diff --git a/.travis/calcrom/calcrom.pl b/.github/calcrom/calcrom.pl similarity index 100% rename from .travis/calcrom/calcrom.pl rename to .github/calcrom/calcrom.pl diff --git a/.travis/calcrom/webhook.sh b/.github/calcrom/webhook.sh similarity index 66% rename from .travis/calcrom/webhook.sh rename to .github/calcrom/webhook.sh index 86da74c87..2a3015969 100755 --- a/.travis/calcrom/webhook.sh +++ b/.github/calcrom/webhook.sh @@ -1,10 +1,5 @@ #!/bin/bash -ex -# Only run this script if it's the master branch build. -if [[ "$TRAVIS_BRANCH" != "master" || "$TRAVIS_PULL_REQUEST" != "false" ]]; then - exit 0 -fi - build_name=$1 map_file=$build_name.map if [ ! -f $map_file ]; then @@ -13,4 +8,4 @@ if [ ! -f $map_file ]; then fi output=$(perl $(dirname "$0")/calcrom.pl $build_name.map | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g') -curl -d "{\"username\": \"$CALCROM_DISCORD_WEBHOOK_USERNAME\", \"avatar_url\": \"$CALCROM_DISCORD_WEBHOOK_AVATAR_URL\", \"content\":\"\`\`\`$build_name progress:\\n$output\`\`\`\"}" -H "Content-Type: application/json" -X POST $CALCROM_DISCORD_WEBHOOK_URL +curl -d "{\"username\": \"$CALCROM_DISCORD_WEBHOOK_USERNAME\", \"avatar_url\": \"$CALCROM_DISCORD_WEBHOOK_AVATAR_URL\", \"content\":\"\`\`\`$build_name progress:\\n$output\`\`\`\"}" -H "Content-Type: application/json" -X POST "$CALCROM_DISCORD_WEBHOOK_URL" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..822b386ea --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + +jobs: + build: + runs-on: ubuntu-18.04 + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Install binutils + run: sudo apt install gcc-arm-none-eabi binutils-arm-none-eabi + # build-essential, git, and libpng-dev are already installed + # gcc-arm-none-eabi is only needed for the modern build + # as an alternative to dkP + + - name: Install agbcc + run: | + git clone https://github.com/pret/agbcc.git + cd agbcc + ./build.sh + ./install.sh ../ + + - name: Compare + run: make -j${nproc} compare + + - name: Modern + run: make -j${nproc} modern + + - name: Webhook + if: ${{ github.event_name == 'push' }} + env: + CALCROM_DISCORD_WEBHOOK_USERNAME: OK + CALCROM_DISCORD_WEBHOOK_AVATAR_URL: https://i.imgur.com/38BQHdd.png + CALCROM_DISCORD_WEBHOOK_URL: ${{ secrets.CALCROM_DISCORD_WEBHOOK_URL }} + run: sh .github/calcrom/webhook.sh pokeemerald diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8d39be503..000000000 --- a/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -language: generic -dist: bionic -sudo: false -env: - global: - - DEVKITPRO=$HOME - - DEVKITARM=$DEVKITPRO/devkitARM -addons: - apt: - packages: - - gcc-multilib - - linux-libc-dev -cache: - apt: true -install: - - pushd $HOME - - travis_retry wget https://github.com/devkitPro/buildscripts/releases/download/devkitARM_r52/devkitARM_r52-linux.tar.xz - - tar xJf devkitARM*.tar.xz - - travis_retry wget https://github.com/devkitPro/devkitarm-rules/releases/download/v1.0.0/devkitarm-rules-1.0.0.tar.xz - - tar xJf devkitarm-rules-*.tar.xz -C $DEVKITARM - - travis_retry git clone https://github.com/pret/agbcc.git - - cd agbcc && ./build.sh && ./install.sh $TRAVIS_BUILD_DIR - - popd -matrix: - include: - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-7 - env: _="Build" - script: - - make -j2 tools CXX=g++-7 - - make -j2 compare - - make -j2 modern -after_success: - - .travis/calcrom/webhook.sh pokeemerald diff --git a/Makefile b/Makefile index 78a2c2a4f..d97634399 100644 --- a/Makefile +++ b/Makefile @@ -303,6 +303,7 @@ $1: $2 $$(shell $(SCANINC) -I include -I "" $2) $$(PREPROC) $$< charmap.txt | $$(CPP) -I include | $$(AS) $$(ASFLAGS) -o $$@ endef $(foreach src, $(REGULAR_DATA_ASM_SRCS), $(eval $(call DATA_ASM_DEP,$(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o, $(src)),$(src)))) +$(foreach src, $(C_ASM_SRCS), $(eval $(call DATA_ASM_DEP,$(patsubst $(C_SUBDIR)/%.s,$(C_BUILDDIR)/%.o, $(src)),$(src)))) endif $(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s diff --git a/asm/macros.inc b/asm/macros.inc index 6782f4200..77f44a847 100644 --- a/asm/macros.inc +++ b/asm/macros.inc @@ -3,7 +3,6 @@ .include "asm/macros/movement.inc" .include "asm/macros/window.inc" .include "asm/macros/pokemon_data.inc" - .include "asm/macros/ec.inc" .include "asm/macros/map.inc" .include "asm/macros/field_effect_script.inc" .include "asm/macros/trainer_hill.inc" diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index aa2a5f878..b9a591e0f 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -510,7 +510,7 @@ .byte \battler .endm - .macro atk57 + .macro endlinkbattle .byte 0x57 .endm diff --git a/asm/macros/ec.inc b/asm/macros/ec.inc deleted file mode 100644 index a70b8e244..000000000 --- a/asm/macros/ec.inc +++ /dev/null @@ -1,19 +0,0 @@ - .macro ec_word word - .2byte EC_WORD_\word - .endm - - .macro ec_move1 name - .2byte (EC_GROUP_MOVE_1 << 9) | MOVE_\name - .endm - - .macro ec_move2 name - .2byte (EC_GROUP_MOVE_2 << 9) | MOVE_\name - .endm - - .macro ec_pokemon1 name - .2byte (EC_GROUP_POKEMON << 9) | SPECIES_\name - .endm - - .macro ec_pokemon2 name - .2byte (EC_GROUP_POKEMON2 << 9) | SPECIES_\name - .endm diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 7b5163bd8..6317bf0b8 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -930,6 +930,17 @@ .4byte \text .endm + @ Formatting for the braille window, to be put at the start of a pointer used by braillemessage. + @ These are from RS and are ignored in Emerald (see ScrCmd_braillemessage, and comment above) + .macro brailleformat winLeft:req, winTop:req, winRight:req, winBottom:req, textLeft:req, textTop:req + .byte \winLeft + .byte \winTop + .byte \winRight + .byte \winBottom + .byte \textLeft + .byte \textTop + .endm + @ Gives the player one of the specified (species) Pokemon at level level holding item. The trailing 0s are unused parameters .macro givemon species:req, level:req, item:req .byte 0x79 @@ -1481,15 +1492,15 @@ .4byte \value .endm - @ Makes the Pokemon in the specified slot of the player's party obedient. It will not randomly disobey orders in battle. - .macro setmonobedient slot:req + @ Sets the Pokemon in the specified slot of the player party's eventLegal bit. + .macro setmoneventlegal slot:req .byte 0xcd .2byte \slot .endm - @ Checks if the Pokemon in the specified slot of the player's party is obedient. If the Pokemon is disobedient, - @ VAR_RESULT is TRUE. If the Pokemon is obedient (or if the specified slot is empty or invalid), VAR_RESULT is FALSE. - .macro checkmonobedience slot:req + @ Checks if the Pokemon in the specified slot of the player's party has its eventLegal bit set. If it isn't set, + @ VAR_RESULT is TRUE. If the bit is set (or if the specified slot is empty or invalid), VAR_RESULT is FALSE. + .macro checkmoneventlegal slot:req .byte 0xce .2byte \slot .endm @@ -1556,11 +1567,11 @@ .2byte \y .endm - .macro cmdD8 + .macro selectapproachingtrainer .byte 0xd8 .endm - .macro cmdD9 + .macro lockfortrainer .byte 0xd9 .endm @@ -1568,7 +1579,7 @@ .byte 0xda .endm - .macro message3 pointer:req + .macro messageinstant pointer:req .byte 0xdb .4byte \pointer .endm diff --git a/common_syms/battle_main.txt b/common_syms/battle_main.txt index 35a925946..f6f02c48d 100644 --- a/common_syms/battle_main.txt +++ b/common_syms/battle_main.txt @@ -6,4 +6,4 @@ gBattlerControllerFuncs gHealthboxSpriteIds gMultiUsePlayerCursor gNumberOfMovesToChoose -gUnknown_03005D7C +gBattleControllerData diff --git a/common_syms/window.txt b/common_syms/window.txt index 87a1679d1..416d9d732 100644 --- a/common_syms/window.txt +++ b/common_syms/window.txt @@ -1,5 +1,5 @@ -filler_03002F58 -filler_03002F5C +gUnusedWindowVar1 +gUnusedWindowVar2 gTransparentTileNumber -filler_03002F64 -gUnknown_03002F70 +gUnusedWindowVar3 +gWindowBgTilemapBuffers diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 44c202c53..b883a4639 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -14477,7 +14477,7 @@ Move_TWINEEDLE: Move_FIRE_BLAST: loadspritegfx ANIM_TAG_SMALL_EMBER - createsoundtask sub_8158B30, SE_M_FLAME_WHEEL, SE_M_FLAME_WHEEL2 + createsoundtask SoundTask_FireBlast, SE_M_FLAME_WHEEL, SE_M_FLAME_WHEEL2 call FireBlastRing call FireBlastRing call FireBlastRing @@ -16252,7 +16252,7 @@ Move_FISSURE: delay 40 restorebg waitbgfadeout - setarg 7, 0xFFFF + setarg 7, -1 waitbgfadein end diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 16bb6e92c..4104f1dd5 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -5132,7 +5132,7 @@ BattleScript_LocalBattleLostDoTrainer2WinText:: BattleScript_LocalBattleLostEnd_:: end2 -BattleScript_82DAA0B:: +BattleScript_FrontierLinkBattleLost:: returnopponentmon1toball BS_ATTACKER waitstate returnopponentmon2toball BS_ATTACKER @@ -5145,23 +5145,23 @@ BattleScript_82DAA0B:: trainerslidein BS_FAINTED waitstate printstring STRINGID_TRAINER2WINTEXT - jumpifbattletype BATTLE_TYPE_RECORDED, BattleScript_82DAA31 - atk57 -BattleScript_82DAA31:: + jumpifbattletype BATTLE_TYPE_RECORDED, BattleScript_FrontierLinkBattleLostEnd + endlinkbattle +BattleScript_FrontierLinkBattleLostEnd:: waitmessage 0x40 end2 BattleScript_LinkBattleWonOrLost:: - jumpifbattletype BATTLE_TYPE_BATTLE_TOWER, BattleScript_82DAA5C + jumpifbattletype BATTLE_TYPE_BATTLE_TOWER, BattleScript_TowerLinkBattleWon printstring STRINGID_BATTLEEND waitmessage 0x40 jumpifbattletype BATTLE_TYPE_RECORDED, BattleScript_LinkBattleWonOrLostWaitEnd - atk57 + endlinkbattle BattleScript_LinkBattleWonOrLostWaitEnd:: waitmessage 0x40 end2 -BattleScript_82DAA5C:: +BattleScript_TowerLinkBattleWon:: playtrainerdefeatbgm BS_ATTACKER printstring STRINGID_BATTLEEND waitmessage 0x40 @@ -5173,9 +5173,9 @@ BattleScript_82DAA5C:: trainerslidein BS_FAINTED waitstate printstring STRINGID_TRAINER2LOSETEXT - jumpifbattletype BATTLE_TYPE_RECORDED, BattleScript_82DAA83 - atk57 -BattleScript_82DAA83:: + jumpifbattletype BATTLE_TYPE_RECORDED, BattleScript_TowerLinkBattleWonEnd + endlinkbattle +BattleScript_TowerLinkBattleWonEnd:: waitmessage 0x40 end2 @@ -7857,7 +7857,7 @@ BattleScript_PrintPlayerForfeited:: BattleScript_PrintPlayerForfeitedLinkBattle:: printstring STRINGID_FORFEITEDMATCH waitmessage 0x40 - atk57 + endlinkbattle waitmessage 0x40 end2 diff --git a/data/image_processing_effects.s b/data/image_processing_effects.s deleted file mode 100644 index b319b4023..000000000 --- a/data/image_processing_effects.s +++ /dev/null @@ -1,308 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2, 0 - -gPointillismPoints:: @ 85A1F94 - .byte 0x00, 0x1d, 0x1c, 0x0e, 0x1e, 0x1b, 0x00, 0x01, 0x32, 0x2e, 0x1e, 0x37, 0x0a, 0x22, 0x1f, 0x05, 0x26, 0x2e, 0x12, 0x17, 0x1e, 0x1a, 0x03, 0x11, 0x05, 0x11, 0x18, 0x05, 0x27, 0x2f, 0x1a, 0x3f - .byte 0x12, 0x22, 0x3f, 0x16, 0x2b, 0x2f, 0x2e, 0x11, 0x02, 0x2d, 0x23, 0x0d, 0x28, 0x17, 0x0c, 0x19, 0x2f, 0x0e, 0x13, 0x30, 0x18, 0x20, 0x2d, 0x28, 0x22, 0x01, 0x03, 0x19, 0x0e, 0x2a, 0x2b, 0x22 - .byte 0x15, 0x25, 0x22, 0x0a, 0x26, 0x39, 0x06, 0x23, 0x16, 0x07, 0x2f, 0x22, 0x3a, 0x1b, 0x3b, 0x36, 0x35, 0x0a, 0x2b, 0x24, 0x36, 0x09, 0x12, 0x1c, 0x2f, 0x23, 0x2e, 0x38, 0x2c, 0x05, 0x2a, 0x20 - .byte 0x07, 0x14, 0x32, 0x31, 0x08, 0x17, 0x1a, 0x24, 0x2d, 0x22, 0x0a, 0x16, 0x1b, 0x26, 0x2b, 0x29, 0x16, 0x11, 0x35, 0x08, 0x14, 0x1e, 0x08, 0x14, 0x05, 0x31, 0x14, 0x38, 0x31, 0x17, 0x34, 0x33 - .byte 0x12, 0x11, 0x09, 0x1f, 0x28, 0x3d, 0x32, 0x35, 0x03, 0x1e, 0x3c, 0x2b, 0x2e, 0x10, 0x01, 0x17, 0x03, 0x3e, 0x22, 0x17, 0x18, 0x34, 0x08, 0x29, 0x19, 0x03, 0x24, 0x28, 0x3d, 0x33, 0x2f, 0x31 - .byte 0x24, 0x19, 0x1b, 0x18, 0x26, 0x07, 0x0d, 0x25, 0x2d, 0x3f, 0x12, 0x2f, 0x15, 0x25, 0x29, 0x0f, 0x12, 0x07, 0x2c, 0x12, 0x2c, 0x0b, 0x26, 0x12, 0x1a, 0x16, 0x00, 0x0b, 0x2f, 0x16, 0x35, 0x24 - .byte 0x1f, 0x1c, 0x22, 0x29, 0x33, 0x27, 0x3b, 0x30, 0x17, 0x11, 0x06, 0x35, 0x3e, 0x31, 0x2f, 0x11, 0x3a, 0x25, 0x2a, 0x02, 0x19, 0x33, 0x18, 0x35, 0x2a, 0x20, 0x21, 0x2e, 0x32, 0x1b, 0x3b, 0x1f - .byte 0x23, 0x39, 0x29, 0x2a, 0x2e, 0x31, 0x29, 0x2a, 0x0e, 0x2d, 0x2d, 0x00, 0x1f, 0x38, 0x28, 0x1b, 0x14, 0x3b, 0x2b, 0x2e, 0x04, 0x26, 0x36, 0x30, 0x11, 0x3b, 0x21, 0x2d, 0x2b, 0x3f, 0x1b, 0x20 - .byte 0x13, 0x31, 0x33, 0x0c, 0x30, 0x22, 0x2b, 0x2b, 0x16, 0x02, 0x1e, 0x1c, 0x12, 0x1c, 0x0f, 0x3c, 0x36, 0x38, 0x10, 0x2d, 0x18, 0x2f, 0x2d, 0x35, 0x3b, 0x11, 0x37, 0x31, 0x13, 0x13, 0x3d, 0x2f - .byte 0x1e, 0x2c, 0x33, 0x2e, 0x37, 0x12, 0x3c, 0x1f, 0x33, 0x32, 0x2a, 0x27, 0x0d, 0x3b, 0x1c, 0x35, 0x2a, 0x27, 0x09, 0x3d, 0x27, 0x12, 0x0b, 0x18, 0x0c, 0x15, 0x1d, 0x20, 0x01, 0x1c, 0x08, 0x3b - .byte 0x1c, 0x12, 0x37, 0x33, 0x15, 0x03, 0x2c, 0x2a, 0x3b, 0x31, 0x0f, 0x04, 0x35, 0x08, 0x17, 0x33, 0x38, 0x3d, 0x2a, 0x2f, 0x35, 0x16, 0x10, 0x35, 0x16, 0x23, 0x13, 0x2c, 0x2f, 0x06, 0x20, 0x27 - .byte 0x3a, 0x24, 0x00, 0x1c, 0x2a, 0x03, 0x39, 0x1d, 0x28, 0x07, 0x1a, 0x20, 0x0a, 0x37, 0x07, 0x35, 0x2d, 0x15, 0x2f, 0x2c, 0x10, 0x2c, 0x23, 0x3f, 0x29, 0x14, 0x2a, 0x21, 0x36, 0x34, 0x1a, 0x2c - .byte 0x1c, 0x3d, 0x33, 0x38, 0x2b, 0x22, 0x35, 0x28, 0x1f, 0x3d, 0x0f, 0x1c, 0x1e, 0x3e, 0x1b, 0x0c, 0x3e, 0x1f, 0x2b, 0x31, 0x2c, 0x32, 0x39, 0x11, 0x05, 0x09, 0x11, 0x04, 0x38, 0x2a, 0x32, 0x00 - .byte 0x16, 0x13, 0x0b, 0x31, 0x34, 0x2a, 0x13, 0x2c, 0x22, 0x21, 0x39, 0x2f, 0x15, 0x37, 0x28, 0x1e, 0x07, 0x3b, 0x2d, 0x11, 0x03, 0x28, 0x2d, 0x30, 0x1e, 0x31, 0x11, 0x11, 0x23, 0x01, 0x1e, 0x3d - .byte 0x31, 0x34, 0x1c, 0x02, 0x34, 0x21, 0x0e, 0x25, 0x3d, 0x07, 0x17, 0x33, 0x15, 0x10, 0x29, 0x32, 0x32, 0x18, 0x1f, 0x30, 0x2d, 0x3b, 0x30, 0x27, 0x3e, 0x16, 0x31, 0x15, 0x12, 0x30, 0x25, 0x17 - .byte 0x33, 0x06, 0x34, 0x00, 0x29, 0x18, 0x3c, 0x03, 0x12, 0x2c, 0x0c, 0x11, 0x09, 0x30, 0x30, 0x10, 0x0e, 0x11, 0x27, 0x16, 0x1b, 0x0c, 0x3b, 0x2e, 0x2b, 0x33, 0x1e, 0x13, 0x2d, 0x2d, 0x11, 0x24 - .byte 0x29, 0x34, 0x3e, 0x2b, 0x24, 0x1e, 0x21, 0x27, 0x1a, 0x2d, 0x04, 0x39, 0x16, 0x3e, 0x33, 0x26, 0x1b, 0x2e, 0x25, 0x0c, 0x06, 0x19, 0x25, 0x19, 0x18, 0x1d, 0x33, 0x33, 0x1d, 0x28, 0x2d, 0x1c - .byte 0x10, 0x2a, 0x1f, 0x35, 0x1e, 0x34, 0x02, 0x10, 0x2b, 0x3a, 0x14, 0x0d, 0x0b, 0x15, 0x0c, 0x2c, 0x10, 0x37, 0x3a, 0x19, 0x06, 0x13, 0x17, 0x24, 0x10, 0x25, 0x24, 0x04, 0x1e, 0x00, 0x35, 0x34 - .byte 0x3a, 0x00, 0x37, 0x3c, 0x07, 0x1a, 0x2b, 0x28, 0x36, 0x34, 0x39, 0x2f, 0x28, 0x09, 0x1f, 0x38, 0x31, 0x30, 0x16, 0x25, 0x31, 0x18, 0x28, 0x31, 0x18, 0x0c, 0x22, 0x06, 0x39, 0x2d, 0x3d, 0x20 - .byte 0x24, 0x2e, 0x27, 0x21, 0x3e, 0x18, 0x18, 0x15, 0x3c, 0x24, 0x06, 0x1b, 0x26, 0x15, 0x0e, 0x22, 0x0a, 0x0d, 0x1f, 0x18, 0x16, 0x34, 0x10, 0x28, 0x21, 0x20, 0x11, 0x11, 0x36, 0x32, 0x15, 0x3b - .byte 0x2e, 0x24, 0x1f, 0x2d, 0x12, 0x36, 0x2e, 0x20, 0x0b, 0x17, 0x33, 0x26, 0x03, 0x1f, 0x08, 0x19, 0x31, 0x2a, 0x18, 0x25, 0x35, 0x2d, 0x2d, 0x30, 0x38, 0x18, 0x1c, 0x25, 0x14, 0x1c, 0x22, 0x28 - .byte 0x08, 0x23, 0x21, 0x26, 0x1e, 0x30, 0x19, 0x0f, 0x15, 0x10, 0x2f, 0x22, 0x12, 0x02, 0x25, 0x3c, 0x01, 0x1d, 0x0e, 0x14, 0x18, 0x0d, 0x18, 0x17, 0x22, 0x0b, 0x31, 0x13, 0x34, 0x21, 0x0f, 0x2d - .byte 0x36, 0x39, 0x1f, 0x25, 0x18, 0x10, 0x1f, 0x2d, 0x20, 0x20, 0x19, 0x0b, 0x31, 0x33, 0x13, 0x14, 0x2e, 0x11, 0x21, 0x2d, 0x0a, 0x37, 0x07, 0x15, 0x1b, 0x32, 0x04, 0x32, 0x06, 0x18, 0x1b, 0x13 - .byte 0x24, 0x12, 0x36, 0x22, 0x16, 0x1d, 0x29, 0x1c, 0x35, 0x17, 0x21, 0x36, 0x17, 0x2b, 0x35, 0x32, 0x19, 0x2a, 0x0f, 0x2e, 0x10, 0x00, 0x34, 0x02, 0x0e, 0x28, 0x31, 0x32, 0x32, 0x3b, 0x05, 0x20 - .byte 0x36, 0x26, 0x12, 0x34, 0x06, 0x34, 0x1e, 0x31, 0x32, 0x35, 0x05, 0x34, 0x1e, 0x13, 0x15, 0x15, 0x14, 0x2c, 0x29, 0x1c, 0x18, 0x24, 0x24, 0x12, 0x22, 0x29, 0x18, 0x34, 0x36, 0x30, 0x1e, 0x01 - .byte 0x23, 0x0c, 0x3c, 0x24, 0x0a, 0x3d, 0x16, 0x27, 0x1e, 0x23, 0x15, 0x02, 0x12, 0x11, 0x19, 0x2a, 0x1d, 0x31, 0x15, 0x03, 0x3b, 0x2a, 0x21, 0x19, 0x2c, 0x0a, 0x23, 0x11, 0x25, 0x11, 0x1a, 0x1a - .byte 0x0a, 0x34, 0x3b, 0x0b, 0x33, 0x21, 0x0b, 0x37, 0x01, 0x31, 0x28, 0x35, 0x1d, 0x27, 0x2c, 0x30, 0x31, 0x2e, 0x39, 0x2d, 0x30, 0x05, 0x2c, 0x12, 0x2a, 0x2b, 0x39, 0x22, 0x20, 0x15, 0x34, 0x1c - .byte 0x1c, 0x01, 0x15, 0x20, 0x16, 0x22, 0x13, 0x04, 0x18, 0x1e, 0x13, 0x10, 0x25, 0x33, 0x15, 0x39, 0x03, 0x31, 0x3f, 0x36, 0x18, 0x14, 0x23, 0x10, 0x2f, 0x1e, 0x1f, 0x1f, 0x17, 0x2c, 0x02, 0x16 - .byte 0x31, 0x20, 0x18, 0x30, 0x2e, 0x18, 0x37, 0x3b, 0x0e, 0x30, 0x10, 0x39, 0x24, 0x26, 0x39, 0x1e, 0x30, 0x26, 0x2e, 0x12, 0x01, 0x14, 0x37, 0x2a, 0x2e, 0x21, 0x06, 0x1d, 0x2a, 0x16, 0x32, 0x09 - .byte 0x38, 0x1c, 0x07, 0x22, 0x17, 0x3b, 0x2d, 0x15, 0x07, 0x1e, 0x2e, 0x1b, 0x2e, 0x1d, 0x04, 0x09, 0x30, 0x30, 0x2d, 0x37, 0x2d, 0x34, 0x24, 0x18, 0x24, 0x25, 0x0e, 0x2d, 0x26, 0x23, 0x0a, 0x16 - .byte 0x12, 0x2d, 0x11, 0x21, 0x28, 0x2e, 0x0f, 0x01, 0x21, 0x01, 0x31, 0x12, 0x3f, 0x1b, 0x1e, 0x21, 0x25, 0x2b, 0x26, 0x18, 0x13, 0x15, 0x2d, 0x34, 0x23, 0x21, 0x36, 0x0e, 0x2e, 0x1c, 0x14, 0x22 - .byte 0x1c, 0x2c, 0x0b, 0x28, 0x1a, 0x18, 0x21, 0x21, 0x07, 0x1a, 0x24, 0x26, 0x29, 0x2b, 0x0a, 0x34, 0x3e, 0x27, 0x33, 0x12, 0x34, 0x1b, 0x1f, 0x01, 0x2a, 0x2e, 0x06, 0x23, 0x2f, 0x1f, 0x14, 0x18 - .byte 0x06, 0x26, 0x31, 0x1f, 0x2b, 0x22, 0x26, 0x2e, 0x1e, 0x15, 0x16, 0x20, 0x22, 0x28, 0x15, 0x37, 0x12, 0x25, 0x04, 0x2c, 0x1f, 0x04, 0x2e, 0x0c, 0x13, 0x18, 0x07, 0x0b, 0x36, 0x1d, 0x1c, 0x2a - .byte 0x30, 0x22, 0x1c, 0x2e, 0x12, 0x2f, 0x2b, 0x21, 0x1e, 0x16, 0x38, 0x30, 0x04, 0x02, 0x16, 0x05, 0x14, 0x20, 0x38, 0x3c, 0x33, 0x21, 0x1b, 0x2f, 0x14, 0x2a, 0x27, 0x38, 0x14, 0x1b, 0x2b, 0x1f - .byte 0x2b, 0x29, 0x2b, 0x25, 0x27, 0x36, 0x21, 0x11, 0x22, 0x1b, 0x29, 0x03, 0x1b, 0x18, 0x24, 0x28, 0x21, 0x2d, 0x36, 0x3c, 0x2c, 0x24, 0x33, 0x17, 0x1f, 0x2a, 0x3a, 0x21, 0x0a, 0x23, 0x37, 0x00 - .byte 0x0b, 0x21, 0x11, 0x38, 0x19, 0x0f, 0x0e, 0x1c, 0x1f, 0x0f, 0x37, 0x3c, 0x10, 0x37, 0x38, 0x31, 0x35, 0x07, 0x15, 0x28, 0x1e, 0x2e, 0x19, 0x26, 0x10, 0x33, 0x3d, 0x35, 0x2f, 0x3a, 0x04, 0x34 - .byte 0x0d, 0x18, 0x1a, 0x01, 0x2d, 0x15, 0x3d, 0x1a, 0x17, 0x17, 0x3f, 0x32, 0x0b, 0x21, 0x11, 0x1e, 0x26, 0x2b, 0x0d, 0x19, 0x24, 0x2e, 0x04, 0x1b, 0x1b, 0x33, 0x20, 0x15, 0x21, 0x1d, 0x1f, 0x04 - .byte 0x21, 0x0f, 0x12, 0x1f, 0x2d, 0x2a, 0x32, 0x03, 0x37, 0x1f, 0x35, 0x07, 0x27, 0x24, 0x1f, 0x31, 0x2f, 0x30, 0x15, 0x06, 0x00, 0x24, 0x0b, 0x22, 0x1a, 0x0c, 0x3b, 0x29, 0x14, 0x1a, 0x17, 0x37 - .byte 0x20, 0x25, 0x3f, 0x26, 0x37, 0x3a, 0x3e, 0x10, 0x22, 0x04, 0x11, 0x28, 0x12, 0x1c, 0x03, 0x2e, 0x2e, 0x0e, 0x38, 0x28, 0x01, 0x29, 0x22, 0x1e, 0x33, 0x19, 0x06, 0x21, 0x27, 0x33, 0x19, 0x1a - .byte 0x02, 0x05, 0x17, 0x11, 0x11, 0x2c, 0x1f, 0x26, 0x1e, 0x39, 0x1f, 0x28, 0x2e, 0x2f, 0x12, 0x22, 0x34, 0x13, 0x3b, 0x26, 0x2f, 0x34, 0x00, 0x14, 0x10, 0x31, 0x11, 0x1d, 0x2d, 0x2a, 0x08, 0x08 - .byte 0x37, 0x15, 0x18, 0x34, 0x04, 0x2b, 0x24, 0x2f, 0x1e, 0x27, 0x22, 0x2a, 0x24, 0x07, 0x14, 0x25, 0x01, 0x27, 0x19, 0x29, 0x0a, 0x29, 0x3d, 0x1c, 0x2f, 0x0d, 0x1f, 0x1c, 0x24, 0x3d, 0x32, 0x36 - .byte 0x1d, 0x24, 0x14, 0x21, 0x16, 0x1a, 0x0d, 0x29, 0x3f, 0x2b, 0x2a, 0x1a, 0x3e, 0x35, 0x11, 0x28, 0x18, 0x32, 0x05, 0x15, 0x21, 0x2e, 0x34, 0x2d, 0x14, 0x2a, 0x3c, 0x08, 0x37, 0x3f, 0x34, 0x1e - .byte 0x27, 0x24, 0x1c, 0x16, 0x16, 0x33, 0x29, 0x3b, 0x19, 0x36, 0x2f, 0x1c, 0x03, 0x25, 0x2c, 0x0b, 0x16, 0x36, 0x1c, 0x1d, 0x1b, 0x2c, 0x27, 0x1b, 0x0b, 0x1f, 0x2b, 0x08, 0x10, 0x27, 0x3f, 0x25 - .byte 0x2f, 0x33, 0x13, 0x1f, 0x04, 0x31, 0x37, 0x0e, 0x2f, 0x12, 0x08, 0x23, 0x20, 0x3a, 0x1a, 0x1e, 0x2f, 0x0b, 0x1f, 0x1e, 0x20, 0x19, 0x23, 0x3b, 0x14, 0x25, 0x00, 0x27, 0x14, 0x04, 0x25, 0x36 - .byte 0x1a, 0x2b, 0x27, 0x21, 0x15, 0x28, 0x13, 0x2c, 0x0e, 0x3c, 0x35, 0x0c, 0x2d, 0x2b, 0x37, 0x16, 0x15, 0x29, 0x15, 0x1d, 0x17, 0x34, 0x36, 0x09, 0x0a, 0x31, 0x37, 0x22, 0x28, 0x17, 0x2b, 0x35 - .byte 0x14, 0x2b, 0x12, 0x08, 0x13, 0x1f, 0x31, 0x13, 0x28, 0x06, 0x07, 0x35, 0x23, 0x3a, 0x29, 0x0f, 0x24, 0x2e, 0x07, 0x35, 0x26, 0x0e, 0x12, 0x15, 0x23, 0x33, 0x2c, 0x0e, 0x21, 0x26, 0x1c, 0x12 - .byte 0x25, 0x23, 0x1d, 0x2f, 0x04, 0x35, 0x33, 0x16, 0x01, 0x24, 0x3d, 0x2c, 0x2e, 0x35, 0x0a, 0x25, 0x11, 0x13, 0x25, 0x1b, 0x1b, 0x15, 0x15, 0x39, 0x10, 0x0b, 0x35, 0x24, 0x3a, 0x27, 0x30, 0x2e - .byte 0x2f, 0x15, 0x10, 0x1f, 0x35, 0x1b, 0x28, 0x35, 0x26, 0x30, 0x37, 0x34, 0x37, 0x2b, 0x0f, 0x30, 0x29, 0x2e, 0x3f, 0x2b, 0x38, 0x34, 0x2b, 0x2b, 0x2f, 0x25, 0x0d, 0x28, 0x2a, 0x33, 0x18, 0x10 - .byte 0x21, 0x12, 0x11, 0x1f, 0x22, 0x34, 0x11, 0x25, 0x23, 0x21, 0x3f, 0x11, 0x26, 0x27, 0x25, 0x28, 0x36, 0x12, 0x15, 0x26, 0x32, 0x11, 0x18, 0x24, 0x32, 0x25, 0x37, 0x27, 0x3a, 0x33, 0x35, 0x07 - .byte 0x1c, 0x1a, 0x0e, 0x2a, 0x1e, 0x2f, 0x1f, 0x00, 0x2e, 0x21, 0x1b, 0x3c, 0x14, 0x2f, 0x3a, 0x2f, 0x3e, 0x38, 0x15, 0x1a, 0x13, 0x2f, 0x29, 0x0d, 0x2f, 0x37, 0x17, 0x18, 0x30, 0x1c, 0x35, 0x15 - .byte 0x34, 0x14, 0x28, 0x11, 0x2c, 0x2c, 0x25, 0x2a, 0x20, 0x3f, 0x28, 0x0c, 0x34, 0x1b, 0x30, 0x2e, 0x25, 0x37, 0x1c, 0x24, 0x1f, 0x25, 0x26, 0x0c, 0x19, 0x34, 0x18, 0x10, 0x35, 0x0a, 0x13, 0x11 - .byte 0x25, 0x13, 0x20, 0x13, 0x19, 0x11, 0x20, 0x28, 0x1d, 0x3e, 0x30, 0x1b, 0x23, 0x24, 0x21, 0x0d, 0x23, 0x23, 0x1d, 0x28, 0x2e, 0x2d, 0x12, 0x1f, 0x0e, 0x2e, 0x2b, 0x0b, 0x31, 0x32, 0x24, 0x3c - .byte 0x2c, 0x13, 0x3c, 0x12, 0x28, 0x16, 0x2a, 0x05, 0x0c, 0x32, 0x39, 0x0b, 0x32, 0x21, 0x04, 0x14, 0x10, 0x31, 0x32, 0x12, 0x1f, 0x23, 0x39, 0x2e, 0x2e, 0x22, 0x3d, 0x27, 0x0c, 0x1e, 0x18, 0x25 - .byte 0x00, 0x17, 0x06, 0x31, 0x14, 0x13, 0x21, 0x1a, 0x14, 0x20, 0x35, 0x0a, 0x3b, 0x25, 0x33, 0x08, 0x28, 0x3d, 0x02, 0x33, 0x23, 0x00, 0x13, 0x22, 0x21, 0x28, 0x30, 0x14, 0x2e, 0x14, 0x32, 0x36 - .byte 0x39, 0x23, 0x1e, 0x1c, 0x11, 0x30, 0x37, 0x16, 0x30, 0x15, 0x31, 0x1f, 0x34, 0x28, 0x2c, 0x35, 0x05, 0x29, 0x37, 0x33, 0x2a, 0x1c, 0x17, 0x2e, 0x10, 0x06, 0x16, 0x32, 0x1f, 0x2f, 0x00, 0x29 - .byte 0x1e, 0x04, 0x01, 0x16, 0x3b, 0x23, 0x1e, 0x1b, 0x34, 0x2a, 0x30, 0x11, 0x2b, 0x03, 0x00, 0x1f, 0x1d, 0x37, 0x1a, 0x3a, 0x18, 0x25, 0x1c, 0x16, 0x2c, 0x04, 0x3f, 0x33, 0x26, 0x23, 0x2d, 0x15 - .byte 0x2c, 0x27, 0x02, 0x35, 0x27, 0x07, 0x35, 0x33, 0x1a, 0x0c, 0x10, 0x28, 0x26, 0x2c, 0x2f, 0x36, 0x16, 0x37, 0x0b, 0x27, 0x1b, 0x3d, 0x18, 0x27, 0x1f, 0x20, 0x2b, 0x2a, 0x33, 0x0b, 0x0f, 0x20 - .byte 0x35, 0x3c, 0x2f, 0x33, 0x21, 0x15, 0x2d, 0x26, 0x34, 0x1f, 0x1a, 0x21, 0x2f, 0x2c, 0x2a, 0x1a, 0x32, 0x1a, 0x3b, 0x3f, 0x21, 0x13, 0x3f, 0x13, 0x0f, 0x24, 0x22, 0x14, 0x1b, 0x10, 0x21, 0x06 - .byte 0x28, 0x25, 0x34, 0x10, 0x2e, 0x0e, 0x14, 0x3c, 0x3e, 0x25, 0x16, 0x06, 0x30, 0x0b, 0x04, 0x1f, 0x3e, 0x02, 0x24, 0x0c, 0x17, 0x25, 0x2b, 0x3c, 0x2d, 0x15, 0x36, 0x33, 0x18, 0x23, 0x2a, 0x1d - .byte 0x10, 0x2a, 0x35, 0x17, 0x28, 0x00, 0x37, 0x24, 0x0a, 0x3b, 0x15, 0x1d, 0x0b, 0x1f, 0x3c, 0x31, 0x25, 0x1d, 0x0f, 0x1d, 0x20, 0x13, 0x34, 0x11, 0x2b, 0x2e, 0x23, 0x0c, 0x2e, 0x24, 0x02, 0x14 - .byte 0x31, 0x16, 0x19, 0x0e, 0x23, 0x35, 0x1a, 0x10, 0x16, 0x14, 0x04, 0x19, 0x2d, 0x27, 0x37, 0x33, 0x02, 0x31, 0x02, 0x04, 0x16, 0x0d, 0x22, 0x25, 0x25, 0x00, 0x16, 0x2a, 0x3f, 0x26, 0x20, 0x0c - .byte 0x12, 0x2f, 0x2e, 0x35, 0x1b, 0x0d, 0x22, 0x1e, 0x01, 0x34, 0x05, 0x22, 0x21, 0x34, 0x2a, 0x32, 0x0b, 0x09, 0x1d, 0x3f, 0x32, 0x2f, 0x3d, 0x18, 0x2d, 0x0b, 0x38, 0x36, 0x39, 0x17, 0x28, 0x34 - .byte 0x04, 0x24, 0x36, 0x0e, 0x2a, 0x38, 0x01, 0x14, 0x3c, 0x24, 0x22, 0x21, 0x03, 0x18, 0x32, 0x2f, 0x12, 0x29, 0x24, 0x31, 0x0a, 0x3b, 0x12, 0x1a, 0x1c, 0x20, 0x30, 0x31, 0x1b, 0x1a, 0x21, 0x10 - .byte 0x05, 0x29, 0x10, 0x26, 0x2d, 0x13, 0x16, 0x0c, 0x1d, 0x2b, 0x06, 0x1b, 0x06, 0x12, 0x14, 0x38, 0x0f, 0x35, 0x23, 0x3a, 0x2c, 0x00, 0x19, 0x33, 0x29, 0x14, 0x2d, 0x2a, 0x21, 0x29, 0x14, 0x31 - .byte 0x14, 0x1a, 0x06, 0x1e, 0x18, 0x1b, 0x28, 0x3b, 0x16, 0x29, 0x15, 0x1e, 0x12, 0x34, 0x0a, 0x14, 0x1b, 0x05, 0x27, 0x0b, 0x01, 0x26, 0x2a, 0x22, 0x35, 0x21, 0x20, 0x18, 0x20, 0x37, 0x17, 0x14 - .byte 0x1f, 0x11, 0x1d, 0x11, 0x25, 0x24, 0x2b, 0x2f, 0x07, 0x3f, 0x1f, 0x2c, 0x25, 0x25, 0x2a, 0x29, 0x18, 0x11, 0x24, 0x28, 0x31, 0x2c, 0x2a, 0x39, 0x0b, 0x26, 0x28, 0x10, 0x26, 0x22, 0x06, 0x16 - .byte 0x09, 0x2c, 0x13, 0x34, 0x19, 0x15, 0x3a, 0x12, 0x21, 0x1d, 0x38, 0x23, 0x12, 0x25, 0x24, 0x21, 0x30, 0x12, 0x37, 0x1a, 0x12, 0x24, 0x3b, 0x25, 0x32, 0x15, 0x23, 0x0d, 0x1a, 0x10, 0x16, 0x2e - .byte 0x26, 0x1d, 0x14, 0x16, 0x3e, 0x2e, 0x1f, 0x0a, 0x16, 0x10, 0x1d, 0x30, 0x2b, 0x04, 0x3a, 0x19, 0x08, 0x2d, 0x2e, 0x28, 0x1e, 0x33, 0x0a, 0x12, 0x2e, 0x0d, 0x03, 0x2f, 0x26, 0x3a, 0x1e, 0x35 - .byte 0x3b, 0x2a, 0x03, 0x1a, 0x18, 0x3f, 0x0b, 0x27, 0x04, 0x05, 0x34, 0x36, 0x0b, 0x27, 0x3b, 0x17, 0x11, 0x0d, 0x27, 0x26, 0x2c, 0x1f, 0x20, 0x26, 0x10, 0x20, 0x25, 0x23, 0x2d, 0x37, 0x09, 0x13 - .byte 0x14, 0x17, 0x2d, 0x2e, 0x3d, 0x23, 0x1d, 0x1a, 0x1f, 0x21, 0x33, 0x2e, 0x28, 0x17, 0x13, 0x26, 0x3c, 0x36, 0x14, 0x1a, 0x33, 0x32, 0x20, 0x2b, 0x19, 0x3e, 0x20, 0x0c, 0x02, 0x2d, 0x3c, 0x3c - .byte 0x2a, 0x30, 0x30, 0x28, 0x25, 0x3f, 0x1e, 0x03, 0x17, 0x1e, 0x35, 0x11, 0x1c, 0x1b, 0x14, 0x2a, 0x28, 0x3a, 0x23, 0x0e, 0x1f, 0x12, 0x36, 0x21, 0x20, 0x07, 0x3b, 0x10, 0x23, 0x19, 0x34, 0x0d - .byte 0x2e, 0x18, 0x3f, 0x20, 0x25, 0x3e, 0x3b, 0x15, 0x0b, 0x2e, 0x12, 0x37, 0x0b, 0x23, 0x3d, 0x32, 0x1f, 0x16, 0x03, 0x27, 0x14, 0x0c, 0x21, 0x18, 0x03, 0x30, 0x3e, 0x21, 0x13, 0x0f, 0x00, 0x32 - .byte 0x3f, 0x23, 0x16, 0x0e, 0x31, 0x1d, 0x18, 0x1c, 0x1d, 0x30, 0x0e, 0x1e, 0x21, 0x20, 0x23, 0x3f, 0x0c, 0x1e, 0x14, 0x33, 0x22, 0x22, 0x21, 0x15, 0x36, 0x05, 0x1e, 0x1d, 0x31, 0x14, 0x20, 0x11 - .byte 0x37, 0x0d, 0x33, 0x19, 0x25, 0x05, 0x36, 0x1e, 0x31, 0x20, 0x35, 0x3a, 0x2f, 0x32, 0x2f, 0x30, 0x14, 0x23, 0x2d, 0x35, 0x1e, 0x29, 0x05, 0x05, 0x1b, 0x09, 0x1f, 0x26, 0x2f, 0x0b, 0x15, 0x15 - .byte 0x11, 0x13, 0x29, 0x1b, 0x18, 0x1c, 0x13, 0x35, 0x34, 0x31, 0x23, 0x27, 0x3f, 0x2f, 0x09, 0x30, 0x19, 0x23, 0x12, 0x34, 0x02, 0x2a, 0x21, 0x09, 0x3c, 0x1d, 0x0c, 0x02, 0x10, 0x22, 0x05, 0x17 - .byte 0x22, 0x08, 0x1b, 0x0a, 0x0f, 0x15, 0x02, 0x11, 0x13, 0x01, 0x21, 0x22, 0x16, 0x39, 0x33, 0x24, 0x38, 0x34, 0x0f, 0x1e, 0x2b, 0x2b, 0x15, 0x15, 0x20, 0x22, 0x2e, 0x3a, 0x3f, 0x31, 0x1a, 0x27 - .byte 0x2b, 0x29, 0x34, 0x14, 0x16, 0x39, 0x2f, 0x13, 0x3e, 0x16, 0x36, 0x21, 0x30, 0x00, 0x24, 0x2b, 0x24, 0x21, 0x30, 0x15, 0x31, 0x13, 0x10, 0x37, 0x24, 0x08, 0x07, 0x23, 0x21, 0x09, 0x25, 0x05 - .byte 0x3c, 0x32, 0x19, 0x03, 0x25, 0x0f, 0x29, 0x2b, 0x16, 0x07, 0x13, 0x3e, 0x3d, 0x25, 0x36, 0x0b, 0x28, 0x2e, 0x2b, 0x16, 0x0c, 0x31, 0x11, 0x30, 0x13, 0x2d, 0x26, 0x3e, 0x37, 0x29, 0x2f, 0x2e - .byte 0x15, 0x3d, 0x17, 0x1c, 0x2e, 0x21, 0x33, 0x2f, 0x10, 0x0d, 0x05, 0x1d, 0x1c, 0x1a, 0x12, 0x0e, 0x18, 0x37, 0x1b, 0x11, 0x14, 0x06, 0x14, 0x21, 0x31, 0x0e, 0x27, 0x1a, 0x03, 0x10, 0x00, 0x34 - .byte 0x31, 0x3f, 0x0b, 0x1d, 0x0f, 0x12, 0x1f, 0x1a, 0x15, 0x10, 0x0f, 0x00, 0x24, 0x3e, 0x0a, 0x2a, 0x30, 0x2b, 0x24, 0x26, 0x31, 0x10, 0x2d, 0x2f, 0x2f, 0x3f, 0x0c, 0x13, 0x12, 0x0b, 0x16, 0x15 - .byte 0x07, 0x1f, 0x28, 0x10, 0x32, 0x0f, 0x17, 0x15, 0x0b, 0x27, 0x33, 0x34, 0x1d, 0x10, 0x1c, 0x3a, 0x12, 0x2c, 0x27, 0x37, 0x0a, 0x1a, 0x32, 0x05, 0x1f, 0x21, 0x24, 0x0d, 0x1f, 0x1c, 0x17, 0x24 - .byte 0x2f, 0x3b, 0x32, 0x3b, 0x25, 0x10, 0x03, 0x2f, 0x21, 0x0c, 0x10, 0x23, 0x0e, 0x3a, 0x2c, 0x33, 0x03, 0x2c, 0x12, 0x06, 0x1c, 0x2a, 0x37, 0x30, 0x3f, 0x01, 0x1e, 0x35, 0x16, 0x37, 0x2c, 0x32 - .byte 0x35, 0x05, 0x11, 0x22, 0x29, 0x09, 0x20, 0x2b, 0x0d, 0x1f, 0x18, 0x0d, 0x20, 0x23, 0x39, 0x16, 0x0f, 0x3a, 0x18, 0x21, 0x35, 0x2b, 0x36, 0x26, 0x2b, 0x23, 0x05, 0x2f, 0x1b, 0x08, 0x17, 0x3e - .byte 0x09, 0x16, 0x2d, 0x3a, 0x37, 0x15, 0x35, 0x35, 0x29, 0x0a, 0x12, 0x02, 0x39, 0x1f, 0x14, 0x34, 0x33, 0x17, 0x1d, 0x18, 0x16, 0x1d, 0x1a, 0x01, 0x39, 0x22, 0x1e, 0x27, 0x36, 0x32, 0x14, 0x26 - .byte 0x0a, 0x39, 0x36, 0x1f, 0x0d, 0x1e, 0x0b, 0x0a, 0x19, 0x35, 0x1d, 0x34, 0x03, 0x12, 0x16, 0x0c, 0x13, 0x2e, 0x0c, 0x34, 0x1e, 0x10, 0x14, 0x1e, 0x23, 0x32, 0x27, 0x02, 0x10, 0x29, 0x35, 0x18 - .byte 0x33, 0x33, 0x1d, 0x1a, 0x3c, 0x15, 0x23, 0x3e, 0x3f, 0x22, 0x2a, 0x02, 0x2c, 0x28, 0x0a, 0x2f, 0x1a, 0x06, 0x35, 0x3c, 0x17, 0x2b, 0x03, 0x12, 0x17, 0x2f, 0x0a, 0x26, 0x12, 0x38, 0x11, 0x36 - .byte 0x1b, 0x23, 0x01, 0x39, 0x35, 0x19, 0x19, 0x17, 0x09, 0x28, 0x22, 0x1e, 0x27, 0x2c, 0x35, 0x33, 0x2c, 0x27, 0x25, 0x31, 0x06, 0x31, 0x2d, 0x1a, 0x39, 0x28, 0x2d, 0x04, 0x1e, 0x24, 0x3e, 0x1c - .byte 0x3c, 0x30, 0x1b, 0x3f, 0x3e, 0x37, 0x22, 0x36, 0x11, 0x00, 0x01, 0x1c, 0x12, 0x1a, 0x10, 0x12, 0x1e, 0x2c, 0x1f, 0x12, 0x2a, 0x2f, 0x06, 0x19, 0x35, 0x1a, 0x18, 0x3b, 0x09, 0x36, 0x34, 0x1d - .byte 0x13, 0x02, 0x07, 0x10, 0x20, 0x2f, 0x1d, 0x0b, 0x03, 0x33, 0x1c, 0x16, 0x31, 0x05, 0x13, 0x1b, 0x29, 0x06, 0x13, 0x30, 0x2d, 0x36, 0x2a, 0x2d, 0x2c, 0x19, 0x34, 0x1c, 0x0f, 0x15, 0x12, 0x36 - .byte 0x15, 0x2c, 0x3a, 0x06, 0x1c, 0x12, 0x1d, 0x26, 0x03, 0x38, 0x1d, 0x01, 0x01, 0x2d, 0x17, 0x2e, 0x10, 0x14, 0x17, 0x1c, 0x34, 0x0f, 0x28, 0x09, 0x37, 0x1b, 0x28, 0x1d, 0x26, 0x29, 0x2d, 0x36 - .byte 0x1e, 0x17, 0x28, 0x15, 0x0f, 0x1c, 0x20, 0x2d, 0x10, 0x27, 0x16, 0x2e, 0x14, 0x09, 0x12, 0x3b, 0x3d, 0x21, 0x25, 0x1a, 0x2c, 0x00, 0x22, 0x36, 0x0d, 0x30, 0x10, 0x17, 0x19, 0x1b, 0x00, 0x3b - .byte 0x21, 0x2a, 0x28, 0x34, 0x2d, 0x0f, 0x16, 0x0a, 0x30, 0x28, 0x06, 0x00, 0x25, 0x31, 0x2e, 0x2a, 0x14, 0x33, 0x28, 0x36, 0x10, 0x2e, 0x05, 0x2e, 0x19, 0x19, 0x1a, 0x15, 0x2c, 0x14, 0x17, 0x37 - .byte 0x0f, 0x13, 0x32, 0x17, 0x1b, 0x39, 0x18, 0x32, 0x2e, 0x32, 0x1e, 0x24, 0x1d, 0x31, 0x12, 0x1d, 0x2b, 0x14, 0x0c, 0x27, 0x36, 0x2e, 0x32, 0x06, 0x0a, 0x1a, 0x28, 0x28, 0x20, 0x3a, 0x3a, 0x17 - .byte 0x08, 0x27, 0x36, 0x18, 0x1a, 0x10, 0x1e, 0x26, 0x1b, 0x1f, 0x33, 0x1f, 0x21, 0x17, 0x2f, 0x01, 0x08, 0x20, 0x35, 0x03, 0x19, 0x3b, 0x02, 0x20, 0x02, 0x2d, 0x23, 0x0e, 0x17, 0x32, 0x31, 0x29 - .byte 0x11, 0x22, 0x17, 0x22, 0x3a, 0x2c, 0x23, 0x34, 0x20, 0x18, 0x00, 0x3a, 0x22, 0x25, 0x33, 0x21, 0x33, 0x04, 0x27, 0x04, 0x18, 0x32, 0x2c, 0x0c, 0x2f, 0x28, 0x14, 0x2c, 0x3f, 0x30, 0x2b, 0x30 - .byte 0x21, 0x1d, 0x01, 0x25, 0x32, 0x05, 0x23, 0x34, 0x24, 0x10, 0x30, 0x3d, 0x14, 0x1b, 0x3f, 0x38, 0x2f, 0x22, 0x1b, 0x32, 0x25, 0x07, 0x37, 0x0a, 0x0c, 0x1d, 0x03, 0x1e, 0x1a, 0x0f, 0x3c, 0x12 - .byte 0x11, 0x18, 0x1d, 0x00, 0x35, 0x2f, 0x32, 0x18, 0x14, 0x23, 0x30, 0x1b, 0x11, 0x3d, 0x12, 0x1a, 0x16, 0x35, 0x28, 0x05, 0x24, 0x17, 0x3d, 0x37, 0x2e, 0x09, 0x2e, 0x18, 0x1d, 0x17, 0x20, 0x1f - .byte 0x18, 0x23, 0x2c, 0x2f, 0x20, 0x3f, 0x16, 0x3f, 0x29, 0x2e, 0x23, 0x3b, 0x29, 0x18, 0x39, 0x13, 0x1e, 0x32, 0x35, 0x14, 0x1d, 0x2a, 0x35, 0x01, 0x1d, 0x3e, 0x3b, 0x1e, 0x22, 0x1e, 0x16, 0x18 - .byte 0x22, 0x12, 0x3e, 0x29, 0x33, 0x2f, 0x14, 0x19, 0x3b, 0x07, 0x15, 0x06, 0x3d, 0x29, 0x35, 0x37, 0x23, 0x34, 0x1d, 0x2d, 0x18, 0x12, 0x1b, 0x0b, 0x13, 0x24, 0x13, 0x38, 0x1c, 0x1f, 0x0b, 0x1b - .byte 0x13, 0x21, 0x1c, 0x06, 0x39, 0x32, 0x37, 0x3d, 0x26, 0x29, 0x26, 0x15, 0x3c, 0x33, 0x27, 0x00, 0x01, 0x2e, 0x15, 0x18, 0x31, 0x0d, 0x2c, 0x13, 0x27, 0x3b, 0x20, 0x2d, 0x01, 0x26, 0x23, 0x15 - .byte 0x30, 0x24, 0x00, 0x17, 0x37, 0x3f, 0x33, 0x25, 0x24, 0x31, 0x06, 0x3b, 0x37, 0x03, 0x18, 0x1a, 0x2c, 0x34, 0x14, 0x1d, 0x36, 0x18, 0x3a, 0x04, 0x23, 0x12, 0x26, 0x15, 0x2b, 0x19, 0x1a, 0x29 - .byte 0x2c, 0x36, 0x01, 0x19, 0x1d, 0x2f, 0x06, 0x2b, 0x0c, 0x12, 0x26, 0x36, 0x32, 0x1d, 0x0d, 0x12, 0x28, 0x03, 0x28, 0x13, 0x29, 0x06, 0x17, 0x03, 0x38, 0x21, 0x30, 0x2c, 0x10, 0x22, 0x00, 0x28 - .byte 0x24, 0x3b, 0x1c, 0x20, 0x3e, 0x13, 0x02, 0x0c, 0x19, 0x29, 0x2c, 0x1a, 0x39, 0x30, 0x22, 0x2a, 0x1f, 0x22, 0x14, 0x34, 0x2c, 0x14, 0x25, 0x1b, 0x06, 0x3b, 0x15, 0x06, 0x1c, 0x13, 0x15, 0x03 - .byte 0x18, 0x1e, 0x2a, 0x1b, 0x17, 0x25, 0x2f, 0x1c, 0x29, 0x2e, 0x02, 0x32, 0x1e, 0x1d, 0x28, 0x35, 0x36, 0x03, 0x34, 0x16, 0x3d, 0x2a, 0x12, 0x0d, 0x13, 0x1d, 0x2d, 0x21, 0x32, 0x17, 0x2e, 0x1a - .byte 0x15, 0x26, 0x22, 0x2f, 0x15, 0x3c, 0x0e, 0x20, 0x2f, 0x27, 0x13, 0x04, 0x09, 0x32, 0x1e, 0x01, 0x34, 0x06, 0x16, 0x1e, 0x2e, 0x1b, 0x1c, 0x28, 0x13, 0x2a, 0x30, 0x34, 0x12, 0x12, 0x32, 0x18 - .byte 0x1d, 0x1d, 0x35, 0x07, 0x1c, 0x16, 0x2d, 0x3d, 0x35, 0x1c, 0x1b, 0x24, 0x21, 0x2d, 0x1e, 0x10, 0x09, 0x14, 0x3d, 0x11, 0x12, 0x25, 0x02, 0x26, 0x23, 0x02, 0x19, 0x19, 0x05, 0x14, 0x0b, 0x21 - .byte 0x1a, 0x09, 0x02, 0x2c, 0x18, 0x28, 0x2d, 0x1e, 0x10, 0x12, 0x2e, 0x18, 0x2e, 0x1f, 0x02, 0x2c, 0x14, 0x17, 0x24, 0x39, 0x08, 0x32, 0x16, 0x14, 0x22, 0x16, 0x28, 0x21, 0x11, 0x10, 0x2c, 0x23 - .byte 0x36, 0x2b, 0x39, 0x21, 0x26, 0x0e, 0x06, 0x2d, 0x3c, 0x3e, 0x26, 0x2a, 0x1b, 0x1f, 0x00, 0x3c, 0x33, 0x35, 0x3f, 0x14, 0x00, 0x0b, 0x10, 0x34, 0x3c, 0x17, 0x2d, 0x07, 0x1f, 0x24, 0x39, 0x27 - .byte 0x16, 0x00, 0x1d, 0x33, 0x2b, 0x1e, 0x0f, 0x08, 0x31, 0x3a, 0x09, 0x13, 0x0c, 0x21, 0x1c, 0x2a, 0x17, 0x34, 0x29, 0x27, 0x10, 0x37, 0x1b, 0x18, 0x15, 0x08, 0x2f, 0x1f, 0x16, 0x12, 0x1f, 0x28 - .byte 0x34, 0x1c, 0x20, 0x22, 0x12, 0x01, 0x12, 0x21, 0x31, 0x10, 0x22, 0x26, 0x1e, 0x01, 0x3d, 0x11, 0x1e, 0x27, 0x25, 0x3d, 0x30, 0x24, 0x1d, 0x11, 0x22, 0x36, 0x30, 0x16, 0x1f, 0x3e, 0x2a, 0x3c - .byte 0x27, 0x1b, 0x1f, 0x29, 0x10, 0x1e, 0x05, 0x2a, 0x0a, 0x10, 0x14, 0x1f, 0x00, 0x2e, 0x0b, 0x3b, 0x18, 0x0a, 0x39, 0x30, 0x37, 0x0b, 0x1f, 0x1d, 0x0a, 0x29, 0x3e, 0x1c, 0x33, 0x13, 0x2e, 0x28 - .byte 0x27, 0x1b, 0x1e, 0x1d, 0x02, 0x1c, 0x01, 0x25, 0x14, 0x3a, 0x10, 0x1c, 0x12, 0x05, 0x2a, 0x30, 0x20, 0x26, 0x2f, 0x2e, 0x2e, 0x03, 0x07, 0x24, 0x36, 0x04, 0x2b, 0x11, 0x25, 0x2d, 0x28, 0x0e - .byte 0x2e, 0x0f, 0x1d, 0x15, 0x1c, 0x28, 0x30, 0x1f, 0x23, 0x26, 0x36, 0x12, 0x37, 0x3a, 0x31, 0x10, 0x2c, 0x2c, 0x2f, 0x1a, 0x0d, 0x15, 0x3f, 0x3c, 0x32, 0x35, 0x1c, 0x16, 0x33, 0x16, 0x28, 0x1d - .byte 0x3f, 0x21, 0x2c, 0x3e, 0x2b, 0x24, 0x23, 0x2f, 0x32, 0x15, 0x2a, 0x1b, 0x10, 0x35, 0x18, 0x37, 0x10, 0x3b, 0x1e, 0x11, 0x2b, 0x16, 0x24, 0x1d, 0x16, 0x26, 0x3c, 0x2d, 0x11, 0x15, 0x28, 0x28 - .byte 0x27, 0x27, 0x27, 0x3b, 0x3a, 0x16, 0x1a, 0x0c, 0x1a, 0x15, 0x08, 0x25, 0x0b, 0x10, 0x22, 0x1a, 0x3e, 0x17, 0x28, 0x1f, 0x1e, 0x01, 0x1e, 0x1e, 0x1c, 0x2f, 0x10, 0x25, 0x0b, 0x34, 0x3e, 0x0c - .byte 0x1a, 0x1b, 0x10, 0x2a, 0x0f, 0x14, 0x17, 0x0f, 0x3f, 0x17, 0x03, 0x15, 0x1f, 0x02, 0x36, 0x17, 0x15, 0x1d, 0x18, 0x08, 0x36, 0x10, 0x14, 0x0d, 0x2b, 0x0a, 0x05, 0x1d, 0x26, 0x12, 0x1e, 0x3e - .byte 0x18, 0x19, 0x36, 0x18, 0x37, 0x17, 0x39, 0x2e, 0x0d, 0x04, 0x19, 0x16, 0x22, 0x15, 0x3e, 0x26, 0x1f, 0x00, 0x06, 0x17, 0x33, 0x22, 0x1d, 0x2b, 0x39, 0x2b, 0x3e, 0x31, 0x1c, 0x22, 0x3f, 0x13 - .byte 0x30, 0x1c, 0x31, 0x07, 0x2b, 0x14, 0x32, 0x35, 0x1e, 0x02, 0x07, 0x20, 0x0f, 0x3b, 0x11, 0x20, 0x07, 0x12, 0x2a, 0x30, 0x1d, 0x28, 0x38, 0x36, 0x20, 0x01, 0x17, 0x15, 0x20, 0x21, 0x3a, 0x1b - .byte 0x1e, 0x38, 0x12, 0x24, 0x03, 0x3e, 0x1f, 0x29, 0x1d, 0x13, 0x20, 0x27, 0x19, 0x12, 0x25, 0x20, 0x32, 0x33, 0x2b, 0x3f, 0x05, 0x31, 0x35, 0x3c, 0x2d, 0x2d, 0x02, 0x2e, 0x10, 0x2a, 0x16, 0x17 - .byte 0x08, 0x31, 0x17, 0x2e, 0x2b, 0x30, 0x1e, 0x15, 0x31, 0x15, 0x26, 0x08, 0x10, 0x33, 0x15, 0x01, 0x27, 0x12, 0x07, 0x2f, 0x29, 0x27, 0x34, 0x3f, 0x08, 0x31, 0x1c, 0x20, 0x1a, 0x33, 0x0c, 0x13 - .byte 0x18, 0x31, 0x24, 0x37, 0x2d, 0x2e, 0x21, 0x18, 0x24, 0x3a, 0x27, 0x31, 0x35, 0x3e, 0x30, 0x3a, 0x14, 0x33, 0x0f, 0x1a, 0x2d, 0x30, 0x2e, 0x11, 0x1a, 0x31, 0x1d, 0x17, 0x3c, 0x18, 0x33, 0x31 - .byte 0x23, 0x1d, 0x39, 0x2d, 0x10, 0x1d, 0x2f, 0x24, 0x15, 0x1c, 0x25, 0x01, 0x2b, 0x22, 0x16, 0x2e, 0x1b, 0x25, 0x35, 0x37, 0x10, 0x26, 0x39, 0x01, 0x36, 0x17, 0x2b, 0x14, 0x09, 0x16, 0x17, 0x20 - .byte 0x28, 0x23, 0x26, 0x3a, 0x26, 0x27, 0x2a, 0x24, 0x36, 0x02, 0x2c, 0x29, 0x30, 0x35, 0x36, 0x01, 0x1f, 0x28, 0x3b, 0x1d, 0x23, 0x1e, 0x2d, 0x11, 0x1e, 0x2c, 0x2f, 0x32, 0x19, 0x3f, 0x26, 0x31 - .byte 0x38, 0x1e, 0x17, 0x05, 0x18, 0x2e, 0x00, 0x2e, 0x12, 0x34, 0x3f, 0x34, 0x16, 0x10, 0x29, 0x20, 0x3d, 0x36, 0x2f, 0x16, 0x25, 0x12, 0x17, 0x10, 0x21, 0x37, 0x35, 0x25, 0x37, 0x2d, 0x01, 0x08 - .byte 0x27, 0x03, 0x1f, 0x29, 0x0d, 0x2a, 0x16, 0x3a, 0x3f, 0x33, 0x2b, 0x19, 0x1d, 0x2a, 0x1f, 0x29, 0x28, 0x2c, 0x10, 0x28, 0x30, 0x10, 0x39, 0x14, 0x1b, 0x00, 0x18, 0x21, 0x28, 0x0c, 0x37, 0x11 - .byte 0x10, 0x11, 0x3c, 0x33, 0x32, 0x33, 0x36, 0x1a, 0x36, 0x00, 0x1c, 0x31, 0x1b, 0x1d, 0x38, 0x1d, 0x10, 0x3c, 0x39, 0x27, 0x3a, 0x3f, 0x14, 0x19, 0x12, 0x14, 0x0d, 0x1f, 0x18, 0x00, 0x25, 0x18 - .byte 0x28, 0x1c, 0x32, 0x27, 0x03, 0x1a, 0x26, 0x2d, 0x2a, 0x29, 0x28, 0x27, 0x0a, 0x2a, 0x18, 0x0a, 0x1a, 0x30, 0x20, 0x1a, 0x2e, 0x06, 0x0b, 0x1d, 0x0f, 0x0c, 0x1c, 0x35, 0x28, 0x1c, 0x3d, 0x16 - .byte 0x23, 0x21, 0x1c, 0x31, 0x14, 0x1c, 0x2e, 0x22, 0x32, 0x35, 0x09, 0x29, 0x30, 0x20, 0x1a, 0x10, 0x31, 0x3f, 0x2c, 0x0a, 0x3d, 0x37, 0x0b, 0x2e, 0x2d, 0x1f, 0x22, 0x31, 0x06, 0x07, 0x29, 0x22 - .byte 0x17, 0x2d, 0x30, 0x11, 0x18, 0x0c, 0x19, 0x15, 0x07, 0x0a, 0x34, 0x18, 0x29, 0x27, 0x33, 0x0c, 0x30, 0x03, 0x1a, 0x37, 0x06, 0x01, 0x2d, 0x0f, 0x3b, 0x2b, 0x11, 0x1f, 0x37, 0x2b, 0x21, 0x36 - .byte 0x3f, 0x23, 0x17, 0x17, 0x07, 0x2b, 0x2b, 0x0e, 0x30, 0x11, 0x39, 0x1d, 0x29, 0x03, 0x33, 0x30, 0x03, 0x2f, 0x3c, 0x20, 0x26, 0x03, 0x22, 0x14, 0x3a, 0x28, 0x35, 0x01, 0x28, 0x2b, 0x3e, 0x15 - .byte 0x18, 0x30, 0x07, 0x17, 0x3b, 0x2c, 0x30, 0x15, 0x07, 0x2c, 0x17, 0x27, 0x1d, 0x3f, 0x1e, 0x33, 0x0d, 0x17, 0x10, 0x15, 0x0e, 0x30, 0x09, 0x05, 0x30, 0x2d, 0x20, 0x15, 0x3c, 0x3d, 0x30, 0x0c - .byte 0x17, 0x1c, 0x1a, 0x0d, 0x25, 0x2b, 0x2b, 0x2a, 0x02, 0x16, 0x2d, 0x17, 0x31, 0x17, 0x00, 0x08, 0x13, 0x37, 0x35, 0x21, 0x1e, 0x1c, 0x1f, 0x2b, 0x32, 0x1c, 0x10, 0x2a, 0x16, 0x3a, 0x33, 0x31 - .byte 0x17, 0x2b, 0x2a, 0x0c, 0x3d, 0x11, 0x28, 0x0a, 0x30, 0x23, 0x0a, 0x26, 0x0a, 0x14, 0x24, 0x0b, 0x0f, 0x30, 0x1b, 0x1e, 0x29, 0x02, 0x35, 0x28, 0x3b, 0x02, 0x14, 0x00, 0x0f, 0x35, 0x1c, 0x3c - .byte 0x2e, 0x28, 0x38, 0x19, 0x1b, 0x11, 0x12, 0x09, 0x16, 0x10, 0x2e, 0x0d, 0x20, 0x3d, 0x04, 0x32, 0x16, 0x2c, 0x25, 0x02, 0x3d, 0x18, 0x0b, 0x13, 0x1c, 0x22, 0x2a, 0x1c, 0x20, 0x27, 0x22, 0x05 - .byte 0x26, 0x22, 0x12, 0x1d, 0x2c, 0x08, 0x05, 0x2e, 0x3f, 0x1c, 0x17, 0x24, 0x0d, 0x33, 0x36, 0x08, 0x24, 0x10, 0x22, 0x29, 0x1c, 0x0a, 0x11, 0x25, 0x0f, 0x10, 0x24, 0x38, 0x2f, 0x25, 0x32, 0x1e - .byte 0x06, 0x2a, 0x29, 0x3e, 0x3a, 0x28, 0x34, 0x17, 0x33, 0x18, 0x33, 0x17, 0x07, 0x14, 0x1f, 0x11, 0x17, 0x20, 0x13, 0x0e, 0x14, 0x3b, 0x1c, 0x12, 0x2a, 0x13, 0x37, 0x2a, 0x35, 0x32, 0x30, 0x02 - .byte 0x25, 0x00, 0x07, 0x1f, 0x0c, 0x04, 0x2c, 0x37, 0x37, 0x30, 0x25, 0x12, 0x25, 0x12, 0x22, 0x21, 0x22, 0x35, 0x33, 0x07, 0x20, 0x2d, 0x27, 0x0e, 0x30, 0x34, 0x19, 0x1a, 0x0a, 0x3c, 0x25, 0x07 - .byte 0x1d, 0x2b, 0x31, 0x3a, 0x12, 0x1a, 0x3d, 0x37, 0x16, 0x15, 0x16, 0x39, 0x13, 0x15, 0x2d, 0x03, 0x2e, 0x06, 0x39, 0x2c, 0x16, 0x00, 0x13, 0x35, 0x2a, 0x35, 0x24, 0x01, 0x18, 0x24, 0x37, 0x28 - .byte 0x25, 0x1b, 0x34, 0x25, 0x19, 0x17, 0x27, 0x2f, 0x1b, 0x27, 0x0d, 0x10, 0x36, 0x3c, 0x30, 0x3c, 0x33, 0x23, 0x3e, 0x27, 0x1e, 0x25, 0x2d, 0x29, 0x1f, 0x12, 0x21, 0x37, 0x32, 0x1f, 0x11, 0x21 - .byte 0x35, 0x30, 0x0c, 0x19, 0x25, 0x3d, 0x26, 0x17, 0x02, 0x1d, 0x14, 0x2e, 0x11, 0x38, 0x13, 0x30, 0x0a, 0x2b, 0x20, 0x1e, 0x10, 0x15, 0x37, 0x30, 0x2e, 0x1e, 0x04, 0x2c, 0x14, 0x34, 0x19, 0x08 - .byte 0x14, 0x18, 0x0e, 0x1c, 0x30, 0x1a, 0x2e, 0x1b, 0x1f, 0x39, 0x31, 0x0c, 0x1c, 0x28, 0x3e, 0x33, 0x23, 0x0f, 0x13, 0x16, 0x25, 0x39, 0x2f, 0x14, 0x1b, 0x1a, 0x28, 0x3e, 0x21, 0x2d, 0x19, 0x11 - .byte 0x0c, 0x34, 0x32, 0x39, 0x31, 0x19, 0x1a, 0x08, 0x34, 0x09, 0x2f, 0x11, 0x30, 0x04, 0x1c, 0x02, 0x3b, 0x1b, 0x33, 0x21, 0x33, 0x38, 0x02, 0x1a, 0x31, 0x38, 0x32, 0x1f, 0x1d, 0x16, 0x17, 0x10 - .byte 0x1b, 0x32, 0x20, 0x17, 0x00, 0x33, 0x12, 0x21, 0x0f, 0x27, 0x14, 0x19, 0x27, 0x24, 0x2c, 0x37, 0x25, 0x05, 0x2f, 0x3d, 0x25, 0x11, 0x12, 0x30, 0x1a, 0x16, 0x03, 0x1a, 0x14, 0x09, 0x13, 0x02 - .byte 0x23, 0x22, 0x01, 0x3c, 0x10, 0x3f, 0x2d, 0x23, 0x31, 0x3f, 0x23, 0x17, 0x00, 0x33, 0x3f, 0x0f, 0x2f, 0x26, 0x07, 0x15, 0x21, 0x2b, 0x2a, 0x38, 0x39, 0x1e, 0x09, 0x25, 0x2b, 0x3b, 0x30, 0x25 - .byte 0x12, 0x2d, 0x13, 0x32, 0x19, 0x28, 0x24, 0x1c, 0x2d, 0x35, 0x32, 0x26, 0x0d, 0x23, 0x1e, 0x1d, 0x07, 0x21, 0x0b, 0x34, 0x17, 0x2d, 0x32, 0x32, 0x3a, 0x3c, 0x35, 0x1a, 0x10, 0x33, 0x1a, 0x07 - .byte 0x22, 0x3b, 0x1b, 0x2a, 0x33, 0x1f, 0x26, 0x0e, 0x35, 0x1a, 0x3b, 0x0a, 0x1c, 0x11, 0x07, 0x11, 0x0d, 0x3c, 0x2d, 0x1e, 0x37, 0x29, 0x11, 0x05, 0x12, 0x15, 0x2f, 0x1c, 0x24, 0x31, 0x16, 0x2b - .byte 0x21, 0x1b, 0x23, 0x10, 0x31, 0x02, 0x14, 0x29, 0x26, 0x20, 0x16, 0x10, 0x17, 0x10, 0x0b, 0x0f, 0x33, 0x01, 0x2e, 0x14, 0x21, 0x0e, 0x37, 0x1a, 0x1d, 0x2f, 0x1e, 0x30, 0x24, 0x04, 0x14, 0x2d - .byte 0x11, 0x00, 0x30, 0x08, 0x2a, 0x1d, 0x1d, 0x22, 0x21, 0x24, 0x2c, 0x37, 0x24, 0x11, 0x12, 0x04, 0x2e, 0x28, 0x1d, 0x18, 0x23, 0x3c, 0x16, 0x16, 0x10, 0x17, 0x31, 0x20, 0x21, 0x12, 0x33, 0x3e - .byte 0x34, 0x06, 0x13, 0x13, 0x17, 0x38, 0x2b, 0x14, 0x0d, 0x15, 0x24, 0x3b, 0x2b, 0x34, 0x3b, 0x1e, 0x18, 0x07, 0x34, 0x37, 0x1d, 0x1f, 0x0b, 0x29, 0x20, 0x12, 0x1e, 0x1d, 0x1a, 0x24, 0x24, 0x3d - .byte 0x28, 0x24, 0x0b, 0x12, 0x33, 0x1b, 0x3a, 0x22, 0x14, 0x13, 0x2a, 0x31, 0x38, 0x15, 0x37, 0x2b, 0x2e, 0x19, 0x1e, 0x2c, 0x3f, 0x1b, 0x2a, 0x33, 0x1f, 0x33, 0x3f, 0x15, 0x29, 0x01, 0x1e, 0x18 - .byte 0x1f, 0x22, 0x19, 0x33, 0x3c, 0x34, 0x1e, 0x12, 0x22, 0x0d, 0x37, 0x2c, 0x0f, 0x08, 0x31, 0x2e, 0x09, 0x36, 0x01, 0x05, 0x1e, 0x1c, 0x04, 0x1e, 0x0c, 0x01, 0x1c, 0x29, 0x28, 0x2f, 0x39, 0x2d - .byte 0x14, 0x09, 0x22, 0x36, 0x04, 0x37, 0x37, 0x2d, 0x2f, 0x35, 0x24, 0x23, 0x1b, 0x08, 0x20, 0x32, 0x20, 0x1f, 0x34, 0x02, 0x31, 0x19, 0x18, 0x13, 0x36, 0x06, 0x2b, 0x1e, 0x0e, 0x1b, 0x10, 0x2f - .byte 0x0e, 0x1c, 0x11, 0x38, 0x13, 0x01, 0x37, 0x19, 0x14, 0x11, 0x26, 0x31, 0x3d, 0x33, 0x1d, 0x1b, 0x34, 0x25, 0x31, 0x2f, 0x11, 0x0a, 0x2f, 0x39, 0x17, 0x1b, 0x05, 0x0e, 0x13, 0x29, 0x25, 0x22 - .byte 0x15, 0x0d, 0x20, 0x2b, 0x27, 0x21, 0x3e, 0x24, 0x27, 0x2a, 0x2b, 0x16, 0x24, 0x3d, 0x15, 0x15, 0x30, 0x31, 0x0f, 0x33, 0x24, 0x06, 0x16, 0x13, 0x06, 0x31, 0x10, 0x2e, 0x3f, 0x10, 0x05, 0x0d - .byte 0x2f, 0x3c, 0x1f, 0x19, 0x12, 0x13, 0x24, 0x0f, 0x33, 0x36, 0x15, 0x3b, 0x33, 0x03, 0x0f, 0x2a, 0x3b, 0x3c, 0x2c, 0x36, 0x09, 0x29, 0x11, 0x3b, 0x27, 0x28, 0x2b, 0x31, 0x1a, 0x0e, 0x2f, 0x39 - .byte 0x2c, 0x31, 0x0e, 0x3c, 0x35, 0x2c, 0x24, 0x33, 0x3d, 0x11, 0x2b, 0x07, 0x3c, 0x37, 0x14, 0x18, 0x13, 0x1d, 0x3f, 0x2e, 0x30, 0x12, 0x25, 0x26, 0x1d, 0x11, 0x07, 0x11, 0x1e, 0x34, 0x01, 0x11 - .byte 0x0b, 0x39, 0x21, 0x29, 0x02, 0x29, 0x15, 0x10, 0x1a, 0x30, 0x1f, 0x35, 0x3c, 0x2b, 0x2a, 0x30, 0x3b, 0x36, 0x20, 0x1a, 0x23, 0x32, 0x24, 0x2b, 0x15, 0x20, 0x1c, 0x25, 0x3d, 0x36, 0x2d, 0x14 - .byte 0x31, 0x18, 0x23, 0x17, 0x18, 0x05, 0x13, 0x34, 0x30, 0x37, 0x0e, 0x39, 0x23, 0x1d, 0x1f, 0x17, 0x01, 0x15, 0x2f, 0x0b, 0x3e, 0x1b, 0x0d, 0x19, 0x2e, 0x31, 0x38, 0x1c, 0x15, 0x34, 0x15, 0x13 - .byte 0x19, 0x29, 0x19, 0x14, 0x27, 0x15, 0x18, 0x23, 0x29, 0x0c, 0x27, 0x2d, 0x0e, 0x17, 0x34, 0x18, 0x10, 0x3b, 0x1e, 0x29, 0x34, 0x2c, 0x22, 0x31, 0x08, 0x13, 0x1d, 0x18, 0x1a, 0x1c, 0x0b, 0x2a - .byte 0x19, 0x1e, 0x1a, 0x23, 0x27, 0x17, 0x3b, 0x0e, 0x37, 0x19, 0x2b, 0x16, 0x2f, 0x08, 0x21, 0x37, 0x02, 0x20, 0x0b, 0x32, 0x30, 0x16, 0x05, 0x30, 0x13, 0x05, 0x1a, 0x07, 0x39, 0x19, 0x0c, 0x3b - .byte 0x2a, 0x15, 0x05, 0x30, 0x30, 0x05, 0x19, 0x13, 0x00, 0x12, 0x27, 0x16, 0x2a, 0x0f, 0x28, 0x27, 0x0c, 0x23, 0x2f, 0x39, 0x28, 0x2a, 0x24, 0x25, 0x1f, 0x18, 0x29, 0x14, 0x16, 0x05, 0x1a, 0x35 - .byte 0x2f, 0x26, 0x0a, 0x3a, 0x29, 0x34, 0x2c, 0x36, 0x2e, 0x3a, 0x15, 0x1a, 0x0a, 0x2d, 0x16, 0x14, 0x2e, 0x35, 0x28, 0x2a, 0x35, 0x0f, 0x11, 0x11, 0x32, 0x19, 0x20, 0x1a, 0x28, 0x17, 0x1a, 0x28 - .byte 0x16, 0x33, 0x25, 0x13, 0x2c, 0x29, 0x09, 0x16, 0x33, 0x1d, 0x27, 0x26, 0x15, 0x0c, 0x2f, 0x22, 0x1c, 0x19, 0x29, 0x33, 0x10, 0x2d, 0x11, 0x1b, 0x16, 0x19, 0x2e, 0x0d, 0x0c, 0x28, 0x37, 0x3a - .byte 0x34, 0x2a, 0x1d, 0x37, 0x30, 0x0a, 0x36, 0x24, 0x39, 0x1b, 0x39, 0x0a, 0x32, 0x11, 0x03, 0x2d, 0x32, 0x1d, 0x30, 0x38, 0x1e, 0x27, 0x2e, 0x17, 0x18, 0x16, 0x17, 0x2a, 0x36, 0x3b, 0x31, 0x17 - .byte 0x04, 0x19, 0x3a, 0x25, 0x2d, 0x00, 0x36, 0x27, 0x25, 0x12, 0x33, 0x06, 0x0a, 0x14, 0x11, 0x05, 0x2f, 0x03, 0x35, 0x2f, 0x0b, 0x34, 0x29, 0x00, 0x31, 0x13, 0x27, 0x0f, 0x1c, 0x1d, 0x06, 0x2d - .byte 0x1c, 0x30, 0x27, 0x2f, 0x2a, 0x27, 0x16, 0x20, 0x31, 0x33, 0x2b, 0x2b, 0x05, 0x30, 0x36, 0x29, 0x23, 0x35, 0x10, 0x16, 0x2f, 0x2d, 0x20, 0x29, 0x37, 0x13, 0x24, 0x2d, 0x0e, 0x25, 0x08, 0x0a - .byte 0x18, 0x0f, 0x03, 0x1b, 0x31, 0x0c, 0x37, 0x1e, 0x34, 0x31, 0x1b, 0x0e, 0x25, 0x1a, 0x07, 0x34, 0x0d, 0x3c, 0x33, 0x00, 0x3a, 0x36, 0x04, 0x27, 0x12, 0x23, 0x18, 0x24, 0x0d, 0x0b, 0x18, 0x31 - .byte 0x32, 0x37, 0x00, 0x0d, 0x21, 0x32, 0x10, 0x12, 0x26, 0x0d, 0x19, 0x29, 0x24, 0x2b, 0x3d, 0x21, 0x1f, 0x1e, 0x1b, 0x28, 0x0d, 0x12, 0x28, 0x35, 0x1e, 0x23, 0x0a, 0x2e, 0x22, 0x27, 0x27, 0x35 - .byte 0x01, 0x0e, 0x20, 0x31, 0x39, 0x29, 0x3b, 0x24, 0x36, 0x14, 0x10, 0x33, 0x18, 0x2c, 0x26, 0x04, 0x2d, 0x15, 0x1a, 0x11, 0x37, 0x0f, 0x0b, 0x14, 0x0e, 0x2c, 0x2c, 0x21, 0x17, 0x2c, 0x16, 0x21 - .byte 0x35, 0x3e, 0x10, 0x10, 0x0a, 0x05, 0x1e, 0x3b, 0x09, 0x13, 0x26, 0x18, 0x1e, 0x23, 0x0c, 0x1a, 0x33, 0x37, 0x1f, 0x09, 0x12, 0x35, 0x3d, 0x0d, 0x15, 0x36, 0x06, 0x24, 0x33, 0x30, 0x29, 0x3b - .byte 0x0f, 0x28, 0x34, 0x2a, 0x2c, 0x02, 0x12, 0x35, 0x09, 0x22, 0x31, 0x3b, 0x31, 0x1c, 0x33, 0x22, 0x27, 0x3d, 0x34, 0x15, 0x14, 0x22, 0x28, 0x28, 0x10, 0x1e, 0x21, 0x31, 0x10, 0x2d, 0x16, 0x21 - .byte 0x1e, 0x05, 0x33, 0x0f, 0x30, 0x31, 0x0e, 0x1a, 0x35, 0x38, 0x2e, 0x28, 0x26, 0x37, 0x1e, 0x2b, 0x13, 0x33, 0x1f, 0x1e, 0x37, 0x0a, 0x28, 0x24, 0x32, 0x1c, 0x1a, 0x1f, 0x3f, 0x19, 0x39, 0x39 - .byte 0x29, 0x2c, 0x1b, 0x14, 0x15, 0x2a, 0x17, 0x32, 0x0f, 0x21, 0x30, 0x21, 0x18, 0x23, 0x2a, 0x27, 0x3d, 0x07, 0x10, 0x0b, 0x3f, 0x2f, 0x31, 0x02, 0x2e, 0x08, 0x39, 0x2f, 0x3f, 0x20, 0x18, 0x2d - .byte 0x34, 0x11, 0x2e, 0x34, 0x10, 0x26, 0x12, 0x23, 0x25, 0x0a, 0x37, 0x34, 0x09, 0x25, 0x0a, 0x3e, 0x16, 0x1a, 0x17, 0x11, 0x38, 0x1c, 0x20, 0x11, 0x21, 0x26, 0x05, 0x0f, 0x18, 0x26, 0x2b, 0x32 - .byte 0x0a, 0x0c, 0x16, 0x03, 0x29, 0x1d, 0x29, 0x3b, 0x23, 0x16, 0x1b, 0x29, 0x07, 0x09, 0x17, 0x17, 0x2c, 0x1c, 0x35, 0x33, 0x30, 0x17, 0x12, 0x1e, 0x3d, 0x1a, 0x2b, 0x21, 0x1d, 0x10, 0x0a, 0x08 - .byte 0x17, 0x14, 0x3c, 0x36, 0x28, 0x36, 0x36, 0x3b, 0x20, 0x1b, 0x13, 0x22, 0x1d, 0x13, 0x3a, 0x15, 0x02, 0x23, 0x2c, 0x3e, 0x19, 0x14, 0x39, 0x3c, 0x1a, 0x10, 0x08, 0x1e, 0x0a, 0x13, 0x29, 0x3f - .byte 0x38, 0x2c, 0x07, 0x23, 0x1f, 0x19, 0x2a, 0x24, 0x14, 0x3c, 0x1f, 0x0d, 0x04, 0x37, 0x1a, 0x2f, 0x28, 0x2a, 0x1d, 0x1e, 0x11, 0x37, 0x29, 0x28, 0x27, 0x12, 0x0d, 0x00, 0x26, 0x0a, 0x3c, 0x26 - .byte 0x1f, 0x1c, 0x33, 0x04, 0x3a, 0x2c, 0x24, 0x3d, 0x2b, 0x26, 0x31, 0x2f, 0x13, 0x1c, 0x21, 0x3e, 0x12, 0x23, 0x36, 0x0a, 0x1a, 0x2d, 0x1e, 0x19, 0x05, 0x1f, 0x1b, 0x1e, 0x0a, 0x1f, 0x20, 0x08 - .byte 0x24, 0x2c, 0x0c, 0x33, 0x1d, 0x1f, 0x11, 0x0e, 0x12, 0x10, 0x27, 0x12, 0x19, 0x2a, 0x13, 0x31, 0x1c, 0x04, 0x30, 0x1a, 0x38, 0x1f, 0x2c, 0x35, 0x25, 0x07, 0x0b, 0x33, 0x2d, 0x02, 0x1a, 0x2a - .byte 0x35, 0x35, 0x16, 0x2f, 0x14, 0x11, 0x31, 0x33, 0x2c, 0x31, 0x1e, 0x3c, 0x3a, 0x27, 0x3c, 0x2b, 0x12, 0x27, 0x1d, 0x12, 0x36, 0x2c, 0x2b, 0x25, 0x3b, 0x35, 0x12, 0x3d, 0x27, 0x13, 0x23, 0x19 - .byte 0x33, 0x2c, 0x26, 0x09, 0x3c, 0x12, 0x15, 0x1a, 0x23, 0x21, 0x07, 0x1a, 0x22, 0x25, 0x20, 0x19, 0x1b, 0x2c, 0x3a, 0x19, 0x35, 0x05, 0x26, 0x1d, 0x23, 0x22, 0x25, 0x0e, 0x1e, 0x11, 0x13, 0x30 - .byte 0x12, 0x2c, 0x22, 0x25, 0x0a, 0x1d, 0x18, 0x23, 0x3e, 0x1d, 0x02, 0x28, 0x25, 0x21, 0x0e, 0x20, 0x21, 0x22, 0x37, 0x18, 0x33, 0x27, 0x23, 0x23, 0x31, 0x24, 0x1a, 0x1a, 0x3e, 0x25, 0x24, 0x24 - .byte 0x01, 0x18, 0x34, 0x10, 0x22, 0x07, 0x00, 0x37, 0x06, 0x20, 0x20, 0x3a, 0x02, 0x2b, 0x07, 0x2c, 0x2c, 0x09, 0x2f, 0x2a, 0x01, 0x32, 0x2c, 0x00, 0x35, 0x13, 0x2b, 0x3c, 0x1f, 0x36, 0x37, 0x1e - .byte 0x20, 0x35, 0x1d, 0x0c, 0x07, 0x33, 0x16, 0x08, 0x12, 0x3f, 0x36, 0x11, 0x0b, 0x1f, 0x2d, 0x21, 0x20, 0x33, 0x17, 0x1a, 0x2e, 0x16, 0x01, 0x2f, 0x2f, 0x1c, 0x34, 0x29, 0x31, 0x2e, 0x3b, 0x38 - .byte 0x31, 0x0d, 0x16, 0x12, 0x07, 0x29, 0x24, 0x33, 0x3c, 0x34, 0x3e, 0x1e, 0x18, 0x30, 0x02, 0x34, 0x2a, 0x34, 0x1b, 0x2e, 0x23, 0x18, 0x34, 0x00, 0x1f, 0x20, 0x0e, 0x28, 0x15, 0x33, 0x37, 0x27 - .byte 0x35, 0x23, 0x37, 0x3e, 0x11, 0x32, 0x2e, 0x36, 0x3a, 0x02, 0x2b, 0x00, 0x36, 0x1d, 0x13, 0x29, 0x16, 0x08, 0x2b, 0x37, 0x08, 0x02, 0x27, 0x32, 0x2d, 0x34, 0x30, 0x36, 0x29, 0x2e, 0x10, 0x12 - .byte 0x3c, 0x2e, 0x2a, 0x04, 0x33, 0x30, 0x3f, 0x01, 0x22, 0x37, 0x14, 0x1d, 0x27, 0x00, 0x2f, 0x0c, 0x39, 0x26, 0x27, 0x04, 0x21, 0x19, 0x08, 0x1d, 0x01, 0x04, 0x1e, 0x27, 0x1b, 0x2b, 0x31, 0x17 - .byte 0x1f, 0x07, 0x01, 0x2d, 0x2e, 0x3b, 0x1f, 0x34, 0x24, 0x31, 0x32, 0x2b, 0x24, 0x0e, 0x07, 0x1e, 0x0f, 0x33, 0x10, 0x16, 0x21, 0x32, 0x39, 0x02, 0x1a, 0x33, 0x3d, 0x22, 0x0c, 0x25, 0x1a, 0x29 - .byte 0x29, 0x28, 0x3a, 0x32, 0x26, 0x0b, 0x13, 0x22, 0x1f, 0x0f, 0x1c, 0x04, 0x2c, 0x20, 0x39, 0x1a, 0x1b, 0x1a, 0x2a, 0x1f, 0x24, 0x13, 0x1a, 0x31, 0x3b, 0x33, 0x39, 0x23, 0x28, 0x31, 0x07, 0x31 - .byte 0x1f, 0x10, 0x20, 0x29, 0x17, 0x32, 0x26, 0x3b, 0x2d, 0x02, 0x3c, 0x1c, 0x0e, 0x00, 0x20, 0x14, 0x3e, 0x37, 0x01, 0x0f, 0x2d, 0x06, 0x12, 0x27, 0x30, 0x13, 0x19, 0x00, 0x33, 0x2a, 0x0c, 0x07 - .byte 0x27, 0x11, 0x3a, 0x1c, 0x15, 0x0a, 0x13, 0x1f, 0x0d, 0x2a, 0x37, 0x07, 0x2a, 0x34, 0x35, 0x34, 0x28, 0x16, 0x27, 0x06, 0x02, 0x36, 0x09, 0x23, 0x30, 0x14, 0x02, 0x28, 0x39, 0x32, 0x34, 0x24 - .byte 0x35, 0x12, 0x12, 0x22, 0x26, 0x09, 0x07, 0x33, 0x0f, 0x3e, 0x1e, 0x00, 0x3c, 0x33, 0x10, 0x37, 0x14, 0x3a, 0x03, 0x25, 0x2d, 0x1e, 0x24, 0x36, 0x36, 0x26, 0x1f, 0x3c, 0x1a, 0x37, 0x33, 0x25 - .byte 0x23, 0x13, 0x1f, 0x33, 0x0d, 0x13, 0x25, 0x30, 0x1e, 0x17, 0x03, 0x18, 0x18, 0x18, 0x14, 0x30, 0x07, 0x22, 0x3e, 0x33, 0x21, 0x14, 0x37, 0x16, 0x16, 0x00, 0x12, 0x2c, 0x12, 0x2f, 0x25, 0x3f - .byte 0x1e, 0x24, 0x19, 0x16, 0x16, 0x0f, 0x35, 0x2d, 0x10, 0x11, 0x24, 0x2a, 0x28, 0x19, 0x25, 0x2e, 0x0c, 0x16, 0x1f, 0x38, 0x21, 0x36, 0x3d, 0x1a, 0x2f, 0x3b, 0x32, 0x12, 0x36, 0x13, 0x29, 0x0e - .byte 0x30, 0x31, 0x19, 0x07, 0x2f, 0x25, 0x23, 0x28, 0x20, 0x08, 0x29, 0x2a, 0x00, 0x30, 0x30, 0x38, 0x23, 0x1e, 0x0f, 0x1f, 0x3b, 0x1b, 0x30, 0x3a, 0x37, 0x2f, 0x39, 0x37, 0x35, 0x39, 0x2d, 0x2f - .byte 0x1f, 0x2e, 0x1e, 0x1a, 0x2b, 0x1e, 0x14, 0x17, 0x20, 0x2f, 0x03, 0x11, 0x1d, 0x00, 0x30, 0x17, 0x2b, 0x1d, 0x35, 0x28, 0x25, 0x3b, 0x0f, 0x11, 0x09, 0x04, 0x2e, 0x23, 0x11, 0x1e, 0x13, 0x37 - .byte 0x1e, 0x37, 0x37, 0x1e, 0x07, 0x01, 0x32, 0x14, 0x06, 0x32, 0x11, 0x0c, 0x2e, 0x36, 0x2e, 0x24, 0x15, 0x2a, 0x1c, 0x22, 0x15, 0x34, 0x2c, 0x1e, 0x35, 0x22, 0x27, 0x33, 0x19, 0x3f, 0x2d, 0x21 - .byte 0x33, 0x15, 0x26, 0x1a, 0x11, 0x16, 0x3e, 0x12, 0x2b, 0x24, 0x15, 0x3c, 0x0f, 0x2d, 0x31, 0x15, 0x36, 0x3f, 0x24, 0x1d, 0x25, 0x01, 0x37, 0x33, 0x16, 0x1a, 0x1f, 0x0e, 0x10, 0x2f, 0x0b, 0x12 - .byte 0x2a, 0x1a, 0x25, 0x17, 0x0a, 0x35, 0x09, 0x28, 0x35, 0x02, 0x13, 0x36, 0x34, 0x2f, 0x17, 0x03, 0x04, 0x31, 0x3e, 0x26, 0x11, 0x35, 0x33, 0x31, 0x22, 0x17, 0x23, 0x1d, 0x05, 0x2b, 0x2e, 0x27 - .byte 0x20, 0x03, 0x2b, 0x1d, 0x01, 0x19, 0x1e, 0x0e, 0x05, 0x18, 0x16, 0x25, 0x17, 0x02, 0x28, 0x18, 0x19, 0x0b, 0x24, 0x3e, 0x35, 0x16, 0x2e, 0x29, 0x25, 0x3e, 0x38, 0x1e, 0x3a, 0x2f, 0x12, 0x14 - .byte 0x17, 0x2d, 0x11, 0x12, 0x30, 0x15, 0x31, 0x18, 0x08, 0x0b, 0x29, 0x2d, 0x00, 0x33, 0x2c, 0x06, 0x1a, 0x14, 0x1c, 0x2e, 0x04, 0x08, 0x12, 0x1b, 0x2b, 0x2d, 0x2a, 0x37, 0x33, 0x10, 0x27, 0x2c - .byte 0x1d, 0x0e, 0x34, 0x20, 0x02, 0x12, 0x1e, 0x1a, 0x2e, 0x07, 0x0b, 0x10, 0x36, 0x1e, 0x33, 0x2b, 0x28, 0x1b, 0x31, 0x25, 0x1f, 0x38, 0x3a, 0x2f, 0x39, 0x30, 0x2f, 0x12, 0x09, 0x14, 0x0e, 0x08 - .byte 0x19, 0x00, 0x0d, 0x2c, 0x1b, 0x0e, 0x34, 0x11, 0x25, 0x15, 0x0c, 0x2d, 0x26, 0x36, 0x2c, 0x16, 0x31, 0x31, 0x2c, 0x03, 0x1a, 0x16, 0x1c, 0x32, 0x14, 0x0a, 0x3e, 0x36, 0x33, 0x1b, 0x27, 0x1f - .byte 0x32, 0x18, 0x33, 0x26, 0x33, 0x1a, 0x13, 0x1a, 0x0f, 0x34, 0x1c, 0x35, 0x2c, 0x2f, 0x38, 0x03, 0x18, 0x15, 0x0f, 0x27, 0x31, 0x29, 0x20, 0x28, 0x0e, 0x28, 0x31, 0x2c, 0x2e, 0x15, 0x19, 0x1b - .byte 0x10, 0x03, 0x2f, 0x2e, 0x2a, 0x32, 0x2a, 0x27, 0x1b, 0x36, 0x04, 0x1e, 0x3b, 0x04, 0x21, 0x07, 0x2f, 0x19, 0x27, 0x1d, 0x1d, 0x3c, 0x3d, 0x2e, 0x25, 0x08, 0x32, 0x3b, 0x34, 0x2a, 0x0c, 0x10 - .byte 0x13, 0x25, 0x35, 0x1a, 0x2f, 0x19, 0x28, 0x17, 0x00, 0x2b, 0x0a, 0x1c, 0x17, 0x0a, 0x11, 0x1b, 0x35, 0x13, 0x37, 0x29, 0x1c, 0x28, 0x0c, 0x31, 0x35, 0x3c, 0x10, 0x1a, 0x1b, 0x3a, 0x2d, 0x3a - .byte 0x1c, 0x18, 0x22, 0x10, 0x2d, 0x1c, 0x3c, 0x12, 0x17, 0x18, 0x2a, 0x0b, 0x2b, 0x2f, 0x2d, 0x04, 0x2e, 0x3c, 0x13, 0x23, 0x01, 0x1c, 0x2e, 0x14, 0x16, 0x22, 0x0c, 0x24, 0x13, 0x35, 0x37, 0x34 - .byte 0x1b, 0x30, 0x1e, 0x3a, 0x1c, 0x20, 0x06, 0x06, 0x36, 0x09, 0x15, 0x1a, 0x1b, 0x1a, 0x27, 0x0f, 0x33, 0x35, 0x37, 0x06, 0x23, 0x3a, 0x12, 0x1d, 0x00, 0x16, 0x29, 0x0e, 0x1d, 0x35, 0x3f, 0x38 - .byte 0x16, 0x2a, 0x3c, 0x34, 0x13, 0x32, 0x10, 0x17, 0x2c, 0x37, 0x29, 0x2a, 0x1e, 0x35, 0x2f, 0x2d, 0x3c, 0x2a, 0x11, 0x28, 0x13, 0x21, 0x19, 0x1e, 0x34, 0x0c, 0x06, 0x2d, 0x09, 0x04, 0x1c, 0x1d - .byte 0x2f, 0x26, 0x39, 0x07, 0x16, 0x14, 0x04, 0x2d, 0x3a, 0x2f, 0x2e, 0x29, 0x15, 0x35, 0x24, 0x02, 0x36, 0x3f, 0x02, 0x1a, 0x0f, 0x18, 0x24, 0x16, 0x1d, 0x19, 0x14, 0x16, 0x10, 0x29, 0x1b, 0x13 - .byte 0x15, 0x0e, 0x19, 0x3a, 0x2e, 0x2b, 0x08, 0x30, 0x15, 0x35, 0x16, 0x30, 0x2e, 0x18, 0x35, 0x3b, 0x0b, 0x1c, 0x3a, 0x18, 0x13, 0x29, 0x13, 0x1e, 0x20, 0x13, 0x27, 0x04, 0x1d, 0x34, 0x00, 0x38 - .byte 0x19, 0x08, 0x39, 0x32, 0x20, 0x10, 0x26, 0x08, 0x02, 0x28, 0x3f, 0x0f, 0x16, 0x30, 0x1f, 0x19, 0x20, 0x2d, 0x10, 0x38, 0x17, 0x1c, 0x18, 0x31, 0x27, 0x33, 0x38, 0x30, 0x16, 0x33, 0x23, 0x00 - .byte 0x01, 0x36, 0x0d, 0x02, 0x23, 0x39, 0x04, 0x1f, 0x0e, 0x30, 0x24, 0x06, 0x01, 0x2c, 0x34, 0x33, 0x35, 0x16, 0x34, 0x2e, 0x32, 0x16, 0x24, 0x26, 0x39, 0x34, 0x1f, 0x3c, 0x1d, 0x28, 0x1d, 0x37 - .byte 0x17, 0x15, 0x2b, 0x27, 0x39, 0x30, 0x0b, 0x1b, 0x18, 0x35, 0x20, 0x2d, 0x0b, 0x35, 0x1c, 0x03, 0x0e, 0x21, 0x06, 0x0c, 0x20, 0x02, 0x18, 0x34, 0x1e, 0x36, 0x2d, 0x16, 0x0c, 0x19, 0x25, 0x09 - .byte 0x2c, 0x37, 0x05, 0x2e, 0x2e, 0x2b, 0x2c, 0x24, 0x1a, 0x14, 0x27, 0x04, 0x10, 0x32, 0x38, 0x33, 0x37, 0x15, 0x35, 0x11, 0x3f, 0x1d, 0x23, 0x23, 0x1f, 0x29, 0x3f, 0x1d, 0x1a, 0x3c, 0x2b, 0x1b - .byte 0x2c, 0x2c, 0x38, 0x3b, 0x36, 0x04, 0x13, 0x33, 0x2c, 0x14, 0x12, 0x1a, 0x09, 0x1b, 0x36, 0x11, 0x24, 0x3a, 0x3f, 0x11, 0x01, 0x0e, 0x2b, 0x3b, 0x03, 0x2a, 0x08, 0x0d, 0x2b, 0x2b, 0x13, 0x27 - .byte 0x3a, 0x3c, 0x1c, 0x3a, 0x15, 0x2a, 0x24, 0x00, 0x17, 0x3e, 0x0a, 0x15, 0x0c, 0x29, 0x2d, 0x1f, 0x15, 0x30, 0x35, 0x18, 0x19, 0x3d, 0x37, 0x37, 0x12, 0x38, 0x1b, 0x3b, 0x02, 0x20, 0x08, 0x21 - .byte 0x19, 0x2e, 0x36, 0x1d, 0x15, 0x3d, 0x24, 0x22, 0x0c, 0x27, 0x36, 0x3f, 0x33, 0x33, 0x12, 0x11, 0x1a, 0x19, 0x1f, 0x2b, 0x24, 0x12, 0x11, 0x2a, 0x18, 0x25, 0x32, 0x2a, 0x2c, 0x1a, 0x12, 0x26 - .byte 0x06, 0x10, 0x11, 0x29, 0x33, 0x2c, 0x09, 0x14, 0x2b, 0x12, 0x2b, 0x1d, 0x03, 0x24, 0x00, 0x12, 0x15, 0x22, 0x3d, 0x26, 0x15, 0x37, 0x1a, 0x0f, 0x12, 0x37, 0x24, 0x01, 0x18, 0x2a, 0x17, 0x13 - .byte 0x14, 0x3b, 0x29, 0x2a, 0x19, 0x32, 0x2d, 0x17, 0x17, 0x0b, 0x2c, 0x33, 0x07, 0x2d, 0x34, 0x07, 0x38, 0x1d, 0x1f, 0x36, 0x22, 0x11, 0x0a, 0x17, 0x14, 0x11, 0x13, 0x2a, 0x17, 0x25, 0x01, 0x3a - .byte 0x1c, 0x26, 0x27, 0x30, 0x2d, 0x3b, 0x35, 0x3a, 0x30, 0x34, 0x06, 0x3a, 0x1c, 0x2d, 0x05, 0x13, 0x21, 0x32, 0x12, 0x3e, 0x1e, 0x2c, 0x3a, 0x3f, 0x2d, 0x20, 0x2a, 0x34, 0x26, 0x03, 0x1a, 0x19 - .byte 0x27, 0x2e, 0x31, 0x04, 0x26, 0x2a, 0x3f, 0x30, 0x25, 0x23, 0x2a, 0x08, 0x08, 0x35, 0x2c, 0x30, 0x1e, 0x08, 0x05, 0x18, 0x06, 0x09, 0x2d, 0x19, 0x00, 0x27, 0x0d, 0x10, 0x19, 0x1c, 0x00, 0x13 - .byte 0x3d, 0x0b, 0x24, 0x2e, 0x1f, 0x16, 0x3d, 0x18, 0x34, 0x12, 0x1e, 0x15, 0x15, 0x39, 0x25, 0x33, 0x0f, 0x17, 0x1a, 0x1c, 0x1b, 0x37, 0x29, 0x1b, 0x3b, 0x38, 0x12, 0x1d, 0x22, 0x34, 0x26, 0x0a - .byte 0x31, 0x16, 0x2d, 0x13, 0x0d, 0x20, 0x27, 0x24, 0x1d, 0x16, 0x2e, 0x2b, 0x18, 0x16, 0x2a, 0x1b, 0x24, 0x17, 0x36, 0x02, 0x05, 0x2b, 0x37, 0x1a, 0x17, 0x11, 0x3d, 0x2c, 0x1e, 0x2f, 0x22, 0x2c - .byte 0x29, 0x1a, 0x2f, 0x04, 0x25, 0x36, 0x0c, 0x35, 0x30, 0x3e, 0x12, 0x11, 0x30, 0x37, 0x12, 0x21, 0x2e, 0x21, 0x30, 0x17, 0x2c, 0x3d, 0x24, 0x11, 0x23, 0x14, 0x1a, 0x32, 0x17, 0x39, 0x27, 0x18 - .byte 0x0f, 0x24, 0x19, 0x00, 0x3d, 0x37, 0x2c, 0x3c, 0x1c, 0x0b, 0x39, 0x23, 0x0e, 0x04, 0x1f, 0x1c, 0x31, 0x14, 0x00, 0x04, 0x15, 0x26, 0x2a, 0x2a, 0x20, 0x25, 0x2a, 0x0b, 0x3c, 0x33, 0x11, 0x0b - .byte 0x2e, 0x37, 0x22, 0x2e, 0x0e, 0x22, 0x26, 0x18, 0x2d, 0x27, 0x06, 0x0c, 0x1c, 0x26, 0x18, 0x2f, 0x3a, 0x01, 0x2a, 0x2f, 0x31, 0x34, 0x1f, 0x34, 0x1a, 0x31, 0x05, 0x10, 0x2e, 0x17, 0x34, 0x18 - .byte 0x22, 0x23, 0x23, 0x21, 0x32, 0x07, 0x08, 0x22, 0x26, 0x1c, 0x22, 0x31, 0x12, 0x2f, 0x08, 0x1f, 0x10, 0x27, 0x15, 0x2a, 0x1f, 0x0b, 0x26, 0x2f, 0x14, 0x35, 0x24, 0x1f, 0x26, 0x3b, 0x23, 0x33 - .byte 0x20, 0x3e, 0x2d, 0x17, 0x0c, 0x15, 0x13, 0x39, 0x1a, 0x30, 0x14, 0x25, 0x09, 0x07, 0x17, 0x38, 0x38, 0x1f, 0x29, 0x24, 0x27, 0x17, 0x27, 0x28, 0x1b, 0x12, 0x2a, 0x2b, 0x3d, 0x2d, 0x19, 0x34 - .byte 0x1c, 0x01, 0x1d, 0x10, 0x08, 0x39, 0x11, 0x0e, 0x36, 0x1b, 0x26, 0x13, 0x10, 0x16, 0x28, 0x1e, 0x3c, 0x28, 0x17, 0x3e, 0x39, 0x34, 0x0a, 0x03, 0x2e, 0x37, 0x1a, 0x13, 0x2b, 0x33, 0x26, 0x13 - .byte 0x2c, 0x21, 0x25, 0x14, 0x10, 0x16, 0x0b, 0x35, 0x1d, 0x35, 0x33, 0x21, 0x08, 0x33, 0x28, 0x21, 0x1a, 0x12, 0x0c, 0x1b, 0x36, 0x2a, 0x19, 0x2c, 0x2b, 0x23, 0x01, 0x0f, 0x26, 0x17, 0x0c, 0x18 - .byte 0x09, 0x0f, 0x11, 0x2b, 0x24, 0x1c, 0x09, 0x09, 0x15, 0x36, 0x08, 0x13, 0x20, 0x39, 0x21, 0x00, 0x3a, 0x1f, 0x2b, 0x36, 0x31, 0x02, 0x37, 0x13, 0x04, 0x34, 0x35, 0x37, 0x3d, 0x1a, 0x17, 0x3d - .byte 0x13, 0x2b, 0x36, 0x2f, 0x13, 0x1e, 0x13, 0x3e, 0x11, 0x33, 0x27, 0x3a, 0x2d, 0x1e, 0x31, 0x1a, 0x03, 0x03, 0x2d, 0x25, 0x37, 0x1f, 0x11, 0x01, 0x22, 0x1c, 0x12, 0x17, 0x30, 0x3a, 0x30, 0x17 - .byte 0x1d, 0x29, 0x0e, 0x13, 0x27, 0x1a, 0x2e, 0x24, 0x2d, 0x00, 0x1c, 0x17, 0x28, 0x1d, 0x09, 0x1f, 0x2e, 0x1a, 0x2d, 0x26, 0x0a, 0x13, 0x32, 0x3e, 0x00, 0x27, 0x0b, 0x3b, 0x30, 0x08, 0x3a, 0x2d - .byte 0x22, 0x12, 0x1e, 0x34, 0x1d, 0x2b, 0x26, 0x22, 0x35, 0x17, 0x2c, 0x17, 0x29, 0x13, 0x2d, 0x2d, 0x10, 0x10, 0x20, 0x31, 0x23, 0x1e, 0x33, 0x18, 0x33, 0x06, 0x2d, 0x26, 0x14, 0x27, 0x22, 0x1d - .byte 0x2a, 0x2d, 0x06, 0x18, 0x07, 0x09, 0x2e, 0x21, 0x15, 0x2e, 0x21, 0x38, 0x23, 0x35, 0x0b, 0x34, 0x24, 0x0b, 0x22, 0x1e, 0x01, 0x17, 0x0b, 0x24, 0x11, 0x17, 0x07, 0x20, 0x14, 0x25, 0x32, 0x1a - .byte 0x0e, 0x2f, 0x35, 0x17, 0x1f, 0x0c, 0x08, 0x21, 0x30, 0x35, 0x1f, 0x0c, 0x0b, 0x20, 0x04, 0x10, 0x11, 0x35, 0x11, 0x1e, 0x33, 0x3d, 0x16, 0x1e, 0x2b, 0x1d, 0x1a, 0x19, 0x10, 0x04, 0x06, 0x22 - .byte 0x03, 0x3d, 0x24, 0x2a, 0x0e, 0x35, 0x03, 0x3e, 0x17, 0x0b, 0x18, 0x36, 0x3d, 0x0d, 0x26, 0x35, 0x12, 0x20, 0x1f, 0x0d, 0x16, 0x23, 0x32, 0x1a, 0x00, 0x3d, 0x26, 0x30, 0x19, 0x36, 0x12, 0x0e - .byte 0x23, 0x01, 0x23, 0x28, 0x3b, 0x31, 0x11, 0x2d, 0x1c, 0x36, 0x2a, 0x05, 0x16, 0x14, 0x0e, 0x30, 0x3a, 0x37, 0x19, 0x1f, 0x30, 0x25, 0x10, 0x26, 0x2f, 0x22, 0x11, 0x1f, 0x2e, 0x2b, 0x1e, 0x16 - .byte 0x16, 0x21, 0x32, 0x18, 0x35, 0x23, 0x32, 0x1a, 0x3d, 0x0d, 0x19, 0x39, 0x09, 0x23, 0x30, 0x2e, 0x24, 0x1e, 0x0f, 0x24, 0x09, 0x21, 0x31, 0x05, 0x03, 0x11, 0x05, 0x22, 0x2a, 0x03, 0x07, 0x37 - .byte 0x04, 0x08, 0x13, 0x05, 0x10, 0x34, 0x37, 0x14, 0x29, 0x0a, 0x24, 0x32, 0x34, 0x1e, 0x1b, 0x12, 0x17, 0x2e, 0x01, 0x02, 0x13, 0x0a, 0x0c, 0x11, 0x02, 0x14, 0x13, 0x0d, 0x25, 0x23, 0x00, 0x07 - .byte 0x1a, 0x1c, 0x28, 0x35, 0x08, 0x0e, 0x2c, 0x1b, 0x3c, 0x15, 0x1c, 0x19, 0x1d, 0x32, 0x13, 0x1a, 0x1c, 0x00, 0x37, 0x22, 0x1b, 0x35, 0x39, 0x3e, 0x14, 0x32, 0x06, 0x31, 0x17, 0x05, 0x2b, 0x01 - .byte 0x0f, 0x20, 0x1e, 0x0f, 0x34, 0x18, 0x03, 0x1f, 0x2b, 0x00, 0x14, 0x15, 0x3a, 0x30, 0x25, 0x30, 0x21, 0x0b, 0x00, 0x37, 0x24, 0x37, 0x1d, 0x29, 0x21, 0x16, 0x24, 0x0f, 0x2c, 0x3e, 0x15, 0x36 - .byte 0x3c, 0x2d, 0x23, 0x3d, 0x3c, 0x17, 0x1a, 0x1c, 0x13, 0x0a, 0x29, 0x22, 0x25, 0x3f, 0x26, 0x3b, 0x39, 0x2f, 0x1d, 0x08, 0x16, 0x0b, 0x19, 0x14, 0x12, 0x01, 0x2c, 0x35, 0x11, 0x2a, 0x02, 0x00 - .byte 0x13, 0x39, 0x2a, 0x35, 0x07, 0x1a, 0x11, 0x24, 0x0e, 0x1e, 0x0e, 0x2c, 0x15, 0x08, 0x31, 0x1b, 0x21, 0x1d, 0x26, 0x1d, 0x1c, 0x2a, 0x1d, 0x24, 0x13, 0x01, 0x00, 0x18, 0x28, 0x2a, 0x37, 0x15 - .byte 0x0f, 0x13, 0x10, 0x32, 0x36, 0x22, 0x13, 0x31, 0x13, 0x05, 0x1e, 0x17, 0x35, 0x35, 0x3b, 0x0e, 0x24, 0x35, 0x3a, 0x1d, 0x1b, 0x36, 0x1b, 0x03, 0x1d, 0x24, 0x0f, 0x16, 0x30, 0x2d, 0x09, 0x25 - .byte 0x05, 0x21, 0x13, 0x0a, 0x27, 0x36, 0x04, 0x0d, 0x1c, 0x06, 0x3e, 0x21, 0x2a, 0x27, 0x33, 0x28, 0x0e, 0x15, 0x0b, 0x17, 0x1d, 0x1d, 0x32, 0x2d, 0x08, 0x3d, 0x29, 0x21, 0x32, 0x17, 0x33, 0x31 - .byte 0x22, 0x0e, 0x03, 0x21, 0x0d, 0x0b, 0x16, 0x3e, 0x2a, 0x2e, 0x19, 0x36, 0x2a, 0x0d, 0x00, 0x14, 0x22, 0x07, 0x36, 0x0a, 0x09, 0x15, 0x14, 0x10, 0x22, 0x07, 0x16, 0x2c, 0x36, 0x13, 0x15, 0x09 - .byte 0x2f, 0x1b, 0x20, 0x3b, 0x2e, 0x3a, 0x3a, 0x16, 0x0d, 0x15, 0x2a, 0x39, 0x13, 0x2b, 0x0b, 0x01, 0x2a, 0x13, 0x17, 0x1e, 0x08, 0x17, 0x1e, 0x0c, 0x0f, 0x34, 0x1f, 0x31, 0x12, 0x07, 0x3a, 0x1d - .byte 0x35, 0x1e, 0x12, 0x24, 0x2c, 0x15, 0x0e, 0x21, 0x19, 0x34, 0x3b, 0x33, 0x19, 0x0f, 0x28, 0x10, 0x2f, 0x2e, 0x23, 0x27, 0x31, 0x39, 0x2e, 0x18, 0x3c, 0x3f, 0x24, 0x07, 0x23, 0x30, 0x28, 0x13 - .byte 0x35, 0x13, 0x0a, 0x10, 0x35, 0x19, 0x33, 0x23, 0x28, 0x29, 0x13, 0x2f, 0x1a, 0x3a, 0x19, 0x14, 0x37, 0x36, 0x26, 0x20, 0x3b, 0x15, 0x37, 0x39, 0x10, 0x3c, 0x21, 0x34, 0x1c, 0x38, 0x30, 0x15 - .byte 0x07, 0x26, 0x27, 0x21, 0x19, 0x18, 0x11, 0x23, 0x30, 0x28, 0x37, 0x32, 0x2d, 0x1f, 0x2c, 0x3f, 0x30, 0x1d, 0x2f, 0x26, 0x01, 0x11, 0x1c, 0x3b, 0x0f, 0x12, 0x2a, 0x17, 0x27, 0x05, 0x00, 0x1b - .byte 0x25, 0x1c, 0x32, 0x04, 0x22, 0x2d, 0x10, 0x0f, 0x25, 0x0d, 0x39, 0x30, 0x0b, 0x2e, 0x27, 0x2d, 0x34, 0x15, 0x3e, 0x30, 0x36, 0x16, 0x26, 0x2a, 0x05, 0x3f, 0x2b, 0x20, 0x3b, 0x2e, 0x3b, 0x1c - .byte 0x2f, 0x01, 0x18, 0x16, 0x16, 0x3d, 0x10, 0x0a, 0x1f, 0x18, 0x17, 0x0f, 0x22, 0x06, 0x13, 0x11, 0x38, 0x21, 0x17, 0x17, 0x0a, 0x37, 0x1c, 0x19, 0x30, 0x16, 0x38, 0x31, 0x30, 0x10, 0x36, 0x31 - .byte 0x2f, 0x26, 0x3c, 0x1b, 0x23, 0x33, 0x2f, 0x19, 0x16, 0x35, 0x25, 0x3a, 0x18, 0x1f, 0x37, 0x01, 0x1e, 0x0d, 0x18, 0x12, 0x1f, 0x1c, 0x1b, 0x07, 0x34, 0x2d, 0x0b, 0x3f, 0x33, 0x1e, 0x34, 0x1d - .byte 0x2c, 0x13, 0x2c, 0x20, 0x20, 0x13, 0x20, 0x0f, 0x31, 0x08, 0x0f, 0x24, 0x18, 0x3d, 0x1c, 0x36, 0x34, 0x27, 0x33, 0x2a, 0x25, 0x2d, 0x30, 0x26, 0x3d, 0x37, 0x26, 0x25, 0x11, 0x11, 0x03, 0x05 - .byte 0x18, 0x10, 0x04, 0x29, 0x07, 0x2e, 0x36, 0x2a, 0x29, 0x15, 0x3a, 0x0e, 0x33, 0x2a, 0x06, 0x29, 0x3d, 0x01, 0x29, 0x27, 0x0e, 0x16, 0x1d, 0x28, 0x1b, 0x10, 0x33, 0x2b, 0x0c, 0x14, 0x1d, 0x15 - .byte 0x3f, 0x25, 0x37, 0x23, 0x1e, 0x04, 0x2c, 0x1c, 0x15, 0x34, 0x2a, 0x09, 0x2f, 0x15, 0x02, 0x3f, 0x14, 0x19, 0x2c, 0x33, 0x39, 0x32, 0x20, 0x2a, 0x18, 0x32, 0x17, 0x23, 0x21, 0x0b, 0x2d, 0x25 - .byte 0x24, 0x3a, 0x2d, 0x31, 0x3f, 0x34, 0x18, 0x19, 0x24, 0x1e, 0x15, 0x1a, 0x17, 0x33, 0x2b, 0x23, 0x09, 0x26, 0x1b, 0x0d, 0x15, 0x36, 0x26, 0x28, 0x3a, 0x1c, 0x14, 0x0c, 0x3e, 0x10, 0x18, 0x06 - .byte 0x35, 0x37, 0x26, 0x36, 0x21, 0x26, 0x17, 0x3d, 0x1c, 0x2c, 0x16, 0x25, 0x1d, 0x1e, 0x0b, 0x1e, 0x1d, 0x0d, 0x32, 0x08, 0x1f, 0x1b, 0x12, 0x1c, 0x12, 0x20, 0x2a, 0x28, 0x06, 0x3b, 0x35, 0x39 - .byte 0x0e, 0x1e, 0x31, 0x30, 0x28, 0x02, 0x21, 0x14, 0x06, 0x1e, 0x29, 0x16, 0x09, 0x1c, 0x27, 0x32, 0x2d, 0x39, 0x03, 0x27, 0x29, 0x09, 0x1e, 0x1b, 0x11, 0x1c, 0x28, 0x3a, 0x2c, 0x03, 0x03, 0x18 - .byte 0x23, 0x09, 0x2f, 0x30, 0x17, 0x23, 0x0f, 0x25, 0x33, 0x06, 0x24, 0x37, 0x22, 0x09, 0x33, 0x2c, 0x09, 0x2a, 0x0c, 0x12, 0x2a, 0x28, 0x20, 0x10, 0x15, 0x29, 0x33, 0x0f, 0x1a, 0x13, 0x13, 0x18 - .byte 0x36, 0x2e, 0x16, 0x13, 0x3c, 0x1a, 0x15, 0x3a, 0x11, 0x32, 0x02, 0x0a, 0x2c, 0x19, 0x39, 0x11, 0x31, 0x3e, 0x1d, 0x32, 0x14, 0x32, 0x12, 0x2e, 0x34, 0x3e, 0x36, 0x23, 0x37, 0x3e, 0x15, 0x15 - .byte 0x35, 0x34, 0x01, 0x3a, 0x2c, 0x26, 0x25, 0x22, 0x01, 0x2b, 0x37, 0x1c, 0x3d, 0x33, 0x3e, 0x10, 0x1c, 0x26, 0x33, 0x19, 0x05, 0x19, 0x17, 0x12, 0x38, 0x1c, 0x15, 0x3c, 0x32, 0x3f, 0x0f, 0x37 - .byte 0x02, 0x39, 0x32, 0x13, 0x00, 0x1d, 0x1d, 0x2c, 0x10, 0x39, 0x13, 0x31, 0x0f, 0x37, 0x19, 0x09, 0x0d, 0x2a, 0x20, 0x2f, 0x32, 0x3b, 0x34, 0x22, 0x26, 0x14, 0x10, 0x24, 0x3d, 0x22, 0x0b, 0x31 - .byte 0x23, 0x2f, 0x2d, 0x2a, 0x30, 0x04, 0x35, 0x19, 0x20, 0x2a, 0x16, 0x36, 0x37, 0x14, 0x28, 0x37, 0x11, 0x0b, 0x27, 0x1d, 0x06, 0x29, 0x35, 0x16, 0x2e, 0x24, 0x2e, 0x29, 0x36, 0x14, 0x2a, 0x21 - .byte 0x0c, 0x1f, 0x3f, 0x39, 0x19, 0x27, 0x10, 0x2a, 0x1e, 0x12, 0x34, 0x10, 0x24, 0x34, 0x1d, 0x13, 0x1d, 0x17, 0x16, 0x37, 0x27, 0x1b, 0x27, 0x07, 0x24, 0x21, 0x37, 0x21, 0x11, 0x37, 0x28, 0x24 - .byte 0x19, 0x02, 0x1c, 0x14, 0x12, 0x1d, 0x1b, 0x24, 0x2e, 0x2e, 0x3a, 0x15, 0x37, 0x34, 0x21, 0x33, 0x2d, 0x29, 0x2f, 0x1e, 0x34, 0x29, 0x3c, 0x12, 0x05, 0x15, 0x20, 0x05, 0x3e, 0x19, 0x18, 0x0b - .byte 0x30, 0x2f, 0x02, 0x27, 0x14, 0x1c, 0x34, 0x12, 0x20, 0x30, 0x2b, 0x22, 0x1b, 0x06, 0x31, 0x28, 0x15, 0x2d, 0x12, 0x01, 0x0e, 0x13, 0x13, 0x0c, 0x28, 0x07, 0x2a, 0x14, 0x1d, 0x36, 0x14, 0x15 - .byte 0x2b, 0x26, 0x03, 0x25, 0x15, 0x3e, 0x3b, 0x20, 0x35, 0x0c, 0x25, 0x2b, 0x16, 0x35, 0x1e, 0x31, 0x2c, 0x06, 0x03, 0x29, 0x24, 0x07, 0x1f, 0x32, 0x2f, 0x19, 0x25, 0x21, 0x31, 0x22, 0x26, 0x1d - .byte 0x00, 0x1b, 0x18, 0x2a, 0x24, 0x31, 0x20, 0x06, 0x2f, 0x1e, 0x32, 0x26, 0x32, 0x39, 0x12, 0x20, 0x01, 0x19, 0x0f, 0x15, 0x15, 0x27, 0x10, 0x2e, 0x09, 0x25, 0x19, 0x29, 0x37, 0x30, 0x13, 0x1c - .byte 0x1d, 0x29, 0x2d, 0x26, 0x02, 0x1a, 0x16, 0x1d, 0x2b, 0x1c, 0x18, 0x04, 0x34, 0x28, 0x2a, 0x21, 0x15, 0x1b, 0x2e, 0x16, 0x01, 0x10, 0x05, 0x09, 0x14, 0x22, 0x03, 0x22, 0x02, 0x1b, 0x34, 0x29 - .byte 0x2a, 0x23, 0x26, 0x36, 0x13, 0x23, 0x3d, 0x1a, 0x1d, 0x10, 0x24, 0x25, 0x2b, 0x37, 0x19, 0x24, 0x26, 0x28, 0x13, 0x16, 0x17, 0x14, 0x19, 0x0b, 0x2f, 0x25, 0x37, 0x34, 0x37, 0x39, 0x21, 0x1b - .byte 0x0f, 0x3d, 0x2d, 0x0d, 0x10, 0x20, 0x05, 0x0b, 0x2d, 0x01, 0x12, 0x24, 0x18, 0x3d, 0x32, 0x09, 0x21, 0x26, 0x1a, 0x0e, 0x1f, 0x30, 0x06, 0x1f, 0x0b, 0x3c, 0x29, 0x07, 0x3e, 0x27, 0x13, 0x1e - .byte 0x1a, 0x13, 0x07, 0x23, 0x10, 0x34, 0x1e, 0x32, 0x17, 0x23, 0x35, 0x16, 0x31, 0x32, 0x2e, 0x1b, 0x28, 0x0e, 0x22, 0x14, 0x3a, 0x23, 0x22, 0x03, 0x29, 0x2a, 0x10, 0x20, 0x3e, 0x3c, 0x27, 0x16 - .byte 0x20, 0x12, 0x3f, 0x24, 0x31, 0x0d, 0x2e, 0x32, 0x2f, 0x17, 0x2d, 0x36, 0x3b, 0x17, 0x24, 0x23, 0x18, 0x37, 0x1d, 0x13, 0x17, 0x3a, 0x1a, 0x0a, 0x3d, 0x1e, 0x05, 0x12, 0x16, 0x33, 0x32, 0x25 - .byte 0x1d, 0x1f, 0x29, 0x34, 0x2c, 0x26, 0x20, 0x29, 0x35, 0x0e, 0x32, 0x17, 0x01, 0x39, 0x2d, 0x27, 0x24, 0x23, 0x28, 0x3f, 0x18, 0x39, 0x38, 0x25, 0x23, 0x11, 0x11, 0x19, 0x2c, 0x29, 0x30, 0x08 - .byte 0x28, 0x25, 0x27, 0x1d, 0x17, 0x25, 0x21, 0x09, 0x3d, 0x16, 0x1b, 0x0f, 0x2c, 0x1b, 0x12, 0x22, 0x28, 0x3e, 0x26, 0x34, 0x10, 0x1b, 0x02, 0x34, 0x15, 0x1a, 0x29, 0x19, 0x29, 0x11, 0x31, 0x12 - .byte 0x27, 0x17, 0x27, 0x27, 0x2f, 0x34, 0x27, 0x24, 0x03, 0x19, 0x36, 0x17, 0x1d, 0x33, 0x19, 0x25, 0x1a, 0x2b, 0x39, 0x13, 0x3b, 0x33, 0x1d, 0x27, 0x31, 0x34, 0x28, 0x33, 0x37, 0x09, 0x30, 0x1b - .byte 0x03, 0x3a, 0x27, 0x19, 0x11, 0x1f, 0x0b, 0x1a, 0x34, 0x3d, 0x2a, 0x15, 0x04, 0x24, 0x36, 0x30, 0x23, 0x30, 0x0f, 0x22, 0x1b, 0x3d, 0x3d, 0x24, 0x29, 0x1d, 0x12, 0x16, 0x19, 0x2e, 0x03, 0x12 - .byte 0x17, 0x18, 0x25, 0x33, 0x2f, 0x23, 0x1a, 0x1a, 0x35, 0x27, 0x21, 0x26, 0x19, 0x1b, 0x30, 0x18, 0x2b, 0x22, 0x2d, 0x2c, 0x1a, 0x34, 0x3e, 0x12, 0x19, 0x28, 0x27, 0x15, 0x1b, 0x11, 0x12, 0x17 - .byte 0x15, 0x10, 0x34, 0x37, 0x25, 0x12, 0x3f, 0x15, 0x31, 0x0d, 0x37, 0x3e, 0x2a, 0x2d, 0x0f, 0x24, 0x24, 0x3c, 0x3f, 0x1f, 0x1d, 0x34, 0x17, 0x1a, 0x23, 0x1f, 0x37, 0x0f, 0x10, 0x32, 0x34, 0x35 - .byte 0x19, 0x05, 0x22, 0x33, 0x16, 0x34, 0x1e, 0x14, 0x1e, 0x08, 0x13, 0x29, 0x3a, 0x37, 0x30, 0x1d, 0x36, 0x15, 0x29, 0x2e, 0x1d, 0x32, 0x2e, 0x23, 0x35, 0x17, 0x1c, 0x36, 0x1d, 0x13, 0x23, 0x34 - .byte 0x34, 0x24, 0x1a, 0x37, 0x2f, 0x26, 0x2e, 0x1e, 0x17, 0x1a, 0x1f, 0x15, 0x1f, 0x2b, 0x1f, 0x19, 0x0a, 0x33, 0x1a, 0x35, 0x31, 0x24, 0x2d, 0x17, 0x2c, 0x0c, 0x21, 0x36, 0x2c, 0x35, 0x35, 0x1b - .byte 0x03, 0x27, 0x01, 0x0d, 0x1d, 0x1c, 0x0e, 0x11, 0x11, 0x2b, 0x10, 0x25, 0x3b, 0x20, 0x1f, 0x17, 0x19, 0x20, 0x08, 0x36, 0x13, 0x38, 0x19, 0x1b, 0x2b, 0x24, 0x0b, 0x1f, 0x29, 0x27, 0x15, 0x2c - .byte 0x37, 0x39, 0x10, 0x3a, 0x15, 0x2e, 0x2f, 0x11, 0x36, 0x24, 0x04, 0x20, 0x3b, 0x2a, 0x35, 0x27, 0x35, 0x34, 0x0d, 0x1b, 0x20, 0x10, 0x22, 0x37, 0x1f, 0x38, 0x27, 0x31, 0x0f, 0x28, 0x28, 0x25 - .byte 0x15, 0x00, 0x1d, 0x25, 0x31, 0x28, 0x28, 0x0b, 0x3a, 0x1d, 0x2d, 0x13, 0x1b, 0x03, 0x37, 0x2e, 0x1d, 0x28, 0x19, 0x08, 0x2d, 0x22, 0x27, 0x39, 0x32, 0x3f, 0x2f, 0x1d, 0x33, 0x34, 0x28, 0x18 - .byte 0x08, 0x31, 0x23, 0x1f, 0x13, 0x0d, 0x2c, 0x23, 0x3a, 0x2d, 0x1a, 0x02, 0x25, 0x13, 0x20, 0x36, 0x34, 0x12, 0x2b, 0x2d, 0x35, 0x35, 0x34, 0x23, 0x20, 0x21, 0x3a, 0x19, 0x1b, 0x1f, 0x2b, 0x19 - .byte 0x35, 0x0e, 0x19, 0x26, 0x24, 0x37, 0x18, 0x08, 0x10, 0x0c, 0x16, 0x2d, 0x1f, 0x34, 0x21, 0x05, 0x38, 0x19, 0x14, 0x21, 0x24, 0x11, 0x31, 0x14, 0x3e, 0x38, 0x29, 0x3f, 0x08, 0x25, 0x2a, 0x1f - .byte 0x25, 0x25, 0x06, 0x28, 0x0b, 0x1e, 0x14, 0x1a, 0x38, 0x22, 0x24, 0x18, 0x29, 0x1a, 0x11, 0x20, 0x3b, 0x3a, 0x1e, 0x1c, 0x26, 0x1a, 0x05, 0x32, 0x19, 0x39, 0x2a, 0x31, 0x09, 0x07, 0x25, 0x05 - .byte 0x3e, 0x16, 0x34, 0x26, 0x14, 0x1b, 0x32, 0x26, 0x05, 0x08, 0x37, 0x0f, 0x03, 0x20, 0x2a, 0x39, 0x31, 0x08, 0x01, 0x1e, 0x1d, 0x23, 0x31, 0x28, 0x1b, 0x28, 0x1e, 0x37, 0x14, 0x13, 0x0e, 0x28 - .byte 0x2a, 0x3b, 0x37, 0x2f, 0x1c, 0x28, 0x30, 0x30, 0x1a, 0x36, 0x1f, 0x16, 0x3e, 0x0d, 0x15, 0x2e, 0x16, 0x18, 0x15, 0x37, 0x20, 0x2a, 0x33, 0x30, 0x2b, 0x0e, 0x25, 0x18, 0x20, 0x16, 0x02, 0x19 - .byte 0x25, 0x0a, 0x2e, 0x30, 0x16, 0x03, 0x11, 0x04, 0x27, 0x25, 0x1b, 0x1c, 0x21, 0x29, 0x04, 0x27, 0x3d, 0x20, 0x1e, 0x28, 0x33, 0x31, 0x1e, 0x39, 0x10, 0x31, 0x29, 0x1e, 0x06, 0x25, 0x28, 0x19 - .byte 0x3b, 0x12, 0x0b, 0x1b, 0x1c, 0x3e, 0x37, 0x20, 0x0a, 0x37, 0x33, 0x02, 0x2c, 0x25, 0x15, 0x18, 0x14, 0x3b, 0x20, 0x1c, 0x22, 0x3b, 0x1c, 0x24, 0x34, 0x35, 0x0f, 0x2f, 0x31, 0x3b, 0x17, 0x35 - .byte 0x30, 0x39, 0x37, 0x0d, 0x15, 0x11, 0x10, 0x03, 0x1e, 0x1a, 0x39, 0x33, 0x2f, 0x2e, 0x28, 0x1c, 0x28, 0x36, 0x28, 0x18, 0x1f, 0x15, 0x01, 0x30, 0x3e, 0x32, 0x28, 0x34, 0x2f, 0x23, 0x07, 0x0c - .byte 0x36, 0x28, 0x2c, 0x34, 0x2a, 0x0c, 0x1f, 0x3f, 0x20, 0x13, 0x2b, 0x17, 0x27, 0x28, 0x29, 0x2a, 0x3c, 0x13, 0x36, 0x26, 0x2d, 0x2a, 0x0a, 0x06, 0x1e, 0x20, 0x04, 0x1a, 0x02, 0x07, 0x35, 0x0e - .byte 0x18, 0x30, 0x00, 0x34, 0x34, 0x2f, 0x14, 0x37, 0x21, 0x30, 0x1f, 0x15, 0x37, 0x1b, 0x3a, 0x0b, 0x32, 0x22, 0x22, 0x21, 0x1b, 0x35, 0x23, 0x0d, 0x03, 0x1c, 0x23, 0x3b, 0x13, 0x0e, 0x1d, 0x1f - .byte 0x1d, 0x3f, 0x2e, 0x39, 0x27, 0x2e, 0x0f, 0x38, 0x20, 0x31, 0x3c, 0x35, 0x0b, 0x0f, 0x2e, 0x06, 0x06, 0x28, 0x25, 0x39, 0x23, 0x0a, 0x32, 0x15, 0x0f, 0x1d, 0x25, 0x0c, 0x0d, 0x34, 0x12, 0x2e - .byte 0x21, 0x36, 0x18, 0x1f, 0x1f, 0x34, 0x1b, 0x05, 0x3a, 0x36, 0x2b, 0x01, 0x17, 0x0e, 0x16, 0x2b, 0x0e, 0x0b, 0x26, 0x0d, 0x2d, 0x10, 0x21, 0x11, 0x27, 0x3d, 0x13, 0x32, 0x15, 0x25, 0x2a, 0x1b - .byte 0x2d, 0x35, 0x2c, 0x2b, 0x26, 0x26, 0x1f, 0x20, 0x22, 0x2b, 0x12, 0x3f, 0x3d, 0x27, 0x30, 0x0a, 0x36, 0x35, 0x1f, 0x17, 0x21, 0x08, 0x29, 0x1d, 0x20, 0x33, 0x34, 0x11, 0x16, 0x05, 0x38, 0x2d - diff --git a/data/layouts/Unknown_084693AC/border.bin b/data/layouts/BattleFrontier_BattlePikeRoomUnused/border.bin similarity index 100% rename from data/layouts/Unknown_084693AC/border.bin rename to data/layouts/BattleFrontier_BattlePikeRoomUnused/border.bin diff --git a/data/layouts/Unknown_084693AC/map.bin b/data/layouts/BattleFrontier_BattlePikeRoomUnused/map.bin similarity index 100% rename from data/layouts/Unknown_084693AC/map.bin rename to data/layouts/BattleFrontier_BattlePikeRoomUnused/map.bin diff --git a/data/layouts/Unknown_0843E6C0/border.bin b/data/layouts/UnusedCave1/border.bin similarity index 100% rename from data/layouts/Unknown_0843E6C0/border.bin rename to data/layouts/UnusedCave1/border.bin diff --git a/data/layouts/Unknown_0843E6C0/map.bin b/data/layouts/UnusedCave1/map.bin similarity index 100% rename from data/layouts/Unknown_0843E6C0/map.bin rename to data/layouts/UnusedCave1/map.bin diff --git a/data/layouts/Unknown_0843E6E4/border.bin b/data/layouts/UnusedCave10/border.bin similarity index 100% rename from data/layouts/Unknown_0843E6E4/border.bin rename to data/layouts/UnusedCave10/border.bin diff --git a/data/layouts/Unknown_0843E6E4/map.bin b/data/layouts/UnusedCave10/map.bin similarity index 100% rename from data/layouts/Unknown_0843E6E4/map.bin rename to data/layouts/UnusedCave10/map.bin diff --git a/data/layouts/Unknown_0843E708/border.bin b/data/layouts/UnusedCave11/border.bin similarity index 100% rename from data/layouts/Unknown_0843E708/border.bin rename to data/layouts/UnusedCave11/border.bin diff --git a/data/layouts/Unknown_0843E708/map.bin b/data/layouts/UnusedCave11/map.bin similarity index 100% rename from data/layouts/Unknown_0843E708/map.bin rename to data/layouts/UnusedCave11/map.bin diff --git a/data/layouts/Unknown_0843E72C/border.bin b/data/layouts/UnusedCave12/border.bin similarity index 100% rename from data/layouts/Unknown_0843E72C/border.bin rename to data/layouts/UnusedCave12/border.bin diff --git a/data/layouts/Unknown_0843E72C/map.bin b/data/layouts/UnusedCave12/map.bin similarity index 100% rename from data/layouts/Unknown_0843E72C/map.bin rename to data/layouts/UnusedCave12/map.bin diff --git a/data/layouts/Unknown_0843E750/border.bin b/data/layouts/UnusedCave13/border.bin similarity index 100% rename from data/layouts/Unknown_0843E750/border.bin rename to data/layouts/UnusedCave13/border.bin diff --git a/data/layouts/Unknown_0843E750/map.bin b/data/layouts/UnusedCave13/map.bin similarity index 100% rename from data/layouts/Unknown_0843E750/map.bin rename to data/layouts/UnusedCave13/map.bin diff --git a/data/layouts/Unknown_0843E774/border.bin b/data/layouts/UnusedCave14/border.bin similarity index 100% rename from data/layouts/Unknown_0843E774/border.bin rename to data/layouts/UnusedCave14/border.bin diff --git a/data/layouts/Unknown_0843E774/map.bin b/data/layouts/UnusedCave14/map.bin similarity index 100% rename from data/layouts/Unknown_0843E774/map.bin rename to data/layouts/UnusedCave14/map.bin diff --git a/data/layouts/Unknown_0843E798/border.bin b/data/layouts/UnusedCave2/border.bin similarity index 100% rename from data/layouts/Unknown_0843E798/border.bin rename to data/layouts/UnusedCave2/border.bin diff --git a/data/layouts/Unknown_0843E798/map.bin b/data/layouts/UnusedCave2/map.bin similarity index 100% rename from data/layouts/Unknown_0843E798/map.bin rename to data/layouts/UnusedCave2/map.bin diff --git a/data/layouts/Unknown_0843E7BC/border.bin b/data/layouts/UnusedCave3/border.bin similarity index 100% rename from data/layouts/Unknown_0843E7BC/border.bin rename to data/layouts/UnusedCave3/border.bin diff --git a/data/layouts/Unknown_0843E7BC/map.bin b/data/layouts/UnusedCave3/map.bin similarity index 100% rename from data/layouts/Unknown_0843E7BC/map.bin rename to data/layouts/UnusedCave3/map.bin diff --git a/data/layouts/Unknown_0843E7E0/border.bin b/data/layouts/UnusedCave4/border.bin similarity index 100% rename from data/layouts/Unknown_0843E7E0/border.bin rename to data/layouts/UnusedCave4/border.bin diff --git a/data/layouts/Unknown_0843E7E0/map.bin b/data/layouts/UnusedCave4/map.bin similarity index 100% rename from data/layouts/Unknown_0843E7E0/map.bin rename to data/layouts/UnusedCave4/map.bin diff --git a/data/layouts/Unknown_0843E804/border.bin b/data/layouts/UnusedCave5/border.bin similarity index 100% rename from data/layouts/Unknown_0843E804/border.bin rename to data/layouts/UnusedCave5/border.bin diff --git a/data/layouts/Unknown_0843E804/map.bin b/data/layouts/UnusedCave5/map.bin similarity index 100% rename from data/layouts/Unknown_0843E804/map.bin rename to data/layouts/UnusedCave5/map.bin diff --git a/data/layouts/Unknown_0843E828/border.bin b/data/layouts/UnusedCave6/border.bin similarity index 100% rename from data/layouts/Unknown_0843E828/border.bin rename to data/layouts/UnusedCave6/border.bin diff --git a/data/layouts/Unknown_0843E828/map.bin b/data/layouts/UnusedCave6/map.bin similarity index 100% rename from data/layouts/Unknown_0843E828/map.bin rename to data/layouts/UnusedCave6/map.bin diff --git a/data/layouts/Unknown_0843E84C/border.bin b/data/layouts/UnusedCave7/border.bin similarity index 100% rename from data/layouts/Unknown_0843E84C/border.bin rename to data/layouts/UnusedCave7/border.bin diff --git a/data/layouts/Unknown_0843E84C/map.bin b/data/layouts/UnusedCave7/map.bin similarity index 100% rename from data/layouts/Unknown_0843E84C/map.bin rename to data/layouts/UnusedCave7/map.bin diff --git a/data/layouts/Unknown_0843E870/border.bin b/data/layouts/UnusedCave8/border.bin similarity index 100% rename from data/layouts/Unknown_0843E870/border.bin rename to data/layouts/UnusedCave8/border.bin diff --git a/data/layouts/Unknown_0843E870/map.bin b/data/layouts/UnusedCave8/map.bin similarity index 100% rename from data/layouts/Unknown_0843E870/map.bin rename to data/layouts/UnusedCave8/map.bin diff --git a/data/layouts/Unknown_0843E894/border.bin b/data/layouts/UnusedCave9/border.bin similarity index 100% rename from data/layouts/Unknown_0843E894/border.bin rename to data/layouts/UnusedCave9/border.bin diff --git a/data/layouts/Unknown_0843E894/map.bin b/data/layouts/UnusedCave9/map.bin similarity index 100% rename from data/layouts/Unknown_0843E894/map.bin rename to data/layouts/UnusedCave9/map.bin diff --git a/data/layouts/UnknownLinkContestRoom_25_29/border.bin b/data/layouts/UnusedContestHall1/border.bin similarity index 100% rename from data/layouts/UnknownLinkContestRoom_25_29/border.bin rename to data/layouts/UnusedContestHall1/border.bin diff --git a/data/layouts/UnknownLinkContestRoom_25_29/map.bin b/data/layouts/UnusedContestHall1/map.bin similarity index 100% rename from data/layouts/UnknownLinkContestRoom_25_29/map.bin rename to data/layouts/UnusedContestHall1/map.bin diff --git a/data/layouts/UnknownLinkContestRoom_25_30/border.bin b/data/layouts/UnusedContestHall2/border.bin similarity index 100% rename from data/layouts/UnknownLinkContestRoom_25_30/border.bin rename to data/layouts/UnusedContestHall2/border.bin diff --git a/data/layouts/UnknownLinkContestRoom_25_30/map.bin b/data/layouts/UnusedContestHall2/map.bin similarity index 100% rename from data/layouts/UnknownLinkContestRoom_25_30/map.bin rename to data/layouts/UnusedContestHall2/map.bin diff --git a/data/layouts/UnknownLinkContestRoom_25_31/border.bin b/data/layouts/UnusedContestHall3/border.bin similarity index 100% rename from data/layouts/UnknownLinkContestRoom_25_31/border.bin rename to data/layouts/UnusedContestHall3/border.bin diff --git a/data/layouts/UnknownLinkContestRoom_25_31/map.bin b/data/layouts/UnusedContestHall3/map.bin similarity index 100% rename from data/layouts/UnknownLinkContestRoom_25_31/map.bin rename to data/layouts/UnusedContestHall3/map.bin diff --git a/data/layouts/UnknownLinkContestRoom_25_32/border.bin b/data/layouts/UnusedContestHall4/border.bin similarity index 100% rename from data/layouts/UnknownLinkContestRoom_25_32/border.bin rename to data/layouts/UnusedContestHall4/border.bin diff --git a/data/layouts/UnknownLinkContestRoom_25_32/map.bin b/data/layouts/UnusedContestHall4/map.bin similarity index 100% rename from data/layouts/UnknownLinkContestRoom_25_32/map.bin rename to data/layouts/UnusedContestHall4/map.bin diff --git a/data/layouts/UnknownLinkContestRoom_25_33/border.bin b/data/layouts/UnusedContestHall5/border.bin similarity index 100% rename from data/layouts/UnknownLinkContestRoom_25_33/border.bin rename to data/layouts/UnusedContestHall5/border.bin diff --git a/data/layouts/UnknownLinkContestRoom_25_33/map.bin b/data/layouts/UnusedContestHall5/map.bin similarity index 100% rename from data/layouts/UnknownLinkContestRoom_25_33/map.bin rename to data/layouts/UnusedContestHall5/map.bin diff --git a/data/layouts/UnknownLinkContestRoom_25_34/border.bin b/data/layouts/UnusedContestHall6/border.bin similarity index 100% rename from data/layouts/UnknownLinkContestRoom_25_34/border.bin rename to data/layouts/UnusedContestHall6/border.bin diff --git a/data/layouts/UnknownLinkContestRoom_25_34/map.bin b/data/layouts/UnusedContestHall6/map.bin similarity index 100% rename from data/layouts/UnknownLinkContestRoom_25_34/map.bin rename to data/layouts/UnusedContestHall6/map.bin diff --git a/data/layouts/Unknown_08428450/border.bin b/data/layouts/UnusedContestRoom1/border.bin similarity index 100% rename from data/layouts/Unknown_08428450/border.bin rename to data/layouts/UnusedContestRoom1/border.bin diff --git a/data/layouts/Unknown_08428450/map.bin b/data/layouts/UnusedContestRoom1/map.bin similarity index 100% rename from data/layouts/Unknown_08428450/map.bin rename to data/layouts/UnusedContestRoom1/map.bin diff --git a/data/layouts/Unknown_084294C4/border.bin b/data/layouts/UnusedContestRoom2/border.bin similarity index 100% rename from data/layouts/Unknown_084294C4/border.bin rename to data/layouts/UnusedContestRoom2/border.bin diff --git a/data/layouts/Unknown_084294C4/map.bin b/data/layouts/UnusedContestRoom2/map.bin similarity index 100% rename from data/layouts/Unknown_084294C4/map.bin rename to data/layouts/UnusedContestRoom2/map.bin diff --git a/data/layouts/Unknown_084294E8/border.bin b/data/layouts/UnusedContestRoom3/border.bin similarity index 100% rename from data/layouts/Unknown_084294E8/border.bin rename to data/layouts/UnusedContestRoom3/border.bin diff --git a/data/layouts/Unknown_084294E8/map.bin b/data/layouts/UnusedContestRoom3/map.bin similarity index 100% rename from data/layouts/Unknown_084294E8/map.bin rename to data/layouts/UnusedContestRoom3/map.bin diff --git a/data/layouts/Unknown_08447028/border.bin b/data/layouts/UnusedOutdoorArea/border.bin similarity index 100% rename from data/layouts/Unknown_08447028/border.bin rename to data/layouts/UnusedOutdoorArea/border.bin diff --git a/data/layouts/Unknown_08447028/map.bin b/data/layouts/UnusedOutdoorArea/map.bin similarity index 100% rename from data/layouts/Unknown_08447028/map.bin rename to data/layouts/UnusedOutdoorArea/map.bin diff --git a/data/layouts/layouts.json b/data/layouts/layouts.json index 9292e10af..b8d841f72 100644 --- a/data/layouts/layouts.json +++ b/data/layouts/layouts.json @@ -742,14 +742,14 @@ "blockdata_filepath": "data/layouts/LilycoveCity_House2/map.bin" }, { - "id": "LAYOUT_UNKNOWN_08428450", - "name": "Unknown_08428450_Layout", + "id": "LAYOUT_UNUSED_CONTEST_ROOM1", + "name": "UnusedContestRoom1_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_Building", "secondary_tileset": "gTileset_Contest", - "border_filepath": "data/layouts/Unknown_08428450/border.bin", - "blockdata_filepath": "data/layouts/Unknown_08428450/map.bin" + "border_filepath": "data/layouts/UnusedContestRoom1/border.bin", + "blockdata_filepath": "data/layouts/UnusedContestRoom1/map.bin" }, { "id": "LAYOUT_VERDANTURF_TOWN_WANDAS_HOUSE", @@ -822,24 +822,24 @@ "blockdata_filepath": "data/layouts/SlateportCity_SternsShipyard_2F/map.bin" }, { - "id": "LAYOUT_UNKNOWN_084294C4", - "name": "Unknown_084294C4_Layout", + "id": "LAYOUT_UNUSED_CONTEST_ROOM2", + "name": "UnusedContestRoom2_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_Building", "secondary_tileset": "gTileset_Contest", - "border_filepath": "data/layouts/Unknown_084294C4/border.bin", - "blockdata_filepath": "data/layouts/Unknown_084294C4/map.bin" + "border_filepath": "data/layouts/UnusedContestRoom2/border.bin", + "blockdata_filepath": "data/layouts/UnusedContestRoom2/map.bin" }, { - "id": "LAYOUT_UNKNOWN_084294E8", - "name": "Unknown_084294E8_Layout", + "id": "LAYOUT_UNUSED_CONTEST_ROOM3", + "name": "UnusedContestRoom3_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_Building", "secondary_tileset": "gTileset_Contest", - "border_filepath": "data/layouts/Unknown_084294E8/border.bin", - "blockdata_filepath": "data/layouts/Unknown_084294E8/map.bin" + "border_filepath": "data/layouts/UnusedContestRoom3/border.bin", + "blockdata_filepath": "data/layouts/UnusedContestRoom3/map.bin" }, { "id": "LAYOUT_SLATEPORT_CITY_POKEMON_FAN_CLUB", @@ -1692,144 +1692,144 @@ "blockdata_filepath": "data/layouts/ShoalCave_HighTideInnerRoom/map.bin" }, { - "id": "LAYOUT_UNKNOWN_0843E6C0", - "name": "Unknown_0843E6C0_Layout", + "id": "LAYOUT_UNUSED_CAVE1", + "name": "UnusedCave1_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_General", "secondary_tileset": "gTileset_Cave", - "border_filepath": "data/layouts/Unknown_0843E6C0/border.bin", - "blockdata_filepath": "data/layouts/Unknown_0843E6C0/map.bin" + "border_filepath": "data/layouts/UnusedCave1/border.bin", + "blockdata_filepath": "data/layouts/UnusedCave1/map.bin" }, { - "id": "LAYOUT_UNKNOWN_0843E6E4", - "name": "Unknown_0843E6E4_Layout", + "id": "LAYOUT_UNUSED_CAVE2", + "name": "UnusedCave2_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_General", "secondary_tileset": "gTileset_Cave", - "border_filepath": "data/layouts/Unknown_0843E6E4/border.bin", - "blockdata_filepath": "data/layouts/Unknown_0843E6E4/map.bin" + "border_filepath": "data/layouts/UnusedCave2/border.bin", + "blockdata_filepath": "data/layouts/UnusedCave2/map.bin" }, { - "id": "LAYOUT_UNKNOWN_0843E708", - "name": "Unknown_0843E708_Layout", + "id": "LAYOUT_UNUSED_CAVE3", + "name": "UnusedCave3_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_General", "secondary_tileset": "gTileset_Cave", - "border_filepath": "data/layouts/Unknown_0843E708/border.bin", - "blockdata_filepath": "data/layouts/Unknown_0843E708/map.bin" + "border_filepath": "data/layouts/UnusedCave3/border.bin", + "blockdata_filepath": "data/layouts/UnusedCave3/map.bin" }, { - "id": "LAYOUT_UNKNOWN_0843E72C", - "name": "Unknown_0843E72C_Layout", + "id": "LAYOUT_UNUSED_CAVE4", + "name": "UnusedCave4_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_General", "secondary_tileset": "gTileset_Cave", - "border_filepath": "data/layouts/Unknown_0843E72C/border.bin", - "blockdata_filepath": "data/layouts/Unknown_0843E72C/map.bin" + "border_filepath": "data/layouts/UnusedCave4/border.bin", + "blockdata_filepath": "data/layouts/UnusedCave4/map.bin" }, { - "id": "LAYOUT_UNKNOWN_0843E750", - "name": "Unknown_0843E750_Layout", + "id": "LAYOUT_UNUSED_CAVE5", + "name": "UnusedCave5_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_General", "secondary_tileset": "gTileset_Cave", - "border_filepath": "data/layouts/Unknown_0843E750/border.bin", - "blockdata_filepath": "data/layouts/Unknown_0843E750/map.bin" + "border_filepath": "data/layouts/UnusedCave5/border.bin", + "blockdata_filepath": "data/layouts/UnusedCave5/map.bin" }, { - "id": "LAYOUT_UNKNOWN_0843E774", - "name": "Unknown_0843E774_Layout", + "id": "LAYOUT_UNUSED_CAVE6", + "name": "UnusedCave6_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_General", "secondary_tileset": "gTileset_Cave", - "border_filepath": "data/layouts/Unknown_0843E774/border.bin", - "blockdata_filepath": "data/layouts/Unknown_0843E774/map.bin" + "border_filepath": "data/layouts/UnusedCave6/border.bin", + "blockdata_filepath": "data/layouts/UnusedCave6/map.bin" }, { - "id": "LAYOUT_UNKNOWN_0843E798", - "name": "Unknown_0843E798_Layout", + "id": "LAYOUT_UNUSED_CAVE7", + "name": "UnusedCave7_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_General", "secondary_tileset": "gTileset_Cave", - "border_filepath": "data/layouts/Unknown_0843E798/border.bin", - "blockdata_filepath": "data/layouts/Unknown_0843E798/map.bin" + "border_filepath": "data/layouts/UnusedCave7/border.bin", + "blockdata_filepath": "data/layouts/UnusedCave7/map.bin" }, { - "id": "LAYOUT_UNKNOWN_0843E7BC", - "name": "Unknown_0843E7BC_Layout", + "id": "LAYOUT_UNUSED_CAVE8", + "name": "UnusedCave8_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_General", "secondary_tileset": "gTileset_Cave", - "border_filepath": "data/layouts/Unknown_0843E7BC/border.bin", - "blockdata_filepath": "data/layouts/Unknown_0843E7BC/map.bin" + "border_filepath": "data/layouts/UnusedCave8/border.bin", + "blockdata_filepath": "data/layouts/UnusedCave8/map.bin" }, { - "id": "LAYOUT_UNKNOWN_0843E7E0", - "name": "Unknown_0843E7E0_Layout", + "id": "LAYOUT_UNUSED_CAVE9", + "name": "UnusedCave9_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_General", "secondary_tileset": "gTileset_Cave", - "border_filepath": "data/layouts/Unknown_0843E7E0/border.bin", - "blockdata_filepath": "data/layouts/Unknown_0843E7E0/map.bin" + "border_filepath": "data/layouts/UnusedCave9/border.bin", + "blockdata_filepath": "data/layouts/UnusedCave9/map.bin" }, { - "id": "LAYOUT_UNKNOWN_0843E804", - "name": "Unknown_0843E804_Layout", + "id": "LAYOUT_UNUSED_CAVE10", + "name": "UnusedCave10_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_General", "secondary_tileset": "gTileset_Cave", - "border_filepath": "data/layouts/Unknown_0843E804/border.bin", - "blockdata_filepath": "data/layouts/Unknown_0843E804/map.bin" + "border_filepath": "data/layouts/UnusedCave10/border.bin", + "blockdata_filepath": "data/layouts/UnusedCave10/map.bin" }, { - "id": "LAYOUT_UNKNOWN_0843E828", - "name": "Unknown_0843E828_Layout", + "id": "LAYOUT_UNUSED_CAVE11", + "name": "UnusedCave11_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_General", "secondary_tileset": "gTileset_Cave", - "border_filepath": "data/layouts/Unknown_0843E828/border.bin", - "blockdata_filepath": "data/layouts/Unknown_0843E828/map.bin" + "border_filepath": "data/layouts/UnusedCave11/border.bin", + "blockdata_filepath": "data/layouts/UnusedCave11/map.bin" }, { - "id": "LAYOUT_UNKNOWN_0843E84C", - "name": "Unknown_0843E84C_Layout", + "id": "LAYOUT_UNUSED_CAVE12", + "name": "UnusedCave12_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_General", "secondary_tileset": "gTileset_Cave", - "border_filepath": "data/layouts/Unknown_0843E84C/border.bin", - "blockdata_filepath": "data/layouts/Unknown_0843E84C/map.bin" + "border_filepath": "data/layouts/UnusedCave12/border.bin", + "blockdata_filepath": "data/layouts/UnusedCave12/map.bin" }, { - "id": "LAYOUT_UNKNOWN_0843E870", - "name": "Unknown_0843E870_Layout", + "id": "LAYOUT_UNUSED_CAVE13", + "name": "UnusedCave13_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_General", "secondary_tileset": "gTileset_Cave", - "border_filepath": "data/layouts/Unknown_0843E870/border.bin", - "blockdata_filepath": "data/layouts/Unknown_0843E870/map.bin" + "border_filepath": "data/layouts/UnusedCave13/border.bin", + "blockdata_filepath": "data/layouts/UnusedCave13/map.bin" }, { - "id": "LAYOUT_UNKNOWN_0843E894", - "name": "Unknown_0843E894_Layout", + "id": "LAYOUT_UNUSED_CAVE14", + "name": "UnusedCave14_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_General", "secondary_tileset": "gTileset_Cave", - "border_filepath": "data/layouts/Unknown_0843E894/border.bin", - "blockdata_filepath": "data/layouts/Unknown_0843E894/map.bin" + "border_filepath": "data/layouts/UnusedCave14/border.bin", + "blockdata_filepath": "data/layouts/UnusedCave14/map.bin" }, { "id": "LAYOUT_NEW_MAUVILLE_ENTRANCE", @@ -2252,64 +2252,64 @@ "blockdata_filepath": "data/layouts/ContestHall/map.bin" }, { - "id": "LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_29", - "name": "UnknownLinkContestRoom_25_29_Layout", + "id": "LAYOUT_UNUSED_CONTEST_HALL1", + "name": "UnusedContestHall1_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_Building", "secondary_tileset": "gTileset_Contest", - "border_filepath": "data/layouts/UnknownLinkContestRoom_25_29/border.bin", - "blockdata_filepath": "data/layouts/UnknownLinkContestRoom_25_29/map.bin" + "border_filepath": "data/layouts/UnusedContestHall1/border.bin", + "blockdata_filepath": "data/layouts/UnusedContestHall1/map.bin" }, { - "id": "LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_30", - "name": "UnknownLinkContestRoom_25_30_Layout", + "id": "LAYOUT_UNUSED_CONTEST_HALL2", + "name": "UnusedContestHall2_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_Building", "secondary_tileset": "gTileset_Contest", - "border_filepath": "data/layouts/UnknownLinkContestRoom_25_30/border.bin", - "blockdata_filepath": "data/layouts/UnknownLinkContestRoom_25_30/map.bin" + "border_filepath": "data/layouts/UnusedContestHall2/border.bin", + "blockdata_filepath": "data/layouts/UnusedContestHall2/map.bin" }, { - "id": "LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_31", - "name": "UnknownLinkContestRoom_25_31_Layout", + "id": "LAYOUT_UNUSED_CONTEST_HALL3", + "name": "UnusedContestHall3_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_Building", "secondary_tileset": "gTileset_Contest", - "border_filepath": "data/layouts/UnknownLinkContestRoom_25_31/border.bin", - "blockdata_filepath": "data/layouts/UnknownLinkContestRoom_25_31/map.bin" + "border_filepath": "data/layouts/UnusedContestHall3/border.bin", + "blockdata_filepath": "data/layouts/UnusedContestHall3/map.bin" }, { - "id": "LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_32", - "name": "UnknownLinkContestRoom_25_32_Layout", + "id": "LAYOUT_UNUSED_CONTEST_HALL4", + "name": "UnusedContestHall4_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_Building", "secondary_tileset": "gTileset_Contest", - "border_filepath": "data/layouts/UnknownLinkContestRoom_25_32/border.bin", - "blockdata_filepath": "data/layouts/UnknownLinkContestRoom_25_32/map.bin" + "border_filepath": "data/layouts/UnusedContestHall4/border.bin", + "blockdata_filepath": "data/layouts/UnusedContestHall4/map.bin" }, { - "id": "LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_33", - "name": "UnknownLinkContestRoom_25_33_Layout", + "id": "LAYOUT_UNUSED_CONTEST_HALL5", + "name": "UnusedContestHall5_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_Building", "secondary_tileset": "gTileset_Contest", - "border_filepath": "data/layouts/UnknownLinkContestRoom_25_33/border.bin", - "blockdata_filepath": "data/layouts/UnknownLinkContestRoom_25_33/map.bin" + "border_filepath": "data/layouts/UnusedContestHall5/border.bin", + "blockdata_filepath": "data/layouts/UnusedContestHall5/map.bin" }, { - "id": "LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_34", - "name": "UnknownLinkContestRoom_25_34_Layout", + "id": "LAYOUT_UNUSED_CONTEST_HALL6", + "name": "UnusedContestHall6_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_Building", "secondary_tileset": "gTileset_Contest", - "border_filepath": "data/layouts/UnknownLinkContestRoom_25_34/border.bin", - "blockdata_filepath": "data/layouts/UnknownLinkContestRoom_25_34/map.bin" + "border_filepath": "data/layouts/UnusedContestHall6/border.bin", + "blockdata_filepath": "data/layouts/UnusedContestHall6/map.bin" }, { "id": "LAYOUT_CONTEST_HALL_BEAUTY", @@ -2412,14 +2412,14 @@ "blockdata_filepath": "data/layouts/SafariZone_South/map.bin" }, { - "id": "LAYOUT_UNKNOWN_08447028", - "name": "Unknown_08447028_Layout", + "id": "LAYOUT_UNUSED_OUTDOOR_AREA", + "name": "UnusedOutdoorArea_Layout", "width": 58, "height": 26, "primary_tileset": "gTileset_General", "secondary_tileset": "0", - "border_filepath": "data/layouts/Unknown_08447028/border.bin", - "blockdata_filepath": "data/layouts/Unknown_08447028/map.bin" + "border_filepath": "data/layouts/UnusedOutdoorArea/border.bin", + "blockdata_filepath": "data/layouts/UnusedOutdoorArea/map.bin" }, { "id": "LAYOUT_ROUTE109_SEASHORE_HOUSE", @@ -3582,14 +3582,14 @@ "blockdata_filepath": "data/layouts/BattleFrontier_BattlePikeRoomWildMons/map.bin" }, { - "id": "LAYOUT_UNKNOWN_084693AC", - "name": "Unknown_084693AC_Layout", + "id": "LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_UNUSED", + "name": "BattleFrontier_BattlePikeRoomUnused_Layout", "width": 1, "height": 1, "primary_tileset": "gTileset_Building", "secondary_tileset": "gTileset_BattlePike", - "border_filepath": "data/layouts/Unknown_084693AC/border.bin", - "blockdata_filepath": "data/layouts/Unknown_084693AC/map.bin" + "border_filepath": "data/layouts/BattleFrontier_BattlePikeRoomUnused/border.bin", + "blockdata_filepath": "data/layouts/BattleFrontier_BattlePikeRoomUnused/map.bin" }, { "id": "LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY", diff --git a/data/map_events.s b/data/map_events.s index d285040a0..dcbb9cfb1 100644 --- a/data/map_events.s +++ b/data/map_events.s @@ -10,6 +10,7 @@ #include "constants/weather.h" #include "constants/trainer_hill.h" #include "constants/trainer_types.h" +#include "constants/berry.h" .include "asm/macros.inc" .include "constants/constants.inc" diff --git a/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc index f4de37232..dfce6d155 100644 --- a/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc +++ b/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc @@ -143,7 +143,7 @@ BattleFrontier_BattleTowerMultiBattleRoom_EventScript_RestoreParty:: @ 8249121 special LoadPlayerParty frontier_setpartyorder FRONTIER_MULTI_PARTY_SIZE compare VAR_FRONTIER_BATTLE_MODE, FRONTIER_MODE_LINK_MULTIS - call_if_eq BattleFrontier_BattleTowerMultiBattleRoom_EventScript_249514 + call_if_eq BattleFrontier_BattleTowerMultiBattleRoom_EventScript_ReconnectLink playfanfare MUS_HEAL waitfanfare special HealPlayerParty @@ -383,9 +383,8 @@ BattleFrontier_BattleTowerMultiBattleRoom_EventScript_RetireChallengeLink:: @ 82 goto BattleFrontier_BattleTowerMultiBattleRoom_EventScript_WarpToLobbyLost end -@ Some link function. Sets battle type flags at least -BattleFrontier_BattleTowerMultiBattleRoom_EventScript_249514:: @ 8249514 - special sub_813B534 +BattleFrontier_BattleTowerMultiBattleRoom_EventScript_ReconnectLink:: @ 8249514 + special BattleTowerReconnectLink return BattleFrontier_BattleTowerMultiBattleRoom_Movement_PlayerEnterRoom: @ 8249518 diff --git a/data/maps/BirthIsland_Exterior/scripts.inc b/data/maps/BirthIsland_Exterior/scripts.inc index 16a1c7488..c20de3798 100644 --- a/data/maps/BirthIsland_Exterior/scripts.inc +++ b/data/maps/BirthIsland_Exterior/scripts.inc @@ -85,7 +85,7 @@ BirthIsland_Exterior_EventScript_Deoxys:: @ 8267FC1 setvar VAR_0x8004, SPECIES_DEOXYS setvar VAR_0x8005, 30 @ level setvar VAR_0x8006, ITEM_NONE - special CreateObedientEnemyMon + special CreateEventLegalEnemyMon setflag FLAG_SYS_CTRL_OBJ_DELETE special BattleSetup_StartLegendaryBattle waitstate diff --git a/data/maps/DewfordTown/scripts.inc b/data/maps/DewfordTown/scripts.inc index f6d06bea7..27e82167c 100644 --- a/data/maps/DewfordTown/scripts.inc +++ b/data/maps/DewfordTown/scripts.inc @@ -624,15 +624,15 @@ DewfordTown_EventScript_RejectTrendyPhrase:: @ 81E9952 call Common_ShowEasyChatScreen lock faceplayer - compare VAR_RESULT, 1 + compare VAR_RESULT, TRUE goto_if_eq DewfordTown_EventScript_GiveNewTrendyPhrase - compare VAR_RESULT, 0 + compare VAR_RESULT, FALSE goto_if_eq DewfordTown_EventScript_CancelNewTrendyPhrase end DewfordTown_EventScript_GiveNewTrendyPhrase:: @ 81E997D incrementgamestat GAME_STAT_STARTED_TRENDS - compare VAR_0x8004, 0 + compare VAR_0x8004, FALSE goto_if_eq DewfordTown_EventScript_PhraseNotTrendyEnough msgbox DewfordTown_Text_OfCourseIKnowAboutThat, MSGBOX_DEFAULT release diff --git a/data/maps/FarawayIsland_Interior/scripts.inc b/data/maps/FarawayIsland_Interior/scripts.inc index 2a06ffdfa..108bc12e6 100644 --- a/data/maps/FarawayIsland_Interior/scripts.inc +++ b/data/maps/FarawayIsland_Interior/scripts.inc @@ -141,7 +141,7 @@ FarawayIsland_Interior_EventScript_Mew:: @ 8267DF2 setvar VAR_0x8004, SPECIES_MEW setvar VAR_0x8005, 30 @ level setvar VAR_0x8006, ITEM_NONE - special CreateObedientEnemyMon + special CreateEventLegalEnemyMon setflag FLAG_SYS_CTRL_OBJ_DELETE special BattleSetup_StartLegendaryBattle waitstate diff --git a/data/maps/LavaridgeTown_Gym_1F/scripts.inc b/data/maps/LavaridgeTown_Gym_1F/scripts.inc index df95a0b4b..901969416 100644 --- a/data/maps/LavaridgeTown_Gym_1F/scripts.inc +++ b/data/maps/LavaridgeTown_Gym_1F/scripts.inc @@ -9,7 +9,7 @@ LavaridgeTown_Gym_1F_MapScripts:: @ 81FE6F4 LavaridgeTown_Gym_1F_OnTransition: @ 81FE6FA call LavaridgeTown_Gym_1F_EventScript_SetTrainerTempVars - call LavaridgeTown_Gym_1F_EventScript_CheckHideTrainers + call LavaridgeTown_Gym_1F_EventScript_CheckBuryTrainers end @ Unclear where/if these temp vars are getting checked @@ -33,19 +33,19 @@ LavaridgeTown_Gym_1F_EventScript_SetDanielleTempVar:: @ 81FE748 LavaridgeTown_Gym_1F_EventScript_EndSetTrainerTempVars:: @ 81FE756 return -LavaridgeTown_Gym_1F_EventScript_CheckHideTrainers:: @ 81FE757 - goto_if_defeated TRAINER_COLE, LavaridgeTown_Gym_1F_EventScript_CheckHideGerald - setobjectmovementtype LOCALID_COLE, MOVEMENT_TYPE_HIDDEN -LavaridgeTown_Gym_1F_EventScript_CheckHideGerald:: @ 81FE764 - goto_if_defeated TRAINER_GERALD, LavaridgeTown_Gym_1F_EventScript_CheckHideAxle - setobjectmovementtype LOCALID_GERALD, MOVEMENT_TYPE_HIDDEN -LavaridgeTown_Gym_1F_EventScript_CheckHideAxle:: @ 81FE771 - goto_if_defeated TRAINER_AXLE, LavaridgeTown_Gym_1F_EventScript_CheckHideDanielle - setobjectmovementtype LOCALID_AXLE, MOVEMENT_TYPE_HIDDEN -LavaridgeTown_Gym_1F_EventScript_CheckHideDanielle:: @ 81FE77E - goto_if_defeated TRAINER_DANIELLE, LavaridgeTown_Gym_1F_EventScript_EndCheckHideTrainers - setobjectmovementtype LOCALID_DANIELLE, MOVEMENT_TYPE_HIDDEN -LavaridgeTown_Gym_1F_EventScript_EndCheckHideTrainers:: @ 81FE78B +LavaridgeTown_Gym_1F_EventScript_CheckBuryTrainers:: @ 81FE757 + goto_if_defeated TRAINER_COLE, LavaridgeTown_Gym_1F_EventScript_CheckBuryGerald + setobjectmovementtype LOCALID_COLE, MOVEMENT_TYPE_BURIED +LavaridgeTown_Gym_1F_EventScript_CheckBuryGerald:: @ 81FE764 + goto_if_defeated TRAINER_GERALD, LavaridgeTown_Gym_1F_EventScript_CheckBuryAxle + setobjectmovementtype LOCALID_GERALD, MOVEMENT_TYPE_BURIED +LavaridgeTown_Gym_1F_EventScript_CheckBuryAxle:: @ 81FE771 + goto_if_defeated TRAINER_AXLE, LavaridgeTown_Gym_1F_EventScript_CheckBuryDanielle + setobjectmovementtype LOCALID_AXLE, MOVEMENT_TYPE_BURIED +LavaridgeTown_Gym_1F_EventScript_CheckBuryDanielle:: @ 81FE77E + goto_if_defeated TRAINER_DANIELLE, LavaridgeTown_Gym_1F_EventScript_EndCheckBuryTrainers + setobjectmovementtype LOCALID_DANIELLE, MOVEMENT_TYPE_BURIED +LavaridgeTown_Gym_1F_EventScript_EndCheckBuryTrainers:: @ 81FE78B return LavaridgeTown_Gym_1F_EventScript_Flannery:: @ 81FE78C diff --git a/data/maps/LavaridgeTown_Gym_B1F/scripts.inc b/data/maps/LavaridgeTown_Gym_B1F/scripts.inc index aad7c4778..f2e41ace4 100644 --- a/data/maps/LavaridgeTown_Gym_B1F/scripts.inc +++ b/data/maps/LavaridgeTown_Gym_B1F/scripts.inc @@ -9,7 +9,7 @@ LavaridgeTown_Gym_B1F_MapScripts:: @ 81FF87E LavaridgeTown_Gym_B1F_OnTransition: @ 81FF884 call LavaridgeTown_Gym_B1F_EventScript_SetTrainerTempVars - call LavaridgeTown_Gym_B1F_EventScript_CheckHideTrainers + call LavaridgeTown_Gym_B1F_EventScript_CheckBuryTrainers end @ Unclear where/if these temp vars are getting checked @@ -32,18 +32,18 @@ LavaridgeTown_Gym_B1F_EventScript_SetEliTempVar:: @ 81FF8CD LavaridgeTown_Gym_B1F_EventScript_EndSetTrainerTempVars:: @ 81FF8DB return -LavaridgeTown_Gym_B1F_EventScript_CheckHideTrainers:: @ 81FF8DC - goto_if_defeated TRAINER_KEEGAN, LavaridgeTown_Gym_B1F_EventScript_CheckHideJace - setobjectmovementtype LOCALID_KEEGAN, MOVEMENT_TYPE_HIDDEN -LavaridgeTown_Gym_B1F_EventScript_CheckHideJace:: @ 81FF8E9 - goto_if_defeated TRAINER_JACE, LavaridgeTown_Gym_B1F_EventScript_CheckHideJeff - setobjectmovementtype LOCALID_JACE, MOVEMENT_TYPE_HIDDEN -LavaridgeTown_Gym_B1F_EventScript_CheckHideJeff:: @ 81FF8F6 - goto_if_defeated TRAINER_JEFF, LavaridgeTown_Gym_B1F_EventScript_CheckHideEli - setobjectmovementtype LOCALID_JEFF, MOVEMENT_TYPE_HIDDEN -LavaridgeTown_Gym_B1F_EventScript_CheckHideEli:: @ 81FF903 - goto_if_defeated TRAINER_ELI, LavaridgeTown_Gym_B1F_EventScript_EndCheckHideTrainers - setobjectmovementtype LOCALID_ELI, MOVEMENT_TYPE_HIDDEN -LavaridgeTown_Gym_B1F_EventScript_EndCheckHideTrainers:: @ 81FF910 +LavaridgeTown_Gym_B1F_EventScript_CheckBuryTrainers:: @ 81FF8DC + goto_if_defeated TRAINER_KEEGAN, LavaridgeTown_Gym_B1F_EventScript_CheckBuryJace + setobjectmovementtype LOCALID_KEEGAN, MOVEMENT_TYPE_BURIED +LavaridgeTown_Gym_B1F_EventScript_CheckBuryJace:: @ 81FF8E9 + goto_if_defeated TRAINER_JACE, LavaridgeTown_Gym_B1F_EventScript_CheckBuryJeff + setobjectmovementtype LOCALID_JACE, MOVEMENT_TYPE_BURIED +LavaridgeTown_Gym_B1F_EventScript_CheckBuryJeff:: @ 81FF8F6 + goto_if_defeated TRAINER_JEFF, LavaridgeTown_Gym_B1F_EventScript_CheckBuryEli + setobjectmovementtype LOCALID_JEFF, MOVEMENT_TYPE_BURIED +LavaridgeTown_Gym_B1F_EventScript_CheckBuryEli:: @ 81FF903 + goto_if_defeated TRAINER_ELI, LavaridgeTown_Gym_B1F_EventScript_EndCheckBuryTrainers + setobjectmovementtype LOCALID_ELI, MOVEMENT_TYPE_BURIED +LavaridgeTown_Gym_B1F_EventScript_EndCheckBuryTrainers:: @ 81FF910 return diff --git a/data/maps/LilycoveCity_ContestLobby/scripts.inc b/data/maps/LilycoveCity_ContestLobby/scripts.inc index 51c38e3f4..3a3b3d86b 100644 --- a/data/maps/LilycoveCity_ContestLobby/scripts.inc +++ b/data/maps/LilycoveCity_ContestLobby/scripts.inc @@ -783,7 +783,7 @@ LilycoveCity_ContestLobby_EventScript_TrySetUpLinkContest:: @ 821AA15 goto_if_eq LilycoveCity_ContestLobby_EventScript_CancelLinkError compare VAR_RESULT, LINKUP_FAILED_CONTEST_GMODE goto_if_eq LilycoveCity_ContestLobby_EventScript_CancelLinkModeDifference - message3 LilycoveCity_ContestLobby_Text_Transmitting + messageinstant LilycoveCity_ContestLobby_Text_Transmitting contestlinktransfer switch VAR_0x8004 case 0, LilycoveCity_ContestLobby_EventScript_StartLinkContest @@ -926,7 +926,7 @@ LilycoveCity_ContestLobby_EventScript_TryJoinLinkGroup:: @ 821AC38 return LilycoveCity_ContestLobby_EventScript_LinkLeaderDecided:: @ 821AC3D - message3 LilycoveCity_ContestLobby_Text_Transmitting + messageinstant LilycoveCity_ContestLobby_Text_Transmitting contestlinktransfer goto LilycoveCity_ContestLobby_EventScript_StartLinkContest end diff --git a/data/maps/LilycoveCity_CoveLilyMotel_2F/map.json b/data/maps/LilycoveCity_CoveLilyMotel_2F/map.json index f55770b88..0edd978fd 100644 --- a/data/maps/LilycoveCity_CoveLilyMotel_2F/map.json +++ b/data/maps/LilycoveCity_CoveLilyMotel_2F/map.json @@ -25,7 +25,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "LilycoveCity_CoveLilyMotel_2F_EventScript_GameDesigner", - "flag": "FLAG_HIDE_LILCOVE_MOTEL_GAME_DESIGNERS" + "flag": "FLAG_HIDE_LILYCOVE_MOTEL_GAME_DESIGNERS" }, { "graphics_id": "OBJ_EVENT_GFX_SCIENTIST_1", @@ -38,7 +38,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "LilycoveCity_CoveLilyMotel_2F_EventScript_GraphicArtist", - "flag": "FLAG_HIDE_LILCOVE_MOTEL_GAME_DESIGNERS" + "flag": "FLAG_HIDE_LILYCOVE_MOTEL_GAME_DESIGNERS" }, { "graphics_id": "OBJ_EVENT_GFX_FAT_MAN", @@ -51,7 +51,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "LilycoveCity_CoveLilyMotel_2F_EventScript_FatMan", - "flag": "FLAG_HIDE_LILCOVE_MOTEL_GAME_DESIGNERS" + "flag": "FLAG_HIDE_LILYCOVE_MOTEL_GAME_DESIGNERS" }, { "graphics_id": "OBJ_EVENT_GFX_MAN_4", @@ -64,7 +64,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "LilycoveCity_CoveLilyMotel_2F_EventScript_Programmer", - "flag": "FLAG_HIDE_LILCOVE_MOTEL_GAME_DESIGNERS" + "flag": "FLAG_HIDE_LILYCOVE_MOTEL_GAME_DESIGNERS" }, { "graphics_id": "OBJ_EVENT_GFX_GAMEBOY_KID", @@ -77,7 +77,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "LilycoveCity_CoveLilyMotel_2F_EventScript_GameBoyKid", - "flag": "FLAG_HIDE_LILCOVE_MOTEL_GAME_DESIGNERS" + "flag": "FLAG_HIDE_LILYCOVE_MOTEL_GAME_DESIGNERS" }, { "graphics_id": "OBJ_EVENT_GFX_WOMAN_2", @@ -90,7 +90,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "LilycoveCity_CoveLilyMotel_2F_EventScript_Woman", - "flag": "FLAG_HIDE_LILCOVE_MOTEL_GAME_DESIGNERS" + "flag": "FLAG_HIDE_LILYCOVE_MOTEL_GAME_DESIGNERS" }, { "graphics_id": "OBJ_EVENT_GFX_SCOTT", @@ -103,7 +103,7 @@ "trainer_type": "TRAINER_TYPE_NONE", "trainer_sight_or_berry_tree_id": "0", "script": "LilycoveCity_CoveLilyMotel_2F_EventScript_Scott", - "flag": "FLAG_HIDE_LILCOVE_MOTEL_SCOTT" + "flag": "FLAG_HIDE_LILYCOVE_MOTEL_SCOTT" } ], "warp_events": [ diff --git a/data/maps/NavelRock_Bottom/scripts.inc b/data/maps/NavelRock_Bottom/scripts.inc index 9c438fc5c..766c818d2 100644 --- a/data/maps/NavelRock_Bottom/scripts.inc +++ b/data/maps/NavelRock_Bottom/scripts.inc @@ -57,7 +57,7 @@ NavelRock_Bottom_EventScript_Lugia:: @ 82692A2 setvar VAR_0x8004, SPECIES_LUGIA setvar VAR_0x8005, 70 @ level setvar VAR_0x8006, ITEM_NONE - special CreateObedientEnemyMon + special CreateEventLegalEnemyMon setflag FLAG_SYS_CTRL_OBJ_DELETE special BattleSetup_StartLegendaryBattle waitstate diff --git a/data/maps/NavelRock_Top/scripts.inc b/data/maps/NavelRock_Top/scripts.inc index c95596ff6..b24aed23b 100644 --- a/data/maps/NavelRock_Top/scripts.inc +++ b/data/maps/NavelRock_Top/scripts.inc @@ -61,7 +61,7 @@ NavelRock_Top_EventScript_HoOh:: @ 826916F setvar VAR_0x8004, SPECIES_HO_OH setvar VAR_0x8005, 70 @ level setvar VAR_0x8006, ITEM_NONE - special CreateObedientEnemyMon + special CreateEventLegalEnemyMon setflag FLAG_SYS_CTRL_OBJ_DELETE special BattleSetup_StartLegendaryBattle waitstate diff --git a/data/maps/Route102/map.json b/data/maps/Route102/map.json index fc9adee3b..aaa63b11f 100644 --- a/data/maps/Route102/map.json +++ b/data/maps/Route102/map.json @@ -112,7 +112,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "2", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_102_ORAN", "script": "BerryTreeScript", "flag": "0" }, @@ -125,7 +125,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "1", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_102_PECHA", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route103/map.json b/data/maps/Route103/map.json index 4b91f913b..fbf92dd0c 100644 --- a/data/maps/Route103/map.json +++ b/data/maps/Route103/map.json @@ -112,7 +112,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "5", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_103_CHERI_1", "script": "BerryTreeScript", "flag": "0" }, @@ -125,7 +125,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "6", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_103_LEPPA", "script": "BerryTreeScript", "flag": "0" }, @@ -138,7 +138,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "7", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_103_CHERI_2", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route104/map.json b/data/maps/Route104/map.json index 69e5faf27..6ec8b3752 100644 --- a/data/maps/Route104/map.json +++ b/data/maps/Route104/map.json @@ -156,7 +156,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "8", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_104_CHERI_1", "script": "BerryTreeScript", "flag": "0" }, @@ -169,7 +169,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "9", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_104_SOIL_2", "script": "BerryTreeScript", "flag": "0" }, @@ -182,7 +182,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "10", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_104_LEPPA", "script": "BerryTreeScript", "flag": "0" }, @@ -195,7 +195,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "11", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_104_ORAN_2", "script": "BerryTreeScript", "flag": "0" }, @@ -208,7 +208,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "12", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_104_SOIL_3", "script": "BerryTreeScript", "flag": "0" }, @@ -221,7 +221,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "13", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_104_PECHA", "script": "BerryTreeScript", "flag": "0" }, @@ -247,7 +247,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "3", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_104_SOIL_1", "script": "BerryTreeScript", "flag": "0" }, @@ -260,7 +260,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "4", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_104_ORAN_1", "script": "BerryTreeScript", "flag": "0" }, @@ -273,7 +273,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "75", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_104_SOIL_4", "script": "BerryTreeScript", "flag": "0" }, @@ -286,7 +286,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "76", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_104_CHERI_2", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route110/map.json b/data/maps/Route110/map.json index bb5df5eb4..abfc2b767 100644 --- a/data/maps/Route110/map.json +++ b/data/maps/Route110/map.json @@ -234,7 +234,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "16", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_110_NANAB_1", "script": "BerryTreeScript", "flag": "0" }, @@ -247,7 +247,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "17", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_110_NANAB_2", "script": "BerryTreeScript", "flag": "0" }, @@ -260,7 +260,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "18", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_110_NANAB_3", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route111/map.json b/data/maps/Route111/map.json index 014ac084c..4621591e4 100644 --- a/data/maps/Route111/map.json +++ b/data/maps/Route111/map.json @@ -104,7 +104,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "19", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_111_RAZZ_1", "script": "BerryTreeScript", "flag": "0" }, @@ -117,7 +117,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "20", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_111_RAZZ_2", "script": "BerryTreeScript", "flag": "0" }, @@ -273,7 +273,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "80", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_111_ORAN_1", "script": "BerryTreeScript", "flag": "0" }, @@ -286,7 +286,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "81", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_111_ORAN_2", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route112/map.json b/data/maps/Route112/map.json index d4d650857..04b2e6d12 100644 --- a/data/maps/Route112/map.json +++ b/data/maps/Route112/map.json @@ -117,7 +117,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "24", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_112_RAWST_2", "script": "BerryTreeScript", "flag": "0" }, @@ -130,7 +130,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "23", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_112_PECHA_2", "script": "BerryTreeScript", "flag": "0" }, @@ -143,7 +143,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "22", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_112_PECHA_1", "script": "BerryTreeScript", "flag": "0" }, @@ -156,7 +156,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "21", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_112_RAWST_1", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route113/map.json b/data/maps/Route113/map.json index 8d9d74028..422b88e6e 100644 --- a/data/maps/Route113/map.json +++ b/data/maps/Route113/map.json @@ -126,7 +126,7 @@ "x": 29, "y": 6, "elevation": 3, - "movement_type": "MOVEMENT_TYPE_HIDDEN", + "movement_type": "MOVEMENT_TYPE_BURIED", "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_BURIED", @@ -139,7 +139,7 @@ "x": 71, "y": 2, "elevation": 3, - "movement_type": "MOVEMENT_TYPE_HIDDEN", + "movement_type": "MOVEMENT_TYPE_BURIED", "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_BURIED", diff --git a/data/maps/Route114/map.json b/data/maps/Route114/map.json index 37edf509d..38891b518 100644 --- a/data/maps/Route114/map.json +++ b/data/maps/Route114/map.json @@ -34,7 +34,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "77", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_114_PERSIM_2", "script": "BerryTreeScript", "flag": "0" }, @@ -47,7 +47,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "78", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_114_PERSIM_3", "script": "BerryTreeScript", "flag": "0" }, @@ -125,7 +125,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "68", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_114_PERSIM_1", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route115/map.json b/data/maps/Route115/map.json index 2d0dbdbaa..bbac132f5 100644 --- a/data/maps/Route115/map.json +++ b/data/maps/Route115/map.json @@ -73,7 +73,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "69", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_115_KELPSY_1", "script": "BerryTreeScript", "flag": "0" }, @@ -86,7 +86,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "70", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_115_KELPSY_2", "script": "BerryTreeScript", "flag": "0" }, @@ -99,7 +99,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "71", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_115_KELPSY_3", "script": "BerryTreeScript", "flag": "0" }, @@ -190,7 +190,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "55", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_115_BLUK_1", "script": "BerryTreeScript", "flag": "0" }, @@ -203,7 +203,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "56", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_115_BLUK_2", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route116/map.json b/data/maps/Route116/map.json index 247a4b7b1..13b4bac1c 100644 --- a/data/maps/Route116/map.json +++ b/data/maps/Route116/map.json @@ -34,7 +34,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "25", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_116_PINAP_1", "script": "BerryTreeScript", "flag": "0" }, @@ -47,7 +47,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "26", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_116_CHESTO_1", "script": "BerryTreeScript", "flag": "0" }, @@ -138,7 +138,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "66", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_116_CHESTO_2", "script": "BerryTreeScript", "flag": "0" }, @@ -151,7 +151,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "67", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_116_PINAP_2", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route117/map.json b/data/maps/Route117/map.json index dd923a7cd..b72866741 100644 --- a/data/maps/Route117/map.json +++ b/data/maps/Route117/map.json @@ -164,7 +164,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "29", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_117_WEPEAR_3", "script": "BerryTreeScript", "flag": "0" }, @@ -177,7 +177,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "28", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_117_WEPEAR_2", "script": "BerryTreeScript", "flag": "0" }, @@ -190,7 +190,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "27", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_117_WEPEAR_1", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route118/map.json b/data/maps/Route118/map.json index 7b541e629..67acb1b98 100644 --- a/data/maps/Route118/map.json +++ b/data/maps/Route118/map.json @@ -39,7 +39,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "31", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_118_SITRUS_1", "script": "BerryTreeScript", "flag": "0" }, @@ -52,7 +52,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "32", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_118_SOIL", "script": "BerryTreeScript", "flag": "0" }, @@ -65,7 +65,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "33", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_118_SITRUS_2", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route119/map.json b/data/maps/Route119/map.json index 8d78d1065..c5715daa2 100644 --- a/data/maps/Route119/map.json +++ b/data/maps/Route119/map.json @@ -34,7 +34,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "34", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_119_POMEG_1", "script": "BerryTreeScript", "flag": "0" }, @@ -47,7 +47,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "35", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_119_POMEG_2", "script": "BerryTreeScript", "flag": "0" }, @@ -60,7 +60,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "36", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_119_POMEG_3", "script": "BerryTreeScript", "flag": "0" }, @@ -372,7 +372,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "83", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_119_HONDEW_1", "script": "BerryTreeScript", "flag": "0" }, @@ -385,7 +385,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "84", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_119_HONDEW_2", "script": "BerryTreeScript", "flag": "0" }, @@ -398,7 +398,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "85", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_119_SITRUS", "script": "BerryTreeScript", "flag": "0" }, @@ -411,7 +411,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "86", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_119_LEPPA", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route120/map.json b/data/maps/Route120/map.json index 787f51361..6b67310d3 100644 --- a/data/maps/Route120/map.json +++ b/data/maps/Route120/map.json @@ -34,7 +34,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "46", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_120_WEPEAR", "script": "BerryTreeScript", "flag": "0" }, @@ -47,7 +47,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "45", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_120_PINAP", "script": "BerryTreeScript", "flag": "0" }, @@ -60,7 +60,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "44", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_120_NANAB", "script": "BerryTreeScript", "flag": "0" }, @@ -73,7 +73,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "43", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_120_RAZZ", "script": "BerryTreeScript", "flag": "0" }, @@ -86,7 +86,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "37", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_120_ASPEAR_1", "script": "BerryTreeScript", "flag": "0" }, @@ -99,7 +99,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "38", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_120_ASPEAR_2", "script": "BerryTreeScript", "flag": "0" }, @@ -112,7 +112,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "39", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_120_ASPEAR_3", "script": "BerryTreeScript", "flag": "0" }, @@ -125,7 +125,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "40", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_120_PECHA_1", "script": "BerryTreeScript", "flag": "0" }, @@ -138,7 +138,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "41", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_120_PECHA_2", "script": "BerryTreeScript", "flag": "0" }, @@ -151,7 +151,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "42", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_120_PECHA_3", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route121/map.json b/data/maps/Route121/map.json index e956f6251..aa8f07085 100644 --- a/data/maps/Route121/map.json +++ b/data/maps/Route121/map.json @@ -52,7 +52,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "47", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_121_PERSIM", "script": "BerryTreeScript", "flag": "0" }, @@ -65,7 +65,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "48", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_121_ASPEAR", "script": "BerryTreeScript", "flag": "0" }, @@ -78,7 +78,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "49", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_121_RAWST", "script": "BerryTreeScript", "flag": "0" }, @@ -91,7 +91,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "50", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_121_CHESTO", "script": "BerryTreeScript", "flag": "0" }, @@ -104,7 +104,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "51", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_121_SOIL_1", "script": "BerryTreeScript", "flag": "0" }, @@ -117,7 +117,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "52", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_121_NANAB_1", "script": "BerryTreeScript", "flag": "0" }, @@ -130,7 +130,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "53", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_121_NANAB_2", "script": "BerryTreeScript", "flag": "0" }, @@ -143,7 +143,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "54", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_121_SOIL_2", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route123/map.json b/data/maps/Route123/map.json index 1bd25310a..695b50acd 100644 --- a/data/maps/Route123/map.json +++ b/data/maps/Route123/map.json @@ -34,7 +34,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "58", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_POMEG_3", "script": "BerryTreeScript", "flag": "0" }, @@ -47,7 +47,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "59", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_POMEG_4", "script": "BerryTreeScript", "flag": "0" }, @@ -60,7 +60,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "60", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_GREPA_1", "script": "BerryTreeScript", "flag": "0" }, @@ -73,7 +73,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "61", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_GREPA_2", "script": "BerryTreeScript", "flag": "0" }, @@ -86,7 +86,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "62", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_LEPPA_1", "script": "BerryTreeScript", "flag": "0" }, @@ -99,7 +99,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "63", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_SOIL", "script": "BerryTreeScript", "flag": "0" }, @@ -112,7 +112,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "64", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_LEPPA_2", "script": "BerryTreeScript", "flag": "0" }, @@ -151,7 +151,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "65", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_GREPA_3", "script": "BerryTreeScript", "flag": "0" }, @@ -164,7 +164,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "72", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_GREPA_4", "script": "BerryTreeScript", "flag": "0" }, @@ -177,7 +177,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "73", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_QUALOT_2", "script": "BerryTreeScript", "flag": "0" }, @@ -190,7 +190,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "74", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_QUALOT_3", "script": "BerryTreeScript", "flag": "0" }, @@ -203,7 +203,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "79", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_QUALOT_4", "script": "BerryTreeScript", "flag": "0" }, @@ -216,7 +216,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "14", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_QUALOT_1", "script": "BerryTreeScript", "flag": "0" }, @@ -229,7 +229,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "15", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_POMEG_1", "script": "BerryTreeScript", "flag": "0" }, @@ -242,7 +242,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "30", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_POMEG_2", "script": "BerryTreeScript", "flag": "0" }, @@ -320,7 +320,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "87", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_PECHA", "script": "BerryTreeScript", "flag": "0" }, @@ -333,7 +333,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "88", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_SITRUS", "script": "BerryTreeScript", "flag": "0" }, @@ -346,7 +346,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "89", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_123_RAWST", "script": "BerryTreeScript", "flag": "0" }, diff --git a/data/maps/Route130/map.json b/data/maps/Route130/map.json index 7b4cf047c..c612eccb5 100644 --- a/data/maps/Route130/map.json +++ b/data/maps/Route130/map.json @@ -60,7 +60,7 @@ "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", - "trainer_sight_or_berry_tree_id": "82", + "trainer_sight_or_berry_tree_id": "BERRY_TREE_ROUTE_130_LIECHI", "script": "BerryTreeScript", "flag": "FLAG_TEMP_11" }, diff --git a/data/maps/SlateportCity_Harbor/scripts.inc b/data/maps/SlateportCity_Harbor/scripts.inc index 644911ea6..41a224f75 100644 --- a/data/maps/SlateportCity_Harbor/scripts.inc +++ b/data/maps/SlateportCity_Harbor/scripts.inc @@ -70,7 +70,7 @@ SlateportCity_Harbor_EventScript_AquaEscapeScene:: @ 820C9F5 removeobject LOCALID_SUBMARINE setvar VAR_SLATEPORT_HARBOR_STATE, 2 setflag FLAG_MET_TEAM_AQUA_HARBOR - setflag FLAG_HIDE_LILCOVE_MOTEL_SCOTT + setflag FLAG_HIDE_LILYCOVE_MOTEL_SCOTT compare VAR_0x8008, 0 call_if_eq SlateportCity_Harbor_EventScript_SternApproachPlayer0 compare VAR_0x8008, 1 diff --git a/data/maps/SouthernIsland_Interior/scripts.inc b/data/maps/SouthernIsland_Interior/scripts.inc index 0dd8cc303..2c2e6e00d 100644 --- a/data/maps/SouthernIsland_Interior/scripts.inc +++ b/data/maps/SouthernIsland_Interior/scripts.inc @@ -118,14 +118,14 @@ SouthernIsland_Interior_EventScript_SetLatiosBattleVars:: @ 8242BA4 setvar VAR_0x8004, SPECIES_LATIOS setvar VAR_0x8005, 50 @ level setvar VAR_0x8006, ITEM_SOUL_DEW - special CreateObedientEnemyMon + special CreateEventLegalEnemyMon return SouthernIsland_Interior_EventScript_SetLatiasBattleVars:: @ 8242BB7 setvar VAR_0x8004, SPECIES_LATIAS setvar VAR_0x8005, 50 @ level setvar VAR_0x8006, ITEM_SOUL_DEW - special CreateObedientEnemyMon + special CreateEventLegalEnemyMon return SouthernIsland_Interior_Movement_CameraPanUp: @ 8242BCA diff --git a/data/maps/UnknownLinkContestRoom_25_33/map.json b/data/maps/UnknownLinkContestRoom_25_33/map.json deleted file mode 100644 index f73ffe22e..000000000 --- a/data/maps/UnknownLinkContestRoom_25_33/map.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "id": "MAP_UNKNOWN_LINK_CONTEST_ROOM_25_33", - "name": "UnknownLinkContestRoom_25_33", - "layout": "LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_33", - "music": "MUS_GSC_PEWTER", - "region_map_section": "MAPSEC_DYNAMIC", - "requires_flash": false, - "weather": "WEATHER_NONE", - "map_type": "MAP_TYPE_INDOOR", - "allow_cycling": false, - "allow_escaping": false, - "allow_running": false, - "show_map_name": false, - "battle_scene": "MAP_BATTLE_SCENE_NORMAL", - "connections": null, - "shared_events_map": "ContestHall", - "shared_scripts_map": "ContestHall" -} diff --git a/data/maps/UnknownLinkContestRoom_25_34/map.json b/data/maps/UnknownLinkContestRoom_25_34/map.json deleted file mode 100644 index f5ddbbe5a..000000000 --- a/data/maps/UnknownLinkContestRoom_25_34/map.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "id": "MAP_UNKNOWN_LINK_CONTEST_ROOM_25_34", - "name": "UnknownLinkContestRoom_25_34", - "layout": "LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_34", - "music": "MUS_GSC_PEWTER", - "region_map_section": "MAPSEC_DYNAMIC", - "requires_flash": false, - "weather": "WEATHER_NONE", - "map_type": "MAP_TYPE_INDOOR", - "allow_cycling": false, - "allow_escaping": false, - "allow_running": false, - "show_map_name": false, - "battle_scene": "MAP_BATTLE_SCENE_NORMAL", - "connections": null, - "shared_events_map": "ContestHall", - "shared_scripts_map": "ContestHall" -} diff --git a/data/maps/UnknownLinkContestRoom_25_29/map.json b/data/maps/UnusedContestHall1/map.json similarity index 74% rename from data/maps/UnknownLinkContestRoom_25_29/map.json rename to data/maps/UnusedContestHall1/map.json index 72ed407ee..f0cc06947 100644 --- a/data/maps/UnknownLinkContestRoom_25_29/map.json +++ b/data/maps/UnusedContestHall1/map.json @@ -1,7 +1,7 @@ { - "id": "MAP_UNKNOWN_LINK_CONTEST_ROOM_25_29", - "name": "UnknownLinkContestRoom_25_29", - "layout": "LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_29", + "id": "MAP_UNUSED_CONTEST_HALL1", + "name": "UnusedContestHall1", + "layout": "LAYOUT_UNUSED_CONTEST_HALL1", "music": "MUS_GSC_PEWTER", "region_map_section": "MAPSEC_DYNAMIC", "requires_flash": false, diff --git a/data/maps/UnknownLinkContestRoom_25_30/map.json b/data/maps/UnusedContestHall2/map.json similarity index 74% rename from data/maps/UnknownLinkContestRoom_25_30/map.json rename to data/maps/UnusedContestHall2/map.json index cd4d6fddd..96f47e5df 100644 --- a/data/maps/UnknownLinkContestRoom_25_30/map.json +++ b/data/maps/UnusedContestHall2/map.json @@ -1,7 +1,7 @@ { - "id": "MAP_UNKNOWN_LINK_CONTEST_ROOM_25_30", - "name": "UnknownLinkContestRoom_25_30", - "layout": "LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_30", + "id": "MAP_UNUSED_CONTEST_HALL2", + "name": "UnusedContestHall2", + "layout": "LAYOUT_UNUSED_CONTEST_HALL2", "music": "MUS_GSC_PEWTER", "region_map_section": "MAPSEC_DYNAMIC", "requires_flash": false, diff --git a/data/maps/UnknownLinkContestRoom_25_31/map.json b/data/maps/UnusedContestHall3/map.json similarity index 74% rename from data/maps/UnknownLinkContestRoom_25_31/map.json rename to data/maps/UnusedContestHall3/map.json index 975ec382d..95d20e61d 100644 --- a/data/maps/UnknownLinkContestRoom_25_31/map.json +++ b/data/maps/UnusedContestHall3/map.json @@ -1,7 +1,7 @@ { - "id": "MAP_UNKNOWN_LINK_CONTEST_ROOM_25_31", - "name": "UnknownLinkContestRoom_25_31", - "layout": "LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_31", + "id": "MAP_UNUSED_CONTEST_HALL3", + "name": "UnusedContestHall3", + "layout": "LAYOUT_UNUSED_CONTEST_HALL3", "music": "MUS_GSC_PEWTER", "region_map_section": "MAPSEC_DYNAMIC", "requires_flash": false, diff --git a/data/maps/UnknownLinkContestRoom_25_32/map.json b/data/maps/UnusedContestHall4/map.json similarity index 74% rename from data/maps/UnknownLinkContestRoom_25_32/map.json rename to data/maps/UnusedContestHall4/map.json index d2d673adc..b4e715842 100644 --- a/data/maps/UnknownLinkContestRoom_25_32/map.json +++ b/data/maps/UnusedContestHall4/map.json @@ -1,7 +1,7 @@ { - "id": "MAP_UNKNOWN_LINK_CONTEST_ROOM_25_32", - "name": "UnknownLinkContestRoom_25_32", - "layout": "LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_32", + "id": "MAP_UNUSED_CONTEST_HALL4", + "name": "UnusedContestHall4", + "layout": "LAYOUT_UNUSED_CONTEST_HALL4", "music": "MUS_GSC_PEWTER", "region_map_section": "MAPSEC_DYNAMIC", "requires_flash": false, diff --git a/data/maps/UnusedContestHall5/map.json b/data/maps/UnusedContestHall5/map.json new file mode 100644 index 000000000..4c1281bf3 --- /dev/null +++ b/data/maps/UnusedContestHall5/map.json @@ -0,0 +1,18 @@ +{ + "id": "MAP_UNUSED_CONTEST_HALL5", + "name": "UnusedContestHall5", + "layout": "LAYOUT_UNUSED_CONTEST_HALL5", + "music": "MUS_GSC_PEWTER", + "region_map_section": "MAPSEC_DYNAMIC", + "requires_flash": false, + "weather": "WEATHER_NONE", + "map_type": "MAP_TYPE_INDOOR", + "allow_cycling": false, + "allow_escaping": false, + "allow_running": false, + "show_map_name": false, + "battle_scene": "MAP_BATTLE_SCENE_NORMAL", + "connections": null, + "shared_events_map": "ContestHall", + "shared_scripts_map": "ContestHall" +} diff --git a/data/maps/UnusedContestHall6/map.json b/data/maps/UnusedContestHall6/map.json new file mode 100644 index 000000000..c0a7dbb4d --- /dev/null +++ b/data/maps/UnusedContestHall6/map.json @@ -0,0 +1,18 @@ +{ + "id": "MAP_UNUSED_CONTEST_HALL6", + "name": "UnusedContestHall6", + "layout": "LAYOUT_UNUSED_CONTEST_HALL6", + "music": "MUS_GSC_PEWTER", + "region_map_section": "MAPSEC_DYNAMIC", + "requires_flash": false, + "weather": "WEATHER_NONE", + "map_type": "MAP_TYPE_INDOOR", + "allow_cycling": false, + "allow_escaping": false, + "allow_running": false, + "show_map_name": false, + "battle_scene": "MAP_BATTLE_SCENE_NORMAL", + "connections": null, + "shared_events_map": "ContestHall", + "shared_scripts_map": "ContestHall" +} diff --git a/data/maps/map_groups.json b/data/maps/map_groups.json index 4201e814f..4268abbef 100644 --- a/data/maps/map_groups.json +++ b/data/maps/map_groups.json @@ -461,12 +461,12 @@ "RecordCorner", "BattleColosseum_4P", "ContestHall", - "UnknownLinkContestRoom_25_29", - "UnknownLinkContestRoom_25_30", - "UnknownLinkContestRoom_25_31", - "UnknownLinkContestRoom_25_32", - "UnknownLinkContestRoom_25_33", - "UnknownLinkContestRoom_25_34", + "UnusedContestHall1", + "UnusedContestHall2", + "UnusedContestHall3", + "UnusedContestHall4", + "UnusedContestHall5", + "UnusedContestHall6", "ContestHallBeauty", "ContestHallTough", "ContestHallCool", diff --git a/data/script_cmd_table.inc b/data/script_cmd_table.inc index 7edb5c4b7..a26ce6bf2 100644 --- a/data/script_cmd_table.inc +++ b/data/script_cmd_table.inc @@ -205,8 +205,8 @@ gScriptCmdTable:: @ 81DB67C .4byte ScrCmd_nop1 @ 0xca .4byte ScrCmd_nop1 @ 0xcb .4byte ScrCmd_nop1 @ 0xcc - .4byte ScrCmd_setmonobedient @ 0xcd - .4byte ScrCmd_checkmonobedience @ 0xce + .4byte ScrCmd_setmoneventlegal @ 0xcd + .4byte ScrCmd_checkmoneventlegal @ 0xce .4byte ScrCmd_gotoram @ 0xcf .4byte ScrCmd_nop1 @ 0xd0 .4byte ScrCmd_warpspinenter @ 0xd1 @@ -216,10 +216,10 @@ gScriptCmdTable:: @ 81DB67C .4byte ScrCmd_initrotatingtilepuzzle @ 0xd5 .4byte ScrCmd_freerotatingtilepuzzle @ 0xd6 .4byte ScrCmd_warpmossdeepgym @ 0xd7 - .4byte ScrCmd_cmdD8 @ 0xd8 - .4byte ScrCmd_cmdD9 @ 0xd9 + .4byte ScrCmd_selectapproachingtrainer @ 0xd8 + .4byte ScrCmd_lockfortrainer @ 0xd9 .4byte ScrCmd_closebraillemessage @ 0xda - .4byte ScrCmd_cmdDB @ 0xdb + .4byte ScrCmd_messageinstant @ 0xdb .4byte ScrCmd_fadescreenswapbuffers @ 0xdc .4byte ScrCmd_buffertrainerclassname @ 0xdd .4byte ScrCmd_buffertrainername @ 0xde diff --git a/data/scripts/battle_pike.inc b/data/scripts/battle_pike.inc index 67eb19011..7ba25321d 100644 --- a/data/scripts/battle_pike.inc +++ b/data/scripts/battle_pike.inc @@ -1,5 +1,5 @@ @ Note: LOCALIDs shared with BattleFrontier_BattlePikeRoomNormal -BattleFrontier_BattlePikeRoomNormal_MapScripts_2C3E1B: @ 82C3E1B +BattleFrontier_BattlePikeRoom_MapScripts: @ 82C3E1B map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_BattlePikeRoom_OnTransition map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattlePikeRoom_OnWarp diff --git a/data/scripts/gabby_and_ty.inc b/data/scripts/gabby_and_ty.inc index 84cd315f7..c7f576aba 100644 --- a/data/scripts/gabby_and_ty.inc +++ b/data/scripts/gabby_and_ty.inc @@ -1,16 +1,3 @@ -@ Unused -EventScript_28CCAA:: @ 828CCAA - setvar VAR_0x8005, 8 - special InterviewBefore - compare VAR_RESULT, 1 - goto_if_eq EventScript_UnusedRet - setvar VAR_0x8005, 8 - special InterviewAfter - return - -EventScript_UnusedRet:: @ 828CCC6 - return - @ Gabby and Ty always move to the same spots for the first 5 battles @ From the 6th battle onwards, they move randomly between locations 6-8 @ Note: The local IDs of Gabby and Ty are hard-coded in GabbyAndTySetScriptVarsToObjectEventLocalIds diff --git a/data/scripts/hall_of_fame.inc b/data/scripts/hall_of_fame.inc index 91a88f348..021784f81 100644 --- a/data/scripts/hall_of_fame.inc +++ b/data/scripts/hall_of_fame.inc @@ -4,7 +4,7 @@ EverGrandeCity_HallOfFame_EventScript_SetGameClearFlags:: @ 82717C1 call EverGrandeCity_HallOfFame_EventScript_ResetDefeatedEventLegendaries compare VAR_FOSSIL_MANIAC_STATE, 0 call_if_eq EverGrandeCity_HallOfFame_EventScript_SetDesertUnderpassCommentReady - clearflag FLAG_HIDE_LILCOVE_MOTEL_GAME_DESIGNERS + clearflag FLAG_HIDE_LILYCOVE_MOTEL_GAME_DESIGNERS call EverGrandeCity_HallOfFame_EventScript_ResetEliteFour setflag FLAG_HIDE_SLATEPORT_CITY_STERNS_SHIPYARD_MR_BRINEY clearflag FLAG_HIDE_SS_TIDAL_CORRIDOR_MR_BRINEY diff --git a/data/scripts/interview.inc b/data/scripts/interview.inc index f968577f3..9921aa603 100644 --- a/data/scripts/interview.inc +++ b/data/scripts/interview.inc @@ -342,3 +342,16 @@ BattleFrontier_BattleTowerLobby_EventScript_ShowOrHideReporter:: @ 828CC84 BattleFrontier_BattleTowerLobby_EventScript_HideReporter:: @ 828CCA6 setflag FLAG_HIDE_BATTLE_TOWER_REPORTER return + +@ Unused +EventScript_ContestLiveInterview:: @ 828CCAA + setvar VAR_0x8005, TVSHOW_CONTEST_LIVE_UPDATES + special InterviewBefore + compare VAR_RESULT, TRUE + goto_if_eq EventScript_ContestLiveInterviewEnd + setvar VAR_0x8005, TVSHOW_CONTEST_LIVE_UPDATES + special InterviewAfter + return + +EventScript_ContestLiveInterviewEnd:: @ 828CCC6 + return diff --git a/data/scripts/mevent_pichu.inc b/data/scripts/mevent_pichu.inc index c51558e9e..2b9e09df9 100644 --- a/data/scripts/mevent_pichu.inc +++ b/data/scripts/mevent_pichu.inc @@ -30,7 +30,7 @@ SurfPichu_FullParty: @ 8674D73 SurfPichu_GiveEgg: @ 8674D7E giveegg SPECIES_PICHU - setmonobedient VAR_EVENT_PICHU_SLOT + setmoneventlegal VAR_EVENT_PICHU_SLOT setmonmetlocation VAR_EVENT_PICHU_SLOT, METLOC_FATEFUL_ENCOUNTER compare VAR_EVENT_PICHU_SLOT, 1 vgoto_if_eq SurfPichu_Slot1 diff --git a/data/scripts/new_game.inc b/data/scripts/new_game.inc index 77102a001..422186695 100644 --- a/data/scripts/new_game.inc +++ b/data/scripts/new_game.inc @@ -1,115 +1,115 @@ EventScript_ResetAllBerries:: @ 827149D @ Route 102 - setberrytree 2, ITEM_TO_BERRY(ITEM_ORAN_BERRY), BERRY_STAGE_BERRIES - setberrytree 1, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_102_ORAN, ITEM_TO_BERRY(ITEM_ORAN_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_102_PECHA, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES @ Route 104 - setberrytree 11, ITEM_TO_BERRY(ITEM_ORAN_BERRY), BERRY_STAGE_BERRIES - setberrytree 13, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES - setberrytree 4, ITEM_TO_BERRY(ITEM_ORAN_BERRY), BERRY_STAGE_BERRIES - setberrytree 76, ITEM_TO_BERRY(ITEM_CHERI_BERRY), BERRY_STAGE_BERRIES - setberrytree 8, ITEM_TO_BERRY(ITEM_CHERI_BERRY), BERRY_STAGE_BERRIES - setberrytree 10, ITEM_TO_BERRY(ITEM_LEPPA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_104_ORAN_2, ITEM_TO_BERRY(ITEM_ORAN_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_104_PECHA, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_104_ORAN_1, ITEM_TO_BERRY(ITEM_ORAN_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_104_CHERI_2, ITEM_TO_BERRY(ITEM_CHERI_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_104_CHERI_1, ITEM_TO_BERRY(ITEM_CHERI_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_104_LEPPA, ITEM_TO_BERRY(ITEM_LEPPA_BERRY), BERRY_STAGE_BERRIES @ Route 116 - setberrytree 25, ITEM_TO_BERRY(ITEM_PINAP_BERRY), BERRY_STAGE_BERRIES - setberrytree 26, ITEM_TO_BERRY(ITEM_CHESTO_BERRY), BERRY_STAGE_BERRIES - setberrytree 66, ITEM_TO_BERRY(ITEM_CHESTO_BERRY), BERRY_STAGE_BERRIES - setberrytree 67, ITEM_TO_BERRY(ITEM_PINAP_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_116_PINAP_1, ITEM_TO_BERRY(ITEM_PINAP_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_116_CHESTO_1, ITEM_TO_BERRY(ITEM_CHESTO_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_116_CHESTO_2, ITEM_TO_BERRY(ITEM_CHESTO_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_116_PINAP_2, ITEM_TO_BERRY(ITEM_PINAP_BERRY), BERRY_STAGE_BERRIES @ Route 115 - setberrytree 69, ITEM_TO_BERRY(ITEM_KELPSY_BERRY), BERRY_STAGE_BERRIES - setberrytree 70, ITEM_TO_BERRY(ITEM_KELPSY_BERRY), BERRY_STAGE_BERRIES - setberrytree 71, ITEM_TO_BERRY(ITEM_KELPSY_BERRY), BERRY_STAGE_BERRIES - setberrytree 55, ITEM_TO_BERRY(ITEM_BLUK_BERRY), BERRY_STAGE_BERRIES - setberrytree 56, ITEM_TO_BERRY(ITEM_BLUK_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_115_KELPSY_1, ITEM_TO_BERRY(ITEM_KELPSY_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_115_KELPSY_2, ITEM_TO_BERRY(ITEM_KELPSY_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_115_KELPSY_3, ITEM_TO_BERRY(ITEM_KELPSY_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_115_BLUK_1, ITEM_TO_BERRY(ITEM_BLUK_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_115_BLUK_2, ITEM_TO_BERRY(ITEM_BLUK_BERRY), BERRY_STAGE_BERRIES @ Route 103 - setberrytree 5, ITEM_TO_BERRY(ITEM_CHERI_BERRY), BERRY_STAGE_BERRIES - setberrytree 6, ITEM_TO_BERRY(ITEM_LEPPA_BERRY), BERRY_STAGE_BERRIES - setberrytree 7, ITEM_TO_BERRY(ITEM_CHERI_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_103_CHERI_1, ITEM_TO_BERRY(ITEM_CHERI_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_103_LEPPA, ITEM_TO_BERRY(ITEM_LEPPA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_103_CHERI_2, ITEM_TO_BERRY(ITEM_CHERI_BERRY), BERRY_STAGE_BERRIES @ Route 110 - setberrytree 16, ITEM_TO_BERRY(ITEM_NANAB_BERRY), BERRY_STAGE_BERRIES - setberrytree 17, ITEM_TO_BERRY(ITEM_NANAB_BERRY), BERRY_STAGE_BERRIES - setberrytree 18, ITEM_TO_BERRY(ITEM_NANAB_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_110_NANAB_1, ITEM_TO_BERRY(ITEM_NANAB_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_110_NANAB_2, ITEM_TO_BERRY(ITEM_NANAB_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_110_NANAB_3, ITEM_TO_BERRY(ITEM_NANAB_BERRY), BERRY_STAGE_BERRIES @ Route 117 - setberrytree 29, ITEM_TO_BERRY(ITEM_WEPEAR_BERRY), BERRY_STAGE_BERRIES - setberrytree 28, ITEM_TO_BERRY(ITEM_WEPEAR_BERRY), BERRY_STAGE_BERRIES - setberrytree 27, ITEM_TO_BERRY(ITEM_WEPEAR_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_117_WEPEAR_3, ITEM_TO_BERRY(ITEM_WEPEAR_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_117_WEPEAR_2, ITEM_TO_BERRY(ITEM_WEPEAR_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_117_WEPEAR_1, ITEM_TO_BERRY(ITEM_WEPEAR_BERRY), BERRY_STAGE_BERRIES @ Route 112 - setberrytree 24, ITEM_TO_BERRY(ITEM_RAWST_BERRY), BERRY_STAGE_BERRIES - setberrytree 23, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES - setberrytree 22, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES - setberrytree 21, ITEM_TO_BERRY(ITEM_RAWST_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_112_RAWST_2, ITEM_TO_BERRY(ITEM_RAWST_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_112_PECHA_2, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_112_PECHA_1, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_112_RAWST_1, ITEM_TO_BERRY(ITEM_RAWST_BERRY), BERRY_STAGE_BERRIES @ Route 111 - setberrytree 19, ITEM_TO_BERRY(ITEM_RAZZ_BERRY), BERRY_STAGE_BERRIES - setberrytree 20, ITEM_TO_BERRY(ITEM_RAZZ_BERRY), BERRY_STAGE_BERRIES - setberrytree 80, ITEM_TO_BERRY(ITEM_ORAN_BERRY), BERRY_STAGE_BERRIES - setberrytree 81, ITEM_TO_BERRY(ITEM_ORAN_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_111_RAZZ_1, ITEM_TO_BERRY(ITEM_RAZZ_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_111_RAZZ_2, ITEM_TO_BERRY(ITEM_RAZZ_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_111_ORAN_1, ITEM_TO_BERRY(ITEM_ORAN_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_111_ORAN_2, ITEM_TO_BERRY(ITEM_ORAN_BERRY), BERRY_STAGE_BERRIES @ Route 114 - setberrytree 77, ITEM_TO_BERRY(ITEM_PERSIM_BERRY), BERRY_STAGE_BERRIES - setberrytree 78, ITEM_TO_BERRY(ITEM_PERSIM_BERRY), BERRY_STAGE_BERRIES - setberrytree 68, ITEM_TO_BERRY(ITEM_PERSIM_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_114_PERSIM_2, ITEM_TO_BERRY(ITEM_PERSIM_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_114_PERSIM_3, ITEM_TO_BERRY(ITEM_PERSIM_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_114_PERSIM_1, ITEM_TO_BERRY(ITEM_PERSIM_BERRY), BERRY_STAGE_BERRIES @ Route 118 - setberrytree 31, ITEM_TO_BERRY(ITEM_SITRUS_BERRY), BERRY_STAGE_BERRIES - setberrytree 33, ITEM_TO_BERRY(ITEM_SITRUS_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_118_SITRUS_1, ITEM_TO_BERRY(ITEM_SITRUS_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_118_SITRUS_2, ITEM_TO_BERRY(ITEM_SITRUS_BERRY), BERRY_STAGE_BERRIES @ Route 119 - setberrytree 34, ITEM_TO_BERRY(ITEM_POMEG_BERRY), BERRY_STAGE_BERRIES - setberrytree 35, ITEM_TO_BERRY(ITEM_POMEG_BERRY), BERRY_STAGE_BERRIES - setberrytree 36, ITEM_TO_BERRY(ITEM_POMEG_BERRY), BERRY_STAGE_BERRIES - setberrytree 83, ITEM_TO_BERRY(ITEM_HONDEW_BERRY), BERRY_STAGE_BERRIES - setberrytree 84, ITEM_TO_BERRY(ITEM_HONDEW_BERRY), BERRY_STAGE_BERRIES - setberrytree 85, ITEM_TO_BERRY(ITEM_SITRUS_BERRY), BERRY_STAGE_BERRIES - setberrytree 86, ITEM_TO_BERRY(ITEM_LEPPA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_119_POMEG_1, ITEM_TO_BERRY(ITEM_POMEG_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_119_POMEG_2, ITEM_TO_BERRY(ITEM_POMEG_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_119_POMEG_3, ITEM_TO_BERRY(ITEM_POMEG_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_119_HONDEW_1, ITEM_TO_BERRY(ITEM_HONDEW_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_119_HONDEW_2, ITEM_TO_BERRY(ITEM_HONDEW_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_119_SITRUS, ITEM_TO_BERRY(ITEM_SITRUS_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_119_LEPPA, ITEM_TO_BERRY(ITEM_LEPPA_BERRY), BERRY_STAGE_BERRIES @ Route 120 - setberrytree 37, ITEM_TO_BERRY(ITEM_ASPEAR_BERRY), BERRY_STAGE_BERRIES - setberrytree 38, ITEM_TO_BERRY(ITEM_ASPEAR_BERRY), BERRY_STAGE_BERRIES - setberrytree 39, ITEM_TO_BERRY(ITEM_ASPEAR_BERRY), BERRY_STAGE_BERRIES - setberrytree 40, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES - setberrytree 41, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES - setberrytree 42, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES - setberrytree 46, ITEM_TO_BERRY(ITEM_WEPEAR_BERRY), BERRY_STAGE_BERRIES - setberrytree 45, ITEM_TO_BERRY(ITEM_PINAP_BERRY), BERRY_STAGE_BERRIES - setberrytree 44, ITEM_TO_BERRY(ITEM_NANAB_BERRY), BERRY_STAGE_BERRIES - setberrytree 43, ITEM_TO_BERRY(ITEM_RAZZ_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_120_ASPEAR_1, ITEM_TO_BERRY(ITEM_ASPEAR_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_120_ASPEAR_2, ITEM_TO_BERRY(ITEM_ASPEAR_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_120_ASPEAR_3, ITEM_TO_BERRY(ITEM_ASPEAR_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_120_PECHA_1, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_120_PECHA_2, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_120_PECHA_3, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_120_WEPEAR, ITEM_TO_BERRY(ITEM_WEPEAR_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_120_PINAP, ITEM_TO_BERRY(ITEM_PINAP_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_120_NANAB, ITEM_TO_BERRY(ITEM_NANAB_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_120_RAZZ, ITEM_TO_BERRY(ITEM_RAZZ_BERRY), BERRY_STAGE_BERRIES @ Route 121 - setberrytree 47, ITEM_TO_BERRY(ITEM_PERSIM_BERRY), BERRY_STAGE_BERRIES - setberrytree 48, ITEM_TO_BERRY(ITEM_ASPEAR_BERRY), BERRY_STAGE_BERRIES - setberrytree 49, ITEM_TO_BERRY(ITEM_RAWST_BERRY), BERRY_STAGE_BERRIES - setberrytree 50, ITEM_TO_BERRY(ITEM_CHESTO_BERRY), BERRY_STAGE_BERRIES - setberrytree 52, ITEM_TO_BERRY(ITEM_NANAB_BERRY), BERRY_STAGE_BERRIES - setberrytree 53, ITEM_TO_BERRY(ITEM_NANAB_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_121_PERSIM, ITEM_TO_BERRY(ITEM_PERSIM_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_121_ASPEAR, ITEM_TO_BERRY(ITEM_ASPEAR_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_121_RAWST, ITEM_TO_BERRY(ITEM_RAWST_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_121_CHESTO, ITEM_TO_BERRY(ITEM_CHESTO_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_121_NANAB_1, ITEM_TO_BERRY(ITEM_NANAB_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_121_NANAB_2, ITEM_TO_BERRY(ITEM_NANAB_BERRY), BERRY_STAGE_BERRIES @ Route 123 - setberrytree 62, ITEM_TO_BERRY(ITEM_LEPPA_BERRY), BERRY_STAGE_BERRIES - setberrytree 64, ITEM_TO_BERRY(ITEM_LEPPA_BERRY), BERRY_STAGE_BERRIES - setberrytree 58, ITEM_TO_BERRY(ITEM_POMEG_BERRY), BERRY_STAGE_BERRIES - setberrytree 59, ITEM_TO_BERRY(ITEM_POMEG_BERRY), BERRY_STAGE_BERRIES - setberrytree 60, ITEM_TO_BERRY(ITEM_GREPA_BERRY), BERRY_STAGE_BERRIES - setberrytree 61, ITEM_TO_BERRY(ITEM_GREPA_BERRY), BERRY_STAGE_BERRIES - setberrytree 79, ITEM_TO_BERRY(ITEM_QUALOT_BERRY), BERRY_STAGE_BERRIES - setberrytree 14, ITEM_TO_BERRY(ITEM_QUALOT_BERRY), BERRY_STAGE_BERRIES - setberrytree 15, ITEM_TO_BERRY(ITEM_POMEG_BERRY), BERRY_STAGE_BERRIES - setberrytree 30, ITEM_TO_BERRY(ITEM_POMEG_BERRY), BERRY_STAGE_BERRIES - setberrytree 65, ITEM_TO_BERRY(ITEM_GREPA_BERRY), BERRY_STAGE_BERRIES - setberrytree 72, ITEM_TO_BERRY(ITEM_GREPA_BERRY), BERRY_STAGE_BERRIES - setberrytree 73, ITEM_TO_BERRY(ITEM_QUALOT_BERRY), BERRY_STAGE_BERRIES - setberrytree 74, ITEM_TO_BERRY(ITEM_QUALOT_BERRY), BERRY_STAGE_BERRIES - setberrytree 87, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES - setberrytree 88, ITEM_TO_BERRY(ITEM_SITRUS_BERRY), BERRY_STAGE_BERRIES - setberrytree 89, ITEM_TO_BERRY(ITEM_RAWST_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_LEPPA_1, ITEM_TO_BERRY(ITEM_LEPPA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_LEPPA_2, ITEM_TO_BERRY(ITEM_LEPPA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_POMEG_3, ITEM_TO_BERRY(ITEM_POMEG_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_POMEG_4, ITEM_TO_BERRY(ITEM_POMEG_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_GREPA_1, ITEM_TO_BERRY(ITEM_GREPA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_GREPA_2, ITEM_TO_BERRY(ITEM_GREPA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_QUALOT_4, ITEM_TO_BERRY(ITEM_QUALOT_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_QUALOT_1, ITEM_TO_BERRY(ITEM_QUALOT_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_POMEG_1, ITEM_TO_BERRY(ITEM_POMEG_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_POMEG_2, ITEM_TO_BERRY(ITEM_POMEG_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_GREPA_3, ITEM_TO_BERRY(ITEM_GREPA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_GREPA_4, ITEM_TO_BERRY(ITEM_GREPA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_QUALOT_2, ITEM_TO_BERRY(ITEM_QUALOT_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_QUALOT_3, ITEM_TO_BERRY(ITEM_QUALOT_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_PECHA, ITEM_TO_BERRY(ITEM_PECHA_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_SITRUS, ITEM_TO_BERRY(ITEM_SITRUS_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_123_RAWST, ITEM_TO_BERRY(ITEM_RAWST_BERRY), BERRY_STAGE_BERRIES @ Mirage Island - setberrytree 82, ITEM_TO_BERRY(ITEM_LIECHI_BERRY), BERRY_STAGE_BERRIES + setberrytree BERRY_TREE_ROUTE_130_LIECHI, ITEM_TO_BERRY(ITEM_LIECHI_BERRY), BERRY_STAGE_BERRIES return EventScript_ResetAllMapFlags:: @ 82715DE @@ -229,7 +229,7 @@ EventScript_ResetAllMapFlags:: @ 82715DE setflag FLAG_HIDE_ROUTE_110_RIVAL_ON_BIKE setflag FLAG_HIDE_ROUTE_119_RIVAL_ON_BIKE setflag FLAG_HIDE_ROUTE_104_RIVAL - setflag FLAG_HIDE_LILCOVE_MOTEL_GAME_DESIGNERS + setflag FLAG_HIDE_LILYCOVE_MOTEL_GAME_DESIGNERS setflag FLAG_HIDE_LAVARIDGE_TOWN_RIVAL setflag FLAG_HIDE_LAVARIDGE_TOWN_RIVAL_ON_BIKE setflag FLAG_HIDE_MOSSDEEP_CITY_HOUSE_2_WINGULL diff --git a/data/scripts/secret_base.inc b/data/scripts/secret_base.inc index 4a20de9a6..9e7a60e15 100644 --- a/data/scripts/secret_base.inc +++ b/data/scripts/secret_base.inc @@ -157,7 +157,7 @@ SecretBase_EventScript_InitSecretBase:: @ 8275B5B end SecretBase_EventScript_FirstEntrance:: @ 8275B81 - applymovement OBJ_EVENT_ID_PLAYER, SecretBase_Movement_275BB4 + applymovement OBJ_EVENT_ID_PLAYER, SecretBase_Movement_EnterBase waitmovement 0 setvar VAR_INIT_SECRET_BASE, 1 msgbox SecretBase_Text_WantToMakeYourSecretBaseHere, MSGBOX_YESNO @@ -175,7 +175,7 @@ SecretBase_EventScript_SetAsBase:: @ 8275BAB waitstate end -SecretBase_Movement_275BB4: @ 8275BB4 +SecretBase_Movement_EnterBase: @ 8275BB4 walk_up walk_up step_end diff --git a/data/scripts/trainer_battle.inc b/data/scripts/trainer_battle.inc index aa96e7b35..0b5c1118b 100644 --- a/data/scripts/trainer_battle.inc +++ b/data/scripts/trainer_battle.inc @@ -1,10 +1,9 @@ -EventScript_271354:: @ 8271354 - cmdD8 - cmdD9 - -EventScript_ShowSecondTrainerIntro:: @ 8271356 - special SetUpTrainerEncounterMusic - special EndTrainerApproach +EventScript_StartTrainerApproach:: @ 8271354 + selectapproachingtrainer + lockfortrainer +EventScript_TrainerApproach:: @ 8271356 + special PlayTrainerEncounterMusic + special DoTrainerApproach waitstate goto EventScript_ShowTrainerIntroMsg @@ -14,11 +13,12 @@ EventScript_TryDoNormalTrainerBattle:: @ 8271362 applymovement VAR_LAST_TALKED, Movement_RevealTrainer waitmovement 0 specialvar VAR_RESULT, GetTrainerFlag - compare VAR_RESULT, 0 + compare VAR_RESULT, FALSE goto_if_ne EventScript_NoNormalTrainerBattle - special SetUpTrainerEncounterMusic - special SetUpTrainerMovement + special PlayTrainerEncounterMusic + special SetTrainerFacingDirection goto EventScript_ShowTrainerIntroMsg + EventScript_NoNormalTrainerBattle:: @ 8271389 gotopostbattlescript @@ -27,27 +27,29 @@ EventScript_TryDoDoubleTrainerBattle:: @ 827138A faceplayer call EventScript_RevealTrainer specialvar VAR_RESULT, GetTrainerFlag - compare VAR_RESULT, 0 + compare VAR_RESULT, FALSE goto_if_ne EventScript_NoDoubleTrainerBattle special HasEnoughMonsForDoubleBattle compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS goto_if_ne EventScript_NotEnoughMonsForDoubleBattle - special SetUpTrainerEncounterMusic - special SetUpTrainerMovement + special PlayTrainerEncounterMusic + special SetTrainerFacingDirection goto EventScript_ShowTrainerIntroMsg + EventScript_NotEnoughMonsForDoubleBattle:: @ 82713BA special ShowTrainerCantBattleSpeech waitmessage waitbuttonpress release end + EventScript_NoDoubleTrainerBattle:: @ 82713C1 gotopostbattlescript EventScript_DoNoIntroTrainerBattle:: @ 82713C2 applymovement VAR_LAST_TALKED, Movement_RevealTrainer waitmovement 0 - special SetUpTrainerEncounterMusic + special PlayTrainerEncounterMusic trainerbattlebegin gotopostbattlescript @@ -56,8 +58,8 @@ EventScript_TryDoRematchBattle:: @ 82713D1 specialvar VAR_RESULT, IsTrainerReadyForRematch compare VAR_RESULT, FALSE goto_if_eq EventScript_NoRematchTrainerBattle - special SetUpTrainerEncounterMusic - special SetUpTrainerMovement + special PlayTrainerEncounterMusic + special SetTrainerFacingDirection special ShowTrainerIntroSpeech waitmessage waitbuttonpress @@ -65,6 +67,7 @@ EventScript_TryDoRematchBattle:: @ 82713D1 waitstate releaseall end + EventScript_NoRematchTrainerBattle:: @ 82713F7 gotopostbattlescript @@ -75,8 +78,8 @@ EventScript_TryDoDoubleRematchBattle:: @ 82713F8 special HasEnoughMonsForDoubleBattle compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS goto_if_ne EventScript_NotEnoughMonsForDoubleRematchBattle - special SetUpTrainerEncounterMusic - special SetUpTrainerMovement + special PlayTrainerEncounterMusic + special SetTrainerFacingDirection special ShowTrainerIntroSpeech waitmessage waitbuttonpress @@ -84,8 +87,10 @@ EventScript_TryDoDoubleRematchBattle:: @ 82713F8 waitstate releaseall end + EventScript_NoDoubleRematchTrainerBattle:: @ 8271427 gotopostbattlescript + EventScript_NotEnoughMonsForDoubleRematchBattle:: @ 8271428 special ShowTrainerCantBattleSpeech waitmessage @@ -108,7 +113,7 @@ EventScript_ShowTrainerIntroMsg:: @ 827143C waitbuttonpress special TryPrepareSecondApproachingTrainer compare VAR_RESULT, TRUE - goto_if_eq EventScript_ShowSecondTrainerIntro + goto_if_eq EventScript_TrainerApproach goto EventScript_DoTrainerBattle EventScript_DoTrainerBattle:: @ 8271454 diff --git a/data/scripts/trainer_hill.inc b/data/scripts/trainer_hill.inc index 34d0462bb..e4e453228 100644 --- a/data/scripts/trainer_hill.inc +++ b/data/scripts/trainer_hill.inc @@ -16,7 +16,9 @@ TrainerHill_OnWarp: @ 82C8372 TrainerHill_1F_EventScript_DummyOnWarp:: @ 82C837C setvar VAR_TEMP_3, 1 -@ forced stop +.ifdef BUGFIX + end @ Missing end. By chance, the next byte (0x02 of VAR_TEMP_2) is also the id for the end cmd +.endif TrainerHill_OnFrame: @ 82C8381 map_script_2 VAR_TEMP_2, 0, TrainerHill_1F_EventScript_DummyWarpToEntranceCounter diff --git a/data/specials.inc b/data/specials.inc index fe596a0f0..442c50198 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -66,8 +66,8 @@ gSpecials:: @ 81DBA64 def_special ShowTrainerIntroSpeech def_special ShowTrainerCantBattleSpeech def_special GetTrainerFlag - def_special EndTrainerApproach - def_special SetUpTrainerEncounterMusic + def_special DoTrainerApproach + def_special PlayTrainerEncounterMusic def_special ShouldTryRematchBattle def_special IsTrainerReadyForRematch def_special BattleSetup_StartRematchBattle @@ -324,7 +324,7 @@ gSpecials:: @ 81DBA64 def_special StartGroudonKyogreBattle def_special BattleSetup_StartLegendaryBattle def_special StartRegiBattle - def_special SetUpTrainerMovement + def_special SetTrainerFacingDirection def_special DoSealedChamberShakingEffect2 def_special FoundBlackGlasses def_special StartDroughtWeatherBlend @@ -490,7 +490,7 @@ gSpecials:: @ 81DBA64 def_special sub_813AF48 def_special DoDeoxysRockInteraction def_special SetDeoxysRockPalette - def_special CreateObedientEnemyMon + def_special CreateEventLegalEnemyMon def_special StartMirageTowerDisintegration def_special StartMirageTowerShake def_special StartMirageTowerFossilFallAndSink @@ -514,7 +514,7 @@ gSpecials:: @ 81DBA64 def_special SetMewAboveGrass def_special ShouldDistributeEonTicket def_special LinkRetireStatusWithBattleTowerPartner - def_special sub_813B534 + def_special BattleTowerReconnectLink def_special CallTrainerHillFunction def_special Script_DoRayquazaScene @ Listed twice def_special LoopWingFlapSE diff --git a/data/text/braille.inc b/data/text/braille.inc index 30f9b44d4..57b77e393 100644 --- a/data/text/braille.inc +++ b/data/text/braille.inc @@ -1,222 +1,112 @@ Underwater_SealedChamber_Braille_GoUpHere: @ 82A6B15 - .byte 4 - .byte 6 - .byte 26 - .byte 13 - .byte 7 - .byte 9 + brailleformat 4, 6, 26, 13, 7, 9 .braille "GO UP HERE.$" SealedChamber_OuterRoom_Braille_ABC: @ 82A6B27 - .byte 7 - .byte 6 - .byte 21 - .byte 13 - .byte 10 - .byte 9 + brailleformat 7, 6, 21, 13, 10, 9 .braille "ABC$" SealedChamber_OuterRoom_Braille_GHI: @ 82A6B31 - .byte 7 - .byte 6 - .byte 21 - .byte 13 - .byte 10 - .byte 9 + brailleformat 7, 6, 21, 13, 10, 9 .braille "GHI$" SealedChamber_OuterRoom_Braille_MNO: @ 82A6B3B - .byte 7 - .byte 6 - .byte 21 - .byte 13 - .byte 10 - .byte 9 + brailleformat 7, 6, 21, 13, 10, 9 .braille "MNO$" SealedChamber_OuterRoom_Braille_TUV: @ 82A6B45 - .byte 7 - .byte 6 - .byte 21 - .byte 13 - .byte 10 - .byte 9 + brailleformat 7, 6, 21, 13, 10, 9 .braille "TUV$" SealedChamber_OuterRoom_Braille_DEF: @ 82A6B4F - .byte 7 - .byte 6 - .byte 21 - .byte 13 - .byte 10 - .byte 9 + brailleformat 7, 6, 21, 13, 10, 9 .braille "DEF$" SealedChamber_OuterRoom_Braille_JKL: @ 82A6B59 - .byte 7 - .byte 6 - .byte 21 - .byte 13 - .byte 10 - .byte 9 + brailleformat 7, 6, 21, 13, 10, 9 .braille "JKL$" SealedChamber_OuterRoom_Braille_PQRS: @ 82A6B63 - .byte 7 - .byte 6 - .byte 21 - .byte 13 - .byte 10 - .byte 9 + brailleformat 7, 6, 21, 13, 10, 9 .braille "PQRS$" SealedChamber_OuterRoom_Braille_Period: @ 82A6B6E - .byte 9 - .byte 6 - .byte 19 - .byte 13 - .byte 12 - .byte 9 + brailleformat 9, 6, 19, 13, 12, 9 .braille ".$" SealedChamber_OuterRoom_Braille_WXYZ: @ 82A6B76 - .byte 7 - .byte 6 - .byte 21 - .byte 13 - .byte 10 - .byte 9 + brailleformat 7, 6, 21, 13, 10, 9 .braille "WXYZ$" SealedChamber_OuterRoom_Braille_Comma: @ 82A6B81 - .byte 9 - .byte 6 - .byte 19 - .byte 13 - .byte 12 - .byte 9 + brailleformat 9, 6, 19, 13, 12, 9 .braille ",$" SealedChamber_OuterRoom_Braille_DigHere: @ 82A6B89 - .byte 7 - .byte 4 - .byte 23 - .byte 15 - .byte 10 - .byte 7 + brailleformat 7, 4, 23, 15, 10, 7 .braille "DIG HERE.$" SealedChamber_InnerRoom_Braille_FirstWailordLastRelicanth: @ 82A6B99 - .byte 0 - .byte 0 - .byte 29 - .byte 19 - .byte 3 - .byte 3 + brailleformat 0, 0, 29, 19, 3, 3 .braille "FIRST COMES\n" .braille "WAILORD.\n" .braille "LAST COMES\n" .braille "RELICANTH.$" SealedChamber_InnerRoom_Braille_InThisCaveWeHaveLived: @ 82A6BCA - .byte 2 - .byte 0 - .byte 26 - .byte 19 - .byte 5 - .byte 3 + brailleformat 2, 0, 26, 19, 5, 3 .braille "IN THIS\n" .braille "CAVE WE\n" .braille "HAVE\n" .braille "LIVED.$" SealedChamber_InnerRoom_Braille_WeOweAllToThePokemon: @ 82A6BEC - .byte 7 - .byte 2 - .byte 23 - .byte 17 - .byte 10 - .byte 5 + brailleformat 7, 2, 23, 17, 10, 5 .braille "WE OWE ALL\n" .braille "TO THE\n" .braille "POKEMON.$" SealedChamber_InnerRoom_Braille_ButWeSealedThePokemonAway: @ 82A6C0D - .byte 3 - .byte 0 - .byte 25 - .byte 19 - .byte 6 - .byte 3 + brailleformat 3, 0, 25, 19, 6, 3 .braille "BUT, WE\n" .braille "SEALED THE\n" .braille "POKEMON\n" .braille "AWAY.$" SealedChamber_InnerRoom_Braille_WeFearedIt: @ 82A6C34 - .byte 5 - .byte 6 - .byte 25 - .byte 13 - .byte 8 - .byte 9 + brailleformat 5, 6, 25, 13, 8, 9 .braille "WE FEARED IT.$" SealedChamber_InnerRoom_Braille_ThoseWithCourageHope: @ 82A6C48 - .byte 6 - .byte 0 - .byte 24 - .byte 19 - .byte 9 - .byte 3 + brailleformat 6, 0, 24, 19, 9, 3 .braille "THOSE WITH\n" .braille "COURAGE,\n" .braille "THOSE WITH\n" .braille "HOPE.$" SealedChamber_InnerRoom_Braille_OpenDoorEternalPokemonWaits: @ 82A6C73 - .byte 3 - .byte 2 - .byte 27 - .byte 17 - .byte 6 - .byte 5 + brailleformat 3, 2, 27, 17, 6, 5 .braille "OPEN A DOOR.\n" .braille "AN ETERNAL\n" .braille "POKEMON\n" .braille "WAITS.$" DesertRuins_Braille_UseRockSmash: @ 82A6CA0 - .byte 1 - .byte 0 - .byte 27 - .byte 19 - .byte 4 - .byte 3 + brailleformat 1, 0, 27, 19, 4, 3 .braille "LEFT, LEFT,\n" .braille "DOWN, DOWN.\n" .braille "THEN, USE\n" .braille "ROCK SMASH.$" IslandCave_Braille_RunLapAroundWall: @ 82A6CD4 - .byte 5 - .byte 0 - .byte 25 - .byte 19 - .byte 8 - .byte 3 + brailleformat 5, 0, 25, 19, 8, 3 .braille "STAY CLOSE\n" .braille "TO THE WALL.\n" .braille "RUN AROUND\n" .braille "ONE LAP.$" AncientTomb_Braille_ShineInTheMiddle: @ 82A6D06 - .byte 3 - .byte 0 - .byte 25 - .byte 19 - .byte 6 - .byte 3 + brailleformat 3, 0, 25, 19, 6, 3 .braille "THOSE WHO\n" .braille "INHERIT OUR\n" .braille "WILL, SHINE\n" diff --git a/data/text/contest_painting.inc b/data/text/contest_painting.inc index 2aa8c6a93..78ae80153 100644 --- a/data/text/contest_painting.inc +++ b/data/text/contest_painting.inc @@ -1,8 +1,9 @@ -gUnknown_0827EA0C:: @ 827EA0C +gContestPaintingCaption:: @ 827EA0C .string "{STR_VAR_1}\n" .string "{STR_VAR_2}'s {STR_VAR_3}$" -gUnknown_0827EA17:: @ 827EA17 +@ Unused +gContestPaintingContest:: @ 827EA17 .string "CONTEST$" gContestRankNormal:: diff --git a/data/text/tv.inc b/data/text/tv.inc index 6f678d824..444b37f17 100644 --- a/data/text/tv.inc +++ b/data/text/tv.inc @@ -1736,7 +1736,7 @@ gTVTrainerFanClubText11:: @ 08286B4F .string "FANS: {STR_VAR_2}!\p" .string "FANS: {STR_VAR_3}!$" -gTVCutiesText00:: @ 08286D8F +TVSpotTheCuties_Text_Intro:: @ 08286D8F .string "SPOT THE CUTIES!\n" .string "POKéMON IN RIBBONS!\p" .string "Hello, my sweet viewers!\p" @@ -1748,29 +1748,29 @@ gTVCutiesText00:: @ 08286D8F .string "Today's featured pretty POKéMON\n" .string "is {STR_VAR_1}'s {STR_VAR_2}.$" -gTVCutiesText01:: @ 08286E9D +TVSpotTheCuties_Text_RibbonsLow:: @ 08286E9D .string "The number of RIBBONS that\n" .string "{STR_VAR_2} wears is {STR_VAR_3}.\p" .string "It says a lot about how much\n" .string "{STR_VAR_1} adores the POKéMON.$" -gTVCutiesText02:: @ 08286EFC +TVSpotTheCuties_Text_RibbonsMid:: @ 08286EFC .string "{STR_VAR_2} wears an amazing\n" .string "{STR_VAR_3} RIBBONS!\p" .string "It speaks volumes about {STR_VAR_1}'s\n" .string "commitment to the POKéMON!$" -gTVCutiesText03:: @ 08286F54 +TVSpotTheCuties_Text_RibbonsHigh:: @ 08286F54 .string "{STR_VAR_2} wears an incredible\n" .string "{STR_VAR_3} RIBBONS!\p" .string "It shows you {STR_VAR_1}'s total\n" .string "dedication as a collector!$" -gTVCutiesText04:: @ 08286FAA +TVSpotTheCuties_Text_RibbonIntro:: @ 08286FAA .string "Let us take a closer look at the many\n" .string "RIBBONS worn by {STR_VAR_2}.$" -gTVCutiesText05:: @ 08286FE4 +TVSpotTheCuties_Text_RibbonChampion:: @ 08286FE4 .string "The CHAMPION RIBBON is especially\n" .string "fetching.\p" .string "{STR_VAR_2} received it upon entering\n" @@ -1780,7 +1780,7 @@ gTVCutiesText05:: @ 08286FE4 .string "{STR_VAR_2} and the CHAMP RIBBON!\n" .string "The combination is super effective!$" -gTVCutiesText06:: @ 082870A3 +TVSpotTheCuties_Text_RibbonCool:: @ 082870A3 .string "The COOL RIBBON is especially\n" .string "fetching.\p" .string "{STR_VAR_2} received it for winning\n" @@ -1790,7 +1790,7 @@ gTVCutiesText06:: @ 082870A3 .string "{STR_VAR_2} and the COOL RIBBON!\n" .string "The combination is super effective!$" -gTVCutiesText07:: @ 0828715A +TVSpotTheCuties_Text_RibbonBeauty:: @ 0828715A .string "The BEAUTY RIBBON is especially\n" .string "fetching.\p" .string "{STR_VAR_2} received it for winning\n" @@ -1800,7 +1800,7 @@ gTVCutiesText07:: @ 0828715A .string "{STR_VAR_2} and the BEAUTY RIBBON!\n" .string "The combination is super effective!$" -gTVCutiesText08:: @ 08287215 +TVSpotTheCuties_Text_RibbonCute:: @ 08287215 .string "The CUTE RIBBON is especially\n" .string "fetching.\p" .string "{STR_VAR_2} received it for winning\n" @@ -1810,7 +1810,7 @@ gTVCutiesText08:: @ 08287215 .string "{STR_VAR_2} and the CUTE RIBBON!\n" .string "The combination is super effective!$" -gTVCutiesText09:: @ 082872CC +TVSpotTheCuties_Text_RibbonSmart:: @ 082872CC .string "The SMART RIBBON is especially\n" .string "fetching.\p" .string "{STR_VAR_2} received it for winning\n" @@ -1820,7 +1820,7 @@ gTVCutiesText09:: @ 082872CC .string "{STR_VAR_2} and the SMART RIBBON!\n" .string "The combination is super effective!$" -gTVCutiesText10:: @ 08287387 +TVSpotTheCuties_Text_RibbonTough:: @ 08287387 .string "The TOUGH RIBBON is especially\n" .string "fetching.\p" .string "{STR_VAR_2} received it for winning\n" @@ -1830,7 +1830,7 @@ gTVCutiesText10:: @ 08287387 .string "{STR_VAR_2} and the TOUGH RIBBON!\n" .string "The combination is super effective!$" -gTVCutiesText11:: @ 08287442 +TVSpotTheCuties_Text_RibbonWinning:: @ 08287442 .string "The WINNING RIBBON is especially\n" .string "fetching.\p" .string "{STR_VAR_2} received it for its feats\n" @@ -1840,7 +1840,7 @@ gTVCutiesText11:: @ 08287442 .string "{STR_VAR_2} and the WINNING RIBBON!\n" .string "The combination is super effective!$" -gTVCutiesText12:: @ 08287508 +TVSpotTheCuties_Text_RibbonVictory:: @ 08287508 .string "The VICTORY RIBBON is especially\n" .string "fetching.\p" .string "{STR_VAR_2} received it for its feats\n" @@ -1850,7 +1850,7 @@ gTVCutiesText12:: @ 08287508 .string "{STR_VAR_2} and the VICTORY RIBBON!\n" .string "The combination is super effective!$" -gTVCutiesText13:: @ 082875D9 +TVSpotTheCuties_Text_RibbonArtist:: @ 082875D9 .string "The ARTIST RIBBON is especially\n" .string "fetching.\p" .string "{STR_VAR_2} received it for being\n" @@ -1860,7 +1860,7 @@ gTVCutiesText13:: @ 082875D9 .string "{STR_VAR_2} and the ARTIST RIBBON!\n" .string "The combination is super effective!$" -gTVCutiesText14:: @ 082876A1 +TVSpotTheCuties_Text_RibbonEffort:: @ 082876A1 .string "The Hard Worker RIBBON is\n" .string "especially fetching.\p" .string "{STR_VAR_2} received it for being\n" @@ -1870,7 +1870,7 @@ gTVCutiesText14:: @ 082876A1 .string "{STR_VAR_2} and the Hard Worker RIBBON!\n" .string "The combination is super effective!$" -gTVCutiesText15:: @ 08287779 +TVSpotTheCuties_Text_Outro:: @ 08287779 .string "…Sigh…\p" .string "RIBBONS and POKéMON…\n" .string "They go so wonderfully together!\p" diff --git a/gflib/bg.c b/gflib/bg.c index 66dd81a25..3c215c103 100644 --- a/gflib/bg.c +++ b/gflib/bg.c @@ -9,20 +9,20 @@ struct BgControl { struct BgConfig { - u16 visible:1; - u16 unknown_1:1; - u16 screenSize:2; - u16 priority:2; - u16 mosaic:1; - u16 wraparound:1; + u8 visible:1; + u8 unknown_1:1; + u8 screenSize:2; + u8 priority:2; + u8 mosaic:1; + u8 wraparound:1; - u16 charBaseIndex:2; - u16 mapBaseIndex:5; - u16 paletteMode:1; + u8 charBaseIndex:2; + u8 mapBaseIndex:5; + u8 paletteMode:1; - u8 unknown_2; - u8 unknown_3; - } configs[4]; + u8 unknown_2; // Assigned to but never read + u8 unknown_3; // Assigned to but never read + } configs[NUM_BACKGROUNDS]; u16 bgVisibilityAndMode; }; @@ -39,8 +39,8 @@ struct BgConfig2 }; static struct BgControl sGpuBgConfigs; -static struct BgConfig2 sGpuBgConfigs2[4]; -static u32 sDmaBusyBitfield[4]; +static struct BgConfig2 sGpuBgConfigs2[NUM_BACKGROUNDS]; +static u32 sDmaBusyBitfield[NUM_BACKGROUNDS]; u32 gUnneededFireRedVariable; @@ -70,7 +70,7 @@ void ResetBgControlStructs(void) struct BgConfig zeroedConfig = sZeroedBgControlStruct; int i; - for (i = 0; i < 4; i++) + for (i = 0; i < NUM_BACKGROUNDS; i++) { bgConfigs[i] = zeroedConfig; } @@ -102,17 +102,17 @@ static void SetBgControlAttributes(u8 bg, u8 charBaseIndex, u8 mapBaseIndex, u8 { if (charBaseIndex != 0xFF) { - sGpuBgConfigs.configs[bg].charBaseIndex = charBaseIndex & 0x3; + sGpuBgConfigs.configs[bg].charBaseIndex = charBaseIndex; } if (mapBaseIndex != 0xFF) { - sGpuBgConfigs.configs[bg].mapBaseIndex = mapBaseIndex & 0x1F; + sGpuBgConfigs.configs[bg].mapBaseIndex = mapBaseIndex; } if (screenSize != 0xFF) { - sGpuBgConfigs.configs[bg].screenSize = screenSize & 0x3; + sGpuBgConfigs.configs[bg].screenSize = screenSize; } if (paletteMode != 0xFF) @@ -122,12 +122,12 @@ static void SetBgControlAttributes(u8 bg, u8 charBaseIndex, u8 mapBaseIndex, u8 if (priority != 0xFF) { - sGpuBgConfigs.configs[bg].priority = priority & 0x3; + sGpuBgConfigs.configs[bg].priority = priority; } if (mosaic != 0xFF) { - sGpuBgConfigs.configs[bg].mosaic = mosaic & 0x1; + sGpuBgConfigs.configs[bg].mosaic = mosaic; } if (wraparound != 0xFF) @@ -259,7 +259,7 @@ static void SetBgAffineInternal(u8 bg, s32 srcCenterX, s32 srcCenterY, s16 dispC return; break; case 2: - if (bg < 2 || bg > 3) + if (bg < 2 || bg >= NUM_BACKGROUNDS) return; break; case 0: @@ -290,7 +290,7 @@ static void SetBgAffineInternal(u8 bg, s32 srcCenterX, s32 srcCenterY, s16 dispC bool8 IsInvalidBg(u8 bg) { - if (bg > 3) + if (bg >= NUM_BACKGROUNDS) return TRUE; else return FALSE; @@ -306,7 +306,7 @@ void ResetBgsAndClearDma3BusyFlags(u32 leftoverFireRedLeafGreenVariable) int i; ResetBgs(); - for (i = 0; i < 4; i++) + for (i = 0; i < NUM_BACKGROUNDS; i++) { sDmaBusyBitfield[i] = 0; } @@ -325,7 +325,7 @@ void InitBgsFromTemplates(u8 bgMode, const struct BgTemplate *templates, u8 numT for (i = 0; i < numTemplates; i++) { bg = templates[i].bg; - if (bg < 4) + if (bg < NUM_BACKGROUNDS) { SetBgControlAttributes(bg, templates[i].charBaseIndex, @@ -351,7 +351,7 @@ void InitBgFromTemplate(const struct BgTemplate *template) { u8 bg = template->bg; - if (bg < 4) + if (bg < NUM_BACKGROUNDS) { SetBgControlAttributes(bg, template->charBaseIndex, @@ -1239,7 +1239,7 @@ u32 GetBgType(u8 bg) bool32 IsInvalidBg32(u8 bg) { - if (bg > 3) + if (bg >= NUM_BACKGROUNDS) return TRUE; else return FALSE; diff --git a/gflib/dma3_manager.c b/gflib/dma3_manager.c index 43744883f..d774efe8c 100644 --- a/gflib/dma3_manager.c +++ b/gflib/dma3_manager.c @@ -8,88 +8,90 @@ #define DMA_REQUEST_COPY16 3 #define DMA_REQUEST_FILL16 4 -BSS_DATA struct +struct Dma3Request { const u8 *src; u8 *dest; u16 size; u16 mode; u32 value; -} gDma3Requests[MAX_DMA_REQUESTS]; +}; -static volatile bool8 gDma3ManagerLocked; -static u8 gDma3RequestCursor; +static struct Dma3Request sDma3Requests[MAX_DMA_REQUESTS]; + +static vbool8 sDma3ManagerLocked; +static u8 sDma3RequestCursor; void ClearDma3Requests(void) { int i; - gDma3ManagerLocked = TRUE; - gDma3RequestCursor = 0; + sDma3ManagerLocked = TRUE; + sDma3RequestCursor = 0; for (i = 0; i < MAX_DMA_REQUESTS; i++) { - gDma3Requests[i].size = 0; - gDma3Requests[i].src = NULL; - gDma3Requests[i].dest = NULL; + sDma3Requests[i].size = 0; + sDma3Requests[i].src = NULL; + sDma3Requests[i].dest = NULL; } - gDma3ManagerLocked = FALSE; + sDma3ManagerLocked = FALSE; } void ProcessDma3Requests(void) { u16 bytesTransferred; - if (gDma3ManagerLocked) + if (sDma3ManagerLocked) return; bytesTransferred = 0; // as long as there are DMA requests to process (unless size or vblank is an issue), do not exit - while (gDma3Requests[gDma3RequestCursor].size != 0) + while (sDma3Requests[sDma3RequestCursor].size != 0) { - bytesTransferred += gDma3Requests[gDma3RequestCursor].size; + bytesTransferred += sDma3Requests[sDma3RequestCursor].size; if (bytesTransferred > 40 * 1024) return; // don't transfer more than 40 KiB if (*(u8 *)REG_ADDR_VCOUNT > 224) return; // we're about to leave vblank, stop - switch (gDma3Requests[gDma3RequestCursor].mode) + switch (sDma3Requests[sDma3RequestCursor].mode) { case DMA_REQUEST_COPY32: // regular 32-bit copy - Dma3CopyLarge32_(gDma3Requests[gDma3RequestCursor].src, - gDma3Requests[gDma3RequestCursor].dest, - gDma3Requests[gDma3RequestCursor].size); + Dma3CopyLarge32_(sDma3Requests[sDma3RequestCursor].src, + sDma3Requests[sDma3RequestCursor].dest, + sDma3Requests[sDma3RequestCursor].size); break; case DMA_REQUEST_FILL32: // repeat a single 32-bit value across RAM - Dma3FillLarge32_(gDma3Requests[gDma3RequestCursor].value, - gDma3Requests[gDma3RequestCursor].dest, - gDma3Requests[gDma3RequestCursor].size); + Dma3FillLarge32_(sDma3Requests[sDma3RequestCursor].value, + sDma3Requests[sDma3RequestCursor].dest, + sDma3Requests[sDma3RequestCursor].size); break; case DMA_REQUEST_COPY16: // regular 16-bit copy - Dma3CopyLarge16_(gDma3Requests[gDma3RequestCursor].src, - gDma3Requests[gDma3RequestCursor].dest, - gDma3Requests[gDma3RequestCursor].size); + Dma3CopyLarge16_(sDma3Requests[sDma3RequestCursor].src, + sDma3Requests[sDma3RequestCursor].dest, + sDma3Requests[sDma3RequestCursor].size); break; case DMA_REQUEST_FILL16: // repeat a single 16-bit value across RAM - Dma3FillLarge16_(gDma3Requests[gDma3RequestCursor].value, - gDma3Requests[gDma3RequestCursor].dest, - gDma3Requests[gDma3RequestCursor].size); + Dma3FillLarge16_(sDma3Requests[sDma3RequestCursor].value, + sDma3Requests[sDma3RequestCursor].dest, + sDma3Requests[sDma3RequestCursor].size); break; } // Free the request - gDma3Requests[gDma3RequestCursor].src = NULL; - gDma3Requests[gDma3RequestCursor].dest = NULL; - gDma3Requests[gDma3RequestCursor].size = 0; - gDma3Requests[gDma3RequestCursor].mode = 0; - gDma3Requests[gDma3RequestCursor].value = 0; - gDma3RequestCursor++; + sDma3Requests[sDma3RequestCursor].src = NULL; + sDma3Requests[sDma3RequestCursor].dest = NULL; + sDma3Requests[sDma3RequestCursor].size = 0; + sDma3Requests[sDma3RequestCursor].mode = 0; + sDma3Requests[sDma3RequestCursor].value = 0; + sDma3RequestCursor++; - if (gDma3RequestCursor >= MAX_DMA_REQUESTS) // loop back to the first DMA request - gDma3RequestCursor = 0; + if (sDma3RequestCursor >= MAX_DMA_REQUESTS) // loop back to the first DMA request + sDma3RequestCursor = 0; } } @@ -98,30 +100,30 @@ s16 RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode) int cursor; int i = 0; - gDma3ManagerLocked = TRUE; - cursor = gDma3RequestCursor; + sDma3ManagerLocked = TRUE; + cursor = sDma3RequestCursor; while (i < MAX_DMA_REQUESTS) { - if (gDma3Requests[cursor].size == 0) // an empty request was found. + if (sDma3Requests[cursor].size == 0) // an empty request was found. { - gDma3Requests[cursor].src = src; - gDma3Requests[cursor].dest = dest; - gDma3Requests[cursor].size = size; + sDma3Requests[cursor].src = src; + sDma3Requests[cursor].dest = dest; + sDma3Requests[cursor].size = size; if (mode == 1) - gDma3Requests[cursor].mode = DMA_REQUEST_COPY32; + sDma3Requests[cursor].mode = DMA_REQUEST_COPY32; else - gDma3Requests[cursor].mode = DMA_REQUEST_COPY16; + sDma3Requests[cursor].mode = DMA_REQUEST_COPY16; - gDma3ManagerLocked = FALSE; + sDma3ManagerLocked = FALSE; return cursor; } if (++cursor >= MAX_DMA_REQUESTS) // loop back to start. cursor = 0; i++; } - gDma3ManagerLocked = FALSE; + sDma3ManagerLocked = FALSE; return -1; // no free DMA request was found } @@ -130,31 +132,31 @@ s16 RequestDma3Fill(s32 value, void *dest, u16 size, u8 mode) int cursor; int i = 0; - cursor = gDma3RequestCursor; - gDma3ManagerLocked = TRUE; + cursor = sDma3RequestCursor; + sDma3ManagerLocked = TRUE; while (i < MAX_DMA_REQUESTS) { - if (gDma3Requests[cursor].size == 0) // an empty request was found. + if (sDma3Requests[cursor].size == 0) // an empty request was found. { - gDma3Requests[cursor].dest = dest; - gDma3Requests[cursor].size = size; - gDma3Requests[cursor].mode = mode; - gDma3Requests[cursor].value = value; + sDma3Requests[cursor].dest = dest; + sDma3Requests[cursor].size = size; + sDma3Requests[cursor].mode = mode; + sDma3Requests[cursor].value = value; if(mode == 1) - gDma3Requests[cursor].mode = DMA_REQUEST_FILL32; + sDma3Requests[cursor].mode = DMA_REQUEST_FILL32; else - gDma3Requests[cursor].mode = DMA_REQUEST_FILL16; + sDma3Requests[cursor].mode = DMA_REQUEST_FILL16; - gDma3ManagerLocked = FALSE; + sDma3ManagerLocked = FALSE; return cursor; } if (++cursor >= MAX_DMA_REQUESTS) // loop back to start. cursor = 0; i++; } - gDma3ManagerLocked = FALSE; + sDma3ManagerLocked = FALSE; return -1; // no free DMA request was found } @@ -166,7 +168,7 @@ s16 CheckForSpaceForDma3Request(s16 index) { while (i < MAX_DMA_REQUESTS) { - if (gDma3Requests[i].size != 0) + if (sDma3Requests[i].size != 0) return -1; i++; } @@ -174,7 +176,7 @@ s16 CheckForSpaceForDma3Request(s16 index) } else // check the specified request { - if (gDma3Requests[index].size != 0) + if (sDma3Requests[index].size != 0) return -1; return 0; } diff --git a/gflib/sprite.c b/gflib/sprite.c index 2616aeaed..c66b1e47d 100644 --- a/gflib/sprite.c +++ b/gflib/sprite.c @@ -33,6 +33,12 @@ struct SpriteCopyRequest u16 size; }; +struct OamDimensions32 +{ + s32 width; + s32 height; +}; + struct OamDimensions { s8 width; @@ -240,25 +246,28 @@ static const AffineAnimCmdFunc sAffineAnimCmdFuncs[] = AffineAnimCmd_frame, }; -static const s32 sUnknown_082EC6F4[3][4][2] = +static const struct OamDimensions32 sOamDimensions32[3][4] = { + [ST_OAM_SQUARE] = { - {8, 8}, - {0x10, 0x10}, - {0x20, 0x20}, - {0x40, 0x40}, + [SPRITE_SIZE(8x8)] = { 8, 8 }, + [SPRITE_SIZE(16x16)] = { 16, 16 }, + [SPRITE_SIZE(32x32)] = { 32, 32 }, + [SPRITE_SIZE(64x64)] = { 64, 64 }, }, + [ST_OAM_H_RECTANGLE] = { - {0x10, 8}, - {0x20, 8}, - {0x20, 0x10}, - {0x40, 0x20}, + [SPRITE_SIZE(16x8)] = { 16, 8 }, + [SPRITE_SIZE(32x8)] = { 32, 8 }, + [SPRITE_SIZE(32x16)] = { 32, 16 }, + [SPRITE_SIZE(64x32)] = { 64, 32 }, }, + [ST_OAM_V_RECTANGLE] = { - {8, 0x10}, - {8, 0x20}, - {0x10, 0x20}, - {0x20, 0x40}, + [SPRITE_SIZE(8x16)] = { 8, 16 }, + [SPRITE_SIZE(8x32)] = { 8, 32 }, + [SPRITE_SIZE(16x32)] = { 16, 32 }, + [SPRITE_SIZE(32x64)] = { 32, 64 }, }, }; @@ -1233,14 +1242,14 @@ void obj_update_pos2(struct Sprite *sprite, s32 a1, s32 a2) u32 matrixNum = sprite->oam.matrixNum; if (a1 != 0x800) { - var0 = sUnknown_082EC6F4[sprite->oam.shape][sprite->oam.size][0]; + var0 = sOamDimensions32[sprite->oam.shape][sprite->oam.size].width; var1 = var0 << 8; var2 = (var0 << 16) / gOamMatrices[matrixNum].a; sprite->pos2.x = sub_8007E28(var1, var2, a1); } if (a2 != 0x800) { - var0 = sUnknown_082EC6F4[sprite->oam.shape][sprite->oam.size][1]; + var0 = sOamDimensions32[sprite->oam.shape][sprite->oam.size].height; var1 = var0 << 8; var2 = (var0 << 16) / gOamMatrices[matrixNum].d; sprite->pos2.y = sub_8007E28(var1, var2, a2); @@ -1320,12 +1329,7 @@ void ApplyAffineAnimFrameRelativeAndUpdateMatrix(u8 matrixNum, struct AffineAnim s16 ConvertScaleParam(s16 scale) { s32 val = 0x10000; - // UB: possible division by zero -#ifdef UBFIX - if (scale == 0) - return 0; -#endif //UBFIX - return val / scale; + return SAFE_DIV(val, scale); } void GetAffineAnimFrame(u8 matrixNum, struct Sprite *sprite, struct AffineAnimFrameCmd *frameCmd) diff --git a/gflib/sprite.h b/gflib/sprite.h index c9ba9585d..4a3b48225 100644 --- a/gflib/sprite.h +++ b/gflib/sprite.h @@ -2,6 +2,7 @@ #define GUARD_SPRITE_H #define MAX_SPRITES 64 +#define SPRITE_NONE 0xFF #define SPRITE_INVALID_TAG 0xFFFF struct SpriteSheet diff --git a/gflib/window.c b/gflib/window.c index 7c87ea86d..b03b513da 100644 --- a/gflib/window.c +++ b/gflib/window.c @@ -4,12 +4,12 @@ #include "bg.h" #include "blit.h" -u32 filler_03002F58; -u32 filler_03002F5C; +u32 gUnusedWindowVar1; +u32 gUnusedWindowVar2; // This global is set to 0 and never changed. u8 gTransparentTileNumber; -u32 filler_03002F64; -void *gUnknown_03002F70[4]; +u32 gUnusedWindowVar3; +void *gWindowBgTilemapBuffers[NUM_BACKGROUNDS]; extern u32 gUnneededFireRedVariable; #define WINDOWS_MAX 32 @@ -23,7 +23,7 @@ static u8 GetNumActiveWindowsOnBg8Bit(u8 bgId); static const struct WindowTemplate sDummyWindowTemplate = DUMMY_WIN_TEMPLATE; -static void nullsub_8(void) +static void DummyWindowBgTilemap(void) { } @@ -38,22 +38,22 @@ bool16 InitWindows(const struct WindowTemplate *templates) u8* allocatedTilemapBuffer; int allocatedBaseBlock; - for (i = 0; i < 0x4; ++i) + for (i = 0; i < NUM_BACKGROUNDS; ++i) { bgTilemapBuffer = GetBgTilemapBuffer(i); if (bgTilemapBuffer != NULL) - gUnknown_03002F70[i] = nullsub_8; + gWindowBgTilemapBuffers[i] = DummyWindowBgTilemap; else - gUnknown_03002F70[i] = bgTilemapBuffer; + gWindowBgTilemapBuffers[i] = bgTilemapBuffer; } - for (i = 0; i < 0x20; ++i) + for (i = 0; i < WINDOWS_MAX; ++i) { gWindows[i].window = sDummyWindowTemplate; gWindows[i].tileData = NULL; } - for (i = 0, allocatedBaseBlock = 0, bgLayer = templates[i].bg; bgLayer != 0xFF && i < 0x20; ++i, bgLayer = templates[i].bg) + for (i = 0, allocatedBaseBlock = 0, bgLayer = templates[i].bg; bgLayer != 0xFF && i < WINDOWS_MAX; ++i, bgLayer = templates[i].bg) { if (gUnneededFireRedVariable == 1) { @@ -62,7 +62,7 @@ bool16 InitWindows(const struct WindowTemplate *templates) return FALSE; } - if (gUnknown_03002F70[bgLayer] == NULL) + if (gWindowBgTilemapBuffers[bgLayer] == NULL) { attrib = GetBgAttribute(bgLayer, BG_ATTR_METRIC); @@ -79,19 +79,19 @@ bool16 InitWindows(const struct WindowTemplate *templates) for (j = 0; j < attrib; ++j) allocatedTilemapBuffer[j] = 0; - gUnknown_03002F70[bgLayer] = allocatedTilemapBuffer; + gWindowBgTilemapBuffers[bgLayer] = allocatedTilemapBuffer; SetBgTilemapBuffer(bgLayer, allocatedTilemapBuffer); } } - allocatedTilemapBuffer = AllocZeroed((u16)(0x20 * (templates[i].width * templates[i].height))); + allocatedTilemapBuffer = AllocZeroed((u16)(32 * (templates[i].width * templates[i].height))); if (allocatedTilemapBuffer == NULL) { - if ((GetNumActiveWindowsOnBg(bgLayer) == 0) && (gUnknown_03002F70[bgLayer] != nullsub_8)) + if ((GetNumActiveWindowsOnBg(bgLayer) == 0) && (gWindowBgTilemapBuffers[bgLayer] != DummyWindowBgTilemap)) { - Free(gUnknown_03002F70[bgLayer]); - gUnknown_03002F70[bgLayer] = allocatedTilemapBuffer; + Free(gWindowBgTilemapBuffers[bgLayer]); + gWindowBgTilemapBuffers[bgLayer] = allocatedTilemapBuffer; } return FALSE; @@ -127,7 +127,7 @@ u16 AddWindow(const struct WindowTemplate *template) } if (win == WINDOWS_MAX) - return 0xFF; + return WINDOW_NONE; bgLayer = template->bg; allocatedBaseBlock = 0; @@ -137,10 +137,10 @@ u16 AddWindow(const struct WindowTemplate *template) allocatedBaseBlock = DummiedOutFireRedLeafGreenTileAllocFunc(bgLayer, 0, template->width * template->height, 0); if (allocatedBaseBlock == -1) - return 0xFF; + return WINDOW_NONE; } - if (gUnknown_03002F70[bgLayer] == NULL) + if (gWindowBgTilemapBuffers[bgLayer] == NULL) { attrib = GetBgAttribute(bgLayer, BG_ATTR_METRIC); @@ -149,26 +149,26 @@ u16 AddWindow(const struct WindowTemplate *template) allocatedTilemapBuffer = AllocZeroed(attrib); if (allocatedTilemapBuffer == NULL) - return 0xFF; + return WINDOW_NONE; for (i = 0; i < attrib; ++i) allocatedTilemapBuffer[i] = 0; - gUnknown_03002F70[bgLayer] = allocatedTilemapBuffer; + gWindowBgTilemapBuffers[bgLayer] = allocatedTilemapBuffer; SetBgTilemapBuffer(bgLayer, allocatedTilemapBuffer); } } - allocatedTilemapBuffer = AllocZeroed((u16)(0x20 * (template->width * template->height))); + allocatedTilemapBuffer = AllocZeroed((u16)(32 * (template->width * template->height))); if (allocatedTilemapBuffer == NULL) { - if ((GetNumActiveWindowsOnBg(bgLayer) == 0) && (gUnknown_03002F70[bgLayer] != nullsub_8)) + if ((GetNumActiveWindowsOnBg(bgLayer) == 0) && (gWindowBgTilemapBuffers[bgLayer] != DummyWindowBgTilemap)) { - Free(gUnknown_03002F70[bgLayer]); - gUnknown_03002F70[bgLayer] = allocatedTilemapBuffer; + Free(gWindowBgTilemapBuffers[bgLayer]); + gWindowBgTilemapBuffers[bgLayer] = allocatedTilemapBuffer; } - return 0xFF; + return WINDOW_NONE; } gWindows[win].tileData = allocatedTilemapBuffer; @@ -196,7 +196,7 @@ int AddWindowWithoutTileMap(const struct WindowTemplate *template) } if (win == WINDOWS_MAX) - return 0xFF; + return WINDOW_NONE; bgLayer = template->bg; allocatedBaseBlock = 0; @@ -206,7 +206,7 @@ int AddWindowWithoutTileMap(const struct WindowTemplate *template) allocatedBaseBlock = DummiedOutFireRedLeafGreenTileAllocFunc(bgLayer, 0, template->width * template->height, 0); if (allocatedBaseBlock == -1) - return 0xFF; + return WINDOW_NONE; } gWindows[win].window = *template; @@ -233,10 +233,10 @@ void RemoveWindow(u8 windowId) if (GetNumActiveWindowsOnBg(bgLayer) == 0) { - if (gUnknown_03002F70[bgLayer] != nullsub_8) + if (gWindowBgTilemapBuffers[bgLayer] != DummyWindowBgTilemap) { - Free(gUnknown_03002F70[bgLayer]); - gUnknown_03002F70[bgLayer] = 0; + Free(gWindowBgTilemapBuffers[bgLayer]); + gWindowBgTilemapBuffers[bgLayer] = NULL; } } @@ -251,16 +251,16 @@ void FreeAllWindowBuffers(void) { int i; - for (i = 0; i < 4; ++i) + for (i = 0; i < NUM_BACKGROUNDS; ++i) { - if (gUnknown_03002F70[i] != NULL && gUnknown_03002F70[i] != nullsub_8) + if (gWindowBgTilemapBuffers[i] != NULL && gWindowBgTilemapBuffers[i] != DummyWindowBgTilemap) { - Free(gUnknown_03002F70[i]); - gUnknown_03002F70[i] = NULL; + Free(gWindowBgTilemapBuffers[i]); + gWindowBgTilemapBuffers[i] = NULL; } } - for (i = 0; i < 0x20; ++i) + for (i = 0; i < WINDOWS_MAX; ++i) { if (gWindows[i].tileData != NULL) { @@ -448,16 +448,16 @@ void FillWindowPixelRect(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 void CopyToWindowPixelBuffer(u8 windowId, const void *src, u16 size, u16 tileOffset) { if (size != 0) - CpuCopy16(src, gWindows[windowId].tileData + (0x20 * tileOffset), size); + CpuCopy16(src, gWindows[windowId].tileData + (32 * tileOffset), size); else - LZ77UnCompWram(src, gWindows[windowId].tileData + (0x20 * tileOffset)); + LZ77UnCompWram(src, gWindows[windowId].tileData + (32 * tileOffset)); } // Sets all pixels within the window to the fillValue color. void FillWindowPixelBuffer(u8 windowId, u8 fillValue) { int fillSize = gWindows[windowId].window.width * gWindows[windowId].window.height; - CpuFastFill8(fillValue, gWindows[windowId].tileData, 0x20 * fillSize); + CpuFastFill8(fillValue, gWindows[windowId].tileData, 32 * fillSize); } #define MOVE_TILES_DOWN(a) \ @@ -599,7 +599,7 @@ static u8 GetNumActiveWindowsOnBg(u8 bgId) return windowsNum; } -static void nullsub_9(void) +static void DummyWindowBgTilemap8Bit(void) { } @@ -610,15 +610,15 @@ u16 AddWindow8Bit(const struct WindowTemplate *template) u8* memAddress; u8 bgLayer; - for (windowId = 0; windowId < 32; windowId++) + for (windowId = 0; windowId < WINDOWS_MAX; windowId++) { if (gWindows[windowId].window.bg == 0xFF) break; } if (windowId == WINDOWS_MAX) - return 0xFF; + return WINDOW_NONE; bgLayer = template->bg; - if (gUnknown_03002F70[bgLayer] == 0) + if (gWindowBgTilemapBuffers[bgLayer] == NULL) { u16 attribute = GetBgAttribute(bgLayer, BG_ATTR_METRIC); if (attribute != 0xFFFF) @@ -626,22 +626,22 @@ u16 AddWindow8Bit(const struct WindowTemplate *template) s32 i; memAddress = Alloc(attribute); if (memAddress == NULL) - return 0xFF; + return WINDOW_NONE; for (i = 0; i < attribute; i++) // if we're going to zero out the memory anyway, why not call AllocZeroed? memAddress[i] = 0; - gUnknown_03002F70[bgLayer] = memAddress; + gWindowBgTilemapBuffers[bgLayer] = memAddress; SetBgTilemapBuffer(bgLayer, memAddress); } } - memAddress = Alloc((u16)(0x40 * (template->width * template->height))); + memAddress = Alloc((u16)(64 * (template->width * template->height))); if (memAddress == NULL) { - if (GetNumActiveWindowsOnBg8Bit(bgLayer) == 0 && gUnknown_03002F70[bgLayer] != nullsub_9) + if (GetNumActiveWindowsOnBg8Bit(bgLayer) == 0 && gWindowBgTilemapBuffers[bgLayer] != DummyWindowBgTilemap8Bit) { - Free(gUnknown_03002F70[bgLayer]); - gUnknown_03002F70[bgLayer] = NULL; + Free(gWindowBgTilemapBuffers[bgLayer]); + gWindowBgTilemapBuffers[bgLayer] = NULL; } - return 0xFF; + return WINDOW_NONE; } else { @@ -656,7 +656,7 @@ void FillWindowPixelBuffer8Bit(u8 windowId, u8 fillValue) s32 i; s32 size; - size = (u16)(0x40 * (gWindows[windowId].window.width * gWindows[windowId].window.height)); + size = (u16)(64 * (gWindows[windowId].window.width * gWindows[windowId].window.height)); for (i = 0; i < size; i++) gWindows[windowId].tileData[i] = fillValue; } @@ -691,7 +691,7 @@ void BlitBitmapRectToWindow4BitTo8Bit(u8 windowId, const u8 *pixels, u16 srcX, u void CopyWindowToVram8Bit(u8 windowId, u8 mode) { sWindowPtr = &gWindows[windowId]; - sWindowSize = 0x40 * (sWindowPtr->window.width * sWindowPtr->window.height); + sWindowSize = 64 * (sWindowPtr->window.width * sWindowPtr->window.height); switch (mode) { diff --git a/gflib/window.h b/gflib/window.h index 10e447789..3eac75a28 100644 --- a/gflib/window.h +++ b/gflib/window.h @@ -37,6 +37,8 @@ struct WindowTemplate 0, \ } +#define WINDOW_NONE 0xFF + struct Window { struct WindowTemplate window; @@ -70,9 +72,9 @@ void BlitBitmapRectToWindow4BitTo8Bit(u8 windowId, const u8 *pixels, u16 srcX, u void CopyWindowToVram8Bit(u8 windowId, u8 mode); extern struct Window gWindows[]; -extern void* gUnknown_03002F70[]; -extern u32 filler_03002F58; -extern u32 filler_03002F5C; -extern u32 filler_03002F64; +extern void* gWindowBgTilemapBuffers[]; +extern u32 gUnusedWindowVar1; +extern u32 gUnusedWindowVar2; +extern u32 gUnusedWindowVar3; #endif // GUARD_WINDOW_H diff --git a/graphics/battle_anims/masks/unknown_C2EA50.bin b/graphics/battle_anims/masks/unused_level_up.bin similarity index 100% rename from graphics/battle_anims/masks/unknown_C2EA50.bin rename to graphics/battle_anims/masks/unused_level_up.bin diff --git a/graphics/battle_anims/masks/unknown_C2EA50.png b/graphics/battle_anims/masks/unused_level_up.png similarity index 100% rename from graphics/battle_anims/masks/unknown_C2EA50.png rename to graphics/battle_anims/masks/unused_level_up.png diff --git a/graphics/link_games/dodrioberry_berrysprites.png b/graphics/dodrio_berry_picking/berries.png similarity index 100% rename from graphics/link_games/dodrioberry_berrysprites.png rename to graphics/dodrio_berry_picking/berries.png diff --git a/graphics/link_games/dodrioberry_bg1.bin b/graphics/dodrio_berry_picking/bg.bin similarity index 100% rename from graphics/link_games/dodrioberry_bg1.bin rename to graphics/dodrio_berry_picking/bg.bin diff --git a/graphics/link_games/dodrioberry_bg1.pal b/graphics/dodrio_berry_picking/bg.pal similarity index 100% rename from graphics/link_games/dodrioberry_bg1.pal rename to graphics/dodrio_berry_picking/bg.pal diff --git a/graphics/link_games/dodrioberry_bg1.png b/graphics/dodrio_berry_picking/bg.png similarity index 100% rename from graphics/link_games/dodrioberry_bg1.png rename to graphics/dodrio_berry_picking/bg.png diff --git a/graphics/link_games/dodrioberry_platform.png b/graphics/dodrio_berry_picking/cloud.png similarity index 100% rename from graphics/link_games/dodrioberry_platform.png rename to graphics/dodrio_berry_picking/cloud.png diff --git a/graphics/link_games/dodrioberry_pkmn.png b/graphics/dodrio_berry_picking/dodrio.png similarity index 100% rename from graphics/link_games/dodrioberry_pkmn.png rename to graphics/dodrio_berry_picking/dodrio.png diff --git a/graphics/link_games/dodrioberry_shiny.pal b/graphics/dodrio_berry_picking/shiny.pal similarity index 100% rename from graphics/link_games/dodrioberry_shiny.pal rename to graphics/dodrio_berry_picking/shiny.pal diff --git a/graphics/link_games/dodrioberry_status.png b/graphics/dodrio_berry_picking/status.png similarity index 100% rename from graphics/link_games/dodrioberry_status.png rename to graphics/dodrio_berry_picking/status.png diff --git a/graphics/link_games/dodrioberry_bg2.pal b/graphics/dodrio_berry_picking/tree_border.pal similarity index 100% rename from graphics/link_games/dodrioberry_bg2.pal rename to graphics/dodrio_berry_picking/tree_border.pal diff --git a/graphics/link_games/dodrioberry_bg2.png b/graphics/dodrio_berry_picking/tree_border.png similarity index 100% rename from graphics/link_games/dodrioberry_bg2.png rename to graphics/dodrio_berry_picking/tree_border.png diff --git a/graphics/link_games/dodrioberry_bg2left.bin b/graphics/dodrio_berry_picking/tree_border_left.bin similarity index 100% rename from graphics/link_games/dodrioberry_bg2left.bin rename to graphics/dodrio_berry_picking/tree_border_left.bin diff --git a/graphics/link_games/dodrioberry_bg2right.bin b/graphics/dodrio_berry_picking/tree_border_right.bin similarity index 100% rename from graphics/link_games/dodrioberry_bg2right.bin rename to graphics/dodrio_berry_picking/tree_border_right.bin diff --git a/graphics/easy_chat/rwindow.png b/graphics/easy_chat/button_window.png similarity index 100% rename from graphics/easy_chat/rwindow.png rename to graphics/easy_chat/button_window.png diff --git a/graphics/easy_chat/cursor.png b/graphics/easy_chat/rectangle_cursor.png similarity index 100% rename from graphics/easy_chat/cursor.png rename to graphics/easy_chat/rectangle_cursor.png diff --git a/graphics/misc/interview_frame_2.png b/graphics/easy_chat/text_input_frame.png similarity index 100% rename from graphics/misc/interview_frame_2.png rename to graphics/easy_chat/text_input_frame.png diff --git a/graphics/misc/interview_frame_green.pal b/graphics/easy_chat/text_input_frame_green.pal similarity index 100% rename from graphics/misc/interview_frame_green.pal rename to graphics/easy_chat/text_input_frame_green.pal diff --git a/graphics/misc/interview_frame_orange.pal b/graphics/easy_chat/text_input_frame_orange.pal similarity index 100% rename from graphics/misc/interview_frame_orange.pal rename to graphics/easy_chat/text_input_frame_orange.pal diff --git a/graphics/evolution_scene/transition.pal b/graphics/evolution_scene/bg_anim.pal similarity index 100% rename from graphics/evolution_scene/transition.pal rename to graphics/evolution_scene/bg_anim.pal diff --git a/graphics/evolution_scene/gray_transition_intro.pal b/graphics/evolution_scene/bg_anim_intro.pal similarity index 100% rename from graphics/evolution_scene/gray_transition_intro.pal rename to graphics/evolution_scene/bg_anim_intro.pal diff --git a/graphics/evolution_scene/bg.bin b/graphics/evolution_scene/bg_inner.bin similarity index 100% rename from graphics/evolution_scene/bg.bin rename to graphics/evolution_scene/bg_inner.bin diff --git a/graphics/evolution_scene/bg2.bin b/graphics/evolution_scene/bg_outer.bin similarity index 100% rename from graphics/evolution_scene/bg2.bin rename to graphics/evolution_scene/bg_outer.bin diff --git a/graphics/evolution_scene/unknown_5B4114.pal b/graphics/evolution_scene/unused_1.pal similarity index 100% rename from graphics/evolution_scene/unknown_5B4114.pal rename to graphics/evolution_scene/unused_1.pal diff --git a/graphics/evolution_scene/gray_transition_lighten.pal b/graphics/evolution_scene/unused_2.pal similarity index 100% rename from graphics/evolution_scene/gray_transition_lighten.pal rename to graphics/evolution_scene/unused_2.pal diff --git a/graphics/evolution_scene/gray_transition_darken.pal b/graphics/evolution_scene/unused_3.pal similarity index 100% rename from graphics/evolution_scene/gray_transition_darken.pal rename to graphics/evolution_scene/unused_3.pal diff --git a/graphics/evolution_scene/gray_transition_outro.pal b/graphics/evolution_scene/unused_4.pal similarity index 100% rename from graphics/evolution_scene/gray_transition_outro.pal rename to graphics/evolution_scene/unused_4.pal diff --git a/graphics/interface/blank_1x2.png b/graphics/interface/comm_error_bg.png similarity index 100% rename from graphics/interface/blank_1x2.png rename to graphics/interface/comm_error_bg.png diff --git a/graphics/link_games/321start_2.png b/graphics/link_games/321start_static.png similarity index 100% rename from graphics/link_games/321start_2.png rename to graphics/link_games/321start_static.png diff --git a/graphics/pokenav/condition/marker.png b/graphics/misc/mon_markings_menu.png similarity index 100% rename from graphics/pokenav/condition/marker.png rename to graphics/misc/mon_markings_menu.png diff --git a/graphics/link_games/pkmnjump_bg.bin b/graphics/pokemon_jump/bg.bin similarity index 100% rename from graphics/link_games/pkmnjump_bg.bin rename to graphics/pokemon_jump/bg.bin diff --git a/graphics/link_games/pkmnjump_bg.png b/graphics/pokemon_jump/bg.png similarity index 100% rename from graphics/link_games/pkmnjump_bg.png rename to graphics/pokemon_jump/bg.png diff --git a/graphics/link_games/pkmnjump_results.bin b/graphics/pokemon_jump/bonuses.bin similarity index 100% rename from graphics/link_games/pkmnjump_results.bin rename to graphics/pokemon_jump/bonuses.bin diff --git a/graphics/link_games/pkmnjump_results.png b/graphics/pokemon_jump/bonuses.png similarity index 100% rename from graphics/link_games/pkmnjump_results.png rename to graphics/pokemon_jump/bonuses.png diff --git a/graphics/link_games/pkmnjump_pal3.pal b/graphics/pokemon_jump/interface.pal similarity index 100% rename from graphics/link_games/pkmnjump_pal3.pal rename to graphics/pokemon_jump/interface.pal diff --git a/graphics/link_games/pkmnjump_pal1.pal b/graphics/pokemon_jump/pal1.pal similarity index 100% rename from graphics/link_games/pkmnjump_pal1.pal rename to graphics/pokemon_jump/pal1.pal diff --git a/graphics/link_games/pkmnjump_pal2.pal b/graphics/pokemon_jump/pal2.pal similarity index 100% rename from graphics/link_games/pkmnjump_pal2.pal rename to graphics/pokemon_jump/pal2.pal diff --git a/graphics/link_games/pkmnjump_star.png b/graphics/pokemon_jump/star.png similarity index 100% rename from graphics/link_games/pkmnjump_star.png rename to graphics/pokemon_jump/star.png diff --git a/graphics/link_games/pkmnjump_venusaur.bin b/graphics/pokemon_jump/venusaur.bin similarity index 100% rename from graphics/link_games/pkmnjump_venusaur.bin rename to graphics/pokemon_jump/venusaur.bin diff --git a/graphics/link_games/pkmnjump_venusaur.png b/graphics/pokemon_jump/venusaur.png similarity index 100% rename from graphics/link_games/pkmnjump_venusaur.png rename to graphics/pokemon_jump/venusaur.png diff --git a/graphics/link_games/pkmnjump_rope1.png b/graphics/pokemon_jump/vine1.png similarity index 100% rename from graphics/link_games/pkmnjump_rope1.png rename to graphics/pokemon_jump/vine1.png diff --git a/graphics/link_games/pkmnjump_rope2.png b/graphics/pokemon_jump/vine2.png similarity index 100% rename from graphics/link_games/pkmnjump_rope2.png rename to graphics/pokemon_jump/vine2.png diff --git a/graphics/link_games/pkmnjump_rope3.png b/graphics/pokemon_jump/vine3.png similarity index 100% rename from graphics/link_games/pkmnjump_rope3.png rename to graphics/pokemon_jump/vine3.png diff --git a/graphics/link_games/pkmnjump_rope4.png b/graphics/pokemon_jump/vine4.png similarity index 100% rename from graphics/link_games/pkmnjump_rope4.png rename to graphics/pokemon_jump/vine4.png diff --git a/graphics/pokenav/ribbons_icon.png b/graphics/pokenav/ribbons/icons.png similarity index 100% rename from graphics/pokenav/ribbons_icon.png rename to graphics/pokenav/ribbons/icons.png diff --git a/graphics/pokenav/ribbons_icon1.pal b/graphics/pokenav/ribbons/icons1.pal similarity index 100% rename from graphics/pokenav/ribbons_icon1.pal rename to graphics/pokenav/ribbons/icons1.pal diff --git a/graphics/pokenav/ribbons_icon2.pal b/graphics/pokenav/ribbons/icons2.pal similarity index 100% rename from graphics/pokenav/ribbons_icon2.pal rename to graphics/pokenav/ribbons/icons2.pal diff --git a/graphics/pokenav/ribbons_icon3.pal b/graphics/pokenav/ribbons/icons3.pal similarity index 100% rename from graphics/pokenav/ribbons_icon3.pal rename to graphics/pokenav/ribbons/icons3.pal diff --git a/graphics/pokenav/ribbons_icon4.pal b/graphics/pokenav/ribbons/icons4.pal similarity index 100% rename from graphics/pokenav/ribbons_icon4.pal rename to graphics/pokenav/ribbons/icons4.pal diff --git a/graphics/pokenav/ribbons_icon5.pal b/graphics/pokenav/ribbons/icons5.pal similarity index 100% rename from graphics/pokenav/ribbons_icon5.pal rename to graphics/pokenav/ribbons/icons5.pal diff --git a/graphics/pokenav/ribbons_icon_big.png b/graphics/pokenav/ribbons/icons_big.png similarity index 100% rename from graphics/pokenav/ribbons_icon_big.png rename to graphics/pokenav/ribbons/icons_big.png diff --git a/graphics/pokenav/ui_ribbons.bin b/graphics/pokenav/ribbons/list_bg.bin similarity index 100% rename from graphics/pokenav/ui_ribbons.bin rename to graphics/pokenav/ribbons/list_bg.bin diff --git a/graphics/pokenav/ui_ribbons.png b/graphics/pokenav/ribbons/list_bg.png similarity index 100% rename from graphics/pokenav/ui_ribbons.png rename to graphics/pokenav/ribbons/list_bg.png diff --git a/graphics/pokenav/8623790.pal b/graphics/pokenav/ribbons/list_ui.pal similarity index 100% rename from graphics/pokenav/8623790.pal rename to graphics/pokenav/ribbons/list_ui.pal diff --git a/graphics/pokenav/8624098.pal b/graphics/pokenav/ribbons/mon_info.pal similarity index 100% rename from graphics/pokenav/8624098.pal rename to graphics/pokenav/ribbons/mon_info.pal diff --git a/graphics/pokenav/ribbons.bin b/graphics/pokenav/ribbons/summary_bg.bin similarity index 100% rename from graphics/pokenav/ribbons.bin rename to graphics/pokenav/ribbons/summary_bg.bin diff --git a/graphics/pokenav/ribbons.png b/graphics/pokenav/ribbons/summary_bg.png similarity index 100% rename from graphics/pokenav/ribbons.png rename to graphics/pokenav/ribbons/summary_bg.png diff --git a/graphics/misc/reset_rtc_screen_arrow.pal b/graphics/reset_rtc_screen/arrow.pal similarity index 100% rename from graphics/misc/reset_rtc_screen_arrow.pal rename to graphics/reset_rtc_screen/arrow.pal diff --git a/graphics/misc/reset_rtc_screen_downarrow.png b/graphics/reset_rtc_screen/arrow_down.png similarity index 100% rename from graphics/misc/reset_rtc_screen_downarrow.png rename to graphics/reset_rtc_screen/arrow_down.png diff --git a/graphics/misc/reset_rtc_screen_rightarrow.png b/graphics/reset_rtc_screen/arrow_right.png similarity index 100% rename from graphics/misc/reset_rtc_screen_rightarrow.png rename to graphics/reset_rtc_screen/arrow_right.png diff --git a/graphics/weather/0.pal b/graphics/weather/fog.pal similarity index 100% rename from graphics/weather/0.pal rename to graphics/weather/fog.pal diff --git a/graphics_file_rules.mk b/graphics_file_rules.mk index d162ccbb6..e392b5dc5 100644 --- a/graphics_file_rules.mk +++ b/graphics_file_rules.mk @@ -346,7 +346,7 @@ $(FONTGFXDIR)/keypad_icons.4bpp: %.4bpp: %.png graphics/title_screen/pokemon_logo.gbapal: %.gbapal: %.pal $(GFX) $< $@ -num_colors 224 -graphics/link_games/pkmnjump_bg.4bpp: %.4bpp: %.png +graphics/pokemon_jump/bg.4bpp: %.4bpp: %.png $(GFX) $< $@ -num_tiles 63 graphics/pokenav/region_map.8bpp: %.8bpp: %.png @@ -437,7 +437,7 @@ $(BTLANMSPRGFXDIR)/spark.4bpp: $(BTLANMSPRGFXDIR)/spark_0.4bpp \ $(BTLANMSPRGFXDIR)/spark_1.4bpp @cat $^ >$@ -$(MASKSGFXDIR)/unknown_C2EA50.4bpp: %.4bpp: %.png +$(MASKSGFXDIR)/unused_level_up.4bpp: %.4bpp: %.png $(GFX) $< $@ -num_tiles 14 $(BATTRANSGFXDIR)/vs_frame.4bpp: %.4bpp: %.png diff --git a/include/bard_music.h b/include/bard_music.h index 882606b27..2825d16e6 100644 --- a/include/bard_music.h +++ b/include/bard_music.h @@ -1,9 +1,6 @@ #ifndef GUARD_BARD_MUSIC_H #define GUARD_BARD_MUSIC_H -// Exported type declarations - - struct BardSound { /*0x00*/ u8 var00; @@ -34,12 +31,8 @@ struct BardSong /*0x30*/ const struct BardSound *sound; }; -// Exported RAM declarations - -// Exported ROM declarations - -extern const u16 gNumSpeciesNames; -extern const u16 gUnknown_085FA1D4; +extern const u16 gNumBardWords_Species; +extern const u16 gNumBardWords_Moves; const struct BardSound *GetWordSounds(u16 word); void GetWordPhonemes(struct BardSong *song, u16 word); diff --git a/include/battle.h b/include/battle.h index 5262b2d06..17566d97b 100644 --- a/include/battle.h +++ b/include/battle.h @@ -407,6 +407,15 @@ struct BattleTvMovePoints s16 points[2][PARTY_SIZE * 4]; }; +struct LinkBattlerHeader +{ + u8 versionSignatureLo; + u8 versionSignatureHi; + u8 vsScreenHealthFlagsLo; + u8 vsScreenHealthFlagsHi; + struct BattleEnigmaBerry battleEnigmaBerry; +}; + struct MegaEvolutionData { u8 toEvolve; // As flags using gBitTable. @@ -466,7 +475,7 @@ struct BattleStruct u8 formToChangeInto; u8 chosenMovePositions[MAX_BATTLERS_COUNT]; u8 stateIdAfterSelScript[MAX_BATTLERS_COUNT]; - u8 field_8B; // related to player's pokemon switching + u8 prevSelectedPartySlot; u8 stringMoveType; u8 expGetterBattlerId; u8 field_91; // related to gAbsentBattlerFlags, possibly absent flags turn ago? @@ -497,11 +506,10 @@ struct BattleStruct u8 givenExpMons; // Bits for enemy party's pokemon that gave exp to player's party. u16 lastTakenMoveFrom[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT]; // a 2-D array [target][attacker] u16 castformPalette[MAX_BATTLERS_COUNT][16]; - u8 field_180; // weird field, used in battle_main.c, once accessed as an array of u32 overwriting the field below - u8 field_181; - u8 field_182; - u8 field_183; - struct BattleEnigmaBerry battleEnigmaBerry; + union { + struct LinkBattlerHeader linkBattlerHeader; + u32 battleVideo[2]; + } multiBuffer; u8 wishPerishSongState; u8 wishPerishSongBattlerId; bool8 overworldWeatherDone; @@ -645,7 +653,7 @@ struct BattleAnimationInfo u8 ballThrowCaseId:6; u8 isCriticalCapture:1; u8 criticalCaptureSuccess:1; - u8 field_9_x1:1; + u8 introAnimActive:1; u8 wildMonInvisible:1; u8 field_9_x1C:3; u8 field_9_x20:1; @@ -670,17 +678,17 @@ struct BattleHealthboxInfo u8 triedShinyMonAnim:1; u8 finishedShinyMonAnim:1; u8 field_1_x1E:4; - u8 field_1_x20:1; - u8 field_1_x40:1; - u8 field_1_x80:1; + u8 bgmRestored:1; + u8 waitForCry:1; + u8 healthboxSlideInStarted:1; u8 healthboxBounceSpriteId; u8 battlerBounceSpriteId; u8 animationState; - u8 field_5; + u8 partyStatusDelayTimer; u8 matrixNum; u8 shadowSpriteId; - u8 field_8; - u8 field_9; + u8 soundTimer; + u8 introEndDelay; u8 field_A; u8 field_B; }; @@ -745,7 +753,7 @@ extern u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT]; extern u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT]; extern u32 gBattleTypeFlags; extern u8 gBattleTerrain; -extern u32 gUnknown_02022FF4; +extern u32 gUnusedFirstBattleVar1; extern u8 *gUnknown_0202305C; extern u8 *gUnknown_02023060; extern u8 gActiveBattler; @@ -793,7 +801,7 @@ extern u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT]; extern u16 gMoveResultFlags; extern u32 gHitMarker; extern u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT]; -extern u8 gUnknown_0202428C; +extern u8 gUnusedFirstBattleVar2; extern u32 gSideStatuses[2]; extern struct SideTimer gSideTimers[2]; extern u32 gStatuses3[MAX_BATTLERS_COUNT]; @@ -825,8 +833,8 @@ extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT]; extern u8 gPlayerDpadHoldFrames; extern struct BattleSpriteData *gBattleSpritesDataPtr; extern struct MonSpritesGfx *gMonSpritesGfxPtr; -extern struct BattleHealthboxInfo *gUnknown_020244D8; -extern struct BattleHealthboxInfo *gUnknown_020244DC; +extern struct BattleHealthboxInfo *gBattleControllerOpponentHealthboxData; +extern struct BattleHealthboxInfo *gBattleControllerOpponentFlankHealthboxData; extern u16 gBattleMovePower; extern u16 gMoveToLearn; extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; @@ -844,7 +852,7 @@ extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; extern u8 gMultiUsePlayerCursor; extern u8 gNumberOfMovesToChoose; -extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT]; +extern u8 gBattleControllerData[MAX_BATTLERS_COUNT]; extern bool8 gHasFetchedBall; extern u8 gLastUsedBall; diff --git a/include/battle_anim.h b/include/battle_anim.h index 2b28e92fb..02a16d9f7 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -67,7 +67,7 @@ s8 BattleAnimAdjustPanning2(s8 pan); s16 KeepPanInRange(s16 a, int oldPan); s16 CalculatePanIncrement(s16 sourcePan, s16 targetPan, s16 incrementPan); void sub_80A4720(u16 a, u16 *b, u32 c, u8 d); -void sub_80A477C(bool8); +void ResetBattleAnimBg(bool8); void LoadMoveBg(u16 bgId); // battle_intro.c @@ -78,8 +78,8 @@ int GetAnimBgAttribute(u8 bgId, u8 attributeId); // battle_anim_mons.c void TranslateSpriteInEllipseOverDuration(struct Sprite *sprite); -void sub_80A8AEC(struct Sprite *sprite); -void sub_80A8A6C(struct Sprite *sprite); +void AnimUnused_80A8AEC(struct Sprite *sprite); +void AnimUnused_80A8A6C(struct Sprite *sprite); void AnimWeatherBallUp(struct Sprite *sprite); void AnimWeatherBallDown(struct Sprite *sprite); void AnimSpinningSparkle(struct Sprite *sprite); @@ -94,7 +94,7 @@ void InitAnimArcTranslation(struct Sprite *sprite); bool8 AnimTranslateLinear(struct Sprite *sprite); void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite); u8 GetBattlerSpriteCoord2(u8 battlerId, u8 attributeId); -void sub_80A6FD4(struct Sprite *sprite); +void InitAnimLinearTranslationWithSpeed(struct Sprite *sprite); u16 ArcTan2Neg(s16 a, s16 b); void TrySetSpriteRotScale(struct Sprite *sprite, bool8 a2, s16 xScale, s16 yScale, u16 rotation); void RunStoredCallbackWhenAffineAnimEnds(struct Sprite *sprite); @@ -107,13 +107,13 @@ u8 GetBattlerYCoordWithElevation(u8 battlerId); void WaitAnimForDuration(struct Sprite *sprite); void AnimTravelDiagonally(struct Sprite *sprite); void InitAnimLinearTranslation(struct Sprite *sprite); -void sub_80A6F98(struct Sprite *sprite); +void AnimTranslateLinear_WaitEnd(struct Sprite *sprite); u8 GetBattlerSpriteBGPriority(u8 battlerId); void *LoadPointerFromVars(s16 bottom, s16 top); void StorePointerInVars(s16 *bottom, s16 *top, const void *ptr); void sub_80A8278(void); -void sub_80A6B30(struct BattleAnimBgData*); -void sub_80A6B90(struct BattleAnimBgData*, u32 arg1); +void GetBattleAnimBg1Data(struct BattleAnimBgData*); +void GetBattleAnimBgData(struct BattleAnimBgData*, u32 arg1); u8 GetBattlerSpriteSubpriority(u8 battlerId); bool8 TranslateAnimHorizontalArc(struct Sprite *sprite); void sub_80A6630(struct Sprite *sprite); @@ -123,20 +123,20 @@ void SetSpriteRotScale(u8 spriteId, s16 xScale, s16 yScale, u16 rotation); void InitSpriteDataForLinearTranslation(struct Sprite *sprite); void PrepareBattlerSpriteForRotScale(u8 spriteId, u8 objMode); void SetBattlerSpriteYOffsetFromRotation(u8 spriteId); -u32 sub_80A75AC(u8 a1, u8 a2, u8 a3, u8 a4, u8 a5, u8 a6, u8 a7); -u32 sub_80A76C4(u8 a1, u8 a2, u8 a3, u8 a4); -u8 sub_80A77AC(u8 a1); +u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 attackerPartner, u8 targetPartner, u8 a6, u8 a7); +u32 GetBattleMonSpritePalettesMask(u8 playerLeft, u8 playerRight, u8 opponentLeft, u8 opponentRight); +u8 AnimDummyReturnArg(u8 battler); s16 CloneBattlerSpriteWithBlend(u8); void obj_delete_but_dont_free_vram(struct Sprite*); -u8 sub_80A89C8(int, u8, int); +u8 CreateInvisibleSpriteCopy(int, u8, int); void AnimLoadCompressedBgTilemapHandleContest(struct BattleAnimBgData*, const void*, u32); void AnimLoadCompressedBgGfx(u32, const u32*, u32); -void sub_80A6DAC(bool8); +void UpdateAnimBg3ScreenSize(bool8); void TranslateSpriteInGrowingCircleOverDuration(struct Sprite *); void sub_80A653C(struct Sprite *); void SetBattlerSpriteYOffsetFromYScale(u8 spriteId); -void sub_80A805C(struct Task *task, u8 a2, s16 a3, s16 a4, s16 a5, s16 a6, u16 a7); -u8 sub_80A80C8(struct Task *task); +void PrepareEruptAnimTaskData(struct Task *task, u8 a2, s16 a3, s16 a4, s16 a5, s16 a6, u16 a7); +u8 UpdateEruptAnimTask(struct Task *task); void DestroyAnimSpriteAndDisableBlend(struct Sprite *); void AnimLoadCompressedBgTilemap(u32 bgId, const void *src); void InitAnimFastLinearTranslationWithSpeed(struct Sprite *sprite); @@ -145,15 +145,15 @@ void InitAndRunAnimFastLinearTranslation(struct Sprite *sprite); void TranslateMonSpriteLinear(struct Sprite *sprite); void TranslateSpriteLinear(struct Sprite *sprite); void AnimSpriteOnMonPos(struct Sprite *sprite); -void sub_80A7000(struct Sprite *sprite); +void InitAnimLinearTranslationWithSpeedAndPos(struct Sprite *sprite); void TranslateSpriteInCircleOverDuration(struct Sprite *sprite); void SetGreyscaleOrOriginalPalette(u16 palNum, bool8 restoreOriginal); void PrepareAffineAnimInTaskData(struct Task *task, u8 spriteId, const union AffineAnimCmd *affineAnimCmds); bool8 RunAffineAnimFromTaskData(struct Task *task); void AnimThrowProjectile(struct Sprite *sprite); void sub_80A6BFC(struct BattleAnimBgData *unk, u8 unused); -u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, u32 a10); -void sub_80A749C(struct Sprite *sprite); +u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, bool32 ignoreDeoxysForm); +void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite); void TradeMenuBouncePartySprites(struct Sprite *sprite); void DestroyAnimVisualTaskAndDisableBlend(u8 taskId); void DestroySpriteAndFreeResources_(struct Sprite *sprite); @@ -162,7 +162,7 @@ u8 GetBattlerSide(u8 battler); u8 GetBattlerPosition(u8 battler); u8 GetBattlerAtPosition(u8 position); void sub_80A64EC(struct Sprite *sprite); -void sub_80A718C(struct Sprite *sprite); +void InitAnimFastLinearTranslationWithSpeedAndPos(struct Sprite *sprite); enum { @@ -187,7 +187,7 @@ enum u8 GetBattlerSpriteCoord(u8 battlerId, u8 attributeId); bool8 IsBattlerSpritePresent(u8 battlerId); -void sub_80A6C68(u32 arg0); +void ClearBattleAnimBg(u32 arg0); u8 GetAnimBattlerSpriteId(u8 wantedBattler); bool8 IsDoubleBattle(void); u8 GetBattleBgPaletteNum(void); @@ -223,8 +223,8 @@ u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 selectedPalettes, bool32 IsCriticalCapture(void); // battle_anim_utility_funcs.c -void sub_8116EB4(u8); -void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u32 *arg8, const u32 *arg9, const u32 *palette); +void InitStatsChangeAnimation(u8); +void StartMonScrollingBgMask(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u32 *arg8, const u32 *arg9, const u32 *palette); // battle_anim_effects_1.c void SetSpriteNextToMonHead(u8 battler, struct Sprite* sprite); @@ -341,7 +341,7 @@ void AnimPsychoBoost(struct Sprite *sprite); // battle_anim_smokescreen.c u8 SmokescreenImpact(s16 x, s16 y, u8 a3); -u32 UnpackSelectedBattleAnimPalettes(s16); +u32 UnpackSelectedBattleBgPalettes(s16); u8 GetBattlerSpriteFinal_Y(u8, u16, u8); @@ -436,7 +436,7 @@ void AnimBasicFistOrFoot(struct Sprite *sprite); void AnimSpinningKickOrPunchFinish(struct Sprite *sprite); void AnimRevengeScratch(struct Sprite *sprite); void AnimDizzyPunchDuck(struct Sprite *sprite); -extern const union AnimCmd *const gAnims_HandOrFoot[]; +extern const union AnimCmd *const gAnims_HandsAndFeet[]; extern const union AffineAnimCmd *const gAffineAnims_MegaPunchKick[]; extern const union AffineAnimCmd *const gAffineAnims_SpinningHandOrFoot[]; extern const union AnimCmd *const gAnims_RevengeBigScratch[]; diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 5981e3c08..0f2a0d238 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -136,7 +136,7 @@ enum CONTROLLER_PRINTSTRING, CONTROLLER_PRINTSTRINGPLAYERONLY, CONTROLLER_CHOOSEACTION, - CONTROLLER_UNKNOWNYESNOBOX, + CONTROLLER_YESNOBOX, CONTROLLER_CHOOSEMOVE, CONTROLLER_OPENBAG, CONTROLLER_CHOOSEPOKEMON, @@ -172,7 +172,7 @@ enum CONTROLLER_BATTLEANIMATION, CONTROLLER_LINKSTANDBYMSG, CONTROLLER_RESETACTIONMOVESELECTION, - CONTROLLER_55, + CONTROLLER_ENDLINKBATTLE, CONTROLLER_DEBUGMENU, /*new controllers should go here*/ CONTROLLER_TERMINATOR_NOP, @@ -184,8 +184,8 @@ extern struct UnusedControllerStruct gUnusedControllerStruct; // general functions void HandleLinkBattleSetup(void); void SetUpBattleVarsAndBirchZigzagoon(void); -void sub_8032768(void); -void sub_8033648(void); +void InitBattleControllers(void); +void TryReceiveLinkBattleData(void); void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data); // emitters @@ -208,7 +208,7 @@ void BtlController_EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 m void BtlController_EmitPrintString(u8 bufferId, u16 stringId); void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringId); void BtlController_EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2); -void BtlController_EmitUnknownYesNoBox(u8 bufferId); +void BtlController_EmitYesNoBox(u8 bufferId); void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData); void BtlController_EmitChooseItem(u8 bufferId, u8* arg1); void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u16 abilityId, u8* arg4); @@ -242,20 +242,20 @@ void BtlController_EmitHidePartyStatusSummary(u8 bufferId); void BtlController_EmitEndBounceEffect(u8 bufferId); void BtlController_EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible); void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument); -void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2); +void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 record); void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId); -void BtlController_EmitCmd55(u8 bufferId, u8 battleOutcome); +void BtlController_EmitEndLinkBattle(u8 bufferId, u8 battleOutcome); void BtlController_EmitDebugMenu(u8 bufferId); // player controller void SetControllerToPlayer(void); -void nullsub_21(void); +void BattleControllerDummy(void); void PlayerHandleGetRawMonData(void); -void sub_80587B0(void); -void sub_805CC00(struct Sprite *sprite); +void SetBattleEndCallbacks(void); +void SpriteCB_FreePlayerSpriteLoadMonSprite(struct Sprite *sprite); void CB2_SetUpReshowBattleScreenAfterMenu(void); void CB2_SetUpReshowBattleScreenAfterMenu2(void); -void c3_0802FDF4(u8 taskId); +void Task_PlayerController_RestoreBgmAfterCry(u8 taskId); void ActionSelectionCreateCursorAt(u8 cursorPos, u8 unused); void ActionSelectionDestroyCursorAt(u8 cursorPos); void InitMoveSelectionsVarsAndStrings(void); diff --git a/include/battle_gfx_sfx_util.h b/include/battle_gfx_sfx_util.h index 546683eba..a47fc6140 100644 --- a/include/battle_gfx_sfx_util.h +++ b/include/battle_gfx_sfx_util.h @@ -4,21 +4,19 @@ void AllocateBattleSpritesData(void); void FreeBattleSpritesData(void); u16 ChooseMoveAndTargetInBattlePalace(void); -void sub_805D714(struct Sprite *sprite); -void sub_805D770(struct Sprite *sprite, bool8 arg1); -void sub_805D7AC(struct Sprite *sprite); +void SpriteCB_WaitForBattlerBallReleaseAnim(struct Sprite *sprite); +void SpriteCB_TrainerSlideIn(struct Sprite *sprite); void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status); bool8 TryHandleLaunchBattleTableAnimation(u8 activeBattlerId, u8 attacker, u8 target, u8 tableId, u16 argument); void InitAndLaunchSpecialAnimation(u8 activeBattlerId, u8 attacker, u8 target, u8 tableId); bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn); -bool8 mplay_80342A4(u8 battlerId); +bool8 IsBattleSEPlaying(u8 battlerId); void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId); void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId); -void nullsub_23(void); -void nullsub_24(u16 species); +void BattleGfxSfxDummy2(u16 species); void DecompressTrainerFrontPic(u16 frontPicId, u8 battlerId); void DecompressTrainerBackPic(u16 backPicId, u8 battlerId); -void nullsub_25(u8 arg0); +void BattleGfxSfxDummy3(u8 gender); void FreeTrainerFrontPicPalette(u16 frontPicId); void sub_805DFFC(void); bool8 BattleLoadAllHealthBoxesGfx(u8 state); @@ -36,7 +34,7 @@ void HandleLowHpMusicChange(struct Pokemon *mon, u8 battlerId); void BattleStopLowHpSound(void); u8 GetMonHPBarLevel(struct Pokemon *mon); void HandleBattleLowHpMusicChange(void); -void sub_805EB9C(u8 affineMode); +void SetBattlerSpriteAffineMode(u8 affineMode); void LoadAndCreateEnemyShadowSprites(void); void SpriteCB_SetInvisible(struct Sprite *sprite); void SetBattlerShadowSpriteCallback(u8 battlerId, u16 species); diff --git a/include/battle_main.h b/include/battle_main.h index c0b8e6c0f..bf95ca156 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -34,27 +34,26 @@ void CB2_QuitRecordedBattle(void); void sub_8038528(struct Sprite* sprite); void sub_8038A04(void); // unused void VBlankCB_Battle(void); -void nullsub_17(struct Sprite *sprite); -void sub_8038B74(struct Sprite *sprite); -void sub_8038D64(void); -u32 sub_80391E0(u8 arrayId, u8 caseId); -u32 sub_80397C4(u32 setId, u32 tableId); +void SpriteCB_VsLetterDummy(struct Sprite *sprite); +void SpriteCB_VsLetterInit(struct Sprite *sprite); +void CB2_InitEndLinkBattle(void); +u32 GetBattleBgTemplateData(u8 arrayId, u8 caseId); +u32 GetBattleWindowTemplatePixelWidth(u32 setId, u32 tableId); void SpriteCb_WildMon(struct Sprite *sprite); void SpriteCallbackDummy_2(struct Sprite *sprite); void SpriteCB_FaintOpponentMon(struct Sprite *sprite); void SpriteCb_ShowAsMoveTarget(struct Sprite *sprite); void SpriteCb_HideAsMoveTarget(struct Sprite *sprite); void SpriteCb_OpponentMonFromBall(struct Sprite *sprite); -void sub_8039BB4(struct Sprite *sprite); -void sub_80105DC(struct Sprite *sprite); -void sub_8039C00(struct Sprite *sprite); +void SpriteCB_BattleSpriteStartSlideLeft(struct Sprite *sprite); +void SpriteCB_FaintSlideAnim(struct Sprite *sprite); void DoBounceEffect(u8 battlerId, u8 b, s8 c, s8 d); void EndBounceEffect(u8 battlerId, bool8 b); void SpriteCb_PlayerMonFromBall(struct Sprite *sprite); void sub_8039E60(struct Sprite *sprite); void SpriteCB_TrainerThrowObject(struct Sprite *sprite); void sub_8039E9C(struct Sprite *sprite); -void nullsub_20(void); +void BeginBattleIntroDummy(void); void BeginBattleIntro(void); void SwitchInClearSetData(void); void FaintClearSetData(void); @@ -75,8 +74,8 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk); extern struct UnknownPokemonStruct4 gMultiPartnerParty[MULTI_PARTY_SIZE]; extern const struct SpriteTemplate gUnknown_0831AC88; -extern const struct OamData gOamData_831ACA8; -extern const struct OamData gOamData_831ACB0; +extern const struct OamData gOamData_BattleSpriteOpponentSide; +extern const struct OamData gOamData_BattleSpritePlayerSide; extern const u8 gTypeNames[NUMBER_OF_MON_TYPES][TYPE_NAME_LENGTH + 1]; extern const struct TrainerMoney gTrainerMoneyTable[]; extern const u8 gAbilityNames[][ABILITY_NAME_LENGTH + 1]; diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 2fc993b9c..0b94a6ae7 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -217,7 +217,7 @@ extern const u8 BattleScript_ActionSelectionItemsCantBeUsed[]; extern const u8 BattleScript_ArenaTurnBeginning[]; extern const u8 BattleScript_PalacePrintFlavorText[]; extern const u8 BattleScript_ArenaDoJudgment[]; -extern const u8 BattleScript_82DAA0B[]; +extern const u8 BattleScript_FrontierLinkBattleLost[]; extern const u8 BattleScript_AskIfWantsToForfeitMatch[]; extern const u8 BattleScript_PrintPlayerForfeited[]; extern const u8 BattleScript_PrintPlayerForfeitedLinkBattle[]; diff --git a/include/battle_setup.h b/include/battle_setup.h index 4099d5f15..5ec7e35d5 100644 --- a/include/battle_setup.h +++ b/include/battle_setup.h @@ -41,7 +41,7 @@ void ConfigureAndSetUpOneTrainerBattle(u8 trainerObjEventId, const u8 *trainerSc void ConfigureTwoTrainersBattle(u8 trainerObjEventId, const u8 *trainerScript); void SetUpTwoTrainersBattle(void); bool32 GetTrainerFlagFromScriptPointer(const u8 *data); -void SetUpTrainerMovement(void); +void SetTrainerFacingDirection(void); u8 GetTrainerBattleMode(void); bool8 GetTrainerFlag(void); bool8 HasTrainerBeenFought(u16 trainerId); @@ -53,7 +53,7 @@ void ShowTrainerIntroSpeech(void); const u8 *BattleSetup_GetScriptAddrAfterBattle(void); const u8 *BattleSetup_GetTrainerPostBattleScript(void); void ShowTrainerCantBattleSpeech(void); -void SetUpTrainerEncounterMusic(void); +void PlayTrainerEncounterMusic(void); const u8 *GetTrainerALoseText(void); const u8 *GetTrainerBLoseText(void); const u8 *GetTrainerWonSpeech(void); diff --git a/include/battle_util.h b/include/battle_util.h index 2cacf71d0..411e6cd52 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -66,7 +66,7 @@ void PressurePPLoseOnUsingImprison(u8 attacker); void MarkAllBattlersForControllerExec(void); // unused bool32 IsBattlerMarkedForControllerExec(u8 battlerId); void MarkBattlerForControllerExec(u8 battlerId); -void sub_803F850(u8 arg0); +void MarkBattlerReceivedLinkData(u8 arg0); void CancelMultiTurnMoves(u8 battlerId); bool8 WasUnableToUseMove(u8 battlerId); void PrepareStringBattle(u16 stringId, u8 battlerId); diff --git a/include/berry.h b/include/berry.h index afd1bc499..4a5a46615 100644 --- a/include/berry.h +++ b/include/berry.h @@ -24,7 +24,7 @@ void ObjectEventInteractionPlantBerryTree(void); void ObjectEventInteractionPickBerryTree(void); void ObjectEventInteractionRemoveBerryTree(void); bool8 PlayerHasBerries(void); -void ResetBerryTreeSparkleFlags(void); +void SetBerryTreesSeen(void); extern const struct Berry gBerries[]; diff --git a/include/bike.h b/include/bike.h index 46b668169..893b0b19e 100644 --- a/include/bike.h +++ b/include/bike.h @@ -71,7 +71,7 @@ void MovePlayerOnBike(u8 direction, u16 newKeys, u16 heldKeys); void Bike_TryAcroBikeHistoryUpdate(u16 newKeys, u16 heldKeys); bool8 RS_IsRunningDisallowed(u8 tile); bool8 IsBikingDisallowedByPlayer(void); -bool8 player_should_look_direction_be_enforced_upon_movement(void); +bool8 IsPlayerNotUsingAcroBikeOnBumpySlope(void); void GetOnOffBike(u8 transitionFlags); void BikeClearState(int newDirHistory, int newAbStartHistory); void Bike_UpdateBikeCounterSpeed(u8 counter); diff --git a/include/cable_club.h b/include/cable_club.h index 7340742ea..a5a6acfa4 100644 --- a/include/cable_club.h +++ b/include/cable_club.h @@ -7,7 +7,7 @@ void CreateTask_EnterCableClubSeat(TaskFunc taskFunc); u8 CreateTask_ReestablishCableClubLink(void); void CB2_ReturnFromCableClubBattle(void); bool32 AreBattleTowerLinkSpeciesSame(u16 *speciesList1, u16 *speciesList2); -void sub_80B3AF8(u8 taskId); +void Task_ReconnectWithLinkPlayers(u8 taskId); void Task_WaitForLinkPlayerConnection(u8 taskId); bool32 GetLinkTrainerCardColor(u8 linkPlayerIndex); diff --git a/include/constants/battle_tower.h b/include/constants/battle_tower.h index 6d50b83ed..47858e807 100644 --- a/include/constants/battle_tower.h +++ b/include/constants/battle_tower.h @@ -33,10 +33,10 @@ #define BATTLE_TOWER_LINK_CONTINUE 0 #define BATTLE_TOWER_LINK_RETIRE 1 -#define BATTLE_TOWER_LINKSTAT_CONTINUE 0 -#define BATTLE_TOWER_LINKSTAT_BOTH_RETIRE 1 -#define BATTLE_TOWER_LINKSTAT_PARTNER_RETIRE 2 -#define BATTLE_TOWER_LINKSTAT_PLAYER_RETIRE 3 +#define BATTLE_TOWER_LINKSTAT_CONTINUE 0 +#define BATTLE_TOWER_LINKSTAT_BOTH_RETIRE 1 +#define BATTLE_TOWER_LINKSTAT_MEMBER_RETIRE 2 +#define BATTLE_TOWER_LINKSTAT_LEADER_RETIRE 3 // Ids for special multi battle types #define MULTI_BATTLE_2_VS_2 0 diff --git a/include/constants/berry.h b/include/constants/berry.h index 8f1e7cd82..3ba59c0f5 100644 --- a/include/constants/berry.h +++ b/include/constants/berry.h @@ -32,4 +32,101 @@ // - BERRY_STAGE_FLOWERING #define NUM_WATER_STAGES 4 +// IDs for berry tree objects, indexes into berryTrees in SaveBlock1 +// Named for whatever berry is initially planted there on a new game +// Those with no initial berry are named "soil" +#define BERRY_TREE_ROUTE_102_PECHA 1 +#define BERRY_TREE_ROUTE_102_ORAN 2 +#define BERRY_TREE_ROUTE_104_SOIL_1 3 +#define BERRY_TREE_ROUTE_104_ORAN_1 4 +#define BERRY_TREE_ROUTE_103_CHERI_1 5 +#define BERRY_TREE_ROUTE_103_LEPPA 6 +#define BERRY_TREE_ROUTE_103_CHERI_2 7 +#define BERRY_TREE_ROUTE_104_CHERI_1 8 +#define BERRY_TREE_ROUTE_104_SOIL_2 9 +#define BERRY_TREE_ROUTE_104_LEPPA 10 +#define BERRY_TREE_ROUTE_104_ORAN_2 11 +#define BERRY_TREE_ROUTE_104_SOIL_3 12 +#define BERRY_TREE_ROUTE_104_PECHA 13 +#define BERRY_TREE_ROUTE_123_QUALOT_1 14 +#define BERRY_TREE_ROUTE_123_POMEG_1 15 +#define BERRY_TREE_ROUTE_110_NANAB_1 16 +#define BERRY_TREE_ROUTE_110_NANAB_2 17 +#define BERRY_TREE_ROUTE_110_NANAB_3 18 +#define BERRY_TREE_ROUTE_111_RAZZ_1 19 +#define BERRY_TREE_ROUTE_111_RAZZ_2 20 +#define BERRY_TREE_ROUTE_112_RAWST_1 21 +#define BERRY_TREE_ROUTE_112_PECHA_1 22 +#define BERRY_TREE_ROUTE_112_PECHA_2 23 +#define BERRY_TREE_ROUTE_112_RAWST_2 24 +#define BERRY_TREE_ROUTE_116_PINAP_1 25 +#define BERRY_TREE_ROUTE_116_CHESTO_1 26 +#define BERRY_TREE_ROUTE_117_WEPEAR_1 27 +#define BERRY_TREE_ROUTE_117_WEPEAR_2 28 +#define BERRY_TREE_ROUTE_117_WEPEAR_3 29 +#define BERRY_TREE_ROUTE_123_POMEG_2 30 +#define BERRY_TREE_ROUTE_118_SITRUS_1 31 +#define BERRY_TREE_ROUTE_118_SOIL 32 +#define BERRY_TREE_ROUTE_118_SITRUS_2 33 +#define BERRY_TREE_ROUTE_119_POMEG_1 34 +#define BERRY_TREE_ROUTE_119_POMEG_2 35 +#define BERRY_TREE_ROUTE_119_POMEG_3 36 +#define BERRY_TREE_ROUTE_120_ASPEAR_1 37 +#define BERRY_TREE_ROUTE_120_ASPEAR_2 38 +#define BERRY_TREE_ROUTE_120_ASPEAR_3 39 +#define BERRY_TREE_ROUTE_120_PECHA_1 40 +#define BERRY_TREE_ROUTE_120_PECHA_2 41 +#define BERRY_TREE_ROUTE_120_PECHA_3 42 +#define BERRY_TREE_ROUTE_120_RAZZ 43 +#define BERRY_TREE_ROUTE_120_NANAB 44 +#define BERRY_TREE_ROUTE_120_PINAP 45 +#define BERRY_TREE_ROUTE_120_WEPEAR 46 +#define BERRY_TREE_ROUTE_121_PERSIM 47 +#define BERRY_TREE_ROUTE_121_ASPEAR 48 +#define BERRY_TREE_ROUTE_121_RAWST 49 +#define BERRY_TREE_ROUTE_121_CHESTO 50 +#define BERRY_TREE_ROUTE_121_SOIL_1 51 +#define BERRY_TREE_ROUTE_121_NANAB_1 52 +#define BERRY_TREE_ROUTE_121_NANAB_2 53 +#define BERRY_TREE_ROUTE_121_SOIL_2 54 +#define BERRY_TREE_ROUTE_115_BLUK_1 55 +#define BERRY_TREE_ROUTE_115_BLUK_2 56 +#define BERRY_TREE_UNUSED 57 +#define BERRY_TREE_ROUTE_123_POMEG_3 58 +#define BERRY_TREE_ROUTE_123_POMEG_4 59 +#define BERRY_TREE_ROUTE_123_GREPA_1 60 +#define BERRY_TREE_ROUTE_123_GREPA_2 61 +#define BERRY_TREE_ROUTE_123_LEPPA_1 62 +#define BERRY_TREE_ROUTE_123_SOIL 63 +#define BERRY_TREE_ROUTE_123_LEPPA_2 64 +#define BERRY_TREE_ROUTE_123_GREPA_3 65 +#define BERRY_TREE_ROUTE_116_CHESTO_2 66 +#define BERRY_TREE_ROUTE_116_PINAP_2 67 +#define BERRY_TREE_ROUTE_114_PERSIM_1 68 +#define BERRY_TREE_ROUTE_115_KELPSY_1 69 +#define BERRY_TREE_ROUTE_115_KELPSY_2 70 +#define BERRY_TREE_ROUTE_115_KELPSY_3 71 +#define BERRY_TREE_ROUTE_123_GREPA_4 72 +#define BERRY_TREE_ROUTE_123_QUALOT_2 73 +#define BERRY_TREE_ROUTE_123_QUALOT_3 74 +#define BERRY_TREE_ROUTE_104_SOIL_4 75 +#define BERRY_TREE_ROUTE_104_CHERI_2 76 +#define BERRY_TREE_ROUTE_114_PERSIM_2 77 +#define BERRY_TREE_ROUTE_114_PERSIM_3 78 +#define BERRY_TREE_ROUTE_123_QUALOT_4 79 +#define BERRY_TREE_ROUTE_111_ORAN_1 80 +#define BERRY_TREE_ROUTE_111_ORAN_2 81 +#define BERRY_TREE_ROUTE_130_LIECHI 82 +#define BERRY_TREE_ROUTE_119_HONDEW_1 83 +#define BERRY_TREE_ROUTE_119_HONDEW_2 84 +#define BERRY_TREE_ROUTE_119_SITRUS 85 +#define BERRY_TREE_ROUTE_119_LEPPA 86 +#define BERRY_TREE_ROUTE_123_PECHA 87 +#define BERRY_TREE_ROUTE_123_SITRUS 88 +#define BERRY_TREE_ROUTE_123_RAWST 89 + +// Remainder are unused + +#define BERRY_TREES_COUNT 128 + #endif // GUARD_CONSTANTS_BERRY_H diff --git a/include/constants/daycare.h b/include/constants/daycare.h index adb62fab5..e412d2ab7 100644 --- a/include/constants/daycare.h +++ b/include/constants/daycare.h @@ -1,11 +1,11 @@ #ifndef GUARD_DAYCARE_CONSTANTS_H #define GUARD_DAYCARE_CONSTANTS_H -// Parent compatability scores +// Parent compatibility scores #define PARENTS_INCOMPATIBLE 0 #define PARENTS_LOW_COMPATIBILITY 20 -#define PARENTS_MED_COMPATABILITY 50 -#define PARENTS_MAX_COMPATABILITY 70 +#define PARENTS_MED_COMPATIBILITY 50 +#define PARENTS_MAX_COMPATIBILITY 70 // Daycare state #define DAYCARE_NO_MONS 0 diff --git a/include/constants/easy_chat.h b/include/constants/easy_chat.h index 8e82cfef0..069f17fcb 100644 --- a/include/constants/easy_chat.h +++ b/include/constants/easy_chat.h @@ -28,29 +28,29 @@ #define EASY_CHAT_PERSON_BOY 2 #define EASY_CHAT_PERSON_DISPLAY_NONE 3 -#define EC_GROUP_POKEMON 0x0 -#define EC_GROUP_TRAINER 0x1 -#define EC_GROUP_STATUS 0x2 -#define EC_GROUP_BATTLE 0x3 -#define EC_GROUP_GREETINGS 0x4 -#define EC_GROUP_PEOPLE 0x5 -#define EC_GROUP_VOICES 0x6 -#define EC_GROUP_SPEECH 0x7 -#define EC_GROUP_ENDINGS 0x8 -#define EC_GROUP_FEELINGS 0x9 -#define EC_GROUP_CONDITIONS 0xa -#define EC_GROUP_ACTIONS 0xb -#define EC_GROUP_LIFESTYLE 0xc -#define EC_GROUP_HOBBIES 0xd -#define EC_GROUP_TIME 0xe -#define EC_GROUP_MISC 0xf -#define EC_GROUP_ADJECTIVES 0x10 -#define EC_GROUP_EVENTS 0x11 -#define EC_GROUP_MOVE_1 0x12 -#define EC_GROUP_MOVE_2 0x13 -#define EC_GROUP_TRENDY_SAYING 0x14 -#define EC_GROUP_POKEMON_2 0x15 -#define EC_NUM_GROUPS 0x16 +#define EC_GROUP_POKEMON 0 +#define EC_GROUP_TRAINER 1 +#define EC_GROUP_STATUS 2 +#define EC_GROUP_BATTLE 3 +#define EC_GROUP_GREETINGS 4 +#define EC_GROUP_PEOPLE 5 +#define EC_GROUP_VOICES 6 +#define EC_GROUP_SPEECH 7 +#define EC_GROUP_ENDINGS 8 +#define EC_GROUP_FEELINGS 9 +#define EC_GROUP_CONDITIONS 10 +#define EC_GROUP_ACTIONS 11 +#define EC_GROUP_LIFESTYLE 12 +#define EC_GROUP_HOBBIES 13 +#define EC_GROUP_TIME 14 +#define EC_GROUP_MISC 15 +#define EC_GROUP_ADJECTIVES 16 +#define EC_GROUP_EVENTS 17 +#define EC_GROUP_MOVE_1 18 +#define EC_GROUP_MOVE_2 19 +#define EC_GROUP_TRENDY_SAYING 20 +#define EC_GROUP_POKEMON_NATIONAL 21 +#define EC_NUM_GROUPS 22 // TRAINER #define EC_WORD_I_CHOOSE_YOU (EC_GROUP_TRAINER << 9) | 0x0 @@ -1105,13 +1105,22 @@ #define PHRASE_COOL_LATIOS 4 #define PHRASE_SUPER_HUSTLE 5 +#define EC_NUM_ALPHABET_GROUPS 27 // 26 (1 for each letter) + 1 (Others) + +#define EC_MAX_WORDS_IN_GROUP 270 // The closest is words by letter S, at 262 + +#define EC_MASK_GROUP 0x7F +#define EC_MASK_INDEX 0x1FF + #define EC_POKEMON(mon) ((EC_GROUP_POKEMON << 9) | SPECIES_##mon) -#define EC_POKEMON2(mon) ((EC_GROUP_POKEMON_2 << 9) | SPECIES_##mon) +#define EC_POKEMON_NATIONAL(mon) ((EC_GROUP_POKEMON_NATIONAL << 9) | SPECIES_##mon) #define EC_MOVE(move) ((EC_GROUP_MOVE_1 << 9) | MOVE_##move) #define EC_MOVE2(move) ((EC_GROUP_MOVE_2 << 9) | MOVE_##move) #define EC_GROUP(word) ((word) >> 9) -#define EC_INDEX(word) ((word) & 0x1FF) -#define EC_WORD(group, index) ((((group) & 0x7F) << 9) | ((index) & 0x1FF)) +#define EC_INDEX(word) ((word) & EC_MASK_INDEX) +#define EC_WORD(group, index) ((((group) & EC_MASK_GROUP) << 9) | ((index) & EC_MASK_INDEX)) + +#define EC_EMPTY_WORD 0xFFFF #endif // GUARD_CONSTANTS_EASY_CHAT_H diff --git a/include/constants/event_object_movement.h b/include/constants/event_object_movement.h index 6a4405b65..223650081 100755 --- a/include/constants/event_object_movement.h +++ b/include/constants/event_object_movement.h @@ -64,7 +64,7 @@ #define MOVEMENT_TYPE_COPY_PLAYER_OPPOSITE_IN_GRASS 0x3C #define MOVEMENT_TYPE_COPY_PLAYER_COUNTERCLOCKWISE_IN_GRASS 0x3D #define MOVEMENT_TYPE_COPY_PLAYER_CLOCKWISE_IN_GRASS 0x3E -#define MOVEMENT_TYPE_HIDDEN 0x3F +#define MOVEMENT_TYPE_BURIED 0x3F #define MOVEMENT_TYPE_WALK_IN_PLACE_DOWN 0x40 #define MOVEMENT_TYPE_WALK_IN_PLACE_UP 0x41 #define MOVEMENT_TYPE_WALK_IN_PLACE_LEFT 0x42 diff --git a/include/constants/flags.h b/include/constants/flags.h index 9be269105..21b730de3 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -829,7 +829,7 @@ #define FLAG_HIDE_LITTLEROOT_TOWN_BRENDANS_HOUSE_RIVAL_MOM 0x310 #define FLAG_HIDE_LITTLEROOT_TOWN_MAYS_HOUSE_RIVAL_MOM 0x311 #define FLAG_HIDE_ROUTE_119_SCOTT 0x312 -#define FLAG_HIDE_LILCOVE_MOTEL_SCOTT 0x313 +#define FLAG_HIDE_LILYCOVE_MOTEL_SCOTT 0x313 #define FLAG_HIDE_MOSSDEEP_CITY_SCOTT 0x314 #define FLAG_HIDE_FANCLUB_OLD_LADY 0x315 #define FLAG_HIDE_FANCLUB_BOY 0x316 @@ -967,7 +967,7 @@ #define FLAG_HIDE_ROUTE_110_RIVAL_ON_BIKE 0x39A #define FLAG_HIDE_ROUTE_119_RIVAL_ON_BIKE 0x39B #define FLAG_HIDE_AQUA_HIDEOUT_GRUNTS 0x39C -#define FLAG_HIDE_LILCOVE_MOTEL_GAME_DESIGNERS 0x39D +#define FLAG_HIDE_LILYCOVE_MOTEL_GAME_DESIGNERS 0x39D #define FLAG_HIDE_MT_CHIMNEY_TEAM_AQUA 0x39E #define FLAG_HIDE_MT_CHIMNEY_TEAM_MAGMA 0x39F #define FLAG_HIDE_FALLARBOR_HOUSE_PROF_COZMO 0x3A0 diff --git a/include/constants/global.h b/include/constants/global.h index 55830ae8b..213ccca5b 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -33,7 +33,6 @@ #define DAYCARE_MON_COUNT 2 #define POKEBLOCKS_COUNT 40 #define OBJECT_EVENTS_COUNT 16 -#define BERRY_TREES_COUNT 128 #define MAIL_COUNT 16 #define SECRET_BASES_COUNT 20 #define TV_SHOWS_COUNT 25 @@ -52,6 +51,7 @@ #define MAX_REMATCH_ENTRIES 100 // only REMATCH_TABLE_ENTRIES (78) are used #define NUM_CONTEST_WINNERS 13 #define UNION_ROOM_KB_ROW_COUNT 10 +#define GIFT_RIBBONS_COUNT 11 #define PYRAMID_BAG_ITEMS_COUNT 10 #define HALL_FACILITIES_COUNT 9 // 7 facilities for single mode + tower double mode + tower multi mode. @@ -70,7 +70,7 @@ // party sizes #define PARTY_SIZE 6 -#define MULTI_PARTY_SIZE PARTY_SIZE / 2 +#define MULTI_PARTY_SIZE (PARTY_SIZE / 2) #define FRONTIER_PARTY_SIZE 3 #define FRONTIER_DOUBLES_PARTY_SIZE 4 #define FRONTIER_MULTI_PARTY_SIZE 2 @@ -84,6 +84,7 @@ #define MAIL_WORDS_COUNT 9 #define EASY_CHAT_BATTLE_WORDS_COUNT 6 #define MOVE_NAME_LENGTH 12 +#define NUM_QUESTIONNAIRE_WORDS 4 #define MALE 0 #define FEMALE 1 diff --git a/include/constants/item_effects.h b/include/constants/item_effects.h index e68914c7b..9d4eac993 100644 --- a/include/constants/item_effects.h +++ b/include/constants/item_effects.h @@ -43,7 +43,7 @@ #define ITEM4_EV_HP 0x1 #define ITEM4_EV_ATK 0x2 #define ITEM4_HEAL_HP 0x4 -#define ITEM4_HEAL_PP_ALL 0x8 +#define ITEM4_HEAL_PP 0x8 #define ITEM4_HEAL_PP_ONE 0x10 #define ITEM4_PP_UP 0x20 #define ITEM4_REVIVE 0x40 @@ -62,11 +62,19 @@ #define ITEM5_FRIENDSHIP_ALL (ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID | ITEM5_FRIENDSHIP_HIGH) // fields 6 and onwards are item-specific arguments +#define ITEM_EFFECT_ARG_START 6 // Special HP recovery amounts for ITEM4_HEAL_HP -#define ITEM6_HEAL_FULL ((u8) -1) -#define ITEM6_HEAL_HALF ((u8) -2) -#define ITEM6_HEAL_LVL_UP ((u8) -3) +#define ITEM6_HEAL_HP_FULL ((u8) -1) +#define ITEM6_HEAL_HP_HALF ((u8) -2) +#define ITEM6_HEAL_HP_LVL_UP ((u8) -3) + +// Special PP recovery amounts for ITEM4_HEAL_PP +#define ITEM6_HEAL_PP_FULL 0x7F + +// Amount of EV modified by ITEM4_EV_HP, ITEM4_EV_ATK, ITEM5_EV_DEF, ITEM5_EV_SPEED, ITEM5_EV_SPDEF and ITEM5_EV_SPATK +#define ITEM6_ADD_EV 10 +#define ITEM6_SUBTRACT_EV -10 // Used for GetItemEffectType. #define ITEM_EFFECT_X_ITEM 0 diff --git a/include/constants/items.h b/include/constants/items.h index 71338da8e..8f77e80de 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -495,7 +495,9 @@ #define NUM_ROUTE_114_MAN_BERRIES (LAST_ROUTE_114_MAN_BERRY - FIRST_ROUTE_114_MAN_BERRY + 1) #define NUM_ROUTE_114_MAN_BERRIES_SKIPPED (FIRST_ROUTE_114_MAN_BERRY - FIRST_BERRY_INDEX) -#define ITEM_TO_BERRY(itemId)(((itemId - FIRST_BERRY_INDEX) + 1)) +#define ITEM_TO_BERRY(itemId)(((itemId) - FIRST_BERRY_INDEX) + 1) +#define ITEM_TO_MAIL(itemId)((itemId) - FIRST_MAIL_INDEX) +#define MAIL_NONE 0xFF #define NUM_TECHNICAL_MACHINES 50 #define NUM_HIDDEN_MACHINES 8 diff --git a/include/constants/layouts.h b/include/constants/layouts.h index 9d5e877b0..db92c9594 100755 --- a/include/constants/layouts.h +++ b/include/constants/layouts.h @@ -79,7 +79,7 @@ #define LAYOUT_FALLARBOR_TOWN_LEFTOVER_RSCONTEST_LOBBY 72 #define LAYOUT_FALLARBOR_TOWN_LEFTOVER_RSCONTEST_HALL 73 #define LAYOUT_LILYCOVE_CITY_HOUSE2 74 -#define LAYOUT_UNKNOWN_08428450 75 +#define LAYOUT_UNUSED_CONTEST_ROOM1 75 #define LAYOUT_VERDANTURF_TOWN_WANDAS_HOUSE 76 #define LAYOUT_PACIFIDLOG_TOWN_HOUSE1 77 #define LAYOUT_PACIFIDLOG_TOWN_HOUSE2 78 @@ -87,8 +87,8 @@ #define LAYOUT_HOUSE_WITH_BED 80 #define LAYOUT_SLATEPORT_CITY_STERNS_SHIPYARD_1F 81 #define LAYOUT_SLATEPORT_CITY_STERNS_SHIPYARD_2F 82 -#define LAYOUT_UNKNOWN_084294C4 83 -#define LAYOUT_UNKNOWN_084294E8 84 +#define LAYOUT_UNUSED_CONTEST_ROOM2 83 +#define LAYOUT_UNUSED_CONTEST_ROOM3 84 #define LAYOUT_SLATEPORT_CITY_POKEMON_FAN_CLUB 85 #define LAYOUT_SLATEPORT_CITY_OCEANIC_MUSEUM_1F 86 #define LAYOUT_SLATEPORT_CITY_OCEANIC_MUSEUM_2F 87 @@ -174,20 +174,20 @@ #define LAYOUT_SHOAL_CAVE_LOW_TIDE_LOWER_ROOM 167 #define LAYOUT_SHOAL_CAVE_HIGH_TIDE_ENTRANCE_ROOM 168 #define LAYOUT_SHOAL_CAVE_HIGH_TIDE_INNER_ROOM 169 -#define LAYOUT_UNKNOWN_0843E6C0 170 -#define LAYOUT_UNKNOWN_0843E6E4 171 -#define LAYOUT_UNKNOWN_0843E708 172 -#define LAYOUT_UNKNOWN_0843E72C 173 -#define LAYOUT_UNKNOWN_0843E750 174 -#define LAYOUT_UNKNOWN_0843E774 175 -#define LAYOUT_UNKNOWN_0843E798 176 -#define LAYOUT_UNKNOWN_0843E7BC 177 -#define LAYOUT_UNKNOWN_0843E7E0 178 -#define LAYOUT_UNKNOWN_0843E804 179 -#define LAYOUT_UNKNOWN_0843E828 180 -#define LAYOUT_UNKNOWN_0843E84C 181 -#define LAYOUT_UNKNOWN_0843E870 182 -#define LAYOUT_UNKNOWN_0843E894 183 +#define LAYOUT_UNUSED_CAVE1 170 +#define LAYOUT_UNUSED_CAVE2 171 +#define LAYOUT_UNUSED_CAVE3 172 +#define LAYOUT_UNUSED_CAVE4 173 +#define LAYOUT_UNUSED_CAVE5 174 +#define LAYOUT_UNUSED_CAVE6 175 +#define LAYOUT_UNUSED_CAVE7 176 +#define LAYOUT_UNUSED_CAVE8 177 +#define LAYOUT_UNUSED_CAVE9 178 +#define LAYOUT_UNUSED_CAVE10 179 +#define LAYOUT_UNUSED_CAVE11 180 +#define LAYOUT_UNUSED_CAVE12 181 +#define LAYOUT_UNUSED_CAVE13 182 +#define LAYOUT_UNUSED_CAVE14 183 #define LAYOUT_NEW_MAUVILLE_ENTRANCE 184 #define LAYOUT_NEW_MAUVILLE_INSIDE 185 #define LAYOUT_ABANDONED_SHIP_DECK 186 @@ -230,12 +230,12 @@ #define LAYOUT_RECORD_CORNER 223 #define LAYOUT_BATTLE_COLOSSEUM_4P 224 #define LAYOUT_CONTEST_HALL 225 -#define LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_29 226 -#define LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_30 227 -#define LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_31 228 -#define LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_32 229 -#define LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_33 230 -#define LAYOUT_UNKNOWN_LINK_CONTEST_ROOM_25_34 231 +#define LAYOUT_UNUSED_CONTEST_HALL1 226 +#define LAYOUT_UNUSED_CONTEST_HALL2 227 +#define LAYOUT_UNUSED_CONTEST_HALL3 228 +#define LAYOUT_UNUSED_CONTEST_HALL4 229 +#define LAYOUT_UNUSED_CONTEST_HALL5 230 +#define LAYOUT_UNUSED_CONTEST_HALL6 231 #define LAYOUT_CONTEST_HALL_BEAUTY 232 #define LAYOUT_CONTEST_HALL_TOUGH 233 #define LAYOUT_CONTEST_HALL_COOL 234 @@ -246,7 +246,7 @@ #define LAYOUT_SAFARI_ZONE_NORTH 239 #define LAYOUT_SAFARI_ZONE_SOUTHWEST 240 #define LAYOUT_SAFARI_ZONE_SOUTH 241 -#define LAYOUT_UNKNOWN_08447028 242 +#define LAYOUT_UNUSED_OUTDOOR_AREA 242 #define LAYOUT_ROUTE109_SEASHORE_HOUSE 243 #define LAYOUT_ROUTE110_TRICK_HOUSE_ENTRANCE 244 #define LAYOUT_ROUTE110_TRICK_HOUSE_END 245 @@ -363,7 +363,7 @@ #define LAYOUT_BATTLE_FRONTIER_BATTLE_ARENA_BATTLE_ROOM 356 #define LAYOUT_SOOTOPOLIS_CITY_LEGENDS_BATTLE 357 #define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_WILD_MONS 358 -#define LAYOUT_UNKNOWN_084693AC 359 +#define LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_UNUSED 359 #define LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY 360 #define LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR 361 #define LAYOUT_BATTLE_PYRAMID_SQUARE01 362 diff --git a/include/constants/map_groups.h b/include/constants/map_groups.h index 69355635b..c650600e8 100755 --- a/include/constants/map_groups.h +++ b/include/constants/map_groups.h @@ -402,67 +402,67 @@ #define MAP_METEOR_FALLS_STEVENS_CAVE (107 | (24 << 8)) // Map Group 25 -#define MAP_SECRET_BASE_RED_CAVE1 (0 | (25 << 8)) -#define MAP_SECRET_BASE_BROWN_CAVE1 (1 | (25 << 8)) -#define MAP_SECRET_BASE_BLUE_CAVE1 (2 | (25 << 8)) -#define MAP_SECRET_BASE_YELLOW_CAVE1 (3 | (25 << 8)) -#define MAP_SECRET_BASE_TREE1 (4 | (25 << 8)) -#define MAP_SECRET_BASE_SHRUB1 (5 | (25 << 8)) -#define MAP_SECRET_BASE_RED_CAVE2 (6 | (25 << 8)) -#define MAP_SECRET_BASE_BROWN_CAVE2 (7 | (25 << 8)) -#define MAP_SECRET_BASE_BLUE_CAVE2 (8 | (25 << 8)) -#define MAP_SECRET_BASE_YELLOW_CAVE2 (9 | (25 << 8)) -#define MAP_SECRET_BASE_TREE2 (10 | (25 << 8)) -#define MAP_SECRET_BASE_SHRUB2 (11 | (25 << 8)) -#define MAP_SECRET_BASE_RED_CAVE3 (12 | (25 << 8)) -#define MAP_SECRET_BASE_BROWN_CAVE3 (13 | (25 << 8)) -#define MAP_SECRET_BASE_BLUE_CAVE3 (14 | (25 << 8)) -#define MAP_SECRET_BASE_YELLOW_CAVE3 (15 | (25 << 8)) -#define MAP_SECRET_BASE_TREE3 (16 | (25 << 8)) -#define MAP_SECRET_BASE_SHRUB3 (17 | (25 << 8)) -#define MAP_SECRET_BASE_RED_CAVE4 (18 | (25 << 8)) -#define MAP_SECRET_BASE_BROWN_CAVE4 (19 | (25 << 8)) -#define MAP_SECRET_BASE_BLUE_CAVE4 (20 | (25 << 8)) -#define MAP_SECRET_BASE_YELLOW_CAVE4 (21 | (25 << 8)) -#define MAP_SECRET_BASE_TREE4 (22 | (25 << 8)) -#define MAP_SECRET_BASE_SHRUB4 (23 | (25 << 8)) -#define MAP_BATTLE_COLOSSEUM_2P (24 | (25 << 8)) -#define MAP_TRADE_CENTER (25 | (25 << 8)) -#define MAP_RECORD_CORNER (26 | (25 << 8)) -#define MAP_BATTLE_COLOSSEUM_4P (27 | (25 << 8)) -#define MAP_CONTEST_HALL (28 | (25 << 8)) -#define MAP_UNKNOWN_LINK_CONTEST_ROOM_25_29 (29 | (25 << 8)) -#define MAP_UNKNOWN_LINK_CONTEST_ROOM_25_30 (30 | (25 << 8)) -#define MAP_UNKNOWN_LINK_CONTEST_ROOM_25_31 (31 | (25 << 8)) -#define MAP_UNKNOWN_LINK_CONTEST_ROOM_25_32 (32 | (25 << 8)) -#define MAP_UNKNOWN_LINK_CONTEST_ROOM_25_33 (33 | (25 << 8)) -#define MAP_UNKNOWN_LINK_CONTEST_ROOM_25_34 (34 | (25 << 8)) -#define MAP_CONTEST_HALL_BEAUTY (35 | (25 << 8)) -#define MAP_CONTEST_HALL_TOUGH (36 | (25 << 8)) -#define MAP_CONTEST_HALL_COOL (37 | (25 << 8)) -#define MAP_CONTEST_HALL_SMART (38 | (25 << 8)) -#define MAP_CONTEST_HALL_CUTE (39 | (25 << 8)) -#define MAP_INSIDE_OF_TRUCK (40 | (25 << 8)) -#define MAP_SS_TIDAL_CORRIDOR (41 | (25 << 8)) -#define MAP_SS_TIDAL_LOWER_DECK (42 | (25 << 8)) -#define MAP_SS_TIDAL_ROOMS (43 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE01 (44 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE02 (45 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE03 (46 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE04 (47 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE05 (48 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE06 (49 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE07 (50 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE08 (51 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE09 (52 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE10 (53 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE11 (54 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE12 (55 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE13 (56 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE14 (57 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE15 (58 | (25 << 8)) -#define MAP_BATTLE_PYRAMID_SQUARE16 (59 | (25 << 8)) -#define MAP_UNION_ROOM (60 | (25 << 8)) +#define MAP_SECRET_BASE_RED_CAVE1 (0 | (25 << 8)) +#define MAP_SECRET_BASE_BROWN_CAVE1 (1 | (25 << 8)) +#define MAP_SECRET_BASE_BLUE_CAVE1 (2 | (25 << 8)) +#define MAP_SECRET_BASE_YELLOW_CAVE1 (3 | (25 << 8)) +#define MAP_SECRET_BASE_TREE1 (4 | (25 << 8)) +#define MAP_SECRET_BASE_SHRUB1 (5 | (25 << 8)) +#define MAP_SECRET_BASE_RED_CAVE2 (6 | (25 << 8)) +#define MAP_SECRET_BASE_BROWN_CAVE2 (7 | (25 << 8)) +#define MAP_SECRET_BASE_BLUE_CAVE2 (8 | (25 << 8)) +#define MAP_SECRET_BASE_YELLOW_CAVE2 (9 | (25 << 8)) +#define MAP_SECRET_BASE_TREE2 (10 | (25 << 8)) +#define MAP_SECRET_BASE_SHRUB2 (11 | (25 << 8)) +#define MAP_SECRET_BASE_RED_CAVE3 (12 | (25 << 8)) +#define MAP_SECRET_BASE_BROWN_CAVE3 (13 | (25 << 8)) +#define MAP_SECRET_BASE_BLUE_CAVE3 (14 | (25 << 8)) +#define MAP_SECRET_BASE_YELLOW_CAVE3 (15 | (25 << 8)) +#define MAP_SECRET_BASE_TREE3 (16 | (25 << 8)) +#define MAP_SECRET_BASE_SHRUB3 (17 | (25 << 8)) +#define MAP_SECRET_BASE_RED_CAVE4 (18 | (25 << 8)) +#define MAP_SECRET_BASE_BROWN_CAVE4 (19 | (25 << 8)) +#define MAP_SECRET_BASE_BLUE_CAVE4 (20 | (25 << 8)) +#define MAP_SECRET_BASE_YELLOW_CAVE4 (21 | (25 << 8)) +#define MAP_SECRET_BASE_TREE4 (22 | (25 << 8)) +#define MAP_SECRET_BASE_SHRUB4 (23 | (25 << 8)) +#define MAP_BATTLE_COLOSSEUM_2P (24 | (25 << 8)) +#define MAP_TRADE_CENTER (25 | (25 << 8)) +#define MAP_RECORD_CORNER (26 | (25 << 8)) +#define MAP_BATTLE_COLOSSEUM_4P (27 | (25 << 8)) +#define MAP_CONTEST_HALL (28 | (25 << 8)) +#define MAP_UNUSED_CONTEST_HALL1 (29 | (25 << 8)) +#define MAP_UNUSED_CONTEST_HALL2 (30 | (25 << 8)) +#define MAP_UNUSED_CONTEST_HALL3 (31 | (25 << 8)) +#define MAP_UNUSED_CONTEST_HALL4 (32 | (25 << 8)) +#define MAP_UNUSED_CONTEST_HALL5 (33 | (25 << 8)) +#define MAP_UNUSED_CONTEST_HALL6 (34 | (25 << 8)) +#define MAP_CONTEST_HALL_BEAUTY (35 | (25 << 8)) +#define MAP_CONTEST_HALL_TOUGH (36 | (25 << 8)) +#define MAP_CONTEST_HALL_COOL (37 | (25 << 8)) +#define MAP_CONTEST_HALL_SMART (38 | (25 << 8)) +#define MAP_CONTEST_HALL_CUTE (39 | (25 << 8)) +#define MAP_INSIDE_OF_TRUCK (40 | (25 << 8)) +#define MAP_SS_TIDAL_CORRIDOR (41 | (25 << 8)) +#define MAP_SS_TIDAL_LOWER_DECK (42 | (25 << 8)) +#define MAP_SS_TIDAL_ROOMS (43 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE01 (44 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE02 (45 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE03 (46 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE04 (47 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE05 (48 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE06 (49 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE07 (50 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE08 (51 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE09 (52 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE10 (53 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE11 (54 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE12 (55 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE13 (56 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE14 (57 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE15 (58 | (25 << 8)) +#define MAP_BATTLE_PYRAMID_SQUARE16 (59 | (25 << 8)) +#define MAP_UNION_ROOM (60 | (25 << 8)) // Map Group 26 #define MAP_SAFARI_ZONE_NORTHWEST (0 | (26 << 8)) diff --git a/include/constants/metatile_labels.h b/include/constants/metatile_labels.h index f7405f46a..836ab6ef2 100644 --- a/include/constants/metatile_labels.h +++ b/include/constants/metatile_labels.h @@ -165,6 +165,8 @@ // gTileset_Cave #define METATILE_Cave_EntranceCover 0x229 +#define METATILE_Cave_CrackedFloor_Hole 0x206 +#define METATILE_Cave_CrackedFloor 0x22F #define METATILE_Cave_SealedChamberEntrance_TopLeft 0x22A #define METATILE_Cave_SealedChamberEntrance_TopMid 0x22B #define METATILE_Cave_SealedChamberEntrance_TopRight 0x22C @@ -191,6 +193,7 @@ #define METATILE_Pacifidlog_HalfSubmergedLogs_Vertical1 0x261 #define METATILE_Pacifidlog_SubmergedLogs_Vertical0 0x25A #define METATILE_Pacifidlog_SubmergedLogs_Vertical1 0x262 +#define METATILE_Pacifidlog_SkyPillar_CrackedFloor_Hole 0x237 #define METATILE_Pacifidlog_SkyPillar_DoorOpen_Top 0x2AA #define METATILE_Pacifidlog_SkyPillar_DoorOpen_Bottom 0x2B2 diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 8f8bb3c47..9c844f400 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -165,15 +165,15 @@ #define MON_DATA_VICTORY_RIBBON 69 #define MON_DATA_ARTIST_RIBBON 70 #define MON_DATA_EFFORT_RIBBON 71 -#define MON_DATA_GIFT_RIBBON_1 72 -#define MON_DATA_GIFT_RIBBON_2 73 -#define MON_DATA_GIFT_RIBBON_3 74 -#define MON_DATA_GIFT_RIBBON_4 75 -#define MON_DATA_GIFT_RIBBON_5 76 -#define MON_DATA_GIFT_RIBBON_6 77 -#define MON_DATA_GIFT_RIBBON_7 78 -#define MON_DATA_FATEFUL_ENCOUNTER 79 -#define MON_DATA_OBEDIENCE 80 +#define MON_DATA_MARINE_RIBBON 72 +#define MON_DATA_LAND_RIBBON 73 +#define MON_DATA_SKY_RIBBON 74 +#define MON_DATA_COUNTRY_RIBBON 75 +#define MON_DATA_NATIONAL_RIBBON 76 +#define MON_DATA_EARTH_RIBBON 77 +#define MON_DATA_WORLD_RIBBON 78 +#define MON_DATA_UNUSED_RIBBONS 79 +#define MON_DATA_EVENT_LEGAL 80 #define MON_DATA_KNOWN_MOVES 81 #define MON_DATA_RIBBON_COUNT 82 #define MON_DATA_RIBBONS 83 @@ -183,6 +183,55 @@ #define MON_DATA_SPATK2 87 #define MON_DATA_SPDEF2 88 +// Ribbon IDs used by TV and Pokénav +#define CHAMPION_RIBBON 0 +#define COOL_RIBBON_NORMAL 1 +#define COOL_RIBBON_SUPER 2 +#define COOL_RIBBON_HYPER 3 +#define COOL_RIBBON_MASTER 4 +#define BEAUTY_RIBBON_NORMAL 5 +#define BEAUTY_RIBBON_SUPER 6 +#define BEAUTY_RIBBON_HYPER 7 +#define BEAUTY_RIBBON_MASTER 8 +#define CUTE_RIBBON_NORMAL 9 +#define CUTE_RIBBON_SUPER 10 +#define CUTE_RIBBON_HYPER 11 +#define CUTE_RIBBON_MASTER 12 +#define SMART_RIBBON_NORMAL 13 +#define SMART_RIBBON_SUPER 14 +#define SMART_RIBBON_HYPER 15 +#define SMART_RIBBON_MASTER 16 +#define TOUGH_RIBBON_NORMAL 17 +#define TOUGH_RIBBON_SUPER 18 +#define TOUGH_RIBBON_HYPER 19 +#define TOUGH_RIBBON_MASTER 20 +#define WINNING_RIBBON 21 +#define VICTORY_RIBBON 22 +#define ARTIST_RIBBON 23 +#define EFFORT_RIBBON 24 +#define MARINE_RIBBON 25 +#define LAND_RIBBON 26 +#define SKY_RIBBON 27 +#define COUNTRY_RIBBON 28 +#define NATIONAL_RIBBON 29 +#define EARTH_RIBBON 30 +#define WORLD_RIBBON 31 + +#define FIRST_GIFT_RIBBON MARINE_RIBBON +#define LAST_GIFT_RIBBON WORLD_RIBBON +#define NUM_GIFT_RIBBONS (1 + LAST_GIFT_RIBBON - FIRST_GIFT_RIBBON) + +// The above gift ribbons (Marine - World) are +// special distribution ribbons that correspond to +// 1 bit each in the Pokémon struct. Gen 4 hard-codes +// each of these to the given name. In Gen 3 they're +// used to get an index into giftRibbons in the save block, +// which can have a value 0-64 (0 is 'no ribbon') that +// corresponds to one of the special ribbons listed +// in gGiftRibbonDescriptionPointers. Most of these were +// never distributed +#define MAX_GIFT_RIBBON 64 + #define MIN_LEVEL 1 #define MAX_LEVEL 100 @@ -240,8 +289,6 @@ #define MAX_TOTAL_EVS 510 #define EV_ITEM_RAISE_LIMIT 100 -#define UNOWN_FORM_COUNT 28 - // Battle move flags #define FLAG_MAKES_CONTACT (1 << 0) #define FLAG_PROTECT_AFFECTED (1 << 1) @@ -316,6 +363,12 @@ #define EVOS_PER_MON 5 +// Evolution 'modes,' for GetEvolutionTargetSpecies +#define EVO_MODE_NORMAL 0 +#define EVO_MODE_TRADE 1 +#define EVO_MODE_ITEM_USE 2 +#define EVO_MODE_ITEM_CHECK 3 // If an Everstone is being held, still want to show that the stone *could* be used on that Pokémon to evolve + #define NUM_MALE_LINK_FACILITY_CLASSES 8 #define NUM_FEMALE_LINK_FACILITY_CLASSES 8 diff --git a/include/constants/secret_bases.h b/include/constants/secret_bases.h index 2f405317d..e9188fbf5 100755 --- a/include/constants/secret_bases.h +++ b/include/constants/secret_bases.h @@ -12,106 +12,160 @@ // The secret base's map is determined by (id / 10). The ones // digit is used to differentiate secret bases using the same map. // Therefore, each secret base map can be used by up to 10 different -// secret bases in the game. These ids are 1-based, but there is no -// apparent reason for that. +// secret bases in the game. + +// * 4 is for each byte of data per secret base group in sSecretBaseEntrancePositions +// They are the map number, the entrance warp id, and the x/y position in front of the computer +#define SECRET_BASE_GROUP(idx) ((idx) * 4) +#define SECRET_BASE_ID_TO_GROUP(baseId) SECRET_BASE_GROUP((baseId) / 10) #define SECRET_BASE_RED_CAVE1_1 1 #define SECRET_BASE_RED_CAVE1_2 2 #define SECRET_BASE_RED_CAVE1_3 3 +#define SECRET_BASE_RED_CAVE1 SECRET_BASE_GROUP(0) + #define SECRET_BASE_RED_CAVE2_1 11 #define SECRET_BASE_RED_CAVE2_2 12 #define SECRET_BASE_RED_CAVE2_3 13 +#define SECRET_BASE_RED_CAVE2 SECRET_BASE_GROUP(1) + #define SECRET_BASE_RED_CAVE3_1 21 #define SECRET_BASE_RED_CAVE3_2 22 #define SECRET_BASE_RED_CAVE3_3 23 +#define SECRET_BASE_RED_CAVE3 SECRET_BASE_GROUP(2) + #define SECRET_BASE_RED_CAVE4_1 31 #define SECRET_BASE_RED_CAVE4_2 32 #define SECRET_BASE_RED_CAVE4_3 33 +#define SECRET_BASE_RED_CAVE4 SECRET_BASE_GROUP(3) + #define SECRET_BASE_BROWN_CAVE1_1 41 #define SECRET_BASE_BROWN_CAVE1_2 42 #define SECRET_BASE_BROWN_CAVE1_3 43 +#define SECRET_BASE_BROWN_CAVE1 SECRET_BASE_GROUP(4) + #define SECRET_BASE_BROWN_CAVE2_1 51 #define SECRET_BASE_BROWN_CAVE2_2 52 #define SECRET_BASE_BROWN_CAVE2_3 53 +#define SECRET_BASE_BROWN_CAVE2 SECRET_BASE_GROUP(5) + #define SECRET_BASE_BROWN_CAVE3_1 61 #define SECRET_BASE_BROWN_CAVE3_2 62 #define SECRET_BASE_BROWN_CAVE3_3 63 +#define SECRET_BASE_BROWN_CAVE3 SECRET_BASE_GROUP(6) + #define SECRET_BASE_BROWN_CAVE4_1 71 #define SECRET_BASE_BROWN_CAVE4_2 72 #define SECRET_BASE_BROWN_CAVE4_3 73 +#define SECRET_BASE_BROWN_CAVE4 SECRET_BASE_GROUP(7) + #define SECRET_BASE_BLUE_CAVE1_1 81 #define SECRET_BASE_BLUE_CAVE1_2 82 #define SECRET_BASE_BLUE_CAVE1_3 83 +#define SECRET_BASE_BLUE_CAVE1 SECRET_BASE_GROUP(8) + #define SECRET_BASE_BLUE_CAVE2_1 91 #define SECRET_BASE_BLUE_CAVE2_2 92 #define SECRET_BASE_BLUE_CAVE2_3 93 +#define SECRET_BASE_BLUE_CAVE2 SECRET_BASE_GROUP(9) + #define SECRET_BASE_BLUE_CAVE3_1 101 #define SECRET_BASE_BLUE_CAVE3_2 102 #define SECRET_BASE_BLUE_CAVE3_3 103 +#define SECRET_BASE_BLUE_CAVE3 SECRET_BASE_GROUP(10) + #define SECRET_BASE_BLUE_CAVE4_1 111 #define SECRET_BASE_BLUE_CAVE4_2 112 #define SECRET_BASE_BLUE_CAVE4_3 113 +#define SECRET_BASE_BLUE_CAVE4 SECRET_BASE_GROUP(11) + #define SECRET_BASE_YELLOW_CAVE1_1 121 #define SECRET_BASE_YELLOW_CAVE1_2 122 #define SECRET_BASE_YELLOW_CAVE1_3 123 +#define SECRET_BASE_YELLOW_CAVE1 SECRET_BASE_GROUP(12) + #define SECRET_BASE_YELLOW_CAVE2_1 131 #define SECRET_BASE_YELLOW_CAVE2_2 132 #define SECRET_BASE_YELLOW_CAVE2_3 133 +#define SECRET_BASE_YELLOW_CAVE2 SECRET_BASE_GROUP(13) + #define SECRET_BASE_YELLOW_CAVE3_1 141 #define SECRET_BASE_YELLOW_CAVE3_2 142 #define SECRET_BASE_YELLOW_CAVE3_3 143 +#define SECRET_BASE_YELLOW_CAVE3 SECRET_BASE_GROUP(14) + #define SECRET_BASE_YELLOW_CAVE4_1 151 #define SECRET_BASE_YELLOW_CAVE4_2 152 #define SECRET_BASE_YELLOW_CAVE4_3 153 +#define SECRET_BASE_YELLOW_CAVE4 SECRET_BASE_GROUP(15) + #define SECRET_BASE_TREE1_1 161 #define SECRET_BASE_TREE1_2 162 #define SECRET_BASE_TREE1_3 163 #define SECRET_BASE_TREE1_4 164 +#define SECRET_BASE_TREE1 SECRET_BASE_GROUP(16) + #define SECRET_BASE_TREE2_1 171 #define SECRET_BASE_TREE2_2 172 #define SECRET_BASE_TREE2_3 173 #define SECRET_BASE_TREE2_4 174 +#define SECRET_BASE_TREE2 SECRET_BASE_GROUP(17) + #define SECRET_BASE_TREE3_1 181 #define SECRET_BASE_TREE3_2 182 #define SECRET_BASE_TREE3_3 183 +#define SECRET_BASE_TREE3 SECRET_BASE_GROUP(18) + #define SECRET_BASE_TREE4_1 191 #define SECRET_BASE_TREE4_2 192 #define SECRET_BASE_TREE4_3 193 +#define SECRET_BASE_TREE4 SECRET_BASE_GROUP(19) + #define SECRET_BASE_SHRUB1_1 201 #define SECRET_BASE_SHRUB1_2 202 #define SECRET_BASE_SHRUB1_3 203 #define SECRET_BASE_SHRUB1_4 204 +#define SECRET_BASE_SHRUB1 SECRET_BASE_GROUP(20) + #define SECRET_BASE_SHRUB2_1 211 #define SECRET_BASE_SHRUB2_2 212 #define SECRET_BASE_SHRUB2_3 213 +#define SECRET_BASE_SHRUB2 SECRET_BASE_GROUP(21) + #define SECRET_BASE_SHRUB3_1 221 #define SECRET_BASE_SHRUB3_2 222 #define SECRET_BASE_SHRUB3_3 223 +#define SECRET_BASE_SHRUB3 SECRET_BASE_GROUP(22) + #define SECRET_BASE_SHRUB4_1 231 #define SECRET_BASE_SHRUB4_2 232 #define SECRET_BASE_SHRUB4_3 233 +#define SECRET_BASE_SHRUB4 SECRET_BASE_GROUP(23) + +#define NUM_SECRET_BASE_GROUPS 24 + #endif // GUARD_CONSTANTS_SECRET_BASES_H diff --git a/include/constants/tv.h b/include/constants/tv.h index 4b5f9115b..72eae3f1c 100644 --- a/include/constants/tv.h +++ b/include/constants/tv.h @@ -188,4 +188,22 @@ #define CONTESTLIVE_FLAG_LAST_BOTH_ROUNDS (1 << 6) #define CONTESTLIVE_FLAG_NO_APPEALS (1 << 7) +// TV Show states for Spot the Cuties +#define SPOTCUTIES_STATE_INTRO 0 +#define SPOTCUTIES_STATE_RIBBONS_LOW 1 +#define SPOTCUTIES_STATE_RIBBONS_MID 2 +#define SPOTCUTIES_STATE_RIBBONS_HIGH 3 +#define SPOTCUTIES_STATE_RIBBON_INTRO 4 +#define SPOTCUTIES_STATE_RIBBON_CHAMPION 5 +#define SPOTCUTIES_STATE_RIBBON_COOL 6 +#define SPOTCUTIES_STATE_RIBBON_BEAUTY 7 +#define SPOTCUTIES_STATE_RIBBON_CUTE 8 +#define SPOTCUTIES_STATE_RIBBON_SMART 9 +#define SPOTCUTIES_STATE_RIBBON_TOUGH 10 +#define SPOTCUTIES_STATE_RIBBON_WINNING 11 +#define SPOTCUTIES_STATE_RIBBON_VICTORY 12 +#define SPOTCUTIES_STATE_RIBBON_ARTIST 13 +#define SPOTCUTIES_STATE_RIBBON_EFFORT 14 +#define SPOTCUTIES_STATE_OUTRO 15 + #endif //GUARD_CONSTANTS_TV_H diff --git a/include/constants/weather.h b/include/constants/weather.h index aa0309882..becbdda87 100644 --- a/include/constants/weather.h +++ b/include/constants/weather.h @@ -39,8 +39,6 @@ // These are the "abnormal weather events" that are used // to find Kyogre and Groudon. -#define ABNORMAL_WEATHER_LOCATIONS (MARINE_CAVE_LOCATIONS + TERRA_CAVE_LOCATIONS) -#define ABNORMAL_WEATHER_NONE 0 // Groudon/Terra Cave locations #define TERRA_CAVE_LOCATIONS_START 1 @@ -66,4 +64,7 @@ #define ABNORMAL_WEATHER_ROUTE_129_EAST (MARINE_CAVE_LOCATIONS_START + 7) #define MARINE_CAVE_LOCATIONS 8 +#define ABNORMAL_WEATHER_LOCATIONS (MARINE_CAVE_LOCATIONS + TERRA_CAVE_LOCATIONS) +#define ABNORMAL_WEATHER_NONE 0 + #endif // GUARD_CONSTANTS_WEATHER_H diff --git a/include/data.h b/include/data.h index 260c18152..2f8c44746 100644 --- a/include/data.h +++ b/include/data.h @@ -69,13 +69,13 @@ struct Trainer #define TRAINER_ENCOUNTER_MUSIC(trainer)((gTrainers[trainer].encounterMusic_gender & 0x7F)) -extern const u16 gUnknown_082FF1D8[]; -extern const u32 gUnknown_082FF1F8[]; +extern const u16 gMinigameDigits_Pal[]; +extern const u32 gMinigameDigits_Gfx[]; -extern const struct SpriteFrameImage gUnknown_082FF3A8[]; -extern const struct SpriteFrameImage gUnknown_082FF3C8[]; -extern const struct SpriteFrameImage gUnknown_082FF3E8[]; -extern const struct SpriteFrameImage gUnknown_082FF408[]; +extern const struct SpriteFrameImage gBattlerPicTable_PlayerLeft[]; +extern const struct SpriteFrameImage gBattlerPicTable_OpponentLeft[]; +extern const struct SpriteFrameImage gBattlerPicTable_PlayerRight[]; +extern const struct SpriteFrameImage gBattlerPicTable_OpponentRight[]; extern const struct SpriteFrameImage gTrainerBackPicTable_Brendan[]; extern const struct SpriteFrameImage gTrainerBackPicTable_May[]; extern const struct SpriteFrameImage gTrainerBackPicTable_Red[]; @@ -85,8 +85,8 @@ extern const struct SpriteFrameImage gTrainerBackPicTable_RubySapphireMay[]; extern const struct SpriteFrameImage gTrainerBackPicTable_Wally[]; extern const struct SpriteFrameImage gTrainerBackPicTable_Steven[]; -extern const union AffineAnimCmd *const gUnknown_082FF618[]; -extern const union AffineAnimCmd *const gUnknown_082FF694[]; +extern const union AffineAnimCmd *const gAffineAnims_BattleSpritePlayerSide[]; +extern const union AffineAnimCmd *const gAffineAnims_BattleSpriteOpponentSide[]; extern const union AffineAnimCmd *const gUnknown_082FF6C0[]; extern const union AnimCmd *const gUnknown_082FF70C[]; diff --git a/include/dewford_trend.h b/include/dewford_trend.h index bdb0fc95c..a7ed006f0 100644 --- a/include/dewford_trend.h +++ b/include/dewford_trend.h @@ -4,7 +4,7 @@ void InitDewfordTrend(void); void UpdateDewfordTrendPerDay(u16); void UpdateDewfordTrendPerDay(u16 days); -bool8 sub_81226D8(u16 *a); +bool8 IsPhraseTrendy(u16 *a); void ReceiveEasyChatPairsData(struct EasyChatPair *a, size_t b, u8 unused); diff --git a/include/dodrio_berry_picking.h b/include/dodrio_berry_picking.h index 5decbeccb..a93fb27cd 100644 --- a/include/dodrio_berry_picking.h +++ b/include/dodrio_berry_picking.h @@ -1,7 +1,7 @@ #ifndef GUARD_DODRIO_BERRY_PICKING_H #define GUARD_DODRIO_BERRY_PICKING_H -void StartDodrioBerryPicking(u16 a0, void (*callback)(void)); +void StartDodrioBerryPicking(u16 partyId, void (*exitCallback)(void)); void IsDodrioInParty(void); void ShowDodrioBerryPickingRecords(void); diff --git a/include/easy_chat.h b/include/easy_chat.h index f2ef066d4..4d2bc7c98 100644 --- a/include/easy_chat.h +++ b/include/easy_chat.h @@ -24,55 +24,55 @@ struct EasyChatScreen /*0x01*/ u8 templateId; /*0x02*/ u8 numColumns; /*0x03*/ u8 numRows; - /*0x04*/ u8 state; + /*0x04*/ u8 inputState; /*0x05*/ s8 mainCursorColumn; /*0x06*/ s8 mainCursorRow; - /*0x07*/ u8 unk_07; - /*0x08*/ u8 stateBackup; - /*0x09*/ u8 unk_09; - /*0x0A*/ s8 unk_0a; - /*0x0B*/ s8 unk_0b; - /*0x0C*/ u8 unk_0c; - /*0x0D*/ u8 unk_0d; - /*0x0E*/ u8 unk_0e; - /*0x0F*/ u8 unk_0f; - /*0x10*/ s8 unk_10; - /*0x11*/ s8 unk_11; + /*0x07*/ u8 maxWords; + /*0x08*/ u8 inputStateBackup; + /*0x09*/ bool8 inAlphabetMode; + /*0x0A*/ s8 keyboardColumn; + /*0x0B*/ s8 keyboardRow; + /*0x0C*/ u8 keyboardScrollOffset; + /*0x0D*/ u8 keyboardLastRow; + /*0x0E*/ u8 wordSelectScrollOffset; + /*0x0F*/ u8 wordSelectLastRow; + /*0x10*/ s8 wordSelectColumn; + /*0x11*/ s8 wordSelectRow; /*0x12*/ u8 displayedPersonType; - /*0x13*/ u8 unk_13; - /*0x14*/ u8 unk_14[0x20]; + /*0x13*/ u8 unused; // Set to 0, never read + /*0x14*/ u8 quizTitle[32]; /*0x34*/ const u8 *titleText; - /*0x38*/ u16 *words; - /*0x3C*/ u16 ecWordBuffer[9]; + /*0x38*/ u16 *savedPhrase; + /*0x3C*/ u16 currentPhrase[9]; }; -struct Unk203A11C +struct EasyChatScreenControl { - u16 unk0; + u16 funcState; u16 windowId; - u16 unk4; - u8 unk6; - u8 unk7; - s8 unk8; - u8 unk9; - u8 unkA; - u8 unkB[0xC1]; - u8 unkCC[0x202]; - u16 unk2CE; - int unk2D0; - int unk2D4; - struct Sprite *unk2D8; - struct Sprite *unk2DC; - struct Sprite *unk2E0; - struct Sprite *unk2E4; - struct Sprite *unk2E8; - struct Sprite *unk2EC; - struct Sprite *unk2F0; - struct Sprite *unk2F4; - struct Sprite *unk2F8; - struct Sprite *unk2FC; - u16 unk300[BG_SCREEN_SIZE / 2]; - u16 unkB00[BG_SCREEN_SIZE / 2]; + u16 currentFuncId; + u8 curWindowAnimState; + u8 destWindowAnimState; + s8 windowAnimStateDir; + u8 modeWindowState; + bool8 fourFooterOptions; // Never read (template is used directly instead) + u8 phrasePrintBuffer[193]; + u8 wordSelectPrintBuffer[514]; + u16 scrollOffset; + int scrollDest; + int scrollSpeed; + struct Sprite *mainCursorSprite; + struct Sprite *rectangleCursorSpriteRight; + struct Sprite *rectangleCursorSpriteLeft; + struct Sprite *wordSelectCursorSprite; + struct Sprite *buttonWindowSprite; + struct Sprite *modeWindowSprite; + struct Sprite *scrollIndicatorUpSprite; + struct Sprite *scrollIndicatorDownSprite; + struct Sprite *startButtonSprite; + struct Sprite *selectButtonSprite; + u16 bg1TilemapBuffer[BG_SCREEN_SIZE / 2]; + u16 bg3TilemapBuffer[BG_SCREEN_SIZE / 2]; }; struct EasyChatPhraseFrameDimensions @@ -104,15 +104,15 @@ struct EasyChatGroup u16 numEnabledWords; }; -struct Unk203A120 +struct EasyChatScreenWordData { - u16 unk0; - u16 unk2[EC_NUM_GROUPS]; - u16 unk2E[27]; - u16 unk64[27][270]; - u8 filler3958[0x2C]; - u16 unk3984[0x10E]; - u16 unk3BA0; + u16 numUnlockedGroups; + u16 unlockedGroupIds[EC_NUM_GROUPS]; + u16 numUnlockedAlphabetWords[EC_NUM_ALPHABET_GROUPS]; + u16 unlockedAlphabetWords[EC_NUM_ALPHABET_GROUPS][EC_MAX_WORDS_IN_GROUP]; + u8 unused[44]; + u16 selectedGroupWords[EC_MAX_WORDS_IN_GROUP]; + u16 numSelectedGroupWords; }; /*size = 0x3BA4*/ struct EasyChatWordsByLetter @@ -124,16 +124,16 @@ struct EasyChatWordsByLetter void InitEasyChatPhrases(void); void ShowEasyChatScreen(void); u8 * CopyEasyChatWord(u8 *dest, u16 word); -bool32 sub_811F8D8(int word); +bool32 IsEasyChatAnswerUnlocked(int word); void InitializeEasyChatWordArray(u16 *words, u16 length); u8 *ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 columns, u16 rows); -bool8 ECWord_CheckIfOutsideOfValidRange(u16 word); +bool8 IsBardWordInvalid(u16 word); u16 GetRandomEasyChatWordFromGroup(u16 group); u16 GetNewHipsterPhraseToTeach(void); u16 EasyChat_GetNumWordsInGroup(u8); u16 GetRandomEasyChatWordFromUnlockedGroup(u16); void DoEasyChatScreen(u8 type, u16 *words, MainCallback callback, u8 displayedPersonType); -void sub_811F8BC(void); +void InitQuestionnaireWords(void); void UnlockAdditionalPhrase(u8 additionalPhraseId); #endif // GUARD_EASYCHAT_H diff --git a/include/event_object_lock.h b/include/event_object_lock.h index 0226eb632..9d31a25fd 100644 --- a/include/event_object_lock.h +++ b/include/event_object_lock.h @@ -1,12 +1,12 @@ #ifndef GUARD_EVENT_OBJECT_LOCK_H #define GUARD_EVENT_OBJECT_LOCK_H -bool8 sub_80983C4(void); +bool8 IsFreezePlayerFinished(void); void ScriptFreezeObjectEvents(void); -bool8 sub_809847C(void); +bool8 IsFreezeSelectedObjectAndPlayerFinished(void); void LockSelectedObjectEvent(void); -void sub_8098630(void); -bool8 sub_8098734(void); +void FreezeForApproachingTrainers(void); +bool8 IsFreezeObjectAndPlayerFinished(void); void ScriptUnfreezeObjectEvents(void); void UnionRoom_UnlockPlayerAndChatPartner(void); diff --git a/include/event_object_movement.h b/include/event_object_movement.h index cd76cac11..1e754dcd9 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -106,11 +106,11 @@ void ObjectEventSetGraphicsId(struct ObjectEvent *, u8 graphicsId); void ObjectEventTurn(struct ObjectEvent *, u8); void ObjectEventTurnByLocalIdAndMap(u8, u8, u8, u8); const struct ObjectEventGraphicsInfo *GetObjectEventGraphicsInfo(u8 graphicsId); -void npc_by_local_id_and_map_set_field_1_bit_x20(u8, u8, u8, u8); +void SetObjectInvisibility(u8, u8, u8, bool8); void FreeAndReserveObjectSpritePalettes(void); void SetObjectEventSpritePosByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y); -void sub_808E7E4(u8, u8, u8); -void sub_808E78C(u8, u8, u8, u8); +void ResetObjectPriority(u8, u8, u8); +void SetObjectPriority(u8, u8, u8, u8); void sub_808E75C(s16, s16); void ObjectEventGetLocalIdAndMap(struct ObjectEvent *objectEvent, void *localId, void *mapNum, void *mapGroup); void ShiftObjectEventCoords(struct ObjectEvent *, s16, s16); @@ -189,7 +189,7 @@ void DestroyExtraMovementTask(u8); void UnfreezeObjectEvents(void); void FreezeObjectEventsExceptOne(u8 objectEventId); void TurnObjectEventSprite(u8, u8); -void sub_8098074(u8 var1, u8 var2); +void FreezeObjectEventsExceptTwo(u8 objectEventId1, u8 objectEventId2); void FreezeObjectEvents(void); bool8 FreezeObjectEvent(struct ObjectEvent *objectEvent); u8 GetMoveDirectionFastAnimNum(u8); @@ -203,7 +203,7 @@ s16 GetFigure8XOffset(s16 idx); s16 GetFigure8YOffset(s16 idx); void CameraObjectReset2(void); u8 GetObjectEventBerryTreeId(u8 objectEventId); -void sub_8092EF0(u8 mapId, u8 mapNumber, u8 mapGroup); +void SetBerryTreeJustPicked(u8 mapId, u8 mapNumber, u8 mapGroup); bool8 IsBerryTreeSparkling(u8, u8, u8); void MovementType_None(struct Sprite *); @@ -255,7 +255,7 @@ void MovementType_CopyPlayer(struct Sprite *); void MovementType_TreeDisguise(struct Sprite *); void MovementType_MountainDisguise(struct Sprite *); void MovementType_CopyPlayerInGrass(struct Sprite *); -void MovementType_Hidden(struct Sprite *); +void MovementType_Buried(struct Sprite *); void MovementType_WalkInPlace(struct Sprite *); void MovementType_JogInPlace(struct Sprite *); void MovementType_RunInPlace(struct Sprite *); @@ -307,11 +307,11 @@ u8 MovementType_WanderLeftAndRight_Step6(struct ObjectEvent *, struct Sprite *); u8 MovementType_FaceDirection_Step0(struct ObjectEvent *, struct Sprite *); u8 MovementType_FaceDirection_Step1(struct ObjectEvent *, struct Sprite *); u8 MovementType_FaceDirection_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_BerryTreeGrowth_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementType_BerryTreeGrowth_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_BerryTreeGrowth_Step2(struct ObjectEvent *, struct Sprite *); -u8 MovementType_BerryTreeGrowth_Step3(struct ObjectEvent *, struct Sprite *); -u8 MovementType_BerryTreeGrowth_Step4(struct ObjectEvent *, struct Sprite *); +u8 MovementType_BerryTreeGrowth_Normal(struct ObjectEvent *, struct Sprite *); +u8 MovementType_BerryTreeGrowth_Move(struct ObjectEvent *, struct Sprite *); +u8 MovementType_BerryTreeGrowth_SparkleStart(struct ObjectEvent *, struct Sprite *); +u8 MovementType_BerryTreeGrowth_Sparkle(struct ObjectEvent *, struct Sprite *); +u8 MovementType_BerryTreeGrowth_SparkleEnd(struct ObjectEvent *, struct Sprite *); u8 MovementType_FaceDownAndUp_Step0(struct ObjectEvent *, struct Sprite *); u8 MovementType_FaceDownAndUp_Step1(struct ObjectEvent *, struct Sprite *); u8 MovementType_FaceDownAndUp_Step2(struct ObjectEvent *, struct Sprite *); @@ -413,7 +413,7 @@ bool8 cph_IM_DIFFERENT(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); bool8 CopyablePlayerMovement_GoSpeed4(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); bool8 CopyablePlayerMovement_Jump(struct ObjectEvent *, struct Sprite *, u8, bool8(u8)); u8 MovementType_CopyPlayerInGrass_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementType_Hidden_Step0(struct ObjectEvent *, struct Sprite *); +u8 MovementType_Buried_Step0(struct ObjectEvent *, struct Sprite *); u8 MovementType_WalkInPlace_Step0(struct ObjectEvent *, struct Sprite *); u8 MovementType_MoveInPlace_Step1(struct ObjectEvent *, struct Sprite *); u8 MovementType_WalkSlowlyInPlace_Step0(struct ObjectEvent *, struct Sprite *); diff --git a/include/event_scripts.h b/include/event_scripts.h index 851559724..79ef0ea14 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -3,7 +3,7 @@ extern const u8 EventScript_TestSignpostMsg[]; extern const u8 EventScript_TryGetTrainerScript[]; -extern const u8 EventScript_271354[]; +extern const u8 EventScript_StartTrainerApproach[]; extern const u8 EventScript_DoNoIntroTrainerBattle[]; extern const u8 EventScript_TryDoDoubleTrainerBattle[]; extern const u8 EventScript_TryDoNormalTrainerBattle[]; @@ -196,22 +196,22 @@ extern const u8 gTVTrainerFanClubText08[]; extern const u8 gTVTrainerFanClubText09[]; extern const u8 gTVTrainerFanClubText10[]; extern const u8 gTVTrainerFanClubText11[]; -extern const u8 gTVCutiesText00[]; -extern const u8 gTVCutiesText01[]; -extern const u8 gTVCutiesText02[]; -extern const u8 gTVCutiesText03[]; -extern const u8 gTVCutiesText04[]; -extern const u8 gTVCutiesText05[]; -extern const u8 gTVCutiesText06[]; -extern const u8 gTVCutiesText07[]; -extern const u8 gTVCutiesText08[]; -extern const u8 gTVCutiesText09[]; -extern const u8 gTVCutiesText10[]; -extern const u8 gTVCutiesText11[]; -extern const u8 gTVCutiesText12[]; -extern const u8 gTVCutiesText13[]; -extern const u8 gTVCutiesText14[]; -extern const u8 gTVCutiesText15[]; +extern const u8 TVSpotTheCuties_Text_Intro[]; +extern const u8 TVSpotTheCuties_Text_RibbonsLow[]; +extern const u8 TVSpotTheCuties_Text_RibbonsMid[]; +extern const u8 TVSpotTheCuties_Text_RibbonsHigh[]; +extern const u8 TVSpotTheCuties_Text_RibbonIntro[]; +extern const u8 TVSpotTheCuties_Text_RibbonChampion[]; +extern const u8 TVSpotTheCuties_Text_RibbonCool[]; +extern const u8 TVSpotTheCuties_Text_RibbonBeauty[]; +extern const u8 TVSpotTheCuties_Text_RibbonCute[]; +extern const u8 TVSpotTheCuties_Text_RibbonSmart[]; +extern const u8 TVSpotTheCuties_Text_RibbonTough[]; +extern const u8 TVSpotTheCuties_Text_RibbonWinning[]; +extern const u8 TVSpotTheCuties_Text_RibbonVictory[]; +extern const u8 TVSpotTheCuties_Text_RibbonArtist[]; +extern const u8 TVSpotTheCuties_Text_RibbonEffort[]; +extern const u8 TVSpotTheCuties_Text_Outro[]; extern const u8 gTVPokemonNewsBattleFrontierText00[]; extern const u8 gTVPokemonNewsBattleFrontierText01[]; extern const u8 gTVPokemonNewsBattleFrontierText02[]; diff --git a/include/evolution_graphics.h b/include/evolution_graphics.h index f52105815..61051c69a 100644 --- a/include/evolution_graphics.h +++ b/include/evolution_graphics.h @@ -3,13 +3,11 @@ void LoadEvoSparkleSpriteAndPal(void); -u8 LaunchTask_PreEvoSparklesSet1(u16 arg0); -u8 LaunchTask_PreEvoSparklesSet2(void); -u8 LaunchTask_PostEvoSparklesSet1(void); -u8 LaunchTask_PostEvoSparklesSet2AndFlash(u16 species); -u8 LaunchTask_PostEvoSparklesSet2AndFlash_Trade(u16 species); -u8 sub_817C3A0(u8 preEvoSpriteID, u8 postEvoSpriteID); - -#define EvoGraphicsTaskEvoStop data[8] +u8 EvolutionSparkles_SpiralUpward(u16 arg0); +u8 EvolutionSparkles_ArcDown(void); +u8 EvolutionSparkles_CircleInward(void); +u8 EvolutionSparkles_SprayAndFlash(u16 species); +u8 EvolutionSparkles_SprayAndFlash_Trade(u16 species); +u8 CycleEvolutionMonSprite(u8 preEvoSpriteID, u8 postEvoSpriteID); #endif // GUARD_EVOLUTION_GRAPHICS_H diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h index aa1a2e0dc..c30ce0b6f 100644 --- a/include/field_player_avatar.h +++ b/include/field_player_avatar.h @@ -34,7 +34,7 @@ u8 PlayerGetZCoord(void); void SetPlayerAvatarTransitionFlags(u16 a); void sub_808BCE8(void); void InitPlayerAvatar(s16 a, s16 b, u8 c, u8 d); -void sub_808B864(void); +void PlayerFreeze(void); void sub_808BCF4(void); void SetSpinStartFacingDir(u8); void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr); diff --git a/include/field_weather.h b/include/field_weather.h index 1af320151..9ecf52501 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -117,7 +117,7 @@ struct Weather // field_weather.c extern struct Weather gWeather; extern struct Weather *const gWeatherPtr; -extern const u16 gUnknown_083970E8[]; +extern const u16 gFogPalette[]; // field_weather_effect.c extern const u8 gWeatherFogHorizontalTiles[]; diff --git a/include/gba/defines.h b/include/gba/defines.h index 2df9a3feb..78c688593 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -50,6 +50,8 @@ #define BG_TILE_H_FLIP(n) (0x400 + (n)) #define BG_TILE_V_FLIP(n) (0x800 + (n)) +#define NUM_BACKGROUNDS 4 + // text-mode BG #define OBJ_VRAM0 (VRAM + 0x10000) #define OBJ_VRAM0_SIZE 0x8000 diff --git a/include/global.berry.h b/include/global.berry.h index 8046d344e..8d1aa369d 100644 --- a/include/global.berry.h +++ b/include/global.berry.h @@ -63,7 +63,7 @@ struct BerryTree { u8 berry; u8 stage:7; - u8 growthSparkle:1; + u8 stopGrowth:1; u16 minutesUntilNextStage; u8 berryYield; u8 regrowthCount:4; diff --git a/include/global.h b/include/global.h index 9788f6fdf..005115f3e 100644 --- a/include/global.h +++ b/include/global.h @@ -9,6 +9,7 @@ #include "constants/flags.h" #include "constants/vars.h" #include "constants/species.h" +#include "constants/berry.h" // Prevent cross-jump optimization. #define BLOCK_CROSS_JUMP asm(""); @@ -79,6 +80,14 @@ #define abs(x) (((x) < 0) ? -(x) : (x)) #endif +// Used in cases where division by 0 can occur in the retail version. +// Avoids invalid opcodes on some emulators, and the otherwise UB. +#ifdef UBFIX +#define SAFE_DIV(a, b) ((b) ? (a) / (b) : 0) +#else +#define SAFE_DIV(a, b) ((a) / (b)) +#endif + // Extracts the upper 16 bits of a 32-bit number #define HIHALF(n) (((n) & 0xFFFF0000) >> 16) @@ -186,13 +195,13 @@ struct Pokedex /*0x44*/ u8 seen[DEX_FLAGS_NO]; }; -struct PokemonJumpResults +struct PokemonJumpRecords { u16 jumpsInRow; - u16 field2; + u16 unused1; // Set to 0, never read u16 excellentsInRow; - u16 field6; - u32 field8; + u16 gamesWithMaxPlayers; + u32 unused2; // Set to 0, never read u32 bestJumpScore; }; @@ -489,7 +498,7 @@ struct SaveBlock2 /*0xB0*/ struct PlayersApprentice playerApprentice; /*0xDC*/ struct Apprentice apprentices[APPRENTICE_COUNT]; /*0x1EC*/ struct BerryCrush berryCrush; - /*0x1FC*/ struct PokemonJumpResults pokeJump; + /*0x1FC*/ struct PokemonJumpRecords pokeJump; /*0x20C*/ struct BerryPickingResults berryPick; /*0x21C*/ struct RankingHall1P hallRecords1P[HALL_FACILITIES_COUNT][2][3]; // From record mixing. /*0x57C*/ struct RankingHall2P hallRecords2P[2][3]; // From record mixing. @@ -512,7 +521,7 @@ struct SecretBaseParty struct SecretBase { /*0x1A9C*/ u8 secretBaseId; - /*0x1A9D*/ u8 sbr_field_1_0:4; + /*0x1A9D*/ bool8 toRegister:4; /*0x1A9D*/ u8 gender:1; /*0x1A9D*/ u8 battledOwnerToday:1; /*0x1A9D*/ u8 registryStatus:2; @@ -521,7 +530,7 @@ struct SecretBase /*0x1AA9*/ u8 language; /*0x1AAA*/ u16 numSecretBasesReceived; /*0x1AAC*/ u8 numTimesEntered; - /*0x1AAD*/ u8 sbr_field_11; + /*0x1AAD*/ u8 unused; /*0x1AAE*/ u8 decorations[DECOR_MAX_SECRET_BASE]; /*0x1ABE*/ u8 decorationPositions[DECOR_MAX_SECRET_BASE]; /*0x1AD0*/ struct SecretBaseParty party; @@ -904,11 +913,57 @@ struct MysteryEventStruct /*0x000 0x322C*/ struct WonderNewsSaveStruct wonderNews; /*0x1c0 0x33EC*/ struct WonderCardSaveStruct wonderCard; /*0x310 0x353C*/ struct MEventBuffer_3430 buffer_310; - /*0x338 0x3564*/ u16 unk_338[4]; + /*0x338 0x3564*/ u16 questionnaireWords[NUM_QUESTIONNAIRE_WORDS]; /*0x340 0x356C*/ struct MysteryEventStruct unk_340; /*0x344 0x3570*/ u32 unk_344[2][5]; }; // 0x36C 0x3598 +// For external event data storage. The majority of these may have never been used. +// In Emerald, the only known used fields are the PokeCoupon and BoxRS ones, but hacking the distribution discs allows Emerald to receive events and set the others +struct ExternalEventData +{ + u8 unknownExternalDataFields1[7]; // if actually used, may be broken up into different fields. + u32 unknownExternalDataFields2:8; + u32 currentPokeCoupons:24; // PokéCoupons stored by Pokémon Colosseum and XD from Mt. Battle runs. Earned PokéCoupons are also added to totalEarnedPokeCoupons. Colosseum/XD caps this at 9,999,999, but will read up to 16,777,215. + u32 gotGoldPokeCouponTitleReward:1; // Master Ball from JP Colosseum Bonus Disc; for reaching 30,000 totalEarnedPokeCoupons + u32 gotSilverPokeCouponTitleReward:1; // Light Ball Pikachu from JP Colosseum Bonus Disc; for reaching 5000 totalEarnedPokeCoupons + u32 gotBronzePokeCouponTitleReward:1; // PP Max from JP Colosseum Bonus Disc; for reaching 2500 totalEarnedPokeCoupons + u32 receivedAgetoCelebi:1; // from JP Colosseum Bonus Disc + u32 unknownExternalDataFields3:4; + u32 totalEarnedPokeCoupons:24; // Used by the JP Colosseum bonus disc. Determines PokéCoupon rank to distribute rewards. Unread in International games. Colosseum/XD caps this at 9,999,999. + u8 unknownExternalDataFields4[5]; // if actually used, may be broken up into different fields. +} __attribute__((packed)); /*size = 0x14*/ + +// For external event flags. The majority of these may have never been used. +// In Emerald, Jirachi cannot normally be received, but hacking the distribution discs allows Emerald to receive Jirachi and set the flag +struct ExternalEventFlags +{ + u8 usedBoxRS:1; // Set by Pokémon Box: Ruby & Sapphire; denotes whether this save has connected to it and triggered the free False Swipe Swablu Egg giveaway. + u8 boxRSEggsUnlocked:2; // Set by Pokémon Box: Ruby & Sapphire; denotes the number of Eggs unlocked from deposits; 1 for ExtremeSpeed Zigzagoon (at 100 deposited), 2 for Pay Day Skitty (at 500 deposited), 3 for Surf Pichu (at 1499 deposited) + u8 padding:5; + u8 unknownFlag1; + u8 receivedGCNJirachi; // Both the US Colosseum Bonus Disc and PAL/AUS Pokémon Channel use this field. One cannot receive a WISHMKR Jirachi and CHANNEL Jirachi with the same savefile. + u8 unknownFlag3; + u8 unknownFlag4; + u8 unknownFlag5; + u8 unknownFlag6; + u8 unknownFlag7; + u8 unknownFlag8; + u8 unknownFlag9; + u8 unknownFlag10; + u8 unknownFlag11; + u8 unknownFlag12; + u8 unknownFlag13; + u8 unknownFlag14; + u8 unknownFlag15; + u8 unknownFlag16; + u8 unknownFlag17; + u8 unknownFlag18; + u8 unknownFlag19; + u8 unknownFlag20; + +} __attribute__((packed));/*size = 0x15*/ + struct SaveBlock1 { /*0x00*/ struct Coords16 pos; @@ -982,7 +1037,9 @@ struct SaveBlock1 /*0x2e90*/ struct ContestWinner contestWinners[NUM_CONTEST_WINNERS]; // see CONTEST_WINNER_* /*0x3030*/ struct DayCare daycare; /*0x3150*/ struct LinkBattleRecords linkBattleRecords; - /*0x31A8*/ u8 giftRibbons[52]; + /*0x31A8*/ u8 giftRibbons[GIFT_RIBBONS_COUNT]; + /*0x31B3*/ struct ExternalEventData externalEventData; + /*0x31C7*/ struct ExternalEventFlags externalEventFlags; /*0x31DC*/ struct Roamer roamer; /*0x31F8*/ struct EnigmaBerry enigmaBerry; /*0x322C*/ struct MEventBuffers unk_322C; diff --git a/include/graphics.h b/include/graphics.h index e07751c13..c3f3b3b72 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4015,8 +4015,6 @@ extern const u32 gPokenavCondition_Tilemap[]; extern const u16 gPokenavOptions_Tilemap[]; extern const u32 gPokenavOptions_Gfx[]; extern const u16 gPokenavOptions_Pal[]; -extern const u8 gPokenavConditionMarker_Gfx[]; -extern const u16 gPokenavConditionMarker_Pal[]; extern const u16 gPokenavLeftHeader_Pal[]; extern const u16 gPokenavHeader_Pal[]; extern const u32 gPokenavHeader_Gfx[]; @@ -4033,9 +4031,9 @@ extern const u32 gPokenavLeftHeaderBeauty_Gfx[]; extern const u32 gPokenavLeftHeaderCute_Gfx[]; extern const u32 gPokenavLeftHeaderSmart_Gfx[]; extern const u32 gPokenavLeftHeaderTough_Gfx[]; -extern const u16 gUnknown_08DDE010[]; -extern const u32 gUnknown_08DDE030[]; -extern const u32 gUnknown_08DDE12C[]; +extern const u16 gPokenavRibbonsSummaryBg_Pal[]; +extern const u32 gPokenavRibbonsSummaryBg_Gfx[]; +extern const u32 gPokenavRibbonsSummaryBg_Tilemap[]; extern const u32 gPageInfoTilemap[]; extern const u32 gUnknown_08D98CC8[]; @@ -4201,8 +4199,8 @@ extern const u32 gBattleAnimSpriteGfx_HumanoidFoot[]; extern const u32 gBattleAnimSpriteGfx_MonsterFoot[]; extern const u32 gBattleAnimSpriteGfx_HumanoidHand[]; extern const u32 gBattleAnimSpriteGfx_NoiseLine[]; -extern const u32 gUnknown_08C2EA50[]; -extern const u32 gUnknown_08C2EA9C[]; +extern const u32 UnusedLevelupAnimationGfx[]; +extern const u32 UnusedLevelupAnimationTilemap[]; extern const u32 gBattleAnimSpriteGfx_YellowUnk[]; extern const u32 gBattleAnimSpriteGfx_RedFist[]; extern const u32 gBattleAnimSpriteGfx_SlamHit[]; @@ -5093,8 +5091,8 @@ extern const u32 gMetalShineGfx[]; extern const u32 gMetalShinePalette[]; extern const u32 gMetalShineTilemap[]; -extern const u32 gUnknown_08C20668[]; -extern const u32 gUnknown_08C20684[]; +extern const u32 gBattleAnimMaskImage_Curse[]; +extern const u32 gBattleAnimMaskTilemap_Curse[]; extern const u32 gBattleStatMask_Gfx[]; extern const u32 gBattleStatMask1_Tilemap[]; extern const u32 gBattleStatMask2_Tilemap[]; @@ -5306,10 +5304,10 @@ extern const u32 gEasyChatWindow_Gfx[]; extern const u32 gEasyChatWindow_Tilemap[]; extern const u32 gEasyChatMode_Gfx[]; extern const u16 gEasyChatMode_Pal[]; -extern const u32 gEasyChatCursor_Gfx[]; -extern const u16 gEasyChatCursor_Pal[]; -extern const u32 gEasyChatRightWindow_Gfx[]; -extern const u16 gEasyChatRightWindow_Pal[]; +extern const u32 gEasyChatRectangleCursor_Gfx[]; +extern const u16 gEasyChatRectangleCursor_Pal[]; +extern const u32 gEasyChatButtonWindow_Gfx[]; +extern const u16 gEasyChatButtonWindow_Pal[]; // Use Pokeblock extern const u32 gUsePokeblockCondition_Gfx[]; @@ -5354,4 +5352,45 @@ extern const u16 gObjectEventPal_May[]; extern const u16 gObjectEventPal_RubySapphireBrendan[]; extern const u16 gObjectEventPal_RubySapphireMay[]; +// Mail +extern const u16 gMailPalette_Orange[]; +extern const u16 gMailPalette_Harbor[]; +extern const u16 gMailPalette_Glitter[]; +extern const u16 gMailPalette_Mech[]; +extern const u16 gMailPalette_Wood[]; +extern const u16 gMailPalette_Wave[]; +extern const u16 gMailPalette_Bead[]; +extern const u16 gMailPalette_Shadow[]; +extern const u16 gMailPalette_Tropic[]; +extern const u16 gMailPalette_Dream[]; +extern const u16 gMailPalette_Fab[]; +extern const u16 gMailPalette_Retro[]; +extern const u8 gMailTiles_Orange[]; +extern const u8 gMailTilemap_Orange[]; +extern const u8 gMailTiles_Harbor[]; +extern const u8 gMailTilemap_Harbor[]; +extern const u8 gMailTiles_Glitter[]; +extern const u8 gMailTilemap_Glitter[]; +extern const u8 gMailTiles_Mech[]; +extern const u8 gMailTilemap_Mech[]; +extern const u8 gMailTiles_Wood[]; +extern const u8 gMailTilemap_Wood[]; +extern const u8 gMailTiles_Wave[]; +extern const u8 gMailTilemap_Wave[]; +extern const u8 gMailTiles_Bead[]; +extern const u8 gMailTilemap_Bead[]; +extern const u8 gMailTiles_Shadow[]; +extern const u8 gMailTilemap_Shadow[]; +extern const u8 gMailTiles_Tropic[]; +extern const u8 gMailTilemap_Tropic[]; +extern const u8 gMailTiles_Dream[]; +extern const u8 gMailTilemap_Dream[]; +extern const u8 gMailTiles_Fab[]; +extern const u8 gMailTilemap_Fab[]; +extern const u8 gMailTiles_Retro[]; +extern const u8 gMailTilemap_Retro[]; + +extern const u8 gMonMarkingsMenu_Gfx[]; +extern const u16 gMonMarkingsMenu_Pal[]; + #endif //GUARD_GRAPHICS_H diff --git a/include/international_string_util.h b/include/international_string_util.h index cf3c5f723..f76fc5be1 100644 --- a/include/international_string_util.h +++ b/include/international_string_util.h @@ -4,7 +4,7 @@ #include "menu.h" #include "list_menu.h" -void sub_81DB52C(u8 *src); +void ConvertInternationalPlayerName(u8 *src); void TVShowConvertInternationalString(u8 *dest, const u8 *src, int language); int GetStringCenterAlignXOffset(int fontId, const u8 *str, int totalWidth); int GetStringRightAlignXOffset(int fontId, const u8 *str, int totalWidth); @@ -16,7 +16,7 @@ int Intl_GetListMenuWidth(const struct ListMenuTemplate *listMenu); void CopyMonCategoryText(int dexNum, u8 *dest); u8 *sub_81DB494(u8 *str, int fontId, const u8 *str2, int totalStringWidth); void PadNameString(u8 *dest, u8 padChar); -void sub_81DB554(u8 *, u8); +void ConvertInternationalPlayerNameStripChar(u8 *, u8); void sub_81DB5AC(u8 *); int sub_81DB604(u8 *); void sub_81DB620(int windowId, int columnStart, int rowStart, int numFillTiles, int numRows); diff --git a/include/item_icon.h b/include/item_icon.h index af03473fb..c93a519bb 100644 --- a/include/item_icon.h +++ b/include/item_icon.h @@ -1,8 +1,8 @@ #ifndef GUARD_ITEM_ICON_H #define GUARD_ITEM_ICON_H -extern void *gItemIconDecompressionBuffer; -extern void *gItemIcon4x4Buffer; +extern u8 *gItemIconDecompressionBuffer; +extern u8 *gItemIcon4x4Buffer; extern const struct SpriteTemplate gItemIconSpriteTemplate; diff --git a/include/link.h b/include/link.h index 086bf787b..3b621e6c1 100644 --- a/include/link.h +++ b/include/link.h @@ -56,17 +56,17 @@ #define LINKCMD_BLENDER_SEND_KEYS 0x4444 #define LINKCMD_BLENDER_SCORE_BEST 0x4523 #define LINKCMD_BLENDER_SCORE_GOOD 0x5432 -#define LINKCMD_0x5555 0x5555 -#define LINKCMD_0x5566 0x5566 +#define LINKCMD_DUMMY_1 0x5555 +#define LINKCMD_DUMMY_2 0x5566 #define LINKCMD_READY_CLOSE_LINK 0x5FFF -#define LINKCMD_0x6666 0x6666 -#define LINKCMD_0x7777 0x7777 +#define LINKCMD_SEND_EMPTY 0x6666 +#define LINKCMD_SEND_0xEE 0x7777 #define LINKCMD_BLENDER_PLAY_AGAIN 0x7779 -#define LINKCMD_0x7FFF 0x7FFF +#define LINKCMD_COUNTDOWN 0x7FFF #define LINKCMD_CONT_BLOCK 0x8888 #define LINKCMD_BLENDER_NO_BERRIES 0x9999 #define LINKCMD_BLENDER_NO_PBLOCK_SPACE 0xAAAA -#define LINKCMD_0xAAAB 0xAAAB +#define LINKCMD_SEND_ITEM 0xAAAB #define LINKCMD_READY_TO_TRADE 0xAABB #define LINKCMD_READY_FINISH_TRADE 0xABCD #define LINKCMD_INIT_BLOCK 0xBBBB @@ -76,17 +76,18 @@ #define LINKCMD_START_TRADE 0xCCDD #define LINKCMD_CONFIRM_FINISH_TRADE 0xDCBA #define LINKCMD_SET_MONS_TO_TRADE 0xDDDD -#define LINKCMD_0xDDEE 0xDDEE +#define LINKCMD_PLAYER_CANCEL_TRADE 0xDDEE #define LINKCMD_REQUEST_CANCEL 0xEEAA -#define LINKCMD_CANCEL_TRADE 0xEEBB -#define LINKCMD_0xEECC 0xEECC +#define LINKCMD_BOTH_CANCEL_TRADE 0xEEBB +#define LINKCMD_PARTNER_CANCEL_TRADE 0xEECC +#define LINKCMD_NONE 0xEFFF #define LINKTYPE_TRADE 0x1111 #define LINKTYPE_TRADE_CONNECTING 0x1122 #define LINKTYPE_TRADE_SETUP 0x1133 #define LINKTYPE_TRADE_DISCONNECTED 0x1144 #define LINKTYPE_BATTLE 0x2211 -#define LINKTYPE_0x2222 0x2222 // unused battle? +#define LINKTYPE_UNUSED_BATTLE 0x2222 // Unused, inferred from gap #define LINKTYPE_SINGLE_BATTLE 0x2233 #define LINKTYPE_DOUBLE_BATTLE 0x2244 #define LINKTYPE_MULTI_BATTLE 0x2255 @@ -98,7 +99,7 @@ #define LINKTYPE_BERRY_BLENDER_SETUP 0x4411 #define LINKTYPE_BERRY_BLENDER 0x4422 #define LINKTYPE_MYSTERY_EVENT 0x5501 -#define LINKTYPE_0x5502 0x5502 // unused? +#define LINKTYPE_UNUSED_EREADER 0x5502 // Unused, inferred from gap #define LINKTYPE_EREADER 0x5503 #define LINKTYPE_CONTEST_GMODE 0x6601 #define LINKTYPE_CONTEST_EMODE 0x6602 @@ -290,17 +291,17 @@ bool8 HandleLinkConnection(void); void SetLinkDebugValues(u32 seed, u32 flags); void SetBerryBlenderLinkCallback(void); void SetSuppressLinkErrorMessage(bool8 flag); -void sub_800B524(struct LinkPlayer *linkPlayer); +void ConvertLinkPlayerName(struct LinkPlayer *linkPlayer); u8 GetSioMultiSI(void); void ClearSavedLinkPlayers(void); -void BufferLinkErrorInfo(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, u8 unk_06); -void sub_800B348(void); +void BufferLinkErrorInfo(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, bool8 disconnected); +void LocalLinkPlayerToBlock(void); void LinkPlayerFromBlock(u32 who); bool32 Link_AnyPartnersPlayingFRLG_JP(void); void ResetLinkPlayerCount(void); void SaveLinkPlayers(u8 a0); void SetWirelessCommType0(void); -bool32 sub_800B504(void); +bool32 IsLinkRecvQueueLengthAtLeast3(void); extern u16 gLinkPartnersHeldKeys[6]; extern u32 gLinkDebugSeed; diff --git a/include/link_rfu.h b/include/link_rfu.h index 9476da6b7..e1c3a6fba 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -262,7 +262,7 @@ bool8 LinkRfu_GetNameIfSerial7F7D(struct GFtgtGname *buff1, u8 *buff2, u8 idx); s32 sub_800E87C(u8 idx); void CreateTask_RfuIdle(void); void DestroyTask_RfuIdle(void); -void sub_8011AC8(void); +void ClearRecvCommands(void); void LinkRfu_FatalError(void); bool32 sub_8011A9C(void); void sub_80104B0(void); diff --git a/include/main.h b/include/main.h index 16ac31df2..cad5c0ef9 100644 --- a/include/main.h +++ b/include/main.h @@ -37,7 +37,7 @@ struct Main /*0x439*/ u8 oamLoadDisabled:1; /*0x439*/ u8 inBattle:1; - /*0x439*/ u8 field_439_x4:1; + /*0x439*/ u8 anyLinkBattlerHasFrontierPass:1; }; extern const u8 gGameVersion; diff --git a/include/mevent.h b/include/mevent.h index 8c0ebbad7..4b7d39b0c 100755 --- a/include/mevent.h +++ b/include/mevent.h @@ -21,7 +21,7 @@ struct MEventStruct_Unk1442CC u16 unk_0C; u32 unk_10; u16 unk_14; - u16 unk_16[4]; + u16 unk_16[NUM_QUESTIONNAIRE_WORDS]; struct MEventBuffer_3430_Sub unk_20; u8 unk_44; u8 unk_45[7]; @@ -36,7 +36,7 @@ struct WonderNews *GetSavedWonderNews(void); struct WonderCard *GetSavedWonderCard(void); struct MEventBuffer_3430_Sub *sav1_get_mevent_buffer_2(void); struct MysteryEventStruct *sub_801B044(void); -u16 *sub_801B058(void); +u16 *GetQuestionnaireWordsPtr(void); void DestroyWonderNews(void); bool32 sub_801B078(const struct WonderNews *src); bool32 ValidateReceivedWonderNews(void); diff --git a/include/mon_markings.h b/include/mon_markings.h index 3cb04ad48..fda7ad563 100644 --- a/include/mon_markings.h +++ b/include/mon_markings.h @@ -1,37 +1,35 @@ -#ifndef POKEEMERALD_MON_MARKINGS_H -#define POKEEMERALD_MON_MARKINGS_H +#ifndef MON_MARKINGS_H +#define MON_MARKINGS_H #define NUM_MON_MARKINGS 4 -struct PokemonMarkMenu +struct MonMarkingsMenu { - /*0x0000*/ u16 baseTileTag; - /*0x0002*/ u16 basePaletteTag; - /*0x0004*/ u8 markings; // bit flags - /*0x0005*/ s8 cursorPos; - /*0x0006*/ bool8 markingsArray[NUM_MON_MARKINGS]; - /*0x000A*/ u8 cursorBaseY; - /*0x000B*/ bool8 spriteSheetLoadRequired; - /*0x000C*/ struct Sprite *menuWindowSprites[2]; // upper and lower halves of menu window - /*0x0014*/ struct Sprite *menuMarkingSprites[NUM_MON_MARKINGS]; - /*0x0024*/ struct Sprite *unkSprite; - /*0x0028*/ struct Sprite *menuTextSprite; - /*0x002C*/ const u8 *frameTiles; - /*0x0030*/ const u16 *framePalette; - /*0x0034*/ u8 menuWindowSpriteTiles[0x1000]; - /*0x1034*/ u8 filler1030[0x80]; - /*0x10B4*/ u8 tileLoadState; -}; // 10b8 + u16 baseTileTag; + u16 basePaletteTag; + u8 markings; // bit flags + s8 cursorPos; + bool8 markingsArray[NUM_MON_MARKINGS]; + u8 cursorBaseY; + bool8 spriteSheetLoadRequired; + struct Sprite *windowSprites[2]; // upper and lower halves of menu window + struct Sprite *markingSprites[NUM_MON_MARKINGS]; + struct Sprite *cursorSprite; + struct Sprite *textSprite; + const u8 *frameTiles; + const u16 *framePalette; + u8 windowSpriteTiles[0x1000]; + u8 unused[0x80]; + u8 tileLoadState; +}; -void sub_811F90C(struct PokemonMarkMenu *ptr); -void sub_811F918(void); -bool8 sub_811F960(void); -void sub_811FA90(void); -void sub_811FAA4(u8 markings, s16 x, s16 y); -void sub_811FAF8(void); -bool8 MonMarkingsMenuHandleInput(void); -struct Sprite *CreateMonMarkingsSpriteWithPal(u16 tileTag, u16 paletteTag, const u16 *palette); -struct Sprite *sub_811FFB4(u16 tileTag, u16 paletteTag, const u16 *palette); -void sub_8120084(u8 markings, void *dest); +void InitMonMarkingsMenu(struct MonMarkingsMenu *ptr); +void BufferMonMarkingsMenuTiles(void); +void OpenMonMarkingsMenu(u8 markings, s16 x, s16 y); +void FreeMonMarkingsMenu(void); +bool8 HandleMonMarkingsMenuInput(void); +struct Sprite *CreateMonMarkingAllCombosSprite(u16 tileTag, u16 paletteTag, const u16 *palette); +struct Sprite *CreateMonMarkingComboSprite(u16 tileTag, u16 paletteTag, const u16 *palette); +void UpdateMonMarkingTiles(u8 markings, void *dest); -#endif //POKEEMERALD_MON_MARKINGS_H +#endif //MON_MARKINGS_H diff --git a/include/palette.h b/include/palette.h index f874bcd74..072edef56 100644 --- a/include/palette.h +++ b/include/palette.h @@ -14,6 +14,10 @@ #define PALETTE_FADE_STATUS_DONE 0 #define PALETTE_FADE_STATUS_LOADING 0xFF +#define PALETTES_BG 0x0000FFFF +#define PALETTES_OBJECTS 0xFFFF0000 +#define PALETTES_ALL (PALETTES_BG | PALETTES_OBJECTS) + enum { FAST_FADE_IN_FROM_WHITE, diff --git a/include/player_pc.h b/include/player_pc.h index 219c11440..bdf4a4e0e 100644 --- a/include/player_pc.h +++ b/include/player_pc.h @@ -73,7 +73,7 @@ struct PlayerPCItemPageStruct u8 pageItems; u8 count; u8 filler[3]; - u8 scrollIndicatorId; + u8 scrollIndicatorTaskId; }; // Exported type declarations diff --git a/include/pokeball.h b/include/pokeball.h index 1cdb08f94..8ea675ce4 100644 --- a/include/pokeball.h +++ b/include/pokeball.h @@ -34,7 +34,7 @@ extern const struct SpriteTemplate gBallSpriteTemplates[]; u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow); void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battler, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species); u8 CreateTradePokeballSprite(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 h); -void sub_8076918(u8 battler); +void StartHealthboxSlideIn(u8 battler); void DoHitAnimHealthboxEffect(u8 battler); void LoadBallGfx(u8 ballId); void FreeBallGfx(u8 ballId); diff --git a/include/pokemon.h b/include/pokemon.h index 4f74bbed1..67672fb11 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -67,15 +67,15 @@ struct PokemonSubstruct3 /* 0x0A */ u32 victoryRibbon:1; /* 0x0A */ u32 artistRibbon:1; /* 0x0A */ u32 effortRibbon:1; - /* 0x0A */ u32 giftRibbon1:1; - /* 0x0A */ u32 giftRibbon2:1; - /* 0x0A */ u32 giftRibbon3:1; - /* 0x0A */ u32 giftRibbon4:1; - /* 0x0B */ u32 giftRibbon5:1; - /* 0x0B */ u32 giftRibbon6:1; - /* 0x0B */ u32 giftRibbon7:1; - /* 0x0B */ u32 fatefulEncounter:4; - /* 0x0B */ u32 obedient:1; + /* 0x0A */ u32 marineRibbon:1; // never distributed + /* 0x0A */ u32 landRibbon:1; // never distributed + /* 0x0A */ u32 skyRibbon:1; // never distributed + /* 0x0A */ u32 countryRibbon:1; // distributed during Pokémon Festa '04 and '05 to tournament winners + /* 0x0B */ u32 nationalRibbon:1; + /* 0x0B */ u32 earthRibbon:1; + /* 0x0B */ u32 worldRibbon:1; // distributed during Pokémon Festa '04 and '05 to tournament winners + /* 0x0B */ u32 unusedRibbons:4; // discarded in Gen 4 + /* 0x0B */ u32 eventLegal:1; // controls Mew & Deoxys obedience; if set, Pokémon is a fateful encounter in Gen 4+; set for in-game event island legendaries, some distributed events, and Pokémon from XD: Gale of Darkness. }; union PokemonSubstruct @@ -273,7 +273,7 @@ extern const u8 gPPUpSetMask[]; extern const u8 gPPUpAddMask[]; extern const u8 gStatStageRatios[MAX_STAT_STAGE + 1][2]; extern const u16 gLinkPlayerFacilityClasses[]; -extern const struct SpriteTemplate gUnknown_08329D98[]; +extern const struct SpriteTemplate gBattlerSpriteTemplates[]; extern const s8 gNatureStatTable[][5]; void ZeroBoxMonData(struct BoxPokemon *boxMon); @@ -293,12 +293,12 @@ void CreateBattleTowerMon2(struct Pokemon *mon, struct BattleTowerPokemon *src, void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 monId); void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId); void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest); -void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId); -bool8 sub_80688F8(u8 caseId, u8 battlerId); +void CreateEventLegalMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId); +bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId); void SetDeoxysStats(void); u16 GetUnionRoomTrainerPic(void); u16 GetUnionRoomTrainerClass(void); -void CreateObedientEnemyMon(void); +void CreateEventLegalEnemyMon(void); void CalculateMonStats(struct Pokemon *mon); void BoxMonToMon(const struct BoxPokemon *src, struct Pokemon *dest); u8 GetLevelFromMonExp(struct Pokemon *mon); diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index dbd7f2895..c0f823bb1 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -10,14 +10,14 @@ const u8 *GetMonIconPtr(u16 speciesId, u32 personality, u32 frameNo); const u16 *GetValidMonIconPalettePtr(u16 speciesId); u16 GetIconSpecies(u16 species, u32 personality); u16 GetUnownLetterByPersonality(u32 personality); -u16 sub_80D2E84(u16 speciesId); +u16 GetIconSpeciesNoPersonality(u16 speciesId); void LoadMonIconPalettes(void); void LoadMonIconPalette(u16 species); void FreeMonIconPalettes(void); -u8 sub_80D2D78(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, bool32 extra); +u8 CreateMonIconNoPersonality(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, bool32 handleDeoxys); void FreeMonIconPalette(u16 species); void FreeAndDestroyMonIconSprite(struct Sprite *sprite); -u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u32 personality, bool32 extra); +u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u32 personality, bool32 handleDeoxys); u8 UpdateMonIconFrame(struct Sprite *sprite); void LoadMonIconPalette(u16 species); void sub_80D328C(struct Sprite *sprite); diff --git a/include/pokemon_jump.h b/include/pokemon_jump.h index 91733b385..3aaa4fafb 100644 --- a/include/pokemon_jump.h +++ b/include/pokemon_jump.h @@ -3,10 +3,10 @@ #include "main.h" -void StartPokemonJump(u16 monId, MainCallback callback); +void StartPokemonJump(u16 partyId, MainCallback exitCallback); bool32 IsSpeciesAllowedInPokemonJump(u16 species); void IsPokemonJumpSpeciesInParty(void); -void ResetPokeJumpResults(void); +void ResetPokemonJumpRecords(void); void ShowPokemonJumpRecords(void); #endif // GUARD_POKEMON_JUMP_H diff --git a/include/recorded_battle.h b/include/recorded_battle.h index 55353a6d1..5ae4ac12d 100644 --- a/include/recorded_battle.h +++ b/include/recorded_battle.h @@ -5,14 +5,16 @@ extern u32 gRecordedBattleRngSeed; extern u32 gBattlePalaceMoveSelectionRngValue; extern u8 gRecordedBattleMultiplayerId; -void sub_8184DA4(u8 arg0); +#define B_RECORD_MODE_RECORDING 1 +#define B_RECORD_MODE_PLAYBACK 2 + +void RecordedBattle_Init(u8 arg0); void sub_8184E58(void); void RecordedBattle_SetBattlerAction(u8 battlerId, u8 action); void RecordedBattle_ClearBattlerAction(u8 battlerId, u8 bytesToClear); u8 RecordedBattle_GetBattlerAction(u8 battlerId); -u8 sub_81850D0(void); -u8 sub_81850DC(u8 *arg0); -void sub_81851A8(u8 *arg0); +u8 RecordedBattle_BufferNewBattlerData(u8 *dst); +void RecordedBattle_RecordAllBattlerData(u8 *data); bool32 CanCopyRecordedBattleSaveData(void); bool32 MoveRecordedBattleToSaveData(void); void PlayRecordedBattle(void (*CB2_After)(void)); @@ -20,9 +22,9 @@ u8 GetRecordedBattleFrontierFacility(void); u8 GetRecordedBattleFronterBrainSymbol(void); void RecordedBattle_SaveParties(void); u8 GetActiveBattlerLinkPlayerGender(void); -void sub_8185F84(void); -void sub_8185F90(u16 arg0); -u8 sub_8185FAC(void); +void RecordedBattle_ClearFrontierPassFlag(void); +void RecordedBattle_SetFrontierPassFlagFromHword(u16 arg0); +u8 RecordedBattle_GetFrontierPassFlag(void); u8 GetBattleSceneInRecordedBattle(void); u8 GetTextSpeedInRecordedBattle(void); void RecordedBattle_CopyBattlerMoves(void); diff --git a/include/reset_rtc_screen.h b/include/reset_rtc_screen.h index 7c251377d..589616400 100644 --- a/include/reset_rtc_screen.h +++ b/include/reset_rtc_screen.h @@ -1,8 +1,8 @@ #ifndef GUARD_RESET_RTC_SCREEN_H #define GUARD_RESET_RTC_SCREEN_H -extern const struct SpritePalette gSpritePalette_RtcArrow; -extern const struct SpriteTemplate gSpriteTemplate_RtcArrow; +extern const struct SpritePalette gSpritePalette_Arrow; +extern const struct SpriteTemplate gSpriteTemplate_Arrow; void CB2_InitResetRtcScreen(void); diff --git a/include/reshow_battle_screen.h b/include/reshow_battle_screen.h index c22135280..174fb4157 100644 --- a/include/reshow_battle_screen.h +++ b/include/reshow_battle_screen.h @@ -1,7 +1,7 @@ #ifndef GUARD_RESHOW_BATTLE_SCREEN_H #define GUARD_RESHOW_BATTLE_SCREEN_H -void nullsub_35(void); +void ReshowBattleScreenDummy(void); void ReshowBattleScreenAfterMenu(void); #endif // GUARD_RESHOW_BATTLE_SCREEN_H diff --git a/include/save.h b/include/save.h index 18b57502b..948530406 100644 --- a/include/save.h +++ b/include/save.h @@ -29,6 +29,11 @@ struct SaveSectionOffsets u16 size; }; +// Each 4 KiB flash sector contains 3968 bytes of actual data followed by a 128 byte footer +#define SECTOR_DATA_SIZE 3968 +#define SECTOR_FOOTER_SIZE 128 +#define SECTOR_SIZE (SECTOR_DATA_SIZE + SECTOR_FOOTER_SIZE) + // Emerald changes this definition to be the sectors per slot. #define NUM_SECTORS_PER_SLOT 16 diff --git a/include/script.h b/include/script.h index f9fb09b5d..63f6f5aef 100644 --- a/include/script.h +++ b/include/script.h @@ -26,8 +26,6 @@ u8 SetupBytecodeScript(struct ScriptContext *ctx, const u8 *ptr); void SetupNativeScript(struct ScriptContext *ctx, bool8 (*ptr)(void)); void StopScript(struct ScriptContext *ctx); bool8 RunScriptCommand(struct ScriptContext *ctx); -u8 ScriptPush(struct ScriptContext *ctx, const u8 *ptr); -const u8 *ScriptPop(struct ScriptContext *ctx); void ScriptJump(struct ScriptContext *ctx, const u8 *ptr); void ScriptCall(struct ScriptContext *ctx, const u8 *ptr); void ScriptReturn(struct ScriptContext *ctx); diff --git a/include/sound.h b/include/sound.h index 7d47b7456..25ffa2d6e 100644 --- a/include/sound.h +++ b/include/sound.h @@ -1,6 +1,27 @@ #ifndef GUARD_SOUND_H #define GUARD_SOUND_H +enum { + FANFARE_LEVEL_UP, + FANFARE_OBTAIN_ITEM, + FANFARE_EVOLVED, + FANFARE_OBTAIN_TMHM, + FANFARE_HEAL, + FANFARE_OBTAIN_BADGE, + FANFARE_MOVE_DELETED, + FANFARE_OBTAIN_BERRY, + FANFARE_AWAKEN_LEGEND, + FANFARE_SLOTS_JACKPOT, + FANFARE_SLOTS_WIN, + FANFARE_TOO_BAD, + FANFARE_RG_POKE_FLUTE, + FANFARE_RG_OBTAIN_KEY_ITEM, + FANFARE_RG_DEX_RATING, + FANFARE_OBTAIN_B_POINTS, + FANFARE_OBTAIN_SYMBOL, + FANFARE_REGISTER_MATCH_CALL, +}; + void InitMapMusic(void); void MapMusicMain(void); void ResetMapMusic(void); diff --git a/include/task.h b/include/task.h index d0ca34f7f..9d1ee42c4 100644 --- a/include/task.h +++ b/include/task.h @@ -3,6 +3,7 @@ #define HEAD_SENTINEL 0xFE #define TAIL_SENTINEL 0xFF +#define TASK_NONE TAIL_SENTINEL #define NUM_TASKS 16 #define NUM_TASK_DATA 16 diff --git a/include/trainer_see.h b/include/trainer_see.h index 9d88e05fa..ab808c720 100644 --- a/include/trainer_see.h +++ b/include/trainer_see.h @@ -17,8 +17,8 @@ extern bool8 gTrainerApproachedPlayer; extern u8 gApproachingTrainerId; bool8 CheckForTrainersWantingBattle(void); -void sub_80B4578(struct ObjectEvent *var); -void EndTrainerApproach(void); +void SetBuriedTrainerMovement(struct ObjectEvent *var); +void DoTrainerApproach(void); void TryPrepareSecondApproachingTrainer(void); u8 FldEff_ExclamationMarkIcon(void); u8 FldEff_QuestionMarkIcon(void); diff --git a/ld_script.txt b/ld_script.txt index 091b6e693..3976621b1 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -584,7 +584,6 @@ SECTIONS { src/heal_location.o(.rodata); src/region_map.o(.rodata); src/image_processing_effects.o(.rodata); - data/image_processing_effects.o(.rodata); src/decoration.o(.rodata); src/slot_machine.o(.rodata); src/contest_painting.o(.rodata); diff --git a/ld_script_modern.txt b/ld_script_modern.txt index d12d99456..b69ada864 100644 --- a/ld_script_modern.txt +++ b/ld_script_modern.txt @@ -50,6 +50,15 @@ SECTIONS { asm/*.o(.text); } =0 + .text.unlikely : + ALIGN(4) + { + src/crt0.o(.text.unlikely); + src/*.o(.text.unlikely); + gflib/*.o(.text.unlikely); + asm/*.o(.text.unlikely); + } =0 + script_data : ALIGN(4) { diff --git a/src/apprentice.c b/src/apprentice.c index 41facf7ad..caced4914 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -144,7 +144,7 @@ void ResetApprenticeStruct(struct Apprentice *apprentice) u8 i; for (i = 0; i < ARRAY_COUNT(apprentice->speechWon); i++) - apprentice->speechWon[i] = 0xFFFF; + apprentice->speechWon[i] = EC_EMPTY_WORD; apprentice->playerName[0] = EOS; apprentice->id = NUM_APPRENTICES; @@ -158,7 +158,7 @@ void ResetAllApprenticeData(void) for (i = 0; i < APPRENTICE_COUNT; i++) { for (j = 0; j < ARRAY_COUNT(gSaveBlock2Ptr->apprentices[i].speechWon); j++) - gSaveBlock2Ptr->apprentices[i].speechWon[j] = 0xFFFF; + gSaveBlock2Ptr->apprentices[i].speechWon[j] = EC_EMPTY_WORD; gSaveBlock2Ptr->apprentices[i].id = NUM_APPRENTICES; gSaveBlock2Ptr->apprentices[i].playerName[0] = EOS; gSaveBlock2Ptr->apprentices[i].lvlMode = 0; @@ -923,7 +923,7 @@ static void Script_PrintApprenticeMessage(void) { ScriptContext2_Enable(); FreezeObjectEvents(); - sub_808B864(); + PlayerFreeze(); sub_808BCF4(); DrawDialogueFrame(0, 1); PrintApprenticeMessage(); @@ -1083,7 +1083,7 @@ static void ApprenticeBufferString(void) StringCopy(stringDst, ItemId_GetName(PLAYER_APPRENTICE.questions[CURRENT_QUESTION_NUM].data)); break; case APPRENTICE_BUFF_NAME: - TVShowConvertInternationalString(text, GetApprenticeNameInLanguage(PLAYER_APPRENTICE.id, LANGUAGE_ENGLISH), LANGUAGE_ENGLISH); + TVShowConvertInternationalString(text, GetApprenticeNameInLanguage(PLAYER_APPRENTICE.id, GAME_LANGUAGE), GAME_LANGUAGE); StringCopy(stringDst, text); break; case APPRENTICE_BUFF_LEVEL: diff --git a/src/bard_music.c b/src/bard_music.c index 1a61c25ff..114f1cf42 100644 --- a/src/bard_music.c +++ b/src/bard_music.c @@ -1,5 +1,3 @@ - -// Includes #include "global.h" #include "bard_music.h" #include "constants/easy_chat.h" @@ -10,9 +8,9 @@ #include "data/bard_music/default_sound.h" #include "data/bard_music/length_table.h" -s16 CalcWordPitch(int arg0, int songPos) +static s16 CalcWordPitch(int arg0, int songPos) { - return gBardSoundPitchTables[arg0][songPos]; + return sBardSoundPitchTables[arg0][songPos]; } const struct BardSound *GetWordSounds(u16 word) @@ -21,7 +19,7 @@ const struct BardSound *GetWordSounds(u16 word) u32 subword; const struct BardSound (*ptr)[6]; - if (ECWord_CheckIfOutsideOfValidRange(word)) + if (IsBardWordInvalid(word)) { return gBardSound_InvalidWord; } @@ -30,7 +28,7 @@ const struct BardSound *GetWordSounds(u16 word) switch (category) { case EC_GROUP_POKEMON: - case EC_GROUP_POKEMON_2: + case EC_GROUP_POKEMON_NATIONAL: ptr = gBardSounds_Pokemon; break; case EC_GROUP_MOVE_1: diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 5ea08e67f..ebb33a22b 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -99,16 +99,16 @@ static void Cmd_if_equal_u32(void); static void Cmd_if_not_equal_u32(void); static void Cmd_if_user_goes(void); static void Cmd_if_cant_use_belch(void); -static void Cmd_nullsub_2A(void); -static void Cmd_nullsub_2B(void); +static void Cmd_nop_2A(void); +static void Cmd_nop_2B(void); static void Cmd_count_usable_party_mons(void); static void Cmd_get_considered_move(void); static void Cmd_get_considered_move_effect(void); static void Cmd_get_ability(void); static void Cmd_get_highest_type_effectiveness(void); static void Cmd_if_type_effectiveness(void); -static void Cmd_nullsub_32(void); -static void Cmd_nullsub_33(void); +static void Cmd_nop_32(void); +static void Cmd_nop_33(void); static void Cmd_if_status_in_party(void); static void Cmd_if_status_not_in_party(void); static void Cmd_get_weather(void); @@ -144,7 +144,7 @@ static void Cmd_if_field_status(void); static void Cmd_get_move_accuracy(void); static void Cmd_call_if_eq(void); static void Cmd_call_if_move_flag(void); -static void Cmd_nullsub_57(void); +static void Cmd_nop_57(void); static void Cmd_call(void); static void Cmd_goto(void); static void Cmd_end(void); @@ -231,16 +231,16 @@ static const BattleAICmdFunc sBattleAICmdTable[] = Cmd_if_not_equal_u32, // 0x27 Cmd_if_user_goes, // 0x28 Cmd_if_cant_use_belch, // 0x29 - Cmd_nullsub_2A, // 0x2A - Cmd_nullsub_2B, // 0x2B + Cmd_nop_2A, // 0x2A + Cmd_nop_2B, // 0x2B Cmd_count_usable_party_mons, // 0x2C Cmd_get_considered_move, // 0x2D Cmd_get_considered_move_effect, // 0x2E Cmd_get_ability, // 0x2F Cmd_get_highest_type_effectiveness, // 0x30 Cmd_if_type_effectiveness, // 0x31 - Cmd_nullsub_32, // 0x32 - Cmd_nullsub_33, // 0x33 + Cmd_nop_32, // 0x32 + Cmd_nop_33, // 0x33 Cmd_if_status_in_party, // 0x34 Cmd_if_status_not_in_party, // 0x35 Cmd_get_weather, // 0x36 @@ -276,7 +276,7 @@ static const BattleAICmdFunc sBattleAICmdTable[] = Cmd_get_move_accuracy, // 0x54 Cmd_call_if_eq, // 0x55 Cmd_call_if_move_flag, // 0x56 - Cmd_nullsub_57, // 0x57 + Cmd_nop_57, // 0x57 Cmd_call, // 0x58 Cmd_goto, // 0x59 Cmd_end, // 0x5A @@ -1606,11 +1606,11 @@ static void Cmd_if_user_goes(void) } } -static void Cmd_nullsub_2A(void) +static void Cmd_nop_2A(void) { } -static void Cmd_nullsub_2B(void) +static void Cmd_nop_2B(void) { } @@ -1801,11 +1801,11 @@ static void Cmd_if_type_effectiveness(void) gAIScriptPtr += 6; } -static void Cmd_nullsub_32(void) +static void Cmd_nop_32(void) { } -static void Cmd_nullsub_33(void) +static void Cmd_nop_33(void) { } @@ -2393,7 +2393,7 @@ static void Cmd_call_if_move_flag(void) } } -static void Cmd_nullsub_57(void) +static void Cmd_nop_57(void) { } diff --git a/src/battle_anim.c b/src/battle_anim.c index 6613c3639..28da653d9 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -2170,8 +2170,8 @@ void ClearBattleAnimationVars(void) for (i = 0; i < ANIM_ARGS_COUNT; i++) gBattleAnimArgs[i] = 0; - sMonAnimTaskIdArray[0] = 0xFF; - sMonAnimTaskIdArray[1] = 0xFF; + sMonAnimTaskIdArray[0] = TASK_NONE; + sMonAnimTaskIdArray[1] = TASK_NONE; gAnimMoveTurn = 0; sAnimBackgroundFadeState = 0; gAnimMoveIndex = 0; @@ -2247,8 +2247,8 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo for (i = 0; i < ANIM_ARGS_COUNT; i++) gBattleAnimArgs[i] = 0; - sMonAnimTaskIdArray[0] = 0xFF; - sMonAnimTaskIdArray[1] = 0xFF; + sMonAnimTaskIdArray[0] = TASK_NONE; + sMonAnimTaskIdArray[1] = TASK_NONE; sBattleAnimScriptPtr = animsTable[tableId]; gAnimScriptActive = TRUE; gAnimFramesToWait = 0; @@ -2492,7 +2492,7 @@ static void ScriptCmd_end(void) // Keep waiting as long as there are animations to be done. if (gAnimVisualTaskCount != 0 || gAnimSoundTaskCount != 0 - || sMonAnimTaskIdArray[0] != 0xFF || sMonAnimTaskIdArray[1] != 0xFF) + || sMonAnimTaskIdArray[0] != TASK_NONE || sMonAnimTaskIdArray[1] != TASK_NONE) { sSoundAnimFramesToWait = 0; gAnimFramesToWait = 1; @@ -2698,7 +2698,7 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) RequestDma3Fill(0xFF, (void*)(BG_SCREEN_ADDR(28)), 0x1000, 0); } - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); CpuFill16(0, animBg.bgTiles, 0x1000); CpuFill16(0xFF, animBg.bgTilemap, 0x800); @@ -2736,7 +2736,7 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) { RequestDma3Fill(0, (void*)(BG_SCREEN_ADDR(12)), 0x2000, 1); RequestDma3Fill(0, (void*)(BG_SCREEN_ADDR(30)), 0x1000, 1); - sub_80A6B90(&animBg, 2); + GetBattleAnimBgData(&animBg, 2); CpuFill16(0, animBg.bgTiles + 0x1000, 0x1000); CpuFill16(0, animBg.bgTilemap + 0x400, 0x800); SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 2); @@ -2769,7 +2769,7 @@ static void sub_80A46A0(void) if (IsSpeciesNotUnown(gContestResources->moveAnim->species)) { - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); ptr = animBg.bgTilemap; for (i = 0; i < 8; i++) { @@ -2806,20 +2806,20 @@ void sub_80A4720(u16 a, u16 *b, u32 c, u8 d) } } -void sub_80A477C(bool8 to_BG2) +void ResetBattleAnimBg(bool8 toBG2) { struct BattleAnimBgData animBg; - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); - if (!to_BG2 || IsContest()) + if (!toBG2 || IsContest()) { - sub_80A6C68(1); + ClearBattleAnimBg(1); gBattle_BG1_X = 0; gBattle_BG1_Y = 0; } else { - sub_80A6C68(2); + ClearBattleAnimBg(2); gBattle_BG2_X = 0; gBattle_BG2_Y = 0; } @@ -2833,7 +2833,7 @@ static void task_pA_ma0A_obj_to_bg_pal(u8 taskId) spriteId = gTasks[taskId].data[0]; palIndex = gTasks[taskId].data[6]; - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); x = gTasks[taskId].data[1] - (gSprites[spriteId].pos1.x + gSprites[spriteId].pos2.x); y = gTasks[taskId].data[2] - (gSprites[spriteId].pos1.y + gSprites[spriteId].pos2.y); @@ -2880,9 +2880,9 @@ static void ScriptCmd_clearmonbg(void) else battlerId = gBattleAnimTarget; - if (sMonAnimTaskIdArray[0] != 0xFF) + if (sMonAnimTaskIdArray[0] != TASK_NONE) gSprites[gBattlerSpriteIds[battlerId]].invisible = FALSE; - if (animBattlerId > 1 && sMonAnimTaskIdArray[1] != 0xFF) + if (animBattlerId > 1 && sMonAnimTaskIdArray[1] != TASK_NONE) gSprites[gBattlerSpriteIds[battlerId ^ BIT_FLANK]].invisible = FALSE; else animBattlerId = 0; @@ -2906,17 +2906,17 @@ static void sub_80A4980(u8 taskId) else to_BG2 = TRUE; - if (sMonAnimTaskIdArray[0] != 0xFF) + if (sMonAnimTaskIdArray[0] != TASK_NONE) { - sub_80A477C(to_BG2); + ResetBattleAnimBg(to_BG2); DestroyTask(sMonAnimTaskIdArray[0]); - sMonAnimTaskIdArray[0] = 0xFF; + sMonAnimTaskIdArray[0] = TASK_NONE; } if (gTasks[taskId].data[0] > 1) { - sub_80A477C(to_BG2 ^ 1); + ResetBattleAnimBg(to_BG2 ^ 1); DestroyTask(sMonAnimTaskIdArray[1]); - sMonAnimTaskIdArray[1] = 0xFF; + sMonAnimTaskIdArray[1] = TASK_NONE; } DestroyTask(taskId); } @@ -3015,9 +3015,9 @@ static void sub_80A4BB0(u8 taskId) toBG_2 = TRUE; if (IsBattlerSpriteVisible(battlerId)) - sub_80A477C(toBG_2); + ResetBattleAnimBg(toBG_2); if (gTasks[taskId].data[0] > 1 && IsBattlerSpriteVisible(battlerId ^ BIT_FLANK)) - sub_80A477C(toBG_2 ^ 1); + ResetBattleAnimBg(toBG_2 ^ 1); DestroyTask(taskId); } @@ -3764,7 +3764,7 @@ static void ScriptCmd_invisible(void) u8 spriteId; spriteId = GetAnimBattlerSpriteId(sBattleAnimScriptPtr[1]); - if (spriteId != 0xFF) + if (spriteId != SPRITE_NONE) gSprites[spriteId].invisible = TRUE; sBattleAnimScriptPtr += 2; @@ -3775,7 +3775,7 @@ static void ScriptCmd_visible(void) u8 spriteId; spriteId = GetAnimBattlerSpriteId(sBattleAnimScriptPtr[1]); - if (spriteId != 0xFF) + if (spriteId != SPRITE_NONE) gSprites[spriteId].invisible = FALSE; sBattleAnimScriptPtr += 2; @@ -3802,16 +3802,16 @@ static void ScriptCmd_doublebattle_2D(void) r4 = GetBattlerSpriteBGPriorityRank(gBattleAnimTarget); spriteId = GetAnimBattlerSpriteId(ANIM_TARGET); } - if (spriteId != 0xFF) + if (spriteId != SPRITE_NONE) { gSprites[spriteId].invisible = FALSE; if (r4 == 2) gSprites[spriteId].oam.priority = 3; if (r4 == 1) - sub_80A477C(FALSE); + ResetBattleAnimBg(FALSE); else - sub_80A477C(TRUE); + ResetBattleAnimBg(TRUE); } } } @@ -3838,7 +3838,7 @@ static void ScriptCmd_doublebattle_2E(void) spriteId = GetAnimBattlerSpriteId(ANIM_TARGET); } - if (spriteId != 0xFF && r4 == 2) + if (spriteId != SPRITE_NONE && r4 == 2) gSprites[spriteId].oam.priority = 2; } } diff --git a/src/battle_anim_bug.c b/src/battle_anim_bug.c index 422c86934..cc7cd10d4 100644 --- a/src/battle_anim_bug.c +++ b/src/battle_anim_bug.c @@ -270,7 +270,7 @@ static void AnimTranslateWebThread(struct Sprite *sprite) SetAverageBattlerPositions(gBattleAnimTarget, 1, &sprite->data[2], &sprite->data[4]); } - sub_80A6FD4(sprite); + InitAnimLinearTranslationWithSpeed(sprite); sprite->data[5] = gBattleAnimArgs[3]; sprite->callback = AnimTranslateWebThread_Step; } diff --git a/src/battle_anim_dark.c b/src/battle_anim_dark.c index 8f93438e8..6ee70f8a6 100644 --- a/src/battle_anim_dark.c +++ b/src/battle_anim_dark.c @@ -505,7 +505,7 @@ void AnimTask_MoveAttackerMementoShadow(u8 taskId) task->data[3] = GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker); if (task->data[3] == 1) { - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); task->data[10] = gBattle_BG1_Y; SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND | BLDCNT_TGT1_BG1); FillPalette(0, animBg.paletteId * 16, 32); @@ -646,7 +646,7 @@ void AnimTask_MoveTargetMementoShadow(u8 taskId) case 1: if (task->data[3] == 1) { - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); task->data[10] = gBattle_BG1_Y; FillPalette(0, animBg.paletteId * 16, 32); } @@ -846,7 +846,7 @@ static void sub_8114374(u8 priority) for (i = 0; i < MAX_BATTLERS_COUNT; i++) { u8 spriteId = GetAnimBattlerSpriteId(i); - if (spriteId != 0xFF) + if (spriteId != SPRITE_NONE) gSprites[spriteId].oam.priority = priority; } } @@ -869,10 +869,10 @@ void AnimTask_InitMementoShadow(u8 taskId) void sub_8114470(u8 taskId) { u8 toBG2 = GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker) ^ 1 ? 1 : 0; - sub_80A477C(toBG2); + ResetBattleAnimBg(toBG2); if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker))) - sub_80A477C(toBG2 ^ 1); + ResetBattleAnimBg(toBG2 ^ 1); DestroyAnimVisualTask(taskId); } @@ -940,9 +940,9 @@ void AnimTask_MetallicShine(u8 taskId) } spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER); - newSpriteId = sub_80A89C8(gBattleAnimAttacker, spriteId, species); + newSpriteId = CreateInvisibleSpriteCopy(gBattleAnimAttacker, spriteId, species); - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); AnimLoadCompressedBgTilemap(animBg.bgId, gMetalShineTilemap); AnimLoadCompressedBgGfx(animBg.bgId, gMetalShineGfx, animBg.tilesOffset); LoadCompressedPalette(gMetalShinePalette, animBg.paletteId * 16, 32); @@ -985,8 +985,8 @@ static void AnimTask_MetallicShine_Step(u8 taskId) SetGreyscaleOrOriginalPalette(paletteNum, TRUE); DestroySprite(&gSprites[gTasks[taskId].data[0]]); - sub_80A6B30(&animBg); - sub_80A6C68(animBg.bgId); + GetBattleAnimBg1Data(&animBg); + ClearBattleAnimBg(animBg.bgId); if (gTasks[taskId].data[6] == 1) gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].oam.priority++; } @@ -1042,7 +1042,7 @@ void AnimTask_SetGreyscaleOrOriginalPal(u8 taskId) calcSpriteId = TRUE; break; default: - spriteId = 0xFF; + spriteId = SPRITE_NONE; break; } @@ -1052,10 +1052,10 @@ void AnimTask_SetGreyscaleOrOriginalPal(u8 taskId) if (IsBattlerSpriteVisible(battler)) spriteId = gBattlerSpriteIds[battler]; else - spriteId = 0xFF; + spriteId = SPRITE_NONE; } - if (spriteId != 0xFF) + if (spriteId != SPRITE_NONE) SetGreyscaleOrOriginalPalette(gSprites[spriteId].oam.paletteNum + 16, gBattleAnimArgs[1]); DestroyAnimVisualTask(taskId); diff --git a/src/battle_anim_dragon.c b/src/battle_anim_dragon.c index 406902d71..3f1605b78 100644 --- a/src/battle_anim_dragon.c +++ b/src/battle_anim_dragon.c @@ -9,14 +9,14 @@ static void AnimOutrageFlame(struct Sprite *); static void AnimDragonDanceOrb_Step(struct Sprite *); static void AnimOverheatFlame_Step(struct Sprite *); static void AnimTask_DragonDanceWaver_Step(u8); -static void sub_8113574(struct Task *); +static void UpdateDragonDanceScanlineEffect(struct Task *); static void AnimDragonRushStep(struct Sprite *sprite); static void AnimSpinningDracoMeteor(struct Sprite *sprite); static void AnimSpinningDracoMeteorFinish(struct Sprite *sprite); -EWRAM_DATA static u16 gUnknown_0203A100[7] = {0}; +EWRAM_DATA static u16 gUnusedOverheatData[7] = {0}; -static const union AnimCmd gUnknown_08596E60[] = +static const union AnimCmd sAnim_OutrageOverheatFire_0[] = { ANIMCMD_FRAME(0, 4), ANIMCMD_FRAME(16, 4), @@ -26,9 +26,9 @@ static const union AnimCmd gUnknown_08596E60[] = ANIMCMD_JUMP(0), }; -static const union AnimCmd *const gUnknown_08596E78[] = +static const union AnimCmd *const sAnims_OutrageOverheatFire[] = { - gUnknown_08596E60, + sAnim_OutrageOverheatFire_0, }; const struct SpriteTemplate gOutrageFlameSpriteTemplate = @@ -36,7 +36,7 @@ const struct SpriteTemplate gOutrageFlameSpriteTemplate = .tileTag = ANIM_TAG_SMALL_EMBER, .paletteTag = ANIM_TAG_SMALL_EMBER, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gUnknown_08596E78, + .anims = sAnims_OutrageOverheatFire, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimOutrageFlame, @@ -180,7 +180,7 @@ const struct SpriteTemplate gOverheatFlameSpriteTemplate = .tileTag = ANIM_TAG_SMALL_EMBER, .paletteTag = ANIM_TAG_SMALL_EMBER, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gUnknown_08596E78, + .anims = sAnims_OutrageOverheatFire, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimOverheatFlame, @@ -341,7 +341,7 @@ static void AnimOutrageFlame(struct Sprite *sprite) sprite->callback = TranslateSpriteLinearAndFlicker; } -static void sub_8113100(struct Sprite *sprite) +static void StartDragonFireTranslation(struct Sprite *sprite) { SetSpriteCoordsToAnimAttackerCoords(sprite); sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); @@ -392,7 +392,7 @@ void AnimDragonFireToTarget(struct Sprite *sprite) if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) StartSpriteAffineAnim(sprite, 1); - sub_8113100(sprite); + StartDragonFireTranslation(sprite); } void AnimDragonDanceOrb(struct Sprite *sprite) @@ -457,27 +457,27 @@ static void AnimDragonDanceOrb_Step(struct Sprite *sprite) // Used by Dragon Dance void AnimTask_DragonDanceWaver(u8 taskId) { - struct ScanlineEffectParams sp; + struct ScanlineEffectParams scanlineParams; struct Task *task = &gTasks[taskId]; u16 i; - u8 r1; + u8 y; if (GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker) == 1) { - sp.dmaDest = ®_BG1HOFS; + scanlineParams.dmaDest = ®_BG1HOFS; task->data[2] = gBattle_BG1_X; } else { - sp.dmaDest = ®_BG2HOFS; + scanlineParams.dmaDest = ®_BG2HOFS; task->data[2] = gBattle_BG2_X; } - sp.dmaControl = 0xA2600001; - sp.initState = 1; - sp.unused9 = 0; - r1 = GetBattlerYCoordWithElevation(gBattleAnimAttacker); - task->data[3] = r1 - 32; - task->data[4] = r1 + 32; + scanlineParams.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT; + scanlineParams.initState = 1; + scanlineParams.unused9 = 0; + y = GetBattlerYCoordWithElevation(gBattleAnimAttacker); + task->data[3] = y - 32; + task->data[4] = y + 32; if (task->data[3] < 0) task->data[3] = 0; @@ -487,7 +487,7 @@ void AnimTask_DragonDanceWaver(u8 taskId) gScanlineEffectRegBuffers[1][i] = task->data[2]; } - ScanlineEffect_SetParams(sp); + ScanlineEffect_SetParams(scanlineParams); task->func = AnimTask_DragonDanceWaver_Step; } @@ -503,12 +503,12 @@ static void AnimTask_DragonDanceWaver_Step(u8 taskId) if (++task->data[6] == 3) task->data[0]++; } - sub_8113574(task); + UpdateDragonDanceScanlineEffect(task); break; case 1: if (++task->data[1] > 0x3C) task->data[0]++; - sub_8113574(task); + UpdateDragonDanceScanlineEffect(task); break; case 2: if (++task->data[7] > 1) @@ -517,7 +517,7 @@ static void AnimTask_DragonDanceWaver_Step(u8 taskId) if (--task->data[6] == 0) task->data[0]++; } - sub_8113574(task); + UpdateDragonDanceScanlineEffect(task); break; case 3: gScanlineEffect.state = 3; @@ -529,14 +529,14 @@ static void AnimTask_DragonDanceWaver_Step(u8 taskId) } } -static void sub_8113574(struct Task *task) +static void UpdateDragonDanceScanlineEffect(struct Task *task) { - u16 r3 = task->data[5]; + u16 sineIndex = task->data[5]; u16 i; for (i = task->data[3]; i <= task->data[4]; i++) { - gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = ((gSineTable[r3] * task->data[6]) >> 7) + task->data[2]; - r3 = (r3 + 8) & 0xFF; + gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = ((gSineTable[sineIndex] * task->data[6]) >> 7) + task->data[2]; + sineIndex = (sineIndex + 8) & 0xFF; } task->data[5] = (task->data[5] + 9) & 0xFF; @@ -544,18 +544,18 @@ static void sub_8113574(struct Task *task) void AnimOverheatFlame(struct Sprite *sprite) { - int r6 = (gBattleAnimArgs[2] * 3) / 5; int i; + int yAmplitude = (gBattleAnimArgs[2] * 3) / 5; sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[4]; sprite->data[1] = Cos(gBattleAnimArgs[1], gBattleAnimArgs[2]); - sprite->data[2] = Sin(gBattleAnimArgs[1], r6); + sprite->data[2] = Sin(gBattleAnimArgs[1], yAmplitude); sprite->pos1.x += sprite->data[1] * gBattleAnimArgs[0]; sprite->pos1.y += sprite->data[2] * gBattleAnimArgs[0]; sprite->data[3] = gBattleAnimArgs[3]; sprite->callback = AnimOverheatFlame_Step; for (i = 0; i < 7; i++) - gUnknown_0203A100[i] = sprite->data[i]; + gUnusedOverheatData[i] = sprite->data[i]; } static void AnimOverheatFlame_Step(struct Sprite *sprite) diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index 6b528c71e..1235274a3 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -4180,7 +4180,7 @@ static void AnimPresent(struct Sprite* sprite) sprite->callback = AnimItemSteal_Step1; } -static void sub_80FFB90(struct Sprite* sprite) +static void AnimKnockOffOpponentsItem(struct Sprite* sprite) { int zero; sprite->data[0] += ((sprite->data[3] * 128) / sprite->data[4]); @@ -4222,7 +4222,7 @@ static void AnimKnockOffItem(struct Sprite* sprite) sub_80FF9B8(sprite, 40); sprite->data[3] = 3; sprite->data[4] = 60; - sprite->callback = sub_80FFB90; + sprite->callback = AnimKnockOffOpponentsItem; } } @@ -4837,7 +4837,7 @@ void AnimNeedleArmSpike_Step(struct Sprite* sprite) } } -static void sub_81009DC(struct Sprite* sprite) +static void AnimWhipHit_WaitEnd(struct Sprite* sprite) { if (sprite->animEnded) DestroyAnimSprite(sprite); @@ -4865,7 +4865,7 @@ static void AnimWhipHit(struct Sprite* sprite) if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) StartSpriteAnim(sprite, 1); - sprite->callback = sub_81009DC; + sprite->callback = AnimWhipHit_WaitEnd; SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]); sprite->pos1.y += gBattleAnimArgs[1]; } @@ -5444,7 +5444,7 @@ static void AnimLockOnTarget_Step4(struct Sprite* sprite) sprite->data[1] = 0; } - BlendPalettes(sub_80A75AC(1, 1, 1, 1, 1, 0, 0), sprite->data[1], RGB(31, 31, 31)); + BlendPalettes(GetBattleBgPalettesMask(1, 1, 1, 1, 1, 0, 0), sprite->data[1], RGB(31, 31, 31)); if (sprite->data[1] == 16) { int pal; @@ -6097,7 +6097,7 @@ static void AnimMoonlightSparkle_Step(struct Sprite* sprite) void AnimTask_MoonlightEndFade(u8 taskId) { - int a = sub_80A75AC(1, 0, 0, 0, 0, 0, 0) & 0xFFFF; + int a = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0) & 0xFFFF; int b; int c; int d; @@ -6112,7 +6112,7 @@ void AnimTask_MoonlightEndFade(u8 taskId) gTasks[taskId].data[7] = 13; gTasks[taskId].data[8] = 14; gTasks[taskId].data[9] = 15; - b = sub_80A76C4(1, 1, 1, 1); + b = GetBattleMonSpritePalettesMask(1, 1, 1, 1); c = a | b; StorePointerInVars(&gTasks[taskId].data[14], &gTasks[taskId].data[15], (void*)c); b = b | (0x10000 << IndexOfSpritePaletteTag(ANIM_TAG_MOON)); diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index 6c0d76055..9ede25d7b 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -1821,7 +1821,7 @@ static void AnimCoinThrow(struct Sprite *sprite) sprite->data[0] = gBattleAnimArgs[4]; sprite->data[2] = r6; sprite->data[4] = r7; - sprite->callback = sub_80A7000; + sprite->callback = InitAnimLinearTranslationWithSpeedAndPos; StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); } @@ -2606,7 +2606,7 @@ static void AnimBlendThinRing(struct Sprite *sprite) sprite->callback(sprite); } -void sub_8105284(struct Sprite *sprite) +static void AnimHyperVoiceRing_WaitEnd(struct Sprite *sprite) { if (AnimTranslateLinear(sprite)) { @@ -2696,7 +2696,7 @@ void AnimHyperVoiceRing(struct Sprite *sprite) sprite->data[4] = sp1; sprite->data[0] = gBattleAnimArgs[0]; InitAnimLinearTranslation(sprite); - sprite->callback = sub_8105284; + sprite->callback = AnimHyperVoiceRing_WaitEnd; sprite->callback(sprite); } @@ -3143,7 +3143,7 @@ static void AnimTask_FakeOut_Step2(u8 taskId) { gTasks[taskId].data[11] = 0x88; SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG3 | BLDCNT_EFFECT_LIGHTEN); - BlendPalettes(sub_80A75AC(1, 0, 0, 0, 0, 0, 0), 16, RGB(31, 31, 31)); + BlendPalettes(GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0), 16, RGB(31, 31, 31)); } else if (gTasks[taskId].data[10] > 4) { @@ -3285,7 +3285,7 @@ void AnimTask_HeartsBackground(u8 taskId) gBattle_BG1_Y = 0; SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); AnimLoadCompressedBgGfx(animBg.bgId, &gBattleAnimBgImage_Attract, animBg.tilesOffset); AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimBgTilemap_Attract, 0); LoadCompressedPalette(&gBattleAnimBgPalette_Attract, animBg.paletteId * 16, 32); @@ -3332,8 +3332,8 @@ static void AnimTask_HeartsBackground_Step(u8 taskId) } break; case 3: - sub_80A6B30(&animBg); - sub_80A6C68(animBg.bgId); + GetBattleAnimBg1Data(&animBg); + ClearBattleAnimBg(animBg.bgId); gTasks[taskId].data[12]++; break; case 4: @@ -3363,7 +3363,7 @@ void AnimTask_ScaryFace(u8 taskId) gBattle_BG1_Y = 0; SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); if (IsContest()) AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimBgTilemap_ScaryFaceContest, 0); else if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_OPPONENT) @@ -3416,9 +3416,9 @@ static void AnimTask_ScaryFace_Step(u8 taskId) } break; case 3: - sub_80A6B30(&animBg); - sub_80A6C68(1); - sub_80A6C68(2); + GetBattleAnimBg1Data(&animBg); + ClearBattleAnimBg(1); + ClearBattleAnimBg(2); gTasks[taskId].data[12]++; // fall through case 4: @@ -3560,7 +3560,7 @@ static void AnimAngel(struct Sprite *sprite) DestroyAnimSprite(sprite); } -static void sub_8106A64(struct Sprite *sprite) +static void AnimPinkHeart_Step(struct Sprite *sprite) { sprite->data[5]++; sprite->pos2.x = Sin(sprite->data[3], 5); @@ -3589,7 +3589,7 @@ static void AnimPinkHeart(struct Sprite *sprite) sprite->data[3] = (sprite->data[3] + 3) & 0xFF; if (sprite->data[3] > 70) { - sprite->callback = sub_8106A64; + sprite->callback = AnimPinkHeart_Step; sprite->pos1.x += sprite->pos2.x; sprite->pos1.y += sprite->pos2.y; sprite->pos2.x = 0; diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index 1c979fd26..3f88acbe5 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -2361,7 +2361,7 @@ void AnimTask_TransformMon(u8 taskId) if (IsSpeciesNotUnown(gContestResources->moveAnim->targetSpecies)) gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gUnknown_082FF6C0; else - gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gUnknown_082FF694; + gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gAffineAnims_BattleSpriteOpponentSide; StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimAttacker]], 0); } @@ -2427,7 +2427,7 @@ void AnimTask_MorningSunLightBeam(u8 taskId) if (!IsContest()) SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1); - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimMaskTilemap_LightBeam, 0); if (IsContest()) { @@ -2490,8 +2490,8 @@ void AnimTask_MorningSunLightBeam(u8 taskId) } break; case 4: - sub_80A6B30(&animBg); - sub_80A6C68(animBg.bgId); + GetBattleAnimBg1Data(&animBg); + ClearBattleAnimBg(animBg.bgId); if (!IsContest()) SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0); @@ -2608,7 +2608,7 @@ void AnimTask_DoomDesireLightBeam(u8 taskId) if (!IsContest()) SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1); - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimMaskTilemap_LightBeam, 0); if (IsContest()) { @@ -2679,8 +2679,8 @@ void AnimTask_DoomDesireLightBeam(u8 taskId) gTasks[taskId].data[0] = 1; break; case 5: - sub_80A6B30(&animBg); - sub_80A6C68(animBg.bgId); + GetBattleAnimBg1Data(&animBg); + ClearBattleAnimBg(animBg.bgId); if (!IsContest()) SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0); @@ -3288,7 +3288,7 @@ void AnimTask_RolePlaySilhouette(u8 taskId) coord1 = GetBattlerSpriteCoord(gBattleAnimAttacker, 0); coord2 = GetBattlerSpriteCoord(gBattleAnimAttacker, 1); - spriteId = sub_80A8394(species, isBackPic, 0, coord1 + xOffset, coord2, 5, personality, otId, gBattleAnimTarget, 1); + spriteId = CreateAdditionalMonSpriteForMoveAnim(species, isBackPic, 0, coord1 + xOffset, coord2, 5, personality, otId, gBattleAnimTarget, TRUE); gSprites[spriteId].oam.priority = priority; gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND; @@ -3326,7 +3326,7 @@ static void AnimTask_RolePlaySilhouette_Step2(u8 taskId) TrySetSpriteRotScale(&gSprites[spriteId], TRUE, gTasks[taskId].data[10], gTasks[taskId].data[11], 0); if (++gTasks[taskId].data[12] == 9) { - sub_80A749C(&gSprites[spriteId]); + ResetSpriteRotScale_PreserveAffine(&gSprites[spriteId]); DestroySpriteAndFreeResources_(&gSprites[spriteId]); gTasks[taskId].func = DestroyAnimVisualTaskAndDisableBlend; } @@ -3906,7 +3906,7 @@ static void AnimTask_FacadeColorBlend_Step(u8 taskId) // The sliding circle effect used by Refresh and Aromatherapy void AnimTask_StatusClearedEffect(u8 taskId) { - sub_8117854( + StartMonScrollingBgMask( taskId, 0, 0x1A0, @@ -5117,7 +5117,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId) } } - spriteId2 = sub_80A8394(species, isBackPic, 0, x, GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y), subpriority, personality, otId, gBattleAnimAttacker, 0); + spriteId2 = CreateAdditionalMonSpriteForMoveAnim(species, isBackPic, 0, x, GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y), subpriority, personality, otId, gBattleAnimAttacker, FALSE); if (gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies != SPECIES_NONE) BlendPalette((gSprites[spriteId2].oam.paletteNum * 16) | 0x100, 16, 6, RGB_WHITE); diff --git a/src/battle_anim_electric.c b/src/battle_anim_electric.c index 3d61ab703..6407c2fd2 100644 --- a/src/battle_anim_electric.c +++ b/src/battle_anim_electric.c @@ -8,9 +8,9 @@ static void AnimLightning(struct Sprite *); static void AnimLightning_Step(struct Sprite *); -static void sub_810A214(struct Sprite *); -static void sub_810A258(struct Sprite *); -static void sub_810A274(struct Sprite *); +static void AnimUnused_0810A214(struct Sprite *); +static void AnimUnused_0810A214_Step(struct Sprite *); +static void AnimUnused_0810A274(struct Sprite *); static void AnimZapCannonSpark_Step(struct Sprite *); static void AnimThunderboltOrb(struct Sprite *); static void AnimThunderboltOrb_Step(struct Sprite *); @@ -24,12 +24,12 @@ static void AnimElectricChargingParticles(struct Sprite *); static void AnimElectricChargingParticles_Step(struct Sprite *); static void AnimVoltTackleOrbSlide(struct Sprite *); static void AnimVoltTackleOrbSlide_Step(struct Sprite *); -static bool8 sub_810B154(struct Task *task, u8 taskId); +static bool8 CreateVoltTackleBolt(struct Task *task, u8 taskId); static void AnimVoltTackleBolt(struct Sprite *); -static bool8 sub_810B430(struct Task *task, u8 taskId); +static bool8 CreateShockWaveBoltSprite(struct Task *task, u8 taskId); static void AnimShockWaveProgressingBolt(struct Sprite *); -static bool8 sub_810B614(struct Task *task, u8 taskId); -static void sub_810B684(struct Sprite *sprite); +static bool8 CreateShockWaveLightningSprite(struct Task *task, u8 taskId); +static void AnimShockWaveLightning(struct Sprite *sprite); static const union AnimCmd sAnim_Lightning[] = { @@ -57,7 +57,7 @@ const struct SpriteTemplate gLightningSpriteTemplate = .callback = AnimLightning, }; -static const union AffineAnimCmd gUnknown_085956D8[] = +static const union AffineAnimCmd sAnim_Unused_085956D8[] = { AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 20), @@ -65,24 +65,24 @@ static const union AffineAnimCmd gUnknown_085956D8[] = AFFINEANIMCMD_END, }; -static const union AffineAnimCmd *const gUnknown_085956F8[] = +static const union AffineAnimCmd *const sAnims_Unused_085956F8[] = { - gUnknown_085956D8, + sAnim_Unused_085956D8, }; // Unused -const struct SpriteTemplate gUnknown_085956FC = +const struct SpriteTemplate gUnusedSpriteTemplate_085956FC = { .tileTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET, .oam = &gOamData_AffineNormal_ObjNormal_32x32, .anims = gDummySpriteAnimTable, .images = NULL, - .affineAnims = gUnknown_085956F8, - .callback = sub_810A214, + .affineAnims = sAnims_Unused_085956F8, + .callback = AnimUnused_0810A214, }; -static const union AnimCmd gUnknown_08595714[] = +static const union AnimCmd sAnim_Unused_08595714[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_FRAME(16, 5), @@ -93,21 +93,21 @@ static const union AnimCmd gUnknown_08595714[] = ANIMCMD_JUMP(0), }; -static const union AnimCmd *const gUnknown_08595730[] = +static const union AnimCmd *const sAnims_Unused_08595730[] = { - gUnknown_08595714, + sAnim_Unused_08595714, }; // Unused -const struct SpriteTemplate gUnknown_08595734 = +const struct SpriteTemplate gUnusedSpriteTemplate_08595734 = { .tileTag = ANIM_TAG_SHOCK, .paletteTag = ANIM_TAG_SHOCK, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gUnknown_08595730, + .anims = sAnims_Unused_08595730, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810A274, + .callback = AnimUnused_0810A274, }; const struct SpriteTemplate gSparkElectricitySpriteTemplate = @@ -567,23 +567,23 @@ static void AnimLightning_Step(struct Sprite *sprite) DestroyAnimSprite(sprite); } -static void sub_810A214(struct Sprite *sprite) +static void AnimUnused_0810A214(struct Sprite *sprite) { if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) sprite->pos1.x -= gBattleAnimArgs[0]; else sprite->pos1.x += gBattleAnimArgs[0]; - sprite->callback = sub_810A258; + sprite->callback = AnimUnused_0810A214_Step; } -static void sub_810A258(struct Sprite *sprite) +static void AnimUnused_0810A214_Step(struct Sprite *sprite) { if (sprite->affineAnimEnded) DestroySpriteAndMatrix(sprite); } -static void sub_810A274(struct Sprite *sprite) +static void AnimUnused_0810A274(struct Sprite *sprite) { sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); @@ -1180,7 +1180,7 @@ void AnimTask_VoltTackleBolt(u8 taskId) if (++task->data[2] > 0) { task->data[2] = 0; - if (sub_810B154(task, taskId) || sub_810B154(task, taskId)) + if (CreateVoltTackleBolt(task, taskId) || CreateVoltTackleBolt(task, taskId)) task->data[0]++; } break; @@ -1190,7 +1190,7 @@ void AnimTask_VoltTackleBolt(u8 taskId) } } -static bool8 sub_810B154(struct Task *task, u8 taskId) +static bool8 CreateVoltTackleBolt(struct Task *task, u8 taskId) { u8 spriteId = CreateSprite(&gVoltTackleBoltSpriteTemplate, task->data[3], task->data[5], 35); if (spriteId != MAX_SPRITES) @@ -1274,7 +1274,7 @@ void AnimTask_ShockWaveProgressingBolt(u8 taskId) if (++task->data[1] > 0) { task->data[1] = 0; - if (sub_810B430(task, taskId)) + if (CreateShockWaveBoltSprite(task, taskId)) { if (task->data[2] == 5) task->data[0] = 3; @@ -1327,7 +1327,7 @@ void AnimTask_ShockWaveProgressingBolt(u8 taskId) } } -static bool8 sub_810B430(struct Task *task, u8 taskId) +static bool8 CreateShockWaveBoltSprite(struct Task *task, u8 taskId) { u8 spriteId = CreateSprite(&gShockWaveProgressingBoltSpriteTemplate, task->data[6], task->data[7], 35); if (spriteId != MAX_SPRITES) @@ -1397,7 +1397,7 @@ void AnimTask_ShockWaveLightning(u8 taskId) if (++task->data[1] > 1) { task->data[1] = 0; - if (sub_810B614(task, taskId)) + if (CreateShockWaveLightningSprite(task, taskId)) task->data[0]++; } break; @@ -1408,12 +1408,12 @@ void AnimTask_ShockWaveLightning(u8 taskId) } } -bool8 sub_810B614(struct Task *task, u8 taskId) +static bool8 CreateShockWaveLightningSprite(struct Task *task, u8 taskId) { u8 spriteId = CreateSprite(&gLightningSpriteTemplate, task->data[13], task->data[14], task->data[12]); if (spriteId != MAX_SPRITES) { - gSprites[spriteId].callback = sub_810B684; + gSprites[spriteId].callback = AnimShockWaveLightning; gSprites[spriteId].data[6] = taskId; gSprites[spriteId].data[7] = 10; task->data[10]++; @@ -1424,7 +1424,7 @@ bool8 sub_810B614(struct Task *task, u8 taskId) return FALSE; } -static void sub_810B684(struct Sprite *sprite) +static void AnimShockWaveLightning(struct Sprite *sprite) { if (sprite->animEnded) { diff --git a/src/battle_anim_fight.c b/src/battle_anim_fight.c index 477a15b6d..c59a608a7 100644 --- a/src/battle_anim_fight.c +++ b/src/battle_anim_fight.c @@ -6,7 +6,7 @@ #include "trig.h" #include "constants/rgb.h" -static void unc_080B08A0(struct Sprite *); +static void AnimUnused_080B08A0(struct Sprite *); static void AnimSlideHandOrFootToTarget(struct Sprite *); static void AnimFistOrFootRandomPos(struct Sprite *); static void AnimFistOrFootRandomPos_Step(struct Sprite *); @@ -33,7 +33,7 @@ static void AnimForcePalm(struct Sprite *sprite); extern struct SpriteTemplate gBasicHitSplatSpriteTemplate; // Unused -const struct SpriteTemplate gUnknown_08595E14 = +const struct SpriteTemplate gUnusedSpriteTemplate_08595E14 = { .tileTag = ANIM_TAG_HUMANOID_FOOT, .paletteTag = ANIM_TAG_HUMANOID_FOOT, @@ -41,54 +41,46 @@ const struct SpriteTemplate gUnknown_08595E14 = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = unc_080B08A0, + .callback = AnimUnused_080B08A0, }; -static const union AnimCmd sAnim_HandOrFoot[] = +static const union AnimCmd sAnim_Fist[] = { ANIMCMD_FRAME(0, 1), ANIMCMD_END, }; -static const union AnimCmd sAnim_SlidingKick_0[] = +static const union AnimCmd sAnim_FootWide[] = { ANIMCMD_FRAME(16, 1), ANIMCMD_END, }; -static const union AnimCmd sAnim_SlidingKick_1[] = +static const union AnimCmd sAnim_FootTall[] = { ANIMCMD_FRAME(32, 1), ANIMCMD_END, }; -static const union AnimCmd sAnim_CrossChopHand_0[] = +static const union AnimCmd sAnim_HandLeft[] = { ANIMCMD_FRAME(48, 1), ANIMCMD_END, }; -static const union AnimCmd sAnim_CrossChopHand_1[] = +static const union AnimCmd sAnim_HandRight[] = { ANIMCMD_FRAME(48, 1, .hFlip = TRUE), ANIMCMD_END, }; -const union AnimCmd *const gAnims_HandOrFoot[] = +const union AnimCmd *const gAnims_HandsAndFeet[] = { - sAnim_HandOrFoot, -}; - -static const union AnimCmd *const sAnims_SlidingKick[] = -{ - sAnim_SlidingKick_0, - sAnim_SlidingKick_1, -}; - -static const union AnimCmd *const sAnims_CrossChopHand[] = -{ - sAnim_CrossChopHand_0, - sAnim_CrossChopHand_1, + sAnim_Fist, + sAnim_FootWide, + sAnim_FootTall, + sAnim_HandLeft, + sAnim_HandRight, }; const struct SpriteTemplate gKarateChopSpriteTemplate = @@ -96,7 +88,7 @@ const struct SpriteTemplate gKarateChopSpriteTemplate = .tileTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimSlideHandOrFootToTarget, @@ -107,7 +99,7 @@ const struct SpriteTemplate gJumpKickSpriteTemplate = .tileTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimJumpKick, @@ -118,7 +110,7 @@ const struct SpriteTemplate gFistFootSpriteTemplate = .tileTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimBasicFistOrFoot, @@ -129,7 +121,7 @@ const struct SpriteTemplate gFistFootRandomPosSpriteTemplate = .tileTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimFistOrFootRandomPos, @@ -140,7 +132,7 @@ const struct SpriteTemplate gCrossChopHandSpriteTemplate = .tileTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = sAnims_CrossChopHand, + .anims = &gAnims_HandsAndFeet[3], .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimCrossChopHand, @@ -151,7 +143,7 @@ const struct SpriteTemplate gSlidingKickSpriteTemplate = .tileTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = sAnims_SlidingKick, + .anims = &gAnims_HandsAndFeet[1], .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimSlidingKick, @@ -175,7 +167,7 @@ const struct SpriteTemplate gSpinningHandOrFootSpriteTemplate = .tileTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET, .oam = &gOamData_AffineDouble_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gAffineAnims_SpinningHandOrFoot, .callback = AnimSpinningKickOrPunch, @@ -198,7 +190,7 @@ const struct SpriteTemplate gMegaPunchKickSpriteTemplate = .tileTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET, .oam = &gOamData_AffineDouble_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gAffineAnims_MegaPunchKick, .callback = AnimSpinningKickOrPunch, @@ -209,7 +201,7 @@ const struct SpriteTemplate gStompFootSpriteTemplate = .tileTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = sAnims_SlidingKick, + .anims = &gAnims_HandsAndFeet[1], .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimStompFoot, @@ -300,7 +292,7 @@ const struct SpriteTemplate gArmThrustHandSpriteTemplate = .tileTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimArmThrustHit, @@ -404,7 +396,7 @@ const struct SpriteTemplate gFocusPunchFistSpriteTemplate = .tileTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET, .oam = &gOamData_AffineDouble_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = sAffineAnims_FocusPunchFist, .callback = AnimFocusPunchFist, @@ -415,7 +407,7 @@ const struct SpriteTemplate gPalmSpriteTemplate = .tileTag = ANIM_TAG_PURPLE_HAND_OUTLINE, .paletteTag = ANIM_TAG_PURPLE_HAND_OUTLINE, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimBasicFistOrFoot, @@ -490,7 +482,7 @@ static void AnimForcePalm(struct Sprite *sprite) StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); } -static void unc_080B08A0(struct Sprite *sprite) +static void AnimUnused_080B08A0(struct Sprite *sprite) { SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]); sprite->pos1.y += gBattleAnimArgs[1]; @@ -908,7 +900,7 @@ static void AnimSuperpowerOrb_Step(struct Sprite *sprite) InitAnimLinearTranslation(sprite); StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix); - sprite->callback = sub_80A6F98; + sprite->callback = AnimTranslateLinear_WaitEnd; } } @@ -1004,7 +996,7 @@ static void AnimSuperpowerFireball(struct Sprite *sprite) InitAnimLinearTranslation(sprite); StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); - sprite->callback = sub_80A6F98; + sprite->callback = AnimTranslateLinear_WaitEnd; } static void AnimArmThrustHit_Step(struct Sprite *sprite) @@ -1081,7 +1073,7 @@ void AnimTask_MoveSkyUppercutBg(u8 taskId) switch (task->data[0]) { case 0: - sub_80A6DAC(0); + UpdateAnimBg3ScreenSize(FALSE); task->data[8] = gBattleAnimArgs[0]; task->data[0]++; break; @@ -1110,7 +1102,7 @@ void AnimTask_MoveSkyUppercutBg(u8 taskId) { gBattle_BG3_X = 0; gBattle_BG3_Y = 0; - sub_80A6DAC(1); + UpdateAnimBg3ScreenSize(TRUE); DestroyAnimVisualTask(taskId); } } diff --git a/src/battle_anim_fire.c b/src/battle_anim_fire.c index df951ab1a..1fdfd82b1 100644 --- a/src/battle_anim_fire.c +++ b/src/battle_anim_fire.c @@ -10,9 +10,9 @@ static void AnimFireSpiralInward(struct Sprite *); static void AnimFirePlume(struct Sprite *); static void AnimLargeFlame(struct Sprite *); -static void sub_8109028(struct Sprite *); -static void sub_8109064(struct Sprite *); -static void sub_81090D8(struct Sprite *); +static void AnimLargeFlame_Step(struct Sprite *); +static void AnimUnused_8109064(struct Sprite *); +static void AnimUnused_8109064_Step(struct Sprite *); static void AnimSunlight(struct Sprite *); static void AnimEmberFlare(struct Sprite *); static void AnimBurnFlame(struct Sprite *); @@ -162,7 +162,7 @@ const struct SpriteTemplate gFirePlumeSpriteTemplate = }; // Unused -const struct SpriteTemplate gUnknown_08595440 = +const struct SpriteTemplate gUnusedSpriteTemplate_08595440 = { .tileTag = ANIM_TAG_SMALL_EMBER, .paletteTag = ANIM_TAG_SMALL_EMBER, @@ -173,7 +173,7 @@ const struct SpriteTemplate gUnknown_08595440 = .callback = AnimFirePlume, }; -static const union AnimCmd gUnknown_08595458[] = +static const union AnimCmd sAnim_Unused_08595458[] = { ANIMCMD_FRAME(16, 6), ANIMCMD_FRAME(32, 6), @@ -181,21 +181,21 @@ static const union AnimCmd gUnknown_08595458[] = ANIMCMD_JUMP(0), }; -static const union AnimCmd *const gUnknown_08595468[] = +static const union AnimCmd *const sAnims_Unused_08595468[] = { - gUnknown_08595458, + sAnim_Unused_08595458, }; // Unused -const struct SpriteTemplate gUnknown_0859546C = +const struct SpriteTemplate gUnusedSpriteTemplate_0859546C = { .tileTag = ANIM_TAG_SMALL_EMBER, .paletteTag = ANIM_TAG_SMALL_EMBER, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gUnknown_08595468, + .anims = sAnims_Unused_08595468, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8109064, + .callback = AnimUnused_8109064, }; static const union AffineAnimCmd sAffineAnim_SunlightRay[] = @@ -316,23 +316,23 @@ const union AnimCmd *const gAnims_FireBlastCross[] = sAnim_FireBlastCross, }; -static const union AffineAnimCmd gUnknown_08595544[] = +static const union AffineAnimCmd sAnim_Unused_08595544[] = { AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 1), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gUnknown_08595554[] = +static const union AffineAnimCmd sAnim_Unused_08595554[] = { AFFINEANIMCMD_FRAME(0xA0, 0xA0, 0, 0), AFFINEANIMCMD_END, }; // Unused -static const union AffineAnimCmd *const gUnknown_08595564[] = +static const union AffineAnimCmd *const sAnims_Unused_08595564[] = { - gUnknown_08595544, - gUnknown_08595554, + sAnim_Unused_08595544, + sAnim_Unused_08595554, }; const struct SpriteTemplate gFireBlastCrossSpriteTemplate = @@ -597,7 +597,7 @@ static void AnimFirePlume(struct Sprite *sprite) sprite->data[4] = gBattleAnimArgs[3]; sprite->data[3] = gBattleAnimArgs[5]; - sprite->callback = sub_8109028; + sprite->callback = AnimLargeFlame_Step; } static void AnimLargeFlame(struct Sprite *sprite) @@ -619,10 +619,10 @@ static void AnimLargeFlame(struct Sprite *sprite) sprite->data[4] = gBattleAnimArgs[3]; sprite->data[3] = gBattleAnimArgs[5]; - sprite->callback = sub_8109028; + sprite->callback = AnimLargeFlame_Step; } -static void sub_8109028(struct Sprite *sprite) +static void AnimLargeFlame_Step(struct Sprite *sprite) { if (++sprite->data[0] < sprite->data[4]) { @@ -634,7 +634,7 @@ static void sub_8109028(struct Sprite *sprite) DestroySpriteAndMatrix(sprite); } -static void sub_8109064(struct Sprite *sprite) +static void AnimUnused_8109064(struct Sprite *sprite) { SetSpriteCoordsToAnimAttackerCoords(sprite); @@ -656,10 +656,10 @@ static void sub_8109064(struct Sprite *sprite) sprite->data[4] = gBattleAnimArgs[6]; sprite->data[5] = 0; - sprite->callback = sub_81090D8; + sprite->callback = AnimUnused_8109064_Step; } -static void sub_81090D8(struct Sprite *sprite) +static void AnimUnused_8109064_Step(struct Sprite *sprite) { if (sprite->data[3]) { @@ -697,8 +697,6 @@ static void AnimSunlight(struct Sprite *sprite) StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); } -//fire 2 - // Animates the secondary effect of MOVE_EMBER, where the flames grow and slide // horizontally a bit. // arg 0: initial x pixel offset @@ -878,15 +876,14 @@ void AnimTask_EruptionLaunchRocks(u8 taskId) task->func = AnimTask_EruptionLaunchRocks_Step; } -static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTION? +static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) { struct Task *task = &gTasks[taskId]; switch (task->data[0]) { case 0: - sub_80A805C(task, task->data[15], 0x100, 0x100, 0xE0, 0x200, 0x20); - + PrepareEruptAnimTaskData(task, task->data[15], 0x100, 0x100, 0xE0, 0x200, 32); task->data[0]++; case 1: if (++task->data[1] > 1) @@ -899,7 +896,7 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTIO gSprites[task->data[15]].pos2.x = -3; } - if (task->data[5]) + if (task->data[5] != B_SIDE_PLAYER) { if (++task->data[3] > 4) { @@ -908,7 +905,7 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTIO } } - if(!sub_80A80C8(task)) + if(!UpdateEruptAnimTask(task)) { SetBattlerSpriteYOffsetFromYScale(task->data[15]); gSprites[task->data[15]].pos2.x = 0; @@ -922,20 +919,19 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTIO case 2: if (++task->data[1] > 4) { - if (task->data[5]) - sub_80A805C(task, task->data[15], 0xE0, 0x200, 0x180, 0xF0, 0x6); + if (task->data[5] != B_SIDE_PLAYER) + PrepareEruptAnimTaskData(task, task->data[15], 0xE0, 0x200, 0x180, 0xF0, 6); else - sub_80A805C(task, task->data[15], 0xE0, 0x200, 0x180, 0xC0, 0x6); + PrepareEruptAnimTaskData(task, task->data[15], 0xE0, 0x200, 0x180, 0xC0, 6); task->data[1] = 0; task->data[0]++; } break; case 3: - if (!sub_80A80C8(task)) + if (!UpdateEruptAnimTask(task)) { CreateEruptionLaunchRocks(task->data[15], taskId, 6); - task->data[0]++; } break; @@ -952,10 +948,10 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTIO if (++task->data[3] > 0x18) { - if (task->data[5]) - sub_80A805C(task, task->data[15], 0x180, 0xF0, 0x100, 0x100, 0x8); + if (task->data[5] != B_SIDE_PLAYER) + PrepareEruptAnimTaskData(task, task->data[15], 0x180, 0xF0, 0x100, 0x100, 8); else - sub_80A805C(task, task->data[15], 0x180, 0xC0, 0x100, 0x100, 0x8); + PrepareEruptAnimTaskData(task, task->data[15], 0x180, 0xC0, 0x100, 0x100, 8); if (task->data[2] & 1) gSprites[task->data[15]].pos2.y -= 3; @@ -967,14 +963,13 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTIO } break; case 5: - if (task->data[5]) + if (task->data[5] != B_SIDE_PLAYER) gSprites[task->data[15]].pos1.y--; - if (!sub_80A80C8(task)) + if (!UpdateEruptAnimTask(task)) { gSprites[task->data[15]].pos1.y = task->data[4]; ResetSpriteRotScale(task->data[15]); - task->data[2] = 0; task->data[0]++; } @@ -982,7 +977,6 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) // animate Move_ERUPTIO case 6: if (!task->data[6]) DestroyAnimVisualTask(taskId); - break; default: break; @@ -1041,16 +1035,12 @@ static void AnimEruptionLaunchRock(struct Sprite *sprite) static u16 GetEruptionLaunchRockInitialYPos(u8 spriteId) { - u16 y = gSprites[spriteId].pos1.y + gSprites[spriteId].pos2.y + gSprites[spriteId].centerToCornerVecY; + s16 y = gSprites[spriteId].pos1.y + gSprites[spriteId].pos2.y + gSprites[spriteId].centerToCornerVecY; if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) - { - y = ((y << 16) + 0x4A0000) >> 16; - } + y += 74; else - { - y = ((y << 16) + 0x2C0000) >> 16; - } + y += 44; return y; } @@ -1201,7 +1191,7 @@ static void AnimWillOWispOrb(struct Sprite *sprite) sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); - sub_80A6FD4(sprite); + InitAnimLinearTranslationWithSpeed(sprite); sprite->callback = AnimWillOWispOrb_Step; } break; @@ -1368,14 +1358,14 @@ static void AnimTask_MoveHeatWaveTargets_Step(u8 taskId) } } -// Used to add a color mask to the battle interface / HUD in Heat Wave. +// Used to add a color mask to the battle background. // arg 0: opacity // arg 1: color code void AnimTask_BlendBackground(u8 taskId) { struct BattleAnimBgData animBg; - sub_80A6B30(&animBg); - BlendPalette(animBg.paletteId * 16, 16, gBattleAnimArgs[0], gBattleAnimArgs[1]); // u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor + GetBattleAnimBg1Data(&animBg); + BlendPalette(animBg.paletteId * 16, 16, gBattleAnimArgs[0], gBattleAnimArgs[1]); DestroyAnimVisualTask(taskId); } diff --git a/src/battle_anim_flying.c b/src/battle_anim_flying.c index 8334e0484..2b8926fef 100644 --- a/src/battle_anim_flying.c +++ b/src/battle_anim_flying.c @@ -13,9 +13,9 @@ static void AnimEllipticalGust_Step(struct Sprite *); static void AnimGustToTarget(struct Sprite *); static void AnimGustToTarget_Step(struct Sprite *); static void AnimFallingFeather(struct Sprite *); -static void sub_810E520(struct Sprite *); -static void sub_810EB40(struct Sprite *); -static void sub_810EA4C(struct Sprite *); +static void AnimFallingFeather_Step(struct Sprite *); +static void AnimWhirlwindLine_Step(struct Sprite *); +static void AnimUnused_810EA4C(struct Sprite *); static void AnimWhirlwindLine(struct Sprite *); static void AnimBounceBallShrink(struct Sprite *); static void AnimBounceBallLand(struct Sprite *); @@ -25,8 +25,8 @@ static void AnimDiveBall_Step2(struct Sprite *); static void AnimDiveWaterSplash(struct Sprite *); static void AnimSprayWaterDroplet(struct Sprite *); static void AnimSprayWaterDroplet_Step(struct Sprite *); -static void sub_810F004(struct Sprite *); -static void sub_810F018(struct Sprite *); +static void AnimUnused_810F004(struct Sprite *); +static void AnimUnused_810F004_Step(struct Sprite *); static void AnimSkyAttackBird(struct Sprite *); static void AnimSkyAttackBird_Step(struct Sprite *); static void AnimTask_AnimateGustTornadoPalette_Step(u8); @@ -174,7 +174,8 @@ const struct SpriteTemplate gFallingFeatherSpriteTemplate = .callback = AnimFallingFeather, }; -const struct SpriteTemplate gUnknown_085963A0 = +// Unused +const struct SpriteTemplate gUnusedSpriteTemplate_085963A0 = { .tileTag = ANIM_TAG_SMALL_BUBBLES, .paletteTag = ANIM_TAG_SMALL_BUBBLES, @@ -182,7 +183,7 @@ const struct SpriteTemplate gUnknown_085963A0 = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810EA4C, + .callback = AnimUnused_810EA4C, }; static const union AnimCmd sAnim_WhirlwindLines[] = @@ -284,7 +285,7 @@ const struct SpriteTemplate gDiveBallSpriteTemplate = .callback = AnimDiveBall, }; -static const union AffineAnimCmd gUnknown_085964A8[] = +static const union AffineAnimCmd sAnim_Unused_085964A8[] = { AFFINEANIMCMD_FRAME(0x100, 0x0, 0, 0), AFFINEANIMCMD_FRAME(0x0, 0x20, 0, 12), @@ -293,9 +294,9 @@ static const union AffineAnimCmd gUnknown_085964A8[] = }; // Unused -static const union AffineAnimCmd *const gUnknown_085964C8[] = +static const union AffineAnimCmd *const sAnims_Unused_085964C8[] = { - gUnknown_085964A8, + sAnim_Unused_085964A8, }; const struct SpriteTemplate gDiveWaterSplashSpriteTemplate = @@ -320,7 +321,8 @@ const struct SpriteTemplate gSprayWaterDropletSpriteTemplate = .callback = AnimSprayWaterDroplet, }; -const struct SpriteTemplate gUnknown_085964FC = +// Unused +const struct SpriteTemplate gUnusedSpriteTemplate_085964FC = { .tileTag = ANIM_TAG_CIRCLE_OF_LIGHT, .paletteTag = ANIM_TAG_CIRCLE_OF_LIGHT, @@ -328,7 +330,7 @@ const struct SpriteTemplate gUnknown_085964FC = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810F004, + .callback = AnimUnused_810F004, }; const struct SpriteTemplate gSkyAttackBirdSpriteTemplate = @@ -635,10 +637,10 @@ static void AnimFallingFeather(struct Sprite *sprite) gOamMatrices[matrixNum].b = spriteCoord; gOamMatrices[matrixNum].c = -spriteCoord; - sprite->callback = sub_810E520; + sprite->callback = AnimFallingFeather_Step; } -static void sub_810E520(struct Sprite *sprite) +static void AnimFallingFeather_Step(struct Sprite *sprite) { u8 matrixNum, sinIndex; s16 sinVal = 0; @@ -886,7 +888,7 @@ static void sub_810E520(struct Sprite *sprite) } } -static void sub_810EA4C(struct Sprite *sprite) +static void AnimUnused_810EA4C(struct Sprite *sprite) { sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimTarget); sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); @@ -896,7 +898,7 @@ static void sub_810EA4C(struct Sprite *sprite) static void AnimWhirlwindLine(struct Sprite * sprite) { - u16 arg; + u16 offset; u8 mult; if (gBattleAnimArgs[2] == ANIM_ATTACKER) @@ -914,15 +916,15 @@ static void AnimWhirlwindLine(struct Sprite * sprite) sprite->pos1.x -= 32; sprite->data[1] = 0x0ccc; - arg = gBattleAnimArgs[4]; + offset = gBattleAnimArgs[4]; mult = 12; - sprite->pos2.x += mult * arg; - sprite->data[0] = arg; + sprite->pos2.x += mult * offset; + sprite->data[0] = offset; sprite->data[7] = gBattleAnimArgs[3]; - sprite->callback = sub_810EB40; + sprite->callback = AnimWhirlwindLine_Step; } -static void sub_810EB40(struct Sprite *sprite) +static void AnimWhirlwindLine_Step(struct Sprite *sprite) { sprite->pos2.x += sprite->data[1] >> 8; @@ -1059,9 +1061,9 @@ static void AnimDiveWaterSplash(struct Sprite *sprite) sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1); } - sprite->data[1] = 512; + sprite->data[1] = 0x200; - TrySetSpriteRotScale(sprite, 0, 256, sprite->data[1], 0); + TrySetSpriteRotScale(sprite, 0, 0x100, sprite->data[1], 0); sprite->data[0]++; break; case 1: @@ -1072,11 +1074,11 @@ static void AnimDiveWaterSplash(struct Sprite *sprite) sprite->data[2]++; - TrySetSpriteRotScale(sprite, 0, 256, sprite->data[1], 0); + TrySetSpriteRotScale(sprite, 0, 0x100, sprite->data[1], 0); matrixNum = sprite->oam.matrixNum; - t1 = 15616; + t1 = 0x3D00; t2 = t1 / gOamMatrices[matrixNum].d + 1; if (t2 > 128) @@ -1087,7 +1089,7 @@ static void AnimDiveWaterSplash(struct Sprite *sprite) if (sprite->data[2] == 24) { - sub_80A749C(sprite); + ResetSpriteRotScale_PreserveAffine(sprite); DestroyAnimSprite(sprite); } break; @@ -1152,14 +1154,14 @@ static void AnimSprayWaterDroplet_Step(struct Sprite *sprite) DestroyAnimSprite(sprite); } -static void sub_810F004(struct Sprite *sprite) +static void AnimUnused_810F004(struct Sprite *sprite) { sprite->data[6] = 0; sprite->data[7] = 64; - sprite->callback = sub_810F018; + sprite->callback = AnimUnused_810F004_Step; } -static void sub_810F018(struct Sprite *sprite) +static void AnimUnused_810F004_Step(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -1214,7 +1216,7 @@ void AnimSkyAttackBird_Step(struct Sprite *sprite) DestroySpriteAndMatrix(sprite); } -void unref_sub_810F184(u8 taskId) +void AnimTask_Unused_810F184(u8 taskId) { if (gBattleAnimArgs[0] == 0) { diff --git a/src/battle_anim_ghost.c b/src/battle_anim_ghost.c index 8831cae5e..02fe7bab7 100644 --- a/src/battle_anim_ghost.c +++ b/src/battle_anim_ghost.c @@ -14,7 +14,7 @@ static void AnimConfuseRayBallBounce(struct Sprite *); static void AnimConfuseRayBallBounce_Step1(struct Sprite *); static void AnimConfuseRayBallBounce_Step2(struct Sprite *); -static void sub_8111764(struct Sprite *); +static void UpdateConfuseRayBallBlend(struct Sprite *); static void AnimConfuseRayBallSpiral(struct Sprite *); static void AnimConfuseRayBallSpiral_Step(struct Sprite *); static void AnimTask_NightShadeClone_Step1(u8 taskId); @@ -37,8 +37,8 @@ static void AnimCurseNail_Step2(struct Sprite *); static void AnimCurseNail_End(struct Sprite *); static void AnimGhostStatusSprite_Step(struct Sprite *); static void AnimGrudgeFlame(struct Sprite *); -static void sub_8112F60(struct Sprite *); -static void sub_8112FB8(struct Sprite *); +static void AnimUnused_8112F60(struct Sprite *); +static void AnimUnused_8112F60_Step(struct Sprite *); static const union AffineAnimCmd sAffineAnim_ConfuseRayBallBounce[] = { @@ -155,16 +155,16 @@ const struct SpriteTemplate gLickSpriteTemplate = .callback = AnimLick, }; -static const union AffineAnimCmd gUnknown_08596DA4[] = +static const union AffineAnimCmd sAnim_Unused_08596DA4[] = { AFFINEANIMCMD_FRAME(0x200, 0x200, 0, 0), AFFINEANIMCMD_END, }; // Unused -static const union AffineAnimCmd *const gUnknown_08596DB4[] = +static const union AffineAnimCmd *const gAnims_Unused_08596DB4[] = { - gUnknown_08596DA4, + sAnim_Unused_08596DA4, }; const struct SpriteTemplate gDestinyBondWhiteShadowSpriteTemplate = @@ -248,7 +248,7 @@ const struct SpriteTemplate gGrudgeFlameSpriteTemplate = }; // Unused -const struct SpriteTemplate gUnknown_08596E48 = +const struct SpriteTemplate gUnusedSpriteTemplate_08596E48 = { .tileTag = 0, .paletteTag = 0, @@ -256,7 +256,7 @@ const struct SpriteTemplate gUnknown_08596E48 = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8112F60, + .callback = AnimUnused_8112F60, }; const struct SpriteTemplate gFlashCannonBallMovementTemplate = @@ -272,13 +272,13 @@ const struct SpriteTemplate gFlashCannonBallMovementTemplate = static void AnimConfuseRayBallBounce(struct Sprite *sprite) { - InitSpritePosToAnimAttacker(sprite, 1); + InitSpritePosToAnimAttacker(sprite, TRUE); sprite->data[0] = gBattleAnimArgs[2]; sprite->data[1] = sprite->pos1.x; sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2); sprite->data[3] = sprite->pos1.y; sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3); - sub_80A6FD4(sprite); + InitAnimLinearTranslationWithSpeed(sprite); sprite->callback = AnimConfuseRayBallBounce_Step1; sprite->data[6] = 16; SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)); @@ -289,7 +289,7 @@ static void AnimConfuseRayBallBounce_Step1(struct Sprite *sprite) { s16 r0; s16 r2; - sub_8111764(sprite); + UpdateConfuseRayBallBlend(sprite); if (AnimTranslateLinear(sprite)) { sprite->callback = AnimConfuseRayBallBounce_Step2; @@ -333,13 +333,11 @@ static void AnimConfuseRayBallBounce_Step2(struct Sprite *sprite) sprite->callback = DestroyAnimSpriteAndDisableBlend; } else - sub_8111764(sprite); + UpdateConfuseRayBallBlend(sprite); } -static void sub_8111764(struct Sprite *sprite) +static void UpdateConfuseRayBallBlend(struct Sprite *sprite) { - - s16 r0; if (sprite->data[6] > 0xFF) { if (++sprite->data[6] == 0x10d) @@ -347,10 +345,7 @@ static void sub_8111764(struct Sprite *sprite) return; } - r0 = sprite->data[7]; - sprite->data[7]++; - - if ((r0 & 0xFF) == 0) + if ((sprite->data[7]++ & 0xFF) == 0) { sprite->data[7] &= 0xff00; if ((sprite->data[7] & 0x100) != 0) @@ -701,7 +696,7 @@ static void AnimTask_SpiteTargetShadow_Step1(u8 taskId) break; case 1: task->data[14] = (task->data[14] + 16) * 16; - CpuSet(&gPlttBufferUnfaded[task->data[4]], &gPlttBufferFaded[task->data[14]], 0x4000008); + CpuCopy32(&gPlttBufferUnfaded[task->data[4]], &gPlttBufferFaded[task->data[14]], 32); BlendPalette(task->data[4], 16, 10, RGB(13, 0, 15)); task->data[15]++; break; @@ -1070,7 +1065,7 @@ static void AnimTask_CurseStretchingBlackBg_Step1(u8 taskId) right = 240; top = 0; bottom = 112; - selectedPalettes = sub_80A75AC(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); BeginNormalPaletteFade(selectedPalettes, 0, 16, 16, RGB(0, 0, 0)); gTasks[taskId].func = AnimTask_CurseStretchingBlackBg_Step2; } @@ -1368,7 +1363,7 @@ static void AnimGrudgeFlame(struct Sprite *sprite) } } -static void sub_8112F60(struct Sprite *sprite) +static void AnimUnused_8112F60(struct Sprite *sprite) { sprite->invisible = TRUE; sprite->data[5] = gBattlerSpriteIds[gBattleAnimAttacker]; @@ -1376,12 +1371,12 @@ static void sub_8112F60(struct Sprite *sprite) sprite->data[1] = 10; sprite->data[2] = gBattleAnimArgs[0]; sprite->data[3] = gBattleAnimArgs[1]; - sprite->callback = sub_8112FB8; + sprite->callback = AnimUnused_8112F60_Step; gSprites[sprite->data[5]].pos1.y += 8; } -static void sub_8112FB8(struct Sprite *sprite) +static void AnimUnused_8112F60_Step(struct Sprite *sprite) { if (sprite->data[3]) { diff --git a/src/battle_anim_ground.c b/src/battle_anim_ground.c index 8c1442fd4..63891d5a7 100644 --- a/src/battle_anim_ground.c +++ b/src/battle_anim_ground.c @@ -18,11 +18,11 @@ static void AnimTask_DigBounceMovement(u8); static void AnimTask_DigEndBounceMovementSetInvisible(u8); static void AnimTask_DigSetVisibleUnderground(u8); static void AnimTask_DigRiseUpFromHole(u8); -static void sub_81150E0(u8, s16, s16); +static void SetDigScanlineEffect(u8, s16, s16); static void AnimTask_ShakeTerrain(u8); static void AnimTask_ShakeBattlers(u8); static void SetBattlersXOffsetForShake(struct Task *); -static void sub_81156D0(u8); +static void WaitForFissureCompletion(u8); static const union AffineAnimCmd sAffineAnim_Bonemerang[] = { @@ -318,7 +318,7 @@ void AnimTask_DigDownMovement(u8 taskId) static void AnimTask_DigBounceMovement(u8 taskId) { - u8 var0; + u8 y; struct Task *task = &gTasks[taskId]; switch (task->data[0]) @@ -337,9 +337,9 @@ static void AnimTask_DigBounceMovement(u8 taskId) task->data[13] = gBattle_BG2_Y; } - var0 = GetBattlerYCoordWithElevation(gBattleAnimAttacker); - task->data[14] = var0 - 32; - task->data[15] = var0 + 32; + y = GetBattlerYCoordWithElevation(gBattleAnimAttacker); + task->data[14] = y - 32; + task->data[15] = y + 32; if (task->data[14] < 0) task->data[14] = 0; @@ -347,7 +347,7 @@ static void AnimTask_DigBounceMovement(u8 taskId) task->data[0]++; break; case 1: - sub_81150E0(task->data[11], task->data[14], task->data[15]); + SetDigScanlineEffect(task->data[11], task->data[14], task->data[15]); task->data[0]++; break; case 2: @@ -453,7 +453,7 @@ static void AnimTask_DigRiseUpFromHole(u8 taskId) task->data[0]++; break; case 1: - sub_81150E0(task->data[11], 0, task->data[15]); + SetDigScanlineEffect(task->data[11], 0, task->data[15]); task->data[0]++; break; case 2: @@ -474,7 +474,7 @@ static void AnimTask_DigRiseUpFromHole(u8 taskId) } } -static void sub_81150E0(u8 useBG1, s16 y, s16 endY) +static void SetDigScanlineEffect(u8 useBG1, s16 y, s16 endY) { s16 bgX; struct ScanlineEffectParams scanlineParams; @@ -621,7 +621,7 @@ void AnimTask_HorizontalShake(u8 taskId) break; default: // Shake specific battler task->tbattlerSpriteIds(0) = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); - if (task->tbattlerSpriteIds(0) == 0xFF) + if (task->tbattlerSpriteIds(0) == SPRITE_NONE) { DestroyAnimVisualTask(taskId); } @@ -761,21 +761,23 @@ void AnimTask_PositionFissureBgOnBattler(u8 taskId) u8 battler = (gBattleAnimArgs[0] & ANIM_TARGET) ? gBattleAnimTarget : gBattleAnimAttacker; if (gBattleAnimArgs[0] > ANIM_TARGET) - battler ^= 2; + battler = BATTLE_PARTNER(battler); - newTask = &gTasks[CreateTask(sub_81156D0, gBattleAnimArgs[1])]; - newTask->data[1] = (32 - GetBattlerSpriteCoord(battler, 2)) & 0x1FF; - newTask->data[2] = (64 - GetBattlerSpriteCoord(battler, 3)) & 0xFF; + newTask = &gTasks[CreateTask(WaitForFissureCompletion, gBattleAnimArgs[1])]; + newTask->data[1] = (32 - GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2)) & 0x1FF; + newTask->data[2] = (64 - GetBattlerSpriteCoord(battler, BATTLER_COORD_Y_PIC_OFFSET)) & 0xFF; gBattle_BG3_X = newTask->data[1]; gBattle_BG3_Y = newTask->data[2]; newTask->data[3] = gBattleAnimArgs[2]; DestroyAnimVisualTask(taskId); } -static void sub_81156D0(u8 taskId) +static void WaitForFissureCompletion(u8 taskId) { struct Task *task = &gTasks[taskId]; + // Holds the BG3 offsets until gBattleAnimArgs[7] + // is set to a special terminator value. if (gBattleAnimArgs[7] == task->data[3]) { gBattle_BG3_X = 0; diff --git a/src/battle_anim_ice.c b/src/battle_anim_ice.c index c3aa2680b..4aa892c8e 100644 --- a/src/battle_anim_ice.c +++ b/src/battle_anim_ice.c @@ -20,8 +20,8 @@ struct HailStruct { s32 unk3:4; }; -static void sub_810B6C4(struct Sprite *); -static void sub_810B848(struct Sprite *); +static void AnimUnused_810B6C4(struct Sprite *); +static void AnimUnused_810B6C4_Step(struct Sprite *); static void AnimIcePunchSwirlingParticle(struct Sprite *); static void AnimIceBeamParticle(struct Sprite *); static void AnimFlickerIceEffectParticle(struct Sprite *); @@ -40,27 +40,27 @@ static void InitIceBallAnim(struct Sprite *); static void AnimThrowIceBall(struct Sprite *); static void InitIceBallParticle(struct Sprite *); static void AnimIceBallParticle(struct Sprite *); -static void AnimTask_Haze2(u8); -static void AnimTask_OverlayFogTiles(u8); +static void AnimTask_HazeScrollingFog_Step(u8); +static void AnimTask_LoadMistTiles_Step(u8); static void AnimTask_Hail2(u8); static bool8 GenerateHailParticle(u8 hailStructId, u8 affineAnimNum, u8 taskId, u8 c); static void AvalancheAnim_Step(struct Sprite *sprite); static void AvalancheAnim_Step2(struct Sprite *sprite); -static const union AnimCmd gUnknown_08595A48[] = +static const union AnimCmd sAnim_Unused_08595A48[] = { ANIMCMD_FRAME(0, 5, .hFlip = TRUE), ANIMCMD_FRAME(1, 5, .hFlip = TRUE), ANIMCMD_JUMP(0), }; -static const union AnimCmd *const gUnknown_08595A54[] = +static const union AnimCmd *const sAnims_Unused_08595A54[] = { - gUnknown_08595A48, + sAnim_Unused_08595A48, }; // Unused -const struct SpriteTemplate gUnknown_08595A58 = +const struct SpriteTemplate gUnusedSpriteTemplate_08595A58 = { .tileTag = ANIM_TAG_ICE_CRYSTALS, .paletteTag = ANIM_TAG_ICE_CRYSTALS, @@ -68,10 +68,10 @@ const struct SpriteTemplate gUnknown_08595A58 = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_810B6C4, + .callback = AnimUnused_810B6C4, }; -static const union AnimCmd gUnknown_08595A70[] = +static const union AnimCmd sAnim_Unused_08595A70[] = { ANIMCMD_FRAME(0, 1), ANIMCMD_END, @@ -109,9 +109,9 @@ static const union AnimCmd sAnim_SmallBubblePair[] = }; // Unused -static const union AnimCmd *const gUnknown_08595AA4[] = +static const union AnimCmd *const sAnims_Unused_08595AA4[] = { - gUnknown_08595A70, + sAnim_Unused_08595A70, }; const union AnimCmd *const gAnims_IceCrystalLarge[] = @@ -335,7 +335,7 @@ const struct SpriteTemplate gSmogCloudSpriteTemplate = .callback = InitSwirlingFogAnim, }; -static const u8 sUnknown_08595C5C[] = +static const u8 sHazeBlendAmounts[] = { 0, 1, 2, 2, 2, 2, 3, 4, 4, 4, 5, 6, 6, 6, 6, 7, 8, 8, 8, 9, }; @@ -351,7 +351,7 @@ const struct SpriteTemplate gMistBallSpriteTemplate = .callback = AnimThrowMistBall, }; -static const u8 sUnknown_08595C88[] = +static const u8 wMistBlendAmounts[] = { 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, }; @@ -607,7 +607,7 @@ static void AvalancheAnim_Step2(struct Sprite *sprite) } // Unused -static void sub_810B6C4(struct Sprite *sprite) +static void AnimUnused_810B6C4(struct Sprite *sprite) { s16 targetX, targetY, attackerX, attackerY; @@ -643,10 +643,10 @@ static void sub_810B6C4(struct Sprite *sprite) sub_80A64EC(sprite); sprite->data[3] = gBattleAnimArgs[5]; sprite->data[4] = gBattleAnimArgs[6]; - sprite->callback = sub_810B848; + sprite->callback = AnimUnused_810B6C4_Step; } -static void sub_810B848(struct Sprite *sprite) +static void AnimUnused_810B6C4_Step(struct Sprite *sprite) { if (sprite->data[0] != 0) { @@ -793,7 +793,7 @@ static void AnimSwirlingSnowball(struct Sprite *sprite) for (i = 0; i < 8; i++) sprite->data[i] = tempDataHolder[i]; - sprite->callback = sub_80A718C; + sprite->callback = InitAnimFastLinearTranslationWithSpeedAndPos; StoreSpriteCallbackInData6(sprite, AnimSwirlingSnowball_Step1); } @@ -1081,15 +1081,15 @@ void AnimTask_HazeScrollingFog(u8 taskId) SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); LoadBgTiles(animBg.bgId, gWeatherFogHorizontalTiles, 0x800, animBg.tilesOffset); AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimFogTilemap, 0); - LoadPalette(&gUnknown_083970E8, animBg.paletteId * 16, 32); + LoadPalette(&gFogPalette, animBg.paletteId * 16, 32); - gTasks[taskId].func = AnimTask_Haze2; + gTasks[taskId].func = AnimTask_HazeScrollingFog_Step; } -static void AnimTask_Haze2(u8 taskId) +static void AnimTask_HazeScrollingFog_Step(u8 taskId) { struct BattleAnimBgData animBg; @@ -1103,7 +1103,7 @@ static void AnimTask_Haze2(u8 taskId) { gTasks[taskId].data[10] = 0; gTasks[taskId].data[9]++; - gTasks[taskId].data[11] = sUnknown_08595C5C[gTasks[taskId].data[9]]; + gTasks[taskId].data[11] = sHazeBlendAmounts[gTasks[taskId].data[9]]; SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11])); if (gTasks[taskId].data[11] == 9) @@ -1135,12 +1135,10 @@ static void AnimTask_Haze2(u8 taskId) } break; case 3: - sub_80A6B30(&animBg); - sub_80A6C68(1); - sub_80A6C68(2); - + GetBattleAnimBg1Data(&animBg); + ClearBattleAnimBg(1); + ClearBattleAnimBg(2); gTasks[taskId].data[12]++; - // fall through case 4: if (!IsContest()) @@ -1188,16 +1186,16 @@ void AnimTask_LoadMistTiles(u8 taskId) SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); LoadBgTiles(animBg.bgId, gWeatherFogHorizontalTiles, 0x800, animBg.tilesOffset); AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimFogTilemap, 0); - LoadPalette(&gUnknown_083970E8, animBg.paletteId * 16, 32); + LoadPalette(&gFogPalette, animBg.paletteId * 16, 32); gTasks[taskId].data[15] = -1; - gTasks[taskId].func = AnimTask_OverlayFogTiles; + gTasks[taskId].func = AnimTask_LoadMistTiles_Step; } -static void AnimTask_OverlayFogTiles(u8 taskId) +static void AnimTask_LoadMistTiles_Step(u8 taskId) { struct BattleAnimBgData animBg; @@ -1208,7 +1206,7 @@ static void AnimTask_OverlayFogTiles(u8 taskId) { case 0: gTasks[taskId].data[9] += 1; - gTasks[taskId].data[11] = sUnknown_08595C88[gTasks[taskId].data[9]]; + gTasks[taskId].data[11] = wMistBlendAmounts[gTasks[taskId].data[9]]; SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 17 - gTasks[taskId].data[11])); if (gTasks[taskId].data[11] == 5) { @@ -1237,9 +1235,9 @@ static void AnimTask_OverlayFogTiles(u8 taskId) } break; case 3: - sub_80A6B30(&animBg); - sub_80A6C68(1); - sub_80A6C68(2); + GetBattleAnimBg1Data(&animBg); + ClearBattleAnimBg(1); + ClearBattleAnimBg(2); gTasks[taskId].data[12]++; @@ -1394,7 +1392,7 @@ static void MovePoisonGasCloud(struct Sprite *sprite) sprite->data[7]++; sprite->pos2.x = sprite->pos2.y = 0; - sub_80A6FD4(sprite); + InitAnimLinearTranslationWithSpeed(sprite); } break; case 2: diff --git a/src/battle_anim_mon_movement.c b/src/battle_anim_mon_movement.c index 4b6d53304..9b0835224 100644 --- a/src/battle_anim_mon_movement.c +++ b/src/battle_anim_mon_movement.c @@ -95,7 +95,7 @@ void AnimTask_ShakeMon(u8 taskId) { u8 spriteId; spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); - if (spriteId == 0xff) + if (spriteId == SPRITE_NONE) { DestroyAnimVisualTask(taskId); return; @@ -163,7 +163,7 @@ void AnimTask_ShakeMon2(u8 taskId) if (gBattleAnimArgs[0] < MAX_BATTLERS_COUNT) { spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); - if (spriteId == 0xff) + if (spriteId == SPRITE_NONE) { DestroyAnimVisualTask(taskId); return; @@ -256,7 +256,7 @@ static void AnimTask_ShakeMon2_Step(u8 taskId) void AnimTask_ShakeMonInPlace(u8 taskId) { u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); - if (spriteId == 0xff) + if (spriteId == SPRITE_NONE) { DestroyAnimVisualTask(taskId); return; diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index b352a4603..0045b7d8c 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -21,15 +21,15 @@ extern const struct OamData gOamData_AffineNormal_ObjNormal_64x64; static void sub_80A6FB4(struct Sprite *sprite); -static void sub_80A7144(struct Sprite *sprite); +static void AnimFastTranslateLinearWaitEnd(struct Sprite *sprite); static void AnimThrowProjectile_Step(struct Sprite *sprite); static void sub_80A8DFC(struct Sprite *sprite); -static void sub_80A8E88(struct Sprite *sprite); +static void AnimWeatherBallUp_Step(struct Sprite *sprite); static u16 GetBattlerYDeltaFromSpriteId(u8 spriteId); static void AnimTask_BlendPalInAndOutSetup(struct Task *task); -static void sub_80A7AFC(u8 taskId); -static void sub_80A8CAC(u8 taskId); -static void AnimTask_BlendMonInAndOutStep(u8 taskId); +static void AnimTask_AlphaFadeIn_Step(u8 taskId); +static void AnimTask_AttackerPunchWithTrace_Step(u8 taskId); +static void AnimTask_BlendMonInAndOut_Step(u8 taskId); static bool8 sub_80A7238(void); static void sub_80A8D78(struct Task *task, u8 taskId); @@ -79,11 +79,15 @@ static const u8 sCastformBackSpriteYCoords[] = 0, // HAIL }; -static const struct SpriteTemplate sUnknown_08525F90[] = +// Placeholders for pokemon sprites to be created for a move animation effect (e.g. Role Play / Snatch) +#define TAG_MOVE_EFFECT_MON_1 55125 +#define TAG_MOVE_EFFECT_MON_2 55126 + +static const struct SpriteTemplate sSpriteTemplate_MoveEffectMons[] = { { - .tileTag = 55125, - .paletteTag = 55125, + .tileTag = TAG_MOVE_EFFECT_MON_1, + .paletteTag = TAG_MOVE_EFFECT_MON_1, .oam = &gOamData_AffineNormal_ObjNormal_64x64, .anims = gDummySpriteAnimTable, .images = NULL, @@ -91,8 +95,8 @@ static const struct SpriteTemplate sUnknown_08525F90[] = .callback = SpriteCallbackDummy, }, { - .tileTag = 55126, - .paletteTag = 55126, + .tileTag = TAG_MOVE_EFFECT_MON_2, + .paletteTag = TAG_MOVE_EFFECT_MON_2, .oam = &gOamData_AffineNormal_ObjNormal_64x64, .anims = gDummySpriteAnimTable, .images = NULL, @@ -101,10 +105,10 @@ static const struct SpriteTemplate sUnknown_08525F90[] = } }; -static const struct SpriteSheet sUnknown_08525FC0[] = +static const struct SpriteSheet sSpriteSheet_MoveEffectMons[] = { - { gMiscBlank_Gfx, 0x800, 55125, }, - { gMiscBlank_Gfx, 0x800, 55126, }, + { gMiscBlank_Gfx, 0x800, TAG_MOVE_EFFECT_MON_1, }, + { gMiscBlank_Gfx, 0x800, TAG_MOVE_EFFECT_MON_2, }, }; u8 GetBattlerSpriteCoord(u8 battlerId, u8 coordType) @@ -885,90 +889,90 @@ bool8 IsDoubleBattle(void) return IS_DOUBLE_BATTLE(); } -void sub_80A6B30(struct BattleAnimBgData *unk) +void GetBattleAnimBg1Data(struct BattleAnimBgData *out) { if (IsContest()) { - unk->bgTiles = gUnknown_0202305C; - unk->bgTilemap = (u16 *)gUnknown_02023060; - unk->paletteId = 14; - unk->bgId = 1; - unk->tilesOffset = 0; - unk->unused = 0; + out->bgTiles = gUnknown_0202305C; + out->bgTilemap = (u16 *)gUnknown_02023060; + out->paletteId = 14; + out->bgId = 1; + out->tilesOffset = 0; + out->unused = 0; } else { - unk->bgTiles = gUnknown_0202305C; - unk->bgTilemap = (u16 *)gUnknown_02023060; - unk->paletteId = 8; - unk->bgId = 1; - unk->tilesOffset = 0x200; - unk->unused = 0; + out->bgTiles = gUnknown_0202305C; + out->bgTilemap = (u16 *)gUnknown_02023060; + out->paletteId = 8; + out->bgId = 1; + out->tilesOffset = 0x200; + out->unused = 0; } } -void sub_80A6B90(struct BattleAnimBgData *unk, u32 arg1) +void GetBattleAnimBgData(struct BattleAnimBgData *out, u32 bgId) { if (IsContest()) { - unk->bgTiles = gUnknown_0202305C; - unk->bgTilemap = (u16 *)gUnknown_02023060; - unk->paletteId = 14; - unk->bgId = 1; - unk->tilesOffset = 0; - unk->unused = 0; + out->bgTiles = gUnknown_0202305C; + out->bgTilemap = (u16 *)gUnknown_02023060; + out->paletteId = 14; + out->bgId = 1; + out->tilesOffset = 0; + out->unused = 0; } - else if (arg1 == 1) + else if (bgId == 1) { - sub_80A6B30(unk); + GetBattleAnimBg1Data(out); } else { - unk->bgTiles = gUnknown_0202305C; - unk->bgTilemap = (u16 *)gUnknown_02023060; - unk->paletteId = 9; - unk->bgId = 2; - unk->tilesOffset = 0x300; - unk->unused = 0; + out->bgTiles = gUnknown_0202305C; + out->bgTilemap = (u16 *)gUnknown_02023060; + out->paletteId = 9; + out->bgId = 2; + out->tilesOffset = 0x300; + out->unused = 0; } } -void sub_80A6BFC(struct BattleAnimBgData *unk, u8 unused) +void sub_80A6BFC(struct BattleAnimBgData *out, u8 unused) { - unk->bgTiles = gUnknown_0202305C; - unk->bgTilemap = (u16 *)gUnknown_02023060; + out->bgTiles = gUnknown_0202305C; + out->bgTilemap = (u16 *)gUnknown_02023060; if (IsContest()) { - unk->paletteId = 14; - unk->bgId = 1; - unk->tilesOffset = 0; - unk->unused = 0; + out->paletteId = 14; + out->bgId = 1; + out->tilesOffset = 0; + out->unused = 0; } else if (GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker) == 1) { - unk->paletteId = 8; - unk->bgId = 1; - unk->tilesOffset = 0x200; - unk->unused = 0; + out->paletteId = 8; + out->bgId = 1; + out->tilesOffset = 0x200; + out->unused = 0; } else { - unk->paletteId = 9; - unk->bgId = 2; - unk->tilesOffset = 0x300; - unk->unused = 0; + out->paletteId = 9; + out->bgId = 2; + out->tilesOffset = 0x300; + out->unused = 0; } } -void sub_80A6C68(u32 bgId) +void ClearBattleAnimBg(u32 bgId) { - struct BattleAnimBgData unkStruct; + struct BattleAnimBgData bgAnimData; - sub_80A6B90(&unkStruct, bgId); - CpuFill32(0, unkStruct.bgTiles, 0x2000); - LoadBgTiles(unkStruct.bgId, unkStruct.bgTiles, 0x2000, unkStruct.tilesOffset); - FillBgTilemapBufferRect(unkStruct.bgId, 0, 0, 0, 32, 64, 17); - CopyBgTilemapBufferToVram(unkStruct.bgId); + GetBattleAnimBgData(&bgAnimData, bgId); + CpuFill32(0, bgAnimData.bgTiles, 0x2000); + LoadBgTiles(bgAnimData.bgId, bgAnimData.bgTiles, 0x2000, bgAnimData.tilesOffset); + FillBgTilemapBufferRect(bgAnimData.bgId, 0, 0, 0, 32, 64, 17); + CopyBgTilemapBufferToVram(bgAnimData.bgId); } void AnimLoadCompressedBgGfx(u32 bgId, const u32 *src, u32 tilesOffset) @@ -1006,9 +1010,9 @@ u8 GetBattleBgPaletteNum(void) return 2; } -void sub_80A6DAC(bool8 arg0) +void UpdateAnimBg3ScreenSize(bool8 largeScreenSize) { - if (!arg0 || IsContest()) + if (!largeScreenSize || IsContest()) { SetAnimBgAttribute(3, BG_ANIM_SCREEN_SIZE, 0); SetAnimBgAttribute(3, BG_ANIM_AREA_OVERFLOW_MODE, 1); @@ -1072,7 +1076,7 @@ void StartAnimLinearTranslation(struct Sprite *sprite) sprite->data[1] = sprite->pos1.x; sprite->data[3] = sprite->pos1.y; InitAnimLinearTranslation(sprite); - sprite->callback = sub_80A6F98; + sprite->callback = AnimTranslateLinear_WaitEnd; sprite->callback(sprite); } @@ -1115,7 +1119,7 @@ bool8 AnimTranslateLinear(struct Sprite *sprite) return FALSE; } -void sub_80A6F98(struct Sprite *sprite) +void AnimTranslateLinear_WaitEnd(struct Sprite *sprite) { if (AnimTranslateLinear(sprite)) SetCallbackToStoredInData6(sprite); @@ -1128,19 +1132,19 @@ static void sub_80A6FB4(struct Sprite *sprite) SetCallbackToStoredInData6(sprite); } -void sub_80A6FD4(struct Sprite *sprite) +void InitAnimLinearTranslationWithSpeed(struct Sprite *sprite) { int v1 = abs(sprite->data[2] - sprite->data[1]) << 8; sprite->data[0] = v1 / sprite->data[0]; InitAnimLinearTranslation(sprite); } -void sub_80A7000(struct Sprite *sprite) +void InitAnimLinearTranslationWithSpeedAndPos(struct Sprite *sprite) { sprite->data[1] = sprite->pos1.x; sprite->data[3] = sprite->pos1.y; - sub_80A6FD4(sprite); - sprite->callback = sub_80A6F98; + InitAnimLinearTranslationWithSpeed(sprite); + sprite->callback = AnimTranslateLinear_WaitEnd; sprite->callback(sprite); } @@ -1177,7 +1181,7 @@ void InitAndRunAnimFastLinearTranslation(struct Sprite *sprite) sprite->data[1] = sprite->pos1.x; sprite->data[3] = sprite->pos1.y; InitAnimFastLinearTranslation(sprite); - sprite->callback = sub_80A7144; + sprite->callback = AnimFastTranslateLinearWaitEnd; sprite->callback(sprite); } @@ -1211,7 +1215,7 @@ bool8 AnimFastTranslateLinear(struct Sprite *sprite) return FALSE; } -static void sub_80A7144(struct Sprite *sprite) +static void AnimFastTranslateLinearWaitEnd(struct Sprite *sprite) { if (AnimFastTranslateLinear(sprite)) SetCallbackToStoredInData6(sprite); @@ -1224,12 +1228,12 @@ void InitAnimFastLinearTranslationWithSpeed(struct Sprite *sprite) InitAnimFastLinearTranslation(sprite); } -void sub_80A718C(struct Sprite *sprite) +void InitAnimFastLinearTranslationWithSpeedAndPos(struct Sprite *sprite) { sprite->data[1] = sprite->pos1.x; sprite->data[3] = sprite->pos1.y; InitAnimFastLinearTranslationWithSpeed(sprite); - sprite->callback = sub_80A7144; + sprite->callback = AnimFastTranslateLinearWaitEnd; sprite->callback(sprite); } @@ -1328,7 +1332,7 @@ void TrySetSpriteRotScale(struct Sprite *sprite, bool8 recalcCenterVector, s16 x } } -void sub_80A749C(struct Sprite *sprite) +void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite) { TrySetSpriteRotScale(sprite, TRUE, 0x100, 0x100, 0); sprite->affineAnimPaused = FALSE; @@ -1375,7 +1379,7 @@ void SetGreyscaleOrOriginalPalette(u16 paletteNum, bool8 restoreOriginalColor) } } -u32 sub_80A75AC(u8 battleBackground, u8 attacker, u8 target, u8 attackerPartner, u8 targetPartner, u8 a6, u8 a7) +u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 attackerPartner, u8 targetPartner, u8 a6, u8 a7) { u32 selectedPalettes = 0; u32 shift; @@ -1428,59 +1432,60 @@ u32 sub_80A75AC(u8 battleBackground, u8 attacker, u8 target, u8 attackerPartner, return selectedPalettes; } -u32 sub_80A76C4(u8 a1, u8 a2, u8 a3, u8 a4) +u32 GetBattleMonSpritePalettesMask(u8 playerLeft, u8 playerRight, u8 opponentLeft, u8 opponentRight) { - u32 var = 0; + u32 selectedPalettes = 0; u32 shift; if (IsContest()) { - if (a1) + if (playerLeft) { - var |= 1 << 18; - return var; + selectedPalettes |= 1 << 18; + return selectedPalettes; } } else { - if (a1) + if (playerLeft) { if (IsBattlerSpriteVisible(GetBattlerAtPosition(B_POSITION_PLAYER_LEFT))) { - var |= 1 << (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) + 16); + selectedPalettes |= 1 << (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) + 16); } } - if (a2) + if (playerRight) { if (IsBattlerSpriteVisible(GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT))) { shift = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT) + 16; - var |= 1 << shift; + selectedPalettes |= 1 << shift; } } - if (a3) + if (opponentLeft) { if (IsBattlerSpriteVisible(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))) { shift = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT) + 16; - var |= 1 << shift; + selectedPalettes |= 1 << shift; } } - if (a4) + if (opponentRight) { if (IsBattlerSpriteVisible(GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT))) { shift = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT) + 16; - var |= 1 << shift; + selectedPalettes |= 1 << shift; } } } - return var; + return selectedPalettes; } -u8 sub_80A77AC(u8 a1) +// Presumably something commented here, just returns arg +u8 AnimDummyReturnArg(u8 battler) { - return a1; + return battler; } static u8 GetBattlerAtPosition_(u8 position) @@ -1608,7 +1613,7 @@ s16 CloneBattlerSpriteWithBlend(u8 animBattler) u16 i; u8 spriteId = GetAnimBattlerSpriteId(animBattler); - if (spriteId != 0xFF) + if (spriteId != SPRITE_NONE) { for (i = 0; i < MAX_SPRITES; i++) { @@ -1655,10 +1660,10 @@ void AnimTask_AlphaFadeIn(u8 taskId) gTasks[taskId].data[7] = gBattleAnimArgs[2]; gTasks[taskId].data[8] = gBattleAnimArgs[3]; SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gBattleAnimArgs[0], gBattleAnimArgs[1])); - gTasks[taskId].func = sub_80A7AFC; + gTasks[taskId].func = AnimTask_AlphaFadeIn_Step; } -static void sub_80A7AFC(u8 taskId) +static void AnimTask_AlphaFadeIn_Step(u8 taskId) { struct Task *task = &gTasks[taskId]; @@ -1694,7 +1699,7 @@ static void sub_80A7AFC(u8 taskId) void AnimTask_BlendMonInAndOut(u8 task) { u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); - if (spriteId == 0xff) + if (spriteId == SPRITE_NONE) { DestroyAnimVisualTask(task); return; @@ -1712,10 +1717,10 @@ static void AnimTask_BlendPalInAndOutSetup(struct Task *task) task->data[5] = gBattleAnimArgs[3]; task->data[6] = 0; task->data[7] = gBattleAnimArgs[4]; - task->func = AnimTask_BlendMonInAndOutStep; + task->func = AnimTask_BlendMonInAndOut_Step; } -static void AnimTask_BlendMonInAndOutStep(u8 taskId) +static void AnimTask_BlendMonInAndOut_Step(u8 taskId) { struct Task *task = &gTasks[taskId]; @@ -1854,7 +1859,7 @@ void SetBattlerSpriteYOffsetFromYScale(u8 spriteId) { int var = 64 - GetBattlerYDeltaFromSpriteId(spriteId) * 2; u16 matrix = gSprites[spriteId].oam.matrixNum; - int var2 = (var << 8) / gOamMatrices[matrix].d; + int var2 = SAFE_DIV(var << 8, gOamMatrices[matrix].d); if (var2 > 128) var2 = 128; @@ -1867,7 +1872,7 @@ void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId) { int var = 64 - GetBattlerYDeltaFromSpriteId(otherSpriteId) * 2; u16 matrix = gSprites[spriteId].oam.matrixNum; - int var2 = (var << 8) / gOamMatrices[matrix].d; + int var2 = SAFE_DIV(var << 8, gOamMatrices[matrix].d); if (var2 > 128) var2 = 128; @@ -1935,19 +1940,19 @@ void *LoadPointerFromVars(s16 lo, s16 hi) return (void *)((u16)lo | ((u16)hi << 16)); } -void sub_80A805C(struct Task *task, u8 a2, s16 a3, s16 a4, s16 a5, s16 a6, u16 a7) +void PrepareEruptAnimTaskData(struct Task *task, u8 spriteId, s16 xScaleStart, s16 yScaleStart, s16 xScaleEnd, s16 yScaleEnd, u16 duration) { - task->data[8] = a7; - task->data[15] = a2; // spriteId - task->data[9] = a3; - task->data[10] = a4; - task->data[13] = a5; - task->data[14] = a6; - task->data[11] = (a5 - a3) / a7; - task->data[12] = (a6 - a4) / a7; + task->data[8] = duration; + task->data[15] = spriteId; + task->data[9] = xScaleStart; + task->data[10] = yScaleStart; + task->data[13] = xScaleEnd; + task->data[14] = yScaleEnd; + task->data[11] = (xScaleEnd - xScaleStart) / duration; + task->data[12] = (yScaleEnd - yScaleStart) / duration; } -u8 sub_80A80C8(struct Task *task) +u8 UpdateEruptAnimTask(struct Task *task) { if (!task->data[8]) return 0; @@ -2065,18 +2070,19 @@ u8 GetBattlerSpriteBGPriorityRank(u8 battlerId) return 1; } -u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, u32 a10) +// Create pokemon sprite to be used for a move animation effect (e.g. Role Play / Snatch) +u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, bool32 ignoreDeoxysForm) { u8 spriteId; - u16 sheet = LoadSpriteSheet(&sUnknown_08525FC0[a3]); - u16 palette = AllocSpritePalette(sUnknown_08525F90[a3].paletteTag); + u16 sheet = LoadSpriteSheet(&sSpriteSheet_MoveEffectMons[id]); + u16 palette = AllocSpritePalette(sSpriteTemplate_MoveEffectMons[id].paletteTag); if (gMonSpritesGfxPtr != NULL && gMonSpritesGfxPtr->buffer == NULL) gMonSpritesGfxPtr->buffer = AllocZeroed(0x2000); if (!isBackpic) { LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20); - if (a10 == 1 || sub_80688F8(5, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0) + if (ignoreDeoxysForm == TRUE || ShouldIgnoreDeoxysForm(5, battlerId) == TRUE || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0) LoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species], gMonSpritesGfxPtr->buffer, species, @@ -2092,7 +2098,7 @@ u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority else { LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20); - if (a10 == 1 || sub_80688F8(5, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0) + if (ignoreDeoxysForm == TRUE || ShouldIgnoreDeoxysForm(5, battlerId) == TRUE || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0) LoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species], gMonSpritesGfxPtr->buffer, species, @@ -2110,9 +2116,9 @@ u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority FREE_AND_SET_NULL(gMonSpritesGfxPtr->buffer); if (!isBackpic) - spriteId = CreateSprite(&sUnknown_08525F90[a3], x, y + gMonFrontPicCoords[species].y_offset, subpriority); + spriteId = CreateSprite(&sSpriteTemplate_MoveEffectMons[id], x, y + gMonFrontPicCoords[species].y_offset, subpriority); else - spriteId = CreateSprite(&sUnknown_08525F90[a3], x, y + gMonBackPicCoords[species].y_offset, subpriority); + spriteId = CreateSprite(&sSpriteTemplate_MoveEffectMons[id], x, y + gMonBackPicCoords[species].y_offset, subpriority); if (IsContest()) { @@ -2299,7 +2305,7 @@ void SetAverageBattlerPositions(u8 battlerId, bool8 respectMonPicOffsets, s16 *x *y = (battlerY + partnerY) / 2; } -u8 sub_80A89C8(int battlerId, u8 spriteId, int species) +u8 CreateInvisibleSpriteCopy(int battlerId, u8 spriteId, int species) { u8 newSpriteId = CreateInvisibleSpriteWithCallback(SpriteCallbackDummy); gSprites[newSpriteId] = gSprites[spriteId]; @@ -2311,7 +2317,7 @@ u8 sub_80A89C8(int battlerId, u8 spriteId, int species) return newSpriteId; } -void sub_80A8A6C(struct Sprite *sprite) +void AnimUnused_80A8A6C(struct Sprite *sprite) { SetSpriteCoordsToAnimAttackerCoords(sprite); if (GetBattlerSide(gBattleAnimAttacker)) @@ -2333,7 +2339,8 @@ void sub_80A8A6C(struct Sprite *sprite) sprite->callback = TranslateSpriteLinearAndFlicker; } -void sub_80A8AEC(struct Sprite *sprite) +// Used by three different unused battle anim sprite templates. +void AnimUnused_80A8AEC(struct Sprite *sprite) { if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) { @@ -2381,7 +2388,7 @@ void AnimTask_AttackerPunchWithTrace(u8 taskId) task->data[2] = 0; task->data[3] = 0; gSprites[task->data[0]].pos2.x -= task->data[0]; - task->data[4] = AllocSpritePalette(10097); + task->data[4] = AllocSpritePalette(ANIM_TAG_BENT_SPOON); task->data[5] = 0; dest = (task->data[4] + 0x10) * 0x10; @@ -2393,10 +2400,10 @@ void AnimTask_AttackerPunchWithTrace(u8 taskId) task->data[6] = 3; CpuCopy32(&gPlttBufferUnfaded[src], &gPlttBufferFaded[dest], 0x20); BlendPalette(dest, 16, gBattleAnimArgs[1], gBattleAnimArgs[0]); - task->func = sub_80A8CAC; + task->func = AnimTask_AttackerPunchWithTrace_Step; } -static void sub_80A8CAC(u8 taskId) +static void AnimTask_AttackerPunchWithTrace_Step(u8 taskId) { struct Task *task = &gTasks[taskId]; switch (task->data[2]) @@ -2463,10 +2470,10 @@ void AnimWeatherBallUp(struct Sprite *sprite) else sprite->data[0] = -10; sprite->data[1] = -40; - sprite->callback = sub_80A8E88; + sprite->callback = AnimWeatherBallUp_Step; } -static void sub_80A8E88(struct Sprite *sprite) +static void AnimWeatherBallUp_Step(struct Sprite *sprite) { sprite->data[2] += sprite->data[0]; sprite->data[3] += sprite->data[1]; diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index a1c4d1afd..f588b5f87 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -353,7 +353,7 @@ const struct SpriteTemplate gQuickGuardArmImpactTemplate = .tileTag = ANIM_TAG_QUICK_GUARD_HAND, .paletteTag = ANIM_TAG_QUICK_GUARD_HAND, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimBasicFistOrFoot @@ -421,7 +421,7 @@ const struct SpriteTemplate gQuashArmHitTemplate = .tileTag = ANIM_TAG_ASSURANCE_HAND, .paletteTag = ANIM_TAG_ASSURANCE_HAND, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimStompFoot @@ -534,7 +534,7 @@ const struct SpriteTemplate gHeartStampSpinningHeartTemplate = .tileTag = ANIM_TAG_HEART_STAMP, .paletteTag = ANIM_TAG_HEART_STAMP, .oam = &gOamData_AffineDouble_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gAffineAnims_SpinningHandOrFoot, .callback = AnimSpinningKickOrPunch @@ -720,7 +720,7 @@ const struct SpriteTemplate gSearingShotEruptionImpactTemplate = .tileTag = ANIM_TAG_WARM_ROCK, .paletteTag = ANIM_TAG_WARM_ROCK, .oam = &gOamData_AffineDouble_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = sSpriteAffineAnimTable_SearingShotRock, .callback = SpriteCB_SearingShotRock @@ -2170,7 +2170,7 @@ const struct SpriteTemplate gIceHammerPunchStompTemplate = .tileTag = ANIM_TAG_HORSESHOE_SIDE_FIST, .paletteTag = ANIM_TAG_HORSESHOE_SIDE_FIST, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimStompFoot @@ -2238,7 +2238,7 @@ const struct SpriteTemplate gHighHorsepowerHorseshoeTemplate = .tileTag = ANIM_TAG_HORSESHOE_SIDE_FIST, .paletteTag = ANIM_TAG_HORSESHOE_SIDE_FIST, .oam = &gOamData_AffineDouble_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gAffineAnims_MegaPunchKick, .callback = AnimSpinningKickOrPunch @@ -2807,7 +2807,7 @@ const struct SpriteTemplate gTropKickGreenFootTemplate = .tileTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimJumpKick @@ -3731,7 +3731,7 @@ const struct SpriteTemplate gClangorousSoulRedFistTemplate = .tileTag = ANIM_TAG_HORSESHOE_SIDE_FIST, .paletteTag = ANIM_TAG_VERTICAL_HEX, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gAnims_HandOrFoot, + .anims = gAnims_HandsAndFeet, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimJumpKick @@ -4249,7 +4249,7 @@ static void SpriteCB_GrowingSuperpower(struct Sprite *sprite) InitAnimLinearTranslation(sprite); StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); - sprite->callback = sub_80A6F98; + sprite->callback = AnimTranslateLinear_WaitEnd; } static void SpriteCB_CentredSpiderWeb(struct Sprite* sprite) diff --git a/src/battle_anim_normal.c b/src/battle_anim_normal.c index 079636626..8292aa442 100644 --- a/src/battle_anim_normal.c +++ b/src/battle_anim_normal.c @@ -12,7 +12,7 @@ static void AnimSimplePaletteBlend_Step(struct Sprite *); static void AnimComplexPaletteBlend(struct Sprite *); static void AnimComplexPaletteBlend_Step1(struct Sprite *); static void AnimComplexPaletteBlend_Step2(struct Sprite *); -static void sub_81159B4(struct Sprite *); +static void AnimUnused_81159B4(struct Sprite *); static void AnimShakeMonOrBattleTerrain(struct Sprite *); static void AnimShakeMonOrBattleTerrain_Step(struct Sprite *); static void AnimShakeMonOrBattleTerrain_UpdateCoordOffsetEnabled(void); @@ -144,7 +144,7 @@ const struct SpriteTemplate gPowerSwapGuardSwapSpriteTemplate = .callback = AnimMovePowerSwapGuardSwap }; -static const union AnimCmd gUnknown_085972A4[] = +static const union AnimCmd sAnim_Unused_085972A4[] = { ANIMCMD_FRAME(0, 3), ANIMCMD_FRAME(16, 3), @@ -154,21 +154,21 @@ static const union AnimCmd gUnknown_085972A4[] = ANIMCMD_JUMP(0), }; -static const union AnimCmd *const gUnknown_085972BC[] = +static const union AnimCmd *const sAnims_Unused_085972BC[] = { - gUnknown_085972A4, + sAnim_Unused_085972A4, }; // Unused -const struct SpriteTemplate gUnknown_085972C0 = +const struct SpriteTemplate gUnusedSpriteTemplate_085972C0 = { .tileTag = ANIM_TAG_SPARKLE_4, .paletteTag = ANIM_TAG_SPARKLE_4, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gUnknown_085972BC, + .anims = sAnims_Unused_085972BC, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_81159B4, + .callback = AnimUnused_81159B4, }; const struct SpriteTemplate gShakeMonOrTerrainSpriteTemplate = @@ -389,7 +389,7 @@ static void AnimConfusionDuck_Step(struct Sprite *sprite) // arg 4: blend color static void AnimSimplePaletteBlend(struct Sprite *sprite) { - u32 selectedPalettes = UnpackSelectedBattleAnimPalettes(gBattleAnimArgs[0]); + u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gBattleAnimArgs[0]); BeginNormalPaletteFade(selectedPalettes, gBattleAnimArgs[1], gBattleAnimArgs[2], gBattleAnimArgs[3], gBattleAnimArgs[4]); sprite->invisible = TRUE; sprite->callback = AnimSimplePaletteBlend_Step; @@ -404,7 +404,7 @@ static void AnimSimplePaletteBlend(struct Sprite *sprite) // 4: gBattleAnimTarget partner OBJ palette // 5: BG palette 4 // 6: BG palette 5 -u32 UnpackSelectedBattleAnimPalettes(s16 selector) +u32 UnpackSelectedBattleBgPalettes(s16 selector) { u8 battleBackground = selector & 1; u8 attacker = (selector >> 1) & 1; @@ -413,7 +413,7 @@ u32 UnpackSelectedBattleAnimPalettes(s16 selector) u8 targetPartner = (selector >> 4) & 1; u8 arg5 = (selector >> 5) & 1; u8 arg6 = (selector >> 6) & 1; - return sub_80A75AC(battleBackground, attacker, target, attackerPartner, targetPartner, arg5, arg6); + return GetBattleBgPalettesMask(battleBackground, attacker, target, attackerPartner, targetPartner, arg5, arg6); } static void AnimSimplePaletteBlend_Step(struct Sprite *sprite) @@ -435,7 +435,7 @@ static void AnimComplexPaletteBlend(struct Sprite *sprite) sprite->data[6] = gBattleAnimArgs[6]; sprite->data[7] = gBattleAnimArgs[0]; - selectedPalettes = UnpackSelectedBattleAnimPalettes(sprite->data[7]); + selectedPalettes = UnpackSelectedBattleBgPalettes(sprite->data[7]); BlendPalettes(selectedPalettes, gBattleAnimArgs[4], gBattleAnimArgs[3]); sprite->invisible = TRUE; sprite->callback = AnimComplexPaletteBlend_Step1; @@ -460,7 +460,7 @@ static void AnimComplexPaletteBlend_Step1(struct Sprite *sprite) return; } - selectedPalettes = UnpackSelectedBattleAnimPalettes(sprite->data[7]); + selectedPalettes = UnpackSelectedBattleBgPalettes(sprite->data[7]); if (sprite->data[1] & 0x100) BlendPalettes(selectedPalettes, sprite->data[4], sprite->data[3]); else @@ -477,13 +477,13 @@ static void AnimComplexPaletteBlend_Step2(struct Sprite *sprite) if (!gPaletteFade.active) { - selectedPalettes = UnpackSelectedBattleAnimPalettes(sprite->data[7]); + selectedPalettes = UnpackSelectedBattleBgPalettes(sprite->data[7]); BlendPalettes(selectedPalettes, 0, 0); DestroyAnimSprite(sprite); } } -static void sub_81159B4(struct Sprite *sprite) +static void AnimUnused_81159B4(struct Sprite *sprite) { sprite->pos1.x += gBattleAnimArgs[0]; sprite->pos1.y += gBattleAnimArgs[1]; @@ -527,7 +527,7 @@ void AnimTask_BlendColorCycle(u8 taskId) static void BlendColorCycle(u8 taskId, u8 startBlendAmount, u8 targetBlendAmount) { - u32 selectedPalettes = UnpackSelectedBattleAnimPalettes(gTasks[taskId].tPalSelector); + u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gTasks[taskId].tPalSelector); BeginNormalPaletteFade( selectedPalettes, gTasks[taskId].tDelay, @@ -804,7 +804,7 @@ void AnimTask_InvertScreenColor(u8 taskId) u32 selectedPalettes = 0; if (gBattleAnimArgs[0] & 0x1) - selectedPalettes = sub_80A75AC(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); if (gBattleAnimArgs[0] & 0x2) selectedPalettes |= (0x10000 << gBattleAnimAttacker); if (gBattleAnimArgs[0] & 0x4) @@ -818,7 +818,7 @@ void AnimTask_InvertScreenColor(u8 taskId) DestroyAnimVisualTask(taskId); } -void sub_8115F94(u8 taskId) +void UnusedAnimTask_8115F94(u8 taskId) { u8 attackerBattler; u8 targetBattler; diff --git a/src/battle_anim_psychic.c b/src/battle_anim_psychic.c index e4e91bd42..470711f8e 100644 --- a/src/battle_anim_psychic.c +++ b/src/battle_anim_psychic.c @@ -682,14 +682,14 @@ static void AnimDefensiveWall_Step5(struct Sprite *sprite) u8 battler = battlerCopy = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); u8 rank = GetBattlerSpriteBGPriorityRank(battler); int var0 = 1; - u8 toBG_2 = (rank ^ var0) != 0; + bool8 toBG2 = (rank ^ var0) != 0; if (IsBattlerSpriteVisible(battler)) - sub_80A477C(toBG_2); + ResetBattleAnimBg(toBG2); battler = battlerCopy ^ 2; if (IsBattlerSpriteVisible(battler)) - sub_80A477C(toBG_2 ^ var0); + ResetBattleAnimBg(toBG2 ^ var0); } sprite->callback = DestroyAnimSprite; @@ -953,7 +953,7 @@ static void AnimTask_ImprisonOrbs_Step(u8 taskId) } } -static void sub_810FB60(struct Sprite *sprite) +static void AnimRedX_Step(struct Sprite *sprite) { if (sprite->data[1] > sprite->data[0] - 10) sprite->invisible = sprite->data[1] & 1; @@ -973,7 +973,7 @@ static void AnimRedX(struct Sprite *sprite) } sprite->data[0] = gBattleAnimArgs[1]; - sprite->callback = sub_810FB60; + sprite->callback = AnimRedX_Step; } void AnimTask_SkillSwap(u8 taskId) diff --git a/src/battle_anim_rock.c b/src/battle_anim_rock.c index b5c0f4b1c..7f91b7365 100644 --- a/src/battle_anim_rock.c +++ b/src/battle_anim_rock.c @@ -19,7 +19,7 @@ static void AnimRockScatter(struct Sprite *); static void AnimRockScatter_Step(struct Sprite *sprite); static void AnimParticleInVortex_Step(struct Sprite *sprite); static void AnimTask_LoadSandstormBackground_Step(u8 taskId); -static void sub_8111214(struct Task *task); +static void CreateRolloutDirtSprite(struct Task *task); static void AnimStealthRockStep2(struct Sprite *sprite); static void AnimStealthRockStep(struct Sprite *sprite); static void AnimStealthRock(struct Sprite *sprite); @@ -508,7 +508,7 @@ void AnimTask_LoadSandstormBackground(u8 taskId) SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_Sandstorm, animBg.tilesOffset); AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimBgTilemap_Sandstorm, 0); LoadCompressedPalette(gBattleAnimSpritePal_FlyingDirt, animBg.paletteId * 16, 32); @@ -567,8 +567,8 @@ static void AnimTask_LoadSandstormBackground_Step(u8 taskId) } break; case 3: - sub_80A6B30(&animBg); - sub_80A6C68(animBg.bgId); + GetBattleAnimBg1Data(&animBg); + ClearBattleAnimBg(animBg.bgId); gTasks[taskId].data[12]++; break; case 4: @@ -756,7 +756,7 @@ static void AnimTask_Rollout_Step(u8 taskId) if (++task->data[9] >= task->data[10]) { task->data[9] = 0; - sub_8111214(task); + CreateRolloutDirtSprite(task); task->data[13] += task->data[14]; PlaySE12WithPanning(SE_M_DIG, task->data[13]); } @@ -773,7 +773,7 @@ static void AnimTask_Rollout_Step(u8 taskId) } } -static void sub_8111214(struct Task *task) +static void CreateRolloutDirtSprite(struct Task *task) { const struct SpriteTemplate *spriteTemplate; int tileOffset; @@ -828,7 +828,7 @@ static void AnimRolloutParticle(struct Sprite *sprite) if (TranslateAnimHorizontalArc(sprite)) { u8 taskId = FindTaskIdByFunc(AnimTask_Rollout_Step); - if (taskId != 0xFF) + if (taskId != TASK_NONE) gTasks[taskId].data[11]--; DestroySprite(sprite); @@ -930,7 +930,7 @@ void AnimTask_MoveSeismicTossBg(u8 taskId) { if (gTasks[taskId].data[0] == 0) { - sub_80A6DAC(FALSE); + UpdateAnimBg3ScreenSize(FALSE); gTasks[taskId].data[1] = 200; } @@ -939,7 +939,7 @@ void AnimTask_MoveSeismicTossBg(u8 taskId) if (gTasks[taskId].data[0] == 120) { - sub_80A6DAC(TRUE); + UpdateAnimBg3ScreenSize(TRUE); DestroyAnimVisualTask(taskId); } @@ -950,7 +950,7 @@ void AnimTask_SeismicTossBgAccelerateDownAtEnd(u8 taskId) { if (gTasks[taskId].data[0] == 0) { - sub_80A6DAC(FALSE); + UpdateAnimBg3ScreenSize(FALSE); gTasks[taskId].data[0]++; gTasks[taskId].data[2] = gBattle_BG3_Y; } @@ -962,7 +962,7 @@ void AnimTask_SeismicTossBgAccelerateDownAtEnd(u8 taskId) if (gBattleAnimArgs[7] == 0xFFF) { gBattle_BG3_Y = 0; - sub_80A6DAC(TRUE); + UpdateAnimBg3ScreenSize(TRUE); DestroyAnimVisualTask(taskId); } } diff --git a/src/battle_anim_smokescreen.c b/src/battle_anim_smokescreen.c index 4120dda72..ea7f94843 100644 --- a/src/battle_anim_smokescreen.c +++ b/src/battle_anim_smokescreen.c @@ -125,7 +125,7 @@ const struct CompressedSpriteSheet gSpriteSheet_EnemyShadow = .data = gEnemyMonShadow_Gfx, .size = 0x80, .tag = 55129 }; -static const struct OamData gUnknown_0831C6A8 = +static const struct OamData sOamData_EnemyShadow = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -146,7 +146,7 @@ const struct SpriteTemplate gSpriteTemplate_EnemyShadow = { .tileTag = 55129, .paletteTag = 55039, - .oam = &gUnknown_0831C6A8, + .oam = &sOamData_EnemyShadow, .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, diff --git a/src/battle_anim_sound_tasks.c b/src/battle_anim_sound_tasks.c index c1aea13f1..bf01ea3ea 100644 --- a/src/battle_anim_sound_tasks.c +++ b/src/battle_anim_sound_tasks.c @@ -9,17 +9,22 @@ extern struct MusicPlayerInfo gMPlayInfo_SE1; -// this file's functions -static void sub_8158B98(u8 taskId); -static void sub_8158C04(u8 taskId); +static void SoundTask_FireBlast_Step1(u8 taskId); +static void SoundTask_FireBlast_Step2(u8 taskId); static void SoundTask_LoopSEAdjustPanning_Step(u8 taskId); static void SoundTask_PlayDoubleCry_Step(u8 taskId); static void SoundTask_PlayCryWithEcho_Step(u8 taskId); static void SoundTask_AdjustPanningVar_Step(u8 taskId); static void SoundTask_SeVolumeChange(u8 taskId); -// task start -void sub_8158B30(u8 taskId) +// Loops the specified sound effect and pans from the +// attacker to the target. The second specified sound effect +// is played at the very end. This task is effectively +// hardcoded to the move FIRE_BLAST due to the baked-in +// durations. +// arg 0: looped sound effect +// arg 1: ending sound effect +void SoundTask_FireBlast(u8 taskId) { s8 pan1, pan2, panIncrement; @@ -35,10 +40,10 @@ void sub_8158B30(u8 taskId) gTasks[taskId].data[4] = panIncrement; gTasks[taskId].data[10] = 10; - gTasks[taskId].func = sub_8158B98; + gTasks[taskId].func = SoundTask_FireBlast_Step1; } -static void sub_8158B98(u8 taskId) +static void SoundTask_FireBlast_Step1(u8 taskId) { s16 pan = gTasks[taskId].data[2]; s8 panIncrement = gTasks[taskId].data[4]; @@ -46,7 +51,7 @@ static void sub_8158B98(u8 taskId) { gTasks[taskId].data[10] = 5; gTasks[taskId].data[11] = 0; - gTasks[taskId].func = sub_8158C04; + gTasks[taskId].func = SoundTask_FireBlast_Step2; } else { @@ -60,7 +65,7 @@ static void sub_8158B98(u8 taskId) } } -static void sub_8158C04(u8 taskId) +static void SoundTask_FireBlast_Step2(u8 taskId) { if (++gTasks[taskId].data[10] == 6) { @@ -73,9 +78,7 @@ static void sub_8158C04(u8 taskId) DestroyAnimSoundTask(taskId); } } -// task end -// task start void SoundTask_LoopSEAdjustPanning(u8 taskId) { u16 songId = gBattleAnimArgs[0]; @@ -127,9 +130,7 @@ static void SoundTask_LoopSEAdjustPanning_Step(u8 taskId) gTasks[taskId].data[11] = KeepPanInRange(gTasks[taskId].data[11], oldPan); } } -// task end -// task start void SoundTask_PlayCryHighPitch(u8 taskId) { u16 species = 0; @@ -173,9 +174,7 @@ void SoundTask_PlayCryHighPitch(u8 taskId) DestroyAnimVisualTask(taskId); } -// task end -// task start void SoundTask_PlayDoubleCry(u8 taskId) { u16 species = 0; @@ -262,7 +261,6 @@ static void SoundTask_PlayDoubleCry_Step(u8 taskId) } } } -// task end void SoundTask_WaitForCry(u8 taskId) { @@ -277,7 +275,6 @@ void SoundTask_WaitForCry(u8 taskId) } } -// task start void SoundTask_PlayCryWithEcho(u8 taskId) { u16 species; @@ -333,7 +330,6 @@ static void SoundTask_PlayCryWithEcho_Step(u8 taskId) break; } } -// task end void SoundTask_PlaySE1WithPanning(u8 taskId) { @@ -451,4 +447,3 @@ static void SoundTask_SeVolumeChange(u8 taskId) m4aMPlayVolumeControl(&gMPlayInfo_SE1, 0xFFFF, gTasks[taskId].tCurrentVolume); } } - diff --git a/src/battle_anim_status_effects.c b/src/battle_anim_status_effects.c index 56a8afa53..9221116ba 100644 --- a/src/battle_anim_status_effects.c +++ b/src/battle_anim_status_effects.c @@ -17,18 +17,16 @@ extern const u8 *const gBattleAnims_StatusConditions[]; extern const struct OamData gOamData_AffineOff_ObjNormal_8x8; extern const struct OamData gOamData_AffineOff_ObjBlend_64x64; -// This file's functions. -static void sub_80A9DB4(u8 taskId); +static void UnusedTask_80A9DB4(u8 taskId); static void AnimTask_FrozenIceCube_Step1(u8 taskId); static void AnimTask_FrozenIceCube_Step2(u8 taskId); static void AnimTask_FrozenIceCube_Step3(u8 taskId); static void AnimTask_FrozenIceCube_Step4(u8 taskId); static void Task_DoStatusAnimation(u8 taskId); -static void sub_80A9E44(struct Sprite *sprite); -static void sub_80A9E78(struct Sprite *sprite); +static void AnimUnused_80A9E44(struct Sprite *sprite); +static void AnimUnused_80A9E44_Step(struct Sprite *sprite); -// const rom data -static const union AnimCmd sSpriteAnim_853EDE4[] = +static const union AnimCmd sAnim_Unused_853EDE4[] = { ANIMCMD_FRAME(0, 3), ANIMCMD_FRAME(4, 3), @@ -37,33 +35,33 @@ static const union AnimCmd sSpriteAnim_853EDE4[] = ANIMCMD_JUMP(0) }; -static const union AnimCmd *const sSpriteAnimTable_853EDF8[] = +static const union AnimCmd *const sAnims_Unused_853EDF8[] = { - sSpriteAnim_853EDE4 + sAnim_Unused_853EDE4 }; // Unused -const struct SpriteTemplate gUnknown_0853EDFC = +const struct SpriteTemplate gUnusedSpriteTemplate_0853EDFC = { .tileTag = ANIM_TAG_ORB, .paletteTag = ANIM_TAG_ORB, .oam = &gOamData_AffineOff_ObjNormal_16x16, - .anims = sSpriteAnimTable_853EDF8, + .anims = sAnims_Unused_853EDF8, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80A8AEC, + .callback = AnimUnused_80A8AEC, }; // Unused -const struct SpriteTemplate gUnknown_0853EE14 = +const struct SpriteTemplate gUnusedSpriteTemplate_0853EE14 = { .tileTag = ANIM_TAG_ORB, .paletteTag = ANIM_TAG_ORB, .oam = &gOamData_AffineOff_ObjNormal_16x16, - .anims = sSpriteAnimTable_853EDF8, + .anims = sAnims_Unused_853EDF8, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80A8A6C, + .callback = AnimUnused_80A8A6C, }; static const union AnimCmd sAnim_WeatherBallNormal[] = @@ -99,7 +97,7 @@ const struct SpriteTemplate gWeatherBallNormalDownSpriteTemplate = .callback = AnimWeatherBallDown, }; -static const union AnimCmd sSpriteAnim_853EE68[] = +static const union AnimCmd sAnim_SpinningSparkle[] = { ANIMCMD_FRAME(0, 3), ANIMCMD_FRAME(16, 3), @@ -109,9 +107,9 @@ static const union AnimCmd sSpriteAnim_853EE68[] = ANIMCMD_END }; -static const union AnimCmd *const sSpriteAnimTable_853EE80[] = +static const union AnimCmd *const sAnims_SpinningSparkle[] = { - sSpriteAnim_853EE68 + sAnim_SpinningSparkle }; const struct SpriteTemplate gSpinningSparkleSpriteTemplate = @@ -119,14 +117,14 @@ const struct SpriteTemplate gSpinningSparkleSpriteTemplate = .tileTag = ANIM_TAG_SPARKLE_4, .paletteTag = ANIM_TAG_SPARKLE_4, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = sSpriteAnimTable_853EE80, + .anims = sAnims_SpinningSparkle, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = AnimSpinningSparkle, }; // Unused -const struct SpriteTemplate gUnknown_0853EE9C = +const struct SpriteTemplate gUnusedSpriteTemplate_0853EE9C = { .tileTag = ANIM_TAG_MONSTER_FOOT, .paletteTag = ANIM_TAG_MONSTER_FOOT, @@ -134,78 +132,79 @@ const struct SpriteTemplate gUnknown_0853EE9C = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80A8AEC, + .callback = AnimUnused_80A8AEC, }; -static const union AnimCmd sSpriteAnim_853EEB4[] = +static const union AnimCmd sAnim_Unused_853EEB4[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_853EEBC[] = +static const union AnimCmd sAnim_Unused_853EEBC[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_853EEC4[] = +static const union AnimCmd sAnim_Unused_853EEC4[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_JUMP(0) }; -static const union AnimCmd *const sSpriteAnimTable_853EECC[] = +static const union AnimCmd *const sAnims_Unused_853EECC[] = { - sSpriteAnim_853EEB4, - sSpriteAnim_853EEBC, - sSpriteAnim_853EEC4 + sAnim_Unused_853EEB4, + sAnim_Unused_853EEBC, + sAnim_Unused_853EEC4, }; // Unused -const struct SpriteTemplate gUnknown_0853EED8 = +const struct SpriteTemplate gUnusedSpriteTemplate_0853EED8 = { .tileTag = ANIM_TAG_IMPACT, .paletteTag = ANIM_TAG_IMPACT, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = sSpriteAnimTable_853EECC, + .anims = sAnims_Unused_853EECC, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80A8AEC, + .callback = AnimUnused_80A8AEC, }; -static const union AnimCmd sSpriteAnim_853EEF0[] = +static const union AnimCmd sAnim_Unused_853EEF0[] = { ANIMCMD_FRAME(0, 15), ANIMCMD_JUMP(0) }; -static const union AnimCmd *const sSpriteAnimTable_853EEF8[] = +static const union AnimCmd *const sAnims_Unused_853EEF8[] = { - sSpriteAnim_853EEF0 + sAnim_Unused_853EEF0 }; -static const union AffineAnimCmd sSpriteAffineAnim_853EEFC[] = +static const union AffineAnimCmd sAffineAnim_Unused_853EEFC[] = { AFFINEANIMCMD_FRAME(96, 96, 0, 0), AFFINEANIMCMD_FRAME(2, 2, 0, 1), AFFINEANIMCMD_JUMP(1) }; -static const union AffineAnimCmd *const sSpriteAffineAnimTable_853EEF8[] = +static const union AffineAnimCmd *const sAffineAnims_Unused_853EEF8[] = { - sSpriteAffineAnim_853EEFC + sAffineAnim_Unused_853EEFC }; -const struct SpriteTemplate gUnknown_0853EF18 = +// Unused +const struct SpriteTemplate gUnusedSpriteTemplate_0853EF18 = { .tileTag = ANIM_TAG_ORB, .paletteTag = ANIM_TAG_ORB, .oam = &gOamData_AffineDouble_ObjNormal_16x16, - .anims = sSpriteAnimTable_853EEF8, + .anims = sAnims_Unused_853EEF8, .images = NULL, - .affineAnims = sSpriteAffineAnimTable_853EEF8, - .callback = sub_80A8A6C, + .affineAnims = sAffineAnims_Unused_853EEF8, + .callback = AnimUnused_80A8A6C, }; static const struct Subsprite sFrozenIceCubeSubsprites[] = @@ -260,7 +259,7 @@ static const struct SpriteTemplate gFrozenIceCubeSpriteTemplate = .callback = SpriteCallbackDummy, }; -static const struct SpriteTemplate gUnknown_0853EF60 = +static const struct SpriteTemplate gUnusedSpriteTemplate_0853EF60 = { .tileTag = ANIM_TAG_CIRCLE_IMPACT, .paletteTag = ANIM_TAG_CIRCLE_IMPACT, @@ -268,14 +267,14 @@ static const struct SpriteTemplate gUnknown_0853EF60 = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80A9E44, + .callback = AnimUnused_80A9E44, }; // Unused -u8 sub_80A9C70(u8 battlerId, bool8 b) +u8 Unused_80A9C70(u8 battlerId, bool8 b) { u8 battlerSpriteId = gBattlerSpriteIds[battlerId]; - u8 taskId = CreateTask(sub_80A9DB4, 10); + u8 taskId = CreateTask(UnusedTask_80A9DB4, 10); u8 spriteId2; u8 i; @@ -287,7 +286,7 @@ u8 sub_80A9C70(u8 battlerId, bool8 b) gTasks[taskId].data[1] = RGB_RED; for (i = 0; i < 10; i++) { - spriteId2 = CreateSprite(&gUnknown_0853EF60, gSprites[battlerSpriteId].pos1.x, gSprites[battlerSpriteId].pos1.y + 32, 0); + spriteId2 = CreateSprite(&gUnusedSpriteTemplate_0853EF60, gSprites[battlerSpriteId].pos1.x, gSprites[battlerSpriteId].pos1.y + 32, 0); gSprites[spriteId2].data[0] = i * 51; gSprites[spriteId2].data[1] = -256; gSprites[spriteId2].invisible = TRUE; @@ -300,7 +299,7 @@ u8 sub_80A9C70(u8 battlerId, bool8 b) gTasks[taskId].data[1] = RGB_BLUE; for (i = 0; i < 10; i++) { - spriteId2 = CreateSprite(&gUnknown_0853EF60, gSprites[battlerSpriteId].pos1.x, gSprites[battlerSpriteId].pos1.y - 32, 0); + spriteId2 = CreateSprite(&gUnusedSpriteTemplate_0853EF60, gSprites[battlerSpriteId].pos1.x, gSprites[battlerSpriteId].pos1.y - 32, 0); gSprites[spriteId2].data[0] = i * 51; gSprites[spriteId2].data[1] = 256; gSprites[spriteId2].invisible = TRUE; @@ -312,7 +311,7 @@ u8 sub_80A9C70(u8 battlerId, bool8 b) return taskId; } -static void sub_80A9DB4(u8 taskId) +static void UnusedTask_80A9DB4(u8 taskId) { if (gTasks[taskId].data[2] == 2) { @@ -345,13 +344,13 @@ static void sub_80A9DB4(u8 taskId) } } -static void sub_80A9E44(struct Sprite *sprite) +static void AnimUnused_80A9E44(struct Sprite *sprite) { if (sprite->data[6] == 0) { sprite->invisible = FALSE; - sprite->callback = sub_80A9E78; - sub_80A9E78(sprite); + sprite->callback = AnimUnused_80A9E44_Step; + AnimUnused_80A9E44_Step(sprite); } else { @@ -359,7 +358,7 @@ static void sub_80A9E44(struct Sprite *sprite) } } -static void sub_80A9E78(struct Sprite *sprite) +static void AnimUnused_80A9E44_Step(struct Sprite *sprite) { sprite->pos2.x = Cos(sprite->data[0], 32); sprite->pos2.y = Sin(sprite->data[0], 8); @@ -538,8 +537,8 @@ void AnimTask_StatsChange(u8 taskId) gBattleAnimArgs[2] = 0; gBattleAnimArgs[3] = 0; gBattleAnimArgs[4] = sharply; - gTasks[taskId].func = sub_8116EB4; - sub_8116EB4(taskId); + gTasks[taskId].func = InitStatsChangeAnimation; + InitStatsChangeAnimation(taskId); } #undef CASE diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index 869daf030..4334fb03a 100755 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -48,7 +48,7 @@ enum { SHINY_STAR_DIAGONAL, }; -static void sub_8170660(u8); +static void AnimTask_UnusedLevelUpHealthBox_Step(u8); static void AnimTask_FlashHealthboxOnLevelUp_Step(u8); static void AnimTask_ThrowBall_Step(u8); static void SpriteCB_Ball_Throw(struct Sprite *); @@ -430,9 +430,12 @@ static const struct SpriteTemplate sSafariRockSpriteTemplate = extern const struct SpriteTemplate gWishStarSpriteTemplate; extern const struct SpriteTemplate gMiniTwinklingStarSpriteTemplate; -void unref_sub_8170478(u8 taskId) +// This is an unused function, but it seems likely that it was +// intended to be an additional effect during the level-up animation. +// It is an upward blue gradient effect on the mon's healthbox. +void AnimTask_UnusedLevelUpHealthBox(u8 taskId) { - struct BattleAnimBgData unknownStruct; + struct BattleAnimBgData animBgData; u8 healthBoxSpriteId; u8 battler; u8 spriteId1, spriteId2, spriteId3, spriteId4; @@ -465,20 +468,20 @@ void unref_sub_8170478(u8 taskId) gSprites[spriteId3].callback = SpriteCallbackDummy; gSprites[spriteId4].callback = SpriteCallbackDummy; - sub_80A6B30(&unknownStruct); - AnimLoadCompressedBgTilemap(unknownStruct.bgId, gUnknown_08C2EA9C); - AnimLoadCompressedBgGfx(unknownStruct.bgId, gUnknown_08C2EA50, unknownStruct.tilesOffset); - LoadCompressedPalette(gCureBubblesPal, unknownStruct.paletteId << 4, 32); + GetBattleAnimBg1Data(&animBgData); + AnimLoadCompressedBgTilemap(animBgData.bgId, UnusedLevelupAnimationTilemap); + AnimLoadCompressedBgGfx(animBgData.bgId, UnusedLevelupAnimationGfx, animBgData.tilesOffset); + LoadCompressedPalette(gCureBubblesPal, animBgData.paletteId << 4, 32); gBattle_BG1_X = -gSprites[spriteId3].pos1.x + 32; gBattle_BG1_Y = -gSprites[spriteId3].pos1.y - 32; gTasks[taskId].data[1] = 640; gTasks[taskId].data[0] = spriteId3; gTasks[taskId].data[2] = spriteId4; - gTasks[taskId].func = sub_8170660; + gTasks[taskId].func = AnimTask_UnusedLevelUpHealthBox_Step; } -static void sub_8170660(u8 taskId) +static void AnimTask_UnusedLevelUpHealthBox_Step(u8 taskId) { u8 spriteId1, spriteId2; u8 battler; @@ -512,7 +515,7 @@ static void sub_8170660(u8 taskId) SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12])); if (gTasks[taskId].data[12] == 0) { - sub_80A477C(0); + ResetBattleAnimBg(0); gBattle_WIN0H = 0; gBattle_WIN0V = 0; SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR); @@ -687,7 +690,7 @@ void AnimTask_SwitchOutBallEffect(u8 taskId) priority = gSprites[spriteId].oam.priority; subpriority = gSprites[spriteId].subpriority; gTasks[taskId].data[10] = AnimateBallOpenParticles(x, y + 32, priority, subpriority, ballId); - selectedPalettes = sub_80A75AC(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); gTasks[taskId].data[11] = LaunchBallFadeMonTask(FALSE, gBattleAnimAttacker, selectedPalettes, ballId); gTasks[taskId].data[0]++; break; diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index 411e60767..4d18d04fa 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -29,26 +29,26 @@ static void AnimTask_HardwarePaletteFade_Step(u8); static void AnimTask_TraceMonBlended_Step(u8); static void AnimMonTrace(struct Sprite*); static void AnimTask_DrawFallingWhiteLinesOnAttacker_Step(u8); -static void sub_8116F04(u8); -static void sub_81170EC(u8); -static void sub_81172EC(u8); +static void StatsChangeAnimation_Step1(u8); +static void StatsChangeAnimation_Step2(u8); +static void StatsChangeAnimation_Step3(u8); static void AnimTask_Flash_Step(u8); -static void sub_81175C4(u32, u16); +static void SetPalettesToColor(u32, u16); static void AnimTask_UpdateSlidingBg(u8); -static void sub_8117A60(u8); +static void UpdateMonScrollingBgMask(u8); static void AnimTask_WaitAndRestoreVisibility(u8); -const u16 gUnknown_08597418 = RGB(31, 31, 31); +static const u16 sCurseLinesPalette[] = { RGB_WHITE }; -// These belong in battle_intro.c, but there putting them there causes 2 bytes of alignment padding +// These belong in battle_intro.c, but putting them there causes 2 bytes of alignment padding // between the two .rodata segments. Perhaps battle_intro.c actually belongs in this file, too. -const u8 gUnknown_0859741A[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT}; -const u8 gUnknown_0859741E[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT}; +const u8 gBattleAnimBgCntSet[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT}; +const u8 gBattleAnimBgCntGet[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT}; void AnimTask_BlendBattleAnimPal(u8 taskId) { - u32 selectedPalettes = UnpackSelectedBattleAnimPalettes(gBattleAnimArgs[0]); - selectedPalettes |= sub_80A76C4((gBattleAnimArgs[0] >> 7) & 1, + u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gBattleAnimArgs[0]); + selectedPalettes |= GetBattleMonSpritePalettesMask((gBattleAnimArgs[0] >> 7) & 1, (gBattleAnimArgs[0] >> 8) & 1, (gBattleAnimArgs[0] >> 9) & 1, (gBattleAnimArgs[0] >> 10) & 1); @@ -62,7 +62,7 @@ void AnimTask_BlendBattleAnimPalExclude(u8 taskId) u8 animBattlers[2]; animBattlers[1] = 0xFF; - selectedPalettes = UnpackSelectedBattleAnimPalettes(1); + selectedPalettes = UnpackSelectedBattleBgPalettes(1); switch (gBattleAnimArgs[0]) { case 2: @@ -97,7 +97,7 @@ void AnimTask_BlendBattleAnimPalExclude(u8 taskId) for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++) { if (battler != animBattlers[0] && battler != animBattlers[1] && IsBattlerSpriteVisible(battler)) - selectedPalettes |= 0x10000 << sub_80A77AC(battler); + selectedPalettes |= 0x10000 << AnimDummyReturnArg(battler); } StartBlendAnimSpriteColor(taskId, selectedPalettes); @@ -105,7 +105,7 @@ void AnimTask_BlendBattleAnimPalExclude(u8 taskId) void AnimTask_SetCamouflageBlend(u8 taskId) { - u32 selectedPalettes = UnpackSelectedBattleAnimPalettes(gBattleAnimArgs[0]); + u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gBattleAnimArgs[0]); switch (gBattleTerrain) { case BATTLE_TERRAIN_GRASS: @@ -278,7 +278,7 @@ void AnimTask_DrawFallingWhiteLinesOnAttacker(u8 taskId) int spriteId, newSpriteId; u16 var0; u16 bg1Cnt; - struct BattleAnimBgData unknownStruct; + struct BattleAnimBgData animBgData; var0 = 0; gBattle_WIN0H = 0; @@ -329,11 +329,11 @@ void AnimTask_DrawFallingWhiteLinesOnAttacker(u8 taskId) } spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER); - newSpriteId = sub_80A89C8(gBattleAnimAttacker, spriteId, species); - sub_80A6B30(&unknownStruct); - AnimLoadCompressedBgTilemapHandleContest(&unknownStruct, gUnknown_08C20684, 0); - AnimLoadCompressedBgGfx(unknownStruct.bgId, gUnknown_08C20668, unknownStruct.tilesOffset); - LoadPalette(&gUnknown_08597418, unknownStruct.paletteId * 16 + 1, 2); + newSpriteId = CreateInvisibleSpriteCopy(gBattleAnimAttacker, spriteId, species); + GetBattleAnimBg1Data(&animBgData); + AnimLoadCompressedBgTilemapHandleContest(&animBgData, gBattleAnimMaskTilemap_Curse, 0); + AnimLoadCompressedBgGfx(animBgData.bgId, gBattleAnimMaskImage_Curse, animBgData.tilesOffset); + LoadPalette(sCurseLinesPalette, animBgData.paletteId * 16 + 1, 2); gBattle_BG1_X = -gSprites[spriteId].pos1.x + 32; gBattle_BG1_Y = -gSprites[spriteId].pos1.y + 32; @@ -344,7 +344,7 @@ void AnimTask_DrawFallingWhiteLinesOnAttacker(u8 taskId) static void AnimTask_DrawFallingWhiteLinesOnAttacker_Step(u8 taskId) { - struct BattleAnimBgData unknownStruct; + struct BattleAnimBgData animBgData; struct Sprite *sprite; u16 bg1Cnt; @@ -356,7 +356,7 @@ static void AnimTask_DrawFallingWhiteLinesOnAttacker_Step(u8 taskId) gBattle_BG1_Y += 64; if (++gTasks[taskId].data[11] == 4) { - sub_80A477C(0); + ResetBattleAnimBg(0); gBattle_WIN0H = 0; gBattle_WIN0V = 0; SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR @@ -377,8 +377,8 @@ static void AnimTask_DrawFallingWhiteLinesOnAttacker_Step(u8 taskId) sprite = &gSprites[gTasks[taskId].data[0]]; DestroySprite(sprite); - sub_80A6B30(&unknownStruct); - sub_80A6C68(unknownStruct.bgId); + GetBattleAnimBg1Data(&animBgData); + ClearBattleAnimBg(animBgData.bgId); if (gTasks[taskId].data[6] == 1) gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].oam.priority++; @@ -388,7 +388,7 @@ static void AnimTask_DrawFallingWhiteLinesOnAttacker_Step(u8 taskId) } } -void sub_8116EB4(u8 taskId) +void InitStatsChangeAnimation(u8 taskId) { u8 i; @@ -396,10 +396,10 @@ void sub_8116EB4(u8 taskId) for (i = 0; i < 8; i++) sAnimStatsChangeData->data[i] = gBattleAnimArgs[i]; - gTasks[taskId].func = sub_8116F04; + gTasks[taskId].func = StatsChangeAnimation_Step1; } -static void sub_8116F04(u8 taskId) +static void StatsChangeAnimation_Step1(u8 taskId) { if (sAnimStatsChangeData->data[2] == 0) sAnimStatsChangeData->battler1 = gBattleAnimAttacker; @@ -450,56 +450,56 @@ static void sub_8116F04(u8 taskId) sAnimStatsChangeData->species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[sAnimStatsChangeData->battler1]], MON_DATA_SPECIES); } - gTasks[taskId].func = sub_81170EC; + gTasks[taskId].func = StatsChangeAnimation_Step2; } -static void sub_81170EC(u8 taskId) +static void StatsChangeAnimation_Step2(u8 taskId) { - struct BattleAnimBgData unknownStruct; + struct BattleAnimBgData animBgData; u8 spriteId, spriteId2; u8 battlerSpriteId; spriteId2 = 0; battlerSpriteId = gBattlerSpriteIds[sAnimStatsChangeData->battler1]; - spriteId = sub_80A89C8(sAnimStatsChangeData->battler1, battlerSpriteId, sAnimStatsChangeData->species); + spriteId = CreateInvisibleSpriteCopy(sAnimStatsChangeData->battler1, battlerSpriteId, sAnimStatsChangeData->species); if (sAnimStatsChangeData->data[3]) { battlerSpriteId = gBattlerSpriteIds[sAnimStatsChangeData->battler2]; - spriteId2 = sub_80A89C8(sAnimStatsChangeData->battler2, battlerSpriteId, sAnimStatsChangeData->species); + spriteId2 = CreateInvisibleSpriteCopy(sAnimStatsChangeData->battler2, battlerSpriteId, sAnimStatsChangeData->species); } - sub_80A6B30(&unknownStruct); + GetBattleAnimBg1Data(&animBgData); if (sAnimStatsChangeData->data[0] == 0) - AnimLoadCompressedBgTilemapHandleContest(&unknownStruct, gBattleStatMask1_Tilemap, 0); + AnimLoadCompressedBgTilemapHandleContest(&animBgData, gBattleStatMask1_Tilemap, 0); else - AnimLoadCompressedBgTilemapHandleContest(&unknownStruct, gBattleStatMask2_Tilemap, 0); + AnimLoadCompressedBgTilemapHandleContest(&animBgData, gBattleStatMask2_Tilemap, 0); - AnimLoadCompressedBgGfx(unknownStruct.bgId, gBattleStatMask_Gfx, unknownStruct.tilesOffset); + AnimLoadCompressedBgGfx(animBgData.bgId, gBattleStatMask_Gfx, animBgData.tilesOffset); switch (sAnimStatsChangeData->data[1]) { case 0: - LoadCompressedPalette(gBattleStatMask2_Pal, unknownStruct.paletteId * 16, 32); + LoadCompressedPalette(gBattleStatMask2_Pal, animBgData.paletteId * 16, 32); break; case 1: - LoadCompressedPalette(gBattleStatMask1_Pal, unknownStruct.paletteId * 16, 32); + LoadCompressedPalette(gBattleStatMask1_Pal, animBgData.paletteId * 16, 32); break; case 2: - LoadCompressedPalette(gBattleStatMask3_Pal, unknownStruct.paletteId * 16, 32); + LoadCompressedPalette(gBattleStatMask3_Pal, animBgData.paletteId * 16, 32); break; case 3: - LoadCompressedPalette(gBattleStatMask4_Pal, unknownStruct.paletteId * 16, 32); + LoadCompressedPalette(gBattleStatMask4_Pal, animBgData.paletteId * 16, 32); break; case 4: - LoadCompressedPalette(gBattleStatMask6_Pal, unknownStruct.paletteId * 16, 32); + LoadCompressedPalette(gBattleStatMask6_Pal, animBgData.paletteId * 16, 32); break; case 5: - LoadCompressedPalette(gBattleStatMask7_Pal, unknownStruct.paletteId * 16, 32); + LoadCompressedPalette(gBattleStatMask7_Pal, animBgData.paletteId * 16, 32); break; case 6: - LoadCompressedPalette(gBattleStatMask8_Pal, unknownStruct.paletteId * 16, 32); + LoadCompressedPalette(gBattleStatMask8_Pal, animBgData.paletteId * 16, 32); break; default: - LoadCompressedPalette(gBattleStatMask5_Pal, unknownStruct.paletteId * 16, 32); + LoadCompressedPalette(gBattleStatMask5_Pal, animBgData.paletteId * 16, 32); break; } @@ -532,7 +532,7 @@ static void sub_81170EC(u8 taskId) gTasks[taskId].data[3] = spriteId2; gTasks[taskId].data[6] = sAnimStatsChangeData->higherPriority; gTasks[taskId].data[7] = gBattlerSpriteIds[sAnimStatsChangeData->battler2]; - gTasks[taskId].func = sub_81172EC; + gTasks[taskId].func = StatsChangeAnimation_Step3; if (sAnimStatsChangeData->data[0] == 0) PlaySE12WithPanning(SE_M_STAT_INCREASE, BattleAnimAdjustPanning2(-64)); @@ -540,7 +540,7 @@ static void sub_81170EC(u8 taskId) PlaySE12WithPanning(SE_M_STAT_DECREASE, BattleAnimAdjustPanning2(-64)); } -static void sub_81172EC(u8 taskId) +static void StatsChangeAnimation_Step3(u8 taskId) { gBattle_BG1_Y += gTasks[taskId].data[1]; @@ -568,7 +568,7 @@ static void sub_81172EC(u8 taskId) SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12])); if (gTasks[taskId].data[12] == 0) { - sub_80A477C(0); + ResetBattleAnimBg(0); gTasks[taskId].data[15]++; } } @@ -603,12 +603,12 @@ static void sub_81172EC(u8 taskId) void AnimTask_Flash(u8 taskId) { - u32 selectedPalettes = sub_80A76C4(1, 1, 1, 1); - sub_81175C4(selectedPalettes, 0); + u32 selectedPalettes = GetBattleMonSpritePalettesMask(1, 1, 1, 1); + SetPalettesToColor(selectedPalettes, RGB_BLACK); gTasks[taskId].data[14] = selectedPalettes >> 16; - selectedPalettes = sub_80A75AC(1, 0, 0, 0, 0, 0, 0) & 0xFFFF; - sub_81175C4(selectedPalettes, 0xFFFF); + selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0) & 0xFFFF; + SetPalettesToColor(selectedPalettes, RGB_WHITEALPHA); gTasks[taskId].data[15] = selectedPalettes; gTasks[taskId].data[0] = 0; @@ -662,7 +662,7 @@ static void AnimTask_Flash_Step(u8 taskId) } } -static void sub_81175C4(u32 selectedPalettes, u16 color) +static void SetPalettesToColor(u32 selectedPalettes, u16 color) { u16 i; @@ -705,7 +705,7 @@ void AnimTask_StartSlidingBg(u8 taskId) { u8 newTaskId; - sub_80A6DAC(0); + UpdateAnimBg3ScreenSize(FALSE); newTaskId = CreateTask(AnimTask_UpdateSlidingBg, 5); if (gBattleAnimArgs[2] && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) { @@ -733,7 +733,7 @@ static void AnimTask_UpdateSlidingBg(u8 taskId) { gBattle_BG3_X = 0; gBattle_BG3_Y = 0; - sub_80A6DAC(1); + UpdateAnimBg3ScreenSize(TRUE); DestroyTask(taskId); } } @@ -756,8 +756,6 @@ void AnimTask_GetTargetIsAttackerPartner(u8 taskId) DestroyAnimVisualTask(taskId); } -#define tInvisible gBattleAnimArgs[0]; - // For hiding or subsequently revealing all other battlers void AnimTask_SetAllNonAttackersInvisiblity(u8 taskId) { @@ -766,27 +764,25 @@ void AnimTask_SetAllNonAttackersInvisiblity(u8 taskId) for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++) { if (battler != gBattleAnimAttacker && IsBattlerSpriteVisible(battler)) - gSprites[gBattlerSpriteIds[battler]].invisible = tInvisible; + gSprites[gBattlerSpriteIds[battler]].invisible = gBattleAnimArgs[0]; } DestroyAnimVisualTask(taskId); } -#undef tInvisible - -void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u32 *gfx, const u32 *tilemap, const u32 *palette) +void StartMonScrollingBgMask(u8 taskId, int unused, u16 scrollSpeed, u8 battler, bool8 includePartner, u8 numFadeSteps, u8 fadeStepDelay, u8 duration, const u32 *gfx, const u32 *tilemap, const u32 *palette) { u16 species; u8 spriteId, spriteId2; u16 bg1Cnt; - struct BattleAnimBgData unknownStruct; + struct BattleAnimBgData animBgData; u8 battler2; spriteId2 = 0; - battler2 = BATTLE_PARTNER(battler1); + battler2 = BATTLE_PARTNER(battler); - if (IsContest() || (arg4 && !IsBattlerSpriteVisible(battler2))) - arg4 = 0; + if (IsContest() || (includePartner && !IsBattlerSpriteVisible(battler2))) + includePartner = FALSE; gBattle_WIN0H = 0; gBattle_WIN0V = 0; @@ -814,34 +810,34 @@ void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, } else { - if (GetBattlerSide(battler1) != B_SIDE_PLAYER) - species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler1]], MON_DATA_SPECIES); + if (GetBattlerSide(battler) != B_SIDE_PLAYER) + species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES); else - species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler1]], MON_DATA_SPECIES); + species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES); } - spriteId = sub_80A89C8(battler1, gBattlerSpriteIds[battler1], species); - if (arg4) - spriteId2 = sub_80A89C8(battler2, gBattlerSpriteIds[battler2], species); + spriteId = CreateInvisibleSpriteCopy(battler, gBattlerSpriteIds[battler], species); + if (includePartner) + spriteId2 = CreateInvisibleSpriteCopy(battler2, gBattlerSpriteIds[battler2], species); - sub_80A6B30(&unknownStruct); - AnimLoadCompressedBgTilemapHandleContest(&unknownStruct, tilemap, 0); - AnimLoadCompressedBgGfx(unknownStruct.bgId, gfx, unknownStruct.tilesOffset); - LoadCompressedPalette(palette, unknownStruct.paletteId * 16, 32); + GetBattleAnimBg1Data(&animBgData); + AnimLoadCompressedBgTilemapHandleContest(&animBgData, tilemap, 0); + AnimLoadCompressedBgGfx(animBgData.bgId, gfx, animBgData.tilesOffset); + LoadCompressedPalette(palette, animBgData.paletteId * 16, 32); gBattle_BG1_X = 0; gBattle_BG1_Y = 0; - gTasks[taskId].data[1] = arg2; - gTasks[taskId].data[4] = arg5; - gTasks[taskId].data[5] = arg7; - gTasks[taskId].data[6] = arg6; + gTasks[taskId].data[1] = scrollSpeed; + gTasks[taskId].data[4] = numFadeSteps; + gTasks[taskId].data[5] = duration; + gTasks[taskId].data[6] = fadeStepDelay; gTasks[taskId].data[0] = spriteId; - gTasks[taskId].data[2] = arg4; + gTasks[taskId].data[2] = includePartner; gTasks[taskId].data[3] = spriteId2; - gTasks[taskId].func = sub_8117A60; + gTasks[taskId].func = UpdateMonScrollingBgMask; } -static void sub_8117A60(u8 taskId) +static void UpdateMonScrollingBgMask(u8 taskId) { gTasks[taskId].data[13] += gTasks[taskId].data[1] < 0 ? -gTasks[taskId].data[1] : gTasks[taskId].data[1]; if (gTasks[taskId].data[1] < 0) @@ -874,7 +870,7 @@ static void sub_8117A60(u8 taskId) SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12])); if (gTasks[taskId].data[12] == 0) { - sub_80A477C(0); + ResetBattleAnimBg(0); gBattle_WIN0H = 0; gBattle_WIN0V = 0; SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR @@ -927,7 +923,7 @@ void AnimTask_CopyPalUnfadedToBackup(u8 taskId) if (gBattleAnimArgs[0] == 0) { - selectedPalettes = sub_80A75AC(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); while ((selectedPalettes & 1) == 0) { selectedPalettes >>= 1; @@ -954,7 +950,7 @@ void AnimTask_CopyPalUnfadedFromBackup(u8 taskId) if (gBattleAnimArgs[0] == 0) { - selectedPalettes = sub_80A75AC(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); while ((selectedPalettes & 1) == 0) { selectedPalettes >>= 1; @@ -981,7 +977,7 @@ void AnimTask_CopyPalFadedToUnfaded(u8 taskId) if (gBattleAnimArgs[0] == 0) { - selectedPalettes = sub_80A75AC(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); while ((selectedPalettes & 1) == 0) { selectedPalettes >>= 1; diff --git a/src/battle_anim_water.c b/src/battle_anim_water.c index 207f89f35..9f2d18f14 100644 --- a/src/battle_anim_water.c +++ b/src/battle_anim_water.c @@ -991,7 +991,7 @@ void AnimTask_CreateSurfWave(u8 taskId) SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16)); SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 1); - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); if (!IsContest()) { SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1); @@ -1077,7 +1077,7 @@ static void AnimTask_CreateSurfWave_Step1(u8 taskId) *BGptrX += gTasks[taskId].data[0]; *BGptrY += gTasks[taskId].data[1]; - sub_80A6B30(&animBg); + GetBattleAnimBg1Data(&animBg); gTasks[taskId].data[2] += gTasks[taskId].data[1]; if (++gTasks[taskId].data[5] == 4) { @@ -1116,8 +1116,8 @@ static void AnimTask_CreateSurfWave_Step2(u8 taskId) u16 *BGptrY = &gBattle_BG1_Y; if (gTasks[taskId].data[0] == 0) { - sub_80A6C68(1); - sub_80A6C68(2); + ClearBattleAnimBg(1); + ClearBattleAnimBg(2); gTasks[taskId].data[0]++; } else @@ -1246,7 +1246,7 @@ static void AnimTask_WaterSpoutLaunch_Step(u8 taskId) switch (task->data[0]) { case 0: - sub_80A805C(task, task->data[15], 0x100, 0x100, 224, 0x200, 32); + PrepareEruptAnimTaskData(task, task->data[15], 0x100, 0x100, 0xE0, 0x200, 32); task->data[0]++; case 1: if (++task->data[3] > 1) @@ -1262,7 +1262,7 @@ static void AnimTask_WaterSpoutLaunch_Step(u8 taskId) gSprites[task->data[15]].pos2.x = -3; } } - if (sub_80A80C8(task) == 0) + if (UpdateEruptAnimTask(task) == 0) { SetBattlerSpriteYOffsetFromYScale(task->data[15]); gSprites[task->data[15]].pos2.x = 0; @@ -1274,13 +1274,13 @@ static void AnimTask_WaterSpoutLaunch_Step(u8 taskId) case 2: if (++task->data[3] > 4) { - sub_80A805C(task, task->data[15], 224, 0x200, 384, 224, 8); + PrepareEruptAnimTaskData(task, task->data[15], 0xE0, 0x200, 0x180, 0xE0, 8); task->data[3] = 0; task->data[0]++; } break; case 3: - if (sub_80A80C8(task) == 0) + if (UpdateEruptAnimTask(task) == 0) { task->data[3] = 0; task->data[4] = 0; @@ -1300,7 +1300,7 @@ static void AnimTask_WaterSpoutLaunch_Step(u8 taskId) gSprites[task->data[15]].pos2.y -= 2; if (task->data[4] == 10) { - sub_80A805C(task, task->data[15], 384, 224, 0x100, 0x100, 8); + PrepareEruptAnimTaskData(task, task->data[15], 0x180, 0xE0, 0x100, 0x100, 8); task->data[3] = 0; task->data[4] = 0; task->data[0]++; @@ -1309,7 +1309,7 @@ static void AnimTask_WaterSpoutLaunch_Step(u8 taskId) break; case 6: gSprites[task->data[15]].pos1.y--; - if (sub_80A80C8(task) == 0) + if (UpdateEruptAnimTask(task) == 0) { ResetSpriteRotScale(task->data[15]); gSprites[task->data[15]].pos1.y = task->data[5]; @@ -1453,14 +1453,14 @@ static void AnimTask_WaterSpoutRain_Step(u8 taskId) gBattleAnimArgs[1] = 0; gBattleAnimArgs[2] = 12; taskId2 = CreateTask(AnimTask_HorizontalShake, 80); - if (taskId2 != 0xFF) + if (taskId2 != TASK_NONE) { gTasks[taskId2].func(taskId2); gAnimVisualTaskCount++; } gBattleAnimArgs[0] = ANIM_DEF_PARTNER; taskId2 = CreateTask(AnimTask_HorizontalShake, 80); - if (taskId2 != 0xFF) + if (taskId2 != TASK_NONE) { gTasks[taskId2].func(taskId2); gAnimVisualTaskCount++; diff --git a/src/battle_bg.c b/src/battle_bg.c index 96708099d..5ed0bde80 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -102,7 +102,7 @@ static const struct SpriteTemplate sVsLetter_V_SpriteTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = sVsLetterAffineAnimTable, - .callback = nullsub_17 + .callback = SpriteCB_VsLetterDummy }; static const struct SpriteTemplate sVsLetter_S_SpriteTemplate = @@ -113,7 +113,7 @@ static const struct SpriteTemplate sVsLetter_S_SpriteTemplate = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = sVsLetterAffineAnimTable, - .callback = nullsub_17 + .callback = SpriteCB_VsLetterDummy }; static const struct CompressedSpriteSheet sVsLettersSpriteSheet = diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 4cff37913..02c3a376e 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -51,7 +51,7 @@ static void LinkOpponentHandleMoveAnimation(void); static void LinkOpponentHandlePrintString(void); static void LinkOpponentHandlePrintSelectionString(void); static void LinkOpponentHandleChooseAction(void); -static void LinkOpponentHandleUnknownYesNoBox(void); +static void LinkOpponentHandleYesNoBox(void); static void LinkOpponentHandleChooseMove(void); static void LinkOpponentHandleChooseItem(void); static void LinkOpponentHandleChoosePokemon(void); @@ -87,21 +87,21 @@ static void LinkOpponentHandleSpriteInvisibility(void); static void LinkOpponentHandleBattleAnimation(void); static void LinkOpponentHandleLinkStandbyMsg(void); static void LinkOpponentHandleResetActionMoveSelection(void); -static void LinkOpponentHandleCmd55(void); +static void LinkOpponentHandleEndLinkBattle(void); static void LinkOpponentHandleBattleDebug(void); static void LinkOpponentCmdEnd(void); static void LinkOpponentBufferRunCommand(void); static void LinkOpponentBufferExecCompleted(void); -static void sub_8064DD0(void); +static void SwitchIn_HandleSoundAndEnd(void); static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst); static void SetLinkOpponentMonData(u8 monId); -static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit); +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); static void DoSwitchOutAnimation(void); static void LinkOpponentDoMoveAnimation(void); -static void sub_8067618(u8 taskId); -static void sub_80676FC(struct Sprite *sprite); -static void sub_806782C(void); +static void Task_StartSendOutAnim(u8 taskId); +static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite); +static void EndDrawPartyStatusSummary(void); static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { @@ -124,7 +124,7 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_PRINTSTRING] = LinkOpponentHandlePrintString, [CONTROLLER_PRINTSTRINGPLAYERONLY] = LinkOpponentHandlePrintSelectionString, [CONTROLLER_CHOOSEACTION] = LinkOpponentHandleChooseAction, - [CONTROLLER_UNKNOWNYESNOBOX] = LinkOpponentHandleUnknownYesNoBox, + [CONTROLLER_YESNOBOX] = LinkOpponentHandleYesNoBox, [CONTROLLER_CHOOSEMOVE] = LinkOpponentHandleChooseMove, [CONTROLLER_OPENBAG] = LinkOpponentHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = LinkOpponentHandleChoosePokemon, @@ -160,12 +160,12 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_BATTLEANIMATION] = LinkOpponentHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = LinkOpponentHandleLinkStandbyMsg, [CONTROLLER_RESETACTIONMOVESELECTION] = LinkOpponentHandleResetActionMoveSelection, - [CONTROLLER_55] = LinkOpponentHandleCmd55, + [CONTROLLER_ENDLINKBATTLE] = LinkOpponentHandleEndLinkBattle, [CONTROLLER_DEBUGMENU] = LinkOpponentHandleBattleDebug, [CONTROLLER_TERMINATOR_NOP] = LinkOpponentCmdEnd }; -static void nullsub_28(void) +static void LinkOpponentDummy(void) { } @@ -197,7 +197,7 @@ static void CompleteOnBankSpriteCallbackDummy2(void) LinkOpponentBufferExecCompleted(); } -static void sub_8064470(void) +static void FreeTrainerSpriteAfterSlide(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { @@ -208,38 +208,38 @@ static void sub_8064470(void) } } -static void sub_80644D8(void) +static void Intro_DelayAndEnd(void) { - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 == 0xFF) + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; LinkOpponentBufferExecCompleted(); } } -static void sub_8064520(void) +static void Intro_WaitForShinyAnimAndHealthbox(void) { - bool32 r8 = FALSE; - bool32 r4 = FALSE; + bool32 healthboxAnimDone = FALSE; + bool32 twoMons = FALSE; if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - r8 = TRUE; + healthboxAnimDone = TRUE; } else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy) { - r8 = TRUE; + healthboxAnimDone = TRUE; } - r4 = TRUE; + twoMons = TRUE; } - if (r8) + if (healthboxAnimDone) { - if (r4 || !IsBattlerSpriteVisible(BATTLE_PARTNER(gActiveBattler))) + if (twoMons || !IsBattlerSpriteVisible(BATTLE_PARTNER(gActiveBattler))) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) return; @@ -252,8 +252,8 @@ static void sub_8064520(void) gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } else { @@ -265,19 +265,19 @@ static void sub_8064520(void) if (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT) { - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerControllerFuncs[gActiveBattler] = sub_80644D8; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; + gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; } } -static void sub_8064734(void) +static void Intro_TryShinyAnimShowHealthbox(void) { - bool32 r10 = FALSE; + bool32 bgmRestored = FALSE; if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim @@ -296,27 +296,27 @@ static void sub_8064734(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL); - sub_8076918(BATTLE_PARTNER(gActiveBattler)); + StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler)); SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 1; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = TRUE; } - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x40 - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 - && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].field_1_x40 + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry + && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted + && !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].waitForCry && !IsCryPlayingOrClearCrySongs()) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) { @@ -329,42 +329,42 @@ static void sub_8064734(void) } } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 1; - r10 = TRUE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; + bgmRestored = TRUE; } - if (r10) + if (bgmRestored) { - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT) { - if (++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 == 1) + if (++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == 1) return; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; } if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gUnknown_03005D7C[BATTLE_PARTNER(gActiveBattler)]]); + DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]); SetBattlerShadowSpriteCallback(BATTLE_PARTNER(gActiveBattler), GetMonData(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], MON_DATA_SPECIES)); } - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattleSpritesDataPtr->animationData->field_9_x1 = 0; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 0; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 0; + gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; - gBattlerControllerFuncs[gActiveBattler] = sub_8064520; + gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; } } } -static void sub_8064B04(void) +static void TryShinyAnimAfterMonAnim(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0) @@ -379,8 +379,8 @@ static void sub_8064B04(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); LinkOpponentBufferExecCompleted(); } } @@ -403,7 +403,7 @@ static void CompleteOnHealthbarDone(void) } } -static void sub_8064C14(void) +static void HideHealthboxAfterMonFaint(void) { if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse) { @@ -412,7 +412,7 @@ static void sub_8064C14(void) } } -static void sub_8064C58(void) +static void FreeMonSpriteAfterSwitchOutAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { @@ -449,18 +449,18 @@ static void DoHitAnimBlinkSpriteEffect(void) } } -static void sub_8064D60(void) +static void SwitchIn_ShowSubstitute(void) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = sub_8064DD0; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_HandleSoundAndEnd; } } -static void sub_8064DD0(void) +static void SwitchIn_HandleSoundAndEnd(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) { @@ -473,7 +473,7 @@ static void sub_8064DD0(void) } } -static void sub_8064E50(void) +static void SwitchIn_ShowHealthbox(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) @@ -481,20 +481,20 @@ static void sub_8064E50(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); CopyBattleSpriteInvisibility(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = sub_8064D60; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; } } -static void sub_8064F40(void) +static void SwitchIn_TryShinyAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim) @@ -502,12 +502,12 @@ static void sub_8064F40(void) TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); } - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerControllerFuncs[gActiveBattler] = sub_8064E50; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; } } @@ -1142,24 +1142,24 @@ static void LinkOpponentHandleLoadMonSprite(void) SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerControllerFuncs[gActiveBattler] = sub_8064B04; + gBattlerControllerFuncs[gActiveBattler] = TryShinyAnimAfterMonAnim; } static void LinkOpponentHandleSwitchInAnim(void) { gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1]; - sub_8066494(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = sub_8064F40; + StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; } -static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit) +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) { u16 species; ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714); + gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId); SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); @@ -1169,8 +1169,8 @@ static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit) GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); - gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; + gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; + gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; @@ -1181,7 +1181,7 @@ static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit) gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT); + gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT); } static void LinkOpponentHandleReturnMonToBall(void) @@ -1216,12 +1216,14 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_OPPONENT_MON); - gBattlerControllerFuncs[gActiveBattler] = sub_8064C58; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; } break; } } +#define sSpeedX data[0] + static void LinkOpponentHandleDrawTrainerPic(void) { s16 xPos; @@ -1302,10 +1304,10 @@ static void LinkOpponentHandleDrawTrainerPic(void) GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 2; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; } @@ -1325,15 +1327,17 @@ static void LinkOpponentHandleTrainerSlide(void) gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 96; gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.x += 32; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; // this line is redundant, because LinkOpponentBufferExecCompleted changes the battle battlerId function LinkOpponentBufferExecCompleted(); } +#undef sSpeedX + static void LinkOpponentHandleTrainerSlideBack(void) { SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); @@ -1342,7 +1346,7 @@ static void LinkOpponentHandleTrainerSlideBack(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = sub_8064470; + gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; } static void LinkOpponentHandleFaintAnimation(void) @@ -1360,7 +1364,7 @@ static void LinkOpponentHandleFaintAnimation(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; PlaySE12WithPanning(SE_FAINT, SOUND_PAN_TARGET); gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon; - gBattlerControllerFuncs[gActiveBattler] = sub_8064C14; + gBattlerControllerFuncs[gActiveBattler] = HideHealthboxAfterMonFaint; } } } @@ -1387,7 +1391,7 @@ static void LinkOpponentHandlePause(void) static void LinkOpponentHandleMoveAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); @@ -1430,7 +1434,7 @@ static void LinkOpponentDoMoveAnimation(void) case 1: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - sub_805EB9C(ST_OAM_AFFINE_OFF); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); DoMoveAnim(move); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; } @@ -1439,7 +1443,7 @@ static void LinkOpponentDoMoveAnimation(void) gAnimScriptCallback(); if (!gAnimScriptActive) { - sub_805EB9C(ST_OAM_AFFINE_NORMAL); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) { InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); @@ -1483,7 +1487,7 @@ static void LinkOpponentHandleChooseAction(void) LinkOpponentBufferExecCompleted(); } -static void LinkOpponentHandleUnknownYesNoBox(void) +static void LinkOpponentHandleYesNoBox(void) { LinkOpponentBufferExecCompleted(); } @@ -1539,7 +1543,7 @@ static void LinkOpponentHandleExpUpdate(void) static void LinkOpponentHandleStatusIconUpdate(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 battlerId; @@ -1552,7 +1556,7 @@ static void LinkOpponentHandleStatusIconUpdate(void) static void LinkOpponentHandleStatusAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { InitAndLaunchChosenStatusAnimation(gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8) | (gBattleResources->bufferA[gActiveBattler][4] << 16) | (gBattleResources->bufferA[gActiveBattler][5] << 24)); @@ -1703,19 +1707,19 @@ static void LinkOpponentHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_80676FC); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreeOpponentSprite); - taskId = CreateTask(sub_8067618, 5); + taskId = CreateTask(Task_StartSendOutAnim, 5); gTasks[taskId].data[0] = gActiveBattler; if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerControllerFuncs[gActiveBattler] = nullsub_28; + gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; + gBattlerControllerFuncs[gActiveBattler] = LinkOpponentDummy; } -static void sub_8067618(u8 taskId) +static void Task_StartSendOutAnim(u8 taskId) { u8 savedActiveBank = gActiveBattler; @@ -1723,23 +1727,23 @@ static void sub_8067618(u8 taskId) if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_8066494(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); } else { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_8066494(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler = BATTLE_PARTNER(gActiveBattler); gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_8066494(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler = BATTLE_PARTNER(gActiveBattler); } - gBattlerControllerFuncs[gActiveBattler] = sub_8064734; + gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; gActiveBattler = savedActiveBank; DestroyTask(taskId); } -static void sub_80676FC(struct Sprite *sprite) +static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite) { FreeTrainerFrontPicPalette(sprite->oam.affineParam); FreeSpriteOamMatrix(sprite); @@ -1770,20 +1774,20 @@ static void LinkOpponentHandleDrawPartyStatusSummary(void) } gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; if (gBattleResources->bufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - gBattlerControllerFuncs[gActiveBattler] = sub_806782C; + gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; } } -static void sub_806782C(void) +static void EndDrawPartyStatusSummary(void) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5++ > 0x5C) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; LinkOpponentBufferExecCompleted(); } } @@ -1812,7 +1816,7 @@ static void LinkOpponentHandleSpriteInvisibility(void) static void LinkOpponentHandleBattleAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); @@ -1828,7 +1832,7 @@ static void LinkOpponentHandleBattleAnimation(void) static void LinkOpponentHandleLinkStandbyMsg(void) { - sub_81851A8(&gBattleResources->bufferA[gActiveBattler][2]); + RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[gActiveBattler][2]); LinkOpponentBufferExecCompleted(); } @@ -1837,9 +1841,9 @@ static void LinkOpponentHandleResetActionMoveSelection(void) LinkOpponentBufferExecCompleted(); } -static void LinkOpponentHandleCmd55(void) +static void LinkOpponentHandleEndLinkBattle(void) { - sub_81851A8(&gBattleResources->bufferA[gActiveBattler][4]); + RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[gActiveBattler][4]); if (gBattleResources->bufferA[gActiveBattler][1] == B_OUTCOME_DREW) gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; @@ -1850,7 +1854,7 @@ static void LinkOpponentHandleCmd55(void) FadeOutMapMusic(5); BeginFastPaletteFade(3); LinkOpponentBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; } static void LinkOpponentHandleBattleDebug(void) diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 32a02ab28..d0be18d57 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -49,7 +49,7 @@ static void LinkPartnerHandleMoveAnimation(void); static void LinkPartnerHandlePrintString(void); static void LinkPartnerHandlePrintSelectionString(void); static void LinkPartnerHandleChooseAction(void); -static void LinkPartnerHandleUnknownYesNoBox(void); +static void LinkPartnerHandleYesNoBox(void); static void LinkPartnerHandleChooseMove(void); static void LinkPartnerHandleChooseItem(void); static void LinkPartnerHandleChoosePokemon(void); @@ -85,20 +85,20 @@ static void LinkPartnerHandleSpriteInvisibility(void); static void LinkPartnerHandleBattleAnimation(void); static void LinkPartnerHandleLinkStandbyMsg(void); static void LinkPartnerHandleResetActionMoveSelection(void); -static void LinkPartnerHandleCmd55(void); +static void LinkPartnerHandleEndLinkBattle(void); static void LinkPartnerHandleBattleDebug(void); static void LinkPartnerCmdEnd(void); static void LinkPartnerBufferRunCommand(void); static void LinkPartnerBufferExecCompleted(void); -static void sub_814B554(void); +static void SwitchIn_WaitAndEnd(void); static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst); static void SetLinkPartnerMonData(u8 monId); -static void sub_814CC98(u8 battlerId, bool8 dontClearSubstituteBit); +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); static void DoSwitchOutAnimation(void); static void LinkPartnerDoMoveAnimation(void); -static void sub_814DCCC(u8 taskId); -static void sub_814DE9C(void); +static void Task_StartSendOutAnim(u8 taskId); +static void EndDrawPartyStatusSummary(void); static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { @@ -121,7 +121,7 @@ static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_PRINTSTRING] = LinkPartnerHandlePrintString, [CONTROLLER_PRINTSTRINGPLAYERONLY] = LinkPartnerHandlePrintSelectionString, [CONTROLLER_CHOOSEACTION] = LinkPartnerHandleChooseAction, - [CONTROLLER_UNKNOWNYESNOBOX] = LinkPartnerHandleUnknownYesNoBox, + [CONTROLLER_YESNOBOX] = LinkPartnerHandleYesNoBox, [CONTROLLER_CHOOSEMOVE] = LinkPartnerHandleChooseMove, [CONTROLLER_OPENBAG] = LinkPartnerHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = LinkPartnerHandleChoosePokemon, @@ -157,7 +157,7 @@ static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_BATTLEANIMATION] = LinkPartnerHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = LinkPartnerHandleLinkStandbyMsg, [CONTROLLER_RESETACTIONMOVESELECTION] = LinkPartnerHandleResetActionMoveSelection, - [CONTROLLER_55] = LinkPartnerHandleCmd55, + [CONTROLLER_ENDLINKBATTLE] = LinkPartnerHandleEndLinkBattle, [CONTROLLER_DEBUGMENU] = LinkPartnerHandleBattleDebug, [CONTROLLER_TERMINATOR_NOP] = LinkPartnerCmdEnd }; @@ -188,84 +188,84 @@ static void CompleteOnBattlerSpriteCallbackDummy(void) LinkPartnerBufferExecCompleted(); } -static void sub_814AF54(void) +static void FreeTrainerSpriteAfterSlide(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { - nullsub_25(0); + BattleGfxSfxDummy3(MALE); FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); LinkPartnerBufferExecCompleted(); } } -static void sub_814AFBC(void) +static void Intro_DelayAndEnd(void) { - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 == 0xFF) + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; LinkPartnerBufferExecCompleted(); } } -static void sub_814B004(void) +static void Intro_WaitForHealthbox(void) { - bool32 r6 = FALSE; + bool32 finished = FALSE; if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - r6 = TRUE; + finished = TRUE; } else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { - r6 = TRUE; + finished = TRUE; } } if (IsCryPlayingOrClearCrySongs()) - r6 = FALSE; + finished = FALSE; - if (r6) + if (finished) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerControllerFuncs[gActiveBattler] = sub_814AFBC; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; + gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; } } -static void sub_814B0E8(void) +static void Intro_ShowHealthbox(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive - && gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 != 1) + && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay != 1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler ^ BIT_FLANK); + StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; - gBattlerControllerFuncs[gActiveBattler] = sub_814B004; + gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForHealthbox; } } -static void sub_814B290(void) +static void WaitForMonAnimAfterLoad(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded && gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0) LinkPartnerBufferExecCompleted(); @@ -288,13 +288,13 @@ static void CompleteOnHealthbarDone(void) } } -static void sub_814B340(void) +static void FreeMonSpriteAfterFaintAnim(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y > DISPLAY_HEIGHT) { u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - nullsub_24(species); + BattleGfxSfxDummy2(species); FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum); DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); @@ -302,7 +302,7 @@ static void sub_814B340(void) } } -static void sub_814B3DC(void) +static void FreeMonSpriteAfterSwitchOutAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { @@ -338,7 +338,7 @@ static void DoHitAnimBlinkSpriteEffect(void) } } -static void sub_814B4E0(void) +static void SwitchIn_ShowSubstitute(void) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { @@ -346,11 +346,11 @@ static void sub_814B4E0(void) if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = sub_814B554; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_WaitAndEnd; } } -static void sub_814B554(void) +static void SwitchIn_WaitAndEnd(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) @@ -359,28 +359,28 @@ static void sub_814B554(void) } } -static void sub_814B5A8(void) +static void SwitchIn_ShowHealthbox(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); - CreateTask(c3_0802FDF4, 10); + CreateTask(Task_PlayerController_RestoreBgmAfterCry, 10); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - gBattlerControllerFuncs[gActiveBattler] = sub_814B4E0; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; } } -static void sub_814B69C(void) +static void SwitchIn_TryShinyAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) @@ -388,11 +388,11 @@ static void sub_814B69C(void) TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); } - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - gBattlerControllerFuncs[gActiveBattler] = sub_814B5A8; + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; } } @@ -1026,7 +1026,7 @@ static void LinkPartnerHandleLoadMonSprite(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - gBattlerControllerFuncs[gActiveBattler] = sub_814B290; + gBattlerControllerFuncs[gActiveBattler] = WaitForMonAnimAfterLoad; } static void LinkPartnerHandleSwitchInAnim(void) @@ -1034,18 +1034,18 @@ static void LinkPartnerHandleSwitchInAnim(void) ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1]; BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - sub_814CC98(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = sub_814B69C; + StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; } -static void sub_814CC98(u8 battlerId, bool8 dontClearSubstituteBit) +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) { u16 species; ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714); + gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); gBattlerSpriteIds[battlerId] = CreateSprite( @@ -1054,8 +1054,8 @@ static void sub_814CC98(u8 battlerId, bool8 dontClearSubstituteBit) GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); - gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; + gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; + gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; @@ -1066,7 +1066,7 @@ static void sub_814CC98(u8 battlerId, bool8 dontClearSubstituteBit) gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); + gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); } static void LinkPartnerHandleReturnMonToBall(void) @@ -1100,12 +1100,14 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerControllerFuncs[gActiveBattler] = sub_814B3DC; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; } break; } } +#define sSpeedX data[0] + static void LinkPartnerHandleDrawTrainerPic(void) { s16 xPos; @@ -1143,13 +1145,15 @@ static void LinkPartnerHandleDrawTrainerPic(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80, GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = DISPLAY_WIDTH; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; } +#undef sSpeedX + static void LinkPartnerHandleTrainerSlide(void) { LinkPartnerBufferExecCompleted(); @@ -1163,9 +1167,12 @@ static void LinkPartnerHandleTrainerSlideBack(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = sub_814AF54; + gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; } +#define sSpeedX data[1] +#define sSpeedY data[2] + static void LinkPartnerHandleFaintAnimation(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0) @@ -1181,14 +1188,17 @@ static void LinkPartnerHandleFaintAnimation(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); PlaySE12WithPanning(SE_FAINT, SOUND_PAN_ATTACKER); - gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 5; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039C00; - gBattlerControllerFuncs[gActiveBattler] = sub_814B340; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedY = 5; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintSlideAnim; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterFaintAnim; } } } +#undef sSpeedX +#undef sSpeedY + static void LinkPartnerHandlePaletteFade(void) { LinkPartnerBufferExecCompleted(); @@ -1211,7 +1221,7 @@ static void LinkPartnerHandlePause(void) static void LinkPartnerHandleMoveAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); @@ -1254,7 +1264,7 @@ static void LinkPartnerDoMoveAnimation(void) case 1: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - sub_805EB9C(ST_OAM_AFFINE_OFF); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); DoMoveAnim(move); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; } @@ -1263,7 +1273,7 @@ static void LinkPartnerDoMoveAnimation(void) gAnimScriptCallback(); if (!gAnimScriptActive) { - sub_805EB9C(ST_OAM_AFFINE_NORMAL); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) { InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); @@ -1307,7 +1317,7 @@ static void LinkPartnerHandleChooseAction(void) LinkPartnerBufferExecCompleted(); } -static void LinkPartnerHandleUnknownYesNoBox(void) +static void LinkPartnerHandleYesNoBox(void) { LinkPartnerBufferExecCompleted(); } @@ -1363,7 +1373,7 @@ static void LinkPartnerHandleExpUpdate(void) static void LinkPartnerHandleStatusIconUpdate(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 battlerId; @@ -1376,7 +1386,7 @@ static void LinkPartnerHandleStatusIconUpdate(void) static void LinkPartnerHandleStatusAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { InitAndLaunchChosenStatusAnimation(gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8) | (gBattleResources->bufferA[gActiveBattler][4] << 16) | (gBattleResources->bufferA[gActiveBattler][5] << 24)); @@ -1530,7 +1540,7 @@ static void LinkPartnerHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreePlayerSpriteLoadMonSprite); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); paletteNum = AllocSpritePalette(0xD6F9); @@ -1554,17 +1564,17 @@ static void LinkPartnerHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; - taskId = CreateTask(sub_814DCCC, 5); + taskId = CreateTask(Task_StartSendOutAnim, 5); gTasks[taskId].data[0] = gActiveBattler; if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - gBattleSpritesDataPtr->animationData->field_9_x1 = 1; + gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; gBattlerControllerFuncs[gActiveBattler] = SpriteCB_Null2; } -static void sub_814DCCC(u8 taskId) +static void Task_StartSendOutAnim(u8 taskId) { if (gTasks[taskId].data[1] < 24) { @@ -1578,19 +1588,19 @@ static void sub_814DCCC(u8 taskId) if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_814CC98(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); } else { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_814CC98(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - sub_814CC98(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerControllerFuncs[gActiveBattler] = sub_814B0E8; + gBattlerControllerFuncs[gActiveBattler] = Intro_ShowHealthbox; gActiveBattler = savedActiveBank; DestroyTask(taskId); } @@ -1606,20 +1616,20 @@ static void LinkPartnerHandleDrawPartyStatusSummary(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1; gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; if (gBattleResources->bufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - gBattlerControllerFuncs[gActiveBattler] = sub_814DE9C; + gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; } } -static void sub_814DE9C(void) +static void EndDrawPartyStatusSummary(void) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5++ > 0x5C) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; LinkPartnerBufferExecCompleted(); } } @@ -1648,7 +1658,7 @@ static void LinkPartnerHandleSpriteInvisibility(void) static void LinkPartnerHandleBattleAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); @@ -1664,7 +1674,7 @@ static void LinkPartnerHandleBattleAnimation(void) static void LinkPartnerHandleLinkStandbyMsg(void) { - sub_81851A8(&gBattleResources->bufferA[gActiveBattler][2]); + RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[gActiveBattler][2]); LinkPartnerBufferExecCompleted(); } @@ -1673,15 +1683,15 @@ static void LinkPartnerHandleResetActionMoveSelection(void) LinkPartnerBufferExecCompleted(); } -static void LinkPartnerHandleCmd55(void) +static void LinkPartnerHandleEndLinkBattle(void) { - sub_81851A8(&gBattleResources->bufferA[gActiveBattler][4]); + RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[gActiveBattler][4]); gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; gSaveBlock2Ptr->frontier.disableRecordBattle = gBattleResources->bufferA[gActiveBattler][2]; FadeOutMapMusic(5); BeginFastPaletteFade(3); LinkPartnerBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; } static void LinkPartnerHandleBattleDebug(void) diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index e852a545e..78b670ff4 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -56,7 +56,7 @@ static void OpponentHandleMoveAnimation(void); static void OpponentHandlePrintString(void); static void OpponentHandlePrintSelectionString(void); static void OpponentHandleChooseAction(void); -static void OpponentHandleUnknownYesNoBox(void); +static void OpponentHandleYesNoBox(void); static void OpponentHandleChooseMove(void); static void OpponentHandleChooseItem(void); static void OpponentHandleChoosePokemon(void); @@ -92,21 +92,21 @@ static void OpponentHandleSpriteInvisibility(void); static void OpponentHandleBattleAnimation(void); static void OpponentHandleLinkStandbyMsg(void); static void OpponentHandleResetActionMoveSelection(void); -static void OpponentHandleCmd55(void); +static void OpponentHandleEndLinkBattle(void); static void OpponentHandleDebugMenu(void); static void OpponentCmdEnd(void); static void OpponentBufferRunCommand(void); static void OpponentBufferExecCompleted(void); -static void sub_805FC80(void); +static void SwitchIn_HandleSoundAndEnd(void); static u32 GetOpponentMonData(u8 monId, u8 *dst); static void SetOpponentMonData(u8 monId); -static void sub_80613DC(u8 battlerId, bool8 dontClearSubstituteBit); +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); static void DoSwitchOutAnimation(void); static void OpponentDoMoveAnimation(void); -static void sub_806280C(struct Sprite *sprite); -static void sub_8062828(u8 taskId); -static void sub_8062A2C(void); +static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite); +static void Task_StartSendOutAnim(u8 taskId); +static void EndDrawPartyStatusSummary(void); static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { @@ -129,7 +129,7 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_PRINTSTRING] = OpponentHandlePrintString, [CONTROLLER_PRINTSTRINGPLAYERONLY] = OpponentHandlePrintSelectionString, [CONTROLLER_CHOOSEACTION] = OpponentHandleChooseAction, - [CONTROLLER_UNKNOWNYESNOBOX] = OpponentHandleUnknownYesNoBox, + [CONTROLLER_YESNOBOX] = OpponentHandleYesNoBox, [CONTROLLER_CHOOSEMOVE] = OpponentHandleChooseMove, [CONTROLLER_OPENBAG] = OpponentHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = OpponentHandleChoosePokemon, @@ -165,7 +165,7 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_BATTLEANIMATION] = OpponentHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = OpponentHandleLinkStandbyMsg, [CONTROLLER_RESETACTIONMOVESELECTION] = OpponentHandleResetActionMoveSelection, - [CONTROLLER_55] = OpponentHandleCmd55, + [CONTROLLER_ENDLINKBATTLE] = OpponentHandleEndLinkBattle, [CONTROLLER_DEBUGMENU] = OpponentHandleDebugMenu, [CONTROLLER_TERMINATOR_NOP] = OpponentCmdEnd }; @@ -173,7 +173,7 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = // unknown unused data static const u8 sUnused[] = {0xB0, 0xB0, 0xC8, 0x98, 0x28, 0x28, 0x28, 0x20}; -static void nullsub_26(void) +static void OpponentDummy(void) { } @@ -205,7 +205,7 @@ static void CompleteOnBankSpriteCallbackDummy2(void) OpponentBufferExecCompleted(); } -static void sub_805F240(void) +static void FreeTrainerSpriteAfterSlide(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { @@ -216,40 +216,40 @@ static void sub_805F240(void) } } -static void sub_805F2A8(void) +static void Intro_DelayAndEnd(void) { - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 == 0xFF) + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; OpponentBufferExecCompleted(); } } -static void sub_805F2F0(void) +static void Intro_WaitForShinyAnimAndHealthbox(void) { - bool8 var = FALSE; - bool8 var2; + bool8 healthboxAnimDone = FALSE; + bool8 twoMons; if (!IsDoubleBattle() || ((IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI) && !BATTLE_TWO_VS_ONE_OPPONENT) || (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS))) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - var = TRUE; - var2 = FALSE; + healthboxAnimDone = TRUE; + twoMons = FALSE; } else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) - var = TRUE; - var2 = TRUE; + healthboxAnimDone = TRUE; + twoMons = TRUE; } - gUnknown_020244D8 = &gBattleSpritesDataPtr->healthBoxesData[gActiveBattler]; - gUnknown_020244DC = &gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK]; + gBattleControllerOpponentHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[gActiveBattler]; + gBattleControllerOpponentFlankHealthboxData = &gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK]; - if (var) + if (healthboxAnimDone) { - if (var2 == TRUE) + if (twoMons == TRUE) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) @@ -258,8 +258,8 @@ static void sub_805F2F0(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } else return; @@ -271,8 +271,8 @@ static void sub_805F2F0(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) { - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } else return; @@ -283,15 +283,15 @@ static void sub_805F2F0(void) else return; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerControllerFuncs[gActiveBattler] = sub_805F2A8; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; + gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; } } -static void sub_805F560(void) +static void Intro_TryShinyAnimShowHealthbox(void) { - bool32 sp = FALSE; - bool32 r10 = FALSE; + bool32 bgmRestored = FALSE; + bool32 battlerAnimsDone = FALSE; if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive @@ -308,27 +308,27 @@ static void sub_805F560(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (IsDoubleBattle() && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT)) { UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler ^ BIT_FLANK); + StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 1; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = TRUE; } - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x40 - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].field_1_x40 + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry + && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry && !IsCryPlayingOrClearCrySongs()) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) { @@ -338,48 +338,48 @@ static void sub_805F560(void) else m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 1; - sp = TRUE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; + bgmRestored = TRUE; } if (!IsDoubleBattle() || (IsDoubleBattle() && gBattleTypeFlags & BATTLE_TYPE_MULTI && !BATTLE_TWO_VS_ONE_OPPONENT)) { - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { - r10 = TRUE; + battlerAnimsDone = TRUE; } } else { - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy + && gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { - r10 = TRUE; + battlerAnimsDone = TRUE; } } - if (sp && r10) + if (bgmRestored && battlerAnimsDone) { if (IsDoubleBattle() && (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT)) { - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); SetBattlerShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES)); } - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattleSpritesDataPtr->animationData->field_9_x1 = 0; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 0; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 0; + gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; - gBattlerControllerFuncs[gActiveBattler] = sub_805F2F0; + gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; } } -static void sub_805F994(void) +static void TryShinyAnimAfterMonAnim(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim @@ -391,8 +391,8 @@ static void sub_805F994(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); OpponentBufferExecCompleted(); } } @@ -409,7 +409,7 @@ static void CompleteOnHealthbarDone(void) OpponentBufferExecCompleted(); } -static void sub_805FAC4(void) +static void HideHealthboxAfterMonFaint(void) { if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse) { @@ -418,7 +418,7 @@ static void sub_805FAC4(void) } } -static void sub_805FB08(void) +static void FreeMonSpriteAfterSwitchOutAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { @@ -455,21 +455,22 @@ static void DoHitAnimBlinkSpriteEffect(void) } } -static void sub_805FC10(void) +static void SwitchIn_ShowSubstitute(void) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = sub_805FC80; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_HandleSoundAndEnd; } } -static void sub_805FC80(void) +static void SwitchIn_HandleSoundAndEnd(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) { - if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy || gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy_2) + if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy + || gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy_2) { m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100); OpponentBufferExecCompleted(); @@ -477,36 +478,36 @@ static void sub_805FC80(void) } } -static void sub_805FD00(void) +static void SwitchIn_ShowHealthbox(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); CopyBattleSpriteInvisibility(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = sub_805FC10; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; } } -static void sub_805FDF0(void) +static void SwitchIn_TryShinyAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerControllerFuncs[gActiveBattler] = sub_805FD00; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; } } @@ -1151,25 +1152,25 @@ static void OpponentHandleLoadMonSprite(void) SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerControllerFuncs[gActiveBattler] = sub_805F994; + gBattlerControllerFuncs[gActiveBattler] = TryShinyAnimAfterMonAnim; } static void OpponentHandleSwitchInAnim(void) { *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = 6; gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1]; - sub_80613DC(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = sub_805FDF0; + StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; } -static void sub_80613DC(u8 battlerId, bool8 dontClearSubstituteBit) +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) { u16 species; ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714); + gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId); SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); @@ -1181,8 +1182,8 @@ static void sub_80613DC(u8 battlerId, bool8 dontClearSubstituteBit) gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; - gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; + gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; + gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].oam.paletteNum = battlerId; @@ -1191,7 +1192,7 @@ static void sub_80613DC(u8 battlerId, bool8 dontClearSubstituteBit) gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT); + gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT); } static void OpponentHandleReturnMonToBall(void) @@ -1226,12 +1227,14 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_OPPONENT_MON); - gBattlerControllerFuncs[gActiveBattler] = sub_805FB08; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; } break; } } +#define sSpeedX data[0] + static void OpponentHandleDrawTrainerPic(void) { u32 trainerPicId; @@ -1309,10 +1312,10 @@ static void OpponentHandleDrawTrainerPic(void) GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 2; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; } @@ -1379,14 +1382,16 @@ static void OpponentHandleTrainerSlide(void) gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 96; gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.x += 32; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; } +#undef sSpeedX + static void OpponentHandleTrainerSlideBack(void) { SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); @@ -1395,7 +1400,7 @@ static void OpponentHandleTrainerSlideBack(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = sub_805F240; + gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; } static void OpponentHandleFaintAnimation(void) @@ -1413,7 +1418,7 @@ static void OpponentHandleFaintAnimation(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; PlaySE12WithPanning(SE_FAINT, SOUND_PAN_TARGET); gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon; - gBattlerControllerFuncs[gActiveBattler] = sub_805FAC4; + gBattlerControllerFuncs[gActiveBattler] = HideHealthboxAfterMonFaint; } } } @@ -1440,7 +1445,7 @@ static void OpponentHandlePause(void) static void OpponentHandleMoveAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); @@ -1482,7 +1487,7 @@ static void OpponentDoMoveAnimation(void) case 1: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - sub_805EB9C(ST_OAM_AFFINE_OFF); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); DoMoveAnim(move); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; } @@ -1491,7 +1496,7 @@ static void OpponentDoMoveAnimation(void) gAnimScriptCallback(); if (!gAnimScriptActive) { - sub_805EB9C(ST_OAM_AFFINE_NORMAL); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) { InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); @@ -1536,7 +1541,7 @@ static void OpponentHandleChooseAction(void) OpponentBufferExecCompleted(); } -static void OpponentHandleUnknownYesNoBox(void) +static void OpponentHandleYesNoBox(void) { OpponentBufferExecCompleted(); } @@ -1699,7 +1704,7 @@ static void OpponentHandleExpUpdate(void) static void OpponentHandleStatusIconUpdate(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 battlerId; @@ -1712,7 +1717,7 @@ static void OpponentHandleStatusIconUpdate(void) static void OpponentHandleStatusAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { InitAndLaunchChosenStatusAnimation(gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8) | (gBattleResources->bufferA[gActiveBattler][4] << 16) | (gBattleResources->bufferA[gActiveBattler][5] << 24)); @@ -1863,26 +1868,26 @@ static void OpponentHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_806280C); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreeOpponentSprite); - taskId = CreateTask(sub_8062828, 5); + taskId = CreateTask(Task_StartSendOutAnim, 5); gTasks[taskId].data[0] = gActiveBattler; if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerControllerFuncs[gActiveBattler] = nullsub_26; + gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; + gBattlerControllerFuncs[gActiveBattler] = OpponentDummy; } -static void sub_806280C(struct Sprite *sprite) +static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite) { FreeTrainerFrontPicPalette(sprite->oam.affineParam); FreeSpriteOamMatrix(sprite); DestroySprite(sprite); } -static void sub_8062828(u8 taskId) +static void Task_StartSendOutAnim(u8 taskId) { u8 savedActiveBank = gActiveBattler; @@ -1890,23 +1895,23 @@ static void sub_8062828(u8 taskId) if ((!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) && !BATTLE_TWO_VS_ONE_OPPONENT) { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_80613DC(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); } else if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)) { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_80613DC(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); } else { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_80613DC(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_80613DC(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerControllerFuncs[gActiveBattler] = sub_805F560; + gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; gActiveBattler = savedActiveBank; DestroyTask(taskId); } @@ -1935,20 +1940,20 @@ static void OpponentHandleDrawPartyStatusSummary(void) } gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; if (gBattleResources->bufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - gBattlerControllerFuncs[gActiveBattler] = sub_8062A2C; + gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; } } -static void sub_8062A2C(void) +static void EndDrawPartyStatusSummary(void) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5++ > 0x5C) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; OpponentBufferExecCompleted(); } } @@ -1977,7 +1982,7 @@ static void OpponentHandleSpriteInvisibility(void) static void OpponentHandleBattleAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); @@ -1999,7 +2004,7 @@ static void OpponentHandleResetActionMoveSelection(void) OpponentBufferExecCompleted(); } -static void OpponentHandleCmd55(void) +static void OpponentHandleEndLinkBattle(void) { if (gBattleTypeFlags & BATTLE_TYPE_LINK && !(gBattleTypeFlags & BATTLE_TYPE_IS_MASTER)) { diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index f981eb823..1f823f1cb 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -58,7 +58,7 @@ static void PlayerHandleMoveAnimation(void); static void PlayerHandlePrintString(void); static void PlayerHandlePrintSelectionString(void); static void PlayerHandleChooseAction(void); -static void PlayerHandleUnknownYesNoBox(void); +static void PlayerHandleYesNoBox(void); static void PlayerHandleChooseMove(void); static void PlayerHandleChooseItem(void); static void PlayerHandleChoosePokemon(void); @@ -94,7 +94,7 @@ static void PlayerHandleSpriteInvisibility(void); static void PlayerHandleBattleAnimation(void); static void PlayerHandleLinkStandbyMsg(void); static void PlayerHandleResetActionMoveSelection(void); -static void PlayerHandleCmd55(void); +static void PlayerHandleEndLinkBattle(void); static void PlayerHandleBattleDebug(void); static void PlayerCmdEnd(void); @@ -108,22 +108,22 @@ static void MoveSelectionDisplayPpString(void); static void MoveSelectionDisplayMoveType(void); static void MoveSelectionDisplayMoveNames(void); static void HandleMoveSwitching(void); -static void sub_8058FC0(void); +static void SwitchIn_HandleSoundAndEnd(void); static void WaitForMonSelection(void); static void CompleteWhenChoseItem(void); static void Task_LaunchLvlUpAnim(u8 taskId); static void Task_PrepareToGiveExpWithExpBar(u8 taskId); static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId); -static void sub_8059400(u8 taskId); +static void Task_GiveExpWithExpBar(u8 taskId); static void Task_UpdateLvlInHealthbox(u8 taskId); static void PrintLinkStandbyMsg(void); static u32 CopyPlayerMonData(u8 monId, u8 *dst); static void SetPlayerMonData(u8 monId); -static void sub_805B258(u8 battlerId, bool8 dontClearSubstituteBit); +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); static void DoSwitchOutAnimation(void); static void PlayerDoMoveAnimation(void); -static void task05_08033660(u8 taskId); -static void sub_805CE38(void); +static void Task_StartSendOutAnim(u8 taskId); +static void EndDrawPartyStatusSummary(void); static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { @@ -146,7 +146,7 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_PRINTSTRING] = PlayerHandlePrintString, [CONTROLLER_PRINTSTRINGPLAYERONLY] = PlayerHandlePrintSelectionString, [CONTROLLER_CHOOSEACTION] = PlayerHandleChooseAction, - [CONTROLLER_UNKNOWNYESNOBOX] = PlayerHandleUnknownYesNoBox, + [CONTROLLER_YESNOBOX] = PlayerHandleYesNoBox, [CONTROLLER_CHOOSEMOVE] = PlayerHandleChooseMove, [CONTROLLER_OPENBAG] = PlayerHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = PlayerHandleChoosePokemon, @@ -182,7 +182,7 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_BATTLEANIMATION] = PlayerHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = PlayerHandleLinkStandbyMsg, [CONTROLLER_RESETACTIONMOVESELECTION] = PlayerHandleResetActionMoveSelection, - [CONTROLLER_55] = PlayerHandleCmd55, + [CONTROLLER_ENDLINKBATTLE] = PlayerHandleEndLinkBattle, [CONTROLLER_DEBUGMENU] = PlayerHandleBattleDebug, [CONTROLLER_TERMINATOR_NOP] = PlayerCmdEnd }; @@ -190,7 +190,7 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = // unknown unused data static const u8 sUnused[] = {0x48, 0x48, 0x20, 0x5a, 0x50, 0x50, 0x50, 0x58}; -void nullsub_21(void) +void BattleControllerDummy(void) { } @@ -338,7 +338,7 @@ static void HandleInputChooseAction(void) } } -static void sub_80577F0(void) // unused +static void UnusedEndBounceEffect(void) { EndBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX); EndBounceEffect(gActiveBattler, BOUNCE_MON); @@ -348,7 +348,7 @@ static void sub_80577F0(void) // unused static void HandleInputChooseTarget(void) { s32 i; - static const u8 identities[4] = {B_POSITION_PLAYER_LEFT, B_POSITION_PLAYER_RIGHT, B_POSITION_OPPONENT_RIGHT, B_POSITION_OPPONENT_LEFT}; + static const u8 identities[MAX_BATTLERS_COUNT] = {B_POSITION_PLAYER_LEFT, B_POSITION_PLAYER_RIGHT, B_POSITION_OPPONENT_RIGHT, B_POSITION_OPPONENT_LEFT}; u16 move = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler]); DoBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX, 15, 1); @@ -407,7 +407,7 @@ static void HandleInputChooseTarget(void) do { if (--i < 0) - i = 3; + i = MAX_BATTLERS_COUNT - 1; gMultiUsePlayerCursor = GetBattlerAtPosition(identities[i]); } while (gMultiUsePlayerCursor == gBattlersCount); @@ -711,7 +711,7 @@ static void HandleInputChooseMove(void) } } -u32 sub_8057FBC(void) // unused +static u32 HandleMoveInputUnused(void) { u32 var = 0; @@ -945,7 +945,7 @@ static void HandleMoveSwitching(void) } } -static void sub_80586F8(void) +static void SetLinkBattleEndCallbacks(void) { if (gWirelessCommType == 0) { @@ -954,7 +954,7 @@ static void sub_80586F8(void) m4aSongNumStop(SE_LOW_HEALTH); gMain.inBattle = 0; gMain.callback1 = gPreBattleCallback1; - SetMainCallback2(sub_8038D64); + SetMainCallback2(CB2_InitEndLinkBattle); if (gBattleOutcome == B_OUTCOME_WON) TryPutLinkBattleTvShowOnAir(); FreeAllWindowBuffers(); @@ -967,7 +967,7 @@ static void sub_80586F8(void) m4aSongNumStop(SE_LOW_HEALTH); gMain.inBattle = 0; gMain.callback1 = gPreBattleCallback1; - SetMainCallback2(sub_8038D64); + SetMainCallback2(CB2_InitEndLinkBattle); if (gBattleOutcome == B_OUTCOME_WON) TryPutLinkBattleTvShowOnAir(); FreeAllWindowBuffers(); @@ -975,7 +975,8 @@ static void sub_80586F8(void) } } -void sub_80587B0(void) +// Despite handling link battles separately, this is only ever used by link battles +void SetBattleEndCallbacks(void) { if (!gPaletteFade.active) { @@ -988,7 +989,7 @@ void sub_80587B0(void) else SetLinkStandbyCallback(); - gBattlerControllerFuncs[gActiveBattler] = sub_80586F8; + gBattlerControllerFuncs[gActiveBattler] = SetLinkBattleEndCallbacks; } } else @@ -1013,161 +1014,174 @@ static void CompleteOnBankSpriteCallbackDummy2(void) PlayerBufferExecCompleted(); } -static void sub_80588B4(void) +static void FreeTrainerSpriteAfterSlide(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { - nullsub_25(gSaveBlock2Ptr->playerGender); + BattleGfxSfxDummy3(gSaveBlock2Ptr->playerGender); FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); PlayerBufferExecCompleted(); } } -static void sub_8058924(void) +static void Intro_DelayAndEnd(void) { - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 == 0xFF) + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; PlayerBufferExecCompleted(); } } -static void sub_805896C(void) +static void Intro_WaitForShinyAnimAndHealthbox(void) { - bool8 var = FALSE; + bool8 healthboxAnimDone = FALSE; + // Check if healthbox has finished sliding in if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - var = TRUE; + healthboxAnimDone = TRUE; } else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) - var = TRUE; + healthboxAnimDone = TRUE; } - if (var && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim + // If healthbox and shiny anim are done + if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) { + // Reset shiny anim (even if it didn't occur) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); if (IsDoubleBattle()) HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerControllerFuncs[gActiveBattler] = sub_8058924; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; + gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; } } -static void sub_8058B40(void) +static void Intro_TryShinyAnimShowHealthbox(void) { - bool32 r9 = FALSE; - bool32 r8 = FALSE; + bool32 bgmRestored = FALSE; + bool32 battlerAnimsDone = FALSE; - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim + // Start shiny animation if applicable for 1st pokemon + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); + // Start shiny animation if applicable for 2nd pokemon if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) TryShinyAnimation(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]]); - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) + // Show healthbox after ball anim + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler ^ BIT_FLANK); + StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 1; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = TRUE; } - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x40 - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].field_1_x40 + // Restore bgm after cry has played and healthbox anim is started + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry + && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry && !IsCryPlayingOrClearCrySongs()) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) m4aMPlayContinue(&gMPlayInfo_BGM); else m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 1; - r9 = TRUE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; + bgmRestored = TRUE; } + // Wait for battler anims if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { - r8 = TRUE; + battlerAnimsDone = TRUE; } } else { - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy + && gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { - r8 = TRUE; + battlerAnimsDone = TRUE; } } - if (r9 && r8) + // Clean up + if (bgmRestored && battlerAnimsDone) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); - gBattleSpritesDataPtr->animationData->field_9_x1 = 0; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 0; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 0; + gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; - gBattlerControllerFuncs[gActiveBattler] = sub_805896C; + gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; } } -static void sub_8058EDC(void) +static void SwitchIn_CleanShinyAnimShowSubstitute(void) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { CopyBattleSpriteInvisibility(gActiveBattler); + + // Reset shiny anim (even if it didn't occur) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); + // Check if Substitute should be shown if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = sub_8058FC0; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_HandleSoundAndEnd; } } -static void sub_8058FC0(void) +static void SwitchIn_HandleSoundAndEnd(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) @@ -1178,24 +1192,26 @@ static void sub_8058FC0(void) } } -static void sub_805902C(void) +static void SwitchIn_TryShinyAnimShowHealthbox(void) { + // Start shiny animation if applicable if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + // Wait for ball anim, then show healthbox + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - gBattlerControllerFuncs[gActiveBattler] = sub_8058EDC; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_CleanShinyAnimShowSubstitute; } } -void c3_0802FDF4(u8 taskId) +void Task_PlayerController_RestoreBgmAfterCry(u8 taskId) { if (!IsCryPlayingOrClearCrySongs()) { @@ -1294,10 +1310,10 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId) expToNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLvlExp; SetBattleBarStruct(battlerId, gHealthboxSpriteIds[battlerId], expToNextLvl, exp, -gainedExp); PlaySE(SE_EXP); - gTasks[taskId].func = sub_8059400; + gTasks[taskId].func = Task_GiveExpWithExpBar; } -static void sub_8059400(u8 taskId) +static void Task_GiveExpWithExpBar(u8 taskId) { if (gTasks[taskId].tExpTask_frames < 13) { @@ -1392,13 +1408,13 @@ static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId) DestroyTask(taskId); } -static void sub_80596A8(void) +static void FreeMonSpriteAfterFaintAnim(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y > DISPLAY_HEIGHT) { u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - nullsub_24(species); + BattleGfxSfxDummy2(species); FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum); DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); @@ -1406,7 +1422,7 @@ static void sub_80596A8(void) } } -static void sub_8059744(void) +static void FreeMonSpriteAfterSwitchOutAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { @@ -1430,8 +1446,8 @@ static void OpenPartyMenuToChooseMon(void) u8 caseId; gBattlerControllerFuncs[gActiveBattler] = WaitForMonSelection; - caseId = gTasks[gUnknown_03005D7C[gActiveBattler]].data[0]; - DestroyTask(gUnknown_03005D7C[gActiveBattler]); + caseId = gTasks[gBattleControllerData[gActiveBattler]].data[0]; + DestroyTask(gBattleControllerData[gActiveBattler]); FreeAllWindowBuffers(); OpenPartyMenuInBattle(caseId); } @@ -1458,7 +1474,7 @@ static void OpenBagAndChooseItem(void) if (!gPaletteFade.active) { gBattlerControllerFuncs[gActiveBattler] = CompleteWhenChoseItem; - nullsub_35(); + ReshowBattleScreenDummy(); FreeAllWindowBuffers(); CB2_BagMenuFromBattle(); } @@ -1498,7 +1514,7 @@ static void DoHitAnimBlinkSpriteEffect(void) } } -static void PlayerHandleUnknownYesNoInput(void) +static void PlayerHandleYesNoInput(void) { if (JOY_NEW(DPAD_UP) && gMultiUsePlayerCursor != 0) { @@ -2268,18 +2284,18 @@ static void PlayerHandleSwitchInAnim(void) BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); gActionSelectionCursor[gActiveBattler] = 0; gMoveSelectionCursor[gActiveBattler] = 0; - sub_805B258(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = sub_805902C; + StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnimShowHealthbox; } -static void sub_805B258(u8 battlerId, bool8 dontClearSubstituteBit) +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) { u16 species; ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714); + gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); gBattlerSpriteIds[battlerId] = CreateSprite( @@ -2288,8 +2304,8 @@ static void sub_805B258(u8 battlerId, bool8 dontClearSubstituteBit) GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); - gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; + gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; + gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; @@ -2300,7 +2316,7 @@ static void sub_805B258(u8 battlerId, bool8 dontClearSubstituteBit) gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); + gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); } static void PlayerHandleReturnMonToBall(void) @@ -2334,12 +2350,14 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerControllerFuncs[gActiveBattler] = sub_8059744; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; } break; } } +#define sSpeedX data[0] + // In emerald it's possible to have a tag battle in the battle frontier facilities with AI // which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) // that use an animated back pic. @@ -2403,10 +2421,10 @@ static void PlayerHandleDrawTrainerPic(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y = 48; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineMode = ST_OAM_AFFINE_OFF; gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1; } @@ -2418,9 +2436,9 @@ static void PlayerHandleDrawTrainerPic(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = DISPLAY_WIDTH; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; } gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; @@ -2458,12 +2476,14 @@ static void PlayerHandleTrainerSlide(void) gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -96; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; } +#undef sSpeedX + static void PlayerHandleTrainerSlideBack(void) { SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); @@ -2473,9 +2493,12 @@ static void PlayerHandleTrainerSlideBack(void) gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); - gBattlerControllerFuncs[gActiveBattler] = sub_80588B4; + gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; } +#define sSpeedX data[1] +#define sSpeedY data[2] + static void PlayerHandleFaintAnimation(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0) @@ -2491,17 +2514,20 @@ static void PlayerHandleFaintAnimation(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); PlaySE12WithPanning(SE_FAINT, SOUND_PAN_ATTACKER); - gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 5; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039C00; - gBattlerControllerFuncs[gActiveBattler] = sub_80596A8; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedY = 5; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintSlideAnim; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterFaintAnim; } } } +#undef sSpeedX +#undef sSpeedY + static void PlayerHandlePaletteFade(void) { - BeginNormalPaletteFade(0xFFFFFFFF, 2, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 2, 0, 16, RGB_BLACK); PlayerBufferExecCompleted(); } @@ -2533,18 +2559,17 @@ static void PlayerHandleBallThrowAnim(void) static void PlayerHandlePause(void) { - u8 var = gBattleResources->bufferA[gActiveBattler][1]; + u8 timer = gBattleResources->bufferA[gActiveBattler][1]; - // WTF is this?? - while (var != 0) - var--; + while (timer != 0) + timer--; PlayerBufferExecCompleted(); } static void PlayerHandleMoveAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); @@ -2587,7 +2612,7 @@ static void PlayerDoMoveAnimation(void) case 1: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - sub_805EB9C(ST_OAM_AFFINE_OFF); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); DoMoveAnim(move); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; } @@ -2596,7 +2621,7 @@ static void PlayerDoMoveAnimation(void) gAnimScriptCallback(); if (!gAnimScriptActive) { - sub_805EB9C(ST_OAM_AFFINE_NORMAL); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) { InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); @@ -2665,7 +2690,7 @@ static void PlayerHandleChooseAction(void) BattlePutTextOnWindow(gDisplayedStringBattle, 1); } -static void PlayerHandleUnknownYesNoBox(void) +static void PlayerHandleYesNoBox(void) { if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) { @@ -2673,7 +2698,7 @@ static void PlayerHandleUnknownYesNoBox(void) BattlePutTextOnWindow(gText_BattleYesNoChoice, 12); gMultiUsePlayerCursor = 1; BattleCreateYesNoCursorAt(1); - gBattlerControllerFuncs[gActiveBattler] = PlayerHandleUnknownYesNoInput; + gBattlerControllerFuncs[gActiveBattler] = PlayerHandleYesNoInput; } else { @@ -2736,7 +2761,7 @@ static void PlayerHandleChooseItem(void) { s32 i; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gBattlerControllerFuncs[gActiveBattler] = OpenBagAndChooseItem; gBattlerInMenuId = gActiveBattler; @@ -2758,10 +2783,10 @@ static void PlayerHandleChoosePokemon(void) } else { - gUnknown_03005D7C[gActiveBattler] = CreateTask(TaskDummy, 0xFF); - gTasks[gUnknown_03005D7C[gActiveBattler]].data[0] = gBattleResources->bufferA[gActiveBattler][1] & 0xF; + gBattleControllerData[gActiveBattler] = CreateTask(TaskDummy, 0xFF); + gTasks[gBattleControllerData[gActiveBattler]].data[0] = gBattleResources->bufferA[gActiveBattler][1] & 0xF; *(&gBattleStruct->battlerPreventingSwitchout) = gBattleResources->bufferA[gActiveBattler][1] >> 4; - *(&gBattleStruct->field_8B) = gBattleResources->bufferA[gActiveBattler][2]; + *(&gBattleStruct->prevSelectedPartySlot) = gBattleResources->bufferA[gActiveBattler][2]; *(&gBattleStruct->abilityPreventingSwitchout) = (gBattleResources->bufferA[gActiveBattler][3] & 0xFF) | (gBattleResources->bufferA[gActiveBattler][7] << 8); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); gBattlerControllerFuncs[gActiveBattler] = OpenPartyMenuToChooseMon; @@ -2772,7 +2797,7 @@ static void PlayerHandleChoosePokemon(void) static void PlayerHandleCmd23(void) { BattleStopLowHpSound(); - BeginNormalPaletteFade(0xFFFFFFFF, 2, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 2, 0, 16, RGB_BLACK); PlayerBufferExecCompleted(); } @@ -2825,7 +2850,7 @@ static void PlayerHandleExpUpdate(void) gTasks[taskId].tExpTask_monId = monId; gTasks[taskId].tExpTask_gainedExp = expPointsToGive; gTasks[taskId].tExpTask_battler = gActiveBattler; - gBattlerControllerFuncs[gActiveBattler] = nullsub_21; + gBattlerControllerFuncs[gActiveBattler] = BattleControllerDummy; } } @@ -2836,7 +2861,7 @@ static void PlayerHandleExpUpdate(void) static void PlayerHandleStatusIconUpdate(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 battlerId; @@ -2849,7 +2874,7 @@ static void PlayerHandleStatusIconUpdate(void) static void PlayerHandleStatusAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { InitAndLaunchChosenStatusAnimation(gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8) | (gBattleResources->bufferA[gActiveBattler][4] << 16) | (gBattleResources->bufferA[gActiveBattler][5] << 24)); @@ -3019,6 +3044,12 @@ static void PlayerHandleIntroSlide(void) PlayerBufferExecCompleted(); } +// Task data for Task_StartSendOutAnim +#define tBattlerId data[0] +#define tStartTimer data[1] + +#define sBattlerId data[5] + static void PlayerHandleIntroTrainerBallThrow(void) { u8 paletteNum; @@ -3030,68 +3061,77 @@ static void PlayerHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40; gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; + gSprites[gBattlerSpriteIds[gActiveBattler]].sBattlerId = gActiveBattler; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreePlayerSpriteLoadMonSprite); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); paletteNum = AllocSpritePalette(0xD6F8); LoadCompressedPalette(gTrainerBackPicPaletteTable[gSaveBlock2Ptr->playerGender].data, 0x100 + paletteNum * 16, 32); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; - taskId = CreateTask(task05_08033660, 5); - gTasks[taskId].data[0] = gActiveBattler; + taskId = CreateTask(Task_StartSendOutAnim, 5); + gTasks[taskId].tBattlerId = gActiveBattler; if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerControllerFuncs[gActiveBattler] = nullsub_21; + gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; + gBattlerControllerFuncs[gActiveBattler] = BattleControllerDummy; } -void sub_805CC00(struct Sprite *sprite) +void SpriteCB_FreePlayerSpriteLoadMonSprite(struct Sprite *sprite) { - u8 battlerId = sprite->data[5]; + u8 battlerId = sprite->sBattlerId; + // Free player trainer sprite FreeSpriteOamMatrix(sprite); FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(sprite->oam.paletteNum)); DestroySprite(sprite); + + // Load mon sprite BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battlerId]], battlerId); StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], 0); } -static void task05_08033660(u8 taskId) +#undef sBattlerId + +// Send out at start of battle +static void Task_StartSendOutAnim(u8 taskId) { - if (gTasks[taskId].data[1] < 31) + if (gTasks[taskId].tStartTimer < 31) { - gTasks[taskId].data[1]++; + gTasks[taskId].tStartTimer++; } else { u8 savedActiveBattler = gActiveBattler; - gActiveBattler = gTasks[taskId].data[0]; + gActiveBattler = gTasks[taskId].tBattlerId; if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_805B258(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); } else { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_805B258(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - sub_805B258(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerControllerFuncs[gActiveBattler] = sub_8058B40; + gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; gActiveBattler = savedActiveBattler; DestroyTask(taskId); } } +#undef tBattlerId +#undef tStartTimer + static void PlayerHandleDrawPartyStatusSummary(void) { if (gBattleResources->bufferA[gActiveBattler][1] != 0 && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) @@ -3102,20 +3142,21 @@ static void PlayerHandleDrawPartyStatusSummary(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1; gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; + // If intro, skip the delay after drawing if (gBattleResources->bufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - gBattlerControllerFuncs[gActiveBattler] = sub_805CE38; + gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; } } -static void sub_805CE38(void) +static void EndDrawPartyStatusSummary(void) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5++ > 0x5C) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; PlayerBufferExecCompleted(); } } @@ -3146,7 +3187,7 @@ static void PlayerHandleSpriteInvisibility(void) static void PlayerHandleBattleAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); @@ -3162,7 +3203,7 @@ static void PlayerHandleBattleAnimation(void) static void PlayerHandleLinkStandbyMsg(void) { - sub_81851A8(&gBattleResources->bufferA[gActiveBattler][2]); + RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[gActiveBattler][2]); switch (gBattleResources->bufferA[gActiveBattler][1]) { case 0: @@ -3197,15 +3238,15 @@ static void PlayerHandleResetActionMoveSelection(void) PlayerBufferExecCompleted(); } -static void PlayerHandleCmd55(void) +static void PlayerHandleEndLinkBattle(void) { - sub_81851A8(&gBattleResources->bufferA[gActiveBattler][4]); + RecordedBattle_RecordAllBattlerData(&gBattleResources->bufferA[gActiveBattler][4]); gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; gSaveBlock2Ptr->frontier.disableRecordBattle = gBattleResources->bufferA[gActiveBattler][2]; FadeOutMapMusic(5); BeginFastPaletteFade(3); PlayerBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; } static void WaitForDebug(void) diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index ac14a13b8..ecbda4c9c 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -47,7 +47,7 @@ static void PlayerPartnerHandleMoveAnimation(void); static void PlayerPartnerHandlePrintString(void); static void PlayerPartnerHandlePrintSelectionString(void); static void PlayerPartnerHandleChooseAction(void); -static void PlayerPartnerHandleUnknownYesNoBox(void); +static void PlayerPartnerHandleYesNoBox(void); static void PlayerPartnerHandleChooseMove(void); static void PlayerPartnerHandleChooseItem(void); static void PlayerPartnerHandleChoosePokemon(void); @@ -83,26 +83,25 @@ static void PlayerPartnerHandleSpriteInvisibility(void); static void PlayerPartnerHandleBattleAnimation(void); static void PlayerPartnerHandleLinkStandbyMsg(void); static void PlayerPartnerHandleResetActionMoveSelection(void); -static void PlayerPartnerHandleCmd55(void); +static void PlayerPartnerHandleEndLinkBattle(void); static void PlayerPartnerHandleBattleDebug(void); static void PlayerPartnerCmdEnd(void); static void PlayerPartnerBufferRunCommand(void); static void PlayerPartnerBufferExecCompleted(void); -static void sub_81BB628(u8 taskId); +static void Task_LaunchLvlUpAnim(u8 taskId); static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId); static void Task_PrepareToGiveExpWithExpBar(u8 taskId); -static void sub_81BB4E4(u8 taskId); -static void sub_81BB628(u8 taskId); -static void sub_81BB688(u8 taskId); -static void sub_81BB9A0(void); +static void Task_GiveExpWithExpBar(u8 taskId); +static void Task_UpdateLvlInHealthbox(u8 taskId); +static void SwitchIn_WaitAndEnd(void); static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst); static void SetPlayerPartnerMonData(u8 monId); -static void sub_81BD0E4(u8 battlerId, bool8 dontClearSubstituteBit); +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); static void DoSwitchOutAnimation(void); static void PlayerPartnerDoMoveAnimation(void); -static void sub_81BE2C8(u8 taskId); -static void sub_81BE498(void); +static void Task_StartSendOutAnim(u8 taskId); +static void EndDrawPartyStatusSummary(void); static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { @@ -125,7 +124,7 @@ static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_PRINTSTRING] = PlayerPartnerHandlePrintString, [CONTROLLER_PRINTSTRINGPLAYERONLY] = PlayerPartnerHandlePrintSelectionString, [CONTROLLER_CHOOSEACTION] = PlayerPartnerHandleChooseAction, - [CONTROLLER_UNKNOWNYESNOBOX] = PlayerPartnerHandleUnknownYesNoBox, + [CONTROLLER_YESNOBOX] = PlayerPartnerHandleYesNoBox, [CONTROLLER_CHOOSEMOVE] = PlayerPartnerHandleChooseMove, [CONTROLLER_OPENBAG] = PlayerPartnerHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = PlayerPartnerHandleChoosePokemon, @@ -161,7 +160,7 @@ static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_BATTLEANIMATION] = PlayerPartnerHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = PlayerPartnerHandleLinkStandbyMsg, [CONTROLLER_RESETACTIONMOVESELECTION] = PlayerPartnerHandleResetActionMoveSelection, - [CONTROLLER_55] = PlayerPartnerHandleCmd55, + [CONTROLLER_ENDLINKBATTLE] = PlayerPartnerHandleEndLinkBattle, [CONTROLLER_DEBUGMENU] = PlayerPartnerHandleBattleDebug, [CONTROLLER_TERMINATOR_NOP] = PlayerPartnerCmdEnd }; @@ -175,7 +174,7 @@ static const u8 sUnused[] = 0x3b, 0x43, 0xda, 0x36, 0x79, 0x2a, 0x0e, 0x53, }; -static void nullsub_77(void) +static void PlayerPartnerDummy(void) { } @@ -201,84 +200,84 @@ static void CompleteOnBattlerSpriteCallbackDummy(void) PlayerPartnerBufferExecCompleted(); } -static void sub_81BAE98(void) +static void FreeTrainerSpriteAfterSlide(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { - nullsub_25(0); + BattleGfxSfxDummy3(MALE); FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); PlayerPartnerBufferExecCompleted(); } } -static void sub_81BAF00(void) +static void Intro_DelayAndEnd(void) { - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 == 0xFF) + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; PlayerPartnerBufferExecCompleted(); } } -static void sub_81BAF48(void) +static void Intro_WaitForHealthbox(void) { - bool32 r6 = FALSE; + bool32 finished = FALSE; if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - r6 = TRUE; + finished = TRUE; } else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { - r6 = TRUE; + finished = TRUE; } } if (IsCryPlayingOrClearCrySongs()) - r6 = FALSE; + finished = FALSE; - if (r6) + if (finished) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerControllerFuncs[gActiveBattler] = sub_81BAF00; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; + gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; } } -static void sub_81BB02C(void) +static void Intro_ShowHealthbox(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive - && gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 != 1) + && ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay != 1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler ^ BIT_FLANK); + StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - gBattleSpritesDataPtr->animationData->field_9_x1 = 0; + gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; - gBattlerControllerFuncs[gActiveBattler] = sub_81BAF48; + gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForHealthbox; } } -static void sub_81BB1D4(void) +static void WaitForMonAnimAfterLoad(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded && gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0) PlayerPartnerBufferExecCompleted(); @@ -341,7 +340,7 @@ static void Task_GiveExpToMon(u8 taskId) if (IsDoubleBattle() == TRUE && ((u16)(monId) == gBattlerPartyIndexes[battlerId] || (u16)(monId) == gBattlerPartyIndexes[battlerId ^ BIT_FLANK])) - gTasks[taskId].func = sub_81BB628; + gTasks[taskId].func = Task_LaunchLvlUpAnim; else gTasks[taskId].func = DestroyExpTaskAndCompleteOnInactiveTextPrinter; } @@ -375,10 +374,10 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId) expToNextLvl = gExperienceTables[gBaseStats[species].growthRate][level + 1] - currLvlExp; SetBattleBarStruct(battlerId, gHealthboxSpriteIds[battlerId], expToNextLvl, exp, -gainedExp); PlaySE(SE_EXP); - gTasks[taskId].func = sub_81BB4E4; + gTasks[taskId].func = Task_GiveExpWithExpBar; } -static void sub_81BB4E4(u8 taskId) +static void Task_GiveExpWithExpBar(u8 taskId) { if (gTasks[taskId].tExpTask_frames < 13) { @@ -417,7 +416,7 @@ static void sub_81BB4E4(u8 taskId) gActiveBattler = battlerId; BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELED_UP, gainedExp); gActiveBattler = savedActiveBank; - gTasks[taskId].func = sub_81BB628; + gTasks[taskId].func = Task_LaunchLvlUpAnim; } else { @@ -430,7 +429,7 @@ static void sub_81BB4E4(u8 taskId) } } -static void sub_81BB628(u8 taskId) +static void Task_LaunchLvlUpAnim(u8 taskId) { u8 battlerId = gTasks[taskId].tExpTask_bank; u8 monIndex = gTasks[taskId].tExpTask_monId; @@ -439,10 +438,10 @@ static void sub_81BB628(u8 taskId) battlerId ^= BIT_FLANK; InitAndLaunchSpecialAnimation(battlerId, battlerId, battlerId, B_ANIM_LVL_UP); - gTasks[taskId].func = sub_81BB688; + gTasks[taskId].func = Task_UpdateLvlInHealthbox; } -static void sub_81BB688(u8 taskId) +static void Task_UpdateLvlInHealthbox(u8 taskId) { u8 battlerId = gTasks[taskId].tExpTask_bank; @@ -473,13 +472,13 @@ static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId) DestroyTask(taskId); } -static void sub_81BB78C(void) +static void FreeMonSpriteAfterFaintAnim(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y > DISPLAY_HEIGHT) { u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - nullsub_24(species); + BattleGfxSfxDummy2(species); FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum); DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); @@ -487,7 +486,7 @@ static void sub_81BB78C(void) } } -static void sub_81BB828(void) +static void FreeMonSpriteAfterSwitchOutAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { @@ -523,7 +522,7 @@ static void DoHitAnimBlinkSpriteEffect(void) } } -static void sub_81BB92C(void) +static void SwitchIn_ShowSubstitute(void) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { @@ -531,11 +530,11 @@ static void sub_81BB92C(void) if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = sub_81BB9A0; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_WaitAndEnd; } } -static void sub_81BB9A0(void) +static void SwitchIn_WaitAndEnd(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) @@ -544,28 +543,28 @@ static void sub_81BB9A0(void) } } -static void sub_81BB9F4(void) +static void SwitchIn_ShowHealthbox(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); - CreateTask(c3_0802FDF4, 10); + CreateTask(Task_PlayerController_RestoreBgmAfterCry, 10); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - gBattlerControllerFuncs[gActiveBattler] = sub_81BB92C; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; } } -static void sub_81BBAE8(void) +static void SwitchIn_TryShinyAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) @@ -573,11 +572,11 @@ static void sub_81BBAE8(void) TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); } - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - gBattlerControllerFuncs[gActiveBattler] = sub_81BB9F4; + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; } } @@ -1211,7 +1210,7 @@ static void PlayerPartnerHandleLoadMonSprite(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - gBattlerControllerFuncs[gActiveBattler] = sub_81BB1D4; + gBattlerControllerFuncs[gActiveBattler] = WaitForMonAnimAfterLoad; } static void PlayerPartnerHandleSwitchInAnim(void) @@ -1219,18 +1218,18 @@ static void PlayerPartnerHandleSwitchInAnim(void) ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1]; BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - sub_81BD0E4(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = sub_81BBAE8; + StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; } -static void sub_81BD0E4(u8 battlerId, bool8 dontClearSubstituteBit) +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) { u16 species; ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714); + gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); gBattlerSpriteIds[battlerId] = CreateSprite( @@ -1239,8 +1238,8 @@ static void sub_81BD0E4(u8 battlerId, bool8 dontClearSubstituteBit) GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); - gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; + gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; + gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; @@ -1251,7 +1250,7 @@ static void sub_81BD0E4(u8 battlerId, bool8 dontClearSubstituteBit) gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); + gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); } static void PlayerPartnerHandleReturnMonToBall(void) @@ -1285,12 +1284,14 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerControllerFuncs[gActiveBattler] = sub_81BB828; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; } break; } } +#define sSpeedX data[0] + // some explanation here // in emerald it's possible to have a tag battle in the battle frontier facilities with AI // which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) that use the back pic as well as animate it @@ -1326,9 +1327,9 @@ static void PlayerPartnerHandleDrawTrainerPic(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = DISPLAY_WIDTH; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; } else // otherwise use front sprite { @@ -1337,10 +1338,10 @@ static void PlayerPartnerHandleDrawTrainerPic(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y = 48; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineMode = ST_OAM_AFFINE_OFF; gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1; } @@ -1348,6 +1349,8 @@ static void PlayerPartnerHandleDrawTrainerPic(void) gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; } +#undef sSpeedX + static void PlayerPartnerHandleTrainerSlide(void) { PlayerPartnerBufferExecCompleted(); @@ -1361,9 +1364,12 @@ static void PlayerPartnerHandleTrainerSlideBack(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = sub_81BAE98; + gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; } +#define sSpeedX data[1] +#define sSpeedY data[2] + static void PlayerPartnerHandleFaintAnimation(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0) @@ -1379,14 +1385,17 @@ static void PlayerPartnerHandleFaintAnimation(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); PlaySE12WithPanning(SE_FAINT, SOUND_PAN_ATTACKER); - gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 5; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039C00; - gBattlerControllerFuncs[gActiveBattler] = sub_81BB78C; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedY = 5; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintSlideAnim; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterFaintAnim; } } } +#undef sSpeedX +#undef sSpeedY + static void PlayerPartnerHandlePaletteFade(void) { PlayerPartnerBufferExecCompleted(); @@ -1409,7 +1418,7 @@ static void PlayerPartnerHandlePause(void) static void PlayerPartnerHandleMoveAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); @@ -1451,7 +1460,7 @@ static void PlayerPartnerDoMoveAnimation(void) case 1: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - sub_805EB9C(ST_OAM_AFFINE_OFF); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); DoMoveAnim(move); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; } @@ -1460,7 +1469,7 @@ static void PlayerPartnerDoMoveAnimation(void) gAnimScriptCallback(); if (!gAnimScriptActive) { - sub_805EB9C(ST_OAM_AFFINE_NORMAL); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) { InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); @@ -1504,7 +1513,7 @@ static void PlayerPartnerHandleChooseAction(void) PlayerPartnerBufferExecCompleted(); } -static void PlayerPartnerHandleUnknownYesNoBox(void) +static void PlayerPartnerHandleYesNoBox(void) { PlayerPartnerBufferExecCompleted(); } @@ -1612,7 +1621,7 @@ static void PlayerPartnerHandleExpUpdate(void) gTasks[taskId].tExpTask_monId = monId; gTasks[taskId].tExpTask_gainedExp = expPointsToGive; gTasks[taskId].tExpTask_bank = gActiveBattler; - gBattlerControllerFuncs[gActiveBattler] = nullsub_21; + gBattlerControllerFuncs[gActiveBattler] = BattleControllerDummy; } } @@ -1623,7 +1632,7 @@ static void PlayerPartnerHandleExpUpdate(void) static void PlayerPartnerHandleStatusIconUpdate(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 battlerId; @@ -1636,7 +1645,7 @@ static void PlayerPartnerHandleStatusIconUpdate(void) static void PlayerPartnerHandleStatusAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { InitAndLaunchChosenStatusAnimation(gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8) | (gBattleResources->bufferA[gActiveBattler][4] << 16) | (gBattleResources->bufferA[gActiveBattler][5] << 24)); @@ -1789,7 +1798,7 @@ static void PlayerPartnerHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreePlayerSpriteLoadMonSprite); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); paletteNum = AllocSpritePalette(0xD6F9); @@ -1812,17 +1821,17 @@ static void PlayerPartnerHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; - taskId = CreateTask(sub_81BE2C8, 5); + taskId = CreateTask(Task_StartSendOutAnim, 5); gTasks[taskId].data[0] = gActiveBattler; if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerControllerFuncs[gActiveBattler] = nullsub_77; + gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; + gBattlerControllerFuncs[gActiveBattler] = PlayerPartnerDummy; } -static void sub_81BE2C8(u8 taskId) +static void Task_StartSendOutAnim(u8 taskId) { if (gTasks[taskId].data[1] < 24) { @@ -1836,19 +1845,19 @@ static void sub_81BE2C8(u8 taskId) if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_81BD0E4(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); } else { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_81BD0E4(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - sub_81BD0E4(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerControllerFuncs[gActiveBattler] = sub_81BB02C; + gBattlerControllerFuncs[gActiveBattler] = Intro_ShowHealthbox; gActiveBattler = savedActiveBank; DestroyTask(taskId); } @@ -1864,20 +1873,20 @@ static void PlayerPartnerHandleDrawPartyStatusSummary(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1; gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; if (gBattleResources->bufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - gBattlerControllerFuncs[gActiveBattler] = sub_81BE498; + gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; } } -static void sub_81BE498(void) +static void EndDrawPartyStatusSummary(void) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5++ > 0x5C) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; PlayerPartnerBufferExecCompleted(); } } @@ -1906,7 +1915,7 @@ static void PlayerPartnerHandleSpriteInvisibility(void) static void PlayerPartnerHandleBattleAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); @@ -1928,13 +1937,13 @@ static void PlayerPartnerHandleResetActionMoveSelection(void) PlayerPartnerBufferExecCompleted(); } -static void PlayerPartnerHandleCmd55(void) +static void PlayerPartnerHandleEndLinkBattle(void) { gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; FadeOutMapMusic(5); BeginFastPaletteFade(3); PlayerPartnerBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; } static void PlayerPartnerHandleBattleDebug(void) diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index a9ac0f394..bee32ccbf 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -51,7 +51,7 @@ static void RecordedOpponentHandleMoveAnimation(void); static void RecordedOpponentHandlePrintString(void); static void RecordedOpponentHandlePrintSelectionString(void); static void RecordedOpponentHandleChooseAction(void); -static void RecordedOpponentHandleUnknownYesNoBox(void); +static void RecordedOpponentHandleYesNoBox(void); static void RecordedOpponentHandleChooseMove(void); static void RecordedOpponentHandleChooseItem(void); static void RecordedOpponentHandleChoosePokemon(void); @@ -87,21 +87,21 @@ static void RecordedOpponentHandleSpriteInvisibility(void); static void RecordedOpponentHandleBattleAnimation(void); static void RecordedOpponentHandleLinkStandbyMsg(void); static void RecordedOpponentHandleResetActionMoveSelection(void); -static void RecordedOpponentHandleCmd55(void); +static void RecordedOpponentHandleEndLinkBattle(void); static void RecordedOpponentHandleBattleDebug(void); static void RecordedOpponentCmdEnd(void); static void RecordedOpponentBufferRunCommand(void); static void RecordedOpponentBufferExecCompleted(void); -static void sub_8186F14(void); +static void SwitchIn_HandleSoundAndEnd(void); static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst); static void SetRecordedOpponentMonData(u8 monId); -static void sub_81885D8(u8 battlerId, bool8 dontClearSubstituteBit); +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); static void DoSwitchOutAnimation(void); static void RecordedOpponentDoMoveAnimation(void); -static void sub_8189548(u8 taskId); -static void sub_818962C(struct Sprite *sprite); -static void sub_818975C(void); +static void Task_StartSendOutAnim(u8 taskId); +static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite); +static void EndDrawPartyStatusSummary(void); static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { @@ -124,7 +124,7 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void [CONTROLLER_PRINTSTRING] = RecordedOpponentHandlePrintString, [CONTROLLER_PRINTSTRINGPLAYERONLY] = RecordedOpponentHandlePrintSelectionString, [CONTROLLER_CHOOSEACTION] = RecordedOpponentHandleChooseAction, - [CONTROLLER_UNKNOWNYESNOBOX] = RecordedOpponentHandleUnknownYesNoBox, + [CONTROLLER_YESNOBOX] = RecordedOpponentHandleYesNoBox, [CONTROLLER_CHOOSEMOVE] = RecordedOpponentHandleChooseMove, [CONTROLLER_OPENBAG] = RecordedOpponentHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = RecordedOpponentHandleChoosePokemon, @@ -160,12 +160,12 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void [CONTROLLER_BATTLEANIMATION] = RecordedOpponentHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = RecordedOpponentHandleLinkStandbyMsg, [CONTROLLER_RESETACTIONMOVESELECTION] = RecordedOpponentHandleResetActionMoveSelection, - [CONTROLLER_55] = RecordedOpponentHandleCmd55, + [CONTROLLER_ENDLINKBATTLE] = RecordedOpponentHandleEndLinkBattle, [CONTROLLER_DEBUGMENU] = RecordedOpponentHandleBattleDebug, [CONTROLLER_TERMINATOR_NOP] = RecordedOpponentCmdEnd }; -static void nullsub_70(void) +static void RecordedOpponentDummy(void) { } @@ -197,7 +197,7 @@ static void CompleteOnBankSpriteCallbackDummy2(void) RecordedOpponentBufferExecCompleted(); } -static void sub_81865C8(void) +static void FreeTrainerSpriteAfterSlide(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { @@ -208,24 +208,24 @@ static void sub_81865C8(void) } } -static void sub_8186630(void) +static void Intro_DelayAndEnd(void) { - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 == 0xFF) + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; RecordedOpponentBufferExecCompleted(); } } -static void sub_8186678(void) +static void Intro_WaitForShinyAnimAndHealthbox(void) { - bool8 var = FALSE; + bool8 healthboxAnimDone = FALSE; if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded) - var = TRUE; + healthboxAnimDone = TRUE; } else @@ -234,10 +234,10 @@ static void sub_8186678(void) && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].animEnded) - var = TRUE; + healthboxAnimDone = TRUE; } - if (var) + if (healthboxAnimDone) { if (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_LEFT) { @@ -250,19 +250,19 @@ static void sub_8186678(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerControllerFuncs[gActiveBattler] = sub_8186630; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; + gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; } } -static void sub_818686C(void) +static void Intro_TryShinyAnimShowHealthbox(void) { - bool32 r9 = FALSE; - bool32 r8 = FALSE; + bool32 bgmRestored = FALSE; + bool32 battlerAnimsDone = FALSE; if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) @@ -274,27 +274,27 @@ static void sub_818686C(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler ^ BIT_FLANK); + StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 1; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = TRUE; } - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x40 - && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].field_1_x40 + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry + && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry && !IsCryPlayingOrClearCrySongs()) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) { @@ -306,49 +306,49 @@ static void sub_818686C(void) m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100); } } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 1; - r9 = TRUE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; + bgmRestored = TRUE; } if (!IsDoubleBattle()) { - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { - r8 = TRUE; + battlerAnimsDone = TRUE; } } else { - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy - && gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy + && gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { - r8 = TRUE; + battlerAnimsDone = TRUE; } } - if (r9 && r8) + if (bgmRestored && battlerAnimsDone) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); SetBattlerShadowSpriteCallback(gActiveBattler ^ BIT_FLANK, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], MON_DATA_SPECIES)); } - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattleSpritesDataPtr->animationData->field_9_x1 = 0; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 0; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 0; + gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; - gBattlerControllerFuncs[gActiveBattler] = sub_8186678; + gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; } } -static void sub_8186C48(void) +static void TryShinyAnimAfterMonAnim(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0) @@ -363,8 +363,8 @@ static void sub_8186C48(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); RecordedOpponentBufferExecCompleted(); } } @@ -387,7 +387,7 @@ static void CompleteOnHealthbarDone(void) } } -static void sub_8186D58(void) +static void HideHealthboxAfterMonFaint(void) { if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse) { @@ -396,7 +396,7 @@ static void sub_8186D58(void) } } -static void sub_8186D9C(void) +static void FreeMonSpriteAfterSwitchOutAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { @@ -433,18 +433,18 @@ static void DoHitAnimBlinkSpriteEffect(void) } } -static void sub_8186EA4(void) +static void SwitchIn_ShowSubstitute(void) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = sub_8186F14; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_HandleSoundAndEnd; } } -static void sub_8186F14(void) +static void SwitchIn_HandleSoundAndEnd(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && !IsCryPlayingOrClearCrySongs()) @@ -458,7 +458,7 @@ static void sub_8186F14(void) } } -static void sub_8186F94(void) +static void SwitchIn_ShowHealthbox(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) @@ -466,31 +466,31 @@ static void sub_8186F94(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); CopyBattleSpriteInvisibility(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = sub_8186EA4; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; } } -static void sub_8187084(void) +static void SwitchIn_TryShinyAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim) TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]); - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerControllerFuncs[gActiveBattler] = sub_8186F94; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; } } @@ -1125,24 +1125,24 @@ static void RecordedOpponentHandleLoadMonSprite(void) SetBattlerShadowSpriteCallback(gActiveBattler, GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES)); - gBattlerControllerFuncs[gActiveBattler] = sub_8186C48; + gBattlerControllerFuncs[gActiveBattler] = TryShinyAnimAfterMonAnim; } static void RecordedOpponentHandleSwitchInAnim(void) { gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1]; - sub_81885D8(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = sub_8187084; + StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; } -static void sub_81885D8(u8 battlerId, bool8 dontClearSubstituteBit) +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) { u16 species; ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714); + gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId); SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); @@ -1151,8 +1151,8 @@ static void sub_81885D8(u8 battlerId, bool8 dontClearSubstituteBit) GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); - gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; + gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; + gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; @@ -1163,7 +1163,7 @@ static void sub_81885D8(u8 battlerId, bool8 dontClearSubstituteBit) gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT); + gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_OPPONENT_SENDOUT); } static void RecordedOpponentHandleReturnMonToBall(void) @@ -1198,12 +1198,14 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_OPPONENT_MON); - gBattlerControllerFuncs[gActiveBattler] = sub_8186D9C; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; } break; } } +#define sSpeedX data[0] + static void RecordedOpponentHandleDrawTrainerPic(void) { s16 xPos; @@ -1249,14 +1251,16 @@ static void RecordedOpponentHandleDrawTrainerPic(void) GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 2; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; } +#undef sSpeedX + static void RecordedOpponentHandleTrainerSlide(void) { RecordedOpponentBufferExecCompleted(); @@ -1270,7 +1274,7 @@ static void RecordedOpponentHandleTrainerSlideBack(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = sub_81865C8; + gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; } static void RecordedOpponentHandleFaintAnimation(void) @@ -1288,7 +1292,7 @@ static void RecordedOpponentHandleFaintAnimation(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; PlaySE12WithPanning(SE_FAINT, SOUND_PAN_TARGET); gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon; - gBattlerControllerFuncs[gActiveBattler] = sub_8186D58; + gBattlerControllerFuncs[gActiveBattler] = HideHealthboxAfterMonFaint; } } } @@ -1315,7 +1319,7 @@ static void RecordedOpponentHandlePause(void) static void RecordedOpponentHandleMoveAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); @@ -1357,7 +1361,7 @@ static void RecordedOpponentDoMoveAnimation(void) case 1: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - sub_805EB9C(ST_OAM_AFFINE_OFF); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); DoMoveAnim(move); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; } @@ -1366,7 +1370,7 @@ static void RecordedOpponentDoMoveAnimation(void) gAnimScriptCallback(); if (!gAnimScriptActive) { - sub_805EB9C(ST_OAM_AFFINE_NORMAL); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) { InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); @@ -1410,7 +1414,7 @@ static void RecordedOpponentHandleChooseAction(void) RecordedOpponentBufferExecCompleted(); } -static void RecordedOpponentHandleUnknownYesNoBox(void) +static void RecordedOpponentHandleYesNoBox(void) { RecordedOpponentBufferExecCompleted(); } @@ -1479,7 +1483,7 @@ static void RecordedOpponentHandleExpUpdate(void) static void RecordedOpponentHandleStatusIconUpdate(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 battlerId; @@ -1492,7 +1496,7 @@ static void RecordedOpponentHandleStatusIconUpdate(void) static void RecordedOpponentHandleStatusAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { InitAndLaunchChosenStatusAnimation(gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8) | (gBattleResources->bufferA[gActiveBattler][4] << 16) | (gBattleResources->bufferA[gActiveBattler][5] << 24)); @@ -1643,19 +1647,19 @@ static void RecordedOpponentHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_818962C); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreeOpponentSprite); - taskId = CreateTask(sub_8189548, 5); + taskId = CreateTask(Task_StartSendOutAnim, 5); gTasks[taskId].data[0] = gActiveBattler; if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerControllerFuncs[gActiveBattler] = nullsub_70; + gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; + gBattlerControllerFuncs[gActiveBattler] = RecordedOpponentDummy; } -static void sub_8189548(u8 taskId) +static void Task_StartSendOutAnim(u8 taskId) { u8 savedActiveBank = gActiveBattler; @@ -1663,23 +1667,23 @@ static void sub_8189548(u8 taskId) if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_81885D8(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); } else { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_81885D8(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_81885D8(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerControllerFuncs[gActiveBattler] = sub_818686C; + gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; gActiveBattler = savedActiveBank; DestroyTask(taskId); } -static void sub_818962C(struct Sprite *sprite) +static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite) { FreeTrainerFrontPicPalette(sprite->oam.affineParam); FreeSpriteOamMatrix(sprite); @@ -1710,20 +1714,20 @@ static void RecordedOpponentHandleDrawPartyStatusSummary(void) } gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; if (gBattleResources->bufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - gBattlerControllerFuncs[gActiveBattler] = sub_818975C; + gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; } } -static void sub_818975C(void) +static void EndDrawPartyStatusSummary(void) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5++ > 0x5C) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; RecordedOpponentBufferExecCompleted(); } } @@ -1752,7 +1756,7 @@ static void RecordedOpponentHandleSpriteInvisibility(void) static void RecordedOpponentHandleBattleAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); @@ -1774,7 +1778,7 @@ static void RecordedOpponentHandleResetActionMoveSelection(void) RecordedOpponentBufferExecCompleted(); } -static void RecordedOpponentHandleCmd55(void) +static void RecordedOpponentHandleEndLinkBattle(void) { if (gBattleResources->bufferA[gActiveBattler][1] == B_OUTCOME_DREW) gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; @@ -1784,7 +1788,7 @@ static void RecordedOpponentHandleCmd55(void) FadeOutMapMusic(5); BeginFastPaletteFade(3); RecordedOpponentBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; } static void RecordedOpponentHandleBattleDebug(void) diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index ade2f750d..e6dbebec9 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -47,7 +47,7 @@ static void RecordedPlayerHandleMoveAnimation(void); static void RecordedPlayerHandlePrintString(void); static void RecordedPlayerHandlePrintSelectionString(void); static void RecordedPlayerHandleChooseAction(void); -static void RecordedPlayerHandleUnknownYesNoBox(void); +static void RecordedPlayerHandleYesNoBox(void); static void RecordedPlayerHandleChooseMove(void); static void RecordedPlayerHandleChooseItem(void); static void RecordedPlayerHandleChoosePokemon(void); @@ -83,19 +83,19 @@ static void RecordedPlayerHandleSpriteInvisibility(void); static void RecordedPlayerHandleBattleAnimation(void); static void RecordedPlayerHandleLinkStandbyMsg(void); static void RecordedPlayerHandleResetActionMoveSelection(void); -static void RecordedPlayerHandleCmd55(void); +static void RecordedPlayerHandleEndLinkBattle(void); static void RecordedPlayerCmdEnd(void); static void RecordedPlayerBufferRunCommand(void); static void RecordedPlayerBufferExecCompleted(void); -static void sub_818A328(void); +static void SwitchIn_WaitAndEnd(void); static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst); static void SetRecordedPlayerMonData(u8 monId); -static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit); +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); static void DoSwitchOutAnimation(void); static void RecordedPlayerDoMoveAnimation(void); -static void sub_818CC24(u8 taskId); -static void sub_818CDF4(void); +static void Task_StartSendOutAnim(u8 taskId); +static void EndDrawPartyStatusSummary(void); static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { @@ -118,7 +118,7 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) [CONTROLLER_PRINTSTRING] = RecordedPlayerHandlePrintString, [CONTROLLER_PRINTSTRINGPLAYERONLY] = RecordedPlayerHandlePrintSelectionString, [CONTROLLER_CHOOSEACTION] = RecordedPlayerHandleChooseAction, - [CONTROLLER_UNKNOWNYESNOBOX] = RecordedPlayerHandleUnknownYesNoBox, + [CONTROLLER_YESNOBOX] = RecordedPlayerHandleYesNoBox, [CONTROLLER_CHOOSEMOVE] = RecordedPlayerHandleChooseMove, [CONTROLLER_OPENBAG] = RecordedPlayerHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = RecordedPlayerHandleChoosePokemon, @@ -154,11 +154,11 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) [CONTROLLER_BATTLEANIMATION] = RecordedPlayerHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = RecordedPlayerHandleLinkStandbyMsg, [CONTROLLER_RESETACTIONMOVESELECTION] = RecordedPlayerHandleResetActionMoveSelection, - [CONTROLLER_55] = RecordedPlayerHandleCmd55, + [CONTROLLER_ENDLINKBATTLE] = RecordedPlayerHandleEndLinkBattle, [CONTROLLER_TERMINATOR_NOP] = RecordedPlayerCmdEnd }; -static void nullsub_120(void) +static void RecordedPlayerDummy(void) { } @@ -184,47 +184,47 @@ static void CompleteOnBattlerSpriteCallbackDummy(void) RecordedPlayerBufferExecCompleted(); } -static void sub_81899F0(void) +static void FreeTrainerSpriteAfterSlide(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { - nullsub_25(0); + BattleGfxSfxDummy3(MALE); FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]); DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); RecordedPlayerBufferExecCompleted(); } } -static void sub_8189A58(void) +static void Intro_DelayAndEnd(void) { - if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 == 0xFF) + if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0; RecordedPlayerBufferExecCompleted(); } } -static void sub_8189AA0(void) +static void Intro_WaitForShinyAnimAndHealthbox(void) { - bool32 r6 = FALSE; + bool32 healthboxAnimDone = FALSE; if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT) { if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - r6 = TRUE; + healthboxAnimDone = TRUE; } else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { - r6 = TRUE; + healthboxAnimDone = TRUE; } } - if (r6 && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim + if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; @@ -233,15 +233,15 @@ static void sub_8189AA0(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); if (IsDoubleBattle()) HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], gActiveBattler ^ BIT_FLANK); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerControllerFuncs[gActiveBattler] = sub_8189A58; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; + gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; } } else @@ -249,31 +249,31 @@ static void sub_8189AA0(void) if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - r6 = TRUE; + healthboxAnimDone = TRUE; } else { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy) { - r6 = TRUE; + healthboxAnimDone = TRUE; } } if (IsCryPlayingOrClearCrySongs()) - r6 = FALSE; + healthboxAnimDone = FALSE; - if (r6) + if (healthboxAnimDone) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3; - gBattlerControllerFuncs[gActiveBattler] = sub_8189A58; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3; + gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd; } } } -static void sub_8189D40(void) +static void Intro_TryShinyAnimShowHealthbox(void) { - bool32 r10 = FALSE; + bool32 bgmRestored = FALSE; if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT) { @@ -289,27 +289,27 @@ static void sub_8189D40(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler ^ BIT_FLANK); + StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 1; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = TRUE; } - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x40 - && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].field_1_x40 + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].waitForCry + && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].waitForCry && !IsCryPlayingOrClearCrySongs()) { - if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20) + if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored) { if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { @@ -322,25 +322,25 @@ static void sub_8189D40(void) } } - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 1; - r10 = TRUE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = TRUE; + bgmRestored = TRUE; } - if (r10 && gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (bgmRestored && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - gBattleSpritesDataPtr->animationData->field_9_x1 = 0; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x20 = 0; - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x80 = 0; - gBattlerControllerFuncs[gActiveBattler] = sub_8189AA0; + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); + gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].bgmRestored = FALSE; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].healthboxSlideInStarted = FALSE; + gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; } } -static void sub_818A064(void) +static void WaitForMonAnimAfterLoad(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded && gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x == 0) RecordedPlayerBufferExecCompleted(); @@ -363,13 +363,13 @@ static void CompleteOnHealthbarDone(void) } } -static void sub_818A114(void) +static void FreeMonSpriteAfterFaintAnim(void) { if (gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y > DISPLAY_HEIGHT) { u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - nullsub_24(species); + BattleGfxSfxDummy2(species); FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum); DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]); SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]); @@ -377,7 +377,7 @@ static void sub_818A114(void) } } -static void sub_818A1B0(void) +static void FreeMonSpriteAfterSwitchOutAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { @@ -413,7 +413,7 @@ static void DoHitAnimBlinkSpriteEffect(void) } } -static void sub_818A2B4(void) +static void SwitchIn_ShowSubstitute(void) { if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { @@ -421,11 +421,11 @@ static void sub_818A2B4(void) if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); - gBattlerControllerFuncs[gActiveBattler] = sub_818A328; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_WaitAndEnd; } } -static void sub_818A328(void) +static void SwitchIn_WaitAndEnd(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) @@ -434,28 +434,28 @@ static void sub_818A328(void) } } -static void sub_818A37C(void) +static void SwitchIn_ShowHealthbox(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); - CreateTask(c3_0802FDF4, 10); + CreateTask(Task_PlayerController_RestoreBgmAfterCry, 10); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - gBattlerControllerFuncs[gActiveBattler] = sub_818A2B4; + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute; } } -static void sub_818A470(void) +static void SwitchIn_TryShinyAnim(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) @@ -463,11 +463,11 @@ static void sub_818A470(void) TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]); } - if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) { - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); - gBattlerControllerFuncs[gActiveBattler] = sub_818A37C; + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox; } } @@ -1101,7 +1101,7 @@ static void RecordedPlayerHandleLoadMonSprite(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); - gBattlerControllerFuncs[gActiveBattler] = sub_818A064; + gBattlerControllerFuncs[gActiveBattler] = WaitForMonAnimAfterLoad; } static void RecordedPlayerHandleSwitchInAnim(void) @@ -1109,18 +1109,18 @@ static void RecordedPlayerHandleSwitchInAnim(void) ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); gBattlerPartyIndexes[gActiveBattler] = gBattleResources->bufferA[gActiveBattler][1]; BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - sub_818BA6C(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); - gBattlerControllerFuncs[gActiveBattler] = sub_818A470; + StartSendOutAnim(gActiveBattler, gBattleResources->bufferA[gActiveBattler][2]); + gBattlerControllerFuncs[gActiveBattler] = SwitchIn_TryShinyAnim; } -static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit) +static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit) { u16 species; ClearTemporarySpeciesSpriteData(battlerId, dontClearSubstituteBit); gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714); + gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); gBattlerSpriteIds[battlerId] = CreateSprite( @@ -1129,8 +1129,8 @@ static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit) GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); - gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; + gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; + gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; @@ -1141,7 +1141,7 @@ static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit) gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); + gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); } static void RecordedPlayerHandleReturnMonToBall(void) @@ -1175,12 +1175,14 @@ static void DoSwitchOutAnimation(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerControllerFuncs[gActiveBattler] = sub_818A1B0; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim; } break; } } +#define sSpeedX data[0] + static void RecordedPlayerHandleDrawTrainerPic(void) { s16 xPos, yPos; @@ -1230,10 +1232,10 @@ static void RecordedPlayerHandleDrawTrainerPic(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.y = 48; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineMode = ST_OAM_AFFINE_OFF; gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1; } @@ -1244,14 +1246,16 @@ static void RecordedPlayerHandleDrawTrainerPic(void) gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler)); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = DISPLAY_WIDTH; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; } gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; } +#undef sSpeedX + static void RecordedPlayerHandleTrainerSlide(void) { RecordedPlayerBufferExecCompleted(); @@ -1265,9 +1269,12 @@ static void RecordedPlayerHandleTrainerSlideBack(void) gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y; gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy); - gBattlerControllerFuncs[gActiveBattler] = sub_81899F0; + gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; } +#define sSpeedX data[1] +#define sSpeedY data[2] + static void RecordedPlayerHandleFaintAnimation(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0) @@ -1283,14 +1290,17 @@ static void RecordedPlayerHandleFaintAnimation(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); PlaySE12WithPanning(SE_FAINT, -64); - gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 5; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039C00; - gBattlerControllerFuncs[gActiveBattler] = sub_818A114; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 0; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedY = 5; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintSlideAnim; + gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterFaintAnim; } } } +#undef sSpeedX +#undef sSpeedY + static void RecordedPlayerHandlePaletteFade(void) { RecordedPlayerBufferExecCompleted(); @@ -1313,7 +1323,7 @@ static void RecordedPlayerHandlePause(void) static void RecordedPlayerHandleMoveAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8); @@ -1355,7 +1365,7 @@ static void RecordedPlayerDoMoveAnimation(void) case 1: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - sub_805EB9C(ST_OAM_AFFINE_OFF); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); DoMoveAnim(move); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; } @@ -1364,7 +1374,7 @@ static void RecordedPlayerDoMoveAnimation(void) gAnimScriptCallback(); if (!gAnimScriptActive) { - sub_805EB9C(ST_OAM_AFFINE_NORMAL); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2) { InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); @@ -1424,7 +1434,7 @@ static void RecordedPlayerHandleChooseAction(void) } } -static void RecordedPlayerHandleUnknownYesNoBox(void) +static void RecordedPlayerHandleYesNoBox(void) { RecordedPlayerBufferExecCompleted(); } @@ -1494,7 +1504,7 @@ static void RecordedPlayerHandleExpUpdate(void) static void RecordedPlayerHandleStatusIconUpdate(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 battlerId; @@ -1507,7 +1517,7 @@ static void RecordedPlayerHandleStatusIconUpdate(void) static void RecordedPlayerHandleStatusAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { InitAndLaunchChosenStatusAnimation(gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8) | (gBattleResources->bufferA[gActiveBattler][4] << 16) | (gBattleResources->bufferA[gActiveBattler][5] << 24)); @@ -1661,7 +1671,7 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreePlayerSpriteLoadMonSprite); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); paletteNum = AllocSpritePalette(0xD6F9); @@ -1674,17 +1684,17 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; - taskId = CreateTask(sub_818CC24, 5); + taskId = CreateTask(Task_StartSendOutAnim, 5); gTasks[taskId].data[0] = gActiveBattler; if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerControllerFuncs[gActiveBattler] = nullsub_120; + gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; + gBattlerControllerFuncs[gActiveBattler] = RecordedPlayerDummy; } -static void sub_818CC24(u8 taskId) +static void Task_StartSendOutAnim(u8 taskId) { if (gTasks[taskId].data[1] < 24) { @@ -1698,19 +1708,19 @@ static void sub_818CC24(u8 taskId) if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_818BA6C(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); } else { gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_818BA6C(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); - sub_818BA6C(gActiveBattler, FALSE); + StartSendOutAnim(gActiveBattler, FALSE); gActiveBattler ^= BIT_FLANK; } - gBattlerControllerFuncs[gActiveBattler] = sub_8189D40; + gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; gActiveBattler = savedActiveBank; DestroyTask(taskId); } @@ -1726,20 +1736,20 @@ static void RecordedPlayerHandleDrawPartyStatusSummary(void) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1; gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]); - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; if (gBattleResources->bufferA[gActiveBattler][2] != 0) - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93; - gBattlerControllerFuncs[gActiveBattler] = sub_818CDF4; + gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary; } } -static void sub_818CDF4(void) +static void EndDrawPartyStatusSummary(void) { - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5++ > 0x5C) + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92) { - gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; + gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0; RecordedPlayerBufferExecCompleted(); } } @@ -1768,7 +1778,7 @@ static void RecordedPlayerHandleSpriteInvisibility(void) static void RecordedPlayerHandleBattleAnimation(void) { - if (!mplay_80342A4(gActiveBattler)) + if (!IsBattleSEPlaying(gActiveBattler)) { u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8); @@ -1790,13 +1800,13 @@ static void RecordedPlayerHandleResetActionMoveSelection(void) RecordedPlayerBufferExecCompleted(); } -static void RecordedPlayerHandleCmd55(void) +static void RecordedPlayerHandleEndLinkBattle(void) { gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; FadeOutMapMusic(5); BeginFastPaletteFade(3); RecordedPlayerBufferExecCompleted(); - gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; } static void RecordedPlayerCmdEnd(void) diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 724bcd7da..9acee4106 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -44,7 +44,7 @@ static void SafariHandleMoveAnimation(void); static void SafariHandlePrintString(void); static void SafariHandlePrintSelectionString(void); static void SafariHandleChooseAction(void); -static void SafariHandleUnknownYesNoBox(void); +static void SafariHandleYesNoBox(void); static void SafariHandleChooseMove(void); static void SafariHandleChooseItem(void); static void SafariHandleChoosePokemon(void); @@ -80,7 +80,7 @@ static void SafariHandleSpriteInvisibility(void); static void SafariHandleBattleAnimation(void); static void SafariHandleLinkStandbyMsg(void); static void SafariHandleResetActionMoveSelection(void); -static void SafariHandleCmd55(void); +static void SafariHandleEndLinkBattle(void); static void SafariHandleBattleDebug(void); static void SafariCmdEnd(void); @@ -109,7 +109,7 @@ static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_PRINTSTRING] = SafariHandlePrintString, [CONTROLLER_PRINTSTRINGPLAYERONLY] = SafariHandlePrintSelectionString, [CONTROLLER_CHOOSEACTION] = SafariHandleChooseAction, - [CONTROLLER_UNKNOWNYESNOBOX] = SafariHandleUnknownYesNoBox, + [CONTROLLER_YESNOBOX] = SafariHandleYesNoBox, [CONTROLLER_CHOOSEMOVE] = SafariHandleChooseMove, [CONTROLLER_OPENBAG] = SafariHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = SafariHandleChoosePokemon, @@ -145,7 +145,7 @@ static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_BATTLEANIMATION] = SafariHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = SafariHandleLinkStandbyMsg, [CONTROLLER_RESETACTIONMOVESELECTION] = SafariHandleResetActionMoveSelection, - [CONTROLLER_55] = SafariHandleCmd55, + [CONTROLLER_ENDLINKBATTLE] = SafariHandleEndLinkBattle, [CONTROLLER_DEBUGMENU] = SafariHandleBattleDebug, [CONTROLLER_TERMINATOR_NOP] = SafariCmdEnd }; @@ -253,7 +253,7 @@ static void CompleteOnHealthboxSpriteCallbackDummy(void) SafariBufferExecCompleted(); } -static void sub_81595E4(void) +static void SafariSetBattleEndCallbacks(void) { if (!gPaletteFade.active) { @@ -351,6 +351,8 @@ static void SafariHandleReturnMonToBall(void) SafariBufferExecCompleted(); } +#define sSpeedX data[0] + static void SafariHandleDrawTrainerPic(void) { DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBattler); @@ -361,12 +363,14 @@ static void SafariHandleDrawTrainerPic(void) (8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].size) * 4 + 80, 30); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = DISPLAY_WIDTH; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; } +#undef sSpeedX + static void SafariHandleTrainerSlide(void) { SafariBufferExecCompleted(); @@ -460,7 +464,7 @@ static void SafariHandleChooseAction(void) BattlePutTextOnWindow(gDisplayedStringBattle, 1); } -static void SafariHandleUnknownYesNoBox(void) +static void SafariHandleYesNoBox(void) { SafariBufferExecCompleted(); } @@ -472,7 +476,7 @@ static void SafariHandleChooseMove(void) static void SafariHandleChooseItem(void) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gBattlerControllerFuncs[gActiveBattler] = SafariOpenPokeblockCase; gBattlerInMenuId = gActiveBattler; } @@ -629,7 +633,7 @@ static void SafariHandleIntroSlide(void) static void SafariHandleIntroTrainerBallThrow(void) { UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_SAFARI_ALL_TEXT); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthboxSpriteCallbackDummy; } @@ -675,14 +679,14 @@ static void SafariHandleResetActionMoveSelection(void) SafariBufferExecCompleted(); } -static void SafariHandleCmd55(void) +static void SafariHandleEndLinkBattle(void) { gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; FadeOutMapMusic(5); BeginFastPaletteFade(3); SafariBufferExecCompleted(); if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && !(gBattleTypeFlags & BATTLE_TYPE_IS_MASTER)) - gBattlerControllerFuncs[gActiveBattler] = sub_81595E4; + gBattlerControllerFuncs[gActiveBattler] = SafariSetBattleEndCallbacks; } static void SafariHandleBattleDebug(void) diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index 251f55545..0fa4e679e 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -52,7 +52,7 @@ static void WallyHandleMoveAnimation(void); static void WallyHandlePrintString(void); static void WallyHandlePrintSelectionString(void); static void WallyHandleChooseAction(void); -static void WallyHandleUnknownYesNoBox(void); +static void WallyHandleYesNoBox(void); static void WallyHandleChooseMove(void); static void WallyHandleChooseItem(void); static void WallyHandleChoosePokemon(void); @@ -88,18 +88,18 @@ static void WallyHandleSpriteInvisibility(void); static void WallyHandleBattleAnimation(void); static void WallyHandleLinkStandbyMsg(void); static void WallyHandleResetActionMoveSelection(void); -static void WallyHandleCmd55(void); +static void WallyHandleEndLinkBattle(void); static void WallyHandleBattleDebug(void); static void WallyCmdEnd(void); static void WallyBufferRunCommand(void); static void WallyBufferExecCompleted(void); static void CompleteOnChosenItem(void); -static void sub_8168818(void); +static void Intro_WaitForShinyAnimAndHealthbox(void); static u32 CopyWallyMonData(u8 monId, u8 *dst); static void SetWallyMonData(u8 monId); static void WallyDoMoveAnimation(void); -static void sub_816AC04(u8 taskId); +static void Task_StartSendOutAnim(u8 taskId); static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) = { @@ -122,7 +122,7 @@ static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_PRINTSTRING] = WallyHandlePrintString, [CONTROLLER_PRINTSTRINGPLAYERONLY] = WallyHandlePrintSelectionString, [CONTROLLER_CHOOSEACTION] = WallyHandleChooseAction, - [CONTROLLER_UNKNOWNYESNOBOX] = WallyHandleUnknownYesNoBox, + [CONTROLLER_YESNOBOX] = WallyHandleYesNoBox, [CONTROLLER_CHOOSEMOVE] = WallyHandleChooseMove, [CONTROLLER_OPENBAG] = WallyHandleChooseItem, [CONTROLLER_CHOOSEPOKEMON] = WallyHandleChoosePokemon, @@ -158,7 +158,7 @@ static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_BATTLEANIMATION] = WallyHandleBattleAnimation, [CONTROLLER_LINKSTANDBYMSG] = WallyHandleLinkStandbyMsg, [CONTROLLER_RESETACTIONMOVESELECTION] = WallyHandleResetActionMoveSelection, - [CONTROLLER_55] = WallyHandleCmd55, + [CONTROLLER_ENDLINKBATTLE] = WallyHandleEndLinkBattle, [CONTROLLER_DEBUGMENU] = WallyHandleBattleDebug, [CONTROLLER_TERMINATOR_NOP] = WallyCmdEnd }; @@ -270,7 +270,7 @@ static void OpenBagAfterPaletteFade(void) if (!gPaletteFade.active) { gBattlerControllerFuncs[gActiveBattler] = CompleteOnChosenItem; - nullsub_35(); + ReshowBattleScreenDummy(); FreeAllWindowBuffers(); DoWallyTutorialBagMenu(); } @@ -285,7 +285,7 @@ static void CompleteOnChosenItem(void) } } -static void sub_816864C(void) +static void Intro_TryShinyAnimShowHealthbox(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive) @@ -297,35 +297,35 @@ static void sub_816864C(void) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive - && gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy + && gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy && gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) { if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler ^ BIT_FLANK]]); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler ^ BIT_FLANK); + StartHealthboxSlideIn(gActiveBattler ^ BIT_FLANK); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler ^ BIT_FLANK]); } - DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]); + DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL); - sub_8076918(gActiveBattler); + StartHealthboxSlideIn(gActiveBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]); - gBattleSpritesDataPtr->animationData->field_9_x1 = 0; - gBattlerControllerFuncs[gActiveBattler] = sub_8168818; + gBattleSpritesDataPtr->animationData->introAnimActive = FALSE; + gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForShinyAnimAndHealthbox; } } -static void sub_8168818(void) +static void Intro_WaitForShinyAnimAndHealthbox(void) { - bool32 r4 = FALSE; + bool32 healthboxAnimDone = FALSE; if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) - r4 = TRUE; + healthboxAnimDone = TRUE; - if (r4 && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim + if (healthboxAnimDone && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE; @@ -334,10 +334,10 @@ static void sub_8168818(void) gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim = FALSE; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].finishedShinyMonAnim = FALSE; - FreeSpriteTilesByTag(0x27F9); - FreeSpritePaletteByTag(0x27F9); + FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS); + FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS); - CreateTask(c3_0802FDF4, 10); + CreateTask(Task_PlayerController_RestoreBgmAfterCry, 10); HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler); WallyBufferExecCompleted(); @@ -380,7 +380,7 @@ static void DoHitAnimBlinkSpriteEffect(void) } } -static void sub_8168A20(void) +static void DoSwitchOutAnimation(void) { if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { @@ -1020,7 +1020,7 @@ static void WallyHandleReturnMonToBall(void) if (gBattleResources->bufferA[gActiveBattler][1] == 0) { InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON); - gBattlerControllerFuncs[gActiveBattler] = sub_8168A20; + gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation; } else { @@ -1031,6 +1031,8 @@ static void WallyHandleReturnMonToBall(void) } } +#define sSpeedX data[0] + static void WallyHandleDrawTrainerPic(void) { DecompressTrainerBackPic(TRAINER_BACK_PIC_WALLY, gActiveBattler); @@ -1040,9 +1042,9 @@ static void WallyHandleDrawTrainerPic(void) 80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].size), 30); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = DISPLAY_WIDTH; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy; } @@ -1056,11 +1058,13 @@ static void WallyHandleTrainerSlide(void) 30); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -96; - gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 2; - gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC; + gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; + gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn; gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2; } +#undef sSpeedX + static void WallyHandleTrainerSlideBack(void) { WallyBufferExecCompleted(); @@ -1138,7 +1142,7 @@ static void WallyDoMoveAnimation(void) case 1: if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive) { - sub_805EB9C(ST_OAM_AFFINE_OFF); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF); DoMoveAnim(move); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2; } @@ -1147,7 +1151,7 @@ static void WallyDoMoveAnimation(void) gAnimScriptCallback(); if (!gAnimScriptActive) { - sub_805EB9C(ST_OAM_AFFINE_NORMAL); + SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL); if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute) { InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE); @@ -1212,7 +1216,7 @@ static void WallyHandleChooseAction(void) BattlePutTextOnWindow(gDisplayedStringBattle, 1); } -static void WallyHandleUnknownYesNoBox(void) +static void WallyHandleYesNoBox(void) { WallyBufferExecCompleted(); } @@ -1247,7 +1251,7 @@ static void WallyHandleChooseMove(void) static void WallyHandleChooseItem(void) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gBattlerControllerFuncs[gActiveBattler] = OpenBagAfterPaletteFade; gBattlerInMenuId = gActiveBattler; } @@ -1436,39 +1440,39 @@ static void WallyHandleIntroTrainerBallThrow(void) gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation; gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler; - StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00); + StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreePlayerSpriteLoadMonSprite); StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1); paletteNum = AllocSpritePalette(0xD6F8); LoadCompressedPalette(gTrainerBackPicPaletteTable[TRAINER_BACK_PIC_WALLY].data, 0x100 + paletteNum * 16, 32); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum; - taskId = CreateTask(sub_816AC04, 5); + taskId = CreateTask(Task_StartSendOutAnim, 5); gTasks[taskId].data[0] = gActiveBattler; if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown) gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary; - gBattleSpritesDataPtr->animationData->field_9_x1 = 1; - gBattlerControllerFuncs[gActiveBattler] = nullsub_21; + gBattleSpritesDataPtr->animationData->introAnimActive = TRUE; + gBattlerControllerFuncs[gActiveBattler] = BattleControllerDummy; } -static void sub_816AA80(u8 battlerId) +static void StartSendOutAnim(u8 battlerId) { u16 species; gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies = 0; gBattlerPartyIndexes[battlerId] = gBattleResources->bufferA[battlerId][1]; species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES); - gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714); + gBattleControllerData[battlerId] = CreateInvisibleSpriteWithCallback(SpriteCB_WaitForBattlerBallReleaseAnim); SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId)); gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battlerId, 2), GetBattlerSpriteDefault_Y(battlerId), GetBattlerSpriteSubpriority(battlerId)); - gSprites[gUnknown_03005D7C[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; - gSprites[gUnknown_03005D7C[battlerId]].data[2] = battlerId; + gSprites[gBattleControllerData[battlerId]].data[1] = gBattlerSpriteIds[battlerId]; + gSprites[gBattleControllerData[battlerId]].data[2] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[0] = battlerId; gSprites[gBattlerSpriteIds[battlerId]].data[2] = species; @@ -1477,10 +1481,10 @@ static void sub_816AA80(u8 battlerId) StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerId]], gBattleMonForms[battlerId]); gSprites[gBattlerSpriteIds[battlerId]].invisible = TRUE; gSprites[gBattlerSpriteIds[battlerId]].callback = SpriteCallbackDummy; - gSprites[gUnknown_03005D7C[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); + gSprites[gBattleControllerData[battlerId]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT); } -static void sub_816AC04(u8 taskId) +static void Task_StartSendOutAnim(u8 taskId) { if (gTasks[taskId].data[1] < 31) { @@ -1492,8 +1496,8 @@ static void sub_816AC04(u8 taskId) gActiveBattler = gTasks[taskId].data[0]; gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler]; - sub_816AA80(gActiveBattler); - gBattlerControllerFuncs[gActiveBattler] = sub_816864C; + StartSendOutAnim(gActiveBattler); + gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox; gActiveBattler = savedActiveBank; DestroyTask(taskId); } @@ -1549,7 +1553,7 @@ static void WallyHandleResetActionMoveSelection(void) WallyBufferExecCompleted(); } -static void WallyHandleCmd55(void) +static void WallyHandleEndLinkBattle(void) { gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1]; FadeOutMapMusic(5); @@ -1557,7 +1561,7 @@ static void WallyHandleCmd55(void) WallyBufferExecCompleted(); if (!(gBattleTypeFlags & BATTLE_TYPE_IS_MASTER) && gBattleTypeFlags & BATTLE_TYPE_LINK) - gBattlerControllerFuncs[gActiveBattler] = sub_80587B0; + gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks; } static void WallyHandleBattleDebug(void) diff --git a/src/battle_controllers.c b/src/battle_controllers.c index a26a66158..0bb9ba8d7 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -17,11 +17,10 @@ static EWRAM_DATA u8 sLinkSendTaskId = 0; static EWRAM_DATA u8 sLinkReceiveTaskId = 0; -static EWRAM_DATA u8 sUnknown_02022D0A = 0; +static EWRAM_DATA u8 sUnused = 0; // Debug? Never read EWRAM_DATA struct UnusedControllerStruct gUnusedControllerStruct = {}; // Debug? Unused code that writes to it, never read static EWRAM_DATA u8 sBattleBuffersTransferData[0x100] = {}; -// this file's funcionts static void CreateTasksForSendRecvLinkBuffers(void); static void InitLinkBtlControllers(void); static void InitSinglePlayerBtlControllers(void); @@ -46,11 +45,11 @@ void SetUpBattleVarsAndBirchZigzagoon(void) { s32 i; - gBattleMainFunc = nullsub_20; + gBattleMainFunc = BeginBattleIntroDummy; for (i = 0; i < MAX_BATTLERS_COUNT; i++) { - gBattlerControllerFuncs[i] = nullsub_21; + gBattlerControllerFuncs[i] = BattleControllerDummy; gBattlerPositions[i] = 0xFF; gActionSelectionCursor[i] = 0; gMoveSelectionCursor[i] = 0; @@ -71,18 +70,19 @@ void SetUpBattleVarsAndBirchZigzagoon(void) SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &i); } - gUnknown_02022FF4 = 0; - gUnknown_0202428C = 0; + // Below are never read + gUnusedFirstBattleVar1 = 0; + gUnusedFirstBattleVar2 = 0; } -void sub_8032768(void) +void InitBattleControllers(void) { s32 i; if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) - sub_8184DA4(1); + RecordedBattle_Init(B_RECORD_MODE_RECORDING); else - sub_8184DA4(2); + RecordedBattle_Init(B_RECORD_MODE_PLAYBACK); if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) RecordedBattle_SaveParties(); @@ -703,7 +703,7 @@ static void CreateTasksForSendRecvLinkBuffers(void) gTasks[sLinkReceiveTaskId].data[14] = 0; gTasks[sLinkReceiveTaskId].data[15] = 0; - sUnknown_02022D0A = 0; + sUnused = 0; } enum @@ -829,7 +829,7 @@ static void Task_HandleSendLinkBuffersData(u8 taskId) } } -void sub_8033648(void) +void TryReceiveLinkBattleData(void) { u8 i; s32 j; @@ -846,9 +846,9 @@ void sub_8033648(void) recvBuffer = (u8 *)gBlockRecvBuffer[i]; { u8 *dest, *src; - u16 r6 = gBlockRecvBuffer[i][2]; + u16 dataSize = gBlockRecvBuffer[i][2]; - if (gTasks[sLinkReceiveTaskId].data[14] + 9 + r6 > 0x1000) + if (gTasks[sLinkReceiveTaskId].data[14] + 9 + dataSize > 0x1000) { gTasks[sLinkReceiveTaskId].data[12] = gTasks[sLinkReceiveTaskId].data[14]; gTasks[sLinkReceiveTaskId].data[14] = 0; @@ -857,10 +857,10 @@ void sub_8033648(void) dest = &gLinkBattleRecvBuffer[gTasks[sLinkReceiveTaskId].data[14]]; src = recvBuffer; - for (j = 0; j < r6 + 8; j++) + for (j = 0; j < dataSize + 8; j++) dest[j] = src[j]; - gTasks[sLinkReceiveTaskId].data[14] = gTasks[sLinkReceiveTaskId].data[14] + r6 + 8; + gTasks[sLinkReceiveTaskId].data[14] = gTasks[sLinkReceiveTaskId].data[14] + dataSize + 8; } } } @@ -891,7 +891,7 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId) return; memcpy(gBattleResources->bufferA[battlerId], &gLinkBattleRecvBuffer[gTasks[taskId].data[15] + LINK_BUFF_DATA], blockSize); - sub_803F850(battlerId); + MarkBattlerReceivedLinkData(battlerId); if (!(gBattleTypeFlags & BATTLE_TYPE_IS_MASTER)) { @@ -1153,12 +1153,14 @@ void BtlController_EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitUnknownYesNoBox(u8 bufferId) +// Only used by the forfeit prompt in the Battle Frontier +// For other Yes/No boxes in battle, see Cmd_yesnobox +void BtlController_EmitYesNoBox(u8 bufferId) { - sBattleBuffersTransferData[0] = CONTROLLER_UNKNOWNYESNOBOX; - sBattleBuffersTransferData[1] = CONTROLLER_UNKNOWNYESNOBOX; - sBattleBuffersTransferData[2] = CONTROLLER_UNKNOWNYESNOBOX; - sBattleBuffersTransferData[3] = CONTROLLER_UNKNOWNYESNOBOX; + sBattleBuffersTransferData[0] = CONTROLLER_YESNOBOX; + sBattleBuffersTransferData[1] = CONTROLLER_YESNOBOX; + sBattleBuffersTransferData[2] = CONTROLLER_YESNOBOX; + sBattleBuffersTransferData[3] = CONTROLLER_YESNOBOX; PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } @@ -1446,13 +1448,13 @@ void BtlController_EmitIntroTrainerBallThrow(u8 bufferId) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2) +void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 flags) { s32 i; sBattleBuffersTransferData[0] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; - sBattleBuffersTransferData[1] = arg2 & 0x7F; - sBattleBuffersTransferData[2] = (arg2 & 0x80) >> 7; + sBattleBuffersTransferData[1] = flags & 0x7F; + sBattleBuffersTransferData[2] = (flags & 0x80) >> 7; // If true, skip delay after drawing. True during intro sBattleBuffersTransferData[3] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; for (i = 0; i < (s32)(sizeof(struct HpAndStatus) * PARTY_SIZE); i++) sBattleBuffersTransferData[4 + i] = *(i + (u8*)(hpAndStatus)); @@ -1495,14 +1497,14 @@ void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2) +void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 record) { - bool8 arg2_ = arg2; + bool8 record_ = record; sBattleBuffersTransferData[0] = CONTROLLER_LINKSTANDBYMSG; sBattleBuffersTransferData[1] = arg1; - if (arg2_) - sBattleBuffersTransferData[3] = sBattleBuffersTransferData[2] = sub_81850DC(&sBattleBuffersTransferData[4]); + if (record_) + sBattleBuffersTransferData[3] = sBattleBuffersTransferData[2] = RecordedBattle_BufferNewBattlerData(&sBattleBuffersTransferData[4]); else sBattleBuffersTransferData[3] = sBattleBuffersTransferData[2] = 0; @@ -1516,13 +1518,13 @@ void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2); } -void BtlController_EmitCmd55(u8 bufferId, u8 battleOutcome) +void BtlController_EmitEndLinkBattle(u8 bufferId, u8 battleOutcome) { - sBattleBuffersTransferData[0] = CONTROLLER_55; + sBattleBuffersTransferData[0] = CONTROLLER_ENDLINKBATTLE; sBattleBuffersTransferData[1] = battleOutcome; sBattleBuffersTransferData[2] = gSaveBlock2Ptr->frontier.disableRecordBattle; sBattleBuffersTransferData[3] = gSaveBlock2Ptr->frontier.disableRecordBattle; - sBattleBuffersTransferData[5] = sBattleBuffersTransferData[4] = sub_81850DC(&sBattleBuffersTransferData[6]); + sBattleBuffersTransferData[5] = sBattleBuffersTransferData[4] = RecordedBattle_BufferNewBattlerData(&sBattleBuffersTransferData[6]); PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sBattleBuffersTransferData[4] + 6); } diff --git a/src/battle_debug.c b/src/battle_debug.c index 05e6c9ef2..461f84158 100644 --- a/src/battle_debug.c +++ b/src/battle_debug.c @@ -1171,7 +1171,7 @@ static void PrintSecondaryEntries(struct BattleDebugMenu *data) static void DestroyModifyArrows(struct BattleDebugMenu *data) { - FreeSpritePaletteByTag(gSpritePalette_RtcArrow.tag); + FreeSpritePaletteByTag(gSpritePalette_Arrow.tag); if (data->modifyArrows.arrowSpriteId[0] != 0xFF) DestroySprite(&gSprites[data->modifyArrows.arrowSpriteId[0]]); if (data->modifyArrows.arrowSpriteId[1] != 0xFF) @@ -1440,9 +1440,9 @@ static u8 *GetSideStatusValue(struct BattleDebugMenu *data, bool32 changeStatus, static void SetUpModifyArrows(struct BattleDebugMenu *data) { - LoadSpritePalette(&gSpritePalette_RtcArrow); - data->modifyArrows.arrowSpriteId[0] = CreateSprite(&gSpriteTemplate_RtcArrow, 207, 12, 0); - data->modifyArrows.arrowSpriteId[1] = CreateSprite(&gSpriteTemplate_RtcArrow, 207, 36, 0); + LoadSpritePalette(&gSpritePalette_Arrow); + data->modifyArrows.arrowSpriteId[0] = CreateSprite(&gSpriteTemplate_Arrow, 207, 12, 0); + data->modifyArrows.arrowSpriteId[1] = CreateSprite(&gSpriteTemplate_Arrow, 207, 36, 0); gSprites[data->modifyArrows.arrowSpriteId[1]].animNum = 1; switch (data->currentMainListItemId) { diff --git a/src/battle_dome.c b/src/battle_dome.c index 7b0c2b92c..1a1127ea9 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -3031,7 +3031,7 @@ static void Task_ShowTourneyInfoCard(u8 taskId) SetVBlankCallback(VblankCb_TourneyInfoCard); sInfoCard = AllocZeroed(sizeof(*sInfoCard)); for (i = 0; i < NUM_INFOCARD_SPRITES; i++) - sInfoCard->spriteIds[i] = 0xFF; + sInfoCard->spriteIds[i] = SPRITE_NONE; LoadMonIconPalettes(); i = CreateTask(Task_HandleInfoCardInput, 0); gTasks[i].data[0] = 0; @@ -3096,7 +3096,7 @@ static void SpriteCb_TrainerIconCardScrollUp(struct Sprite *sprite) { if (sprite->pos1.y >= 192) { - sInfoCard->spriteIds[sprite->data[2]] = 0xFF; + sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE; FreeAndDestroyTrainerPicSprite(sprite->data[3]); } } @@ -3116,7 +3116,7 @@ static void SpriteCb_TrainerIconCardScrollDown(struct Sprite *sprite) { if (sprite->pos1.y <= -32) { - sInfoCard->spriteIds[sprite->data[2]] = 0xFF; + sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE; FreeAndDestroyTrainerPicSprite(sprite->data[3]); } } @@ -3136,7 +3136,7 @@ static void SpriteCb_TrainerIconCardScrollLeft(struct Sprite *sprite) { if (sprite->pos1.x >= 272) { - sInfoCard->spriteIds[sprite->data[2]] = 0xFF; + sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE; FreeAndDestroyTrainerPicSprite(sprite->data[3]); } } @@ -3156,7 +3156,7 @@ static void SpriteCb_TrainerIconCardScrollRight(struct Sprite *sprite) { if (sprite->pos1.x <= -32) { - sInfoCard->spriteIds[sprite->data[2]] = 0xFF; + sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE; FreeAndDestroyTrainerPicSprite(sprite->data[3]); } } @@ -3186,7 +3186,7 @@ static void SpriteCb_MonIconCardScrollUp(struct Sprite *sprite) { if (sprite->pos1.y >= 176) { - sInfoCard->spriteIds[sprite->data[2]] = 0xFF; + sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE; FreeAndDestroyMonIconSprite(sprite); } } @@ -3208,7 +3208,7 @@ static void SpriteCb_MonIconCardScrollDown(struct Sprite *sprite) { if (sprite->pos1.y <= -16) { - sInfoCard->spriteIds[sprite->data[2]] = 0xFF; + sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE; FreeAndDestroyMonIconSprite(sprite); } } @@ -3230,7 +3230,7 @@ static void SpriteCb_MonIconCardScrollLeft(struct Sprite *sprite) { if (sprite->pos1.x >= 256) { - sInfoCard->spriteIds[sprite->data[2]] = 0xFF; + sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE; FreeAndDestroyMonIconSprite(sprite); } } @@ -3252,7 +3252,7 @@ static void SpriteCb_MonIconCardScrollRight(struct Sprite *sprite) { if (sprite->pos1.x <= -16) { - sInfoCard->spriteIds[sprite->data[2]] = 0xFF; + sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE; FreeAndDestroyMonIconSprite(sprite); } } @@ -3384,7 +3384,7 @@ static void Task_HandleInfoCardInput(u8 taskId) case STATE_FADE_IN: if (!gPaletteFade.active) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); gTasks[taskId].tState = STATE_WAIT_FADE; } break; @@ -3397,7 +3397,7 @@ static void Task_HandleInfoCardInput(u8 taskId) switch (i) { case INFOCARD_INPUT_AB: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].tState = STATE_CLOSE_CARD; break; case TRAINERCARD_INPUT_UP ... TRAINERCARD_INPUT_RIGHT: @@ -3491,7 +3491,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (i < 2) { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollUp; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; @@ -3502,7 +3502,7 @@ static void Task_HandleInfoCardInput(u8 taskId) } else { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollUp; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; @@ -3515,7 +3515,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (i < 10) { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollUp; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; @@ -3526,7 +3526,7 @@ static void Task_HandleInfoCardInput(u8 taskId) } else { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollUp; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; @@ -3607,7 +3607,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (i < 2) { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollDown; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; @@ -3618,7 +3618,7 @@ static void Task_HandleInfoCardInput(u8 taskId) } else { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollDown; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; @@ -3631,7 +3631,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (i < 10) { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollDown; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; @@ -3642,7 +3642,7 @@ static void Task_HandleInfoCardInput(u8 taskId) } else { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollDown; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; @@ -3690,7 +3690,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (i < 2) { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; @@ -3701,7 +3701,7 @@ static void Task_HandleInfoCardInput(u8 taskId) } else { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; @@ -3714,7 +3714,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (i < 10) { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; @@ -3725,7 +3725,7 @@ static void Task_HandleInfoCardInput(u8 taskId) } else { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; @@ -3773,7 +3773,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (i < 2) { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; @@ -3784,7 +3784,7 @@ static void Task_HandleInfoCardInput(u8 taskId) } else { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; @@ -3797,7 +3797,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (i < 10) { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; @@ -3808,7 +3808,7 @@ static void Task_HandleInfoCardInput(u8 taskId) } else { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; @@ -3854,7 +3854,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (i < 2) { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; @@ -3865,7 +3865,7 @@ static void Task_HandleInfoCardInput(u8 taskId) } else { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; @@ -3878,7 +3878,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (i < 10) { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; @@ -3889,7 +3889,7 @@ static void Task_HandleInfoCardInput(u8 taskId) } else { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; @@ -3937,7 +3937,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (i < 2) { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; @@ -3948,7 +3948,7 @@ static void Task_HandleInfoCardInput(u8 taskId) } else { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; @@ -3961,7 +3961,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (i < 10) { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; @@ -3972,7 +3972,7 @@ static void Task_HandleInfoCardInput(u8 taskId) } else { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) { gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; @@ -4042,12 +4042,12 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (i < 2) { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) FreeAndDestroyTrainerPicSprite(sInfoCard->spriteIds[i]); } else { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) FreeAndDestroyMonIconSprite(&gSprites[sInfoCard->spriteIds[i]]); } } @@ -4055,12 +4055,12 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (i < 10) { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) FreeAndDestroyTrainerPicSprite(sInfoCard->spriteIds[i]); } else { - if (sInfoCard->spriteIds[i] != 0xFF) + if (sInfoCard->spriteIds[i] != SPRITE_NONE) FreeAndDestroyMonIconSprite(&gSprites[sInfoCard->spriteIds[i]]); } } @@ -4936,7 +4936,7 @@ static void Task_HandleTourneyTreeInput(u8 taskId) case STATE_FADE_IN: if (!gPaletteFade.active) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); gTasks[taskId].tState = STATE_WAIT_FADE; StartSpriteAnim(&gSprites[spriteId], 1); } @@ -4950,17 +4950,17 @@ static void Task_HandleTourneyTreeInput(u8 taskId) { case TOURNEY_TREE_SELECTED_CLOSE: default: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].tState = STATE_CLOSE_TOURNEY_TREE; break; case TOURNEY_TREE_NO_SELECTION: break; case TOURNEY_TREE_SELECTED_TRAINER: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].tState = STATE_SHOW_INFOCARD_TRAINER; break; case TOURNEY_TREE_SELECTED_MATCH: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].tState = STATE_SHOW_INFOCARD_MATCH; break; } @@ -5499,7 +5499,7 @@ static void Task_HandleStaticTourneyTreeInput(u8 taskId) switch (gTasks[taskId].tState) { case STATE_FADE_IN: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); gTasks[taskId].tState = STATE_SHOW_RESULTS; break; case STATE_SHOW_RESULTS: @@ -5549,7 +5549,7 @@ static void Task_HandleStaticTourneyTreeInput(u8 taskId) case STATE_WAIT_FOR_INPUT: if (JOY_NEW(A_BUTTON | B_BUTTON)) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].tState = STATE_CLOSE_TOURNEY_TREE; } break; @@ -5764,6 +5764,8 @@ static void InitRandomTourneyTreeResults(void) int monTypesBits; int trainerId; int monId; + int zero1; + int zero2; u8 lvlMode; u16 *statSums; int *statValues; @@ -5779,12 +5781,11 @@ static void InitRandomTourneyTreeResults(void) statValues = AllocZeroed(sizeof(int) * NUM_STATS); lvlMode = gSaveBlock2Ptr->frontier.lvlMode; gSaveBlock2Ptr->frontier.lvlMode = FRONTIER_LVL_50; - // This one, I'd like to call a 'C fakematching'. - { - u8 one; - gSaveBlock2Ptr->frontier.domeLvlMode = (one = 1); - gSaveBlock2Ptr->frontier.domeBattleMode = one; - } + zero1 = 0; + zero2 = 0; + + gSaveBlock2Ptr->frontier.domeLvlMode = zero1 + 1; + gSaveBlock2Ptr->frontier.domeBattleMode = zero2 + 1; for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++) { diff --git a/src/battle_factory.c b/src/battle_factory.c index 9ba13b0d3..72772929a 100644 --- a/src/battle_factory.c +++ b/src/battle_factory.c @@ -592,39 +592,58 @@ static void GenerateInitialRentalMons(void) } } +// Determines if the upcoming opponent has a single most-common +// type in its party. If there are two different types that are +// tied, then the opponent is deemed to have no preferred type, +// and NUMBER_OF_MON_TYPES is the result. static void GetOpponentMostCommonMonType(void) { u8 i; - u8 typesCount[NUMBER_OF_MON_TYPES]; - u8 usedType[2]; + u8 typeCounts[NUMBER_OF_MON_TYPES]; + u8 mostCommonTypes[2]; gFacilityTrainerMons = gBattleFrontierMons; - for (i = 0; i < NUMBER_OF_MON_TYPES; i++) - typesCount[i] = 0; + + // Count the number of times each type occurs in the opponent's party. + for (i = TYPE_NORMAL; i < NUMBER_OF_MON_TYPES; i++) + typeCounts[i] = 0; for (i = 0; i < FRONTIER_PARTY_SIZE; i++) { u32 species = gFacilityTrainerMons[gFrontierTempParty[i]].species; - - typesCount[gBaseStats[species].type1]++; + typeCounts[gBaseStats[species].type1]++; if (gBaseStats[species].type1 != gBaseStats[species].type2) - typesCount[gBaseStats[species].type2]++; + typeCounts[gBaseStats[species].type2]++; } - usedType[0] = 0; - usedType[1] = 0; - for (i = 1; i < NUMBER_OF_MON_TYPES; i++) + // Determine which are the two most-common types. + // The second most-common type is only updated if + // its count is equal to the most-common type. + mostCommonTypes[0] = TYPE_NORMAL; + mostCommonTypes[1] = TYPE_NORMAL; + for (i = TYPE_FIGHTING; i < NUMBER_OF_MON_TYPES; i++) { - if (typesCount[usedType[0]] < typesCount[i]) - usedType[0] = i; - else if (typesCount[usedType[0]] == typesCount[i]) - usedType[1] = i; + if (typeCounts[mostCommonTypes[0]] < typeCounts[i]) + mostCommonTypes[0] = i; + else if (typeCounts[mostCommonTypes[0]] == typeCounts[i]) + mostCommonTypes[1] = i; } - gSpecialVar_Result = gSpecialVar_Result; // Needed to match. Don't ask me why. - if (typesCount[usedType[0]] != 0 && (typesCount[usedType[0]] > typesCount[usedType[1]] || usedType[0] == usedType[1])) - gSpecialVar_Result = usedType[0]; + if (typeCounts[mostCommonTypes[0]] != 0) + { + // The most-common type must be strictly greater than + // the second-most-common type, or the top two must be + // the same type. + if (typeCounts[mostCommonTypes[0]] > typeCounts[mostCommonTypes[1]]) + gSpecialVar_Result = mostCommonTypes[0]; + else if (mostCommonTypes[0] == mostCommonTypes[1]) + gSpecialVar_Result = mostCommonTypes[0]; + else + gSpecialVar_Result = NUMBER_OF_MON_TYPES; + } else + { gSpecialVar_Result = NUMBER_OF_MON_TYPES; + } } static void GetOpponentBattleStyle(void) diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c index 86e3b0233..8c056da1b 100644 --- a/src/battle_factory_screen.c +++ b/src/battle_factory_screen.c @@ -1203,7 +1203,7 @@ static void CB2_InitSelectScreen(void) ShowBg(0); ShowBg(1); SetVBlankCallback(VBlankCB_SelectScreen); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_1D_MAP); #ifdef UBFIX if (sFactorySelectScreen && sFactorySelectScreen->fromSummaryScreen) @@ -1451,7 +1451,7 @@ static void Select_Task_OpenSummaryScreen(u8 taskId) { case STATE_SUMMARY_FADE: gPlttBufferUnfaded[228] = gPlttBufferFaded[228]; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].tState = STATE_SUMMARY_CLEAN; break; case STATE_SUMMARY_CLEAN: @@ -1489,7 +1489,7 @@ static void Select_Task_Exit(u8 taskId) switch (gTasks[taskId].tState) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].tState++; break; case 1: @@ -2369,7 +2369,7 @@ static void Swap_Task_OpenSummaryScreen(u8 taskId) switch (gTasks[taskId].tState) { case STATE_SUMMARY_FADE: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].tState = STATE_SUMMARY_CLEAN; break; case STATE_SUMMARY_CLEAN: @@ -2425,7 +2425,7 @@ static void Swap_Task_Exit(u8 taskId) gTasks[taskId].tState++; break; case 2: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].tState++; break; case 3: @@ -3381,7 +3381,7 @@ static void CB2_InitSwapScreen(void) gMain.state++; break; case 14: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); ShowBg(0); ShowBg(1); diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 4a4237397..72547d8cb 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -40,7 +40,7 @@ extern const struct SpriteTemplate gSpriteTemplate_EnemyShadow; // this file's functions static u8 GetBattlePalaceMoveGroup(u16 move); static u16 GetBattlePalaceTarget(void); -static void sub_805D7EC(struct Sprite *sprite); +static void SpriteCB_TrainerSlideVertical(struct Sprite *sprite); static bool8 ShouldAnimBeDoneRegardlessOfSubsitute(u8 animId); static void Task_ClearBitWhenBattleTableAnimDone(u8 taskId); static void Task_ClearBitWhenSpecialAnimDone(u8 taskId); @@ -337,7 +337,8 @@ static u16 GetBattlePalaceTarget(void) return (gActiveBattler ^ BIT_SIDE) << 8; } -void sub_805D714(struct Sprite *sprite) +// Wait for the pokemon to finish appearing out from the pokeball on send out +void SpriteCB_WaitForBattlerBallReleaseAnim(struct Sprite *sprite) { u8 spriteId = sprite->data[1]; @@ -357,9 +358,9 @@ void sub_805D714(struct Sprite *sprite) } } -void sub_805D770(struct Sprite *sprite, bool8 arg1) +static void UnusedDoBattleSpriteAffineAnim(struct Sprite *sprite, bool8 arg1) { - sprite->animPaused = 1; + sprite->animPaused = TRUE; sprite->callback = SpriteCallbackDummy; if (!arg1) @@ -370,28 +371,33 @@ void sub_805D770(struct Sprite *sprite, bool8 arg1) AnimateSprite(sprite); } -void sub_805D7AC(struct Sprite *sprite) +#define sSpeedX data[0] + +void SpriteCB_TrainerSlideIn(struct Sprite *sprite) { if (!(gIntroSlideFlags & 1)) { - sprite->pos2.x += sprite->data[0]; + sprite->pos2.x += sprite->sSpeedX; if (sprite->pos2.x == 0) { if (sprite->pos2.y != 0) - sprite->callback = sub_805D7EC; + sprite->callback = SpriteCB_TrainerSlideVertical; else sprite->callback = SpriteCallbackDummy; } } } -static void sub_805D7EC(struct Sprite *sprite) +// Slide up to 0 if necessary (used by multi battle intro) +static void SpriteCB_TrainerSlideVertical(struct Sprite *sprite) { sprite->pos2.y -= 2; if (sprite->pos2.y == 0) sprite->callback = SpriteCallbackDummy; } +#undef sSpeedX + void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status) { gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive = 1; @@ -532,14 +538,15 @@ bool8 IsMoveWithoutAnimation(u16 moveId, u8 animationTurn) return FALSE; } -bool8 mplay_80342A4(u8 battlerId) +// Check if SE has finished or 30 calls, whichever comes first +bool8 IsBattleSEPlaying(u8 battlerId) { u8 zero = 0; if (IsSEPlaying()) { - gBattleSpritesDataPtr->healthBoxesData[battlerId].field_8++; - if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_8 < 30) + gBattleSpritesDataPtr->healthBoxesData[battlerId].soundTimer++; + if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].soundTimer < 30) return TRUE; m4aMPlayStop(&gMPlayInfo_SE1); @@ -547,10 +554,11 @@ bool8 mplay_80342A4(u8 battlerId) } if (zero == 0) { - gBattleSpritesDataPtr->healthBoxesData[battlerId].field_8 = 0; + gBattleSpritesDataPtr->healthBoxesData[battlerId].soundTimer = 0; return FALSE; } + // Never reached return TRUE; } @@ -584,7 +592,7 @@ static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 op } else { - if (sub_80688F8(1, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE) + if (ShouldIgnoreDeoxysForm(1, battlerId) == TRUE || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE) { HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species], gMonSpritesGfxPtr->sprites.ptr[position], @@ -634,7 +642,7 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId) BattleLoadMonSpriteGfx(mon, battlerId, FALSE); } -void nullsub_24(u16 species) +void BattleGfxSfxDummy2(u16 species) { } @@ -657,7 +665,7 @@ void DecompressTrainerBackPic(u16 backPicId, u8 battlerId) 0x100 + 16 * battlerId, 0x20); } -void nullsub_25(u8 arg0) +void BattleGfxSfxDummy3(u8 gender) { } @@ -1077,7 +1085,7 @@ void HandleBattleLowHpMusicChange(void) } } -void sub_805EB9C(u8 affineMode) +void SetBattlerSpriteAffineMode(u8 affineMode) { s32 i; @@ -1213,7 +1221,7 @@ void AllocateMonSpritesGfx(void) for (i = 0; i < MAX_BATTLERS_COUNT; i++) { gMonSpritesGfxPtr->sprites.ptr[i] = gMonSpritesGfxPtr->firstDecompressed + (i * 0x2000); - *(gMonSpritesGfxPtr->templates + i) = gUnknown_08329D98[i]; + *(gMonSpritesGfxPtr->templates + i) = gBattlerSpriteTemplates[i]; for (j = 0; j < 4; j++) { diff --git a/src/battle_intro.c b/src/battle_intro.c index 95af82432..1447ee85c 100644 --- a/src/battle_intro.c +++ b/src/battle_intro.c @@ -13,8 +13,8 @@ static EWRAM_DATA u16 sBgCnt = 0; -extern const u8 gUnknown_0859741A[]; -extern const u8 gUnknown_0859741E[]; +extern const u8 gBattleAnimBgCntSet[]; +extern const u8 gBattleAnimBgCntGet[]; static void BattleIntroSlide1(u8); static void BattleIntroSlide2(u8); @@ -24,23 +24,23 @@ static void BattleIntroSlidePartner(u8); static const TaskFunc sBattleIntroSlideFuncs[] = { - BattleIntroSlide1, // BATTLE_TERRAIN_GRASS - BattleIntroSlide1, // BATTLE_TERRAIN_LONG_GRASS - BattleIntroSlide2, // BATTLE_TERRAIN_SAND - BattleIntroSlide2, // BATTLE_TERRAIN_UNDERWATER - BattleIntroSlide2, // BATTLE_TERRAIN_WATER - BattleIntroSlide1, // BATTLE_TERRAIN_POND - BattleIntroSlide1, // BATTLE_TERRAIN_MOUNTAIN - BattleIntroSlide1, // BATTLE_TERRAIN_CAVE - BattleIntroSlide3, // BATTLE_TERRAIN_BUILDING - BattleIntroSlide3, // BATTLE_TERRAIN_PLAIN + [BATTLE_TERRAIN_GRASS] = BattleIntroSlide1, + [BATTLE_TERRAIN_LONG_GRASS] = BattleIntroSlide1, + [BATTLE_TERRAIN_SAND] = BattleIntroSlide2, + [BATTLE_TERRAIN_UNDERWATER] = BattleIntroSlide2, + [BATTLE_TERRAIN_WATER] = BattleIntroSlide2, + [BATTLE_TERRAIN_POND] = BattleIntroSlide1, + [BATTLE_TERRAIN_MOUNTAIN] = BattleIntroSlide1, + [BATTLE_TERRAIN_CAVE] = BattleIntroSlide1, + [BATTLE_TERRAIN_BUILDING] = BattleIntroSlide3, + [BATTLE_TERRAIN_PLAIN] = BattleIntroSlide3, }; void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value) { if (bgId < 4) { - sBgCnt = GetGpuReg(gUnknown_0859741A[bgId]); + sBgCnt = GetGpuReg(gBattleAnimBgCntSet[bgId]); switch (attributeId) { case BG_ANIM_SCREEN_SIZE: @@ -66,7 +66,7 @@ void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value) break; } - SetGpuReg(gUnknown_0859741A[bgId], sBgCnt); + SetGpuReg(gBattleAnimBgCntSet[bgId], sBgCnt); } } @@ -76,7 +76,7 @@ int GetAnimBgAttribute(u8 bgId, u8 attributeId) if (bgId < 4) { - bgCnt = GetGpuReg(gUnknown_0859741E[bgId]); + bgCnt = GetGpuReg(gBattleAnimBgCntGet[bgId]); switch (attributeId) { case BG_ANIM_SCREEN_SIZE: @@ -99,6 +99,9 @@ int GetAnimBgAttribute(u8 bgId, u8 attributeId) return 0; } +#define tState data[0] +#define tTerrain data[1] + void HandleIntroSlide(u8 terrain) { u8 taskId; @@ -125,8 +128,8 @@ void HandleIntroSlide(u8 terrain) taskId = CreateTask(sBattleIntroSlideFuncs[terrain], 0); } - gTasks[taskId].data[0] = 0; - gTasks[taskId].data[1] = terrain; + gTasks[taskId].tState = 0; + gTasks[taskId].tTerrain = terrain; gTasks[taskId].data[2] = 0; gTasks[taskId].data[3] = 0; gTasks[taskId].data[4] = 0; @@ -134,7 +137,7 @@ void HandleIntroSlide(u8 terrain) gTasks[taskId].data[6] = 0; } -void sub_811828C(u8 taskId) +static void BattleIntroSlideEnd(u8 taskId) { DestroyTask(taskId); gBattle_BG1_X = 0; @@ -153,24 +156,24 @@ static void BattleIntroSlide1(u8 taskId) int i; gBattle_BG1_X += 6; - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: if (gBattleTypeFlags & BATTLE_TYPE_LINK) { gTasks[taskId].data[2] = 16; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } else { gTasks[taskId].data[2] = 1; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } break; case 1: if (--gTasks[taskId].data[2] == 0) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); } break; @@ -178,7 +181,7 @@ static void BattleIntroSlide1(u8 taskId) gBattle_WIN0V -= 0xFF; if ((gBattle_WIN0V & 0xFF00) == 0x3000) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; gTasks[taskId].data[2] = 240; gTasks[taskId].data[3] = 32; gIntroSlideFlags &= ~1; @@ -191,7 +194,7 @@ static void BattleIntroSlide1(u8 taskId) } else { - if (gTasks[taskId].data[1] == 1) + if (gTasks[taskId].tTerrain == BATTLE_TERRAIN_LONG_GRASS) { if (gBattle_BG1_Y != 0xFFB0) gBattle_BG1_Y -= 2; @@ -219,7 +222,7 @@ static void BattleIntroSlide1(u8 taskId) if (!gTasks[taskId].data[2]) { gScanlineEffect.state = 3; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; CpuFill32(0, (void *)BG_SCREEN_ADDR(28), BG_SCREEN_SIZE); SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0); SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0); @@ -228,7 +231,7 @@ static void BattleIntroSlide1(u8 taskId) } break; case 4: - sub_811828C(taskId); + BattleIntroSlideEnd(taskId); break; } } @@ -237,18 +240,18 @@ static void BattleIntroSlide2(u8 taskId) { int i; - switch (gTasks[taskId].data[1]) + switch (gTasks[taskId].tTerrain) { - case 2: - case 4: + case BATTLE_TERRAIN_SAND: + case BATTLE_TERRAIN_WATER: gBattle_BG1_X += 8; break; - case 3: + case BATTLE_TERRAIN_UNDERWATER: gBattle_BG1_X += 6; break; } - if (gTasks[taskId].data[1] == 4) + if (gTasks[taskId].tTerrain == BATTLE_TERRAIN_WATER) { gBattle_BG1_Y = Cos2(gTasks[taskId].data[6]) / 512 - 8; if (gTasks[taskId].data[6] < 180) @@ -260,25 +263,25 @@ static void BattleIntroSlide2(u8 taskId) gTasks[taskId].data[6] = 0; } - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: gTasks[taskId].data[4] = 16; if (gBattleTypeFlags & BATTLE_TYPE_LINK) { gTasks[taskId].data[2] = 16; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } else { gTasks[taskId].data[2] = 1; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } break; case 1: if (--gTasks[taskId].data[2] == 0) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); } break; @@ -286,7 +289,7 @@ static void BattleIntroSlide2(u8 taskId) gBattle_WIN0V -= 0xFF; if ((gBattle_WIN0V & 0xFF00) == 0x3000) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; gTasks[taskId].data[2] = 240; gTasks[taskId].data[3] = 32; gTasks[taskId].data[5] = 1; @@ -328,7 +331,7 @@ static void BattleIntroSlide2(u8 taskId) if (!gTasks[taskId].data[2]) { gScanlineEffect.state = 3; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; CpuFill32(0, (void *)BG_SCREEN_ADDR(28), BG_SCREEN_SIZE); SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0); SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0); @@ -337,11 +340,11 @@ static void BattleIntroSlide2(u8 taskId) } break; case 4: - sub_811828C(taskId); + BattleIntroSlideEnd(taskId); break; } - if (gTasks[taskId].data[0] != 4) + if (gTasks[taskId].tState != 4) SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[4], 0)); } @@ -350,7 +353,7 @@ static void BattleIntroSlide3(u8 taskId) int i; gBattle_BG1_X += 8; - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ); @@ -360,18 +363,18 @@ static void BattleIntroSlide3(u8 taskId) if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) { gTasks[taskId].data[2] = 16; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } else { gTasks[taskId].data[2] = 1; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } break; case 1: if (--gTasks[taskId].data[2] == 0) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); } break; @@ -379,7 +382,7 @@ static void BattleIntroSlide3(u8 taskId) gBattle_WIN0V -= 0xFF; if ((gBattle_WIN0V & 0xFF00) == 0x3000) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; gTasks[taskId].data[2] = 240; gTasks[taskId].data[3] = 32; gTasks[taskId].data[5] = 1; @@ -416,7 +419,7 @@ static void BattleIntroSlide3(u8 taskId) if (!gTasks[taskId].data[2]) { gScanlineEffect.state = 3; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; CpuFill32(0, (void *)BG_SCREEN_ADDR(28), BG_SCREEN_SIZE); SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0); SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0); @@ -425,11 +428,11 @@ static void BattleIntroSlide3(u8 taskId) } break; case 4: - sub_811828C(taskId); + BattleIntroSlideEnd(taskId); break; } - if (gTasks[taskId].data[0] != 4) + if (gTasks[taskId].tState != 4) SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[4], 0)); } @@ -437,7 +440,7 @@ static void BattleIntroSlideLink(u8 taskId) { int i; - if (gTasks[taskId].data[0] > 1 && !gTasks[taskId].data[4]) + if (gTasks[taskId].tState > 1 && !gTasks[taskId].data[4]) { u16 var0 = gBattle_BG1_X & 0x8000; if (var0 || gBattle_BG1_X < 80) @@ -453,20 +456,20 @@ static void BattleIntroSlideLink(u8 taskId) } } - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: gTasks[taskId].data[2] = 32; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; break; case 1: if (--gTasks[taskId].data[2] == 0) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; gSprites[gBattleStruct->linkBattleVsSpriteId_V].oam.objMode = ST_OAM_OBJ_WINDOW; - gSprites[gBattleStruct->linkBattleVsSpriteId_V].callback = sub_8038B74; + gSprites[gBattleStruct->linkBattleVsSpriteId_V].callback = SpriteCB_VsLetterInit; gSprites[gBattleStruct->linkBattleVsSpriteId_S].oam.objMode = ST_OAM_OBJ_WINDOW; - gSprites[gBattleStruct->linkBattleVsSpriteId_S].callback = sub_8038B74; + gSprites[gBattleStruct->linkBattleVsSpriteId_S].callback = SpriteCB_VsLetterInit; SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR | WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2); } @@ -475,7 +478,7 @@ static void BattleIntroSlideLink(u8 taskId) gBattle_WIN0V -= 0xFF; if ((gBattle_WIN0V & 0xFF00) == 0x3000) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; gTasks[taskId].data[2] = 240; gTasks[taskId].data[3] = 32; gIntroSlideFlags &= ~1; @@ -498,7 +501,7 @@ static void BattleIntroSlideLink(u8 taskId) if (!gTasks[taskId].data[2]) { gScanlineEffect.state = 3; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0); SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0); SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(28) | BGCNT_TXT256x512); @@ -506,23 +509,23 @@ static void BattleIntroSlideLink(u8 taskId) } break; case 4: - sub_811828C(taskId); + BattleIntroSlideEnd(taskId); break; } } static void BattleIntroSlidePartner(u8 taskId) { - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: gTasks[taskId].data[2] = 1; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; break; case 1: if (--gTasks[taskId].data[2] == 0) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(2) | BGCNT_CHARBASE(2) | BGCNT_16COLOR | BGCNT_SCREENBASE(28) | BGCNT_TXT512x256); SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2) | BGCNT_CHARBASE(2) | BGCNT_16COLOR | BGCNT_SCREENBASE(30) | BGCNT_TXT512x256); SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) | DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJWIN_ON); @@ -540,7 +543,7 @@ static void BattleIntroSlidePartner(u8 taskId) if ((gBattle_WIN0V & 0xFF00) == 0x2000) { - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; gTasks[taskId].data[2] = 240; gIntroSlideFlags &= ~1; } @@ -555,7 +558,7 @@ static void BattleIntroSlidePartner(u8 taskId) gBattle_BG1_X = gTasks[taskId].data[2]; gBattle_BG2_X = -gTasks[taskId].data[2]; if (!gTasks[taskId].data[2]) - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; break; case 4: gBattle_BG0_Y += 2; @@ -572,11 +575,11 @@ static void BattleIntroSlidePartner(u8 taskId) SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(28) | BGCNT_TXT256x512); SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(30) | BGCNT_TXT512x256); gScanlineEffect.state = 3; - gTasks[taskId].data[0]++; + gTasks[taskId].tState++; } break; case 5: - sub_811828C(taskId); + BattleIntroSlideEnd(taskId); break; } } diff --git a/src/battle_main.c b/src/battle_main.c index 37c6c15fa..edd7d4190 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -69,9 +69,6 @@ extern const struct BgTemplate gBattleBgTemplates[]; extern const struct WindowTemplate *const gBattleWindowTemplates[]; // this file's functions -#if !defined(NONMATCHING) && MODERN -#define static -#endif static void CB2_InitBattleInternal(void); static void CB2_PreInitMultiBattle(void); static void CB2_PreInitIngamePlayerPartnerBattle(void); @@ -82,8 +79,8 @@ static void TryCorrectShedinjaLanguage(struct Pokemon *mon); static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum, bool8 firstTrainer); static void BattleMainCB1(void); static void sub_8038538(struct Sprite *sprite); -static void sub_8038F14(void); -static void sub_8038F34(void); +static void CB2_EndLinkBattle(void); +static void EndLinkBattleInSteps(void); static void sub_80392A8(void); static void sub_803937C(void); static void sub_803939C(void); @@ -94,7 +91,7 @@ static void sub_80398D0(struct Sprite *sprite); static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite); static void SpriteCb_BlinkVisible(struct Sprite *sprite); static void SpriteCallbackDummy_3(struct Sprite *sprite); -static void oac_poke_ally_(struct Sprite *sprite); +static void SpriteCB_BattleSpriteSlideLeft(struct Sprite *sprite); static void TurnValuesCleanUp(bool8 var0); static void SpriteCB_BounceEffect(struct Sprite *sprite); static void BattleStartClearSetData(void); @@ -138,7 +135,7 @@ EWRAM_DATA u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT] = {0}; EWRAM_DATA u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT] = {0}; EWRAM_DATA u32 gBattleTypeFlags = 0; EWRAM_DATA u8 gBattleTerrain = 0; -EWRAM_DATA u32 gUnknown_02022FF4 = 0; +EWRAM_DATA u32 gUnusedFirstBattleVar1 = 0; // Never read EWRAM_DATA struct UnknownPokemonStruct4 gMultiPartnerParty[MULTI_PARTY_SIZE] = {0}; EWRAM_DATA static struct UnknownPokemonStruct4* sMultiPartnerPartyBuffer = NULL; EWRAM_DATA u8 *gUnknown_0202305C = NULL; @@ -188,7 +185,7 @@ EWRAM_DATA u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u16 gMoveResultFlags = 0; EWRAM_DATA u32 gHitMarker = 0; EWRAM_DATA u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT] = {0}; -EWRAM_DATA u8 gUnknown_0202428C = 0; +EWRAM_DATA u8 gUnusedFirstBattleVar2 = 0; // Never read EWRAM_DATA u32 gSideStatuses[2] = {0}; EWRAM_DATA struct SideTimer gSideTimers[2] = {0}; EWRAM_DATA u32 gStatuses3[MAX_BATTLERS_COUNT] = {0}; @@ -220,8 +217,8 @@ EWRAM_DATA u32 gTransformedPersonalities[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u8 gPlayerDpadHoldFrames = 0; EWRAM_DATA struct BattleSpriteData *gBattleSpritesDataPtr = NULL; EWRAM_DATA struct MonSpritesGfx *gMonSpritesGfxPtr = NULL; -EWRAM_DATA struct BattleHealthboxInfo *gUnknown_020244D8 = NULL; -EWRAM_DATA struct BattleHealthboxInfo *gUnknown_020244DC = NULL; +EWRAM_DATA struct BattleHealthboxInfo *gBattleControllerOpponentHealthboxData = NULL; // Never read +EWRAM_DATA struct BattleHealthboxInfo *gBattleControllerOpponentFlankHealthboxData = NULL; // Never read EWRAM_DATA u16 gBattleMovePower = 0; EWRAM_DATA u16 gMoveToLearn = 0; EWRAM_DATA u8 gBattleMonForms[MAX_BATTLERS_COUNT] = {0}; @@ -242,7 +239,7 @@ void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; u8 gMultiUsePlayerCursor; u8 gNumberOfMovesToChoose; -u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT]; +u8 gBattleControllerData[MAX_BATTLERS_COUNT]; // Used by the battle controllers to store misc sprite/task IDs for each battler // rom const data static const struct ScanlineEffectParams sIntroScanlineParams16Bit = @@ -269,7 +266,7 @@ const struct SpriteTemplate gUnknown_0831AC88 = static const u8 sText_ShedinjaJpnName[] = _("ヌケニン"); // Nukenin -const struct OamData gOamData_831ACA8 = +const struct OamData gOamData_BattleSpriteOpponentSide = { .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, @@ -284,7 +281,7 @@ const struct OamData gOamData_831ACA8 = .affineParam = 0, }; -const struct OamData gOamData_831ACB0 = +const struct OamData gOamData_BattleSpritePlayerSide = { .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, @@ -446,7 +443,7 @@ void CB2_InitBattle(void) AllocateBattleResources(); AllocateBattleSpritesData(); AllocateMonSpritesGfx(); - sub_8185F84(); + RecordedBattle_ClearFrontierPassFlag(); if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { @@ -567,46 +564,52 @@ static void CB2_InitBattleInternal(void) gBattleCommunication[MULTIUSE_STATE] = 0; } -static void sub_8036A5C(void) -{ - u16 r6 = 0; - u16 species = 0; - u16 hp = 0; - u32 status = 0; - s32 i; - - for (i = 0; i < PARTY_SIZE; i++) - { - species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); - hp = GetMonData(&gPlayerParty[i], MON_DATA_HP); - status = GetMonData(&gPlayerParty[i], MON_DATA_STATUS); - - if (species == SPECIES_NONE) - continue; - if (species != SPECIES_EGG && hp != 0 && status == 0) - r6 |= 1 << i * 2; - - if (species == SPECIES_NONE) - continue; - if (hp != 0 && (species == SPECIES_EGG || status != 0)) - r6 |= 2 << i * 2; - - if (species == SPECIES_NONE) - continue; - if (species != SPECIES_EGG && hp == 0) - r6 |= 3 << i * 2; +#define BUFFER_PARTY_VS_SCREEN_STATUS(party, flags, i) \ + for ((i) = 0; (i) < PARTY_SIZE; (i)++) \ + { \ + u16 species = GetMonData(&(party)[(i)], MON_DATA_SPECIES2); \ + u16 hp = GetMonData(&(party)[(i)], MON_DATA_HP); \ + u32 status = GetMonData(&(party)[(i)], MON_DATA_STATUS); \ + \ + if (species == SPECIES_NONE) \ + continue; \ + \ + /* Is healthy mon? */ \ + if (species != SPECIES_EGG && hp != 0 && status == 0) \ + (flags) |= 1 << (i) * 2; \ + \ + if (species == SPECIES_NONE) /* Redundant */ \ + continue; \ + \ + /* Is Egg or statused? */ \ + if (hp != 0 && (species == SPECIES_EGG || status != 0)) \ + (flags) |= 2 << (i) * 2; \ + \ + if (species == SPECIES_NONE) /* Redundant */ \ + continue; \ + \ + /* Is fainted? */ \ + if (species != SPECIES_EGG && hp == 0) \ + (flags) |= 3 << (i) * 2; \ } - gBattleStruct->field_182 = r6; - *(&gBattleStruct->field_183) = r6 >> 8; - gBattleStruct->field_183 |= FlagGet(FLAG_SYS_FRONTIER_PASS) << 7; +// For Vs Screen at link battle start +static void BufferPartyVsScreenHealth_AtStart(void) +{ + u16 flags = 0; + s32 i; + + BUFFER_PARTY_VS_SCREEN_STATUS(gPlayerParty, flags, i); + gBattleStruct->multiBuffer.linkBattlerHeader.vsScreenHealthFlagsLo = flags; + *(&gBattleStruct->multiBuffer.linkBattlerHeader.vsScreenHealthFlagsHi) = flags >> 8; + gBattleStruct->multiBuffer.linkBattlerHeader.vsScreenHealthFlagsHi |= FlagGet(FLAG_SYS_FRONTIER_PASS) << 7; } static void SetPlayerBerryDataInBattleStruct(void) { s32 i; struct BattleStruct *battleStruct = gBattleStruct; - struct BattleEnigmaBerry *battleBerry = &battleStruct->battleEnigmaBerry; + struct BattleEnigmaBerry *battleBerry = &battleStruct->multiBuffer.linkBattlerHeader.battleEnigmaBerry; if (IsEnigmaBerryValid() == TRUE) { @@ -746,52 +749,56 @@ static void SetAllPlayersBerryData(void) } } -static void sub_8036EB8(u8 arg0, u8 arg1) +// This was inlined in Ruby/Sapphire +static void FindLinkBattleMaster(u8 numPlayers, u8 multiPlayerId) { - u8 var = 0; + u8 found = 0; - if (gBlockRecvBuffer[0][0] == 256) + // If player 1 is playing the minimum version, player 1 is master. + if (gBlockRecvBuffer[0][0] == 0x100) { - if (arg1 == 0) + if (multiPlayerId == 0) gBattleTypeFlags |= BATTLE_TYPE_IS_MASTER | BATTLE_TYPE_TRAINER; else gBattleTypeFlags |= BATTLE_TYPE_TRAINER; - var++; + found++; } - if (var == 0) + if (found == 0) { + // If multiple different versions are being used, player 1 is master. s32 i; - for (i = 0; i < arg0; i++) + for (i = 0; i < numPlayers; i++) { if (gBlockRecvBuffer[0][0] != gBlockRecvBuffer[i][0]) break; } - if (i == arg0) + if (i == numPlayers) { - if (arg1 == 0) + if (multiPlayerId == 0) gBattleTypeFlags |= BATTLE_TYPE_IS_MASTER | BATTLE_TYPE_TRAINER; else gBattleTypeFlags |= BATTLE_TYPE_TRAINER; - var++; + found++; } - if (var == 0) + if (found == 0) { - for (i = 0; i < arg0; i++) + // Lowest index player with the highest game version is master. + for (i = 0; i < numPlayers; i++) { - if (gBlockRecvBuffer[i][0] == 0x300) + if (gBlockRecvBuffer[i][0] == 0x300 && i != multiPlayerId) { - if (i != arg1 && i < arg1) + if (i < multiPlayerId) break; } - if (gBlockRecvBuffer[i][0] > 0x300 && i != arg1) + if (gBlockRecvBuffer[i][0] > 0x300 && i != multiPlayerId) break; } - if (i == arg0) + if (i == numPlayers) gBattleTypeFlags |= BATTLE_TYPE_IS_MASTER | BATTLE_TYPE_TRAINER; else gBattleTypeFlags |= BATTLE_TYPE_TRAINER; @@ -834,9 +841,10 @@ static void CB2_HandleStartBattle(void) { if (IsLinkTaskFinished()) { - *(&gBattleStruct->field_180) = 0; - *(&gBattleStruct->field_181) = 3; - sub_8036A5C(); + // 0x300 + *(&gBattleStruct->multiBuffer.linkBattlerHeader.versionSignatureLo) = 0; + *(&gBattleStruct->multiBuffer.linkBattlerHeader.versionSignatureHi) = 3; + BufferPartyVsScreenHealth_AtStart(); SetPlayerBerryDataInBattleStruct(); if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM) @@ -845,7 +853,7 @@ static void CB2_HandleStartBattle(void) gLinkPlayers[1].id = 1; } - SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32); + SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->multiBuffer.linkBattlerHeader, sizeof(gBattleStruct->multiBuffer.linkBattlerHeader)); gBattleCommunication[MULTIUSE_STATE] = 2; } if (gWirelessCommType) @@ -866,16 +874,16 @@ static void CB2_HandleStartBattle(void) u8 taskId; ResetBlockReceivedFlags(); - sub_8036EB8(2, playerMultiplayerId); + FindLinkBattleMaster(2, playerMultiplayerId); SetAllPlayersBerryData(); taskId = CreateTask(InitLinkBattleVsScreen, 0); gTasks[taskId].data[1] = 0x10E; gTasks[taskId].data[2] = 0x5A; gTasks[taskId].data[5] = 0; - gTasks[taskId].data[3] = gBattleStruct->field_182 | (gBattleStruct->field_183 << 8); + gTasks[taskId].data[3] = gBattleStruct->multiBuffer.linkBattlerHeader.vsScreenHealthFlagsLo | (gBattleStruct->multiBuffer.linkBattlerHeader.vsScreenHealthFlagsHi << 8); gTasks[taskId].data[4] = gBlockRecvBuffer[enemyMultiplayerId][1]; - sub_8185F90(gBlockRecvBuffer[playerMultiplayerId][1]); - sub_8185F90(gBlockRecvBuffer[enemyMultiplayerId][1]); + RecordedBattle_SetFrontierPassFlagFromHword(gBlockRecvBuffer[playerMultiplayerId][1]); + RecordedBattle_SetFrontierPassFlagFromHword(gBlockRecvBuffer[enemyMultiplayerId][1]); SetDeoxysStats(); gBattleCommunication[MULTIUSE_STATE]++; } @@ -932,7 +940,7 @@ static void CB2_HandleStartBattle(void) } break; case 15: - sub_8032768(); + InitBattleControllers(); sub_8184E58(); gBattleCommunication[SPRITES_INIT_STATE1] = 0; gBattleCommunication[SPRITES_INIT_STATE2] = 0; @@ -1042,11 +1050,12 @@ static void CB2_HandleStartMultiPartnerBattle(void) if (IsLinkTaskFinished()) { - *(&gBattleStruct->field_180) = 0; - *(&gBattleStruct->field_181) = 3; - sub_8036A5C(); + // 0x300 + *(&gBattleStruct->multiBuffer.linkBattlerHeader.versionSignatureLo) = 0; + *(&gBattleStruct->multiBuffer.linkBattlerHeader.versionSignatureHi) = 3; + BufferPartyVsScreenHealth_AtStart(); SetPlayerBerryDataInBattleStruct(); - SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32); + SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->multiBuffer.linkBattlerHeader, sizeof(gBattleStruct->multiBuffer.linkBattlerHeader)); gBattleCommunication[MULTIUSE_STATE] = 2; } @@ -1068,7 +1077,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) u8 taskId; ResetBlockReceivedFlags(); - sub_8036EB8(2, playerMultiplayerId); + FindLinkBattleMaster(2, playerMultiplayerId); SetAllPlayersBerryData(); taskId = CreateTask(InitLinkBattleVsScreen, 0); gTasks[taskId].data[1] = 0x10E; @@ -1192,7 +1201,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) } break; case 13: - sub_8032768(); + InitBattleControllers(); sub_8184E58(); gBattleCommunication[SPRITES_INIT_STATE1] = 0; gBattleCommunication[SPRITES_INIT_STATE2] = 0; @@ -1429,12 +1438,13 @@ static void CB2_HandleStartMultiBattle(void) { if (IsLinkTaskFinished()) { - *(&gBattleStruct->field_180) = 0; - *(&gBattleStruct->field_181) = 3; - sub_8036A5C(); + // 0x300 + *(&gBattleStruct->multiBuffer.linkBattlerHeader.versionSignatureLo) = 0; + *(&gBattleStruct->multiBuffer.linkBattlerHeader.versionSignatureHi) = 3; + BufferPartyVsScreenHealth_AtStart(); SetPlayerBerryDataInBattleStruct(); - SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32); + SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->multiBuffer.linkBattlerHeader, sizeof(gBattleStruct->multiBuffer.linkBattlerHeader)); gBattleCommunication[MULTIUSE_STATE]++; } if (gWirelessCommType) @@ -1453,7 +1463,7 @@ static void CB2_HandleStartMultiBattle(void) if ((GetBlockReceivedStatus() & 0xF) == 0xF) { ResetBlockReceivedFlags(); - sub_8036EB8(4, playerMultiplayerId); + FindLinkBattleMaster(4, playerMultiplayerId); SetAllPlayersBerryData(); SetDeoxysStats(); var = CreateTask(InitLinkBattleVsScreen, 0); @@ -1465,7 +1475,7 @@ static void CB2_HandleStartMultiBattle(void) for (id = 0; id < MAX_LINK_PLAYERS; id++) { - sub_8185F90(gBlockRecvBuffer[id][1]); + RecordedBattle_SetFrontierPassFlagFromHword(gBlockRecvBuffer[id][1]); switch (gLinkPlayers[id].id) { case 0: @@ -1629,7 +1639,7 @@ static void CB2_HandleStartMultiBattle(void) } break; case 7: - sub_8032768(); + InitBattleControllers(); sub_8184E58(); gBattleCommunication[SPRITES_INIT_STATE1] = 0; gBattleCommunication[SPRITES_INIT_STATE2] = 0; @@ -1650,10 +1660,10 @@ static void CB2_HandleStartMultiBattle(void) case 8: if (IsLinkTaskFinished()) { - u32* ptr = (u32*)(&gBattleStruct->field_180); + u32* ptr = gBattleStruct->multiBuffer.battleVideo; ptr[0] = gBattleTypeFlags; ptr[1] = gRecordedBattleRngSeed; // UB: overwrites berry data - SendBlock(bitmask_all_link_players_but_self(), ptr, 8); + SendBlock(bitmask_all_link_players_but_self(), ptr, sizeof(gBattleStruct->multiBuffer.battleVideo)); gBattleCommunication[MULTIUSE_STATE]++; } break; @@ -1702,7 +1712,7 @@ void BattleMainCB2(void) { gSpecialVar_Result = gBattleOutcome = B_OUTCOME_PLAYER_TELEPORTED; ResetPaletteFadeControl(); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); SetMainCallback2(CB2_QuitRecordedBattle); } } @@ -1925,12 +1935,12 @@ void VBlankCB_Battle(void) ScanlineEffect_InitHBlankDmaTransfer(); } -void nullsub_17(struct Sprite *sprite) +void SpriteCB_VsLetterDummy(struct Sprite *sprite) { } -static void sub_8038B04(struct Sprite *sprite) +static void SpriteCB_VsLetter(struct Sprite *sprite) { if (sprite->data[0] != 0) sprite->pos1.x = sprite->data[1] + ((sprite->data[2] & 0xFF00) >> 8); @@ -1941,100 +1951,60 @@ static void sub_8038B04(struct Sprite *sprite) if (sprite->affineAnimEnded) { - FreeSpriteTilesByTag(0x2710); - FreeSpritePaletteByTag(0x2710); + FreeSpriteTilesByTag(ANIM_SPRITES_START); + FreeSpritePaletteByTag(ANIM_SPRITES_START); FreeSpriteOamMatrix(sprite); DestroySprite(sprite); } } -void sub_8038B74(struct Sprite *sprite) +void SpriteCB_VsLetterInit(struct Sprite *sprite) { StartSpriteAffineAnim(sprite, 1); - sprite->callback = sub_8038B04; + sprite->callback = SpriteCB_VsLetter; PlaySE(SE_MUGSHOT); } -static void sub_8038B94(u8 taskId) +static void BufferPartyVsScreenHealth_AtEnd(u8 taskId) { - struct Pokemon *sp4 = NULL; - struct Pokemon *sp8 = NULL; - u8 r2 = gBattleScripting.multiplayerId; - u32 r7; + struct Pokemon *party1 = NULL; + struct Pokemon *party2 = NULL; + u8 multiplayerId = gBattleScripting.multiplayerId; + u32 flags; s32 i; if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - switch (gLinkPlayers[r2].id) + switch (gLinkPlayers[multiplayerId].id) { case 0: case 2: - sp4 = gPlayerParty; - sp8 = gEnemyParty; + party1 = gPlayerParty; + party2 = gEnemyParty; break; case 1: case 3: - sp4 = gEnemyParty; - sp8 = gPlayerParty; + party1 = gEnemyParty; + party2 = gPlayerParty; break; } } else { - sp4 = gPlayerParty; - sp8 = gEnemyParty; + party1 = gPlayerParty; + party2 = gEnemyParty; } - r7 = 0; - for (i = 0; i < PARTY_SIZE; i++) - { - u16 species = GetMonData(&sp4[i], MON_DATA_SPECIES2); - u16 hp = GetMonData(&sp4[i], MON_DATA_HP); - u32 status = GetMonData(&sp4[i], MON_DATA_STATUS); + flags = 0; + BUFFER_PARTY_VS_SCREEN_STATUS(party1, flags, i); + gTasks[taskId].data[3] = flags; - if (species == SPECIES_NONE) - continue; - if (species != SPECIES_EGG && hp != 0 && status == 0) - r7 |= 1 << i * 2; - - if (species == SPECIES_NONE) - continue; - if (hp != 0 && (species == SPECIES_EGG || status != 0)) - r7 |= 2 << i * 2; - - if (species == SPECIES_NONE) - continue; - if (species != SPECIES_EGG && hp == 0) - r7 |= 3 << i * 2; - } - gTasks[taskId].data[3] = r7; - - r7 = 0; - for (i = 0; i < PARTY_SIZE; i++) - { - u16 species = GetMonData(&sp8[i], MON_DATA_SPECIES2); - u16 hp = GetMonData(&sp8[i], MON_DATA_HP); - u32 status = GetMonData(&sp8[i], MON_DATA_STATUS); - - if (species == SPECIES_NONE) - continue; - if (species != SPECIES_EGG && hp != 0 && status == 0) - r7 |= 1 << i * 2; - - if (species == SPECIES_NONE) - continue; - if (hp != 0 && (species == SPECIES_EGG || status != 0)) - r7 |= 2 << i * 2; - - if (species == SPECIES_NONE) - continue; - if (species != SPECIES_EGG && hp == 0) - r7 |= 3 << i * 2; - } - gTasks[taskId].data[4] = r7; + flags = 0; + BUFFER_PARTY_VS_SCREEN_STATUS(party2, flags, i); + gTasks[taskId].data[4] = flags; } -void sub_8038D64(void) +void CB2_InitEndLinkBattle(void) { s32 i; u8 taskId; @@ -2054,12 +2024,12 @@ void sub_8038D64(void) { CpuFill32(0, (void*)(VRAM), VRAM_SIZE); SetGpuReg(REG_OFFSET_MOSAIC, 0); - SetGpuReg(REG_OFFSET_WIN0H, 0xF0); - SetGpuReg(REG_OFFSET_WIN0V, 0x5051); + SetGpuReg(REG_OFFSET_WIN0H, DISPLAY_WIDTH); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 2 + 1)); SetGpuReg(REG_OFFSET_WININ, 0); SetGpuReg(REG_OFFSET_WINOUT, 0); - gBattle_WIN0H = 0xF0; - gBattle_WIN0V = 0x5051; + gBattle_WIN0H = DISPLAY_WIDTH; + gBattle_WIN0V = WIN_RANGE(DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 2 + 1); ScanlineEffect_Clear(); i = 0; @@ -2094,24 +2064,26 @@ void sub_8038D64(void) ResetSpriteData(); ResetTasks(); DrawBattleEntryBackground(); - SetGpuReg(REG_OFFSET_WINOUT, 0x37); + SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR); FreeAllSpritePalettes(); gReservedSpritePaletteCount = 4; SetVBlankCallback(VBlankCB_Battle); + // Show end Vs screen with battle results taskId = CreateTask(InitLinkBattleVsScreen, 0); gTasks[taskId].data[1] = 0x10E; gTasks[taskId].data[2] = 0x5A; gTasks[taskId].data[5] = 1; - sub_8038B94(taskId); - SetMainCallback2(sub_8038F14); + BufferPartyVsScreenHealth_AtEnd(taskId); + + SetMainCallback2(CB2_EndLinkBattle); gBattleCommunication[MULTIUSE_STATE] = 0; } } -static void sub_8038F14(void) +static void CB2_EndLinkBattle(void) { - sub_8038F34(); + EndLinkBattleInSteps(); AnimateSprites(); BuildOamBuffer(); RunTextPrinters(); @@ -2119,7 +2091,7 @@ static void sub_8038F14(void) RunTasks(); } -static void sub_8038F34(void) +static void EndLinkBattleInSteps(void) { s32 i; @@ -2135,7 +2107,7 @@ static void sub_8038F34(void) case 1: if (--gBattleCommunication[1] == 0) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gBattleCommunication[MULTIUSE_STATE]++; } break; @@ -2144,7 +2116,7 @@ static void sub_8038F34(void) { u8 monsCount; - gMain.field_439_x4 = sub_8185FAC(); + gMain.anyLinkBattlerHasFrontierPass = RecordedBattle_GetFrontierPassFlag(); if (gBattleTypeFlags & BATTLE_TYPE_MULTI) monsCount = 4; @@ -2160,7 +2132,7 @@ static void sub_8038F34(void) FreeAllWindowBuffers(); SetMainCallback2(sub_80392A8); } - else if (!gMain.field_439_x4) + else if (!gMain.anyLinkBattlerHasFrontierPass) { SetMainCallback2(gMain.savedCallback); FreeBattleResources(); @@ -2169,7 +2141,7 @@ static void sub_8038F34(void) } else if (gReceivedRemoteLinkPlayers == 0) { - CreateTask(sub_80B3AF8, 5); + CreateTask(Task_ReconnectWithLinkPlayers, 5); gBattleCommunication[MULTIUSE_STATE]++; } else @@ -2192,7 +2164,7 @@ static void sub_8038F34(void) for (i = 0; i < 2; i++) LoadChosenBattleElement(i); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); gBattleCommunication[MULTIUSE_STATE]++; break; case 4: @@ -2200,7 +2172,7 @@ static void sub_8038F34(void) gBattleCommunication[MULTIUSE_STATE]++; break; case 5: - if (!FuncIsActiveTask(sub_80B3AF8)) + if (!FuncIsActiveTask(Task_ReconnectWithLinkPlayers)) gBattleCommunication[MULTIUSE_STATE]++; break; case 6: @@ -2224,9 +2196,9 @@ static void sub_8038F34(void) gBattleCommunication[MULTIUSE_STATE]++; break; case 9: - if (!gMain.field_439_x4 || gWirelessCommType || gReceivedRemoteLinkPlayers != 1) + if (!gMain.anyLinkBattlerHasFrontierPass || gWirelessCommType || gReceivedRemoteLinkPlayers != 1) { - gMain.field_439_x4 = 0; + gMain.anyLinkBattlerHasFrontierPass = 0; SetMainCallback2(gMain.savedCallback); FreeBattleResources(); FreeBattleSpritesData(); @@ -2236,7 +2208,7 @@ static void sub_8038F34(void) } } -u32 sub_80391E0(u8 arrayId, u8 caseId) +u32 GetBattleBgTemplateData(u8 arrayId, u8 caseId) { u32 ret = 0; @@ -2257,7 +2229,7 @@ u32 sub_80391E0(u8 arrayId, u8 caseId) case 4: ret = gBattleBgTemplates[arrayId].paletteMode; break; - case 5: + case 5: // Only this case is used ret = gBattleBgTemplates[arrayId].priority; break; case 6: @@ -2297,7 +2269,7 @@ static void sub_80392A8(void) gReservedSpritePaletteCount = 4; SetVBlankCallback(VBlankCB_Battle); SetMainCallback2(sub_803937C); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); gBattleCommunication[MULTIUSE_STATE] = 0; } @@ -2322,12 +2294,12 @@ static void sub_803939C(void) gBattleCommunication[MULTIUSE_STATE]++; break; case 1: - if (gMain.field_439_x4 && gReceivedRemoteLinkPlayers == 0) - CreateTask(sub_80B3AF8, 5); + if (gMain.anyLinkBattlerHasFrontierPass && gReceivedRemoteLinkPlayers == 0) + CreateTask(Task_ReconnectWithLinkPlayers, 5); gBattleCommunication[MULTIUSE_STATE]++; break; case 2: - if (!FuncIsActiveTask(sub_80B3AF8)) + if (!FuncIsActiveTask(Task_ReconnectWithLinkPlayers)) gBattleCommunication[MULTIUSE_STATE]++; break; case 3: @@ -2392,7 +2364,7 @@ static void sub_803939C(void) if (IsLinkTaskFinished() == TRUE) { HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); - if (gMain.field_439_x4) + if (gMain.anyLinkBattlerHasFrontierPass) { SetLinkStandbyCallback(); BattlePutTextOnWindow(gText_LinkStandby3, 0); @@ -2403,15 +2375,15 @@ static void sub_803939C(void) case 8: if (--gBattleCommunication[1] == 0) { - if (gMain.field_439_x4 && !gWirelessCommType) + if (gMain.anyLinkBattlerHasFrontierPass && !gWirelessCommType) SetCloseLinkCallback(); gBattleCommunication[MULTIUSE_STATE]++; } break; case 9: - if (!gMain.field_439_x4 || gWirelessCommType || gReceivedRemoteLinkPlayers != 1) + if (!gMain.anyLinkBattlerHasFrontierPass || gWirelessCommType || gReceivedRemoteLinkPlayers != 1) { - gMain.field_439_x4 = 0; + gMain.anyLinkBattlerHasFrontierPass = 0; if (!gPaletteFade.active) { SetMainCallback2(gMain.savedCallback); @@ -2441,7 +2413,7 @@ static void sub_803939C(void) case 11: if (IsLinkTaskFinished() == TRUE && !IsTextPrinterActive(0) && --gBattleCommunication[1] == 0) { - if (gMain.field_439_x4) + if (gMain.anyLinkBattlerHasFrontierPass) { SetLinkStandbyCallback(); BattlePutTextOnWindow(gText_LinkStandby3, 0); @@ -2453,11 +2425,11 @@ static void sub_803939C(void) case 7: if (!IsTextPrinterActive(0)) { - if (gMain.field_439_x4) + if (gMain.anyLinkBattlerHasFrontierPass) { if (IsLinkTaskFinished() == TRUE) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gBattleCommunication[1] = 0x20; gBattleCommunication[MULTIUSE_STATE] = 8; } @@ -2465,7 +2437,7 @@ static void sub_803939C(void) } else { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gBattleCommunication[1] = 0x20; gBattleCommunication[MULTIUSE_STATE] = 8; } @@ -2488,7 +2460,7 @@ static void TryCorrectShedinjaLanguage(struct Pokemon *mon) } } -u32 sub_80397C4(u32 setId, u32 tableId) +u32 GetBattleWindowTemplatePixelWidth(u32 setId, u32 tableId) { return gBattleWindowTemplates[setId][tableId].width * 8; } @@ -2522,7 +2494,7 @@ static void SpriteCb_WildMonShowHealthbox(struct Sprite *sprite) { if (sprite->animEnded) { - sub_8076918(sprite->sBattler); + StartHealthboxSlideIn(sprite->sBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[sprite->sBattler]); sprite->callback = SpriteCb_WildMonAnimate; StartSpriteAnimIfDifferent(sprite, 0); @@ -2672,12 +2644,13 @@ void SpriteCb_OpponentMonFromBall(struct Sprite *sprite) } } -void sub_8039BB4(struct Sprite *sprite) +// This callback is frequently overwritten by SpriteCB_TrainerSlideIn +void SpriteCB_BattleSpriteStartSlideLeft(struct Sprite *sprite) { - sprite->callback = oac_poke_ally_; + sprite->callback = SpriteCB_BattleSpriteSlideLeft; } -static void oac_poke_ally_(struct Sprite *sprite) +static void SpriteCB_BattleSpriteSlideLeft(struct Sprite *sprite) { if (!(gIntroSlideFlags & 1)) { @@ -2690,7 +2663,8 @@ static void oac_poke_ally_(struct Sprite *sprite) } } -void sub_80105DC(struct Sprite *sprite) +// Unused +static void sub_80105DC(struct Sprite *sprite) { sprite->callback = SpriteCallbackDummy_3; } @@ -2699,15 +2673,21 @@ static void SpriteCallbackDummy_3(struct Sprite *sprite) { } -void sub_8039C00(struct Sprite *sprite) +#define sSpeedX data[1] +#define sSpeedY data[2] + +void SpriteCB_FaintSlideAnim(struct Sprite *sprite) { if (!(gIntroSlideFlags & 1)) { - sprite->pos2.x += sprite->data[1]; - sprite->pos2.y += sprite->data[2]; + sprite->pos2.x += sprite->sSpeedX; + sprite->pos2.y += sprite->sSpeedY; } } +#undef sSpeedX +#undef sSpeedY + #define sSinIndex data[3] #define sDelta data[4] #define sAmplitude data[5] @@ -2828,7 +2808,7 @@ void sub_8039E9C(struct Sprite *sprite) sprite->centerToCornerVecX = gUnknown_0831ACE0[sprite->animCmdIndex]; } -void nullsub_20(void) +void BeginBattleIntroDummy(void) { } @@ -4097,7 +4077,11 @@ static void HandleTurnActionSelectionState(void) } break; case STATE_WAIT_ACTION_CONFIRMED_STANDBY: - if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) + if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) + | (0xF0000000) + | (gBitTable[gActiveBattler] << 4) + | (gBitTable[gActiveBattler] << 8) + | (gBitTable[gActiveBattler] << 12)))) { if (AllAtActionConfirmed()) i = TRUE; @@ -4775,7 +4759,7 @@ static void HandleEndTurn_BattleLost(void) } else { - gBattlescriptCurrInstr = BattleScript_82DAA0B; + gBattlescriptCurrInstr = BattleScript_FrontierLinkBattleLost; gBattleOutcome &= ~(B_OUTCOME_LINK_BATTLE_RAN); } } @@ -4944,7 +4928,7 @@ static void TryEvolvePokemon(void) levelUpBits &= ~(gBitTable[i]); gLeveledUpInBattle = levelUpBits; - species = GetEvolutionTargetSpecies(&gPlayerParty[i], 0, levelUpBits); + species = GetEvolutionTargetSpecies(&gPlayerParty[i], EVO_MODE_NORMAL, levelUpBits); if (species != SPECIES_NONE) { FreeAllWindowBuffers(); diff --git a/src/battle_message.c b/src/battle_message.c index 05874c595..42f2e1b52 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -22,7 +22,6 @@ #include "constants/abilities.h" #include "constants/battle_dome.h" #include "constants/battle_string_ids.h" -#include "constants/berry.h" #include "constants/frontier_util.h" #include "constants/items.h" #include "constants/moves.h" @@ -3601,7 +3600,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId) if (printerTemplate.x == 0xFF) { - u32 width = sub_80397C4(gBattleScripting.windowsType, windowId); + u32 width = GetBattleWindowTemplatePixelWidth(gBattleScripting.windowsType, windowId); s32 alignX = GetStringCenterAlignXOffsetWithLetterSpacing(printerTemplate.fontId, printerTemplate.currentChar, width, printerTemplate.letterSpacing); printerTemplate.x = printerTemplate.currentX = alignX; } diff --git a/src/battle_pike.c b/src/battle_pike.c index 54c2361f1..d4235963a 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -429,32 +429,32 @@ static const u16 sNPCSpeeches[][EASY_CHAT_BATTLE_WORDS_COUNT] = {EC_WORD_DID, EC_WORD_YOU, EC_WORD_MAKE, EC_WORD_A, EC_WORD_MISTAKE, EC_WORD_QUES}, {EC_WORD_IT_S, EC_WORD_MEAN, EC_WORD_AND, EC_WORD_AWFUL, EC_WORD_IN, EC_WORD_HERE}, {EC_WORD_I_AM, EC_WORD_SO, EC_WORD_TIRED, EC_WORD_OF, EC_WORD_THIS, EC_WORD_PLACE}, - {EC_WORD_I, EC_WORD_QUITE, EC_WORD_ENJOY, EC_WORD_THIS, EC_WORD_CHALLENGE, 0xFFFF}, + {EC_WORD_I, EC_WORD_QUITE, EC_WORD_ENJOY, EC_WORD_THIS, EC_WORD_CHALLENGE, EC_EMPTY_WORD}, {EC_WORD_LOOK, EC_WORD_AT, EC_WORD_HOW, EC_WORD_I, EC_MOVE2(TACKLE), EC_WORD_THIS}, - {EC_WORD_READY, EC_WORD_TO, EC_WORD_GIVE_UP, EC_WORD_YET, EC_WORD_QUES, 0xFFFF}, + {EC_WORD_READY, EC_WORD_TO, EC_WORD_GIVE_UP, EC_WORD_YET, EC_WORD_QUES, EC_EMPTY_WORD}, {EC_WORD_OH, EC_WORD_NO, EC_WORD_WHO, EC_WORD_ARE, EC_WORD_YOU, EC_WORD_QUES}, {EC_WORD_I_VE, EC_WORD_BEEN, EC_WORD_WANDERING, EC_WORD_ABOUT, EC_WORD_FOREVER, EC_WORD_ELLIPSIS}, - {EC_WORD_I, EC_WORD_THINK, EC_WORD_I, EC_WORD_WILL, EC_WORD_GIVE_UP, 0xFFFF}, + {EC_WORD_I, EC_WORD_THINK, EC_WORD_I, EC_WORD_WILL, EC_WORD_GIVE_UP, EC_EMPTY_WORD}, {EC_WORD_WHAT, EC_WORD_SHOULD, EC_WORD_I, EC_WORD_DO, EC_WORD_NEXT, EC_WORD_QUES}, {EC_WORD_I, EC_WORD_CAN_WIN, EC_WORD_WITH, EC_WORD_MY, EC_MOVE(SHEER_COLD), EC_WORD_GENIUS}, {EC_WORD_WON_T, EC_WORD_SOMEONE, EC_WORD_COOL, EC_WORD_SHOW, EC_WORD_UP, EC_WORD_QUES}, - {EC_WORD_BATTLE, EC_WORD_GAME, EC_WORD_IS, EC_WORD_AWESOME, EC_WORD_EXCL, 0xFFFF}, + {EC_WORD_BATTLE, EC_WORD_GAME, EC_WORD_IS, EC_WORD_AWESOME, EC_WORD_EXCL, EC_EMPTY_WORD}, {EC_WORD_I, EC_WORD_CAN_T, EC_WORD_TAKE, EC_WORD_THIS, EC_WORD_ANY, EC_WORD_MORE}, {EC_WORD_I, EC_WORD_DON_T, EC_WORD_KNOW, EC_WORD_IF, EC_WORD_IT_S, EC_WORD_OKAY}, {EC_WORD_OH, EC_WORD_NO, EC_WORD_EXCL, EC_WORD_NOT, EC_WORD_ANOTHER, EC_WORD_TRAINER}, {EC_WORD_IT, EC_WORD_HAS, EC_WORD_TO, EC_WORD_BE, EC_WORD_LEFT, EC_WORD_NEXT}, {EC_WORD_IT, EC_WORD_MUST_BE, EC_WORD_OVER, EC_WORD_SOON, EC_WORD_RIGHT, EC_WORD_QUES}, - {EC_WORD_THIS, EC_WORD_IS, EC_WORD_TOTALLY, EC_WORD_EASY, EC_WORD_ISN_T_IT_QUES, 0xFFFF}, - {EC_WORD_I_AM, EC_WORD_GOING, EC_WORD_TO, EC_WORD_POWER, EC_WORD_ON, 0xFFFF}, + {EC_WORD_THIS, EC_WORD_IS, EC_WORD_TOTALLY, EC_WORD_EASY, EC_WORD_ISN_T_IT_QUES, EC_EMPTY_WORD}, + {EC_WORD_I_AM, EC_WORD_GOING, EC_WORD_TO, EC_WORD_POWER, EC_WORD_ON, EC_EMPTY_WORD}, {EC_WORD_THERE, EC_WORD_IS, EC_WORD_NO, EC_WORD_GIVE_UP, EC_WORD_IN, EC_WORD_ME}, {EC_WORD_I_AM, EC_WORD_NOT, EC_WORD_GOING, EC_WORD_TO, EC_WORD_MAKE, EC_WORD_IT}, {EC_WORD_GO, EC_WORD_ON, EC_WORD_I, EC_WORD_CAN_T, EC_WORD_ANY, EC_WORD_MORE}, - {EC_WORD_A, EC_WORD_TRAINER, EC_WORD_AFTER, EC_WORD_ANOTHER, EC_WORD_ELLIPSIS, 0xFFFF}, + {EC_WORD_A, EC_WORD_TRAINER, EC_WORD_AFTER, EC_WORD_ANOTHER, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, {EC_WORD_DO, EC_WORD_YOU, EC_WORD_LIKE, EC_WORD_STEEL, EC_WORD_POKEMON, EC_WORD_QUES}, - {EC_WORD_EVERY, EC_WORD_TRAINER, EC_WORD_HERE, EC_WORD_IS, EC_WORD_TOO_WEAK, 0xFFFF}, + {EC_WORD_EVERY, EC_WORD_TRAINER, EC_WORD_HERE, EC_WORD_IS, EC_WORD_TOO_WEAK, EC_EMPTY_WORD}, {EC_WORD_YOU, EC_WORD_THINK, EC_WORD_THIS, EC_WORD_IS, EC_WORD_EASY, EC_WORD_QUES}, {EC_WORD_WHAT, EC_WORD_WILL, EC_WORD_COME, EC_WORD_AFTER, EC_WORD_THIS, EC_WORD_QUES}, - {EC_WORD_I_AM, EC_WORD_JUST, EC_WORD_SO, EC_WORD_CONFUSED, EC_WORD_EXCL, 0xFFFF}, + {EC_WORD_I_AM, EC_WORD_JUST, EC_WORD_SO, EC_WORD_CONFUSED, EC_WORD_EXCL, EC_EMPTY_WORD}, {EC_WORD_I, EC_WORD_JUST, EC_WORD_WANT, EC_WORD_TO, EC_WORD_GO_HOME, EC_WORD_ELLIPSIS}, {EC_WORD_YEEHAW_EXCL, EC_WORD_THIS, EC_WORD_PLACE, EC_WORD_IS, EC_WORD_A, EC_WORD_PUSHOVER}, {EC_WORD_I, EC_WORD_HAVEN_T, EC_WORD_BEEN, EC_WORD_IN, EC_WORD_A, EC_WORD_BATTLE}, @@ -1186,7 +1186,7 @@ static bool8 StatusInflictionFadeOut(struct Task *task) task->data[7] += task->data[4]; if (task->data[7] > 16) task->data[7] = 16; - BlendPalettes(0xFFFFFFFF, task->data[7], RGB(11, 11, 11)); + BlendPalettes(PALETTES_ALL, task->data[7], RGB(11, 11, 11)); } if (task->data[7] >= 16) @@ -1205,7 +1205,7 @@ static bool8 StatusInflictionFadeIn(struct Task *task) task->data[7] -= task->data[5]; if (task->data[7] < 0) task->data[7] = 0; - BlendPalettes(0xFFFFFFFF, task->data[7], RGB(11, 11, 11)); + BlendPalettes(PALETTES_ALL, task->data[7], RGB(11, 11, 11)); } if (task->data[7] == 0) @@ -1237,7 +1237,7 @@ static void StartStatusInflictionScreenFlash(s16 fadeOutDelay, s16 fadeInDelay, static bool8 IsStatusInflictionScreenFlashTaskFinished(void) { - if (FindTaskIdByFunc(DoStatusInflictionScreenFlash) == 0xFF) + if (FindTaskIdByFunc(DoStatusInflictionScreenFlash) == TASK_NONE) return TRUE; else return FALSE; @@ -1328,7 +1328,7 @@ bool8 InBattlePike(void) return gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_THREE_PATH_ROOM || gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_NORMAL || gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_WILD_MONS - || gMapHeader.mapLayoutId == LAYOUT_UNKNOWN_084693AC; + || gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_UNUSED; } static void SetHintedRoom(void) diff --git a/src/battle_pyramid_bag.c b/src/battle_pyramid_bag.c index 8fee57855..f39bbf522 100644 --- a/src/battle_pyramid_bag.c +++ b/src/battle_pyramid_bag.c @@ -389,10 +389,10 @@ void GoToBattlePyramidBagMenu(u8 a0, void (*callback)(void)) gPyramidBagResources->callback2 = NULL; gPyramidBagResources->unk814 = 0xFF; - gPyramidBagResources->scrollIndicatorsTaskId = 0xFF; + gPyramidBagResources->scrollIndicatorsTaskId = TASK_NONE; memset(gPyramidBagResources->itemsSpriteIds, 0xFF, sizeof(gPyramidBagResources->itemsSpriteIds)); - memset(gPyramidBagResources->windowIds, 0xFF, sizeof(gPyramidBagResources->windowIds)); + memset(gPyramidBagResources->windowIds, WINDOW_NONE, sizeof(gPyramidBagResources->windowIds)); SetMainCallback2(sub_81C504C); } @@ -493,11 +493,11 @@ static bool8 sub_81C5078(void) gMain.state++; break; case 15: - BlendPalettes(0xFFFFFFFF, 0x10, 0); + BlendPalettes(PALETTES_ALL, 0x10, 0); gMain.state++; break; case 16: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); gPaletteFade.bufferTransferDisabled = FALSE; gMain.state++; break; @@ -657,16 +657,16 @@ static void PrintItemDescription(s32 listMenuId) static void AddScrollArrow(void) { - if (gPyramidBagResources->scrollIndicatorsTaskId == 0xFF) + if (gPyramidBagResources->scrollIndicatorsTaskId == TASK_NONE) gPyramidBagResources->scrollIndicatorsTaskId = AddScrollIndicatorArrowPairParameterized(2, 172, 12, 148, gPyramidBagResources->listMenuCount - gPyramidBagResources->listMenuMaxShown, 0xB5E, 0xB5E, &gPyramidBagCursorData.scrollPosition); } static void RemoveScrollArrow(void) { - if (gPyramidBagResources->scrollIndicatorsTaskId != 0xFF) + if (gPyramidBagResources->scrollIndicatorsTaskId != TASK_NONE) { RemoveScrollIndicatorArrowPair(gPyramidBagResources->scrollIndicatorsTaskId); - gPyramidBagResources->scrollIndicatorsTaskId = 0xFF; + gPyramidBagResources->scrollIndicatorsTaskId = TASK_NONE; } } @@ -811,7 +811,7 @@ static void sub_81C5AB8(u8 y, u8 arg1) void CloseBattlePyramidBagAndSetCallback(u8 taskId) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = sub_81C5B4C; } @@ -1428,7 +1428,7 @@ static u8 sub_81C6D08(u8 windowArrayId) static u8 sub_81C6D24(u8 windowArrayId) { u8 *windowId = &gPyramidBagResources->windowIds[windowArrayId]; - if (*windowId == 0xFF) + if (*windowId == WINDOW_NONE) { *windowId = AddWindow(&gUnknown_0861F350[windowArrayId]); DrawStdFrameWithCustomTileAndPalette(*windowId, FALSE, 1, 0xE); @@ -1440,13 +1440,13 @@ static u8 sub_81C6D24(u8 windowArrayId) static void sub_81C6D6C(u8 windowArrayId) { u8 *windowId = &gPyramidBagResources->windowIds[windowArrayId]; - if (*windowId != 0xFF) + if (*windowId != WINDOW_NONE) { ClearStdWindowAndFrameToTransparent(*windowId, FALSE); ClearWindowTilemap(*windowId); RemoveWindow(*windowId); ScheduleBgCopyTilemapToVram(1); - *windowId = 0xFF; + *windowId = WINDOW_NONE; } } @@ -1475,13 +1475,13 @@ static void CloseBattlePyramidBagTextWindow(void) static void sub_81C6E38(u8 itemSpriteArrayId) { u8 *spriteId = &gPyramidBagResources->itemsSpriteIds[itemSpriteArrayId]; - if (*spriteId != 0xFF) + if (*spriteId != SPRITE_NONE) { FreeSpriteTilesByTag(ITEM_IMAGE_TAG + itemSpriteArrayId); FreeSpritePaletteByTag(ITEM_IMAGE_TAG + itemSpriteArrayId); FreeSpriteOamMatrix(&gSprites[*spriteId]); DestroySprite(&gSprites[*spriteId]); - *spriteId = 0xFF; + *spriteId = SPRITE_NONE; } } @@ -1526,7 +1526,7 @@ static void ShowItemImage(u16 itemId, u8 itemSpriteArrayId) { u8 itemSpriteId; u8 *spriteId = &gPyramidBagResources->itemsSpriteIds[itemSpriteArrayId + 1]; - if (*spriteId == 0xFF) + if (*spriteId == SPRITE_NONE) { FreeSpriteTilesByTag(ITEM_IMAGE_TAG + 1 + itemSpriteArrayId); FreeSpritePaletteByTag(ITEM_IMAGE_TAG + 1 + itemSpriteArrayId); diff --git a/src/battle_records.c b/src/battle_records.c index a8b9ead14..5dff8e6d3 100644 --- a/src/battle_records.c +++ b/src/battle_records.c @@ -365,7 +365,7 @@ static void Task_CloseTrainerHillRecordsOnButton(u8 taskId) static void Task_BeginPaletteFade(u8 taskId) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ExitTrainerHillRecords; } @@ -512,7 +512,7 @@ static void CB2_ShowTrainerHillRecords(void) gMain.state++; break; case 6: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); gMain.state++; break; case 7: diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 0c5250050..6aaeaa6c2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -383,7 +383,7 @@ static void Cmd_trainerslidein(void); static void Cmd_playse(void); static void Cmd_fanfare(void); static void Cmd_playfaintcry(void); -static void Cmd_unknown_57(void); +static void Cmd_endlinkbattle(void); static void Cmd_returntoball(void); static void Cmd_handlelearnnewmove(void); static void Cmd_yesnoboxlearnmove(void); @@ -642,7 +642,7 @@ void (* const gBattleScriptingCommandsTable[])(void) = Cmd_playse, //0x54 Cmd_fanfare, //0x55 Cmd_playfaintcry, //0x56 - Cmd_unknown_57, //0x57 + Cmd_endlinkbattle, //0x57 Cmd_returntoball, //0x58 Cmd_handlelearnnewmove, //0x59 Cmd_yesnoboxlearnmove, //0x5A @@ -5449,7 +5449,7 @@ static void Cmd_openpartyscreen(void) { gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); - BtlController_EmitLinkStandbyMsg(0, 2, 0); + BtlController_EmitLinkStandbyMsg(0, 2, FALSE); MarkBattlerForControllerExec(gActiveBattler); } else if (!gSpecialStatuses[gActiveBattler].flag40) @@ -5460,7 +5460,7 @@ static void Cmd_openpartyscreen(void) } else { - BtlController_EmitLinkStandbyMsg(0, 2, 0); + BtlController_EmitLinkStandbyMsg(0, 2, FALSE); MarkBattlerForControllerExec(gActiveBattler); } } @@ -5488,7 +5488,7 @@ static void Cmd_openpartyscreen(void) } else { - BtlController_EmitLinkStandbyMsg(0, 2, 0); + BtlController_EmitLinkStandbyMsg(0, 2, FALSE); MarkBattlerForControllerExec(gActiveBattler); flags |= 1; } @@ -5510,7 +5510,7 @@ static void Cmd_openpartyscreen(void) } else if (!(flags & 1)) { - BtlController_EmitLinkStandbyMsg(0, 2, 0); + BtlController_EmitLinkStandbyMsg(0, 2, FALSE); MarkBattlerForControllerExec(gActiveBattler); } } @@ -5531,7 +5531,7 @@ static void Cmd_openpartyscreen(void) } else { - BtlController_EmitLinkStandbyMsg(0, 2, 0); + BtlController_EmitLinkStandbyMsg(0, 2, FALSE); MarkBattlerForControllerExec(gActiveBattler); flags |= 2; } @@ -5553,7 +5553,7 @@ static void Cmd_openpartyscreen(void) } else if (!(flags & 2)) { - BtlController_EmitLinkStandbyMsg(0, 2, 0); + BtlController_EmitLinkStandbyMsg(0, 2, FALSE); MarkBattlerForControllerExec(gActiveBattler); } } @@ -5569,7 +5569,7 @@ static void Cmd_openpartyscreen(void) else gActiveBattler = 0; - BtlController_EmitLinkStandbyMsg(0, 2, 0); + BtlController_EmitLinkStandbyMsg(0, 2, FALSE); MarkBattlerForControllerExec(gActiveBattler); } @@ -5585,7 +5585,7 @@ static void Cmd_openpartyscreen(void) else gActiveBattler = 1; - BtlController_EmitLinkStandbyMsg(0, 2, 0); + BtlController_EmitLinkStandbyMsg(0, 2, FALSE); MarkBattlerForControllerExec(gActiveBattler); } } @@ -5693,7 +5693,7 @@ static void Cmd_openpartyscreen(void) { if (gActiveBattler != battlerId) { - BtlController_EmitLinkStandbyMsg(0, 2, 0); + BtlController_EmitLinkStandbyMsg(0, 2, FALSE); MarkBattlerForControllerExec(gActiveBattler); } } @@ -5704,7 +5704,7 @@ static void Cmd_openpartyscreen(void) if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) gActiveBattler ^= BIT_FLANK; - BtlController_EmitLinkStandbyMsg(0, 2, 0); + BtlController_EmitLinkStandbyMsg(0, 2, FALSE); MarkBattlerForControllerExec(gActiveBattler); } } @@ -5951,10 +5951,10 @@ static void Cmd_playfaintcry(void) gBattlescriptCurrInstr += 2; } -static void Cmd_unknown_57(void) +static void Cmd_endlinkbattle(void) { gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - BtlController_EmitCmd55(0, gBattleOutcome); + BtlController_EmitEndLinkBattle(0, gBattleOutcome); MarkBattlerForControllerExec(gActiveBattler); gBattlescriptCurrInstr += 1; @@ -6043,7 +6043,7 @@ static void Cmd_yesnoboxlearnmove(void) if (gBattleCommunication[1] == 0) { HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, WINDOW_CLEAR); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gBattleScripting.learnMoveState++; } else @@ -6917,7 +6917,7 @@ static void Cmd_hpthresholds2(void) static void Cmd_useitemonopponent(void) { gBattlerInMenuId = gBattlerAttacker; - PokemonUseItemEffects(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker]], gLastUsedItem, gBattlerPartyIndexes[gBattlerAttacker], 0, 1); + PokemonUseItemEffects(&gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker]], gLastUsedItem, gBattlerPartyIndexes[gBattlerAttacker], 0, TRUE); gBattlescriptCurrInstr += 1; } @@ -7430,7 +7430,7 @@ static void Cmd_various(void) gDisableStructs[1].truantSwitchInHack = 1; break; case VARIOUS_EMIT_YESNOBOX: - BtlController_EmitUnknownYesNoBox(0); + BtlController_EmitYesNoBox(0); MarkBattlerForControllerExec(gActiveBattler); break; case 14: @@ -12171,7 +12171,7 @@ static void Cmd_displaydexinfo(void) switch (gBattleCommunication[0]) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gBattleCommunication[0]++; break; case 1: @@ -12202,7 +12202,7 @@ static void Cmd_displaydexinfo(void) case 4: if (!IsDma3ManagerBusyWithBgCopy()) { - BeginNormalPaletteFade(0xFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_BG, 0, 0x10, 0, RGB_BLACK); ShowBg(0); ShowBg(3); gBattleCommunication[0]++; diff --git a/src/battle_setup.c b/src/battle_setup.c index 7e2dcc9b3..07ac3396b 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -1215,7 +1215,7 @@ void ConfigureAndSetUpOneTrainerBattle(u8 trainerObjEventId, const u8 *trainerSc gSelectedObjectEvent = trainerObjEventId; gSpecialVar_LastTalked = gObjectEvents[trainerObjEventId].localId; BattleSetup_ConfigureTrainerBattle(trainerScript + 1); - ScriptContext1_SetupScript(EventScript_271354); + ScriptContext1_SetupScript(EventScript_StartTrainerApproach); ScriptContext2_Enable(); } @@ -1228,7 +1228,7 @@ void ConfigureTwoTrainersBattle(u8 trainerObjEventId, const u8 *trainerScript) void SetUpTwoTrainersBattle(void) { - ScriptContext1_SetupScript(EventScript_271354); + ScriptContext1_SetupScript(EventScript_StartTrainerApproach); ScriptContext2_Enable(); } @@ -1238,10 +1238,12 @@ bool32 GetTrainerFlagFromScriptPointer(const u8 *data) return FlagGet(TRAINER_FLAGS_START + flag); } -void SetUpTrainerMovement(void) +// Set trainer's movement type so they stop and remain facing that direction +// Note: Only for trainers who are spoken to directly +// For trainers who spot the player this is handled by PlayerFaceApproachingTrainer +void SetTrainerFacingDirection(void) { struct ObjectEvent *objectEvent = &gObjectEvents[gSelectedObjectEvent]; - SetTrainerMovementType(objectEvent, GetTrainerFacingDirectionMovementType(objectEvent->facingDirection)); } @@ -1455,7 +1457,7 @@ void ShowTrainerCantBattleSpeech(void) ShowFieldMessage(GetTrainerCantBattleSpeech()); } -void SetUpTrainerEncounterMusic(void) +void PlayTrainerEncounterMusic(void) { u16 trainerId; u16 music; diff --git a/src/battle_tower.c b/src/battle_tower.c index d6d163b3a..eb98d2966 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -2809,7 +2809,11 @@ static void AwardBattleTowerRibbons(void) { s32 i; u32 partyIndex; +#ifdef BUGFIX + struct RibbonCounter ribbons[MAX_FRONTIER_PARTY_SIZE]; +#else struct RibbonCounter ribbons[3]; // BUG: 4 Pokemon can receive ribbons in a double battle mode. +#endif u8 ribbonType = 0; u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); diff --git a/src/battle_transition.c b/src/battle_transition.c index 74e1548e7..66a4395b9 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -991,7 +991,7 @@ static bool8 Transition_Phase1(struct Task *task) static bool8 Transition_WaitForPhase1(struct Task *task) { - if (FindTaskIdByFunc(sPhase1_Tasks[task->tTransitionId]) == 0xFF) + if (FindTaskIdByFunc(sPhase1_Tasks[task->tTransitionId]) == TASK_NONE) { task->tState++; return TRUE; @@ -1012,7 +1012,7 @@ static bool8 Transition_Phase2(struct Task *task) static bool8 Transition_WaitForPhase2(struct Task *task) { task->tTransitionDone = FALSE; - if (FindTaskIdByFunc(sPhase2_Tasks[task->tTransitionId]) == 0xFF) + if (FindTaskIdByFunc(sPhase2_Tasks[task->tTransitionId]) == TASK_NONE) task->tTransitionDone = TRUE; return FALSE; } @@ -1071,7 +1071,7 @@ static bool8 Phase2_Blur_Func2(struct Task *task) { task->tData1 = 4; if (++task->tData2 == 10) - BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 0x10, RGB_BLACK); SetGpuReg(REG_OFFSET_MOSAIC, (task->tData2 & 15) * 17); if (task->tData2 > 14) task->tState++; @@ -1098,7 +1098,7 @@ static bool8 Phase2_Swirl_Func1(struct Task *task) { InitTransitionStructVars(); ScanlineEffect_Clear(); - BeginNormalPaletteFade(0xFFFFFFFF, 4, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 4, 0, 0x10, RGB_BLACK); sub_8149F98(gScanlineEffectRegBuffers[1], sTransitionStructPtr->field_14, 0, 2, 0, 160); SetVBlankCallback(VBlankCB_Phase2_Swirl); @@ -1153,7 +1153,7 @@ static bool8 Phase2_Shuffle_Func1(struct Task *task) InitTransitionStructVars(); ScanlineEffect_Clear(); - BeginNormalPaletteFade(0xFFFFFFFF, 4, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 4, 0, 0x10, RGB_BLACK); memset(gScanlineEffectRegBuffers[1], sTransitionStructPtr->field_16, 0x140); SetVBlankCallback(VBlankCB_Phase2_Shuffle); @@ -1456,7 +1456,7 @@ static bool8 Phase2_Kyogre_Func5(struct Task *task) static bool8 Phase2_WeatherDuo_Func6(struct Task *task) { - BeginNormalPaletteFade(0xFFFF8000, 1, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_OBJECTS | 0x8000, 1, 0, 0x10, RGB_BLACK); task->tState++; return FALSE; } @@ -1541,7 +1541,7 @@ static bool8 Phase2_FramesCountdown(struct Task *task) static bool8 Phase2_WeatherTrio_Func1(struct Task *task) { - BeginNormalPaletteFade(0x0000FFFF, 1, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_BG, 1, 0, 0x10, RGB_BLACK); task->tState++; return FALSE; } @@ -1962,7 +1962,7 @@ static bool8 Phase2_Ripple_Func2(struct Task *task) if (++task->tData3 == 81) { task->tData4++; - BeginNormalPaletteFade(0xFFFFFFFF, -2, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -2, 0, 0x10, RGB_BLACK); } if (task->tData4 != 0 && !gPaletteFade.active) @@ -2308,7 +2308,7 @@ static bool8 Phase2_Mugshot_Func7(struct Task *task) static bool8 Phase2_Mugshot_Func8(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; - BlendPalettes(0xFFFFFFFF, 0x10, RGB_WHITE); + BlendPalettes(PALETTES_ALL, 0x10, RGB_WHITE); sTransitionStructPtr->BLDCNT = 0xFF; task->tData3 = 0; @@ -3168,7 +3168,7 @@ static bool8 Phase2_Rayquaza_Func6(struct Task *task) { task->tState++; task->tData1 = 0; - BeginNormalPaletteFade(0xFFFF8000, 2, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_OBJECTS | 0x8000, 2, 0, 0x10, RGB_BLACK); } return FALSE; @@ -3187,8 +3187,8 @@ static bool8 Phase2_Rayquaza_Func7(struct Task *task) static bool8 Phase2_Rayquaza_Func8(struct Task *task) { - BlendPalettes(0x00007FFF, 8, 0); - BlendPalettes(0xFFFF8000, 0, 0); + BlendPalettes(PALETTES_BG & ~(0x8000), 8, 0); + BlendPalettes(PALETTES_OBJECTS | 0x8000, 0, 0); task->tState++; return FALSE; @@ -3300,7 +3300,7 @@ static bool8 Phase2_WhiteFade_Func3(struct Task *task) sTransitionStructPtr->VBlank_DMA = 0; if (sTransitionStructPtr->field_20 > 7) { - BlendPalettes(-1, 0x10, 0x7FFF); + BlendPalettes(PALETTES_ALL, 0x10, 0x7FFF); task->tState++; } return FALSE; @@ -3612,7 +3612,7 @@ static void CreatePhase1Task(s16 a0, s16 a1, s16 a2, s16 a3, s16 a4) static bool8 IsPhase1Done(void) { - if (FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) == 0xFF) + if (FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) == TASK_NONE) return TRUE; else return FALSE; @@ -3631,7 +3631,7 @@ static bool8 Phase1_TransitionAll_Func1(struct Task *task) task->tData7 += task->tData4; if (task->tData7 > 16) task->tData7 = 16; - BlendPalettes(-1, task->tData7, 0x2D6B); + BlendPalettes(PALETTES_ALL, task->tData7, 0x2D6B); } if (task->tData7 > 15) { @@ -3649,7 +3649,7 @@ static bool8 Phase1_TransitionAll_Func2(struct Task *task) task->tData7 -= task->tData5; if (task->tData7 < 0) task->tData7 = 0; - BlendPalettes(-1, task->tData7, 0x2D6B); + BlendPalettes(PALETTES_ALL, task->tData7, 0x2D6B); } if (task->tData7 == 0) { @@ -3706,7 +3706,7 @@ void GetBg0TilesDst(u16 **tilemap, u16 **tileset) static void FadeScreenBlack(void) { - BlendPalettes(0xFFFFFFFF, 16, RGB_BLACK); + BlendPalettes(PALETTES_ALL, 16, RGB_BLACK); } static void sub_8149F98(s16 *array, s16 sinAdd, s16 index, s16 indexIncrementer, s16 amplitude, s16 arrSize) @@ -3977,7 +3977,7 @@ static bool8 Phase2_FrontierLogoWave_Func4(struct Task *task) if (++task->tData3 == 101) { task->tData4++; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); } if (task->tData4 != 0 && !gPaletteFade.active) @@ -4077,7 +4077,7 @@ static bool8 Phase2_FrontierSquares_Func3(struct Task *task) } break; case 1: - BlendPalettes(0xFFFF7FFF, 0x10, 0); + BlendPalettes(PALETTES_ALL & ~(0x8000), 0x10, 0); LZ77UnCompVram(sFrontierSquares_EmptyBg_Tileset, tileset); break; case 2: @@ -4138,7 +4138,7 @@ static bool8 Phase2_FrontierSquaresSpiral_Func2(struct Task *task) static bool8 Phase2_FrontierSquaresSpiral_Func3(struct Task *task) { BlendPalette(0xE0, 0x10, 3, 0); - BlendPalettes(0xFFFF3FFF, 0x10, 0); + BlendPalettes(PALETTES_ALL & ~(0x8000 | 0x4000), 0x10, 0); task->tData2 = 0; task->tData3 = 0; @@ -4194,7 +4194,7 @@ static bool8 Phase2_FrontierSquares_End(struct Task *task) { FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 0x20, 0x20); CopyBgTilemapBufferToVram(0); - BlendPalettes(0xFFFFFFFF, 0x10, 0); + BlendPalettes(PALETTES_ALL, 0x10, 0); DestroyTask(FindTaskIdByFunc(task->func)); return FALSE; } @@ -4286,7 +4286,7 @@ static bool8 Phase2_FrontierSquaresScroll_Func2(struct Task *task) static bool8 Phase2_FrontierSquaresScroll_Func3(struct Task *task) { - BlendPalettes(0xFFFF7FFF, 0x10, 0); + BlendPalettes(PALETTES_ALL & ~(0x8000), 0x10, 0); task->tData2 = 0; @@ -4325,7 +4325,7 @@ static bool8 Phase2_FrontierSquaresScroll_Func5(struct Task *task) FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 0x20, 0x20); CopyBgTilemapBufferToVram(0); - BlendPalettes(0xFFFFFFFF, 0x10, 0); + BlendPalettes(PALETTES_ALL, 0x10, 0); DestroyTask(FindTaskIdByFunc(task->func)); task->tState++; // UB: changing value of a destroyed task diff --git a/src/battle_transition_frontier.c b/src/battle_transition_frontier.c index 931de5e44..cb3519c4e 100644 --- a/src/battle_transition_frontier.c +++ b/src/battle_transition_frontier.c @@ -373,7 +373,7 @@ static bool8 FadeInCenterLogoCircle(struct Task *task) { if (task->data[3] == 31) { - BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 0x10, RGB_BLACK); task->tState++; } else diff --git a/src/battle_util.c b/src/battle_util.c index f1f5ffd10..928b465e9 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -37,7 +37,6 @@ #include "constants/battle_move_effects.h" #include "constants/battle_script_commands.h" #include "constants/battle_string_ids.h" -#include "constants/berry.h" #include "constants/hold_effects.h" #include "constants/items.h" #include "constants/moves.h" @@ -1174,14 +1173,14 @@ void MarkBattlerForControllerExec(u8 battlerId) gBattleControllerExecFlags |= gBitTable[battlerId]; } -void sub_803F850(u8 arg0) +void MarkBattlerReceivedLinkData(u8 battlerId) { s32 i; for (i = 0; i < GetLinkPlayerCount(); i++) - gBattleControllerExecFlags |= gBitTable[arg0] << (i << 2); + gBattleControllerExecFlags |= gBitTable[battlerId] << (i << 2); - gBattleControllerExecFlags &= ~(0x10000000 << arg0); + gBattleControllerExecFlags &= ~(0x10000000 << battlerId); } void CancelMultiTurnMoves(u8 battler) @@ -6418,14 +6417,14 @@ u8 GetMoveTarget(u16 move, u8 setTarget) return targetBattler; } -static bool32 HasObedientBitSet(u8 battlerId) +static bool32 IsNotEventLegalMewOrDeoxys(u8 battlerId) { if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT) return TRUE; if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS && GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_MEW) return TRUE; - return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_OBEDIENCE, NULL); + return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_EVENT_LEGAL, NULL); } u8 IsMonDisobedient(void) @@ -6439,7 +6438,7 @@ u8 IsMonDisobedient(void) if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT) return 0; - if (HasObedientBitSet(gBattlerAttacker)) // only if species is Mew or Deoxys + if (IsNotEventLegalMewOrDeoxys(gBattlerAttacker)) // only if species is Mew or Deoxys { if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBattlerPosition(gBattlerAttacker) == 2) return 0; diff --git a/src/berry.c b/src/berry.c index 98264f37b..ea62deabf 100644 --- a/src/berry.c +++ b/src/berry.c @@ -11,7 +11,6 @@ #include "random.h" #include "string_util.h" #include "text.h" -#include "constants/berry.h" #include "constants/event_object_movement.h" #include "constants/items.h" @@ -1046,8 +1045,9 @@ void ClearBerryTrees(void) static bool32 BerryTreeGrow(struct BerryTree *tree) { - if (tree->growthSparkle) + if (tree->stopGrowth) return FALSE; + switch (tree->stage) { case BERRY_STAGE_NO_BERRY: @@ -1082,7 +1082,7 @@ void BerryTreeTimeUpdate(s32 minutes) { tree = &gSaveBlock1Ptr->berryTrees[i]; - if (tree->berry && tree->stage && !tree->growthSparkle) + if (tree->berry && tree->stage && !tree->stopGrowth) { if (minutes >= GetStageDurationByBerryType(tree->berry) * 71) { @@ -1111,7 +1111,7 @@ void BerryTreeTimeUpdate(s32 minutes) } } -void PlantBerryTree(u8 id, u8 berry, u8 stage, bool8 sparkle) +void PlantBerryTree(u8 id, u8 berry, u8 stage, bool8 allowGrowth) { struct BerryTree *tree = GetBerryTreeInfo(id); @@ -1125,8 +1125,10 @@ void PlantBerryTree(u8 id, u8 berry, u8 stage, bool8 sparkle) tree->minutesUntilNextStage *= 4; } - if (!sparkle) - tree->growthSparkle = TRUE; + // Stop growth, to keep tree at this stage until the player has seen it + // allowGrowth is always true for berry trees the player has planted + if (!allowGrowth) + tree->stopGrowth = TRUE; } void RemoveBerryTree(u8 id) @@ -1175,9 +1177,9 @@ void GetBerryCountStringByBerryType(u8 berry, u8* dest, u32 berryCount) GetBerryCountString(dest, GetBerryInfo(berry)->name, berryCount); } -void ResetBerryTreeSparkleFlag(u8 id) +void AllowBerryTreeGrowth(u8 id) { - GetBerryTreeInfo(id)->growthSparkle = FALSE; + GetBerryTreeInfo(id)->stopGrowth = FALSE; } static u8 BerryTreeGetNumStagesWatered(struct BerryTree *tree) @@ -1262,7 +1264,7 @@ void ObjectEventInteractionGetBerryTreeData(void) id = GetObjectEventBerryTreeId(gSelectedObjectEvent); berry = GetBerryTypeByBerryTreeId(id); - ResetBerryTreeSparkleFlag(id); + AllowBerryTreeGrowth(id); localId = gSpecialVar_LastTalked; num = gSaveBlock1Ptr->location.mapNum; group = gSaveBlock1Ptr->location.mapGroup; @@ -1313,7 +1315,7 @@ void ObjectEventInteractionPickBerryTree(void) void ObjectEventInteractionRemoveBerryTree(void) { RemoveBerryTree(GetObjectEventBerryTreeId(gSelectedObjectEvent)); - sub_8092EF0(gSpecialVar_LastTalked, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); + SetBerryTreeJustPicked(gSpecialVar_LastTalked, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); } bool8 PlayerHasBerries(void) @@ -1321,7 +1323,9 @@ bool8 PlayerHasBerries(void) return IsBagPocketNonEmpty(POCKET_BERRIES); } -void ResetBerryTreeSparkleFlags(void) +// Berry tree growth is frozen at their initial stage (usually, fully grown) until the player has seen the tree +// For all berry trees on screen, allow normal growth +void SetBerryTreesSeen(void) { s16 cam_left; s16 cam_top; @@ -1343,7 +1347,7 @@ void ResetBerryTreeSparkleFlags(void) cam_left = gObjectEvents[i].currentCoords.x; cam_top = gObjectEvents[i].currentCoords.y; if (left <= cam_left && cam_left <= right && top <= cam_top && cam_top <= bottom) - ResetBerryTreeSparkleFlag(gObjectEvents[i].trainerRange_berryTreeId); + AllowBerryTreeGrowth(gObjectEvents[i].trainerRange_berryTreeId); } } } diff --git a/src/berry_blender.c b/src/berry_blender.c index 08a25c58a..ede1f6e99 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -34,7 +34,6 @@ #include "new_game.h" #include "save.h" #include "strings.h" -#include "constants/berry.h" #include "constants/game_stat.h" #include "constants/items.h" #include "constants/rgb.h" @@ -1098,7 +1097,7 @@ static void CB2_LoadBerryBlender(void) } break; case 2: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); UpdateBlenderCenter(); sBerryBlender->mainState++; break; @@ -1112,7 +1111,7 @@ static void CB2_LoadBerryBlender(void) sBerryBlender->mainState++; break; case 5: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); sBerryBlender->mainState++; break; case 6: @@ -1327,7 +1326,7 @@ static void CB2_StartBlenderLink(void) sBerryBlender->mainState++; break; case 3: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); sBerryBlender->mainState++; break; case 4: @@ -1665,7 +1664,7 @@ static void CB2_StartBlenderLocal(void) sBerryBlender->mainState++; break; case 3: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); sBerryBlender->mainState++; sBerryBlender->framesToWait = 0; break; @@ -2896,7 +2895,7 @@ static void CB2_CheckPlayAgainLink(void) case 9: if (IsLinkTaskFinished()) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); sBerryBlender->gameEndState++; } break; diff --git a/src/berry_crush.c b/src/berry_crush.c index 84e2e2eba..635f2a639 100755 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -38,6 +38,8 @@ #include "constants/rgb.h" #include "constants/songs.h" +#define TAG_COUNTDOWN 0x1000 + struct BerryCrushGame_Player { u8 unk0[PLAYER_NAME_LENGTH + 1 + 4]; @@ -85,7 +87,7 @@ struct BerryCrushGame_5C u16 unk00; u8 unk02_0:1; u8 unk02_1:1; - u8 unk02_2:1; + u8 pushedAButton:1; u8 unk02_3:5; s8 unk03; u16 unk04; @@ -101,11 +103,13 @@ struct BerryCrushGame_68 u16 unk06; u16 unk08; u16 unk0A; - u16 unk0C[2][5]; + // 0: Number of A presses + // 1: Neatness + u16 stats[2][5]; u8 unk20[2][8]; }; -struct BerryCrushGame_138_C +struct BerryCrushPlayerSeatCoords { u8 unk0; u8 unk1; @@ -118,45 +122,45 @@ struct BerryCrushGame_138_C struct BerryCrushGame_138 { - u8 unk0; + u8 animBerryIdx; u8 unk1; u8 unk2; u8 unk3; - s16 unk4; - s16 unk6; - s16 unk8; - const struct BerryCrushGame_138_C *unkC[5]; - struct Sprite *unk20; - struct Sprite *unk24[5]; - struct Sprite *unk38[5]; - struct Sprite *unk4C[11]; - struct Sprite *unk78[2]; + s16 minutes; + s16 secondsInt; + s16 secondsFrac; + const struct BerryCrushPlayerSeatCoords *seatCoords[5]; + struct Sprite *coreSprite; + struct Sprite *impactSprites[5]; + struct Sprite *berrySprites[5]; + struct Sprite *sparkleSprites[11]; + struct Sprite *timerSprites[2]; u8 unk80; u8 filler81; u8 unk82; u8 unk83[5]; - u16 unk88[4][0x800]; + u16 bgBuffers[4][0x800]; }; struct BerryCrushGame { - MainCallback unk0; - u32 (* unk4)(struct BerryCrushGame *, u8 *); - u8 unk8; - u8 unk9; + MainCallback savedCallback; + u32 (*cmdCallback)(struct BerryCrushGame *, u8 *); + u8 localId; + u8 playerCount; u8 mainTask; - u8 unkB; - u8 unkC; + u8 textSpeed; + u8 cmdState; u8 unkD; - u8 unkE; - u8 unkF; + u8 nextCmd; + u8 afterPalFadeCmd; u16 unk10; - u16 unk12; + u16 gameState; u16 unk14; - u16 unk16; + u16 pressingSpeed; s16 unk18; s16 unk1A; - s32 unk1C; + s32 powder; s32 unk20; u8 unk24; u8 unk25_0:1; @@ -166,17 +170,17 @@ struct BerryCrushGame u8 unk25_4:1; u8 unk25_5:3; u16 unk26; - u16 unk28; - s16 unk2A; - s16 unk2C; + u16 timer; + s16 depth; + s16 vibration; s16 unk2E; s16 unk30; s16 unk32; s16 unk34; - u8 unk36[0xC]; - u16 unk42[6]; - u16 unk4E[7]; - struct BerryCrushGame_5C unk5C; + u8 commandParams[0xC]; + u16 sendCmd[6]; + u16 recvCmd[7]; + struct BerryCrushGame_5C localState; struct BerryCrushGame_68 unk68; struct BerryCrushGame_Player unk98[5]; struct BerryCrushGame_138 unk138; @@ -186,47 +190,47 @@ static void VBlankCB(void); static void MainCB(void); static void MainTask(u8); static void ParseName_Options(struct BerryCrushGame *); -void sub_8022BEC(u16, u8, u8 *); +static void BerryCrush_RunOrScheduleCommand(u16, u8, u8 *); static void BerryCrush_SetPaletteFadeParams(u8 *, bool8, u32, s8, u8, u8, u16); -static int sub_8021450(struct BerryCrushGame *); -void sub_8022588(struct BerryCrushGame *); -void sub_8022600(struct BerryCrushGame *); -void sub_80226D0(struct BerryCrushGame *); -void sub_8022730(struct BerryCrushGame *); -void sub_8022960(struct BerryCrushGame *); -void sub_8022524(struct BerryCrushGame_138 *, u16); -void sub_8022B28(struct Sprite *); -void sub_8022554(struct BerryCrushGame_138 *r0); -void sub_8024578(struct BerryCrushGame *); -void sub_8024644(u8 *, u32, u32, u32, u32); -static void sub_8022A20(struct Sprite *sprite); +static s32 sub_8021450(struct BerryCrushGame *); +static void sub_8022588(struct BerryCrushGame *); +static void sub_8022600(struct BerryCrushGame *); +static void sub_80226D0(struct BerryCrushGame *); +static void sub_8022730(struct BerryCrushGame *); +static void sub_8022960(struct BerryCrushGame *); +static void BerryCrush_PrintTimeOnSprites(struct BerryCrushGame_138 *, u16); +static void sub_8022B28(struct Sprite *); +static void BerryCrush_HideTimerSprites(struct BerryCrushGame_138 *r0); +static void sub_8024578(struct BerryCrushGame *); +static void BerryCrush_SetShowMessageParams(u8 *params, u8 stringId, u8 flags, u16 waitKeys, u8 followupCmd); +static void SpriteCB_BerryCrushImpact(struct Sprite *sprite); static u32 BerryCrushCommand_BeginNormalPaletteFade(struct BerryCrushGame *r6, u8 *r1); -static u32 sub_8022CB0(struct BerryCrushGame *r4, u8 *r5); -static u32 sub_8022D14(struct BerryCrushGame *r7, u8 *r5); -static u32 sub_8022E1C(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); -static u32 sub_8022E3C(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); -static u32 sub_8022E5C(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); -static u32 sub_8022EAC(struct BerryCrushGame *r4, u8 *r5); -static u32 sub_8022F04(struct BerryCrushGame *r0, __attribute__((unused)) u8 *r1); -static u32 sub_8022F1C(struct BerryCrushGame *r5, u8 *r2); -static u32 sub_8023070(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); -static u32 sub_80231B8(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); -static u32 sub_80232EC(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); -static u32 sub_80238F0(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); -static u32 sub_8023998(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); -static u32 sub_8023A30(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); -static u32 sub_8023BC0(struct BerryCrushGame *r5, u8 *r6); -static u32 sub_8023CAC(struct BerryCrushGame *r7, __attribute__((unused)) u8 *r1); -static u32 sub_8024048(struct BerryCrushGame *r5, u8 *r6); -static u32 sub_8024134(struct BerryCrushGame *r5, u8 *r4); -static u32 sub_8024228(struct BerryCrushGame *r5, u8 *r6); -static u32 sub_80242E0(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); -static u32 sub_80243BC(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1); -static u32 sub_8024444(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1); -static u32 sub_8024508(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1); -static u32 sub_8024568(__attribute__((unused)) struct BerryCrushGame *r0, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_WaitPaletteFade(struct BerryCrushGame *r4, u8 *r5); +static u32 BerryCrushCommand_PrintMessage(struct BerryCrushGame *r7, u8 *r5); +static u32 BerryCrushCommand_InitGfx(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_TeardownGfx(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_SignalReadyToBegin(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_AskPickBerry(struct BerryCrushGame *r4, u8 *r5); +static u32 BerryCrushCommand_GoToBerryPouch(struct BerryCrushGame *r0, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_WaitForOthersToPickBerries(struct BerryCrushGame *r5, u8 *r2); +static u32 BerryCrushCommand_DropBerriesIntoCrusher(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_DropLid(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_Countdown(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_PlayGame_Master(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_PlayGame_Slave(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_FinishGame(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_HandleTimeUp(struct BerryCrushGame *r5, u8 *r6); +static u32 BerryCrushCommand_TabulateResults(struct BerryCrushGame *r7, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_ShowResults(struct BerryCrushGame *r5, u8 *r6); +static u32 BerryCrushCommand_SaveGame(struct BerryCrushGame *r5, u8 *r4); +static u32 BerryCrushCommand_AskPlayAgain(struct BerryCrushGame *r5, u8 *r6); +static u32 BerryCrushCommand_CommunicatePlayAgainResponses(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_FadeOutToPlayAgain(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_PlayAgainFailureMessage(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_GracefulExit(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1); +static u32 BerryCrushCommand_Quit(__attribute__((unused)) struct BerryCrushGame *r0, __attribute__((unused)) u8 *r1); -static EWRAM_DATA struct BerryCrushGame *gBerryCrushGame = NULL; +static EWRAM_DATA struct BerryCrushGame *sBerryCrushGamePtr = NULL; static const u8 gUnknown_082F325C[] = { 1, 2, 4, 8, 16, 32, 64, 128 }; static const u8 gUnknown_082F3264[] = { 0, 1, 2, 3, 5, 0, 0, 0 }; @@ -251,7 +255,7 @@ static const u8 gUnknown_082F3290[][4] = {3, 5, 3, 0}, }; -static const u8 *const gUnknown_082F32A4[] = +static const u8 *const sBerryCrushMessages[] = { gText_ReadyToBerryCrush, gText_WaitForAllChooseBerry, @@ -417,14 +421,16 @@ static const u8 gUnknown_082F3344[][4] = static const u32 sPressingSpeedConversionTable[] = { - 50000000 / (1 << 0), - 50000000 / (1 << 1), - 50000000 / (1 << 2), - 50000000 / (1 << 3), - 50000000 / (1 << 4), - 50000000 / (1 << 5), - 50000000 / (1 << 6), - 50000000 / (1 << 7), + // Decimal point is vertically aligned with the pixel + // directly between the >< below. + 50000000, // 50 + 25000000, // 25 + 12500000, // 12.5 + 6250000, // 6.25 + 3125000, // 3.125 + 1562500, // 1.5625 + 781250, // 0.78125 + 390625 // 0.390625 }; static const u16 gBerryCrushGrinderBasePal[] = INCBIN_U16("graphics/link_games/berrycrush_grinder_base.gbapal"); @@ -446,7 +452,7 @@ static const u8 gUnknown_082F417C[][5] = {0, 1, 3, 2, 4}, }; -static const struct BerryCrushGame_138_C gUnknown_082F4190[] = +static const struct BerryCrushPlayerSeatCoords gUnknown_082F4190[] = { { .unk0 = 0, @@ -518,7 +524,7 @@ static const s8 gUnknown_082F41D2[][2] = { 40, -16}, }; -static const u16 gUnknown_082F41E8[] = {5, 6, 7, 8, 9, 0}; +static const u16 sPlayerBerrySpriteTags[] = {5, 6, 7, 8, 9, 0}; static const struct CompressedSpriteSheet gUnknown_082F41F4[] = { @@ -534,14 +540,10 @@ static const struct SpriteSheet gUnknown_082F420C[] = }; -static const struct SpritePalette gUnknown_082F421C[] = +static const struct SpritePalette sSpritePals[] = { { .data = gBerryCrushGrinderBasePal, .tag = 1 }, { .data = gBerryCrushMiscSpritesPal, .tag = 2 }, -}; - -static const struct SpritePalette gUnknown_082F422C[] = -{ { .data = gBerryCrushTimerDigitsPal, .tag = 4 }, {} }; @@ -620,24 +622,24 @@ static const union AffineAnimCmd gUnknown_082F42D0[] = AFFINEANIMCMD_JUMP(1) }; -static const union AnimCmd *const gUnknown_082F42E8[] = +static const union AnimCmd *const sAnimTable_BerryCrushCore[] = { gUnknown_082F423C }; -static const union AnimCmd *const gUnknown_082F42EC[] = +static const union AnimCmd *const sAnimTable_BerryCrushImpact[] = { gUnknown_082F4244, gUnknown_082F4254, }; -static const union AnimCmd *const gUnknown_082F42F4[] = +static const union AnimCmd *const sAnimTable_BerryCrushPowderSparkles[] = { gUnknown_082F4268, gUnknown_082F4284, }; -static const union AnimCmd *const gUnknown_082F42FC[] = +static const union AnimCmd *const sAnimTable_BerryCrushTimer[] = { gUnknown_082F42A8 }; @@ -653,51 +655,51 @@ static const union AffineAnimCmd *const gUnknown_082F4304[] = gUnknown_082F42D0, }; -static const struct SpriteTemplate gUnknown_082F430C = +static const struct SpriteTemplate sSpriteTemplate_BerryCrushCore = { .tileTag = 1, .paletteTag = 1, .oam = &gOamData_AffineOff_ObjNormal_64x64, - .anims = gUnknown_082F42E8, + .anims = sAnimTable_BerryCrushCore, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy }; -static const struct SpriteTemplate gUnknown_082F4324 = +static const struct SpriteTemplate sSpriteTemplate_BerryCrushImpact = { .tileTag = 2, .paletteTag = 2, .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = gUnknown_082F42EC, + .anims = sAnimTable_BerryCrushImpact, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8022A20 + .callback = SpriteCB_BerryCrushImpact }; -static const struct SpriteTemplate gUnknown_082F433C = +static const struct SpriteTemplate sSpriteTemplate_BerryCrushPowderSparkles = { .tileTag = 3, .paletteTag = 2, .oam = &gOamData_AffineOff_ObjNormal_16x16, - .anims = gUnknown_082F42F4, + .anims = sAnimTable_BerryCrushPowderSparkles, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy }; -static const struct SpriteTemplate gUnknown_082F4354 = +static const struct SpriteTemplate sSpriteTemplate_BerryCrushTimer = { .tileTag = 4, .paletteTag = 4, .oam = &gOamData_AffineOff_ObjNormal_8x16, - .anims = gUnknown_082F42FC, + .anims = sAnimTable_BerryCrushTimer, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy }; -static const struct SpriteTemplate gUnknown_082F436C = +static const struct SpriteTemplate sSpriteTemplate_PlayerBerry = { .tileTag = 5, .paletteTag = 5, @@ -708,7 +710,7 @@ static const struct SpriteTemplate gUnknown_082F436C = .callback = SpriteCallbackDummy }; -static const struct DigitObjUtilTemplate gUnknown_082F4384[] = +static const struct DigitObjUtilTemplate sDigitObjTemplates[] = { { .strConvMode = 1, @@ -720,7 +722,7 @@ static const struct DigitObjUtilTemplate gUnknown_082F4384[] = .x = 156, .y = 0, .spriteSheet = gUnknown_082F420C, - .spritePal = gUnknown_082F422C, + .spritePal = &sSpritePals[2], }, { .strConvMode = 0, @@ -732,7 +734,7 @@ static const struct DigitObjUtilTemplate gUnknown_082F4384[] = .x = 180, .y = 0, .spriteSheet = gUnknown_082F420C, - .spritePal = gUnknown_082F422C, + .spritePal = &sSpritePals[2], }, { .strConvMode = 0, @@ -744,11 +746,11 @@ static const struct DigitObjUtilTemplate gUnknown_082F4384[] = .x = 204, .y = 0, .spriteSheet = gUnknown_082F420C, - .spritePal = gUnknown_082F422C, + .spritePal = &sSpritePals[2], } }; -static const u8 *const gUnknown_082F43B4[] = +static const u8 *const sBCRankingHeaders[] = { gText_SpaceTimes2, gText_XDotY, @@ -758,34 +760,34 @@ static const u8 *const gUnknown_082F43B4[] = gText_PressingPowerRankings, }; -static u32 (*const gUnknown_082F43CC[])(struct BerryCrushGame *, u8 *) = +static u32 (*const sBerryCrushCommands[])(struct BerryCrushGame *, u8 *) = { NULL, BerryCrushCommand_BeginNormalPaletteFade, - sub_8022CB0, - sub_8022D14, - sub_8022E1C, - sub_8022E3C, - sub_8022E5C, - sub_8022EAC, - sub_8022F04, - sub_8022F1C, - sub_8023070, - sub_80231B8, - sub_80232EC, - sub_80238F0, - sub_8023998, - sub_8023A30, - sub_8023BC0, - sub_8023CAC, - sub_8024048, - sub_8024134, - sub_8024228, - sub_80242E0, - sub_80243BC, - sub_8024444, - sub_8024508, - sub_8024568, + BerryCrushCommand_WaitPaletteFade, + BerryCrushCommand_PrintMessage, + BerryCrushCommand_InitGfx, + BerryCrushCommand_TeardownGfx, + BerryCrushCommand_SignalReadyToBegin, + BerryCrushCommand_AskPickBerry, + BerryCrushCommand_GoToBerryPouch, + BerryCrushCommand_WaitForOthersToPickBerries, + BerryCrushCommand_DropBerriesIntoCrusher, + BerryCrushCommand_DropLid, + BerryCrushCommand_Countdown, + BerryCrushCommand_PlayGame_Master, + BerryCrushCommand_PlayGame_Slave, + BerryCrushCommand_FinishGame, + BerryCrushCommand_HandleTimeUp, + BerryCrushCommand_TabulateResults, + BerryCrushCommand_ShowResults, + BerryCrushCommand_SaveGame, + BerryCrushCommand_AskPlayAgain, + BerryCrushCommand_CommunicatePlayAgainResponses, + BerryCrushCommand_FadeOutToPlayAgain, + BerryCrushCommand_PlayAgainFailureMessage, + BerryCrushCommand_GracefulExit, + BerryCrushCommand_Quit, }; static const u8 gUnknown_082F4434[][4] = @@ -797,23 +799,23 @@ static const u8 gUnknown_082F4434[][4] = }; static const u8 gUnknown_082F4444[] = {5, 7, 9, 12}; -static const u8 gUnknown_082F4448[] = {3, 7, 15, 31}; +static const u8 sReceivedPlayerBitmasks[] = {0x03, 0x07, 0x0F, 0x1F}; struct BerryCrushGame * GetBerryCrushGame(void) { - return gBerryCrushGame; + return sBerryCrushGamePtr; } u32 QuitBerryCrush(MainCallback callback) { - if (!gBerryCrushGame) + if (!sBerryCrushGamePtr) return 2; if (!callback) - callback = gBerryCrushGame->unk0; + callback = sBerryCrushGamePtr->savedCallback; - DestroyTask(gBerryCrushGame->mainTask); - FREE_AND_SET_NULL(gBerryCrushGame); + DestroyTask(sBerryCrushGamePtr->mainTask); + FREE_AND_SET_NULL(sBerryCrushGamePtr); SetMainCallback2(callback); if (callback == CB2_ReturnToField) { @@ -850,8 +852,8 @@ void StartBerryCrush(MainCallback callback) return; } - gBerryCrushGame = AllocZeroed(sizeof(*gBerryCrushGame)); - if (!gBerryCrushGame) + sBerryCrushGamePtr = AllocZeroed(sizeof(struct BerryCrushGame)); + if (!sBerryCrushGamePtr) { SetMainCallback2(callback); Rfu.unk_10 = 0; @@ -860,17 +862,17 @@ void StartBerryCrush(MainCallback callback) return; } - gBerryCrushGame->unk0 = callback; - gBerryCrushGame->unk8 = multiplayerId; - gBerryCrushGame->unk9 = playerCount; - ParseName_Options(gBerryCrushGame); - gBerryCrushGame->unk12 = 1; - gBerryCrushGame->unkE = 1; - gBerryCrushGame->unkF = 6; - BerryCrush_SetPaletteFadeParams(gBerryCrushGame->unk36, 1, -1, 0, 16, 0, 0); - sub_8022BEC(4, 1, gBerryCrushGame->unk36); + sBerryCrushGamePtr->savedCallback = callback; + sBerryCrushGamePtr->localId = multiplayerId; + sBerryCrushGamePtr->playerCount = playerCount; + ParseName_Options(sBerryCrushGamePtr); + sBerryCrushGamePtr->gameState = 1; + sBerryCrushGamePtr->nextCmd = 1; + sBerryCrushGamePtr->afterPalFadeCmd = 6; + BerryCrush_SetPaletteFadeParams(sBerryCrushGamePtr->commandParams, 1, -1, 0, 16, 0, 0); + BerryCrush_RunOrScheduleCommand(4, 1, sBerryCrushGamePtr->commandParams); SetMainCallback2(MainCB); - gBerryCrushGame->mainTask = CreateTask(MainTask, 8); + sBerryCrushGamePtr->mainTask = CreateTask(MainTask, 8); gTextFlags.autoScroll = 0; } @@ -881,18 +883,18 @@ static void GetBerryFromBag(void) else RemoveBagItem(gSpecialVar_ItemId, 1); - gBerryCrushGame->unk98[gBerryCrushGame->unk8].unkC = gSpecialVar_ItemId - FIRST_BERRY_INDEX; - gBerryCrushGame->unkE = 1; - gBerryCrushGame->unkF = 9; - BerryCrush_SetPaletteFadeParams(gBerryCrushGame->unk36, 0, -1, 0, 16, 0, 0); - sub_8022BEC(4, 1, gBerryCrushGame->unk36); - gBerryCrushGame->mainTask = CreateTask(MainTask, 8); + sBerryCrushGamePtr->unk98[sBerryCrushGamePtr->localId].unkC = gSpecialVar_ItemId - FIRST_BERRY_INDEX; + sBerryCrushGamePtr->nextCmd = 1; + sBerryCrushGamePtr->afterPalFadeCmd = 9; + BerryCrush_SetPaletteFadeParams(sBerryCrushGamePtr->commandParams, 0, -1, 0, 16, 0, 0); + BerryCrush_RunOrScheduleCommand(4, 1, sBerryCrushGamePtr->commandParams); + sBerryCrushGamePtr->mainTask = CreateTask(MainTask, 8); SetMainCallback2(MainCB); } static void BerryCrush_SetupMainTask(void) { - DestroyTask(gBerryCrushGame->mainTask); + DestroyTask(sBerryCrushGamePtr->mainTask); ChooseBerryForMachine(GetBerryFromBag); } @@ -910,50 +912,50 @@ static void BerryCrush_SaveResults(void) { u32 var0, var1; - var0 = gBerryCrushGame->unk68.unk04; + var0 = sBerryCrushGamePtr->unk68.unk04; var0 = Q_24_8(var0); var0 = MathUtil_Div32(var0, Q_24_8(60)); - var1 = gBerryCrushGame->unk68.unk0A; + var1 = sBerryCrushGamePtr->unk68.unk0A; var1 = Q_24_8(var1); var1 = MathUtil_Div32(var1, var0) & 0xFFFF; - gBerryCrushGame->unk16 = var1; - switch (gBerryCrushGame->unk9) + sBerryCrushGamePtr->pressingSpeed = var1; + switch (sBerryCrushGamePtr->playerCount) { case 2: - if (gBerryCrushGame->unk16 > gSaveBlock2Ptr->berryCrush.berryCrushResults[0]) + if (sBerryCrushGamePtr->pressingSpeed > gSaveBlock2Ptr->berryCrush.berryCrushResults[0]) { - gBerryCrushGame->unk25_1 = 1; - gSaveBlock2Ptr->berryCrush.berryCrushResults[0] = gBerryCrushGame->unk16; + sBerryCrushGamePtr->unk25_1 = 1; + gSaveBlock2Ptr->berryCrush.berryCrushResults[0] = sBerryCrushGamePtr->pressingSpeed; } break; case 3: - if (gBerryCrushGame->unk16 > gSaveBlock2Ptr->berryCrush.berryCrushResults[1]) + if (sBerryCrushGamePtr->pressingSpeed > gSaveBlock2Ptr->berryCrush.berryCrushResults[1]) { - gBerryCrushGame->unk25_1 = 1; - gSaveBlock2Ptr->berryCrush.berryCrushResults[1] = gBerryCrushGame->unk16; + sBerryCrushGamePtr->unk25_1 = 1; + gSaveBlock2Ptr->berryCrush.berryCrushResults[1] = sBerryCrushGamePtr->pressingSpeed; } break; case 4: - if (gBerryCrushGame->unk16 > gSaveBlock2Ptr->berryCrush.berryCrushResults[2]) + if (sBerryCrushGamePtr->pressingSpeed > gSaveBlock2Ptr->berryCrush.berryCrushResults[2]) { - gBerryCrushGame->unk25_1 = 1; - gSaveBlock2Ptr->berryCrush.berryCrushResults[2] = gBerryCrushGame->unk16; + sBerryCrushGamePtr->unk25_1 = 1; + gSaveBlock2Ptr->berryCrush.berryCrushResults[2] = sBerryCrushGamePtr->pressingSpeed; } break; case 5: - if (gBerryCrushGame->unk16 > gSaveBlock2Ptr->berryCrush.berryCrushResults[3]) + if (sBerryCrushGamePtr->pressingSpeed > gSaveBlock2Ptr->berryCrush.berryCrushResults[3]) { - gBerryCrushGame->unk25_1 = 1; - gSaveBlock2Ptr->berryCrush.berryCrushResults[3] = gBerryCrushGame->unk16; + sBerryCrushGamePtr->unk25_1 = 1; + gSaveBlock2Ptr->berryCrush.berryCrushResults[3] = sBerryCrushGamePtr->pressingSpeed; } break; } - gBerryCrushGame->unk1C = gBerryCrushGame->unk68.unk00; - if (GiveBerryPowder(gBerryCrushGame->unk1C)) + sBerryCrushGamePtr->powder = sBerryCrushGamePtr->unk68.unk00; + if (GiveBerryPowder(sBerryCrushGamePtr->powder)) return; - gBerryCrushGame->unk25_0 = 1; + sBerryCrushGamePtr->unk25_0 = 1; } static void VBlankCB(void) @@ -973,17 +975,17 @@ static void MainCB(void) static void MainTask(u8 taskId) { - if (gBerryCrushGame->unk4) - gBerryCrushGame->unk4(gBerryCrushGame, gBerryCrushGame->unk36); + if (sBerryCrushGamePtr->cmdCallback) + sBerryCrushGamePtr->cmdCallback(sBerryCrushGamePtr, sBerryCrushGamePtr->commandParams); - sub_8021450(gBerryCrushGame); + sub_8021450(sBerryCrushGamePtr); } static void ParseName_Options(struct BerryCrushGame *arg0) { u8 i = 0; - for (; i < arg0->unk9; i++) + for (; i < arg0->playerCount; i++) StringCopy(arg0->unk98[i].unk0, gLinkPlayers[i].name); for (; i < 5; i++) { @@ -994,13 +996,13 @@ static void ParseName_Options(struct BerryCrushGame *arg0) switch (gSaveBlock2Ptr->optionsTextSpeed) { case OPTIONS_TEXT_SPEED_SLOW: - arg0->unkB = 8; + arg0->textSpeed = 8; break; case OPTIONS_TEXT_SPEED_MID: - arg0->unkB = 4; + arg0->textSpeed = 4; break; case OPTIONS_TEXT_SPEED_FAST: - arg0->unkB = 1; + arg0->textSpeed = 1; break; } } @@ -1012,7 +1014,7 @@ s32 InitBerryCrushDisplay(void) if (!game) return -1; - switch (game->unkC) + switch (game->cmdState) { case 0: SetVBlankCallback(NULL); @@ -1034,9 +1036,9 @@ s32 InitBerryCrushDisplay(void) case 3: ResetBgsAndClearDma3BusyFlags(0); InitBgsFromTemplates(0, gUnknown_082F32C8, ARRAY_COUNT(gUnknown_082F32C8)); - SetBgTilemapBuffer(1, game->unk138.unk88[0]); - SetBgTilemapBuffer(2, game->unk138.unk88[2]); - SetBgTilemapBuffer(3, game->unk138.unk88[3]); + SetBgTilemapBuffer(1, game->unk138.bgBuffers[0]); + SetBgTilemapBuffer(2, game->unk138.bgBuffers[2]); + SetBgTilemapBuffer(3, game->unk138.bgBuffers[3]); ChangeBgX(0, 0, 0); ChangeBgY(0, 0, 0); ChangeBgX(2, 0, 0); @@ -1089,28 +1091,28 @@ s32 InitBerryCrushDisplay(void) break; case 9: gPaletteFade.bufferTransferDisabled = FALSE; - BlendPalettes(0xFFFFFFFF, 16, RGB_BLACK); + BlendPalettes(PALETTES_ALL, 16, RGB_BLACK); ShowBg(0); ShowBg(1); ShowBg(2); ShowBg(3); SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); BerryCrush_SetVBlankCB(); - game->unkC = 0; + game->cmdState = 0; return 1; } - game->unkC++; + game->cmdState++; return 0; } -int sub_802130C(void) +static s32 BerryCrush_TeardownBgs(void) { struct BerryCrushGame *var0 = GetBerryCrushGame(); if (!var0) return -1; - switch (var0->unkC) + switch (var0->cmdState) { case 0: Rfu_SetLinkStandbyCallback(); @@ -1121,7 +1123,7 @@ int sub_802130C(void) // fall through. The original author forgot to use "break" here // because this will call BeginNormalPaletteFade() twice. case 2: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); UpdatePaletteFade(); break; case 3: @@ -1156,21 +1158,21 @@ int sub_802130C(void) DigitObjUtil_Free(); break; case 7: - var0->unkC = 0; + var0->cmdState = 0; return 1; } - var0->unkC++; + var0->cmdState++; return 0; } -static int sub_8021450(struct BerryCrushGame *arg0) +static s32 sub_8021450(struct BerryCrushGame *arg0) { - gSpriteCoordOffsetY = arg0->unk2A + arg0->unk2C; + gSpriteCoordOffsetY = arg0->depth + arg0->vibration; SetGpuReg(REG_OFFSET_BG1VOFS, -gSpriteCoordOffsetY); - if (arg0->unk12 == 7) + if (arg0->gameState == 7) { - sub_8022524(&arg0->unk138, arg0->unk28); + BerryCrush_PrintTimeOnSprites(&arg0->unk138, arg0->timer); } return 0; @@ -1178,40 +1180,40 @@ static int sub_8021450(struct BerryCrushGame *arg0) void sub_8021488(struct BerryCrushGame *arg0) { - arg0->unk2A = -104; - arg0->unk2C = 0; + arg0->depth = -104; + arg0->vibration = 0; gSpriteCoordOffsetX = 0; gSpriteCoordOffsetY = -104; } -void sub_80214A8(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1) +static void BerryCrush_CreateBerrySprites(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1) { u8 i; u8 spriteId; s16 var0, var1; s16 *data; - int var3; + s32 var3; s16 var5; u32 var6; - for (i = 0; i < arg0->unk9; i++) + for (i = 0; i < arg0->playerCount; i++) { spriteId = AddCustomItemIconSprite( - &gUnknown_082F436C, - gUnknown_082F41E8[i], - gUnknown_082F41E8[i], - arg0->unk98[i].unkC + 133); - arg1->unk38[i] = &gSprites[spriteId]; - arg1->unk38[i]->oam.priority = 3; - arg1->unk38[i]->affineAnimPaused = TRUE; - arg1->unk38[i]->pos1.x = arg1->unkC[i]->unk8 + 120; - arg1->unk38[i]->pos1.y = -16; - data = arg1->unk38[i]->data; + &sSpriteTemplate_PlayerBerry, + sPlayerBerrySpriteTags[i], + sPlayerBerrySpriteTags[i], + arg0->unk98[i].unkC + FIRST_BERRY_INDEX); + arg1->berrySprites[i] = &gSprites[spriteId]; + arg1->berrySprites[i]->oam.priority = 3; + arg1->berrySprites[i]->affineAnimPaused = TRUE; + arg1->berrySprites[i]->pos1.x = arg1->seatCoords[i]->unk8 + 120; + arg1->berrySprites[i]->pos1.y = -16; + data = arg1->berrySprites[i]->data; var5 = 512; data[1] = var5; data[2] = 32; data[7] = 112; - var0 = arg1->unkC[i]->unkA - arg1->unkC[i]->unk8; + var0 = arg1->seatCoords[i]->unkA - arg1->seatCoords[i]->unk8; var3 = var0; if (var0 < 0) var3 += 3; @@ -1221,18 +1223,18 @@ void sub_80214A8(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1) var6 = var5 + 32; var6 = var6 / 2; var1 = MathUtil_Div16Shift(7, Q_8_8(63.5), var6); - data[0] = (u16)arg1->unk38[i]->pos1.x * 128; + data[0] = (u16)arg1->berrySprites[i]->pos1.x * 128; data[3] = MathUtil_Div16Shift(7, var0, var1); var1 = MathUtil_Mul16Shift(7, var1, 85); data[4] = 0; data[5] = MathUtil_Div16Shift(7, Q_8_8(63.5), var1); data[7] |= 0x8000; - if (arg1->unkC[i]->unk8 < 0) - StartSpriteAffineAnim(arg1->unk38[i], 1); + if (arg1->seatCoords[i]->unk8 < 0) + StartSpriteAffineAnim(arg1->berrySprites[i], 1); } } -void sub_8021608(struct Sprite *sprite) +static void SpriteCB_DropBerryIntoCrusher(struct Sprite *sprite) { s16 *data = sprite->data; @@ -1259,13 +1261,13 @@ void sub_8021608(struct Sprite *sprite) } } -void sub_80216A8(struct BerryCrushGame *arg0, __attribute__((unused)) struct BerryCrushGame_138 *arg1) +void BerryCrushFreeBerrySpriteGfx(struct BerryCrushGame *arg0, __attribute__((unused)) struct BerryCrushGame_138 *arg1) { u8 i; - for (i = 0; i < arg0->unk9; i++) + for (i = 0; i < arg0->playerCount; i++) { - FreeSpritePaletteByTag(gUnknown_082F41E8[i]); - FreeSpriteTilesByTag(gUnknown_082F41E8[i]); + FreeSpritePaletteByTag(sPlayerBerrySpriteTags[i]); + FreeSpriteTilesByTag(sPlayerBerrySpriteTags[i]); } } @@ -1277,8 +1279,8 @@ void sub_80216E0(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1) u16 var, var2; sp4 = 0; - var4E = (struct BerryCrushGame_4E *)arg0->unk4E; - for (i = 0; i < arg0->unk9; i++) + var4E = (struct BerryCrushGame_4E *)arg0->recvCmd; + for (i = 0; i < arg0->playerCount; i++) { var = var4E->unkA >> (i * 3); var &= 7; @@ -1286,14 +1288,14 @@ void sub_80216E0(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1) { sp4++; if (var & 0x4) - StartSpriteAnim(arg1->unk24[i], 1); + StartSpriteAnim(arg1->impactSprites[i], 1); else - StartSpriteAnim(arg1->unk24[i], 0); + StartSpriteAnim(arg1->impactSprites[i], 0); - arg1->unk24[i]->invisible = FALSE; - arg1->unk24[i]->animPaused = FALSE; - arg1->unk24[i]->pos2.x = gUnknown_082F41CC[(var % 4) - 1][0]; - arg1->unk24[i]->pos2.y = gUnknown_082F41CC[(var % 4) - 1][1]; + arg1->impactSprites[i]->invisible = FALSE; + arg1->impactSprites[i]->animPaused = FALSE; + arg1->impactSprites[i]->pos2.x = gUnknown_082F41CC[(var % 4) - 1][0]; + arg1->impactSprites[i]->pos2.y = gUnknown_082F41CC[(var % 4) - 1][1]; } } @@ -1303,21 +1305,21 @@ void sub_80216E0(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1) } else { - var = (u8)(arg0->unk28 % 3); + var = (u8)(arg0->timer % 3); var2 = var; for (i = 0; i < var4E->unkC * 2 + 3; i++) { - if (arg1->unk4C[i]->invisible) + if (arg1->sparkleSprites[i]->invisible) { - arg1->unk4C[i]->callback = sub_8022B28; - arg1->unk4C[i]->pos1.x = gUnknown_082F41D2[i][0] + 120; - arg1->unk4C[i]->pos1.y = gUnknown_082F41D2[i][1] + 136 - (var * 4); - arg1->unk4C[i]->pos2.x = gUnknown_082F41D2[i][0] + (gUnknown_082F41D2[i][0] / (var2 * 4)); - arg1->unk4C[i]->pos2.y = gUnknown_082F41D2[i][1]; + arg1->sparkleSprites[i]->callback = sub_8022B28; + arg1->sparkleSprites[i]->pos1.x = gUnknown_082F41D2[i][0] + 120; + arg1->sparkleSprites[i]->pos1.y = gUnknown_082F41D2[i][1] + 136 - (var * 4); + arg1->sparkleSprites[i]->pos2.x = gUnknown_082F41D2[i][0] + (gUnknown_082F41D2[i][0] / (var2 * 4)); + arg1->sparkleSprites[i]->pos2.y = gUnknown_082F41D2[i][1]; if (var4E->unk4_1) - StartSpriteAnim(arg1->unk4C[i], 1); + StartSpriteAnim(arg1->sparkleSprites[i], 1); else - StartSpriteAnim(arg1->unk4C[i], 0); + StartSpriteAnim(arg1->sparkleSprites[i], 0); var++; if (var > 3) @@ -1345,50 +1347,50 @@ bool32 sub_80218D4(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1) { u8 i; - for (i = 0; i < arg0->unk9; i++) + for (i = 0; i < arg0->playerCount; i++) { - if (!arg1->unk24[i]->invisible) + if (!arg1->impactSprites[i]->invisible) return FALSE; } for (i = 0; i < 11; i++) { - if (!arg1->unk4C[i]->invisible) + if (!arg1->sparkleSprites[i]->invisible) return FALSE; } - if (arg0->unk2C != 0) - arg0->unk2C = 0; + if (arg0->vibration != 0) + arg0->vibration = 0; return TRUE; } -void sub_8021944(struct BerryCrushGame_138 *arg0, u16 arg1) +static void FramesToMinSec(struct BerryCrushGame_138 *arg0, u16 arg1) { u8 i = 0; - u32 r7 = 0; + u32 fractionalFrames = 0; s16 r3 = 0; - arg0->unk4 = arg1 / 3600; - arg0->unk6 = (arg1 % 3600) / 60; + arg0->minutes = arg1 / 3600; + arg0->secondsInt = (arg1 % 3600) / 60; r3 = MathUtil_Mul16(Q_8_8(arg1 % 60), 4); for (i = 0; i < 8; i++) { if ((r3 >> (7 - i)) & 1) - r7 += sPressingSpeedConversionTable[i]; + fractionalFrames += sPressingSpeedConversionTable[i]; } - arg0->unk8 = r7 / 1000000; + arg0->secondsFrac = fractionalFrames / 1000000; } -void sub_80219C8(u8 windowId, u8 left, u8 colorId, const u8 *string) +static void PrintTextCentered(u8 windowId, u8 left, u8 colorId, const u8 *string) { left = (left * 4) - (GetStringWidth(2, string, -1) / 2u); AddTextPrinterParameterized3(windowId, 2, left, 0, sBerryCrushTextColorTable[colorId], 0, string); } -void sub_8021A28(struct BerryCrushGame * sp0C, u8 sp10, u8 sp14, u8 sp18) +static void PrintBerryCrushResultWindow(struct BerryCrushGame * sp0C, u8 sp10, u8 sp14, u8 sp18) { u8 r8; u8 sp1C = 0; @@ -1403,37 +1405,37 @@ void sub_8021A28(struct BerryCrushGame * sp0C, u8 sp10, u8 sp14, u8 sp18) sp18 -= 16; if (sp10 == 2) sp18 -= 42; - r6 = sp18 - 14 * sp0C->unk9; + r6 = sp18 - 14 * sp0C->playerCount; if (r6 > 0) r6 = r6 / 2 + 16; else r6 = 16; - for (r8 = 0; r8 < sp0C->unk9; r6 += 14, ++r8) + for (r8 = 0; r8 < sp0C->playerCount; r6 += 14, ++r8) { DynamicPlaceholderTextUtil_Reset(); switch (sp10) { case 0: sp1C = sp24->unk20[sp10][r8]; - if (r8 != 0 && sp24->unk0C[sp10][r8] != sp24->unk0C[sp10][r8 - 1]) + if (r8 != 0 && sp24->stats[sp10][r8] != sp24->stats[sp10][r8 - 1]) sp20 = r8; - ConvertIntToDecimalStringN(gStringVar4, sp24->unk0C[sp10][r8], STR_CONV_MODE_RIGHT_ALIGN, 4); - StringAppend(gStringVar4, gUnknown_082F43B4[sp10]); + ConvertIntToDecimalStringN(gStringVar4, sp24->stats[sp10][r8], STR_CONV_MODE_RIGHT_ALIGN, 4); + StringAppend(gStringVar4, sBCRankingHeaders[sp10]); break; case 1: sp1C = sp24->unk20[sp10][r8]; - if (r8 != 0 && sp24->unk0C[sp10][r8] != sp24->unk0C[sp10][r8 - 1]) + if (r8 != 0 && sp24->stats[sp10][r8] != sp24->stats[sp10][r8 - 1]) sp20 = r8; - ConvertIntToDecimalStringN(gStringVar1, sp24->unk0C[sp10][r8] >> 4, STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar1, sp24->stats[sp10][r8] >> 4, STR_CONV_MODE_RIGHT_ALIGN, 3); xOffset = 0; - r7 = sp24->unk0C[sp10][r8] & 15; + r7 = sp24->stats[sp10][r8] & 15; for (r2 = 0; r2 < 4; ++r2) if ((r7 >> (3 - r2)) & 1) xOffset += sPressingSpeedConversionTable[r2]; r7 = xOffset / 1000000u; ConvertIntToDecimalStringN(gStringVar2, r7, STR_CONV_MODE_LEADING_ZEROS, 2); - StringExpandPlaceholders(gStringVar4, gUnknown_082F43B4[sp10]); + StringExpandPlaceholders(gStringVar4, sBCRankingHeaders[sp10]); break; case 2: sp1C = r8; @@ -1442,12 +1444,12 @@ void sub_8021A28(struct BerryCrushGame * sp0C, u8 sp10, u8 sp14, u8 sp18) if (r2 >= LAST_BERRY_INDEX - FIRST_BERRY_INDEX + 2) r2 = 0; StringCopy(gStringVar1, gBerries[r2].name); - StringExpandPlaceholders(gStringVar4, gUnknown_082F43B4[sp10]); + StringExpandPlaceholders(gStringVar4, sBCRankingHeaders[sp10]); break; } r3 = GetStringRightAlignXOffset(2, gStringVar4, sp14 - 4); AddTextPrinterParameterized3(sp0C->unk138.unk82, 2, r3, r6, sBerryCrushTextColorTable[0], 0, gStringVar4); - if (sp1C == sp0C->unk8) + if (sp1C == sp0C->localId) StringCopy(gStringVar3, gText_1DotBlueF700); else StringCopy(gStringVar3, gText_1DotF700); @@ -1458,7 +1460,7 @@ void sub_8021A28(struct BerryCrushGame * sp0C, u8 sp10, u8 sp14, u8 sp18) } } -void sub_8021D34(struct BerryCrushGame *r8) +static void sub_8021D34(struct BerryCrushGame *r8) { u8 r10 = 0; u8 r6 = 0; @@ -1466,18 +1468,18 @@ void sub_8021D34(struct BerryCrushGame *r8) struct BerryCrushGame_68 *sp10 = &r8->unk68; u8 r7 = GetWindowAttribute(r8->unk138.unk82, WINDOW_HEIGHT) * 8 - 42; - sub_8021944(&r8->unk138, sp10->unk04); + FramesToMinSec(&r8->unk138, sp10->unk04); AddTextPrinterParameterized3(r8->unk138.unk82, 2, r6, r7, sBerryCrushTextColorTable[0], 0, gText_TimeColon); r6 = 176 - (u8)GetStringWidth(2, gText_SpaceSec, -1); AddTextPrinterParameterized3(r8->unk138.unk82, 2, r6, r7, sBerryCrushTextColorTable[0], 0, gText_SpaceSec); - ConvertIntToDecimalStringN(gStringVar1, r8->unk138.unk6, STR_CONV_MODE_LEADING_ZEROS, 2); - ConvertIntToDecimalStringN(gStringVar2, r8->unk138.unk8, STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar1, r8->unk138.secondsInt, STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar2, r8->unk138.secondsFrac, STR_CONV_MODE_LEADING_ZEROS, 2); StringExpandPlaceholders(gStringVar4, gText_XDotY2); r6 -= GetStringWidth(2, gStringVar4, -1); AddTextPrinterParameterized3(r8->unk138.unk82, 2, r6, r7, sBerryCrushTextColorTable[0], 0, gStringVar4); r6 -= GetStringWidth(2, gText_SpaceMin, -1); AddTextPrinterParameterized3(r8->unk138.unk82, 2, r6, r7, sBerryCrushTextColorTable[0], 0, gText_SpaceMin); - ConvertIntToDecimalStringN(gStringVar1, r8->unk138.unk4, STR_CONV_MODE_LEADING_ZEROS, 1); + ConvertIntToDecimalStringN(gStringVar1, r8->unk138.minutes, STR_CONV_MODE_LEADING_ZEROS, 1); StringExpandPlaceholders(gStringVar4, gText_StrVar1); r6 -= GetStringWidth(2, gStringVar4, -1); AddTextPrinterParameterized3(r8->unk138.unk82, 2, r6, r7, sBerryCrushTextColorTable[0], 0, gStringVar4); @@ -1486,9 +1488,9 @@ void sub_8021D34(struct BerryCrushGame *r8) r6 = 176 - (u8)GetStringWidth(2, gText_TimesPerSec, -1); AddTextPrinterParameterized3(r8->unk138.unk82, 2, r6, r7, sBerryCrushTextColorTable[0], 0, gText_TimesPerSec); for (; r10 < 8; ++r10) - if (((u8)r8->unk16 >> (7 - r10)) & 1) + if (((u8)r8->pressingSpeed >> (7 - r10)) & 1) sp0C += *(r10 + sPressingSpeedConversionTable); // It's accessed in a different way here for unknown reason - ConvertIntToDecimalStringN(gStringVar1, r8->unk16 >> 8, STR_CONV_MODE_RIGHT_ALIGN, 3); + ConvertIntToDecimalStringN(gStringVar1, r8->pressingSpeed >> 8, STR_CONV_MODE_RIGHT_ALIGN, 3); ConvertIntToDecimalStringN(gStringVar2, sp0C / 1000000, STR_CONV_MODE_LEADING_ZEROS, 2); StringExpandPlaceholders(gStringVar4, gText_XDotY3); r6 -= GetStringWidth(2, gStringVar4, -1); @@ -1504,7 +1506,7 @@ void sub_8021D34(struct BerryCrushGame *r8) AddTextPrinterParameterized3(r8->unk138.unk82, 2, r6, r7, sBerryCrushTextColorTable[0], 0, gStringVar4); } -bool32 sub_8022070(struct BerryCrushGame *r4, struct BerryCrushGame_138 *r6) +static bool32 sub_8022070(struct BerryCrushGame *r4, struct BerryCrushGame_138 *r6) { u8 r5; struct WindowTemplate template; @@ -1512,10 +1514,10 @@ bool32 sub_8022070(struct BerryCrushGame *r4, struct BerryCrushGame_138 *r6) switch (r6->unk80) { case 0: - r5 = r4->unk9 - 2; - sub_8022554(r6); - memcpy(&template, &gUnknown_082F3324[r4->unk12 - 11], sizeof(struct WindowTemplate)); - if (r4->unk12 == 13) + r5 = r4->playerCount - 2; + BerryCrush_HideTimerSprites(r6); + memcpy(&template, &gUnknown_082F3324[r4->gameState - 11], sizeof(struct WindowTemplate)); + if (r4->gameState == 13) template.height = gUnknown_082F3344[1][r5]; else template.height = gUnknown_082F3344[0][r5]; @@ -1530,22 +1532,22 @@ bool32 sub_8022070(struct BerryCrushGame *r4, struct BerryCrushGame_138 *r6) DrawStdFrameWithCustomTileAndPalette(r6->unk82, 0, 541, 13); break; case 3: - r5 = r4->unk9 - 2; - switch (r4->unk12) + r5 = r4->playerCount - 2; + switch (r4->gameState) { case 11: - sub_80219C8(r6->unk82, 20, 3, gText_PressesRankings); - sub_8021A28(r4, 0, 0xA0, 8 * gUnknown_082F3344[0][r5]); + PrintTextCentered(r6->unk82, 20, 3, gText_PressesRankings); + PrintBerryCrushResultWindow(r4, 0, 0xA0, 8 * gUnknown_082F3344[0][r5]); r6->unk80 = 5; return FALSE; case 12: - sub_80219C8(r6->unk82, 20, 4, gUnknown_082F43B4[r4->unk68.unk20[0][7] + 3]); - sub_8021A28(r4, 1, 0xA0, 8 * gUnknown_082F3344[0][r5]); + PrintTextCentered(r6->unk82, 20, 4, sBCRankingHeaders[r4->unk68.unk20[0][7] + 3]); + PrintBerryCrushResultWindow(r4, 1, 0xA0, 8 * gUnknown_082F3344[0][r5]); r6->unk80 = 5; return FALSE; case 13: - sub_80219C8(r6->unk82, 22, 3, gText_CrushingResults); - sub_8021A28(r4, 2, 0xB0, 8 * gUnknown_082F3344[1][r5]); + PrintTextCentered(r6->unk82, 22, 3, gText_CrushingResults); + PrintBerryCrushResultWindow(r4, 2, 0xB0, 8 * gUnknown_082F3344[1][r5]); break; } break; @@ -1561,7 +1563,7 @@ bool32 sub_8022070(struct BerryCrushGame *r4, struct BerryCrushGame_138 *r6) return FALSE; } -void sub_802222C(struct BerryCrushGame *r4) +static void sub_802222C(struct BerryCrushGame *r4) { ClearStdWindowAndFrameToTransparent(r4->unk138.unk82, 1); RemoveWindow(r4->unk138.unk82); @@ -1681,44 +1683,44 @@ void ShowBerryCrushRankings(void) gTasks[taskId].data[5] = gSaveBlock2Ptr->berryCrush.berryCrushResults[3]; } -void sub_8022524(struct BerryCrushGame_138 *r4, u16 r1) +static void BerryCrush_PrintTimeOnSprites(struct BerryCrushGame_138 *r4, u16 r1) { - sub_8021944(r4, r1); - DigitObjUtil_PrintNumOn(0, r4->unk4); - DigitObjUtil_PrintNumOn(1, r4->unk6); - DigitObjUtil_PrintNumOn(2, r4->unk8); + FramesToMinSec(r4, r1); + DigitObjUtil_PrintNumOn(0, r4->minutes); + DigitObjUtil_PrintNumOn(1, r4->secondsInt); + DigitObjUtil_PrintNumOn(2, r4->secondsFrac); } -void sub_8022554(struct BerryCrushGame_138 *r0) +static void BerryCrush_HideTimerSprites(struct BerryCrushGame_138 *r0) { - r0->unk78[0]->invisible = TRUE; - r0->unk78[1]->invisible = TRUE; + r0->timerSprites[0]->invisible = TRUE; + r0->timerSprites[1]->invisible = TRUE; DigitObjUtil_HideOrShow(2, 1); DigitObjUtil_HideOrShow(1, 1); DigitObjUtil_HideOrShow(0, 1); } -void sub_8022588(struct BerryCrushGame *r5) +static void sub_8022588(struct BerryCrushGame *r5) { u8 r6; - for (r6 = 0; r6 < r5->unk9; ++r6) + for (r6 = 0; r6 < r5->playerCount; ++r6) { - r5->unk138.unkC[r6] = &gUnknown_082F4190[gUnknown_082F417C[r5->unk9 - 2][r6]]; - r5->unk138.unk83[r6] = AddWindow(&gUnknown_082F32F4[r5->unk138.unkC[r6]->unk0]); + r5->unk138.seatCoords[r6] = &gUnknown_082F4190[gUnknown_082F417C[r5->playerCount - 2][r6]]; + r5->unk138.unk83[r6] = AddWindow(&gUnknown_082F32F4[r5->unk138.seatCoords[r6]->unk0]); PutWindowTilemap(r5->unk138.unk83[r6]); FillWindowPixelBuffer(r5->unk138.unk83[r6], 0); } } -void sub_8022600(struct BerryCrushGame *r6) +static void sub_8022600(struct BerryCrushGame *r6) { u8 r7; - for (r7 = 0; r7 < r6->unk9; ++r7) + for (r7 = 0; r7 < r6->playerCount; ++r7) { PutWindowTilemap(r6->unk138.unk83[r7]); - if (r7 == r6->unk8) + if (r7 == r6->localId) { AddTextPrinterParameterized4( r6->unk138.unk83[r7], @@ -1751,20 +1753,20 @@ void sub_8022600(struct BerryCrushGame *r6) CopyBgTilemapBufferToVram(0); } -void sub_80226D0(struct BerryCrushGame *r6) +static void sub_80226D0(struct BerryCrushGame *r6) { u8 r5 = 0; u8 * r4; LZ77UnCompWram(gUnknown_08DE3FD4, gDecompressionBuffer); - for (r4 = gDecompressionBuffer; r5 < r6->unk9; ++r5) + for (r4 = gDecompressionBuffer; r5 < r6->playerCount; ++r5) { CopyToBgTilemapBufferRect( 3, - &r4[r6->unk138.unkC[r5]->unk0 * 40], - r6->unk138.unkC[r5]->unk1, - r6->unk138.unkC[r5]->unk2, + &r4[r6->unk138.seatCoords[r5]->unk0 * 40], + r6->unk138.seatCoords[r5]->unk1, + r6->unk138.seatCoords[r5]->unk2, 10, 2 ); @@ -1772,72 +1774,72 @@ void sub_80226D0(struct BerryCrushGame *r6) CopyBgTilemapBufferToVram(3); } -void sub_8022730(struct BerryCrushGame *r6) +static void sub_8022730(struct BerryCrushGame *r6) { u8 r5 = 0; u8 r2; - r6->unk2A = -104; - r6->unk2C = 0; + r6->depth = -104; + r6->vibration = 0; gSpriteCoordOffsetX = 0; gSpriteCoordOffsetY = -104; for (; r5 < 4; ++r5) LoadCompressedSpriteSheet(&gUnknown_082F41F4[r5]); - LoadSpritePalettes(gUnknown_082F421C); - r2 = CreateSprite(&gUnknown_082F430C, 120, 88, 5); - r6->unk138.unk20 = &gSprites[r2]; - r6->unk138.unk20->oam.priority = 3; - r6->unk138.unk20->coordOffsetEnabled = TRUE; - r6->unk138.unk20->animPaused = TRUE; - for (r5 = 0; r5 < r6->unk9; ++r5) + LoadSpritePalettes(sSpritePals); + r2 = CreateSprite(&sSpriteTemplate_BerryCrushCore, 120, 88, 5); + r6->unk138.coreSprite = &gSprites[r2]; + r6->unk138.coreSprite->oam.priority = 3; + r6->unk138.coreSprite->coordOffsetEnabled = TRUE; + r6->unk138.coreSprite->animPaused = TRUE; + for (r5 = 0; r5 < r6->playerCount; ++r5) { r2 = CreateSprite( - &gUnknown_082F4324, - r6->unk138.unkC[r5]->unk4 + 120, - r6->unk138.unkC[r5]->unk6 + 32, + &sSpriteTemplate_BerryCrushImpact, + r6->unk138.seatCoords[r5]->unk4 + 120, + r6->unk138.seatCoords[r5]->unk6 + 32, 0 ); - r6->unk138.unk24[r5] = &gSprites[r2]; - r6->unk138.unk24[r5]->oam.priority = 1; - r6->unk138.unk24[r5]->invisible = TRUE; - r6->unk138.unk24[r5]->coordOffsetEnabled = TRUE; - r6->unk138.unk24[r5]->animPaused = TRUE; + r6->unk138.impactSprites[r5] = &gSprites[r2]; + r6->unk138.impactSprites[r5]->oam.priority = 1; + r6->unk138.impactSprites[r5]->invisible = TRUE; + r6->unk138.impactSprites[r5]->coordOffsetEnabled = TRUE; + r6->unk138.impactSprites[r5]->animPaused = TRUE; } - for (r5 = 0; r5 < ARRAY_COUNT(r6->unk138.unk4C); ++r5) + for (r5 = 0; r5 < ARRAY_COUNT(r6->unk138.sparkleSprites); ++r5) { r2 = CreateSprite( - &gUnknown_082F433C, + &sSpriteTemplate_BerryCrushPowderSparkles, gUnknown_082F41D2[r5][0] + 120, gUnknown_082F41D2[r5][1] + 136, 6 ); - r6->unk138.unk4C[r5] = &gSprites[r2]; - r6->unk138.unk4C[r5]->oam.priority = 3; - r6->unk138.unk4C[r5]->invisible = TRUE; - r6->unk138.unk4C[r5]->animPaused = TRUE; - r6->unk138.unk4C[r5]->data[0] = r5; + r6->unk138.sparkleSprites[r5] = &gSprites[r2]; + r6->unk138.sparkleSprites[r5]->oam.priority = 3; + r6->unk138.sparkleSprites[r5]->invisible = TRUE; + r6->unk138.sparkleSprites[r5]->animPaused = TRUE; + r6->unk138.sparkleSprites[r5]->data[0] = r5; } - for (r5 = 0; r5 < ARRAY_COUNT(r6->unk138.unk78); ++r5) + for (r5 = 0; r5 < ARRAY_COUNT(r6->unk138.timerSprites); ++r5) { r2 = CreateSprite( - &gUnknown_082F4354, + &sSpriteTemplate_BerryCrushTimer, 24 * r5 + 176, 8, 0 ); - r6->unk138.unk78[r5] = &gSprites[r2]; - r6->unk138.unk78[r5]->oam.priority = 0; - r6->unk138.unk78[r5]->invisible = FALSE; - r6->unk138.unk78[r5]->animPaused = FALSE; + r6->unk138.timerSprites[r5] = &gSprites[r2]; + r6->unk138.timerSprites[r5]->oam.priority = 0; + r6->unk138.timerSprites[r5]->invisible = FALSE; + r6->unk138.timerSprites[r5]->animPaused = FALSE; } - DigitObjUtil_CreatePrinter(0, 0, &gUnknown_082F4384[0]); - DigitObjUtil_CreatePrinter(1, 0, &gUnknown_082F4384[1]); - DigitObjUtil_CreatePrinter(2, 0, &gUnknown_082F4384[2]); - if (r6->unk12 == 1) - sub_8022554(&r6->unk138); + DigitObjUtil_CreatePrinter(0, 0, &sDigitObjTemplates[0]); + DigitObjUtil_CreatePrinter(1, 0, &sDigitObjTemplates[1]); + DigitObjUtil_CreatePrinter(2, 0, &sDigitObjTemplates[2]); + if (r6->gameState == 1) + BerryCrush_HideTimerSprites(&r6->unk138); } -void sub_8022960(struct BerryCrushGame *r5) +static void sub_8022960(struct BerryCrushGame *r5) { u8 r4 = 0; @@ -1848,20 +1850,20 @@ void sub_8022960(struct BerryCrushGame *r5) FreeSpritePaletteByTag(4); FreeSpritePaletteByTag(2); FreeSpritePaletteByTag(1); - for (; r4 < ARRAY_COUNT(r5->unk138.unk78); ++r4) - DestroySprite(r5->unk138.unk78[r4]); + for (; r4 < ARRAY_COUNT(r5->unk138.timerSprites); ++r4) + DestroySprite(r5->unk138.timerSprites[r4]); DigitObjUtil_DeletePrinter(2); DigitObjUtil_DeletePrinter(1); DigitObjUtil_DeletePrinter(0); - for (r4 = 0; r4 < ARRAY_COUNT(r5->unk138.unk4C); ++r4) - DestroySprite(r5->unk138.unk4C[r4]); - for (r4 = 0; r4 < r5->unk9; ++r4) - DestroySprite(r5->unk138.unk24[r4]); - if (r5->unk138.unk20->inUse) - DestroySprite(r5->unk138.unk20); + for (r4 = 0; r4 < ARRAY_COUNT(r5->unk138.sparkleSprites); ++r4) + DestroySprite(r5->unk138.sparkleSprites[r4]); + for (r4 = 0; r4 < r5->playerCount; ++r4) + DestroySprite(r5->unk138.impactSprites[r4]); + if (r5->unk138.coreSprite->inUse) + DestroySprite(r5->unk138.coreSprite); } -static void sub_8022A20(struct Sprite *sprite) +static void SpriteCB_BerryCrushImpact(struct Sprite *sprite) { if (sprite->animEnded) { @@ -1870,7 +1872,7 @@ static void sub_8022A20(struct Sprite *sprite) } } -void sub_8022A4C(struct Sprite *sprite) +static void sub_8022A4C(struct Sprite *sprite) { u8 r1 = 0; SpriteCallback r5 = SpriteCallbackDummy; @@ -1884,7 +1886,7 @@ void sub_8022A4C(struct Sprite *sprite) sprite->callback = r5; } -void sub_8022A94(struct Sprite *sprite) +static void sub_8022A94(struct Sprite *sprite) { s16 *r4 = sprite->data; @@ -1906,7 +1908,7 @@ void sub_8022A94(struct Sprite *sprite) sprite->callback = sub_8022A4C; } -void sub_8022B28(struct Sprite *sprite) +static void sub_8022B28(struct Sprite *sprite) { s16 *r7 = sprite->data; s16 r4, r5; @@ -1933,23 +1935,23 @@ void sub_8022B28(struct Sprite *sprite) sprite->invisible = FALSE; } -void sub_8022BEC(u16 r5, u8 r4, u8 *r7) +static void BerryCrush_RunOrScheduleCommand(u16 r5, u8 r4, u8 *r7) { struct BerryCrushGame *r6 = GetBerryCrushGame(); - if (r5 > 25) + if (r5 >= ARRAY_COUNT(sBerryCrushCommands)) r5 = 0; switch (r4) { case 0: if (r5 != 0) - gUnknown_082F43CC[r5](r6, r7); - if (r6->unkE > 25) - r6->unkE = r4; - r6->unk4 = gUnknown_082F43CC[r6->unkE]; + sBerryCrushCommands[r5](r6, r7); + if (r6->nextCmd >= ARRAY_COUNT(sBerryCrushCommands)) + r6->nextCmd = r4; + r6->cmdCallback = sBerryCrushCommands[r6->nextCmd]; break; case 1: - r6->unk4 = gUnknown_082F43CC[r5]; + r6->cmdCallback = sBerryCrushCommands[r5]; break; } } @@ -1989,61 +1991,61 @@ static u32 BerryCrushCommand_BeginNormalPaletteFade(struct BerryCrushGame *game, gPaletteFade.bufferTransferDisabled = FALSE; BeginNormalPaletteFade(selectedPals[0], params[4], params[5], params[6], color); UpdatePaletteFade(); - game->unkE = 2; + game->nextCmd = 2; return 0; } -static u32 sub_8022CB0(struct BerryCrushGame *r4, u8 *r5) +static u32 BerryCrushCommand_WaitPaletteFade(struct BerryCrushGame *r4, u8 *r5) { - switch (r4->unkC) + switch (r4->cmdState) { case 0: if (UpdatePaletteFade()) return 0; if(r5[0] != 0) - ++r4->unkC; + ++r4->cmdState; else - r4->unkC = 3; + r4->cmdState = 3; return 0; case 1: Rfu_SetLinkStandbyCallback(); - ++r4->unkC; + ++r4->cmdState; return 0; case 2: if (IsLinkTaskFinished()) { - ++r4->unkC; + ++r4->cmdState; return 0; } return 0; case 3: - sub_8022BEC(r4->unkF, 1, NULL); - r4->unkC = 0; + BerryCrush_RunOrScheduleCommand(r4->afterPalFadeCmd, 1, NULL); + r4->cmdState = 0; return 0; default: - ++r4->unkC; + ++r4->cmdState; return 0; } } -static u32 sub_8022D14(struct BerryCrushGame *r7, u8 *r5) +static u32 BerryCrushCommand_PrintMessage(struct BerryCrushGame *r7, u8 *r5) { u16 r4 = r5[3]; r4 <<= 8; r4 |= r5[2]; - switch (r7->unkC) + switch (r7->cmdState) { case 0: DrawDialogueFrame(0, 0); if (r5[1] & 2) { - StringExpandPlaceholders(gStringVar4, gUnknown_082F32A4[r5[0]]); - AddTextPrinterParameterized2(0, 1, gStringVar4, r7->unkB, 0, 2, 1, 3); + StringExpandPlaceholders(gStringVar4, sBerryCrushMessages[r5[0]]); + AddTextPrinterParameterized2(0, 1, gStringVar4, r7->textSpeed, 0, 2, 1, 3); } else { - AddTextPrinterParameterized2(0, 1, gUnknown_082F32A4[r5[0]], r7->unkB, 0, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, sBerryCrushMessages[r5[0]], r7->textSpeed, 0, 2, 1, 3); } CopyWindowToVram(0, 3); break; @@ -2051,7 +2053,7 @@ static u32 sub_8022D14(struct BerryCrushGame *r7, u8 *r5) if (!IsTextPrinterActive(0)) { if (r4 == 0) - ++r7->unkC; + ++r7->cmdState; break; } return 0; @@ -2062,31 +2064,31 @@ static u32 sub_8022D14(struct BerryCrushGame *r7, u8 *r5) case 3: if (r5[1] & 1) ClearDialogWindowAndFrame(0, 1); - sub_8022BEC(r7->unkE, 1, NULL); - r7->unkC = r5[4]; + BerryCrush_RunOrScheduleCommand(r7->nextCmd, 1, NULL); + r7->cmdState = r5[4]; return 0; } - ++r7->unkC; + ++r7->cmdState; return 0; } -static u32 sub_8022E1C(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_InitGfx(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) { if (InitBerryCrushDisplay() != 0) - sub_8022BEC(r4->unkE, 0, r4->unk36); + BerryCrush_RunOrScheduleCommand(r4->nextCmd, 0, r4->commandParams); return 0; } -static u32 sub_8022E3C(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_TeardownGfx(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) { - if (sub_802130C() != 0) - sub_8022BEC(r4->unkE, 0, r4->unk36); + if (BerryCrush_TeardownBgs() != 0) + BerryCrush_RunOrScheduleCommand(r4->nextCmd, 0, r4->commandParams); return 0; } -static u32 sub_8022E5C(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_SignalReadyToBegin(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) { - switch (r4->unkC) + switch (r4->cmdState) { case 0: Rfu_SetLinkStandbyCallback(); @@ -2095,55 +2097,55 @@ static u32 sub_8022E5C(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1 if (IsLinkTaskFinished()) { PlayNewMapMusic(MUS_RG_GAME_CORNER); - sub_8022BEC(7, 1, NULL); - r4->unk12 = 3; - r4->unkC = 0; + BerryCrush_RunOrScheduleCommand(7, 1, NULL); + r4->gameState = 3; + r4->cmdState = 0; } return 0; } - ++r4->unkC; + ++r4->cmdState; return 0; } -static u32 sub_8022EAC(struct BerryCrushGame *r4, u8 *r5) +static u32 BerryCrushCommand_AskPickBerry(struct BerryCrushGame *r4, u8 *r5) { - switch (r4->unkC) + switch (r4->cmdState) { default: - ++r4->unkC; + ++r4->cmdState; break; case 0: sub_8024578(r4); - sub_8024644(r5, 0, 1, 0, 1); - r4->unkE = 7; - sub_8022BEC(3, 1, NULL); + BerryCrush_SetShowMessageParams(r5, 0, 1, 0, 1); + r4->nextCmd = 7; + BerryCrush_RunOrScheduleCommand(3, 1, NULL); break; case 1: - r4->unkE = 8; - sub_8022BEC(5, 1, NULL); - r4->unkC = 2; + r4->nextCmd = 8; + BerryCrush_RunOrScheduleCommand(5, 1, NULL); + r4->cmdState = 2; break; } return 0; } -static u32 sub_8022F04(struct BerryCrushGame *r0, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_GoToBerryPouch(struct BerryCrushGame *r0, __attribute__((unused)) u8 *r1) { - r0->unk4 = NULL; + r0->cmdCallback = NULL; SetMainCallback2(BerryCrush_SetupMainTask); return 0; } -static u32 sub_8022F1C(struct BerryCrushGame *r5, u8 *r2) +static u32 BerryCrushCommand_WaitForOthersToPickBerries(struct BerryCrushGame *r5, u8 *r2) { u8 r3; - switch (r5->unkC) + switch (r5->cmdState) { case 0: - sub_8024644(r2, 1, 0, 0, 1); - r5->unkE = 9; - sub_8022BEC(3, 1, NULL); + BerryCrush_SetShowMessageParams(r2, 1, 0, 0, 1); + r5->nextCmd = 9; + BerryCrush_RunOrScheduleCommand(3, 1, NULL); return 0; case 1: Rfu_SetLinkStandbyCallback(); @@ -2151,9 +2153,9 @@ static u32 sub_8022F1C(struct BerryCrushGame *r5, u8 *r2) case 2: if (!IsLinkTaskFinished()) return 0; - memset(r5->unk42, 0, sizeof(r5->unk42)); - r5->unk42[0] = r5->unk98[r5->unk8].unkC; - SendBlock(0, r5->unk42, 2); + memset(r5->sendCmd, 0, sizeof(r5->sendCmd)); + r5->sendCmd[0] = r5->unk98[r5->localId].unkC; + SendBlock(0, r5->sendCmd, 2); break; case 3: if (!IsLinkTaskFinished()) @@ -2161,15 +2163,15 @@ static u32 sub_8022F1C(struct BerryCrushGame *r5, u8 *r2) r5->unk10 = 0; break; case 4: - if (GetBlockReceivedStatus() != gUnknown_082F4448[r5->unk9 - 2]) + if (GetBlockReceivedStatus() != sReceivedPlayerBitmasks[r5->playerCount - 2]) return 0; - for (r3 = 0; r3 < r5->unk9; ++r3) + for (r3 = 0; r3 < r5->playerCount; ++r3) { r5->unk98[r3].unkC = gBlockRecvBuffer[r3][0]; if (r5->unk98[r3].unkC > 0xB0) r5->unk98[r3].unkC = 0; r5->unk18 += gUnknown_0858AB24[r5->unk98[r3].unkC].unk0; - r5->unk1C += gUnknown_0858AB24[r5->unk98[r3].unkC].unk1; + r5->powder += gUnknown_0858AB24[r5->unk98[r3].unkC].unk1; } r5->unk10 = 0; ResetBlockReceivedFlags(); @@ -2177,100 +2179,100 @@ static u32 sub_8022F1C(struct BerryCrushGame *r5, u8 *r2) break; case 5: ClearDialogWindowAndFrame(0, 1); - sub_8022BEC(10, 1, NULL); - r5->unk12 = 4; - r5->unkC = 0; + BerryCrush_RunOrScheduleCommand(10, 1, NULL); + r5->gameState = 4; + r5->cmdState = 0; return 0; } - ++r5->unkC; + ++r5->cmdState; return 0; } -static u32 sub_8023070(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_DropBerriesIntoCrusher(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) { - switch (r4->unkC) + switch (r4->cmdState) { case 0: - sub_80214A8(r4, &r4->unk138); + BerryCrush_CreateBerrySprites(r4, &r4->unk138); Rfu_SetLinkStandbyCallback(); break; case 1: if (!IsLinkTaskFinished()) return 0; - r4->unk138.unk0 = 0; + r4->unk138.animBerryIdx = 0; r4->unk138.unk1 = 0; r4->unk138.unk2 = 0; r4->unk138.unk3 = 0; break; case 2: - r4->unk138.unk38[r4->unk138.unk0]->callback = sub_8021608; - r4->unk138.unk38[r4->unk138.unk0]->affineAnimPaused = FALSE; + r4->unk138.berrySprites[r4->unk138.animBerryIdx]->callback = SpriteCB_DropBerryIntoCrusher; + r4->unk138.berrySprites[r4->unk138.animBerryIdx]->affineAnimPaused = FALSE; PlaySE(SE_BALL_THROW); break; case 3: - if (r4->unk138.unk38[r4->unk138.unk0]->callback == sub_8021608) + if (r4->unk138.berrySprites[r4->unk138.animBerryIdx]->callback == SpriteCB_DropBerryIntoCrusher) return 0; - r4->unk138.unk38[r4->unk138.unk0] = NULL; - ++r4->unk138.unk0; + r4->unk138.berrySprites[r4->unk138.animBerryIdx] = NULL; + ++r4->unk138.animBerryIdx; Rfu_SetLinkStandbyCallback(); break; case 4: if (!IsLinkTaskFinished()) return 0; - if (r4->unk138.unk0 < r4->unk9) + if (r4->unk138.animBerryIdx < r4->playerCount) { - r4->unkC = 2; + r4->cmdState = 2; return 0; } - r4->unk138.unk0 = 0; + r4->unk138.animBerryIdx = 0; break; case 5: - sub_80216A8(r4, &r4->unk138); + BerryCrushFreeBerrySpriteGfx(r4, &r4->unk138); Rfu_SetLinkStandbyCallback(); break; case 6: if (!IsLinkTaskFinished()) return 0; PlaySE(SE_FALL); - sub_8022BEC(11, 1, NULL); - r4->unk12 = 5; - r4->unkC = 0; + BerryCrush_RunOrScheduleCommand(11, 1, NULL); + r4->gameState = 5; + r4->cmdState = 0; return 0; } - ++r4->unkC; + ++r4->cmdState; return 0; } -static u32 sub_80231B8(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_DropLid(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) { - switch (r4->unkC) + switch (r4->cmdState) { case 0: - r4->unk2A += 4; - if (r4->unk2A < 0) + r4->depth += 4; + if (r4->depth < 0) return 0; - r4->unk2A = 0; + r4->depth = 0; r4->unk138.unk1 = 4; - r4->unk138.unk0 = 0; + r4->unk138.animBerryIdx = 0; r4->unk138.unk2 = gUnknown_082F326C[r4->unk138.unk1][0]; PlaySE(SE_M_STRENGTH); break; case 1: - r4->unk2C = gUnknown_082F326C[r4->unk138.unk1][r4->unk138.unk0]; - SetGpuReg(REG_OFFSET_BG0VOFS, -r4->unk2C); - SetGpuReg(REG_OFFSET_BG2VOFS, -r4->unk2C); - SetGpuReg(REG_OFFSET_BG3VOFS, -r4->unk2C); - ++r4->unk138.unk0; - if (r4->unk138.unk0 < r4->unk138.unk2) + r4->vibration = gUnknown_082F326C[r4->unk138.unk1][r4->unk138.animBerryIdx]; + SetGpuReg(REG_OFFSET_BG0VOFS, -r4->vibration); + SetGpuReg(REG_OFFSET_BG2VOFS, -r4->vibration); + SetGpuReg(REG_OFFSET_BG3VOFS, -r4->vibration); + ++r4->unk138.animBerryIdx; + if (r4->unk138.animBerryIdx < r4->unk138.unk2) return 0; if (r4->unk138.unk1 == 0) break; --r4->unk138.unk1; r4->unk138.unk2 = gUnknown_082F326C[r4->unk138.unk1][0]; - r4->unk138.unk0 = 0; + r4->unk138.animBerryIdx = 0; return 0; case 2: - r4->unk2C = 0; + r4->vibration = 0; SetGpuReg(REG_OFFSET_BG0VOFS, 0); SetGpuReg(REG_OFFSET_BG2VOFS, 0); SetGpuReg(REG_OFFSET_BG3VOFS, 0); @@ -2279,23 +2281,23 @@ static u32 sub_80231B8(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r case 3: if (!IsLinkTaskFinished()) return 0; - sub_8022BEC(12, 1, NULL); - r4->unk12 = 6; - r4->unkC = 0; + BerryCrush_RunOrScheduleCommand(12, 1, NULL); + r4->gameState = 6; + r4->cmdState = 0; return 0; } - ++r4->unkC; + ++r4->cmdState; return 0; } -static u32 sub_80232EC(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_Countdown(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) { - switch (r4-> unkC) + switch (r4-> cmdState) { case 1: if (!IsLinkTaskFinished()) return 0; - StartMinigameCountdown(0x1000, 0x1000, 120, 80, 0); + StartMinigameCountdown(TAG_COUNTDOWN, TAG_COUNTDOWN, 120, 80, 0); break; case 2: if (IsMinigameCountdownRunning()) @@ -2307,24 +2309,24 @@ static u32 sub_80232EC(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r case 3: if (!IsLinkTaskFinished()) return 0; - r4->unk138.unk0 = 0; + r4->unk138.animBerryIdx = 0; r4->unk138.unk1 = 0; r4->unk138.unk2 = 0; r4->unk138.unk3 = 0; r4->unk10 = 0; - if (r4->unk8 == 0) - sub_8022BEC(13, 1, NULL); + if (r4->localId == 0) + BerryCrush_RunOrScheduleCommand(13, 1, NULL); else - sub_8022BEC(14, 1, NULL); - r4->unk12 = 7; - r4->unkC = 0; + BerryCrush_RunOrScheduleCommand(14, 1, NULL); + r4->gameState = 7; + r4->cmdState = 0; return 0; } - ++r4->unkC; + ++r4->cmdState; return 0; } -void sub_802339C(struct BerryCrushGame *r4) +void BerryCrush_ProcessGamePartnerInput(struct BerryCrushGame *r4) { u8 r8 = 0; u8 r7 = 0; @@ -2332,7 +2334,7 @@ void sub_802339C(struct BerryCrushGame *r4) s32 r2_ = 0; struct BerryCrushGame_4E *r2; - for (r7 = 0; r7 < r4->unk9; r7++) + for (r7 = 0; r7 < r4->playerCount; r7++) { r2 = (struct BerryCrushGame_4E *)gRecvCmds[r7]; if ((r2->unk0 & 0xFF00) != RFUCMD_SEND_PACKET) @@ -2342,11 +2344,11 @@ void sub_802339C(struct BerryCrushGame *r4) if (r2->unk4_2) { - r4->unk5C.unk02_3 |= gUnknown_082F325C[r7]; + r4->localState.unk02_3 |= gUnknown_082F325C[r7]; r4->unk98[r7].unk1C = 1; ++r4->unk98[r7].unk16; ++r8; - r3 = r4->unk28 - r4->unk98[r7].unkE; + r3 = r4->timer - r4->unk98[r7].unkE; if (r3 >= r4->unk98[r7].unk12 - 1 && r3 <= r4->unk98[r7].unk12 + 1) { ++r4->unk98[r7].unk10; @@ -2359,7 +2361,7 @@ void sub_802339C(struct BerryCrushGame *r4) r4->unk98[r7].unk10 = 0; r4->unk98[r7].unk12 = r3; } - r4->unk98[r7].unkE = r4->unk28; + r4->unk98[r7].unkE = r4->timer; ++r4->unk98[r7].unk1B; if (r4->unk98[r7].unk1B > 2) r4->unk98[r7].unk1B = 0; @@ -2371,7 +2373,7 @@ void sub_802339C(struct BerryCrushGame *r4) } if (r8 > 1) { - for (r7 = 0; r7 < r4->unk9; ++r7) + for (r7 = 0; r7 < r4->playerCount; ++r7) { if (!r4->unk98[r7].unk1C) continue; @@ -2397,17 +2399,17 @@ void sub_802339C(struct BerryCrushGame *r4) } r4->unk24 = 32; - r4->unk5C.unk02_0 = 1; + r4->localState.unk02_0 = 1; } -void sub_8023558(struct BerryCrushGame *r3) +void BerryCrush_BuildLocalState(struct BerryCrushGame *r3) { u8 r6 = 0; u16 r1 = 0; u16 r2 = 0; u8 r4 = 0; - for (r4 = 0; r4 < r3->unk9; ++r4) + for (r4 = 0; r4 < r3->playerCount; ++r4) { if (r3->unk98[r4].unk1C != 0) { @@ -2416,15 +2418,15 @@ void sub_8023558(struct BerryCrushGame *r3) if (r3->unk98[r4].unk1C & 2) r1 |= 4; r1 <<= 3 * r4; - r3->unk5C.unk08 |= r1; + r3->localState.unk08 |= r1; } } r2 = (u16)r3->unk24; - r3->unk5C.unk04 = r2; + r3->localState.unk04 = r2; if (r6 == 0) { if (r3->unk138.unk3 != 0) - ++r3->unk138.unk0; + ++r3->unk138.animBerryIdx; } else if (r3->unk138.unk3 != 0) { @@ -2435,12 +2437,12 @@ void sub_8023558(struct BerryCrushGame *r3) } else { - ++r3->unk138.unk0; + ++r3->unk138.animBerryIdx; } } else { - r3->unk138.unk0 = 0; + r3->unk138.animBerryIdx = 0; r3->unk138.unk1 = r6 - 1; r3->unk138.unk2 = gUnknown_082F3290[r6 - 1][0]; r3->unk138.unk3 = 1; @@ -2448,9 +2450,9 @@ void sub_8023558(struct BerryCrushGame *r3) if (r3->unk138.unk3 != 0) { - if (r3->unk138.unk0 >= r3->unk138.unk2) + if (r3->unk138.animBerryIdx >= r3->unk138.unk2) { - r3->unk138.unk0 = 0; + r3->unk138.animBerryIdx = 0; r3->unk138.unk1 = 0; r3->unk138.unk2 = 0; r3->unk138.unk3 = 0; @@ -2458,32 +2460,32 @@ void sub_8023558(struct BerryCrushGame *r3) } else { - r1 = gUnknown_082F3290[r3->unk138.unk1][r3->unk138.unk0 + 1]; + r1 = gUnknown_082F3290[r3->unk138.unk1][r3->unk138.animBerryIdx + 1]; } - r3->unk5C.unk03 = (u8)r1; + r3->localState.unk03 = (u8)r1; } else { - r3->unk5C.unk03 = 0; + r3->localState.unk03 = 0; } - r3->unk5C.unk06 = r3->unk26; + r3->localState.unk06 = r3->unk26; } -void sub_80236B8(struct BerryCrushGame *r5) +void BerryCrush_HandlePlayerInput(struct BerryCrushGame *r5) { if (JOY_NEW(A_BUTTON)) - r5->unk5C.unk02_2 = 1; + r5->localState.pushedAButton = 1; if (JOY_HELD(A_BUTTON)) { - if (r5->unk98[r5->unk8].unk1A < r5->unk28) - ++r5->unk98[r5->unk8].unk1A; + if (r5->unk98[r5->localId].unk1A < r5->timer) + ++r5->unk98[r5->localId].unk1A; } - if (r5->unk8 != 0 && r5->unk5C.unk02_2 == 0) + if (r5->localId != 0 && r5->localState.pushedAButton == 0) return; - r5->unk5C.unk00 = 2; - if (r5->unk28 % 30 == 0) + r5->localState.unk00 = 2; + if (r5->timer % 30 == 0) { - if (r5->unk2E > gUnknown_082F4444[r5->unk9 - 2]) + if (r5->unk2E > gUnknown_082F4444[r5->playerCount - 2]) { ++r5->unk30; r5->unk25_4 = 1; @@ -2495,15 +2497,15 @@ void sub_80236B8(struct BerryCrushGame *r5) r5->unk2E = 0; ++r5->unk32; } - if (r5->unk28 % 15 == 0) + if (r5->timer % 15 == 0) { - if (r5->unk34 < gUnknown_082F4434[r5->unk9 - 2][0]) + if (r5->unk34 < gUnknown_082F4434[r5->playerCount - 2][0]) r5->unk25_5 = 0; - else if (r5->unk34 < gUnknown_082F4434[r5->unk9 - 2][1]) + else if (r5->unk34 < gUnknown_082F4434[r5->playerCount - 2][1]) r5->unk25_5 = 1; - else if (r5->unk34 < gUnknown_082F4434[r5->unk9 - 2][2]) + else if (r5->unk34 < gUnknown_082F4434[r5->playerCount - 2][2]) r5->unk34 = 2; // typo since r5->unk34 will be reset? - else if (r5->unk34 < gUnknown_082F4434[r5->unk9 - 2][3]) + else if (r5->unk34 < gUnknown_082F4434[r5->playerCount - 2][3]) r5->unk34 = 3; // typo since r5->unk34 will be reset? else r5->unk25_5 = 4; @@ -2516,31 +2518,31 @@ void sub_80236B8(struct BerryCrushGame *r5) { if (r5->unk10 > 70) { - sub_8011AC8(); + ClearRecvCommands(); r5->unk10 = 0; } - else if (r5->unk5C.unk02_3 == 0) + else if (r5->localState.unk02_3 == 0) { - sub_8011AC8(); + ClearRecvCommands(); r5->unk10 = 0; } } } - if (r5->unk28 >= 36000) - r5->unk5C.unk02_0 = 1; - r5->unk5C.unk02_1 = r5->unk25_4; - r5->unk5C.unk0A = r5->unk25_5; - memcpy(r5->unk42, &r5->unk5C, sizeof(r5->unk42)); - Rfu_SendPacket(r5->unk42); + if (r5->timer >= 36000) + r5->localState.unk02_0 = 1; + r5->localState.unk02_1 = r5->unk25_4; + r5->localState.unk0A = r5->unk25_5; + memcpy(r5->sendCmd, &r5->localState, sizeof(r5->sendCmd)); + Rfu_SendPacket(r5->sendCmd); } -void sub_802385C(struct BerryCrushGame *r5) +void BerryCrush_UpdateGameState(struct BerryCrushGame *r5) { u8 r4 = 0; struct BerryCrushGame_4E *r4_ = NULL; - for (r4 = 0; r4 < r5->unk9; r4++) + for (r4 = 0; r4 < r5->playerCount; r4++) r5->unk98[r4].unk1C = 0; if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET) { @@ -2553,11 +2555,11 @@ void sub_802385C(struct BerryCrushGame *r5) return; } - memcpy(r5->unk4E, gRecvCmds[0], 14); - r4_ = (struct BerryCrushGame_4E *)&r5->unk4E; - r5->unk2A = r4_->unk6; - r5->unk2C = (s16)r4_->unk5; - r5->unk28 = r4_->unk8; + memcpy(r5->recvCmd, gRecvCmds[0], 14); + r4_ = (struct BerryCrushGame_4E *)&r5->recvCmd; + r5->depth = r4_->unk6; + r5->vibration = (s16)r4_->unk5; + r5->timer = r4_->unk8; sub_80216E0(r5, &(r5->unk138)); if (r4_->unk4_0) { @@ -2565,104 +2567,104 @@ void sub_802385C(struct BerryCrushGame *r5) } } -static u32 sub_80238F0(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_PlayGame_Master(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) { - memset(&r4->unk5C, 0, sizeof(r4->unk5C)); - memset(&r4->unk4E, 0, sizeof(r4->unk4E)); - sub_802385C(r4); - SetGpuReg(REG_OFFSET_BG0VOFS, -r4->unk2C); - SetGpuReg(REG_OFFSET_BG2VOFS, -r4->unk2C); - SetGpuReg(REG_OFFSET_BG3VOFS, -r4->unk2C); + memset(&r4->localState, 0, sizeof(r4->localState)); + memset(&r4->recvCmd, 0, sizeof(r4->recvCmd)); + BerryCrush_UpdateGameState(r4); + SetGpuReg(REG_OFFSET_BG0VOFS, -r4->vibration); + SetGpuReg(REG_OFFSET_BG2VOFS, -r4->vibration); + SetGpuReg(REG_OFFSET_BG3VOFS, -r4->vibration); if (r4->unk25_3) { - if (r4->unk28 >= 36000) + if (r4->timer >= 36000) { - r4->unk28 = 36000; - sub_8022BEC(16, 1, NULL); + r4->timer = 36000; + BerryCrush_RunOrScheduleCommand(16, 1, NULL); } else { - sub_8022BEC(15, 1, NULL); + BerryCrush_RunOrScheduleCommand(15, 1, NULL); } r4->unk10 = 0; - r4->unkC = 0; + r4->cmdState = 0; return 0; } else { ++r4->unk26; - sub_802339C(r4); - sub_8023558(r4); - sub_80236B8(r4); + BerryCrush_ProcessGamePartnerInput(r4); + BerryCrush_BuildLocalState(r4); + BerryCrush_HandlePlayerInput(r4); return 0; } } -static u32 sub_8023998(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_PlayGame_Slave(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) { - memset(&r4->unk5C, 0, sizeof(r4->unk5C)); - memset(&r4->unk4E, 0, sizeof(r4->unk4E)); - sub_802385C(r4); - SetGpuReg(REG_OFFSET_BG0VOFS, -r4->unk2C); - SetGpuReg(REG_OFFSET_BG2VOFS, -r4->unk2C); - SetGpuReg(REG_OFFSET_BG3VOFS, -r4->unk2C); + memset(&r4->localState, 0, sizeof(r4->localState)); + memset(&r4->recvCmd, 0, sizeof(r4->recvCmd)); + BerryCrush_UpdateGameState(r4); + SetGpuReg(REG_OFFSET_BG0VOFS, -r4->vibration); + SetGpuReg(REG_OFFSET_BG2VOFS, -r4->vibration); + SetGpuReg(REG_OFFSET_BG3VOFS, -r4->vibration); if (r4->unk25_3) { - if (r4->unk28 >= 36000) + if (r4->timer >= 36000) { - r4->unk28 = 36000; - sub_8022BEC(16, 1, NULL); + r4->timer = 36000; + BerryCrush_RunOrScheduleCommand(16, 1, NULL); } else { - sub_8022BEC(15, 1, NULL); + BerryCrush_RunOrScheduleCommand(15, 1, NULL); } r4->unk10 = 0; - r4->unkC = 0; + r4->cmdState = 0; return 0; } else { - sub_80236B8(r4); + BerryCrush_HandlePlayerInput(r4); return 0; } } -static u32 sub_8023A30(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_FinishGame(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) { - switch (r4->unkC) + switch (r4->cmdState) { case 0: - r4->unk12 = 8; + r4->gameState = 8; PlaySE(SE_M_STRENGTH); - BlendPalettes(0xFFFFFFFF, 8, RGB(31, 31, 0)); - r4->unk138.unk0 = 2; + BlendPalettes(PALETTES_ALL, 8, RGB(31, 31, 0)); + r4->unk138.animBerryIdx = 2; break; case 1: - if (--r4->unk138.unk0 != 255) + if (--r4->unk138.animBerryIdx != 255) return 0; - BlendPalettes(0xFFFFFFFF, 0, RGB(31, 31, 0)); + BlendPalettes(PALETTES_ALL, 0, RGB(31, 31, 0)); r4->unk138.unk1 = 4; - r4->unk138.unk0 = 0; + r4->unk138.animBerryIdx = 0; r4->unk138.unk2 = gUnknown_082F326C[r4->unk138.unk1][0]; break; case 2: - r4->unk2C = gUnknown_082F326C[r4->unk138.unk1][r4->unk138.unk0]; - SetGpuReg(REG_OFFSET_BG0VOFS, -r4->unk2C); - SetGpuReg(REG_OFFSET_BG2VOFS, -r4->unk2C); - SetGpuReg(REG_OFFSET_BG3VOFS, -r4->unk2C); - if (++r4->unk138.unk0 < r4->unk138.unk2) + r4->vibration = gUnknown_082F326C[r4->unk138.unk1][r4->unk138.animBerryIdx]; + SetGpuReg(REG_OFFSET_BG0VOFS, -r4->vibration); + SetGpuReg(REG_OFFSET_BG2VOFS, -r4->vibration); + SetGpuReg(REG_OFFSET_BG3VOFS, -r4->vibration); + if (++r4->unk138.animBerryIdx < r4->unk138.unk2) return 0; if (r4->unk138.unk1 != 0) { --r4->unk138.unk1; r4->unk138.unk2 = gUnknown_082F326C[r4->unk138.unk1][0]; - r4->unk138.unk0 = 0; + r4->unk138.animBerryIdx = 0; return 0; } break; case 3: - r4->unk2C = 0; + r4->vibration = 0; SetGpuReg(REG_OFFSET_BG0VOFS, 0); SetGpuReg(REG_OFFSET_BG2VOFS, 0); SetGpuReg(REG_OFFSET_BG3VOFS, 0); @@ -2676,30 +2678,30 @@ static u32 sub_8023A30(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1 case 5: if (!IsLinkTaskFinished()) return 0; - sub_8022BEC(17, 1, NULL); + BerryCrush_RunOrScheduleCommand(17, 1, NULL); r4->unk10 = 0; - r4->unkC = 0; + r4->cmdState = 0; return 0; } - ++r4->unkC; + ++r4->cmdState; return 0; } -static u32 sub_8023BC0(struct BerryCrushGame *r5, u8 *r6) +static u32 BerryCrushCommand_HandleTimeUp(struct BerryCrushGame *r5, u8 *r6) { - switch (r5->unkC) + switch (r5->cmdState) { case 0: - r5->unk12 = 9; + r5->gameState = 9; PlaySE(SE_FAILURE); - BlendPalettes(0xFFFFFFFF, 8, RGB(31, 0, 0)); - r5->unk138.unk0 = 4; + BlendPalettes(PALETTES_ALL, 8, RGB(31, 0, 0)); + r5->unk138.animBerryIdx = 4; break; case 1: - if (--r5->unk138.unk0 != 255) + if (--r5->unk138.animBerryIdx != 255) return 0; - BlendPalettes(0xFFFFFFFF, 0, RGB(31, 0, 0)); - r5->unk138.unk0 = 0; + BlendPalettes(PALETTES_ALL, 0, RGB(31, 0, 0)); + r5->unk138.animBerryIdx = 0; break; case 2: if (!sub_80218D4(r5, &r5->unk138)) @@ -2713,33 +2715,33 @@ static u32 sub_8023BC0(struct BerryCrushGame *r5, u8 *r6) case 3: if (!IsLinkTaskFinished()) return 0; - ConvertIntToDecimalStringN(gStringVar1, r5->unk1C, STR_CONV_MODE_LEFT_ALIGN, 6); - sub_8024644(r6, 7, 1, 0, 0); - r5->unkE = 19; - sub_8022BEC(3, 1, NULL); + ConvertIntToDecimalStringN(gStringVar1, r5->powder, STR_CONV_MODE_LEFT_ALIGN, 6); + BerryCrush_SetShowMessageParams(r6, 7, 1, 0, 0); + r5->nextCmd = 19; + BerryCrush_RunOrScheduleCommand(3, 1, NULL); r5->unk10 = 0; - r5->unkC = 0; + r5->cmdState = 0; return 0; } - ++r5->unkC; + ++r5->cmdState; return 0; } -static u32 sub_8023CAC(struct BerryCrushGame *r7, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_TabulateResults(struct BerryCrushGame *r7, __attribute__((unused)) u8 *r1) { u8 r8, r4_, r3; s32 r2; s32 r4; u16 r6; - switch (r7->unkC) + switch (r7->cmdState) { case 0: - memset(r7->unk42, 0, 2 * sizeof(u16)); - if (r7->unk98[r7->unk8].unk1A > r7->unk28) - r7->unk98[r7->unk8].unk1A = r7->unk28; - r7->unk42[0] = r7->unk98[r7->unk8].unk1A; - SendBlock(0, r7->unk42, 2); + memset(r7->sendCmd, 0, 2 * sizeof(u16)); + if (r7->unk98[r7->localId].unk1A > r7->timer) + r7->unk98[r7->localId].unk1A = r7->timer; + r7->sendCmd[0] = r7->unk98[r7->localId].unk1A; + SendBlock(0, r7->sendCmd, 2); break; case 1: if (!IsLinkTaskFinished()) @@ -2747,38 +2749,38 @@ static u32 sub_8023CAC(struct BerryCrushGame *r7, __attribute__((unused)) u8 *r1 r7->unk10 = 0; break; case 2: - if (GetBlockReceivedStatus() != gUnknown_082F4448[r7->unk9 - 2]) + if (GetBlockReceivedStatus() != sReceivedPlayerBitmasks[r7->playerCount - 2]) return 0; - for (r8 = 0; r8 < r7->unk9; ++r8) + for (r8 = 0; r8 < r7->playerCount; ++r8) r7->unk98[r8].unk1A = gBlockRecvBuffer[r8][0]; r7->unk10 = 0; - r7->unk42[0] = 0; + r7->sendCmd[0] = 0; ResetBlockReceivedFlags(); - if (r7->unk8 == 0) - r7->unkC = 3; + if (r7->localId == 0) + r7->cmdState = 3; else - r7->unkC = 6; + r7->cmdState = 6; return 0; case 3: memset(&r7->unk68, 0, sizeof(struct BerryCrushGame_68)); - r7->unk68.unk04 = r7->unk28; - r7->unk68.unk06 = r7->unk18 / (r7->unk28 / 60); + r7->unk68.unk04 = r7->timer; + r7->unk68.unk06 = r7->unk18 / (r7->timer / 60); r2 = MathUtil_Mul32(Q_24_8(r7->unk30), Q_24_8(50)); r2 = MathUtil_Div32(r2, Q_24_8(r7->unk32)) + Q_24_8(50); r2 = Q_24_8_TO_INT(r2); r7->unk68.unk08 = r2 & 0x7F; r2 = Q_24_8(r2); r2 = MathUtil_Div32(r2, Q_24_8(100)); - r4 = Q_24_8(r7->unk1C * r7->unk9); + r4 = Q_24_8(r7->powder * r7->playerCount); r4 = MathUtil_Mul32(r4, r2); r7->unk68.unk00 = r4 >> 8; r7->unk68.unk20[0][7] = Random() % 3; - for (r8 = 0; r8 < r7->unk9; ++r8) + for (r8 = 0; r8 < r7->playerCount; ++r8) { r7->unk68.unk20[0][r8] = r8; r7->unk68.unk20[1][r8] = r8; - r7->unk68.unk0C[0][r8] = r7->unk98[r8].unk16; - r7->unk68.unk0A += r7->unk68.unk0C[0][r8]; + r7->unk68.stats[0][r8] = r7->unk98[r8].unk16; + r7->unk68.unk0A += r7->unk68.stats[0][r8]; switch (r7->unk68.unk20[0][7]) { case 0: @@ -2816,7 +2818,7 @@ static u32 sub_8023CAC(struct BerryCrushGame *r7, __attribute__((unused)) u8 *r1 { r4 = 0; } - else if (r7->unk98[r8].unk1A >= r7->unk28) + else if (r7->unk98[r8].unk1A >= r7->timer) { r4 = 0x6400; } @@ -2825,35 +2827,35 @@ static u32 sub_8023CAC(struct BerryCrushGame *r7, __attribute__((unused)) u8 *r1 r2 = r7->unk98[r8].unk1A; r2 = Q_24_8(r2); r2 = MathUtil_Mul32(r2, Q_24_8(100)); - r4 = r7->unk28; + r4 = r7->timer; r4 = Q_24_8(r4); r4 = MathUtil_Div32(r2, r4); } break; } r4 >>= 4; - r7->unk68.unk0C[1][r8] = r4; + r7->unk68.stats[1][r8] = r4; } break; case 4: - for (r8 = 0; r8 < r7->unk9 - 1; ++r8) + for (r8 = 0; r8 < r7->playerCount - 1; ++r8) { - for (r4_ = r7->unk9 - 1; r4_ > r8; --r4_) + for (r4_ = r7->playerCount - 1; r4_ > r8; --r4_) { - if (r7->unk68.unk0C[0][r4_ - 1] < r7->unk68.unk0C[0][r4_]) + if (r7->unk68.stats[0][r4_ - 1] < r7->unk68.stats[0][r4_]) { - r6 = r7->unk68.unk0C[0][r4_]; - r7->unk68.unk0C[0][r4_] = r7->unk68.unk0C[0][r4_ - 1]; - r7->unk68.unk0C[0][r4_ - 1] = r6; + r6 = r7->unk68.stats[0][r4_]; + r7->unk68.stats[0][r4_] = r7->unk68.stats[0][r4_ - 1]; + r7->unk68.stats[0][r4_ - 1] = r6; r3 = r7->unk68.unk20[0][r4_]; r7->unk68.unk20[0][r4_] = r7->unk68.unk20[0][r4_ - 1]; r7->unk68.unk20[0][r4_ - 1] = r3; } - if (r7->unk68.unk0C[1][r4_ - 1] < r7->unk68.unk0C[1][r4_]) + if (r7->unk68.stats[1][r4_ - 1] < r7->unk68.stats[1][r4_]) { - r6 = r7->unk68.unk0C[1][r4_]; - r7->unk68.unk0C[1][r4_] = r7->unk68.unk0C[1][r4_ - 1]; - r7->unk68.unk0C[1][r4_ - 1] = r6; + r6 = r7->unk68.stats[1][r4_]; + r7->unk68.stats[1][r4_] = r7->unk68.stats[1][r4_ - 1]; + r7->unk68.stats[1][r4_ - 1] = r6; r3 = r7->unk68.unk20[1][r4_]; r7->unk68.unk20[1][r4_] = r7->unk68.unk20[1][r4_ - 1]; r7->unk68.unk20[1][r4_ - 1] = r3; @@ -2877,19 +2879,19 @@ static u32 sub_8023CAC(struct BerryCrushGame *r7, __attribute__((unused)) u8 *r1 break; case 7: BerryCrush_SaveResults(); - sub_8022BEC(18, 1, NULL); - r7->unk12 = 11; - r7->unkC = 0; + BerryCrush_RunOrScheduleCommand(18, 1, NULL); + r7->gameState = 11; + r7->cmdState = 0; r7->unk24 = 0; return 0; } - ++r7->unkC; + ++r7->cmdState; return 0; } -static u32 sub_8024048(struct BerryCrushGame *r5, u8 *r6) +static u32 BerryCrushCommand_ShowResults(struct BerryCrushGame *r5, u8 *r6) { - switch (r5->unkC) + switch (r5->cmdState) { case 0: if (!sub_8022070(r5, &r5->unk138)) @@ -2897,12 +2899,12 @@ static u32 sub_8024048(struct BerryCrushGame *r5, u8 *r6) break; case 1: CopyBgTilemapBufferToVram(0); - r5->unk138.unk0 = 30; + r5->unk138.animBerryIdx = 30; break; case 2: - if (r5->unk138.unk0 != 0) + if (r5->unk138.animBerryIdx != 0) { - --r5->unk138.unk0; + --r5->unk138.animBerryIdx; return 0; } if (!(JOY_NEW(A_BUTTON))) @@ -2911,37 +2913,37 @@ static u32 sub_8024048(struct BerryCrushGame *r5, u8 *r6) sub_802222C(r5); break; case 3: - if (r5->unk12 <= 12) + if (r5->gameState <= 12) { - ++r5->unk12; - r5->unkC = 0; + ++r5->gameState; + r5->cmdState = 0; return 0; } break; case 4: - ConvertIntToDecimalStringN(gStringVar1, r5->unk1C, STR_CONV_MODE_LEFT_ALIGN, 6); + ConvertIntToDecimalStringN(gStringVar1, r5->powder, STR_CONV_MODE_LEFT_ALIGN, 6); ConvertIntToDecimalStringN(gStringVar2, GetBerryPowder(), STR_CONV_MODE_LEFT_ALIGN, 6); - sub_8024644(r6, 2, 3, 0, 0); - r5->unkE = 19; - sub_8022BEC(3, 1, NULL); - r5->unkC = 0; + BerryCrush_SetShowMessageParams(r6, 2, 3, 0, 0); + r5->nextCmd = 19; + BerryCrush_RunOrScheduleCommand(3, 1, NULL); + r5->cmdState = 0; return 0; } - ++r5->unkC; + ++r5->cmdState; return 0; } -static u32 sub_8024134(struct BerryCrushGame *r5, u8 *r4) +static u32 BerryCrushCommand_SaveGame(struct BerryCrushGame *r5, u8 *r4) { - switch (r5->unkC) + switch (r5->cmdState) { case 0: - if (r5->unk28 >= 36000) - sub_8022554(&r5->unk138); - sub_8024644(r4, 8, 0, 0, 1); - r5->unkE = 19; - sub_8022BEC(3, 1, NULL); - r5->unkC = 0; + if (r5->timer >= 36000) + BerryCrush_HideTimerSprites(&r5->unk138); + BerryCrush_SetShowMessageParams(r4, 8, 0, 0, 1); + r5->nextCmd = 19; + BerryCrush_RunOrScheduleCommand(3, 1, NULL); + r5->cmdState = 0; return 0; case 1: Rfu_SetLinkStandbyCallback(); @@ -2959,26 +2961,26 @@ static u32 sub_8024134(struct BerryCrushGame *r5, u8 *r4) return 0; break; case 4: - sub_8022BEC(20, 1, NULL); - r5->unk12 = 15; - r5->unkC = 0; + BerryCrush_RunOrScheduleCommand(20, 1, NULL); + r5->gameState = 15; + r5->cmdState = 0; return 0; } - ++r5->unkC; + ++r5->cmdState; return 0; } -static u32 sub_8024228(struct BerryCrushGame *r5, u8 *r6) +static u32 BerryCrushCommand_AskPlayAgain(struct BerryCrushGame *r5, u8 *r6) { s8 r4 = 0; - switch (r5->unkC) + switch (r5->cmdState) { case 0: - sub_8024644(r6, 4, 0, 0, 1); - r5->unkE = 20; - sub_8022BEC(3, 1, NULL); - r5->unkC = 0; // dunno what it's doing because it's already in case 0 + BerryCrush_SetShowMessageParams(r6, 4, 0, 0, 1); + r5->nextCmd = 20; + BerryCrush_RunOrScheduleCommand(3, 1, NULL); + r5->cmdState = 0; // dunno what it's doing because it's already in case 0 return 0; case 1: DisplayYesNoMenuDefaultYes(); @@ -2987,7 +2989,7 @@ static u32 sub_8024228(struct BerryCrushGame *r5, u8 *r6) r4 = Menu_ProcessInputNoWrapClearOnChoose(); if (r4 != -2) { - memset(r5->unk42, 0, sizeof(r5->unk42)); + memset(r5->sendCmd, 0, sizeof(r5->sendCmd)); if (r4 == 0) { if (HasAtLeastOneBerry()) @@ -3000,22 +3002,22 @@ static u32 sub_8024228(struct BerryCrushGame *r5, u8 *r6) r5->unk14 = 1; } ClearDialogWindowAndFrame(0, 1); - sub_8024644(r6, 8, 0, 0, 0); - r5->unkE = 21; - sub_8022BEC(3, 1, NULL); - r5->unkC = 0; + BerryCrush_SetShowMessageParams(r6, 8, 0, 0, 0); + r5->nextCmd = 21; + BerryCrush_RunOrScheduleCommand(3, 1, NULL); + r5->cmdState = 0; } return 0; } - ++r5->unkC; + ++r5->cmdState; return 0; } -static u32 sub_80242E0(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_CommunicatePlayAgainResponses(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1) { u8 r5 = 0; - switch (r4->unkC) + switch (r4->cmdState) { case 0: Rfu_SetLinkStandbyCallback(); @@ -3023,9 +3025,9 @@ static u32 sub_80242E0(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1 case 1: if (!IsLinkTaskFinished()) return 0; - r4->unk42[0] = r4->unk14; - r4->unk4E[0] = 0; - SendBlock(0, r4->unk42, sizeof(u16)); + r4->sendCmd[0] = r4->unk14; + r4->recvCmd[0] = 0; + SendBlock(0, r4->sendCmd, sizeof(u16)); break; case 2: if (!IsLinkTaskFinished()) @@ -3033,31 +3035,31 @@ static u32 sub_80242E0(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1 r4->unk10 = 0; break; case 3: - if (GetBlockReceivedStatus() != gUnknown_082F4448[r4->unk9 - 2]) + if (GetBlockReceivedStatus() != sReceivedPlayerBitmasks[r4->playerCount - 2]) return 0; - for (; r5 < r4->unk9; ++r5) - r4->unk4E[0] += gBlockRecvBuffer[r5][0]; - if (r4->unk4E[0] != 0) - sub_8022BEC(23, 1, NULL); + for (; r5 < r4->playerCount; ++r5) + r4->recvCmd[0] += gBlockRecvBuffer[r5][0]; + if (r4->recvCmd[0] != 0) + BerryCrush_RunOrScheduleCommand(23, 1, NULL); else - sub_8022BEC(22, 1, NULL); + BerryCrush_RunOrScheduleCommand(22, 1, NULL); ResetBlockReceivedFlags(); - r4->unk42[0] = 0; - r4->unk4E[0] = 0; + r4->sendCmd[0] = 0; + r4->recvCmd[0] = 0; r4->unk10 = 0; - r4->unkC = 0; + r4->cmdState = 0; return 0; } - ++r4->unkC; + ++r4->cmdState; return 0; } -static u32 sub_80243BC(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_FadeOutToPlayAgain(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1) { - switch (r5->unkC) + switch (r5->cmdState) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 1, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 1, 0, 0x10, RGB_BLACK); UpdatePaletteFade(); break; case 1: @@ -3067,55 +3069,55 @@ static u32 sub_80243BC(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1 case 2: ClearDialogWindowAndFrame(0, 1); sub_8021488(r5); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); UpdatePaletteFade(); break; case 3: if (UpdatePaletteFade()) return 0; - sub_8022BEC(7, 1, NULL); - r5->unk12 = 3; - r5->unkC = 0; + BerryCrush_RunOrScheduleCommand(7, 1, NULL); + r5->gameState = 3; + r5->cmdState = 0; return 0; } - ++r5->unkC; + ++r5->cmdState; return 0; } -static u32 sub_8024444(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_PlayAgainFailureMessage(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1) { - switch (r5->unkC) + switch (r5->cmdState) { case 0: DrawDialogueFrame(0, 0); if (r5->unk14 == 3) - AddTextPrinterParameterized2(0, 1, gUnknown_082F32A4[5], r5->unkB, 0, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, sBerryCrushMessages[5], r5->textSpeed, 0, 2, 1, 3); else - AddTextPrinterParameterized2(0, 1, gUnknown_082F32A4[6], r5->unkB, 0, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, sBerryCrushMessages[6], r5->textSpeed, 0, 2, 1, 3); CopyWindowToVram(0, 3); break; case 1: if (IsTextPrinterActive(0)) return 0; - r5->unk138.unk0 = 120; + r5->unk138.animBerryIdx = 120; break; case 2: - if (r5->unk138.unk0 != 0) - --r5->unk138.unk0; + if (r5->unk138.animBerryIdx != 0) + --r5->unk138.animBerryIdx; else { - sub_8022BEC(24, 1, NULL); - r5->unkC = 0; + BerryCrush_RunOrScheduleCommand(24, 1, NULL); + r5->cmdState = 0; } return 0; } - ++r5->unkC; + ++r5->cmdState; return 0; } -static u32 sub_8024508(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_GracefulExit(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1) { - switch (r5->unkC) + switch (r5->cmdState) { case 0: Rfu_SetLinkStandbyCallback(); @@ -3128,31 +3130,31 @@ static u32 sub_8024508(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1 case 2: if (gReceivedRemoteLinkPlayers != 0) return 0; - r5->unkE = 25; - sub_8022BEC(5, 1, NULL); - r5->unkC = 2; // ??? + r5->nextCmd = 25; + BerryCrush_RunOrScheduleCommand(5, 1, NULL); + r5->cmdState = 2; // ??? return 0; } - ++r5->unkC; + ++r5->cmdState; return 0; } -static u32 sub_8024568(__attribute__((unused)) struct BerryCrushGame *r0, __attribute__((unused)) u8 *r1) +static u32 BerryCrushCommand_Quit(__attribute__((unused)) struct BerryCrushGame *r0, __attribute__((unused)) u8 *r1) { QuitBerryCrush(NULL); return 0; } -void sub_8024578(struct BerryCrushGame *r4) +static void sub_8024578(struct BerryCrushGame *r4) { u8 r5 = 0; IncrementGameStat(GAME_STAT_51); r4->unkD = 0; r4->unk10 = 0; - r4->unk12 = 2; + r4->gameState = 2; r4->unk14 = 0; - r4->unk1C = 0; + r4->powder = 0; r4->unk18 = 0; r4->unk1A = 0; r4->unk20 = 0; @@ -3164,7 +3166,7 @@ void sub_8024578(struct BerryCrushGame *r4) r4->unk25_4 = 0; r4->unk25_5 = 0; r4->unk26 = 0; - r4->unk28 = 0; + r4->timer = 0; r4->unk2E = 0; r4->unk32 = -1; r4->unk30 = 0; @@ -3198,14 +3200,11 @@ static void BerryCrush_SetPaletteFadeParams(u8 *params, bool8 communicateAfter, params[9] = communicateAfter; } -void sub_8024644(u8 *r0, u32 r1, u32 r2, u32 r3, u32 r5) +static void BerryCrush_SetShowMessageParams(u8 *params, u8 stringId, u8 flags, u16 waitKeys, u8 followupCmd) { - u8 sp[4]; - - 0[(u16 *)sp] = r3; - r0[0] = r1; - r0[1] = r2; - r0[2] = sp[0]; - r0[3] = sp[1]; - r0[4] = r5; + params[0] = stringId; + params[1] = flags; + params[2] = ((u8 *)&waitKeys)[0]; + params[3] = ((u8 *)&waitKeys)[1]; + params[4] = followupCmd; } diff --git a/src/berry_fix_program.c b/src/berry_fix_program.c index 4c4a010b2..31caf79cc 100644 --- a/src/berry_fix_program.c +++ b/src/berry_fix_program.c @@ -12,40 +12,42 @@ #include "text.h" #include "menu.h" #include "m4a.h" +#include "constants/rgb.h" -// Static type declarations - -typedef struct { +struct { u8 state; - u8 unk1; - u16 unk2; + u8 curScene; + u16 timer; struct MultiBootParam mb; -} berryfix_t; +} static * sBerryFix; -// Static RAM declarations - -static berryfix_t *berry_fix_mb_manager; - -// Static ROM declarations - -static void berry_fix_main(void); -static void berry_fix_gpu_set(void); -static int berry_fix_text_update(int); -static void berry_fix_text_print(int); -static void berry_fix_bg_hide(void); - -// .rodata +static void BerryFix_Main(void); +static void BerryFix_GpuSet(void); +static int BerryFix_TrySetScene(int); +static void BerryFix_SetScene(int); +static void BerryFix_HideScene(void); static const u8 sText_BerryProgramUpdate[] = _("Berry Program Update"); static const u8 sText_RubySapphire[] = _("Ruby/Sapphire"); static const u8 sText_Emerald[] = _("Emerald"); - -static const u8 sText_BerryProgramWillBeUpdatedPressA[] = _("The Berry Program on your POKéMON\nRuby/Sapphire Game Pak will be updated.\n{COLOR RED}{SHADOW LIGHT_RED}Press the A Button."); -static const u8 sText_EnsureGBAConnectionMatches[] = _("Please ensure the connection of your\nGame Boy Advance system matches this.\n{COLOR RED}{SHADOW LIGHT_RED}YES: Press the A Button.\nNO: Turn off the power and try again."); -static const u8 sText_TurnOffPowerHoldingStartSelect[] = _("Please turn on the power of POKéMON\nRuby/Sapphire while holding START and\nSELECT simultaneously. Then, ensure\nthe picture above appears."); -static const u8 sText_TransmittingPleaseWait[] = _("Transmitting. Please wait.\n{COLOR RED}{SHADOW LIGHT_RED}Please do not turn off the power or\nunplug the Game Boy Advance Game\nLink Cable."); -static const u8 sText_PleaseFollowInstructionsOnScreen[] = _("Please follow the instructions on your\nPOKéMON Ruby/Sapphire screen."); -static const u8 sText_TransmissionFailureTryAgain[] = _("Transmission failure.\n{COLOR RED}{SHADOW LIGHT_RED}Please try again."); +static const u8 sText_BerryProgramWillBeUpdatedPressA[] = _("The Berry Program on your POKéMON\n" + "Ruby/Sapphire Game Pak will be updated.\n" + "{COLOR RED}{SHADOW LIGHT_RED}Press the A Button."); +static const u8 sText_EnsureGBAConnectionMatches[] = _("Please ensure the connection of your\n" + "Game Boy Advance system matches this.\n" + "{COLOR RED}{SHADOW LIGHT_RED}YES: Press the A Button.\n" + "NO: Turn off the power and try again."); +static const u8 sText_TurnOffPowerHoldingStartSelect[] = _("Please turn on the power of POKéMON\n" + "Ruby/Sapphire while holding START and\n" + "SELECT simultaneously. Then, ensure\n" + "the picture above appears."); +static const u8 sText_TransmittingPleaseWait[] = _("Transmitting. Please wait.\n" + "{COLOR RED}{SHADOW LIGHT_RED}Please do not turn off the power or\n" + "unplug the Game Boy Advance Game\nLink Cable."); +static const u8 sText_PleaseFollowInstructionsOnScreen[] = _("Please follow the instructions on your\n" + "POKéMON Ruby/Sapphire screen."); +static const u8 sText_TransmissionFailureTryAgain[] = _("Transmission failure.\n" + "{COLOR RED}{SHADOW LIGHT_RED}Please try again."); static const struct BgTemplate sBerryFixBgTemplates[] = { { @@ -108,52 +110,66 @@ static const struct WindowTemplate sBerryFixWindowTemplates[] = { DUMMY_WIN_TEMPLATE }; -static const u16 sUnknown_08618138[] = { - 0x7fff, 0x7fff, 0x318c, 0x675a, - 0x043c, 0x3aff, 0x0664, 0x4bd2, - 0x6546, 0x7b14, 0x7fff, 0x318c, - 0x675a, 0, 0, 0 +static const u16 sBerryFixPalColors[] = { + RGB_WHITE, RGB_WHITE, RGB(12, 12, 12), RGB(26, 26, 25), + RGB(28, 1, 1), RGB(31, 23, 14), RGB(4, 19, 1), RGB(18, 30, 18), + RGB(6, 10, 25), RGB(20, 24, 30), RGB_WHITE, RGB(12, 12, 12), + RGB(26, 26, 25), RGB_BLACK, RGB_BLACK, RGB_BLACK }; static const u8 sBerryProgramTextColors[] = {TEXT_DYNAMIC_COLOR_1, TEXT_DYNAMIC_COLOR_2, TEXT_DYNAMIC_COLOR_3}; static const u8 sGameTitleTextColors[] = { TEXT_COLOR_TRANSPARENT, TEXT_DYNAMIC_COLOR_1, TEXT_DYNAMIC_COLOR_4}; -static const u8 *const sBerryProgramTexts[] = { - sText_EnsureGBAConnectionMatches, - sText_TurnOffPowerHoldingStartSelect, - sText_TransmittingPleaseWait, - sText_PleaseFollowInstructionsOnScreen, - sText_TransmissionFailureTryAgain, - sText_BerryProgramWillBeUpdatedPressA +enum { + SCENE_ENSURE_CONNECT, + SCENE_TURN_OFF_POWER, + SCENE_TRANSMITTING, + SCENE_FOLLOW_INSTRUCT, + SCENE_TRANSMIT_FAILED, + SCENE_BEGIN, + SCENE_NONE }; +static const u8 *const sBerryProgramTexts[] = { + [SCENE_ENSURE_CONNECT] = sText_EnsureGBAConnectionMatches, + [SCENE_TURN_OFF_POWER] = sText_TurnOffPowerHoldingStartSelect, + [SCENE_TRANSMITTING] = sText_TransmittingPleaseWait, + [SCENE_FOLLOW_INSTRUCT] = sText_PleaseFollowInstructionsOnScreen, + [SCENE_TRANSMIT_FAILED] = sText_TransmissionFailureTryAgain, + [SCENE_BEGIN] = sText_BerryProgramWillBeUpdatedPressA +}; static const struct { const u32 *gfx; const u32 *tilemap; - const u16 *pltt; + const u16 *palette; } sBerryFixGraphics[] = { - { + [SCENE_ENSURE_CONNECT] = { gBerryFixGameboy_Gfx, gBerryFixGameboy_Tilemap, gBerryFixGameboy_Pal - }, { + }, + [SCENE_TURN_OFF_POWER] = { gBerryFixGameboyLogo_Gfx, gBerryFixGameboyLogo_Tilemap, gBerryFixGameboyLogo_Pal - }, { + }, + [SCENE_TRANSMITTING] = { gBerryFixGbaTransfer_Gfx, gBerryFixGbaTransfer_Tilemap, gBerryFixGbaTransfer_Pal - }, { + }, + [SCENE_FOLLOW_INSTRUCT] = { gBerryFixGbaTransferHighlight_Gfx, gBerryFixGbaTransferHighlight_Tilemap, gBerryFixGbaTransferHighlight_Pal - }, { + }, + [SCENE_TRANSMIT_FAILED] = { gBerryFixGbaTransferError_Gfx, gBerryFixGbaTransferError_Tilemap, gBerryFixGbaTransferError_Pal - }, { + }, + [SCENE_BEGIN] = { gBerryFixWindow_Gfx, gBerryFixWindow_Tilemap, gBerryFixWindow_Pal @@ -163,7 +179,16 @@ static const struct { extern const u8 gMultiBootProgram_BerryGlitchFix_Start[0x3BF4]; extern const u8 gMultiBootProgram_BerryGlitchFix_End[]; -// .text +enum { + MAINSTATE_INIT, + MAINSTATE_BEGIN, + MAINSTATE_CONNECT, + MAINSTATE_INIT_MULTIBOOT, + MAINSTATE_MULTIBOOT, + MAINSTATE_TRANSMIT, + MAINSTATE_EXIT, + MAINSTATE_FAILED, +}; void CB2_InitBerryFixProgram(void) { @@ -175,81 +200,79 @@ void CB2_InitBerryFixProgram(void) ResetTasks(); ScanlineEffect_Stop(); SetGpuReg(REG_OFFSET_DISPCNT, 0); - berry_fix_mb_manager = AllocZeroed(0x50); - berry_fix_mb_manager->state = 0; - berry_fix_mb_manager->unk1 = 6; - SetMainCallback2(berry_fix_main); + sBerryFix = AllocZeroed(sizeof(*sBerryFix)); + sBerryFix->state = MAINSTATE_INIT; + sBerryFix->curScene = SCENE_NONE; + SetMainCallback2(BerryFix_Main); } -static void berry_fix_main(void) +#define TryScene(sceneNum) BerryFix_TrySetScene(sceneNum) == (sceneNum) + +static void BerryFix_Main(void) { - switch (berry_fix_mb_manager->state) + switch (sBerryFix->state) { - case 0: - berry_fix_gpu_set(); - berry_fix_mb_manager->state = 1; + case MAINSTATE_INIT: + BerryFix_GpuSet(); + sBerryFix->state = MAINSTATE_BEGIN; break; - case 1: - if (berry_fix_text_update(5) == 5 && (JOY_NEW(A_BUTTON))) + case MAINSTATE_BEGIN: + if (TryScene(SCENE_BEGIN) && (JOY_NEW(A_BUTTON))) + sBerryFix->state = MAINSTATE_CONNECT; + break; + case MAINSTATE_CONNECT: + if (TryScene(SCENE_ENSURE_CONNECT) && (JOY_NEW(A_BUTTON))) + sBerryFix->state = MAINSTATE_INIT_MULTIBOOT; + break; + case MAINSTATE_INIT_MULTIBOOT: + if (TryScene(SCENE_TURN_OFF_POWER)) { - berry_fix_mb_manager->state = 2; + sBerryFix->mb.masterp = gMultiBootProgram_BerryGlitchFix_Start; + sBerryFix->mb.server_type = 0; + MultiBootInit(&sBerryFix->mb); + sBerryFix->timer = 0; + sBerryFix->state = MAINSTATE_MULTIBOOT; } break; - case 2: - if (berry_fix_text_update(0) == 0 && (JOY_NEW(A_BUTTON))) + case MAINSTATE_MULTIBOOT: + MultiBootMain(&sBerryFix->mb); + if (sBerryFix->mb.probe_count != 0 || (!(sBerryFix->mb.response_bit & 2) || !(sBerryFix->mb.client_bit & 2))) { - berry_fix_mb_manager->state = 3; + sBerryFix->timer = 0; + } + else if (++sBerryFix->timer > 180) + { + MultiBootStartMaster(&sBerryFix->mb, + gMultiBootProgram_BerryGlitchFix_Start + ROM_HEADER_SIZE, + (u32)(gMultiBootProgram_BerryGlitchFix_End - (gMultiBootProgram_BerryGlitchFix_Start + ROM_HEADER_SIZE)), + 4, + 1); + sBerryFix->state = MAINSTATE_TRANSMIT; } break; - case 3: - if (berry_fix_text_update(1) == 1) + case MAINSTATE_TRANSMIT: + if (TryScene(SCENE_TRANSMITTING)) { - berry_fix_mb_manager->mb.masterp = gMultiBootProgram_BerryGlitchFix_Start; - berry_fix_mb_manager->mb.server_type = 0; - MultiBootInit(&berry_fix_mb_manager->mb); - berry_fix_mb_manager->unk2 = 0; - berry_fix_mb_manager->state = 4; + MultiBootMain(&sBerryFix->mb); + + if (MultiBootCheckComplete(&sBerryFix->mb)) + sBerryFix->state = MAINSTATE_EXIT; + else if (!(sBerryFix->mb.client_bit & 2)) + sBerryFix->state = MAINSTATE_FAILED; } break; - case 4: - MultiBootMain(&berry_fix_mb_manager->mb); - if (berry_fix_mb_manager->mb.probe_count != 0 || (!(berry_fix_mb_manager->mb.response_bit & 2) || !(berry_fix_mb_manager->mb.client_bit & 2))) - { - berry_fix_mb_manager->unk2 = 0; - } - else if (++ berry_fix_mb_manager->unk2 > 180) - { - MultiBootStartMaster(&berry_fix_mb_manager->mb, gMultiBootProgram_BerryGlitchFix_Start + ROM_HEADER_SIZE, (u32)(gMultiBootProgram_BerryGlitchFix_End - (gMultiBootProgram_BerryGlitchFix_Start + ROM_HEADER_SIZE)), 4, 1); - berry_fix_mb_manager->state = 5; - } - break; - case 5: - if (berry_fix_text_update(2) == 2) { - MultiBootMain(&berry_fix_mb_manager->mb); - if (MultiBootCheckComplete(&berry_fix_mb_manager->mb)) { - berry_fix_mb_manager->state = 6; - } - else if (!(berry_fix_mb_manager->mb.client_bit & 2)) { - berry_fix_mb_manager->state = 7; - } - } - break; - case 6: - if (berry_fix_text_update(3) == 3 && JOY_NEW(A_BUTTON)) - { + case MAINSTATE_EXIT: + if (TryScene(SCENE_FOLLOW_INSTRUCT) && JOY_NEW(A_BUTTON)) DoSoftReset(); - } break; - case 7: - if (berry_fix_text_update(4) == 4 && JOY_NEW(A_BUTTON)) - { - berry_fix_mb_manager->state = 1; - } + case MAINSTATE_FAILED: + if (TryScene(SCENE_TRANSMIT_FAILED) && JOY_NEW(A_BUTTON)) + sBerryFix->state = MAINSTATE_BEGIN; break; } } -static void berry_fix_gpu_set(void) +static void BerryFix_GpuSet(void) { s32 width, left; @@ -274,26 +297,26 @@ static void berry_fix_gpu_set(void) InitWindows(sBerryFixWindowTemplates); DeactivateAllTextPrinters(); - DmaCopy32(3, sUnknown_08618138, BG_PLTT + 0x1E0, 0x20); + DmaCopy32(3, sBerryFixPalColors, BG_PLTT + 0x1E0, sizeof(sBerryFixPalColors)); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP); FillWindowPixelBuffer(2, PIXEL_FILL(0)); FillWindowPixelBuffer(3, PIXEL_FILL(0)); - FillWindowPixelBuffer(0, PIXEL_FILL(0xA)); + FillWindowPixelBuffer(0, PIXEL_FILL(10)); width = GetStringWidth(0, sText_Emerald, 0); - left = (0x78 - width) / 2; + left = (120 - width) / 2; AddTextPrinterParameterized3(2, 0, left, 3, sGameTitleTextColors, TEXT_SPEED_FF, sText_Emerald); width = GetStringWidth(0, sText_RubySapphire, 0); - left = (0x78 - width) / 2 + 0x78; + left = (120 - width) / 2 + 120; AddTextPrinterParameterized3(2, 0, left, 3, sGameTitleTextColors, TEXT_SPEED_FF, sText_RubySapphire); width = GetStringWidth(0, sText_RubySapphire, 0); - left = (0x70 - width) / 2; + left = (112 - width) / 2; AddTextPrinterParameterized3(3, 0, left, 0, sGameTitleTextColors, TEXT_SPEED_FF, sText_RubySapphire); width = GetStringWidth(1, sText_BerryProgramUpdate, 0); - left = (0xD0 - width) / 2; + left = (208 - width) / 2; AddTextPrinterParameterized3(0, 1, left, 2, sBerryProgramTextColors, TEXT_SPEED_FF, sText_BerryProgramUpdate); CopyWindowToVram(2, 2); @@ -301,56 +324,55 @@ static void berry_fix_gpu_set(void) CopyWindowToVram(0, 2); } -static int berry_fix_text_update(int checkval) +static int BerryFix_TrySetScene(int scene) { - if (berry_fix_mb_manager->unk1 == checkval) + if (sBerryFix->curScene == scene) + return scene; + + if (sBerryFix->curScene == SCENE_NONE) { - return checkval; - } - if (berry_fix_mb_manager->unk1 == 6) - { - berry_fix_text_print(checkval); - berry_fix_mb_manager->unk1 = checkval; + BerryFix_SetScene(scene); + sBerryFix->curScene = scene; } else { - berry_fix_bg_hide(); - berry_fix_mb_manager->unk1 = 6; + BerryFix_HideScene(); + sBerryFix->curScene = SCENE_NONE; } - return berry_fix_mb_manager->unk1; + return sBerryFix->curScene; } -static void berry_fix_text_print(int scene) +static void BerryFix_SetScene(int scene) { FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32); - FillWindowPixelBuffer(1, PIXEL_FILL(0xA)); + FillWindowPixelBuffer(1, PIXEL_FILL(10)); AddTextPrinterParameterized3(1, 1, 0, 0, sBerryProgramTextColors, -1, sBerryProgramTexts[scene]); PutWindowTilemap(1); CopyWindowToVram(1, 2); switch (scene) { - case 0: - case 2: - case 3: - case 4: - PutWindowTilemap(2); - break; - case 1: - PutWindowTilemap(3); - break; - case 5: - PutWindowTilemap(0); - break; + case SCENE_ENSURE_CONNECT: + case SCENE_TRANSMITTING: + case SCENE_FOLLOW_INSTRUCT: + case SCENE_TRANSMIT_FAILED: + PutWindowTilemap(2); + break; + case SCENE_TURN_OFF_POWER: + PutWindowTilemap(3); + break; + case SCENE_BEGIN: + PutWindowTilemap(0); + break; } CopyBgTilemapBufferToVram(0); LZ77UnCompVram(sBerryFixGraphics[scene].gfx, (void *)BG_CHAR_ADDR(1)); LZ77UnCompVram(sBerryFixGraphics[scene].tilemap, (void *)BG_SCREEN_ADDR(31)); - CpuCopy32(sBerryFixGraphics[scene].pltt, (void *)BG_PLTT, 0x100); + CpuCopy32(sBerryFixGraphics[scene].palette, (void *)BG_PLTT, 0x100); ShowBg(0); ShowBg(1); } -static void berry_fix_bg_hide(void) +static void BerryFix_HideScene(void) { HideBg(0); HideBg(1); diff --git a/src/berry_tag_screen.c b/src/berry_tag_screen.c index 089228b17..27efb7e7a 100644 --- a/src/berry_tag_screen.c +++ b/src/berry_tag_screen.c @@ -26,7 +26,6 @@ #include "item_menu_icons.h" #include "decompress.h" #include "international_string_util.h" -#include "constants/berry.h" #include "constants/items.h" #include "constants/rgb.h" #include "constants/songs.h" @@ -277,11 +276,11 @@ static bool8 InitBerryTagScreen(void) gMain.state++; break; case 14: - BlendPalettes(-1, 0x10, 0); + BlendPalettes(PALETTES_ALL, 0x10, 0); gMain.state++; break; case 15: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); gPaletteFade.bufferTransferDisabled = 0; gMain.state++; break; @@ -515,7 +514,7 @@ static void DestroyFlavorCircleSprites(void) static void PrepareToCloseBerryTagScreen(u8 taskId) { PlaySE(SE_SELECT); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_CloseBerryTagScreen; } diff --git a/src/bike.c b/src/bike.c index c4964b627..bbcda989c 100644 --- a/src/bike.c +++ b/src/bike.c @@ -963,9 +963,10 @@ bool8 IsBikingDisallowedByPlayer(void) return TRUE; } -bool8 player_should_look_direction_be_enforced_upon_movement(void) +bool8 IsPlayerNotUsingAcroBikeOnBumpySlope(void) { - if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE) != FALSE && MetatileBehavior_IsBumpySlope(gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior) != FALSE) + if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE) + && MetatileBehavior_IsBumpySlope(gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior)) return FALSE; else return TRUE; diff --git a/src/cable_car.c b/src/cable_car.c index acd0bc7a5..56118161b 100644 --- a/src/cable_car.c +++ b/src/cable_car.c @@ -246,7 +246,7 @@ void CableCar(void) { ScriptContext2_Enable(); CreateTask(Task_LoadCableCar, 1); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB(0, 0, 0)); } static void CB2_LoadCableCar(void) @@ -350,7 +350,7 @@ static void CB2_LoadCableCar(void) gMain.state++; break; case 8: - BeginNormalPaletteFade(0xFFFFFFFF, 3, 16, 0, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 3, 16, 0, RGB(0, 0, 0)); FadeInNewBGM(MUS_CABLE_CAR, 1); SetBgRegs(TRUE); gMain.state++; @@ -468,7 +468,7 @@ static void Task_CableCar(u8 taskId) if (sCableCar->timer == 570) { sCableCar->state = 3; - BeginNormalPaletteFade(0xFFFFFFFF, 3, 0, 16, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 3, 0, 16, RGB(0, 0, 0)); FadeOutBGM(4); } break; diff --git a/src/cable_club.c b/src/cable_club.c index cd0baefcd..1d8c6e53d 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -82,7 +82,7 @@ static void Task_ReestablishLinkAwaitConfirmation(u8 taskId); static void CreateLinkupTask(u8 minPlayers, u8 maxPlayers) { - if (FindTaskIdByFunc(Task_LinkupStart) == 0xFF) + if (FindTaskIdByFunc(Task_LinkupStart) == TASK_NONE) { u8 taskId1; @@ -627,7 +627,7 @@ void ValidateMixingGameLanguage(void) { u32 taskId = FindTaskIdByFunc(Task_ValidateMixingGameLanguage); - if (taskId == 0xFF) + if (taskId == TASK_NONE) { taskId = CreateTask(Task_ValidateMixingGameLanguage, 80); gTasks[taskId].tState = 0; @@ -904,7 +904,7 @@ static void Task_StartWirelessCableClubBattle(u8 taskId) { struct LinkPlayer *player = (struct LinkPlayer *)gBlockRecvBuffer[i]; gLinkPlayers[i] = *player; - sub_800B524(&gLinkPlayers[i]); + ConvertLinkPlayerName(&gLinkPlayers[i]); ResetBlockReceivedFlag(i); } tState = 4; @@ -1267,7 +1267,8 @@ static void sub_80B3AD0(u8 taskId) #define tTimer data[1] -void sub_80B3AF8(u8 taskId) +// Confirm that all cabled link players are connected +void Task_ReconnectWithLinkPlayers(u8 taskId) { s16 *data = gTasks[taskId].data; diff --git a/src/clear_save_data_screen.c b/src/clear_save_data_screen.c index b91506352..0d69eb0fa 100644 --- a/src/clear_save_data_screen.c +++ b/src/clear_save_data_screen.c @@ -163,7 +163,7 @@ static bool8 SetupClearSaveDataScreen(void) ShowBg(3); SetGpuReg(REG_OFFSET_BLDCNT, 0); InitClearSaveDataScreenWindows(); - BeginNormalPaletteFade(0x0000FFFF, 0, 0x10, 0, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_BG, 0, 0x10, 0, RGB_WHITEALPHA); EnableInterrupts(INTR_FLAG_VBLANK); SetVBlankCallback(VBlankCB); gMain.state = 1; @@ -185,7 +185,7 @@ static void CB2_FadeAndDoReset(void) { case 0: default: - BeginNormalPaletteFade(0x0000FFFF, 0, 0, 0x10, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_BG, 0, 0, 0x10, RGB_WHITEALPHA); gMain.state = 1; break; case 1: diff --git a/src/contest.c b/src/contest.c index e7c420448..f5326663f 100644 --- a/src/contest.c +++ b/src/contest.c @@ -2711,7 +2711,7 @@ static void Task_TryCommunicateFinalStandings(u8 taskId) } else { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].func = Task_ContestReturnToField; } } @@ -2730,7 +2730,7 @@ static void Task_CommunicateFinalStandings(u8 taskId) static void Task_EndCommunicateFinalStandings(u8 taskId) { DestroyTask(taskId); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[eContest.mainTaskId].func = Task_ContestReturnToField; } @@ -3135,7 +3135,7 @@ static u8 CreateContestantSprite(u16 species, u32 otId, u32 personality, u32 ind if (IsSpeciesNotUnown(species)) gSprites[spriteId].affineAnims = gUnknown_082FF6C0; else - gSprites[spriteId].affineAnims = gUnknown_082FF694; + gSprites[spriteId].affineAnims = gAffineAnims_BattleSpriteOpponentSide; StartSpriteAffineAnim(gSprites + spriteId, 0); return spriteId; @@ -5998,7 +5998,7 @@ static u8 GetMonNicknameLanguage(u8 *nickname) u8 ret = GAME_LANGUAGE; if (nickname[0] == EXT_CTRL_CODE_BEGIN && nickname[1] == EXT_CTRL_CODE_JPN) - return LANGUAGE_ENGLISH; + return GAME_LANGUAGE; if (StringLength(nickname) < PLAYER_NAME_LENGTH - 1) { diff --git a/src/contest_painting.c b/src/contest_painting.c index 1602eb94f..4f0bf9245 100644 --- a/src/contest_painting.c +++ b/src/contest_painting.c @@ -44,7 +44,7 @@ static void PrintContestPaintingCaption(u8, u8); static void VBlankCB_ContestPainting(void); static void _InitContestMonPixels(u8 *spriteGfx, u16 *palette, u16 (*destPixels)[64][64]); -extern const u8 gUnknown_0827EA0C[]; +extern const u8 gContestPaintingCaption[]; extern const u8 gContestCoolness[]; extern const u8 gContestBeauty[]; extern const u8 gContestCuteness[]; @@ -165,12 +165,11 @@ const u16 gUnknown_085B0838[] = {RGB(0, 0, 0), RGB(0, 0, 0)}; void SetContestWinnerForPainting(int contestWinnerId) { - // probably fakematching u8 *ptr1 = &gUnknown_02039F5D; u8 *ptr2 = &gUnknown_02039F5C; - gCurContestWinner = gSaveBlock1Ptr->contestWinners[contestWinnerId - 1]; - *ptr1 = contestWinnerId - 1; - *ptr2 = FALSE; + gCurContestWinner = gSaveBlock1Ptr->contestWinners[contestWinnerId - 1]; + *ptr1 = contestWinnerId - 1; + *ptr2 = FALSE; } void CB2_ContestPainting(void) @@ -251,7 +250,7 @@ static void HoldContestPainting(void) if ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON))) { gContestPaintingState++; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB(0, 0, 0)); } if (gUnknown_030011F6) @@ -298,7 +297,7 @@ static void PrintContestPaintingCaption(u8 contestType, bool8 arg1) StringCopy(gStringVar2, gContestPaintingWinner->trainerName); sub_81DB5AC(gStringVar2); StringCopy(gStringVar3, gContestPaintingWinner->monName); - StringExpandPlaceholders(gStringVar4, gUnknown_0827EA0C); + StringExpandPlaceholders(gStringVar4, gContestPaintingCaption); } else { diff --git a/src/contest_util.c b/src/contest_util.c index e690a3bbe..e5fd51db1 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -517,7 +517,7 @@ static void CB2_StartShowContestResults(void) memset(sContestResults->monResults, 0, sizeof(*sContestResults->monResults)); LoadContestResultSprites(); TryCreateWirelessSprites(); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); gPaletteFade.bufferTransferDisabled = FALSE; sContestResults->data->showResultsTaskId = CreateTask(Task_ShowContestResults, 5); SetMainCallback2(CB2_ShowContestResults); @@ -1018,12 +1018,12 @@ static void Task_EndShowContestResults(u8 taskId) if (gTasks[taskId].tTimer == 0) { DestroyTask(sContestResults->data->highlightWinnerTaskId); - BlendPalettes(0x0000FFFF, 16, RGB_BLACK); + BlendPalettes(PALETTES_BG, 16, RGB_BLACK); gTasks[taskId].tTimer++; } else if (gTasks[taskId].tTimer == 1) { - BlendPalettes(0xFFFF0000, 16, RGB_BLACK); + BlendPalettes(PALETTES_OBJECTS, 16, RGB_BLACK); gTasks[taskId].tTimer++; } else @@ -2102,7 +2102,7 @@ void StartContest(void) { ScriptContext2_Enable(); CreateTask(Task_StartContest, 10); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); } void BufferContestantMonSpecies(void) @@ -2123,7 +2123,7 @@ void ShowContestResults(void) { ScriptContext2_Enable(); CreateTask(Task_StartShowContestResults, 10); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); } void GetContestPlayerId(void) @@ -2535,7 +2535,7 @@ void ShowContestEntryMonPic(void) u8 taskId; u8 left, top; - if (FindTaskIdByFunc(Task_ShowContestEntryMonPic) == 0xFF) + if (FindTaskIdByFunc(Task_ShowContestEntryMonPic) == TASK_NONE) { AllocateMonSpritesGfx(); left = 10; @@ -2578,7 +2578,7 @@ void ShowContestEntryMonPic(void) void HideContestEntryMonPic(void) { u8 taskId = FindTaskIdByFunc(Task_ShowContestEntryMonPic); - if (taskId != 0xFF) + if (taskId != TASK_NONE) { gTasks[taskId].data[0]++; FreeMonSpritesGfx(); diff --git a/src/credits.c b/src/credits.c index a9beb319c..84b802005 100644 --- a/src/credits.c +++ b/src/credits.c @@ -1235,7 +1235,7 @@ void CB2_StartCreditsSequence(void) gTasks[taskIdB].data[TDB_TASK_A_ID] = taskIdA; gTasks[taskIdA].data[TDA_TASK_B_ID] = taskIdB; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); EnableInterrupts(INTR_FLAG_VBLANK); SetVBlankCallback(CreditsVBlankCallback); m4aSongNumStart(MUS_CREDITS); @@ -1281,14 +1281,14 @@ static void Task_ProgressCreditTasks(u8 taskIdA) { gTasks[taskIdA].data[TDA_13] = data1; gTasks[taskIdA].data[TDA_11] = 0; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskIdA].func = sub_8175808; } else if (gTasks[taskIdA].data[TDA_11] == 2) { gTasks[taskIdA].data[TDA_13] = data1; gTasks[taskIdA].data[TDA_11] = 0; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskIdA].func = sub_81758A4; } } @@ -1309,7 +1309,7 @@ static void c2_080C9BFC(u8 taskIdA) if (sub_8176AB0(gTasks[taskIdA].data[TDA_7], taskIdA)) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); EnableInterrupts(INTR_FLAG_VBLANK); SetVBlankCallback(CreditsVBlankCallback); gTasks[taskIdA].func = Task_WaitPaletteFade; @@ -1369,7 +1369,7 @@ static void Task_CreditsLoadGrassScene(u8 taskIdA) gTasks[gTasks[taskIdA].data[TDA_TASK_D_ID]].data[TDD_TASK_A_ID] = taskIdA; gTasks[gTasks[taskIdA].data[TDA_TASK_D_ID]].data[TDD_2] = gTasks[taskIdA].data[TDA_7]; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); SetGpuReg(REG_OFFSET_BG3HOFS, 0); SetGpuReg(REG_OFFSET_BG3VOFS, 32); SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_PRIORITY(3) @@ -1398,7 +1398,7 @@ static void Task_CreditsTheEnd1(u8 taskIdA) return; } - BeginNormalPaletteFade(0xFFFFFFFF, 12, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 12, 0, 16, RGB_BLACK); gTasks[taskIdA].func = Task_CreditsTheEnd2; } @@ -1418,7 +1418,7 @@ static void Task_CreditsTheEnd3(u8 taskIdA) LoadTheEndScreen(0, 0x3800, 0); ResetSpriteData(); FreeAllSpritePalettes(); - BeginNormalPaletteFade(0xFFFFFFFF, 8, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 8, 16, 0, RGB_BLACK); SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) @@ -1442,7 +1442,7 @@ static void Task_CreditsTheEnd4(u8 taskIdA) return; } - BeginNormalPaletteFade(0xFFFFFFFF, 6, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 6, 0, 16, RGB_BLACK); gTasks[taskIdA].func = Task_CreditsTheEnd5; } @@ -1452,7 +1452,7 @@ static void Task_CreditsTheEnd5(u8 taskIdA) { sub_8176E40(0x3800, 0); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0, RGB_BLACK); gTasks[taskIdA].data[TDA_0] = 7200; gTasks[taskIdA].func = Task_CreditsTheEnd6; } @@ -1465,7 +1465,7 @@ static void Task_CreditsTheEnd6(u8 taskIdA) if (gTasks[taskIdA].data[TDA_0] == 0 || gMain.newKeys) { FadeOutBGM(4); - BeginNormalPaletteFade(0xFFFFFFFF, 8, 0, 16, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL, 8, 0, 16, RGB_WHITEALPHA); gTasks[taskIdA].func = Task_CreditsSoftReset; return; } diff --git a/src/crt0.s b/src/crt0.s index 49f214f80..385e340a5 100644 --- a/src/crt0.s +++ b/src/crt0.s @@ -1,3 +1,4 @@ +#include "constants/global.h" .include "constants/gba_constants.inc" .syntax unified @@ -34,8 +35,8 @@ GPIOPortReadEnable: @ 80000C8 @ 80000CC .space 0x34 - .4byte 3 - .4byte 2 + .4byte GAME_VERSION + .4byte GAME_LANGUAGE .ascii "pokemon emerald version" .space 9 @@ -51,17 +52,33 @@ GPIOPortReadEnable: @ 80000C8 .4byte gMoveNames .4byte gDecorations - .4byte 0x00001270, 0x0000139c, 0x00000018, 0x00000988 - .4byte 0x00003b24, 0x00000046, 0x000008e4, 0x000008ac - .4byte 0x00000182 + .4byte 0x00001270 @ offsetof(struct SaveBlock1, flags) + .4byte 0x0000139c @ offsetof(struct SaveBlock1, vars) + .4byte 0x00000018 @ offsetof(struct SaveBlock2, pokedex) + .4byte 0x00000988 @ offsetof(struct SaveBlock1, seen1) + .4byte 0x00003b24 @ offsetof(struct SaveBlock1, seen2) + .4byte 0x00000046 @ ? + .4byte 0x000008e4 @ ? + .4byte 0x000008ac @ ? + .4byte 0x00000182 @ NATIONAL_DEX_COUNT? .byte 0x07, 0x0a, 0x0a, 0x0a, 0x0c, 0x0c, 0x06, 0x0c .byte 0x06, 0x10, 0x12, 0x0c, 0x0f, 0x0b, 0x01, 0x08 - .4byte 0x0000000c, 0x00000f2c, 0x00003d88, 0x00000234 - .4byte 0x00000238, 0x00000009, 0x0000000a, 0x00000000 - .4byte 0x00000008, 0x00000ca8, 0x00000ca8, 0x000031c7 - .4byte 0x000031b3, 0x00000000 + .4byte 0x0000000c @ ? + .4byte 0x00000f2c @ sizeof(struct SaveBlock2) + .4byte 0x00003d88 @ sizeof(struct SaveBlock1) + .4byte 0x00000234 @ offsetof(struct SaveBlock1, playerPartyCount) + .4byte 0x00000238 @ offsetof(struct SaveBlock1, playerParty) + .4byte 0x00000009 @ offsetof(struct SaveBlock2, specialSaveWarpFlags) + .4byte 0x0000000a @ offsetof(struct SaveBlock2, playerTrainerId) + .4byte 0x00000000 @ offsetof(struct SaveBlock2, playerName) + .4byte 0x00000008 @ offsetof(struct SaveBlock2, playerGender) + .4byte 0x00000ca8 @ offsetof(struct SaveBlock2, frontier.challengeStatus) + .4byte 0x00000ca8 @ offsetof(struct SaveBlock2, frontier.challengeStatus) + .4byte 0x000031c7 @ offsetof(struct SaveBlock1, externalEventFlags) + .4byte 0x000031b3 @ offsetof(struct SaveBlock1, externalEventData) + .4byte 0x00000000 .4byte gBaseStats .4byte gAbilityNames @@ -71,12 +88,19 @@ GPIOPortReadEnable: @ 80000C8 .4byte gBallSpriteSheets .4byte gBallSpritePalettes - .4byte 0x000000a8, 0x00000864, 0x0000089b + .4byte 0x000000a8 @ offsetof(struct SaveBlock2, gcnLinkFlags) + .4byte 0x00000864 @ ? + .4byte 0x0000089b @ ? .byte 0x1e, 0x1e, 0x10, 0x40 - .4byte 0x0000322e, 0x00000498, 0x000031a8, 0x000031f8 - .4byte 0x00000034, 0x00000000, 0x00000000 + .4byte 0x0000322e @ offsetof(struct SaveBlock1, ? part-way into unk_322C) + .4byte 0x00000498 @ offsetof(struct SaveBlock1, pcItems) + .4byte 0x000031a8 @ offsetof(struct SaveBlock1, giftRibbons) + .4byte 0x000031f8 @ offsetof(struct SaveBlock1, enigmaBerry) + .4byte 0x00000034 @ offsetof(struct SaveBlock1, mapView) + .4byte 0x00000000 + .4byte 0x00000000 .arm .align 2, 0 diff --git a/src/data.c b/src/data.c index 4861da18b..6a4295440 100644 --- a/src/data.c +++ b/src/data.c @@ -8,12 +8,11 @@ #include "constants/trainers.h" #include "constants/battle_ai.h" -const u16 gUnknown_082FF1D8[] = INCBIN_U16("graphics/link/minigame_digits.gbapal"); -const u32 gUnknown_082FF1F8[] = INCBIN_U32("graphics/link/minigame_digits.4bpp.lz"); -// unused -const u32 gUnknown_082FF2B8[] = INCBIN_U32("graphics/link/minigame_digits2.4bpp.lz"); +const u16 gMinigameDigits_Pal[] = INCBIN_U16("graphics/link/minigame_digits.gbapal"); +const u32 gMinigameDigits_Gfx[] = INCBIN_U32("graphics/link/minigame_digits.4bpp.lz"); +static const u32 sMinigameDigitsThin_Gfx[] = INCBIN_U32("graphics/link/minigame_digits2.4bpp.lz"); // Unused -const struct SpriteFrameImage gUnknown_082FF3A8[] = +const struct SpriteFrameImage gBattlerPicTable_PlayerLeft[] = { gHeap + 0x8000, 0x800, gHeap + 0x8800, 0x800, @@ -21,7 +20,7 @@ const struct SpriteFrameImage gUnknown_082FF3A8[] = gHeap + 0x9800, 0x800, }; -const struct SpriteFrameImage gUnknown_082FF3C8[] = +const struct SpriteFrameImage gBattlerPicTable_OpponentLeft[] = { gHeap + 0xA000, 0x800, gHeap + 0xA800, 0x800, @@ -29,7 +28,7 @@ const struct SpriteFrameImage gUnknown_082FF3C8[] = gHeap + 0xB800, 0x800, }; -const struct SpriteFrameImage gUnknown_082FF3E8[] = +const struct SpriteFrameImage gBattlerPicTable_PlayerRight[] = { gHeap + 0xC000, 0x800, gHeap + 0xC800, 0x800, @@ -37,7 +36,7 @@ const struct SpriteFrameImage gUnknown_082FF3E8[] = gHeap + 0xD800, 0x800, }; -const struct SpriteFrameImage gUnknown_082FF408[] = +const struct SpriteFrameImage gBattlerPicTable_OpponentRight[] = { gHeap + 0xE000, 0x800, gHeap + 0xE800, 0x800, @@ -189,7 +188,7 @@ static const union AffineAnimCmd gUnknown_082FF600[] = AFFINEANIMCMD_END, }; -const union AffineAnimCmd *const gUnknown_082FF618[] = +const union AffineAnimCmd *const gAffineAnims_BattleSpritePlayerSide[] = { gUnknown_082FF548, gUnknown_082FF568, @@ -229,7 +228,7 @@ static const union AffineAnimCmd gUnknown_082FF684[] = AFFINEANIMCMD_END, }; -const union AffineAnimCmd *const gUnknown_082FF694[] = +const union AffineAnimCmd *const gAffineAnims_BattleSpriteOpponentSide[] = { gUnknown_082FF548, gUnknown_082FF568, @@ -313,8 +312,7 @@ const union AnimCmd *const gUnknown_082FF70C[] = #include "data/pokemon_graphics/front_pic_anims.h" #include "data/pokemon_graphics/front_pic_table.h" -// unused -const u32 gUnknown830AF4C[] = +static const u32 sUnused[] = { 0x00000888, 0x00000888, 0x00000888, 0x00000888, 0x00000088, 0x00000888, 0x00000888, 0x00000886, diff --git a/src/data/bard_music/bard_sounds.h b/src/data/bard_music/bard_sounds.h index 1ec1f0d97..1dd5c7f56 100644 --- a/src/data/bard_music/bard_sounds.h +++ b/src/data/bard_music/bard_sounds.h @@ -25,28 +25,28 @@ #include "trendysaying.h" const struct BardSound (*const gBardSoundsTable[EC_NUM_GROUPS])[6] = { - [EC_GROUP_POKEMON] = NULL, // Handled by gBardSounds_Pokemon - [EC_GROUP_TRAINER] = gBardSounds_Trainer, - [EC_GROUP_STATUS] = gBardSounds_Status, - [EC_GROUP_BATTLE] = gBardSounds_Battle, - [EC_GROUP_GREETINGS] = gBardSounds_Greetings, - [EC_GROUP_PEOPLE] = gBardSounds_People, - [EC_GROUP_VOICES] = gBardSounds_Voices, - [EC_GROUP_SPEECH] = gBardSounds_Speech, - [EC_GROUP_ENDINGS] = gBardSounds_Endings, - [EC_GROUP_FEELINGS] = gBardSounds_Feelings, - [EC_GROUP_CONDITIONS] = gBardSounds_Conditions, - [EC_GROUP_ACTIONS] = gBardSounds_Actions, - [EC_GROUP_LIFESTYLE] = gBardSounds_Lifestyle, - [EC_GROUP_HOBBIES] = gBardSounds_Hobbies, - [EC_GROUP_TIME] = gBardSounds_Time, - [EC_GROUP_MISC] = gBardSounds_Misc, - [EC_GROUP_ADJECTIVES] = gBardSounds_Adjectives, - [EC_GROUP_EVENTS] = gBardSounds_Events, - [EC_GROUP_MOVE_1] = NULL, // Handled by gBardSounds_Moves - [EC_GROUP_MOVE_2] = NULL, // Handled by gBardSounds_Moves - [EC_GROUP_TRENDY_SAYING] = gBardSounds_TrendySaying, - [EC_GROUP_POKEMON_2] = NULL // Handled by gBardSounds_Pokemon + [EC_GROUP_POKEMON] = NULL, // Handled by gBardSounds_Pokemon + [EC_GROUP_TRAINER] = gBardSounds_Trainer, + [EC_GROUP_STATUS] = gBardSounds_Status, + [EC_GROUP_BATTLE] = gBardSounds_Battle, + [EC_GROUP_GREETINGS] = gBardSounds_Greetings, + [EC_GROUP_PEOPLE] = gBardSounds_People, + [EC_GROUP_VOICES] = gBardSounds_Voices, + [EC_GROUP_SPEECH] = gBardSounds_Speech, + [EC_GROUP_ENDINGS] = gBardSounds_Endings, + [EC_GROUP_FEELINGS] = gBardSounds_Feelings, + [EC_GROUP_CONDITIONS] = gBardSounds_Conditions, + [EC_GROUP_ACTIONS] = gBardSounds_Actions, + [EC_GROUP_LIFESTYLE] = gBardSounds_Lifestyle, + [EC_GROUP_HOBBIES] = gBardSounds_Hobbies, + [EC_GROUP_TIME] = gBardSounds_Time, + [EC_GROUP_MISC] = gBardSounds_Misc, + [EC_GROUP_ADJECTIVES] = gBardSounds_Adjectives, + [EC_GROUP_EVENTS] = gBardSounds_Events, + [EC_GROUP_MOVE_1] = NULL, // Handled by gBardSounds_Moves + [EC_GROUP_MOVE_2] = NULL, // Handled by gBardSounds_Moves + [EC_GROUP_TRENDY_SAYING] = gBardSounds_TrendySaying, + [EC_GROUP_POKEMON_NATIONAL] = NULL // Handled by gBardSounds_Pokemon }; #endif //GUARD_BARD_SOUNDS_TABLE_H diff --git a/src/data/bard_music/moves.h b/src/data/bard_music/moves.h index 6bb350a7c..89fc4c0f1 100644 --- a/src/data/bard_music/moves.h +++ b/src/data/bard_music/moves.h @@ -1,12 +1,12 @@ #ifndef GUARD_DATA_BARD_MUSIC_MOVES_H #define GUARD_DATA_BARD_MUSIC_MOVES_H -#include "moves.h" +#include "constants/moves.h" -const u16 gUnknown_085FA1D4 = 0x163; +const u16 gNumBardWords_Moves = MOVES_COUNT; -const struct BardSound gBardSounds_Moves[][6] = { - { +const struct BardSound gBardSounds_Moves[MOVES_COUNT][6] = { + [MOVE_NONE] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -14,7 +14,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_POUND] = { { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -22,7 +22,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_KARATE_CHOP] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, @@ -30,7 +30,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DOUBLE_SLAP] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0xa, 0x0, 0x0, 0x0, 0x0}, { 0x2, 0x0, 0x0, 0x0, 0x0}, @@ -38,7 +38,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_COMET_PUNCH] = { { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -46,7 +46,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MEGA_PUNCH] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -54,7 +54,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_PAY_DAY] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -62,7 +62,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FIRE_PUNCH] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -70,7 +70,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ICE_PUNCH] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, @@ -78,7 +78,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_THUNDER_PUNCH] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -86,7 +86,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SCRATCH] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -94,7 +94,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_VISE_GRIP] = { { 0x14, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -102,7 +102,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_GUILLOTINE] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, @@ -110,7 +110,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_RAZOR_WIND] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, @@ -118,7 +118,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SWORDS_DANCE] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x1, 0x0, 0x0, 0x0, 0x0}, @@ -126,7 +126,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CUT] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -134,7 +134,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_GUST] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -142,7 +142,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_WING_ATTACK] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -150,7 +150,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_WHIRLWIND] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, @@ -158,7 +158,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FLY] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -166,7 +166,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BIND] = { { 0x14, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -174,7 +174,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SLAM] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -182,7 +182,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_VINE_WHIP] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -190,7 +190,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_STOMP] = { { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -198,7 +198,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DOUBLE_KICK] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -206,7 +206,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MEGA_KICK] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -214,7 +214,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_JUMP_KICK] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -222,7 +222,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ROLLING_KICK] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -230,7 +230,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SAND_ATTACK] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -238,7 +238,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HEADBUTT] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -246,7 +246,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HORN_ATTACK] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -254,7 +254,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FURY_ATTACK] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -262,7 +262,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HORN_DRILL] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -270,7 +270,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TACKLE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -278,7 +278,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BODY_SLAM] = { { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2, 0x0, 0x0, 0x0, 0x0}, @@ -286,7 +286,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_WRAP] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -294,7 +294,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TAKE_DOWN] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x23, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -302,7 +302,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_THRASH] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x2, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -310,7 +310,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DOUBLE_EDGE] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0xa, 0x0, 0x0, 0x0, 0x0}, @@ -318,7 +318,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TAIL_WHIP] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -326,7 +326,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_POISON_STING] = { { 0x1e, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, @@ -334,7 +334,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TWINEEDLE] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, @@ -342,7 +342,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_PIN_MISSILE] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, @@ -350,7 +350,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_LEER] = { { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -358,7 +358,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BITE] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -366,7 +366,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_GROWL] = { { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -374,7 +374,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ROAR] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -382,7 +382,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SING] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -390,7 +390,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SUPERSONIC] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -398,7 +398,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SONIC_BOOM] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, @@ -406,7 +406,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DISABLE] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, @@ -414,7 +414,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ACID] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -422,7 +422,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_EMBER] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -430,7 +430,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FLAMETHROWER] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -438,7 +438,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MIST] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -446,7 +446,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_WATER_GUN] = { { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x32, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -454,7 +454,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HYDRO_PUMP] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -462,7 +462,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SURF] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -470,7 +470,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ICE_BEAM] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -478,7 +478,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BLIZZARD] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x32, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -486,7 +486,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_PSYBEAM] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -494,7 +494,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BUBBLE_BEAM] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -502,7 +502,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_AURORA_BEAM] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -510,7 +510,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [MOVE_HYPER_BEAM] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -518,7 +518,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_PECK] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -526,7 +526,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DRILL_PECK] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -534,7 +534,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SUBMISSION] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, @@ -542,7 +542,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_LOW_KICK] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -550,7 +550,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_COUNTER] = { { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -558,7 +558,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SEISMIC_TOSS] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -566,7 +566,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_STRENGTH] = { { 0x32, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -574,7 +574,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ABSORB] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -582,7 +582,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MEGA_DRAIN] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, @@ -590,7 +590,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_LEECH_SEED] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -598,7 +598,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_GROWTH] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -606,7 +606,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_RAZOR_LEAF] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -614,7 +614,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SOLAR_BEAM] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -622,7 +622,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_POISON_POWDER] = { { 0x1e, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, @@ -630,7 +630,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_STUN_SPORE] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -638,7 +638,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SLEEP_POWDER] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -646,7 +646,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_PETAL_DANCE] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x2, 0x0, 0x0, 0x0, 0x0}, @@ -654,7 +654,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_STRING_SHOT] = { { 0x32, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -662,7 +662,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DRAGON_RAGE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x5, 0x0, 0x0, 0x0, 0x0}, @@ -670,7 +670,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [MOVE_FIRE_SPIN] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, @@ -678,7 +678,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_THUNDER_SHOCK] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -686,7 +686,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_THUNDERBOLT] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, @@ -694,7 +694,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_THUNDER_WAVE] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x5, 0x0, 0x0, 0x0, 0x0}, @@ -702,7 +702,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_THUNDER] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -710,7 +710,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ROCK_THROW] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -718,7 +718,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_EARTHQUAKE] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -726,7 +726,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FISSURE] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x32, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -734,7 +734,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DIG] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -742,7 +742,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TOXIC] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -750,7 +750,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CONFUSION] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x29, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -758,7 +758,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_PSYCHIC] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -766,7 +766,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HYPNOSIS] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -774,7 +774,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MEDITATE] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, @@ -782,7 +782,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_AGILITY] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -790,7 +790,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_QUICK_ATTACK] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -798,7 +798,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_RAGE] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -806,7 +806,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TELEPORT] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, @@ -814,7 +814,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_NIGHT_SHADE] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -822,7 +822,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MIMIC] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -830,7 +830,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SCREECH] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0xd, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -838,7 +838,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DOUBLE_TEAM] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -846,7 +846,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_RECOVER] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -854,7 +854,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HARDEN] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -862,7 +862,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MINIMIZE] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -870,7 +870,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SMOKESCREEN] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -878,7 +878,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CONFUSE_RAY] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x2d, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, @@ -886,7 +886,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_WITHDRAW] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -894,7 +894,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DEFENSE_CURL] = { { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, { 0x32, 0x0, 0x0, 0x0, 0x0}, @@ -902,7 +902,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BARRIER] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -910,7 +910,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_LIGHT_SCREEN] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -918,7 +918,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HAZE] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -926,7 +926,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_REFLECT] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -934,7 +934,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FOCUS_ENERGY] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, @@ -942,7 +942,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [MOVE_BIDE] = { { 0xb, 0x0, 0x0, 0x0, 0x0}, { 0x32, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -950,7 +950,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_METRONOME] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -958,7 +958,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MIRROR_MOVE] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x32, 0x0, 0x0, 0x0, 0x0}, { 0x29, 0x0, 0x0, 0x0, 0x0}, @@ -966,7 +966,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SELF_DESTRUCT] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -974,7 +974,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_EGG_BOMB] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -982,7 +982,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_LICK] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -990,7 +990,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SMOG] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -998,7 +998,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SLUDGE] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1006,7 +1006,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BONE_CLUB] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1014,7 +1014,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FIRE_BLAST] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -1022,7 +1022,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_WATERFALL] = { { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, @@ -1030,7 +1030,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CLAMP] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1038,7 +1038,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SWIFT] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1046,7 +1046,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SKULL_BASH] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -1054,7 +1054,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SPIKE_CANNON] = { { 0x14, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, @@ -1062,7 +1062,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CONSTRICT] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1070,7 +1070,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_AMNESIA] = { { 0x2, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -1078,7 +1078,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_KINESIS] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -1086,7 +1086,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SOFT_BOILED] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x1e, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, @@ -1094,7 +1094,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HIGH_JUMP_KICK] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -1102,7 +1102,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_GLARE] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1110,7 +1110,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DREAM_EATER] = { { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -1118,7 +1118,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_POISON_GAS] = { { 0x1e, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -1126,7 +1126,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BARRAGE] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1134,7 +1134,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_LEECH_LIFE] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1142,7 +1142,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_LOVELY_KISS] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -1150,7 +1150,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [MOVE_SKY_ATTACK] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -1158,7 +1158,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TRANSFORM] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1166,7 +1166,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BUBBLE] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1174,7 +1174,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DIZZY_PUNCH] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -1182,7 +1182,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SPORE] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1190,7 +1190,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FLASH] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1198,7 +1198,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_PSYWAVE] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1206,7 +1206,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SPLASH] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1214,7 +1214,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ACID_ARMOR] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -1222,7 +1222,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CRABHAMMER] = { { 0x2, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -1230,7 +1230,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_EXPLOSION] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -1238,7 +1238,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [MOVE_FURY_SWIPES] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -1246,7 +1246,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BONEMERANG] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -1254,7 +1254,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_REST] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1262,7 +1262,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ROCK_SLIDE] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1270,7 +1270,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HYPER_FANG] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -1278,7 +1278,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SHARPEN] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1286,7 +1286,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CONVERSION] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -1294,7 +1294,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TRI_ATTACK] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -1302,7 +1302,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SUPER_FANG] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x1, 0x0, 0x0, 0x0, 0x0}, @@ -1310,7 +1310,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SLASH] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1318,7 +1318,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SUBSTITUTE] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, @@ -1326,7 +1326,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_STRUGGLE] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1334,7 +1334,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SKETCH] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1342,7 +1342,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TRIPLE_KICK] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -1350,7 +1350,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_THIEF] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1358,7 +1358,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SPIDER_WEB] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, @@ -1366,7 +1366,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MIND_READER] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -1374,7 +1374,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_NIGHTMARE] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1382,7 +1382,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FLAME_WHEEL] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1390,7 +1390,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SNORE] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1398,7 +1398,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CURSE] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1406,7 +1406,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FLAIL] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1414,7 +1414,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CONVERSION_2] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -1422,7 +1422,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [MOVE_AEROBLAST] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -1430,7 +1430,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_COTTON_SPORE] = { { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, @@ -1438,7 +1438,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_REVERSAL] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, @@ -1446,7 +1446,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SPITE] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1454,7 +1454,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_POWDER_SNOW] = { { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -1462,7 +1462,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_PROTECT] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1470,7 +1470,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MACH_PUNCH] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1478,7 +1478,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SCARY_FACE] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, @@ -1486,7 +1486,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FEINT_ATTACK] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -1494,7 +1494,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SWEET_KISS] = { { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1502,7 +1502,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BELLY_DRUM] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -1510,7 +1510,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SLUDGE_BOMB] = { { 0x2b, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1518,7 +1518,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MUD_SLAP] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1526,7 +1526,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_OCTAZOOKA] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x28, 0x0, 0x0, 0x0, 0x0}, @@ -1534,7 +1534,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SPIKES] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1542,7 +1542,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ZAP_CANNON] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -1550,7 +1550,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FORESIGHT] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x14, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1558,7 +1558,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DESTINY_BOND] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -1566,7 +1566,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_PERISH_SONG] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -1574,7 +1574,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ICY_WIND] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, @@ -1582,7 +1582,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DETECT] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1590,7 +1590,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BONE_RUSH] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1598,7 +1598,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_LOCK_ON] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1606,7 +1606,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_OUTRAGE] = { { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1614,7 +1614,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SANDSTORM] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1622,7 +1622,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_GIGA_DRAIN] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, @@ -1630,7 +1630,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ENDURE] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1638,7 +1638,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CHARM] = { { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1646,7 +1646,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ROLLOUT] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1654,7 +1654,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FALSE_SWIPE] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1662,7 +1662,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SWAGGER] = { { 0x2, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1670,7 +1670,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MILK_DRINK] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1678,7 +1678,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SPARK] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1686,7 +1686,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FURY_CUTTER] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -1694,7 +1694,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_STEEL_WING] = { { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0xd, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1702,7 +1702,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MEAN_LOOK] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1710,7 +1710,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ATTRACT] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1718,7 +1718,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SLEEP_TALK] = { { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1726,7 +1726,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HEAL_BELL] = { { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0xa, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1734,7 +1734,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_RETURN] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1742,7 +1742,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_PRESENT] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1750,7 +1750,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FRUSTRATION] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -1758,7 +1758,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SAFEGUARD] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1766,7 +1766,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_PAIN_SPLIT] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1774,7 +1774,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SACRED_FIRE] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -1782,7 +1782,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [MOVE_MAGNITUDE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, @@ -1790,7 +1790,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DYNAMIC_PUNCH] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -1798,7 +1798,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MEGAHORN] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, @@ -1806,7 +1806,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DRAGON_BREATH] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, @@ -1814,7 +1814,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [MOVE_BATON_PASS] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -1822,7 +1822,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ENCORE] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1830,7 +1830,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_PURSUIT] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1838,7 +1838,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_RAPID_SPIN] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, @@ -1846,7 +1846,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SWEET_SCENT] = { { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1854,7 +1854,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_IRON_TAIL] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x5, 0x0, 0x0, 0x0, 0x0}, @@ -1862,7 +1862,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_METAL_CLAW] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -1870,7 +1870,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_VITAL_THROW] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -1878,7 +1878,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MORNING_SUN] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -1886,7 +1886,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SYNTHESIS] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, @@ -1894,7 +1894,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MOONLIGHT] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1902,7 +1902,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HIDDEN_POWER] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, @@ -1910,7 +1910,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CROSS_CHOP] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1918,7 +1918,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TWISTER] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1926,7 +1926,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_RAIN_DANCE] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1934,7 +1934,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SUNNY_DAY] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x5, 0x0, 0x0, 0x0, 0x0}, @@ -1942,7 +1942,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CRUNCH] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1950,7 +1950,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MIRROR_COAT] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -1958,7 +1958,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_PSYCH_UP] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1966,7 +1966,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_EXTREME_SPEED] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -1974,7 +1974,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ANCIENT_POWER] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, @@ -1982,7 +1982,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [MOVE_SHADOW_BALL] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -1990,7 +1990,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FUTURE_SIGHT] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -1998,7 +1998,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ROCK_SMASH] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2006,7 +2006,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_WHIRLPOOL] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2014,7 +2014,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BEAT_UP] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2022,7 +2022,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FAKE_OUT] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2030,7 +2030,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_UPROAR] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2038,7 +2038,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_STOCKPILE] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x14, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2046,7 +2046,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SPIT_UP] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2054,7 +2054,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SWALLOW] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2062,7 +2062,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HEAT_WAVE] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2070,7 +2070,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HAIL] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2078,7 +2078,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TORMENT] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2086,7 +2086,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FLATTER] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2094,7 +2094,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_WILL_O_WISP] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -2102,7 +2102,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MEMENTO] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -2110,7 +2110,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FACADE] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2118,7 +2118,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FOCUS_PUNCH] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -2126,7 +2126,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SMELLING_SALTS] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -2134,7 +2134,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FOLLOW_ME] = { { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -2142,7 +2142,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_NATURE_POWER] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, @@ -2150,7 +2150,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CHARGE] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2158,7 +2158,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TAUNT] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2166,7 +2166,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HELPING_HAND] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -2174,7 +2174,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TRICK] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2182,7 +2182,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ROLE_PLAY] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2190,7 +2190,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_WISH] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2198,7 +2198,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ASSIST] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2206,7 +2206,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_INGRAIN] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2214,7 +2214,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SUPERPOWER] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, @@ -2222,7 +2222,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MAGIC_COAT] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -2230,7 +2230,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_RECYCLE] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, @@ -2238,7 +2238,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_REVENGE] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2246,7 +2246,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BRICK_BREAK] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2254,7 +2254,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_YAWN] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2262,7 +2262,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_KNOCK_OFF] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2270,7 +2270,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ENDEAVOR] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -2278,7 +2278,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ERUPTION] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, @@ -2286,7 +2286,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SKILL_SWAP] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2294,7 +2294,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_IMPRISON] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -2302,7 +2302,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_REFRESH] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2310,7 +2310,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_GRUDGE] = { { 0x2b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2318,7 +2318,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SNATCH] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2326,7 +2326,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SECRET_POWER] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, @@ -2334,7 +2334,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DIVE] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2342,7 +2342,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ARM_THRUST] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2350,7 +2350,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CAMOUFLAGE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -2358,7 +2358,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TAIL_GLOW] = { { 0x4, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2366,7 +2366,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_LUSTER_PURGE] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x32, 0x0, 0x0, 0x0, 0x0}, @@ -2374,7 +2374,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MIST_BALL] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2382,7 +2382,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FEATHER_DANCE] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -2390,7 +2390,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TEETER_DANCE] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -2398,7 +2398,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BLAZE_KICK] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2406,7 +2406,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MUD_SPORT] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -2414,7 +2414,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ICE_BALL] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2422,7 +2422,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_NEEDLE_ARM] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, @@ -2430,7 +2430,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SLACK_OFF] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2438,7 +2438,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HYPER_VOICE] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x1e, 0x0, 0x0, 0x0, 0x0}, @@ -2446,7 +2446,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_POISON_FANG] = { { 0x1e, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -2454,7 +2454,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CRUSH_CLAW] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2462,7 +2462,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BLAST_BURN] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -2470,7 +2470,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HYDRO_CANNON] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -2478,7 +2478,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [MOVE_METEOR_MASH] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -2486,7 +2486,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0} }, - { + [MOVE_ASTONISH] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -2494,7 +2494,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_WEATHER_BALL] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -2502,7 +2502,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_AROMATHERAPY] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -2510,7 +2510,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0} }, - { + [MOVE_FAKE_TEARS] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2518,7 +2518,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_AIR_CUTTER] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -2526,7 +2526,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_OVERHEAT] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -2534,7 +2534,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ODOR_SLEUTH] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, @@ -2542,7 +2542,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ROCK_TOMB] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2550,7 +2550,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SILVER_WIND] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, @@ -2558,7 +2558,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_METAL_SOUND] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, @@ -2566,7 +2566,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_GRASS_WHISTLE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, @@ -2574,7 +2574,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_TICKLE] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2582,7 +2582,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_COSMIC_POWER] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, @@ -2590,7 +2590,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_WATER_SPOUT] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, @@ -2598,7 +2598,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SIGNAL_BEAM] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -2606,7 +2606,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SHADOW_PUNCH] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -2614,7 +2614,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_EXTRASENSORY] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, @@ -2622,7 +2622,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [MOVE_SKY_UPPERCUT] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -2630,7 +2630,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SAND_TOMB] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2638,7 +2638,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SHEER_COLD] = { { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -2646,7 +2646,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MUDDY_WATER] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -2654,7 +2654,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BULLET_SEED] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -2662,7 +2662,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_AERIAL_ACE] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -2670,7 +2670,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ICICLE_SPEAR] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -2678,7 +2678,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [MOVE_IRON_DEFENSE] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -2686,7 +2686,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BLOCK] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2694,7 +2694,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_HOWL] = { { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2702,7 +2702,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DRAGON_CLAW] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, @@ -2710,7 +2710,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_FRENZY_PLANT] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -2718,7 +2718,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BULK_UP] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2726,7 +2726,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_BOUNCE] = { { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2734,7 +2734,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MUD_SHOT] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2742,7 +2742,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_POISON_TAIL] = { { 0x1e, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x5, 0x0, 0x0, 0x0, 0x0}, @@ -2750,7 +2750,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_COVET] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2758,7 +2758,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_VOLT_TACKLE] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -2766,7 +2766,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_MAGICAL_LEAF] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, @@ -2774,7 +2774,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [MOVE_WATER_SPORT] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, @@ -2782,7 +2782,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_CALM_MIND] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2790,7 +2790,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_LEAF_BLADE] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2798,7 +2798,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DRAGON_DANCE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -2806,7 +2806,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_ROCK_BLAST] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2814,7 +2814,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_SHOCK_WAVE] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2822,7 +2822,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_WATER_PULSE] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -2830,7 +2830,7 @@ const struct BardSound gBardSounds_Moves[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [MOVE_DOOM_DESIRE] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -2838,7 +2838,7 @@ const struct BardSound gBardSounds_Moves[][6] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [MOVE_PSYCHO_BOOST] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, diff --git a/src/data/bard_music/pokemon.h b/src/data/bard_music/pokemon.h index 5ccf2f830..294cd4078 100644 --- a/src/data/bard_music/pokemon.h +++ b/src/data/bard_music/pokemon.h @@ -1,10 +1,10 @@ #ifndef GUARD_DATA_BARD_MUSIC_POKEMON_H #define GUARD_DATA_BARD_MUSIC_POKEMON_H -const u16 gNumSpeciesNames = NUM_SPECIES; +const u16 gNumBardWords_Species = NUM_SPECIES; -const struct BardSound gBardSounds_Pokemon[][6] = { - { +const struct BardSound gBardSounds_Pokemon[NUM_SPECIES][6] = { + [SPECIES_NONE] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -12,7 +12,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BULBASAUR] = { { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -20,7 +20,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_IVYSAUR] = { { 0x14, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x32, 0x0, 0x0, 0x0, 0x0}, @@ -28,7 +28,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_VENUSAUR] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -36,7 +36,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CHARMANDER] = { { 0x6, 0x0, 0x0, 0x0, 0x0}, { 0x2, 0x0, 0x0, 0x0, 0x0}, { 0x32, 0x0, 0x0, 0x0, 0x0}, @@ -44,7 +44,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CHARMELEON] = { { 0x6, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -52,7 +52,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [SPECIES_CHARIZARD] = { { 0x6, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x32, 0x0, 0x0, 0x0, 0x0}, @@ -60,7 +60,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [SPECIES_SQUIRTLE] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -68,7 +68,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_WARTORTLE] = { { 0x8, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, @@ -76,7 +76,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BLASTOISE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1e, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -84,7 +84,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CATERPIE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -92,7 +92,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_METAPOD] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, @@ -100,7 +100,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BUTTERFREE] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -108,7 +108,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_WEEDLE] = { { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x26, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -116,7 +116,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_KAKUNA] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -124,7 +124,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BEEDRILL] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -132,7 +132,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PIDGEY] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -140,7 +140,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PIDGEOTTO] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -148,7 +148,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PIDGEOT] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, @@ -156,7 +156,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_RATTATA] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -164,7 +164,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_RATICATE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, @@ -172,7 +172,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SPEAROW] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -180,7 +180,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_FEAROW] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -188,7 +188,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_EKANS] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -196,7 +196,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ARBOK] = { { 0x6, 0x0, 0x0, 0x0, 0x0}, { 0x17, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -204,7 +204,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PIKACHU] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, @@ -212,7 +212,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_RAICHU] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -220,7 +220,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SANDSHREW] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -228,7 +228,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SANDSLASH] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -236,7 +236,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_NIDORAN_F] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -244,7 +244,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_NIDORINA] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -252,7 +252,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_NIDOQUEEN] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -260,7 +260,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_NIDORAN_M] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -268,7 +268,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_NIDORINO] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -276,7 +276,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_NIDOKING] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -284,7 +284,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CLEFAIRY] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -292,7 +292,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CLEFABLE] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, @@ -300,7 +300,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_VULPIX] = { { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -308,7 +308,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_NINETALES] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -316,7 +316,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_JIGGLYPUFF] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -324,7 +324,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [SPECIES_WIGGLYTUFF] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -332,7 +332,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [SPECIES_ZUBAT] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -340,7 +340,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GOLBAT] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -348,7 +348,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ODDISH] = { { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -356,7 +356,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GLOOM] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -364,7 +364,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_VILEPLUME] = { { 0x14, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -372,7 +372,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PARAS] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -380,7 +380,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PARASECT] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, @@ -388,7 +388,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_VENONAT] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -396,7 +396,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_VENOMOTH] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, @@ -404,7 +404,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DIGLETT] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -412,7 +412,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DUGTRIO] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -420,7 +420,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MEOWTH] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -428,7 +428,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PERSIAN] = { { 0x32, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -436,7 +436,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PSYDUCK] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -444,7 +444,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GOLDUCK] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -452,7 +452,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MANKEY] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -460,7 +460,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PRIMEAPE] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -468,7 +468,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GROWLITHE] = { { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -476,7 +476,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ARCANINE] = { { 0x6, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -484,7 +484,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_POLIWAG] = { { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -492,7 +492,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_POLIWHIRL] = { { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -500,7 +500,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_POLIWRATH] = { { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -508,7 +508,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ABRA] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -516,7 +516,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_KADABRA] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -524,7 +524,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ALAKAZAM] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -532,7 +532,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MACHOP] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -540,7 +540,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MACHOKE] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -548,7 +548,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MACHAMP] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -556,7 +556,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BELLSPROUT] = { { 0xb, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -564,7 +564,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_WEEPINBELL] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, @@ -572,7 +572,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_VICTREEBEL] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, @@ -580,7 +580,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TENTACOOL] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, @@ -588,7 +588,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TENTACRUEL] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, @@ -596,7 +596,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GEODUDE] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, @@ -604,7 +604,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GRAVELER] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -612,7 +612,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GOLEM] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -620,7 +620,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PONYTA] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -628,7 +628,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_RAPIDASH] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -636,7 +636,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SLOWPOKE] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -644,7 +644,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SLOWBRO] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -652,7 +652,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MAGNEMITE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -660,7 +660,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MAGNETON] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -668,7 +668,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_FARFETCHD] = { { 0x6, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -676,7 +676,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DODUO] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -684,7 +684,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DODRIO] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -692,7 +692,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SEEL] = { { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -700,7 +700,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DEWGONG] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -708,7 +708,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GRIMER] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -716,7 +716,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MUK] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -724,7 +724,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SHELLDER] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -732,7 +732,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CLOYSTER] = { { 0x1e, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -740,7 +740,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GASTLY] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -748,7 +748,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_HAUNTER] = { { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -756,7 +756,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GENGAR] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x8, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -764,7 +764,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ONIX] = { { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -772,7 +772,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DROWZEE] = { { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -780,7 +780,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_HYPNO] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -788,7 +788,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_KRABBY] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -796,7 +796,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_KINGLER] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -804,7 +804,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_VOLTORB] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -812,7 +812,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ELECTRODE] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -820,7 +820,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_EXEGGCUTE] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, @@ -828,7 +828,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_EXEGGUTOR] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, @@ -836,7 +836,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [SPECIES_CUBONE] = { { 0x2d, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -844,7 +844,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MAROWAK] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -852,7 +852,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_HITMONLEE] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -860,7 +860,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_HITMONCHAN] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -868,7 +868,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LICKITUNG] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -876,7 +876,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_KOFFING] = { { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -884,7 +884,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_WEEZING] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -892,7 +892,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_RHYHORN] = { { 0x14, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -900,7 +900,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_RHYDON] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -908,7 +908,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CHANSEY] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -916,7 +916,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TANGELA] = { { 0x2, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -924,7 +924,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_KANGASKHAN] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -932,7 +932,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_HORSEA] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -940,7 +940,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SEADRA] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -948,7 +948,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GOLDEEN] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -956,7 +956,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SEAKING] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -964,7 +964,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_STARYU] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -972,7 +972,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_STARMIE] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -980,7 +980,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MR_MIME] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -988,7 +988,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SCYTHER] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -996,7 +996,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_JYNX] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1004,7 +1004,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ELECTABUZZ] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -1012,7 +1012,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MAGMAR] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1020,7 +1020,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PINSIR] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1028,7 +1028,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TAUROS] = { { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1036,7 +1036,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MAGIKARP] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -1044,7 +1044,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GYARADOS] = { { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -1052,7 +1052,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LAPRAS] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1060,7 +1060,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DITTO] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1068,7 +1068,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_EEVEE] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1076,7 +1076,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_VAPOREON] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -1084,7 +1084,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_JOLTEON] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, @@ -1092,7 +1092,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_FLAREON] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, @@ -1100,7 +1100,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PORYGON] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, @@ -1108,7 +1108,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OMANYTE] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -1116,7 +1116,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OMASTAR] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, @@ -1124,7 +1124,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_KABUTO] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, @@ -1132,7 +1132,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_KABUTOPS] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, @@ -1140,7 +1140,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_AERODACTYL] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -1148,7 +1148,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SNORLAX] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1156,7 +1156,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ARTICUNO] = { { 0x6, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, @@ -1164,7 +1164,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ZAPDOS] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1172,7 +1172,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MOLTRES] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1180,7 +1180,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DRATINI] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -1188,7 +1188,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DRAGONAIR] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, @@ -1196,7 +1196,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DRAGONITE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -1204,7 +1204,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MEWTWO] = { { 0x2d, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND, @@ -1212,7 +1212,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MEW] = { { 0x2d, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -1220,7 +1220,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CHIKORITA] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -1228,7 +1228,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BAYLEEF] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1236,7 +1236,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MEGANIUM] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -1244,7 +1244,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CYNDAQUIL] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, @@ -1252,7 +1252,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_QUILAVA] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x6, 0x0, 0x0, 0x0, 0x0}, { 0x8, 0x0, 0x0, 0x0, 0x0}, @@ -1260,7 +1260,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TYPHLOSION] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -1268,7 +1268,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { { 0x33, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [SPECIES_TOTODILE] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -1276,7 +1276,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CROCONAW] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -1284,7 +1284,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_FERALIGATR] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, @@ -1292,7 +1292,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, NULL_BARD_SOUND }, - { + [SPECIES_SENTRET] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1300,7 +1300,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_FURRET] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1308,7 +1308,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_HOOTHOOT] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1316,7 +1316,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_NOCTOWL] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1324,7 +1324,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LEDYBA] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -1332,7 +1332,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LEDIAN] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -1340,7 +1340,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SPINARAK] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -1348,7 +1348,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ARIADOS] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -1356,7 +1356,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CROBAT] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1364,7 +1364,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CHINCHOU] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1372,7 +1372,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LANTURN] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1380,7 +1380,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PICHU] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1388,7 +1388,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CLEFFA] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1396,7 +1396,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_IGGLYBUFF] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -1404,7 +1404,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TOGEPI] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -1412,7 +1412,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TOGETIC] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -1420,7 +1420,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_NATU] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1428,7 +1428,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_XATU] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1436,7 +1436,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MAREEP] = { { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1444,7 +1444,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_FLAAFFY] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1452,7 +1452,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_AMPHAROS] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x6, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -1460,7 +1460,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BELLOSSOM] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -1468,7 +1468,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MARILL] = { { 0x8, 0x0, 0x0, 0x0, 0x0}, { 0x10, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1476,7 +1476,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_AZUMARILL] = { { 0x8, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -1484,7 +1484,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SUDOWOODO] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, @@ -1492,7 +1492,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_POLITOED] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -1500,7 +1500,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_HOPPIP] = { { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1508,7 +1508,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SKIPLOOM] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1516,7 +1516,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_JUMPLUFF] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1524,7 +1524,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_AIPOM] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1532,7 +1532,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SUNKERN] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1540,7 +1540,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SUNFLORA] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -1548,7 +1548,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_YANMA] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1556,7 +1556,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_WOOPER] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1564,7 +1564,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_QUAGSIRE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x32, 0x0, 0x0, 0x0, 0x0}, @@ -1572,7 +1572,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ESPEON] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -1580,7 +1580,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_UMBREON] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -1588,7 +1588,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MURKROW] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1596,7 +1596,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SLOWKING] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1604,7 +1604,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MISDREAVUS] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, @@ -1612,7 +1612,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_UNOWN] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1620,7 +1620,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_WOBBUFFET] = { { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, @@ -1628,7 +1628,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GIRAFARIG] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -1636,7 +1636,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PINECO] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1644,7 +1644,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_FORRETRESS] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, @@ -1652,7 +1652,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DUNSPARCE] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x1c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1660,7 +1660,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GLIGAR] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1668,7 +1668,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_STEELIX] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1676,7 +1676,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SNUBBULL] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1684,7 +1684,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GRANBULL] = { { 0x2, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1692,7 +1692,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_QWILFISH] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1700,7 +1700,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SCIZOR] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x32, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1708,7 +1708,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SHUCKLE] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x26, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1716,7 +1716,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_HERACROSS] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -1724,7 +1724,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SNEASEL] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x26, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1732,7 +1732,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TEDDIURSA] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -1740,7 +1740,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_URSARING] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -1748,7 +1748,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SLUGMA] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1756,7 +1756,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MAGCARGO] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -1764,7 +1764,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SWINUB] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1772,7 +1772,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PILOSWINE] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -1780,7 +1780,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CORSOLA] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -1788,7 +1788,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_REMORAID] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, @@ -1796,7 +1796,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OCTILLERY] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -1804,7 +1804,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DELIBIRD] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -1812,7 +1812,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MANTINE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1820,7 +1820,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SKARMORY] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -1828,7 +1828,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_HOUNDOUR] = { { 0x23, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1836,7 +1836,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_HOUNDOOM] = { { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1844,7 +1844,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_KINGDRA] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1852,7 +1852,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PHANPY] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1860,7 +1860,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DONPHAN] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1868,7 +1868,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PORYGON2] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -1876,7 +1876,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_STANTLER] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1884,7 +1884,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SMEARGLE] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x26, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1892,7 +1892,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TYROGUE] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1900,7 +1900,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_HITMONTOP] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, @@ -1908,7 +1908,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SMOOCHUM] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1916,7 +1916,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ELEKID] = { { 0xb, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -1924,7 +1924,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MAGBY] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1932,7 +1932,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MILTANK] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1940,7 +1940,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BLISSEY] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1948,7 +1948,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_RAIKOU] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1956,7 +1956,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ENTEI] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1964,7 +1964,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SUICUNE] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -1972,7 +1972,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LARVITAR] = { { 0x15, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x15, 0x0, 0x0, 0x0, 0x0}, @@ -1980,7 +1980,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PUPITAR] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -1988,7 +1988,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TYRANITAR] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -1996,7 +1996,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LUGIA] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -2004,7 +2004,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_HO_OH] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2012,7 +2012,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CELEBI] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -2020,7 +2020,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_B] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2028,7 +2028,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_C] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2036,7 +2036,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_D] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2044,7 +2044,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_E] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2052,7 +2052,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_F] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2060,7 +2060,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_G] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2068,7 +2068,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_H] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2076,7 +2076,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_I] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2084,7 +2084,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_J] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2092,7 +2092,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_K] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2100,7 +2100,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_L] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2108,7 +2108,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_M] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2116,7 +2116,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_N] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2124,7 +2124,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_O] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2132,7 +2132,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_P] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2140,7 +2140,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_Q] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2148,7 +2148,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_R] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2156,7 +2156,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_S] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2164,7 +2164,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_T] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2172,7 +2172,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_U] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2180,7 +2180,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_V] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2188,7 +2188,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_W] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2196,7 +2196,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_X] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2204,7 +2204,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_Y] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2212,7 +2212,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_OLD_UNOWN_Z] = { NULL_BARD_SOUND, NULL_BARD_SOUND, NULL_BARD_SOUND, @@ -2220,7 +2220,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TREECKO] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2228,7 +2228,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GROVYLE] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2236,7 +2236,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SCEPTILE] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2244,7 +2244,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TORCHIC] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2252,7 +2252,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_COMBUSKEN] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, @@ -2260,7 +2260,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BLAZIKEN] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, @@ -2268,7 +2268,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MUDKIP] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2276,7 +2276,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MARSHTOMP] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2284,7 +2284,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SWAMPERT] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2292,7 +2292,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_POOCHYENA] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, @@ -2300,7 +2300,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MIGHTYENA] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, @@ -2308,7 +2308,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ZIGZAGOON] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, @@ -2316,7 +2316,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LINOONE] = { { 0x14, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2324,7 +2324,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_WURMPLE] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2332,7 +2332,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SILCOON] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x28, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2340,7 +2340,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BEAUTIFLY] = { { 0x2d, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -2348,7 +2348,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CASCOON] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2356,7 +2356,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DUSTOX] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x17, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2364,7 +2364,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LOTAD] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2372,7 +2372,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LOMBRE] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2380,7 +2380,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LUDICOLO] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, @@ -2388,7 +2388,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SEEDOT] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2396,7 +2396,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_NUZLEAF] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2404,7 +2404,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SHIFTRY] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2412,7 +2412,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_NINCADA] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x6, 0x0, 0x0, 0x0, 0x0}, { 0x6, 0x0, 0x0, 0x0, 0x0}, @@ -2420,7 +2420,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_NINJASK] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2428,7 +2428,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SHEDINJA] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -2436,7 +2436,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TAILLOW] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2444,7 +2444,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SWELLOW] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2452,7 +2452,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SHROOMISH] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2460,7 +2460,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BRELOOM] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2468,7 +2468,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SPINDA] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2476,7 +2476,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_WINGULL] = { { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2484,7 +2484,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PELIPPER] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -2492,7 +2492,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SURSKIT] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2500,7 +2500,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MASQUERAIN] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, @@ -2508,7 +2508,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_WAILMER] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2516,7 +2516,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_WAILORD] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2524,7 +2524,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SKITTY] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2532,7 +2532,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DELCATTY] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -2540,7 +2540,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_KECLEON] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -2548,7 +2548,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BALTOY] = { { 0x1, 0x0, 0x0, 0x0, 0x0}, { 0x1e, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2556,7 +2556,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CLAYDOL] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2564,7 +2564,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_NOSEPASS] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2572,7 +2572,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TORKOAL] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2580,7 +2580,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SABLEYE] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -2588,7 +2588,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BARBOACH] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2596,7 +2596,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_WHISCASH] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2604,7 +2604,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LUVDISC] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2612,7 +2612,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CORPHISH] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2620,7 +2620,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CRAWDAUNT] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2628,7 +2628,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_FEEBAS] = { { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2636,7 +2636,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MILOTIC] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -2644,7 +2644,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CARVANHA] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x1, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -2652,7 +2652,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SHARPEDO] = { { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -2660,7 +2660,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TRAPINCH] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2668,7 +2668,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_VIBRAVA] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -2676,7 +2676,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_FLYGON] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2684,7 +2684,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MAKUHITA] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -2692,7 +2692,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_HARIYAMA] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -2700,7 +2700,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ELECTRIKE] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -2708,7 +2708,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MANECTRIC] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -2716,7 +2716,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_NUMEL] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0xb, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2724,7 +2724,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CAMERUPT] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -2732,7 +2732,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SPHEAL] = { { 0xe, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2740,7 +2740,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SEALEO] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -2748,7 +2748,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_WALREIN] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2756,7 +2756,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CACNEA] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -2764,7 +2764,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CACTURNE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2772,7 +2772,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SNORUNT] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2780,7 +2780,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GLALIE] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2788,7 +2788,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LUNATONE] = { { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -2796,7 +2796,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SOLROCK] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2804,7 +2804,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_AZURILL] = { { 0x6, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, @@ -2812,7 +2812,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SPOINK] = { { 0x1e, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2820,7 +2820,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GRUMPIG] = { { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2828,7 +2828,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_PLUSLE] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2836,7 +2836,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MINUN] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2844,7 +2844,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MAWILE] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2852,7 +2852,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MEDITITE] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -2860,7 +2860,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_MEDICHAM] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -2868,7 +2868,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SWABLU] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2876,7 +2876,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ALTARIA] = { { 0x6, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -2884,7 +2884,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_WYNAUT] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2892,7 +2892,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DUSKULL] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x26, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2900,7 +2900,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DUSCLOPS] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2908,7 +2908,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ROSELIA] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -2916,7 +2916,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SLAKOTH] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2924,7 +2924,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_VIGOROTH] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -2932,7 +2932,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SLAKING] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2940,7 +2940,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GULPIN] = { { 0x24, 0x0, 0x0, 0x0, 0x0}, { 0xf, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2948,7 +2948,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SWALOT] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2956,7 +2956,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_TROPIUS] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -2964,7 +2964,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_WHISMUR] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2972,7 +2972,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LOUDRED] = { { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2980,7 +2980,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_EXPLOUD] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2988,7 +2988,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CLAMPERL] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x32, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -2996,7 +2996,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_HUNTAIL] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3004,7 +3004,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GOREBYSS] = { { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x2c, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -3012,7 +3012,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ABSOL] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3020,7 +3020,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SHUPPET] = { { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3028,7 +3028,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BANETTE] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3036,7 +3036,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SEVIPER] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -3044,7 +3044,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ZANGOOSE] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3052,7 +3052,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_RELICANTH] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -3060,7 +3060,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ARON] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x1d, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3068,7 +3068,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LAIRON] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3076,7 +3076,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_AGGRON] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3084,7 +3084,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CASTFORM] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x1a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3092,7 +3092,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_VOLBEAT] = { { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3100,7 +3100,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ILLUMISE] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x27, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -3108,7 +3108,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LILEEP] = { { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3116,7 +3116,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CRADILY] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -3124,7 +3124,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ANORITH] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -3132,7 +3132,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_ARMALDO] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -3140,7 +3140,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_RALTS] = { { 0x7, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3148,7 +3148,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_KIRLIA] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -3156,7 +3156,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GARDEVOIR] = { { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -3164,7 +3164,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BAGON] = { { 0x5, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3172,7 +3172,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SHELGON] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3180,7 +3180,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_SALAMENCE] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, @@ -3188,7 +3188,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_BELDUM] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3196,7 +3196,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_METANG] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3204,7 +3204,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_METAGROSS] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -3212,7 +3212,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_REGIROCK] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, @@ -3220,7 +3220,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_REGICE] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x12, 0x0, 0x0, 0x0, 0x0}, @@ -3228,7 +3228,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_REGISTEEL] = { { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0xe, 0x0, 0x0, 0x0, 0x0}, @@ -3236,7 +3236,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_KYOGRE] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, { 0x30, 0x0, 0x0, 0x0, 0x0}, @@ -3244,7 +3244,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_GROUDON] = { { 0x21, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x33, 0x0, 0x0, 0x0, 0x0}, @@ -3252,7 +3252,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_RAYQUAZA] = { { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x3, 0x0, 0x0, 0x0, 0x0}, { 0x2a, 0x0, 0x0, 0x0, 0x0}, @@ -3260,7 +3260,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LATIAS] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x0, 0x0, 0x0, 0x0, 0x0}, @@ -3268,7 +3268,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_LATIOS] = { { 0x0, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, @@ -3276,7 +3276,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_JIRACHI] = { { 0x30, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0xc, 0x0, 0x0, 0x0, 0x0}, @@ -3284,7 +3284,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_DEOXYS] = { { 0xc, 0x0, 0x0, 0x0, 0x0}, { 0x1b, 0x0, 0x0, 0x0, 0x0}, { 0x11, 0x0, 0x0, 0x0, 0x0}, @@ -3292,7 +3292,7 @@ const struct BardSound gBardSounds_Pokemon[][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND }, - { + [SPECIES_CHIMECHO] = { { 0x12, 0x0, 0x0, 0x0, 0x0}, { 0x9, 0x0, 0x0, 0x0, 0x0}, { 0x18, 0x0, 0x0, 0x0, 0x0}, diff --git a/src/data/bard_music/word_pitch.h b/src/data/bard_music/word_pitch.h index 54a87acc9..35527017c 100644 --- a/src/data/bard_music/word_pitch.h +++ b/src/data/bard_music/word_pitch.h @@ -1,182 +1,186 @@ #ifndef GUARD_WORD_PITCH_H #define GUARD_WORD_PITCH_H -const s16 gUnknown_0860A1C0[] = { - -0x300, 0x1800 +#define PITCH_END 0x1800 + +static const s16 sPitch1_0[] = { + -0x300, PITCH_END }; -const s16 gUnknown_0860A1C4[] = { - 0x0900, 0x1800 +static const s16 sPitch1_1[] = { + 0x0900, PITCH_END }; -const s16 gUnknown_0860A1C8[] = { - 0x0100, 0x1800 +static const s16 sPitch1_2[] = { + 0x0100, PITCH_END }; -const s16 gUnknown_0860A1CC[] = { - 0x0400, 0x1800 +static const s16 sPitch1_3[] = { + 0x0400, PITCH_END }; -const s16 gUnknown_0860A1D0[] = { - 0x0b00, 0x1800 +static const s16 sPitch1_4[] = { + 0x0b00, PITCH_END }; -const s16 gUnknown_0860A1D4[] = { - -0x300, -0x100, 0x1800 +static const s16 sPitch2_0[] = { + -0x300, -0x100, PITCH_END }; -const s16 gUnknown_0860A1DA[] = { - -0x300, 0x0200, 0x1800 +static const s16 sPitch2_1[] = { + -0x300, 0x0200, PITCH_END }; -const s16 gUnknown_0860A1E0[] = { - 0x0200, 0x0400, 0x1800 +static const s16 sPitch2_2[] = { + 0x0200, 0x0400, PITCH_END }; -const s16 gUnknown_0860A1E6[] = { - 0x0600, 0x0800, 0x1800 +static const s16 sPitch2_3[] = { + 0x0600, 0x0800, PITCH_END }; -const s16 gUnknown_0860A1EC[] = { - 0x0900, 0x0800, 0x1800 +static const s16 sPitch2_4[] = { + 0x0900, 0x0800, PITCH_END }; -const s16 gUnknown_0860A1F2[] = { - -0x300, -0x100, -0x300, 0x1800 +static const s16 sPitch3_0[] = { + -0x300, -0x100, -0x300, PITCH_END }; -const s16 gUnknown_0860A1FA[] = { - 0x0400, -0x300, 0x0400, 0x1800 +static const s16 sPitch3_1[] = { + 0x0400, -0x300, 0x0400, PITCH_END }; -const s16 gUnknown_0860A202[] = { - 0x0900, 0x0800, 0x0600, 0x1800 +static const s16 sPitch3_2[] = { + 0x0900, 0x0800, 0x0600, PITCH_END }; -const s16 gUnknown_0860A20A[] = { - 0x0100, 0x0200, 0x0400, 0x1800 +static const s16 sPitch3_3[] = { + 0x0100, 0x0200, 0x0400, PITCH_END }; -const s16 gUnknown_0860A212[] = { - 0x0600, 0x1000, 0x0d00, 0x1800 +static const s16 sPitch3_4[] = { + 0x0600, 0x1000, 0x0d00, PITCH_END }; -const s16 gUnknown_0860A21A[] = { - 0x0400, 0x0900, 0x0400, 0x0900, 0x1800 +static const s16 sPitch4_0[] = { + 0x0400, 0x0900, 0x0400, 0x0900, PITCH_END }; -const s16 gUnknown_0860A224[] = { - 0x0900, 0x0400, 0x0d00, 0x0400, 0x1800 +static const s16 sPitch4_1[] = { + 0x0900, 0x0400, 0x0d00, 0x0400, PITCH_END }; -const s16 gUnknown_0860A22E[] = { - 0x0100, 0x0200, 0x0400, 0x0600, 0x1800 +static const s16 sPitch4_2[] = { + 0x0100, 0x0200, 0x0400, 0x0600, PITCH_END }; -const s16 gUnknown_0860A238[] = { - 0x0800, 0x0600, 0x0400, 0x0200, 0x1800 +static const s16 sPitch4_3[] = { + 0x0800, 0x0600, 0x0400, 0x0200, PITCH_END }; -const s16 gUnknown_0860A242[] = { - 0x0f00, 0x0d00, 0x0b00, 0x0a00, 0x1800 +static const s16 sPitch4_4[] = { + 0x0f00, 0x0d00, 0x0b00, 0x0a00, PITCH_END }; -const s16 gUnknown_0860A24C[] = { - -0x300, -0x100, 0x0100, 0x0200, 0x0400, 0x1800 +static const s16 sPitch5_0[] = { + -0x300, -0x100, 0x0100, 0x0200, 0x0400, PITCH_END }; -const s16 gUnknown_0860A258[] = { - 0x0900, 0x0800, 0x0600, 0x0400, 0x0200, 0x1800 +static const s16 sPitch5_1[] = { + 0x0900, 0x0800, 0x0600, 0x0400, 0x0200, PITCH_END }; -const s16 gUnknown_0860A264[] = { - 0x0100, 0x0400, 0x0900, 0x0400, 0x0100, 0x1800 +static const s16 sPitch5_2[] = { + 0x0100, 0x0400, 0x0900, 0x0400, 0x0100, PITCH_END }; -const s16 gUnknown_0860A270[] = { - 0x0900, 0x0400, 0x0900, 0x0400, -0x300, 0x1800 +static const s16 sPitch5_3[] = { + 0x0900, 0x0400, 0x0900, 0x0400, -0x300, PITCH_END }; -const s16 gUnknown_0860A27C[] = { - 0x0b00, 0x0800, 0x0400, 0x0400, 0x0600, 0x1800 +static const s16 sPitch5_4[] = { + 0x0b00, 0x0800, 0x0400, 0x0400, 0x0600, PITCH_END }; -const s16 gUnknown_0860A288[] = { - -0x300, -0x100, 0x0100, 0x0200, 0x0400, 0x0600, 0x1800 +static const s16 sPitch6_0[] = { + -0x300, -0x100, 0x0100, 0x0200, 0x0400, 0x0600, PITCH_END }; -const s16 gUnknown_0860A296[] = { - 0x0800, 0x0600, 0x0400, 0x0200, 0x0100, -0x100, 0x1800 +static const s16 sPitch6_1[] = { + 0x0800, 0x0600, 0x0400, 0x0200, 0x0100, -0x100, PITCH_END }; -const s16 gUnknown_0860A2A4[] = { - 0x0100, 0x0200, 0x0400, 0x0100, 0x0200, 0x1000, 0x1800 +static const s16 sPitch6_2[] = { + 0x0100, 0x0200, 0x0400, 0x0100, 0x0200, 0x1000, PITCH_END }; -const s16 gUnknown_0860A2B2[] = { - 0x0400, -0x300, 0x0900, 0x0400, 0x0900, 0x0400, 0x1800 +static const s16 sPitch6_3[] = { + 0x0400, -0x300, 0x0900, 0x0400, 0x0900, 0x0400, PITCH_END }; -const s16 gUnknown_0860A2C0[] = { - 0x0800, 0x0900, 0x0800, 0x0900, 0x0800, 0x0900, 0x1800 +static const s16 sPitch6_4[] = { + 0x0800, 0x0900, 0x0800, 0x0900, 0x0800, 0x0900, PITCH_END }; -const s16 gUnknown_0860A2CE[] = { - 0x0200, 0x0100, 0x0200, 0x0100, 0x0200, 0x0400, 0x0200, 0x1800 +static const s16 sPitch7_0[] = { + 0x0200, 0x0100, 0x0200, 0x0100, 0x0200, 0x0400, 0x0200, PITCH_END }; -const s16 gUnknown_0860A2DE[] = { - 0x0100, 0x0100, -0x100, -0x100, -0x300, 0x0400, -0x300, 0x1800 +static const s16 sPitch7_1[] = { + 0x0100, 0x0100, -0x100, -0x100, -0x300, 0x0400, -0x300, PITCH_END }; -const s16 gUnknown_0860A2EE[] = { - 0x0800, 0x0900, 0x0b00, 0x0d00, 0x0e00, 0x0d00, 0x0b00, 0x1800 +static const s16 sPitch7_2[] = { + 0x0800, 0x0900, 0x0b00, 0x0d00, 0x0e00, 0x0d00, 0x0b00, PITCH_END }; -const s16 gUnknown_0860A2FE[] = { - 0x0800, 0x0600, 0x0400, 0x0200, 0x0d00, 0x0b00, 0x0900, 0x1800 +static const s16 sPitch7_3[] = { + 0x0800, 0x0600, 0x0400, 0x0200, 0x0d00, 0x0b00, 0x0900, PITCH_END }; -const s16 gUnknown_0860A30E[] = { - 0x0300, 0x0400, 0x0600, 0x0800, 0x0700, 0x0800, 0x0400, 0x1800 +static const s16 sPitch7_4[] = { + 0x0300, 0x0400, 0x0600, 0x0800, 0x0700, 0x0800, 0x0400, PITCH_END }; -const s16 *const gBardSoundPitchTables[] = { - gUnknown_0860A1C0, - gUnknown_0860A1C4, - gUnknown_0860A1C8, - gUnknown_0860A1CC, - gUnknown_0860A1D0, - gUnknown_0860A1D4, - gUnknown_0860A1DA, - gUnknown_0860A1E0, - gUnknown_0860A1E6, - gUnknown_0860A1EC, - gUnknown_0860A1F2, - gUnknown_0860A1FA, - gUnknown_0860A202, - gUnknown_0860A20A, - gUnknown_0860A212, - gUnknown_0860A21A, - gUnknown_0860A224, - gUnknown_0860A22E, - gUnknown_0860A238, - gUnknown_0860A242, - gUnknown_0860A24C, - gUnknown_0860A258, - gUnknown_0860A264, - gUnknown_0860A270, - gUnknown_0860A27C, - gUnknown_0860A288, - gUnknown_0860A296, - gUnknown_0860A2A4, - gUnknown_0860A2B2, - gUnknown_0860A2C0, - gUnknown_0860A2CE, - gUnknown_0860A2DE, - gUnknown_0860A2EE, - gUnknown_0860A2FE, - gUnknown_0860A30E +// Only sPitch7_# are used below +// This table is always indexed with (x + 30), where x is some value 0 - 4 +static const s16 *const sBardSoundPitchTables[] = { + sPitch1_0, + sPitch1_1, + sPitch1_2, + sPitch1_3, + sPitch1_4, + sPitch2_0, + sPitch2_1, + sPitch2_2, + sPitch2_3, + sPitch2_4, + sPitch3_0, + sPitch3_1, + sPitch3_2, + sPitch3_3, + sPitch3_4, + sPitch4_0, + sPitch4_1, + sPitch4_2, + sPitch4_3, + sPitch4_4, + sPitch5_0, + sPitch5_1, + sPitch5_2, + sPitch5_3, + sPitch5_4, + sPitch6_0, + sPitch6_1, + sPitch6_2, + sPitch6_3, + sPitch6_4, + sPitch7_0, + sPitch7_1, + sPitch7_2, + sPitch7_3, + sPitch7_4 }; diff --git a/src/data/battle_frontier/apprentice.h b/src/data/battle_frontier/apprentice.h index e501eb403..285946de4 100644 --- a/src/data/battle_frontier/apprentice.h +++ b/src/data/battle_frontier/apprentice.h @@ -326,7 +326,7 @@ const struct ApprenticeTrainer gApprentices[NUM_APPRENTICES] = .facilityClass = FACILITY_CLASS_LASS, .species = {SPECIES_SWALOT, SPECIES_XATU, SPECIES_ALTARIA, SPECIES_GOLDUCK, SPECIES_FLYGON, SPECIES_ALAKAZAM, SPECIES_GARDEVOIR, SPECIES_WAILORD, SPECIES_GRUMPIG, SPECIES_MIGHTYENA}, .id = 3, - .speechLost = {EC_WORD_IS, EC_WORD_THIS, EC_WORD_TOO, EC_WORD_MUCH, EC_WORD_QUES, 0xFFFF}, + .speechLost = {EC_WORD_IS, EC_WORD_THIS, EC_WORD_TOO, EC_WORD_MUCH, EC_WORD_QUES, EC_EMPTY_WORD}, }, { .name = {_("ヨウカ"), _("MACY"), _("AMELIE"), _("CLEO"), _("MARIA"), _("ELISA")}, @@ -358,7 +358,7 @@ const struct ApprenticeTrainer gApprentices[NUM_APPRENTICES] = .facilityClass = FACILITY_CLASS_BEAUTY, .species = {SPECIES_NINETALES, SPECIES_ALAKAZAM, SPECIES_SCEPTILE, SPECIES_SALAMENCE, SPECIES_GOLDUCK, SPECIES_MAWILE, SPECIES_WEEZING, SPECIES_LANTURN, SPECIES_GARDEVOIR, SPECIES_MILOTIC}, .id = 7, - .speechLost = {EC_WORD_YOU_RE, EC_WORD_STRONG, EC_WORD_AREN_T, EC_WORD_YOU, EC_WORD_QUES, 0xFFFF}, + .speechLost = {EC_WORD_YOU_RE, EC_WORD_STRONG, EC_WORD_AREN_T, EC_WORD_YOU, EC_WORD_QUES, EC_EMPTY_WORD}, }, { .name = {_("スミレ"), _("ANNIE"), _("ANNIE"), _("IMELDA"), _("INES"), _("ROSA")}, @@ -374,7 +374,7 @@ const struct ApprenticeTrainer gApprentices[NUM_APPRENTICES] = .facilityClass = FACILITY_CLASS_HIKER, .species = {SPECIES_SKARMORY, SPECIES_GOLEM, SPECIES_BLAZIKEN, SPECIES_CAMERUPT, SPECIES_DONPHAN, SPECIES_MUK, SPECIES_SALAMENCE, SPECIES_TROPIUS, SPECIES_SOLROCK, SPECIES_RHYDON}, .id = 9, - .speechLost = {EC_WORD_WE, EC_WORD_WERE, EC_WORD_JUST, EC_WORD_SHREDDED, EC_WORD_ELLIPSIS, 0xFFFF}, + .speechLost = {EC_WORD_WE, EC_WORD_WERE, EC_WORD_JUST, EC_WORD_SHREDDED, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, }, { .name = {_("トウゾウ"), _("DALLAS"), _("BRUNO"), _("LEARCO"), _("ANSGAR"), _("MANOLO")}, @@ -382,7 +382,7 @@ const struct ApprenticeTrainer gApprentices[NUM_APPRENTICES] = .facilityClass = FACILITY_CLASS_FISHERMAN, .species = {SPECIES_SEAKING, SPECIES_STARMIE, SPECIES_GOLDUCK, SPECIES_TENTACRUEL, SPECIES_OCTILLERY, SPECIES_GOREBYSS, SPECIES_GLALIE, SPECIES_WAILORD, SPECIES_SHARPEDO, SPECIES_KINGDRA}, .id = 10, - .speechLost = {EC_WORD_YOUR, EC_WORD_WIN, EC_WORD_ANGERS, EC_WORD_ME, EC_WORD_EXCL, 0xFFFF}, + .speechLost = {EC_WORD_YOUR, EC_WORD_WIN, EC_WORD_ANGERS, EC_WORD_ME, EC_WORD_EXCL, EC_EMPTY_WORD}, }, { .name = {_("セイヤ"), _("FRANK"), _("FRANK"), _("OLINDO"), _("FRANK"), _("MAURO")}, diff --git a/src/data/battle_frontier/battle_frontier_trainers.h b/src/data/battle_frontier/battle_frontier_trainers.h index bbd88d76f..1cae890c2 100644 --- a/src/data/battle_frontier/battle_frontier_trainers.h +++ b/src/data/battle_frontier/battle_frontier_trainers.h @@ -4,15 +4,15 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_YOUNGSTER, .trainerName = _("BRADY"), .speechBefore = {EC_WORD_I_AM, EC_WORD_NEVER, EC_WORD_GOING, EC_WORD_TO, EC_WORD_LOSE, EC_WORD_EXCL}, - .speechWin = {EC_WORD_I_AM, EC_WORD_STRONG, EC_WORD_AREN_T, EC_WORD_I, EC_WORD_QUES, 0xFFFF}, - .speechLose = {EC_WORD_WHAT, EC_WORD_QUES, 0xFFFF, EC_WORD_BUT, EC_WORD_HOW, EC_WORD_QUES}, + .speechWin = {EC_WORD_I_AM, EC_WORD_STRONG, EC_WORD_AREN_T, EC_WORD_I, EC_WORD_QUES, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_WHAT, EC_WORD_QUES, EC_EMPTY_WORD, EC_WORD_BUT, EC_WORD_HOW, EC_WORD_QUES}, .monSet = gBattleFrontierTrainerMons_Brady }, [FRONTIER_TRAINER_CONNER] = { .facilityClass = FACILITY_CLASS_YOUNGSTER, .trainerName = _("CONNER"), - .speechBefore = {EC_WORD_LOSING, EC_WORD_DOESN_T, EC_WORD_BUG, EC_WORD_ME, 0xFFFF, 0xFFFF}, - .speechWin = {EC_WORD_A, EC_WORD_WIN, EC_WORD_IS, EC_WORD_JUST, EC_WORD_AWESOME, 0xFFFF}, + .speechBefore = {EC_WORD_LOSING, EC_WORD_DOESN_T, EC_WORD_BUG, EC_WORD_ME, EC_EMPTY_WORD, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_A, EC_WORD_WIN, EC_WORD_IS, EC_WORD_JUST, EC_WORD_AWESOME, EC_EMPTY_WORD}, .speechLose = {EC_WORD_DARN, EC_WORD_ELLIPSIS, EC_WORD_LOSING, EC_WORD_DOES, EC_WORD_BUG, EC_WORD_ME}, .monSet = gBattleFrontierTrainerMons_Conner }, @@ -20,7 +20,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_YOUNGSTER, .trainerName = _("BRADLEY"), .speechBefore = {EC_WORD_HEY_THERE, EC_WORD_EXCL, EC_WORD_YOU_RE, EC_WORD_MY, EC_WORD_OPPONENT, EC_WORD_TODAY}, - .speechWin = {EC_WORD_HAHAHA, EC_WORD_EXCL, 0xFFFF, EC_WORD_SEE_YA, EC_WORD_LATER, EC_WORD_EXCL}, + .speechWin = {EC_WORD_HAHAHA, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_SEE_YA, EC_WORD_LATER, EC_WORD_EXCL}, .speechLose = {EC_WORD_TOMORROW, EC_WORD_IS, EC_WORD_WHEN, EC_WORD_WE, EC_WORD_REALLY, EC_WORD_BATTLE}, .monSet = gBattleFrontierTrainerMons_Bradley }, @@ -44,7 +44,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_LASS, .trainerName = _("PEGGY"), .speechBefore = {EC_WORD_GET, EC_WORD_READY, EC_WORD_TO, EC_WORD_BE, EC_WORD_DESTROYED, EC_WORD_EXCL}, - .speechWin = {EC_WORD_HAHAHA, EC_WORD_EXCL_EXCL, 0xFFFF, EC_WORD_I_AM, EC_WORD_LOLLING, EC_WORD_EXCL}, + .speechWin = {EC_WORD_HAHAHA, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD, EC_WORD_I_AM, EC_WORD_LOLLING, EC_WORD_EXCL}, .speechLose = {EC_WORD_I_AM, EC_WORD_FEELING, EC_WORD_SAD, EC_WORD_THANKS, EC_WORD_TO, EC_WORD_YOU}, .monSet = gBattleFrontierTrainerMons_Peggy }, @@ -52,7 +52,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_SCHOOL_KID_M, .trainerName = _("KEITH"), .speechBefore = {EC_WORD_I, EC_WORD_DON_T, EC_WORD_JUST, EC_WORD_STUDY, EC_WORD_YOU, EC_WORD_KNOW}, - .speechWin = {EC_WORD_YOU, EC_WORD_DON_T, EC_WORD_STUDY, EC_WORD_ENOUGH, EC_WORD_ELLIPSIS, 0xFFFF}, + .speechWin = {EC_WORD_YOU, EC_WORD_DON_T, EC_WORD_STUDY, EC_WORD_ENOUGH, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I, EC_WORD_NEED, EC_WORD_TO, EC_WORD_STUDY, EC_WORD_MORE, EC_WORD_ELLIPSIS}, .monSet = gBattleFrontierTrainerMons_Keith }, @@ -60,15 +60,15 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_SCHOOL_KID_M, .trainerName = _("GRAYSON"), .speechBefore = {EC_WORD_A, EC_WORD_POKEMON, EC_WORD_BATTLE, EC_WORD_ISN_T, EC_WORD_CHILD_S_PLAY, EC_WORD_EXCL}, - .speechWin = {EC_WORD_YOU_RE, EC_WORD_DONE, EC_WORD_AREN_T, EC_WORD_YOU, EC_WORD_QUES, 0xFFFF}, + .speechWin = {EC_WORD_YOU_RE, EC_WORD_DONE, EC_WORD_AREN_T, EC_WORD_YOU, EC_WORD_QUES, EC_EMPTY_WORD}, .speechLose = {EC_WORD_WE, EC_WORD_WERE, EC_WORD_LIKE, EC_WORD_TOYS, EC_WORD_TO, EC_WORD_YOU}, .monSet = gBattleFrontierTrainerMons_Grayson }, [FRONTIER_TRAINER_GLENN] = { .facilityClass = FACILITY_CLASS_SCHOOL_KID_M, .trainerName = _("GLENN"), - .speechBefore = {EC_WORD_I, EC_WORD_WOULD, EC_WORD_BE, EC_WORD_COOL, EC_WORD_IF_I_WIN, 0xFFFF}, - .speechWin = {EC_WORD_COOL, EC_WORD_EXCL, 0xFFFF, EC_WORD_THAT_S, EC_WORD_WHAT, EC_WORD_I_AM}, + .speechBefore = {EC_WORD_I, EC_WORD_WOULD, EC_WORD_BE, EC_WORD_COOL, EC_WORD_IF_I_WIN, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_COOL, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_THAT_S, EC_WORD_WHAT, EC_WORD_I_AM}, .speechLose = {EC_WORD_I_AM, EC_WORD_NOT, EC_WORD_GOING, EC_WORD_TO, EC_WORD_BE, EC_WORD_COOL}, .monSet = gBattleFrontierTrainerMons_Glenn }, @@ -92,7 +92,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_SCHOOL_KID_F, .trainerName = _("ZOEY"), .speechBefore = {EC_WORD_PLEASE, EC_WORD_BATTLE, EC_WORD_LIKE, EC_WORD_YOU, EC_WORD_MEAN, EC_WORD_IT}, - .speechWin = {EC_WORD_THANK_YOU, EC_WORD_EXCL_EXCL, 0xFFFF, EC_WORD_THANK_YOU, EC_WORD_SO, EC_WORD_MUCH}, + .speechWin = {EC_WORD_THANK_YOU, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD, EC_WORD_THANK_YOU, EC_WORD_SO, EC_WORD_MUCH}, .speechLose = {EC_WORD_WERE, EC_WORD_YOU, EC_WORD_REALLY, EC_WORD_BEING, EC_WORD_SERIOUS, EC_WORD_QUES}, .monSet = gBattleFrontierTrainerMons_Zoey }, @@ -100,8 +100,8 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_RICH_BOY, .trainerName = _("MANUEL"), .speechBefore = {EC_WORD_ME, EC_WORD_LOSE, EC_WORD_QUES, EC_WORD_THAT_S, EC_WORD_PREPOSTEROUS, EC_WORD_EXCL}, - .speechWin = {EC_WORD_NATURALLY, EC_WORD_I, EC_WORD_WIN, 0xFFFF, 0xFFFF, 0xFFFF}, - .speechLose = {EC_WORD_WAAAH, EC_WORD_EXCL, 0xFFFF, EC_WORD_I, EC_WORD_LOST, EC_WORD_MOTHER}, + .speechWin = {EC_WORD_NATURALLY, EC_WORD_I, EC_WORD_WIN, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_WAAAH, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_I, EC_WORD_LOST, EC_WORD_MOTHER}, .monSet = gBattleFrontierTrainerMons_Manuel }, [FRONTIER_TRAINER_RUSS] = { @@ -115,16 +115,16 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_DUSTIN] = { .facilityClass = FACILITY_CLASS_RICH_BOY, .trainerName = _("DUSTIN"), - .speechBefore = {EC_WORD_I, EC_WORD_REALLY, EC_WORD_LIKE, EC_WORD_COOL, EC_WORD_POKEMON, 0xFFFF}, - .speechWin = {EC_WORD_I, EC_WORD_LIKE, EC_WORD_MYSELF, EC_WORD_WHEN_I_WIN, EC_WORD_EXCL, 0xFFFF}, - .speechLose = {EC_WORD_I, EC_WORD_LIKE, EC_WORD_MYSELF, EC_WORD_IF_I_LOSE, EC_WORD_TOO, 0xFFFF}, + .speechBefore = {EC_WORD_I, EC_WORD_REALLY, EC_WORD_LIKE, EC_WORD_COOL, EC_WORD_POKEMON, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_I, EC_WORD_LIKE, EC_WORD_MYSELF, EC_WORD_WHEN_I_WIN, EC_WORD_EXCL, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_I, EC_WORD_LIKE, EC_WORD_MYSELF, EC_WORD_IF_I_LOSE, EC_WORD_TOO, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Dustin }, [FRONTIER_TRAINER_TINA] = { .facilityClass = FACILITY_CLASS_LADY, .trainerName = _("TINA"), .speechBefore = {EC_WORD_IF_I_WIN, EC_WORD_YOU, EC_WORD_CAN, EC_WORD_HAVE, EC_WORD_A, EC_MOVE2(SWEET_KISS)}, - .speechWin = {EC_WORD_HERE_IT_IS, EC_WORD_YOUR, EC_MOVE2(SWEET_KISS), EC_WORD_FROM, EC_WORD_MY, EC_POKEMON2(JYNX)}, + .speechWin = {EC_WORD_HERE_IT_IS, EC_WORD_YOUR, EC_MOVE2(SWEET_KISS), EC_WORD_FROM, EC_WORD_MY, EC_POKEMON_NATIONAL(JYNX)}, .speechLose = {EC_WORD_YOU, EC_WORD_WANT, EC_WORD_A, EC_MOVE(SWIFT), EC_MOVE2(MEGA_KICK), EC_WORD_INSTEAD}, .monSet = gBattleFrontierTrainerMons_Tina }, @@ -133,14 +133,14 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("GILLIAN"), .speechBefore = {EC_WORD_THE, EC_WORD_GOURMET, EC_WORD_THING, EC_WORD_IS, EC_WORD_SO, EC_WORD_YESTERDAY}, .speechWin = {EC_WORD_POKEMON, EC_WORD_NEVER, EC_WORD_GO, EC_WORD_OUT, EC_WORD_OF, EC_WORD_FASHION}, - .speechLose = {EC_WORD_LOSING, EC_WORD_DOESN_T, EC_WORD_DISAPPOINT, EC_WORD_ME, 0xFFFF, 0xFFFF}, + .speechLose = {EC_WORD_LOSING, EC_WORD_DOESN_T, EC_WORD_DISAPPOINT, EC_WORD_ME, EC_EMPTY_WORD, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Gillian }, [FRONTIER_TRAINER_ZOE] = { .facilityClass = FACILITY_CLASS_LADY, .trainerName = _("ZOE"), .speechBefore = {EC_WORD_I, EC_WORD_HAVEN_T, EC_WORD_A, EC_WORD_WORRY, EC_WORD_AT, EC_WORD_ALL}, - .speechWin = {EC_WORD_LIFE, EC_WORD_IS, EC_WORD_ALWAYS, EC_WORD_GOOD, EC_WORD_TO_ME, 0xFFFF}, + .speechWin = {EC_WORD_LIFE, EC_WORD_IS, EC_WORD_ALWAYS, EC_WORD_GOOD, EC_WORD_TO_ME, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I, EC_WORD_WORRY, EC_WORD_ABOUT, EC_WORD_MY, EC_WORD_POKEMON, EC_WORD_SKILL}, .monSet = gBattleFrontierTrainerMons_Zoe }, @@ -156,7 +156,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_CAMPER, .trainerName = _("AL"), .speechBefore = {EC_WORD_YOUR, EC_WORD_LOOK, EC_WORD_SAYS, EC_WORD_YOU_RE, EC_WORD_REALLY, EC_WORD_TOUGH}, - .speechWin = {EC_WORD_IT_S, EC_WORD_ME, EC_WORD_WHO_IS, EC_WORD_REALLY, EC_WORD_TOUGH, 0xFFFF}, + .speechWin = {EC_WORD_IT_S, EC_WORD_ME, EC_WORD_WHO_IS, EC_WORD_REALLY, EC_WORD_TOUGH, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I_AM, EC_WORD_RIGHT, EC_WORD_EXCL, EC_WORD_YOU_RE, EC_WORD_REALLY, EC_WORD_TOUGH}, .monSet = gBattleFrontierTrainerMons_Al }, @@ -165,15 +165,15 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("MITCH"), .speechBefore = {EC_WORD_MOTHER, EC_WORD_NATURE, EC_WORD_IS, EC_WORD_MY, EC_WORD_ALLY, EC_WORD_EXCL}, .speechWin = {EC_WORD_WAS, EC_WORD_THAT, EC_WORD_ENOUGH, EC_WORD_FOR, EC_WORD_YOU, EC_WORD_QUES}, - .speechLose = {EC_WORD_MOTHER, EC_WORD_NATURE, EC_WORD_DIDN_T, EC_WORD_LET_ME_WIN, EC_WORD_QUES, 0xFFFF}, + .speechLose = {EC_WORD_MOTHER, EC_WORD_NATURE, EC_WORD_DIDN_T, EC_WORD_LET_ME_WIN, EC_WORD_QUES, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Mitch }, [FRONTIER_TRAINER_ANNE] = { .facilityClass = FACILITY_CLASS_PICNICKER, .trainerName = _("ANNE"), .speechBefore = {EC_WORD_I, EC_WORD_CAN_T, EC_WORD_WAIT, EC_WORD_LET_S, EC_WORD_BATTLE, EC_WORD_NOW}, - .speechWin = {EC_WORD_MY, EC_WORD_HAPPINESS, EC_WORD_IS, EC_WORD_OVERWHELMING, EC_WORD_EXCL, 0xFFFF}, - .speechLose = {EC_WORD_YOU_VE, EC_WORD_DESTROYED, EC_WORD_MY, EC_WORD_HAPPINESS, EC_WORD_ELLIPSIS, 0xFFFF}, + .speechWin = {EC_WORD_MY, EC_WORD_HAPPINESS, EC_WORD_IS, EC_WORD_OVERWHELMING, EC_WORD_EXCL, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_YOU_VE, EC_WORD_DESTROYED, EC_WORD_MY, EC_WORD_HAPPINESS, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Anne }, [FRONTIER_TRAINER_ALIZE] = { @@ -203,15 +203,15 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_JASON] = { .facilityClass = FACILITY_CLASS_TUBER_M, .trainerName = _("JASON"), - .speechBefore = {EC_WORD_TEACH, EC_WORD_ME, EC_WORD_A, EC_WORD_GOOD, EC_WORD_STRATEGY, 0xFFFF}, - .speechWin = {EC_WORD_THAT_WAS, EC_WORD_YOUR, EC_WORD_GOOD, EC_WORD_STRATEGY, EC_WORD_QUES_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_TEACH, EC_WORD_ME, EC_WORD_A, EC_WORD_GOOD, EC_WORD_STRATEGY, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_THAT_WAS, EC_WORD_YOUR, EC_WORD_GOOD, EC_WORD_STRATEGY, EC_WORD_QUES_EXCL, EC_EMPTY_WORD}, .speechLose = {EC_WORD_WOW, EC_WORD_THAT, EC_WORD_IS, EC_WORD_AN, EC_WORD_AWESOME, EC_WORD_STRATEGY}, .monSet = gBattleFrontierTrainerMons_Jason }, [FRONTIER_TRAINER_JOHN] = { .facilityClass = FACILITY_CLASS_TUBER_M, .trainerName = _("JOHN"), - .speechBefore = {EC_WORD_I_AM, EC_WORD_A, EC_WORD_PRETTY, EC_WORD_NEW, EC_WORD_TRAINER, 0xFFFF}, + .speechBefore = {EC_WORD_I_AM, EC_WORD_A, EC_WORD_PRETTY, EC_WORD_NEW, EC_WORD_TRAINER, EC_EMPTY_WORD}, .speechWin = {EC_WORD_I_AM, EC_WORD_NEW, EC_WORD_BUT, EC_WORD_I, EC_WORD_WON, EC_WORD_EXCL}, .speechLose = {EC_WORD_I_AM, EC_WORD_NEW, EC_WORD_SO, EC_WORD_WHAT, EC_WORD_IF_I_LOSE, EC_WORD_QUES}, .monSet = gBattleFrontierTrainerMons_John @@ -237,14 +237,14 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("CARLIE"), .speechBefore = {EC_WORD_MY, EC_WORD_SUMMER, EC_WORD_VACATION, EC_WORD_IS, EC_WORD_FOR, EC_WORD_POKEMON}, .speechWin = {EC_WORD_MY, EC_WORD_SUMMER, EC_WORD_VACATION, EC_WORD_WILL, EC_WORD_BE, EC_WORD_AWESOME}, - .speechLose = {EC_WORD_I, EC_WORD_CAN_T_WIN, EC_WORD_LIKE, EC_WORD_THIS, EC_WORD_ELLIPSIS, 0xFFFF}, + .speechLose = {EC_WORD_I, EC_WORD_CAN_T_WIN, EC_WORD_LIKE, EC_WORD_THIS, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Carlie }, [FRONTIER_TRAINER_GORDON] = { .facilityClass = FACILITY_CLASS_SWIMMER_M, .trainerName = _("GORDON"), - .speechBefore = {EC_WORD_VICTORY, EC_WORD_WILL, EC_WORD_COME, EC_WORD_TO_ME, EC_WORD_EXCL, 0xFFFF}, - .speechWin = {EC_WORD_OH_YEAH, EC_WORD_EXCL, 0xFFFF, EC_WORD_I, EC_WORD_REALLY, EC_WORD_WON}, + .speechBefore = {EC_WORD_VICTORY, EC_WORD_WILL, EC_WORD_COME, EC_WORD_TO_ME, EC_WORD_EXCL, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_OH_YEAH, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_I, EC_WORD_REALLY, EC_WORD_WON}, .speechLose = {EC_WORD_NOTHING, EC_WORD_IS, EC_WORD_WORKING, EC_WORD_OUT, EC_WORD_FOR, EC_WORD_ME}, .monSet = gBattleFrontierTrainerMons_Gordon }, @@ -268,7 +268,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_SWIMMER_F, .trainerName = _("CIERRA"), .speechBefore = {EC_WORD_I, EC_WORD_LIKE, EC_WORD_TO, EC_WORD_SYNCHRONIZE, EC_WORD_MY, EC_WORD_SWIFT_SWIM}, - .speechWin = {EC_WORD_MY, EC_WORD_POKEMON, EC_WORD_SYNCHRONIZE, EC_WORD_WITH, EC_WORD_ME, 0xFFFF}, + .speechWin = {EC_WORD_MY, EC_WORD_POKEMON, EC_WORD_SYNCHRONIZE, EC_WORD_WITH, EC_WORD_ME, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I, EC_WORD_NEED, EC_WORD_TO, EC_WORD_SYNCHRONIZE, EC_WORD_BETTER, EC_WORD_ELLIPSIS}, .monSet = gBattleFrontierTrainerMons_Cierra }, @@ -324,7 +324,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_POKEFAN_F, .trainerName = _("AMANDA"), .speechBefore = {EC_WORD_I, EC_WORD_COME, EC_WORD_FROM, EC_WORD_A, EC_WORD_TRAINER, EC_WORD_FAMILY}, - .speechWin = {EC_WORD_I, EC_WORD_WILL, EC_WORD_TREASURE, EC_WORD_THIS, EC_WORD_WIN, 0xFFFF}, + .speechWin = {EC_WORD_I, EC_WORD_WILL, EC_WORD_TREASURE, EC_WORD_THIS, EC_WORD_WIN, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I, EC_WORD_WANT, EC_WORD_TO, EC_WORD_GO_HOME, EC_WORD_RIGHT, EC_WORD_NOW}, .monSet = gBattleFrontierTrainerMons_Amanda }, @@ -340,7 +340,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_PKMN_BREEDER_M, .trainerName = _("RAFAEL"), .speechBefore = {EC_WORD_COME_ON, EC_WORD_EXCL, EC_WORD_LET_S, EC_WORD_SEE, EC_WORD_SOME, EC_WORD_SPIRIT}, - .speechWin = {EC_WORD_THAT_S_IT_EXCL, EC_WORD_THAT_S, EC_WORD_THE, EC_WORD_SPIRIT, EC_WORD_EXCL, 0xFFFF}, + .speechWin = {EC_WORD_THAT_S_IT_EXCL, EC_WORD_THAT_S, EC_WORD_THE, EC_WORD_SPIRIT, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechLose = {EC_WORD_WELL, EC_WORD_SO, EC_WORD_MUCH, EC_WORD_FOR, EC_WORD_OUR, EC_WORD_SPIRIT}, .monSet = gBattleFrontierTrainerMons_Rafael }, @@ -356,15 +356,15 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_PKMN_BREEDER_M, .trainerName = _("PAYTON"), .speechBefore = {EC_WORD_I, EC_WORD_TRAIN, EC_WORD_FROM, EC_WORD_THE, EC_WORD_EGG, EC_WORD_UP}, - .speechWin = {EC_WORD_WELL, EC_WORD_DONE, EC_WORD_EXCL, 0xFFFF, 0xFFFF, 0xFFFF}, - .speechLose = {EC_WORD_THAT_WAS, EC_WORD_A, EC_MOVE2(SOFT_BOILED), EC_WORD_LOSS, EC_WORD_ELLIPSIS, 0xFFFF}, + .speechWin = {EC_WORD_WELL, EC_WORD_DONE, EC_WORD_EXCL, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_THAT_WAS, EC_WORD_A, EC_MOVE2(SOFT_BOILED), EC_WORD_LOSS, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Payton }, [FRONTIER_TRAINER_PAMELA] = { .facilityClass = FACILITY_CLASS_PKMN_BREEDER_F, .trainerName = _("PAMELA"), .speechBefore = {EC_WORD_ALL, EC_WORD_POKEMON, EC_WORD_ADORE, EC_WORD_A, EC_WORD_KIND, EC_WORD_TRAINER}, - .speechWin = {EC_WORD_IT_S, EC_WORD_TOO, EC_WORD_BAD, EC_WORD_YOU, EC_WORD_LOST, 0xFFFF}, + .speechWin = {EC_WORD_IT_S, EC_WORD_TOO, EC_WORD_BAD, EC_WORD_YOU, EC_WORD_LOST, EC_EMPTY_WORD}, .speechLose = {EC_WORD_YOU_RE, EC_WORD_KIND, EC_WORD_AND, EC_WORD_YOU_RE, EC_WORD_ALSO, EC_WORD_STRONG}, .monSet = gBattleFrontierTrainerMons_Pamela }, @@ -379,7 +379,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_MARISA] = { .facilityClass = FACILITY_CLASS_PKMN_BREEDER_F, .trainerName = _("MARISA"), - .speechBefore = {EC_WORD_I, EC_WORD_PROMISE, EC_WORD_TO, EC_WORD_BATTLE, EC_WORD_SERIOUSLY, 0xFFFF}, + .speechBefore = {EC_WORD_I, EC_WORD_PROMISE, EC_WORD_TO, EC_WORD_BATTLE, EC_WORD_SERIOUSLY, EC_EMPTY_WORD}, .speechWin = {EC_WORD_PROMISE, EC_WORD_ME, EC_WORD_YOU, EC_WORD_WILL, EC_WORD_DO, EC_WORD_BETTER}, .speechLose = {EC_WORD_PROMISE, EC_WORD_ME, EC_WORD_ANOTHER, EC_WORD_BATTLE, EC_WORD_PLEASE, EC_WORD_EXCL}, .monSet = gBattleFrontierTrainerMons_Marisa @@ -397,23 +397,23 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("YOSHI"), .speechBefore = {EC_WORD_BUG, EC_WORD_POKEMON, EC_WORD_MAKE, EC_WORD_ME, EC_WORD_FEELING, EC_WORD_LOVEY_DOVEY}, .speechWin = {EC_WORD_BUG, EC_WORD_POKEMON, EC_WORD_ARE, EC_WORD_THE, EC_WORD_BEST, EC_WORD_EXCL}, - .speechLose = {EC_WORD_YOU_RE, EC_WORD_IGNORANT, EC_WORD_ABOUT, EC_WORD_BUG, EC_WORD_POKEMON, 0xFFFF}, + .speechLose = {EC_WORD_YOU_RE, EC_WORD_IGNORANT, EC_WORD_ABOUT, EC_WORD_BUG, EC_WORD_POKEMON, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Yoshi }, [FRONTIER_TRAINER_DESTIN] = { .facilityClass = FACILITY_CLASS_BUG_CATCHER, .trainerName = _("DESTIN"), - .speechBefore = {EC_WORD_IT_S, EC_WORD_WAY, EC_WORD_TOO, EC_WORD_HOT, EC_WORD_HERE, 0xFFFF}, - .speechWin = {EC_WORD_I_AM, EC_WORD_ABOUT, EC_WORD_TO, EC_MOVE(OVERHEAT), 0xFFFF, 0xFFFF}, - .speechLose = {EC_WORD_PLEASE, EC_WORD_I, EC_WORD_NEED, EC_WORD_SOME, EC_WORD_WATER, 0xFFFF}, + .speechBefore = {EC_WORD_IT_S, EC_WORD_WAY, EC_WORD_TOO, EC_WORD_HOT, EC_WORD_HERE, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_I_AM, EC_WORD_ABOUT, EC_WORD_TO, EC_MOVE(OVERHEAT), EC_EMPTY_WORD, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_PLEASE, EC_WORD_I, EC_WORD_NEED, EC_WORD_SOME, EC_WORD_WATER, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Destin }, [FRONTIER_TRAINER_KEON] = { .facilityClass = FACILITY_CLASS_NINJA_BOY, .trainerName = _("KEON"), - .speechBefore = {EC_WORD_FORGIVE, EC_WORD_ME, EC_WORD_BUT, EC_WORD_HERE_I_COME, EC_WORD_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_FORGIVE, EC_WORD_ME, EC_WORD_BUT, EC_WORD_HERE_I_COME, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechWin = {EC_WORD_FORGIVE, EC_WORD_ME, EC_WORD_FOR, EC_WORD_MY, EC_WORD_OVERWHELMING, EC_WORD_POWER}, - .speechLose = {EC_WORD_I_AM, EC_WORD_SORRY, EC_WORD_ELLIPSIS, 0xFFFF, 0xFFFF, 0xFFFF}, + .speechLose = {EC_WORD_I_AM, EC_WORD_SORRY, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Keon }, [FRONTIER_TRAINER_STUART] = { @@ -429,7 +429,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("NESTOR"), .speechBefore = {EC_WORD_SHOW, EC_WORD_ME, EC_WORD_A, EC_WORD_REALLY, EC_WORD_SMOOTH, EC_WORD_MOVE}, .speechWin = {EC_WORD_THERE, EC_WORD_WAS, EC_WORD_NOTHING, EC_WORD_SMOOTH, EC_WORD_ABOUT, EC_WORD_THAT}, - .speechLose = {EC_WORD_YOU, EC_WORD_REALLY, EC_WORD_ARE, EC_WORD_SMOOTH, EC_WORD_EXCL, 0xFFFF}, + .speechLose = {EC_WORD_YOU, EC_WORD_REALLY, EC_WORD_ARE, EC_WORD_SMOOTH, EC_WORD_EXCL, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Nestor }, [FRONTIER_TRAINER_DERRICK] = { @@ -445,13 +445,13 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("BRYSON"), .speechBefore = {EC_MOVE2(POISON_POWDER), EC_WORD_IS, EC_WORD_IN, EC_WORD_OUR, EC_MOVE2(COTTON_SPORE), EC_WORD_MOVE}, .speechWin = {EC_WORD_HOW_DO, EC_WORD_YOU, EC_WORD_LIKE, EC_WORD_OUR, EC_MOVE2(POISON_POWDER), EC_WORD_QUES}, - .speechLose = {EC_WORD_MY, EC_MOVE2(COTTON_SPORE), EC_WORD_WAS, EC_WORD_USELESS, 0xFFFF, 0xFFFF}, + .speechLose = {EC_WORD_MY, EC_MOVE2(COTTON_SPORE), EC_WORD_WAS, EC_WORD_USELESS, EC_EMPTY_WORD, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Bryson }, [FRONTIER_TRAINER_CLAYTON] = { .facilityClass = FACILITY_CLASS_BUG_MANIAC, .trainerName = _("CLAYTON"), - .speechBefore = {EC_WORD_HUH_QUES, 0xFFFF, 0xFFFF, EC_WORD_WHERE, EC_WORD_IS_IT_QUES, 0xFFFF}, + .speechBefore = {EC_WORD_HUH_QUES, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_WORD_WHERE, EC_WORD_IS_IT_QUES, EC_EMPTY_WORD}, .speechWin = {EC_WORD_WHERE, EC_WORD_IS_IT_QUES, EC_WORD_I_VE, EC_WORD_LOST, EC_WORD_MY, EC_WORD_POKENAV}, .speechLose = {EC_WORD_WHERE, EC_WORD_IS_IT_QUES, EC_WORD_I_VE, EC_WORD_LOST, EC_WORD_MY, EC_WORD_SENSE}, .monSet = gBattleFrontierTrainerMons_Clayton @@ -459,7 +459,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_TRENTON] = { .facilityClass = FACILITY_CLASS_FISHERMAN, .trainerName = _("TRENTON"), - .speechBefore = {EC_WORD_COME_OVER, EC_WORD_FOR, EC_WORD_SOME, EC_WORD_TASTY, EC_WORD_WATER, 0xFFFF}, + .speechBefore = {EC_WORD_COME_OVER, EC_WORD_FOR, EC_WORD_SOME, EC_WORD_TASTY, EC_WORD_WATER, EC_EMPTY_WORD}, .speechWin = {EC_WORD_MMM, EC_WORD_DO, EC_WORD_YOU, EC_WORD_WANT, EC_WORD_SOME, EC_WORD_QUES}, .speechLose = {EC_WORD_I, EC_WORD_GOT, EC_WORD_THIS, EC_WORD_TASTY, EC_WORD_WATER, EC_WORD_SHOPPING}, .monSet = gBattleFrontierTrainerMons_Trenton @@ -475,9 +475,9 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_WESLEY] = { .facilityClass = FACILITY_CLASS_FISHERMAN, .trainerName = _("WESLEY"), - .speechBefore = {EC_POKEMON2(MEW), EC_POKEMON2(MEW), EC_WORD_IS, EC_WORD_HOW, EC_WORD_I, EC_WORD_CRY}, + .speechBefore = {EC_POKEMON_NATIONAL(MEW), EC_POKEMON_NATIONAL(MEW), EC_WORD_IS, EC_WORD_HOW, EC_WORD_I, EC_WORD_CRY}, .speechWin = {EC_WORD_YES, EC_WORD_I, EC_WORD_KNOW, EC_WORD_I_AM, EC_WORD_CUTE, EC_WORD_EXCL}, - .speechLose = {EC_POKEMON2(MEW), EC_POKEMON2(MEW), EC_WORD_EXCL, EC_POKEMON2(MEW), EC_WORD_EXCL_EXCL, 0xFFFF}, + .speechLose = {EC_POKEMON_NATIONAL(MEW), EC_POKEMON_NATIONAL(MEW), EC_WORD_EXCL, EC_POKEMON_NATIONAL(MEW), EC_WORD_EXCL_EXCL, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Wesley }, [FRONTIER_TRAINER_ANTON] = { @@ -491,7 +491,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_LAWSON] = { .facilityClass = FACILITY_CLASS_RUIN_MANIAC, .trainerName = _("LAWSON"), - .speechBefore = {EC_WORD_I_AM, EC_WORD_YOUNG, EC_WORD_AT, EC_WORD_HEART, EC_WORD_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_I_AM, EC_WORD_YOUNG, EC_WORD_AT, EC_WORD_HEART, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechWin = {EC_WORD_NOT, EC_WORD_COOL, EC_WORD_EXCL, EC_WORD_NOT, EC_WORD_AT, EC_WORD_ALL}, .speechLose = {EC_WORD_I_AM, EC_WORD_OLD, EC_WORD_AND, EC_WORD_FEELING, EC_WORD_SHAKY, EC_WORD_ELLIPSIS}, .monSet = gBattleFrontierTrainerMons_Lawson @@ -515,16 +515,16 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_ADRIAN] = { .facilityClass = FACILITY_CLASS_COLLECTOR, .trainerName = _("ADRIAN"), - .speechBefore = {EC_WORD_YAHOO, EC_WORD_EXCL, 0xFFFF, EC_WORD_YAHOO, EC_WORD_EXCL_EXCL, 0xFFFF}, - .speechWin = {EC_WORD_THANK_YOU, EC_WORD_EXCL, 0xFFFF, EC_WORD_THANK_YOU, EC_WORD_EXCL_EXCL, 0xFFFF}, - .speechLose = {EC_WORD_GOOD_BYE, EC_WORD_EXCL, 0xFFFF, EC_WORD_GOOD_BYE, EC_WORD_EXCL_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_YAHOO, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_YAHOO, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_THANK_YOU, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_THANK_YOU, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_GOOD_BYE, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_GOOD_BYE, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Adrian }, [FRONTIER_TRAINER_TRISTAN] = { .facilityClass = FACILITY_CLASS_COLLECTOR, .trainerName = _("TRISTAN"), - .speechBefore = {EC_WORD_CONFUSED, EC_WORD_QUES, 0xFFFF, EC_WORD_I_AM, EC_WORD_A, EC_WORD_GENIUS}, - .speechWin = {EC_WORD_SEE, EC_WORD_QUES, 0xFFFF, EC_WORD_I_AM, EC_WORD_A, EC_WORD_GENIUS}, + .speechBefore = {EC_WORD_CONFUSED, EC_WORD_QUES, EC_EMPTY_WORD, EC_WORD_I_AM, EC_WORD_A, EC_WORD_GENIUS}, + .speechWin = {EC_WORD_SEE, EC_WORD_QUES, EC_EMPTY_WORD, EC_WORD_I_AM, EC_WORD_A, EC_WORD_GENIUS}, .speechLose = {EC_WORD_I_AM, EC_WORD_NOT, EC_WORD_A, EC_WORD_GENIUS, EC_WORD_IN, EC_WORD_BATTLE}, .monSet = gBattleFrontierTrainerMons_Tristan }, @@ -548,8 +548,8 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_PARASOL_LADY, .trainerName = _("CHELSEA"), .speechBefore = {EC_WORD_I, EC_WORD_SERIOUSLY, EC_WORD_MEAN, EC_WORD_TO, EC_WORD_WIN, EC_WORD_EXCL}, - .speechWin = {EC_WORD_THAT_WAS, EC_WORD_MY, EC_WORD_WILL, EC_WORD_TO, EC_WORD_WIN, 0xFFFF}, - .speechLose = {EC_WORD_YOU_RE, EC_WORD_FAR, EC_WORD_TOO_STRONG, EC_WORD_FOR, EC_WORD_ME, 0xFFFF}, + .speechWin = {EC_WORD_THAT_WAS, EC_WORD_MY, EC_WORD_WILL, EC_WORD_TO, EC_WORD_WIN, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_YOU_RE, EC_WORD_FAR, EC_WORD_TOO_STRONG, EC_WORD_FOR, EC_WORD_ME, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Chelsea }, [FRONTIER_TRAINER_DANELA] = { @@ -613,7 +613,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("JADEN"), .speechBefore = {EC_WORD_HELLO, EC_WORD_I, EC_WORD_THINK, EC_WORD_I, EC_WORD_ADORE, EC_WORD_YOU}, .speechWin = {EC_WORD_YOU, EC_WORD_MAKE, EC_WORD_ME, EC_MOVE(THRASH), EC_WORD_IN, EC_MOVE2(FRUSTRATION)}, - .speechLose = {EC_WORD_THIS_IS_IT_EXCL, 0xFFFF, 0xFFFF, EC_WORD_GOOD_BYE, EC_WORD_FOREVER, EC_WORD_EXCL}, + .speechLose = {EC_WORD_THIS_IS_IT_EXCL, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_WORD_GOOD_BYE, EC_WORD_FOREVER, EC_WORD_EXCL}, .monSet = gBattleFrontierTrainerMons_Jaden }, [FRONTIER_TRAINER_DAKOTA] = { @@ -621,7 +621,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("DAKOTA"), .speechBefore = {EC_WORD_YOU, EC_WORD_HAVE, EC_WORD_TO, EC_WORD_DANCE, EC_WORD_WITH, EC_WORD_POWER}, .speechWin = {EC_WORD_GOT, EC_WORD_IT, EC_WORD_QUES, EC_WORD_DANCE, EC_WORD_WITH, EC_WORD_POWER}, - .speechLose = {EC_WORD_OKAY, EC_WORD_YOU, EC_WORD_UNDERSTAND, EC_WORD_ALL_RIGHT, EC_WORD_EXCL, 0xFFFF}, + .speechLose = {EC_WORD_OKAY, EC_WORD_YOU, EC_WORD_UNDERSTAND, EC_WORD_ALL_RIGHT, EC_WORD_EXCL, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Dakota }, [FRONTIER_TRAINER_BRAYDEN] = { @@ -637,22 +637,22 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("CORSON"), .speechBefore = {EC_WORD_I, EC_WORD_GET, EC_WORD_TO, EC_MOVE2(BEAT_UP), EC_WORD_ON, EC_WORD_YOU}, .speechWin = {EC_WORD_TOO, EC_WORD_EASY, EC_WORD_EXCL, EC_WORD_I_AM, EC_WORD_SO, EC_WORD_COOL}, - .speechLose = {EC_WORD_WHY, EC_WORD_QUES_EXCL, 0xFFFF, EC_WORD_I, EC_MOVE2(CURSE), EC_WORD_YOU}, + .speechLose = {EC_WORD_WHY, EC_WORD_QUES_EXCL, EC_EMPTY_WORD, EC_WORD_I, EC_MOVE2(CURSE), EC_WORD_YOU}, .monSet = gBattleFrontierTrainerMons_Corson }, [FRONTIER_TRAINER_TREVIN] = { .facilityClass = FACILITY_CLASS_BIRD_KEEPER, .trainerName = _("TREVIN"), .speechBefore = {EC_WORD_THERE, EC_WORD_IS, EC_WORD_NONE, EC_WORD_BETTER, EC_WORD_THAN, EC_WORD_ME}, - .speechWin = {EC_WORD_YES_SIR_EXCL, 0xFFFF, 0xFFFF, EC_WORD_I_AM, EC_WORD_THE, EC_WORD_BEST}, - .speechLose = {EC_WORD_SERIOUS, EC_WORD_QUES_EXCL, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}, + .speechWin = {EC_WORD_YES_SIR_EXCL, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_WORD_I_AM, EC_WORD_THE, EC_WORD_BEST}, + .speechLose = {EC_WORD_SERIOUS, EC_WORD_QUES_EXCL, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Trevin }, [FRONTIER_TRAINER_PATRICK] = { .facilityClass = FACILITY_CLASS_SAILOR, .trainerName = _("PATRICK"), - .speechBefore = {EC_WORD_I_AM, EC_WORD_PERFECT, EC_WORD_EXCL, EC_WORD_GIVE_UP, EC_WORD_NOW, 0xFFFF}, - .speechWin = {EC_WORD_DON_T, EC_WORD_BE, EC_WORD_DISAPPOINTED, EC_WORD_I_AM, EC_WORD_PERFECT, 0xFFFF}, + .speechBefore = {EC_WORD_I_AM, EC_WORD_PERFECT, EC_WORD_EXCL, EC_WORD_GIVE_UP, EC_WORD_NOW, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_DON_T, EC_WORD_BE, EC_WORD_DISAPPOINTED, EC_WORD_I_AM, EC_WORD_PERFECT, EC_EMPTY_WORD}, .speechLose = {EC_WORD_BUT, EC_WORD_HOW, EC_WORD_QUES, EC_WORD_I_AM, EC_WORD_PERFECT, EC_WORD_ELLIPSIS}, .monSet = gBattleFrontierTrainerMons_Patrick }, @@ -667,9 +667,9 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_MAXWELL] = { .facilityClass = FACILITY_CLASS_SAILOR, .trainerName = _("MAXWELL"), - .speechBefore = {EC_WORD_HEY_THERE, EC_WORD_WHO_IS, EC_WORD_YOUR, EC_WORD_RIVAL, EC_WORD_QUES, 0xFFFF}, + .speechBefore = {EC_WORD_HEY_THERE, EC_WORD_WHO_IS, EC_WORD_YOUR, EC_WORD_RIVAL, EC_WORD_QUES, EC_EMPTY_WORD}, .speechWin = {EC_WORD_MY, EC_WORD_RIVAL, EC_WORD_IS, EC_WORD_MY, EC_WORD_GIRL, EC_WORD_FRIEND}, - .speechLose = {EC_WORD_I_AM, EC_WORD_MAKING, EC_WORD_YOU, EC_WORD_MY, EC_WORD_RIVAL, 0xFFFF}, + .speechLose = {EC_WORD_I_AM, EC_WORD_MAKING, EC_WORD_YOU, EC_WORD_MY, EC_WORD_RIVAL, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Maxwell }, [FRONTIER_TRAINER_DARYL] = { @@ -685,22 +685,22 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("KENNETH"), .speechBefore = {EC_WORD_YOU, EC_WORD_BETTER, EC_WORD_NOT, EC_MOVE2(SLACK_OFF), EC_WORD_WITH, EC_WORD_ME}, .speechWin = {EC_WORD_DID, EC_WORD_MY, EC_MOVE2(TAUNT), EC_WORD_INTIMIDATE, EC_WORD_YOU, EC_WORD_QUES}, - .speechLose = {EC_WORD_I_AM, EC_WORD_SORRY, EC_WORD_ELLIPSIS, 0xFFFF, 0xFFFF, 0xFFFF}, + .speechLose = {EC_WORD_I_AM, EC_WORD_SORRY, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Kenneth }, [FRONTIER_TRAINER_RICH] = { .facilityClass = FACILITY_CLASS_HIKER, .trainerName = _("RICH"), - .speechBefore = {EC_WORD_YOUR, EC_MOVE(FACADE), EC_WORD_DOESN_T, EC_MOVE2(TRICK), EC_WORD_ME, 0xFFFF}, - .speechWin = {EC_WORD_SERIOUSLY, EC_WORD_ARE, EC_WORD_YOU, EC_WORD_REALLY, EC_WORD_OK_QUES, 0xFFFF}, - .speechLose = {EC_WORD_THAT_WAS, EC_WORD_REALLY, EC_WORD_TOUGH, EC_WORD_ON, EC_WORD_ME, 0xFFFF}, + .speechBefore = {EC_WORD_YOUR, EC_MOVE(FACADE), EC_WORD_DOESN_T, EC_MOVE2(TRICK), EC_WORD_ME, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_SERIOUSLY, EC_WORD_ARE, EC_WORD_YOU, EC_WORD_REALLY, EC_WORD_OK_QUES, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_THAT_WAS, EC_WORD_REALLY, EC_WORD_TOUGH, EC_WORD_ON, EC_WORD_ME, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Rich }, [FRONTIER_TRAINER_CADEN] = { .facilityClass = FACILITY_CLASS_KINDLER, .trainerName = _("CADEN"), - .speechBefore = {EC_WORD_I, EC_WORD_CAN_T, EC_WORD_BE, EC_WORD_DEFEATED, EC_WORD_EXCL, 0xFFFF}, - .speechWin = {EC_WORD_FIRE, EC_WORD_EXCL, 0xFFFF, EC_WORD_FIRE, EC_WORD_EXCL_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_I, EC_WORD_CAN_T, EC_WORD_BE, EC_WORD_DEFEATED, EC_WORD_EXCL, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_FIRE, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_FIRE, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I_AM, EC_WORD_TIRED, EC_WORD_ELLIPSIS, EC_WORD_IT_S, EC_WORD_SO, EC_WORD_HOT}, .monSet = gBattleFrontierTrainerMons_Caden }, @@ -715,9 +715,9 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_NASH] = { .facilityClass = FACILITY_CLASS_KINDLER, .trainerName = _("NASH"), - .speechBefore = {EC_WORD_I_AM, EC_WORD_ON, EC_WORD_FIRE, EC_WORD_BABY, EC_WORD_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_I_AM, EC_WORD_ON, EC_WORD_FIRE, EC_WORD_BABY, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechWin = {EC_WORD_I, EC_WORD_LEFT, EC_WORD_YOU, EC_WORD_JUST, EC_WORD_AN, EC_MOVE2(EMBER)}, - .speechLose = {EC_WORD_AIYEEH, EC_WORD_EXCL_EXCL, 0xFFFF, EC_WORD_NO, EC_WORD_WATER, EC_WORD_PLEASE}, + .speechLose = {EC_WORD_AIYEEH, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD, EC_WORD_NO, EC_WORD_WATER, EC_WORD_PLEASE}, .monSet = gBattleFrontierTrainerMons_Nash }, [FRONTIER_TRAINER_ROBBY] = { @@ -749,13 +749,13 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("ELLEN"), .speechBefore = {EC_WORD_CRUSH, EC_WORD_YOU, EC_WORD_LIKE, EC_WORD_AN, EC_WORD_EGG, EC_WORD_EXCL}, .speechWin = {EC_WORD_THAT_WAS, EC_WORD_A, EC_WORD_TASTY, EC_WORD_VICTORY, EC_WORD_FOR, EC_WORD_ME}, - .speechLose = {EC_WORD_TOO, EC_WORD_TOUGH, EC_WORD_TO, EC_WORD_CRUSH, EC_WORD_EXCL, 0xFFFF}, + .speechLose = {EC_WORD_TOO, EC_WORD_TOUGH, EC_WORD_TO, EC_WORD_CRUSH, EC_WORD_EXCL, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Ellen }, [FRONTIER_TRAINER_RAMON] = { .facilityClass = FACILITY_CLASS_SWIMMING_TRIATHLETE_M, .trainerName = _("RAMON"), - .speechBefore = {EC_WORD_OKAY, EC_WORD_EXCL, 0xFFFF, EC_WORD_THIS, EC_WORD_IS, EC_WORD_PERFECTION}, + .speechBefore = {EC_WORD_OKAY, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_THIS, EC_WORD_IS, EC_WORD_PERFECTION}, .speechWin = {EC_WORD_I_AM, EC_WORD_HAPPY, EC_WORD_THAT, EC_WORD_I, EC_WORD_WON, EC_WORD_EXCL}, .speechLose = {EC_WORD_IT_S, EC_WORD_A, EC_WORD_SECRET, EC_WORD_WHY, EC_WORD_I_AM, EC_WORD_HAPPY}, .monSet = gBattleFrontierTrainerMons_Ramon @@ -764,8 +764,8 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_SWIMMING_TRIATHLETE_M, .trainerName = _("ARTHUR"), .speechBefore = {EC_WORD_HERE_I_COME, EC_WORD_FEELING, EC_WORD_READY, EC_WORD_FOR, EC_WORD_IT, EC_WORD_ALL}, - .speechWin = {EC_WORD_THAT_S_IT_EXCL, 0xFFFF, 0xFFFF, EC_WORD_THAT_WAS, EC_WORD_FABULOUS, EC_WORD_EXCL}, - .speechLose = {EC_WORD_THAT_WAS, EC_WORD_NOT, EC_WORD_WHAT, EC_WORD_I, EC_WORD_NEED, 0xFFFF}, + .speechWin = {EC_WORD_THAT_S_IT_EXCL, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_WORD_THAT_WAS, EC_WORD_FABULOUS, EC_WORD_EXCL}, + .speechLose = {EC_WORD_THAT_WAS, EC_WORD_NOT, EC_WORD_WHAT, EC_WORD_I, EC_WORD_NEED, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Arthur }, [FRONTIER_TRAINER_ALONDRA] = { @@ -781,7 +781,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("ADRIANA"), .speechBefore = {EC_WORD_COME, EC_WORD_SEE, EC_WORD_AN, EC_WORD_INCREDIBLE, EC_WORD_SWIFT_SWIM, EC_WORD_EXCL}, .speechWin = {EC_WORD_I, EC_WORD_MAKE, EC_WORD_IT, EC_WORD_LOOK, EC_WORD_SO, EC_WORD_EASY}, - .speechLose = {EC_WORD_I_AM, EC_WORD_FEELING, EC_MOVE2(BEAT_UP), EC_WORD_AND, EC_WORD_TIRED, 0xFFFF}, + .speechLose = {EC_WORD_I_AM, EC_WORD_FEELING, EC_MOVE2(BEAT_UP), EC_WORD_AND, EC_WORD_TIRED, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Adriana }, [FRONTIER_TRAINER_MALIK] = { @@ -795,17 +795,17 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_JILL] = { .facilityClass = FACILITY_CLASS_CYCLING_TRIATHLETE_F, .trainerName = _("JILL"), - .speechBefore = {EC_WORD_I_AM, EC_WORD_THE, EC_MOVE2(QUICK_ATTACK), EC_WORD_TRAINER, EC_WORD_EXCL, 0xFFFF}, - .speechWin = {EC_WORD_THE, EC_MOVE2(QUICK_ATTACK), EC_WORD_TRAINER, EC_WORD_WINS, EC_WORD_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_I_AM, EC_WORD_THE, EC_MOVE2(QUICK_ATTACK), EC_WORD_TRAINER, EC_WORD_EXCL, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_THE, EC_MOVE2(QUICK_ATTACK), EC_WORD_TRAINER, EC_WORD_WINS, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechLose = {EC_WORD_THE, EC_MOVE2(QUICK_ATTACK), EC_WORD_TRAINER, EC_WORD_GIVES, EC_WORD_UP, EC_WORD_EXCL}, .monSet = gBattleFrontierTrainerMons_Jill }, [FRONTIER_TRAINER_ERIK] = { .facilityClass = FACILITY_CLASS_RUNNING_TRIATHLETE_M, .trainerName = _("ERIK"), - .speechBefore = {EC_WORD_I_AM, EC_WORD_THE, EC_WORD_SPEED_BOOST, EC_WORD_HERO, EC_WORD_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_I_AM, EC_WORD_THE, EC_WORD_SPEED_BOOST, EC_WORD_HERO, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechWin = {EC_WORD_THANK_YOU, EC_WORD_FROM, EC_WORD_THE, EC_WORD_SPEED_BOOST, EC_WORD_HERO, EC_WORD_EXCL}, - .speechLose = {EC_WORD_WAAAH, EC_WORD_EXCL_EXCL, 0xFFFF, EC_WORD_NO, EC_WORD_NO, EC_WORD_EXCL_EXCL}, + .speechLose = {EC_WORD_WAAAH, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD, EC_WORD_NO, EC_WORD_NO, EC_WORD_EXCL_EXCL}, .monSet = gBattleFrontierTrainerMons_Erik }, [FRONTIER_TRAINER_YAZMIN] = { @@ -843,9 +843,9 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_CARLO] = { .facilityClass = FACILITY_CLASS_CYCLING_TRIATHLETE_M, .trainerName = _("CARLO"), - .speechBefore = {EC_WORD_HAH, EC_WORD_EXCL_EXCL, 0xFFFF, EC_WORD_YEAH, EC_WORD_EXCL_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_HAH, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD, EC_WORD_YEAH, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD}, .speechWin = {EC_WORD_I, EC_WORD_DO, EC_WORD_THINGS, EC_WORD_AT, EC_MOVE(EXTREME_SPEED), EC_WORD_EXCL}, - .speechLose = {EC_WORD_I, EC_WORD_LOST, EC_WORD_AT, EC_MOVE(EXTREME_SPEED), EC_WORD_ELLIPSIS, 0xFFFF}, + .speechLose = {EC_WORD_I, EC_WORD_LOST, EC_WORD_AT, EC_MOVE(EXTREME_SPEED), EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Carlo }, [FRONTIER_TRAINER_EMILIA] = { @@ -859,7 +859,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_DALIA] = { .facilityClass = FACILITY_CLASS_CYCLING_TRIATHLETE_F, .trainerName = _("DALIA"), - .speechBefore = {EC_WORD_MY, EC_WORD_BIKE, EC_WORD_IS, EC_WORD_VERY, EC_WORD_EXPENSIVE, 0xFFFF}, + .speechBefore = {EC_WORD_MY, EC_WORD_BIKE, EC_WORD_IS, EC_WORD_VERY, EC_WORD_EXPENSIVE, EC_EMPTY_WORD}, .speechWin = {EC_WORD_DON_T, EC_WORD_COME, EC_WORD_NEAR, EC_WORD_MY, EC_WORD_BIKE, EC_WORD_EXCL}, .speechLose = {EC_WORD_MY, EC_WORD_BIKE, EC_WORD_IS, EC_WORD_MY, EC_WORD_BEST, EC_WORD_FRIEND}, .monSet = gBattleFrontierTrainerMons_Dalia @@ -867,24 +867,24 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_HITOMI] = { .facilityClass = FACILITY_CLASS_BLACK_BELT, .trainerName = _("HITOMI"), - .speechBefore = {EC_WORD_YEAH, EC_WORD_EXCL_EXCL, 0xFFFF, EC_WORD_HAH, EC_WORD_EXCL_EXCL, 0xFFFF}, - .speechWin = {EC_WORD_WHAT, EC_WORD_QUES_EXCL, 0xFFFF, EC_WORD_I, EC_WORD_WON, EC_WORD_QUES_EXCL}, - .speechLose = {EC_WORD_AIYEEH, EC_WORD_EXCL_EXCL, 0xFFFF, EC_WORD_I_AM, EC_WORD_SORRY, EC_WORD_EXCL_EXCL}, + .speechBefore = {EC_WORD_YEAH, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD, EC_WORD_HAH, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_WHAT, EC_WORD_QUES_EXCL, EC_EMPTY_WORD, EC_WORD_I, EC_WORD_WON, EC_WORD_QUES_EXCL}, + .speechLose = {EC_WORD_AIYEEH, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD, EC_WORD_I_AM, EC_WORD_SORRY, EC_WORD_EXCL_EXCL}, .monSet = gBattleFrontierTrainerMons_Hitomi }, [FRONTIER_TRAINER_RICARDO] = { .facilityClass = FACILITY_CLASS_BLACK_BELT, .trainerName = _("RICARDO"), .speechBefore = {EC_WORD_COME_ON, EC_WORD_EXCL, EC_WORD_PLAY, EC_WORD_TIME, EC_WORD_IS, EC_WORD_OVER}, - .speechWin = {EC_WORD_YOU_RE, EC_WORD_OUT, EC_WORD_OF, EC_WORD_HERE, EC_WORD_EXCL, 0xFFFF}, - .speechLose = {EC_WORD_PLEASE, EC_WORD_DON_T, EC_WORD_HIT, EC_WORD_ME, EC_WORD_EXCL, 0xFFFF}, + .speechWin = {EC_WORD_YOU_RE, EC_WORD_OUT, EC_WORD_OF, EC_WORD_HERE, EC_WORD_EXCL, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_PLEASE, EC_WORD_DON_T, EC_WORD_HIT, EC_WORD_ME, EC_WORD_EXCL, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Ricardo }, [FRONTIER_TRAINER_SHIZUKA] = { .facilityClass = FACILITY_CLASS_BLACK_BELT, .trainerName = _("SHIZUKA"), .speechBefore = {EC_WORD_SHOW, EC_WORD_ME, EC_WORD_THAT, EC_WORD_YOU_RE, EC_WORD_SERIOUS, EC_WORD_EXCL}, - .speechWin = {EC_WORD_I, EC_WORD_WON_T, EC_WORD_FORGET, EC_WORD_ABOUT, EC_WORD_YOU, 0xFFFF}, + .speechWin = {EC_WORD_I, EC_WORD_WON_T, EC_WORD_FORGET, EC_WORD_ABOUT, EC_WORD_YOU, EC_EMPTY_WORD}, .speechLose = {EC_WORD_YOU_RE, EC_WORD_PERFECT, EC_WORD_IN, EC_WORD_EVERY, EC_WORD_WAY, EC_WORD_EXCL}, .monSet = gBattleFrontierTrainerMons_Shizuka }, @@ -900,7 +900,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_BATTLE_GIRL, .trainerName = _("KELLY"), .speechBefore = {EC_WORD_MY, EC_WORD_NIGHT, EC_WORD_SCHOOL, EC_WORD_IS, EC_WORD_REALLY, EC_WORD_SCARY}, - .speechWin = {EC_WORD_A, EC_WORD_LADY, EC_WORD_GHOST, EC_WORD_APPEARS, EC_WORD_THERE, 0xFFFF}, + .speechWin = {EC_WORD_A, EC_WORD_LADY, EC_WORD_GHOST, EC_WORD_APPEARS, EC_WORD_THERE, EC_EMPTY_WORD}, .speechLose = {EC_WORD_THE, EC_WORD_HOME, EC_WORD_WORK, EC_WORD_IS, EC_WORD_AWFULLY, EC_WORD_SCARY}, .monSet = gBattleFrontierTrainerMons_Kelly }, @@ -908,14 +908,14 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_BATTLE_GIRL, .trainerName = _("RAYNA"), .speechBefore = {EC_WORD_I_AM, EC_WORD_NO_1, EC_WORD_WHEN, EC_WORD_IT_S, EC_WORD_ABOUT, EC_WORD_POWER}, - .speechWin = {EC_WORD_UNDERSTAND, EC_WORD_MY, EC_WORD_POWER, EC_WORD_NOW, EC_WORD_QUES, 0xFFFF}, - .speechLose = {EC_WORD_TERRIBLE, EC_WORD_ELLIPSIS, 0xFFFF, EC_WORD_I_AM, EC_WORD_TERRIBLE, EC_WORD_ELLIPSIS}, + .speechWin = {EC_WORD_UNDERSTAND, EC_WORD_MY, EC_WORD_POWER, EC_WORD_NOW, EC_WORD_QUES, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_TERRIBLE, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_WORD_I_AM, EC_WORD_TERRIBLE, EC_WORD_ELLIPSIS}, .monSet = gBattleFrontierTrainerMons_Rayna }, [FRONTIER_TRAINER_EVAN] = { .facilityClass = FACILITY_CLASS_EXPERT_M, .trainerName = _("EVAN"), - .speechBefore = {EC_WORD_EVERY, EC_WORD_BATTLE, EC_WORD_HAS, EC_WORD_A, EC_WORD_SMELL, 0xFFFF}, + .speechBefore = {EC_WORD_EVERY, EC_WORD_BATTLE, EC_WORD_HAS, EC_WORD_A, EC_WORD_SMELL, EC_EMPTY_WORD}, .speechWin = {EC_WORD_OH, EC_WORD_EXCL, EC_WORD_THE, EC_MOVE(SWEET_SCENT), EC_WORD_OF, EC_WORD_VICTORY}, .speechLose = {EC_WORD_THE, EC_WORD_AWFUL, EC_WORD_STENCH, EC_WORD_OF, EC_WORD_A, EC_WORD_LOSS}, .monSet = gBattleFrontierTrainerMons_Evan @@ -923,23 +923,23 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_JORDAN] = { .facilityClass = FACILITY_CLASS_EXPERT_M, .trainerName = _("JORDAN"), - .speechBefore = {EC_WORD_GOOD, EC_WORD_EXCL, 0xFFFF, EC_WORD_COME_ON, EC_WORD_EXCL_EXCL, 0xFFFF}, - .speechWin = {EC_WORD_YOU, EC_WORD_CAN_T, EC_WORD_BEAT, EC_WORD_ME, EC_WORD_EXCL, 0xFFFF}, - .speechLose = {EC_WORD_WHAT, EC_WORD_QUES_EXCL, 0xFFFF, EC_WORD_BUT, EC_WORD_HOW, EC_WORD_QUES}, + .speechBefore = {EC_WORD_GOOD, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_COME_ON, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_YOU, EC_WORD_CAN_T, EC_WORD_BEAT, EC_WORD_ME, EC_WORD_EXCL, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_WHAT, EC_WORD_QUES_EXCL, EC_EMPTY_WORD, EC_WORD_BUT, EC_WORD_HOW, EC_WORD_QUES}, .monSet = gBattleFrontierTrainerMons_Jordan }, [FRONTIER_TRAINER_JOEL] = { .facilityClass = FACILITY_CLASS_EXPERT_M, .trainerName = _("JOEL"), - .speechBefore = {EC_WORD_FUFUFU, EC_WORD_ELLIPSIS, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}, - .speechWin = {EC_WORD_GIGGLE, EC_WORD_ELLIPSIS, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}, - .speechLose = {EC_WORD_HAHAHA, EC_WORD_ELLIPSIS, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}, + .speechBefore = {EC_WORD_FUFUFU, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_GIGGLE, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_HAHAHA, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Joel }, [FRONTIER_TRAINER_KRISTEN] = { .facilityClass = FACILITY_CLASS_EXPERT_F, .trainerName = _("KRISTEN"), - .speechBefore = {EC_WORD_HAHAHA, EC_WORD_ELLIPSIS, 0xFFFF, EC_WORD_A, EC_WORD_KID, EC_WORD_ELLIPSIS}, + .speechBefore = {EC_WORD_HAHAHA, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_WORD_A, EC_WORD_KID, EC_WORD_ELLIPSIS}, .speechWin = {EC_WORD_JUST, EC_WORD_A_LITTLE, EC_WORD_KID, EC_WORD_AFTER, EC_WORD_ALL, EC_WORD_EXCL}, .speechLose = {EC_WORD_A, EC_WORD_TOUGH, EC_WORD_KID, EC_WORD_HUH_QUES, EC_WORD_HUMPH, EC_WORD_EXCL}, .monSet = gBattleFrontierTrainerMons_Kristen @@ -947,7 +947,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_SELPHY] = { .facilityClass = FACILITY_CLASS_EXPERT_F, .trainerName = _("SELPHY"), - .speechBefore = {EC_WORD_HUH_QUES, EC_WORD_WHAT, EC_WORD_IS_IT_QUES, 0xFFFF, 0xFFFF, 0xFFFF}, + .speechBefore = {EC_WORD_HUH_QUES, EC_WORD_WHAT, EC_WORD_IS_IT_QUES, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD}, .speechWin = {EC_WORD_OH, EC_WORD_YES, EC_WORD_EXCL, EC_WORD_WHY, EC_WORD_NOT, EC_WORD_QUES}, .speechLose = {EC_WORD_OH, EC_WORD_NO, EC_WORD_EXCL, EC_WORD_WHY, EC_WORD_NOT, EC_WORD_QUES}, .monSet = gBattleFrontierTrainerMons_Selphy @@ -956,14 +956,14 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_EXPERT_F, .trainerName = _("CHLOE"), .speechBefore = {EC_WORD_COME, EC_WORD_WE, EC_WORD_WILL, EC_WORD_DO, EC_WORD_BATTLE, EC_WORD_NOW}, - .speechWin = {EC_WORD_MORE, EC_WORD_EXCL, 0xFFFF, EC_WORD_ANOTHER, EC_WORD_BATTLE, EC_WORD_EXCL}, - .speechLose = {EC_WORD_OH, EC_WORD_EXCL, 0xFFFF, EC_WORD_STRONG, EC_WORD_YOU, EC_WORD_ARE}, + .speechWin = {EC_WORD_MORE, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_ANOTHER, EC_WORD_BATTLE, EC_WORD_EXCL}, + .speechLose = {EC_WORD_OH, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_STRONG, EC_WORD_YOU, EC_WORD_ARE}, .monSet = gBattleFrontierTrainerMons_Chloe }, [FRONTIER_TRAINER_NORTON] = { .facilityClass = FACILITY_CLASS_PSYCHIC_M, .trainerName = _("NORTON"), - .speechBefore = {EC_WORD_I, EC_WORD_KNOW, EC_WORD_ONLY, EC_WORD_YOU, 0xFFFF, 0xFFFF}, + .speechBefore = {EC_WORD_I, EC_WORD_KNOW, EC_WORD_ONLY, EC_WORD_YOU, EC_EMPTY_WORD, EC_EMPTY_WORD}, .speechWin = {EC_WORD_EXCUSE_ME, EC_WORD_BUT, EC_WORD_YOU_RE, EC_WORD_A, EC_WORD_PUSHOVER, EC_WORD_EXCL}, .speechLose = {EC_WORD_YOU_RE, EC_WORD_SOME, EC_WORD_KIND, EC_WORD_OF, EC_WORD_AWESOME, EC_WORD_EXCL}, .monSet = gBattleFrontierTrainerMons_Norton @@ -973,15 +973,15 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("LUKAS"), .speechBefore = {EC_WORD_MY, EC_WORD_JOKING, EC_WORD_IS, EC_WORD_PRETTY, EC_WORD_TERRIBLE, EC_WORD_ELLIPSIS}, .speechWin = {EC_WORD_YOUR, EC_WORD_ROCK_HEAD, EC_WORD_EXISTS, EC_WORD_TO, EC_WORD_SHINE, EC_WORD_EXCL}, - .speechLose = {EC_WORD_YOUR, EC_WORD_ROCK_HEAD, EC_WORD_COME, EC_WORD_TO, EC_WORD_SHINE, 0xFFFF}, + .speechLose = {EC_WORD_YOUR, EC_WORD_ROCK_HEAD, EC_WORD_COME, EC_WORD_TO, EC_WORD_SHINE, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Lukas }, [FRONTIER_TRAINER_ZACH] = { .facilityClass = FACILITY_CLASS_PSYCHIC_M, .trainerName = _("ZACH"), .speechBefore = {EC_WORD_I_AM, EC_WORD_AN, EC_WORD_EXCELLENT, EC_MOVE2(MIMIC), EC_WORD_OF, EC_WORD_POKEMON}, - .speechWin = {EC_WORD_I_AM, EC_WORD_HAPPY, EC_WORD_LIKE, EC_WORD_A_LITTLE, EC_POKEMON2(TOGEPI), EC_WORD_EXCL}, - .speechLose = {EC_WORD_I_AM, EC_WORD_ANGRY, EC_WORD_LIKE, EC_WORD_A, EC_POKEMON2(MANKEY), EC_WORD_EXCL}, + .speechWin = {EC_WORD_I_AM, EC_WORD_HAPPY, EC_WORD_LIKE, EC_WORD_A_LITTLE, EC_POKEMON_NATIONAL(TOGEPI), EC_WORD_EXCL}, + .speechLose = {EC_WORD_I_AM, EC_WORD_ANGRY, EC_WORD_LIKE, EC_WORD_A, EC_POKEMON_NATIONAL(MANKEY), EC_WORD_EXCL}, .monSet = gBattleFrontierTrainerMons_Zach }, [FRONTIER_TRAINER_KAITLYN] = { @@ -997,7 +997,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("BREANNA"), .speechBefore = {EC_WORD_MY, EC_WORD_POKEMON, EC_WORD_WILL, EC_WORD_CRUSH, EC_WORD_YOU, EC_WORD_EXCL}, .speechWin = {EC_WORD_HAVE, EC_WORD_SOME, EC_WORD_MORE, EC_WORD_OF, EC_WORD_THIS, EC_WORD_EXCL}, - .speechLose = {EC_WORD_YOU, EC_WORD_HAVE, EC_WORD_GUTS, EC_WORD_AND, EC_WORD_SKILL, 0xFFFF}, + .speechLose = {EC_WORD_YOU, EC_WORD_HAVE, EC_WORD_GUTS, EC_WORD_AND, EC_WORD_SKILL, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Breanna }, [FRONTIER_TRAINER_KENDRA] = { @@ -1005,7 +1005,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("KENDRA"), .speechBefore = {EC_WORD_IF, EC_WORD_YOU_RE, EC_WORD_SMART, EC_WORD_STOP, EC_WORD_RIGHT, EC_WORD_NOW}, .speechWin = {EC_WORD_I, EC_WORD_SAID, EC_WORD_THAT, EC_WORD_YOU, EC_WORD_SHOULD, EC_WORD_STOP}, - .speechLose = {EC_WORD_WHY, EC_WORD_DIDN_T, EC_WORD_YOU, EC_WORD_STOP, EC_WORD_QUES, 0xFFFF}, + .speechLose = {EC_WORD_WHY, EC_WORD_DIDN_T, EC_WORD_YOU, EC_WORD_STOP, EC_WORD_QUES, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Kendra }, [FRONTIER_TRAINER_MOLLY] = { @@ -1013,7 +1013,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("MOLLY"), .speechBefore = {EC_WORD_WILL, EC_WORD_MY, EC_WORD_CUTE_CHARM, EC_MOVE2(ATTRACT), EC_WORD_YOU, EC_WORD_QUES}, .speechWin = {EC_WORD_YOUR, EC_WORD_POKEMON, EC_WORD_ARE, EC_WORD_MY, EC_WORD_TOYS, EC_WORD_NOW}, - .speechLose = {EC_WORD_OH, EC_WORD_HOW, EC_WORD_COULD, EC_WORD_YOU, EC_WORD_QUES, 0xFFFF}, + .speechLose = {EC_WORD_OH, EC_WORD_HOW, EC_WORD_COULD, EC_WORD_YOU, EC_WORD_QUES, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Molly }, [FRONTIER_TRAINER_JAZMIN] = { @@ -1077,7 +1077,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("BALEY"), .speechBefore = {EC_MOVE(SCREECH), EC_WORD_IS, EC_WORD_LIKE, EC_WORD_MUSIC, EC_WORD_TO_ME, EC_WORD_EXCL}, .speechWin = {EC_WORD_MY, EC_MOVE(SCREECH), EC_WORD_STRATEGY, EC_WORD_IS, EC_WORD_THE, EC_WORD_BEST}, - .speechLose = {EC_WORD_YOU_RE, EC_WORD_SOUNDPROOF, EC_WORD_QUES, 0xFFFF, 0xFFFF, 0xFFFF}, + .speechLose = {EC_WORD_YOU_RE, EC_WORD_SOUNDPROOF, EC_WORD_QUES, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Baley }, [FRONTIER_TRAINER_ZACKARY] = { @@ -1093,7 +1093,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("GABRIEL"), .speechBefore = {EC_MOVE2(POUND), EC_WORD_THE, EC_WORD_THICK_FAT, EC_WORD_ON, EC_WORD_MY, EC_MOVE2(BELLY_DRUM)}, .speechWin = {EC_MOVE2(POUND), EC_WORD_MY, EC_MOVE2(BELLY_DRUM), EC_MOVE2(POUND), EC_WORD_MY, EC_MOVE2(BELLY_DRUM)}, - .speechLose = {EC_WORD_MY, EC_MOVE2(BELLY_DRUM), EC_WORD_WAS, EC_WORD_TOO_WEAK, EC_WORD_ELLIPSIS, 0xFFFF}, + .speechLose = {EC_WORD_MY, EC_MOVE2(BELLY_DRUM), EC_WORD_WAS, EC_WORD_TOO_WEAK, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Gabriel }, [FRONTIER_TRAINER_EMILY] = { @@ -1115,17 +1115,17 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_SOFIA] = { .facilityClass = FACILITY_CLASS_AROMA_LADY, .trainerName = _("SOFIA"), - .speechBefore = {EC_POKEMON(LOUDRED), EC_WORD_PROBABLY, EC_WORD_HAS, EC_WORD_A, EC_MOVE(SWEET_SCENT), 0xFFFF}, + .speechBefore = {EC_POKEMON(LOUDRED), EC_WORD_PROBABLY, EC_WORD_HAS, EC_WORD_A, EC_MOVE(SWEET_SCENT), EC_EMPTY_WORD}, .speechWin = {EC_WORD_THAT_S, EC_WORD_THE, EC_WORD_FEELING, EC_WORD_THAT, EC_WORD_I, EC_WORD_GET}, - .speechLose = {EC_WORD_I, EC_WORD_WORK, EC_WORD_AT, EC_WORD_THE, EC_WORD_DEPT_STORE, 0xFFFF}, + .speechLose = {EC_WORD_I, EC_WORD_WORK, EC_WORD_AT, EC_WORD_THE, EC_WORD_DEPT_STORE, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Sofia }, [FRONTIER_TRAINER_BRADEN] = { .facilityClass = FACILITY_CLASS_COOLTRAINER_M, .trainerName = _("BRADEN"), - .speechBefore = {EC_WORD_I_CHOOSE_YOU, EC_WORD_EXCL, 0xFFFF, EC_WORD_THIS_IS_IT_EXCL, 0xFFFF, 0xFFFF}, + .speechBefore = {EC_WORD_I_CHOOSE_YOU, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_THIS_IS_IT_EXCL, EC_EMPTY_WORD, EC_EMPTY_WORD}, .speechWin = {EC_WORD_I_AM, EC_WORD_FEELING, EC_WORD_PRETTY, EC_WORD_AWESOME, EC_WORD_ABOUT, EC_WORD_MYSELF}, - .speechLose = {EC_WORD_ALL_RIGHT, EC_WORD_EXCL, 0xFFFF, EC_WORD_I, EC_WORD_SURRENDER, EC_WORD_EXCL}, + .speechLose = {EC_WORD_ALL_RIGHT, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_I, EC_WORD_SURRENDER, EC_WORD_EXCL}, .monSet = gBattleFrontierTrainerMons_Braden }, [FRONTIER_TRAINER_KAYDEN] = { @@ -1133,7 +1133,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("KAYDEN"), .speechBefore = {EC_WORD_THEY, EC_WORD_OVERDO, EC_WORD_THAT, EC_WORD_GOURMET, EC_WORD_THING, EC_WORD_ELLIPSIS}, .speechWin = {EC_WORD_THAT, EC_WORD_GOURMET, EC_WORD_THING, EC_WORD_ISN_T, EC_WORD_FOR, EC_WORD_ME}, - .speechLose = {EC_WORD_HEY, EC_WORD_THIS, EC_WORD_IS, EC_WORD_PRETTY, EC_WORD_TASTY, 0xFFFF}, + .speechLose = {EC_WORD_HEY, EC_WORD_THIS, EC_WORD_IS, EC_WORD_PRETTY, EC_WORD_TASTY, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Kayden }, [FRONTIER_TRAINER_COOPER] = { @@ -1141,7 +1141,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("COOPER"), .speechBefore = {EC_WORD_THIS, EC_WORD_SHOULD, EC_WORD_ABSOLUTELY, EC_WORD_BE, EC_WORD_A, EC_WORD_PUSHOVER}, .speechWin = {EC_WORD_THAT_WAS, EC_WORD_TOO, EC_WORD_EXCITING, EC_WORD_FOR, EC_WORD_ME, EC_WORD_ELLIPSIS}, - .speechLose = {EC_WORD_PLEASE, EC_WORD_EXCL, 0xFFFF, EC_WORD_SORRY, EC_WORD_I_AM, EC_WORD_SORRY}, + .speechLose = {EC_WORD_PLEASE, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_SORRY, EC_WORD_I_AM, EC_WORD_SORRY}, .monSet = gBattleFrontierTrainerMons_Cooper }, [FRONTIER_TRAINER_JULIA] = { @@ -1179,8 +1179,8 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_DOMINIC] = { .facilityClass = FACILITY_CLASS_PKMN_RANGER_M, .trainerName = _("DOMINIC"), - .speechBefore = {EC_WORD_I, EC_WORD_HAVE, EC_WORD_THIS, EC_WORD_EXCELLENT, EC_WORD_CAMERA, 0xFFFF}, - .speechWin = {EC_WORD_MY, EC_WORD_CAMERA, EC_WORD_WAS, EC_WORD_AWFULLY, EC_WORD_EXPENSIVE, 0xFFFF}, + .speechBefore = {EC_WORD_I, EC_WORD_HAVE, EC_WORD_THIS, EC_WORD_EXCELLENT, EC_WORD_CAMERA, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_MY, EC_WORD_CAMERA, EC_WORD_WAS, EC_WORD_AWFULLY, EC_WORD_EXPENSIVE, EC_EMPTY_WORD}, .speechLose = {EC_WORD_MY, EC_WORD_CAMERA, EC_WORD_DOESN_T, EC_WORD_MISS, EC_WORD_A, EC_WORD_THING}, .monSet = gBattleFrontierTrainerMons_Dominic }, @@ -1188,8 +1188,8 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_PKMN_RANGER_M, .trainerName = _("NIKOLAS"), .speechBefore = {EC_WORD_I, EC_MOVE2(MIMIC), EC_WORD_POKEMON, EC_WORD_AFTER, EC_WORD_EVERY, EC_WORD_BATTLE}, - .speechWin = {EC_WORD_IF_I_WIN, EC_WORD_I, EC_WORD_PRETEND, EC_WORD_I_AM, EC_WORD_A, EC_POKEMON2(TAUROS)}, - .speechLose = {EC_WORD_IF_I_LOSE, EC_WORD_I, EC_WORD_PRETEND, EC_WORD_I_AM, EC_WORD_A, EC_POKEMON2(MILTANK)}, + .speechWin = {EC_WORD_IF_I_WIN, EC_WORD_I, EC_WORD_PRETEND, EC_WORD_I_AM, EC_WORD_A, EC_POKEMON_NATIONAL(TAUROS)}, + .speechLose = {EC_WORD_IF_I_LOSE, EC_WORD_I, EC_WORD_PRETEND, EC_WORD_I_AM, EC_WORD_A, EC_POKEMON_NATIONAL(MILTANK)}, .monSet = gBattleFrontierTrainerMons_Nikolas }, [FRONTIER_TRAINER_VALERIA] = { @@ -1212,16 +1212,16 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_PKMN_RANGER_F, .trainerName = _("MEGHAN"), .speechBefore = {EC_WORD_SCHOOL, EC_WORD_IS, EC_WORD_OUT, EC_WORD_TIME, EC_WORD_TO, EC_WORD_PLAY}, - .speechWin = {EC_WORD_MY, EC_WORD_BOY, EC_WORD_FRIEND, EC_WORD_LIKES, EC_WORD_COMICS, 0xFFFF}, - .speechLose = {EC_WORD_IT_S, EC_WORD_BACK, EC_WORD_TO, EC_WORD_SCHOOL, EC_WORD_SOON, 0xFFFF}, + .speechWin = {EC_WORD_MY, EC_WORD_BOY, EC_WORD_FRIEND, EC_WORD_LIKES, EC_WORD_COMICS, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_IT_S, EC_WORD_BACK, EC_WORD_TO, EC_WORD_SCHOOL, EC_WORD_SOON, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Meghan }, [FRONTIER_TRAINER_ROBERTO] = { .facilityClass = FACILITY_CLASS_DRAGON_TAMER, .trainerName = _("ROBERTO"), - .speechBefore = {EC_WORD_DRAGON, EC_WORD_POKEMON, EC_WORD_ARE, EC_WORD_INVINCIBLE, EC_WORD_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_DRAGON, EC_WORD_POKEMON, EC_WORD_ARE, EC_WORD_INVINCIBLE, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechWin = {EC_WORD_YOU, EC_WORD_WEREN_T, EC_WORD_BAD, EC_WORD_I_WAS, EC_WORD_JUST, EC_WORD_BETTER}, - .speechLose = {EC_WORD_AREN_T, EC_WORD_YOU, EC_WORD_SATISFIED, EC_WORD_YET, EC_WORD_QUES, 0xFFFF}, + .speechLose = {EC_WORD_AREN_T, EC_WORD_YOU, EC_WORD_SATISFIED, EC_WORD_YET, EC_WORD_QUES, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Roberto }, [FRONTIER_TRAINER_DAMIAN] = { @@ -1229,7 +1229,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("DAMIAN"), .speechBefore = {EC_WORD_MY, EC_WORD_PURE_POWER, EC_WORD_IS, EC_WORD_MACHINE, EC_WORD_LIKE, EC_WORD_EXCL}, .speechWin = {EC_WORD_MY, EC_MOVE2(MACH_PUNCH), EC_WORD_WILL, EC_WORD_MAKE, EC_WORD_A, EC_MOVE(BRICK_BREAK)}, - .speechLose = {EC_WORD_ARRGH, EC_WORD_EXCL, 0xFFFF, EC_WORD_NO, EC_WORD_EXCL_EXCL, 0xFFFF}, + .speechLose = {EC_WORD_ARRGH, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_NO, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Damian }, [FRONTIER_TRAINER_BRODY] = { @@ -1243,7 +1243,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_GRAHAM] = { .facilityClass = FACILITY_CLASS_DRAGON_TAMER, .trainerName = _("GRAHAM"), - .speechBefore = {EC_WORD_YEAH, EC_WORD_EXCL, 0xFFFF, EC_WORD_YEAH_YEAH, EC_WORD_EXCL_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_YEAH, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_YEAH_YEAH, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD}, .speechWin = {EC_WORD_WAHAHAHA, EC_WORD_WAHAHAHA, EC_WORD_EXCL, EC_WORD_WAHAHAHA, EC_WORD_WAHAHAHA, EC_WORD_EXCL_EXCL}, .speechLose = {EC_WORD_I_AM, EC_WORD_SORRY, EC_WORD_ELLIPSIS, EC_WORD_IT_S, EC_WORD_MY, EC_WORD_BAD}, .monSet = gBattleFrontierTrainerMons_Graham @@ -1252,23 +1252,23 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_POKEFAN_M, .trainerName = _("TYLOR"), .speechBefore = {EC_WORD_ARE, EC_WORD_YOU, EC_WORD_FEELING, EC_WORD_MY, EC_MOVE2(HEAT_WAVE), EC_WORD_QUES}, - .speechWin = {EC_WORD_YES, EC_WORD_I_AM, EC_WORD_ON, EC_WORD_FIRE, EC_WORD_EXCL, 0xFFFF}, + .speechWin = {EC_WORD_YES, EC_WORD_I_AM, EC_WORD_ON, EC_WORD_FIRE, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechLose = {EC_WORD_BUT, EC_WORD_I_WAS, EC_WORD_ON, EC_WORD_FIRE, EC_WORD_FOR, EC_WORD_YOU}, .monSet = gBattleFrontierTrainerMons_Tylor }, [FRONTIER_TRAINER_JAREN] = { .facilityClass = FACILITY_CLASS_POKEFAN_F, .trainerName = _("JAREN"), - .speechBefore = {EC_WORD_FIGHTING, EC_WORD_SPIRIT, EC_WORD_QUES, EC_WORD_ME, EC_WORD_QUES, 0xFFFF}, - .speechWin = {EC_WORD_I, EC_WORD_WANT, EC_WORD_MORE, EC_WORD_CUTE, EC_WORD_POKEMON, 0xFFFF}, - .speechLose = {EC_WORD_YOUR, EC_WORD_POKEMON, EC_WORD_LOOK, EC_WORD_QUITE, EC_WORD_CUTE, 0xFFFF}, + .speechBefore = {EC_WORD_FIGHTING, EC_WORD_SPIRIT, EC_WORD_QUES, EC_WORD_ME, EC_WORD_QUES, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_I, EC_WORD_WANT, EC_WORD_MORE, EC_WORD_CUTE, EC_WORD_POKEMON, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_YOUR, EC_WORD_POKEMON, EC_WORD_LOOK, EC_WORD_QUITE, EC_WORD_CUTE, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Jaren }, [FRONTIER_TRAINER_CORDELL] = { .facilityClass = FACILITY_CLASS_PKMN_BREEDER_M, .trainerName = _("CORDELL"), .speechBefore = {EC_WORD_A, EC_WORD_BATTLE, EC_WORD_IS, EC_WORD_DECIDED, EC_WORD_ON, EC_WORD_SPIRIT}, - .speechWin = {EC_WORD_CAN_T, EC_WORD_YOU, EC_WORD_ACCEPT, EC_WORD_THAT, EC_WORD_QUES, 0xFFFF}, + .speechWin = {EC_WORD_CAN_T, EC_WORD_YOU, EC_WORD_ACCEPT, EC_WORD_THAT, EC_WORD_QUES, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I, EC_WORD_WILL, EC_WORD_BE, EC_WORD_ON, EC_WORD_MY, EC_WORD_WAY}, .monSet = gBattleFrontierTrainerMons_Cordell }, @@ -1291,7 +1291,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_JOHAN] = { .facilityClass = FACILITY_CLASS_YOUNGSTER, .trainerName = _("JOHAN"), - .speechBefore = {EC_WORD_WINTER, EC_WORD_WILL, EC_WORD_SOON, EC_WORD_BE, EC_WORD_HERE, 0xFFFF}, + .speechBefore = {EC_WORD_WINTER, EC_WORD_WILL, EC_WORD_SOON, EC_WORD_BE, EC_WORD_HERE, EC_EMPTY_WORD}, .speechWin = {EC_WORD_MY, EC_WORD_ALLOWANCE, EC_WORD_COULD, EC_WORD_USE, EC_WORD_A, EC_MOVE2(HELPING_HAND)}, .speechLose = {EC_WORD_I, EC_WORD_ALWAYS, EC_WORD_USE, EC_WORD_MY, EC_WORD_ALLOWANCE, EC_WORD_UP}, .monSet = gBattleFrontierTrainerMons_Johan @@ -1315,7 +1315,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_ISIAH] = { .facilityClass = FACILITY_CLASS_SCHOOL_KID_M, .trainerName = _("ISIAH"), - .speechBefore = {EC_WORD_I, EC_WORD_PRETEND, EC_WORD_TO, EC_WORD_STUDY, EC_WORD_A_LOT, 0xFFFF}, + .speechBefore = {EC_WORD_I, EC_WORD_PRETEND, EC_WORD_TO, EC_WORD_STUDY, EC_WORD_A_LOT, EC_EMPTY_WORD}, .speechWin = {EC_WORD_I, EC_MOVE2(TRICK), EC_WORD_MOTHER, EC_WORD_FOR, EC_WORD_MY, EC_WORD_ALLOWANCE}, .speechLose = {EC_WORD_I, EC_WORD_DON_T, EC_WORD_WANT, EC_WORD_TO, EC_WORD_STUDY, EC_WORD_MORE}, .monSet = gBattleFrontierTrainerMons_Isiah @@ -1340,14 +1340,14 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_SCHOOL_KID_F, .trainerName = _("MEGAN"), .speechBefore = {EC_WORD_I, EC_WORD_BELIEVE, EC_WORD_IN, EC_WORD_AN, EC_MOVE(AROMATHERAPY), EC_WORD_BATH}, - .speechWin = {EC_WORD_I, EC_WORD_WANT, EC_WORD_A, EC_WORD_HEALTHY, EC_WORD_CLEAR_BODY, 0xFFFF}, + .speechWin = {EC_WORD_I, EC_WORD_WANT, EC_WORD_A, EC_WORD_HEALTHY, EC_WORD_CLEAR_BODY, EC_EMPTY_WORD}, .speechLose = {EC_WORD_IF, EC_WORD_ONLY, EC_MOVE(AROMATHERAPY), EC_WORD_WERE, EC_WORD_LESS, EC_WORD_EXPENSIVE}, .monSet = gBattleFrontierTrainerMons_Megan }, [FRONTIER_TRAINER_ISSAC] = { .facilityClass = FACILITY_CLASS_RICH_BOY, .trainerName = _("ISSAC"), - .speechBefore = {EC_WORD_MY, EC_WORD_HOBBY, EC_WORD_QUES, 0xFFFF, 0xFFFF, 0xFFFF}, + .speechBefore = {EC_WORD_MY, EC_WORD_HOBBY, EC_WORD_QUES, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD}, .speechWin = {EC_WORD_I, EC_WORD_LIKE, EC_WORD_ANY, EC_WORD_KIND, EC_WORD_OF, EC_MOVE2(WATER_SPORT)}, .speechLose = {EC_WORD_I, EC_WORD_DISLIKE, EC_WORD_ANY, EC_WORD_KIND, EC_WORD_OF, EC_MOVE2(MUD_SPORT)}, .monSet = gBattleFrontierTrainerMons_Issac @@ -1355,8 +1355,8 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_QUINTON] = { .facilityClass = FACILITY_CLASS_RICH_BOY, .trainerName = _("QUINTON"), - .speechBefore = {EC_WORD_I_AM, EC_WORD_SAD, EC_WORD_CAUSE, EC_WORD_I_AM, EC_WORD_TOO_WEAK, 0xFFFF}, - .speechWin = {EC_WORD_YOU, EC_WORD_AREN_T, EC_WORD_TOO_STRONG, EC_WORD_FOR, EC_WORD_ME, 0xFFFF}, + .speechBefore = {EC_WORD_I_AM, EC_WORD_SAD, EC_WORD_CAUSE, EC_WORD_I_AM, EC_WORD_TOO_WEAK, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_YOU, EC_WORD_AREN_T, EC_WORD_TOO_STRONG, EC_WORD_FOR, EC_WORD_ME, EC_EMPTY_WORD}, .speechLose = {EC_WORD_HEY, EC_WORD_WHAT, EC_WORD_DID, EC_WORD_I, EC_WORD_DO, EC_WORD_QUES}, .monSet = gBattleFrontierTrainerMons_Quinton }, @@ -1372,7 +1372,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_LADY, .trainerName = _("ANSLEY"), .speechBefore = {EC_WORD_I_AM, EC_WORD_BORED, EC_WORD_ELLIPSIS, EC_WORD_DANCE, EC_WORD_FOR, EC_WORD_ME}, - .speechWin = {EC_WORD_YOU_VE, EC_WORD_BORED, EC_WORD_ME, EC_WORD_SOME, EC_WORD_MORE, 0xFFFF}, + .speechWin = {EC_WORD_YOU_VE, EC_WORD_BORED, EC_WORD_ME, EC_WORD_SOME, EC_WORD_MORE, EC_EMPTY_WORD}, .speechLose = {EC_WORD_TAKE, EC_WORD_YOUR, EC_MOVE2(FRUSTRATION), EC_WORD_SOME, EC_WORD_OTHER, EC_WORD_PLACE}, .monSet = gBattleFrontierTrainerMons_Ansley }, @@ -1380,8 +1380,8 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_BUG_CATCHER, .trainerName = _("HOLDEN"), .speechBefore = {EC_WORD_LET_S, EC_WORD_COMMEMORATE, EC_WORD_MY, EC_WORD_COOLNESS, EC_WORD_IN, EC_WORD_BATTLE}, - .speechWin = {EC_WORD_YOU_RE, EC_WORD_TOO_WEAK, EC_WORD_FOR, EC_WORD_ANY, EC_WORD_PRAISE, 0xFFFF}, - .speechLose = {EC_WORD_YOUR, EC_WORD_BATTLE, EC_WORD_SENSE, EC_WORD_IS, EC_WORD_AMUSING, 0xFFFF}, + .speechWin = {EC_WORD_YOU_RE, EC_WORD_TOO_WEAK, EC_WORD_FOR, EC_WORD_ANY, EC_WORD_PRAISE, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_YOUR, EC_WORD_BATTLE, EC_WORD_SENSE, EC_WORD_IS, EC_WORD_AMUSING, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Holden }, [FRONTIER_TRAINER_LUCA] = { @@ -1396,14 +1396,14 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_NINJA_BOY, .trainerName = _("JAMISON"), .speechBefore = {EC_WORD_MY, EC_MOVE2(SECRET_POWER), EC_WORD_IS, EC_WORD_OVERWHELMING, EC_WORD_TO, EC_WORD_POKEMON}, - .speechWin = {EC_WORD_DID, EC_WORD_YOU, EC_WORD_SEE, EC_WORD_THAT, EC_WORD_QUES, 0xFFFF}, + .speechWin = {EC_WORD_DID, EC_WORD_YOU, EC_WORD_SEE, EC_WORD_THAT, EC_WORD_QUES, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I, EC_WORD_WILL, EC_WORD_USE, EC_MOVE(SMOKESCREEN), EC_WORD_TO, EC_WORD_ESCAPE}, .monSet = gBattleFrontierTrainerMons_Jamison }, [FRONTIER_TRAINER_GUNNAR] = { .facilityClass = FACILITY_CLASS_NINJA_BOY, .trainerName = _("GUNNAR"), - .speechBefore = {EC_WORD_I, EC_MOVE(CUT), EC_WORD_DOWN, EC_WORD_EVERY, EC_WORD_OPPONENT, 0xFFFF}, + .speechBefore = {EC_WORD_I, EC_MOVE(CUT), EC_WORD_DOWN, EC_WORD_EVERY, EC_WORD_OPPONENT, EC_EMPTY_WORD}, .speechWin = {EC_WORD_DON_T, EC_MOVE(GRUDGE), EC_WORD_ME, EC_WORD_FOR, EC_WORD_YOUR, EC_WORD_LOSS}, .speechLose = {EC_WORD_PLEASE, EC_WORD_LOSE, EC_WORD_THAT, EC_MOVE(SCARY_FACE), EC_WORD_OF, EC_WORD_YOURS}, .monSet = gBattleFrontierTrainerMons_Gunnar @@ -1413,22 +1413,22 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("CRAIG"), .speechBefore = {EC_WORD_I, EC_WORD_CAN_T, EC_WORD_WAIT, EC_WORD_FOR, EC_WORD_MY, EC_WORD_TRAIN}, .speechWin = {EC_WORD_MY, EC_WORD_TRAIN, EC_WORD_ISN_T, EC_WORD_HERE, EC_WORD_YET, EC_WORD_ELLIPSIS}, - .speechLose = {EC_WORD_HERE_IT_IS, EC_WORD_MY, EC_WORD_TRAIN, EC_WORD_SEE_YA, EC_WORD_EXCL, 0xFFFF}, + .speechLose = {EC_WORD_HERE_IT_IS, EC_WORD_MY, EC_WORD_TRAIN, EC_WORD_SEE_YA, EC_WORD_EXCL, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Craig }, [FRONTIER_TRAINER_PIERCE] = { .facilityClass = FACILITY_CLASS_TUBER_M, .trainerName = _("PIERCE"), .speechBefore = {EC_WORD_THERE, EC_WORD_WAS, EC_WORD_A, EC_MOVE2(HEAT_WAVE), EC_WORD_LAST, EC_WORD_WEEK}, - .speechWin = {EC_WORD_I, EC_WORD_CAN_T, EC_WORD_TAKE, EC_WORD_A, EC_MOVE2(HEAT_WAVE), 0xFFFF}, - .speechLose = {EC_WORD_DIDN_T, EC_WORD_IT, EC_MOVE(HAIL), EC_WORD_TOO, EC_WORD_QUES, 0xFFFF}, + .speechWin = {EC_WORD_I, EC_WORD_CAN_T, EC_WORD_TAKE, EC_WORD_A, EC_MOVE2(HEAT_WAVE), EC_EMPTY_WORD}, + .speechLose = {EC_WORD_DIDN_T, EC_WORD_IT, EC_MOVE(HAIL), EC_WORD_TOO, EC_WORD_QUES, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Pierce }, [FRONTIER_TRAINER_REGINA] = { .facilityClass = FACILITY_CLASS_TUBER_F, .trainerName = _("REGINA"), .speechBefore = {EC_WORD_I, EC_WORD_LIKE, EC_WORD_TO, EC_WORD_PLAY, EC_WORD_IN, EC_WORD_WATER}, - .speechWin = {EC_WORD_I, EC_WORD_REFUSE, EC_WORD_TO, EC_WORD_COME, EC_WORD_OUT, 0xFFFF}, + .speechWin = {EC_WORD_I, EC_WORD_REFUSE, EC_WORD_TO, EC_WORD_COME, EC_WORD_OUT, EC_EMPTY_WORD}, .speechLose = {EC_WORD_YOU_RE, EC_WORD_NOT, EC_WORD_MUCH, EC_WORD_GOOD, EC_WORD_IN, EC_WORD_WATER}, .monSet = gBattleFrontierTrainerMons_Regina }, @@ -1469,7 +1469,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("HUNTER"), .speechBefore = {EC_WORD_SHOW, EC_WORD_ME, EC_WORD_A, EC_WORD_TOTALLY, EC_WORD_COOL, EC_MOVE(CROSS_CHOP)}, .speechWin = {EC_WORD_YOU_RE, EC_WORD_TOO_WEAK, EC_WORD_TO, EC_WORD_DO, EC_WORD_A, EC_MOVE(CROSS_CHOP)}, - .speechLose = {EC_WORD_WAS, EC_WORD_IT, EC_WORD_A, EC_WORD_MISTAKE, EC_WORD_QUES, 0xFFFF}, + .speechLose = {EC_WORD_WAS, EC_WORD_IT, EC_WORD_A, EC_WORD_MISTAKE, EC_WORD_QUES, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Hunter }, [FRONTIER_TRAINER_AIDEN] = { @@ -1483,9 +1483,9 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_XAVIER] = { .facilityClass = FACILITY_CLASS_RUIN_MANIAC, .trainerName = _("XAVIER"), - .speechBefore = {EC_WORD_HEY_THERE, EC_WORD_EXCL, 0xFFFF, EC_WORD_LOOK, EC_WORD_LOOK, EC_WORD_EXCL_EXCL}, - .speechWin = {EC_WORD_GOOD_BYE, EC_WORD_AND, EC_WORD_THANK_YOU, EC_WORD_THAT_WAS, EC_WORD_FUNNY, 0xFFFF}, - .speechLose = {EC_WORD_WOWEE, EC_WORD_EXCL, 0xFFFF, EC_WORD_NO, EC_WORD_NO, EC_WORD_EXCL_EXCL}, + .speechBefore = {EC_WORD_HEY_THERE, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_LOOK, EC_WORD_LOOK, EC_WORD_EXCL_EXCL}, + .speechWin = {EC_WORD_GOOD_BYE, EC_WORD_AND, EC_WORD_THANK_YOU, EC_WORD_THAT_WAS, EC_WORD_FUNNY, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_WOWEE, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_NO, EC_WORD_NO, EC_WORD_EXCL_EXCL}, .monSet = gBattleFrontierTrainerMons_Xavier }, [FRONTIER_TRAINER_CLINTON] = { @@ -1493,7 +1493,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("CLINTON"), .speechBefore = {EC_WORD_WANT, EC_WORD_TO, EC_WORD_SEE, EC_WORD_MY, EC_MOVE(HYPNOSIS), EC_WORD_QUES}, .speechWin = {EC_WORD_YOUR, EC_MOVE2(FURY_SWIPES), EC_WORD_YOUR, EC_MOVE(STRENGTH), EC_WORD_YOUNG, EC_WORD_TRAINER}, - .speechLose = {EC_WORD_TCH, EC_WORD_ELLIPSIS, 0xFFFF, EC_WORD_I_AM, EC_WORD_TOO_WEAK, EC_WORD_ELLIPSIS}, + .speechLose = {EC_WORD_TCH, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_WORD_I_AM, EC_WORD_TOO_WEAK, EC_WORD_ELLIPSIS}, .monSet = gBattleFrontierTrainerMons_Clinton }, [FRONTIER_TRAINER_JESSE] = { @@ -1501,7 +1501,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("JESSE"), .speechBefore = {EC_WORD_THIS, EC_WORD_BATTLE, EC_WORD_IS, EC_WORD_FOR, EC_WORD_MY, EC_WORD_MOTHER}, .speechWin = {EC_WORD_MOTHER, EC_WORD_WILL, EC_WORD_BE, EC_WORD_HAPPY, EC_WORD_FOR, EC_WORD_ME}, - .speechLose = {EC_WORD_I, EC_WORD_WANT, EC_WORD_MY, EC_WORD_MOTHER, EC_WORD_EXCL, 0xFFFF}, + .speechLose = {EC_WORD_I, EC_WORD_WANT, EC_WORD_MY, EC_WORD_MOTHER, EC_WORD_EXCL, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Jesse }, [FRONTIER_TRAINER_EDUARDO] = { @@ -1515,7 +1515,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_HAL] = { .facilityClass = FACILITY_CLASS_GUITARIST, .trainerName = _("HAL"), - .speechBefore = {EC_WORD_I_AM, EC_WORD_TRENDY, EC_WORD_AREN_T, EC_WORD_I, EC_WORD_QUES, 0xFFFF}, + .speechBefore = {EC_WORD_I_AM, EC_WORD_TRENDY, EC_WORD_AREN_T, EC_WORD_I, EC_WORD_QUES, EC_EMPTY_WORD}, .speechWin = {EC_WORD_I_AM, EC_WORD_FEELING, EC_WORD_HIP_AND, EC_WORD_HAPPENING, EC_WORD_OH_YEAH, EC_WORD_EXCL}, .speechLose = {EC_WORD_I_AM, EC_WORD_ALWAYS, EC_WORD_TRENDY, EC_WORD_THANK_YOU, EC_WORD_VERY, EC_WORD_MUCH}, .monSet = gBattleFrontierTrainerMons_Hal @@ -1525,7 +1525,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("GAGE"), .speechBefore = {EC_WORD_HERE_IT_IS, EC_WORD_A, EC_WORD_FLYING, EC_WORD_TYPE, EC_WORD_HIDDEN, EC_WORD_MOVE}, .speechWin = {EC_WORD_IT_S, EC_WORD_A, EC_WORD_FLYING, EC_WORD_TYPE, EC_WORD_VICTORY, EC_WORD_EXCL}, - .speechLose = {EC_WORD_IF_I_LOSE, EC_WORD_I, EC_WORD_JUST, EC_MOVE(FLY), EC_WORD_AWAY, 0xFFFF}, + .speechLose = {EC_WORD_IF_I_LOSE, EC_WORD_I, EC_WORD_JUST, EC_MOVE(FLY), EC_WORD_AWAY, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Gage }, [FRONTIER_TRAINER_ARNOLD] = { @@ -1563,8 +1563,8 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_GUSTAVO] = { .facilityClass = FACILITY_CLASS_HIKER, .trainerName = _("GUSTAVO"), - .speechBefore = {EC_MOVE(CHARGE), EC_WORD_EXCL, 0xFFFF, EC_MOVE(CHARGE), EC_WORD_EXCL_EXCL, 0xFFFF}, - .speechWin = {EC_WORD_SURRENDER, EC_WORD_QUES, 0xFFFF, EC_WORD_SO, EC_WORD_SOON, EC_WORD_QUES}, + .speechBefore = {EC_MOVE(CHARGE), EC_WORD_EXCL, EC_EMPTY_WORD, EC_MOVE(CHARGE), EC_WORD_EXCL_EXCL, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_SURRENDER, EC_WORD_QUES, EC_EMPTY_WORD, EC_WORD_SO, EC_WORD_SOON, EC_WORD_QUES}, .speechLose = {EC_WORD_YOU, EC_WORD_CAN_T, EC_WORD_MAKE, EC_WORD_ME, EC_WORD_SURRENDER, EC_WORD_YET}, .monSet = gBattleFrontierTrainerMons_Gustavo }, @@ -1581,7 +1581,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("ALFREDO"), .speechBefore = {EC_WORD_A, EC_WORD_FIERY, EC_WORD_GOURMET, EC_WORD_AM, EC_WORD_I, EC_WORD_EXCL}, .speechWin = {EC_WORD_IT_S, EC_WORD_A, EC_WORD_TASTY, EC_WORD_GOURMET, EC_WORD_VICTORY, EC_WORD_EXCL}, - .speechLose = {EC_WORD_WHAT, EC_WORD_A, EC_WORD_DISASTER, EC_WORD_THAT_WAS, EC_WORD_EXCL, 0xFFFF}, + .speechLose = {EC_WORD_WHAT, EC_WORD_A, EC_WORD_DISASTER, EC_WORD_THAT_WAS, EC_WORD_EXCL, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Alfredo }, [FRONTIER_TRAINER_RUBEN] = { @@ -1589,15 +1589,15 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("RUBEN"), .speechBefore = {EC_WORD_I, EC_WORD_CAN_T, EC_WORD_WAIT, EC_WORD_TO, EC_WORD_GET, EC_WORD_GOING}, .speechWin = {EC_WORD_GET, EC_WORD_GOING, EC_WORD_EXCL, EC_WORD_THIS, EC_WORD_IS, EC_WORD_GOOD_BYE}, - .speechLose = {EC_WORD_I_VE, EC_WORD_GOT, EC_WORD_TO, EC_WORD_GET, EC_WORD_GOING, 0xFFFF}, + .speechLose = {EC_WORD_I_VE, EC_WORD_GOT, EC_WORD_TO, EC_WORD_GET, EC_WORD_GOING, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Ruben }, [FRONTIER_TRAINER_LAMAR] = { .facilityClass = FACILITY_CLASS_GENTLEMAN, .trainerName = _("LAMAR"), - .speechBefore = {EC_WORD_A, EC_MOVE2(PRESENT), EC_WORD_FOR, EC_WORD_ME, EC_WORD_QUES, 0xFFFF}, + .speechBefore = {EC_WORD_A, EC_MOVE2(PRESENT), EC_WORD_FOR, EC_WORD_ME, EC_WORD_QUES, EC_EMPTY_WORD}, .speechWin = {EC_WORD_MMM, EC_WORD_THIS, EC_WORD_IS, EC_WORD_QUITE, EC_WORD_TASTY, EC_WORD_ELLIPSIS}, - .speechLose = {EC_WORD_OH, EC_WORD_IT_S, EC_WORD_A, EC_WORD_GAME, EC_WORD_IS_IT_QUES, 0xFFFF}, + .speechLose = {EC_WORD_OH, EC_WORD_IT_S, EC_WORD_A, EC_WORD_GAME, EC_WORD_IS_IT_QUES, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Lamar }, [FRONTIER_TRAINER_JAXON] = { @@ -1645,14 +1645,14 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("SKYLER"), .speechBefore = {EC_MOVE2(INGRAIN), EC_WORD_IS, EC_WORD_MY, EC_WORD_CHOICE, EC_WORD_BATTLE, EC_WORD_MOVE}, .speechWin = {EC_WORD_YOU, EC_WORD_CAN_T, EC_WORD_MOVE, EC_WORD_ME, EC_WORD_NOW, EC_WORD_EXCL}, - .speechLose = {EC_WORD_YOU, EC_MOVE(CUT), EC_WORD_ME, EC_WORD_DOWN, EC_WORD_ELLIPSIS, 0xFFFF}, + .speechLose = {EC_WORD_YOU, EC_MOVE(CUT), EC_WORD_ME, EC_WORD_DOWN, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Skyler }, [FRONTIER_TRAINER_RUTH] = { .facilityClass = FACILITY_CLASS_PICNICKER, .trainerName = _("RUTH"), .speechBefore = {EC_WORD_I, EC_WORD_WANT, EC_WORD_TO, EC_WORD_ENJOY, EC_WORD_THIS, EC_WORD_BATTLE}, - .speechWin = {EC_WORD_THAT_WAS, EC_WORD_MUCH, EC_WORD_TOO, EC_WORD_EASY, EC_WORD_EXCL, 0xFFFF}, + .speechWin = {EC_WORD_THAT_WAS, EC_WORD_MUCH, EC_WORD_TOO, EC_WORD_EASY, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechLose = {EC_WORD_PLEASE, EC_WORD_STOP, EC_WORD_I, EC_WORD_DON_T, EC_WORD_ENJOY, EC_WORD_THIS}, .monSet = gBattleFrontierTrainerMons_Ruth }, @@ -1669,7 +1669,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("PEDRO"), .speechBefore = {EC_WORD_A, EC_WORD_SWIFT_SWIM, EC_WORD_WILL, EC_WORD_DO, EC_WORD_YOU, EC_WORD_GOOD}, .speechWin = {EC_WORD_THAT_S, EC_WORD_HOW, EC_WORD_I, EC_WORD_SINK, EC_WORD_AN, EC_WORD_OPPONENT}, - .speechLose = {EC_WORD_UH_OH, EC_WORD_EXCL, 0xFFFF, EC_WORD_A, EC_MOVE(WHIRLPOOL), EC_WORD_EXCL}, + .speechLose = {EC_WORD_UH_OH, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_A, EC_MOVE(WHIRLPOOL), EC_WORD_EXCL}, .monSet = gBattleFrontierTrainerMons_Pedro }, [FRONTIER_TRAINER_ERICK] = { @@ -1693,7 +1693,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("JOYCE"), .speechBefore = {EC_WORD_YOU, EC_WORD_MAKE, EC_WORD_ME, EC_WORD_GO, EC_WORD_AHAHA, EC_WORD_EXCL}, .speechWin = {EC_WORD_LALALA, EC_WORD_NO, EC_WORD_LOSING, EC_WORD_FOR, EC_WORD_ME, EC_WORD_EXCL}, - .speechLose = {EC_WORD_LALALA, EC_WORD_ELLIPSIS, 0xFFFF, EC_WORD_HUH_QUES, 0xFFFF, 0xFFFF}, + .speechLose = {EC_WORD_LALALA, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_WORD_HUH_QUES, EC_EMPTY_WORD, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Joyce }, [FRONTIER_TRAINER_TODD] = { @@ -1707,8 +1707,8 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_GAVIN] = { .facilityClass = FACILITY_CLASS_POKEFAN_M, .trainerName = _("GAVIN"), - .speechBefore = {EC_WORD_I, EC_WORD_WILL, EC_MOVE(BIDE), EC_WORD_MY, EC_WORD_TIME, 0xFFFF}, - .speechWin = {EC_WORD_IT_S, EC_WORD_OVER, EC_WORD_SO, EC_WORD_SOON, EC_WORD_QUES, 0xFFFF}, + .speechBefore = {EC_WORD_I, EC_WORD_WILL, EC_MOVE(BIDE), EC_WORD_MY, EC_WORD_TIME, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_IT_S, EC_WORD_OVER, EC_WORD_SO, EC_WORD_SOON, EC_WORD_QUES, EC_EMPTY_WORD}, .speechLose = {EC_WORD_MY, EC_WORD_MISTAKE, EC_WORD_WAS, EC_WORD_TOO, EC_WORD_EXPENSIVE, EC_WORD_ELLIPSIS}, .monSet = gBattleFrontierTrainerMons_Gavin }, @@ -1716,7 +1716,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_POKEFAN_F, .trainerName = _("MALORY"), .speechBefore = {EC_WORD_PROMISE, EC_WORD_TO, EC_WORD_SHOW, EC_WORD_ME, EC_WORD_CUTE, EC_WORD_POKEMON}, - .speechWin = {EC_WORD_GIGGLE, EC_WORD_ELLIPSIS, 0xFFFF, EC_WORD_THANK_YOU, EC_WORD_SO, EC_WORD_MUCH}, + .speechWin = {EC_WORD_GIGGLE, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_WORD_THANK_YOU, EC_WORD_SO, EC_WORD_MUCH}, .speechLose = {EC_WORD_TCH, EC_WORD_YOUR, EC_WORD_POKEMON, EC_WORD_AREN_T, EC_WORD_VERY, EC_WORD_NICE}, .monSet = gBattleFrontierTrainerMons_Malory }, @@ -1733,7 +1733,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("OSCAR"), .speechBefore = {EC_WORD_LET_S, EC_WORD_SEE, EC_WORD_YOUR, EC_WORD_POWER, EC_WORD_IN, EC_WORD_FULL}, .speechWin = {EC_WORD_THAT_WAS, EC_WORD_NOT, EC_WORD_YOUR, EC_WORD_FULL, EC_WORD_POWER, EC_WORD_EXCL}, - .speechLose = {EC_WORD_NOT, EC_WORD_FUNNY, EC_WORD_ELLIPSIS, EC_WORD_YOU_RE, EC_WORD_TOO_STRONG, 0xFFFF}, + .speechLose = {EC_WORD_NOT, EC_WORD_FUNNY, EC_WORD_ELLIPSIS, EC_WORD_YOU_RE, EC_WORD_TOO_STRONG, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Oscar }, [FRONTIER_TRAINER_WILSON] = { @@ -1772,8 +1772,8 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_COOLTRAINER_M, .trainerName = _("ALONZO"), .speechBefore = {EC_WORD_I_VE, EC_WORD_NOT, EC_WORD_LOST, EC_WORD_ONCE, EC_WORD_YET, EC_WORD_EXCL}, - .speechWin = {EC_WORD_YOUR, EC_WORD_SAD, EC_WORD_LOOK, EC_WORD_BECOMES, EC_WORD_YOU, 0xFFFF}, - .speechLose = {EC_WORD_I, EC_WORD_DON_T, EC_WORD_BELIEVE, EC_WORD_THIS, EC_WORD_ELLIPSIS, 0xFFFF}, + .speechWin = {EC_WORD_YOUR, EC_WORD_SAD, EC_WORD_LOOK, EC_WORD_BECOMES, EC_WORD_YOU, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_I, EC_WORD_DON_T, EC_WORD_BELIEVE, EC_WORD_THIS, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Alonzo }, [FRONTIER_TRAINER_VINCE] = { @@ -1812,7 +1812,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_COOLTRAINER_F, .trainerName = _("CARRIE"), .speechBefore = {EC_WORD_I, EC_WORD_WILL, EC_WORD_SHOW, EC_WORD_YOU, EC_WORD_GUTSY, EC_WORD_EXCL}, - .speechWin = {EC_WORD_IT_S, EC_WORD_ALL, EC_WORD_ABOUT, EC_WORD_GUTS, EC_WORD_EXCL, 0xFFFF}, + .speechWin = {EC_WORD_IT_S, EC_WORD_ALL, EC_WORD_ABOUT, EC_WORD_GUTS, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechLose = {EC_WORD_OH, EC_WORD_NO, EC_WORD_ELLIPSIS, EC_MOVE(SELF_DESTRUCT), EC_WORD_MODE, EC_WORD_EXCL}, .monSet = gBattleFrontierTrainerMons_Carrie }, @@ -1827,9 +1827,9 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_TYLER] = { .facilityClass = FACILITY_CLASS_PKMN_RANGER_M, .trainerName = _("TYLER"), - .speechBefore = {EC_WORD_YO, EC_WORD_EXCL, 0xFFFF, EC_WORD_LET_S, EC_WORD_GO, EC_WORD_EXCL_EXCL}, - .speechWin = {EC_WORD_YO, EC_WORD_EXCL, 0xFFFF, EC_WORD_I, EC_WORD_WON, EC_WORD_YO}, - .speechLose = {EC_WORD_YO, EC_WORD_EXCL, 0xFFFF, EC_WORD_I, EC_WORD_LOST, EC_WORD_YO}, + .speechBefore = {EC_WORD_YO, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_LET_S, EC_WORD_GO, EC_WORD_EXCL_EXCL}, + .speechWin = {EC_WORD_YO, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_I, EC_WORD_WON, EC_WORD_YO}, + .speechLose = {EC_WORD_YO, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_I, EC_WORD_LOST, EC_WORD_YO}, .monSet = gBattleFrontierTrainerMons_Tyler }, [FRONTIER_TRAINER_CHAZ] = { @@ -1867,7 +1867,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_DORINE] = { .facilityClass = FACILITY_CLASS_PKMN_RANGER_F, .trainerName = _("DORINE"), - .speechBefore = {EC_WORD_I_AM, EC_WORD_YOUNG, EC_WORD_AND, EC_WORD_STRONG, EC_WORD_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_I_AM, EC_WORD_YOUNG, EC_WORD_AND, EC_WORD_STRONG, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechWin = {EC_WORD_SEE, EC_WORD_QUES, EC_WORD_AREN_T, EC_WORD_I, EC_WORD_GOOD, EC_WORD_QUES}, .speechLose = {EC_WORD_THIS, EC_WORD_ISN_T, EC_WORD_WORKING, EC_WORD_OUT, EC_WORD_AT, EC_WORD_ALL}, .monSet = gBattleFrontierTrainerMons_Dorine @@ -1883,9 +1883,9 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_DAVIN] = { .facilityClass = FACILITY_CLASS_DRAGON_TAMER, .trainerName = _("DAVIN"), - .speechBefore = {EC_WORD_LET_S, EC_WORD_HEAR, EC_WORD_YOU, EC_MOVE2(ROAR), EC_WORD_EXCL, 0xFFFF}, - .speechWin = {EC_WORD_WROOOAAR_EXCL, 0xFFFF, 0xFFFF, EC_WORD_VICTORY, EC_WORD_EXCL_EXCL, 0xFFFF}, - .speechLose = {EC_WORD_WROOOAAR_EXCL, 0xFFFF, 0xFFFF, EC_WORD_WHY, EC_WORD_QUES_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_LET_S, EC_WORD_HEAR, EC_WORD_YOU, EC_MOVE2(ROAR), EC_WORD_EXCL, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_WROOOAAR_EXCL, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_WORD_VICTORY, EC_WORD_EXCL_EXCL, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_WROOOAAR_EXCL, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_WORD_WHY, EC_WORD_QUES_EXCL, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Davin }, [FRONTIER_TRAINER_TREVON] = { @@ -1915,7 +1915,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_RAUL] = { .facilityClass = FACILITY_CLASS_BLACK_BELT, .trainerName = _("RAUL"), - .speechBefore = {EC_WORD_I, EC_WORD_REJECT, EC_WORD_EVERY, EC_WORD_WEAK, EC_WORD_TRAINER, 0xFFFF}, + .speechBefore = {EC_WORD_I, EC_WORD_REJECT, EC_WORD_EVERY, EC_WORD_WEAK, EC_WORD_TRAINER, EC_EMPTY_WORD}, .speechWin = {EC_WORD_HUMPH, EC_WORD_EXCL, EC_WORD_ANOTHER, EC_WORD_WEAK, EC_WORD_TRAINER, EC_WORD_ELLIPSIS}, .speechLose = {EC_WORD_THERE, EC_WORD_IS, EC_WORD_NOTHING, EC_WORD_WEAK, EC_WORD_ABOUT, EC_WORD_YOU}, .monSet = gBattleFrontierTrainerMons_Raul @@ -1923,7 +1923,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_KAY] = { .facilityClass = FACILITY_CLASS_BATTLE_GIRL, .trainerName = _("KAY"), - .speechBefore = {EC_WORD_AND, EC_WORD_YET, EC_WORD_ANOTHER, EC_WORD_BATTLE, EC_WORD_QUES, 0xFFFF}, + .speechBefore = {EC_WORD_AND, EC_WORD_YET, EC_WORD_ANOTHER, EC_WORD_BATTLE, EC_WORD_QUES, EC_EMPTY_WORD}, .speechWin = {EC_WORD_I, EC_WORD_WON, EC_WORD_BUT, EC_WORD_I_AM, EC_WORD_TIRED, EC_WORD_ELLIPSIS}, .speechLose = {EC_WORD_GOOD, EC_WORD_IT_S, EC_WORD_OVER, EC_WORD_AT, EC_WORD_LAST, EC_WORD_ELLIPSIS}, .monSet = gBattleFrontierTrainerMons_Kay @@ -1940,7 +1940,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_BATTLE_GIRL, .trainerName = _("ALANA"), .speechBefore = {EC_WORD_EAT, EC_WORD_MY, EC_WORD_INVINCIBLE, EC_WORD_ATTACK, EC_WORD_YOU, EC_WORD_EXCL}, - .speechWin = {EC_WORD_YOU, EC_WORD_HAVE, EC_WORD_MUCH, EC_WORD_TO, EC_WORD_LEARN, 0xFFFF}, + .speechWin = {EC_WORD_YOU, EC_WORD_HAVE, EC_WORD_MUCH, EC_WORD_TO, EC_WORD_LEARN, EC_EMPTY_WORD}, .speechLose = {EC_WORD_SO, EC_WORD_MUCH, EC_WORD_FOR, EC_WORD_MY, EC_WORD_INVINCIBLE, EC_WORD_ATTACK}, .monSet = gBattleFrontierTrainerMons_Alana }, @@ -1948,7 +1948,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_EXPERT_M, .trainerName = _("ALEXAS"), .speechBefore = {EC_WORD_GOOD, EC_WORD_TO, EC_WORD_MEET_YOU, EC_WORD_YOUNG, EC_WORD_TRAINER, EC_WORD_EXCL}, - .speechWin = {EC_WORD_WAHAHAHA, EC_WORD_EXCL, 0xFFFF, EC_WORD_GIVE, EC_WORD_IT, EC_WORD_UP}, + .speechWin = {EC_WORD_WAHAHAHA, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_GIVE, EC_WORD_IT, EC_WORD_UP}, .speechLose = {EC_WORD_YOU, EC_WORD_ARE, EC_WORD_A, EC_WORD_STRONG, EC_WORD_TRAINER, EC_WORD_KID}, .monSet = gBattleFrontierTrainerMons_Alexas }, @@ -1964,7 +1964,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_EXPERT_M, .trainerName = _("JASPER"), .speechBefore = {EC_WORD_I_AM, EC_WORD_NOT, EC_WORD_OLD, EC_WORD_I_AM, EC_WORD_SKILLED, EC_WORD_EXCL}, - .speechWin = {EC_WORD_SKILLED, EC_WORD_THAT_S, EC_WORD_WHAT, EC_WORD_I_AM, EC_WORD_EXCL, 0xFFFF}, + .speechWin = {EC_WORD_SKILLED, EC_WORD_THAT_S, EC_WORD_WHAT, EC_WORD_I_AM, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I_AM, EC_WORD_SHOCKED, EC_WORD_EXCL, EC_WORD_DOWN, EC_WORD_I, EC_WORD_GO}, .monSet = gBattleFrontierTrainerMons_Jasper }, @@ -1972,14 +1972,14 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_EXPERT_F, .trainerName = _("NADIA"), .speechBefore = {EC_WORD_YOU, EC_WORD_CAN_T, EC_WORD_BEAT, EC_WORD_ME, EC_WORD_DOWN, EC_WORD_EXCL}, - .speechWin = {EC_WORD_HAH, EC_WORD_EXCL, 0xFFFF, EC_WORD_I, EC_WORD_BEAT, EC_WORD_YOU}, - .speechLose = {EC_WORD_I_AM, EC_MOVE2(BEAT_UP), EC_WORD_AND, EC_WORD_DOWNCAST, EC_WORD_ELLIPSIS, 0xFFFF}, + .speechWin = {EC_WORD_HAH, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_I, EC_WORD_BEAT, EC_WORD_YOU}, + .speechLose = {EC_WORD_I_AM, EC_MOVE2(BEAT_UP), EC_WORD_AND, EC_WORD_DOWNCAST, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Nadia }, [FRONTIER_TRAINER_MIRANDA] = { .facilityClass = FACILITY_CLASS_EXPERT_F, .trainerName = _("MIRANDA"), - .speechBefore = {EC_WORD_WELL, EC_WORD_WELL, 0xFFFF, EC_WORD_LET_S, EC_WORD_START, 0xFFFF}, + .speechBefore = {EC_WORD_WELL, EC_WORD_WELL, EC_EMPTY_WORD, EC_WORD_LET_S, EC_WORD_START, EC_EMPTY_WORD}, .speechWin = {EC_WORD_WHAT, EC_WORD_QUES, EC_WORD_DONE, EC_WORD_SO, EC_WORD_SOON, EC_WORD_QUES}, .speechLose = {EC_WORD_WELL, EC_WORD_I, EC_WORD_SEE, EC_WORD_THAT, EC_WORD_I_AM, EC_WORD_TOO_WEAK}, .monSet = gBattleFrontierTrainerMons_Miranda @@ -1987,8 +1987,8 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_EMMA] = { .facilityClass = FACILITY_CLASS_EXPERT_F, .trainerName = _("EMMA"), - .speechBefore = {EC_WORD_I_VE, EC_WORD_BEEN, EC_WORD_HEARING, EC_WORD_ABOUT, EC_WORD_YOU, 0xFFFF}, - .speechWin = {EC_WORD_I, EC_WORD_THINK, EC_WORD_I_VE, EC_WORD_MISHEARD, EC_WORD_THINGS, 0xFFFF}, + .speechBefore = {EC_WORD_I_VE, EC_WORD_BEEN, EC_WORD_HEARING, EC_WORD_ABOUT, EC_WORD_YOU, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_I, EC_WORD_THINK, EC_WORD_I_VE, EC_WORD_MISHEARD, EC_WORD_THINGS, EC_EMPTY_WORD}, .speechLose = {EC_WORD_WHAT, EC_WORD_I_VE, EC_WORD_BEEN, EC_WORD_HEARING, EC_WORD_IS, EC_WORD_RIGHT}, .monSet = gBattleFrontierTrainerMons_Emma }, @@ -2004,15 +2004,15 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_PSYCHIC_M, .trainerName = _("STANLY"), .speechBefore = {EC_WORD_THIS, EC_WORD_SHOULD, EC_WORD_BE, EC_WORD_AN, EC_WORD_EASY, EC_WORD_MATCH}, - .speechWin = {EC_WORD_IT, EC_WORD_REALLY, EC_WORD_WAS, EC_WORD_EASY, 0xFFFF, 0xFFFF}, - .speechLose = {EC_WORD_ARE, EC_WORD_YOU, EC_WORD_HAPPY, EC_WORD_NOW, EC_WORD_QUES, 0xFFFF}, + .speechWin = {EC_WORD_IT, EC_WORD_REALLY, EC_WORD_WAS, EC_WORD_EASY, EC_EMPTY_WORD, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_ARE, EC_WORD_YOU, EC_WORD_HAPPY, EC_WORD_NOW, EC_WORD_QUES, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Stanly }, [FRONTIER_TRAINER_DARIO] = { .facilityClass = FACILITY_CLASS_PSYCHIC_M, .trainerName = _("DARIO"), .speechBefore = {EC_WORD_MY, EC_MOVE2(FORESIGHT), EC_WORD_SAYS, EC_WORD_I, EC_WORD_WILL, EC_WORD_WIN}, - .speechWin = {EC_WORD_MY, EC_MOVE2(FORESIGHT), EC_WORD_HAS, EC_WORD_BEEN, EC_WORD_PERFECT, 0xFFFF}, + .speechWin = {EC_WORD_MY, EC_MOVE2(FORESIGHT), EC_WORD_HAS, EC_WORD_BEEN, EC_WORD_PERFECT, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I, EC_WORD_DIDN_T, EC_WORD_SEE, EC_WORD_THIS, EC_MOVE(REVERSAL), EC_WORD_ELLIPSIS}, .monSet = gBattleFrontierTrainerMons_Dario }, @@ -2020,7 +2020,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_PSYCHIC_F, .trainerName = _("KARLEE"), .speechBefore = {EC_WORD_SOMETHING, EC_WORD_GOOD, EC_WORD_WILL, EC_WORD_COME, EC_WORD_OF, EC_WORD_THIS}, - .speechWin = {EC_WORD_YOU, EC_WORD_SEE, EC_WORD_QUES, EC_WORD_FANTASTIC, EC_WORD_EXCL, 0xFFFF}, + .speechWin = {EC_WORD_YOU, EC_WORD_SEE, EC_WORD_QUES, EC_WORD_FANTASTIC, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechLose = {EC_WORD_THAT, EC_WORD_SOMETHING, EC_WORD_GOOD, EC_WORD_WENT, EC_WORD_TO, EC_WORD_YOU}, .monSet = gBattleFrontierTrainerMons_Karlee }, @@ -2043,7 +2043,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_DELILAH] = { .facilityClass = FACILITY_CLASS_HEX_MANIAC, .trainerName = _("DELILAH"), - .speechBefore = {EC_WORD_DON_T, EC_MOVE(GRUDGE), EC_WORD_ME, EC_WORD_IF_I_WIN, EC_WORD_OK_QUES, 0xFFFF}, + .speechBefore = {EC_WORD_DON_T, EC_MOVE(GRUDGE), EC_WORD_ME, EC_WORD_IF_I_WIN, EC_WORD_OK_QUES, EC_EMPTY_WORD}, .speechWin = {EC_WORD_I_AM, EC_WORD_SORRY, EC_WORD_TO, EC_WORD_SEE, EC_WORD_YOU, EC_WORD_ANGRY}, .speechLose = {EC_WORD_I, EC_WORD_HAVE, EC_WORD_A, EC_MOVE(GRUDGE), EC_WORD_WITH, EC_WORD_YOU}, .monSet = gBattleFrontierTrainerMons_Delilah @@ -2060,16 +2060,16 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_HEX_MANIAC, .trainerName = _("LEXIE"), .speechBefore = {EC_WORD_WANT, EC_WORD_TO, EC_WORD_SEE, EC_WORD_SCARY, EC_WORD_POKEMON, EC_WORD_QUES}, - .speechWin = {EC_WORD_WASN_T, EC_WORD_THAT, EC_WORD_SCARY, EC_WORD_EH_QUES, 0xFFFF, 0xFFFF}, + .speechWin = {EC_WORD_WASN_T, EC_WORD_THAT, EC_WORD_SCARY, EC_WORD_EH_QUES, EC_EMPTY_WORD, EC_EMPTY_WORD}, .speechLose = {EC_WORD_YOU_RE, EC_WORD_MORE, EC_WORD_SCARY, EC_WORD_THAN, EC_WORD_MY, EC_WORD_POKEMON}, .monSet = gBattleFrontierTrainerMons_Lexie }, [FRONTIER_TRAINER_MILLER] = { .facilityClass = FACILITY_CLASS_POKEMANIAC, .trainerName = _("MILLER"), - .speechBefore = {EC_WORD_HELLO, EC_WORD_QUES, 0xFFFF, EC_WORD_HELLO, EC_WORD_QUES_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_HELLO, EC_WORD_QUES, EC_EMPTY_WORD, EC_WORD_HELLO, EC_WORD_QUES_EXCL, EC_EMPTY_WORD}, .speechWin = {EC_WORD_HELLO, EC_WORD_MOTHER, EC_WORD_EXCL, EC_WORD_I, EC_WORD_WON, EC_WORD_EXCL}, - .speechLose = {EC_WORD_MY, EC_WORD_PHONE, EC_WORD_ISN_T, EC_WORD_WORKING, EC_WORD_ELLIPSIS, 0xFFFF}, + .speechLose = {EC_WORD_MY, EC_WORD_PHONE, EC_WORD_ISN_T, EC_WORD_WORKING, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Miller }, [FRONTIER_TRAINER_MARV] = { @@ -2099,7 +2099,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_GREGORY] = { .facilityClass = FACILITY_CLASS_GENTLEMAN, .trainerName = _("GREGORY"), - .speechBefore = {EC_WORD_I_AM, EC_WORD_NOT, EC_WORD_THAT, EC_WORD_OLD, EC_WORD_YET, 0xFFFF}, + .speechBefore = {EC_WORD_I_AM, EC_WORD_NOT, EC_WORD_THAT, EC_WORD_OLD, EC_WORD_YET, EC_EMPTY_WORD}, .speechWin = {EC_WORD_WHO, EC_WORD_SAYS, EC_WORD_I_AM, EC_WORD_TOO, EC_WORD_OLD, EC_WORD_QUES}, .speechLose = {EC_WORD_PLEASE, EC_WORD_I_AM, EC_WORD_REALLY, EC_WORD_NOT, EC_WORD_THAT, EC_WORD_OLD}, .monSet = gBattleFrontierTrainerMons_Gregory @@ -2107,23 +2107,23 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_REESE] = { .facilityClass = FACILITY_CLASS_GENTLEMAN, .trainerName = _("REESE"), - .speechBefore = {EC_WORD_I_VE, EC_WORD_A, EC_WORD_COUPLE, EC_WORD_THINGS, 0xFFFF, 0xFFFF}, - .speechWin = {EC_WORD_DON_T, EC_WORD_DIET, EC_WORD_PLAY, EC_WORD_SPORTS, EC_WORD_INSTEAD, 0xFFFF}, + .speechBefore = {EC_WORD_I_VE, EC_WORD_A, EC_WORD_COUPLE, EC_WORD_THINGS, EC_EMPTY_WORD, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_DON_T, EC_WORD_DIET, EC_WORD_PLAY, EC_WORD_SPORTS, EC_WORD_INSTEAD, EC_EMPTY_WORD}, .speechLose = {EC_WORD_INSTEAD, EC_WORD_OF, EC_WORD_TELEVISION, EC_WORD_GET, EC_WORD_A, EC_WORD_BOOK}, .monSet = gBattleFrontierTrainerMons_Reese }, [FRONTIER_TRAINER_MASON] = { .facilityClass = FACILITY_CLASS_RUNNING_TRIATHLETE_M, .trainerName = _("MASON"), - .speechBefore = {EC_WORD_PLEASE, EC_WORD_DON_T, EC_WORD_MAKE, EC_WORD_THIS, EC_WORD_SCARY, 0xFFFF}, - .speechWin = {EC_WORD_THANK_YOU, EC_WORD_ELLIPSIS, 0xFFFF, EC_WORD_I_AM, EC_WORD_HAPPY, EC_WORD_NOW}, - .speechLose = {EC_WORD_I_AM, EC_WORD_DISAPPOINTED, EC_WORD_ELLIPSIS, 0xFFFF, 0xFFFF, 0xFFFF}, + .speechBefore = {EC_WORD_PLEASE, EC_WORD_DON_T, EC_WORD_MAKE, EC_WORD_THIS, EC_WORD_SCARY, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_THANK_YOU, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_WORD_I_AM, EC_WORD_HAPPY, EC_WORD_NOW}, + .speechLose = {EC_WORD_I_AM, EC_WORD_DISAPPOINTED, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Mason }, [FRONTIER_TRAINER_TOBY] = { .facilityClass = FACILITY_CLASS_RUNNING_TRIATHLETE_M, .trainerName = _("TOBY"), - .speechBefore = {EC_WORD_LISTEN, EC_WORD_UP, 0xFFFF, EC_WORD_I, EC_WORD_ALWAYS, EC_WORD_WIN}, + .speechBefore = {EC_WORD_LISTEN, EC_WORD_UP, EC_EMPTY_WORD, EC_WORD_I, EC_WORD_ALWAYS, EC_WORD_WIN}, .speechWin = {EC_WORD_I_AM, EC_WORD_A, EC_WORD_GENIUS, EC_WORD_OR, EC_WORD_WHAT, EC_WORD_QUES}, .speechLose = {EC_WORD_I, EC_WORD_CAN, EC_WORD_BEAT, EC_WORD_YOU, EC_WORD_AT, EC_WORD_SMARTNESS}, .monSet = gBattleFrontierTrainerMons_Toby @@ -2141,14 +2141,14 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("PIPER"), .speechBefore = {EC_WORD_COME_ON, EC_WORD_YOU, EC_WORD_NEED, EC_WORD_A, EC_WORD_SPEED_BOOST, EC_WORD_QUES}, .speechWin = {EC_WORD_YOU, EC_WORD_NEED, EC_WORD_TO, EC_WORD_SHOW, EC_WORD_MORE, EC_WORD_GUTS}, - .speechLose = {EC_WORD_OH, EC_WORD_YOU, EC_WORD_EXCL, 0xFFFF, 0xFFFF, 0xFFFF}, + .speechLose = {EC_WORD_OH, EC_WORD_YOU, EC_WORD_EXCL, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Piper }, [FRONTIER_TRAINER_FINN] = { .facilityClass = FACILITY_CLASS_SWIMMING_TRIATHLETE_M, .trainerName = _("FINN"), - .speechBefore = {EC_WORD_NOT, EC_WORD_ANOTHER, EC_WORD_TRAINER, EC_WORD_BATTLE, EC_WORD_ELLIPSIS, 0xFFFF}, - .speechWin = {EC_WORD_WON_T, EC_WORD_THIS, EC_WORD_EVER, EC_WORD_END, EC_WORD_QUES, 0xFFFF}, + .speechBefore = {EC_WORD_NOT, EC_WORD_ANOTHER, EC_WORD_TRAINER, EC_WORD_BATTLE, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_WON_T, EC_WORD_THIS, EC_WORD_EVER, EC_WORD_END, EC_WORD_QUES, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I, EC_WORD_FINALLY, EC_WORD_GET, EC_WORD_TO, EC_MOVE2(REST), EC_WORD_A_LITTLE}, .monSet = gBattleFrontierTrainerMons_Finn }, @@ -2157,7 +2157,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("SAMIR"), .speechBefore = {EC_WORD_I, EC_MOVE2(DIVE), EC_WORD_BELOW, EC_WORD_THE, EC_MOVE2(SURF), EC_WORD_EXCL}, .speechWin = {EC_WORD_YAHOO, EC_WORD_TAKE, EC_WORD_A, EC_MOVE2(DIVE), EC_WORD_YOU, EC_WORD_EXCL}, - .speechLose = {EC_WORD_I_AM, EC_WORD_GOING, EC_WORD_TO, EC_WORD_SINK, EC_WORD_ELLIPSIS, 0xFFFF}, + .speechLose = {EC_WORD_I_AM, EC_WORD_GOING, EC_WORD_TO, EC_WORD_SINK, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Samir }, [FRONTIER_TRAINER_FIONA] = { @@ -2179,7 +2179,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_NICO] = { .facilityClass = FACILITY_CLASS_CYCLING_TRIATHLETE_M, .trainerName = _("NICO"), - .speechBefore = {EC_WORD_LIKE, EC_WORD_A, EC_MOVE(SONIC_BOOM), EC_WORD_I_VE_ARRIVED, 0xFFFF, 0xFFFF}, + .speechBefore = {EC_WORD_LIKE, EC_WORD_A, EC_MOVE(SONIC_BOOM), EC_WORD_I_VE_ARRIVED, EC_EMPTY_WORD, EC_EMPTY_WORD}, .speechWin = {EC_WORD_SORRY, EC_WORD_TO, EC_WORD_MAKE, EC_WORD_YOU, EC_WORD_SO, EC_WORD_DOWNCAST}, .speechLose = {EC_WORD_I_AM, EC_WORD_GOING, EC_WORD_WITH, EC_WORD_A, EC_MOVE2(SUPERSONIC), EC_WORD_SPEED_BOOST}, .monSet = gBattleFrontierTrainerMons_Nico @@ -2220,7 +2220,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_BUG_MANIAC, .trainerName = _("LIAM"), .speechBefore = {EC_WORD_WE, EC_WORD_REALLY, EC_WORD_DISLIKE, EC_WORD_FIRE, EC_WORD_AND, EC_WORD_FLYING}, - .speechWin = {EC_WORD_BUG, EC_WORD_POKEMON, EC_WORD_AREN_T, EC_WORD_BAD, EC_WORD_HEY_QUES, 0xFFFF}, + .speechWin = {EC_WORD_BUG, EC_WORD_POKEMON, EC_WORD_AREN_T, EC_WORD_BAD, EC_WORD_HEY_QUES, EC_EMPTY_WORD}, .speechLose = {EC_WORD_YOU, EC_WORD_KNOW, EC_WORD_WHAT, EC_WORD_WE, EC_WORD_DISLIKE, EC_WORD_HEY_QUES}, .monSet = gBattleFrontierTrainerMons_Liam }, @@ -2269,14 +2269,14 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .trainerName = _("TRISTON"), .speechBefore = {EC_WORD_I, EC_WORD_WOULD, EC_WORD_RATHER, EC_WORD_LOOK, EC_WORD_AT, EC_WORD_POKEMON}, .speechWin = {EC_WORD_HUH_QUES, EC_WORD_YOU, EC_WORD_MEAN, EC_WORD_I, EC_WORD_WON, EC_WORD_QUES_EXCL}, - .speechLose = {EC_WORD_SEE, EC_WORD_QUES, 0xFFFF, EC_WORD_I, EC_WORD_ALWAYS, EC_WORD_LOSE}, + .speechLose = {EC_WORD_SEE, EC_WORD_QUES, EC_EMPTY_WORD, EC_WORD_I, EC_WORD_ALWAYS, EC_WORD_LOSE}, .monSet = gBattleFrontierTrainerMons_Triston }, [FRONTIER_TRAINER_CHARLES] = { .facilityClass = FACILITY_CLASS_GUITARIST, .trainerName = _("CHARLES"), .speechBefore = {EC_WORD_IT_S, EC_WORD_HOPELESS, EC_WORD_TO, EC_MOVE2(STRUGGLE), EC_WORD_WITH, EC_WORD_ME}, - .speechWin = {EC_MOVE(SUBMISSION), EC_WORD_WAS, EC_WORD_YOUR, EC_WORD_ONLY, EC_WORD_CHOICE, 0xFFFF}, + .speechWin = {EC_MOVE(SUBMISSION), EC_WORD_WAS, EC_WORD_YOUR, EC_WORD_ONLY, EC_WORD_CHOICE, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I_AM, EC_WORD_GOING, EC_WORD_DOWN, EC_WORD_DOWN, EC_WORD_DOWN, EC_WORD_EXCL}, .monSet = gBattleFrontierTrainerMons_Charles }, @@ -2284,7 +2284,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_GUITARIST, .trainerName = _("RAYMOND"), .speechBefore = {EC_WORD_WANT, EC_WORD_TO, EC_WORD_HEAR, EC_WORD_MY, EC_WORD_SONG, EC_WORD_QUES}, - .speechWin = {EC_WORD_SATISFIED, EC_WORD_THAT_S, EC_WORD_WHAT, EC_WORD_I_AM, EC_WORD_EXCL, 0xFFFF}, + .speechWin = {EC_WORD_SATISFIED, EC_WORD_THAT_S, EC_WORD_WHAT, EC_WORD_I_AM, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechLose = {EC_WORD_SATISFIED, EC_WORD_IS, EC_WORD_WHAT, EC_WORD_I, EC_WORD_CAN_T, EC_WORD_BE}, .monSet = gBattleFrontierTrainerMons_Raymond }, @@ -2348,7 +2348,7 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_KINDLER, .trainerName = _("FERRIS"), .speechBefore = {EC_WORD_I_AM, EC_WORD_NO_1, EC_WORD_IN, EC_WORD_THE, EC_WORD_OLD, EC_WORD_CLASS}, - .speechWin = {EC_WORD_NO_1, EC_WORD_THAT_S, EC_WORD_WHAT, EC_WORD_I_AM, EC_WORD_EXCL, 0xFFFF}, + .speechWin = {EC_WORD_NO_1, EC_WORD_THAT_S, EC_WORD_WHAT, EC_WORD_I_AM, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I_AM, EC_WORD_NOT, EC_WORD_NO_1, EC_WORD_ANY, EC_WORD_MORE, EC_WORD_ELLIPSIS}, .monSet = gBattleFrontierTrainerMons_Ferris }, @@ -2363,24 +2363,24 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU [FRONTIER_TRAINER_PAIGE] = { .facilityClass = FACILITY_CLASS_PARASOL_LADY, .trainerName = _("PAIGE"), - .speechBefore = {EC_WORD_LET_S, EC_WORD_ENJOY, EC_WORD_OUR, EC_WORD_BATTLE, EC_WORD_TOGETHER, 0xFFFF}, - .speechWin = {EC_WORD_THAT_S_IT_EXCL, 0xFFFF, 0xFFFF, EC_WORD_THANK_YOU, EC_WORD_VERY, EC_WORD_MUCH}, - .speechLose = {EC_WORD_THAT_S_IT_EXCL, 0xFFFF, 0xFFFF, EC_WORD_DO, EC_WORD_GO, EC_WORD_ON}, + .speechBefore = {EC_WORD_LET_S, EC_WORD_ENJOY, EC_WORD_OUR, EC_WORD_BATTLE, EC_WORD_TOGETHER, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_THAT_S_IT_EXCL, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_WORD_THANK_YOU, EC_WORD_VERY, EC_WORD_MUCH}, + .speechLose = {EC_WORD_THAT_S_IT_EXCL, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_WORD_DO, EC_WORD_GO, EC_WORD_ON}, .monSet = gBattleFrontierTrainerMons_Paige }, [FRONTIER_TRAINER_ANYA] = { .facilityClass = FACILITY_CLASS_BEAUTY, .trainerName = _("ANYA"), .speechBefore = {EC_WORD_I, EC_WORD_DISLIKE, EC_WORD_OH, EC_WORD_SO, EC_WORD_PRETTY, EC_WORD_FASHION}, - .speechWin = {EC_WORD_FASHION, EC_WORD_SHOULD, EC_WORD_MATCH, EC_WORD_THE, EC_WORD_PERSON, 0xFFFF}, - .speechLose = {EC_WORD_PRETTY, EC_WORD_COULD, EC_WORD_BE, EC_WORD_GOOD, 0xFFFF, 0xFFFF}, + .speechWin = {EC_WORD_FASHION, EC_WORD_SHOULD, EC_WORD_MATCH, EC_WORD_THE, EC_WORD_PERSON, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_PRETTY, EC_WORD_COULD, EC_WORD_BE, EC_WORD_GOOD, EC_EMPTY_WORD, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Anya }, [FRONTIER_TRAINER_DAWN] = { .facilityClass = FACILITY_CLASS_BEAUTY, .trainerName = _("DAWN"), - .speechBefore = {EC_WORD_I, EC_WORD_GO, EC_WORD_ALL, EC_WORD_OUT, EC_WORD_EXCL, 0xFFFF}, - .speechWin = {EC_WORD_DON_T, EC_WORD_BE, EC_WORD_A, EC_WORD_BABY, EC_WORD_EXCL, 0xFFFF}, + .speechBefore = {EC_WORD_I, EC_WORD_GO, EC_WORD_ALL, EC_WORD_OUT, EC_WORD_EXCL, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_DON_T, EC_WORD_BE, EC_WORD_A, EC_WORD_BABY, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechLose = {EC_WORD_YOU, EC_WORD_WON, EC_WORD_EXCL, EC_WORD_MOVE, EC_WORD_ON, EC_WORD_EXCL}, .monSet = gBattleFrontierTrainerMons_Dawn }, @@ -2388,8 +2388,8 @@ const struct BattleFrontierTrainer gBattleFrontierTrainers[FRONTIER_TRAINERS_COU .facilityClass = FACILITY_CLASS_AROMA_LADY, .trainerName = _("ABBY"), .speechBefore = {EC_WORD_I, EC_WORD_LIKE, EC_WORD_A, EC_WORD_TRAINER, EC_WORD_THAT_S, EC_WORD_REFRESHING}, - .speechWin = {EC_WORD_VICTORY, EC_WORD_HAS, EC_WORD_A, EC_MOVE(SWEET_SCENT), EC_WORD_EXCL, 0xFFFF}, - .speechLose = {EC_WORD_WHAT, EC_WORD_AN, EC_WORD_AWFUL, EC_WORD_STENCH, EC_WORD_EXCL, 0xFFFF}, + .speechWin = {EC_WORD_VICTORY, EC_WORD_HAS, EC_WORD_A, EC_MOVE(SWEET_SCENT), EC_WORD_EXCL, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_WHAT, EC_WORD_AN, EC_WORD_AWFUL, EC_WORD_STENCH, EC_WORD_EXCL, EC_EMPTY_WORD}, .monSet = gBattleFrontierTrainerMons_Abby }, [FRONTIER_TRAINER_GRETEL] = { diff --git a/src/data/battle_frontier/battle_tent.h b/src/data/battle_frontier/battle_tent.h index 1615d9562..bce7979c8 100644 --- a/src/data/battle_frontier/battle_tent.h +++ b/src/data/battle_frontier/battle_tent.h @@ -616,9 +616,9 @@ const struct BattleFrontierTrainer gSlateportBattleTentTrainers[NUM_BATTLE_TENT_ [SLATEPORT_TENT_TRAINER_MAGGIE] = { .facilityClass = FACILITY_CLASS_SCHOOL_KID_F, .trainerName = _("MAGGIE"), - .speechBefore = {EC_POKEMON(VULPIX), EC_POKEMON(XATU), EC_POKEMON2(UMBREON), EC_WORD_ELLIPSIS, EC_WORD_UM, EC_WORD_ELLIPSIS}, + .speechBefore = {EC_POKEMON(VULPIX), EC_POKEMON(XATU), EC_POKEMON_NATIONAL(UMBREON), EC_WORD_ELLIPSIS, EC_WORD_UM, EC_WORD_ELLIPSIS}, .speechWin = {EC_POKEMON(NOSEPASS), EC_WORD_ELLIPSIS, EC_WORD_UM, EC_POKEMON(SEVIPER), EC_WORD_EXCL, -1}, - .speechLose = {EC_POKEMON(NOSEPASS), EC_WORD_ELLIPSIS, EC_WORD_UM, EC_POKEMON2(SNORLAX), EC_WORD_ELLIPSIS, EC_WORD_UH_OH}, + .speechLose = {EC_POKEMON(NOSEPASS), EC_WORD_ELLIPSIS, EC_WORD_UM, EC_POKEMON_NATIONAL(SNORLAX), EC_WORD_ELLIPSIS, EC_WORD_UH_OH}, .monSet = gSlateportBattleTentTrainerMons_Maggie }, [SLATEPORT_TENT_TRAINER_STEPHON] = { diff --git a/src/data/battle_frontier/trainer_hill.h b/src/data/battle_frontier/trainer_hill.h index f090385b0..59cfabd64 100644 --- a/src/data/battle_frontier/trainer_hill.h +++ b/src/data/battle_frontier/trainer_hill.h @@ -314,7 +314,7 @@ static const struct TrHillFloor sDataTagJPDefault_Floors[] = { .speechBefore = { EC_WORD_SISTER, EC_WORD_ALTHOUGH, EC_WORD_KIND, EC_WORD_MATCH, EC_WORD_PLEASE, EC_WORD_WITHOUT }, .speechWin = { EC_WORD_KIND, EC_WORD_ELLIPSIS, EC_WORD_INSTEAD, EC_WORD_DEEP, EC_WORD_WEAK, EC_WORD_QUES }, .speechLose = { EC_WORD_AWFUL, EC_WORD_GWAH, EC_WORD_HOPELESS, EC_WORD_CAN_T_WIN, EC_WORD_IS, EC_WORD_NONE }, - .speechAfter = { EC_WORD_AWW, 0xFFFF, 0xFFFF, EC_WORD_ALMOST, EC_WORD_GOOD, EC_WORD_ANYWHERE }, + .speechAfter = { EC_WORD_AWW, EC_EMPTY_WORD, EC_EMPTY_WORD, EC_WORD_ALMOST, EC_WORD_GOOD, EC_WORD_ANYWHERE }, .mons = { [0] = NULL_BATTLE_TOWER_POKEMON, [1] = NULL_BATTLE_TOWER_POKEMON, @@ -444,7 +444,7 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .unused = 0, .speechBefore = {EC_WORD_YOU, EC_WORD_CAN, EC_WORD_CHOOSE, EC_WORD_NOT, EC_WORD_TO, EC_WORD_BELIEVE}, .speechWin = {EC_WORD_A, EC_WORD_SUPER, EC_WORD_NATURAL, EC_WORD_POWER, EC_WORD_HAS, EC_WORD_COME}, - .speechLose = {EC_WORD_THIS, EC_WORD_MUST_BE, EC_WORD_A, EC_MOVE(NIGHTMARE), EC_WORD_EXCL, 0xFFFF}, + .speechLose = {EC_WORD_THIS, EC_WORD_MUST_BE, EC_WORD_A, EC_MOVE(NIGHTMARE), EC_WORD_EXCL, EC_EMPTY_WORD}, .speechAfter = {EC_WORD_I, EC_WORD_WILL, EC_WORD_DISAPPEAR, EC_WORD_IN, EC_WORD_THE, EC_WORD_DARK}, .mons = { @@ -589,7 +589,7 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .name = _("ALFONSO"), .facilityClass = FACILITY_CLASS_CYCLING_TRIATHLETE_M, .unused = 0, - .speechBefore = {EC_WORD_I, EC_WORD_NEVER, EC_WORD_TAKE, EC_WORD_A, EC_WORD_TRAIN, 0xFFFF}, + .speechBefore = {EC_WORD_I, EC_WORD_NEVER, EC_WORD_TAKE, EC_WORD_A, EC_WORD_TRAIN, EC_EMPTY_WORD}, .speechWin = {EC_WORD_I_AM, EC_WORD_FEELING, EC_MOVE2(SUPERSONIC), EC_WORD_ON, EC_WORD_MY, EC_WORD_BIKE}, .speechLose = {EC_WORD_MY, EC_WORD_BIKE, EC_WORD_EXCL, EC_WORD_YOU_VE, EC_WORD_DESTROYED, EC_WORD_IT}, .speechAfter = {EC_WORD_A, EC_WORD_BIKE, EC_WORD_OVER, EC_WORD_ANY, EC_WORD_TRAIN, EC_WORD_EXCL}, @@ -907,8 +907,8 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .facilityClass = FACILITY_CLASS_PKMN_BREEDER_F, .unused = 0, .speechBefore = {EC_WORD_SOME, EC_WORD_THINGS, EC_WORD_YOU, EC_WORD_CAN_T, EC_WORD_DO, EC_WORD_ALONE}, - .speechWin = {EC_WORD_YOU, EC_WORD_WIN, EC_WORD_AS, EC_WORD_A, EC_WORD_GROUP, 0xFFFF}, - .speechLose = {EC_WORD_WE, EC_WORD_COULDN_T, EC_WORD_WIN, EC_WORD_TOGETHER, EC_WORD_QUES, 0xFFFF}, + .speechWin = {EC_WORD_YOU, EC_WORD_WIN, EC_WORD_AS, EC_WORD_A, EC_WORD_GROUP, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_WE, EC_WORD_COULDN_T, EC_WORD_WIN, EC_WORD_TOGETHER, EC_WORD_QUES, EC_EMPTY_WORD}, .speechAfter = {EC_WORD_MAYBE, EC_WORD_I, EC_WORD_NEED, EC_WORD_A, EC_WORD_BOY, EC_WORD_FRIEND}, .mons = { @@ -1086,7 +1086,7 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .speechBefore = {EC_WORD_LET_S, EC_MOVE2(WRAP), EC_WORD_THINGS, EC_WORD_UP, EC_WORD_HERE, EC_WORD_HEY_QUES}, .speechWin = {EC_WORD_WOULD, EC_WORD_YOU, EC_WORD_LIKE, EC_WORD_TO, EC_WORD_GO_HOME, EC_WORD_QUES}, .speechLose = {EC_WORD_I, EC_WORD_WILL, EC_WORD_MAKE, EC_WORD_YOU, EC_WORD_SORRY, EC_WORD_FRIEND}, - .speechAfter = {EC_WORD_HAVEN_T, EC_WORD_YOU, EC_WORD_DONE, EC_WORD_ENOUGH, EC_WORD_QUES, 0xFFFF}, + .speechAfter = {EC_WORD_HAVEN_T, EC_WORD_YOU, EC_WORD_DONE, EC_WORD_ENOUGH, EC_WORD_QUES, EC_EMPTY_WORD}, .mons = { [0] = @@ -1229,7 +1229,7 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .facilityClass = FACILITY_CLASS_PKMN_BREEDER_F, .unused = 0, .speechBefore = {EC_WORD_I_AM, EC_WORD_THE, EC_WORD_STRONG, EC_WORD_BEAUTY, EC_WORD_AROUND, EC_WORD_HERE}, - .speechWin = {EC_WORD_I_AM, EC_WORD_STRONG, EC_WORD_THAT_S, EC_WORD_WHY, EC_WORD_EXCL, 0xFFFF}, + .speechWin = {EC_WORD_I_AM, EC_WORD_STRONG, EC_WORD_THAT_S, EC_WORD_WHY, EC_WORD_EXCL, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I_AM, EC_WORD_TIRED, EC_WORD_TODAY, EC_WORD_THAT_S, EC_WORD_WHY, EC_WORD_EXCL}, .speechAfter = {EC_WORD_WHY, EC_WORD_YES, EC_WORD_I_AM, EC_WORD_ANGRY, EC_WORD_THANK_YOU, EC_WORD_EXCL}, .mons = @@ -1404,8 +1404,8 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .name = _("KEENAN"), .facilityClass = FACILITY_CLASS_PSYCHIC_M, .unused = 0, - .speechBefore = {EC_WORD_YOU, EC_WORD_LOOK, EC_WORD_SO, EC_WORD_HURRIED, 0xFFFF, 0xFFFF}, - .speechWin = {EC_WORD_TOO, EC_WORD_BAD, 0xFFFF, EC_WORD_TIME, EC_WORD_IS, EC_WORD_UP}, + .speechBefore = {EC_WORD_YOU, EC_WORD_LOOK, EC_WORD_SO, EC_WORD_HURRIED, EC_EMPTY_WORD, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_TOO, EC_WORD_BAD, EC_EMPTY_WORD, EC_WORD_TIME, EC_WORD_IS, EC_WORD_UP}, .speechLose = {EC_WORD_DOES, EC_WORD_THE, EC_WORD_TIME, EC_WORD_WORRY, EC_WORD_YOU, EC_WORD_QUES}, .speechAfter = {EC_WORD_YOU, EC_WORD_DON_T, EC_WORD_HAVE, EC_WORD_TIME, EC_WORD_TO, EC_WORD_CHAT}, .mons = @@ -1547,7 +1547,7 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .unused = 0, .speechBefore = {EC_WORD_IT_S, EC_WORD_HOT, EC_WORD_ELLIPSIS, EC_WORD_WHAT, EC_WORD_A, EC_WORD_STENCH}, .speechWin = {EC_WORD_I, EC_WORD_REALLY, EC_WORD_LIKE, EC_WORD_AN, EC_WORD_OFFENSIVE, EC_WORD_STENCH}, - .speechLose = {EC_WORD_I, EC_MOVE2(COVET), EC_WORD_ANY, EC_WORD_STRONG, EC_WORD_STENCH, 0xFFFF}, + .speechLose = {EC_WORD_I, EC_MOVE2(COVET), EC_WORD_ANY, EC_WORD_STRONG, EC_WORD_STENCH, EC_EMPTY_WORD}, .speechAfter = {EC_WORD_MY, EC_WORD_SENSE, EC_WORD_OF, EC_WORD_SMELL, EC_WORD_ISN_T, EC_WORD_NORMAL}, .mons = { @@ -1731,8 +1731,8 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .unused = 0, .speechBefore = {EC_WORD_GOOD, EC_WORD_CHILDREN, EC_WORD_WILL, EC_WORD_GET, EC_WORD_A, EC_MOVE2(PRESENT)}, .speechWin = {EC_WORD_THANK_YOU, EC_WORD_MY, EC_WORD_VICTORY, EC_WORD_IS, EC_WORD_YOUR, EC_MOVE2(PRESENT)}, - .speechLose = {EC_WORD_THAT_WAS, EC_WORD_MY, EC_MOVE2(PRESENT), EC_WORD_TO, EC_WORD_YOU, 0xFFFF}, - .speechAfter = {EC_WORD_WELL_THEN, EC_WORD_CONGRATS, EC_WORD_MY, EC_WORD_FRIEND, 0xFFFF, 0xFFFF}, + .speechLose = {EC_WORD_THAT_WAS, EC_WORD_MY, EC_MOVE2(PRESENT), EC_WORD_TO, EC_WORD_YOU, EC_EMPTY_WORD}, + .speechAfter = {EC_WORD_WELL_THEN, EC_WORD_CONGRATS, EC_WORD_MY, EC_WORD_FRIEND, EC_EMPTY_WORD, EC_EMPTY_WORD}, .mons = { [0] = @@ -1870,7 +1870,7 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .unused = 0, .speechBefore = {EC_WORD_CAN, EC_WORD_YOU, EC_WORD_SENSE, EC_WORD_ME, EC_MOVE(FOCUS_ENERGY), EC_WORD_QUES}, .speechWin = {EC_WORD_THAT_S, EC_WORD_ABOUT, EC_WORD_RIGHT, EC_WORD_I, EC_WORD_WOULD, EC_WORD_THINK}, - .speechLose = {EC_WORD_THINGS, EC_WORD_DON_T, EC_WORD_ALWAYS, EC_WORD_WORK, EC_WORD_OUT, 0xFFFF}, + .speechLose = {EC_WORD_THINGS, EC_WORD_DON_T, EC_WORD_ALWAYS, EC_WORD_WORK, EC_WORD_OUT, EC_EMPTY_WORD}, .speechAfter = {EC_WORD_I_AM, EC_WORD_FEELING, EC_WORD_LONESOME, EC_WORD_AND, EC_WORD_SAD, EC_WORD_NOW}, .mons = { @@ -2040,7 +2040,7 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .facilityClass = FACILITY_CLASS_PARASOL_LADY, .unused = 0, .speechBefore = {EC_WORD_HI, EC_WORD_ARE, EC_WORD_YOU, EC_WORD_FEELING, EC_WORD_UPBEAT, EC_WORD_QUES}, - .speechWin = {EC_WORD_AREN_T, EC_WORD_YOU, EC_WORD_FEELING, EC_WORD_WELL, EC_WORD_QUES, 0xFFFF}, + .speechWin = {EC_WORD_AREN_T, EC_WORD_YOU, EC_WORD_FEELING, EC_WORD_WELL, EC_WORD_QUES, EC_EMPTY_WORD}, .speechLose = {EC_WORD_I, EC_WORD_CAN, EC_WORD_SEE, EC_WORD_YOU_RE, EC_WORD_FEELING, EC_WORD_GREAT}, .speechAfter = {EC_WORD_YOUR, EC_WORD_POKEMON, EC_WORD_LOOK, EC_WORD_READY, EC_WORD_TO, EC_WORD_HUSTLE}, .mons = @@ -2380,8 +2380,8 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .facilityClass = FACILITY_CLASS_RICH_BOY, .unused = 0, .speechBefore = {EC_WORD_GET, EC_WORD_READY, EC_WORD_FOR, EC_WORD_AN, EC_WORD_AWESOME, EC_WORD_TIME}, - .speechWin = {EC_WORD_HEY, EC_WORD_HEY, EC_WORD_EXCL, EC_WORD_WHAT_S_UP_QUES, 0xFFFF, 0xFFFF}, - .speechLose = {EC_WORD_AWW, EC_WORD_COULDN_T, EC_WORD_YOU, EC_WORD_LET_ME_WIN, EC_WORD_QUES, 0xFFFF}, + .speechWin = {EC_WORD_HEY, EC_WORD_HEY, EC_WORD_EXCL, EC_WORD_WHAT_S_UP_QUES, EC_EMPTY_WORD, EC_EMPTY_WORD}, + .speechLose = {EC_WORD_AWW, EC_WORD_COULDN_T, EC_WORD_YOU, EC_WORD_LET_ME_WIN, EC_WORD_QUES, EC_EMPTY_WORD}, .speechAfter = {EC_WORD_DID, EC_WORD_YOU, EC_WORD_SEE, EC_WORD_MY, EC_WORD_SKILL, EC_WORD_QUES}, .mons = { @@ -2840,10 +2840,10 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .name = _("FRANCISCO"), .facilityClass = FACILITY_CLASS_POKEFAN_M, .unused = 0, - .speechBefore = {EC_WORD_I, EC_WORD_STUDY, EC_WORD_EVERY, EC_WORD_DAY, EC_WORD_TOO, 0xFFFF}, - .speechWin = {EC_WORD_SO, EC_WORD_THAT_S, EC_WORD_HOW, EC_WORD_YOU, EC_WORD_LOSE, 0xFFFF}, + .speechBefore = {EC_WORD_I, EC_WORD_STUDY, EC_WORD_EVERY, EC_WORD_DAY, EC_WORD_TOO, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_SO, EC_WORD_THAT_S, EC_WORD_HOW, EC_WORD_YOU, EC_WORD_LOSE, EC_EMPTY_WORD}, .speechLose = {EC_WORD_NO, EC_WORD_WONDER, EC_WORD_I, EC_WORD_COULDN_T, EC_WORD_BEAT, EC_WORD_YOU}, - .speechAfter = {EC_WORD_YES, EC_WORD_ELLIPSIS, 0xFFFF, EC_WORD_THANK_YOU, 0xFFFF, 0xFFFF}, + .speechAfter = {EC_WORD_YES, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_WORD_THANK_YOU, EC_EMPTY_WORD, EC_EMPTY_WORD}, .mons = { [0] = @@ -3023,10 +3023,10 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .name = _("MEREDITH"), .facilityClass = FACILITY_CLASS_PKMN_RANGER_F, .unused = 0, - .speechBefore = {EC_WORD_UM, EC_WORD_ELLIPSIS, 0xFFFF, EC_WORD_I, EC_WORD_ELLIPSIS, 0xFFFF}, - .speechWin = {EC_WORD_OH, EC_WORD_EXCL, 0xFFFF, EC_WORD_UM, EC_WORD_ELLIPSIS, EC_WORD_YAY}, - .speechLose = {EC_WORD_UM, EC_WORD_ELLIPSIS, 0xFFFF, EC_WORD_WAAAH, EC_WORD_ELLIPSIS, 0xFFFF}, - .speechAfter = {EC_WORD_UM, EC_WORD_ELLIPSIS, 0xFFFF, EC_WORD_I_AM, EC_WORD_SAD, EC_WORD_ELLIPSIS}, + .speechBefore = {EC_WORD_UM, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_WORD_I, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, + .speechWin = {EC_WORD_OH, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_UM, EC_WORD_ELLIPSIS, EC_WORD_YAY}, + .speechLose = {EC_WORD_UM, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_WORD_WAAAH, EC_WORD_ELLIPSIS, EC_EMPTY_WORD}, + .speechAfter = {EC_WORD_UM, EC_WORD_ELLIPSIS, EC_EMPTY_WORD, EC_WORD_I_AM, EC_WORD_SAD, EC_WORD_ELLIPSIS}, .mons = { [0] = @@ -4948,8 +4948,8 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .unused = 0, .speechBefore = {EC_WORD_OH_DEAR, EC_WORD_THIS, EC_WORD_MATCH, EC_WORD_IS, EC_WORD_FOR, EC_WORD_YOU}, .speechWin = {EC_WORD_OH_DEAR, EC_WORD_DID, EC_WORD_YOU, EC_WORD_SEE, EC_WORD_THAT, EC_WORD_QUES}, - .speechLose = {EC_WORD_OH_DEAR, EC_WORD_I_AM, EC_WORD_SO, EC_WORD_SORRY, 0xFFFF, 0xFFFF}, - .speechAfter = {EC_WORD_IS, EC_WORD_YOUR, EC_WORD_GRANDMOTHER, EC_WORD_STRONG, EC_WORD_QUES, 0xFFFF}, + .speechLose = {EC_WORD_OH_DEAR, EC_WORD_I_AM, EC_WORD_SO, EC_WORD_SORRY, EC_EMPTY_WORD, EC_EMPTY_WORD}, + .speechAfter = {EC_WORD_IS, EC_WORD_YOUR, EC_WORD_GRANDMOTHER, EC_WORD_STRONG, EC_WORD_QUES, EC_EMPTY_WORD}, .mons = { [0] = @@ -5094,7 +5094,7 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speechBefore = {EC_WORD_OH_DEAR, EC_WORD_I, EC_WORD_WILL, EC_WORD_WIN, EC_WORD_FOR, EC_WORD_YOU}, .speechWin = {EC_WORD_OH_DEAR, EC_WORD_WE, EC_WORD_HAVE, EC_WORD_A, EC_WORD_PARTY, EC_WORD_LATER}, .speechLose = {EC_WORD_OH_DEAR, EC_WORD_I_AM, EC_WORD_SORRY, EC_WORD_TO, EC_WORD_DISAPPOINT, EC_WORD_YOU}, - .speechAfter = {EC_WORD_IS, EC_WORD_YOUR, EC_WORD_GRANDFATHER, EC_WORD_COOL, EC_WORD_QUES, 0xFFFF}, + .speechAfter = {EC_WORD_IS, EC_WORD_YOUR, EC_WORD_GRANDFATHER, EC_WORD_COOL, EC_WORD_QUES, EC_EMPTY_WORD}, .mons = { [0] = @@ -5271,7 +5271,7 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speechBefore = {EC_WORD_WAAAH, EC_WORD_THIS, EC_WORD_IS, EC_WORD_SO, EC_WORD_EXCITING, EC_WORD_EXCL}, .speechWin = {EC_WORD_WAAAH, EC_WORD_I_AM, EC_WORD_SO, EC_WORD_HAPPY, EC_WORD_I, EC_WORD_WON}, .speechLose = {EC_WORD_WAAAH, EC_WORD_I_AM, EC_WORD_SO, EC_WORD_SAD, EC_WORD_I, EC_WORD_LOST}, - .speechAfter = {EC_WORD_WAAAH, EC_WORD_EXCL, 0xFFFF, EC_WORD_GO, EC_WORD_AWAY, EC_WORD_EXCL}, + .speechAfter = {EC_WORD_WAAAH, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_GO, EC_WORD_AWAY, EC_WORD_EXCL}, .mons = { [0] = @@ -5410,7 +5410,7 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .facilityClass = FACILITY_CLASS_PKMN_RANGER_M, .unused = 0, .speechBefore = {EC_WORD_WAHAHAHA, EC_WORD_YOU, EC_WORD_CAN_T, EC_WORD_STOP, EC_WORD_ME, EC_WORD_EXCL}, - .speechWin = {EC_WORD_WOWEE, EC_WORD_EXCL, 0xFFFF, EC_WORD_I_AM, EC_WORD_AWESOME, EC_WORD_COOL}, + .speechWin = {EC_WORD_WOWEE, EC_WORD_EXCL, EC_EMPTY_WORD, EC_WORD_I_AM, EC_WORD_AWESOME, EC_WORD_COOL}, .speechLose = {EC_WORD_I_AM, EC_WORD_NOT, EC_WORD_COOL, EC_WORD_AT, EC_WORD_ALL, EC_WORD_EXCL}, .speechAfter = {EC_WORD_HEHEHE, EC_WORD_THAT_WAS, EC_WORD_AN, EC_WORD_AWESOME, EC_WORD_BATTLE, EC_WORD_EXCL}, .mons = diff --git a/src/data/easy_chat/easy_chat_words_by_letter.h b/src/data/easy_chat/easy_chat_words_by_letter.h index 347f875d4..df6524b17 100755 --- a/src/data/easy_chat/easy_chat_words_by_letter.h +++ b/src/data/easy_chat/easy_chat_words_by_letter.h @@ -1,6 +1,8 @@ #include "easy_chat.h" #include "constants/easy_chat.h" +#define DOUBLE_SPECIES_NAME EC_EMPTY_WORD, 2, + const u16 gEasyChatWordsByLetter_Others[] = { EC_WORD_EXCL, EC_WORD_EXCL_EXCL, @@ -21,9 +23,9 @@ const u16 gEasyChatWordsByLetter_A[] = { EC_WORD_A_TINY_BIT, EC_WORD_ABOUT, EC_WORD_ABOVE, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(ABRA), - EC_POKEMON2(ABRA), + EC_POKEMON_NATIONAL(ABRA), EC_WORD_ABSENT, EC_POKEMON(ABSOL), EC_WORD_ABSOLUTELY, @@ -36,7 +38,7 @@ const u16 gEasyChatWordsByLetter_A[] = { EC_WORD_ADVENTURE, EC_MOVE2(AERIAL_ACE), EC_MOVE(AEROBLAST), - EC_POKEMON2(AERODACTYL), + EC_POKEMON_NATIONAL(AERODACTYL), EC_WORD_AFTER, EC_WORD_AGE, EC_POKEMON(AGGRON), @@ -44,13 +46,13 @@ const u16 gEasyChatWordsByLetter_A[] = { EC_WORD_AGREE, EC_WORD_AHAHA, EC_WORD_AIM, - EC_POKEMON2(AIPOM), + EC_POKEMON_NATIONAL(AIPOM), EC_MOVE(AIR_CUTTER), EC_WORD_AIR_LOCK, EC_WORD_AIYEEH, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(ALAKAZAM), - EC_POKEMON2(ALAKAZAM), + EC_POKEMON_NATIONAL(ALAKAZAM), EC_WORD_ALL, EC_WORD_ALL_RIGHT, EC_WORD_ALLOW, @@ -65,7 +67,7 @@ const u16 gEasyChatWordsByLetter_A[] = { EC_WORD_ALWAYS, EC_WORD_AM, EC_MOVE2(AMNESIA), - EC_POKEMON2(AMPHAROS), + EC_POKEMON_NATIONAL(AMPHAROS), EC_WORD_AMUSING, EC_WORD_AN, EC_MOVE(ANCIENT_POWER), @@ -85,19 +87,19 @@ const u16 gEasyChatWordsByLetter_A[] = { EC_WORD_APPEARS, EC_WORD_APPRECIATE, EC_WORD_APPROVED, - EC_POKEMON2(ARBOK), - EC_POKEMON2(ARCANINE), + EC_POKEMON_NATIONAL(ARBOK), + EC_POKEMON_NATIONAL(ARCANINE), EC_WORD_ARE, EC_WORD_AREN_T, EC_WORD_ARENA_TRAP, - EC_POKEMON2(ARIADOS), + EC_POKEMON_NATIONAL(ARIADOS), EC_MOVE2(ARM_THRUST), EC_POKEMON(ARMALDO), EC_MOVE(AROMATHERAPY), EC_POKEMON(ARON), EC_WORD_AROUND, EC_WORD_ARRGH, - EC_POKEMON2(ARTICUNO), + EC_POKEMON_NATIONAL(ARTICUNO), EC_WORD_AS, EC_WORD_AS_IF, EC_WORD_AS_MUCH_AS, @@ -114,9 +116,9 @@ const u16 gEasyChatWordsByLetter_A[] = { EC_WORD_AWFUL, EC_WORD_AWFULLY, EC_WORD_AWW, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(AZUMARILL), - EC_POKEMON2(AZUMARILL), + EC_POKEMON_NATIONAL(AZUMARILL), EC_POKEMON(AZURILL), }; @@ -141,7 +143,7 @@ const u16 gEasyChatWordsByLetter_B[] = { EC_WORD_BATTLE_ARMOR, EC_WORD_BATTLE_ROOM, EC_WORD_BATTLE_TOWER, - EC_POKEMON2(BAYLEEF), + EC_POKEMON_NATIONAL(BAYLEEF), EC_WORD_BE, EC_WORD_BEAT, EC_MOVE2(BEAT_UP), @@ -149,17 +151,17 @@ const u16 gEasyChatWordsByLetter_B[] = { EC_WORD_BEAUTIFUL, EC_WORD_BEAUTY, EC_WORD_BECOMES, - EC_POKEMON2(BEEDRILL), + EC_POKEMON_NATIONAL(BEEDRILL), EC_WORD_BEEN, EC_WORD_BEFORE, EC_WORD_BEGINNING, EC_WORD_BEING, EC_POKEMON(BELDUM), EC_WORD_BELIEVE, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(BELLOSSOM), - EC_POKEMON2(BELLOSSOM), - EC_POKEMON2(BELLSPROUT), + EC_POKEMON_NATIONAL(BELLOSSOM), + EC_POKEMON_NATIONAL(BELLSPROUT), EC_MOVE2(BELLY_DRUM), EC_WORD_BELONGS_TO, EC_WORD_BELOW, @@ -173,12 +175,12 @@ const u16 gEasyChatWordsByLetter_B[] = { EC_MOVE(BIND), EC_MOVE(BITE), EC_MOVE2(BLAST_BURN), - EC_POKEMON2(BLASTOISE), + EC_POKEMON_NATIONAL(BLASTOISE), EC_WORD_BLAZE, EC_MOVE2(BLAZE_KICK), EC_POKEMON(BLAZIKEN), EC_WORD_BLEND, - EC_POKEMON2(BLISSEY), + EC_POKEMON_NATIONAL(BLISSEY), EC_MOVE2(BLIZZARD), EC_MOVE2(BLOCK), EC_WORD_BOARD, @@ -199,12 +201,12 @@ const u16 gEasyChatWordsByLetter_B[] = { EC_MOVE(BUBBLE), EC_MOVE2(BUBBLE_BEAM), EC_WORD_BUG, - EC_POKEMON2(BULBASAUR), + EC_POKEMON_NATIONAL(BULBASAUR), EC_MOVE2(BULK_UP), EC_MOVE2(BULLET_SEED), EC_WORD_BUSY, EC_WORD_BUT, - EC_POKEMON2(BUTTERFREE), + EC_POKEMON_NATIONAL(BUTTERFREE), EC_WORD_BYE_BYE, }; @@ -229,27 +231,27 @@ const u16 gEasyChatWordsByLetter_C[] = { EC_POKEMON(CASCOON), EC_WORD_CASE, EC_POKEMON(CASTFORM), - EC_POKEMON2(CATERPIE), + EC_POKEMON_NATIONAL(CATERPIE), EC_WORD_CAUSE, - EC_POKEMON2(CELEBI), + EC_POKEMON_NATIONAL(CELEBI), EC_WORD_CENTER, EC_WORD_CHALLENGE, EC_WORD_CHANGE, EC_WORD_CHANNEL, - EC_POKEMON2(CHANSEY), + EC_POKEMON_NATIONAL(CHANSEY), EC_MOVE(CHARGE), - EC_POKEMON2(CHARIZARD), + EC_POKEMON_NATIONAL(CHARIZARD), EC_MOVE(CHARM), - EC_POKEMON2(CHARMANDER), - EC_POKEMON2(CHARMELEON), + EC_POKEMON_NATIONAL(CHARMANDER), + EC_POKEMON_NATIONAL(CHARMELEON), EC_WORD_CHAT, - EC_POKEMON2(CHIKORITA), + EC_POKEMON_NATIONAL(CHIKORITA), EC_WORD_CHILD_S_PLAY, EC_WORD_CHILDREN, EC_POKEMON(CHIMECHO), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(CHINCHOU), - EC_POKEMON2(CHINCHOU), + EC_POKEMON_NATIONAL(CHINCHOU), EC_WORD_CHLOROPHYLL, EC_WORD_CHOICE, EC_WORD_CHOOSE, @@ -259,12 +261,12 @@ const u16 gEasyChatWordsByLetter_C[] = { EC_WORD_CLASS, EC_POKEMON(CLAYDOL), EC_WORD_CLEAR_BODY, - EC_POKEMON2(CLEFABLE), - EC_POKEMON2(CLEFAIRY), - EC_POKEMON2(CLEFFA), + EC_POKEMON_NATIONAL(CLEFABLE), + EC_POKEMON_NATIONAL(CLEFAIRY), + EC_POKEMON_NATIONAL(CLEFFA), EC_WORD_CLOSE, EC_WORD_CLOUD_NINE, - EC_POKEMON2(CLOYSTER), + EC_POKEMON_NATIONAL(CLOYSTER), EC_WORD_COLD, EC_WORD_COLLECT, EC_WORD_COLLECTION, @@ -293,9 +295,9 @@ const u16 gEasyChatWordsByLetter_C[] = { EC_WORD_COOLNESS, EC_POKEMON(CORPHISH), EC_WORD_CORRECT, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(CORSOLA), - EC_POKEMON2(CORSOLA), + EC_POKEMON_NATIONAL(CORSOLA), EC_MOVE(COSMIC_POWER), EC_MOVE2(COTTON_SPORE), EC_WORD_COULD, @@ -308,23 +310,23 @@ const u16 gEasyChatWordsByLetter_C[] = { EC_POKEMON(CRADILY), EC_POKEMON(CRAWDAUNT), EC_WORD_CRIES, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(CROBAT), - EC_POKEMON2(CROBAT), - EC_POKEMON2(CROCONAW), + EC_POKEMON_NATIONAL(CROBAT), + EC_POKEMON_NATIONAL(CROCONAW), EC_MOVE(CROSS_CHOP), EC_MOVE(CRUNCH), EC_WORD_CRUSH, EC_MOVE2(CRUSH_CLAW), EC_WORD_CRY, - EC_POKEMON2(CUBONE), + EC_POKEMON_NATIONAL(CUBONE), EC_WORD_CURRENT, EC_MOVE2(CURSE), EC_MOVE(CUT), EC_WORD_CUTE, EC_WORD_CUTE_CHARM, EC_WORD_CUTENESS, - EC_POKEMON2(CYNDAQUIL), + EC_POKEMON_NATIONAL(CYNDAQUIL), }; const u16 gEasyChatWordsByLetter_D[] = { @@ -345,7 +347,7 @@ const u16 gEasyChatWordsByLetter_D[] = { EC_WORD_DEFEATED, EC_MOVE2(DEFENSE_CURL), EC_POKEMON(DELCATTY), - EC_POKEMON2(DELIBIRD), + EC_POKEMON_NATIONAL(DELIBIRD), EC_POKEMON(DEOXYS), EC_WORD_DEPT_STORE, EC_WORD_DESIGN, @@ -353,14 +355,14 @@ const u16 gEasyChatWordsByLetter_D[] = { EC_MOVE2(DESTINY_BOND), EC_WORD_DESTROYED, EC_MOVE2(DETECT), - EC_POKEMON2(DEWGONG), + EC_POKEMON_NATIONAL(DEWGONG), EC_WORD_DID, EC_WORD_DIDN_T, EC_WORD_DIET, EC_WORD_DIFFERENT, EC_MOVE(DIG), EC_WORD_DIGITAL, - EC_POKEMON2(DIGLETT), + EC_POKEMON_NATIONAL(DIGLETT), EC_WORD_DIRECT, EC_MOVE(DISABLE), EC_WORD_DISAPPEAR, @@ -370,24 +372,24 @@ const u16 gEasyChatWordsByLetter_D[] = { EC_WORD_DISASTER, EC_WORD_DISLIKE, EC_WORD_DISLIKES, - EC_POKEMON2(DITTO), + EC_POKEMON_NATIONAL(DITTO), EC_MOVE2(DIVE), EC_MOVE2(DIZZY_PUNCH), EC_WORD_DO, EC_WORD_DOCILE, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(DODRIO), - EC_POKEMON2(DODRIO), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(DODRIO), + DOUBLE_SPECIES_NAME EC_POKEMON(DODUO), - EC_POKEMON2(DODUO), + EC_POKEMON_NATIONAL(DODUO), EC_WORD_DOES, EC_WORD_DOESN_T, EC_WORD_DON_T, EC_WORD_DONE, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(DONPHAN), - EC_POKEMON2(DONPHAN), + EC_POKEMON_NATIONAL(DONPHAN), EC_MOVE2(DOOM_DESIRE), EC_MOVE2(DOUBLE_KICK), EC_MOVE(DOUBLE_TEAM), @@ -399,10 +401,10 @@ const u16 gEasyChatWordsByLetter_D[] = { EC_MOVE2(DRAGON_CLAW), EC_MOVE2(DRAGON_DANCE), EC_MOVE2(DRAGON_RAGE), - EC_POKEMON2(DRAGONAIR), + EC_POKEMON_NATIONAL(DRAGONAIR), EC_MOVE2(DRAGON_BREATH), - EC_POKEMON2(DRAGONITE), - EC_POKEMON2(DRATINI), + EC_POKEMON_NATIONAL(DRAGONITE), + EC_POKEMON_NATIONAL(DRATINI), EC_WORD_DREAM, EC_MOVE2(DREAM_EATER), EC_MOVE2(DRILL_PECK), @@ -411,10 +413,10 @@ const u16 gEasyChatWordsByLetter_D[] = { EC_WORD_DRIZZLE, EC_WORD_DROOLING, EC_WORD_DROUGHT, - EC_POKEMON2(DROWZEE), + EC_POKEMON_NATIONAL(DROWZEE), EC_WORD_DUDE, - EC_POKEMON2(DUGTRIO), - EC_POKEMON2(DUNSPARCE), + EC_POKEMON_NATIONAL(DUGTRIO), + EC_POKEMON_NATIONAL(DUNSPARCE), EC_POKEMON(DUSCLOPS), EC_POKEMON(DUSKULL), EC_POKEMON(DUSTOX), @@ -429,20 +431,20 @@ const u16 gEasyChatWordsByLetter_E[] = { EC_WORD_EAT, EC_WORD_EATS, EC_WORD_EEK, - EC_POKEMON2(EEVEE), + EC_POKEMON_NATIONAL(EEVEE), EC_WORD_EFFECT_SPORE, EC_WORD_EGG, EC_MOVE2(EGG_BOMB), EC_WORD_EH_QUES, EC_WORD_EHEHE, - EC_POKEMON2(EKANS), - EC_POKEMON2(ELECTABUZZ), + EC_POKEMON_NATIONAL(EKANS), + EC_POKEMON_NATIONAL(ELECTABUZZ), EC_WORD_ELECTRIC, EC_POKEMON(ELECTRIKE), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(ELECTRODE), - EC_POKEMON2(ELECTRODE), - EC_POKEMON2(ELEKID), + EC_POKEMON_NATIONAL(ELECTRODE), + EC_POKEMON_NATIONAL(ELEKID), EC_WORD_ELSE, EC_MOVE2(EMBER), EC_WORD_EMERALD, @@ -454,11 +456,11 @@ const u16 gEasyChatWordsByLetter_E[] = { EC_WORD_ENJOY, EC_WORD_ENJOYS, EC_WORD_ENOUGH, - EC_POKEMON2(ENTEI), + EC_POKEMON_NATIONAL(ENTEI), EC_WORD_ENTERTAINING, EC_MOVE2(ERUPTION), EC_WORD_ESCAPE, - EC_POKEMON2(ESPEON), + EC_POKEMON_NATIONAL(ESPEON), EC_WORD_EVEN_SO, EC_WORD_EVENT, EC_WORD_EVENTS, @@ -472,8 +474,8 @@ const u16 gEasyChatWordsByLetter_E[] = { EC_WORD_EXCITING, EC_WORD_EXCUSE, EC_WORD_EXCUSE_ME, - EC_POKEMON2(EXEGGCUTE), - EC_POKEMON2(EXEGGUTOR), + EC_POKEMON_NATIONAL(EXEGGCUTE), + EC_POKEMON_NATIONAL(EXEGGUTOR), EC_WORD_EXISTS, EC_WORD_EXPENSIVE, EC_MOVE2(EXPLOSION), @@ -495,16 +497,16 @@ const u16 gEasyChatWordsByLetter_F[] = { EC_WORD_FAMILY, EC_WORD_FANTASTIC, EC_WORD_FAR, - EC_POKEMON2(FARFETCHD), + EC_POKEMON_NATIONAL(FARFETCHD), EC_WORD_FASHION, EC_WORD_FAST, EC_WORD_FATHER, EC_WORD_FEAR, - EC_POKEMON2(FEAROW), + EC_POKEMON_NATIONAL(FEAROW), EC_MOVE2(FEATHER_DANCE), EC_POKEMON(FEEBAS), EC_WORD_FEELING, - EC_POKEMON2(FERALIGATR), + EC_POKEMON_NATIONAL(FERALIGATR), EC_WORD_FESTIVAL, EC_WORD_FEVER, EC_WORD_FIERY, @@ -520,13 +522,13 @@ const u16 gEasyChatWordsByLetter_F[] = { EC_MOVE2(FIRE_SPIN), EC_WORD_FISHING, EC_MOVE(FISSURE), - EC_POKEMON2(FLAAFFY), + EC_POKEMON_NATIONAL(FLAAFFY), EC_MOVE(FLAIL), EC_WORD_FLAME, EC_WORD_FLAME_BODY, EC_MOVE(FLAME_WHEEL), EC_MOVE(FLAMETHROWER), - EC_POKEMON2(FLAREON), + EC_POKEMON_NATIONAL(FLAREON), EC_MOVE2(FLASH), EC_WORD_FLASH_FIRE, EC_WORD_FLATTEN, @@ -547,7 +549,7 @@ const u16 gEasyChatWordsByLetter_F[] = { EC_WORD_FORGET, EC_WORD_FORGETS, EC_WORD_FORGIVE, - EC_POKEMON2(FORRETRESS), + EC_POKEMON_NATIONAL(FORRETRESS), EC_MOVE2(FRENZY_PLANT), EC_WORD_FRIDAY, EC_WORD_FRIEND, @@ -558,7 +560,7 @@ const u16 gEasyChatWordsByLetter_F[] = { EC_WORD_FUFUFU, EC_WORD_FULL, EC_WORD_FUNNY, - EC_POKEMON2(FURRET), + EC_POKEMON_NATIONAL(FURRET), EC_MOVE2(FURY_ATTACK), EC_MOVE2(FURY_CUTTER), EC_MOVE2(FURY_SWIPES), @@ -568,12 +570,12 @@ const u16 gEasyChatWordsByLetter_F[] = { const u16 gEasyChatWordsByLetter_G[] = { EC_WORD_GAME, EC_POKEMON(GARDEVOIR), - EC_POKEMON2(GASTLY), - EC_POKEMON2(GENGAR), + EC_POKEMON_NATIONAL(GASTLY), + EC_POKEMON_NATIONAL(GENGAR), EC_WORD_GENIUS, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(GEODUDE), - EC_POKEMON2(GEODUDE), + EC_POKEMON_NATIONAL(GEODUDE), EC_WORD_GET, EC_WORD_GETS, EC_WORD_GHOST, @@ -581,9 +583,9 @@ const u16 gEasyChatWordsByLetter_G[] = { EC_MOVE(GIGA_DRAIN), EC_WORD_GIGGLE, EC_WORD_GIMME, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(GIRAFARIG), - EC_POKEMON2(GIRAFARIG), + EC_POKEMON_NATIONAL(GIRAFARIG), EC_WORD_GIRL, EC_WORD_GIVE, EC_WORD_GIVE_ME, @@ -591,29 +593,29 @@ const u16 gEasyChatWordsByLetter_G[] = { EC_WORD_GIVES, EC_POKEMON(GLALIE), EC_MOVE2(GLARE), - EC_POKEMON2(GLIGAR), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(GLIGAR), + DOUBLE_SPECIES_NAME EC_POKEMON(GLOOM), - EC_POKEMON2(GLOOM), + EC_POKEMON_NATIONAL(GLOOM), EC_WORD_GO, EC_WORD_GO_AHEAD, EC_WORD_GO_EASY, EC_WORD_GO_HOME, EC_WORD_GOES, EC_WORD_GOING, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(GOLBAT), - EC_POKEMON2(GOLBAT), + EC_POKEMON_NATIONAL(GOLBAT), EC_WORD_GOLD, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(GOLDEEN), - EC_POKEMON2(GOLDEEN), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(GOLDEEN), + DOUBLE_SPECIES_NAME EC_POKEMON(GOLDUCK), - EC_POKEMON2(GOLDUCK), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(GOLDUCK), + DOUBLE_SPECIES_NAME EC_POKEMON(GOLEM), - EC_POKEMON2(GOLEM), + EC_POKEMON_NATIONAL(GOLEM), EC_WORD_GOOD, EC_WORD_GOOD_BYE, EC_POKEMON(GOREBYSS), @@ -621,25 +623,25 @@ const u16 gEasyChatWordsByLetter_G[] = { EC_WORD_GOTCHA, EC_WORD_GOURMET, EC_WORD_GRAAAH, - EC_POKEMON2(GRANBULL), + EC_POKEMON_NATIONAL(GRANBULL), EC_WORD_GRANDFATHER, EC_WORD_GRANDMOTHER, EC_WORD_GRASS, EC_MOVE(GRASS_WHISTLE), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(GRAVELER), - EC_POKEMON2(GRAVELER), + EC_POKEMON_NATIONAL(GRAVELER), EC_WORD_GREAT, EC_WORD_GREEN, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(GRIMER), - EC_POKEMON2(GRIMER), + EC_POKEMON_NATIONAL(GRIMER), EC_POKEMON(GROUDON), EC_WORD_GROUND, EC_WORD_GROUP, EC_POKEMON(GROVYLE), EC_MOVE2(GROWL), - EC_POKEMON2(GROWLITHE), + EC_POKEMON_NATIONAL(GROWLITHE), EC_MOVE(GROWTH), EC_MOVE(GRUDGE), EC_POKEMON(GRUMPIG), @@ -651,9 +653,9 @@ const u16 gEasyChatWordsByLetter_G[] = { EC_WORD_GUTSY, EC_WORD_GWAH, EC_WORD_GWAHAHAHA, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(GYARADOS), - EC_POKEMON2(GYARADOS), + EC_POKEMON_NATIONAL(GYARADOS), }; const u16 gEasyChatWordsByLetter_H[] = { @@ -671,7 +673,7 @@ const u16 gEasyChatWordsByLetter_H[] = { EC_POKEMON(HARIYAMA), EC_WORD_HAS, EC_WORD_HASSLE, - EC_POKEMON2(HAUNTER), + EC_POKEMON_NATIONAL(HAUNTER), EC_WORD_HAVE, EC_WORD_HAVEN_T, EC_MOVE(HAZE), @@ -691,9 +693,9 @@ const u16 gEasyChatWordsByLetter_H[] = { EC_WORD_HELLO, EC_MOVE2(HELPING_HAND), EC_WORD_HER, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(HERACROSS), - EC_POKEMON2(HERACROSS), + EC_POKEMON_NATIONAL(HERACROSS), EC_WORD_HERE, EC_WORD_HERE_GOES, EC_WORD_HERE_I_COME, @@ -714,28 +716,28 @@ const u16 gEasyChatWordsByLetter_H[] = { EC_WORD_HIP_AND, EC_WORD_HIS, EC_WORD_HIT, - EC_POKEMON2(HITMONCHAN), - EC_POKEMON2(HITMONLEE), - EC_POKEMON2(HITMONTOP), + EC_POKEMON_NATIONAL(HITMONCHAN), + EC_POKEMON_NATIONAL(HITMONLEE), + EC_POKEMON_NATIONAL(HITMONTOP), EC_WORD_HIYAH, EC_WORD_HMM, - EC_POKEMON2(HO_OH), + EC_POKEMON_NATIONAL(HO_OH), EC_WORD_HOBBY, EC_WORD_HOHOHO, EC_WORD_HOLIDAY, EC_WORD_HOME, EC_WORD_HOO_HAH, - EC_POKEMON2(HOOTHOOT), + EC_POKEMON_NATIONAL(HOOTHOOT), EC_WORD_HOPELESS, - EC_POKEMON2(HOPPIP), + EC_POKEMON_NATIONAL(HOPPIP), EC_MOVE2(HORN_ATTACK), EC_MOVE2(HORN_DRILL), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(HORSEA), - EC_POKEMON2(HORSEA), + EC_POKEMON_NATIONAL(HORSEA), EC_WORD_HOT, - EC_POKEMON2(HOUNDOOM), - EC_POKEMON2(HOUNDOUR), + EC_POKEMON_NATIONAL(HOUNDOOM), + EC_POKEMON_NATIONAL(HOUNDOUR), EC_WORD_HOW, EC_WORD_HOW_DO, EC_WORD_HOWEVER, @@ -754,7 +756,7 @@ const u16 gEasyChatWordsByLetter_H[] = { EC_WORD_HYPER_CUTTER, EC_MOVE2(HYPER_FANG), EC_MOVE2(HYPER_VOICE), - EC_POKEMON2(HYPNO), + EC_POKEMON_NATIONAL(HYPNO), EC_MOVE(HYPNOSIS), }; @@ -775,9 +777,9 @@ const u16 gEasyChatWordsByLetter_I[] = { EC_WORD_IF, EC_WORD_IF_I_LOSE, EC_WORD_IF_I_WIN, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(IGGLYBUFF), - EC_POKEMON2(IGGLYBUFF), + EC_POKEMON_NATIONAL(IGGLYBUFF), EC_WORD_IGNORANT, EC_WORD_ILLUMINATE, EC_POKEMON(ILLUMISE), @@ -805,32 +807,32 @@ const u16 gEasyChatWordsByLetter_I[] = { EC_WORD_IT, EC_WORD_IT_S, EC_WORD_ITEM, - EC_POKEMON2(IVYSAUR), + EC_POKEMON_NATIONAL(IVYSAUR), }; const u16 gEasyChatWordsByLetter_J[] = { - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(JIGGLYPUFF), - EC_POKEMON2(JIGGLYPUFF), + EC_POKEMON_NATIONAL(JIGGLYPUFF), EC_POKEMON(JIRACHI), EC_WORD_JOKING, - EC_POKEMON2(JOLTEON), + EC_POKEMON_NATIONAL(JOLTEON), EC_WORD_JOY, EC_WORD_JUDGE, EC_MOVE2(JUMP_KICK), - EC_POKEMON2(JUMPLUFF), + EC_POKEMON_NATIONAL(JUMPLUFF), EC_WORD_JUST, - EC_POKEMON2(JYNX), + EC_POKEMON_NATIONAL(JYNX), }; const u16 gEasyChatWordsByLetter_K[] = { - EC_POKEMON2(KABUTO), - EC_POKEMON2(KABUTOPS), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(KABUTO), + EC_POKEMON_NATIONAL(KABUTOPS), + DOUBLE_SPECIES_NAME EC_POKEMON(KADABRA), - EC_POKEMON2(KADABRA), - EC_POKEMON2(KAKUNA), - EC_POKEMON2(KANGASKHAN), + EC_POKEMON_NATIONAL(KADABRA), + EC_POKEMON_NATIONAL(KAKUNA), + EC_POKEMON_NATIONAL(KANGASKHAN), EC_MOVE(KARATE_CHOP), EC_POKEMON(KECLEON), EC_WORD_KEEN_EYE, @@ -839,19 +841,19 @@ const u16 gEasyChatWordsByLetter_K[] = { EC_WORD_KIND, EC_WORD_KINDERGARTEN, EC_MOVE(KINESIS), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(KINGDRA), - EC_POKEMON2(KINGDRA), - EC_POKEMON2(KINGLER), + EC_POKEMON_NATIONAL(KINGDRA), + EC_POKEMON_NATIONAL(KINGLER), EC_POKEMON(KIRLIA), EC_MOVE2(KNOCK_OFF), EC_WORD_KNOCKOUT, EC_WORD_KNOW, EC_WORD_KNOWS, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(KOFFING), - EC_POKEMON2(KOFFING), - EC_POKEMON2(KRABBY), + EC_POKEMON_NATIONAL(KOFFING), + EC_POKEMON_NATIONAL(KRABBY), EC_WORD_KTHX_BYE, EC_POKEMON(KYOGRE), }; @@ -862,11 +864,11 @@ const u16 gEasyChatWordsByLetter_L[] = { EC_WORD_LADY, EC_POKEMON(LAIRON), EC_WORD_LALALA, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(LANTURN), - EC_POKEMON2(LANTURN), - EC_POKEMON2(LAPRAS), - EC_POKEMON2(LARVITAR), + EC_POKEMON_NATIONAL(LANTURN), + EC_POKEMON_NATIONAL(LAPRAS), + EC_POKEMON_NATIONAL(LARVITAR), EC_WORD_LAST, EC_WORD_LATE, EC_WORD_LATER, @@ -879,8 +881,8 @@ const u16 gEasyChatWordsByLetter_L[] = { EC_WORD_LEAF, EC_MOVE2(LEAF_BLADE), EC_WORD_LEARN, - EC_POKEMON2(LEDIAN), - EC_POKEMON2(LEDYBA), + EC_POKEMON_NATIONAL(LEDIAN), + EC_POKEMON_NATIONAL(LEDYBA), EC_MOVE(LEECH_LIFE), EC_MOVE2(LEECH_SEED), EC_MOVE2(LEER), @@ -894,7 +896,7 @@ const u16 gEasyChatWordsByLetter_L[] = { EC_WORD_LEVEL, EC_WORD_LEVITATE, EC_MOVE(LICK), - EC_POKEMON2(LICKITUNG), + EC_POKEMON_NATIONAL(LICKITUNG), EC_WORD_LIE, EC_WORD_LIFE, EC_MOVE2(LIGHT_SCREEN), @@ -933,7 +935,7 @@ const u16 gEasyChatWordsByLetter_L[] = { EC_MOVE(LOW_KICK), EC_WORD_LOWS, EC_POKEMON(LUDICOLO), - EC_POKEMON2(LUGIA), + EC_POKEMON_NATIONAL(LUGIA), EC_WORD_LUKEWARM, EC_POKEMON(LUNATONE), EC_MOVE2(LUSTER_PURGE), @@ -942,35 +944,35 @@ const u16 gEasyChatWordsByLetter_L[] = { const u16 gEasyChatWordsByLetter_M[] = { EC_MOVE2(MACH_PUNCH), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(MACHAMP), - EC_POKEMON2(MACHAMP), + EC_POKEMON_NATIONAL(MACHAMP), EC_WORD_MACHINE, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(MACHOKE), - EC_POKEMON2(MACHOKE), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(MACHOKE), + DOUBLE_SPECIES_NAME EC_POKEMON(MACHOP), - EC_POKEMON2(MACHOP), + EC_POKEMON_NATIONAL(MACHOP), EC_WORD_MAGAZINE, - EC_POKEMON2(MAGBY), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(MAGBY), + DOUBLE_SPECIES_NAME EC_POKEMON(MAGCARGO), - EC_POKEMON2(MAGCARGO), + EC_POKEMON_NATIONAL(MAGCARGO), EC_MOVE2(MAGIC_COAT), EC_MOVE2(MAGICAL_LEAF), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(MAGIKARP), - EC_POKEMON2(MAGIKARP), + EC_POKEMON_NATIONAL(MAGIKARP), EC_WORD_MAGMA_ARMOR, - EC_POKEMON2(MAGMAR), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(MAGMAR), + DOUBLE_SPECIES_NAME EC_POKEMON(MAGNEMITE), - EC_POKEMON2(MAGNEMITE), + EC_POKEMON_NATIONAL(MAGNEMITE), EC_WORD_MAGNET_PULL, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(MAGNETON), - EC_POKEMON2(MAGNETON), + EC_POKEMON_NATIONAL(MAGNETON), EC_MOVE2(MAGNITUDE), EC_WORD_MAIL, EC_WORD_MAKE, @@ -978,13 +980,13 @@ const u16 gEasyChatWordsByLetter_M[] = { EC_POKEMON(MAKUHITA), EC_WORD_MAN, EC_POKEMON(MANECTRIC), - EC_POKEMON2(MANKEY), - EC_POKEMON2(MANTINE), - EC_POKEMON2(MAREEP), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(MANKEY), + EC_POKEMON_NATIONAL(MANTINE), + EC_POKEMON_NATIONAL(MAREEP), + DOUBLE_SPECIES_NAME EC_POKEMON(MARILL), - EC_POKEMON2(MARILL), - EC_POKEMON2(MAROWAK), + EC_POKEMON_NATIONAL(MARILL), + EC_POKEMON_NATIONAL(MAROWAK), EC_POKEMON(MARSHTOMP), EC_WORD_MARVEL_SCALE, EC_POKEMON(MASQUERAIN), @@ -1008,23 +1010,23 @@ const u16 gEasyChatWordsByLetter_M[] = { EC_MOVE2(MEGA_KICK), EC_MOVE2(MEGA_PUNCH), EC_MOVE2(MEGAHORN), - EC_POKEMON2(MEGANIUM), + EC_POKEMON_NATIONAL(MEGANIUM), EC_MOVE(MEMENTO), - EC_POKEMON2(MEOWTH), + EC_POKEMON_NATIONAL(MEOWTH), EC_WORD_MESSAGE, EC_POKEMON(METAGROSS), EC_MOVE2(METAL_CLAW), EC_MOVE(METAL_SOUND), EC_POKEMON(METANG), - EC_POKEMON2(METAPOD), + EC_POKEMON_NATIONAL(METAPOD), EC_MOVE(METEOR_MASH), EC_MOVE2(METRONOME), - EC_POKEMON2(MEW), - EC_POKEMON2(MEWTWO), + EC_POKEMON_NATIONAL(MEW), + EC_POKEMON_NATIONAL(MEWTWO), EC_POKEMON(MIGHTYENA), EC_MOVE2(MILK_DRINK), EC_POKEMON(MILOTIC), - EC_POKEMON2(MILTANK), + EC_POKEMON_NATIONAL(MILTANK), EC_MOVE2(MIMIC), EC_MOVE(MIND_READER), EC_MOVE2(MINIMIZE), @@ -1032,7 +1034,7 @@ const u16 gEasyChatWordsByLetter_M[] = { EC_WORD_MINUS, EC_MOVE2(MIRROR_COAT), EC_MOVE(MIRROR_MOVE), - EC_POKEMON2(MISDREAVUS), + EC_POKEMON_NATIONAL(MISDREAVUS), EC_WORD_MISHEARD, EC_WORD_MISS, EC_MOVE(MIST), @@ -1041,7 +1043,7 @@ const u16 gEasyChatWordsByLetter_M[] = { EC_WORD_MMM, EC_WORD_MODE, EC_WORD_MODERN, - EC_POKEMON2(MOLTRES), + EC_POKEMON_NATIONAL(MOLTRES), EC_WORD_MOMENTUM, EC_WORD_MONDAY, EC_WORD_MONEY, @@ -1055,7 +1057,7 @@ const u16 gEasyChatWordsByLetter_M[] = { EC_WORD_MOVE, EC_WORD_MOVIE, EC_WORD_MR, - EC_POKEMON2(MR_MIME), + EC_POKEMON_NATIONAL(MR_MIME), EC_WORD_MRS, EC_WORD_MUCH, EC_WORD_MUCH_OBLIGED, @@ -1065,10 +1067,10 @@ const u16 gEasyChatWordsByLetter_M[] = { EC_MOVE2(MUDDY_WATER), EC_POKEMON(MUDKIP), EC_WORD_MUFUFU, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(MUK), - EC_POKEMON2(MUK), - EC_POKEMON2(MURKROW), + EC_POKEMON_NATIONAL(MUK), + EC_POKEMON_NATIONAL(MURKROW), EC_WORD_MUSIC, EC_WORD_MUST_BE, EC_WORD_MY, @@ -1079,9 +1081,9 @@ const u16 gEasyChatWordsByLetter_M[] = { const u16 gEasyChatWordsByLetter_N[] = { EC_WORD_NAME, EC_WORD_NAP, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(NATU), - EC_POKEMON2(NATU), + EC_POKEMON_NATIONAL(NATU), EC_WORD_NATURAL, EC_WORD_NATURAL_CURE, EC_WORD_NATURALLY, @@ -1097,26 +1099,26 @@ const u16 gEasyChatWordsByLetter_N[] = { EC_WORD_NEWS, EC_WORD_NEXT, EC_WORD_NICE, - EC_POKEMON2(NIDOKING), - EC_POKEMON2(NIDOQUEEN), - EC_POKEMON2(NIDORAN_F), - EC_POKEMON2(NIDORAN_M), - EC_POKEMON2(NIDORINA), - EC_POKEMON2(NIDORINO), + EC_POKEMON_NATIONAL(NIDOKING), + EC_POKEMON_NATIONAL(NIDOQUEEN), + EC_POKEMON_NATIONAL(NIDORAN_F), + EC_POKEMON_NATIONAL(NIDORAN_M), + EC_POKEMON_NATIONAL(NIDORINA), + EC_POKEMON_NATIONAL(NIDORINO), EC_WORD_NIGHT, EC_MOVE2(NIGHT_SHADE), EC_MOVE(NIGHTMARE), EC_WORD_NIGHTTIME, EC_POKEMON(NINCADA), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(NINETALES), - EC_POKEMON2(NINETALES), + EC_POKEMON_NATIONAL(NINETALES), EC_POKEMON(NINJASK), EC_WORD_NITWIT, EC_WORD_NO, EC_WORD_NO_MATCH, EC_WORD_NO_1, - EC_POKEMON2(NOCTOWL), + EC_POKEMON_NATIONAL(NOCTOWL), EC_WORD_NOISY, EC_WORD_NON_STOP, EC_WORD_NONE, @@ -1134,10 +1136,10 @@ const u16 gEasyChatWordsByLetter_N[] = { const u16 gEasyChatWordsByLetter_O[] = { EC_WORD_OBLIVIOUS, EC_MOVE(OCTAZOOKA), - EC_POKEMON2(OCTILLERY), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(OCTILLERY), + DOUBLE_SPECIES_NAME EC_POKEMON(ODDISH), - EC_POKEMON2(ODDISH), + EC_POKEMON_NATIONAL(ODDISH), EC_MOVE(ODOR_SLEUTH), EC_WORD_OF, EC_WORD_OFF, @@ -1153,11 +1155,11 @@ const u16 gEasyChatWordsByLetter_O[] = { EC_WORD_OKAY, EC_WORD_OLD, EC_WORD_OLDEN, - EC_POKEMON2(OMANYTE), - EC_POKEMON2(OMASTAR), + EC_POKEMON_NATIONAL(OMANYTE), + EC_POKEMON_NATIONAL(OMASTAR), EC_WORD_ON, EC_WORD_ONCE, - EC_POKEMON2(ONIX), + EC_POKEMON_NATIONAL(ONIX), EC_WORD_ONLY, EC_WORD_OOPS, EC_WORD_OPPONENT, @@ -1179,8 +1181,8 @@ const u16 gEasyChatWordsByLetter_O[] = { const u16 gEasyChatWordsByLetter_P[] = { EC_MOVE(PAIN_SPLIT), - EC_POKEMON2(PARAS), - EC_POKEMON2(PARASECT), + EC_POKEMON_NATIONAL(PARAS), + EC_POKEMON_NATIONAL(PARASECT), EC_WORD_PARDON, EC_WORD_PARENT, EC_WORD_PARTNER, @@ -1193,29 +1195,29 @@ const u16 gEasyChatWordsByLetter_P[] = { EC_WORD_PERFECT, EC_WORD_PERFECTION, EC_MOVE2(PERISH_SONG), - EC_POKEMON2(PERSIAN), + EC_POKEMON_NATIONAL(PERSIAN), EC_WORD_PERSON, EC_MOVE2(PETAL_DANCE), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(PHANPY), - EC_POKEMON2(PHANPY), + EC_POKEMON_NATIONAL(PHANPY), EC_WORD_PHONE, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(PICHU), - EC_POKEMON2(PICHU), + EC_POKEMON_NATIONAL(PICHU), EC_WORD_PICKUP, - EC_POKEMON2(PIDGEOT), - EC_POKEMON2(PIDGEOTTO), - EC_POKEMON2(PIDGEY), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(PIDGEOT), + EC_POKEMON_NATIONAL(PIDGEOTTO), + EC_POKEMON_NATIONAL(PIDGEY), + DOUBLE_SPECIES_NAME EC_POKEMON(PIKACHU), - EC_POKEMON2(PIKACHU), - EC_POKEMON2(PILOSWINE), + EC_POKEMON_NATIONAL(PIKACHU), + EC_POKEMON_NATIONAL(PILOSWINE), EC_MOVE2(PIN_MISSILE), - EC_POKEMON2(PINECO), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(PINECO), + DOUBLE_SPECIES_NAME EC_POKEMON(PINSIR), - EC_POKEMON2(PINSIR), + EC_POKEMON_NATIONAL(PINSIR), EC_WORD_PKRS, EC_WORD_PLACE, EC_WORD_PLANS, @@ -1238,15 +1240,15 @@ const u16 gEasyChatWordsByLetter_P[] = { EC_WORD_POKEDEX, EC_WORD_POKEMON, EC_WORD_POKENAV, - EC_POKEMON2(POLITOED), - EC_POKEMON2(POLIWAG), - EC_POKEMON2(POLIWHIRL), - EC_POKEMON2(POLIWRATH), - EC_POKEMON2(PONYTA), + EC_POKEMON_NATIONAL(POLITOED), + EC_POKEMON_NATIONAL(POLIWAG), + EC_POKEMON_NATIONAL(POLIWHIRL), + EC_POKEMON_NATIONAL(POLIWRATH), + EC_POKEMON_NATIONAL(PONYTA), EC_POKEMON(POOCHYENA), EC_WORD_POPULAR, - EC_POKEMON2(PORYGON), - EC_POKEMON2(PORYGON2), + EC_POKEMON_NATIONAL(PORYGON), + EC_POKEMON_NATIONAL(PORYGON2), EC_MOVE2(POUND), EC_MOVE(POWDER_SNOW), EC_WORD_POWER, @@ -1256,52 +1258,52 @@ const u16 gEasyChatWordsByLetter_P[] = { EC_WORD_PRESSURE, EC_WORD_PRETEND, EC_WORD_PRETTY, - EC_POKEMON2(PRIMEAPE), + EC_POKEMON_NATIONAL(PRIMEAPE), EC_WORD_PROBABLY, EC_WORD_PROMISE, EC_MOVE2(PROTECT), EC_MOVE(PSYBEAM), EC_MOVE(PSYCH_UP), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_WORD_PSYCHIC, EC_MOVE(PSYCHIC), EC_MOVE(PSYCHO_BOOST), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(PSYDUCK), - EC_POKEMON2(PSYDUCK), + EC_POKEMON_NATIONAL(PSYDUCK), EC_MOVE(PSYWAVE), - EC_POKEMON2(PUPITAR), + EC_POKEMON_NATIONAL(PUPITAR), EC_WORD_PURE_POWER, EC_MOVE(PURSUIT), EC_WORD_PUSHOVER, }; const u16 gEasyChatWordsByLetter_Q[] = { - EC_POKEMON2(QUAGSIRE), + EC_POKEMON_NATIONAL(QUAGSIRE), EC_WORD_QUESTION, EC_MOVE2(QUICK_ATTACK), - EC_POKEMON2(QUILAVA), + EC_POKEMON_NATIONAL(QUILAVA), EC_WORD_QUITE, - EC_POKEMON2(QWILFISH), + EC_POKEMON_NATIONAL(QWILFISH), }; const u16 gEasyChatWordsByLetter_R[] = { EC_WORD_RADIO, EC_MOVE(RAGE), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(RAICHU), - EC_POKEMON2(RAICHU), - EC_POKEMON2(RAIKOU), + EC_POKEMON_NATIONAL(RAICHU), + EC_POKEMON_NATIONAL(RAIKOU), EC_MOVE(RAIN_DANCE), EC_WORD_RAIN_DISH, EC_POKEMON(RALTS), EC_WORD_RANK, EC_MOVE(RAPID_SPIN), - EC_POKEMON2(RAPIDASH), + EC_POKEMON_NATIONAL(RAPIDASH), EC_WORD_RARE, EC_WORD_RATHER, - EC_POKEMON2(RATICATE), - EC_POKEMON2(RATTATA), + EC_POKEMON_NATIONAL(RATICATE), + EC_POKEMON_NATIONAL(RATTATA), EC_POKEMON(RAYQUAZA), EC_MOVE2(RAZOR_LEAF), EC_MOVE(RAZOR_WIND), @@ -1323,19 +1325,19 @@ const u16 gEasyChatWordsByLetter_R[] = { EC_WORD_REJECT, EC_WORD_RELEASE, EC_POKEMON(RELICANTH), - EC_POKEMON2(REMORAID), + EC_POKEMON_NATIONAL(REMORAID), EC_WORD_RENTAL, EC_MOVE2(REST), EC_WORD_RESUSCITATE, EC_MOVE(RETURN), EC_MOVE2(REVENGE), EC_MOVE(REVERSAL), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(RHYDON), - EC_POKEMON2(RHYDON), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(RHYDON), + DOUBLE_SPECIES_NAME EC_POKEMON(RHYHORN), - EC_POKEMON2(RHYHORN), + EC_POKEMON_NATIONAL(RHYHORN), EC_WORD_RIBBON, EC_WORD_RICKETY, EC_WORD_RIGHT, @@ -1377,12 +1379,12 @@ const u16 gEasyChatWordsByLetter_S[] = { EC_MOVE(SAND_TOMB), EC_WORD_SAND_VEIL, EC_MOVE(SAND_ATTACK), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(SANDSHREW), - EC_POKEMON2(SANDSHREW), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(SANDSHREW), + DOUBLE_SPECIES_NAME EC_POKEMON(SANDSLASH), - EC_POKEMON2(SANDSLASH), + EC_POKEMON_NATIONAL(SANDSLASH), EC_MOVE(SANDSTORM), EC_WORD_SAPPHIRE, EC_WORD_SATISFIED, @@ -1393,16 +1395,16 @@ const u16 gEasyChatWordsByLetter_S[] = { EC_WORD_SCATTER, EC_POKEMON(SCEPTILE), EC_WORD_SCHOOL, - EC_POKEMON2(SCIZOR), + EC_POKEMON_NATIONAL(SCIZOR), EC_MOVE2(SCRATCH), EC_MOVE(SCREECH), - EC_POKEMON2(SCYTHER), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(SCYTHER), + DOUBLE_SPECIES_NAME EC_POKEMON(SEADRA), - EC_POKEMON2(SEADRA), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(SEADRA), + DOUBLE_SPECIES_NAME EC_POKEMON(SEAKING), - EC_POKEMON2(SEAKING), + EC_POKEMON_NATIONAL(SEAKING), EC_POKEMON(SEALEO), EC_WORD_SEARCH, EC_WORD_SECRET, @@ -1412,13 +1414,13 @@ const u16 gEasyChatWordsByLetter_S[] = { EC_WORD_SEE_YA, EC_POKEMON(SEEDOT), EC_WORD_SEEK, - EC_POKEMON2(SEEL), + EC_POKEMON_NATIONAL(SEEL), EC_WORD_SEEMS, EC_WORD_SEES, EC_MOVE2(SEISMIC_TOSS), EC_MOVE(SELF_DESTRUCT), EC_WORD_SENSE, - EC_POKEMON2(SENTRET), + EC_POKEMON_NATIONAL(SENTRET), EC_WORD_SERENE_GRACE, EC_WORD_SERIOUS, EC_WORD_SERIOUSLY, @@ -1441,7 +1443,7 @@ const u16 gEasyChatWordsByLetter_S[] = { EC_MOVE(SHEER_COLD), EC_POKEMON(SHELGON), EC_WORD_SHELL_ARMOR, - EC_POKEMON2(SHELLDER), + EC_POKEMON_NATIONAL(SHELLDER), EC_WORD_SHIELD_DUST, EC_POKEMON(SHIFTRY), EC_WORD_SHINE, @@ -1452,7 +1454,7 @@ const u16 gEasyChatWordsByLetter_S[] = { EC_WORD_SHOW, EC_WORD_SHREDDED, EC_POKEMON(SHROOMISH), - EC_POKEMON2(SHUCKLE), + EC_POKEMON_NATIONAL(SHUCKLE), EC_POKEMON(SHUPPET), EC_WORD_SIBLINGS, EC_WORD_SIGH, @@ -1466,14 +1468,14 @@ const u16 gEasyChatWordsByLetter_S[] = { EC_MOVE(SING), EC_WORD_SINK, EC_WORD_SISTER, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(SKARMORY), - EC_POKEMON2(SKARMORY), + EC_POKEMON_NATIONAL(SKARMORY), EC_MOVE(SKETCH), EC_WORD_SKILL, EC_MOVE(SKILL_SWAP), EC_WORD_SKILLED, - EC_POKEMON2(SKIPLOOM), + EC_POKEMON_NATIONAL(SKIPLOOM), EC_POKEMON(SKITTY), EC_MOVE2(SKULL_BASH), EC_MOVE(SKY_ATTACK), @@ -1489,34 +1491,34 @@ const u16 gEasyChatWordsByLetter_S[] = { EC_WORD_SLEPT, EC_WORD_SLIDE, EC_WORD_SLIMY, - EC_POKEMON2(SLOWBRO), - EC_POKEMON2(SLOWKING), - EC_POKEMON2(SLOWPOKE), + EC_POKEMON_NATIONAL(SLOWBRO), + EC_POKEMON_NATIONAL(SLOWKING), + EC_POKEMON_NATIONAL(SLOWPOKE), EC_MOVE2(SLUDGE), EC_MOVE2(SLUDGE_BOMB), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(SLUGMA), - EC_POKEMON2(SLUGMA), + EC_POKEMON_NATIONAL(SLUGMA), EC_WORD_SMACK, EC_WORD_SMALL, EC_WORD_SMART, EC_WORD_SMARTNESS, - EC_POKEMON2(SMEARGLE), + EC_POKEMON_NATIONAL(SMEARGLE), EC_WORD_SMELL, EC_WORD_SMELL_YA, EC_MOVE(SMELLING_SALTS), EC_WORD_SMITE, EC_MOVE(SMOG), EC_MOVE(SMOKESCREEN), - EC_POKEMON2(SMOOCHUM), + EC_POKEMON_NATIONAL(SMOOCHUM), EC_WORD_SMOOTH, EC_MOVE2(SNATCH), - EC_POKEMON2(SNEASEL), + EC_POKEMON_NATIONAL(SNEASEL), EC_MOVE(SNORE), - EC_POKEMON2(SNORLAX), + EC_POKEMON_NATIONAL(SNORLAX), EC_WORD_SNORT, EC_POKEMON(SNORUNT), - EC_POKEMON2(SNUBBULL), + EC_POKEMON_NATIONAL(SNUBBULL), EC_WORD_SO, EC_MOVE2(SOFT_BOILED), EC_WORD_SOFTWARE, @@ -1536,14 +1538,14 @@ const u16 gEasyChatWordsByLetter_S[] = { EC_WORD_SOUNDPROOF, EC_WORD_SP_ABILITY, EC_MOVE(SPARK), - EC_POKEMON2(SPEAROW), + EC_POKEMON_NATIONAL(SPEAROW), EC_WORD_SPECTATOR, EC_WORD_SPEED_BOOST, EC_POKEMON(SPHEAL), EC_MOVE(SPIDER_WEB), EC_MOVE2(SPIKE_CANNON), EC_MOVE2(SPIKES), - EC_POKEMON2(SPINARAK), + EC_POKEMON_NATIONAL(SPINARAK), EC_POKEMON(SPINDA), EC_WORD_SPIRALING, EC_WORD_SPIRIT, @@ -1554,21 +1556,21 @@ const u16 gEasyChatWordsByLetter_S[] = { EC_MOVE(SPORE), EC_WORD_SPORTS, EC_WORD_SPRING, - EC_POKEMON2(SQUIRTLE), + EC_POKEMON_NATIONAL(SQUIRTLE), EC_WORD_STAGE, - EC_POKEMON2(STANTLER), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(STANTLER), + DOUBLE_SPECIES_NAME EC_POKEMON(STARMIE), - EC_POKEMON2(STARMIE), + EC_POKEMON_NATIONAL(STARMIE), EC_WORD_START, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(STARYU), - EC_POKEMON2(STARYU), + EC_POKEMON_NATIONAL(STARYU), EC_WORD_STATIC, EC_WORD_STAY_AT_HOME, EC_WORD_STEEL, EC_MOVE2(STEEL_WING), - EC_POKEMON2(STEELIX), + EC_POKEMON_NATIONAL(STEELIX), EC_WORD_STENCH, EC_WORD_STICKY_HOLD, EC_MOVE2(STOCKPILE), @@ -1588,12 +1590,12 @@ const u16 gEasyChatWordsByLetter_S[] = { EC_MOVE(SUBMISSION), EC_MOVE2(SUBSTITUTE), EC_WORD_SUCTION_CUPS, - EC_POKEMON2(SUDOWOODO), - EC_POKEMON2(SUICUNE), + EC_POKEMON_NATIONAL(SUDOWOODO), + EC_POKEMON_NATIONAL(SUICUNE), EC_WORD_SUMMER, EC_WORD_SUNDAY, - EC_POKEMON2(SUNFLORA), - EC_POKEMON2(SUNKERN), + EC_POKEMON_NATIONAL(SUNFLORA), + EC_POKEMON_NATIONAL(SUNKERN), EC_MOVE2(SUNNY_DAY), EC_WORD_SUPER, EC_MOVE(SUPER_FANG), @@ -1615,7 +1617,7 @@ const u16 gEasyChatWordsByLetter_S[] = { EC_POKEMON(SWELLOW), EC_MOVE(SWIFT), EC_WORD_SWIFT_SWIM, - EC_POKEMON2(SWINUB), + EC_POKEMON_NATIONAL(SWINUB), EC_MOVE2(SWORDS_DANCE), EC_WORD_SYNCHRONIZE, EC_MOVE(SYNTHESIS), @@ -1633,24 +1635,24 @@ const u16 gEasyChatWordsByLetter_T[] = { EC_WORD_TALENT, EC_WORD_TALK, EC_WORD_TALKING, - EC_POKEMON2(TANGELA), + EC_POKEMON_NATIONAL(TANGELA), EC_WORD_TASTY, EC_MOVE2(TAUNT), - EC_POKEMON2(TAUROS), + EC_POKEMON_NATIONAL(TAUROS), EC_WORD_TCH, EC_WORD_TEACH, EC_WORD_TEACHER, EC_WORD_TEACHES, - EC_POKEMON2(TEDDIURSA), + EC_POKEMON_NATIONAL(TEDDIURSA), EC_MOVE2(TEETER_DANCE), EC_MOVE2(TELEPORT), EC_WORD_TELEVISION, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(TENTACOOL), - EC_POKEMON2(TENTACOOL), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(TENTACOOL), + DOUBLE_SPECIES_NAME EC_POKEMON(TENTACRUEL), - EC_POKEMON2(TENTACRUEL), + EC_POKEMON_NATIONAL(TENTACRUEL), EC_WORD_TERRIBLE, EC_WORD_TEST, EC_WORD_THAN, @@ -1704,9 +1706,9 @@ const u16 gEasyChatWordsByLetter_T[] = { EC_WORD_TO_US, EC_WORD_TO_WHOM, EC_WORD_TODAY, - EC_POKEMON2(TOGEPI), + EC_POKEMON_NATIONAL(TOGEPI), EC_WORD_TOGETHER, - EC_POKEMON2(TOGETIC), + EC_POKEMON_NATIONAL(TOGETIC), EC_WORD_TOMORROW, EC_WORD_TOO, EC_WORD_TOO_LATE, @@ -1718,7 +1720,7 @@ const u16 gEasyChatWordsByLetter_T[] = { EC_MOVE(TORMENT), EC_WORD_TORRENT, EC_WORD_TOTALLY, - EC_POKEMON2(TOTODILE), + EC_POKEMON_NATIONAL(TOTODILE), EC_WORD_TOUGH, EC_WORD_TOUGHNESS, EC_WORD_TOURNAMENT, @@ -1751,9 +1753,9 @@ const u16 gEasyChatWordsByLetter_T[] = { EC_WORD_TWIRLING, EC_MOVE2(TWISTER), EC_WORD_TYPE, - EC_POKEMON2(TYPHLOSION), - EC_POKEMON2(TYRANITAR), - EC_POKEMON2(TYROGUE), + EC_POKEMON_NATIONAL(TYPHLOSION), + EC_POKEMON_NATIONAL(TYRANITAR), + EC_POKEMON_NATIONAL(TYROGUE), }; const u16 gEasyChatWordsByLetter_U[] = { @@ -1761,7 +1763,7 @@ const u16 gEasyChatWordsByLetter_U[] = { EC_WORD_UH_HUH, EC_WORD_UH_OH, EC_WORD_UM, - EC_POKEMON2(UMBREON), + EC_POKEMON_NATIONAL(UMBREON), EC_WORD_UNAVOIDABLE, EC_WORD_UNBELIEVABLE, EC_WORD_UNCLE, @@ -1769,14 +1771,14 @@ const u16 gEasyChatWordsByLetter_U[] = { EC_WORD_UNDERSTANDS, EC_WORD_UNDERSTOOD, EC_WORD_UNION, - EC_POKEMON2(UNOWN), + EC_POKEMON_NATIONAL(UNOWN), EC_WORD_UNTIL, EC_WORD_UP, EC_WORD_UPBEAT, EC_MOVE(UPROAR), EC_WORD_UPSIDE_DOWN, EC_WORD_URGH, - EC_POKEMON2(URSARING), + EC_POKEMON_NATIONAL(URSARING), EC_WORD_USE, EC_WORD_USELESS, EC_WORD_USES, @@ -1785,35 +1787,35 @@ const u16 gEasyChatWordsByLetter_U[] = { const u16 gEasyChatWordsByLetter_V[] = { EC_WORD_VACATION, - EC_POKEMON2(VAPOREON), - EC_POKEMON2(VENOMOTH), - EC_POKEMON2(VENONAT), - EC_POKEMON2(VENUSAUR), + EC_POKEMON_NATIONAL(VAPOREON), + EC_POKEMON_NATIONAL(VENOMOTH), + EC_POKEMON_NATIONAL(VENONAT), + EC_POKEMON_NATIONAL(VENUSAUR), EC_WORD_VERSION, EC_WORD_VERSUS, EC_WORD_VERY, EC_POKEMON(VIBRAVA), EC_MOVE2(VISE_GRIP), EC_WORD_VICTORY, - EC_POKEMON2(VICTREEBEL), + EC_POKEMON_NATIONAL(VICTREEBEL), EC_WORD_VIEWING, EC_POKEMON(VIGOROTH), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(VILEPLUME), - EC_POKEMON2(VILEPLUME), + EC_POKEMON_NATIONAL(VILEPLUME), EC_MOVE2(VINE_WHIP), EC_WORD_VITAL_SPIRIT, EC_MOVE(VITAL_THROW), EC_POKEMON(VOLBEAT), EC_WORD_VOLT_ABSORB, EC_MOVE2(VOLT_TACKLE), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(VOLTORB), - EC_POKEMON2(VOLTORB), + EC_POKEMON_NATIONAL(VOLTORB), EC_WORD_VORACIOUS, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(VULPIX), - EC_POKEMON2(VULPIX), + EC_POKEMON_NATIONAL(VULPIX), }; const u16 gEasyChatWordsByLetter_W[] = { @@ -1832,7 +1834,7 @@ const u16 gEasyChatWordsByLetter_W[] = { EC_WORD_WANNABE, EC_WORD_WANT, EC_WORD_WANTS, - EC_POKEMON2(WARTORTLE), + EC_POKEMON_NATIONAL(WARTORTLE), EC_WORD_WAS, EC_WORD_WASN_T, EC_WORD_WATER, @@ -1851,12 +1853,12 @@ const u16 gEasyChatWordsByLetter_W[] = { EC_WORD_WEAKENED, EC_MOVE(WEATHER_BALL), EC_WORD_WEDNESDAY, - EC_POKEMON2(WEEDLE), + EC_POKEMON_NATIONAL(WEEDLE), EC_WORD_WEEK, - EC_POKEMON2(WEEPINBELL), - -1, 2, // Doubled pokemon species name + EC_POKEMON_NATIONAL(WEEPINBELL), + DOUBLE_SPECIES_NAME EC_POKEMON(WEEZING), - EC_POKEMON2(WEEZING), + EC_POKEMON_NATIONAL(WEEZING), EC_WORD_WEIRD, EC_WORD_WELCOME, EC_WORD_WELL, @@ -1883,9 +1885,9 @@ const u16 gEasyChatWordsByLetter_W[] = { EC_WORD_WHOM, EC_WORD_WHOSE, EC_WORD_WHY, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(WIGGLYTUFF), - EC_POKEMON2(WIGGLYTUFF), + EC_POKEMON_NATIONAL(WIGGLYTUFF), EC_WORD_WILD, EC_WORD_WILL, EC_WORD_WILL_BE_HERE, @@ -1903,15 +1905,15 @@ const u16 gEasyChatWordsByLetter_W[] = { EC_MOVE(WITHDRAW), EC_WORD_WITHOUT, EC_WORD_WOBBLY, - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(WOBBUFFET), - EC_POKEMON2(WOBBUFFET), + EC_POKEMON_NATIONAL(WOBBUFFET), EC_WORD_WOMAN, EC_WORD_WON, EC_WORD_WON_T, EC_WORD_WONDER, EC_WORD_WONDER_GUARD, - EC_POKEMON2(WOOPER), + EC_POKEMON_NATIONAL(WOOPER), EC_WORD_WORD, EC_WORD_WORK, EC_WORD_WORKING, @@ -1928,14 +1930,14 @@ const u16 gEasyChatWordsByLetter_W[] = { }; const u16 gEasyChatWordsByLetter_X[] = { - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(XATU), - EC_POKEMON2(XATU), + EC_POKEMON_NATIONAL(XATU), }; const u16 gEasyChatWordsByLetter_Y[] = { EC_WORD_YAHOO, - EC_POKEMON2(YANMA), + EC_POKEMON_NATIONAL(YANMA), EC_MOVE(YAWN), EC_WORD_YAY, EC_WORD_YEAH, @@ -1958,59 +1960,59 @@ const u16 gEasyChatWordsByLetter_Y[] = { const u16 gEasyChatWordsByLetter_Z[] = { EC_POKEMON(ZANGOOSE), EC_MOVE2(ZAP_CANNON), - EC_POKEMON2(ZAPDOS), + EC_POKEMON_NATIONAL(ZAPDOS), EC_POKEMON(ZIGZAGOON), - -1, 2, // Doubled pokemon species name + DOUBLE_SPECIES_NAME EC_POKEMON(ZUBAT), - EC_POKEMON2(ZUBAT), + EC_POKEMON_NATIONAL(ZUBAT), }; const u16 gEasyChatWordsByLetter_UnusedJapaneseHi[] = { - EC_POKEMON2(CLEFFA), + EC_POKEMON_NATIONAL(CLEFFA), EC_WORD_AIYEEH, - EC_POKEMON2(WEEDLE), + EC_POKEMON_NATIONAL(WEEDLE), EC_WORD_HERO, - -1, 2, // Doubled pokemon species name - EC_POKEMON2(PIKACHU), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(PIKACHU), EC_POKEMON(PIKACHU), EC_MOVE2(LIGHT_SCREEN), EC_WORD_SHINE, EC_WORD_LOW, - EC_POKEMON2(CLEFABLE), + EC_POKEMON_NATIONAL(CLEFABLE), EC_WORD_FLYING, - EC_POKEMON2(PIDGEOT), - EC_POKEMON2(PIDGEOTTO), + EC_POKEMON_NATIONAL(PIDGEOT), + EC_POKEMON_NATIONAL(PIDGEOTTO), EC_WORD_LEFT, - -1, 2, // Doubled pokemon species name - EC_POKEMON2(PICHU), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(PICHU), EC_POKEMON(PICHU), EC_MOVE2(SCRATCH), EC_WORD_SURPRISE, EC_MOVE2(HYPER_FANG), - EC_POKEMON2(CLEFAIRY), + EC_POKEMON_NATIONAL(CLEFAIRY), EC_WORD_DROUGHT, EC_WORD_HIDDEN, EC_WORD_PERSON, EC_WORD_AWFUL, - EC_POKEMON2(CHARMANDER), - -1, 2, // Doubled pokemon species name - EC_POKEMON2(STARYU), + EC_POKEMON_NATIONAL(CHARMANDER), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(STARYU), EC_POKEMON(STARYU), EC_WORD_ALONE, - EC_POKEMON2(CYNDAQUIL), + EC_POKEMON_NATIONAL(CYNDAQUIL), EC_MOVE2(EMBER), EC_POKEMON(VIBRAVA), EC_WORD_BORED, - EC_POKEMON2(SUNKERN), + EC_POKEMON_NATIONAL(SUNKERN), EC_WORD_SECRET, EC_WORD_SECRET_BASE, EC_MOVE2(SECRET_POWER), - EC_POKEMON2(TEDDIURSA), + EC_POKEMON_NATIONAL(TEDDIURSA), EC_WORD_HIYAH, EC_MOVE2(DIZZY_PUNCH), EC_WORD_LIGHTNINGROD, - -1, 2, // Doubled pokemon species name - EC_POKEMON2(VOLTORB), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(VOLTORB), EC_POKEMON(VOLTORB), EC_WORD_DAYTIME, EC_MOVE2(BULK_UP), @@ -2021,42 +2023,42 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseHi[] = { const u16 gEasyChatWordsByLetter_UnusedJapaneseFu[] = { EC_WORD_FIGHT, - EC_POKEMON2(MOLTRES), + EC_POKEMON_NATIONAL(MOLTRES), EC_WORD_FASHION, EC_WORD_FEAR, EC_WORD_FEVER, EC_MOVE2(IMPRISON), - EC_POKEMON2(FLAREON), - -1, 2, // Doubled pokemon species name - EC_POKEMON2(ALAKAZAM), + EC_POKEMON_NATIONAL(FLAREON), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(ALAKAZAM), EC_POKEMON(ALAKAZAM), - EC_POKEMON2(MAGMAR), + EC_POKEMON_NATIONAL(MAGMAR), EC_POKEMON(GRUMPIG), EC_MOVE2(FEATHER_DANCE), - EC_POKEMON2(FORRETRESS), + EC_POKEMON_NATIONAL(FORRETRESS), EC_MOVE2(WHIRLWIND), EC_WORD_COMPOUNDEYES, - -1, 2, // Doubled pokemon species name - EC_POKEMON2(WIGGLYTUFF), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(WIGGLYTUFF), EC_POKEMON(WIGGLYTUFF), EC_MOVE2(BEAT_UP), EC_WORD_MYSTERY, - EC_POKEMON2(IVYSAUR), - EC_POKEMON2(BULBASAUR), + EC_POKEMON_NATIONAL(IVYSAUR), + EC_POKEMON_NATIONAL(BULBASAUR), EC_WORD_MARVEL_SCALE, EC_WORD_WONDER_GUARD, - EC_POKEMON2(VENUSAUR), + EC_POKEMON_NATIONAL(VENUSAUR), EC_WORD_LACKS, EC_WORD_RESUSCITATE, EC_WORD_SMACK, EC_WORD_FUFUFU, - EC_POKEMON2(AERODACTYL), + EC_POKEMON_NATIONAL(AERODACTYL), EC_WORD_WIMPY, - EC_POKEMON2(MAGBY), + EC_POKEMON_NATIONAL(MAGBY), EC_WORD_LOL, EC_MOVE2(BLIZZARD), - -1, 2, // Doubled pokemon species name - EC_POKEMON2(IGGLYBUFF), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(IGGLYBUFF), EC_POKEMON(IGGLYBUFF), EC_WORD_SNORT, EC_MOVE2(STOMP), @@ -2067,17 +2069,17 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseFu[] = { EC_WORD_PLUS, EC_MOVE2(BLAST_BURN), EC_POKEMON(PLUSLE), - EC_POKEMON2(UMBREON), + EC_POKEMON_NATIONAL(UMBREON), EC_MOVE2(FLASH), EC_WORD_WOBBLY, EC_MOVE2(TEETER_DANCE), EC_WORD_PRETEND, - EC_POKEMON2(ARTICUNO), + EC_POKEMON_NATIONAL(ARTICUNO), EC_WORD_WANNABE, - -1, 2, // Doubled pokemon species name - EC_POKEMON2(JIGGLYPUFF), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(JIGGLYPUFF), EC_POKEMON(JIGGLYPUFF), - EC_POKEMON2(SNUBBULL), + EC_POKEMON_NATIONAL(SNUBBULL), EC_WORD_SHAKY, EC_MOVE2(CRUSH_CLAW), EC_MOVE2(BLAZE_KICK), @@ -2093,29 +2095,29 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseHe[] = { EC_WORD_HEY, EC_POKEMON(CORPHISH), EC_WORD_BABY, - EC_POKEMON2(BAYLEEF), + EC_POKEMON_NATIONAL(BAYLEEF), EC_WORD_BEST, EC_WORD_LOUSY, EC_WORD_HEHEHE, - -1, 2, // Doubled pokemon species name - EC_POKEMON2(GRIMER), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(GRIMER), EC_POKEMON(GRIMER), - -1, 2, // Doubled pokemon species name - EC_POKEMON2(MUK), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(MUK), EC_POKEMON(MUK), EC_WORD_LIQUID_OOZE, EC_MOVE2(SLUDGE), EC_MOVE2(SLUDGE_BOMB), EC_MOVE2(GLARE), EC_WORD_HEH, - -1, 2, // Doubled pokemon species name - EC_POKEMON2(HERACROSS), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(HERACROSS), EC_POKEMON(HERACROSS), EC_POKEMON(PELIPPER), - EC_POKEMON2(HOUNDOOM), - EC_POKEMON2(PERSIAN), + EC_POKEMON_NATIONAL(HOUNDOOM), + EC_POKEMON_NATIONAL(PERSIAN), EC_WORD_RIPPED, - EC_POKEMON2(LICKITUNG), + EC_POKEMON_NATIONAL(LICKITUNG), EC_WORD_STUDY, EC_WORD_COLOR_CHANGE, EC_MOVE2(TRANSFORM), @@ -2124,7 +2126,7 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseHe[] = { const u16 gEasyChatWordsByLetter_UnusedJapaneseHo[] = { EC_MOVE2(POISON_TAIL), EC_WORD_POINTS, - EC_POKEMON2(HO_OH), + EC_POKEMON_NATIONAL(HO_OH), EC_WORD_SOUNDPROOF, EC_WORD_ADVENTURE, EC_WORD_EFFECT_SPORE, @@ -2133,7 +2135,7 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseHo[] = { EC_POKEMON(WAILMER), EC_WORD_DUDE, EC_WORD_BOARD, - EC_POKEMON2(HOOTHOOT), + EC_POKEMON_NATIONAL(HOOTHOOT), EC_POKEMON(SALAMENCE), EC_WORD_BALL, EC_MOVE2(BONE_RUSH), @@ -2154,21 +2156,21 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseHo[] = { EC_POKEMON(AGGRON), EC_MOVE2(TAIL_GLOW), EC_POKEMON(POOCHYENA), - EC_POKEMON2(PIDGEY), + EC_POKEMON_NATIONAL(PIDGEY), EC_WORD_AS_MUCH_AS, - EC_POKEMON2(PONYTA), + EC_POKEMON_NATIONAL(PONYTA), EC_MOVE2(BONE_CLUB), EC_MOVE2(BONEMERANG), EC_WORD_FIRE, EC_MOVE2(FIRE_SPIN), EC_WORD_FLAME_BODY, EC_MOVE2(FIRE_PUNCH), - EC_POKEMON2(SKIPLOOM), + EC_POKEMON_NATIONAL(SKIPLOOM), EC_WORD_HOHOHO, EC_WORD_PRAISE, EC_WORD_UH_HUH, - EC_POKEMON2(PORYGON), - EC_POKEMON2(PORYGON2), + EC_POKEMON_NATIONAL(PORYGON), + EC_POKEMON_NATIONAL(PORYGON2), EC_MOVE2(VOLT_TACKLE), EC_WORD_POKEBLOCK, EC_MOVE2(PERISH_SONG), @@ -2189,16 +2191,16 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseMa[] = { EC_WORD_OWN_TEMPO, EC_MOVE2(WRAP), EC_MOVE2(SPIKES), - -1, 2, // Doubled pokemon species name - EC_POKEMON2(MAGCARGO), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(MAGCARGO), EC_POKEMON(MAGCARGO), EC_MOVE2(MAGNITUDE), EC_POKEMON(MAKUHITA), - -1, 2, // Doubled pokemon species name - EC_POKEMON2(SLUGMA), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(SLUGMA), EC_POKEMON(SLUGMA), EC_WORD_MAGMA_ARMOR, - EC_POKEMON2(QUILAVA), + EC_POKEMON_NATIONAL(QUILAVA), EC_WORD_OVERDO, EC_WORD_LOSS, EC_WORD_IF_I_LOSE, @@ -2214,9 +2216,9 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseMa[] = { EC_WORD_INCREASING, EC_WORD_TOO, EC_WORD_LIKE, - EC_POKEMON2(BELLSPROUT), - -1, 2, // Doubled pokemon species name - EC_POKEMON2(WEEZING), + EC_POKEMON_NATIONAL(BELLSPROUT), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(WEEZING), EC_POKEMON(WEEZING), EC_WORD_SMELL, EC_WORD_YET, @@ -2231,23 +2233,23 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseMa[] = { EC_WORD_GUARD, EC_MOVE2(PROTECT), EC_POKEMON(CASCOON), - -1, 2, // Doubled pokemon species name - EC_POKEMON2(MARILL), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(MARILL), EC_POKEMON(MARILL), - -1, 2, // Doubled pokemon species name - EC_POKEMON2(AZUMARILL), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(AZUMARILL), EC_POKEMON(AZUMARILL), EC_MOVE2(DEFENSE_CURL), EC_WORD_AS_IF, EC_POKEMON(SWALOT), - -1, 2, // Doubled pokemon species name - EC_POKEMON2(ELECTRODE), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(ELECTRODE), EC_POKEMON(ELECTRODE), EC_MOVE2(ROLLING_KICK), EC_WORD_COMICS, - EC_POKEMON2(MANKEY), + EC_POKEMON_NATIONAL(MANKEY), EC_WORD_SATISFIED, - EC_POKEMON2(MANTINE), + EC_POKEMON_NATIONAL(MANTINE), }; const u16 gEasyChatWordsByLetter_UnusedJapaneseMi[] = { @@ -2272,16 +2274,16 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseMi[] = { EC_WORD_LOOKS, EC_WORD_REJECT, EC_WORD_ACCEPT, - EC_POKEMON2(DRATINI), + EC_POKEMON_NATIONAL(DRATINI), EC_MOVE2(FALSE_SWIPE), EC_MOVE2(FORESIGHT), - EC_POKEMON2(MEW), - EC_POKEMON2(MEWTWO), + EC_POKEMON_NATIONAL(MEW), + EC_POKEMON_NATIONAL(MEWTWO), EC_MOVE2(MIRROR_COAT), EC_MOVE2(FUTURE_SIGHT), EC_WORD_SEES, EC_MOVE2(MILK_DRINK), - EC_POKEMON2(MILTANK), + EC_POKEMON_NATIONAL(MILTANK), EC_POKEMON(MILOTIC), EC_WORD_WE, EC_WORD_BEEN, @@ -2292,13 +2294,13 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseMi[] = { const u16 gEasyChatWordsByLetter_UnusedJapaneseMu[] = { EC_WORD_MOOD, - EC_POKEMON2(MISDREAVUS), + EC_POKEMON_NATIONAL(MISDREAVUS), EC_WORD_OLDEN, EC_WORD_ARRGH, EC_WORD_BUG, EC_WORD_SWARM, EC_WORD_RATHER, - EC_POKEMON2(SMOOCHUM), + EC_POKEMON_NATIONAL(SMOOCHUM), EC_WORD_INVINCIBLE, EC_WORD_HEART, EC_WORD_MUFUFU, @@ -2311,23 +2313,23 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseMe[] = { EC_MOVE2(MEGA_DRAIN), EC_MOVE2(MEGA_KICK), EC_MOVE2(MEGA_PUNCH), - EC_POKEMON2(MEGANIUM), + EC_POKEMON_NATIONAL(MEGANIUM), EC_MOVE2(MEGAHORN), EC_WORD_SEEK, EC_MOVE2(HIDDEN_POWER), EC_WORD_RARE, EC_POKEMON(METAGROSS), - EC_POKEMON2(DITTO), + EC_POKEMON_NATIONAL(DITTO), EC_MOVE2(METAL_CLAW), EC_POKEMON(METANG), EC_WORD_DESTROYED, EC_WORD_MESSAGE, EC_WORD_AWFULLY, - -1, 2, // Doubled pokemon species name - EC_POKEMON2(TENTACOOL), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(TENTACOOL), EC_POKEMON(TENTACOOL), EC_WORD_FIERY, - EC_POKEMON2(MAREEP), + EC_POKEMON_NATIONAL(MAREEP), EC_MOVE2(ATTRACT), EC_WORD_CUTE_CHARM, EC_WORD_IMMUNITY, @@ -2340,7 +2342,7 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseMo[] = { EC_WORD_MODE, EC_WORD_OLD, EC_WORD_THURSDAY, - EC_POKEMON2(FLAAFFY), + EC_POKEMON_NATIONAL(FLAAFFY), EC_WORD_LISTENING, EC_WORD_OWN, EC_WORD_MORE, @@ -2351,9 +2353,9 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseMo[] = { EC_WORD_PATTERN, EC_WORD_FLASH_FIRE, EC_WORD_RECEIVED, - EC_POKEMON2(VENOMOTH), + EC_POKEMON_NATIONAL(VENOMOTH), EC_WORD_DOESN_T, - EC_POKEMON2(TANGELA), + EC_POKEMON_NATIONAL(TANGELA), }; const u16 gEasyChatWordsByLetter_UnusedJapaneseYa[] = { @@ -2368,19 +2370,19 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseYa[] = { EC_WORD_FINALLY, EC_WORD_ANY, EC_WORD_YAHOO, - EC_POKEMON2(SLOWKING), - EC_POKEMON2(SLOWBRO), + EC_POKEMON_NATIONAL(SLOWKING), + EC_POKEMON_NATIONAL(SLOWBRO), EC_MOVE2(LEECH_SEED), - EC_POKEMON2(SLOWPOKE), + EC_POKEMON_NATIONAL(SLOWPOKE), EC_WORD_DANGER, - EC_POKEMON2(MURKROW), + EC_POKEMON_NATIONAL(MURKROW), EC_POKEMON(SABLEYE), EC_WORD_DEFEATED, EC_WORD_BEAT, EC_WORD_VITAL_SPIRIT, EC_POKEMON(VIGOROTH), EC_WORD_YOUNG, - EC_POKEMON2(YANMA), + EC_POKEMON_NATIONAL(YANMA), }; const u16 gEasyChatWordsByLetter_UnusedJapaneseYu[] = { @@ -2393,8 +2395,8 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseYu[] = { EC_WORD_ALLOW, EC_WORD_FORGET, EC_POKEMON(CRADILY), - -1, 2, // Doubled pokemon species name - EC_POKEMON2(KADABRA), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(KADABRA), EC_POKEMON(KADABRA), }; @@ -2406,7 +2408,7 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseYo[] = { EC_WORD_KINDERGARTEN, EC_WORD_CHLOROPHYLL, EC_WORD_AFTER, - EC_POKEMON2(LARVITAR), + EC_POKEMON_NATIONAL(LARVITAR), EC_WORD_OH_KAY, EC_WORD_BEFORE, EC_WORD_GREAT, @@ -2422,7 +2424,7 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseYo[] = { EC_WORD_EASY, EC_WORD_INSTEAD, EC_WORD_NIGHT, - EC_POKEMON2(NOCTOWL), + EC_POKEMON_NATIONAL(NOCTOWL), EC_WORD_COUNT_ON, EC_WORD_WEAK, EC_WORD_TOO_WEAK, @@ -2430,10 +2432,10 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseYo[] = { }; const u16 gEasyChatWordsByLetter_UnusedJapaneseRa[] = { - EC_POKEMON2(RAIKOU), + EC_POKEMON_NATIONAL(RAIKOU), EC_WORD_WEEK, - -1, 2, // Doubled pokemon species name - EC_POKEMON2(RAICHU), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(RAICHU), EC_POKEMON(RAICHU), EC_WORD_RIVAL, EC_WORD_LIFE, @@ -2445,31 +2447,31 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseRa[] = { EC_WORD_SEEMS, EC_WORD_RADIO, EC_MOVE2(LUSTER_PURGE), - EC_POKEMON2(CHANSEY), - EC_POKEMON2(RATICATE), + EC_POKEMON_NATIONAL(CHANSEY), + EC_POKEMON_NATIONAL(RATICATE), EC_POKEMON(LATIAS), EC_POKEMON(LATIOS), EC_POKEMON(LUVDISC), - EC_POKEMON2(LAPRAS), + EC_POKEMON_NATIONAL(LAPRAS), EC_WORD_LOVEY_DOVEY, - -1, 2, // Doubled pokemon species name - EC_POKEMON2(VILEPLUME), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(VILEPLUME), EC_POKEMON(VILEPLUME), EC_WORD_LALALA, EC_POKEMON(RALTS), EC_WORD_FORGETS, EC_WORD_APPEARS, EC_WORD_RANK, - -1, 2, // Doubled pokemon species name - EC_POKEMON2(LANTURN), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(LANTURN), EC_POKEMON(LANTURN), }; const u16 gEasyChatWordsByLetter_UnusedJapaneseRi[] = { EC_WORD_LEADER, EC_MOVE2(LEAF_BLADE), - EC_POKEMON2(CHARMELEON), - EC_POKEMON2(CHARIZARD), + EC_POKEMON_NATIONAL(CHARMELEON), + EC_POKEMON_NATIONAL(CHARIZARD), EC_MOVE2(RECYCLE), EC_MOVE2(REFLECT), EC_MOVE2(REFRESH), @@ -2481,15 +2483,15 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseRi[] = { EC_MOVE2(DRAGON_DANCE), EC_WORD_VACATION, EC_POKEMON(LILEEP), - EC_POKEMON2(URSARING), + EC_POKEMON_NATIONAL(URSARING), EC_WORD_SHIELD_DUST, }; const u16 gEasyChatWordsByLetter_UnusedJapaneseRu[] = { - EC_POKEMON2(JYNX), + EC_POKEMON_NATIONAL(JYNX), EC_WORD_ROOM, EC_WORD_RULE, - EC_POKEMON2(LUGIA), + EC_POKEMON_NATIONAL(LUGIA), EC_WORD_LOOK, EC_POKEMON(LUNATONE), EC_WORD_RUBY, @@ -2500,8 +2502,8 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseRu[] = { }; const u16 gEasyChatWordsByLetter_UnusedJapaneseRe[] = { - -1, 2, // Doubled pokemon species name - EC_POKEMON2(MAGNETON), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(MAGNETON), EC_POKEMON(MAGNETON), EC_MOVE2(ICE_PUNCH), EC_MOVE2(ICE_BEAM), @@ -2510,8 +2512,8 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseRe[] = { EC_POKEMON(REGIROCK), EC_POKEMON(RAYQUAZA), EC_WORD_UGLY, - EC_POKEMON2(LEDIAN), - EC_POKEMON2(LEDYBA), + EC_POKEMON_NATIONAL(LEDIAN), + EC_POKEMON_NATIONAL(LEDYBA), EC_WORD_FANTASTIC, EC_WORD_LEVEL, EC_MOVE2(FURY_CUTTER), @@ -2521,8 +2523,8 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseRe[] = { const u16 gEasyChatWordsByLetter_UnusedJapaneseRo[] = { EC_MOVE2(SKULL_BASH), - -1, 2, // Doubled pokemon species name - EC_POKEMON2(VULPIX), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(VULPIX), EC_POKEMON(VULPIX), EC_POKEMON(ROSELIA), EC_MOVE2(LOCK_ON), @@ -2553,198 +2555,198 @@ const u16 gEasyChatWordsByLetter_UnusedJapaneseWa[] = { EC_WORD_HERS, EC_WORD_SHE_IS, EC_WORD_SOME, - EC_POKEMON2(JUMPLUFF), + EC_POKEMON_NATIONAL(JUMPLUFF), EC_MOVE2(COTTON_SPORE), EC_WORD_GWAH, - EC_POKEMON2(TOTODILE), + EC_POKEMON_NATIONAL(TOTODILE), EC_WORD_WAHAHAHA, EC_WORD_ANYWHERE, EC_MOVE2(STRUGGLE), EC_WORD_BADLY, - -1, 2, // Doubled pokemon species name - EC_POKEMON2(MACHOP), + DOUBLE_SPECIES_NAME + EC_POKEMON_NATIONAL(MACHOP), EC_POKEMON(MACHOP), }; -const struct EasyChatWordsByLetter gEasyChatWordsByLetterPointers[] = { +const struct EasyChatWordsByLetter gEasyChatWordsByLetterPointers[EC_NUM_ALPHABET_GROUPS + 18] = { // 18 unused JP groups { .words = gEasyChatWordsByLetter_Others, - .numWords = 10, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_Others), }, { .words = gEasyChatWordsByLetter_A, - .numWords = 106, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_A), }, { .words = gEasyChatWordsByLetter_B, - .numWords = 86, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_B), }, { .words = gEasyChatWordsByLetter_C, - .numWords = 119, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_C), }, { .words = gEasyChatWordsByLetter_D, - .numWords = 94, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_D), }, { .words = gEasyChatWordsByLetter_E, - .numWords = 59, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_E), }, { .words = gEasyChatWordsByLetter_F, - .numWords = 80, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_F), }, { .words = gEasyChatWordsByLetter_G, - .numWords = 98, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_G), }, { .words = gEasyChatWordsByLetter_H, - .numWords = 101, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_H), }, { .words = gEasyChatWordsByLetter_I, - .numWords = 48, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_I), }, { .words = gEasyChatWordsByLetter_J, - .numWords = 13, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_J), }, { .words = gEasyChatWordsByLetter_K, - .numWords = 33, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_K), }, { .words = gEasyChatWordsByLetter_L, - .numWords = 82, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_L), }, { .words = gEasyChatWordsByLetter_M, - .numWords = 142, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_M), }, { .words = gEasyChatWordsByLetter_N, - .numWords = 54, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_N), }, { .words = gEasyChatWordsByLetter_O, - .numWords = 44, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_O), }, { .words = gEasyChatWordsByLetter_P, - .numWords = 102, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_P), }, { .words = gEasyChatWordsByLetter_Q, - .numWords = 6, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_Q), }, { .words = gEasyChatWordsByLetter_R, - .numWords = 80, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_R), }, { .words = gEasyChatWordsByLetter_S, - .numWords = 262, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_S), }, { .words = gEasyChatWordsByLetter_T, - .numWords = 133, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_T), }, { .words = gEasyChatWordsByLetter_U, - .numWords = 24, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_U), }, { .words = gEasyChatWordsByLetter_V, - .numWords = 33, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_V), }, { .words = gEasyChatWordsByLetter_W, - .numWords = 111, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_W), }, { .words = gEasyChatWordsByLetter_X, - .numWords = 4, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_X), }, { .words = gEasyChatWordsByLetter_Y, - .numWords = 19, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_Y), }, { .words = gEasyChatWordsByLetter_Z, - .numWords = 8, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_Z), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseHi, - .numWords = 55, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseHi), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseFu, - .numWords = 71, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseFu), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseHe, - .numWords = 32, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseHe), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseHo, - .numWords = 55, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseHo), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseMa, - .numWords = 74, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseMa), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseMi, - .numWords = 37, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseMi), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseMu, - .numWords = 12, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseMu), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseMe, - .numWords = 26, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseMe), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseMo, - .numWords = 20, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseMo), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseYa, - .numWords = 24, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseYa), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseYu, - .numWords = 13, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseYu), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseYo, - .numWords = 28, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseYo), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseRa, - .numWords = 36, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseRa), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseRi, - .numWords = 17, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseRi), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseRu, - .numWords = 11, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseRu), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseRe, - .numWords = 18, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseRe), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseRo, - .numWords = 10, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseRo), }, { .words = gEasyChatWordsByLetter_UnusedJapaneseWa, - .numWords = 33, + .numWords = ARRAY_COUNT(gEasyChatWordsByLetter_UnusedJapaneseWa), }, }; diff --git a/src/data/items.h b/src/data/items.h index 443c45f1a..e4e7e0fbc 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -1479,7 +1479,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = ITEM_ORANGE_MAIL - FIRST_MAIL_INDEX, + .secondaryId = ITEM_TO_MAIL(ITEM_ORANGE_MAIL), }, [ITEM_HARBOR_MAIL] = @@ -1491,7 +1491,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = ITEM_HARBOR_MAIL - FIRST_MAIL_INDEX, + .secondaryId = ITEM_TO_MAIL(ITEM_HARBOR_MAIL), }, [ITEM_GLITTER_MAIL] = @@ -1503,7 +1503,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = ITEM_GLITTER_MAIL - FIRST_MAIL_INDEX, + .secondaryId = ITEM_TO_MAIL(ITEM_GLITTER_MAIL), }, [ITEM_MECH_MAIL] = @@ -1515,7 +1515,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = ITEM_MECH_MAIL - FIRST_MAIL_INDEX, + .secondaryId = ITEM_TO_MAIL(ITEM_MECH_MAIL), }, [ITEM_WOOD_MAIL] = @@ -1527,7 +1527,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = ITEM_WOOD_MAIL - FIRST_MAIL_INDEX, + .secondaryId = ITEM_TO_MAIL(ITEM_WOOD_MAIL), }, [ITEM_WAVE_MAIL] = @@ -1539,7 +1539,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = ITEM_WAVE_MAIL - FIRST_MAIL_INDEX, + .secondaryId = ITEM_TO_MAIL(ITEM_WAVE_MAIL), }, [ITEM_BEAD_MAIL] = @@ -1551,7 +1551,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = ITEM_BEAD_MAIL - FIRST_MAIL_INDEX, + .secondaryId = ITEM_TO_MAIL(ITEM_BEAD_MAIL), }, [ITEM_SHADOW_MAIL] = @@ -1563,7 +1563,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = ITEM_SHADOW_MAIL - FIRST_MAIL_INDEX, + .secondaryId = ITEM_TO_MAIL(ITEM_SHADOW_MAIL), }, [ITEM_TROPIC_MAIL] = @@ -1575,7 +1575,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = ITEM_TROPIC_MAIL - FIRST_MAIL_INDEX, + .secondaryId = ITEM_TO_MAIL(ITEM_TROPIC_MAIL), }, [ITEM_DREAM_MAIL] = @@ -1587,7 +1587,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = ITEM_DREAM_MAIL - FIRST_MAIL_INDEX, + .secondaryId = ITEM_TO_MAIL(ITEM_DREAM_MAIL), }, [ITEM_FAB_MAIL] = @@ -1599,7 +1599,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = ITEM_FAB_MAIL - FIRST_MAIL_INDEX, + .secondaryId = ITEM_TO_MAIL(ITEM_FAB_MAIL), }, [ITEM_RETRO_MAIL] = @@ -1611,7 +1611,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = ITEM_RETRO_MAIL - FIRST_MAIL_INDEX, + .secondaryId = ITEM_TO_MAIL(ITEM_RETRO_MAIL), }, // Berries diff --git a/src/data/lilycove_lady.h b/src/data/lilycove_lady.h index 37bae7e95..818a5fd5f 100644 --- a/src/data/lilycove_lady.h +++ b/src/data/lilycove_lady.h @@ -53,7 +53,7 @@ static const u16 sQuizLadyQuestion3[] = EC_WORD_POKEMON, EC_WORD_EVOLVE, EC_WORD_QUES, - 0xFFFF, + EC_EMPTY_WORD, EC_WORD_LEVEL, EC_WORD_INSOMNIA, EC_WORD_CUTE_CHARM @@ -92,7 +92,7 @@ static const u16 sQuizLadyQuestion6[] = EC_WORD_STOP, EC_MOVE2(CONFUSION), EC_WORD_QUES, - 0xFFFF, + EC_EMPTY_WORD, EC_WORD_ILLUMINATE, EC_WORD_OWN_TEMPO, EC_WORD_SWIFT_SWIM @@ -118,7 +118,7 @@ static const u16 sQuizLadyQuestion8[] = EC_MOVE2(BLOCK), EC_WORD_ESCAPE, EC_WORD_QUES, - 0xFFFF, + EC_EMPTY_WORD, EC_WORD_RUN_AWAY, EC_WORD_SHADOW_TAG, EC_WORD_WONDER_GUARD @@ -131,7 +131,7 @@ static const u16 sQuizLadyQuestion9[] = EC_WORD_STOP, EC_WORD_POISON, EC_WORD_QUES, - 0xFFFF, + EC_EMPTY_WORD, EC_WORD_GUTS, EC_WORD_IMMUNITY, EC_WORD_SHED_SKIN @@ -144,7 +144,7 @@ static const u16 sQuizLadyQuestion10[] = EC_WORD_WITH, EC_WORD_CENTER, EC_WORD_QUES, - 0xFFFF, + EC_EMPTY_WORD, EC_WORD_POKEDEX, EC_WORD_POKEMON, EC_WORD_POKENAV @@ -157,7 +157,7 @@ static const u16 sQuizLadyQuestion11[] = EC_WORD_YOUR, EC_WORD_POKEMON, EC_WORD_QUES, - 0xFFFF, + EC_EMPTY_WORD, EC_WORD_PC, EC_WORD_DEPT_STORE, EC_WORD_TELEVISION @@ -199,7 +199,7 @@ static const u16 sQuizLadyQuestion14[] = EC_WORD_QUES, EC_WORD_ICE, EC_WORD_GROUND, - 0xFFFF + EC_EMPTY_WORD }; static const u16 sQuizLadyQuestion15[] = @@ -212,7 +212,7 @@ static const u16 sQuizLadyQuestion15[] = EC_WORD_QUES, EC_WORD_PSYCHIC, EC_WORD_FIGHTING, - 0xFFFF + EC_EMPTY_WORD }; static const u16 sQuizLadyQuestion16[] = @@ -225,7 +225,7 @@ static const u16 sQuizLadyQuestion16[] = EC_WORD_QUES, EC_WORD_NORMAL, EC_WORD_DARK, - 0xFFFF + EC_EMPTY_WORD }; static const u16 *const sQuizLadyQuizQuestions[] = diff --git a/src/data/object_events/movement_type_func_tables.h b/src/data/object_events/movement_type_func_tables.h index 7d149a628..f4890d684 100755 --- a/src/data/object_events/movement_type_func_tables.h +++ b/src/data/object_events/movement_type_func_tables.h @@ -63,11 +63,11 @@ u8 (*const gMovementTypeFuncs_FaceDirection[])(struct ObjectEvent *, struct Spri }; u8 (*const gMovementTypeFuncs_BerryTreeGrowth[])(struct ObjectEvent *, struct Sprite *) = { - MovementType_BerryTreeGrowth_Step0, - MovementType_BerryTreeGrowth_Step1, - MovementType_BerryTreeGrowth_Step2, - MovementType_BerryTreeGrowth_Step3, - MovementType_BerryTreeGrowth_Step4, + MovementType_BerryTreeGrowth_Normal, + MovementType_BerryTreeGrowth_Move, + MovementType_BerryTreeGrowth_SparkleStart, + MovementType_BerryTreeGrowth_Sparkle, + MovementType_BerryTreeGrowth_SparkleEnd, }; u8 (*const gMovementTypeFuncs_FaceDownAndUp[])(struct ObjectEvent *, struct Sprite *) = { @@ -407,8 +407,8 @@ u8 (*const gMovementTypeFuncs_CopyPlayerInGrass[])(struct ObjectEvent *, struct MovementType_CopyPlayer_Step2, }; -u8 (*const gMovementTypeFuncs_Hidden[])(struct ObjectEvent *, struct Sprite *) = { - MovementType_Hidden_Step0, +u8 (*const gMovementTypeFuncs_Buried[])(struct ObjectEvent *, struct Sprite *) = { + MovementType_Buried_Step0, }; u8 (*const gMovementTypeFuncs_WalkInPlace[])(struct ObjectEvent *, struct Sprite *) = { diff --git a/src/data/pointillism_points.h b/src/data/pointillism_points.h new file mode 100644 index 000000000..708f5c02e --- /dev/null +++ b/src/data/pointillism_points.h @@ -0,0 +1,3210 @@ +#define GET_POINT_OFFSET_DL(bits) (((bits) >> 0) & 1) +#define GET_POINT_COLOR_TYPE(bits) (((bits) >> 1) & 3) +#define GET_POINT_DELTA(bits) (((bits) >> 3) & 7) + +#define PT(x, y, delta, colorType, offsetDownLeft) x, y, (delta << 3) | (colorType << 1) | offsetDownLeft + +static const u8 sPointillismPoints[][3] = { + PT( 0, 29, 3, 2, FALSE), + PT(14, 30, 3, 1, TRUE), + PT( 0, 1, 6, 1, FALSE), + PT(46, 30, 6, 3, TRUE), + PT(10, 34, 3, 3, TRUE), + PT( 5, 38, 5, 3, FALSE), + PT(18, 23, 3, 3, FALSE), + PT(26, 3, 2, 0, TRUE), + PT( 5, 17, 3, 0, FALSE), + PT( 5, 39, 5, 3, TRUE), + PT(26, 63, 2, 1, FALSE), + PT(34, 63, 2, 3, FALSE), + PT(43, 47, 5, 3, FALSE), + PT(17, 2, 5, 2, TRUE), + PT(35, 13, 5, 0, FALSE), + PT(23, 12, 3, 0, TRUE), + PT(47, 14, 2, 1, TRUE), + PT(48, 24, 4, 0, FALSE), + PT(45, 40, 4, 1, FALSE), + PT( 1, 3, 3, 0, TRUE), + PT(14, 42, 5, 1, TRUE), + PT(34, 21, 4, 2, TRUE), + PT(34, 10, 4, 3, FALSE), + PT(57, 6, 4, 1, TRUE), + PT(22, 7, 5, 3, TRUE), + PT(34, 58, 3, 1, TRUE), + PT(59, 54, 6, 2, TRUE), + PT(10, 43, 4, 2, FALSE), + PT(54, 9, 2, 1, FALSE), + PT(28, 47, 4, 1, TRUE), + PT(46, 56, 5, 2, FALSE), + PT( 5, 42, 4, 0, FALSE), + PT( 7, 20, 6, 1, FALSE), + PT(49, 8, 2, 3, TRUE), + PT(26, 36, 5, 2, TRUE), + PT(34, 10, 2, 3, FALSE), + PT(27, 38, 5, 1, TRUE), + PT(41, 22, 2, 0, TRUE), + PT(53, 8, 2, 2, FALSE), + PT(30, 8, 2, 2, FALSE), + PT( 5, 49, 2, 2, FALSE), + PT(56, 49, 2, 3, TRUE), + PT(52, 51, 2, 1, FALSE), + PT(17, 9, 3, 3, TRUE), + PT(40, 61, 6, 1, FALSE), + PT(53, 3, 3, 3, FALSE), + PT(60, 43, 5, 3, FALSE), + PT(16, 1, 2, 3, TRUE), + PT( 3, 62, 4, 1, FALSE), + PT(23, 24, 6, 2, FALSE), + PT( 8, 41, 3, 0, TRUE), + PT( 3, 36, 5, 0, FALSE), + PT(61, 51, 5, 3, TRUE), + PT(49, 36, 3, 0, TRUE), + PT(27, 24, 4, 3, FALSE), + PT( 7, 13, 4, 2, TRUE), + PT(45, 63, 2, 1, FALSE), + PT(47, 21, 4, 2, TRUE), + PT(41, 15, 2, 1, FALSE), + PT( 7, 44, 2, 1, FALSE), + PT(44, 11, 4, 3, FALSE), + PT(18, 26, 2, 3, FALSE), + PT( 0, 11, 5, 3, TRUE), + PT(22, 53, 4, 2, FALSE), + PT(31, 28, 4, 1, FALSE), + PT(41, 51, 4, 3, TRUE), + PT(59, 48, 2, 3, TRUE), + PT(17, 6, 6, 2, TRUE), + PT(62, 49, 5, 3, TRUE), + PT(17, 58, 4, 2, TRUE), + PT(42, 2, 3, 0, TRUE), + PT(51, 24, 6, 2, TRUE), + PT(42, 32, 4, 0, TRUE), + PT(46, 50, 3, 1, TRUE), + PT(59, 31, 4, 1, TRUE), + PT(57, 41, 5, 1, FALSE), + PT(46, 49, 5, 0, TRUE), + PT(42, 14, 5, 2, TRUE), + PT(45, 0, 3, 3, TRUE), + PT(56, 40, 3, 1, TRUE), + PT(20, 59, 5, 1, TRUE), + PT(46, 4, 4, 3, FALSE), + PT(54, 48, 2, 0, TRUE), + PT(59, 33, 5, 2, TRUE), + PT(43, 63, 3, 1, TRUE), + PT(32, 19, 6, 0, TRUE), + PT(51, 12, 6, 0, FALSE), + PT(34, 43, 5, 1, TRUE), + PT(22, 2, 3, 3, FALSE), + PT(28, 18, 3, 2, FALSE), + PT(15, 60, 6, 3, FALSE), + PT(56, 16, 5, 2, TRUE), + PT(24, 47, 5, 2, TRUE), + PT(53, 59, 2, 0, TRUE), + PT(55, 49, 2, 1, TRUE), + PT(19, 61, 5, 3, TRUE), + PT(30, 44, 6, 1, TRUE), + PT(46, 55, 2, 1, FALSE), + PT(60, 31, 6, 1, TRUE), + PT(50, 42, 4, 3, TRUE), + PT(13, 59, 3, 2, FALSE), + PT(53, 42, 4, 3, TRUE), + PT( 9, 61, 4, 3, TRUE), + PT(18, 11, 3, 0, FALSE), + PT(12, 21, 3, 2, TRUE), + PT(32, 1, 3, 2, FALSE), + PT( 8, 59, 3, 2, FALSE), + PT(18, 55, 6, 1, TRUE), + PT(21, 3, 5, 2, FALSE), + PT(42, 59, 6, 0, TRUE), + PT(15, 4, 6, 2, TRUE), + PT( 8, 23, 6, 1, TRUE), + PT(56, 61, 5, 1, FALSE), + PT(47, 53, 2, 3, FALSE), + PT(16, 53, 2, 3, FALSE), + PT(35, 19, 5, 2, FALSE), + PT(47, 6, 4, 0, FALSE), + PT(39, 58, 4, 2, FALSE), + PT( 0, 28, 5, 1, FALSE), + PT( 3, 57, 3, 2, TRUE), + PT(40, 7, 3, 1, FALSE), + PT(32, 10, 6, 3, TRUE), + PT( 7, 53, 5, 2, TRUE), + PT(21, 47, 5, 2, FALSE), + PT(16, 44, 4, 1, TRUE), + PT(63, 41, 2, 2, FALSE), + PT(42, 33, 6, 3, FALSE), + PT(52, 26, 5, 2, FALSE), + PT(28, 61, 6, 1, TRUE), + PT(56, 43, 4, 1, FALSE), + PT(53, 40, 3, 3, TRUE), + PT(61, 15, 3, 2, FALSE), + PT(30, 62, 3, 1, TRUE), + PT(12, 62, 3, 3, TRUE), + PT(43, 49, 5, 2, FALSE), + PT(50, 57, 2, 0, TRUE), + PT( 5, 9, 2, 0, TRUE), + PT( 4, 56, 5, 1, FALSE), + PT(50, 0, 2, 3, FALSE), + PT(19, 11, 6, 0, TRUE), + PT(52, 42, 2, 1, TRUE), + PT(44, 34, 4, 0, TRUE), + PT(57, 47, 2, 2, TRUE), + PT(55, 40, 3, 3, FALSE), + PT( 7, 59, 5, 2, TRUE), + PT(17, 3, 5, 0, FALSE), + PT(45, 48, 3, 3, FALSE), + PT(49, 17, 2, 0, TRUE), + PT(35, 1, 3, 3, FALSE), + PT(61, 49, 6, 2, FALSE), + PT(28, 2, 6, 2, FALSE), + PT(33, 14, 4, 2, TRUE), + PT(61, 7, 2, 3, TRUE), + PT(51, 21, 2, 0, FALSE), + PT(41, 50, 6, 1, FALSE), + PT(24, 31, 6, 0, FALSE), + PT(45, 59, 6, 0, FALSE), + PT(39, 62, 2, 3, FALSE), + PT(49, 21, 2, 1, FALSE), + PT(48, 37, 2, 3, TRUE), + PT(51, 6, 6, 2, FALSE), + PT( 0, 41, 3, 0, FALSE), + PT(60, 3, 2, 1, FALSE), + PT(44, 12, 2, 0, TRUE), + PT( 9, 48, 6, 0, FALSE), + PT(16, 14, 2, 0, TRUE), + PT(39, 22, 3, 1, TRUE), + PT(12, 59, 5, 3, FALSE), + PT(43, 51, 3, 3, FALSE), + PT(19, 45, 5, 2, TRUE), + PT(17, 36, 5, 0, TRUE), + PT(52, 62, 5, 1, TRUE), + PT(36, 30, 4, 0, TRUE), + PT(39, 26, 5, 2, TRUE), + PT( 4, 57, 2, 3, FALSE), + PT(62, 51, 4, 3, FALSE), + PT(27, 46, 4, 2, TRUE), + PT(12, 6, 3, 0, TRUE), + PT(37, 25, 3, 0, FALSE), + PT(29, 51, 6, 1, TRUE), + PT(29, 40, 5, 2, TRUE), + PT(28, 16, 5, 1, FALSE), + PT(31, 53, 3, 3, FALSE), + PT(52, 2, 2, 0, FALSE), + PT(43, 58, 2, 2, FALSE), + PT(13, 11, 2, 2, TRUE), + PT(12, 44, 2, 0, FALSE), + PT(55, 58, 3, 0, TRUE), + PT( 6, 19, 2, 3, TRUE), + PT(36, 16, 4, 2, TRUE), + PT(36, 4, 3, 3, FALSE), + PT( 0, 53, 6, 2, FALSE), + PT(58, 0, 6, 3, TRUE), + PT(60, 7, 3, 1, FALSE), + PT(43, 40, 6, 3, FALSE), + PT(52, 57, 5, 3, TRUE), + PT(40, 9, 3, 3, TRUE), + PT(56, 49, 6, 0, FALSE), + PT(22, 37, 6, 0, TRUE), + PT(24, 40, 6, 0, TRUE), + PT(24, 12, 4, 1, FALSE), + PT( 6, 57, 5, 2, TRUE), + PT(61, 32, 4, 2, FALSE), + PT(46, 39, 4, 0, TRUE), + PT(62, 24, 3, 0, FALSE), + PT(21, 60, 4, 2, FALSE), + PT( 6, 27, 4, 3, FALSE), + PT(21, 14, 4, 1, FALSE), + PT(10, 13, 3, 3, TRUE), + PT(24, 22, 6, 2, FALSE), + PT(16, 40, 4, 0, TRUE), + PT(32, 17, 2, 0, TRUE), + PT(54, 50, 2, 2, TRUE), + PT(59, 46, 4, 2, FALSE), + PT(31, 45, 2, 1, FALSE), + PT(54, 46, 4, 0, FALSE), + PT(11, 23, 6, 1, TRUE), + PT(38, 3, 3, 3, TRUE), + PT( 8, 25, 6, 0, TRUE), + PT(42, 24, 4, 2, TRUE), + PT(53, 45, 5, 2, TRUE), + PT(48, 56, 3, 0, FALSE), + PT(28, 37, 2, 2, FALSE), + PT(28, 34, 5, 0, FALSE), + PT( 8, 35, 4, 0, TRUE), + PT(38, 30, 6, 0, FALSE), + PT(25, 15, 2, 2, TRUE), + PT(16, 47, 4, 1, FALSE), + PT(18, 2, 4, 2, TRUE), + PT(60, 1, 3, 2, TRUE), + PT(14, 20, 3, 0, FALSE), + PT(13, 24, 2, 3, TRUE), + PT(34, 11, 6, 0, TRUE), + PT(19, 52, 4, 0, TRUE), + PT(15, 45, 6, 3, FALSE), + PT(57, 31, 4, 2, TRUE), + PT(24, 16, 3, 3, TRUE), + PT(45, 32, 4, 0, FALSE), + PT(25, 11, 6, 0, TRUE), + PT(51, 19, 2, 2, FALSE), + PT(46, 17, 4, 0, TRUE), + PT(45, 10, 6, 3, TRUE), + PT( 7, 21, 3, 1, TRUE), + PT(50, 4, 6, 1, FALSE), + PT( 6, 24, 3, 1, TRUE), + PT(19, 36, 2, 1, FALSE), + PT(54, 34, 2, 3, FALSE), + PT(29, 41, 3, 2, FALSE), + PT(53, 23, 4, 0, TRUE), + PT(54, 23, 5, 1, TRUE), + PT(53, 50, 3, 0, TRUE), + PT(42, 15, 5, 3, FALSE), + PT(16, 0, 6, 2, FALSE), + PT( 2, 14, 5, 0, FALSE), + PT(49, 50, 6, 1, FALSE), + PT(59, 5, 4, 0, FALSE), + PT(54, 38, 2, 1, FALSE), + PT(52, 6, 6, 2, FALSE), + PT(30, 49, 6, 1, FALSE), + PT(53, 5, 6, 2, FALSE), + PT(30, 19, 2, 2, TRUE), + PT(21, 20, 5, 2, FALSE), + PT(41, 28, 3, 0, FALSE), + PT(36, 36, 2, 1, FALSE), + PT(34, 41, 3, 0, FALSE), + PT(52, 54, 6, 0, FALSE), + PT(30, 1, 4, 1, TRUE), + PT(12, 60, 4, 2, FALSE), + PT(10, 61, 2, 3, FALSE), + PT(39, 30, 4, 1, TRUE), + PT(21, 2, 2, 1, FALSE), + PT(17, 25, 5, 1, FALSE), + PT(29, 49, 2, 2, TRUE), + PT( 3, 59, 5, 1, FALSE), + PT(33, 25, 5, 2, FALSE), + PT(10, 35, 2, 0, TRUE), + PT(37, 17, 3, 1, FALSE), + PT(26, 10, 6, 2, FALSE), + PT(59, 11, 6, 1, TRUE), + PT(33, 11, 6, 3, TRUE), + PT( 1, 49, 5, 0, FALSE), + PT(53, 29, 4, 3, TRUE), + PT(44, 48, 6, 0, TRUE), + PT(46, 57, 5, 2, TRUE), + PT(48, 5, 5, 2, FALSE), + PT(18, 42, 5, 1, TRUE), + PT(57, 34, 4, 0, FALSE), + PT(21, 52, 3, 2, FALSE), + PT(28, 1, 2, 2, TRUE), + PT(32, 22, 4, 1, FALSE), + PT(19, 4, 3, 0, FALSE), + PT(30, 19, 2, 0, FALSE), + PT(37, 51, 2, 2, TRUE), + PT(57, 3, 6, 0, TRUE), + PT(63, 54, 3, 0, FALSE), + PT(20, 35, 2, 0, FALSE), + PT(47, 30, 3, 3, TRUE), + PT(31, 23, 5, 2, FALSE), + PT( 2, 22, 6, 0, TRUE), + PT(32, 24, 6, 0, FALSE), + PT(46, 24, 6, 3, TRUE), + PT(59, 14, 6, 0, FALSE), + PT(16, 57, 4, 2, FALSE), + PT(38, 57, 3, 3, FALSE), + PT(48, 38, 5, 3, FALSE), + PT(18, 1, 2, 2, FALSE), + PT(55, 42, 5, 3, FALSE), + PT(33, 6, 3, 2, TRUE), + PT(42, 22, 6, 1, FALSE), + PT( 9, 56, 3, 2, FALSE), + PT( 7, 34, 2, 3, TRUE), + PT(59, 45, 2, 2, TRUE), + PT( 7, 30, 5, 3, FALSE), + PT(27, 46, 3, 2, TRUE), + PT( 4, 9, 6, 0, FALSE), + PT(48, 45, 6, 3, TRUE), + PT(45, 52, 4, 2, FALSE), + PT(24, 36, 4, 2, TRUE), + PT(14, 45, 4, 3, FALSE), + PT(35, 10, 2, 3, FALSE), + PT(18, 45, 2, 0, TRUE), + PT(33, 40, 5, 3, FALSE), + PT(15, 1, 4, 0, TRUE), + PT( 1, 49, 2, 1, FALSE), + PT(63, 27, 3, 3, FALSE), + PT(33, 37, 5, 1, TRUE), + PT(38, 24, 2, 1, TRUE), + PT(21, 45, 6, 2, FALSE), + PT(35, 33, 6, 3, FALSE), + PT(14, 46, 3, 2, FALSE), + PT(20, 34, 3, 2, FALSE), + PT(44, 11, 5, 0, FALSE), + PT(26, 24, 4, 0, TRUE), + PT(33, 7, 3, 1, FALSE), + PT(36, 38, 5, 0, TRUE), + PT(43, 10, 6, 2, FALSE), + PT(62, 39, 6, 1, TRUE), + PT(18, 52, 3, 1, TRUE), + PT(31, 1, 5, 1, FALSE), + PT(46, 6, 4, 1, TRUE), + PT(47, 31, 2, 2, FALSE), + PT(24, 6, 4, 3, FALSE), + PT(49, 31, 5, 1, TRUE), + PT(34, 38, 5, 3, FALSE), + PT(30, 21, 2, 3, FALSE), + PT(32, 34, 5, 0, FALSE), + PT(21, 55, 2, 1, FALSE), + PT(37, 4, 5, 2, FALSE), + PT(31, 4, 5, 3, FALSE), + PT(12, 19, 3, 0, FALSE), + PT( 7, 11, 6, 3, FALSE), + PT(29, 28, 5, 1, FALSE), + PT(48, 34, 3, 2, FALSE), + PT(46, 18, 5, 3, TRUE), + PT(43, 33, 3, 3, FALSE), + PT(22, 56, 6, 0, FALSE), + PT( 4, 2, 2, 3, FALSE), + PT( 5, 20, 4, 0, FALSE), + PT(56, 60, 6, 1, TRUE), + PT(33, 27, 5, 3, TRUE), + PT(20, 42, 4, 3, TRUE), + PT(56, 20, 3, 1, TRUE), + PT(43, 31, 5, 1, TRUE), + PT(41, 43, 4, 2, TRUE), + PT(39, 54, 4, 0, TRUE), + PT(17, 34, 3, 1, TRUE), + PT(41, 3, 3, 1, TRUE), + PT(24, 36, 5, 0, FALSE), + PT(33, 45, 6, 3, FALSE), + PT(60, 44, 4, 2, FALSE), + PT(51, 23, 3, 3, TRUE), + PT(42, 58, 4, 0, TRUE), + PT(10, 35, 6, 3, TRUE), + PT( 0, 11, 4, 0, TRUE), + PT(17, 56, 3, 0, TRUE), + PT(15, 14, 3, 2, FALSE), + PT(31, 15, 6, 3, TRUE), + PT(60, 16, 6, 3, TRUE), + PT(56, 49, 6, 2, TRUE), + PT( 7, 21, 5, 0, FALSE), + PT(30, 46, 3, 0, TRUE), + PT(38, 16, 6, 1, TRUE), + PT(61, 53, 5, 3, TRUE), + PT(58, 4, 6, 2, FALSE), + PT(13, 24, 3, 1, FALSE), + PT( 1, 45, 2, 2, TRUE), + PT(61, 26, 2, 3, TRUE), + PT(23, 63, 6, 1, FALSE), + PT(11, 33, 2, 0, TRUE), + PT(30, 38, 5, 1, TRUE), + PT(13, 25, 4, 2, FALSE), + PT(46, 4, 3, 1, TRUE), + PT(27, 51, 4, 0, FALSE), + PT(21, 33, 3, 2, TRUE), + PT(31, 4, 4, 0, TRUE), + PT(15, 18, 3, 3, TRUE), + PT(45, 42, 6, 1, FALSE), + PT( 3, 55, 3, 3, TRUE), + PT(53, 7, 4, 3, TRUE), + PT(36, 31, 6, 0, TRUE), + PT(47, 48, 2, 2, TRUE), + PT( 6, 0, 4, 2, FALSE), + PT(11, 34, 3, 1, FALSE), + PT(12, 59, 5, 0, TRUE), + PT(20, 26, 2, 3, TRUE), + PT(55, 32, 4, 2, TRUE), + PT(63, 38, 6, 3, TRUE), + PT(58, 62, 2, 0, FALSE), + PT(34, 4, 2, 0, TRUE), + PT(40, 18, 3, 2, FALSE), + PT( 3, 46, 5, 3, FALSE), + PT(14, 56, 5, 0, FALSE), + PT( 1, 41, 4, 1, FALSE), + PT(30, 51, 3, 0, TRUE), + PT( 6, 33, 4, 3, TRUE), + PT(51, 25, 3, 1, FALSE), + PT( 2, 5, 2, 3, TRUE), + PT(17, 17, 5, 2, FALSE), + PT(31, 38, 3, 3, FALSE), + PT(57, 31, 5, 0, FALSE), + PT(46, 47, 2, 1, FALSE), + PT(34, 52, 2, 1, TRUE), + PT(59, 38, 5, 3, TRUE), + PT(52, 0, 2, 2, FALSE), + PT(16, 49, 2, 0, TRUE), + PT(29, 45, 5, 1, FALSE), + PT( 8, 8, 6, 3, TRUE), + PT(21, 24, 6, 2, FALSE), + PT( 4, 43, 4, 2, FALSE), + PT(47, 30, 4, 3, TRUE), + PT(34, 42, 4, 2, FALSE), + PT( 7, 20, 4, 2, TRUE), + PT( 1, 39, 3, 0, TRUE), + PT(41, 10, 5, 0, TRUE), + PT(61, 28, 5, 3, TRUE), + PT(13, 31, 3, 2, FALSE), + PT(36, 61, 6, 1, FALSE), + PT(54, 29, 4, 2, FALSE), + PT(20, 33, 2, 3, FALSE), + PT(26, 13, 5, 0, TRUE), + PT(63, 43, 5, 1, FALSE), + PT(26, 62, 6, 2, TRUE), + PT(17, 40, 3, 0, FALSE), + PT(50, 5, 2, 2, TRUE), + PT(33, 46, 6, 2, FALSE), + PT(45, 20, 5, 1, FALSE), + PT(60, 8, 6, 3, TRUE), + PT(63, 52, 3, 3, FALSE), + PT(39, 36, 3, 2, FALSE), + PT(22, 22, 6, 1, TRUE), + PT(41, 59, 3, 0, TRUE), + PT(54, 47, 3, 2, FALSE), + PT( 3, 37, 5, 2, FALSE), + PT(11, 22, 6, 3, FALSE), + PT(28, 29, 3, 1, TRUE), + PT(44, 39, 3, 1, TRUE), + PT(11, 31, 5, 1, TRUE), + PT( 8, 16, 4, 3, TRUE), + PT(63, 37, 5, 3, TRUE), + PT(51, 19, 3, 3, TRUE), + PT( 4, 49, 6, 3, TRUE), + PT(14, 47, 2, 1, FALSE), + PT( 8, 35, 4, 0, FALSE), + PT(58, 26, 3, 3, FALSE), + PT(47, 11, 3, 3, TRUE), + PT(30, 32, 3, 0, TRUE), + PT(35, 59, 2, 2, FALSE), + PT(37, 0, 4, 3, TRUE), + PT(20, 4, 4, 2, TRUE), + PT(54, 26, 5, 1, TRUE), + PT(39, 33, 2, 2, TRUE), + PT(40, 19, 5, 2, FALSE), + PT(14, 60, 6, 2, TRUE), + PT(12, 45, 5, 1, TRUE), + PT(55, 22, 2, 2, TRUE), + PT(41, 21, 3, 2, TRUE), + PT(23, 52, 6, 3, FALSE), + PT( 9, 10, 6, 0, TRUE), + PT(55, 34, 5, 0, FALSE), + PT(23, 43, 6, 2, TRUE), + PT(20, 43, 2, 1, FALSE), + PT( 8, 19, 3, 3, TRUE), + PT(49, 19, 5, 0, FALSE), + PT( 6, 7, 6, 2, TRUE), + PT(35, 58, 5, 0, TRUE), + PT(15, 36, 5, 3, FALSE), + PT( 7, 53, 4, 3, FALSE), + PT(14, 18, 2, 2, TRUE), + PT(35, 51, 5, 2, FALSE), + PT(14, 33, 4, 3, FALSE), + PT(28, 18, 4, 2, TRUE), + PT(35, 29, 5, 3, TRUE), + PT( 4, 53, 6, 1, TRUE), + PT(22, 1, 4, 2, FALSE), + PT(61, 44, 5, 3, FALSE), + PT(53, 10, 4, 2, TRUE), + PT(17, 19, 4, 2, TRUE), + PT(27, 27, 2, 2, TRUE), + PT(21, 57, 2, 0, FALSE), + PT(11, 53, 4, 2, FALSE), + PT(58, 39, 6, 0, FALSE), + PT(46, 47, 2, 2, TRUE), + PT(16, 31, 6, 2, TRUE), + PT(27, 40, 6, 2, TRUE), + PT(38, 48, 6, 3, TRUE), + PT(52, 55, 5, 1, TRUE), + PT(15, 48, 5, 0, TRUE), + PT(46, 63, 5, 1, TRUE), + PT(56, 52, 5, 1, TRUE), + PT(43, 47, 4, 2, TRUE), + PT(13, 40, 5, 1, FALSE), + PT(51, 24, 2, 0, FALSE), + PT(33, 18, 2, 0, TRUE), + PT(31, 34, 6, 2, FALSE), + PT(17, 37, 4, 1, TRUE), + PT(33, 63, 2, 0, TRUE), + PT(38, 39, 4, 2, TRUE), + PT(40, 54, 2, 1, FALSE), + PT(21, 38, 6, 1, FALSE), + PT(17, 24, 4, 2, FALSE), + PT(50, 37, 6, 3, TRUE), + PT(39, 58, 6, 1, TRUE), + PT(53, 7, 3, 2, FALSE), + PT(26, 14, 5, 1, FALSE), + PT(30, 47, 3, 3, TRUE), + PT( 0, 46, 4, 0, TRUE), + PT(27, 60, 2, 2, FALSE), + PT(47, 58, 5, 3, TRUE), + PT(62, 56, 2, 2, TRUE), + PT(26, 19, 5, 3, TRUE), + PT(41, 13, 5, 3, TRUE), + PT(55, 23, 3, 0, FALSE), + PT(48, 28, 6, 2, TRUE), + PT(21, 52, 2, 2, FALSE), + PT(40, 17, 5, 2, FALSE), + PT(44, 37, 5, 1, FALSE), + PT(32, 63, 5, 0, FALSE), + PT(12, 52, 3, 1, TRUE), + PT(48, 46, 4, 2, TRUE), + PT(55, 28, 4, 2, FALSE), + PT(31, 37, 4, 3, FALSE), + PT(12, 25, 6, 2, FALSE), + PT(24, 16, 6, 2, TRUE), + PT(10, 19, 2, 0, TRUE), + PT(37, 19, 4, 0, FALSE), + PT(19, 25, 2, 0, TRUE), + PT(32, 40, 3, 2, TRUE), + PT(62, 48, 3, 1, TRUE), + PT(35, 36, 4, 0, TRUE), + PT(13, 35, 4, 1, TRUE), + PT(29, 40, 5, 3, FALSE), + PT(45, 18, 3, 3, TRUE), + PT(14, 46, 5, 1, TRUE), + PT(11, 49, 6, 1, FALSE), + PT(36, 60, 5, 2, FALSE), + PT(19, 60, 2, 1, FALSE), + PT(40, 22, 5, 1, FALSE), + PT( 5, 12, 6, 1, FALSE), + PT(57, 11, 6, 1, FALSE), + PT(33, 4, 2, 2, FALSE), + PT(16, 49, 6, 1, FALSE), + PT(18, 31, 4, 1, TRUE), + PT(57, 46, 5, 3, FALSE), + PT(34, 61, 4, 3, TRUE), + PT(12, 30, 3, 0, FALSE), + PT(37, 0, 2, 3, TRUE), + PT( 6, 49, 2, 2, FALSE), + PT(19, 33, 3, 1, FALSE), + PT(20, 32, 6, 2, TRUE), + PT(10, 59, 4, 2, TRUE), + PT(51, 8, 5, 0, FALSE), + PT(61, 2, 6, 1, TRUE), + PT(35, 0, 2, 1, TRUE), + PT(34, 33, 5, 0, FALSE), + PT(48, 20, 5, 3, FALSE), + PT(20, 50, 6, 3, FALSE), + PT(57, 35, 3, 3, FALSE), + PT(28, 17, 6, 0, FALSE), + PT(55, 22, 6, 0, FALSE), + PT(21, 49, 3, 3, TRUE), + PT(52, 40, 5, 2, FALSE), + PT(53, 5, 5, 0, TRUE), + PT(55, 51, 5, 1, FALSE), + PT(28, 23, 5, 3, FALSE), + PT(16, 6, 2, 3, FALSE), + PT(50, 31, 5, 3, TRUE), + PT( 0, 41, 3, 3, FALSE), + PT( 4, 1, 2, 3, FALSE), + PT(59, 35, 3, 3, FALSE), + PT(27, 52, 5, 1, FALSE), + PT(48, 17, 5, 1, TRUE), + PT( 3, 0, 3, 3, TRUE), + PT(29, 55, 3, 1, FALSE), + PT(58, 24, 4, 2, TRUE), + PT(28, 22, 5, 2, FALSE), + PT( 4, 63, 6, 1, TRUE), + PT(38, 35, 5, 2, TRUE), + PT(21, 44, 4, 3, TRUE), + PT( 2, 53, 4, 3, TRUE), + PT( 7, 53, 6, 1, TRUE), + PT(26, 12, 2, 0, FALSE), + PT(40, 38, 5, 2, FALSE), + PT(47, 54, 2, 3, FALSE), + PT(55, 11, 4, 3, TRUE), + PT(27, 61, 3, 0, FALSE), + PT(39, 31, 4, 0, FALSE), + PT(43, 42, 6, 1, TRUE), + PT(11, 15, 4, 0, FALSE), + PT(53, 60, 5, 3, TRUE), + PT(51, 33, 2, 2, TRUE), + PT(45, 38, 6, 2, FALSE), + PT(31, 26, 4, 0, TRUE), + PT(47, 44, 5, 1, FALSE), + PT(26, 50, 3, 1, FALSE), + PT(59, 63, 4, 0, TRUE), + PT(19, 63, 2, 1, TRUE), + PT(15, 36, 4, 1, FALSE), + PT(20, 27, 2, 0, FALSE), + PT(33, 6, 5, 0, FALSE), + PT(37, 52, 2, 0, FALSE), + PT(46, 14, 2, 2, FALSE), + PT(60, 62, 4, 2, TRUE), + PT(22, 6, 6, 0, FALSE), + PT(11, 4, 3, 3, TRUE), + PT(62, 2, 4, 2, FALSE), + PT(12, 23, 4, 2, TRUE), + PT(43, 60, 5, 2, TRUE), + PT(21, 54, 6, 1, TRUE), + PT(24, 35, 5, 1, FALSE), + PT(29, 16, 5, 1, FALSE), + PT(53, 23, 5, 0, FALSE), + PT( 0, 55, 4, 2, FALSE), + PT(10, 59, 2, 2, TRUE), + PT(29, 11, 3, 3, TRUE), + PT(60, 49, 4, 2, TRUE), + PT(29, 15, 3, 2, TRUE), + PT(32, 19, 6, 2, FALSE), + PT(17, 43, 5, 3, FALSE), + PT(35, 12, 5, 3, FALSE), + PT(36, 2, 2, 2, FALSE), + PT(49, 22, 3, 0, TRUE), + PT(14, 35, 6, 2, TRUE), + PT(26, 16, 2, 3, FALSE), + PT(20, 4, 3, 0, TRUE), + PT(45, 39, 6, 3, TRUE), + PT(51, 2, 6, 0, TRUE), + PT( 2, 4, 2, 3, FALSE), + PT(13, 34, 4, 2, TRUE), + PT(37, 0, 2, 3, FALSE), + PT(42, 63, 4, 3, FALSE), + PT(32, 12, 2, 1, FALSE), + PT(47, 46, 6, 2, TRUE), + PT(27, 13, 4, 1, FALSE), + PT(30, 1, 6, 2, FALSE), + PT( 5, 34, 4, 0, TRUE), + PT(52, 42, 6, 1, FALSE), + PT(11, 9, 3, 2, TRUE), + PT(63, 50, 5, 3, TRUE), + PT(61, 24, 5, 2, TRUE), + PT(11, 56, 6, 3, FALSE), + PT(57, 23, 5, 0, FALSE), + PT(52, 4, 4, 2, FALSE), + PT(54, 14, 5, 1, FALSE), + PT(56, 1, 2, 2, FALSE), + PT(60, 36, 4, 1, FALSE), + PT(33, 3, 3, 0, FALSE), + PT(50, 47, 2, 1, FALSE), + PT(41, 36, 6, 0, TRUE), + PT(10, 59, 2, 1, FALSE), + PT(26, 28, 4, 0, FALSE), + PT(48, 49, 3, 1, TRUE), + PT(26, 33, 2, 0, FALSE), + PT( 5, 41, 2, 0, FALSE), + PT(38, 45, 2, 1, TRUE), + PT(22, 12, 3, 2, TRUE), + PT(43, 6, 3, 1, TRUE), + PT( 6, 18, 2, 2, FALSE), + PT(56, 15, 6, 2, TRUE), + PT(35, 58, 5, 2, FALSE), + PT( 0, 25, 6, 1, TRUE), + PT(41, 20, 5, 2, TRUE), + PT(42, 33, 5, 0, TRUE), + PT(20, 49, 2, 2, FALSE), + PT(26, 6, 3, 3, FALSE), + PT(24, 27, 5, 0, FALSE), + PT(59, 22, 5, 0, TRUE), + PT(21, 30, 2, 1, FALSE), + PT(52, 10, 2, 2, FALSE), + PT(27, 5, 4, 3, TRUE), + PT(11, 1, 4, 3, FALSE), + PT(42, 34, 6, 2, TRUE), + PT(33, 32, 3, 0, FALSE), + PT(32, 55, 2, 3, TRUE), + PT(20, 31, 2, 0, TRUE), + PT(29, 17, 4, 2, TRUE), + PT(36, 43, 5, 3, TRUE), + PT( 7, 63, 3, 3, TRUE), + PT(44, 37, 4, 2, TRUE), + PT(42, 41, 3, 0, FALSE), + PT(17, 36, 5, 0, FALSE), + PT(49, 44, 5, 1, FALSE), + PT(57, 11, 4, 3, FALSE), + PT(40, 16, 4, 3, FALSE), + PT(34, 6, 2, 3, FALSE), + PT( 9, 44, 2, 1, TRUE), + PT(52, 25, 2, 2, TRUE), + PT(58, 18, 4, 0, TRUE), + PT(29, 56, 4, 1, TRUE), + PT(18, 37, 4, 2, FALSE), + PT(33, 48, 2, 1, FALSE), + PT(55, 26, 2, 1, FALSE), + PT(36, 59, 4, 2, TRUE), + PT(50, 21, 4, 1, TRUE), + PT(13, 26, 2, 0, FALSE), + PT(22, 46, 4, 3, FALSE), + PT(29, 20, 2, 3, FALSE), + PT(62, 46, 3, 3, TRUE), + PT(10, 22, 2, 0, FALSE), + PT(29, 48, 5, 1, TRUE), + PT( 4, 58, 3, 0, TRUE), + PT( 8, 45, 5, 3, FALSE), + PT(40, 30, 6, 1, TRUE), + PT(10, 18, 5, 3, FALSE), + PT(13, 3, 5, 3, TRUE), + PT(38, 58, 3, 3, FALSE), + PT(53, 59, 5, 1, FALSE), + PT( 3, 26, 3, 0, FALSE), + PT(63, 11, 4, 3, TRUE), + PT( 4, 5, 6, 2, FALSE), + PT(54, 11, 4, 3, TRUE), + PT(59, 23, 2, 0, TRUE), + PT(13, 39, 4, 3, FALSE), + PT(44, 31, 4, 0, FALSE), + PT(38, 16, 4, 0, FALSE), + PT(37, 35, 5, 2, TRUE), + PT(55, 9, 2, 1, TRUE), + PT(20, 23, 5, 2, TRUE), + PT(46, 61, 4, 1, TRUE), + PT(29, 26, 3, 3, TRUE), + PT(33, 51, 5, 3, FALSE), + PT(40, 23, 2, 1, TRUE), + PT(38, 60, 6, 3, FALSE), + PT(20, 26, 6, 1, TRUE), + PT(50, 32, 5, 1, TRUE), + PT(25, 62, 4, 0, FALSE), + PT(12, 2, 5, 2, TRUE), + PT(60, 60, 5, 1, FALSE), + PT(48, 48, 5, 0, FALSE), + PT(37, 63, 3, 3, FALSE), + PT( 3, 23, 3, 3, FALSE), + PT(53, 17, 3, 2, FALSE), + PT(27, 20, 5, 1, FALSE), + PT(40, 58, 4, 1, TRUE), + PT(14, 31, 2, 1, FALSE), + PT(54, 33, 4, 0, FALSE), + PT( 7, 59, 2, 0, FALSE), + PT(35, 25, 6, 2, FALSE), + PT(13, 46, 3, 0, FALSE), + PT(63, 32, 4, 2, TRUE), + PT(62, 59, 2, 2, TRUE), + PT(11, 46, 2, 1, FALSE), + PT(55, 11, 4, 1, TRUE), + PT(61, 50, 3, 3, TRUE), + PT(22, 3, 4, 3, TRUE), + PT(20, 12, 4, 0, TRUE), + PT(24, 3, 6, 0, FALSE), + PT(62, 33, 2, 1, TRUE), + PT(15, 0, 6, 1, FALSE), + PT(63, 35, 2, 3, FALSE), + PT(14, 49, 3, 2, TRUE), + PT(24, 28, 3, 2, TRUE), + PT(48, 14, 3, 3, FALSE), + PT(33, 32, 4, 1, TRUE), + PT(63, 12, 3, 3, FALSE), + PT(20, 51, 4, 1, FALSE), + PT(34, 33, 2, 2, TRUE), + PT(54, 5, 3, 3, FALSE), + PT(29, 49, 2, 2, FALSE), + PT(32, 17, 6, 3, TRUE), + PT(13, 51, 3, 0, TRUE), + PT(37, 5, 6, 3, FALSE), + PT(30, 49, 4, 0, FALSE), + PT(53, 58, 5, 3, TRUE), + PT(50, 47, 6, 0, FALSE), + PT(20, 35, 5, 2, TRUE), + PT(53, 30, 5, 0, TRUE), + PT( 5, 5, 3, 1, TRUE), + PT( 9, 31, 4, 3, FALSE), + PT(47, 11, 2, 2, TRUE), + PT(21, 17, 2, 1, TRUE), + PT(41, 27, 3, 0, FALSE), + PT(28, 19, 6, 2, TRUE), + PT(52, 49, 4, 1, TRUE), + PT(39, 63, 5, 3, TRUE), + PT( 9, 48, 3, 0, TRUE), + PT(35, 18, 6, 2, FALSE), + PT( 2, 42, 4, 0, TRUE), + PT( 9, 60, 3, 2, TRUE), + PT(12, 2, 2, 0, FALSE), + PT(34, 5, 2, 3, TRUE), + PT(34, 8, 3, 1, TRUE), + PT(10, 15, 2, 2, TRUE), + PT( 2, 17, 2, 1, TRUE), + PT( 1, 33, 4, 1, FALSE), + PT(22, 57, 6, 1, TRUE), + PT(36, 56, 6, 2, FALSE), + PT(15, 30, 5, 1, TRUE), + PT(43, 21, 2, 2, TRUE), + PT(32, 34, 5, 3, FALSE), + PT(58, 63, 6, 0, TRUE), + PT(26, 39, 5, 1, TRUE), + PT(41, 52, 2, 2, FALSE), + PT(22, 57, 5, 3, TRUE), + PT(19, 62, 2, 3, FALSE), + PT(54, 33, 6, 0, FALSE), + PT( 0, 36, 5, 1, TRUE), + PT(36, 33, 6, 0, FALSE), + PT(21, 49, 2, 1, TRUE), + PT(16, 55, 4, 2, FALSE), + PT( 8, 7, 4, 1, TRUE), + PT(33, 9, 4, 2, TRUE), + PT( 5, 60, 6, 1, FALSE), + PT(25, 3, 4, 2, TRUE), + PT(15, 41, 5, 1, TRUE), + PT(22, 7, 2, 1, TRUE), + PT(62, 61, 4, 2, TRUE), + PT(54, 11, 5, 0, FALSE), + PT(46, 43, 2, 3, FALSE), + PT(12, 49, 2, 0, TRUE), + PT(48, 19, 5, 2, TRUE), + PT(38, 62, 6, 3, TRUE), + PT(41, 47, 5, 3, FALSE), + PT(21, 61, 2, 3, TRUE), + PT(28, 46, 4, 0, TRUE), + PT(51, 47, 2, 0, FALSE), + PT(13, 5, 3, 2, TRUE), + PT(28, 26, 2, 1, FALSE), + PT(14, 24, 6, 3, TRUE), + PT(27, 17, 2, 2, FALSE), + PT( 6, 20, 4, 0, TRUE), + PT(49, 14, 4, 3, TRUE), + PT(26, 3, 2, 0, FALSE), + PT( 0, 52, 6, 0, TRUE), + PT(63, 11, 3, 2, TRUE), + PT(15, 18, 3, 3, TRUE), + PT(26, 21, 2, 0, FALSE), + PT(15, 0, 4, 2, FALSE), + PT(62, 10, 5, 1, FALSE), + PT(48, 43, 4, 2, FALSE), + PT(38, 49, 2, 0, FALSE), + PT(45, 47, 5, 3, TRUE), + PT(63, 12, 2, 1, TRUE), + PT(18, 11, 2, 3, FALSE), + PT(21, 7, 3, 3, TRUE), + PT(40, 16, 6, 1, FALSE), + PT(15, 23, 2, 2, TRUE), + PT(11, 39, 6, 1, TRUE), + PT(52, 29, 2, 0, FALSE), + PT(28, 58, 2, 1, FALSE), + PT(44, 39, 6, 3, TRUE), + PT(10, 26, 6, 1, FALSE), + PT( 5, 31, 4, 0, TRUE), + PT(36, 13, 3, 3, TRUE), + PT(28, 23, 4, 2, FALSE), + PT(47, 59, 6, 1, FALSE), + PT(59, 37, 2, 0, FALSE), + PT( 3, 47, 4, 0, TRUE), + PT(12, 16, 4, 1, TRUE), + PT(14, 58, 5, 2, FALSE), + PT(51, 3, 5, 2, FALSE), + PT(18, 6, 3, 2, FALSE), + PT(42, 55, 6, 0, FALSE), + PT(63, 1, 3, 3, FALSE), + PT(53, 22, 6, 3, TRUE), + PT(44, 50, 6, 2, TRUE), + PT( 5, 17, 4, 1, FALSE), + PT(41, 9, 4, 0, FALSE), + PT(43, 13, 3, 3, TRUE), + PT(24, 13, 4, 0, FALSE), + PT(35, 57, 2, 3, FALSE), + PT(15, 58, 3, 0, FALSE), + PT(33, 53, 5, 1, TRUE), + PT(54, 38, 5, 1, TRUE), + PT(35, 5, 5, 3, TRUE), + PT(27, 8, 2, 3, TRUE), + PT(62, 9, 2, 3, FALSE), + PT(45, 58, 6, 3, TRUE), + PT(21, 53, 6, 2, TRUE), + PT(41, 10, 2, 1, FALSE), + PT( 2, 57, 3, 3, TRUE), + PT(20, 52, 6, 1, TRUE), + PT(23, 29, 3, 0, FALSE), + PT(22, 29, 3, 1, FALSE), + PT( 1, 57, 4, 1, FALSE), + PT(30, 39, 6, 3, FALSE), + PT(50, 20, 4, 3, FALSE), + PT(10, 57, 6, 3, FALSE), + PT(31, 13, 3, 3, FALSE), + PT(11, 10, 3, 0, TRUE), + PT(53, 29, 6, 2, FALSE), + PT( 3, 18, 2, 3, FALSE), + PT(12, 19, 5, 3, FALSE), + PT(12, 52, 3, 3, FALSE), + PT(16, 20, 3, 3, FALSE), + PT(35, 50, 4, 3, TRUE), + PT( 2, 16, 5, 0, TRUE), + PT(53, 24, 6, 1, TRUE), + PT(51, 29, 3, 1, FALSE), + PT(60, 21, 4, 1, TRUE), + PT(62, 63, 4, 1, FALSE), + PT(42, 2, 5, 2, FALSE), + PT(40, 10, 5, 3, TRUE), + PT(26, 6, 6, 2, TRUE), + PT(60, 23, 5, 1, TRUE), + PT( 3, 18, 2, 3, TRUE), + PT(47, 10, 4, 3, FALSE), + PT(18, 56, 2, 0, TRUE), + PT(54, 27, 4, 1, TRUE), + PT( 1, 57, 6, 2, TRUE), + PT(25, 25, 2, 3, TRUE), + PT( 9, 40, 4, 1, FALSE), + PT(30, 39, 5, 2, FALSE), + PT(53, 51, 5, 2, FALSE), + PT(39, 37, 6, 0, TRUE), + PT( 6, 49, 5, 2, TRUE), + PT(26, 57, 5, 0, FALSE), + PT(45, 4, 3, 3, FALSE), + PT(36, 62, 3, 2, FALSE), + PT(60, 48, 3, 1, TRUE), + PT(63, 62, 6, 3, TRUE), + PT(34, 54, 2, 0, TRUE), + PT( 0, 1, 3, 2, FALSE), + PT(18, 26, 2, 0, FALSE), + PT(18, 30, 5, 2, FALSE), + PT(31, 18, 5, 1, FALSE), + PT(47, 6, 3, 0, TRUE), + PT(53, 26, 3, 0, FALSE), + PT(59, 9, 6, 3, FALSE), + PT(52, 29, 2, 1, TRUE), + PT( 2, 7, 2, 0, FALSE), + PT(32, 47, 3, 2, TRUE), + PT(11, 3, 6, 1, TRUE), + PT(28, 22, 6, 0, TRUE), + PT( 5, 19, 3, 1, TRUE), + PT(41, 6, 2, 1, TRUE), + PT(48, 45, 6, 3, FALSE), + PT(42, 45, 5, 2, FALSE), + PT(25, 52, 3, 2, FALSE), + PT(15, 21, 2, 1, FALSE), + PT(54, 21, 5, 2, FALSE), + PT(58, 6, 3, 2, FALSE), + PT(18, 29, 4, 3, FALSE), + PT( 3, 56, 3, 2, TRUE), + PT( 1, 1, 5, 2, TRUE), + PT(23, 46, 2, 0, FALSE), + PT(20, 23, 3, 2, FALSE), + PT(52, 15, 5, 0, FALSE), + PT( 9, 55, 3, 1, TRUE), + PT(40, 29, 4, 3, FALSE), + PT(41, 45, 6, 3, FALSE), + PT(30, 23, 5, 0, FALSE), + PT(21, 15, 3, 2, FALSE), + PT(32, 45, 2, 0, FALSE), + PT(39, 22, 5, 3, FALSE), + PT(20, 9, 2, 1, FALSE), + PT(59, 61, 4, 0, TRUE), + PT(37, 26, 5, 2, FALSE), + PT( 0, 34, 6, 3, FALSE), + PT(13, 48, 2, 0, FALSE), + PT(23, 25, 3, 1, TRUE), + PT( 0, 59, 4, 0, TRUE), + PT(42, 40, 6, 2, FALSE), + PT(45, 15, 2, 3, FALSE), + PT(10, 48, 5, 0, FALSE), + PT( 6, 0, 4, 2, TRUE), + PT(49, 46, 5, 1, FALSE), + PT(20, 51, 5, 0, FALSE), + PT(54, 16, 5, 3, FALSE), + PT( 5, 46, 3, 0, TRUE), + PT(25, 26, 2, 2, TRUE), + PT(44, 20, 2, 3, TRUE), + PT(55, 15, 2, 1, TRUE), + PT(50, 23, 3, 1, TRUE), + PT(57, 24, 6, 1, FALSE), + PT(46, 50, 3, 3, FALSE), + PT(36, 29, 6, 0, TRUE), + PT(18, 29, 5, 1, TRUE), + PT(20, 12, 4, 3, TRUE), + PT(54, 46, 6, 1, FALSE), + PT( 6, 10, 3, 1, FALSE), + PT(40, 40, 4, 0, FALSE), + PT(58, 58, 2, 3, TRUE), + PT( 8, 39, 6, 3, FALSE), + PT(24, 26, 2, 0, FALSE), + PT(30, 38, 3, 1, TRUE), + PT(31, 51, 3, 3, TRUE), + PT(33, 23, 5, 3, TRUE), + PT( 1, 8, 4, 0, FALSE), + PT(53, 3, 3, 0, TRUE), + PT(59, 2, 4, 0, FALSE), + PT( 2, 45, 4, 1, TRUE), + PT(14, 23, 6, 1, FALSE), + PT(49, 41, 2, 0, TRUE), + PT(34, 23, 4, 1, FALSE), + PT(58, 44, 4, 1, TRUE), + PT(52, 32, 3, 0, FALSE), + PT( 0, 58, 4, 1, FALSE), + PT(37, 51, 4, 0, TRUE), + PT(51, 4, 4, 3, TRUE), + PT( 4, 24, 6, 1, FALSE), + PT(44, 12, 5, 3, TRUE), + PT(40, 20, 5, 2, FALSE), + PT(63, 48, 5, 1, TRUE), + PT(48, 33, 3, 2, TRUE), + PT( 1, 37, 6, 1, FALSE), + PT( 5, 35, 6, 2, FALSE), + PT(36, 16, 6, 0, FALSE), + PT(61, 20, 3, 1, TRUE), + PT(63, 56, 5, 3, TRUE), + PT(34, 27, 6, 1, FALSE), + PT(37, 7, 6, 3, TRUE), + PT(10, 12, 3, 2, TRUE), + PT( 3, 30, 3, 1, FALSE), + PT(15, 60, 2, 1, FALSE), + PT(17, 24, 3, 2, TRUE), + PT( 0, 53, 5, 3, TRUE), + PT(50, 24, 2, 2, FALSE), + PT(35, 48, 3, 1, TRUE), + PT(17, 61, 2, 1, FALSE), + PT(26, 22, 6, 2, TRUE), + PT(40, 5, 4, 2, FALSE), + PT(23, 61, 6, 3, TRUE), + PT(46, 9, 5, 3, FALSE), + PT(24, 29, 2, 3, TRUE), + PT(32, 31, 3, 0, FALSE), + PT(35, 44, 5, 3, TRUE), + PT(32, 63, 2, 3, FALSE), + PT(63, 41, 5, 3, FALSE), + PT(35, 59, 5, 0, TRUE), + PT(24, 57, 2, 1, TRUE), + PT(30, 50, 6, 2, TRUE), + PT(20, 29, 5, 1, FALSE), + PT(53, 1, 3, 2, TRUE), + PT(62, 59, 3, 3, FALSE), + PT(34, 30, 2, 3, FALSE), + PT(24, 34, 2, 1, FALSE), + PT(62, 41, 6, 1, TRUE), + PT(47, 20, 3, 0, TRUE), + PT(59, 7, 2, 2, TRUE), + PT( 6, 61, 5, 0, TRUE), + PT(53, 55, 4, 1, TRUE), + PT(52, 29, 5, 2, TRUE), + PT(24, 18, 3, 1, TRUE), + PT(11, 19, 4, 2, FALSE), + PT(19, 56, 3, 2, FALSE), + PT(31, 11, 3, 1, TRUE), + PT(19, 33, 3, 2, FALSE), + PT( 6, 57, 6, 1, FALSE), + PT(55, 61, 4, 3, FALSE), + PT(41, 38, 2, 2, TRUE), + PT(60, 51, 4, 3, TRUE), + PT( 0, 1, 5, 3, FALSE), + PT(21, 24, 6, 0, TRUE), + PT(13, 44, 2, 1, TRUE), + PT(39, 59, 4, 0, FALSE), + PT(45, 1, 4, 3, FALSE), + PT(35, 21, 6, 0, FALSE), + PT(36, 0, 2, 3, TRUE), + PT(55, 63, 6, 1, TRUE), + PT(37, 36, 6, 0, TRUE), + PT( 6, 59, 6, 3, TRUE), + PT( 3, 24, 3, 1, FALSE), + PT(44, 52, 2, 2, FALSE), + PT(29, 54, 3, 0, FALSE), + PT(58, 4, 4, 1, TRUE), + PT(18, 38, 2, 2, TRUE), + PT(43, 25, 3, 1, FALSE), + PT(41, 44, 6, 3, FALSE), + PT( 1, 25, 3, 2, TRUE), + PT(47, 6, 5, 1, TRUE), + PT(12, 18, 4, 3, FALSE), + PT(54, 50, 3, 2, TRUE), + PT(13, 18, 5, 0, FALSE), + PT( 3, 40, 2, 1, TRUE), + PT(41, 6, 2, 3, TRUE), + PT( 3, 56, 4, 0, TRUE), + PT(48, 44, 2, 0, FALSE), + PT(34, 0, 5, 0, FALSE), + PT(36, 59, 3, 2, FALSE), + PT(32, 62, 2, 1, TRUE), + PT( 2, 12, 3, 0, TRUE), + PT(41, 44, 3, 1, FALSE), + PT(57, 48, 4, 1, FALSE), + PT(42, 31, 4, 1, FALSE), + PT(20, 52, 5, 2, FALSE), + PT(20, 37, 3, 1, TRUE), + PT( 6, 59, 2, 2, TRUE), + PT( 6, 28, 2, 1, TRUE), + PT(21, 3, 3, 0, FALSE), + PT(30, 42, 3, 1, TRUE), + PT(23, 37, 5, 3, TRUE), + PT(28, 41, 5, 3, FALSE), + PT( 2, 50, 3, 3, FALSE), + PT(29, 40, 6, 2, TRUE), + PT(54, 3, 6, 2, FALSE), + PT(22, 61, 5, 1, FALSE), + PT(18, 13, 2, 1, TRUE), + PT(29, 45, 4, 0, TRUE), + PT(50, 23, 5, 3, FALSE), + PT(26, 21, 4, 3, FALSE), + PT(34, 47, 2, 2, TRUE), + PT(60, 14, 4, 0, FALSE), + PT(47, 39, 2, 1, TRUE), + PT( 4, 9, 6, 1, FALSE), + PT(30, 1, 6, 2, FALSE), + PT( 6, 22, 3, 3, FALSE), + PT(46, 27, 3, 2, FALSE), + PT(40, 19, 5, 1, FALSE), + PT(48, 52, 2, 1, FALSE), + PT(18, 50, 3, 0, FALSE), + PT(29, 29, 6, 2, TRUE), + PT( 7, 28, 2, 3, FALSE), + PT(45, 61, 6, 2, TRUE), + PT(28, 27, 4, 2, FALSE), + PT(33, 45, 3, 3, FALSE), + PT(16, 9, 2, 2, FALSE), + PT(61, 17, 2, 1, FALSE), + PT(37, 2, 4, 3, FALSE), + PT(35, 2, 3, 0, TRUE), + PT(25, 5, 2, 2, FALSE), + PT(11, 33, 3, 1, FALSE), + PT( 9, 2, 5, 2, FALSE), + PT(24, 40, 5, 2, TRUE), + PT(30, 16, 2, 1, FALSE), + PT(46, 24, 5, 3, FALSE), + PT(31, 2, 5, 2, FALSE), + PT(20, 23, 4, 2, FALSE), + PT(57, 8, 6, 1, FALSE), + PT(22, 20, 4, 1, FALSE), + PT(22, 40, 4, 0, TRUE), + PT(17, 16, 5, 2, FALSE), + PT(35, 54, 5, 1, TRUE), + PT(57, 33, 4, 3, FALSE), + PT(14, 6, 5, 2, TRUE), + PT(60, 62, 4, 3, FALSE), + PT(42, 27, 3, 3, TRUE), + PT( 0, 60, 6, 1, TRUE), + PT(53, 63, 2, 2, FALSE), + PT( 0, 11, 2, 0, FALSE), + PT(52, 60, 2, 3, TRUE), + PT(45, 7, 3, 3, TRUE), + PT(36, 57, 4, 3, TRUE), + PT(22, 0, 3, 2, TRUE), + PT(51, 43, 3, 3, FALSE), + PT(15, 8, 6, 0, TRUE), + PT(58, 9, 2, 1, TRUE), + PT(12, 33, 3, 2, FALSE), + PT(42, 23, 6, 2, FALSE), + PT(41, 39, 2, 0, FALSE), + PT(55, 27, 3, 0, FALSE), + PT(21, 8, 5, 3, TRUE), + PT(31, 22, 2, 1, FALSE), + PT(31, 40, 6, 2, FALSE), + PT(28, 32, 4, 1, FALSE), + PT(18, 1, 2, 1, FALSE), + PT(33, 49, 2, 0, FALSE), + PT(34, 38, 3, 3, FALSE), + PT( 1, 61, 2, 0, TRUE), + PT(30, 39, 4, 2, TRUE), + PT(61, 48, 4, 2, FALSE), + PT(29, 17, 4, 1, FALSE), + PT(54, 48, 2, 3, FALSE), + PT(31, 62, 5, 1, FALSE), + PT(60, 39, 3, 1, TRUE), + PT(31, 41, 2, 0, FALSE), + PT(30, 5, 5, 1, FALSE), + PT(10, 16, 2, 2, FALSE), + PT(31, 0, 5, 3, FALSE), + PT(11, 59, 3, 0, FALSE), + PT(10, 57, 6, 0, FALSE), + PT(55, 11, 3, 3, TRUE), + PT(29, 10, 5, 0, TRUE), + PT(62, 28, 6, 1, TRUE), + PT(19, 46, 5, 0, FALSE), + PT(39, 27, 3, 3, FALSE), + PT(29, 2, 3, 2, FALSE), + PT( 1, 37, 2, 2, FALSE), + PT(58, 16, 3, 2, FALSE), + PT(18, 5, 5, 1, FALSE), + PT(48, 32, 4, 3, FALSE), + PT(47, 46, 5, 3, FALSE), + PT( 3, 7, 4, 2, FALSE), + PT(54, 4, 5, 1, TRUE), + PT(17, 37, 5, 2, TRUE), + PT(40, 14, 5, 3, FALSE), + PT(15, 29, 2, 2, TRUE), + PT(28, 40, 6, 0, FALSE), + PT(31, 35, 4, 3, FALSE), + PT(54, 18, 6, 3, TRUE), + PT(58, 49, 2, 0, FALSE), + PT(44, 44, 5, 3, TRUE), + PT(26, 13, 2, 2, TRUE), + PT(63, 60, 6, 1, FALSE), + PT(53, 28, 2, 3, FALSE), + PT(51, 22, 5, 0, FALSE), + PT(29, 63, 4, 0, TRUE), + PT(44, 62, 5, 1, TRUE), + PT(36, 35, 5, 3, TRUE), + PT(50, 21, 5, 1, FALSE), + PT(27, 16, 6, 2, TRUE), + PT(24, 55, 2, 0, FALSE), + PT(59, 30, 2, 0, TRUE), + PT(43, 22, 4, 2, FALSE), + PT(29, 22, 4, 3, FALSE), + PT(60, 45, 2, 0, TRUE), + PT(21, 40, 5, 0, FALSE), + PT(39, 39, 4, 3, TRUE), + PT(59, 58, 2, 3, FALSE), + PT(26, 12, 3, 1, FALSE), + PT(21, 8, 4, 2, TRUE), + PT(11, 16, 4, 1, FALSE), + PT(26, 62, 2, 3, TRUE), + PT(40, 31, 3, 3, FALSE), + PT( 1, 30, 3, 3, FALSE), + PT(28, 47, 2, 0, FALSE), + PT(37, 11, 6, 2, FALSE), + PT(62, 12, 3, 1, FALSE), + PT(27, 16, 5, 1, FALSE), + PT(15, 20, 2, 3, TRUE), + PT(15, 63, 2, 3, TRUE), + PT( 3, 21, 3, 3, TRUE), + PT( 2, 54, 2, 3, TRUE), + PT(21, 29, 3, 0, FALSE), + PT( 8, 54, 2, 0, FALSE), + PT(20, 13, 5, 1, TRUE), + PT(10, 5, 3, 2, TRUE), + PT(38, 18, 3, 3, FALSE), + PT(62, 24, 3, 0, TRUE), + PT(54, 24, 6, 3, TRUE), + PT(23, 57, 5, 3, FALSE), + PT(13, 4, 3, 0, TRUE), + PT(22, 34, 2, 2, TRUE), + PT(62, 38, 3, 3, TRUE), + PT( 0, 6, 2, 3, TRUE), + PT(51, 34, 3, 2, TRUE), + PT(43, 57, 5, 1, TRUE), + PT(62, 49, 3, 2, FALSE), + PT(34, 63, 2, 1, TRUE), + PT(48, 28, 6, 0, TRUE), + PT( 7, 43, 2, 2, FALSE), + PT(50, 53, 3, 3, FALSE), + PT( 2, 7, 4, 0, FALSE), + PT(15, 59, 2, 0, TRUE), + PT(32, 7, 2, 1, FALSE), + PT(42, 48, 3, 2, TRUE), + PT(40, 56, 6, 3, FALSE), + PT(32, 1, 2, 3, TRUE), + PT(21, 32, 4, 0, TRUE), + PT(58, 27, 3, 3, FALSE), + PT(56, 18, 4, 2, FALSE), + PT( 3, 62, 3, 3, TRUE), + PT(41, 29, 2, 1, TRUE), + PT(32, 39, 3, 0, TRUE), + PT(18, 37, 4, 0, FALSE), + PT(50, 51, 5, 1, TRUE), + PT(63, 5, 6, 0, TRUE), + PT(53, 60, 5, 2, TRUE), + PT(45, 2, 5, 3, FALSE), + PT(16, 42, 2, 3, FALSE), + PT(23, 8, 6, 0, TRUE), + PT(23, 46, 5, 1, TRUE), + PT(48, 30, 2, 2, TRUE), + PT(49, 21, 4, 3, FALSE), + PT( 8, 16, 6, 1, TRUE), + PT(21, 1, 4, 3, TRUE), + PT(18, 7, 5, 3, TRUE), + PT(41, 39, 6, 2, FALSE), + PT(63, 8, 6, 0, TRUE), + PT(28, 32, 3, 1, FALSE), + PT(51, 12, 2, 1, TRUE), + PT(24, 49, 4, 2, FALSE), + PT(55, 45, 5, 3, FALSE), + PT(33, 24, 4, 2, FALSE), + PT(58, 39, 6, 0, TRUE), + PT(53, 62, 6, 0, FALSE), + PT(58, 20, 6, 1, TRUE), + PT(15, 26, 5, 2, TRUE), + PT(48, 46, 2, 0, TRUE), + PT(26, 49, 3, 2, TRUE), + PT(23, 60, 3, 0, FALSE), + PT(51, 49, 4, 1, TRUE), + PT(29, 57, 5, 2, TRUE), + PT(16, 29, 5, 3, TRUE), + PT(36, 21, 3, 2, FALSE), + PT(37, 1, 5, 1, TRUE), + PT(34, 22, 5, 3, FALSE), + PT(27, 37, 6, 2, TRUE), + PT(55, 16, 4, 3, FALSE), + PT(57, 1, 6, 3, FALSE), + PT(23, 43, 2, 2, FALSE), + PT( 9, 22, 2, 3, TRUE), + PT(32, 40, 4, 1, TRUE), + PT(38, 58, 4, 3, FALSE), + PT(39, 42, 4, 2, FALSE), + PT(54, 2, 5, 2, FALSE), + PT(41, 48, 6, 2, TRUE), + PT(54, 1, 3, 3, TRUE), + PT(40, 59, 3, 2, TRUE), + PT(35, 30, 5, 2, TRUE), + PT(17, 30, 5, 2, FALSE), + PT(47, 50, 3, 0, TRUE), + PT(63, 38, 6, 0, TRUE), + PT(56, 30, 2, 3, TRUE), + PT( 5, 24, 5, 3, FALSE), + PT( 0, 46, 2, 1, FALSE), + PT(52, 63, 6, 2, FALSE), + PT(22, 16, 5, 0, TRUE), + PT(32, 61, 6, 3, FALSE), + PT(47, 22, 4, 2, TRUE), + PT(18, 23, 2, 0, FALSE), + PT(33, 55, 6, 2, TRUE), + PT(37, 55, 5, 2, TRUE), + PT( 1, 8, 4, 3, TRUE), + PT( 3, 31, 5, 0, TRUE), + PT(13, 42, 2, 3, FALSE), + PT(58, 63, 6, 1, TRUE), + PT(43, 25, 3, 2, TRUE), + PT(42, 31, 5, 0, TRUE), + PT(40, 44, 2, 0, FALSE), + PT(40, 48, 2, 0, FALSE), + PT(57, 20, 3, 1, TRUE), + PT( 0, 24, 4, 0, TRUE), + PT(40, 12, 6, 3, TRUE), + PT(17, 16, 2, 0, TRUE), + PT(60, 51, 6, 1, FALSE), + PT(51, 54, 3, 1, FALSE), + PT(54, 0, 3, 2, FALSE), + PT(49, 27, 3, 2, TRUE), + PT(56, 29, 2, 0, FALSE), + PT(60, 57, 4, 3, TRUE), + PT(58, 63, 2, 2, FALSE), + PT(25, 18, 2, 2, FALSE), + PT(13, 31, 3, 0, FALSE), + PT( 0, 37, 3, 0, FALSE), + PT(40, 28, 6, 1, FALSE), + PT(39, 3, 3, 1, FALSE), + PT(38, 45, 5, 1, FALSE), + PT(41, 40, 4, 3, TRUE), + PT(10, 42, 3, 0, FALSE), + PT(10, 26, 6, 0, FALSE), + PT(32, 26, 5, 3, FALSE), + PT( 6, 11, 3, 2, TRUE), + PT(15, 12, 3, 2, FALSE), + PT(53, 40, 3, 2, FALSE), + PT(61, 22, 4, 1, TRUE), + PT(33, 28, 6, 0, TRUE), + PT(20, 28, 5, 3, FALSE), + PT(34, 50, 6, 2, TRUE), + PT( 9, 41, 6, 0, FALSE), + PT(32, 26, 2, 0, FALSE), + PT(49, 63, 5, 2, FALSE), + PT(10, 61, 6, 3, TRUE), + PT(11, 46, 5, 2, TRUE), + PT(31, 34, 6, 0, TRUE), + PT( 6, 7, 5, 0, TRUE), + PT(34, 23, 5, 2, TRUE), + PT(48, 17, 3, 0, FALSE), + PT(12, 25, 2, 2, TRUE), + PT( 7, 10, 6, 2, FALSE), + PT(24, 41, 4, 3, TRUE), + PT(51, 12, 6, 0, FALSE), + PT( 3, 26, 6, 3, TRUE), + PT( 6, 1, 5, 2, TRUE), + PT(15, 59, 5, 1, TRUE), + PT(17, 31, 6, 3, TRUE), + PT(43, 33, 6, 3, FALSE), + PT(63, 35, 2, 3, TRUE), + PT(23, 7, 5, 1, TRUE), + PT(43, 14, 6, 0, FALSE), + PT(17, 57, 3, 2, TRUE), + PT(41, 3, 6, 1, TRUE), + PT(48, 3, 5, 3, TRUE), + PT(60, 32, 4, 3, FALSE), + PT( 3, 34, 2, 2, FALSE), + PT(58, 40, 6, 2, TRUE), + PT( 1, 40, 5, 1, TRUE), + PT(62, 21, 3, 0, FALSE), + PT(48, 7, 2, 3, TRUE), + PT(59, 44, 6, 0, FALSE), + PT(21, 7, 5, 2, FALSE), + PT(23, 39, 3, 2, TRUE), + PT(63, 30, 6, 1, TRUE), + PT(13, 23, 2, 0, FALSE), + PT(21, 14, 6, 0, FALSE), + PT( 9, 5, 6, 0, FALSE), + PT(45, 32, 2, 2, TRUE), + PT(60, 61, 6, 0, FALSE), + PT(12, 23, 3, 2, FALSE), + PT(26, 13, 4, 2, TRUE), + PT(43, 43, 5, 1, FALSE), + PT( 2, 22, 5, 2, TRUE), + PT(23, 49, 2, 3, TRUE), + PT( 0, 8, 2, 1, TRUE), + PT(55, 53, 4, 0, TRUE), + PT(30, 28, 3, 3, TRUE), + PT(43, 50, 3, 2, FALSE), + PT(16, 42, 2, 3, FALSE), + PT(58, 51, 6, 0, TRUE), + PT(23, 43, 5, 1, FALSE), + PT(12, 61, 2, 0, TRUE), + PT(40, 10, 6, 0, FALSE), + PT(35, 10, 4, 3, FALSE), + PT(10, 20, 4, 2, FALSE), + PT(11, 15, 6, 0, FALSE), + PT(27, 30, 5, 0, TRUE), + PT( 2, 53, 5, 0, FALSE), + PT(59, 2, 2, 2, FALSE), + PT( 0, 15, 6, 2, TRUE), + PT(28, 60, 5, 3, FALSE), + PT(40, 56, 3, 0, TRUE), + PT(27, 17, 2, 1, FALSE), + PT( 9, 22, 2, 0, FALSE), + PT(46, 13, 4, 0, FALSE), + PT(61, 4, 6, 1, FALSE), + PT(22, 44, 4, 2, TRUE), + PT( 2, 61, 3, 0, FALSE), + PT(11, 19, 3, 2, FALSE), + PT(34, 42, 3, 2, FALSE), + PT(32, 39, 4, 1, FALSE), + PT( 5, 38, 4, 1, FALSE), + PT(18, 29, 5, 2, FALSE), + PT( 8, 5, 5, 3, FALSE), + PT(63, 28, 2, 3, TRUE), + PT(36, 13, 6, 1, TRUE), + PT(54, 8, 4, 2, FALSE), + PT(16, 34, 5, 0, TRUE), + PT(28, 10, 2, 0, TRUE), + PT(37, 15, 2, 0, FALSE), + PT(36, 56, 5, 3, TRUE), + PT(37, 50, 3, 3, FALSE), + PT( 6, 42, 5, 0, TRUE), + PT(62, 58, 5, 0, FALSE), + PT(52, 23, 6, 1, TRUE), + PT(24, 51, 2, 3, TRUE), + PT( 7, 20, 3, 3, TRUE), + PT(17, 23, 4, 0, FALSE), + PT(19, 14, 2, 2, FALSE), + PT(59, 28, 2, 1, FALSE), + PT(42, 19, 6, 3, TRUE), + PT(42, 53, 6, 1, FALSE), + PT(48, 2, 4, 2, TRUE), + PT( 0, 7, 3, 3, TRUE), + PT(12, 4, 5, 2, FALSE), + PT(55, 55, 6, 0, FALSE), + PT(37, 18, 4, 2, TRUE), + PT(18, 34, 4, 0, TRUE), + PT(34, 53, 6, 1, TRUE), + PT( 7, 32, 5, 2, TRUE), + PT(39, 14, 6, 0, FALSE), + PT(52, 25, 3, 1, FALSE), + PT(10, 60, 4, 2, TRUE), + PT( 7, 29, 5, 1, TRUE), + PT(49, 58, 2, 1, FALSE), + PT(26, 61, 6, 3, TRUE), + PT(22, 21, 2, 3, FALSE), + PT(57, 19, 2, 2, TRUE), + PT(45, 3, 5, 3, FALSE), + PT( 6, 57, 5, 2, FALSE), + PT(22, 0, 2, 1, TRUE), + PT(53, 42, 6, 2, TRUE), + PT(36, 1, 3, 0, FALSE), + PT(36, 55, 5, 0, FALSE), + PT(37, 27, 6, 2, FALSE), + PT(37, 25, 2, 3, TRUE), + PT(39, 47, 3, 1, TRUE), + PT(39, 13, 2, 0, FALSE), + PT(54, 60, 6, 0, FALSE), + PT(60, 51, 4, 1, TRUE), + PT(62, 39, 3, 3, FALSE), + PT(37, 45, 5, 0, TRUE), + PT(31, 18, 4, 0, TRUE), + PT(55, 50, 3, 3, TRUE), + PT(17, 33, 6, 2, TRUE), + PT(48, 12, 3, 0, TRUE), + PT(37, 61, 4, 3, FALSE), + PT(23, 2, 3, 2, TRUE), + PT(20, 46, 2, 0, TRUE), + PT(56, 19, 6, 0, FALSE), + PT(10, 43, 4, 0, FALSE), + PT(30, 16, 2, 2, TRUE), + PT(55, 48, 5, 3, FALSE), + PT(30, 4, 5, 2, FALSE), + PT(20, 52, 3, 0, TRUE), + PT( 8, 20, 3, 0, FALSE), + PT(14, 28, 6, 0, FALSE), + PT(26, 46, 3, 1, TRUE), + PT(31, 57, 6, 0, TRUE), + PT(12, 28, 5, 0, FALSE), + PT(62, 51, 4, 1, TRUE), + PT(15, 19, 2, 3, FALSE), + PT(37, 57, 5, 3, TRUE), + PT(20, 27, 3, 1, FALSE), + PT(40, 62, 4, 0, TRUE), + PT(45, 25, 2, 0, TRUE), + PT(12, 52, 6, 1, FALSE), + PT(57, 49, 3, 0, TRUE), + PT(26, 8, 6, 2, FALSE), + PT( 9, 47, 2, 0, TRUE), + PT(48, 4, 3, 2, FALSE), + PT( 2, 59, 3, 1, TRUE), + PT(51, 33, 6, 1, TRUE), + PT(56, 2, 3, 1, FALSE), + PT(49, 56, 6, 1, FALSE), + PT(31, 29, 2, 3, FALSE), + PT(23, 16, 3, 1, TRUE), + PT(50, 32, 2, 3, TRUE), + PT( 0, 51, 2, 1, FALSE), + PT(33, 15, 4, 3, TRUE), + PT(20, 25, 4, 3, TRUE), + PT(36, 44, 6, 3, TRUE), + PT(37, 5, 5, 3, TRUE), + PT(61, 37, 2, 0, TRUE), + PT(18, 48, 3, 1, FALSE), + PT(22, 3, 3, 1, FALSE), + PT(20, 9, 2, 1, TRUE), + PT( 2, 35, 4, 1, FALSE), + PT( 1, 60, 2, 0, FALSE), + PT(63, 45, 4, 1, TRUE), + PT(49, 63, 4, 1, TRUE), + PT(23, 0, 6, 1, TRUE), + PT(63, 15, 5, 3, TRUE), + PT(38, 7, 2, 2, TRUE), + PT(33, 43, 5, 1, FALSE), + PT(56, 57, 3, 3, FALSE), + PT( 9, 37, 5, 1, TRUE), + PT(59, 48, 4, 2, TRUE), + PT(18, 45, 2, 1, TRUE), + PT(50, 25, 5, 0, FALSE), + PT(36, 28, 5, 2, TRUE), + PT(53, 50, 4, 3, FALSE), + PT(13, 35, 3, 3, FALSE), + PT(29, 7, 4, 0, TRUE), + PT(11, 52, 2, 3, TRUE), + PT(45, 50, 6, 1, FALSE), + PT(58, 60, 6, 2, TRUE), + PT(26, 16, 6, 1, TRUE), + PT(26, 7, 4, 1, FALSE), + PT(59, 27, 5, 1, FALSE), + PT(51, 31, 4, 3, FALSE), + PT(14, 53, 3, 1, FALSE), + PT(59, 10, 3, 2, FALSE), + PT(17, 7, 2, 0, TRUE), + PT(13, 60, 5, 2, TRUE), + PT(30, 55, 5, 0, TRUE), + PT(17, 5, 2, 1, FALSE), + PT(21, 47, 3, 2, FALSE), + PT(36, 49, 2, 3, FALSE), + PT(43, 33, 3, 1, TRUE), + PT(35, 16, 6, 0, TRUE), + PT( 2, 20, 5, 0, TRUE), + PT(38, 32, 2, 3, FALSE), + PT(16, 23, 2, 0, FALSE), + PT(11, 15, 6, 1, TRUE), + PT( 1, 46, 2, 2, FALSE), + PT(33, 14, 6, 3, TRUE), + PT(26, 29, 5, 3, TRUE), + PT(30, 48, 4, 2, FALSE), + PT( 4, 20, 5, 2, TRUE), + PT(17, 0, 6, 0, FALSE), + PT( 8, 42, 3, 2, TRUE), + PT(29, 34, 4, 0, TRUE), + PT(36, 44, 6, 3, TRUE), + PT(36, 17, 2, 1, FALSE), + PT( 4, 46, 5, 0, FALSE), + PT(29, 24, 4, 1, TRUE), + PT(60, 22, 2, 3, FALSE), + PT(16, 23, 6, 0, TRUE), + PT(32, 33, 2, 1, FALSE), + PT(51, 62, 6, 2, FALSE), + PT( 6, 19, 2, 1, TRUE), + PT(23, 56, 5, 1, TRUE), + PT(20, 13, 2, 2, TRUE), + PT(36, 59, 5, 1, TRUE), + PT(52, 59, 3, 3, FALSE), + PT(24, 7, 6, 2, FALSE), + PT(55, 29, 3, 3, TRUE), + PT(11, 41, 4, 0, FALSE), + PT(18, 30, 3, 2, TRUE), + PT(26, 36, 4, 2, FALSE), + PT(61, 40, 4, 2, FALSE), + PT(11, 18, 6, 1, TRUE), + PT(27, 58, 4, 1, FALSE), + PT(20, 19, 5, 1, FALSE), + PT(49, 56, 2, 2, TRUE), + PT(55, 43, 5, 3, FALSE), + PT(25, 30, 5, 2, FALSE), + PT(63, 27, 5, 1, FALSE), + PT(51, 31, 6, 1, TRUE), + PT(63, 21, 5, 0, TRUE), + PT( 1, 30, 3, 0, FALSE), + PT(31, 34, 3, 0, TRUE), + PT(51, 60, 6, 2, FALSE), + PT(30, 18, 4, 1, FALSE), + PT(13, 55, 5, 2, FALSE), + PT(15, 8, 6, 0, TRUE), + PT(46, 9, 6, 3, FALSE), + PT( 1, 5, 3, 3, FALSE), + PT(28, 4, 3, 3, FALSE), + PT(12, 1, 3, 2, FALSE), + PT(41, 40, 5, 3, TRUE), + PT(57, 45, 2, 2, FALSE), + PT( 9, 34, 6, 3, FALSE), + PT( 4, 55, 6, 3, TRUE), + PT(45, 47, 6, 2, TRUE), + PT(36, 35, 3, 1, TRUE), + PT( 8, 32, 6, 1, FALSE), + PT(32, 31, 6, 2, FALSE), + PT( 2, 49, 3, 0, TRUE), + PT(24, 19, 6, 3, FALSE), + PT( 6, 43, 3, 3, FALSE), + PT(14, 27, 2, 0, FALSE), + PT(47, 14, 3, 2, FALSE), + PT(17, 56, 2, 1, TRUE), + PT( 1, 55, 3, 0, TRUE), + PT(20, 17, 4, 3, FALSE), + PT(49, 61, 6, 1, TRUE), + PT(29, 27, 6, 2, FALSE), + PT(37, 49, 5, 3, TRUE), + PT(17, 10, 5, 3, TRUE), + PT(57, 23, 3, 1, TRUE), + PT( 5, 14, 2, 1, TRUE), + PT(41, 37, 4, 1, FALSE), + PT(21, 13, 4, 0, FALSE), + PT(43, 39, 4, 0, TRUE), + PT(62, 36, 4, 3, TRUE), + PT(42, 43, 2, 3, FALSE), + PT(36, 61, 2, 2, TRUE), + PT(21, 48, 6, 0, TRUE), + PT(15, 51, 4, 2, FALSE), + PT( 6, 22, 2, 1, TRUE), + PT( 6, 49, 2, 0, FALSE), + PT(46, 63, 2, 0, FALSE), + PT( 5, 13, 5, 3, TRUE), + PT(60, 31, 3, 0, TRUE), + PT(18, 19, 4, 2, FALSE), + PT(15, 51, 6, 3, FALSE), + PT(21, 59, 6, 1, TRUE), + PT( 3, 15, 5, 1, FALSE), + PT(59, 60, 5, 2, FALSE), + PT(54, 9, 5, 0, TRUE), + PT(17, 59, 4, 3, TRUE), + PT(40, 43, 6, 0, TRUE), + PT(26, 14, 5, 3, TRUE), + PT(57, 44, 6, 0, TRUE), + PT(14, 60, 6, 2, TRUE), + PT(44, 36, 6, 1, TRUE), + PT(61, 17, 5, 1, TRUE), + PT( 7, 60, 6, 3, TRUE), + PT(20, 24, 2, 1, TRUE), + PT(29, 63, 5, 3, FALSE), + PT(48, 18, 4, 2, TRUE), + PT(38, 29, 2, 0, TRUE), + PT( 7, 17, 3, 3, FALSE), + PT(52, 1, 2, 0, TRUE), + PT(11, 57, 4, 0, TRUE), + PT(41, 2, 5, 0, TRUE), + PT(21, 16, 3, 1, FALSE), + PT(48, 31, 6, 2, TRUE), + PT(60, 43, 5, 1, FALSE), + PT(48, 59, 6, 3, FALSE), + PT(32, 26, 4, 1, TRUE), + PT(50, 36, 5, 1, TRUE), + PT(21, 32, 3, 2, FALSE), + PT(37, 61, 6, 3, FALSE), + PT(45, 20, 6, 0, TRUE), + PT(24, 35, 2, 3, TRUE), + PT(24, 5, 2, 1, TRUE), + PT(52, 48, 6, 3, TRUE), + PT(14, 57, 4, 1, TRUE), + PT(29, 31, 2, 3, TRUE), + PT( 1, 21, 5, 3, TRUE), + PT(11, 62, 3, 1, TRUE), + PT(13, 25, 5, 3, FALSE), + PT(49, 56, 3, 2, FALSE), + PT(21, 52, 2, 2, TRUE), + PT(19, 25, 5, 0, TRUE), + PT(25, 20, 4, 3, TRUE), + PT(21, 24, 4, 1, TRUE), + PT(41, 12, 4, 3, TRUE), + PT(45, 14, 2, 3, TRUE), + PT(52, 24, 2, 0, FALSE), + PT(59, 30, 5, 0, TRUE), + PT(52, 44, 4, 1, FALSE), + PT(49, 8, 2, 1, TRUE), + PT(29, 24, 3, 1, FALSE), + PT(28, 11, 5, 1, FALSE), + PT(25, 30, 3, 1, FALSE), + PT(35, 39, 2, 3, TRUE), + PT(59, 14, 6, 3, TRUE), + PT(25, 43, 2, 3, FALSE), + PT(47, 8, 4, 0, TRUE), + PT(55, 2, 4, 0, FALSE), + PT(11, 50, 6, 0, FALSE), + PT(22, 5, 6, 0, FALSE), + PT(19, 5, 3, 1, FALSE), + PT( 7, 57, 3, 0, TRUE), + PT(12, 59, 5, 1, FALSE), + PT(21, 5, 6, 0, FALSE), + PT(48, 5, 3, 0, TRUE), + PT(19, 0, 2, 1, FALSE), + PT(39, 22, 5, 1, FALSE), + PT(15, 40, 4, 3, TRUE), + PT(12, 35, 5, 3, TRUE), + PT(57, 40, 5, 1, FALSE), + PT(36, 37, 3, 3, TRUE), + PT(24, 41, 2, 2, FALSE), + PT(22, 5, 3, 1, FALSE), + PT(53, 47, 4, 3, FALSE), + PT(10, 58, 5, 0, TRUE), + PT(52, 44, 6, 3, FALSE), + PT(46, 58, 2, 2, TRUE), + PT(26, 10, 5, 2, TRUE), + PT(22, 20, 5, 3, FALSE), + PT(53, 40, 5, 1, FALSE), + PT(53, 15, 2, 0, TRUE), + PT(17, 50, 3, 0, TRUE), + PT(32, 26, 5, 0, FALSE), + PT(23, 26, 5, 0, FALSE), + PT(22, 51, 4, 2, TRUE), + PT(19, 44, 5, 0, TRUE), + PT( 9, 22, 6, 1, TRUE), + PT(29, 39, 4, 3, FALSE), + PT(21, 12, 5, 3, TRUE), + PT(34, 28, 3, 0, TRUE), + PT(41, 51, 2, 0, FALSE), + PT(45, 17, 3, 1, TRUE), + PT(22, 25, 5, 3, FALSE), + PT(13, 12, 5, 0, FALSE), + PT(55, 58, 6, 2, FALSE), + PT(42, 29, 6, 3, TRUE), + PT(48, 10, 6, 3, FALSE), + PT(36, 57, 3, 1, TRUE), + PT(57, 10, 6, 1, FALSE), + PT(17, 3, 5, 2, TRUE), + PT(50, 29, 6, 0, FALSE), + PT(56, 30, 4, 3, TRUE), + PT(46, 23, 3, 0, FALSE), + PT(22, 23, 5, 1, FALSE), + PT(54, 59, 6, 0, TRUE), + PT(23, 4, 3, 0, TRUE), + PT(58, 37, 5, 2, TRUE), + PT( 0, 54, 4, 3, TRUE), + PT(37, 18, 6, 1, TRUE), + PT( 6, 10, 2, 2, FALSE), + PT(17, 5, 5, 3, TRUE), + PT( 3, 53, 5, 3, TRUE), + PT(11, 52, 5, 0, TRUE), + PT( 0, 49, 2, 1, TRUE), + PT(39, 15, 3, 2, FALSE), + PT(29, 6, 5, 2, TRUE), + PT(28, 48, 4, 3, TRUE), + PT(47, 42, 4, 3, TRUE), + PT(22, 32, 6, 0, TRUE), + PT(51, 43, 5, 1, TRUE), + PT( 5, 48, 6, 3, FALSE), + PT(41, 35, 6, 2, TRUE), + PT(16, 22, 5, 3, TRUE), + PT(45, 32, 5, 0, TRUE), + PT(55, 19, 4, 2, FALSE), + PT(45, 14, 4, 2, TRUE), + PT( 8, 10, 3, 0, FALSE), + PT(15, 3, 3, 1, TRUE), + PT(49, 12, 6, 3, TRUE), + PT(30, 52, 6, 0, TRUE), + PT(27, 14, 4, 2, TRUE), + PT(26, 7, 6, 2, FALSE), + PT(13, 60, 6, 1, TRUE), + PT( 0, 58, 6, 3, FALSE), + PT( 4, 39, 2, 1, FALSE), + PT(35, 24, 4, 2, FALSE), + PT(13, 11, 3, 0, FALSE), + PT(49, 50, 6, 3, TRUE), + PT( 0, 13, 4, 0, TRUE), + PT(50, 16, 2, 1, FALSE), + PT(38, 13, 3, 0, TRUE), + PT(41, 36, 5, 1, TRUE), + PT(61, 33, 3, 3, TRUE), + PT(30, 27, 5, 0, FALSE), + PT(13, 18, 5, 0, FALSE), + PT(53, 30, 4, 1, TRUE), + PT(10, 46, 4, 1, FALSE), + PT(39, 39, 6, 2, TRUE), + PT( 1, 14, 4, 0, FALSE), + PT(49, 57, 5, 0, TRUE), + PT(59, 36, 6, 3, FALSE), + PT(20, 16, 6, 1, TRUE), + PT(24, 44, 4, 3, FALSE), + PT( 4, 45, 2, 2, TRUE), + PT(26, 17, 6, 3, TRUE), + PT(15, 11, 2, 2, FALSE), + PT(14, 44, 5, 2, FALSE), + PT(33, 23, 5, 2, FALSE), + PT(22, 33, 6, 2, TRUE), + PT(62, 16, 2, 0, FALSE), + PT(10, 5, 3, 3, FALSE), + PT(59, 9, 2, 1, TRUE), + PT(38, 24, 3, 3, FALSE), + PT(35, 12, 3, 1, FALSE), + PT(51, 55, 3, 3, TRUE), + PT( 9, 18, 6, 2, TRUE), + PT(61, 13, 2, 2, TRUE), + PT(54, 6, 4, 2, FALSE), + PT(51, 48, 5, 0, TRUE), + PT(59, 15, 5, 0, FALSE), + PT(52, 42, 5, 2, FALSE), + PT( 2, 18, 6, 2, TRUE), + PT( 9, 34, 6, 0, TRUE), + PT(59, 49, 3, 2, FALSE), + PT(51, 34, 4, 3, TRUE), + PT(61, 52, 2, 2, TRUE), + PT(20, 34, 5, 0, FALSE), + PT(40, 16, 3, 3, FALSE), + PT(33, 49, 2, 0, FALSE), + PT(45, 22, 4, 0, TRUE), + PT(30, 5, 6, 1, TRUE), + PT(15, 48, 6, 0, TRUE), + PT(14, 26, 6, 2, TRUE), + PT(56, 46, 5, 0, FALSE), + PT(38, 55, 3, 3, FALSE), + PT(43, 19, 6, 1, TRUE), + PT(31, 30, 6, 3, TRUE), + PT(10, 40, 4, 2, FALSE), + PT(50, 28, 3, 1, FALSE), + PT(31, 63, 3, 0, TRUE), + PT(57, 57, 5, 0, TRUE), + PT(44, 27, 2, 2, FALSE), + PT(21, 42, 2, 3, TRUE), + PT(50, 15, 4, 0, TRUE), + PT(48, 33, 3, 0, FALSE), + PT(35, 42, 4, 3, TRUE), + PT(61, 7, 2, 0, FALSE), + PT(11, 63, 5, 3, TRUE), + PT(49, 2, 5, 3, FALSE), + PT( 8, 57, 5, 3, TRUE), + PT(63, 32, 3, 0, FALSE), + PT(45, 52, 2, 0, TRUE), + PT(46, 52, 2, 0, FALSE), + PT(38, 18, 4, 1, TRUE), + PT(37, 10, 6, 3, TRUE), + PT(52, 9, 4, 2, TRUE), + PT(10, 62, 2, 3, FALSE), + PT(26, 23, 2, 0, TRUE), + PT(56, 28, 4, 0, FALSE), + PT(17, 33, 4, 3, FALSE), + PT( 5, 15, 3, 0, FALSE), + PT(38, 43, 6, 1, FALSE), + PT(10, 12, 2, 3, FALSE), + PT( 3, 41, 3, 2, TRUE), + PT(41, 59, 4, 1, TRUE), + PT(22, 27, 5, 0, TRUE), + PT( 7, 9, 2, 3, TRUE), + PT(23, 44, 3, 2, FALSE), + PT(53, 51, 6, 0, FALSE), + PT(23, 18, 3, 3, FALSE), + PT(61, 26, 5, 1, TRUE), + PT(33, 29, 2, 0, FALSE), + PT(10, 8, 2, 3, TRUE), + PT(20, 60, 6, 3, FALSE), + PT(40, 54, 6, 3, FALSE), + PT(59, 32, 3, 1, TRUE), + PT(19, 34, 3, 2, TRUE), + PT(19, 58, 2, 2, TRUE), + PT( 2, 35, 5, 2, FALSE), + PT(62, 25, 2, 2, FALSE), + PT(57, 60, 3, 1, FALSE), + PT(16, 8, 3, 3, FALSE), + PT(10, 19, 5, 0, TRUE), + PT(63, 56, 5, 2, FALSE), + PT( 7, 35, 3, 3, TRUE), + PT(25, 42, 4, 2, FALSE), + PT(20, 60, 3, 3, TRUE), + PT(13, 4, 6, 3, TRUE), + PT(26, 47, 5, 0, FALSE), + PT(42, 29, 3, 3, FALSE), + PT(17, 55, 5, 0, TRUE), + PT(40, 39, 2, 1, FALSE), + PT(13, 0, 4, 3, FALSE), + PT(10, 60, 4, 3, FALSE), + PT(31, 28, 6, 1, TRUE), + PT( 4, 58, 5, 2, FALSE), + PT(36, 61, 5, 1, TRUE), + PT(38, 49, 5, 3, TRUE), + PT(19, 28, 4, 0, TRUE), + PT(62, 18, 4, 1, TRUE), + PT(54, 10, 3, 1, FALSE), + PT(45, 30, 3, 0, TRUE), + PT( 5, 31, 3, 1, TRUE), + PT(30, 10, 3, 3, TRUE), + PT(32, 8, 4, 2, FALSE), + PT(44, 12, 6, 1, TRUE), + PT(29, 31, 2, 0, TRUE), + PT(14, 18, 2, 0, FALSE), + PT(39, 18, 3, 0, TRUE), + PT(42, 19, 6, 0, TRUE), + PT(28, 4, 6, 0, FALSE), + PT(26, 56, 3, 3, TRUE), + PT(44, 53, 4, 2, TRUE), + PT( 7, 11, 6, 1, TRUE), + PT(45, 2, 3, 1, FALSE), + PT(42, 53, 6, 2, TRUE), + PT(22, 47, 2, 2, FALSE), + PT(17, 49, 6, 1, TRUE), + PT(44, 49, 3, 3, FALSE), + PT(60, 58, 4, 3, TRUE), + PT(60, 43, 2, 1, FALSE), + PT(39, 29, 2, 1, FALSE), + PT(54, 44, 5, 1, TRUE), + PT(37, 59, 6, 2, TRUE), + PT(18, 61, 4, 3, TRUE), + PT(19, 35, 3, 0, TRUE), + PT(51, 44, 4, 3, FALSE), + PT( 9, 60, 2, 1, FALSE), + PT(21, 26, 4, 1, TRUE), + PT(33, 7, 3, 1, FALSE), + PT(34, 37, 4, 0, FALSE), + PT(25, 27, 5, 2, FALSE), + PT(58, 25, 6, 2, TRUE), + PT( 5, 38, 3, 2, TRUE), + PT(35, 34, 4, 2, TRUE), + PT(14, 30, 2, 0, TRUE), + PT(19, 48, 2, 1, FALSE), + PT(44, 34, 4, 2, TRUE), + PT(10, 29, 3, 0, FALSE), + PT(35, 62, 3, 2, TRUE), + PT( 2, 40, 4, 2, TRUE), + PT(33, 14, 4, 0, FALSE), + PT(33, 34, 6, 3, TRUE), + PT(24, 51, 4, 3, TRUE), + PT(35, 35, 6, 0, TRUE), + PT(36, 26, 3, 1, FALSE), + PT(62, 37, 4, 2, FALSE), + PT(36, 1, 3, 0, FALSE), + PT(52, 16, 4, 1, FALSE), + PT( 7, 0, 6, 3, TRUE), + PT( 6, 32, 4, 0, FALSE), + PT(58, 2, 5, 1, TRUE), + PT( 7, 44, 5, 2, FALSE), + PT( 9, 47, 5, 1, FALSE), + PT( 1, 50, 5, 2, FALSE), + PT( 0, 53, 2, 1, TRUE), + PT(43, 60, 3, 3, TRUE), + PT(54, 55, 3, 3, FALSE), + PT(32, 53, 3, 2, TRUE), + PT(12, 7, 6, 1, TRUE), + PT(22, 8, 2, 1, FALSE), + PT(63, 54, 2, 0, TRUE), + PT(11, 31, 5, 2, TRUE), + PT(33, 32, 6, 1, TRUE), + PT(23, 26, 5, 3, FALSE), + PT(22, 1, 5, 3, TRUE), + PT(47, 28, 6, 2, FALSE), + PT(41, 49, 5, 3, FALSE), + PT(59, 56, 6, 0, TRUE), + PT(13, 22, 2, 1, FALSE), + PT( 7, 41, 4, 2, FALSE), + PT(51, 60, 6, 2, FALSE), + PT(62, 30, 3, 0, FALSE), + PT(48, 2, 6, 2, FALSE), + PT(42, 52, 3, 1, TRUE), + PT(46, 35, 3, 0, FALSE), + PT(52, 0, 3, 3, TRUE), + PT(32, 14, 5, 0, FALSE), + PT(21, 51, 6, 3, TRUE), + PT(39, 53, 4, 1, TRUE), + PT(55, 62, 2, 0, TRUE), + PT(50, 46, 6, 3, FALSE), + PT(58, 2, 5, 1, TRUE), + PT( 0, 54, 3, 2, TRUE), + PT(19, 41, 2, 3, FALSE), + PT( 8, 43, 6, 3, TRUE), + PT( 8, 2, 4, 3, TRUE), + PT(50, 45, 6, 2, FALSE), + PT(48, 54, 5, 0, TRUE), + PT(46, 16, 2, 1, FALSE), + PT(60, 46, 5, 1, FALSE), + PT( 4, 51, 6, 0, FALSE), + PT(63, 1, 4, 1, FALSE), + PT(55, 20, 3, 2, TRUE), + PT(39, 0, 5, 3, TRUE), + PT(12, 57, 4, 3, FALSE), + PT(39, 4, 4, 0, TRUE), + PT(25, 8, 3, 2, TRUE), + PT( 1, 4, 3, 3, FALSE), + PT(39, 27, 5, 1, TRUE), + PT(49, 23, 3, 3, TRUE), + PT( 7, 1, 5, 2, TRUE), + PT(46, 59, 3, 3, TRUE), + PT(52, 36, 6, 0, TRUE), + PT(50, 43, 4, 2, FALSE), + PT(14, 7, 3, 3, FALSE), + PT(15, 51, 2, 0, FALSE), + PT(22, 33, 6, 1, FALSE), + PT(57, 2, 3, 1, FALSE), + PT(51, 61, 4, 1, FALSE), + PT(12, 37, 3, 1, FALSE), + PT(41, 41, 5, 0, FALSE), + PT(58, 50, 4, 3, FALSE), + PT(11, 19, 4, 1, FALSE), + PT(31, 15, 3, 2, FALSE), + PT( 4, 44, 4, 0, FALSE), + PT(57, 26, 3, 1, TRUE), + PT(26, 42, 3, 3, TRUE), + PT(36, 19, 3, 1, FALSE), + PT(49, 59, 6, 1, TRUE), + PT(57, 35, 5, 0, FALSE), + PT(49, 7, 6, 0, TRUE), + PT(31, 16, 4, 0, FALSE), + PT(41, 23, 6, 1, FALSE), + PT(38, 59, 5, 2, TRUE), + PT( 2, 60, 3, 2, FALSE), + PT(14, 0, 4, 0, FALSE), + PT(20, 62, 6, 3, TRUE), + PT( 1, 15, 5, 2, TRUE), + PT( 6, 18, 4, 3, TRUE), + PT(48, 19, 3, 0, TRUE), + PT( 0, 51, 5, 1, FALSE), + PT(12, 7, 4, 3, TRUE), + PT(17, 58, 3, 2, FALSE), + PT(21, 10, 2, 1, TRUE), + PT(31, 13, 5, 1, FALSE), + PT(55, 7, 5, 1, FALSE), + PT(52, 53, 6, 2, FALSE), + PT(40, 22, 4, 3, TRUE), + PT( 6, 2, 6, 3, FALSE), + PT( 9, 35, 6, 0, FALSE), + PT(20, 2, 5, 0, FALSE), + PT(57, 50, 6, 2, FALSE), + PT(36, 53, 2, 1, FALSE), + PT(18, 34, 4, 3, FALSE), + PT( 9, 7, 6, 1, TRUE), + PT(15, 62, 3, 3, FALSE), + PT( 0, 60, 6, 1, TRUE), + PT(16, 55, 2, 2, FALSE), + PT(58, 3, 4, 2, TRUE), + PT(45, 30, 4, 2, FALSE), + PT(54, 54, 4, 3, FALSE), + PT(31, 60, 3, 1, FALSE), + PT(55, 51, 4, 2, TRUE), + PT(35, 19, 3, 3, TRUE), + PT(51, 13, 2, 1, TRUE), + PT(37, 48, 3, 3, FALSE), + PT(23, 3, 3, 0, FALSE), + PT(24, 24, 2, 2, FALSE), + PT(48, 7, 4, 1, FALSE), + PT(62, 51, 4, 0, TRUE), + PT(20, 55, 2, 3, FALSE), + PT(22, 0, 2, 1, FALSE), + PT(44, 18, 5, 3, TRUE), + PT(37, 63, 3, 3, FALSE), + PT(36, 25, 2, 3, FALSE), + PT(22, 15, 6, 2, TRUE), + PT(45, 16, 2, 0, TRUE), + PT(36, 42, 5, 0, FALSE), + PT(25, 37, 5, 3, FALSE), + PT(12, 22, 3, 3, TRUE), + PT(56, 33, 6, 3, FALSE), + PT(61, 26, 5, 3, TRUE), + PT(59, 50, 2, 1, FALSE), + PT(54, 19, 5, 0, TRUE), + PT(14, 48, 6, 0, TRUE), + PT(25, 7, 5, 3, TRUE), + PT(37, 35, 5, 0, FALSE), + PT(32, 8, 5, 0, TRUE), + PT(42, 0, 6, 0, FALSE), + PT(48, 56, 4, 1, TRUE), + PT(30, 15, 3, 3, TRUE), + PT(59, 27, 6, 0, FALSE), + PT(58, 55, 5, 3, TRUE), + PT(57, 55, 6, 2, TRUE), + PT(57, 45, 5, 3, TRUE), + PT(31, 46, 3, 3, FALSE), + PT(26, 43, 3, 3, FALSE), + PT(20, 23, 4, 0, FALSE), + PT(47, 3, 2, 0, TRUE), + PT(29, 0, 6, 0, FALSE), + PT(23, 43, 3, 2, TRUE), + PT(53, 40, 4, 2, TRUE), + PT(59, 15, 2, 0, TRUE), + PT( 9, 4, 5, 3, FALSE), + PT(35, 17, 3, 3, FALSE), + PT(19, 55, 3, 3, FALSE), + PT(55, 55, 3, 3, FALSE), + PT( 7, 1, 6, 1, FALSE), + PT(20, 6, 6, 1, FALSE), + PT(17, 12, 5, 3, FALSE), + PT(54, 46, 4, 2, FALSE), + PT(21, 42, 3, 2, FALSE), + PT(34, 21, 6, 2, FALSE), + PT(44, 30, 6, 2, TRUE), + PT(34, 39, 6, 1, TRUE), + PT(25, 63, 5, 2, TRUE), + PT(33, 51, 2, 2, TRUE), + PT(38, 26, 2, 0, TRUE), + PT(22, 62, 2, 1, FALSE), + PT(43, 36, 2, 2, TRUE), + PT(60, 15, 5, 2, TRUE), + PT(49, 21, 6, 3, FALSE), + PT(63, 36, 3, 2, TRUE), + PT(37, 1, 6, 3, TRUE), + PT(51, 22, 3, 1, FALSE), + PT(31, 14, 2, 0, FALSE), + PT(47, 11, 2, 1, FALSE), + PT(42, 26, 4, 2, TRUE), + PT(23, 10, 6, 2, TRUE), + PT( 9, 40, 6, 2, TRUE), + PT( 2, 19, 6, 3, FALSE), + PT(52, 47, 2, 3, TRUE), + PT( 3, 4, 6, 0, TRUE), + PT(62, 38, 2, 0, TRUE), + PT(53, 51, 6, 0, TRUE), + PT(34, 23, 4, 1, TRUE), + PT(29, 5, 5, 1, TRUE), + PT(46, 39, 4, 0, FALSE), + PT( 3, 43, 3, 2, TRUE), + PT( 1, 25, 3, 3, FALSE), + PT(14, 5, 3, 0, FALSE), + PT(22, 37, 2, 3, TRUE), + PT( 2, 40, 3, 0, FALSE), + PT(25, 11, 4, 2, FALSE), + PT(62, 53, 2, 3, FALSE), + PT(46, 41, 4, 2, TRUE), + PT(62, 56, 3, 3, FALSE), + PT(58, 47, 2, 1, FALSE), + PT(20, 23, 5, 2, TRUE), + PT(17, 18, 6, 0, FALSE), + PT(21, 49, 3, 0, FALSE), + PT( 8, 11, 5, 0, TRUE), + PT(45, 0, 6, 1, TRUE), + PT(44, 6, 3, 1, FALSE), + PT(20, 28, 5, 3, FALSE), + PT( 4, 8, 2, 1, FALSE), + PT(27, 43, 5, 2, TRUE), + PT(42, 55, 6, 1, TRUE), + PT(16, 39, 5, 2, FALSE), + PT(29, 14, 6, 2, FALSE), + PT(32, 2, 2, 1, FALSE), + PT(30, 26, 5, 3, FALSE), + PT( 7, 11, 2, 0, FALSE), + PT(54, 30, 6, 1, TRUE), + PT(43, 40, 3, 1, TRUE), + PT(49, 37, 3, 3, TRUE), + PT(56, 58, 5, 3, TRUE), + PT(57, 48, 5, 3, TRUE), + PT(18, 9, 2, 2, FALSE), + PT(14, 8, 3, 0, TRUE), + PT( 0, 13, 5, 2, FALSE), + PT(27, 14, 6, 2, FALSE), + PT(17, 37, 2, 2, TRUE), + PT(12, 45, 4, 3, FALSE), + PT(54, 44, 2, 3, FALSE), + PT(49, 49, 5, 2, FALSE), + PT( 3, 26, 2, 3, FALSE), + PT(28, 50, 2, 2, FALSE), + PT(10, 62, 6, 3, FALSE), + PT(51, 27, 4, 3, TRUE), + PT(31, 50, 3, 0, FALSE), + PT(51, 38, 6, 1, TRUE), + PT(26, 19, 3, 1, FALSE), + PT(15, 52, 3, 2, FALSE), + PT(53, 44, 5, 3, TRUE), + PT(56, 3, 3, 0, FALSE), + PT(21, 15, 4, 3, TRUE), + PT(49, 41, 4, 0, FALSE), + PT(40, 14, 5, 0, FALSE), + PT(49, 44, 5, 3, FALSE), + PT(21, 25, 3, 1, TRUE), + PT(16, 3, 5, 3, TRUE), + PT(46, 42, 6, 1, FALSE), + PT(42, 39, 3, 1, TRUE), + PT(54, 4, 3, 3, FALSE), + PT(59, 4, 4, 0, TRUE), + PT( 7, 47, 3, 0, TRUE), + PT(39, 29, 3, 2, TRUE), + PT(60, 61, 5, 3, FALSE), + PT(37, 8, 6, 1, FALSE), + PT(59, 52, 5, 1, FALSE), + PT(12, 16, 2, 1, TRUE), + PT(37, 53, 3, 1, FALSE), + PT(47, 25, 5, 0, FALSE), + PT(23, 0, 5, 1, TRUE), + PT(10, 28, 2, 3, TRUE), + PT(10, 17, 3, 1, TRUE), + PT(53, 19, 6, 3, TRUE), + PT(41, 28, 5, 0, FALSE), + PT(12, 49, 6, 2, TRUE), + PT(60, 16, 3, 1, FALSE), + PT(27, 58, 5, 2, TRUE), + PT(58, 28, 3, 0, FALSE), + PT(34, 16, 5, 2, TRUE), + PT(28, 60, 2, 1, FALSE), + PT(23, 24, 5, 1, FALSE), + PT(11, 43, 5, 3, TRUE), + PT(45, 4, 5, 3, FALSE), + PT(60, 19, 4, 1, TRUE), + PT( 1, 28, 5, 3, FALSE), + PT(20, 22, 4, 1, FALSE), + PT(12, 36, 2, 1, TRUE), + PT(53, 55, 6, 2, FALSE), + PT(27, 48, 3, 3, FALSE), + PT(58, 28, 4, 0, FALSE), + PT( 6, 6, 6, 3, FALSE), + PT( 9, 21, 3, 1, FALSE), + PT(27, 26, 4, 3, TRUE), + PT(15, 51, 6, 2, TRUE), + PT(55, 6, 4, 1, TRUE), + PT(58, 18, 3, 2, TRUE), + PT( 0, 22, 5, 0, TRUE), + PT(14, 29, 6, 2, TRUE), + PT(63, 56, 2, 3, FALSE), + PT(42, 60, 6, 2, FALSE), + PT(19, 50, 2, 0, FALSE), + PT(23, 44, 6, 3, TRUE), + PT(41, 42, 3, 3, FALSE), + PT(53, 47, 5, 2, TRUE), + PT(60, 42, 2, 0, TRUE), + PT(40, 19, 4, 0, TRUE), + PT(25, 30, 6, 2, FALSE), + PT(12, 6, 5, 2, TRUE), + PT( 9, 4, 3, 2, FALSE), + PT(29, 47, 4, 3, FALSE), + PT(57, 7, 2, 3, FALSE), + PT(20, 4, 5, 2, TRUE), + PT(58, 47, 5, 3, FALSE), + PT(41, 21, 6, 2, TRUE), + PT(36, 2, 6, 3, FALSE), + PT(63, 2, 3, 1, FALSE), + PT(15, 24, 4, 2, FALSE), + PT(22, 29, 3, 0, TRUE), + PT(20, 22, 2, 0, FALSE), + PT(41, 27, 2, 1, TRUE), + PT(21, 14, 3, 0, TRUE), + PT(58, 46, 5, 1, TRUE), + PT( 8, 48, 2, 2, TRUE), + PT(53, 22, 6, 0, FALSE), + PT(46, 24, 6, 2, TRUE), + PT(59, 11, 3, 2, FALSE), + PT(58, 24, 2, 1, TRUE), + PT(41, 19, 3, 3, FALSE), + PT(32, 19, 4, 3, TRUE), + PT( 4, 29, 6, 2, FALSE), + PT( 0, 56, 3, 0, TRUE), + PT( 8, 57, 6, 1, FALSE), + PT(32, 16, 4, 3, FALSE), + PT( 8, 2, 5, 0, FALSE), + PT(63, 15, 2, 3, FALSE), + PT(48, 31, 3, 0, TRUE), + PT(32, 45, 2, 0, FALSE), + PT(56, 23, 3, 2, FALSE), + PT(24, 49, 4, 3, TRUE), + PT(51, 56, 6, 0, FALSE), + PT(22, 51, 4, 1, TRUE), + PT( 0, 1, 6, 3, FALSE), + PT(13, 2, 4, 1, TRUE), + PT(57, 4, 3, 3, TRUE), + PT(14, 48, 4, 2, FALSE), + PT( 6, 1, 5, 2, FALSE), + PT(52, 51, 6, 2, TRUE), + PT(22, 52, 5, 3, FALSE), + PT(50, 22, 4, 2, FALSE), + PT(38, 57, 6, 2, FALSE), + PT(31, 60, 3, 2, TRUE), + PT(40, 29, 6, 3, TRUE), + PT(23, 21, 5, 1, TRUE), + PT(39, 57, 6, 0, FALSE), + PT(11, 27, 3, 0, FALSE), + PT(53, 32, 5, 2, TRUE), + PT(11, 53, 3, 2, FALSE), + PT( 3, 14, 4, 0, TRUE), + PT( 6, 12, 4, 0, FALSE), + PT( 2, 24, 6, 2, FALSE), + PT(30, 54, 5, 2, TRUE), + PT(22, 12, 3, 0, TRUE), + PT(37, 9, 5, 2, FALSE), + PT(55, 5, 5, 3, FALSE), + PT(46, 43, 5, 2, FALSE), + PT(36, 26, 2, 2, FALSE), + PT(39, 4, 2, 0, FALSE), + PT(50, 56, 6, 1, TRUE), + PT(55, 21, 6, 2, TRUE), + PT(17, 63, 3, 2, TRUE), + PT(35, 35, 3, 3, TRUE), + PT(41, 63, 3, 2, TRUE), + PT(26, 60, 5, 1, TRUE), + PT(27, 44, 5, 2, FALSE), + PT(56, 59, 6, 3, FALSE), + PT( 4, 19, 6, 1, TRUE), + PT(44, 20, 2, 1, FALSE), + PT(26, 9, 3, 1, TRUE), + PT(54, 17, 4, 2, FALSE), + PT(58, 63, 2, 0, TRUE), + PT( 1, 14, 5, 1, TRUE), + PT(59, 3, 5, 1, FALSE), + PT( 8, 13, 5, 1, TRUE), + PT(43, 19, 4, 3, TRUE), + PT(58, 60, 3, 2, FALSE), + PT(58, 21, 5, 1, FALSE), + PT(36, 0, 2, 3, TRUE), + PT(62, 10, 2, 2, TRUE), + PT(12, 41, 5, 2, TRUE), + PT(31, 21, 6, 0, FALSE), + PT(53, 24, 3, 0, TRUE), + PT(61, 55, 6, 3, TRUE), + PT(18, 56, 3, 1, TRUE), + PT(59, 2, 4, 0, FALSE), + PT( 8, 33, 3, 0, TRUE), + PT(46, 54, 3, 2, TRUE), + PT(21, 61, 4, 2, FALSE), + PT(34, 12, 4, 3, TRUE), + PT(54, 63, 6, 1, TRUE), + PT(51, 18, 2, 0, TRUE), + PT(26, 25, 3, 3, TRUE), + PT(43, 36, 2, 1, FALSE), + PT(17, 42, 3, 0, FALSE), + PT(37, 50, 5, 1, FALSE), + PT(44, 26, 2, 1, FALSE), + PT(38, 6, 2, 0, FALSE), + PT(17, 41, 6, 1, TRUE), + PT(44, 9, 2, 2, FALSE), + PT(43, 18, 5, 1, TRUE), + PT(29, 3, 4, 2, FALSE), + PT( 0, 18, 2, 2, TRUE), + PT(34, 61, 4, 3, FALSE), + PT(21, 55, 3, 1, FALSE), + PT(15, 18, 6, 3, TRUE), + PT(36, 1, 3, 0, FALSE), + PT(42, 23, 2, 1, TRUE), + PT(20, 59, 5, 0, TRUE), + PT(42, 25, 6, 1, FALSE), + PT(45, 23, 2, 3, TRUE), + PT(11, 44, 6, 1, TRUE), + PT( 7, 45, 6, 2, FALSE), + PT( 7, 56, 3, 2, TRUE), + PT(31, 54, 4, 1, FALSE), + PT(17, 10, 2, 3, TRUE), + PT(20, 17, 2, 1, TRUE), + PT(42, 23, 4, 2, TRUE), + PT( 1, 58, 3, 2, FALSE), + PT(38, 39, 6, 0, FALSE), + PT(45, 59, 6, 2, TRUE), + PT(58, 48, 6, 2, FALSE), + PT( 6, 58, 3, 2, FALSE), + PT(45, 5, 2, 1, TRUE), + PT(33, 50, 2, 1, FALSE), + PT(62, 30, 5, 2, FALSE), + PT(58, 63, 5, 2, TRUE), + PT(32, 42, 6, 2, FALSE), + PT(38, 3, 3, 1, FALSE), + PT(25, 39, 5, 3, FALSE), + PT(49, 4, 4, 3, FALSE), + PT(42, 63, 6, 0, FALSE), + PT(37, 35, 5, 1, FALSE), + PT( 8, 8, 6, 2, TRUE), + PT(44, 48, 3, 3, FALSE), + PT( 8, 5, 3, 0, FALSE), + PT( 6, 9, 5, 2, TRUE), + PT(25, 0, 4, 3, TRUE), + PT(13, 16, 3, 0, TRUE), + PT(28, 0, 2, 1, TRUE), + PT(61, 11, 4, 2, FALSE), + PT(46, 31, 2, 3, FALSE), + PT(61, 24, 6, 2, FALSE), + PT(18, 30, 2, 2, TRUE), + PT(21, 57, 4, 2, TRUE), + PT(51, 15, 2, 3, TRUE), + PT(26, 28, 3, 1, TRUE), + PT(55, 41, 3, 1, TRUE), + PT(59, 56, 2, 1, FALSE), + PT(29, 34, 6, 2, FALSE), + PT(38, 10, 6, 0, TRUE), + PT(22, 45, 2, 1, TRUE), + PT(13, 32, 4, 3, TRUE), + PT(36, 29, 2, 3, FALSE), + PT(46, 43, 3, 0, FALSE), + PT(22, 42, 3, 1, TRUE), + PT(36, 23, 6, 3, FALSE), + PT( 2, 5, 5, 1, TRUE), + PT(55, 26, 2, 3, TRUE), + PT(17, 61, 5, 2, FALSE), + PT(30, 47, 4, 1, FALSE), + PT(44, 41, 3, 1, FALSE), + PT(47, 4, 4, 2, TRUE), + PT(54, 12, 6, 2, TRUE), + PT(48, 62, 2, 1, FALSE), + PT(17, 48, 6, 3, TRUE), + PT(18, 33, 5, 3, FALSE), + PT(33, 48, 2, 3, TRUE), + PT(44, 61, 4, 2, FALSE), + PT(17, 35, 2, 2, FALSE), + PT(26, 50, 2, 3, TRUE), + PT(57, 39, 3, 0, FALSE), + PT(15, 36, 3, 0, TRUE), + PT( 0, 61, 6, 3, TRUE), + PT(44, 60, 3, 2, FALSE), + PT(11, 57, 4, 1, TRUE), + PT(14, 4, 3, 3, TRUE), + PT(28, 49, 2, 2, FALSE), + PT( 0, 4, 2, 2, TRUE), + PT(38, 42, 5, 1, FALSE), + PT(32, 37, 5, 1, FALSE), + PT(11, 60, 6, 1, TRUE), + PT(17, 11, 5, 3, FALSE), + PT(55, 34, 5, 3, FALSE), + PT(14, 34, 4, 3, FALSE), + PT(24, 45, 4, 3, TRUE), + PT( 6, 12, 3, 2, FALSE), + PT(38, 24, 5, 3, TRUE), + PT(58, 1, 5, 1, FALSE), + PT(47, 49, 6, 2, FALSE), + PT(31, 52, 3, 1, FALSE), + PT(49, 5, 2, 0, FALSE), + PT(46, 23, 6, 2, FALSE), + PT(24, 34, 4, 1, TRUE), + PT(35, 33, 6, 1, FALSE), + PT( 7, 8, 4, 1, FALSE), + PT(38, 28, 4, 1, FALSE), + PT(49, 18, 5, 3, TRUE), + PT( 8, 31, 2, 0, FALSE), + PT(39, 21, 5, 1, FALSE), + PT(31, 11, 4, 3, FALSE), + PT(47, 20, 6, 2, TRUE), + PT(36, 31, 4, 3, FALSE), + PT(59, 35, 6, 1, TRUE), + PT(32, 62, 5, 2, TRUE), + PT(23, 12, 2, 2, TRUE), + PT(19, 57, 3, 1, FALSE), + PT(48, 20, 4, 2, TRUE), + PT( 9, 7, 2, 3, TRUE), + PT(56, 56, 3, 3, TRUE), + PT(41, 36, 4, 3, TRUE), + PT(23, 39, 5, 0, FALSE), + PT(27, 18, 5, 1, FALSE), + PT(43, 61, 5, 2, TRUE), + PT(25, 52, 3, 2, FALSE), + PT( 1, 29, 2, 0, FALSE), + PT( 8, 57, 2, 0, TRUE), + PT(14, 54, 3, 1, TRUE), + PT(38, 19, 2, 0, FALSE), + PT(22, 40, 3, 3, FALSE), + PT(60, 40, 2, 3, TRUE), + PT(62, 57, 6, 2, FALSE), + PT(10, 3, 5, 3, FALSE), + PT(55, 26, 2, 1, TRUE), + PT(43, 51, 4, 3, FALSE), + PT(19, 44, 4, 0, TRUE), + PT(37, 20, 2, 0, FALSE), + PT(22, 11, 6, 2, TRUE), + PT(29, 53, 6, 1, TRUE), + PT(33, 8, 6, 1, TRUE), + PT(40, 33, 3, 1, FALSE), + PT(18, 12, 3, 1, TRUE), + PT(54, 42, 3, 0, TRUE), + PT(44, 43, 4, 1, TRUE), + PT( 1, 15, 4, 3, FALSE), + PT(23, 12, 3, 0, FALSE), + PT( 9, 15, 2, 0, TRUE), + PT(43, 36, 3, 2, FALSE), + PT( 9, 9, 2, 2, TRUE), + PT(54, 8, 2, 1, TRUE), + PT(32, 57, 4, 0, TRUE), + PT( 0, 58, 3, 3, TRUE), + PT(43, 54, 6, 0, TRUE), + PT( 2, 55, 2, 1, TRUE), + PT( 4, 52, 6, 2, TRUE), + PT(55, 61, 3, 1, FALSE), + PT(23, 61, 2, 1, TRUE), + PT(43, 54, 5, 3, TRUE), + PT(19, 30, 2, 1, TRUE), + PT(62, 17, 6, 1, TRUE), + PT(39, 58, 5, 2, TRUE), + PT(30, 49, 3, 1, FALSE), + PT( 3, 3, 5, 2, TRUE), + PT(37, 55, 3, 3, TRUE), + PT(17, 1, 4, 1, FALSE), + PT(28, 18, 2, 3, TRUE), + PT(48, 58, 6, 0, FALSE), + PT(23, 29, 5, 0, TRUE), + PT(14, 19, 4, 3, TRUE), + PT(26, 46, 4, 2, FALSE), + PT(45, 0, 3, 2, FALSE), + PT(23, 40, 3, 2, TRUE), + PT( 9, 31, 5, 3, FALSE), + PT(26, 45, 4, 3, FALSE), + PT(10, 19, 6, 1, FALSE), + PT(62, 0, 4, 3, TRUE), + PT(11, 59, 6, 0, FALSE), + PT( 8, 58, 5, 2, TRUE), + PT(34, 18, 3, 3, FALSE), + PT(52, 29, 5, 1, TRUE), + PT(38, 34, 6, 2, TRUE), + PT(23, 44, 2, 3, TRUE), + PT(41, 19, 5, 2, TRUE), + PT(45, 16, 2, 0, FALSE), + PT(32, 49, 4, 1, TRUE), + PT(30, 51, 3, 0, FALSE), + PT(51, 6, 5, 2, TRUE), + PT(38, 20, 4, 3, TRUE), + PT(34, 29, 5, 1, FALSE), + PT(45, 6, 3, 0, FALSE), + PT( 7, 9, 5, 3, FALSE), + PT(33, 21, 5, 3, FALSE), + PT(33, 56, 4, 1, TRUE), + PT(53, 11, 6, 2, FALSE), + PT(36, 11, 4, 1, FALSE), + PT(30, 1, 2, 3, TRUE), + PT(11, 36, 2, 0, TRUE), + PT(23, 7, 4, 0, FALSE), + PT(20, 37, 6, 1, FALSE), + PT(26, 14, 5, 3, TRUE), + PT(53, 23, 3, 3, TRUE), + PT(12, 8, 4, 0, TRUE), + PT(48, 53, 3, 3, TRUE), + PT(12, 11, 4, 0, FALSE), + PT( 4, 16, 2, 0, TRUE), + PT(53, 17, 3, 3, FALSE), + PT(51, 61, 2, 3, FALSE), + PT(30, 43, 3, 2, TRUE), + PT(26, 25, 2, 0, FALSE), + PT( 4, 6, 4, 1, FALSE), + PT( 3, 61, 4, 2, FALSE), + PT(42, 14, 6, 2, TRUE), + PT( 3, 62, 2, 3, TRUE), + PT(11, 24, 6, 3, FALSE), + PT(61, 13, 4, 3, FALSE), + PT(53, 18, 4, 0, FALSE), + PT(31, 13, 2, 3, FALSE), + PT(35, 50, 3, 1, FALSE), + PT( 0, 61, 4, 3, FALSE), + PT(48, 25, 6, 3, FALSE), + PT(18, 14, 4, 1, TRUE), + PT( 1, 35, 5, 0, FALSE), + PT(59, 49, 2, 0, TRUE), + PT(45, 28, 6, 3, FALSE), + PT(42, 5, 2, 3, FALSE), + PT(20, 14, 6, 0, FALSE), + PT(58, 55, 3, 0, TRUE), + PT(31, 48, 4, 2, TRUE), + PT(16, 38, 5, 3, TRUE), + PT(34, 17, 3, 3, TRUE), + PT(46, 43, 3, 3, FALSE), + PT(22, 22, 4, 0, TRUE), + PT(50, 24, 6, 2, TRUE), + PT(35, 50, 3, 1, FALSE), + PT(61, 13, 3, 0, TRUE), + PT(57, 9, 4, 1, TRUE), + PT(48, 46, 4, 2, FALSE), + PT(30, 15, 4, 2, FALSE), + PT( 9, 33, 6, 0, TRUE), + PT( 5, 3, 2, 0, TRUE), + PT( 5, 34, 5, 1, FALSE), + PT( 3, 7, 6, 3, TRUE), + PT( 4, 8, 2, 1, TRUE), + PT( 5, 16, 6, 2, FALSE), + PT(55, 20, 5, 0, TRUE), + PT(10, 36, 6, 1, FALSE), + PT(52, 30, 3, 1, TRUE), + PT(18, 23, 5, 3, FALSE), + PT( 1, 2, 2, 1, TRUE), + PT(10, 12, 2, 0, TRUE), + PT( 2, 20, 2, 1, TRUE), + PT(13, 37, 4, 1, TRUE), + PT( 0, 7, 3, 1, FALSE), + PT(28, 40, 6, 2, TRUE), + PT( 8, 14, 5, 2, FALSE), + PT(27, 60, 2, 2, TRUE), + PT(28, 25, 3, 2, TRUE), + PT(50, 19, 3, 1, FALSE), + PT(28, 0, 6, 3, TRUE), + PT(34, 27, 6, 2, TRUE), + PT(57, 62, 2, 2, FALSE), + PT(50, 6, 6, 0, TRUE), + PT(23, 5, 5, 1, TRUE), + PT( 1, 15, 4, 0, FALSE), + PT(30, 15, 6, 2, FALSE), + PT(24, 3, 3, 3, TRUE), + PT(43, 0, 2, 2, FALSE), + PT(21, 58, 6, 0, FALSE), + PT(37, 48, 4, 0, TRUE), + PT(11, 0, 6, 3, TRUE), + PT(36, 55, 3, 2, TRUE), + PT(41, 33, 2, 3, FALSE), + PT(36, 15, 5, 2, FALSE), + PT(62, 21, 6, 3, FALSE), + PT(60, 45, 4, 1, TRUE), + PT(61, 60, 2, 3, TRUE), + PT(26, 28, 2, 1, TRUE), + PT(10, 41, 4, 1, FALSE), + PT(37, 63, 4, 3, FALSE), + PT(59, 57, 5, 3, TRUE), + PT(29, 8, 2, 3, FALSE), + PT(11, 25, 2, 2, FALSE), + PT(18, 1, 5, 2, FALSE), + PT(53, 17, 5, 1, FALSE), + PT( 2, 0, 2, 1, TRUE), + PT(57, 42, 6, 2, TRUE), + PT( 7, 26, 2, 0, TRUE), + PT(36, 14, 3, 3, FALSE), + PT(14, 44, 2, 2, TRUE), + PT( 8, 49, 3, 1, TRUE), + PT(33, 29, 4, 3, FALSE), + PT(29, 28, 5, 1, FALSE), + PT(29, 36, 2, 1, TRUE), + PT( 1, 0, 3, 0, FALSE), + PT(40, 42, 6, 3, TRUE), + PT(21, 15, 2, 1, TRUE), + PT(16, 50, 6, 3, FALSE), + PT(34, 19, 6, 0, TRUE), + PT(19, 5, 3, 3, FALSE), + PT(23, 53, 6, 2, TRUE), + PT(59, 14, 4, 2, FALSE), + PT(53, 58, 3, 2, TRUE), + PT(27, 54, 3, 1, TRUE), + PT( 3, 29, 4, 2, FALSE), + PT(15, 22, 6, 0, FALSE), + PT(45, 9, 4, 2, TRUE), + PT( 5, 33, 2, 1, TRUE), + PT(10, 39, 6, 3, FALSE), + PT( 4, 13, 3, 2, FALSE), + PT( 6, 62, 4, 0, TRUE), + PT(42, 39, 6, 1, TRUE), + PT(40, 14, 2, 2, TRUE), + PT(11, 23, 3, 2, TRUE), + PT(29, 50, 5, 2, TRUE), + PT( 8, 61, 5, 0, TRUE), + PT(33, 50, 2, 3, TRUE), + PT(51, 49, 4, 1, FALSE), + PT(14, 3, 4, 0, TRUE), + PT(13, 11, 2, 3, FALSE), + PT(62, 42, 5, 3, FALSE), + PT(25, 54, 5, 1, FALSE), + PT(13, 0, 2, 2, FALSE), + PT(34, 7, 6, 3, FALSE), + PT(10, 9, 2, 2, TRUE), + PT(20, 16, 4, 1, FALSE), + PT( 7, 22, 5, 2, FALSE), + PT(54, 19, 2, 2, TRUE), + PT( 9, 47, 3, 1, TRUE), + PT(32, 59, 5, 3, FALSE), + PT(58, 58, 2, 3, FALSE), + PT(13, 21, 5, 1, FALSE), + PT(57, 19, 5, 1, TRUE), + PT(11, 1, 5, 1, FALSE), + PT(19, 23, 3, 3, FALSE), + PT( 8, 23, 3, 3, FALSE), + PT(12, 15, 6, 2, FALSE), + PT(31, 49, 2, 1, FALSE), + PT( 7, 58, 3, 2, TRUE), + PT(53, 30, 2, 1, FALSE), + PT(36, 44, 2, 2, TRUE), + PT(14, 33, 3, 0, TRUE), + PT(52, 59, 6, 1, TRUE), + PT(25, 15, 5, 0, FALSE), + PT(16, 47, 5, 3, FALSE), + PT(35, 39, 6, 0, TRUE), + PT(57, 46, 3, 0, FALSE), + PT(60, 63, 4, 2, FALSE), + PT( 7, 35, 6, 0, FALSE), + PT(40, 19, 6, 2, TRUE), + PT(19, 10, 2, 0, FALSE), + PT(53, 25, 6, 1, TRUE), + PT(35, 40, 5, 0, TRUE), + PT(19, 47, 3, 1, FALSE), + PT(58, 25, 2, 2, FALSE), + PT(55, 54, 4, 3, FALSE), + PT(32, 59, 2, 2, TRUE), + PT(55, 57, 2, 0, FALSE), + PT(60, 33, 6, 2, FALSE), + PT(28, 56, 6, 0, FALSE), + PT(21, 7, 4, 3, FALSE), + PT(39, 33, 3, 0, TRUE), + PT(24, 17, 4, 1, TRUE), + PT(48, 40, 6, 3, TRUE), + PT(50, 45, 3, 3, TRUE), + PT(44, 63, 6, 0, FALSE), + PT(29, 47, 4, 3, FALSE), + PT( 1, 17, 3, 2, FALSE), + PT(59, 15, 2, 1, FALSE), + PT(42, 23, 4, 3, TRUE), + PT( 5, 0, 3, 1, TRUE), + PT(37, 28, 6, 1, FALSE), + PT( 4, 34, 5, 2, TRUE), + PT(16, 15, 4, 2, TRUE), + PT(13, 57, 6, 0, FALSE), + PT(11, 46, 4, 3, TRUE), + PT(45, 52, 2, 2, TRUE), + PT(62, 48, 6, 3, FALSE), + PT(22, 38, 5, 1, FALSE), + PT( 5, 63, 5, 1, TRUE), + PT(32, 59, 5, 3, FALSE), + PT(59, 28, 5, 3, TRUE), + PT( 1, 24, 2, 3, FALSE), + PT(22, 61, 2, 0, FALSE), + PT(10, 31, 3, 0, FALSE), + PT(23, 15, 4, 1, FALSE), + PT( 6, 19, 2, 0, TRUE), + PT(56, 33, 2, 3, TRUE), + PT(23, 10, 6, 3, TRUE), + PT(28, 25, 6, 0, FALSE), + PT(22, 56, 6, 0, TRUE), + PT(48, 16, 6, 3, FALSE), + PT(49, 47, 4, 3, FALSE), + PT(60, 27, 4, 1, TRUE), + PT(51, 47, 3, 0, TRUE), + PT(22, 53, 4, 2, TRUE), + PT(58, 24, 3, 3, TRUE), + PT(55, 1, 3, 3, FALSE), + PT(13, 24, 2, 1, FALSE), + PT(31, 28, 3, 1, TRUE), + PT( 7, 52, 5, 2, TRUE), + PT(11, 63, 6, 1, TRUE), + PT(30, 52, 3, 2, TRUE), + PT(44, 19, 5, 2, FALSE), + PT(32, 32, 2, 1, TRUE), + PT(32, 15, 6, 0, TRUE), + PT( 8, 15, 4, 2, FALSE), + PT(24, 61, 3, 2, FALSE), + PT(54, 52, 4, 3, TRUE), + PT(51, 42, 4, 2, TRUE), + PT(45, 48, 4, 3, FALSE), + PT(61, 55, 4, 3, FALSE), + PT(37, 17, 2, 0, TRUE), + PT( 3, 5, 3, 0, FALSE), + PT(16, 4, 5, 0, TRUE), + PT( 7, 46, 6, 3, FALSE), + PT(42, 41, 2, 2, TRUE), + PT(58, 14, 6, 1, TRUE), + PT(42, 6, 5, 0, TRUE), + PT(61, 1, 5, 0, TRUE), + PT(39, 14, 2, 3, FALSE), + PT(29, 40, 3, 1, TRUE), + PT(16, 51, 5, 1, TRUE), + PT(12, 20, 3, 2, TRUE), + PT(21, 63, 4, 2, TRUE), + PT(55, 35, 3, 3, FALSE), + PT( 4, 44, 3, 2, FALSE), + PT(21, 52, 5, 1, FALSE), + PT( 9, 47, 2, 2, TRUE), + PT( 2, 63, 2, 2, FALSE), + PT(25, 44, 6, 1, TRUE), + PT(57, 50, 4, 0, FALSE), + PT(42, 24, 6, 1, FALSE), + PT(23, 35, 4, 0, TRUE), + PT(11, 45, 4, 2, TRUE), + PT(36, 58, 5, 2, TRUE), + PT(49, 63, 6, 2, FALSE), + PT(24, 25, 4, 2, FALSE), + PT(30, 21, 3, 1, FALSE), + PT(23, 51, 5, 1, TRUE), + PT(35, 9, 4, 3, FALSE), + PT(27, 13, 2, 2, TRUE), + PT(54, 38, 5, 0, FALSE), + PT(58, 28, 2, 2, FALSE), + PT(12, 62, 2, 0, FALSE), + PT(24, 6, 6, 2, TRUE), + PT(55, 38, 6, 3, FALSE), + PT(33, 38, 2, 3, TRUE), + PT(61, 28, 5, 2, FALSE), + PT(22, 37, 3, 2, TRUE), + PT(30, 11, 3, 3, FALSE), + PT(29, 13, 6, 1, FALSE), + PT( 8, 31, 3, 1, TRUE), + PT(18, 28, 2, 1, FALSE), + PT(32, 42, 5, 0, FALSE), + PT( 6, 59, 6, 2, TRUE), + PT(57, 14, 3, 3, FALSE), + PT(49, 48, 5, 0, FALSE), + PT( 2, 33, 2, 2, FALSE), + PT( 6, 30, 5, 0, TRUE), + PT(22, 9, 3, 2, FALSE), + PT(39, 50, 5, 2, TRUE), + PT(57, 3, 4, 3, TRUE), + PT(41, 9, 3, 3, FALSE), + PT(27, 17, 3, 2, FALSE), + PT(40, 58, 5, 2, FALSE), + PT( 3, 3, 3, 0, FALSE), + PT(35, 9, 5, 3, TRUE), + PT(48, 23, 4, 1, TRUE), + PT(15, 37, 6, 1, TRUE), + PT( 6, 36, 6, 3, TRUE), + PT(34, 9, 6, 1, TRUE), + PT(44, 9, 5, 1, FALSE), + PT(12, 18, 5, 1, FALSE), + PT(40, 32, 2, 0, FALSE), + PT(21, 41, 6, 1, TRUE), + PT(15, 26, 2, 1, TRUE), + PT(19, 24, 6, 3, FALSE), + PT(46, 22, 2, 1, TRUE), + PT(60, 26, 2, 2, TRUE), + PT(58, 17, 6, 1, FALSE), + PT( 2, 10, 5, 2, FALSE), + PT(25, 57, 2, 0, TRUE), + PT(49, 62, 3, 2, TRUE), + PT(50, 20, 6, 1, FALSE), + PT(18, 46, 6, 2, FALSE), + PT(62, 54, 4, 1, TRUE), + PT(55, 62, 2, 2, TRUE), + PT(21, 53, 6, 2, FALSE), + PT( 1, 58, 5, 2, FALSE), + PT(38, 37, 4, 1, FALSE), + PT( 1, 43, 6, 3, TRUE), + PT(28, 61, 6, 1, TRUE), + PT(62, 16, 3, 2, FALSE), + PT(38, 51, 3, 0, TRUE), + PT( 5, 25, 2, 3, TRUE), + PT(18, 56, 3, 2, FALSE), + PT(21, 60, 6, 1, FALSE), + PT(63, 15, 6, 3, TRUE), + PT( 2, 57, 6, 1, FALSE), + PT(19, 0, 3, 2, TRUE), + PT(29, 44, 2, 0, FALSE), + PT(57, 19, 6, 0, TRUE), + PT(15, 55, 3, 0, TRUE), + PT( 9, 13, 5, 1, FALSE), + PT(32, 47, 6, 1, FALSE), + PT(59, 52, 4, 1, FALSE), + PT(38, 20, 2, 0, FALSE), + PT(36, 61, 4, 1, FALSE), + PT(11, 49, 4, 1, TRUE), + PT(47, 45, 5, 1, FALSE), + PT(48, 4, 6, 2, TRUE), + PT(25, 32, 5, 1, FALSE), + PT(22, 54, 6, 3, TRUE), + PT(20, 40, 6, 3, TRUE), + PT(17, 11, 4, 3, TRUE), + PT(29, 6, 5, 0, TRUE), + PT(53, 22, 5, 3, FALSE), + PT(36, 46, 5, 0, TRUE), + PT(54, 20, 5, 1, FALSE), + PT(33, 12, 3, 3, TRUE), + PT(63, 57, 3, 0, TRUE), + PT(39, 16, 5, 1, FALSE), + PT(30, 18, 6, 2, FALSE), + PT(16, 36, 6, 2, FALSE), + PT(29, 19, 3, 2, TRUE), + PT(23, 22, 6, 3, TRUE), + PT(39, 27, 4, 3, TRUE), + PT( 7, 36, 4, 0, TRUE), + PT(55, 33, 2, 0, TRUE), + PT(55, 40, 4, 2, FALSE), + PT(25, 2, 3, 2, FALSE), + PT(20, 18, 3, 2, TRUE), + PT(27, 36, 5, 3, FALSE), + PT(46, 58, 2, 2, TRUE), + PT(55, 52, 4, 0, TRUE), + PT(51, 45, 5, 0, TRUE), + PT(47, 30, 6, 2, FALSE), + PT(41, 60, 2, 1, FALSE), + PT( 5, 21, 4, 0, FALSE), + PT( 5, 62, 3, 0, TRUE), + PT(24, 11, 6, 0, FALSE), + PT(47, 2, 4, 3, TRUE), + PT(20, 28, 6, 2, FALSE), + PT(18, 32, 6, 0, FALSE), + PT(43, 34, 3, 1, TRUE), + PT( 6, 49, 5, 0, FALSE), + PT(21, 45, 2, 1, FALSE), + PT( 1, 14, 2, 1, TRUE), + PT(19, 12, 5, 0, FALSE), + PT( 7, 42, 2, 2, FALSE), + PT(29, 54, 2, 2, FALSE), + PT(21, 43, 4, 3, FALSE), + PT( 3, 37, 2, 2, TRUE), + PT(62, 59, 4, 0, FALSE), + PT(53, 12, 4, 2, TRUE), + PT(43, 22, 6, 2, TRUE), + PT(30, 49, 5, 2, FALSE), + PT( 6, 3, 5, 0, TRUE), + PT(36, 7, 3, 3, TRUE), + PT(50, 47, 3, 0, TRUE), + PT(37, 33, 6, 0, TRUE), + PT(34, 38, 3, 2, TRUE), + PT( 0, 27, 3, 0, FALSE), + PT(42, 36, 6, 0, TRUE), + PT(32, 6, 5, 3, TRUE), + PT(30, 50, 4, 3, FALSE), + PT(50, 57, 2, 1, FALSE), + PT(32, 1, 3, 0, TRUE), + PT(15, 21, 2, 2, TRUE), + PT(39, 16, 5, 3, FALSE), + PT( 9, 37, 3, 0, TRUE), + PT(41, 55, 6, 0, FALSE), + PT(19, 28, 3, 2, TRUE), + PT(41, 45, 4, 3, FALSE), + PT( 2, 26, 2, 3, FALSE), + PT(29, 43, 3, 2, FALSE), + PT(24, 4, 6, 2, FALSE), + PT(40, 42, 4, 0, TRUE), + PT(21, 27, 5, 3, FALSE), + PT(22, 1, 2, 0, FALSE), + PT( 5, 9, 2, 2, FALSE), + PT(34, 3, 4, 1, FALSE), + PT( 2, 27, 6, 2, FALSE), + PT(41, 42, 4, 1, TRUE), + PT(38, 54, 2, 1, TRUE), + PT(35, 61, 3, 1, FALSE), + PT(29, 16, 4, 2, FALSE), + PT(37, 43, 6, 3, TRUE), + PT(25, 36, 4, 3, FALSE), + PT(40, 19, 2, 3, FALSE), + PT(23, 20, 3, 0, TRUE), + PT(11, 47, 4, 2, TRUE), + PT(55, 52, 6, 3, TRUE), + PT(57, 33, 3, 1, TRUE), + PT(15, 61, 5, 2, TRUE), + PT(13, 16, 4, 0, FALSE), + PT( 5, 11, 5, 2, TRUE), + PT( 1, 18, 4, 2, FALSE), + PT(24, 61, 6, 1, FALSE), + PT( 9, 33, 4, 3, FALSE), + PT(26, 14, 3, 3, TRUE), + PT(48, 6, 3, 3, TRUE), + PT(11, 60, 5, 0, TRUE), + PT( 7, 62, 4, 3, TRUE), + PT(19, 30, 3, 1, FALSE), + PT(19, 7, 4, 1, TRUE), + PT(16, 52, 3, 3, FALSE), + PT(50, 23, 4, 1, TRUE), + PT(53, 22, 6, 0, TRUE), + PT(50, 46, 3, 1, TRUE), + PT(40, 14, 4, 1, FALSE), + PT(20, 58, 4, 1, TRUE), + PT(34, 3, 5, 0, TRUE), + PT(42, 16, 4, 0, FALSE), + PT(62, 60, 4, 3, TRUE), + PT(22, 32, 2, 1, FALSE), + PT(63, 36, 6, 0, TRUE), + PT(13, 46, 6, 1, FALSE), + PT(47, 23, 5, 2, TRUE), + PT(54, 59, 2, 3, TRUE), + PT(36, 35, 3, 0, FALSE), + PT(55, 29, 2, 1, TRUE), + PT(23, 58, 3, 1, FALSE), + PT(10, 61, 3, 3, FALSE), + PT( 5, 18, 2, 3, FALSE), + PT(51, 50, 4, 2, TRUE), + PT(29, 31, 5, 0, TRUE), + PT(52, 44, 4, 3, FALSE), + PT(32, 41, 6, 2, TRUE), + PT(14, 50, 2, 3, TRUE), + PT( 1, 57, 5, 2, TRUE), + PT(39, 36, 4, 1, TRUE), + PT(40, 63, 3, 0, FALSE), + PT(57, 56, 4, 2, TRUE), + PT(35, 17, 2, 0, TRUE), + PT(25, 44, 5, 0, TRUE), + PT(48, 8, 5, 0, FALSE), + PT(37, 39, 3, 2, TRUE), + PT(23, 37, 4, 0, TRUE), + PT( 9, 61, 2, 3, FALSE), + PT(27, 15, 5, 2, FALSE), + PT(27, 18, 4, 1, FALSE), + PT(40, 62, 4, 3, FALSE), + PT(52, 16, 3, 1, TRUE), + PT( 2, 52, 2, 2, TRUE), + PT(26, 41, 3, 0, TRUE), + PT(41, 17, 6, 0, TRUE), + PT(18, 39, 2, 3, TRUE), + PT(39, 39, 5, 3, TRUE), + PT(52, 39, 4, 2, FALSE), + PT( 3, 25, 6, 3, FALSE), + PT(23, 29, 6, 1, TRUE), + PT(25, 37, 3, 1, FALSE), + PT(43, 57, 2, 1, TRUE), + PT(59, 51, 3, 2, TRUE), + PT(39, 49, 6, 2, FALSE), + PT(40, 51, 6, 3, TRUE), + PT( 9, 48, 3, 1, TRUE), + PT( 3, 58, 4, 3, TRUE), + PT(25, 17, 3, 3, TRUE), + PT(11, 26, 6, 2, FALSE), + PT(61, 42, 2, 2, TRUE), + PT( 4, 36, 6, 3, FALSE), + PT(48, 35, 6, 0, FALSE), + PT(15, 34, 3, 1, TRUE), + PT(61, 61, 4, 2, FALSE), + PT(41, 29, 2, 1, FALSE), + PT(22, 25, 5, 3, FALSE), + PT( 3, 18, 2, 3, TRUE), + PT(24, 37, 6, 1, TRUE), + PT(47, 35, 3, 1, FALSE), + PT(26, 53, 4, 3, TRUE), + PT(33, 38, 3, 0, TRUE), + PT(27, 48, 3, 0, FALSE), + PT(43, 34, 5, 2, TRUE), + PT(44, 26, 6, 2, FALSE), + PT(62, 18, 3, 0, TRUE), + PT(40, 39, 2, 2, TRUE), + PT(27, 17, 2, 1, FALSE), + PT(23, 21, 2, 0, FALSE), + PT(52, 55, 4, 2, TRUE), + PT(18, 63, 2, 2, TRUE), + PT(49, 13, 6, 3, TRUE), + PT(62, 42, 5, 2, TRUE), + PT(15, 36, 4, 2, FALSE), + PT(60, 63, 3, 3, TRUE), + PT(29, 52, 2, 3, TRUE), + PT(26, 35, 3, 3, TRUE), + PT(55, 15, 2, 0, FALSE), + PT(50, 52, 6, 2, TRUE), + PT(25, 5, 4, 1, FALSE), + PT(51, 22, 6, 2, FALSE), + PT(30, 20, 3, 3, FALSE), + PT( 8, 19, 5, 0, TRUE), + PT(58, 55, 6, 0, FALSE), + PT(29, 54, 2, 2, TRUE), + PT(41, 46, 3, 2, TRUE), + PT(50, 46, 4, 1, TRUE), + PT(53, 23, 3, 2, FALSE), + PT(54, 29, 2, 1, TRUE), + PT(35, 52, 6, 2, FALSE), + PT(36, 26, 6, 3, TRUE), + PT(47, 38, 5, 3, FALSE), + PT(30, 23, 3, 1, FALSE), + PT(31, 21, 3, 3, TRUE), + PT(43, 31, 3, 0, TRUE), + PT(10, 51, 3, 1, FALSE), + PT(53, 49, 4, 2, FALSE), + PT(45, 23, 5, 2, FALSE), + PT(12, 33, 6, 3, FALSE), + PT(44, 53, 6, 2, TRUE), + PT(27, 3, 4, 3, TRUE), + PT( 1, 13, 3, 2, TRUE), + PT(28, 14, 2, 0, TRUE), + PT(17, 43, 2, 0, FALSE), + PT(37, 59, 4, 0, FALSE), + PT(31, 23, 3, 0, TRUE), + PT(32, 8, 6, 3, FALSE), + PT(19, 56, 3, 0, TRUE), + PT(27, 43, 4, 2, FALSE), + PT(11, 31, 5, 0, TRUE), + PT(39, 21, 5, 2, FALSE), + PT(55, 57, 2, 0, FALSE), + PT(58, 21, 5, 3, FALSE), + PT(47, 17, 6, 3, FALSE), + PT(36, 4, 4, 0, FALSE), + PT(59, 42, 6, 2, TRUE), + PT(39, 53, 6, 2, FALSE), + PT(13, 27, 4, 0, FALSE), + PT(16, 34, 6, 3, TRUE), + PT(31, 56, 4, 3, TRUE), + PT(49, 15, 5, 0, FALSE), + PT(40, 37, 2, 2, TRUE), + PT( 0, 29, 4, 2, TRUE), + PT(49, 40, 5, 0, FALSE), + PT(11, 58, 3, 2, TRUE), + PT(45, 19, 3, 1, TRUE), + PT( 3, 55, 5, 3, FALSE), + PT(29, 40, 3, 0, TRUE), + PT( 8, 45, 4, 1, FALSE), + PT(39, 57, 6, 1, FALSE), + PT(63, 47, 3, 2, TRUE), + PT(51, 52, 5, 0, FALSE), + PT(24, 8, 6, 0, TRUE), + PT(35, 31, 2, 1, TRUE), + PT(13, 44, 4, 1, TRUE), + PT(58, 45, 3, 1, FALSE), + PT( 2, 37, 2, 1, TRUE), + PT(32, 54, 6, 2, FALSE), + PT(18, 43, 5, 2, TRUE), + PT(53, 53, 6, 2, FALSE), + PT(35, 32, 4, 0, TRUE), + PT(58, 25, 3, 1, TRUE), + PT(31, 43, 3, 0, TRUE), + PT(53, 14, 3, 0, TRUE), + PT(38, 36, 6, 3, TRUE), + PT(24, 8, 2, 0, FALSE), + PT(12, 22, 5, 2, TRUE), + PT(31, 52, 4, 0, TRUE), + PT( 5, 56, 3, 0, TRUE), + PT(20, 33, 4, 2, FALSE), + PT(17, 49, 2, 2, FALSE), + PT(62, 56, 5, 0, TRUE), + PT(63, 8, 4, 2, TRUE), + PT(42, 31, 4, 2, TRUE), + PT(37, 6, 5, 0, FALSE), + PT(11, 30, 2, 2, FALSE), + PT(26, 56, 4, 1, FALSE), + PT(36, 24, 5, 0, TRUE), + PT(26, 17, 4, 0, FALSE), + PT(59, 58, 3, 3, FALSE), + PT(28, 38, 3, 1, FALSE), + PT( 5, 50, 3, 0, TRUE), + PT(57, 42, 6, 0, TRUE), + PT( 9, 7, 4, 2, TRUE), + PT( 5, 62, 2, 3, FALSE), + PT(52, 38, 2, 2, FALSE), + PT(27, 50, 4, 3, FALSE), + PT( 5, 8, 6, 3, TRUE), + PT(15, 3, 4, 0, FALSE), + PT(42, 57, 6, 0, TRUE), + PT( 8, 1, 3, 3, FALSE), + PT(29, 35, 6, 0, TRUE), + PT(40, 27, 5, 0, FALSE), + PT(30, 55, 2, 2, FALSE), + PT(19, 14, 5, 0, FALSE), + PT(42, 59, 6, 3, TRUE), + PT(47, 28, 5, 0, FALSE), + PT(48, 48, 3, 1, FALSE), + PT(54, 31, 2, 3, FALSE), + PT(62, 13, 2, 2, TRUE), + PT(46, 22, 3, 0, FALSE), + PT(21, 55, 4, 0, FALSE), + PT(42, 51, 6, 0, FALSE), + PT(43, 14, 4, 2, TRUE), + PT(24, 32, 2, 3, FALSE), + PT( 2, 25, 4, 2, TRUE), + PT(10, 46, 6, 0, FALSE), + PT(22, 3, 2, 0, TRUE), + PT( 4, 39, 4, 2, TRUE), + PT(27, 28, 4, 0, TRUE), + PT(41, 4, 4, 3, TRUE), + PT(61, 32, 3, 3, FALSE), + PT(40, 51, 6, 0, TRUE), + PT(30, 57, 2, 0, FALSE), + PT(49, 41, 3, 3, FALSE), + PT( 6, 37, 5, 0, FALSE), + PT(25, 59, 2, 1, FALSE), + PT(11, 27, 3, 2, FALSE), + PT(62, 55, 4, 0, FALSE), + PT(10, 55, 6, 1, TRUE), + PT( 2, 44, 4, 2, TRUE), + PT(21, 24, 2, 2, FALSE), + PT(59, 32, 3, 2, FALSE), + PT(34, 59, 3, 2, FALSE), + PT(36, 52, 6, 2, TRUE), + PT(15, 47, 6, 0, TRUE), + PT(59, 23, 6, 2, TRUE), + PT(48, 57, 6, 3, TRUE), + PT(13, 21, 2, 0, TRUE), + PT(16, 3, 3, 3, FALSE), + PT(26, 57, 6, 1, TRUE), + PT(47, 46, 5, 0, FALSE), + PT(28, 40, 6, 3, FALSE), + PT(40, 24, 3, 3, TRUE), + PT(21, 1, 6, 0, FALSE), + PT(62, 50, 5, 0, FALSE), + PT(52, 47, 4, 1, TRUE), + PT( 7, 12, 6, 3, FALSE), + PT(40, 44, 6, 2, FALSE), + PT(42, 12, 3, 3, TRUE), + PT(63, 32, 2, 1, TRUE), + PT(43, 23, 4, 3, TRUE), + PT(40, 41, 5, 1, FALSE), + PT(60, 19, 6, 3, FALSE), + PT(38, 45, 5, 1, FALSE), + PT(10, 6, 3, 3, FALSE), + PT(32, 4, 3, 1, FALSE), + PT( 2, 7, 6, 2, TRUE), + PT(14, 24, 6, 0, FALSE), + PT( 0, 52, 6, 2, FALSE), + PT(47, 20, 6, 3, TRUE), + PT(33, 48, 3, 3, TRUE), + PT(21, 55, 3, 1, TRUE), + PT(58, 11, 6, 1, FALSE), + PT(34, 34, 4, 0, TRUE), + PT(27, 53, 4, 1, TRUE), + PT(13, 3, 3, 2, FALSE), + PT(35, 59, 2, 1, TRUE), + PT(14, 29, 3, 3, TRUE), + PT(29, 63, 5, 3, FALSE), + PT(57, 39, 5, 3, FALSE), + PT(15, 56, 4, 0, FALSE), + PT(49, 60, 6, 2, TRUE), + PT(11, 15, 5, 3, FALSE), + PT( 6, 6, 5, 0, FALSE), + PT(37, 57, 4, 1, TRUE), + PT(10, 50, 2, 2, TRUE), + PT(15, 29, 4, 2, TRUE), + PT(12, 13, 6, 2, FALSE), + PT(18, 46, 4, 0, TRUE), + PT(54, 24, 3, 3, TRUE), + PT(31, 52, 3, 1, TRUE), + PT( 5, 58, 6, 3, FALSE), + PT(43, 1, 2, 3, TRUE), + PT(14, 22, 5, 1, TRUE), + PT(14, 11, 4, 3, FALSE), + PT(13, 45, 2, 0, FALSE), + PT(33, 17, 4, 3, TRUE), + PT(61, 19, 6, 1, FALSE), + PT(21, 37, 5, 1, FALSE), + PT(27, 45, 6, 2, TRUE), + PT(44, 43, 4, 3, FALSE), + PT(38, 31, 4, 0, FALSE), + PT(34, 43, 2, 1, FALSE), + PT(63, 61, 4, 3, TRUE), + PT(48, 10, 6, 3, FALSE), + PT(53, 31, 2, 3, TRUE), + PT(33, 8, 5, 0, TRUE), + PT(29, 32, 6, 1, TRUE), + PT(52, 17, 2, 3, FALSE), + PT( 5, 56, 5, 2, TRUE), +}; + +#undef PT diff --git a/src/data/pokemon/item_effects.h b/src/data/pokemon/item_effects.h index 1ed721e44..00872a9b2 100644 --- a/src/data/pokemon/item_effects.h +++ b/src/data/pokemon/item_effects.h @@ -1,6 +1,6 @@ const u8 gItemEffect_Potion[7] = { [4] = ITEM4_HEAL_HP, - [6] = 20, + [6] = 20, // Amount of HP to recover }; const u8 gItemEffect_Antidote[6] = { @@ -26,22 +26,22 @@ const u8 gItemEffect_ParalyzeHeal[6] = { const u8 gItemEffect_FullRestore[7] = { [3] = ITEM3_STATUS_ALL, [4] = ITEM4_HEAL_HP, - [6] = ITEM6_HEAL_FULL, + [6] = ITEM6_HEAL_HP_FULL, }; const u8 gItemEffect_MaxPotion[7] = { [4] = ITEM4_HEAL_HP, - [6] = ITEM6_HEAL_FULL, + [6] = ITEM6_HEAL_HP_FULL, }; const u8 gItemEffect_HyperPotion[7] = { [4] = ITEM4_HEAL_HP, - [6] = 200, + [6] = 200, // Amount of HP to recover }; const u8 gItemEffect_SuperPotion[7] = { [4] = ITEM4_HEAL_HP, - [6] = 50, + [6] = 50, // Amount of HP to recover }; const u8 gItemEffect_FullHeal[6] = { @@ -50,87 +50,87 @@ const u8 gItemEffect_FullHeal[6] = { const u8 gItemEffect_Revive[7] = { [4] = ITEM4_REVIVE | ITEM4_HEAL_HP, - [6] = ITEM6_HEAL_HALF, + [6] = ITEM6_HEAL_HP_HALF, }; const u8 gItemEffect_MaxRevive[7] = { [4] = ITEM4_REVIVE | ITEM4_HEAL_HP, - [6] = ITEM6_HEAL_FULL, + [6] = ITEM6_HEAL_HP_FULL, }; const u8 gItemEffect_FreshWater[7] = { [4] = ITEM4_HEAL_HP, - [6] = 50, + [6] = 50, // Amount of HP to recover }; const u8 gItemEffect_SodaPop[7] = { [4] = ITEM4_HEAL_HP, - [6] = 60, + [6] = 60, // Amount of HP to recover }; const u8 gItemEffect_Lemonade[7] = { [4] = ITEM4_HEAL_HP, - [6] = 80, + [6] = 80, // Amount of HP to recover }; const u8 gItemEffect_MoomooMilk[7] = { [4] = ITEM4_HEAL_HP, - [6] = 100, + [6] = 100, // Amount of HP to recover }; const u8 gItemEffect_EnergyPowder[10] = { [4] = ITEM4_HEAL_HP, [5] = ITEM5_FRIENDSHIP_ALL, - [6] = 50, - [7] = -5, - [8] = -5, - [9] = -10, + [6] = 50, // Amount of HP to recover + [7] = -5, // Friendship change, low + [8] = -5, // Friendship change, mid + [9] = -10, // Friendship change, high }; const u8 gItemEffect_EnergyRoot[10] = { [4] = ITEM4_HEAL_HP, [5] = ITEM5_FRIENDSHIP_ALL, - [6] = 200, - [7] = -10, - [8] = -10, - [9] = -15, + [6] = 200, // Amount of HP to recover + [7] = -10, // Friendship change, low + [8] = -10, // Friendship change, mid + [9] = -15, // Friendship change, high }; const u8 gItemEffect_HealPowder[9] = { [3] = ITEM3_STATUS_ALL, [5] = ITEM5_FRIENDSHIP_ALL, - [6] = -5, - [7] = -5, - [8] = -10, + [6] = -5, // Friendship change, low + [7] = -5, // Friendship change, mid + [8] = -10, // Friendship change, high }; const u8 gItemEffect_RevivalHerb[10] = { [4] = ITEM4_REVIVE | ITEM4_HEAL_HP, [5] = ITEM5_FRIENDSHIP_ALL, - [6] = ITEM6_HEAL_FULL, - [7] = -15, - [8] = -15, - [9] = -20, + [6] = ITEM6_HEAL_HP_FULL, + [7] = -15, // Friendship change, low + [8] = -15, // Friendship change, mid + [9] = -20, // Friendship change, high }; const u8 gItemEffect_Ether[7] = { - [4] = ITEM4_HEAL_PP_ONE | ITEM4_HEAL_PP_ALL, + [4] = ITEM4_HEAL_PP_ONE | ITEM4_HEAL_PP, [6] = 10, }; const u8 gItemEffect_MaxEther[7] = { - [4] = ITEM4_HEAL_PP_ONE | ITEM4_HEAL_PP_ALL, - [6] = 0x7F, + [4] = ITEM4_HEAL_PP_ONE | ITEM4_HEAL_PP, + [6] = ITEM6_HEAL_PP_FULL, }; const u8 gItemEffect_Elixir[7] = { - [4] = ITEM4_HEAL_PP_ALL, - [6] = 10, + [4] = ITEM4_HEAL_PP, + [6] = 10, // Amount of PP to recover }; const u8 gItemEffect_MaxElixir[7] = { - [4] = ITEM4_HEAL_PP_ALL, - [6] = 0x7F, + [4] = ITEM4_HEAL_PP, + [6] = ITEM6_HEAL_PP_FULL, }; const u8 gItemEffect_LavaCookie[6] = { @@ -151,137 +151,125 @@ const u8 gItemEffect_RedFlute[6] = { const u8 gItemEffect_BerryJuice[7] = { [4] = ITEM4_HEAL_HP, - [6] = 20, + [6] = 20, // Amount of HP to recover }; const u8 gItemEffect_SacredAsh[7] = { [0] = ITEM0_SACRED_ASH, [4] = ITEM4_REVIVE | ITEM4_HEAL_HP, - [6] = ITEM6_HEAL_FULL, + [6] = ITEM6_HEAL_HP_FULL, }; +#define VITAMIN_FRIENDSHIP_CHANGE(i) \ + [(i) + 0] = 5, /* Friendship change, low */ \ + [(i) + 1] = 3, /* Friendship change, mid */ \ + [(i) + 2] = 2 /* Friendship change, high */ + const u8 gItemEffect_HPUp[10] = { [4] = ITEM4_EV_HP, [5] = ITEM5_FRIENDSHIP_ALL, - [6] = 10, - [7] = 5, - [8] = 3, - [9] = 2, + [6] = ITEM6_ADD_EV, + VITAMIN_FRIENDSHIP_CHANGE(7), }; const u8 gItemEffect_Protein[10] = { [4] = ITEM4_EV_ATK, [5] = ITEM5_FRIENDSHIP_ALL, - [6] = 10, - [7] = 5, - [8] = 3, - [9] = 2, + [6] = ITEM6_ADD_EV, + VITAMIN_FRIENDSHIP_CHANGE(7), }; const u8 gItemEffect_Iron[10] = { [5] = ITEM5_EV_DEF | ITEM5_FRIENDSHIP_ALL, - [6] = 10, - [7] = 5, - [8] = 3, - [9] = 2, + [6] = ITEM6_ADD_EV, + VITAMIN_FRIENDSHIP_CHANGE(7), }; const u8 gItemEffect_Carbos[10] = { [5] = ITEM5_EV_SPEED | ITEM5_FRIENDSHIP_ALL, - [6] = 10, - [7] = 5, - [8] = 3, - [9] = 2, + [6] = ITEM6_ADD_EV, + VITAMIN_FRIENDSHIP_CHANGE(7), }; const u8 gItemEffect_Calcium[10] = { [5] = ITEM5_EV_SPATK | ITEM5_FRIENDSHIP_ALL, - [6] = 10, - [7] = 5, - [8] = 3, - [9] = 2, + [6] = ITEM6_ADD_EV, + VITAMIN_FRIENDSHIP_CHANGE(7), }; const u8 gItemEffect_RareCandy[10] = { [3] = ITEM3_LEVEL_UP, [4] = ITEM4_REVIVE | ITEM4_HEAL_HP, [5] = ITEM5_FRIENDSHIP_ALL, - [6] = ITEM6_HEAL_LVL_UP, - [7] = 5, - [8] = 3, - [9] = 2, + [6] = ITEM6_HEAL_HP_LVL_UP, + VITAMIN_FRIENDSHIP_CHANGE(7), }; const u8 gItemEffect_PPUp[9] = { [4] = ITEM4_PP_UP, [5] = ITEM5_FRIENDSHIP_ALL, - [6] = 5, - [7] = 3, - [8] = 2, + VITAMIN_FRIENDSHIP_CHANGE(6), }; const u8 gItemEffect_Zinc[10] = { [5] = ITEM5_EV_SPDEF | ITEM5_FRIENDSHIP_ALL, - [6] = 10, - [7] = 5, - [8] = 3, - [9] = 2, + [6] = ITEM6_ADD_EV, + VITAMIN_FRIENDSHIP_CHANGE(7), }; const u8 gItemEffect_PPMax[9] = { [5] = ITEM5_PP_MAX | ITEM5_FRIENDSHIP_ALL, - [6] = 5, - [7] = 3, - [8] = 2, + VITAMIN_FRIENDSHIP_CHANGE(6), }; +#define STAT_BOOST_FRIENDSHIP_CHANGE \ + [6] = 1, /* Friendship change, low */ \ + [7] = 1 /* Friendship change, mid */ + const u8 gItemEffect_GuardSpec[8] = { [3] = ITEM3_GUARD_SPEC, [5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID, - [6] = 1, - [7] = 1, + STAT_BOOST_FRIENDSHIP_CHANGE, }; +// The first item effect value for the stat boost items +// only uses the least significant bit of its full mask. +// The full constant is commented next to it + const u8 gItemEffect_DireHit[8] = { - [0] = 2 << 4, + [0] = 1 << 5, // ITEM0_DIRE_HIT [5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID, - [6] = 1, - [7] = 1, + STAT_BOOST_FRIENDSHIP_CHANGE, }; const u8 gItemEffect_XAttack[8] = { - [0] = 1, + [0] = 1, // ITEM0_X_ATTACK [5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID, - [6] = 1, - [7] = 1, + STAT_BOOST_FRIENDSHIP_CHANGE, }; const u8 gItemEffect_XDefend[8] = { - [1] = 1 << 4, + [1] = 1 << 4, /// ITEM1_X_DEFEND [5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID, - [6] = 1, - [7] = 1, + STAT_BOOST_FRIENDSHIP_CHANGE, }; const u8 gItemEffect_XSpeed[8] = { - [1] = 1, + [1] = 1, // ITEM1_X_SPEED [5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID, - [6] = 1, - [7] = 1, + STAT_BOOST_FRIENDSHIP_CHANGE, }; const u8 gItemEffect_XAccuracy[8] = { - [2] = 1 << 4, + [2] = 1 << 4, // ITEM2_X_ACCURACY [5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID, - [6] = 1, - [7] = 1, + STAT_BOOST_FRIENDSHIP_CHANGE, }; const u8 gItemEffect_XSpecial[8] = { - [2] = 1, + [2] = 1, // ITEM2_X_SPATK [5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID, - [6] = 1, - [7] = 1, + STAT_BOOST_FRIENDSHIP_CHANGE, }; const u8 gItemEffect_SunStone[6] = { @@ -329,13 +317,13 @@ const u8 gItemEffect_AspearBerry[6] = { }; const u8 gItemEffect_LeppaBerry[7] = { - [4] = ITEM4_HEAL_PP_ONE | ITEM4_HEAL_PP_ALL, - [6] = 10, + [4] = ITEM4_HEAL_PP_ONE | ITEM4_HEAL_PP, + [6] = 10, // Amount of PP to recover }; const u8 gItemEffect_OranBerry[7] = { [4] = ITEM4_HEAL_HP, - [6] = 10, + [6] = 10, // Amount of HP to recover }; const u8 gItemEffect_PersimBerry[6] = { @@ -348,129 +336,122 @@ const u8 gItemEffect_LumBerry[6] = { const u8 gItemEffect_SitrusBerry[7] = { [4] = ITEM4_HEAL_HP, - [6] = 30, + [6] = 30, // Amount of HP to recover }; +#define EV_BERRY_FRIENDSHIP_CHANGE \ + [7] = 10, /* Friendship change, low */ \ + [8] = 5, /* Friendship change, mid */ \ + [9] = 2 /* Friendship change, high */ + const u8 gItemEffect_PomegBerry[10] = { [4] = ITEM4_EV_HP, [5] = ITEM5_FRIENDSHIP_ALL, - [6] = -10, - [7] = 10, - [8] = 5, - [9] = 2, + [6] = ITEM6_SUBTRACT_EV, + EV_BERRY_FRIENDSHIP_CHANGE, }; const u8 gItemEffect_KelpsyBerry[10] = { [4] = ITEM4_EV_ATK, [5] = ITEM5_FRIENDSHIP_ALL, - [6] = -10, - [7] = 10, - [8] = 5, - [9] = 2, + [6] = ITEM6_SUBTRACT_EV, + EV_BERRY_FRIENDSHIP_CHANGE, }; const u8 gItemEffect_QualotBerry[10] = { [5] = ITEM5_EV_DEF | ITEM5_FRIENDSHIP_ALL, - [6] = -10, - [7] = 10, - [8] = 5, - [9] = 2, + [6] = ITEM6_SUBTRACT_EV, + EV_BERRY_FRIENDSHIP_CHANGE, }; const u8 gItemEffect_HondewBerry[10] = { [5] = ITEM5_EV_SPATK | ITEM5_FRIENDSHIP_ALL, - [6] = -10, - [7] = 10, - [8] = 5, - [9] = 2, + [6] = ITEM6_SUBTRACT_EV, + EV_BERRY_FRIENDSHIP_CHANGE, }; const u8 gItemEffect_GrepaBerry[10] = { [5] = ITEM5_EV_SPDEF | ITEM5_FRIENDSHIP_ALL, - [6] = -10, - [7] = 10, - [8] = 5, - [9] = 2, + [6] = ITEM6_SUBTRACT_EV, + EV_BERRY_FRIENDSHIP_CHANGE, }; const u8 gItemEffect_TamatoBerry[10] = { [5] = ITEM5_EV_SPEED | ITEM5_FRIENDSHIP_ALL, - [6] = -10, - [7] = 10, - [8] = 5, - [9] = 2, + [6] = ITEM6_SUBTRACT_EV, + EV_BERRY_FRIENDSHIP_CHANGE, }; const u8 *const gItemEffectTable[] = { - [ITEM_POTION - ITEM_POTION] = gItemEffect_Potion, - [ITEM_ANTIDOTE - ITEM_POTION] = gItemEffect_Antidote, - [ITEM_BURN_HEAL - ITEM_POTION] = gItemEffect_BurnHeal, - [ITEM_ICE_HEAL - ITEM_POTION] = gItemEffect_IceHeal, - [ITEM_AWAKENING - ITEM_POTION] = gItemEffect_Awakening, + [ITEM_POTION - ITEM_POTION] = gItemEffect_Potion, + [ITEM_ANTIDOTE - ITEM_POTION] = gItemEffect_Antidote, + [ITEM_BURN_HEAL - ITEM_POTION] = gItemEffect_BurnHeal, + [ITEM_ICE_HEAL - ITEM_POTION] = gItemEffect_IceHeal, + [ITEM_AWAKENING - ITEM_POTION] = gItemEffect_Awakening, [ITEM_PARALYZE_HEAL - ITEM_POTION] = gItemEffect_ParalyzeHeal, - [ITEM_FULL_RESTORE - ITEM_POTION] = gItemEffect_FullRestore, - [ITEM_MAX_POTION - ITEM_POTION] = gItemEffect_MaxPotion, - [ITEM_HYPER_POTION - ITEM_POTION] = gItemEffect_HyperPotion, - [ITEM_SUPER_POTION - ITEM_POTION] = gItemEffect_SuperPotion, - [ITEM_FULL_HEAL - ITEM_POTION] = gItemEffect_FullHeal, - [ITEM_REVIVE - ITEM_POTION] = gItemEffect_Revive, - [ITEM_MAX_REVIVE - ITEM_POTION] = gItemEffect_MaxRevive, - [ITEM_FRESH_WATER - ITEM_POTION] = gItemEffect_FreshWater, - [ITEM_SODA_POP - ITEM_POTION] = gItemEffect_SodaPop, - [ITEM_LEMONADE - ITEM_POTION] = gItemEffect_Lemonade, - [ITEM_MOOMOO_MILK - ITEM_POTION] = gItemEffect_MoomooMilk, + [ITEM_FULL_RESTORE - ITEM_POTION] = gItemEffect_FullRestore, + [ITEM_MAX_POTION - ITEM_POTION] = gItemEffect_MaxPotion, + [ITEM_HYPER_POTION - ITEM_POTION] = gItemEffect_HyperPotion, + [ITEM_SUPER_POTION - ITEM_POTION] = gItemEffect_SuperPotion, + [ITEM_FULL_HEAL - ITEM_POTION] = gItemEffect_FullHeal, + [ITEM_REVIVE - ITEM_POTION] = gItemEffect_Revive, + [ITEM_MAX_REVIVE - ITEM_POTION] = gItemEffect_MaxRevive, + [ITEM_FRESH_WATER - ITEM_POTION] = gItemEffect_FreshWater, + [ITEM_SODA_POP - ITEM_POTION] = gItemEffect_SodaPop, + [ITEM_LEMONADE - ITEM_POTION] = gItemEffect_Lemonade, + [ITEM_MOOMOO_MILK - ITEM_POTION] = gItemEffect_MoomooMilk, [ITEM_ENERGY_POWDER - ITEM_POTION] = gItemEffect_EnergyPowder, - [ITEM_ENERGY_ROOT - ITEM_POTION] = gItemEffect_EnergyRoot, - [ITEM_HEAL_POWDER - ITEM_POTION] = gItemEffect_HealPowder, - [ITEM_REVIVAL_HERB - ITEM_POTION] = gItemEffect_RevivalHerb, - [ITEM_ETHER - ITEM_POTION] = gItemEffect_Ether, - [ITEM_MAX_ETHER - ITEM_POTION] = gItemEffect_MaxEther, - [ITEM_ELIXIR - ITEM_POTION] = gItemEffect_Elixir, - [ITEM_MAX_ELIXIR - ITEM_POTION] = gItemEffect_MaxElixir, - [ITEM_LAVA_COOKIE - ITEM_POTION] = gItemEffect_LavaCookie, - [ITEM_BLUE_FLUTE - ITEM_POTION] = gItemEffect_BlueFlute, - [ITEM_YELLOW_FLUTE - ITEM_POTION] = gItemEffect_YellowFlute, - [ITEM_RED_FLUTE - ITEM_POTION] = gItemEffect_RedFlute, - [ITEM_BERRY_JUICE - ITEM_POTION] = gItemEffect_BerryJuice, - [ITEM_SACRED_ASH - ITEM_POTION] = gItemEffect_SacredAsh, - [ITEM_HP_UP - ITEM_POTION] = gItemEffect_HPUp, - [ITEM_PROTEIN - ITEM_POTION] = gItemEffect_Protein, - [ITEM_IRON - ITEM_POTION] = gItemEffect_Iron, - [ITEM_CARBOS - ITEM_POTION] = gItemEffect_Carbos, - [ITEM_CALCIUM - ITEM_POTION] = gItemEffect_Calcium, - [ITEM_RARE_CANDY - ITEM_POTION] = gItemEffect_RareCandy, - [ITEM_PP_UP - ITEM_POTION] = gItemEffect_PPUp, - [ITEM_ZINC - ITEM_POTION] = gItemEffect_Zinc, - [ITEM_PP_MAX - ITEM_POTION] = gItemEffect_PPMax, - [ITEM_GUARD_SPEC - ITEM_POTION] = gItemEffect_GuardSpec, - [ITEM_DIRE_HIT - ITEM_POTION] = gItemEffect_DireHit, - [ITEM_X_ATTACK - ITEM_POTION] = gItemEffect_XAttack, - [ITEM_X_DEFEND - ITEM_POTION] = gItemEffect_XDefend, - [ITEM_X_SPEED - ITEM_POTION] = gItemEffect_XSpeed, - [ITEM_X_ACCURACY - ITEM_POTION] = gItemEffect_XAccuracy, - [ITEM_X_SPECIAL - ITEM_POTION] = gItemEffect_XSpecial, - [ITEM_SUN_STONE - ITEM_POTION] = gItemEffect_SunStone, - [ITEM_MOON_STONE - ITEM_POTION] = gItemEffect_MoonStone, - [ITEM_FIRE_STONE - ITEM_POTION] = gItemEffect_FireStone, + [ITEM_ENERGY_ROOT - ITEM_POTION] = gItemEffect_EnergyRoot, + [ITEM_HEAL_POWDER - ITEM_POTION] = gItemEffect_HealPowder, + [ITEM_REVIVAL_HERB - ITEM_POTION] = gItemEffect_RevivalHerb, + [ITEM_ETHER - ITEM_POTION] = gItemEffect_Ether, + [ITEM_MAX_ETHER - ITEM_POTION] = gItemEffect_MaxEther, + [ITEM_ELIXIR - ITEM_POTION] = gItemEffect_Elixir, + [ITEM_MAX_ELIXIR - ITEM_POTION] = gItemEffect_MaxElixir, + [ITEM_LAVA_COOKIE - ITEM_POTION] = gItemEffect_LavaCookie, + [ITEM_BLUE_FLUTE - ITEM_POTION] = gItemEffect_BlueFlute, + [ITEM_YELLOW_FLUTE - ITEM_POTION] = gItemEffect_YellowFlute, + [ITEM_RED_FLUTE - ITEM_POTION] = gItemEffect_RedFlute, + [ITEM_BERRY_JUICE - ITEM_POTION] = gItemEffect_BerryJuice, + [ITEM_SACRED_ASH - ITEM_POTION] = gItemEffect_SacredAsh, + [ITEM_HP_UP - ITEM_POTION] = gItemEffect_HPUp, + [ITEM_PROTEIN - ITEM_POTION] = gItemEffect_Protein, + [ITEM_IRON - ITEM_POTION] = gItemEffect_Iron, + [ITEM_CARBOS - ITEM_POTION] = gItemEffect_Carbos, + [ITEM_CALCIUM - ITEM_POTION] = gItemEffect_Calcium, + [ITEM_RARE_CANDY - ITEM_POTION] = gItemEffect_RareCandy, + [ITEM_PP_UP - ITEM_POTION] = gItemEffect_PPUp, + [ITEM_ZINC - ITEM_POTION] = gItemEffect_Zinc, + [ITEM_PP_MAX - ITEM_POTION] = gItemEffect_PPMax, + [ITEM_GUARD_SPEC - ITEM_POTION] = gItemEffect_GuardSpec, + [ITEM_DIRE_HIT - ITEM_POTION] = gItemEffect_DireHit, + [ITEM_X_ATTACK - ITEM_POTION] = gItemEffect_XAttack, + [ITEM_X_DEFEND - ITEM_POTION] = gItemEffect_XDefend, + [ITEM_X_SPEED - ITEM_POTION] = gItemEffect_XSpeed, + [ITEM_X_ACCURACY - ITEM_POTION] = gItemEffect_XAccuracy, + [ITEM_X_SPECIAL - ITEM_POTION] = gItemEffect_XSpecial, + [ITEM_SUN_STONE - ITEM_POTION] = gItemEffect_SunStone, + [ITEM_MOON_STONE - ITEM_POTION] = gItemEffect_MoonStone, + [ITEM_FIRE_STONE - ITEM_POTION] = gItemEffect_FireStone, [ITEM_THUNDER_STONE - ITEM_POTION] = gItemEffect_ThunderStone, - [ITEM_WATER_STONE - ITEM_POTION] = gItemEffect_WaterStone, - [ITEM_LEAF_STONE - ITEM_POTION] = gItemEffect_LeafStone, - [ITEM_CHERI_BERRY - ITEM_POTION] = gItemEffect_CheriBerry, - [ITEM_CHESTO_BERRY - ITEM_POTION] = gItemEffect_ChestoBerry, - [ITEM_PECHA_BERRY - ITEM_POTION] = gItemEffect_PechaBerry, - [ITEM_RAWST_BERRY - ITEM_POTION] = gItemEffect_RawstBerry, - [ITEM_ASPEAR_BERRY - ITEM_POTION] = gItemEffect_AspearBerry, - [ITEM_LEPPA_BERRY - ITEM_POTION] = gItemEffect_LeppaBerry, - [ITEM_ORAN_BERRY - ITEM_POTION] = gItemEffect_OranBerry, - [ITEM_PERSIM_BERRY - ITEM_POTION] = gItemEffect_PersimBerry, - [ITEM_LUM_BERRY - ITEM_POTION] = gItemEffect_LumBerry, - [ITEM_SITRUS_BERRY - ITEM_POTION] = gItemEffect_SitrusBerry, - [ITEM_POMEG_BERRY - ITEM_POTION] = gItemEffect_PomegBerry, - [ITEM_KELPSY_BERRY - ITEM_POTION] = gItemEffect_KelpsyBerry, - [ITEM_QUALOT_BERRY - ITEM_POTION] = gItemEffect_QualotBerry, - [ITEM_HONDEW_BERRY - ITEM_POTION] = gItemEffect_HondewBerry, - [ITEM_GREPA_BERRY - ITEM_POTION] = gItemEffect_GrepaBerry, - [ITEM_TAMATO_BERRY - ITEM_POTION] = gItemEffect_TamatoBerry, - [LAST_BERRY_INDEX - ITEM_POTION] = NULL + [ITEM_WATER_STONE - ITEM_POTION] = gItemEffect_WaterStone, + [ITEM_LEAF_STONE - ITEM_POTION] = gItemEffect_LeafStone, + [ITEM_CHERI_BERRY - ITEM_POTION] = gItemEffect_CheriBerry, + [ITEM_CHESTO_BERRY - ITEM_POTION] = gItemEffect_ChestoBerry, + [ITEM_PECHA_BERRY - ITEM_POTION] = gItemEffect_PechaBerry, + [ITEM_RAWST_BERRY - ITEM_POTION] = gItemEffect_RawstBerry, + [ITEM_ASPEAR_BERRY - ITEM_POTION] = gItemEffect_AspearBerry, + [ITEM_LEPPA_BERRY - ITEM_POTION] = gItemEffect_LeppaBerry, + [ITEM_ORAN_BERRY - ITEM_POTION] = gItemEffect_OranBerry, + [ITEM_PERSIM_BERRY - ITEM_POTION] = gItemEffect_PersimBerry, + [ITEM_LUM_BERRY - ITEM_POTION] = gItemEffect_LumBerry, + [ITEM_SITRUS_BERRY - ITEM_POTION] = gItemEffect_SitrusBerry, + [ITEM_POMEG_BERRY - ITEM_POTION] = gItemEffect_PomegBerry, + [ITEM_KELPSY_BERRY - ITEM_POTION] = gItemEffect_KelpsyBerry, + [ITEM_QUALOT_BERRY - ITEM_POTION] = gItemEffect_QualotBerry, + [ITEM_HONDEW_BERRY - ITEM_POTION] = gItemEffect_HondewBerry, + [ITEM_GREPA_BERRY - ITEM_POTION] = gItemEffect_GrepaBerry, + [ITEM_TAMATO_BERRY - ITEM_POTION] = gItemEffect_TamatoBerry, + [LAST_BERRY_INDEX - ITEM_POTION] = NULL }; diff --git a/src/data/text/gift_ribbon_descriptions.h b/src/data/text/gift_ribbon_descriptions.h index ea108be18..a95f9729d 100644 --- a/src/data/text/gift_ribbon_descriptions.h +++ b/src/data/text/gift_ribbon_descriptions.h @@ -46,7 +46,7 @@ const u8 gGiftRibbonDescriptionPart2_LovedPokemon[] = _("for a loved POKéMON.") const u8 gGiftRibbonDescriptionPart1_LoveForPokemon[] = _("RIBBON that shows"); const u8 gGiftRibbonDescriptionPart2_LoveForPokemon[] = _("love for POKéMON."); -const u8 *const gGiftRibbonDescriptionPointers[][2] = +const u8 *const gGiftRibbonDescriptionPointers[MAX_GIFT_RIBBON][2] = { {gGiftRibbonDescriptionPart1_2003RegionalTourney, gGiftRibbonDescriptionPart2_Champion}, {gGiftRibbonDescriptionPart1_2003NationalTourney, gGiftRibbonDescriptionPart2_Champion}, diff --git a/src/data/text/ribbon_descriptions.h b/src/data/text/ribbon_descriptions.h index f455a7771..5db52dced 100644 --- a/src/data/text/ribbon_descriptions.h +++ b/src/data/text/ribbon_descriptions.h @@ -20,29 +20,29 @@ const u8 gRibbonDescriptionPart2_Effort[] = _("being a hard worker."); const u8 *const gRibbonDescriptionPointers[][2] = { - {gRibbonDescriptionPart1_Champion, gRibbonDescriptionPart2_Champion}, - {gRibbonDescriptionPart1_CoolContest, gRibbonDescriptionPart2_NormalRank}, - {gRibbonDescriptionPart1_CoolContest, gRibbonDescriptionPart2_SuperRank}, - {gRibbonDescriptionPart1_CoolContest, gRibbonDescriptionPart2_HyperRank}, - {gRibbonDescriptionPart1_CoolContest, gRibbonDescriptionPart2_MasterRank}, - {gRibbonDescriptionPart1_BeautyContest, gRibbonDescriptionPart2_NormalRank}, - {gRibbonDescriptionPart1_BeautyContest, gRibbonDescriptionPart2_SuperRank}, - {gRibbonDescriptionPart1_BeautyContest, gRibbonDescriptionPart2_HyperRank}, - {gRibbonDescriptionPart1_BeautyContest, gRibbonDescriptionPart2_MasterRank}, - {gRibbonDescriptionPart1_CuteContest, gRibbonDescriptionPart2_NormalRank}, - {gRibbonDescriptionPart1_CuteContest, gRibbonDescriptionPart2_SuperRank}, - {gRibbonDescriptionPart1_CuteContest, gRibbonDescriptionPart2_HyperRank}, - {gRibbonDescriptionPart1_CuteContest, gRibbonDescriptionPart2_MasterRank}, - {gRibbonDescriptionPart1_SmartContest, gRibbonDescriptionPart2_NormalRank}, - {gRibbonDescriptionPart1_SmartContest, gRibbonDescriptionPart2_SuperRank}, - {gRibbonDescriptionPart1_SmartContest, gRibbonDescriptionPart2_HyperRank}, - {gRibbonDescriptionPart1_SmartContest, gRibbonDescriptionPart2_MasterRank}, - {gRibbonDescriptionPart1_ToughContest, gRibbonDescriptionPart2_NormalRank}, - {gRibbonDescriptionPart1_ToughContest, gRibbonDescriptionPart2_SuperRank}, - {gRibbonDescriptionPart1_ToughContest, gRibbonDescriptionPart2_HyperRank}, - {gRibbonDescriptionPart1_ToughContest, gRibbonDescriptionPart2_MasterRank}, - {gRibbonDescriptionPart1_Winning, gRibbonDescriptionPart2_Winning}, - {gRibbonDescriptionPart1_Victory, gRibbonDescriptionPart2_Victory}, - {gRibbonDescriptionPart1_Artist, gRibbonDescriptionPart2_Artist}, - {gRibbonDescriptionPart1_Effort, gRibbonDescriptionPart2_Effort}, + [CHAMPION_RIBBON] = {gRibbonDescriptionPart1_Champion, gRibbonDescriptionPart2_Champion}, + [COOL_RIBBON_NORMAL] = {gRibbonDescriptionPart1_CoolContest, gRibbonDescriptionPart2_NormalRank}, + [COOL_RIBBON_SUPER] = {gRibbonDescriptionPart1_CoolContest, gRibbonDescriptionPart2_SuperRank}, + [COOL_RIBBON_HYPER] = {gRibbonDescriptionPart1_CoolContest, gRibbonDescriptionPart2_HyperRank}, + [COOL_RIBBON_MASTER] = {gRibbonDescriptionPart1_CoolContest, gRibbonDescriptionPart2_MasterRank}, + [BEAUTY_RIBBON_NORMAL] = {gRibbonDescriptionPart1_BeautyContest, gRibbonDescriptionPart2_NormalRank}, + [BEAUTY_RIBBON_SUPER] = {gRibbonDescriptionPart1_BeautyContest, gRibbonDescriptionPart2_SuperRank}, + [BEAUTY_RIBBON_HYPER] = {gRibbonDescriptionPart1_BeautyContest, gRibbonDescriptionPart2_HyperRank}, + [BEAUTY_RIBBON_MASTER] = {gRibbonDescriptionPart1_BeautyContest, gRibbonDescriptionPart2_MasterRank}, + [CUTE_RIBBON_NORMAL] = {gRibbonDescriptionPart1_CuteContest, gRibbonDescriptionPart2_NormalRank}, + [CUTE_RIBBON_SUPER] = {gRibbonDescriptionPart1_CuteContest, gRibbonDescriptionPart2_SuperRank}, + [CUTE_RIBBON_HYPER] = {gRibbonDescriptionPart1_CuteContest, gRibbonDescriptionPart2_HyperRank}, + [CUTE_RIBBON_MASTER] = {gRibbonDescriptionPart1_CuteContest, gRibbonDescriptionPart2_MasterRank}, + [SMART_RIBBON_NORMAL] = {gRibbonDescriptionPart1_SmartContest, gRibbonDescriptionPart2_NormalRank}, + [SMART_RIBBON_SUPER] = {gRibbonDescriptionPart1_SmartContest, gRibbonDescriptionPart2_SuperRank}, + [SMART_RIBBON_HYPER] = {gRibbonDescriptionPart1_SmartContest, gRibbonDescriptionPart2_HyperRank}, + [SMART_RIBBON_MASTER] = {gRibbonDescriptionPart1_SmartContest, gRibbonDescriptionPart2_MasterRank}, + [TOUGH_RIBBON_NORMAL] = {gRibbonDescriptionPart1_ToughContest, gRibbonDescriptionPart2_NormalRank}, + [TOUGH_RIBBON_SUPER] = {gRibbonDescriptionPart1_ToughContest, gRibbonDescriptionPart2_SuperRank}, + [TOUGH_RIBBON_HYPER] = {gRibbonDescriptionPart1_ToughContest, gRibbonDescriptionPart2_HyperRank}, + [TOUGH_RIBBON_MASTER] = {gRibbonDescriptionPart1_ToughContest, gRibbonDescriptionPart2_MasterRank}, + [WINNING_RIBBON] = {gRibbonDescriptionPart1_Winning, gRibbonDescriptionPart2_Winning}, + [VICTORY_RIBBON] = {gRibbonDescriptionPart1_Victory, gRibbonDescriptionPart2_Victory}, + [ARTIST_RIBBON] = {gRibbonDescriptionPart1_Artist, gRibbonDescriptionPart2_Artist}, + [EFFORT_RIBBON] = {gRibbonDescriptionPart1_Effort, gRibbonDescriptionPart2_Effort}, }; diff --git a/src/data/trade.h b/src/data/trade.h index b9350863b..7001b6ce5 100644 --- a/src/data/trade.h +++ b/src/data/trade.h @@ -1070,7 +1070,7 @@ static const u16 sIngameTradeMail[][MAIL_WORDS_COUNT + 1] = EC_WORD_THANK_YOU, EC_WORD_FOR, EC_POKEMON(SKITTY), - EC_POKEMON2(MEOWTH), + EC_POKEMON_NATIONAL(MEOWTH), EC_WORD_CRIES, EC_WORD_IN, EC_WORD_A, diff --git a/src/daycare.c b/src/daycare.c index 2a1efefcc..14cf57806 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -170,7 +170,7 @@ static void StorePokemonInDaycare(struct Pokemon *mon, struct DaycareMon *daycar StringCopy(daycareMon->mail.OT_name, gSaveBlock2Ptr->playerName); GetMonNickname2(mon, daycareMon->mail.monName); StripExtCtrlCodes(daycareMon->mail.monName); - daycareMon->mail.gameLanguage = LANGUAGE_ENGLISH; + daycareMon->mail.gameLanguage = GAME_LANGUAGE; daycareMon->mail.monLanguage = GetMonData(mon, MON_DATA_LANGUAGE); mailId = GetMonData(mon, MON_DATA_MAIL); daycareMon->mail.message = gSaveBlock1Ptr->mail[mailId]; @@ -894,8 +894,8 @@ static bool8 TryProduceOrHatchEgg(struct DayCare *daycare) // Check if an egg should be produced if (daycare->offspringPersonality == 0 && validEggs == DAYCARE_MON_COUNT && (daycare->mons[1].steps & 0xFF) == 0xFF) { - u8 compatability = GetDaycareCompatibilityScore(daycare); - if (compatability > (Random() * 100u) / USHRT_MAX) + u8 compatibility = GetDaycareCompatibilityScore(daycare); + if (compatibility > (Random() * 100u) / USHRT_MAX) TriggerPendingDaycareEgg(); } @@ -1050,7 +1050,7 @@ static u8 GetDaycareCompatibilityScore(struct DayCare *daycare) if (trainerIds[0] == trainerIds[1]) return PARENTS_LOW_COMPATIBILITY; - return PARENTS_MED_COMPATABILITY; + return PARENTS_MED_COMPATIBILITY; } // neither parent is Ditto else @@ -1065,14 +1065,14 @@ static u8 GetDaycareCompatibilityScore(struct DayCare *daycare) if (species[0] == species[1]) { if (trainerIds[0] == trainerIds[1]) - return PARENTS_MED_COMPATABILITY; // same species, same trainer + return PARENTS_MED_COMPATIBILITY; // same species, same trainer - return PARENTS_MAX_COMPATABILITY; // same species, different trainers + return PARENTS_MAX_COMPATIBILITY; // same species, different trainers } else { if (trainerIds[0] != trainerIds[1]) - return PARENTS_MED_COMPATABILITY; // different species, different trainers + return PARENTS_MED_COMPATIBILITY; // different species, different trainers return PARENTS_LOW_COMPATIBILITY; // different species, same trainer } @@ -1095,9 +1095,9 @@ void SetDaycareCompatibilityString(void) whichString = 3; if (relationshipScore == PARENTS_LOW_COMPATIBILITY) whichString = 2; - if (relationshipScore == PARENTS_MED_COMPATABILITY) + if (relationshipScore == PARENTS_MED_COMPATIBILITY) whichString = 1; - if (relationshipScore == PARENTS_MAX_COMPATABILITY) + if (relationshipScore == PARENTS_MAX_COMPATIBILITY) whichString = 0; StringCopy(gStringVar4, sCompatibilityMessages[whichString]); diff --git a/src/decoration.c b/src/decoration.c index 484398aba..b9a243708 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -925,7 +925,7 @@ static void DecorationItemsMenu_PrintDecorationInUse(u8 windowId, s32 itemIndex, static void AddDecorationItemsScrollIndicators(void) { - if (sDecorationItemsMenu->scrollIndicatorsTaskId == 0xFF) + if (sDecorationItemsMenu->scrollIndicatorsTaskId == TASK_NONE) { sDecorationItemsMenu->scrollIndicatorsTaskId = AddScrollIndicatorArrowPairParameterized( SCROLL_ARROW_UP, @@ -941,10 +941,10 @@ static void AddDecorationItemsScrollIndicators(void) static void RemoveDecorationItemsScrollIndicators(void) { - if (sDecorationItemsMenu->scrollIndicatorsTaskId != 0xFF) + if (sDecorationItemsMenu->scrollIndicatorsTaskId != TASK_NONE) { RemoveScrollIndicatorArrowPair(sDecorationItemsMenu->scrollIndicatorsTaskId); - sDecorationItemsMenu->scrollIndicatorsTaskId = 0xFF; + sDecorationItemsMenu->scrollIndicatorsTaskId = TASK_NONE; } } @@ -960,7 +960,7 @@ static void InitDecorationItemsWindow(u8 taskId) AddDecorationWindow(WINDOW_DECORATION_CATEGORY_ITEMS); ShowDecorationCategorySummaryWindow(sCurDecorationCategory); sDecorationItemsMenu = AllocZeroed(sizeof(*sDecorationItemsMenu)); - sDecorationItemsMenu->scrollIndicatorsTaskId = 0xFF; + sDecorationItemsMenu->scrollIndicatorsTaskId = TASK_NONE; InitDecorationItemsMenuLimits(); InitDecorationItemsMenuScrollAndCursor(); InitDecorationItemsMenuScrollAndCursor2(); diff --git a/src/dewford_trend.c b/src/dewford_trend.c index 5c7e50f16..c60797f86 100644 --- a/src/dewford_trend.c +++ b/src/dewford_trend.c @@ -90,7 +90,7 @@ void UpdateDewfordTrendPerDay(u16 a) } -bool8 sub_81226D8(u16 *a) +bool8 IsPhraseTrendy(u16 *a) { struct EasyChatPair s = {0}; u16 i; diff --git a/src/diploma.c b/src/diploma.c index 8f04bb9ad..bf0d5b057 100644 --- a/src/diploma.c +++ b/src/diploma.c @@ -84,7 +84,7 @@ void CB2_ShowDiploma(void) CopyBgTilemapBufferToVram(1); DisplayDiplomaText(); BlendPalettes(-1, 16, 0); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); EnableInterrupts(1); SetVBlankCallback(VBlankCB); SetMainCallback2(MainCB2); @@ -109,7 +109,7 @@ static void Task_DiplomaWaitForKeyPress(u8 taskId) { if (JOY_NEW(A_BUTTON | B_BUTTON)) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].func = Task_DiplomaFadeOut; } } diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index 66eacc5f9..d3244f4b9 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -25,252 +25,3458 @@ #include "constants/items.h" #include "constants/songs.h" -struct DodrioSubstruct_0160 +// Note that in this file 'Dodrio Berry Picking' is often +// shortened to DodrioGame or just Game for convenience + +#define MAX_SCORE 999990 +#define MAX_BERRIES 9999 + +// The minimum score needed to receive a prize +#define PRIZE_SCORE 3000 + +// Difficulty increases as berries are eaten. The rate of new berries increases and the types of berries changes +// When the max difficulty is reached it starts again from the beginning +#define NUM_DIFFICULTIES 7 + +#define MAX_FALL_DIST 10 // The number of times a berry needs to fall before hitting the ground +#define EAT_FALL_DIST 7 // The number of times a berry needs to fall to be available to eat + +enum { + BG_INTERFACE, + BG_TREE_LEFT, + BG_TREE_RIGHT, + BG_SCENERY +}; + +enum { + FUNC_INTRO, + FUNC_INIT_COUNTDOWN, + FUNC_COUNTDOWN, + FUNC_WAIT_START, + FUNC_PLAY_GAME, + FUNC_INIT_RESULTS, + FUNC_RESULTS, + FUNC_ASK_PLAY_AGAIN, + FUNC_END_LINK, + FUNC_EXIT, + FUNC_RESET_GAME, + FUNC_WAIT_END_GAME, +}; + +enum { + GFXFUNC_LOAD, + GFXFUNC_SHOW_NAMES, + GFXFUNC_SHOW_RESULTS, + GFXFUNC_MSG_PLAY_AGAIN, + GFXFUNC_MSG_SAVING, + GFXFUNC_MSG_COMM_STANDBY, + GFXFUNC_ERASE_MSG, + GFXFUNC_MSG_PLAYER_DROPPED, + GFXFUNC_STOP, + GFXFUNC_IDLE, +}; + +enum { + PACKET_READY_START = 1, + PACKET_GAME_STATE, + PACKET_PICK_STATE, + PACKET_READY_END, +}; + +enum { + PLAY_AGAIN_NONE, + PLAY_AGAIN_YES, + PLAY_AGAIN_NO, + PLAY_AGAIN_DROPPED = 5, +}; + +enum { + PICK_NONE, // Dodrio standing still + PICK_RIGHT, // Dodrio reaching right + PICK_MIDDLE, // Dodrio reaching up + PICK_LEFT, // Dodrio reaching left + PICK_DISABLED, // Dodrio down after game over +}; + +enum { + BERRY_BLUE, + BERRY_GREEN, + BERRY_GOLD, + BERRY_MISSED, + BERRY_PRIZE, + BERRY_IN_ROW, + NUM_BERRY_IDS +}; + +#define NUM_BERRY_TYPES 4 // Blue, Green, Gold, and 'missed' + + // Eaten anim comes after the normal & missed versions of other berries +#define ANIM_EATEN (BERRY_MISSED * 2) + +enum { + BERRYSTATE_NONE, + BERRYSTATE_PICKED, // Berry has been picked by a Dodrio, replaced with blue hit sprite (still falling) + BERRYSTATE_EATEN, // Berry has been eaten (after being picked), berry is gone now + BERRYSTATE_SQUISHED, // Berry has hit the ground +}; + +enum { + INPUTSTATE_NONE, + INPUTSTATE_TRY_PICK, + INPUTSTATE_PICKED, + INPUTSTATE_ATE_BERRY, + INPUTSTATE_BAD_MISS, +}; + +// Colors for status bar squares +// Colored gray when a berry is missed +// Flash red when few yellow squares remain +enum { + STATUS_YELLOW, + STATUS_GRAY, + STATUS_RED, +}; + +#define NUM_STATUS_SQUARES 10 + +// Berries fall in predefined columns. +// A total of 10 are available, though fewer will be used with < 5 players +// The 11th column is a repeat of the 1st column wrapped around, so only +// the values 0-9 are unique 'valid' columns +#define NUM_BERRY_COLUMNS 11 + +#define GFXTAG_DODRIO 0 +#define GFXTAG_STATUS 1 +#define GFXTAG_BERRIES 2 +#define GFXTAG_CLOUD 5 +#define GFXTAG_COUNTDOWN 7 + +#define PALTAG_DODRIO_NORMAL 0 +#define PALTAG_DODRIO_SHINY 1 +#define PALTAG_STATUS 2 +#define PALTAG_BERRIES 3 +#define PALTAG_CLOUD 6 +#define PALTAG_COUNTDOWN 8 + +#define NUM_CLOUDS 2 + +#define PLAYER_NONE 0xFF + +struct DodrioGame_Gfx { - /*0x0000 : 0x3000*/ u16 ALIGNED(4) tilemapBuffers[3][BG_SCREEN_SIZE]; - /*0x3000 : 0x3160*/ bool32 finished; - /*0x3004 : 0x3164*/ u8 ALIGNED(4) unk3004; - /*0x3008 : 0x3168*/ u8 ALIGNED(4) unk3008[10]; - /*0x3014 : 0x3174*/ u8 ALIGNED(4) state; - /*0x3018 : 0x3178*/ u8 ALIGNED(4) unk3018; - /*0x301C : 0x317C*/ u16 ALIGNED(4) unk301C; - /*0x3020 : 0x3180*/ u8 ALIGNED(4) unk3020; - /*0x3024 : 0x3184*/ u8 ALIGNED(4) unk3024; - /*0x3024 : 0x3184*/ void (*unk3028)(void); + u16 ALIGNED(4) tilemapBuffers[3][BG_SCREEN_SIZE]; + bool32 finished; + u8 ALIGNED(4) taskId; + u8 ALIGNED(4) windowIds[MAX_RFU_PLAYERS + 5]; // The latter 5 are never used + u8 ALIGNED(4) state; + u8 ALIGNED(4) loadState; + u16 ALIGNED(4) timer; + u8 ALIGNED(4) cursorSelection; + u8 ALIGNED(4) playAgainState; + void (*func)(void); }; // size = 0x302C -struct DodrioStruct_2022CF4 +struct StatusBar { - u8 filler_00[0xc]; - u8 unkC[10]; - s16 unk16[10]; - u16 unk2A[10]; - u16 unk3E; + u8 unused[12]; + bool8 entered[NUM_STATUS_SQUARES]; + s16 yChange[NUM_STATUS_SQUARES]; + u16 spriteIds[NUM_STATUS_SQUARES]; + u16 flashTimer; }; // size = 0x40 -struct DodrioSubstruct_31A0_14 +struct DodrioGame_Berries { - u8 unk0[11]; - u8 unkB[11]; + u8 ids[NUM_BERRY_COLUMNS]; + u8 fallDist[NUM_BERRY_COLUMNS]; }; -struct DodrioSubstruct_31A0_2C +struct DodrioGame_PlayerCommData { - u8 unk0; - u8 ALIGNED(4) unk4; - u8 ALIGNED(4) unk8; + u8 pickState; + bool8 ALIGNED(4) ateBerry; + bool8 ALIGNED(4) missedBerry; }; -struct DodrioSubstruct_31A0 +struct DodrioGame_Player { - u8 name[0x10]; - u32 unk10; - struct DodrioSubstruct_31A0_14 unk14; - struct DodrioSubstruct_31A0_2C unk2C; - u8 filler_35[4]; + u8 name[16]; + bool32 receivedGameStatePacket; // Never read + struct DodrioGame_Berries berries; + struct DodrioGame_PlayerCommData comm; + u32 unused; }; // size = 0x3C -struct DodrioSubstruct_318C +// Because Dodrio is required for this minigame, +// the only relevant information about the selected +// Pokémon is whether or not it's shiny +struct DodrioGame_MonInfo { bool8 isShiny; }; -struct DodrioSubstruct_3308 +struct DodrioGame_ScoreResults { - u8 unk0; - u32 unk4; + u8 ranking; + u32 score; }; -struct DodrioStruct +struct DodrioGame { - /*0x0000*/ void (*savedCallback)(void); - /*0x0004*/ u8 ALIGNED(4) unk04; - /*0x0008*/ u8 ALIGNED(4) unk08; - /*0x000C*/ u8 ALIGNED(4) unk0C; - /*0x0010*/ u8 ALIGNED(4) unk10; - /*0x0014*/ u8 ALIGNED(4) unk14; - /*0x0018*/ u8 ALIGNED(4) unk18; - /*0x001C*/ u8 ALIGNED(4) unk1C; - /*0x0020*/ u8 ALIGNED(4) unk20; - /*0x0024*/ u8 ALIGNED(4) unk24; + /*0x0000*/ void (*exitCallback)(void); + /*0x0004*/ u8 ALIGNED(4) taskId; + /*0x0008*/ u8 ALIGNED(4) playersReceived; + /*0x000C*/ u8 ALIGNED(4) startState; + /*0x0010*/ u8 ALIGNED(4) state; + /*0x0014*/ u8 ALIGNED(4) timer; + /*0x0018*/ u8 ALIGNED(4) funcId; + /*0x001C*/ u8 ALIGNED(4) prevFuncId; // Set, never read + /*0x0020*/ bool8 ALIGNED(4) isLeader; + /*0x0024*/ u8 ALIGNED(4) numPlayers; /*0x0028*/ u8 ALIGNED(4) multiplayerId; - /*0x0029*/ u8 filler_0029[7]; - /*0x0030*/ u8 ALIGNED(4) unk30; - /*0x0034*/ u8 ALIGNED(4) unk34[5]; - /*0x003C*/ u8 ALIGNED(4) unk3C; - /*0x0040*/ u8 ALIGNED(4) unk40; - /*0x0044*/ u8 ALIGNED(4) unk44; - /*0x0048*/ u8 ALIGNED(4) unk48; - /*0x004A*/ u16 unk4A[5][6]; - /*0x0086*/ u16 unk86[5]; - /*0x0090*/ u8 ALIGNED(4) unk90[5]; - /*0x0098*/ u8 ALIGNED(4) unk98[4]; - /*0x009C*/ u8 ALIGNED(4) unk9C[11]; - /*0x00A8*/ u8 ALIGNED(4) unkA8[5]; - /*0x00B0*/ u8 ALIGNED(4) unkB0[5]; - /*0x00B8*/ u8 ALIGNED(4) unkB8[11]; - /*0x00C4*/ u8 ALIGNED(4) unkC4[11]; - /*0x00D0*/ u8 ALIGNED(4) unkD0[11]; - /*0x00DC*/ u8 ALIGNED(4) unkDC[11]; - /*0x00E8*/ u8 ALIGNED(4) unkE8[11]; - /*0x00F4*/ u8 ALIGNED(4) unkF4[11][2]; - /*0x010C*/ u8 ALIGNED(4) unk10C[5]; - /*0x0112*/ u16 unk112; - /*0x0114*/ u16 unk114; - /*0x0118*/ u32 unk118; - /*0x011C*/ u32 unk11C; - /*0x0120*/ u32 unk120; - /*0x0124*/ u8 ALIGNED(4) unk124; - /*0x0128*/ u8 ALIGNED(4) unk128; - /*0x012C*/ u32 unk12C; - /*0x0130*/ u32 unk130[5]; - /*0x0144*/ u8 ALIGNED(4) unk144; - /*0x0148*/ u8 ALIGNED(4) unk148[11]; - /*0x0154*/ u8 ALIGNED(4) unk154; - /*0x0158*/ u8 ALIGNED(4) unk158[5]; - /*0x0160*/ struct DodrioSubstruct_0160 unk160; - /*0x318C*/ struct DodrioSubstruct_318C unk318C[5]; - /*0x31A0*/ struct DodrioSubstruct_31A0 unk31A0[5]; - /*0x32CC*/ struct DodrioSubstruct_31A0 unk32CC; - /*0x3308*/ struct DodrioSubstruct_3308 unk3308[5]; + /*0x0029*/ u8 unused1[7]; + /*0x0030*/ u8 ALIGNED(4) countdownEndDelay; + /*0x0034*/ u8 ALIGNED(4) posToPlayerId[MAX_RFU_PLAYERS]; + /*0x003C*/ u8 ALIGNED(4) unused2; // Set to 0, never read + /*0x0040*/ u8 ALIGNED(4) numGraySquares; + /*0x0044*/ u8 ALIGNED(4) berryColStart; + /*0x0048*/ u8 ALIGNED(4) berryColEnd; + /*0x004A*/ u16 berryResults[MAX_RFU_PLAYERS][NUM_BERRY_IDS]; + /*0x0086*/ u16 berriesEaten[MAX_RFU_PLAYERS]; + /*0x0090*/ u8 ALIGNED(4) difficulty[MAX_RFU_PLAYERS]; + /*0x0098*/ u8 ALIGNED(4) pickStateQueue[4]; + /*0x009C*/ u8 ALIGNED(4) eatTimer[NUM_BERRY_COLUMNS]; + /*0x00A8*/ u8 ALIGNED(4) inputState[MAX_RFU_PLAYERS]; + /*0x00B0*/ u8 ALIGNED(4) inputDelay[MAX_RFU_PLAYERS]; + /*0x00B8*/ u8 ALIGNED(4) berryEatenBy[NUM_BERRY_COLUMNS]; + /*0x00C4*/ u8 ALIGNED(4) berryState[NUM_BERRY_COLUMNS]; + /*0x00D0*/ u8 ALIGNED(4) fallTimer[NUM_BERRY_COLUMNS]; + /*0x00DC*/ u8 ALIGNED(4) newBerryTimer[NUM_BERRY_COLUMNS]; + /*0x00E8*/ u8 ALIGNED(4) prevBerryIds[NUM_BERRY_COLUMNS]; + /*0x00F4*/ u8 ALIGNED(4) playersAttemptingPick[NUM_BERRY_COLUMNS][2]; + /*0x010C*/ u8 ALIGNED(4) playAgainStates[MAX_RFU_PLAYERS]; + /*0x0112*/ u16 berriesPickedInRow; + /*0x0114*/ u16 maxBerriesPickedInRow; + /*0x0118*/ bool32 startCountdown; // Never read + /*0x011C*/ bool32 startGame; + /*0x0120*/ bool32 berriesFalling; + /*0x0124*/ u8 ALIGNED(4) clearRecvCmdTimer; + /*0x0128*/ bool8 ALIGNED(4) clearRecvCmds; + /*0x012C*/ bool32 allReadyToEnd; + /*0x0130*/ bool32 readyToEnd[MAX_RFU_PLAYERS]; + /*0x0144*/ bool8 ALIGNED(4) playingPickSound; + /*0x0148*/ bool8 ALIGNED(4) playingSquishSound[NUM_BERRY_COLUMNS]; + /*0x0154*/ u8 ALIGNED(4) endSoundState; + /*0x0158*/ bool8 ALIGNED(4) readyToStart[MAX_RFU_PLAYERS]; + /*0x0160*/ struct DodrioGame_Gfx gfx; + /*0x318C*/ struct DodrioGame_MonInfo monInfo[MAX_RFU_PLAYERS]; + /*0x31A0*/ struct DodrioGame_Player players[MAX_RFU_PLAYERS]; + /*0x32CC*/ struct DodrioGame_Player player; + /*0x3308*/ struct DodrioGame_ScoreResults scoreResults[MAX_RFU_PLAYERS]; }; // size = 0x3330 -EWRAM_DATA static struct DodrioStruct * gUnknown_02022C98 = NULL; -EWRAM_DATA static u16 *gUnknown_02022C9C[5] = {NULL}; -EWRAM_DATA static u16 *gUnknown_02022CB0[2] = {NULL}; -EWRAM_DATA static u16 *gUnknown_02022CB8[11] = {NULL}; -EWRAM_DATA static u16 *gUnknown_02022CE4[4] = {NULL}; -EWRAM_DATA static struct DodrioStruct_2022CF4 *gUnknown_02022CF4 = NULL; -EWRAM_DATA static struct DodrioSubstruct_0160 *gUnknown_02022CF8 = NULL; +EWRAM_DATA static struct DodrioGame * sGame = NULL; +EWRAM_DATA static u16 * sDodrioSpriteIds[MAX_RFU_PLAYERS] = {NULL}; +EWRAM_DATA static u16 * sCloudSpriteIds[NUM_CLOUDS] = {NULL}; +EWRAM_DATA static u16 * sBerrySpriteIds[NUM_BERRY_COLUMNS] = {NULL}; +EWRAM_DATA static u16 * sBerryIconSpriteIds[NUM_BERRY_TYPES] = {NULL}; +EWRAM_DATA static struct StatusBar * sStatusBar = NULL; +EWRAM_DATA static struct DodrioGame_Gfx * sGfx = NULL; -static bool32 gUnknown_03000DB0; +static bool32 sExitingGame; -static void sub_8024A1C(void); -static void sub_8024A30(struct DodrioStruct *); -static void sub_8024BC8(u8 taskId); -static void sub_8024DBC(void); -static void sub_8024E00(void); -static void sub_8024E38(void); -static void sub_8024F10(void); -static void sub_8024F38(void); -static void sub_8024FFC(void); -static void sub_80250D4(void); -static void sub_8025158(void); -static void sub_8025198(void); -static void sub_8025230(void); -static void sub_8025324(void); -static void sub_8025470(void); -static void sub_8025644(void); -static void sub_80256AC(void); -static void sub_8025758(void); -static void sub_802589C(u8 taskId); -static void sub_8025910(u8 taskId); -static void sub_8025D04(void); -static void sub_8025D50(void); -static void sub_8025E0C(void); -static void sub_8025ED8(void); -static void sub_8025F48(void); -static void sub_8026044(void); -static void sub_80261CC(void); -static void sub_80261E4(void); -static void sub_80261F8(struct DodrioSubstruct_318C *, struct Pokemon *); -static void sub_802620C(TaskFunc, u8); -static void sub_802621C(TaskFunc); -static void sub_8026240(u8); -static bool32 sub_8026264(void); -static void sub_80262C0(void); -static bool32 sub_8026634(u8, u8, u8); -static void sub_802671C(void); -static void sub_8026AF4(void); -static void sub_8026B28(void); -static void sub_8026B5C(u8, u8*, u8*); -static bool32 sub_8026BB8(void); -static void sub_8026C28(void); -static bool32 sub_8026C50(void); -static bool32 sub_8026C90(void); -static void sub_8026D1C(u8); -static u8 sub_8026D8C(u8); -static u8 sub_8026DB0(u8, u8); -static void sub_8026F1C(u8, u8, u8); -static void sub_8027234(bool32 arg0); -static void sub_80272A4(void); -static void sub_80272E8(void); -static void sub_80273F0(void); -static void sub_802749C(void); -static u8 sub_8027518(u8); -static void sub_8027554(void); -static void sub_8027608(void); -static u32 sub_8027748(void); -static void sub_8027DD0(u32 arg0); -static void sub_8027E30(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 arg6, u32 arg7, u32 arg8); -static u32 sub_8028164(u32 unused, struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 *arg6, u32 *arg7, u32 *arg8); -static void sub_80282EC(u8); -static u32 sub_8028318(u32 arg0, u8 *arg1); -static void sub_8028350(u32 arg0); -static u32 sub_8028374(u32 arg0); -static void sub_80283A8(void); -static void sub_8028408(struct DodrioSubstruct_318C *arg0, u8 arg1, u8 id, u8 arg3); -static void sub_80284CC(u8); -static void sub_8028504(u8); -static void sub_8028614(u8 count); -static void sub_802868C(bool8 invisible, u8 count); -static void sub_8028734(void); -static void sub_80287E4(void); -static void sub_80289E8(bool8 invisible); -static void sub_80286E4(void); -static bool32 sub_8028828(void); -static void sub_8028A34(void); -static void sub_8028A88(void); -static void sub_8028B80(void); -static void sub_8028D44(void); -static void sub_8028DFC(void); -static void sub_8028E4C(void); -static void sub_8028E84(void); -static void sub_8028EC8(bool8 invisible); -static void sub_8028FCC(void); -static void sub_802903C(void); -static void sub_8029274(struct DodrioSubstruct_0160 *PTR); -static void sub_80292E0(u8); -static bool32 sub_802A770(void); -static u8 sub_802A794(void); -static void sub_8028BF8(u8 id, bool8 invisible); -static void sub_8028C30(bool8 invisible); -static void sub_8028CA4(u16 id, u8 frameNum); -static void sub_8028C7C(u8 id, u8 y); -static void sub_80286B4(u8 id, u8 frameNum); -static u8 sub_8026E70(u8 arg0, u8 arg1); -static void sub_80288D4(u8 arg0); -static u32 sub_8027DFC(u32 arg0); -static u32 IncrementWithLimit(u32 arg0, u32 arg1); -static u32 Min(u32 arg0, u32 arg1); -static u32 sub_80276C0(u8 arg0); -static void Task_ShowDodrioBerryPickingRecords(u8 taskId); -static void sub_8029314(u8 taskId); -static void sub_8027BEC(u8 windowId, s32 width); -static void nullsub_15(struct Sprite *sprite); -static void sub_80284A8(struct Sprite *sprite); -static u32 sub_802853C(struct Sprite *sprite); -static u32 sub_80285AC(struct Sprite *sprite); -static s16 sub_8028F14(u8 arg0, u8 arg1); -static void sub_8028654(bool8 invisible, u8 id); -static void sub_8029338(void); -static bool32 sub_802A8E8(void); -static void sub_802A7A8(void); -static void sub_802A72C(void (*func)(void)); -static void (*sub_802A75C(void))(void); -static void sub_8029338(void); -static void sub_8029440(void); -static void sub_802988C(void); -static void sub_802A010(void); -static void sub_802A380(void); -static void sub_802A454(void); -static void sub_802A534(void); -static void sub_802A588(void); -static void sub_802A6FC(void); -static void nullsub_16(void); +static void ResetTasksAndSprites(void); +static void InitDodrioGame(struct DodrioGame *); +static void Task_StartDodrioGame(u8); +static void DoGameIntro(void); +static void InitCountdown(void); +static void DoCountdown(void); +static void WaitGameStart(void); +static void PlayGame_Leader(void); +static void PlayGame_Member(void); +static void WaitEndGame_Leader(void); +static void WaitEndGame_Member(void); +static void InitResults_Leader(void); +static void InitResults_Member(void); +static void DoResults(void); +static void AskPlayAgain(void); +static void EndLink(void); +static void ExitGame(void); +static void ResetGame(void); +static void Task_NewGameIntro(u8); +static void Task_CommunicateMonInfo(u8); +static void RecvLinkData_Leader(void); +static void SendLinkData_Leader(void); +static void RecvLinkData_Member(void); +static void SendLinkData_Member(void); +static void HandleSound_Leader(void); +static void HandleSound_Member(void); +static void CB2_DodrioGame(void); +static void VBlankCB_DodrioGame(void); +static void InitMonInfo(struct DodrioGame_MonInfo *, struct Pokemon *); +static void CreateTask_(TaskFunc, u8); +static void CreateDodrioGameTask(TaskFunc); +static void SetGameFunc(u8); +static bool32 SlideTreeBordersOut(void); +static void InitFirstWaveOfBerries(void); +static bool32 TryPickBerry(u8, u8, u8); +static void UpdateFallingBerries(void); +static void UpdateGame_Leader(void); +static void UpdateGame_Member(void); +static void GetActiveBerryColumns(u8, u8*, u8*); +static bool32 AllPlayersReadyToStart(void); +static void ResetReadyToStart(void); +static bool32 ReadyToEndGame_Leader(void); +static bool32 ReadyToEndGame_Member(void); +static void TryIncrementDifficulty(u8); +static u8 GetPlayerIdAtColumn(u8); +static u8 GetNewBerryId(u8, u8); +static void IncrementBerryResult(u8, u8, u8); +static void UpdateBerriesPickedInRow(bool32); +static void SetMaxBerriesPickedInRow(void); +static void ResetForPlayAgainPrompt(void); +static void SetRandomPrize(void); +static void TryUpdateRecords(void); +static u8 UpdatePickStateQueue(u8); +static void HandleWaitPlayAgainInput(void); +static void ResetPickState(void); +static u32 GetHighestScore(void); +static void SendPacket_ReadyToStart(bool32); +static void SendPacket_GameState(struct DodrioGame_Player *, + struct DodrioGame_PlayerCommData *, + struct DodrioGame_PlayerCommData *, + struct DodrioGame_PlayerCommData *, + struct DodrioGame_PlayerCommData *, + struct DodrioGame_PlayerCommData *, + u8 , bool32 , bool32 ); +static bool32 RecvPacket_GameState(u32, + struct DodrioGame_Player *, + struct DodrioGame_PlayerCommData *, + struct DodrioGame_PlayerCommData *, + struct DodrioGame_PlayerCommData *, + struct DodrioGame_PlayerCommData *, + struct DodrioGame_PlayerCommData *, + u8 *, bool32 *, bool32 *); +static void SendPacket_PickState(u8); +static bool32 RecvPacket_PickState(u32, u8 *); +static void SendPacket_ReadyToEnd(bool32); +static bool32 RecvPacket_ReadyToEnd(u32); +static void LoadDodrioGfx(void); +static void CreateDodrioSprite(struct DodrioGame_MonInfo *, u8, u8, u8); +static void StartDodrioMissedAnim(u8); +static void StartDodrioIntroAnim(u8); +static void FreeDodrioSprites(u8); +static void SetAllDodrioInvisibility(bool8, u8); +static void CreateStatusBarSprites(void); +static void FreeStatusBar(void); +static void SetStatusBarInvisibility(bool8); +static void InitStatusBarPos(void); +static bool32 DoStatusBarIntro(void); +static void LoadBerryGfx(void); +static void CreateBerrySprites(void); +static void FreeBerrySprites(void); +static void CreateCloudSprites(void); +static void ResetCloudPos(void); +static void StartCloudMovement(void); +static void FreeCloudSprites(void); +static void SetCloudInvisibility(bool8); +static void ResetBerryAndStatusBarSprites(void); +static void ResetGfxState(void); +static void InitGameGfx(struct DodrioGame_Gfx *); +static void SetGfxFuncById(u8); +static bool32 IsGfxFuncActive(void); +static u8 GetPlayAgainState(void); +static void SetBerryInvisibility(u8, bool8); +static void SetBerryIconsInvisibility(bool8); +static void SetBerryAnim(u16, u8); +static void SetBerryYPos(u8, u8); +static void SetDodrioAnim(u8, u8); +static u8 GetNewBerryIdByDifficulty(u8, u8); +static void UpdateStatusBarAnim(u8); +static u32 RecvPacket_ReadyToStart(u32); +static u32 IncrementWithLimit(u32, u32); +static u32 Min(u32, u32); +static u32 GetScore(u8); +static void Task_ShowDodrioBerryPickingRecords(u8); +static void Task_TryRunGfxFunc(u8); +static void PrintRecordsText(u8, s32); +static void SpriteCB_Status(struct Sprite *); +static void SpriteCB_Dodrio(struct Sprite *); +static u32 DoDodrioMissedAnim(struct Sprite *); +static u32 DoDodrioIntroAnim(struct Sprite *); +static s16 GetDodrioXPos(u8, u8); +static void SetDodrioInvisibility(bool8, u8); +static void LoadGfx(void); +static bool32 LoadBgGfx(void); +static void InitBgs(void); +static void SetGfxFunc(void (*func)(void)); +static void (*GetGfxFunc(void))(void); +static void ShowNames(void); +static void ShowResults(void); +static void Msg_WantToPlayAgain(void); +static void Msg_SavingDontTurnOff(void); +static void Msg_CommunicationStandby(void); +static void EraseMessage(void); +static void Msg_SomeoneDroppedOut(void); +static void StopGfxFuncs(void); +static void GfxIdle(void); -// const rom data -static const u8 gUnknown_082F449C[5][5][11] = +// For each player, the array is a list of all the columns starting with the column to their left +// Only the range of active columns is read from the array (dependent on the number of players), +// so the arrays are spaced such that the numbers in the center are where the data that's read starts and end. +static const u8 sActiveColumnMap[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS][NUM_BERRY_COLUMNS] = +{ + { // 1 player (never used), columns 4-6. + // Sometimes read to get default order regardless of the current number of players + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, + }, + { // 2 players (never used), columns 3-6 + {0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 0}, + {0, 1, 2, 5, 6, 3, 4, 5, 8, 9, 0}, + }, + { // 3 players, columns 2-7 + {0, 1, 2, 3, 4, 5, 6, 7, 2, 9, 0}, + {0, 1, 4, 5, 6, 7, 2, 3, 4, 9, 0}, + {0, 1, 6, 7, 2, 3, 4, 5, 6, 9, 0}, + }, + { // 4 players, columns 1-8 + {0, 1, 2, 3, 4, 5, 6, 7, 8, 1, 0}, + {0, 3, 4, 5, 6, 7, 8, 1, 2, 3, 0}, + {0, 5, 6, 7, 8, 1, 2, 3, 4, 5, 0}, + {0, 7, 8, 1, 2, 3, 4, 5, 6, 7, 0}, + }, + { // 5 players, all columns (0-9) + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }, + { 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2 }, + { 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4 }, + { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6 }, + { 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8 }, + }, +}; + +// A table for which falling berry column corresponds to which Dodrio head for each player +// The numbers in each array are the column number for each head, {left, middle, right} +// Dependent on the number of players +static const u8 sDodrioHeadToColumnMap[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS][3] = +{ + { // 1 player (never used) + {4, 5, 6}, + }, + { // 2 players (never used) + {3, 4, 5}, + {5, 6, 3}, + }, + { // 3 players + {4, 5, 6}, + {6, 7, 2}, + {2, 3, 4}, + }, + { // 4 players + {3, 4, 5}, + {5, 6, 7}, + {7, 8, 1}, + {1, 2, 3}, + }, + { // 5 players + {4, 5, 6}, + {6, 7, 8}, + {8, 9, 0}, + {0, 1, 2}, + {2, 3, 4}, + }, +}; + +// A table of player ids and their neighbor, dependent on the total number of players +// {L, M, R}, where M is the player in question, L is their neighbor to the left, and R is their neighbor to the right +static const u8 sDodrioNeighborMap[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS][3] = +{ + { // 1 player (never used) + {1, 0, 1}, + }, + { // 2 players (never used) + {1, 0, 1}, + {0, 1, 0}, + }, + { // 3 players + {2, 0, 1}, + {0, 1, 2}, + {1, 2, 0}, + }, + { // 4 players + {3, 0, 1}, + {0, 1, 2}, + {1, 2, 3}, + {2, 3, 0}, + }, + { // 5 players + {4, 0, 1}, + {0, 1, 2}, + {1, 2, 3}, + {2, 3, 4}, + {3, 4, 0}, + }, +}; + +#define __ 9 // No player at this column. This may go out of bounds if this is returned + +// Takes the number of players and a column and returns the player id at that column. +// Note that the assignment is somewhat arbitrary as players share neighboring columns. +ALIGNED(4) +static const u8 sPlayerIdAtColumn[MAX_RFU_PLAYERS][NUM_BERRY_COLUMNS] = +{ + {__, __, __, __, 1, 1, 1, __, __, __, __}, // 1 player + {__, __, __, 0, 0, 1, 1, 0, __, __, __}, // 2 players + {__, __, 2, 2, 0, 0, 1, 1, 1, __, __}, // 3 players + {__, 3, 3, 0, 0, 1, 1, 2, 2, 3, __}, // 4 players + { 3, 3, 4, 4, 0, 0, 1, 1, 2, 2, 3}, // 5 players +}; + +#undef __ + +// Each array contains the columns that belong solely to one player, dependent on the number of players +// When determing how difficult the berries in a column should be, the highest +// difficulty of the players sharing that column is used. +// This table is used to skip that check, and instead automatically use the +// difficulty of the only player who can use the column. +static const u8 sUnsharedColumns[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS] = +{ + {5}, + {4, 6}, + {3, 5, 7}, + {2, 4, 6, 8}, +#ifndef BUGFIX + {1, 3, 5, 6, 9}, // BUG: Column 6 is shared, 7 is not. As a result, the player in column 7 will have their difficulty influenced by their neighbors +#else + {1, 3, 5, 7, 9}, +#endif +}; + +// Duplicate and unused gfx. Feel free to remove. +static const u32 sDuplicateGfx[] = INCBIN_U32("graphics/dodrio_berry_picking/bg.gbapal", + "graphics/dodrio_berry_picking/tree_border.gbapal", + "graphics/dodrio_berry_picking/dodrio.gbapal", + "graphics/dodrio_berry_picking/shiny.gbapal", + "graphics/dodrio_berry_picking/status.gbapal", + "graphics/dodrio_berry_picking/berries.gbapal", + "graphics/dodrio_berry_picking/berries.4bpp.lz", + "graphics/dodrio_berry_picking/cloud.gbapal", + "graphics/dodrio_berry_picking/bg.4bpp.lz", + "graphics/dodrio_berry_picking/tree_border.4bpp.lz", + "graphics/dodrio_berry_picking/status.4bpp.lz", + "graphics/dodrio_berry_picking/cloud.4bpp.lz", + "graphics/dodrio_berry_picking/dodrio.4bpp.lz", + "graphics/dodrio_berry_picking/bg.bin.lz", + "graphics/dodrio_berry_picking/tree_border_right.bin.lz", + "graphics/dodrio_berry_picking/tree_border_left.bin.lz"); + + +static const u8 sBerryFallDelays[][3] = +{ + { [BERRY_BLUE] = 40, [BERRY_GREEN] = 24, [BERRY_GOLD] = 13 }, + { [BERRY_BLUE] = 32, [BERRY_GREEN] = 19, [BERRY_GOLD] = 10 }, + { [BERRY_BLUE] = 22, [BERRY_GREEN] = 13, [BERRY_GOLD] = 7 }, +}; + +// How far the outer tree borders should slide to reveal the game screen. +// Dependent on how many players are playing. +// Curiously the 2-player screen is narrower than the 1-player, though neither +// gets used as there's a 3 player minimum +ALIGNED(4) +static const u8 sTreeBorderXPos[MAX_RFU_PLAYERS] = {8, 5, 8, 11, 15}; + +// The number of berries eaten needed to progress to the next difficulty +ALIGNED(4) +static const u8 sDifficultyThresholds[NUM_DIFFICULTIES] = {5, 10, 20, 30, 50, 70, 100}; + +ALIGNED(4) +static const u8 sPrizeBerryIds[][10] = +{ + { // Possible prizes with 3 players + ITEM_TO_BERRY(ITEM_RAZZ_BERRY) - 1, + ITEM_TO_BERRY(ITEM_BLUK_BERRY) - 1, + ITEM_TO_BERRY(ITEM_NANAB_BERRY) - 1, + ITEM_TO_BERRY(ITEM_WEPEAR_BERRY) - 1, + ITEM_TO_BERRY(ITEM_PINAP_BERRY) - 1, + ITEM_TO_BERRY(ITEM_PINAP_BERRY) - 1, + ITEM_TO_BERRY(ITEM_WEPEAR_BERRY) - 1, + ITEM_TO_BERRY(ITEM_NANAB_BERRY) - 1, + ITEM_TO_BERRY(ITEM_BLUK_BERRY) - 1, + ITEM_TO_BERRY(ITEM_RAZZ_BERRY) - 1 + }, + { // Possible prizes with 4 players + ITEM_TO_BERRY(ITEM_POMEG_BERRY) - 1, + ITEM_TO_BERRY(ITEM_KELPSY_BERRY) - 1, + ITEM_TO_BERRY(ITEM_QUALOT_BERRY) - 1, + ITEM_TO_BERRY(ITEM_HONDEW_BERRY) - 1, + ITEM_TO_BERRY(ITEM_GREPA_BERRY) - 1, + ITEM_TO_BERRY(ITEM_TAMATO_BERRY) - 1, + ITEM_TO_BERRY(ITEM_CORNN_BERRY) - 1, + ITEM_TO_BERRY(ITEM_MAGOST_BERRY) - 1, + ITEM_TO_BERRY(ITEM_RABUTA_BERRY) - 1, + ITEM_TO_BERRY(ITEM_NOMEL_BERRY) - 1 + }, + { // Possible prizes with 5 players + ITEM_TO_BERRY(ITEM_SPELON_BERRY) - 1, + ITEM_TO_BERRY(ITEM_PAMTRE_BERRY) - 1, + ITEM_TO_BERRY(ITEM_WATMEL_BERRY) - 1, + ITEM_TO_BERRY(ITEM_DURIN_BERRY) - 1, + ITEM_TO_BERRY(ITEM_BELUE_BERRY) - 1, + ITEM_TO_BERRY(ITEM_BELUE_BERRY) - 1, + ITEM_TO_BERRY(ITEM_DURIN_BERRY) - 1, + ITEM_TO_BERRY(ITEM_WATMEL_BERRY) - 1, + ITEM_TO_BERRY(ITEM_PAMTRE_BERRY) - 1, + ITEM_TO_BERRY(ITEM_SPELON_BERRY) - 1 + }, +}; + +static void (*const sLeaderFuncs[])(void) = +{ + [FUNC_INTRO] = DoGameIntro, + [FUNC_INIT_COUNTDOWN] = InitCountdown, + [FUNC_COUNTDOWN] = DoCountdown, + [FUNC_WAIT_START] = WaitGameStart, + [FUNC_PLAY_GAME] = PlayGame_Leader, + [FUNC_INIT_RESULTS] = InitResults_Leader, + [FUNC_RESULTS] = DoResults, + [FUNC_ASK_PLAY_AGAIN] = AskPlayAgain, + [FUNC_END_LINK] = EndLink, + [FUNC_EXIT] = ExitGame, + [FUNC_RESET_GAME] = ResetGame, + [FUNC_WAIT_END_GAME] = WaitEndGame_Leader +}; + +static void (*const sMemberFuncs[])(void) = +{ + [FUNC_INTRO] = DoGameIntro, + [FUNC_INIT_COUNTDOWN] = InitCountdown, + [FUNC_COUNTDOWN] = DoCountdown, + [FUNC_WAIT_START] = WaitGameStart, + [FUNC_PLAY_GAME] = PlayGame_Member, + [FUNC_INIT_RESULTS] = InitResults_Member, + [FUNC_RESULTS] = DoResults, + [FUNC_ASK_PLAY_AGAIN] = AskPlayAgain, + [FUNC_END_LINK] = EndLink, + [FUNC_EXIT] = ExitGame, + [FUNC_RESET_GAME] = ResetGame, + [FUNC_WAIT_END_GAME] = WaitEndGame_Member +}; + +void StartDodrioBerryPicking(u16 partyId, void (*exitCallback)(void)) +{ + sExitingGame = FALSE; + + if (gReceivedRemoteLinkPlayers != 0 && (sGame = AllocZeroed(sizeof(*sGame)))) + { + ResetTasksAndSprites(); + InitDodrioGame(sGame); + sGame->exitCallback = exitCallback; + sGame->multiplayerId = GetMultiplayerId(); + sGame->player = sGame->players[sGame->multiplayerId]; + InitMonInfo(&sGame->monInfo[sGame->multiplayerId], &gPlayerParty[partyId]); + CreateTask(Task_StartDodrioGame, 1); + SetMainCallback2(CB2_DodrioGame); + SetRandomPrize(); + GetActiveBerryColumns(sGame->numPlayers, &sGame->berryColStart, &sGame->berryColEnd); + StopMapMusic(); + PlayNewMapMusic(MUS_RG_BERRY_PICK); + } + else + { + // Exit - Alloc failed, or players not connected + SetMainCallback2(exitCallback); + return; + } +} + +static void ResetTasksAndSprites(void) +{ + ResetTasks(); + ResetSpriteData(); + FreeAllSpritePalettes(); +} + +static void InitDodrioGame(struct DodrioGame * game) +{ + u8 i; + + game->startState = 0; + game->state = 0; + game->timer = 0; + game->funcId = FUNC_INTRO; + game->prevFuncId = FUNC_INTRO; + game->startGame = FALSE; + game->berriesFalling = FALSE; + game->countdownEndDelay = 0; + game->numGraySquares = 0; + game->unused2 = 0; + game->allReadyToEnd = FALSE; + + for (i = 0; i < ARRAY_COUNT(game->pickStateQueue); i++) + game->pickStateQueue[i] = PICK_NONE; + + for (i = 0; i < MAX_RFU_PLAYERS; i++) + { + game->inputState[i] = INPUTSTATE_NONE; + game->inputDelay[i] = 0; + game->berryResults[i][BERRY_BLUE] = 0; + game->berryResults[i][BERRY_GREEN] = 0; + game->berryResults[i][BERRY_GOLD] = 0; + game->berryResults[i][BERRY_MISSED] = 0; + game->berryResults[i][BERRY_IN_ROW] = 0; + game->playAgainStates[i] = PLAY_AGAIN_NONE; + game->readyToEnd[i] = FALSE; + } + + for (i = 0; i < NUM_BERRY_COLUMNS; i++) + { + game->fallTimer[i] = 0; + game->newBerryTimer[i] = 0; + game->berryState[i] = BERRYSTATE_NONE; + game->playersAttemptingPick[i][0] = PLAYER_NONE; + game->playersAttemptingPick[i][1] = PLAYER_NONE; + } + + game->isLeader = GetMultiplayerId() == 0 ? TRUE : FALSE; + game->numPlayers = GetLinkPlayerCount(); + game->posToPlayerId[0] = GetMultiplayerId(); + for (i = 1; i < game->numPlayers; i++) + { + game->posToPlayerId[i] = game->posToPlayerId[i - 1] + 1; + if (game->posToPlayerId[i] > game->numPlayers - 1) + game->posToPlayerId[i] %= game->numPlayers; + } +} + +static void Task_StartDodrioGame(u8 taskId) +{ + u8 i, numPlayers; + + switch (sGame->startState) + { + case 0: + SetVBlankCallback(NULL); + CreateTask_(Task_CommunicateMonInfo, 4); + sGame->startState++; + break; + case 1: + if (!FuncIsActiveTask(Task_CommunicateMonInfo)) + { + InitGameGfx(&sGame->gfx); + sGame->startState++; + } + break; + case 2: + if (!IsGfxFuncActive()) + { + Rfu_SetLinkStandbyCallback(); + sGame->startState++; + } + break; + case 3: + if (IsLinkTaskFinished()) + { + if (gReceivedRemoteLinkPlayers != 0) + { + LoadWirelessStatusIndicatorSpriteGfx(); + CreateWirelessStatusIndicatorSprite(0, 0); + } + sGame->startState++; + } + break; + case 4: + numPlayers = sGame->numPlayers; + LoadDodrioGfx(); + for (i = 0; i < numPlayers; i++) + CreateDodrioSprite(&sGame->monInfo[sGame->posToPlayerId[i]], i, sGame->posToPlayerId[i], sGame->numPlayers); + + SetAllDodrioInvisibility(FALSE, sGame->numPlayers); + sGame->startState++; + break; + case 5: + LoadBerryGfx(); + CreateBerrySprites(); + CreateCloudSprites(); + CreateStatusBarSprites(); + sGame->startState++; + break; + case 6: + BlendPalettes(PALETTES_ALL, 0x10, 0x00); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, 0); + SetVBlankCallback(VBlankCB_DodrioGame); + sGame->startState++; + break; + case 7: + UpdatePaletteFade(); + if (!gPaletteFade.active) + sGame->startState++; + break; + default: + DestroyTask(taskId); + CreateDodrioGameTask(Task_NewGameIntro); + break; + } +} + +static void Task_DodrioGame_Leader(u8 taskId) +{ + RecvLinkData_Leader(); + sLeaderFuncs[sGame->funcId](); + if (!sExitingGame) + UpdateGame_Leader(); + + SendLinkData_Leader(); +} + +static void Task_DodrioGame_Member(u8 taskId) +{ + RecvLinkData_Member(); + sMemberFuncs[sGame->funcId](); + if (!sExitingGame) + UpdateGame_Member(); + + SendLinkData_Member(); +} + +static void DoGameIntro(void) +{ + switch (sGame->state) + { + case 0: + StartDodrioIntroAnim(1); + SetGfxFuncById(GFXFUNC_SHOW_NAMES); + sGame->state++; + break; + case 1: + if (!IsGfxFuncActive()) + SetGameFunc(FUNC_INIT_COUNTDOWN); + break; + } +} + +static void InitCountdown(void) +{ + switch (sGame->state) + { + case 0: + InitFirstWaveOfBerries(); + sGame->state++; + break; + default: + sGame->startCountdown = TRUE; + SetGameFunc(FUNC_COUNTDOWN); + break; + } +} + +static void DoCountdown(void) +{ + switch (sGame->state) + { + case 0: + StartMinigameCountdown(GFXTAG_COUNTDOWN, PALTAG_COUNTDOWN, 120, 80, 0); + sGame->state++; + break; + case 1: + Rfu_SetLinkStandbyCallback(); + sGame->state++; + break; + case 2: + if (IsLinkTaskFinished()) + { + sGame->state++; + sGame->countdownEndDelay = 0; + } + break; + case 3: + if (!IsMinigameCountdownRunning()) + sGame->state++; + break; + case 4: + if (++sGame->countdownEndDelay > 5) + { + Rfu_SetLinkStandbyCallback(); + sGame->state++; + } + break; + case 5: + if (IsLinkTaskFinished()) + SetGameFunc(FUNC_WAIT_START); + break; + } +} + +static void WaitGameStart(void) +{ + switch (sGame->state) + { + case 0: + if (sGame->startGame) + SetGameFunc(FUNC_PLAY_GAME); + break; + } +} + +static void PlayGame_Leader(void) +{ + switch (sGame->state) + { + case 0: + if (sGame->numGraySquares < NUM_STATUS_SQUARES) + { + if (sGame->inputState[0] == INPUTSTATE_NONE) + { + if (JOY_NEW(DPAD_UP)) + { + if (sGame->players[0].comm.pickState == PICK_NONE) + { + sGame->players[0].comm.ateBerry = FALSE; + sGame->players[0].comm.pickState = UpdatePickStateQueue(PICK_MIDDLE); + } + } + else if (JOY_NEW(DPAD_RIGHT)) + { + if (sGame->players[0].comm.pickState == PICK_NONE) + { + sGame->players[0].comm.ateBerry = FALSE; + sGame->players[0].comm.pickState = UpdatePickStateQueue(PICK_RIGHT); + } + } + else if (JOY_NEW(DPAD_LEFT)) + { + if (sGame->players[0].comm.pickState == PICK_NONE) + { + sGame->players[0].comm.ateBerry = FALSE; + sGame->players[0].comm.pickState = UpdatePickStateQueue(PICK_LEFT); + } + } + else + { + sGame->players[0].comm.pickState = UpdatePickStateQueue(PICK_NONE); + } + } + } + else + { + SetGameFunc(FUNC_WAIT_END_GAME); + } + UpdateFallingBerries(); + HandleSound_Leader(); + break; + } +} + +static void PlayGame_Member(void) +{ + if (sGame->numGraySquares < NUM_STATUS_SQUARES) + { + if (JOY_NEW(DPAD_UP)) + { + if (sGame->players[sGame->multiplayerId].comm.pickState == PICK_NONE) + { + sGame->player.comm.pickState = PICK_MIDDLE; + } + } + else if (JOY_NEW(DPAD_RIGHT)) + { + if (sGame->players[sGame->multiplayerId].comm.pickState == PICK_NONE) + { + sGame->player.comm.pickState = PICK_RIGHT; + } + } + else if (JOY_NEW(DPAD_LEFT)) + { + if (sGame->players[sGame->multiplayerId].comm.pickState == PICK_NONE) + { + sGame->player.comm.pickState = PICK_LEFT; + } + } + else + { + sGame->player.comm.pickState = PICK_NONE; + } + } + else + { + SetGameFunc(FUNC_WAIT_END_GAME); + } + HandleSound_Member(); +} + +static void WaitEndGame_Leader(void) +{ + u8 i; + + UpdateFallingBerries(); + HandleSound_Leader(); + if (ReadyToEndGame_Leader() == TRUE) + { + SetMaxBerriesPickedInRow(); + SetGameFunc(FUNC_INIT_RESULTS); + } + else + { + sGame->allReadyToEnd = TRUE; + for (i = 1; i < sGame->numPlayers; i++) + { + if (sGame->readyToEnd[i] != TRUE) + { + sGame->allReadyToEnd = FALSE; + break; + } + } + } +} + +static void WaitEndGame_Member(void) +{ + HandleSound_Member(); + if (ReadyToEndGame_Member() == TRUE) + SetGameFunc(FUNC_INIT_RESULTS); +} + +static bool32 AllLinkBlocksReceived(void) +{ + u8 recvStatus = GetBlockReceivedStatus(); + u8 playerFlags = GetLinkPlayerCountAsBitFlags(); + if (recvStatus == playerFlags) + { + ResetBlockReceivedFlags(); + return TRUE; + } + else + { + return FALSE; + } +} + +static void InitResults_Leader(void) +{ + switch (sGame->state) + { + case 0: + if (SendBlock(0, sGame->berryResults, sizeof(sGame->berryResults))) + { + sGame->playersReceived = 0; + sGame->state++; + } + break; + case 1: + if (IsLinkTaskFinished()) + { + sGame->state++; + } + break; + case 2: + if (AllLinkBlocksReceived()) + { + sGame->playersReceived = sGame->numPlayers; + } + if (sGame->playersReceived >= sGame->numPlayers) + { + sGame->timer++; + sGame->state++; + } + break; + default: + if (WaitFanfare(TRUE)) + { + SetGameFunc(FUNC_RESULTS); + FadeOutAndPlayNewMapMusic(MUS_RG_VICTORY_WILD, 4); + } + break; + } +} + +static void InitResults_Member(void) +{ + u8 i; + + switch (sGame->state) { + case 0: + if (SendBlock(0, sGame->berryResults[sGame->timer], sizeof(sGame->berryResults))) { + sGame->playersReceived = 0; + sGame->state++; + } + break; + case 1: + if (IsLinkTaskFinished()) { + sGame->state++; + } + break; + case 2: + if (AllLinkBlocksReceived()) { + for (i = 0; i < sGame->numPlayers; i++) { + memcpy(sGame->berryResults, gBlockRecvBuffer, sizeof(sGame->berryResults)); + sGame->playersReceived = sGame->numPlayers; + } + } + if (sGame->playersReceived >= sGame->numPlayers) { + sGame->timer++; + sGame->state++; + } + break; + default: + if (WaitFanfare(TRUE)) { + sGame->maxBerriesPickedInRow = sGame->berryResults[sGame->multiplayerId][BERRY_IN_ROW]; + SetGameFunc(FUNC_RESULTS); + FadeOutAndPlayNewMapMusic(MUS_RG_VICTORY_WILD, 4); + } + break; + } +} + +static void DoResults(void) +{ + u8 playAgainState = PLAY_AGAIN_YES; + u8 i; + + switch (sGame->state) + { + case 0: + TryUpdateRecords(); + SetStatusBarInvisibility(TRUE); + ResetCloudPos(); + SetCloudInvisibility(TRUE); + SetGfxFuncById(GFXFUNC_SHOW_RESULTS); + sGame->state++; + break; + case 1: + if (!IsGfxFuncActive()) + { + SetGfxFuncById(GFXFUNC_MSG_COMM_STANDBY); + sGame->state++; + } + break; + case 2: + playAgainState = GetPlayAgainState(); + if (SendBlock(0, &playAgainState, sizeof(playAgainState))) + sGame->state++; + break; + case 3: + if (IsLinkTaskFinished()) + { + sGame->state++; + sGame->playersReceived = 0; + } + break; + case 4: + if (AllLinkBlocksReceived()) + { + for (i = 0; i < sGame->numPlayers; i++) + { + *(&sGame->playAgainStates[i]) = *(u8 *)gBlockRecvBuffer[i]; + sGame->playersReceived = sGame->numPlayers; + } + } + if (sGame->playersReceived >= sGame->numPlayers) + { + if (++sGame->timer >= 120) + { + SetGfxFuncById(GFXFUNC_ERASE_MSG); + sGame->state++; + } + } + break; + default: + if (!IsGfxFuncActive()) + SetGameFunc(FUNC_ASK_PLAY_AGAIN); + break; + } +} + +static void AskPlayAgain(void) +{ + u8 playAgainState; + u8 i; + + switch (sGame->state) + { + case 0: + if (GetHighestScore() >= PRIZE_SCORE) + { + SetGfxFuncById(GFXFUNC_MSG_SAVING); + } + sGame->state++; + break; + case 1: + if (!IsGfxFuncActive()) + { + SetGfxFuncById(GFXFUNC_MSG_PLAY_AGAIN); + sGame->state++; + } + break; + case 2: + ResetBerryAndStatusBarSprites(); + ResetForPlayAgainPrompt(); + sGame->state++; + break; + case 3: + if ((playAgainState = GetPlayAgainState()) != PLAY_AGAIN_NONE) + { + sGame->state++; + } + break; + case 4: + if (!IsGfxFuncActive()) + { + SetGfxFuncById(GFXFUNC_MSG_COMM_STANDBY); + sGame->state++; + } + break; + case 5: + playAgainState = GetPlayAgainState(); + if (SendBlock(0, &playAgainState, sizeof(playAgainState))) + { + sGame->playersReceived = 0; + sGame->state++; + } + break; + case 6: + if (IsLinkTaskFinished()) + sGame->state++; + break; + case 7: + if (AllLinkBlocksReceived()) + { + for (i = 0; i < sGame->numPlayers; i++) + { + *(&sGame->playAgainStates[i]) = *(u8 *)gBlockRecvBuffer[i]; + sGame->playersReceived = sGame->numPlayers; + } + } + if (sGame->playersReceived >= sGame->numPlayers) + { + if (++sGame->timer >= 120) + { + ResetPickState(); + SetGfxFuncById(GFXFUNC_ERASE_MSG); + sGame->state++; + } + } + else + { + HandleWaitPlayAgainInput(); + } + break; + default: + if (!IsGfxFuncActive()) + { + for (i = 0; i < sGame->numPlayers; i++) + { + if (sGame->playAgainStates[i] == PLAY_AGAIN_NO) + { + SetGameFunc(FUNC_END_LINK); + return; + } + } + SetGameFunc(FUNC_RESET_GAME); + } + break; + } +} + +static void EndLink(void) +{ + switch (sGame->state) + { + case 0: + SetCloseLinkCallback(); + SetGfxFuncById(GFXFUNC_MSG_PLAYER_DROPPED); + sGame->state++; + break; + case 1: + if (!IsGfxFuncActive()) + sGame->state++; + break; + case 2: + if (GetPlayAgainState() == PLAY_AGAIN_DROPPED) + sGame->state++; + break; + default: + if (gReceivedRemoteLinkPlayers == 0) + { + SetGameFunc(FUNC_EXIT); + } + break; + } +} + +static void ExitGame(void) +{ + switch (sGame->state) + { + case 0: + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, 0); + sGame->state++; + break; + case 1: + UpdatePaletteFade(); + if (!gPaletteFade.active) + sGame->state++; + break; + case 2: + FreeBerrySprites(); + FreeStatusBar(); + FreeDodrioSprites(sGame->numPlayers); + FreeCloudSprites(); + sExitingGame = TRUE; + SetGfxFuncById(GFXFUNC_STOP); + sGame->state++; + break; + default: + if (!IsGfxFuncActive()) + { + SetMainCallback2(sGame->exitCallback); + DestroyTask(sGame->taskId); + Free(sGame); + FreeAllWindowBuffers(); + } + break; + } +} + +static void ResetGame(void) +{ + switch (sGame->state) + { + case 0: + SetGfxFuncById(GFXFUNC_IDLE); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, 0); + sGame->state++; + break; + case 1: + UpdatePaletteFade(); + if (!gPaletteFade.active) + { + sGame->state++; + } + break; + case 2: + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(3, 0, 0); + ChangeBgY(3, 0, 0); + sGame->state++; + break; + case 3: + StopMapMusic(); + sGame->state++; + break; + case 4: + PlayNewMapMusic(MUS_RG_BERRY_PICK); + StartCloudMovement(); + sGame->state++; + break; + case 5: + BlendPalettes(PALETTES_ALL, 16, 0); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, 0); + sGame->state++; + break; + case 6: + UpdatePaletteFade(); + if (!gPaletteFade.active) + sGame->state++; + break; + default: + DestroyTask(sGame->taskId); + CreateDodrioGameTask(Task_NewGameIntro); + ResetGfxState(); + InitDodrioGame(sGame); + if (gReceivedRemoteLinkPlayers == 0) + sGame->numPlayers = 1; + + SetRandomPrize(); + SetCloudInvisibility(FALSE); + break; + } +} + +static void Task_NewGameIntro(u8 taskId) +{ + switch (sGame->state) + { + case 0: + if (SlideTreeBordersOut() == TRUE) + sGame->state++; + break; + case 1: + InitStatusBarPos(); + sGame->state++; + break; + case 2: + if (DoStatusBarIntro() == TRUE) + sGame->state++; + break; + default: + if (sGame->isLeader) + CreateDodrioGameTask(Task_DodrioGame_Leader); + else + CreateDodrioGameTask(Task_DodrioGame_Member); + + DestroyTask(taskId); + break; + } +} + +#define tState data[0] + +static void Task_CommunicateMonInfo(u8 taskId) +{ + s16 * data = gTasks[taskId].data; + u8 i; + + switch (tState) + { + case 0: + if (SendBlock(0, &sGame->monInfo[sGame->multiplayerId].isShiny, sizeof(sGame->monInfo[sGame->multiplayerId].isShiny))) + { + sGame->playersReceived = 0; + tState++; + } + break; + case 1: + if (IsLinkTaskFinished()) + tState++; + break; + case 2: + if (AllLinkBlocksReceived()) + { + for (i = 0; i < sGame->numPlayers; i++) + { + *(u8 *)&sGame->monInfo[i] = *(u8 *)gBlockRecvBuffer[i]; + sGame->playersReceived = sGame->numPlayers; + } + } + if (sGame->playersReceived >= sGame->numPlayers) + { + DestroyTask(taskId); + SetGfxFuncById(GFXFUNC_ERASE_MSG); + sGame->state++; + } + break; + } +} + +#undef tState + +static void RecvLinkData_Gameplay(void) +{ + u8 i; + u8 numPlayers = sGame->numPlayers; + + sGame->players[0].receivedGameStatePacket = RecvPacket_GameState(0, + &sGame->players[0], + &sGame->players[0].comm, + &sGame->players[1].comm, + &sGame->players[2].comm, + &sGame->players[3].comm, + &sGame->players[4].comm, + &sGame->numGraySquares, + &sGame->berriesFalling, + &sGame->allReadyToEnd); + sGame->clearRecvCmds = TRUE; + + for (i = 1; i < numPlayers; i++) + { + if (sGame->inputState[i] == INPUTSTATE_NONE && !RecvPacket_PickState(i, &sGame->players[i].comm.pickState)) + { + sGame->players[i].comm.pickState = PICK_NONE; + sGame->clearRecvCmds = FALSE; + } + } + if (++sGame->clearRecvCmdTimer >= 60) + { + if (sGame->clearRecvCmds) + { + ClearRecvCommands(); + sGame->clearRecvCmdTimer = 0; + } + else if (sGame->clearRecvCmdTimer > 70) + { + ClearRecvCommands(); + sGame->clearRecvCmdTimer = 0; + } + } + + for (i = 0; i < numPlayers; i++) + { + if (sGame->players[i].comm.pickState != PICK_NONE && sGame->inputState[i] == INPUTSTATE_NONE) + { + sGame->inputState[i] = INPUTSTATE_TRY_PICK; + } + switch (sGame->inputState[i]) + { + case INPUTSTATE_NONE: + default: + break; + case INPUTSTATE_TRY_PICK: + case INPUTSTATE_PICKED: + case INPUTSTATE_ATE_BERRY: + if (++sGame->inputDelay[i] >= 6) + { + sGame->inputDelay[i] = 0; + sGame->inputState[i] = INPUTSTATE_NONE; + sGame->players[i].comm.pickState = PICK_NONE; + sGame->players[i].comm.ateBerry = FALSE; + sGame->players[i].comm.missedBerry = FALSE; + } + break; + case INPUTSTATE_BAD_MISS: + // Tried to pick with no berry in range, long delay until next input + if (++sGame->inputDelay[i] >= 40) + { + sGame->inputDelay[i] = 0; + sGame->inputState[i] = INPUTSTATE_NONE; + sGame->players[i].comm.pickState = PICK_NONE; + sGame->players[i].comm.ateBerry = FALSE; + sGame->players[i].comm.missedBerry = FALSE; + } + break; + } + } +} + +static void RecvLinkData_ReadyToEnd(void) +{ + u8 i; + u8 numPlayers = sGame->numPlayers; + + sGame->players[0].receivedGameStatePacket = RecvPacket_GameState(0, + &sGame->players[0], + &sGame->players[0].comm, + &sGame->players[1].comm, + &sGame->players[2].comm, + &sGame->players[3].comm, + &sGame->players[4].comm, + &sGame->numGraySquares, + &sGame->berriesFalling, + &sGame->allReadyToEnd); + sGame->clearRecvCmds = TRUE; + + for (i = 1; i < numPlayers; i++) + { + if (RecvPacket_ReadyToEnd(i)) + { + sGame->readyToEnd[i] = TRUE; + sGame->clearRecvCmds = FALSE; + } + } + if (++sGame->clearRecvCmdTimer >= 60) + { + if (sGame->clearRecvCmds) + { + ClearRecvCommands(); + sGame->clearRecvCmdTimer = 0; + } + else if (sGame->clearRecvCmdTimer > 70) + { + ClearRecvCommands(); + sGame->clearRecvCmdTimer = 0; + } + } +} + +static void RecvLinkData_Leader(void) +{ + switch (sGame->funcId) + { + case FUNC_WAIT_START: + if (AllPlayersReadyToStart() == TRUE) + { + ResetReadyToStart(); + sGame->startGame = TRUE; + } + break; + case FUNC_PLAY_GAME: + RecvLinkData_Gameplay(); + break; + case FUNC_WAIT_END_GAME: + RecvLinkData_ReadyToEnd(); + break; + } +} + +static void SendLinkData_Leader(void) +{ + switch (sGame->funcId) + { + case FUNC_PLAY_GAME: + SendPacket_GameState(&sGame->player, + &sGame->players[0].comm, + &sGame->players[1].comm, + &sGame->players[2].comm, + &sGame->players[3].comm, + &sGame->players[4].comm, + sGame->numGraySquares, + sGame->berriesFalling, + sGame->allReadyToEnd); + break; + case FUNC_WAIT_END_GAME: + SendPacket_GameState(&sGame->player, + &sGame->players[0].comm, + &sGame->players[1].comm, + &sGame->players[2].comm, + &sGame->players[3].comm, + &sGame->players[4].comm, + sGame->numGraySquares, + sGame->berriesFalling, + sGame->allReadyToEnd); + break; + } +} + +static void RecvLinkData_Member(void) +{ + switch (sGame->funcId) + { + case FUNC_PLAY_GAME: + RecvPacket_GameState(sGame->multiplayerId, + &sGame->players[sGame->multiplayerId], + &sGame->players[0].comm, + &sGame->players[1].comm, + &sGame->players[2].comm, + &sGame->players[3].comm, + &sGame->players[4].comm, + &sGame->numGraySquares, + &sGame->berriesFalling, + &sGame->allReadyToEnd); + break; + case FUNC_WAIT_END_GAME: + RecvPacket_GameState(sGame->multiplayerId, + &sGame->players[sGame->multiplayerId], + &sGame->players[0].comm, + &sGame->players[1].comm, + &sGame->players[2].comm, + &sGame->players[3].comm, + &sGame->players[4].comm, + &sGame->numGraySquares, + &sGame->berriesFalling, + &sGame->allReadyToEnd); + break; + } +} + +static void SendLinkData_Member(void) +{ + switch (sGame->funcId) + { + case FUNC_WAIT_START: + SendPacket_ReadyToStart(TRUE); + sGame->startGame = TRUE; + break; + case FUNC_PLAY_GAME: + if (sGame->player.comm.pickState != PICK_NONE) + { + SendPacket_PickState(sGame->player.comm.pickState); + } + break; + case FUNC_WAIT_END_GAME: + if (!sGame->berriesFalling && !sGame->allReadyToEnd) + SendPacket_ReadyToEnd(TRUE); + break; + } +} + +static void HandleSound_Leader(void) +{ + if (sGame->players[sGame->multiplayerId].comm.pickState == PICK_NONE) + { + if (!IsSEPlaying()) + sGame->playingPickSound = FALSE; + } + else if (sGame->players[sGame->multiplayerId].comm.ateBerry == TRUE) + { + if (!sGame->playingPickSound) + { + m4aSongNumStop(SE_SUCCESS); + PlaySE(SE_SUCCESS); + sGame->playingPickSound = TRUE; + } + } + else if (sGame->players[sGame->multiplayerId].comm.missedBerry == TRUE) + { + if (!sGame->playingPickSound && !IsSEPlaying()) + { + PlaySE(SE_BOO); + StartDodrioMissedAnim(1); + sGame->playingPickSound = TRUE; + } + } + + if (sGame->endSoundState == 0 && sGame->numGraySquares >= NUM_STATUS_SQUARES) + { + // Ready to play game over sound + StopMapMusic(); + sGame->endSoundState = 1; + } + else if (sGame->endSoundState == 1) + { + // Play game over sound + PlayFanfareByFanfareNum(FANFARE_TOO_BAD); + sGame->endSoundState = 2; + } +} + +static void HandleSound_Member(void) +{ + u8 berryStart = sGame->berryColStart; + u8 berryEnd = sGame->berryColEnd; + u8 i; + if (sGame->players[sGame->multiplayerId].comm.pickState == PICK_NONE) + { + if (sGame->players[sGame->multiplayerId].comm.ateBerry != TRUE + && sGame->players[sGame->multiplayerId].comm.missedBerry != TRUE) + sGame->playingPickSound = 0; + } + else if (sGame->players[sGame->multiplayerId].comm.ateBerry == TRUE) + { + if (!sGame->playingPickSound) + { + m4aSongNumStop(SE_SUCCESS); + PlaySE(SE_SUCCESS); + sGame->playingPickSound = TRUE; + } + } + else if (sGame->players[sGame->multiplayerId].comm.missedBerry == TRUE) + { + if (!sGame->playingPickSound && !IsSEPlaying()) + { + PlaySE(SE_BOO); + StartDodrioMissedAnim(1); + sGame->playingPickSound = TRUE; + } + } + for (i = berryStart; i < berryEnd; i++) + { + struct DodrioGame_Berries * berries = &sGame->players[sGame->multiplayerId].berries; + if (berries->fallDist[i] >= MAX_FALL_DIST) + { + if (!sGame->playingSquishSound[i]) + { + PlaySE(SE_BALLOON_RED + berries->ids[i]); + sGame->playingSquishSound[i] = TRUE; + } + } + else + { + sGame->playingSquishSound[i] = FALSE; + } + } + if (sGame->endSoundState == 0 && sGame->numGraySquares >= NUM_STATUS_SQUARES) + { + // Ready to play game over sound + StopMapMusic(); + sGame->endSoundState = 1; + } + else if (sGame->endSoundState == 1) + { + // Play game over sound + PlayFanfareByFanfareNum(FANFARE_TOO_BAD); + sGame->endSoundState = 2; + } +} + +static void CB2_DodrioGame(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void VBlankCB_DodrioGame(void) +{ + TransferPlttBuffer(); + LoadOam(); + ProcessSpriteCopyRequests(); +} + +static void InitMonInfo(struct DodrioGame_MonInfo * monInfo, struct Pokemon * mon) +{ + monInfo->isShiny = IsMonShiny(mon); +} + +static void CreateTask_(TaskFunc func, u8 priority) +{ + CreateTask(func, priority); +} + +static void CreateDodrioGameTask(TaskFunc func) +{ + sGame->taskId = CreateTask(func, 1); + sGame->state = 0; + sGame->startState = 0; + sGame->timer = 0; +} + +static void SetGameFunc(u8 funcId) +{ + sGame->prevFuncId = sGame->funcId; + sGame->funcId = funcId; + sGame->state = 0; + sGame->timer = 0; +} + +static bool32 SlideTreeBordersOut(void) +{ + u8 x = sGame->timer / 4; + sGame->timer++; + if (x != 0 && sGame->timer % 4 == 0) + { + if (x < sTreeBorderXPos[sGame->numPlayers - 1]) + { + // Update position + SetGpuReg(REG_OFFSET_BG1HOFS, (x * 8)); // BG_TREE_LEFT + SetGpuReg(REG_OFFSET_BG2HOFS, -(x * 8)); // BG_TREE_RIGHT + return FALSE; + } + else + { + // Animation finished + return TRUE; + } + } + else + { + return FALSE; + } +} + +static void InitFirstWaveOfBerries(void) +{ + u8 i; + u8 berryStart = sGame->berryColStart; + u8 berryEnd = sGame->berryColEnd; + + for (i = berryStart; i < berryEnd; i++) + { + struct DodrioGame_Berries * berries = &sGame->player.berries; + berries->fallDist[i] = (i % 2 == 0) ? 1 : 0; + berries->ids[i] = BERRY_BLUE; + } +} + +// This function checks every berry and resolves if it should be eaten or not. +// It's run in a loop that handles moving each individual berry, which means +// that every time any berry moves, every single berry is checked. +static void HandlePickBerries(void) +{ + u8 berryStart = sGame->berryColStart; + u8 berryEnd = sGame->berryColEnd; + u8 numPlayers = sGame->numPlayers; + u8 i, j, k, column; + + // Game is already over + if (sGame->numGraySquares >= NUM_STATUS_SQUARES) + return; + + for (i = 0; i < numPlayers; i++) + { + u8 *pickState = &sGame->players[i].comm.pickState; + if (*pickState != PICK_NONE && sGame->inputState[i] == INPUTSTATE_TRY_PICK) + { + // Player is attempting to pick a berry + for (j = berryStart; j < berryEnd; j++) + { + column = sActiveColumnMap[0][0][j]; + + // Attempt has already been checked + if (sGame->playersAttemptingPick[column][0] == i + || sGame->playersAttemptingPick[column][1] == i) + break; + + // Check berry pick attempt + if (TryPickBerry(i, *pickState, column) == TRUE) + { + // Attempt was successful + for (k = 0; k < ARRAY_COUNT(sGame->playersAttemptingPick[0]); k++) + { + if (sGame->playersAttemptingPick[column][k] == PLAYER_NONE) + { + sGame->playersAttemptingPick[column][k] = i; + sGame->inputState[i] = INPUTSTATE_PICKED; + sGame->berryState[column] = BERRYSTATE_PICKED; + break; + } + } + break; + } + if (sGame->players[i].comm.missedBerry == TRUE) + break; + } + } + } + + for (j = berryStart; j < berryEnd; j++) + { + u8 playerIdMissed = PLAYER_NONE; + column = sActiveColumnMap[0][0][j]; + if (sGame->berryState[column] == BERRYSTATE_PICKED) + { + s32 delayRemaining; + u8 playerIdPicked, delayStage = sGame->difficulty[GetPlayerIdAtColumn(column)] / NUM_DIFFICULTIES; + if (delayStage >= ARRAY_COUNT(sBerryFallDelays) - 1) + delayStage = ARRAY_COUNT(sBerryFallDelays) - 1; + + delayRemaining = sBerryFallDelays[delayStage][sGame->players[0].berries.ids[column]] - sGame->fallTimer[column]; + if (delayRemaining < 6) + sGame->eatTimer[column] += delayRemaining; + + if (++sGame->eatTimer[column] >= 6) + { + sGame->eatTimer[column] = 0; + + if (sGame->playersAttemptingPick[column][0] == PLAYER_NONE + && sGame->playersAttemptingPick[column][1] == PLAYER_NONE) + { + // No players attempting to pick this berry + continue; + } + else if (sGame->playersAttemptingPick[column][0] != PLAYER_NONE + && sGame->playersAttemptingPick[column][1] == PLAYER_NONE) + { + // One player attempting to pick this berry + playerIdPicked = sGame->playersAttemptingPick[column][0]; + } + else + { + // Two players attempting to pick this berry + // Randomly give it to one of them + u8 playerId1 = sGame->playersAttemptingPick[column][0]; + i = sGame->playersAttemptingPick[column][1]; // playerId2. Have to re-use the variable to match. + if (!(Random() & 1)) + { + playerIdPicked = playerId1; + playerIdMissed = i; + } + else + { + playerIdPicked = i; + playerIdMissed = playerId1; + } + } + + // Eat berry + sGame->player.berries.fallDist[column] = EAT_FALL_DIST; + sGame->berryState[column] = BERRYSTATE_EATEN; + sGame->inputState[playerIdPicked] = INPUTSTATE_ATE_BERRY; + sGame->berryEatenBy[column] = playerIdPicked; + sGame->players[playerIdPicked].comm.ateBerry = TRUE; +#ifdef UBFIX + if (playerIdMissed != PLAYER_NONE) +#endif + sGame->players[playerIdMissed].comm.missedBerry = TRUE; // UB: playerIdMissed can be PLAYER_NONE here, which is out of bounds + + sGame->berriesEaten[playerIdPicked]++; + IncrementBerryResult(0, column, playerIdPicked); + UpdateBerriesPickedInRow(TRUE); + TryIncrementDifficulty(playerIdPicked); + sGame->prevBerryIds[column] = sGame->player.berries.ids[column]; + sGame->player.berries.ids[column] = BERRY_MISSED; // Just to clear berry id, wasn't actually missed + sGame->playersAttemptingPick[column][0] = PLAYER_NONE; + sGame->playersAttemptingPick[column][1] = PLAYER_NONE; + } + } + } +} + +static bool32 TryPickBerry(u8 playerId, u8 pickState, u8 column) +{ + s32 pick = 0; + u8 numPlayersIdx = sGame->numPlayers - 1; + struct DodrioGame_Berries * berries = &sGame->player.berries; + + switch (pickState) + { + case PICK_LEFT: + default: + pick = 0; + break; + case PICK_MIDDLE: + pick = 1; + break; + case PICK_RIGHT: + pick = 2; + break; + } + + // Check if berry is within range to be picked + if (berries->fallDist[column] == EAT_FALL_DIST - 1 || berries->fallDist[column] == EAT_FALL_DIST) + { + // Check if this berry is the one the player is trying to pick + if (column == sDodrioHeadToColumnMap[numPlayersIdx][playerId][pick]) + { + // Check if berry has been picked/eaten by another player + if (sGame->berryState[column] == BERRYSTATE_PICKED || sGame->berryState[column] == BERRYSTATE_EATEN) + { + // Missed berry, picked by someone else + sGame->players[playerId].comm.missedBerry = TRUE; + return FALSE; + } + else + { + // Successfully picked berry + return TRUE; + } + } + } + else + { + // Check if this berry is the one the player is trying to pick + if (column == sDodrioHeadToColumnMap[numPlayersIdx][playerId][pick]) + { + // Missed berry, out of range + sGame->inputState[playerId] = INPUTSTATE_BAD_MISS; + sGame->players[playerId].comm.missedBerry = TRUE; + } + } + return FALSE; +} + +static void UpdateFallingBerries(void) +{ + u8 berryStart = sGame->berryColStart; + u8 berryEnd = sGame->berryColEnd; + u8 delayStage = 0; + u8 otherBerryMissed = 0; + u8 i; + + sGame->berriesFalling = FALSE; + + for (i = berryStart; i < berryEnd - 1; i++) + { + struct DodrioGame *game = sGame; + + if (sGame->berryState[i] == BERRYSTATE_NONE || sGame->berryState[i] == BERRYSTATE_PICKED) + { + sGame->berriesFalling = TRUE; + + if (game->player.berries.fallDist[i] >= MAX_FALL_DIST) + { + // Berry hit the ground + game->player.berries.fallDist[i] = MAX_FALL_DIST; + sGame->berryState[i] = BERRYSTATE_SQUISHED; + if (!sGame->playingSquishSound[i]) + { + sGame->playingSquishSound[i] = TRUE; + PlaySE(SE_BALLOON_RED + game->player.berries.ids[i]); + } + if (sGame->numGraySquares < NUM_STATUS_SQUARES || otherBerryMissed == TRUE) + { + otherBerryMissed = TRUE; + sGame->playingSquishSound[i] = FALSE; + if (sGame->numGraySquares < NUM_STATUS_SQUARES) + sGame->numGraySquares++; + + IncrementBerryResult(BERRY_MISSED, i, 0); + UpdateBerriesPickedInRow(FALSE); + } + } + else + { + // Berry is still falling + u8 delay; + delayStage = sGame->difficulty[GetPlayerIdAtColumn(i)] / NUM_DIFFICULTIES; + if (delayStage >= ARRAY_COUNT(sBerryFallDelays) - 1) + delayStage = ARRAY_COUNT(sBerryFallDelays) - 1; + + delay = sBerryFallDelays[delayStage][game->player.berries.ids[i]]; + if (++sGame->fallTimer[i] >= delay) + { + game->player.berries.fallDist[i]++; + sGame->fallTimer[i] = 0; + } + HandlePickBerries(); + } + } + else if (sGame->berryState[i] == BERRYSTATE_EATEN) + { + // Berry has been eaten, wait and create a new berry + sGame->berriesFalling = TRUE; + if (++sGame->newBerryTimer[i] >= 20) + { + sGame->players[sGame->berryEatenBy[i]].comm.ateBerry = FALSE; + sGame->newBerryTimer[i] = 0; + sGame->fallTimer[i] = 0; + sGame->berryState[i] = BERRYSTATE_NONE; + game->player.berries.fallDist[i] = 1; + game->player.berries.ids[i] = GetNewBerryId(GetPlayerIdAtColumn(i), i); + } + } + else if (sGame->berryState[i] == BERRYSTATE_SQUISHED) + { + // Berry has already hit the ground, wait and create a new berry + if (++sGame->newBerryTimer[i] >= 20) + { + if (sGame->numGraySquares < NUM_STATUS_SQUARES) + { + sGame->newBerryTimer[i] = 0; + sGame->fallTimer[i] = 0; + sGame->berryState[i] = BERRYSTATE_NONE; + game->player.berries.fallDist[i] = 1; + sGame->prevBerryIds[i] = game->player.berries.ids[i]; + game->player.berries.ids[i] = GetNewBerryId(GetPlayerIdAtColumn(i), i); + } + } + } + } +} + +static void UpdateBerrySprites(void) +{ + u8 i; + u8 berryStart = sGame->berryColStart; + u8 berryEnd = sGame->berryColEnd; + + for (i = berryStart; i < berryEnd; i++) + { + struct DodrioGame_Player *player = &sGame->players[sGame->multiplayerId]; + u8 column = sActiveColumnMap[sGame->numPlayers - 1][sGame->multiplayerId][i]; + + if (player->berries.fallDist[column] != 0) + SetBerryInvisibility(i, FALSE); + else + SetBerryInvisibility(i, TRUE); + + if (player->berries.fallDist[column] >= MAX_FALL_DIST) + { + // Berry was missed, set squished anim + SetBerryAnim(i, player->berries.ids[column] + BERRY_MISSED); + SetBerryYPos(i, player->berries.fallDist[column] * 2 - 1); + } + else if (player->berries.ids[column] == 3) + { + // Berry was picked, set eaten anim + player->berries.fallDist[column] = EAT_FALL_DIST; + SetBerryAnim(i, ANIM_EATEN); + SetBerryYPos(i, player->berries.fallDist[column] * 2 - 1); + } + else + { + // Berry is still falling + SetBerryAnim(i, player->berries.ids[column]); + SetBerryYPos(i, player->berries.fallDist[column] * 2); + } + } +} + +static void UpdateAllDodrioAnims(void) +{ + u8 i, numPlayers; + + numPlayers = sGame->numPlayers; + for (i = 0; i < numPlayers; i++) + { + struct DodrioGame_Player *player = &sGame->players[i]; + SetDodrioAnim(i, player->comm.pickState); + } +} + +static void SetAllDodrioDisabled(void) +{ + u8 i, numPlayers; + + numPlayers = sGame->numPlayers; + for (i = 0; i < numPlayers; i++) + SetDodrioAnim(i, PICK_DISABLED); +} + +static void UpdateGame_Leader(void) +{ + UpdateBerrySprites(); + if (sGame->numGraySquares >= NUM_STATUS_SQUARES) + SetAllDodrioDisabled(); + else + UpdateAllDodrioAnims(); + + UpdateStatusBarAnim(sGame->numGraySquares); +} + +// Identical to UpdateGame_Leader +static void UpdateGame_Member(void) +{ + UpdateBerrySprites(); + if (sGame->numGraySquares >= NUM_STATUS_SQUARES) + SetAllDodrioDisabled(); + else + UpdateAllDodrioAnims(); + + UpdateStatusBarAnim(sGame->numGraySquares); +} + +static void GetActiveBerryColumns(u8 numPlayers, u8 *start, u8 *end) +{ + switch (numPlayers) + { + case 1: + *start = 4, *end = 7; + break; + case 2: + *start = 3, *end = 8; + break; + case 3: + *start = 2, *end = 9; + break; + case 4: + *start = 1, *end = 10; + break; + case 5: + *start = 0, *end = 11; + break; + } +} + +static bool32 AllPlayersReadyToStart(void) +{ + u8 i, numPlayers; + + numPlayers = sGame->numPlayers; + for (i = 1; i < numPlayers; i++) + { + if (sGame->readyToStart[i] == FALSE) + sGame->readyToStart[i] = RecvPacket_ReadyToStart(i); + } + + numPlayers = numPlayers; // Needed to force compiler to keep loop below + +#ifdef BUGFIX + i = 1; // i isn't reset, loop below never runs. As a result, game can begin before all players ready +#endif + for (; i < numPlayers; i++) + { + if (sGame->readyToStart[i] == FALSE) + return FALSE; + } + + return TRUE; +} + +static void ResetReadyToStart(void) +{ + u8 i; + + for (i = 0; i < MAX_RFU_PLAYERS; i++) + sGame->readyToStart[i] = FALSE; +} + +static bool32 ReadyToEndGame_Leader(void) +{ + if (sGame->numGraySquares >= NUM_STATUS_SQUARES && !sGame->berriesFalling) + { + sGame->numGraySquares = NUM_STATUS_SQUARES; + if (sGame->allReadyToEnd) + return TRUE; + } + + return FALSE; +} + +static bool32 ReadyToEndGame_Member(void) +{ + u8 i, berryStart, berryEnd; + + if (sGame->numGraySquares >= NUM_STATUS_SQUARES) + { + berryStart = sGame->berryColStart; + berryEnd = sGame->berryColEnd; + sGame->numGraySquares = NUM_STATUS_SQUARES; + if (sGame->allReadyToEnd) + { + for (i = berryStart; i < berryEnd; i++) + { + struct DodrioGame_Player *player = &sGame->players[sGame->multiplayerId]; + u8 column = sActiveColumnMap[sGame->numPlayers - 1][sGame->multiplayerId][i]; + + if (player->berries.fallDist[column] != MAX_FALL_DIST) + return FALSE; + } + return TRUE; + } + } + + return FALSE; +} + +static void TryIncrementDifficulty(u8 playerId) +{ + u8 threshold = sDifficultyThresholds[sGame->difficulty[playerId] % NUM_DIFFICULTIES] + (sGame->difficulty[playerId] / NUM_DIFFICULTIES) * 100; + if (sGame->berriesEaten[playerId] >= threshold) + sGame->difficulty[playerId]++; +} + +static u8 GetPlayerIdAtColumn(u8 column) +{ + return sPlayerIdAtColumn[sGame->numPlayers - 1][column]; +} + +// Get a berry id for when a new falling berry is created. +// What type of berry it is depends on the current difficulty +// level of players who can pick berries from that column. +static u8 GetNewBerryId(u8 playerId, u8 column) +{ + u8 i, highestDifficulty; + u8 numPlayersIdx = sGame->numPlayers - 1; + u8 leftPlayer = sDodrioNeighborMap[numPlayersIdx][playerId][0]; + u8 middlePlayer = sDodrioNeighborMap[numPlayersIdx][playerId][1]; + u8 rightPlayer = sDodrioNeighborMap[numPlayersIdx][playerId][2]; + + for (i = 0; sUnsharedColumns[numPlayersIdx][i] != 0; i++) + { + // If only one player can use this column, just use their difficulty + if (column == sUnsharedColumns[numPlayersIdx][i]) + return GetNewBerryIdByDifficulty(sGame->difficulty[middlePlayer], column); + } + + // This column is shared, get the highest difficulty of adjacent players + if (sGame->difficulty[leftPlayer] > sGame->difficulty[middlePlayer]) + highestDifficulty = sGame->difficulty[leftPlayer]; + else + highestDifficulty = sGame->difficulty[middlePlayer]; + + if (sGame->difficulty[rightPlayer] > highestDifficulty) + highestDifficulty = sGame->difficulty[rightPlayer]; + + return GetNewBerryIdByDifficulty(highestDifficulty, column); +} + +// The berry types cycle through different distributions depending on the difficulty +static u8 GetNewBerryIdByDifficulty(u8 difficulty, u8 column) +{ + u8 prevBerryId = sGame->prevBerryIds[column]; + switch (difficulty % NUM_DIFFICULTIES) + { + default: return BERRY_BLUE; + case 0: return BERRY_BLUE; + case 1: return BERRY_GREEN; + case 2: return BERRY_GOLD; + case 3: + if (prevBerryId == BERRY_BLUE) + return BERRY_GREEN; + else + return BERRY_BLUE; + case 4: + if (prevBerryId == BERRY_BLUE) + return BERRY_GOLD; + else + return BERRY_BLUE; + case 5: + if (prevBerryId == BERRY_GOLD) + return BERRY_GREEN; + else + return BERRY_GOLD; + case 6: + if (prevBerryId == BERRY_BLUE) + return BERRY_GREEN; + else if (prevBerryId == BERRY_GREEN) + return BERRY_GOLD; + else + return BERRY_BLUE; + } +} + +static bool32 IsTotalBerriesMissedOver10(u16 berryResults[MAX_RFU_PLAYERS][NUM_BERRY_IDS]) +{ + int missed = 0, i = 0; + for (; i < GetLinkPlayerCount(); missed += berryResults[i][BERRY_MISSED], i++) + ; + + if (missed > 10) + return TRUE; + else + return FALSE; +} + +// Despite being set up to take a berry id as an argument, this +// function is only ever given BERRY_BLUE or BERRY_MISSED. +// It reads the actual berry id (if necessary) from ids +static void IncrementBerryResult(u8 berryIdArg, u8 column, u8 playerId) +{ + u8 berryId; + u8 numPlayers = sGame->numPlayers; + switch (berryIdArg) + { + case BERRY_BLUE: + case BERRY_GREEN: + case BERRY_GOLD: + berryId = sGame->players[0].berries.ids[column]; + sGame->berryResults[playerId][berryId] = IncrementWithLimit(sGame->berryResults[playerId][berryId], 20000); + break; + case BERRY_MISSED: + if (IsTotalBerriesMissedOver10(sGame->berryResults)) + break; + switch (numPlayers) + { + case 5: + switch (column) + { + case 0: + sGame->berryResults[2][BERRY_MISSED]++; + sGame->berryResults[3][BERRY_MISSED]++; + break; + case 1: + sGame->berryResults[3][BERRY_MISSED]++; + break; + case 2: + sGame->berryResults[3][BERRY_MISSED]++; + sGame->berryResults[4][BERRY_MISSED]++; + break; + case 3: + sGame->berryResults[4][BERRY_MISSED]++; + break; + case 4: + sGame->berryResults[4][BERRY_MISSED]++; + sGame->berryResults[0][BERRY_MISSED]++; + break; + case 5: + sGame->berryResults[0][BERRY_MISSED]++; + break; + case 6: + sGame->berryResults[0][BERRY_MISSED]++; + sGame->berryResults[1][BERRY_MISSED]++; + break; + case 7: + sGame->berryResults[1][BERRY_MISSED]++; + break; + case 8: + sGame->berryResults[1][BERRY_MISSED]++; + sGame->berryResults[2][BERRY_MISSED]++; + break; + case 9: + sGame->berryResults[2][BERRY_MISSED]++; + break; + } + break; + case 4: + switch (column) + { + case 1: + sGame->berryResults[2][BERRY_MISSED]++; + sGame->berryResults[3][BERRY_MISSED]++; + break; + case 2: + sGame->berryResults[3][BERRY_MISSED]++; + break; + case 3: + sGame->berryResults[3][BERRY_MISSED]++; + sGame->berryResults[0][BERRY_MISSED]++; + break; + case 4: + sGame->berryResults[0][BERRY_MISSED]++; + break; + case 5: + sGame->berryResults[0][BERRY_MISSED]++; + sGame->berryResults[1][BERRY_MISSED]++; + break; + case 6: + sGame->berryResults[1][BERRY_MISSED]++; + break; + case 7: + sGame->berryResults[1][BERRY_MISSED]++; + sGame->berryResults[2][BERRY_MISSED]++; + break; + case 8: + sGame->berryResults[2][BERRY_MISSED]++; + break; + } + break; + case 3: + switch (column) + { + case 2: + sGame->berryResults[1][BERRY_MISSED]++; + sGame->berryResults[2][BERRY_MISSED]++; + break; + case 3: + sGame->berryResults[2][BERRY_MISSED]++; + break; + case 4: + sGame->berryResults[2][BERRY_MISSED]++; + sGame->berryResults[0][BERRY_MISSED]++; + break; + case 5: + sGame->berryResults[0][BERRY_MISSED]++; + break; + case 6: + sGame->berryResults[0][BERRY_MISSED]++; + sGame->berryResults[1][BERRY_MISSED]++; + break; + case 7: + sGame->berryResults[1][BERRY_MISSED]++; + break; + } + break; + case 2: + switch (column) + { + case 3: + sGame->berryResults[0][BERRY_MISSED]++; + sGame->berryResults[1][BERRY_MISSED]++; + break; + case 4: + sGame->berryResults[0][BERRY_MISSED]++; + break; + case 5: + sGame->berryResults[0][BERRY_MISSED]++; + sGame->berryResults[1][BERRY_MISSED]++; + break; + case 6: + sGame->berryResults[1][BERRY_MISSED]++; + break; + } + break; + } + break; + } +} + +static void UpdateBerriesPickedInRow(bool32 picked) +{ + // The 'berries picked in row' stat is only + // counted for games with all 5 players + if (sGame->numPlayers != MAX_RFU_PLAYERS) + return; + + if (picked == TRUE) + { + if (++sGame->berriesPickedInRow > sGame->maxBerriesPickedInRow) + sGame->maxBerriesPickedInRow = sGame->berriesPickedInRow; + if (sGame->berriesPickedInRow > MAX_BERRIES) + sGame->berriesPickedInRow = MAX_BERRIES; + } + else // missed + { + if (sGame->berriesPickedInRow > sGame->maxBerriesPickedInRow) + sGame->maxBerriesPickedInRow = sGame->berriesPickedInRow; + sGame->berriesPickedInRow = 0; + } +} + +static void SetMaxBerriesPickedInRow(void) +{ + u8 i; + for (i = 0; i < sGame->numPlayers; i++) + sGame->berryResults[i][BERRY_IN_ROW] = sGame->maxBerriesPickedInRow; +} + +static void ResetForPlayAgainPrompt(void) +{ + u8 i, j; + + for (i = 0; i < MAX_RFU_PLAYERS; i++) + { + for (j = 0; j < NUM_BERRY_COLUMNS; j++) + sGame->players[i].berries.fallDist[j] = 0; + sGame->players[i].comm.pickState = PICK_NONE; + sGame->players[i].comm.ateBerry = FALSE; + sGame->difficulty[i] = 0; + sGame->berriesEaten[i] = 0; + sGame->scoreResults[i].ranking = 0; + sGame->scoreResults[i].score = 0; + sGame->berryResults[i][BERRY_BLUE] = 0; + sGame->berryResults[i][BERRY_GREEN] = 0; + sGame->berryResults[i][BERRY_GOLD] = 0; + sGame->berryResults[i][BERRY_MISSED] = 0; + sGame->berryResults[i][BERRY_PRIZE] = 0; + sGame->berryResults[i][BERRY_IN_ROW] = 0; + } + sGame->endSoundState = 0; + sGame->berriesPickedInRow = 0; + sGame->numGraySquares = 0; + UpdateAllDodrioAnims(); + UpdateBerrySprites(); +} + +static const s16 sBerryScoreMultipliers[] = { + [BERRY_BLUE] = 10, + [BERRY_GREEN] = 30, + [BERRY_GOLD] = 50, + [BERRY_MISSED] = 50 // Subtracted +}; + +static void SetRandomPrize(void) +{ + u8 i, prizeSet = 0, prizeIdx = 0; + + switch (sGame->numPlayers) + { + case 4: prizeSet = 1; break; + case 5: prizeSet = 2; break; + } + + prizeIdx = Random() % ARRAY_COUNT(sPrizeBerryIds[0]); + for (i = 0; i < MAX_RFU_PLAYERS; i++) + sGame->berryResults[i][BERRY_PRIZE] = sPrizeBerryIds[prizeSet][prizeIdx]; +} + +static u32 GetBerriesPicked(u8 playerId) +{ + u32 sum = sGame->berryResults[playerId][BERRY_BLUE] + + sGame->berryResults[playerId][BERRY_GREEN] + + sGame->berryResults[playerId][BERRY_GOLD]; + return min(sum, MAX_BERRIES); +} + +static void TryUpdateRecords(void) +{ + u32 berriesPicked = Min(GetBerriesPicked(sGame->multiplayerId), MAX_BERRIES); // Min here is redundant + u32 score = Min(GetScore(sGame->multiplayerId), MAX_SCORE); + + if (gSaveBlock2Ptr->berryPick.bestScore < score) + gSaveBlock2Ptr->berryPick.bestScore = score; + if (gSaveBlock2Ptr->berryPick.berriesPicked < berriesPicked) + gSaveBlock2Ptr->berryPick.berriesPicked = berriesPicked; + if (gSaveBlock2Ptr->berryPick.berriesPickedInRow < sGame->maxBerriesPickedInRow) + gSaveBlock2Ptr->berryPick.berriesPickedInRow = sGame->maxBerriesPickedInRow; +} + +// Enqueue the given state, and dequeue and return +// the state that should be used next +static u8 UpdatePickStateQueue(u8 pickState) +{ + u8 i, nextState; + + nextState = sGame->pickStateQueue[ARRAY_COUNT(sGame->pickStateQueue) - 1]; + for (i = ARRAY_COUNT(sGame->pickStateQueue) - 1; i != 0; i--) + sGame->pickStateQueue[i] = sGame->pickStateQueue[i - 1]; + sGame->pickStateQueue[0] = pickState; + return nextState; +} + +// The player may extend their Dodrio's heads while they wait for +// other players to respond to the "Play again?" prompt +static void HandleWaitPlayAgainInput(void) +{ + if (sGame->inputDelay[sGame->multiplayerId] == 0) + { + if (JOY_NEW(DPAD_UP)) + { + sGame->players[sGame->multiplayerId].comm.pickState = PICK_MIDDLE; + sGame->inputDelay[sGame->multiplayerId] = 6; + PlaySE(SE_M_CHARM); + } + else if (JOY_NEW(DPAD_LEFT)) + { + sGame->players[sGame->multiplayerId].comm.pickState = PICK_LEFT; + sGame->inputDelay[sGame->multiplayerId] = 6; + PlaySE(SE_M_CHARM); + } + else if (JOY_NEW(DPAD_RIGHT)) + { + sGame->players[sGame->multiplayerId].comm.pickState = PICK_RIGHT; + sGame->inputDelay[sGame->multiplayerId] = 6; + PlaySE(SE_M_CHARM); + } + else + { + sGame->players[sGame->multiplayerId].comm.pickState = PICK_NONE; + } + } + else + { + sGame->inputDelay[sGame->multiplayerId]--; + } +} + +static void ResetPickState(void) +{ + sGame->players[sGame->multiplayerId].comm.pickState = PICK_NONE; +} + +static u16 GetPrizeItemId(void) +{ + return sGame->berryResults[sGame->multiplayerId][BERRY_PRIZE] + FIRST_BERRY_INDEX; +} + +static u8 GetNumPlayers(void) +{ + return sGame->numPlayers; +} + +static u8 *GetPlayerName(u8 id) +{ + if (gReceivedRemoteLinkPlayers) + return gLinkPlayers[id].name; + else + return sGame->players[id].name; +} + +static u16 GetBerryResult(u8 playerId, u8 berryId) +{ + return sGame->berryResults[playerId][berryId]; +} + +static u32 GetScore(u8 playerId) +{ + u8 i; + u32 scoreLost, score = 0; + + // Sum up points for berries picked + for (i = 0; i < BERRY_MISSED; i++) + score += sGame->berryResults[playerId][i] * sBerryScoreMultipliers[i]; + + // Get points lost for berries missed + scoreLost = sGame->berryResults[playerId][BERRY_MISSED] * sBerryScoreMultipliers[BERRY_MISSED]; + + if (score <= scoreLost) + return 0; + else + return score - scoreLost; +} + +static u32 GetHighestScore(void) +{ + u8 i, numPlayers = sGame->numPlayers; + u32 maxScore = GetScore(0); + + for (i = 1; i < numPlayers; i++) + { + u32 score = GetScore(i); + if (score > maxScore) + maxScore = score; + } + return Min(maxScore, MAX_SCORE); +} + +static u32 GetHighestBerryResult(u8 berryId) +{ + u8 i, numPlayers = sGame->numPlayers; + u16 maxScore = sGame->berryResults[0][berryId]; + + for (i = 0; i < numPlayers; i++) + { + u16 score = sGame->berryResults[i][berryId]; + if (score > maxScore) + maxScore = score; + } + return maxScore; +} + +static u32 GetScoreByRanking(u8 ranking) +{ + u32 scores[MAX_RFU_PLAYERS], temp; + s16 unsorted = TRUE; + u8 i; + u8 numPlayers = sGame->numPlayers; + + for (i = 0; i < numPlayers; i++) + scores[i] = temp = GetScore(i); + + // Sort the scores in the array highest to lowest + while (unsorted) + { + unsorted = FALSE; + for (i = 0; i < numPlayers - 1; i++) + { + if (scores[i] < scores[i + 1]) + { + SWAP(scores[i], scores[i + 1], temp); + unsorted = TRUE; + } + } + } + + return scores[ranking]; +} + +static u32 SetScoreResults(void) +{ + u8 i, ranking = 0, nextRanking = 0, playersRanked = 0; + u8 numPlayers = sGame->numPlayers; + + GetHighestScore(); // Useless call + + if (GetHighestScore() == 0) + { + // No one scored any points, put everyone in last place with a score of 0. + // Presumably this was supposed to then return, as the assignments in this + // loop are then overwritten by the rest of the function + for (i = 0; i < numPlayers; i++) + { + sGame->scoreResults[i].ranking = MAX_RFU_PLAYERS - 1; + sGame->scoreResults[i].score = 0; + } + } + + // Set scores + for (i = 0; i < numPlayers; i++) + sGame->scoreResults[i].score = Min(GetScore(i), MAX_SCORE); + + // Set rankings + do + { + u32 score = GetScoreByRanking(ranking); + u8 curRanking = nextRanking; + + // Find all players with the score for this ranking. + // Increment nextRanking but not curRanking to allow + // for ties + for (i = 0; i < numPlayers; i++) + { + if (score == sGame->scoreResults[i].score) + { + sGame->scoreResults[i].ranking = curRanking; + nextRanking++; + playersRanked++; + } + } + ranking = nextRanking; + } while (playersRanked < numPlayers); + + return 0; +} + +static void GetScoreResults(struct DodrioGame_ScoreResults *dst, u8 playerId) +{ + *dst = sGame->scoreResults[playerId]; +} + +// Unused +// Returns where the specified player's score ranks, 0 being first (highest score) +static u8 GetScoreRanking(u8 playerId) +{ + u8 i, ranking = 0; + u8 numPlayers = sGame->numPlayers; + u32 playersScore; + u32 scores[MAX_RFU_PLAYERS] = {0}; + + for (i = 0; i < numPlayers; i++) + scores[i] = GetScore(i); + + playersScore = scores[playerId]; + for (i = 0; i < MAX_RFU_PLAYERS; i++) + { + if (i != playerId && playersScore < scores[i]) + ranking++; + } + + return ranking; +} + +enum { + PRIZE_RECEIVED, + PRIZE_FILLED_BAG, + PRIZE_NO_ROOM, + NO_PRIZE, +}; + +static u8 TryGivePrize(void) +{ + u8 multiplayerId = sGame->multiplayerId; + u16 itemId = GetPrizeItemId(); + + if (GetScore(multiplayerId) != GetHighestScore()) + return NO_PRIZE; + if (!CheckBagHasSpace(itemId, 1)) + return PRIZE_NO_ROOM; + + AddBagItem(itemId, 1); + if (!CheckBagHasSpace(itemId, 1)) + return PRIZE_FILLED_BAG; + return PRIZE_RECEIVED; +} + +static u32 IncrementWithLimit(u32 a, u32 max) +{ + if (a < max) + return a + 1; + else + return max; +} + +static u32 Min(u32 a, u32 b) +{ + if (a < b) + return a; + else + return b; +} + +static u8 GetPlayerIdByPos(u8 id) +{ + return sGame->posToPlayerId[id]; +} + +void IsDodrioInParty(void) +{ + int i; + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_HAS_SPECIES) + && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) == SPECIES_DODRIO) + { + gSpecialVar_Result = TRUE; + return; + } + } + + gSpecialVar_Result = FALSE; +} + +#define NUM_RECORD_TYPES 3 + +void ShowDodrioBerryPickingRecords(void) +{ + u8 taskId = CreateTask(Task_ShowDodrioBerryPickingRecords, 0); + Task_ShowDodrioBerryPickingRecords(taskId); +} + +static const struct WindowTemplate sWindowTemplates_Records = +{ + .bg = 0, + .tilemapLeft = 5, + .tilemapTop = 1, + .width = 20, + .height = 11, + .paletteNum = 15, + .baseBlock = 0x1, +}; + +static const u8 *const sRecordsTexts[NUM_RECORD_TYPES] = {gText_BerriesPicked, gText_BestScore, gText_BerriesInRowFivePlayers}; +static const u8 sRecordNumMaxDigits[NUM_RECORD_TYPES] = {4, 7, 4}; +ALIGNED(4) +static const u8 sRecordTextYCoords[NUM_RECORD_TYPES][2] = {{25}, {41}, {57}}; +static const u8 sRecordNumYCoords[NUM_RECORD_TYPES][2] = {{25}, {41}, {73}}; + +#define tState data[0] +#define tWindowId data[1] + +static void Task_ShowDodrioBerryPickingRecords(u8 taskId) +{ + struct WindowTemplate window; + s32 i, width, widthCurr; + s16 *data = gTasks[taskId].data; + + switch (tState) + { + case 0: + window = sWindowTemplates_Records; + width = GetStringWidth(1, gText_BerryPickingRecords, 0); + for (i = 0; i < ARRAY_COUNT(sRecordsTexts); i++) + { + widthCurr = GetStringWidth(1, sRecordsTexts[i], 0) + 50; + if (widthCurr > width) + width = widthCurr; + } + width = (width + 7) / 8; + if (width & 1) + width++; + window.tilemapLeft = (30 - width) / 2; + window.width = width; + tWindowId = AddWindow(&window); + PrintRecordsText(tWindowId, width); + CopyWindowToVram(tWindowId, 3); + tState++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + tState++; + break; + case 2: + if (JOY_NEW(A_BUTTON | B_BUTTON)) + { + rbox_fill_rectangle(tWindowId); + CopyWindowToVram(tWindowId, 1); + tState++; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + { + RemoveWindow(tWindowId); + DestroyTask(taskId); + EnableBothScriptContexts(); + } + break; + } +} + +#undef tState +#undef tWindowId + +static void PrintRecordsText(u8 windowId, s32 width) +{ + s32 i, x, numWidth; + s32 recordNums[NUM_RECORD_TYPES]; + recordNums[0] = gSaveBlock2Ptr->berryPick.berriesPicked; + recordNums[1] = gSaveBlock2Ptr->berryPick.bestScore; + recordNums[2] = gSaveBlock2Ptr->berryPick.berriesPickedInRow; + + LoadUserWindowBorderGfx_(windowId, 0x21D, 0xD0); + DrawTextBorderOuter(windowId, 0x21D, 0xD); + FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); + AddTextPrinterParameterized(windowId, 1, gText_BerryPickingRecords, GetStringCenterAlignXOffset(1, gText_BerryPickingRecords, width * 8), 1, TEXT_SPEED_FF, NULL); + for (i = 0; i < NUM_RECORD_TYPES; i++) + { + ConvertIntToDecimalStringN(gStringVar1, recordNums[i], STR_CONV_MODE_LEFT_ALIGN, sRecordNumMaxDigits[i]); + numWidth = GetStringWidth(1, gStringVar1, -1); + AddTextPrinterParameterized(windowId, 1, sRecordsTexts[i], 0, sRecordTextYCoords[i][0], TEXT_SPEED_FF, NULL); + x = (width * 8) - numWidth; + AddTextPrinterParameterized(windowId, 1, gStringVar1, x, sRecordNumYCoords[i][0], TEXT_SPEED_FF, NULL); + } + PutWindowTilemap(windowId); +} + +// Debug functions? +static const u16 sDebug_BerryResults[MAX_RFU_PLAYERS][4] = +{ + { + [BERRY_BLUE] = MAX_BERRIES, + [BERRY_GREEN] = 0, + [BERRY_GOLD] = 90, + [BERRY_MISSED] = MAX_BERRIES + }, + { + [BERRY_BLUE] = MAX_BERRIES, + [BERRY_GREEN] = MAX_BERRIES, + [BERRY_GOLD] = 70, + [BERRY_MISSED] = MAX_BERRIES + }, + { + [BERRY_BLUE] = MAX_BERRIES, + [BERRY_GREEN] = 0, + [BERRY_GOLD] = MAX_BERRIES, + [BERRY_MISSED] = 0 + }, + { + [BERRY_BLUE] = MAX_BERRIES, + [BERRY_GREEN] = MAX_BERRIES, + [BERRY_GOLD] = 60, + [BERRY_MISSED] = 0 + }, + { + [BERRY_BLUE] = MAX_BERRIES, + [BERRY_GREEN] = MAX_BERRIES, + [BERRY_GOLD] = MAX_BERRIES, + [BERRY_MISSED] = 0 + }, +}; + +static const u8 sJPText_Vowels[] = _("あいうえおかき"); +static const u8 sText_ABCDEFG[] = _("ABCDEFG"); +static const u8 sText_0123456[] = _("0123456"); + +static const u8 *const sDebug_PlayerNames[] = +{ + sJPText_Vowels, + sJPText_Vowels, + sJPText_Vowels, + sText_ABCDEFG, + sText_0123456 +}; + +static void Debug_UpdateNumPlayers(void) +{ + sGame->numPlayers = GetLinkPlayerCount(); +} + +static void Debug_SetPlayerNamesAndResults(void) +{ + u8 i, playerId; + + for (playerId = sGame->numPlayers; playerId < ARRAY_COUNT(sDebug_PlayerNames); playerId++) + StringCopy(gLinkPlayers[playerId].name, sDebug_PlayerNames[playerId]); + + sGame->numPlayers = MAX_RFU_PLAYERS; + for (i = 0; i < NUM_BERRY_TYPES; i++) + { + for (playerId = 0; playerId < sGame->numPlayers; playerId++) + sGame->berryResults[playerId][i] = sDebug_BerryResults[playerId][i]; + } +} + +struct ReadyToStartPacket +{ + u8 id; + bool8 ALIGNED(4) ready; +}; + +static void SendPacket_ReadyToStart(bool32 ready) +{ + struct ReadyToStartPacket packet; + packet.id = PACKET_READY_START; + packet.ready = ready; + Rfu_SendPacket(&packet); +} + +static u32 RecvPacket_ReadyToStart(u32 playerId) +{ + struct ReadyToStartPacket *packet; + + if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET) + return FALSE; + + packet = (void *)&gRecvCmds[playerId][1]; + if (packet->id == PACKET_READY_START) + return packet->ready; + + return FALSE; +} + +struct GameStatePacket +{ + u8 id; + u8 fallDist_Col0:4; + u8 fallDist_Col1:4; + u16 fallDist_Col2:4; + u16 fallDist_Col3:4; + u16 fallDist_Col4:4; + u16 fallDist_Col5:4; + u16 fallDist_Col6:4; + u16 fallDist_Col7:4; + u16 fallDist_Col8:4; + u16 fallDist_Col9:4; + u16 berryId_Col0:2; + u16 berryId_Col1:2; + u16 berryId_Col2:2; + u16 berryId_Col3:2; + u16 berryId_Col4:2; + u16 berryId_Col5:2; + u16 berryId_Col6:2; + u16 berryId_Col7:2; + u8 berryId_Col8:2; + u8 berryId_Col9:2; + u8 pickState_Player1:2; + u8 pickState_Player2:2; + u8 pickState_Player3:2; + u8 pickState_Player4:2; + u8 pickState_Player5:2; + bool8 ateBerry_Player1:1; + bool8 ateBerry_Player2:1; + bool8 ateBerry_Player3:1; + bool8 ateBerry_Player4:1; + bool8 ateBerry_Player5:1; + u8 numGraySquares:5; + bool8 allReadyToEnd:1; + bool8 berriesFalling:1; + bool8 missedBerry_Player1:1; + bool8 missedBerry_Player2:1; + bool8 missedBerry_Player3:1; + bool8 missedBerry_Player4:1; + bool8 missedBerry_Player5:1; +}; + +static void SendPacket_GameState(struct DodrioGame_Player *player, + struct DodrioGame_PlayerCommData *player1, + struct DodrioGame_PlayerCommData *player2, + struct DodrioGame_PlayerCommData *player3, + struct DodrioGame_PlayerCommData *player4, + struct DodrioGame_PlayerCommData *player5, + u8 numGraySquares, + bool32 berriesFalling, + bool32 allReadyToEnd) +{ + struct GameStatePacket packet; + struct DodrioGame_Berries *berries = &player->berries; + + packet.id = PACKET_GAME_STATE; + packet.fallDist_Col0 = berries->fallDist[0]; + packet.fallDist_Col1 = berries->fallDist[1]; + packet.fallDist_Col2 = berries->fallDist[2]; + packet.fallDist_Col3 = berries->fallDist[3]; + packet.fallDist_Col4 = berries->fallDist[4]; + packet.fallDist_Col5 = berries->fallDist[5]; + packet.fallDist_Col6 = berries->fallDist[6]; + packet.fallDist_Col7 = berries->fallDist[7]; + packet.fallDist_Col8 = berries->fallDist[8]; + packet.fallDist_Col9 = berries->fallDist[9]; + + packet.berryId_Col0 = berries->ids[0]; + packet.berryId_Col1 = berries->ids[1]; + packet.berryId_Col2 = berries->ids[2]; + packet.berryId_Col3 = berries->ids[3]; + packet.berryId_Col4 = berries->ids[4]; + packet.berryId_Col5 = berries->ids[5]; + packet.berryId_Col6 = berries->ids[6]; + packet.berryId_Col7 = berries->ids[7]; + packet.berryId_Col8 = berries->ids[8]; + packet.berryId_Col9 = berries->ids[9]; + + packet.pickState_Player1 = player1->pickState; + packet.pickState_Player2 = player2->pickState; + packet.pickState_Player3 = player3->pickState; + packet.pickState_Player4 = player4->pickState; + packet.pickState_Player5 = player5->pickState; + + packet.ateBerry_Player1 = player1->ateBerry; + packet.ateBerry_Player2 = player2->ateBerry; + packet.ateBerry_Player3 = player3->ateBerry; + packet.ateBerry_Player4 = player4->ateBerry; + packet.ateBerry_Player5 = player5->ateBerry; + + packet.missedBerry_Player1 = player1->missedBerry; + packet.missedBerry_Player2 = player2->missedBerry; + packet.missedBerry_Player3 = player3->missedBerry; + packet.missedBerry_Player4 = player4->missedBerry; + packet.missedBerry_Player5 = player5->missedBerry; + + packet.numGraySquares = numGraySquares; + packet.berriesFalling = berriesFalling; + packet.allReadyToEnd = allReadyToEnd; + Rfu_SendPacket(&packet); +} + +static bool32 RecvPacket_GameState(u32 playerId, + struct DodrioGame_Player *player, + struct DodrioGame_PlayerCommData *player1, + struct DodrioGame_PlayerCommData *player2, + struct DodrioGame_PlayerCommData *player3, + struct DodrioGame_PlayerCommData *player4, + struct DodrioGame_PlayerCommData *player5, + u8 *numGraySquares, + bool32 *berriesFalling, + bool32 *allReadyToEnd) +{ + struct GameStatePacket *packet; + struct DodrioGame_Berries *berries = &player->berries; + + if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET) + return FALSE; + + packet = (void *)&gRecvCmds[0][1]; + if (packet->id == PACKET_GAME_STATE) + { + berries->fallDist[0] = packet->fallDist_Col0; + berries->fallDist[1] = packet->fallDist_Col1; + berries->fallDist[2] = packet->fallDist_Col2; + berries->fallDist[3] = packet->fallDist_Col3; + berries->fallDist[4] = packet->fallDist_Col4; + berries->fallDist[5] = packet->fallDist_Col5; + berries->fallDist[6] = packet->fallDist_Col6; + berries->fallDist[7] = packet->fallDist_Col7; + berries->fallDist[8] = packet->fallDist_Col8; + berries->fallDist[9] = packet->fallDist_Col9; + berries->fallDist[10] = packet->fallDist_Col0; + + berries->ids[0] = packet->berryId_Col0; + berries->ids[1] = packet->berryId_Col1; + berries->ids[2] = packet->berryId_Col2; + berries->ids[3] = packet->berryId_Col3; + berries->ids[4] = packet->berryId_Col4; + berries->ids[5] = packet->berryId_Col5; + berries->ids[6] = packet->berryId_Col6; + berries->ids[7] = packet->berryId_Col7; + berries->ids[8] = packet->berryId_Col8; + berries->ids[9] = packet->berryId_Col9; + berries->ids[10] = packet->berryId_Col0; + + player1->pickState = packet->pickState_Player1; + player1->ateBerry = packet->ateBerry_Player1; + player1->missedBerry = packet->missedBerry_Player1; + + player2->pickState = packet->pickState_Player2; + player2->ateBerry = packet->ateBerry_Player2; + player2->missedBerry = packet->missedBerry_Player2; + + player3->pickState = packet->pickState_Player3; + player3->ateBerry = packet->ateBerry_Player3; + player3->missedBerry = packet->missedBerry_Player3; + + player4->pickState = packet->pickState_Player4; + player4->ateBerry = packet->ateBerry_Player4; + player4->missedBerry = packet->missedBerry_Player4; + + player5->pickState = packet->pickState_Player5; + player5->ateBerry = packet->ateBerry_Player5; + player5->missedBerry = packet->missedBerry_Player5; + + *numGraySquares = packet->numGraySquares; + *berriesFalling = packet->berriesFalling; + *allReadyToEnd = packet->allReadyToEnd; + return TRUE; + } + + return FALSE; +} + +struct PickStatePacket +{ + u8 id; + u8 ALIGNED(4) pickState; +}; + +static void SendPacket_PickState(u8 pickState) +{ + struct PickStatePacket packet; + packet.id = PACKET_PICK_STATE; + packet.pickState = pickState; + Rfu_SendPacket(&packet); +} + +static bool32 RecvPacket_PickState(u32 playerId, u8 *pickState) +{ + struct PickStatePacket *packet; + + if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET) + return FALSE; + + packet = (void *)&gRecvCmds[playerId][1]; + if (packet->id == PACKET_PICK_STATE) + { + *pickState = packet->pickState; + return TRUE; + } + + return FALSE; +} + +struct ReadyToEndPacket +{ + u8 id; + bool32 ready; +}; + +static void SendPacket_ReadyToEnd(bool32 ready) +{ + struct ReadyToEndPacket packet; + packet.id = PACKET_READY_END; + packet.ready = ready; + Rfu_SendPacket(&packet); +} + +static bool32 RecvPacket_ReadyToEnd(u32 playerId) +{ + struct ReadyToEndPacket *packet; + + if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET) + return FALSE; + + packet = (void *)&gRecvCmds[playerId][1]; + if (packet->id == PACKET_READY_END) + return packet->ready; + + return FALSE; +} + +static const struct BgTemplate sBgTemplates[] = +{ + { + .bg = BG_INTERFACE, + .charBaseIndex = 0, + .mapBaseIndex = 30, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = BG_TREE_LEFT, + .charBaseIndex = 2, + .mapBaseIndex = 12, + .screenSize = 1, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = BG_TREE_RIGHT, + .charBaseIndex = 2, + .mapBaseIndex = 14, + .screenSize = 1, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = BG_SCENERY, + .charBaseIndex = 3, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, +}; + +static const struct WindowTemplate sWindowTemplate_Dummy = DUMMY_WIN_TEMPLATE; + +static const struct WindowTemplate sWindowTemplates_Results[] = +{ + { + .bg = BG_INTERFACE, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 28, + .height = 2, + .paletteNum = 13, + .baseBlock = 0x13, + }, + { + .bg = BG_INTERFACE, + .tilemapLeft = 1, + .tilemapTop = 5, + .width = 28, + .height = 14, + .paletteNum = 13, + .baseBlock = 0x4B, + } +}; + +static const struct WindowTemplate sWindowTemplate_Prize = +{ + .bg = BG_INTERFACE, + .tilemapLeft = 1, + .tilemapTop = 5, + .width = 28, + .height = 7, + .paletteNum = 13, + .baseBlock = 0x4B, +}; + +enum { + WIN_PLAY_AGAIN, + WIN_YES_NO, +}; + +static const struct WindowTemplate sWindowTemplates_PlayAgain[] = +{ + [WIN_PLAY_AGAIN] = { + .bg = BG_INTERFACE, + .tilemapLeft = 1, + .tilemapTop = 8, + .width = 19, + .height = 3, + .paletteNum = 13, + .baseBlock = 0x13, + }, + [WIN_YES_NO] = { + .bg = BG_INTERFACE, + .tilemapLeft = 22, + .tilemapTop = 7, + .width = 6, + .height = 4, + .paletteNum = 13, + .baseBlock = 0x4C, + } +}; + +static const struct WindowTemplate sWindowTemplate_DroppedOut = +{ + .bg = BG_INTERFACE, + .tilemapLeft = 4, + .tilemapTop = 6, + .width = 22, + .height = 5, + .paletteNum = 13, + .baseBlock = 0x13, +}; + +static const struct WindowTemplate sWindowTemplate_CommStandby = +{ + .bg = BG_INTERFACE, + .tilemapLeft = 5, + .tilemapTop = 8, + .width = 19, + .height = 3, + .paletteNum = 13, + .baseBlock = 0x13, +}; + +// Unused duplicate of sActiveColumnMap +static const u8 sActiveColumnMap_Duplicate[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS][NUM_BERRY_COLUMNS] = { { {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, @@ -297,9 +3503,10 @@ static const u8 gUnknown_082F449C[5][5][11] = {6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6}, {8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8}, }, -}; +}; -static const u8 gUknnown_082F45AF[5][5][3] = +// Unused duplicate of sDodrioHeadToColumnMap +static const u8 sDodrioHeadToColumnMap_Duplicate[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS][3] = { { {4, 5, 6}, @@ -328,7 +3535,8 @@ static const u8 gUknnown_082F45AF[5][5][3] = }, }; -static const u8 gUnknown_082F45FA[5][5][3] = +// Unused duplicate of sDodrioNeighborMap +static const u8 sDodrioNeighborMap_Duplicate[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS][3] = { { {1, 0, 1}, @@ -357,8 +3565,9 @@ static const u8 gUnknown_082F45FA[5][5][3] = }, }; +// Unused duplicate of sPlayerIdAtColumn ALIGNED(4) -static const u8 gUnknown_082F4648[5][11] = +static const u8 sPlayerIdAtColumn_Duplicate[MAX_RFU_PLAYERS][NUM_BERRY_COLUMNS] = { {9, 9, 9, 9, 1, 1, 1, 9, 9, 9, 9}, {9, 9, 9, 0, 0, 1, 1, 0, 9, 9, 9}, @@ -367,7 +3576,8 @@ static const u8 gUnknown_082F4648[5][11] = {3, 3, 4, 4, 0, 0, 1, 1, 2, 2, 3}, }; -static const u8 gUnknown_082F467F[5][5] = +// Unused duplicate of sUnsharedColumns +static const u8 sUnsharedColumns_Duplicate[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS] = { {5}, {4, 6}, @@ -376,2765 +3586,24 @@ static const u8 gUnknown_082F467F[5][5] = {1, 3, 5, 6, 9}, }; -// Duplicate and unused gfx. Feel free to remove. -static const u32 sDuplicateGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.gbapal", - "graphics/link_games/dodrioberry_bg2.gbapal", - "graphics/link_games/dodrioberry_pkmn.gbapal", - "graphics/link_games/dodrioberry_shiny.gbapal", - "graphics/link_games/dodrioberry_status.gbapal", - "graphics/link_games/dodrioberry_berrysprites.gbapal", - "graphics/link_games/dodrioberry_berrysprites.4bpp.lz", - "graphics/link_games/dodrioberry_platform.gbapal", - "graphics/link_games/dodrioberry_bg1.4bpp.lz", - "graphics/link_games/dodrioberry_bg2.4bpp.lz", - "graphics/link_games/dodrioberry_status.4bpp.lz", - "graphics/link_games/dodrioberry_platform.4bpp.lz", - "graphics/link_games/dodrioberry_pkmn.4bpp.lz", - "graphics/link_games/dodrioberry_bg1.bin.lz", - "graphics/link_games/dodrioberry_bg2right.bin.lz", - "graphics/link_games/dodrioberry_bg2left.bin.lz"); - - -static const u8 gUnknown_082F7A88[][3] = -{ - {40, 24, 13}, - {32, 19, 10}, - {22, 13, 7}, -}; - -ALIGNED(4) -static const u8 gUnknown_082F7A94[] = {8, 5, 8, 11, 15}; - -ALIGNED(4) -static const u8 gUnknown_082F7A9C[] = {5, 10, 20, 30, 50, 70, 100}; - -ALIGNED(4) -static const u8 gUnknown_082F7AA4[][10] = -{ - {15, 16, 17, 18, 19, 19, 18, 17, 16, 15}, - {20, 21, 22, 23, 24, 25, 26, 27, 28, 29}, - {30, 31, 32, 33, 34, 34, 33, 32, 31, 30}, -}; - -static void (*const gUnknown_082F7AC4[])(void) = -{ - sub_8024DBC, - sub_8024E00, - sub_8024E38, - sub_8024F10, - sub_8024F38, - sub_8025198, - sub_8025324, - sub_8025470, - sub_8025644, - sub_80256AC, - sub_8025758, - sub_80250D4 -}; - -static void (*const gUnknown_082F7AF4[])(void) = -{ - sub_8024DBC, - sub_8024E00, - sub_8024E38, - sub_8024F10, - sub_8024FFC, - sub_8025230, - sub_8025324, - sub_8025470, - sub_8025644, - sub_80256AC, - sub_8025758, - sub_8025158 -}; - -// code -void StartDodrioBerryPicking(u16 a0, void (*callback)(void)) -{ - gUnknown_03000DB0 = FALSE; - - if (gReceivedRemoteLinkPlayers != 0 && (gUnknown_02022C98 = AllocZeroed(sizeof(*gUnknown_02022C98))) != NULL) - { - sub_8024A1C(); - sub_8024A30(gUnknown_02022C98); - gUnknown_02022C98->savedCallback = callback; - gUnknown_02022C98->multiplayerId = GetMultiplayerId(); - gUnknown_02022C98->unk32CC = gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId]; - sub_80261F8(&gUnknown_02022C98->unk318C[gUnknown_02022C98->multiplayerId], &gPlayerParty[a0]); - CreateTask(sub_8024BC8, 1); - SetMainCallback2(sub_80261CC); - sub_80273F0(); - sub_8026B5C(gUnknown_02022C98->unk24, &gUnknown_02022C98->unk44, &gUnknown_02022C98->unk48); - StopMapMusic(); - PlayNewMapMusic(MUS_RG_BERRY_PICK); - } - else - { - SetMainCallback2(callback); - return; - } -} - -static void sub_8024A1C(void) -{ - ResetTasks(); - ResetSpriteData(); - FreeAllSpritePalettes(); -} - -static void sub_8024A30(struct DodrioStruct * data) -{ - u8 i; - - data->unk0C = 0; - data->unk10 = 0; - data->unk14 = 0; - data->unk18 = 0; - data->unk1C = 0; - data->unk11C = 0; - data->unk120 = 0; - data->unk30 = 0; - data->unk40 = 0; - data->unk3C = 0; - data->unk12C = 0; - - for (i = 0; i < 4; i++) - { - data->unk98[i] = 0; - } - - for (i = 0; i < 5; i++) - { - data->unkA8[i] = 0; - data->unkB0[i] = 0; - data->unk4A[i][0] = 0; - data->unk4A[i][1] = 0; - data->unk4A[i][2] = 0; - data->unk4A[i][3] = 0; - data->unk4A[i][5] = 0; - data->unk10C[i] = 0; - data->unk130[i] = 0; - } - - for (i = 0; i < 11; i++) - { - data->unkD0[i] = 0; - data->unkDC[i] = 0; - data->unkC4[i] = 0; - data->unkF4[i][0] = 0xFF; - data->unkF4[i][1] = 0xFF; - } - - data->unk20 = GetMultiplayerId() == 0 ? 1 : 0; - data->unk24 = GetLinkPlayerCount(); - data->unk34[0] = GetMultiplayerId(); - for (i = 1; i < data->unk24; i++) - { - data->unk34[i] = data->unk34[i - 1] + 1; - if (data->unk34[i] > data->unk24 - 1) - data->unk34[i] %= data->unk24; - } -} - -static void sub_8024BC8(u8 taskId) -{ - u8 r4, r5; - - switch (gUnknown_02022C98->unk0C) - { - case 0: - SetVBlankCallback(NULL); - sub_802620C(sub_8025910, 4); - gUnknown_02022C98->unk0C++; - break; - case 1: - if (!FuncIsActiveTask(sub_8025910)) - { - sub_8029274(&gUnknown_02022C98->unk160); - gUnknown_02022C98->unk0C++; - } - break; - case 2: - if (!sub_802A770()) - { - Rfu_SetLinkStandbyCallback(); - gUnknown_02022C98->unk0C++; - } - break; - case 3: - if (IsLinkTaskFinished()) - { - if (gReceivedRemoteLinkPlayers != 0) - { - LoadWirelessStatusIndicatorSpriteGfx(); - CreateWirelessStatusIndicatorSprite(0, 0); - } - gUnknown_02022C98->unk0C++; - } - break; - case 4: - r5 = gUnknown_02022C98->unk24; - sub_80283A8(); - for (r4 = 0; r4 < r5; r4++) - { - sub_8028408(&gUnknown_02022C98->unk318C[gUnknown_02022C98->unk34[r4]], r4, gUnknown_02022C98->unk34[r4], gUnknown_02022C98->unk24); - } - sub_802868C(FALSE, gUnknown_02022C98->unk24); - gUnknown_02022C98->unk0C++; - break; - case 5: - sub_8028A34(); - sub_8028A88(); - sub_8028D44(); - sub_8028734(); - gUnknown_02022C98->unk0C++; - break; - case 6: - BlendPalettes(0xFFFFFFFF, 0x10, 0x00); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); - SetVBlankCallback(sub_80261E4); - gUnknown_02022C98->unk0C++; - break; - case 7: - UpdatePaletteFade(); - if (!gPaletteFade.active) - { - gUnknown_02022C98->unk0C++; - } - break; - default: - DestroyTask(taskId); - sub_802621C(sub_802589C); - break; - } -} - -static void sub_8024D4C(u8 taskId) -{ - sub_8025D04(); - gUnknown_082F7AC4[gUnknown_02022C98->unk18](); - if (!gUnknown_03000DB0) - { - sub_8026AF4(); - } - sub_8025D50(); -} - -static void sub_8024D84(u8 taskId) -{ - sub_8025E0C(); - gUnknown_082F7AF4[gUnknown_02022C98->unk18](); - if (!gUnknown_03000DB0) - { - sub_8026B28(); - } - sub_8025ED8(); -} - -static void sub_8024DBC(void) -{ - switch (gUnknown_02022C98->unk10) - { - case 0: - sub_8028504(1); - sub_80292E0(1); - gUnknown_02022C98->unk10++; - break; - case 1: - if (!sub_802A770()) - sub_8026240(1); - break; - } -} - -static void sub_8024E00(void) -{ - if (gUnknown_02022C98->unk10 == 0) - { - sub_80262C0(); - gUnknown_02022C98->unk10++; - } - else - { - gUnknown_02022C98->unk118 = 1; - sub_8026240(2); - } -} - -static void sub_8024E38(void) -{ - switch (gUnknown_02022C98->unk10) - { - case 0: - StartMinigameCountdown(7, 8, 120, 80, 0); - gUnknown_02022C98->unk10++; - break; - case 1: - Rfu_SetLinkStandbyCallback(); - gUnknown_02022C98->unk10++; - break; - case 2: - if (IsLinkTaskFinished()) - { - gUnknown_02022C98->unk10++; - gUnknown_02022C98->unk30 = 0; - } - break; - case 3: - if (!IsMinigameCountdownRunning()) - { - gUnknown_02022C98->unk10++; - } - break; - case 4: - if (++gUnknown_02022C98->unk30 > 5) - { - Rfu_SetLinkStandbyCallback(); - gUnknown_02022C98->unk10++; - } - break; - case 5: - if (IsLinkTaskFinished()) - { - sub_8026240(3); - } - break; - } -} - -static void sub_8024F10(void) -{ - if (gUnknown_02022C98->unk10 == 0) - { - if (gUnknown_02022C98->unk11C != 0) - { - sub_8026240(4); - } - } -} - -static void sub_8024F38(void) -{ - if (gUnknown_02022C98->unk10 == 0) - { - if (gUnknown_02022C98->unk40 < 10) - { - if (gUnknown_02022C98->unkA8[0] == 0) - { - if (JOY_NEW(DPAD_UP)) - { - if (gUnknown_02022C98->unk31A0[0].unk2C.unk0 == 0) - { - gUnknown_02022C98->unk31A0[0].unk2C.unk4 = 0; - gUnknown_02022C98->unk31A0[0].unk2C.unk0 = sub_8027518(2); - } - } - else if (JOY_NEW(DPAD_RIGHT)) - { - if (gUnknown_02022C98->unk31A0[0].unk2C.unk0 == 0) - { - gUnknown_02022C98->unk31A0[0].unk2C.unk4 = 0; - gUnknown_02022C98->unk31A0[0].unk2C.unk0 = sub_8027518(1); - } - } - else if (JOY_NEW(DPAD_LEFT)) - { - if (gUnknown_02022C98->unk31A0[0].unk2C.unk0 == 0) - { - gUnknown_02022C98->unk31A0[0].unk2C.unk4 = 0; - gUnknown_02022C98->unk31A0[0].unk2C.unk0 = sub_8027518(3); - } - } - else - { - gUnknown_02022C98->unk31A0[0].unk2C.unk0 = sub_8027518(0); - } - } - } - else - { - sub_8026240(11); - } - sub_802671C(); - sub_8025F48(); - } -} - -static void sub_8024FFC(void) -{ - if (gUnknown_02022C98->unk40 < 10) - { - if (JOY_NEW(DPAD_UP)) - { - if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 == 0) - { - gUnknown_02022C98->unk32CC.unk2C.unk0 = 2; - } - } - else if (JOY_NEW(DPAD_RIGHT)) - { - if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 == 0) - { - gUnknown_02022C98->unk32CC.unk2C.unk0 = 1; - } - } - else if (JOY_NEW(DPAD_LEFT)) - { - if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 == 0) - { - gUnknown_02022C98->unk32CC.unk2C.unk0 = 3; - } - } - else - { - gUnknown_02022C98->unk32CC.unk2C.unk0 = 0; - } - } - else - { - sub_8026240(11); - } - sub_8026044(); -} - -static void sub_80250D4(void) -{ - u8 i; - - sub_802671C(); - sub_8025F48(); - if (sub_8026C50() == 1) - { - sub_80272A4(); - sub_8026240(5); - } - else - { - gUnknown_02022C98->unk12C = 1; - for (i = 1; i < gUnknown_02022C98->unk24; i++) - { - if (gUnknown_02022C98->unk130[i] != 1) - { - gUnknown_02022C98->unk12C = 0; - break; - } - } - } -} - -static void sub_8025158(void) -{ - sub_8026044(); - if (sub_8026C90() == 1) - sub_8026240(5); -} - -static bool32 sub_8025170(void) -{ - u8 recvStatus = GetBlockReceivedStatus(); - u8 playerFlags = GetLinkPlayerCountAsBitFlags(); - if (recvStatus == playerFlags) - { - ResetBlockReceivedFlags(); - return TRUE; - } - else - { - return FALSE; - } -} - -static void sub_8025198(void) -{ - switch (gUnknown_02022C98->unk10) - { - case 0: - if (SendBlock(0, gUnknown_02022C98->unk4A, sizeof(gUnknown_02022C98->unk4A))) - { - gUnknown_02022C98->unk08 = 0; - gUnknown_02022C98->unk10++; - } - break; - case 1: - if (IsLinkTaskFinished()) - { - gUnknown_02022C98->unk10++; - } - break; - case 2: - if (sub_8025170()) - { - gUnknown_02022C98->unk08 = gUnknown_02022C98->unk24; - } - if (gUnknown_02022C98->unk08 >= gUnknown_02022C98->unk24) - { - gUnknown_02022C98->unk14++; - gUnknown_02022C98->unk10++; - } - break; - default: - if (WaitFanfare(TRUE)) - { - sub_8026240(6); - FadeOutAndPlayNewMapMusic(MUS_RG_VICTORY_WILD, 4); - } - break; - } -} - -static void sub_8025230(void) -{ - u8 i; - - switch (gUnknown_02022C98->unk10) { - case 0: - if (SendBlock(0, gUnknown_02022C98->unk4A[gUnknown_02022C98->unk14], - sizeof(gUnknown_02022C98->unk4A))) { - gUnknown_02022C98->unk08 = 0; - gUnknown_02022C98->unk10++; - } - break; - case 1: - if (IsLinkTaskFinished()) { - gUnknown_02022C98->unk10++; - } - break; - case 2: - if (sub_8025170()) { - for (i = 0; i < gUnknown_02022C98->unk24; i++) { - memcpy(gUnknown_02022C98->unk4A, gBlockRecvBuffer, sizeof(gUnknown_02022C98->unk4A)); - gUnknown_02022C98->unk08 = gUnknown_02022C98->unk24; - } - } - if (gUnknown_02022C98->unk08 >= gUnknown_02022C98->unk24) { - gUnknown_02022C98->unk14++; - gUnknown_02022C98->unk10++; - } - break; - default: - if (WaitFanfare(TRUE)) { - gUnknown_02022C98->unk114 = gUnknown_02022C98->unk4A[gUnknown_02022C98->multiplayerId][5]; - sub_8026240(6); - FadeOutAndPlayNewMapMusic(MUS_RG_VICTORY_WILD, 4); - } - break; - } -} - -static void sub_8025324(void) -{ - u8 sp00 = 1; - u8 i; - - switch (gUnknown_02022C98->unk10) - { - case 0: - sub_802749C(); - sub_80289E8(TRUE); - sub_8028DFC(); - sub_8028EC8(TRUE); - sub_80292E0(2); - gUnknown_02022C98->unk10++; - break; - case 1: - if (!sub_802A770()) - { - sub_80292E0(5); - gUnknown_02022C98->unk10++; - } - break; - case 2: - sp00 = sub_802A794(); - if (SendBlock(0, &sp00, sizeof(sp00))) - { - gUnknown_02022C98->unk10++; - } - break; - case 3: - if (IsLinkTaskFinished()) - { - gUnknown_02022C98->unk10++; - gUnknown_02022C98->unk08 = 0; - } - break; - case 4: - if (sub_8025170()) - { - for (i = 0; i < gUnknown_02022C98->unk24; i++) - { - *(gUnknown_02022C98->unk10C + i) = *(u8 *)gBlockRecvBuffer[i]; - gUnknown_02022C98->unk08 = gUnknown_02022C98->unk24; - } - } - if (gUnknown_02022C98->unk08 >= gUnknown_02022C98->unk24) { - if (++gUnknown_02022C98->unk14 >= 120) - { - sub_80292E0(6); - gUnknown_02022C98->unk10++; - } - } - break; - default: - if (!sub_802A770()) - { - sub_8026240(7); - } - break; - } -} - -static void sub_8025470(void) -{ - u8 sp0; - u8 i; - - switch (gUnknown_02022C98->unk10) - { - case 0: - if (sub_8027748() >= 3000) - { - sub_80292E0(4); - } - gUnknown_02022C98->unk10++; - break; - case 1: - if (!sub_802A770()) - { - sub_80292E0(3); - gUnknown_02022C98->unk10++; - } - break; - case 2: - sub_8028FCC(); - sub_80272E8(); - gUnknown_02022C98->unk10++; - break; - case 3: - if ((sp0 = sub_802A794()) != 0) - { - gUnknown_02022C98->unk10++; - } - break; - case 4: - if (!sub_802A770()) - { - sub_80292E0(5); - gUnknown_02022C98->unk10++; - } - break; - case 5: - sp0 = sub_802A794(); - if (SendBlock(0, &sp0, sizeof(sp0))) - { - gUnknown_02022C98->unk08 = 0; - gUnknown_02022C98->unk10++; - } - break; - case 6: - if (IsLinkTaskFinished()) - { - gUnknown_02022C98->unk10++; - } - break; - case 7: - if (sub_8025170()) - { - for (i = 0; i < gUnknown_02022C98->unk24; i++) - { - *(gUnknown_02022C98->unk10C + i) = *(u8 *)gBlockRecvBuffer[i]; - gUnknown_02022C98->unk08 = gUnknown_02022C98->unk24; - } - } - if (gUnknown_02022C98->unk08 >= gUnknown_02022C98->unk24) { - if (++gUnknown_02022C98->unk14 >= 120) - { - sub_8027608(); - sub_80292E0(6); - gUnknown_02022C98->unk10++; - } - } - else - { - sub_8027554(); - } - break; - default: - if (!sub_802A770()) - { - for (i = 0; i < gUnknown_02022C98->unk24; i++) - { - if (gUnknown_02022C98->unk10C[i] == 2) - { - sub_8026240(8); - return; - } - } - sub_8026240(10); - } - break; - } -} - -static void sub_8025644(void) -{ - switch (gUnknown_02022C98->unk10) - { - case 0: - SetCloseLinkCallback(); - sub_80292E0(7); - gUnknown_02022C98->unk10++; - break; - case 1: - if (!sub_802A770()) - { - gUnknown_02022C98->unk10++; - } - break; - case 2: - if (sub_802A794() == 5) - { - gUnknown_02022C98->unk10++; - } - break; - default: - if (gReceivedRemoteLinkPlayers == 0) - { - sub_8026240(9); - } - break; - } -} - -static void sub_80256AC(void) -{ - switch (gUnknown_02022C98->unk10) - { - case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); - gUnknown_02022C98->unk10++; - break; - case 1: - UpdatePaletteFade(); - if (!gPaletteFade.active) - { - gUnknown_02022C98->unk10++; - } - break; - case 2: - sub_8028B80(); - sub_80287E4(); - sub_8028614(gUnknown_02022C98->unk24); - sub_8028E84(); - gUnknown_03000DB0 = TRUE; - sub_80292E0(8); - gUnknown_02022C98->unk10++; - break; - default: - if (!sub_802A770()) - { - SetMainCallback2(gUnknown_02022C98->savedCallback); - DestroyTask(gUnknown_02022C98->unk04); - Free(gUnknown_02022C98); - FreeAllWindowBuffers(); - } - break; - } -} - -static void sub_8025758(void) -{ - switch (gUnknown_02022C98->unk10) - { - case 0: - sub_80292E0(9); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); - gUnknown_02022C98->unk10++; - break; - case 1: - UpdatePaletteFade(); - if (!gPaletteFade.active) - { - gUnknown_02022C98->unk10++; - } - break; - case 2: - ChangeBgX(0, 0, 0); - ChangeBgY(0, 0, 0); - ChangeBgX(1, 0, 0); - ChangeBgY(1, 0, 0); - ChangeBgX(2, 0, 0); - ChangeBgY(2, 0, 0); - ChangeBgX(3, 0, 0); - ChangeBgY(3, 0, 0); - gUnknown_02022C98->unk10++; - break; - case 3: - StopMapMusic(); - gUnknown_02022C98->unk10++; - break; - case 4: - PlayNewMapMusic(MUS_RG_BERRY_PICK); - sub_8028E4C(); - gUnknown_02022C98->unk10++; - break; - case 5: - BlendPalettes(0xFFFFFFFF, 16, 0); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); - gUnknown_02022C98->unk10++; - break; - case 6: - UpdatePaletteFade(); - if (!gPaletteFade.active) - { - gUnknown_02022C98->unk10++; - } - break; - default: - DestroyTask(gUnknown_02022C98->unk04); - sub_802621C(sub_802589C); - sub_802903C(); - sub_8024A30(gUnknown_02022C98); - if (gReceivedRemoteLinkPlayers == 0) - { - gUnknown_02022C98->unk24 = 1; - } - sub_80273F0(); - sub_8028EC8(FALSE); - break; - } -} - -static void sub_802589C(u8 taskId) -{ - switch (gUnknown_02022C98->unk10) - { - case 0: - if (sub_8026264() == 1) - { - gUnknown_02022C98->unk10++; - } - break; - case 1: - sub_80286E4(); - gUnknown_02022C98->unk10++; - break; - case 2: - if (sub_8028828() == TRUE) - { - gUnknown_02022C98->unk10++; - } - break; - default: - if (gUnknown_02022C98->unk20 != 0) - { - sub_802621C(sub_8024D4C); - } - else - { - sub_802621C(sub_8024D84); - } - DestroyTask(taskId); - break; - } -} - -static void sub_8025910(u8 taskId) -{ - s16 * data = gTasks[taskId].data; - u8 i; - - switch (data[0]) - { - case 0: - if (SendBlock(0, &gUnknown_02022C98->unk318C[gUnknown_02022C98->multiplayerId].isShiny, sizeof(gUnknown_02022C98->unk318C[gUnknown_02022C98->multiplayerId].isShiny))) - { - gUnknown_02022C98->unk08 = 0; - data[0]++; - } - break; - case 1: - if (IsLinkTaskFinished()) - { - data[0]++; - } - break; - case 2: - if (sub_8025170()) - { - for (i = 0; i < gUnknown_02022C98->unk24; i++) - { - *(u8 *)&gUnknown_02022C98->unk318C[i] = *(u8 *)gBlockRecvBuffer[i]; - gUnknown_02022C98->unk08 = gUnknown_02022C98->unk24; - } - } - if (gUnknown_02022C98->unk08 >= gUnknown_02022C98->unk24) - { - DestroyTask(taskId); - sub_80292E0(6); - gUnknown_02022C98->unk10++; - } - break; - } -} - -static void sub_80259FC(void) -{ - u8 i; - u8 r7 = gUnknown_02022C98->unk24; - - gUnknown_02022C98->unk31A0[0].unk10 = sub_8028164(0, &gUnknown_02022C98->unk31A0[0], &gUnknown_02022C98->unk31A0[0].unk2C, &gUnknown_02022C98->unk31A0[1].unk2C, &gUnknown_02022C98->unk31A0[2].unk2C, &gUnknown_02022C98->unk31A0[3].unk2C, &gUnknown_02022C98->unk31A0[4].unk2C, &gUnknown_02022C98->unk40, &gUnknown_02022C98->unk120, &gUnknown_02022C98->unk12C); - gUnknown_02022C98->unk128 = 1; - - for (i = 1; i < r7; i++) - { - if ( gUnknown_02022C98->unkA8[i] == 0 - && sub_8028318(i, &gUnknown_02022C98->unk31A0[i].unk2C.unk0) == 0) - { - gUnknown_02022C98->unk31A0[i].unk2C.unk0 = 0; - gUnknown_02022C98->unk128 = 0; - } - } - if (++gUnknown_02022C98->unk124 >= 60) - { - if (gUnknown_02022C98->unk128 != 0) - { - sub_8011AC8(); - gUnknown_02022C98->unk124 = 0; - } - else if (gUnknown_02022C98->unk124 > 70) - { - sub_8011AC8(); - gUnknown_02022C98->unk124 = 0; - } - } - - for (i = 0; i < r7; i++) - { - if ( gUnknown_02022C98->unk31A0[i].unk2C.unk0 != 0 - && gUnknown_02022C98->unkA8[i] == 0) - { - gUnknown_02022C98->unkA8[i] = 1; - } - switch (gUnknown_02022C98->unkA8[i]) - { - case 0: - default: - break; - case 1 ... 3: - if (++gUnknown_02022C98->unkB0[i] >= 6) - { - gUnknown_02022C98->unkB0[i] = 0; - gUnknown_02022C98->unkA8[i] = 0; - gUnknown_02022C98->unk31A0[i].unk2C.unk0 = 0; - gUnknown_02022C98->unk31A0[i].unk2C.unk4 = 0; - gUnknown_02022C98->unk31A0[i].unk2C.unk8 = 0; - } - break; - case 4: - if (++gUnknown_02022C98->unkB0[i] >= 40) - { - gUnknown_02022C98->unkB0[i] = 0; - gUnknown_02022C98->unkA8[i] = 0; - gUnknown_02022C98->unk31A0[i].unk2C.unk0 = 0; - gUnknown_02022C98->unk31A0[i].unk2C.unk4 = 0; - gUnknown_02022C98->unk31A0[i].unk2C.unk8 = 0; - } - break; - } - } -} - -static void sub_8025C0C(void) -{ - u8 i; - u8 r6 = gUnknown_02022C98->unk24; - - gUnknown_02022C98->unk31A0[0].unk10 = sub_8028164(0, &gUnknown_02022C98->unk31A0[0], &gUnknown_02022C98->unk31A0[0].unk2C, &gUnknown_02022C98->unk31A0[1].unk2C, &gUnknown_02022C98->unk31A0[2].unk2C, &gUnknown_02022C98->unk31A0[3].unk2C, &gUnknown_02022C98->unk31A0[4].unk2C, &gUnknown_02022C98->unk40, &gUnknown_02022C98->unk120, &gUnknown_02022C98->unk12C); - gUnknown_02022C98->unk128 = 1; - - for (i = 1; i < r6; i++) - { - if (sub_8028374(i) != 0) - { - gUnknown_02022C98->unk130[i] = 1; - gUnknown_02022C98->unk128 = 0; - } - } - if (++gUnknown_02022C98->unk124 >= 60) - { - if (gUnknown_02022C98->unk128 != 0) - { - sub_8011AC8(); - gUnknown_02022C98->unk124 = 0; - } - else if (gUnknown_02022C98->unk124 > 70) - { - sub_8011AC8(); - gUnknown_02022C98->unk124 = 0; - } - } -} - -static void sub_8025D04(void) -{ - switch (gUnknown_02022C98->unk18) - { - case 3: - if (sub_8026BB8() == TRUE) - { - sub_8026C28(); - gUnknown_02022C98->unk11C = 1; - } - break; - case 4: - sub_80259FC(); - break; - case 11: - sub_8025C0C(); - break; - } -} - -static void sub_8025D50(void) -{ - switch (gUnknown_02022C98->unk18) - { - case 4: - sub_8027E30(&gUnknown_02022C98->unk32CC, &gUnknown_02022C98->unk31A0[0].unk2C, &gUnknown_02022C98->unk31A0[1].unk2C, &gUnknown_02022C98->unk31A0[2].unk2C, &gUnknown_02022C98->unk31A0[3].unk2C, &gUnknown_02022C98->unk31A0[4].unk2C, gUnknown_02022C98->unk40, gUnknown_02022C98->unk120, gUnknown_02022C98->unk12C); - break; - case 11: - sub_8027E30(&gUnknown_02022C98->unk32CC, &gUnknown_02022C98->unk31A0[0].unk2C, &gUnknown_02022C98->unk31A0[1].unk2C, &gUnknown_02022C98->unk31A0[2].unk2C, &gUnknown_02022C98->unk31A0[3].unk2C, &gUnknown_02022C98->unk31A0[4].unk2C, gUnknown_02022C98->unk40, gUnknown_02022C98->unk120, gUnknown_02022C98->unk12C); - break; - } -} - -static void sub_8025E0C(void) -{ - switch (gUnknown_02022C98->unk18) - { - case 4: - sub_8028164(gUnknown_02022C98->multiplayerId, &gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId], &gUnknown_02022C98->unk31A0[0].unk2C, &gUnknown_02022C98->unk31A0[1].unk2C, &gUnknown_02022C98->unk31A0[2].unk2C, &gUnknown_02022C98->unk31A0[3].unk2C, &gUnknown_02022C98->unk31A0[4].unk2C, &gUnknown_02022C98->unk40, &gUnknown_02022C98->unk120, &gUnknown_02022C98->unk12C); - break; - case 11: - sub_8028164(gUnknown_02022C98->multiplayerId, &gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId], &gUnknown_02022C98->unk31A0[0].unk2C, &gUnknown_02022C98->unk31A0[1].unk2C, &gUnknown_02022C98->unk31A0[2].unk2C, &gUnknown_02022C98->unk31A0[3].unk2C, &gUnknown_02022C98->unk31A0[4].unk2C, &gUnknown_02022C98->unk40, &gUnknown_02022C98->unk120, &gUnknown_02022C98->unk12C); - break; - } -} - -static void sub_8025ED8(void) -{ - switch (gUnknown_02022C98->unk18) - { - case 3: - sub_8027DD0(1); - gUnknown_02022C98->unk11C = 1; - break; - case 4: - if (gUnknown_02022C98->unk32CC.unk2C.unk0 != 0) - { - sub_80282EC(gUnknown_02022C98->unk32CC.unk2C.unk0); - } - break; - case 11: - if (gUnknown_02022C98->unk120 == 0 && gUnknown_02022C98->unk12C == 0) - { - sub_8028350(1); - } - break; - } -} - -static void sub_8025F48(void) -{ - if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 == 0) - { - if (!IsSEPlaying()) - { - gUnknown_02022C98->unk144 = 0; - } - } - else if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk4 == 1) - { - if (gUnknown_02022C98->unk144 == 0) - { - m4aSongNumStop(SE_SUCCESS); - PlaySE(SE_SUCCESS); - gUnknown_02022C98->unk144 = 1; - } - } - else if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk8 == 1) - { - if (gUnknown_02022C98->unk144 == 0 && !IsSEPlaying()) - { - PlaySE(SE_BOO); - sub_80284CC(1); - gUnknown_02022C98->unk144 = 1; - } - } - - if (gUnknown_02022C98->unk154 == 0 && gUnknown_02022C98->unk40 >= 10) - { - StopMapMusic(); - gUnknown_02022C98->unk154 = 1; - } - else if (gUnknown_02022C98->unk154 == 1) - { - PlayFanfareByFanfareNum(11); // MUS_TOO_BAD - gUnknown_02022C98->unk154 = 2; - } -} - -static void sub_8026044(void) -{ - u8 r8 = gUnknown_02022C98->unk44; - u8 r7 = gUnknown_02022C98->unk48; - u8 r4; - if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 == 0) - { - if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk4 != 1 && gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk8 != 1) - { - gUnknown_02022C98->unk144 = 0; - } - } - else if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk4 == 1) - { - if (gUnknown_02022C98->unk144 == 0) - { - m4aSongNumStop(SE_SUCCESS); - PlaySE(SE_SUCCESS); - gUnknown_02022C98->unk144 = 1; - } - } - else if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk8 == 1) - { - if (gUnknown_02022C98->unk144 == 0 && !IsSEPlaying()) - { - PlaySE(SE_BOO); - sub_80284CC(1); - gUnknown_02022C98->unk144 = 1; - } - } - for (r4 = r8; r4 < r7; r4++) - { - struct DodrioSubstruct_31A0_14 * ptr = &gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk14; - if (ptr->unkB[r4] >= 10) - { - if (gUnknown_02022C98->unk148[r4] == 0) - { - PlaySE(SE_BALLOON_RED + ptr->unk0[r4]); - gUnknown_02022C98->unk148[r4] = 1; - } - } - else - { - gUnknown_02022C98->unk148[r4] = 0; - } - } - if (gUnknown_02022C98->unk154 == 0 && gUnknown_02022C98->unk40 >= 10) - { - StopMapMusic(); - gUnknown_02022C98->unk154 = 1; - } - else if (gUnknown_02022C98->unk154 == 1) - { - PlayFanfareByFanfareNum(11); // MUS_TOO_BAD - gUnknown_02022C98->unk154 = 2; - } -} - -static void sub_80261CC(void) -{ - RunTasks(); - AnimateSprites(); - BuildOamBuffer(); - UpdatePaletteFade(); -} - -static void sub_80261E4(void) -{ - TransferPlttBuffer(); - LoadOam(); - ProcessSpriteCopyRequests(); -} - -static void sub_80261F8(struct DodrioSubstruct_318C * a0, struct Pokemon * a1) -{ - a0->isShiny = IsMonShiny(a1); -} - -static void sub_802620C(TaskFunc func, u8 priority) -{ - CreateTask(func, priority); -} - -static void sub_802621C(TaskFunc func) -{ - gUnknown_02022C98->unk04 = CreateTask(func, 1); - gUnknown_02022C98->unk10 = 0; - gUnknown_02022C98->unk0C = 0; - gUnknown_02022C98->unk14 = 0; -} - -static void sub_8026240(u8 a0) -{ - gUnknown_02022C98->unk1C = gUnknown_02022C98->unk18; - gUnknown_02022C98->unk18 = a0; - gUnknown_02022C98->unk10 = 0; - gUnknown_02022C98->unk14 = 0; -} - -static bool32 sub_8026264(void) -{ - u8 r2 = gUnknown_02022C98->unk14 / 4; - gUnknown_02022C98->unk14++; - if (r2 != 0 && gUnknown_02022C98->unk14 % 4 == 0) - { - if (r2 < gUnknown_082F7A94[gUnknown_02022C98->unk24 - 1]) - { - SetGpuReg(REG_OFFSET_BG1HOFS, (r2 * 8)); - SetGpuReg(REG_OFFSET_BG2HOFS, -(r2 * 8)); - return FALSE; - } - else - { - return TRUE; - } - } - else - { - return FALSE; - } -} - -static void sub_80262C0(void) -{ - u8 i; - u8 start = gUnknown_02022C98->unk44; - u8 finish = gUnknown_02022C98->unk48; - - for (i = start; i < finish; i++) - { - struct DodrioSubstruct_31A0_14 * ptr = &gUnknown_02022C98->unk32CC.unk14; - ptr->unkB[i] = (i % 2 == 0) ? 1 : 0; - ptr->unk0[i] = 0; - } -} - -static void sub_8026324(void) -{ - u8 sp0 = gUnknown_02022C98->unk44; - u8 sp4 = gUnknown_02022C98->unk48; - u8 sp8 = gUnknown_02022C98->unk24; - u8 i, j, k, r5; - - if (gUnknown_02022C98->unk40 >= 10) - return; - - for (i = 0; i < sp8; i++) - { - u8 *ptr = &gUnknown_02022C98->unk31A0[i].unk2C.unk0; - if (*ptr != 0 && gUnknown_02022C98->unkA8[i] == 1) - { - for (j = sp0; j < sp4; j++) - { - r5 = gUnknown_082F449C[0][0][j]; - if (gUnknown_02022C98->unkF4[r5][0] == i || gUnknown_02022C98->unkF4[r5][1] == i) - break; - if (sub_8026634(i, *ptr, r5) == TRUE) - { - for (k = 0; k < 2; k++) - { - if (gUnknown_02022C98->unkF4[r5][k] == 0xFF) - { - gUnknown_02022C98->unkF4[r5][k] = i; - gUnknown_02022C98->unkA8[i] = 2; - gUnknown_02022C98->unkC4[r5] = 1; - break; - } - } - break; - } - if (gUnknown_02022C98->unk31A0[i].unk2C.unk8 == 1) - break; - } - } - } - - for (j = sp0; j < sp4; j++) - { - u8 id = 0xFF; - r5 = gUnknown_082F449C[0][0][j]; - if (gUnknown_02022C98->unkC4[r5] == 1) - { - s32 r2; - u8 r4, r3 = gUnknown_02022C98->unk90[sub_8026D8C(r5)] / 7; - if (r3 >= ARRAY_COUNT(gUnknown_082F7A88) - 1) - r3 = ARRAY_COUNT(gUnknown_082F7A88) - 1; - - r2 = gUnknown_082F7A88[r3][gUnknown_02022C98->unk31A0[0].unk14.unk0[r5]] - gUnknown_02022C98->unkD0[r5]; - if (r2 < 6) - gUnknown_02022C98->unk9C[r5] += r2; - - if (++gUnknown_02022C98->unk9C[r5] >= 6) - { - gUnknown_02022C98->unk9C[r5] = 0; - if (gUnknown_02022C98->unkF4[r5][0] == 0xFF && gUnknown_02022C98->unkF4[r5][1] == 0xFF) - { - continue; - } - else if (gUnknown_02022C98->unkF4[r5][0] != 0xFF && gUnknown_02022C98->unkF4[r5][1] == 0xFF) - { - r4 = gUnknown_02022C98->unkF4[r5][0]; - } - else - { - u8 unk0 = gUnknown_02022C98->unkF4[r5][0]; - i = gUnknown_02022C98->unkF4[r5][1]; // Have to re-use the variable to match. - if (!(Random() & 1)) - { - r4 = unk0; - id = i; - } - else - { - r4 = i; - id = unk0; - } - } - gUnknown_02022C98->unk32CC.unk14.unkB[r5] = 7; - gUnknown_02022C98->unkC4[r5] = 2; - gUnknown_02022C98->unkA8[r4] = 3; - gUnknown_02022C98->unkB8[r5] = r4; - gUnknown_02022C98->unk31A0[r4].unk2C.unk4 = 1; - gUnknown_02022C98->unk31A0[id].unk2C.unk8 = 1; - gUnknown_02022C98->unk86[r4]++; - sub_8026F1C(0, r5, r4); - sub_8027234(TRUE); - sub_8026D1C(r4); - gUnknown_02022C98->unkE8[r5] = gUnknown_02022C98->unk32CC.unk14.unk0[r5]; - gUnknown_02022C98->unk32CC.unk14.unk0[r5] = 3; - gUnknown_02022C98->unkF4[r5][0] = 0xFF; - gUnknown_02022C98->unkF4[r5][1] = 0xFF; - } - } - } -} - -static bool32 sub_8026634(u8 a0, u8 a1, u8 a2) -{ - s32 r7 = 0; - u8 r5 = gUnknown_02022C98->unk24 - 1; - struct DodrioSubstruct_31A0_14 * ptr = &gUnknown_02022C98->unk32CC.unk14; - - switch (a1) - { - case 3: - default: - r7 = 0; - break; - case 2: - r7 = 1; - break; - case 1: - r7 = 2; - break; - } - if (ptr->unkB[a2] == 6 || ptr->unkB[a2] == 7) - { - if (a2 == gUknnown_082F45AF[r5][a0][r7]) - { - if (gUnknown_02022C98->unkC4[a2] == 1 || gUnknown_02022C98->unkC4[a2] == 2) - { - gUnknown_02022C98->unk31A0[a0].unk2C.unk8 = 1; - return FALSE; - } - else - { - return TRUE; - } - } - } - else - { - if (a2 == gUknnown_082F45AF[r5][a0][r7]) - { - gUnknown_02022C98->unkA8[a0] = 4; - gUnknown_02022C98->unk31A0[a0].unk2C.unk8 = 1; - } - } - return FALSE; -} - -static void sub_802671C(void) -{ - u8 r1 = gUnknown_02022C98->unk44; - u8 r9 = gUnknown_02022C98->unk48; - u8 r3 = 0; - u8 r10 = 0; - u8 i; - u8 r2; - struct DodrioStruct *ptr; - - gUnknown_02022C98->unk120 = 0; - - for (i = r1; i < r9 - 1; i++) - { - ptr = gUnknown_02022C98; - - if (gUnknown_02022C98->unkC4[i] == 0 || gUnknown_02022C98->unkC4[i] == 1) - { - gUnknown_02022C98->unk120 = 1; - if (ptr->unk32CC.unk14.unkB[i] >= 10) - { - ptr->unk32CC.unk14.unkB[i] = 10; - gUnknown_02022C98->unkC4[i] = 3; - if (gUnknown_02022C98->unk148[i] == 0) - { - gUnknown_02022C98->unk148[i] = 1; - PlaySE(SE_BALLOON_RED + ptr->unk32CC.unk14.unk0[i]); - } - if (gUnknown_02022C98->unk40 < 10 || r10 == 1) - { - r10 = 1; - gUnknown_02022C98->unk148[i] = 0; - if (gUnknown_02022C98->unk40 < 10) - { - gUnknown_02022C98->unk40++; - } - sub_8026F1C(3, i, 0); - sub_8027234(FALSE); - } - } - else - { - r3 = gUnknown_02022C98->unk90[sub_8026D8C(i)] / 7; - if (r3 >= 2) - { - r3 = 2; - } - r2 = gUnknown_082F7A88[r3][ptr->unk32CC.unk14.unk0[i]]; - if (++gUnknown_02022C98->unkD0[i] >= r2) - { - ptr->unk32CC.unk14.unkB[i]++; - gUnknown_02022C98->unkD0[i] = 0; - } - sub_8026324(); - } - } - else if (gUnknown_02022C98->unkC4[i] == 2) - { - gUnknown_02022C98->unk120 = 1; - if (++gUnknown_02022C98->unkDC[i] >= 20) - { - gUnknown_02022C98->unk31A0[gUnknown_02022C98->unkB8[i]].unk2C.unk4 = 0; - gUnknown_02022C98->unkDC[i] = 0; - gUnknown_02022C98->unkD0[i] = 0; - gUnknown_02022C98->unkC4[i] = 0; - ptr->unk32CC.unk14.unkB[i] = 1; - ptr->unk32CC.unk14.unk0[i] = sub_8026DB0(sub_8026D8C(i), i); - } - } - else if (gUnknown_02022C98->unkC4[i] == 3) - { - if (++gUnknown_02022C98->unkDC[i] >= 20) - { - if (gUnknown_02022C98->unk40 < 10) - { - gUnknown_02022C98->unkDC[i] = 0; - gUnknown_02022C98->unkD0[i] = 0; - gUnknown_02022C98->unkC4[i] = 0; - ptr->unk32CC.unk14.unkB[i] = 1; - gUnknown_02022C98->unkE8[i] = ptr->unk32CC.unk14.unk0[i]; - ptr->unk32CC.unk14.unk0[i] = sub_8026DB0(sub_8026D8C(i), i); - } - } - } - } -} - -static void sub_8026988(void) -{ - u8 i, first, count; - - first = gUnknown_02022C98->unk44; - count = gUnknown_02022C98->unk48; - for (i = first; i < count; i++) - { - struct DodrioSubstruct_31A0 *ptr = &gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId]; - u8 var = gUnknown_082F449C[gUnknown_02022C98->unk24 - 1][gUnknown_02022C98->multiplayerId][i]; - - if (ptr->unk14.unkB[var] != 0) - sub_8028BF8(i, FALSE); - else - sub_8028BF8(i, TRUE); - - if (ptr->unk14.unkB[var] > 9) - { - sub_8028CA4(i, ptr->unk14.unk0[var] + 3); - sub_8028C7C(i, ptr->unk14.unkB[var] * 2 - 1); - } - else if (ptr->unk14.unk0[var] == 3) - { - ptr->unk14.unkB[var] = 7; - sub_8028CA4(i, 6); - sub_8028C7C(i, ptr->unk14.unkB[var] * 2 - 1); - } - else - { - sub_8028CA4(i, ptr->unk14.unk0[var]); - sub_8028C7C(i, ptr->unk14.unkB[var] * 2); - } - } -} - -static void sub_8026A88(void) -{ - u8 i, count; - - count = gUnknown_02022C98->unk24; - for (i = 0; i < count; i++) - { - struct DodrioSubstruct_31A0 *ptr = &gUnknown_02022C98->unk31A0[i]; - sub_80286B4(i, ptr->unk2C.unk0); - } -} - -static void sub_8026AC8(void) -{ - u8 i, count; - - count = gUnknown_02022C98->unk24; - for (i = 0; i < count; i++) - sub_80286B4(i, 4); -} - -static void sub_8026AF4(void) -{ - sub_8026988(); - if (gUnknown_02022C98->unk40 > 9) - sub_8026AC8(); - else - sub_8026A88(); - - sub_80288D4(gUnknown_02022C98->unk40); -} - -// This function is literally the same as the one above...Why? -static void sub_8026B28(void) -{ - sub_8026988(); - if (gUnknown_02022C98->unk40 > 9) - sub_8026AC8(); - else - sub_8026A88(); - - sub_80288D4(gUnknown_02022C98->unk40); -} - -static void sub_8026B5C(u8 arg0, u8 *arg1, u8 *arg2) -{ - switch (arg0) - { - case 1: - *arg1 = 4, *arg2 = 7; - break; - case 2: - *arg1 = 3, *arg2 = 8; - break; - case 3: - *arg1 = 2, *arg2 = 9; - break; - case 4: - *arg1 = 1, *arg2 = 10; - break; - case 5: - *arg1 = 0, *arg2 = 11; - break; - } -} - -static bool32 sub_8026BB8(void) -{ - u8 i, count; - - count = gUnknown_02022C98->unk24; - for (i = 1; i < count; i++) - { - if (gUnknown_02022C98->unk158[i] == 0) - gUnknown_02022C98->unk158[i] = sub_8027DFC(i); - } - - // This loop won't ever run, the seemingly poitnless assingment below is to make the compiler - // generate code for it. - count = count; - for (; i < count; i++) - { - if (gUnknown_02022C98->unk158[i] == 0) - return FALSE; - } - - return TRUE; -} - -static void sub_8026C28(void) -{ - u8 i; - - for (i = 0; i < 5; i++) - gUnknown_02022C98->unk158[i] = 0; -} - -static bool32 sub_8026C50(void) -{ - if (gUnknown_02022C98->unk40 > 9 && gUnknown_02022C98->unk120 == 0) - { - gUnknown_02022C98->unk40 = 10; - if (gUnknown_02022C98->unk12C != 0) - return TRUE; - } - - return FALSE; -} - -static bool32 sub_8026C90(void) -{ - u8 i, first, count; - - if (gUnknown_02022C98->unk40 > 9) - { - first = gUnknown_02022C98->unk44; - count = gUnknown_02022C98->unk48; - gUnknown_02022C98->unk40 = 10; - if (gUnknown_02022C98->unk12C != 0) - { - for (i = first; i < count; i++) - { - struct DodrioSubstruct_31A0 *ptr = &gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId]; - u8 var = gUnknown_082F449C[gUnknown_02022C98->unk24 - 1][gUnknown_02022C98->multiplayerId][i]; - - if (ptr->unk14.unkB[var] != 10) - return FALSE; - } - return TRUE; - } - } - - return FALSE; -} - -static void sub_8026D1C(u8 arg0) -{ - u8 var = gUnknown_082F7A9C[gUnknown_02022C98->unk90[arg0] % 7] + (gUnknown_02022C98->unk90[arg0] / 7) * 100; - if (gUnknown_02022C98->unk86[arg0] >= var) - gUnknown_02022C98->unk90[arg0]++; -} - -static u8 sub_8026D8C(u8 arg0) -{ - return gUnknown_082F4648[gUnknown_02022C98->unk24 - 1][arg0]; -} - -static u8 sub_8026DB0(u8 arg0, u8 arg1) -{ - u8 i, var3; - u8 count = gUnknown_02022C98->unk24 - 1; - u8 var0 = gUnknown_082F45FA[count][arg0][0]; - u8 var1 = gUnknown_082F45FA[count][arg0][1]; - u8 var2 = gUnknown_082F45FA[count][arg0][2]; - - for (i = 0; gUnknown_082F467F[count][i] != 0; i++) - { - if (arg1 == gUnknown_082F467F[count][i]) - return sub_8026E70(gUnknown_02022C98->unk90[var1], arg1); - } - - // Gets the highest of the three. - if (gUnknown_02022C98->unk90[var0] > gUnknown_02022C98->unk90[var1]) - var3 = gUnknown_02022C98->unk90[var0]; - else - var3 = gUnknown_02022C98->unk90[var1]; - - if (gUnknown_02022C98->unk90[var2] > var3) - var3 = gUnknown_02022C98->unk90[var2]; - - return sub_8026E70(var3, arg1); -} - -static u8 sub_8026E70(u8 arg0, u8 arg1) -{ - u8 var = gUnknown_02022C98->unkE8[arg1]; - switch (arg0 % 7) - { - default: return 0; - case 0: return 0; - case 1: return 1; - case 2: return 2; - case 3: - if (var == 0) - return 1; - else - return 0; - case 4: - if (var == 0) - return 2; - else - return 0; - case 5: - if (var == 2) - return 1; - else - return 2; - case 6: - if (var == 0) - return 1; - else if (var == 1) - return 2; - else - return 0; - } -} - -static bool32 sub_8026EEC(u16 arg0[5][6]) -{ - int sum, i; - for (sum = 0, i = 0; i < GetLinkPlayerCount(); sum += arg0[i][3], i++) - ; - - if (sum >= 11) - return TRUE; - else - return FALSE; -} - -static void sub_8026F1C(u8 arg0, u8 arg1, u8 arg2) -{ - u8 var; - u8 count = gUnknown_02022C98->unk24; - switch (arg0) - { - case 0: - case 1: - case 2: - var = gUnknown_02022C98->unk31A0[0].unk14.unk0[arg1]; - gUnknown_02022C98->unk4A[arg2][var] = IncrementWithLimit(gUnknown_02022C98->unk4A[arg2][var], 20000); - break; - case 3: - if (sub_8026EEC(gUnknown_02022C98->unk4A)) - break; - switch (count) - { - case 5: - switch (arg1) - { - case 0: - gUnknown_02022C98->unk4A[2][3]++; - gUnknown_02022C98->unk4A[3][3]++; - break; - case 1: - gUnknown_02022C98->unk4A[3][3]++; - break; - case 2: - gUnknown_02022C98->unk4A[3][3]++; - gUnknown_02022C98->unk4A[4][3]++; - break; - case 3: - gUnknown_02022C98->unk4A[4][3]++; - break; - case 4: - gUnknown_02022C98->unk4A[4][3]++; - gUnknown_02022C98->unk4A[0][3]++; - break; - case 5: - gUnknown_02022C98->unk4A[0][3]++; - break; - case 6: - gUnknown_02022C98->unk4A[0][3]++; - gUnknown_02022C98->unk4A[1][3]++; - break; - case 7: - gUnknown_02022C98->unk4A[1][3]++; - break; - case 8: - gUnknown_02022C98->unk4A[1][3]++; - gUnknown_02022C98->unk4A[2][3]++; - break; - case 9: - gUnknown_02022C98->unk4A[2][3]++; - break; - } - break; - case 4: - switch (arg1) - { - case 1: - gUnknown_02022C98->unk4A[2][3]++; - gUnknown_02022C98->unk4A[3][3]++; - break; - case 2: - gUnknown_02022C98->unk4A[3][3]++; - break; - case 3: - gUnknown_02022C98->unk4A[3][3]++; - gUnknown_02022C98->unk4A[0][3]++; - break; - case 4: - gUnknown_02022C98->unk4A[0][3]++; - break; - case 5: - gUnknown_02022C98->unk4A[0][3]++; - gUnknown_02022C98->unk4A[1][3]++; - break; - case 6: - gUnknown_02022C98->unk4A[1][3]++; - break; - case 7: - gUnknown_02022C98->unk4A[1][3]++; - gUnknown_02022C98->unk4A[2][3]++; - break; - case 8: - gUnknown_02022C98->unk4A[2][3]++; - break; - } - break; - case 3: - switch (arg1) - { - case 2: - gUnknown_02022C98->unk4A[1][3]++; - gUnknown_02022C98->unk4A[2][3]++; - break; - case 3: - gUnknown_02022C98->unk4A[2][3]++; - break; - case 4: - gUnknown_02022C98->unk4A[2][3]++; - gUnknown_02022C98->unk4A[0][3]++; - break; - case 5: - gUnknown_02022C98->unk4A[0][3]++; - break; - case 6: - gUnknown_02022C98->unk4A[0][3]++; - gUnknown_02022C98->unk4A[1][3]++; - break; - case 7: - gUnknown_02022C98->unk4A[1][3]++; - break; - } - break; - case 2: - switch (arg1) - { - case 3: - gUnknown_02022C98->unk4A[0][3]++; - gUnknown_02022C98->unk4A[1][3]++; - break; - case 4: - gUnknown_02022C98->unk4A[0][3]++; - break; - case 5: - gUnknown_02022C98->unk4A[0][3]++; - gUnknown_02022C98->unk4A[1][3]++; - break; - case 6: - gUnknown_02022C98->unk4A[1][3]++; - break; - } - break; - } - break; - } -} - -static void sub_8027234(bool32 arg0) -{ - if (gUnknown_02022C98->unk24 != 5) - return; - - if (arg0 == TRUE) - { - if (++gUnknown_02022C98->unk112 > gUnknown_02022C98->unk114) - gUnknown_02022C98->unk114 = gUnknown_02022C98->unk112; - if (gUnknown_02022C98->unk112 > 9999) - gUnknown_02022C98->unk112 = 9999; - } - else - { - if (gUnknown_02022C98->unk112 > gUnknown_02022C98->unk114) - gUnknown_02022C98->unk114 = gUnknown_02022C98->unk112; - gUnknown_02022C98->unk112 = 0; - } -} - -static void sub_80272A4(void) -{ - u8 i; - for (i = 0; i < gUnknown_02022C98->unk24; i++) - gUnknown_02022C98->unk4A[i][5] = gUnknown_02022C98->unk114; -} - -static void sub_80272E8(void) -{ - u8 i, j; - - for (i = 0; i < 5; i++) - { - for (j = 0; j < 11; j++) - gUnknown_02022C98->unk31A0[i].unk14.unkB[j] = 0; - gUnknown_02022C98->unk31A0[i].unk2C.unk0 = 0; - gUnknown_02022C98->unk31A0[i].unk2C.unk4 = 0; - gUnknown_02022C98->unk90[i] = 0; - gUnknown_02022C98->unk86[i] = 0; - gUnknown_02022C98->unk3308[i].unk0 = 0; - gUnknown_02022C98->unk3308[i].unk4 = 0; - gUnknown_02022C98->unk4A[i][0] = 0; - gUnknown_02022C98->unk4A[i][1] = 0; - gUnknown_02022C98->unk4A[i][2] = 0; - gUnknown_02022C98->unk4A[i][3] = 0; - gUnknown_02022C98->unk4A[i][4] = 0; - gUnknown_02022C98->unk4A[i][5] = 0; - } - gUnknown_02022C98->unk154 = 0; - gUnknown_02022C98->unk112 = 0; - gUnknown_02022C98->unk40 = 0; - sub_8026A88(); - sub_8026988(); -} - -static const s16 gUnknown_082F7B24[] = {10, 30, 50, 50}; - -static void sub_80273F0(void) -{ - u8 i, var = 0, var2 = 0; - - switch (gUnknown_02022C98->unk24) - { - case 4: var = 1; break; - case 5: var = 2; break; - } - - var2 = Random() % 10; - for (i = 0; i < 5; i++) - gUnknown_02022C98->unk4A[i][4] = gUnknown_082F7AA4[var][var2]; -} - -static u32 sub_802745C(u8 arg0) -{ - u32 sum = gUnknown_02022C98->unk4A[arg0][0] - + gUnknown_02022C98->unk4A[arg0][1] - + gUnknown_02022C98->unk4A[arg0][2]; - return min(sum, 9999); -} - -static void sub_802749C(void) -{ - u32 berriesPicked = Min(sub_802745C(gUnknown_02022C98->multiplayerId), 9999); - u32 score = Min(sub_80276C0(gUnknown_02022C98->multiplayerId), 999990); - - if (gSaveBlock2Ptr->berryPick.bestScore < score) - gSaveBlock2Ptr->berryPick.bestScore = score; - if (gSaveBlock2Ptr->berryPick.berriesPicked < berriesPicked) - gSaveBlock2Ptr->berryPick.berriesPicked = berriesPicked; - if (gSaveBlock2Ptr->berryPick.berriesPickedInRow < gUnknown_02022C98->unk114) - gSaveBlock2Ptr->berryPick.berriesPickedInRow = gUnknown_02022C98->unk114; -} - -static u8 sub_8027518(u8 arg0) -{ - u8 i, saved; - - saved = gUnknown_02022C98->unk98[3]; - for (i = 3; i != 0; i--) - gUnknown_02022C98->unk98[i] = gUnknown_02022C98->unk98[i - 1]; - gUnknown_02022C98->unk98[0] = arg0; - return saved; -} - -static void sub_8027554(void) -{ - if (gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] == 0) - { - if (JOY_NEW(DPAD_UP)) - { - gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 2; - gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6; - PlaySE(SE_M_CHARM); - } - else if (JOY_NEW(DPAD_LEFT)) - { - gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 3; - gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6; - PlaySE(SE_M_CHARM); - } - else if (JOY_NEW(DPAD_RIGHT)) - { - gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 1; - gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6; - PlaySE(SE_M_CHARM); - } - else - { - gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 0; - } - } - else - { - gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId]--; - } -} - -static void sub_8027608(void) -{ - gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 0; -} - -static u16 sub_802762C(void) -{ - return gUnknown_02022C98->unk4A[gUnknown_02022C98->multiplayerId][4] + FIRST_BERRY_INDEX; -} - -static u8 sub_8027650(void) -{ - return gUnknown_02022C98->unk24; -} - -static u8 *sub_8027660(u8 id) -{ - if (gReceivedRemoteLinkPlayers) - return gLinkPlayers[id].name; - else - return gUnknown_02022C98->unk31A0[id].name; -} - -static u16 sub_80276A0(u8 arg0, u8 arg1) -{ - return gUnknown_02022C98->unk4A[arg0][arg1]; -} - -static u32 sub_80276C0(u8 arg0) -{ - u8 i; - u32 var, sum = 0; - - for (i = 0; i < 3; i++) - sum += gUnknown_02022C98->unk4A[arg0][i] * gUnknown_082F7B24[i]; - - var = gUnknown_02022C98->unk4A[arg0][3] * gUnknown_082F7B24[3]; - if (sum <= var) - return 0; - else - return sum - var; -} - -static u32 sub_8027748(void) -{ - u8 i, count = gUnknown_02022C98->unk24; - u32 maxVar = sub_80276C0(0); - - for (i = 1; i < count; i++) - { - u32 var = sub_80276C0(i); - if (var > maxVar) - maxVar = var; - } - return Min(maxVar, 999990); -} - -static u32 sub_802778C(u8 arg0) -{ - u8 i, count = gUnknown_02022C98->unk24; - u16 maxVar = gUnknown_02022C98->unk4A[0][arg0]; - - for (i = 0; i < count; i++) - { - u16 var = gUnknown_02022C98->unk4A[i][arg0]; - if (var > maxVar) - maxVar = var; - } - return maxVar; -} - -static u32 sub_80277D0(u8 arg0) -{ - u32 vals[5], temp; - s16 r6 = TRUE; - u8 i, count = gUnknown_02022C98->unk24; - - for (i = 0; i < count; i++) - vals[i] = temp = sub_80276C0(i); - - while (r6) - { - r6 = FALSE; - for (i = 0; i < count - 1; i++) - { - if (vals[i] < vals[i + 1]) - { - SWAP(vals[i], vals[i + 1], temp); - r6 = TRUE; - } - } - } - - return vals[arg0]; -} - -static u32 sub_802784C(void) -{ - u8 i, r10 = 0, r8 = 0, r9 = 0, count = gUnknown_02022C98->unk24; - - // Function called two times for some reason. - sub_8027748(); - if (sub_8027748() == 0) - { - for (i = 0; i < count; i++) - { - gUnknown_02022C98->unk3308[i].unk0 = 4; - gUnknown_02022C98->unk3308[i].unk4 = 0; - } - } - - for (i = 0; i < count; i++) - gUnknown_02022C98->unk3308[i].unk4 = Min(sub_80276C0(i), 999990); - - do - { - u32 r6 = sub_80277D0(r10); - u8 r3 = r8; - for (i = 0; i < count; i++) - { - if (r6 == gUnknown_02022C98->unk3308[i].unk4) - { - gUnknown_02022C98->unk3308[i].unk0 = r3; - r8++; - r9++; - } - } - r10 = r8; - } while (r9 < count); - - return 0; -} - -static void sub_802793C(struct DodrioSubstruct_3308 *dst, u8 id) -{ - *dst = gUnknown_02022C98->unk3308[id]; -} - -// Unused function -static u8 sub_802795C(u8 arg0) -{ - u8 i, ret = 0, count = gUnknown_02022C98->unk24; - u32 var, vars[5] = {0}; - - for (i = 0; i < count; i++) - vars[i] = sub_80276C0(i); - - var = vars[arg0]; - for (i = 0; i < 5; i++) - { - if (i != arg0 && var < vars[i]) - ret++; - } - - return ret; -} - -static u8 sub_80279C8(void) -{ - u8 multiplayerId = gUnknown_02022C98->multiplayerId; - u16 itemId = sub_802762C(); - - if (sub_80276C0(multiplayerId) != sub_8027748()) - return 3; - if (!CheckBagHasSpace(itemId, 1)) - return 2; - - AddBagItem(itemId, 1); - if (!CheckBagHasSpace(itemId, 1)) - return 1; - return 0; -} - -// Really? What next, u32 Add(u32 a)return a+1;? -static u32 IncrementWithLimit(u32 a, u32 max) -{ - if (a < max) - return a + 1; - else - return max; -} - -// Gamefreak pls, min(a, b) ((a) < (b) ? (a) : (b)) is a well-known macro -static u32 Min(u32 a, u32 b) -{ - if (a < b) - return a; - else - return b; -} - -static u8 sub_8027A48(u8 id) -{ - return gUnknown_02022C98->unk34[id]; -} - -void IsDodrioInParty(void) -{ - int i; - for (i = 0; i < PARTY_SIZE; i++) - { - if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_HAS_SPECIES) - && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) == SPECIES_DODRIO) - { - gSpecialVar_Result = TRUE; - return; - } - } - - gSpecialVar_Result = FALSE; -} - -void ShowDodrioBerryPickingRecords(void) -{ - u8 taskId = CreateTask(Task_ShowDodrioBerryPickingRecords, 0); - Task_ShowDodrioBerryPickingRecords(taskId); -} - -// Data related to printing saved results. -static const struct WindowTemplate gUnknown_082F7B2C = -{ - .bg = 0, - .tilemapLeft = 5, - .tilemapTop = 1, - .width = 20, - .height = 11, - .paletteNum = 15, - .baseBlock = 0x1, -}; - -static const u8 *const gUnknown_082F7B34[3] = {gText_BerriesPicked, gText_BestScore, gText_BerriesInRowFivePlayers}; -static const u8 gUnknown_082F7B40[] = {4, 7, 4}; - -ALIGNED(4) -static const u8 gUnknown_082F7B44[][2] = {{25}, {41}, {57}}; -static const u8 gUnknown_082F7B4A[][2] = {{25}, {41}, {73}}; - -static void Task_ShowDodrioBerryPickingRecords(u8 taskId) -{ - struct WindowTemplate window; - s32 i, width, widthCurr; - s16 *data = gTasks[taskId].data; - - switch (data[0]) - { - case 0: - window = gUnknown_082F7B2C; - width = GetStringWidth(1, gText_BerryPickingRecords, 0); - for (i = 0; i < ARRAY_COUNT(gUnknown_082F7B34); i++) - { - widthCurr = GetStringWidth(1, gUnknown_082F7B34[i], 0) + 50; - if (widthCurr > width) - width = widthCurr; - } - width = (width + 7) / 8; - if (width & 1) - width++; - window.tilemapLeft = (30 - width) / 2; - window.width = width; - data[1] = AddWindow(&window); - sub_8027BEC(data[1], width); - CopyWindowToVram(data[1], 3); - data[0]++; - break; - case 1: - if (!IsDma3ManagerBusyWithBgCopy()) - data[0]++; - break; - case 2: - if (JOY_NEW(A_BUTTON | B_BUTTON)) - { - rbox_fill_rectangle(data[1]); - CopyWindowToVram(data[1], 1); - data[0]++; - } - break; - case 3: - if (!IsDma3ManagerBusyWithBgCopy()) - { - RemoveWindow(data[1]); - DestroyTask(taskId); - EnableBothScriptContexts(); - } - break; - } -} - -static void sub_8027BEC(u8 windowId, s32 width) -{ - s32 i, x, numWidth; - s32 results[3]; - results[0] = gSaveBlock2Ptr->berryPick.berriesPicked; - results[1] = gSaveBlock2Ptr->berryPick.bestScore; - results[2] = gSaveBlock2Ptr->berryPick.berriesPickedInRow; - - LoadUserWindowBorderGfx_(windowId, 0x21D, 0xD0); - DrawTextBorderOuter(windowId, 0x21D, 0xD); - FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); - AddTextPrinterParameterized(windowId, 1, gText_BerryPickingRecords, GetStringCenterAlignXOffset(1, gText_BerryPickingRecords, width * 8), 1, TEXT_SPEED_FF, NULL); - for (i = 0; i < 3; i++) - { - ConvertIntToDecimalStringN(gStringVar1, results[i], STR_CONV_MODE_LEFT_ALIGN, gUnknown_082F7B40[i]); - numWidth = GetStringWidth(1, gStringVar1, -1); - AddTextPrinterParameterized(windowId, 1, gUnknown_082F7B34[i], 0, gUnknown_082F7B44[i][0], TEXT_SPEED_FF, NULL); - x = (width * 8) - numWidth; - AddTextPrinterParameterized(windowId, 1, gStringVar1, x, gUnknown_082F7B4A[i][0], TEXT_SPEED_FF, NULL); - } - PutWindowTilemap(windowId); -} - -// Debug functions? -static const u16 gUnknown_082F7B50[][4] = -{ - {9999, 0, 90, 9999}, - {9999, 9999, 70, 9999}, - {9999, 0, 9999, 0}, - {9999, 9999, 60, 0}, - {9999, 9999, 9999, 0}, -}; - -static const u8 sJPText_Vowels[] = _("あいうえおかき"); -static const u8 sText_ABCDEFG[] = _("ABCDEFG"); -static const u8 sText_0123456[] = _("0123456"); - -static const u8 *const sPlaceholderPlayerNames[] = -{ - sJPText_Vowels, - sJPText_Vowels, - sJPText_Vowels, - sText_ABCDEFG, - sText_0123456 -}; - -static void sub_8027D20(void) -{ - gUnknown_02022C98->unk24 = GetLinkPlayerCount(); -} - -static void sub_8027D38(void) -{ - u8 i, playerId; - - for (playerId = gUnknown_02022C98->unk24; playerId < ARRAY_COUNT(sPlaceholderPlayerNames); playerId++) - StringCopy(gLinkPlayers[playerId].name, sPlaceholderPlayerNames[playerId]); - - gUnknown_02022C98->unk24 = 5; - for (i = 0; i < 4; i++) - { - for (playerId = 0; playerId < gUnknown_02022C98->unk24; playerId++) - gUnknown_02022C98->unk4A[playerId][i] = gUnknown_082F7B50[playerId][i]; - } -} - -struct UnkPacket1 -{ - u8 id; - u8 ALIGNED(4) unk4; -}; - -static void sub_8027DD0(u32 arg0) -{ - struct UnkPacket1 packet; - packet.id = 1; - packet.unk4 = arg0; - Rfu_SendPacket(&packet); -} - -static u32 sub_8027DFC(u32 arg0) -{ - struct UnkPacket1 *packet; - - if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET) - return 0; - - packet = (void *)&gRecvCmds[arg0][1]; - if (packet->id == 1) - return packet->unk4; - - return 0; -} - -struct UnkPacket2 -{ - u8 id; - u8 unk1_0:4; - u8 unk1_1:4; - u16 unk2_0:4; - u16 unk2_1:4; - u16 unk3_0:4; - u16 unk3_1:4; - u16 unk4_0:4; - u16 unk4_1:4; - u16 unk5_0:4; - u16 unk5_1:4; - u16 unk6_0:2; - u16 unk6_1:2; - u16 unk6_2:2; - u16 unk6_3:2; - u16 unk7_0:2; - u16 unk7_1:2; - u16 unk7_2:2; - u16 unk7_3:2; - u8 unk8_0:2; - u8 unk8_1:2; - u8 unk8_2:2; - u8 unk8_3:2; - u8 unk9_0:2; - u8 unk9_1:2; - u8 unk9_2:2; - u8 unk9_3:1; - u8 unk9_4:1; - u8 unkA_0:1; - u8 unkA_1:1; - u8 unkA_2:1; - u8 unkA_3:5; - u8 unkB_0:1; - u8 unkB_1:1; - u8 unkB_2:1; - u8 unkB_3:1; - u8 unkB_4:1; - u8 unkB_5:1; - u8 unkB_6:1; -}; - -static void sub_8027E30(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 arg6, u32 arg7, u32 arg8) -{ - struct UnkPacket2 packet; - struct DodrioSubstruct_31A0_14 *ptr = &arg0->unk14; - - packet.id = 2; - packet.unk1_0 = ptr->unkB[0]; - packet.unk1_1 = ptr->unkB[1]; - packet.unk2_0 = ptr->unkB[2]; - packet.unk2_1 = ptr->unkB[3]; - packet.unk3_0 = ptr->unkB[4]; - packet.unk3_1 = ptr->unkB[5]; - packet.unk4_0 = ptr->unkB[6]; - packet.unk4_1 = ptr->unkB[7]; - packet.unk5_0 = ptr->unkB[8]; - packet.unk5_1 = ptr->unkB[9]; - - packet.unk6_0 = ptr->unk0[0]; - packet.unk6_1 = ptr->unk0[1]; - packet.unk6_2 = ptr->unk0[2]; - packet.unk6_3 = ptr->unk0[3]; - packet.unk7_0 = ptr->unk0[4]; - packet.unk7_1 = ptr->unk0[5]; - packet.unk7_2 = ptr->unk0[6]; - packet.unk7_3 = ptr->unk0[7]; - packet.unk8_0 = ptr->unk0[8]; - packet.unk8_1 = ptr->unk0[9]; - - packet.unk8_2 = arg1->unk0; - packet.unk8_3 = arg2->unk0; - packet.unk9_0 = arg3->unk0; - packet.unk9_1 = arg4->unk0; - packet.unk9_2 = arg5->unk0; - - packet.unk9_3 = arg1->unk4; - packet.unk9_4 = arg2->unk4; - packet.unkA_0 = arg3->unk4; - packet.unkA_1 = arg4->unk4; - packet.unkA_2 = arg5->unk4; - - packet.unkB_2 = arg1->unk8; - packet.unkB_3 = arg2->unk8; - packet.unkB_4 = arg3->unk8; - packet.unkB_5 = arg4->unk8; - packet.unkB_6 = arg5->unk8; - - packet.unkA_3 = arg6; - packet.unkB_1 = arg7; - packet.unkB_0 = arg8; - Rfu_SendPacket(&packet); -} - -static u32 sub_8028164(u32 unused, struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 *arg6, u32 *arg7, u32 *arg8) -{ - struct UnkPacket2 *packet; - struct DodrioSubstruct_31A0_14 *ptr = &arg0->unk14; - - if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET) - return 0; - - packet = (void *)&gRecvCmds[0][1]; - if (packet->id == 2) - { - ptr->unkB[0] = packet->unk1_0; - ptr->unkB[1] = packet->unk1_1; - ptr->unkB[2] = packet->unk2_0; - ptr->unkB[3] = packet->unk2_1; - ptr->unkB[4] = packet->unk3_0; - ptr->unkB[5] = packet->unk3_1; - ptr->unkB[6] = packet->unk4_0; - ptr->unkB[7] = packet->unk4_1; - ptr->unkB[8] = packet->unk5_0; - ptr->unkB[9] = packet->unk5_1; - ptr->unkB[10] = packet->unk1_0; - - ptr->unk0[0] = packet->unk6_0; - ptr->unk0[1] = packet->unk6_1; - ptr->unk0[2] = packet->unk6_2; - ptr->unk0[3] = packet->unk6_3; - ptr->unk0[4] = packet->unk7_0; - ptr->unk0[5] = packet->unk7_1; - ptr->unk0[6] = packet->unk7_2; - ptr->unk0[7] = packet->unk7_3; - ptr->unk0[8] = packet->unk8_0; - ptr->unk0[9] = packet->unk8_1; - ptr->unk0[10] = packet->unk6_0; - - arg1->unk0 = packet->unk8_2; - arg1->unk4 = packet->unk9_3; - arg1->unk8 = packet->unkB_2; - - arg2->unk0 = packet->unk8_3; - arg2->unk4 = packet->unk9_4; - arg2->unk8 = packet->unkB_3; - - arg3->unk0 = packet->unk9_0; - arg3->unk4 = packet->unkA_0; - arg3->unk8 = packet->unkB_4; - - arg4->unk0 = packet->unk9_1; - arg4->unk4 = packet->unkA_1; - arg4->unk8 = packet->unkB_5; - - arg5->unk0 = packet->unk9_2; - arg5->unk4 = packet->unkA_2; - arg5->unk8 = packet->unkB_6; - - *arg6 = packet->unkA_3; - *arg7 = packet->unkB_1; - *arg8 = packet->unkB_0; - return 1; - } - - return 0; -} - -struct UnkPacket3 -{ - u8 id; - u8 ALIGNED(4) unk4; -}; - -static void sub_80282EC(u8 arg0) -{ - struct UnkPacket3 packet; - packet.id = 3; - packet.unk4 = arg0; - Rfu_SendPacket(&packet); -} - -static u32 sub_8028318(u32 arg0, u8 *arg1) -{ - struct UnkPacket3 *packet; - - if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET) - return 0; - - packet = (void *)&gRecvCmds[arg0][1]; - if (packet->id == 3) - { - *arg1 = packet->unk4; - return 1; - } - - return 0; -} - -struct UnkPacket4 -{ - u8 id; - u32 unk4; -}; - -static void sub_8028350(u32 arg0) -{ - struct UnkPacket4 packet; - packet.id = 4; - packet.unk4 = arg0; - Rfu_SendPacket(&packet); -} - -static u32 sub_8028374(u32 arg0) -{ - struct UnkPacket4 *packet; - - if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET) - return 0; - - packet = (void *)&gRecvCmds[arg0][1]; - if (packet->id == 4) - return packet->unk4; - - return 0; -} - -// Large chunk of data -static const struct BgTemplate gUnknown_082F7BA4[] = -{ - { - .bg = 0, - .charBaseIndex = 0, - .mapBaseIndex = 30, - .screenSize = 0, - .paletteMode = 0, - .priority = 0, - .baseTile = 0 - }, - { - .bg = 1, - .charBaseIndex = 2, - .mapBaseIndex = 12, - .screenSize = 1, - .paletteMode = 0, - .priority = 1, - .baseTile = 0 - }, - { - .bg = 2, - .charBaseIndex = 2, - .mapBaseIndex = 14, - .screenSize = 1, - .paletteMode = 0, - .priority = 1, - .baseTile = 0 - }, - { - .bg = 3, - .charBaseIndex = 3, - .mapBaseIndex = 31, - .screenSize = 0, - .paletteMode = 0, - .priority = 2, - .baseTile = 0 - }, -}; - -// Unknown unreferenced data, feel free to remove. -static const u32 sUnused[] = {255, 0}; - -static const struct WindowTemplate gUnknown_082F7BBC[] = -{ - { - .bg = 0, - .tilemapLeft = 1, - .tilemapTop = 1, - .width = 28, - .height = 2, - .paletteNum = 13, - .baseBlock = 0x13, - }, - { - .bg = 0, - .tilemapLeft = 1, - .tilemapTop = 5, - .width = 28, - .height = 14, - .paletteNum = 13, - .baseBlock = 0x4B, - } -}; -static const struct WindowTemplate gUnknown_082F7BCC = -{ - .bg = 0, - .tilemapLeft = 1, - .tilemapTop = 5, - .width = 28, - .height = 7, - .paletteNum = 13, - .baseBlock = 0x4B, -}; -static const struct WindowTemplate gUnknown_082F7BD4[] = -{ - { - .bg = 0, - .tilemapLeft = 1, - .tilemapTop = 8, - .width = 19, - .height = 3, - .paletteNum = 13, - .baseBlock = 0x13, - }, - { - .bg = 0, - .tilemapLeft = 22, - .tilemapTop = 7, - .width = 6, - .height = 4, - .paletteNum = 13, - .baseBlock = 0x4C, - } -}; -static const struct WindowTemplate gUnknown_082F7BE4 = -{ - .bg = 0, - .tilemapLeft = 4, - .tilemapTop = 6, - .width = 22, - .height = 5, - .paletteNum = 13, - .baseBlock = 0x13, -}; -static const struct WindowTemplate gUnknown_082F7BEC = -{ - .bg = 0, - .tilemapLeft = 5, - .tilemapTop = 8, - .width = 19, - .height = 3, - .paletteNum = 13, - .baseBlock = 0x13, -}; - -// This is an unused copy of the tables from the top of the file. Feel free to remove. -static const u8 sDuplicateArray[] = -{ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 0, 0, 1, 2, 5, 6, 3, 4, 5, 8, 9, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 2, 9, - 0, 0, 1, 4, 5, 6, 7, 2, 3, 4, 9, 0, 0, 1, 6, 7, 2, 3, 4, 5, 6, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 1, 0, 0, 3, 4, 5, 6, 7, 8, 1, 2, 3, 0, 0, 5, 6, 7, 8, 1, 2, 3, 4, 5, 0, 0, 7, - 8, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 3, 4, 5, 6, 7, 8, 9, 0, - 1, 2, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 4, 5, 6, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 5, 5, 6, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 6, 7, 2, 2, 3, 4, 0, 0, 0, 0, 0, 0, - 3, 4, 5, 5, 6, 7, 7, 8, 1, 1, 2, 3, 0, 0, 0, 4, 5, 6, 6, 7, 8, 8, 9, 0, 0, 1, 2, 2, 3, 4, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 0, 1, - 2, 1, 2, 3, 2, 3, 0, 0, 0, 0, 4, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 0, 0, 0, 0, 9, 9, 9, 9, 1, 1, 1, 9, 9, 9, 9, 9, - 9, 9, 0, 0, 1, 1, 0, 9, 9, 9, 9, 9, 2, 2, 0, 0, 1, 1, 1, 9, 9, 9, 3, 3, 0, 0, 1, 1, 2, 2, 3, 9, 3, 3, 4, 4, 0, 0, 1, 1, - 2, 2, 3, 5, 0, 0, 0, 0, 4, 6, 0, 0, 0, 3, 5, 7, 0, 0, 2, 4, 6, 8, 0, 1, 3, 5, 6, 9 -}; - -static const u16 gDodrioBerryBgPal1[] = INCBIN_U16("graphics/link_games/dodrioberry_bg1.gbapal", - "graphics/link_games/dodrioberry_bg2.gbapal"); -static const u16 gDodrioBerryPkmnPal[] = INCBIN_U16("graphics/link_games/dodrioberry_pkmn.gbapal"); -static const u16 gDodrioBerryShinyPal[] = INCBIN_U16("graphics/link_games/dodrioberry_shiny.gbapal"); -static const u16 gDodrioBerryStatusPal[] = INCBIN_U16("graphics/link_games/dodrioberry_status.gbapal"); -static const u16 gDodrioBerrySpritesPal[] = INCBIN_U16("graphics/link_games/dodrioberry_berrysprites.gbapal"); -static const u32 gDodrioBerrySpritesGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_berrysprites.4bpp.lz"); -static const u16 gDodrioBerryPlatformPal[] = INCBIN_U16("graphics/link_games/dodrioberry_platform.gbapal"); -static const u32 gDodrioBerryBgGfx1[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.4bpp.lz"); -static const u32 gDodrioBerryBgGfx2[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2.4bpp.lz"); -static const u32 gDodrioBerryStatusGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_status.4bpp.lz"); -static const u32 gDodrioBerryPlatformGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_platform.4bpp.lz"); -static const u32 gDodrioBerryPkmnGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_pkmn.4bpp.lz"); -static const u32 gDodrioBerryBgTilemap1[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.bin.lz"); -static const u32 gDodrioBerryBgTilemap2Right[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2right.bin.lz"); -static const u32 gDodrioBerryBgTilemap2Left[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2left.bin.lz"); - -static const struct OamData sOamData_82FB1E0 = +static const u16 sBg_Pal[] = INCBIN_U16("graphics/dodrio_berry_picking/bg.gbapal", + "graphics/dodrio_berry_picking/tree_border.gbapal"); +static const u16 sDodrioNormal_Pal[] = INCBIN_U16("graphics/dodrio_berry_picking/dodrio.gbapal"); +static const u16 sDodrioShiny_Pal[] = INCBIN_U16("graphics/dodrio_berry_picking/shiny.gbapal"); +static const u16 sStatus_Pal[] = INCBIN_U16("graphics/dodrio_berry_picking/status.gbapal"); +static const u16 sBerries_Pal[] = INCBIN_U16("graphics/dodrio_berry_picking/berries.gbapal"); +static const u32 sBerries_Gfx[] = INCBIN_U32("graphics/dodrio_berry_picking/berries.4bpp.lz"); +static const u16 sCloud_Pal[] = INCBIN_U16("graphics/dodrio_berry_picking/cloud.gbapal"); +static const u32 sBg_Gfx[] = INCBIN_U32("graphics/dodrio_berry_picking/bg.4bpp.lz"); +static const u32 sTreeBorder_Gfx[] = INCBIN_U32("graphics/dodrio_berry_picking/tree_border.4bpp.lz"); +static const u32 sStatus_Gfx[] = INCBIN_U32("graphics/dodrio_berry_picking/status.4bpp.lz"); +static const u32 sCloud_Gfx[] = INCBIN_U32("graphics/dodrio_berry_picking/cloud.4bpp.lz"); +static const u32 sDodrio_Gfx[] = INCBIN_U32("graphics/dodrio_berry_picking/dodrio.4bpp.lz"); +static const u32 sBg_Tilemap[] = INCBIN_U32("graphics/dodrio_berry_picking/bg.bin.lz"); +static const u32 sTreeBorderRight_Tilemap[] = INCBIN_U32("graphics/dodrio_berry_picking/tree_border_right.bin.lz"); +static const u32 sTreeBorderLeft_Tilemap[] = INCBIN_U32("graphics/dodrio_berry_picking/tree_border_left.bin.lz"); + +static const struct OamData sOamData_Dodrio = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -3151,7 +3620,8 @@ static const struct OamData sOamData_82FB1E0 = .affineParam = 0 }; -static const struct OamData sOamData_82FB1E8 = +// Used by the status bar and the results screen berry icons +static const struct OamData sOamData_16x16_Priority0 = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -3168,7 +3638,7 @@ static const struct OamData sOamData_82FB1E8 = .affineParam = 0 }; -static const struct OamData sOamData_82FB1F0 = +static const struct OamData sOamData_Berry = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -3185,7 +3655,7 @@ static const struct OamData sOamData_82FB1F0 = .affineParam = 0 }; -static const struct OamData sOamData_82FB1F8 = +static const struct OamData sOamData_Cloud = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -3202,533 +3672,589 @@ static const struct OamData sOamData_82FB1F8 = .affineParam = 0 }; -static const union AnimCmd sSpriteAnim_82FB200[] = +static const union AnimCmd sAnim_Dodrio_Normal[] = { ANIMCMD_FRAME(0, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_82FB208[] = +static const union AnimCmd sAnim_Dodrio_PickRight[] = { ANIMCMD_FRAME(64, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_82FB210[] = +static const union AnimCmd sAnim_Dodrio_PickMiddle[] = { ANIMCMD_FRAME(128, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_82FB218[] = +static const union AnimCmd sAnim_Dodrio_PickLeft[] = { ANIMCMD_FRAME(192, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_82FB220[] = +static const union AnimCmd sAnim_Dodrio_Down[] = { ANIMCMD_FRAME(256, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd *const sSpriteAnimTable_82FB228[] = +static const union AnimCmd *const sAnims_Dodrio[] = { - sSpriteAnim_82FB200, - sSpriteAnim_82FB208, - sSpriteAnim_82FB210, - sSpriteAnim_82FB218, - sSpriteAnim_82FB220 + [PICK_NONE] = sAnim_Dodrio_Normal, + [PICK_RIGHT] = sAnim_Dodrio_PickRight, + [PICK_MIDDLE] = sAnim_Dodrio_PickMiddle, + [PICK_LEFT] = sAnim_Dodrio_PickLeft, + [PICK_DISABLED] = sAnim_Dodrio_Down, + // There is an unused 6th frame of Dodrio's graphic }; -static const union AnimCmd sSpriteAnim_82FB23C[] = +static const union AnimCmd sAnims_StatusBar_Yellow[] = { ANIMCMD_FRAME(0, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_82FB244[] = +static const union AnimCmd sAnims_StatusBar_Gray[] = { ANIMCMD_FRAME(4, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_82FB24C[] = +static const union AnimCmd sAnims_StatusBar_Red[] = { ANIMCMD_FRAME(8, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd *const sSpriteAnimTable_82FB254[] = +static const union AnimCmd *const sAnims_StatusBar[] = { - sSpriteAnim_82FB23C, - sSpriteAnim_82FB244, - sSpriteAnim_82FB24C + [STATUS_YELLOW] = sAnims_StatusBar_Yellow, + [STATUS_GRAY] = sAnims_StatusBar_Gray, + [STATUS_RED] = sAnims_StatusBar_Red }; -static const union AnimCmd sSpriteAnim_82FB260[] = +static const union AnimCmd sAnim_Berry_Blue[] = { ANIMCMD_FRAME(0, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_82FB268[] = +static const union AnimCmd sAnim_Berry_Green[] = { ANIMCMD_FRAME(4, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_82FB270[] = +static const union AnimCmd sAnim_Berry_Gold[] = { ANIMCMD_FRAME(8, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_82FB278[] = +static const union AnimCmd sAnim_Berry_BlueSquished[] = { ANIMCMD_FRAME(12, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_82FB280[] = +static const union AnimCmd sAnim_Berry_GreenSquished[] = { ANIMCMD_FRAME(16, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_82FB288[] = +static const union AnimCmd sAnim_Berry_GoldSquished[] = { ANIMCMD_FRAME(20, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_82FB290[] = +static const union AnimCmd sAnim_Berry_Eaten[] = { ANIMCMD_FRAME(24, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_82FB298[] = +static const union AnimCmd sAnim_Berry_Empty1[] = { ANIMCMD_FRAME(28, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd sSpriteAnim_82FB2A0[] = +static const union AnimCmd sAnim_Berry_Empty2[] = { ANIMCMD_FRAME(32, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd *const sSpriteAnimTable_82FB2A8[] = +static const union AnimCmd *const sAnims_Berry[] = { - sSpriteAnim_82FB260, - sSpriteAnim_82FB268, - sSpriteAnim_82FB270, - sSpriteAnim_82FB278, - sSpriteAnim_82FB280, - sSpriteAnim_82FB288, - sSpriteAnim_82FB290, - sSpriteAnim_82FB298, - sSpriteAnim_82FB2A0 + [BERRY_BLUE] = sAnim_Berry_Blue, + [BERRY_GREEN] = sAnim_Berry_Green, + [BERRY_GOLD] = sAnim_Berry_Gold, + + [BERRY_BLUE + BERRY_MISSED] = sAnim_Berry_BlueSquished, + [BERRY_GREEN + BERRY_MISSED] = sAnim_Berry_GreenSquished, + [BERRY_GOLD + BERRY_MISSED] = sAnim_Berry_GoldSquished, + + [ANIM_EATEN] = sAnim_Berry_Eaten, + + sAnim_Berry_Empty1, + sAnim_Berry_Empty2 }; -static const union AnimCmd sSpriteAnim_82FB2CC[] = +static const union AnimCmd sAnim_Cloud[] = { ANIMCMD_FRAME(0, 20), ANIMCMD_JUMP(0) }; -static const union AnimCmd *const sSpriteAnimTable_82FB2D4[] = +static const union AnimCmd *const sAnims_Cloud[] = { - sSpriteAnim_82FB2CC + sAnim_Cloud }; -static void sub_80283A8(void) +static void LoadDodrioGfx(void) { void *ptr = AllocZeroed(0x3000); - struct SpritePalette pal1 = {gDodrioBerryPkmnPal, 0}; - struct SpritePalette pal2 = {gDodrioBerryShinyPal, 1}; + struct SpritePalette normal = {sDodrioNormal_Pal, PALTAG_DODRIO_NORMAL}; + struct SpritePalette shiny = {sDodrioShiny_Pal, PALTAG_DODRIO_SHINY}; - LZ77UnCompWram(gDodrioBerryPkmnGfx, ptr); - // This check should be one line up. - if (ptr != NULL) + LZ77UnCompWram(sDodrio_Gfx, ptr); + if (ptr) { - struct SpriteSheet sheet = {ptr, 0x3000, 0}; + struct SpriteSheet sheet = {ptr, 0x3000, GFXTAG_DODRIO}; LoadSpriteSheet(&sheet); Free(ptr); } - LoadSpritePalette(&pal1); - LoadSpritePalette(&pal2); + LoadSpritePalette(&normal); + LoadSpritePalette(&shiny); } -static void sub_8028408(struct DodrioSubstruct_318C *arg0, u8 arg1, u8 id, u8 arg3) +static void CreateDodrioSprite(struct DodrioGame_MonInfo * monInfo, u8 playerId, u8 id, u8 numPlayers) { - struct SpriteTemplate sprTemplate = + struct SpriteTemplate template = { - .tileTag = 0, - .paletteTag = arg0->isShiny, - .oam = &sOamData_82FB1E0, - .anims = sSpriteAnimTable_82FB228, + .tileTag = GFXTAG_DODRIO, + .paletteTag = monInfo->isShiny, // PALTAG_DODRIO_NORMAL / PALTAG_DODRIO_SHINY + .oam = &sOamData_Dodrio, + .anims = sAnims_Dodrio, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80284A8, + .callback = SpriteCB_Dodrio, }; - gUnknown_02022C9C[id] = AllocZeroed(4); - *gUnknown_02022C9C[id] = CreateSprite(&sprTemplate, sub_8028F14(arg1, arg3), 136, 3); - sub_8028654(TRUE, id); + sDodrioSpriteIds[id] = AllocZeroed(4); + *sDodrioSpriteIds[id] = CreateSprite(&template, GetDodrioXPos(playerId, numPlayers), 136, 3); + SetDodrioInvisibility(TRUE, id); } -static void sub_80284A8(struct Sprite *sprite) +#define sState data[0] +#define sTimer data[1] +#define sUnused1 data[2] +#define sUnused2 data[3] +#define sUnused3 data[4] + +static void SpriteCB_Dodrio(struct Sprite *sprite) { - switch (sprite->data[0]) + switch (sprite->sState) { case 0: break; case 1: - sub_802853C(sprite); + DoDodrioMissedAnim(sprite); break; case 2: - sub_80285AC(sprite); + DoDodrioIntroAnim(sprite); break; } } -static void sub_80284CC(u8 unused) +static void StartDodrioMissedAnim(u8 unused) { - struct Sprite *sprite = &gSprites[*gUnknown_02022C9C[GetMultiplayerId()]]; - sprite->data[0] = 1; - sprite->data[1] = 0; - sprite->data[2] = 0; - sprite->data[3] = 0; - sprite->data[4] = 0; + struct Sprite *sprite = &gSprites[*sDodrioSpriteIds[GetMultiplayerId()]]; + sprite->sState = 1; + sprite->sTimer = 0; + sprite->sUnused1 = 0; + sprite->sUnused2 = 0; + sprite->sUnused3 = 0; } -static void sub_8028504(u8 unused) +static void StartDodrioIntroAnim(u8 unused) { - struct Sprite *sprite = &gSprites[*gUnknown_02022C9C[GetMultiplayerId()]]; - sprite->data[0] = 2; - sprite->data[1] = 0; - sprite->data[2] = 0; - sprite->data[3] = 0; - sprite->data[4] = 0; + struct Sprite *sprite = &gSprites[*sDodrioSpriteIds[GetMultiplayerId()]]; + sprite->sState = 2; + sprite->sTimer = 0; + sprite->sUnused1 = 0; + sprite->sUnused2 = 0; + sprite->sUnused3 = 0; } -static u32 sub_802853C(struct Sprite *sprite) +// Do animation where Dodrio shakes horizontally after reaching for a berry and missing +static u32 DoDodrioMissedAnim(struct Sprite *sprite) { - s8 var; - u8 mod = (++sprite->data[1] / 2) % 4; + s8 x; + u8 state = (++sprite->sTimer / 2) % 4; - if (sprite->data[1] >= 3) + if (sprite->sTimer >= 3) { - switch (mod) + switch (state) { default: - var = 1; + x = 1; break; case 1: case 2: - var = -1; + x = -1; break; } - sprite->pos1.x += var; - if (++sprite->data[1] >= 40) + sprite->pos1.x += x; + if (++sprite->sTimer >= 40) { - sprite->data[0] = 0; - sprite->pos1.x = sub_8028F14(0, sub_8027650()); + sprite->sState = 0; + sprite->pos1.x = GetDodrioXPos(0, GetNumPlayers()); } } return 0; } -static u32 sub_80285AC(struct Sprite *sprite) -{ - u8 mod = (++sprite->data[1] / 13) % 4; +// Does the intro animation where the player's Dodrio +// cycles through extending each head twice +#define FRAMES_PER_STATE 13 +#define NUM_INTRO_PICK_STATES PICK_DISABLED // Cycle through 'Normal' and each head, but exclude the Disabled state - if (sprite->data[1] % 13 == 0 && mod != 0) +static u32 DoDodrioIntroAnim(struct Sprite *sprite) +{ + u8 pickState = (++sprite->sTimer / FRAMES_PER_STATE) % NUM_INTRO_PICK_STATES; + + // Play a sound effect at the start of each head extension + if (sprite->sTimer % FRAMES_PER_STATE == 0 && pickState != PICK_NONE) PlaySE(SE_M_CHARM); - if (sprite->data[1] >= 104) + + if (sprite->sTimer >= FRAMES_PER_STATE * NUM_INTRO_PICK_STATES * 2) { - sprite->data[0] = 0; - mod = 0; + // End animation + sprite->sState = 0; + pickState = PICK_NONE; } - sub_80286B4(GetMultiplayerId(), mod); + SetDodrioAnim(GetMultiplayerId(), pickState); return 0; } -static void sub_8028614(u8 count) +#undef sState +#undef sTimer +#undef sUnused1 +#undef sUnused2 +#undef sUnused3 + +static void FreeDodrioSprites(u8 numPlayers) { u8 i; - for (i = 0; i < count; i++) + for (i = 0; i < numPlayers; i++) { - struct Sprite *sprite = &gSprites[*gUnknown_02022C9C[i]]; - if (sprite != NULL) + struct Sprite *sprite = &gSprites[*sDodrioSpriteIds[i]]; + if (sprite) DestroySpriteAndFreeResources(sprite); - // Memory should be freed here but is not. +#ifdef BUGFIX + FREE_AND_SET_NULL(sDodrioSpriteIds[i]); // Memory should be freed here but is not. +#endif } } -static void sub_8028654(bool8 invisible, u8 id) +static void SetDodrioInvisibility(bool8 invisible, u8 id) { - gSprites[*gUnknown_02022C9C[id]].invisible = invisible; + gSprites[*sDodrioSpriteIds[id]].invisible = invisible; } -static void sub_802868C(bool8 invisible, u8 count) +static void SetAllDodrioInvisibility(bool8 invisible, u8 count) { u8 i; for (i = 0; i < count; i++) - sub_8028654(invisible, i); + SetDodrioInvisibility(invisible, i); } -static void sub_80286B4(u8 id, u8 frameNum) +static void SetDodrioAnim(u8 id, u8 pickState) { - StartSpriteAnim(&gSprites[*gUnknown_02022C9C[id]], frameNum); + StartSpriteAnim(&gSprites[*sDodrioSpriteIds[id]], pickState); } -static void nullsub_15(struct Sprite *sprite) +static void SpriteCB_Status(struct Sprite *sprite) { } -static void sub_80286E4(void) +static void InitStatusBarPos(void) { u8 i; - for (i = 0; i < 10; i++) + for (i = 0; i < NUM_STATUS_SQUARES; i++) { - struct Sprite *sprite = &gSprites[gUnknown_02022CF4->unk2A[i]]; + struct Sprite *sprite = &gSprites[sStatusBar->spriteIds[i]]; sprite->pos1.x = (i * 16) + 48; sprite->pos1.y = -8 - (i * 8); - gUnknown_02022CF4->unkC[i] = 0; + sStatusBar->entered[i] = FALSE; } } -static void sub_8028734(void) +static void CreateStatusBarSprites(void) { u8 i; void *ptr = AllocZeroed(0x180); - struct SpritePalette spPal = {gDodrioBerryStatusPal, 2}; + struct SpritePalette pal = {sStatus_Pal, PALTAG_STATUS}; - LZ77UnCompWram(gDodrioBerryStatusGfx, ptr); + LZ77UnCompWram(sStatus_Gfx, ptr); // This check should be one line up. - if (ptr != NULL) + if (ptr) { - struct SpriteSheet spSheet = {ptr, 0x180, 1}; - struct SpriteTemplate spTemplate = + struct SpriteSheet sheet = {ptr, 0x180, GFXTAG_STATUS}; + struct SpriteTemplate template = { - .tileTag = 1, - .paletteTag = 2, - .oam = &sOamData_82FB1E8, - .anims = sSpriteAnimTable_82FB254, + .tileTag = GFXTAG_STATUS, + .paletteTag = PALTAG_STATUS, + .oam = &sOamData_16x16_Priority0, + .anims = sAnims_StatusBar, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = nullsub_15, + .callback = SpriteCB_Status, }; - gUnknown_02022CF4 = AllocZeroed(sizeof(*gUnknown_02022CF4)); - LoadSpriteSheet(&spSheet); - LoadSpritePalette(&spPal); - for (i = 0; i < 10; i++) - gUnknown_02022CF4->unk2A[i] = CreateSprite(&spTemplate, (i * 16) + 48, -8 - (i * 8), 0); + sStatusBar = AllocZeroed(sizeof(*sStatusBar)); + LoadSpriteSheet(&sheet); + LoadSpritePalette(&pal); + for (i = 0; i < NUM_STATUS_SQUARES; i++) + sStatusBar->spriteIds[i] = CreateSprite(&template, (i * 16) + 48, -8 - (i * 8), 0); } Free(ptr); } -static void sub_80287E4(void) +static void FreeStatusBar(void) { u8 i; - for (i = 0; i < 10; i++) + for (i = 0; i < NUM_STATUS_SQUARES; i++) { - struct Sprite *sprite = &gSprites[gUnknown_02022CF4->unk2A[i]]; - if (sprite != NULL) + struct Sprite *sprite = &gSprites[sStatusBar->spriteIds[i]]; + if (sprite) DestroySpriteAndFreeResources(sprite); } - FREE_AND_SET_NULL(gUnknown_02022CF4); + FREE_AND_SET_NULL(sStatusBar); } -static bool32 sub_8028828(void) +// Progress an animation where each square of the +// status bar drops down into view, bounces up, +// then settles into position. +// Returns TRUE if the animation is complete +static bool32 DoStatusBarIntro(void) { u8 i; - bool32 r3 = FALSE; - for (i = 0; i < 10; i++) + bool32 animActive = FALSE; + for (i = 0; i < NUM_STATUS_SQUARES; i++) { - struct Sprite *sprite = &gSprites[gUnknown_02022CF4->unk2A[i]]; - gUnknown_02022CF4->unk16[i] = 2; - if (gUnknown_02022CF4->unkC[i] != 0 && sprite->pos1.y == 8) + struct Sprite *sprite = &gSprites[sStatusBar->spriteIds[i]]; + sStatusBar->yChange[i] = 2; + if (sStatusBar->entered[i] && sprite->pos1.y == 8) continue; - r3 = TRUE; + + animActive = TRUE; if (sprite->pos1.y == 8) { - if (gUnknown_02022CF4->unkC[i] != 0) + if (sStatusBar->entered[i]) continue; - gUnknown_02022CF4->unkC[i] = 1; - gUnknown_02022CF4->unk16[i] = -16; + + // Square has entered screen, play click + // sound and reverse direction + sStatusBar->entered[i] = TRUE; + sStatusBar->yChange[i] = -16; PlaySE(SE_CLICK); } - sprite->pos1.y += gUnknown_02022CF4->unk16[i]; + sprite->pos1.y += sStatusBar->yChange[i]; } - if (r3) + if (animActive) return FALSE; else return TRUE; } -static void sub_80288D4(u8 arg0) +// The status bar at the top changes color depending on the game performance. +// The squares start out yellow. For every berry missed, a square is colored gray. +// If there are 4 or fewer yellow squares left they also flash red +static void UpdateStatusBarAnim(u8 numEmpty) { u8 i; - if (arg0 > 10) + if (numEmpty > NUM_STATUS_SQUARES) { - for (i = 0; i < 10; i++) - StartSpriteAnim(&gSprites[gUnknown_02022CF4->unk2A[i]], 1); + // All squares gray + for (i = 0; i < NUM_STATUS_SQUARES; i++) + StartSpriteAnim(&gSprites[sStatusBar->spriteIds[i]], STATUS_GRAY); } else { - for (i = 0; i < 10 - arg0; i++) + // At least 1 square is yellow + for (i = 0; i < NUM_STATUS_SQUARES - numEmpty; i++) { - if (arg0 > 6) + if (numEmpty > 6) { - gUnknown_02022CF4->unk3E += arg0 - 6; - if (gUnknown_02022CF4->unk3E > 30) - gUnknown_02022CF4->unk3E = 0; - else if (gUnknown_02022CF4->unk3E > 10) - StartSpriteAnim(&gSprites[gUnknown_02022CF4->unk2A[i]], 2); + // Flash the yellow squares red + // The flash cycles faster the fewer yellow squares remain + sStatusBar->flashTimer += numEmpty - 6; + if (sStatusBar->flashTimer > 30) + sStatusBar->flashTimer = 0; + else if (sStatusBar->flashTimer > 10) + StartSpriteAnim(&gSprites[sStatusBar->spriteIds[i]], STATUS_RED); else - StartSpriteAnim(&gSprites[gUnknown_02022CF4->unk2A[i]], 0); + StartSpriteAnim(&gSprites[sStatusBar->spriteIds[i]], STATUS_YELLOW); } else { - StartSpriteAnim(&gSprites[gUnknown_02022CF4->unk2A[i]], 0); + // Set yellow squares, no flash + StartSpriteAnim(&gSprites[sStatusBar->spriteIds[i]], STATUS_YELLOW); } } - for (; i < 10; i++) - StartSpriteAnim(&gSprites[gUnknown_02022CF4->unk2A[i]], 1); + + // Set remaining squares gray + for (; i < NUM_STATUS_SQUARES; i++) + StartSpriteAnim(&gSprites[sStatusBar->spriteIds[i]], STATUS_GRAY); } } -static void sub_80289E8(bool8 invisible) +static void SetStatusBarInvisibility(bool8 invisible) { u8 i; - for (i = 0; i < 10; i++) - gSprites[gUnknown_02022CF4->unk2A[i]].invisible = invisible; + for (i = 0; i < NUM_STATUS_SQUARES; i++) + gSprites[sStatusBar->spriteIds[i]].invisible = invisible; } -// Unknown unused data, feel free to remove. -static const u8 sUnused2[] = {0xD4, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0xFB, 0x0, 0x0}; +static const u8 sUnusedSounds[] = { + SE_M_CHARM, + SE_NOTE_C, + SE_NOTE_D, + SE_NOTE_E, + SE_NOTE_F, + SE_NOTE_G, + SE_NOTE_A, + SE_NOTE_B, + SE_NOTE_C_HIGH, + SE_RG_CARD_OPEN +}; -static void sub_8028A34(void) +static void LoadBerryGfx(void) { void *ptr = AllocZeroed(0x480); - struct SpritePalette sprPal = {gDodrioBerrySpritesPal, 3}; + struct SpritePalette pal = {sBerries_Pal, PALTAG_BERRIES}; - LZ77UnCompWram(gDodrioBerrySpritesGfx, ptr); - if (ptr != NULL) + LZ77UnCompWram(sBerries_Gfx, ptr); + if (ptr) { - struct SpriteSheet sprSheet = {ptr, 0x480, 2}; - LoadSpriteSheet(&sprSheet); + struct SpriteSheet sheet = {ptr, 0x480, GFXTAG_BERRIES}; + LoadSpriteSheet(&sheet); } - LoadSpritePalette(&sprPal); + LoadSpritePalette(&pal); Free(ptr); } -static const s16 gUnknown_082FB31C[] = {88, 128, 168, 208}; +static const s16 sBerryIconXCoords[] = {88, 128, 168, 208}; -static void sub_8028A88(void) +static void CreateBerrySprites(void) { u8 i; s16 x; - struct SpriteTemplate sprTemplate1 = + struct SpriteTemplate berry = { - .tileTag = 2, - .paletteTag = 3, - .oam = &sOamData_82FB1F0, - .anims = sSpriteAnimTable_82FB2A8, + .tileTag = GFXTAG_BERRIES, + .paletteTag = PALTAG_BERRIES, + .oam = &sOamData_Berry, + .anims = sAnims_Berry, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy, }; - struct SpriteTemplate sprTemplate2 = + struct SpriteTemplate berryIcon = { - .tileTag = 2, - .paletteTag = 3, - .oam = &sOamData_82FB1E8, - .anims = sSpriteAnimTable_82FB2A8, + .tileTag = GFXTAG_BERRIES, + .paletteTag = PALTAG_BERRIES, + .oam = &sOamData_16x16_Priority0, + .anims = sAnims_Berry, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy, }; - for (i = 0; i < 11; i++) + // Create berry sprites that fall during gameplay + for (i = 0; i < NUM_BERRY_COLUMNS; i++) { - gUnknown_02022CB8[i] = AllocZeroed(4); + sBerrySpriteIds[i] = AllocZeroed(4); x = i * 16; - *gUnknown_02022CB8[i] = CreateSprite(&sprTemplate1, x + (i * 8), 8, 1); - sub_8028BF8(i, TRUE); - } - for (i = 0; i < 4; i++) - { - gUnknown_02022CE4[i] = AllocZeroed(4); - if (i == 3) - *gUnknown_02022CE4[i] = CreateSprite(&sprTemplate2, gUnknown_082FB31C[i], 49, 0); - else - *gUnknown_02022CE4[i] = CreateSprite(&sprTemplate2, gUnknown_082FB31C[i], 52, 0); - StartSpriteAnim(&gSprites[*gUnknown_02022CE4[i]], i); + *sBerrySpriteIds[i] = CreateSprite(&berry, x + (i * 8), 8, 1); + SetBerryInvisibility(i, TRUE); } - sub_8028C30(TRUE); + // Create berry icon sprites for results screen + for (i = 0; i < NUM_BERRY_TYPES; i++) + { + sBerryIconSpriteIds[i] = AllocZeroed(4); + if (i == BERRY_MISSED) + *sBerryIconSpriteIds[i] = CreateSprite(&berryIcon, sBerryIconXCoords[i], 49, 0); + else + *sBerryIconSpriteIds[i] = CreateSprite(&berryIcon, sBerryIconXCoords[i], 52, 0); + StartSpriteAnim(&gSprites[*sBerryIconSpriteIds[i]], i); + } + SetBerryIconsInvisibility(TRUE); } -static void sub_8028B80(void) +static void FreeBerrySprites(void) { struct Sprite *sprite; u8 i; - for (i = 0; i < 11; i++) + for (i = 0; i < NUM_BERRY_COLUMNS; i++) { - sprite = &gSprites[*gUnknown_02022CB8[i]]; - if (sprite != NULL) + sprite = &gSprites[*sBerrySpriteIds[i]]; + if (sprite) DestroySprite(sprite); - FREE_AND_SET_NULL(gUnknown_02022CB8[i]); + FREE_AND_SET_NULL(sBerrySpriteIds[i]); } - for (i = 0; i < 4; i++) + for (i = 0; i < NUM_BERRY_TYPES; i++) { - sprite = &gSprites[*gUnknown_02022CE4[i]]; - if (sprite != NULL) + sprite = &gSprites[*sBerryIconSpriteIds[i]]; + if (sprite) DestroySprite(sprite); - FREE_AND_SET_NULL(gUnknown_02022CE4[i]); + FREE_AND_SET_NULL(sBerryIconSpriteIds[i]); } } -static void sub_8028BF8(u8 id, bool8 invisible) +static void SetBerryInvisibility(u8 id, bool8 invisible) { - gSprites[*gUnknown_02022CB8[id]].invisible = invisible; + gSprites[*sBerrySpriteIds[id]].invisible = invisible; } -static void sub_8028C30(bool8 invisible) +static void SetBerryIconsInvisibility(bool8 invisible) { u8 i; - for (i = 0; i < 4; i++) - gSprites[*gUnknown_02022CE4[i]].invisible = invisible; + for (i = 0; i < NUM_BERRY_TYPES; i++) + gSprites[*sBerryIconSpriteIds[i]].invisible = invisible; } -static void sub_8028C7C(u8 id, u8 y) +static void SetBerryYPos(u8 id, u8 y) { - gSprites[*gUnknown_02022CB8[id]].pos1.y = y * 8; + gSprites[*sBerrySpriteIds[id]].pos1.y = y * 8; } -static void sub_8028CA4(u16 id, u8 frameNum) +static void SetBerryAnim(u16 id, u8 animNum) { - StartSpriteAnim(&gSprites[*gUnknown_02022CB8[id]], frameNum); + StartSpriteAnim(&gSprites[*sBerrySpriteIds[id]], animNum); } // Unused -static void sub_8028CD0(u8 spriteId) +static void UnusedSetSpritePos(u8 spriteId) { gSprites[spriteId].pos1.x = 20 * spriteId + 50; gSprites[spriteId].pos1.y = 50; @@ -3736,125 +4262,129 @@ static void sub_8028CD0(u8 spriteId) // Gamefreak made a mistake there and goes out of bounds for the data array as it holds 8 elements // in turn overwriting sprite's subpriority and subsprites fields. -#if defined(NONMATCHING) || MODERN - #define sKeepPosX data[1] +#ifdef UBFIX + #define sFrozen data[1] #else - #define sKeepPosX data[10] -#endif // NONMATCHING + #define sFrozen data[10] +#endif // UBFIX -static void sub_8028CF4(struct Sprite *sprite) +static void SpriteCB_Cloud(struct Sprite *sprite) { u8 i; - static const u8 array[] = {30, 20}; + static const u8 moveDelays[] = {30, 20}; - if (sprite->sKeepPosX != TRUE) + if (sprite->sFrozen != TRUE) { - for (i = 0; i < 2; i++) + for (i = 0; i < NUM_CLOUDS; i++) { - if (++gUnknown_02022CB0[i][1] > array[i]) + if (++sCloudSpriteIds[i][1] > moveDelays[i]) { sprite->pos1.x--; - gUnknown_02022CB0[i][1] = 0; + sCloudSpriteIds[i][1] = 0; } } } } -static const s16 gUnknown_082FB356[][2] = {{230, 55}, {30, 74}}; +static const s16 sCloudStartCoords[NUM_CLOUDS][2] = +{ + {230, 55}, + { 30, 74} +}; -static void sub_8028D44(void) +static void CreateCloudSprites(void) { u8 i; void *ptr = AllocZeroed(0x400); - struct SpritePalette sprPal = {gDodrioBerryPlatformPal, 6}; + struct SpritePalette pal = {sCloud_Pal, PALTAG_CLOUD}; - LZ77UnCompWram(gDodrioBerryPlatformGfx, ptr); - if (ptr != NULL) + LZ77UnCompWram(sCloud_Gfx, ptr); + if (ptr) { - struct SpriteSheet sprSheet = {ptr, 0x400, 5}; - struct SpriteTemplate sprTemplate = + struct SpriteSheet sheet = {ptr, 0x400, GFXTAG_CLOUD}; + struct SpriteTemplate template = { - .tileTag = 5, - .paletteTag = 6, - .oam = &sOamData_82FB1F8, - .anims = sSpriteAnimTable_82FB2D4, + .tileTag = GFXTAG_CLOUD, + .paletteTag = PALTAG_CLOUD, + .oam = &sOamData_Cloud, + .anims = sAnims_Cloud, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8028CF4, + .callback = SpriteCB_Cloud, }; - LoadSpriteSheet(&sprSheet); - LoadSpritePalette(&sprPal); - for (i = 0; i < 2; i++) + LoadSpriteSheet(&sheet); + LoadSpritePalette(&pal); + for (i = 0; i < NUM_CLOUDS; i++) { - gUnknown_02022CB0[i] = AllocZeroed(4); - *gUnknown_02022CB0[i] = CreateSprite(&sprTemplate, gUnknown_082FB356[i][0], gUnknown_082FB356[i][1], 4); + sCloudSpriteIds[i] = AllocZeroed(4); + *sCloudSpriteIds[i] = CreateSprite(&template, sCloudStartCoords[i][0], sCloudStartCoords[i][1], 4); } } Free(ptr); } -static void sub_8028DFC(void) +static void ResetCloudPos(void) { u8 i; - for (i = 0; i < 2; i++) + for (i = 0; i < NUM_CLOUDS; i++) { - struct Sprite *sprite = &gSprites[*gUnknown_02022CB0[i]]; - sprite->sKeepPosX = TRUE; - sprite->pos1.x = gUnknown_082FB356[i][0]; - sprite->pos1.y = gUnknown_082FB356[i][1]; + struct Sprite *sprite = &gSprites[*sCloudSpriteIds[i]]; + sprite->sFrozen = TRUE; + sprite->pos1.x = sCloudStartCoords[i][0]; + sprite->pos1.y = sCloudStartCoords[i][1]; } } -static void sub_8028E4C(void) +static void StartCloudMovement(void) { u8 i; - for (i = 0; i < 2; i++) + for (i = 0; i < NUM_CLOUDS; i++) { - struct Sprite *sprite = &gSprites[*gUnknown_02022CB0[i]]; - sprite->sKeepPosX = FALSE; + struct Sprite *sprite = &gSprites[*sCloudSpriteIds[i]]; + sprite->sFrozen = FALSE; } } -static void sub_8028E84(void) +static void FreeCloudSprites(void) { u8 i; - for (i = 0; i < 2; i++) + for (i = 0; i < NUM_CLOUDS; i++) { - struct Sprite *sprite = &gSprites[*gUnknown_02022CB0[i]]; + struct Sprite *sprite = &gSprites[*sCloudSpriteIds[i]]; if (sprite) DestroySprite(sprite); - FREE_AND_SET_NULL(gUnknown_02022CB0[i]); + FREE_AND_SET_NULL(sCloudSpriteIds[i]); } } -static void sub_8028EC8(bool8 invisible) +static void SetCloudInvisibility(bool8 invisible) { u8 i; - for (i = 0; i < 2; i++) - gSprites[*gUnknown_02022CB0[i]].invisible = invisible; + for (i = 0; i < NUM_CLOUDS; i++) + gSprites[*sCloudSpriteIds[i]].invisible = invisible; } -#undef sKeepPosX +#undef sFrozen -static s16 sub_8028F14(u8 arg0, u8 arg1) +static s16 GetDodrioXPos(u8 playerId, u8 numPlayers) { s16 x = 0; - switch (arg1) + switch (numPlayers) { case 1: x = 15; break; case 2: - switch (arg0) + switch (playerId) { case 0: x = 12; break; case 1: x = 18; break; } break; case 3: - switch (arg0) + switch (playerId) { case 0: x = 15; break; case 1: x = 21; break; @@ -3862,7 +4392,7 @@ static s16 sub_8028F14(u8 arg0, u8 arg1) } break; case 4: - switch (arg0) + switch (playerId) { case 0: x = 12; break; case 1: x = 18; break; @@ -3871,7 +4401,7 @@ static s16 sub_8028F14(u8 arg0, u8 arg1) } break; case 5: - switch (arg0) + switch (playerId) { case 0: x = 15; break; case 1: x = 21; break; @@ -3885,78 +4415,79 @@ static s16 sub_8028F14(u8 arg0, u8 arg1) return x * 8; } -static void sub_8028FCC(void) +static void ResetBerryAndStatusBarSprites(void) { u8 i; - for (i = 0; i < 11; i++) + for (i = 0; i < NUM_BERRY_COLUMNS; i++) { - sub_8028BF8(i, TRUE); - sub_8028C7C(i, 1); + SetBerryInvisibility(i, TRUE); + SetBerryYPos(i, 1); } - sub_80289E8(FALSE); + SetStatusBarInvisibility(FALSE); } -static void sub_8028FF8(u8 frameId) +static void LoadWindowFrameGfx(u8 frameId) { - LoadBgTiles(0, GetWindowFrameTilesPal(frameId)->tiles, 0x120, 1); + LoadBgTiles(BG_INTERFACE, GetWindowFrameTilesPal(frameId)->tiles, 0x120, 1); LoadPalette(GetWindowFrameTilesPal(frameId)->pal, 0xA0, 0x20); } -static void sub_802902C(void) +static void LoadUserWindowFrameGfx(void) { LoadUserWindowBorderGfx_(0, 0xA, 0xB0); } -static void sub_802903C(void) +static void ResetGfxState(void) { - gUnknown_02022CF8->finished = FALSE; - gUnknown_02022CF8->state = 0; - gUnknown_02022CF8->unk3018 = 0; - gUnknown_02022CF8->unk3020 = 0; - gUnknown_02022CF8->unk3024 = 0; + sGfx->finished = FALSE; + sGfx->state = 0; + sGfx->loadState = 0; + sGfx->cursorSelection = 0; + sGfx->playAgainState = PLAY_AGAIN_NONE; } -static void sub_8029074(const struct WindowTemplate *winTempl) +static void DrawYesNoMessageWindow(const struct WindowTemplate *template) { - u8 pal = 0xA; + u8 pal = 10; - FillBgTilemapBufferRect(0, 1, winTempl->tilemapLeft - 1, winTempl->tilemapTop - 1, 1, 1, pal); - FillBgTilemapBufferRect(0, 2, winTempl->tilemapLeft, winTempl->tilemapTop - 1, winTempl->width, 1, pal); - FillBgTilemapBufferRect(0, 3, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop - 1, 1, 1, pal); - FillBgTilemapBufferRect(0, 4, winTempl->tilemapLeft - 1, winTempl->tilemapTop, 1, winTempl->height, pal); - FillBgTilemapBufferRect(0, 6, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop, 1, winTempl->height, pal); - FillBgTilemapBufferRect(0, 7, winTempl->tilemapLeft - 1, winTempl->tilemapTop + winTempl->height, 1, 1, pal); - FillBgTilemapBufferRect(0, 8, winTempl->tilemapLeft, winTempl->tilemapTop + winTempl->height, winTempl->width, 1, pal); - FillBgTilemapBufferRect(0, 9, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop + winTempl->height, 1, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 1, template->tilemapLeft - 1, template->tilemapTop - 1, 1, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 2, template->tilemapLeft, template->tilemapTop - 1, template->width, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 3, template->tilemapLeft + template->width, template->tilemapTop - 1, 1, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 4, template->tilemapLeft - 1, template->tilemapTop, 1, template->height, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 6, template->tilemapLeft + template->width, template->tilemapTop, 1, template->height, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 7, template->tilemapLeft - 1, template->tilemapTop + template->height, 1, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 8, template->tilemapLeft, template->tilemapTop + template->height, template->width, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 9, template->tilemapLeft + template->width, template->tilemapTop + template->height, 1, 1, pal); } -static void sub_8029174(const struct WindowTemplate *winTempl) +static void DrawMessageWindow(const struct WindowTemplate *template) { - u8 pal = 0xB; + u8 pal = 11; - FillBgTilemapBufferRect(0, 10, winTempl->tilemapLeft - 1, winTempl->tilemapTop - 1, 1, 1, pal); - FillBgTilemapBufferRect(0, 11, winTempl->tilemapLeft, winTempl->tilemapTop - 1, winTempl->width, 1, pal); - FillBgTilemapBufferRect(0, 12, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop - 1, 1, 1, pal); - FillBgTilemapBufferRect(0, 13, winTempl->tilemapLeft - 1, winTempl->tilemapTop, 1, winTempl->height, pal); - FillBgTilemapBufferRect(0, 15, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop, 1, winTempl->height, pal); - FillBgTilemapBufferRect(0, 16, winTempl->tilemapLeft - 1, winTempl->tilemapTop + winTempl->height, 1, 1, pal); - FillBgTilemapBufferRect(0, 17, winTempl->tilemapLeft, winTempl->tilemapTop + winTempl->height, winTempl->width, 1, pal); - FillBgTilemapBufferRect(0, 18, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop + winTempl->height, 1, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 10, template->tilemapLeft - 1, template->tilemapTop - 1, 1, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 11, template->tilemapLeft, template->tilemapTop - 1, template->width, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 12, template->tilemapLeft + template->width, template->tilemapTop - 1, 1, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 13, template->tilemapLeft - 1, template->tilemapTop, 1, template->height, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 15, template->tilemapLeft + template->width, template->tilemapTop, 1, template->height, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 16, template->tilemapLeft - 1, template->tilemapTop + template->height, 1, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 17, template->tilemapLeft, template->tilemapTop + template->height, template->width, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 18, template->tilemapLeft + template->width, template->tilemapTop + template->height, 1, 1, pal); } -static void sub_8029274(struct DodrioSubstruct_0160 *ptr) +static void InitGameGfx(struct DodrioGame_Gfx *ptr) { - gUnknown_02022CF8 = ptr; - gUnknown_02022CF8->finished = FALSE; - gUnknown_02022CF8->state = 0; - gUnknown_02022CF8->unk3018 = 0; - gUnknown_02022CF8->unk3020 = 0; - gUnknown_02022CF8->unk3024 = 0; - gUnknown_02022CF8->unk3004 = CreateTask(sub_8029314, 3); - sub_802A72C(sub_8029338); + sGfx = ptr; + sGfx->finished = FALSE; + sGfx->state = 0; + sGfx->loadState = 0; + sGfx->cursorSelection = 0; + sGfx->playAgainState = PLAY_AGAIN_NONE; + sGfx->taskId = CreateTask(Task_TryRunGfxFunc, 3); + SetGfxFunc(LoadGfx); } -static void sub_80292D4(void) +// Unused +static void FreeAllWindowBuffers_(void) { FreeAllWindowBuffers(); } @@ -3968,30 +4499,37 @@ struct WinCoords u8 top; }; +enum { + COLORID_GREY, + COLORID_RED, + COLORID_BLUE, + COLORID_GREEN, // Unused +}; + static const u8 sTextColorTable[][3] = { - {TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY}, - {TEXT_COLOR_WHITE, TEXT_COLOR_RED, TEXT_COLOR_LIGHT_RED}, - {TEXT_COLOR_WHITE, TEXT_COLOR_BLUE, TEXT_COLOR_LIGHT_BLUE}, - {TEXT_COLOR_WHITE, TEXT_COLOR_GREEN, TEXT_COLOR_LIGHT_GREEN}, + [COLORID_GREY] = {TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY}, + [COLORID_RED] = {TEXT_COLOR_WHITE, TEXT_COLOR_RED, TEXT_COLOR_LIGHT_RED}, + [COLORID_BLUE] = {TEXT_COLOR_WHITE, TEXT_COLOR_BLUE, TEXT_COLOR_LIGHT_BLUE}, + [COLORID_GREEN] = {TEXT_COLOR_WHITE, TEXT_COLOR_GREEN, TEXT_COLOR_LIGHT_GREEN}, }; -static const struct WinCoords gUnknown_082FB38C[] = {{12, 6}}; -static const struct WinCoords gUnknown_082FB390[] = {{9, 10}, {15, 6}}; -static const struct WinCoords gUnknown_082FB398[] = {{12, 6}, {18, 10}, {6, 10}}; -static const struct WinCoords gUnknown_082FB3A4[] = {{9, 10}, {15, 6}, {21, 10}, {3, 6}}; -static const struct WinCoords gUnknown_082FB3B4[] = {{12, 6}, {18, 10}, {23, 6}, {1, 6}, {6, 10}}; +static const struct WinCoords sNameWindowCoords_1Player[] = {{12, 6}}; +static const struct WinCoords sNameWindowCoords_2Players[] = {{9, 10}, {15, 6}}; +static const struct WinCoords sNameWindowCoords_3Players[] = {{12, 6}, {18, 10}, {6, 10}}; +static const struct WinCoords sNameWindowCoords_4Players[] = {{9, 10}, {15, 6}, {21, 10}, {3, 6}}; +static const struct WinCoords sNameWindowCoords_5Players[] = {{12, 6}, {18, 10}, {23, 6}, {1, 6}, {6, 10}}; -static const struct WinCoords *const gUnknown_082FB3C8[] = +static const struct WinCoords *const sNameWindowCoords[MAX_RFU_PLAYERS] = { - gUnknown_082FB38C, - gUnknown_082FB390, - gUnknown_082FB398, - gUnknown_082FB3A4, - gUnknown_082FB3B4, + sNameWindowCoords_1Player, + sNameWindowCoords_2Players, + sNameWindowCoords_3Players, + sNameWindowCoords_4Players, + sNameWindowCoords_5Players, }; -static const u8 *const gUnknown_082FB3DC[] = +static const u8 *const sRankingTexts[MAX_RFU_PLAYERS] = { gText_1Colon, gText_2Colon, @@ -4000,625 +4538,640 @@ static const u8 *const gUnknown_082FB3DC[] = gText_5Colon, }; -static const u16 gUnknown_082FB3F0[] = {92, 132, 172, 212}; -static const u16 gUnknown_082FB3F8[] = {33, 49, 65, 81, 97}; -static const u16 gUnknown_082FB402[] = {17, 33, 49, 65, 81}; +static const u16 sResultsXCoords[] = {92, 132, 172, 212}; +static const u16 sResultsYCoords[] = {33, 49, 65, 81, 97}; +static const u16 sRankingYCoords[] = {17, 33, 49, 65, 81}; struct { u8 id; void (*func)(void); -} const gUnknown_082FB40C[] = +} const sGfxFuncs[] = { - {0, sub_8029338}, - {1, sub_8029440}, - {2, sub_802988C}, - {3, sub_802A010}, - {4, sub_802A380}, - {5, sub_802A454}, - {6, sub_802A534}, - {7, sub_802A588}, - {8, sub_802A6FC}, - {9, nullsub_16}, + {GFXFUNC_LOAD, LoadGfx}, // Element not used, LoadGfx is passed directly to SetGfxFunc + {GFXFUNC_SHOW_NAMES, ShowNames}, + {GFXFUNC_SHOW_RESULTS, ShowResults}, + {GFXFUNC_MSG_PLAY_AGAIN, Msg_WantToPlayAgain}, + {GFXFUNC_MSG_SAVING, Msg_SavingDontTurnOff}, + {GFXFUNC_MSG_COMM_STANDBY, Msg_CommunicationStandby}, + {GFXFUNC_ERASE_MSG, EraseMessage}, + {GFXFUNC_MSG_PLAYER_DROPPED, Msg_SomeoneDroppedOut}, + {GFXFUNC_STOP, StopGfxFuncs}, + {GFXFUNC_IDLE, GfxIdle}, }; -static void sub_80292E0(u8 arg0) +static void SetGfxFuncById(u8 funcId) { u8 i; - for (i = 0; i < 10; i++) + for (i = 0; i < ARRAY_COUNT(sGfxFuncs); i++) { - if (gUnknown_082FB40C[i].id == arg0) - sub_802A72C(gUnknown_082FB40C[i].func); + if (sGfxFuncs[i].id == funcId) + SetGfxFunc(sGfxFuncs[i].func); } } -static void sub_8029314(u8 taskId) +static void Task_TryRunGfxFunc(u8 taskId) { - if (!gUnknown_02022CF8->finished) - sub_802A75C()(); + // Continue calling function until it + // has reached its finished state. + // Another will not be called until + // readied by SetGfxFunc + if (!sGfx->finished) + GetGfxFunc()(); } -static void sub_8029338(void) +static void LoadGfx(void) { - switch (gUnknown_02022CF8->state) + switch (sGfx->state) { case 0: - sub_802A7A8(); - gUnknown_02022CF8->state++; + InitBgs(); + sGfx->state++; break; case 1: - if (sub_802A8E8() == TRUE) - gUnknown_02022CF8->state++; + if (LoadBgGfx() == TRUE) + sGfx->state++; break; case 2: - CopyToBgTilemapBuffer(3, gDodrioBerryBgTilemap1, 0, 0); - CopyToBgTilemapBuffer(1, gDodrioBerryBgTilemap2Left, 0, 0); - CopyToBgTilemapBuffer(2, gDodrioBerryBgTilemap2Right, 0, 0); - CopyBgTilemapBufferToVram(3); - CopyBgTilemapBufferToVram(1); - CopyBgTilemapBufferToVram(2); - gUnknown_02022CF8->state++; + CopyToBgTilemapBuffer(BG_SCENERY, sBg_Tilemap, 0, 0); + CopyToBgTilemapBuffer(BG_TREE_LEFT, sTreeBorderLeft_Tilemap, 0, 0); + CopyToBgTilemapBuffer(BG_TREE_RIGHT, sTreeBorderRight_Tilemap, 0, 0); + CopyBgTilemapBufferToVram(BG_SCENERY); + CopyBgTilemapBufferToVram(BG_TREE_LEFT); + CopyBgTilemapBufferToVram(BG_TREE_RIGHT); + sGfx->state++; break; case 3: - ShowBg(0); - ShowBg(3); - ShowBg(1); - ShowBg(2); - gUnknown_02022CF8->state++; + ShowBg(BG_INTERFACE); + ShowBg(BG_SCENERY); + ShowBg(BG_TREE_LEFT); + ShowBg(BG_TREE_RIGHT); + sGfx->state++; break; case 4: - sub_8028FF8(gSaveBlock2Ptr->optionsWindowFrameType); - sub_802902C(); - gUnknown_02022CF8->state++; + LoadWindowFrameGfx(gSaveBlock2Ptr->optionsWindowFrameType); + LoadUserWindowFrameGfx(); + sGfx->state++; break; default: - gUnknown_02022CF8->finished = TRUE; + sGfx->finished = TRUE; break; } } -static void sub_8029440(void) +static void ShowNames(void) { - u8 i, playersCount, id, colorsId, *name; + u8 i, numPlayers, playerId, colorsId, *name; u32 left; struct WindowTemplate window; - const struct WinCoords *ptr; + const struct WinCoords *coords; - switch (gUnknown_02022CF8->state) + switch (sGfx->state) { case 0: - playersCount = sub_8027650(); - ptr = gUnknown_082FB3C8[playersCount - 1]; - window.bg = 0; + numPlayers = GetNumPlayers(); + coords = sNameWindowCoords[numPlayers - 1]; + window.bg = BG_INTERFACE; window.width = 7; window.height = 2; - window.paletteNum = 0xD; + window.paletteNum = 13; window.baseBlock = 0x13; - for (i = 0; i < playersCount; ptr++, i++) + for (i = 0; i < numPlayers; coords++, i++) { - colorsId = 0; - id = sub_8027A48(i); - left = (56 - GetStringWidth(1, sub_8027660(id), -1)) / 2u; - window.tilemapLeft = ptr->left; - window.tilemapTop = ptr->top; - gUnknown_02022CF8->unk3008[i] = AddWindow(&window); - ClearWindowTilemap(gUnknown_02022CF8->unk3008[i]); - FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[i], PIXEL_FILL(1)); - if (id == GetMultiplayerId()) - colorsId = 2; - name = sub_8027660(id); - AddTextPrinterParameterized3(gUnknown_02022CF8->unk3008[i], 1, left, 1, sTextColorTable[colorsId], -1, name); - CopyWindowToVram(gUnknown_02022CF8->unk3008[i], 2); + colorsId = COLORID_GREY; + playerId = GetPlayerIdByPos(i); + left = (56 - GetStringWidth(1, GetPlayerName(playerId), -1)) / 2u; + window.tilemapLeft = coords->left; + window.tilemapTop = coords->top; + sGfx->windowIds[i] = AddWindow(&window); + ClearWindowTilemap(sGfx->windowIds[i]); + FillWindowPixelBuffer(sGfx->windowIds[i], PIXEL_FILL(1)); + if (playerId == GetMultiplayerId()) + colorsId = COLORID_BLUE; + name = GetPlayerName(playerId); + AddTextPrinterParameterized3(sGfx->windowIds[i], 1, left, 1, sTextColorTable[colorsId], -1, name); + CopyWindowToVram(sGfx->windowIds[i], 2); window.baseBlock += 0xE; - sub_8029174(&window); + DrawMessageWindow(&window); } - gUnknown_02022CF8->state++; + sGfx->state++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - playersCount = sub_8027650(); - for (i = 0; i < playersCount; i++) - PutWindowTilemap(gUnknown_02022CF8->unk3008[i]); - CopyBgTilemapBufferToVram(0); - gUnknown_02022CF8->state++; + numPlayers = GetNumPlayers(); + for (i = 0; i < numPlayers; i++) + PutWindowTilemap(sGfx->windowIds[i]); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->state++; } break; default: - if (++gUnknown_02022CF8->state > 180) + if (++sGfx->state > 180) { - playersCount = sub_8027650(); - for (i = 0; i < playersCount; i++) + numPlayers = GetNumPlayers(); + for (i = 0; i < numPlayers; i++) { - ClearWindowTilemap(gUnknown_02022CF8->unk3008[i]); - RemoveWindow(gUnknown_02022CF8->unk3008[i]); + ClearWindowTilemap(sGfx->windowIds[i]); + RemoveWindow(sGfx->windowIds[i]); } - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - CopyBgTilemapBufferToVram(0); - gUnknown_02022CF8->finished = TRUE; + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->finished = TRUE; } break; } } -static void sub_80296A8(u8 playersCount_) +static void PrintRankedScores(u8 numPlayers_) { - u8 i, r8 = 0, r6 = 0; - u8 playersCount = playersCount_; // Pointless variable, I know, but it's needed to match. + u8 i, ranking = 0, rankedPlayers = 0; + u8 numPlayers = numPlayers_; // Needed to match u8 *name; u32 x, numWidth; u8 numString[32]; - u8 array[5] = {0, 1, 2, 3, 4}; - struct DodrioSubstruct_3308 temp, structArray[5]; + u8 playersByRanking[MAX_RFU_PLAYERS] = {0, 1, 2, 3, 4}; + struct DodrioGame_ScoreResults temp, scoreResults[MAX_RFU_PLAYERS]; - for (i = 0; i < playersCount; i++) + // Get all players scores and rankings + for (i = 0; i < numPlayers; i++) { - array[i] = i; - sub_802793C(&temp, i); - structArray[i] = temp; + playersByRanking[i] = i; + GetScoreResults(&temp, i); + scoreResults[i] = temp; } - if (sub_8027748() != 0) + // Sort player ids by ranking + if (GetHighestScore() != 0) { do { - for (i = 0; i < playersCount; i++) + for (i = 0; i < numPlayers; i++) { - if (structArray[i].unk0 == r8) + if (scoreResults[i].ranking == ranking) { - array[r6] = i; - r6++; + playersByRanking[rankedPlayers] = i; + rankedPlayers++; } } - r8 = r6; - } while (r6 < playersCount); + ranking = rankedPlayers; + } while (rankedPlayers < numPlayers); } - for (i = 0; i < playersCount; i++) + // Put any player with a score of 0 at lowest ranking + for (i = 0; i < numPlayers; i++) { - if (structArray[i].unk4 == 0) - structArray[i].unk0 = playersCount - 1; + if (scoreResults[i].score == 0) + scoreResults[i].ranking = numPlayers - 1; } + // Print text x = 216 - GetStringWidth(1, gText_SpacePoints, 0); - for (i = 0; i < playersCount; i++) + for (i = 0; i < numPlayers; i++) { - u8 colorsId = 0; - u8 id = array[i]; - u32 points = structArray[id].unk4; + u8 colorsId = COLORID_GREY; + u8 playerId = playersByRanking[i]; + u32 points = scoreResults[playerId].score; - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gUnknown_082FB3DC[structArray[id].unk0], 8, gUnknown_082FB402[i], -1, NULL); - if (id == GetMultiplayerId()) - colorsId = 2; - name = sub_8027660(id); - AddTextPrinterParameterized3(gUnknown_02022CF8->unk3008[1], 1, 28, gUnknown_082FB402[i], sTextColorTable[colorsId], -1, name); + AddTextPrinterParameterized(sGfx->windowIds[1], 1, sRankingTexts[scoreResults[playerId].ranking], 8, sRankingYCoords[i], -1, NULL); + if (playerId == GetMultiplayerId()) + colorsId = COLORID_BLUE; + name = GetPlayerName(playerId); + AddTextPrinterParameterized3(sGfx->windowIds[1], 1, 28, sRankingYCoords[i], sTextColorTable[colorsId], -1, name); ConvertIntToDecimalStringN(numString, points, STR_CONV_MODE_LEFT_ALIGN, 7); numWidth = GetStringWidth(1, numString, -1); - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, numString, x - numWidth, gUnknown_082FB402[i], -1, NULL); - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_SpacePoints, x, gUnknown_082FB402[i], -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[1], 1, numString, x - numWidth, sRankingYCoords[i], -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[1], 1, gText_SpacePoints, x, sRankingYCoords[i], -1, NULL); } } -static void sub_802988C(void) +static void ShowResults(void) { - u8 i, j, itemGiveRet, playersCount = sub_8027650(); + u8 i, j, prizeState, numPlayers = GetNumPlayers(); u8 *name; u32 strWidth, x; - switch (gUnknown_02022CF8->state) + switch (sGfx->state) { case 0: - sub_802784C(); - gUnknown_02022CF8->unk301C = 0; - gUnknown_02022CF8->state++; + SetScoreResults(); + sGfx->timer = 0; + sGfx->state++; break; case 1: - gUnknown_02022CF8->unk3008[0] = AddWindow(&gUnknown_082F7BBC[0]); - gUnknown_02022CF8->unk3008[1] = AddWindow(&gUnknown_082F7BBC[1]); - ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); - ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); - sub_8029174(&gUnknown_082F7BBC[0]); - sub_8029174(&gUnknown_082F7BBC[1]); - gUnknown_02022CF8->state++; + sGfx->windowIds[0] = AddWindow(&sWindowTemplates_Results[0]); + sGfx->windowIds[1] = AddWindow(&sWindowTemplates_Results[1]); + ClearWindowTilemap(sGfx->windowIds[0]); + ClearWindowTilemap(sGfx->windowIds[1]); + DrawMessageWindow(&sWindowTemplates_Results[0]); + DrawMessageWindow(&sWindowTemplates_Results[1]); + sGfx->state++; break; case 2: - FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); - FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); + FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); + FillWindowPixelBuffer(sGfx->windowIds[1], PIXEL_FILL(1)); strWidth = GetStringWidth(1, gText_BerryPickingResults, -1); x = (224 - strWidth) / 2; - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_BerryPickingResults, x, 1, -1, NULL); - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_10P30P50P50P, 68, 17, -1, NULL); - for (i = 0; i < playersCount; i++) + AddTextPrinterParameterized(sGfx->windowIds[0], 1, gText_BerryPickingResults, x, 1, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[1], 1, gText_10P30P50P50P, 68, 17, -1, NULL); + for (i = 0; i < numPlayers; i++) { - u8 colorsId = 0; + u8 colorsId = COLORID_GREY; if (i == GetMultiplayerId()) - colorsId = 2; + colorsId = COLORID_BLUE; - name = sub_8027660(i); - AddTextPrinterParameterized3(gUnknown_02022CF8->unk3008[1], 1, 0, gUnknown_082FB3F8[i], sTextColorTable[colorsId], -1, name); + name = GetPlayerName(i); + AddTextPrinterParameterized3(sGfx->windowIds[1], 1, 0, sResultsYCoords[i], sTextColorTable[colorsId], -1, name); for (j = 0; j < 4; j++) { u32 width; - u16 result1 = Min(sub_80276A0(i, j), 9999); - u16 result2 = Min(sub_802778C(j), 9999); + u16 berriesPicked = Min(GetBerryResult(i, j), MAX_BERRIES); + u16 maxBerriesPicked = Min(GetHighestBerryResult(j), MAX_BERRIES); - ConvertIntToDecimalStringN(gStringVar4, result1, STR_CONV_MODE_LEFT_ALIGN, 4); + ConvertIntToDecimalStringN(gStringVar4, berriesPicked, STR_CONV_MODE_LEFT_ALIGN, 4); width = GetStringWidth(1, gStringVar4, -1); - if (result2 == result1 && result2 != 0) - AddTextPrinterParameterized3(gUnknown_02022CF8->unk3008[1], 1, gUnknown_082FB3F0[j] - width, gUnknown_082FB3F8[i], sTextColorTable[1], -1, gStringVar4); + + // If player got the most of a berry type, highlight their number in red + if (maxBerriesPicked == berriesPicked && maxBerriesPicked != 0) + AddTextPrinterParameterized3(sGfx->windowIds[1], 1, sResultsXCoords[j] - width, sResultsYCoords[i], sTextColorTable[COLORID_RED], -1, gStringVar4); else - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gStringVar4, gUnknown_082FB3F0[j] - width, gUnknown_082FB3F8[i], -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[1], 1, gStringVar4, sResultsXCoords[j] - width, sResultsYCoords[i], -1, NULL); } } - CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); - CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 2); - gUnknown_02022CF8->state++; + CopyWindowToVram(sGfx->windowIds[0], 2); + CopyWindowToVram(sGfx->windowIds[1], 2); + sGfx->state++; break; case 3: if (!IsDma3ManagerBusyWithBgCopy()) { - PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); - PutWindowTilemap(gUnknown_02022CF8->unk3008[1]); + PutWindowTilemap(sGfx->windowIds[0]); + PutWindowTilemap(sGfx->windowIds[1]); } - CopyBgTilemapBufferToVram(0); - sub_8028C30(FALSE); - gUnknown_02022CF8->state++; + CopyBgTilemapBufferToVram(BG_INTERFACE); + SetBerryIconsInvisibility(FALSE); + sGfx->state++; break; case 4: - if (++gUnknown_02022CF8->unk301C >= 30 && JOY_NEW(A_BUTTON)) + if (++sGfx->timer >= 30 && JOY_NEW(A_BUTTON)) { - gUnknown_02022CF8->unk301C = 0; + sGfx->timer = 0; PlaySE(SE_SELECT); - sub_8028C30(TRUE); - gUnknown_02022CF8->state++; + SetBerryIconsInvisibility(TRUE); + sGfx->state++; } break; case 5: - FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); - FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); + FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); + FillWindowPixelBuffer(sGfx->windowIds[1], PIXEL_FILL(1)); strWidth = GetStringWidth(1, gText_AnnouncingRankings, -1); x = (224 - strWidth) / 2; - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_AnnouncingRankings, x, 1, -1, NULL); - gUnknown_02022CF8->state++; + AddTextPrinterParameterized(sGfx->windowIds[0], 1, gText_AnnouncingRankings, x, 1, -1, NULL); + sGfx->state++; break; case 6: - sub_80296A8(playersCount); - CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); - CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 2); - gUnknown_02022CF8->state++; + PrintRankedScores(numPlayers); + CopyWindowToVram(sGfx->windowIds[0], 2); + CopyWindowToVram(sGfx->windowIds[1], 2); + sGfx->state++; break; case 7: if (!IsDma3ManagerBusyWithBgCopy()) { - PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); - PutWindowTilemap(gUnknown_02022CF8->unk3008[1]); + PutWindowTilemap(sGfx->windowIds[0]); + PutWindowTilemap(sGfx->windowIds[1]); } - CopyBgTilemapBufferToVram(0); - gUnknown_02022CF8->state++; + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->state++; break; case 8: - if (++gUnknown_02022CF8->unk301C >= 30 && JOY_NEW(A_BUTTON)) + if (++sGfx->timer >= 30 && JOY_NEW(A_BUTTON)) { - gUnknown_02022CF8->unk301C = 0; + sGfx->timer = 0; PlaySE(SE_SELECT); - if (sub_8027748() < 3000) + if (GetHighestScore() < PRIZE_SCORE) { - gUnknown_02022CF8->state = 127; + sGfx->state = 127; // Skip to end, past giving prize } else { StopMapMusic(); - gUnknown_02022CF8->state++; + sGfx->state++; } - FillBgTilemapBufferRect_Palette0(0, 0, 0, 5, 30, 15); - RemoveWindow(gUnknown_02022CF8->unk3008[1]); - gUnknown_02022CF8->unk3008[1] = AddWindow(&gUnknown_082F7BCC); - ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); - sub_8029174(&gUnknown_082F7BCC); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 5, 30, 15); + RemoveWindow(sGfx->windowIds[1]); + sGfx->windowIds[1] = AddWindow(&sWindowTemplate_Prize); + ClearWindowTilemap(sGfx->windowIds[1]); + DrawMessageWindow(&sWindowTemplate_Prize); } break; case 9: PlayNewMapMusic(MUS_LEVEL_UP); - FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); - FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); + FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); + FillWindowPixelBuffer(sGfx->windowIds[1], PIXEL_FILL(1)); strWidth = GetStringWidth(1, gText_AnnouncingPrizes, -1); x = (224 - strWidth) / 2; - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_AnnouncingPrizes, x, 1, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[0], 1, gText_AnnouncingPrizes, x, 1, -1, NULL); DynamicPlaceholderTextUtil_Reset(); - CopyItemName(sub_802762C(), gStringVar1); + CopyItemName(GetPrizeItemId(), gStringVar1); DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_FirstPlacePrize); - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gStringVar4, 0, 1, -1, NULL); - itemGiveRet = sub_80279C8(); - if (itemGiveRet != 0 && itemGiveRet != 3) + AddTextPrinterParameterized(sGfx->windowIds[1], 1, gStringVar4, 0, 1, -1, NULL); + prizeState = TryGivePrize(); + if (prizeState != PRIZE_RECEIVED && prizeState != NO_PRIZE) { DynamicPlaceholderTextUtil_Reset(); - CopyItemName(sub_802762C(), gStringVar1); + CopyItemName(GetPrizeItemId(), gStringVar1); DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); - if (itemGiveRet == 2) + if (prizeState == PRIZE_NO_ROOM) DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_CantHoldAnyMore); - else if (itemGiveRet == 1) + else if (prizeState == PRIZE_FILLED_BAG) DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_FilledStorageSpace); - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gStringVar4, 0, 41, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[1], 1, gStringVar4, 0, 41, -1, NULL); } - CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); - CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 2); - gUnknown_02022CF8->state++; + CopyWindowToVram(sGfx->windowIds[0], 2); + CopyWindowToVram(sGfx->windowIds[1], 2); + sGfx->state++; break; case 10: if (!IsDma3ManagerBusyWithBgCopy()) { - PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); - PutWindowTilemap(gUnknown_02022CF8->unk3008[1]); + PutWindowTilemap(sGfx->windowIds[0]); + PutWindowTilemap(sGfx->windowIds[1]); } - CopyBgTilemapBufferToVram(0); + CopyBgTilemapBufferToVram(BG_INTERFACE); FadeOutAndFadeInNewMapMusic(MUS_RG_VICTORY_WILD, 20, 10); - gUnknown_02022CF8->state++; + sGfx->state++; break; case 11: - if (++gUnknown_02022CF8->unk301C >= 30 && JOY_NEW(A_BUTTON)) + if (++sGfx->timer >= 30 && JOY_NEW(A_BUTTON)) { - gUnknown_02022CF8->unk301C = 0; + sGfx->timer = 0; PlaySE(SE_SELECT); - gUnknown_02022CF8->state++; + sGfx->state++; } break; default: - ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); - ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); - RemoveWindow(gUnknown_02022CF8->unk3008[0]); - RemoveWindow(gUnknown_02022CF8->unk3008[1]); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - CopyBgTilemapBufferToVram(0); - gUnknown_02022CF8->finished = TRUE; + ClearWindowTilemap(sGfx->windowIds[0]); + ClearWindowTilemap(sGfx->windowIds[1]); + RemoveWindow(sGfx->windowIds[0]); + RemoveWindow(sGfx->windowIds[1]); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->finished = TRUE; break; } } -static void sub_802A010(void) +static void Msg_WantToPlayAgain(void) { u8 y; - switch (gUnknown_02022CF8->state) + switch (sGfx->state) { case 0: - gUnknown_02022CF8->unk3008[0] = AddWindow(&gUnknown_082F7BD4[0]); - gUnknown_02022CF8->unk3008[1] = AddWindow(&gUnknown_082F7BD4[1]); - ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); - ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); - sub_8029174(&gUnknown_082F7BD4[0]); - sub_8029074(&gUnknown_082F7BD4[1]); - gUnknown_02022CF8->state++; - gUnknown_02022CF8->unk3020 = 0; - gUnknown_02022CF8->unk3024 = 0; + // Create windows + sGfx->windowIds[WIN_PLAY_AGAIN] = AddWindow(&sWindowTemplates_PlayAgain[WIN_PLAY_AGAIN]); + sGfx->windowIds[WIN_YES_NO] = AddWindow(&sWindowTemplates_PlayAgain[WIN_YES_NO]); + ClearWindowTilemap(sGfx->windowIds[WIN_PLAY_AGAIN]); + ClearWindowTilemap(sGfx->windowIds[WIN_YES_NO]); + DrawMessageWindow(&sWindowTemplates_PlayAgain[WIN_PLAY_AGAIN]); + DrawYesNoMessageWindow(&sWindowTemplates_PlayAgain[WIN_YES_NO]); + sGfx->state++; + sGfx->cursorSelection = PLAY_AGAIN_NONE; + sGfx->playAgainState = PLAY_AGAIN_NONE; break; case 1: - FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); - FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_WantToPlayAgain, 0, 5, -1, NULL); - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_Yes, 8, 1, -1, NULL); - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_No, 8, 17, -1, NULL); - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_SelectorArrow2, 0, 1, -1, NULL); - CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); - CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 2); - gUnknown_02022CF8->state++; + // Print text + FillWindowPixelBuffer(sGfx->windowIds[WIN_PLAY_AGAIN], PIXEL_FILL(1)); + FillWindowPixelBuffer(sGfx->windowIds[WIN_YES_NO], PIXEL_FILL(1)); + AddTextPrinterParameterized(sGfx->windowIds[WIN_PLAY_AGAIN], 1, gText_WantToPlayAgain, 0, 5, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], 1, gText_Yes, 8, 1, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], 1, gText_No, 8, 17, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], 1, gText_SelectorArrow2, 0, 1, -1, NULL); + CopyWindowToVram(sGfx->windowIds[WIN_PLAY_AGAIN], 2); + CopyWindowToVram(sGfx->windowIds[WIN_YES_NO], 2); + sGfx->state++; break; case 2: + // Draw windows if (!IsDma3ManagerBusyWithBgCopy()) { - PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); - PutWindowTilemap(gUnknown_02022CF8->unk3008[1]); + PutWindowTilemap(sGfx->windowIds[WIN_PLAY_AGAIN]); + PutWindowTilemap(sGfx->windowIds[WIN_YES_NO]); } - CopyBgTilemapBufferToVram(0); - gUnknown_02022CF8->state++; + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->state++; break; case 3: - y = gUnknown_02022CF8->unk3020; - if (y == 0) - y = 1; - FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_Yes, 8, 1, -1, NULL); - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_No, 8, 17, -1, NULL); - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_SelectorArrow2, 0, ((y - 1) * 16) + 1, -1, NULL); - CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 3); + // Handle input + y = sGfx->cursorSelection; + if (y == PLAY_AGAIN_NONE) + y = PLAY_AGAIN_YES; + FillWindowPixelBuffer(sGfx->windowIds[WIN_YES_NO], PIXEL_FILL(1)); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], 1, gText_Yes, 8, 1, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], 1, gText_No, 8, 17, -1, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], 1, gText_SelectorArrow2, 0, ((y - 1) * 16) + 1, -1, NULL); + CopyWindowToVram(sGfx->windowIds[WIN_YES_NO], 3); + // Increment state only if A or B button have been pressed. if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); - if (gUnknown_02022CF8->unk3020 == 0) - gUnknown_02022CF8->unk3020 = 1; - gUnknown_02022CF8->state++; + if (sGfx->cursorSelection == PLAY_AGAIN_NONE) + sGfx->cursorSelection = PLAY_AGAIN_YES; + sGfx->state++; } else if (JOY_NEW(DPAD_UP | DPAD_DOWN)) { PlaySE(SE_SELECT); - switch (gUnknown_02022CF8->unk3020) + switch (sGfx->cursorSelection) { - case 0: - gUnknown_02022CF8->unk3020 = 2; + case PLAY_AGAIN_NONE: + sGfx->cursorSelection = PLAY_AGAIN_NO; break; - case 1: - gUnknown_02022CF8->unk3020 = 2; + case PLAY_AGAIN_YES: + sGfx->cursorSelection = PLAY_AGAIN_NO; break; - case 2: - gUnknown_02022CF8->unk3020 = 1; + case PLAY_AGAIN_NO: + sGfx->cursorSelection = PLAY_AGAIN_YES; break; } } else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); - gUnknown_02022CF8->unk3020 = 2; - gUnknown_02022CF8->state++; + sGfx->cursorSelection = PLAY_AGAIN_NO; + sGfx->state++; } break; default: - gUnknown_02022CF8->unk3024 = gUnknown_02022CF8->unk3020; - ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); - ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); - RemoveWindow(gUnknown_02022CF8->unk3008[0]); - RemoveWindow(gUnknown_02022CF8->unk3008[1]); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - CopyBgTilemapBufferToVram(0); - gUnknown_02022CF8->finished = TRUE; + sGfx->playAgainState = sGfx->cursorSelection; + ClearWindowTilemap(sGfx->windowIds[WIN_PLAY_AGAIN]); + ClearWindowTilemap(sGfx->windowIds[WIN_YES_NO]); + RemoveWindow(sGfx->windowIds[WIN_PLAY_AGAIN]); + RemoveWindow(sGfx->windowIds[WIN_YES_NO]); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->finished = TRUE; break; } } -static void sub_802A380(void) +static void Msg_SavingDontTurnOff(void) { - switch (gUnknown_02022CF8->state) + switch (sGfx->state) { case 0: DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized2(0, 1, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3); - gUnknown_02022CF8->state++; + sGfx->state++; break; case 1: CopyWindowToVram(0, 3); - gUnknown_02022CF8->state++; + sGfx->state++; break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) { CreateTask(Task_LinkSave, 0); - gUnknown_02022CF8->state++; + sGfx->state++; } break; case 3: if (!FuncIsActiveTask(Task_LinkSave)) - gUnknown_02022CF8->state++; + sGfx->state++; break; default: - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - CopyBgTilemapBufferToVram(0); - gUnknown_02022CF8->finished = TRUE; + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->finished = TRUE; break; } } -static void sub_802A454(void) +static void Msg_CommunicationStandby(void) { - switch (gUnknown_02022CF8->state) + switch (sGfx->state) { case 0: - gUnknown_02022CF8->unk3008[0] = AddWindow(&gUnknown_082F7BEC); - ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); - sub_8029174(&gUnknown_082F7BEC); - gUnknown_02022CF8->state++; + sGfx->windowIds[0] = AddWindow(&sWindowTemplate_CommStandby); + ClearWindowTilemap(sGfx->windowIds[0]); + DrawMessageWindow(&sWindowTemplate_CommStandby); + sGfx->state++; break; case 1: - FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_CommunicationStandby3, 0, 5, -1, NULL); - CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); - gUnknown_02022CF8->state++; + FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); + AddTextPrinterParameterized(sGfx->windowIds[0], 1, gText_CommunicationStandby3, 0, 5, -1, NULL); + CopyWindowToVram(sGfx->windowIds[0], 2); + sGfx->state++; break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) - PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); - CopyBgTilemapBufferToVram(0); - gUnknown_02022CF8->state++; + PutWindowTilemap(sGfx->windowIds[0]); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->state++; break; default: - gUnknown_02022CF8->finished = TRUE; + sGfx->finished = TRUE; break; } } -static void sub_802A534(void) +static void EraseMessage(void) { - ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); - RemoveWindow(gUnknown_02022CF8->unk3008[0]); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - CopyBgTilemapBufferToVram(0); - gUnknown_02022CF8->finished = TRUE; + ClearWindowTilemap(sGfx->windowIds[0]); + RemoveWindow(sGfx->windowIds[0]); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->finished = TRUE; } -static void sub_802A588(void) +static void Msg_SomeoneDroppedOut(void) { - switch (gUnknown_02022CF8->state) + switch (sGfx->state) { case 0: - gUnknown_02022CF8->unk3008[0] = AddWindow(&gUnknown_082F7BE4); - ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); - sub_8029174(&gUnknown_082F7BE4); - gUnknown_02022CF8->state++; - gUnknown_02022CF8->unk301C = 0; - gUnknown_02022CF8->unk3020 = 0; - gUnknown_02022CF8->unk3024 = 0; + sGfx->windowIds[0] = AddWindow(&sWindowTemplate_DroppedOut); + ClearWindowTilemap(sGfx->windowIds[0]); + DrawMessageWindow(&sWindowTemplate_DroppedOut); + sGfx->state++; + sGfx->timer = 0; + sGfx->cursorSelection = 0; + sGfx->playAgainState = PLAY_AGAIN_NONE; break; case 1: - FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); - AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_SomeoneDroppedOut, 0, 5, -1, NULL); - CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); - gUnknown_02022CF8->state++; + FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); + AddTextPrinterParameterized(sGfx->windowIds[0], 1, gText_SomeoneDroppedOut, 0, 5, -1, NULL); + CopyWindowToVram(sGfx->windowIds[0], 2); + sGfx->state++; break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) - PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); - CopyBgTilemapBufferToVram(0); - gUnknown_02022CF8->state++; + PutWindowTilemap(sGfx->windowIds[0]); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->state++; break; case 3: - if (++gUnknown_02022CF8->unk301C >= 120) - gUnknown_02022CF8->state++; + if (++sGfx->timer >= 120) + sGfx->state++; break; default: - gUnknown_02022CF8->unk3024 = 5; - ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); - RemoveWindow(gUnknown_02022CF8->unk3008[0]); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - CopyBgTilemapBufferToVram(0); - gUnknown_02022CF8->finished = TRUE; + sGfx->playAgainState = PLAY_AGAIN_DROPPED; + ClearWindowTilemap(sGfx->windowIds[0]); + RemoveWindow(sGfx->windowIds[0]); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->finished = TRUE; break; } } -static void sub_802A6FC(void) +static void StopGfxFuncs(void) { - DestroyTask(gUnknown_02022CF8->unk3004); - gUnknown_02022CF8->finished = TRUE; + DestroyTask(sGfx->taskId); + sGfx->finished = TRUE; } -static void nullsub_16(void) +static void GfxIdle(void) { } -static void sub_802A72C(void (*func)(void)) +static void SetGfxFunc(void (*func)(void)) { - gUnknown_02022CF8->state = 0; - gUnknown_02022CF8->finished = FALSE; - gUnknown_02022CF8->unk3028 = func; + sGfx->state = 0; + sGfx->finished = FALSE; + sGfx->func = func; } -static void (*sub_802A75C(void))(void) +static void (*GetGfxFunc(void))(void) { - return gUnknown_02022CF8->unk3028; + return sGfx->func; } -static bool32 sub_802A770(void) +static bool32 IsGfxFuncActive(void) { - if (gUnknown_02022CF8->finished == TRUE) + if (sGfx->finished == TRUE) return FALSE; else return TRUE; } -static u8 sub_802A794(void) +static u8 GetPlayAgainState(void) { - return gUnknown_02022CF8->unk3024; + return sGfx->playAgainState; } -static void sub_802A7A8(void) +static void InitBgs(void) { DmaClearLarge16(3, (void *)VRAM, VRAM_SIZE, 0x1000); DmaClear32(3,(void *)OAM, OAM_SIZE); DmaClear16(3, (void *)PLTT, PLTT_SIZE); SetGpuReg(REG_OFFSET_DISPCNT, 0); ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, gUnknown_082F7BA4, ARRAY_COUNT(gUnknown_082F7BA4)); + InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates)); ChangeBgX(0, 0, 0); ChangeBgY(0, 0, 0); ChangeBgX(1, 0, 0); @@ -4630,26 +5183,26 @@ static void sub_802A7A8(void) InitStandardTextBoxWindows(); InitTextBoxGfxAndPrinters(); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); - SetBgTilemapBuffer(3, gUnknown_02022CF8->tilemapBuffers[0]); - SetBgTilemapBuffer(1, gUnknown_02022CF8->tilemapBuffers[1]); - SetBgTilemapBuffer(2, gUnknown_02022CF8->tilemapBuffers[2]); + SetBgTilemapBuffer(BG_SCENERY, sGfx->tilemapBuffers[0]); + SetBgTilemapBuffer(BG_TREE_LEFT, sGfx->tilemapBuffers[1]); + SetBgTilemapBuffer(BG_TREE_RIGHT, sGfx->tilemapBuffers[2]); } -static bool32 sub_802A8E8(void) +static bool32 LoadBgGfx(void) { - switch (gUnknown_02022CF8->unk3018) + switch (sGfx->loadState) { case 0: - LoadPalette(gDodrioBerryBgPal1, 0, sizeof(gDodrioBerryBgPal1)); + LoadPalette(sBg_Pal, 0, sizeof(sBg_Pal)); break; case 1: ResetTempTileDataBuffers(); break; case 2: - DecompressAndCopyTileDataToVram(3, gDodrioBerryBgGfx1, 0, 0, 0); + DecompressAndCopyTileDataToVram(BG_SCENERY, sBg_Gfx, 0, 0, 0); break; case 3: - DecompressAndCopyTileDataToVram(1, gDodrioBerryBgGfx2, 0, 0, 0); + DecompressAndCopyTileDataToVram(BG_TREE_LEFT, sTreeBorder_Gfx, 0, 0, 0); break; case 4: if (FreeTempTileDataBuffersIfPossible() == TRUE) @@ -4659,10 +5212,10 @@ static bool32 sub_802A8E8(void) LoadPalette(GetTextWindowPalette(3), 0xD0, 0x20); break; default: - gUnknown_02022CF8->unk3018 = 0; + sGfx->loadState = 0; return TRUE; } - gUnknown_02022CF8->unk3018++; + sGfx->loadState++; return FALSE; } diff --git a/src/easy_chat.c b/src/easy_chat.c index 6bb77bc84..a27e1780e 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -34,228 +34,382 @@ #include "constants/songs.h" #include "constants/rgb.h" -#define EZCHAT_TASK_STATE 0 -#define EZCHAT_TASK_TYPE 1 -#define EZCHAT_TASK_WORDS 2 -#define EZCHAT_TASK_MAINCALLBACK 4 -#define EZCHAT_TASK_UNK06 6 -#define EZCHAT_TASK_SIZE 7 - static EWRAM_DATA struct EasyChatScreen *sEasyChatScreen = NULL; -static EWRAM_DATA struct Unk203A11C *sUnknown_0203A11C = NULL; -static EWRAM_DATA struct Unk203A120 *sUnknown_0203A120 = NULL; +static EWRAM_DATA struct EasyChatScreenControl *sScreenControl = NULL; +static EWRAM_DATA struct EasyChatScreenWordData *sWordData = NULL; -static void sub_811A2C0(u8); -static void MainCallback_EasyChatScreen(void); -static bool8 sub_811A428(u8); -static void sub_811A2FC(u8); -static void sub_811A4D0(MainCallback); -static bool32 sub_811A88C(u16); -static void sub_811A8A4(u16); -static bool8 EasyChat_AllocateResources(u8, u16 *, u8); -static void EasyChat_FreeResources(void); -static u16 sub_811AAAC(void); -static u16 sub_811AB68(void); -static u16 sub_811ACDC(void); -static u16 sub_811AE44(void); -static u16 sub_811AF00(void); -static u16 sub_811AF8C(void); -static u16 sub_811AFEC(void); -static u16 sub_811B040(void); -static u16 sub_811B08C(void); -static u16 sub_811B0BC(void); -static u16 sub_811B0E8(void); -static u16 sub_811B0F8(void); -static u16 sub_811B150(void); -static u16 sub_811B1B4(void); +static void Task_InitEasyChatScreen(u8); +static void CB2_EasyChatScreen(void); +static bool8 InitEasyChatScreen(u8); +static void Task_EasyChatScreen(u8); +static void ExitEasyChatScreen(MainCallback); +static bool32 IsFuncIdForQuizLadyScreen(u16); +static void EnterQuizLadyScreen(u16); +static bool8 InitEasyChatScreenStruct(u8, u16 *, u8); +static void FreeEasyChatScreenStruct(void); +static u16 HandleEasyChatInput(void); +static u16 HandleEasyChatInput_Phrase(void); +static u16 HandleEasyChatInput_MainScreenButtons(void); +static u16 HandleEasyChatInput_Keyboard(void); +static u16 HandleEasyChatInput_WordSelect(void); +static u16 HandleEasyChatInput_ExitPrompt(void); +static u16 HandleEasyChatInput_ConfirmWordsYesNo(void); +static u16 HandleEasyChatInput_DeleteAllYesNo(void); +static u16 HandleEasyChatInput_QuizQuestion(void); +static u16 HandleEasyChatInput_WaitForMsg(void); +static u16 HandleEasyChatInput_StartConfirmLyrics(void); +static u16 HandleEasyChatInput_ConfirmLyricsYesNo(void); +static u16 StartConfirmExitPrompt(void); +static u16 TryConfirmWords(void); static u8 GetEasyChatScreenFrameId(void); static u8 GetEachChatScreenTemplateId(u8); -static void sub_811BDF0(u8 *); -static void sub_811BF78(void); -static bool8 sub_811BF8C(void); -static bool8 sub_811BFA4(void); -static void sub_811C13C(void); -static void sub_811C158(u16); -static bool8 sub_811C170(void); -static bool8 sub_811F28C(void); -static void sub_811F2B8(void); -static u8 sub_811F3AC(void); +static void GetQuizTitle(u8 *); +static void ClearUnusedField(void); +static bool8 InitEasyChatScreenControl(void); +static bool8 LoadEasyChatScreen(void); +static void FreeEasyChatScreenControl(void); +static void StartEasyChatFunction(u16); +static bool8 RunEasyChatFunction(void); +static bool8 InitEasyChatScreenWordData(void); +static void FreeEasyChatScreenWordData(void); +static u8 GetNumUnlockedEasyChatGroups(void); static int FooterHasFourOptions(void); -static int sub_811B184(void); -static int sub_811B264(void); -static int sub_811B32C(void); -static int sub_811B2B0(void); -static int sub_811B33C(void); -static int sub_811B368(void); -static u16 sub_811B528(int); -static u16 sub_811B794(u32); -static int sub_811B394(void); -static u8 sub_811B2A4(void); -static void sub_811B3E4(void); -static void sub_811BE9C(void); -static int sub_811B4EC(void); -static void sub_811B418(void); -static void sub_811B454(void); -static int sub_811BD64(void); -static int sub_811BDB0(void); -static int sub_811BD2C(void); -static int sub_811BCF4(void); -static u16 sub_811B8E8(void); -static u8 sub_811F3B8(u8); -static void sub_811F548(int, u16); -static int sub_811B908(void); -static u16 sub_811F5B0(void); -static void sub_811B488(u16); -static u16 sub_811B940(void); -static u16 sub_811F578(u16); -static int sub_811BF88(int); -static u16 sub_811B8C8(void); -static int sub_811B568(u32); -static int sub_811B634(u32); -static int sub_811B6C4(u32); -static void sub_811B978(void); -static void sub_811B744(void); -static u8 sub_811B9C8(void); -static void sub_811B768(void); -static u8 sub_811B960(u8); -static void sub_811B9A0(void); -static u8 sub_811BA1C(void); +static int DoDeleteAllButton(void); +static int DoQuizButton(void); +static int ExitKeyboardToMainScreen(void); +static int SelectKeyboardGroup(void); +static int StartSwitchKeyboardMode(void); +static int DeleteSelectedWord(void); +static u16 MoveKeyboardCursor(int); +static u16 MoveWordSelectCursor(u32); +static int SelectNewWord(void); +static u8 GetEasyChatBackupState(void); +static void SaveCurrentPhrase(void); +static void SetSpecialEasyChatResult(void); +static bool32 GetEasyChatCompleted(void); +static void ResetCurrentPhrase(void); +static void ResetCurrentPhraseToSaved(void); +static int IsQuizQuestionEmpty(void); +static int IsQuizAnswerEmpty(void); +static bool32 IsCurrentPhraseFull(void); +static bool32 IsCurrentPhraseEmpty(void); +static u16 GetSelectedGroupIndex(void); +static u8 GetUnlockedEasyChatGroupId(u8); +static void SetSelectedWordGroup(bool32, u16); +static int GetSelectedAlphabetGroupId(void); +static u16 GetNumWordsInSelectedGroup(void); +static void SetSelectedWord(u16); +static u16 GetSelectedWordIndex(void); +static u16 GetWordFromSelectedGroup(u16); +static bool32 DummyWordCheck(int); +static u16 GetWordIndexToReplace(void); +static int MoveKeyboardCursor_GroupNames(u32); +static int MoveKeyboardCursor_Alphabet(u32); +static int MoveKeyboardCursor_ButtonWindow(u32); +static void ReduceToValidKeyboardColumn(void); +static void SetKeyboardCursorInButtonWindow(void); +static bool8 IsSelectedKeyboardIndexInvalid(void); +static void SetKeyboardCursorToLastColumn(void); +static u8 GetLastAlphabetColumn(u8); +static void ReduceToValidWordSelectColumn(void); +static bool8 IsSelectedWordIndexInvalid(void); static int DidPlayerInputMysteryGiftPhrase(void); static u16 DidPlayerInputABerryMasterWifePhrase(void); -static bool8 sub_811CE94(void); -static void sub_811CF64(void); -static void sub_811CF04(void); -static void sub_811D60C(void); -static void sub_811D424(u16 *); -static void sub_811D230(void); -static void sub_811E948(void); -static void sub_811CFCC(void); -static void sub_811D0BC(void); -static void sub_811D2C8(void); -static void sub_811D684(void); -static void sub_811DE90(void); -static void sub_811DEC4(void); -static void sub_811DF28(struct Sprite *); -static void sub_811DE5C(u8, u8, u8, u8); -static void sub_811E5D4(void); -static void sub_811E720(void); -static void sub_811E828(void); -static bool8 sub_811C2D4(void); -static bool8 sub_811C30C(void); -static bool8 sub_811C3E4(void); -static bool8 sub_811C48C(void); -static bool8 sub_811C404(void); -static bool8 sub_811C448(void); -static bool8 sub_811C4D0(void); -static bool8 sub_811C518(void); -static bool8 sub_811C554(void); -static bool8 sub_811C620(void); -static bool8 sub_811C830(void); -static bool8 sub_811C8F0(void); -static bool8 sub_811C99C(void); -static bool8 sub_811CA5C(void); -static bool8 sub_811C780(void); -static bool8 sub_811C78C(void); -static bool8 sub_811C7D4(void); -static bool8 sub_811CB18(void); -static bool8 sub_811CB98(void); -static bool8 sub_811CB24(void); -static bool8 sub_811CC90(void); -static bool8 sub_811CC08(void); -static bool8 sub_811C6C0(void); -static bool8 sub_811CD14(void); -static bool8 sub_811CD54(void); -static bool8 sub_811CD94(void); -static bool8 sub_811CDD4(void); -static bool8 sub_811CE14(void); -static bool8 sub_811CE54(void); -static void sub_811DF60(u8, u8); +static bool8 InitEasyChatScreenControl_(void); +static void LoadEasyChatPalettes(void); +static void InitEasyChatBgs(void); +static void AdjustBgTilemapForFooter(void); +static void BufferFrameTilemap(u16 *); +static void AddPhraseWindow(void); +static void AddMainScreenButtonWindow(void); +static void PrintTitle(void); +static void PrintInitialInstructions(void); +static void PrintCurrentPhrase(void); +static void DrawLowerWindow(void); +static void LoadEasyChatGfx(void); +static void CreateMainCursorSprite(void); +static void SpriteCB_Cursor(struct Sprite *); +static void SetWindowDimensions(u8, u8, u8, u8); +static void CreateScrollIndicatorSprites(void); +static void CreateStartSelectButtonSprites(void); +static void TryAddInterviewObjectEvents(void); +static bool8 ReprintPhrase(void); +static bool8 UpdateMainCursor(void); +static bool8 UpdateMainCursorOnButtons(void); +static bool8 ShowConfirmDeleteAllPrompt(void); +static bool8 ShowConfirmExitPrompt(void); +static bool8 ShowConfirmPrompt(void); +static bool8 ClosePrompt(void); +static bool8 ClosePromptAfterDeleteAll(void); +static bool8 OpenKeyboard(void); +static bool8 CloseKeyboard(void); +static bool8 OpenWordSelect(void); +static bool8 CloseWordSelect(void); +static bool8 ShowConfirmLyricsPrompt(void); +static bool8 ReturnToKeyboard(void); +static bool8 UpdateKeyboardCursor(void); +static bool8 GroupNamesScrollDown(void); +static bool8 GroupNamesScrollUp(void); +static bool8 UpdateWordSelectCursor(void); +static bool8 WordSelectScrollUp(void); +static bool8 WordSelectScrollDown(void); +static bool8 WordSelectPageScrollUp(void); +static bool8 WordSelectPageScrollDown(void); +static bool8 SwitchKeyboardMode(void); +static bool8 ShowCreateQuizMsg(void); +static bool8 ShowSelectAnswerMsg(void); +static bool8 ShowSongTooShortMsg(void); +static bool8 ShowCantDeleteLyricsMsg(void); +static bool8 ShowCombineTwoWordsMsg(void); +static bool8 ShowCantExitMsg(void); +static void SetMainCursorPos(u8, u8); static int GetFooterOptionXOffset(int); -static void sub_811DF90(void); -static void sub_811D104(u8); -static void sub_811D214(u8); -static void sub_811DFB0(void); -static void sub_811D6D4(void); -static void sub_811D9CC(int); -static void sub_811E3AC(void); -static bool8 sub_811E418(void); -static void sub_811DFC8(void); -static void sub_811E6E0(int); -static bool8 sub_811DAA4(void); -static void sub_811E64C(void); -static void sub_811E050(void); -static void sub_811E4AC(void); -static void sub_811E6B0(void); -static void sub_811E55C(void); -static bool8 sub_811E4D0(void); -static bool8 sub_811E5B8(void); -static void sub_811E578(void); -static void sub_811E088(void); -static void sub_811DDAC(s16, u8); -static bool8 sub_811DE10(void); -static void sub_811D9B4(void); -static void sub_811D698(u32); -static void sub_811E288(void); -static void sub_811E794(void); -static void sub_811E380(void); -static void sub_811E7F8(void); -static void sub_811E30C(void); -static void sub_811D7A4(void); -static void sub_811D7C8(void); -static int sub_811DE48(void); -static void sub_811D7EC(void); -static void sub_811D830(void); -static void sub_811D058(u8, u8, const u8 *, u8, u8, u8, u8, u8, u8); -static void sub_811DD84(void); -static void sub_811D6F4(void); -static void PrintEasyChatKeyboardText(void); -static void sub_811D794(void); +static void StopMainCursorAnim(void); +static void PrintEasyChatStdMessage(u8); +static void CreateEasyChatYesNoMenu(u8); +static void StartMainCursorAnim(void); +static void PrintKeyboardText(void); +static void InitLowerWindowAnim(int); +static void CreateSideWindowSprites(void); +static bool8 ShowSideWindow(void); +static void CreateRectangleCursorSprites(void); +static void SetScrollIndicatorXPos(bool32); +static bool8 UpdateLowerWindowAnim(void); +static void UpdateScrollIndicatorsVisibility(void); +static void DestroyRectangleCursorSprites(void); +static void HideModeWindow(void); +static void HideScrollIndicators(void); +static void SetModeWindowToTransition(void); +static bool8 DestroySideWindowSprites(void); +static bool8 IsModeWindowAnimActive(void); +static void UpdateModeWindowAnim(void); +static void UpdateRectangleCursorPos(void); +static void InitLowerWindowScroll(s16, u8); +static bool8 UpdateLowerWindowScroll(void); +static void ClearWordSelectWindow(void); +static void InitLowerWindowText(u32); +static void CreateWordSelectCursorSprite(void); +static void UpdateStartSelectButtonsVisibility(void); +static void DestroyWordSelectCursorSprite(void); +static void HideStartSelectButtons(void); +static void UpdateWordSelectCursorPos(void); +static void PrintWordSelectNextRowDown(void); +static void PrintWordSelectNextRowUp(void); +static int GetLowerWindowScrollOffset(void); +static void PrintWordSelectRowsPageDown(void); +static void PrintWordSelectRowsPageUp(void); +static void PrintEasyChatTextWithColors(u8, u8, const u8 *, u8, u8, u8, u8, u8, u8); +static void ResetLowerWindowScroll(void); +static void PrintKeyboardGroupNames(void); +static void PrintKeyboardAlphabet(void); +static void PrintInitialWordSelectText(void); static const u8 *GetEasyChatWordGroupName(u8); -static void sub_811D864(u8, u8); -static void sub_811D950(u8, u8); -static void sub_811DADC(u8); -static void sub_811DC28(int, int, int, int); -static void sub_811E0EC(s8, s8); -static void sub_811E1A4(s8, s8); -static void sub_811E2DC(struct Sprite *); -static void sub_811E34C(u8, u8); +static void PrintWordSelectText(u8, u8); +static void EraseWordSelectRows(u8, u8); +static void DrawLowerWindowFrame(u8); +static void BufferLowerWindowFrame(int, int, int, int); +static void SetRectangleCursorPos_GroupMode(s8, s8); +static void SetRectangleCursorPos_AlphabetMode(s8, s8); +static void SpriteCB_WordSelectCursor(struct Sprite *); +static void SetWordSelectCursorPos(u8, u8); static bool8 EasyChatIsNationalPokedexEnabled(void); static u16 GetRandomUnlockedEasyChatPokemon(void); -static void sub_811F2D4(void); -static void sub_811F46C(void); +static void SetUnlockedEasyChatGroups(void); +static void SetUnlockedWordsByAlphabet(void); static u8 *CopyEasyChatWordPadded(u8 *, u16, u16); -static u8 sub_811F860(u16); -static u16 sub_811F5C4(u16); -static u16 sub_811F6B8(u16); -static bool8 sub_811F764(u16, u8); -static int sub_811F838(u16); +static u8 IsEasyChatWordUnlocked(u16); +static u16 SetSelectedWordGroup_GroupMode(u16); +static u16 SetSelectedWordGroup_AlphabetMode(u16); +static bool8 IsEasyChatIndexAndGroupUnlocked(u16, u8); +static int IsRestrictedWordSpecies(u16); static void DoQuizAnswerEasyChatScreen(void); static void DoQuizQuestionEasyChatScreen(void); static void DoQuizSetAnswerEasyChatScreen(void); static void DoQuizSetQuestionEasyChatScreen(void); -struct Unk8597530 -{ - u16 word; - MainCallback callback; +#define PALTAG_TRIANGLE_CURSOR 0 +#define PALTAG_RECTANGLE_CURSOR 1 +#define PALTAG_MISC_UI 2 +#define PALTAG_3 3 + +#define GFXTAG_TRIANGLE_CURSOR 0 +#define GFXTAG_RECTANGLE_CURSOR 1 +#define GFXTAG_SCROLL_INDICATOR 2 +#define GFXTAG_START_SELECT_BUTTONS 3 +#define GFXTAG_MODE_WINDOW 4 +#define GFXTAG_5 5 +#define GFXTAG_BUTTON_WINDOW 6 + +// State values for sEasyChatScreen->inputState +// Control which input handler to use in HandleEasyChatInput +enum { + INPUTSTATE_PHRASE, + INPUTSTATE_MAIN_SCREEN_BUTTONS, + INPUTSTATE_KEYBOARD, + INPUTSTATE_WORD_SELECT, + INPUTSTATE_EXIT_PROMPT, + INPUTSTATE_DELETE_ALL_YES_NO, + INPUTSTATE_CONFIRM_WORDS_YES_NO, + INPUTSTATE_QUIZ_QUESTION, + INPUTSTATE_WAIT_FOR_MSG, + INPUTSTATE_START_CONFIRM_LYRICS, + INPUTSTATE_CONFIRM_LYRICS_YES_NO, }; -// Lilycove Quiz Lady -static const struct Unk8597530 sUnknown_08597530[] = { +// Task states for the 'main' task, Task_EasyChatScreen +enum { + MAINSTATE_FADE_IN, + MAINSTATE_HANDLE_INPUT, + MAINSTATE_RUN_FUNC, + MAINSTATE_TO_QUIZ_LADY, + MAINSTATE_EXIT, + MAINSTATE_WAIT_FADE_IN, +}; + +// IDs provided to PrintEasyChatStdMessage to print a standard message +enum { + MSG_INSTRUCTIONS, + MSG_CONFIRM_DELETE, + MSG_CONFIRM_EXIT, + MSG_CONFIRM, + MSG_CREATE_QUIZ, + MSG_SELECT_ANSWER, + MSG_SONG_TOO_SHORT, + MSG_CANT_DELETE_LYRICS, + MSG_COMBINE_TWO_WORDS, + MSG_CANT_QUIT, +}; + +// IDs for supplementary Easy Chat functions +// Returned by the input handler functions, and run +// in the main task (MAINSTATE_RUN_FUNC) +enum { + ECFUNC_NONE, + ECFUNC_REPRINT_PHRASE, + ECFUNC_UPDATE_MAIN_CURSOR, + ECFUNC_UPDATE_MAIN_CURSOR_ON_BUTTONS, + ECFUNC_PROMPT_DELETE_ALL, + ECFUNC_PROMPT_EXIT, + ECFUNC_PROMPT_CONFIRM, + ECFUNC_CLOSE_PROMPT, + ECFUNC_CLOSE_PROMPT_AFTER_DELETE, + ECFUNC_OPEN_KEYBOARD, + ECFUNC_CLOSE_KEYBOARD, + ECFUNC_OPEN_WORD_SELECT, + ECFUNC_CLOSE_WORD_SELECT, + ECFUNC_PROMPT_CONFIRM_LYRICS, + ECFUNC_RETURN_TO_KEYBOARD, + ECFUNC_UPDATE_KEYBOARD_CURSOR, + ECFUNC_GROUP_NAMES_SCROLL_DOWN, + ECFUNC_GROUP_NAMES_SCROLL_UP, + ECFUNC_UPDATE_WORD_SELECT_CURSOR, + ECFUNC_WORD_SELECT_SCROLL_UP, + ECFUNC_WORD_SELECT_SCROLL_DOWN, + ECFUNC_WORD_SELECT_PAGE_UP, + ECFUNC_WORD_SELECT_PAGE_DOWN, + ECFUNC_SWITCH_KEYBOARD_MODE, + ECFUNC_EXIT, + ECFUNC_QUIZ_QUESTION, + ECFUNC_QUIZ_ANSWER, + ECFUNC_SET_QUIZ_QUESTION, + ECFUNC_SET_QUIZ_ANSWER, + ECFUNC_MSG_CREATE_QUIZ, + ECFUNC_MSG_SELECT_ANSWER, + ECFUNC_MSG_SONG_TOO_SHORT, + ECFUNC_MSG_CANT_DELETE_LYRICS, + ECFUNC_MSG_COMBINE_TWO_WORDS, + ECFUNC_MSG_CANT_EXIT, +}; + +// IDs for InitLowerWindowText +enum { + TEXT_GROUPS, + TEXT_ALPHABET, + TEXT_WORD_SELECT, +}; + +#define NUM_ALPHABET_ROWS 4 +#define NUM_GROUP_NAME_ROWS 4 +#define NUM_WORD_SELECT_ROWS 4 +#define NUM_BUTTON_ROWS 3 + +#define NUM_ALPHABET_COLUMNS 7 +#define NUM_GROUP_NAME_COLUMNS 2 +#define NUM_WORD_SELECT_COLUMNS 2 + +enum { + FRAMEID_GENERAL_2x2, + FRAMEID_GENERAL_2x3, + FRAMEID_MAIL, + FRAMEID_COMBINE_TWO_WORDS, + FRAMEID_INTERVIEW_SHOW_PERSON, + FRAMEID_INTERVIEW, + FRAMEID_QUIZ_ANSWER, + FRAMEID_QUIZ_QUESTION, + FRAMEID_QUIZ_SET_QUESTION, +}; + +// IDs for the footer row of buttons on the main screen +enum { + FOOTER_NORMAL, + FOOTER_QUIZ, + FOOTER_ANSWER, + NUM_FOOTER_TYPES +}; + +enum { + INPUT_RIGHT, + INPUT_LEFT, + INPUT_UP, + INPUT_DOWN, + INPUT_START, + INPUT_SELECT, +}; + +// Types of animations for the lower window (keyboard/word select), given to InitLowerWindowAnim +enum { + WINANIM_OPEN_KEYBOARD, + WINANIM_CLOSE_KEYBOARD, + WINANIM_OPEN_WORD_SELECT, + WINANIM_CLOSE_WORD_SELECT, + WINANIM_RETURN_TO_KEYBOARD, + WINANIM_KEYBOARD_SWITCH_OUT, + WINANIM_KEYBOARD_SWITCH_IN, +}; + +// Values for text frame tilemap +#define FRAME_OFFSET_ORANGE 0x1000 // Orange frame, for phrase text +#define FRAME_OFFSET_GREEN 0x4000 // Green frame, for keyboard/word select + +#define FRAME_TILE_TRANSPARENT 0x0 +#define FRAME_TILE_TOP_L_CORNER 0x1 +#define FRAME_TILE_TOP_EDGE 0x2 +#define FRAME_TILE_TOP_R_CORNER 0x3 +#define FRAME_TILE_L_EDGE 0x5 +#define FRAME_TILE_R_EDGE 0x7 +#define FRAME_TILE_BOTTOM_L_CORNER 0x9 +#define FRAME_TILE_BOTTOM_EDGE 0xA +#define FRAME_TILE_BOTTOM_R_CORNER 0xB + +struct +{ + u16 funcId; + MainCallback callback; +} static const sQuizLadyEasyChatScreens[] = { { - .word = 26, + .funcId = ECFUNC_QUIZ_ANSWER, .callback = DoQuizAnswerEasyChatScreen, }, { - .word = 25, + .funcId = ECFUNC_QUIZ_QUESTION, .callback = DoQuizQuestionEasyChatScreen, }, { - .word = 28, + .funcId = ECFUNC_SET_QUIZ_ANSWER, .callback = DoQuizSetAnswerEasyChatScreen, }, { - .word = 27, + .funcId = ECFUNC_SET_QUIZ_QUESTION, .callback = DoQuizSetQuestionEasyChatScreen, }, }; @@ -265,7 +419,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_PROFILE, .numColumns = 2, .numRows = 2, - .frameId = 0, + .frameId = FRAMEID_GENERAL_2x2, .fourFooterOptions = FALSE, .titleText = gText_Profile, .instructionsText1 = gText_CombineFourWordsOrPhrases, @@ -277,7 +431,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_BATTLE_START, .numColumns = 2, .numRows = 3, - .frameId = 1, + .frameId = FRAMEID_GENERAL_2x3, .fourFooterOptions = FALSE, .titleText = gText_AtTheBattlesStart, .instructionsText1 = gText_CombineSixWordsOrPhrases, @@ -289,7 +443,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_BATTLE_WON, .numColumns = 2, .numRows = 3, - .frameId = 1, + .frameId = FRAMEID_GENERAL_2x3, .fourFooterOptions = FALSE, .titleText = gText_UponWinningABattle, .instructionsText1 = gText_CombineSixWordsOrPhrases, @@ -301,7 +455,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_BATTLE_LOST, .numColumns = 2, .numRows = 3, - .frameId = 1, + .frameId = FRAMEID_GENERAL_2x3, .fourFooterOptions = FALSE, .titleText = gText_UponLosingABattle, .instructionsText1 = gText_CombineSixWordsOrPhrases, @@ -313,7 +467,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_MAIL, .numColumns = 2, .numRows = 5, - .frameId = 2, + .frameId = FRAMEID_MAIL, .fourFooterOptions = FALSE, .titleText = NULL, .instructionsText1 = gText_CombineNineWordsOrPhrases, @@ -325,7 +479,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_INTERVIEW, .numColumns = 2, .numRows = 2, - .frameId = 5, + .frameId = FRAMEID_INTERVIEW, .fourFooterOptions = FALSE, .titleText = gText_Interview, .instructionsText1 = gText_CombineFourWordsOrPhrases, @@ -337,7 +491,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_BARD_SONG, .numColumns = 2, .numRows = 3, - .frameId = 1, + .frameId = FRAMEID_GENERAL_2x3, .fourFooterOptions = FALSE, .titleText = gText_TheBardsSong, .instructionsText1 = gText_ChangeJustOneWordOrPhrase, @@ -349,7 +503,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_FAN_CLUB, .numColumns = 1, .numRows = 1, - .frameId = 4, + .frameId = FRAMEID_INTERVIEW_SHOW_PERSON, .fourFooterOptions = FALSE, .titleText = gText_Interview, .instructionsText1 = gText_FindWordsThatDescribeYour, @@ -361,7 +515,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_TRENDY_PHRASE, .numColumns = 2, .numRows = 1, - .frameId = 3, + .frameId = FRAMEID_COMBINE_TWO_WORDS, .fourFooterOptions = FALSE, .titleText = gText_WhatsHipAndHappening, .instructionsText1 = gText_CombineTwoWordsOrPhrases, @@ -373,7 +527,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_QUIZ_QUESTION, .numColumns = 2, .numRows = 5, - .frameId = 7, + .frameId = FRAMEID_QUIZ_QUESTION, .fourFooterOptions = TRUE, .titleText = NULL, .instructionsText1 = gText_AfterYouHaveReadTheQuiz, @@ -385,7 +539,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_QUIZ_ANSWER, .numColumns = 1, .numRows = 1, - .frameId = 6, + .frameId = FRAMEID_QUIZ_ANSWER, .fourFooterOptions = TRUE, .titleText = gText_TheQuizAnswerIs, .instructionsText1 = gText_OutOfTheListedChoices, @@ -397,7 +551,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_QUIZ_SET_QUESTION, .numColumns = 2, .numRows = 5, - .frameId = 8, + .frameId = FRAMEID_QUIZ_SET_QUESTION, .fourFooterOptions = TRUE, .titleText = NULL, .instructionsText1 = gText_CombineNineWordsOrPhrases, @@ -409,7 +563,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_QUIZ_SET_ANSWER, .numColumns = 1, .numRows = 1, - .frameId = 6, + .frameId = FRAMEID_QUIZ_ANSWER, .fourFooterOptions = TRUE, .titleText = gText_TheQuizAnswerIs, .instructionsText1 = gText_PickAWordOrPhraseAnd, @@ -421,7 +575,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_BARD_SONG, .numColumns = 2, .numRows = 3, - .frameId = 1, + .frameId = FRAMEID_GENERAL_2x3, .fourFooterOptions = FALSE, .titleText = gText_TheBardsSong, .instructionsText1 = gText_ChangeJustOneWordOrPhrase, @@ -433,7 +587,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_APPRENTICE, .numColumns = 2, .numRows = 3, - .frameId = 1, + .frameId = FRAMEID_GENERAL_2x3, .fourFooterOptions = FALSE, .titleText = gText_ApprenticesPhrase, .instructionsText1 = gText_FindWordsWhichFit, @@ -445,7 +599,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_GOOD_SAYING, .numColumns = 2, .numRows = 1, - .frameId = 3, + .frameId = FRAMEID_COMBINE_TWO_WORDS, .fourFooterOptions = FALSE, .titleText = gText_GoodSaying, .instructionsText1 = gText_CombineTwoWordsOrPhrases2, @@ -457,7 +611,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_GABBY_AND_TY, .numColumns = 1, .numRows = 1, - .frameId = 4, + .frameId = FRAMEID_INTERVIEW_SHOW_PERSON, .fourFooterOptions = FALSE, .titleText = gText_Interview, .instructionsText1 = gText_FindWordsThatDescribeYour, @@ -469,7 +623,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_BATTLE_TOWER_INTERVIEW, .numColumns = 1, .numRows = 1, - .frameId = 4, + .frameId = FRAMEID_INTERVIEW_SHOW_PERSON, .fourFooterOptions = FALSE, .titleText = gText_Interview, .instructionsText1 = gText_FindWordsThatDescribeYour, @@ -481,7 +635,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_CONTEST_INTERVIEW, .numColumns = 1, .numRows = 1, - .frameId = 4, + .frameId = FRAMEID_INTERVIEW_SHOW_PERSON, .fourFooterOptions = FALSE, .titleText = gText_Interview, .instructionsText1 = gText_FindWordsThatDescribeYour, @@ -493,7 +647,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_FAN_QUESTION, .numColumns = 1, .numRows = 1, - .frameId = 4, + .frameId = FRAMEID_INTERVIEW_SHOW_PERSON, .fourFooterOptions = FALSE, .titleText = gText_FansQuestion, .instructionsText1 = gText_FindWordsWhichFit, @@ -505,7 +659,7 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { .type = EASY_CHAT_TYPE_QUESTIONNAIRE, .numColumns = 2, .numRows = 2, - .frameId = 0, + .frameId = FRAMEID_GENERAL_2x2, .fourFooterOptions = FALSE, .titleText = gText_Questionnaire, .instructionsText1 = gText_CombineFourWordsOrPhrases, @@ -515,14 +669,17 @@ static const struct EasyChatScreenTemplate sEasyChatScreenTemplates[] = { }, }; -static const u8 sUnknown_08597748[][7] = { +// IDs are used indirectly as indexes into gEasyChatWordsByLetterPointers +// 0 is 'Others', 1-26 are the letters A-Z +// This array maps the group IDs to the alphabet keyboard +static const u8 sAlphabetGroupIdMap[NUM_ALPHABET_ROWS][NUM_ALPHABET_COLUMNS] = { { 1, 2, 3, 4, 5, 6, 0}, { 7, 8, 9, 10, 11, 12, 0}, {13, 14, 15, 16, 17, 18, 19}, {20, 21, 22, 23, 24, 25, 26}, }; -static const u16 sMysteryGiftPhrase[] = { +static const u16 sMysteryGiftPhrase[NUM_QUESTIONNAIRE_WORDS] = { EC_WORD_LINK, EC_WORD_TOGETHER, EC_WORD_WITH, @@ -537,81 +694,81 @@ static const u16 sBerryMasterWifePhrases[][2] = { [PHRASE_SUPER_HUSTLE - 1] = {EC_WORD_SUPER, EC_WORD_HUSTLE}, }; -static const u16 sEasyChatTriangleCursorPalette[] = INCBIN_U16("graphics/easy_chat/triangle_cursor.gbapal"); -static const u32 sEasyChatTriangleCursorGfx[] = INCBIN_U32("graphics/easy_chat/triangle_cursor.4bpp"); -static const u32 sEasyChatScrollIndicatorGfx[] = INCBIN_U32("graphics/easy_chat/scroll_indicator.4bpp"); -static const u32 sEasyChatStartSelectButtonsGfx[] = INCBIN_U32("graphics/easy_chat/start_select_buttons.4bpp"); +static const u16 sTriangleCursor_Pal[] = INCBIN_U16("graphics/easy_chat/triangle_cursor.gbapal"); +static const u32 sTriangleCursor_Gfx[] = INCBIN_U32("graphics/easy_chat/triangle_cursor.4bpp"); +static const u32 sScrollIndicator_Gfx[] = INCBIN_U32("graphics/easy_chat/scroll_indicator.4bpp"); +static const u32 sStartSelectButtons_Gfx[] = INCBIN_U32("graphics/easy_chat/start_select_buttons.4bpp"); static const u16 sUnknown_085979C0[] = INCBIN_U16("graphics/misc/interview_frame.gbapal"); static const u32 sUnknown_085979E0[] = INCBIN_U32("graphics/misc/interview_frame.4bpp.lz"); -static const u16 sUnknown_08597B14[] = INCBIN_U16("graphics/misc/interview_frame_orange.gbapal"); -static const u16 sUnknown_08597B34[] = INCBIN_U16("graphics/misc/interview_frame_green.gbapal"); -static const u32 sUnknown_08597B54[] = INCBIN_U32("graphics/misc/interview_frame_2.4bpp.lz"); +static const u16 sTextInputFrameOrange_Pal[] = INCBIN_U16("graphics/easy_chat/text_input_frame_orange.gbapal"); +static const u16 sTextInputFrameGreen_Pal[] = INCBIN_U16("graphics/easy_chat/text_input_frame_green.gbapal"); +static const u32 sTextInputFrame_Gfx[] = INCBIN_U32("graphics/easy_chat/text_input_frame.4bpp.lz"); static const u16 sUnknown_08597C1C[] = INCBIN_U16("graphics/misc/8597C1C.gbapal"); static const u16 sUnknown_08597C24[] = INCBIN_U16("graphics/misc/8597C24.gbapal"); static const struct EasyChatPhraseFrameDimensions sPhraseFrameDimensions[] = { - { + [FRAMEID_GENERAL_2x2] = { .left = 3, .top = 4, .width = 24, .height = 4, - .footerId = 0, + .footerId = FOOTER_NORMAL, }, - { + [FRAMEID_GENERAL_2x3] = { .left = 3, .top = 3, .width = 24, .height = 6, - .footerId = 0, + .footerId = FOOTER_NORMAL, }, - { + [FRAMEID_MAIL] = { .left = 3, .top = 0, .width = 24, .height = 10, - .footerId = 0, + .footerId = FOOTER_NORMAL, }, - { + [FRAMEID_COMBINE_TWO_WORDS] = { .left = 3, .top = 5, .width = 24, .height = 2, - .footerId = 0, + .footerId = FOOTER_NORMAL, }, - { + [FRAMEID_INTERVIEW_SHOW_PERSON] = { .left = 16, .top = 5, .width = 12, .height = 2, - .footerId = 0, + .footerId = FOOTER_NORMAL, }, - { + [FRAMEID_INTERVIEW] = { .left = 3, .top = 4, .width = 24, .height = 4, - .footerId = 0, + .footerId = FOOTER_NORMAL, }, - { + [FRAMEID_QUIZ_ANSWER] = { .left = 9, .top = 4, .width = 12, .height = 2, - .footerId = 1, + .footerId = FOOTER_QUIZ, }, - { + [FRAMEID_QUIZ_QUESTION] = { .left = 5, .top = 3, - .width = 0x14, + .width = 20, .height = 10, - .footerId = 3, + .footerId = NUM_FOOTER_TYPES, }, - { + [FRAMEID_QUIZ_SET_QUESTION] = { .left = 3, .top = 0, .width = 24, .height = 10, - .footerId = 2, + .footerId = FOOTER_ANSWER, }, }; @@ -685,7 +842,7 @@ static const struct WindowTemplate sEasyChatWindowTemplates[] = { DUMMY_WIN_TEMPLATE, }; -static const struct WindowTemplate sEasyChatYesNoWindowTemplate = { +static const struct WindowTemplate sEasyChatYesNoWindowTemplate = { .bg = 0, .tilemapLeft = 22, .tilemapTop = 9, @@ -697,7 +854,7 @@ static const struct WindowTemplate sEasyChatYesNoWindowTemplate = { static const u8 sText_Clear17[] = _("{CLEAR 17}"); -static const u8 *const sEasyChatKeyboardText[] = +static const u8 *const sEasyChatKeyboardAlphabet[NUM_ALPHABET_ROWS] = { gText_EasyChatKeyboard_ABCDEFothers, gText_EasyChatKeyboard_GHIJKL, @@ -705,71 +862,71 @@ static const u8 *const sEasyChatKeyboardText[] = gText_EasyChatKeyboard_TUVWXYZ, }; -static const struct SpriteSheet sEasyChatSpriteSheets[] = { +static const struct SpriteSheet sSpriteSheets[] = { { - .data = sEasyChatTriangleCursorGfx, - .size = 0x0020, - .tag = 0 + .data = sTriangleCursor_Gfx, + .size = 0x20, + .tag = GFXTAG_TRIANGLE_CURSOR }, { - .data = sEasyChatScrollIndicatorGfx, - .size = 0x0100, - .tag = 2 + .data = sScrollIndicator_Gfx, + .size = 0x100, + .tag = GFXTAG_SCROLL_INDICATOR }, { - .data = sEasyChatStartSelectButtonsGfx, - .size = 0x0100, - .tag = 3 + .data = sStartSelectButtons_Gfx, + .size = 0x100, + .tag = GFXTAG_START_SELECT_BUTTONS }, {0} }; -static const struct SpritePalette sEasyChatSpritePalettes[] = { +static const struct SpritePalette sSpritePalettes[] = { { - .data = sEasyChatTriangleCursorPalette, - .tag = 0, + .data = sTriangleCursor_Pal, + .tag = PALTAG_TRIANGLE_CURSOR, }, { - .data = gEasyChatCursor_Pal, - .tag = 1, + .data = gEasyChatRectangleCursor_Pal, + .tag = PALTAG_RECTANGLE_CURSOR, }, { - .data = gEasyChatRightWindow_Pal, - .tag = 2, + .data = gEasyChatButtonWindow_Pal, + .tag = PALTAG_MISC_UI, // The palette is generated from the button window but used for various parts of the UI }, { .data = sUnknown_085979C0, - .tag = 3, + .tag = PALTAG_3, }, {0} }; -static const struct CompressedSpriteSheet sUnknown_08597CE8[] = { +static const struct CompressedSpriteSheet sCompressedSpriteSheets[] = { { .data = sUnknown_085979E0, - .size = 0x0800, - .tag = 5, + .size = 0x800, + .tag = GFXTAG_5, }, { - .data = gEasyChatCursor_Gfx, + .data = gEasyChatRectangleCursor_Gfx, .size = 0x1000, - .tag = 1, + .tag = GFXTAG_RECTANGLE_CURSOR, }, { - .data = gEasyChatRightWindow_Gfx, - .size = 0x0800, - .tag = 6, + .data = gEasyChatButtonWindow_Gfx, + .size = 0x800, + .tag = GFXTAG_BUTTON_WINDOW, }, { .data = gEasyChatMode_Gfx, .size = 0x1000, - .tag = 4, + .tag = GFXTAG_MODE_WINDOW, }, }; -static const u8 sUnknown_08597D08[] = {0, 12, 24, 56, 68, 80, 92}; +static const u8 sAlphabetKeyboardColumnOffsets[NUM_ALPHABET_COLUMNS] = {0, 12, 24, 56, 68, 80, 92}; -static const struct OamData sOamData_8597D10 = { +static const struct OamData sOamData_TriangleCursor = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, @@ -785,17 +942,17 @@ static const struct OamData sOamData_8597D10 = { .affineParam = 0, }; -static const struct SpriteTemplate sUnknown_08597D18 = { - .tileTag = 0, - .paletteTag = 0, - .oam = &sOamData_8597D10, +static const struct SpriteTemplate sSpriteTemplate_TriangleCursor = { + .tileTag = PALTAG_TRIANGLE_CURSOR, + .paletteTag = GFXTAG_TRIANGLE_CURSOR, + .oam = &sOamData_TriangleCursor, .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_811DF28, + .callback = SpriteCB_Cursor, }; -static const struct OamData sUnknown_08597D30 = { +static const struct OamData sOamData_RectangleCursor = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, @@ -811,44 +968,52 @@ static const struct OamData sUnknown_08597D30 = { .affineParam = 0, }; -static const union AnimCmd sUnknown_08597D38[] = { +static const union AnimCmd sAnim_RectangleCursor_OnGroup[] = { ANIMCMD_FRAME(0, 0), ANIMCMD_END, }; -static const union AnimCmd sUnknown_08597D40[] = { +static const union AnimCmd sAnim_RectangleCursor_OnButton[] = { ANIMCMD_FRAME(32, 0), ANIMCMD_END, }; -static const union AnimCmd sUnknown_08597D48[] = { +static const union AnimCmd sAnim_RectangleCursor_OnOthers[] = { ANIMCMD_FRAME(64, 0), ANIMCMD_END, }; -static const union AnimCmd sUnknown_08597D50[] = { +static const union AnimCmd sAnim_RectangleCursor_OnLetter[] = { ANIMCMD_FRAME(96, 0), ANIMCMD_END, }; -static const union AnimCmd *const sUnknown_08597D58[] = { - sUnknown_08597D38, - sUnknown_08597D40, - sUnknown_08597D48, - sUnknown_08597D50, +// Each anim changes the width of the rectangle cursor to fit what it should be selecting +enum { + RECTCURSOR_ANIM_ON_GROUP, + RECTCURSOR_ANIM_ON_BUTTON, + RECTCURSOR_ANIM_ON_OTHERS, + RECTCURSOR_ANIM_ON_LETTER, }; -static const struct SpriteTemplate sUnknown_08597D68 = { - .tileTag = 1, - .paletteTag = 1, - .oam = &sUnknown_08597D30, - .anims = sUnknown_08597D58, +static const union AnimCmd *const sAnims_RectangleCursor[] = { + [RECTCURSOR_ANIM_ON_GROUP] = sAnim_RectangleCursor_OnGroup, + [RECTCURSOR_ANIM_ON_BUTTON] = sAnim_RectangleCursor_OnButton, + [RECTCURSOR_ANIM_ON_OTHERS] = sAnim_RectangleCursor_OnOthers, + [RECTCURSOR_ANIM_ON_LETTER] = sAnim_RectangleCursor_OnLetter, +}; + +static const struct SpriteTemplate sSpriteTemplate_RectangleCursor = { + .tileTag = GFXTAG_RECTANGLE_CURSOR, + .paletteTag = PALTAG_RECTANGLE_CURSOR, + .oam = &sOamData_RectangleCursor, + .anims = sAnims_RectangleCursor, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_811DF28, + .callback = SpriteCB_Cursor, }; -static const struct OamData sUnknown_08597D80 = { +static const struct OamData sOamData_ModeWindow = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, @@ -864,53 +1029,61 @@ static const struct OamData sUnknown_08597D80 = { .affineParam = 0, }; -static const union AnimCmd sUnknown_08597D88[] = { +static const union AnimCmd sAnim_ModeWindow_Hidden[] = { ANIMCMD_FRAME(96, 0), ANIMCMD_END, }; -static const union AnimCmd sUnknown_08597D90[] = { - ANIMCMD_FRAME(64, 4), - ANIMCMD_FRAME(32, 4), +static const union AnimCmd sAnim_ModeWindow_ToGroup[] = { + ANIMCMD_FRAME(64, 4), // Transition frame + ANIMCMD_FRAME(32, 4), // 'Group' frame ANIMCMD_END, }; -static const union AnimCmd sUnknown_08597D9C[] = { - ANIMCMD_FRAME(64, 4), - ANIMCMD_FRAME(0, 4), +static const union AnimCmd sAnim_ModeWindow_ToAlphabet[] = { + ANIMCMD_FRAME(64, 4), // Transition frame + ANIMCMD_FRAME(0, 4), // 'A-Z' frame ANIMCMD_END, }; -static const union AnimCmd sUnknown_08597DA8[] = { - ANIMCMD_FRAME(64, 4), - ANIMCMD_FRAME(96, 0), +static const union AnimCmd sAnim_ModeWindow_ToHidden[] = { + ANIMCMD_FRAME(64, 4), // Transition frame + ANIMCMD_FRAME(96, 0), // Hidden frame ANIMCMD_END, }; -static const union AnimCmd sUnknown_08597DB4[] = { +static const union AnimCmd sAnim_ModeWindow_Transition[] = { ANIMCMD_FRAME(64, 4), ANIMCMD_END, }; -static const union AnimCmd *const sUnknown_08597DBC[] = { - sUnknown_08597D88, - sUnknown_08597D90, - sUnknown_08597D9C, - sUnknown_08597DA8, - sUnknown_08597DB4, +enum { + MODEWINDOW_ANIM_HIDDEN, + MODEWINDOW_ANIM_TO_GROUP, + MODEWINDOW_ANIM_TO_ALPHABET, + MODEWINDOW_ANIM_TO_HIDDEN, + MODEWINDOW_ANIM_TRANSITION, }; -static const struct SpriteTemplate sUnknown_08597DD0 = { - .tileTag = 4, - .paletteTag = 2, - .oam = &sUnknown_08597D80, - .anims = sUnknown_08597DBC, +static const union AnimCmd *const sAnims_ModeWindow[] = { + [MODEWINDOW_ANIM_HIDDEN] = sAnim_ModeWindow_Hidden, + [MODEWINDOW_ANIM_TO_GROUP] = sAnim_ModeWindow_ToGroup, + [MODEWINDOW_ANIM_TO_ALPHABET] = sAnim_ModeWindow_ToAlphabet, + [MODEWINDOW_ANIM_TO_HIDDEN] = sAnim_ModeWindow_ToHidden, + [MODEWINDOW_ANIM_TRANSITION] = sAnim_ModeWindow_Transition, +}; + +static const struct SpriteTemplate sSpriteTemplate_ModeWindow = { + .tileTag = GFXTAG_MODE_WINDOW, + .paletteTag = PALTAG_MISC_UI, + .oam = &sOamData_ModeWindow, + .anims = sAnims_ModeWindow, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy, }; -static const struct OamData sUnknown_08597DE8 = { +static const struct OamData sOamData_ButtonWindow = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, @@ -926,17 +1099,17 @@ static const struct OamData sUnknown_08597DE8 = { .affineParam = 0, }; -static const struct SpriteTemplate sUnknown_08597DF0 = { - .tileTag = 6, - .paletteTag = 2, - .oam = &sUnknown_08597DE8, +static const struct SpriteTemplate sSpriteTemplate_ButtonWindow = { + .tileTag = GFXTAG_BUTTON_WINDOW, + .paletteTag = PALTAG_MISC_UI, + .oam = &sOamData_ButtonWindow, .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy, }; -static const struct OamData sUnknown_08597E08 = { +static const struct OamData sOamData_StartSelectButton = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, @@ -952,7 +1125,7 @@ static const struct OamData sUnknown_08597E08 = { .affineParam = 0, }; -static const struct OamData gUnknown_08597E10 = { +static const struct OamData sOamData_ScrollIndicator = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, @@ -968,89 +1141,90 @@ static const struct OamData gUnknown_08597E10 = { .affineParam = 0, }; -static const union AnimCmd sUnknown_08597E18[] = { +static const union AnimCmd sAnim_Frame0[] = { ANIMCMD_FRAME(0, 0), ANIMCMD_END, }; -static const union AnimCmd sUnknown_08597E20[] = { +static const union AnimCmd sAnim_Frame1[] = { ANIMCMD_FRAME(4, 0), ANIMCMD_END, }; -static const union AnimCmd *const sUnknown_08597E28[] = { - sUnknown_08597E18, - sUnknown_08597E20, +// Frame0 is Start button, Frame1 is Select button, both are identical for the scroll indicators +static const union AnimCmd *const sAnims_TwoFrame[] = { + sAnim_Frame0, + sAnim_Frame1, }; -static const struct SpriteTemplate sUnknown_08597E30 = { - .tileTag = 3, - .paletteTag = 2, - .oam = &sUnknown_08597E08, - .anims = sUnknown_08597E28, +static const struct SpriteTemplate sSpriteTemplate_StartSelectButton = { + .tileTag = GFXTAG_START_SELECT_BUTTONS, + .paletteTag = PALTAG_MISC_UI, + .oam = &sOamData_StartSelectButton, + .anims = sAnims_TwoFrame, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy, }; -static const struct SpriteTemplate sUnknown_08597E48 = { - .tileTag = 2, - .paletteTag = 2, - .oam = &gUnknown_08597E10, - .anims = sUnknown_08597E28, +static const struct SpriteTemplate sSpriteTemplate_ScrollIndicator = { + .tileTag = GFXTAG_SCROLL_INDICATOR, + .paletteTag = PALTAG_MISC_UI, + .oam = &sOamData_ScrollIndicator, + .anims = sAnims_TwoFrame, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy, }; -static const u8 sFooterOptionXOffsets[][4] = { - {16, 111, 196, 0}, - {16, 78, 130, 160}, - {16, 80, 134, 170}, +static const u8 sFooterOptionXOffsets[NUM_FOOTER_TYPES][4] = { + [FOOTER_NORMAL] = {16, 111, 196, 0}, + [FOOTER_QUIZ] = {16, 78, 130, 160}, + [FOOTER_ANSWER] = {16, 80, 134, 170}, }; -static const u8 *const sFooterTextOptions[][4] = { - {gText_DelAll, gText_Cancel5, gText_Ok2, NULL}, - {gText_DelAll, gText_Cancel5, gText_Ok2, gText_Quiz}, - {gText_DelAll, gText_Cancel5, gText_Ok2, gText_Answer}, +static const u8 *const sFooterTextOptions[NUM_FOOTER_TYPES][4] = { + [FOOTER_NORMAL] = {gText_DelAll, gText_Cancel5, gText_Ok2, NULL}, + [FOOTER_QUIZ] = {gText_DelAll, gText_Cancel5, gText_Ok2, gText_Quiz}, + [FOOTER_ANSWER] = {gText_DelAll, gText_Cancel5, gText_Ok2, gText_Answer}, }; #include "data/easy_chat/easy_chat_groups.h" #include "data/easy_chat/easy_chat_words_by_letter.h" -const u8 *const gEasyChatGroupNamePointers[] = { - [EC_GROUP_POKEMON] = gEasyChatGroupName_Pokemon, - [EC_GROUP_TRAINER] = gEasyChatGroupName_Trainer, - [EC_GROUP_STATUS] = gEasyChatGroupName_Status, - [EC_GROUP_BATTLE] = gEasyChatGroupName_Battle, - [EC_GROUP_GREETINGS] = gEasyChatGroupName_Greetings, - [EC_GROUP_PEOPLE] = gEasyChatGroupName_People, - [EC_GROUP_VOICES] = gEasyChatGroupName_Voices, - [EC_GROUP_SPEECH] = gEasyChatGroupName_Speech, - [EC_GROUP_ENDINGS] = gEasyChatGroupName_Endings, - [EC_GROUP_FEELINGS] = gEasyChatGroupName_Feelings, - [EC_GROUP_CONDITIONS] = gEasyChatGroupName_Conditions, - [EC_GROUP_ACTIONS] = gEasyChatGroupName_Actions, - [EC_GROUP_LIFESTYLE] = gEasyChatGroupName_Lifestyle, - [EC_GROUP_HOBBIES] = gEasyChatGroupName_Hobbies, - [EC_GROUP_TIME] = gEasyChatGroupName_Time, - [EC_GROUP_MISC] = gEasyChatGroupName_Misc, - [EC_GROUP_ADJECTIVES] = gEasyChatGroupName_Adjectives, - [EC_GROUP_EVENTS] = gEasyChatGroupName_Events, - [EC_GROUP_MOVE_1] = gEasyChatGroupName_Move1, - [EC_GROUP_MOVE_2] = gEasyChatGroupName_Move2, - [EC_GROUP_TRENDY_SAYING] = gEasyChatGroupName_TrendySaying, - [EC_GROUP_POKEMON_2] = gEasyChatGroupName_Pokemon2, +static const u8 *const sEasyChatGroupNamePointers[EC_NUM_GROUPS] = { + [EC_GROUP_POKEMON] = gEasyChatGroupName_Pokemon, + [EC_GROUP_TRAINER] = gEasyChatGroupName_Trainer, + [EC_GROUP_STATUS] = gEasyChatGroupName_Status, + [EC_GROUP_BATTLE] = gEasyChatGroupName_Battle, + [EC_GROUP_GREETINGS] = gEasyChatGroupName_Greetings, + [EC_GROUP_PEOPLE] = gEasyChatGroupName_People, + [EC_GROUP_VOICES] = gEasyChatGroupName_Voices, + [EC_GROUP_SPEECH] = gEasyChatGroupName_Speech, + [EC_GROUP_ENDINGS] = gEasyChatGroupName_Endings, + [EC_GROUP_FEELINGS] = gEasyChatGroupName_Feelings, + [EC_GROUP_CONDITIONS] = gEasyChatGroupName_Conditions, + [EC_GROUP_ACTIONS] = gEasyChatGroupName_Actions, + [EC_GROUP_LIFESTYLE] = gEasyChatGroupName_Lifestyle, + [EC_GROUP_HOBBIES] = gEasyChatGroupName_Hobbies, + [EC_GROUP_TIME] = gEasyChatGroupName_Time, + [EC_GROUP_MISC] = gEasyChatGroupName_Misc, + [EC_GROUP_ADJECTIVES] = gEasyChatGroupName_Adjectives, + [EC_GROUP_EVENTS] = gEasyChatGroupName_Events, + [EC_GROUP_MOVE_1] = gEasyChatGroupName_Move1, + [EC_GROUP_MOVE_2] = gEasyChatGroupName_Move2, + [EC_GROUP_TRENDY_SAYING] = gEasyChatGroupName_TrendySaying, + [EC_GROUP_POKEMON_NATIONAL] = gEasyChatGroupName_Pokemon2, }; -static const u16 sDefaultProfileWords[] = { +static const u16 sDefaultProfileWords[EASY_CHAT_BATTLE_WORDS_COUNT - 2] = { EC_WORD_I_AM, EC_WORD_A, EC_WORD_POKEMON, EC_WORD_FRIEND, }; -static const u16 sDefaultBattleStartWords[] = { +static const u16 sDefaultBattleStartWords[EASY_CHAT_BATTLE_WORDS_COUNT] = { EC_WORD_ARE, EC_WORD_YOU, EC_WORD_READY, @@ -1059,7 +1233,7 @@ static const u16 sDefaultBattleStartWords[] = { EC_WORD_EXCL, }; -static const u16 sUnknown_0859E640[] = { +static const u16 sDefaultBattleWonWords[EASY_CHAT_BATTLE_WORDS_COUNT] = { EC_WORD_YAY, EC_WORD_YAY, EC_WORD_EXCL_EXCL, @@ -1068,7 +1242,7 @@ static const u16 sUnknown_0859E640[] = { EC_WORD_EXCL_EXCL, }; -static const u16 sUnknown_0859E64C[] = { +static const u16 sDefaultBattleLostWords[EASY_CHAT_BATTLE_WORDS_COUNT] = { EC_WORD_TOO, EC_WORD_BAD, EC_WORD_ELLIPSIS, @@ -1077,24 +1251,40 @@ static const u16 sUnknown_0859E64C[] = { EC_WORD_ELLIPSIS, }; -static const u16 sUnknown_0859E658[] = { +static const u16 sRestrictedWordSpecies[] = { SPECIES_DEOXYS, }; -void DoEasyChatScreen(u8 type, u16 *words, MainCallback callback, u8 displayedPersonType) + +// In addition to the task defines below, these two elements +// have their indexes used explicitly because they are 4-byte +// pointers, and occupy the next data element as well. +// SetWordTaskArg/GetWordTaskArg use these defines to +// read the pointer from the two elements +#define TASKIDX_WORDS 2 +#define TASKIDX_EXIT_CALLBACK 4 + +#define tState data[0] +#define tType data[1] +#define tWords data[TASKIDX_WORDS] // Occupies 2 and 3 +#define tExitCallback data[TASKIDX_EXIT_CALLBACK] // Occupies 4 and 5 +#define tFuncId data[6] +#define tPersonType data[7] + +void DoEasyChatScreen(u8 type, u16 *words, MainCallback exitCallback, u8 displayedPersonType) { u8 taskId; ResetTasks(); - taskId = CreateTask(sub_811A2C0, 0); - gTasks[taskId].data[EZCHAT_TASK_TYPE] = type; - gTasks[taskId].data[EZCHAT_TASK_SIZE] = displayedPersonType; - SetWordTaskArg(taskId, EZCHAT_TASK_WORDS, (u32)words); - SetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK, (u32)callback); - SetMainCallback2(MainCallback_EasyChatScreen); + taskId = CreateTask(Task_InitEasyChatScreen, 0); + gTasks[taskId].tType = type; + gTasks[taskId].tPersonType = displayedPersonType; + SetWordTaskArg(taskId, TASKIDX_WORDS, (u32)words); + SetWordTaskArg(taskId, TASKIDX_EXIT_CALLBACK, (u32)exitCallback); + SetMainCallback2(CB2_EasyChatScreen); } -static void MainCallback_EasyChatScreen(void) +static void CB2_EasyChatScreen(void) { RunTasks(); AnimateSprites(); @@ -1102,94 +1292,97 @@ static void MainCallback_EasyChatScreen(void) UpdatePaletteFade(); } -static void VBlankCallback_EasyChatScreen(void) +static void VBlankCB_EasyChatScreen(void) { TransferPlttBuffer(); LoadOam(); ProcessSpriteCopyRequests(); } -static void sub_811A2A4(u8 taskId, TaskFunc taskFunc) +static void StartEasyChatScreen(u8 taskId, TaskFunc taskFunc) { gTasks[taskId].func = taskFunc; - gTasks[taskId].data[EZCHAT_TASK_STATE] = 0; + gTasks[taskId].tState = MAINSTATE_FADE_IN; } -static void sub_811A2C0(u8 taskId) +static void Task_InitEasyChatScreen(u8 taskId) { if (!IsUpdateLinkStateCBActive()) { - while (sub_811A428(taskId)); + while (InitEasyChatScreen(taskId)); } else { - if (sub_811A428(taskId) == TRUE) - { + if (InitEasyChatScreen(taskId) == TRUE) return; - } } - sub_811A2A4(taskId, sub_811A2FC); + StartEasyChatScreen(taskId, Task_EasyChatScreen); } -static void sub_811A2FC(u8 taskId) +// After loading, this is the 'main' Easy Chat task +static void Task_EasyChatScreen(u8 taskId) { - u16 v0; + u16 funcId; s16 *data; data = gTasks[taskId].data; - switch (data[EZCHAT_TASK_STATE]) + switch (tState) { - case 0: - SetVBlankCallback(VBlankCallback_EasyChatScreen); - BlendPalettes(0xFFFFFFFF, 16, 0); - BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); - data[EZCHAT_TASK_STATE] = 5; + case MAINSTATE_FADE_IN: + SetVBlankCallback(VBlankCB_EasyChatScreen); + BlendPalettes(PALETTES_ALL, 16, 0); + BeginNormalPaletteFade(PALETTES_ALL, -1, 16, 0, RGB_BLACK); + tState = MAINSTATE_WAIT_FADE_IN; break; - case 1: - v0 = sub_811AAAC(); - if (sub_811A88C(v0)) + case MAINSTATE_HANDLE_INPUT: + funcId = HandleEasyChatInput(); + if (IsFuncIdForQuizLadyScreen(funcId)) { - BeginNormalPaletteFade(0xFFFFFFFF, -2, 0, 16, RGB_BLACK); - data[EZCHAT_TASK_STATE] = 3; - data[EZCHAT_TASK_UNK06] = v0; + // Fade to Quiz Lady screen + BeginNormalPaletteFade(PALETTES_ALL, -2, 0, 16, RGB_BLACK); + tState = MAINSTATE_TO_QUIZ_LADY; + tFuncId = funcId; } - else if (v0 == 0x18) + else if (funcId == ECFUNC_EXIT) { - BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); - data[EZCHAT_TASK_STATE] = 4; + // Fade and exit Easy Chat + BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 16, RGB_BLACK); + tState = MAINSTATE_EXIT; } - else if (v0 != 0) + else if (funcId != ECFUNC_NONE) { PlaySE(SE_SELECT); - sub_811C158(v0); - data[EZCHAT_TASK_STATE] ++; + StartEasyChatFunction(funcId); + tState++; // MAINSTATE_RUN_FUNC } break; - case 2: - if (!sub_811C170()) - data[EZCHAT_TASK_STATE] = 1; + case MAINSTATE_RUN_FUNC: + if (!RunEasyChatFunction()) + tState = MAINSTATE_HANDLE_INPUT; break; - case 3: + case MAINSTATE_TO_QUIZ_LADY: if (!gPaletteFade.active) - sub_811A8A4(data[EZCHAT_TASK_UNK06]); + EnterQuizLadyScreen(tFuncId); break; - case 4: + case MAINSTATE_EXIT: if (!gPaletteFade.active) - sub_811A4D0((MainCallback)GetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK)); + ExitEasyChatScreen((MainCallback)GetWordTaskArg(taskId, TASKIDX_EXIT_CALLBACK)); break; - case 5: + case MAINSTATE_WAIT_FADE_IN: if (!gPaletteFade.active) - data[EZCHAT_TASK_STATE] = 1; + tState = MAINSTATE_HANDLE_INPUT; break; } } -static bool8 sub_811A428(u8 taskId) +// Returns TRUE if still initializing, FALSE when finished +// If an allocation fails it will switch to the exit callback +static bool8 InitEasyChatScreen(u8 taskId) { s16 *data; data = gTasks[taskId].data; - switch (data[EZCHAT_TASK_STATE]) + switch (tState) { case 0: SetVBlankCallback(NULL); @@ -1198,25 +1391,28 @@ static bool8 sub_811A428(u8 taskId) ResetPaletteFade(); break; case 1: - if (!sub_811F28C()) + if (!InitEasyChatScreenWordData()) { - sub_811A4D0((MainCallback)GetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK)); + // Alloc failed, exit + ExitEasyChatScreen((MainCallback)GetWordTaskArg(taskId, TASKIDX_EXIT_CALLBACK)); } break; case 2: - if (!EasyChat_AllocateResources(data[EZCHAT_TASK_TYPE], (u16 *)GetWordTaskArg(taskId, EZCHAT_TASK_WORDS), data[EZCHAT_TASK_SIZE])) + if (!InitEasyChatScreenStruct(tType, (u16 *)GetWordTaskArg(taskId, TASKIDX_WORDS), tPersonType)) { - sub_811A4D0((MainCallback)GetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK)); + // Alloc failed, exit + ExitEasyChatScreen((MainCallback)GetWordTaskArg(taskId, TASKIDX_EXIT_CALLBACK)); } break; case 3: - if (!sub_811BF8C()) + if (!InitEasyChatScreenControl()) { - sub_811A4D0((MainCallback)GetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK)); + // Alloc failed, exit + ExitEasyChatScreen((MainCallback)GetWordTaskArg(taskId, TASKIDX_EXIT_CALLBACK)); } break; case 4: - if (sub_811BFA4()) + if (LoadEasyChatScreen()) { return TRUE; } @@ -1224,15 +1420,15 @@ static bool8 sub_811A428(u8 taskId) default: return FALSE; } - data[EZCHAT_TASK_STATE] ++; + tState++; return TRUE; } -static void sub_811A4D0(MainCallback callback) +static void ExitEasyChatScreen(MainCallback callback) { - sub_811C13C(); - EasyChat_FreeResources(); - sub_811F2B8(); + FreeEasyChatScreenControl(); + FreeEasyChatScreenStruct(); + FreeEasyChatScreenWordData(); FreeAllWindowBuffers(); SetMainCallback2(callback); } @@ -1286,7 +1482,7 @@ void ShowEasyChatScreen(void) break; case EASY_CHAT_TYPE_GABBY_AND_TY: words = gSaveBlock1Ptr->gabbyAndTyData.quote; - *words = -1; + *words = EC_EMPTY_WORD; displayedPersonType = EASY_CHAT_PERSON_REPORTER_FEMALE; break; case EASY_CHAT_TYPE_CONTEST_INTERVIEW: @@ -1303,7 +1499,7 @@ void ShowEasyChatScreen(void) break; case EASY_CHAT_TYPE_FAN_QUESTION: words = gSaveBlock1Ptr->tvShows[gSpecialVar_0x8005].fanClubSpecial.words; - words[0] = -1; + words[0] = EC_EMPTY_WORD; displayedPersonType = EASY_CHAT_PERSON_BOY; break; case EASY_CHAT_TYPE_QUIZ_ANSWER: @@ -1321,7 +1517,7 @@ void ShowEasyChatScreen(void) words = gSaveBlock2Ptr->apprentices[0].speechWon; break; case EASY_CHAT_TYPE_QUESTIONNAIRE: - words = sub_801B058(); + words = GetQuestionnaireWordsPtr(); break; default: return; @@ -1345,7 +1541,7 @@ static void CB2_QuizLadyQuestion(void) if (!gPaletteFade.active) { lilycoveLady = &gSaveBlock1Ptr->lilycoveLady; - lilycoveLady->quiz.playerAnswer = -1; + lilycoveLady->quiz.playerAnswer = EC_EMPTY_WORD; CleanupOverworldWindowsAndTilemaps(); DoQuizQuestionEasyChatScreen(); } @@ -1359,30 +1555,30 @@ void QuizLadyShowQuizQuestion(void) SetMainCallback2(CB2_QuizLadyQuestion); } -static int sub_811A868(u16 word) +static int GetQuizLadyScreenByFuncId(u16 funcId) { int i; - for (i = 0; i < ARRAY_COUNT(sUnknown_08597530); i ++) + for (i = 0; i < ARRAY_COUNT(sQuizLadyEasyChatScreens); i ++) { - if (word == sUnknown_08597530[i].word) + if (funcId == sQuizLadyEasyChatScreens[i].funcId) return i; } return -1; } -static bool32 sub_811A88C(u16 word) +static bool32 IsFuncIdForQuizLadyScreen(u16 funcId) { - return sub_811A868(word) == -1 ? FALSE : TRUE; + return GetQuizLadyScreenByFuncId(funcId) == -1 ? FALSE : TRUE; } -static void sub_811A8A4(u16 word) +static void EnterQuizLadyScreen(u16 funcId) { int i; - i = sub_811A868(word); + i = GetQuizLadyScreenByFuncId(funcId); ResetTasks(); - sub_811A4D0(sUnknown_08597530[i].callback); + ExitEasyChatScreen(sQuizLadyEasyChatScreens[i].callback); } static void DoQuizAnswerEasyChatScreen(void) @@ -1418,7 +1614,7 @@ static void DoQuizSetQuestionEasyChatScreen(void) EASY_CHAT_PERSON_DISPLAY_NONE); } -static bool8 EasyChat_AllocateResources(u8 type, u16 *words, u8 displayedPersonType) +static bool8 InitEasyChatScreenStruct(u8 type, u16 *words, u8 displayedPersonType) { u8 templateId; int i; @@ -1428,116 +1624,121 @@ static bool8 EasyChat_AllocateResources(u8 type, u16 *words, u8 displayedPersonT return FALSE; sEasyChatScreen->type = type; - sEasyChatScreen->words = words; + sEasyChatScreen->savedPhrase = words; sEasyChatScreen->mainCursorColumn = 0; sEasyChatScreen->mainCursorRow = 0; - sEasyChatScreen->unk_09 = 0; + sEasyChatScreen->inAlphabetMode = FALSE; sEasyChatScreen->displayedPersonType = displayedPersonType; - sEasyChatScreen->unk_13 = 0; + sEasyChatScreen->unused = 0; templateId = GetEachChatScreenTemplateId(type); if (type == EASY_CHAT_TYPE_QUIZ_QUESTION) { - sub_811BDF0(sEasyChatScreen->unk_14); - sEasyChatScreen->titleText = sEasyChatScreen->unk_14; - sEasyChatScreen->state = 7; + GetQuizTitle(sEasyChatScreen->quizTitle); + sEasyChatScreen->titleText = sEasyChatScreen->quizTitle; + sEasyChatScreen->inputState = INPUTSTATE_QUIZ_QUESTION; } else { - sEasyChatScreen->state = 0; + sEasyChatScreen->inputState = INPUTSTATE_PHRASE; sEasyChatScreen->titleText = sEasyChatScreenTemplates[templateId].titleText; } sEasyChatScreen->numColumns = sEasyChatScreenTemplates[templateId].numColumns; sEasyChatScreen->numRows = sEasyChatScreenTemplates[templateId].numRows; - sEasyChatScreen->unk_07 = sEasyChatScreen->numColumns * sEasyChatScreen->numRows; + sEasyChatScreen->maxWords = sEasyChatScreen->numColumns * sEasyChatScreen->numRows; sEasyChatScreen->templateId = templateId; - if (sEasyChatScreen->unk_07 > 9) - sEasyChatScreen->unk_07 = 9; + if (sEasyChatScreen->maxWords > ARRAY_COUNT(sEasyChatScreen->currentPhrase)) + sEasyChatScreen->maxWords = ARRAY_COUNT(sEasyChatScreen->currentPhrase); if (words != NULL) { - CpuCopy16(words, sEasyChatScreen->ecWordBuffer, sEasyChatScreen->unk_07 * sizeof(u16)); + // Phrase starts with words filled in, copy to current phrase + CpuCopy16(words, sEasyChatScreen->currentPhrase, sEasyChatScreen->maxWords * sizeof(u16)); } else { - for (i = 0; i < sEasyChatScreen->unk_07; i ++) - sEasyChatScreen->ecWordBuffer[i] = -1; + // Phrase starts with no words, fill with empty words and save + for (i = 0; i < sEasyChatScreen->maxWords; i ++) + sEasyChatScreen->currentPhrase[i] = EC_EMPTY_WORD; - sEasyChatScreen->words = sEasyChatScreen->ecWordBuffer; + sEasyChatScreen->savedPhrase = sEasyChatScreen->currentPhrase; } - sEasyChatScreen->unk_0d = (sub_811F3AC() - 1) / 2 + 1; + sEasyChatScreen->keyboardLastRow = (GetNumUnlockedEasyChatGroups() - 1) / 2 + 1; return TRUE; } -static void EasyChat_FreeResources(void) +static void FreeEasyChatScreenStruct(void) { if (sEasyChatScreen != NULL) FREE_AND_SET_NULL(sEasyChatScreen); } -static u16 sub_811AAAC(void) +// Returns the function ID of the action to take as a result of player's input. +// If no action is needed, returns ECFUNC_NONE +static u16 HandleEasyChatInput(void) { - switch (sEasyChatScreen->state) + switch (sEasyChatScreen->inputState) { - case 0: - return sub_811AB68(); - case 1: - return sub_811ACDC(); - case 2: - return sub_811AE44(); - case 3: - return sub_811AF00(); - case 4: - return sub_811AF8C(); - case 5: - return sub_811B040(); - case 6: - return sub_811AFEC(); - case 7: - return sub_811B08C(); - case 8: - return sub_811B0BC(); - case 9: - return sub_811B0E8(); - case 10: - return sub_811B0F8(); + case INPUTSTATE_PHRASE: + return HandleEasyChatInput_Phrase(); + case INPUTSTATE_MAIN_SCREEN_BUTTONS: + return HandleEasyChatInput_MainScreenButtons(); + case INPUTSTATE_KEYBOARD: + return HandleEasyChatInput_Keyboard(); + case INPUTSTATE_WORD_SELECT: + return HandleEasyChatInput_WordSelect(); + case INPUTSTATE_EXIT_PROMPT: + return HandleEasyChatInput_ExitPrompt(); + case INPUTSTATE_DELETE_ALL_YES_NO: + return HandleEasyChatInput_DeleteAllYesNo(); + case INPUTSTATE_CONFIRM_WORDS_YES_NO: + return HandleEasyChatInput_ConfirmWordsYesNo(); + case INPUTSTATE_QUIZ_QUESTION: + return HandleEasyChatInput_QuizQuestion(); + case INPUTSTATE_WAIT_FOR_MSG: + return HandleEasyChatInput_WaitForMsg(); + case INPUTSTATE_START_CONFIRM_LYRICS: + return HandleEasyChatInput_StartConfirmLyrics(); + case INPUTSTATE_CONFIRM_LYRICS_YES_NO: + return HandleEasyChatInput_ConfirmLyricsYesNo(); } - return 0; + return ECFUNC_NONE; } -bool32 sub_811AB44(void) +static bool32 IsCurrentFrame2x5(void) { switch (GetEasyChatScreenFrameId()) { - case 2: - case 7: - case 8: + case FRAMEID_MAIL: + case FRAMEID_QUIZ_QUESTION: + case FRAMEID_QUIZ_SET_QUESTION: return TRUE; } return FALSE; } -static u16 sub_811AB68(void) +// Handles main screen input while cursor is on a word in the phrase +static u16 HandleEasyChatInput_Phrase(void) { do { if (JOY_NEW(A_BUTTON)) { - sub_811BF78(); - sEasyChatScreen->state = 2; - sEasyChatScreen->unk_0a = 0; - sEasyChatScreen->unk_0b = 0; - sEasyChatScreen->unk_0c = 0; - return 9; + ClearUnusedField(); + sEasyChatScreen->inputState = INPUTSTATE_KEYBOARD; + sEasyChatScreen->keyboardColumn = 0; + sEasyChatScreen->keyboardRow = 0; + sEasyChatScreen->keyboardScrollOffset = 0; + return ECFUNC_OPEN_KEYBOARD; } else if (JOY_NEW(B_BUTTON)) { - return sub_811B150(); + return StartConfirmExitPrompt(); } else if (JOY_NEW(START_BUTTON)) { - return sub_811B1B4(); + return TryConfirmWords(); } else if (JOY_NEW(DPAD_UP)) { @@ -1560,37 +1761,42 @@ static u16 sub_811AB68(void) break; } - return 0; + return ECFUNC_NONE; } while (0); + // Handle D-Pad input + + // Wrap row if (sEasyChatScreen->mainCursorRow < 0) sEasyChatScreen->mainCursorRow = sEasyChatScreenTemplates[sEasyChatScreen->templateId].numRows; - if (sEasyChatScreen->mainCursorRow > sEasyChatScreenTemplates[sEasyChatScreen->templateId].numRows) sEasyChatScreen->mainCursorRow = 0; if (sEasyChatScreen->mainCursorRow == sEasyChatScreenTemplates[sEasyChatScreen->templateId].numRows) { + // Moved onto bottom row (buttons) if (sEasyChatScreen->mainCursorColumn > 2) sEasyChatScreen->mainCursorColumn = 2; - sEasyChatScreen->state = 1; - return 3; + sEasyChatScreen->inputState = INPUTSTATE_MAIN_SCREEN_BUTTONS; + return ECFUNC_UPDATE_MAIN_CURSOR_ON_BUTTONS; } + // Wrap column if (sEasyChatScreen->mainCursorColumn < 0) sEasyChatScreen->mainCursorColumn = sEasyChatScreenTemplates[sEasyChatScreen->templateId].numColumns - 1; - if (sEasyChatScreen->mainCursorColumn >= sEasyChatScreenTemplates[sEasyChatScreen->templateId].numColumns) sEasyChatScreen->mainCursorColumn = 0; - if (sub_811AB44() && sEasyChatScreen->mainCursorColumn == 1 && sEasyChatScreen->mainCursorRow == 4) + // All 2x5 phrases are only 9 words long, exclude the bottom right (10th) position + if (IsCurrentFrame2x5() && sEasyChatScreen->mainCursorColumn == 1 && sEasyChatScreen->mainCursorRow == 4) sEasyChatScreen->mainCursorColumn = 0; - return 2; + return ECFUNC_UPDATE_MAIN_CURSOR; } -static u16 sub_811ACDC(void) +// Handles main screen input while cursor is below the phrase on one of the buttons, e.g. Del. All or Cancel +static u16 HandleEasyChatInput_MainScreenButtons(void) { do { @@ -1598,24 +1804,24 @@ static u16 sub_811ACDC(void) { switch (sEasyChatScreen->mainCursorColumn) { - case 0: - return sub_811B184(); - case 1: - return sub_811B150(); - case 2: - return sub_811B1B4(); - case 3: - return sub_811B264(); + case 0: // Del. All button + return DoDeleteAllButton(); + case 1: // Cancel button + return StartConfirmExitPrompt(); + case 2: // OK button + return TryConfirmWords(); + case 3: // Quiz/Answer button + return DoQuizButton(); } } if (JOY_NEW(B_BUTTON)) { - return sub_811B150(); + return StartConfirmExitPrompt(); } else if (JOY_NEW(START_BUTTON)) { - return sub_811B1B4(); + return TryConfirmWords(); } else if (JOY_NEW(DPAD_UP)) { @@ -1638,7 +1844,7 @@ static u16 sub_811ACDC(void) break; } - return 0; + return ECFUNC_NONE; } while (0); if (sEasyChatScreen->mainCursorRow == sEasyChatScreenTemplates[sEasyChatScreen->templateId].numRows) @@ -1650,790 +1856,803 @@ static u16 sub_811ACDC(void) if (sEasyChatScreen->mainCursorColumn >= numFooterColumns) sEasyChatScreen->mainCursorColumn = 0; - return 3; + return ECFUNC_UPDATE_MAIN_CURSOR_ON_BUTTONS; } if (sEasyChatScreen->mainCursorColumn >= sEasyChatScreenTemplates[sEasyChatScreen->templateId].numColumns) sEasyChatScreen->mainCursorColumn = sEasyChatScreenTemplates[sEasyChatScreen->templateId].numColumns - 1; - if (sub_811AB44() && sEasyChatScreen->mainCursorColumn == 1 && sEasyChatScreen->mainCursorRow == 4) + // All 2x5 phrases are only 9 words long, exclude the bottom right (10th) position + if (IsCurrentFrame2x5() && sEasyChatScreen->mainCursorColumn == 1 && sEasyChatScreen->mainCursorRow == 4) sEasyChatScreen->mainCursorColumn = 0; - sEasyChatScreen->state = 0; - return 2; + sEasyChatScreen->inputState = INPUTSTATE_PHRASE; + return ECFUNC_UPDATE_MAIN_CURSOR; } -static u16 sub_811AE44(void) +static u16 HandleEasyChatInput_Keyboard(void) { if (JOY_NEW(B_BUTTON)) - return sub_811B32C(); + return ExitKeyboardToMainScreen(); if (JOY_NEW(A_BUTTON)) { - if (sEasyChatScreen->unk_0a != -1) - return sub_811B2B0(); + if (sEasyChatScreen->keyboardColumn != -1) + return SelectKeyboardGroup(); - switch (sEasyChatScreen->unk_0b) + // Cursor is in button window + switch (sEasyChatScreen->keyboardRow) { - case 0: - return sub_811B33C(); - case 1: - return sub_811B368(); - case 2: - return sub_811B32C(); + case 0: // Mode button + return StartSwitchKeyboardMode(); + case 1: // Delete button + return DeleteSelectedWord(); + case 2: // Cancel button + return ExitKeyboardToMainScreen(); } } if (JOY_NEW(SELECT_BUTTON)) - return sub_811B33C(); + return StartSwitchKeyboardMode(); if (JOY_REPEAT(DPAD_UP)) - return sub_811B528(2); + return MoveKeyboardCursor(INPUT_UP); if (JOY_REPEAT(DPAD_DOWN)) - return sub_811B528(3); + return MoveKeyboardCursor(INPUT_DOWN); if (JOY_REPEAT(DPAD_LEFT)) - return sub_811B528(1); + return MoveKeyboardCursor(INPUT_LEFT); if (JOY_REPEAT(DPAD_RIGHT)) - return sub_811B528(0); + return MoveKeyboardCursor(INPUT_RIGHT); - return 0; + return ECFUNC_NONE; } -static u16 sub_811AF00(void) +// Input handling for the lower window after a word group has been selected +static u16 HandleEasyChatInput_WordSelect(void) { if (JOY_NEW(B_BUTTON)) { - sEasyChatScreen->state = 2; - return 14; + sEasyChatScreen->inputState = INPUTSTATE_KEYBOARD; + return ECFUNC_RETURN_TO_KEYBOARD; } if (JOY_NEW(A_BUTTON)) - return sub_811B394(); + return SelectNewWord(); if (JOY_NEW(START_BUTTON)) - return sub_811B794(4); + return MoveWordSelectCursor(INPUT_START); if (JOY_NEW(SELECT_BUTTON)) - return sub_811B794(5); + return MoveWordSelectCursor(INPUT_SELECT); if (JOY_REPEAT(DPAD_UP)) - return sub_811B794(2); + return MoveWordSelectCursor(INPUT_UP); if (JOY_REPEAT(DPAD_DOWN)) - return sub_811B794(3); + return MoveWordSelectCursor(INPUT_DOWN); if (JOY_REPEAT(DPAD_LEFT)) - return sub_811B794(1); + return MoveWordSelectCursor(INPUT_LEFT); if (JOY_REPEAT(DPAD_RIGHT)) - return sub_811B794(0); + return MoveWordSelectCursor(INPUT_RIGHT); - return 0; + return ECFUNC_NONE; } -static u16 sub_811AF8C(void) +static u16 HandleEasyChatInput_ExitPrompt(void) { - u8 var0; - switch (Menu_ProcessInputNoWrapClearOnChoose()) { - case MENU_B_PRESSED: // B Button - case 1: // No - sEasyChatScreen->state = sub_811B2A4(); - return 7; - case 0: // Yes + case MENU_B_PRESSED: + case 1: // No (Continue) + sEasyChatScreen->inputState = GetEasyChatBackupState(); + return ECFUNC_CLOSE_PROMPT; + case 0: // Yes (Exit) gSpecialVar_Result = 0; - var0 = sEasyChatScreen->type - EASY_CHAT_TYPE_QUIZ_SET_QUESTION; - if (var0 < 2) - sub_811B3E4(); + if (sEasyChatScreen->type == EASY_CHAT_TYPE_QUIZ_SET_QUESTION + || sEasyChatScreen->type == EASY_CHAT_TYPE_QUIZ_SET_ANSWER) + SaveCurrentPhrase(); - return 24; + return ECFUNC_EXIT; default: - return 0; + return ECFUNC_NONE; } } -static u16 sub_811AFEC(void) +static u16 HandleEasyChatInput_ConfirmWordsYesNo(void) { switch (Menu_ProcessInputNoWrapClearOnChoose()) { - case MENU_B_PRESSED: // B Button + case MENU_B_PRESSED: case 1: // No - sEasyChatScreen->state = sub_811B2A4(); - return 7; + sEasyChatScreen->inputState = GetEasyChatBackupState(); + return ECFUNC_CLOSE_PROMPT; case 0: // Yes - sub_811BE9C(); - gSpecialVar_Result = sub_811B4EC(); - sub_811B3E4(); - return 24; + SetSpecialEasyChatResult(); + gSpecialVar_Result = GetEasyChatCompleted(); + SaveCurrentPhrase(); + return ECFUNC_EXIT; default: - return 0; + return ECFUNC_NONE; } } -static u16 sub_811B040(void) +static u16 HandleEasyChatInput_DeleteAllYesNo(void) { switch (Menu_ProcessInputNoWrapClearOnChoose()) { - case MENU_B_PRESSED: // B Button + case MENU_B_PRESSED: case 1: // No - sEasyChatScreen->state = 1; - return 7; + sEasyChatScreen->inputState = INPUTSTATE_MAIN_SCREEN_BUTTONS; + return ECFUNC_CLOSE_PROMPT; case 0: // Yes - sub_811B418(); - sEasyChatScreen->state = 1; - return 8; + ResetCurrentPhrase(); + sEasyChatScreen->inputState = INPUTSTATE_MAIN_SCREEN_BUTTONS; + return ECFUNC_CLOSE_PROMPT_AFTER_DELETE; default: - return 0; + return ECFUNC_NONE; } } -static u16 sub_811B08C(void) +static u16 HandleEasyChatInput_QuizQuestion(void) { if (JOY_NEW(A_BUTTON)) - return 26; + return ECFUNC_QUIZ_ANSWER; if (JOY_NEW(B_BUTTON)) - return sub_811B150(); + return StartConfirmExitPrompt(); - return 0; + return ECFUNC_NONE; } -static u16 sub_811B0BC(void) +// A message has been printed. Wait for player to +// press A or B, then return to previous state +static u16 HandleEasyChatInput_WaitForMsg(void) { if (JOY_NEW(A_BUTTON | B_BUTTON)) { - sEasyChatScreen->state = sub_811B2A4(); - return 7; + sEasyChatScreen->inputState = GetEasyChatBackupState(); + return ECFUNC_CLOSE_PROMPT; } - return 0; + return ECFUNC_NONE; } -static u16 sub_811B0E8(void) +// Odd, could have been skipped. Just passes to HandleEasyChatInput_ConfirmLyricsYesNo +static u16 HandleEasyChatInput_StartConfirmLyrics(void) { - sEasyChatScreen->state = 10; - return 6; + sEasyChatScreen->inputState = INPUTSTATE_CONFIRM_LYRICS_YES_NO; + return ECFUNC_PROMPT_CONFIRM; } -static u16 sub_811B0F8(void) +static u16 HandleEasyChatInput_ConfirmLyricsYesNo(void) { switch (Menu_ProcessInputNoWrapClearOnChoose()) { - case MENU_B_PRESSED: // B Button + case MENU_B_PRESSED: case 1: // No - sub_811B454(); - sEasyChatScreen->stateBackup = 0; - sEasyChatScreen->state = 8; - return 31; + ResetCurrentPhraseToSaved(); + sEasyChatScreen->inputStateBackup = INPUTSTATE_PHRASE; + sEasyChatScreen->inputState = INPUTSTATE_WAIT_FOR_MSG; + return ECFUNC_MSG_SONG_TOO_SHORT; case 0: // Yes - gSpecialVar_Result = sub_811B4EC(); - sub_811B3E4(); - return 24; + gSpecialVar_Result = GetEasyChatCompleted(); + SaveCurrentPhrase(); + return ECFUNC_EXIT; default: - return 0; + return ECFUNC_NONE; } } -static u16 sub_811B150(void) +static u16 StartConfirmExitPrompt(void) { if (sEasyChatScreen->type == EASY_CHAT_TYPE_APPRENTICE || sEasyChatScreen->type == EASY_CHAT_TYPE_CONTEST_INTERVIEW) { - sEasyChatScreen->stateBackup = sEasyChatScreen->state; - sEasyChatScreen->state = 8; - return 34; + sEasyChatScreen->inputStateBackup = sEasyChatScreen->inputState; + sEasyChatScreen->inputState = INPUTSTATE_WAIT_FOR_MSG; + return ECFUNC_MSG_CANT_EXIT; } else { - sEasyChatScreen->stateBackup = sEasyChatScreen->state; - sEasyChatScreen->state = 4; - return 5; + sEasyChatScreen->inputStateBackup = sEasyChatScreen->inputState; + sEasyChatScreen->inputState = INPUTSTATE_EXIT_PROMPT; + return ECFUNC_PROMPT_EXIT; } } -static int sub_811B184(void) +static int DoDeleteAllButton(void) { - sEasyChatScreen->stateBackup = sEasyChatScreen->state; + sEasyChatScreen->inputStateBackup = sEasyChatScreen->inputState; if (sEasyChatScreen->type != EASY_CHAT_TYPE_BARD_SONG) { - sEasyChatScreen->state = 5; - return 4; + // Show Delete yes/no + sEasyChatScreen->inputState = INPUTSTATE_DELETE_ALL_YES_NO; + return ECFUNC_PROMPT_DELETE_ALL; } else { - sEasyChatScreen->stateBackup = sEasyChatScreen->state; - sEasyChatScreen->state = 8; - return 32; + // Cannot delete lyrics when setting Bard's song + sEasyChatScreen->inputStateBackup = sEasyChatScreen->inputState; + sEasyChatScreen->inputState = INPUTSTATE_WAIT_FOR_MSG; + return ECFUNC_MSG_CANT_DELETE_LYRICS; } } -static u16 sub_811B1B4(void) +static u16 TryConfirmWords(void) { - sEasyChatScreen->stateBackup = sEasyChatScreen->state; + sEasyChatScreen->inputStateBackup = sEasyChatScreen->inputState; if (sEasyChatScreen->type == EASY_CHAT_TYPE_QUIZ_SET_QUESTION) { - if (sub_811BD64()) + if (IsQuizQuestionEmpty()) { - sEasyChatScreen->state = 8; - return 29; + sEasyChatScreen->inputState = INPUTSTATE_WAIT_FOR_MSG; + return ECFUNC_MSG_CREATE_QUIZ; } - if (sub_811BDB0()) + if (IsQuizAnswerEmpty()) { - sEasyChatScreen->state = 8; - return 30; + sEasyChatScreen->inputState = INPUTSTATE_WAIT_FOR_MSG; + return ECFUNC_MSG_SELECT_ANSWER; } - sEasyChatScreen->state = 6; - return 6; + sEasyChatScreen->inputState = INPUTSTATE_CONFIRM_WORDS_YES_NO; + return ECFUNC_PROMPT_CONFIRM; } else if (sEasyChatScreen->type == EASY_CHAT_TYPE_QUIZ_SET_ANSWER) { - if (sub_811BDB0()) + if (IsQuizAnswerEmpty()) { - sEasyChatScreen->state = 8; - return 30; + sEasyChatScreen->inputState = INPUTSTATE_WAIT_FOR_MSG; + return ECFUNC_MSG_SELECT_ANSWER; } - if (sub_811BD64()) + if (IsQuizQuestionEmpty()) { - sEasyChatScreen->state = 8; - return 29; + sEasyChatScreen->inputState = INPUTSTATE_WAIT_FOR_MSG; + return ECFUNC_MSG_CREATE_QUIZ; } - sEasyChatScreen->state = 6; - return 6; + sEasyChatScreen->inputState = INPUTSTATE_CONFIRM_WORDS_YES_NO; + return ECFUNC_PROMPT_CONFIRM; } else if (sEasyChatScreen->type == EASY_CHAT_TYPE_TRENDY_PHRASE || sEasyChatScreen->type == EASY_CHAT_TYPE_GOOD_SAYING) { - if (!sub_811BD2C()) + if (!IsCurrentPhraseFull()) { - sEasyChatScreen->state = 8; - return 33; + sEasyChatScreen->inputState = INPUTSTATE_WAIT_FOR_MSG; + return ECFUNC_MSG_COMBINE_TWO_WORDS; } - sEasyChatScreen->state = 6; - return 6; + sEasyChatScreen->inputState = INPUTSTATE_CONFIRM_WORDS_YES_NO; + return ECFUNC_PROMPT_CONFIRM; } else if (sEasyChatScreen->type == EASY_CHAT_TYPE_APPRENTICE || sEasyChatScreen->type == EASY_CHAT_TYPE_CONTEST_INTERVIEW) { - if (sub_811BCF4()) + if (IsCurrentPhraseEmpty()) { - sEasyChatScreen->state = 8; - return 34; + sEasyChatScreen->inputState = INPUTSTATE_WAIT_FOR_MSG; + return ECFUNC_MSG_CANT_EXIT; } - sEasyChatScreen->state = 6; - return 6; + sEasyChatScreen->inputState = INPUTSTATE_CONFIRM_WORDS_YES_NO; + return ECFUNC_PROMPT_CONFIRM; } else if (sEasyChatScreen->type == EASY_CHAT_TYPE_QUESTIONNAIRE) { - sEasyChatScreen->state = 6; - return 6; + sEasyChatScreen->inputState = INPUTSTATE_CONFIRM_WORDS_YES_NO; + return ECFUNC_PROMPT_CONFIRM; } else { - if (sub_811BCF4() == 1 || !sub_811B4EC()) + if (IsCurrentPhraseEmpty() == TRUE || !GetEasyChatCompleted()) { - sEasyChatScreen->state = 4; - return 5; + sEasyChatScreen->inputState = INPUTSTATE_EXIT_PROMPT; + return ECFUNC_PROMPT_EXIT; } - sEasyChatScreen->state = 6; - return 6; + sEasyChatScreen->inputState = INPUTSTATE_CONFIRM_WORDS_YES_NO; + return ECFUNC_PROMPT_CONFIRM; } } -static int sub_811B264(void) +static int DoQuizButton(void) { - sEasyChatScreen->stateBackup = sEasyChatScreen->state; + sEasyChatScreen->inputStateBackup = sEasyChatScreen->inputState; switch (sEasyChatScreen->type) { case EASY_CHAT_TYPE_QUIZ_ANSWER: - return 25; + return ECFUNC_QUIZ_QUESTION; case EASY_CHAT_TYPE_QUIZ_SET_QUESTION: - sub_811B3E4(); - return 28; + SaveCurrentPhrase(); + return ECFUNC_SET_QUIZ_ANSWER; case EASY_CHAT_TYPE_QUIZ_SET_ANSWER: - sub_811B3E4(); - return 27; + SaveCurrentPhrase(); + return ECFUNC_SET_QUIZ_QUESTION; default: - return 0; + return ECFUNC_NONE; } } -static u8 sub_811B2A4(void) +static u8 GetEasyChatBackupState(void) { - return sEasyChatScreen->stateBackup; + return sEasyChatScreen->inputStateBackup; } -static int sub_811B2B0(void) +static int SelectKeyboardGroup(void) { - u16 var1; + u16 numWords; - if (sEasyChatScreen->unk_09 == 0) + if (!sEasyChatScreen->inAlphabetMode) { - u8 groupId = sub_811F3B8(sub_811B8E8()); - sub_811F548(0, groupId); + u8 groupId = GetUnlockedEasyChatGroupId(GetSelectedGroupIndex()); + SetSelectedWordGroup(FALSE, groupId); } else { - sub_811F548(1, sub_811B908()); + SetSelectedWordGroup(TRUE, GetSelectedAlphabetGroupId()); } - var1 = sub_811F5B0(); - if (var1 == 0) - return 0; + numWords = GetNumWordsInSelectedGroup(); + if (numWords == 0) + return ECFUNC_NONE; - sEasyChatScreen->unk_0f = (var1 - 1) / 2; - sEasyChatScreen->unk_0e = 0; - sEasyChatScreen->unk_10 = 0; - sEasyChatScreen->unk_11 = 0; - sEasyChatScreen->state = 3; - return 11; + sEasyChatScreen->wordSelectLastRow = (numWords - 1) / 2; + sEasyChatScreen->wordSelectScrollOffset = 0; + sEasyChatScreen->wordSelectColumn = 0; + sEasyChatScreen->wordSelectRow = 0; + sEasyChatScreen->inputState = INPUTSTATE_WORD_SELECT; + return ECFUNC_OPEN_WORD_SELECT; } -static int sub_811B32C(void) +static int ExitKeyboardToMainScreen(void) { - sEasyChatScreen->state = 0; - return 10; + sEasyChatScreen->inputState = INPUTSTATE_PHRASE; + return ECFUNC_CLOSE_KEYBOARD; } -static int sub_811B33C(void) +static int StartSwitchKeyboardMode(void) { - sEasyChatScreen->unk_0a = 0; - sEasyChatScreen->unk_0b = 0; - sEasyChatScreen->unk_0c = 0; - if (!sEasyChatScreen->unk_09) - sEasyChatScreen->unk_09 = 1; + sEasyChatScreen->keyboardColumn = 0; + sEasyChatScreen->keyboardRow = 0; + sEasyChatScreen->keyboardScrollOffset = 0; + if (!sEasyChatScreen->inAlphabetMode) + sEasyChatScreen->inAlphabetMode = TRUE; else - sEasyChatScreen->unk_09 = 0; + sEasyChatScreen->inAlphabetMode = FALSE; - return 23; + return ECFUNC_SWITCH_KEYBOARD_MODE; } -static int sub_811B368(void) +static int DeleteSelectedWord(void) { if (sEasyChatScreen->type == EASY_CHAT_TYPE_BARD_SONG) { PlaySE(SE_FAILURE); - return 0; + return ECFUNC_NONE; } else { - sub_811B488(0xFFFF); - return 1; + SetSelectedWord(EC_EMPTY_WORD); + return ECFUNC_REPRINT_PHRASE; } } -static int sub_811B394(void) +static int SelectNewWord(void) { - u16 easyChatWord = sub_811F578(sub_811B940()); - if (sub_811BF88(easyChatWord)) + u16 easyChatWord = GetWordFromSelectedGroup(GetSelectedWordIndex()); + if (DummyWordCheck(easyChatWord)) { + // Never reached. Would disallow selecting certain words PlaySE(SE_FAILURE); - return 0; + return ECFUNC_NONE; } else { - sub_811B488(easyChatWord); + SetSelectedWord(easyChatWord); if (sEasyChatScreen->type != EASY_CHAT_TYPE_BARD_SONG) { - sEasyChatScreen->state = 0; - return 12; + sEasyChatScreen->inputState = INPUTSTATE_PHRASE; + return ECFUNC_CLOSE_WORD_SELECT; } else { - sEasyChatScreen->state = 9; - return 13; + sEasyChatScreen->inputState = INPUTSTATE_START_CONFIRM_LYRICS; + return ECFUNC_PROMPT_CONFIRM_LYRICS; } } } -static void sub_811B3E4(void) +static void SaveCurrentPhrase(void) { int i; - for (i = 0; i < sEasyChatScreen->unk_07; i++) - sEasyChatScreen->words[i] = sEasyChatScreen->ecWordBuffer[i]; + for (i = 0; i < sEasyChatScreen->maxWords; i++) + sEasyChatScreen->savedPhrase[i] = sEasyChatScreen->currentPhrase[i]; } -static void sub_811B418(void) +static void ResetCurrentPhrase(void) { int i; - for (i = 0; i < sEasyChatScreen->unk_07; i++) - sEasyChatScreen->ecWordBuffer[i] = 0xFFFF; + for (i = 0; i < sEasyChatScreen->maxWords; i++) + sEasyChatScreen->currentPhrase[i] = EC_EMPTY_WORD; } -static void sub_811B454(void) +static void ResetCurrentPhraseToSaved(void) { int i; - for (i = 0; i < sEasyChatScreen->unk_07; i++) - sEasyChatScreen->ecWordBuffer[i] = sEasyChatScreen->words[i]; + for (i = 0; i < sEasyChatScreen->maxWords; i++) + sEasyChatScreen->currentPhrase[i] = sEasyChatScreen->savedPhrase[i]; } -static void sub_811B488(u16 easyChatWord) +static void SetSelectedWord(u16 easyChatWord) { - u16 index = sub_811B8C8(); - sEasyChatScreen->ecWordBuffer[index] = easyChatWord; + u16 index = GetWordIndexToReplace(); + sEasyChatScreen->currentPhrase[index] = easyChatWord; } -static u8 sub_811B4AC(void) +// Compare current phrase to the original saved phrase +static bool8 DidPhraseChange(void) { u16 i; - for (i = 0; i < sEasyChatScreen->unk_07; i++) + for (i = 0; i < sEasyChatScreen->maxWords; i++) { - if (sEasyChatScreen->ecWordBuffer[i] != sEasyChatScreen->words[i]) - return 1; + if (sEasyChatScreen->currentPhrase[i] != sEasyChatScreen->savedPhrase[i]) + return TRUE; } - return 0; + return FALSE; } -static int sub_811B4EC(void) +// 'Completed' if the phrase was changed, or in the case of making a quiz, the question and answer were filled out +static bool32 GetEasyChatCompleted(void) { - u8 var0 = sEasyChatScreen->type - EASY_CHAT_TYPE_QUIZ_SET_QUESTION; - if (var0 < 2) + if (sEasyChatScreen->type == EASY_CHAT_TYPE_QUIZ_SET_QUESTION + || sEasyChatScreen->type == EASY_CHAT_TYPE_QUIZ_SET_ANSWER) { - if (sub_811BD64()) - return 0; + if (IsQuizQuestionEmpty()) + return FALSE; - if (sub_811BDB0()) - return 0; + if (IsQuizAnswerEmpty()) + return FALSE; - return 1; + return TRUE; } else { - return sub_811B4AC(); + return DidPhraseChange(); } } -static u16 sub_811B528(int arg0) +static u16 MoveKeyboardCursor(int input) { - if (sEasyChatScreen->unk_0a != -1) + if (sEasyChatScreen->keyboardColumn != -1) { - if (sEasyChatScreen->unk_09 == 0) - return sub_811B568(arg0); + if (!sEasyChatScreen->inAlphabetMode) + return MoveKeyboardCursor_GroupNames(input); else - return sub_811B634(arg0); + return MoveKeyboardCursor_Alphabet(input); } else { - return sub_811B6C4(arg0); + return MoveKeyboardCursor_ButtonWindow(input); } } -static int sub_811B568(u32 arg0) +static int MoveKeyboardCursor_GroupNames(u32 input) { - switch (arg0) + switch (input) { - case 2: - if (sEasyChatScreen->unk_0b != -sEasyChatScreen->unk_0c) + case INPUT_UP: + if (sEasyChatScreen->keyboardRow != -sEasyChatScreen->keyboardScrollOffset) { - if (sEasyChatScreen->unk_0b) + if (sEasyChatScreen->keyboardRow) { - sEasyChatScreen->unk_0b--; - return 15; + sEasyChatScreen->keyboardRow--; + return ECFUNC_UPDATE_KEYBOARD_CURSOR; } else { - sEasyChatScreen->unk_0c--; - return 17; + sEasyChatScreen->keyboardScrollOffset--; + return ECFUNC_GROUP_NAMES_SCROLL_UP; } } break; - case 3: - if (sEasyChatScreen->unk_0b + sEasyChatScreen->unk_0c < sEasyChatScreen->unk_0d - 1) + case INPUT_DOWN: + if (sEasyChatScreen->keyboardRow + sEasyChatScreen->keyboardScrollOffset < sEasyChatScreen->keyboardLastRow - 1) { - int var0; - if (sEasyChatScreen->unk_0b < 3) + int funcId; + if (sEasyChatScreen->keyboardRow < NUM_GROUP_NAME_ROWS - 1) { - sEasyChatScreen->unk_0b++; - var0 = 15; + sEasyChatScreen->keyboardRow++; + funcId = ECFUNC_UPDATE_KEYBOARD_CURSOR; } else { - sEasyChatScreen->unk_0c++; - var0 = 16; + sEasyChatScreen->keyboardScrollOffset++; + funcId = ECFUNC_GROUP_NAMES_SCROLL_DOWN; } - sub_811B978(); - return var0; + ReduceToValidKeyboardColumn(); + return funcId; } break; - case 1: - if (sEasyChatScreen->unk_0a) - sEasyChatScreen->unk_0a--; + case INPUT_LEFT: + if (sEasyChatScreen->keyboardColumn) + sEasyChatScreen->keyboardColumn--; else - sub_811B744(); + SetKeyboardCursorInButtonWindow(); - return 15; - case 0: - if (sEasyChatScreen->unk_0a < 1) + return ECFUNC_UPDATE_KEYBOARD_CURSOR; + case INPUT_RIGHT: + if (sEasyChatScreen->keyboardColumn < 1) { - sEasyChatScreen->unk_0a++; - if (sub_811B9C8()) - sub_811B744(); + sEasyChatScreen->keyboardColumn++; + if (IsSelectedKeyboardIndexInvalid()) + SetKeyboardCursorInButtonWindow(); } else { - sub_811B744(); + SetKeyboardCursorInButtonWindow(); } - return 15; + return ECFUNC_UPDATE_KEYBOARD_CURSOR; } - return 0; + return ECFUNC_NONE; } -static int sub_811B634(u32 arg0) +static int MoveKeyboardCursor_Alphabet(u32 input) { - switch (arg0) + switch (input) { - case 2: - if (sEasyChatScreen->unk_0b > 0) - sEasyChatScreen->unk_0b--; + case INPUT_UP: + if (sEasyChatScreen->keyboardRow > 0) + sEasyChatScreen->keyboardRow--; else - sEasyChatScreen->unk_0b = 3; + sEasyChatScreen->keyboardRow = NUM_ALPHABET_ROWS - 1; - sub_811B978(); - return 15; - case 3: - if (sEasyChatScreen->unk_0b < 3) - sEasyChatScreen->unk_0b++; + ReduceToValidKeyboardColumn(); + return ECFUNC_UPDATE_KEYBOARD_CURSOR; + case INPUT_DOWN: + if (sEasyChatScreen->keyboardRow < NUM_ALPHABET_ROWS - 1) + sEasyChatScreen->keyboardRow++; else - sEasyChatScreen->unk_0b = 0; + sEasyChatScreen->keyboardRow = 0; - sub_811B978(); - return 15; - case 0: - sEasyChatScreen->unk_0a++; - if (sub_811B9C8()) - sub_811B744(); + ReduceToValidKeyboardColumn(); + return ECFUNC_UPDATE_KEYBOARD_CURSOR; + case INPUT_RIGHT: + sEasyChatScreen->keyboardColumn++; + if (IsSelectedKeyboardIndexInvalid()) + SetKeyboardCursorInButtonWindow(); - return 15; - case 1: - sEasyChatScreen->unk_0a--; - if (sEasyChatScreen->unk_0a < 0) - sub_811B744(); + return ECFUNC_UPDATE_KEYBOARD_CURSOR; + case INPUT_LEFT: + sEasyChatScreen->keyboardColumn--; + if (sEasyChatScreen->keyboardColumn < 0) + SetKeyboardCursorInButtonWindow(); - return 15; + return ECFUNC_UPDATE_KEYBOARD_CURSOR; } - return 0; + return ECFUNC_NONE; } -static int sub_811B6C4(u32 arg0) +static int MoveKeyboardCursor_ButtonWindow(u32 input) { - switch (arg0) + switch (input) { - case 2: - if (sEasyChatScreen->unk_0b) - sEasyChatScreen->unk_0b--; + case INPUT_UP: + if (sEasyChatScreen->keyboardRow) + sEasyChatScreen->keyboardRow--; else - sEasyChatScreen->unk_0b = 2; + sEasyChatScreen->keyboardRow = NUM_BUTTON_ROWS - 1; - return 15; - case 3: - if (sEasyChatScreen->unk_0b < 2) - sEasyChatScreen->unk_0b++; + return ECFUNC_UPDATE_KEYBOARD_CURSOR; + case INPUT_DOWN: + if (sEasyChatScreen->keyboardRow < NUM_BUTTON_ROWS - 1) + sEasyChatScreen->keyboardRow++; else - sEasyChatScreen->unk_0b = 0; + sEasyChatScreen->keyboardRow = 0; - return 15; - case 1: - sEasyChatScreen->unk_0b++; - sub_811B768(); - return 15; - case 0: - sEasyChatScreen->unk_0a = 0; - sEasyChatScreen->unk_0b++; - return 15; + return ECFUNC_UPDATE_KEYBOARD_CURSOR; + case INPUT_LEFT: + sEasyChatScreen->keyboardRow++; + SetKeyboardCursorToLastColumn(); + return ECFUNC_UPDATE_KEYBOARD_CURSOR; + case INPUT_RIGHT: + sEasyChatScreen->keyboardColumn = 0; + sEasyChatScreen->keyboardRow++; + return ECFUNC_UPDATE_KEYBOARD_CURSOR; } - return 0; + return ECFUNC_NONE; } -static void sub_811B744(void) +static void SetKeyboardCursorInButtonWindow(void) { - sEasyChatScreen->unk_0a = 0xFF; - if (sEasyChatScreen->unk_0b) - sEasyChatScreen->unk_0b--; + sEasyChatScreen->keyboardColumn = -1; + if (sEasyChatScreen->keyboardRow) + sEasyChatScreen->keyboardRow--; } -static void sub_811B768(void) +static void SetKeyboardCursorToLastColumn(void) { - if (sEasyChatScreen->unk_09 == 0) + if (!sEasyChatScreen->inAlphabetMode) { - sEasyChatScreen->unk_0a = 1; - sub_811B978(); + sEasyChatScreen->keyboardColumn = 1; + ReduceToValidKeyboardColumn(); } else { - sEasyChatScreen->unk_0a = sub_811B960(sEasyChatScreen->unk_0b); + sEasyChatScreen->keyboardColumn = GetLastAlphabetColumn(sEasyChatScreen->keyboardRow); } } -static u16 sub_811B794(u32 arg0) +static u16 MoveWordSelectCursor(u32 input) { - u16 result; - switch (arg0) + u16 funcId; + switch (input) { - case 2: - if (sEasyChatScreen->unk_11 + sEasyChatScreen->unk_0e > 0) + case INPUT_UP: + if (sEasyChatScreen->wordSelectRow + sEasyChatScreen->wordSelectScrollOffset > 0) { - if (sEasyChatScreen->unk_11 > 0) + if (sEasyChatScreen->wordSelectRow > 0) { - sEasyChatScreen->unk_11--; - result = 18; + sEasyChatScreen->wordSelectRow--; + funcId = ECFUNC_UPDATE_WORD_SELECT_CURSOR; } else { - sEasyChatScreen->unk_0e--; - result = 19; + sEasyChatScreen->wordSelectScrollOffset--; + funcId = ECFUNC_WORD_SELECT_SCROLL_UP; } - sub_811B9A0(); - return result; + ReduceToValidWordSelectColumn(); + return funcId; } break; - case 3: - if (sEasyChatScreen->unk_11 + sEasyChatScreen->unk_0e < sEasyChatScreen->unk_0f) + case INPUT_DOWN: + if (sEasyChatScreen->wordSelectRow + sEasyChatScreen->wordSelectScrollOffset < sEasyChatScreen->wordSelectLastRow) { - if (sEasyChatScreen->unk_11 < 3) + if (sEasyChatScreen->wordSelectRow < NUM_WORD_SELECT_ROWS - 1) { - sEasyChatScreen->unk_11++; - result = 18; + sEasyChatScreen->wordSelectRow++; + funcId = ECFUNC_UPDATE_WORD_SELECT_CURSOR; } else { - sEasyChatScreen->unk_0e++; - result = 20; + sEasyChatScreen->wordSelectScrollOffset++; + funcId = ECFUNC_WORD_SELECT_SCROLL_DOWN; } - sub_811B9A0(); - return result; + ReduceToValidWordSelectColumn(); + return funcId; } break; - case 1: - if (sEasyChatScreen->unk_10 > 0) - sEasyChatScreen->unk_10--; + case INPUT_LEFT: + if (sEasyChatScreen->wordSelectColumn > 0) + sEasyChatScreen->wordSelectColumn--; else - sEasyChatScreen->unk_10 = 1; + sEasyChatScreen->wordSelectColumn = 1; - sub_811B9A0(); - return 18; - case 0: - if (sEasyChatScreen->unk_10 < 1) + ReduceToValidWordSelectColumn(); + return ECFUNC_UPDATE_WORD_SELECT_CURSOR; + case INPUT_RIGHT: + if (sEasyChatScreen->wordSelectColumn < 1) { - sEasyChatScreen->unk_10++; - if (sub_811BA1C()) - sEasyChatScreen->unk_10 = 0; + sEasyChatScreen->wordSelectColumn++; + if (IsSelectedWordIndexInvalid()) + sEasyChatScreen->wordSelectColumn = 0; } else { - sEasyChatScreen->unk_10 = 0; + sEasyChatScreen->wordSelectColumn = 0; } - return 18; - case 4: - if (sEasyChatScreen->unk_0e) + return ECFUNC_UPDATE_WORD_SELECT_CURSOR; + case INPUT_START: + // Page scroll up + if (sEasyChatScreen->wordSelectScrollOffset) { - if (sEasyChatScreen->unk_0e > 3) - sEasyChatScreen->unk_0e -= 4; + if (sEasyChatScreen->wordSelectScrollOffset >= NUM_WORD_SELECT_ROWS) + sEasyChatScreen->wordSelectScrollOffset -= NUM_WORD_SELECT_ROWS; else - sEasyChatScreen->unk_0e = 0; + sEasyChatScreen->wordSelectScrollOffset = 0; - return 21; + return ECFUNC_WORD_SELECT_PAGE_UP; } break; - case 5: - if (sEasyChatScreen->unk_0e <= sEasyChatScreen->unk_0f - 4) + case INPUT_SELECT: + // Page scroll down + if (sEasyChatScreen->wordSelectScrollOffset <= sEasyChatScreen->wordSelectLastRow - NUM_WORD_SELECT_ROWS) { - sEasyChatScreen->unk_0e += 4; - if (sEasyChatScreen->unk_0e > sEasyChatScreen->unk_0f - 3) - sEasyChatScreen->unk_0e = sEasyChatScreen->unk_0f + 0xFD; + sEasyChatScreen->wordSelectScrollOffset += NUM_WORD_SELECT_ROWS; + if (sEasyChatScreen->wordSelectScrollOffset > sEasyChatScreen->wordSelectLastRow - NUM_WORD_SELECT_ROWS + 1) + sEasyChatScreen->wordSelectScrollOffset = sEasyChatScreen->wordSelectLastRow - NUM_WORD_SELECT_ROWS + 1; - sub_811B9A0(); - return 22; + ReduceToValidWordSelectColumn(); + return ECFUNC_WORD_SELECT_PAGE_DOWN; } break; } - return 0; + return ECFUNC_NONE; } -static u16 sub_811B8C8(void) +static u16 GetWordIndexToReplace(void) { return (sEasyChatScreen->mainCursorRow * sEasyChatScreen->numColumns) + sEasyChatScreen->mainCursorColumn; } -static u16 sub_811B8E8(void) +static u16 GetSelectedGroupIndex(void) { - return 2 * (sEasyChatScreen->unk_0b + sEasyChatScreen->unk_0c) + sEasyChatScreen->unk_0a; + return NUM_GROUP_NAME_COLUMNS * (sEasyChatScreen->keyboardRow + sEasyChatScreen->keyboardScrollOffset) + sEasyChatScreen->keyboardColumn; } -static int sub_811B908(void) +static int GetSelectedAlphabetGroupId(void) { - int var0 = (u8)sEasyChatScreen->unk_0a < 7 ? sEasyChatScreen->unk_0a : 0; - int var1 = (u8)sEasyChatScreen->unk_0b < 4 ? sEasyChatScreen->unk_0b : 0; - return sUnknown_08597748[var1][var0]; + int column = (u8)sEasyChatScreen->keyboardColumn < NUM_ALPHABET_COLUMNS ? sEasyChatScreen->keyboardColumn : 0; + int row = (u8)sEasyChatScreen->keyboardRow < NUM_ALPHABET_ROWS ? sEasyChatScreen->keyboardRow : 0; + return sAlphabetGroupIdMap[row][column]; } -static u16 sub_811B940(void) +static u16 GetSelectedWordIndex(void) { - return 2 * (sEasyChatScreen->unk_11 + sEasyChatScreen->unk_0e) + sEasyChatScreen->unk_10; + return NUM_WORD_SELECT_COLUMNS * (sEasyChatScreen->wordSelectRow + sEasyChatScreen->wordSelectScrollOffset) + sEasyChatScreen->wordSelectColumn; } -static u8 sub_811B960(u8 arg0) +// Get the index of the last column in the alphabet keyboard, depending on current row +static u8 GetLastAlphabetColumn(u8 row) { - switch (arg0) + switch (row) { case 0: default: - return 6; + return NUM_ALPHABET_COLUMNS - 1; case 1: - return 5; + return NUM_ALPHABET_COLUMNS - 2; // At 6 letters, only the 2nd row (index 1) has less than the max columns + // The 3rd and 4th row have 7 letters, the 1st row has 6 letters and 'Others' } } -static void sub_811B978(void) +static void ReduceToValidKeyboardColumn(void) { - while (sub_811B9C8()) + while (IsSelectedKeyboardIndexInvalid()) { - if (sEasyChatScreen->unk_0a) - sEasyChatScreen->unk_0a--; + if (sEasyChatScreen->keyboardColumn) + sEasyChatScreen->keyboardColumn--; else break; } } -static void sub_811B9A0(void) +static void ReduceToValidWordSelectColumn(void) { - while (sub_811BA1C()) + while (IsSelectedWordIndexInvalid()) { - if (sEasyChatScreen->unk_10) - sEasyChatScreen->unk_10--; + if (sEasyChatScreen->wordSelectColumn) + sEasyChatScreen->wordSelectColumn--; else break; } } -static u8 sub_811B9C8(void) +static bool8 IsSelectedKeyboardIndexInvalid(void) { - if (sEasyChatScreen->unk_09 == 0) - return sub_811B8E8() >= sub_811F3AC() ? 1 : 0; + if (!sEasyChatScreen->inAlphabetMode) + return GetSelectedGroupIndex() >= GetNumUnlockedEasyChatGroups() ? TRUE : FALSE; else - return sEasyChatScreen->unk_0a > sub_811B960(sEasyChatScreen->unk_0b) ? 1 : 0; + return sEasyChatScreen->keyboardColumn > GetLastAlphabetColumn(sEasyChatScreen->keyboardRow) ? TRUE : FALSE; } -static u8 sub_811BA1C(void) +static bool8 IsSelectedWordIndexInvalid(void) { - return sub_811B940() >= sub_811F5B0() ? 1 : 0; + return GetSelectedWordIndex() >= GetNumWordsInSelectedGroup() ? TRUE : FALSE; } static int FooterHasFourOptions(void) @@ -2456,9 +2675,9 @@ const u8 *GetTitleText(void) return sEasyChatScreen->titleText; } -static u16 *GetEasyChatWordBuffer(void) +static u16 *GetCurrentPhrase(void) { - return sEasyChatScreen->ecWordBuffer; + return sEasyChatScreen->currentPhrase; } static u8 GetNumRows(void) @@ -2493,7 +2712,7 @@ static void GetEasyChatConfirmText(const u8 **str1, const u8 **str2) *str2 = sEasyChatScreenTemplates[sEasyChatScreen->templateId].confirmText2; } -static void sub_811BB40(const u8 **str1, const u8 **str2) +static void GetEasyChatConfirmExitText(const u8 **str1, const u8 **str2) { switch (sEasyChatScreen->type) { @@ -2520,75 +2739,75 @@ static void GetEasyChatConfirmDeletionText(const u8 **str1, const u8 **str2) *str2 = gText_BeDeletedThatOkay; } -void sub_811BB9C(u8 *arg0, u8 *arg1) +static void GetKeyboardCursorColAndRow(u8 *column, u8 *row) { - *arg0 = sEasyChatScreen->unk_0a; - *arg1 = sEasyChatScreen->unk_0b; + *column = sEasyChatScreen->keyboardColumn; + *row = sEasyChatScreen->keyboardRow; } -u8 sub_811BBB0(void) +static bool8 GetInAlphabetMode(void) { - return sEasyChatScreen->unk_09; + return sEasyChatScreen->inAlphabetMode; } -u8 sub_811BBBC(void) +static u8 GetKeyboardScrollOffset(void) { - return sEasyChatScreen->unk_0c; + return sEasyChatScreen->keyboardScrollOffset; } -void sub_811BBC8(u8 *arg0, u8 *arg1) +static void GetWordSelectColAndRow(u8 *column, u8 *row) { - *arg0 = sEasyChatScreen->unk_10; - *arg1 = sEasyChatScreen->unk_11; + *column = sEasyChatScreen->wordSelectColumn; + *row = sEasyChatScreen->wordSelectRow; } -u8 sub_811BBDC(void) +static u8 GetWordSelectScrollOffset(void) { - return sEasyChatScreen->unk_0e; + return sEasyChatScreen->wordSelectScrollOffset; } -u8 sub_811BBE8(void) +static u8 GetWordSelectLastRow(void) { - return sEasyChatScreen->unk_0f; + return sEasyChatScreen->wordSelectLastRow; } -static u8 unref_sub_811BBF4(void) +static u8 UnusedDummy(void) { - return 0; + return FALSE; } -int sub_811BBF8(void) +static bool32 CanScrollUp(void) { - switch (sEasyChatScreen->state) + switch (sEasyChatScreen->inputState) { - case 2: - if (sEasyChatScreen->unk_09 == 0 && sEasyChatScreen->unk_0c) - return 1; + case INPUTSTATE_KEYBOARD: + if (!sEasyChatScreen->inAlphabetMode && sEasyChatScreen->keyboardScrollOffset) + return TRUE; break; - case 3: - if (sEasyChatScreen->unk_0e) - return 1; + case INPUTSTATE_WORD_SELECT: + if (sEasyChatScreen->wordSelectScrollOffset) + return TRUE; break; } - return 0; + return FALSE; } -int sub_811BC2C(void) +static bool32 CanScrollDown(void) { - switch (sEasyChatScreen->state) + switch (sEasyChatScreen->inputState) { - case 2: - if (sEasyChatScreen->unk_09 == 0 && sEasyChatScreen->unk_0c + 4 <= sEasyChatScreen->unk_0d - 1) - return 1; + case INPUTSTATE_KEYBOARD: + if (!sEasyChatScreen->inAlphabetMode && sEasyChatScreen->keyboardScrollOffset + NUM_GROUP_NAME_ROWS <= sEasyChatScreen->keyboardLastRow - 1) + return TRUE; break; - case 3: - if (sEasyChatScreen->unk_0e + 4 <= sEasyChatScreen->unk_0f) - return 1; + case INPUTSTATE_WORD_SELECT: + if (sEasyChatScreen->wordSelectScrollOffset + NUM_WORD_SELECT_ROWS <= sEasyChatScreen->wordSelectLastRow) + return TRUE; break; } - return 0; + return FALSE; } static int FooterHasFourOptions_(void) @@ -2602,7 +2821,7 @@ static bool8 IsPhraseDifferentThanPlayerInput(const u16 *phrase, u8 phraseLength for (i = 0; i < phraseLength; i++) { - if (phrase[i] != sEasyChatScreen->ecWordBuffer[i]) + if (phrase[i] != sEasyChatScreen->currentPhrase[i]) return TRUE; } @@ -2627,65 +2846,67 @@ static u8 GetEachChatScreenTemplateId(u8 type) return 0; } -static int sub_811BCF4(void) +static bool32 IsCurrentPhraseEmpty(void) { int i; - for (i = 0; i < sEasyChatScreen->unk_07; i++) + for (i = 0; i < sEasyChatScreen->maxWords; i++) { - if (sEasyChatScreen->ecWordBuffer[i] != 0xFFFF) - return 0; + if (sEasyChatScreen->currentPhrase[i] != EC_EMPTY_WORD) + return FALSE; } - return 1; + return TRUE; } -static int sub_811BD2C(void) +static bool32 IsCurrentPhraseFull(void) { int i; - for (i = 0; i < sEasyChatScreen->unk_07; i++) + for (i = 0; i < sEasyChatScreen->maxWords; i++) { - if (sEasyChatScreen->ecWordBuffer[i] == 0xFFFF) - return 0; + if (sEasyChatScreen->currentPhrase[i] == EC_EMPTY_WORD) + return FALSE; } - return 1; + return TRUE; } -static int sub_811BD64(void) +static int IsQuizQuestionEmpty(void) { int i; struct SaveBlock1 *saveBlock1; if (sEasyChatScreen->type == EASY_CHAT_TYPE_QUIZ_SET_QUESTION) - return sub_811BCF4(); + return IsCurrentPhraseEmpty(); saveBlock1 = gSaveBlock1Ptr; for (i = 0; i < QUIZ_QUESTION_LEN; i++) { - if (saveBlock1->lilycoveLady.quiz.question[i] != 0xFFFF) - return 0; + if (saveBlock1->lilycoveLady.quiz.question[i] != EC_EMPTY_WORD) + return FALSE; } - return 1; + return TRUE; } -static int sub_811BDB0(void) +static int IsQuizAnswerEmpty(void) { struct LilycoveLadyQuiz *quiz; if (sEasyChatScreen->type == EASY_CHAT_TYPE_QUIZ_SET_ANSWER) - return sub_811BCF4(); + return IsCurrentPhraseEmpty(); quiz = &gSaveBlock1Ptr->lilycoveLady.quiz; - return quiz->correctAnswer == 0xFFFF ? 1 : 0; + return quiz->correctAnswer == EC_EMPTY_WORD ? TRUE : FALSE; } -static void sub_811BDF0(u8 *arg0) +static void GetQuizTitle(u8 *dst) { u8 name[32]; struct SaveBlock1 *saveBlock1 = gSaveBlock1Ptr; DynamicPlaceholderTextUtil_Reset(); + + // Buffer author's name if (StringLength(saveBlock1->lilycoveLady.quiz.playerName) != 0) { TVShowConvertInternationalString(name, saveBlock1->lilycoveLady.quiz.playerName, saveBlock1->lilycoveLady.quiz.language); @@ -2696,32 +2917,33 @@ static void sub_811BDF0(u8 *arg0) DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gText_Lady); } - DynamicPlaceholderTextUtil_ExpandPlaceholders(arg0, gText_F700sQuiz); + // "'s Quiz" + DynamicPlaceholderTextUtil_ExpandPlaceholders(dst, gText_F700sQuiz); } -static void sub_811BE54(void) +static void BufferCurrentPhraseToStringVar2(void) { int i; - u16 *ecWord; + u16 *phrase; u8 *str; - ecWord = sEasyChatScreen->ecWordBuffer; + phrase = sEasyChatScreen->currentPhrase; str = gStringVar2; i = 0; - while (i < sEasyChatScreen->unk_07) + while (i < sEasyChatScreen->maxWords) { - str = CopyEasyChatWordPadded(str, *ecWord, 0); + str = CopyEasyChatWordPadded(str, *phrase, 0); *str = 0; str++; - ecWord++; + phrase++; i++; } str--; - str[0] = 0xFF; + str[0] = EOS; } -static void sub_811BE9C(void) +static void SetSpecialEasyChatResult(void) { switch (sEasyChatScreen->type) { @@ -2735,8 +2957,8 @@ static void sub_811BE9C(void) gSpecialVar_0x8004 = 0; break; case EASY_CHAT_TYPE_TRENDY_PHRASE: - sub_811BE54(); - gSpecialVar_0x8004 = sub_81226D8(sEasyChatScreen->ecWordBuffer); + BufferCurrentPhraseToStringVar2(); + gSpecialVar_0x8004 = IsPhraseTrendy(sEasyChatScreen->currentPhrase); break; case EASY_CHAT_TYPE_GOOD_SAYING: gSpecialVar_0x8004 = DidPlayerInputABerryMasterWifePhrase(); @@ -2761,62 +2983,62 @@ static u16 DidPlayerInputABerryMasterWifePhrase(void) return 0; } -static void sub_811BF78(void) +static void ClearUnusedField(void) { - sEasyChatScreen->unk_13 = 0; + sEasyChatScreen->unused = 0; } -static int sub_811BF88(int easyChatWord) +static bool32 DummyWordCheck(int easyChatWord) { - return 0; + return FALSE; } -static bool8 sub_811BF8C(void) +static bool8 InitEasyChatScreenControl(void) { - if (!sub_811CE94()) - return 0; + if (!InitEasyChatScreenControl_()) + return FALSE; else - return 1; + return TRUE; } -static bool8 sub_811BFA4(void) +static bool8 LoadEasyChatScreen(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: ResetBgsAndClearDma3BusyFlags(0); InitBgsFromTemplates(0, sEasyChatBgTemplates, ARRAY_COUNT(sEasyChatBgTemplates)); - SetBgTilemapBuffer(3, sUnknown_0203A11C->unkB00); - SetBgTilemapBuffer(1, sUnknown_0203A11C->unk300); + SetBgTilemapBuffer(3, sScreenControl->bg3TilemapBuffer); + SetBgTilemapBuffer(1, sScreenControl->bg1TilemapBuffer); InitWindows(sEasyChatWindowTemplates); DeactivateAllTextPrinters(); - sub_811CF64(); - sub_811CF04(); + LoadEasyChatPalettes(); + InitEasyChatBgs(); CpuFastFill(0, (void *)OAM, OAM_SIZE); break; case 1: DecompressAndLoadBgGfxUsingHeap(3, gEasyChatWindow_Gfx, 0, 0, 0); CopyToBgTilemapBuffer(3, gEasyChatWindow_Tilemap, 0, 0); - sub_811D60C(); - sub_811D424(sUnknown_0203A11C->unk300); - sub_811D230(); - sub_811E948(); + AdjustBgTilemapForFooter(); + BufferFrameTilemap(sScreenControl->bg1TilemapBuffer); + AddPhraseWindow(); + AddMainScreenButtonWindow(); CopyBgTilemapBufferToVram(3); break; case 2: - DecompressAndLoadBgGfxUsingHeap(1, sUnknown_08597B54, 0, 0, 0); + DecompressAndLoadBgGfxUsingHeap(1, sTextInputFrame_Gfx, 0, 0, 0); CopyBgTilemapBufferToVram(1); break; case 3: - sub_811CFCC(); - sub_811D0BC(); - sub_811D2C8(); - sub_811D684(); + PrintTitle(); + PrintInitialInstructions(); + PrintCurrentPhrase(); + DrawLowerWindow(); break; case 4: - sub_811DE90(); + LoadEasyChatGfx(); if (GetEasyChatScreenType() != EASY_CHAT_TYPE_QUIZ_QUESTION) - sub_811DEC4(); + CreateMainCursorSprite(); break; case 5: if (IsDma3ManagerBusyWithBgCopy()) @@ -2825,7 +3047,7 @@ static bool8 sub_811BFA4(void) } else { - sub_811DE5C(0, 0, 0, 0); + SetWindowDimensions(0, 0, 0, 0); SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG1 @@ -2836,82 +3058,84 @@ static bool8 sub_811BFA4(void) ShowBg(1); ShowBg(2); ShowBg(0); - sub_811E5D4(); - sub_811E720(); - sub_811E828(); + CreateScrollIndicatorSprites(); + CreateStartSelectButtonSprites(); + TryAddInterviewObjectEvents(); } break; default: return FALSE; } - sUnknown_0203A11C->unk0++; + sScreenControl->funcState++; return TRUE; } -static void sub_811C13C(void) +static void FreeEasyChatScreenControl(void) { - if (sUnknown_0203A11C) - FREE_AND_SET_NULL(sUnknown_0203A11C); + if (sScreenControl) + FREE_AND_SET_NULL(sScreenControl); } -static void sub_811C158(u16 arg0) +static void StartEasyChatFunction(u16 funcId) { - sUnknown_0203A11C->unk4 = arg0; - sUnknown_0203A11C->unk0 = 0; - sub_811C170(); + sScreenControl->currentFuncId = funcId; + sScreenControl->funcState = 0; + RunEasyChatFunction(); } -static bool8 sub_811C170(void) +// Returns FALSE when called function has finished +static bool8 RunEasyChatFunction(void) { - switch (sUnknown_0203A11C->unk4) + switch (sScreenControl->currentFuncId) { - case 0: return FALSE; - case 1: return sub_811C2D4(); - case 2: return sub_811C30C(); - case 3: return sub_811C3E4(); - case 4: return sub_811C48C(); - case 5: return sub_811C404(); - case 6: return sub_811C448(); - case 7: return sub_811C4D0(); - case 8: return sub_811C518(); - case 9: return sub_811C554(); - case 10: return sub_811C620(); - case 11: return sub_811C830(); - case 12: return sub_811C8F0(); - case 13: return sub_811C99C(); - case 14: return sub_811CA5C(); - case 15: return sub_811C780(); - case 16: return sub_811C78C(); - case 17: return sub_811C7D4(); - case 18: return sub_811CB18(); - case 19: return sub_811CB98(); - case 20: return sub_811CB24(); - case 21: return sub_811CC90(); - case 22: return sub_811CC08(); - case 23: return sub_811C6C0(); - case 24: return FALSE; - case 25: return FALSE; - case 26: return FALSE; - case 27: return FALSE; - case 28: return FALSE; - case 29: return sub_811CD14(); - case 30: return sub_811CD54(); - case 31: return sub_811CD94(); - case 32: return sub_811CDD4(); - case 33: return sub_811CE14(); - case 34: return sub_811CE54(); - default: return FALSE; + case ECFUNC_NONE: return FALSE; + case ECFUNC_REPRINT_PHRASE: return ReprintPhrase(); + case ECFUNC_UPDATE_MAIN_CURSOR: return UpdateMainCursor(); + case ECFUNC_UPDATE_MAIN_CURSOR_ON_BUTTONS: return UpdateMainCursorOnButtons(); + case ECFUNC_PROMPT_DELETE_ALL: return ShowConfirmDeleteAllPrompt(); + case ECFUNC_PROMPT_EXIT: return ShowConfirmExitPrompt(); + case ECFUNC_PROMPT_CONFIRM: return ShowConfirmPrompt(); + case ECFUNC_CLOSE_PROMPT: return ClosePrompt(); + case ECFUNC_CLOSE_PROMPT_AFTER_DELETE: return ClosePromptAfterDeleteAll(); + case ECFUNC_OPEN_KEYBOARD: return OpenKeyboard(); + case ECFUNC_CLOSE_KEYBOARD: return CloseKeyboard(); + case ECFUNC_OPEN_WORD_SELECT: return OpenWordSelect(); + case ECFUNC_CLOSE_WORD_SELECT: return CloseWordSelect(); + case ECFUNC_PROMPT_CONFIRM_LYRICS: return ShowConfirmLyricsPrompt(); + case ECFUNC_RETURN_TO_KEYBOARD: return ReturnToKeyboard(); + case ECFUNC_UPDATE_KEYBOARD_CURSOR: return UpdateKeyboardCursor(); + case ECFUNC_GROUP_NAMES_SCROLL_DOWN: return GroupNamesScrollDown(); + case ECFUNC_GROUP_NAMES_SCROLL_UP: return GroupNamesScrollUp(); + case ECFUNC_UPDATE_WORD_SELECT_CURSOR: return UpdateWordSelectCursor(); + case ECFUNC_WORD_SELECT_SCROLL_UP: return WordSelectScrollUp(); + case ECFUNC_WORD_SELECT_SCROLL_DOWN: return WordSelectScrollDown(); + case ECFUNC_WORD_SELECT_PAGE_UP: return WordSelectPageScrollUp(); + case ECFUNC_WORD_SELECT_PAGE_DOWN: return WordSelectPageScrollDown(); + case ECFUNC_SWITCH_KEYBOARD_MODE: return SwitchKeyboardMode(); + case ECFUNC_EXIT: return FALSE; + case ECFUNC_QUIZ_QUESTION: return FALSE; // The 4 quiz functions + case ECFUNC_QUIZ_ANSWER: return FALSE; // 'finish' automatically + case ECFUNC_SET_QUIZ_QUESTION: return FALSE; // because they switch to a + case ECFUNC_SET_QUIZ_ANSWER: return FALSE; // callback in sQuizLadyEasyChatScreens + case ECFUNC_MSG_CREATE_QUIZ: return ShowCreateQuizMsg(); + case ECFUNC_MSG_SELECT_ANSWER: return ShowSelectAnswerMsg(); + case ECFUNC_MSG_SONG_TOO_SHORT: return ShowSongTooShortMsg(); + case ECFUNC_MSG_CANT_DELETE_LYRICS: return ShowCantDeleteLyricsMsg(); + case ECFUNC_MSG_COMBINE_TWO_WORDS: return ShowCombineTwoWordsMsg(); + case ECFUNC_MSG_CANT_EXIT: return ShowCantExitMsg(); + default: return FALSE; } } -static bool8 sub_811C2D4(void) +// Only used to update the current phrase after a word deletion +static bool8 ReprintPhrase(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811D2C8(); - sUnknown_0203A11C->unk0++; + PrintCurrentPhrase(); + sScreenControl->funcState++; break; case 1: return IsDma3ManagerBusyWithBgCopy(); @@ -2920,29 +3144,29 @@ static bool8 sub_811C2D4(void) return TRUE; } -static bool8 sub_811C30C(void) +static bool8 UpdateMainCursor(void) { u8 i; - u16 *ecWordBuffer; + u16 *currentPhrase; u16 *ecWord; u8 frameId; u8 cursorColumn, cursorRow, numColumns; - s16 var1; + s16 x; int stringWidth; int trueStringWidth; - u8 var2; + u8 y; u8 str[64]; - ecWordBuffer = GetEasyChatWordBuffer(); + currentPhrase = GetCurrentPhrase(); frameId = GetEasyChatScreenFrameId(); cursorColumn = GetMainCursorColumn(); cursorRow = GetMainCursorRow(); numColumns = GetNumColumns(); - ecWord = &ecWordBuffer[cursorRow * numColumns]; - var1 = 8 * sPhraseFrameDimensions[frameId].left + 13; + ecWord = ¤tPhrase[cursorRow * numColumns]; + x = 8 * sPhraseFrameDimensions[frameId].left + 13; for (i = 0; i < cursorColumn; i++) { - if (*ecWord == 0xFFFF) + if (*ecWord == EC_EMPTY_WORD) { stringWidth = 72; } @@ -2953,31 +3177,31 @@ static bool8 sub_811C30C(void) } trueStringWidth = stringWidth + 17; - var1 += trueStringWidth; + x += trueStringWidth; ecWord++; } - var2 = 8 * (sPhraseFrameDimensions[frameId].top + cursorRow * 2); - sub_811DF60(var1, var2 + 8); + y = 8 * (sPhraseFrameDimensions[frameId].top + cursorRow * 2); + SetMainCursorPos(x, y + 8); return FALSE; } -static bool8 sub_811C3E4(void) +static bool8 UpdateMainCursorOnButtons(void) { u8 xOffset = GetFooterOptionXOffset(GetMainCursorColumn()); - sub_811DF60(xOffset, 96); + SetMainCursorPos(xOffset, 96); return FALSE; } -static bool8 sub_811C404(void) +static bool8 ShowConfirmExitPrompt(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811DF90(); - sub_811D104(2); - sub_811D214(1); - sUnknown_0203A11C->unk0++; + StopMainCursorAnim(); + PrintEasyChatStdMessage(MSG_CONFIRM_EXIT); + CreateEasyChatYesNoMenu(1); + sScreenControl->funcState++; break; case 1: return IsDma3ManagerBusyWithBgCopy(); @@ -2986,15 +3210,15 @@ static bool8 sub_811C404(void) return TRUE; } -static bool8 sub_811C448(void) +static bool8 ShowConfirmPrompt(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811DF90(); - sub_811D104(3); - sub_811D214(0); - sUnknown_0203A11C->unk0++; + StopMainCursorAnim(); + PrintEasyChatStdMessage(MSG_CONFIRM); + CreateEasyChatYesNoMenu(0); + sScreenControl->funcState++; break; case 1: return IsDma3ManagerBusyWithBgCopy(); @@ -3003,15 +3227,15 @@ static bool8 sub_811C448(void) return TRUE; } -static bool8 sub_811C48C(void) +static bool8 ShowConfirmDeleteAllPrompt(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811DF90(); - sub_811D104(1); - sub_811D214(1); - sUnknown_0203A11C->unk0++; + StopMainCursorAnim(); + PrintEasyChatStdMessage(MSG_CONFIRM_DELETE); + CreateEasyChatYesNoMenu(1); + sScreenControl->funcState++; break; case 1: return IsDma3ManagerBusyWithBgCopy(); @@ -3020,16 +3244,16 @@ static bool8 sub_811C48C(void) return TRUE; } -static bool8 sub_811C4D0(void) +static bool8 ClosePrompt(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811DFB0(); - sub_811D104(0); - sub_811D2C8(); + StartMainCursorAnim(); + PrintEasyChatStdMessage(MSG_INSTRUCTIONS); + PrintCurrentPhrase(); ShowBg(0); - sUnknown_0203A11C->unk0++; + sScreenControl->funcState++; break; case 1: return IsDma3ManagerBusyWithBgCopy(); @@ -3038,15 +3262,15 @@ static bool8 sub_811C4D0(void) return TRUE; } -static bool8 sub_811C518(void) +static bool8 ClosePromptAfterDeleteAll(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811DFB0(); - sub_811D104(0); - sub_811D2C8(); - sUnknown_0203A11C->unk0++; + StartMainCursorAnim(); + PrintEasyChatStdMessage(MSG_INSTRUCTIONS); + PrintCurrentPhrase(); + sScreenControl->funcState++; // Fall through case 1: return IsDma3ManagerBusyWithBgCopy(); @@ -3055,42 +3279,42 @@ static bool8 sub_811C518(void) return TRUE; } -static bool8 sub_811C554(void) +static bool8 OpenKeyboard(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811DF90(); + StopMainCursorAnim(); HideBg(0); - sub_811DE5C(0, 0, 0, 0); - sub_811D6D4(); - sUnknown_0203A11C->unk0++; + SetWindowDimensions(0, 0, 0, 0); + PrintKeyboardText(); + sScreenControl->funcState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_811D9CC(0); - sUnknown_0203A11C->unk0++; + InitLowerWindowAnim(WINANIM_OPEN_KEYBOARD); + sScreenControl->funcState++; } break; case 2: - if (!IsDma3ManagerBusyWithBgCopy() && !sub_811DAA4()) - sUnknown_0203A11C->unk0++; + if (!IsDma3ManagerBusyWithBgCopy() && !UpdateLowerWindowAnim()) + sScreenControl->funcState++; break; case 3: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_811E3AC(); - sUnknown_0203A11C->unk0++; + CreateSideWindowSprites(); + sScreenControl->funcState++; } break; case 4: - if (!sub_811E418()) + if (!ShowSideWindow()) { - sub_811DFC8(); - sub_811E6E0(0); - sub_811E64C(); - sUnknown_0203A11C->unk0++; + CreateRectangleCursorSprites(); + SetScrollIndicatorXPos(FALSE); + UpdateScrollIndicatorsVisibility(); + sScreenControl->funcState++; return FALSE; } break; @@ -3101,33 +3325,33 @@ static bool8 sub_811C554(void) return TRUE; } -static bool8 sub_811C620(void) +static bool8 CloseKeyboard(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811E050(); - sub_811E4AC(); - sub_811E6B0(); - sUnknown_0203A11C->unk0++; + DestroyRectangleCursorSprites(); + HideModeWindow(); + HideScrollIndicators(); + sScreenControl->funcState++; break; case 1: - if (sub_811E4D0() == TRUE) + if (DestroySideWindowSprites() == TRUE) break; - sub_811D9CC(1); - sUnknown_0203A11C->unk0++; + InitLowerWindowAnim(WINANIM_CLOSE_KEYBOARD); + sScreenControl->funcState++; // Fall through case 2: - if (!sub_811DAA4()) - sUnknown_0203A11C->unk0++; + if (!UpdateLowerWindowAnim()) + sScreenControl->funcState++; break; case 3: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_811DFB0(); + StartMainCursorAnim(); ShowBg(0); - sUnknown_0203A11C->unk0++; + sScreenControl->funcState++; } break; case 4: @@ -3137,38 +3361,38 @@ static bool8 sub_811C620(void) return TRUE; } -static bool8 sub_811C6C0(void) +static bool8 SwitchKeyboardMode(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811E050(); - sub_811E6B0(); - sub_811E55C(); - sub_811D9CC(5); - sUnknown_0203A11C->unk0++; + DestroyRectangleCursorSprites(); + HideScrollIndicators(); + SetModeWindowToTransition(); + InitLowerWindowAnim(WINANIM_KEYBOARD_SWITCH_OUT); + sScreenControl->funcState++; break; case 1: - if (!sub_811DAA4() && !sub_811E5B8()) + if (!UpdateLowerWindowAnim() && !IsModeWindowAnimActive()) { - sub_811D6D4(); - sUnknown_0203A11C->unk0++; + PrintKeyboardText(); + sScreenControl->funcState++; } break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_811D9CC(6); - sub_811E578(); - sUnknown_0203A11C->unk0++; + InitLowerWindowAnim(WINANIM_KEYBOARD_SWITCH_IN); + UpdateModeWindowAnim(); + sScreenControl->funcState++; } break; case 3: - if (!sub_811DAA4() && !sub_811E5B8()) + if (!UpdateLowerWindowAnim() && !IsModeWindowAnimActive()) { - sub_811E64C(); - sub_811DFC8(); - sUnknown_0203A11C->unk0++; + UpdateScrollIndicatorsVisibility(); + CreateRectangleCursorSprites(); + sScreenControl->funcState++; return FALSE; } break; @@ -3179,25 +3403,25 @@ static bool8 sub_811C6C0(void) return TRUE; } -static bool8 sub_811C780(void) +static bool8 UpdateKeyboardCursor(void) { - sub_811E088(); + UpdateRectangleCursorPos(); return FALSE; } -static bool8 sub_811C78C(void) +static bool8 GroupNamesScrollDown(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811DDAC(1, 4); - sUnknown_0203A11C->unk0++; + InitLowerWindowScroll(1, 4); + sScreenControl->funcState++; // Fall through case 1: - if (!sub_811DE10()) + if (!UpdateLowerWindowScroll()) { - sub_811E088(); - sub_811E64C(); + UpdateRectangleCursorPos(); + UpdateScrollIndicatorsVisibility(); return FALSE; } break; @@ -3206,19 +3430,19 @@ static bool8 sub_811C78C(void) return TRUE; } -static bool8 sub_811C7D4(void) +static bool8 GroupNamesScrollUp(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811DDAC(-1, 4); - sUnknown_0203A11C->unk0++; + InitLowerWindowScroll(-1, 4); + sScreenControl->funcState++; // Fall through case 1: - if (!sub_811DE10()) + if (!UpdateLowerWindowScroll()) { - sub_811E64C(); - sUnknown_0203A11C->unk0++; + UpdateScrollIndicatorsVisibility(); + sScreenControl->funcState++; return FALSE; } break; @@ -3229,45 +3453,45 @@ static bool8 sub_811C7D4(void) return TRUE; } -static bool8 sub_811C830(void) +static bool8 OpenWordSelect(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811E050(); - sub_811E4AC(); - sub_811E6B0(); - sUnknown_0203A11C->unk0++; + DestroyRectangleCursorSprites(); + HideModeWindow(); + HideScrollIndicators(); + sScreenControl->funcState++; break; case 1: - if (!sub_811E4D0()) + if (!DestroySideWindowSprites()) { - sub_811D9B4(); - sUnknown_0203A11C->unk0++; + ClearWordSelectWindow(); + sScreenControl->funcState++; } break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_811D9CC(2); - sUnknown_0203A11C->unk0++; + InitLowerWindowAnim(WINANIM_OPEN_WORD_SELECT); + sScreenControl->funcState++; } break; case 3: - if (!sub_811DAA4()) + if (!UpdateLowerWindowAnim()) { - sub_811D698(2); - sUnknown_0203A11C->unk0++; + InitLowerWindowText(TEXT_WORD_SELECT); + sScreenControl->funcState++; } break; case 4: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_811E288(); - sub_811E6E0(1); - sub_811E64C(); - sub_811E794(); - sUnknown_0203A11C->unk0++; + CreateWordSelectCursorSprite(); + SetScrollIndicatorXPos(TRUE); + UpdateScrollIndicatorsVisibility(); + UpdateStartSelectButtonsVisibility(); + sScreenControl->funcState++; return FALSE; } break; @@ -3278,40 +3502,40 @@ static bool8 sub_811C830(void) return TRUE; } -static bool8 sub_811C8F0(void) +static bool8 CloseWordSelect(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811D2C8(); - sUnknown_0203A11C->unk0++; + PrintCurrentPhrase(); + sScreenControl->funcState++; break; case 1: - sub_811E380(); - sub_811E6B0(); - sub_811E7F8(); - sub_811D9B4(); - sUnknown_0203A11C->unk0++; + DestroyWordSelectCursorSprite(); + HideScrollIndicators(); + HideStartSelectButtons(); + ClearWordSelectWindow(); + sScreenControl->funcState++; break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_811D9CC(3); - sUnknown_0203A11C->unk0++; + InitLowerWindowAnim(WINANIM_CLOSE_WORD_SELECT); + sScreenControl->funcState++; } break; case 3: - if (!sub_811DAA4()) + if (!UpdateLowerWindowAnim()) { ShowBg(0); - sUnknown_0203A11C->unk0++; + sScreenControl->funcState++; } break; case 4: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_811DFB0(); - sUnknown_0203A11C->unk0++; + StartMainCursorAnim(); + sScreenControl->funcState++; return FALSE; } break; @@ -3322,47 +3546,47 @@ static bool8 sub_811C8F0(void) return TRUE; } -static bool8 sub_811C99C(void) +static bool8 ShowConfirmLyricsPrompt(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811D2C8(); - sUnknown_0203A11C->unk0++; + PrintCurrentPhrase(); + sScreenControl->funcState++; break; case 1: - sub_811E380(); - sub_811E6B0(); - sub_811E7F8(); - sub_811D9B4(); - sUnknown_0203A11C->unk0++; + DestroyWordSelectCursorSprite(); + HideScrollIndicators(); + HideStartSelectButtons(); + ClearWordSelectWindow(); + sScreenControl->funcState++; break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_811D9CC(3); - sUnknown_0203A11C->unk0++; + InitLowerWindowAnim(WINANIM_CLOSE_WORD_SELECT); + sScreenControl->funcState++; } break; case 3: - if (!sub_811DAA4()) + if (!UpdateLowerWindowAnim()) { - sub_811D104(3); - sUnknown_0203A11C->unk0++; + PrintEasyChatStdMessage(MSG_CONFIRM); + sScreenControl->funcState++; } break; case 4: if (!IsDma3ManagerBusyWithBgCopy()) { ShowBg(0); - sUnknown_0203A11C->unk0++; + sScreenControl->funcState++; } break; case 5: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_811DFB0(); - sUnknown_0203A11C->unk0++; + StartMainCursorAnim(); + sScreenControl->funcState++; return FALSE; } break; @@ -3373,45 +3597,45 @@ static bool8 sub_811C99C(void) return TRUE; } -static bool8 sub_811CA5C(void) +static bool8 ReturnToKeyboard(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811E380(); - sub_811E6B0(); - sub_811E7F8(); - sub_811D9B4(); - sUnknown_0203A11C->unk0++; + DestroyWordSelectCursorSprite(); + HideScrollIndicators(); + HideStartSelectButtons(); + ClearWordSelectWindow(); + sScreenControl->funcState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_811D9CC(4); - sUnknown_0203A11C->unk0++; + InitLowerWindowAnim(WINANIM_RETURN_TO_KEYBOARD); + sScreenControl->funcState++; } break; case 2: - if (!sub_811DAA4()) + if (!UpdateLowerWindowAnim()) { - sub_811D6D4(); - sUnknown_0203A11C->unk0++; + PrintKeyboardText(); + sScreenControl->funcState++; } break; case 3: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_811E3AC(); - sUnknown_0203A11C->unk0++; + CreateSideWindowSprites(); + sScreenControl->funcState++; } break; case 4: - if (!sub_811E418()) + if (!ShowSideWindow()) { - sub_811DFC8(); - sub_811E6E0(0); - sub_811E64C(); - sUnknown_0203A11C->unk0++; + CreateRectangleCursorSprites(); + SetScrollIndicatorXPos(FALSE); + UpdateScrollIndicatorsVisibility(); + sScreenControl->funcState++; return FALSE; } break; @@ -3420,34 +3644,34 @@ static bool8 sub_811CA5C(void) return TRUE; } -static bool8 sub_811CB18(void) +static bool8 UpdateWordSelectCursor(void) { - sub_811E30C(); + UpdateWordSelectCursorPos(); return FALSE; } -static bool8 sub_811CB24(void) +static bool8 WordSelectScrollDown(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811D7A4(); - sUnknown_0203A11C->unk0++; + PrintWordSelectNextRowDown(); + sScreenControl->funcState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_811DDAC(1, 4); - sUnknown_0203A11C->unk0++; + InitLowerWindowScroll(1, 4); + sScreenControl->funcState++; } break; case 2: - if (!sub_811DE10()) + if (!UpdateLowerWindowScroll()) { - sub_811E30C(); - sub_811E64C(); - sub_811E794(); - sUnknown_0203A11C->unk0++; + UpdateWordSelectCursorPos(); + UpdateScrollIndicatorsVisibility(); + UpdateStartSelectButtonsVisibility(); + sScreenControl->funcState++; return FALSE; } break; @@ -3458,27 +3682,27 @@ static bool8 sub_811CB24(void) return TRUE; } -static bool8 sub_811CB98(void) +static bool8 WordSelectScrollUp(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811D7C8(); - sUnknown_0203A11C->unk0++; + PrintWordSelectNextRowUp(); + sScreenControl->funcState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_811DDAC(-1, 4); - sUnknown_0203A11C->unk0++; + InitLowerWindowScroll(-1, 4); + sScreenControl->funcState++; } break; case 2: - if (!sub_811DE10()) + if (!UpdateLowerWindowScroll()) { - sub_811E64C(); - sub_811E794(); - sUnknown_0203A11C->unk0++; + UpdateScrollIndicatorsVisibility(); + UpdateStartSelectButtonsVisibility(); + sScreenControl->funcState++; return FALSE; } break; @@ -3489,29 +3713,29 @@ static bool8 sub_811CB98(void) return TRUE; } -static bool8 sub_811CC08(void) +static bool8 WordSelectPageScrollDown(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811D7EC(); - sUnknown_0203A11C->unk0++; + PrintWordSelectRowsPageDown(); + sScreenControl->funcState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - s16 var0 = sub_811BBDC() - sub_811DE48(); - sub_811DDAC(var0, 8); - sUnknown_0203A11C->unk0++; + s16 scrollChange = GetWordSelectScrollOffset() - GetLowerWindowScrollOffset(); + InitLowerWindowScroll(scrollChange, 8); + sScreenControl->funcState++; } break; case 2: - if (!sub_811DE10()) + if (!UpdateLowerWindowScroll()) { - sub_811E30C(); - sub_811E64C(); - sub_811E794(); - sUnknown_0203A11C->unk0++; + UpdateWordSelectCursorPos(); + UpdateScrollIndicatorsVisibility(); + UpdateStartSelectButtonsVisibility(); + sScreenControl->funcState++; return FALSE; } break; @@ -3522,28 +3746,28 @@ static bool8 sub_811CC08(void) return TRUE; } -static bool8 sub_811CC90(void) +static bool8 WordSelectPageScrollUp(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811D830(); - sUnknown_0203A11C->unk0++; + PrintWordSelectRowsPageUp(); + sScreenControl->funcState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - s16 var0 = sub_811BBDC() - sub_811DE48(); - sub_811DDAC(var0, 8); - sUnknown_0203A11C->unk0++; + s16 scrollChange = GetWordSelectScrollOffset() - GetLowerWindowScrollOffset(); + InitLowerWindowScroll(scrollChange, 8); + sScreenControl->funcState++; } break; case 2: - if (!sub_811DE10()) + if (!UpdateLowerWindowScroll()) { - sub_811E64C(); - sub_811E794(); - sUnknown_0203A11C->unk0++; + UpdateScrollIndicatorsVisibility(); + UpdateStartSelectButtonsVisibility(); + sScreenControl->funcState++; return FALSE; } break; @@ -3554,14 +3778,14 @@ static bool8 sub_811CC90(void) return TRUE; } -static bool8 sub_811CD14(void) +static bool8 ShowCreateQuizMsg(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811DF90(); - sub_811D104(4); - sUnknown_0203A11C->unk0++; + StopMainCursorAnim(); + PrintEasyChatStdMessage(MSG_CREATE_QUIZ); + sScreenControl->funcState++; break; case 1: return IsDma3ManagerBusyWithBgCopy(); @@ -3570,14 +3794,14 @@ static bool8 sub_811CD14(void) return TRUE; } -static bool8 sub_811CD54(void) +static bool8 ShowSelectAnswerMsg(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811DF90(); - sub_811D104(5); - sUnknown_0203A11C->unk0++; + StopMainCursorAnim(); + PrintEasyChatStdMessage(MSG_SELECT_ANSWER); + sScreenControl->funcState++; break; case 1: return IsDma3ManagerBusyWithBgCopy(); @@ -3586,14 +3810,14 @@ static bool8 sub_811CD54(void) return TRUE; } -static bool8 sub_811CD94(void) +static bool8 ShowSongTooShortMsg(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811DF90(); - sub_811D104(6); - sUnknown_0203A11C->unk0++; + StopMainCursorAnim(); + PrintEasyChatStdMessage(MSG_SONG_TOO_SHORT); + sScreenControl->funcState++; break; case 1: return IsDma3ManagerBusyWithBgCopy(); @@ -3602,14 +3826,14 @@ static bool8 sub_811CD94(void) return TRUE; } -static bool8 sub_811CDD4(void) +static bool8 ShowCantDeleteLyricsMsg(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811DF90(); - sub_811D104(7); - sUnknown_0203A11C->unk0++; + StopMainCursorAnim(); + PrintEasyChatStdMessage(MSG_CANT_DELETE_LYRICS); + sScreenControl->funcState++; break; case 1: return IsDma3ManagerBusyWithBgCopy(); @@ -3618,14 +3842,14 @@ static bool8 sub_811CDD4(void) return TRUE; } -static bool8 sub_811CE14(void) +static bool8 ShowCombineTwoWordsMsg(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811DF90(); - sub_811D104(8); - sUnknown_0203A11C->unk0++; + StopMainCursorAnim(); + PrintEasyChatStdMessage(MSG_COMBINE_TWO_WORDS); + sScreenControl->funcState++; break; case 1: return IsDma3ManagerBusyWithBgCopy(); @@ -3634,14 +3858,14 @@ static bool8 sub_811CE14(void) return TRUE; } -static bool8 sub_811CE54(void) +static bool8 ShowCantExitMsg(void) { - switch (sUnknown_0203A11C->unk0) + switch (sScreenControl->funcState) { case 0: - sub_811DF90(); - sub_811D104(9); - sUnknown_0203A11C->unk0++; + StopMainCursorAnim(); + PrintEasyChatStdMessage(MSG_CANT_QUIT); + sScreenControl->funcState++; break; case 1: return IsDma3ManagerBusyWithBgCopy(); @@ -3650,28 +3874,28 @@ static bool8 sub_811CE54(void) return TRUE; } -static bool8 sub_811CE94(void) +static bool8 InitEasyChatScreenControl_(void) { - sUnknown_0203A11C = Alloc(sizeof(*sUnknown_0203A11C)); - if (!sUnknown_0203A11C) + sScreenControl = Alloc(sizeof(*sScreenControl)); + if (!sScreenControl) return FALSE; - sUnknown_0203A11C->unk0 = 0; - sUnknown_0203A11C->unk2D8 = NULL; - sUnknown_0203A11C->unk2DC = NULL; - sUnknown_0203A11C->unk2E0 = NULL; - sUnknown_0203A11C->unk2E4 = NULL; - sUnknown_0203A11C->unk2E8 = NULL; - sUnknown_0203A11C->unk2EC = NULL; - sUnknown_0203A11C->unk2F0 = NULL; - sUnknown_0203A11C->unk2F4 = NULL; - sUnknown_0203A11C->unk2F8 = NULL; - sUnknown_0203A11C->unk2FC = NULL; - sUnknown_0203A11C->unkA = FooterHasFourOptions_(); + sScreenControl->funcState = 0; + sScreenControl->mainCursorSprite = NULL; + sScreenControl->rectangleCursorSpriteRight = NULL; + sScreenControl->rectangleCursorSpriteLeft = NULL; + sScreenControl->wordSelectCursorSprite = NULL; + sScreenControl->buttonWindowSprite = NULL; + sScreenControl->modeWindowSprite = NULL; + sScreenControl->scrollIndicatorUpSprite = NULL; + sScreenControl->scrollIndicatorDownSprite = NULL; + sScreenControl->startButtonSprite = NULL; + sScreenControl->selectButtonSprite = NULL; + sScreenControl->fourFooterOptions = FooterHasFourOptions_(); return TRUE; } -static void sub_811CF04(void) +static void InitEasyChatBgs(void) { ChangeBgX(3, 0, 0); ChangeBgY(3, 0, 0); @@ -3684,19 +3908,19 @@ static void sub_811CF04(void) SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON); } -static void sub_811CF64(void) +static void LoadEasyChatPalettes(void) { ResetPaletteFade(); LoadPalette(gEasyChatMode_Pal, 0, 32); - LoadPalette(sUnknown_08597B14, 1 * 16, 32); - LoadPalette(sUnknown_08597B34, 4 * 16, 32); + LoadPalette(sTextInputFrameOrange_Pal, 1 * 16, 32); + LoadPalette(sTextInputFrameGreen_Pal, 4 * 16, 32); LoadPalette(sUnknown_08597C1C, 10 * 16, 8); LoadPalette(sUnknown_08597C24, 11 * 16, 12); LoadPalette(sUnknown_08597C24, 15 * 16, 12); LoadPalette(sUnknown_08597C24, 3 * 16, 12); } -static void sub_811CFCC(void) +static void PrintTitle(void) { int xOffset; const u8 *titleText = GetTitleText(); @@ -3705,17 +3929,17 @@ static void sub_811CFCC(void) xOffset = GetStringCenterAlignXOffset(1, titleText, 144); FillWindowPixelBuffer(0, PIXEL_FILL(0)); - sub_811D058(0, 1, titleText, xOffset, 1, 0xFF, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY); + PrintEasyChatTextWithColors(0, 1, titleText, xOffset, 1, TEXT_SPEED_FF, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY); PutWindowTilemap(0); CopyWindowToVram(0, 3); } -void sub_811D028(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16)) +static void PrintEasyChatText(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16)) { AddTextPrinterParameterized(windowId, fontId, str, x, y, speed, callback); } -static void sub_811D058(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, u8 bg, u8 fg, u8 shadow) +static void PrintEasyChatTextWithColors(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, u8 bg, u8 fg, u8 shadow) { u8 color[3]; color[0] = bg; @@ -3724,51 +3948,51 @@ static void sub_811D058(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, AddTextPrinterParameterized3(windowId, fontId, left, top, color, speed, str); } -static void sub_811D0BC(void) +static void PrintInitialInstructions(void) { FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17); LoadUserWindowBorderGfx(1, 1, 0xE0); DrawTextBorderOuter(1, 1, 14); - sub_811D104(0); + PrintEasyChatStdMessage(MSG_INSTRUCTIONS); PutWindowTilemap(1); CopyBgTilemapBufferToVram(0); } -static void sub_811D104(u8 arg0) +static void PrintEasyChatStdMessage(u8 msgId) { const u8 *text2 = NULL; const u8 *text1 = NULL; - switch (arg0) + switch (msgId) { - case 0: + case MSG_INSTRUCTIONS: GetEasyChatInstructionsText(&text1, &text2); break; - case 2: - sub_811BB40(&text1, &text2); + case MSG_CONFIRM_EXIT: + GetEasyChatConfirmExitText(&text1, &text2); break; - case 3: + case MSG_CONFIRM: GetEasyChatConfirmText(&text1, &text2); break; - case 1: + case MSG_CONFIRM_DELETE: GetEasyChatConfirmDeletionText(&text1, &text2); break; - case 4: + case MSG_CREATE_QUIZ: text1 = gText_CreateAQuiz; break; - case 5: + case MSG_SELECT_ANSWER: text1 = gText_SelectTheAnswer; break; - case 6: + case MSG_SONG_TOO_SHORT: text1 = gText_OnlyOnePhrase; text2 = gText_OriginalSongWillBeUsed; break; - case 7: + case MSG_CANT_DELETE_LYRICS: text1 = gText_LyricsCantBeDeleted; break; - case 8: + case MSG_COMBINE_TWO_WORDS: text1 = gText_CombineTwoWordsOrPhrases3; break; - case 9: + case MSG_CANT_QUIT: text1 = gText_YouCannotQuitHere; text2 = gText_SectionMustBeCompleted; break; @@ -3776,20 +4000,20 @@ static void sub_811D104(u8 arg0) FillWindowPixelBuffer(1, PIXEL_FILL(1)); if (text1) - sub_811D028(1, 1, text1, 0, 1, 0xFF, 0); + PrintEasyChatText(1, 1, text1, 0, 1, TEXT_SPEED_FF, 0); if (text2) - sub_811D028(1, 1, text2, 0, 17, 0xFF, 0); + PrintEasyChatText(1, 1, text2, 0, 17, TEXT_SPEED_FF, 0); CopyWindowToVram(1, 3); } -static void sub_811D214(u8 initialCursorPos) +static void CreateEasyChatYesNoMenu(u8 initialCursorPos) { CreateYesNoMenu(&sEasyChatYesNoWindowTemplate, 1, 14, initialCursorPos); } -static void sub_811D230(void) +static void AddPhraseWindow(void) { u8 frameId; struct WindowTemplate template; @@ -3802,49 +4026,50 @@ static void sub_811D230(void) template.height = sPhraseFrameDimensions[frameId].height; template.paletteNum = 11; template.baseBlock = 0x6C; - sUnknown_0203A11C->windowId = AddWindow(&template); - PutWindowTilemap(sUnknown_0203A11C->windowId); + sScreenControl->windowId = AddWindow(&template); + PutWindowTilemap(sScreenControl->windowId); } -static void sub_811D2C8(void) +static void PrintCurrentPhrase(void) { - u8 spC[4]; - u16 *ecWord; + u8 strClear[4]; + u16 *currentPhrase; u8 numColumns, numRows; u8 *str; int frameId; - int var1; + bool32 isQuizQuestion; int i, j, k; - ecWord = GetEasyChatWordBuffer(); + currentPhrase = GetCurrentPhrase(); numColumns = GetNumColumns(); numRows = GetNumRows(); frameId = GetEasyChatScreenFrameId(); - var1 = 0; - if (frameId == 7) - var1 = 1; - FillWindowPixelBuffer(sUnknown_0203A11C->windowId, PIXEL_FILL(1)); + isQuizQuestion = FALSE; + if (frameId == FRAMEID_QUIZ_QUESTION) + isQuizQuestion = TRUE; + + FillWindowPixelBuffer(sScreenControl->windowId, PIXEL_FILL(1)); for (i = 0; i < numRows; i++) { - memcpy(spC, sText_Clear17, sizeof(sText_Clear17)); - if (var1) - spC[2] = 6; + memcpy(strClear, sText_Clear17, sizeof(sText_Clear17)); + if (isQuizQuestion) + strClear[2] = 6; - str = sUnknown_0203A11C->unkB; - sUnknown_0203A11C->unkB[0] = EOS; - str = StringAppend(str, spC); + str = sScreenControl->phrasePrintBuffer; + sScreenControl->phrasePrintBuffer[0] = EOS; + str = StringAppend(str, strClear); for (j = 0; j < numColumns; j++) { - if (*ecWord != 0xFFFF) + if (*currentPhrase != EC_EMPTY_WORD) { - str = CopyEasyChatWord(str, *ecWord); - ecWord++; + str = CopyEasyChatWord(str, *currentPhrase); + currentPhrase++; } else { - ecWord++; - if (!var1) + currentPhrase++; + if (!isQuizQuestion) { str = WriteColorChangeControlCode(str, 0, 4); for (k = 0; k < 12; k++) @@ -3857,25 +4082,27 @@ static void sub_811D2C8(void) } } - if (var1) - spC[2] = 3; + if (isQuizQuestion) + strClear[2] = 3; - str = StringAppend(str, spC); - if (frameId == 2 || frameId == 7 || frameId == 8) + str = StringAppend(str, strClear); + + if (frameId == FRAMEID_MAIL || frameId == FRAMEID_QUIZ_QUESTION || frameId == FRAMEID_QUIZ_SET_QUESTION) { + // Is 2x5 frame, end on 9th word if (j == 0 && i == 4) break; } } *str = EOS; - sub_811D028(sUnknown_0203A11C->windowId, 1, sUnknown_0203A11C->unkB, 0, i * 16 + 1, 0xFF, 0); + PrintEasyChatText(sScreenControl->windowId, 1, sScreenControl->phrasePrintBuffer, 0, i * 16 + 1, TEXT_SPEED_FF, 0); } - CopyWindowToVram(sUnknown_0203A11C->windowId, 3); + CopyWindowToVram(sScreenControl->windowId, 3); } -static void sub_811D424(u16 *tilemap) +static void BufferFrameTilemap(u16 *tilemap) { u8 frameId; int right, bottom; @@ -3883,19 +4110,22 @@ static void sub_811D424(u16 *tilemap) frameId = GetEasyChatScreenFrameId(); CpuFastFill(0, tilemap, BG_SCREEN_SIZE); - if (frameId == 2 || frameId == 8) + if (frameId == FRAMEID_MAIL || frameId == FRAMEID_QUIZ_SET_QUESTION) { + // These frames fill the screen, no need to draw top/bottom edges right = sPhraseFrameDimensions[frameId].left + sPhraseFrameDimensions[frameId].width; bottom = sPhraseFrameDimensions[frameId].top + sPhraseFrameDimensions[frameId].height; + + // Draw middle section for (y = sPhraseFrameDimensions[frameId].top; y < bottom; y++) { x = sPhraseFrameDimensions[frameId].left - 1; - tilemap[y * 32 + x] = 0x1005; + tilemap[y * 32 + x] = FRAME_OFFSET_ORANGE + FRAME_TILE_L_EDGE; x++; for (; x < right; x++) - tilemap[y * 32 + x] = 0x1000; + tilemap[y * 32 + x] = FRAME_OFFSET_ORANGE + FRAME_TILE_TRANSPARENT; - tilemap[y* 32 + x] = 0x1007; + tilemap[y* 32 + x] = FRAME_OFFSET_ORANGE + FRAME_TILE_R_EDGE; } } else @@ -3904,35 +4134,40 @@ static void sub_811D424(u16 *tilemap) x = sPhraseFrameDimensions[frameId].left - 1; right = sPhraseFrameDimensions[frameId].left + sPhraseFrameDimensions[frameId].width; bottom = sPhraseFrameDimensions[frameId].top + sPhraseFrameDimensions[frameId].height; - tilemap[y * 32 + x] = 0x1001; + + // Draw top edge + tilemap[y * 32 + x] = FRAME_OFFSET_ORANGE + FRAME_TILE_TOP_L_CORNER; x++; for (; x < right; x++) - tilemap[y * 32 + x] = 0x1002; + tilemap[y * 32 + x] = FRAME_OFFSET_ORANGE + FRAME_TILE_TOP_EDGE; - tilemap[y * 32 + x] = 0x1003; + tilemap[y * 32 + x] = FRAME_OFFSET_ORANGE + FRAME_TILE_TOP_R_CORNER; y++; + + // Draw middle section for (; y < bottom; y++) { x = sPhraseFrameDimensions[frameId].left - 1; - tilemap[y * 32 + x] = 0x1005; + tilemap[y * 32 + x] = FRAME_OFFSET_ORANGE + FRAME_TILE_L_EDGE; x++; for (; x < right; x++) - tilemap[y * 32 + x] = 0x1000; + tilemap[y * 32 + x] = FRAME_OFFSET_ORANGE + FRAME_TILE_TRANSPARENT; - tilemap[y* 32 + x] = 0x1007; + tilemap[y* 32 + x] = FRAME_OFFSET_ORANGE + FRAME_TILE_R_EDGE; } + // Draw bottom edge x = sPhraseFrameDimensions[frameId].left - 1; - tilemap[y * 32 + x] = 0x1009; + tilemap[y * 32 + x] = FRAME_OFFSET_ORANGE + FRAME_TILE_BOTTOM_L_CORNER; x++; for (; x < right; x++) - tilemap[y * 32 + x] = 0x100A; + tilemap[y * 32 + x] = FRAME_OFFSET_ORANGE + FRAME_TILE_BOTTOM_EDGE; - tilemap[y * 32 + x] = 0x100B; + tilemap[y * 32 + x] = FRAME_OFFSET_ORANGE + FRAME_TILE_BOTTOM_R_CORNER; } } -static void sub_811D60C(void) +static void AdjustBgTilemapForFooter(void) { u8 frameId; u16 *tilemap; @@ -3941,55 +4176,55 @@ static void sub_811D60C(void) frameId = GetEasyChatScreenFrameId(); switch (sPhraseFrameDimensions[frameId].footerId) { - case 2: + case FOOTER_ANSWER: tilemap += 0x2A0; CopyToBgTilemapBufferRect(3, tilemap, 0, 11, 32, 2); break; - case 1: + case FOOTER_QUIZ: tilemap += 0x300; CopyToBgTilemapBufferRect(3, tilemap, 0, 11, 32, 2); break; - case 3: + case NUM_FOOTER_TYPES: CopyToBgTilemapBufferRect(3, tilemap, 0, 10, 32, 4); break; } } -static void sub_811D684(void) +static void DrawLowerWindow(void) { PutWindowTilemap(2); CopyBgTilemapBufferToVram(2); } -static void sub_811D698(u32 arg0) +static void InitLowerWindowText(u32 whichText) { - sub_811DD84(); + ResetLowerWindowScroll(); FillWindowPixelBuffer(2, PIXEL_FILL(1)); - switch (arg0) + switch (whichText) { - case 0: - sub_811D6F4(); + case TEXT_GROUPS: + PrintKeyboardGroupNames(); break; - case 1: - PrintEasyChatKeyboardText(); + case TEXT_ALPHABET: + PrintKeyboardAlphabet(); break; - case 2: - sub_811D794(); + case TEXT_WORD_SELECT: + PrintInitialWordSelectText(); break; } CopyWindowToVram(2, 2); } -static void sub_811D6D4(void) +static void PrintKeyboardText(void) { - if (!sub_811BBB0()) - sub_811D698(0); + if (!GetInAlphabetMode()) + InitLowerWindowText(TEXT_GROUPS); else - sub_811D698(1); + InitLowerWindowText(TEXT_ALPHABET); } -static void sub_811D6F4(void) +static void PrintKeyboardGroupNames(void) { int i; int x, y; @@ -4000,97 +4235,99 @@ static void sub_811D6F4(void) { for (x = 0; x < 2; x++) { - u8 groupId = sub_811F3B8(i++); + u8 groupId = GetUnlockedEasyChatGroupId(i++); if (groupId == EC_NUM_GROUPS) { - sub_811DDAC(sub_811BBBC(), 0); + InitLowerWindowScroll(GetKeyboardScrollOffset(), 0); return; } - sub_811D028(2, 1, GetEasyChatWordGroupName(groupId), x * 84 + 10, y, 0xFF, NULL); + PrintEasyChatText(2, 1, GetEasyChatWordGroupName(groupId), x * 84 + 10, y, TEXT_SPEED_FF, NULL); } y += 16; } } -static void PrintEasyChatKeyboardText(void) +static void PrintKeyboardAlphabet(void) { u32 i; - for (i = 0; i < ARRAY_COUNT(sEasyChatKeyboardText); i++) - sub_811D028(2, 1, sEasyChatKeyboardText[i], 10, 97 + i * 16, 0xFF, NULL); + for (i = 0; i < ARRAY_COUNT(sEasyChatKeyboardAlphabet); i++) + PrintEasyChatText(2, 1, sEasyChatKeyboardAlphabet[i], 10, 97 + i * 16, TEXT_SPEED_FF, NULL); } -static void sub_811D794(void) +static void PrintInitialWordSelectText(void) { - sub_811D864(0, 4); + PrintWordSelectText(0, NUM_WORD_SELECT_ROWS); } -static void sub_811D7A4(void) +static void PrintWordSelectNextRowDown(void) { - u8 var0 = sub_811BBDC() + 3; - sub_811D950(var0, 1); - sub_811D864(var0, 1); + u8 wordScroll = GetWordSelectScrollOffset() + NUM_WORD_SELECT_ROWS - 1; + EraseWordSelectRows(wordScroll, 1); + PrintWordSelectText(wordScroll, 1); } -static void sub_811D7C8(void) +static void PrintWordSelectNextRowUp(void) { - u8 var0 = sub_811BBDC(); - sub_811D950(var0, 1); - sub_811D864(var0, 1); + u8 wordScroll = GetWordSelectScrollOffset(); + EraseWordSelectRows(wordScroll, 1); + PrintWordSelectText(wordScroll, 1); } -static void sub_811D7EC(void) +static void PrintWordSelectRowsPageDown(void) { - u8 var0 = sub_811BBDC(); - u8 var1 = var0 + 4; - u8 var2 = sub_811BBE8() + 1; - if (var1 > var2) - var1 = var2; + u8 wordScroll = GetWordSelectScrollOffset(); + u8 maxScroll = wordScroll + NUM_WORD_SELECT_ROWS; + u8 maxRows = GetWordSelectLastRow() + 1; + if (maxScroll > maxRows) + maxScroll = maxRows; - if (var0 < var1) + if (wordScroll < maxScroll) { - u8 var3 = var1 - var0; - sub_811D950(var0, var3); - sub_811D864(var0, var3); + u8 numRows = maxScroll - wordScroll; + EraseWordSelectRows(wordScroll, numRows); + PrintWordSelectText(wordScroll, numRows); } } -static void sub_811D830(void) +static void PrintWordSelectRowsPageUp(void) { - u8 var0 = sub_811BBDC(); - u8 var1 = sub_811DE48(); - if (var0 < var1) + u8 wordScroll = GetWordSelectScrollOffset(); + u8 windowScroll = GetLowerWindowScrollOffset(); + if (wordScroll < windowScroll) { - u8 var2 = var1 - var0; - sub_811D950(var0, var2); - sub_811D864(var0, var2); + u8 numRows = windowScroll - wordScroll; + EraseWordSelectRows(wordScroll, numRows); + PrintWordSelectText(wordScroll, numRows); } } -static void sub_811D864(u8 arg0, u8 arg1) +// Print the easy chat words available for selection in +// the currently selected group and at the given offset and row +static void PrintWordSelectText(u8 scrollOffset, u8 numRows) { int i, j; u16 easyChatWord; int y; - int var0; + int wordIndex; - var0 = arg0 * 2; - y = (arg0 * 16 + 96) & 0xFF; + wordIndex = scrollOffset * NUM_WORD_SELECT_COLUMNS; + y = (scrollOffset * 16 + 96) & 0xFF; y++; - for (i = 0; i < arg1; i++) + for (i = 0; i < numRows; i++) { for (j = 0; j < 2; j++) { - easyChatWord = sub_811F578(var0++); - if (easyChatWord != 0xFFFF) + easyChatWord = GetWordFromSelectedGroup(wordIndex++); + if (easyChatWord != EC_EMPTY_WORD) { - CopyEasyChatWordPadded(sUnknown_0203A11C->unkCC, easyChatWord, 0); - if (!sub_811BF88(easyChatWord)) - sub_811D028(2, 1, sUnknown_0203A11C->unkCC, (j * 13 + 3) * 8, y, 0xFF, NULL); - else - sub_811D058(2, 1, sUnknown_0203A11C->unkCC, (j * 13 + 3) * 8, y, 0xFF, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_RED, TEXT_COLOR_LIGHT_GREY); + CopyEasyChatWordPadded(sScreenControl->wordSelectPrintBuffer, easyChatWord, 0); + if (!DummyWordCheck(easyChatWord)) + PrintEasyChatText(2, 1, sScreenControl->wordSelectPrintBuffer, (j * 13 + 3) * 8, y, TEXT_SPEED_FF, NULL); + else // Never reached + PrintEasyChatTextWithColors(2, 1, sScreenControl->wordSelectPrintBuffer, (j * 13 + 3) * 8, y, TEXT_SPEED_FF, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_RED, TEXT_COLOR_LIGHT_GREY); } } @@ -4100,16 +4337,17 @@ static void sub_811D864(u8 arg0, u8 arg1) CopyWindowToVram(2, 2); } -static void sub_811D950(u8 arg0, u8 arg1) +static void EraseWordSelectRows(u8 scrollOffset, u8 numRows) { int y; int var0; int var1; int var2; - y = (arg0 * 16 + 96) & 0xFF; - var2 = arg1 * 16; + y = (scrollOffset * 16 + 96) & 0xFF; + var2 = numRows * 16; var0 = y + var2; + if (var0 > 255) { var1 = var0 - 256; @@ -4125,191 +4363,209 @@ static void sub_811D950(u8 arg0, u8 arg1) FillWindowPixelRect(2, PIXEL_FILL(1), 0, 0, 224, var1); } -static void sub_811D9B4(void) +static void ClearWordSelectWindow(void) { FillWindowPixelBuffer(2, PIXEL_FILL(1)); CopyWindowToVram(2, 2); } -static void sub_811D9CC(int arg0) +static void InitLowerWindowAnim(int winAnimType) { - switch (arg0) + switch (winAnimType) { - case 0: - sUnknown_0203A11C->unk6 = 0; - sUnknown_0203A11C->unk7 = 10; + case WINANIM_OPEN_KEYBOARD: + sScreenControl->curWindowAnimState = 0; + sScreenControl->destWindowAnimState = 10; break; - case 1: - sUnknown_0203A11C->unk6 = 9; - sUnknown_0203A11C->unk7 = 0; + case WINANIM_CLOSE_KEYBOARD: + sScreenControl->curWindowAnimState = 9; + sScreenControl->destWindowAnimState = 0; break; - case 2: - sUnknown_0203A11C->unk6 = 11; - sUnknown_0203A11C->unk7 = 17; + case WINANIM_OPEN_WORD_SELECT: + sScreenControl->curWindowAnimState = 11; + sScreenControl->destWindowAnimState = 17; break; - case 3: - sUnknown_0203A11C->unk6 = 17; - sUnknown_0203A11C->unk7 = 0; + case WINANIM_CLOSE_WORD_SELECT: + sScreenControl->curWindowAnimState = 17; + sScreenControl->destWindowAnimState = 0; break; - case 4: - sUnknown_0203A11C->unk6 = 17; - sUnknown_0203A11C->unk7 = 10; + case WINANIM_RETURN_TO_KEYBOARD: + sScreenControl->curWindowAnimState = 17; + sScreenControl->destWindowAnimState = 10; break; - case 5: - sUnknown_0203A11C->unk6 = 18; - sUnknown_0203A11C->unk7 = 22; + case WINANIM_KEYBOARD_SWITCH_OUT: + sScreenControl->curWindowAnimState = 18; + sScreenControl->destWindowAnimState = 22; break; - case 6: - sUnknown_0203A11C->unk6 = 22; - sUnknown_0203A11C->unk7 = 18; + case WINANIM_KEYBOARD_SWITCH_IN: + sScreenControl->curWindowAnimState = 22; + sScreenControl->destWindowAnimState = 18; break; } - sUnknown_0203A11C->unk8 = sUnknown_0203A11C->unk6 < sUnknown_0203A11C->unk7 ? 1 : -1; + sScreenControl->windowAnimStateDir = sScreenControl->curWindowAnimState < sScreenControl->destWindowAnimState ? 1 : -1; } -static bool8 sub_811DAA4(void) +// Returns FALSE if the anim is finished +static bool8 UpdateLowerWindowAnim(void) { - u8 var0, var1; - if (sUnknown_0203A11C->unk6 == sUnknown_0203A11C->unk7) + u8 curState, destState; + if (sScreenControl->curWindowAnimState == sScreenControl->destWindowAnimState) return FALSE; - sUnknown_0203A11C->unk6 += sUnknown_0203A11C->unk8; - sub_811DADC(sUnknown_0203A11C->unk6); - var0 = sUnknown_0203A11C->unk6; - var1 = sUnknown_0203A11C->unk7; - return (var0 ^ var1) > 0; + sScreenControl->curWindowAnimState += sScreenControl->windowAnimStateDir; + DrawLowerWindowFrame(sScreenControl->curWindowAnimState); + curState = sScreenControl->curWindowAnimState; + destState = sScreenControl->destWindowAnimState; + return (curState ^ destState) > 0; } -static void sub_811DADC(u8 arg0) +// States in this function are used incrementally with differing start/end cases +// to draw the lower window and create the appearance that it's opening/closing/animating. +// See InitLowerWindowAnim +static void DrawLowerWindowFrame(u8 type) { FillBgTilemapBufferRect_Palette0(1, 0, 0, 10, 30, 10); - switch (arg0) + switch (type) { - case 0: + case 0: // Closed break; case 1: - sub_811DC28(11, 14, 3, 2); + BufferLowerWindowFrame(11, 14, 3, 2); break; case 2: - sub_811DC28(9, 14, 7, 2); + BufferLowerWindowFrame(9, 14, 7, 2); break; case 3: - sub_811DC28(7, 14, 11, 2); + BufferLowerWindowFrame(7, 14, 11, 2); break; case 4: - sub_811DC28(5, 14, 15, 2); + BufferLowerWindowFrame(5, 14, 15, 2); break; case 5: - sub_811DC28(3, 14, 19, 2); + BufferLowerWindowFrame(3, 14, 19, 2); break; case 6: - sub_811DC28(1, 14, 23, 2); - break; - case 11: - sub_811DC28(1, 10, 24, 10); - break; - case 12: - sub_811DC28(1, 10, 25, 10); - break; - case 13: - sub_811DC28(1, 10, 26, 10); - break; - case 14: - sub_811DC28(1, 10, 27, 10); - break; - case 15: - sub_811DC28(1, 10, 28, 10); - break; - case 16: - sub_811DC28(1, 10, 29, 10); - break; - case 17: - sub_811DC28(0, 10, 30, 10); - break; - case 10: - case 18: - sub_811DC28(1, 10, 23, 10); - break; - case 9: - case 19: - sub_811DC28(1, 11, 23, 8); - break; - case 8: - case 20: - sub_811DC28(1, 12, 23, 6); + BufferLowerWindowFrame(1, 14, 23, 2); break; case 7: + BufferLowerWindowFrame(1, 13, 23, 4); + break; + case 8: + BufferLowerWindowFrame(1, 12, 23, 6); + break; + case 9: + BufferLowerWindowFrame(1, 11, 23, 8); + break; + case 10: + BufferLowerWindowFrame(1, 10, 23, 10); + break; + case 11: + BufferLowerWindowFrame(1, 10, 24, 10); + break; + case 12: + BufferLowerWindowFrame(1, 10, 25, 10); + break; + case 13: + BufferLowerWindowFrame(1, 10, 26, 10); + break; + case 14: + BufferLowerWindowFrame(1, 10, 27, 10); + break; + case 15: + BufferLowerWindowFrame(1, 10, 28, 10); + break; + case 16: + BufferLowerWindowFrame(1, 10, 29, 10); + break; + case 17: + BufferLowerWindowFrame(0, 10, 30, 10); + break; + case 18: + BufferLowerWindowFrame(1, 10, 23, 10); + break; + case 19: + BufferLowerWindowFrame(1, 11, 23, 8); + break; + case 20: + BufferLowerWindowFrame(1, 12, 23, 6); + break; case 21: - sub_811DC28(1, 13, 23, 4); + BufferLowerWindowFrame(1, 13, 23, 4); break; case 22: - sub_811DC28(1, 14, 23, 2); + BufferLowerWindowFrame(1, 14, 23, 2); break; } CopyBgTilemapBufferToVram(1); } -static void sub_811DC28(int left, int top, int width, int height) +static void BufferLowerWindowFrame(int left, int top, int width, int height) { u16 *tilemap; int right; int bottom; int x, y; - tilemap = sUnknown_0203A11C->unk300; + tilemap = sScreenControl->bg1TilemapBuffer; right = left + width - 1; bottom = top + height - 1; x = left; y = top; - tilemap[y * 32 + x] = 0x4001; + + // Draw top edge + tilemap[y * 32 + x] = FRAME_OFFSET_GREEN + FRAME_TILE_TOP_L_CORNER; x++; for (; x < right; x++) - tilemap[y * 32 + x] = 0x4002; + tilemap[y * 32 + x] = FRAME_OFFSET_GREEN + FRAME_TILE_TOP_EDGE; - tilemap[y * 32 + x] = 0x4003; + tilemap[y * 32 + x] = FRAME_OFFSET_GREEN + FRAME_TILE_TOP_R_CORNER; y++; + + // Draw middle section for (; y < bottom; y++) { - tilemap[y * 32 + left] = 0x4005; + tilemap[y * 32 + left] = FRAME_OFFSET_GREEN + FRAME_TILE_L_EDGE; x = left + 1; for (; x < right; x++) - tilemap[y * 32 + x] = 0x4000; + tilemap[y * 32 + x] = FRAME_OFFSET_GREEN + FRAME_TILE_TRANSPARENT; - tilemap[y * 32 + x] = 0x4007; + tilemap[y * 32 + x] = FRAME_OFFSET_GREEN + FRAME_TILE_R_EDGE; } - tilemap[y * 32 + left] = 0x4009; + // Draw bottom edge + tilemap[y * 32 + left] = FRAME_OFFSET_GREEN + FRAME_TILE_BOTTOM_L_CORNER; x = left + 1; for (; x < right; x++) - tilemap[y * 32 + x] = 0x400A; + tilemap[y * 32 + x] = FRAME_OFFSET_GREEN + FRAME_TILE_BOTTOM_EDGE; - tilemap[y * 32 + x] = 0x400B; - sub_811DE5C((left + 1) * 8, (top + 1) * 8, (width - 2) * 8, (height - 2) * 8); + tilemap[y * 32 + x] = FRAME_OFFSET_GREEN + FRAME_TILE_BOTTOM_R_CORNER; + + SetWindowDimensions((left + 1) * 8, (top + 1) * 8, (width - 2) * 8, (height - 2) * 8); } -static void sub_811DD84(void) +static void ResetLowerWindowScroll(void) { ChangeBgY(2, 0x800, 0); - sUnknown_0203A11C->unk2CE = 0; + sScreenControl->scrollOffset = 0; } -static void sub_811DDAC(s16 arg0, u8 arg1) +static void InitLowerWindowScroll(s16 scrollChange, u8 speed) { int bgY; - s16 var0; + s16 yChange; bgY = GetBgY(2); - sUnknown_0203A11C->unk2CE += arg0; - var0 = arg0 * 16; - bgY += var0 << 8; - if (arg1) + sScreenControl->scrollOffset += scrollChange; + yChange = scrollChange * 16; + bgY += yChange * 256; + if (speed) { - sUnknown_0203A11C->unk2D0 = bgY; - sUnknown_0203A11C->unk2D4 = arg1 * 256; - if (var0 < 0) - sUnknown_0203A11C->unk2D4 = -sUnknown_0203A11C->unk2D4; + sScreenControl->scrollDest = bgY; + sScreenControl->scrollSpeed = speed * 256; + if (yChange < 0) + sScreenControl->scrollSpeed = -sScreenControl->scrollSpeed; } else { @@ -4317,28 +4573,28 @@ static void sub_811DDAC(s16 arg0, u8 arg1) } } -static bool8 sub_811DE10(void) +static bool8 UpdateLowerWindowScroll(void) { int bgY; bgY = GetBgY(2); - if (bgY == sUnknown_0203A11C->unk2D0) + if (bgY == sScreenControl->scrollDest) { return FALSE; } else { - ChangeBgY(2, sUnknown_0203A11C->unk2D4, 1); + ChangeBgY(2, sScreenControl->scrollSpeed, 1); return TRUE; } } -static int sub_811DE48(void) +static int GetLowerWindowScrollOffset(void) { - return sUnknown_0203A11C->unk2CE; + return sScreenControl->scrollOffset; } -static void sub_811DE5C(u8 left, u8 top, u8 width, u8 height) +static void SetWindowDimensions(u8 left, u8 top, u8 width, u8 height) { u16 horizontalDimensions = WIN_RANGE(left, left + width); u16 verticalDimensions = WIN_RANGE(top, top + height); @@ -4346,244 +4602,258 @@ static void sub_811DE5C(u8 left, u8 top, u8 width, u8 height) SetGpuReg(REG_OFFSET_WIN0V, verticalDimensions); } -static void sub_811DE90(void) +static void LoadEasyChatGfx(void) { u32 i; - LoadSpriteSheets(sEasyChatSpriteSheets); - LoadSpritePalettes(sEasyChatSpritePalettes); - for (i = 0; i < ARRAY_COUNT(sUnknown_08597CE8); i++) - LoadCompressedSpriteSheet(&sUnknown_08597CE8[i]); + LoadSpriteSheets(sSpriteSheets); + LoadSpritePalettes(sSpritePalettes); + for (i = 0; i < ARRAY_COUNT(sCompressedSpriteSheets); i++) + LoadCompressedSpriteSheet(&sCompressedSpriteSheets[i]); } -static void sub_811DEC4(void) +#define sDelayTimer data[0] +#define sAnimateCursor data[1] + +static void CreateMainCursorSprite(void) { u8 frameId = GetEasyChatScreenFrameId(); int x = sPhraseFrameDimensions[frameId].left * 8 + 13; int y = sPhraseFrameDimensions[frameId].top * 8 + 8; - u8 spriteId = CreateSprite(&sUnknown_08597D18, x, y, 2); - sUnknown_0203A11C->unk2D8 = &gSprites[spriteId]; - gSprites[spriteId].data[1] = 1; + u8 spriteId = CreateSprite(&sSpriteTemplate_TriangleCursor, x, y, 2); + sScreenControl->mainCursorSprite = &gSprites[spriteId]; + gSprites[spriteId].sAnimateCursor = TRUE; } -static void sub_811DF28(struct Sprite *sprite) +static void SpriteCB_Cursor(struct Sprite *sprite) { - if (sprite->data[1]) + if (sprite->sAnimateCursor) { - if (++sprite->data[0] > 2) + if (++sprite->sDelayTimer > 2) { - sprite->data[0] = 0; + sprite->sDelayTimer = 0; if (++sprite->pos2.x > 0) sprite->pos2.x = -6; } } } -static void sub_811DF60(u8 x, u8 y) +static void SetMainCursorPos(u8 x, u8 y) { - sUnknown_0203A11C->unk2D8->pos1.x = x; - sUnknown_0203A11C->unk2D8->pos1.y = y; - sUnknown_0203A11C->unk2D8->pos2.x = 0; - sUnknown_0203A11C->unk2D8->data[0] = 0; + sScreenControl->mainCursorSprite->pos1.x = x; + sScreenControl->mainCursorSprite->pos1.y = y; + sScreenControl->mainCursorSprite->pos2.x = 0; + sScreenControl->mainCursorSprite->sDelayTimer = 0; } -static void sub_811DF90(void) +static void StopMainCursorAnim(void) { - sUnknown_0203A11C->unk2D8->data[0] = 0; - sUnknown_0203A11C->unk2D8->data[1] = 0; - sUnknown_0203A11C->unk2D8->pos2.x = 0; + sScreenControl->mainCursorSprite->sDelayTimer = 0; + sScreenControl->mainCursorSprite->sAnimateCursor = FALSE; + sScreenControl->mainCursorSprite->pos2.x = 0; } -static void sub_811DFB0(void) +static void StartMainCursorAnim(void) { - sUnknown_0203A11C->unk2D8->data[1] = 1; + sScreenControl->mainCursorSprite->sAnimateCursor = TRUE; } -static void sub_811DFC8(void) +static void CreateRectangleCursorSprites(void) { - u8 spriteId = CreateSprite(&sUnknown_08597D68, 0, 0, 3); - sUnknown_0203A11C->unk2DC = &gSprites[spriteId]; - sUnknown_0203A11C->unk2DC->pos2.x = 32; + u8 spriteId = CreateSprite(&sSpriteTemplate_RectangleCursor, 0, 0, 3); + sScreenControl->rectangleCursorSpriteRight = &gSprites[spriteId]; + sScreenControl->rectangleCursorSpriteRight->pos2.x = 32; - spriteId = CreateSprite(&sUnknown_08597D68, 0, 0, 3); - sUnknown_0203A11C->unk2E0 = &gSprites[spriteId]; - sUnknown_0203A11C->unk2E0->pos2.x = -32; + spriteId = CreateSprite(&sSpriteTemplate_RectangleCursor, 0, 0, 3); + sScreenControl->rectangleCursorSpriteLeft = &gSprites[spriteId]; + sScreenControl->rectangleCursorSpriteLeft->pos2.x = -32; - sUnknown_0203A11C->unk2DC->hFlip = 1; - sub_811E088(); + sScreenControl->rectangleCursorSpriteRight->hFlip = TRUE; + UpdateRectangleCursorPos(); } -static void sub_811E050(void) +static void DestroyRectangleCursorSprites(void) { - DestroySprite(sUnknown_0203A11C->unk2DC); - sUnknown_0203A11C->unk2DC = NULL; - DestroySprite(sUnknown_0203A11C->unk2E0); - sUnknown_0203A11C->unk2E0 = NULL; + DestroySprite(sScreenControl->rectangleCursorSpriteRight); + sScreenControl->rectangleCursorSpriteRight = NULL; + DestroySprite(sScreenControl->rectangleCursorSpriteLeft); + sScreenControl->rectangleCursorSpriteLeft = NULL; } -static void sub_811E088(void) +static void UpdateRectangleCursorPos(void) { - u8 var0; - u8 var1; + s8 column; + s8 row; - if (sUnknown_0203A11C->unk2DC && sUnknown_0203A11C->unk2E0) + if (sScreenControl->rectangleCursorSpriteRight + && sScreenControl->rectangleCursorSpriteLeft) { - sub_811BB9C(&var0, &var1); - if (!sub_811BBB0()) - sub_811E0EC(var0, var1); + GetKeyboardCursorColAndRow(&column, &row); + if (!GetInAlphabetMode()) + SetRectangleCursorPos_GroupMode(column, row); else - sub_811E1A4(var0, var1); + SetRectangleCursorPos_AlphabetMode(column, row); } } -static void sub_811E0EC(s8 arg0, s8 arg1) +static void SetRectangleCursorPos_GroupMode(s8 column, s8 row) { - if (arg0 != -1) + if (column != -1) { - StartSpriteAnim(sUnknown_0203A11C->unk2DC, 0); - sUnknown_0203A11C->unk2DC->pos1.x = arg0 * 84 + 58; - sUnknown_0203A11C->unk2DC->pos1.y = arg1 * 16 + 96; + // In group name window + StartSpriteAnim(sScreenControl->rectangleCursorSpriteRight, RECTCURSOR_ANIM_ON_GROUP); + sScreenControl->rectangleCursorSpriteRight->pos1.x = column * 84 + 58; + sScreenControl->rectangleCursorSpriteRight->pos1.y = row * 16 + 96; - StartSpriteAnim(sUnknown_0203A11C->unk2E0, 0); - sUnknown_0203A11C->unk2E0->pos1.x = arg0 * 84 + 58; - sUnknown_0203A11C->unk2E0->pos1.y = arg1 * 16 + 96; + StartSpriteAnim(sScreenControl->rectangleCursorSpriteLeft, RECTCURSOR_ANIM_ON_GROUP); + sScreenControl->rectangleCursorSpriteLeft->pos1.x = column * 84 + 58; + sScreenControl->rectangleCursorSpriteLeft->pos1.y = row * 16 + 96; } else { - StartSpriteAnim(sUnknown_0203A11C->unk2DC, 1); - sUnknown_0203A11C->unk2DC->pos1.x = 216; - sUnknown_0203A11C->unk2DC->pos1.y = arg1 * 16 + 112; + // In button window + StartSpriteAnim(sScreenControl->rectangleCursorSpriteRight, RECTCURSOR_ANIM_ON_BUTTON); + sScreenControl->rectangleCursorSpriteRight->pos1.x = 216; + sScreenControl->rectangleCursorSpriteRight->pos1.y = row * 16 + 112; - StartSpriteAnim(sUnknown_0203A11C->unk2E0, 1); - sUnknown_0203A11C->unk2E0->pos1.x = 216; - sUnknown_0203A11C->unk2E0->pos1.y = arg1 * 16 + 112; + StartSpriteAnim(sScreenControl->rectangleCursorSpriteLeft, RECTCURSOR_ANIM_ON_BUTTON); + sScreenControl->rectangleCursorSpriteLeft->pos1.x = 216; + sScreenControl->rectangleCursorSpriteLeft->pos1.y = row * 16 + 112; } } -static void sub_811E1A4(s8 arg0, s8 arg1) +static void SetRectangleCursorPos_AlphabetMode(s8 column, s8 row) { int anim; int x, y; - if (arg0 != -1) + if (column != -1) { - y = arg1 * 16 + 96; + y = row * 16 + 96; x = 32; - if (arg0 == 6 && arg1 == 0) + if (column == NUM_ALPHABET_COLUMNS - 1 && row == 0) { + // Cursor is on 'Others' x = 158; - anim = 2; + anim = RECTCURSOR_ANIM_ON_OTHERS; } else { - x += sUnknown_08597D08[arg0 < ARRAY_COUNT(sUnknown_08597D08) ? arg0 : 0]; - anim = 3; + // Cursor is on a letter + x += sAlphabetKeyboardColumnOffsets[(u8)column < NUM_ALPHABET_COLUMNS ? column : 0]; + anim = RECTCURSOR_ANIM_ON_LETTER; } - StartSpriteAnim(sUnknown_0203A11C->unk2DC, anim); - sUnknown_0203A11C->unk2DC->pos1.x = x; - sUnknown_0203A11C->unk2DC->pos1.y = y; + StartSpriteAnim(sScreenControl->rectangleCursorSpriteRight, anim); + sScreenControl->rectangleCursorSpriteRight->pos1.x = x; + sScreenControl->rectangleCursorSpriteRight->pos1.y = y; - StartSpriteAnim(sUnknown_0203A11C->unk2E0, anim); - sUnknown_0203A11C->unk2E0->pos1.x = x; - sUnknown_0203A11C->unk2E0->pos1.y = y; + StartSpriteAnim(sScreenControl->rectangleCursorSpriteLeft, anim); + sScreenControl->rectangleCursorSpriteLeft->pos1.x = x; + sScreenControl->rectangleCursorSpriteLeft->pos1.y = y; } else { - StartSpriteAnim(sUnknown_0203A11C->unk2DC, 1); - sUnknown_0203A11C->unk2DC->pos1.x = 216; - sUnknown_0203A11C->unk2DC->pos1.y = arg1 * 16 + 112; + // In button window + StartSpriteAnim(sScreenControl->rectangleCursorSpriteRight, RECTCURSOR_ANIM_ON_BUTTON); + sScreenControl->rectangleCursorSpriteRight->pos1.x = 216; + sScreenControl->rectangleCursorSpriteRight->pos1.y = row * 16 + 112; - StartSpriteAnim(sUnknown_0203A11C->unk2E0, 1); - sUnknown_0203A11C->unk2E0->pos1.x = 216; - sUnknown_0203A11C->unk2E0->pos1.y = arg1 * 16 + 112; + StartSpriteAnim(sScreenControl->rectangleCursorSpriteLeft, RECTCURSOR_ANIM_ON_BUTTON); + sScreenControl->rectangleCursorSpriteLeft->pos1.x = 216; + sScreenControl->rectangleCursorSpriteLeft->pos1.y = row * 16 + 112; } } -static void sub_811E288(void) +// Cursor for selecting a new word +// Identical in appearance to the 'main' cursor +static void CreateWordSelectCursorSprite(void) { - u8 spriteId = CreateSprite(&sUnknown_08597D18, 0, 0, 4); - sUnknown_0203A11C->unk2E4 = &gSprites[spriteId]; - sUnknown_0203A11C->unk2E4->callback = sub_811E2DC; - sUnknown_0203A11C->unk2E4->oam.priority = 2; - sub_811E30C(); + u8 spriteId = CreateSprite(&sSpriteTemplate_TriangleCursor, 0, 0, 4); + sScreenControl->wordSelectCursorSprite = &gSprites[spriteId]; + sScreenControl->wordSelectCursorSprite->callback = SpriteCB_WordSelectCursor; + sScreenControl->wordSelectCursorSprite->oam.priority = 2; + UpdateWordSelectCursorPos(); } -static void sub_811E2DC(struct Sprite *sprite) +static void SpriteCB_WordSelectCursor(struct Sprite *sprite) { - if (++sprite->data[0] > 2) + if (++sprite->sDelayTimer > 2) { - sprite->data[0] = 0; + sprite->sDelayTimer = 0; if (++sprite->pos2.x > 0) sprite->pos2.x = -6; } } -static void sub_811E30C(void) +static void UpdateWordSelectCursorPos(void) { - s8 var0, var1, x, y; + s8 column, row, x, y; - sub_811BBC8(&var0, &var1); - x = var0 * 13; + GetWordSelectColAndRow(&column, &row); + x = column * 13; x = x * 8 + 28; - y = var1 * 16 + 96; - sub_811E34C(x, y); + y = row * 16 + 96; + SetWordSelectCursorPos(x, y); } -static void sub_811E34C(u8 x, u8 y) +static void SetWordSelectCursorPos(u8 x, u8 y) { - if (sUnknown_0203A11C->unk2E4) + if (sScreenControl->wordSelectCursorSprite) { - sUnknown_0203A11C->unk2E4->pos1.x = x; - sUnknown_0203A11C->unk2E4->pos1.y = y; - sUnknown_0203A11C->unk2E4->pos2.x = 0; - sUnknown_0203A11C->unk2E4->data[0] = 0; + sScreenControl->wordSelectCursorSprite->pos1.x = x; + sScreenControl->wordSelectCursorSprite->pos1.y = y; + sScreenControl->wordSelectCursorSprite->pos2.x = 0; + sScreenControl->wordSelectCursorSprite->sDelayTimer = 0; } } -static void sub_811E380(void) +static void DestroyWordSelectCursorSprite(void) { - if (sUnknown_0203A11C->unk2E4) + if (sScreenControl->wordSelectCursorSprite) { - DestroySprite(sUnknown_0203A11C->unk2E4); - sUnknown_0203A11C->unk2E4 = NULL; + DestroySprite(sScreenControl->wordSelectCursorSprite); + sScreenControl->wordSelectCursorSprite = NULL; } } -static void sub_811E3AC(void) +static void CreateSideWindowSprites(void) { - u8 spriteId = CreateSprite(&sUnknown_08597DF0, 208, 128, 6); - sUnknown_0203A11C->unk2E8 = &gSprites[spriteId]; - sUnknown_0203A11C->unk2E8->pos2.x = -64; + u8 spriteId = CreateSprite(&sSpriteTemplate_ButtonWindow, 208, 128, 6); + sScreenControl->buttonWindowSprite = &gSprites[spriteId]; + sScreenControl->buttonWindowSprite->pos2.x = -64; - spriteId = CreateSprite(&sUnknown_08597DD0, 208, 80, 5); - sUnknown_0203A11C->unk2EC = &gSprites[spriteId]; - sUnknown_0203A11C->unk9 = 0; + spriteId = CreateSprite(&sSpriteTemplate_ModeWindow, 208, 80, 5); + sScreenControl->modeWindowSprite = &gSprites[spriteId]; + sScreenControl->modeWindowState = 0; } -static bool8 sub_811E418(void) +static bool8 ShowSideWindow(void) { - switch (sUnknown_0203A11C->unk9) + switch (sScreenControl->modeWindowState) { default: return FALSE; case 0: - sUnknown_0203A11C->unk2E8->pos2.x += 8; - if (sUnknown_0203A11C->unk2E8->pos2.x >= 0) + // Slide button window on + sScreenControl->buttonWindowSprite->pos2.x += 8; + if (sScreenControl->buttonWindowSprite->pos2.x >= 0) { - sUnknown_0203A11C->unk2E8->pos2.x = 0; - if (!sub_811BBB0()) - StartSpriteAnim(sUnknown_0203A11C->unk2EC, 1); + sScreenControl->buttonWindowSprite->pos2.x = 0; + + // Set mode window anim + if (!GetInAlphabetMode()) + StartSpriteAnim(sScreenControl->modeWindowSprite, MODEWINDOW_ANIM_TO_GROUP); else - StartSpriteAnim(sUnknown_0203A11C->unk2EC, 2); + StartSpriteAnim(sScreenControl->modeWindowSprite, MODEWINDOW_ANIM_TO_ALPHABET); - sUnknown_0203A11C->unk9++; + sScreenControl->modeWindowState++; } break; case 1: - if (sUnknown_0203A11C->unk2EC->animEnded) + if (sScreenControl->modeWindowSprite->animEnded) { - sUnknown_0203A11C->unk9 = 2; + sScreenControl->modeWindowState = 2; return FALSE; } } @@ -4591,31 +4861,31 @@ static bool8 sub_811E418(void) return TRUE; } -static void sub_811E4AC(void) +static void HideModeWindow(void) { - sUnknown_0203A11C->unk9 = 0; - StartSpriteAnim(sUnknown_0203A11C->unk2EC, 3); + sScreenControl->modeWindowState = 0; + StartSpriteAnim(sScreenControl->modeWindowSprite, MODEWINDOW_ANIM_TO_HIDDEN); } -static bool8 sub_811E4D0(void) +static bool8 DestroySideWindowSprites(void) { - switch (sUnknown_0203A11C->unk9) + switch (sScreenControl->modeWindowState) { default: return FALSE; case 0: - if (sUnknown_0203A11C->unk2EC->animEnded) - sUnknown_0203A11C->unk9 = 1; + if (sScreenControl->modeWindowSprite->animEnded) + sScreenControl->modeWindowState = 1; break; case 1: - sUnknown_0203A11C->unk2E8->pos2.x -= 8; - if (sUnknown_0203A11C->unk2E8->pos2.x <= -64) + sScreenControl->buttonWindowSprite->pos2.x -= 8; + if (sScreenControl->buttonWindowSprite->pos2.x <= -64) { - DestroySprite(sUnknown_0203A11C->unk2EC); - DestroySprite(sUnknown_0203A11C->unk2E8); - sUnknown_0203A11C->unk2EC = NULL; - sUnknown_0203A11C->unk2E8 = NULL; - sUnknown_0203A11C->unk9++; + DestroySprite(sScreenControl->modeWindowSprite); + DestroySprite(sScreenControl->buttonWindowSprite); + sScreenControl->modeWindowSprite = NULL; + sScreenControl->buttonWindowSprite = NULL; + sScreenControl->modeWindowState++; return FALSE; } } @@ -4623,95 +4893,98 @@ static bool8 sub_811E4D0(void) return TRUE; } -static void sub_811E55C(void) +static void SetModeWindowToTransition(void) { - StartSpriteAnim(sUnknown_0203A11C->unk2EC, 4); + StartSpriteAnim(sScreenControl->modeWindowSprite, MODEWINDOW_ANIM_TRANSITION); } -static void sub_811E578(void) +static void UpdateModeWindowAnim(void) { - if (!sub_811BBB0()) - StartSpriteAnim(sUnknown_0203A11C->unk2EC, 1); + if (!GetInAlphabetMode()) + StartSpriteAnim(sScreenControl->modeWindowSprite, MODEWINDOW_ANIM_TO_GROUP); else - StartSpriteAnim(sUnknown_0203A11C->unk2EC, 2); + StartSpriteAnim(sScreenControl->modeWindowSprite, MODEWINDOW_ANIM_TO_ALPHABET); } -static bool8 sub_811E5B8(void) +static bool8 IsModeWindowAnimActive(void) { - return !sUnknown_0203A11C->unk2EC->animEnded; + return !sScreenControl->modeWindowSprite->animEnded; } -static void sub_811E5D4(void) +static void CreateScrollIndicatorSprites(void) { - u8 spriteId = CreateSprite(&sUnknown_08597E48, 96, 80, 0); + u8 spriteId = CreateSprite(&sSpriteTemplate_ScrollIndicator, 96, 80, 0); if (spriteId != MAX_SPRITES) - sUnknown_0203A11C->unk2F0 = &gSprites[spriteId]; + sScreenControl->scrollIndicatorUpSprite = &gSprites[spriteId]; - spriteId = CreateSprite(&sUnknown_08597E48, 96, 156, 0); + spriteId = CreateSprite(&sSpriteTemplate_ScrollIndicator, 96, 156, 0); if (spriteId != MAX_SPRITES) { - sUnknown_0203A11C->unk2F4 = &gSprites[spriteId]; - sUnknown_0203A11C->unk2F4->vFlip = 1; + sScreenControl->scrollIndicatorDownSprite = &gSprites[spriteId]; + sScreenControl->scrollIndicatorDownSprite->vFlip = TRUE; } - sub_811E6B0(); + HideScrollIndicators(); } -static void sub_811E64C(void) +static void UpdateScrollIndicatorsVisibility(void) { - sUnknown_0203A11C->unk2F0->invisible = !sub_811BBF8(); - sUnknown_0203A11C->unk2F4->invisible = !sub_811BC2C(); + sScreenControl->scrollIndicatorUpSprite->invisible = !CanScrollUp(); + sScreenControl->scrollIndicatorDownSprite->invisible = !CanScrollDown(); } -static void sub_811E6B0(void) +static void HideScrollIndicators(void) { - sUnknown_0203A11C->unk2F0->invisible = 1; - sUnknown_0203A11C->unk2F4->invisible = 1; + sScreenControl->scrollIndicatorUpSprite->invisible = TRUE; + sScreenControl->scrollIndicatorDownSprite->invisible = TRUE; } -static void sub_811E6E0(int arg0) +static void SetScrollIndicatorXPos(bool32 inWordSelect) { - if (!arg0) + if (!inWordSelect) { - sUnknown_0203A11C->unk2F0->pos1.x = 96; - sUnknown_0203A11C->unk2F4->pos1.x = 96; + // Keyboard (only relevant for group mode, can't scroll in alphabet mode) + sScreenControl->scrollIndicatorUpSprite->pos1.x = 96; + sScreenControl->scrollIndicatorDownSprite->pos1.x = 96; } else { - sUnknown_0203A11C->unk2F0->pos1.x = 120; - sUnknown_0203A11C->unk2F4->pos1.x = 120; + // Word select + sScreenControl->scrollIndicatorUpSprite->pos1.x = 120; + sScreenControl->scrollIndicatorDownSprite->pos1.x = 120; } } -static void sub_811E720(void) +// The Start/Select buttons are used as page scroll indicators +static void CreateStartSelectButtonSprites(void) { - u8 spriteId = CreateSprite(&sUnknown_08597E30, 220, 84, 1); + u8 spriteId = CreateSprite(&sSpriteTemplate_StartSelectButton, 220, 84, 1); if (spriteId != MAX_SPRITES) - sUnknown_0203A11C->unk2F8 = &gSprites[spriteId]; + sScreenControl->startButtonSprite = &gSprites[spriteId]; - spriteId = CreateSprite(&sUnknown_08597E30, 220, 156, 1); + spriteId = CreateSprite(&sSpriteTemplate_StartSelectButton, 220, 156, 1); if (spriteId != MAX_SPRITES) { - sUnknown_0203A11C->unk2FC = &gSprites[spriteId]; - StartSpriteAnim(sUnknown_0203A11C->unk2FC, 1); + sScreenControl->selectButtonSprite = &gSprites[spriteId]; + StartSpriteAnim(sScreenControl->selectButtonSprite, 1); } - sub_811E7F8(); + HideStartSelectButtons(); } -static void sub_811E794(void) +static void UpdateStartSelectButtonsVisibility(void) { - sUnknown_0203A11C->unk2F8->invisible = !sub_811BBF8(); - sUnknown_0203A11C->unk2FC->invisible = !sub_811BC2C(); + sScreenControl->startButtonSprite->invisible = !CanScrollUp(); + sScreenControl->selectButtonSprite->invisible = !CanScrollDown(); } -static void sub_811E7F8(void) +static void HideStartSelectButtons(void) { - sUnknown_0203A11C->unk2F8->invisible = 1; - sUnknown_0203A11C->unk2FC->invisible = 1; + sScreenControl->startButtonSprite->invisible = TRUE; + sScreenControl->selectButtonSprite->invisible = TRUE; } -static void sub_811E828(void) +static void TryAddInterviewObjectEvents(void) { int graphicsId; u8 spriteId; @@ -4731,9 +5004,10 @@ static void sub_811E828(void) return; } - if (GetEasyChatScreenFrameId() != 4) + if (GetEasyChatScreenFrameId() != FRAMEID_INTERVIEW_SHOW_PERSON) return; + // Add object for reporter/interviewing fan (facing left) spriteId = AddPseudoObjectEvent(graphicsId, SpriteCallbackDummy, 76, 40, 0); if (spriteId != MAX_SPRITES) { @@ -4741,6 +5015,7 @@ static void sub_811E828(void) StartSpriteAnim(&gSprites[spriteId], 2); } + // Add object for player (facing right) spriteId = AddPseudoObjectEvent( gSaveBlock2Ptr->playerGender == MALE ? OBJ_EVENT_GFX_RIVAL_BRENDAN_NORMAL : OBJ_EVENT_GFX_RIVAL_MAY_NORMAL, SpriteCallbackDummy, @@ -4760,33 +5035,33 @@ int GetFooterIndex(void) u8 frameId = GetEasyChatScreenFrameId(); switch (sPhraseFrameDimensions[frameId].footerId) { - case 1: - return 1; - case 2: - return 2; - case 0: - return 0; + case FOOTER_QUIZ: + return FOOTER_QUIZ; + case FOOTER_ANSWER: + return FOOTER_ANSWER; + case FOOTER_NORMAL: + return FOOTER_NORMAL; default: - return 3; + return NUM_FOOTER_TYPES; } } static int GetFooterOptionXOffset(int option) { int footerIndex = GetFooterIndex(); - if (footerIndex < 3) + if (footerIndex < NUM_FOOTER_TYPES) return sFooterOptionXOffsets[footerIndex][option] + 4; else return 0; } -static void sub_811E948(void) +static void AddMainScreenButtonWindow(void) { int i; u16 windowId; struct WindowTemplate template; - int footerId = GetFooterIndex(); - if (footerId == 3) + int footerIndex = GetFooterIndex(); + if (footerIndex == NUM_FOOTER_TYPES) return; template.bg = 3; @@ -4798,13 +5073,13 @@ static void sub_811E948(void) template.baseBlock = 0x34; windowId = AddWindow(&template); FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); - for (i = 0; i < 4; i++) + for (i = 0; i < (int)ARRAY_COUNT(sFooterTextOptions[0]); i++) { - const u8 *str = sFooterTextOptions[footerId][i]; + const u8 *str = sFooterTextOptions[footerIndex][i]; if (str) { - int x = sFooterOptionXOffsets[footerId][i]; - sub_811D028(windowId, 1, str, x, 1, 0, NULL); + int x = sFooterOptionXOffsets[footerIndex][i]; + PrintEasyChatText(windowId, 1, str, x, 1, 0, NULL); } } @@ -4821,7 +5096,7 @@ static bool8 IsEasyChatGroupUnlocked(u8 groupId) case EC_GROUP_MOVE_1: case EC_GROUP_MOVE_2: return FlagGet(FLAG_SYS_GAME_CLEAR); - case EC_GROUP_POKEMON_2: + case EC_GROUP_POKEMON_NATIONAL: return EasyChatIsNationalPokedexEnabled(); default: return TRUE; @@ -4839,14 +5114,14 @@ u16 EasyChat_GetNumWordsInGroup(u8 groupId) return 0; } -bool8 sub_811EAA4(u16 easyChatWord) +static bool8 IsEasyChatWordInvalid(u16 easyChatWord) { u16 i; u8 groupId; u32 index; u16 numWords; const u16 *list; - if (easyChatWord == 0xFFFF) + if (easyChatWord == EC_EMPTY_WORD) return FALSE; groupId = EC_GROUP(easyChatWord); @@ -4858,7 +5133,7 @@ bool8 sub_811EAA4(u16 easyChatWord) switch (groupId) { case EC_GROUP_POKEMON: - case EC_GROUP_POKEMON_2: + case EC_GROUP_POKEMON_NATIONAL: case EC_GROUP_MOVE_1: case EC_GROUP_MOVE_2: list = gEasyChatGroups[groupId].wordData.valueList; @@ -4868,15 +5143,15 @@ bool8 sub_811EAA4(u16 easyChatWord) return FALSE; } return TRUE; - default: - if (index >= numWords) - return TRUE; - else - return FALSE; } + + if (index >= numWords) + return TRUE; + else + return FALSE; } -bool8 ECWord_CheckIfOutsideOfValidRange(u16 easyChatWord) +bool8 IsBardWordInvalid(u16 easyChatWord) { int numWordsInGroup; u8 groupId = EC_GROUP(easyChatWord); @@ -4887,12 +5162,12 @@ bool8 ECWord_CheckIfOutsideOfValidRange(u16 easyChatWord) switch (groupId) { case EC_GROUP_POKEMON: - case EC_GROUP_POKEMON_2: - numWordsInGroup = gNumSpeciesNames; + case EC_GROUP_POKEMON_NATIONAL: + numWordsInGroup = gNumBardWords_Species; break; case EC_GROUP_MOVE_1: case EC_GROUP_MOVE_2: - numWordsInGroup = gUnknown_085FA1D4; + numWordsInGroup = gNumBardWords_Moves; break; default: numWordsInGroup = gEasyChatGroups[groupId].numWords; @@ -4905,12 +5180,12 @@ bool8 ECWord_CheckIfOutsideOfValidRange(u16 easyChatWord) return FALSE; } -const u8 *GetEasyChatWord(u8 groupId, u16 index) +static const u8 *GetEasyChatWord(u8 groupId, u16 index) { switch (groupId) { case EC_GROUP_POKEMON: - case EC_GROUP_POKEMON_2: + case EC_GROUP_POKEMON_NATIONAL: return gSpeciesNames[index]; case EC_GROUP_MOVE_1: case EC_GROUP_MOVE_2: @@ -4923,11 +5198,11 @@ const u8 *GetEasyChatWord(u8 groupId, u16 index) u8 *CopyEasyChatWord(u8 *dest, u16 easyChatWord) { u8 *resultStr; - if (sub_811EAA4(easyChatWord)) + if (IsEasyChatWordInvalid(easyChatWord)) { resultStr = StringCopy(dest, gText_ThreeQuestionMarks); } - else if (easyChatWord != 0xFFFF) + else if (easyChatWord != EC_EMPTY_WORD) { u16 index = EC_INDEX(easyChatWord); u8 groupId = EC_GROUP(easyChatWord); @@ -4952,7 +5227,7 @@ u8 *ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 columns, u16 rows for (j = 0; j < numColumns; j++) { dest = CopyEasyChatWord(dest, *src); - if (*src != 0xFFFF) + if (*src != EC_EMPTY_WORD) { *dest = CHAR_SPACE; dest++; @@ -4971,26 +5246,26 @@ u8 *ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 columns, u16 rows return dest; } -u8 *unref_sub_811EC98(u8 *dest, const u16 *src, u16 columns, u16 rows) +static u8 *UnusedConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 columns, u16 rows) { u16 i, j, k; u16 numColumns; - int var0, var1; + int notEmpty, lineNumber; numColumns = columns; - var1 = 0; + lineNumber = 0; columns--; for (i = 0; i < rows; i++) { - const u16 *var2 = src; - var0 = 0; + const u16 *str = src; + notEmpty = FALSE; for (j = 0; j < numColumns; j++) { - if (var2[j] != 0xFFFF) - var0 = 1; + if (str[j] != EC_EMPTY_WORD) + notEmpty = TRUE; } - if (!var0) + if (!notEmpty) { src += numColumns; continue; @@ -4999,7 +5274,7 @@ u8 *unref_sub_811EC98(u8 *dest, const u16 *src, u16 columns, u16 rows) for (k = 0; k < columns; k++) { dest = CopyEasyChatWord(dest, *src); - if (*src != 0xFFFF) + if (*src != EC_EMPTY_WORD) { *dest = CHAR_SPACE; dest++; @@ -5009,13 +5284,13 @@ u8 *unref_sub_811EC98(u8 *dest, const u16 *src, u16 columns, u16 rows) } dest = CopyEasyChatWord(dest, *(src++)); - if (var1 == 0) + if (lineNumber == 0) *dest = CHAR_NEWLINE; else *dest = CHAR_PROMPT_SCROLL; dest++; - var1++; + lineNumber++; } dest--; @@ -5025,10 +5300,10 @@ u8 *unref_sub_811EC98(u8 *dest, const u16 *src, u16 columns, u16 rows) static u16 GetEasyChatWordStringLength(u16 easyChatWord) { - if (easyChatWord == 0xFFFF) + if (easyChatWord == EC_EMPTY_WORD) return 0; - if (sub_811EAA4(easyChatWord)) + if (IsEasyChatWordInvalid(easyChatWord)) { return StringLength(gText_ThreeQuestionMarks); } @@ -5061,7 +5336,7 @@ u16 GetRandomEasyChatWordFromGroup(u16 groupId) { u16 index = Random() % gEasyChatGroups[groupId].numWords; if (groupId == EC_GROUP_POKEMON - || groupId == EC_GROUP_POKEMON_2 + || groupId == EC_GROUP_POKEMON_NATIONAL || groupId == EC_GROUP_MOVE_1 || groupId == EC_GROUP_MOVE_2) { @@ -5074,7 +5349,7 @@ u16 GetRandomEasyChatWordFromGroup(u16 groupId) u16 GetRandomEasyChatWordFromUnlockedGroup(u16 groupId) { if (!IsEasyChatGroupUnlocked(groupId)) - return 0xFFFF; + return EC_EMPTY_WORD; if (groupId == EC_GROUP_POKEMON) return GetRandomUnlockedEasyChatPokemon(); @@ -5169,7 +5444,7 @@ u16 GetNewHipsterPhraseToTeach(void) u16 additionalPhraseId; u8 numAdditionalPhrasesUnlocked = GetNumAdditionalPhrasesUnlocked(); if (numAdditionalPhrasesUnlocked == NUM_ADDITIONAL_PHRASES) - return 0xFFFF; + return EC_EMPTY_WORD; additionalPhraseId = Random() % (NUM_ADDITIONAL_PHRASES - numAdditionalPhrasesUnlocked); for (i = 0; i < NUM_ADDITIONAL_PHRASES; i++) @@ -5188,7 +5463,7 @@ u16 GetNewHipsterPhraseToTeach(void) } } - return 0xFFFF; + return EC_EMPTY_WORD; } // Unused @@ -5197,7 +5472,7 @@ u16 GetRandomTaughtHipsterPhrase(void) u16 i; u16 additionalPhraseId = GetNumAdditionalPhrasesUnlocked(); if (additionalPhraseId == 0) - return 0xFFFF; + return EC_EMPTY_WORD; additionalPhraseId = Random() % additionalPhraseId; for (i = 0; i < NUM_ADDITIONAL_PHRASES; i++) @@ -5211,7 +5486,7 @@ u16 GetRandomTaughtHipsterPhrase(void) } } - return 0xFFFF; + return EC_EMPTY_WORD; } static bool8 EasyChatIsNationalPokedexEnabled(void) @@ -5226,7 +5501,7 @@ static u16 GetRandomUnlockedEasyChatPokemon(void) const u16 *species; u16 index = EasyChat_GetNumWordsInGroup(EC_GROUP_POKEMON); if (index == 0) - return 0xFFFF; + return EC_EMPTY_WORD; index = Random() % index; species = gEasyChatGroups[EC_GROUP_POKEMON].wordData.valueList; @@ -5245,29 +5520,29 @@ static u16 GetRandomUnlockedEasyChatPokemon(void) species++; } - return 0xFFFF; + return EC_EMPTY_WORD; } void InitEasyChatPhrases(void) { u16 i, j; - for (i = 0; i < 4; i++) + for (i = 0; i < ARRAY_COUNT(sDefaultProfileWords); i++) gSaveBlock1Ptr->easyChatProfile[i] = sDefaultProfileWords[i]; - for (i = 0; i < 6; i++) + for (i = 0; i < EASY_CHAT_BATTLE_WORDS_COUNT; i++) gSaveBlock1Ptr->easyChatBattleStart[i] = sDefaultBattleStartWords[i]; - for (i = 0; i < 6; i++) - gSaveBlock1Ptr->easyChatBattleWon[i] = sUnknown_0859E640[i]; + for (i = 0; i < EASY_CHAT_BATTLE_WORDS_COUNT; i++) + gSaveBlock1Ptr->easyChatBattleWon[i] = sDefaultBattleWonWords[i]; - for (i = 0; i < 6; i++) - gSaveBlock1Ptr->easyChatBattleLost[i] = sUnknown_0859E64C[i]; + for (i = 0; i < EASY_CHAT_BATTLE_WORDS_COUNT; i++) + gSaveBlock1Ptr->easyChatBattleLost[i] = sDefaultBattleLostWords[i]; for (i = 0; i < MAIL_COUNT; i++) { for (j = 0; j < MAIL_WORDS_COUNT; j++) - gSaveBlock1Ptr->mail[i].words[j] = 0xFFFF; + gSaveBlock1Ptr->mail[i].words[j] = EC_EMPTY_WORD; } #ifndef UBFIX @@ -5283,65 +5558,67 @@ void InitEasyChatPhrases(void) #endif } -static bool8 sub_811F28C(void) +static bool8 InitEasyChatScreenWordData(void) { - sUnknown_0203A120 = Alloc(sizeof(*sUnknown_0203A120)); - if (!sUnknown_0203A120) + sWordData = Alloc(sizeof(*sWordData)); + if (!sWordData) return FALSE; - sub_811F2D4(); - sub_811F46C(); + SetUnlockedEasyChatGroups(); + SetUnlockedWordsByAlphabet(); return TRUE; } -static void sub_811F2B8(void) +static void FreeEasyChatScreenWordData(void) { - if (sUnknown_0203A120) - FREE_AND_SET_NULL(sUnknown_0203A120); + if (sWordData) + FREE_AND_SET_NULL(sWordData); } -static void sub_811F2D4(void) +static void SetUnlockedEasyChatGroups(void) { int i; - sUnknown_0203A120->unk0 = 0; + sWordData->numUnlockedGroups = 0; if (GetNationalPokedexCount(FLAG_GET_SEEN)) - sUnknown_0203A120->unk2[sUnknown_0203A120->unk0++] = EC_GROUP_POKEMON; + sWordData->unlockedGroupIds[sWordData->numUnlockedGroups++] = EC_GROUP_POKEMON; + // These groups are unlocked automatically for (i = EC_GROUP_TRAINER; i <= EC_GROUP_ADJECTIVES; i++) - sUnknown_0203A120->unk2[sUnknown_0203A120->unk0++] = i; + sWordData->unlockedGroupIds[sWordData->numUnlockedGroups++] = i; if (FlagGet(FLAG_SYS_GAME_CLEAR)) { - sUnknown_0203A120->unk2[sUnknown_0203A120->unk0++] = EC_GROUP_EVENTS; - sUnknown_0203A120->unk2[sUnknown_0203A120->unk0++] = EC_GROUP_MOVE_1; - sUnknown_0203A120->unk2[sUnknown_0203A120->unk0++] = EC_GROUP_MOVE_2; + sWordData->unlockedGroupIds[sWordData->numUnlockedGroups++] = EC_GROUP_EVENTS; + sWordData->unlockedGroupIds[sWordData->numUnlockedGroups++] = EC_GROUP_MOVE_1; + sWordData->unlockedGroupIds[sWordData->numUnlockedGroups++] = EC_GROUP_MOVE_2; } if (FlagGet(FLAG_SYS_HIPSTER_MEET)) - sUnknown_0203A120->unk2[sUnknown_0203A120->unk0++] = EC_GROUP_TRENDY_SAYING; + sWordData->unlockedGroupIds[sWordData->numUnlockedGroups++] = EC_GROUP_TRENDY_SAYING; if (IsNationalPokedexEnabled()) - sUnknown_0203A120->unk2[sUnknown_0203A120->unk0++] = EC_GROUP_POKEMON_2; + sWordData->unlockedGroupIds[sWordData->numUnlockedGroups++] = EC_GROUP_POKEMON_NATIONAL; } -static u8 sub_811F3AC(void) +static u8 GetNumUnlockedEasyChatGroups(void) { - return sUnknown_0203A120->unk0; + return sWordData->numUnlockedGroups; } -static u8 sub_811F3B8(u8 index) +static u8 GetUnlockedEasyChatGroupId(u8 index) { - if (index >= sUnknown_0203A120->unk0) + if (index >= sWordData->numUnlockedGroups) return EC_NUM_GROUPS; else - return sUnknown_0203A120->unk2[index]; + return sWordData->unlockedGroupIds[index]; } -u8 *unref_sub_811F3E0(u8 *dest, u8 groupId, u16 totalChars) +// Unused +static u8 *BufferEasyChatWordGroupName(u8 *dest, u8 groupId, u16 totalChars) { u16 i; - u8 *str = StringCopy(dest, gEasyChatGroupNamePointers[groupId]); + u8 *str = StringCopy(dest, sEasyChatGroupNamePointers[groupId]); for (i = str - dest; i < totalChars; i++) { *str = CHAR_SPACE; @@ -5354,7 +5631,7 @@ u8 *unref_sub_811F3E0(u8 *dest, u8 groupId, u16 totalChars) static const u8 *GetEasyChatWordGroupName(u8 groupId) { - return gEasyChatGroupNamePointers[groupId]; + return sEasyChatGroupNamePointers[groupId]; } static u8 *CopyEasyChatWordPadded(u8 *dest, u16 easyChatWord, u16 totalChars) @@ -5371,7 +5648,7 @@ static u8 *CopyEasyChatWordPadded(u8 *dest, u16 easyChatWord, u16 totalChars) return str; } -static void sub_811F46C(void) +static void SetUnlockedWordsByAlphabet(void) { int i, j, k; int numWords; @@ -5379,15 +5656,15 @@ static void sub_811F46C(void) u16 numToProcess; int index; - for (i = 0; i < 27; i++) + for (i = 0; i < EC_NUM_ALPHABET_GROUPS; i++) { numWords = gEasyChatWordsByLetterPointers[i].numWords; words = gEasyChatWordsByLetterPointers[i].words; - sUnknown_0203A120->unk2E[i] = 0; + sWordData->numUnlockedAlphabetWords[i] = 0; index = 0; for (j = 0; j < numWords; j++) { - if (*words == 0xFFFF) + if (*words == EC_EMPTY_WORD) { words++; numToProcess = *words; @@ -5401,10 +5678,10 @@ static void sub_811F46C(void) for (k = 0; k < numToProcess; k++) { - if (sub_811F860(words[k])) + if (IsEasyChatWordUnlocked(words[k])) { - sUnknown_0203A120->unk64[i][index++] = words[k]; - sUnknown_0203A120->unk2E[i]++; + sWordData->unlockedAlphabetWords[i][index++] = words[k]; + sWordData->numUnlockedAlphabetWords[i]++; break; } } @@ -5414,28 +5691,28 @@ static void sub_811F46C(void) } } -static void sub_811F548(int arg0, u16 groupId) +static void SetSelectedWordGroup(bool32 inAlphabetMode, u16 groupId) { - if (!arg0) - sUnknown_0203A120->unk3BA0 = sub_811F5C4(groupId); + if (!inAlphabetMode) + sWordData->numSelectedGroupWords = SetSelectedWordGroup_GroupMode(groupId); else - sUnknown_0203A120->unk3BA0 = sub_811F6B8(groupId); + sWordData->numSelectedGroupWords = SetSelectedWordGroup_AlphabetMode(groupId); } -static u16 sub_811F578(u16 arg0) +static u16 GetWordFromSelectedGroup(u16 index) { - if (arg0 >= sUnknown_0203A120->unk3BA0) - return 0xFFFF; + if (index >= sWordData->numSelectedGroupWords) + return EC_EMPTY_WORD; else - return sUnknown_0203A120->unk3984[arg0]; + return sWordData->selectedGroupWords[index]; } -static u16 sub_811F5B0(void) +static u16 GetNumWordsInSelectedGroup(void) { - return sUnknown_0203A120->unk3BA0; + return sWordData->numSelectedGroupWords; } -static u16 sub_811F5C4(u16 groupId) +static u16 SetSelectedWordGroup_GroupMode(u16 groupId) { u32 i; int totalWords; @@ -5443,14 +5720,14 @@ static u16 sub_811F5C4(u16 groupId) const struct EasyChatWordInfo *wordInfo; u16 numWords = gEasyChatGroups[groupId].numWords; - if (groupId == EC_GROUP_POKEMON || groupId == EC_GROUP_POKEMON_2 + if (groupId == EC_GROUP_POKEMON || groupId == EC_GROUP_POKEMON_NATIONAL || groupId == EC_GROUP_MOVE_1 || groupId == EC_GROUP_MOVE_2) { list = gEasyChatGroups[groupId].wordData.valueList; for (i = 0, totalWords = 0; i < numWords; i++) { - if (sub_811F764(list[i], groupId)) - sUnknown_0203A120->unk3984[totalWords++] = EC_WORD(groupId, list[i]); + if (IsEasyChatIndexAndGroupUnlocked(list[i], groupId)) + sWordData->selectedGroupWords[totalWords++] = EC_WORD(groupId, list[i]); } return totalWords; @@ -5461,45 +5738,45 @@ static u16 sub_811F5C4(u16 groupId) for (i = 0, totalWords = 0; i < numWords; i++) { u16 alphabeticalOrder = wordInfo[i].alphabeticalOrder; - if (sub_811F764(alphabeticalOrder, groupId)) - sUnknown_0203A120->unk3984[totalWords++] = EC_WORD(groupId, alphabeticalOrder); + if (IsEasyChatIndexAndGroupUnlocked(alphabeticalOrder, groupId)) + sWordData->selectedGroupWords[totalWords++] = EC_WORD(groupId, alphabeticalOrder); } return totalWords; } } -static u16 sub_811F6B8(u16 alphabeticalGroup) +static u16 SetSelectedWordGroup_AlphabetMode(u16 groupId) { u16 i; u16 totalWords; - for (i = 0, totalWords = 0; i < sUnknown_0203A120->unk2E[alphabeticalGroup]; i++) - sUnknown_0203A120->unk3984[totalWords++] = sUnknown_0203A120->unk64[alphabeticalGroup][i]; + for (i = 0, totalWords = 0; i < sWordData->numUnlockedAlphabetWords[groupId]; i++) + sWordData->selectedGroupWords[totalWords++] = sWordData->unlockedAlphabetWords[groupId][i]; return totalWords; } -static bool8 sub_811F72C(u8 arg0) +static bool8 IsEasyChatGroupUnlocked2(u8 groupId) { int i; - for (i = 0; i < sUnknown_0203A120->unk0; i++) + for (i = 0; i < sWordData->numUnlockedGroups; i++) { - if (sUnknown_0203A120->unk2[i] == arg0) + if (sWordData->unlockedGroupIds[i] == groupId) return TRUE; } return FALSE; } -static bool8 sub_811F764(u16 wordIndex, u8 groupId) +static bool8 IsEasyChatIndexAndGroupUnlocked(u16 wordIndex, u8 groupId) { switch (groupId) { case EC_GROUP_POKEMON: return GetSetPokedexFlag(SpeciesToNationalPokedexNum(wordIndex), FLAG_GET_SEEN); - case EC_GROUP_POKEMON_2: - if (sub_811F838(wordIndex)) + case EC_GROUP_POKEMON_NATIONAL: + if (IsRestrictedWordSpecies(wordIndex)) GetSetPokedexFlag(SpeciesToNationalPokedexNum(wordIndex), FLAG_GET_SEEN); return TRUE; case EC_GROUP_MOVE_1: @@ -5512,50 +5789,52 @@ static bool8 sub_811F764(u16 wordIndex, u8 groupId) } } -static int sub_811F838(u16 species) +// Pokémon words in EC_GROUP_POKEMON_NATIONAL are always allowed (assuming the group is unlocked) +// unless they are in this group. If they are in this group (just Deoxys), they must also have been seen. +static int IsRestrictedWordSpecies(u16 species) { u32 i; - for (i = 0; i < ARRAY_COUNT(sUnknown_0859E658); i++) + for (i = 0; i < ARRAY_COUNT(sRestrictedWordSpecies); i++) { - if (sUnknown_0859E658[i] == species) + if (sRestrictedWordSpecies[i] == species) return TRUE; } return FALSE; } -static u8 sub_811F860(u16 easyChatWord) +static u8 IsEasyChatWordUnlocked(u16 easyChatWord) { u8 groupId = EC_GROUP(easyChatWord); u32 index = EC_INDEX(easyChatWord); - if (!sub_811F72C(groupId)) + if (!IsEasyChatGroupUnlocked2(groupId)) return FALSE; else - return sub_811F764(index, groupId); + return IsEasyChatIndexAndGroupUnlocked(index, groupId); } void InitializeEasyChatWordArray(u16 *words, u16 length) { u16 i; - for (i = length - 1; i != 0xFFFF; i--) - *(words++) = 0xFFFF; + for (i = length - 1; i != EC_EMPTY_WORD; i--) + *(words++) = EC_EMPTY_WORD; } -void sub_811F8BC(void) +void InitQuestionnaireWords(void) { int i; - u16 *words = sub_801B058(); - for (i = 0; i < 4; i++) - words[i] = 0xFFFF; + u16 *words = GetQuestionnaireWordsPtr(); + for (i = 0; i < NUM_QUESTIONNAIRE_WORDS; i++) + words[i] = EC_EMPTY_WORD; } -bool32 sub_811F8D8(int easyChatWord) +bool32 IsEasyChatAnswerUnlocked(int easyChatWord) { int groupId = EC_GROUP(easyChatWord); - int mask = 0x7F; + int mask = EC_MASK_GROUP; int index = EC_INDEX(easyChatWord); if (!IsEasyChatGroupUnlocked(groupId & mask)) return FALSE; else - return sub_811F764(index, groupId & mask); + return IsEasyChatIndexAndGroupUnlocked(index, groupId & mask); } diff --git a/src/egg_hatch.c b/src/egg_hatch.c index c7510420f..14bbb82af 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -297,7 +297,7 @@ static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp) { u16 species; u32 personality, pokerus; - u8 i, friendship, language, gameMet, markings, obedience; + u8 i, friendship, language, gameMet, markings, isEventLegal; u16 moves[MAX_MON_MOVES]; u32 ivs[NUM_STATS]; @@ -320,7 +320,7 @@ static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp) gameMet = GetMonData(egg, MON_DATA_MET_GAME); markings = GetMonData(egg, MON_DATA_MARKINGS); pokerus = GetMonData(egg, MON_DATA_POKERUS); - obedience = GetMonData(egg, MON_DATA_OBEDIENCE); + isEventLegal = GetMonData(egg, MON_DATA_EVENT_LEGAL); CreateMon(temp, species, EGG_HATCH_LEVEL, USE_RANDOM_IVS, TRUE, personality, OT_ID_PLAYER_ID, 0); @@ -342,7 +342,7 @@ static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp) friendship = 120; SetMonData(temp, MON_DATA_FRIENDSHIP, &friendship); SetMonData(temp, MON_DATA_POKERUS, &pokerus); - SetMonData(temp, MON_DATA_OBEDIENCE, &obedience); + SetMonData(temp, MON_DATA_EVENT_LEGAL, &isEventLegal); *egg = *temp; } @@ -597,7 +597,7 @@ static void CB2_EggHatch_1(void) switch (sEggHatchData->CB2_state) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); sEggHatchData->eggSpriteID = CreateSprite(&sSpriteTemplate_EggHatch, 120, 75, 5); ShowBg(0); ShowBg(1); @@ -680,7 +680,7 @@ static void CB2_EggHatch_1(void) } break; case 11: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); sEggHatchData->CB2_state++; break; case 12: @@ -790,7 +790,7 @@ static void SpriteCB_Egg_4(struct Sprite* sprite) { s16 i; if (sprite->data[0] == 0) - BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 0x10, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 0x10, RGB_WHITEALPHA); if (sprite->data[0] < 4u) { for (i = 0; i <= 3; i++) @@ -814,7 +814,7 @@ static void SpriteCB_Egg_5(struct Sprite* sprite) StartSpriteAffineAnim(&gSprites[sEggHatchData->pokeSpriteID], 1); } if (sprite->data[0] == 8) - BeginNormalPaletteFade(0xFFFFFFFF, -1, 0x10, 0, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL, -1, 0x10, 0, RGB_WHITEALPHA); if (sprite->data[0] <= 9) gSprites[sEggHatchData->pokeSpriteID].pos1.y -= 1; if (sprite->data[0] > 40) diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index fe3da8857..94ead2ff3 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -134,10 +134,10 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .name = __("ハルヒト$$$$ "), .facilityClass = FACILITY_CLASS_CAMPER, .unused = 0x1, - .speechBefore = { EC_MOVE2(BOUNCE), EC_WORD_AS_MUCH_AS, 0xFFFF, EC_WORD_THEY_RE, EC_WORD_STRONG, EC_WORD_EXCL }, - .speechWin = { EC_MOVE(FLY), EC_WORD_AS_MUCH_AS, 0xFFFF, EC_WORD_THEY_RE, EC_WORD_HAPPY, EC_WORD_EXCL }, - .speechLose = { EC_MOVE2(MINIMIZE), EC_WORD_AS_MUCH_AS, 0xFFFF, EC_WORD_THEY_RE, EC_WORD_SAD, EC_WORD_EXCL }, - .speechAfter = { EC_MOVE(BITE), EC_WORD_AS_MUCH_AS, 0xFFFF, EC_WORD_THEY_RE, EC_WORD_ANGRY, EC_WORD_EXCL }, + .speechBefore = { EC_MOVE2(BOUNCE), EC_WORD_AS_MUCH_AS, EC_EMPTY_WORD, EC_WORD_THEY_RE, EC_WORD_STRONG, EC_WORD_EXCL }, + .speechWin = { EC_MOVE(FLY), EC_WORD_AS_MUCH_AS, EC_EMPTY_WORD, EC_WORD_THEY_RE, EC_WORD_HAPPY, EC_WORD_EXCL }, + .speechLose = { EC_MOVE2(MINIMIZE), EC_WORD_AS_MUCH_AS, EC_EMPTY_WORD, EC_WORD_THEY_RE, EC_WORD_SAD, EC_WORD_EXCL }, + .speechAfter = { EC_MOVE(BITE), EC_WORD_AS_MUCH_AS, EC_EMPTY_WORD, EC_WORD_THEY_RE, EC_WORD_ANGRY, EC_WORD_EXCL }, .mons = { [0] = NULL_BATTLE_TOWER_POKEMON, [1] = NULL_BATTLE_TOWER_POKEMON, @@ -223,7 +223,7 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .speechBefore = { EC_WORD_SHINE, EC_WORD_POKEMON, EC_WORD_RELEASE, EC_WORD_WAS, EC_MOVE2(FRUSTRATION), EC_WORD_WITHOUT }, .speechWin = { EC_WORD_SHINE, EC_WORD_POKEMON, EC_WORD_TO_HER, EC_MOVE2(PRESENT), EC_WORD_KNOWS, EC_WORD_WITHOUT }, .speechLose = { EC_WORD_THAT, EC_WORD_ABOVE, EC_WORD_LOST, EC_WORD_STORES, EC_WORD_JOKING, EC_WORD_ELLIPSIS_ELLIPSIS_ELLIPSIS }, - .speechAfter = { EC_WORD_ENTERTAINING, EC_WORD_NONE, EC_WORD_HEY_QUES, EC_WORD_ALMOST, EC_WORD_EXCL, 0xFFFF }, + .speechAfter = { EC_WORD_ENTERTAINING, EC_WORD_NONE, EC_WORD_HEY_QUES, EC_WORD_ALMOST, EC_WORD_EXCL, EC_EMPTY_WORD }, .mons = { [0] = NULL_BATTLE_TOWER_POKEMON, [1] = NULL_BATTLE_TOWER_POKEMON, @@ -307,7 +307,7 @@ static const struct TrainerHillTrainer sTrainerHillTrainerTemplates_JP[] = { .facilityClass = FACILITY_CLASS_GENTLEMAN, .unused = 0x1, .speechBefore = { EC_WORD_SHE_WAS, EC_WORD_NO_1, EC_WORD_STRONG, EC_WORD_UNCLE, EC_WORD_THERE, EC_WORD_EXCL }, - .speechWin = { EC_WORD_HAHAHA, EC_WORD_TEACHER, EC_WORD_BECOMES, EC_WORD_GIVE, EC_WORD_IS_IT_QUES, 0xFFFF }, + .speechWin = { EC_WORD_HAHAHA, EC_WORD_TEACHER, EC_WORD_BECOMES, EC_WORD_GIVE, EC_WORD_IS_IT_QUES, EC_EMPTY_WORD }, .speechLose = { EC_WORD_OUTSIDE, EC_WORD_UNCLE, EC_WORD_SURPRISE, EC_WORD_THESE, EC_WORD_HEY_QUES, EC_WORD_ELLIPSIS_EXCL }, .speechAfter = { EC_WORD_HE_S, EC_WORD_NO_1, EC_WORD_STRONG, EC_WORD_CHILDREN, EC_WORD_CAN_T, EC_WORD_EXCL_EXCL }, .mons = { diff --git a/src/event_object_lock.c b/src/event_object_lock.c index 67652a99b..dec2d7906 100644 --- a/src/event_object_lock.c +++ b/src/event_object_lock.c @@ -16,18 +16,19 @@ bool8 IsPlayerStandingStill(void) return TRUE; } -static void sub_80983A4(u8 taskId) +// Freeze player once their movement is finished +static void Task_FreezePlayer(u8 taskId) { if (IsPlayerStandingStill()) { - sub_808B864(); + PlayerFreeze(); DestroyTask(taskId); } } -bool8 sub_80983C4(void) +bool8 IsFreezePlayerFinished(void) { - if (FuncIsActiveTask(sub_80983A4)) + if (FuncIsActiveTask(Task_FreezePlayer)) { return FALSE; } @@ -42,30 +43,35 @@ bool8 sub_80983C4(void) void ScriptFreezeObjectEvents(void) { FreezeObjectEvents(); - CreateTask(sub_80983A4, 80); + CreateTask(Task_FreezePlayer, 80); } -static void sub_8098400(u8 taskId) +#define tPlayerFrozen data[0] +#define tObjectFrozen data[1] +#define tObjectId data[2] + +// Freeze selected object and player once their movement is finished +static void Task_FreezeSelectedObjectAndPlayer(u8 taskId) { struct Task *task = &gTasks[taskId]; - if (!task->data[0] && IsPlayerStandingStill() == TRUE) + if (!task->tPlayerFrozen && IsPlayerStandingStill() == TRUE) { - sub_808B864(); - task->data[0] = 1; + PlayerFreeze(); + task->tPlayerFrozen = TRUE; } - if (!task->data[1] && !gObjectEvents[gSelectedObjectEvent].singleMovementActive) + if (!task->tObjectFrozen && !gObjectEvents[gSelectedObjectEvent].singleMovementActive) { FreezeObjectEvent(&gObjectEvents[gSelectedObjectEvent]); - task->data[1] = 1; + task->tObjectFrozen = TRUE; } - if (task->data[0] && task->data[1]) + if (task->tPlayerFrozen && task->tObjectFrozen) DestroyTask(taskId); } -bool8 sub_809847C(void) +bool8 IsFreezeSelectedObjectAndPlayerFinished(void) { - if (FuncIsActiveTask(sub_8098400)) + if (FuncIsActiveTask(Task_FreezeSelectedObjectAndPlayer)) { return FALSE; } @@ -80,11 +86,11 @@ void LockSelectedObjectEvent(void) { u8 taskId; FreezeObjectEventsExceptOne(gSelectedObjectEvent); - taskId = CreateTask(sub_8098400, 80); + taskId = CreateTask(Task_FreezeSelectedObjectAndPlayer, 80); if (!gObjectEvents[gSelectedObjectEvent].singleMovementActive) { FreezeObjectEvent(&gObjectEvents[gSelectedObjectEvent]); - gTasks[taskId].data[1] = 1; + gTasks[taskId].tObjectFrozen = TRUE; } } @@ -118,64 +124,71 @@ void Script_ClearHeldMovement(void) ObjectEventClearHeldMovementIfActive(&gObjectEvents[gSelectedObjectEvent]); } -static void sub_80985BC(u8 taskId) +// Freeze designated object and player once their movement is finished +static void Task_FreezeObjectAndPlayer(u8 taskId) { struct Task *task = &gTasks[taskId]; - u8 objectEventId = task->data[2]; + u8 objectEventId = task->tObjectId; - if (!task->data[0] && IsPlayerStandingStill() == TRUE) + if (!task->tPlayerFrozen && IsPlayerStandingStill() == TRUE) { - sub_808B864(); - task->data[0] = 1; + PlayerFreeze(); + task->tPlayerFrozen = TRUE; } - if (!task->data[1] && !gObjectEvents[objectEventId].singleMovementActive) + if (!task->tObjectFrozen && !gObjectEvents[objectEventId].singleMovementActive) { FreezeObjectEvent(&gObjectEvents[objectEventId]); - task->data[1] = 1; + task->tObjectFrozen = TRUE; } - if (task->data[0] && task->data[1]) + if (task->tPlayerFrozen && task->tObjectFrozen) DestroyTask(taskId); } -void sub_8098630(void) +void FreezeForApproachingTrainers(void) { u8 trainerObjectId1, trainerObjectId2, taskId; trainerObjectId1 = GetChosenApproachingTrainerObjectEventId(0); - if(gNoOfApproachingTrainers == 2) + + if (gNoOfApproachingTrainers == 2) { + // Get second trainer, freeze all other objects trainerObjectId2 = GetChosenApproachingTrainerObjectEventId(1); - sub_8098074(trainerObjectId1, trainerObjectId2); - taskId = CreateTask(sub_80985BC, 80); - gTasks[taskId].data[2] = trainerObjectId1; - if(!gObjectEvents[trainerObjectId1].singleMovementActive) + FreezeObjectEventsExceptTwo(trainerObjectId1, trainerObjectId2); + + // Start task to freeze trainer 1 (and player) after movement + taskId = CreateTask(Task_FreezeObjectAndPlayer, 80); + gTasks[taskId].tObjectId = trainerObjectId1; + if (!gObjectEvents[trainerObjectId1].singleMovementActive) { FreezeObjectEvent(&gObjectEvents[trainerObjectId1]); - gTasks[taskId].data[1] = 1; + gTasks[taskId].tObjectFrozen = TRUE; } - taskId = CreateTask(sub_80985BC, 81); - gTasks[taskId].data[2] = trainerObjectId2; - if(!gObjectEvents[trainerObjectId2].singleMovementActive) + + // Start task to freeze trainer 2 after movement + taskId = CreateTask(Task_FreezeObjectAndPlayer, 81); + gTasks[taskId].tObjectId = trainerObjectId2; + if (!gObjectEvents[trainerObjectId2].singleMovementActive) { FreezeObjectEvent(&gObjectEvents[trainerObjectId2]); - gTasks[taskId].data[1] = 1; + gTasks[taskId].tObjectFrozen = TRUE; } } else { FreezeObjectEventsExceptOne(trainerObjectId1); - taskId = CreateTask(sub_80985BC, 80); - gTasks[taskId].data[2] = trainerObjectId1; - if(!gObjectEvents[trainerObjectId1].singleMovementActive) + taskId = CreateTask(Task_FreezeObjectAndPlayer, 80); + gTasks[taskId].tObjectId = trainerObjectId1; + if (!gObjectEvents[trainerObjectId1].singleMovementActive) { FreezeObjectEvent(&gObjectEvents[trainerObjectId1]); - gTasks[taskId].data[1] = 1; + gTasks[taskId].tObjectFrozen = TRUE; } } } -bool8 sub_8098734(void) +bool8 IsFreezeObjectAndPlayerFinished(void) { - if (FuncIsActiveTask(sub_80985BC)) + if (FuncIsActiveTask(Task_FreezeObjectAndPlayer)) { return FALSE; } @@ -185,3 +198,7 @@ bool8 sub_8098734(void) return TRUE; } } + +#undef tPlayerFrozen +#undef tObjectFrozen +#undef tObjectId diff --git a/src/event_object_movement.c b/src/event_object_movement.c index d9c06eb10..1a7d08db2 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -101,7 +101,7 @@ static void DoGroundEffects_OnFinishStep(struct ObjectEvent*, struct Sprite*); static void UpdateObjectEventSpritePosition(struct Sprite*); static void ApplyLevitateMovement(u8); static bool8 MovementType_Disguise_Callback(struct ObjectEvent *, struct Sprite *); -static bool8 MovementType_Hidden_Callback(struct ObjectEvent *, struct Sprite *); +static bool8 MovementType_Buried_Callback(struct ObjectEvent *, struct Sprite *); static void CreateReflectionEffectSprites(void); static u8 GetObjectEventIdByLocalId(u8); static u8 GetObjectEventIdByLocalIdAndMapInternal(u8, u8, u8); @@ -212,7 +212,7 @@ static void (*const sMovementTypeCallbacks[])(struct Sprite *) = [MOVEMENT_TYPE_COPY_PLAYER_OPPOSITE_IN_GRASS] = MovementType_CopyPlayerInGrass, [MOVEMENT_TYPE_COPY_PLAYER_COUNTERCLOCKWISE_IN_GRASS] = MovementType_CopyPlayerInGrass, [MOVEMENT_TYPE_COPY_PLAYER_CLOCKWISE_IN_GRASS] = MovementType_CopyPlayerInGrass, - [MOVEMENT_TYPE_HIDDEN] = MovementType_Hidden, + [MOVEMENT_TYPE_BURIED] = MovementType_Buried, [MOVEMENT_TYPE_WALK_IN_PLACE_DOWN] = MovementType_WalkInPlace, [MOVEMENT_TYPE_WALK_IN_PLACE_UP] = MovementType_WalkInPlace, [MOVEMENT_TYPE_WALK_IN_PLACE_LEFT] = MovementType_WalkInPlace, @@ -296,7 +296,7 @@ const u8 gRangedMovementTypes[] = { [MOVEMENT_TYPE_COPY_PLAYER_OPPOSITE_IN_GRASS] = 1, [MOVEMENT_TYPE_COPY_PLAYER_COUNTERCLOCKWISE_IN_GRASS] = 1, [MOVEMENT_TYPE_COPY_PLAYER_CLOCKWISE_IN_GRASS] = 1, - [MOVEMENT_TYPE_HIDDEN] = 0, + [MOVEMENT_TYPE_BURIED] = 0, [MOVEMENT_TYPE_WALK_IN_PLACE_DOWN] = 0, [MOVEMENT_TYPE_WALK_IN_PLACE_UP] = 0, [MOVEMENT_TYPE_WALK_IN_PLACE_LEFT] = 0, @@ -380,7 +380,7 @@ const u8 gInitialMovementTypeFacingDirections[] = { [MOVEMENT_TYPE_COPY_PLAYER_OPPOSITE_IN_GRASS] = DIR_SOUTH, [MOVEMENT_TYPE_COPY_PLAYER_COUNTERCLOCKWISE_IN_GRASS] = DIR_WEST, [MOVEMENT_TYPE_COPY_PLAYER_CLOCKWISE_IN_GRASS] = DIR_EAST, - [MOVEMENT_TYPE_HIDDEN] = DIR_SOUTH, + [MOVEMENT_TYPE_BURIED] = DIR_SOUTH, [MOVEMENT_TYPE_WALK_IN_PLACE_DOWN] = DIR_SOUTH, [MOVEMENT_TYPE_WALK_IN_PLACE_UP] = DIR_NORTH, [MOVEMENT_TYPE_WALK_IN_PLACE_LEFT] = DIR_WEST, @@ -1834,7 +1834,7 @@ void PlayerObjectTurn(struct PlayerAvatar *playerAvatar, u8 direction) ObjectEventTurn(&gObjectEvents[playerAvatar->objectEventId], direction); } -static void get_berry_tree_graphics(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static void SetBerryTreeGraphics(struct ObjectEvent *objectEvent, struct Sprite *sprite) { u8 berryStage; u8 berryId; @@ -1842,7 +1842,7 @@ static void get_berry_tree_graphics(struct ObjectEvent *objectEvent, struct Spri objectEvent->invisible = TRUE; sprite->invisible = TRUE; berryStage = GetStageByBerryTreeId(objectEvent->trainerRange_berryTreeId); - if (berryStage != 0) + if (berryStage != BERRY_STAGE_NO_BERRY) { objectEvent->invisible = FALSE; sprite->invisible = FALSE; @@ -1888,13 +1888,13 @@ static void SetObjectEventDynamicGraphicsId(struct ObjectEvent *objectEvent) } } -void npc_by_local_id_and_map_set_field_1_bit_x20(u8 localId, u8 mapNum, u8 mapGroup, u8 state) +void SetObjectInvisibility(u8 localId, u8 mapNum, u8 mapGroup, bool8 invisible) { u8 objectEventId; if (!TryGetObjectEventIdByLocalIdAndMap(localId, mapNum, mapGroup, &objectEventId)) { - gObjectEvents[objectEventId].invisible = state; + gObjectEvents[objectEventId].invisible = invisible; } } @@ -1918,7 +1918,7 @@ void sub_808E75C(s16 x, s16 y) } } -void sub_808E78C(u8 localId, u8 mapNum, u8 mapGroup, u8 subpriority) +void SetObjectPriority(u8 localId, u8 mapNum, u8 mapGroup, u8 subpriority) { u8 objectEventId; struct ObjectEvent *objectEvent; @@ -1933,7 +1933,7 @@ void sub_808E78C(u8 localId, u8 mapNum, u8 mapGroup, u8 subpriority) } } -void sub_808E7E4(u8 localId, u8 mapNum, u8 mapGroup) +void ResetObjectPriority(u8 localId, u8 mapNum, u8 mapGroup) { u8 objectEventId; struct ObjectEvent *objectEvent; @@ -2595,7 +2595,7 @@ bool8 MovementType_WanderAround_Step4(struct ObjectEvent *objectEvent, struct Sp bool8 MovementType_WanderAround_Step5(struct ObjectEvent *objectEvent, struct Sprite *sprite) { ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkNormalMovementAction(objectEvent->movementDirection)); - objectEvent->singleMovementActive = 1; + objectEvent->singleMovementActive = TRUE; sprite->data[1] = 6; return TRUE; } @@ -2604,7 +2604,7 @@ bool8 MovementType_WanderAround_Step6(struct ObjectEvent *objectEvent, struct Sp { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 1; } return FALSE; @@ -2880,7 +2880,7 @@ bool8 MovementType_LookAround_Step2(struct ObjectEvent *objectEvent, struct Spri if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { SetMovementDelay(sprite, gMovementDelaysMedium[Random() & 3]); - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 3; } return FALSE; @@ -2964,7 +2964,7 @@ bool8 MovementType_WanderUpAndDown_Step4(struct ObjectEvent *objectEvent, struct bool8 MovementType_WanderUpAndDown_Step5(struct ObjectEvent *objectEvent, struct Sprite *sprite) { ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkNormalMovementAction(objectEvent->movementDirection)); - objectEvent->singleMovementActive = 1; + objectEvent->singleMovementActive = TRUE; sprite->data[1] = 6; return TRUE; } @@ -2973,7 +2973,7 @@ bool8 MovementType_WanderUpAndDown_Step6(struct ObjectEvent *objectEvent, struct { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 1; } return FALSE; @@ -3033,7 +3033,7 @@ bool8 MovementType_WanderLeftAndRight_Step4(struct ObjectEvent *objectEvent, str bool8 MovementType_WanderLeftAndRight_Step5(struct ObjectEvent *objectEvent, struct Sprite *sprite) { ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkNormalMovementAction(objectEvent->movementDirection)); - objectEvent->singleMovementActive = 1; + objectEvent->singleMovementActive = TRUE; sprite->data[1] = 6; return TRUE; } @@ -3042,7 +3042,7 @@ bool8 MovementType_WanderLeftAndRight_Step6(struct ObjectEvent *objectEvent, str { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 1; } return FALSE; @@ -3070,39 +3070,58 @@ bool8 MovementType_FaceDirection_Step1(struct ObjectEvent *objectEvent, struct S bool8 MovementType_FaceDirection_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; return FALSE; } static bool8 ObjectEventCB2_BerryTree(struct ObjectEvent *objectEvent, struct Sprite *sprite); extern bool8 (*const gMovementTypeFuncs_BerryTreeGrowth[])(struct ObjectEvent *objectEvent, struct Sprite *sprite); + +enum { + BERRYTREEFUNC_NORMAL, + BERRYTREEFUNC_MOVE, + BERRYTREEFUNC_SPARKLE_START, + BERRYTREEFUNC_SPARKLE, + BERRYTREEFUNC_SPARKLE_END, +}; + +#define sObjEventId data[0] +#define sFuncId data[1] +#define sTimer data[2] +#define sBerryTreeFlags data[7] + +#define BERRY_FLAG_SET_GFX (1 << 0) +#define BERRY_FLAG_SPARKLING (1 << 1) +#define BERRY_FLAG_JUST_PICKED (1 << 2) + void MovementType_BerryTreeGrowth(struct Sprite *sprite) { struct ObjectEvent *objectEvent; - objectEvent = &gObjectEvents[sprite->data[0]]; - if (!(sprite->data[7] & 1)) + objectEvent = &gObjectEvents[sprite->sObjEventId]; + if (!(sprite->sBerryTreeFlags & BERRY_FLAG_SET_GFX)) { - get_berry_tree_graphics(objectEvent, sprite); - sprite->data[7] |= 1; + SetBerryTreeGraphics(objectEvent, sprite); + sprite->sBerryTreeFlags |= BERRY_FLAG_SET_GFX; } UpdateObjectEventCurrentMovement(objectEvent, sprite, ObjectEventCB2_BerryTree); } static bool8 ObjectEventCB2_BerryTree(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - return gMovementTypeFuncs_BerryTreeGrowth[sprite->data[1]](objectEvent, sprite); + return gMovementTypeFuncs_BerryTreeGrowth[sprite->sFuncId](objectEvent, sprite); } -bool8 MovementType_BerryTreeGrowth_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +// BERRYTREEFUNC_NORMAL +bool8 MovementType_BerryTreeGrowth_Normal(struct ObjectEvent *objectEvent, struct Sprite *sprite) { u8 berryStage; ClearObjectEventMovement(objectEvent, sprite); objectEvent->invisible = TRUE; sprite->invisible = TRUE; berryStage = GetStageByBerryTreeId(objectEvent->trainerRange_berryTreeId); - if (berryStage == 0) + if (berryStage == BERRY_STAGE_NO_BERRY) { - if (!(sprite->data[7] & 4) && sprite->animNum == 4) + if (!(sprite->sBerryTreeFlags & BERRY_FLAG_JUST_PICKED) && sprite->animNum == BERRY_STAGE_FLOWERING) { gFieldEffectArguments[0] = objectEvent->currentCoords.x; gFieldEffectArguments[1] = objectEvent->currentCoords.y; @@ -3115,34 +3134,36 @@ bool8 MovementType_BerryTreeGrowth_Step0(struct ObjectEvent *objectEvent, struct } objectEvent->invisible = FALSE; sprite->invisible = FALSE; - berryStage --; + berryStage--; if (sprite->animNum != berryStage) { - sprite->data[1] = 2; + sprite->sFuncId = BERRYTREEFUNC_SPARKLE_START; return TRUE; } - get_berry_tree_graphics(objectEvent, sprite); + SetBerryTreeGraphics(objectEvent, sprite); ObjectEventSetSingleMovement(objectEvent, sprite, MOVEMENT_ACTION_START_ANIM_IN_DIRECTION); - sprite->data[1] = 1; + sprite->sFuncId = BERRYTREEFUNC_MOVE; return TRUE; } -bool8 MovementType_BerryTreeGrowth_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +// BERRYTREEFUNC_MOVE +bool8 MovementType_BerryTreeGrowth_Move(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - sprite->data[1] = 0; + sprite->sFuncId = BERRYTREEFUNC_NORMAL; return TRUE; } return FALSE; } -bool8 MovementType_BerryTreeGrowth_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite) +// BERRYTREEFUNC_SPARKLE_START +bool8 MovementType_BerryTreeGrowth_SparkleStart(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - objectEvent->singleMovementActive = 1; - sprite->data[1] = 3; - sprite->data[2] = 0; - sprite->data[7] |= 2; + objectEvent->singleMovementActive = TRUE; + sprite->sFuncId = BERRYTREEFUNC_SPARKLE; + sprite->sTimer = 0; + sprite->sBerryTreeFlags |= BERRY_FLAG_SPARKLING; gFieldEffectArguments[0] = objectEvent->currentCoords.x; gFieldEffectArguments[1] = objectEvent->currentCoords.y; gFieldEffectArguments[2] = sprite->subpriority - 1; @@ -3151,30 +3172,32 @@ bool8 MovementType_BerryTreeGrowth_Step2(struct ObjectEvent *objectEvent, struct return TRUE; } -bool8 MovementType_BerryTreeGrowth_Step3(struct ObjectEvent *objectEvent, struct Sprite *sprite) +// BERRYTREEFUNC_SPARKLE +bool8 MovementType_BerryTreeGrowth_Sparkle(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - sprite->data[2]++; - objectEvent->invisible = (sprite->data[2] & 0x02) >> 1; + sprite->sTimer++; + objectEvent->invisible = (sprite->sTimer & 2) >> 1; sprite->animPaused = TRUE; - if (sprite->data[2] > 64) + if (sprite->sTimer > 64) { - get_berry_tree_graphics(objectEvent, sprite); - sprite->data[1] = 4; - sprite->data[2] = 0; + SetBerryTreeGraphics(objectEvent, sprite); + sprite->sFuncId = BERRYTREEFUNC_SPARKLE_END; + sprite->sTimer = 0; return TRUE; } return FALSE; } -bool8 MovementType_BerryTreeGrowth_Step4(struct ObjectEvent *objectEvent, struct Sprite *sprite) +// BERRYTREEFUNC_SPARKLE_END +bool8 MovementType_BerryTreeGrowth_SparkleEnd(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - sprite->data[2]++; - objectEvent->invisible = (sprite->data[2] & 0x02) >> 1; + sprite->sTimer++; + objectEvent->invisible = (sprite->sTimer & 2) >> 1; sprite->animPaused = TRUE; - if (sprite->data[2] > 64) + if (sprite->sTimer > 64) { - sprite->data[1] = 0; - sprite->data[7] &= ~0x0002; + sprite->sFuncId = BERRYTREEFUNC_NORMAL; + sprite->sBerryTreeFlags &= ~BERRY_FLAG_SPARKLING; return TRUE; } return FALSE; @@ -3201,7 +3224,7 @@ bool8 MovementType_FaceDownAndUp_Step2(struct ObjectEvent *objectEvent, struct S if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { SetMovementDelay(sprite, gMovementDelaysMedium[Random() & 3]); - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 3; } return FALSE; @@ -3253,7 +3276,7 @@ bool8 MovementType_FaceLeftAndRight_Step2(struct ObjectEvent *objectEvent, struc if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { SetMovementDelay(sprite, gMovementDelaysMedium[Random() & 3]); - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 3; } return FALSE; @@ -3305,7 +3328,7 @@ bool8 MovementType_FaceUpAndLeft_Step2(struct ObjectEvent *objectEvent, struct S if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]); - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 3; } return FALSE; @@ -3357,7 +3380,7 @@ bool8 MovementType_FaceUpAndRight_Step2(struct ObjectEvent *objectEvent, struct if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]); - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 3; } return FALSE; @@ -3409,7 +3432,7 @@ bool8 MovementType_FaceDownAndLeft_Step2(struct ObjectEvent *objectEvent, struct if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]); - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 3; } return FALSE; @@ -3461,7 +3484,7 @@ bool8 MovementType_FaceDownAndRight_Step2(struct ObjectEvent *objectEvent, struc if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]); - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 3; } return FALSE; @@ -3513,7 +3536,7 @@ bool8 MovementType_FaceDownUpAndLeft_Step2(struct ObjectEvent *objectEvent, stru if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]); - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 3; } return FALSE; @@ -3565,7 +3588,7 @@ bool8 MovementType_FaceDownUpAndRight_Step2(struct ObjectEvent *objectEvent, str if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]); - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 3; } return FALSE; @@ -3617,7 +3640,7 @@ bool8 MovementType_FaceUpLeftAndRight_Step2(struct ObjectEvent *objectEvent, str if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]); - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 3; } return FALSE; @@ -3669,7 +3692,7 @@ bool8 MovementType_FaceDownLeftAndRight_Step2(struct ObjectEvent *objectEvent, s if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { SetMovementDelay(sprite, gMovementDelaysShort[Random() & 3]); - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 3; } return FALSE; @@ -3835,7 +3858,7 @@ bool8 MovementType_WalkBackAndForth_Step2(struct ObjectEvent *objectEvent, struc movementActionId = GetWalkInPlaceNormalMovementAction(objectEvent->facingDirection); ObjectEventSetSingleMovement(objectEvent, sprite, movementActionId); - objectEvent->singleMovementActive = 1; + objectEvent->singleMovementActive = TRUE; sprite->data[1] = 3; return TRUE; } @@ -3844,7 +3867,7 @@ bool8 MovementType_WalkBackAndForth_Step3(struct ObjectEvent *objectEvent, struc { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 1; } return FALSE; @@ -3880,7 +3903,7 @@ bool8 MoveNextDirectionInSequence(struct ObjectEvent *objectEvent, struct Sprite movementActionId = GetWalkInPlaceNormalMovementAction(objectEvent->facingDirection); ObjectEventSetSingleMovement(objectEvent, sprite, movementActionId); - objectEvent->singleMovementActive = 1; + objectEvent->singleMovementActive = TRUE; sprite->data[1] = 2; return TRUE; } @@ -3889,7 +3912,7 @@ bool8 MovementType_WalkSequence_Step2(struct ObjectEvent *objectEvent, struct Sp { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 1; } return FALSE; @@ -4233,7 +4256,7 @@ bool8 MovementType_CopyPlayer_Step2(struct ObjectEvent *objectEvent, struct Spri { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; sprite->data[1] = 1; } return FALSE; @@ -4247,7 +4270,7 @@ bool8 CopyablePlayerMovement_None(struct ObjectEvent *objectEvent, struct Sprite bool8 CopyablePlayerMovement_FaceDirection(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 playerDirection, bool8 tileCallback(u8)) { ObjectEventSetSingleMovement(objectEvent, sprite, GetFaceDirectionMovementAction(state_to_direction(gInitialMovementTypeFacingDirections[objectEvent->movementType], objectEvent->directionSequenceIndex, playerDirection))); - objectEvent->singleMovementActive = 1; + objectEvent->singleMovementActive = TRUE; sprite->data[1] = 2; return TRUE; } @@ -4268,7 +4291,7 @@ bool8 CopyablePlayerMovement_GoSpeed0(struct ObjectEvent *objectEvent, struct Sp direction = state_to_direction(gInitialMovementTypeFacingDirections[objectEvent->movementType], objectEvent->directionSequenceIndex, direction); ObjectEventMoveDestCoords(objectEvent, direction, &x, &y); ObjectEventSetSingleMovement(objectEvent, sprite, GetFaceDirectionMovementAction(direction)); - objectEvent->singleMovementActive = 1; + objectEvent->singleMovementActive = TRUE; sprite->data[1] = 2; return TRUE; } @@ -4283,7 +4306,7 @@ bool8 CopyablePlayerMovement_GoSpeed0(struct ObjectEvent *objectEvent, struct Sp { ObjectEventSetSingleMovement(objectEvent, sprite, GetFaceDirectionMovementAction(direction)); } - objectEvent->singleMovementActive = 1; + objectEvent->singleMovementActive = TRUE; sprite->data[1] = 2; return TRUE; } @@ -4444,7 +4467,7 @@ void MovementType_MountainDisguise(struct Sprite *sprite) UpdateObjectEventCurrentMovement(&gObjectEvents[sprite->data[0]], sprite, MovementType_Disguise_Callback); } -void MovementType_Hidden(struct Sprite *sprite) +void MovementType_Buried(struct Sprite *sprite) { if (!sprite->data[7]) { @@ -4453,15 +4476,15 @@ void MovementType_Hidden(struct Sprite *sprite) sprite->oam.priority = 3; sprite->data[7]++; } - UpdateObjectEventCurrentMovement(&gObjectEvents[sprite->data[0]], sprite, MovementType_Hidden_Callback); + UpdateObjectEventCurrentMovement(&gObjectEvents[sprite->data[0]], sprite, MovementType_Buried_Callback); } -static bool8 MovementType_Hidden_Callback(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementType_Buried_Callback(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - return gMovementTypeFuncs_Hidden[sprite->data[1]](objectEvent, sprite); + return gMovementTypeFuncs_Buried[sprite->data[1]](objectEvent, sprite); } -bool8 MovementType_Hidden_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +bool8 MovementType_Buried_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { ClearObjectEventMovement(objectEvent, sprite); return FALSE; @@ -4538,13 +4561,13 @@ bool8 MovementType_Invisible_Step1(struct ObjectEvent *objectEvent, struct Sprit bool8 MovementType_Invisible_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; return FALSE; } static void ClearObjectEventMovement(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - objectEvent->singleMovementActive = 0; + objectEvent->singleMovementActive = FALSE; objectEvent->heldMovementActive = FALSE; objectEvent->heldMovementFinished = FALSE; objectEvent->movementActionId = 0xFF; @@ -4824,7 +4847,7 @@ bool8 IsBerryTreeSparkling(u8 localId, u8 mapNum, u8 mapGroup) u8 objectEventId; if (!TryGetObjectEventIdByLocalIdAndMap(localId, mapNum, mapGroup, &objectEventId) - && gSprites[gObjectEvents[objectEventId].spriteId].data[7] & 2) + && gSprites[gObjectEvents[objectEventId].spriteId].sBerryTreeFlags & BERRY_FLAG_SPARKLING) { return TRUE; } @@ -4832,13 +4855,13 @@ bool8 IsBerryTreeSparkling(u8 localId, u8 mapNum, u8 mapGroup) return FALSE; } -void sub_8092EF0(u8 localId, u8 mapNum, u8 mapGroup) +void SetBerryTreeJustPicked(u8 localId, u8 mapNum, u8 mapGroup) { u8 objectEventId; if (!TryGetObjectEventIdByLocalIdAndMap(localId, mapNum, mapGroup, &objectEventId)) { - gSprites[gObjectEvents[objectEventId].spriteId].data[7] |= 0x04; + gSprites[gObjectEvents[objectEventId].spriteId].sBerryTreeFlags |= BERRY_FLAG_JUST_PICKED; } } @@ -6577,9 +6600,9 @@ bool8 MovementAction_EmoteHeart_Step0(struct ObjectEvent *objectEvent, struct Sp bool8 MovementAction_RevealTrainer_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - if (objectEvent->movementType == MOVEMENT_TYPE_HIDDEN) + if (objectEvent->movementType == MOVEMENT_TYPE_BURIED) { - sub_80B4578(objectEvent); + SetBuriedTrainerMovement(objectEvent); return FALSE; } if (objectEvent->movementType != MOVEMENT_TYPE_TREE_DISGUISE && objectEvent->movementType != MOVEMENT_TYPE_MOUNTAIN_DISGUISE) @@ -8971,13 +8994,14 @@ void DestroyExtraMovementTask(u8 taskId) DestroyTask(taskId); } -void sub_8098074(u8 var1, u8 var2) +// Used to freeze other objects except two trainers approaching for battle +void FreezeObjectEventsExceptTwo(u8 objectEventId1, u8 objectEventId2) { u8 i; for(i = 0; i < OBJECT_EVENTS_COUNT; i++) { - if(i != var1 && i != var2 && + if(i != objectEventId1 && i != objectEventId2 && gObjectEvents[i].active && i != gPlayerAvatar.objectEventId) FreezeObjectEvent(&gObjectEvents[i]); } diff --git a/src/evolution_graphics.c b/src/evolution_graphics.c index 28bbd4ef7..a66a7a28d 100644 --- a/src/evolution_graphics.c +++ b/src/evolution_graphics.c @@ -10,40 +10,46 @@ #include "palette.h" #include "constants/rgb.h" -// this file's functions -static void EvoSparkle_DummySpriteCb(struct Sprite* sprite); -static void EvoTask_BeginPreSet1_FadeAndPlaySE(u8 taskID); -static void EvoTask_CreatePreEvoSparkleSet1(u8 taskID); -static void EvoTask_WaitForPre1SparklesToGoUp(u8 taskID); -static void EvoTask_BeginPreSparklesSet2(u8 taskID); -static void EvoTask_CreatePreEvoSparklesSet2(u8 taskID); -static void EvoTask_DestroyPreSet2Task(u8 taskID); -static void EvoTask_BeginPostSparklesSet1(u8 taskID); -static void EvoTask_CreatePostEvoSparklesSet1(u8 taskID); -static void EvoTask_DestroyPostSet1Task(u8 taskID); -static void EvoTask_BeginPostSparklesSet2_AndFlash(u8 taskID); -static void EvoTask_CreatePostEvoSparklesSet2_AndFlash(u8 taskID); -static void EvoTask_BeginPostSparklesSet2_AndFlash_Trade(u8 taskID); -static void EvoTask_CreatePostEvoSparklesSet2_AndFlash_Trade(u8 taskID); -static void EvoTask_DestroyPostSet2AndFlashTask(u8 taskID); -static void sub_817C4EC(u8 taskID); -static void sub_817C510(u8 taskID); -static void PreEvoVisible_PostEvoInvisible_KillTask(u8 taskID); -static void PreEvoInvisible_PostEvoVisible_KillTask(u8 taskID); -static void sub_817C560(u8 taskID); +static void SpriteCB_Sparkle_Dummy(struct Sprite* sprite); -static const u16 sEvoSparklePalette[] = INCBIN_U16("graphics/misc/evo_sparkle.gbapal"); -static const u32 sEvoSparkleTiles[] = INCBIN_U32("graphics/misc/evo_sparkle.4bpp.lz"); +static void Task_Sparkles_SpiralUpward_Init(u8 taskId); +static void Task_Sparkles_SpiralUpward(u8 taskId); +static void Task_Sparkles_SpiralUpward_End(u8 taskId); + +static void Task_Sparkles_ArcDown_Init(u8 taskId); +static void Task_Sparkles_ArcDown(u8 taskId); +static void Task_Sparkles_ArcDown_End(u8 taskId); + +static void Task_Sparkles_CircleInward_Init(u8 taskId); +static void Task_Sparkles_CircleInward(u8 taskId); +static void Task_Sparkles_CircleInward_End(u8 taskId); + +static void Task_Sparkles_SprayAndFlash_Init(u8 taskId); +static void Task_Sparkles_SprayAndFlash(u8 taskId); +static void Task_Sparkles_SprayAndFlashTrade_Init(u8 taskId); +static void Task_Sparkles_SprayAndFlashTrade(u8 taskId); +static void Task_Sparkles_SprayAndFlash_End(u8 taskId); + +static void Task_CycleEvolutionMonSprite_Init(u8 taskId); +static void Task_CycleEvolutionMonSprite_TryEnd(u8 taskId); +static void Task_CycleEvolutionMonSprite_UpdateSize(u8 taskId); +static void EndOnPreEvoMon(u8 taskId); +static void EndOnPostEvoMon(u8 taskId); + +#define TAG_SPARKLE 1001 + +static const u16 sEvoSparkle_Pal[] = INCBIN_U16("graphics/misc/evo_sparkle.gbapal"); +static const u32 sEvoSparkle_Gfx[] = INCBIN_U32("graphics/misc/evo_sparkle.4bpp.lz"); static const struct CompressedSpriteSheet sEvoSparkleSpriteSheets[] = { - {sEvoSparkleTiles, 0x20, 1001}, + {sEvoSparkle_Gfx, 0x20, TAG_SPARKLE}, {NULL, 0, 0} }; static const struct SpritePalette sEvoSparkleSpritePals[] = { - {sEvoSparklePalette, 1001}, + {sEvoSparkle_Pal, TAG_SPARKLE}, {NULL, 0} }; @@ -77,13 +83,13 @@ static const union AnimCmd *const sSpriteAnimTable_EvoSparkle[] = static const struct SpriteTemplate sEvoSparkleSpriteTemplate = { - .tileTag = 1001, - .paletteTag = 1001, + .tileTag = TAG_SPARKLE, + .paletteTag = TAG_SPARKLE, .oam = &sOamData_EvoSparkle, .anims = sSpriteAnimTable_EvoSparkle, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = EvoSparkle_DummySpriteCb + .callback = SpriteCB_Sparkle_Dummy }; static const s16 sEvoSparkleMatrices[] = @@ -93,7 +99,7 @@ static const s16 sEvoSparkleMatrices[] = -1, 0x70, 0x1, 0x70, 0x2, 0x50, 0x3, 0x30, 0x4, 0x10 }; -static void EvoSparkle_DummySpriteCb(struct Sprite *sprite) +static void SpriteCB_Sparkle_Dummy(struct Sprite *sprite) { } @@ -107,7 +113,7 @@ static void SetEvoSparklesMatrices(void) } } -static void SpriteCB_PreEvoSparkleSet1(struct Sprite* sprite) +static void SpriteCB_Sparkle_SpiralUpward(struct Sprite* sprite) { if (sprite->pos1.y > 8) { @@ -133,7 +139,7 @@ static void SpriteCB_PreEvoSparkleSet1(struct Sprite* sprite) DestroySprite(sprite); } -static void CreatePreEvoSparkleSet1(u8 arg0) +static void CreateSparkle_SpiralUpward(u8 arg0) { u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 88, 0); if (spriteID != MAX_SPRITES) @@ -143,11 +149,11 @@ static void CreatePreEvoSparkleSet1(u8 arg0) gSprites[spriteID].data[7] = 0; gSprites[spriteID].oam.affineMode = ST_OAM_AFFINE_NORMAL; gSprites[spriteID].oam.matrixNum = 31; - gSprites[spriteID].callback = SpriteCB_PreEvoSparkleSet1; + gSprites[spriteID].callback = SpriteCB_Sparkle_SpiralUpward; } } -static void SpriteCB_PreEvoSparkleSet2(struct Sprite* sprite) +static void SpriteCB_Sparkle_ArcDown(struct Sprite* sprite) { if (sprite->pos1.y < 88) { @@ -161,7 +167,7 @@ static void SpriteCB_PreEvoSparkleSet2(struct Sprite* sprite) DestroySprite(sprite); } -static void CreatePreEvoSparkleSet2(u8 arg0) +static void CreateSparkle_ArcDown(u8 arg0) { u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 8, 0); if (spriteID != MAX_SPRITES) @@ -172,11 +178,11 @@ static void CreatePreEvoSparkleSet2(u8 arg0) gSprites[spriteID].oam.affineMode = ST_OAM_AFFINE_NORMAL; gSprites[spriteID].oam.matrixNum = 25; gSprites[spriteID].subpriority = 1; - gSprites[spriteID].callback = SpriteCB_PreEvoSparkleSet2; + gSprites[spriteID].callback = SpriteCB_Sparkle_ArcDown; } } -static void SpriteCB_PostEvoSparkleSet1(struct Sprite* sprite) +static void SpriteCB_Sparkle_CircleInward(struct Sprite* sprite) { if (sprite->data[5] > 8) { @@ -189,7 +195,7 @@ static void SpriteCB_PostEvoSparkleSet1(struct Sprite* sprite) DestroySprite(sprite); } -static void CreatePostEvoSparkleSet1(u8 arg0, u8 arg1) +static void CreateSparkle_CircleInward(u8 arg0, u8 arg1) { u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 56, 0); if (spriteID != MAX_SPRITES) @@ -201,11 +207,11 @@ static void CreatePostEvoSparkleSet1(u8 arg0, u8 arg1) gSprites[spriteID].oam.affineMode = ST_OAM_AFFINE_NORMAL; gSprites[spriteID].oam.matrixNum = 31; gSprites[spriteID].subpriority = 1; - gSprites[spriteID].callback = SpriteCB_PostEvoSparkleSet1; + gSprites[spriteID].callback = SpriteCB_Sparkle_CircleInward; } } -static void SpriteCB_PostEvoSparkleSet2(struct Sprite* sprite) +static void SpriteCB_Sparkle_Spray(struct Sprite* sprite) { if (!(sprite->data[7] & 3)) sprite->pos1.y++; @@ -235,7 +241,7 @@ static void SpriteCB_PostEvoSparkleSet2(struct Sprite* sprite) DestroySprite(sprite); } -static void CreatePostEvoSparkleSet2(u8 arg0) +static void CreateSparkle_Spray(u8 id) { u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 56, 0); if (spriteID != MAX_SPRITES) @@ -246,7 +252,7 @@ static void CreatePostEvoSparkleSet2(u8 arg0) gSprites[spriteID].oam.affineMode = ST_OAM_AFFINE_NORMAL; gSprites[spriteID].oam.matrixNum = 31; gSprites[spriteID].subpriority = 20; - gSprites[spriteID].callback = SpriteCB_PostEvoSparkleSet2; + gSprites[spriteID].callback = SpriteCB_Sparkle_Spray; } } @@ -256,357 +262,386 @@ void LoadEvoSparkleSpriteAndPal(void) LoadSpritePalettes(sEvoSparkleSpritePals); } -#define tFrameCounter data[15] +#define tPalNum data[1] +#define tTimer data[15] -u8 LaunchTask_PreEvoSparklesSet1(u16 arg0) +u8 EvolutionSparkles_SpiralUpward(u16 palNum) { - u8 taskID = CreateTask(EvoTask_BeginPreSet1_FadeAndPlaySE, 0); - gTasks[taskID].data[1] = arg0; - return taskID; + u8 taskId = CreateTask(Task_Sparkles_SpiralUpward_Init, 0); + gTasks[taskId].tPalNum = palNum; + return taskId; } -static void EvoTask_BeginPreSet1_FadeAndPlaySE(u8 taskID) +static void Task_Sparkles_SpiralUpward_Init(u8 taskId) { SetEvoSparklesMatrices(); - gTasks[taskID].tFrameCounter = 0; - BeginNormalPaletteFade(3 << gTasks[taskID].data[1], 0xA, 0, 0x10, RGB_WHITE); - gTasks[taskID].func = EvoTask_CreatePreEvoSparkleSet1; - PlaySE(SE_M_MEGA_KICK); + gTasks[taskId].tTimer = 0; + BeginNormalPaletteFade(3 << gTasks[taskId].tPalNum, 0xA, 0, 0x10, RGB_WHITE); + gTasks[taskId].func = Task_Sparkles_SpiralUpward; + PlaySE(SE_M_MEGA_KICK); // 'Charging up' sound for the sparkles as they spiral upwards } -static void EvoTask_CreatePreEvoSparkleSet1(u8 taskID) +static void Task_Sparkles_SpiralUpward(u8 taskId) { - if (gTasks[taskID].tFrameCounter < 64) + if (gTasks[taskId].tTimer < 64) { - if (!(gTasks[taskID].tFrameCounter & 7)) + if (!(gTasks[taskId].tTimer & 7)) { u8 i; for (i = 0; i < 4; i++) - CreatePreEvoSparkleSet1((0x78 & gTasks[taskID].tFrameCounter) * 2 + i * 64); + CreateSparkle_SpiralUpward((0x78 & gTasks[taskId].tTimer) * 2 + i * 64); } - gTasks[taskID].tFrameCounter++; + gTasks[taskId].tTimer++; } else { - gTasks[taskID].tFrameCounter = 96; - gTasks[taskID].func = EvoTask_WaitForPre1SparklesToGoUp; + gTasks[taskId].tTimer = 96; + gTasks[taskId].func = Task_Sparkles_SpiralUpward_End; } } -static void EvoTask_WaitForPre1SparklesToGoUp(u8 taskID) +static void Task_Sparkles_SpiralUpward_End(u8 taskId) { - if (gTasks[taskID].tFrameCounter != 0) - gTasks[taskID].tFrameCounter--; + if (gTasks[taskId].tTimer != 0) + gTasks[taskId].tTimer--; else - DestroyTask(taskID); + DestroyTask(taskId); } -u8 LaunchTask_PreEvoSparklesSet2(void) +u8 EvolutionSparkles_ArcDown(void) { - return CreateTask(EvoTask_BeginPreSparklesSet2, 0); + return CreateTask(Task_Sparkles_ArcDown_Init, 0); } -static void EvoTask_BeginPreSparklesSet2(u8 taskID) +static void Task_Sparkles_ArcDown_Init(u8 taskId) { SetEvoSparklesMatrices(); - gTasks[taskID].tFrameCounter = 0; - gTasks[taskID].func = EvoTask_CreatePreEvoSparklesSet2; + gTasks[taskId].tTimer = 0; + gTasks[taskId].func = Task_Sparkles_ArcDown; PlaySE(SE_M_BUBBLE_BEAM2); } -static void EvoTask_CreatePreEvoSparklesSet2(u8 taskID) +static void Task_Sparkles_ArcDown(u8 taskId) { - if (gTasks[taskID].tFrameCounter < 96) + if (gTasks[taskId].tTimer < 96) { - if (gTasks[taskID].tFrameCounter < 6) + if (gTasks[taskId].tTimer < 6) { u8 i; for (i = 0; i < 9; i++) - CreatePreEvoSparkleSet2(i * 16); + CreateSparkle_ArcDown(i * 16); } - gTasks[taskID].tFrameCounter++; + gTasks[taskId].tTimer++; } else - gTasks[taskID].func = EvoTask_DestroyPreSet2Task; + gTasks[taskId].func = Task_Sparkles_ArcDown_End; } -static void EvoTask_DestroyPreSet2Task(u8 taskID) +static void Task_Sparkles_ArcDown_End(u8 taskId) { - DestroyTask(taskID); + DestroyTask(taskId); } -u8 LaunchTask_PostEvoSparklesSet1(void) +u8 EvolutionSparkles_CircleInward(void) { - return CreateTask(EvoTask_BeginPostSparklesSet1, 0); + return CreateTask(Task_Sparkles_CircleInward_Init, 0); } -static void EvoTask_BeginPostSparklesSet1(u8 taskID) +static void Task_Sparkles_CircleInward_Init(u8 taskId) { SetEvoSparklesMatrices(); - gTasks[taskID].tFrameCounter = 0; - gTasks[taskID].func = EvoTask_CreatePostEvoSparklesSet1; + gTasks[taskId].tTimer = 0; + gTasks[taskId].func = Task_Sparkles_CircleInward; PlaySE(SE_SHINY); } -static void EvoTask_CreatePostEvoSparklesSet1(u8 taskID) +static void Task_Sparkles_CircleInward(u8 taskId) { - if (gTasks[taskID].tFrameCounter < 48) + if (gTasks[taskId].tTimer < 48) { - if (gTasks[taskID].tFrameCounter == 0) + if (gTasks[taskId].tTimer == 0) { u8 i; for (i = 0; i < 16; i++) - CreatePostEvoSparkleSet1(i * 16, 4); + CreateSparkle_CircleInward(i * 16, 4); } - if (gTasks[taskID].tFrameCounter == 32) + if (gTasks[taskId].tTimer == 32) { u8 i; for (i = 0; i < 16; i++) - CreatePostEvoSparkleSet1(i * 16, 8); + CreateSparkle_CircleInward(i * 16, 8); } - gTasks[taskID].tFrameCounter++; + gTasks[taskId].tTimer++; } else - gTasks[taskID].func = EvoTask_DestroyPostSet1Task; + gTasks[taskId].func = Task_Sparkles_CircleInward_End; } -static void EvoTask_DestroyPostSet1Task(u8 taskID) +static void Task_Sparkles_CircleInward_End(u8 taskId) { - DestroyTask(taskID); + DestroyTask(taskId); } -u8 LaunchTask_PostEvoSparklesSet2AndFlash(u16 species) +#define tSpecies data[2] // Never read + +u8 EvolutionSparkles_SprayAndFlash(u16 species) { - u8 taskID = CreateTask(EvoTask_BeginPostSparklesSet2_AndFlash, 0); - gTasks[taskID].data[2] = species; - return taskID; + u8 taskId = CreateTask(Task_Sparkles_SprayAndFlash_Init, 0); + gTasks[taskId].tSpecies = species; + return taskId; } -static void EvoTask_BeginPostSparklesSet2_AndFlash(u8 taskID) +static void Task_Sparkles_SprayAndFlash_Init(u8 taskId) { SetEvoSparklesMatrices(); - gTasks[taskID].tFrameCounter = 0; + gTasks[taskId].tTimer = 0; CpuSet(&gPlttBufferFaded[0x20], &gPlttBufferUnfaded[0x20], 0x30); BeginNormalPaletteFade(0xFFF9041C, 0, 0, 0x10, RGB_WHITE); // was 0xFFF9001C in R/S - gTasks[taskID].func = EvoTask_CreatePostEvoSparklesSet2_AndFlash; + gTasks[taskId].func = Task_Sparkles_SprayAndFlash; PlaySE(SE_M_PETAL_DANCE); } -static void EvoTask_CreatePostEvoSparklesSet2_AndFlash(u8 taskID) +static void Task_Sparkles_SprayAndFlash(u8 taskId) { - if (gTasks[taskID].tFrameCounter < 128) + if (gTasks[taskId].tTimer < 128) { u8 i; - switch (gTasks[taskID].tFrameCounter) + switch (gTasks[taskId].tTimer) { default: - if (gTasks[taskID].tFrameCounter < 50) - CreatePostEvoSparkleSet2(Random() & 7); + if (gTasks[taskId].tTimer < 50) + CreateSparkle_Spray(Random() & 7); break; case 0: for (i = 0; i < 8; i++) - CreatePostEvoSparkleSet2(i); + CreateSparkle_Spray(i); break; case 32: BeginNormalPaletteFade(0xFFFF041C, 0x10, 0x10, 0, RGB_WHITE); // was 0xFFF9001C in R/S break; } - gTasks[taskID].tFrameCounter++; + gTasks[taskId].tTimer++; } else - gTasks[taskID].func = EvoTask_DestroyPostSet2AndFlashTask; + gTasks[taskId].func = Task_Sparkles_SprayAndFlash_End; } -static void EvoTask_DestroyPostSet2AndFlashTask(u8 taskID) +static void Task_Sparkles_SprayAndFlash_End(u8 taskId) { if (!gPaletteFade.active) - DestroyTask(taskID); + DestroyTask(taskId); } -u8 LaunchTask_PostEvoSparklesSet2AndFlash_Trade(u16 species) +// Separate from EvolutionSparkles_SprayAndFlash for difference in fade color +u8 EvolutionSparkles_SprayAndFlash_Trade(u16 species) { - u8 taskID = CreateTask(EvoTask_BeginPostSparklesSet2_AndFlash_Trade, 0); - gTasks[taskID].data[2] = species; - return taskID; + u8 taskId = CreateTask(Task_Sparkles_SprayAndFlashTrade_Init, 0); + gTasks[taskId].tSpecies = species; + return taskId; } -static void EvoTask_BeginPostSparklesSet2_AndFlash_Trade(u8 taskID) +static void Task_Sparkles_SprayAndFlashTrade_Init(u8 taskId) { SetEvoSparklesMatrices(); - gTasks[taskID].tFrameCounter = 0; + gTasks[taskId].tTimer = 0; CpuSet(&gPlttBufferFaded[0x20], &gPlttBufferUnfaded[0x20], 0x30); BeginNormalPaletteFade(0xFFF90400, 0, 0, 0x10, RGB_WHITE); // was 0xFFFF0001 in R/S - gTasks[taskID].func = EvoTask_CreatePostEvoSparklesSet2_AndFlash_Trade; + gTasks[taskId].func = Task_Sparkles_SprayAndFlashTrade; PlaySE(SE_M_PETAL_DANCE); } -static void EvoTask_CreatePostEvoSparklesSet2_AndFlash_Trade(u8 taskID) +static void Task_Sparkles_SprayAndFlashTrade(u8 taskId) { - if (gTasks[taskID].tFrameCounter < 128) + if (gTasks[taskId].tTimer < 128) { u8 i; - switch (gTasks[taskID].tFrameCounter) + switch (gTasks[taskId].tTimer) { default: - if (gTasks[taskID].tFrameCounter < 50) - CreatePostEvoSparkleSet2(Random() & 7); + if (gTasks[taskId].tTimer < 50) + CreateSparkle_Spray(Random() & 7); break; case 0: for (i = 0; i < 8; i++) - CreatePostEvoSparkleSet2(i); + CreateSparkle_Spray(i); break; case 32: BeginNormalPaletteFade(0xFFFF0400, 0x10, 0x10, 0, RGB_WHITE); // was 0xFFFF0001 in R/S break; } - gTasks[taskID].tFrameCounter++; + gTasks[taskId].tTimer++; } else - gTasks[taskID].func = EvoTask_DestroyPostSet2AndFlashTask; + gTasks[taskId].func = Task_Sparkles_SprayAndFlash_End; } -#undef tFrameCounter +#undef tTimer +#undef tSpecies -static void PokeEvoSprite_DummySpriteCB(struct Sprite* sprite) +static void SpriteCB_EvolutionMonSprite(struct Sprite* sprite) { } -#define tPreEvoSpriteID data[1] -#define tPostEvoSpriteID data[2] +#define tPreEvoSpriteId data[1] +#define tPostEvoSpriteId data[2] +#define tPreEvoScale data[3] +#define tPostEvoScale data[4] +#define tShowingPostEvo data[5] +#define tScaleSpeed data[6] #define tEvoStopped data[8] -u8 sub_817C3A0(u8 preEvoSpriteID, u8 postEvoSpriteID) +#define MATRIX_PRE_EVO 30 +#define MATRIX_POST_EVO 31 + +#define MON_MAX_SCALE 256 +#define MON_MIN_SCALE 16 + +// Alternately grow/shrink the pre-evolution and post-evolution mon sprites +u8 CycleEvolutionMonSprite(u8 preEvoSpriteId, u8 postEvoSpriteId) { u16 i; u16 stack[16]; - u8 taskID; + u8 taskId; s32 toDiv; - for (i = 0; i < 16; i++) + for (i = 0; i < ARRAY_COUNT(stack); i++) stack[i] = 0x7FFF; - taskID = CreateTask(sub_817C4EC, 0); - gTasks[taskID].tPreEvoSpriteID = preEvoSpriteID; - gTasks[taskID].tPostEvoSpriteID = postEvoSpriteID; - gTasks[taskID].data[3] = 256; - gTasks[taskID].data[4] = 16; + taskId = CreateTask(Task_CycleEvolutionMonSprite_Init, 0); + gTasks[taskId].tPreEvoSpriteId = preEvoSpriteId; + gTasks[taskId].tPostEvoSpriteId = postEvoSpriteId; + gTasks[taskId].tPreEvoScale = MON_MAX_SCALE; + gTasks[taskId].tPostEvoScale = MON_MIN_SCALE; toDiv = 65536; - SetOamMatrix(30, 256, 0, 0, 256); - SetOamMatrix(31, toDiv / gTasks[taskID].data[4], 0, 0, toDiv / gTasks[taskID].data[4]); + SetOamMatrix(MATRIX_PRE_EVO, MON_MAX_SCALE, 0, 0, MON_MAX_SCALE); + SetOamMatrix(MATRIX_POST_EVO, toDiv / gTasks[taskId].tPostEvoScale, 0, 0, toDiv / gTasks[taskId].tPostEvoScale); - gSprites[preEvoSpriteID].callback = PokeEvoSprite_DummySpriteCB; - gSprites[preEvoSpriteID].oam.affineMode = ST_OAM_AFFINE_NORMAL; - gSprites[preEvoSpriteID].oam.matrixNum = 30; - gSprites[preEvoSpriteID].invisible = FALSE; - CpuSet(stack, &gPlttBufferFaded[0x100 + (gSprites[preEvoSpriteID].oam.paletteNum * 16)], 16); + gSprites[preEvoSpriteId].callback = SpriteCB_EvolutionMonSprite; + gSprites[preEvoSpriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[preEvoSpriteId].oam.matrixNum = MATRIX_PRE_EVO; + gSprites[preEvoSpriteId].invisible = FALSE; + CpuSet(stack, &gPlttBufferFaded[0x100 + (gSprites[preEvoSpriteId].oam.paletteNum * 16)], 16); - gSprites[postEvoSpriteID].callback = PokeEvoSprite_DummySpriteCB; - gSprites[postEvoSpriteID].oam.affineMode = ST_OAM_AFFINE_NORMAL; - gSprites[postEvoSpriteID].oam.matrixNum = 31; - gSprites[postEvoSpriteID].invisible = FALSE; - CpuSet(stack, &gPlttBufferFaded[0x100 + (gSprites[postEvoSpriteID].oam.paletteNum * 16)], 16); + gSprites[postEvoSpriteId].callback = SpriteCB_EvolutionMonSprite; + gSprites[postEvoSpriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[postEvoSpriteId].oam.matrixNum = MATRIX_POST_EVO; + gSprites[postEvoSpriteId].invisible = FALSE; + CpuSet(stack, &gPlttBufferFaded[0x100 + (gSprites[postEvoSpriteId].oam.paletteNum * 16)], 16); - gTasks[taskID].tEvoStopped = FALSE; - return taskID; + gTasks[taskId].tEvoStopped = FALSE; + return taskId; } -static void sub_817C4EC(u8 taskID) +static void Task_CycleEvolutionMonSprite_Init(u8 taskId) { - gTasks[taskID].data[5] = 0; - gTasks[taskID].data[6] = 8; - gTasks[taskID].func = sub_817C510; + gTasks[taskId].tShowingPostEvo = FALSE; + gTasks[taskId].tScaleSpeed = 8; + gTasks[taskId].func = Task_CycleEvolutionMonSprite_TryEnd; } -static void sub_817C510(u8 taskID) +// Try to end sprite cycling +// If evo hasn't stopped or growth/shrink speed hasn't been maxed out, start another cycle +static void Task_CycleEvolutionMonSprite_TryEnd(u8 taskId) { - if (gTasks[taskID].tEvoStopped) - PreEvoVisible_PostEvoInvisible_KillTask(taskID); - else if (gTasks[taskID].data[6] == 128) - PreEvoInvisible_PostEvoVisible_KillTask(taskID); + if (gTasks[taskId].tEvoStopped) + EndOnPreEvoMon(taskId); + else if (gTasks[taskId].tScaleSpeed == 128) + EndOnPostEvoMon(taskId); else { - gTasks[taskID].data[6] += 2; - gTasks[taskID].data[5] ^= 1; - gTasks[taskID].func = sub_817C560; + gTasks[taskId].tScaleSpeed += 2; + gTasks[taskId].tShowingPostEvo ^= 1; + gTasks[taskId].func = Task_CycleEvolutionMonSprite_UpdateSize; } } -static void sub_817C560(u8 taskID) +static void Task_CycleEvolutionMonSprite_UpdateSize(u8 taskId) { - if (gTasks[taskID].tEvoStopped) - gTasks[taskID].func = PreEvoVisible_PostEvoInvisible_KillTask; + if (gTasks[taskId].tEvoStopped) + gTasks[taskId].func = EndOnPreEvoMon; else { u16 oamMatrixArg; - u8 r6 = 0; - if (gTasks[taskID].data[5] == 0) + u8 numSpritesFinished = 0; + if (!gTasks[taskId].tShowingPostEvo) { - if (gTasks[taskID].data[3] < 256 - gTasks[taskID].data[6]) - gTasks[taskID].data[3] += gTasks[taskID].data[6]; + // Set pre-evo sprite growth + if (gTasks[taskId].tPreEvoScale < MON_MAX_SCALE - gTasks[taskId].tScaleSpeed) + gTasks[taskId].tPreEvoScale += gTasks[taskId].tScaleSpeed; else { - gTasks[taskID].data[3] = 256; - r6++; + gTasks[taskId].tPreEvoScale = MON_MAX_SCALE; + numSpritesFinished++; } - if (gTasks[taskID].data[4] > 16 + gTasks[taskID].data[6]) - gTasks[taskID].data[4] -= gTasks[taskID].data[6]; + + // Set post-evo sprite shrink + if (gTasks[taskId].tPostEvoScale > MON_MIN_SCALE + gTasks[taskId].tScaleSpeed) + gTasks[taskId].tPostEvoScale -= gTasks[taskId].tScaleSpeed; else { - gTasks[taskID].data[4] = 16; - r6++; + gTasks[taskId].tPostEvoScale = MON_MIN_SCALE; + numSpritesFinished++; } } else { - if (gTasks[taskID].data[4] < 256 - gTasks[taskID].data[6]) - gTasks[taskID].data[4] += gTasks[taskID].data[6]; + // Set post-evo sprite growth + if (gTasks[taskId].tPostEvoScale < MON_MAX_SCALE - gTasks[taskId].tScaleSpeed) + gTasks[taskId].tPostEvoScale += gTasks[taskId].tScaleSpeed; else { - gTasks[taskID].data[4] = 256; - r6++; + gTasks[taskId].tPostEvoScale = MON_MAX_SCALE; + numSpritesFinished++; } - if (gTasks[taskID].data[3] > 16 + gTasks[taskID].data[6]) - gTasks[taskID].data[3] -= gTasks[taskID].data[6]; + + // Set pre-evo sprite shrink + if (gTasks[taskId].tPreEvoScale > MON_MIN_SCALE + gTasks[taskId].tScaleSpeed) + gTasks[taskId].tPreEvoScale -= gTasks[taskId].tScaleSpeed; else { - gTasks[taskID].data[3] = 16; - r6++; + gTasks[taskId].tPreEvoScale = MON_MIN_SCALE; + numSpritesFinished++; } } - oamMatrixArg = 65536 / gTasks[taskID].data[3]; - SetOamMatrix(30, oamMatrixArg, 0, 0, oamMatrixArg); - oamMatrixArg = 65536 / gTasks[taskID].data[4]; - SetOamMatrix(31, oamMatrixArg, 0, 0, oamMatrixArg); - if (r6 == 2) - gTasks[taskID].func = sub_817C510; + // Grow/shrink pre-evo sprite + oamMatrixArg = 65536 / gTasks[taskId].tPreEvoScale; + SetOamMatrix(MATRIX_PRE_EVO, oamMatrixArg, 0, 0, oamMatrixArg); + + // Grow/shrink post-evo sprite + oamMatrixArg = 65536 / gTasks[taskId].tPostEvoScale; + SetOamMatrix(MATRIX_POST_EVO, oamMatrixArg, 0, 0, oamMatrixArg); + + // Both sprites have reached their size extreme + if (numSpritesFinished == 2) + gTasks[taskId].func = Task_CycleEvolutionMonSprite_TryEnd; } } -static void PreEvoInvisible_PostEvoVisible_KillTask(u8 taskID) +static void EndOnPostEvoMon(u8 taskId) { - gSprites[gTasks[taskID].tPreEvoSpriteID].oam.affineMode = ST_OAM_AFFINE_OFF; - gSprites[gTasks[taskID].tPreEvoSpriteID].oam.matrixNum = 0; - gSprites[gTasks[taskID].tPreEvoSpriteID].invisible = TRUE; + gSprites[gTasks[taskId].tPreEvoSpriteId].oam.affineMode = ST_OAM_AFFINE_OFF; + gSprites[gTasks[taskId].tPreEvoSpriteId].oam.matrixNum = 0; + gSprites[gTasks[taskId].tPreEvoSpriteId].invisible = TRUE; - gSprites[gTasks[taskID].tPostEvoSpriteID].oam.affineMode = ST_OAM_AFFINE_OFF; - gSprites[gTasks[taskID].tPostEvoSpriteID].oam.matrixNum = 0; - gSprites[gTasks[taskID].tPostEvoSpriteID].invisible = FALSE; + gSprites[gTasks[taskId].tPostEvoSpriteId].oam.affineMode = ST_OAM_AFFINE_OFF; + gSprites[gTasks[taskId].tPostEvoSpriteId].oam.matrixNum = 0; + gSprites[gTasks[taskId].tPostEvoSpriteId].invisible = FALSE; - DestroyTask(taskID); + DestroyTask(taskId); } -static void PreEvoVisible_PostEvoInvisible_KillTask(u8 taskID) +static void EndOnPreEvoMon(u8 taskId) { - gSprites[gTasks[taskID].tPreEvoSpriteID].oam.affineMode = ST_OAM_AFFINE_OFF; - gSprites[gTasks[taskID].tPreEvoSpriteID].oam.matrixNum = 0; - gSprites[gTasks[taskID].tPreEvoSpriteID].invisible = FALSE; + gSprites[gTasks[taskId].tPreEvoSpriteId].oam.affineMode = ST_OAM_AFFINE_OFF; + gSprites[gTasks[taskId].tPreEvoSpriteId].oam.matrixNum = 0; + gSprites[gTasks[taskId].tPreEvoSpriteId].invisible = FALSE; - gSprites[gTasks[taskID].tPostEvoSpriteID].oam.affineMode = ST_OAM_AFFINE_OFF; - gSprites[gTasks[taskID].tPostEvoSpriteID].oam.matrixNum = 0; - gSprites[gTasks[taskID].tPostEvoSpriteID].invisible = TRUE; + gSprites[gTasks[taskId].tPostEvoSpriteId].oam.affineMode = ST_OAM_AFFINE_OFF; + gSprites[gTasks[taskId].tPostEvoSpriteId].oam.matrixNum = 0; + gSprites[gTasks[taskId].tPostEvoSpriteId].invisible = TRUE; - DestroyTask(taskID); + DestroyTask(taskId); } diff --git a/src/evolution_scene.c b/src/evolution_scene.c index a8de8a555..59316835f 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -32,113 +32,117 @@ #include "constants/battle_string_ids.h" #include "constants/songs.h" #include "constants/rgb.h" +#include "constants/items.h" struct EvoInfo { - u8 preEvoSpriteID; - u8 postEvoSpriteID; - u8 evoTaskID; - u8 field_3; + u8 preEvoSpriteId; + u8 postEvoSpriteId; + u8 evoTaskId; + u8 delayTimer; u16 savedPalette[48]; }; -// EWRAM vars static EWRAM_DATA struct EvoInfo *sEvoStructPtr = NULL; -static EWRAM_DATA u16 *sEvoMovingBgPtr = NULL; +static EWRAM_DATA u16 *sBgAnimPal = NULL; -// IWRAM common void (*gCB2_AfterEvolution)(void); #define sEvoCursorPos gBattleCommunication[1] // when learning a new move -#define sEvoGraphicsTaskID gBattleCommunication[2] +#define sEvoGraphicsTaskId gBattleCommunication[2] -// this file's functions -static void Task_EvolutionScene(u8 taskID); -static void Task_TradeEvolutionScene(u8 taskID); +static void Task_EvolutionScene(u8 taskId); +static void Task_TradeEvolutionScene(u8 taskId); static void CB2_EvolutionSceneUpdate(void); static void CB2_TradeEvolutionSceneUpdate(void); static void EvoDummyFunc(void); static void VBlankCB_EvolutionScene(void); static void VBlankCB_TradeEvolutionScene(void); -static void sub_8140134(void); -static void EvoScene_DoMonAnimation(u8 monSpriteId, u16 speciesId); +static void EvoScene_DoMonAnimAndCry(u8 monSpriteId, u16 speciesId); static bool32 EvoScene_IsMonAnimFinished(u8 monSpriteId); -static void InitMovingBackgroundTask(bool8 isLink); -static void sub_813FEE8(u8 taskId); -static void sub_8140174(void); +static void StartBgAnimation(bool8 isLink); +static void StopBgAnimation(void); +static void Task_AnimateBg(u8 taskId); +static void RestoreBgAfterAnim(void); -// const data -static const u16 sUnknown_085B4114[] = INCBIN_U16("graphics/evolution_scene/unknown_5B4114.gbapal"); -static const u32 sUnknown_085B4134[] = INCBIN_U32("graphics/evolution_scene/bg.4bpp.lz"); -static const u32 sUnknown_085B482C[] = INCBIN_U32("graphics/evolution_scene/bg.bin.lz"); -static const u32 sUnknown_085B4D10[] = INCBIN_U32("graphics/evolution_scene/bg2.bin.lz"); -static const u16 sUnknown_085B51E4[] = INCBIN_U16("graphics/evolution_scene/gray_transition_intro.gbapal"); -static const u16 sUnknown_085B53E4[] = INCBIN_U16("graphics/evolution_scene/gray_transition_lighten.gbapal"); -static const u16 sUnknown_085B5544[] = INCBIN_U16("graphics/evolution_scene/gray_transition_darken.gbapal"); -static const u16 sUnknown_085B56E4[] = INCBIN_U16("graphics/evolution_scene/gray_transition_outro.gbapal"); -static const u16 sUnknown_085B5884[] = INCBIN_U16("graphics/evolution_scene/transition.gbapal"); +static const u16 sUnusedPal1[] = INCBIN_U16("graphics/evolution_scene/unused_1.gbapal"); +static const u32 sBgAnim_Gfx[] = INCBIN_U32("graphics/evolution_scene/bg.4bpp.lz"); +static const u32 sBgAnim_Inner_Tilemap[] = INCBIN_U32("graphics/evolution_scene/bg_inner.bin.lz"); +static const u32 sBgAnim_Outer_Tilemap[] = INCBIN_U32("graphics/evolution_scene/bg_outer.bin.lz"); +static const u16 sBgAnim_Intro_Pal[] = INCBIN_U16("graphics/evolution_scene/bg_anim_intro.gbapal"); +static const u16 sUnusedPal2[] = INCBIN_U16("graphics/evolution_scene/unused_2.gbapal"); +static const u16 sUnusedPal3[] = INCBIN_U16("graphics/evolution_scene/unused_3.gbapal"); +static const u16 sUnusedPal4[] = INCBIN_U16("graphics/evolution_scene/unused_4.gbapal"); +static const u16 sBgAnim_Pal[] = INCBIN_U16("graphics/evolution_scene/bg_anim.gbapal"); -static const u8 Text_ShedinjaJapaneseName[] = _("ヌケニン"); +static const u8 sText_ShedinjaJapaneseName[] = _("ヌケニン"); -static const u8 sUnknown_085B58C9[][4] = +// The below table is used by Task_UpdateBgPalette to control the speed at which the bg color updates. +// The first two values are indexes into sBgAnim_PalIndexes (indirectly, via sBgAnimPal), and are +// the start and end of the range of colors in sBgAnim_PalIndexes it will move through incrementally +// before starting over. It will repeat this cycle x number of times, where x = the 3rd value, +// delaying each increment by y, where y = the 4th value. +// Once it has cycled x number of times, it will move to the next array in this table. +static const u8 sBgAnim_PaletteControl[][4] = { - { 0x00, 0x0C, 0x01, 0x06 }, - { 0x0D, 0x24, 0x05, 0x02 }, - { 0x0D, 0x18, 0x01, 0x02 }, - { 0x25, 0x31, 0x01, 0x06 }, + { 0, 12, 1, 6 }, + { 13, 36, 5, 2 }, + { 13, 24, 1, 2 }, + { 37, 49, 1, 6 }, }; -static const u8 sUnknown_085B58D9[][16] = { - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x0B, 0x00, 0x00 }, - { 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x00, 0x00 }, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x00, 0x00 }, - { 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x00, 0x00 }, - { 0x00, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x00, 0x00 }, - { 0x00, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x00, 0x00 }, - { 0x00, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x00, 0x00 }, - { 0x00, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x00, 0x00 }, - { 0x00, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x00, 0x00 }, - { 0x00, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x00, 0x00 }, - { 0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x00, 0x00 }, - { 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x00, 0x00 }, - { 0x00, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x00, 0x00 }, - { 0x00, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x00, 0x00 }, - { 0x00, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00 }, - { 0x00, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x00, 0x00 }, - { 0x00, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x00, 0x00 }, - { 0x00, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x00, 0x00 }, - { 0x00, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00 }, - { 0x00, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00, 0x00 }, - { 0x00, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00 }, - { 0x00, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, 0x00 }, - { 0x00, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00 }, - { 0x00, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x00, 0x00 }, - { 0x00, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x00, 0x00 }, - { 0x00, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x00, 0x00 }, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x00, 0x00 }, - { 0x00, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00 }, - { 0x00, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } +// Indexes into sBgAnim_Pal, 0 is black, transitioning to a bright light blue (172, 213, 255) at 13 +static const u8 sBgAnim_PalIndexes[][16] = { + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0 }, + { 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0 }, + { 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0 }, + { 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 11, 0, 0 }, + { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0 }, + { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 12, 0, 0 }, + { 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 12, 11, 0, 0 }, + { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 12, 11, 10, 0, 0 }, + { 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 12, 11, 10, 9, 0, 0 }, + { 0, 6, 7, 8, 9, 10, 11, 12, 13, 12, 11, 10, 9, 8, 0, 0 }, + { 0, 7, 8, 9, 10, 11, 12, 13, 12, 11, 10, 9, 8, 7, 0, 0 }, + { 0, 8, 9, 10, 11, 12, 13, 12, 11, 10, 9, 8, 7, 6, 0, 0 }, + { 0, 9, 10, 11, 12, 13, 12, 11, 10, 9, 8, 7, 6, 5, 0, 0 }, + { 0, 10, 11, 12, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 0, 0 }, + { 0, 11, 12, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 0, 0 }, + { 0, 12, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 0, 0 }, + { 0, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 }, + { 0, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 0, 0 }, + { 0, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 0, 0 }, + { 0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 0, 0 }, + { 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 0, 0 }, + { 0, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 0, 0 }, + { 0, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 0, 0 }, + { 0, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0 }, + { 0, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0 }, + { 0, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0 }, + { 0, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0 }, + { 0, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 0 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0 }, + { 0, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0 }, + { 0, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0 }, + { 0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0 }, + { 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0 }, + { 0, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; static void CB2_BeginEvolutionScene(void) @@ -154,53 +158,53 @@ static void CB2_BeginEvolutionScene(void) #define tBits data[3] #define tLearnsFirstMove data[4] #define tLearnMoveState data[6] -#define tData7 data[7] -#define tData8 data[8] +#define tLearnMoveYesState data[7] +#define tLearnMoveNoState data[8] #define tEvoWasStopped data[9] -#define tPartyID data[10] +#define tPartyId data[10] -#define TASK_BIT_CAN_STOP 0x1 -#define TASK_BIT_LEARN_MOVE 0x80 +#define TASK_BIT_CAN_STOP (1 << 0) +#define TASK_BIT_LEARN_MOVE (1 << 7) -static void Task_BeginEvolutionScene(u8 taskID) +static void Task_BeginEvolutionScene(u8 taskId) { struct Pokemon* mon = NULL; - switch (gTasks[taskID].tState) + switch (gTasks[taskId].tState) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); - gTasks[taskID].tState++; + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); + gTasks[taskId].tState++; break; case 1: if (!gPaletteFade.active) { - u16 speciesToEvolve; + u16 postEvoSpecies; bool8 canStopEvo; - u8 partyID; + u8 partyId; - mon = &gPlayerParty[gTasks[taskID].tPartyID]; - speciesToEvolve = gTasks[taskID].tPostEvoSpecies; - canStopEvo = gTasks[taskID].tCanStop; - partyID = gTasks[taskID].tPartyID; + mon = &gPlayerParty[gTasks[taskId].tPartyId]; + postEvoSpecies = gTasks[taskId].tPostEvoSpecies; + canStopEvo = gTasks[taskId].tCanStop; + partyId = gTasks[taskId].tPartyId; - DestroyTask(taskID); - EvolutionScene(mon, speciesToEvolve, canStopEvo, partyID); + DestroyTask(taskId); + EvolutionScene(mon, postEvoSpecies, canStopEvo, partyId); } break; } } -void BeginEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID) +void BeginEvolutionScene(struct Pokemon* mon, u16 postEvoSpecies, bool8 canStopEvo, u8 partyId) { - u8 taskID = CreateTask(Task_BeginEvolutionScene, 0); - gTasks[taskID].tState = 0; - gTasks[taskID].tPostEvoSpecies = speciesToEvolve; - gTasks[taskID].tCanStop = canStopEvo; - gTasks[taskID].tPartyID = partyID; + u8 taskId = CreateTask(Task_BeginEvolutionScene, 0); + gTasks[taskId].tState = 0; + gTasks[taskId].tPostEvoSpecies = postEvoSpecies; + gTasks[taskId].tCanStop = canStopEvo; + gTasks[taskId].tPartyId = partyId; SetMainCallback2(CB2_BeginEvolutionScene); } -void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID) +void EvolutionScene(struct Pokemon* mon, u16 postEvoSpecies, bool8 canStopEvo, u8 partyId) { u8 name[20]; u16 currSpecies; @@ -247,7 +251,7 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, GetMonData(mon, MON_DATA_NICKNAME, name); StringCopy10(gStringVar1, name); - StringCopy(gStringVar2, gSpeciesNames[speciesToEvolve]); + StringCopy(gStringVar2, gSpeciesNames[postEvoSpecies]); // preEvo sprite currSpecies = GetMonData(mon, MON_DATA_SPECIES); @@ -261,38 +265,38 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, SetMultiuseSpriteTemplateToPokemon(currSpecies, 1); gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable; - sEvoStructPtr->preEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30); + sEvoStructPtr->preEvoSpriteId = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30); gSprites[ID].callback = SpriteCallbackDummy_2; gSprites[ID].oam.paletteNum = 1; gSprites[ID].invisible = TRUE; // postEvo sprite - DecompressPicFromTable_2(&gMonFrontPicTable[speciesToEvolve], + DecompressPicFromTable_2(&gMonFrontPicTable[postEvoSpecies], gMonSpritesGfxPtr->sprites.ptr[3], - speciesToEvolve); - pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, trainerId, personality); + postEvoSpecies); + pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, trainerId, personality); LoadCompressedPalette(pokePal->data, 0x120, 0x20); - SetMultiuseSpriteTemplateToPokemon(speciesToEvolve, 3); + SetMultiuseSpriteTemplateToPokemon(postEvoSpecies, 3); gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable; - sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30); + sEvoStructPtr->postEvoSpriteId = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30); gSprites[ID].callback = SpriteCallbackDummy_2; gSprites[ID].oam.paletteNum = 2; gSprites[ID].invisible = TRUE; LoadEvoSparkleSpriteAndPal(); - sEvoStructPtr->evoTaskID = ID = CreateTask(Task_EvolutionScene, 0); + sEvoStructPtr->evoTaskId = ID = CreateTask(Task_EvolutionScene, 0); gTasks[ID].tState = 0; gTasks[ID].tPreEvoSpecies = currSpecies; - gTasks[ID].tPostEvoSpecies = speciesToEvolve; + gTasks[ID].tPostEvoSpecies = postEvoSpecies; gTasks[ID].tCanStop = canStopEvo; gTasks[ID].tLearnsFirstMove = TRUE; gTasks[ID].tEvoWasStopped = FALSE; - gTasks[ID].tPartyID = partyID; + gTasks[ID].tPartyId = partyId; - memcpy(&sEvoStructPtr->savedPalette, &gPlttBufferUnfaded[0x20], 0x60); + memcpy(&sEvoStructPtr->savedPalette, &gPlttBufferUnfaded[0x20], sizeof(sEvoStructPtr->savedPalette)); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP); @@ -308,11 +312,11 @@ static void CB2_EvolutionSceneLoadGraphics(void) const struct CompressedSpritePalette* pokePal; u16 postEvoSpecies; u32 trainerId, personality; - struct Pokemon* Mon = &gPlayerParty[gTasks[sEvoStructPtr->evoTaskID].tPartyID]; + struct Pokemon* mon = &gPlayerParty[gTasks[sEvoStructPtr->evoTaskId].tPartyId]; - postEvoSpecies = gTasks[sEvoStructPtr->evoTaskID].tPostEvoSpecies; - trainerId = GetMonData(Mon, MON_DATA_OT_ID); - personality = GetMonData(Mon, MON_DATA_PERSONALITY); + postEvoSpecies = gTasks[sEvoStructPtr->evoTaskId].tPostEvoSpecies; + trainerId = GetMonData(mon, MON_DATA_OT_ID); + personality = GetMonData(mon, MON_DATA_PERSONALITY); SetHBlankCallback(NULL); SetVBlankCallback(NULL); @@ -354,7 +358,7 @@ static void CB2_EvolutionSceneLoadGraphics(void) SetMultiuseSpriteTemplateToPokemon(postEvoSpecies, 3); gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable; - sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30); + sEvoStructPtr->postEvoSpriteId = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30); gSprites[ID].callback = SpriteCallbackDummy_2; gSprites[ID].oam.paletteNum = 2; @@ -365,7 +369,7 @@ static void CB2_EvolutionSceneLoadGraphics(void) SetVBlankCallback(VBlankCB_EvolutionScene); SetMainCallback2(CB2_EvolutionSceneUpdate); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); ShowBg(0); ShowBg(1); @@ -375,8 +379,8 @@ static void CB2_EvolutionSceneLoadGraphics(void) static void CB2_TradeEvolutionSceneLoadGraphics(void) { - struct Pokemon* Mon = &gPlayerParty[gTasks[sEvoStructPtr->evoTaskID].tPartyID]; - u16 postEvoSpecies = gTasks[sEvoStructPtr->evoTaskID].tPostEvoSpecies; + struct Pokemon* mon = &gPlayerParty[gTasks[sEvoStructPtr->evoTaskId].tPartyId]; + u16 postEvoSpecies = gTasks[sEvoStructPtr->evoTaskId].tPostEvoSpecies; switch (gMain.state) { @@ -415,8 +419,8 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void) case 4: { const struct CompressedSpritePalette* pokePal; - u32 trainerId = GetMonData(Mon, MON_DATA_OT_ID); - u32 personality = GetMonData(Mon, MON_DATA_PERSONALITY); + u32 trainerId = GetMonData(mon, MON_DATA_OT_ID); + u32 personality = GetMonData(mon, MON_DATA_PERSONALITY); DecompressPicFromTable_2(&gMonFrontPicTable[postEvoSpecies], gMonSpritesGfxPtr->sprites.ptr[3], postEvoSpecies); @@ -431,7 +435,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void) SetMultiuseSpriteTemplateToPokemon(postEvoSpecies, 1); gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable; - sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30); + sEvoStructPtr->postEvoSpriteId = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30); gSprites[ID].callback = SpriteCallbackDummy_2; gSprites[ID].oam.paletteNum = 2; @@ -445,11 +449,11 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void) LoadWirelessStatusIndicatorSpriteGfx(); CreateWirelessStatusIndicatorSprite(0, 0); } - BlendPalettes(-1,0x10, 0); + BlendPalettes(PALETTES_ALL, 0x10, 0); gMain.state++; break; case 7: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); InitTradeSequenceBgGpuRegs(); ShowBg(0); ShowBg(1); @@ -459,7 +463,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void) } } -void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpriteID, u8 partyID) +void TradeEvolutionScene(struct Pokemon* mon, u16 postEvoSpecies, u8 preEvoSpriteId, u8 partyId) { u8 name[20]; u16 currSpecies; @@ -469,7 +473,7 @@ void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpri GetMonData(mon, MON_DATA_NICKNAME, name); StringCopy10(gStringVar1, name); - StringCopy(gStringVar2, gSpeciesNames[speciesToEvolve]); + StringCopy(gStringVar2, gSpeciesNames[postEvoSpecies]); gAffineAnimsDisabled = TRUE; @@ -479,18 +483,18 @@ void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpri trainerId = GetMonData(mon, MON_DATA_OT_ID); sEvoStructPtr = AllocZeroed(sizeof(struct EvoInfo)); - sEvoStructPtr->preEvoSpriteID = preEvoSpriteID; + sEvoStructPtr->preEvoSpriteId = preEvoSpriteId; - DecompressPicFromTable_2(&gMonFrontPicTable[speciesToEvolve], + DecompressPicFromTable_2(&gMonFrontPicTable[postEvoSpecies], gMonSpritesGfxPtr->sprites.ptr[1], - speciesToEvolve); + postEvoSpecies); - pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, trainerId, personality); + pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, trainerId, personality); LoadCompressedPalette(pokePal->data, 0x120, 0x20); - SetMultiuseSpriteTemplateToPokemon(speciesToEvolve, 1); + SetMultiuseSpriteTemplateToPokemon(postEvoSpecies, 1); gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable; - sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30); + sEvoStructPtr->postEvoSpriteId = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30); gSprites[ID].callback = SpriteCallbackDummy_2; gSprites[ID].oam.paletteNum = 2; @@ -498,13 +502,13 @@ void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpri LoadEvoSparkleSpriteAndPal(); - sEvoStructPtr->evoTaskID = ID = CreateTask(Task_TradeEvolutionScene, 0); + sEvoStructPtr->evoTaskId = ID = CreateTask(Task_TradeEvolutionScene, 0); gTasks[ID].tState = 0; gTasks[ID].tPreEvoSpecies = currSpecies; - gTasks[ID].tPostEvoSpecies = speciesToEvolve; + gTasks[ID].tPostEvoSpecies = postEvoSpecies; gTasks[ID].tLearnsFirstMove = TRUE; gTasks[ID].tEvoWasStopped = FALSE; - gTasks[ID].tPartyID = partyID; + gTasks[ID].tPartyId = partyId; gBattle_BG0_X = 0; gBattle_BG0_Y = 0; @@ -542,7 +546,7 @@ static void CB2_TradeEvolutionSceneUpdate(void) static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) { u32 data = 0; - if (gEvolutionTable[preEvoSpecies][0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < 6) + if (gEvolutionTable[preEvoSpecies][0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < PARTY_SIZE) { s32 i; struct Pokemon* shedinja = &gPlayerParty[gPlayerPartyCount]; @@ -550,20 +554,20 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) const struct Evolution *evos2; CopyMon(&gPlayerParty[gPlayerPartyCount], mon, sizeof(struct Pokemon)); - SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, (&gEvolutionTable[preEvoSpecies][1].targetSpecies)); - SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_NICKNAME, (gSpeciesNames[gEvolutionTable[preEvoSpecies][1].targetSpecies])); - SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_HELD_ITEM, (&data)); - SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, (&data)); - SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_ENCRYPT_SEPARATOR, (&data)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, &gEvolutionTable[preEvoSpecies][1].targetSpecies); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_NICKNAME, gSpeciesNames[gEvolutionTable[preEvoSpecies][1].targetSpecies]); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_HELD_ITEM, &data); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, &data); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_ENCRYPT_SEPARATOR, &data); - for (i = MON_DATA_COOL_RIBBON; i < MON_DATA_COOL_RIBBON + 5; i++) - SetMonData(&gPlayerParty[gPlayerPartyCount], i, (&data)); - for (i = MON_DATA_CHAMPION_RIBBON; i <= MON_DATA_FATEFUL_ENCOUNTER; i++) - SetMonData(&gPlayerParty[gPlayerPartyCount], i, (&data)); + for (i = MON_DATA_COOL_RIBBON; i < MON_DATA_COOL_RIBBON + CONTEST_CATEGORIES_COUNT; i++) + SetMonData(&gPlayerParty[gPlayerPartyCount], i, &data); + for (i = MON_DATA_CHAMPION_RIBBON; i <= MON_DATA_UNUSED_RIBBONS; i++) + SetMonData(&gPlayerParty[gPlayerPartyCount], i, &data); - SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_STATUS, (&data)); - data = 0xFF; - SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MAIL, (&data)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_STATUS, &data); + data = MAIL_NONE; + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MAIL, &data); CalculateMonStats(&gPlayerParty[gPlayerPartyCount]); CalculatePlayerPartyCount(); @@ -578,195 +582,243 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) if (GetMonData(shedinja, MON_DATA_SPECIES) == SPECIES_SHEDINJA && GetMonData(shedinja, MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE && GetMonData(mon, MON_DATA_SPECIES) == SPECIES_NINJASK) - SetMonData(shedinja, MON_DATA_NICKNAME, Text_ShedinjaJapaneseName); + SetMonData(shedinja, MON_DATA_NICKNAME, sText_ShedinjaJapaneseName); } } -static void Task_EvolutionScene(u8 taskID) +// States for the main switch in Task_EvolutionScene +enum { + EVOSTATE_FADE_IN, + EVOSTATE_INTRO_MSG, + EVOSTATE_INTRO_MON_ANIM, + EVOSTATE_INTRO_SOUND, + EVOSTATE_START_MUSIC, + EVOSTATE_START_BG_AND_SPARKLE_SPIRAL, + EVOSTATE_SPARKLE_ARC, + EVOSTATE_CYCLE_MON_SPRITE, + EVOSTATE_WAIT_CYCLE_MON_SPRITE, + EVOSTATE_SPARKLE_CIRCLE, + EVOSTATE_SPARKLE_SPRAY, + EVOSTATE_EVO_SOUND, + EVOSTATE_RESTORE_SCREEN, + EVOSTATE_EVO_MON_ANIM, + EVOSTATE_SET_MON_EVOLVED, + EVOSTATE_TRY_LEARN_MOVE, + EVOSTATE_END, + EVOSTATE_CANCEL, + EVOSTATE_CANCEL_MON_ANIM, + EVOSTATE_CANCEL_MSG, + EVOSTATE_LEARNED_MOVE, + EVOSTATE_TRY_LEARN_ANOTHER_MOVE, + EVOSTATE_REPLACE_MOVE, +}; + +// States for the switch in EVOSTATE_REPLACE_MOVE +enum { + MVSTATE_INTRO_MSG_1, + MVSTATE_INTRO_MSG_2, + MVSTATE_INTRO_MSG_3, + MVSTATE_PRINT_YES_NO, + MVSTATE_HANDLE_YES_NO, + MVSTATE_SHOW_MOVE_SELECT, + MVSTATE_HANDLE_MOVE_SELECT, + MVSTATE_FORGET_MSG_1, + MVSTATE_FORGET_MSG_2, + MVSTATE_LEARNED_MOVE, + MVSTATE_ASK_CANCEL, + MVSTATE_CANCEL, + MVSTATE_RETRY_AFTER_HM, +}; + +// Task data from CycleEvolutionMonSprite +#define tEvoStopped data[8] + +static void Task_EvolutionScene(u8 taskId) { u32 var; - struct Pokemon* mon = &gPlayerParty[gTasks[taskID].tPartyID]; + struct Pokemon* mon = &gPlayerParty[gTasks[taskId].tPartyId]; // check if B Button was held, so the evolution gets stopped if (gMain.heldKeys == B_BUTTON - && gTasks[taskID].tState == 8 - && gTasks[sEvoGraphicsTaskID].isActive - && gTasks[taskID].tBits & TASK_BIT_CAN_STOP) + && gTasks[taskId].tState == EVOSTATE_WAIT_CYCLE_MON_SPRITE + && gTasks[sEvoGraphicsTaskId].isActive + && gTasks[taskId].tBits & TASK_BIT_CAN_STOP) { - gTasks[taskID].tState = 17; - gTasks[sEvoGraphicsTaskID].EvoGraphicsTaskEvoStop = TRUE; - sub_8140134(); + gTasks[taskId].tState = EVOSTATE_CANCEL; + gTasks[sEvoGraphicsTaskId].tEvoStopped = TRUE; + StopBgAnimation(); return; } - switch (gTasks[taskID].tState) + switch (gTasks[taskId].tState) { - case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); - gSprites[sEvoStructPtr->preEvoSpriteID].invisible = FALSE; - gTasks[taskID].tState++; + case EVOSTATE_FADE_IN: + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); + gSprites[sEvoStructPtr->preEvoSpriteId].invisible = FALSE; + gTasks[taskId].tState++; ShowBg(0); ShowBg(1); ShowBg(2); ShowBg(3); break; - case 1: // print 'whoa, poke is evolving!!!' msg + case EVOSTATE_INTRO_MSG: if (!gPaletteFade.active) { StringExpandPlaceholders(gStringVar4, gText_PkmnIsEvolving); BattlePutTextOnWindow(gStringVar4, 0); - gTasks[taskID].tState++; + gTasks[taskId].tState++; } break; - case 2: // wait for string, animate mon(and play its cry) + case EVOSTATE_INTRO_MON_ANIM: if (!IsTextPrinterActive(0)) { - EvoScene_DoMonAnimation(sEvoStructPtr->preEvoSpriteID, gTasks[taskID].tPreEvoSpecies); - gTasks[taskID].tState++; + EvoScene_DoMonAnimAndCry(sEvoStructPtr->preEvoSpriteId, gTasks[taskId].tPreEvoSpecies); + gTasks[taskId].tState++; } break; - case 3: - if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteID)) // wait for animation, play tu du SE + case EVOSTATE_INTRO_SOUND: + if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteId)) { PlaySE(MUS_EVOLUTION_INTRO); - gTasks[taskID].tState++; + gTasks[taskId].tState++; } break; - case 4: // play evolution music and fade screen black + case EVOSTATE_START_MUSIC: if (!IsSEPlaying()) { + // Start music, fade background to black PlayNewMapMusic(MUS_EVOLUTION); - gTasks[taskID].tState++; + gTasks[taskId].tState++; BeginNormalPaletteFade(0x1C, 4, 0, 0x10, RGB_BLACK); } break; - case 5: // launch moving bg task, preapre evo sparkles + case EVOSTATE_START_BG_AND_SPARKLE_SPIRAL: if (!gPaletteFade.active) { - InitMovingBackgroundTask(FALSE); - sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet1(17); - gTasks[taskID].tState++; + StartBgAnimation(FALSE); + sEvoGraphicsTaskId = EvolutionSparkles_SpiralUpward(17); + gTasks[taskId].tState++; } break; - case 6: // another set of evo sparkles - if (!gTasks[sEvoGraphicsTaskID].isActive) + case EVOSTATE_SPARKLE_ARC: + if (!gTasks[sEvoGraphicsTaskId].isActive) { - gTasks[taskID].tState++; - sEvoStructPtr->field_3 = 1; - sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet2(); + gTasks[taskId].tState++; + sEvoStructPtr->delayTimer = 1; + sEvoGraphicsTaskId = EvolutionSparkles_ArcDown(); } break; - case 7: // launch task that flashes pre evo with post evo sprites - if (!gTasks[sEvoGraphicsTaskID].isActive) + case EVOSTATE_CYCLE_MON_SPRITE: // launch task that flashes pre evo with post evo sprites + if (!gTasks[sEvoGraphicsTaskId].isActive) { - sEvoGraphicsTaskID = sub_817C3A0(sEvoStructPtr->preEvoSpriteID, sEvoStructPtr->postEvoSpriteID); - gTasks[taskID].tState++; + sEvoGraphicsTaskId = CycleEvolutionMonSprite(sEvoStructPtr->preEvoSpriteId, sEvoStructPtr->postEvoSpriteId); + gTasks[taskId].tState++; } break; - case 8: // wait for the above task to finish - if (--sEvoStructPtr->field_3 == 0) + case EVOSTATE_WAIT_CYCLE_MON_SPRITE: + if (--sEvoStructPtr->delayTimer == 0) { - sEvoStructPtr->field_3 = 3; - if (!gTasks[sEvoGraphicsTaskID].isActive) - gTasks[taskID].tState++; + sEvoStructPtr->delayTimer = 3; + if (!gTasks[sEvoGraphicsTaskId].isActive) + gTasks[taskId].tState++; } break; - case 9: // post evo sparkles - sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet1(); - gTasks[taskID].tState++; + case EVOSTATE_SPARKLE_CIRCLE: + sEvoGraphicsTaskId = EvolutionSparkles_CircleInward(); + gTasks[taskId].tState++; break; - case 10: - if (!gTasks[sEvoGraphicsTaskID].isActive) + case EVOSTATE_SPARKLE_SPRAY: + if (!gTasks[sEvoGraphicsTaskId].isActive) { - sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet2AndFlash(gTasks[taskID].tPostEvoSpecies); - gTasks[taskID].tState++; + sEvoGraphicsTaskId = EvolutionSparkles_SprayAndFlash(gTasks[taskId].tPostEvoSpecies); + gTasks[taskId].tState++; } break; - case 11: // play tu du sound after evolution - if (!gTasks[sEvoGraphicsTaskID].isActive) + case EVOSTATE_EVO_SOUND: + if (!gTasks[sEvoGraphicsTaskId].isActive) { PlaySE(SE_EXP); - gTasks[taskID].tState++; + gTasks[taskId].tState++; } break; - case 12: // stop music, return screen to pre-fade state + case EVOSTATE_RESTORE_SCREEN: // stop music, return screen to pre-fade state if (IsSEPlaying()) { m4aMPlayAllStop(); - memcpy(&gPlttBufferUnfaded[0x20], sEvoStructPtr->savedPalette, 0x60); - sub_8140174(); + memcpy(&gPlttBufferUnfaded[0x20], sEvoStructPtr->savedPalette, sizeof(sEvoStructPtr->savedPalette)); + RestoreBgAfterAnim(); BeginNormalPaletteFade(0x1C, 0, 0x10, 0, RGB_BLACK); - gTasks[taskID].tState++; + gTasks[taskId].tState++; } break; - case 13: // animate mon + case EVOSTATE_EVO_MON_ANIM: if (!gPaletteFade.active) { - EvoScene_DoMonAnimation(sEvoStructPtr->postEvoSpriteID, gTasks[taskID].tPostEvoSpecies); - gTasks[taskID].tState++; + EvoScene_DoMonAnimAndCry(sEvoStructPtr->postEvoSpriteId, gTasks[taskId].tPostEvoSpecies); + gTasks[taskId].tState++; } break; - case 14: // congratulations string and rename prompt + case EVOSTATE_SET_MON_EVOLVED: if (IsCryFinished()) { StringExpandPlaceholders(gStringVar4, gText_CongratsPkmnEvolved); BattlePutTextOnWindow(gStringVar4, 0); PlayBGM(MUS_EVOLVED); - gTasks[taskID].tState++; - SetMonData(mon, MON_DATA_SPECIES, (void*)(&gTasks[taskID].tPostEvoSpecies)); + gTasks[taskId].tState++; + SetMonData(mon, MON_DATA_SPECIES, (void*)(&gTasks[taskId].tPostEvoSpecies)); CalculateMonStats(mon); - EvolutionRenameMon(mon, gTasks[taskID].tPreEvoSpecies, gTasks[taskID].tPostEvoSpecies); - GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_SEEN); - GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_CAUGHT); + EvolutionRenameMon(mon, gTasks[taskId].tPreEvoSpecies, gTasks[taskId].tPostEvoSpecies); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskId].tPostEvoSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskId].tPostEvoSpecies), FLAG_SET_CAUGHT); IncrementGameStat(GAME_STAT_EVOLVED_POKEMON); } break; - case 15: // check if it wants to learn a new move + case EVOSTATE_TRY_LEARN_MOVE: if (!IsTextPrinterActive(0)) { - var = MonTryLearningNewMove(mon, gTasks[taskID].tLearnsFirstMove); - if (var != 0 && !gTasks[taskID].tEvoWasStopped) + var = MonTryLearningNewMove(mon, gTasks[taskId].tLearnsFirstMove); + if (var != MOVE_NONE && !gTasks[taskId].tEvoWasStopped) { u8 text[20]; - if (!(gTasks[taskID].tBits & TASK_BIT_LEARN_MOVE)) + if (!(gTasks[taskId].tBits & TASK_BIT_LEARN_MOVE)) { StopMapMusic(); Overworld_PlaySpecialMapMusic(); } - gTasks[taskID].tBits |= TASK_BIT_LEARN_MOVE; - gTasks[taskID].tLearnsFirstMove = FALSE; - gTasks[taskID].tLearnMoveState = 0; + gTasks[taskId].tBits |= TASK_BIT_LEARN_MOVE; + gTasks[taskId].tLearnsFirstMove = FALSE; + gTasks[taskId].tLearnMoveState = MVSTATE_INTRO_MSG_1; GetMonData(mon, MON_DATA_NICKNAME, text); StringCopy10(gBattleTextBuff1, text); if (var == MON_HAS_MAX_MOVES) - gTasks[taskID].tState = 22; + gTasks[taskId].tState = EVOSTATE_REPLACE_MOVE; else if (var == MON_ALREADY_KNOWS_MOVE) break; else - gTasks[taskID].tState = 20; // move has been learned + gTasks[taskId].tState = EVOSTATE_LEARNED_MOVE; } - else // no move to learn + else // no move to learn, or evolution was canceled { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); - gTasks[taskID].tState++; + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); + gTasks[taskId].tState++; } } break; - case 16: // task has finished, return + case EVOSTATE_END: if (!gPaletteFade.active) { - if (!(gTasks[taskID].tBits & TASK_BIT_LEARN_MOVE)) + if (!(gTasks[taskId].tBits & TASK_BIT_LEARN_MOVE)) { StopMapMusic(); Overworld_PlaySpecialMapMusic(); } - if (!gTasks[taskID].tEvoWasStopped) - CreateShedinja(gTasks[taskID].tPreEvoSpecies, mon); + if (!gTasks[taskId].tEvoWasStopped) + CreateShedinja(gTasks[taskId].tPreEvoSpecies, mon); - DestroyTask(taskID); + DestroyTask(taskId); FreeMonSpritesGfx(); Free(sEvoStructPtr); sEvoStructPtr = NULL; @@ -774,91 +826,98 @@ static void Task_EvolutionScene(u8 taskID) SetMainCallback2(gCB2_AfterEvolution); } break; - case 17: // evolution has been canceled, stop music and re-fade palette - if (!gTasks[sEvoGraphicsTaskID].isActive) + case EVOSTATE_CANCEL: + if (!gTasks[sEvoGraphicsTaskId].isActive) { m4aMPlayAllStop(); BeginNormalPaletteFade(0x6001C, 0, 0x10, 0, RGB_WHITE); - gTasks[taskID].tState++; + gTasks[taskId].tState++; } break; - case 18: // animate pokemon trying to evolve again, evolution has been stopped + case EVOSTATE_CANCEL_MON_ANIM: if (!gPaletteFade.active) { - EvoScene_DoMonAnimation(sEvoStructPtr->preEvoSpriteID, gTasks[taskID].tPreEvoSpecies); - gTasks[taskID].tState++; + EvoScene_DoMonAnimAndCry(sEvoStructPtr->preEvoSpriteId, gTasks[taskId].tPreEvoSpecies); + gTasks[taskId].tState++; } break; - case 19: // after the animation, print the string 'WHOA IT DID NOT EVOLVE!!!' - if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteID)) + case EVOSTATE_CANCEL_MSG: + if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteId)) { - if (gTasks[taskID].tEvoWasStopped) + if (gTasks[taskId].tEvoWasStopped) StringExpandPlaceholders(gStringVar4, gText_EllipsisQuestionMark); else // Fire Red leftover probably StringExpandPlaceholders(gStringVar4, gText_PkmnStoppedEvolving); BattlePutTextOnWindow(gStringVar4, 0); - gTasks[taskID].tEvoWasStopped = TRUE; - gTasks[taskID].tState = 15; + gTasks[taskId].tEvoWasStopped = TRUE; + gTasks[taskId].tState = EVOSTATE_TRY_LEARN_MOVE; } break; - case 20: // pokemon learned a new move, print string and play a fanfare + case EVOSTATE_LEARNED_MOVE: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { BufferMoveToLearnIntoBattleTextBuff2(); PlayFanfare(MUS_LEVEL_UP); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_ID_ADDER]); BattlePutTextOnWindow(gDisplayedStringBattle, 0); - gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter - gTasks[taskID].tState++; + gTasks[taskId].tLearnsFirstMove = 0x40; // re-used as a counter + gTasks[taskId].tState++; } break; - case 21: // wait a bit and check if can learn another move - if (!IsTextPrinterActive(0) && !IsSEPlaying() && --gTasks[taskID].tLearnsFirstMove == 0) - gTasks[taskID].tState = 15; + case EVOSTATE_TRY_LEARN_ANOTHER_MOVE: + if (!IsTextPrinterActive(0) && !IsSEPlaying() && --gTasks[taskId].tLearnsFirstMove == 0) + gTasks[taskId].tState = EVOSTATE_TRY_LEARN_MOVE; break; - case 22: // try to learn a new move - switch (gTasks[taskID].tLearnMoveState) + case EVOSTATE_REPLACE_MOVE: + switch (gTasks[taskId].tLearnMoveState) { - case 0: + case MVSTATE_INTRO_MSG_1: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { + // "{mon} is trying to learn {move}" BufferMoveToLearnIntoBattleTextBuff2(); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_ID_ADDER]); BattlePutTextOnWindow(gDisplayedStringBattle, 0); - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveState++; } break; - case 1: + case MVSTATE_INTRO_MSG_2: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { + // "But, {mon} can't learn more than four moves" BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_ID_ADDER]); BattlePutTextOnWindow(gDisplayedStringBattle, 0); - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveState++; } break; - case 2: + case MVSTATE_INTRO_MSG_3: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { + // "Delete a move to make room for {move}?" BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_ID_ADDER]); BattlePutTextOnWindow(gDisplayedStringBattle, 0); - gTasks[taskID].tData7 = 5; - gTasks[taskID].tData8 = 10; - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveYesState = MVSTATE_SHOW_MOVE_SELECT; + gTasks[taskId].tLearnMoveNoState = MVSTATE_ASK_CANCEL; + gTasks[taskId].tLearnMoveState++; } - case 3: + case MVSTATE_PRINT_YES_NO: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); BattlePutTextOnWindow(gText_BattleYesNoChoice, 0xC); - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveState++; sEvoCursorPos = 0; BattleCreateYesNoCursorAt(0); } break; - case 4: + case MVSTATE_HANDLE_YES_NO: + // This Yes/No is used for both the initial "delete move?" prompt + // and for the "stop learning move?" prompt + // What Yes/No do next is determined by tLearnMoveYesState / tLearnMoveNoState if (JOY_NEW(DPAD_UP) && sEvoCursorPos != 0) { + // Moved onto YES PlaySE(SE_SELECT); BattleDestroyYesNoCursorAt(sEvoCursorPos); sEvoCursorPos = 0; @@ -866,6 +925,7 @@ static void Task_EvolutionScene(u8 taskID) } if (JOY_NEW(DPAD_DOWN) && sEvoCursorPos == 0) { + // Moved onto NO PlaySE(SE_SELECT); BattleDestroyYesNoCursorAt(sEvoCursorPos); sEvoCursorPos = 1; @@ -878,350 +938,403 @@ static void Task_EvolutionScene(u8 taskID) if (sEvoCursorPos != 0) { - gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8; + // NO + gTasks[taskId].tLearnMoveState = gTasks[taskId].tLearnMoveNoState; } else { - gTasks[taskID].tLearnMoveState = gTasks[taskID].tData7; - if (gTasks[taskID].tLearnMoveState == 5) - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + // YES + gTasks[taskId].tLearnMoveState = gTasks[taskId].tLearnMoveYesState; + if (gTasks[taskId].tLearnMoveState == MVSTATE_SHOW_MOVE_SELECT) + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); } } if (JOY_NEW(B_BUTTON)) { + // Equivalent to selecting NO HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); PlaySE(SE_SELECT); - gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8; + gTasks[taskId].tLearnMoveState = gTasks[taskId].tLearnMoveNoState; } break; - case 5: + case MVSTATE_SHOW_MOVE_SELECT: if (!gPaletteFade.active) { FreeAllWindowBuffers(); - ShowSelectMovePokemonSummaryScreen(gPlayerParty, gTasks[taskID].tPartyID, + ShowSelectMovePokemonSummaryScreen(gPlayerParty, gTasks[taskId].tPartyId, gPlayerPartyCount - 1, CB2_EvolutionSceneLoadGraphics, gMoveToLearn); - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveState++; } break; - case 6: + case MVSTATE_HANDLE_MOVE_SELECT: if (!gPaletteFade.active && gMain.callback2 == CB2_EvolutionSceneUpdate) { var = GetMoveSlotToReplace(); if (var == MAX_MON_MOVES) { - gTasks[taskID].tLearnMoveState = 10; + // Didn't select move slot + gTasks[taskId].tLearnMoveState = MVSTATE_ASK_CANCEL; } else { + // Selected move to forget u16 move = GetMonData(mon, var + MON_DATA_MOVE1); if (IsHMMove2(move)) { + // Can't forget HMs BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_ID_ADDER]); BattlePutTextOnWindow(gDisplayedStringBattle, 0); - gTasks[taskID].tLearnMoveState = 12; + gTasks[taskId].tLearnMoveState = MVSTATE_RETRY_AFTER_HM; } else { + // Forget move PREPARE_MOVE_BUFFER(gBattleTextBuff2, move) RemoveMonPPBonus(mon, var); SetMonMoveSlot(mon, gMoveToLearn, var); - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveState++; } } } break; - case 7: + case MVSTATE_FORGET_MSG_1: BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF - BATTLESTRINGS_ID_ADDER]); BattlePutTextOnWindow(gDisplayedStringBattle, 0); - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveState++; break; - case 8: + case MVSTATE_FORGET_MSG_2: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_ID_ADDER]); BattlePutTextOnWindow(gDisplayedStringBattle, 0); - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveState++; } break; - case 9: + case MVSTATE_LEARNED_MOVE: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS - BATTLESTRINGS_ID_ADDER]); BattlePutTextOnWindow(gDisplayedStringBattle, 0); - gTasks[taskID].tState = 20; + gTasks[taskId].tState = EVOSTATE_LEARNED_MOVE; } break; - case 10: + case MVSTATE_ASK_CANCEL: BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_ID_ADDER]); BattlePutTextOnWindow(gDisplayedStringBattle, 0); - gTasks[taskID].tData7 = 11; - gTasks[taskID].tData8 = 0; - gTasks[taskID].tLearnMoveState = 3; + gTasks[taskId].tLearnMoveYesState = MVSTATE_CANCEL; + gTasks[taskId].tLearnMoveNoState = MVSTATE_INTRO_MSG_1; + gTasks[taskId].tLearnMoveState = MVSTATE_PRINT_YES_NO; break; - case 11: + case MVSTATE_CANCEL: BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_ID_ADDER]); BattlePutTextOnWindow(gDisplayedStringBattle, 0); - gTasks[taskID].tState = 15; + gTasks[taskId].tState = EVOSTATE_TRY_LEARN_MOVE; break; - case 12: + case MVSTATE_RETRY_AFTER_HM: if (!IsTextPrinterActive(0) && !IsSEPlaying()) - gTasks[taskID].tLearnMoveState = 5; + gTasks[taskId].tLearnMoveState = MVSTATE_SHOW_MOVE_SELECT; break; } break; } } -static void Task_TradeEvolutionScene(u8 taskID) +// States for the main switch in Task_TradeEvolutionScene +enum { + T_EVOSTATE_INTRO_MSG, + T_EVOSTATE_INTRO_CRY, + T_EVOSTATE_INTRO_SOUND, + T_EVOSTATE_START_MUSIC, + T_EVOSTATE_START_BG_AND_SPARKLE_SPIRAL, + T_EVOSTATE_SPARKLE_ARC, + T_EVOSTATE_CYCLE_MON_SPRITE, + T_EVOSTATE_WAIT_CYCLE_MON_SPRITE, + T_EVOSTATE_SPARKLE_CIRCLE, + T_EVOSTATE_SPARKLE_SPRAY, + T_EVOSTATE_EVO_SOUND, + T_EVOSTATE_EVO_MON_ANIM, + T_EVOSTATE_SET_MON_EVOLVED, + T_EVOSTATE_TRY_LEARN_MOVE, + T_EVOSTATE_END, + T_EVOSTATE_CANCEL, + T_EVOSTATE_CANCEL_MON_ANIM, + T_EVOSTATE_CANCEL_MSG, + T_EVOSTATE_LEARNED_MOVE, + T_EVOSTATE_TRY_LEARN_ANOTHER_MOVE, + T_EVOSTATE_REPLACE_MOVE, +}; + +// States for the switch in T_EVOSTATE_REPLACE_MOVE +enum { + T_MVSTATE_INTRO_MSG_1, + T_MVSTATE_INTRO_MSG_2, + T_MVSTATE_INTRO_MSG_3, + T_MVSTATE_PRINT_YES_NO, + T_MVSTATE_HANDLE_YES_NO, + T_MVSTATE_SHOW_MOVE_SELECT, + T_MVSTATE_HANDLE_MOVE_SELECT, + T_MVSTATE_FORGET_MSG, + T_MVSTATE_LEARNED_MOVE, + T_MVSTATE_ASK_CANCEL, + T_MVSTATE_CANCEL, + T_MVSTATE_RETRY_AFTER_HM, +}; + +// Compare to Task_EvolutionScene, very similar +static void Task_TradeEvolutionScene(u8 taskId) { u32 var = 0; - struct Pokemon* mon = &gPlayerParty[gTasks[taskID].tPartyID]; + struct Pokemon* mon = &gPlayerParty[gTasks[taskId].tPartyId]; - switch (gTasks[taskID].tState) + switch (gTasks[taskId].tState) { - case 0: + case T_EVOSTATE_INTRO_MSG: StringExpandPlaceholders(gStringVar4, gText_PkmnIsEvolving); DrawTextOnTradeWindow(0, gStringVar4, 1); - gTasks[taskID].tState++; + gTasks[taskId].tState++; break; - case 1: + case T_EVOSTATE_INTRO_CRY: if (!IsTextPrinterActive(0)) { - PlayCry1(gTasks[taskID].tPreEvoSpecies, 0); - gTasks[taskID].tState++; + PlayCry1(gTasks[taskId].tPreEvoSpecies, 0); + gTasks[taskId].tState++; } break; - case 2: + case T_EVOSTATE_INTRO_SOUND: if (IsCryFinished()) { m4aSongNumStop(MUS_EVOLUTION); PlaySE(MUS_EVOLUTION_INTRO); - gTasks[taskID].tState++; + gTasks[taskId].tState++; } break; - case 3: + case T_EVOSTATE_START_MUSIC: if (!IsSEPlaying()) { PlayBGM(MUS_EVOLUTION); - gTasks[taskID].tState++; + gTasks[taskId].tState++; BeginNormalPaletteFade(0x1C, 4, 0, 0x10, RGB_BLACK); } break; - case 4: + case T_EVOSTATE_START_BG_AND_SPARKLE_SPIRAL: if (!gPaletteFade.active) { - InitMovingBackgroundTask(TRUE); - var = gSprites[sEvoStructPtr->preEvoSpriteID].oam.paletteNum + 16; - sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet1(var); - gTasks[taskID].tState++; + StartBgAnimation(TRUE); + var = gSprites[sEvoStructPtr->preEvoSpriteId].oam.paletteNum + 16; + sEvoGraphicsTaskId = EvolutionSparkles_SpiralUpward(var); + gTasks[taskId].tState++; SetGpuReg(REG_OFFSET_BG3CNT, 0x603); } break; - case 5: - if (!gTasks[sEvoGraphicsTaskID].isActive) + case T_EVOSTATE_SPARKLE_ARC: + if (!gTasks[sEvoGraphicsTaskId].isActive) { - gTasks[taskID].tState++; - sEvoStructPtr->field_3 = 1; - sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet2(); + gTasks[taskId].tState++; + sEvoStructPtr->delayTimer = 1; + sEvoGraphicsTaskId = EvolutionSparkles_ArcDown(); } break; - case 6: - if (!gTasks[sEvoGraphicsTaskID].isActive) + case T_EVOSTATE_CYCLE_MON_SPRITE: + if (!gTasks[sEvoGraphicsTaskId].isActive) { - sEvoGraphicsTaskID = sub_817C3A0(sEvoStructPtr->preEvoSpriteID, sEvoStructPtr->postEvoSpriteID); - gTasks[taskID].tState++; + sEvoGraphicsTaskId = CycleEvolutionMonSprite(sEvoStructPtr->preEvoSpriteId, sEvoStructPtr->postEvoSpriteId); + gTasks[taskId].tState++; } break; - case 7: - if (--sEvoStructPtr->field_3 == 0) + case T_EVOSTATE_WAIT_CYCLE_MON_SPRITE: + if (--sEvoStructPtr->delayTimer == 0) { - sEvoStructPtr->field_3 = 3; - if (!gTasks[sEvoGraphicsTaskID].isActive) - gTasks[taskID].tState++; + sEvoStructPtr->delayTimer = 3; + if (!gTasks[sEvoGraphicsTaskId].isActive) + gTasks[taskId].tState++; } break; - case 8: - sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet1(); - gTasks[taskID].tState++; + case T_EVOSTATE_SPARKLE_CIRCLE: + sEvoGraphicsTaskId = EvolutionSparkles_CircleInward(); + gTasks[taskId].tState++; break; - case 9: - if (!gTasks[sEvoGraphicsTaskID].isActive) + case T_EVOSTATE_SPARKLE_SPRAY: + if (!gTasks[sEvoGraphicsTaskId].isActive) { - sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet2AndFlash_Trade(gTasks[taskID].tPostEvoSpecies); - gTasks[taskID].tState++; + sEvoGraphicsTaskId = EvolutionSparkles_SprayAndFlash_Trade(gTasks[taskId].tPostEvoSpecies); + gTasks[taskId].tState++; } break; - case 10: - if (!gTasks[sEvoGraphicsTaskID].isActive) + case T_EVOSTATE_EVO_SOUND: + if (!gTasks[sEvoGraphicsTaskId].isActive) { PlaySE(SE_EXP); - gTasks[taskID].tState++; + gTasks[taskId].tState++; } break; - case 11: + case T_EVOSTATE_EVO_MON_ANIM: if (IsSEPlaying()) { - Free(sEvoMovingBgPtr); - EvoScene_DoMonAnimation(sEvoStructPtr->postEvoSpriteID, gTasks[taskID].tPostEvoSpecies); - memcpy(&gPlttBufferUnfaded[0x20], sEvoStructPtr->savedPalette, 0x60); - gTasks[taskID].tState++; + // Restore bg, do mon anim/cry + Free(sBgAnimPal); + EvoScene_DoMonAnimAndCry(sEvoStructPtr->postEvoSpriteId, gTasks[taskId].tPostEvoSpecies); + memcpy(&gPlttBufferUnfaded[0x20], sEvoStructPtr->savedPalette, sizeof(sEvoStructPtr->savedPalette)); + gTasks[taskId].tState++; } break; - case 12: + case T_EVOSTATE_SET_MON_EVOLVED: if (IsCryFinished()) { StringExpandPlaceholders(gStringVar4, gText_CongratsPkmnEvolved); DrawTextOnTradeWindow(0, gStringVar4, 1); PlayFanfare(MUS_EVOLVED); - gTasks[taskID].tState++; - SetMonData(mon, MON_DATA_SPECIES, (&gTasks[taskID].tPostEvoSpecies)); + gTasks[taskId].tState++; + SetMonData(mon, MON_DATA_SPECIES, (&gTasks[taskId].tPostEvoSpecies)); CalculateMonStats(mon); - EvolutionRenameMon(mon, gTasks[taskID].tPreEvoSpecies, gTasks[taskID].tPostEvoSpecies); - GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_SEEN); - GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_CAUGHT); + EvolutionRenameMon(mon, gTasks[taskId].tPreEvoSpecies, gTasks[taskId].tPostEvoSpecies); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskId].tPostEvoSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskId].tPostEvoSpecies), FLAG_SET_CAUGHT); IncrementGameStat(GAME_STAT_EVOLVED_POKEMON); } break; - case 13: + case T_EVOSTATE_TRY_LEARN_MOVE: if (!IsTextPrinterActive(0) && IsFanfareTaskInactive() == TRUE) { - var = MonTryLearningNewMove(mon, gTasks[taskID].tLearnsFirstMove); - if (var != 0 && !gTasks[taskID].tEvoWasStopped) + var = MonTryLearningNewMove(mon, gTasks[taskId].tLearnsFirstMove); + if (var != MOVE_NONE && !gTasks[taskId].tEvoWasStopped) { u8 text[20]; - gTasks[taskID].tBits |= TASK_BIT_LEARN_MOVE; - gTasks[taskID].tLearnsFirstMove = FALSE; - gTasks[taskID].tLearnMoveState = 0; + gTasks[taskId].tBits |= TASK_BIT_LEARN_MOVE; + gTasks[taskId].tLearnsFirstMove = FALSE; + gTasks[taskId].tLearnMoveState = 0; GetMonData(mon, MON_DATA_NICKNAME, text); StringCopy10(gBattleTextBuff1, text); if (var == MON_HAS_MAX_MOVES) - gTasks[taskID].tState = 20; + gTasks[taskId].tState = T_EVOSTATE_REPLACE_MOVE; else if (var == MON_ALREADY_KNOWS_MOVE) break; else - gTasks[taskID].tState = 18; + gTasks[taskId].tState = T_EVOSTATE_LEARNED_MOVE; } else { PlayBGM(MUS_EVOLUTION); DrawTextOnTradeWindow(0, gText_CommunicationStandby5, 1); - gTasks[taskID].tState++; + gTasks[taskId].tState++; } } break; - case 14: + case T_EVOSTATE_END: if (!IsTextPrinterActive(0)) { - DestroyTask(taskID); + DestroyTask(taskId); Free(sEvoStructPtr); sEvoStructPtr = NULL; gTextFlags.useAlternateDownArrow = 0; SetMainCallback2(gCB2_AfterEvolution); } break; - case 15: - if (!gTasks[sEvoGraphicsTaskID].isActive) + case T_EVOSTATE_CANCEL: + if (!gTasks[sEvoGraphicsTaskId].isActive) { m4aMPlayAllStop(); - BeginNormalPaletteFade((1 << (gSprites[sEvoStructPtr->preEvoSpriteID].oam.paletteNum + 16)) | (0x4001C), 0, 0x10, 0, RGB_WHITE); - gTasks[taskID].tState++; + BeginNormalPaletteFade((1 << (gSprites[sEvoStructPtr->preEvoSpriteId].oam.paletteNum + 16)) | (0x4001C), 0, 0x10, 0, RGB_WHITE); + gTasks[taskId].tState++; } break; - case 16: + case T_EVOSTATE_CANCEL_MON_ANIM: if (!gPaletteFade.active) { - EvoScene_DoMonAnimation(sEvoStructPtr->preEvoSpriteID, gTasks[taskID].tPreEvoSpecies); - gTasks[taskID].tState++; + EvoScene_DoMonAnimAndCry(sEvoStructPtr->preEvoSpriteId, gTasks[taskId].tPreEvoSpecies); + gTasks[taskId].tState++; } break; - case 17: - if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteID)) + case T_EVOSTATE_CANCEL_MSG: + if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteId)) { StringExpandPlaceholders(gStringVar4, gText_EllipsisQuestionMark); DrawTextOnTradeWindow(0, gStringVar4, 1); - gTasks[taskID].tEvoWasStopped = 1; - gTasks[taskID].tState = 13; + gTasks[taskId].tEvoWasStopped = TRUE; + gTasks[taskId].tState = T_EVOSTATE_TRY_LEARN_MOVE; } break; - case 18: + case T_EVOSTATE_LEARNED_MOVE: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { BufferMoveToLearnIntoBattleTextBuff2(); PlayFanfare(MUS_LEVEL_UP); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_ID_ADDER]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); - gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter - gTasks[taskID].tState++; + gTasks[taskId].tLearnsFirstMove = 0x40; // re-used as a counter + gTasks[taskId].tState++; } break; - case 19: - if (!IsTextPrinterActive(0) && IsFanfareTaskInactive() == TRUE && --gTasks[taskID].tLearnsFirstMove == 0) - gTasks[taskID].tState = 13; + case T_EVOSTATE_TRY_LEARN_ANOTHER_MOVE: + if (!IsTextPrinterActive(0) && IsFanfareTaskInactive() == TRUE && --gTasks[taskId].tLearnsFirstMove == 0) + gTasks[taskId].tState = T_EVOSTATE_TRY_LEARN_MOVE; break; - case 20: - switch (gTasks[taskID].tLearnMoveState) + case T_EVOSTATE_REPLACE_MOVE: + switch (gTasks[taskId].tLearnMoveState) { - case 0: + case T_MVSTATE_INTRO_MSG_1: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { + // "{mon} is trying to learn {move}" BufferMoveToLearnIntoBattleTextBuff2(); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_ID_ADDER]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveState++; } break; - case 1: + case T_MVSTATE_INTRO_MSG_2: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { + // "But, {mon} can't learn more than four moves" BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_ID_ADDER]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveState++; } break; - case 2: + case T_MVSTATE_INTRO_MSG_3: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { + // "Delete a move to make room for {move}?" BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_ID_ADDER]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); - gTasks[taskID].tData7 = 5; - gTasks[taskID].tData8 = 9; - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveYesState = T_MVSTATE_SHOW_MOVE_SELECT; + gTasks[taskId].tLearnMoveNoState = T_MVSTATE_ASK_CANCEL; + gTasks[taskId].tLearnMoveState++; } - case 3: + case T_MVSTATE_PRINT_YES_NO: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { LoadUserWindowBorderGfx(0, 0xA8, 0xE0); CreateYesNoMenu(&gTradeEvolutionSceneYesNoWindowTemplate, 0xA8, 0xE, 0); sEvoCursorPos = 0; - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveState++; sEvoCursorPos = 0; } break; - case 4: + case T_MVSTATE_HANDLE_YES_NO: switch (Menu_ProcessInputNoWrapClearOnChoose()) { - case 0: + case 0: // YES sEvoCursorPos = 0; BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_ID_ADDER]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); - gTasks[taskID].tLearnMoveState = gTasks[taskID].tData7; - if (gTasks[taskID].tLearnMoveState == 5) - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + gTasks[taskId].tLearnMoveState = gTasks[taskId].tLearnMoveYesState; + if (gTasks[taskId].tLearnMoveState == T_MVSTATE_SHOW_MOVE_SELECT) + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); break; - case 1: - case -1: + case 1: // NO + case MENU_B_PRESSED: sEvoCursorPos = 1; BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_ID_ADDER]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); - gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8; + gTasks[taskId].tLearnMoveState = gTasks[taskId].tLearnMoveNoState; break; } break; - case 5: + case T_MVSTATE_SHOW_MOVE_SELECT: if (!gPaletteFade.active) { if (gWirelessCommType) @@ -1232,73 +1345,77 @@ static void Task_TradeEvolutionScene(u8 taskID) Free(GetBgTilemapBuffer(0)); FreeAllWindowBuffers(); - ShowSelectMovePokemonSummaryScreen(gPlayerParty, gTasks[taskID].tPartyID, + ShowSelectMovePokemonSummaryScreen(gPlayerParty, gTasks[taskId].tPartyId, gPlayerPartyCount - 1, CB2_TradeEvolutionSceneLoadGraphics, gMoveToLearn); - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveState++; } break; - case 6: + case T_MVSTATE_HANDLE_MOVE_SELECT: if (!gPaletteFade.active && gMain.callback2 == CB2_TradeEvolutionSceneUpdate) { var = GetMoveSlotToReplace(); if (var == MAX_MON_MOVES) { - gTasks[taskID].tLearnMoveState = 9; + // Didn't select move slot + gTasks[taskId].tLearnMoveState = T_MVSTATE_ASK_CANCEL; } else { + // Selected move to forget u16 move = GetMonData(mon, var + MON_DATA_MOVE1); if (IsHMMove2(move)) { + // Can't forget HMs BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_ID_ADDER]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); - gTasks[taskID].tLearnMoveState = 11; + gTasks[taskId].tLearnMoveState = T_MVSTATE_RETRY_AFTER_HM; } else { + // Forget move PREPARE_MOVE_BUFFER(gBattleTextBuff2, move) RemoveMonPPBonus(mon, var); SetMonMoveSlot(mon, gMoveToLearn, var); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF - BATTLESTRINGS_ID_ADDER]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveState++; } } } break; - case 7: + case T_MVSTATE_FORGET_MSG: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_ID_ADDER]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); - gTasks[taskID].tLearnMoveState++; + gTasks[taskId].tLearnMoveState++; } break; - case 8: + case T_MVSTATE_LEARNED_MOVE: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS - BATTLESTRINGS_ID_ADDER]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); - gTasks[taskID].tState = 18; + gTasks[taskId].tState = T_EVOSTATE_LEARNED_MOVE; } break; - case 9: + case T_MVSTATE_ASK_CANCEL: BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_ID_ADDER]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); - gTasks[taskID].tData7 = 10; - gTasks[taskID].tData8 = 0; - gTasks[taskID].tLearnMoveState = 3; + gTasks[taskId].tLearnMoveYesState = T_MVSTATE_CANCEL; + gTasks[taskId].tLearnMoveNoState = T_MVSTATE_INTRO_MSG_1; + gTasks[taskId].tLearnMoveState = T_MVSTATE_PRINT_YES_NO; break; - case 10: + case T_MVSTATE_CANCEL: BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_ID_ADDER]); DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1); - gTasks[taskID].tState = 13; + gTasks[taskId].tState = T_EVOSTATE_TRY_LEARN_MOVE; break; - case 11: + case T_MVSTATE_RETRY_AFTER_HM: if (!IsTextPrinterActive(0) && !IsSEPlaying()) - gTasks[taskID].tLearnMoveState = 5; + gTasks[taskId].tLearnMoveState = T_MVSTATE_SHOW_MOVE_SELECT; break; } break; @@ -1312,10 +1429,10 @@ static void Task_TradeEvolutionScene(u8 taskID) #undef tBits #undef tLearnsFirstMove #undef tLearnMoveState -#undef tData7 -#undef tData8 +#undef tLearnMoveYesState +#undef tLearnMoveNoState #undef tEvoWasStopped -#undef tPartyID +#undef tPartyId static void EvoDummyFunc(void) { @@ -1355,57 +1472,87 @@ static void VBlankCB_TradeEvolutionScene(void) ScanlineEffect_InitHBlankDmaTransfer(); } -static void sub_813FDEC(u8 taskId) +#define tCycleTimer data[0] +#define tPalStage data[1] +#define tControlStage data[2] +#define tNumCycles data[3] +#define tStartTimer data[5] +#define tPaused data[6] + +// See comments above sBgAnim_PaletteControl +#define START_PAL sBgAnim_PaletteControl[tControlStage][0] +#define END_PAL sBgAnim_PaletteControl[tControlStage][1] +#define CYCLES sBgAnim_PaletteControl[tControlStage][2] +#define DELAY sBgAnim_PaletteControl[tControlStage][3] + +// Cycles the background through a set range of palettes in a series +// of stages, each stage having a different palette range and timing +static void Task_UpdateBgPalette(u8 taskId) { s16 *data = gTasks[taskId].data; - if (data[6] != 0) + if (tPaused) return; - if (data[5]++ < 20) + if (tStartTimer++ < 20) return; - if (data[0]++ > sUnknown_085B58C9[data[2]][3]) + if (tCycleTimer++ > DELAY) { - if (sUnknown_085B58C9[data[2]][1] == data[1]) + if (END_PAL == tPalStage) { - data[3]++; - if (data[3] == sUnknown_085B58C9[data[2]][2]) + // Reached final palette in current stage, completed a 'cycle' + // If this is the final cycle for this stage, move to the next stage + tNumCycles++; + if (tNumCycles == CYCLES) { - data[3] = 0; - data[2]++; + tNumCycles = 0; + tControlStage++; } - data[1] = sUnknown_085B58C9[data[2]][0]; + tPalStage = START_PAL; } else { - LoadPalette(&sEvoMovingBgPtr[data[1] * 16], 0xA0, 0x20); - data[0] = 0; - data[1]++; + // Haven't reached final palette in current stage, load the current palette + LoadPalette(&sBgAnimPal[tPalStage * 16], 0xA0, 0x20); + tCycleTimer = 0; + tPalStage++; } } - if (data[2] == 4) + if (tControlStage == (int)ARRAY_COUNT(sBgAnim_PaletteControl[0])) DestroyTask(taskId); } -static void sub_813FEA4(bool8 isLink) +#undef tCycleTimer +#undef tPalStage +#undef tControlStage +#undef tNumCycles +#undef tStartTimer +#undef START_PAL +#undef END_PAL +#undef CYCLES +#undef DELAY + +#define tIsLink data[2] + +static void CreateBgAnimTask(bool8 isLink) { - u8 taskId = CreateTask(sub_813FEE8, 7); + u8 taskId = CreateTask(Task_AnimateBg, 7); if (!isLink) - gTasks[taskId].data[2] = 0; + gTasks[taskId].tIsLink = FALSE; else - gTasks[taskId].data[2] = 1; + gTasks[taskId].tIsLink = TRUE; } -static void sub_813FEE8(u8 taskId) +static void Task_AnimateBg(u8 taskId) { u16 *outer_X, *outer_Y; u16 *inner_X = &gBattle_BG1_X; u16 *inner_Y = &gBattle_BG1_Y; - if (!gTasks[taskId].data[2]) + if (!gTasks[taskId].tIsLink) { outer_X = &gBattle_BG2_X; outer_Y = &gBattle_BG2_Y; @@ -1425,7 +1572,7 @@ static void sub_813FEE8(u8 taskId) *outer_X = Cos(gTasks[taskId].data[1], 4) + 8; *outer_Y = Sin(gTasks[taskId].data[1], 4) + 16; - if (!FuncIsActiveTask(sub_813FDEC)) + if (!FuncIsActiveTask(Task_UpdateBgPalette)) { DestroyTask(taskId); @@ -1437,37 +1584,39 @@ static void sub_813FEE8(u8 taskId) } } -static void InitMovingBgValues(u16 *movingBgs) +#undef tIsLink + +static void InitMovingBgPalette(u16 *palette) { s32 i, j; - for (i = 0; i < 50; i++) + for (i = 0; i < (int)ARRAY_COUNT(sBgAnim_PalIndexes); i++) { for (j = 0; j < 16; j++) { - movingBgs[i * 16 + j] = sUnknown_085B5884[sUnknown_085B58D9[i][j]]; + palette[i * 16 + j] = sBgAnim_Pal[sBgAnim_PalIndexes[i][j]]; } } } -static void InitMovingBackgroundTask(bool8 isLink) +static void StartBgAnimation(bool8 isLink) { u8 innerBgId, outerBgId; - sEvoMovingBgPtr = AllocZeroed(0x640); - InitMovingBgValues(sEvoMovingBgPtr); + sBgAnimPal = AllocZeroed(0x640); + InitMovingBgPalette(sBgAnimPal); if (!isLink) innerBgId = 1, outerBgId = 2; else innerBgId = 1, outerBgId = 3; - LoadPalette(sUnknown_085B51E4, 0xA0, 0x20); + LoadPalette(sBgAnim_Intro_Pal, 0xA0, 0x20); - DecompressAndLoadBgGfxUsingHeap(1, sUnknown_085B4134, FALSE, 0, 0); - CopyToBgTilemapBuffer(1, sUnknown_085B482C, 0, 0); - CopyToBgTilemapBuffer(outerBgId, sUnknown_085B4D10, 0, 0); - CopyBgTilemapBufferToVram(1); + DecompressAndLoadBgGfxUsingHeap(1, sBgAnim_Gfx, FALSE, 0, 0); + CopyToBgTilemapBuffer(innerBgId, sBgAnim_Inner_Tilemap, 0, 0); + CopyToBgTilemapBuffer(outerBgId, sBgAnim_Outer_Tilemap, 0, 0); + CopyBgTilemapBufferToVram(innerBgId); CopyBgTilemapBufferToVram(outerBgId); if (!isLink) @@ -1489,46 +1638,49 @@ static void InitMovingBackgroundTask(bool8 isLink) SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG3_ON | DISPCNT_BG1_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP); } - CreateTask(sub_813FDEC, 5); - sub_813FEA4(isLink); + CreateTask(Task_UpdateBgPalette, 5); + CreateBgAnimTask(isLink); } -static void sub_8140100(void) // unused +// Unused +static void PauseBgPaletteAnim(void) { - u8 taskId = FindTaskIdByFunc(sub_813FDEC); + u8 taskId = FindTaskIdByFunc(Task_UpdateBgPalette); - if (taskId != 0xFF) - gTasks[taskId].data[6] = 1; + if (taskId != TASK_NONE) + gTasks[taskId].tPaused = TRUE; FillPalette(0, 0xA0, 0x20); } -static void sub_8140134(void) +#undef tPaused + +static void StopBgAnimation(void) { u8 taskId; - if ((taskId = FindTaskIdByFunc(sub_813FDEC)) != 0xFF) + if ((taskId = FindTaskIdByFunc(Task_UpdateBgPalette)) != TASK_NONE) DestroyTask(taskId); - if ((taskId = FindTaskIdByFunc(sub_813FEE8)) != 0xFF) + if ((taskId = FindTaskIdByFunc(Task_AnimateBg)) != TASK_NONE) DestroyTask(taskId); FillPalette(0, 0xA0, 0x20); - sub_8140174(); + RestoreBgAfterAnim(); } -static void sub_8140174(void) +static void RestoreBgAfterAnim(void) { SetGpuReg(REG_OFFSET_BLDCNT, 0); gBattle_BG1_X = 0; gBattle_BG1_Y = 0; gBattle_BG2_X = 0; - SetBgAttribute(1, BG_ATTR_PRIORITY, sub_80391E0(1, 5)); - SetBgAttribute(2, BG_ATTR_PRIORITY, sub_80391E0(2, 5)); + SetBgAttribute(1, BG_ATTR_PRIORITY, GetBattleBgTemplateData(1, 5)); + SetBgAttribute(2, BG_ATTR_PRIORITY, GetBattleBgTemplateData(2, 5)); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG3_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP); - Free(sEvoMovingBgPtr); + Free(sBgAnimPal); } -static void EvoScene_DoMonAnimation(u8 monSpriteId, u16 speciesId) +static void EvoScene_DoMonAnimAndCry(u8 monSpriteId, u16 speciesId) { DoMonFrontSpriteAnimation(&gSprites[monSpriteId], speciesId, FALSE, 0); } diff --git a/src/field_camera.c b/src/field_camera.c index 57be52221..699b984ac 100644 --- a/src/field_camera.c +++ b/src/field_camera.c @@ -417,7 +417,7 @@ void CameraUpdate(void) CameraMove(deltaX, deltaY); UpdateObjectEventsForCameraUpdate(deltaX, deltaY); RotatingGatePuzzleCameraUpdate(deltaX, deltaY); - ResetBerryTreeSparkleFlags(); + SetBerryTreesSeen(); AddCameraTileOffset(&sFieldCameraOffset, deltaX * 2, deltaY * 2); RedrawMapSlicesForCameraUpdate(&sFieldCameraOffset, deltaX * 2, deltaY * 2); } diff --git a/src/field_effect.c b/src/field_effect.c index b1837c514..a70ef2892 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -967,8 +967,8 @@ void MultiplyPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b) curBlue -= ((curBlue * b) >> 4); color = curRed; - color |= curGreen << 5; - color |= curBlue << 10; + color |= (curGreen << 5); + color |= (curBlue << 10); gPlttBufferFaded[i] = color; } @@ -3703,8 +3703,8 @@ static void DestroyDeoxysRockEffect_RockFragments(s16* data, u8 taskId) { struct Sprite *sprite = &gSprites[gObjectEvents[tObjectEventId].spriteId]; gObjectEvents[tObjectEventId].invisible = TRUE; - BlendPalettes(0x0000FFFF, 0x10, RGB_WHITE); - BeginNormalPaletteFade(0x0000FFFF, 0, 0x10, 0, RGB_WHITE); + BlendPalettes(PALETTES_BG, 0x10, RGB_WHITE); + BeginNormalPaletteFade(PALETTES_BG, 0, 0x10, 0, RGB_WHITE); CreateDeoxysRockFragments(sprite); PlaySE(SE_THUNDER); StartEndingDeoxysRockCameraShake(tCameraTaskId); @@ -3853,16 +3853,8 @@ static void Task_MoveDeoxysRock(u8 taskId) case 0: data[4] = sprite->pos1.x << 4; data[5] = sprite->pos1.y << 4; - - // UB: Possible divide by zero - #ifdef UBFIX - #define DIVISOR (data[8] ? data[8] : 1); - #else - #define DIVISOR (data[8]) - #endif - - data[6] = (data[2] * 16 - data[4]) / DIVISOR; - data[7] = (data[3] * 16 - data[5]) / DIVISOR; + data[6] = SAFE_DIV(data[2] * 16 - data[4], data[8]); + data[7] = SAFE_DIV(data[3] * 16 - data[5], data[8]); data[0]++; case 1: if (data[8] != 0) diff --git a/src/field_message_box.c b/src/field_message_box.c index b98425b66..69d470b84 100755 --- a/src/field_message_box.c +++ b/src/field_message_box.c @@ -55,7 +55,7 @@ static void CreateTask_DrawFieldMessage(void) static void DestroyTask_DrawFieldMessage(void) { u8 taskId = FindTaskIdByFunc(Task_DrawFieldMessage); - if (taskId != 0xFF) + if (taskId != TASK_NONE) DestroyTask(taskId); } diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index ccc190057..532b392f8 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -96,7 +96,7 @@ static void PlayerNotOnBikeCollideWithFarawayIslandMew(u8); static void PlayCollisionSoundIfNotFacingWarp(u8 a); -static void sub_808C280(struct ObjectEvent *); +static void HideShowWarpArrow(struct ObjectEvent *); static void StartStrengthAnim(u8, u8); static void Task_PushBoulder(u8 taskId); @@ -323,7 +323,7 @@ void PlayerStep(u8 direction, u16 newKeys, u16 heldKeys) { struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - sub_808C280(playerObjEvent); + HideShowWarpArrow(playerObjEvent); if (gPlayerAvatar.preventStep == FALSE) { Bike_TryAcroBikeHistoryUpdate(newKeys, heldKeys); @@ -382,8 +382,7 @@ static void npc_clear_strange_bits(struct ObjectEvent *objEvent) static void MovePlayerAvatarUsingKeypadInput(u8 direction, u16 newKeys, u16 heldKeys) { - if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE) - || (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE)) + if (gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE)) MovePlayerOnBike(direction, newKeys, heldKeys); else MovePlayerNotOnBike(direction, heldKeys); @@ -940,9 +939,9 @@ u8 PlayerGetCopyableMovement(void) return gObjectEvents[gPlayerAvatar.objectEventId].playerCopyableMovement; } -static void sub_808B6BC(u8 a) +static void PlayerForceSetHeldMovement(u8 movementActionId) { - ObjectEventForceSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], a); + ObjectEventForceSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], movementActionId); } void PlayerSetAnimId(u8 movementActionId, u8 copyableMovement) @@ -1020,12 +1019,13 @@ void PlayerJumpLedge(u8 direction) PlayerSetAnimId(GetJump2MovementAction(direction), 8); } -void sub_808B864(void) +// Stop player on current facing direction once they're done moving and if they're not currently Acro Biking on bumpy slope +void PlayerFreeze(void) { if (gPlayerAvatar.tileTransitionState == T_TILE_CENTER || gPlayerAvatar.tileTransitionState == T_NOT_MOVING) { - if (player_should_look_direction_be_enforced_upon_movement()) - sub_808B6BC(GetFaceDirectionMovementAction(gObjectEvents[gPlayerAvatar.objectEventId].facingDirection)); + if (IsPlayerNotUsingAcroBikeOnBumpySlope()) + PlayerForceSetHeldMovement(GetFaceDirectionMovementAction(gObjectEvents[gPlayerAvatar.objectEventId].facingDirection)); } } @@ -1424,7 +1424,7 @@ void SetPlayerAvatarWatering(u8 direction) StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFaceDirectionAnimNum(direction)); } -static void sub_808C280(struct ObjectEvent *objectEvent) +static void HideShowWarpArrow(struct ObjectEvent *objectEvent) { s16 x; s16 y; @@ -1435,6 +1435,7 @@ static void sub_808C280(struct ObjectEvent *objectEvent) { if (sArrowWarpMetatileBehaviorChecks2[x](metatileBehavior) && direction == objectEvent->movementDirection) { + // Show warp arrow if applicable x = objectEvent->currentCoords.x; y = objectEvent->currentCoords.y; MoveCoords(direction, &x, &y); diff --git a/src/field_region_map.c b/src/field_region_map.c index fc6f0fa76..99def4901 100644 --- a/src/field_region_map.c +++ b/src/field_region_map.c @@ -156,7 +156,7 @@ static void FieldUpdateRegionMap(void) ScheduleBgCopyTilemapToVram(0); DrawStdFrameWithCustomTileAndPalette(0, 0, 0x27, 0xd); PrintRegionMapSecName(); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); sFieldRegionMapHandler->state++; break; case 2: @@ -184,7 +184,7 @@ static void FieldUpdateRegionMap(void) } break; case 5: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sFieldRegionMapHandler->state++; break; case 6: diff --git a/src/field_specials.c b/src/field_specials.c index a6831ec5b..86be21eda 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1408,7 +1408,7 @@ void GiveLeadMonEffortRibbon(void) SetMonData(leadMon, MON_DATA_EFFORT_RIBBON, &ribbonSet); if (GetRibbonCount(leadMon) > NUM_CUTIES_RIBBONS) { - TryPutSpotTheCutiesOnAir(leadMon, 0x47); + TryPutSpotTheCutiesOnAir(leadMon, MON_DATA_EFFORT_RIBBON); } } @@ -2667,7 +2667,7 @@ static void ScrollableMultichoice_MoveCursor(s32 itemIndex, bool8 onInit, struct u8 taskId; PlaySE(SE_SELECT); taskId = FindTaskIdByFunc(ScrollableMultichoice_ProcessInput); - if (taskId != 0xFF) + if (taskId != TASK_NONE) { u16 selection; struct Task *task = &gTasks[taskId]; @@ -2753,7 +2753,7 @@ static void sub_813A600(u8 taskId) void sub_813A630(void) { u8 taskId = FindTaskIdByFunc(sub_813A600); - if (taskId == 0xFF) + if (taskId == TASK_NONE) { EnableBothScriptContexts(); } @@ -3262,7 +3262,7 @@ void sub_813ADD4(void) u16 scrollOffset, selectedRow; u8 i; u8 taskId = FindTaskIdByFunc(sub_813A600); - if (taskId != 0xFF) + if (taskId != TASK_NONE) { struct Task *task = &gTasks[taskId]; ListMenuGetScrollAndRow(task->tListTaskId, &scrollOffset, &selectedRow); @@ -3321,7 +3321,7 @@ void GetBattleFrontierTutorMoveIndex(void) void sub_813AF48(void) { u8 taskId = FindTaskIdByFunc(sub_813A600); - if (taskId != 0xFF) + if (taskId != TASK_NONE) { struct Task *task = &gTasks[taskId]; DestroyListMenuTask(task->tListTaskId, NULL, NULL); @@ -3735,14 +3735,17 @@ bool32 ShouldDistributeEonTicket(void) return TRUE; } -void sub_813B534(void) +#define tState data[0] + +void BattleTowerReconnectLink(void) { + // Save battle type, restored at end + // of Task_LinkRetireStatusWithBattleTowerPartner sBattleTowerMultiBattleTypeFlags = gBattleTypeFlags; gBattleTypeFlags = 0; + if (!gReceivedRemoteLinkPlayers) - { - CreateTask(sub_80B3AF8, 5); - } + CreateTask(Task_ReconnectWithLinkPlayers, 5); } void LinkRetireStatusWithBattleTowerPartner(void) @@ -3750,137 +3753,145 @@ void LinkRetireStatusWithBattleTowerPartner(void) CreateTask(Task_LinkRetireStatusWithBattleTowerPartner, 5); } +// Communicate with a Battle Tower link partner to tell them +// whether or not the player chose to continue or retire, +// and determine what the partner chose to do +// gSpecialVar_0x8004: Player's choice +// gSpecialVar_0x8005: Partner's choice (read from gBlockRecvBuffer[1][0]) static void Task_LinkRetireStatusWithBattleTowerPartner(u8 taskId) { - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { - case 0: - if (!FuncIsActiveTask(sub_80B3AF8)) - { - gTasks[taskId].data[0]++; - } - break; - case 1: - if (IsLinkTaskFinished() == TRUE) - { - if (GetMultiplayerId() == 0) - { - gTasks[taskId].data[0]++; - } - else - { - SendBlock(bitmask_all_link_players_but_self(), &gSpecialVar_0x8004, 2); - gTasks[taskId].data[0]++; - } - } - break; - case 2: - if ((GetBlockReceivedStatus() & 2) != 0) - { - if (GetMultiplayerId() == 0) - { - gSpecialVar_0x8005 = gBlockRecvBuffer[1][0]; - ResetBlockReceivedFlag(1); - if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_RETIRE - && gSpecialVar_0x8005 == BATTLE_TOWER_LINK_RETIRE) - { - gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_BOTH_RETIRE; - } - else if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_CONTINUE - && gSpecialVar_0x8005 == BATTLE_TOWER_LINK_RETIRE) - { - gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_PARTNER_RETIRE; - } - else if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_RETIRE - && gSpecialVar_0x8005 == BATTLE_TOWER_LINK_CONTINUE) - { - gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_PLAYER_RETIRE; - } - else - { - gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_CONTINUE; - } - } - gTasks[taskId].data[0]++; - } - break; - case 3: - if (IsLinkTaskFinished() == TRUE) - { - if (GetMultiplayerId() != 0) - { - gTasks[taskId].data[0]++; - } - else - { - SendBlock(bitmask_all_link_players_but_self(), &gSpecialVar_Result, 2); - gTasks[taskId].data[0]++; - } - } - break; - case 4: - if ((GetBlockReceivedStatus() & 1) != 0) - { - if (GetMultiplayerId() != 0) - { - gSpecialVar_Result = gBlockRecvBuffer[0][0]; - ResetBlockReceivedFlag(0); - gTasks[taskId].data[0]++; - } - else - { - gTasks[taskId].data[0]++; - } - } - break; - case 5: + case 0: + if (!FuncIsActiveTask(Task_ReconnectWithLinkPlayers)) + { + gTasks[taskId].tState++; + } + break; + case 1: + if (IsLinkTaskFinished() == TRUE) + { if (GetMultiplayerId() == 0) { - if (gSpecialVar_Result == BATTLE_TOWER_LINKSTAT_PARTNER_RETIRE) - { - ShowFieldAutoScrollMessage(gText_YourPartnerHasRetired); - } + // Player is link leader, skip sending data + gTasks[taskId].tState++; } else { - if (gSpecialVar_Result == BATTLE_TOWER_LINKSTAT_PLAYER_RETIRE) + // Send value of gSpecialVar_0x8004 to leader + // Will either be BATTLE_TOWER_LINK_CONTINUE or BATTLE_TOWER_LINK_RETIRE + SendBlock(bitmask_all_link_players_but_self(), &gSpecialVar_0x8004, sizeof(gSpecialVar_0x8004)); + gTasks[taskId].tState++; + } + } + break; + case 2: + if (GetBlockReceivedStatus() & 2) + { + if (GetMultiplayerId() == 0) + { + // Player is leader, read partner's choice + // and determine if play should continue + gSpecialVar_0x8005 = gBlockRecvBuffer[1][0]; + ResetBlockReceivedFlag(1); + + if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_RETIRE + && gSpecialVar_0x8005 == BATTLE_TOWER_LINK_RETIRE) { - ShowFieldAutoScrollMessage(gText_YourPartnerHasRetired); + gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_BOTH_RETIRE; + } + else if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_CONTINUE + && gSpecialVar_0x8005 == BATTLE_TOWER_LINK_RETIRE) + { + gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_MEMBER_RETIRE; + } + else if (gSpecialVar_0x8004 == BATTLE_TOWER_LINK_RETIRE + && gSpecialVar_0x8005 == BATTLE_TOWER_LINK_CONTINUE) + { + gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_LEADER_RETIRE; + } + else + { + gSpecialVar_Result = BATTLE_TOWER_LINKSTAT_CONTINUE; } } - gTasks[taskId].data[0]++; - break; - case 6: - if (!IsTextPrinterActive(0)) + gTasks[taskId].tState++; + } + break; + case 3: + if (IsLinkTaskFinished() == TRUE) + { + if (GetMultiplayerId() != 0) { - gTasks[taskId].data[0]++; + // Player is not link leader, wait for leader's response + gTasks[taskId].tState++; } - break; - case 7: - if (IsLinkTaskFinished() == 1) + else { - SetLinkStandbyCallback(); - gTasks[taskId].data[0]++; + // Send whether or not play should continue + SendBlock(bitmask_all_link_players_but_self(), &gSpecialVar_Result, sizeof(gSpecialVar_Result)); + gTasks[taskId].tState++; } - break; - case 8: - if (IsLinkTaskFinished() == 1) + } + break; + case 4: + if (GetBlockReceivedStatus() & 1) + { + if (GetMultiplayerId() != 0) { - gTasks[taskId].data[0]++; + // Player is not link leader, read leader's response + gSpecialVar_Result = gBlockRecvBuffer[0][0]; + ResetBlockReceivedFlag(0); + gTasks[taskId].tState++; } - break; - case 9: - if (gWirelessCommType == 0) + else { - SetCloseLinkCallback(); + gTasks[taskId].tState++; } - gBattleTypeFlags = sBattleTowerMultiBattleTypeFlags; - EnableBothScriptContexts(); - DestroyTask(taskId); - break; + } + break; + case 5: + // Print message if partner chose to retire (and player didn't) + if (GetMultiplayerId() == 0) + { + if (gSpecialVar_Result == BATTLE_TOWER_LINKSTAT_MEMBER_RETIRE) + ShowFieldAutoScrollMessage(gText_YourPartnerHasRetired); + } + else + { + if (gSpecialVar_Result == BATTLE_TOWER_LINKSTAT_LEADER_RETIRE) + ShowFieldAutoScrollMessage(gText_YourPartnerHasRetired); + } + gTasks[taskId].tState++; + break; + case 6: + if (!IsTextPrinterActive(0)) + gTasks[taskId].tState++; + break; + case 7: + if (IsLinkTaskFinished() == TRUE) + { + SetLinkStandbyCallback(); + gTasks[taskId].tState++; + } + break; + case 8: + if (IsLinkTaskFinished() == TRUE) + gTasks[taskId].tState++; + break; + case 9: + if (gWirelessCommType == 0) + SetCloseLinkCallback(); + + gBattleTypeFlags = sBattleTowerMultiBattleTypeFlags; + EnableBothScriptContexts(); + DestroyTask(taskId); + break; } } +#undef tState + void Script_DoRayquazaScene(void) { if (!gSpecialVar_0x8004) diff --git a/src/field_tasks.c b/src/field_tasks.c index 002977a10..676a9cfc7 100644 --- a/src/field_tasks.c +++ b/src/field_tasks.c @@ -174,7 +174,7 @@ void SetUpFieldTasks(void) void ActivatePerStepCallback(u8 callbackId) { u8 taskId = FindTaskIdByFunc(Task_RunPerStepCallback); - if (taskId != 0xff) + if (taskId != TASK_NONE) { s32 i; s16 *data = gTasks[taskId].data; @@ -199,12 +199,12 @@ void ResetFieldTasksArgs(void) s16 *data; taskId = FindTaskIdByFunc(Task_RunPerStepCallback); - if (taskId != 0xff) + if (taskId != TASK_NONE) { data = gTasks[taskId].data; } taskId = FindTaskIdByFunc(Task_RunTimeBasedEvents); - if (taskId != 0xff) + if (taskId != TASK_NONE) { data = gTasks[taskId].data; data[1] = 0; @@ -635,9 +635,12 @@ static void AshGrassPerStepCallback(u8 taskId) } } +// This function uses the constants for gTileset_Cave's metatile labels, but other tilesets with +// the CrackedFloorPerStepCallback callback use the same metatile numbers for the cracked floor +// and hole metatiles, such as gTileset_MirageTower. static void SetCrackedFloorHoleMetatile(s16 x, s16 y) { - MapGridSetMetatileIdAt(x, y, MapGridGetMetatileIdAt(x, y) == 0x22f ? 0x206 : 0x237);// unsure what these are referring to + MapGridSetMetatileIdAt(x, y, MapGridGetMetatileIdAt(x, y) == METATILE_Cave_CrackedFloor ? METATILE_Cave_CrackedFloor_Hole : METATILE_Pacifidlog_SkyPillar_CrackedFloor_Hole); CurrentMapDrawMetatileAt(x, y); } diff --git a/src/field_weather.c b/src/field_weather.c index 25ee0582a..655e24590 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -154,15 +154,14 @@ static const u8 sBasePaletteGammaTypes[32] = GAMMA_NORMAL, }; -const u16 gUnknown_083970E8[] = INCBIN_U16("graphics/weather/0.gbapal"); +const u16 gFogPalette[] = INCBIN_U16("graphics/weather/fog.gbapal"); -// code void StartWeather(void) { if (!FuncIsActiveTask(Task_WeatherMain)) { u8 index = AllocSpritePalette(0x1200); - CpuCopy32(gUnknown_083970E8, &gPlttBufferUnfaded[0x100 + index * 16], 32); + CpuCopy32(gFogPalette, &gPlttBufferUnfaded[0x100 + index * 16], 32); BuildGammaShiftTables(); gWeatherPtr->altGammaSpritePalIndex = index; gWeatherPtr->weatherPicSpritePalIndex = AllocSpritePalette(0x1201); @@ -494,7 +493,7 @@ static void ApplyGammaShift(u8 startPalIndex, u8 numPalettes, s8 gammaIndex) r = gammaTable[baseColor.r]; g = gammaTable[baseColor.g]; b = gammaTable[baseColor.b]; - gPlttBufferFaded[palOffset++] = (b << 10) | (g << 5) | r; + gPlttBufferFaded[palOffset++] = RGB2(r, g, b); } } @@ -579,7 +578,7 @@ static void ApplyGammaShiftWithBlend(u8 startPalIndex, u8 numPalettes, s8 gammaI r += ((rBlend - r) * blendCoeff) >> 4; g += ((gBlend - g) * blendCoeff) >> 4; b += ((bBlend - b) * blendCoeff) >> 4; - gPlttBufferFaded[palOffset++] = (b << 10) | (g << 5) | r; + gPlttBufferFaded[palOffset++] = RGB2(r, g, b); } } @@ -636,7 +635,7 @@ static void ApplyDroughtGammaShiftWithBlend(s8 gammaIndex, u8 blendCoeff, u16 bl g2 += ((gBlend - g2) * blendCoeff) >> 4; b2 += ((bBlend - b2) * blendCoeff) >> 4; - gPlttBufferFaded[palOffset++] = (b2 << 10) | (g2 << 5) | r2; + gPlttBufferFaded[palOffset++] = RGB2(r2, g2, b2); } } } @@ -678,7 +677,7 @@ static void ApplyFogBlend(u8 blendCoeff, u16 blendColor) g += ((gBlend - g) * blendCoeff) >> 4; b += ((bBlend - b) * blendCoeff) >> 4; - gPlttBufferFaded[palOffset] = (b << 10) | (g << 5) | r; + gPlttBufferFaded[palOffset] = RGB2(r, g, b); palOffset++; } } @@ -782,7 +781,7 @@ void FadeScreen(u8 mode, s8 delay) if (useWeatherPal) CpuFastCopy(gPlttBufferFaded, gPlttBufferUnfaded, 0x400); - BeginNormalPaletteFade(0xFFFFFFFF, delay, 0, 16, fadeColor); + BeginNormalPaletteFade(PALETTES_ALL, delay, 0, 16, fadeColor); gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_OUT; } else @@ -791,7 +790,7 @@ void FadeScreen(u8 mode, s8 delay) if (useWeatherPal) gWeatherPtr->fadeScreenCounter = 0; else - BeginNormalPaletteFade(0xFFFFFFFF, delay, 16, 0, fadeColor); + BeginNormalPaletteFade(PALETTES_ALL, delay, 16, 0, fadeColor); gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_IN; gWeatherPtr->unknown_6CA = 1; diff --git a/src/fldeff_misc.c b/src/fldeff_misc.c index 7eae8cfd1..b320f3eb0 100644 --- a/src/fldeff_misc.c +++ b/src/fldeff_misc.c @@ -387,7 +387,7 @@ static void Task_ComputerScreenOpenEffect(u8 taskId) task->tWinRight = DISPLAY_WIDTH; SetGpuReg(REG_OFFSET_BLDY, 0); SetGpuReg(REG_OFFSET_BLDCNT, task->tBlendCnt); - BlendPalettes(0xFFFFFFFF, 0, 0); + BlendPalettes(PALETTES_ALL, 0, 0); gPlttBufferFaded[0] = 0; } SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->tWinLeft, task->tWinRight)); @@ -463,7 +463,7 @@ static void Task_ComputerScreenCloseEffect(u8 taskId) { task->tWinLeft = DISPLAY_WIDTH / 2; task->tWinRight = DISPLAY_WIDTH / 2; - BlendPalettes(-1, 16, 0); + BlendPalettes(PALETTES_ALL, 16, 0); gPlttBufferFaded[0] = 0; } SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->tWinLeft, task->tWinRight)); diff --git a/src/frontier_pass.c b/src/frontier_pass.c index cf170b350..2de27c36b 100644 --- a/src/frontier_pass.c +++ b/src/frontier_pass.c @@ -751,8 +751,8 @@ static bool32 InitFrontierPass(void) ShowBg(2); LoadCursorAndSymbolSprites(); SetVBlankCallback(VblankCb_FrontierPass); - BlendPalettes(0xFFFFFFFF, 0x10, RGB_BLACK); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BlendPalettes(PALETTES_ALL, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); break; case 10: AnimateSprites(); @@ -775,7 +775,7 @@ static bool32 HideFrontierPass(void) case 0: if (sPassData->unkE != 1 && sPassData->unkE != 2) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); } else { @@ -1023,7 +1023,7 @@ static void Task_DoFadeEffect(u8 taskId) data[2] = Q_8_8(1); data[3] = 0x15; data[4] = 0x15; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITE); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_WHITE); } else { @@ -1037,8 +1037,8 @@ static void Task_DoFadeEffect(u8 taskId) ShowBg(2); LoadCursorAndSymbolSprites(); SetVBlankCallback(VblankCb_FrontierPass); - BlendPalettes(0xFFFFFFFF, 0x10, RGB_WHITE); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_WHITE); + BlendPalettes(PALETTES_ALL, 0x10, RGB_WHITE); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_WHITE); } sPassGfx->setAffine = TRUE; sPassGfx->unk2E = MathUtil_Inv16(data[1]); @@ -1366,8 +1366,8 @@ static bool32 InitFrontierMap(void) ShowBg(2); InitFrontierMapSprites(); SetVBlankCallback(VblankCb_FrontierPass); - BlendPalettes(0xFFFFFFFF, 0x10, RGB_WHITE); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_WHITE); + BlendPalettes(PALETTES_ALL, 0x10, RGB_WHITE); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_WHITE); break; case 7: if (UpdatePaletteFade()) @@ -1385,7 +1385,7 @@ static bool32 ExitFrontierMap(void) switch (sPassData->state) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITE); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_WHITE); break; case 1: if (UpdatePaletteFade()) diff --git a/src/frontier_util.c b/src/frontier_util.c index e0ad3971c..109e3c3ac 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -2383,13 +2383,13 @@ void ClearRankingHallRecords(void) { s32 i, j, k; - // BUG: Passing 0 as a pointer instead of a pointer holding a value of 0. - #ifdef BUGFIX - u8 zero = 0; - #define ZERO (&zero) - #else + // UB: Passing 0 as a pointer instead of a pointer holding a value of 0. +#ifdef UBFIX + u8 emptyId[TRAINER_ID_LENGTH] = {0}; + #define ZERO emptyId +#else #define ZERO 0 - #endif +#endif for (i = 0; i < HALL_FACILITIES_COUNT; i++) { diff --git a/src/graphics.c b/src/graphics.c index a4875d064..9e7a6707a 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -983,8 +983,8 @@ const u32 gBattleAnimSpritePal_FangAttack[] = INCBIN_U32("graphics/battle_anims/ const u32 gBattleAnimSpriteGfx_PurpleHandOutline[] = INCBIN_U32("graphics/battle_anims/sprites/purple_hand_outline.4bpp.lz"); const u32 gBattleAnimSpritePal_PurpleHandOutline[] = INCBIN_U32("graphics/battle_anims/sprites/purple_hand_outline.gbapal.lz"); -const u32 gUnknown_08C20668[] = INCBIN_U32("graphics/battle_anims/masks/curse.4bpp.lz"); -const u32 gUnknown_08C20684[] = INCBIN_U32("graphics/battle_anims/masks/curse.bin.lz"); +const u32 gBattleAnimMaskImage_Curse[] = INCBIN_U32("graphics/battle_anims/masks/curse.4bpp.lz"); +const u32 gBattleAnimMaskTilemap_Curse[] = INCBIN_U32("graphics/battle_anims/masks/curse.bin.lz"); const u32 gBattleAnimSpriteGfx_Pencil[] = INCBIN_U32("graphics/battle_anims/sprites/pencil.4bpp.lz"); const u32 gBattleAnimSpritePal_Pencil[] = INCBIN_U32("graphics/battle_anims/sprites/pencil.gbapal.lz"); @@ -1226,8 +1226,8 @@ const u32 gBattleAnimSpriteGfx_TagHand[] = INCBIN_U32("graphics/battle_anims/spr const u32 gBattleAnimSpriteGfx_NoiseLine[] = INCBIN_U32("graphics/battle_anims/sprites/noise_line.4bpp.lz"); -const u32 gUnknown_08C2EA50[] = INCBIN_U32("graphics/battle_anims/masks/unknown_C2EA50.4bpp.lz"); -const u32 gUnknown_08C2EA9C[] = INCBIN_U32("graphics/battle_anims/masks/unknown_C2EA50.bin.lz"); +const u32 UnusedLevelupAnimationGfx[] = INCBIN_U32("graphics/battle_anims/masks/unused_level_up.4bpp.lz"); +const u32 UnusedLevelupAnimationTilemap[] = INCBIN_U32("graphics/battle_anims/masks/unused_level_up.bin.lz"); const u32 gBattleAnimSpriteGfx_SmallRedEye[] = INCBIN_U32("graphics/battle_anims/sprites/small_red_eye.4bpp.lz"); const u32 gBattleAnimSpritePal_SmallRedEye[] = INCBIN_U32("graphics/battle_anims/sprites/small_red_eye.gbapal.lz"); @@ -1862,8 +1862,8 @@ const u32 gRegionMapCityZoomText_Gfx[] = INCBIN_U32("graphics/pokenav/city_zoom_ const u16 gPokenavConditionCancel_Pal[] = INCBIN_U16("graphics/pokenav/condition/cancel.gbapal"); const u8 gPokenavConditionCancel_Gfx[] = INCBIN_U8("graphics/pokenav/condition/cancel.4bpp"); -const u16 gPokenavConditionMarker_Pal[] = INCBIN_U16("graphics/pokenav/condition/marker.gbapal"); -const u8 gPokenavConditionMarker_Gfx[] = INCBIN_U8("graphics/pokenav/condition/marker.4bpp"); +const u16 gMonMarkingsMenu_Pal[] = INCBIN_U16("graphics/misc/mon_markings_menu.gbapal"); +const u8 gMonMarkingsMenu_Gfx[] = INCBIN_U8("graphics/misc/mon_markings_menu.4bpp"); const u16 gBerryBlenderMiscPalette[] = INCBIN_U16("graphics/berry_blender/misc.gbapal"); const u16 gBerryBlenderArrowPalette[] = INCBIN_U16("graphics/berry_blender/arrow.gbapal"); @@ -1877,11 +1877,11 @@ static const u8 sEmpty1[0x200] = {0}; const u8 gBerryBlenderPlayerArrow_Gfx[] = INCBIN_U8("graphics/berry_blender/arrow.4bpp"); static const u8 sEmpty2[0x2C0] = {0}; -const u16 gEasyChatCursor_Pal[] = INCBIN_U16("graphics/easy_chat/cursor.gbapal"); -const u32 gEasyChatCursor_Gfx[] = INCBIN_U32("graphics/easy_chat/cursor.4bpp.lz"); +const u16 gEasyChatRectangleCursor_Pal[] = INCBIN_U16("graphics/easy_chat/rectangle_cursor.gbapal"); +const u32 gEasyChatRectangleCursor_Gfx[] = INCBIN_U32("graphics/easy_chat/rectangle_cursor.4bpp.lz"); -const u16 gEasyChatRightWindow_Pal[] = INCBIN_U16("graphics/easy_chat/rwindow.gbapal"); -const u32 gEasyChatRightWindow_Gfx[] = INCBIN_U32("graphics/easy_chat/rwindow.4bpp.lz"); +const u16 gEasyChatButtonWindow_Pal[] = INCBIN_U16("graphics/easy_chat/button_window.gbapal"); +const u32 gEasyChatButtonWindow_Gfx[] = INCBIN_U32("graphics/easy_chat/button_window.4bpp.lz"); const u32 gEasyChatMode_Gfx[] = INCBIN_U32("graphics/easy_chat/mode.4bpp.lz"); const u16 gEasyChatMode_Pal[] = INCBIN_U16("graphics/easy_chat/mode.gbapal"); @@ -2022,11 +2022,9 @@ const u16 gWallpaperPalettes_Ribbon[][16] = const u32 gWallpaperTiles_Ribbon[] = INCBIN_U32("graphics/pokemon_storage/ribbon.4bpp.lz"); const u32 gWallpaperTilemap_Ribbon[] = INCBIN_U32("graphics/pokemon_storage/ribbon.bin.lz"); -// pokenav - -const u16 gUnknown_08DDE010[] = INCBIN_U16("graphics/pokenav/ribbons.gbapal"); -const u32 gUnknown_08DDE030[] = INCBIN_U32("graphics/pokenav/ribbons.4bpp.lz"); -const u32 gUnknown_08DDE12C[] = INCBIN_U32("graphics/pokenav/ribbons.bin.lz"); +const u16 gPokenavRibbonsSummaryBg_Pal[] = INCBIN_U16("graphics/pokenav/ribbons/summary_bg.gbapal"); +const u32 gPokenavRibbonsSummaryBg_Gfx[] = INCBIN_U32("graphics/pokenav/ribbons/summary_bg.4bpp.lz"); +const u32 gPokenavRibbonsSummaryBg_Tilemap[] = INCBIN_U32("graphics/pokenav/ribbons/summary_bg.bin.lz"); const u16 gMonIconPalettes[][16] = { diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 7b63950d1..7d3a7f28b 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -386,7 +386,7 @@ static bool8 InitHallOfFameScreen(void) if (!sub_8175024()) { SetVBlankCallback(VBlankCB_HallOfFame); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); gMain.state++; } break; @@ -464,11 +464,11 @@ static void Task_Hof_InitMonData(u8 taskId) sHofFadePalettes = 0; gTasks[taskId].tDisplayedMonId = 0; - gTasks[taskId].tPlayerSpriteID = 0xFF; + gTasks[taskId].tPlayerSpriteID = SPRITE_NONE; for (i = 0; i < PARTY_SIZE; i++) { - gTasks[taskId].tMonSpriteId(i) = 0xFF; + gTasks[taskId].tMonSpriteId(i) = SPRITE_NONE; } if (gTasks[taskId].tDontSaveData) @@ -639,10 +639,10 @@ static void Task_Hof_PaletteFadeAndPrintWelcomeText(u8 taskId) { u16 i; - BeginNormalPaletteFade(0xFFFF0000, 0, 0, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_OBJECTS, 0, 0, 0, RGB_BLACK); for (i = 0; i < PARTY_SIZE; i++) { - if (gTasks[taskId].tMonSpriteId(i) != 0xFF) + if (gTasks[taskId].tMonSpriteId(i) != SPRITE_NONE) gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 0; } @@ -668,7 +668,7 @@ static void Task_Hof_DoConfetti(u8 taskId) u16 i; for (i = 0; i < PARTY_SIZE; i++) { - if (gTasks[taskId].tMonSpriteId(i) != 0xFF) + if (gTasks[taskId].tMonSpriteId(i) != SPRITE_NONE) gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 1; } BeginNormalPaletteFade(sHofFadePalettes, 0, 12, 12, RGB(16, 29, 24)); @@ -739,7 +739,7 @@ static void Task_Hof_ExitOnKeyPressed(u8 taskId) static void Task_Hof_HandlePaletteOnExit(u8 taskId) { CpuCopy16(gPlttBufferFaded, gPlttBufferUnfaded, 0x400); - BeginNormalPaletteFade(0xFFFFFFFF, 8, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 8, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_Hof_HandleExit; } @@ -752,7 +752,7 @@ static void Task_Hof_HandleExit(u8 taskId) for (i = 0; i < PARTY_SIZE; i++) { u8 spriteId = gTasks[taskId].tMonSpriteId(i); - if (spriteId != 0xFF) + if (spriteId != SPRITE_NONE) { FreeOamMatrix(gSprites[spriteId].oam.matrixNum); FreeAndDestroyMonPicSprite(spriteId); @@ -847,7 +847,7 @@ void CB2_DoHallOfFamePC(void) for (i = 0; i < PARTY_SIZE; i++) { - gTasks[taskId].tMonSpriteId(i) = 0xFF; + gTasks[taskId].tMonSpriteId(i) = SPRITE_NONE; } sHofMonPtr = AllocZeroed(0x2000); @@ -937,11 +937,11 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId) } else { - gTasks[taskId].tMonSpriteId(i) = 0xFF; + gTasks[taskId].tMonSpriteId(i) = SPRITE_NONE; } } - BlendPalettes(0xFFFF0000, 0xC, RGB(16, 29, 24)); + BlendPalettes(PALETTES_OBJECTS, 0xC, RGB(16, 29, 24)); ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tCurrPageNo, STR_CONV_MODE_RIGHT_ALIGN, 3); StringExpandPlaceholders(gStringVar4, gText_HOFNumber); @@ -967,7 +967,7 @@ static void Task_HofPC_PrintMonInfo(u8 taskId) for (i = 0; i < PARTY_SIZE; i++) { u16 spriteId = gTasks[taskId].tMonSpriteId(i); - if (spriteId != 0xFF) + if (spriteId != SPRITE_NONE) gSprites[spriteId].oam.priority = 1; } @@ -999,10 +999,10 @@ static void Task_HofPC_HandleInput(u8 taskId) for (i = 0; i < PARTY_SIZE; i++) { u8 spriteId = gTasks[taskId].tMonSpriteId(i); - if (spriteId != 0xFF) + if (spriteId != SPRITE_NONE) { FreeAndDestroyMonPicSprite(spriteId); - gTasks[taskId].tMonSpriteId(i) = 0xFF; + gTasks[taskId].tMonSpriteId(i) = SPRITE_NONE; } } if (gTasks[taskId].tCurrPageNo != 0) @@ -1060,10 +1060,10 @@ static void Task_HofPC_HandleExit(u8 taskId) for (i = 0; i < PARTY_SIZE; i++) { u16 spriteId = gTasks[taskId].tMonSpriteId(i); - if (spriteId != 0xFF) + if (spriteId != SPRITE_NONE) { FreeAndDestroyMonPicSprite(spriteId); - gTasks[taskId].tMonSpriteId(i) = 0xFF; + gTasks[taskId].tMonSpriteId(i) = SPRITE_NONE; } } @@ -1433,7 +1433,7 @@ void DoDomeConfetti(void) gSpecialVar_0x8004 = 180; taskId = CreateTask(Task_DoDomeConfetti, 0); - if (taskId != 0xFF) + if (taskId != TASK_NONE) { gTasks[taskId].tTimer = gSpecialVar_0x8004; gSpecialVar_0x8005 = taskId; @@ -1444,7 +1444,7 @@ static void StopDomeConfetti(void) { u8 taskId; - if ((taskId = FindTaskIdByFunc(Task_DoDomeConfetti)) != 0xFF) + if ((taskId = FindTaskIdByFunc(Task_DoDomeConfetti)) != TASK_NONE) DestroyTask(taskId); ConfettiUtil_Free(); diff --git a/src/hof_pc.c b/src/hof_pc.c index 327749179..f74448cca 100644 --- a/src/hof_pc.c +++ b/src/hof_pc.c @@ -29,7 +29,7 @@ static void ReshowPCMenuAfterHallOfFamePC(void) Overworld_PlaySpecialMapMusic(); ScriptMenu_CreatePCMultichoice(); ScriptMenu_DisplayPCStartupPrompt(); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); CreateTask(Task_WaitForPaletteFade, 10); } diff --git a/src/image_processing_effects.c b/src/image_processing_effects.c index 224de6fe1..4a56871a4 100644 --- a/src/image_processing_effects.c +++ b/src/image_processing_effects.c @@ -51,7 +51,9 @@ static u16 QuantizePixel_GrayscaleSmall(u16*); static u16 QuantizePixel_Grayscale(u16*); static u16 QuantizePixel_PrimaryColors(u16*); -extern const u8 gPointillismPoints[][3]; +#define MAX_DIMENSION 64 + +#include "data/pointillism_points.h" void ApplyImageProcessingEffects(struct ImageProcessingContext *context) { @@ -169,7 +171,7 @@ static void ApplyImageEffect_RedChannelGrayscaleHighlight(u8 highlight) static void ApplyImageEffect_Pointillism(void) { u32 i; - for (i = 0; i < 3200; i++) + for (i = 0; i < ARRAY_COUNT(sPointillismPoints); i++) AddPointillismPoints(i); } @@ -307,9 +309,9 @@ static void ApplyImageEffect_Shimmer(void) // First, invert all of the colors. pixel = gCanvasPixels; - for (i = 0; i < 64; i++) + for (i = 0; i < MAX_DIMENSION; i++) { - for (j = 0; j < 64; j++, pixel++) + for (j = 0; j < MAX_DIMENSION; j++, pixel++) { if (!IS_ALPHA(*pixel)) *pixel = QuantizePixel_Invert(pixel); @@ -317,16 +319,16 @@ static void ApplyImageEffect_Shimmer(void) } // Blur the pixels twice. - for (j = 0; j < 64; j++) + for (j = 0; j < MAX_DIMENSION; j++) { pixel = &gCanvasPixels[j]; prevPixel = *pixel; *pixel = RGB_ALPHA; - for (i = 1, pixel += 64; i < 63; i++, pixel += 64) + for (i = 1, pixel += MAX_DIMENSION; i < MAX_DIMENSION - 1; i++, pixel += MAX_DIMENSION) { if (!IS_ALPHA(*pixel)) { - *pixel = QuantizePixel_BlurHard(&prevPixel, pixel, pixel + 64); + *pixel = QuantizePixel_BlurHard(&prevPixel, pixel, pixel + MAX_DIMENSION); prevPixel = *pixel; } } @@ -335,11 +337,11 @@ static void ApplyImageEffect_Shimmer(void) pixel = &gCanvasPixels[j]; prevPixel = *pixel; *pixel = RGB_ALPHA; - for (i = 1, pixel += 64; i < 63; i++, pixel += 64) + for (i = 1, pixel += MAX_DIMENSION; i < MAX_DIMENSION - 1; i++, pixel += MAX_DIMENSION) { if (!IS_ALPHA(*pixel)) { - *pixel = QuantizePixel_BlurHard(&prevPixel, pixel, pixel + 64); + *pixel = QuantizePixel_BlurHard(&prevPixel, pixel, pixel + MAX_DIMENSION); prevPixel = *pixel; } } @@ -351,9 +353,9 @@ static void ApplyImageEffect_Shimmer(void) // The above blur causes the outline areas to darken, which makes // this inversion give the effect of light outlines. pixel = gCanvasPixels; - for (i = 0; i < 64; i++) + for (i = 0; i < MAX_DIMENSION; i++) { - for (j = 0; j < 64; j++, pixel++) + for (j = 0; j < MAX_DIMENSION; j++, pixel++) { if (!IS_ALPHA(*pixel)) *pixel = QuantizePixel_Invert(pixel); @@ -408,19 +410,19 @@ struct PointillismPoint u16 delta; }; -static void AddPointillismPoints(u16 arg0) +static void AddPointillismPoints(u16 point) { u8 i; bool8 offsetDownLeft; u8 colorType; struct PointillismPoint points[6]; - points[0].column = gPointillismPoints[arg0][0]; - points[0].row = gPointillismPoints[arg0][1]; - points[0].delta = (gPointillismPoints[arg0][2] >> 3) & 7; + points[0].column = sPointillismPoints[point][0]; + points[0].row = sPointillismPoints[point][1]; + points[0].delta = GET_POINT_DELTA(sPointillismPoints[point][2]); - colorType = (gPointillismPoints[arg0][2] >> 1) & 3; - offsetDownLeft = gPointillismPoints[arg0][2] & 1; + colorType = GET_POINT_COLOR_TYPE(sPointillismPoints[point][2]); + offsetDownLeft = GET_POINT_OFFSET_DL(sPointillismPoints[point][2]); for (i = 1; i < points[0].delta; i++) { if (!offsetDownLeft) @@ -434,7 +436,7 @@ static void AddPointillismPoints(u16 arg0) points[i].row = points[0].row - 1; } - if (points[i].column > 63 || points[i].row > 63) + if (points[i].column >= MAX_DIMENSION || points[i].row >= MAX_DIMENSION) { points[0].delta = i - 1; break; @@ -445,7 +447,7 @@ static void AddPointillismPoints(u16 arg0) for (i = 0; i < points[0].delta; i++) { - u16 *pixel = &gCanvasPixels[points[i].row * 64] + points[i].column; + u16 *pixel = &gCanvasPixels[points[i].row * MAX_DIMENSION] + points[i].column; if (!IS_ALPHA(*pixel)) { @@ -457,7 +459,7 @@ static void AddPointillismPoints(u16 arg0) { case 0: case 1: - switch (((gPointillismPoints[arg0][2] >> 3) & 7) % 3) + switch (GET_POINT_DELTA(sPointillismPoints[point][2]) % 3) { case 0: if (red >= points[i].delta) diff --git a/src/international_string_util.c b/src/international_string_util.c index 23ca6c081..ed1e17816 100644 --- a/src/international_string_util.c +++ b/src/international_string_util.c @@ -152,7 +152,7 @@ void PadNameString(u8 *dest, u8 padChar) dest[length] = EOS; } -void sub_81DB52C(u8 *str) +void ConvertInternationalPlayerName(u8 *str) { if (StringLength(str) < PLAYER_NAME_LENGTH - 1) ConvertInternationalString(str, LANGUAGE_JAPANESE); @@ -160,14 +160,14 @@ void sub_81DB52C(u8 *str) StripExtCtrlCodes(str); } -void sub_81DB554(u8 *str, u8 arg1) +void ConvertInternationalPlayerNameStripChar(u8 *str, u8 removeChar) { u8 *buffer; if (StringLength(str) < PLAYER_NAME_LENGTH - 1) { ConvertInternationalString(str, LANGUAGE_JAPANESE); } - else if (arg1 == EXT_CTRL_CODE_BEGIN) + else if (removeChar == EXT_CTRL_CODE_BEGIN) { StripExtCtrlCodes(str); } @@ -177,7 +177,7 @@ void sub_81DB554(u8 *str, u8 arg1) while (buffer[1] != EOS) buffer++; - while (buffer >= str && buffer[0] == arg1) + while (buffer >= str && buffer[0] == removeChar) { buffer[0] = EOS; buffer--; @@ -214,7 +214,7 @@ int sub_81DB604(u8 *str) if (str[0] == EXT_CTRL_CODE_BEGIN && str[1] == EXT_CTRL_CODE_JPN) return LANGUAGE_JAPANESE; else - return LANGUAGE_ENGLISH; + return GAME_LANGUAGE; } void sub_81DB620(int windowId, int columnStart, int rowStart, int numFillTiles, int numRows) diff --git a/src/intro.c b/src/intro.c index 7c92913b6..324ec6d46 100644 --- a/src/intro.c +++ b/src/intro.c @@ -1006,7 +1006,7 @@ static u8 SetUpCopyrightScreen(void) ResetTasks(); ResetSpriteData(); FreeAllSpritePalettes(); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_WHITEALPHA); SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(7) @@ -1026,7 +1026,7 @@ static u8 SetUpCopyrightScreen(void) GameCubeMultiBoot_Main(&gMultibootProgramStruct); if (gMultibootProgramStruct.gcmb_field_2 != 1) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gMain.state++; } break; @@ -1121,7 +1121,7 @@ static void Task_IntroLoadPart1Graphics(u8 taskId) static void Task_IntroFadeIn(u8 taskId) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); SetVBlankCallback(VBlankCB_Intro); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON); gTasks[taskId].func = Task_IntroWaterDrops; @@ -1232,7 +1232,7 @@ static void Task_IntroScrollDownAndShowFlygon(u8 taskId) //fade to white if (gIntroFrameCounter > 1007) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_WHITEALPHA); gTasks[taskId].func = Task_IntroWaitToSetupPart2; } } @@ -1291,7 +1291,7 @@ static void Task_IntroStartBikeRide(u8 taskId) spriteId = intro_create_flygon_sprite(-0x40, 0x3C); gSprites[spriteId].callback = SpriteCB_IntroGraphicsFlygon; gTasks[taskId].data[2] = spriteId; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_WHITEALPHA); SetVBlankCallback(VBlankCB_Intro); gTasks[taskId].data[0] = CreateBicycleAnimationTask(1, 0x4000, 0x400, 0x10); sub_817B150(1); @@ -1310,7 +1310,7 @@ static void Task_IntroHandleBikeAndFlygonMovement(u8 taskId) } if (gIntroFrameCounter > 1946) { - BeginNormalPaletteFade(0xFFFFFFFF, 8, 0, 16, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL, 8, 0, 16, RGB_WHITEALPHA); gTasks[taskId].func = Task_IntroWaitToSetupPart3; } if (gIntroFrameCounter == 1109) @@ -1554,7 +1554,7 @@ static void Task_IntroLoadPart3Graphics(u8 taskId) PanFadeAndZoomScreen(0x78, 0x50, 0, 0); ResetSpriteData(); FreeAllSpritePalettes(); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_WHITEALPHA); SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(8) | BGCNT_256COLOR | BGCNT_AFF256x256); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG2_ON | DISPCNT_OBJ_ON); gTasks[taskId].func = Task_IntroSpinAndZoomPokeball; @@ -1576,10 +1576,10 @@ static void Task_IntroSpinAndZoomPokeball(u8 taskId) gTasks[taskId].func = Task_IntroWaitToSetupPart3LegendsFight; } - PanFadeAndZoomScreen(0x78, 0x50, 0x10000 / gTasks[taskId].data[1], gTasks[taskId].data[0]); + PanFadeAndZoomScreen(0x78, 0x50, SAFE_DIV(0x10000, gTasks[taskId].data[1]), gTasks[taskId].data[0]); if (gIntroFrameCounter == 28) - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_WHITEALPHA); } static void Task_IntroWaitToSetupPart3LegendsFight(u8 taskId) @@ -1630,7 +1630,7 @@ static void Task_IntroLoadPart3Graphics1(u8 taskId) | DISPCNT_BG2_ON | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_WHITEALPHA); gTasks[taskId].data[0] = 0; gTasks[taskId].data[1] = 0xFFA0; gTasks[taskId].data[2] = 0xFF51; @@ -1749,7 +1749,7 @@ static void Task_IntroGroudonScene(u8 taskId) data[3] = Sin((data[6] & 0xFF00) >> 8, 0x40) + 0x100; if (data[1] == 0x78) { - BeginNormalPaletteFade(0xFFFFFFFE, 3, 0, 16, RGB_WHITE); + BeginNormalPaletteFade(PALETTES_ALL & ~1, 3, 0, 16, RGB_WHITE); data[3] = 0x100; data[4] = 0; data[0]++; @@ -1824,7 +1824,7 @@ static void Task_IntroLoadKyogreScene(u8 taskId) LZDecompressVram(gIntro3KyogreBgTilemap, (void *)(BG_SCREEN_ADDR(28))); LoadCompressedSpriteSheet(gUnknown_085E4C88); LoadSpritePalette(gUnknown_085E4C98); - BeginNormalPaletteFade(0xFFFFFFFE, 0, 0x10, 0, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL & ~1, 0, 0x10, 0, RGB_WHITEALPHA); gTasks[taskId].func = Task_IntroKyogreScene; gTasks[taskId].data[0] = 0; gTasks[taskId].data[1] = 0x150; @@ -1958,7 +1958,7 @@ static void Task_IntroKyogreScene(u8 taskId) gTasks[taskId].data[1] = Sin(data[6], 0x3C) + 0x58; if (data[6] == 0x40) { - BeginNormalPaletteFade(0xFFFFFFFE, 3, 0, 16, RGB_WHITE); + BeginNormalPaletteFade(PALETTES_ALL & ~1, 3, 0, 16, RGB_WHITE); data[0]++; } break; @@ -2117,14 +2117,14 @@ static void Task_IntroCloudScene(u8 taskId) case 0: if (--data[6] == 0) { - BeginNormalPaletteFade(0xFFFFFFFE, 0, 16, 0, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL & ~1, 0, 16, 0, RGB_WHITEALPHA); data[6] = 0x5000; data[0]++; } break; case 1: if (data[6] == 0x2800) - BeginNormalPaletteFade(0x0000FFFE, 3, 0, 16, RGB(9, 10, 10)); + BeginNormalPaletteFade(PALETTES_BG & ~1, 3, 0, 16, RGB(9, 10, 10)); if (data[6] != 0) data[6] -= 0x80; @@ -2236,7 +2236,7 @@ static void Task_IntroLoadRayquazaGlowScene(u8 taskId) | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON); gTasks[taskId].func = Task_IntroRayquazaGlowScene_0; - BeginNormalPaletteFade(0x0000FFDE, 0, 16, 0, RGB(9, 10, 10)); + BeginNormalPaletteFade(PALETTES_BG & ~(0x21), 0, 16, 0, RGB(9, 10, 10)); gTasks[taskId].data[0] = 0; gTasks[taskId].data[1] = 0xA8; gTasks[taskId].data[2] = -0x10; @@ -2383,7 +2383,7 @@ static void Task_IntroRayquazaGlowScene_1(u8 taskId) case 4: if (--data[3] == 0) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_WHITE); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_WHITE); data[0]++; } break; diff --git a/src/item.c b/src/item.c index 91d2f1a0a..892092184 100644 --- a/src/item.c +++ b/src/item.c @@ -19,9 +19,6 @@ extern u16 gUnknown_0203CF30[]; // this file's functions -#if !defined(NONMATCHING) && MODERN -#define static -#endif static bool8 CheckPyramidBagHasItem(u16 itemId, u16 count); static bool8 CheckPyramidBagHasSpace(u16 itemId, u16 count); diff --git a/src/item_icon.c b/src/item_icon.c index 487b89b71..dc69d0331 100644 --- a/src/item_icon.c +++ b/src/item_icon.c @@ -7,8 +7,8 @@ #include "constants/items.h" // EWRAM vars -EWRAM_DATA void *gItemIconDecompressionBuffer = NULL; -EWRAM_DATA void *gItemIcon4x4Buffer = NULL; +EWRAM_DATA u8 *gItemIconDecompressionBuffer = NULL; +EWRAM_DATA u8 *gItemIcon4x4Buffer = NULL; // const rom data #include "data/item_icon_table.h" @@ -55,12 +55,10 @@ const struct SpriteTemplate gItemIconSpriteTemplate = // code bool8 AllocItemIconTemporaryBuffers(void) { - gItemIconDecompressionBuffer = gItemIconDecompressionBuffer; // needed to match gItemIconDecompressionBuffer = Alloc(0x120); if (gItemIconDecompressionBuffer == NULL) return FALSE; - gItemIcon4x4Buffer = gItemIcon4x4Buffer; // needed to match gItemIcon4x4Buffer = AllocZeroed(0x200); if (gItemIcon4x4Buffer == NULL) { diff --git a/src/item_menu.c b/src/item_menu.c index 6d30038d0..8836c0c63 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -86,7 +86,7 @@ u16 BagGetQuantityByPocketPosition(u8, u16); void BagDestroyPocketSwitchArrowPair(void); void TaskCloseBagMenu_2(u8); u8 AddItemMessageWindow(u8); -void BagMenu_RemoveBagItemMessageindow(u8); +void BagMenu_RemoveBagItemMessageWindow(u8); void set_callback3_to_bag(u8); void PrintItemDepositAmount(u8, s16); static u8 BagMenu_AddWindow(u8); @@ -594,8 +594,8 @@ void GoToBagMenu(u8 location, u8 pocket, void ( *postExitMenuMainCallback2)()) gBagMenu->pocketSwitchDisabled = TRUE; gBagMenu->exitCallback = NULL; gBagMenu->itemOriginalLocation = 0xFF; - gBagMenu->pocketScrollArrowsTask = 0xFF; - gBagMenu->pocketSwitchArrowsTask = 0xFF; + gBagMenu->pocketScrollArrowsTask = TASK_NONE; + gBagMenu->pocketSwitchArrowsTask = TASK_NONE; memset(gBagMenu->spriteId, 0xFF, sizeof(gBagMenu->spriteId)); memset(gBagMenu->windowPointers, 0xFF, 10); SetMainCallback2(CB2_Bag); @@ -720,11 +720,11 @@ bool8 SetupBagMenu(void) gMain.state++; break; case 19: - BlendPalettes(0xFFFFFFFF, 16, 0); + BlendPalettes(PALETTES_ALL, 16, 0); gMain.state++; break; case 20: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); gPaletteFade.bufferTransferDisabled = FALSE; gMain.state++; break; @@ -971,7 +971,7 @@ void BagMenu_PrintCursor(u8 y, u8 colorIndex) void CreatePocketScrollArrowPair(void) { - if (gBagMenu->pocketScrollArrowsTask == 0xFF) + if (gBagMenu->pocketScrollArrowsTask == TASK_NONE) gBagMenu->pocketScrollArrowsTask = AddScrollIndicatorArrowPairParameterized( SCROLL_ARROW_UP, 172, @@ -985,26 +985,26 @@ void CreatePocketScrollArrowPair(void) void BagDestroyPocketScrollArrowPair(void) { - if (gBagMenu->pocketScrollArrowsTask != 0xFF) + if (gBagMenu->pocketScrollArrowsTask != TASK_NONE) { RemoveScrollIndicatorArrowPair(gBagMenu->pocketScrollArrowsTask); - gBagMenu->pocketScrollArrowsTask = 0xFF; + gBagMenu->pocketScrollArrowsTask = TASK_NONE; } BagDestroyPocketSwitchArrowPair(); } void CreatePocketSwitchArrowPair(void) { - if (gBagMenu->pocketSwitchDisabled != TRUE && gBagMenu->pocketSwitchArrowsTask == 0xFF) + if (gBagMenu->pocketSwitchDisabled != TRUE && gBagMenu->pocketSwitchArrowsTask == TASK_NONE) gBagMenu->pocketSwitchArrowsTask = AddScrollIndicatorArrowPair(&sBagScrollArrowsTemplate, &gBagPositionStruct.unk6); } void BagDestroyPocketSwitchArrowPair(void) { - if (gBagMenu->pocketSwitchArrowsTask != 0xFF) + if (gBagMenu->pocketSwitchArrowsTask != TASK_NONE) { RemoveScrollIndicatorArrowPair(gBagMenu->pocketSwitchArrowsTask); - gBagMenu->pocketSwitchArrowsTask = 0xFF; + gBagMenu->pocketSwitchArrowsTask = TASK_NONE; } } @@ -1018,7 +1018,7 @@ void FreeBagItemListBuffers(void) void Task_FadeAndCloseBagMenu(u8 taskId) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].func = TaskCloseBagMenu_2; } @@ -1115,7 +1115,7 @@ void BagMenu_InitListsMenu(u8 taskId) s16* data = gTasks[taskId].data; u16* scrollPos = &gBagPositionStruct.scrollPosition[gBagPositionStruct.pocket]; u16* cursorPos = &gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket]; - BagMenu_RemoveBagItemMessageindow(4); + BagMenu_RemoveBagItemMessageWindow(4); DestroyListMenuTask(data[0], scrollPos, cursorPos); UpdatePocketItemList(gBagPositionStruct.pocket); SetInitialScrollAndCursorPositions(gBagPositionStruct.pocket); @@ -1971,7 +1971,7 @@ bool8 UseRegisteredKeyItemOnField(void) { ScriptContext2_Enable(); FreezeObjectEvents(); - sub_808B864(); + PlayerFreeze(); sub_808BCF4(); gSpecialVar_ItemId = gSaveBlock1Ptr->registeredItem; taskId = CreateTask(ItemId_GetFieldFunc(gSaveBlock1Ptr->registeredItem), 8); @@ -2035,7 +2035,7 @@ void BagMenu_CancelSell(u8 taskId) s16* data = gTasks[taskId].data; RemoveMoneyWindow(); - BagMenu_RemoveBagItemMessageindow(4); + BagMenu_RemoveBagItemMessageWindow(4); BagMenu_PrintCursor_(data[0], 0); set_callback3_to_bag(taskId); } @@ -2070,7 +2070,7 @@ static void Task_SellHowManyDialogueHandleInput(u8 taskId) BagMenu_PrintCursor_(data[0], 0); RemoveMoneyWindow(); BagMenu_RemoveWindow(8); - BagMenu_RemoveBagItemMessageindow(4); + BagMenu_RemoveBagItemMessageWindow(4); set_callback3_to_bag(taskId); } } @@ -2390,7 +2390,7 @@ u8 sub_81AE124(u8 which) u8 BagMenu_AddWindow(u8 which) { u8 *ptr = &gBagMenu->windowPointers[which]; - if (*ptr == 0xFF) + if (*ptr == WINDOW_NONE) { *ptr = AddWindow(&sContextMenuWindowTemplates[which]); DrawStdFrameWithCustomTileAndPalette(*ptr, 0, 1, 14); @@ -2402,35 +2402,35 @@ u8 BagMenu_AddWindow(u8 which) void BagMenu_RemoveWindow(u8 which) { u8 *ptr = &gBagMenu->windowPointers[which]; - if (*ptr != 0xFF) + if (*ptr != WINDOW_NONE) { ClearStdWindowAndFrameToTransparent(*ptr, FALSE); ClearWindowTilemap(*ptr); RemoveWindow(*ptr); ScheduleBgCopyTilemapToVram(1); - *ptr = 0xFF; + *ptr = WINDOW_NONE; } } u8 AddItemMessageWindow(u8 which) { u8 *ptr = &gBagMenu->windowPointers[which]; - if (*ptr == 0xFF) + if (*ptr == WINDOW_NONE) *ptr = AddWindow(&sContextMenuWindowTemplates[which]); return *ptr; } -void BagMenu_RemoveBagItemMessageindow(u8 which) +void BagMenu_RemoveBagItemMessageWindow(u8 which) { u8 *ptr = &gBagMenu->windowPointers[which]; - if (*ptr != 0xFF) + if (*ptr != WINDOW_NONE) { ClearDialogWindowAndFrameToTransparent(*ptr, FALSE); // This ClearWindowTilemap call is redundant, since ClearDialogWindowAndFrameToTransparent already calls it. ClearWindowTilemap(*ptr); RemoveWindow(*ptr); ScheduleBgCopyTilemapToVram(1); - *ptr = 0xFF; + *ptr = WINDOW_NONE; } } diff --git a/src/item_menu_icons.c b/src/item_menu_icons.c index cc51236c8..dd0081161 100644 --- a/src/item_menu_icons.c +++ b/src/item_menu_icons.c @@ -410,13 +410,13 @@ static const struct SpriteTemplate gBerryCheckCircleSpriteTemplate = void RemoveBagSprite(u8 id) { u8 *spriteId = &gBagMenu->spriteId[id]; - if (*spriteId != 0xFF) + if (*spriteId != SPRITE_NONE) { FreeSpriteTilesByTag(id + 100); FreeSpritePaletteByTag(id + 100); FreeSpriteOamMatrix(&gSprites[*spriteId]); DestroySprite(&gSprites[*spriteId]); - *spriteId = 0xFF; + *spriteId = SPRITE_NONE; } } @@ -516,7 +516,7 @@ static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite) void AddBagItemIconSprite(u16 itemId, u8 id) { u8 *spriteId = &gBagMenu->spriteId[id + 2]; - if (*spriteId == 0xFF) + if (*spriteId == SPRITE_NONE) { u8 iconSpriteId; diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c index 7cb9b1bd6..f39ccb74c 100644 --- a/src/librfu_rfu.c +++ b/src/librfu_rfu.c @@ -1425,35 +1425,36 @@ static u16 rfu_STC_setSendData_org(u8 ni_or_uni, u8 bmSendSlot, u8 subFrameSize, sending = ni_or_uni & 0x20; if (sending || ni_or_uni == 0x40) { - u8 *dataType_p; // a hack to swap instructions - slotStatus_NI = gRfuSlotStatusNI[bm_slot_id]; slotStatus_UNI = NULL; slotStatus_NI->send.errorCode = 0; - *slotStatus_NI->send.now_p = dataType_p = &slotStatus_NI->send.dataType; + slotStatus_NI->send.now_p[0] = &slotStatus_NI->send.dataType; slotStatus_NI->send.remainSize = 7; slotStatus_NI->send.bmSlotOrg = bmSendSlot; slotStatus_NI->send.bmSlot = bmSendSlot; slotStatus_NI->send.payloadSize = subFrameSize - frameSize; if (sending != 0) - *dataType_p = 0; + slotStatus_NI->send.dataType = 0; else - *dataType_p = 1; + slotStatus_NI->send.dataType = 1; + slotStatus_NI->send.dataSize = dataSize; slotStatus_NI->send.src = src; slotStatus_NI->send.ack = 0; slotStatus_NI->send.phase = 0; - #ifndef NONMATCHING // to fix r2, r3, r4, r5 register roulette - asm("":::"r2"); - #endif for (i = 0; i < WINDOW_COUNT; ++i) { slotStatus_NI->send.recvAckFlag[i] = 0; slotStatus_NI->send.n[i] = 1; } for (bm_slot_id = 0; bm_slot_id < RFU_CHILD_MAX; ++bm_slot_id) - if ((bmSendSlot >> bm_slot_id) & 1) - gRfuSlotStatusNI[bm_slot_id]->send.failCounter = 0; + { + do + { + if ((bmSendSlot >> bm_slot_id) & 1) + gRfuSlotStatusNI[bm_slot_id]->send.failCounter = 0; + } while (0); + } gRfuLinkStatus->sendSlotNIFlag |= bmSendSlot; *llFrameSize_p -= subFrameSize; slotStatus_NI->send.state = SLOT_STATE_SEND_START; diff --git a/src/lilycove_lady.c b/src/lilycove_lady.c index 011d9fdfd..5bad07420 100644 --- a/src/lilycove_lady.c +++ b/src/lilycove_lady.c @@ -379,7 +379,7 @@ u8 GetQuizAuthor(void) struct LilycoveLadyQuiz *quiz; quiz = &gSaveBlock1Ptr->lilycoveLady.quiz; - if (sub_811F8D8(quiz->correctAnswer) == 0) + if (IsEasyChatAnswerUnlocked(quiz->correctAnswer) == FALSE) { i = quiz->questionId; do @@ -388,7 +388,7 @@ u8 GetQuizAuthor(void) { i = 0; } - } while (sub_811F8D8(sQuizLadyQuizAnswers[i]) == 0); + } while (IsEasyChatAnswerUnlocked(sQuizLadyQuizAnswers[i]) == FALSE); for (j = 0; j < QUIZ_QUESTION_LEN; j ++) { quiz->question[j] = sQuizLadyQuizQuestions[i][j]; diff --git a/src/link.c b/src/link.c index dffb5b4cd..6dc5a09f3 100644 --- a/src/link.c +++ b/src/link.c @@ -41,8 +41,8 @@ struct LinkTestBGInfo { u32 screenBaseBlock; u32 paletteNum; - u32 dummy_8; - u32 dummy_C; + u32 baseChar; + u32 unused; }; static struct BlockTransfer sBlockSend; @@ -97,28 +97,26 @@ struct Link gLink; u8 gLastRecvQueueCount; u16 gLinkSavedIme; -EWRAM_DATA u8 gLinkTestDebugValuesEnabled = 0; -EWRAM_DATA u8 gUnknown_020223BD = 0; +static EWRAM_DATA u8 sLinkTestDebugValuesEnabled = 0; +static EWRAM_DATA u8 sDummyFlag = FALSE; EWRAM_DATA u32 gBerryBlenderKeySendAttempts = 0; EWRAM_DATA u16 gBlockRecvBuffer[MAX_RFU_PLAYERS][BLOCK_BUFFER_SIZE / 2] = {}; EWRAM_DATA u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE] = {}; -EWRAM_DATA bool8 gLinkOpen = FALSE; +static EWRAM_DATA bool8 sLinkOpen = FALSE; EWRAM_DATA u16 gLinkType = 0; -EWRAM_DATA u16 gLinkTimeOutCounter = 0; +static EWRAM_DATA u16 sTimeOutCounter = 0; EWRAM_DATA struct LinkPlayer gLocalLinkPlayer = {}; EWRAM_DATA struct LinkPlayer gLinkPlayers[MAX_RFU_PLAYERS] = {}; -EWRAM_DATA struct LinkPlayer gSavedLinkPlayers[MAX_RFU_PLAYERS] = {}; +static EWRAM_DATA struct LinkPlayer sSavedLinkPlayers[MAX_RFU_PLAYERS] = {}; EWRAM_DATA struct { u32 status; u8 lastRecvQueueCount; u8 lastSendQueueCount; - u8 unk_06; + bool8 disconnected; } sLinkErrorBuffer = {}; static EWRAM_DATA u16 sReadyCloseLinkAttempts = 0; // never read static EWRAM_DATA void *sLinkErrorBgTilemapBuffer = NULL; -// Static ROM declarations - static void InitLocalLinkPlayer(void); static void VBlankCB_LinkError(void); static void CB2_LinkTest(void); @@ -131,7 +129,7 @@ static void LinkCB_BlockSend(void); static void LinkCB_BlockSendEnd(void); static void SetBlockReceivedFlag(u8 who); static u16 LinkTestCalcBlockChecksum(const u16 *src, u16 size); -static void LinkTest_prnthex(u32 pos, u8 a0, u8 a1, u8 a2); +static void LinkTest_PrintHex(u32 pos, u8 a0, u8 a1, u8 a2); static void LinkCB_RequestPlayerDataExchange(void); static void Task_PrintTestData(u8 taskId); @@ -160,15 +158,13 @@ static void DoSend(void); static void StopTimer(void); static void SendRecvDone(void); -// .rodata - static const u16 sWirelessLinkDisplayPal[] = INCBIN_U16("graphics/interface/wireless_link_display.gbapal"); static const u32 sWirelessLinkDisplayGfx[] = INCBIN_U32("graphics/interface/wireless_link_display.4bpp.lz"); static const u32 sWirelessLinkDisplayTilemap[] = INCBIN_U32("graphics/interface/wireless_link_display.bin.lz"); static const u16 sLinkTestDigitsPal[] = INCBIN_U16("graphics/interface/link_test_digits.gbapal"); static const u16 sLinkTestDigitsGfx[] = INCBIN_U16("graphics/interface/link_test_digits.4bpp"); static const u8 sUnusedTransparentWhite[] = _("{HIGHLIGHT TRANSPARENT}{COLOR WHITE}"); -static const u16 s2BlankTilesGfx[] = INCBIN_U16("graphics/interface/blank_1x2.4bpp"); +static const u16 sCommErrorBg_Gfx[] = INCBIN_U16("graphics/interface/comm_error_bg.4bpp"); static const struct BlockRequest sBlockRequests[] = { {gBlockSendBuffer, 200}, {gBlockSendBuffer, 200}, @@ -226,15 +222,13 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = { }; static const u8 sTextColors[] = { TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY }; -static const u8 sUnused_082ED224[] = {0x00, 0xFF, 0xFE, 0xFF, 0x00}; - -// .text +static const u8 sUnusedData[] = {0x00, 0xFF, 0xFE, 0xFF, 0x00}; bool8 IsWirelessAdapterConnected(void) { SetWirelessCommType1(); InitRFUAPI(); - if (rfu_LMAN_REQBN_softReset_and_checkID() == 0x8001) + if (rfu_LMAN_REQBN_softReset_and_checkID() == RFU_ID) { rfu_REQ_stopMode(); rfu_waitREQComplete(); @@ -251,13 +245,13 @@ void Task_DestroySelf(u8 taskId) DestroyTask(taskId); } -static void InitLinkTestBG(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charBaseBlock, u16 a4) +static void InitLinkTestBG(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charBaseBlock, u16 baseChar) { LoadPalette(sLinkTestDigitsPal, paletteNum * 16, 0x20); - DmaCopy16(3, sLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock) + (16 * a4), sizeof sLinkTestDigitsGfx); + DmaCopy16(3, sLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock) + (16 * baseChar), sizeof sLinkTestDigitsGfx); gLinkTestBGInfo.screenBaseBlock = screenBaseBlock; gLinkTestBGInfo.paletteNum = paletteNum; - gLinkTestBGInfo.dummy_8 = a4; + gLinkTestBGInfo.baseChar = baseChar; switch (bgNum) { case 1: @@ -274,17 +268,19 @@ static void InitLinkTestBG(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charB SetGpuReg(REG_OFFSET_BG0VOFS + bgNum * 4, 0); } -void sub_80094EC(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charBaseBlock) +// Unused +static void LoadLinkTestBgGfx(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charBaseBlock) { LoadPalette(sLinkTestDigitsPal, paletteNum * 16, 0x20); DmaCopy16(3, sLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock), sizeof sLinkTestDigitsGfx); gLinkTestBGInfo.screenBaseBlock = screenBaseBlock; gLinkTestBGInfo.paletteNum = paletteNum; - gLinkTestBGInfo.dummy_8 = 0; + gLinkTestBGInfo.baseChar = 0; SetGpuReg(sBGControlRegs[bgNum], BGCNT_SCREENBASE(screenBaseBlock) | BGCNT_CHARBASE(charBaseBlock)); } -void LinkTestScreen(void) +// Unused +static void LinkTestScreen(void) { int i; @@ -346,10 +342,9 @@ static void InitLink(void) int i; for (i = 0; i < CMD_LENGTH; i++) - { - gSendCmd[i] = 0xEfff; - } - gLinkOpen = TRUE; + gSendCmd[i] = LINKCMD_NONE; + + sLinkOpen = TRUE; EnableSerial(); } @@ -402,7 +397,7 @@ void CloseLink(void) { LinkRfu_Shutdown(); } - gLinkOpen = FALSE; + sLinkOpen = FALSE; DisableSerial(); } @@ -413,14 +408,14 @@ static void TestBlockTransfer(u8 nothing, u8 is, u8 used) if (sLinkTestLastBlockSendPos != sBlockSend.pos) { - LinkTest_prnthex(sBlockSend.pos, 2, 3, 2); + LinkTest_PrintHex(sBlockSend.pos, 2, 3, 2); sLinkTestLastBlockSendPos = sBlockSend.pos; } for (i = 0; i < MAX_LINK_PLAYERS; i++) { if (sLinkTestLastBlockRecvPos[i] != sBlockRecv[i].pos) { - LinkTest_prnthex(sBlockRecv[i].pos, 2, i + 4, 2); + LinkTest_PrintHex(sBlockRecv[i].pos, 2, i + 4, 2); sLinkTestLastBlockRecvPos[i] = sBlockRecv[i].pos; } } @@ -435,8 +430,8 @@ static void TestBlockTransfer(u8 nothing, u8 is, u8 used) ResetBlockReceivedFlag(i); if (gLinkTestBlockChecksums[i] != 0x0342) { - gLinkTestDebugValuesEnabled = FALSE; - gUnknown_020223BD = FALSE; + sLinkTestDebugValuesEnabled = FALSE; + sDummyFlag = FALSE; } } } @@ -455,7 +450,7 @@ static void LinkTestProcessKeyInput(void) } if (JOY_NEW(L_BUTTON)) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(2, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB(2, 0, 0)); } if (JOY_NEW(START_BUTTON)) { @@ -469,7 +464,7 @@ static void LinkTestProcessKeyInput(void) { SetCloseLinkCallback(); } - if (gLinkTestDebugValuesEnabled) + if (sLinkTestDebugValuesEnabled) { SetLinkDebugValues(gMain.vblankCounter2, gLinkCallback ? gLinkVSyncDisabled : gLinkVSyncDisabled | 0x10); } @@ -489,7 +484,7 @@ u16 LinkMain2(const u16 *heldKeys) { u8 i; - if (!gLinkOpen) + if (!sLinkOpen) { return 0; } @@ -555,10 +550,10 @@ static void ProcessRecvCmds(u8 unused) case LINKCMD_BLENDER_SEND_KEYS: gLinkPartnersHeldKeys[i] = gRecvCmds[i][1]; break; - case LINKCMD_0x5555: + case LINKCMD_DUMMY_1: gLinkDummy2 = TRUE; break; - case LINKCMD_0x5566: + case LINKCMD_DUMMY_2: gLinkDummy2 = TRUE; break; case LINKCMD_INIT_BLOCK: @@ -612,7 +607,7 @@ static void ProcessRecvCmds(u8 unused) linkPlayer->neverRead = 0; linkPlayer->progressFlags = 0; } - sub_800B524(linkPlayer); + ConvertLinkPlayerName(linkPlayer); if (strcmp(block->magic1, sASCIIGameFreakInc) != 0 || strcmp(block->magic2, sASCIIGameFreakInc) != 0) { @@ -664,22 +659,19 @@ static void BuildSendCmd(u16 command) gSendCmd[0] = LINKCMD_BLENDER_SEND_KEYS; gSendCmd[1] = gMain.heldKeys; break; - case LINKCMD_0x5555: - gSendCmd[0] = LINKCMD_0x5555; + case LINKCMD_DUMMY_1: + gSendCmd[0] = LINKCMD_DUMMY_1; break; - case LINKCMD_0x6666: - gSendCmd[0] = LINKCMD_0x6666; + case LINKCMD_SEND_EMPTY: + gSendCmd[0] = LINKCMD_SEND_EMPTY; gSendCmd[1] = 0; break; - case LINKCMD_0x7777: + case LINKCMD_SEND_0xEE: { u8 i; - - gSendCmd[0] = LINKCMD_0x7777; + gSendCmd[0] = LINKCMD_SEND_0xEE; for (i = 0; i < 5; i++) - { gSendCmd[i + 1] = 0xEE; - } break; } case LINKCMD_INIT_BLOCK: @@ -690,8 +682,8 @@ static void BuildSendCmd(u16 command) case LINKCMD_BLENDER_NO_PBLOCK_SPACE: gSendCmd[0] = LINKCMD_BLENDER_NO_PBLOCK_SPACE; break; - case LINKCMD_0xAAAB: - gSendCmd[0] = LINKCMD_0xAAAB; + case LINKCMD_SEND_ITEM: + gSendCmd[0] = LINKCMD_SEND_ITEM; gSendCmd[1] = gSpecialVar_ItemId; break; case LINKCMD_SEND_BLOCK_REQ: @@ -702,14 +694,13 @@ static void BuildSendCmd(u16 command) gSendCmd[0] = LINKCMD_READY_CLOSE_LINK; gSendCmd[1] = gReadyCloseLinkType; break; - case LINKCMD_0x5566: - gSendCmd[0] = LINKCMD_0x5566; + case LINKCMD_DUMMY_2: + gSendCmd[0] = LINKCMD_DUMMY_2; break; case LINKCMD_SEND_HELD_KEYS: if (gHeldKeyCodeToSend == 0 || gLinkTransferringData) - { break; - } + gSendCmd[0] = LINKCMD_SEND_HELD_KEYS; gSendCmd[1] = gHeldKeyCodeToSend; break; @@ -819,7 +810,7 @@ bool32 Link_AnyPartnersPlayingFRLG_JP(void) void OpenLinkTimed(void) { sPlayerDataExchangeStatus = EXCHANGE_NOT_STARTED; - gLinkTimeOutCounter = 0; + sTimeOutCounter = 0; OpenLink(); } @@ -892,7 +883,7 @@ u8 GetLinkPlayerDataExchangeStatusTimed(int minPlayers, int maxPlayers) } } } - else if (++gLinkTimeOutCounter > 600) + else if (++sTimeOutCounter > 600) { sPlayerDataExchangeStatus = EXCHANGE_TIMED_OUT; } @@ -909,9 +900,7 @@ bool8 IsLinkPlayerDataExchangeComplete(void) for (i = 0; i < GetLinkPlayerCount(); i++) { if (gLinkPlayers[i].linkType == gLinkPlayers[0].linkType) - { count++; - } } if (count == GetLinkPlayerCount()) { @@ -936,9 +925,7 @@ void ResetLinkPlayers(void) int i; for (i = 0; i <= MAX_LINK_PLAYERS; i++) - { gLinkPlayers[i] = (struct LinkPlayer){}; - } } static void ResetBlockSend(void) @@ -966,9 +953,8 @@ static bool32 InitBlockSend(const void *src, size_t size) else { if (src != gBlockSendBuffer) - { memcpy(gBlockSendBuffer, src, size); - } + sBlockSend.src = gBlockSendBuffer; } BuildSendCmd(LINKCMD_INIT_BLOCK); @@ -980,9 +966,7 @@ static bool32 InitBlockSend(const void *src, size_t size) static void LinkCB_BlockSendBegin(void) { if (++sBlockSendDelayCounter > 2) - { gLinkCallback = LinkCB_BlockSend; - } } static void LinkCB_BlockSend(void) @@ -1020,13 +1004,9 @@ void SetBerryBlenderLinkCallback(void) { gBerryBlenderKeySendAttempts = 0; if (gWirelessCommType) - { Rfu_SetBerryBlenderLinkCallback(); - } else - { gLinkCallback = LinkCB_BerryBlenderSendHeldKeys; - } } // Unused @@ -1044,9 +1024,8 @@ static void SendBerryBlenderNoSpaceForPokeblocks(void) u8 GetMultiplayerId(void) { if (gWirelessCommType == TRUE) - { return Rfu_GetMultiplayerId(); - } + return SIO_MULTI_CNT->id; } @@ -1061,18 +1040,16 @@ u8 bitmask_all_link_players_but_self(void) bool8 SendBlock(u8 unused, const void *src, u16 size) { if (gWirelessCommType == TRUE) - { return Rfu_InitBlockSend(src, size); - } + return InitBlockSend(src, size); } bool8 SendBlockRequest(u8 blockReqType) { if (gWirelessCommType == TRUE) - { return Rfu_SendBlockRequest(blockReqType); - } + if (gLinkCallback == NULL) { gBlockRequestType = blockReqType; @@ -1085,31 +1062,25 @@ bool8 SendBlockRequest(u8 blockReqType) bool8 IsLinkTaskFinished(void) { if (gWirelessCommType == TRUE) - { return IsLinkRfuTaskFinished(); - } + return gLinkCallback == NULL; } u8 GetBlockReceivedStatus(void) { if (gWirelessCommType == TRUE) - { return Rfu_GetBlockReceivedStatus(); - } + return (gBlockReceivedStatus[3] << 3) | (gBlockReceivedStatus[2] << 2) | (gBlockReceivedStatus[1] << 1) | (gBlockReceivedStatus[0] << 0); } static void SetBlockReceivedFlag(u8 who) { if (gWirelessCommType == TRUE) - { Rfu_SetBlockReceivedFlag(who); - } else - { gBlockReceivedStatus[who] = TRUE; - } } void ResetBlockReceivedFlags(void) @@ -1119,16 +1090,12 @@ void ResetBlockReceivedFlags(void) if (gWirelessCommType == TRUE) { for (i = 0; i < MAX_RFU_PLAYERS; i++) - { Rfu_ResetBlockReceivedFlag(i); - } } else { for (i = 0; i < MAX_LINK_PLAYERS; i++) - { gBlockReceivedStatus[i] = FALSE; - } } } @@ -1147,9 +1114,7 @@ void ResetBlockReceivedFlag(u8 who) void CheckShouldAdvanceLinkState(void) { if ((gLinkStatus & LINK_STAT_MASTER) && EXTRACT_PLAYER_COUNT(gLinkStatus) > 1) - { gShouldAdvanceLinkState = 1; - } } static u16 LinkTestCalcBlockChecksum(const u16 *src, u16 size) @@ -1159,92 +1124,90 @@ static u16 LinkTestCalcBlockChecksum(const u16 *src, u16 size) chksum = 0; for (i = 0; i < size / 2; i++) - { chksum += src[i]; - } + return chksum; } -static void LinkTest_prnthexchar(char a0, u8 a1, u8 a2) +static void LinkTest_PrintNumChar(char val, u8 x, u8 y) { u16 *vAddr; vAddr = (u16 *)BG_SCREEN_ADDR(gLinkTestBGInfo.screenBaseBlock); - vAddr[a2 * 32 + a1] = (gLinkTestBGInfo.paletteNum << 12) | (a0 + 1 + gLinkTestBGInfo.dummy_8); + vAddr[y * 32 + x] = (gLinkTestBGInfo.paletteNum << 12) | (val + 1 + gLinkTestBGInfo.baseChar); } -static void LinkTest_prntchar(char a0, u8 a1, u8 a2) +static void LinkTest_PrintChar(char val, u8 x, u8 y) { u16 *vAddr; vAddr = (u16 *)BG_SCREEN_ADDR(gLinkTestBGInfo.screenBaseBlock); - vAddr[a2 * 32 + a1] = (gLinkTestBGInfo.paletteNum << 12) | (a0 + gLinkTestBGInfo.dummy_8); + vAddr[y * 32 + x] = (gLinkTestBGInfo.paletteNum << 12) | (val + gLinkTestBGInfo.baseChar); } -static void LinkTest_prnthex(u32 pos, u8 a0, u8 a1, u8 a2) +static void LinkTest_PrintHex(u32 num, u8 x, u8 y, u8 length) { - char sp[32 / 2]; + char buff[16]; int i; - for (i = 0; i < a2; i++) + for (i = 0; i < length; i++) { - sp[i] = pos & 0xf; - pos >>= 4; + buff[i] = num & 0xF; + num >>= 4; } - for (i = a2 - 1; i >= 0; i--) + for (i = length - 1; i >= 0; i--) { - LinkTest_prnthexchar(sp[i], a0, a1); - a0++; + LinkTest_PrintNumChar(buff[i], x, y); + x++; } } -static void LinkTest_prntint(int a0, u8 a1, u8 a2, u8 a3) +static void LinkTest_PrintInt(int num, u8 x, u8 y, u8 length) { - char sp[32 / 2]; - int sp10; + char buff[16]; + int negX; int i; - sp10 = -1; - if (a0 < 0) + negX = -1; + if (num < 0) { - sp10 = a1; - a0 = -a0; + negX = x; + num = -num; } - for (i = 0; i < a3; i++) + for (i = 0; i < length; i++) { - sp[i] = a0 % 10; - a0 /= 10; + buff[i] = num % 10; + num /= 10; } - for (i = a3 - 1; i >= 0; i--) + for (i = length - 1; i >= 0; i--) { - LinkTest_prnthexchar(sp[i], a1, a2); - a1++; - } - if (sp10 != -1) - { - LinkTest_prnthexchar(*"\n", sp10, a2); + LinkTest_PrintNumChar(buff[i], x, y); + x++; } + + if (negX != -1) + LinkTest_PrintNumChar(*"\n", negX, y); } -static void LinkTest_prntstr(const char *a0, u8 a1, u8 a2) +static void LinkTest_PrintString(const char *str, u8 x, u8 y) { - int r6; + int xOffset; int i; - int r5; + int yOffset; - r5 = 0; - r6 = 0; - for (i = 0; a0[i] != 0; a0++) + yOffset = 0; + xOffset = 0; + for (i = 0; str[i] != 0; str++) { - if (a0[i] == *"\n") + if (str[i] == *"\n") { - r5++; - r6 = 0; + yOffset++; + xOffset = 0; } else { - LinkTest_prntchar(a0[i], a1 + r6, a2 + r5); - r6++; + LinkTest_PrintChar(str[i], x + xOffset, y + yOffset); + xOffset++; } } } @@ -1260,29 +1223,28 @@ static void LinkCB_RequestPlayerDataExchange(void) static void Task_PrintTestData(u8 taskId) { - char sp[32]; + char testTitle[32]; int i; - strcpy(sp, sASCIITestPrint); - LinkTest_prntstr(sp, 5, 2); - LinkTest_prnthex(gShouldAdvanceLinkState, 2, 1, 2); - LinkTest_prnthex(gLinkStatus, 15, 1, 8); - LinkTest_prnthex(gLink.state, 2, 10, 2); - LinkTest_prnthex(EXTRACT_PLAYER_COUNT(gLinkStatus), 15, 10, 2); - LinkTest_prnthex(GetMultiplayerId(), 15, 12, 2); - LinkTest_prnthex(gLastSendQueueCount, 25, 1, 2); - LinkTest_prnthex(gLastRecvQueueCount, 25, 2, 2); - LinkTest_prnthex(GetBlockReceivedStatus(), 15, 5, 2); - LinkTest_prnthex(gLinkDebugSeed, 2, 12, 8); - LinkTest_prnthex(gLinkDebugFlags, 2, 13, 8); - LinkTest_prnthex(GetSioMultiSI(), 25, 5, 1); - LinkTest_prnthex(IsSioMultiMaster(), 25, 6, 1); - LinkTest_prnthex(IsLinkConnectionEstablished(), 25, 7, 1); - LinkTest_prnthex(HasLinkErrorOccurred(), 25, 8, 1); + strcpy(testTitle, sASCIITestPrint); + LinkTest_PrintString(testTitle, 5, 2); + LinkTest_PrintHex(gShouldAdvanceLinkState, 2, 1, 2); + LinkTest_PrintHex(gLinkStatus, 15, 1, 8); + LinkTest_PrintHex(gLink.state, 2, 10, 2); + LinkTest_PrintHex(EXTRACT_PLAYER_COUNT(gLinkStatus), 15, 10, 2); + LinkTest_PrintHex(GetMultiplayerId(), 15, 12, 2); + LinkTest_PrintHex(gLastSendQueueCount, 25, 1, 2); + LinkTest_PrintHex(gLastRecvQueueCount, 25, 2, 2); + LinkTest_PrintHex(GetBlockReceivedStatus(), 15, 5, 2); + LinkTest_PrintHex(gLinkDebugSeed, 2, 12, 8); + LinkTest_PrintHex(gLinkDebugFlags, 2, 13, 8); + LinkTest_PrintHex(GetSioMultiSI(), 25, 5, 1); + LinkTest_PrintHex(IsSioMultiMaster(), 25, 6, 1); + LinkTest_PrintHex(IsLinkConnectionEstablished(), 25, 7, 1); + LinkTest_PrintHex(HasLinkErrorOccurred(), 25, 8, 1); + for (i = 0; i < MAX_LINK_PLAYERS; i++) - { - LinkTest_prnthex(gLinkTestBlockChecksums[i], 10, 4 + i, 4); - } + LinkTest_PrintHex(gLinkTestBlockChecksums[i], 10, 4 + i, 4); } void SetLinkDebugValues(u32 seed, u32 flags) @@ -1298,9 +1260,8 @@ u8 GetSavedLinkPlayerCountAsBitFlags(void) flags = 0; for (i = 0; i < gSavedLinkPlayerCount; i++) - { flags |= (1 << i); - } + return flags; } @@ -1311,9 +1272,8 @@ u8 GetLinkPlayerCountAsBitFlags(void) flags = 0; for (i = 0; i < GetLinkPlayerCount(); i++) - { flags |= (1 << i); - } + return flags; } @@ -1324,9 +1284,7 @@ void SaveLinkPlayers(u8 playerCount) gSavedLinkPlayerCount = playerCount; gSavedMultiplayerId = GetMultiplayerId(); for (i = 0; i < MAX_RFU_PLAYERS; i++) - { - gSavedLinkPlayers[i] = gLinkPlayers[i]; - } + sSavedLinkPlayers[i] = gLinkPlayers[i]; } // The number of players when trading began. This is frequently compared against the @@ -1349,7 +1307,7 @@ bool8 DoesLinkPlayerCountMatchSaved(void) for (i = 0; i < gSavedLinkPlayerCount; i++) { - if (gLinkPlayers[i].trainerId == gSavedLinkPlayers[i].trainerId) + if (gLinkPlayers[i].trainerId == sSavedLinkPlayers[i].trainerId) { if (gLinkType == LINKTYPE_BATTLE_TOWER) { @@ -1375,12 +1333,15 @@ bool8 DoesLinkPlayerCountMatchSaved(void) void ClearSavedLinkPlayers(void) { int i; - - // Clearly not what was meant to be written, but here it is anyway. - for (i = 0; i < 4; i++) - { - CpuSet(&gSavedLinkPlayers[i], NULL, sizeof(struct LinkPlayer)); - } + // The CpuSet loop below is incorrectly writing to NULL + // instead of sSavedLinkPlayers. + // Additionally it's using the wrong array size. +#ifdef UBFIX + memset(sSavedLinkPlayers, 0, sizeof(sSavedLinkPlayers)); +#else + for (i = 0; i < MAX_LINK_PLAYERS; i++) + CpuSet(&sSavedLinkPlayers[i], NULL, sizeof(struct LinkPlayer)); +#endif } void CheckLinkPlayersMatchSaved(void) @@ -1389,8 +1350,8 @@ void CheckLinkPlayersMatchSaved(void) for (i = 0; i < gSavedLinkPlayerCount; i++) { - if (gSavedLinkPlayers[i].trainerId != gLinkPlayers[i].trainerId - || StringCompare(gSavedLinkPlayers[i].name, gLinkPlayers[i].name) != 0) + if (sSavedLinkPlayers[i].trainerId != gLinkPlayers[i].trainerId + || StringCompare(sSavedLinkPlayers[i].name, gLinkPlayers[i].name) != 0) { gLinkErrorOccurred = TRUE; CloseLink(); @@ -1413,9 +1374,8 @@ u8 GetLinkPlayerCount_2(void) bool8 IsLinkMaster(void) { if (gWirelessCommType) - { return Rfu_IsMaster(); - } + return EXTRACT_MASTER(gLinkStatus); } @@ -1568,9 +1528,8 @@ void SetLinkStandbyCallback(void) else { if (gLinkCallback == NULL) - { gLinkCallback = LinkCB_Standby; - } + gLinkDummy1 = FALSE; } } @@ -1606,7 +1565,7 @@ static void LinkCB_StandbyForAll(void) static void CheckErrorStatus(void) { - if (gLinkOpen && EXTRACT_LINK_ERRORS(gLinkStatus)) + if (sLinkOpen && EXTRACT_LINK_ERRORS(gLinkStatus)) { if (!gSuppressLinkErrorMessage) { @@ -1620,12 +1579,12 @@ static void CheckErrorStatus(void) } } -void BufferLinkErrorInfo(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, bool8 unk_06) +void BufferLinkErrorInfo(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, bool8 disconnected) { sLinkErrorBuffer.status = status; sLinkErrorBuffer.lastSendQueueCount = lastSendQueueCount; sLinkErrorBuffer.lastRecvQueueCount = lastRecvQueueCount; - sLinkErrorBuffer.unk_06 = unk_06; + sLinkErrorBuffer.disconnected = disconnected; } void CB2_LinkError(void) @@ -1645,16 +1604,15 @@ void CB2_LinkError(void) ScanlineEffect_Stop(); if (gWirelessCommType) { - if (!sLinkErrorBuffer.unk_06) - { + if (!sLinkErrorBuffer.disconnected) gWirelessCommType = 3; - } + ResetLinkRfuGFLayer(); } SetVBlankCallback(VBlankCB_LinkError); ResetBgsAndClearDma3BusyFlags(0); InitBgsFromTemplates(0, sLinkErrorBgTemplates, ARRAY_COUNT(sLinkErrorBgTemplates)); - sLinkErrorBgTilemapBuffer = tilemapBuffer = malloc(0x800); + sLinkErrorBgTilemapBuffer = tilemapBuffer = malloc(BG_SCREEN_SIZE); SetBgTilemapBuffer(1, tilemapBuffer); if (InitWindows(sLinkErrorWindowTemplates)) { @@ -1680,9 +1638,9 @@ void CB2_LinkError(void) } } -static void sub_800B080(void) +static void ErrorMsg_MoveCloserToPartner(void) { - LoadBgTiles(0, s2BlankTilesGfx, 0x20, 0); + LoadBgTiles(0, sCommErrorBg_Gfx, 0x20, 0); DecompressAndLoadBgGfxUsingHeap(1, sWirelessLinkDisplayGfx, FALSE, 0, 0); CopyToBgTilemapBuffer(1, sWirelessLinkDisplayTilemap, 0, 0); CopyBgTilemapBufferToVram(1); @@ -1697,9 +1655,9 @@ static void sub_800B080(void) CopyWindowToVram(2, 3); } -static void sub_800B138(void) +static void ErrorMsg_CheckConnections(void) { - LoadBgTiles(0, s2BlankTilesGfx, 0x20, 0); + LoadBgTiles(0, sCommErrorBg_Gfx, 0x20, 0); FillWindowPixelBuffer(1, PIXEL_FILL(0)); FillWindowPixelBuffer(2, PIXEL_FILL(0)); AddTextPrinterParameterized3(1, 3, 2, 0, sTextColors, 0, gText_CommErrorCheckConnections); @@ -1714,21 +1672,17 @@ static void CB2_PrintErrorMessage(void) switch (gMain.state) { case 00: - if (sLinkErrorBuffer.unk_06) - { - sub_800B080(); - } + // Below is only true for the RFU, so the other error + // type is inferred to be from a wired connection + if (sLinkErrorBuffer.disconnected) + ErrorMsg_MoveCloserToPartner(); else - { - sub_800B138(); - } + ErrorMsg_CheckConnections(); break; case 02: ShowBg(0); - if (sLinkErrorBuffer.unk_06) - { + if (sLinkErrorBuffer.disconnected) ShowBg(1); - } break; case 30: PlaySE(SE_BOO); @@ -1741,13 +1695,9 @@ static void CB2_PrintErrorMessage(void) break; case 130: if (gWirelessCommType == 2) - { AddTextPrinterParameterized3(0, 3, 2, 20, sTextColors, 0, gText_ABtnTitleScreen); - } else if (gWirelessCommType == 1) - { AddTextPrinterParameterized3(0, 3, 2, 20, sTextColors, 0, gText_ABtnRegistrationCounter); - } break; } if (gMain.state == 160) @@ -1758,7 +1708,7 @@ static void CB2_PrintErrorMessage(void) { PlaySE(SE_PIN); gWirelessCommType = 0; - sLinkErrorBuffer.unk_06 = 0; + sLinkErrorBuffer.disconnected = FALSE; sub_81700F8(); } } @@ -1772,10 +1722,9 @@ static void CB2_PrintErrorMessage(void) } } } + if (gMain.state != 160) - { gMain.state++; - } } // TODO: there might be a file boundary here, let's name it @@ -1805,7 +1754,7 @@ bool8 HasLinkErrorOccurred(void) return gLinkErrorOccurred; } -void sub_800B348(void) +void LocalLinkPlayerToBlock(void) { struct LinkPlayerBlock *block; @@ -1826,11 +1775,11 @@ void LinkPlayerFromBlock(u32 who) block = (struct LinkPlayerBlock *)gBlockRecvBuffer[who_]; player = &gLinkPlayers[who_]; *player = block->linkPlayer; - sub_800B524(player); - if (strcmp(block->magic1, sASCIIGameFreakInc) != 0 || strcmp(block->magic2, sASCIIGameFreakInc) != 0) - { + ConvertLinkPlayerName(player); + + if (strcmp(block->magic1, sASCIIGameFreakInc) != 0 + || strcmp(block->magic2, sASCIIGameFreakInc) != 0) SetMainCallback2(CB2_LinkError); - } } bool8 HandleLinkConnection(void) @@ -1842,10 +1791,9 @@ bool8 HandleLinkConnection(void) { gLinkStatus = LinkMain1(&gShouldAdvanceLinkState, gSendCmd, gRecvCmds); LinkMain2(&gMain.heldKeys); + if ((gLinkStatus & LINK_STAT_RECEIVED_NOTHING) && sub_808766C() == TRUE) - { return TRUE; - } } else { @@ -1854,9 +1802,7 @@ bool8 HandleLinkConnection(void) if (sub_808766C() == TRUE) { if (r4 == TRUE || IsRfuRecvQueueEmpty() || r5) - { return TRUE; - } } } return FALSE; @@ -1865,42 +1811,34 @@ bool8 HandleLinkConnection(void) void SetWirelessCommType1(void) { if (gReceivedRemoteLinkPlayers == 0) - { gWirelessCommType = 1; - } } static void SetWirelessCommType0_Internal(void) { if (gReceivedRemoteLinkPlayers == 0) - { gWirelessCommType = 0; - } } void SetWirelessCommType0(void) { if (gReceivedRemoteLinkPlayers == 0) - { gWirelessCommType = 0; - } } u32 GetLinkRecvQueueLength(void) { if (gWirelessCommType != 0) - { return GetRfuRecvQueueLength(); - } + return gLink.recvQueue.count; } -bool32 sub_800B504(void) +bool32 IsLinkRecvQueueLengthAtLeast3(void) { if (GetLinkRecvQueueLength() > 2) - { return TRUE; - } + return FALSE; } @@ -1910,9 +1848,9 @@ u8 GetWirelessCommType(void) return gWirelessCommType; } -void sub_800B524(struct LinkPlayer *player) +void ConvertLinkPlayerName(struct LinkPlayer *player) { - player->progressFlagsCopy = player->progressFlags; + player->progressFlagsCopy = player->progressFlags; // ? Perhaps relocating for a longer name field ConvertInternationalString(player->name, player->language); } @@ -2420,9 +2358,7 @@ void ResetSendBuffer(void) for (i = 0; i < CMD_LENGTH; i++) { for (j = 0; j < QUEUE_CAPACITY; j++) - { - gLink.sendQueue.data[i][j] = 0xEFFF; - } + gLink.sendQueue.data[i][j] = LINKCMD_NONE; } } @@ -2439,9 +2375,7 @@ void ResetRecvBuffer(void) for (j = 0; j < CMD_LENGTH; j++) { for (k = 0; k < QUEUE_CAPACITY; k++) - { - gLink.recvQueue.data[i][j][k] = 0xEFFF; - } + gLink.recvQueue.data[i][j][k] = LINKCMD_NONE; } } } diff --git a/src/link_rfu_2.c b/src/link_rfu_2.c index b7713fa3f..6366b9704 100644 --- a/src/link_rfu_2.c +++ b/src/link_rfu_2.c @@ -1697,7 +1697,7 @@ static void sub_801084C(u8 taskId) if (AreNoPlayersReceiving()) { ResetBlockReceivedFlags(); - sub_800B348(); + LocalLinkPlayerToBlock(); gTasks[taskId].data[0]++; } break; @@ -1786,7 +1786,7 @@ static void ReceiveRfuLinkPlayers(const struct SioInfo *sioInfo) for (i = 0; i < MAX_RFU_PLAYERS; i++) { gLinkPlayers[i] = sioInfo->linkPlayers[i]; - sub_800B524(gLinkPlayers + i); + ConvertLinkPlayerName(gLinkPlayers + i); } } @@ -1831,7 +1831,7 @@ static void Task_ExchangeLinkPlayers(u8 taskId) ResetBlockReceivedFlag(r4); r2 = (struct LinkPlayerBlock *)gBlockRecvBuffer[r4]; gLinkPlayers[r4] = r2->linkPlayer; - sub_800B524(gLinkPlayers + r4); + ConvertLinkPlayerName(gLinkPlayers + r4); gTasks[taskId].data[0]++; } break; @@ -1887,7 +1887,7 @@ static void sub_8010D0C(u8 taskId) case 0: if (Rfu.playerCount) { - sub_800B348(); + LocalLinkPlayerToBlock(); SendBlock(0, gBlockSendBuffer, sizeof(struct LinkPlayerBlock)); gTasks[taskId].data[0]++; } @@ -2472,7 +2472,7 @@ void RfuVSync(void) rfu_LMAN_syncVBlank(); } -void sub_8011AC8(void) +void ClearRecvCommands(void) { CpuFill32(0, gRecvCmds, sizeof(gRecvCmds)); } @@ -2643,7 +2643,7 @@ static void sub_8011E2C(u8 taskId) static void sub_8011E94(u32 a0, u32 a1) { u8 taskId = FindTaskIdByFunc(sub_8011E2C); - if (taskId == 0xFF) + if (taskId == TASK_NONE) { taskId = CreateTask(sub_8011E2C, 5); gTasks[taskId].data[0] = a0; @@ -2792,12 +2792,12 @@ void sub_8012188(const u8 *name, struct GFtgtGname *structPtr, u8 activity) taskId2 = FindTaskIdByFunc(Task_LinkRfu_UnionRoomListen); if (activity == (ACTIVITY_CHAT | IN_UNION_ROOM)) { - if (taskId2 != 0xFF) + if (taskId2 != TASK_NONE) gTasks[taskId2].data[7] = 1; } else { - if (taskId2 != 0xFF) + if (taskId2 != TASK_NONE) gTasks[taskId2].data[7] = 0; } } diff --git a/src/link_rfu_3.c b/src/link_rfu_3.c index c6344f503..f47167873 100644 --- a/src/link_rfu_3.c +++ b/src/link_rfu_3.c @@ -792,7 +792,7 @@ void LoadWirelessStatusIndicatorSpriteGfx(void) LoadCompressedSpriteSheet(&sWirelessStatusIndicatorSpriteSheet); } LoadSpritePalette(&sWirelessStatusIndicatorSpritePalette); - gWirelessStatusIndicatorSpriteId = 0xFF; + gWirelessStatusIndicatorSpriteId = SPRITE_NONE; } static u8 GetParentSignalStrength(void) @@ -822,7 +822,7 @@ static void SetWirelessStatusIndicatorAnim(struct Sprite *sprite, s32 animNum) void UpdateWirelessStatusIndicatorSprite(void) { - if (gWirelessStatusIndicatorSpriteId != 0xFF && gSprites[gWirelessStatusIndicatorSpriteId].sValidator == STATUS_INDICATOR_ACTIVE) + if (gWirelessStatusIndicatorSpriteId != SPRITE_NONE && gSprites[gWirelessStatusIndicatorSpriteId].sValidator == STATUS_INDICATOR_ACTIVE) { struct Sprite *sprite = &gSprites[gWirelessStatusIndicatorSpriteId]; u8 signalStrength = RFU_LINK_ICON_LEVEL4_MAX; diff --git a/src/list_menu.c b/src/list_menu.c index 3e5642e4c..79ea1fde0 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -467,8 +467,6 @@ s32 ListMenu_ProcessInput(u8 listTaskId) } } -#define TASK_NONE 0xFF - void DestroyListMenuTask(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow) { struct ListMenu *list = (void*) gTasks[listTaskId].data; diff --git a/src/m4a.c b/src/m4a.c index e079ba4f6..7d7193334 100644 --- a/src/m4a.c +++ b/src/m4a.c @@ -1616,6 +1616,9 @@ void ply_xcmd_0C(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *tra void ply_xcmd_0D(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *track) { u32 unk; +#ifdef UBFIX + unk = 0; +#endif READ_XCMD_BYTE(unk, 0) // UB: uninitialized variable READ_XCMD_BYTE(unk, 1) @@ -1657,18 +1660,12 @@ start_song: mplayInfo = &gPokemonCryMusicPlayers[i]; mplayInfo->ident++; -#define CRY ((s32)&gPokemonCrySongs + i * sizeof(struct PokemonCrySong)) -#define CRY_OFS(field) offsetof(struct PokemonCrySong, field) + gPokemonCrySongs[i] = gPokemonCrySong; - memcpy((void *)CRY, &gPokemonCrySong, sizeof(struct PokemonCrySong)); - - *(u32 *)(CRY + CRY_OFS(tone)) = (u32)tone; - *(u32 *)(CRY + CRY_OFS(part)) = CRY + CRY_OFS(part0); - *(u32 *)(CRY + CRY_OFS(part) + 4) = CRY + CRY_OFS(part1); - *(u32 *)(CRY + CRY_OFS(gotoTarget)) = CRY + CRY_OFS(cont); - -#undef CRY_OFS -#undef CRY + gPokemonCrySongs[i].tone = tone; + gPokemonCrySongs[i].part[0] = &gPokemonCrySongs[i].part0; + gPokemonCrySongs[i].part[1] = &gPokemonCrySongs[i].part1; + gPokemonCrySongs[i].gotoTarget = (u32)&gPokemonCrySongs[i].cont; mplayInfo->ident = ID_NUMBER; diff --git a/src/mail.c b/src/mail.c index 71e98b42a..db8451395 100644 --- a/src/mail.c +++ b/src/mail.c @@ -18,62 +18,31 @@ #include "pokemon_icon.h" #include "malloc.h" #include "easy_chat.h" +#include "graphics.h" #include "constants/rgb.h" -extern const u16 gMailPalette_Orange[]; -extern const u16 gMailPalette_Harbor[]; -extern const u16 gMailPalette_Glitter[]; -extern const u16 gMailPalette_Mech[]; -extern const u16 gMailPalette_Wood[]; -extern const u16 gMailPalette_Wave[]; -extern const u16 gMailPalette_Bead[]; -extern const u16 gMailPalette_Shadow[]; -extern const u16 gMailPalette_Tropic[]; -extern const u16 gMailPalette_Dream[]; -extern const u16 gMailPalette_Fab[]; -extern const u16 gMailPalette_Retro[]; -extern const u8 gMailTiles_Orange[]; -extern const u8 gMailTilemap_Orange[]; -extern const u8 gMailTiles_Harbor[]; -extern const u8 gMailTilemap_Harbor[]; -extern const u8 gMailTiles_Glitter[]; -extern const u8 gMailTilemap_Glitter[]; -extern const u8 gMailTiles_Mech[]; -extern const u8 gMailTilemap_Mech[]; -extern const u8 gMailTiles_Wood[]; -extern const u8 gMailTilemap_Wood[]; -extern const u8 gMailTiles_Wave[]; -extern const u8 gMailTilemap_Wave[]; -extern const u8 gMailTiles_Bead[]; -extern const u8 gMailTilemap_Bead[]; -extern const u8 gMailTiles_Shadow[]; -extern const u8 gMailTilemap_Shadow[]; -extern const u8 gMailTiles_Tropic[]; -extern const u8 gMailTilemap_Tropic[]; -extern const u8 gMailTiles_Dream[]; -extern const u8 gMailTilemap_Dream[]; -extern const u8 gMailTiles_Fab[]; -extern const u8 gMailTilemap_Fab[]; -extern const u8 gMailTiles_Retro[]; -extern const u8 gMailTilemap_Retro[]; +// Bead and Dream mail feature an icon of the Pokémon holding it. +enum { + ICON_TYPE_NONE, + ICON_TYPE_BEAD, + ICON_TYPE_DREAM, +}; -// Static type declarations - -struct UnkMailStruct +struct MailLineLayout { - u32 numEasyChatWords:2; - u32 xOffset:6; - u32 lineHeight:8; + u8 numEasyChatWords:2; + u8 xOffset:6; + u8 height; }; struct MailLayout { - u8 numSubStructs; + u8 numLines; u8 signatureYPos; u8 signatureWidth; - u8 wordsXPos; u8 wordsYPos; - const struct UnkMailStruct *var8; + u8 wordsXPos; + const struct MailLineLayout *lines; }; struct MailGraphics @@ -81,26 +50,25 @@ struct MailGraphics const u16 *palette; const u8 *tiles; const u8 *tileMap; - u16 var0C; - u16 var0E; - u16 color10; - u16 color12; + u32 unused; + u16 textColor; + u16 textShadow; }; struct MailRead { - /*0x0000*/ u8 strbuf[8][64]; + /*0x0000*/ u8 message[8][64]; /*0x0200*/ u8 playerName[12]; - /*0x020C*/ MainCallback callback; - /*0x0210*/ MainCallback callback2; + /*0x020C*/ MainCallback exitCallback; + /*0x0210*/ MainCallback callback; /*0x0214*/ struct MailStruct *mail; - /*0x0218*/ bool8 flag; + /*0x0218*/ bool8 hasText; /*0x0219*/ u8 signatureWidth; /*0x021a*/ u8 mailType; - /*0x021b*/ u8 animsActive; - /*0x021c*/ u8 monIconSprite; + /*0x021b*/ u8 iconType; + /*0x021c*/ u8 monIconSpriteId; /*0x021d*/ u8 language; - /*0x021e*/ bool8 playerIsSender; + /*0x021e*/ bool8 international; /*0x0220*/ u8 * (*parserSingle)(u8 *dest, u16 word); /*0x0224*/ u8 * (*parserMultiple)(u8 *dest, const u16 *src, u16 length1, u16 length2); /*0x0228*/ const struct MailLayout *layout; @@ -108,23 +76,17 @@ struct MailRead /*0x122c*/ u8 bg2TilemapBuffer[0x1000]; }; -// Static RAM declarations - static EWRAM_DATA struct MailRead *sMailRead = NULL; -// Static ROM declarations - static void CB2_InitMailRead(void); -static void sub_8121A1C(void); -static void sub_8121B1C(void); +static void BufferMailText(void); +static void PrintMailText(void); static void VBlankCB_MailRead(void); static void CB2_MailRead(void); static void CB2_WaitForPaletteExitOnKeyPress(void); static void CB2_ExitOnKeyPress(void); static void CB2_ExitMailReadFreeVars(void); -// .rodata - static const struct BgTemplate sBgTemplates[] = { { .bg = 0, @@ -144,7 +106,7 @@ static const struct BgTemplate sBgTemplates[] = { } }; -static const struct WindowTemplate sUnknown_0859F29C[] = { +static const struct WindowTemplate sWindowTemplates[] = { { .bg = 0, .tilemapLeft = 2, @@ -163,137 +125,377 @@ static const u8 sTextColors[] = { TEXT_DYNAMIC_COLOR_2 }; -static const u16 sUnknown_0859F2B0[][2] = { - { 0x6ACD, 0x51A5 }, - { 0x45FC, 0x38D4 } +// Background is alternating bars of a dark/light color. +// Either blue or red depending on player's gender +static const u16 sBgColors[GENDER_COUNT][2] = { + [MALE] = { RGB(13, 22, 26), RGB(5, 13, 20) }, + [FEMALE] = { RGB(28, 15, 17), RGB(20, 6, 14) } }; -static const struct MailGraphics sUnknown_0859F2B8[] = { - { - gMailPalette_Orange, gMailTiles_Orange, gMailTilemap_Orange, 0x02c0, 0, 0x294a, 0x6739 - }, { - gMailPalette_Harbor, gMailTiles_Harbor, gMailTilemap_Harbor, 0x02e0, 0, 0x7fff, 0x4631 - }, { - gMailPalette_Glitter, gMailTiles_Glitter, gMailTilemap_Glitter, 0x0400, 0, 0x294a, 0x6739 - }, { - gMailPalette_Mech, gMailTiles_Mech, gMailTilemap_Mech, 0x01e0, 0, 0x7fff, 0x4631 - }, { - gMailPalette_Wood, gMailTiles_Wood, gMailTilemap_Wood, 0x02e0, 0, 0x7fff, 0x4631 - }, { - gMailPalette_Wave, gMailTiles_Wave, gMailTilemap_Wave, 0x0300, 0, 0x294a, 0x6739 - }, { - gMailPalette_Bead, gMailTiles_Bead, gMailTilemap_Bead, 0x0140, 0, 0x7fff, 0x4631 - }, { - gMailPalette_Shadow, gMailTiles_Shadow, gMailTilemap_Shadow, 0x0300, 0, 0x7fff, 0x4631 - }, { - gMailPalette_Tropic, gMailTiles_Tropic, gMailTilemap_Tropic, 0x0220, 0, 0x294a, 0x6739 - }, { - gMailPalette_Dream, gMailTiles_Dream, gMailTilemap_Dream, 0x0340, 0, 0x294a, 0x6739 - }, { - gMailPalette_Fab, gMailTiles_Fab, gMailTilemap_Fab, 0x02a0, 0, 0x294a, 0x6739 - }, { - gMailPalette_Retro, gMailTiles_Retro, gMailTilemap_Retro, 0x0520, 0, 0x294a, 0x6739 +static const struct MailGraphics sMailGraphics[] = { + [ITEM_TO_MAIL(ITEM_ORANGE_MAIL)] = { + .palette = gMailPalette_Orange, + .tiles = gMailTiles_Orange, + .tileMap = gMailTilemap_Orange, + .unused = 0x2C0, + .textColor = RGB(10, 10, 10), + .textShadow = RGB(25, 25, 25), + }, + [ITEM_TO_MAIL(ITEM_HARBOR_MAIL)] = { + .palette = gMailPalette_Harbor, + .tiles = gMailTiles_Harbor, + .tileMap = gMailTilemap_Harbor, + .unused = 0x2E0, + .textColor = RGB_WHITE, + .textShadow = RGB(17, 17, 17), + }, + [ITEM_TO_MAIL(ITEM_GLITTER_MAIL)] = { + .palette = gMailPalette_Glitter, + .tiles = gMailTiles_Glitter, + .tileMap = gMailTilemap_Glitter, + .unused = 0x400, + .textColor = RGB(10, 10, 10), + .textShadow = RGB(25, 25, 25), + }, + [ITEM_TO_MAIL(ITEM_MECH_MAIL)] = { + .palette = gMailPalette_Mech, + .tiles = gMailTiles_Mech, + .tileMap = gMailTilemap_Mech, + .unused = 0x1E0, + .textColor = RGB_WHITE, + .textShadow = RGB(17, 17, 17), + }, + [ITEM_TO_MAIL(ITEM_WOOD_MAIL)] = { + .palette = gMailPalette_Wood, + .tiles = gMailTiles_Wood, + .tileMap = gMailTilemap_Wood, + .unused = 0x2E0, + .textColor = RGB_WHITE, + .textShadow = RGB(17, 17, 17), + }, + [ITEM_TO_MAIL(ITEM_WAVE_MAIL)] = { + .palette = gMailPalette_Wave, + .tiles = gMailTiles_Wave, + .tileMap = gMailTilemap_Wave, + .unused = 0x300, + .textColor = RGB(10, 10, 10), + .textShadow = RGB(25, 25, 25), + }, + [ITEM_TO_MAIL(ITEM_BEAD_MAIL)] = { + .palette = gMailPalette_Bead, + .tiles = gMailTiles_Bead, + .tileMap = gMailTilemap_Bead, + .unused = 0x140, + .textColor = RGB_WHITE, + .textShadow = RGB(17, 17, 17), + }, + [ITEM_TO_MAIL(ITEM_SHADOW_MAIL)] = { + .palette = gMailPalette_Shadow, + .tiles = gMailTiles_Shadow, + .tileMap = gMailTilemap_Shadow, + .unused = 0x300, + .textColor = RGB_WHITE, + .textShadow = RGB(17, 17, 17), + }, + [ITEM_TO_MAIL(ITEM_TROPIC_MAIL)] = { + .palette = gMailPalette_Tropic, + .tiles = gMailTiles_Tropic, + .tileMap = gMailTilemap_Tropic, + .unused = 0x220, + .textColor = RGB(10, 10, 10), + .textShadow = RGB(25, 25, 25), + }, + [ITEM_TO_MAIL(ITEM_DREAM_MAIL)] = { + .palette = gMailPalette_Dream, + .tiles = gMailTiles_Dream, + .tileMap = gMailTilemap_Dream, + .unused = 0x340, + .textColor = RGB(10, 10, 10), + .textShadow = RGB(25, 25, 25), + }, + [ITEM_TO_MAIL(ITEM_FAB_MAIL)] = { + .palette = gMailPalette_Fab, + .tiles = gMailTiles_Fab, + .tileMap = gMailTilemap_Fab, + .unused = 0x2a0, + .textColor = RGB(10, 10, 10), + .textShadow = RGB(25, 25, 25), + }, + [ITEM_TO_MAIL(ITEM_RETRO_MAIL)] = { + .palette = gMailPalette_Retro, + .tiles = gMailTiles_Retro, + .tileMap = gMailTilemap_Retro, + .unused = 0x520, + .textColor = RGB(10, 10, 10), + .textShadow = RGB(25, 25, 25), } }; -static const struct UnkMailStruct Unknown_0859F3A8[] = { - { .numEasyChatWords = 3, .lineHeight = 16 }, - { .numEasyChatWords = 3, .lineHeight = 16 }, - { .numEasyChatWords = 3, .lineHeight = 16 } +static const struct MailLineLayout sLineLayouts_Wide[] = { + { .numEasyChatWords = 3, .xOffset = 0, .height = 16 }, + { .numEasyChatWords = 3, .xOffset = 0, .height = 16 }, + { .numEasyChatWords = 3, .xOffset = 0, .height = 16 } }; -static const struct MailLayout sUnknown_0859F3B4[] = { - { 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 }, - { 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 }, - { 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 }, - { 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 }, - { 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 }, - { 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 }, - { 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 }, - { 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 }, - { 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 }, - { 0x03, 0x00, 0x00, 0x02, 0x04, Unknown_0859F3A8 }, - { 0x03, 0x08, 0x00, 0x02, 0x04, Unknown_0859F3A8 }, - { 0x03, 0x00, 0x00, 0x02, 0x00, Unknown_0859F3A8 } +static const struct MailLayout sMailLayouts_Wide[] = { + [ITEM_TO_MAIL(ITEM_ORANGE_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Wide), + .signatureYPos = 0, + .signatureWidth = 0, + .wordsYPos = 2, + .wordsXPos = 4, + .lines = sLineLayouts_Wide, + }, + [ITEM_TO_MAIL(ITEM_HARBOR_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Wide), + .signatureYPos = 0, + .signatureWidth = 0, + .wordsYPos = 2, + .wordsXPos = 4, + .lines = sLineLayouts_Wide, + }, + [ITEM_TO_MAIL(ITEM_GLITTER_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Wide), + .signatureYPos = 0, + .signatureWidth = 0, + .wordsYPos = 2, + .wordsXPos = 4, + .lines = sLineLayouts_Wide, + }, + [ITEM_TO_MAIL(ITEM_MECH_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Wide), + .signatureYPos = 0, + .signatureWidth = 0, + .wordsYPos = 2, + .wordsXPos = 4, + .lines = sLineLayouts_Wide, + }, + [ITEM_TO_MAIL(ITEM_WOOD_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Wide), + .signatureYPos = 0, + .signatureWidth = 0, + .wordsYPos = 2, + .wordsXPos = 4, + .lines = sLineLayouts_Wide, + }, + [ITEM_TO_MAIL(ITEM_WAVE_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Wide), + .signatureYPos = 0, + .signatureWidth = 0, + .wordsYPos = 2, + .wordsXPos = 4, + .lines = sLineLayouts_Wide, + }, + [ITEM_TO_MAIL(ITEM_BEAD_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Wide), + .signatureYPos = 0, + .signatureWidth = 0, + .wordsYPos = 2, + .wordsXPos = 4, + .lines = sLineLayouts_Wide, + }, + [ITEM_TO_MAIL(ITEM_SHADOW_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Wide), + .signatureYPos = 0, + .signatureWidth = 0, + .wordsYPos = 2, + .wordsXPos = 4, + .lines = sLineLayouts_Wide, + }, + [ITEM_TO_MAIL(ITEM_TROPIC_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Wide), + .signatureYPos = 0, + .signatureWidth = 0, + .wordsYPos = 2, + .wordsXPos = 4, + .lines = sLineLayouts_Wide, + }, + [ITEM_TO_MAIL(ITEM_DREAM_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Wide), + .signatureYPos = 0, + .signatureWidth = 0, + .wordsYPos = 2, + .wordsXPos = 4, + .lines = sLineLayouts_Wide, + }, + [ITEM_TO_MAIL(ITEM_FAB_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Wide), + .signatureYPos = 8, + .signatureWidth = 0, + .wordsYPos = 2, + .wordsXPos = 4, + .lines = sLineLayouts_Wide, + }, + [ITEM_TO_MAIL(ITEM_RETRO_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Wide), + .signatureYPos = 0, + .signatureWidth = 0, + .wordsYPos = 2, + .wordsXPos = 0, + .lines = sLineLayouts_Wide, + }, }; -static const struct UnkMailStruct Unknown_0859F444[] = { - { .numEasyChatWords = 2, .lineHeight = 16 }, - { .numEasyChatWords = 2, .lineHeight = 16 }, - { .numEasyChatWords = 2, .lineHeight = 16 }, - { .numEasyChatWords = 2, .lineHeight = 16 }, - { .numEasyChatWords = 1, .lineHeight = 16 } +static const struct MailLineLayout sLineLayouts_Tall[] = { + { .numEasyChatWords = 2, .xOffset = 0, .height = 16 }, + { .numEasyChatWords = 2, .xOffset = 0, .height = 16 }, + { .numEasyChatWords = 2, .xOffset = 0, .height = 16 }, + { .numEasyChatWords = 2, .xOffset = 0, .height = 16 }, + { .numEasyChatWords = 1, .xOffset = 0, .height = 16 } }; -static const struct MailLayout sUnknown_0859F458[] = { - { 0x05, 0x07, 0x58, 0x0b, 0x1e, Unknown_0859F444 }, - { 0x05, 0x0a, 0x60, 0x09, 0x1e, Unknown_0859F444 }, - { 0x05, 0x0c, 0x68, 0x05, 0x1e, Unknown_0859F444 }, - { 0x05, 0x05, 0x60, 0x08, 0x1e, Unknown_0859F444 }, - { 0x05, 0x0a, 0x60, 0x09, 0x1e, Unknown_0859F444 }, - { 0x05, 0x09, 0x70, 0x05, 0x1e, Unknown_0859F444 }, - { 0x05, 0x0c, 0x68, 0x09, 0x1e, Unknown_0859F444 }, - { 0x05, 0x0d, 0x68, 0x0d, 0x1e, Unknown_0859F444 }, - { 0x05, 0x09, 0x60, 0x09, 0x1e, Unknown_0859F444 }, - { 0x05, 0x09, 0x60, 0x09, 0x1e, Unknown_0859F444 }, - { 0x05, 0x11, 0x68, 0x0f, 0x1e, Unknown_0859F444 }, - { 0x05, 0x09, 0x60, 0x05, 0x1e, Unknown_0859F444 } +static const struct MailLayout sMailLayouts_Tall[] = { + [ITEM_TO_MAIL(ITEM_ORANGE_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Tall), + .signatureYPos = 7, + .signatureWidth = 88, + .wordsYPos = 11, + .wordsXPos = 30, + .lines = sLineLayouts_Tall, + }, + [ITEM_TO_MAIL(ITEM_HARBOR_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Tall), + .signatureYPos = 10, + .signatureWidth = 96, + .wordsYPos = 9, + .wordsXPos = 30, + .lines = sLineLayouts_Tall, + }, + [ITEM_TO_MAIL(ITEM_GLITTER_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Tall), + .signatureYPos = 12, + .signatureWidth = 104, + .wordsYPos = 5, + .wordsXPos = 30, + .lines = sLineLayouts_Tall, + }, + [ITEM_TO_MAIL(ITEM_MECH_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Tall), + .signatureYPos = 5, + .signatureWidth = 96, + .wordsYPos = 8, + .wordsXPos = 30, + .lines = sLineLayouts_Tall, + }, + [ITEM_TO_MAIL(ITEM_WOOD_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Tall), + .signatureYPos = 10, + .signatureWidth = 96, + .wordsYPos = 9, + .wordsXPos = 30, + .lines = sLineLayouts_Tall, + }, + [ITEM_TO_MAIL(ITEM_WAVE_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Tall), + .signatureYPos = 9, + .signatureWidth = 112, + .wordsYPos = 5, + .wordsXPos = 30, + .lines = sLineLayouts_Tall, + }, + [ITEM_TO_MAIL(ITEM_BEAD_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Tall), + .signatureYPos = 12, + .signatureWidth = 104, + .wordsYPos = 9, + .wordsXPos = 30, + .lines = sLineLayouts_Tall, + }, + [ITEM_TO_MAIL(ITEM_SHADOW_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Tall), + .signatureYPos = 13, + .signatureWidth = 104, + .wordsYPos = 13, + .wordsXPos = 30, + .lines = sLineLayouts_Tall, + }, + [ITEM_TO_MAIL(ITEM_TROPIC_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Tall), + .signatureYPos = 9, + .signatureWidth = 96, + .wordsYPos = 9, + .wordsXPos = 30, + .lines = sLineLayouts_Tall, + }, + [ITEM_TO_MAIL(ITEM_DREAM_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Tall), + .signatureYPos = 9, + .signatureWidth = 96, + .wordsYPos = 9, + .wordsXPos = 30, + .lines = sLineLayouts_Tall, + }, + [ITEM_TO_MAIL(ITEM_FAB_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Tall), + .signatureYPos = 17, + .signatureWidth = 104, + .wordsYPos = 15, + .wordsXPos = 30, + .lines = sLineLayouts_Tall, + }, + [ITEM_TO_MAIL(ITEM_RETRO_MAIL)] = { + .numLines = ARRAY_COUNT(sLineLayouts_Tall), + .signatureYPos = 9, + .signatureWidth = 96, + .wordsYPos = 5, + .wordsXPos = 30, + .lines = sLineLayouts_Tall, + }, }; -// .text - -void ReadMail(struct MailStruct *mail, void (*callback)(void), bool8 flag) +void ReadMail(struct MailStruct *mail, void (*exitCallback)(void), bool8 hasText) { u16 buffer[2]; u16 species; sMailRead = calloc(1, sizeof(*sMailRead)); - sMailRead->language = LANGUAGE_ENGLISH; - sMailRead->playerIsSender = TRUE; + sMailRead->language = GAME_LANGUAGE; + sMailRead->international = TRUE; sMailRead->parserSingle = CopyEasyChatWord; sMailRead->parserMultiple = ConvertEasyChatWordsToString; if (IS_ITEM_MAIL(mail->itemId)) { - sMailRead->mailType = mail->itemId - FIRST_MAIL_INDEX; + sMailRead->mailType = ITEM_TO_MAIL(mail->itemId); } else { - sMailRead->mailType = 0; - flag = FALSE; + sMailRead->mailType = ITEM_TO_MAIL(FIRST_MAIL_INDEX); + hasText = FALSE; } - switch (sMailRead->playerIsSender) + switch (sMailRead->international) { - case FALSE: - default: - sMailRead->layout = &sUnknown_0859F3B4[sMailRead->mailType]; - break; - case TRUE: - sMailRead->layout = &sUnknown_0859F458[sMailRead->mailType]; - break; + case FALSE: + default: + // Never reached. JP only? + sMailRead->layout = &sMailLayouts_Wide[sMailRead->mailType]; + break; + case TRUE: + sMailRead->layout = &sMailLayouts_Tall[sMailRead->mailType]; + break; } species = MailSpeciesToSpecies(mail->species, buffer); - if (species >= SPECIES_BULBASAUR && species < NUM_SPECIES) + if (species > SPECIES_NONE && species < NUM_SPECIES) { switch (sMailRead->mailType) { - default: - sMailRead->animsActive = 0; - break; - case ITEM_BEAD_MAIL - FIRST_MAIL_INDEX: - sMailRead->animsActive = 1; - break; - case ITEM_DREAM_MAIL - FIRST_MAIL_INDEX: - sMailRead->animsActive = 2; - break; + default: + sMailRead->iconType = ICON_TYPE_NONE; + break; + case ITEM_TO_MAIL(ITEM_BEAD_MAIL): + sMailRead->iconType = ICON_TYPE_BEAD; + break; + case ITEM_TO_MAIL(ITEM_DREAM_MAIL): + sMailRead->iconType = ICON_TYPE_DREAM; + break; } } else { - sMailRead->animsActive = 0; + sMailRead->iconType = ICON_TYPE_NONE; } sMailRead->mail = mail; - sMailRead->callback = callback; - sMailRead->flag = flag; + sMailRead->exitCallback = exitCallback; + sMailRead->hasText = hasText; SetMainCallback2(CB2_InitMailRead); } @@ -341,11 +543,11 @@ static bool8 MailReadBuildGraphics(void) SetBgTilemapBuffer(2, sMailRead->bg2TilemapBuffer); break; case 7: - InitWindows(sUnknown_0859F29C); + InitWindows(sWindowTemplates); DeactivateAllTextPrinters(); break; case 8: - DecompressAndCopyTileDataToVram(1, sUnknown_0859F2B8[sMailRead->mailType].tiles, 0, 0, 0); + DecompressAndCopyTileDataToVram(1, sMailGraphics[sMailRead->mailType].tiles, 0, 0, 0); break; case 9: if (FreeTempTileDataBuffersIfPossible()) @@ -356,7 +558,7 @@ static bool8 MailReadBuildGraphics(void) case 10: FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); FillBgTilemapBufferRect_Palette0(2, 1, 0, 0, 30, 20); - CopyToBgTilemapBuffer(1, sUnknown_0859F2B8[sMailRead->mailType].tileMap, 0, 0); + CopyToBgTilemapBuffer(1, sMailGraphics[sMailRead->mailType].tileMap, 0, 0); break; case 11: CopyBgTilemapBufferToVram(0); @@ -365,26 +567,28 @@ static bool8 MailReadBuildGraphics(void) break; case 12: LoadPalette(GetOverworldTextboxPalettePtr(), 240, 32); - gPlttBufferUnfaded[250] = sUnknown_0859F2B8[sMailRead->mailType].color10; - gPlttBufferFaded[250] = sUnknown_0859F2B8[sMailRead->mailType].color10; - gPlttBufferUnfaded[251] = sUnknown_0859F2B8[sMailRead->mailType].color12; - gPlttBufferFaded[251] = sUnknown_0859F2B8[sMailRead->mailType].color12; - LoadPalette(sUnknown_0859F2B8[sMailRead->mailType].palette, 0, 32); - gPlttBufferUnfaded[10] = sUnknown_0859F2B0[gSaveBlock2Ptr->playerGender][0]; - gPlttBufferFaded[10] = sUnknown_0859F2B0[gSaveBlock2Ptr->playerGender][0]; - gPlttBufferUnfaded[11] = sUnknown_0859F2B0[gSaveBlock2Ptr->playerGender][1]; - gPlttBufferFaded[11] = sUnknown_0859F2B0[gSaveBlock2Ptr->playerGender][1]; + + gPlttBufferUnfaded[250] = sMailGraphics[sMailRead->mailType].textColor; + gPlttBufferFaded[250] = sMailGraphics[sMailRead->mailType].textColor; + gPlttBufferUnfaded[251] = sMailGraphics[sMailRead->mailType].textShadow; + gPlttBufferFaded[251] = sMailGraphics[sMailRead->mailType].textShadow; + LoadPalette(sMailGraphics[sMailRead->mailType].palette, 0, 32); + + gPlttBufferUnfaded[10] = sBgColors[gSaveBlock2Ptr->playerGender][0]; + gPlttBufferFaded[10] = sBgColors[gSaveBlock2Ptr->playerGender][0]; + gPlttBufferUnfaded[11] = sBgColors[gSaveBlock2Ptr->playerGender][1]; + gPlttBufferFaded[11] = sBgColors[gSaveBlock2Ptr->playerGender][1]; break; case 13: - if (sMailRead->flag) + if (sMailRead->hasText) { - sub_8121A1C(); + BufferMailText(); } break; case 14: - if (sMailRead->flag) + if (sMailRead->hasText) { - sub_8121B1C(); + PrintMailText(); RunTextPrinters(); } break; @@ -399,17 +603,17 @@ static bool8 MailReadBuildGraphics(void) gPaletteFade.bufferTransferDisabled = TRUE; break; case 17: - icon = sub_80D2E84(sMailRead->mail->species); - switch (sMailRead->animsActive) + icon = GetIconSpeciesNoPersonality(sMailRead->mail->species); + switch (sMailRead->iconType) { - case 1: - LoadMonIconPalette(icon); - sMailRead->monIconSprite = sub_80D2D78(icon, SpriteCallbackDummy, 0x60, 0x80, 0, 0); - break; - case 2: - LoadMonIconPalette(icon); - sMailRead->monIconSprite = sub_80D2D78(icon, SpriteCallbackDummy, 0x28, 0x80, 0, 0); - break; + case ICON_TYPE_BEAD: + LoadMonIconPalette(icon); + sMailRead->monIconSpriteId = CreateMonIconNoPersonality(icon, SpriteCallbackDummy, 96, 128, 0, FALSE); + break; + case ICON_TYPE_DREAM: + LoadMonIconPalette(icon); + sMailRead->monIconSpriteId = CreateMonIconNoPersonality(icon, SpriteCallbackDummy, 40, 128, 0, FALSE); + break; } break; case 18: @@ -417,9 +621,9 @@ static bool8 MailReadBuildGraphics(void) ShowBg(0); ShowBg(1); ShowBg(2); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); gPaletteFade.bufferTransferDisabled = FALSE; - sMailRead->callback2 = CB2_WaitForPaletteExitOnKeyPress; + sMailRead->callback = CB2_WaitForPaletteExitOnKeyPress; return TRUE; default: return FALSE; @@ -440,35 +644,39 @@ static void CB2_InitMailRead(void) } while (MenuHelpers_LinkSomething() != TRUE); } -static void sub_8121A1C(void) +static void BufferMailText(void) { u16 i; - u8 total; + u8 numWords; u8 *ptr; - total = 0; - for (i = 0; i < sMailRead->layout->numSubStructs; i ++) + // Convert the easy chat words to strings line by line and buffer them to message + numWords = 0; + for (i = 0; i < sMailRead->layout->numLines; i ++) { - ConvertEasyChatWordsToString(sMailRead->strbuf[i], &sMailRead->mail->words[total], sMailRead->layout->var8[i].numEasyChatWords, 1); - total += sMailRead->layout->var8[i].numEasyChatWords; + ConvertEasyChatWordsToString(sMailRead->message[i], &sMailRead->mail->words[numWords], sMailRead->layout->lines[i].numEasyChatWords, 1); + numWords += sMailRead->layout->lines[i].numEasyChatWords; } + + // Buffer the signature ptr = StringCopy(sMailRead->playerName, sMailRead->mail->playerName); - if (!sMailRead->playerIsSender) + if (!sMailRead->international) { - StringCopy(ptr, gText_FromSpace); - sMailRead->signatureWidth = sMailRead->layout->signatureWidth - (StringLength(sMailRead->playerName) * 8 - 0x60); + // Never reached + StringCopy(ptr, gText_FromSpace); // Odd, "From" text is already printed in PrintMailText + sMailRead->signatureWidth = sMailRead->layout->signatureWidth - (StringLength(sMailRead->playerName) * 8 - 96); } else { - sub_81DB52C(sMailRead->playerName); + ConvertInternationalPlayerName(sMailRead->playerName); sMailRead->signatureWidth = sMailRead->layout->signatureWidth; } } -static void sub_8121B1C(void) +static void PrintMailText(void) { u16 i; - u8 strbuf[0x20]; + u8 signature[32]; u8 y; u8 *bufptr; s32 box_x; @@ -479,20 +687,19 @@ static void sub_8121B1C(void) PutWindowTilemap(1); FillWindowPixelBuffer(0, PIXEL_FILL(0)); FillWindowPixelBuffer(1, PIXEL_FILL(0)); - for (i = 0; i < sMailRead->layout->numSubStructs; i ++) + for (i = 0; i < sMailRead->layout->numLines; i ++) { - if (sMailRead->strbuf[i][0] == EOS || sMailRead->strbuf[i][0] == CHAR_SPACE) - { + if (sMailRead->message[i][0] == EOS || sMailRead->message[i][0] == CHAR_SPACE) continue; - } - AddTextPrinterParameterized3(0, 1, sMailRead->layout->var8[i].xOffset + sMailRead->layout->wordsYPos, y + sMailRead->layout->wordsXPos, sTextColors, 0, sMailRead->strbuf[i]); - y += sMailRead->layout->var8[i].lineHeight; + + AddTextPrinterParameterized3(0, 1, sMailRead->layout->lines[i].xOffset + sMailRead->layout->wordsXPos, y + sMailRead->layout->wordsYPos, sTextColors, 0, sMailRead->message[i]); + y += sMailRead->layout->lines[i].height; } - bufptr = StringCopy(strbuf, gText_FromSpace); + bufptr = StringCopy(signature, gText_FromSpace); StringCopy(bufptr, sMailRead->playerName); - box_x = GetStringCenterAlignXOffset(1, strbuf, sMailRead->signatureWidth) + 0x68; - box_y = sMailRead->layout->signatureYPos + 0x58; - AddTextPrinterParameterized3(0, 1, box_x, box_y, sTextColors, 0, strbuf); + box_x = GetStringCenterAlignXOffset(1, signature, sMailRead->signatureWidth) + 104; + box_y = sMailRead->layout->signatureYPos + 88; + AddTextPrinterParameterized3(0, 1, box_x, box_y, sTextColors, 0, signature); CopyWindowToVram(0, 3); CopyWindowToVram(1, 3); } @@ -506,19 +713,19 @@ static void VBlankCB_MailRead(void) static void CB2_MailRead(void) { - if (sMailRead->animsActive != 0) + if (sMailRead->iconType != ICON_TYPE_NONE) { AnimateSprites(); BuildOamBuffer(); } - sMailRead->callback2(); + sMailRead->callback(); } static void CB2_WaitForPaletteExitOnKeyPress(void) { if (!UpdatePaletteFade()) { - sMailRead->callback2 = CB2_ExitOnKeyPress; + sMailRead->callback = CB2_ExitOnKeyPress; } } @@ -526,8 +733,8 @@ static void CB2_ExitOnKeyPress(void) { if (JOY_NEW(A_BUTTON | B_BUTTON)) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); - sMailRead->callback2 = CB2_ExitMailReadFreeVars; + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); + sMailRead->callback = CB2_ExitMailReadFreeVars; } } @@ -535,13 +742,13 @@ static void CB2_ExitMailReadFreeVars(void) { if (!UpdatePaletteFade()) { - SetMainCallback2(sMailRead->callback); - switch (sMailRead->animsActive) + SetMainCallback2(sMailRead->exitCallback); + switch (sMailRead->iconType) { - case 1: - case 2: - FreeMonIconPalette(sub_80D2E84(sMailRead->mail->species)); - FreeAndDestroyMonIconSprite(&gSprites[sMailRead->monIconSprite]); + case ICON_TYPE_BEAD: + case ICON_TYPE_DREAM: + FreeMonIconPalette(GetIconSpeciesNoPersonality(sMailRead->mail->species)); + FreeAndDestroyMonIconSprite(&gSprites[sMailRead->monIconSpriteId]); } memset(sMailRead, 0, sizeof(*sMailRead)); ResetPaletteFade(); diff --git a/src/mail_data.c b/src/mail_data.c index e0553af99..2ae9bedab 100644 --- a/src/mail_data.c +++ b/src/mail_data.c @@ -5,6 +5,7 @@ #include "pokemon_icon.h" #include "text.h" #include "international_string_util.h" +#include "constants/easy_chat.h" void ClearMailData(void) { @@ -19,12 +20,12 @@ void ClearMailStruct(struct MailStruct *mail) s32 i; for (i = 0; i < MAIL_WORDS_COUNT; i++) - mail->words[i] = 0xFFFF; + mail->words[i] = EC_EMPTY_WORD; for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++) mail->playerName[i] = EOS; - for (i = 0; i < 4; i++) + for (i = 0; i < TRAINER_ID_LENGTH; i++) mail->trainerId[i] = 0; mail->species = SPECIES_BULBASAUR; @@ -34,7 +35,7 @@ void ClearMailStruct(struct MailStruct *mail) bool8 MonHasMail(struct Pokemon *mon) { u16 heldItem = GetMonData(mon, MON_DATA_HELD_ITEM); - if (ItemIsMail(heldItem) && GetMonData(mon, MON_DATA_MAIL) != 0xFF) + if (ItemIsMail(heldItem) && GetMonData(mon, MON_DATA_MAIL) != MAIL_NONE) return TRUE; else return FALSE; @@ -52,12 +53,12 @@ u8 GiveMailToMon(struct Pokemon *mon, u16 itemId) for (id = 0; id < PARTY_SIZE; id++) { - if (gSaveBlock1Ptr->mail[id].itemId == 0) + if (gSaveBlock1Ptr->mail[id].itemId == ITEM_NONE) { for (i = 0; i < MAIL_WORDS_COUNT; i++) - gSaveBlock1Ptr->mail[id].words[i] = 0xFFFF; + gSaveBlock1Ptr->mail[id].words[i] = EC_EMPTY_WORD; - for (i = 0; i < PLAYER_NAME_LENGTH + 1 - 1; i++) + for (i = 0; i < PLAYER_NAME_LENGTH; i++) gSaveBlock1Ptr->mail[id].playerName[i] = gSaveBlock2Ptr->playerName[i]; gSaveBlock1Ptr->mail[id].playerName[i] = EOS; PadNameString(gSaveBlock1Ptr->mail[id].playerName, CHAR_SPACE); @@ -75,7 +76,7 @@ u8 GiveMailToMon(struct Pokemon *mon, u16 itemId) } } - return 0xFF; + return MAIL_NONE; } u16 SpeciesToMailSpecies(u16 species, u32 personality) @@ -93,7 +94,7 @@ u16 MailSpeciesToSpecies(u16 mailSpecies, u16 *buffer) { u16 result; - if (mailSpecies >= 30000 && mailSpecies < (30000 + UNOWN_FORM_COUNT)) + if (mailSpecies >= 30000 && mailSpecies < (30000 + NUM_UNOWN_FORMS)) { result = SPECIES_UNOWN; *buffer = mailSpecies - 30000; @@ -112,8 +113,8 @@ u8 GiveMailToMon2(struct Pokemon *mon, struct MailStruct *mail) u16 itemId = mail->itemId; u8 mailId = GiveMailToMon(mon, itemId); - if (mailId == 0xFF) - return 0xFF; + if (mailId == MAIL_NONE) + return MAIL_NONE; gSaveBlock1Ptr->mail[mailId] = *mail; @@ -141,7 +142,7 @@ void TakeMailFromMon(struct Pokemon *mon) { mailId = GetMonData(mon, MON_DATA_MAIL); gSaveBlock1Ptr->mail[mailId].itemId = ITEM_NONE; - mailId = 0xFF; + mailId = MAIL_NONE; heldItem[0] = ITEM_NONE; heldItem[1] = ITEM_NONE << 8; SetMonData(mon, MON_DATA_MAIL, &mailId); @@ -162,7 +163,7 @@ u8 TakeMailFromMon2(struct Pokemon *mon) newHeldItem[0] = ITEM_NONE; newHeldItem[1] = ITEM_NONE << 8; - newMailId = 0xFF; + newMailId = MAIL_NONE; for (i = PARTY_SIZE; i < MAIL_COUNT; i++) { @@ -176,7 +177,7 @@ u8 TakeMailFromMon2(struct Pokemon *mon) } } - return 0xFF; + return MAIL_NONE; } bool8 ItemIsMail(u16 itemId) diff --git a/src/main.c b/src/main.c index 992d23ead..278b93542 100644 --- a/src/main.c +++ b/src/main.c @@ -23,6 +23,7 @@ #include "intro.h" #include "main.h" #include "trainer_hill.h" +#include "constants/rgb.h" static void VBlankIntr(void); static void HBlankIntr(void); @@ -90,7 +91,7 @@ void AgbMain() #if !MODERN RegisterRamReset(RESET_ALL); #endif //MODERN - *(vu16 *)BG_PLTT = 0x7FFF; + *(vu16 *)BG_PLTT = RGB_WHITE; // Set the backdrop to white on startup InitGpuRegManager(); REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | WAITCNT_WS0_S_1 | WAITCNT_WS0_N_3; InitKeys(); @@ -350,7 +351,7 @@ static void VBlankIntr(void) gPcmDmaCounter = gSoundInfo.pcmDmaCounter; m4aSoundMain(); - sub_8033648(); + TryReceiveLinkBattleData(); if (!gMain.inBattle || !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_RECORDED))) Random(); diff --git a/src/main_menu.c b/src/main_menu.c index 74af96da8..d2ec55d3e 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -581,9 +581,9 @@ static u32 InitMainMenu(bool8 returningFromOptionsMenu) ResetSpriteData(); FreeAllSpritePalettes(); if (returningFromOptionsMenu) - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); // fade to black + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); // fade to black else - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_WHITEALPHA); // fade to white + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_WHITEALPHA); // fade to white ResetBgsAndClearDma3BusyFlags(0); InitBgsFromTemplates(0, sMainMenuBgTemplates, ARRAY_COUNT(sMainMenuBgTemplates)); ChangeBgX(0, 0, 0); @@ -889,13 +889,13 @@ static bool8 HandleMainMenuInput(u8 taskId) { PlaySE(SE_SELECT); IsWirelessAdapterConnected(); // why bother calling this here? debug? Task_HandleMainMenuAPressed will check too - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_HandleMainMenuAPressed; } else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_WHITEALPHA); SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, 240)); SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, 160)); gTasks[taskId].func = Task_HandleMainMenuBPressed; @@ -1095,7 +1095,7 @@ static void Task_HandleMainMenuAPressed(u8 taskId) SetGpuReg(REG_OFFSET_BG1VOFS, 0); SetGpuReg(REG_OFFSET_BG0HOFS, 0); SetGpuReg(REG_OFFSET_BG0VOFS, 0); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); return; } FreeAllWindowBuffers(); @@ -1152,7 +1152,7 @@ static void Task_DisplayMainMenuInvalidActionError(u8 taskId) if (JOY_NEW(A_BUTTON | B_BUTTON)) { PlaySE(SE_SELECT); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].func = Task_HandleMainMenuBPressed; } } @@ -1284,10 +1284,10 @@ static void Task_NewGameBirchSpeech_Init(u8 taskId) FreeAllSpritePalettes(); ResetAllPicSprites(); AddBirchSpeechObjects(taskId); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); gTasks[taskId].tBG1HOFS = 0; gTasks[taskId].func = Task_NewGameBirchSpeech_WaitToShowBirch; - gTasks[taskId].tPlayerSpriteId = 0xFF; + gTasks[taskId].tPlayerSpriteId = SPRITE_NONE; gTasks[taskId].data[3] = 0xFF; gTasks[taskId].tTimer = 0xD8; PlayBGM(MUS_ROUTE122); @@ -1594,7 +1594,7 @@ static void Task_NewGameBirchSpeech_WaitPressBeforeNameChoice(u8 taskId) { if ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON))) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].func = Task_NewGameBirchSpeech_StartNamingScreen; } } @@ -1749,7 +1749,7 @@ static void Task_NewGameBirchSpeech_ShrinkPlayer(u8 taskId) InitSpriteAffineAnim(&gSprites[spriteId]); StartSpriteAffineAnim(&gSprites[spriteId], 0); gSprites[spriteId].callback = SpriteCB_MovePlayerDownWhileShrinking; - BeginNormalPaletteFade(0x0000FFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_BG, 0, 0, 16, RGB_BLACK); FadeOutBGM(4); gTasks[taskId].func = Task_NewGameBirchSpeech_WaitForPlayerShrink; } @@ -1773,7 +1773,7 @@ static void Task_NewGameBirchSpeech_FadePlayerToWhite(u8 taskId) spriteId = gTasks[taskId].tPlayerSpriteId; gSprites[spriteId].callback = SpriteCB_Null; SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); - BeginNormalPaletteFade(0xFFFF0000, 0, 0, 16, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_OBJECTS, 0, 0, 16, RGB_WHITEALPHA); gTasks[taskId].func = Task_NewGameBirchSpeech_Cleanup; } } @@ -1843,7 +1843,7 @@ static void CB2_NewGameBirchSpeech_ReturnFromNamingScreen(void) gSprites[spriteId].invisible = FALSE; gTasks[taskId].tPlayerSpriteId = spriteId; SetGpuReg(REG_OFFSET_BG1HOFS, -60); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); SetGpuReg(REG_OFFSET_WIN0H, 0); SetGpuReg(REG_OFFSET_WIN0V, 0); SetGpuReg(REG_OFFSET_WININ, 0); @@ -2117,9 +2117,9 @@ static void NewGameBirchSpeech_SetDefaultPlayerName(u8 nameId) name = gMalePresetNames[nameId]; else name = gFemalePresetNames[nameId]; - for (i = 0; i < 7; i++) + for (i = 0; i < PLAYER_NAME_LENGTH; i++) gSaveBlock2Ptr->playerName[i] = name[i]; - gSaveBlock2Ptr->playerName[7] = 0xFF; + gSaveBlock2Ptr->playerName[PLAYER_NAME_LENGTH] = EOS; } static void CreateMainMenuErrorWindow(const u8* str) diff --git a/src/match_call.c b/src/match_call.c index 7e8d0c38a..fb8ebc98c 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -1114,7 +1114,7 @@ static void StartMatchCall(void) { ScriptContext2_Enable(); FreezeObjectEvents(); - sub_808B864(); + PlayerFreeze(); sub_808BCF4(); } @@ -1168,7 +1168,7 @@ static bool32 LoadMatchCallWindowGfx(u8 taskId) { s16 *taskData = gTasks[taskId].data; taskData[2] = AddWindow(&sMatchCallTextWindow); - if (taskData[2] == 0xFF) + if (taskData[2] == WINDOW_NONE) { DestroyTask(taskId); return FALSE; diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index c97ee94f3..cdcde9b06 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -250,7 +250,7 @@ void ScrSpecial_HipsterTeachWord(void) { u16 phrase = GetNewHipsterPhraseToTeach(); - if (phrase == 0xFFFF) + if (phrase == EC_EMPTY_WORD) { gSpecialVar_Result = FALSE; } @@ -283,7 +283,7 @@ void ScrSpecial_GenerateGiddyLine(void) if (giddy->taleCounter == 0) InitGiddyTaleList(); - if (giddy->randomWords[giddy->taleCounter] != 0xFFFF) // is not the last element of the array? + if (giddy->randomWords[giddy->taleCounter] != EC_EMPTY_WORD) { u8 *stringPtr; u32 adjective = Random(); @@ -316,7 +316,7 @@ static void InitGiddyTaleList(void) {EC_GROUP_HOBBIES, 0}, {EC_GROUP_MOVE_1, 0}, {EC_GROUP_MOVE_2, 0}, - {EC_GROUP_POKEMON_2, 0} + {EC_GROUP_POKEMON_NATIONAL, 0} }; u16 i; u16 r10; @@ -348,7 +348,7 @@ static void InitGiddyTaleList(void) r1 = Random() % 10; if (r1 < 3 && r7 < 8) { - giddy->randomWords[i] = 0xFFFF; + giddy->randomWords[i] = EC_EMPTY_WORD; r7++; } else diff --git a/src/menu.c b/src/menu.c index 69c7a9885..4de60d16d 100644 --- a/src/menu.c +++ b/src/menu.c @@ -145,8 +145,8 @@ void task_free_buf_after_copying_tile_data_to_vram(u8 taskId); void InitStandardTextBoxWindows(void) { InitWindows(sStandardTextBox_WindowTemplates); - sStartMenuWindowId = 0xFF; - sMapNamePopupWindowId = 0xFF; + sStartMenuWindowId = WINDOW_NONE; + sMapNamePopupWindowId = WINDOW_NONE; } void FreeAllOverworldWindowBuffers(void) @@ -491,7 +491,7 @@ u8 GetPlayerTextSpeedDelay(void) u8 sub_81979C4(u8 a1) { - if (sStartMenuWindowId == 0xFF) + if (sStartMenuWindowId == WINDOW_NONE) sStartMenuWindowId = sub_8198AA4(0, 0x16, 1, 7, (a1 * 2) + 2, 0xF, 0x139); return sStartMenuWindowId; } @@ -503,10 +503,10 @@ u8 GetStartMenuWindowId(void) void RemoveStartMenuWindow(void) { - if (sStartMenuWindowId != 0xFF) + if (sStartMenuWindowId != WINDOW_NONE) { RemoveWindow(sStartMenuWindowId); - sStartMenuWindowId = 0xFF; + sStartMenuWindowId = WINDOW_NONE; } } @@ -522,7 +522,7 @@ u16 sub_8197A38(void) u8 AddMapNamePopUpWindow(void) { - if (sMapNamePopupWindowId == 0xFF) + if (sMapNamePopupWindowId == WINDOW_NONE) sMapNamePopupWindowId = sub_8198AA4(0, 1, 1, 10, 3, 14, 0x107); return sMapNamePopupWindowId; } @@ -534,10 +534,10 @@ u8 GetMapNamePopUpWindowId(void) void RemoveMapNamePopUpWindow(void) { - if (sMapNamePopupWindowId != 0xFF) + if (sMapNamePopupWindowId != WINDOW_NONE) { RemoveWindow(sMapNamePopupWindowId); - sMapNamePopupWindowId = 0xFF; + sMapNamePopupWindowId = WINDOW_NONE; } } @@ -816,7 +816,7 @@ void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram) { u16 width = 0; - if (sWindowId != 0xFF) + if (sWindowId != WINDOW_NONE) { PutWindowTilemap(sWindowId); FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15)); @@ -838,7 +838,7 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo u8 color[3]; u16 width = 0; - if (sWindowId != 0xFF) + if (sWindowId != WINDOW_NONE) { if (a3 != 0) { @@ -873,13 +873,13 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo void sub_81982D8(void) { - if (sWindowId != 0xFF) + if (sWindowId != WINDOW_NONE) CopyWindowToVram(sWindowId, 3); } void sub_81982F0(void) { - if (sWindowId != 0xFF) + if (sWindowId != WINDOW_NONE) { FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15)); CopyWindowToVram(sWindowId, 3); @@ -888,13 +888,13 @@ void sub_81982F0(void) void sub_8198314(void) { - if (sWindowId != 0xFF) + if (sWindowId != WINDOW_NONE) { FillWindowPixelBuffer(sWindowId, PIXEL_FILL(0)); ClearWindowTilemap(sWindowId); CopyWindowToVram(sWindowId, 3); RemoveWindow(sWindowId); - sWindowId = 0xFF; + sWindowId = WINDOW_NONE; } } diff --git a/src/menu_helpers.c b/src/menu_helpers.c index b31d84a1e..3fe19efcc 100644 --- a/src/menu_helpers.c +++ b/src/menu_helpers.c @@ -319,7 +319,7 @@ bool8 MenuHelpers_CallLinkSomething(void) { if (sub_81221D0() == TRUE) return TRUE; - else if (sub_800B504() != TRUE) + else if (IsLinkRecvQueueLengthAtLeast3() != TRUE) return FALSE; else return TRUE; diff --git a/src/menu_specialized.c b/src/menu_specialized.c index 7de963893..8eda1621e 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -23,7 +23,6 @@ #include "text_window.h" #include "trig.h" #include "window.h" -#include "constants/berry.h" #include "constants/songs.h" #include "gba/io_reg.h" @@ -217,14 +216,14 @@ bool8 sub_81D1C44(u8 count) return FALSE; for (i = 0; i < ARRAY_COUNT(sUnknown_0203CF48); i++) - sUnknown_0203CF48[i] = 0xFF; + sUnknown_0203CF48[i] = WINDOW_NONE; return TRUE; } u8 sub_81D1C84(u8 a0) { - if (sUnknown_0203CF48[a0] == 0xFF) + if (sUnknown_0203CF48[a0] == WINDOW_NONE) { if (a0 == 2) { @@ -246,7 +245,7 @@ void sub_81D1D04(u8 a0) ClearStdWindowAndFrameToTransparent(sUnknown_0203CF48[a0], 0); ClearWindowTilemap(sUnknown_0203CF48[a0]); RemoveWindow(sUnknown_0203CF48[a0]); - sUnknown_0203CF48[a0] = 0xFF; + sUnknown_0203CF48[a0] = WINDOW_NONE; } static u8 sub_81D1D34(u8 a0) @@ -262,10 +261,10 @@ static void sub_81D1D44(u8 windowId, s32 itemId, u8 y) if (itemId == LIST_CANCEL) return; - StringCopy(buffer, gSaveBlock1Ptr->mail[6 + itemId].playerName); - sub_81DB52C(buffer); + StringCopy(buffer, gSaveBlock1Ptr->mail[PARTY_SIZE + itemId].playerName); + ConvertInternationalPlayerName(buffer); length = StringLength(buffer); - if (length <= 5) + if (length < PLAYER_NAME_LENGTH - 1) ConvertInternationalString(buffer, LANGUAGE_JAPANESE); AddTextPrinterParameterized4(windowId, 1, 8, y, 0, 0, sPlayerNameTextColors, -1, buffer); } @@ -311,7 +310,7 @@ static void sub_81D1E7C(s32 itemIndex, bool8 onInit, struct ListMenu *list) void sub_81D1E90(struct PlayerPCItemPageStruct *page) { - page->scrollIndicatorId = AddScrollIndicatorArrowPairParameterized(2, 0xC8, 12, 0x94, page->count - page->pageItems + 1, 0x6E, 0x6E, &page->itemsAbove); + page->scrollIndicatorTaskId = AddScrollIndicatorArrowPairParameterized(2, 0xC8, 12, 0x94, page->count - page->pageItems + 1, 0x6E, 0x6E, &page->itemsAbove); } void sub_81D1EC0(void) diff --git a/src/mevent2.c b/src/mevent2.c index 3209c585a..d2c020858 100755 --- a/src/mevent2.c +++ b/src/mevent2.c @@ -26,7 +26,7 @@ void sub_801AFD8(void) { CpuFill32(0, &gSaveBlock1Ptr->unk_322C, sizeof(gSaveBlock1Ptr->unk_322C)); sub_801B180(); - sub_811F8BC(); + InitQuestionnaireWords(); } struct WonderNews *GetSavedWonderNews(void) @@ -49,9 +49,9 @@ struct MysteryEventStruct *sub_801B044(void) return &gSaveBlock1Ptr->unk_322C.unk_340; } -u16 *sub_801B058(void) +u16 *GetQuestionnaireWordsPtr(void) { - return gSaveBlock1Ptr->unk_322C.unk_338; + return gSaveBlock1Ptr->unk_322C.questionnaireWords; } void DestroyWonderNews(void) @@ -364,8 +364,8 @@ void sub_801B580(struct MEventStruct_Unk1442CC *data, bool32 a1) data->unk_14 = 0; } - for (i = 0; i < 4; i++) - data->unk_16[i] = gSaveBlock1Ptr->unk_322C.unk_338[i]; + for (i = 0; i < NUM_QUESTIONNAIRE_WORDS; i++) + data->unk_16[i] = gSaveBlock1Ptr->unk_322C.questionnaireWords[i]; CopyTrainerId(data->unk_4C, gSaveBlock2Ptr->playerTrainerId); StringCopy(data->unk_45, gSaveBlock2Ptr->playerName); @@ -425,7 +425,7 @@ u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const vo bool32 MEventStruct_Unk1442CC_CompareField_unk_16(const struct MEventStruct_Unk1442CC *a0, const u16 *a1) { int i; - for (i = 0; i < 4; i++) + for (i = 0; i < NUM_QUESTIONNAIRE_WORDS; i++) { if (a0->unk_16[i] != a1[i]) return FALSE; diff --git a/src/mevent_801BAAC.c b/src/mevent_801BAAC.c index d732e3045..fa0153e62 100644 --- a/src/mevent_801BAAC.c +++ b/src/mevent_801BAAC.c @@ -186,7 +186,7 @@ s32 FadeToWonderCardMenu(void) switch(sWonderCardData->unk_0174) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); break; case 1: if (UpdatePaletteFade()) @@ -231,7 +231,7 @@ s32 FadeToWonderCardMenu(void) ShowBg(2); gPaletteFade.bufferTransferDisabled = FALSE; sub_801C4C0(); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); UpdatePaletteFade(); break; default: @@ -251,7 +251,7 @@ s32 FadeOutFromWonderCard(bool32 flag) switch (sWonderCardData->unk_0174) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); break; case 1: if (UpdatePaletteFade()) @@ -279,7 +279,7 @@ s32 FadeOutFromWonderCard(bool32 flag) case 5: PrintMysteryGiftOrEReaderTopMenu(gGiftIsFromEReader, flag); CopyBgTilemapBufferToVram(0); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); break; default: if (UpdatePaletteFade()) @@ -420,7 +420,7 @@ void sub_801C4C0(void) sWonderCardData->unk_017C = 0xFF; if (sWonderCardData->unk_014C.unk_06 != SPECIES_NONE) { - sWonderCardData->unk_017C = sub_80D2D78(sub_80D2E84(sWonderCardData->unk_014C.unk_06), SpriteCallbackDummy, 0xDC, 0x14, 0, FALSE); + sWonderCardData->unk_017C = CreateMonIconNoPersonality(GetIconSpeciesNoPersonality(sWonderCardData->unk_014C.unk_06), SpriteCallbackDummy, 0xDC, 0x14, 0, FALSE); gSprites[sWonderCardData->unk_017C].oam.priority = 2; } if (sWonderCardData->unk_0000.unk_09 != 0 && sWonderCardData->unk_0000.unk_08_0 == 1) @@ -434,7 +434,7 @@ void sub_801C4C0(void) sWonderCardData->unk_017D[r7][0] = CreateSprite(&gUnknown_082F1D48, 0xd8 - 32 * r7, 0x90, 8); if (sWonderCardData->unk_014C.unk_08[0][r7] != 0) { - sWonderCardData->unk_017D[r7][1] = sub_80D2D78(sub_80D2E84(sWonderCardData->unk_014C.unk_08[0][r7]), SpriteCallbackDummy, 0xd8 - 32 * r7, 0x88, 0, 0); + sWonderCardData->unk_017D[r7][1] = CreateMonIconNoPersonality(GetIconSpeciesNoPersonality(sWonderCardData->unk_014C.unk_08[0][r7]), SpriteCallbackDummy, 0xd8 - 32 * r7, 0x88, 0, 0); } } } @@ -575,7 +575,7 @@ s32 FadeToWonderNewsMenu(void) switch (sWonderNewsData->unk_01C0_1) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); break; case 1: if (UpdatePaletteFade()) @@ -629,7 +629,7 @@ s32 FadeToWonderNewsMenu(void) ShowBg(3); gPaletteFade.bufferTransferDisabled = FALSE; sWonderNewsData->unk_01C1 = AddScrollIndicatorArrowPair(&sWonderNewsData->unk_0394, &sWonderNewsData->unk_01C6); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); UpdatePaletteFade(); break; default: @@ -650,7 +650,7 @@ s32 FadeOutFromWonderNews(bool32 flag) switch (sWonderNewsData->unk_01C0_1) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); break; case 1: if (UpdatePaletteFade()) @@ -692,7 +692,7 @@ s32 FadeOutFromWonderNews(bool32 flag) MG_DrawCheckerboardPattern(3); CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(3); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); break; default: if (UpdatePaletteFade()) diff --git a/src/minigame_countdown.c b/src/minigame_countdown.c index d2f7d3ea8..f7dad4800 100644 --- a/src/minigame_countdown.c +++ b/src/minigame_countdown.c @@ -5,15 +5,366 @@ #include "sound.h" #include "task.h" #include "trig.h" +#include "minigame_countdown.h" #include "constants/songs.h" +/* + This file contains two types of '3-2-1 Start' countdowns intended for use by the wireless minigames. + + One is static, where the numbers simply appear and disappear without moving. This version is unused. + The other (used) version has the numbers squish and bounce up as they appear. +*/ + +#define TAG_STATIC_COUNTDOWN 0x2000 + +enum { + STATE_IDLE = 1, + STATE_START, + STATE_RUN, + STATE_END, +}; + +enum { + FUNC_INIT, + FUNC_FREE, + FUNC_START, + FUNC_RUN, +}; + +enum { + ANIM_THREE, + ANIM_TWO, + ANIM_ONE, + ANIM_START_LEFT, + ANIM_START_MID, + ANIM_START_RIGHT, +}; + extern const struct OamData gOamData_AffineOff_ObjNormal_32x32; -static void sub_802E6D0(u8 taskId); -static void sub_802E83C(u8 taskId); -static void sub_802E8C8(u8 taskId); -static void sub_802EA50(u8 taskId); -static void sub_802EAB0(u8 taskId); +static void Task_StaticCountdown(u8 taskId); +static void Task_StaticCountdown_Init(u8 taskId); +static void Task_StaticCountdown_Free(u8 taskId); +static void Task_StaticCountdown_Start(u8 taskId); +static void Task_StaticCountdown_Run(u8 taskId); + +static const u16 s321Start_Static_Pal[] = INCBIN_U16("graphics/link_games/321start_static.gbapal"); +static const u32 s321Start_Static_Gfx[] = INCBIN_U32("graphics/link_games/321start_static.4bpp.lz"); + +static const struct CompressedSpriteSheet sSpriteSheet_321Start_Static[] = +{ + {s321Start_Static_Gfx, 0xC00, TAG_STATIC_COUNTDOWN}, + {}, +}; + +static const struct SpritePalette sSpritePalette_321Start_Static[] = +{ + {s321Start_Static_Pal, TAG_STATIC_COUNTDOWN}, + {}, +}; + +static const union AnimCmd sAnim_StaticCountdown_Three[] = +{ + ANIMCMD_FRAME(0, 0), + ANIMCMD_END +}; + +static const union AnimCmd sAnim_StaticCountdown_Two[] = +{ + ANIMCMD_FRAME(16, 0), + ANIMCMD_END +}; + +static const union AnimCmd sAnim_StaticCountdown_One[] = +{ + ANIMCMD_FRAME(32, 0), + ANIMCMD_END +}; + +static const union AnimCmd sAnim_StaticCountdown_StartLeft[] = +{ + ANIMCMD_FRAME(64, 0), + ANIMCMD_END +}; + +static const union AnimCmd sAnim_StaticCountdown_StartMid[] = +{ + ANIMCMD_FRAME(48, 0), + ANIMCMD_END +}; + +static const union AnimCmd sAnim_StaticCountdown_StartRight[] = +{ + ANIMCMD_FRAME(80, 0), + ANIMCMD_END +}; + +static const union AnimCmd *const sAnims_StaticCountdown[] = +{ + [ANIM_THREE] = sAnim_StaticCountdown_Three, + [ANIM_TWO] = sAnim_StaticCountdown_Two, + [ANIM_ONE] = sAnim_StaticCountdown_One, + [ANIM_START_LEFT] = sAnim_StaticCountdown_StartLeft, + [ANIM_START_MID] = sAnim_StaticCountdown_StartMid, + [ANIM_START_RIGHT] = sAnim_StaticCountdown_StartRight +}; + +static const struct SpriteTemplate sSpriteTemplate_StaticCountdown[] = +{ + { + .tileTag = TAG_STATIC_COUNTDOWN, + .paletteTag = TAG_STATIC_COUNTDOWN, + .oam = &gOamData_AffineOff_ObjNormal_32x32, + .anims = sAnims_StaticCountdown, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, +}; + +static const TaskFunc sStaticCountdownFuncs[][4] = +{ + { + [FUNC_INIT] = Task_StaticCountdown_Init, + [FUNC_FREE] = Task_StaticCountdown_Free, + [FUNC_START] = Task_StaticCountdown_Start, + [FUNC_RUN] = Task_StaticCountdown_Run + }, +}; + +#define tState data[0] +#define tFuncSetId data[1] // These 4 data elements are indexes into +#define tSpriteTemplateId data[2] // arrays that only have 1 element with +#define tSpriteSheetId data[3] // data. As such their only legal value +#define tSpritePalId data[4] // is 0. Unclear why they were used. +#define tInterval data[5] +#define tPriority data[6] +#define tSubpriority data[7] +#define tNumSprites data[8] +#define tX data[9] +#define tY data[10] +#define tPrevTime data[10] // Re-used +#define tTimer data[11] +#define tLinkTimer data[12] +// 13-15 hold sprite ids +// tSpriteIds(0) is used for the number sprites, and the leftmost part of 'Start' +// tSpriteIds(1) is used for the middle part of 'Start' +// tSpriteIds(2) is used for for the rightmost part of 'Start' +#define tSpriteIds(i) data[13 + i] + +#define sInterval data[1] // Never read +#define sAnimNum data[2] +#define sTaskId data[3] +#define sId data[4] // Never read +#define sNumberSpriteId data[5] // Never read + +// Unused +static u32 CreateStaticCountdownTask(u8 funcSetId, u8 taskPriority) +{ + u8 taskId = CreateTask(Task_StaticCountdown, taskPriority); + struct Task *task = &gTasks[taskId]; + + task->tState = STATE_IDLE; + task->tFuncSetId = funcSetId; + sStaticCountdownFuncs[funcSetId][FUNC_INIT](taskId); + return taskId; +} + +static bool32 StartStaticCountdown(void) +{ + u8 taskId = FindTaskIdByFunc(Task_StaticCountdown); + if (taskId == TASK_NONE) + return FALSE; + + gTasks[taskId].tState = STATE_START; + return TRUE; +} + +static bool32 IsStaticCountdownRunning(void) +{ + return FuncIsActiveTask(Task_StaticCountdown); +} + +static void Task_StaticCountdown(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + switch (tState) + { + // STATE_IDLE does nothing; wait until started + case STATE_START: + sStaticCountdownFuncs[tFuncSetId][FUNC_START](taskId); + tState = STATE_RUN; + break; + case STATE_RUN: + sStaticCountdownFuncs[tFuncSetId][FUNC_RUN](taskId); + break; + case STATE_END: + sStaticCountdownFuncs[tFuncSetId][FUNC_FREE](taskId); + DestroyTask(taskId); + break; + } +} + +static void StaticCountdown_CreateSprites(u8 taskId, s16 *data) +{ + u8 i; + struct Sprite *sprite; + + LoadCompressedSpriteSheet(&sSpriteSheet_321Start_Static[tSpriteSheetId]); + LoadSpritePalette(&sSpritePalette_321Start_Static[tSpritePalId]); + for (i = 0; i < tNumSprites; i++) + tSpriteIds(i) = CreateSprite(&sSpriteTemplate_StaticCountdown[tSpriteTemplateId], tX, tY, tSubpriority); + for (i = 0; i < tNumSprites; i++) + { + sprite = &gSprites[tSpriteIds(i)]; + sprite->oam.priority = tPriority; + sprite->invisible = TRUE; + sprite->sInterval = tInterval; + sprite->sTaskId = taskId; + sprite->sId = i; + sprite->sNumberSpriteId = tSpriteIds(0); + } +} + +static void Task_StaticCountdown_Init(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + tSpriteTemplateId = 0; + tSpriteSheetId = 0; + tSpritePalId = 0; + tInterval = 60; + tPriority = 0; + tSubpriority = 0; + tNumSprites = 3; + tX = 120; + tY = 88; + StaticCountdown_CreateSprites(taskId, data); + + StartSpriteAnim(&gSprites[tSpriteIds(1)], ANIM_START_MID); + gSprites[tSpriteIds(1)].pos2.x = -32; + + StartSpriteAnim(&gSprites[tSpriteIds(2)], ANIM_START_RIGHT); + gSprites[tSpriteIds(2)].pos2.x = 32; +} + +static void Task_StaticCountdown_Free(u8 taskId) +{ + u8 i = 0; + s16 *data = gTasks[taskId].data; + + for (i = 0; i < tNumSprites; i++) + DestroySprite(&gSprites[tSpriteIds(i)]); + FreeSpriteTilesByTag(sSpriteSheet_321Start_Static[tSpriteSheetId].tag); + FreeSpritePaletteByTag(sSpritePalette_321Start_Static[tSpritePalId].tag); +} + +static void SpriteCB_StaticCountdown(struct Sprite *sprite) +{ + s16 *data = gTasks[sprite->sTaskId].data; + + if (tTimer % tInterval != 0) + return; + if (tTimer == tPrevTime) + return; + + tPrevTime = tTimer; + switch (sprite->sAnimNum) + { + case ANIM_THREE: + sprite->invisible = FALSE; + case ANIM_TWO: + case ANIM_ONE: + // Set sprite to a number + PlaySE(SE_BALL_BOUNCE_1); + StartSpriteAnim(sprite, sprite->sAnimNum); + break; + case ANIM_START_LEFT: + // Set sprite to 'Start' + PlaySE(SE_PIN); + StartSpriteAnim(sprite, sprite->sAnimNum); + gSprites[tSpriteIds(1)].invisible = FALSE; + gSprites[tSpriteIds(2)].invisible = FALSE; + break; + case ANIM_START_LEFT + 1: // End + // Hide countdown + sprite->invisible = TRUE; + gSprites[tSpriteIds(1)].invisible = TRUE; + gSprites[tSpriteIds(2)].invisible = TRUE; + tState = STATE_END; + return; + } + sprite->sAnimNum++; +} + +static void Task_StaticCountdown_Start(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + PlaySE(SE_BALL_BOUNCE_1); + gSprites[tSpriteIds(0)].callback = SpriteCB_StaticCountdown; + gSprites[tSpriteIds(0)].invisible = FALSE; + gTasks[taskId].tState = STATE_RUN; +} + +// Increment timer for progressing the countdown. +// If the player is the link leader, increment a +// separate timer and send it to group members for +// them to read and use. +static void Task_StaticCountdown_Run(u8 taskId) +{ + u16 packet[RFU_PACKET_SIZE]; + s16 *data = gTasks[taskId].data; + + if (gReceivedRemoteLinkPlayers != 0) + { + // Read link timer + if (gRecvCmds[0][1] == LINKCMD_COUNTDOWN) + tTimer = gRecvCmds[0][2]; + + if (GetMultiplayerId() == 0) + { + // Player is link leader. + // Send timer to group members + tLinkTimer++; + memset(packet, 0, sizeof(packet)); + packet[0] = LINKCMD_COUNTDOWN; + packet[1] = tLinkTimer; + Rfu_SendPacket(packet); + } + } + else + { + // Local, just increment own timer + tTimer++; + } +} + +#undef tState +#undef tFuncSetId +#undef tSpriteTemplateId +#undef tSpriteSheetId +#undef tSpritePalId +#undef tInterval +#undef tPriority +#undef tSubpriority +#undef tNumSprites +#undef tX +#undef tY +#undef tPrevTime +#undef tTimer +#undef tLinkTimer +#undef tSpriteIds +#undef sInterval +#undef sAnimNum +#undef sTaskId +#undef sId +#undef sNumberSpriteId + +/* + The countdown that actually gets used by + the wireless minigames starts here +*/ + static void Task_MinigameCountdown(u8 taskId); static bool32 RunMinigameCountdownDigitsAnim(u8 spriteId); static bool32 IsStartGraphicAnimRunning(u8 spriteId); @@ -23,260 +374,8 @@ static void CreateStartSprite(u16 tileTag, u16 palTag, s16 x, s16 y, u8 subprior static void InitStartGraphic(u8 spriteId1, u8 spriteId2, u8 spriteId3); static void SpriteCB_Start(struct Sprite *sprite); -static const u16 sSpritePal_321Start_2[] = INCBIN_U16("graphics/link_games/321start_2.gbapal"); -static const u32 sSpriteSheet_321Start_2[] = INCBIN_U32("graphics/link_games/321start_2.4bpp.lz"); - -static const struct CompressedSpriteSheet gUnknown_082FE6C8[] = -{ - {sSpriteSheet_321Start_2, 0xC00, 0x2000}, - {}, -}; - -static const struct SpritePalette gUnknown_082FE6D8[] = -{ - {sSpritePal_321Start_2, 0x2000}, - {}, -}; - -static const union AnimCmd sSpriteAnim_82FE6E8[] = -{ - ANIMCMD_FRAME(0, 0), - ANIMCMD_END -}; - -static const union AnimCmd sSpriteAnim_82FE6F0[] = -{ - ANIMCMD_FRAME(16, 0), - ANIMCMD_END -}; - -static const union AnimCmd sSpriteAnim_82FE6F8[] = -{ - ANIMCMD_FRAME(32, 0), - ANIMCMD_END -}; - -static const union AnimCmd sSpriteAnim_82FE700[] = -{ - ANIMCMD_FRAME(64, 0), - ANIMCMD_END -}; - -static const union AnimCmd sSpriteAnim_82FE708[] = -{ - ANIMCMD_FRAME(48, 0), - ANIMCMD_END -}; - -static const union AnimCmd sSpriteAnim_82FE710[] = -{ - ANIMCMD_FRAME(80, 0), - ANIMCMD_END -}; - -static const union AnimCmd *const sSpriteAnimTable_82FE718[] = -{ - sSpriteAnim_82FE6E8, - sSpriteAnim_82FE6F0, - sSpriteAnim_82FE6F8, - sSpriteAnim_82FE700, - sSpriteAnim_82FE708, - sSpriteAnim_82FE710 -}; - -static const struct SpriteTemplate gUnknown_082FE730[] = -{ - { - .tileTag = 0x2000, - .paletteTag = 0x2000, - .oam = &gOamData_AffineOff_ObjNormal_32x32, - .anims = sSpriteAnimTable_82FE718, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = SpriteCallbackDummy, - }, -}; - -static const TaskFunc gUnknown_082FE748[][4] = -{ - { - sub_802E83C, - sub_802E8C8, - sub_802EA50, - sub_802EAB0 - }, -}; - -static const u16 sSpritePal_321Start[] = INCBIN_U16("graphics/link_games/321start.gbapal"); -static const u32 sSpriteSheet_321Start[] = INCBIN_U32("graphics/link_games/321start.4bpp.lz"); - -// Unused -static u32 sub_802E63C(u8 funcSetId, u8 taskPriority) -{ - u8 taskId = CreateTask(sub_802E6D0, taskPriority); - struct Task *task = &gTasks[taskId]; - - task->data[0] = 1; - task->data[1] = funcSetId; - gUnknown_082FE748[funcSetId][0](taskId); - return taskId; -} - -static bool32 sub_802E688(void) -{ - u8 taskId = FindTaskIdByFunc(sub_802E6D0); - if (taskId == 0xFF) - return FALSE; - - gTasks[taskId].data[0] = 2; - return TRUE; -} - -static bool32 sub_802E6BC(void) -{ - return FuncIsActiveTask(sub_802E6D0); -} - -static void sub_802E6D0(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - - switch (data[0]) - { - case 2: - gUnknown_082FE748[data[1]][2](taskId); - data[0] = 3; - break; - case 3: - gUnknown_082FE748[data[1]][3](taskId); - break; - case 4: - gUnknown_082FE748[data[1]][1](taskId); - DestroyTask(taskId); - break; - } -} - -static void sub_802E75C(u8 taskId, s16 *data) -{ - u8 i; - struct Sprite *sprite; - - LoadCompressedSpriteSheet(&gUnknown_082FE6C8[data[3]]); - LoadSpritePalette(&gUnknown_082FE6D8[data[4]]); - for (i = 0; i < data[8]; i++) - data[13 + i] = CreateSprite(&gUnknown_082FE730[data[2]], data[9], data[10], data[7]); - for (i = 0; i < data[8]; i++) - { - sprite = &gSprites[data[13 + i]]; - sprite->oam.priority = data[6]; - sprite->invisible = TRUE; - sprite->data[1] = data[5]; - sprite->data[3] = taskId; - sprite->data[4] = i; - sprite->data[5] = data[13]; - } -} - -static void sub_802E83C(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - data[2] = 0; - data[3] = 0; - data[4] = 0; - data[5] = 60; - data[6] = 0; - data[7] = 0; - data[8] = 3; - data[9] = 120; - data[10] = 88; - sub_802E75C(taskId, data); - - StartSpriteAnim(&gSprites[data[14]], 4); - gSprites[data[14]].pos2.x = -32; - - StartSpriteAnim(&gSprites[data[15]], 5); - gSprites[data[15]].pos2.x = 32; -} - -static void sub_802E8C8(u8 taskId) -{ - u8 i = 0; - s16 *data = gTasks[taskId].data; - - for (i = 0; i < data[8]; i++) - DestroySprite(&gSprites[data[13 + i]]); - FreeSpriteTilesByTag(gUnknown_082FE6C8[data[3]].tag); - FreeSpritePaletteByTag(gUnknown_082FE6D8[data[4]].tag); -} - -static void sub_802E938(struct Sprite *sprite) -{ - s16 *data = gTasks[sprite->data[3]].data; - - if (data[11] % data[5] != 0) - return; - if (data[11] == data[10]) - return; - - data[10] = data[11]; - switch (sprite->data[2]) - { - case 0: - sprite->invisible = FALSE; - case 1: - case 2: - PlaySE(SE_BALL_BOUNCE_1); - StartSpriteAnim(sprite, sprite->data[2]); - break; - case 3: - PlaySE(SE_PIN); - StartSpriteAnim(sprite, sprite->data[2]); - gSprites[data[14]].invisible = FALSE; - gSprites[data[15]].invisible = FALSE; - break; - case 4: - sprite->invisible = TRUE; - gSprites[data[14]].invisible = TRUE; - gSprites[data[15]].invisible = TRUE; - data[0] = 4; - return; - } - sprite->data[2]++; -} - -static void sub_802EA50(u8 taskId) -{ - s16 *data = gTasks[taskId].data; - PlaySE(SE_BALL_BOUNCE_1); - gSprites[data[13]].callback = sub_802E938; - gSprites[data[13]].invisible = FALSE; - gTasks[taskId].data[0] = 3; -} - -static void sub_802EAB0(u8 taskId) -{ - u16 packet[6]; - s16 *data = gTasks[taskId].data; - - if (gReceivedRemoteLinkPlayers != 0) - { - if (gRecvCmds[0][1] == LINKCMD_0x7FFF) - data[11] = gRecvCmds[0][2]; - if (GetMultiplayerId() == 0) - { - data[12]++; - memset(packet, 0, sizeof(packet)); - packet[0] = LINKCMD_0x7FFF; - packet[1] = data[12]; - Rfu_SendPacket(packet); - } - } - else - { - data[11]++; - } -} +static const u16 s321Start_Pal[] = INCBIN_U16("graphics/link_games/321start.gbapal"); +static const u32 s321Start_Gfx[] = INCBIN_U32("graphics/link_games/321start.4bpp.lz"); #define tState data[0] #define tTilesTag data[2] @@ -288,7 +387,7 @@ static void sub_802EAB0(u8 taskId) #define tSpriteId2 data[8] #define tSpriteId3 data[9] -void StartMinigameCountdown(s16 tilesTag, s16 palTag, s16 x, s16 y, u8 subpriority) +void StartMinigameCountdown(u16 tilesTag, u16 palTag, s16 x, s16 y, u8 subpriority) { u8 taskId = CreateTask(Task_MinigameCountdown, 80); gTasks[taskId].tTilesTag = tilesTag; @@ -337,69 +436,82 @@ static void Task_MinigameCountdown(u8 taskId) } } +#define sState data[0] +#define sTimer data[2] +#define sAnimNum data[4] + static bool32 RunMinigameCountdownDigitsAnim(u8 spriteId) { struct Sprite *sprite = &gSprites[spriteId]; - switch (sprite->data[0]) + switch (sprite->sState) { case 0: sub_8007E18(sprite, 0x800, 0x1A); - sprite->data[0]++; + sprite->sState++; // fallthrough case 1: - if (sprite->data[2] == 0) + if (sprite->sTimer == 0) PlaySE(SE_BALL_BOUNCE_2); - if (++sprite->data[2] >= 20) + + if (++sprite->sTimer >= 20) { - sprite->data[2] = 0; + // Ready for jump + sprite->sTimer = 0; StartSpriteAffineAnim(sprite, 1); - sprite->data[0]++; + sprite->sState++; } break; case 2: if (sprite->affineAnimEnded) - sprite->data[0]++; + sprite->sState++; break; case 3: - if (++sprite->data[2] >= 4) + if (++sprite->sTimer >= 4) { - sprite->data[2] = 0; - sprite->data[0]++; + // Start jump + sprite->sTimer = 0; + sprite->sState++; StartSpriteAffineAnim(sprite, 2); } break; case 4: + // Moving up from jump sprite->pos1.y -= 4; - if (++sprite->data[2] >= 8) + if (++sprite->sTimer >= 8) { - if (sprite->data[4] <= 1) + if (sprite->sAnimNum < 2) { - StartSpriteAnim(sprite, sprite->data[4] + 1); - sprite->data[2] = 0; - sprite->data[0]++; + // Swap to the next number + StartSpriteAnim(sprite, sprite->sAnimNum + 1); + sprite->sTimer = 0; + sprite->sState++; } else { - sprite->data[0] = 7; + // End + sprite->sState = 7; return FALSE; } } break; case 5: + // Falling after jump sprite->pos1.y += 4; - if (++sprite->data[2] >= 8) + if (++sprite->sTimer >= 8) { - sprite->data[2] = 0; + // Land from jump + sprite->sTimer = 0; StartSpriteAffineAnim(sprite, 3); - sprite->data[0]++; + sprite->sState++; } break; case 6: if (sprite->affineAnimEnded) { - sprite->data[4]++; - sprite->data[0] = 1; + // Restart for next number + sprite->sAnimNum++; + sprite->sState = 1; } break; case 7: @@ -409,6 +521,10 @@ static bool32 RunMinigameCountdownDigitsAnim(u8 spriteId) return TRUE; } +#undef sState +#undef sTimer +#undef sAnimNum + // First argument is unused. static void InitStartGraphic(u8 spriteId1, u8 spriteId2, u8 spriteId3) { @@ -425,60 +541,70 @@ static bool32 IsStartGraphicAnimRunning(u8 spriteId) return gSprites[spriteId].callback == SpriteCB_Start; } +#define sState data[0] +#define sTimer data[1] +#define sYSpeed data[4] +#define sY data[5] + static void SpriteCB_Start(struct Sprite *sprite) { int y; s16 *data = sprite->data; - switch (data[0]) + switch (sState) { case 0: - data[4] = 64; - data[5] = sprite->pos2.y << 4; - data[0]++; + sYSpeed = 64; + sY = sprite->pos2.y << 4; + sState++; case 1: - data[5] += data[4]; - data[4]++; - sprite->pos2.y = data[5] >> 4; + sY += sYSpeed; + sYSpeed++; + sprite->pos2.y = sY >> 4; if (sprite->pos2.y >= 0) { PlaySE(SE_BALL_BOUNCE_2); sprite->pos2.y = 0; - data[0]++; + sState++; } break; case 2: - data[1] += 12; - if (data[1] >= 128) + sTimer += 12; + if (sTimer >= 128) { PlaySE(SE_BALL_BOUNCE_2); - data[1] = 0; - data[0]++; + sTimer = 0; + sState++; } - y = gSineTable[data[1]]; + y = gSineTable[sTimer]; sprite->pos2.y = -(y >> 4); break; case 3: - data[1] += 16; - if (data[1] >= 128) + sTimer += 16; + if (sTimer >= 128) { PlaySE(SE_BALL_BOUNCE_2); - data[1] = 0; - data[0]++; + sTimer = 0; + sState++; } - sprite->pos2.y = -(gSineTable[data[1]] >> 5); + sprite->pos2.y = -(gSineTable[sTimer] >> 5); break; case 4: - if (++data[1] > 40) + if (++sTimer > 40) sprite->callback = SpriteCallbackDummy; break; } } +#undef sState +#undef sTimer +#undef sYSpeed +#undef sY + static void Load321StartGfx(u16 tileTag, u16 palTag) { - struct CompressedSpriteSheet spriteSheet = {sSpriteSheet_321Start, 0xE00, 0}; - struct SpritePalette spritePalette = {sSpritePal_321Start, 0}; + struct CompressedSpriteSheet spriteSheet = {s321Start_Gfx, 0xE00, 0}; + struct SpritePalette spritePalette = {s321Start_Pal, 0}; spriteSheet.tag = tileTag; spritePalette.tag = palTag; @@ -564,26 +690,26 @@ static const union AnimCmd *const sAnimTable_Start[] = sAnim_StartRight }; -static const union AffineAnimCmd sAffineAnim_Numbers_0[] = +static const union AffineAnimCmd sAffineAnim_Numbers_Normal[] = { AFFINEANIMCMD_FRAME(256, 256, 0, 0), AFFINEANIMCMD_END }; -static const union AffineAnimCmd sAffineAnim_Numbers_1[] = +static const union AffineAnimCmd sAffineAnim_Numbers_Squash[] = { AFFINEANIMCMD_FRAME(256, 256, 0, 0), AFFINEANIMCMD_FRAME(16, -16, 0, 8), AFFINEANIMCMD_END }; -static const union AffineAnimCmd sAffineAnim_Numbers_2[] = +static const union AffineAnimCmd sAffineAnim_Numbers_Stretch[] = { AFFINEANIMCMD_FRAME(-18, 18, 0, 8), AFFINEANIMCMD_END }; -static const union AffineAnimCmd sAffineAnim_Numbers_3[] = +static const union AffineAnimCmd sAffineAnim_Numbers_Land[] = { AFFINEANIMCMD_FRAME( 6, -6, 0, 8), AFFINEANIMCMD_FRAME( -4, 4, 0, 8), @@ -593,10 +719,10 @@ static const union AffineAnimCmd sAffineAnim_Numbers_3[] = static const union AffineAnimCmd *const sAffineAnimTable_Numbers[] = { - sAffineAnim_Numbers_0, - sAffineAnim_Numbers_1, - sAffineAnim_Numbers_2, - sAffineAnim_Numbers_3 + sAffineAnim_Numbers_Normal, + sAffineAnim_Numbers_Squash, // Push down before the jump + sAffineAnim_Numbers_Stretch, // Stretch up for the jump + sAffineAnim_Numbers_Land // Land after the jump }; static u8 CreateNumberSprite(u16 tileTag, u16 palTag, s16 x, s16 y, u8 subpriority) diff --git a/src/mirage_tower.c b/src/mirage_tower.c index ef7bf7228..d18ddcc0f 100644 --- a/src/mirage_tower.c +++ b/src/mirage_tower.c @@ -398,7 +398,7 @@ static void DoScreenShake(u8 taskId) static void IncrementCeilingCrumbleFinishedCount(void) { u8 taskId = FindTaskIdByFunc(WaitCeilingCrumble); - if (taskId != 0xFF) + if (taskId != TASK_NONE) gTasks[taskId].data[0]++; } @@ -610,7 +610,7 @@ static void DoMirageTowerDisintegration(u8 taskId) case 4: UnsetBgTilemapBuffer(0); bgShakeTaskId = FindTaskIdByFunc(UpdateBgShake); - if (bgShakeTaskId != 0xFF) + if (bgShakeTaskId != TASK_NONE) DestroyTask(bgShakeTaskId); sBgShakeOffsets->bgVOFS = sBgShakeOffsets->bgHOFS = 0; SetBgShakeOffsets(); diff --git a/src/mon_markings.c b/src/mon_markings.c index a819d4f9a..e71d6d795 100644 --- a/src/mon_markings.c +++ b/src/mon_markings.c @@ -10,20 +10,22 @@ #include "sprite.h" #include "text_window.h" -#define MENU_TEXT_SPRITE_X_OFFSET 32 +#define ANIM_CURSOR (NUM_MON_MARKINGS * 2) +#define ANIM_TEXT (ANIM_CURSOR + 1) -// static functions -static void sub_811FC80(s16, s16, u16, u16); -static void TaskDummy7(struct Sprite *); -static void sub_811FF40(struct Sprite *); -static void sub_811FF7C(struct Sprite *); -static struct Sprite *sub_811FFD4(u16, u16, const u16 *, u16); +#define SELECTION_OK NUM_MON_MARKINGS +#define SELECTION_CANCEL (SELECTION_OK + 1) -// .rodata -static const u16 gUnknown_0859E65C[] = INCBIN_U16("graphics/misc/mon_markings.gbapal"); -static const u8 gUnknown_0859E67C[] = INCBIN_U8("graphics/misc/mon_markings.4bpp"); +static void CreateMonMarkingsMenuSprites(s16, s16, u16, u16); +static void SpriteCB_Dummy(struct Sprite *); +static void SpriteCB_Marking(struct Sprite *); +static void SpriteCB_Cursor(struct Sprite *); +static struct Sprite *CreateMarkingComboSprite(u16, u16, const u16 *, u16); -static const struct OamData gUnknown_0859EE7C = +static const u16 sMonMarkings_Pal[] = INCBIN_U16("graphics/misc/mon_markings.gbapal"); +static const u8 sMonMarkings_Gfx[] = INCBIN_U8("graphics/misc/mon_markings.4bpp"); + +static const struct OamData sOamData_MenuWindow = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -40,7 +42,8 @@ static const struct OamData gUnknown_0859EE7C = .affineParam = 0, }; -static const struct OamData gUnknown_0859EE84 = +// Used for the markings, OK/Cancel text, and cursor sprites +static const struct OamData sOamData_8x8 = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -57,99 +60,99 @@ static const struct OamData gUnknown_0859EE84 = .affineParam = 0, }; -static const union AnimCmd gUnknown_0859EE8C[] = +static const union AnimCmd sAnim_Marking_CircleOff[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EE94[] = +static const union AnimCmd sAnim_Marking_CircleOn[] = { ANIMCMD_FRAME(1, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EE9C[] = +static const union AnimCmd sAnim_Marking_SquareOff[] = { ANIMCMD_FRAME(2, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EEA4[] = +static const union AnimCmd sAnim_Marking_SquareOn[] = { ANIMCMD_FRAME(3, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EEAC[] = +static const union AnimCmd sAnim_Marking_TriangleOff[] = { ANIMCMD_FRAME(4, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EEB4[] = +static const union AnimCmd sAnim_Marking_TriangleOn[] = { ANIMCMD_FRAME(5, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EEBC[] = +static const union AnimCmd sAnim_Marking_HeartOff[] = { ANIMCMD_FRAME(6, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EEC4[] = +static const union AnimCmd sAnim_Marking_HeartOn[] = { ANIMCMD_FRAME(7, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EECC[] = +static const union AnimCmd sAnim_Cursor[] = { ANIMCMD_FRAME(8, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EED4[] = +static const union AnimCmd sAnim_OKCancelText[] = { ANIMCMD_FRAME(9, 5), ANIMCMD_END, }; -static const union AnimCmd *const gUnknown_0859EEDC[] = +static const union AnimCmd *const sAnims_MenuSprite[] = { - gUnknown_0859EE8C, - gUnknown_0859EE94, - gUnknown_0859EE9C, - gUnknown_0859EEA4, - gUnknown_0859EEAC, - gUnknown_0859EEB4, - gUnknown_0859EEBC, - gUnknown_0859EEC4, - gUnknown_0859EECC, - gUnknown_0859EED4, + sAnim_Marking_CircleOff, + sAnim_Marking_CircleOn, + sAnim_Marking_SquareOff, + sAnim_Marking_SquareOn, + sAnim_Marking_TriangleOff, + sAnim_Marking_TriangleOn, + sAnim_Marking_HeartOff, + sAnim_Marking_HeartOn, + [ANIM_CURSOR] = sAnim_Cursor, + [ANIM_TEXT] = sAnim_OKCancelText, }; -static const union AnimCmd gUnknown_0859EF04[] = +static const union AnimCmd sAnim_MenuWindow_UpperHalf[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF0C[] = +static const union AnimCmd sAnim_MenuWindow_LowerHalf[] = { ANIMCMD_FRAME(64, 5), ANIMCMD_END, }; -static const union AnimCmd *const gUnknown_0859EF14[] = +static const union AnimCmd *const sAnims_MenuWindow[] = { - gUnknown_0859EF04, - gUnknown_0859EF0C, + sAnim_MenuWindow_UpperHalf, + sAnim_MenuWindow_LowerHalf, }; -static const struct OamData gUnknown_0859EF1C = +static const struct OamData sOamData_MarkingCombo = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -166,169 +169,166 @@ static const struct OamData gUnknown_0859EF1C = .affineParam = 0, }; -static const union AnimCmd gUnknown_0859EF24[] = +static const union AnimCmd sAnim_MarkingCombo_AllOff[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF2C[] = +static const union AnimCmd sAnim_MarkingCombo_Circle[] = { ANIMCMD_FRAME(4, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF34[] = +static const union AnimCmd sAnim_MarkingCombo_Square[] = { ANIMCMD_FRAME(8, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF3C[] = +static const union AnimCmd sAnim_MarkingCombo_CircleSquare[] = { ANIMCMD_FRAME(12, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF44[] = +static const union AnimCmd sAnim_MarkingCombo_Triangle[] = { ANIMCMD_FRAME(16, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF4C[] = +static const union AnimCmd sAnim_MarkingCombo_CircleTriangle[] = { ANIMCMD_FRAME(20, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF54[] = +static const union AnimCmd sAnim_MarkingCombo_SquareTriangle[] = { ANIMCMD_FRAME(24, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF5C[] = +static const union AnimCmd sAnim_MarkingCombo_CircleSquareTriangle[] = { ANIMCMD_FRAME(28, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF64[] = +static const union AnimCmd sAnim_MarkingCombo_Heart[] = { ANIMCMD_FRAME(32, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF6C[] = +static const union AnimCmd sAnim_MarkingCombo_CircleHeart[] = { ANIMCMD_FRAME(36, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF74[] = +static const union AnimCmd sAnim_MarkingCombo_SquareHeart[] = { ANIMCMD_FRAME(40, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF7C[] = +static const union AnimCmd sAnim_MarkingCombo_CircleSquareHeart[] = { ANIMCMD_FRAME(44, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF84[] = +static const union AnimCmd sAnim_MarkingCombo_TriangleHeart[] = { ANIMCMD_FRAME(48, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF8C[] = +static const union AnimCmd sAnim_MarkingCombo_CircleTriangleHeart[] = { ANIMCMD_FRAME(52, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF94[] = +static const union AnimCmd sAnim_MarkingCombo_SquareTriangleHeart[] = { ANIMCMD_FRAME(56, 5), ANIMCMD_END, }; -static const union AnimCmd gUnknown_0859EF9C[] = +static const union AnimCmd sAnim_MarkingCombo_AllOn[] = { ANIMCMD_FRAME(60, 5), ANIMCMD_END, }; -static const union AnimCmd *const gUnknown_0859EFA4[] = +static const union AnimCmd *const sAnims_MarkingCombo[] = { - gUnknown_0859EF24, - gUnknown_0859EF2C, - gUnknown_0859EF34, - gUnknown_0859EF3C, - gUnknown_0859EF44, - gUnknown_0859EF4C, - gUnknown_0859EF54, - gUnknown_0859EF5C, - gUnknown_0859EF64, - gUnknown_0859EF6C, - gUnknown_0859EF74, - gUnknown_0859EF7C, - gUnknown_0859EF84, - gUnknown_0859EF8C, - gUnknown_0859EF94, - gUnknown_0859EF9C, + sAnim_MarkingCombo_AllOff, + sAnim_MarkingCombo_Circle, + sAnim_MarkingCombo_Square, + sAnim_MarkingCombo_CircleSquare, + sAnim_MarkingCombo_Triangle, + sAnim_MarkingCombo_CircleTriangle, + sAnim_MarkingCombo_SquareTriangle, + sAnim_MarkingCombo_CircleSquareTriangle, + sAnim_MarkingCombo_Heart, + sAnim_MarkingCombo_CircleHeart, + sAnim_MarkingCombo_SquareHeart, + sAnim_MarkingCombo_CircleSquareHeart, + sAnim_MarkingCombo_TriangleHeart, + sAnim_MarkingCombo_CircleTriangleHeart, + sAnim_MarkingCombo_SquareTriangleHeart, + sAnim_MarkingCombo_AllOn, }; -static EWRAM_DATA struct PokemonMarkMenu *sMenu = NULL; +static EWRAM_DATA struct MonMarkingsMenu *sMenu = NULL; -void sub_811F90C(struct PokemonMarkMenu *ptr) +void InitMonMarkingsMenu(struct MonMarkingsMenu *ptr) { sMenu = ptr; } -void sub_811F918(void) +static void BufferMenuWindowTiles(void) { const struct TilesPal *frame = GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType); sMenu->frameTiles = frame->tiles; sMenu->framePalette = frame->pal; sMenu->tileLoadState = 0; - CpuFill16(0, sMenu->menuWindowSpriteTiles, sizeof(sMenu->menuWindowSpriteTiles)); + CpuFill16(0, sMenu->windowSpriteTiles, sizeof(sMenu->windowSpriteTiles)); } -bool8 sub_811F960(void) +static bool8 BufferMenuFrameTiles(void) { u16 i; - u8 *dest = sMenu->menuWindowSpriteTiles + sMenu->tileLoadState * 0x100; + u8 *dest = sMenu->windowSpriteTiles + sMenu->tileLoadState * 0x100; switch (sMenu->tileLoadState) { case 0: CpuFastCopy(sMenu->frameTiles, dest, TILE_SIZE_4BPP); for (i = 0; i < 6; i++) - { CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP, dest + TILE_SIZE_4BPP * (i + 1), TILE_SIZE_4BPP); - } + CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP * 2, dest + TILE_SIZE_4BPP * 7, TILE_SIZE_4BPP); sMenu->tileLoadState++; break; default: CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP * 3, dest, TILE_SIZE_4BPP); for (i = 0; i < 6; i++) - { CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP * 4, dest + TILE_SIZE_4BPP * (i + 1), TILE_SIZE_4BPP); - } + CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP * 5, dest + TILE_SIZE_4BPP * 7, TILE_SIZE_4BPP); sMenu->tileLoadState++; break; case 13: CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP * 6, dest, TILE_SIZE_4BPP); for (i = 0; i < 6; i++) - { CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP * 7, dest + TILE_SIZE_4BPP * (i + 1), TILE_SIZE_4BPP); - } + CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP * 8, dest + TILE_SIZE_4BPP * 7, TILE_SIZE_4BPP); sMenu->tileLoadState++; return FALSE; @@ -339,23 +339,23 @@ bool8 sub_811F960(void) return TRUE; } -void sub_811FA90(void) +void BufferMonMarkingsMenuTiles(void) { - sub_811F918(); - while (sub_811F960()); + BufferMenuWindowTiles(); + while (BufferMenuFrameTiles()); } -void sub_811FAA4(u8 markings, s16 x, s16 y) +void OpenMonMarkingsMenu(u8 markings, s16 x, s16 y) { u16 i; sMenu->cursorPos = 0; sMenu->markings = markings; for (i = 0; i < NUM_MON_MARKINGS; i++) sMenu->markingsArray[i] = (sMenu->markings >> i) & 1; - sub_811FC80(x, y, sMenu->baseTileTag, sMenu->basePaletteTag); + CreateMonMarkingsMenuSprites(x, y, sMenu->baseTileTag, sMenu->basePaletteTag); } -void sub_811FAF8(void) +void FreeMonMarkingsMenu(void) { u16 i; @@ -364,33 +364,33 @@ void sub_811FAF8(void) FreeSpriteTilesByTag(sMenu->baseTileTag + i); FreeSpritePaletteByTag(sMenu->basePaletteTag + i); } - for (i = 0; i < 2; i++) + for (i = 0; i < ARRAY_COUNT(sMenu->windowSprites); i++) { - if (!sMenu->menuWindowSprites[i]) + if (!sMenu->windowSprites[i]) return; - DestroySprite(sMenu->menuWindowSprites[i]); - sMenu->menuWindowSprites[i] = NULL; + DestroySprite(sMenu->windowSprites[i]); + sMenu->windowSprites[i] = NULL; } for (i = 0; i < NUM_MON_MARKINGS; i++) { - if (!sMenu->menuMarkingSprites[i]) + if (!sMenu->markingSprites[i]) return; - DestroySprite(sMenu->menuMarkingSprites[i]); - sMenu->menuMarkingSprites[i] = NULL; + DestroySprite(sMenu->markingSprites[i]); + sMenu->markingSprites[i] = NULL; } - if (sMenu->unkSprite) + if (sMenu->cursorSprite) { - DestroySprite(sMenu->unkSprite); - sMenu->unkSprite = NULL; + DestroySprite(sMenu->cursorSprite); + sMenu->cursorSprite = NULL; } - if (sMenu->menuTextSprite) + if (sMenu->textSprite) { - DestroySprite(sMenu->menuTextSprite); - sMenu->menuTextSprite = NULL; + DestroySprite(sMenu->textSprite); + sMenu->textSprite = NULL; } } -bool8 MonMarkingsMenuHandleInput(void) +bool8 HandleMonMarkingsMenuInput(void) { u16 i; @@ -400,7 +400,7 @@ bool8 MonMarkingsMenuHandleInput(void) PlaySE(SE_SELECT); pos = --sMenu->cursorPos; if (pos < 0) - sMenu->cursorPos = 5; + sMenu->cursorPos = SELECTION_CANCEL; return TRUE; } @@ -409,7 +409,7 @@ bool8 MonMarkingsMenuHandleInput(void) s8 pos; PlaySE(SE_SELECT); pos = ++sMenu->cursorPos; - if (pos > 5) + if (pos > SELECTION_CANCEL) sMenu->cursorPos = 0; return TRUE; } @@ -420,12 +420,12 @@ bool8 MonMarkingsMenuHandleInput(void) switch (sMenu->cursorPos) { - case 4: + case SELECTION_OK: sMenu->markings = 0; for (i = 0; i < NUM_MON_MARKINGS; i++) sMenu->markings |= sMenu->markingsArray[i] << i; return FALSE; - case 5: + case SELECTION_CANCEL: return FALSE; } @@ -442,170 +442,181 @@ bool8 MonMarkingsMenuHandleInput(void) return TRUE; } -static void sub_811FC80(s16 x, s16 y, u16 baseTileTag, u16 basePaletteTag) +#define sMarkingId data[0] +#define sCursorYOffset data[0] + +static void CreateMonMarkingsMenuSprites(s16 x, s16 y, u16 baseTileTag, u16 basePaletteTag) { u16 i; u8 spriteId; struct SpriteSheet sheets[] = { - { sMenu->menuWindowSpriteTiles, 0x1000, baseTileTag }, - { gPokenavConditionMarker_Gfx, 0x320, baseTileTag + 1 }, - { NULL, 0 } + { sMenu->windowSpriteTiles, 0x1000, baseTileTag }, + { gMonMarkingsMenu_Gfx, 0x320, baseTileTag + 1 }, + {} }; struct SpritePalette palettes[] = { { sMenu->framePalette, basePaletteTag }, - { gPokenavConditionMarker_Pal, basePaletteTag + 1}, - { NULL, 0 } + { gMonMarkingsMenu_Pal, basePaletteTag + 1}, + {} }; - struct SpriteTemplate sprTemplate = + struct SpriteTemplate template = { - baseTileTag, - basePaletteTag, - &gUnknown_0859EE7C, - gUnknown_0859EF14, - NULL, - gDummySpriteAffineAnimTable, - TaskDummy7, + .tileTag = baseTileTag, + .paletteTag = basePaletteTag, + .oam = &sOamData_MenuWindow, + .anims = sAnims_MenuWindow, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_Dummy, }; LoadSpriteSheets(sheets); LoadSpritePalettes(palettes); - for (i = 0; i < 2; i++) + // Create window sprites + for (i = 0; i < ARRAY_COUNT(sMenu->windowSprites); i++) { - spriteId = CreateSprite(&sprTemplate, x + 32, y + 32, 1); + spriteId = CreateSprite(&template, x + 32, y + 32, 1); if (spriteId != MAX_SPRITES) { - sMenu->menuWindowSprites[i] = &gSprites[spriteId]; + sMenu->windowSprites[i] = &gSprites[spriteId]; StartSpriteAnim(&gSprites[spriteId], i); } else { - sMenu->menuWindowSprites[i] = NULL; + sMenu->windowSprites[i] = NULL; return; } } + sMenu->windowSprites[1]->pos1.y = y + 96; - sMenu->menuWindowSprites[1]->pos1.y = y + 96; - - sprTemplate.tileTag++; - sprTemplate.paletteTag++; - sprTemplate.anims = gUnknown_0859EEDC; - sprTemplate.callback = sub_811FF40; - sprTemplate.oam = &gUnknown_0859EE84; + // Create marking sprites + template.tileTag++; + template.paletteTag++; + template.anims = sAnims_MenuSprite; + template.callback = SpriteCB_Marking; + template.oam = &sOamData_8x8; for (i = 0; i < NUM_MON_MARKINGS; i++) { - spriteId = CreateSprite(&sprTemplate, x + 32, y + 16 + 16 * i, 0); + spriteId = CreateSprite(&template, x + 32, y + 16 + 16 * i, 0); if (spriteId != MAX_SPRITES) { - sMenu->menuMarkingSprites[i] = &gSprites[spriteId]; - gSprites[spriteId].data[0] = i; + sMenu->markingSprites[i] = &gSprites[spriteId]; + gSprites[spriteId].sMarkingId = i; } else { - sMenu->menuMarkingSprites[i] = NULL; + sMenu->markingSprites[i] = NULL; return; } } - sprTemplate.callback = SpriteCallbackDummy; - - spriteId = CreateSprite(&sprTemplate, 0, 0, 0); - + // Create OK/Cancel text sprite + template.callback = SpriteCallbackDummy; + spriteId = CreateSprite(&template, 0, 0, 0); if (spriteId != MAX_SPRITES) { - sMenu->menuTextSprite = &gSprites[spriteId]; - sMenu->menuTextSprite->oam.shape = SPRITE_SHAPE(32x32); - sMenu->menuTextSprite->oam.size = SPRITE_SIZE(32x32); - StartSpriteAnim(sMenu->menuTextSprite, 9); - sMenu->menuTextSprite->pos1.x = x + MENU_TEXT_SPRITE_X_OFFSET; - sMenu->menuTextSprite->pos1.y = y + 80; - CalcCenterToCornerVec(sMenu->menuTextSprite, SPRITE_SHAPE(32x16), SPRITE_SIZE(32x16), ST_OAM_AFFINE_OFF); + sMenu->textSprite = &gSprites[spriteId]; + sMenu->textSprite->oam.shape = SPRITE_SHAPE(32x32); + sMenu->textSprite->oam.size = SPRITE_SIZE(32x32); + StartSpriteAnim(sMenu->textSprite, ANIM_TEXT); + sMenu->textSprite->pos1.x = x + 32; + sMenu->textSprite->pos1.y = y + 80; + CalcCenterToCornerVec(sMenu->textSprite, SPRITE_SHAPE(32x16), SPRITE_SIZE(32x16), ST_OAM_AFFINE_OFF); } else { - sMenu->menuTextSprite = NULL; + sMenu->textSprite = NULL; } - sprTemplate.callback = sub_811FF7C; - spriteId = CreateSprite(&sprTemplate, x + 12, 0, 0); + // Create cursor sprite + template.callback = SpriteCB_Cursor; + spriteId = CreateSprite(&template, x + 12, 0, 0); if (spriteId != MAX_SPRITES) { - sMenu->unkSprite = &gSprites[spriteId]; - sMenu->unkSprite->data[0] = y + 16; - StartSpriteAnim(sMenu->unkSprite, 8); + sMenu->cursorSprite = &gSprites[spriteId]; + sMenu->cursorSprite->sCursorYOffset = y + 16; + StartSpriteAnim(sMenu->cursorSprite, ANIM_CURSOR); } else { - sMenu->unkSprite = NULL; + sMenu->cursorSprite = NULL; } } -static void TaskDummy7(struct Sprite *sprite) +static void SpriteCB_Dummy(struct Sprite *sprite) { } -static void sub_811FF40(struct Sprite *sprite) +static void SpriteCB_Marking(struct Sprite *sprite) { - if (sMenu->markingsArray[sprite->data[0]]) - StartSpriteAnim(sprite, 2 * sprite->data[0] + 1); + if (sMenu->markingsArray[sprite->sMarkingId]) + StartSpriteAnim(sprite, 2 * sprite->sMarkingId + 1); // Set marking 'on' else - StartSpriteAnim(sprite, 2 * sprite->data[0]); + StartSpriteAnim(sprite, 2 * sprite->sMarkingId); // Set marking 'off' } -static void sub_811FF7C(struct Sprite *sprite) +#undef sMarkingId + +static void SpriteCB_Cursor(struct Sprite *sprite) { - sprite->pos1.y = (16 * sMenu->cursorPos) + sprite->data[0]; + sprite->pos1.y = (16 * sMenu->cursorPos) + sprite->sCursorYOffset; } -struct Sprite *CreateMonMarkingsSpriteWithPal(u16 tileTag, u16 paletteTag, const u16 *palette) +#undef sCursorYOffset + +// Creates a mon marking combination sprite with a spritesheet that holds every possible combination, used by the summary screen / Pokénav +struct Sprite *CreateMonMarkingAllCombosSprite(u16 tileTag, u16 paletteTag, const u16 *palette) { if (!palette) - palette = gUnknown_0859E65C; - return sub_811FFD4(tileTag, paletteTag, palette, 16); + palette = sMonMarkings_Pal; + return CreateMarkingComboSprite(tileTag, paletteTag, palette, 1 << NUM_MON_MARKINGS); } -struct Sprite *sub_811FFB4(u16 tileTag, u16 paletteTag, const u16 *palette) +// Creates a mon marking combination sprite with a spritesheet that holds only one combination, used for the currently selected PC mon +struct Sprite *CreateMonMarkingComboSprite(u16 tileTag, u16 paletteTag, const u16 *palette) { if (!palette) - palette = gUnknown_0859E65C; - return sub_811FFD4(tileTag, paletteTag, palette, 1); + palette = sMonMarkings_Pal; + return CreateMarkingComboSprite(tileTag, paletteTag, palette, 1); } -static struct Sprite *sub_811FFD4(u16 tileTag, u16 paletteTag, const u16 *palette, u16 size) +static struct Sprite *CreateMarkingComboSprite(u16 tileTag, u16 paletteTag, const u16 *palette, u16 size) { u8 spriteId; - struct SpriteTemplate sprTemplate; - struct SpriteSheet sheet = { gUnknown_0859E67C, 0x80, tileTag }; + struct SpriteTemplate template; + struct SpriteSheet sheet = { sMonMarkings_Gfx, 0x80, tileTag }; struct SpritePalette sprPalette = { palette, paletteTag }; - sprTemplate.tileTag = tileTag; - sprTemplate.paletteTag = paletteTag; - sprTemplate.oam = &gUnknown_0859EF1C; - sprTemplate.anims = gUnknown_0859EFA4; - sprTemplate.images = NULL; - sprTemplate.affineAnims = gDummySpriteAffineAnimTable; - sprTemplate.callback = TaskDummy7; + template.tileTag = tileTag; + template.paletteTag = paletteTag; + template.oam = &sOamData_MarkingCombo; + template.anims = sAnims_MarkingCombo; + template.images = NULL; + template.affineAnims = gDummySpriteAffineAnimTable; + template.callback = SpriteCB_Dummy; sheet.size = size * 0x80; LoadSpriteSheet(&sheet); LoadSpritePalette(&sprPalette); - spriteId = CreateSprite(&sprTemplate, 0, 0, 0); + spriteId = CreateSprite(&template, 0, 0, 0); if (spriteId != MAX_SPRITES) return &gSprites[spriteId]; else return NULL; } -void sub_8120084(u8 markings, void *dest) +// Update what combination is shown, used for sprites created with CreateMonMarkingComboSprite +void UpdateMonMarkingTiles(u8 markings, void *dest) { - RequestDma3Copy(gUnknown_0859E67C + markings * 0x80, dest, 0x80, 0x10); + RequestDma3Copy(&sMonMarkings_Gfx[markings * 0x80], dest, 0x80, 0x10); } diff --git a/src/move_relearner.c b/src/move_relearner.c index cd4da5835..9fa7bf11c 100644 --- a/src/move_relearner.c +++ b/src/move_relearner.c @@ -368,7 +368,7 @@ void TeachMoveRelearnerMove(void) ScriptContext2_Enable(); CreateTask(Task_WaitForFadeOut, 10); // Fade to black - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); } static void Task_WaitForFadeOut(u8 taskId) @@ -472,7 +472,7 @@ static void DoMoveRelearnerMain(void) case MENU_STATE_FADE_TO_BLACK: sMoveRelearnerStruct->state++; HideHeartSpritesAndShowTeachMoveText(FALSE); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); break; case MENU_STATE_WAIT_FOR_FADE: if (!gPaletteFade.active) @@ -645,7 +645,7 @@ static void DoMoveRelearnerMain(void) if (!MoveRelearnerRunTextPrinters()) { sMoveRelearnerStruct->state = MENU_STATE_SHOW_MOVE_SUMMARY_SCREEN; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); } break; case MENU_STATE_SHOW_MOVE_SUMMARY_SCREEN: @@ -662,10 +662,10 @@ static void DoMoveRelearnerMain(void) } break; case 22: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); break; case MENU_STATE_FADE_AND_RETURN: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sMoveRelearnerStruct->state++; break; case MENU_STATE_RETURN_TO_FIELD: @@ -676,7 +676,7 @@ static void DoMoveRelearnerMain(void) } break; case MENU_STATE_FADE_FROM_SUMMARY_SCREEN: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); sMoveRelearnerStruct->state++; if (sMoveRelearnerMenuSate.showContestInfo == FALSE) { @@ -844,8 +844,8 @@ static void CreateUISprites(void) { int i; - sMoveRelearnerStruct->moveDisplayArrowTask = 0xFF; - sMoveRelearnerStruct->moveListScrollArrowTask = 0xFF; + sMoveRelearnerStruct->moveDisplayArrowTask = TASK_NONE; + sMoveRelearnerStruct->moveListScrollArrowTask = TASK_NONE; AddScrollArrows(); // These are the appeal hearts. @@ -870,12 +870,12 @@ static void CreateUISprites(void) static void AddScrollArrows(void) { - if (sMoveRelearnerStruct->moveDisplayArrowTask == 0xFF) + if (sMoveRelearnerStruct->moveDisplayArrowTask == TASK_NONE) { sMoveRelearnerStruct->moveDisplayArrowTask = AddScrollIndicatorArrowPair(&sDisplayModeArrowsTemplate, &sMoveRelearnerStruct->scrollOffset); } - if (sMoveRelearnerStruct->moveListScrollArrowTask == 0xFF) + if (sMoveRelearnerStruct->moveListScrollArrowTask == TASK_NONE) { gTempScrollArrowTemplate = sMoveListScrollArrowsTemplate; gTempScrollArrowTemplate.fullyDownThreshold = sMoveRelearnerStruct->numMenuChoices - sMoveRelearnerStruct->numToShowAtOnce; @@ -885,16 +885,16 @@ static void AddScrollArrows(void) static void RemoveScrollArrows(void) { - if (sMoveRelearnerStruct->moveDisplayArrowTask != 0xFF) + if (sMoveRelearnerStruct->moveDisplayArrowTask != TASK_NONE) { RemoveScrollIndicatorArrowPair(sMoveRelearnerStruct->moveDisplayArrowTask); - sMoveRelearnerStruct->moveDisplayArrowTask = 0xFF; + sMoveRelearnerStruct->moveDisplayArrowTask = TASK_NONE; } - if (sMoveRelearnerStruct->moveListScrollArrowTask != 0xFF) + if (sMoveRelearnerStruct->moveListScrollArrowTask != TASK_NONE) { RemoveScrollIndicatorArrowPair(sMoveRelearnerStruct->moveListScrollArrowTask); - sMoveRelearnerStruct->moveListScrollArrowTask = 0xFF; + sMoveRelearnerStruct->moveListScrollArrowTask = TASK_NONE; } } diff --git a/src/mystery_event_menu.c b/src/mystery_event_menu.c index 00dcbf0e3..297883e9c 100644 --- a/src/mystery_event_menu.c +++ b/src/mystery_event_menu.c @@ -138,7 +138,7 @@ static void CB2_MysteryEventMenu(void) PutWindowTilemap(0); CopyWindowToVram(0, 3); ShowBg(0); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); gMain.state++; break; case 1: @@ -281,7 +281,7 @@ static void CB2_MysteryEventMenu(void) } break; case 15: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gMain.state++; break; case 16: diff --git a/src/mystery_event_script.c b/src/mystery_event_script.c index beb1bf45d..176eab7fc 100644 --- a/src/mystery_event_script.c +++ b/src/mystery_event_script.c @@ -325,7 +325,7 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx) } else { - memcpy(&gPlayerParty[5], pokemonPtr, sizeof(struct Pokemon)); + memcpy(&gPlayerParty[PARTY_SIZE - 1], pokemonPtr, sizeof(struct Pokemon)); memcpy(&mail, mailPtr, sizeof(struct MailStruct)); if (species != SPECIES_EGG) @@ -335,9 +335,9 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx) GetSetPokedexFlag(pokedexNum, FLAG_SET_CAUGHT); } - heldItem = GetMonData(&gPlayerParty[5], MON_DATA_HELD_ITEM); + heldItem = GetMonData(&gPlayerParty[PARTY_SIZE - 1], MON_DATA_HELD_ITEM); if (ItemIsMail(heldItem)) - GiveMailToMon2(&gPlayerParty[5], &mail); + GiveMailToMon2(&gPlayerParty[PARTY_SIZE - 1], &mail); CompactPartySlots(); CalculatePlayerPartyCount(); StringExpandPlaceholders(gStringVar4, gText_MysteryGiftSentOver); @@ -350,7 +350,7 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx) bool8 MEScrCmd_addtrainer(struct ScriptContext *ctx) { u32 data = ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]; - memcpy((void*)(gSaveBlock2Ptr) + 0xBEC, (void *)data, 0xBC); + memcpy(&gSaveBlock2Ptr->frontier.ereaderTrainer, (void *)data, sizeof(gSaveBlock2Ptr->frontier.ereaderTrainer)); ValidateEReaderTrainer(); StringExpandPlaceholders(gStringVar4, gText_MysteryGiftNewTrainer); ctx->data[2] = 2; diff --git a/src/naming_screen.c b/src/naming_screen.c index be921078e..a1dfac88e 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -635,8 +635,8 @@ static bool8 MainState_FadeIn(void) CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(3); - BlendPalettes(-1, 16, 0); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BlendPalettes(PALETTES_ALL, 16, 0); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); sNamingScreen->state++; return FALSE; } @@ -690,7 +690,7 @@ static bool8 MainState_PressedOKButton(void) static bool8 MainState_FadeOut(void) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sNamingScreen->state++; return FALSE; } @@ -826,7 +826,7 @@ static void Task_HandlePageSwapAnim(u8 taskId) static bool8 IsPageSwapAnimNotInProgress(void) { - if (FindTaskIdByFunc(Task_HandlePageSwapAnim) == 0xFF) + if (FindTaskIdByFunc(Task_HandlePageSwapAnim) == TASK_NONE) return TRUE; else return FALSE; diff --git a/src/new_game.c b/src/new_game.c index 55a568132..c43c6ae9f 100644 --- a/src/new_game.c +++ b/src/new_game.c @@ -51,7 +51,7 @@ extern const u8 EventScript_ResetAllMapFlags[]; // this file's functions static void ClearFrontierRecord(void); static void WarpToTruck(void); -static void ResetMiniGamesResults(void); +static void ResetMiniGamesRecords(void); // EWRAM vars EWRAM_DATA bool8 gDifferentSaveFile = FALSE; @@ -140,7 +140,7 @@ void Sav2_ClearSetDefault(void) void ResetMenuAndMonGlobals(void) { - gDifferentSaveFile = 0; + gDifferentSaveFile = FALSE; ResetPokedexScrollPositions(); ZeroPlayerPartyMons(); ZeroEnemyPartyMons(); @@ -153,7 +153,7 @@ void NewGameInitData(void) if (gSaveFileStatus == SAVE_STATUS_EMPTY || gSaveFileStatus == SAVE_STATUS_CORRUPT) RtcReset(); - gDifferentSaveFile = 1; + gDifferentSaveFile = TRUE; gSaveBlock2Ptr->encryptionKey = 0; ZeroPlayerPartyMons(); ZeroEnemyPartyMons(); @@ -196,7 +196,7 @@ void NewGameInitData(void) ResetLotteryCorner(); WarpToTruck(); ScriptContext2_RunNewScript(EventScript_ResetAllMapFlags); - ResetMiniGamesResults(); + ResetMiniGamesRecords(); InitUnionRoomChatRegisteredTexts(); InitLilycoveLady(); ResetAllApprenticeData(); @@ -208,10 +208,10 @@ void NewGameInitData(void) ResetContestLinkResults(); } -static void ResetMiniGamesResults(void) +static void ResetMiniGamesRecords(void) { CpuFill16(0, &gSaveBlock2Ptr->berryCrush, sizeof(struct BerryCrush)); SetBerryPowder(&gSaveBlock2Ptr->berryCrush.berryPowderAmount, 0); - ResetPokeJumpResults(); + ResetPokemonJumpRecords(); CpuFill16(0, &gSaveBlock2Ptr->berryPick, sizeof(struct BerryPickingResults)); } diff --git a/src/option_menu.c b/src/option_menu.c index b6440a89c..64e9b6576 100644 --- a/src/option_menu.c +++ b/src/option_menu.c @@ -256,7 +256,7 @@ void CB2_InitOptionMenu(void) break; } case 11: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); SetVBlankCallback(VBlankCB); SetMainCallback2(MainCB2); return; @@ -365,7 +365,7 @@ static void Task_OptionMenuSave(u8 taskId) gSaveBlock2Ptr->optionsButtonMode = gTasks[taskId].data[TD_BUTTONMODE]; gSaveBlock2Ptr->optionsWindowFrameType = gTasks[taskId].data[TD_FRAMETYPE]; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_OptionMenuFadeOut; } diff --git a/src/overworld.c b/src/overworld.c index e135b491d..28fcdad66 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -1136,7 +1136,7 @@ void Overworld_PlaySpecialMapMusic(void) { u16 music = GetCurrLocationDefaultMusic(); - if (music != MUS_ABNORMAL_WEATHER && music != 0xFFFF) + if (music != MUS_ABNORMAL_WEATHER && music != MUS_NONE) { if (gSaveBlock1Ptr->savedMusic) music = gSaveBlock1Ptr->savedMusic; @@ -1166,7 +1166,7 @@ static void TransitionMapMusic(void) { u16 newMusic = GetWarpDestinationMusic(); u16 currentMusic = GetCurrentMapMusic(); - if (newMusic != MUS_ABNORMAL_WEATHER && newMusic != 0xFFFF) + if (newMusic != MUS_ABNORMAL_WEATHER && newMusic != MUS_NONE) { if (currentMusic == MUS_UNDERWATER || currentMusic == MUS_SURF) return; diff --git a/src/palette.c b/src/palette.c index ece753d21..cbaae8da2 100644 --- a/src/palette.c +++ b/src/palette.c @@ -1002,7 +1002,7 @@ static void DestroyBlendPalettesGraduallyTask(void) while (1) { taskId = FindTaskIdByFunc(Task_BlendPalettesGradually); - if (taskId == 0xFF) + if (taskId == TASK_NONE) break; DestroyTask(taskId); } diff --git a/src/party_menu.c b/src/party_menu.c index 52afa425a..1f78c7a99 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -443,7 +443,7 @@ static void InitPartyMenu(u8 menuType, u8 layout, u8 partyAction, bool8 keepCurs for (i = 0; i < ARRAY_COUNT(sPartyMenuInternal->data); i++) sPartyMenuInternal->data[i] = 0; for (i = 0; i < ARRAY_COUNT(sPartyMenuInternal->windowId); i++) - sPartyMenuInternal->windowId[i] = 0xFF; + sPartyMenuInternal->windowId[i] = WINDOW_NONE; if (!keepCursorPos) gPartyMenu.slotId = 0; @@ -589,12 +589,12 @@ static bool8 ShowPartyMenu(void) gMain.state++; break; case 21: - BlendPalettes(0xFFFFFFFF, 16, 0); + BlendPalettes(PALETTES_ALL, 16, 0); gPaletteFade.bufferTransferDisabled = FALSE; gMain.state++; break; case 22: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); gMain.state++; break; default: @@ -607,7 +607,7 @@ static bool8 ShowPartyMenu(void) static void ExitPartyMenu(void) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); CreateTask(Task_ExitPartyMenu, 0); SetVBlankCallback(VBlankCB_PartyMenu); SetMainCallback2(CB2_UpdatePartyMenu); @@ -731,10 +731,10 @@ static void InitPartyMenuBoxes(u8 layout) sPartyMenuBoxes[i].infoRects = &sPartyBoxInfoRects[PARTY_BOX_RIGHT_COLUMN]; sPartyMenuBoxes[i].spriteCoords = sPartyMenuSpriteCoords[layout][i]; sPartyMenuBoxes[i].windowId = i; - sPartyMenuBoxes[i].monSpriteId = 0xFF; - sPartyMenuBoxes[i].itemSpriteId = 0xFF; - sPartyMenuBoxes[i].pokeballSpriteId = 0xFF; - sPartyMenuBoxes[i].statusSpriteId = 0xFF; + sPartyMenuBoxes[i].monSpriteId = SPRITE_NONE; + sPartyMenuBoxes[i].itemSpriteId = SPRITE_NONE; + sPartyMenuBoxes[i].pokeballSpriteId = SPRITE_NONE; + sPartyMenuBoxes[i].statusSpriteId = SPRITE_NONE; } // The first party mon goes in the left column sPartyMenuBoxes[0].infoRects = &sPartyBoxInfoRects[PARTY_BOX_LEFT_COLUMN]; @@ -915,7 +915,7 @@ static bool8 DisplayPartyPokemonDataForMoveTutorOrEvolutionItem(u8 slot) DisplayPartyPokemonDataToTeachMove(slot, item, 0); break; case 2: // Evolution stone - if (!GetMonData(currentPokemon, MON_DATA_IS_EGG) && GetEvolutionTargetSpecies(currentPokemon, 3, item) != SPECIES_NONE) + if (!GetMonData(currentPokemon, MON_DATA_IS_EGG) && GetEvolutionTargetSpecies(currentPokemon, EVO_MODE_ITEM_CHECK, item) != SPECIES_NONE) return FALSE; DisplayPartyPokemonDescriptionData(slot, PARTYBOX_DESC_NO_USE); break; @@ -955,7 +955,7 @@ static void DisplayPartyPokemonDataForMultiBattle(u8 slot) menuBox->infoRects->blitFunc(menuBox->windowId, 0, 0, 0, 0, FALSE); StringCopy(gStringVar1, gMultiPartnerParty[actualSlot].nickname); StringGetEnd10(gStringVar1); - sub_81DB52C(gStringVar1); + ConvertInternationalPlayerName(gStringVar1); DisplayPartyPokemonBarDetail(menuBox->windowId, gStringVar1, 0, menuBox->infoRects->dimensions); DisplayPartyPokemonLevel(gMultiPartnerParty[actualSlot].level, menuBox); DisplayPartyPokemonGender(gMultiPartnerParty[actualSlot].gender, gMultiPartnerParty[actualSlot].species, gMultiPartnerParty[actualSlot].nickname, menuBox); @@ -1148,7 +1148,7 @@ static void SwapPartyPokemon(struct Pokemon *mon1, struct Pokemon *mon2) static void Task_ClosePartyMenu(u8 taskId) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].func = Task_ClosePartyMenuAndSetCB2; } @@ -2371,11 +2371,11 @@ static void DisplayPartyPokemonDescriptionText(u8 stringID, struct PartyMenuBox static void PartyMenuRemoveWindow(u8 *ptr) { - if (*ptr != 0xFF) + if (*ptr != WINDOW_NONE) { ClearStdWindowAndFrameToTransparent(*ptr, 0); RemoveWindow(*ptr); - *ptr = 0xFF; + *ptr = WINDOW_NONE; ScheduleBgCopyTilemapToVram(2); } } @@ -2384,7 +2384,7 @@ void DisplayPartyMenuStdMessage(u32 stringId) { u8 *windowPtr = &sPartyMenuInternal->windowId[1]; - if (*windowPtr != 0xFF) + if (*windowPtr != WINDOW_NONE) PartyMenuRemoveWindow(windowPtr); if (stringId != PARTY_MSG_NONE) @@ -3520,9 +3520,9 @@ static void CursorCb_Register(u8 taskId) { u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2); u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES); - u8 obedience = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_OBEDIENCE); + u8 isEventLegal = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_EVENT_LEGAL); - switch (CanRegisterMonForTradingBoard(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), species2, species, obedience)) + switch (CanRegisterMonForTradingBoard(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), species2, species, isEventLegal)) { case CANT_REGISTER_MON: StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow); @@ -3547,8 +3547,8 @@ static void CursorCb_Trade1(u8 taskId) { u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2); u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES); - u8 obedience = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_OBEDIENCE); - u32 stringId = GetUnionRoomTradeMessageId(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), gPartnerTgtGnameSub, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, obedience); + u8 isEventLegal = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_EVENT_LEGAL); + u32 stringId = GetUnionRoomTradeMessageId(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), gPartnerTgtGnameSub, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, isEventLegal); if (stringId != UR_TRADE_MSG_NONE) { @@ -4904,7 +4904,7 @@ void ItemUseCB_RareCandy(u8 taskId, TaskFunc task) else { gPartyMenuUseExitCallback = TRUE; - PlayFanfareByFanfareNum(0); + PlayFanfareByFanfareNum(FANFARE_LEVEL_UP); UpdateMonDisplayInfoAfterRareCandy(gPartyMenu.slotId, mon); RemoveBagItem(gSpecialVar_ItemId, 1); GetMonNickname(mon, gStringVar1); @@ -5018,13 +5018,13 @@ static void Task_TryLearningNextMove(u8 taskId) static void PartyMenuTryEvolution(u8 taskId) { struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId]; - u16 targetSpecies = GetEvolutionTargetSpecies(mon, 0, 0); + u16 targetSpecies = GetEvolutionTargetSpecies(mon, EVO_MODE_NORMAL, ITEM_NONE); if (targetSpecies != SPECIES_NONE) { FreePartyPointers(); gCB2_AfterEvolution = gPartyMenu.exitCallback; - BeginEvolutionScene(mon, targetSpecies, 1, gPartyMenu.slotId); + BeginEvolutionScene(mon, targetSpecies, TRUE, gPartyMenu.slotId); DestroyTask(taskId); } else @@ -5236,7 +5236,7 @@ u8 GetItemEffectType(u16 item) return ITEM_EFFECT_PP_UP; else if (itemEffect[5] & ITEM5_PP_MAX) return ITEM_EFFECT_PP_MAX; - else if (itemEffect[4] & (ITEM4_HEAL_PP_ALL | ITEM4_HEAL_PP_ONE)) + else if (itemEffect[4] & (ITEM4_HEAL_PP | ITEM4_HEAL_PP_ONE)) return ITEM_EFFECT_HEAL_PP; else return ITEM_EFFECT_NONE; @@ -5701,14 +5701,14 @@ static u8 GetPartyLayoutFromBattleType(void) void OpenPartyMenuInBattle(u8 partyAction) { InitPartyMenu(PARTY_MENU_TYPE_IN_BATTLE, GetPartyLayoutFromBattleType(), partyAction, FALSE, PARTY_MSG_CHOOSE_MON, Task_HandleChooseMonInput, CB2_SetUpReshowBattleScreenAfterMenu); - nullsub_35(); + ReshowBattleScreenDummy(); UpdatePartyToBattleOrder(); } void ChooseMonForInBattleItem(void) { InitPartyMenu(PARTY_MENU_TYPE_IN_BATTLE, GetPartyLayoutFromBattleType(), PARTY_ACTION_USE_ITEM, FALSE, PARTY_MSG_USE_ON_WHICH_MON, Task_HandleChooseMonInput, CB2_ReturnToBagMenu); - nullsub_35(); + ReshowBattleScreenDummy(); UpdatePartyToBattleOrder(); } @@ -5757,7 +5757,7 @@ static bool8 TrySwitchInPokemon(void) StringExpandPlaceholders(gStringVar4, gText_EggCantBattle); return FALSE; } - if (GetPartyIdFromBattleSlot(slot) == gBattleStruct->field_8B) + if (GetPartyIdFromBattleSlot(slot) == gBattleStruct->prevSelectedPartySlot) { GetMonNickname(&gPlayerParty[slot], gStringVar1); StringExpandPlaceholders(gStringVar4, gText_PkmnAlreadySelected); diff --git a/src/player_pc.c b/src/player_pc.c index 1f293a195..a06aad60e 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -398,7 +398,7 @@ static void PlayerPC_Mailbox(u8 taskId) { playerPCItemPageInfo.cursorPos = 0; playerPCItemPageInfo.itemsAbove = 0; - playerPCItemPageInfo.scrollIndicatorId = 0xFF; + playerPCItemPageInfo.scrollIndicatorTaskId = TASK_NONE; Mailbox_UpdateMailList(); ItemStorage_SetItemAndMailCount(taskId); if (sub_81D1C44(playerPCItemPageInfo.count) == TRUE) @@ -554,7 +554,7 @@ static void ItemStorage_WithdrawToss_Helper(u8 taskId, bool8 toss) sub_816B4DC(taskId); playerPCItemPageInfo.cursorPos = 0; playerPCItemPageInfo.itemsAbove = 0; - playerPCItemPageInfo.scrollIndicatorId = 0xFF; + playerPCItemPageInfo.scrollIndicatorTaskId = TASK_NONE; ItemStorage_SetItemAndMailCount(taskId); sub_816BC14(); FreeAndReserveObjectSpritePalettes(); @@ -593,8 +593,8 @@ static u8 GetMailboxMailCount(void) { u8 i, j; - for(i = 0, j = 6; j < 16; j++) - if (gSaveBlock1Ptr->mail[j].itemId != 0) + for(i = 0, j = PARTY_SIZE; j < MAIL_COUNT; j++) + if (gSaveBlock1Ptr->mail[j].itemId != ITEM_NONE) i++; return i; @@ -605,9 +605,9 @@ static void Mailbox_UpdateMailList(void) struct MailStruct mailBuffer; u8 i, j; - for (i=6; i<15; i++) + for (i = PARTY_SIZE; i < MAIL_COUNT - 1; i++) { - for (j=i+1; j<16; j++) + for (j = i + 1; j < MAIL_COUNT; j++) { if (gSaveBlock1Ptr->mail[i].itemId == 0) { @@ -647,7 +647,7 @@ static void Mailbox_ProcessInput(u8 taskId) break; case LIST_CANCEL: PlaySE(SE_SELECT); - RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorId); + RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorTaskId); Mailbox_ReturnToPlayerPC(taskId); break; default: @@ -656,7 +656,7 @@ static void Mailbox_ProcessInput(u8 taskId) sub_81D1D04(1); DestroyListMenuTask(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); ScheduleBgCopyTilemapToVram(0); - RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorId); + RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorTaskId); gTasks[taskId].func = Mailbox_PrintWhatToDoWithPlayerMailText; break; } @@ -665,8 +665,8 @@ static void Mailbox_ProcessInput(u8 taskId) static void Mailbox_PrintWhatToDoWithPlayerMailText(u8 taskId) { - StringCopy(gStringVar1, gSaveBlock1Ptr->mail[playerPCItemPageInfo.itemsAbove + 6 + playerPCItemPageInfo.cursorPos].playerName); - sub_81DB554(gStringVar1, 0); + StringCopy(gStringVar1, gSaveBlock1Ptr->mail[playerPCItemPageInfo.itemsAbove + PARTY_SIZE + playerPCItemPageInfo.cursorPos].playerName); + ConvertInternationalPlayerNameStripChar(gStringVar1, CHAR_SPACE); StringExpandPlaceholders(gStringVar4, gText_WhatToDoWithVar1sMail); DisplayItemMessageOnField(taskId, gStringVar4, Mailbox_PrintMailOptions); } @@ -724,7 +724,7 @@ static void Mailbox_FadeAndReadMail(u8 taskId) { sub_81D1EC0(); CleanupOverworldWindowsAndTilemaps(); - ReadMail(&(gSaveBlock1Ptr->mail[playerPCItemPageInfo.itemsAbove + 6 + playerPCItemPageInfo.cursorPos]), Mailbox_ReturnToFieldFromReadMail, TRUE); + ReadMail(&(gSaveBlock1Ptr->mail[playerPCItemPageInfo.itemsAbove + PARTY_SIZE + playerPCItemPageInfo.cursorPos]), Mailbox_ReturnToFieldFromReadMail, TRUE); DestroyTask(taskId); } } @@ -785,7 +785,7 @@ static void Mailbox_MoveToBagYesNoPrompt(u8 taskId) static void Mailbox_DoMailMoveToBag(u8 taskId) { - struct MailStruct *mailStruct = &(gSaveBlock1Ptr->mail[playerPCItemPageInfo.itemsAbove + 6 + playerPCItemPageInfo.cursorPos]); + struct MailStruct *mailStruct = &(gSaveBlock1Ptr->mail[playerPCItemPageInfo.itemsAbove + PARTY_SIZE + playerPCItemPageInfo.cursorPos]); if (!AddBagItem(mailStruct->itemId, 1)) { DisplayItemMessageOnField(taskId, gText_BagIsFull, Mailbox_Cancel); @@ -874,7 +874,7 @@ static void sub_816BC14(void) gUnknown_0203BCC4 = AllocZeroed(sizeof(struct Struct203BCC4)); memset(gUnknown_0203BCC4->windowIds, 0xFF, 0x6); gUnknown_0203BCC4->unk666 = 0xFF; - gUnknown_0203BCC4->spriteId = 0xFF; + gUnknown_0203BCC4->spriteId = SPRITE_NONE; } static void sub_816BC58(void) @@ -889,7 +889,7 @@ static void sub_816BC58(void) static u8 sub_816BC7C(u8 a) { u8 *windowIdLoc = &(gUnknown_0203BCC4->windowIds[a]); - if (*windowIdLoc == 0xFF) + if (*windowIdLoc == WINDOW_NONE) { *windowIdLoc = AddWindow(&gUnknown_085DFF5C[a]); DrawStdFrameWithCustomTileAndPalette(*windowIdLoc, FALSE, 0x214, 0xE); @@ -901,13 +901,13 @@ static u8 sub_816BC7C(u8 a) static void sub_816BCC4(u8 a) { u8 *windowIdLoc = &(gUnknown_0203BCC4->windowIds[a]); - if (*windowIdLoc != 0xFF) + if (*windowIdLoc != WINDOW_NONE) { ClearStdWindowAndFrameToTransparent(*windowIdLoc, FALSE); ClearWindowTilemap(*windowIdLoc); ScheduleBgCopyTilemapToVram(0); RemoveWindow(*windowIdLoc); - *windowIdLoc = 0xFF; + *windowIdLoc = WINDOW_NONE; } } @@ -983,16 +983,16 @@ static void sub_816BEF0(s32 id) static void ItemStorage_StartScrollIndicator(void) { - if (playerPCItemPageInfo.scrollIndicatorId == 0xFF) - playerPCItemPageInfo.scrollIndicatorId = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 0xB0, 0xC, 0x94, playerPCItemPageInfo.count - playerPCItemPageInfo.pageItems, 0x13F8, 0x13F8, &(playerPCItemPageInfo.itemsAbove)); + if (playerPCItemPageInfo.scrollIndicatorTaskId == TASK_NONE) + playerPCItemPageInfo.scrollIndicatorTaskId = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 0xB0, 0xC, 0x94, playerPCItemPageInfo.count - playerPCItemPageInfo.pageItems, 0x13F8, 0x13F8, &(playerPCItemPageInfo.itemsAbove)); } static void ItemStorage_RemoveScrollIndicator(void) { - if (playerPCItemPageInfo.scrollIndicatorId != 0xFF) + if (playerPCItemPageInfo.scrollIndicatorTaskId != TASK_NONE) { - RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorId); - playerPCItemPageInfo.scrollIndicatorId = 0xFF; + RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorTaskId); + playerPCItemPageInfo.scrollIndicatorTaskId = TASK_NONE; } } @@ -1015,7 +1015,7 @@ static void sub_816C060(u16 itemId) u8 spriteId; u8* spriteIdLoc = &(gUnknown_0203BCC4->spriteId); - if (*spriteIdLoc == 0xFF) + if (*spriteIdLoc == SPRITE_NONE) { FreeSpriteTilesByTag(0x13F6); FreeSpritePaletteByTag(0x13F6); @@ -1033,12 +1033,12 @@ static void sub_816C060(u16 itemId) static void sub_816C0C8(void) { u8* spriteIdLoc = &(gUnknown_0203BCC4->spriteId); - if (*spriteIdLoc != 0xFF) + if (*spriteIdLoc != SPRITE_NONE) { FreeSpriteTilesByTag(0x13F6); FreeSpritePaletteByTag(0x13F6); DestroySprite(&(gSprites[*spriteIdLoc])); - *spriteIdLoc = 0xFF; + *spriteIdLoc = SPRITE_NONE; } } diff --git a/src/pokeball.c b/src/pokeball.c index bbcedc948..4798c83bd 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -34,13 +34,13 @@ static void sub_8075970(struct Sprite *sprite); static void HandleBallAnimEnd(struct Sprite *sprite); static void sub_8075FB4(struct Sprite *sprite); static void sub_80760F8(struct Sprite *sprite); -static void sub_8076524(struct Sprite *sprite); -static void sub_80765E0(struct Sprite *sprite); -static void sub_80767D4(struct Sprite *sprite); -static void sub_807687C(struct Sprite *sprite); -static void sub_80768F0(struct Sprite *sprite); -static void sub_80769A8(struct Sprite *sprite); -static void sub_80769CC(struct Sprite *sprite); +static void SpriteCB_PokeballReleaseMon(struct Sprite *sprite); +static void SpriteCB_ReleasedMonFlyOut(struct Sprite *sprite); +static void SpriteCB_TradePokeball(struct Sprite *sprite); +static void SpriteCB_TradePokeballSendOff(struct Sprite *sprite); +static void SpriteCB_TradePokeballEnd(struct Sprite *sprite); +static void SpriteCB_HealthboxSlideInDelayed(struct Sprite *sprite); +static void SpriteCB_HealthboxSlideIn(struct Sprite *sprite); static void SpriteCB_HitAnimHealthoxEffect(struct Sprite *sprite); static u16 GetBattlerPokeballItemId(u8 battlerId); @@ -61,34 +61,34 @@ static u16 GetBattlerPokeballItemId(u8 battlerId); const struct CompressedSpriteSheet gBallSpriteSheets[POKEBALL_COUNT] = { - {gInterfaceGfx_PokeBall, 384, GFX_TAG_POKEBALL}, - {gInterfaceGfx_GreatBall, 384, GFX_TAG_GREATBALL}, - {gInterfaceGfx_SafariBall, 384, GFX_TAG_SAFARIBALL}, - {gInterfaceGfx_UltraBall, 384, GFX_TAG_ULTRABALL}, - {gInterfaceGfx_MasterBall, 384, GFX_TAG_MASTERBALL}, - {gInterfaceGfx_NetBall, 384, GFX_TAG_NETBALL}, - {gInterfaceGfx_DiveBall, 384, GFX_TAG_DIVEBALL}, - {gInterfaceGfx_NestBall, 384, GFX_TAG_NESTBALL}, - {gInterfaceGfx_RepeatBall, 384, GFX_TAG_REPEATBALL}, - {gInterfaceGfx_TimerBall, 384, GFX_TAG_TIMERBALL}, - {gInterfaceGfx_LuxuryBall, 384, GFX_TAG_LUXURYBALL}, - {gInterfaceGfx_PremierBall, 384, GFX_TAG_PREMIERBALL}, + [BALL_POKE] = {gInterfaceGfx_PokeBall, 384, GFX_TAG_POKEBALL}, + [BALL_GREAT] = {gInterfaceGfx_GreatBall, 384, GFX_TAG_GREATBALL}, + [BALL_SAFARI] = {gInterfaceGfx_SafariBall, 384, GFX_TAG_SAFARIBALL}, + [BALL_ULTRA] = {gInterfaceGfx_UltraBall, 384, GFX_TAG_ULTRABALL}, + [BALL_MASTER] = {gInterfaceGfx_MasterBall, 384, GFX_TAG_MASTERBALL}, + [BALL_NET] = {gInterfaceGfx_NetBall, 384, GFX_TAG_NETBALL}, + [BALL_DIVE] = {gInterfaceGfx_DiveBall, 384, GFX_TAG_DIVEBALL}, + [BALL_NEST] = {gInterfaceGfx_NestBall, 384, GFX_TAG_NESTBALL}, + [BALL_REPEAT] = {gInterfaceGfx_RepeatBall, 384, GFX_TAG_REPEATBALL}, + [BALL_TIMER] = {gInterfaceGfx_TimerBall, 384, GFX_TAG_TIMERBALL}, + [BALL_LUXURY] = {gInterfaceGfx_LuxuryBall, 384, GFX_TAG_LUXURYBALL}, + [BALL_PREMIER] = {gInterfaceGfx_PremierBall, 384, GFX_TAG_PREMIERBALL}, }; const struct CompressedSpritePalette gBallSpritePalettes[POKEBALL_COUNT] = { - {gInterfacePal_PokeBall, GFX_TAG_POKEBALL}, - {gInterfacePal_GreatBall, GFX_TAG_GREATBALL}, - {gInterfacePal_SafariBall, GFX_TAG_SAFARIBALL}, - {gInterfacePal_UltraBall, GFX_TAG_ULTRABALL}, - {gInterfacePal_MasterBall, GFX_TAG_MASTERBALL}, - {gInterfacePal_NetBall, GFX_TAG_NETBALL}, - {gInterfacePal_DiveBall, GFX_TAG_DIVEBALL}, - {gInterfacePal_NestBall, GFX_TAG_NESTBALL}, - {gInterfacePal_RepeatBall, GFX_TAG_REPEATBALL}, - {gInterfacePal_TimerBall, GFX_TAG_TIMERBALL}, - {gInterfacePal_LuxuryBall, GFX_TAG_LUXURYBALL}, - {gInterfacePal_PremierBall, GFX_TAG_PREMIERBALL}, + [BALL_POKE] = {gInterfacePal_PokeBall, GFX_TAG_POKEBALL}, + [BALL_GREAT] = {gInterfacePal_GreatBall, GFX_TAG_GREATBALL}, + [BALL_SAFARI] = {gInterfacePal_SafariBall, GFX_TAG_SAFARIBALL}, + [BALL_ULTRA] = {gInterfacePal_UltraBall, GFX_TAG_ULTRABALL}, + [BALL_MASTER] = {gInterfacePal_MasterBall, GFX_TAG_MASTERBALL}, + [BALL_NET] = {gInterfacePal_NetBall, GFX_TAG_NETBALL}, + [BALL_DIVE] = {gInterfacePal_DiveBall, GFX_TAG_DIVEBALL}, + [BALL_NEST] = {gInterfacePal_NestBall, GFX_TAG_NESTBALL}, + [BALL_REPEAT] = {gInterfacePal_RepeatBall, GFX_TAG_REPEATBALL}, + [BALL_TIMER] = {gInterfacePal_TimerBall, GFX_TAG_TIMERBALL}, + [BALL_LUXURY] = {gInterfacePal_LuxuryBall, GFX_TAG_LUXURYBALL}, + [BALL_PREMIER] = {gInterfacePal_PremierBall, GFX_TAG_PREMIERBALL}, }; static const struct OamData sBallOamData = @@ -647,7 +647,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId) u16 species = gTasks[taskId].tCryTaskSpecies; u8 battlerId = gTasks[taskId].tCryTaskBattler; u8 monSpriteId = gTasks[taskId].tCryTaskMonSpriteId; - struct Pokemon *mon = (void*)(u32)((gTasks[taskId].tCryTaskMonPtr1 << 0x10) | (u16)(gTasks[taskId].tCryTaskMonPtr2)); + struct Pokemon *mon = (void*)(u32)((gTasks[taskId].tCryTaskMonPtr1 << 16) | (u16)(gTasks[taskId].tCryTaskMonPtr2)); switch (gTasks[taskId].tCryTaskState) { @@ -661,7 +661,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId) PlayCry3(species, pan, 0); else PlayCry3(species, pan, 11); - gBattleSpritesDataPtr->healthBoxesData[battlerId].field_1_x40 = 0; + gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE; DestroyTask(taskId); break; case 2: @@ -677,7 +677,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId) else PlayCry4(species, pan, 12); - gBattleSpritesDataPtr->healthBoxesData[battlerId].field_1_x40 = 0; + gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE; DestroyTask(taskId); } else @@ -716,7 +716,7 @@ static void Task_PlayCryWhenReleasedFromBall(u8 taskId) else PlayCry4(species, pan, 11); - gBattleSpritesDataPtr->healthBoxesData[battlerId].field_1_x40 = 0; + gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = FALSE; DestroyTask(taskId); break; } @@ -752,7 +752,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) } if ((battlerId == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || battlerId == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)) - && IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1) + && IsDoubleBattle() && gBattleSpritesDataPtr->animationData->introAnimActive) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) { @@ -765,14 +765,15 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) } } - if (!IsDoubleBattle() || !gBattleSpritesDataPtr->animationData->field_9_x1) + if (!IsDoubleBattle() || !gBattleSpritesDataPtr->animationData->introAnimActive) wantedCryCase = 0; else if (battlerId == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || battlerId == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)) wantedCryCase = 1; else wantedCryCase = 2; - gBattleSpritesDataPtr->healthBoxesData[battlerId].field_1_x40 = 1; + gBattleSpritesDataPtr->healthBoxesData[battlerId].waitForCry = TRUE; + taskId = CreateTask(Task_PlayCryWhenReleasedFromBall, 3); illusionMon = GetIllusionMonPtr(battlerId); @@ -944,7 +945,7 @@ static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite) sprite->sBattler = sprite->oam.affineParam & 0xFF; sprite->data[0] = 0; - if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1 + if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->introAnimActive && sprite->sBattler == GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT)) sprite->callback = SpriteCB_ReleaseMon2FromBall; else @@ -970,7 +971,7 @@ static void SpriteCB_OpponentMonSendOut(struct Sprite *sprite) if (sprite->data[0] > 15) { sprite->data[0] = 0; - if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1 + if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->introAnimActive && sprite->sBattler == GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT)) sprite->callback = SpriteCB_ReleaseMon2FromBall; else @@ -990,6 +991,7 @@ static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 battlerId, u32 return LaunchBallFadeMonTask(unFadeLater, battlerId, arg2, BALL_POKE); } +// Pokeball in Birch intro, and when receiving via trade void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battlerId, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species) { u8 spriteId; @@ -1011,12 +1013,12 @@ void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battlerId, u8 x, u8 y, gSprites[spriteId].data[3] = h; gSprites[spriteId].data[4] = h >> 0x10; gSprites[spriteId].oam.priority = oamPriority; - gSprites[spriteId].callback = sub_8076524; + gSprites[spriteId].callback = SpriteCB_PokeballReleaseMon; gSprites[monSpriteId].invisible = TRUE; } -static void sub_8076524(struct Sprite *sprite) +static void SpriteCB_PokeballReleaseMon(struct Sprite *sprite) { if (sprite->data[1] == 0) { @@ -1033,7 +1035,7 @@ static void sub_8076524(struct Sprite *sprite) StartSpriteAnim(sprite, 1); AnimateBallOpenParticlesForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r5); sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, r4); - sprite->callback = sub_80765E0; + sprite->callback = SpriteCB_ReleasedMonFlyOut; gSprites[r7].invisible = FALSE; StartSpriteAffineAnim(&gSprites[r7], 1); AnimateSprite(&gSprites[r7]); @@ -1046,7 +1048,7 @@ static void sub_8076524(struct Sprite *sprite) } } -static void sub_80765E0(struct Sprite *sprite) +static void SpriteCB_ReleasedMonFlyOut(struct Sprite *sprite) { bool8 r12 = FALSE; bool8 r6 = FALSE; @@ -1105,16 +1107,16 @@ u8 CreateTradePokeballSprite(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPrior gSprites[spriteId].data[3] = h; gSprites[spriteId].data[4] = h >> 16; gSprites[spriteId].oam.priority = oamPriority; - gSprites[spriteId].callback = sub_80767D4; + gSprites[spriteId].callback = SpriteCB_TradePokeball; return spriteId; } -static void sub_80767D4(struct Sprite *sprite) +static void SpriteCB_TradePokeball(struct Sprite *sprite) { if (sprite->data[1] == 0) { u8 r6; - u8 r7 = sprite->data[0]; + u8 monSpriteId = sprite->data[0]; u8 r8 = sprite->data[2]; u32 r5 = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16); @@ -1126,15 +1128,15 @@ static void sub_80767D4(struct Sprite *sprite) StartSpriteAnim(sprite, 1); AnimateBallOpenParticlesForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r6); sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, r8, r5); - sprite->callback = sub_807687C; + sprite->callback = SpriteCB_TradePokeballSendOff; #ifdef BUGFIX // FIX: If this is used on a sprite that has previously had an affine animation, it will not // play the shrink anim properly due to being paused. Works together with the fix to `sub_817F77C`. - gSprites[r7].affineAnimPaused = FALSE; + gSprites[monSpriteId].affineAnimPaused = FALSE; #endif // BUGFIX - StartSpriteAffineAnim(&gSprites[r7], 2); - AnimateSprite(&gSprites[r7]); - gSprites[r7].data[1] = 0; + StartSpriteAffineAnim(&gSprites[monSpriteId], 2); + AnimateSprite(&gSprites[monSpriteId]); + gSprites[monSpriteId].data[1] = 0; } else { @@ -1142,29 +1144,29 @@ static void sub_80767D4(struct Sprite *sprite) } } -static void sub_807687C(struct Sprite *sprite) +static void SpriteCB_TradePokeballSendOff(struct Sprite *sprite) { - u8 r1; + u8 monSpriteId; sprite->data[5]++; if (sprite->data[5] == 11) PlaySE(SE_BALL_TRADE); - r1 = sprite->data[0]; - if (gSprites[r1].affineAnimEnded) + monSpriteId = sprite->data[0]; + if (gSprites[monSpriteId].affineAnimEnded) { StartSpriteAnim(sprite, 2); - gSprites[r1].invisible = TRUE; + gSprites[monSpriteId].invisible = TRUE; sprite->data[5] = 0; - sprite->callback = sub_80768F0; + sprite->callback = SpriteCB_TradePokeballEnd; } else { - gSprites[r1].data[1] += 96; - gSprites[r1].pos2.y = -gSprites[r1].data[1] >> 8; + gSprites[monSpriteId].data[1] += 96; + gSprites[monSpriteId].pos2.y = -gSprites[monSpriteId].data[1] >> 8; } } -static void sub_80768F0(struct Sprite *sprite) +static void SpriteCB_TradePokeballEnd(struct Sprite *sprite) { if (sprite->animEnded) sprite->callback = SpriteCallbackDummy; @@ -1175,45 +1177,54 @@ static void Unref_DestroySpriteAndFreeResources(struct Sprite *sprite) DestroySpriteAndFreeResources(sprite); } -void sub_8076918(u8 battlerId) +#define sSpeedX data[0] +#define sSpeedY data[1] + +#define sDelayTimer data[1] + +void StartHealthboxSlideIn(u8 battlerId) { struct Sprite *healthboxSprite = &gSprites[gHealthboxSpriteIds[battlerId]]; - healthboxSprite->data[0] = 5; - healthboxSprite->data[1] = 0; + healthboxSprite->sSpeedX = 5; + healthboxSprite->sSpeedY = 0; healthboxSprite->pos2.x = 0x73; healthboxSprite->pos2.y = 0; - healthboxSprite->callback = sub_80769CC; + healthboxSprite->callback = SpriteCB_HealthboxSlideIn; if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) { - healthboxSprite->data[0] = -healthboxSprite->data[0]; - healthboxSprite->data[1] = -healthboxSprite->data[1]; + healthboxSprite->sSpeedX = -healthboxSprite->sSpeedX; + healthboxSprite->sSpeedY = -healthboxSprite->sSpeedY; healthboxSprite->pos2.x = -healthboxSprite->pos2.x; healthboxSprite->pos2.y = -healthboxSprite->pos2.y; } gSprites[healthboxSprite->data[5]].callback(&gSprites[healthboxSprite->data[5]]); if (GetBattlerPosition(battlerId) == B_POSITION_PLAYER_RIGHT) - healthboxSprite->callback = sub_80769A8; + healthboxSprite->callback = SpriteCB_HealthboxSlideInDelayed; } -static void sub_80769A8(struct Sprite *sprite) +static void SpriteCB_HealthboxSlideInDelayed(struct Sprite *sprite) { - sprite->data[1]++; - if (sprite->data[1] == 20) + sprite->sDelayTimer++; + if (sprite->sDelayTimer == 20) { - sprite->data[1] = 0; - sprite->callback = sub_80769CC; + sprite->sDelayTimer = 0; + sprite->callback = SpriteCB_HealthboxSlideIn; } } -static void sub_80769CC(struct Sprite *sprite) +static void SpriteCB_HealthboxSlideIn(struct Sprite *sprite) { - sprite->pos2.x -= sprite->data[0]; - sprite->pos2.y -= sprite->data[1]; + sprite->pos2.x -= sprite->sSpeedX; + sprite->pos2.y -= sprite->sSpeedY; if (sprite->pos2.x == 0 && sprite->pos2.y == 0) sprite->callback = SpriteCallbackDummy; } +#undef sSpeedX +#undef sSpeedY +#undef sDelayTimer + void DoHitAnimHealthboxEffect(u8 battlerId) { u8 spriteId; diff --git a/src/pokeblock.c b/src/pokeblock.c index 0bfb10632..ee546deda 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -29,7 +29,6 @@ #include "task.h" #include "text.h" #include "text_window.h" -#include "constants/berry.h" #include "constants/items.h" #include "constants/songs.h" #include "constants/rgb.h" @@ -433,7 +432,7 @@ void OpenPokeblockCase(u8 caseId, void (*callback)(void)) sPokeblockMenu = Alloc(sizeof(*sPokeblockMenu)); sPokeblockMenu->caseId = caseId; sPokeblockMenu->callbackOnUse = NULL; - sPokeblockMenu->unkTaskId = 0xFF; + sPokeblockMenu->unkTaskId = TASK_NONE; sPokeblockMenu->isSwapping = FALSE; sSavedPokeblockData.callback = callback; @@ -582,11 +581,11 @@ static bool8 InitPokeblockMenu(void) gMain.state++; break; case 17: - BlendPalettes(-1, 0x10, 0); + BlendPalettes(PALETTES_ALL, 0x10, 0); gMain.state++; break; case 18: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); gPaletteFade.bufferTransferDisabled = 0; gMain.state++; break; @@ -899,7 +898,7 @@ static void sub_8136344(void) static void sub_81363BC(void) { - if (sPokeblockMenu->unkTaskId == 0xFF) + if (sPokeblockMenu->unkTaskId == TASK_NONE) { sPokeblockMenu->unkTaskId = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 0xB0, 8, 0x98, sPokeblockMenu->itemsNo - sPokeblockMenu->maxShowed, 0x456, 0x456, &sSavedPokeblockData.lastItemPage); @@ -908,10 +907,10 @@ static void sub_81363BC(void) static void sub_8136418(void) { - if (sPokeblockMenu->unkTaskId != 0xFF) + if (sPokeblockMenu->unkTaskId != TASK_NONE) { RemoveScrollIndicatorArrowPair(sPokeblockMenu->unkTaskId); - sPokeblockMenu->unkTaskId = 0xFF; + sPokeblockMenu->unkTaskId = TASK_NONE; } } @@ -949,7 +948,7 @@ static void sub_8136470(struct Sprite *sprite) static void FadePaletteAndSetTaskToClosePokeblockCase(u8 taskId) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_FreeDataAndExitPokeblockCase; } diff --git a/src/pokeblock_feed.c b/src/pokeblock_feed.c index a930523ce..e5b13e2f6 100644 --- a/src/pokeblock_feed.c +++ b/src/pokeblock_feed.c @@ -587,11 +587,11 @@ static bool8 TransitionToPokeblockFeedScene(void) gMain.state++; break; case 12: - BlendPalettes(-1, 0x10, 0); + BlendPalettes(PALETTES_ALL, 0x10, 0); gMain.state++; break; case 13: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); gPaletteFade.bufferTransferDisabled = 0; gMain.state++; break; @@ -805,7 +805,7 @@ static void Task_ReturnAfterPaletteFade(u8 taskId) static void Task_PaletteFadeToReturn(u8 taskId) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ReturnAfterPaletteFade; } diff --git a/src/pokedex.c b/src/pokedex.c index c0236020e..558c27083 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1689,7 +1689,7 @@ static void Task_HandlePokedexInput(u8 taskId) else if (JOY_NEW(SELECT_BUTTON)) { PlaySE(SE_SELECT); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].tTaskId = LoadSearchMenu(); sPokedexView->screenSwitchState = 0; sPokedexView->pokeBallRotationBackup = sPokedexView->pokeBallRotation; @@ -1702,7 +1702,7 @@ static void Task_HandlePokedexInput(u8 taskId) } else if (JOY_NEW(B_BUTTON)) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ClosePokedex; PlaySE(SE_PC_OFF); } @@ -1756,7 +1756,7 @@ static void Task_HandlePokedexStartMenuInput(u8 taskId) gMain.newKeys |= START_BUTTON; //Exit menu break; case 3: //CLOSE POKEDEX - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ClosePokedex; PlaySE(SE_PC_OFF); break; @@ -1891,7 +1891,7 @@ static void Task_HandleSearchResultsInput(u8 taskId) } else if (JOY_NEW(SELECT_BUTTON)) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].tTaskId = LoadSearchMenu(); sPokedexView->screenSwitchState = 0; gTasks[taskId].func = Task_WaitForExitSearch; @@ -1900,7 +1900,7 @@ static void Task_HandleSearchResultsInput(u8 taskId) } else if (JOY_NEW(B_BUTTON)) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ReturnToPokedexFromSearchResults; PlaySE(SE_PC_OFF); } @@ -1953,12 +1953,12 @@ static void Task_HandleSearchResultsStartMenuInput(u8 taskId) gMain.newKeys |= START_BUTTON; break; case 3: //BACK TO POKEDEX - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ReturnToPokedexFromSearchResults; PlaySE(SE_TRUCK_DOOR); break; case 4: //CLOSE POKEDEX - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ClosePokedexFromSearchResultsStartMenu; PlaySE(SE_PC_OFF); break; @@ -2104,7 +2104,7 @@ static bool8 LoadPokedexListPage(u8 page) gMain.state++; break; case 4: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); SetVBlankCallback(VBlankCB_Pokedex); gMain.state++; break; @@ -3032,17 +3032,8 @@ static void SpriteCB_PokedexListMonSprite(struct Sprite *sprite) else { u32 var; - sprite->pos2.y = gSineTable[(u8)sprite->data[5]] * 76 / 256; - // UB: possible division by zero -#ifdef UBFIX - if (gSineTable[sprite->data[5] + 64] != 0) - var = 0x10000 / gSineTable[sprite->data[5] + 64]; - else - var = 0; -#else - var = 0x10000 / gSineTable[sprite->data[5] + 64]; -#endif //UBFIX + var = SAFE_DIV(0x10000, gSineTable[sprite->data[5] + 64]); if (var > 0xFFFF) var = 0xFFFF; SetOamMatrix(sprite->data[1] + 1, 0x100, 0, 0, var); @@ -3355,14 +3346,14 @@ static void Task_HandleInfoScreenInput(u8 taskId) if (gTasks[taskId].data[0] != 0) { // Scroll up/down - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].func = Task_LoadInfoScreenWaitForFade; PlaySE(SE_DEX_SCROLL); return; } if (JOY_NEW(B_BUTTON)) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].func = Task_ExitInfoScreen; PlaySE(SE_PC_OFF); return; @@ -3372,13 +3363,13 @@ static void Task_HandleInfoScreenInput(u8 taskId) switch (sPokedexView->selectedScreen) { case AREA_SCREEN: - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 16, RGB_BLACK); sPokedexView->screenSwitchState = 1; gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; PlaySE(SE_PIN); break; case CRY_SCREEN: - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK); sPokedexView->screenSwitchState = 2; gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; PlaySE(SE_PIN); @@ -3390,14 +3381,14 @@ static void Task_HandleInfoScreenInput(u8 taskId) } else { - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK); sPokedexView->screenSwitchState = 3; gTasks[taskId].func = Task_SwitchScreensFromInfoScreen; PlaySE(SE_PIN); } break; case CANCEL_SCREEN: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_ExitInfoScreen; PlaySE(SE_PC_OFF); break; @@ -3602,7 +3593,7 @@ static void Task_LoadCryScreen(u8 taskId) } break; case 8: - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0x10, 0, RGB_BLACK); SetVBlankCallback(gPokedexVBlankCB); gMain.state++; break; @@ -3644,7 +3635,7 @@ static void Task_HandleCryScreenInput(u8 taskId) { if (JOY_NEW(B_BUTTON)) { - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK); m4aMPlayContinue(&gMPlayInfo_BGM); sPokedexView->screenSwitchState = 1; gTasks[taskId].func = Task_SwitchScreensFromCryScreen; @@ -3654,7 +3645,7 @@ static void Task_HandleCryScreenInput(u8 taskId) if ((JOY_NEW(DPAD_LEFT)) || ((JOY_NEW(L_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) { - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK); m4aMPlayContinue(&gMPlayInfo_BGM); sPokedexView->screenSwitchState = 2; gTasks[taskId].func = Task_SwitchScreensFromCryScreen; @@ -3670,7 +3661,7 @@ static void Task_HandleCryScreenInput(u8 taskId) } else { - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK); m4aMPlayContinue(&gMPlayInfo_BGM); sPokedexView->screenSwitchState = 3; gTasks[taskId].func = Task_SwitchScreensFromCryScreen; @@ -3786,7 +3777,7 @@ static void Task_LoadSizeScreen(u8 taskId) gMain.state++; break; case 7: - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0x10, 0, RGB_BLACK); SetVBlankCallback(gPokedexVBlankCB); gMain.state++; break; @@ -3816,7 +3807,7 @@ static void Task_HandleSizeScreenInput(u8 taskId) { if (JOY_NEW(B_BUTTON)) { - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK); sPokedexView->screenSwitchState = 1; gTasks[taskId].func = Task_SwitchScreensFromSizeScreen; PlaySE(SE_PC_OFF); @@ -3824,7 +3815,7 @@ static void Task_HandleSizeScreenInput(u8 taskId) else if ((JOY_NEW(DPAD_LEFT)) || ((JOY_NEW(L_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)) { - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 0x10, RGB_BLACK); sPokedexView->screenSwitchState = 2; gTasks[taskId].func = Task_SwitchScreensFromSizeScreen; PlaySE(SE_DEX_PAGE); @@ -3987,7 +3978,7 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId) case 4: spriteId = CreateMonSpriteFromNationalDexNumber(dexNum, 48, 56, 0); gSprites[spriteId].oam.priority = 0; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); SetVBlankCallback(gPokedexVBlankCB); gTasks[taskId].tMonSpriteId = spriteId; gTasks[taskId].tState++; @@ -4016,7 +4007,7 @@ static void Task_HandleCaughtMonPageInput(u8 taskId) { if (JOY_NEW(A_BUTTON | B_BUTTON)) { - BeginNormalPaletteFade(0x0000FFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_BG, 0, 0, 16, RGB_BLACK); gSprites[gTasks[taskId].tMonSpriteId].callback = SpriteCB_SlideCaughtMonToCenter; gTasks[taskId].func = Task_ExitCaughtMonPage; } @@ -4849,7 +4840,7 @@ static void Task_LoadSearchMenu(u8 taskId) gMain.state++; break; case 2: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); gMain.state++; break; case 3: @@ -5219,7 +5210,7 @@ static void Task_HandleSearchParameterInput(u8 taskId) static void Task_ExitSearch(u8 taskId) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].func = Task_ExitSearchWaitForFade; } diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c index b63b00290..f9cf42309 100755 --- a/src/pokedex_area_screen.c +++ b/src/pokedex_area_screen.c @@ -691,7 +691,7 @@ static void Task_ShowPokedexAreaScreen(u8 taskId) CreateAreaUnknownSprites(); break; case 9: - BeginNormalPaletteFade(0xFFFFFFEB, 0, 16, 0, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 16, 0, RGB(0, 0, 0)); break; case 10: SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG0 | BLDCNT_TGT2_ALL); @@ -736,7 +736,7 @@ static void Task_HandlePokedexAreaScreenInput(u8 taskId) return; break; case 2: - BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL & ~(0x14), 0, 0, 16, RGB_BLACK); break; case 3: if (gPaletteFade.active) diff --git a/src/pokemon.c b/src/pokemon.c index d04f78c6e..3c1157b1a 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1350,32 +1350,32 @@ const struct SpindaSpot gSpindaSpotGraphics[] = const s8 gNatureStatTable[NUM_NATURES][NUM_NATURE_STATS] = { - // Atk Def Spd Sp.Atk Sp.Def - { 0, 0, 0, 0, 0}, // Hardy - { +1, -1, 0, 0, 0}, // Lonely - { +1, 0, -1, 0, 0}, // Brave - { +1, 0, 0, -1, 0}, // Adamant - { +1, 0, 0, 0, -1}, // Naughty - { -1, +1, 0, 0, 0}, // Bold - { 0, 0, 0, 0, 0}, // Docile - { 0, +1, -1, 0, 0}, // Relaxed - { 0, +1, 0, -1, 0}, // Impish - { 0, +1, 0, 0, -1}, // Lax - { -1, 0, +1, 0, 0}, // Timid - { 0, -1, +1, 0, 0}, // Hasty - { 0, 0, 0, 0, 0}, // Serious - { 0, 0, +1, -1, 0}, // Jolly - { 0, 0, +1, 0, -1}, // Naive - { -1, 0, 0, +1, 0}, // Modest - { 0, -1, 0, +1, 0}, // Mild - { 0, 0, -1, +1, 0}, // Quiet - { 0, 0, 0, 0, 0}, // Bashful - { 0, 0, 0, +1, -1}, // Rash - { -1, 0, 0, 0, +1}, // Calm - { 0, -1, 0, 0, +1}, // Gentle - { 0, 0, -1, 0, +1}, // Sassy - { 0, 0, 0, -1, +1}, // Careful - { 0, 0, 0, 0, 0}, // Quirky + // Atk Def Spd Sp.Atk Sp.Def + [NATURE_HARDY] = { 0, 0, 0, 0, 0}, + [NATURE_LONELY] = { +1, -1, 0, 0, 0}, + [NATURE_BRAVE] = { +1, 0, -1, 0, 0}, + [NATURE_ADAMANT] = { +1, 0, 0, -1, 0}, + [NATURE_NAUGHTY] = { +1, 0, 0, 0, -1}, + [NATURE_BOLD] = { -1, +1, 0, 0, 0}, + [NATURE_DOCILE] = { 0, 0, 0, 0, 0}, + [NATURE_RELAXED] = { 0, +1, -1, 0, 0}, + [NATURE_IMPISH] = { 0, +1, 0, -1, 0}, + [NATURE_LAX] = { 0, +1, 0, 0, -1}, + [NATURE_TIMID] = { -1, 0, +1, 0, 0}, + [NATURE_HASTY] = { 0, -1, +1, 0, 0}, + [NATURE_SERIOUS] = { 0, 0, 0, 0, 0}, + [NATURE_JOLLY] = { 0, 0, +1, -1, 0}, + [NATURE_NAIVE] = { 0, 0, +1, 0, -1}, + [NATURE_MODEST] = { -1, 0, 0, +1, 0}, + [NATURE_MILD] = { 0, -1, 0, +1, 0}, + [NATURE_QUIET] = { 0, 0, -1, +1, 0}, + [NATURE_BASHFUL] = { 0, 0, 0, 0, 0}, + [NATURE_RASH] = { 0, 0, 0, +1, -1}, + [NATURE_CALM] = { -1, 0, 0, 0, +1}, + [NATURE_GENTLE] = { 0, -1, 0, 0, +1}, + [NATURE_SASSY] = { 0, 0, -1, 0, +1}, + [NATURE_CAREFUL] = { 0, 0, 0, -1, +1}, + [NATURE_QUIRKY] = { 0, 0, 0, 0, 0}, }; #include "data/pokemon/tmhm_learnsets.h" @@ -1918,119 +1918,119 @@ const u16 gLinkPlayerFacilityClasses[NUM_MALE_LINK_FACILITY_CLASSES + NUM_FEMALE FACILITY_CLASS_BEAUTY }; -const struct SpriteTemplate gUnknown_08329D98[MAX_BATTLERS_COUNT] = +const struct SpriteTemplate gBattlerSpriteTemplates[MAX_BATTLERS_COUNT] = { - { // B_POSITION_PLAYER_LEFT + [B_POSITION_PLAYER_LEFT] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, - .images = gUnknown_082FF3A8, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .images = gBattlerPicTable_PlayerLeft, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { // B_POSITION_OPPONENT_LEFT + [B_POSITION_OPPONENT_LEFT] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACA8, + .oam = &gOamData_BattleSpriteOpponentSide, .anims = NULL, - .images = gUnknown_082FF3C8, - .affineAnims = gUnknown_082FF694, + .images = gBattlerPicTable_OpponentLeft, + .affineAnims = gAffineAnims_BattleSpriteOpponentSide, .callback = SpriteCb_WildMon, }, - { // B_POSITION_PLAYER_RIGHT + [B_POSITION_PLAYER_RIGHT] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, - .images = gUnknown_082FF3E8, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .images = gBattlerPicTable_PlayerRight, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { // B_POSITION_OPPONENT_RIGHT + [B_POSITION_OPPONENT_RIGHT] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACA8, + .oam = &gOamData_BattleSpriteOpponentSide, .anims = NULL, - .images = gUnknown_082FF408, - .affineAnims = gUnknown_082FF694, + .images = gBattlerPicTable_OpponentRight, + .affineAnims = gAffineAnims_BattleSpriteOpponentSide, .callback = SpriteCb_WildMon }, }; -static const struct SpriteTemplate gSpriteTemplateTable_TrainerBackSprites[] = +static const struct SpriteTemplate sTrainerBackSpriteTemplates[] = { - { + [TRAINER_BACK_PIC_BRENDAN] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_Brendan, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { + [TRAINER_BACK_PIC_MAY] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_May, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { + [TRAINER_BACK_PIC_RED] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_Red, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { + [TRAINER_BACK_PIC_LEAF] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_Leaf, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { + [TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_RubySapphireBrendan, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { + [TRAINER_BACK_PIC_RUBY_SAPPHIRE_MAY] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_RubySapphireMay, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { + [TRAINER_BACK_PIC_WALLY] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_Wally, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, - { + [TRAINER_BACK_PIC_STEVEN] = { .tileTag = 0xFFFF, .paletteTag = 0, - .oam = &gOamData_831ACB0, + .oam = &gOamData_BattleSpritePlayerSide, .anims = NULL, .images = gTrainerBackPicTable_Steven, - .affineAnims = gUnknown_082FF618, - .callback = sub_8039BB4, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, + .callback = SpriteCB_BattleSpriteStartSlideLeft, }, }; @@ -2600,22 +2600,23 @@ void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerP GetMonData(mon, MON_DATA_NICKNAME, dest->nickname); } -void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId) +void CreateEventLegalMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId) { - bool32 obedient = TRUE; + bool32 isEventLegal = TRUE; CreateMon(mon, species, level, fixedIV, hasFixedPersonality, fixedPersonality, otIdType, fixedOtId); - SetMonData(mon, MON_DATA_OBEDIENCE, &obedient); + SetMonData(mon, MON_DATA_EVENT_LEGAL, &isEventLegal); } -bool8 sub_80688F8(u8 caseId, u8 battlerId) +// If FALSE, should load this game's Deoxys form. If TRUE, should load normal Deoxys form +bool8 ShouldIgnoreDeoxysForm(u8 caseId, u8 battlerId) { switch (caseId) { case 0: default: return FALSE; - case 1: + case 1: // Player's side in battle if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI)) return FALSE; if (!gMain.inBattle) @@ -2625,7 +2626,7 @@ bool8 sub_80688F8(u8 caseId, u8 battlerId) break; case 2: break; - case 3: + case 3: // Summary Screen if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI)) return FALSE; if (!gMain.inBattle) @@ -2635,7 +2636,7 @@ bool8 sub_80688F8(u8 caseId, u8 battlerId) return FALSE; case 4: break; - case 5: + case 5: // In move animation, e.g. in Role Play or Snatch if (gBattleTypeFlags & BATTLE_TYPE_LINK) { if (!gMain.inBattle) @@ -2739,14 +2740,14 @@ u16 GetUnionRoomTrainerClass(void) return gFacilityClassToTrainerClass[gLinkPlayerFacilityClasses[arrId]]; } -void CreateObedientEnemyMon(void) +void CreateEventLegalEnemyMon(void) { s32 species = gSpecialVar_0x8004; s32 level = gSpecialVar_0x8005; s32 itemId = gSpecialVar_0x8006; ZeroEnemyPartyMons(); - CreateObedientMon(&gEnemyParty[0], species, level, USE_RANDOM_IVS, 0, 0, 0, 0); + CreateEventLegalMon(&gEnemyParty[0], species, level, USE_RANDOM_IVS, 0, 0, 0, 0); if (itemId) { u8 heldItem[2]; @@ -2969,7 +2970,7 @@ void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon) u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove) { - u32 retVal = 0; + u32 retVal = MOVE_NONE; u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL); u8 level = GetMonData(mon, MON_DATA_LEVEL, NULL); @@ -2985,7 +2986,7 @@ u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove) { sLearningMoveTableID++; if (gLevelUpLearnsets[species][sLearningMoveTableID].move == LEVEL_UP_END) - return 0; + return MOVE_NONE; } } @@ -3161,7 +3162,7 @@ void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition) else if (gUnknown_020249B4[1]) gMultiuseSpriteTemplate = gUnknown_020249B4[1]->templates[battlerPosition]; else - gMultiuseSpriteTemplate = gUnknown_08329D98[battlerPosition]; + gMultiuseSpriteTemplate = gBattlerSpriteTemplates[battlerPosition]; gMultiuseSpriteTemplate.paletteTag = speciesTag; if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT) @@ -3177,7 +3178,7 @@ void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosit gMultiuseSpriteTemplate.paletteTag = trainerSpriteId; if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT) { - gMultiuseSpriteTemplate = gSpriteTemplateTable_TrainerBackSprites[trainerSpriteId]; + gMultiuseSpriteTemplate = sTrainerBackSpriteTemplates[trainerSpriteId]; gMultiuseSpriteTemplate.anims = gTrainerBackAnimsPtrTable[trainerSpriteId]; } else @@ -3185,7 +3186,7 @@ void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosit if (gMonSpritesGfxPtr != NULL) gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition]; else - gMultiuseSpriteTemplate = gUnknown_08329D98[battlerPosition]; + gMultiuseSpriteTemplate = gBattlerSpriteTemplates[battlerPosition]; gMultiuseSpriteTemplate.anims = gTrainerFrontAnimsPtrTable[trainerSpriteId]; } } @@ -3195,7 +3196,7 @@ void SetMultiuseSpriteTemplateToTrainerFront(u16 arg0, u8 battlerPosition) if (gMonSpritesGfxPtr != NULL) gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition]; else - gMultiuseSpriteTemplate = gUnknown_08329D98[battlerPosition]; + gMultiuseSpriteTemplate = gBattlerSpriteTemplates[battlerPosition]; gMultiuseSpriteTemplate.paletteTag = arg0; gMultiuseSpriteTemplate.anims = gTrainerFrontAnimsPtrTable[arg0]; @@ -3613,32 +3614,32 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data) case MON_DATA_EFFORT_RIBBON: retVal = substruct3->effortRibbon; break; - case MON_DATA_GIFT_RIBBON_1: - retVal = substruct3->giftRibbon1; + case MON_DATA_MARINE_RIBBON: + retVal = substruct3->marineRibbon; break; - case MON_DATA_GIFT_RIBBON_2: - retVal = substruct3->giftRibbon2; + case MON_DATA_LAND_RIBBON: + retVal = substruct3->landRibbon; break; - case MON_DATA_GIFT_RIBBON_3: - retVal = substruct3->giftRibbon3; + case MON_DATA_SKY_RIBBON: + retVal = substruct3->skyRibbon; break; - case MON_DATA_GIFT_RIBBON_4: - retVal = substruct3->giftRibbon4; + case MON_DATA_COUNTRY_RIBBON: + retVal = substruct3->countryRibbon; break; - case MON_DATA_GIFT_RIBBON_5: - retVal = substruct3->giftRibbon5; + case MON_DATA_NATIONAL_RIBBON: + retVal = substruct3->nationalRibbon; break; - case MON_DATA_GIFT_RIBBON_6: - retVal = substruct3->giftRibbon6; + case MON_DATA_EARTH_RIBBON: + retVal = substruct3->earthRibbon; break; - case MON_DATA_GIFT_RIBBON_7: - retVal = substruct3->giftRibbon7; + case MON_DATA_WORLD_RIBBON: + retVal = substruct3->worldRibbon; break; - case MON_DATA_FATEFUL_ENCOUNTER: - retVal = substruct3->fatefulEncounter; + case MON_DATA_UNUSED_RIBBONS: + retVal = substruct3->unusedRibbons; break; - case MON_DATA_OBEDIENCE: - retVal = substruct3->obedient; + case MON_DATA_EVENT_LEGAL: + retVal = substruct3->eventLegal; break; case MON_DATA_SPECIES2: retVal = substruct0->species; @@ -3680,13 +3681,13 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data) retVal += substruct3->victoryRibbon; retVal += substruct3->artistRibbon; retVal += substruct3->effortRibbon; - retVal += substruct3->giftRibbon1; - retVal += substruct3->giftRibbon2; - retVal += substruct3->giftRibbon3; - retVal += substruct3->giftRibbon4; - retVal += substruct3->giftRibbon5; - retVal += substruct3->giftRibbon6; - retVal += substruct3->giftRibbon7; + retVal += substruct3->marineRibbon; + retVal += substruct3->landRibbon; + retVal += substruct3->skyRibbon; + retVal += substruct3->countryRibbon; + retVal += substruct3->nationalRibbon; + retVal += substruct3->earthRibbon; + retVal += substruct3->worldRibbon; } break; case MON_DATA_RIBBONS: @@ -3703,13 +3704,13 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data) | (substruct3->victoryRibbon << 17) | (substruct3->artistRibbon << 18) | (substruct3->effortRibbon << 19) - | (substruct3->giftRibbon1 << 20) - | (substruct3->giftRibbon2 << 21) - | (substruct3->giftRibbon3 << 22) - | (substruct3->giftRibbon4 << 23) - | (substruct3->giftRibbon5 << 24) - | (substruct3->giftRibbon6 << 25) - | (substruct3->giftRibbon7 << 26); + | (substruct3->marineRibbon << 20) + | (substruct3->landRibbon << 21) + | (substruct3->skyRibbon << 22) + | (substruct3->countryRibbon << 23) + | (substruct3->nationalRibbon << 24) + | (substruct3->earthRibbon << 25) + | (substruct3->worldRibbon << 26); } break; default: @@ -3992,32 +3993,32 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg) case MON_DATA_EFFORT_RIBBON: SET8(substruct3->effortRibbon); break; - case MON_DATA_GIFT_RIBBON_1: - SET8(substruct3->giftRibbon1); + case MON_DATA_MARINE_RIBBON: + SET8(substruct3->marineRibbon); break; - case MON_DATA_GIFT_RIBBON_2: - SET8(substruct3->giftRibbon2); + case MON_DATA_LAND_RIBBON: + SET8(substruct3->landRibbon); break; - case MON_DATA_GIFT_RIBBON_3: - SET8(substruct3->giftRibbon3); + case MON_DATA_SKY_RIBBON: + SET8(substruct3->skyRibbon); break; - case MON_DATA_GIFT_RIBBON_4: - SET8(substruct3->giftRibbon4); + case MON_DATA_COUNTRY_RIBBON: + SET8(substruct3->countryRibbon); break; - case MON_DATA_GIFT_RIBBON_5: - SET8(substruct3->giftRibbon5); + case MON_DATA_NATIONAL_RIBBON: + SET8(substruct3->nationalRibbon); break; - case MON_DATA_GIFT_RIBBON_6: - SET8(substruct3->giftRibbon6); + case MON_DATA_EARTH_RIBBON: + SET8(substruct3->earthRibbon); break; - case MON_DATA_GIFT_RIBBON_7: - SET8(substruct3->giftRibbon7); + case MON_DATA_WORLD_RIBBON: + SET8(substruct3->worldRibbon); break; - case MON_DATA_FATEFUL_ENCOUNTER: - SET8(substruct3->fatefulEncounter); + case MON_DATA_UNUSED_RIBBONS: + SET8(substruct3->unusedRibbons); break; - case MON_DATA_OBEDIENCE: - SET8(substruct3->obedient); + case MON_DATA_EVENT_LEGAL: + SET8(substruct3->eventLegal); break; case MON_DATA_IVS: { @@ -4347,29 +4348,56 @@ void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex) bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex) { - return PokemonUseItemEffects(mon, item, partyIndex, moveIndex, 0); + return PokemonUseItemEffects(mon, item, partyIndex, moveIndex, FALSE); } -bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex, u8 e) +#define UPDATE_FRIENDSHIP_FROM_ITEM \ +{ \ + if ((retVal == 0 || friendshipOnly) && !ShouldSkipFriendshipChange() && friendshipChange == 0) \ + { \ + friendshipChange = itemEffect[itemEffectParam]; \ + friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); \ + if (friendshipChange > 0 && holdEffect == HOLD_EFFECT_HAPPINESS_UP) \ + friendship += 150 * friendshipChange / 100; \ + else \ + friendship += friendshipChange; \ + if (friendshipChange > 0) \ + { \ + if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == ITEM_LUXURY_BALL) \ + friendship++; \ + if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == GetCurrentRegionMapSectionId()) \ + friendship++; \ + } \ + if (friendship < 0) \ + friendship = 0; \ + if (friendship > MAX_FRIENDSHIP) \ + friendship = MAX_FRIENDSHIP; \ + SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship); \ + retVal = FALSE; \ + } \ +} + +// Returns TRUE if the item has no effect on the Pokémon, FALSE otherwise +bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex, bool8 usedByAI) { u32 dataUnsigned; s32 dataSigned; s32 friendship; - s32 cmdIndex; + s32 i; bool8 retVal = TRUE; const u8 *itemEffect; - u8 var_3C = 6; - u32 var_38; - s8 var_34 = 0; + u8 itemEffectParam = ITEM_EFFECT_ARG_START; + u32 temp1, temp2; + s8 friendshipChange = 0; u8 holdEffect; - u8 battlerId = 4; - u32 var_28 = 0; + u8 battlerId = MAX_BATTLERS_COUNT; + u32 friendshipOnly = FALSE; u16 heldItem; - u8 r10; - u32 r5; - s8 r2; + u8 effectFlags; + s8 evChange; u16 evCount; + // Get item hold effect heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL); if (heldItem == ITEM_ENIGMA_BERRY) { @@ -4383,19 +4411,20 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov holdEffect = ItemId_GetHoldEffect(heldItem); } + // Get battler id (if relevant) gPotentialItemEffectBattler = gBattlerInMenuId; if (gMain.inBattle) { gActiveBattler = gBattlerInMenuId; - cmdIndex = (GetBattlerSide(gActiveBattler) != B_SIDE_PLAYER); - while (cmdIndex < gBattlersCount) + i = (GetBattlerSide(gActiveBattler) != B_SIDE_PLAYER); + while (i < gBattlersCount) { - if (gBattlerPartyIndexes[cmdIndex] == partyIndex) + if (gBattlerPartyIndexes[i] == partyIndex) { - battlerId = cmdIndex; + battlerId = i; break; } - cmdIndex += 2; + i += 2; } } else @@ -4404,11 +4433,13 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov battlerId = MAX_BATTLERS_COUNT; } + // Skip using the item if it won't do anything if (!ITEM_HAS_EFFECT(item)) return TRUE; if (gItemEffectTable[item - ITEM_POTION] == NULL && item != ITEM_ENIGMA_BERRY) return TRUE; + // Get item effect if (item == ITEM_ENIGMA_BERRY) { if (gMain.inBattle) @@ -4421,93 +4452,107 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov itemEffect = gItemEffectTable[item - ITEM_POTION]; } - for (cmdIndex = 0; cmdIndex < 6; cmdIndex++) + // Do item effect + for (i = 0; i < ITEM_EFFECT_ARG_START; i++) { - switch (cmdIndex) + switch (i) { - // infatuation heal, x attack, sacred ash and dire hit + + // Handle ITEM0 effects (infatuation, Dire Hit, X Attack). ITEM0_SACRED_ASH is handled in party_menu.c case 0: - if ((itemEffect[cmdIndex] & ITEM0_INFATUATION) + // Cure infatuation + if ((itemEffect[i] & ITEM0_INFATUATION) && gMain.inBattle && battlerId != MAX_BATTLERS_COUNT && (gBattleMons[battlerId].status2 & STATUS2_INFATUATION)) { gBattleMons[battlerId].status2 &= ~STATUS2_INFATUATION; retVal = FALSE; } - if ((itemEffect[cmdIndex] & ITEM0_DIRE_HIT) + + // Dire Hit + if ((itemEffect[i] & ITEM0_DIRE_HIT) && !(gBattleMons[gActiveBattler].status2 & STATUS2_FOCUS_ENERGY)) { gBattleMons[gActiveBattler].status2 |= STATUS2_FOCUS_ENERGY; retVal = FALSE; } #ifndef ITEM_EXPANSION - if ((itemEffect[cmdIndex] & ITEM0_X_ATTACK) + // X Attack + if ((itemEffect[i] & ITEM0_X_ATTACK) && gBattleMons[gActiveBattler].statStages[STAT_ATK] < MAX_STAT_STAGE) { if (B_X_ITEMS_BUFF == GEN_7) gBattleMons[gActiveBattler].statStages[STAT_ATK] += 2; else - gBattleMons[gActiveBattler].statStages[STAT_ATK] += itemEffect[cmdIndex] & ITEM0_X_ATTACK; + gBattleMons[gActiveBattler].statStages[STAT_ATK] += itemEffect[i] & ITEM0_X_ATTACK; if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_ATK] = MAX_STAT_STAGE; retVal = FALSE; } #endif break; - // in-battle stat boosting effects + + // Handle ITEM1 effects (in-battle stat boosting effects) #ifndef ITEM_EXPANSION case 1: - if ((itemEffect[cmdIndex] & ITEM1_X_DEFEND) + // X Defend + if ((itemEffect[i] & ITEM1_X_DEFEND) && gBattleMons[gActiveBattler].statStages[STAT_DEF] < MAX_STAT_STAGE) { if (B_X_ITEMS_BUFF == GEN_7) gBattleMons[gActiveBattler].statStages[STAT_DEF] += 2; else - gBattleMons[gActiveBattler].statStages[STAT_DEF] += (itemEffect[cmdIndex] & ITEM1_X_DEFEND) >> 4; + gBattleMons[gActiveBattler].statStages[STAT_DEF] += (itemEffect[i] & ITEM1_X_DEFEND) >> 4; if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_DEF] = MAX_STAT_STAGE; retVal = FALSE; } - if ((itemEffect[cmdIndex] & ITEM1_X_SPEED) + + // X Speed + if ((itemEffect[i] & ITEM1_X_SPEED) && gBattleMons[gActiveBattler].statStages[STAT_SPEED] < MAX_STAT_STAGE) { if (B_X_ITEMS_BUFF == GEN_7) gBattleMons[gActiveBattler].statStages[STAT_SPEED] += 2; else - gBattleMons[gActiveBattler].statStages[STAT_SPEED] += itemEffect[cmdIndex] & ITEM1_X_SPEED; + gBattleMons[gActiveBattler].statStages[STAT_SPEED] += itemEffect[i] & ITEM1_X_SPEED; if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_SPEED] = MAX_STAT_STAGE; retVal = FALSE; } break; - // more stat boosting effects + // Handle ITEM2 effects (more stat boosting effects) case 2: - if ((itemEffect[cmdIndex] & ITEM2_X_ACCURACY) + // X Accuracy + if ((itemEffect[i] & ITEM2_X_ACCURACY) && gBattleMons[gActiveBattler].statStages[STAT_ACC] < MAX_STAT_STAGE) { if (B_X_ITEMS_BUFF == GEN_7) gBattleMons[gActiveBattler].statStages[STAT_ACC] += 2; else - gBattleMons[gActiveBattler].statStages[STAT_ACC] += (itemEffect[cmdIndex] & ITEM2_X_ACCURACY) >> 4; + gBattleMons[gActiveBattler].statStages[STAT_ACC] += (itemEffect[i] & ITEM2_X_ACCURACY) >> 4; if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_ACC] = MAX_STAT_STAGE; retVal = FALSE; } - if ((itemEffect[cmdIndex] & ITEM2_X_SPATK) + + // X Sp Attack + if ((itemEffect[i] & ITEM2_X_SPATK) && gBattleMons[gActiveBattler].statStages[STAT_SPATK] < MAX_STAT_STAGE) { if (B_X_ITEMS_BUFF == GEN_7) gBattleMons[gActiveBattler].statStages[STAT_SPATK] += 2; else - gBattleMons[gActiveBattler].statStages[STAT_SPATK] += itemEffect[cmdIndex] & ITEM2_X_SPATK; + gBattleMons[gActiveBattler].statStages[STAT_SPATK] += itemEffect[i] & ITEM2_X_SPATK; if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_SPATK] = MAX_STAT_STAGE; retVal = FALSE; } break; #else - // in-battle stat boosting effects + // Handle ITEM1 effects (in-battle stat boosting effects) case 1: - if ((itemEffect[cmdIndex] & ITEM1_X_ATTACK) + // X Attack + if ((itemEffect[i] & ITEM1_X_ATTACK) && gBattleMons[gActiveBattler].statStages[STAT_ATK] < MAX_STAT_STAGE) { if (B_X_ITEMS_BUFF == GEN_7) @@ -4518,7 +4563,9 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov gBattleMons[gActiveBattler].statStages[STAT_ATK] = MAX_STAT_STAGE; retVal = FALSE; } - if ((itemEffect[cmdIndex] & ITEM1_X_DEFENSE) + + // X Defense + if ((itemEffect[i] & ITEM1_X_DEFENSE) && gBattleMons[gActiveBattler].statStages[STAT_DEF] < MAX_STAT_STAGE) { if (B_X_ITEMS_BUFF == GEN_7) @@ -4529,7 +4576,9 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov gBattleMons[gActiveBattler].statStages[STAT_DEF] = MAX_STAT_STAGE; retVal = FALSE; } - if ((itemEffect[cmdIndex] & ITEM1_X_SPEED) + + // X Speed + if ((itemEffect[i] & ITEM1_X_SPEED) && gBattleMons[gActiveBattler].statStages[STAT_SPEED] < MAX_STAT_STAGE) { if (B_X_ITEMS_BUFF == GEN_7) @@ -4540,7 +4589,9 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov gBattleMons[gActiveBattler].statStages[STAT_SPEED] = MAX_STAT_STAGE; retVal = FALSE; } - if ((itemEffect[cmdIndex] & ITEM1_X_SPATK) + + // X Sp Attack + if ((itemEffect[i] & ITEM1_X_SPATK) && gBattleMons[gActiveBattler].statStages[STAT_SPATK] < MAX_STAT_STAGE) { if (B_X_ITEMS_BUFF == GEN_7) @@ -4551,7 +4602,9 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov gBattleMons[gActiveBattler].statStages[STAT_SPATK] = MAX_STAT_STAGE; retVal = FALSE; } - if ((itemEffect[cmdIndex] & ITEM1_X_SPDEF) + + // X Sp Defense + if ((itemEffect[i] & ITEM1_X_SPDEF) && gBattleMons[gActiveBattler].statStages[STAT_SPDEF] < MAX_STAT_STAGE) { if (B_X_ITEMS_BUFF == GEN_7) @@ -4562,7 +4615,9 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov gBattleMons[gActiveBattler].statStages[STAT_SPDEF] = MAX_STAT_STAGE; retVal = FALSE; } - if ((itemEffect[cmdIndex] & ITEM1_X_ACCURACY) + + // X Accuracy + if ((itemEffect[i] & ITEM1_X_ACCURACY) && gBattleMons[gActiveBattler].statStages[STAT_ACC] < MAX_STAT_STAGE) { if (B_X_ITEMS_BUFF == GEN_7) @@ -4574,18 +4629,22 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov retVal = FALSE; } break; - // formerly used by the item effects of the X Sp. Atk and the X Accuracy + // Formerly used by the item effects of the X Sp. Atk and the X Accuracy case 2: break; #endif + // Handle ITEM3 effects (Guard Spec, Rare Candy, cure status) case 3: - if ((itemEffect[cmdIndex] & ITEM3_GUARD_SPEC) + // Guard Spec + if ((itemEffect[i] & ITEM3_GUARD_SPEC) && gSideTimers[GetBattlerSide(gActiveBattler)].mistTimer == 0) { gSideTimers[GetBattlerSide(gActiveBattler)].mistTimer = 5; retVal = FALSE; } - if ((itemEffect[cmdIndex] & ITEM3_LEVEL_UP) + + // Rare Candy + if ((itemEffect[i] & ITEM3_LEVEL_UP) && GetMonData(mon, MON_DATA_LEVEL, NULL) != MAX_LEVEL) { dataUnsigned = gExperienceTables[gBaseStats[GetMonData(mon, MON_DATA_SPECIES, NULL)].growthRate][GetMonData(mon, MON_DATA_LEVEL, NULL) + 1]; @@ -4593,106 +4652,120 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov CalculateMonStats(mon); retVal = FALSE; } - if ((itemEffect[cmdIndex] & ITEM3_SLEEP) - && HealStatusConditions(mon, partyIndex, 7, battlerId) == 0) + + // Cure status + if ((itemEffect[i] & ITEM3_SLEEP) + && HealStatusConditions(mon, partyIndex, STATUS1_SLEEP, battlerId) == 0) { - if (battlerId != 4) + if (battlerId != MAX_BATTLERS_COUNT) gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; retVal = FALSE; } - if ((itemEffect[cmdIndex] & ITEM3_POISON) && HealStatusConditions(mon, partyIndex, STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER, battlerId) == 0) + if ((itemEffect[i] & ITEM3_POISON) && HealStatusConditions(mon, partyIndex, STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER, battlerId) == 0) retVal = FALSE; - if ((itemEffect[cmdIndex] & ITEM3_BURN) && HealStatusConditions(mon, partyIndex, STATUS1_BURN, battlerId) == 0) + if ((itemEffect[i] & ITEM3_BURN) && HealStatusConditions(mon, partyIndex, STATUS1_BURN, battlerId) == 0) retVal = FALSE; - if ((itemEffect[cmdIndex] & ITEM3_FREEZE) && HealStatusConditions(mon, partyIndex, STATUS1_FREEZE, battlerId) == 0) + if ((itemEffect[i] & ITEM3_FREEZE) && HealStatusConditions(mon, partyIndex, STATUS1_FREEZE, battlerId) == 0) retVal = FALSE; - if ((itemEffect[cmdIndex] & ITEM3_PARALYSIS) && HealStatusConditions(mon, partyIndex, STATUS1_PARALYSIS, battlerId) == 0) + if ((itemEffect[i] & ITEM3_PARALYSIS) && HealStatusConditions(mon, partyIndex, STATUS1_PARALYSIS, battlerId) == 0) retVal = FALSE; - if ((itemEffect[cmdIndex] & ITEM3_CONFUSION) // heal confusion + if ((itemEffect[i] & ITEM3_CONFUSION) // heal confusion && gMain.inBattle && battlerId != MAX_BATTLERS_COUNT && (gBattleMons[battlerId].status2 & STATUS2_CONFUSION)) { gBattleMons[battlerId].status2 &= ~STATUS2_CONFUSION; retVal = FALSE; } break; - // EV, HP, and PP raising effects + + // Handle ITEM4 effects (Change HP/Atk EVs, HP heal, PP heal, PP up, Revive, and evolution stones) case 4: - r10 = itemEffect[cmdIndex]; - if (r10 & ITEM4_PP_UP) + effectFlags = itemEffect[i]; + + // PP Up + if (effectFlags & ITEM4_PP_UP) { - r10 &= ~ITEM4_PP_UP; + effectFlags &= ~ITEM4_PP_UP; dataUnsigned = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2); - var_38 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex); - if (dataUnsigned <= 2 && var_38 > 4) + temp1 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex); + if (dataUnsigned <= 2 && temp1 > 4) { dataUnsigned = GetMonData(mon, MON_DATA_PP_BONUSES, NULL) + gPPUpAddMask[moveIndex]; SetMonData(mon, MON_DATA_PP_BONUSES, &dataUnsigned); - dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), dataUnsigned, moveIndex) - var_38; + dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), dataUnsigned, moveIndex) - temp1; dataUnsigned = GetMonData(mon, MON_DATA_PP1 + moveIndex, NULL) + dataUnsigned; SetMonData(mon, MON_DATA_PP1 + moveIndex, &dataUnsigned); retVal = FALSE; } } - var_38 = 0; - while (r10 != 0) + temp1 = 0; + + // Loop through and try each of the remaining ITEM4 effects + while (effectFlags != 0) { - if (r10 & 1) + if (effectFlags & 1) { - switch (var_38) + switch (temp1) { - case 0: - case 1: - // ev raise + case 0: // ITEM4_EV_HP + case 1: // ITEM4_EV_ATK evCount = GetMonEVCount(mon); - r5 = itemEffect[var_3C]; - dataSigned = GetMonData(mon, sGetMonDataEVConstants[var_38], NULL); - r2 = r5; - if (r2 > 0) + temp2 = itemEffect[itemEffectParam]; + dataSigned = GetMonData(mon, sGetMonDataEVConstants[temp1], NULL); + evChange = temp2; + + if (evChange > 0) // Increasing EV (HP or Atk) { + // Has EV increase limit already been reached? if (evCount >= MAX_TOTAL_EVS) return TRUE; if (dataSigned >= EV_ITEM_RAISE_LIMIT) break; - if (dataSigned + r2 > EV_ITEM_RAISE_LIMIT) - r5 = EV_ITEM_RAISE_LIMIT - (dataSigned + r2) + r2; + // Limit the increase + if (dataSigned + evChange > EV_ITEM_RAISE_LIMIT) + temp2 = EV_ITEM_RAISE_LIMIT - (dataSigned + evChange) + evChange; else - r5 = r2; + temp2 = evChange; - if (evCount + r5 > MAX_TOTAL_EVS) - r5 += MAX_TOTAL_EVS - (evCount + r5); - dataSigned += r5; + if (evCount + temp2 > MAX_TOTAL_EVS) + temp2 += MAX_TOTAL_EVS - (evCount + temp2); + + dataSigned += temp2; } - else + else // Decreasing EV (HP or Atk) { if (dataSigned == 0) { - var_28 = 1; - var_3C++; + // No EVs to lose, but make sure friendship updates anyway + friendshipOnly = TRUE; + itemEffectParam++; break; } - dataSigned += r2; + dataSigned += evChange; if (dataSigned < 0) dataSigned = 0; } - SetMonData(mon, sGetMonDataEVConstants[var_38], &dataSigned); + + // Update EVs and stats + SetMonData(mon, sGetMonDataEVConstants[temp1], &dataSigned); CalculateMonStats(mon); - var_3C++; + itemEffectParam++; retVal = FALSE; break; - case 2: - // revive - if (r10 & 0x10) + + case 2: // ITEM4_HEAL_HP + // If Revive, update number of times revive has been used + if (effectFlags & (ITEM4_REVIVE >> 2)) { if (GetMonData(mon, MON_DATA_HP, NULL) != 0) { - var_3C++; + itemEffectParam++; break; } if (gMain.inBattle) { - if (battlerId != 4) + if (battlerId != MAX_BATTLERS_COUNT) { gAbsentBattlerFlags &= ~gBitTable[battlerId]; CopyPlayerPartyMonToBattleData(battlerId, GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[battlerId])); @@ -4711,48 +4784,53 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov { if (GetMonData(mon, MON_DATA_HP, NULL) == 0) { - var_3C++; + itemEffectParam++; break; } } // Get amount of HP to restore - dataUnsigned = itemEffect[var_3C++]; + dataUnsigned = itemEffect[itemEffectParam++]; switch (dataUnsigned) { - case ITEM6_HEAL_FULL: + case ITEM6_HEAL_HP_FULL: dataUnsigned = GetMonData(mon, MON_DATA_MAX_HP, NULL) - GetMonData(mon, MON_DATA_HP, NULL); break; - case ITEM6_HEAL_HALF: + case ITEM6_HEAL_HP_HALF: dataUnsigned = GetMonData(mon, MON_DATA_MAX_HP, NULL) / 2; if (dataUnsigned == 0) dataUnsigned = 1; break; - case ITEM6_HEAL_LVL_UP: + case ITEM6_HEAL_HP_LVL_UP: dataUnsigned = gBattleScripting.levelUpHP; break; } + + // Only restore HP if not at max health if (GetMonData(mon, MON_DATA_MAX_HP, NULL) != GetMonData(mon, MON_DATA_HP, NULL)) { - if (e == 0) + if (!usedByAI) { + // Restore HP dataUnsigned = GetMonData(mon, MON_DATA_HP, NULL) + dataUnsigned; if (dataUnsigned > GetMonData(mon, MON_DATA_MAX_HP, NULL)) dataUnsigned = GetMonData(mon, MON_DATA_MAX_HP, NULL); SetMonData(mon, MON_DATA_HP, &dataUnsigned); - if (gMain.inBattle && battlerId != 4) + + // Update battler (if applicable) + if (gMain.inBattle && battlerId != MAX_BATTLERS_COUNT) { gBattleMons[battlerId].hp = dataUnsigned; - if (!(r10 & 0x10) && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + if (!(effectFlags & (ITEM4_REVIVE >> 2)) && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) { if (gBattleResults.numHealingItemsUsed < 255) gBattleResults.numHealingItemsUsed++; - // I have to re-use this variable to match. - r5 = gActiveBattler; + + temp2 = gActiveBattler; gActiveBattler = battlerId; BtlController_EmitGetMonData(0, REQUEST_ALL_BATTLE, 0); MarkBattlerForControllerExec(gActiveBattler); - gActiveBattler = r5; + gActiveBattler = temp2; } } } @@ -4762,227 +4840,197 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov } retVal = FALSE; } - r10 &= 0xEF; + effectFlags &= ~(ITEM4_REVIVE >> 2); break; - case 3: - // Heal pp in all moves. - if (!(r10 & 2)) + + case 3: // ITEM4_HEAL_PP + if (!(effectFlags & (ITEM4_HEAL_PP_ONE >> 3))) { - for (r5 = 0; (signed)(r5) < (signed)(4); r5++) + // Heal PP for all moves + for (temp2 = 0; (signed)(temp2) < (signed)(MAX_MON_MOVES); temp2++) { u16 moveId; - - dataUnsigned = GetMonData(mon, MON_DATA_PP1 + r5, NULL); - moveId = GetMonData(mon, MON_DATA_MOVE1 + r5, NULL); - if (dataUnsigned != CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), r5)) + dataUnsigned = GetMonData(mon, MON_DATA_PP1 + temp2, NULL); + moveId = GetMonData(mon, MON_DATA_MOVE1 + temp2, NULL); + if (dataUnsigned != CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), temp2)) { - dataUnsigned += itemEffect[var_3C]; - moveId = GetMonData(mon, MON_DATA_MOVE1 + r5, NULL); - if (dataUnsigned > CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), r5)) + dataUnsigned += itemEffect[itemEffectParam]; + moveId = GetMonData(mon, MON_DATA_MOVE1 + temp2, NULL); // Redundant + if (dataUnsigned > CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), temp2)) { - moveId = GetMonData(mon, MON_DATA_MOVE1 + r5, NULL); - dataUnsigned = CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), r5); + moveId = GetMonData(mon, MON_DATA_MOVE1 + temp2, NULL); // Redundant + dataUnsigned = CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), temp2); } - SetMonData(mon, MON_DATA_PP1 + r5, &dataUnsigned); + SetMonData(mon, MON_DATA_PP1 + temp2, &dataUnsigned); + + // Heal battler PP too (if applicable) if (gMain.inBattle && battlerId != MAX_BATTLERS_COUNT && !(gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED) - && !(gDisableStructs[battlerId].mimickedMoves & gBitTable[r5])) - gBattleMons[battlerId].pp[r5] = dataUnsigned; + && !(gDisableStructs[battlerId].mimickedMoves & gBitTable[temp2])) + gBattleMons[battlerId].pp[temp2] = dataUnsigned; + retVal = FALSE; } } - var_3C++; + itemEffectParam++; } - // Heal pp in one move. else { + // Heal PP for one move u16 moveId; - dataUnsigned = GetMonData(mon, MON_DATA_PP1 + moveIndex, NULL); moveId = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL); if (dataUnsigned != CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex)) { - dataUnsigned += itemEffect[var_3C++]; - moveId = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL); + dataUnsigned += itemEffect[itemEffectParam++]; + moveId = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL); // Redundant if (dataUnsigned > CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex)) { - moveId = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL); + moveId = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL); // Redundant dataUnsigned = CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex); } SetMonData(mon, MON_DATA_PP1 + moveIndex, &dataUnsigned); + + // Heal battler PP too (if applicable) if (gMain.inBattle - && battlerId != 4 && !(gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED) + && battlerId != MAX_BATTLERS_COUNT && !(gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED) && !(gDisableStructs[battlerId].mimickedMoves & gBitTable[moveIndex])) gBattleMons[battlerId].pp[moveIndex] = dataUnsigned; + retVal = FALSE; } } break; - // Evolution stone - case 7: + + // cases 4-6 are ITEM4_HEAL_PP_ONE, ITEM4_PP_UP, and ITEM4_REVIVE, which + // are already handled above by other cases or before the loop + + case 7: // ITEM4_EVO_STONE { - u16 targetSpecies = GetEvolutionTargetSpecies(mon, 2, item); + u16 targetSpecies = GetEvolutionTargetSpecies(mon, EVO_MODE_ITEM_USE, item); if (targetSpecies != SPECIES_NONE) { - BeginEvolutionScene(mon, targetSpecies, 0, partyIndex); + BeginEvolutionScene(mon, targetSpecies, FALSE, partyIndex); return FALSE; } } break; } } - var_38++; - r10 >>= 1; + temp1++; + effectFlags >>= 1; } break; - // EV and friendship + + // Handle ITEM5 effects (Change Def/SpDef/SpAtk/Speed EVs, PP Max, and friendship changes) case 5: - r10 = itemEffect[cmdIndex]; - var_38 = 0; - while (r10 != 0) + effectFlags = itemEffect[i]; + temp1 = 0; + + // Loop through and try each of the ITEM5 effects + while (effectFlags != 0) { - if (r10 & 1) + if (effectFlags & 1) { - switch (var_38) + switch (temp1) { - case 0: - case 1: - case 2: - case 3: + case 0: // ITEM5_EV_DEF + case 1: // ITEM5_EV_SPEED + case 2: // ITEM5_EV_SPDEF + case 3: // ITEM5_EV_SPATK evCount = GetMonEVCount(mon); - r5 = itemEffect[var_3C]; - dataSigned = GetMonData(mon, sGetMonDataEVConstants[var_38 + 2], NULL); - r2 = r5; - if (r2 > 0) + temp2 = itemEffect[itemEffectParam]; + dataSigned = GetMonData(mon, sGetMonDataEVConstants[temp1 + 2], NULL); + evChange = temp2; + if (evChange > 0) // Increasing EV { + // Has EV increase limit already been reached? if (evCount >= MAX_TOTAL_EVS) return TRUE; if (dataSigned >= EV_ITEM_RAISE_LIMIT) break; - if (dataSigned + r2 > EV_ITEM_RAISE_LIMIT) - r5 = EV_ITEM_RAISE_LIMIT - (dataSigned + r2) + r2; + // Limit the increase + if (dataSigned + evChange > EV_ITEM_RAISE_LIMIT) + temp2 = EV_ITEM_RAISE_LIMIT - (dataSigned + evChange) + evChange; else - r5 = r2; + temp2 = evChange; - if (evCount + r5 > MAX_TOTAL_EVS) - r5 += MAX_TOTAL_EVS - (evCount + r5); - dataSigned += r5; + if (evCount + temp2 > MAX_TOTAL_EVS) + temp2 += MAX_TOTAL_EVS - (evCount + temp2); + + dataSigned += temp2; } - else + else // Decreasing EV { if (dataSigned == 0) { - var_28 = 1; - var_3C++; + // No EVs to lose, but make sure friendship updates anyway + friendshipOnly = TRUE; + itemEffectParam++; break; } - dataSigned += r2; + dataSigned += evChange; if (dataSigned < 0) dataSigned = 0; } - SetMonData(mon, sGetMonDataEVConstants[var_38 + 2], &dataSigned); + + // Update EVs and stats + SetMonData(mon, sGetMonDataEVConstants[temp1 + 2], &dataSigned); CalculateMonStats(mon); retVal = FALSE; - var_3C++; + itemEffectParam++; break; - case 4: + + case 4: // ITEM5_PP_MAX dataUnsigned = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2); - r5 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex); - if (dataUnsigned < 3 && r5 > 4) + temp2 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex); + if (dataUnsigned < 3 && temp2 > 4) { dataUnsigned = GetMonData(mon, MON_DATA_PP_BONUSES, NULL); dataUnsigned &= gPPUpSetMask[moveIndex]; dataUnsigned += gPPUpAddMask[moveIndex] * 3; SetMonData(mon, MON_DATA_PP_BONUSES, &dataUnsigned); - dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), dataUnsigned, moveIndex) - r5; + dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), dataUnsigned, moveIndex) - temp2; dataUnsigned = GetMonData(mon, MON_DATA_PP1 + moveIndex, NULL) + dataUnsigned; SetMonData(mon, MON_DATA_PP1 + moveIndex, &dataUnsigned); retVal = FALSE; } break; - case 5: - if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 100 && (retVal == 0 || var_28 != 0) && !ShouldSkipFriendshipChange() && var_34 == 0) + + case 5: // ITEM5_FRIENDSHIP_LOW + // Changes to friendship are given differently depending on + // how much friendship the Pokémon already has. + // In general, Pokémon with lower friendship receive more, + // and Pokémon with higher friendship receive less. + if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 100) { - var_34 = itemEffect[var_3C]; - friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); - if (var_34 > 0 && holdEffect == HOLD_EFFECT_HAPPINESS_UP) - friendship += 150 * var_34 / 100; - else - friendship += var_34; - if (var_34 > 0) - { - if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == ITEM_LUXURY_BALL) - friendship++; - if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == GetCurrentRegionMapSectionId()) - friendship++; - } - if (friendship < 0) - friendship = 0; - if (friendship > MAX_FRIENDSHIP) - friendship = MAX_FRIENDSHIP; - SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship); - retVal = FALSE; + UPDATE_FRIENDSHIP_FROM_ITEM; } - var_3C++; + itemEffectParam++; break; - case 6: - if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 100 && GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 200 - && (retVal == 0 || var_28 != 0) && !ShouldSkipFriendshipChange() && var_34 == 0) + + case 6: // ITEM5_FRIENDSHIP_MID + if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 100 && GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 200) { - var_34 = itemEffect[var_3C]; - friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); - if ((s8)(var_34) > 0 && holdEffect == HOLD_EFFECT_HAPPINESS_UP) - friendship += 150 * var_34 / 100; - else - friendship += var_34; - if (var_34 > 0) - { - if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == ITEM_LUXURY_BALL) - friendship++; - if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == GetCurrentRegionMapSectionId()) - friendship++; - } - if (friendship < 0) - friendship = 0; - if (friendship > MAX_FRIENDSHIP) - friendship = MAX_FRIENDSHIP; - SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship); - retVal = FALSE; + UPDATE_FRIENDSHIP_FROM_ITEM; } - var_3C++; + itemEffectParam++; break; - case 7: - if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 200 && (retVal == 0 || var_28 != 0) && !ShouldSkipFriendshipChange() && var_34 == 0) + + case 7: // ITEM5_FRIENDSHIP_HIGH + if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 200) { - var_34 = itemEffect[var_3C]; - friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); - if ((s8)(var_34) > 0 && holdEffect == HOLD_EFFECT_HAPPINESS_UP) - friendship += 150 * var_34 / 100; - else - friendship += var_34; - if (var_34 > 0) - { - if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == ITEM_LUXURY_BALL) - friendship++; - if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == GetCurrentRegionMapSectionId()) - friendship++; - } - if (friendship < 0) - friendship = 0; - if (friendship > MAX_FRIENDSHIP) - friendship = MAX_FRIENDSHIP; - SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship); - retVal = FALSE; + UPDATE_FRIENDSHIP_FROM_ITEM; } - var_3C++; + itemEffectParam++; break; } } - var_38++; - r10 >>= 1; + temp1++; + effectFlags >>= 1; } break; } @@ -5015,9 +5063,9 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit) u8 offset; int i; u8 j; - u8 val; + u8 effectFlags; - offset = 6; + offset = ITEM_EFFECT_ARG_START; temp = gItemEffectTable[itemId - ITEM_POTION]; @@ -5031,7 +5079,7 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit) itemEffect = temp; - for (i = 0; i < 6; i++) + for (i = 0; i < ITEM_EFFECT_ARG_START; i++) { switch (i) { @@ -5043,74 +5091,75 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit) return 0; break; case 4: - val = itemEffect[4]; - if (val & ITEM4_PP_UP) - val &= ~(ITEM4_PP_UP); + effectFlags = itemEffect[4]; + if (effectFlags & ITEM4_PP_UP) + effectFlags &= ~(ITEM4_PP_UP); j = 0; - while (val) + while (effectFlags) { - if (val & 1) + if (effectFlags & 1) { switch (j) { - case 2: - if (val & 0x10) - val &= 0xEF; - case 0: - if (i == effectByte && (val & effectBit)) + case 2: // ITEM4_HEAL_HP + if (effectFlags & (ITEM4_REVIVE >> 2)) + effectFlags &= ~(ITEM4_REVIVE >> 2); + // fallthrough + case 0: // ITEM4_EV_HP + if (i == effectByte && (effectFlags & effectBit)) return offset; offset++; break; - case 1: - if (i == effectByte && (val & effectBit)) + case 1: // ITEM4_EV_ATK + if (i == effectByte && (effectFlags & effectBit)) return offset; offset++; break; - case 3: - if (i == effectByte && (val & effectBit)) + case 3: // ITEM4_HEAL_PP + if (i == effectByte && (effectFlags & effectBit)) return offset; offset++; break; - case 7: + case 7: // ITEM4_EVO_STONE if (i == effectByte) return 0; break; } } j++; - val >>= 1; + effectFlags >>= 1; if (i == effectByte) effectBit >>= 1; } break; case 5: - val = itemEffect[5]; + effectFlags = itemEffect[5]; j = 0; - while (val) + while (effectFlags) { - if (val & 1) + if (effectFlags & 1) { switch (j) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - if (i == effectByte && (val & effectBit)) + case 0: // ITEM5_EV_DEF + case 1: // ITEM5_EV_SPEED + case 2: // ITEM5_EV_SPDEF + case 3: // ITEM5_EV_SPATK + case 4: // ITEM5_PP_MAX + case 5: // ITEM5_FRIENDSHIP_LOW + case 6: // ITEM5_FRIENDSHIP_MID + if (i == effectByte && (effectFlags & effectBit)) return offset; offset++; break; - case 7: + case 7: // ITEM5_FRIENDSHIP_HIGH if (i == effectByte) return 0; break; } } j++; - val >>= 1; + effectFlags >>= 1; if (i == effectByte) effectBit >>= 1; } @@ -5230,7 +5279,7 @@ u8 GetNatureFromPersonality(u32 personality) return personality % NUM_NATURES; } -u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem) +u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem) { int i; u16 targetSpecies = 0; @@ -5248,12 +5297,13 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem) else holdEffect = ItemId_GetHoldEffect(heldItem); - if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE && type != 3) + // Prevent evolution with Everstone, unless we're just viewing the party menu with an evolution item + if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE && mode != EVO_MODE_ITEM_CHECK) return SPECIES_NONE; - switch (type) + switch (mode) { - case 0: + case EVO_MODE_NORMAL: level = GetMonData(mon, MON_DATA_LEVEL, 0); friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, 0); @@ -5313,7 +5363,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem) } } break; - case 1: + case EVO_MODE_TRADE: for (i = 0; i < EVOS_PER_MON; i++) { switch (gEvolutionTable[species][i].method) @@ -5332,8 +5382,8 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem) } } break; - case 2: - case 3: + case EVO_MODE_ITEM_USE: + case EVO_MODE_ITEM_CHECK: for (i = 0; i < EVOS_PER_MON; i++) { if (gEvolutionTable[species][i].method == EVO_ITEM @@ -5438,96 +5488,63 @@ u16 SpeciesToCryId(u16 species) return gSpeciesIdToCryId[species - (SPECIES_TREECKO - 1)]; } -void sub_806D544(u16 species, u32 personality, u8 *dest) +#define DRAW_SPINDA_SPOTS \ +{ \ + int i; \ + for (i = 0; i < 4; i++) \ + { \ + int j; \ + u8 x = gSpindaSpotGraphics[i].x + ((personality & 0x0F) - 8); \ + u8 y = gSpindaSpotGraphics[i].y + (((personality & 0xF0) >> 4) - 8); \ + \ + for (j = 0; j < 16; j++) \ + { \ + int k; \ + s32 row = gSpindaSpotGraphics[i].image[j]; \ + \ + for (k = x; k < x + 16; k++) \ + { \ + u8 *val = dest + ((k / 8) * 32) + \ + ((k % 8) / 2) + \ + ((y >> 3) << 8) + \ + ((y & 7) << 2); \ + \ + if (row & 1) \ + { \ + if (k & 1) \ + { \ + if ((u8)((*val & 0xF0) - 0x10) <= 0x20) \ + *val += 0x40; \ + } \ + else \ + { \ + if ((u8)((*val & 0xF) - 0x01) <= 0x02) \ + *val += 0x04; \ + } \ + } \ + \ + row >>= 1; \ + } \ + \ + y++; \ + } \ + \ + personality >>= 8; \ + } \ +} + +static void DrawSpindaSpotsUnused(u16 species, u32 personality, u8 *dest) { if (species == SPECIES_SPINDA && dest != gMonSpritesGfxPtr->sprites.ptr[0] && dest != gMonSpritesGfxPtr->sprites.ptr[2]) - { - int i; - for (i = 0; i < 4; i++) - { - int j; - u8 x = gSpindaSpotGraphics[i].x + ((personality & 0x0F) - 8); - u8 y = gSpindaSpotGraphics[i].y + (((personality & 0xF0) >> 4) - 8); - - for (j = 0; j < 16; j++) - { - int k; - s32 row = gSpindaSpotGraphics[i].image[j]; - - for (k = x; k < x + 16; k++) - { - u8 *val = dest + ((k / 8) * 32) + ((k % 8) / 2) + ((y >> 3) << 8) + ((y & 7) << 2); - - if (row & 1) - { - if (k & 1) - { - if ((u8)((*val & 0xF0) - 0x10) <= 0x20) - *val += 0x40; - } - else - { - if ((u8)((*val & 0xF) - 0x01) <= 0x02) - *val += 0x04; - } - } - - row >>= 1; - } - - y++; - } - - personality >>= 8; - } - } + DRAW_SPINDA_SPOTS; } -void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, u8 a4) +void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, bool8 isFrontPic) { - if (species == SPECIES_SPINDA && a4) - { - int i; - for (i = 0; i < 4; i++) - { - int j; - u8 x = gSpindaSpotGraphics[i].x + ((personality & 0x0F) - 8); - u8 y = gSpindaSpotGraphics[i].y + (((personality & 0xF0) >> 4) - 8); - - for (j = 0; j < 16; j++) - { - int k; - s32 row = gSpindaSpotGraphics[i].image[j]; - - for (k = x; k < x + 16; k++) - { - u8 *val = dest + ((k / 8) * 32) + ((k % 8) / 2) + ((y >> 3) << 8) + ((y & 7) << 2); - - if (row & 1) - { - if (k & 1) - { - if ((u8)((*val & 0xF0) - 0x10) <= 0x20) - *val += 0x40; - } - else - { - if ((u8)((*val & 0xF) - 0x01) <= 0x02) - *val += 0x04; - } - } - - row >>= 1; - } - - y++; - } - - personality >>= 8; - } - } + if (species == SPECIES_SPINDA && isFrontPic) + DRAW_SPINDA_SPOTS; } void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies) @@ -6575,7 +6592,7 @@ void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneF void StopPokemonAnimationDelayTask(void) { u8 delayTaskId = FindTaskIdByFunc(Task_PokemonSummaryAnimateAfterDelay); - if (delayTaskId != 0xFF) + if (delayTaskId != TASK_NONE) DestroyTask(delayTaskId); } @@ -6701,7 +6718,7 @@ static void sub_806F160(struct Unknown_806F160_Struct* structPtr) u16 i, j; for (i = 0; i < structPtr->field_0_0; i++) { - structPtr->templates[i] = gUnknown_08329D98[i]; + structPtr->templates[i] = gBattlerSpriteTemplates[i]; for (j = 0; j < structPtr->field_1; j++) { structPtr->frameImages[i * structPtr->field_1 + j].data = &structPtr->byteArrays[i][j * 0x800]; diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index 9c8eaca9a..da30963b5 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -1047,7 +1047,7 @@ static void sub_817F77C(struct Sprite *sprite) { // FIX: Reset these back to normal after they were changed so Poké Ball catch/release // animations without a screen transition in between don't break - sprite->affineAnims = gUnknown_082FF694; + sprite->affineAnims = gAffineAnims_BattleSpriteOpponentSide; } #endif // BUGFIX } diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index 065b8e22e..42330b6a5 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -7,6 +7,8 @@ #define POKE_ICON_BASE_PAL_TAG 56000 +#define INVALID_ICON_SPECIES SPECIES_OLD_UNOWN_J // Oddly specific, used when an icon should be a ?. Any of the 'old unown' would work + struct MonIconSpriteTemplate { const struct OamData *oam; @@ -1049,7 +1051,7 @@ u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u return spriteId; } -u8 sub_80D2D78(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, bool32 extra) +u8 CreateMonIconNoPersonality(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, bool32 handleDeoxys) { u8 spriteId; struct MonIconSpriteTemplate iconTemplate = @@ -1062,7 +1064,7 @@ u8 sub_80D2D78(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 .paletteTag = POKE_ICON_BASE_PAL_TAG + gMonIconPaletteIndices[species], }; - iconTemplate.image = GetMonIconTiles(species, extra); + iconTemplate.image = GetMonIconTiles(species, handleDeoxys); spriteId = CreateMonIconSprite(&iconTemplate, x, y, subpriority); UpdateMonIconFrame(&gSprites[spriteId]); @@ -1086,7 +1088,7 @@ u16 GetIconSpecies(u16 species, u32 personality) else { if (species > NUM_SPECIES) - result = 260; + result = INVALID_ICON_SPECIES; else result = species; } @@ -1102,7 +1104,7 @@ u16 GetUnownLetterByPersonality(u32 personality) return GET_UNOWN_LETTER(personality); } -u16 sub_80D2E84(u16 species) +u16 GetIconSpeciesNoPersonality(u16 species) { u16 value; @@ -1117,7 +1119,7 @@ u16 sub_80D2E84(u16 species) else { if (species > (SPECIES_UNOWN_B - 1)) - species = SPECIES_OLD_UNOWN_J; // That's an oddly specific species. + species = INVALID_ICON_SPECIES; return GetIconSpecies(species, 0); } } @@ -1144,7 +1146,7 @@ void SafeLoadMonIconPalette(u16 species) { u8 palIndex; if (species > NUM_SPECIES) - species = 260; + species = INVALID_ICON_SPECIES; palIndex = gMonIconPaletteIndices[species]; if (IndexOfSpritePaletteTag(gMonIconPaletteTable[palIndex].tag) == 0xFF) LoadSpritePalette(&gMonIconPaletteTable[palIndex]); @@ -1160,7 +1162,7 @@ void LoadMonIconPalette(u16 species) void FreeMonIconPalettes(void) { u8 i; - for (i = 0; i < 6; i++) + for (i = 0; i < ARRAY_COUNT(gMonIconPaletteTable); i++) FreeSpritePaletteByTag(gMonIconPaletteTable[i].tag); } @@ -1169,7 +1171,7 @@ void SafeFreeMonIconPalette(u16 species) { u8 palIndex; if (species > NUM_SPECIES) - species = 260; + species = INVALID_ICON_SPECIES; palIndex = gMonIconPaletteIndices[species]; FreeSpritePaletteByTag(gMonIconPaletteTable[palIndex].tag); } @@ -1216,7 +1218,7 @@ void sub_80D304C(u16 offset) u8 GetValidMonIconPalIndex(u16 species) { if (species > NUM_SPECIES) - species = 260; + species = INVALID_ICON_SPECIES; return gMonIconPaletteIndices[species]; } @@ -1228,7 +1230,7 @@ u8 GetMonIconPaletteIndexFromSpecies(u16 species) const u16* GetValidMonIconPalettePtr(u16 species) { if (species > NUM_SPECIES) - species = 260; + species = INVALID_ICON_SPECIES; return gMonIconPaletteTable[gMonIconPaletteIndices[species]].data; } diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c index 914752eb4..33f08f590 100755 --- a/src/pokemon_jump.c +++ b/src/pokemon_jump.c @@ -29,515 +29,645 @@ #include "pokemon_jump.h" #include "constants/rgb.h" #include "constants/songs.h" +#include "constants/items.h" -struct PokemonJump1_MonInfo +#define MAX_JUMP_SCORE 99990 +#define MAX_JUMPS 9999 + +#define JUMP_PEAK (-30) + +enum { + BG_INTERFACE, + BG_BONUSES, + BG_VENUSAUR, + BG_SCENERY, +}; + +// IDs for persistent windows +enum { + WIN_POINTS, + WIN_TIMES, + NUM_WINDOWS +}; + +enum { + PACKET_MON_INFO = 1, + PACKET_UNUSED, + PACKET_LEADER_STATE, + PACKET_MEMBER_STATE, +}; + +enum { + JUMP_TYPE_NORMAL, + JUMP_TYPE_FAST, + JUMP_TYPE_SLOW, +}; + +enum { + FUNC_GAME_INTRO, + FUNC_WAIT_ROUND, + FUNC_GAME_ROUND, + FUNC_GAME_OVER, + FUNC_ASK_PLAY_AGAIN, + FUNC_RESET_GAME, + FUNC_EXIT, + FUNC_GIVE_PRIZE, + FUNC_SAVE, + FUNC_NONE +}; + +enum { + GFXFUNC_LOAD, + GFXFUNC_SHOW_NAMES, + GFXFUNC_SHOW_NAMES_HIGHLIGHT, + GFXFUNC_ERASE_NAMES, + GFXFUNC_MSG_PLAY_AGAIN, + GFXFUNC_MSG_SAVING, + GFXFUNC_ERASE_MSG, + GFXFUNC_MSG_PLAYER_DROPPED, + GFXFUNC_MSG_COMM_STANDBY, + GFXFUNC_COUNTDOWN, +}; + +enum { + VINE_HIGHEST, + VINE_DOWNSWING_HIGHER, + VINE_DOWNSWING_HIGH, + VINE_DOWNSWING_LOW, + VINE_DOWNSWING_LOWER, + VINE_LOWEST, + VINE_UPSWING_LOWER, + VINE_UPSWING_LOW, + VINE_UPSWING_HIGH, + VINE_UPSWING_HIGHER, + NUM_VINESTATES +}; + +// Used to compare limits for vineStateTimer +// The upper 8 bits of vineStateTimer are the vine state, +// the lower 8 bits are a timer to the next state. +// When the timer is incremented above 255, it increments +// the vine state and the timer is reset. +#define VINE_STATE_TIMER(vineState)(((vineState) << 8) | 0xFF) + +enum { + MONSTATE_NORMAL, // Pokémon is either on the ground or in the middle of a jump + MONSTATE_JUMP, // Pokémon has begun a jump + MONSTATE_HIT, // Pokémon got hit by the vine +}; + +enum { + JUMPSTATE_NONE, + JUMPSTATE_SUCCESS, // Cleared vine + JUMPSTATE_FAILURE, // Hit vine +}; + +#define PLAY_AGAIN_NO 1 +#define PLAY_AGAIN_YES 2 + +#define TAG_MON1 0 +#define TAG_MON2 1 // MON2-5 used implicitly by adding multiplayer id to tag +#define TAG_MON3 2 +#define TAG_MON4 3 +#define TAG_MON5 4 + +#define GFXTAG_VINE1 5 +#define GFXTAG_VINE2 6 +#define GFXTAG_VINE3 7 +#define GFXTAG_VINE4 8 +#define GFXTAG_COUNTDOWN 9 +#define GFXTAG_STAR 10 + +#define PALTAG_1 5 +#define PALTAG_2 6 +#define PALTAG_COUNTDOWN 7 + +#define TAG_DIGITS 800 + +#define VINE_SPRITES_PER_SIDE 4 // Vine rope is divided into 8 sprites, 4 per side copied and flipped horizontally + +// Used by SetLinkTimeInterval to get a bit mask for capping +// a timer that controls how frequently link data is sent. +#define LINK_INTERVAL_NONE 0 +#define LINK_INTERVAL_SHORT 3 // 3 frame interval +#define LINK_INTERVAL_MEDIUM 4 // 7 frame interval +#define LINK_INTERVAL_LONG 5 // 15 frame interval + +#define LINK_TIMER_STOPPED 0x1111 + +struct PokemonJump_MonInfo { u16 species; u32 otId; u32 personality; }; -struct PokemonJump1_82E4 +struct PokemonJump_Player { - int unk0; - int unk4; - u8 filler8[0x4]; - u16 unkC; - u16 unkE; - u16 unk10; - u16 unk12; - int unk14; - int unk18; - u8 unk1C[11]; + int jumpOffset; + int jumpOffsetIdx; + u32 unused; + u16 monJumpType; + u16 jumpTimeStart; + u16 monState; + u16 prevMonState; + int jumpState; + bool32 funcFinished; + u8 name[11]; }; -struct PokemonJump2 +struct PokemonJumpGfx { - int unk0; - u16 unk4; - u8 unk6; - u8 filler7[0xa - 0x7]; - u8 unkA; - u8 unkB; - u8 unkC; - u8 unkD; - u8 unkE; - u8 unkF; - u16 filler10; - u16 unk12; - u16 unk14; - u32 unk18; - u16 unk1C[5]; - u8 txtBuff[2][0x40]; - u8 strBuff[0x100]; - u16 tilemapBuffer[(0x81a8 - 0x1a6) / 2]; // 0x1A6 - struct Sprite *unk81A8[MAX_RFU_PLAYERS]; - struct Sprite *unk81BC[MAX_RFU_PLAYERS]; - struct Sprite *unk81D0[8]; - u8 filler81F0[0xC]; - u8 unk81FC[MAX_RFU_PLAYERS]; + bool32 funcFinished; + u16 mainState; + u8 taskId; + u8 unused1[3]; + u8 resetVineState; + u8 resetVineTimer; + u8 vineState; + u8 msgWindowState; + u8 vinePalNumDownswing; + u8 vinePalNumUpswing; + u16 unused2; + u16 msgWindowId; + u16 fanfare; + u32 bonusTimer; + u16 nameWindowIds[MAX_RFU_PLAYERS]; + u8 itemName[64]; + u8 itemQuantityStr[64]; + u8 prizeMsg[256]; + u16 tilemapBuffer[0x4000]; + struct Sprite *monSprites[MAX_RFU_PLAYERS]; + struct Sprite *starSprites[MAX_RFU_PLAYERS]; + struct Sprite *vineSprites[VINE_SPRITES_PER_SIDE * 2]; + u8 unused3[12]; + u8 monSpriteSubpriorities[MAX_RFU_PLAYERS]; }; -struct PokemonJump1Sub +struct PokemonJump_CommData { - u8 unk0; - u8 unk1; - u16 unk2; - u16 unk4; - u32 unk8; + u8 funcId; + u8 receivedBonusFlags; + u16 data; // Multi-use + u16 jumpsInRow; + u32 jumpScore; }; -struct PokemonJump1 +struct PokemonJump { - MainCallback returnCallback; - u8 unk4; - u8 unk5; - u8 unk6; - u8 unk7; - u16 unk8; - u16 unkA; - u16 unkC; - u16 unkE; - int unk10; - u32 unk14; - u32 unk18; - int unk1C; - u32 unk20; - u32 unk24; - u32 unk28; - int unk2C; - u32 unk30; - u16 unk34; - u16 unk36; - u8 filler38[0x2]; - u16 unk3A; - u16 unk3C; - u16 unk3E; - u16 unk40; - u16 unk42; - u8 unk44; - u8 unk45; - u8 unk46; - u8 isLeader; - u8 unk48; - u8 unk49; - u16 unk4A; - u8 unk4C; - u8 unk4D; - u16 unk4E; - u8 unk50; - u8 unk51; - u8 filler52[0x2]; - int unk54; - int unk58; - int unk5C; - int unk60; - int unk64; - int unk68; - int unk6C; - struct PokemonJump1Sub unk70; - u8 unk7C[MAX_RFU_PLAYERS]; - u8 unk81[MAX_RFU_PLAYERS]; - u8 unk86[MAX_RFU_PLAYERS]; - u8 unk8B[MAX_RFU_PLAYERS]; - u16 unk90[MAX_RFU_PLAYERS]; - u16 unk9A[MAX_RFU_PLAYERS]; - struct PokemonJump2 unkA4; - struct PokemonJump1_MonInfo unk82A8[MAX_RFU_PLAYERS]; - struct PokemonJump1_82E4 unk82E4[MAX_RFU_PLAYERS]; - struct PokemonJump1_82E4 *unk83AC; + MainCallback exitCallback; + u8 taskId; + u8 numPlayers; + u8 multiplayerId; + u8 startDelayTimer; + u16 mainState; + u16 helperState; + u16 excellentsInRow; + u16 excellentsInRowRecord; + bool32 gameOver; + u32 vineState; + u32 prevVineState; + int vineSpeed; + u32 vineSpeedAccel; + u32 rngSeed; + u32 nextVineSpeed; + int linkTimer; + u32 linkTimerLimit; + u16 vineStateTimer; + bool16 ignoreJumpInput; + u16 unused1; + u16 unused2; // Set to 0, never read + u16 timer; + u16 prizeItemId; + u16 prizeItemQuantity; + u16 playAgainComm; + u8 unused3; // Set to 0, never read + u8 playAgainState; + bool8 allowVineUpdates; + bool8 isLeader; + bool8 funcActive; + bool8 allPlayersReady; + u16 vineTimer; + u8 nextFuncId; + bool8 showBonus; + u16 vineSpeedDelay; + u8 vineBaseSpeedIdx; + u8 vineSpeedStage; + int numPlayersAtPeak; + bool32 initScoreUpdate; + bool32 updateScore; + bool32 unused4; // Set to TRUE, never read + bool32 giveBonus; + bool32 skipJumpUpdate; + bool32 atMaxSpeedStage; + struct PokemonJump_CommData comm; + bool8 atJumpPeak[MAX_RFU_PLAYERS]; + bool8 atJumpPeak2[MAX_RFU_PLAYERS]; + bool8 atJumpPeak3[MAX_RFU_PLAYERS]; + u8 memberFuncIds[MAX_RFU_PLAYERS]; + u16 playAgainStates[MAX_RFU_PLAYERS]; + u16 jumpTimeStarts[MAX_RFU_PLAYERS]; + struct PokemonJumpGfx jumpGfx; + struct PokemonJump_MonInfo monInfo[MAX_RFU_PLAYERS]; + struct PokemonJump_Player players[MAX_RFU_PLAYERS]; + struct PokemonJump_Player *player; }; struct PokemonJumpMons { u16 species; - u16 unk2; + u16 jumpType; }; -static void sub_802AA60(struct PokemonJump1 *); -static void sub_802AA94(struct PokemonJump1 *); -static void sub_802AB20(void); -static void sub_802AB98(void); +static void InitGame(struct PokemonJump *); +static void ResetForNewGame(struct PokemonJump *); +static void InitPlayerAndJumpTypes(void); +static void ResetPlayersForNewGame(void); static s16 GetPokemonJumpSpeciesIdx(u16 species); -static void sub_802AC2C(struct PokemonJump1_MonInfo *monInfo, struct Pokemon *mon); -static void sub_802AC6C(void); -static void sub_802ACA0(u8 taskId); -static void sub_802AF80(u8 taskId); -static void sub_802B008(void); -static void sub_802B194(u8 taskId); -static void sub_802B1FC(void); -static bool32 sub_802B248(void); -static bool32 sub_802B2D4(void); -static bool32 sub_802B368(void); -static bool32 sub_802B3D4(void); -static bool32 sub_802B470(void); -static bool32 sub_802B4CC(void); -static bool32 sub_802B568(void); -static bool32 sub_802B5C8(void); -static bool32 sub_802B628(void); -static bool32 sub_802B664(void); -static bool32 sub_802B6B8(void); -static bool32 sub_802B704(void); -static bool32 sub_802B720(void); -static bool32 sub_802B7E0(void); -static bool32 sub_802B8CC(void); -static bool32 sub_802B964(void); -static bool32 sub_802B29C(void); -static bool32 sub_802B31C(void); -static bool32 sub_802B3B4(void); -static bool32 sub_802BA58(void); -static bool32 sub_802BB84(void); -static bool32 sub_802BC60(void); -static bool32 sub_802BD30(void); -static void sub_802BD84(u8 taskId); -static void sub_802BE60(TaskFunc func, u8 taskPriority); -static void sub_802BE80(void); -static void sub_802BEA0(void); -static void sub_802BEE4(void); -static int sub_802BF48(void); -static void sub_802BF7C(void); -static int sub_802C098(void); -static void sub_802C0B8(void); -static void sub_802C0E8(void); -static void sub_802C114(void); -static bool32 sub_802C130(u16); -static void sub_802C164(void); -static void sub_802C1DC(void); -static void sub_802C240(void); -static void sub_802C260(void); -static void sub_802C270(void); -static void sub_802C280(void); -static void sub_802C398(int); -static void sub_802C43C(void); -static bool32 sub_802C538(void); -static bool32 sub_802C5DC(void); -static bool32 sub_802C618(void); -static bool32 sub_802C650(void); -static void sub_802C688(int); -static int sub_802C6B0(void); +static void InitJumpMonInfo(struct PokemonJump_MonInfo *, struct Pokemon *); +static void CB2_PokemonJump(void); +static void Task_StartPokemonJump(u8); +static void Task_PokemonJump_Leader(u8); +static void SendLinkData_Leader(void); +static void Task_PokemonJump_Member(u8); +static void SendLinkData_Member(void); +static bool32 GameIntro_Leader(void); +static bool32 WaitRound_Leader(void); +static bool32 GameRound_Leader(void); +static bool32 GameOver_Leader(void); +static bool32 GameOver_Member(void); +static bool32 AskPlayAgain_Leader(void); +static bool32 AskPlayAgain_Member(void); +static bool32 ResetGame_Leader(void); +static bool32 ResetGame_Member(void); +static bool32 ExitGame(void); +static bool32 GivePrize_Leader(void); +static bool32 GivePrize_Member(void); +static bool32 SavePokeJump(void); +static bool32 DoGameIntro(void); +static bool32 HandleSwingRound(void); +static bool32 DoVineHitEffect(void); +static bool32 GameIntro_Member(void); +static bool32 WaitRound_Member(void); +static bool32 GameRound_Member(void); +static bool32 TryGivePrize(void); +static bool32 DoPlayAgainPrompt(void); +static bool32 ClosePokeJumpLink(void); +static bool32 CloseMessageAndResetScore(void); +static void Task_CommunicateMonInfo(u8); +static void SetTaskWithPokeJumpStruct(TaskFunc, u8); +static void InitVineState(void); +static void ResetVineState(void); +static void UpdateVineState(void); +static int GetVineSpeed(void); +static void UpdateVineSpeed(void); +static int PokeJumpRandom(void); +static void ResetVineAfterHit(void); +static void ResetPlayersJumpStates(void); +static void ResetPlayersMonState(void); +static bool32 IsPlayersMonState(u16); +static void SetMonStateJump(void); +static void UpdateGame(void); +static void TryUpdateVineSwing(void); +static void DisallowVineUpdates(void); +static void AllowVineUpdates(void); +static void HandleMonState(void); +static void UpdateJump(int); +static void TryUpdateScore(void); +static bool32 UpdateVineHitStates(void); +static bool32 AllPlayersJumpedOrHit(void); +static bool32 DidAllPlayersClearVine(void); +static bool32 ShouldPlayAgain(void); +static void AddJumpScore(int); +static int GetPlayersAtJumpPeak(void); static bool32 AreLinkQueuesEmpty(void); -static int sub_802C73C(u8 *); -static void sub_802C780(void); -static int sub_802C790(int); -static void sub_802C7A0(u16); -static bool32 sub_802C7BC(void); -static u16 sub_802C7E0(void); -static void sub_802C808(u16, u16 *, u16 *); -static u16 sub_802C818(void); -static u16 sub_802C838(void); -static u16 sub_802C880(u16 item, u16 quantity); -static void sub_802CB7C(struct Sprite *sprite); -static void sub_802CC40(struct Sprite *sprite); -static void sub_802CD08(struct Sprite *sprite); -static void sub_802CDD4(struct Sprite *sprite); -static void sub_802DC9C(int id); -static void sub_802D074(struct PokemonJump2 *); -static void sub_802D0BC(struct PokemonJump2 *); -static void sub_802D0AC(void); -static void sub_802D0C8(int); -static bool32 sub_802D0F0(void); -static void sub_802D764(void); -static bool32 sub_802D788(void); -static void sub_802D7E8(u16 itemId, u16 quantity); -static void sub_802D884(u16 itemId); -static void sub_802D8FC(u16 itemId); -static bool32 sub_802D974(void); -static void sub_802DA14(void); -static void sub_802DC80(u32 id, s16 y); -static void sub_802DD88(u8 multiplayerId); -static bool32 sub_802DA44(void); -static void sub_802DD64(int); -static s8 sub_802DA8C(void); -static int sub_802DCCC(u8 flags); -static void sub_802DD74(u16); -static void sub_802DDA0(u8 multiplayerId); -static int sub_802DDB8(int multiplayerId); -static void sub_802DDCC(void); -static void sub_802DDE0(void); -static void sub_802DDF4(int); -static int sub_802DE08(void); -static void sub_802E0AC(struct PokemonJump1_MonInfo *arg0); -static bool32 sub_802E0D0(int multiplayerId, struct PokemonJump1_MonInfo *arg0); -static void sub_802E138(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *arg1); -static bool32 sub_802E1BC(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *arg1); -static void sub_802E234(struct PokemonJump1_82E4 *arg0, u8 arg1, u16 arg2); -static bool32 sub_802E264(struct PokemonJump1_82E4 *arg0, int multiplayerId, u8 *arg2, u16 *arg3); -static bool32 sub_802E2D0(struct PokemonJump1_82E4 *arg0, int multiplayerId); -static bool32 sub_802E354(u32 jumpScore, u16 jumpsInRow, u16 excellentsInRow); -static void sub_802E3A8(void); -static void sub_802D12C(u8 taskId); -static void sub_802E00C(u8 arg0); -static void sub_802E090(u8 taskId); -static void sub_802D150(void); -static void sub_802DD08(void); -static void sub_802DB8C(void); -static void sub_802DBF8(void); -static void sub_802DE1C(void); -static void sub_802DFD4(void); -static void sub_802D108(void (*func)(void)); -static void sub_802DF70(bool32 arg0); -static u32 sub_802DA9C(u32 left, u32 top, u32 width, u32 height); -static void sub_802DB18(u16 left, u16 top, u8 cursorPos); -static void sub_802D150(void); -static void sub_802D2E4(void); -static void sub_802D350(void); -static void sub_802D3BC(void); -static void sub_802D448(void); -static void sub_802D4F4(void); -static void sub_802D598(void); -static void sub_802D5E4(void); -static void sub_802D72C(void); -static void sub_802D688(void); -static void Task_ShowPokemonJumpRecords(u8 taskId); -static void sub_802E500(u16 windowId, int width); -static void TruncateToFirstWordOnly(u8 *str); +static int GetNumPlayersForBonus(u8 *); +static void ClearUnreadField(void); +static int GetScoreBonus(int); +static void TryUpdateExcellentsRecord(u16); +static bool32 HasEnoughScoreForPrize(void); +static u16 GetPrizeData(void); +static void UnpackPrizeData(u16, u16 *, u16 *); +static u16 GetPrizeItemId(void); +static u16 GetPrizeQuantity(void); +static u16 GetQuantityLimitedByBag(u16, u16); +static void SpriteCB_Star(struct Sprite *); +static void SpriteCB_MonHitShake(struct Sprite *); +static void SpriteCB_MonHitFlash(struct Sprite *); +static void SpriteCB_MonIntroBounce(struct Sprite *); +static void UpdateVineSwing(int); +static void StartPokeJumpGfx(struct PokemonJumpGfx *); +static void InitPokeJumpGfx(struct PokemonJumpGfx *); +static void FreeWindowsAndDigitObj(void); +static void SetUpPokeJumpGfxFuncById(int); +static bool32 IsPokeJumpGfxFuncFinished(void); +static void SetUpResetVineGfx(void); +static bool32 ResetVineGfx(void); +static void PrintPrizeMessage(u16, u16); +static void PrintPrizeFilledBagMessage(u16); +static void PrintNoRoomForPrizeMessage(u16); +static bool32 DoPrizeMessageAndFanfare(void); +static void ClearMessageWindow(void); +static void SetMonSpriteY(u32, s16); +static void StartMonHitShake(u8); +static bool32 RemoveMessageWindow(void); +static void PrintScore(int); +static s8 HandlePlayAgainInput(void); +static int DoSameJumpTimeBonus(u8); +static void PrintJumpsInRow(u16); +static void StartMonHitFlash(u8); +static int IsMonHitShakeActive(int); +static void StopMonHitFlash(void); +static void ResetMonSpriteSubpriorities(void); +static void StartMonIntroBounce(int); +static int IsMonIntroBounceActive(void); +static void SendPacket_MonInfo(struct PokemonJump_MonInfo *); +static bool32 RecvPacket_MonInfo(int, struct PokemonJump_MonInfo *); +static void SendPacket_LeaderState(struct PokemonJump_Player *, struct PokemonJump_CommData *); +static bool32 RecvPacket_LeaderState(struct PokemonJump_Player *, struct PokemonJump_CommData *); +static void SendPacket_MemberState(struct PokemonJump_Player *, u8, u16); +static bool32 RecvPacket_MemberStateToLeader(struct PokemonJump_Player *, int, u8 *, u16 *); +static bool32 RecvPacket_MemberStateToMember(struct PokemonJump_Player *, int); +static bool32 TryUpdateRecords(u32, u16, u16); +static void IncrementGamesWithMaxPlayers(void); +static void Task_RunPokeJumpGfxFunc(u8); +static void ShowBonus(u8); +static void Task_UpdateBonus(u8); +static void LoadPokeJumpGfx(void); +static void InitDigitPrinters(void); +static void PrintScoreSuffixes(void); +static void CreateJumpMonSprites(void); +static void AddPlayerNameWindows(void); +static void DrawPlayerNameWindows(void); +static void SetUpPokeJumpGfxFunc(void (*func)(void)); +static void PrintPokeJumpPlayerNames(bool32); +static u32 AddMessageWindow(u32, u32, u32, u32); +static void CreatePokeJumpYesNoMenu(u16, u16, u8); +static void PrintPlayerNamesNoHighlight(void); +static void PrintPlayerNamesWithHighlight(void); +static void ErasePlayerNames(void); +static void Msg_WantToPlayAgain(void); +static void Msg_SavingDontTurnOff(void); +static void EraseMessage(void); +static void Msg_SomeoneDroppedOut(void); +static void DoPokeJumpCountdown(void); +static void Msg_CommunicationStandby(void); +static void Task_ShowPokemonJumpRecords(u8); +static void PrintRecordsText(u16, int); +static void TruncateToFirstWordOnly(u8 *); -EWRAM_DATA static struct PokemonJump1 *gUnknown_02022CFC = NULL; -EWRAM_DATA static struct PokemonJump2 *gUnknown_02022D00 = NULL; +EWRAM_DATA static struct PokemonJump *sPokemonJump = NULL; +EWRAM_DATA static struct PokemonJumpGfx *sPokemonJumpGfx = NULL; -static const struct PokemonJumpMons gPkmnJumpSpecies[] = +/* + According to the clerk, the Pokémon allowed in + Pokémon Jump are all <= 28 inches, and do not + only swim, burrow, or fly. +*/ +static const struct PokemonJumpMons sPokeJumpMons[] = { - { .species = SPECIES_BULBASAUR, .unk2 = 2, }, - { .species = SPECIES_CHARMANDER, .unk2 = 1, }, - { .species = SPECIES_SQUIRTLE, .unk2 = 0, }, - { .species = SPECIES_CATERPIE, .unk2 = 1, }, - { .species = SPECIES_METAPOD, .unk2 = 1, }, - { .species = SPECIES_WEEDLE, .unk2 = 1, }, - { .species = SPECIES_KAKUNA, .unk2 = 1, }, - { .species = SPECIES_RATTATA, .unk2 = 1, }, - { .species = SPECIES_RATICATE, .unk2 = 1, }, - { .species = SPECIES_PIKACHU, .unk2 = 0, }, - { .species = SPECIES_SANDSHREW, .unk2 = 0, }, - { .species = SPECIES_NIDORAN_F, .unk2 = 0, }, - { .species = SPECIES_NIDORAN_M, .unk2 = 0, }, - { .species = SPECIES_CLEFAIRY, .unk2 = 0, }, - { .species = SPECIES_VULPIX, .unk2 = 0, }, - { .species = SPECIES_JIGGLYPUFF, .unk2 = 2, }, - { .species = SPECIES_ODDISH, .unk2 = 2, }, - { .species = SPECIES_PARAS, .unk2 = 1, }, - { .species = SPECIES_MEOWTH, .unk2 = 0, }, - { .species = SPECIES_PSYDUCK, .unk2 = 2, }, - { .species = SPECIES_MANKEY, .unk2 = 1, }, - { .species = SPECIES_GROWLITHE, .unk2 = 1, }, - { .species = SPECIES_POLIWAG, .unk2 = 2, }, - { .species = SPECIES_BELLSPROUT, .unk2 = 2, }, - { .species = SPECIES_SHELLDER, .unk2 = 1, }, - { .species = SPECIES_KRABBY, .unk2 = 1, }, - { .species = SPECIES_EXEGGCUTE, .unk2 = 2, }, - { .species = SPECIES_CUBONE, .unk2 = 0, }, - { .species = SPECIES_DITTO, .unk2 = 2, }, - { .species = SPECIES_EEVEE, .unk2 = 0, }, - { .species = SPECIES_OMANYTE, .unk2 = 1, }, - { .species = SPECIES_KABUTO, .unk2 = 1, }, - { .species = SPECIES_CHIKORITA, .unk2 = 2, }, - { .species = SPECIES_CYNDAQUIL, .unk2 = 1, }, - { .species = SPECIES_TOTODILE, .unk2 = 0, }, - { .species = SPECIES_SPINARAK, .unk2 = 1, }, - { .species = SPECIES_PICHU, .unk2 = 0, }, - { .species = SPECIES_CLEFFA, .unk2 = 0, }, - { .species = SPECIES_IGGLYBUFF, .unk2 = 2, }, - { .species = SPECIES_TOGEPI, .unk2 = 2, }, - { .species = SPECIES_MAREEP, .unk2 = 0, }, - { .species = SPECIES_BELLOSSOM, .unk2 = 2, }, - { .species = SPECIES_MARILL, .unk2 = 2, }, - { .species = SPECIES_SUNKERN, .unk2 = 2, }, - { .species = SPECIES_WOOPER, .unk2 = 2, }, - { .species = SPECIES_PINECO, .unk2 = 2, }, - { .species = SPECIES_SNUBBULL, .unk2 = 0, }, - { .species = SPECIES_SHUCKLE, .unk2 = 2, }, - { .species = SPECIES_TEDDIURSA, .unk2 = 0, }, - { .species = SPECIES_SLUGMA, .unk2 = 2, }, - { .species = SPECIES_SWINUB, .unk2 = 0, }, - { .species = SPECIES_HOUNDOUR, .unk2 = 1, }, - { .species = SPECIES_PHANPY, .unk2 = 0, }, - { .species = SPECIES_PORYGON2, .unk2 = 0, }, - { .species = SPECIES_TYROGUE, .unk2 = 1, }, - { .species = SPECIES_SMOOCHUM, .unk2 = 2, }, - { .species = SPECIES_ELEKID, .unk2 = 1, }, - { .species = SPECIES_MAGBY, .unk2 = 1, }, - { .species = SPECIES_LARVITAR, .unk2 = 1, }, - { .species = SPECIES_TREECKO, .unk2 = 1, }, - { .species = SPECIES_TORCHIC, .unk2 = 2, }, - { .species = SPECIES_MUDKIP, .unk2 = 0, }, - { .species = SPECIES_MARSHTOMP, .unk2 = 0, }, - { .species = SPECIES_POOCHYENA, .unk2 = 1, }, - { .species = SPECIES_ZIGZAGOON, .unk2 = 0, }, - { .species = SPECIES_LINOONE, .unk2 = 0, }, - { .species = SPECIES_WURMPLE, .unk2 = 1, }, - { .species = SPECIES_SILCOON, .unk2 = 2, }, - { .species = SPECIES_CASCOON, .unk2 = 2, }, - { .species = SPECIES_LOTAD, .unk2 = 2, }, - { .species = SPECIES_SEEDOT, .unk2 = 1, }, - { .species = SPECIES_RALTS, .unk2 = 0, }, - { .species = SPECIES_KIRLIA, .unk2 = 0, }, - { .species = SPECIES_SURSKIT, .unk2 = 2, }, - { .species = SPECIES_SHROOMISH, .unk2 = 2, }, - { .species = SPECIES_NINCADA, .unk2 = 1, }, - { .species = SPECIES_WHISMUR, .unk2 = 0, }, - { .species = SPECIES_AZURILL, .unk2 = 2, }, - { .species = SPECIES_SKITTY, .unk2 = 0, }, - { .species = SPECIES_SABLEYE, .unk2 = 0, }, - { .species = SPECIES_MAWILE, .unk2 = 0, }, - { .species = SPECIES_ARON, .unk2 = 1, }, - { .species = SPECIES_MEDITITE, .unk2 = 2, }, - { .species = SPECIES_ELECTRIKE, .unk2 = 1, }, - { .species = SPECIES_PLUSLE, .unk2 = 1, }, - { .species = SPECIES_MINUN, .unk2 = 1, }, - { .species = SPECIES_VOLBEAT, .unk2 = 0, }, - { .species = SPECIES_ILLUMISE, .unk2 = 0, }, - { .species = SPECIES_ROSELIA, .unk2 = 2, }, - { .species = SPECIES_GULPIN, .unk2 = 2, }, - { .species = SPECIES_NUMEL, .unk2 = 2, }, - { .species = SPECIES_TORKOAL, .unk2 = 2, }, - { .species = SPECIES_SPOINK, .unk2 = 0, }, - { .species = SPECIES_TRAPINCH, .unk2 = 2, }, - { .species = SPECIES_CACNEA, .unk2 = 2, }, - { .species = SPECIES_ANORITH, .unk2 = 1, }, - { .species = SPECIES_WYNAUT, .unk2 = 0, }, - { .species = SPECIES_SNORUNT, .unk2 = 0, }, - { .species = SPECIES_CLAMPERL, .unk2 = 1, }, - { .species = SPECIES_BAGON, .unk2 = 1, }, + { .species = SPECIES_BULBASAUR, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_CHARMANDER, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_SQUIRTLE, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_CATERPIE, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_METAPOD, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_WEEDLE, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_KAKUNA, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_RATTATA, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_RATICATE, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_PIKACHU, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_SANDSHREW, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_NIDORAN_F, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_NIDORAN_M, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_CLEFAIRY, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_VULPIX, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_JIGGLYPUFF, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_ODDISH, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_PARAS, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_MEOWTH, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_PSYDUCK, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_MANKEY, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_GROWLITHE, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_POLIWAG, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_BELLSPROUT, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_SHELLDER, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_KRABBY, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_EXEGGCUTE, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_CUBONE, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_DITTO, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_EEVEE, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_OMANYTE, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_KABUTO, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_CHIKORITA, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_CYNDAQUIL, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_TOTODILE, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_SPINARAK, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_PICHU, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_CLEFFA, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_IGGLYBUFF, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_TOGEPI, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_MAREEP, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_BELLOSSOM, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_MARILL, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_SUNKERN, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_WOOPER, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_PINECO, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_SNUBBULL, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_SHUCKLE, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_TEDDIURSA, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_SLUGMA, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_SWINUB, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_HOUNDOUR, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_PHANPY, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_PORYGON2, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_TYROGUE, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_SMOOCHUM, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_ELEKID, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_MAGBY, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_LARVITAR, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_TREECKO, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_TORCHIC, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_MUDKIP, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_MARSHTOMP, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_POOCHYENA, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_ZIGZAGOON, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_LINOONE, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_WURMPLE, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_SILCOON, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_CASCOON, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_LOTAD, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_SEEDOT, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_RALTS, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_KIRLIA, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_SURSKIT, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_SHROOMISH, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_NINCADA, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_WHISMUR, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_AZURILL, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_SKITTY, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_SABLEYE, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_MAWILE, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_ARON, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_MEDITITE, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_ELECTRIKE, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_PLUSLE, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_MINUN, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_VOLBEAT, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_ILLUMISE, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_ROSELIA, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_GULPIN, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_NUMEL, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_TORKOAL, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_SPOINK, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_TRAPINCH, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_CACNEA, .jumpType = JUMP_TYPE_SLOW, }, + { .species = SPECIES_ANORITH, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_WYNAUT, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_SNORUNT, .jumpType = JUMP_TYPE_NORMAL, }, + { .species = SPECIES_CLAMPERL, .jumpType = JUMP_TYPE_FAST, }, + { .species = SPECIES_BAGON, .jumpType = JUMP_TYPE_FAST, }, }; -void StartPokemonJump(u16 partyIndex, MainCallback callback) +void StartPokemonJump(u16 partyId, MainCallback exitCallback) { u8 taskId; if (gReceivedRemoteLinkPlayers) { - gUnknown_02022CFC = Alloc(sizeof(*gUnknown_02022CFC)); - if (gUnknown_02022CFC) + sPokemonJump = Alloc(sizeof(*sPokemonJump)); + if (sPokemonJump) { ResetTasks(); - taskId = CreateTask(sub_802ACA0, 1); - gUnknown_02022CFC->unk8 = 0; - gUnknown_02022CFC->returnCallback = callback; - gUnknown_02022CFC->unk4 = taskId; - gUnknown_02022CFC->unk6 = GetMultiplayerId(); - sub_802AC2C(&gUnknown_02022CFC->unk82A8[gUnknown_02022CFC->unk6], &gPlayerParty[partyIndex]); - sub_802AA60(gUnknown_02022CFC); - SetWordTaskArg(taskId, 2, (u32)gUnknown_02022CFC); - SetMainCallback2(sub_802AC6C); + taskId = CreateTask(Task_StartPokemonJump, 1); + sPokemonJump->mainState = 0; + sPokemonJump->exitCallback = exitCallback; + sPokemonJump->taskId = taskId; + sPokemonJump->multiplayerId = GetMultiplayerId(); + InitJumpMonInfo(&sPokemonJump->monInfo[sPokemonJump->multiplayerId], &gPlayerParty[partyId]); + InitGame(sPokemonJump); + SetWordTaskArg(taskId, 2, (u32)sPokemonJump); + SetMainCallback2(CB2_PokemonJump); return; } } - SetMainCallback2(callback); + // Exit - Players not connected, or alloc failed + SetMainCallback2(exitCallback); } -static void sub_802AA48(void) +static void FreePokemonJump(void) { - sub_802D0AC(); - Free(gUnknown_02022CFC); + FreeWindowsAndDigitObj(); + Free(sPokemonJump); } -static void sub_802AA60(struct PokemonJump1 *arg0) +static void InitGame(struct PokemonJump *jump) { - arg0->unk5 = GetLinkPlayerCount(); - arg0->unk70.unk0 = 5; - arg0->unk70.unk2 = 0; - sub_802AB20(); - sub_802AA94(arg0); - if (arg0->unk5 == MAX_RFU_PLAYERS) - sub_802E3A8(); + jump->numPlayers = GetLinkPlayerCount(); + jump->comm.funcId = FUNC_RESET_GAME; + jump->comm.data = 0; + InitPlayerAndJumpTypes(); + ResetForNewGame(jump); + if (jump->numPlayers == MAX_RFU_PLAYERS) + IncrementGamesWithMaxPlayers(); } -static void sub_802AA94(struct PokemonJump1 *arg0) +static void ResetForNewGame(struct PokemonJump *jump) { int i; - arg0->unk14 = 6; - arg0->unk18 = 6; - arg0->unk4A = 0; - arg0->unk1C = 0; - arg0->unk5C = 0; - arg0->isLeader = GetMultiplayerId() == 0; - arg0->unk8 = 0; - arg0->unkA = 0; - arg0->unkC = 0; - arg0->unkE = 0; - arg0->unk58 = 0; - arg0->unk3A = 0; - arg0->unk44 = 0; - arg0->unk54 = 0; - arg0->unk46 = 0; - arg0->unk49 = 0; - arg0->unk48 = 1; - arg0->unk70.unk8 = 0; - arg0->unk70.unk1 = 0; - arg0->unk70.unk4 = 0; - arg0->unk60 = 1; - arg0->unk4D = 0; - arg0->unk68 = 0; - arg0->unk64 = 0; - arg0->unk2C = 0; - arg0->unk30 = 0; - sub_802AB98(); - sub_802C0E8(); + jump->vineState = VINE_UPSWING_LOWER; + jump->prevVineState = VINE_UPSWING_LOWER; + jump->vineTimer = 0; + jump->vineSpeed = 0; + jump->updateScore = FALSE; + jump->isLeader = GetMultiplayerId() == 0; + jump->mainState = 0; + jump->helperState = 0; + jump->excellentsInRow = 0; + jump->excellentsInRowRecord = 0; + jump->initScoreUpdate = FALSE; + jump->unused2 = 0; + jump->unused3 = 0; + jump->numPlayersAtPeak = 0; + jump->allowVineUpdates = FALSE; + jump->allPlayersReady = FALSE; + jump->funcActive = TRUE; + jump->comm.jumpScore = 0; + jump->comm.receivedBonusFlags = 0; + jump->comm.jumpsInRow = 0; + jump->unused4 = TRUE; + jump->showBonus = FALSE; + jump->skipJumpUpdate = FALSE; + jump->giveBonus = FALSE; + jump->linkTimer = 0; + jump->linkTimerLimit = 0; + ResetPlayersForNewGame(); + ResetPlayersJumpStates(); for (i = 0; i < MAX_RFU_PLAYERS; i++) { - arg0->unk7C[i] = 0; - arg0->unk9A[i] = 0; + jump->atJumpPeak[i] = FALSE; + jump->jumpTimeStarts[i] = 0; } } -static void sub_802AB20(void) +static void InitPlayerAndJumpTypes(void) { int i, index; for (i = 0; i < MAX_RFU_PLAYERS; i++) { - index = GetPokemonJumpSpeciesIdx(gUnknown_02022CFC->unk82A8[i].species); - gUnknown_02022CFC->unk82E4[i].unkC = gPkmnJumpSpecies[index].unk2; + index = GetPokemonJumpSpeciesIdx(sPokemonJump->monInfo[i].species); + sPokemonJump->players[i].monJumpType = sPokeJumpMons[index].jumpType; } - gUnknown_02022CFC->unk83AC = &gUnknown_02022CFC->unk82E4[gUnknown_02022CFC->unk6]; + sPokemonJump->player = &sPokemonJump->players[sPokemonJump->multiplayerId]; } -static void sub_802AB98(void) +static void ResetPlayersForNewGame(void) { int i; for (i = 0; i < MAX_RFU_PLAYERS; i++) { - gUnknown_02022CFC->unk82E4[i].unkE = 0; - gUnknown_02022CFC->unk82E4[i].unk10 = 0; - gUnknown_02022CFC->unk82E4[i].unk12 = 0; - gUnknown_02022CFC->unk82E4[i].unk0 = 0; - gUnknown_02022CFC->unk82E4[i].unk4 = 0x7FFFFFFF; - gUnknown_02022CFC->unk82E4[i].unk14 = 0; - gUnknown_02022CFC->unk8B[i] = 9; + sPokemonJump->players[i].jumpTimeStart = 0; + sPokemonJump->players[i].monState = MONSTATE_NORMAL; + sPokemonJump->players[i].prevMonState = MONSTATE_NORMAL; + sPokemonJump->players[i].jumpOffset = 0; + sPokemonJump->players[i].jumpOffsetIdx = INT_MAX; + sPokemonJump->players[i].jumpState = JUMPSTATE_NONE; + sPokemonJump->memberFuncIds[i] = FUNC_NONE; } } static s16 GetPokemonJumpSpeciesIdx(u16 species) { u32 i; - for (i = 0; i < ARRAY_COUNT(gPkmnJumpSpecies); i++) + for (i = 0; i < ARRAY_COUNT(sPokeJumpMons); i++) { - if (gPkmnJumpSpecies[i].species == species) + if (sPokeJumpMons[i].species == species) return i; } return -1; // species isnt allowed } -static void sub_802AC2C(struct PokemonJump1_MonInfo *monInfo, struct Pokemon *mon) +static void InitJumpMonInfo(struct PokemonJump_MonInfo *monInfo, struct Pokemon *mon) { monInfo->species = GetMonData(mon, MON_DATA_SPECIES); monInfo->otId = GetMonData(mon, MON_DATA_OT_ID); monInfo->personality = GetMonData(mon, MON_DATA_PERSONALITY); } -static void sub_802AC58(void) +static void VBlankCB_PokemonJump(void) { TransferPlttBuffer(); LoadOam(); ProcessSpriteCopyRequests(); } -static void sub_802AC6C(void) +static void CB2_PokemonJump(void) { RunTasks(); AnimateSprites(); @@ -545,280 +675,284 @@ static void sub_802AC6C(void) UpdatePaletteFade(); } -static void sub_802AC84(TaskFunc func) +static void SetPokeJumpTask(TaskFunc func) { - gUnknown_02022CFC->unk4 = CreateTask(func, 1); - gUnknown_02022CFC->unk8 = 0; + sPokemonJump->taskId = CreateTask(func, 1); + sPokemonJump->mainState = 0; } -static void sub_802ACA0(u8 taskId) +static void Task_StartPokemonJump(u8 taskId) { - switch (gUnknown_02022CFC->unk8) + switch (sPokemonJump->mainState) { case 0: SetVBlankCallback(NULL); ResetSpriteData(); FreeAllSpritePalettes(); - sub_802BE60(sub_802BD84, 5); + SetTaskWithPokeJumpStruct(Task_CommunicateMonInfo, 5); FadeOutMapMusic(4); - gUnknown_02022CFC->unk8++; + sPokemonJump->mainState++; break; case 1: - if (!FuncIsActiveTask(sub_802BD84)) + if (!FuncIsActiveTask(Task_CommunicateMonInfo)) { - sub_802D074(&gUnknown_02022CFC->unkA4); + StartPokeJumpGfx(&sPokemonJump->jumpGfx); LoadWirelessStatusIndicatorSpriteGfx(); CreateWirelessStatusIndicatorSprite(0, 0); - gUnknown_02022CFC->unk8++; + sPokemonJump->mainState++; } break; case 2: - if (!sub_802D0F0() && IsNotWaitingForBGMStop() == TRUE) + if (!IsPokeJumpGfxFuncFinished() && IsNotWaitingForBGMStop() == TRUE) { FadeOutAndPlayNewMapMusic(MUS_RG_POKE_JUMP, 8); - gUnknown_02022CFC->unk8++; + sPokemonJump->mainState++; } break; case 3: if (IsLinkTaskFinished()) { - BlendPalettes(0xFFFFFFFF, 16, RGB_BLACK); - BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); - SetVBlankCallback(sub_802AC58); - gUnknown_02022CFC->unk8++; + BlendPalettes(PALETTES_ALL, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 16, 0, RGB_BLACK); + SetVBlankCallback(VBlankCB_PokemonJump); + sPokemonJump->mainState++; } break; case 4: UpdatePaletteFade(); if (!gPaletteFade.active) { - gUnknown_02022CFC->unk7 = 0; - gUnknown_02022CFC->unk8++; + sPokemonJump->startDelayTimer = 0; + sPokemonJump->mainState++; } break; case 5: - gUnknown_02022CFC->unk7++; - if (gUnknown_02022CFC->unk7 >= 20) + sPokemonJump->startDelayTimer++; + if (sPokemonJump->startDelayTimer >= 20) { - if (gUnknown_02022CFC->isLeader) - sub_802AC84(sub_802AF80); + if (sPokemonJump->isLeader) + SetPokeJumpTask(Task_PokemonJump_Leader); else - sub_802AC84(sub_802B194); + SetPokeJumpTask(Task_PokemonJump_Member); - sub_802BE80(); + InitVineState(); DestroyTask(taskId); } break; } } -static void sub_802AE14(int arg0) +static void SetLinkTimeInterval(int intervalId) { - if (arg0 == 0) + if (intervalId == LINK_INTERVAL_NONE) { - gUnknown_02022CFC->unk30 = 0x1111; - gUnknown_02022CFC->unk2C = 1; + // Link data is sent when timer reaches 0. + // Set timer to 1 and set limit to special + // 'stopped' value so timer won't change + sPokemonJump->linkTimerLimit = LINK_TIMER_STOPPED; + sPokemonJump->linkTimer = 1; } else { - gUnknown_02022CFC->unk30 = (1 << (arg0 - 1)) - 1; - gUnknown_02022CFC->unk2C = 0; + sPokemonJump->linkTimerLimit = (1 << (intervalId - 1)) - 1; + sPokemonJump->linkTimer = 0; } } -static void sub_802AE50(u8 arg0) +static void SetFunc_Leader(u8 funcId) { int i; - gUnknown_02022CFC->unk70.unk0 = arg0; - gUnknown_02022CFC->unk8 = 0; - gUnknown_02022CFC->unkA = 0; - gUnknown_02022CFC->unk48 = 1; - gUnknown_02022CFC->unk49 = 0; - for (i = 1; i < gUnknown_02022CFC->unk5; i++) - gUnknown_02022CFC->unk82E4[i].unk18 = 0; + sPokemonJump->comm.funcId = funcId; + sPokemonJump->mainState = 0; + sPokemonJump->helperState = 0; + sPokemonJump->funcActive = TRUE; + sPokemonJump->allPlayersReady = FALSE; + for (i = 1; i < sPokemonJump->numPlayers; i++) + sPokemonJump->players[i].funcFinished = FALSE; } -static void sub_802AEA4(void) +static void RecvLinkData_Leader(void) { int i; - int count; - u16 var0; - u8 var1; - u16 var2; + int numReady; + u16 monState; + u8 funcId; + u16 playAgainState; - for (i = 1, count = 0; i < gUnknown_02022CFC->unk5; i++) + for (i = 1, numReady = 0; i < sPokemonJump->numPlayers; i++) { - var0 = gUnknown_02022CFC->unk82E4[i].unk10; - if (sub_802E264(&gUnknown_02022CFC->unk82E4[i], i, &var1, &var2)) + monState = sPokemonJump->players[i].monState; + if (RecvPacket_MemberStateToLeader(&sPokemonJump->players[i], i, &funcId, &playAgainState)) { - gUnknown_02022CFC->unk90[i] = var2; - gUnknown_02022CFC->unk8B[i] = var1; - gUnknown_02022CFC->unk82E4[i].unk12 = var0; + sPokemonJump->playAgainStates[i] = playAgainState; + sPokemonJump->memberFuncIds[i] = funcId; + sPokemonJump->players[i].prevMonState = monState; } - if (gUnknown_02022CFC->unk82E4[i].unk18 && gUnknown_02022CFC->unk8B[i] == gUnknown_02022CFC->unk70.unk0) - count++; + // Group member has finished currently assigned function + if (sPokemonJump->players[i].funcFinished && sPokemonJump->memberFuncIds[i] == sPokemonJump->comm.funcId) + numReady++; } - if (count == gUnknown_02022CFC->unk5 - 1) - gUnknown_02022CFC->unk49 = 1; + if (numReady == sPokemonJump->numPlayers - 1) + sPokemonJump->allPlayersReady = TRUE; } -static bool32 (* const gUnknown_082FB5F4[])(void) = +static bool32 (* const sPokeJumpLeaderFuncs[])(void) = { - sub_802B248, - sub_802B2D4, - sub_802B368, - sub_802B3D4, - sub_802B4CC, - sub_802B5C8, - sub_802B664, - sub_802B6B8, - sub_802B720, + [FUNC_GAME_INTRO] = GameIntro_Leader, + [FUNC_WAIT_ROUND] = WaitRound_Leader, + [FUNC_GAME_ROUND] = GameRound_Leader, + [FUNC_GAME_OVER] = GameOver_Leader, + [FUNC_ASK_PLAY_AGAIN] = AskPlayAgain_Leader, + [FUNC_RESET_GAME] = ResetGame_Leader, + [FUNC_EXIT] = ExitGame, + [FUNC_GIVE_PRIZE] = GivePrize_Leader, + [FUNC_SAVE] = SavePokeJump, }; -static void sub_802AF80(u8 taskId) +static void Task_PokemonJump_Leader(u8 taskId) { - sub_802AEA4(); - sub_802C43C(); - if (!gUnknown_02022CFC->unk48 && gUnknown_02022CFC->unk49) + RecvLinkData_Leader(); + TryUpdateScore(); + if (!sPokemonJump->funcActive && sPokemonJump->allPlayersReady) { - sub_802AE50(gUnknown_02022CFC->unk4C); - sub_802AE14(3); + SetFunc_Leader(sPokemonJump->nextFuncId); + SetLinkTimeInterval(LINK_INTERVAL_SHORT); } - if (gUnknown_02022CFC->unk48 == 1) + if (sPokemonJump->funcActive == TRUE) { - if (!gUnknown_082FB5F4[gUnknown_02022CFC->unk70.unk0]()) + if (!sPokeJumpLeaderFuncs[sPokemonJump->comm.funcId]()) { - gUnknown_02022CFC->unk48 = 0; - gUnknown_02022CFC->unk82E4[gUnknown_02022CFC->unk6].unk18 = 1; + sPokemonJump->funcActive = FALSE; + sPokemonJump->players[sPokemonJump->multiplayerId].funcFinished = TRUE; } } - sub_802C1DC(); - sub_802B008(); + UpdateGame(); + SendLinkData_Leader(); } -static void sub_802B008(void) +static void SendLinkData_Leader(void) { - if (!gUnknown_02022CFC->unk2C) - sub_802E138(gUnknown_02022CFC->unk82E4, &gUnknown_02022CFC->unk70); + if (!sPokemonJump->linkTimer) + SendPacket_LeaderState(sPokemonJump->players, &sPokemonJump->comm); - if (gUnknown_02022CFC->unk30 != 0x1111) + if (sPokemonJump->linkTimerLimit != LINK_TIMER_STOPPED) { - gUnknown_02022CFC->unk2C++; - gUnknown_02022CFC->unk2C &= gUnknown_02022CFC->unk30; + sPokemonJump->linkTimer++; + sPokemonJump->linkTimer &= sPokemonJump->linkTimerLimit; } } -static void sub_802B044(u8 arg0) +static void SetFunc_Member(u8 funcId) { - gUnknown_02022CFC->unk70.unk0 = arg0; - gUnknown_02022CFC->unk8 = 0; - gUnknown_02022CFC->unkA = 0; - gUnknown_02022CFC->unk48 = 1; - gUnknown_02022CFC->unk82E4[gUnknown_02022CFC->unk6].unk18 = 0; + sPokemonJump->comm.funcId = funcId; + sPokemonJump->mainState = 0; + sPokemonJump->helperState = 0; + sPokemonJump->funcActive = TRUE; + sPokemonJump->players[sPokemonJump->multiplayerId].funcFinished = FALSE; } -static void sub_802B078(void) +static void RecvLinkData_Member(void) { int i; - u16 var0; - struct PokemonJump1Sub sp0; + u16 monState; + struct PokemonJump_CommData leaderData; - var0 = gUnknown_02022CFC->unk82E4[0].unk10; - if (sub_802E1BC(gUnknown_02022CFC->unk82E4, &sp0)) + monState = sPokemonJump->players[0].monState; + if (RecvPacket_LeaderState(sPokemonJump->players, &leaderData)) { - if (gUnknown_02022CFC->unk82E4[gUnknown_02022CFC->unk6].unk18 == 1 - && sp0.unk0 != gUnknown_02022CFC->unk70.unk0) + if (sPokemonJump->players[sPokemonJump->multiplayerId].funcFinished == TRUE + && leaderData.funcId != sPokemonJump->comm.funcId) { - sub_802B044(sp0.unk0); + SetFunc_Member(leaderData.funcId); } - if (gUnknown_02022CFC->unk70.unk8 != sp0.unk8) + if (sPokemonJump->comm.jumpScore != leaderData.jumpScore) { - gUnknown_02022CFC->unk70.unk8 = sp0.unk8; - gUnknown_02022CFC->unk5C = 1; - gUnknown_02022CFC->unk70.unk1 = sp0.unk1; - if (gUnknown_02022CFC->unk70.unk1) - gUnknown_02022CFC->unk4D = 1; + sPokemonJump->comm.jumpScore = leaderData.jumpScore; + sPokemonJump->updateScore = TRUE; + sPokemonJump->comm.receivedBonusFlags = leaderData.receivedBonusFlags; + if (sPokemonJump->comm.receivedBonusFlags) + sPokemonJump->showBonus = TRUE; else - gUnknown_02022CFC->unk4D = 0; + sPokemonJump->showBonus = FALSE; } - gUnknown_02022CFC->unk70.unk2 = sp0.unk2; - gUnknown_02022CFC->unk70.unk4 = sp0.unk4; - gUnknown_02022CFC->unk82E4[0].unk12 = var0; + sPokemonJump->comm.data = leaderData.data; + sPokemonJump->comm.jumpsInRow = leaderData.jumpsInRow; + sPokemonJump->players[0].prevMonState = monState; } - for (i = 1; i < gUnknown_02022CFC->unk5; i++) + for (i = 1; i < sPokemonJump->numPlayers; i++) { - if (i != gUnknown_02022CFC->unk6) + if (i != sPokemonJump->multiplayerId) { - var0 = gUnknown_02022CFC->unk82E4[i].unk10; - if (sub_802E2D0(&gUnknown_02022CFC->unk82E4[i], i)) - gUnknown_02022CFC->unk82E4[i].unk12 = var0; + monState = sPokemonJump->players[i].monState; + if (RecvPacket_MemberStateToMember(&sPokemonJump->players[i], i)) + sPokemonJump->players[i].prevMonState = monState; } } } -static bool32 (* const gUnknown_082FB618[])(void) = +static bool32 (* const sPokeJumpMemberFuncs[])(void) = { - sub_802B29C, - sub_802B31C, - sub_802B3B4, - sub_802B470, - sub_802B568, - sub_802B628, - sub_802B664, - sub_802B704, - sub_802B720, + [FUNC_GAME_INTRO] = GameIntro_Member, + [FUNC_WAIT_ROUND] = WaitRound_Member, + [FUNC_GAME_ROUND] = GameRound_Member, + [FUNC_GAME_OVER] = GameOver_Member, + [FUNC_ASK_PLAY_AGAIN] = AskPlayAgain_Member, + [FUNC_RESET_GAME] = ResetGame_Member, + [FUNC_EXIT] = ExitGame, + [FUNC_GIVE_PRIZE] = GivePrize_Member, + [FUNC_SAVE] = SavePokeJump, }; -static void sub_802B194(u8 taskId) +static void Task_PokemonJump_Member(u8 taskId) { - sub_802B078(); - if (gUnknown_02022CFC->unk48) + RecvLinkData_Member(); + if (sPokemonJump->funcActive) { - if (!gUnknown_082FB618[gUnknown_02022CFC->unk70.unk0]()) + if (!sPokeJumpMemberFuncs[sPokemonJump->comm.funcId]()) { - gUnknown_02022CFC->unk48 = 0; - gUnknown_02022CFC->unk82E4[gUnknown_02022CFC->unk6].unk18 = 1; - sub_802AE14(3); + sPokemonJump->funcActive = FALSE; + sPokemonJump->players[sPokemonJump->multiplayerId].funcFinished = TRUE; + SetLinkTimeInterval(LINK_INTERVAL_SHORT); } } - sub_802C1DC(); - sub_802B1FC(); + UpdateGame(); + SendLinkData_Member(); } -static void sub_802B1FC(void) +static void SendLinkData_Member(void) { - if (!gUnknown_02022CFC->unk2C) - sub_802E234(&gUnknown_02022CFC->unk82E4[gUnknown_02022CFC->unk6], gUnknown_02022CFC->unk70.unk0, gUnknown_02022CFC->unk42); + if (!sPokemonJump->linkTimer) + SendPacket_MemberState(&sPokemonJump->players[sPokemonJump->multiplayerId], sPokemonJump->comm.funcId, sPokemonJump->playAgainComm); - if (gUnknown_02022CFC->unk30 != 0x1111) + if (sPokemonJump->linkTimerLimit != LINK_TIMER_STOPPED) { - gUnknown_02022CFC->unk2C++; - gUnknown_02022CFC->unk2C &= gUnknown_02022CFC->unk30; + sPokemonJump->linkTimer++; + sPokemonJump->linkTimer &= sPokemonJump->linkTimerLimit; } } -static bool32 sub_802B248(void) +static bool32 GameIntro_Leader(void) { - switch (gUnknown_02022CFC->unk8) + switch (sPokemonJump->mainState) { case 0: - sub_802AE14(3); - gUnknown_02022CFC->unk8++; + SetLinkTimeInterval(LINK_INTERVAL_SHORT); + sPokemonJump->mainState++; // fall through case 1: - if (!sub_802B7E0()) + if (!DoGameIntro()) { - gUnknown_02022CFC->unk70.unk2 = gUnknown_02022CFC->unk4A; - gUnknown_02022CFC->unk4C = 1; + sPokemonJump->comm.data = sPokemonJump->vineTimer; + sPokemonJump->nextFuncId = FUNC_WAIT_ROUND; return FALSE; } break; @@ -827,35 +961,35 @@ static bool32 sub_802B248(void) return TRUE; } -static bool32 sub_802B29C(void) +static bool32 GameIntro_Member(void) { - switch (gUnknown_02022CFC->unk8) + switch (sPokemonJump->mainState) { case 0: - sub_802AE14(0); - gUnknown_02022CFC->unk24 = gUnknown_02022CFC->unk70.unk2; - gUnknown_02022CFC->unk8++; + SetLinkTimeInterval(LINK_INTERVAL_NONE); + sPokemonJump->rngSeed = sPokemonJump->comm.data; + sPokemonJump->mainState++; // fall through case 1: - return sub_802B7E0(); + return DoGameIntro(); } return TRUE; } -static bool32 sub_802B2D4(void) +static bool32 WaitRound_Leader(void) { - switch (gUnknown_02022CFC->unk8) + switch (sPokemonJump->mainState) { case 0: - sub_802C0E8(); - sub_802AE14(5); - gUnknown_02022CFC->unk8++; + ResetPlayersJumpStates(); + SetLinkTimeInterval(LINK_INTERVAL_LONG); + sPokemonJump->mainState++; break; case 1: - if (gUnknown_02022CFC->unk49) + if (sPokemonJump->allPlayersReady) { - gUnknown_02022CFC->unk4C = 2; + sPokemonJump->nextFuncId = FUNC_GAME_ROUND; return FALSE; } break; @@ -864,15 +998,15 @@ static bool32 sub_802B2D4(void) return TRUE; } -static bool32 sub_802B31C(void) +static bool32 WaitRound_Member(void) { - switch (gUnknown_02022CFC->unk8) + switch (sPokemonJump->mainState) { case 0: - sub_802C0E8(); - sub_802AE14(0); - gUnknown_02022CFC->unk4A = gUnknown_02022CFC->unk70.unk2; - gUnknown_02022CFC->unk8++; + ResetPlayersJumpStates(); + SetLinkTimeInterval(LINK_INTERVAL_NONE); + sPokemonJump->vineTimer = sPokemonJump->comm.data; + sPokemonJump->mainState++; // fall through case 1: if (AreLinkQueuesEmpty()) @@ -883,67 +1017,68 @@ static bool32 sub_802B31C(void) return TRUE; } -static bool32 sub_802B368(void) +static bool32 GameRound_Leader(void) { - if (!sub_802B8CC()) + if (!HandleSwingRound()) { - gUnknown_02022CFC->unk70.unk2 = gUnknown_02022CFC->unk4A; - gUnknown_02022CFC->unk4C = 1; + sPokemonJump->comm.data = sPokemonJump->vineTimer; + sPokemonJump->nextFuncId = FUNC_WAIT_ROUND; } - else if (sub_802C538()) + else if (UpdateVineHitStates()) { return TRUE; } else { - sub_802C0B8(); - gUnknown_02022CFC->unk4C = 3; + // Someone hit the vine + ResetVineAfterHit(); + sPokemonJump->nextFuncId = FUNC_GAME_OVER; } return FALSE; } -static bool32 sub_802B3B4(void) +static bool32 GameRound_Member(void) { - if (!sub_802B8CC()) + if (!HandleSwingRound()) ; - else if (sub_802C538()) + else if (UpdateVineHitStates()) return TRUE; - else - sub_802C0B8(); + else // Someone hit the vine + ResetVineAfterHit(); return FALSE; } -static bool32 sub_802B3D4(void) +static bool32 GameOver_Leader(void) { - switch (gUnknown_02022CFC->unk8) + switch (sPokemonJump->mainState) { case 0: - sub_802C538(); - if (sub_802C5DC()) - gUnknown_02022CFC->unk8++; + UpdateVineHitStates(); + if (AllPlayersJumpedOrHit()) + sPokemonJump->mainState++; break; case 1: - if (!sub_802B964()) + if (!DoVineHitEffect()) { - if (sub_802C7BC()) + if (HasEnoughScoreForPrize()) { - gUnknown_02022CFC->unk70.unk2 = sub_802C7E0(); - gUnknown_02022CFC->unk4C = 7; + sPokemonJump->comm.data = GetPrizeData(); + sPokemonJump->nextFuncId = FUNC_GIVE_PRIZE; } - else if (gUnknown_02022CFC->unk70.unk4 >= 200) + else if (sPokemonJump->comm.jumpsInRow >= 200) { - gUnknown_02022CFC->unk70.unk2 = gUnknown_02022CFC->unkE; - gUnknown_02022CFC->unk4C = 8; + sPokemonJump->comm.data = sPokemonJump->excellentsInRowRecord; + sPokemonJump->nextFuncId = FUNC_SAVE; } else { - gUnknown_02022CFC->unk70.unk2 = gUnknown_02022CFC->unkE; - gUnknown_02022CFC->unk4C = 4; + sPokemonJump->comm.data = sPokemonJump->excellentsInRowRecord; + sPokemonJump->nextFuncId = FUNC_ASK_PLAY_AGAIN; } - gUnknown_02022CFC->unk8++; + sPokemonJump->mainState++; return FALSE; } break; @@ -954,20 +1089,20 @@ static bool32 sub_802B3D4(void) return TRUE; } -static bool32 sub_802B470(void) +static bool32 GameOver_Member(void) { - switch (gUnknown_02022CFC->unk8) + switch (sPokemonJump->mainState) { case 0: - if (!sub_802C538()) - sub_802C0B8(); - if (sub_802C5DC()) - gUnknown_02022CFC->unk8++; + if (!UpdateVineHitStates()) + ResetVineAfterHit(); + if (AllPlayersJumpedOrHit()) + sPokemonJump->mainState++; break; case 1: - if (!sub_802B964()) + if (!DoVineHitEffect()) { - gUnknown_02022CFC->unk8++; + sPokemonJump->mainState++; return FALSE; } break; @@ -978,30 +1113,30 @@ static bool32 sub_802B470(void) return TRUE; } -static bool32 sub_802B4CC(void) +static bool32 AskPlayAgain_Leader(void) { - switch (gUnknown_02022CFC->unk8) + switch (sPokemonJump->mainState) { case 0: - sub_802AE14(4); - gUnknown_02022CFC->unk8++; + SetLinkTimeInterval(LINK_INTERVAL_MEDIUM); + sPokemonJump->mainState++; // fall through case 1: - if (!sub_802BB84()) + if (!DoPlayAgainPrompt()) { - sub_802E354(gUnknown_02022CFC->unk70.unk8, gUnknown_02022CFC->unk70.unk4, gUnknown_02022CFC->unk70.unk2); - gUnknown_02022CFC->unk8++; + TryUpdateRecords(sPokemonJump->comm.jumpScore, sPokemonJump->comm.jumpsInRow, sPokemonJump->comm.data); + sPokemonJump->mainState++; } break; case 2: - if (gUnknown_02022CFC->unk49) + if (sPokemonJump->allPlayersReady) { - if (sub_802C650()) - gUnknown_02022CFC->unk4C = 5; + if (ShouldPlayAgain()) + sPokemonJump->nextFuncId = FUNC_RESET_GAME; else - gUnknown_02022CFC->unk4C = 6; + sPokemonJump->nextFuncId = FUNC_EXIT; - gUnknown_02022CFC->unk8++; + sPokemonJump->mainState++; return FALSE; } break; @@ -1012,19 +1147,19 @@ static bool32 sub_802B4CC(void) return TRUE; } -static bool32 sub_802B568(void) +static bool32 AskPlayAgain_Member(void) { - switch (gUnknown_02022CFC->unk8) + switch (sPokemonJump->mainState) { case 0: - sub_802AE14(0); - gUnknown_02022CFC->unk8++; + SetLinkTimeInterval(LINK_INTERVAL_NONE); + sPokemonJump->mainState++; // fall through case 1: - if (!sub_802BB84()) + if (!DoPlayAgainPrompt()) { - sub_802E354(gUnknown_02022CFC->unk70.unk8, gUnknown_02022CFC->unk70.unk4, gUnknown_02022CFC->unk70.unk2); - gUnknown_02022CFC->unk42 = gUnknown_02022CFC->unk45; + TryUpdateRecords(sPokemonJump->comm.jumpScore, sPokemonJump->comm.jumpsInRow, sPokemonJump->comm.data); + sPokemonJump->playAgainComm = sPokemonJump->playAgainState; return FALSE; } break; @@ -1033,21 +1168,21 @@ static bool32 sub_802B568(void) return TRUE; } -static bool32 sub_802B5C8(void) +static bool32 ResetGame_Leader(void) { - switch (gUnknown_02022CFC->unk8) + switch (sPokemonJump->mainState) { case 0: - if (!sub_802BD30()) - gUnknown_02022CFC->unk8++; + if (!CloseMessageAndResetScore()) + sPokemonJump->mainState++; break; case 1: - if (gUnknown_02022CFC->unk49) + if (sPokemonJump->allPlayersReady) { - sub_802AA94(gUnknown_02022CFC); - gUnknown_02022CFC->unk24 = Random(); - gUnknown_02022CFC->unk70.unk2 = gUnknown_02022CFC->unk24; - gUnknown_02022CFC->unk4C = 0; + ResetForNewGame(sPokemonJump); + sPokemonJump->rngSeed = Random(); + sPokemonJump->comm.data = sPokemonJump->rngSeed; + sPokemonJump->nextFuncId = FUNC_GAME_INTRO; return FALSE; } break; @@ -1056,15 +1191,15 @@ static bool32 sub_802B5C8(void) return TRUE; } -static bool32 sub_802B628(void) +static bool32 ResetGame_Member(void) { - switch (gUnknown_02022CFC->unk8) + switch (sPokemonJump->mainState) { case 0: - if (!sub_802BD30()) + if (!CloseMessageAndResetScore()) { - sub_802AA94(gUnknown_02022CFC); - gUnknown_02022CFC->unk8++; + ResetForNewGame(sPokemonJump); + sPokemonJump->mainState++; return FALSE; } break; @@ -1075,22 +1210,22 @@ static bool32 sub_802B628(void) return TRUE; } -static bool32 sub_802B664(void) +static bool32 ExitGame(void) { - switch (gUnknown_02022CFC->unk8) + switch (sPokemonJump->mainState) { case 0: - gUnknown_02022CFC->unk8 = 1; + sPokemonJump->mainState = 1; break; case 1: - sub_802AE14(0); - gUnknown_02022CFC->unk8++; + SetLinkTimeInterval(LINK_INTERVAL_NONE); + sPokemonJump->mainState++; break; case 2: - if (!sub_802BC60()) + if (!ClosePokeJumpLink()) { - SetMainCallback2(gUnknown_02022CFC->returnCallback); - sub_802AA48(); + SetMainCallback2(sPokemonJump->exitCallback); + FreePokemonJump(); } break; } @@ -1098,19 +1233,19 @@ static bool32 sub_802B664(void) return TRUE; } -static bool32 sub_802B6B8(void) +static bool32 GivePrize_Leader(void) { - switch (gUnknown_02022CFC->unk8) + switch (sPokemonJump->mainState) { case 0: - sub_802AE14(4); - gUnknown_02022CFC->unk8++; + SetLinkTimeInterval(LINK_INTERVAL_MEDIUM); + sPokemonJump->mainState++; break; case 1: - if (!sub_802BA58()) + if (!TryGivePrize()) { - gUnknown_02022CFC->unk70.unk2 = gUnknown_02022CFC->unkE; - gUnknown_02022CFC->unk4C = 8; + sPokemonJump->comm.data = sPokemonJump->excellentsInRowRecord; + sPokemonJump->nextFuncId = FUNC_SAVE; return FALSE; } break; @@ -1119,49 +1254,49 @@ static bool32 sub_802B6B8(void) return TRUE; } -static bool32 sub_802B704(void) +static bool32 GivePrize_Member(void) { - sub_802AE14(0); - if (!sub_802BA58()) + SetLinkTimeInterval(LINK_INTERVAL_NONE); + if (!TryGivePrize()) return FALSE; else return TRUE; } -static bool32 sub_802B720(void) +static bool32 SavePokeJump(void) { - switch (gUnknown_02022CFC->unk8) + switch (sPokemonJump->mainState) { case 0: - sub_802E354(gUnknown_02022CFC->unk70.unk8, gUnknown_02022CFC->unk70.unk4, gUnknown_02022CFC->unk70.unk2); - sub_802D0C8(5); - gUnknown_02022CFC->unk8++; + TryUpdateRecords(sPokemonJump->comm.jumpScore, sPokemonJump->comm.jumpsInRow, sPokemonJump->comm.data); + SetUpPokeJumpGfxFuncById(GFXFUNC_MSG_SAVING); + sPokemonJump->mainState++; break; case 1: - if (!sub_802D0F0()) + if (!IsPokeJumpGfxFuncFinished()) { - sub_802AE14(0); - gUnknown_02022CFC->unk8++; + SetLinkTimeInterval(LINK_INTERVAL_NONE); + sPokemonJump->mainState++; } break; case 2: if (AreLinkQueuesEmpty()) { CreateTask(Task_LinkSave, 6); - gUnknown_02022CFC->unk8++; + sPokemonJump->mainState++; } break; case 3: if (!FuncIsActiveTask(Task_LinkSave)) { - sub_802DA14(); - gUnknown_02022CFC->unk8++; + ClearMessageWindow(); + sPokemonJump->mainState++; } break; case 4: - if (!sub_802DA44()) + if (!RemoveMessageWindow()) { - gUnknown_02022CFC->unk4C = 4; + sPokemonJump->nextFuncId = FUNC_ASK_PLAY_AGAIN; return FALSE; } break; @@ -1170,52 +1305,52 @@ static bool32 sub_802B720(void) return TRUE; } -static bool32 sub_802B7E0(void) +static bool32 DoGameIntro(void) { - switch (gUnknown_02022CFC->unkA) + switch (sPokemonJump->helperState) { case 0: - sub_802D0C8(2); - sub_802DDE0(); - gUnknown_02022CFC->unkA++; + SetUpPokeJumpGfxFuncById(GFXFUNC_SHOW_NAMES_HIGHLIGHT); + ResetMonSpriteSubpriorities(); + sPokemonJump->helperState++; break; case 1: - if (!sub_802D0F0()) + if (!IsPokeJumpGfxFuncFinished()) { - sub_802DDF4(gUnknown_02022CFC->unk6); - gUnknown_02022CFC->unk3C = 0; - gUnknown_02022CFC->unkA++; + StartMonIntroBounce(sPokemonJump->multiplayerId); + sPokemonJump->timer = 0; + sPokemonJump->helperState++; } break; case 2: - if (++gUnknown_02022CFC->unk3C > 120) + if (++sPokemonJump->timer > 120) { - sub_802D0C8(3); - gUnknown_02022CFC->unkA++; + SetUpPokeJumpGfxFuncById(GFXFUNC_ERASE_NAMES); + sPokemonJump->helperState++; } break; case 3: - if (sub_802D0F0() != 1 && sub_802DE08() != 1) - gUnknown_02022CFC->unkA++; + if (IsPokeJumpGfxFuncFinished() != TRUE && IsMonIntroBounceActive() != TRUE) + sPokemonJump->helperState++; break; case 4: - sub_802D0C8(9); - gUnknown_02022CFC->unkA++; + SetUpPokeJumpGfxFuncById(GFXFUNC_COUNTDOWN); + sPokemonJump->helperState++; break; case 5: - if (!sub_802D0F0()) + if (!IsPokeJumpGfxFuncFinished()) { - sub_802C260(); - sub_802D764(); - gUnknown_02022CFC->unkA++; + DisallowVineUpdates(); + SetUpResetVineGfx(); + sPokemonJump->helperState++; } break; case 6: - if (!sub_802D788()) + if (!ResetVineGfx()) { - sub_802C270(); - sub_802BEA0(); - gUnknown_02022CFC->unkA++; + AllowVineUpdates(); + ResetVineState(); + sPokemonJump->helperState++; return FALSE; } break; @@ -1226,85 +1361,88 @@ static bool32 sub_802B7E0(void) return TRUE; } -static bool32 sub_802B8CC(void) +// Update the vine and wait for player to input a jump +// Returns false when vine reaches the 'hit' point, after +// which input is ignored +static bool32 HandleSwingRound(void) { - sub_802BEE4(); - if (gUnknown_02022CFC->unk36) + UpdateVineState(); + if (sPokemonJump->ignoreJumpInput) { - gUnknown_02022CFC->unk36 = 0; + sPokemonJump->ignoreJumpInput = FALSE; return FALSE; } - switch (gUnknown_02022CFC->unkA) + switch (sPokemonJump->helperState) { case 0: - if (sub_802C130(0)) - gUnknown_02022CFC->unkA++; + if (IsPlayersMonState(MONSTATE_NORMAL)) + sPokemonJump->helperState++; else break; // fall through case 1: if (JOY_NEW(A_BUTTON)) { - sub_802C164(); - sub_802AE14(3); - gUnknown_02022CFC->unkA++; + SetMonStateJump(); + SetLinkTimeInterval(LINK_INTERVAL_SHORT); + sPokemonJump->helperState++; } break; case 2: - if (sub_802C130(1) == TRUE) - gUnknown_02022CFC->unkA++; + if (IsPlayersMonState(MONSTATE_JUMP) == TRUE) + sPokemonJump->helperState++; break; case 3: - if (sub_802C130(0) == TRUE) - gUnknown_02022CFC->unkA = 0; + if (IsPlayersMonState(MONSTATE_NORMAL) == TRUE) + sPokemonJump->helperState = 0; break; } return TRUE; } -static bool32 sub_802B964(void) +static bool32 DoVineHitEffect(void) { int i; - switch (gUnknown_02022CFC->unkA) + switch (sPokemonJump->helperState) { case 0: - for (i = 0; i < gUnknown_02022CFC->unk5; i++) + for (i = 0; i < sPokemonJump->numPlayers; i++) { - if (sub_802DDB8(i) == 1) + if (IsMonHitShakeActive(i) == TRUE) return TRUE; } - gUnknown_02022CFC->unkA++; + sPokemonJump->helperState++; break; case 1: - for (i = 0; i < gUnknown_02022CFC->unk5; i++) + for (i = 0; i < sPokemonJump->numPlayers; i++) { - if (gUnknown_02022CFC->unk82E4[i].unk10 == 2) - sub_802DDA0(i); + if (sPokemonJump->players[i].monState == MONSTATE_HIT) + StartMonHitFlash(i); } - sub_802D0C8(1); - gUnknown_02022CFC->unk3C = 0; - gUnknown_02022CFC->unkA++; + SetUpPokeJumpGfxFuncById(GFXFUNC_SHOW_NAMES); + sPokemonJump->timer = 0; + sPokemonJump->helperState++; break; case 2: - if (++gUnknown_02022CFC->unk3C > 100) + if (++sPokemonJump->timer > 100) { - sub_802D0C8(3); - gUnknown_02022CFC->unk3C = 0; - gUnknown_02022CFC->unkA++; + SetUpPokeJumpGfxFuncById(GFXFUNC_ERASE_NAMES); + sPokemonJump->timer = 0; + sPokemonJump->helperState++; } break; case 3: - if (!sub_802D0F0()) + if (!IsPokeJumpGfxFuncFinished()) { - sub_802DDCC(); - gUnknown_02022CFC->unk70.unk1 = 0; - sub_802C114(); - gUnknown_02022CFC->unkA++; + StopMonHitFlash(); + sPokemonJump->comm.receivedBonusFlags = 0; + ResetPlayersMonState(); + sPokemonJump->helperState++; return FALSE; } break; @@ -1315,58 +1453,61 @@ static bool32 sub_802B964(void) return TRUE; } -static bool32 sub_802BA58(void) +static bool32 TryGivePrize(void) { - switch (gUnknown_02022CFC->unkA) + switch (sPokemonJump->helperState) { case 0: - sub_802C808(gUnknown_02022CFC->unk70.unk2, &gUnknown_02022CFC->unk3E, &gUnknown_02022CFC->unk40); - sub_802D7E8(gUnknown_02022CFC->unk3E, gUnknown_02022CFC->unk40); - gUnknown_02022CFC->unkA++; + UnpackPrizeData(sPokemonJump->comm.data, &sPokemonJump->prizeItemId, &sPokemonJump->prizeItemQuantity); + PrintPrizeMessage(sPokemonJump->prizeItemId, sPokemonJump->prizeItemQuantity); + sPokemonJump->helperState++; break; case 1: case 4: - if (!sub_802D974()) + if (!DoPrizeMessageAndFanfare()) { - gUnknown_02022CFC->unk3C = 0; - gUnknown_02022CFC->unkA++; + sPokemonJump->timer = 0; + sPokemonJump->helperState++; } break; case 2: case 5: - gUnknown_02022CFC->unk3C++; - if (JOY_NEW(A_BUTTON | B_BUTTON) || gUnknown_02022CFC->unk3C > 180) + // Wait to continue after message + sPokemonJump->timer++; + if (JOY_NEW(A_BUTTON | B_BUTTON) || sPokemonJump->timer > 180) { - sub_802DA14(); - gUnknown_02022CFC->unkA++; + ClearMessageWindow(); + sPokemonJump->helperState++; } break; case 3: - if (!sub_802DA44()) + if (!RemoveMessageWindow()) { - gUnknown_02022CFC->unk40 = sub_802C880(gUnknown_02022CFC->unk3E, gUnknown_02022CFC->unk40); - if (gUnknown_02022CFC->unk40 && AddBagItem(gUnknown_02022CFC->unk3E, gUnknown_02022CFC->unk40)) + sPokemonJump->prizeItemQuantity = GetQuantityLimitedByBag(sPokemonJump->prizeItemId, sPokemonJump->prizeItemQuantity); + if (sPokemonJump->prizeItemQuantity && AddBagItem(sPokemonJump->prizeItemId, sPokemonJump->prizeItemQuantity)) { - if (!CheckBagHasSpace(gUnknown_02022CFC->unk3E, 1)) + if (!CheckBagHasSpace(sPokemonJump->prizeItemId, 1)) { - sub_802D884(gUnknown_02022CFC->unk3E); - gUnknown_02022CFC->unkA = 4; + // An item was given successfully, but no room for any more. + // It's possible the full prize quantity had to be limited + PrintPrizeFilledBagMessage(sPokemonJump->prizeItemId); + sPokemonJump->helperState = 4; // Do message } else { - gUnknown_02022CFC->unkA = 6; + sPokemonJump->helperState = 6; // Exit break; } } else { - sub_802D8FC(gUnknown_02022CFC->unk3E); - gUnknown_02022CFC->unkA = 4; + PrintNoRoomForPrizeMessage(sPokemonJump->prizeItemId); + sPokemonJump->helperState = 4; // Do message } } break; case 6: - if (!sub_802DA44()) + if (!RemoveMessageWindow()) return FALSE; break; } @@ -1374,49 +1515,49 @@ static bool32 sub_802BA58(void) return TRUE; } -static bool32 sub_802BB84(void) +static bool32 DoPlayAgainPrompt(void) { s8 input; - switch (gUnknown_02022CFC->unkA) + switch (sPokemonJump->helperState) { case 0: - sub_802D0C8(4); - gUnknown_02022CFC->unkA++; + SetUpPokeJumpGfxFuncById(GFXFUNC_MSG_PLAY_AGAIN); + sPokemonJump->helperState++; break; case 1: - if (!sub_802D0F0()) - gUnknown_02022CFC->unkA++; + if (!IsPokeJumpGfxFuncFinished()) + sPokemonJump->helperState++; break; case 2: - input = sub_802DA8C(); + input = HandlePlayAgainInput(); switch (input) { case MENU_B_PRESSED: - case 1: - gUnknown_02022CFC->unk45 = 1; - sub_802D0C8(6); - gUnknown_02022CFC->unkA++; + case 1: // No + sPokemonJump->playAgainState = PLAY_AGAIN_NO; + SetUpPokeJumpGfxFuncById(GFXFUNC_ERASE_MSG); + sPokemonJump->helperState++; break; - case 0: - gUnknown_02022CFC->unk45 = 2; - sub_802D0C8(6); - gUnknown_02022CFC->unkA++; + case 0: // Yes + sPokemonJump->playAgainState = PLAY_AGAIN_YES; + SetUpPokeJumpGfxFuncById(GFXFUNC_ERASE_MSG); + sPokemonJump->helperState++; break; } break; case 3: - if (!sub_802D0F0()) - gUnknown_02022CFC->unkA++; + if (!IsPokeJumpGfxFuncFinished()) + sPokemonJump->helperState++; break; case 4: - sub_802D0C8(8); - gUnknown_02022CFC->unkA++; + SetUpPokeJumpGfxFuncById(GFXFUNC_MSG_COMM_STANDBY); + sPokemonJump->helperState++; break; case 5: - if (!sub_802D0F0()) + if (!IsPokeJumpGfxFuncFinished()) { - gUnknown_02022CFC->unkA++; + sPokemonJump->helperState++; return FALSE; } break; @@ -1427,43 +1568,40 @@ static bool32 sub_802BB84(void) return TRUE; } -static bool32 sub_802BC60(void) +static bool32 ClosePokeJumpLink(void) { - int var0; - - switch (gUnknown_02022CFC->unkA) + switch (sPokemonJump->helperState) { case 0: - sub_802DA14(); - gUnknown_02022CFC->unkA++; + ClearMessageWindow(); + sPokemonJump->helperState++; break; case 1: - if (!sub_802DA44()) + if (!RemoveMessageWindow()) { - sub_802D0C8(7); - gUnknown_02022CFC->unkA++; + SetUpPokeJumpGfxFuncById(GFXFUNC_MSG_PLAYER_DROPPED); + sPokemonJump->helperState++; } break; case 2: - var0 = sub_802D0F0(); - if (!var0) + if (!IsPokeJumpGfxFuncFinished()) { - gUnknown_02022CFC->unk3C = var0; - gUnknown_02022CFC->unkA++; + sPokemonJump->timer = 0; + sPokemonJump->helperState++; } break; case 3: - if (++gUnknown_02022CFC->unk3C > 120) + if (++sPokemonJump->timer > 120) { - BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); - gUnknown_02022CFC->unkA++; + BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 16, RGB_BLACK); + sPokemonJump->helperState++; } break; case 4: if (!gPaletteFade.active) { SetCloseLinkCallback(); - gUnknown_02022CFC->unkA++; + sPokemonJump->helperState++; } break; case 5: @@ -1475,19 +1613,19 @@ static bool32 sub_802BC60(void) return TRUE; } -static bool32 sub_802BD30(void) +static bool32 CloseMessageAndResetScore(void) { - switch (gUnknown_02022CFC->unkA) + switch (sPokemonJump->helperState) { case 0: - sub_802DA14(); - sub_802DD64(0); - gUnknown_02022CFC->unkA++; + ClearMessageWindow(); + PrintScore(0); + sPokemonJump->helperState++; break; case 1: - if (!sub_802DA44()) + if (!RemoveMessageWindow()) { - gUnknown_02022CFC->unkA++; + sPokemonJump->helperState++; return FALSE; } break; @@ -1498,32 +1636,37 @@ static bool32 sub_802BD30(void) return TRUE; } -static void sub_802BD84(u8 taskId) +#define tState data[0] +#define tNumReceived data[1] +#define tReceivedPacket(playerId) data[(playerId) + 2] +#define DATAIDX_GAME_STRUCT 14 + +static void Task_CommunicateMonInfo(u8 taskId) { int i; - s16 *taskData = gTasks[taskId].data; - struct PokemonJump1 *ptr = (struct PokemonJump1 *)GetWordTaskArg(taskId, 14); + s16 *data = gTasks[taskId].data; + struct PokemonJump *jump = (struct PokemonJump *)GetWordTaskArg(taskId, DATAIDX_GAME_STRUCT); - switch (taskData[0]) + switch (tState) { case 0: for (i = 0; i < MAX_RFU_PLAYERS; i++) - taskData[i + 2] = 0; + tReceivedPacket(i) = FALSE; - taskData[0]++; + tState++; // fall through case 1: - sub_802E0AC(&ptr->unk82A8[ptr->unk6]); + SendPacket_MonInfo(&jump->monInfo[jump->multiplayerId]); for (i = 0; i < MAX_RFU_PLAYERS; i++) { - if (!taskData[i + 2] && sub_802E0D0(i, &ptr->unk82A8[i])) + if (!tReceivedPacket(i) && RecvPacket_MonInfo(i, &jump->monInfo[i])) { - StringCopy(ptr->unk82E4[i].unk1C, gLinkPlayers[i].name); - taskData[i + 2] = 1; - taskData[1]++; - if (taskData[1] == ptr->unk5) + StringCopy(jump->players[i].name, gLinkPlayers[i].name); + tReceivedPacket(i) = TRUE; + tNumReceived++; + if (tNumReceived == jump->numPlayers) { - sub_802AB20(); + InitPlayerAndJumpTypes(); DestroyTask(taskId); break; } @@ -1533,495 +1676,528 @@ static void sub_802BD84(u8 taskId) } } -static void sub_802BE60(TaskFunc func, u8 taskPriority) +static void SetTaskWithPokeJumpStruct(TaskFunc func, u8 taskPriority) { u8 taskId = CreateTask(func, taskPriority); - SetWordTaskArg(taskId, 14, (u32)gUnknown_02022CFC); + SetWordTaskArg(taskId, DATAIDX_GAME_STRUCT, (u32)sPokemonJump); } -static void sub_802BE80(void) +#undef tState +#undef tNumReceived +#undef tReceivedPacket +#undef DATAIDX_GAME_STRUCT + +static void InitVineState(void) { - gUnknown_02022CFC->unk4A = 0; - gUnknown_02022CFC->unk14 = 6; - gUnknown_02022CFC->unk34 = 0; - gUnknown_02022CFC->unk1C = 0; - gUnknown_02022CFC->unk36 = 0; - gUnknown_02022CFC->unk10 = 0; + sPokemonJump->vineTimer = 0; + sPokemonJump->vineState = VINE_UPSWING_LOWER; + sPokemonJump->vineStateTimer = 0; + sPokemonJump->vineSpeed = 0; + sPokemonJump->ignoreJumpInput = FALSE; + sPokemonJump->gameOver = FALSE; } -static void sub_802BEA0(void) +static void ResetVineState(void) { - gUnknown_02022CFC->unk4A = 0; - gUnknown_02022CFC->unk34 = 0x6FF; - gUnknown_02022CFC->unk14 = 7; - gUnknown_02022CFC->unk36 = 0; - gUnknown_02022CFC->unk10 = 0; - gUnknown_02022CFC->unk51 = 0; - gUnknown_02022CFC->unk50 = 0; - gUnknown_02022CFC->unk20 = 0; - gUnknown_02022CFC->unk4E = 0; - gUnknown_02022CFC->unk6C = 0; - sub_802BF7C(); + sPokemonJump->vineTimer = 0; + sPokemonJump->vineStateTimer = VINE_STATE_TIMER(VINE_UPSWING_LOWER); + sPokemonJump->vineState = VINE_UPSWING_LOW; + sPokemonJump->ignoreJumpInput = FALSE; + sPokemonJump->gameOver = FALSE; + sPokemonJump->vineSpeedStage = 0; + sPokemonJump->vineBaseSpeedIdx = 0; + sPokemonJump->vineSpeedAccel = 0; + sPokemonJump->vineSpeedDelay = 0; + sPokemonJump->atMaxSpeedStage = FALSE; + UpdateVineSpeed(); } -static void sub_802BEE4(void) +static void UpdateVineState(void) { - if (gUnknown_02022CFC->unk46) + if (sPokemonJump->allowVineUpdates) { - gUnknown_02022CFC->unk4A++; - gUnknown_02022CFC->unk34 += sub_802BF48(); - if (gUnknown_02022CFC->unk34 >= 0x9FF) - gUnknown_02022CFC->unk34 -= 0x9FF; + sPokemonJump->vineTimer++; + sPokemonJump->vineStateTimer += GetVineSpeed(); + if (sPokemonJump->vineStateTimer >= VINE_STATE_TIMER(NUM_VINESTATES - 1)) + sPokemonJump->vineStateTimer -= VINE_STATE_TIMER(NUM_VINESTATES - 1); - gUnknown_02022CFC->unk18 = gUnknown_02022CFC->unk14; - gUnknown_02022CFC->unk14 = gUnknown_02022CFC->unk34 >> 8; - if (gUnknown_02022CFC->unk14 > 6 && gUnknown_02022CFC->unk18 < 7) + sPokemonJump->prevVineState = sPokemonJump->vineState; + sPokemonJump->vineState = sPokemonJump->vineStateTimer >> 8; + + // If beginning upswing + if (sPokemonJump->vineState > VINE_UPSWING_LOWER && sPokemonJump->prevVineState < VINE_UPSWING_LOW) { - gUnknown_02022CFC->unk36++; - sub_802BF7C(); + sPokemonJump->ignoreJumpInput++; + UpdateVineSpeed(); } } } -static int sub_802BF48(void) +static int GetVineSpeed(void) { - int result; + int speed; - if (gUnknown_02022CFC->unk10) + if (sPokemonJump->gameOver) return 0; - result = gUnknown_02022CFC->unk1C; - if (gUnknown_02022CFC->unk34 <= 0x5FF) + speed = sPokemonJump->vineSpeed; + if (sPokemonJump->vineStateTimer <= VINE_STATE_TIMER(VINE_LOWEST)) { - gUnknown_02022CFC->unk20 += 80; - result += gUnknown_02022CFC->unk20 >> 8; + // If at or below lowest, then vine is in downswing + // Increase speed in downswing + sPokemonJump->vineSpeedAccel += 80; + speed += sPokemonJump->vineSpeedAccel / 256; } - return result; + return speed; } -static const u16 gUnknown_082FB63C[] = {0x1a, 0x1f, 0x24, 0x29, 0x2e, 0x33, 0x38, 0x3d}; -static const u16 gUnknown_082FB64C[] = {0, 1, 1, 2}; +static const u16 sVineBaseSpeeds[] = {26, 31, 36, 41, 46, 51, 56, 61}; +static const u16 sVineSpeedDelays[] = {0, 1, 1, 2}; -static void sub_802BF7C(void) +static void UpdateVineSpeed(void) { - int var0; + int baseSpeed; - gUnknown_02022CFC->unk20 = 0; - if (gUnknown_02022CFC->unk4E) + sPokemonJump->vineSpeedAccel = 0; + if (sPokemonJump->vineSpeedDelay) { - gUnknown_02022CFC->unk4E--; - if (gUnknown_02022CFC->unk6C) + sPokemonJump->vineSpeedDelay--; + if (sPokemonJump->atMaxSpeedStage) { - if (sub_802C098() % 4 != 0) + if (PokeJumpRandom() % 4) { - gUnknown_02022CFC->unk1C = gUnknown_02022CFC->unk28; + sPokemonJump->vineSpeed = sPokemonJump->nextVineSpeed; } else { - if (gUnknown_02022CFC->unk28 > 54) - gUnknown_02022CFC->unk1C = 30; + if (sPokemonJump->nextVineSpeed > 54) + sPokemonJump->vineSpeed = 30; else - gUnknown_02022CFC->unk1C = 82; + sPokemonJump->vineSpeed = 82; } } } else { - if (!(gUnknown_02022CFC->unk50 & 8)) + if (!(sPokemonJump->vineBaseSpeedIdx & ARRAY_COUNT(sVineBaseSpeeds))) { - gUnknown_02022CFC->unk28 = gUnknown_082FB63C[gUnknown_02022CFC->unk50] + (gUnknown_02022CFC->unk51 * 7); - gUnknown_02022CFC->unk4E = gUnknown_082FB64C[sub_802C098() % ARRAY_COUNT(gUnknown_082FB64C)] + 2; - gUnknown_02022CFC->unk50++; + sPokemonJump->nextVineSpeed = sVineBaseSpeeds[sPokemonJump->vineBaseSpeedIdx] + (sPokemonJump->vineSpeedStage * 7); + sPokemonJump->vineSpeedDelay = sVineSpeedDelays[PokeJumpRandom() % ARRAY_COUNT(sVineSpeedDelays)] + 2; + sPokemonJump->vineBaseSpeedIdx++; } else { - if (gUnknown_02022CFC->unk50 == 8) + if (sPokemonJump->vineBaseSpeedIdx == ARRAY_COUNT(sVineBaseSpeeds)) { - if (gUnknown_02022CFC->unk51 < 3) - gUnknown_02022CFC->unk51++; + if (sPokemonJump->vineSpeedStage < 3) + sPokemonJump->vineSpeedStage++; else - gUnknown_02022CFC->unk6C = 1; + sPokemonJump->atMaxSpeedStage = TRUE; } - var0 = gUnknown_082FB63C[15 - gUnknown_02022CFC->unk50]; - gUnknown_02022CFC->unk28 = var0 + (gUnknown_02022CFC->unk51 * 7); - if (++gUnknown_02022CFC->unk50 > 15) + baseSpeed = sVineBaseSpeeds[15 - sPokemonJump->vineBaseSpeedIdx]; + sPokemonJump->nextVineSpeed = baseSpeed + (sPokemonJump->vineSpeedStage * 7); + if (++sPokemonJump->vineBaseSpeedIdx > 15) { - if (sub_802C098() % 4 == 0) - gUnknown_02022CFC->unk28 -= 5; + if (PokeJumpRandom() % 4 == 0) + sPokemonJump->nextVineSpeed -= 5; - gUnknown_02022CFC->unk50 = 0; + sPokemonJump->vineBaseSpeedIdx = 0; } } - gUnknown_02022CFC->unk1C = gUnknown_02022CFC->unk28; + sPokemonJump->vineSpeed = sPokemonJump->nextVineSpeed; } } -static int sub_802C098(void) +static int PokeJumpRandom(void) { - gUnknown_02022CFC->unk24 = ISO_RANDOMIZE1(gUnknown_02022CFC->unk24); - return gUnknown_02022CFC->unk24 >> 16; + sPokemonJump->rngSeed = ISO_RANDOMIZE1(sPokemonJump->rngSeed); + return sPokemonJump->rngSeed >> 16; } -static void sub_802C0B8(void) +static void ResetVineAfterHit(void) { - gUnknown_02022CFC->unk10 = 1; - gUnknown_02022CFC->unk14 = 6; - gUnknown_02022CFC->unk34 = 0x5FF; - sub_802C270(); + sPokemonJump->gameOver = TRUE; + sPokemonJump->vineState = VINE_UPSWING_LOWER; + sPokemonJump->vineStateTimer = VINE_STATE_TIMER(VINE_LOWEST); + AllowVineUpdates(); } -static int sub_802C0DC(void) +static int IsGameOver(void) { - return gUnknown_02022CFC->unk10; + return sPokemonJump->gameOver; } -static void sub_802C0E8(void) +static void ResetPlayersJumpStates(void) { int i; for (i = 0; i < MAX_RFU_PLAYERS; i++) - gUnknown_02022CFC->unk82E4[i].unk14 = 0; + sPokemonJump->players[i].jumpState = JUMPSTATE_NONE; } -static void sub_802C114(void) +static void ResetPlayersMonState(void) { - gUnknown_02022CFC->unk83AC->unk10 = 0; - gUnknown_02022CFC->unk83AC->unk12 = 0; + sPokemonJump->player->monState = MONSTATE_NORMAL; + sPokemonJump->player->prevMonState = MONSTATE_NORMAL; } -static bool32 sub_802C130(u16 arg0) +static bool32 IsPlayersMonState(u16 monState) { - if (gUnknown_02022CFC->unk82E4[gUnknown_02022CFC->unk6].unk10 == arg0) + if (sPokemonJump->players[sPokemonJump->multiplayerId].monState == monState) return TRUE; else return FALSE; } -static void sub_802C164(void) +static void SetMonStateJump(void) { - gUnknown_02022CFC->unk83AC->unkE = gUnknown_02022CFC->unk4A; - gUnknown_02022CFC->unk83AC->unk12 = gUnknown_02022CFC->unk83AC->unk10; - gUnknown_02022CFC->unk83AC->unk10 = 1; + sPokemonJump->player->jumpTimeStart = sPokemonJump->vineTimer; + sPokemonJump->player->prevMonState = sPokemonJump->player->monState; + sPokemonJump->player->monState = MONSTATE_JUMP; } -static void sub_802C18C(void) +static void SetMonStateHit(void) { - gUnknown_02022CFC->unk83AC->unk12 = gUnknown_02022CFC->unk83AC->unk10; - gUnknown_02022CFC->unk83AC->unk10 = 2; - gUnknown_02022CFC->unk83AC->unkE = gUnknown_02022CFC->unk4A; - gUnknown_02022CFC->unk83AC->unk14 = 2; + sPokemonJump->player->prevMonState = sPokemonJump->player->monState; + sPokemonJump->player->monState = MONSTATE_HIT; + sPokemonJump->player->jumpTimeStart = sPokemonJump->vineTimer; + sPokemonJump->player->jumpState = JUMPSTATE_FAILURE; } -static void sub_802C1BC(void) +static void SetMonStateNormal(void) { - gUnknown_02022CFC->unk83AC->unk12 = gUnknown_02022CFC->unk83AC->unk10; - gUnknown_02022CFC->unk83AC->unk10 = 0; + sPokemonJump->player->prevMonState = sPokemonJump->player->monState; + sPokemonJump->player->monState = MONSTATE_NORMAL; } -static const u16 gUnknown_082FB654[] = {SE_SHOP, SE_SHINY, SE_M_MORNING_SUN, SE_RG_POKE_JUMP_SUCCESS}; +static const u16 sSoundEffects[MAX_RFU_PLAYERS - 1] = {SE_SHOP, SE_SHINY, SE_M_MORNING_SUN, SE_RG_POKE_JUMP_SUCCESS}; -static void sub_802C1DC(void) +static void UpdateGame(void) { - if (gUnknown_02022CFC->unk5C) + if (sPokemonJump->updateScore) { - sub_802DD64(gUnknown_02022CFC->unk70.unk8); - gUnknown_02022CFC->unk5C = 0; - if (gUnknown_02022CFC->unk4D) + PrintScore(sPokemonJump->comm.jumpScore); + sPokemonJump->updateScore = FALSE; + if (sPokemonJump->showBonus) { - int index = sub_802DCCC(gUnknown_02022CFC->unk70.unk1); - PlaySE(gUnknown_082FB654[index - 2]); - gUnknown_02022CFC->unk4D = 0; + int numPlayers = DoSameJumpTimeBonus(sPokemonJump->comm.receivedBonusFlags); + PlaySE(sSoundEffects[numPlayers - 2]); + sPokemonJump->showBonus = FALSE; } } - sub_802DD74(gUnknown_02022CFC->unk70.unk4); - sub_802C280(); - sub_802C240(); + PrintJumpsInRow(sPokemonJump->comm.jumpsInRow); + HandleMonState(); + TryUpdateVineSwing(); } -static void sub_802C240(void) +static void TryUpdateVineSwing(void) { - if (gUnknown_02022CFC->unk46) - sub_802DC9C(gUnknown_02022CFC->unk14); + if (sPokemonJump->allowVineUpdates) + UpdateVineSwing(sPokemonJump->vineState); } -static void sub_802C260(void) +static void DisallowVineUpdates(void) { - gUnknown_02022CFC->unk46 = 0; + sPokemonJump->allowVineUpdates = FALSE; } -static void sub_802C270(void) +static void AllowVineUpdates(void) { - gUnknown_02022CFC->unk46 = 1; + sPokemonJump->allowVineUpdates = TRUE; } -static void sub_802C280(void) +#define F_SE_JUMP (1 << 0) +#define F_SE_FAIL (1 << 1) + +static void HandleMonState(void) { int i; - int whichSound = 0; - int numLinkPlayers = gUnknown_02022CFC->unk5; + int soundFlags = 0; + int numPlayers = sPokemonJump->numPlayers; - for (i = 0; i < numLinkPlayers; i++) + for (i = 0; i < numPlayers; i++) { - switch (gUnknown_02022CFC->unk82E4[i].unk10) + switch (sPokemonJump->players[i].monState) { - case 0: - sub_802DC80(i, 0); + case MONSTATE_NORMAL: + SetMonSpriteY(i, 0); break; - case 1: - if (gUnknown_02022CFC->unk82E4[i].unk12 != 1 || gUnknown_02022CFC->unk82E4[i].unkE != gUnknown_02022CFC->unk9A[i]) + case MONSTATE_JUMP: + if (sPokemonJump->players[i].prevMonState != MONSTATE_JUMP || sPokemonJump->players[i].jumpTimeStart != sPokemonJump->jumpTimeStarts[i]) { - if (i == gUnknown_02022CFC->unk6) - gUnknown_02022CFC->unk82E4[i].unk12 = 1; + // This is a new jump, play SE and init fields for jump handling + if (i == sPokemonJump->multiplayerId) + sPokemonJump->players[i].prevMonState = MONSTATE_JUMP; - whichSound |= 0x1; - gUnknown_02022CFC->unk82E4[i].unk4 = 0x7FFFFFFF; - gUnknown_02022CFC->unk9A[i] = gUnknown_02022CFC->unk82E4[i].unkE; + soundFlags |= F_SE_JUMP; + sPokemonJump->players[i].jumpOffsetIdx = INT_MAX; + sPokemonJump->jumpTimeStarts[i] = sPokemonJump->players[i].jumpTimeStart; } - sub_802C398(i); + UpdateJump(i); break; - case 2: - if (gUnknown_02022CFC->unk82E4[i].unk12 != 2) + case MONSTATE_HIT: + if (sPokemonJump->players[i].prevMonState != MONSTATE_HIT) { - if (i == gUnknown_02022CFC->unk6) - gUnknown_02022CFC->unk82E4[i].unk12 = 2; + if (i == sPokemonJump->multiplayerId) + sPokemonJump->players[i].prevMonState = MONSTATE_HIT; - whichSound |= 0x2; - sub_802DD88(i); + soundFlags |= F_SE_FAIL; + StartMonHitShake(i); } break; } } - if (whichSound & 0x2) + if (soundFlags & F_SE_FAIL) PlaySE(SE_RG_POKE_JUMP_FAILURE); - else if (whichSound & 0x1) + else if (soundFlags & F_SE_JUMP) PlaySE(SE_LEDGE); } -static const s8 gUnknown_082FB65C[][48] = +static const s8 sJumpOffsets[][48] = { - {-3, -6, -8, -10, -13, -15, -17, -19, -21, -23, -25, -27, -28, -29, -30, -30, -30, -28, -27, - -26, -25, -23, -22, -20, -18, -17, -15, -13, -11, -8, -6, -4, -1}, + [JUMP_TYPE_NORMAL] = { -3, -6, -8, -10, -13, -15, -17, -19, + -21, -23, -25, -27, -28, -29, + JUMP_PEAK, JUMP_PEAK, JUMP_PEAK, + -28, -27, -26, -25, -23, -22, -20, -18, + -17, -15, -13, -11, -8, -6, -4, -1}, - {-3, -6, -9, -11, -14, -16, -18, -20, -22, -24, -26, -28, -29, -30, -30, -28, -26, -24, -22, - -20, -18, -16, -14, -11, -9, -6, -4, -1}, + [JUMP_TYPE_FAST] = { -3, -6, -9, -11, -14, -16, -18, -20, + -22, -24, -26, -28, -29, + JUMP_PEAK, JUMP_PEAK, + -28, -26, -24, -22, -20, -18, -16, -14, + -11, -9, -6, -4, -1}, - {-3, -6, -9, -11, -13, -15, -17, -19, -21, -23, -25, -27, -28, -29, -30, -30, -30, -30, -29, - -29, -28, -28, -27, -27, -26, -25, -24, -22, -20, -18, -16, -14, - -12, -11, -9, -6, -4, -1}, + [JUMP_TYPE_SLOW] = { -3, -6, -9, -11, -13, -15, -17, -19, + -21, -23, -25, -27, -28, -29, + JUMP_PEAK, JUMP_PEAK, JUMP_PEAK, JUMP_PEAK, + -29, -29, -28, -28, -27, -27, -26, -25, + -24, -22, -20, -18, -16, -14, -12, -11, + -9, -6, -4, -1}, }; -static void sub_802C398(int multiplayerId) +static void UpdateJump(int multiplayerId) { - int var0; - int var1; - struct PokemonJump1_82E4 *player; + int jumpOffsetIdx; + int jumpOffset; + struct PokemonJump_Player *player; - if (gUnknown_02022CFC->unk68) + if (sPokemonJump->skipJumpUpdate) // Always false return; - player = &gUnknown_02022CFC->unk82E4[multiplayerId]; - if (player->unk4 != 0x7FFFFFFF) + player = &sPokemonJump->players[multiplayerId]; + if (player->jumpOffsetIdx != INT_MAX) { - player->unk4++; - var0 = player->unk4; + player->jumpOffsetIdx++; + jumpOffsetIdx = player->jumpOffsetIdx; } else { - var0 = gUnknown_02022CFC->unk4A - player->unkE; - if (var0 >= 65000) + jumpOffsetIdx = sPokemonJump->vineTimer - player->jumpTimeStart; + if (jumpOffsetIdx >= 65000) { - var0 -= 65000; - var0 += gUnknown_02022CFC->unk4A; + jumpOffsetIdx -= 65000; + jumpOffsetIdx += sPokemonJump->vineTimer; } - player->unk4 = var0; + player->jumpOffsetIdx = jumpOffsetIdx; } - if (var0 < 4) + if (jumpOffsetIdx < 4) return; - var0 -= 4; - if (var0 < 48) - var1 = gUnknown_082FB65C[player->unkC][var0]; + jumpOffsetIdx -= 4; + if (jumpOffsetIdx < (int)ARRAY_COUNT(sJumpOffsets[0])) + jumpOffset = sJumpOffsets[player->monJumpType][jumpOffsetIdx]; else - var1 = 0; + jumpOffset = 0; - sub_802DC80(multiplayerId, var1); - if (!var1 && multiplayerId == gUnknown_02022CFC->unk6) - sub_802C1BC(); + SetMonSpriteY(multiplayerId, jumpOffset); + if (jumpOffset == 0 && multiplayerId == sPokemonJump->multiplayerId) + SetMonStateNormal(); - player->unk0 = var1; + player->jumpOffset = jumpOffset; } -static void sub_802C43C(void) +static void TryUpdateScore(void) { - if (gUnknown_02022CFC->unk14 == 8 && gUnknown_02022CFC->unk18 == 7) + if (sPokemonJump->vineState == VINE_UPSWING_HIGH && sPokemonJump->prevVineState == VINE_UPSWING_LOW) { - if (gUnknown_02022CFC->unk58 == 0) + // Vine has passed through the point where it + // would hit the players, allow score to update + + if (!sPokemonJump->initScoreUpdate) { - sub_802C780(); - gUnknown_02022CFC->unk54 = 0; - gUnknown_02022CFC->unk58 = 1; - gUnknown_02022CFC->unk70.unk1 = 0; + ClearUnreadField(); + sPokemonJump->numPlayersAtPeak = 0; + sPokemonJump->initScoreUpdate = TRUE; + sPokemonJump->comm.receivedBonusFlags = 0; } else { - if (gUnknown_02022CFC->unk54 == 5) + if (sPokemonJump->numPlayersAtPeak == MAX_RFU_PLAYERS) { - gUnknown_02022CFC->unkC++; - sub_802C7A0(gUnknown_02022CFC->unkC); + // An 'excellent' is the max 5 players all jumping synchronously + sPokemonJump->excellentsInRow++; + TryUpdateExcellentsRecord(sPokemonJump->excellentsInRow); } else { - gUnknown_02022CFC->unkC = 0; + sPokemonJump->excellentsInRow = 0; } - if (gUnknown_02022CFC->unk54 > 1) + if (sPokemonJump->numPlayersAtPeak > 1) { - gUnknown_02022CFC->unk64 = 1; - memcpy(gUnknown_02022CFC->unk86, gUnknown_02022CFC->unk81, sizeof(u8) * MAX_RFU_PLAYERS); + sPokemonJump->giveBonus = TRUE; + // Unclear why atJumpPeak needed to be copied over twice + memcpy(sPokemonJump->atJumpPeak3, sPokemonJump->atJumpPeak2, sizeof(u8) * MAX_RFU_PLAYERS); } - sub_802C780(); - gUnknown_02022CFC->unk54 = 0; - gUnknown_02022CFC->unk58 = 1; - gUnknown_02022CFC->unk70.unk1 = 0; - if (gUnknown_02022CFC->unk70.unk4 < 9999) - gUnknown_02022CFC->unk70.unk4++; + ClearUnreadField(); + sPokemonJump->numPlayersAtPeak = 0; + sPokemonJump->initScoreUpdate = TRUE; + sPokemonJump->comm.receivedBonusFlags = 0; + if (sPokemonJump->comm.jumpsInRow < MAX_JUMPS) + sPokemonJump->comm.jumpsInRow++; - sub_802C688(10); - sub_802AE14(3); + AddJumpScore(10); + SetLinkTimeInterval(LINK_INTERVAL_SHORT); } } - if (gUnknown_02022CFC->unk64 && (sub_802C618() == TRUE || !gUnknown_02022CFC->unk14)) + if (sPokemonJump->giveBonus && (DidAllPlayersClearVine() == TRUE || sPokemonJump->vineState == VINE_HIGHEST)) { - int var0 = sub_802C73C(gUnknown_02022CFC->unk86); - sub_802C688(sub_802C790(var0)); - sub_802AE14(3); - gUnknown_02022CFC->unk64 = 0; + int numPlayers = GetNumPlayersForBonus(sPokemonJump->atJumpPeak3); + AddJumpScore(GetScoreBonus(numPlayers)); + SetLinkTimeInterval(LINK_INTERVAL_SHORT); + sPokemonJump->giveBonus = FALSE; } - if (gUnknown_02022CFC->unk58) + if (sPokemonJump->initScoreUpdate) { - int var1 = sub_802C6B0(); - if (var1 > gUnknown_02022CFC->unk54) + int numAtPeak = GetPlayersAtJumpPeak(); + if (numAtPeak > sPokemonJump->numPlayersAtPeak) { - gUnknown_02022CFC->unk54 = var1; - memcpy(gUnknown_02022CFC->unk81, gUnknown_02022CFC->unk7C, sizeof(u8) * MAX_RFU_PLAYERS); + sPokemonJump->numPlayersAtPeak = numAtPeak; + memcpy(sPokemonJump->atJumpPeak2, sPokemonJump->atJumpPeak, sizeof(u8) * MAX_RFU_PLAYERS); } } } -static bool32 sub_802C538(void) +// Returns FALSE if any player was hit by vine +static bool32 UpdateVineHitStates(void) { int i; - if (gUnknown_02022CFC->unk14 == 6 && !gUnknown_02022CFC->unk83AC->unk0) + if (sPokemonJump->vineState == VINE_UPSWING_LOWER && sPokemonJump->player->jumpOffset == 0) { - if (gUnknown_02022CFC->unk83AC->unk12 == 1 && sub_802C0DC() == 1) + // Vine is in position to hit the player and jump offset is 0. + // Unless the player had just jumped and has been forced to the ground + // by someone else getting hit, the player has been hit + if (sPokemonJump->player->prevMonState == MONSTATE_JUMP && IsGameOver() == TRUE) { - gUnknown_02022CFC->unk83AC->unk14 = 1; + sPokemonJump->player->jumpState = JUMPSTATE_SUCCESS; } else { - sub_802C18C(); - sub_802AE14(3); + // Hit vine + SetMonStateHit(); + SetLinkTimeInterval(LINK_INTERVAL_SHORT); } } - if (gUnknown_02022CFC->unk14 == 7 - && gUnknown_02022CFC->unk18 == 6 - && gUnknown_02022CFC->unk83AC->unk10 != 2) + if (sPokemonJump->vineState == VINE_UPSWING_LOW + && sPokemonJump->prevVineState == VINE_UPSWING_LOWER + && sPokemonJump->player->monState != MONSTATE_HIT) { - gUnknown_02022CFC->unk83AC->unk14 = 1; - sub_802AE14(3); + sPokemonJump->player->jumpState = JUMPSTATE_SUCCESS; + SetLinkTimeInterval(LINK_INTERVAL_SHORT); } - for (i = 0; i < gUnknown_02022CFC->unk5; i++) + for (i = 0; i < sPokemonJump->numPlayers; i++) { - if (gUnknown_02022CFC->unk82E4[i].unk10 == 2) + if (sPokemonJump->players[i].monState == MONSTATE_HIT) return FALSE; } return TRUE; } -static bool32 sub_802C5DC(void) +// Has everyone either jumped or been hit by the vine +static bool32 AllPlayersJumpedOrHit(void) { int i; - int numPlayers = gUnknown_02022CFC->unk5; - int count = 0; + int numPlayers = sPokemonJump->numPlayers; + int numJumpedOrHit = 0; for (i = 0; i < numPlayers; i++) { - if (gUnknown_02022CFC->unk82E4[i].unk14) - count++; + if (sPokemonJump->players[i].jumpState != JUMPSTATE_NONE) + numJumpedOrHit++; } - return count == numPlayers; + return numJumpedOrHit == numPlayers; } -static bool32 sub_802C618(void) +static bool32 DidAllPlayersClearVine(void) { int i; - for (i = 0; i < gUnknown_02022CFC->unk5; i++) + for (i = 0; i < sPokemonJump->numPlayers; i++) { - if (gUnknown_02022CFC->unk82E4[i].unk14 != 1) + if (sPokemonJump->players[i].jumpState != JUMPSTATE_SUCCESS) return FALSE; } return TRUE; } -static bool32 sub_802C650(void) +static bool32 ShouldPlayAgain(void) { int i; - if (gUnknown_02022CFC->unk45 == 1) + if (sPokemonJump->playAgainState == PLAY_AGAIN_NO) return FALSE; - for (i = 1; i < gUnknown_02022CFC->unk5; i++) + for (i = 1; i < sPokemonJump->numPlayers; i++) { - if (gUnknown_02022CFC->unk90[i] == 1) + if (sPokemonJump->playAgainStates[i] == PLAY_AGAIN_NO) return FALSE; } return TRUE; } -static void sub_802C688(int arg0) +static void AddJumpScore(int score) { - gUnknown_02022CFC->unk70.unk8 += arg0; - gUnknown_02022CFC->unk5C = 1; - if (gUnknown_02022CFC->unk70.unk8 >= 99990) - gUnknown_02022CFC->unk70.unk8 = 99990; + sPokemonJump->comm.jumpScore += score; + sPokemonJump->updateScore = TRUE; + if (sPokemonJump->comm.jumpScore >= MAX_JUMP_SCORE) + sPokemonJump->comm.jumpScore = MAX_JUMP_SCORE; } -static int sub_802C6B0(void) +static int GetPlayersAtJumpPeak(void) { int i; - int count = 0; - int numPlayers = gUnknown_02022CFC->unk5; + int numAtPeak = 0; + int numPlayers = sPokemonJump->numPlayers; for (i = 0; i < numPlayers; i++) { - if (gUnknown_02022CFC->unk82E4[i].unk0 == -30) + if (sPokemonJump->players[i].jumpOffset == JUMP_PEAK) { - gUnknown_02022CFC->unk7C[i] = 1; - count++; + sPokemonJump->atJumpPeak[i] = TRUE; + numAtPeak++; } else { - gUnknown_02022CFC->unk7C[i] = 0; + sPokemonJump->atJumpPeak[i] = FALSE; } } - return count; + return numAtPeak; } static bool32 AreLinkQueuesEmpty(void) @@ -2029,13 +2205,13 @@ static bool32 AreLinkQueuesEmpty(void) return !Rfu.recvQueue.count && !Rfu.sendQueue.count; } -static int sub_802C73C(u8 *arg0) +static int GetNumPlayersForBonus(u8 *arg0) { - int i; - int flags; - int count; + int i = 0; + int flags = 0; + int count = 0; - for (i = 0, flags = 0, count = 0; i < MAX_RFU_PLAYERS; i++) + for (; i < MAX_RFU_PLAYERS; i++) { if (arg0[i]) { @@ -2044,87 +2220,100 @@ static int sub_802C73C(u8 *arg0) } } - gUnknown_02022CFC->unk70.unk1 = flags; + sPokemonJump->comm.receivedBonusFlags = flags; if (flags) - gUnknown_02022CFC->unk4D = 1; + sPokemonJump->showBonus = TRUE; return count; } -static void sub_802C780(void) +static void ClearUnreadField(void) { - gUnknown_02022CFC->unk44 = 0; + sPokemonJump->unused3 = 0; } -static const int gUnknown_082FB6EC[] = {0, 0, 0x32, 0x64, 0xc8, 0x1f4}; +// Bonuses given depend on the number of +// players that jumped at the same time +static const int sScoreBonuses[MAX_RFU_PLAYERS + 1] = {0, 0, 50, 100, 200, 500}; -static int sub_802C790(int arg0) +static int GetScoreBonus(int numPlayers) { - return gUnknown_082FB6EC[arg0]; + return sScoreBonuses[numPlayers]; } -static void sub_802C7A0(u16 arg0) +static void TryUpdateExcellentsRecord(u16 excellentsInRow) { - if (arg0 > gUnknown_02022CFC->unkE) - gUnknown_02022CFC->unkE = arg0; + if (excellentsInRow > sPokemonJump->excellentsInRowRecord) + sPokemonJump->excellentsInRowRecord = excellentsInRow; } -static const u16 gUnknown_082FB704[] = {0x8a, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93}; -static const u32 gUnknown_082FB714[][2] = -{ - {0x1388, 1}, - {0x1f40, 2}, - {0x2ee0, 3}, - {0x3e80, 4}, - {0x4e20, 5}, +static const u16 sPrizeItems[] = { + ITEM_LEPPA_BERRY, + ITEM_LUM_BERRY, + ITEM_SITRUS_BERRY, + ITEM_FIGY_BERRY, + ITEM_WIKI_BERRY, + ITEM_MAGO_BERRY, + ITEM_AGUAV_BERRY, + ITEM_IAPAPA_BERRY }; -static bool32 sub_802C7BC(void) +struct { + u32 score; + u32 quantity; +} static const sPrizeQuantityData[] = { - if (gUnknown_02022CFC->unk70.unk8 >= gUnknown_082FB714[0][0]) + { .score = 5000, .quantity = 1}, + { .score = 8000, .quantity = 2}, + { .score = 12000, .quantity = 3}, + { .score = 16000, .quantity = 4}, + { .score = 20000, .quantity = 5}, +}; + +static bool32 HasEnoughScoreForPrize(void) +{ + if (sPokemonJump->comm.jumpScore >= sPrizeQuantityData[0].score) return TRUE; else return FALSE; } -static u16 sub_802C7E0(void) +static u16 GetPrizeData(void) { - u16 lo = sub_802C818(); - u16 hi = sub_802C838(); - return (hi << 12) | (lo & 0xFFF); + u16 itemId = GetPrizeItemId(); + u16 quantity = GetPrizeQuantity(); + return (quantity << 12) | (itemId & 0xFFF); } -static void sub_802C808(u16 arg0, u16 *arg1, u16 *arg2) +static void UnpackPrizeData(u16 data, u16 *itemId, u16 *quantity) { - *arg2 = arg0 >> 12; - *arg1 = arg0 & 0xFFF; + *quantity = data >> 12; + *itemId = data & 0xFFF; } -static u16 sub_802C818(void) +static u16 GetPrizeItemId(void) { - u16 index = Random() % ARRAY_COUNT(gUnknown_082FB704); - return gUnknown_082FB704[index]; + u16 index = Random() % ARRAY_COUNT(sPrizeItems); + return sPrizeItems[index]; } -static u16 sub_802C838(void) +static u16 GetPrizeQuantity(void) { - u32 val, i; + u32 quantity, i; - val = 0; - for (i = 0; i < 5; i++) + quantity = 0; + for (i = 0; i < ARRAY_COUNT(sPrizeQuantityData); i++) { - if (gUnknown_02022CFC->unk70.unk8 < gUnknown_082FB714[i][0]) - break; - else if (1) - val = gUnknown_082FB714[i][1]; + if (sPokemonJump->comm.jumpScore >= sPrizeQuantityData[i].score) + quantity = sPrizeQuantityData[i].quantity; else break; } - return val; + return quantity; } -static u16 sub_802C880(u16 item, u16 quantity) +static u16 GetQuantityLimitedByBag(u16 item, u16 quantity) { while (quantity && !CheckBagHasSpace(item, quantity)) quantity--; @@ -2132,24 +2321,24 @@ static u16 sub_802C880(u16 item, u16 quantity) return quantity; } -static u16 sub_802C8AC(void) +static u16 GetNumPokeJumpPlayers(void) { return GetLinkPlayerCount(); } -static u16 sub_802C8BC(void) +static u16 GetPokeJumpMultiplayerId(void) { - return gUnknown_02022CFC->unk6; + return sPokemonJump->multiplayerId; } -static struct PokemonJump1_MonInfo *sub_802C8C8(u8 multiplayerId) +static struct PokemonJump_MonInfo *GetMonInfoByMultiplayerId(u8 multiplayerId) { - return &gUnknown_02022CFC->unk82A8[multiplayerId]; + return &sPokemonJump->monInfo[multiplayerId]; } -static u8 *sub_802C8E8(u8 multiplayerId) +static u8 *GetPokeJumpPlayerName(u8 multiplayerId) { - return gUnknown_02022CFC->unk82E4[multiplayerId].unk1C; + return sPokemonJump->players[multiplayerId].name; } bool32 IsSpeciesAllowedInPokemonJump(u16 species) @@ -2177,69 +2366,67 @@ void IsPokemonJumpSpeciesInParty(void) gSpecialVar_Result = FALSE; } -// Large group of data. -static const u16 gPkmnJumpPal1[] = INCBIN_U16("graphics/link_games/pkmnjump_pal1.gbapal"); -static const u16 gPkmnJumpPal2[] = INCBIN_U16("graphics/link_games/pkmnjump_pal2.gbapal"); +static const u16 sPokeJumpPal1[] = INCBIN_U16("graphics/pokemon_jump/pal1.gbapal"); +static const u16 sPokeJumpPal2[] = INCBIN_U16("graphics/pokemon_jump/pal2.gbapal"); -static const u32 gPkmnJumpRopeGfx1[] = INCBIN_U32("graphics/link_games/pkmnjump_rope1.4bpp.lz"); -static const u32 gPkmnJumpRopeGfx2[] = INCBIN_U32("graphics/link_games/pkmnjump_rope2.4bpp.lz"); -static const u32 gPkmnJumpRopeGfx3[] = INCBIN_U32("graphics/link_games/pkmnjump_rope3.4bpp.lz"); -static const u32 gPkmnJumpRopeGfx4[] = INCBIN_U32("graphics/link_games/pkmnjump_rope4.4bpp.lz"); +static const u32 sVine1_Gfx[] = INCBIN_U32("graphics/pokemon_jump/vine1.4bpp.lz"); +static const u32 sVine2_Gfx[] = INCBIN_U32("graphics/pokemon_jump/vine2.4bpp.lz"); +static const u32 sVine3_Gfx[] = INCBIN_U32("graphics/pokemon_jump/vine3.4bpp.lz"); +static const u32 sVine4_Gfx[] = INCBIN_U32("graphics/pokemon_jump/vine4.4bpp.lz"); -static const u32 gPkmnJumpStarGfx[] = INCBIN_U32("graphics/link_games/pkmnjump_star.4bpp.lz"); +static const u32 sStar_Gfx[] = INCBIN_U32("graphics/pokemon_jump/star.4bpp.lz"); -static const struct CompressedSpriteSheet gUnknown_082FBE08[] = +static const struct CompressedSpriteSheet sCompressedSpriteSheets[] = { - {gPkmnJumpRopeGfx1, 0x600, 5}, - {gPkmnJumpRopeGfx2, 0x0c00, 6}, - {gPkmnJumpRopeGfx3, 0x0600, 7}, - {gPkmnJumpRopeGfx4, 0x0600, 8}, - {gPkmnJumpStarGfx, 0x0200, 10}, + {sVine1_Gfx, 0x600, GFXTAG_VINE1}, + {sVine2_Gfx, 0xC00, GFXTAG_VINE2}, + {sVine3_Gfx, 0x600, GFXTAG_VINE3}, + {sVine4_Gfx, 0x600, GFXTAG_VINE4}, + {sStar_Gfx, 0x200, GFXTAG_STAR}, }; -static const struct SpritePalette gUnknown_082FBE30[] = +static const struct SpritePalette sSpritePalettes[] = { - {gPkmnJumpPal1, 5}, - {gPkmnJumpPal2, 6}, + {sPokeJumpPal1, PALTAG_1}, + {sPokeJumpPal2, PALTAG_2}, }; -// Forward declarations. -static const struct OamData sOamData_82FBEC8; -static const struct SpriteTemplate gUnknown_082FBF78; -static const struct SpriteTemplate gUnknown_082FBF90; -static const struct SpriteTemplate gUnknown_082FBFA8; -static const struct SpriteTemplate gUnknown_082FBFC0; +static const struct OamData sOamData_JumpMon; +static const struct SpriteTemplate sSpriteTemplate_Vine1; +static const struct SpriteTemplate sSpriteTemplate_Vine2; +static const struct SpriteTemplate sSpriteTemplate_Vine3; +static const struct SpriteTemplate sSpriteTemplate_Vine4; -static const struct SpriteTemplate gUnknown_082FBE40 = +static const struct SpriteTemplate sSpriteTemplate_JumpMon = { - .tileTag = 0, - .paletteTag = 0, - .oam = &sOamData_82FBEC8, + .tileTag = TAG_MON1, + .paletteTag = TAG_MON1, + .oam = &sOamData_JumpMon, .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy, }; -static const s16 gUnknown_082FBE58[][10] = +static const s16 sVineYCoords[VINE_SPRITES_PER_SIDE][NUM_VINESTATES] = { - {0x60, 0x60, 0x60, 0x72, 0x78, 0x78, 0x78, 0x72, 0x60, 0x60}, - {0x46, 0x50, 0x60, 0x72, 0x78, 0x80, 0x78, 0x72, 0x60, 0x50}, - {0x32, 0x48, 0x60, 0x72, 0x80, 0x88, 0x80, 0x72, 0x60, 0x48}, - {0x2a, 0x48, 0x60, 0x72, 0x80, 0x88, 0x80, 0x72, 0x60, 0x48}, + {96, 96, 96, 114, 120, 120, 120, 114, 96, 96}, + {70, 80, 96, 114, 120, 128, 120, 114, 96, 80}, + {50, 72, 96, 114, 128, 136, 128, 114, 96, 72}, + {42, 72, 96, 114, 128, 136, 128, 114, 96, 72}, }; -static const s16 gUnknown_082FBEA8[] = {0x10, 0x28, 0x48, 0x68, 0x88, 0xa8, 0xc8, 0xe0}; +static const s16 sVineXCoords[VINE_SPRITES_PER_SIDE * 2] = {16, 40, 72, 104, 136, 168, 200, 224}; -static const struct SpriteTemplate *const gUnknown_082FBEB8[] = +static const struct SpriteTemplate *const sSpriteTemplates_Vine[VINE_SPRITES_PER_SIDE] = { - &gUnknown_082FBF78, - &gUnknown_082FBF90, - &gUnknown_082FBFA8, - &gUnknown_082FBFC0, + &sSpriteTemplate_Vine1, + &sSpriteTemplate_Vine2, + &sSpriteTemplate_Vine3, + &sSpriteTemplate_Vine4, }; -static const struct OamData sOamData_82FBEC8 = +static const struct OamData sOamData_JumpMon = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -2256,7 +2443,7 @@ static const struct OamData sOamData_82FBEC8 = .affineParam = 0 }; -static const struct OamData sOamData_82FBED0 = +static const struct OamData sOamData_Vine16x32 = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -2273,7 +2460,7 @@ static const struct OamData sOamData_82FBED0 = .affineParam = 0 }; -static const struct OamData sOamData_82FBED8 = +static const struct OamData sOamData_Vine32x32 = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -2290,7 +2477,7 @@ static const struct OamData sOamData_82FBED8 = .affineParam = 0 }; -static const struct OamData sOamData_82FBEE0 = +static const struct OamData sOamData_Vine32x16 = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -2307,143 +2494,144 @@ static const struct OamData sOamData_82FBEE0 = .affineParam = 0 }; -static const union AnimCmd sSpriteAnim_82FBEE8[] = +static const union AnimCmd sAnims_Vine_Highest[] = { ANIMCMD_FRAME(0, 1), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_82FBEF0[] = +static const union AnimCmd sAnims_Vine_Higher[] = { ANIMCMD_FRAME(8, 1), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_82FBEF8[] = +static const union AnimCmd sAnims_Vine_High[] = { ANIMCMD_FRAME(16, 1), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_82FBF00[] = +static const union AnimCmd sAnims_Vine_Low[] = { ANIMCMD_FRAME(24, 1), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_82FBF08[] = +static const union AnimCmd sAnims_Vine_Lower[] = { ANIMCMD_FRAME(32, 1), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_82FBF10[] = +static const union AnimCmd sAnims_Vine_Lowest[] = { ANIMCMD_FRAME(40, 1), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_82FBF18[] = +static const union AnimCmd sAnims_VineTall_Highest[] = { ANIMCMD_FRAME(0, 1), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_82FBF20[] = +static const union AnimCmd sAnims_VineTall_Higher[] = { ANIMCMD_FRAME(16, 1), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_82FBF28[] = +static const union AnimCmd sAnims_VineTall_High[] = { ANIMCMD_FRAME(32, 1), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_82FBF30[] = +static const union AnimCmd sAnims_VineTall_Low[] = { ANIMCMD_FRAME(48, 1), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_82FBF38[] = +static const union AnimCmd sAnims_VineTall_Lower[] = { ANIMCMD_FRAME(64, 1), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_82FBF40[] = +static const union AnimCmd sAnims_VineTall_Lowest[] = { ANIMCMD_FRAME(80, 1), ANIMCMD_END }; -static const union AnimCmd *const sSpriteAnimTable_82FBF48[] = +static const union AnimCmd *const sAnims_Vine[] = { - sSpriteAnim_82FBEE8, - sSpriteAnim_82FBEF0, - sSpriteAnim_82FBEF8, - sSpriteAnim_82FBF00, - sSpriteAnim_82FBF08, - sSpriteAnim_82FBF10 + sAnims_Vine_Highest, + sAnims_Vine_Higher, + sAnims_Vine_High, + sAnims_Vine_Low, + sAnims_Vine_Lower, + sAnims_Vine_Lowest }; -static const union AnimCmd *const sSpriteAnimTable_82FBF60[] = +// Vine 2 needs its own set of anims because the graphic is twice as large +static const union AnimCmd *const sAnims_VineTall[] = { - sSpriteAnim_82FBF18, - sSpriteAnim_82FBF20, - sSpriteAnim_82FBF28, - sSpriteAnim_82FBF30, - sSpriteAnim_82FBF38, - sSpriteAnim_82FBF40 + sAnims_VineTall_Highest, + sAnims_VineTall_Higher, + sAnims_VineTall_High, + sAnims_VineTall_Low, + sAnims_VineTall_Lower, + sAnims_VineTall_Lowest }; -static const struct SpriteTemplate gUnknown_082FBF78 = +static const struct SpriteTemplate sSpriteTemplate_Vine1 = { - .tileTag = 5, - .paletteTag = 5, - .oam = &sOamData_82FBED0, - .anims = sSpriteAnimTable_82FBF48, + .tileTag = GFXTAG_VINE1, + .paletteTag = PALTAG_1, + .oam = &sOamData_Vine16x32, + .anims = sAnims_Vine, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy, }; -static const struct SpriteTemplate gUnknown_082FBF90 = +static const struct SpriteTemplate sSpriteTemplate_Vine2 = { - .tileTag = 6, - .paletteTag = 5, - .oam = &sOamData_82FBED8, - .anims = sSpriteAnimTable_82FBF60, + .tileTag = GFXTAG_VINE2, + .paletteTag = PALTAG_1, + .oam = &sOamData_Vine32x32, + .anims = sAnims_VineTall, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy, }; -static const struct SpriteTemplate gUnknown_082FBFA8 = +static const struct SpriteTemplate sSpriteTemplate_Vine3 = { - .tileTag = 7, - .paletteTag = 5, - .oam = &sOamData_82FBEE0, - .anims = sSpriteAnimTable_82FBF48, + .tileTag = GFXTAG_VINE3, + .paletteTag = PALTAG_1, + .oam = &sOamData_Vine32x16, + .anims = sAnims_Vine, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy, }; -static const struct SpriteTemplate gUnknown_082FBFC0 = +static const struct SpriteTemplate sSpriteTemplate_Vine4 = { - .tileTag = 8, - .paletteTag = 5, - .oam = &sOamData_82FBEE0, - .anims = sSpriteAnimTable_82FBF48, + .tileTag = GFXTAG_VINE4, + .paletteTag = PALTAG_1, + .oam = &sOamData_Vine32x16, + .anims = sAnims_Vine, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy, }; -static const struct OamData sOamData_82FBFD8 = +static const struct OamData sOamData_Star = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -2460,13 +2648,13 @@ static const struct OamData sOamData_82FBFD8 = .affineParam = 0 }; -static const union AnimCmd sSpriteAnim_82FBFE0[] = +static const union AnimCmd sAnim_Star_Still[] = { ANIMCMD_FRAME(0, 0), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_82FBFE8[] = +static const union AnimCmd sAnim_Star_Spinning[] = { ANIMCMD_FRAME(0, 4), ANIMCMD_FRAME(4, 4), @@ -2477,46 +2665,45 @@ static const union AnimCmd sSpriteAnim_82FBFE8[] = ANIMCMD_END }; -static const union AnimCmd *const sSpriteAnimTable_82FC004[] = +static const union AnimCmd *const sAnims_Star[] = { - sSpriteAnim_82FBFE0, - sSpriteAnim_82FBFE8 + sAnim_Star_Still, + sAnim_Star_Spinning }; -static const struct SpriteTemplate gUnknown_082FC00C = +static const struct SpriteTemplate sSpriteTemplate_Star = { - .tileTag = 10, - .paletteTag = 5, - .oam = &sOamData_82FBFD8, - .anims = sSpriteAnimTable_82FC004, + .tileTag = GFXTAG_STAR, + .paletteTag = PALTAG_1, + .oam = &sOamData_Star, + .anims = sAnims_Star, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy, }; -// Back to code -static void sub_802C974(struct PokemonJump2 *arg0) +static void LoadSpriteSheetsAndPalettes(struct PokemonJumpGfx *jumpGfx) { int i; - for (i = 0; i < ARRAY_COUNT(gUnknown_082FBE08); i++) - LoadCompressedSpriteSheet(&gUnknown_082FBE08[i]); + for (i = 0; i < ARRAY_COUNT(sCompressedSpriteSheets); i++) + LoadCompressedSpriteSheet(&sCompressedSpriteSheets[i]); - for (i = 0; i < ARRAY_COUNT(gUnknown_082FBE30); i++) - LoadSpritePalette(&gUnknown_082FBE30[i]); + for (i = 0; i < ARRAY_COUNT(sSpritePalettes); i++) + LoadSpritePalette(&sSpritePalettes[i]); - arg0->unkE = IndexOfSpritePaletteTag(5); - arg0->unkF = IndexOfSpritePaletteTag(6); + jumpGfx->vinePalNumDownswing = IndexOfSpritePaletteTag(PALTAG_1); + jumpGfx->vinePalNumUpswing = IndexOfSpritePaletteTag(PALTAG_2); } -static void sub_802C9BC(struct Sprite *sprite) +static void ResetPokeJumpSpriteData(struct Sprite *sprite) { int i; - for (i = 0; i < 8; i++) + for (i = 0; i < (int)ARRAY_COUNT(sprite->data); i++) sprite->data[i] = 0; } -static void sub_802C9D4(struct PokemonJump2 *arg0, struct PokemonJump1_MonInfo *jumpMon, s16 x, s16 y, u8 multiplayerId) +static void CreateJumpMonSprite(struct PokemonJumpGfx *jumpGfx, struct PokemonJump_MonInfo *monInfo, s16 x, s16 y, u8 multiplayerId) { struct SpriteTemplate spriteTemplate; struct SpriteSheet spriteSheet; @@ -2526,10 +2713,10 @@ static void sub_802C9D4(struct PokemonJump2 *arg0, struct PokemonJump1_MonInfo * u8 subpriority; u8 spriteId; - spriteTemplate = gUnknown_082FBE40; + spriteTemplate = sSpriteTemplate_JumpMon; buffer = Alloc(0x2000); unusedBuffer = Alloc(0x800); - if (multiplayerId == sub_802C8BC()) + if (multiplayerId == GetPokeJumpMultiplayerId()) subpriority = 3; else subpriority = multiplayerId + 4; @@ -2537,17 +2724,17 @@ static void sub_802C9D4(struct PokemonJump2 *arg0, struct PokemonJump1_MonInfo * if (buffer && unusedBuffer) { HandleLoadSpecialPokePic( - &gMonStillFrontPicTable[jumpMon->species], + &gMonStillFrontPicTable[monInfo->species], buffer, - jumpMon->species, - jumpMon->personality); + monInfo->species, + monInfo->personality); spriteSheet.data = buffer; spriteSheet.tag = multiplayerId; spriteSheet.size = 0x800; LoadSpriteSheet(&spriteSheet); - spritePalette.data = GetMonSpritePalFromSpeciesAndPersonality(jumpMon->species, jumpMon->otId, jumpMon->personality); + spritePalette.data = GetMonSpritePalFromSpeciesAndPersonality(monInfo->species, monInfo->otId, monInfo->personality); spritePalette.tag = multiplayerId; LoadCompressedSpritePalette(&spritePalette); @@ -2559,162 +2746,184 @@ static void sub_802C9D4(struct PokemonJump2 *arg0, struct PokemonJump1_MonInfo * spriteId = CreateSprite(&spriteTemplate, x, y, subpriority); if (spriteId != MAX_SPRITES) { - arg0->unk81A8[multiplayerId] = &gSprites[spriteId]; - arg0->unk81FC[multiplayerId] = subpriority; + jumpGfx->monSprites[multiplayerId] = &gSprites[spriteId]; + jumpGfx->monSpriteSubpriorities[multiplayerId] = subpriority; return; } } - arg0->unk81A8[multiplayerId] = NULL; + jumpGfx->monSprites[multiplayerId] = NULL; } -static void sub_802CB14(struct PokemonJump2 *arg0, int multiplayerId) +#define sState data[0] +#define sTimer data[1] +#define sOffset data[7] // Never read + +static void DoStarAnim(struct PokemonJumpGfx *jumpGfx, int multiplayerId) { - sub_802C9BC(arg0->unk81BC[multiplayerId]); - arg0->unk81BC[multiplayerId]->data[7] = arg0->unk81A8[multiplayerId] - gSprites; - arg0->unk81BC[multiplayerId]->invisible = 0; - arg0->unk81BC[multiplayerId]->pos1.y = 96; - arg0->unk81BC[multiplayerId]->callback = sub_802CB7C; - StartSpriteAnim(arg0->unk81BC[multiplayerId], 1); + ResetPokeJumpSpriteData(jumpGfx->starSprites[multiplayerId]); + jumpGfx->starSprites[multiplayerId]->sOffset = jumpGfx->monSprites[multiplayerId] - gSprites; + jumpGfx->starSprites[multiplayerId]->invisible = FALSE; + jumpGfx->starSprites[multiplayerId]->pos1.y = 96; + jumpGfx->starSprites[multiplayerId]->callback = SpriteCB_Star; + StartSpriteAnim(jumpGfx->starSprites[multiplayerId], 1); } -static void sub_802CB7C(struct Sprite *sprite) +static void SpriteCB_Star(struct Sprite *sprite) { - switch (sprite->data[0]) + switch (sprite->sState) { case 0: if (sprite->animEnded) { - sprite->invisible = 1; + sprite->invisible = TRUE; sprite->callback = SpriteCallbackDummy; } break; case 1: sprite->pos1.y--; - sprite->data[1]++; + sprite->sTimer++; if (sprite->pos1.y <= 72) { sprite->pos1.y = 72; - sprite->data[0]++; + sprite->sState++; } break; case 2: - if (++sprite->data[1] >= 48) + if (++sprite->sTimer >= 48) { - sprite->invisible = 1; + sprite->invisible = TRUE; sprite->callback = SpriteCallbackDummy; } break; } } -static void sub_802CBF0(struct PokemonJump2 *arg0, int multiplayerId) +#undef sState +#undef sTimer +#undef sOffset + +static void Gfx_StartMonHitShake(struct PokemonJumpGfx *jumpGfx, int multiplayerId) { - arg0->unk81A8[multiplayerId]->callback = sub_802CC40; - arg0->unk81A8[multiplayerId]->pos2.y = 0; - sub_802C9BC(arg0->unk81A8[multiplayerId]); + jumpGfx->monSprites[multiplayerId]->callback = SpriteCB_MonHitShake; + jumpGfx->monSprites[multiplayerId]->pos2.y = 0; + ResetPokeJumpSpriteData(jumpGfx->monSprites[multiplayerId]); } -static bool32 sub_802CC18(struct PokemonJump2 *arg0, int multiplayerId) +static bool32 Gfx_IsMonHitShakeActive(struct PokemonJumpGfx *jumpGfx, int multiplayerId) { - return arg0->unk81A8[multiplayerId]->callback == sub_802CC40; + return jumpGfx->monSprites[multiplayerId]->callback == SpriteCB_MonHitShake; } -static void sub_802CC40(struct Sprite *sprite) +#define sTimer data[1] +#define sNumShakes data[2] + +static void SpriteCB_MonHitShake(struct Sprite *sprite) { - if (++sprite->data[1] > 1) + if (++sprite->sTimer > 1) { - if (++sprite->data[2] & 1) + if (++sprite->sNumShakes & 1) sprite->pos2.y = 2; else sprite->pos2.y = -2; - sprite->data[1] = 0; + sprite->sTimer = 0; } - if (sprite->data[2] > 12) + if (sprite->sNumShakes > 12) { sprite->pos2.y = 0; sprite->callback = SpriteCallbackDummy; } } -static void sub_802CC88(struct PokemonJump2 *arg0, int multiplayerId) +#undef sTimer +#undef sNumShakes + +static void Gfx_StartMonHitFlash(struct PokemonJumpGfx *jumpGfx, int multiplayerId) { - sub_802C9BC(arg0->unk81A8[multiplayerId]); - arg0->unk81A8[multiplayerId]->callback = sub_802CD08; + ResetPokeJumpSpriteData(jumpGfx->monSprites[multiplayerId]); + jumpGfx->monSprites[multiplayerId]->callback = SpriteCB_MonHitFlash; } -static void sub_802CCB0(struct PokemonJump2 *arg0) +static void Gfx_StopMonHitFlash(struct PokemonJumpGfx *jumpGfx) { int i; - u16 numPlayers = sub_802C8AC(); + u16 numPlayers = GetNumPokeJumpPlayers(); for (i = 0; i < numPlayers; i++) { - if (arg0->unk81A8[i]->callback == sub_802CD08) + if (jumpGfx->monSprites[i]->callback == SpriteCB_MonHitFlash) { - arg0->unk81A8[i]->invisible = 0; - arg0->unk81A8[i]->callback = SpriteCallbackDummy; - arg0->unk81A8[i]->subpriority = 10; + jumpGfx->monSprites[i]->invisible = FALSE; + jumpGfx->monSprites[i]->callback = SpriteCallbackDummy; + jumpGfx->monSprites[i]->subpriority = 10; } } } -static void sub_802CD08(struct Sprite *sprite) +#define sTimer data[0] + +static void SpriteCB_MonHitFlash(struct Sprite *sprite) { - if (++sprite->data[0] > 3) + if (++sprite->sTimer > 3) { - sprite->data[0] = 0; + sprite->sTimer = 0; sprite->invisible ^= 1; } } -static void sub_802CD3C(struct PokemonJump2 *arg0) +#undef sTimer + +static void Gfx_ResetMonSpriteSubpriorities(struct PokemonJumpGfx *jumpGfx) { int i; - u16 numPlayers = sub_802C8AC(); + u16 numPlayers = GetNumPokeJumpPlayers(); for (i = 0; i < numPlayers; i++) - arg0->unk81A8[i]->subpriority = arg0->unk81FC[i]; + jumpGfx->monSprites[i]->subpriority = jumpGfx->monSpriteSubpriorities[i]; } -static void sub_802CD70(struct PokemonJump2 *arg0, int multiplayerId) +static void Gfx_StartMonIntroBounce(struct PokemonJumpGfx *jumpGfx, int multiplayerId) { - sub_802C9BC(arg0->unk81A8[multiplayerId]); - arg0->unk81A8[multiplayerId]->callback = sub_802CDD4; + ResetPokeJumpSpriteData(jumpGfx->monSprites[multiplayerId]); + jumpGfx->monSprites[multiplayerId]->callback = SpriteCB_MonIntroBounce; } -static bool32 sub_802CD98(struct PokemonJump2 *arg0) +static bool32 Gfx_IsMonIntroBounceActive(struct PokemonJumpGfx *jumpGfx) { int i; - u16 numPlayers = sub_802C8AC(); + u16 numPlayers = GetNumPokeJumpPlayers(); for (i = 0; i < numPlayers; i++) { - if (arg0->unk81A8[i]->callback == sub_802CDD4) + if (jumpGfx->monSprites[i]->callback == SpriteCB_MonIntroBounce) return TRUE; } return FALSE; } -static void sub_802CDD4(struct Sprite *sprite) +#define sState data[0] +#define sHopPos data[1] +#define sNumHops data[2] + +static void SpriteCB_MonIntroBounce(struct Sprite *sprite) { - switch (sprite->data[0]) + switch (sprite->sState) { case 0: PlaySE(SE_BIKE_HOP); - sprite->data[1] = 0; - sprite->data[0]++; + sprite->sHopPos = 0; + sprite->sState++; // fall through case 1: - sprite->data[1] += 4; - if (sprite->data[1] > 0x7F) - sprite->data[1] = 0; + sprite->sHopPos += 4; + if (sprite->sHopPos > 127) + sprite->sHopPos = 0; - sprite->pos2.y = -(gSineTable[sprite->data[1]] >> 3); - if (sprite->data[1] == 0) + sprite->pos2.y = -(gSineTable[sprite->sHopPos] >> 3); + if (sprite->sHopPos == 0) { - if (++sprite->data[2] < 2) - sprite->data[0] = 0; + if (++sprite->sNumHops < 2) + sprite->sState = 0; else sprite->callback = SpriteCallbackDummy; } @@ -2722,131 +2931,136 @@ static void sub_802CDD4(struct Sprite *sprite) } } -static void sub_802CE48(struct PokemonJump2 *arg0, s16 x, s16 y, u8 multiplayerId) +#undef sState +#undef sHopPos +#undef sNumHops + +static void CreateStarSprite(struct PokemonJumpGfx *jumpGfx, s16 x, s16 y, u8 multiplayerId) { - u8 spriteId = CreateSprite(&gUnknown_082FC00C, x, y, 1); + u8 spriteId = CreateSprite(&sSpriteTemplate_Star, x, y, 1); if (spriteId != MAX_SPRITES) { - gSprites[spriteId].invisible = 1; - arg0->unk81BC[multiplayerId] = &gSprites[spriteId]; + gSprites[spriteId].invisible = TRUE; + jumpGfx->starSprites[multiplayerId] = &gSprites[spriteId]; } } -static void sub_802CE9C(struct PokemonJump2 *arg0) +static void CreateVineSprites(struct PokemonJumpGfx *jumpGfx) { int i; int count; u8 spriteId; count = 0; - for (i = 0; i < 4; i++) + for (i = 0; i < VINE_SPRITES_PER_SIDE; i++) { - spriteId = CreateSprite(gUnknown_082FBEB8[i], gUnknown_082FBEA8[count], gUnknown_082FBE58[i][0], 2); - arg0->unk81D0[count] = &gSprites[spriteId]; + spriteId = CreateSprite(sSpriteTemplates_Vine[i], sVineXCoords[count], sVineYCoords[i][0], 2); + jumpGfx->vineSprites[count] = &gSprites[spriteId]; count++; } - for (i = 3; i >= 0; i--) + for (i = VINE_SPRITES_PER_SIDE - 1; i >= 0; i--) { - spriteId = CreateSprite(gUnknown_082FBEB8[i], gUnknown_082FBEA8[count], gUnknown_082FBE58[i][0], 2); - arg0->unk81D0[count] = &gSprites[spriteId]; - arg0->unk81D0[count]->hFlip = 1; + spriteId = CreateSprite(sSpriteTemplates_Vine[i], sVineXCoords[count], sVineYCoords[i][0], 2); + jumpGfx->vineSprites[count] = &gSprites[spriteId]; + jumpGfx->vineSprites[count]->hFlip = TRUE; count++; } } -static void sub_802CF50(struct PokemonJump2 *arg0, int arg1) +static void UpdateVineAnim(struct PokemonJumpGfx *jumpGfx, int vineState) { int i, count, palNum; int priority; - if (arg1 > 5) + if (vineState > VINE_LOWEST) { - arg1 = 10 - arg1; - priority = 3; - palNum = arg0->unkF; + // animNums for vine on upswing are same as + // on downswing but in reverse + vineState = NUM_VINESTATES - vineState; + priority = 3; // Set vine behind Pokémon + palNum = jumpGfx->vinePalNumUpswing; } else { - priority = 2; - palNum = arg0->unkE; + priority = 2; // Set vine in front of Pokémon + palNum = jumpGfx->vinePalNumDownswing; } count = 0; - for (i = 0; i < 4; i++) + for (i = 0; i < VINE_SPRITES_PER_SIDE; i++) { - arg0->unk81D0[count]->pos1.y = gUnknown_082FBE58[i][arg1]; - arg0->unk81D0[count]->oam.priority = priority; - arg0->unk81D0[count]->oam.paletteNum = palNum; - StartSpriteAnim(arg0->unk81D0[count], arg1); + jumpGfx->vineSprites[count]->pos1.y = sVineYCoords[i][vineState]; + jumpGfx->vineSprites[count]->oam.priority = priority; + jumpGfx->vineSprites[count]->oam.paletteNum = palNum; + StartSpriteAnim(jumpGfx->vineSprites[count], vineState); count++; } - for (i = 3; i >= 0; i--) + for (i = VINE_SPRITES_PER_SIDE - 1; i >= 0; i--) { - arg0->unk81D0[count]->pos1.y = gUnknown_082FBE58[i][arg1]; - arg0->unk81D0[count]->oam.priority = priority; - arg0->unk81D0[count]->oam.paletteNum = palNum; - StartSpriteAnim(arg0->unk81D0[count], arg1); + jumpGfx->vineSprites[count]->pos1.y = sVineYCoords[i][vineState]; + jumpGfx->vineSprites[count]->oam.priority = priority; + jumpGfx->vineSprites[count]->oam.paletteNum = palNum; + StartSpriteAnim(jumpGfx->vineSprites[count], vineState); count++; } } -static void sub_802D044(struct PokemonJump2 *arg0) +static void StartPokeJumpCountdown(struct PokemonJumpGfx *jumpGfx) { - StartMinigameCountdown(9, 7, 120, 80, 0); - sub_802CD3C(arg0); + StartMinigameCountdown(GFXTAG_COUNTDOWN, PALTAG_COUNTDOWN, 120, 80, 0); + Gfx_ResetMonSpriteSubpriorities(jumpGfx); } -static bool32 sub_802D068(void) +static bool32 IsPokeJumpCountdownRunning(void) { return IsMinigameCountdownRunning(); } -static void sub_802D074(struct PokemonJump2 *arg0) +static void StartPokeJumpGfx(struct PokemonJumpGfx *jumpGfx) { u8 taskId; - gUnknown_02022D00 = arg0; - sub_802D0BC(gUnknown_02022D00); - taskId = CreateTask(sub_802D12C, 3); - gUnknown_02022D00->unk6 = taskId; - SetWordTaskArg(gUnknown_02022D00->unk6, 2, (u32) gUnknown_02022D00); - sub_802D108(sub_802D150); + sPokemonJumpGfx = jumpGfx; + InitPokeJumpGfx(sPokemonJumpGfx); + taskId = CreateTask(Task_RunPokeJumpGfxFunc, 3); + sPokemonJumpGfx->taskId = taskId; + SetWordTaskArg(sPokemonJumpGfx->taskId, 2, (u32) sPokemonJumpGfx); + SetUpPokeJumpGfxFunc(LoadPokeJumpGfx); } -static void sub_802D0AC(void) +static void FreeWindowsAndDigitObj(void) { FreeAllWindowBuffers(); DigitObjUtil_Free(); } -static void sub_802D0BC(struct PokemonJump2 *arg0) +static void InitPokeJumpGfx(struct PokemonJumpGfx *jumpGfx) { - arg0->unk4 = 0; - arg0->unk0 = 0; - arg0->unk12 = 0xFF; + jumpGfx->mainState = 0; + jumpGfx->funcFinished = FALSE; + jumpGfx->msgWindowId = WINDOW_NONE; } -// Gfx -static const u16 gPkmnJumpPal3[] = INCBIN_U16("graphics/link_games/pkmnjump_pal3.gbapal"); +static const u16 sInterface_Pal[] = INCBIN_U16("graphics/pokemon_jump/interface.gbapal"); -static const u16 gPkmnJumpBgPal[] = INCBIN_U16("graphics/link_games/pkmnjump_bg.gbapal"); -static const u32 gPkmnJumpBgGfx[] = INCBIN_U32("graphics/link_games/pkmnjump_bg.4bpp.lz"); -static const u32 gPkmnJumpBgTilemap[] = INCBIN_U32("graphics/link_games/pkmnjump_bg.bin.lz"); +static const u16 sBg_Pal[] = INCBIN_U16("graphics/pokemon_jump/bg.gbapal"); +static const u32 sBg_Gfx[] = INCBIN_U32("graphics/pokemon_jump/bg.4bpp.lz"); +static const u32 sBg_Tilemap[] = INCBIN_U32("graphics/pokemon_jump/bg.bin.lz"); -static const u16 gPkmnJumpVenusaurPal[] = INCBIN_U16("graphics/link_games/pkmnjump_venusaur.gbapal"); -static const u32 gPkmnJumpVenusaurGfx[] = INCBIN_U32("graphics/link_games/pkmnjump_venusaur.4bpp.lz"); -static const u32 gPkmnJumpVenusaurTilemap[] = INCBIN_U32("graphics/link_games/pkmnjump_venusaur.bin.lz"); +static const u16 sVenusaur_Pal[] = INCBIN_U16("graphics/pokemon_jump/venusaur.gbapal"); +static const u32 sVenusaur_Gfx[] = INCBIN_U32("graphics/pokemon_jump/venusaur.4bpp.lz"); +static const u32 sVenusaur_Tilemap[] = INCBIN_U32("graphics/pokemon_jump/venusaur.bin.lz"); -static const u16 gPkmnJumpResultsPal[] = INCBIN_U16("graphics/link_games/pkmnjump_results.gbapal"); -static const u32 gPkmnJumpResultsGfx[] = INCBIN_U32("graphics/link_games/pkmnjump_results.4bpp.lz"); -static const u32 gPkmnJumpResultsTilemap[] = INCBIN_U32("graphics/link_games/pkmnjump_results.bin.lz"); +static const u16 sBonuses_Pal[] = INCBIN_U16("graphics/pokemon_jump/bonuses.gbapal"); +static const u32 sBonuses_Gfx[] = INCBIN_U32("graphics/pokemon_jump/bonuses.4bpp.lz"); +static const u32 sBonuses_Tilemap[] = INCBIN_U32("graphics/pokemon_jump/bonuses.bin.lz"); -static const struct BgTemplate gUnknown_082FE164[] = +static const struct BgTemplate sBgTemplates[] = { { - .bg = 0, + .bg = BG_INTERFACE, .charBaseIndex = 0, .mapBaseIndex = 27, .screenSize = 0, @@ -2855,7 +3069,7 @@ static const struct BgTemplate gUnknown_082FE164[] = .baseTile = 0 }, { - .bg = 2, + .bg = BG_VENUSAUR, .charBaseIndex = 1, .mapBaseIndex = 30, .screenSize = 2, @@ -2864,7 +3078,7 @@ static const struct BgTemplate gUnknown_082FE164[] = .baseTile = 0 }, { - .bg = 1, + .bg = BG_BONUSES, .charBaseIndex = 2, .mapBaseIndex = 12, .screenSize = 3, @@ -2873,7 +3087,7 @@ static const struct BgTemplate gUnknown_082FE164[] = .baseTile = 0 }, { - .bg = 3, + .bg = BG_SCENERY, .charBaseIndex = 3, .mapBaseIndex = 29, .screenSize = 0, @@ -2883,10 +3097,10 @@ static const struct BgTemplate gUnknown_082FE164[] = }, }; -static const struct WindowTemplate gUnknown_082FE174[] = +static const struct WindowTemplate sWindowTemplates[] = { - { - .bg = 0, + [WIN_POINTS] = { + .bg = BG_INTERFACE, .tilemapLeft = 19, .tilemapTop = 0, .width = 6, @@ -2894,8 +3108,8 @@ static const struct WindowTemplate gUnknown_082FE174[] = .paletteNum = 2, .baseBlock = 0x13, }, - { - .bg = 0, + [WIN_TIMES] = { + .bg = BG_INTERFACE, .tilemapLeft = 8, .tilemapTop = 0, .width = 6, @@ -2910,351 +3124,352 @@ struct { int id; void (*func)(void); -} static const gUnknown_082FE18C[] = +} static const sPokeJumpGfxFuncs[] = { - {0x00, sub_802D150}, - {0x01, sub_802D2E4}, - {0x02, sub_802D350}, - {0x03, sub_802D3BC}, - {0x04, sub_802D448}, - {0x05, sub_802D4F4}, - {0x06, sub_802D598}, - {0x07, sub_802D5E4}, - {0x09, sub_802D72C}, - {0x08, sub_802D688}, + {GFXFUNC_LOAD, LoadPokeJumpGfx}, // Element not used, LoadPokeJumpGfx is passed directly to SetUpPokeJumpGfxFunc + {GFXFUNC_SHOW_NAMES, PrintPlayerNamesNoHighlight}, + {GFXFUNC_SHOW_NAMES_HIGHLIGHT, PrintPlayerNamesWithHighlight}, + {GFXFUNC_ERASE_NAMES, ErasePlayerNames}, + {GFXFUNC_MSG_PLAY_AGAIN, Msg_WantToPlayAgain}, + {GFXFUNC_MSG_SAVING, Msg_SavingDontTurnOff}, + {GFXFUNC_ERASE_MSG, EraseMessage}, + {GFXFUNC_MSG_PLAYER_DROPPED, Msg_SomeoneDroppedOut}, + {GFXFUNC_COUNTDOWN, DoPokeJumpCountdown}, + {GFXFUNC_MSG_COMM_STANDBY, Msg_CommunicationStandby}, }; -static void sub_802D0C8(int arg0) +static void SetUpPokeJumpGfxFuncById(int id) { int i; - for (i = 0; i < ARRAY_COUNT(gUnknown_082FE18C); i++) + for (i = 0; i < ARRAY_COUNT(sPokeJumpGfxFuncs); i++) { - if (gUnknown_082FE18C[i].id == arg0) - sub_802D108(gUnknown_082FE18C[i].func); + if (sPokeJumpGfxFuncs[i].id == id) + SetUpPokeJumpGfxFunc(sPokeJumpGfxFuncs[i].func); } } -static bool32 sub_802D0F0(void) +static bool32 IsPokeJumpGfxFuncFinished(void) { - return (gUnknown_02022D00->unk0 != 1); + return (sPokemonJumpGfx->funcFinished != TRUE); } -static void sub_802D108(void (*func)(void)) +static void SetUpPokeJumpGfxFunc(void (*func)(void)) { - SetWordTaskArg(gUnknown_02022D00->unk6, 0, (u32) func); - gUnknown_02022D00->unk4 = 0; - gUnknown_02022D00->unk0 = 0; + SetWordTaskArg(sPokemonJumpGfx->taskId, 0, (u32) func); + sPokemonJumpGfx->mainState = 0; + sPokemonJumpGfx->funcFinished = FALSE; } -static void sub_802D12C(u8 taskId) +static void Task_RunPokeJumpGfxFunc(u8 taskId) { - if (!gUnknown_02022D00->unk0) + if (!sPokemonJumpGfx->funcFinished) { + // Read the function set in the data by SetUpPokeJumpGfxFunc void (*func)(void) = (void *)(GetWordTaskArg(taskId, 0)); func(); } } -static void sub_802D150(void) +static void LoadPokeJumpGfx(void) { - switch (gUnknown_02022D00->unk4) + switch (sPokemonJumpGfx->mainState) { case 0: ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, gUnknown_082FE164, ARRAY_COUNT(gUnknown_082FE164)); - InitWindows(gUnknown_082FE174); + InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates)); + InitWindows(sWindowTemplates); ResetTempTileDataBuffers(); - sub_802C974(gUnknown_02022D00); - sub_802DD08(); - LoadPalette(gPkmnJumpBgPal, 0, 0x20); - DecompressAndCopyTileDataToVram(3, gPkmnJumpBgGfx, 0, 0, 0); - DecompressAndCopyTileDataToVram(3, gPkmnJumpBgTilemap, 0, 0, 1); - LoadPalette(gPkmnJumpVenusaurPal, 0x30, 0x20); - DecompressAndCopyTileDataToVram(2, gPkmnJumpVenusaurGfx, 0, 0, 0); - DecompressAndCopyTileDataToVram(2, gPkmnJumpVenusaurTilemap, 0, 0, 1); - LoadPalette(gPkmnJumpResultsPal, 0x10, 0x20); - DecompressAndCopyTileDataToVram(1, gPkmnJumpResultsGfx, 0, 0, 0); - DecompressAndCopyTileDataToVram(1, gPkmnJumpResultsTilemap, 0, 0, 1); - LoadPalette(gPkmnJumpPal3, 0x20, 0x20); - SetBgTilemapBuffer(0, gUnknown_02022D00->tilemapBuffer); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); - sub_802DB8C(); - sub_802DD64(0); + LoadSpriteSheetsAndPalettes(sPokemonJumpGfx); + InitDigitPrinters(); + LoadPalette(sBg_Pal, 0, 0x20); + DecompressAndCopyTileDataToVram(BG_SCENERY, sBg_Gfx, 0, 0, 0); + DecompressAndCopyTileDataToVram(BG_SCENERY, sBg_Tilemap, 0, 0, 1); + LoadPalette(sVenusaur_Pal, 0x30, 0x20); + DecompressAndCopyTileDataToVram(BG_VENUSAUR, sVenusaur_Gfx, 0, 0, 0); + DecompressAndCopyTileDataToVram(BG_VENUSAUR, sVenusaur_Tilemap, 0, 0, 1); + LoadPalette(sBonuses_Pal, 0x10, 0x20); + DecompressAndCopyTileDataToVram(BG_BONUSES, sBonuses_Gfx, 0, 0, 0); + DecompressAndCopyTileDataToVram(BG_BONUSES, sBonuses_Tilemap, 0, 0, 1); + LoadPalette(sInterface_Pal, 0x20, 0x20); + SetBgTilemapBuffer(BG_INTERFACE, sPokemonJumpGfx->tilemapBuffer); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 0x20, 0x20); + PrintScoreSuffixes(); + PrintScore(0); sub_8098C6C(0, 1, 0xE0); - CopyBgTilemapBufferToVram(0); - CopyBgTilemapBufferToVram(2); - CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(BG_INTERFACE); + CopyBgTilemapBufferToVram(BG_VENUSAUR); + CopyBgTilemapBufferToVram(BG_BONUSES); ResetBgPositions(); - gUnknown_02022D00->unk4++; + sPokemonJumpGfx->mainState++; break; case 1: if (!FreeTempTileDataBuffersIfPossible()) { - sub_802DBF8(); - sub_802CE9C(gUnknown_02022D00); - sub_802CF50(gUnknown_02022D00, 6); - ShowBg(3); - ShowBg(0); - ShowBg(2); - HideBg(1); - gUnknown_02022D00->unk4++; + CreateJumpMonSprites(); + CreateVineSprites(sPokemonJumpGfx); + UpdateVineAnim(sPokemonJumpGfx, VINE_UPSWING_LOWER); + ShowBg(BG_SCENERY); + ShowBg(BG_INTERFACE); + ShowBg(BG_VENUSAUR); + HideBg(BG_BONUSES); + sPokemonJumpGfx->mainState++; } break; case 2: - gUnknown_02022D00->unk0 = 1; + sPokemonJumpGfx->funcFinished = TRUE; break; } } -static void sub_802D2E4(void) +static void PrintPlayerNamesNoHighlight(void) { - switch (gUnknown_02022D00->unk4) + switch (sPokemonJumpGfx->mainState) { case 0: - sub_802DE1C(); - gUnknown_02022D00->unk4++; + AddPlayerNameWindows(); + sPokemonJumpGfx->mainState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_802DF70(FALSE); - gUnknown_02022D00->unk4++; + PrintPokeJumpPlayerNames(FALSE); + sPokemonJumpGfx->mainState++; } break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_802DFD4(); - gUnknown_02022D00->unk4++; + DrawPlayerNameWindows(); + sPokemonJumpGfx->mainState++; } break; case 3: if (!IsDma3ManagerBusyWithBgCopy()) - gUnknown_02022D00->unk0 = 1; + sPokemonJumpGfx->funcFinished = TRUE; break; } } -static void sub_802D350(void) +static void PrintPlayerNamesWithHighlight(void) { - switch (gUnknown_02022D00->unk4) + switch (sPokemonJumpGfx->mainState) { case 0: - sub_802DE1C(); - gUnknown_02022D00->unk4++; + AddPlayerNameWindows(); + sPokemonJumpGfx->mainState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_802DF70(TRUE); - gUnknown_02022D00->unk4++; + PrintPokeJumpPlayerNames(TRUE); + sPokemonJumpGfx->mainState++; } break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_802DFD4(); - gUnknown_02022D00->unk4++; + DrawPlayerNameWindows(); + sPokemonJumpGfx->mainState++; } break; case 3: if (!IsDma3ManagerBusyWithBgCopy()) - gUnknown_02022D00->unk0 = 1; + sPokemonJumpGfx->funcFinished = TRUE; break; } } -static void sub_802D3BC(void) +static void ErasePlayerNames(void) { int i, numPlayers; - numPlayers = sub_802C8AC(); - switch (gUnknown_02022D00->unk4) + numPlayers = GetNumPokeJumpPlayers(); + switch (sPokemonJumpGfx->mainState) { case 0: for (i = 0; i < numPlayers; i++) - ClearWindowTilemap(gUnknown_02022D00->unk1C[i]); + ClearWindowTilemap(sPokemonJumpGfx->nameWindowIds[i]); - CopyBgTilemapBufferToVram(0); - gUnknown_02022D00->unk4++; + CopyBgTilemapBufferToVram(BG_INTERFACE); + sPokemonJumpGfx->mainState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { for (i = 0; i < numPlayers; i++) - RemoveWindow(gUnknown_02022D00->unk1C[i]); + RemoveWindow(sPokemonJumpGfx->nameWindowIds[i]); - gUnknown_02022D00->unk0 = 1; + sPokemonJumpGfx->funcFinished = TRUE; } break; } } -static void sub_802D448(void) +static void Msg_WantToPlayAgain(void) { - switch (gUnknown_02022D00->unk4) + switch (sPokemonJumpGfx->mainState) { case 0: - gUnknown_02022D00->unk12 = sub_802DA9C(1, 8, 20, 2); - AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gText_WantToPlayAgain2, 0, 1, TEXT_SPEED_FF, NULL); - CopyWindowToVram(gUnknown_02022D00->unk12, 2); - gUnknown_02022D00->unk4++; + sPokemonJumpGfx->msgWindowId = AddMessageWindow(1, 8, 20, 2); + AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, 1, gText_WantToPlayAgain2, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 2); + sPokemonJumpGfx->mainState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - PutWindowTilemap(gUnknown_02022D00->unk12); - DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14); - sub_802DB18(23, 7, 0); - CopyBgTilemapBufferToVram(0); - gUnknown_02022D00->unk4++; + PutWindowTilemap(sPokemonJumpGfx->msgWindowId); + DrawTextBorderOuter(sPokemonJumpGfx->msgWindowId, 1, 14); + CreatePokeJumpYesNoMenu(23, 7, 0); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sPokemonJumpGfx->mainState++; } break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) - gUnknown_02022D00->unk0 = 1; + sPokemonJumpGfx->funcFinished = TRUE; break; } } -static void sub_802D4F4(void) +static void Msg_SavingDontTurnOff(void) { - switch (gUnknown_02022D00->unk4) + switch (sPokemonJumpGfx->mainState) { case 0: - gUnknown_02022D00->unk12 = sub_802DA9C(2, 7, 26, 4); - AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gText_SavingDontTurnOffPower, 0, 1, TEXT_SPEED_FF, NULL); - CopyWindowToVram(gUnknown_02022D00->unk12, 2); - gUnknown_02022D00->unk4++; + sPokemonJumpGfx->msgWindowId = AddMessageWindow(2, 7, 26, 4); + AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, 1, gText_SavingDontTurnOffPower, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 2); + sPokemonJumpGfx->mainState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - PutWindowTilemap(gUnknown_02022D00->unk12); - DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14); - CopyBgTilemapBufferToVram(0); - gUnknown_02022D00->unk4++; + PutWindowTilemap(sPokemonJumpGfx->msgWindowId); + DrawTextBorderOuter(sPokemonJumpGfx->msgWindowId, 1, 14); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sPokemonJumpGfx->mainState++; } break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) - gUnknown_02022D00->unk0 = 1; + sPokemonJumpGfx->funcFinished = TRUE; break; } } -static void sub_802D598(void) +static void EraseMessage(void) { - switch (gUnknown_02022D00->unk4) + switch (sPokemonJumpGfx->mainState) { case 0: - sub_802DA14(); + ClearMessageWindow(); sub_8198C78(); - CopyBgTilemapBufferToVram(0); - gUnknown_02022D00->unk4++; + CopyBgTilemapBufferToVram(BG_INTERFACE); + sPokemonJumpGfx->mainState++; break; case 1: - if (!sub_802DA44() && !IsDma3ManagerBusyWithBgCopy()) - gUnknown_02022D00->unk0 = 1; + if (!RemoveMessageWindow() && !IsDma3ManagerBusyWithBgCopy()) + sPokemonJumpGfx->funcFinished = TRUE; break; } } -static void sub_802D5E4(void) +static void Msg_SomeoneDroppedOut(void) { - switch (gUnknown_02022D00->unk4) + switch (sPokemonJumpGfx->mainState) { case 0: - gUnknown_02022D00->unk12 = sub_802DA9C(2, 8, 22, 4); - AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gText_SomeoneDroppedOut2, 0, 1, TEXT_SPEED_FF, NULL); - CopyWindowToVram(gUnknown_02022D00->unk12, 2); - gUnknown_02022D00->unk4++; + sPokemonJumpGfx->msgWindowId = AddMessageWindow(2, 8, 22, 4); + AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, 1, gText_SomeoneDroppedOut2, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 2); + sPokemonJumpGfx->mainState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - PutWindowTilemap(gUnknown_02022D00->unk12); - DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14); - CopyBgTilemapBufferToVram(0); - gUnknown_02022D00->unk4++; + PutWindowTilemap(sPokemonJumpGfx->msgWindowId); + DrawTextBorderOuter(sPokemonJumpGfx->msgWindowId, 1, 14); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sPokemonJumpGfx->mainState++; } break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) - gUnknown_02022D00->unk0 = 1; + sPokemonJumpGfx->funcFinished = TRUE; break; } } -static void sub_802D688(void) +static void Msg_CommunicationStandby(void) { - switch (gUnknown_02022D00->unk4) + switch (sPokemonJumpGfx->mainState) { case 0: - gUnknown_02022D00->unk12 = sub_802DA9C(7, 10, 16, 2); - AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gText_CommunicationStandby4, 0, 1, TEXT_SPEED_FF, NULL); - CopyWindowToVram(gUnknown_02022D00->unk12, 2); - gUnknown_02022D00->unk4++; + sPokemonJumpGfx->msgWindowId = AddMessageWindow(7, 10, 16, 2); + AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, 1, gText_CommunicationStandby4, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 2); + sPokemonJumpGfx->mainState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - PutWindowTilemap(gUnknown_02022D00->unk12); - DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14); - CopyBgTilemapBufferToVram(0); - gUnknown_02022D00->unk4++; + PutWindowTilemap(sPokemonJumpGfx->msgWindowId); + DrawTextBorderOuter(sPokemonJumpGfx->msgWindowId, 1, 14); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sPokemonJumpGfx->mainState++; } break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) - gUnknown_02022D00->unk0 = 1; + sPokemonJumpGfx->funcFinished = TRUE; break; } } -static void sub_802D72C(void) +static void DoPokeJumpCountdown(void) { - switch (gUnknown_02022D00->unk4) + switch (sPokemonJumpGfx->mainState) { case 0: - sub_802D044(gUnknown_02022D00); - gUnknown_02022D00->unk4++; + StartPokeJumpCountdown(sPokemonJumpGfx); + sPokemonJumpGfx->mainState++; break; case 1: - if (!sub_802D068()) - gUnknown_02022D00->unk0 = 1; + if (!IsPokeJumpCountdownRunning()) + sPokemonJumpGfx->funcFinished = TRUE; break; } } -static void sub_802D764(void) +static void SetUpResetVineGfx(void) { - gUnknown_02022D00->unkA = 0; - gUnknown_02022D00->unkB = 0; - gUnknown_02022D00->unkC = 6; - sub_802DC9C(gUnknown_02022D00->unkC); + sPokemonJumpGfx->resetVineState = 0; + sPokemonJumpGfx->resetVineTimer = 0; + sPokemonJumpGfx->vineState = VINE_UPSWING_LOWER; + UpdateVineSwing(sPokemonJumpGfx->vineState); } -static bool32 sub_802D788(void) +static bool32 ResetVineGfx(void) { - switch (gUnknown_02022D00->unkA) + switch (sPokemonJumpGfx->resetVineState) { case 0: - gUnknown_02022D00->unkB++; - if (gUnknown_02022D00->unkB > 10) + sPokemonJumpGfx->resetVineTimer++; + if (sPokemonJumpGfx->resetVineTimer > 10) { - gUnknown_02022D00->unkB = 0; - gUnknown_02022D00->unkC++; - if (gUnknown_02022D00->unkC >= 10) + sPokemonJumpGfx->resetVineTimer = 0; + sPokemonJumpGfx->vineState++; + if (sPokemonJumpGfx->vineState >= NUM_VINESTATES) { - gUnknown_02022D00->unkC = 0; - gUnknown_02022D00->unkA++; + sPokemonJumpGfx->vineState = VINE_HIGHEST; + sPokemonJumpGfx->resetVineState++; } } - sub_802DC9C(gUnknown_02022D00->unkC); - if (gUnknown_02022D00->unkC != 7) + UpdateVineSwing(sPokemonJumpGfx->vineState); + if (sPokemonJumpGfx->vineState != VINE_UPSWING_LOW) break; case 1: return FALSE; @@ -3263,74 +3478,74 @@ static bool32 sub_802D788(void) return TRUE; } -static void sub_802D7E8(u16 itemId, u16 quantity) +static void PrintPrizeMessage(u16 itemId, u16 quantity) { - CopyItemNameHandlePlural(itemId, gUnknown_02022D00->txtBuff[0], quantity); - ConvertIntToDecimalStringN(gUnknown_02022D00->txtBuff[1], quantity, STR_CONV_MODE_LEFT_ALIGN, 1); + CopyItemNameHandlePlural(itemId, sPokemonJumpGfx->itemName, quantity); + ConvertIntToDecimalStringN(sPokemonJumpGfx->itemQuantityStr, quantity, STR_CONV_MODE_LEFT_ALIGN, 1); DynamicPlaceholderTextUtil_Reset(); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02022D00->txtBuff[0]); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gUnknown_02022D00->txtBuff[1]); - DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_02022D00->strBuff, gText_AwesomeWonF701F700); - gUnknown_02022D00->unk12 = sub_802DA9C(4, 8, 22, 4); - AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gUnknown_02022D00->strBuff, 0, 1, TEXT_SPEED_FF, NULL); - CopyWindowToVram(gUnknown_02022D00->unk12, 2); - gUnknown_02022D00->unk14 = MUS_LEVEL_UP; - gUnknown_02022D00->unkD = 0; + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sPokemonJumpGfx->itemName); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, sPokemonJumpGfx->itemQuantityStr); + DynamicPlaceholderTextUtil_ExpandPlaceholders(sPokemonJumpGfx->prizeMsg, gText_AwesomeWonF701F700); + sPokemonJumpGfx->msgWindowId = AddMessageWindow(4, 8, 22, 4); + AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, 1, sPokemonJumpGfx->prizeMsg, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 2); + sPokemonJumpGfx->fanfare = MUS_LEVEL_UP; + sPokemonJumpGfx->msgWindowState = 0; } -static void sub_802D884(u16 itemId) +static void PrintPrizeFilledBagMessage(u16 itemId) { - CopyItemName(itemId, gUnknown_02022D00->txtBuff[0]); + CopyItemName(itemId, sPokemonJumpGfx->itemName); DynamicPlaceholderTextUtil_Reset(); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02022D00->txtBuff[0]); - DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_02022D00->strBuff, gText_FilledStorageSpace2); - gUnknown_02022D00->unk12 = sub_802DA9C(4, 8, 22, 4); - AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gUnknown_02022D00->strBuff, 0, 1, TEXT_SPEED_FF, NULL); - CopyWindowToVram(gUnknown_02022D00->unk12, 2); - gUnknown_02022D00->unk14 = 0; - gUnknown_02022D00->unkD = 0; + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sPokemonJumpGfx->itemName); + DynamicPlaceholderTextUtil_ExpandPlaceholders(sPokemonJumpGfx->prizeMsg, gText_FilledStorageSpace2); + sPokemonJumpGfx->msgWindowId = AddMessageWindow(4, 8, 22, 4); + AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, 1, sPokemonJumpGfx->prizeMsg, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 2); + sPokemonJumpGfx->fanfare = MUS_DUMMY; + sPokemonJumpGfx->msgWindowState = 0; } -static void sub_802D8FC(u16 itemId) +static void PrintNoRoomForPrizeMessage(u16 itemId) { - CopyItemName(itemId, gUnknown_02022D00->txtBuff[0]); + CopyItemName(itemId, sPokemonJumpGfx->itemName); DynamicPlaceholderTextUtil_Reset(); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02022D00->txtBuff[0]); - DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_02022D00->strBuff, gText_CantHoldMore); - gUnknown_02022D00->unk12 = sub_802DA9C(4, 9, 22, 2); - AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gUnknown_02022D00->strBuff, 0, 1, TEXT_SPEED_FF, NULL); - CopyWindowToVram(gUnknown_02022D00->unk12, 2); - gUnknown_02022D00->unk14 = 0; - gUnknown_02022D00->unkD = 0; + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sPokemonJumpGfx->itemName); + DynamicPlaceholderTextUtil_ExpandPlaceholders(sPokemonJumpGfx->prizeMsg, gText_CantHoldMore); + sPokemonJumpGfx->msgWindowId = AddMessageWindow(4, 9, 22, 2); + AddTextPrinterParameterized(sPokemonJumpGfx->msgWindowId, 1, sPokemonJumpGfx->prizeMsg, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 2); + sPokemonJumpGfx->fanfare = MUS_DUMMY; + sPokemonJumpGfx->msgWindowState = 0; } -static bool32 sub_802D974(void) +static bool32 DoPrizeMessageAndFanfare(void) { - switch (gUnknown_02022D00->unkD) + switch (sPokemonJumpGfx->msgWindowState) { case 0: if (!IsDma3ManagerBusyWithBgCopy()) { - PutWindowTilemap(gUnknown_02022D00->unk12); - DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14); - CopyBgTilemapBufferToVram(0); - gUnknown_02022D00->unkD++; + PutWindowTilemap(sPokemonJumpGfx->msgWindowId); + DrawTextBorderOuter(sPokemonJumpGfx->msgWindowId, 1, 14); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sPokemonJumpGfx->msgWindowState++; } break; case 1: if (IsDma3ManagerBusyWithBgCopy()) break; - if (gUnknown_02022D00->unk14 == 0) + if (sPokemonJumpGfx->fanfare == MUS_DUMMY) { - gUnknown_02022D00->unkD += 2; + sPokemonJumpGfx->msgWindowState += 2; return FALSE; } - PlayFanfare(gUnknown_02022D00->unk14); - gUnknown_02022D00->unkD++; + PlayFanfare(sPokemonJumpGfx->fanfare); + sPokemonJumpGfx->msgWindowState++; case 2: if (!IsFanfareTaskInactive()) break; - gUnknown_02022D00->unkD++; + sPokemonJumpGfx->msgWindowState++; case 3: return FALSE; } @@ -3338,52 +3553,50 @@ static bool32 sub_802D974(void) return TRUE; } -static void sub_802DA14(void) +static void ClearMessageWindow(void) { - if (gUnknown_02022D00->unk12 != 0xFF) + if (sPokemonJumpGfx->msgWindowId != WINDOW_NONE) { - rbox_fill_rectangle(gUnknown_02022D00->unk12); - CopyWindowToVram(gUnknown_02022D00->unk12, 1); - gUnknown_02022D00->unkD = 0; + rbox_fill_rectangle(sPokemonJumpGfx->msgWindowId); + CopyWindowToVram(sPokemonJumpGfx->msgWindowId, 1); + sPokemonJumpGfx->msgWindowState = 0; } } -// Can't match this without the ugly GOTO, oh well. -static bool32 sub_802DA44(void) +static bool32 RemoveMessageWindow(void) { - if (gUnknown_02022D00->unk12 == 0xFF) - { - RET_FALSE: + if (sPokemonJumpGfx->msgWindowId == WINDOW_NONE) return FALSE; - } - if (gUnknown_02022D00->unkD == 0) + switch (sPokemonJumpGfx->msgWindowState) { + case 0: if (!IsDma3ManagerBusyWithBgCopy()) { - RemoveWindow(gUnknown_02022D00->unk12); - gUnknown_02022D00->unk12 = 0xFF; - gUnknown_02022D00->unkD++; - goto RET_FALSE; + RemoveWindow(sPokemonJumpGfx->msgWindowId); + sPokemonJumpGfx->msgWindowId = WINDOW_NONE; + sPokemonJumpGfx->msgWindowState++; } + else + break; + case 1: + return FALSE; } - else if (gUnknown_02022D00->unkD == 1) - goto RET_FALSE; return TRUE; } -static s8 sub_802DA8C(void) +static s8 HandlePlayAgainInput(void) { return Menu_ProcessInputNoWrapClearOnChoose(); } -static u32 sub_802DA9C(u32 left, u32 top, u32 width, u32 height) +static u32 AddMessageWindow(u32 left, u32 top, u32 width, u32 height) { u32 windowId; struct WindowTemplate window; - window.bg = 0; + window.bg = BG_INTERFACE; window.tilemapLeft = left; window.tilemapTop = top; window.width = width; @@ -3396,12 +3609,12 @@ static u32 sub_802DA9C(u32 left, u32 top, u32 width, u32 height) return windowId; } -static void sub_802DB18(u16 left, u16 top, u8 cursorPos) +static void CreatePokeJumpYesNoMenu(u16 left, u16 top, u8 cursorPos) { struct WindowTemplate window; u8 a = cursorPos; - window.bg = 0; + window.bg = BG_INTERFACE; window.tilemapLeft = left; window.tilemapTop = top; window.width = 6; @@ -3412,171 +3625,212 @@ static void sub_802DB18(u16 left, u16 top, u8 cursorPos) CreateYesNoMenu(&window, 1, 0xD, a); } -static void sub_802DB8C(void) +// "Points" for jump score and "times" for number of jumps in a row +static void PrintScoreSuffixes(void) { u8 color[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY}; - PutWindowTilemap(0); - PutWindowTilemap(1); - FillWindowPixelBuffer(0, 0); - FillWindowPixelBuffer(1, 0); - AddTextPrinterParameterized3(0, 0, 0, 1, color, 0, gText_SpacePoints2); - AddTextPrinterParameterized3(1, 0, 0, 1, color, 0, gText_SpaceTimes3); + PutWindowTilemap(WIN_POINTS); + PutWindowTilemap(WIN_TIMES); + FillWindowPixelBuffer(WIN_POINTS, 0); + FillWindowPixelBuffer(WIN_TIMES, 0); + AddTextPrinterParameterized3(WIN_POINTS, 0, 0, 1, color, 0, gText_SpacePoints2); + AddTextPrinterParameterized3(WIN_TIMES, 0, 0, 1, color, 0, gText_SpaceTimes3); } -static const u8 gUnknown_082FE1DF[] = {2, 2, 0, 0, 1, 1, 1, 0, 0, 2, 0, 0, 0}; - -static const struct CompressedSpriteSheet gUnknown_082FE1EC = {gUnknown_082FF1F8, 0, 0x320}; -static const struct SpritePalette gUnknown_082FE1F4 = {gUnknown_082FF1D8, 0x320}; - -static const u16 gUnknown_082FE1FC[] = {0x06, 0x08, 0x10, 0x08}; -static const u16 gUnknown_082FE204[] = {0x06, 0x08, 0x0b, 0x06, 0x10, 0x08}; -static const u16 gUnknown_082FE210[] = {0x02, 0x06, 0x06, 0x08, 0x10, 0x08, 0x14, 0x06}; -static const u16 gUnknown_082FE220[] = {0x02, 0x06, 0x06, 0x08, 0x0b, 0x06, 0x10, 0x08, 0x14, 0x06}; - -static const u16 *const gUnknown_082FE234[] = -{ - gUnknown_082FE1FC, - gUnknown_082FE204, - gUnknown_082FE210, - gUnknown_082FE220, +// The venusaurs in the background are actually an empty 256x512 bg with 3 pairs of venusaurs on it. +// The below array is used to get values for where to set the bg Y to show the corresponding +// venusaur pair in their state of swinging the vine rope +// NEUTRAL/DOWN/UP refers to which direction the Venusaur is facing as it swings the vine +enum { + VENUSAUR_NEUTRAL, + VENUSAUR_DOWN, + VENUSAUR_UP, }; -static const s16 gUnknown_082FE244[] = {0x0058, 0x0098}; -static const s16 gUnknown_082FE248[] = {0x0058, 0x0078, 0x0098}; -static const s16 gUnknown_082FE24E[] = {0x0038, 0x0058, 0x0098, 0x00b8}; -static const s16 gUnknown_082FE256[] = {0x0038, 0x0058, 0x0078, 0x0098, 0x00b8}; - -static const s16 *const gUnknown_082FE260[] = -{ - gUnknown_082FE244, - gUnknown_082FE248, - gUnknown_082FE24E, - gUnknown_082FE256, +static const u8 sVenusaurStates[] = { + [VINE_HIGHEST] = VENUSAUR_UP, + [VINE_DOWNSWING_HIGHER] = VENUSAUR_UP, + [VINE_DOWNSWING_HIGH] = VENUSAUR_NEUTRAL, + [VINE_DOWNSWING_LOW] = VENUSAUR_NEUTRAL, + [VINE_DOWNSWING_LOWER] = VENUSAUR_DOWN, + [VINE_LOWEST] = VENUSAUR_DOWN, + [VINE_UPSWING_LOWER] = VENUSAUR_DOWN, + [VINE_UPSWING_LOW] = VENUSAUR_NEUTRAL, + [VINE_UPSWING_HIGH] = VENUSAUR_NEUTRAL, + [VINE_UPSWING_HIGHER] = VENUSAUR_UP, }; -static void sub_802DBF8(void) +static const struct CompressedSpriteSheet sSpriteSheet_Digits = {gMinigameDigits_Gfx, 0, TAG_DIGITS}; +static const struct SpritePalette sSpritePalette_Digits = {gMinigameDigits_Pal, TAG_DIGITS}; + +static const u16 sPlayerNameWindowCoords_2Players[] = { + 6, 8, + 16, 8 +}; +static const u16 sPlayerNameWindowCoords_3Players[] = { + 6, 8, + 11, 6, + 16, 8 +}; +static const u16 sPlayerNameWindowCoords_4Players[] = { + 2, 6, + 6, 8, + 16, 8, + 20, 6 +}; +static const u16 sPlayerNameWindowCoords_5Players[] = { + 2, 6, + 6, 8, + 11, 6, + 16, 8, + 20, 6 +}; + +static const u16 *const sPlayerNameWindowCoords[MAX_RFU_PLAYERS - 1] = { - int i, y, playersCount = sub_802C8AC(); - const s16 *xCoords = gUnknown_082FE260[playersCount - 2]; + sPlayerNameWindowCoords_2Players, + sPlayerNameWindowCoords_3Players, + sPlayerNameWindowCoords_4Players, + sPlayerNameWindowCoords_5Players, +}; + +static const s16 sMonXCoords_2Players[] = {88, 152}; +static const s16 sMonXCoords_3Players[] = {88, 120, 152}; +static const s16 sMonXCoords_4Players[] = {56, 88, 152, 184}; +static const s16 sMonXCoords_5Players[] = {56, 88, 120, 152, 184}; + +static const s16 *const sMonXCoords[MAX_RFU_PLAYERS - 1] = +{ + sMonXCoords_2Players, + sMonXCoords_3Players, + sMonXCoords_4Players, + sMonXCoords_5Players, +}; + +static void CreateJumpMonSprites(void) +{ + int i, y, playersCount = GetNumPokeJumpPlayers(); + const s16 *xCoords = sMonXCoords[playersCount - 2]; for (i = 0; i < playersCount; i++) { - struct PokemonJump1_MonInfo *info = sub_802C8C8(i); + struct PokemonJump_MonInfo *monInfo = GetMonInfoByMultiplayerId(i); - y = gMonFrontPicCoords[info->species].y_offset; - sub_802C9D4(gUnknown_02022D00, info, *xCoords, y + 112, i); - sub_802CE48(gUnknown_02022D00, *xCoords, 112, i); + y = gMonFrontPicCoords[monInfo->species].y_offset; + CreateJumpMonSprite(sPokemonJumpGfx, monInfo, *xCoords, y + 112, i); + CreateStarSprite(sPokemonJumpGfx, *xCoords, 112, i); xCoords++; } } -static void sub_802DC80(u32 id, s16 y) +static void SetMonSpriteY(u32 id, s16 y) { - gUnknown_02022D00->unk81A8[id]->pos2.y = y; + sPokemonJumpGfx->monSprites[id]->pos2.y = y; } -static void sub_802DC9C(int id) +static void UpdateVineSwing(int vineState) { - sub_802CF50(gUnknown_02022D00, id); - ChangeBgY(2, (gUnknown_082FE1DF[id] * 5) << 0xD, 0); + UpdateVineAnim(sPokemonJumpGfx, vineState); + ChangeBgY(BG_VENUSAUR, (sVenusaurStates[vineState] * 5) << 13, 0); } -static int sub_802DCCC(u8 flags) +static int DoSameJumpTimeBonus(u8 flags) { - int i, count; + int i, numPlayers; - for (i = 0, count = 0; i < 5; i++) + for (i = 0, numPlayers = 0; i < MAX_RFU_PLAYERS; i++) { if (flags & 1) { - sub_802CB14(gUnknown_02022D00, i); - count++; + // Player was part of a synchronous jump + // Give a bonus to them + DoStarAnim(sPokemonJumpGfx, i); + numPlayers++; } flags >>= 1; } - sub_802E00C(count - 2); - return count; + ShowBonus(numPlayers - 2); + return numPlayers; } -static void sub_802DD08(void) +static void InitDigitPrinters(void) { - struct DigitObjUtilTemplate template; - struct DigitObjUtilTemplate *ptr = &template; // This temp variable is needed to match, don't ask me why. + struct DigitObjUtilTemplate template = { + .shape = SPRITE_SHAPE(8x8), + .size = SPRITE_SIZE(8x8), + .strConvMode = 0, + .priority = 1, + .oamCount = 5, + .xDelta = 8, + .x = 108, + .y = 6, + .spriteSheet = (void*) &sSpriteSheet_Digits, + .spritePal = &sSpritePalette_Digits, + }; - ptr->shape = SPRITE_SHAPE(8x8); - ptr->size = SPRITE_SIZE(8x8); - ptr->strConvMode = 0; - ptr->priority = 1; - ptr->oamCount = 5; - ptr->xDelta = 8; - ptr->x = 108; - ptr->y = 6; - ptr->spriteSheet = (void*) &gUnknown_082FE1EC; - ptr->spritePal = &gUnknown_082FE1F4; - - DigitObjUtil_Init(2); - DigitObjUtil_CreatePrinter(0, 0, ptr); + DigitObjUtil_Init(NUM_WINDOWS); + DigitObjUtil_CreatePrinter(WIN_POINTS, 0, &template); template.oamCount = 4; template.x = 30; template.y = 6; - DigitObjUtil_CreatePrinter(1, 0, &template); + DigitObjUtil_CreatePrinter(WIN_TIMES, 0, &template); } -static void sub_802DD64(int arg0) +static void PrintScore(int num) { - DigitObjUtil_PrintNumOn(0, arg0); + DigitObjUtil_PrintNumOn(WIN_POINTS, num); } -static void sub_802DD74(u16 arg0) +static void PrintJumpsInRow(u16 num) { - DigitObjUtil_PrintNumOn(1, arg0); + DigitObjUtil_PrintNumOn(WIN_TIMES, num); } -static void sub_802DD88(u8 multiplayerId) +static void StartMonHitShake(u8 multiplayerId) { - sub_802CBF0(gUnknown_02022D00, multiplayerId); + Gfx_StartMonHitShake(sPokemonJumpGfx, multiplayerId); } -static void sub_802DDA0(u8 multiplayerId) +static void StartMonHitFlash(u8 multiplayerId) { - sub_802CC88(gUnknown_02022D00, multiplayerId); + Gfx_StartMonHitFlash(sPokemonJumpGfx, multiplayerId); } -static int sub_802DDB8(int multiplayerId) +static int IsMonHitShakeActive(int multiplayerId) { - return sub_802CC18(gUnknown_02022D00, multiplayerId); + return Gfx_IsMonHitShakeActive(sPokemonJumpGfx, multiplayerId); } -static void sub_802DDCC(void) +static void StopMonHitFlash(void) { - sub_802CCB0(gUnknown_02022D00); + Gfx_StopMonHitFlash(sPokemonJumpGfx); } -static void sub_802DDE0(void) +static void ResetMonSpriteSubpriorities(void) { - sub_802CD3C(gUnknown_02022D00); + Gfx_ResetMonSpriteSubpriorities(sPokemonJumpGfx); } -static void sub_802DDF4(int multiplayerId) +static void StartMonIntroBounce(int multiplayerId) { - sub_802CD70(gUnknown_02022D00, multiplayerId); + Gfx_StartMonIntroBounce(sPokemonJumpGfx, multiplayerId); } -static int sub_802DE08(void) +static int IsMonIntroBounceActive(void) { - return sub_802CD98(gUnknown_02022D00); + return Gfx_IsMonIntroBounceActive(sPokemonJumpGfx); } -static void sub_802DE1C(void) +static void AddPlayerNameWindows(void) { struct WindowTemplate window; - int i, playersCount = sub_802C8AC(); - const u16 *winCoords = gUnknown_082FE234[playersCount - 2]; + int i, playersCount = GetNumPokeJumpPlayers(); + const u16 *winCoords = sPlayerNameWindowCoords[playersCount - 2]; - window.bg = 0; + window.bg = BG_INTERFACE; window.width = 8; window.height = 2; window.paletteNum = 2; @@ -3586,107 +3840,108 @@ static void sub_802DE1C(void) { window.tilemapLeft = winCoords[0]; window.tilemapTop = winCoords[1]; - gUnknown_02022D00->unk1C[i] = AddWindow(&window); - ClearWindowTilemap(gUnknown_02022D00->unk1C[i]); + sPokemonJumpGfx->nameWindowIds[i] = AddWindow(&window); + ClearWindowTilemap(sPokemonJumpGfx->nameWindowIds[i]); window.baseBlock += 0x10; winCoords += 2; } - CopyBgTilemapBufferToVram(0); + CopyBgTilemapBufferToVram(BG_INTERFACE); } -static void sub_802DED8(int multiplayerId, u8 clr1, u8 clr2, u8 clr3) +static void PrintPokeJumpPlayerName(int multiplayerId, u8 bgColor, u8 fgColor, u8 shadow) { u32 x; - u8 colors[3] = {clr1, clr2, clr3}; + u8 colors[3] = {bgColor, fgColor, shadow}; - FillWindowPixelBuffer(gUnknown_02022D00->unk1C[multiplayerId], 0); - x = 64 - GetStringWidth(1, sub_802C8E8(multiplayerId), -1); + FillWindowPixelBuffer(sPokemonJumpGfx->nameWindowIds[multiplayerId], 0); + x = 64 - GetStringWidth(1, GetPokeJumpPlayerName(multiplayerId), -1); x /= 2; - AddTextPrinterParameterized3(gUnknown_02022D00->unk1C[multiplayerId], 1, x, 1, colors, -1, sub_802C8E8(multiplayerId)); - CopyWindowToVram(gUnknown_02022D00->unk1C[multiplayerId], 2); + AddTextPrinterParameterized3(sPokemonJumpGfx->nameWindowIds[multiplayerId], 1, x, 1, colors, -1, GetPokeJumpPlayerName(multiplayerId)); + CopyWindowToVram(sPokemonJumpGfx->nameWindowIds[multiplayerId], 2); } -static void sub_802DF70(bool32 arg0) +static void PrintPokeJumpPlayerNames(bool32 highlightSelf) { - int i, var, playersCount = sub_802C8AC(); + int i, multiplayerId, playersCount = GetNumPokeJumpPlayers(); - if (!arg0) + if (!highlightSelf) { for (i = 0; i < playersCount; i++) - sub_802DED8(i, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY); + PrintPokeJumpPlayerName(i, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY); } else { - var = sub_802C8BC(); + // Highlight own name + multiplayerId = GetPokeJumpMultiplayerId(); for (i = 0; i < playersCount; i++) { - if (var != i) - sub_802DED8(i, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY); + if (multiplayerId != i) + PrintPokeJumpPlayerName(i, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY); else - sub_802DED8(i, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_RED, TEXT_COLOR_LIGHT_RED); + PrintPokeJumpPlayerName(i, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_RED, TEXT_COLOR_LIGHT_RED); } } } -static void sub_802DFD4(void) +static void DrawPlayerNameWindows(void) { - int i, playersCount = sub_802C8AC(); + int i, playersCount = GetNumPokeJumpPlayers(); for (i = 0; i < playersCount; i++) - PutWindowTilemap(gUnknown_02022D00->unk1C[i]); - CopyBgTilemapBufferToVram(0); + PutWindowTilemap(sPokemonJumpGfx->nameWindowIds[i]); + CopyBgTilemapBufferToVram(BG_INTERFACE); } -static void sub_802E00C(u8 arg0) +static void ShowBonus(u8 bonusId) { - gUnknown_02022D00->unk18 = 0; - ChangeBgX(1, (arg0 / 2) << 16, 0); - ChangeBgY(1, (((arg0 % 2) << 8) - 40) << 8, 0); - ShowBg(1); - CreateTask(sub_802E090, 4); + sPokemonJumpGfx->bonusTimer = 0; + ChangeBgX(BG_BONUSES, (bonusId / 2) * 256 * 256, 0); + ChangeBgY(BG_BONUSES, (((bonusId % 2) * 256) - 40) * 256, 0); + ShowBg(BG_BONUSES); + CreateTask(Task_UpdateBonus, 4); } -static bool32 sub_802E058(void) +static bool32 UpdateBonus(void) { - if (gUnknown_02022D00->unk18 >= 32) + if (sPokemonJumpGfx->bonusTimer >= 32) { return FALSE; } else { - ChangeBgY(1, 128, 1); - if (++gUnknown_02022D00->unk18 >= 32) - HideBg(1); + ChangeBgY(BG_BONUSES, 128, 1); + if (++sPokemonJumpGfx->bonusTimer >= 32) + HideBg(BG_BONUSES); return TRUE; } } -static void sub_802E090(u8 taskId) +static void Task_UpdateBonus(u8 taskId) { - if (!sub_802E058()) + if (!UpdateBonus()) DestroyTask(taskId); } struct MonInfoPacket { - u8 id; // packet id + u8 id; u16 species; u32 personality; u32 otId; }; -static void sub_802E0AC(struct PokemonJump1_MonInfo *arg0) +static void SendPacket_MonInfo(struct PokemonJump_MonInfo *monInfo) { struct MonInfoPacket packet; - packet.id = 1, - packet.species = arg0->species, - packet.otId = arg0->otId, - packet.personality = arg0->personality, + packet.id = PACKET_MON_INFO, + packet.species = monInfo->species, + packet.otId = monInfo->otId, + packet.personality = monInfo->personality, Rfu_SendPacket(&packet); } -static bool32 sub_802E0D0(int multiplayerId, struct PokemonJump1_MonInfo *arg0) +static bool32 RecvPacket_MonInfo(int multiplayerId, struct PokemonJump_MonInfo *monInfo) { struct MonInfoPacket packet; @@ -3694,180 +3949,185 @@ static bool32 sub_802E0D0(int multiplayerId, struct PokemonJump1_MonInfo *arg0) return FALSE; memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet)); - if (packet.id == 1) + if (packet.id == PACKET_MON_INFO) { - arg0->species = packet.species; - arg0->otId = packet.otId; - arg0->personality = packet.personality; + monInfo->species = packet.species; + monInfo->otId = packet.otId; + monInfo->personality = packet.personality; return TRUE; } return FALSE; } -struct UnkPacket2 +struct UnusedPacket { - u8 id; // packet id - u32 unk4; - u32 unk8; + u8 id; + u32 data; + u32 filler; }; -static void sub_802E120(u32 arg0) +// Data packet that's never sent +// No function to read it either +static void SendPacket_Unused(u32 data) { - struct UnkPacket2 packet; - packet.id = 2; - packet.unk4 = arg0; + struct UnusedPacket packet; + packet.id = PACKET_UNUSED; + packet.data = data; Rfu_SendPacket(&packet); } -struct UnkPacket3 +struct LeaderStatePacket { - u8 id; // packet id - u8 unk1; - u8 unk2; - u8 unk3_0:5; - u8 unk3_1:3; - u16 unk4; - u16 unk6; - u32 unk8_0:15; - u32 unk8_1:17; + u8 id; + u8 funcId; + u8 monState; + u8 receivedBonusFlags:5; // 1 bit for each player (MAX_RFU_PLAYERS) + u8 jumpState:3; + u16 jumpTimeStart; + u16 vineTimer; + u32 jumpsInRow:15; + u32 jumpScore:17; }; -static void sub_802E138(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *arg1) +static void SendPacket_LeaderState(struct PokemonJump_Player *player, struct PokemonJump_CommData *comm) { - struct UnkPacket3 packet; - packet.id = 3; - packet.unk8_1 = arg1->unk8; - packet.unk3_0 = arg1->unk1; - packet.unk1 = arg1->unk0; - packet.unk6 = arg1->unk2; - packet.unk8_0 = arg1->unk4; - packet.unk2 = arg0->unk10; - packet.unk3_1 = arg0->unk14; - packet.unk4 = arg0->unkE; + struct LeaderStatePacket packet; + packet.id = PACKET_LEADER_STATE; + packet.jumpScore = comm->jumpScore; + packet.receivedBonusFlags = comm->receivedBonusFlags; + packet.funcId = comm->funcId; + packet.vineTimer = comm->data; + packet.jumpsInRow = comm->jumpsInRow; + packet.monState = player->monState; + packet.jumpState = player->jumpState; + packet.jumpTimeStart = player->jumpTimeStart; Rfu_SendPacket(&packet); } -static bool32 sub_802E1BC(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *arg1) +// Used by group members to read the state of the group leader +static bool32 RecvPacket_LeaderState(struct PokemonJump_Player *player, struct PokemonJump_CommData *comm) { - struct UnkPacket3 packet; + struct LeaderStatePacket packet; if ((gRecvCmds[0][0] & 0xFF00) != RFUCMD_SEND_PACKET) return FALSE; memcpy(&packet, &gRecvCmds[0][1], sizeof(packet)); - if (packet.id != 3) + if (packet.id != PACKET_LEADER_STATE) return FALSE; - arg1->unk8 = packet.unk8_1; - arg1->unk1 = packet.unk3_0; - arg1->unk0 = packet.unk1; - arg1->unk2 = packet.unk6; - arg1->unk4 = packet.unk8_0; - arg0->unk10 = packet.unk2; - arg0->unk14 = packet.unk3_1; - arg0->unkE = packet.unk4; + comm->jumpScore = packet.jumpScore; + comm->receivedBonusFlags = packet.receivedBonusFlags; + comm->funcId = packet.funcId; + comm->data = packet.vineTimer; + comm->jumpsInRow = packet.jumpsInRow; + player->monState = packet.monState; + player->jumpState = packet.jumpState; + player->jumpTimeStart = packet.jumpTimeStart; return TRUE; } -struct UnkPacket4 +struct MemberStatePacket { - u8 id; // packet id - u8 unk1; - u8 unk2; - u8 unk3; - u16 unk4; - u8 unk6; - u16 unk8; + u8 id; + u8 monState; + u8 jumpState; + bool8 funcFinished; + u16 jumpTimeStart; + u8 funcId; + u16 playAgainState; }; -static void sub_802E234(struct PokemonJump1_82E4 *arg0, u8 arg1, u16 arg2) +static void SendPacket_MemberState(struct PokemonJump_Player *player, u8 funcId, u16 playAgainState) { - struct UnkPacket4 packet; - packet.id = 4; - packet.unk1 = arg0->unk10; - packet.unk2 = arg0->unk14; - packet.unk3 = arg0->unk18; - packet.unk4 = arg0->unkE; - packet.unk6 = arg1; - packet.unk8 = arg2; + struct MemberStatePacket packet; + packet.id = PACKET_MEMBER_STATE; + packet.monState = player->monState; + packet.jumpState = player->jumpState; + packet.funcFinished = player->funcFinished; + packet.jumpTimeStart = player->jumpTimeStart; + packet.funcId = funcId; + packet.playAgainState = playAgainState; Rfu_SendPacket(&packet); } -static bool32 sub_802E264(struct PokemonJump1_82E4 *arg0, int multiplayerId, u8 *arg2, u16 *arg3) +// Used by the group leader to read the state of group members +static bool32 RecvPacket_MemberStateToLeader(struct PokemonJump_Player *player, int multiplayerId, u8 *funcId, u16 *playAgainState) { - struct UnkPacket4 packet; + struct MemberStatePacket packet; if ((gRecvCmds[multiplayerId][0] & 0xFF00) != RFUCMD_SEND_PACKET) return FALSE; memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet)); - if (packet.id != 4) + if (packet.id != PACKET_MEMBER_STATE) return FALSE; - arg0->unk10 = packet.unk1; - arg0->unk14 = packet.unk2; - arg0->unk18 = packet.unk3; - arg0->unkE = packet.unk4; - *arg2 = packet.unk6; - *arg3 = packet.unk8; + player->monState = packet.monState; + player->jumpState = packet.jumpState; + player->funcFinished = packet.funcFinished; + player->jumpTimeStart = packet.jumpTimeStart; + *funcId = packet.funcId; + *playAgainState = packet.playAgainState; return TRUE; } -static bool32 sub_802E2D0(struct PokemonJump1_82E4 *arg0, int multiplayerId) +// Used by group members to read the state of other group members +static bool32 RecvPacket_MemberStateToMember(struct PokemonJump_Player *player, int multiplayerId) { - struct UnkPacket4 packet; + struct MemberStatePacket packet; if ((gRecvCmds[multiplayerId][0] & 0xFF00) != RFUCMD_SEND_PACKET) return FALSE; memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet)); - if (packet.id != 4) + if (packet.id != PACKET_MEMBER_STATE) return FALSE; - arg0->unk10 = packet.unk1; - arg0->unk14 = packet.unk2; - arg0->unk18 = packet.unk3; - arg0->unkE = packet.unk4; + player->monState = packet.monState; + player->jumpState = packet.jumpState; + player->funcFinished = packet.funcFinished; + player->jumpTimeStart = packet.jumpTimeStart; return TRUE; } -static struct PokemonJumpResults *sub_802E32C(void) +static struct PokemonJumpRecords *GetPokeJumpRecords(void) { return &gSaveBlock2Ptr->pokeJump; } -void ResetPokeJumpResults(void) +void ResetPokemonJumpRecords(void) { - struct PokemonJumpResults *pokeJump = sub_802E32C(); - pokeJump->jumpsInRow = 0; - pokeJump->bestJumpScore = 0; - pokeJump->excellentsInRow = 0; - pokeJump->field6 = 0; - pokeJump->field8 = 0; - pokeJump->field2 = 0; + struct PokemonJumpRecords *records = GetPokeJumpRecords(); + records->jumpsInRow = 0; + records->bestJumpScore = 0; + records->excellentsInRow = 0; + records->gamesWithMaxPlayers = 0; + records->unused2 = 0; + records->unused1 = 0; } -static bool32 sub_802E354(u32 jumpScore, u16 jumpsInRow, u16 excellentsInRow) +static bool32 TryUpdateRecords(u32 jumpScore, u16 jumpsInRow, u16 excellentsInRow) { - struct PokemonJumpResults *pokeJump = sub_802E32C(); - bool32 ret = FALSE; + struct PokemonJumpRecords *records = GetPokeJumpRecords(); + bool32 newRecord = FALSE; - if (pokeJump->bestJumpScore < jumpScore && jumpScore <= 99990) - pokeJump->bestJumpScore = jumpScore, ret = TRUE; - if (pokeJump->jumpsInRow < jumpsInRow && jumpsInRow <= 9999) - pokeJump->jumpsInRow = jumpsInRow, ret = TRUE; - if (pokeJump->excellentsInRow < excellentsInRow && excellentsInRow <= 9999) - pokeJump->excellentsInRow = excellentsInRow, ret = TRUE; + if (records->bestJumpScore < jumpScore && jumpScore <= MAX_JUMP_SCORE) + records->bestJumpScore = jumpScore, newRecord = TRUE; + if (records->jumpsInRow < jumpsInRow && jumpsInRow <= MAX_JUMPS) + records->jumpsInRow = jumpsInRow, newRecord = TRUE; + if (records->excellentsInRow < excellentsInRow && excellentsInRow <= MAX_JUMPS) + records->excellentsInRow = excellentsInRow, newRecord = TRUE; - return ret; + return newRecord; } -static void sub_802E3A8(void) +static void IncrementGamesWithMaxPlayers(void) { - struct PokemonJumpResults *pokeJump = sub_802E32C(); - if (pokeJump->field6 < 9999) - pokeJump->field6++; + struct PokemonJumpRecords *records = GetPokeJumpRecords(); + if (records->gamesWithMaxPlayers < 9999) + records->gamesWithMaxPlayers++; } void ShowPokemonJumpRecords(void) @@ -3876,7 +4136,7 @@ void ShowPokemonJumpRecords(void) Task_ShowPokemonJumpRecords(taskId); } -static const struct WindowTemplate gUnknown_082FE270 = +static const struct WindowTemplate sWindowTemplate_Records = { .bg = 0, .tilemapLeft = 1, @@ -3887,7 +4147,10 @@ static const struct WindowTemplate gUnknown_082FE270 = .baseBlock = 0x1, }; -static const u8 *const gUnknown_082FE278[] = {gText_JumpsInARow, gText_BestScore2, gText_ExcellentsInARow}; +static const u8 *const sRecordsTexts[] = {gText_JumpsInARow, gText_BestScore2, gText_ExcellentsInARow}; + +#define tState data[0] +#define tWindowId data[1] static void Task_ShowPokemonJumpRecords(u8 taskId) { @@ -3895,14 +4158,14 @@ static void Task_ShowPokemonJumpRecords(u8 taskId) int i, width, widthCurr; s16 *data = gTasks[taskId].data; - switch (data[0]) + switch (tState) { case 0: - window = gUnknown_082FE270; + window = sWindowTemplate_Records; width = GetStringWidth(1, gText_PkmnJumpRecords, 0); - for (i = 0; i < ARRAY_COUNT(gUnknown_082FE278); i++) + for (i = 0; i < ARRAY_COUNT(sRecordsTexts); i++) { - widthCurr = GetStringWidth(1, gUnknown_082FE278[i], 0) + 38; + widthCurr = GetStringWidth(1, sRecordsTexts[i], 0) + 38; if (widthCurr > width) width = widthCurr; } @@ -3911,27 +4174,27 @@ static void Task_ShowPokemonJumpRecords(u8 taskId) width++; window.tilemapLeft = (30 - width) / 2; window.width = width; - data[1] = AddWindow(&window); - sub_802E500(data[1], width); - CopyWindowToVram(data[1], 3); - data[0]++; + tWindowId = AddWindow(&window); + PrintRecordsText(tWindowId, width); + CopyWindowToVram(tWindowId, 3); + tState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) - data[0]++; + tState++; break; case 2: if (JOY_NEW(A_BUTTON | B_BUTTON)) { - rbox_fill_rectangle(data[1]); - CopyWindowToVram(data[1], 1); - data[0]++; + rbox_fill_rectangle(tWindowId); + CopyWindowToVram(tWindowId, 1); + tState++; } break; case 3: if (!IsDma3ManagerBusyWithBgCopy()) { - RemoveWindow(data[1]); + RemoveWindow(tWindowId); DestroyTask(taskId); EnableBothScriptContexts(); } @@ -3939,23 +4202,26 @@ static void Task_ShowPokemonJumpRecords(u8 taskId) } } -static void sub_802E500(u16 windowId, int width) +#undef tState +#undef tWindowId + +static void PrintRecordsText(u16 windowId, int width) { int i, x; - int results[3]; - struct PokemonJumpResults *pokeJump = sub_802E32C(); - results[0] = pokeJump->jumpsInRow; - results[1] = pokeJump->bestJumpScore; - results[2] = pokeJump->excellentsInRow; + int recordNums[3]; + struct PokemonJumpRecords *records = GetPokeJumpRecords(); + recordNums[0] = records->jumpsInRow; + recordNums[1] = records->bestJumpScore; + recordNums[2] = records->excellentsInRow; LoadUserWindowBorderGfx_(windowId, 0x21D, 0xD0); DrawTextBorderOuter(windowId, 0x21D, 0xD); FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); AddTextPrinterParameterized(windowId, 1, gText_PkmnJumpRecords, GetStringCenterAlignXOffset(1, gText_PkmnJumpRecords, width * 8), 1, TEXT_SPEED_FF, NULL); - for (i = 0; i < ARRAY_COUNT(gUnknown_082FE278); i++) + for (i = 0; i < ARRAY_COUNT(sRecordsTexts); i++) { - AddTextPrinterParameterized(windowId, 1, gUnknown_082FE278[i], 0, 25 + (i * 16), TEXT_SPEED_FF, NULL); - ConvertIntToDecimalStringN(gStringVar1, results[i], STR_CONV_MODE_LEFT_ALIGN, 5); + AddTextPrinterParameterized(windowId, 1, sRecordsTexts[i], 0, 25 + (i * 16), TEXT_SPEED_FF, NULL); + ConvertIntToDecimalStringN(gStringVar1, recordNums[i], STR_CONV_MODE_LEFT_ALIGN, 5); TruncateToFirstWordOnly(gStringVar1); x = (width * 8) - GetStringWidth(1, gStringVar1, 0); AddTextPrinterParameterized(windowId, 1, gStringVar1, x, 25 + (i * 16), TEXT_SPEED_FF, NULL); diff --git a/src/pokemon_size_record.c b/src/pokemon_size_record.c index f8b361912..4beb9c83f 100644 --- a/src/pokemon_size_record.c +++ b/src/pokemon_size_record.c @@ -36,11 +36,12 @@ static const struct UnknownStruct sBigMonSizeTable[] = { 1700, 1, -26 }, }; -static const u8 sGiftRibbonsMonDataIds[] = +// - 4 for unused gift ribbon bits in MON_DATA_UNUSED_RIBBONS +static const u8 sGiftRibbonsMonDataIds[GIFT_RIBBONS_COUNT - 4] = { - MON_DATA_GIFT_RIBBON_1, MON_DATA_GIFT_RIBBON_2, MON_DATA_GIFT_RIBBON_3, - MON_DATA_GIFT_RIBBON_4, MON_DATA_GIFT_RIBBON_5, MON_DATA_GIFT_RIBBON_6, - MON_DATA_GIFT_RIBBON_7 + MON_DATA_MARINE_RIBBON, MON_DATA_LAND_RIBBON, MON_DATA_SKY_RIBBON, + MON_DATA_COUNTRY_RIBBON, MON_DATA_NATIONAL_RIBBON, MON_DATA_EARTH_RIBBON, + MON_DATA_WORLD_RIBBON }; extern const u8 gText_DecimalPoint[]; @@ -197,10 +198,10 @@ void GiveGiftRibbonToParty(u8 index, u8 ribbonId) s32 i; bool32 gotRibbon = FALSE; u8 data = 1; - u8 array[8]; + u8 array[ARRAY_COUNT(sGiftRibbonsMonDataIds)]; memcpy(array, sGiftRibbonsMonDataIds, sizeof(sGiftRibbonsMonDataIds)); - if (index < 11 && ribbonId < 65) + if (index < GIFT_RIBBONS_COUNT && ribbonId <= MAX_GIFT_RIBBON) { gSaveBlock1Ptr->giftRibbons[index] = ribbonId; for (i = 0; i < PARTY_SIZE; i++) diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 50fc04372..3d6dc331c 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -231,7 +231,7 @@ struct PokemonStorageSystemData struct Sprite *field_D94; struct Sprite *field_D98[2]; u16 *field_DA0; - struct PokemonMarkMenu markMenu; + struct MonMarkingsMenu markMenu; struct UnkPSSStruct_2002370 field_1E5C; struct Pokemon movingMon; struct Pokemon field_2108; @@ -2323,8 +2323,8 @@ static void Cb_InitPSS(u8 taskId) { sPSSData->markMenu.baseTileTag = TAG_TILE_D; sPSSData->markMenu.basePaletteTag = TAG_PAL_DACE; - sub_811F90C(&sPSSData->markMenu); - sub_811FA90(); + InitMonMarkingsMenu(&sPSSData->markMenu); + BufferMonMarkingsMenuTiles(); } else { @@ -2336,12 +2336,12 @@ static void Cb_InitPSS(u8 taskId) SetMonIconTransparency(); if (!sPSSData->isReshowingPSS) { - BlendPalettes(0xFFFFFFFF, 0x10, RGB_BLACK); + BlendPalettes(PALETTES_ALL, 0x10, RGB_BLACK); SetPSSCallback(Cb_ShowPSS); } else { - BlendPalettes(0xFFFFFFFF, 0x10, RGB_BLACK); + BlendPalettes(PALETTES_ALL, 0x10, RGB_BLACK); SetPSSCallback(Cb_ReshowPSS); } SetVBlankCallback(VblankCb_PSS); @@ -2374,7 +2374,7 @@ static void Cb_ReshowPSS(u8 taskId) switch (sPSSData->state) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, -1, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 0x10, 0, RGB_BLACK); sPSSData->state++; break; case 1: @@ -3179,13 +3179,13 @@ static void Cb_ShowMarkMenu(u8 taskId) case 0: PrintStorageActionText(PC_TEXT_MARK_POKE); sPSSData->markMenu.markings = sPSSData->cursorMonMarkings; - sub_811FAA4(sPSSData->cursorMonMarkings, 0xb0, 0x10); + OpenMonMarkingsMenu(sPSSData->cursorMonMarkings, 0xb0, 0x10); sPSSData->state++; break; case 1: - if (!MonMarkingsMenuHandleInput()) + if (!HandleMonMarkingsMenuInput()) { - sub_811FAF8(); + FreeMonMarkingsMenu(); ClearBottomWindow(); SetMonMarkings(sPSSData->markMenu.markings); RefreshCursorMonData(); @@ -3681,7 +3681,7 @@ static void Cb_NameBox(u8 taskId) { case 0: sub_80CE760(); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sPSSData->state++; break; case 1: @@ -3701,7 +3701,7 @@ static void Cb_ShowMonSummary(u8 taskId) { case 0: sub_80CE7E8(); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sPSSData->state++; break; case 1: @@ -3720,7 +3720,7 @@ static void Cb_GiveItemFromBag(u8 taskId) switch (sPSSData->state) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sPSSData->state++; break; case 1: @@ -3983,7 +3983,7 @@ static void sub_80CA0D8(void) static void sub_80CA154(void) { - sPSSData->field_D94 = sub_811FFB4(TAG_TILE_10, TAG_PAL_DAC8, NULL); + sPSSData->field_D94 = CreateMonMarkingComboSprite(TAG_TILE_10, TAG_PAL_DAC8, NULL); sPSSData->field_D94->oam.priority = 1; sPSSData->field_D94->subpriority = 1; sPSSData->field_D94->pos1.x = 40; @@ -4126,7 +4126,7 @@ static void PrintCursorMonInfo(void) CopyWindowToVram(0, 2); if (sPSSData->cursorMonSpecies != SPECIES_NONE) { - sub_8120084(sPSSData->cursorMonMarkings, sPSSData->field_DA0); + UpdateMonMarkingTiles(sPSSData->cursorMonMarkings, sPSSData->field_DA0); sPSSData->field_D94->invisible = FALSE; } else @@ -5898,12 +5898,12 @@ static bool8 sub_80CD554(void) return TRUE; } -static void sub_80CD6AC(u8 newCurosrArea, u8 newCursorPosition) +static void sub_80CD6AC(u8 newCursorArea, u8 newCursorPosition) { u16 x, y; - sub_80CD444(newCurosrArea, newCursorPosition, &x, &y); - sPSSData->field_CD4 = newCurosrArea; + sub_80CD444(newCursorArea, newCursorPosition, &x, &y); + sPSSData->field_CD4 = newCursorArea; sPSSData->field_CD5 = newCursorPosition; sPSSData->field_CCC = x; sPSSData->field_CCE = y; @@ -5955,9 +5955,9 @@ static void sub_80CD70C(void) sPSSData->field_CC0 = sPSSData->field_CB4->pos1.y << 8; } -static void sub_80CD894(u8 newCurosrArea, u8 newCursorPosition) +static void sub_80CD894(u8 newCursorArea, u8 newCursorPosition) { - sub_80CD6AC(newCurosrArea, newCursorPosition); + sub_80CD6AC(newCursorArea, newCursorPosition); sub_80CD70C(); if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) { @@ -5977,19 +5977,19 @@ static void sub_80CD894(u8 newCurosrArea, u8 newCursorPosition) else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) sub_80D0E50(CURSOR_AREA_IN_PARTY, sBoxCursorPosition); - if (newCurosrArea == CURSOR_AREA_IN_BOX) - sub_80D0D8C(newCurosrArea, newCursorPosition); - else if (newCurosrArea == CURSOR_AREA_IN_PARTY) - sub_80D0D8C(newCurosrArea, newCursorPosition); + if (newCursorArea == CURSOR_AREA_IN_BOX) + sub_80D0D8C(newCursorArea, newCursorPosition); + else if (newCursorArea == CURSOR_AREA_IN_PARTY) + sub_80D0D8C(newCursorArea, newCursorPosition); } - if (newCurosrArea == CURSOR_AREA_IN_PARTY && sBoxCursorArea != CURSOR_AREA_IN_PARTY) + if (newCursorArea == CURSOR_AREA_IN_PARTY && sBoxCursorArea != CURSOR_AREA_IN_PARTY) { - sPSSData->field_CD6 = newCurosrArea; + sPSSData->field_CD6 = newCursorArea; sPSSData->field_CB8->invisible = TRUE; } - switch (newCurosrArea) + switch (newCursorArea) { case CURSOR_AREA_IN_PARTY: case CURSOR_AREA_BOX: diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index efada3509..2636aef52 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1303,7 +1303,7 @@ static bool8 LoadGraphics(void) break; case 17: sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON] = LoadMonGfxAndSprite(&sMonSummaryScreen->currentMon, &sMonSummaryScreen->switchCounter); - if (sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON] != 0xFF) + if (sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON] != SPRITE_NONE) { sMonSummaryScreen->switchCounter = 0; gMain.state++; @@ -1333,11 +1333,11 @@ static bool8 LoadGraphics(void) gMain.state++; break; case 23: - BlendPalettes(0xFFFFFFFF, 16, 0); + BlendPalettes(PALETTES_ALL, 16, 0); gMain.state++; break; case 24: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); gPaletteFade.bufferTransferDisabled = 0; gMain.state++; break; @@ -1559,7 +1559,7 @@ static void FreeSummaryScreen(void) static void BeginCloseSummaryScreen(u8 taskId) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].func = CloseSummaryScreen; } @@ -1715,7 +1715,7 @@ static void Task_ChangeSummaryMon(u8 taskId) break; case 8: sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON] = LoadMonGfxAndSprite(&sMonSummaryScreen->currentMon, &data[1]); - if (sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON] == 0xFF) + if (sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON] == SPRITE_NONE) return; gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON]].data[2] = 1; TryDrawExperienceProgressBar(); @@ -2493,7 +2493,7 @@ static void HandlePowerAccTilemap(u16 a, s16 b) else { u8 taskId = FindTaskIdByFunc(Task_ShowPowerAccWindow); - if (taskId == 0xFF) + if (taskId == TASK_NONE) taskId = CreateTask(Task_ShowPowerAccWindow, 8); gTasks[taskId].data[0] = b; gTasks[taskId].data[1] = a; @@ -2545,7 +2545,7 @@ static void HandleAppealJamTilemap(u16 a, s16 b, u16 move) else { u8 taskId = FindTaskIdByFunc(Task_ShowAppealJamWindow); - if (taskId == 0xFF) + if (taskId == TASK_NONE) taskId = CreateTask(Task_ShowAppealJamWindow, 8); gTasks[taskId].data[0] = b; gTasks[taskId].data[1] = a; @@ -2772,7 +2772,7 @@ static void ResetWindows(void) for (i = 0; i < PSS_LABEL_WINDOW_END; i++) FillWindowPixelBuffer(i, PIXEL_FILL(0)); for (i = 0; i < ARRAY_COUNT(sMonSummaryScreen->windowIds); i++) - sMonSummaryScreen->windowIds[i] = 0xFF; + sMonSummaryScreen->windowIds[i] = WINDOW_NONE; } static void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) @@ -3033,7 +3033,7 @@ static void ClearPageWindowTilemaps(u8 page) static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId) { u8 *windowIdPtr = &sMonSummaryScreen->windowIds[templateId]; - if (*windowIdPtr == 0xFF) + if (*windowIdPtr == WINDOW_NONE) { *windowIdPtr = AddWindow(&template[templateId]); FillWindowPixelBuffer(*windowIdPtr, PIXEL_FILL(0)); @@ -3044,11 +3044,11 @@ static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 te static void RemoveWindowByIndex(u8 windowIndex) { u8 *windowIdPtr = &sMonSummaryScreen->windowIds[windowIndex]; - if (*windowIdPtr != 0xFF) + if (*windowIdPtr != WINDOW_NONE) { ClearWindowTilemap(*windowIdPtr); RemoveWindow(*windowIdPtr); - *windowIdPtr = 0xFF; + *windowIdPtr = WINDOW_NONE; } } @@ -3057,7 +3057,7 @@ static void PrintPageSpecificText(u8 pageIndex) u16 i; for (i = 0; i < ARRAY_COUNT(sMonSummaryScreen->windowIds); i++) { - if (sMonSummaryScreen->windowIds[i] != 0xFF) + if (sMonSummaryScreen->windowIds[i] != WINDOW_NONE) FillWindowPixelBuffer(sMonSummaryScreen->windowIds[i], PIXEL_FILL(0)); } sTextPrinterFunctions[pageIndex](); @@ -3789,15 +3789,15 @@ static void ResetSpriteIds(void) u8 i; for (i = 0; i < ARRAY_COUNT(sMonSummaryScreen->spriteIds); i++) - sMonSummaryScreen->spriteIds[i] = 0xFF; + sMonSummaryScreen->spriteIds[i] = SPRITE_NONE; } static void DestroySpriteInArray(u8 spriteArrayId) { - if (sMonSummaryScreen->spriteIds[spriteArrayId] != 0xFF) + if (sMonSummaryScreen->spriteIds[spriteArrayId] != SPRITE_NONE) { DestroySprite(&gSprites[sMonSummaryScreen->spriteIds[spriteArrayId]]); - sMonSummaryScreen->spriteIds[spriteArrayId] = 0xFF; + sMonSummaryScreen->spriteIds[spriteArrayId] = SPRITE_NONE; } } @@ -3813,7 +3813,7 @@ static void HidePageSpecificSprites(void) for (i = SPRITE_ARR_ID_TYPE; i < ARRAY_COUNT(sMonSummaryScreen->spriteIds); i++) { - if (sMonSummaryScreen->spriteIds[i] != 0xFF) + if (sMonSummaryScreen->spriteIds[i] != SPRITE_NONE) SetSpriteInvisibility(i, TRUE); } } @@ -3842,7 +3842,7 @@ static void CreateMoveTypeIcons(void) for (i = SPRITE_ARR_ID_TYPE; i < SPRITE_ARR_ID_TYPE + 5; i++) { - if (sMonSummaryScreen->spriteIds[i] == 0xFF) + if (sMonSummaryScreen->spriteIds[i] == SPRITE_NONE) sMonSummaryScreen->spriteIds[i] = CreateSprite(&sSpriteTemplate_MoveTypes, 0, 0, 2); SetSpriteInvisibility(i, TRUE); @@ -3954,7 +3954,7 @@ static u8 LoadMonGfxAndSprite(struct Pokemon *mon, s16 *state) case 0: if (gMain.inBattle) { - if (sub_80688F8(3, sMonSummaryScreen->curMonIndex)) + if (ShouldIgnoreDeoxysForm(3, sMonSummaryScreen->curMonIndex)) HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites.ptr[1], summary->species2, summary->pid); else HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites.ptr[1], summary->species2, summary->pid); @@ -4037,10 +4037,10 @@ void SummaryScreen_SetUnknownTaskId(u8 taskId) void SummaryScreen_DestroyUnknownTask(void) { - if (sUnknownTaskId != 0xFF) + if (sUnknownTaskId != TASK_NONE) { DestroyTask(sUnknownTaskId); - sUnknownTaskId = 0xFF; + sUnknownTaskId = TASK_NONE; } } @@ -4073,7 +4073,7 @@ static void StopPokemonAnimations(void) // A subtle effect, this function stops static void CreateMonMarkingsSprite(struct Pokemon *mon) { - struct Sprite *sprite = CreateMonMarkingsSpriteWithPal(TAG_MON_MARKINGS, TAG_MON_MARKINGS, sSummaryMarkingsPalette); + struct Sprite *sprite = CreateMonMarkingAllCombosSprite(TAG_MON_MARKINGS, TAG_MON_MARKINGS, sSummaryMarkingsPalette); sMonSummaryScreen->markingsSprite = sprite; if (sprite != NULL) @@ -4107,7 +4107,7 @@ static void CreateSetStatusSprite(void) u8 *spriteId = &sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_STATUS]; u8 statusAnim; - if (*spriteId == 0xFF) + if (*spriteId == SPRITE_NONE) *spriteId = CreateSprite(&sSpriteTemplate_StatusCondition, 64, 152, 0); statusAnim = GetMonAilment(&sMonSummaryScreen->currentMon); diff --git a/src/pokenav_conditions_1.c b/src/pokenav_conditions_1.c index c27cd410c..0545ff1c1 100644 --- a/src/pokenav_conditions_1.c +++ b/src/pokenav_conditions_1.c @@ -123,7 +123,7 @@ u32 ConditionMenu_OpenMarkingsMenu(struct PokenavSub11 *structPtr) u8 markings; u32 ret = PARTY_CONDITION_FUNC_NONE, boxId, monId; - if (!MonMarkingsMenuHandleInput()) + if (!HandleMonMarkingsMenuInput()) { structPtr->monMarks[structPtr->mark] = GetMonMarkingsData(); monListPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST); diff --git a/src/pokenav_conditions_2.c b/src/pokenav_conditions_2.c index c0e8c7d6d..26607926b 100644 --- a/src/pokenav_conditions_2.c +++ b/src/pokenav_conditions_2.c @@ -132,7 +132,7 @@ struct Pokenav7Struct u8 listIndexWindowId; u8 unusedWindowId1; u8 unusedWindowId2; - struct PokemonMarkMenu monMarks; + struct MonMarkingsMenu monMarks; struct Sprite *monMarksSprite; struct Sprite *conditionSparkleSprites[MAX_CONDITION_SPARKLES]; u8 windowModeState; @@ -161,7 +161,7 @@ bool32 OpenPartyConditionMenu(void) if (structPtr == NULL) return FALSE; - structPtr->monPicSpriteId = 0xFF; + structPtr->monPicSpriteId = SPRITE_NONE; structPtr->loopedTaskId = CreateLoopedTask(LoopedTask_OpenPartyConditionGraph, 1); structPtr->callback = GetPartyConditionLoopedTaskActive; structPtr->windowModeState = 0; @@ -514,7 +514,7 @@ u32 LoopedTask_OpenMonMarkingsWindow(s32 state) switch (state) { case 0: - sub_811FAA4(TryGetMonMarkId(), 176, 32); + OpenMonMarkingsMenu(TryGetMonMarkId(), 176, 32); return LT_INC_AND_CONTINUE; case 1: PrintHelpBarText(HELPBAR_CONDITION_MARKINGS); @@ -533,7 +533,7 @@ u32 LoopedTask_CloseMonMarkingsWindow(s32 state) switch (state) { case 0: - sub_811FAF8(); + FreeMonMarkingsMenu(); return LT_INC_AND_CONTINUE; case 1: PrintHelpBarText(HELPBAR_CONDITION_MON_STATUS); @@ -668,9 +668,9 @@ void CreateMonMarkingsOrPokeballIndicators(void) { structPtr->monMarks.baseTileTag = 0x6A; structPtr->monMarks.basePaletteTag = 0x6A; - sub_811F90C(&structPtr->monMarks); - sub_811FA90(); - sprite = CreateMonMarkingsSpriteWithPal(0x69, 0x69, sConditionGraphMonMarkingsPal); + InitMonMarkingsMenu(&structPtr->monMarks); + BufferMonMarkingsMenuTiles(); + sprite = CreateMonMarkingAllCombosSprite(0x69, 0x69, sConditionGraphMonMarkingsPal); sprite->oam.priority = 3; sprite->pos1.x = 192; sprite->pos1.y = 32; @@ -694,7 +694,7 @@ void CreateMonMarkingsOrPokeballIndicators(void) } else { - structPtr->partyPokeballSpriteIds[i] = 0xFF; + structPtr->partyPokeballSpriteIds[i] = SPRITE_NONE; } } @@ -710,7 +710,7 @@ void CreateMonMarkingsOrPokeballIndicators(void) } else { - structPtr->partyPokeballSpriteIds[i] = 0xFF; + structPtr->partyPokeballSpriteIds[i] = SPRITE_NONE; } } @@ -725,7 +725,7 @@ void CreateMonMarkingsOrPokeballIndicators(void) } else { - structPtr->partyPokeballSpriteIds[i] = 0xFF; + structPtr->partyPokeballSpriteIds[i] = SPRITE_NONE; } } @@ -759,7 +759,7 @@ void sub_81CEBF4(struct Pokenav7Struct *structPtr) FreeSpritePaletteByTag(0x66); } - if (structPtr->monPicSpriteId != 0xFF) + if (structPtr->monPicSpriteId != SPRITE_NONE) { DestroySprite(&gSprites[structPtr->monPicSpriteId]); FreeSpriteTilesByTag(0x64); @@ -803,7 +803,7 @@ void CreateConditionMonPic(u8 id) u8 spriteId; struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU); - if (structPtr->monPicSpriteId == 0xFF) + if (structPtr->monPicSpriteId == SPRITE_NONE) { LoadConditionMonPicTemplate(&sprSheet, &sprTemplate, &sprPal); sprSheet.data = GetConditionMonPicGfx(id); @@ -816,7 +816,7 @@ void CreateConditionMonPic(u8 id) { FreeSpriteTilesByTag(0x64); FreeSpritePaletteByTag(0x64); - structPtr->monPicSpriteId = 0xFF; + structPtr->monPicSpriteId = SPRITE_NONE; } else { diff --git a/src/pokenav_main_menu.c b/src/pokenav_main_menu.c index 21bddf1cd..e8262ad9a 100644 --- a/src/pokenav_main_menu.c +++ b/src/pokenav_main_menu.c @@ -314,7 +314,7 @@ void ShutdownPokenav(void) { PlaySE(SE_POKENAV_OFF); ResetBldCnt_(); - BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 16, RGB_BLACK); } bool32 WaitForPokenavShutdownFade(void) @@ -521,10 +521,10 @@ void PokenavFadeScreen(s32 fadeType) BeginNormalPaletteFade(structPtr->palettes, -2, 16, 0, RGB_BLACK); break; case 2: - BeginNormalPaletteFade(0xFFFFFFFF, -2, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -2, 0, 16, RGB_BLACK); break; case 3: - BeginNormalPaletteFade(0xFFFFFFFF, -2, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -2, 16, 0, RGB_BLACK); break; } } @@ -536,7 +536,7 @@ bool32 IsPaletteFadeActive(void) void sub_81C7B40(void) { - BlendPalettes(0xFFFEFFFE, 16, RGB_BLACK); + BlendPalettes(PALETTES_ALL & ~(0x10000 | 0x1), 16, RGB_BLACK); } void InitBgTemplates(const struct BgTemplate *templates, int count) diff --git a/src/pokenav_match_call_2.c b/src/pokenav_match_call_2.c index adcd889d3..593581d0e 100755 --- a/src/pokenav_match_call_2.c +++ b/src/pokenav_match_call_2.c @@ -890,7 +890,7 @@ static void sub_81CBC1C(void) static void sub_81CBC38(int arg0) { u8 taskId = FindTaskIdByFunc(sub_81CBC64); - if (taskId != 0xFF) + if (taskId != TASK_NONE) gTasks[taskId].data[15] = arg0; } diff --git a/src/pokenav_match_call_ui.c b/src/pokenav_match_call_ui.c index 2d89f9c39..11bb30162 100644 --- a/src/pokenav_match_call_ui.c +++ b/src/pokenav_match_call_ui.c @@ -987,7 +987,7 @@ bool32 CopyPokenavListMenuTemplate(struct PokenavSub17Substruct *dest, const str window.baseBlock = a3 + 2; dest->listWindow.windowId = AddWindow(&window); - if (dest->listWindow.windowId == 0xFF) + if (dest->listWindow.windowId == WINDOW_NONE) return FALSE; dest->listWindow.unkA = 0; diff --git a/src/pokenav_ribbons_1.c b/src/pokenav_ribbons_1.c index 397e1e749..f80f95998 100644 --- a/src/pokenav_ribbons_1.c +++ b/src/pokenav_ribbons_1.c @@ -44,7 +44,7 @@ struct PokenavSub10 static u32 HandleRibbonsMonListInput_WaitListInit(struct PokenavSub9 *structPtr); static u32 HandleRibbonsMonListInput(struct PokenavSub9 *structPtr); static u32 RibbonsMonMenu_ReturnToMainMenu(struct PokenavSub9 *structPtr); -static u32 sub_81CFB10(struct PokenavSub9 *structPtr); +static u32 RibbonsMonMenu_ToSummaryScreen(struct PokenavSub9 *structPtr); static u32 BuildPartyMonRibbonList(s32 state); static u32 InitBoxMonRibbonList(s32 state); static u32 BuildBoxMonRibbonList(s32 state); @@ -71,10 +71,10 @@ static const LoopedTask sMonRibbonListLoopTaskFuncs[] = BuildBoxMonRibbonList }; -static const u16 sMonRibbonListFramePal[] = INCBIN_U16("graphics/pokenav/ui_ribbons.gbapal"); -static const u32 sMonRibbonListFrameTiles[] = INCBIN_U32("graphics/pokenav/ui_ribbons.4bpp.lz"); -static const u32 sMonRibbonListFrameTilemap[] = INCBIN_U32("graphics/pokenav/ui_ribbons.bin.lz"); -static const u16 gUnknown_08623790[] = INCBIN_U16("graphics/pokenav/8623790.gbapal"); +static const u16 sMonRibbonListFramePal[] = INCBIN_U16("graphics/pokenav/ribbons/list_bg.gbapal"); +static const u32 sMonRibbonListFrameTiles[] = INCBIN_U32("graphics/pokenav/ribbons/list_bg.4bpp.lz"); +static const u32 sMonRibbonListFrameTilemap[] = INCBIN_U32("graphics/pokenav/ribbons/list_bg.bin.lz"); +static const u16 sMonRibbonListUi_Pal[] = INCBIN_U16("graphics/pokenav/ribbons/list_ui.gbapal"); static const struct BgTemplate sMonRibbonListBgTemplates[] = { @@ -192,7 +192,7 @@ static u32 HandleRibbonsMonListInput(struct PokenavSub9 *structPtr) { structPtr->monList->currIndex = GetSelectedPokenavListIndex(); structPtr->saveMonList = 1; - structPtr->callback = sub_81CFB10; + structPtr->callback = RibbonsMonMenu_ToSummaryScreen; return RIBBONS_MON_LIST_FUNC_OPEN_RIBBONS_SUMMARY; } return RIBBONS_MON_LIST_FUNC_NONE; @@ -203,7 +203,7 @@ static u32 RibbonsMonMenu_ReturnToMainMenu(struct PokenavSub9 *structPtr) return POKENAV_MAIN_MENU_CURSOR_ON_RIBBONS; } -static u32 sub_81CFB10(struct PokenavSub9 *structPtr) +static u32 RibbonsMonMenu_ToSummaryScreen(struct PokenavSub9 *structPtr) { return POKENAV_RIBBONS_SUMMARY_SCREEN; } @@ -342,8 +342,8 @@ static void sub_81CFCEC(struct PokenavSub9 *structPtr, struct PokenavMonList *it structPtr->monList->listCount++; } -//unused -static bool32 Unused_PlayerHasRibbonsMon(void) +// Unused +static bool32 PlayerHasRibbonsMon(void) { s32 i, j; @@ -446,7 +446,7 @@ static u32 LoopedTask_OpenRibbonsMonList(s32 state) case 2: if (FreeTempTileDataBuffersIfPossible()) return LT_PAUSE; - CopyPaletteIntoBufferUnfaded(gUnknown_08623790, 0x20, 0x20); + CopyPaletteIntoBufferUnfaded(sMonRibbonListUi_Pal, 0x20, 0x20); InitMonRibbonPokenavListMenuTemplate(); return LT_INC_AND_PAUSE; case 3: diff --git a/src/pokenav_ribbons_2.c b/src/pokenav_ribbons_2.c index 203aa19e5..cbcd29776 100644 --- a/src/pokenav_ribbons_2.c +++ b/src/pokenav_ribbons_2.c @@ -16,24 +16,41 @@ enum { RIBBONS_SUMMARY_FUNC_NONE, - RIBBONS_SUMMARY_FUNC_MOVED_CURSOR, + RIBBONS_SUMMARY_FUNC_SWITCH_MONS, RIBBONS_SUMMARY_FUNC_SELECT_RIBBON, RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE, RIBBONS_SUMMARY_FUNC_EXPANDED_CANCEL, RIBBONS_SUMMARY_FUNC_EXIT, }; +#define GFXTAG_RIBBON_ICONS_BIG 9 + +#define PALTAG_RIBBON_ICONS_1 15 +#define PALTAG_RIBBON_ICONS_2 16 +#define PALTAG_RIBBON_ICONS_3 17 +#define PALTAG_RIBBON_ICONS_4 18 +#define PALTAG_RIBBON_ICONS_5 19 + +#define RIBBONS_PER_ROW 9 +#define GIFT_RIBBON_ROW (1 + (FIRST_GIFT_RIBBON / RIBBONS_PER_ROW)) // Gift ribbons start on a new row after the normal ribbons. +#define GIFT_RIBBON_START_POS (RIBBONS_PER_ROW * GIFT_RIBBON_ROW) + +#define MON_SPRITE_X_ON 40 +#define MON_SPRITE_X_OFF -32 +#define MON_SPRITE_Y 104 + struct PokenavSub13 { - u8 filler0[0x8]; + u8 unused1[8]; struct PokenavSub18 *monList; - u16 field_C; - u16 field_E; - u16 field_10; - u16 field_12; - u32 field_14[25]; - u32 field_78[8]; - u32 (*callback)(struct PokenavSub13 *structPtr); + u16 selectedPos; + u16 normalRibbonLastRowStart; + u16 numNormalRibbons; + u16 numGiftRibbons; + u32 ribbonIds[FIRST_GIFT_RIBBON]; + u32 giftRibbonIds[NUM_GIFT_RIBBONS]; + u32 unused2; + u32 (*callback)(struct PokenavSub13 *); }; struct PokenavSub14 @@ -43,99 +60,99 @@ struct PokenavSub14 u16 nameWindowId; u16 ribbonCountWindowId; u16 listIdxWindowId; - u16 field_E; + u16 unusedWindowId; u16 monSpriteId; - struct Sprite *field_14; - u32 filler; + struct Sprite *bigRibbonSprite; + u32 unused; u8 tilemapBuffers[2][BG_SCREEN_SIZE]; }; -static u32 gUnknown_030012C0; -static u32 gUnknown_030012C4; +// Used for the initial drawing of the ribbons +static u32 sRibbonDraw_Total; +static u32 sRibbonDraw_Current; -void PrintCurrentMonRibbonCount(struct PokenavSub14 *structPtr); -void PrintRibbbonsSummaryMonInfo(struct PokenavSub14 *structPtr); -void PrintRibbonsMonListIndex(struct PokenavSub14 *structPtr); -void sub_81D1500(struct PokenavSub14 *structPtr); -void sub_81D0EFC(struct PokenavSub14 *structPtr); -void ResetSpritesAndDrawRibbonsMonFrontPic(struct PokenavSub14 *structPtr); -void AddRibbonListIndexWindow(struct PokenavSub14 *structPtr); -void DestroyRibbonsMonFrontPic(struct PokenavSub14 *structPtr); -void sub_81D11D8(struct PokenavSub14 *structPtr); -void sub_81D11FC(struct PokenavSub14 *structPtr); -void AddRibbonCountWindow(struct PokenavSub14 *structPtr); -void sub_81D1448(struct PokenavSub14 *structPtr); -void sub_81D13FC(struct PokenavSub14 *structPtr); -void AddRibbonSummaryMonNameWindow(struct PokenavSub14 *structPtr); -void sub_81D12D8(struct PokenavSub14 *structPtr); -bool32 sub_81D1524(struct PokenavSub14 *structPtr); -bool32 sub_81D1234(struct PokenavSub14 *structPtr); -void sub_81D0814(struct PokenavSub13 *structPtr); -u32 HandleExpandedRibbonInput(struct PokenavSub13 *structPtr); -u32 RibbonsSummaryHandleInput(struct PokenavSub13 *structPtr); -u32 ReturnToRibbonsListFromSummary(struct PokenavSub13 *structPtr); -bool32 sub_81D05DC(struct PokenavSub13 *structPtr); -bool32 sub_81D0688(struct PokenavSub13 *structPtr); -bool32 sub_81D0664(struct PokenavSub13 *structPtr); -bool32 sub_81D061C(struct PokenavSub13 *structPtr); -bool32 sub_81D0688(struct PokenavSub13 *structPtr); -bool32 GetCurrentLoopedTaskActive(void); -u32 GetRibbonsSummaryCurrentIndex(void); -u32 GetRibbonsSummaryMonListCount(void); -u16 DrawRibbonsMonFrontPic(s32 unused0, s32 unused1); -void sub_81D1258(struct Sprite *sprite, s32 arg1, s32 arg2, s32 arg3); -void sub_81D1284(struct Sprite *sprite); -void sub_81D1350(void); -void sub_81D13BC(u16 *dst, u32 id); -void sub_81D1370(u32 arg0, u32 id); -void sub_81D1538(struct Sprite *sprite); -u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state); -u32 LoopedTask_UpdateRibbonsSummaryInfo(s32 state); -u32 LoopedTask_ExpandSelectedRibbon(s32 state); -u32 LoopedTask_MoveRibbonsCursorExpanded(s32 state); -u32 LoopedTask_ShrinkExpandedRibbon(s32 state); -u32 LoopedTask_ExitRibbonsSummaryMenu(s32 state); +static void PrintCurrentMonRibbonCount(struct PokenavSub14 *); +static void PrintRibbbonsSummaryMonInfo(struct PokenavSub14 *); +static void PrintRibbonsMonListIndex(struct PokenavSub14 *); +static void ZoomOutSelectedRibbon(struct PokenavSub14 *); +static void UpdateAndZoomInSelectedRibbon(struct PokenavSub14 *); +static void PrintRibbonNameAndDescription(struct PokenavSub14 *); +static void ResetSpritesAndDrawMonFrontPic(struct PokenavSub14 *); +static void AddRibbonListIndexWindow(struct PokenavSub14 *); +static void DestroyRibbonsMonFrontPic(struct PokenavSub14 *); +static void SlideMonSpriteOff(struct PokenavSub14 *); +static void SlideMonSpriteOn(struct PokenavSub14 *); +static void AddRibbonCountWindow(struct PokenavSub14 *); +static void CreateBigRibbonSprite(struct PokenavSub14 *); +static void AddRibbonSummaryMonNameWindow(struct PokenavSub14 *); +static void DrawAllRibbonsSmall(struct PokenavSub14 *); +static bool32 IsRibbonAnimating(struct PokenavSub14 *); +static bool32 IsMonSpriteAnimating(struct PokenavSub14 *); +static void GetMonRibbons(struct PokenavSub13 *); +static u32 HandleExpandedRibbonInput(struct PokenavSub13 *); +static u32 RibbonsSummaryHandleInput(struct PokenavSub13 *); +static u32 ReturnToRibbonsListFromSummary(struct PokenavSub13 *); +static bool32 TrySelectRibbonUp(struct PokenavSub13 *); +static bool32 TrySelectRibbonRight(struct PokenavSub13 *); +static bool32 TrySelectRibbonLeft(struct PokenavSub13 *); +static bool32 TrySelectRibbonDown(struct PokenavSub13 *); +static bool32 GetCurrentLoopedTaskActive(void); +static u32 GetRibbonsSummaryCurrentIndex(void); +static u32 GetRibbonsSummaryMonListCount(void); +static u16 DrawRibbonsMonFrontPic(s32, s32); +static void StartMonSpriteSlide(struct Sprite *, s32, s32, s32); +static void SpriteCB_MonSpriteSlide(struct Sprite *); +static void ClearRibbonsSummaryBg(void); +static void BufferSmallRibbonGfxData(u16 *, u32); +static void DrawRibbonSmall(u32, u32); +static void SpriteCB_WaitForRibbonAnimation(struct Sprite *); +static u32 LoopedTask_OpenRibbonsSummaryMenu(s32); +static u32 LoopedTask_SwitchRibbonsSummaryMon(s32); +static u32 LoopedTask_ExpandSelectedRibbon(s32); +static u32 LoopedTask_MoveRibbonsCursorExpanded(s32); +static u32 LoopedTask_ShrinkExpandedRibbon(s32); +static u32 LoopedTask_ExitRibbonsSummaryMenu(s32); struct { - u8 unk0; - u8 unk1; - u8 unk2; - u8 unk3; -} static const gUnknown_086237F8[] = + u8 numBits; // The number of bits needed to represent numRibbons + u8 numRibbons; // Never read. The contest ribbons have 4 (1 for each rank), the rest are just 1 ribbon + u8 ribbonId; + bool8 isGiftRibbon; +} static const sRibbonData[] = { - {1, 1, 0, 0}, - {3, 4, 1, 0}, - {3, 4, 5, 0}, - {3, 4, 9, 0}, - {3, 4, 13, 0}, - {3, 4, 17, 0}, - {1, 1, 21, 0}, - {1, 1, 22, 0}, - {1, 1, 23, 0}, - {1, 1, 24, 0}, - {1, 1, 25, 1}, - {1, 1, 26, 1}, - {1, 1, 27, 1}, - {1, 1, 28, 1}, - {1, 1, 29, 1}, - {1, 1, 30, 1}, - {1, 1, 31, 1} + {1, 1, CHAMPION_RIBBON, FALSE}, + {3, 4, COOL_RIBBON_NORMAL, FALSE}, + {3, 4, BEAUTY_RIBBON_NORMAL, FALSE}, + {3, 4, CUTE_RIBBON_NORMAL, FALSE}, + {3, 4, SMART_RIBBON_NORMAL, FALSE}, + {3, 4, TOUGH_RIBBON_NORMAL, FALSE}, + {1, 1, WINNING_RIBBON, FALSE}, + {1, 1, VICTORY_RIBBON, FALSE}, + {1, 1, ARTIST_RIBBON, FALSE}, + {1, 1, EFFORT_RIBBON, FALSE}, + {1, 1, MARINE_RIBBON, TRUE}, + {1, 1, LAND_RIBBON, TRUE}, + {1, 1, SKY_RIBBON, TRUE}, + {1, 1, COUNTRY_RIBBON, TRUE}, + {1, 1, NATIONAL_RIBBON, TRUE}, + {1, 1, EARTH_RIBBON, TRUE}, + {1, 1, WORLD_RIBBON, TRUE} }; #include "data/text/ribbon_descriptions.h" #include "data/text/gift_ribbon_descriptions.h" -static const u16 gUnknown_08623FF8[] = INCBIN_U16("graphics/pokenav/ribbons_icon1.gbapal"); -static const u16 gUnknown_08624018[] = INCBIN_U16("graphics/pokenav/ribbons_icon2.gbapal"); -static const u16 gUnknown_08624038[] = INCBIN_U16("graphics/pokenav/ribbons_icon3.gbapal"); -static const u16 gUnknown_08624058[] = INCBIN_U16("graphics/pokenav/ribbons_icon4.gbapal"); -static const u16 gUnknown_08624078[] = INCBIN_U16("graphics/pokenav/ribbons_icon5.gbapal"); -static const u16 gUnknown_08624098[] = INCBIN_U16("graphics/pokenav/8624098.gbapal"); -static const u32 sRibbonIconsSmall_Gfx[] = INCBIN_U32("graphics/pokenav/ribbons_icon.4bpp.lz"); -static const u32 sRibbonIconsBig_Gfx[] = INCBIN_U32("graphics/pokenav/ribbons_icon_big.4bpp.lz"); +static const u16 sRibbonIcons1_Pal[] = INCBIN_U16("graphics/pokenav/ribbons/icons1.gbapal"); +static const u16 sRibbonIcons2_Pal[] = INCBIN_U16("graphics/pokenav/ribbons/icons2.gbapal"); +static const u16 sRibbonIcons3_Pal[] = INCBIN_U16("graphics/pokenav/ribbons/icons3.gbapal"); +static const u16 sRibbonIcons4_Pal[] = INCBIN_U16("graphics/pokenav/ribbons/icons4.gbapal"); +static const u16 sRibbonIcons5_Pal[] = INCBIN_U16("graphics/pokenav/ribbons/icons5.gbapal"); +static const u16 sMonInfo_Pal[] = INCBIN_U16("graphics/pokenav/ribbons/mon_info.gbapal"); // palette for Pokémon's name/gender/level text +static const u32 sRibbonIconsSmall_Gfx[] = INCBIN_U32("graphics/pokenav/ribbons/icons.4bpp.lz"); +static const u32 sRibbonIconsBig_Gfx[] = INCBIN_U32("graphics/pokenav/ribbons/icons_big.4bpp.lz"); -static const struct BgTemplate gUnknown_08624B98[] = +static const struct BgTemplate sBgTemplates[] = { { .bg = 1, @@ -160,14 +177,13 @@ static const struct BgTemplate gUnknown_08624B98[] = static const LoopedTask sRibbonsSummaryMenuLoopTaskFuncs[] = { [RIBBONS_SUMMARY_FUNC_NONE] = NULL, - [RIBBONS_SUMMARY_FUNC_MOVED_CURSOR] = LoopedTask_UpdateRibbonsSummaryInfo, + [RIBBONS_SUMMARY_FUNC_SWITCH_MONS] = LoopedTask_SwitchRibbonsSummaryMon, [RIBBONS_SUMMARY_FUNC_SELECT_RIBBON] = LoopedTask_ExpandSelectedRibbon, [RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE] = LoopedTask_MoveRibbonsCursorExpanded, [RIBBONS_SUMMARY_FUNC_EXPANDED_CANCEL] = LoopedTask_ShrinkExpandedRibbon, [RIBBONS_SUMMARY_FUNC_EXIT] = LoopedTask_ExitRibbonsSummaryMenu }; -// code bool32 PokenavCallback_Init_RibbonsSummaryMenu(void) { struct PokenavSub13 *structPtr = AllocSubstruct(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST, sizeof(struct PokenavSub13)); @@ -178,7 +194,7 @@ bool32 PokenavCallback_Init_RibbonsSummaryMenu(void) if (structPtr->monList == NULL) return FALSE; - sub_81D0814(structPtr); + GetMonRibbons(structPtr); structPtr->callback = RibbonsSummaryHandleInput; gKeyRepeatContinueDelay = 3; gKeyRepeatStartDelay = 10; @@ -196,153 +212,170 @@ void FreeRibbonsSummaryScreen1(void) FreePokenavSubstruct(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST); } -u32 RibbonsSummaryHandleInput(struct PokenavSub13 *structPtr) +// Handles input when a specific ribbon is not currently selected +static u32 RibbonsSummaryHandleInput(struct PokenavSub13 *structPtr) { + // Handle Up/Down movement to select a new Pokémon to show ribbons for if (JOY_REPEAT(DPAD_UP) && structPtr->monList->currIndex != 0) { structPtr->monList->currIndex--; - structPtr->field_C = 0; - sub_81D0814(structPtr); - return RIBBONS_SUMMARY_FUNC_MOVED_CURSOR; + structPtr->selectedPos = 0; + GetMonRibbons(structPtr); + return RIBBONS_SUMMARY_FUNC_SWITCH_MONS; } if (JOY_REPEAT(DPAD_DOWN) && structPtr->monList->currIndex < structPtr->monList->listCount - 1) { structPtr->monList->currIndex++; - structPtr->field_C = 0; - sub_81D0814(structPtr); - return RIBBONS_SUMMARY_FUNC_MOVED_CURSOR; + structPtr->selectedPos = 0; + GetMonRibbons(structPtr); + return RIBBONS_SUMMARY_FUNC_SWITCH_MONS; } + if (JOY_NEW(A_BUTTON)) { + // Enter ribbon selection structPtr->callback = HandleExpandedRibbonInput; return RIBBONS_SUMMARY_FUNC_SELECT_RIBBON; } if (JOY_NEW(B_BUTTON)) { + // Exit ribbon summary menu structPtr->callback = ReturnToRibbonsListFromSummary; return RIBBONS_SUMMARY_FUNC_EXIT; } return RIBBONS_SUMMARY_FUNC_NONE; } -u32 HandleExpandedRibbonInput(struct PokenavSub13 *structPtr) +// Handles input when a ribbon is selected +static u32 HandleExpandedRibbonInput(struct PokenavSub13 *structPtr) { - if (JOY_REPEAT(DPAD_UP) && sub_81D05DC(structPtr)) + // Handle movement while a ribbon is selected + if (JOY_REPEAT(DPAD_UP) && TrySelectRibbonUp(structPtr)) return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE; - if (JOY_REPEAT(DPAD_DOWN) && sub_81D061C(structPtr)) + if (JOY_REPEAT(DPAD_DOWN) && TrySelectRibbonDown(structPtr)) return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE; - if (JOY_REPEAT(DPAD_LEFT) && sub_81D0664(structPtr)) + if (JOY_REPEAT(DPAD_LEFT) && TrySelectRibbonLeft(structPtr)) return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE; - if (JOY_REPEAT(DPAD_RIGHT) && sub_81D0688(structPtr)) + if (JOY_REPEAT(DPAD_RIGHT) && TrySelectRibbonRight(structPtr)) return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE; + if (JOY_NEW(B_BUTTON)) { + // Exit ribbon selection structPtr->callback = RibbonsSummaryHandleInput; return RIBBONS_SUMMARY_FUNC_EXPANDED_CANCEL; } return RIBBONS_SUMMARY_FUNC_NONE; } -u32 ReturnToRibbonsListFromSummary(struct PokenavSub13 *structPtr) +static u32 ReturnToRibbonsListFromSummary(struct PokenavSub13 *structPtr) { return POKENAV_RIBBONS_RETURN_TO_MON_LIST; } -bool32 sub_81D05DC(struct PokenavSub13 *structPtr) +static bool32 TrySelectRibbonUp(struct PokenavSub13 *structPtr) { - if (structPtr->field_C < 25) + if (structPtr->selectedPos < FIRST_GIFT_RIBBON) { - if (structPtr->field_C <= 8) + // In normal ribbons, try to move up a row + if (structPtr->selectedPos < RIBBONS_PER_ROW) return FALSE; - structPtr->field_C -= 9; + structPtr->selectedPos -= RIBBONS_PER_ROW; return TRUE; } - if (structPtr->field_10 != 0) + if (structPtr->numNormalRibbons != 0) { - u32 var = structPtr->field_C - 27; - structPtr->field_C = var + structPtr->field_E; - if (structPtr->field_C >= structPtr->field_10) - structPtr->field_C = structPtr->field_10 - 1; + // In gift ribbons, try to move up into normal ribbons + // If there's > 1 row of gift ribbons (not normally possible) + // it's impossible to move up between them + u32 ribbonPos = structPtr->selectedPos - GIFT_RIBBON_START_POS; + structPtr->selectedPos = ribbonPos + structPtr->normalRibbonLastRowStart; + if (structPtr->selectedPos >= structPtr->numNormalRibbons) + structPtr->selectedPos = structPtr->numNormalRibbons - 1; return TRUE; } return FALSE; } -bool32 sub_81D061C(struct PokenavSub13 *structPtr) +static bool32 TrySelectRibbonDown(struct PokenavSub13 *structPtr) { - if (structPtr->field_C >= 25) + if (structPtr->selectedPos >= FIRST_GIFT_RIBBON) return FALSE; - if (structPtr->field_C < structPtr->field_E) + if (structPtr->selectedPos < structPtr->normalRibbonLastRowStart) { - structPtr->field_C += 9; - if (structPtr->field_C >= structPtr->field_10) - structPtr->field_C = structPtr->field_10 - 1; + // Not in last row of normal ribbons, advance to next row + structPtr->selectedPos += RIBBONS_PER_ROW; + if (structPtr->selectedPos >= structPtr->numNormalRibbons) + structPtr->selectedPos = structPtr->numNormalRibbons - 1; return TRUE; } - if (structPtr->field_12 != 0) + if (structPtr->numGiftRibbons != 0) { - int var = structPtr->field_C - structPtr->field_E; - if (var >= structPtr->field_12) - var = structPtr->field_12 - 1; + // In/beyond last of row of normal ribbons and gift ribbons present, move down to gift ribbon row + int ribbonPos = structPtr->selectedPos - structPtr->normalRibbonLastRowStart; + if (ribbonPos >= structPtr->numGiftRibbons) + ribbonPos = structPtr->numGiftRibbons - 1; - structPtr->field_C = var + 27; + structPtr->selectedPos = ribbonPos + GIFT_RIBBON_START_POS; return TRUE; } return FALSE; } -bool32 sub_81D0664(struct PokenavSub13 *structPtr) +static bool32 TrySelectRibbonLeft(struct PokenavSub13 *structPtr) { - u16 var = structPtr->field_C % 9; - if (var != 0) + u16 column = structPtr->selectedPos % RIBBONS_PER_ROW; + if (column != 0) { - structPtr->field_C--; + structPtr->selectedPos--; return TRUE; } return FALSE; } -bool32 sub_81D0688(struct PokenavSub13 *structPtr) +static bool32 TrySelectRibbonRight(struct PokenavSub13 *structPtr) { - int r1 = structPtr->field_C % 9; + int column = structPtr->selectedPos % RIBBONS_PER_ROW; - if (r1 >= 8) + if (column >= RIBBONS_PER_ROW - 1) return FALSE; - if (structPtr->field_C <= 26) + if (structPtr->selectedPos < GIFT_RIBBON_START_POS) { - if (structPtr->field_C < structPtr->field_10 - 1) + // Move right in normal ribbon row + if (structPtr->selectedPos < structPtr->numNormalRibbons - 1) { - structPtr->field_C++; + structPtr->selectedPos++; return TRUE; } } else { - if (r1 < structPtr->field_12 - 1) + // Move right in gift ribbon row + if (column < structPtr->numGiftRibbons - 1) { - structPtr->field_C++; + structPtr->selectedPos++; return TRUE; } } return FALSE; } -u32 GetRibbonsSummaryCurrentIndex(void) +static u32 GetRibbonsSummaryCurrentIndex(void) { struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST); return structPtr->monList->currIndex; } -u32 GetRibbonsSummaryMonListCount(void) +static u32 GetRibbonsSummaryMonListCount(void) { struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST); return structPtr->monList->listCount; } -static void GetCurrMonInfo1(u8 *nick, u8 *level, u8 *gender) +static void GetMonNicknameLevelGender(u8 *nick, u8 *level, u8 *gender) { struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST); struct PokenavSub18 *mons = structPtr->monList; @@ -350,6 +383,7 @@ static void GetCurrMonInfo1(u8 *nick, u8 *level, u8 *gender) if (monInfo->boxId == TOTAL_BOXES_COUNT) { + // Get info for party mon struct Pokemon *mon = &gPlayerParty[monInfo->monId]; GetMonData(mon, MON_DATA_NICKNAME, nick); *level = GetLevelFromMonExp(mon); @@ -357,6 +391,7 @@ static void GetCurrMonInfo1(u8 *nick, u8 *level, u8 *gender) } else { + // Get info for PC box mon struct BoxPokemon *boxMon = GetBoxedMonPtr(monInfo->boxId, monInfo->monId); *gender = GetBoxMonGender(boxMon); *level = GetLevelFromBoxMonExp(boxMon); @@ -365,7 +400,7 @@ static void GetCurrMonInfo1(u8 *nick, u8 *level, u8 *gender) StringGetEnd10(nick); } -static void GetCurrMonInfo2(u16 *species, u32 *personality, u32 *otId) +static void GetMonSpeciesPersonalityOtId(u16 *species, u32 *personality, u32 *otId) { struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST); struct PokenavSub18 *mons = structPtr->monList; @@ -373,6 +408,7 @@ static void GetCurrMonInfo2(u16 *species, u32 *personality, u32 *otId) if (monInfo->boxId == TOTAL_BOXES_COUNT) { + // Get info for party mon struct Pokemon *mon = &gPlayerParty[monInfo->monId]; *species = GetMonData(mon, MON_DATA_SPECIES); *personality = GetMonData(mon, MON_DATA_PERSONALITY); @@ -380,6 +416,7 @@ static void GetCurrMonInfo2(u16 *species, u32 *personality, u32 *otId) } else { + // Get info for PC box mon struct BoxPokemon *boxMon = GetBoxedMonPtr(monInfo->boxId, monInfo->monId); *species = GetBoxMonData(boxMon, MON_DATA_SPECIES); *personality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY); @@ -399,76 +436,79 @@ static u32 GetCurrMonRibbonCount(void) return GetBoxMonDataAt(monInfo->boxId, monInfo->monId, MON_DATA_RIBBON_COUNT); } -void sub_81D0814(struct PokenavSub13 *structPtr) +static void GetMonRibbons(struct PokenavSub13 *structPtr) { - u32 ribbons; + u32 ribbonFlags; s32 i, j; struct PokenavSub18 *mons = structPtr->monList; struct PokenavMonList *monInfo = &mons->monData[mons->currIndex]; if (monInfo->boxId == TOTAL_BOXES_COUNT) - ribbons = GetMonData(&gPlayerParty[monInfo->monId], MON_DATA_RIBBONS); + ribbonFlags = GetMonData(&gPlayerParty[monInfo->monId], MON_DATA_RIBBONS); else - ribbons = GetBoxMonDataAt(monInfo->boxId, monInfo->monId, MON_DATA_RIBBONS); + ribbonFlags = GetBoxMonDataAt(monInfo->boxId, monInfo->monId, MON_DATA_RIBBONS); - structPtr->field_10 = 0; - structPtr->field_12 = 0; - for (i = 0; i < ARRAY_COUNT(gUnknown_086237F8); i++) + structPtr->numNormalRibbons = 0; + structPtr->numGiftRibbons = 0; + for (i = 0; i < ARRAY_COUNT(sRibbonData); i++) { - s32 r4 = ((1 << gUnknown_086237F8[i].unk0) - 1) & ribbons; - if (gUnknown_086237F8[i].unk3 == 0) + // For all non-contest ribbons, numRibbons will be 1 if they have it, 0 if they don't + // For contest ribbons, numRibbons will be 0-4 + s32 numRibbons = ((1 << sRibbonData[i].numBits) - 1) & ribbonFlags; + if (!sRibbonData[i].isGiftRibbon) { - for (j = 0; j < r4; j++) - structPtr->field_14[structPtr->field_10++] = gUnknown_086237F8[i].unk2 + j; + for (j = 0; j < numRibbons; j++) + structPtr->ribbonIds[structPtr->numNormalRibbons++] = sRibbonData[i].ribbonId + j; } else { - for (j = 0; j < r4; j++) - structPtr->field_78[structPtr->field_12++] = gUnknown_086237F8[i].unk2 + j; + for (j = 0; j < numRibbons; j++) + structPtr->giftRibbonIds[structPtr->numGiftRibbons++] = sRibbonData[i].ribbonId + j; } - ribbons >>= gUnknown_086237F8[i].unk0; + ribbonFlags >>= sRibbonData[i].numBits; } - if (structPtr->field_10 != 0) + if (structPtr->numNormalRibbons != 0) { - structPtr->field_E = ((structPtr->field_10 - 1) / 9) * 9; - structPtr->field_C = 0; + structPtr->normalRibbonLastRowStart = ((structPtr->numNormalRibbons - 1) / RIBBONS_PER_ROW) * RIBBONS_PER_ROW; + structPtr->selectedPos = 0; } else { - structPtr->field_E = 0; - structPtr->field_C = 27; + // There are no normal ribbons, move cursor to first gift ribbon + structPtr->normalRibbonLastRowStart = 0; + structPtr->selectedPos = GIFT_RIBBON_START_POS; } } -u32 *sub_81D0914(u32 *arg0) +static u32 *GetNormalRibbonIds(u32 *size) { struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST); - *arg0 = structPtr->field_10; - return structPtr->field_14; + *size = structPtr->numNormalRibbons; + return structPtr->ribbonIds; } -u32 *sub_81D092C(u32 *arg0) +static u32 *GetGiftRibbonIds(u32 *size) { struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST); - *arg0 = structPtr->field_12; - return structPtr->field_78; + *size = structPtr->numGiftRibbons; + return structPtr->giftRibbonIds; } -u16 sub_81D0944(void) +static u16 GetSelectedPosition(void) { struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST); - return structPtr->field_C; + return structPtr->selectedPos; } -u32 sub_81D0954(void) +static u32 GetRibbonId(void) { struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST); - int var = structPtr->field_C; - if (var <= 24) - return structPtr->field_14[var]; + int ribbonPos = structPtr->selectedPos; + if (ribbonPos < FIRST_GIFT_RIBBON) + return structPtr->ribbonIds[ribbonPos]; else - return structPtr->field_78[var - 27]; + return structPtr->giftRibbonIds[ribbonPos - GIFT_RIBBON_START_POS]; } bool32 OpenRibbonsSummaryMenu(void) @@ -501,36 +541,38 @@ void FreeRibbonsSummaryScreen2(void) RemoveWindow(structPtr->ribbonCountWindowId); RemoveWindow(structPtr->nameWindowId); RemoveWindow(structPtr->listIdxWindowId); - RemoveWindow(structPtr->field_E); +#ifndef BUGFIX + RemoveWindow(structPtr->unusedWindowId); // Removing window, but window id is never set +#endif DestroyRibbonsMonFrontPic(structPtr); - FreeSpriteTilesByTag(9); - FreeSpritePaletteByTag(0xF); - FreeSpritePaletteByTag(0x10); - FreeSpritePaletteByTag(0x11); - FreeSpritePaletteByTag(0x12); - FreeSpritePaletteByTag(0x13); - FreeSpriteOamMatrix(structPtr->field_14); - DestroySprite(structPtr->field_14); + FreeSpriteTilesByTag(GFXTAG_RIBBON_ICONS_BIG); + FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_1); + FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_2); + FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_3); + FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_4); + FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_5); + FreeSpriteOamMatrix(structPtr->bigRibbonSprite); + DestroySprite(structPtr->bigRibbonSprite); FreePokenavSubstruct(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU); } -bool32 GetCurrentLoopedTaskActive(void) +static bool32 GetCurrentLoopedTaskActive(void) { struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU); return IsLoopedTaskActive(structPtr->loopedTaskId); } -u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state) +static u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state) { struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU); switch (state) { case 0: - InitBgTemplates(gUnknown_08624B98, ARRAY_COUNT(gUnknown_08624B98)); - DecompressAndCopyTileDataToVram(2, gUnknown_08DDE030, 0, 0, 0); + InitBgTemplates(sBgTemplates, ARRAY_COUNT(sBgTemplates)); + DecompressAndCopyTileDataToVram(2, gPokenavRibbonsSummaryBg_Gfx, 0, 0, 0); SetBgTilemapBuffer(2, structPtr->tilemapBuffers[0]); - CopyToBgTilemapBuffer(2, gUnknown_08DDE12C, 0, 0); - CopyPaletteIntoBufferUnfaded(gUnknown_08DDE010, 0x10, 0x20); + CopyToBgTilemapBuffer(2, gPokenavRibbonsSummaryBg_Tilemap, 0, 0); + CopyPaletteIntoBufferUnfaded(gPokenavRibbonsSummaryBg_Pal, 0x10, 0x20); CopyBgTilemapBufferToVram(2); return LT_INC_AND_PAUSE; case 1: @@ -540,8 +582,8 @@ u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state) DecompressAndCopyTileDataToVram(1, sRibbonIconsSmall_Gfx, 0, 1, 0); SetBgTilemapBuffer(1, structPtr->tilemapBuffers[1]); FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 32, 20); - CopyPaletteIntoBufferUnfaded(gUnknown_08623FF8, 0x20, 0xA0); - CopyPaletteIntoBufferUnfaded(gUnknown_08624098, 0xA0, 0x20); + CopyPaletteIntoBufferUnfaded(sRibbonIcons1_Pal, 0x20, 0xA0); + CopyPaletteIntoBufferUnfaded(sMonInfo_Pal, 0xA0, 0x20); CopyBgTilemapBufferToVram(1); return LT_INC_AND_PAUSE; } @@ -577,18 +619,18 @@ u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state) case 6: if (!IsDma3ManagerBusyWithBgCopy()) { - ResetSpritesAndDrawRibbonsMonFrontPic(structPtr); + ResetSpritesAndDrawMonFrontPic(structPtr); return LT_INC_AND_CONTINUE; } return LT_PAUSE; case 7: - sub_81D12D8(structPtr); + DrawAllRibbonsSmall(structPtr); PrintHelpBarText(HELPBAR_RIBBONS_LIST); return LT_INC_AND_PAUSE; case 8: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_81D13FC(structPtr); + CreateBigRibbonSprite(structPtr); ChangeBgX(1, 0, 0); ChangeBgY(1, 0, 0); ChangeBgX(2, 0, 0); @@ -603,12 +645,11 @@ u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state) case 9: if (IsPaletteFadeActive()) return LT_PAUSE; - return LT_FINISH; } return LT_FINISH; } -u32 LoopedTask_ExitRibbonsSummaryMenu(s32 state) +static u32 LoopedTask_ExitRibbonsSummaryMenu(s32 state) { switch (state) { @@ -624,24 +665,24 @@ u32 LoopedTask_ExitRibbonsSummaryMenu(s32 state) return LT_FINISH; } -u32 LoopedTask_UpdateRibbonsSummaryInfo(s32 state) +static u32 LoopedTask_SwitchRibbonsSummaryMon(s32 state) { struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU); switch (state) { case 0: PlaySE(SE_SELECT); - sub_81D11D8(structPtr); + SlideMonSpriteOff(structPtr); return LT_INC_AND_PAUSE; case 1: - if (!sub_81D1234(structPtr)) + if (!IsMonSpriteAnimating(structPtr)) { PrintRibbbonsSummaryMonInfo(structPtr); return LT_INC_AND_CONTINUE; } return LT_PAUSE; case 2: - sub_81D12D8(structPtr); + DrawAllRibbonsSmall(structPtr); return LT_INC_AND_CONTINUE; case 3: PrintRibbonsMonListIndex(structPtr); @@ -652,31 +693,30 @@ u32 LoopedTask_UpdateRibbonsSummaryInfo(s32 state) case 5: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_81D11FC(structPtr); + SlideMonSpriteOn(structPtr); return LT_INC_AND_PAUSE; } return LT_PAUSE; case 6: - if (sub_81D1234(structPtr)) + if (IsMonSpriteAnimating(structPtr)) return LT_PAUSE; - return LT_FINISH; } return LT_FINISH; } -u32 LoopedTask_ExpandSelectedRibbon(s32 state) +static u32 LoopedTask_ExpandSelectedRibbon(s32 state) { struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU); switch (state) { case 0: PlaySE(SE_SELECT); - sub_81D1448(structPtr); + UpdateAndZoomInSelectedRibbon(structPtr); return LT_INC_AND_PAUSE; case 1: - if (!sub_81D1524(structPtr)) + if (!IsRibbonAnimating(structPtr)) { - sub_81D0EFC(structPtr); + PrintRibbonNameAndDescription(structPtr); PrintHelpBarText(HELPBAR_RIBBONS_CHECK); return LT_INC_AND_PAUSE; } @@ -688,26 +728,26 @@ u32 LoopedTask_ExpandSelectedRibbon(s32 state) return LT_FINISH; } -u32 LoopedTask_MoveRibbonsCursorExpanded(s32 state) +static u32 LoopedTask_MoveRibbonsCursorExpanded(s32 state) { struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU); switch (state) { case 0: PlaySE(SE_SELECT); - sub_81D1500(structPtr); + ZoomOutSelectedRibbon(structPtr); return LT_INC_AND_PAUSE; case 1: - if (!sub_81D1524(structPtr)) + if (!IsRibbonAnimating(structPtr)) { - sub_81D1448(structPtr); + UpdateAndZoomInSelectedRibbon(structPtr); return LT_INC_AND_PAUSE; } return LT_PAUSE; case 2: - if (!sub_81D1524(structPtr)) + if (!IsRibbonAnimating(structPtr)) { - sub_81D0EFC(structPtr); + PrintRibbonNameAndDescription(structPtr); return LT_INC_AND_PAUSE; } return LT_PAUSE; @@ -718,17 +758,17 @@ u32 LoopedTask_MoveRibbonsCursorExpanded(s32 state) return LT_FINISH; } -u32 LoopedTask_ShrinkExpandedRibbon(s32 state) +static u32 LoopedTask_ShrinkExpandedRibbon(s32 state) { struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU); switch (state) { case 0: PlaySE(SE_SELECT); - sub_81D1500(structPtr); + ZoomOutSelectedRibbon(structPtr); return LT_INC_AND_PAUSE; case 1: - if (!sub_81D1524(structPtr)) + if (!IsRibbonAnimating(structPtr)) { PrintCurrentMonRibbonCount(structPtr); PrintHelpBarText(HELPBAR_RIBBONS_LIST); @@ -753,14 +793,14 @@ static const struct WindowTemplate sRibbonCountWindowTemplate = .baseBlock = 0x14, }; -void AddRibbonCountWindow(struct PokenavSub14 *structPtr) +static void AddRibbonCountWindow(struct PokenavSub14 *structPtr) { structPtr->ribbonCountWindowId = AddWindow(&sRibbonCountWindowTemplate); PutWindowTilemap(structPtr->ribbonCountWindowId); PrintCurrentMonRibbonCount(structPtr); } -void PrintCurrentMonRibbonCount(struct PokenavSub14 *structPtr) +static void PrintCurrentMonRibbonCount(struct PokenavSub14 *structPtr) { u8 color[] = {TEXT_COLOR_RED, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY}; @@ -773,24 +813,31 @@ void PrintCurrentMonRibbonCount(struct PokenavSub14 *structPtr) CopyWindowToVram(structPtr->ribbonCountWindowId, 2); } -void sub_81D0EFC(struct PokenavSub14 *structPtr) +static void PrintRibbonNameAndDescription(struct PokenavSub14 *structPtr) { s32 i; - u32 ribbonId = sub_81D0954(); + u32 ribbonId = GetRibbonId(); u8 color[] = {TEXT_COLOR_RED, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY}; FillWindowPixelBuffer(structPtr->ribbonCountWindowId, PIXEL_FILL(4)); - if (ribbonId < 25) + if (ribbonId < FIRST_GIFT_RIBBON) { + // Print normal ribbon name/description for (i = 0; i < 2; i++) AddTextPrinterParameterized3(structPtr->ribbonCountWindowId, 1, 0, (i * 16) + 1, color, -1, gRibbonDescriptionPointers[ribbonId][i]); } else { - ribbonId = gSaveBlock1Ptr->giftRibbons[ribbonId - 25]; + // ribbonId here is one of the 'gift' ribbon slots, used to read + // its actual value from giftRibbons to determine which specific + // gift ribbon it is + ribbonId = gSaveBlock1Ptr->giftRibbons[ribbonId - FIRST_GIFT_RIBBON]; + + // If 0, this gift ribbon slot is unoccupied if (ribbonId == 0) return; + // Print gift ribbon name/description ribbonId--; for (i = 0; i < 2; i++) AddTextPrinterParameterized3(structPtr->ribbonCountWindowId, 1, 0, (i * 16) + 1, color, -1, gGiftRibbonDescriptionPointers[ribbonId][i]); @@ -810,7 +857,7 @@ static const struct WindowTemplate sRibbonSummaryMonNameWindowTemplate = .baseBlock = 0x54, }; -void AddRibbonSummaryMonNameWindow(struct PokenavSub14 *structPtr) +static void AddRibbonSummaryMonNameWindow(struct PokenavSub14 *structPtr) { structPtr->nameWindowId = AddWindow(&sRibbonSummaryMonNameWindowTemplate); PutWindowTilemap(structPtr->nameWindowId); @@ -821,7 +868,7 @@ static const u8 sMaleIconString[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_RED}{WHITE static const u8 sFemaleIconString[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_GREEN}{WHITE}{BLUE}♀{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}"); static const u8 sGenderlessIconString[] = _("{UNK_SPACER}"); -void PrintRibbbonsSummaryMonInfo(struct PokenavSub14 *structPtr) +static void PrintRibbbonsSummaryMonInfo(struct PokenavSub14 *structPtr) { const u8 *genderTxt; u8 *txtPtr; @@ -829,7 +876,7 @@ void PrintRibbbonsSummaryMonInfo(struct PokenavSub14 *structPtr) u16 windowId = structPtr->nameWindowId; FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); - GetCurrMonInfo1(gStringVar3, &level, &gender); + GetMonNicknameLevelGender(gStringVar3, &level, &gender); AddTextPrinterParameterized(windowId, 1, gStringVar3, 0, 1, TEXT_SPEED_FF, NULL); switch (gender) { @@ -867,7 +914,7 @@ static const struct WindowTemplate sRibbonMonListIndexWindowTemplate[] = {}, }; -void AddRibbonListIndexWindow(struct PokenavSub14 *structPtr) +static void AddRibbonListIndexWindow(struct PokenavSub14 *structPtr) { structPtr->listIdxWindowId = AddWindow(sRibbonMonListIndexWindowTemplate); FillWindowPixelBuffer(structPtr->listIdxWindowId, PIXEL_FILL(1)); @@ -875,7 +922,7 @@ void AddRibbonListIndexWindow(struct PokenavSub14 *structPtr) PrintRibbonsMonListIndex(structPtr); } -void PrintRibbonsMonListIndex(struct PokenavSub14 *structPtr) +static void PrintRibbonsMonListIndex(struct PokenavSub14 *structPtr) { s32 x; u8 *txtPtr; @@ -890,181 +937,219 @@ void PrintRibbonsMonListIndex(struct PokenavSub14 *structPtr) CopyWindowToVram(structPtr->listIdxWindowId, 2); } -void ResetSpritesAndDrawRibbonsMonFrontPic(struct PokenavSub14 *structPtr) +static void ResetSpritesAndDrawMonFrontPic(struct PokenavSub14 *structPtr) { u16 species; u32 personality, otId; - GetCurrMonInfo2(&species, &personality, &otId); + GetMonSpeciesPersonalityOtId(&species, &personality, &otId); ResetAllPicSprites(); - structPtr->monSpriteId = DrawRibbonsMonFrontPic(40, 104); + structPtr->monSpriteId = DrawRibbonsMonFrontPic(MON_SPRITE_X_ON, MON_SPRITE_Y); PokenavFillPalette(15, 0); } -void DestroyRibbonsMonFrontPic(struct PokenavSub14 *structPtr) +static void DestroyRibbonsMonFrontPic(struct PokenavSub14 *structPtr) { FreeAndDestroyMonPicSprite(structPtr->monSpriteId); } -u16 DrawRibbonsMonFrontPic(s32 unused0, s32 unused1) +// x and y arguments are ignored +// y is always given as MON_SPRITE_Y +// x is given as either MON_SPRITE_X_ON or MON_SPRITE_X_OFF (but ignored and MON_SPRITE_X_ON is used) +static u16 DrawRibbonsMonFrontPic(s32 x, s32 y) { u16 species, spriteId; u32 personality, otId; - GetCurrMonInfo2(&species, &personality, &otId); - spriteId = CreateMonPicSprite_HandleDeoxys(species, otId, personality, TRUE, 40, 104, 15, 0xFFFF); + GetMonSpeciesPersonalityOtId(&species, &personality, &otId); + spriteId = CreateMonPicSprite_HandleDeoxys(species, otId, personality, TRUE, MON_SPRITE_X_ON, MON_SPRITE_Y, 15, 0xFFFF); gSprites[spriteId].oam.priority = 0; return spriteId; } -void sub_81D11D8(struct PokenavSub14 *structPtr) +static void SlideMonSpriteOff(struct PokenavSub14 *structPtr) { - sub_81D1258(&gSprites[structPtr->monSpriteId], 40, -32, 6); + StartMonSpriteSlide(&gSprites[structPtr->monSpriteId], MON_SPRITE_X_ON, MON_SPRITE_X_OFF, 6); } -void sub_81D11FC(struct PokenavSub14 *structPtr) +static void SlideMonSpriteOn(struct PokenavSub14 *structPtr) { + // Switch to new mon sprite FreeAndDestroyMonPicSprite(structPtr->monSpriteId); - structPtr->monSpriteId = DrawRibbonsMonFrontPic(-32, 104); - sub_81D1258(&gSprites[structPtr->monSpriteId], -32, 40, 6); + structPtr->monSpriteId = DrawRibbonsMonFrontPic(MON_SPRITE_X_OFF, MON_SPRITE_Y); + + // Slide on + StartMonSpriteSlide(&gSprites[structPtr->monSpriteId], MON_SPRITE_X_OFF, MON_SPRITE_X_ON, 6); } -bool32 sub_81D1234(struct PokenavSub14 *structPtr) +// Is Pokémon summary sprite still sliding off/on +static bool32 IsMonSpriteAnimating(struct PokenavSub14 *structPtr) { return (gSprites[structPtr->monSpriteId].callback != SpriteCallbackDummy); } -void sub_81D1258(struct Sprite *sprite, s32 arg1, s32 arg2, s32 arg3) +#define sCurrX data[0] +#define sMoveIncr data[1] +#define sTime data[2] +#define sDestX data[3] + +static void StartMonSpriteSlide(struct Sprite *sprite, s32 startX, s32 destX, s32 time) { - u32 var = arg2 - arg1; + u32 delta = destX - startX; - sprite->pos1.x = arg1; - sprite->data[0] = arg1 << 4; - sprite->data[1] = (var << 4) / arg3; - sprite->data[2] = arg3; - sprite->data[3] = arg2; + sprite->pos1.x = startX; + sprite->sCurrX = startX << 4; + sprite->sMoveIncr = (delta << 4) / time; + sprite->sTime = time; + sprite->sDestX = destX; - sprite->callback = sub_81D1284; + sprite->callback = SpriteCB_MonSpriteSlide; } -void sub_81D1284(struct Sprite *sprite) +static void SpriteCB_MonSpriteSlide(struct Sprite *sprite) { - if (sprite->data[2] != 0) + if (sprite->sTime != 0) { - sprite->data[2]--; - sprite->data[0] += sprite->data[1]; - sprite->pos1.x = sprite->data[0] >> 4; - if (sprite->pos1.x <= -32) + sprite->sTime--; + sprite->sCurrX += sprite->sMoveIncr; + sprite->pos1.x = sprite->sCurrX >> 4; + if (sprite->pos1.x <= MON_SPRITE_X_OFF) sprite->invisible = TRUE; else sprite->invisible = FALSE; } else { - sprite->pos1.x = sprite->data[3]; + sprite->pos1.x = sprite->sDestX; sprite->callback = SpriteCallbackDummy; } } -void sub_81D12D8(struct PokenavSub14 *structPtr) +#undef sCurrX +#undef sMoveIncr +#undef sTime +#undef sDestX + +static void DrawAllRibbonsSmall(struct PokenavSub14 *structPtr) { - u32 *ptr; + u32 *ribbonIds; - sub_81D1350(); + ClearRibbonsSummaryBg(); - ptr = sub_81D0914(&gUnknown_030012C0); - for (gUnknown_030012C4 = 0; gUnknown_030012C4 < gUnknown_030012C0; gUnknown_030012C4++) - sub_81D1370(gUnknown_030012C4, *(ptr++)); + ribbonIds = GetNormalRibbonIds(&sRibbonDraw_Total); + for (sRibbonDraw_Current = 0; sRibbonDraw_Current < sRibbonDraw_Total; sRibbonDraw_Current++) + DrawRibbonSmall(sRibbonDraw_Current, *(ribbonIds++)); - ptr = sub_81D092C(&gUnknown_030012C0); - for (gUnknown_030012C4 = 0; gUnknown_030012C4 < gUnknown_030012C0; gUnknown_030012C4++) - sub_81D1370(gUnknown_030012C4 + 27, *(ptr++)); + ribbonIds = GetGiftRibbonIds(&sRibbonDraw_Total); + for (sRibbonDraw_Current = 0; sRibbonDraw_Current < sRibbonDraw_Total; sRibbonDraw_Current++) + DrawRibbonSmall(sRibbonDraw_Current + GIFT_RIBBON_START_POS, *(ribbonIds++)); CopyBgTilemapBufferToVram(1); } -void sub_81D1350(void) +// Redundant, the same FillBg is called in LoopedTask_OpenRibbonsSummaryMenu +static void ClearRibbonsSummaryBg(void) { FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 32, 20); } -void sub_81D1370(u32 arg0, u32 id) +static void DrawRibbonSmall(u32 i, u32 ribbonId) { u16 bgData[4]; - u32 destX = (arg0 % 9) * 2 + 11; - u32 destY = (arg0 / 9) * 2 + 4; + u32 destX = (i % RIBBONS_PER_ROW) * 2 + 11; + u32 destY = (i / RIBBONS_PER_ROW) * 2 + 4; - sub_81D13BC(bgData, id); + BufferSmallRibbonGfxData(bgData, ribbonId); CopyToBgTilemapBufferRect(1, bgData, destX, destY, 2, 2); } +// Below correspond to a ribbon icon in ribbons/icons.png and ribbons/icons_big.png; 0 at top, 11 at bottom +enum { + RIBBONGFX_CHAMPION, + RIBBONGFX_CONTEST_NORMAL, + RIBBONGFX_CONTEST_SUPER, + RIBBONGFX_CONTEST_HYPER, + RIBBONGFX_CONTEST_MASTER, + RIBBONGFX_WINNING, + RIBBONGFX_VICTORY, + RIBBONGFX_ARTIST, + RIBBONGFX_EFFORT, + RIBBONGFX_GIFT_1, + RIBBONGFX_GIFT_2, + RIBBONGFX_GIFT_3, +}; + +#define TO_PAL_OFFSET(palNum)((palNum) - PALTAG_RIBBON_ICONS_1) + struct { - u16 var0; - u16 var2; -} static const gUnknown_08624BF8[] = + u16 tileNumOffset; + u16 palNumOffset; +} static const sRibbonGfxData[] = { - {0, 0}, - {1, 0}, - {2, 0}, - {3, 0}, - {4, 0}, - {1, 1}, - {2, 1}, - {3, 1}, - {4, 1}, - {1, 2}, - {2, 2}, - {3, 2}, - {4, 2}, - {1, 3}, - {2, 3}, - {3, 3}, - {4, 3}, - {1, 4}, - {2, 4}, - {3, 4}, - {4, 4}, - {5, 0}, - {6, 0}, - {7, 1}, - {8, 2}, - {9, 1}, - {9, 3}, - {9, 4}, - {10, 3}, - {10, 4}, - {11, 0}, - {11, 1}, + [CHAMPION_RIBBON] = { RIBBONGFX_CHAMPION, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_1)}, + [COOL_RIBBON_NORMAL] = { RIBBONGFX_CONTEST_NORMAL, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_1)}, + [COOL_RIBBON_SUPER] = { RIBBONGFX_CONTEST_SUPER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_1)}, + [COOL_RIBBON_HYPER] = { RIBBONGFX_CONTEST_HYPER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_1)}, + [COOL_RIBBON_MASTER] = { RIBBONGFX_CONTEST_MASTER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_1)}, + [BEAUTY_RIBBON_NORMAL] = { RIBBONGFX_CONTEST_NORMAL, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_2)}, + [BEAUTY_RIBBON_SUPER] = { RIBBONGFX_CONTEST_SUPER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_2)}, + [BEAUTY_RIBBON_HYPER] = { RIBBONGFX_CONTEST_HYPER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_2)}, + [BEAUTY_RIBBON_MASTER] = { RIBBONGFX_CONTEST_MASTER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_2)}, + [CUTE_RIBBON_NORMAL] = { RIBBONGFX_CONTEST_NORMAL, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_3)}, + [CUTE_RIBBON_SUPER] = { RIBBONGFX_CONTEST_SUPER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_3)}, + [CUTE_RIBBON_HYPER] = { RIBBONGFX_CONTEST_HYPER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_3)}, + [CUTE_RIBBON_MASTER] = { RIBBONGFX_CONTEST_MASTER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_3)}, + [SMART_RIBBON_NORMAL] = { RIBBONGFX_CONTEST_NORMAL, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_4)}, + [SMART_RIBBON_SUPER] = { RIBBONGFX_CONTEST_SUPER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_4)}, + [SMART_RIBBON_HYPER] = { RIBBONGFX_CONTEST_HYPER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_4)}, + [SMART_RIBBON_MASTER] = { RIBBONGFX_CONTEST_MASTER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_4)}, + [TOUGH_RIBBON_NORMAL] = { RIBBONGFX_CONTEST_NORMAL, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_5)}, + [TOUGH_RIBBON_SUPER] = { RIBBONGFX_CONTEST_SUPER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_5)}, + [TOUGH_RIBBON_HYPER] = { RIBBONGFX_CONTEST_HYPER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_5)}, + [TOUGH_RIBBON_MASTER] = { RIBBONGFX_CONTEST_MASTER, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_5)}, + [WINNING_RIBBON] = { RIBBONGFX_WINNING, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_1)}, + [VICTORY_RIBBON] = { RIBBONGFX_VICTORY, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_1)}, + [ARTIST_RIBBON] = { RIBBONGFX_ARTIST, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_2)}, + [EFFORT_RIBBON] = { RIBBONGFX_EFFORT, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_3)}, + [MARINE_RIBBON] = { RIBBONGFX_GIFT_1, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_2)}, + [LAND_RIBBON] = { RIBBONGFX_GIFT_1, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_4)}, + [SKY_RIBBON] = { RIBBONGFX_GIFT_1, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_5)}, + [COUNTRY_RIBBON] = { RIBBONGFX_GIFT_2, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_4)}, + [NATIONAL_RIBBON] = { RIBBONGFX_GIFT_2, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_5)}, + [EARTH_RIBBON] = { RIBBONGFX_GIFT_3, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_1)}, + [WORLD_RIBBON] = { RIBBONGFX_GIFT_3, TO_PAL_OFFSET(PALTAG_RIBBON_ICONS_2)}, }; -void sub_81D13BC(u16 *dst, u32 id) -{ - u16 r3 = gUnknown_08624BF8[id].var2 + 2; - u16 r1 = (gUnknown_08624BF8[id].var0 * 2) + 1; +#undef TO_PAL_OFFSET - dst[0] = r1 | (r3 << 12); - dst[1] = r1 | (r3 << 12) |0x400; - dst[2] = (r1 + 1) | (r3 << 12); - dst[3] = (r1 + 1) | (r3 << 12) | 0x400; +static void BufferSmallRibbonGfxData(u16 *dst, u32 ribbonId) +{ + u16 palNum = sRibbonGfxData[ribbonId].palNumOffset + 2; + u16 tileNum = (sRibbonGfxData[ribbonId].tileNumOffset * 2) + 1; + + dst[0] = tileNum | (palNum << 12); + dst[1] = tileNum | (palNum << 12) | 0x400; + dst[2] = (tileNum + 1) | (palNum << 12); + dst[3] = (tileNum + 1) | (palNum << 12) | 0x400; } -static const struct CompressedSpriteSheet gUnknown_08624C78 = +static const struct CompressedSpriteSheet sSpriteSheet_RibbonIconsBig = { - sRibbonIconsBig_Gfx, 0x1800, 9 + sRibbonIconsBig_Gfx, 0x1800, GFXTAG_RIBBON_ICONS_BIG }; -static const struct SpritePalette gUnknown_08624C80[] = +static const struct SpritePalette sSpritePalettes_RibbonIcons[] = { - {gUnknown_08623FF8, 15}, - {gUnknown_08624018, 16}, - {gUnknown_08624038, 17}, - {gUnknown_08624058, 18}, - {gUnknown_08624078, 19}, + {sRibbonIcons1_Pal, PALTAG_RIBBON_ICONS_1}, + {sRibbonIcons2_Pal, PALTAG_RIBBON_ICONS_2}, + {sRibbonIcons3_Pal, PALTAG_RIBBON_ICONS_3}, + {sRibbonIcons4_Pal, PALTAG_RIBBON_ICONS_4}, + {sRibbonIcons5_Pal, PALTAG_RIBBON_ICONS_5}, {}, }; -static const struct OamData sOamData_8624CB0 = +static const struct OamData sOamData_RibbonIconBig = { .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, @@ -1081,93 +1166,105 @@ static const struct OamData sOamData_8624CB0 = .affineParam = 0 }; -static const union AffineAnimCmd sSpriteAffineAnim_8624CB8[] = +static const union AffineAnimCmd sAffineAnim_RibbonIconBig_Normal[] = { AFFINEANIMCMD_FRAME(128, 128, 0, 0), AFFINEANIMCMD_END }; -static const union AffineAnimCmd sSpriteAffineAnim_8624CC8[] = +static const union AffineAnimCmd sAffineAnim_RibbonIconBig_ZoomIn[] = { AFFINEANIMCMD_FRAME(128, 128, 0, 0), AFFINEANIMCMD_FRAME(32, 32, 0, 4), AFFINEANIMCMD_END }; -static const union AffineAnimCmd sSpriteAffineAnim_8624CE0[] = +static const union AffineAnimCmd sAffineAnim_RibbonIconBig_ZoomOut[] = { AFFINEANIMCMD_FRAME(256, 256, 0, 0), AFFINEANIMCMD_FRAME(-32, -32, 0, 4), AFFINEANIMCMD_END }; -static const union AffineAnimCmd *const sSpriteAffineAnimTable_8624CF8[] = -{ - sSpriteAffineAnim_8624CB8, - sSpriteAffineAnim_8624CC8, - sSpriteAffineAnim_8624CE0 +enum { + RIBBONANIM_NORMAL, + RIBBONANIM_ZOOM_IN, + RIBBONANIM_ZOOM_OUT, }; -static const struct SpriteTemplate gUnknown_08624D04 = +static const union AffineAnimCmd *const sAffineAnims_RibbonIconBig[] = { - .tileTag = 9, - .paletteTag = 15, - .oam = &sOamData_8624CB0, + [RIBBONANIM_NORMAL] = sAffineAnim_RibbonIconBig_Normal, + [RIBBONANIM_ZOOM_IN] = sAffineAnim_RibbonIconBig_ZoomIn, + [RIBBONANIM_ZOOM_OUT] = sAffineAnim_RibbonIconBig_ZoomOut +}; + +static const struct SpriteTemplate sSpriteTemplate_RibbonIconBig = +{ + .tileTag = GFXTAG_RIBBON_ICONS_BIG, + .paletteTag = PALTAG_RIBBON_ICONS_1, + .oam = &sOamData_RibbonIconBig, .anims = gDummySpriteAnimTable, .images = NULL, - .affineAnims = sSpriteAffineAnimTable_8624CF8, + .affineAnims = sAffineAnims_RibbonIconBig, .callback = SpriteCallbackDummy, }; -void sub_81D13FC(struct PokenavSub14 *structPtr) +// Create dummy sprite to be used for the zoomed in version of the selected ribbon +static void CreateBigRibbonSprite(struct PokenavSub14 *structPtr) { u8 spriteId; - LoadCompressedSpriteSheet(&gUnknown_08624C78); - Pokenav_AllocAndLoadPalettes(gUnknown_08624C80); + LoadCompressedSpriteSheet(&sSpriteSheet_RibbonIconsBig); + Pokenav_AllocAndLoadPalettes(sSpritePalettes_RibbonIcons); - spriteId = CreateSprite(&gUnknown_08624D04, 0, 0, 0); - structPtr->field_14 = &gSprites[spriteId]; - structPtr->field_14->invisible = TRUE; + spriteId = CreateSprite(&sSpriteTemplate_RibbonIconBig, 0, 0, 0); + structPtr->bigRibbonSprite = &gSprites[spriteId]; + structPtr->bigRibbonSprite->invisible = TRUE; } -void sub_81D1448(struct PokenavSub14 *structPtr) +#define sInvisibleWhenDone data[0] + +static void UpdateAndZoomInSelectedRibbon(struct PokenavSub14 *structPtr) { u32 ribbonId; - s32 r4 = sub_81D0944(); - s32 r5 = (r4 % 9) * 16 + 96; - s32 r0 = (r4 / 9) * 16 + 40; + s32 position = GetSelectedPosition(); + s32 x = (position % RIBBONS_PER_ROW) * 16 + 96; + s32 y = (position / RIBBONS_PER_ROW) * 16 + 40; - structPtr->field_14->pos1.x = r5; - structPtr->field_14->pos1.y = r0; + structPtr->bigRibbonSprite->pos1.x = x; + structPtr->bigRibbonSprite->pos1.y = y; - ribbonId = sub_81D0954(); - structPtr->field_14->oam.tileNum = (gUnknown_08624BF8[ribbonId].var0 * 16) + GetSpriteTileStartByTag(9); - structPtr->field_14->oam.paletteNum = IndexOfSpritePaletteTag(gUnknown_08624BF8[ribbonId].var2 + 15); + // Set new selected ribbon's gfx data + ribbonId = GetRibbonId(); + structPtr->bigRibbonSprite->oam.tileNum = (sRibbonGfxData[ribbonId].tileNumOffset * 16) + GetSpriteTileStartByTag(GFXTAG_RIBBON_ICONS_BIG); + structPtr->bigRibbonSprite->oam.paletteNum = IndexOfSpritePaletteTag(sRibbonGfxData[ribbonId].palNumOffset + PALTAG_RIBBON_ICONS_1); - StartSpriteAffineAnim(structPtr->field_14, 1); - structPtr->field_14->invisible = FALSE; - structPtr->field_14->data[0] = 0; - structPtr->field_14->callback = sub_81D1538; + // Start zoom in animation + StartSpriteAffineAnim(structPtr->bigRibbonSprite, RIBBONANIM_ZOOM_IN); + structPtr->bigRibbonSprite->invisible = FALSE; + structPtr->bigRibbonSprite->sInvisibleWhenDone = FALSE; + structPtr->bigRibbonSprite->callback = SpriteCB_WaitForRibbonAnimation; } -void sub_81D1500(struct PokenavSub14 *structPtr) +// Start animation to zoom out of selected ribbon +static void ZoomOutSelectedRibbon(struct PokenavSub14 *structPtr) { - structPtr->field_14->data[0] = 1; - StartSpriteAffineAnim(structPtr->field_14, 2); - structPtr->field_14->callback = sub_81D1538; + structPtr->bigRibbonSprite->sInvisibleWhenDone = TRUE; + StartSpriteAffineAnim(structPtr->bigRibbonSprite, RIBBONANIM_ZOOM_OUT); + structPtr->bigRibbonSprite->callback = SpriteCB_WaitForRibbonAnimation; } -bool32 sub_81D1524(struct PokenavSub14 *structPtr) +static bool32 IsRibbonAnimating(struct PokenavSub14 *structPtr) { - return (structPtr->field_14->callback != SpriteCallbackDummy); + return (structPtr->bigRibbonSprite->callback != SpriteCallbackDummy); } -void sub_81D1538(struct Sprite *sprite) +static void SpriteCB_WaitForRibbonAnimation(struct Sprite *sprite) { if (sprite->affineAnimEnded) { - sprite->invisible = sprite->data[0]; + sprite->invisible = sprite->sInvisibleWhenDone; sprite->callback = SpriteCallbackDummy; } } diff --git a/src/rayquaza_scene.c b/src/rayquaza_scene.c index bc6758cae..101916f13 100644 --- a/src/rayquaza_scene.c +++ b/src/rayquaza_scene.c @@ -1627,8 +1627,8 @@ static void Task_DuoFightAnim(u8 taskId) StopMapMusic(); } - BlendPalettes(-1, 0x10, 0); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BlendPalettes(PALETTES_ALL, 0x10, 0); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); SetVBlankCallback(VBlankCB_DuoFight); PlaySE(SE_DOWNPOUR); } @@ -1738,21 +1738,21 @@ static void Task_HandleDuoFight(u8 taskId) static void DuoFight_Lightning1(void) { PlaySE(SE_THUNDER); - BlendPalettesGradually(0x00007FFF, 0, 16, 0, RGB_WHITEALPHA, 0, 0); - BlendPalettesGradually(0xFFFF0000, 0, 16, 0, RGB_BLACK, 0, 1); + BlendPalettesGradually(PALETTES_BG & ~(0x8000), 0, 16, 0, RGB_WHITEALPHA, 0, 0); + BlendPalettesGradually(PALETTES_OBJECTS, 0, 16, 0, RGB_BLACK, 0, 1); } static void DuoFight_Lightning2(void) { PlaySE(SE_THUNDER); - BlendPalettesGradually(0x00007FFF, 0, 16, 16, RGB_WHITEALPHA, 0, 0); - BlendPalettesGradually(0xFFFF0000, 0, 16, 16, RGB_BLACK, 0, 1); + BlendPalettesGradually(PALETTES_BG & ~(0x8000), 0, 16, 16, RGB_WHITEALPHA, 0, 0); + BlendPalettesGradually(PALETTES_OBJECTS, 0, 16, 16, RGB_BLACK, 0, 1); } static void DuoFight_LightningLong(void) { - BlendPalettesGradually(0x00007FFF, 4, 16, 0, RGB_WHITEALPHA, 0, 0); - BlendPalettesGradually(0xFFFF0000, 4, 16, 0, RGB_BLACK, 0, 1); + BlendPalettesGradually(PALETTES_BG & ~(0x8000), 4, 16, 0, RGB_WHITEALPHA, 0, 0); + BlendPalettesGradually(PALETTES_OBJECTS, 4, 16, 0, RGB_BLACK, 0, 1); } static void DuoFight_AnimateRain(void) @@ -1784,7 +1784,7 @@ static void DuoFight_PanOffScene(u8 taskId) static void DuoFightEnd(u8 taskId, s8 palDelay) { PlaySE(SE_DOWNPOUR_STOP); - BeginNormalPaletteFade(0xFFFFFFFF, palDelay, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, palDelay, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_DuoFightEnd; } @@ -2045,7 +2045,7 @@ static void Task_RayTakesFlightAnim(u8 taskId) LoadTakesFlightSceneGfx(); SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_OBJ | BLDCNT_TGT2_BG1 | BLDCNT_EFFECT_BLEND); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(8, 8)); - BlendPalettes(-1, 16, 0); + BlendPalettes(PALETTES_ALL, 16, 0); SetVBlankCallback(VBlankCB_RayquazaScene); CreateTask(Task_TakesFlight_CreateSmoke, 0); tState = 0; @@ -2064,7 +2064,7 @@ static void Task_HandleRayTakesFlight(u8 taskId) // Delay, then fade in if (tTimer == 8) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); tScale = 0; tScaleSpeed = 30; tYCoord = 0; @@ -2110,7 +2110,7 @@ static void Task_HandleRayTakesFlight(u8 taskId) if (tTimer > 295) { tState++; - BeginNormalPaletteFade(0xFFFFFFFF, 6, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 6, 0, 0x10, RGB_BLACK); } } break; @@ -2284,7 +2284,7 @@ static void Task_RayDescendsAnim(u8 taskId) LoadDescendsSceneGfx(); SetGpuRegBits(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ | BLDCNT_EFFECT_BLEND); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16)); - BlendPalettes(-1, 0x10, 0); + BlendPalettes(PALETTES_ALL, 0x10, 0); SetVBlankCallback(VBlankCB_RayquazaScene); sRayScene->revealedLightLine = 0; sRayScene->revealedLightTimer = 0; @@ -2305,7 +2305,7 @@ static void Task_HandleRayDescends(u8 taskId) // Delay, then fade in if (tTimer == 8) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); tTimer = 0; tState++; } @@ -2354,7 +2354,7 @@ static void Task_HandleRayDescends(u8 taskId) break; case 4: // Fade out - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_RayDescendsEnd; break; } @@ -2501,7 +2501,7 @@ static void Task_RayChargesAnim(u8 taskId) InitChargesSceneBgs(); LoadChargesSceneGfx(); SetWindowsHideVertBorders(); - BlendPalettes(-1, 0x10, 0); + BlendPalettes(PALETTES_ALL, 0x10, 0); SetVBlankCallback(VBlankCB_RayquazaScene); tState = 0; tTimer = 0; @@ -2523,7 +2523,7 @@ static void Task_HandleRayCharges(u8 taskId) // Delay, then fade in if (tTimer == 8) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); tTimer = 0; tState++; } @@ -2559,7 +2559,7 @@ static void Task_HandleRayCharges(u8 taskId) break; case 3: // Fade out - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_RayChargesEnd; break; } @@ -2697,7 +2697,7 @@ static void Task_RayChasesAwayAnim(u8 taskId) ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON); SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_TGT2_BG1 | BLDCNT_EFFECT_BLEND); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(9, 14)); - BlendPalettes(-1, 0x10, 0); + BlendPalettes(PALETTES_ALL, 0x10, 0); SetVBlankCallback(VBlankCB_RayquazaScene); tState = 0; tTimer = 0; @@ -2720,7 +2720,7 @@ static void Task_HandleRayChasesAway(u8 taskId) if (tTimer == 8) { ChasesAway_CreateTrioSprites(taskId); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); tTimer = 0; tState++; } @@ -2760,14 +2760,14 @@ static void Task_HandleRayChasesAway(u8 taskId) tTimer++; if (tTimer % 144 == 0) { - BlendPalettesGradually(0x0000FFFE, 0, 16, 0, RGB_WHITEALPHA, 0, 0); - BlendPalettesGradually(0xFFFF0000, 0, 16, 0, RGB_BLACK, 0, 1); + BlendPalettesGradually(PALETTES_BG & ~1, 0, 16, 0, RGB_WHITEALPHA, 0, 0); + BlendPalettesGradually(PALETTES_OBJECTS, 0, 16, 0, RGB_BLACK, 0, 1); } } break; case 3: // Fade out - BeginNormalPaletteFade(0xFFFFFFFF, 4, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 4, 0, 0x10, RGB_BLACK); gTasks[taskId].func = Task_RayChasesAwayEnd; break; } diff --git a/src/recorded_battle.c b/src/recorded_battle.c index 6fcbe04f1..e29792766 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -75,16 +75,16 @@ struct RecordedBattleSave EWRAM_DATA u32 gRecordedBattleRngSeed = 0; EWRAM_DATA u32 gBattlePalaceMoveSelectionRngValue = 0; EWRAM_DATA static u8 sBattleRecords[MAX_BATTLERS_COUNT][BATTLER_RECORD_SIZE] = {0}; -EWRAM_DATA static u16 sRecordedBytesNo[MAX_BATTLERS_COUNT] = {0}; -EWRAM_DATA static u16 sUnknown_0203C79C[4] = {0}; -EWRAM_DATA static u16 sUnknown_0203C7A4[4] = {0}; -EWRAM_DATA static u8 sUnknown_0203C7AC = 0; +EWRAM_DATA static u16 sBattlerRecordSizes[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA static u16 sBattlerPrevRecordSizes[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA static u16 sBattlerSavedRecordSizes[MAX_BATTLERS_COUNT] = {0}; +EWRAM_DATA static u8 sRecordMode = 0; EWRAM_DATA static u8 sLvlMode = 0; EWRAM_DATA static u8 sFrontierFacility = 0; EWRAM_DATA static u8 sFrontierBrainSymbol = 0; EWRAM_DATA static MainCallback sCallback2_AfterRecordedBattle = NULL; EWRAM_DATA u8 gRecordedBattleMultiplayerId = 0; -EWRAM_DATA static u8 sUnknown_0203C7B5 = 0; +EWRAM_DATA static u8 sFrontierPassFlag = 0; EWRAM_DATA static u8 sBattleScene = 0; EWRAM_DATA static u8 sTextSpeed = 0; EWRAM_DATA static u32 sBattleFlags = 0; @@ -93,7 +93,7 @@ EWRAM_DATA static struct Pokemon sSavedPlayerParty[PARTY_SIZE] = {0}; EWRAM_DATA static struct Pokemon sSavedOpponentParty[PARTY_SIZE] = {0}; EWRAM_DATA static u16 sPlayerMonMoves[2][MAX_MON_MOVES] = {0}; EWRAM_DATA static struct PlayerInfo sPlayers[MAX_BATTLERS_COUNT] = {0}; -EWRAM_DATA static u8 sUnknown_0203CCD0 = 0; +EWRAM_DATA static bool8 sUnknown_0203CCD0 = 0; EWRAM_DATA static u8 sRecordMixFriendName[PLAYER_NAME_LENGTH + 1] = {0}; EWRAM_DATA static u8 sRecordMixFriendClass = 0; EWRAM_DATA static u8 sApprenticeId = 0; @@ -103,26 +103,25 @@ EWRAM_DATA static u8 sBattleOutcome = 0; static u8 sRecordMixFriendLanguage; static u8 sApprenticeLanguage; -// this file's functions -static u8 sub_8185278(u8 *arg0, u8 *arg1, u8 *arg2); -static bool32 CopyRecordedBattleFromSave(struct RecordedBattleSave *dst); +static u8 GetNextRecordedDataByte(u8 *, u8 *, u8 *); +static bool32 CopyRecordedBattleFromSave(struct RecordedBattleSave *); static void RecordedBattle_RestoreSavedParties(void); static void CB2_RecordedBattle(void); -void sub_8184DA4(u8 arg0) +void RecordedBattle_Init(u8 mode) { s32 i, j; - sUnknown_0203C7AC = arg0; - sUnknown_0203CCD0 = 0; + sRecordMode = mode; + sUnknown_0203CCD0 = FALSE; for (i = 0; i < MAX_BATTLERS_COUNT; i++) { - sRecordedBytesNo[i] = 0; - sUnknown_0203C79C[i] = 0; - sUnknown_0203C7A4[i] = 0; + sBattlerRecordSizes[i] = 0; + sBattlerPrevRecordSizes[i] = 0; + sBattlerSavedRecordSizes[i] = 0; - if (arg0 == 1) + if (mode == B_RECORD_MODE_RECORDING) { for (j = 0; j < BATTLER_RECORD_SIZE; j++) { @@ -138,13 +137,13 @@ void sub_8184E58(void) { s32 i, j; - if (sUnknown_0203C7AC == 1) + if (sRecordMode == B_RECORD_MODE_RECORDING) { gRecordedBattleRngSeed = gRngValue; sFrontierFacility = VarGet(VAR_FRONTIER_FACILITY); sFrontierBrainSymbol = GetFronterBrainSymbol(); } - else if (sUnknown_0203C7AC == 2) + else if (sRecordMode == B_RECORD_MODE_PLAYBACK) { gRngValue = gRecordedBattleRngSeed; } @@ -195,9 +194,9 @@ void sub_8184E58(void) void RecordedBattle_SetBattlerAction(u8 battlerId, u8 action) { - if (sRecordedBytesNo[battlerId] < BATTLER_RECORD_SIZE && sUnknown_0203C7AC != 2) + if (sBattlerRecordSizes[battlerId] < BATTLER_RECORD_SIZE && sRecordMode != B_RECORD_MODE_PLAYBACK) { - sBattleRecords[battlerId][sRecordedBytesNo[battlerId]++] = action; + sBattleRecords[battlerId][sBattlerRecordSizes[battlerId]++] = action; } } @@ -207,9 +206,9 @@ void RecordedBattle_ClearBattlerAction(u8 battlerId, u8 bytesToClear) for (i = 0; i < bytesToClear; i++) { - sRecordedBytesNo[battlerId]--; - sBattleRecords[battlerId][sRecordedBytesNo[battlerId]] = 0xFF; - if (sRecordedBytesNo[battlerId] == 0) + sBattlerRecordSizes[battlerId]--; + sBattleRecords[battlerId][sBattlerRecordSizes[battlerId]] = 0xFF; + if (sBattlerRecordSizes[battlerId] == 0) break; } } @@ -217,54 +216,55 @@ void RecordedBattle_ClearBattlerAction(u8 battlerId, u8 bytesToClear) u8 RecordedBattle_GetBattlerAction(u8 battlerId) { // Trying to read past array or invalid action byte, battle is over. - if (sRecordedBytesNo[battlerId] >= BATTLER_RECORD_SIZE || sBattleRecords[battlerId][sRecordedBytesNo[battlerId]] == 0xFF) + if (sBattlerRecordSizes[battlerId] >= BATTLER_RECORD_SIZE || sBattleRecords[battlerId][sBattlerRecordSizes[battlerId]] == 0xFF) { gSpecialVar_Result = gBattleOutcome = B_OUTCOME_PLAYER_TELEPORTED; // hah ResetPaletteFadeControl(); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); SetMainCallback2(CB2_QuitRecordedBattle); return 0xFF; } else { - return sBattleRecords[battlerId][sRecordedBytesNo[battlerId]++]; + return sBattleRecords[battlerId][sBattlerRecordSizes[battlerId]++]; } } -u8 sub_81850D0(void) +// Unused +static u8 GetRecordedBattleMode(void) { - return sUnknown_0203C7AC; + return sRecordMode; } -u8 sub_81850DC(u8 *arg0) +u8 RecordedBattle_BufferNewBattlerData(u8 *dst) { u8 i, j; - u8 ret = 0; + u8 idx = 0; for (i = 0; i < MAX_BATTLERS_COUNT; i++) { - if (sRecordedBytesNo[i] != sUnknown_0203C79C[i]) + if (sBattlerRecordSizes[i] != sBattlerPrevRecordSizes[i]) { - arg0[ret++] = i; - arg0[ret++] = sRecordedBytesNo[i] - sUnknown_0203C79C[i]; + dst[idx++] = i; + dst[idx++] = sBattlerRecordSizes[i] - sBattlerPrevRecordSizes[i]; - for (j = 0; j < sRecordedBytesNo[i] - sUnknown_0203C79C[i]; j++) + for (j = 0; j < sBattlerRecordSizes[i] - sBattlerPrevRecordSizes[i]; j++) { - arg0[ret++] = sBattleRecords[i][sUnknown_0203C79C[i] + j]; + dst[idx++] = sBattleRecords[i][sBattlerPrevRecordSizes[i] + j]; } - sUnknown_0203C79C[i] = sRecordedBytesNo[i]; + sBattlerPrevRecordSizes[i] = sBattlerRecordSizes[i]; } } - return ret; + return idx; } -void sub_81851A8(u8 *arg0) +void RecordedBattle_RecordAllBattlerData(u8 *src) { s32 i; - u8 var1 = 2; - u8 var2; + u8 idx = 2; + u8 size; if (!(gBattleTypeFlags & BATTLE_TYPE_LINK)) return; @@ -277,23 +277,23 @@ void sub_81851A8(u8 *arg0) if (!(gBattleTypeFlags & BATTLE_TYPE_IS_MASTER)) { - for (var2 = *arg0; var2 != 0;) + for (size = *src; size != 0;) { - u8 unkVar = sub_8185278(arg0, &var1, &var2); - u8 unkVar2 = sub_8185278(arg0, &var1, &var2); + u8 battlerId = GetNextRecordedDataByte(src, &idx, &size); + u8 numActions = GetNextRecordedDataByte(src, &idx, &size); - for (i = 0; i < unkVar2; i++) + for (i = 0; i < numActions; i++) { - sBattleRecords[unkVar][sUnknown_0203C7A4[unkVar]++] = sub_8185278(arg0, &var1, &var2); + sBattleRecords[battlerId][sBattlerSavedRecordSizes[battlerId]++] = GetNextRecordedDataByte(src, &idx, &size); } } } } -static u8 sub_8185278(u8 *arg0, u8 *arg1, u8 *arg2) +static u8 GetNextRecordedDataByte(u8 *data, u8 *idx, u8 *size) { - (*arg2)--; - return arg0[(*arg1)++]; + (*size)--; + return data[(*idx)++]; } bool32 CanCopyRecordedBattleSaveData(void) @@ -687,19 +687,20 @@ u8 GetActiveBattlerLinkPlayerGender(void) return 0; } -void sub_8185F84(void) +void RecordedBattle_ClearFrontierPassFlag(void) { - sUnknown_0203C7B5 = 0; + sFrontierPassFlag = 0; } -void sub_8185F90(u16 arg0) +// Set sFrontierPassFlag to received state of FLAG_SYS_FRONTIER_PASS +void RecordedBattle_SetFrontierPassFlagFromHword(u16 arg0) { - sUnknown_0203C7B5 |= (arg0 & 0x8000) >> 0xF; + sFrontierPassFlag |= (arg0 & 0x8000) >> 15; } -u8 sub_8185FAC(void) +u8 RecordedBattle_GetFrontierPassFlag(void) { - return sUnknown_0203C7B5; + return sFrontierPassFlag; } u8 GetBattleSceneInRecordedBattle(void) @@ -720,7 +721,7 @@ void RecordedBattle_CopyBattlerMoves(void) return; if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)) return; - if (sUnknown_0203C7AC == 2) + if (sRecordMode == B_RECORD_MODE_PLAYBACK) return; for (i = 0; i < MAX_MON_MOVES; i++) @@ -767,7 +768,7 @@ void sub_818603C(u8 arg0) } else { - if (sBattleRecords[battlerId][sRecordedBytesNo[battlerId]] == ACTION_MOVE_CHANGE) + if (sBattleRecords[battlerId][sBattlerRecordSizes[battlerId]] == ACTION_MOVE_CHANGE) { u8 ppBonuses[MAX_MON_MOVES]; u8 array1[MAX_MON_MOVES]; @@ -841,12 +842,12 @@ u32 GetAiScriptsInRecordedBattle(void) void sub_8186444(void) { - sUnknown_0203CCD0 = 1; + sUnknown_0203CCD0 = TRUE; } bool8 sub_8186450(void) { - return (sUnknown_0203CCD0 == 0); + return (sUnknown_0203CCD0 == FALSE); } void GetRecordedBattleRecordMixFriendName(u8 *dst) diff --git a/src/region_map.c b/src/region_map.c index 22b925a6f..bec51ebf0 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -1721,7 +1721,7 @@ void CB2_OpenFlyMap(void) gMain.state++; break; case 9: - BlendPalettes(-1, 16, 0); + BlendPalettes(PALETTES_ALL, 16, 0); SetVBlankCallback(VBlankCB_FlyMap); gMain.state++; break; @@ -1936,7 +1936,7 @@ static void CB_FadeInFlyMap(void) switch (sFlyMap->state) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); sFlyMap->state++; break; case 1: @@ -1983,7 +1983,7 @@ static void CB_ExitFlyMap(void) switch (sFlyMap->state) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sFlyMap->state++; break; case 1: diff --git a/src/reset_rtc_screen.c b/src/reset_rtc_screen.c index 770e4f370..844b06960 100644 --- a/src/reset_rtc_screen.c +++ b/src/reset_rtc_screen.c @@ -19,24 +19,52 @@ #include "gpu_regs.h" #include "constants/rgb.h" -struct ResetRtcStruct +#define PALTAG_ARROW 0x1000 + +// Task data for the Task_ResetRtc_* series of tasks, when setting the time on the clock +// Data from these tasks is also used by the cursors and the main task (Task_ResetRtcScreen) +enum { + DATAIDX_DAYS = 3, + DATAIDX_HOURS, + DATAIDX_MINS, + DATAIDX_SECS, + DATAIDX_CONFIRM, +}; +#define tFinished data[0] +#define tSetTime data[1] +#define tSelection data[2] +#define tDays data[DATAIDX_DAYS] +#define tHours data[DATAIDX_HOURS] +#define tMinutes data[DATAIDX_MINS] +#define tSeconds data[DATAIDX_SECS] +#define tConfirm data[DATAIDX_CONFIRM] +#define tWindowId data[8] + +enum { + SELECTION_DAYS = 1, + SELECTION_HOURS, + SELECTION_MINS, + SELECTION_SECS, + SELECTION_CONFIRM, + SELECTION_NONE +}; + +struct ResetRtcInputMap { /*0x0*/ u8 dataIndex; /*0x2*/ u16 minVal; /*0x4*/ u16 maxVal; /*0x6*/ u8 left; /*0x7*/ u8 right; - /*0x8*/ u8 unk8; + /*0x8*/ u8 unk; // never read }; -// this file's functions static void CB2_ResetRtcScreen(void); static void VBlankCB(void); static void Task_ResetRtcScreen(u8 taskId); -static void sub_809F048(void); +static void InitResetRtcScreenBgAndWindows(void); -// const rom data -static const struct BgTemplate sBackgroundTemplates[] = +static const struct BgTemplate sBgTemplates[] = { { .bg = 0, @@ -49,60 +77,84 @@ static const struct BgTemplate sBackgroundTemplates[] = } }; -static const struct WindowTemplate sUnknown_08510408[] = +static const struct WindowTemplate sWindowTemplates[] = { - {0x00, 0x01, 0x01, 0x13, 0x09, 0x0f, 0x0155}, - {0x00, 0x02, 0x0f, 0x1b, 0x04, 0x0f, 0x00e9}, + { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 19, + .height = 9, + .paletteNum = 15, + .baseBlock = 0x155 + }, + { + .bg = 0, + .tilemapLeft = 2, + .tilemapTop = 15, + .width = 27, + .height = 4, + .paletteNum = 15, + .baseBlock = 0xE9 + }, DUMMY_WIN_TEMPLATE }; -static const struct WindowTemplate sUnknown_08510420 = {0x00, 0x04, 0x09, 0x15, 0x02, 0x0f, 0x00bf}; +static const struct WindowTemplate sInputTimeWindow = { + .bg = 0, + .tilemapLeft = 4, + .tilemapTop = 9, + .width = 21, + .height = 2, + .paletteNum = 15, + .baseBlock = 0xBF +}; -static const struct ResetRtcStruct sUnknown_08510428[5] = +static const struct ResetRtcInputMap sInputMap[] = { - { - .dataIndex = 3, + [SELECTION_DAYS - 1] = { + .dataIndex = DATAIDX_DAYS, .minVal = 1, .maxVal = 9999, .left = 0, .right = 2, - .unk8 = 0, + .unk = 0, }, - { - .dataIndex = 4, + [SELECTION_HOURS - 1] = { + .dataIndex = DATAIDX_HOURS, .minVal = 0, .maxVal = 23, .left = 1, .right = 3, - .unk8 = 0, + .unk = 0, }, - { - .dataIndex = 5, + [SELECTION_MINS - 1] = { + .dataIndex = DATAIDX_MINS, .minVal = 0, .maxVal = 59, .left = 2, .right = 4, - .unk8 = 0, + .unk = 0, }, - { - .dataIndex = 6, + [SELECTION_SECS - 1] = { + .dataIndex = DATAIDX_SECS, .minVal = 0, .maxVal = 59, .left = 3, .right = 5, - .unk8 = 0, + .unk = 0, }, - { - .dataIndex = 7, + [SELECTION_CONFIRM - 1] = { + .dataIndex = DATAIDX_CONFIRM, .minVal = 0, .maxVal = 0, .left = 4, .right = 0, - .unk8 = 6, + .unk = 6, }, }; -static const struct OamData sOamData_08510464 = +static const struct OamData sOamData_Arrow = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -119,148 +171,158 @@ static const struct OamData sOamData_08510464 = .affineParam = 0, }; -static const u8 sResetRtcScreen_DownArrowGfx[] = INCBIN_U8("graphics/misc/reset_rtc_screen_downarrow.4bpp"); -static const u8 sResetRtcScreen_RightArrowGfx[] = INCBIN_U8("graphics/misc/reset_rtc_screen_rightarrow.4bpp"); -static const u16 sResetRtcScreen_ArrowPal[] = INCBIN_U16("graphics/misc/reset_rtc_screen_arrow.gbapal"); +static const u8 sArrowDown_Gfx[] = INCBIN_U8("graphics/reset_rtc_screen/arrow_down.4bpp"); +static const u8 sArrowRight_Gfx[] = INCBIN_U8("graphics/reset_rtc_screen/arrow_right.4bpp"); +static const u16 sArrow_Pal[] = INCBIN_U16("graphics/reset_rtc_screen/arrow.gbapal"); -static const struct SpriteFrameImage sSpriteImageTable_85104B4[] = +static const struct SpriteFrameImage sPicTable_Arrow[] = { - obj_frame_tiles(sResetRtcScreen_DownArrowGfx), - obj_frame_tiles(sResetRtcScreen_RightArrowGfx) + obj_frame_tiles(sArrowDown_Gfx), + obj_frame_tiles(sArrowRight_Gfx) }; -const struct SpritePalette gSpritePalette_RtcArrow = +const struct SpritePalette gSpritePalette_Arrow = { - sResetRtcScreen_ArrowPal, 0x1000 + sArrow_Pal, PALTAG_ARROW }; -static const union AnimCmd sSpriteAnim_85104CC[] = +static const union AnimCmd sAnim_Arrow_Down[] = { ANIMCMD_FRAME(0, 30), ANIMCMD_JUMP(0), }; -static const union AnimCmd sSpriteAnim_85104D4[] = +static const union AnimCmd sAnim_Arrow_Up[] = { ANIMCMD_FRAME(0, 30, .vFlip = TRUE), ANIMCMD_JUMP(0), }; -static const union AnimCmd sSpriteAnim_85104DC[] = +static const union AnimCmd sAnim_Arrow_Right[] = { ANIMCMD_FRAME(1, 30), ANIMCMD_JUMP(0), }; -static const union AnimCmd *const sSpriteAnimTable_85104E4[] = -{ - sSpriteAnim_85104CC, - sSpriteAnim_85104D4, - sSpriteAnim_85104DC, +enum { + ARROW_DOWN, + ARROW_UP, + ARROW_RIGHT, }; -const struct SpriteTemplate gSpriteTemplate_RtcArrow = +static const union AnimCmd *const sAnims_Arrow[] = +{ + [ARROW_DOWN] = sAnim_Arrow_Down, + [ARROW_UP] = sAnim_Arrow_Up, + [ARROW_RIGHT] = sAnim_Arrow_Right, +}; + +const struct SpriteTemplate gSpriteTemplate_Arrow = { .tileTag = 0xFFFF, - .paletteTag = 0x1000, - .oam = &sOamData_08510464, - .anims = sSpriteAnimTable_85104E4, - .images = sSpriteImageTable_85104B4, + .paletteTag = PALTAG_ARROW, + .oam = &sOamData_Arrow, + .anims = sAnims_Arrow, + .images = sPicTable_Arrow, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy, }; -// code -static void SpriteCB_ResetRtcCursor0(struct Sprite *sprite) +#define sTaskId data[0] +#define sState data[1] + +static void SpriteCB_Cursor_UpOrRight(struct Sprite *sprite) { - int state = gTasks[sprite->data[0]].data[2]; - if (state != sprite->data[1]) + int state = gTasks[sprite->sTaskId].tSelection; + if (state != sprite->sState) { - sprite->data[1] = state; + sprite->sState = state; switch (state) { - case 1: + case SELECTION_DAYS: sprite->invisible = FALSE; - sprite->animNum = 1; + sprite->animNum = ARROW_UP; sprite->animDelayCounter = 0; sprite->pos1.x = 53; sprite->pos1.y = 68; break; - case 2: + case SELECTION_HOURS: sprite->invisible = FALSE; - sprite->animNum = 1; + sprite->animNum = ARROW_UP; sprite->animDelayCounter = 0; sprite->pos1.x = 86; sprite->pos1.y = 68; break; - case 3: + case SELECTION_MINS: sprite->invisible = FALSE; - sprite->animNum = 1; + sprite->animNum = ARROW_UP; sprite->animDelayCounter = 0; sprite->pos1.x = 101; sprite->pos1.y = 68; break; - case 4: + case SELECTION_SECS: sprite->invisible = FALSE; - sprite->animNum = 1; + sprite->animNum = ARROW_UP; sprite->animDelayCounter = 0; sprite->pos1.x = 116; sprite->pos1.y = 68; break; - case 5: + case SELECTION_CONFIRM: sprite->invisible = FALSE; - sprite->animNum = 2; + sprite->animNum = ARROW_RIGHT; sprite->animDelayCounter = 0; sprite->pos1.x = 153; sprite->pos1.y = 80; break; - case 6: + case SELECTION_NONE: DestroySprite(sprite); break; } } } -static void SpriteCB_ResetRtcCursor1(struct Sprite *sprite) +static void SpriteCB_Cursor_Down(struct Sprite *sprite) { - int state = gTasks[sprite->data[0]].data[2]; - if (state != sprite->data[1]) + int state = gTasks[sprite->sTaskId].tSelection; + if (state != sprite->sState) { - sprite->data[1] = state; + sprite->sState = state; switch (state) { - case 1: + case SELECTION_DAYS: sprite->invisible = FALSE; - sprite->animNum = 0; + sprite->animNum = ARROW_DOWN; sprite->animDelayCounter = 0; sprite->pos1.x = 53; sprite->pos1.y = 92; break; - case 2: + case SELECTION_HOURS: sprite->invisible = FALSE; - sprite->animNum = 0; + sprite->animNum = ARROW_DOWN; sprite->animDelayCounter = 0; sprite->pos1.x = 86; sprite->pos1.y = 92; break; - case 3: + case SELECTION_MINS: sprite->invisible = FALSE; - sprite->animNum = 0; + sprite->animNum = ARROW_DOWN; sprite->animDelayCounter = 0; sprite->pos1.x = 101; sprite->pos1.y = 92; break; - case 4: + case SELECTION_SECS: sprite->invisible = FALSE; - sprite->animNum = 0; + sprite->animNum = ARROW_DOWN; sprite->animDelayCounter = 0; sprite->pos1.x = 116; sprite->pos1.y = 92; break; - case 5: + case SELECTION_CONFIRM: + // The up arrow is used as a right arrow when Confirm is selected + // Hide the down arrow sprite->invisible = TRUE; break; - case 6: + case SELECTION_NONE: DestroySprite(sprite); break; } @@ -271,22 +333,22 @@ static void CreateCursor(u8 taskId) { u32 spriteId; - LoadSpritePalette(&gSpritePalette_RtcArrow); + LoadSpritePalette(&gSpritePalette_Arrow); - spriteId = CreateSpriteAtEnd(&gSpriteTemplate_RtcArrow, 53, 68, 0); - gSprites[spriteId].callback = SpriteCB_ResetRtcCursor0; - gSprites[spriteId].data[0] = taskId; - gSprites[spriteId].data[1] = -1; + spriteId = CreateSpriteAtEnd(&gSpriteTemplate_Arrow, 53, 68, 0); + gSprites[spriteId].callback = SpriteCB_Cursor_UpOrRight; + gSprites[spriteId].sTaskId = taskId; + gSprites[spriteId].sState = -1; - spriteId = CreateSpriteAtEnd(&gSpriteTemplate_RtcArrow, 53, 68, 0); - gSprites[spriteId].callback = SpriteCB_ResetRtcCursor1; - gSprites[spriteId].data[0] = taskId; - gSprites[spriteId].data[1] = -1; + spriteId = CreateSpriteAtEnd(&gSpriteTemplate_Arrow, 53, 68, 0); + gSprites[spriteId].callback = SpriteCB_Cursor_Down; + gSprites[spriteId].sTaskId = taskId; + gSprites[spriteId].sState = -1; } static void FreeCursorPalette(void) { - FreeSpritePaletteByTag(gSpritePalette_RtcArrow.tag); + FreeSpritePaletteByTag(gSpritePalette_Arrow.tag); } static void HideChooseTimeWindow(u8 windowId) @@ -300,18 +362,22 @@ static void PrintTime(u8 windowId, u8 x, u8 y, u16 days, u8 hours, u8 minutes, u { u8 *dest = gStringVar4; + // Print days ConvertIntToDecimalStringN(gStringVar1, days, STR_CONV_MODE_RIGHT_ALIGN, 4); dest = StringCopy(dest, gStringVar1); dest = StringCopy(dest, gText_Day); + // Print hours ConvertIntToDecimalStringN(gStringVar1, hours, STR_CONV_MODE_RIGHT_ALIGN, 3); dest = StringCopy(dest, gStringVar1); dest = StringCopy(dest, gText_Colon3); + // Print minutes ConvertIntToDecimalStringN(gStringVar1, minutes, STR_CONV_MODE_LEADING_ZEROS, 2); dest = StringCopy(dest, gStringVar1); dest = StringCopy(dest, gText_Colon3); + // Print seconds ConvertIntToDecimalStringN(gStringVar1, seconds, STR_CONV_MODE_LEADING_ZEROS, 2); dest = StringCopy(dest, gStringVar1); @@ -360,31 +426,31 @@ static bool32 MoveTimeUpDown(s16 *val, int minVal, int maxVal, u16 keys) return TRUE; } -static void Task_ResetRtc_3(u8 taskId) +static void Task_ResetRtc_SetFinished(u8 taskId) { - gTasks[taskId].data[0] = 1; + gTasks[taskId].tFinished = TRUE; } -static void Task_ResetRtc_2(u8 taskId) +static void Task_ResetRtc_Exit(u8 taskId) { s16 *data = gTasks[taskId].data; - HideChooseTimeWindow(data[8]); + HideChooseTimeWindow(tWindowId); FreeCursorPalette(); - gTasks[taskId].func = Task_ResetRtc_3; + gTasks[taskId].func = Task_ResetRtc_SetFinished; } -static void Task_ResetRtc_1(u8 taskId) +static void Task_ResetRtc_HandleInput(u8 taskId) { s16 *data = gTasks[taskId].data; - u8 selection = data[2]; - const struct ResetRtcStruct *selectionInfo = &sUnknown_08510428[selection - 1]; + u8 selection = tSelection; + const struct ResetRtcInputMap *selectionInfo = &sInputMap[selection - 1]; if (JOY_NEW(B_BUTTON)) { - gTasks[taskId].func = Task_ResetRtc_2; - data[1] = 0; - data[2] = 6; + gTasks[taskId].func = Task_ResetRtc_Exit; + tSetTime = FALSE; + tSelection = SELECTION_NONE; PlaySE(SE_SELECT); return; } @@ -393,7 +459,7 @@ static void Task_ResetRtc_1(u8 taskId) { if (selectionInfo->right) { - data[2] = selectionInfo->right; + tSelection = selectionInfo->right; PlaySE(SE_SELECT); return; } @@ -403,47 +469,47 @@ static void Task_ResetRtc_1(u8 taskId) { if (selectionInfo->left) { - data[2] = selectionInfo->left; + tSelection = selectionInfo->left; PlaySE(SE_SELECT); return; } } - if (selection == 5) + if (selection == SELECTION_CONFIRM) { if (JOY_NEW(A_BUTTON)) { - gLocalTime.days = data[3]; - gLocalTime.hours = data[4]; - gLocalTime.minutes = data[5]; - gLocalTime.seconds = data[6]; + gLocalTime.days = tDays; + gLocalTime.hours = tHours; + gLocalTime.minutes = tMinutes; + gLocalTime.seconds = tSeconds; PlaySE(SE_SELECT); - gTasks[taskId].func = Task_ResetRtc_2; - data[1] = 1; - data[2] = 6; + gTasks[taskId].func = Task_ResetRtc_Exit; + tSetTime = TRUE; + tSelection = SELECTION_NONE; } } else if (MoveTimeUpDown(&data[selectionInfo->dataIndex], selectionInfo->minVal, selectionInfo->maxVal, JOY_REPEAT(DPAD_UP | DPAD_DOWN))) { PlaySE(SE_SELECT); - PrintTime(data[8], 0, 1, data[3], data[4], data[5], data[6]); - CopyWindowToVram(data[8], 2); + PrintTime(tWindowId, 0, 1, tDays, tHours, tMinutes, tSeconds); + CopyWindowToVram(tWindowId, 2); } } -static void Task_ResetRtc_0(u8 taskId) +static void Task_ResetRtc_Init(u8 taskId) { s16 *data = gTasks[taskId].data; - data[0] = 0; - data[3] = gLocalTime.days; - data[4] = gLocalTime.hours; - data[5] = gLocalTime.minutes; - data[6] = gLocalTime.seconds; - data[8] = AddWindow(&sUnknown_08510420); - ShowChooseTimeWindow(data[8], data[3], data[4], data[5], data[6]); + tFinished = FALSE; + tDays = gLocalTime.days; + tHours = gLocalTime.hours; + tMinutes = gLocalTime.minutes; + tSeconds = gLocalTime.seconds; + tWindowId = AddWindow(&sInputTimeWindow); + ShowChooseTimeWindow(tWindowId, tDays, tHours, tMinutes, tSeconds); CreateCursor(taskId); - data[2] = 2; - gTasks[taskId].func = Task_ResetRtc_1; + tSelection = SELECTION_HOURS; + gTasks[taskId].func = Task_ResetRtc_HandleInput; } void CB2_InitResetRtcScreen(void) @@ -451,7 +517,7 @@ void CB2_InitResetRtcScreen(void) SetGpuReg(REG_OFFSET_DISPCNT, 0); SetVBlankCallback(NULL); DmaClear16(3, PLTT, PLTT_SIZE); - DmaFillLarge16(3, 0, (u8 *)VRAM, 0x18000, 0x1000); + DmaFillLarge16(3, 0, (u8 *)VRAM, VRAM_SIZE, 0x1000); ResetOamRange(0, 128); LoadOam(); ScanlineEffect_Stop(); @@ -459,21 +525,21 @@ void CB2_InitResetRtcScreen(void) ResetSpriteData(); ResetTasks(); ResetPaletteFade(); - sub_809F048(); + InitResetRtcScreenBgAndWindows(); SetVBlankCallback(VBlankCB); SetMainCallback2(CB2_ResetRtcScreen); CreateTask(Task_ResetRtcScreen, 80); } -static void sub_809F048(void) +static void InitResetRtcScreenBgAndWindows(void) { ClearScheduledBgCopiesToVram(); ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, sBackgroundTemplates, ARRAY_COUNT(sBackgroundTemplates)); + InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates)); ScheduleBgCopyTilemapToVram(0); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); ShowBg(0); - InitWindows(sUnknown_08510408); + InitWindows(sWindowTemplates); DeactivateAllTextPrinters(); LoadMessageBoxAndBorderGfx(); } @@ -501,14 +567,17 @@ static void ShowMessage(const u8 *str) ScheduleBgCopyTilemapToVram(0); } +#define tState data[0] + static void Task_ShowResetRtcPrompt(u8 taskId) { s16 *data = gTasks[taskId].data; - switch (data[0]) + switch (tState) { case 0: DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x214, 0xE); + AddTextPrinterParameterized(0, 1, gText_PresentTime, 0, 1, TEXT_SPEED_FF, 0); PrintTime( 0, @@ -518,6 +587,7 @@ static void Task_ShowResetRtcPrompt(u8 taskId) gLocalTime.hours, gLocalTime.minutes, gLocalTime.seconds); + AddTextPrinterParameterized(0, 1, gText_PreviousTime, 0, 33, TEXT_SPEED_FF, 0); PrintTime( 0, @@ -527,18 +597,21 @@ static void Task_ShowResetRtcPrompt(u8 taskId) gSaveBlock2Ptr->lastBerryTreeUpdate.hours, gSaveBlock2Ptr->lastBerryTreeUpdate.minutes, gSaveBlock2Ptr->lastBerryTreeUpdate.seconds); + ShowMessage(gText_ResetRTCConfirmCancel); CopyWindowToVram(0, 2); ScheduleBgCopyTilemapToVram(0); - data[0]++; + tState++; case 1: if (JOY_NEW(B_BUTTON)) { + // Cancel, exit without resetting RTC DestroyTask(taskId); DoSoftReset(); } else if (JOY_NEW(A_BUTTON)) { + // Confirm PlaySE(SE_SELECT); DestroyTask(taskId); } @@ -546,53 +619,73 @@ static void Task_ShowResetRtcPrompt(u8 taskId) } } +#undef tState + +// Task states for Task_ResetRtcScreen +enum { + MAINSTATE_FADE_IN, + MAINSTATE_CHECK_SAVE, + MAINSTATE_START_SET_TIME, + MAINSTATE_WAIT_SET_TIME, + MAINSTATE_SAVE, + MAINSTATE_WAIT_EXIT, + MAINSTATE_EXIT, +}; + +#define tState data[0] +#define tSubTaskId data[1] + static void Task_ResetRtcScreen(u8 taskId) { s16 *data = gTasks[taskId].data; - switch (data[0]) + switch (tState) { - case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 1, 0x10, 0, RGB_WHITEALPHA); - data[0] = 1; + case MAINSTATE_FADE_IN: + BeginNormalPaletteFade(PALETTES_ALL, 1, 0x10, 0, RGB_WHITEALPHA); + tState = MAINSTATE_CHECK_SAVE; break; - case 1: + case MAINSTATE_CHECK_SAVE: if (!gPaletteFade.active) { - if (gSaveFileStatus == SAVE_STATUS_EMPTY || gSaveFileStatus == SAVE_STATUS_CORRUPT) + if (gSaveFileStatus == SAVE_STATUS_EMPTY + || gSaveFileStatus == SAVE_STATUS_CORRUPT) { ShowMessage(gText_NoSaveFileCantSetTime); - data[0] = 5; + tState = MAINSTATE_WAIT_EXIT; } else { RtcCalcLocalTime(); - data[1] = CreateTask(Task_ShowResetRtcPrompt, 80); - data[0] = 2; + tSubTaskId = CreateTask(Task_ShowResetRtcPrompt, 80); + tState = MAINSTATE_START_SET_TIME; } } break; - case 2: - if (gTasks[data[1]].isActive != TRUE) + case MAINSTATE_START_SET_TIME: + // Wait for A or B press on prompt first + if (gTasks[tSubTaskId].isActive != TRUE) { ClearStdWindowAndFrameToTransparent(0, FALSE); ShowMessage(gText_PleaseResetTime); gLocalTime = gSaveBlock2Ptr->lastBerryTreeUpdate; - data[1] = CreateTask(Task_ResetRtc_0, 80); - data[0] = 3; + tSubTaskId = CreateTask(Task_ResetRtc_Init, 80); + tState = MAINSTATE_WAIT_SET_TIME; } break; - case 3: - if (gTasks[data[1]].data[0]) + case MAINSTATE_WAIT_SET_TIME: + if (gTasks[tSubTaskId].tFinished) { - if (!gTasks[data[1]].data[1]) + if (!gTasks[tSubTaskId].tSetTime) { - DestroyTask(data[1]); - data[0] = 2; + // Exited without setting time, return to "Please reset time" + DestroyTask(tSubTaskId); + tState = MAINSTATE_START_SET_TIME; } else { - DestroyTask(data[1]); + // Time has been chosen, reset rtc and save + DestroyTask(tSubTaskId); RtcReset(); RtcCalcLocalTimeOffset( gLocalTime.days, @@ -603,11 +696,11 @@ static void Task_ResetRtcScreen(u8 taskId) VarSet(VAR_DAYS, gLocalTime.days); DisableResetRTC(); ShowMessage(gText_ClockHasBeenReset); - data[0] = 4; + tState = MAINSTATE_SAVE; } } break; - case 4: + case MAINSTATE_SAVE: if (TrySavingData(SAVE_NORMAL) == SAVE_STATUS_OK) { ShowMessage(gText_SaveCompleted); @@ -618,18 +711,20 @@ static void Task_ResetRtcScreen(u8 taskId) ShowMessage(gText_SaveFailed); PlaySE(SE_BOO); } - data[0] = 5; - case 5: + tState = MAINSTATE_WAIT_EXIT; + // fallthrough + case MAINSTATE_WAIT_EXIT: if (JOY_NEW(A_BUTTON)) { - BeginNormalPaletteFade(0xFFFFFFFF, 1, 0, 0x10, RGB_WHITEALPHA); - data[0] = 6; + BeginNormalPaletteFade(PALETTES_ALL, 1, 0, 0x10, RGB_WHITEALPHA); + tState = MAINSTATE_EXIT; + // fallthrough } else { break; } - case 6: + case MAINSTATE_EXIT: if (!gPaletteFade.active) { DestroyTask(taskId); diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index 4a6611b20..3d5739243 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -23,7 +23,7 @@ static void CreateBattlerSprite(u8 battlerId); static void CreateHealthboxSprite(u8 battlerId); static void sub_80A95F4(void); -void nullsub_35(void) +void ReshowBattleScreenDummy(void) { } diff --git a/src/roulette.c b/src/roulette.c index 4173edcdb..f0b484fe8 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -3389,7 +3389,7 @@ static void Task_AcceptMinBet(u8 taskId) ClearStdWindowAndFrame(0, TRUE); HideCoinsWindow(); FreeAllWindowBuffers(); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gPaletteFade.delayCounter = gPaletteFade.multipurpose2; UpdatePaletteFade(); gTasks[taskId].func = Task_FadeToRouletteGame; diff --git a/src/save.c b/src/save.c index 680f33de0..bbf4e7dbe 100644 --- a/src/save.c +++ b/src/save.c @@ -23,10 +23,6 @@ static u8 HandleWriteSector(u16 a1, const struct SaveSectionLocation *location); // Divide save blocks into individual chunks to be written to flash sectors -// Each 4 KiB flash sector contains 3968 bytes of actual data followed by a 128 byte footer -#define SECTOR_DATA_SIZE 3968 -#define SECTOR_FOOTER_SIZE 128 - /* * Sector Layout: * diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c index 50ceeb74e..facdbdc17 100644 --- a/src/save_failed_screen.c +++ b/src/save_failed_screen.c @@ -25,25 +25,25 @@ extern const u8 gText_SaveCompleteGameCannotContinue[]; extern const u8 gText_SaveCompletePressA[]; extern const u8 gText_GamePlayCannotBeContinued[]; -// gSaveFailedClockInfo enum +// sClockInfo enum enum { CLOCK_RUNNING, DEBUG_TIMER }; -// gSaveFailedWindowIds enum +// sWindowIds enum enum { TEXT_WIN_ID, CLOCK_WIN_ID }; -EWRAM_DATA u16 gSaveFailedType = {0}; -EWRAM_DATA u16 gSaveFailedClockInfo[2] = {0}; -EWRAM_DATA u8 gSaveFailedUnused1[12] = {0}; -EWRAM_DATA u8 gSaveFailedWindowIds[2] = {0}; -EWRAM_DATA u8 gSaveFailedUnused2[4] = {0}; +static EWRAM_DATA u16 sSaveFailedType = {0}; +static EWRAM_DATA u16 sClockInfo[2] = {0}; +static EWRAM_DATA u8 sUnused1[12] = {0}; +static EWRAM_DATA u8 sWindowIds[2] = {0}; +static EWRAM_DATA u8 sUnused2[4] = {0}; static const struct OamData sClockOamData = { @@ -93,20 +93,9 @@ static const struct BgTemplate sBgTemplates[3] = }, }; -static const struct WindowTemplate gUnknown_085EFD94[] = -{ - { - .bg = 255, - .tilemapLeft = 0, - .tilemapTop = 0, - .width = 0, - .height = 0, - .paletteNum = 0, - .baseBlock = 0, - } -}; +static const struct WindowTemplate sDummyWindowTemplate[] = { DUMMY_WIN_TEMPLATE }; -static const struct WindowTemplate gUnknown_085EFD9C[] = +static const struct WindowTemplate sWindowTemplate_Text[] = { { .bg = 0, @@ -119,7 +108,7 @@ static const struct WindowTemplate gUnknown_085EFD9C[] = } }; -static const struct WindowTemplate gUnknown_085EFDA4[] = +static const struct WindowTemplate sWindowTemplate_Clock[] = { { .bg = 0, @@ -157,24 +146,24 @@ static bool8 VerifySectorWipe(u16 sector); static bool8 WipeSectors(u32); // Although this is a general text printer, it's only used in this file. -static void SaveFailedScreenTextPrint(const u8 *text, u8 var1, u8 var2) +static void SaveFailedScreenTextPrint(const u8 *text, u8 x, u8 y) { u8 color[3]; - color[0] = 0; - color[1] = 15; - color[2] = 3; - AddTextPrinterParameterized4(gSaveFailedWindowIds[TEXT_WIN_ID], 1, var1 * 8, var2 * 8 + 1, 0, 0, color, 0, text); + color[0] = TEXT_COLOR_TRANSPARENT; + color[1] = TEXT_DYNAMIC_COLOR_6; + color[2] = TEXT_COLOR_LIGHT_GREY; + AddTextPrinterParameterized4(sWindowIds[TEXT_WIN_ID], 1, x * 8, y * 8 + 1, 0, 0, color, 0, text); } void DoSaveFailedScreen(u8 saveType) { SetMainCallback2(CB2_SaveFailedScreen); - gSaveFailedType = saveType; - gSaveFailedClockInfo[CLOCK_RUNNING] = FALSE; - gSaveFailedClockInfo[DEBUG_TIMER] = 0; - gSaveFailedWindowIds[TEXT_WIN_ID] = 0; - gSaveFailedWindowIds[CLOCK_WIN_ID] = 0; + sSaveFailedType = saveType; + sClockInfo[CLOCK_RUNNING] = FALSE; + sClockInfo[DEBUG_TIMER] = 0; + sWindowIds[TEXT_WIN_ID] = 0; + sWindowIds[CLOCK_WIN_ID] = 0; } static void VBlankCB(void) @@ -210,17 +199,17 @@ static void CB2_SaveFailedScreen(void) LZ77UnCompVram(gBirchHelpGfx, (void *)VRAM); LZ77UnCompVram(gBirchBagTilemap, (void *)(BG_SCREEN_ADDR(14))); LZ77UnCompVram(gBirchGrassTilemap, (void *)(BG_SCREEN_ADDR(15))); - LZ77UnCompVram(sSaveFailedClockGfx, (void *)(VRAM + 0x10020)); + LZ77UnCompVram(sSaveFailedClockGfx, (void *)(OBJ_VRAM0 + 0x20)); ResetBgsAndClearDma3BusyFlags(0); InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates)); SetBgTilemapBuffer(0, (void *)&gDecompressionBuffer[0x2000]); CpuFill32(0, &gDecompressionBuffer[0x2000], 0x800); LoadBgTiles(0, gTextWindowFrame1_Gfx, 0x120, 0x214); - InitWindows(gUnknown_085EFD94); - gSaveFailedWindowIds[TEXT_WIN_ID] = AddWindowWithoutTileMap(gUnknown_085EFD9C); - SetWindowAttribute(gSaveFailedWindowIds[TEXT_WIN_ID], 7, (u32)&gDecompressionBuffer[0x2800]); - gSaveFailedWindowIds[CLOCK_WIN_ID] = AddWindowWithoutTileMap(gUnknown_085EFDA4); - SetWindowAttribute(gSaveFailedWindowIds[CLOCK_WIN_ID], 7, (u32)&gDecompressionBuffer[0x3D00]); + InitWindows(sDummyWindowTemplate); + sWindowIds[TEXT_WIN_ID] = AddWindowWithoutTileMap(sWindowTemplate_Text); + SetWindowAttribute(sWindowIds[TEXT_WIN_ID], 7, (u32)&gDecompressionBuffer[0x2800]); + sWindowIds[CLOCK_WIN_ID] = AddWindowWithoutTileMap(sWindowTemplate_Clock); + SetWindowAttribute(sWindowIds[CLOCK_WIN_ID], 7, (u32)&gDecompressionBuffer[0x3D00]); DeactivateAllTextPrinters(); ResetSpriteData(); ResetTasks(); @@ -229,14 +218,14 @@ static void CB2_SaveFailedScreen(void) LoadPalette(sSaveFailedClockPal, 0x100, 0x20); LoadPalette(gTextWindowFrame1_Pal, 0xE0, 0x20); LoadPalette(gUnknown_0860F074, 0xF0, 0x20); - DrawStdFrameWithCustomTileAndPalette(gSaveFailedWindowIds[TEXT_WIN_ID], FALSE, 0x214, 0xE); - DrawStdFrameWithCustomTileAndPalette(gSaveFailedWindowIds[CLOCK_WIN_ID], FALSE, 0x214, 0xE); - FillWindowPixelBuffer(gSaveFailedWindowIds[CLOCK_WIN_ID], PIXEL_FILL(1)); // backwards? - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); - CopyWindowToVram(gSaveFailedWindowIds[CLOCK_WIN_ID], 2); // again? - CopyWindowToVram(gSaveFailedWindowIds[TEXT_WIN_ID], 1); + DrawStdFrameWithCustomTileAndPalette(sWindowIds[TEXT_WIN_ID], FALSE, 0x214, 0xE); + DrawStdFrameWithCustomTileAndPalette(sWindowIds[CLOCK_WIN_ID], FALSE, 0x214, 0xE); + FillWindowPixelBuffer(sWindowIds[CLOCK_WIN_ID], PIXEL_FILL(1)); // backwards? + FillWindowPixelBuffer(sWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); + CopyWindowToVram(sWindowIds[CLOCK_WIN_ID], 2); // again? + CopyWindowToVram(sWindowIds[TEXT_WIN_ID], 1); SaveFailedScreenTextPrint(gText_SaveFailedCheckingBackup, 1, 0); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); EnableInterrupts(1); SetVBlankCallback(VBlankCB); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); @@ -259,25 +248,25 @@ static void CB2_WipeSave(void) { u8 wipeTries = 0; - gSaveFailedClockInfo[CLOCK_RUNNING] = TRUE; + sClockInfo[CLOCK_RUNNING] = TRUE; while (gDamagedSaveSectors != 0 && wipeTries < 3) { - if (WipeSectors(gDamagedSaveSectors) != FALSE) + if (WipeSectors(gDamagedSaveSectors)) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); + FillWindowPixelBuffer(sWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); SaveFailedScreenTextPrint(gText_BackupMemoryDamaged, 1, 0); SetMainCallback2(CB2_GameplayCannotBeContinued); return; } - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); + FillWindowPixelBuffer(sWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); SaveFailedScreenTextPrint(gText_CheckCompleted, 1, 0); - HandleSavingData(gSaveFailedType); + HandleSavingData(sSaveFailedType); if (gDamagedSaveSectors != 0) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); + FillWindowPixelBuffer(sWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); SaveFailedScreenTextPrint(gText_SaveFailedCheckingBackup, 1, 0); } @@ -286,12 +275,12 @@ static void CB2_WipeSave(void) if (wipeTries == 3) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); + FillWindowPixelBuffer(sWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); SaveFailedScreenTextPrint(gText_BackupMemoryDamaged, 1, 0); } else { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); + FillWindowPixelBuffer(sWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); if (gGameContinueCallback == NULL) SaveFailedScreenTextPrint(gText_SaveCompleteGameCannotContinue, 1, 0); @@ -304,11 +293,11 @@ static void CB2_WipeSave(void) static void CB2_GameplayCannotBeContinued(void) { - gSaveFailedClockInfo[CLOCK_RUNNING] = FALSE; + sClockInfo[CLOCK_RUNNING] = FALSE; if (JOY_NEW(A_BUTTON)) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); + FillWindowPixelBuffer(sWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); SaveFailedScreenTextPrint(gText_GamePlayCannotBeContinued, 1, 0); SetVBlankCallback(VBlankCB); SetMainCallback2(CB2_FadeAndReturnToTitleScreen); @@ -317,11 +306,11 @@ static void CB2_GameplayCannotBeContinued(void) static void CB2_FadeAndReturnToTitleScreen(void) { - gSaveFailedClockInfo[CLOCK_RUNNING] = FALSE; + sClockInfo[CLOCK_RUNNING] = FALSE; if (JOY_NEW(A_BUTTON)) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); SetVBlankCallback(VBlankCB); SetMainCallback2(CB2_ReturnToTitleScreen); } @@ -351,7 +340,7 @@ static void VBlankCB_UpdateClockGraphics(void) gMain.oamBuffer[0].x = 112; gMain.oamBuffer[0].y = (CLOCK_WIN_TOP + 1) * 8; - if (gSaveFailedClockInfo[CLOCK_RUNNING] != FALSE) + if (sClockInfo[CLOCK_RUNNING]) { gMain.oamBuffer[0].tileNum = sClockFrames[n][0]; gMain.oamBuffer[0].matrixNum = (sClockFrames[n][2] << 4) | (sClockFrames[n][1] << 3); @@ -363,8 +352,8 @@ static void VBlankCB_UpdateClockGraphics(void) CpuFastCopy(gMain.oamBuffer, (void *)OAM, 4); - if (gSaveFailedClockInfo[DEBUG_TIMER]) - gSaveFailedClockInfo[DEBUG_TIMER]--; + if (sClockInfo[DEBUG_TIMER]) + sClockInfo[DEBUG_TIMER]--; } static bool8 VerifySectorWipe(u16 sector) @@ -372,7 +361,7 @@ static bool8 VerifySectorWipe(u16 sector) u32 *ptr = (u32 *)&gSaveDataBuffer; u16 i; - ReadFlash(sector, 0, (u8 *)ptr, 4096); + ReadFlash(sector, 0, (u8 *)ptr, SECTOR_SIZE); for (i = 0; i < 0x400; i++, ptr++) if (*ptr) @@ -388,7 +377,7 @@ static bool8 WipeSector(u16 sector) for (i = 0; failed && i < 130; i++) { - for (j = 0; j < 0x1000; j++) + for (j = 0; j < SECTOR_SIZE; j++) ProgramFlashByte(sector, j, 0); failed = VerifySectorWipe(sector); @@ -401,7 +390,7 @@ static bool8 WipeSectors(u32 sectorBits) { u16 i; - for (i = 0; i < 0x20; i++) + for (i = 0; i < SECTORS_COUNT; i++) if ((sectorBits & (1 << i)) && !WipeSector(i)) sectorBits &= ~(1 << i); diff --git a/src/scanline_effect.c b/src/scanline_effect.c index 1d5814429..dc3ca03f4 100644 --- a/src/scanline_effect.c +++ b/src/scanline_effect.c @@ -22,10 +22,10 @@ void ScanlineEffect_Stop(void) { gScanlineEffect.state = 0; DmaStop(0); - if (gScanlineEffect.waveTaskId != 0xFF) + if (gScanlineEffect.waveTaskId != TASK_NONE) { DestroyTask(gScanlineEffect.waveTaskId); - gScanlineEffect.waveTaskId = 0xFF; + gScanlineEffect.waveTaskId = TASK_NONE; } } @@ -40,7 +40,7 @@ void ScanlineEffect_Clear(void) gScanlineEffect.state = 0; gScanlineEffect.unused16 = 0; gScanlineEffect.unused17 = 0; - gScanlineEffect.waveTaskId = 0xFF; + gScanlineEffect.waveTaskId = TASK_NONE; } void ScanlineEffect_SetParams(struct ScanlineEffectParams params) @@ -132,7 +132,7 @@ static void TaskFunc_UpdateWavePerFrame(u8 taskId) if (sShouldStopWaveTask) { DestroyTask(taskId); - gScanlineEffect.waveTaskId = 0xFF; + gScanlineEffect.waveTaskId = TASK_NONE; } else { diff --git a/src/scrcmd.c b/src/scrcmd.c index d0e7e4d51..67b9fdf69 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -53,8 +53,8 @@ typedef u16 (*SpecialFunc)(void); typedef void (*NativeFunc)(void); -EWRAM_DATA const u8 *gUnknown_020375C0 = NULL; -static EWRAM_DATA u32 gUnknown_020375C4 = 0; +EWRAM_DATA const u8 *gRamScriptRetAddr = NULL; +static EWRAM_DATA u32 sAddressOffset = 0; // For relative addressing in vgoto etc., used by saved scripts (e.g. Mystery Event) static EWRAM_DATA u16 sPauseCounter = 0; static EWRAM_DATA u16 sMovingNpcId = 0; static EWRAM_DATA u16 sMovingNpcMapBank = 0; @@ -193,7 +193,7 @@ bool8 ScrCmd_setvaddress(struct ScriptContext *ctx) u32 addr1 = (u32)ctx->scriptPtr - 1; u32 addr2 = ScriptReadWord(ctx); - gUnknown_020375C4 = addr2 - addr1; + sAddressOffset = addr2 - addr1; return FALSE; } @@ -201,7 +201,7 @@ bool8 ScrCmd_vgoto(struct ScriptContext *ctx) { u32 addr = ScriptReadWord(ctx); - ScriptJump(ctx, (u8 *)(addr - gUnknown_020375C4)); + ScriptJump(ctx, (u8 *)(addr - sAddressOffset)); return FALSE; } @@ -209,14 +209,14 @@ bool8 ScrCmd_vcall(struct ScriptContext *ctx) { u32 addr = ScriptReadWord(ctx); - ScriptCall(ctx, (u8 *)(addr - gUnknown_020375C4)); + ScriptCall(ctx, (u8 *)(addr - sAddressOffset)); return FALSE; } bool8 ScrCmd_vgoto_if(struct ScriptContext *ctx) { u8 condition = ScriptReadByte(ctx); - const u8 *ptr = (const u8 *)(ScriptReadWord(ctx) - gUnknown_020375C4); + const u8 *ptr = (const u8 *)(ScriptReadWord(ctx) - sAddressOffset); if (sScriptConditionTable[condition][ctx->comparisonResult] == 1) ScriptJump(ctx, ptr); @@ -226,7 +226,7 @@ bool8 ScrCmd_vgoto_if(struct ScriptContext *ctx) bool8 ScrCmd_vcall_if(struct ScriptContext *ctx) { u8 condition = ScriptReadByte(ctx); - const u8 *ptr = (const u8 *)(ScriptReadWord(ctx) - gUnknown_020375C4); + const u8 *ptr = (const u8 *)(ScriptReadWord(ctx) - sAddressOffset); if (sScriptConditionTable[condition][ctx->comparisonResult] == 1) ScriptCall(ctx, ptr); @@ -283,7 +283,7 @@ bool8 ScrCmd_callstd_if(struct ScriptContext *ctx) bool8 ScrCmd_returnram(struct ScriptContext *ctx) { - ScriptJump(ctx, gUnknown_020375C0); + ScriptJump(ctx, gRamScriptRetAddr); return FALSE; } @@ -379,32 +379,30 @@ bool8 ScrCmd_setorcopyvar(struct ScriptContext *ctx) return FALSE; } -u8 compare_012(u16 a1, u16 a2) +u8 Compare(u16 a, u16 b) { - if (a1 < a2) + if (a < b) return 0; - if (a1 == a2) + if (a == b) return 1; return 2; } -// comparelocaltolocal bool8 ScrCmd_compare_local_to_local(struct ScriptContext *ctx) { const u8 value1 = ctx->data[ScriptReadByte(ctx)]; const u8 value2 = ctx->data[ScriptReadByte(ctx)]; - ctx->comparisonResult = compare_012(value1, value2); + ctx->comparisonResult = Compare(value1, value2); return FALSE; } -// comparelocaltoimm bool8 ScrCmd_compare_local_to_value(struct ScriptContext *ctx) { const u8 value1 = ctx->data[ScriptReadByte(ctx)]; const u8 value2 = ScriptReadByte(ctx); - ctx->comparisonResult = compare_012(value1, value2); + ctx->comparisonResult = Compare(value1, value2); return FALSE; } @@ -413,7 +411,7 @@ bool8 ScrCmd_compare_local_to_addr(struct ScriptContext *ctx) const u8 value1 = ctx->data[ScriptReadByte(ctx)]; const u8 value2 = *(const u8 *)ScriptReadWord(ctx); - ctx->comparisonResult = compare_012(value1, value2); + ctx->comparisonResult = Compare(value1, value2); return FALSE; } @@ -422,7 +420,7 @@ bool8 ScrCmd_compare_addr_to_local(struct ScriptContext *ctx) const u8 value1 = *(const u8 *)ScriptReadWord(ctx); const u8 value2 = ctx->data[ScriptReadByte(ctx)]; - ctx->comparisonResult = compare_012(value1, value2); + ctx->comparisonResult = Compare(value1, value2); return FALSE; } @@ -431,7 +429,7 @@ bool8 ScrCmd_compare_addr_to_value(struct ScriptContext *ctx) const u8 value1 = *(const u8 *)ScriptReadWord(ctx); const u8 value2 = ScriptReadByte(ctx); - ctx->comparisonResult = compare_012(value1, value2); + ctx->comparisonResult = Compare(value1, value2); return FALSE; } @@ -440,7 +438,7 @@ bool8 ScrCmd_compare_addr_to_addr(struct ScriptContext *ctx) const u8 value1 = *(const u8 *)ScriptReadWord(ctx); const u8 value2 = *(const u8 *)ScriptReadWord(ctx); - ctx->comparisonResult = compare_012(value1, value2); + ctx->comparisonResult = Compare(value1, value2); return FALSE; } @@ -449,7 +447,7 @@ bool8 ScrCmd_compare_var_to_value(struct ScriptContext *ctx) const u16 value1 = *GetVarPointer(ScriptReadHalfword(ctx)); const u16 value2 = ScriptReadHalfword(ctx); - ctx->comparisonResult = compare_012(value1, value2); + ctx->comparisonResult = Compare(value1, value2); return FALSE; } @@ -458,7 +456,7 @@ bool8 ScrCmd_compare_var_to_var(struct ScriptContext *ctx) const u16 *ptr1 = GetVarPointer(ScriptReadHalfword(ctx)); const u16 *ptr2 = GetVarPointer(ScriptReadHalfword(ctx)); - ctx->comparisonResult = compare_012(*ptr1, *ptr2); + ctx->comparisonResult = Compare(*ptr1, *ptr2); return FALSE; } @@ -1121,7 +1119,7 @@ bool8 ScrCmd_showobject_at(struct ScriptContext *ctx) u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); - npc_by_local_id_and_map_set_field_1_bit_x20(localId, mapNum, mapGroup, 0); + SetObjectInvisibility(localId, mapNum, mapGroup, FALSE); return FALSE; } @@ -1131,7 +1129,7 @@ bool8 ScrCmd_hideobject_at(struct ScriptContext *ctx) u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); - npc_by_local_id_and_map_set_field_1_bit_x20(localId, mapNum, mapGroup, 1); + SetObjectInvisibility(localId, mapNum, mapGroup, TRUE); return FALSE; } @@ -1142,7 +1140,7 @@ bool8 ScrCmd_setobjectpriority(struct ScriptContext *ctx) u8 mapNum = ScriptReadByte(ctx); u8 priority = ScriptReadByte(ctx); - sub_808E78C(localId, mapNum, mapGroup, priority + 83); + SetObjectPriority(localId, mapNum, mapGroup, priority + 83); return FALSE; } @@ -1152,7 +1150,7 @@ bool8 ScrCmd_resetobjectpriority(struct ScriptContext *ctx) u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); - sub_808E7E4(localId, mapNum, mapGroup); + ResetObjectPriority(localId, mapNum, mapGroup); return FALSE; } @@ -1215,7 +1213,7 @@ bool8 ScrCmd_lockall(struct ScriptContext *ctx) else { ScriptFreezeObjectEvents(); - SetupNativeScript(ctx, sub_80983C4); + SetupNativeScript(ctx, IsFreezePlayerFinished); return TRUE; } } @@ -1231,12 +1229,12 @@ bool8 ScrCmd_lock(struct ScriptContext *ctx) if (gObjectEvents[gSelectedObjectEvent].active) { LockSelectedObjectEvent(); - SetupNativeScript(ctx, sub_809847C); + SetupNativeScript(ctx, IsFreezeSelectedObjectAndPlayerFinished); } else { ScriptFreezeObjectEvents(); - SetupNativeScript(ctx, sub_80983C4); + SetupNativeScript(ctx, IsFreezePlayerFinished); } return TRUE; } @@ -1300,7 +1298,8 @@ bool8 ScrCmd_messageautoscroll(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdDB(struct ScriptContext *ctx) +// Prints all at once. Skips waiting for player input. Only used by link contests +bool8 ScrCmd_messageinstant(struct ScriptContext *ctx) { const u8 *msg = (const u8 *)ScriptReadWord(ctx); @@ -1490,27 +1489,30 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx) u8 xWindow, yWindow, xText, yText; u8 temp; + // + 6 for the 6 bytes at the start of a braille message (brailleformat macro) + // In RS these bytes are used to position the text and window, but + // in Emerald they are unused and position is calculated below instead StringExpandPlaceholders(gStringVar4, ptr + 6); width = GetStringWidth(6, gStringVar4, -1) / 8u; - if (width > 0x1C) - width = 0x1C; + if (width > 28) + width = 28; - for (i = 0, height = 4; gStringVar4[i] != 0xFF;) + for (i = 0, height = 4; gStringVar4[i] != EOS;) { - if (gStringVar4[i++] == 0xFE) + if (gStringVar4[i++] == CHAR_NEWLINE) height += 3; } - if (height > 0x12) - height = 0x12; + if (height > 18) + height = 18; temp = width + 2; - xWindow = (0x1E - temp) / 2; + xWindow = (30 - temp) / 2; temp = height + 2; - yText = (0x14 - temp) / 2; + yText = (20 - temp) / 2; xText = xWindow; xWindow += 1; @@ -1540,9 +1542,9 @@ bool8 ScrCmd_closebraillemessage(struct ScriptContext *ctx) bool8 ScrCmd_vmessage(struct ScriptContext *ctx) { - u32 v1 = ScriptReadWord(ctx); + u32 msg = ScriptReadWord(ctx); - ShowFieldMessage((u8 *)(v1 - gUnknown_020375C4)); + ShowFieldMessage((u8 *)(msg - sAddressOffset)); return FALSE; } @@ -1652,7 +1654,7 @@ bool8 ScrCmd_bufferstring(struct ScriptContext *ctx) bool8 ScrCmd_vloadword(struct ScriptContext *ctx) { - const u8 *ptr = (u8 *)(ScriptReadWord(ctx) - gUnknown_020375C4); + const u8 *ptr = (u8 *)(ScriptReadWord(ctx) - sAddressOffset); StringExpandPlaceholders(gStringVar4, ptr); return FALSE; @@ -1663,7 +1665,7 @@ bool8 ScrCmd_vbufferstring(struct ScriptContext *ctx) u8 stringVarIndex = ScriptReadByte(ctx); u32 addr = ScriptReadWord(ctx); - const u8 *src = (u8 *)(addr - gUnknown_020375C4); + const u8 *src = (u8 *)(addr - sAddressOffset); u8 *dest = sScriptStringVars[stringVarIndex]; StringCopy(dest, src); return FALSE; @@ -1923,6 +1925,7 @@ bool8 ScrCmd_pokemartdecoration(struct ScriptContext *ctx) return TRUE; } +// Changes clerk dialogue slightly from above. See MART_TYPE_DECOR2 bool8 ScrCmd_pokemartdecoration2(struct ScriptContext *ctx) { const void *ptr = (void *)ScriptReadWord(ctx); @@ -2127,6 +2130,7 @@ bool8 ScrCmd_setdoorclosed(struct ScriptContext *ctx) return FALSE; } +// Below two are functions for elevators in RS, do nothing in Emerald bool8 ScrCmd_addelevmenuitem(struct ScriptContext *ctx) { u8 v3 = ScriptReadByte(ctx); @@ -2158,9 +2162,9 @@ bool8 ScrCmd_addcoins(struct ScriptContext *ctx) u16 coins = VarGet(ScriptReadHalfword(ctx)); if (AddCoins(coins) == TRUE) - gSpecialVar_Result = 0; + gSpecialVar_Result = FALSE; else - gSpecialVar_Result = 1; + gSpecialVar_Result = TRUE; return FALSE; } @@ -2169,9 +2173,9 @@ bool8 ScrCmd_removecoins(struct ScriptContext *ctx) u16 coins = VarGet(ScriptReadHalfword(ctx)); if (RemoveCoins(coins) == TRUE) - gSpecialVar_Result = 0; + gSpecialVar_Result = FALSE; else - gSpecialVar_Result = 1; + gSpecialVar_Result = TRUE; return FALSE; } @@ -2203,13 +2207,13 @@ bool8 ScrCmd_freerotatingtilepuzzle(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdD8(struct ScriptContext *ctx) +bool8 ScrCmd_selectapproachingtrainer(struct ScriptContext *ctx) { gSelectedObjectEvent = GetCurrentApproachingTrainerObjectEventId(); return FALSE; } -bool8 ScrCmd_cmdD9(struct ScriptContext *ctx) +bool8 ScrCmd_lockfortrainer(struct ScriptContext *ctx) { if (IsUpdateLinkStateCBActive()) { @@ -2219,28 +2223,28 @@ bool8 ScrCmd_cmdD9(struct ScriptContext *ctx) { if (gObjectEvents[gSelectedObjectEvent].active) { - sub_8098630(); - SetupNativeScript(ctx, sub_8098734); + FreezeForApproachingTrainers(); + SetupNativeScript(ctx, IsFreezeObjectAndPlayerFinished); } return TRUE; } } -// This command will force the Pokémon to be obedient, you don't get to make it disobedient. -bool8 ScrCmd_setmonobedient(struct ScriptContext *ctx) +// This command will set a Pokémon's eventLegal bit; there is no similar command to clear it. +bool8 ScrCmd_setmoneventlegal(struct ScriptContext *ctx) { - bool8 obedient = TRUE; + bool8 isEventLegal = TRUE; u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); - SetMonData(&gPlayerParty[partyIndex], MON_DATA_OBEDIENCE, &obedient); + SetMonData(&gPlayerParty[partyIndex], MON_DATA_EVENT_LEGAL, &isEventLegal); return FALSE; } -bool8 ScrCmd_checkmonobedience(struct ScriptContext *ctx) +bool8 ScrCmd_checkmoneventlegal(struct ScriptContext *ctx) { u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); - gSpecialVar_Result = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OBEDIENCE, NULL); + gSpecialVar_Result = GetMonData(&gPlayerParty[partyIndex], MON_DATA_EVENT_LEGAL, NULL); return FALSE; } @@ -2248,12 +2252,12 @@ bool8 ScrCmd_checkmonobedience(struct ScriptContext *ctx) // See GetSavedRamScriptIfValid, which is NULL if ValidateReceivedWonderCard returns FALSE bool8 ScrCmd_gotoram(struct ScriptContext *ctx) { - const u8* v1 = GetSavedRamScriptIfValid(); + const u8* script = GetSavedRamScriptIfValid(); - if (v1) + if (script) { - gUnknown_020375C0 = ctx->scriptPtr; - ScriptJump(ctx, v1); + gRamScriptRetAddr = ctx->scriptPtr; + ScriptJump(ctx, script); } return FALSE; } diff --git a/src/script.c b/src/script.c index e6557aa75..726c06543 100644 --- a/src/script.c +++ b/src/script.c @@ -7,9 +7,14 @@ #define RAM_SCRIPT_MAGIC 51 -extern const u8* gUnknown_020375C0; +enum { + SCRIPT_MODE_STOPPED, + SCRIPT_MODE_BYTECODE, + SCRIPT_MODE_NATIVE, +}; + +extern const u8* gRamScriptRetAddr; -// ewram bss static u8 sScriptContext1Status; static struct ScriptContext sScriptContext1; static struct ScriptContext sScriptContext2; @@ -23,57 +28,60 @@ void InitScriptContext(struct ScriptContext *ctx, void *cmdTable, void *cmdTable { s32 i; - ctx->mode = 0; - ctx->scriptPtr = 0; + ctx->mode = SCRIPT_MODE_STOPPED; + ctx->scriptPtr = NULL; ctx->stackDepth = 0; - ctx->nativePtr = 0; + ctx->nativePtr = NULL; ctx->cmdTable = cmdTable; ctx->cmdTableEnd = cmdTableEnd; - for (i = 0; i < 4; i++) + for (i = 0; i < (int)ARRAY_COUNT(ctx->data); i++) ctx->data[i] = 0; - for (i = 0; i < 20; i++) - ctx->stack[i] = 0; + for (i = 0; i < (int)ARRAY_COUNT(ctx->stack); i++) + ctx->stack[i] = NULL; } u8 SetupBytecodeScript(struct ScriptContext *ctx, const u8 *ptr) { ctx->scriptPtr = ptr; - ctx->mode = 1; + ctx->mode = SCRIPT_MODE_BYTECODE; return 1; } void SetupNativeScript(struct ScriptContext *ctx, bool8 (*ptr)(void)) { - ctx->mode = 2; + ctx->mode = SCRIPT_MODE_NATIVE; ctx->nativePtr = ptr; } void StopScript(struct ScriptContext *ctx) { - ctx->mode = 0; - ctx->scriptPtr = 0; + ctx->mode = SCRIPT_MODE_STOPPED; + ctx->scriptPtr = NULL; } bool8 RunScriptCommand(struct ScriptContext *ctx) { - if (ctx->mode == 0) + if (ctx->mode == SCRIPT_MODE_STOPPED) return FALSE; switch (ctx->mode) { - case 0: + case SCRIPT_MODE_STOPPED: return FALSE; - case 2: + case SCRIPT_MODE_NATIVE: + // Try to call a function in C + // Continue to bytecode if no function or it returns TRUE if (ctx->nativePtr) { if (ctx->nativePtr() == TRUE) - ctx->mode = 1; + ctx->mode = SCRIPT_MODE_BYTECODE; return TRUE; } - ctx->mode = 1; - case 1: + ctx->mode = SCRIPT_MODE_BYTECODE; + // fallthrough + case SCRIPT_MODE_BYTECODE: while (1) { u8 cmdCode; @@ -81,7 +89,7 @@ bool8 RunScriptCommand(struct ScriptContext *ctx) if (!ctx->scriptPtr) { - ctx->mode = 0; + ctx->mode = SCRIPT_MODE_STOPPED; return FALSE; } @@ -97,11 +105,11 @@ bool8 RunScriptCommand(struct ScriptContext *ctx) if (func >= ctx->cmdTableEnd) { - ctx->mode = 0; + ctx->mode = SCRIPT_MODE_STOPPED; return FALSE; } - if ((*func)(ctx) == 1) + if ((*func)(ctx) == TRUE) return TRUE; } } @@ -109,21 +117,21 @@ bool8 RunScriptCommand(struct ScriptContext *ctx) return TRUE; } -u8 ScriptPush(struct ScriptContext *ctx, const u8 *ptr) +static bool8 ScriptPush(struct ScriptContext *ctx, const u8 *ptr) { - if (ctx->stackDepth + 1 >= 20) + if (ctx->stackDepth + 1 >= (int)ARRAY_COUNT(ctx->stack)) { - return 1; + return TRUE; } else { ctx->stack[ctx->stackDepth] = ptr; ctx->stackDepth++; - return 0; + return FALSE; } } -const u8 *ScriptPop(struct ScriptContext *ctx) +static const u8 *ScriptPop(struct ScriptContext *ctx) { if (ctx->stackDepth == 0) return NULL; @@ -196,10 +204,10 @@ void ScriptContext1_Init(void) bool8 ScriptContext2_RunScript(void) { if (sScriptContext1Status == 2) - return 0; + return FALSE; if (sScriptContext1Status == 1) - return 0; + return FALSE; ScriptContext2_Enable(); @@ -207,10 +215,10 @@ bool8 ScriptContext2_RunScript(void) { sScriptContext1Status = 2; ScriptContext2_Disable(); - return 0; + return FALSE; } - return 1; + return TRUE; } void ScriptContext1_SetupScript(const u8 *ptr) @@ -234,7 +242,7 @@ void EnableBothScriptContexts(void) void ScriptContext2_RunNewScript(const u8 *ptr) { - InitScriptContext(&sScriptContext2, &gScriptCmdTable, &gScriptCmdTableEnd); + InitScriptContext(&sScriptContext2, gScriptCmdTable, gScriptCmdTableEnd); SetupBytecodeScript(&sScriptContext2, ptr); while (RunScriptCommand(&sScriptContext2) == TRUE); } @@ -253,7 +261,7 @@ u8 *MapHeaderGetScriptTable(u8 tag) if (*mapScripts == tag) { mapScripts++; - return (u8 *)(mapScripts[0] + (mapScripts[1] << 8) + (mapScripts[2] << 16) + (mapScripts[3] << 24)); + return T2_READ_PTR(mapScripts); } mapScripts += 5; } @@ -277,14 +285,20 @@ u8 *MapHeaderCheckScriptTable(u8 tag) { u16 varIndex1; u16 varIndex2; - varIndex1 = ptr[0] | (ptr[1] << 8); + + // Read first var (or .2byte terminal value) + varIndex1 = T1_READ_16(ptr); if (!varIndex1) - return NULL; + return NULL; // Reached end of table ptr += 2; - varIndex2 = ptr[0] | (ptr[1] << 8); + + // Read second var + varIndex2 = T1_READ_16(ptr); ptr += 2; + + // Run map script if vars are equal if (VarGet(varIndex1) == VarGet(varIndex2)) - return (u8 *)(ptr[0] + (ptr[1] << 8) + (ptr[2] << 16) + (ptr[3] << 24)); + return T2_READ_PTR(ptr); ptr += 4; } } @@ -363,7 +377,7 @@ bool8 InitRamScript(const u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 const u8 *GetRamScript(u8 objectId, const u8 *script) { struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data; - gUnknown_020375C0 = NULL; + gRamScriptRetAddr = NULL; if (scriptData->magic != RAM_SCRIPT_MAGIC) return script; if (scriptData->mapGroup != gSaveBlock1Ptr->location.mapGroup) @@ -379,7 +393,7 @@ const u8 *GetRamScript(u8 objectId, const u8 *script) } else { - gUnknown_020375C0 = script; + gRamScriptRetAddr = script; return scriptData->script; } } diff --git a/src/script_menu.c b/src/script_menu.c index 425cdc251..51c37b5b6 100644 --- a/src/script_menu.c +++ b/src/script_menu.c @@ -580,7 +580,7 @@ bool8 ScriptMenu_ShowPokemonPic(u16 species, u8 x, u8 y) u8 taskId; u8 spriteId; - if (FindTaskIdByFunc(Task_PokemonPicWindow) != 0xFF) + if (FindTaskIdByFunc(Task_PokemonPicWindow) != TASK_NONE) { return FALSE; } @@ -604,7 +604,7 @@ bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void) { u8 taskId = FindTaskIdByFunc(Task_PokemonPicWindow); - if (taskId == 0xFF) + if (taskId == TASK_NONE) return NULL; gTasks[taskId].tState++; return IsPicboxClosed; @@ -612,7 +612,7 @@ bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void) static bool8 IsPicboxClosed(void) { - if (FindTaskIdByFunc(Task_PokemonPicWindow) == 0xFF) + if (FindTaskIdByFunc(Task_PokemonPicWindow) == TASK_NONE) return TRUE; else return FALSE; diff --git a/src/script_movement.c b/src/script_movement.c index 4eb305980..013270697 100644 --- a/src/script_movement.c +++ b/src/script_movement.c @@ -52,7 +52,7 @@ void ScriptMovement_UnfreezeObjectEvents(void) u8 taskId; taskId = GetMoveObjectsTaskId(); - if (taskId != 0xFF) + if (taskId != TASK_NONE) { ScriptMovement_UnfreezeActiveObjects(taskId); DestroyTask(taskId); diff --git a/src/secret_base.c b/src/secret_base.c index d49eef277..ddc051dca 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -49,6 +49,13 @@ #include "constants/trainers.h" #include "constants/tv.h" +// Values for registryStatus +enum { + UNREGISTERED, + REGISTERED, + NEW, // Temporary, so new secret bases mixed at the same time don't overwrite each other +}; + struct SecretBaseRegistryMenu { struct ListMenuItem items[11]; @@ -72,21 +79,21 @@ static EWRAM_DATA u8 sCurSecretBaseId = 0; static EWRAM_DATA bool8 sInFriendSecretBase = FALSE; static EWRAM_DATA struct SecretBaseRegistryMenu *sRegistryMenu = NULL; -static void Task_ShowSecretBaseRegistryMenu(u8 taskId); -static void BuildRegistryMenuItems(u8 taskId); -static void RegistryMenu_OnCursorMove(s32 unused, bool8 flag, struct ListMenu *menu); -static void FinalizeRegistryMenu(u8 taskId); -static void AddRegistryMenuScrollArrows(u8 taskId); -static void HandleRegistryMenuInput(u8 taskId); -static void ShowRegistryMenuActions(u8 taskId); -static void HandleRegistryMenuActionsInput(u8 taskId); -static void ShowRegistryMenuDeleteConfirmation(u8 taskId); -static void ShowRegistryMenuDeleteYesNo(u8 taskId); -static void DeleteRegistry_Yes(u8 taskId); -static void DeleteRegistry_No(u8 taskId); -static void ReturnToMainRegistryMenu(u8 taskId); -static void GoToSecretBasePCRegisterMenu(u8 taskId); -static u8 GetSecretBaseOwnerType(u8 secretBaseId); +static void Task_ShowSecretBaseRegistryMenu(u8); +static void BuildRegistryMenuItems(u8); +static void RegistryMenu_OnCursorMove(s32, bool8, struct ListMenu *); +static void FinalizeRegistryMenu(u8); +static void AddRegistryMenuScrollArrows(u8); +static void HandleRegistryMenuInput(u8); +static void ShowRegistryMenuActions(u8); +static void HandleRegistryMenuActionsInput(u8); +static void ShowRegistryMenuDeleteConfirmation(u8); +static void ShowRegistryMenuDeleteYesNo(u8); +static void DeleteRegistry_Yes(u8); +static void DeleteRegistry_No(u8); +static void ReturnToMainRegistryMenu(u8); +static void GoToSecretBasePCRegisterMenu(u8); +static u8 GetSecretBaseOwnerType(u8); static const struct SecretBaseEntranceMetatiles sSecretBaseEntranceMetatiles[] = { @@ -101,34 +108,39 @@ static const struct SecretBaseEntranceMetatiles sSecretBaseEntranceMetatiles[] = // mapNum, warpId, x, y // x, y positions are for when the player warps in for the first time (in front of the computer) -static const u8 sSecretBaseEntrancePositions[] = +static const u8 sSecretBaseEntrancePositions[NUM_SECRET_BASE_GROUPS * 4] = { - MAP_NUM(SECRET_BASE_RED_CAVE1), 0, 1, 3, - MAP_NUM(SECRET_BASE_RED_CAVE2), 0, 5, 9, - MAP_NUM(SECRET_BASE_RED_CAVE3), 0, 1, 3, - MAP_NUM(SECRET_BASE_RED_CAVE4), 0, 7, 13, - MAP_NUM(SECRET_BASE_BROWN_CAVE1), 0, 2, 3, - MAP_NUM(SECRET_BASE_BROWN_CAVE2), 0, 9, 2, - MAP_NUM(SECRET_BASE_BROWN_CAVE3), 0, 13, 4, - MAP_NUM(SECRET_BASE_BROWN_CAVE4), 0, 1, 2, - MAP_NUM(SECRET_BASE_BLUE_CAVE1), 0, 1, 3, - MAP_NUM(SECRET_BASE_BLUE_CAVE2), 0, 1, 2, - MAP_NUM(SECRET_BASE_BLUE_CAVE3), 0, 3, 15, - MAP_NUM(SECRET_BASE_BLUE_CAVE4), 0, 3, 14, - MAP_NUM(SECRET_BASE_YELLOW_CAVE1), 0, 9, 3, - MAP_NUM(SECRET_BASE_YELLOW_CAVE2), 0, 8, 7, - MAP_NUM(SECRET_BASE_YELLOW_CAVE3), 0, 3, 6, - MAP_NUM(SECRET_BASE_YELLOW_CAVE4), 0, 5, 9, - MAP_NUM(SECRET_BASE_TREE1), 0, 2, 3, - MAP_NUM(SECRET_BASE_TREE2), 0, 5, 6, - MAP_NUM(SECRET_BASE_TREE3), 0, 15, 3, - MAP_NUM(SECRET_BASE_TREE4), 0, 4, 10, - MAP_NUM(SECRET_BASE_SHRUB1), 0, 3, 3, - MAP_NUM(SECRET_BASE_SHRUB2), 0, 1, 2, - MAP_NUM(SECRET_BASE_SHRUB3), 0, 7, 8, - MAP_NUM(SECRET_BASE_SHRUB4), 0, 9, 6, + [SECRET_BASE_RED_CAVE1] = MAP_NUM(SECRET_BASE_RED_CAVE1), 0, 1, 3, + [SECRET_BASE_RED_CAVE2] = MAP_NUM(SECRET_BASE_RED_CAVE2), 0, 5, 9, + [SECRET_BASE_RED_CAVE3] = MAP_NUM(SECRET_BASE_RED_CAVE3), 0, 1, 3, + [SECRET_BASE_RED_CAVE4] = MAP_NUM(SECRET_BASE_RED_CAVE4), 0, 7, 13, + [SECRET_BASE_BROWN_CAVE1] = MAP_NUM(SECRET_BASE_BROWN_CAVE1), 0, 2, 3, + [SECRET_BASE_BROWN_CAVE2] = MAP_NUM(SECRET_BASE_BROWN_CAVE2), 0, 9, 2, + [SECRET_BASE_BROWN_CAVE3] = MAP_NUM(SECRET_BASE_BROWN_CAVE3), 0, 13, 4, + [SECRET_BASE_BROWN_CAVE4] = MAP_NUM(SECRET_BASE_BROWN_CAVE4), 0, 1, 2, + [SECRET_BASE_BLUE_CAVE1] = MAP_NUM(SECRET_BASE_BLUE_CAVE1), 0, 1, 3, + [SECRET_BASE_BLUE_CAVE2] = MAP_NUM(SECRET_BASE_BLUE_CAVE2), 0, 1, 2, + [SECRET_BASE_BLUE_CAVE3] = MAP_NUM(SECRET_BASE_BLUE_CAVE3), 0, 3, 15, + [SECRET_BASE_BLUE_CAVE4] = MAP_NUM(SECRET_BASE_BLUE_CAVE4), 0, 3, 14, + [SECRET_BASE_YELLOW_CAVE1] = MAP_NUM(SECRET_BASE_YELLOW_CAVE1), 0, 9, 3, + [SECRET_BASE_YELLOW_CAVE2] = MAP_NUM(SECRET_BASE_YELLOW_CAVE2), 0, 8, 7, + [SECRET_BASE_YELLOW_CAVE3] = MAP_NUM(SECRET_BASE_YELLOW_CAVE3), 0, 3, 6, + [SECRET_BASE_YELLOW_CAVE4] = MAP_NUM(SECRET_BASE_YELLOW_CAVE4), 0, 5, 9, + [SECRET_BASE_TREE1] = MAP_NUM(SECRET_BASE_TREE1), 0, 2, 3, + [SECRET_BASE_TREE2] = MAP_NUM(SECRET_BASE_TREE2), 0, 5, 6, + [SECRET_BASE_TREE3] = MAP_NUM(SECRET_BASE_TREE3), 0, 15, 3, + [SECRET_BASE_TREE4] = MAP_NUM(SECRET_BASE_TREE4), 0, 4, 10, + [SECRET_BASE_SHRUB1] = MAP_NUM(SECRET_BASE_SHRUB1), 0, 3, 3, + [SECRET_BASE_SHRUB2] = MAP_NUM(SECRET_BASE_SHRUB2), 0, 1, 2, + [SECRET_BASE_SHRUB3] = MAP_NUM(SECRET_BASE_SHRUB3), 0, 7, 8, + [SECRET_BASE_SHRUB4] = MAP_NUM(SECRET_BASE_SHRUB4), 0, 9, 6, }; +#define GET_BASE_MAP_NUM(group) (sSecretBaseEntrancePositions[(group) + 0]) +#define GET_BASE_WARP_ID(group) (sSecretBaseEntrancePositions[(group) + 1]) +#define GET_BASE_COMPUTER_X(group) (sSecretBaseEntrancePositions[(group) + 2]) +#define GET_BASE_COMPUTER_Y(group) (sSecretBaseEntrancePositions[(group) + 3]) + static const struct MenuAction sRegistryMenuActions[] = { { @@ -314,6 +326,8 @@ void ToggleSecretBaseEntranceMetatile(void) GetXYCoordsOneStepInFrontOfPlayer(&x, &y); metatileId = MapGridGetMetatileIdAt(x, y); + + // Look for entrance metatiles to open for (i = 0; i < ARRAY_COUNT(sSecretBaseEntranceMetatiles); i++) { if (sSecretBaseEntranceMetatiles[i].closedMetatileId == metatileId) @@ -324,6 +338,7 @@ void ToggleSecretBaseEntranceMetatile(void) } } + // Look for entrance metatiles to close for (i = 0; i < ARRAY_COUNT(sSecretBaseEntranceMetatiles); i++) { if (sSecretBaseEntranceMetatiles[i].openMetatileId == metatileId) @@ -362,6 +377,7 @@ void SetPlayerSecretBase(void) VarSet(VAR_SECRET_BASE_MAP, gMapHeader.regionMapSectionId); } +// Set the 'open' entrance metatile for any occupied secret base on this map void SetOccupiedSecretBaseEntranceMetatiles(struct MapEvents const *events) { u16 bgId; @@ -395,24 +411,26 @@ void SetOccupiedSecretBaseEntranceMetatiles(struct MapEvents const *events) static void SetSecretBaseWarpDestination(void) { - s8 offset = (sCurSecretBaseId / 10) * 4; - SetWarpDestinationToMapWarp(MAP_GROUP(SECRET_BASE_RED_CAVE1), sSecretBaseEntrancePositions[offset], sSecretBaseEntrancePositions[offset + 1]); + s8 secretBaseGroup = SECRET_BASE_ID_TO_GROUP(sCurSecretBaseId); + SetWarpDestinationToMapWarp(MAP_GROUP(SECRET_BASE_RED_CAVE1), GET_BASE_MAP_NUM(secretBaseGroup), GET_BASE_WARP_ID(secretBaseGroup)); } +#define tState data[0] + static void Task_EnterSecretBase(u8 taskId) { - u16 secretBaseId; + u16 secretBaseIdx; - switch (gTasks[taskId].data[0]) + switch (gTasks[taskId].tState) { case 0: if (!gPaletteFade.active) - gTasks[taskId].data[0] = 1; + gTasks[taskId].tState = 1; break; case 1: - secretBaseId = VarGet(VAR_CURRENT_SECRET_BASE); - if (gSaveBlock1Ptr->secretBases[secretBaseId].numTimesEntered < 255) - gSaveBlock1Ptr->secretBases[secretBaseId].numTimesEntered++; + secretBaseIdx = VarGet(VAR_CURRENT_SECRET_BASE); + if (gSaveBlock1Ptr->secretBases[secretBaseIdx].numTimesEntered < 255) + gSaveBlock1Ptr->secretBases[secretBaseIdx].numTimesEntered++; SetSecretBaseWarpDestination(); WarpIntoMap(); @@ -423,6 +441,8 @@ static void Task_EnterSecretBase(u8 taskId) } } +#undef tState + void EnterSecretBase(void) { CreateTask(Task_EnterSecretBase, 0); @@ -467,13 +487,13 @@ static void Task_EnterNewlyCreatedSecretBase(u8 taskId) { if (!gPaletteFade.active) { - s8 offset = sCurSecretBaseId / 10 * 4; + s8 secretBaseGroup = SECRET_BASE_ID_TO_GROUP(sCurSecretBaseId); SetWarpDestination( gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, - sSecretBaseEntrancePositions[offset + 2], - sSecretBaseEntrancePositions[offset + 3]); + GET_BASE_COMPUTER_X(secretBaseGroup), + GET_BASE_COMPUTER_Y(secretBaseGroup)); WarpIntoMap(); gFieldCallback = EnterNewlyCreatedSecretBase_StartFadeIn; SetMainCallback2(CB2_LoadMap); @@ -498,23 +518,23 @@ bool8 CurMapIsSecretBase(void) void InitSecretBaseAppearance(bool8 hidePC) { - u16 secretBaseId; + u16 secretBaseIdx; u16 x, y; u8 *decorations; u8 *decorPos; if (CurMapIsSecretBase()) { - secretBaseId = VarGet(VAR_CURRENT_SECRET_BASE); - decorations = gSaveBlock1Ptr->secretBases[secretBaseId].decorations; - decorPos = gSaveBlock1Ptr->secretBases[secretBaseId].decorationPositions; + secretBaseIdx = VarGet(VAR_CURRENT_SECRET_BASE); + decorations = gSaveBlock1Ptr->secretBases[secretBaseIdx].decorations; + decorPos = gSaveBlock1Ptr->secretBases[secretBaseIdx].decorationPositions; for (x = 0; x < DECOR_MAX_SECRET_BASE; x++) { if (decorations[x] > 0 && decorations[x] <= NUM_DECORATIONS && gDecorations[decorations[x]].permission != DECORPERM_SPRITE) ShowDecorationOnMap((decorPos[x] >> 4) + 7, (decorPos[x] & 0xF) + 7, decorations[x]); } - if (secretBaseId != 0) + if (secretBaseIdx != 0) { // Another player's secret base. Change PC type to the "Register" PC. FindMetatileIdMapCoords(&x, &y, METATILE_SecretBase_PC); @@ -549,9 +569,9 @@ void InitSecretBaseDecorationSprites(void) } else { - u16 secretBaseId = VarGet(VAR_CURRENT_SECRET_BASE); - decorations = gSaveBlock1Ptr->secretBases[secretBaseId].decorations; - decorationPositions = gSaveBlock1Ptr->secretBases[secretBaseId].decorationPositions; + u16 secretBaseIdx = VarGet(VAR_CURRENT_SECRET_BASE); + decorations = gSaveBlock1Ptr->secretBases[secretBaseIdx].decorations; + decorationPositions = gSaveBlock1Ptr->secretBases[secretBaseIdx].decorationPositions; numDecorations = DECOR_MAX_SECRET_BASE; } @@ -703,10 +723,10 @@ void IsCurSecretBaseOwnedByAnotherPlayer(void) gSpecialVar_Result = FALSE; } -static u8 *GetSecretBaseName(u8 *dest, u8 secretBaseId) +static u8 *GetSecretBaseName(u8 *dest, u8 secretBaseIdx) { - *StringCopyN(dest, gSaveBlock1Ptr->secretBases[secretBaseId].trainerName, GetNameLength(gSaveBlock1Ptr->secretBases[secretBaseId].trainerName)) = EOS; - ConvertInternationalString(dest, gSaveBlock1Ptr->secretBases[secretBaseId].language); + *StringCopyN(dest, gSaveBlock1Ptr->secretBases[secretBaseIdx].trainerName, GetNameLength(gSaveBlock1Ptr->secretBases[secretBaseIdx].trainerName)) = EOS; + ConvertInternationalString(dest, gSaveBlock1Ptr->secretBases[secretBaseIdx].language); return StringAppend(dest, gText_ApostropheSBase); } @@ -717,18 +737,18 @@ u8 *GetSecretBaseMapName(u8 *dest) void CopyCurSecretBaseOwnerName_StrVar1(void) { - u8 secretBaseId; + u8 secretBaseIdx; const u8 *name; - secretBaseId = VarGet(VAR_CURRENT_SECRET_BASE); - name = gSaveBlock1Ptr->secretBases[secretBaseId].trainerName; + secretBaseIdx = VarGet(VAR_CURRENT_SECRET_BASE); + name = gSaveBlock1Ptr->secretBases[secretBaseIdx].trainerName; *StringCopyN(gStringVar1, name, GetNameLength(name)) = EOS; - ConvertInternationalString(gStringVar1, gSaveBlock1Ptr->secretBases[secretBaseId].language); + ConvertInternationalString(gStringVar1, gSaveBlock1Ptr->secretBases[secretBaseIdx].language); } -static bool8 IsSecretBaseRegistered(u8 secretBaseId) +static bool8 IsSecretBaseRegistered(u8 secretBaseIdx) { - if (gSaveBlock1Ptr->secretBases[secretBaseId].registryStatus) + if (gSaveBlock1Ptr->secretBases[secretBaseIdx].registryStatus) return TRUE; return FALSE; @@ -812,7 +832,7 @@ static void ClosePlayerSecretBaseEntrance(void) && gSaveBlock1Ptr->secretBases[0].secretBaseId == events->bgEvents[i].bgUnion.secretBaseId) { metatileId = MapGridGetMetatileIdAt(events->bgEvents[i].x + 7, events->bgEvents[i].y + 7); - for (j = 0; j < 7; j++) + for (j = 0; j < ARRAY_COUNT(sSecretBaseEntranceMetatiles); j++) { if (sSecretBaseEntranceMetatiles[j].openMetatileId == metatileId) { @@ -879,18 +899,28 @@ void ShowSecretBaseRegistryMenu(void) CreateTask(Task_ShowSecretBaseRegistryMenu, 0); } +#define tNumBases data[0] +#define tSelectedRow data[1] +#define tScrollOffset data[2] +#define tMaxShownItems data[3] +#define tSelectedBaseId data[4] +#define tListTaskId data[5] +#define tMainWindowId data[6] +#define tActionWindowId data[7] +#define tArrowTaskId data[8] + static void Task_ShowSecretBaseRegistryMenu(u8 taskId) { s16 *data = gTasks[taskId].data; ScriptContext2_Enable(); - data[0] = GetNumRegisteredSecretBases(); - if (data[0] != 0) + tNumBases = GetNumRegisteredSecretBases(); + if (tNumBases != 0) { - data[1] = 0; - data[2] = 0; + tSelectedRow = 0; + tScrollOffset = 0; ClearDialogWindowAndFrame(0, 0); sRegistryMenu = calloc(1, sizeof(*sRegistryMenu)); - data[6] = AddWindow(&sRegistryWindowTemplates[0]); + tMainWindowId = AddWindow(&sRegistryWindowTemplates[0]); BuildRegistryMenuItems(taskId); FinalizeRegistryMenu(taskId); gTasks[taskId].func = HandleRegistryMenuInput; @@ -922,17 +952,17 @@ static void BuildRegistryMenuItems(u8 taskId) sRegistryMenu->items[count].name = gText_Cancel; sRegistryMenu->items[count].id = -2; - data[0] = count + 1; - if (data[0] < 8) - data[3] = data[0]; + tNumBases = count + 1; + if (tNumBases < 8) + tMaxShownItems = tNumBases; else - data[3] = 8; + tMaxShownItems = 8; gMultiuseListMenuTemplate = sRegistryListMenuTemplate; - gMultiuseListMenuTemplate.windowId = data[6]; - gMultiuseListMenuTemplate.totalItems = data[0]; + gMultiuseListMenuTemplate.windowId = tMainWindowId; + gMultiuseListMenuTemplate.totalItems = tNumBases; gMultiuseListMenuTemplate.items = sRegistryMenu->items; - gMultiuseListMenuTemplate.maxShowed = data[3]; + gMultiuseListMenuTemplate.maxShowed = tMaxShownItems; } static void RegistryMenu_OnCursorMove(s32 unused, bool8 flag, struct ListMenu *menu) @@ -944,8 +974,8 @@ static void RegistryMenu_OnCursorMove(s32 unused, bool8 flag, struct ListMenu *m static void FinalizeRegistryMenu(u8 taskId) { s16 *data = gTasks[taskId].data; - SetStandardWindowBorderStyle(data[6], 0); - data[5] = ListMenuInit(&gMultiuseListMenuTemplate, data[2], data[1]); + SetStandardWindowBorderStyle(tMainWindowId, 0); + tListTaskId = ListMenuInit(&gMultiuseListMenuTemplate, tScrollOffset, tSelectedRow); AddRegistryMenuScrollArrows(taskId); ScheduleBgCopyTilemapToVram(0); } @@ -953,35 +983,33 @@ static void FinalizeRegistryMenu(u8 taskId) static void AddRegistryMenuScrollArrows(u8 taskId) { s16 *data = gTasks[taskId].data; - data[8] = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 0xbc, 0x0c, 0x94, data[0] - data[3], 0x13f8, 0x13f8, &data[2]); + tArrowTaskId = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 188, 12, 148, tNumBases - tMaxShownItems, 0x13f8, 0x13f8, &tScrollOffset); } static void HandleRegistryMenuInput(u8 taskId) { - s16 *data; - s32 input; + s16 *data = gTasks[taskId].data; + s32 input = ListMenu_ProcessInput(tListTaskId); + ListMenuGetScrollAndRow(tListTaskId, &tScrollOffset, &tSelectedRow); - data = gTasks[taskId].data; - input = ListMenu_ProcessInput(data[5]); - ListMenuGetScrollAndRow(data[5], &data[2], &data[1]); switch (input) { case LIST_NOTHING_CHOSEN: break; case LIST_CANCEL: PlaySE(SE_SELECT); - DestroyListMenuTask(data[5], NULL, NULL); - RemoveScrollIndicatorArrowPair(data[8]); - ClearStdWindowAndFrame(data[6], 0); - ClearWindowTilemap(data[6]); - RemoveWindow(data[6]); + DestroyListMenuTask(tListTaskId, NULL, NULL); + RemoveScrollIndicatorArrowPair(tArrowTaskId); + ClearStdWindowAndFrame(tMainWindowId, 0); + ClearWindowTilemap(tMainWindowId); + RemoveWindow(tMainWindowId); ScheduleBgCopyTilemapToVram(0); free(sRegistryMenu); GoToSecretBasePCRegisterMenu(taskId); break; default: PlaySE(SE_SELECT); - data[4] = input; + tSelectedBaseId = input; ShowRegistryMenuActions(taskId); break; } @@ -991,13 +1019,13 @@ static void ShowRegistryMenuActions(u8 taskId) { struct WindowTemplate template; s16 *data = gTasks[taskId].data; - RemoveScrollIndicatorArrowPair(data[8]); + RemoveScrollIndicatorArrowPair(tArrowTaskId); template = sRegistryWindowTemplates[1]; template.width = GetMaxWidthInMenuTable(sRegistryMenuActions, 2); - data[7] = AddWindow(&template); - SetStandardWindowBorderStyle(data[7], 0); - PrintMenuTable(data[7], ARRAY_COUNT(sRegistryMenuActions), sRegistryMenuActions); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[7], 2, 0); + tActionWindowId = AddWindow(&template); + SetStandardWindowBorderStyle(tActionWindowId, 0); + PrintMenuTable(tActionWindowId, ARRAY_COUNT(sRegistryMenuActions), sRegistryMenuActions); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(tActionWindowId, 2, 0); ScheduleBgCopyTilemapToVram(0); gTasks[taskId].func = HandleRegistryMenuActionsInput; } @@ -1023,13 +1051,13 @@ static void HandleRegistryMenuActionsInput(u8 taskId) static void ShowRegistryMenuDeleteConfirmation(u8 taskId) { s16 *data = gTasks[taskId].data; - ClearStdWindowAndFrame(data[6], FALSE); - ClearStdWindowAndFrame(data[7], FALSE); - ClearWindowTilemap(data[6]); - ClearWindowTilemap(data[7]); - RemoveWindow(data[7]); + ClearStdWindowAndFrame(tMainWindowId, FALSE); + ClearStdWindowAndFrame(tActionWindowId, FALSE); + ClearWindowTilemap(tMainWindowId); + ClearWindowTilemap(tActionWindowId); + RemoveWindow(tActionWindowId); ScheduleBgCopyTilemapToVram(0); - GetSecretBaseName(gStringVar1, data[4]); + GetSecretBaseName(gStringVar1, tSelectedBaseId); StringExpandPlaceholders(gStringVar4, gText_OkayToDeleteFromRegistry); DisplayItemMessageOnField(taskId, gStringVar4, ShowRegistryMenuDeleteYesNo); } @@ -1044,10 +1072,10 @@ void DeleteRegistry_Yes_Callback(u8 taskId) { s16 *data = gTasks[taskId].data; ClearDialogWindowAndFrame(0, 0); - DestroyListMenuTask(data[5], &data[2], &data[1]); - gSaveBlock1Ptr->secretBases[data[4]].registryStatus = 0; + DestroyListMenuTask(tListTaskId, &tScrollOffset, &tSelectedRow); + gSaveBlock1Ptr->secretBases[tSelectedBaseId].registryStatus = UNREGISTERED; BuildRegistryMenuItems(taskId); - sub_812225C(&data[2], &data[1], data[3], data[0]); + sub_812225C(&tScrollOffset, &tSelectedRow, tMaxShownItems, tNumBases); FinalizeRegistryMenu(taskId); gTasks[taskId].func = HandleRegistryMenuInput; } @@ -1061,7 +1089,7 @@ static void DeleteRegistry_No(u8 taskId) { s16 *data = gTasks[taskId].data; ClearDialogWindowAndFrame(0, 0); - DestroyListMenuTask(data[5], &data[2], &data[1]); + DestroyListMenuTask(tListTaskId, &tScrollOffset, &tSelectedRow); FinalizeRegistryMenu(taskId); gTasks[taskId].func = HandleRegistryMenuInput; } @@ -1070,9 +1098,9 @@ static void ReturnToMainRegistryMenu(u8 taskId) { s16 *data = gTasks[taskId].data; AddRegistryMenuScrollArrows(taskId); - ClearStdWindowAndFrame(data[7], 0); - ClearWindowTilemap(data[7]); - RemoveWindow(data[7]); + ClearStdWindowAndFrame(tActionWindowId, 0); + ClearWindowTilemap(tActionWindowId); + RemoveWindow(tActionWindowId); ScheduleBgCopyTilemapToVram(0); gTasks[taskId].func = HandleRegistryMenuInput; } @@ -1087,10 +1115,20 @@ static void GoToSecretBasePCRegisterMenu(u8 taskId) DestroyTask(taskId); } -static u8 GetSecretBaseOwnerType(u8 secretBaseId) +#undef tNumBases +#undef tSelectedRow +#undef tScrollOffset +#undef tMaxShownItems +#undef tSelectedBaseId +#undef tListTaskId +#undef tMainWindowId +#undef tActionWindowId +#undef tArrowTaskId + +static u8 GetSecretBaseOwnerType(u8 secretBaseIdx) { - return (gSaveBlock1Ptr->secretBases[secretBaseId].trainerId[0] % 5) - + (gSaveBlock1Ptr->secretBases[secretBaseId].gender * 5); + return (gSaveBlock1Ptr->secretBases[secretBaseIdx].trainerId[0] % 5) + + (gSaveBlock1Ptr->secretBases[secretBaseIdx].gender * 5); } const u8 *GetSecretBaseTrainerLoseText(void) @@ -1132,10 +1170,10 @@ void SetBattledOwnerFromResult(void) void GetSecretBaseOwnerAndState(void) { - u16 secretBaseId; + u16 secretBaseIdx; u8 i; - secretBaseId = VarGet(VAR_CURRENT_SECRET_BASE); + secretBaseIdx = VarGet(VAR_CURRENT_SECRET_BASE); if (!FlagGet(FLAG_DAILY_SECRET_BASE)) { for (i = 0; i < SECRET_BASES_COUNT; i++) @@ -1143,10 +1181,16 @@ void GetSecretBaseOwnerAndState(void) FlagSet(FLAG_DAILY_SECRET_BASE); } - gSpecialVar_0x8004 = GetSecretBaseOwnerType(secretBaseId); - gSpecialVar_Result = gSaveBlock1Ptr->secretBases[secretBaseId].battledOwnerToday; + gSpecialVar_0x8004 = GetSecretBaseOwnerType(secretBaseIdx); + gSpecialVar_Result = gSaveBlock1Ptr->secretBases[secretBaseIdx].battledOwnerToday; } +#define tStepCb data[0] // See Task_RunPerStepCallback +#define tState data[1] +#define tPlayerX data[2] +#define tPlayerY data[3] +#define tFldEff data[4] + void SecretBasePerStepCallback(u8 taskId) { s16 x; @@ -1156,23 +1200,23 @@ void SecretBasePerStepCallback(u8 taskId) s16 *data; data = gTasks[taskId].data; - switch (data[1]) + switch (tState) { case 0: - if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) + if (VarGet(VAR_CURRENT_SECRET_BASE)) sInFriendSecretBase = TRUE; else sInFriendSecretBase = FALSE; - PlayerGetDestCoords(&data[2], &data[3]); - data[1] = 1; + PlayerGetDestCoords(&tPlayerX, &tPlayerY); + tState = 1; break; case 1: PlayerGetDestCoords(&x, &y); - if (x != data[2] || y != data[3]) + if (x != tPlayerX || y != tPlayerY) { - data[2] = x; - data[3] = y; + tPlayerX = x; + tPlayerY = y; VarSet(VAR_SECRET_BASE_STEP_COUNTER, VarGet(VAR_SECRET_BASE_STEP_COUNTER) + 1); behavior = MapGridGetMetatileBehaviorAt(x, y); tileId = MapGridGetMetatileIdAt(x, y); @@ -1273,33 +1317,40 @@ void SecretBasePerStepCallback(u8 taskId) } break; case 2: - if (!FieldEffectActiveListContains(data[4])) - data[1] = 1; + // This state is never reached, and tFldEff is never set + if (!FieldEffectActiveListContains(tFldEff)) + tState = 1; break; } } -static void SetSecretBaseDataAndLanguage(u8 secretBaseId, struct SecretBase *secretBase, u32 version, u32 language) +#undef tStepCb +#undef tState +#undef tPlayerX +#undef tPlayerY +#undef tFldEff + +static void SaveSecretBase(u8 secretBaseIdx, struct SecretBase *secretBase, u32 version, u32 language) { int stringLength; u8 *name; - gSaveBlock1Ptr->secretBases[secretBaseId] = *secretBase; - gSaveBlock1Ptr->secretBases[secretBaseId].registryStatus = 2; + gSaveBlock1Ptr->secretBases[secretBaseIdx] = *secretBase; + gSaveBlock1Ptr->secretBases[secretBaseIdx].registryStatus = NEW; if (version == VERSION_SAPPHIRE || version == VERSION_RUBY) - gSaveBlock1Ptr->secretBases[secretBaseId].language = LANGUAGE_ENGLISH; + gSaveBlock1Ptr->secretBases[secretBaseIdx].language = GAME_LANGUAGE; if (version == VERSION_EMERALD && language == LANGUAGE_JAPANESE) { - name = gSaveBlock1Ptr->secretBases[secretBaseId].trainerName; - for (stringLength = 0; stringLength < 7; stringLength++) + name = gSaveBlock1Ptr->secretBases[secretBaseIdx].trainerName; + for (stringLength = 0; stringLength < PLAYER_NAME_LENGTH; stringLength++) { if (name[stringLength] == EOS) break; } if (stringLength > 5) - gSaveBlock1Ptr->secretBases[secretBaseId].language = LANGUAGE_ENGLISH; + gSaveBlock1Ptr->secretBases[secretBaseIdx].language = GAME_LANGUAGE; } } @@ -1363,56 +1414,67 @@ static u8 FindAvailableSecretBaseIndex(void) return 0; } -static u8 sub_80EAA18(void) +static u8 FindUnregisteredSecretBaseIndex(void) { s16 i; for (i = 1; i < SECRET_BASES_COUNT; i++) { - if (gSaveBlock1Ptr->secretBases[i].registryStatus == 0 && gSaveBlock1Ptr->secretBases[i].sbr_field_1_0 == 0) + if (gSaveBlock1Ptr->secretBases[i].registryStatus == UNREGISTERED && gSaveBlock1Ptr->secretBases[i].toRegister == FALSE) return i; } return 0; } -static u8 sub_80EAA64(struct SecretBase *secretBase, u32 version, u32 language) +static u8 TrySaveFriendsSecretBase(struct SecretBase *secretBase, u32 version, u32 language) { s16 index; + // Secret base has no location if (!secretBase->secretBaseId) return 0; index = GetSecretBaseIndexFromId(secretBase->secretBaseId); if (index != 0) { + // An existing secret base is using this location if (index != -1) { - if (gSaveBlock1Ptr->secretBases[index].sbr_field_1_0 == 1) + if (gSaveBlock1Ptr->secretBases[index].toRegister == TRUE) return 0; - if (gSaveBlock1Ptr->secretBases[index].registryStatus != 2 || secretBase->sbr_field_1_0 == 1) + if (gSaveBlock1Ptr->secretBases[index].registryStatus != NEW || secretBase->toRegister == TRUE) { - SetSecretBaseDataAndLanguage(index, secretBase, version, language); + // Overwrite unregistered base at this location + SaveSecretBase(index, secretBase, version, language); return index; } } + // No secret base is using this location, find a spot to save it else { index = FindAvailableSecretBaseIndex(); if (index != 0) { - SetSecretBaseDataAndLanguage(index, secretBase, version, language); + // Save in empty space + SaveSecretBase(index, secretBase, version, language); return index; } - index = sub_80EAA18(); + index = FindUnregisteredSecretBaseIndex(); if (index != 0) { - SetSecretBaseDataAndLanguage(index, secretBase, version, language); + // Overwrite unregistered base + SaveSecretBase(index, secretBase, version, language); return index; } } } + + // Unable to save. Either... + // - This was the player's base + // - A registered base exists at this location + // - The secret base limit has been filled with registered bases return 0; } @@ -1425,11 +1487,12 @@ static void SortSecretBasesByRegistryStatus(void) struct SecretBase *secretBases; secretBases = gSaveBlock1Ptr->secretBases; - for (i = 1; i < 19; i++) + for (i = 1; i < SECRET_BASES_COUNT - 1; i++) { for (j = i + 1; j < SECRET_BASES_COUNT; j++) { - if ((secretBases[i].registryStatus == 0 && secretBases[j].registryStatus == 1) || (secretBases[i].registryStatus == 2 && secretBases[j].registryStatus != 2)) + if ((secretBases[i].registryStatus == UNREGISTERED && secretBases[j].registryStatus == REGISTERED) + || (secretBases[i].registryStatus == NEW && secretBases[j].registryStatus != NEW)) { struct SecretBase temp; SWAP(secretBases[i], secretBases[j], temp) @@ -1438,17 +1501,19 @@ static void SortSecretBasesByRegistryStatus(void) } } -void sub_80EABA4(struct SecretBaseRecordMixer *mixer, u8 registryStatus) +// Used to save a record mixing friends' bases other than their own +// registryStatus is so registered bases can be attempted first +static void TrySaveFriendsSecretBases(struct SecretBaseRecordMixer *mixer, u8 registryStatus) { u16 i; for (i = 1; i < SECRET_BASES_COUNT; i++) { if (mixer->secretBases[i].registryStatus == registryStatus) - sub_80EAA64(&mixer->secretBases[i], mixer->version, mixer->language); + TrySaveFriendsSecretBase(&mixer->secretBases[i], mixer->version, mixer->language); } } -bool8 SecretBaseBelongsToPlayer(struct SecretBase *secretBase) +static bool8 SecretBaseBelongsToPlayer(struct SecretBase *secretBase) { u8 i; @@ -1478,7 +1543,7 @@ bool8 SecretBaseBelongsToPlayer(struct SecretBase *secretBase) #define DELETED_BASE_B (1 << 1) #define DELETED_BASE_C (1 << 2) -void DeleteFirstOldBaseFromPlayerInRecordMixingFriendsRecords(struct SecretBase *basesA, struct SecretBase *basesB, struct SecretBase *basesC) +static void DeleteFirstOldBaseFromPlayerInRecordMixingFriendsRecords(struct SecretBase *basesA, struct SecretBase *basesB, struct SecretBase *basesC) { u8 i; u8 sbFlags = 0; @@ -1524,7 +1589,7 @@ void DeleteFirstOldBaseFromPlayerInRecordMixingFriendsRecords(struct SecretBase #undef DELETED_BASE_C // returns TRUE if secretBase was deleted, FALSE otherwise -static bool8 ClearDuplicateOwnedSecretBases(struct SecretBase *secretBase, struct SecretBase *secretBases, u8 c) +static bool8 ClearDuplicateOwnedSecretBase(struct SecretBase *secretBase, struct SecretBase *secretBases, u8 idx) { u8 i; @@ -1534,7 +1599,7 @@ static bool8 ClearDuplicateOwnedSecretBases(struct SecretBase *secretBase, struc { if (SecretBasesBelongToSamePlayer(secretBase, &secretBases[i]) == TRUE) { - if (c == 0) + if (idx == 0) { ClearSecretBase(&secretBases[i]); return FALSE; @@ -1546,7 +1611,7 @@ static bool8 ClearDuplicateOwnedSecretBases(struct SecretBase *secretBase, struc return FALSE; } - secretBases[i].sbr_field_1_0 = secretBase->sbr_field_1_0; + secretBases[i].toRegister = secretBase->toRegister; ClearSecretBase(secretBase); return TRUE; } @@ -1556,87 +1621,97 @@ static bool8 ClearDuplicateOwnedSecretBases(struct SecretBase *secretBase, struc return FALSE; } -void sub_80EAD94(struct SecretBase *basesA, struct SecretBase *basesB, struct SecretBase *basesC, struct SecretBase *basesD) +static void ClearDuplicateOwnedSecretBases(struct SecretBase *playersBases, struct SecretBase *friendsBasesA, struct SecretBase *friendsBasesB, struct SecretBase *friendsBasesC) { u8 i; for (i = 1; i < SECRET_BASES_COUNT; i++) { - if (basesA[i].secretBaseId) + if (playersBases[i].secretBaseId) { - if (basesA[i].registryStatus == 1) + if (playersBases[i].registryStatus == REGISTERED) { - basesA[i].sbr_field_1_0 = 1; + // Mark registered bases, so if they're deleted as a duplicate they + // will be re-registered later + playersBases[i].toRegister = TRUE; } - if (!ClearDuplicateOwnedSecretBases(&basesA[i], basesB, i)) + if (!ClearDuplicateOwnedSecretBase(&playersBases[i], friendsBasesA, i)) { - if (!ClearDuplicateOwnedSecretBases(&basesA[i], basesC, i)) + if (!ClearDuplicateOwnedSecretBase(&playersBases[i], friendsBasesB, i)) { - ClearDuplicateOwnedSecretBases(&basesA[i], basesD, i); + ClearDuplicateOwnedSecretBase(&playersBases[i], friendsBasesC, i); } } } } for (i = 0; i < SECRET_BASES_COUNT; i++) { - if (basesB[i].secretBaseId) + if (friendsBasesA[i].secretBaseId) { - basesB[i].battledOwnerToday = 0; - if (!ClearDuplicateOwnedSecretBases(&basesB[i], basesC, i)) + friendsBasesA[i].battledOwnerToday = 0; + if (!ClearDuplicateOwnedSecretBase(&friendsBasesA[i], friendsBasesB, i)) { - ClearDuplicateOwnedSecretBases(&basesB[i], basesD, i); + ClearDuplicateOwnedSecretBase(&friendsBasesA[i], friendsBasesC, i); } } } for (i = 0; i < SECRET_BASES_COUNT; i++) { - if (basesC[i].secretBaseId) + if (friendsBasesB[i].secretBaseId) { - basesC[i].battledOwnerToday = 0; - ClearDuplicateOwnedSecretBases(&basesC[i], basesD, i); + friendsBasesB[i].battledOwnerToday = 0; + ClearDuplicateOwnedSecretBase(&friendsBasesB[i], friendsBasesC, i); } - if (basesD[i].secretBaseId) + if (friendsBasesC[i].secretBaseId) { - basesD[i].battledOwnerToday = 0; + friendsBasesC[i].battledOwnerToday = 0; } } } -void sub_80EAE90(struct SecretBase *base, u32 version, u32 language) +static void TrySaveRegisteredDuplicate(struct SecretBase *base, u32 version, u32 language) { - if (base->sbr_field_1_0 == 1) + if (base->toRegister == TRUE) { - sub_80EAA64(base, version, language); + TrySaveFriendsSecretBase(base, version, language); ClearSecretBase(base); } } -void sub_80EAEB4(struct SecretBaseRecordMixer *mixers) +static void TrySaveRegisteredDuplicates(struct SecretBaseRecordMixer *mixers) { u16 i; for (i = 0; i < SECRET_BASES_COUNT; i++) { - sub_80EAE90(&mixers[0].secretBases[i], mixers[0].version, mixers[0].language); - sub_80EAE90(&mixers[1].secretBases[i], mixers[1].version, mixers[1].language); - sub_80EAE90(&mixers[2].secretBases[i], mixers[2].version, mixers[2].language); + TrySaveRegisteredDuplicate(&mixers[0].secretBases[i], mixers[0].version, mixers[0].language); + TrySaveRegisteredDuplicate(&mixers[1].secretBases[i], mixers[1].version, mixers[1].language); + TrySaveRegisteredDuplicate(&mixers[2].secretBases[i], mixers[2].version, mixers[2].language); } } -void sub_80EAEF4(struct SecretBaseRecordMixer *mixers) +static void SaveRecordMixBases(struct SecretBaseRecordMixer *mixers) { DeleteFirstOldBaseFromPlayerInRecordMixingFriendsRecords(mixers[0].secretBases, mixers[1].secretBases, mixers[2].secretBases); - sub_80EAD94(gSaveBlock1Ptr->secretBases, mixers[0].secretBases, mixers[1].secretBases, mixers[2].secretBases); - sub_80EAEB4(mixers); - sub_80EAA64(mixers[0].secretBases, mixers[0].version, mixers[0].language); - sub_80EAA64(mixers[1].secretBases, mixers[1].version, mixers[1].language); - sub_80EAA64(mixers[2].secretBases, mixers[2].version, mixers[2].language); - sub_80EABA4(&mixers[0], 1); - sub_80EABA4(&mixers[1], 1); - sub_80EABA4(&mixers[2], 1); - sub_80EABA4(&mixers[0], 0); - sub_80EABA4(&mixers[1], 0); - sub_80EABA4(&mixers[2], 0); + ClearDuplicateOwnedSecretBases(gSaveBlock1Ptr->secretBases, mixers[0].secretBases, mixers[1].secretBases, mixers[2].secretBases); + + // First, save any registered secret bases that were deleted as duplicates + TrySaveRegisteredDuplicates(mixers); + + // Then try to save the record mixing friends' own bases + TrySaveFriendsSecretBase(mixers[0].secretBases, mixers[0].version, mixers[0].language); + TrySaveFriendsSecretBase(mixers[1].secretBases, mixers[1].version, mixers[1].language); + TrySaveFriendsSecretBase(mixers[2].secretBases, mixers[2].version, mixers[2].language); + + // Then try to save as many of their registered bases as possible + TrySaveFriendsSecretBases(&mixers[0], REGISTERED); + TrySaveFriendsSecretBases(&mixers[1], REGISTERED); + TrySaveFriendsSecretBases(&mixers[2], REGISTERED); + + // Lastly save as many of their unregistered bases as possible + TrySaveFriendsSecretBases(&mixers[0], UNREGISTERED); + TrySaveFriendsSecretBases(&mixers[1], UNREGISTERED); + TrySaveFriendsSecretBases(&mixers[2], UNREGISTERED); } #define INIT_SECRET_BASE_RECORD_MIXER(linkId1, linkId2, linkId3) \ @@ -1684,23 +1759,25 @@ void ReceiveSecretBasesData(void *secretBases, size_t recordSize, u8 linkIdx) break; } - sub_80EAEF4(mixers); + SaveRecordMixBases(mixers); + for (i = 1; i < SECRET_BASES_COUNT; i++) { - if (gSaveBlock1Ptr->secretBases[i].sbr_field_1_0 == 1) + // In the process of deleting duplicate bases, if a base the player has registered is deleted it is + // flagged with the temporary toRegister flag, so it can be re-registered after it has been newly saved + if (gSaveBlock1Ptr->secretBases[i].toRegister == TRUE) { - gSaveBlock1Ptr->secretBases[i].registryStatus = 1; - gSaveBlock1Ptr->secretBases[i].sbr_field_1_0 = 0; + gSaveBlock1Ptr->secretBases[i].registryStatus = REGISTERED; + gSaveBlock1Ptr->secretBases[i].toRegister = FALSE; } } SortSecretBasesByRegistryStatus(); for (i = 1; i < SECRET_BASES_COUNT; i++) { - if (gSaveBlock1Ptr->secretBases[i].registryStatus == 2) - { - gSaveBlock1Ptr->secretBases[i].registryStatus = 0; - } + // Unmark "new" bases, they've been saved now and are no longer important + if (gSaveBlock1Ptr->secretBases[i].registryStatus == NEW) + gSaveBlock1Ptr->secretBases[i].registryStatus = UNREGISTERED; } if (gSaveBlock1Ptr->secretBases[0].secretBaseId != 0 diff --git a/src/shop.c b/src/shop.c index a447982fc..26bd964c5 100755 --- a/src/shop.c +++ b/src/shop.c @@ -448,9 +448,9 @@ static void CB2_InitBuyMenu(void) ResetTasks(); ClearScheduledBgCopiesToVram(); gShopDataPtr = AllocZeroed(sizeof(struct ShopData)); - gShopDataPtr->scrollIndicatorsTaskId = 0xFF; - gShopDataPtr->itemSpriteIds[0] = 0xFF; - gShopDataPtr->itemSpriteIds[1] = 0xFF; + gShopDataPtr->scrollIndicatorsTaskId = TASK_NONE; + gShopDataPtr->itemSpriteIds[0] = SPRITE_NONE; + gShopDataPtr->itemSpriteIds[1] = SPRITE_NONE; BuyMenuBuildListMenuTemplate(); BuyMenuInitBgs(); FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); @@ -470,8 +470,8 @@ static void CB2_InitBuyMenu(void) BuyMenuAddScrollIndicatorArrows(); taskId = CreateTask(Task_BuyMenu, 8); gTasks[taskId].tListTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0); - BlendPalettes(0xFFFFFFFF, 0x10, RGB_BLACK); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BlendPalettes(PALETTES_ALL, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); SetVBlankCallback(VBlankCB_BuyMenu); SetMainCallback2(CB2_BuyMenu); break; @@ -581,7 +581,7 @@ static void BuyMenuPrintPriceInList(u8 windowId, s32 item, u8 y) static void BuyMenuAddScrollIndicatorArrows(void) { - if (gShopDataPtr->scrollIndicatorsTaskId == 0xFF && gMartInfo.itemCount + 1 > 8) + if (gShopDataPtr->scrollIndicatorsTaskId == TASK_NONE && gMartInfo.itemCount + 1 > 8) { gShopDataPtr->scrollIndicatorsTaskId = AddScrollIndicatorArrowPairParameterized( SCROLL_ARROW_UP, @@ -597,10 +597,10 @@ static void BuyMenuAddScrollIndicatorArrows(void) static void BuyMenuRemoveScrollIndicatorArrows(void) { - if (gShopDataPtr->scrollIndicatorsTaskId != 0xFF) + if (gShopDataPtr->scrollIndicatorsTaskId != TASK_NONE) { RemoveScrollIndicatorArrowPair(gShopDataPtr->scrollIndicatorsTaskId); - gShopDataPtr->scrollIndicatorsTaskId = 0xFF; + gShopDataPtr->scrollIndicatorsTaskId = TASK_NONE; } } @@ -614,7 +614,7 @@ static void BuyMenuAddItemIcon(u16 item, u8 iconSlot) { u8 spriteId; u8 *spriteIdPtr = &gShopDataPtr->itemSpriteIds[iconSlot]; - if (*spriteIdPtr != 0xFF) + if (*spriteIdPtr != SPRITE_NONE) return; if (gMartInfo.martType == MART_TYPE_NORMAL || item == 0xFFFF) @@ -638,13 +638,13 @@ static void BuyMenuAddItemIcon(u16 item, u8 iconSlot) static void BuyMenuRemoveItemIcon(u16 item, u8 iconSlot) { u8 *spriteIdPtr = &gShopDataPtr->itemSpriteIds[iconSlot]; - if (*spriteIdPtr == 0xFF) + if (*spriteIdPtr == SPRITE_NONE) return; FreeSpriteTilesByTag(iconSlot + 2110); FreeSpritePaletteByTag(iconSlot + 2110); DestroySprite(&gSprites[*spriteIdPtr]); - *spriteIdPtr = 0xFF; + *spriteIdPtr = SPRITE_NONE; } static void BuyMenuInitBgs(void) @@ -965,8 +965,9 @@ static void Task_BuyMenu(u8 taskId) if (gMartInfo.martType == MART_TYPE_DECOR) StringExpandPlaceholders(gStringVar4, gText_Var1IsItThatllBeVar2); - else + else // MART_TYPE_DECOR2 StringExpandPlaceholders(gStringVar4, gText_YouWantedVar1ThatllBeVar2); + BuyMenuDisplayMessage(taskId, gStringVar4, BuyMenuConfirmPurchase); } } @@ -1069,13 +1070,9 @@ static void BuyMenuTryMakePurchase(u8 taskId) if (DecorationAdd(tItemId)) { if (gMartInfo.martType == MART_TYPE_DECOR) - { BuyMenuDisplayMessage(taskId, gText_ThankYouIllSendItHome, BuyMenuSubtractMoney); - } - else - { + else // MART_TYPE_DECOR2 BuyMenuDisplayMessage(taskId, gText_ThanksIllSendItHome, BuyMenuSubtractMoney); - } } else { @@ -1155,7 +1152,7 @@ static void BuyMenuPrintItemQuantityAndPrice(u8 taskId) static void ExitBuyMenu(u8 taskId) { gFieldCallback = MapPostLoadHook_ReturnToShopMenu; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].func = Task_ExitBuyMenu; } diff --git a/src/slot_machine.c b/src/slot_machine.c index 7cfd7d22e..199e01bdd 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -876,7 +876,7 @@ static void Task_FadeToSlotMachine(u8 taskId) switch (gTasks[taskId].tState) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gTasks[taskId].tState++; break; case 1: @@ -1149,7 +1149,7 @@ static void Task_SlotMachine(u8 taskId) // SLOT_ACTION_UNFADE static bool8 SlotAction_UnfadeScreen(struct Task *task) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB(0, 0, 0)); LoadPikaPowerMeter(sSlotMachine->pikaPower); sSlotMachine->state++; // SLOT_ACTION_WAIT_FADE return FALSE; @@ -1593,7 +1593,7 @@ static bool8 SlotAction_EndGame(struct Task *task) { SetCoins(sSlotMachine->coins); AlertTVOfNewCoinTotal(GetCoins()); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB(0, 0, 0)); sSlotMachine->state++; // SLOT_ACTION_FREE return FALSE; } @@ -3409,7 +3409,7 @@ static void OpenInfoBox(u8 digDisplayId) static bool8 IsInfoBoxClosed(void) { - if (FindTaskIdByFunc(RunInfoBoxActions) == 0xFF) + if (FindTaskIdByFunc(RunInfoBoxActions) == TASK_NONE) return TRUE; else return FALSE; @@ -3422,7 +3422,7 @@ static void RunInfoBoxActions(u8 taskId) static void InfoBox_FadeIn(struct Task *task) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB(0, 0, 0)); task->tState++; } @@ -3446,7 +3446,7 @@ static void InfoBox_AddText(struct Task *task) { AddTextPrinterParameterized3(1, 1, 2, 5, sColors_ReeltimeHelp, 0, gText_ReelTimeHelp); CopyWindowToVram(1, 3); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB(0, 0, 0)); task->tState++; } @@ -3458,7 +3458,7 @@ static void InfoBox_AwaitPlayerInput(struct Task *task) ClearWindowTilemap(1); CopyWindowToVram(1, 1); RemoveWindow(1); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB(0, 0, 0)); task->tState++; } } @@ -3479,7 +3479,7 @@ static void InfoBox_CreateDigitalDisplay(struct Task *task) static void InfoBox_LoadPikaPowerMeter(struct Task *task) { LoadPikaPowerMeter(sSlotMachine->pikaPower); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0)); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB(0, 0, 0)); task->tState++; } diff --git a/src/sound.c b/src/sound.c index ee1753bb3..42f507b7c 100644 --- a/src/sound.c +++ b/src/sound.c @@ -41,24 +41,24 @@ static void Task_DuckBGMForPokemonCry(u8 taskId); static void RestoreBGMVolumeAfterPokemonCry(void); static const struct Fanfare sFanfares[] = { - { MUS_LEVEL_UP, 80 }, - { MUS_OBTAIN_ITEM, 160 }, - { MUS_EVOLVED, 220 }, - { MUS_OBTAIN_TMHM, 220 }, - { MUS_HEAL, 160 }, - { MUS_OBTAIN_BADGE, 340 }, - { MUS_MOVE_DELETED, 180 }, - { MUS_OBTAIN_BERRY, 120 }, - { MUS_AWAKEN_LEGEND, 710 }, - { MUS_SLOTS_JACKPOT, 250 }, - { MUS_SLOTS_WIN, 150 }, - { MUS_TOO_BAD, 160 }, - { MUS_RG_POKE_FLUTE, 450 }, - { MUS_RG_OBTAIN_KEY_ITEM, 170 }, - { MUS_RG_DEX_RATING, 196 }, - { MUS_OBTAIN_B_POINTS, 313 }, - { MUS_OBTAIN_SYMBOL, 318 }, - { MUS_REGISTER_MATCH_CALL, 135 }, + [FANFARE_LEVEL_UP] = { MUS_LEVEL_UP, 80 }, + [FANFARE_OBTAIN_ITEM] = { MUS_OBTAIN_ITEM, 160 }, + [FANFARE_EVOLVED] = { MUS_EVOLVED, 220 }, + [FANFARE_OBTAIN_TMHM] = { MUS_OBTAIN_TMHM, 220 }, + [FANFARE_HEAL] = { MUS_HEAL, 160 }, + [FANFARE_OBTAIN_BADGE] = { MUS_OBTAIN_BADGE, 340 }, + [FANFARE_MOVE_DELETED] = { MUS_MOVE_DELETED, 180 }, + [FANFARE_OBTAIN_BERRY] = { MUS_OBTAIN_BERRY, 120 }, + [FANFARE_AWAKEN_LEGEND] = { MUS_AWAKEN_LEGEND, 710 }, + [FANFARE_SLOTS_JACKPOT] = { MUS_SLOTS_JACKPOT, 250 }, + [FANFARE_SLOTS_WIN] = { MUS_SLOTS_WIN, 150 }, + [FANFARE_TOO_BAD] = { MUS_TOO_BAD, 160 }, + [FANFARE_RG_POKE_FLUTE] = { MUS_RG_POKE_FLUTE, 450 }, + [FANFARE_RG_OBTAIN_KEY_ITEM] = { MUS_RG_OBTAIN_KEY_ITEM, 170 }, + [FANFARE_RG_DEX_RATING] = { MUS_RG_DEX_RATING, 196 }, + [FANFARE_OBTAIN_B_POINTS] = { MUS_OBTAIN_B_POINTS, 313 }, + [FANFARE_OBTAIN_SYMBOL] = { MUS_OBTAIN_SYMBOL, 318 }, + [FANFARE_REGISTER_MATCH_CALL] = { MUS_REGISTER_MATCH_CALL, 135 }, }; #define CRY_VOLUME 120 // was 125 in R/S @@ -212,6 +212,7 @@ bool8 WaitFanfare(bool8 stop) } } +// Unused void StopFanfareByFanfareNum(u8 fanfareNum) { m4aSongNumStop(sFanfares[fanfareNum].songNum); @@ -220,7 +221,7 @@ void StopFanfareByFanfareNum(u8 fanfareNum) void PlayFanfare(u16 songNum) { s32 i; - for (i = 0; (u32)i < 18; i++) + for (i = 0; (u32)i < ARRAY_COUNT(sFanfares); i++) { if (sFanfares[i].songNum == songNum) { @@ -230,6 +231,8 @@ void PlayFanfare(u16 songNum) } } + // songNum is not in sFanfares + // Play first fanfare in table instead PlayFanfareByFanfareNum(0); CreateFanfareTask(); } diff --git a/src/start_menu.c b/src/start_menu.c index bfced1858..26a5097a6 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -541,7 +541,7 @@ void ShowStartMenu(void) if (!IsUpdateLinkStateCBActive()) { FreezeObjectEvents(); - sub_808B864(); + PlayerFreeze(); sub_808BCF4(); } CreateStartMenuTask(Task_ShowStartMenu); @@ -1232,7 +1232,7 @@ static void Task_SaveAfterLinkBattle(u8 taskId) DrawTextBorderOuter(0, 8, 14); PutWindowTilemap(0); CopyWindowToVram(0, 3); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); if (gWirelessCommType != 0 && InUnionRoom()) { @@ -1265,7 +1265,7 @@ static void Task_SaveAfterLinkBattle(u8 taskId) } break; case 3: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); *state = 4; break; case 4: diff --git a/src/starter_choose.c b/src/starter_choose.c index f7ffcfc2c..f29023d96 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -425,7 +425,7 @@ void CB2_ChooseStarter(void) LoadCompressedSpriteSheet(&sSpriteSheet_PokeballSelect[0]); LoadCompressedSpriteSheet(&sSpriteSheet_StarterCircle[0]); LoadSpritePalettes(sSpritePalettes_StarterChoose); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK); EnableInterrupts(DISPSTAT_VBLANK); SetVBlankCallback(VblankCB_StarterChoose); @@ -464,7 +464,7 @@ void CB2_ChooseStarter(void) gSprites[spriteId].sTaskId = taskId; gSprites[spriteId].sBallId = 2; - sStarterLabelWindowId = 0xFF; + sStarterLabelWindowId = WINDOW_NONE; } static void CB2_StarterChoose(void) @@ -613,7 +613,7 @@ static void ClearStarterLabel(void) FillWindowPixelBuffer(sStarterLabelWindowId, PIXEL_FILL(0)); ClearWindowTilemap(sStarterLabelWindowId); RemoveWindow(sStarterLabelWindowId); - sStarterLabelWindowId = 0xFF; + sStarterLabelWindowId = WINDOW_NONE; SetGpuReg(REG_OFFSET_WIN0H, 0); SetGpuReg(REG_OFFSET_WIN0V, 0); ScheduleBgCopyTilemapToVram(0); diff --git a/src/task.c b/src/task.c index 3a3ddadfd..68fb679b3 100644 --- a/src/task.c +++ b/src/task.c @@ -171,7 +171,7 @@ u8 FindTaskIdByFunc(TaskFunc func) if (gTasks[i].isActive == TRUE && gTasks[i].func == func) return (u8)i; - return TAIL_SENTINEL; // No task was found. + return TASK_NONE; // No task was found. } u8 GetTaskCount(void) diff --git a/src/tileset_anims.c b/src/tileset_anims.c index 087b75b7c..f566fe3e0 100644 --- a/src/tileset_anims.c +++ b/src/tileset_anims.c @@ -1169,7 +1169,7 @@ static void BlendAnimPalette_BattleDome_FloorLights(u16 timer) { CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % 4], gPlttBufferUnfaded + 0x80, 32); BlendPalette(0x80, 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); - if ((u8)FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) != 0xFF ) + if ((u8)FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) != TASK_NONE) { sSecondaryTilesetAnimCallback = TilesetAnim_BattleDome2; sSecondaryTilesetAnimCounterMax = 32; @@ -1179,7 +1179,7 @@ static void BlendAnimPalette_BattleDome_FloorLights(u16 timer) static void BlendAnimPalette_BattleDome_FloorLightsNoBlend(u16 timer) { CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % 4], gPlttBufferUnfaded + 0x80, 32); - if ((u8)FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) == 0xFF ) + if ((u8)FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) == TASK_NONE) { BlendPalette(0x80, 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); if (!--sSecondaryTilesetAnimCounterMax) diff --git a/src/title_screen.c b/src/title_screen.c index 1d6f90d74..f86a0b0b3 100644 --- a/src/title_screen.c +++ b/src/title_screen.c @@ -580,7 +580,7 @@ void CB2_InitTitleScreen(void) break; } case 3: - BeginNormalPaletteFade(0xFFFFFFFF, 1, 0x10, 0, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL, 1, 0x10, 0, RGB_WHITEALPHA); SetVBlankCallback(VBlankCB); gMain.state = 4; break; @@ -730,7 +730,7 @@ static void Task_TitleScreenPhase3(u8 taskId) if ((JOY_NEW(A_BUTTON)) || (JOY_NEW(START_BUTTON))) { FadeOutBGM(4); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_WHITEALPHA); SetMainCallback2(CB2_GoToMainMenu); } else if (JOY_HELD(CLEAR_SAVE_BUTTON_COMBO) == CLEAR_SAVE_BUTTON_COMBO) @@ -741,13 +741,13 @@ static void Task_TitleScreenPhase3(u8 taskId) && CanResetRTC() == TRUE) { FadeOutBGM(4); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); SetMainCallback2(CB2_GoToResetRtcScreen); } else if (JOY_HELD(BERRY_UPDATE_BUTTON_COMBO) == BERRY_UPDATE_BUTTON_COMBO) { FadeOutBGM(4); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); SetMainCallback2(CB2_GoToBerryFixScreen); } else @@ -764,7 +764,7 @@ static void Task_TitleScreenPhase3(u8 taskId) UpdateLegendaryMarkingColor(gTasks[taskId].tCounter); if ((gMPlayInfo_BGM.status & 0xFFFF) == 0) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITEALPHA); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_WHITEALPHA); SetMainCallback2(CB2_GoToCopyrightScreen); } } diff --git a/src/trade.c b/src/trade.c index 96099cb74..0e5110a58 100644 --- a/src/trade.c +++ b/src/trade.c @@ -110,7 +110,7 @@ static EWRAM_DATA struct { /*0x007F*/ u8 unused_7F; /*0x0080*/ u16 linkData[20]; /*0x00A8*/ u8 timer; - /*0x00A9*/ u8 giftRibbons[11]; + /*0x00A9*/ u8 giftRibbons[GIFT_RIBBONS_COUNT]; /*0x00B4*/ u8 filler_B4[0x8D0-0xB4]; /*0x08D0*/ struct { bool8 queued; @@ -165,9 +165,6 @@ static EWRAM_DATA struct { /*0xFE*/ u8 wirelessWinBottom; } *sTradeData = {NULL}; -#if !defined(NONMATCHING) && MODERN -#define static -#endif static bool32 IsWirelessTrade(void); static void CB2_CreateTradeMenu(void); static void VBlankCB_TradeMenu(void); @@ -584,7 +581,7 @@ static void CB2_CreateTradeMenu(void) gMain.state++; break; case 18: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); gMain.state++; break; case 19: @@ -764,8 +761,8 @@ static void CB2_ReturnToTradeMenu(void) break; case 18: gPaletteFade.bufferTransferDisabled = FALSE; - BlendPalettes(0xFFFFFFFF, 16, RGB_BLACK); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BlendPalettes(PALETTES_ALL, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); gMain.state++; break; case 19: @@ -805,7 +802,7 @@ static void LinkTradeFadeOut(void) { if (++sTradeMenuData->timer > 15) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_LINK_TRADE_WAIT_FADE; } } @@ -1163,12 +1160,12 @@ static void ReactToLinkTradeData(u8 mpId, u8 status) { switch (gBlockRecvBuffer[0][0]) { - case LINKCMD_CANCEL_TRADE: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + case LINKCMD_BOTH_CANCEL_TRADE: + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); PrintTradeMessage(TRADE_MSG_WAITING_FOR_FRIEND); sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_CANCEL_TRADE_1; break; - case LINKCMD_0xEECC: + case LINKCMD_PARTNER_CANCEL_TRADE: PrintTradeMessage(TRADE_MSG_FRIEND_WANTS_TO_TRADE); sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_REDRAW_MAIN_MENU; break; @@ -1180,10 +1177,10 @@ static void ReactToLinkTradeData(u8 mpId, u8 status) sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_CONFIRM_TRADE_PROMPT; break; case LINKCMD_START_TRADE: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_LINK_TRADE_WAIT_FADE; break; - case LINKCMD_0xDDEE: + case LINKCMD_PLAYER_CANCEL_TRADE: PrintTradeMessage(TRADE_MSG_CANCELED); sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_REDRAW_MAIN_MENU; } @@ -1211,7 +1208,7 @@ static void QueueLinkTradeData(void) && sTradeMenuData->partnerLinkFlagChoseAction == WANTS_TO_CANCEL) { PrintTradeMessage(TRADE_MSG_CANCELED); - sTradeMenuData->linkData[0] = LINKCMD_0xEECC; + sTradeMenuData->linkData[0] = LINKCMD_PARTNER_CANCEL_TRADE; sTradeMenuData->linkData[1] = 0; QueueAction(QUEUE_DELAY_DATA, QUEUE_SEND_DATA); sTradeMenuData->playerLinkFlagStatus = sTradeMenuData->partnerLinkFlagStatus = 0; @@ -1222,7 +1219,7 @@ static void QueueLinkTradeData(void) && sTradeMenuData->partnerLinkFlagChoseAction == WANTS_TO_TRADE) { PrintTradeMessage(TRADE_MSG_FRIEND_WANTS_TO_TRADE); - sTradeMenuData->linkData[0] = LINKCMD_0xDDEE; + sTradeMenuData->linkData[0] = LINKCMD_PLAYER_CANCEL_TRADE; sTradeMenuData->linkData[1] = 0; QueueAction(QUEUE_DELAY_DATA, QUEUE_SEND_DATA); sTradeMenuData->playerLinkFlagStatus = sTradeMenuData->partnerLinkFlagStatus = 0; @@ -1232,10 +1229,10 @@ static void QueueLinkTradeData(void) else if (sTradeMenuData->playerLinkFlagChoseAction == WANTS_TO_CANCEL && sTradeMenuData->partnerLinkFlagChoseAction == WANTS_TO_CANCEL) { - sTradeMenuData->linkData[0] = LINKCMD_CANCEL_TRADE; + sTradeMenuData->linkData[0] = LINKCMD_BOTH_CANCEL_TRADE; sTradeMenuData->linkData[1] = 0; QueueAction(QUEUE_DELAY_DATA, QUEUE_SEND_DATA); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sTradeMenuData->playerLinkFlagChoseAction = sTradeMenuData->partnerLinkFlagChoseAction = 0; sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_CANCEL_TRADE_1; } @@ -1258,7 +1255,7 @@ static void QueueLinkTradeData(void) || sTradeMenuData->partnerLinkFlagStatus == CANCEL_TRADE) { PrintTradeMessage(TRADE_MSG_CANCELED); - sTradeMenuData->linkData[0] = LINKCMD_0xDDEE; + sTradeMenuData->linkData[0] = LINKCMD_PLAYER_CANCEL_TRADE; sTradeMenuData->linkData[1] = 0; QueueAction(QUEUE_DELAY_DATA, QUEUE_SEND_DATA); sTradeMenuData->playerLinkFlagStatus = 0; @@ -1387,7 +1384,7 @@ static void TradeMenuProcessInput(void) // Cursor is in partner's party else if (sTradeMenuData->cursorPosition < PARTY_SIZE * 2) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_SHOW_MON_SUMMARY; } // Cursor is on Cancel @@ -1419,7 +1416,7 @@ static void TradeMenuProcessInput_SelectedMon(void) case MENU_NOTHING_CHOSEN: break; case 0: // Summary - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_SHOW_MON_SUMMARY; break; case 1: // Trade @@ -1489,7 +1486,7 @@ static u8 CheckValidityOfTradeMons(u8 *aliveMons, u8 playerPartyCount, u8 player // Partner cant trade illegitimate Deoxys or Mew if (partnerSpecies == SPECIES_DEOXYS || partnerSpecies == SPECIES_MEW) { - if (!GetMonData(&gEnemyParty[partnerMonIdx], MON_DATA_OBEDIENCE)) + if (!GetMonData(&gEnemyParty[partnerMonIdx], MON_DATA_EVENT_LEGAL)) return PARTNER_MON_INVALID; } @@ -2329,7 +2326,7 @@ static u32 CanTradeSelectedMon(struct Pokemon *playerParty, int partyCount, int if (species[monIdx] == SPECIES_DEOXYS || species[monIdx] == SPECIES_MEW) { - if (!GetMonData(&playerParty[monIdx], MON_DATA_OBEDIENCE)) + if (!GetMonData(&playerParty[monIdx], MON_DATA_EVENT_LEGAL)) return CANT_TRADE_INVALID_MON; } @@ -2394,17 +2391,17 @@ s32 GetGameProgressForLinkTrade(void) return TRADE_BOTH_PLAYERS_READY; } -static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isObedientBitSet) +static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isEventLegal) { if (species == SPECIES_DEOXYS || species == SPECIES_MEW) { - if (!isObedientBitSet) + if (!isEventLegal) return TRUE; } return FALSE; } -int GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGnameSub rfuPartner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isObedientBitSet) +int GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGnameSub rfuPartner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isEventLegal) { bool8 playerHasNationalDex = rfuPlayer.hasNationalDex; bool8 playerIsChampion = rfuPlayer.isChampion; @@ -2424,7 +2421,7 @@ int GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGname } } - if (IsDeoxysOrMewUntradable(playerSpecies, isObedientBitSet)) + if (IsDeoxysOrMewUntradable(playerSpecies, isEventLegal)) { return UR_TRADE_MSG_MON_CANT_BE_TRADED_2; } @@ -2475,11 +2472,11 @@ int GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGname return UR_TRADE_MSG_NONE; } -int CanRegisterMonForTradingBoard(struct GFtgtGnameSub rfuPlayer, u16 species2, u16 species, u8 isObedientBitSet) +int CanRegisterMonForTradingBoard(struct GFtgtGnameSub rfuPlayer, u16 species2, u16 species, u8 isEventLegal) { bool8 hasNationalDex = rfuPlayer.hasNationalDex; - if (IsDeoxysOrMewUntradable(species, isObedientBitSet)) + if (IsDeoxysOrMewUntradable(species, isEventLegal)) return CANT_REGISTER_MON; if (hasNationalDex) @@ -2845,7 +2842,7 @@ void CB2_LinkTrade(void) gMain.state++; break; case 10: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); ShowBg(0); gMain.state++; break; @@ -2920,7 +2917,7 @@ static void CB2_InGameTrade(void) StringCopy(gLinkPlayers[0].name, gSaveBlock2Ptr->playerName); GetMonData(&gEnemyParty[0], MON_DATA_OT_NAME, otName); StringCopy(gLinkPlayers[1].name, otName); - gLinkPlayers[0].language = LANGUAGE_ENGLISH; + gLinkPlayers[0].language = GAME_LANGUAGE; gLinkPlayers[1].language = GetMonData(&gEnemyParty[0], MON_DATA_LANGUAGE); sTradeData = AllocZeroed(sizeof(*sTradeData)); AllocateMonSpritesGfx(); @@ -3024,7 +3021,7 @@ static void TradeMons(u8 playerPartyIdx, u8 partnerPartyIdx) struct Pokemon *partnerMon = &gEnemyParty[partnerPartyIdx]; u16 partnerMail = GetMonData(partnerMon, MON_DATA_MAIL); - if (playerMail != 0xFF) + if (playerMail != MAIL_NONE) ClearMailStruct(&gSaveBlock1Ptr->mail[playerMail]); sTradeData->mon = *playerMon; @@ -3035,7 +3032,7 @@ static void TradeMons(u8 playerPartyIdx, u8 partnerPartyIdx) if (!GetMonData(playerMon, MON_DATA_IS_EGG)) SetMonData(playerMon, MON_DATA_FRIENDSHIP, &friendship); - if (partnerMail != 0xFF) + if (partnerMail != MAIL_NONE) GiveMailToMon2(playerMon, &gTradeMail[partnerMail]); UpdatePokedexForReceivedMon(playerPartyIdx); @@ -3336,7 +3333,7 @@ static bool8 AnimateTradeSequenceCable(void) // The game waits here for the sprite to finish its animation sequence. break; case 14: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sTradeData->state = 20; break; case 20: @@ -3349,7 +3346,7 @@ static bool8 AnimateTradeSequenceCable(void) } break; case 21: - BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 16, 0, RGB_BLACK); sTradeData->state++; break; case 22: @@ -3426,7 +3423,7 @@ static bool8 AnimateTradeSequenceCable(void) } break; case 29: - BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 16, RGB_BLACK); sTradeData->state = 30; break; case 30: @@ -3439,7 +3436,7 @@ static bool8 AnimateTradeSequenceCable(void) } break; case 31: - BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 16, 0, RGB_BLACK); sTradeData->unk_90 = CreateSprite(&sGlowBallSpriteTemplate, 111, 170, 0); sTradeData->unk_91 = CreateSprite(&sGlowBallSpriteTemplate, 129, -10, 0); sTradeData->state++; @@ -3518,7 +3515,7 @@ static bool8 AnimateTradeSequenceCable(void) gSprites[sTradeData->unk_91].pos2.y += 3; if (gSprites[sTradeData->unk_90].pos2.y <= -222) { - BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 16, RGB_BLACK); sTradeData->state++; DestroySprite(&gSprites[sTradeData->unk_90]); DestroySprite(&gSprites[sTradeData->unk_91]); @@ -3536,7 +3533,7 @@ static bool8 AnimateTradeSequenceCable(void) } break; case 41: - BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 16, 0, RGB_BLACK); sTradeData->state++; break; case 42: @@ -3614,7 +3611,7 @@ static bool8 AnimateTradeSequenceCable(void) sTradeData->sXY = 0x8000 / sTradeData->unk_EA; break; case 52: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sTradeData->state = 60; break; @@ -3629,7 +3626,7 @@ static bool8 AnimateTradeSequenceCable(void) break; case 61: gPaletteFade.bufferTransferDisabled = FALSE; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); sTradeData->state++; break; case 62: @@ -3735,7 +3732,7 @@ static bool8 AnimateTradeSequenceCable(void) case 72: // Only if in-game trade TradeMons(gSpecialVar_0x8005, 0); gCB2_AfterEvolution = CB2_UpdateInGameTrade; - evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE); + evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], EVO_MODE_TRADE, ITEM_NONE); if (evoTarget != SPECIES_NONE) { TradeEvolutionScene(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], evoTarget, sTradeData->pokePicSpriteIdxs[TRADE_PARTNER], gSelectedTradeMonPositions[TRADE_PLAYER]); @@ -3743,7 +3740,7 @@ static bool8 AnimateTradeSequenceCable(void) sTradeData->state++; break; case 73: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sTradeData->state++; break; case 74: @@ -3828,7 +3825,7 @@ static bool8 AnimateTradeSequenceWireless(void) // The game waits here for the sprite to finish its animation sequence. break; case 14: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sTradeData->state = 20; break; case 20: @@ -3841,7 +3838,7 @@ static bool8 AnimateTradeSequenceWireless(void) } break; case 21: - BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 16, 0, RGB_BLACK); sTradeData->state++; break; case 22: @@ -3923,7 +3920,7 @@ static bool8 AnimateTradeSequenceWireless(void) } break; case 29: - BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 16, RGB_BLACK); sTradeData->state = 30; break; case 30: @@ -3936,7 +3933,7 @@ static bool8 AnimateTradeSequenceWireless(void) } break; case 31: - BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 16, 0, RGB_BLACK); sTradeData->unk_90 = CreateSprite(&sGlowBallSpriteTemplate, 111, 170, 0); sTradeData->unk_91 = CreateSprite(&sGlowBallSpriteTemplate, 129, -10, 0); sTradeData->state++; @@ -4016,7 +4013,7 @@ static bool8 AnimateTradeSequenceWireless(void) gSprites[sTradeData->unk_91].pos2.y += 3; if (gSprites[sTradeData->unk_90].pos2.y <= -222) { - BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 16, RGB_BLACK); sTradeData->state++; DestroySprite(&gSprites[sTradeData->unk_90]); DestroySprite(&gSprites[sTradeData->unk_91]); @@ -4037,7 +4034,7 @@ static bool8 AnimateTradeSequenceWireless(void) } break; case 41: - BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 16, 0, RGB_BLACK); sTradeData->state++; break; case 42: @@ -4130,7 +4127,7 @@ static bool8 AnimateTradeSequenceWireless(void) sTradeData->sXY = 0x8000 / sTradeData->unk_EA; break; case 52: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sTradeData->state = 60; break; case 60: @@ -4144,7 +4141,7 @@ static bool8 AnimateTradeSequenceWireless(void) break; case 61: gPaletteFade.bufferTransferDisabled = FALSE; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); sTradeData->state++; break; case 62: @@ -4250,7 +4247,7 @@ static bool8 AnimateTradeSequenceWireless(void) case 72: // Only if in-game trade TradeMons(gSpecialVar_0x8005, 0); gCB2_AfterEvolution = CB2_UpdateInGameTrade; - evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE); + evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], EVO_MODE_TRADE, ITEM_NONE); if (evoTarget != SPECIES_NONE) { TradeEvolutionScene(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], evoTarget, sTradeData->pokePicSpriteIdxs[TRADE_PARTNER], gSelectedTradeMonPositions[TRADE_PLAYER]); @@ -4258,7 +4255,7 @@ static bool8 AnimateTradeSequenceWireless(void) sTradeData->state++; break; case 73: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sTradeData->state++; break; case 74: @@ -4293,7 +4290,7 @@ static void CB2_TryTradeEvolution(void) break; case 4: gCB2_AfterEvolution = CB2_SaveAndEndTrade; - evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE); + evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], EVO_MODE_TRADE, ITEM_NONE); if (evoTarget != SPECIES_NONE) TradeEvolutionScene(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], evoTarget, sTradeData->pokePicSpriteIdxs[TRADE_PARTNER], gSelectedTradeMonPositions[TRADE_PLAYER]); else if (IsWirelessTrade()) @@ -4667,7 +4664,7 @@ static void CB2_SaveAndEndTrade(void) case 6: if (_IsLinkTaskFinished()) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gMain.state ++; } break; @@ -4741,7 +4738,7 @@ void DoInGameTradeScene(void) { ScriptContext2_Enable(); CreateTask(Task_InGameTrade, 10); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); } static void Task_InGameTrade(u8 taskId) @@ -4974,7 +4971,7 @@ static void CB2_SaveAndEndWirelessTrade(void) if (_IsLinkTaskFinished()) { FadeOutBGM(3); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gMain.state = 11; } break; diff --git a/src/trainer_card.c b/src/trainer_card.c index 2d9ec2b09..c42c16845 100755 --- a/src/trainer_card.c +++ b/src/trainer_card.c @@ -414,8 +414,8 @@ static void Task_TrainerCard(u8 taskId) LoadWirelessStatusIndicatorSpriteGfx(); CreateWirelessStatusIndicatorSprite(230, 150); } - BlendPalettes(0xFFFFFFFF, 16, sData->blendColor); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, sData->blendColor); + BlendPalettes(PALETTES_ALL, 16, sData->blendColor); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, sData->blendColor); SetVBlankCallback(VblankCb_TrainerCard); sData->mainState++; break; @@ -452,7 +452,7 @@ static void Task_TrainerCard(u8 taskId) } else { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, sData->blendColor); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, sData->blendColor); sData->mainState = STATE_CLOSE_CARD; } } @@ -473,7 +473,7 @@ static void Task_TrainerCard(u8 taskId) } else if (gReceivedRemoteLinkPlayers) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, sData->blendColor); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, sData->blendColor); sData->mainState = STATE_CLOSE_CARD; } else @@ -491,7 +491,7 @@ static void Task_TrainerCard(u8 taskId) } else { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, sData->blendColor); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, sData->blendColor); sData->mainState = STATE_CLOSE_CARD; } } @@ -506,7 +506,7 @@ static void Task_TrainerCard(u8 taskId) case STATE_CLOSE_CARD_LINK: if (!gReceivedRemoteLinkPlayers) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, sData->blendColor); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, sData->blendColor); sData->mainState = STATE_CLOSE_CARD; } break; @@ -1588,7 +1588,7 @@ static void FlipTrainerCard(void) static bool8 IsCardFlipTaskActive(void) { - if (FindTaskIdByFunc(Task_DoCardFlipTask) == 0xFF) + if (FindTaskIdByFunc(Task_DoCardFlipTask) == TASK_NONE) return TRUE; else return FALSE; diff --git a/src/trainer_pokemon_sprites.c b/src/trainer_pokemon_sprites.c index c23047b01..aab4142db 100644 --- a/src/trainer_pokemon_sprites.c +++ b/src/trainer_pokemon_sprites.c @@ -262,12 +262,12 @@ u16 CreatePicSprite2(u16 species, u32 otId, u32 personality, u8 flags, s16 x, s1 sCreatingSpriteTemplate.images = images; if (flags2 == 0x01) { - sCreatingSpriteTemplate.affineAnims = gUnknown_082FF694; + sCreatingSpriteTemplate.affineAnims = gAffineAnims_BattleSpriteOpponentSide; sCreatingSpriteTemplate.oam = &gUnknown_0860B06C; } else if (flags2 == 0x00) { - sCreatingSpriteTemplate.affineAnims = gUnknown_082FF618; + sCreatingSpriteTemplate.affineAnims = gAffineAnims_BattleSpritePlayerSide; sCreatingSpriteTemplate.oam = &gUnknown_0860B06C; } else diff --git a/src/trainer_see.c b/src/trainer_see.c index 46fafa7e3..155c84cbe 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -23,9 +23,9 @@ static u8 CheckTrainer(u8 objectEventId); static u8 GetTrainerApproachDistance(struct ObjectEvent *trainerObj); static u8 CheckPathBetweenTrainerAndPlayer(struct ObjectEvent *trainerObj, u8 approachDistance, u8 direction); -static void TrainerApproachPlayer(struct ObjectEvent *trainerObj, u8 range); +static void InitTrainerApproachTask(struct ObjectEvent *trainerObj, u8 range); static void Task_RunTrainerSeeFuncList(u8 taskId); -static void Task_DestroyTrainerApproachTask(u8 taskId); +static void Task_EndTrainerApproach(u8 taskId); static void SetIconSpriteData(struct Sprite *sprite, u16 fldEffId, u8 spriteAnimNum); static u8 GetTrainerApproachDistanceSouth(struct ObjectEvent *trainerObj, s16 range, s16 x, s16 y); @@ -33,7 +33,7 @@ static u8 GetTrainerApproachDistanceNorth(struct ObjectEvent *trainerObj, s16 ra static u8 GetTrainerApproachDistanceWest(struct ObjectEvent *trainerObj, s16 range, s16 x, s16 y); static u8 GetTrainerApproachDistanceEast(struct ObjectEvent *trainerObj, s16 range, s16 x, s16 y); -static bool8 sub_80B4178(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); +static bool8 TrainerSeeIdle(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); static bool8 TrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); static bool8 WaitTrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); static bool8 TrainerMoveToPlayer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); @@ -41,10 +41,10 @@ static bool8 PlayerFaceApproachingTrainer(u8 taskId, struct Task *task, struct O static bool8 WaitPlayerFaceApproachingTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); static bool8 RevealDisguisedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); static bool8 WaitRevealDisguisedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); -static bool8 RevealHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); -static bool8 PopOutOfAshHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); -static bool8 JumpInPlaceHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); -static bool8 WaitRevealHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); +static bool8 RevealBuriedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); +static bool8 PopOutOfAshBuriedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); +static bool8 JumpInPlaceBuriedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); +static bool8 WaitRevealBuriedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj); static void SpriteCB_TrainerIcons(struct Sprite *sprite); @@ -71,28 +71,43 @@ static u8 (*const sDirectionalApproachDistanceFuncs[])(struct ObjectEvent *train GetTrainerApproachDistanceEast, }; +enum { + TRSEE_NONE, + TRSEE_EXCLAMATION, + TRSEE_EXCLAMATION_WAIT, + TRSEE_MOVE_TO_PLAYER, + TRSEE_PLAYER_FACE, + TRSEE_PLAYER_FACE_WAIT, + TRSEE_REVEAL_DISGUISE, + TRSEE_REVEAL_DISGUISE_WAIT, + TRSEE_REVEAL_BURIED, + TRSEE_BURIED_POP_OUT, + TRSEE_BURIED_JUMP, + TRSEE_REVEAL_BURIED_WAIT, +}; + static bool8 (*const sTrainerSeeFuncList[])(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) = { - sub_80B4178, - TrainerExclamationMark, - WaitTrainerExclamationMark, - TrainerMoveToPlayer, - PlayerFaceApproachingTrainer, - WaitPlayerFaceApproachingTrainer, - RevealDisguisedTrainer, - WaitRevealDisguisedTrainer, - RevealHiddenTrainer, - PopOutOfAshHiddenTrainer, - JumpInPlaceHiddenTrainer, - WaitRevealHiddenTrainer, + [TRSEE_NONE] = TrainerSeeIdle, + [TRSEE_EXCLAMATION] = TrainerExclamationMark, + [TRSEE_EXCLAMATION_WAIT] = WaitTrainerExclamationMark, + [TRSEE_MOVE_TO_PLAYER] = TrainerMoveToPlayer, + [TRSEE_PLAYER_FACE] = PlayerFaceApproachingTrainer, + [TRSEE_PLAYER_FACE_WAIT] = WaitPlayerFaceApproachingTrainer, + [TRSEE_REVEAL_DISGUISE] = RevealDisguisedTrainer, + [TRSEE_REVEAL_DISGUISE_WAIT] = WaitRevealDisguisedTrainer, + [TRSEE_REVEAL_BURIED] = RevealBuriedTrainer, + [TRSEE_BURIED_POP_OUT] = PopOutOfAshBuriedTrainer, + [TRSEE_BURIED_JUMP] = JumpInPlaceBuriedTrainer, + [TRSEE_REVEAL_BURIED_WAIT] = WaitRevealBuriedTrainer, }; static bool8 (*const sTrainerSeeFuncList2[])(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) = { - RevealHiddenTrainer, - PopOutOfAshHiddenTrainer, - JumpInPlaceHiddenTrainer, - WaitRevealHiddenTrainer, + RevealBuriedTrainer, + PopOutOfAshBuriedTrainer, + JumpInPlaceBuriedTrainer, + WaitRevealBuriedTrainer, }; static const struct OamData sOamData_Icons = @@ -164,7 +179,7 @@ static const struct SpriteTemplate sSpriteTemplate_ExclamationQuestionMark = static const struct SpriteTemplate sSpriteTemplate_HeartIcon = { .tileTag = 0xffff, - .paletteTag = 0x1004, + .paletteTag = FLDEFF_PAL_TAG_GENERAL_0, .oam = &sOamData_Icons, .anims = sSpriteAnimTable_Icons, .images = sSpriteImageTable_HeartIcon, @@ -233,7 +248,7 @@ bool8 CheckForTrainersWantingBattle(void) static u8 CheckTrainer(u8 objectEventId) { const u8 *scriptPtr; - u8 ret = 1; + u8 numTrainers = 1; u8 approachDistance; if (InTrainerHill() == TRUE) @@ -268,16 +283,16 @@ static u8 CheckTrainer(u8 objectEventId) if (GetMonsStateToDoubles_2() != 0) return 0; - ret = 2; + numTrainers = 2; } gApproachingTrainers[gNoOfApproachingTrainers].objectEventId = objectEventId; gApproachingTrainers[gNoOfApproachingTrainers].trainerScriptPtr = scriptPtr; gApproachingTrainers[gNoOfApproachingTrainers].radius = approachDistance; - TrainerApproachPlayer(&gObjectEvents[objectEventId], approachDistance - 1); + InitTrainerApproachTask(&gObjectEvents[objectEventId], approachDistance - 1); gNoOfApproachingTrainers++; - return ret; + return numTrainers; } return 0; @@ -357,8 +372,7 @@ static u8 GetTrainerApproachDistanceEast(struct ObjectEvent *trainerObj, s16 ran static u8 CheckPathBetweenTrainerAndPlayer(struct ObjectEvent *trainerObj, u8 approachDistance, u8 direction) { s16 x, y; - u8 unk19_temp; - u8 unk19b_temp; + u8 rangeX, rangeY; u8 i; u8 collision; @@ -376,17 +390,16 @@ static u8 CheckPathBetweenTrainerAndPlayer(struct ObjectEvent *trainerObj, u8 ap return 0; } - // preserve mapobj_unk_19 before clearing. - unk19_temp = trainerObj->rangeX; - unk19b_temp = trainerObj->rangeY; + rangeX = trainerObj->rangeX; + rangeY = trainerObj->rangeY; trainerObj->rangeX = 0; trainerObj->rangeY = 0; collision = GetCollisionAtCoords(trainerObj, x, y, direction); - trainerObj->rangeX = unk19_temp; - trainerObj->rangeY = unk19b_temp; - if (collision == 4) + trainerObj->rangeX = rangeX; + trainerObj->rangeY = rangeY; + if (collision == COLLISION_OBJECT_EVENT) return approachDistance; return 0; @@ -397,7 +410,7 @@ static u8 CheckPathBetweenTrainerAndPlayer(struct ObjectEvent *trainerObj, u8 ap #define tOutOfAshSpriteId data[4] #define tTrainerObjectEventId data[7] -static void TrainerApproachPlayer(struct ObjectEvent *trainerObj, u8 range) +static void InitTrainerApproachTask(struct ObjectEvent *trainerObj, u8 range) { struct Task *task; @@ -407,7 +420,7 @@ static void TrainerApproachPlayer(struct ObjectEvent *trainerObj, u8 range) task->tTrainerObjectEventId = gApproachingTrainers[gNoOfApproachingTrainers].objectEventId; } -static void sub_80B40C8(TaskFunc followupFunc) +static void StartTrainerApproach(TaskFunc followupFunc) { u8 taskId; TaskFunc taskFunc; @@ -419,7 +432,7 @@ static void sub_80B40C8(TaskFunc followupFunc) taskFunc = Task_RunTrainerSeeFuncList; SetTaskFuncWithFollowupFunc(taskId, taskFunc, followupFunc); - gTasks[taskId].tFuncId = 1; + gTasks[taskId].tFuncId = TRSEE_EXCLAMATION; taskFunc(taskId); } @@ -438,11 +451,12 @@ static void Task_RunTrainerSeeFuncList(u8 taskId) } } -static bool8 sub_80B4178(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) +static bool8 TrainerSeeIdle(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) { return FALSE; } +// TRSEE_EXCLAMATION static bool8 TrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) { u8 direction; @@ -451,10 +465,11 @@ static bool8 TrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectE FieldEffectStart(FLDEFF_EXCLAMATION_MARK_ICON); direction = GetFaceDirectionMovementAction(trainerObj->facingDirection); ObjectEventSetHeldMovement(trainerObj, direction); - task->tFuncId++; + task->tFuncId++; // TRSEE_EXCLAMATION_WAIT return TRUE; } +// TRSEE_EXCLAMATION_WAIT static bool8 WaitTrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) { if (FieldEffectActiveListContains(FLDEFF_EXCLAMATION_MARK_ICON)) @@ -463,15 +478,16 @@ static bool8 WaitTrainerExclamationMark(u8 taskId, struct Task *task, struct Obj } else { - task->tFuncId++; + task->tFuncId++; // TRSEE_MOVE_TO_PLAYER if (trainerObj->movementType == MOVEMENT_TYPE_TREE_DISGUISE || trainerObj->movementType == MOVEMENT_TYPE_MOUNTAIN_DISGUISE) - task->tFuncId = 6; - if (trainerObj->movementType == MOVEMENT_TYPE_HIDDEN) - task->tFuncId = 8; + task->tFuncId = TRSEE_REVEAL_DISGUISE; + if (trainerObj->movementType == MOVEMENT_TYPE_BURIED) + task->tFuncId = TRSEE_REVEAL_BURIED; return TRUE; } } +// TRSEE_MOVE_TO_PLAYER static bool8 TrainerMoveToPlayer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) { if (!ObjectEventIsMovementOverridden(trainerObj) || ObjectEventClearHeldMovementIfFinished(trainerObj)) @@ -484,12 +500,13 @@ static bool8 TrainerMoveToPlayer(u8 taskId, struct Task *task, struct ObjectEven else { ObjectEventSetHeldMovement(trainerObj, MOVEMENT_ACTION_FACE_PLAYER); - task->tFuncId++; + task->tFuncId++; // TRSEE_PLAYER_FACE } } return FALSE; } +// TRSEE_PLAYER_FACE static bool8 PlayerFaceApproachingTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) { struct ObjectEvent *playerObj; @@ -497,6 +514,7 @@ static bool8 PlayerFaceApproachingTrainer(u8 taskId, struct Task *task, struct O if (ObjectEventIsMovementOverridden(trainerObj) && !ObjectEventClearHeldMovementIfFinished(trainerObj)) return FALSE; + // Set trainer's movement type so they stop and remain facing that direction SetTrainerMovementType(trainerObj, GetTrainerFacingDirectionMovementType(trainerObj->facingDirection)); TryOverrideTemplateCoordsForObjectEvent(trainerObj, GetTrainerFacingDirectionMovementType(trainerObj->facingDirection)); OverrideTemplateCoordsForObjectEvent(trainerObj); @@ -507,10 +525,11 @@ static bool8 PlayerFaceApproachingTrainer(u8 taskId, struct Task *task, struct O sub_808BCE8(); ObjectEventSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], GetFaceDirectionMovementAction(GetOppositeDirection(trainerObj->facingDirection))); - task->tFuncId++; + task->tFuncId++; // TRSEE_PLAYER_FACE_WAIT return FALSE; } +// TRSEE_PLAYER_FACE_WAIT static bool8 WaitPlayerFaceApproachingTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) { struct ObjectEvent *playerObj = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -521,26 +540,29 @@ static bool8 WaitPlayerFaceApproachingTrainer(u8 taskId, struct Task *task, stru return FALSE; } +// TRSEE_REVEAL_DISGUISE static bool8 RevealDisguisedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) { if (!ObjectEventIsMovementOverridden(trainerObj) || ObjectEventClearHeldMovementIfFinished(trainerObj)) { ObjectEventSetHeldMovement(trainerObj, MOVEMENT_ACTION_REVEAL_TRAINER); - task->tFuncId++; + task->tFuncId++; // TRSEE_REVEAL_DISGUISE_WAIT } return FALSE; } +// TRSEE_REVEAL_DISGUISE_WAIT static bool8 WaitRevealDisguisedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) { if (ObjectEventClearHeldMovementIfFinished(trainerObj)) - task->tFuncId = 3; + task->tFuncId = TRSEE_MOVE_TO_PLAYER; return FALSE; } -static bool8 RevealHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) +// TRSEE_REVEAL_BURIED +static bool8 RevealBuriedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) { if (!ObjectEventIsMovementOverridden(trainerObj) || ObjectEventClearHeldMovementIfFinished(trainerObj)) @@ -551,7 +573,8 @@ static bool8 RevealHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEven return FALSE; } -static bool8 PopOutOfAshHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) +// TRSEE_BURIED_POP_OUT +static bool8 PopOutOfAshBuriedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) { if (ObjectEventCheckHeldMovementStatus(trainerObj)) { @@ -565,7 +588,8 @@ static bool8 PopOutOfAshHiddenTrainer(u8 taskId, struct Task *task, struct Objec return FALSE; } -static bool8 JumpInPlaceHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) +// TRSEE_BURIED_JUMP +static bool8 JumpInPlaceBuriedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) { struct Sprite *sprite; @@ -584,33 +608,34 @@ static bool8 JumpInPlaceHiddenTrainer(u8 taskId, struct Task *task, struct Objec return FALSE; } -static bool8 WaitRevealHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) +// TRSEE_REVEAL_BURIED_WAIT +static bool8 WaitRevealBuriedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) { if (!FieldEffectActiveListContains(FLDEFF_ASH_PUFF)) - task->tFuncId = 3; + task->tFuncId = TRSEE_MOVE_TO_PLAYER; return FALSE; } -#undef tFuncId #undef tTrainerRange #undef tOutOfAshSpriteId #undef tTrainerObjectEventId -static void sub_80B44C8(u8 taskId) +#define tObjEvent data[1] + +static void Task_SetBuriedTrainerMovement(u8 taskId) { struct Task *task = &gTasks[taskId]; struct ObjectEvent *objEvent; - // another objEvent loaded into by loadword? - LoadWordFromTwoHalfwords(&task->data[1], (u32 *)&objEvent); + LoadWordFromTwoHalfwords(&task->tObjEvent, (u32 *)&objEvent); if (!task->data[7]) { ObjectEventClearHeldMovement(objEvent); task->data[7]++; } - sTrainerSeeFuncList2[task->data[0]](taskId, task, objEvent); - if (task->data[0] == 3 && !FieldEffectActiveListContains(FLDEFF_ASH_PUFF)) + sTrainerSeeFuncList2[task->tFuncId](taskId, task, objEvent); + if (task->tFuncId == ((int)ARRAY_COUNT(sTrainerSeeFuncList2) - 1) && !FieldEffectActiveListContains(FLDEFF_ASH_PUFF)) { SetTrainerMovementType(objEvent, GetTrainerFacingDirectionMovementType(objEvent->facingDirection)); TryOverrideTemplateCoordsForObjectEvent(objEvent, GetTrainerFacingDirectionMovementType(objEvent->facingDirection)); @@ -622,17 +647,18 @@ static void sub_80B44C8(u8 taskId) } } -void sub_80B4578(struct ObjectEvent *var) +// Called when a buried Trainer has the reveal_trainer movement applied, from direct interaction +void SetBuriedTrainerMovement(struct ObjectEvent *objEvent) { - StoreWordInTwoHalfwords(&gTasks[CreateTask(sub_80B44C8, 0)].data[1], (u32)var); + StoreWordInTwoHalfwords(&gTasks[CreateTask(Task_SetBuriedTrainerMovement, 0)].tObjEvent, (u32)objEvent); } -void EndTrainerApproach(void) +void DoTrainerApproach(void) { - sub_80B40C8(Task_DestroyTrainerApproachTask); + StartTrainerApproach(Task_EndTrainerApproach); } -static void Task_DestroyTrainerApproachTask(u8 taskId) +static void Task_EndTrainerApproach(u8 taskId) { DestroyTask(taskId); EnableBothScriptContexts(); diff --git a/src/tv.c b/src/tv.c index effd3e4b2..d499e31a8 100644 --- a/src/tv.c +++ b/src/tv.c @@ -75,9 +75,6 @@ EWRAM_DATA ALIGNED(4) u8 sTVShowState = 0; EWRAM_DATA u8 sTVSecretBaseSecretsRandomValues[3] = {}; // Static ROM declarations -#if !defined(NONMATCHING) && MODERN -#define static -#endif void ClearPokemonNews(void); u8 GetTVChannelByShowType(u8 kind); u8 FindFirstActiveTVShowThatIsNotAMassOutbreak(void); @@ -139,7 +136,7 @@ static void sub_80EF120(u16 days); static void sub_80EDA48(u16 days); static void sub_80EEB98(u16 days); void PutFishingAdviceShowOnTheAir(void); -u8 TV_MonDataIdxToRibbon(u8 monDataIdx); +static u8 MonDataIdxToRibbon(u8 monDataIdx); static void sub_80EEBF4(u8 actionIdx); bool8 IsPriceDiscounted(u8 newsKind); static void InterviewBefore_FanClubLetter(void); @@ -592,22 +589,22 @@ static const u8 *const sTVTrainerFanClubTextGroup[] = { }; static const u8 *const sTVCutiesTextGroup[] = { - gTVCutiesText00, - gTVCutiesText01, - gTVCutiesText02, - gTVCutiesText03, - gTVCutiesText04, - gTVCutiesText05, - gTVCutiesText06, - gTVCutiesText07, - gTVCutiesText08, - gTVCutiesText09, - gTVCutiesText10, - gTVCutiesText11, - gTVCutiesText12, - gTVCutiesText13, - gTVCutiesText14, - gTVCutiesText15 + [SPOTCUTIES_STATE_INTRO] = TVSpotTheCuties_Text_Intro, + [SPOTCUTIES_STATE_RIBBONS_LOW] = TVSpotTheCuties_Text_RibbonsLow, + [SPOTCUTIES_STATE_RIBBONS_MID] = TVSpotTheCuties_Text_RibbonsMid, + [SPOTCUTIES_STATE_RIBBONS_HIGH] = TVSpotTheCuties_Text_RibbonsHigh, + [SPOTCUTIES_STATE_RIBBON_INTRO] = TVSpotTheCuties_Text_RibbonIntro, + [SPOTCUTIES_STATE_RIBBON_CHAMPION] = TVSpotTheCuties_Text_RibbonChampion, + [SPOTCUTIES_STATE_RIBBON_COOL] = TVSpotTheCuties_Text_RibbonCool, + [SPOTCUTIES_STATE_RIBBON_BEAUTY] = TVSpotTheCuties_Text_RibbonBeauty, + [SPOTCUTIES_STATE_RIBBON_CUTE] = TVSpotTheCuties_Text_RibbonCute, + [SPOTCUTIES_STATE_RIBBON_SMART] = TVSpotTheCuties_Text_RibbonSmart, + [SPOTCUTIES_STATE_RIBBON_TOUGH] = TVSpotTheCuties_Text_RibbonTough, + [SPOTCUTIES_STATE_RIBBON_WINNING] = TVSpotTheCuties_Text_RibbonWinning, + [SPOTCUTIES_STATE_RIBBON_VICTORY] = TVSpotTheCuties_Text_RibbonVictory, + [SPOTCUTIES_STATE_RIBBON_ARTIST] = TVSpotTheCuties_Text_RibbonArtist, + [SPOTCUTIES_STATE_RIBBON_EFFORT] = TVSpotTheCuties_Text_RibbonEffort, + [SPOTCUTIES_STATE_OUTRO] = TVSpotTheCuties_Text_Outro }; static const u8 *const sTVPokemonNewsBattleFrontierTextGroup[] = { @@ -1016,7 +1013,7 @@ bool8 IsTVShowInSearchOfTrainersAiring(void) bool8 GabbyAndTyGetLastQuote(void) { - if (gSaveBlock1Ptr->gabbyAndTyData.quote[0] == 0xFFFF) + if (gSaveBlock1Ptr->gabbyAndTyData.quote[0] == EC_EMPTY_WORD) { return FALSE; } @@ -1665,7 +1662,7 @@ void PutLilycoveContestLadyShowOnTheAir(void) { show = &gSaveBlock1Ptr->tvShows[sCurTVShowSlot]; BufferContestLadyLanguage(&show->contestLiveUpdates2.language); - show->contestLiveUpdates2.pokemonNameLanguage = LANGUAGE_ENGLISH; + show->contestLiveUpdates2.pokemonNameLanguage = GAME_LANGUAGE; show->contestLiveUpdates2.kind = TVSHOW_CONTEST_LIVE_UPDATES_2; show->contestLiveUpdates2.active = TRUE; BufferContestLadyPlayerName(show->contestLiveUpdates2.playerName); @@ -2369,7 +2366,7 @@ void TryPutSpotTheCutiesOnAir(struct Pokemon *pokemon, u8 ribbonMonDataIdx) GetMonData(pokemon, MON_DATA_NICKNAME, show->cuties.nickname); StripExtCtrlCodes(show->cuties.nickname); show->cuties.nRibbons = GetRibbonCount(pokemon); - show->cuties.selectedRibbon = TV_MonDataIdxToRibbon(ribbonMonDataIdx); + show->cuties.selectedRibbon = MonDataIdxToRibbon(ribbonMonDataIdx); tv_store_id_3x(show); show->cuties.language = gGameLanguage; if (show->cuties.language == LANGUAGE_JAPANESE || GetMonData(pokemon, MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE) @@ -2398,36 +2395,36 @@ u8 GetRibbonCount(struct Pokemon *pokemon) nRibbons += GetMonData(pokemon, MON_DATA_VICTORY_RIBBON); nRibbons += GetMonData(pokemon, MON_DATA_ARTIST_RIBBON); nRibbons += GetMonData(pokemon, MON_DATA_EFFORT_RIBBON); - nRibbons += GetMonData(pokemon, MON_DATA_GIFT_RIBBON_1); - nRibbons += GetMonData(pokemon, MON_DATA_GIFT_RIBBON_2); - nRibbons += GetMonData(pokemon, MON_DATA_GIFT_RIBBON_3); - nRibbons += GetMonData(pokemon, MON_DATA_GIFT_RIBBON_4); - nRibbons += GetMonData(pokemon, MON_DATA_GIFT_RIBBON_5); - nRibbons += GetMonData(pokemon, MON_DATA_GIFT_RIBBON_6); - nRibbons += GetMonData(pokemon, MON_DATA_GIFT_RIBBON_7); + nRibbons += GetMonData(pokemon, MON_DATA_MARINE_RIBBON); + nRibbons += GetMonData(pokemon, MON_DATA_LAND_RIBBON); + nRibbons += GetMonData(pokemon, MON_DATA_SKY_RIBBON); + nRibbons += GetMonData(pokemon, MON_DATA_COUNTRY_RIBBON); + nRibbons += GetMonData(pokemon, MON_DATA_NATIONAL_RIBBON); + nRibbons += GetMonData(pokemon, MON_DATA_EARTH_RIBBON); + nRibbons += GetMonData(pokemon, MON_DATA_WORLD_RIBBON); return nRibbons; } -u8 TV_MonDataIdxToRibbon(u8 monDataIdx) +static u8 MonDataIdxToRibbon(u8 monDataIdx) { - if (monDataIdx == MON_DATA_CHAMPION_RIBBON) return 0; - if (monDataIdx == MON_DATA_COOL_RIBBON) return 1; - if (monDataIdx == MON_DATA_BEAUTY_RIBBON) return 5; - if (monDataIdx == MON_DATA_CUTE_RIBBON) return 9; - if (monDataIdx == MON_DATA_SMART_RIBBON) return 13; - if (monDataIdx == MON_DATA_TOUGH_RIBBON) return 17; - if (monDataIdx == MON_DATA_WINNING_RIBBON) return 21; - if (monDataIdx == MON_DATA_VICTORY_RIBBON) return 22; - if (monDataIdx == MON_DATA_ARTIST_RIBBON) return 23; - if (monDataIdx == MON_DATA_EFFORT_RIBBON) return 24; - if (monDataIdx == MON_DATA_GIFT_RIBBON_1) return 25; - if (monDataIdx == MON_DATA_GIFT_RIBBON_2) return 26; - if (monDataIdx == MON_DATA_GIFT_RIBBON_3) return 27; - if (monDataIdx == MON_DATA_GIFT_RIBBON_4) return 28; - if (monDataIdx == MON_DATA_GIFT_RIBBON_5) return 29; - if (monDataIdx == MON_DATA_GIFT_RIBBON_6) return 30; - if (monDataIdx == MON_DATA_GIFT_RIBBON_7) return 31; - return 0; + if (monDataIdx == MON_DATA_CHAMPION_RIBBON) return CHAMPION_RIBBON; + if (monDataIdx == MON_DATA_COOL_RIBBON) return COOL_RIBBON_NORMAL; + if (monDataIdx == MON_DATA_BEAUTY_RIBBON) return BEAUTY_RIBBON_NORMAL; + if (monDataIdx == MON_DATA_CUTE_RIBBON) return CUTE_RIBBON_NORMAL; + if (monDataIdx == MON_DATA_SMART_RIBBON) return SMART_RIBBON_NORMAL; + if (monDataIdx == MON_DATA_TOUGH_RIBBON) return TOUGH_RIBBON_NORMAL; + if (monDataIdx == MON_DATA_WINNING_RIBBON) return WINNING_RIBBON; + if (monDataIdx == MON_DATA_VICTORY_RIBBON) return VICTORY_RIBBON; + if (monDataIdx == MON_DATA_ARTIST_RIBBON) return ARTIST_RIBBON; + if (monDataIdx == MON_DATA_EFFORT_RIBBON) return EFFORT_RIBBON; + if (monDataIdx == MON_DATA_MARINE_RIBBON) return MARINE_RIBBON; + if (monDataIdx == MON_DATA_LAND_RIBBON) return LAND_RIBBON; + if (monDataIdx == MON_DATA_SKY_RIBBON) return SKY_RIBBON; + if (monDataIdx == MON_DATA_COUNTRY_RIBBON) return COUNTRY_RIBBON; + if (monDataIdx == MON_DATA_NATIONAL_RIBBON) return NATIONAL_RIBBON; + if (monDataIdx == MON_DATA_EARTH_RIBBON) return EARTH_RIBBON; + if (monDataIdx == MON_DATA_WORLD_RIBBON) return WORLD_RIBBON; + return CHAMPION_RIBBON; } void TrySetUpTrainerFanClubSpecial(void) @@ -3144,7 +3141,7 @@ static bool8 IsPartyMonNicknamedOrNotEnglish(u8 monIdx) pokemon = &gPlayerParty[monIdx]; GetMonData(pokemon, MON_DATA_NICKNAME, gStringVar1); language = GetMonData(pokemon, MON_DATA_LANGUAGE, &language); - if (language == LANGUAGE_ENGLISH && !StringCompare(gSpeciesNames[GetMonData(pokemon, MON_DATA_SPECIES, NULL)], gStringVar1)) + if (language == GAME_LANGUAGE && !StringCompare(gSpeciesNames[GetMonData(pokemon, MON_DATA_SPECIES, NULL)], gStringVar1)) { return FALSE; } @@ -3299,14 +3296,11 @@ void TV_FanClubLetter_RandomWordToStringVar3(TVShow *show) while (TRUE) { if (i == 6) - { i = 0; - } - if (show->fanclubLetter.words[i] != 0xFFFF) - { + + if (show->fanclubLetter.words[i] != EC_EMPTY_WORD) break; - } - i ++; + i++; } CopyEasyChatWord(gStringVar3, show->fanclubLetter.words[i]); } @@ -4254,7 +4248,7 @@ static void sub_80F1254(TVShow *shows) } else { - curShow->bravoTrainerTower.pokemonNameLanguage = LANGUAGE_ENGLISH; + curShow->bravoTrainerTower.pokemonNameLanguage = GAME_LANGUAGE; } } } @@ -4262,7 +4256,7 @@ static void sub_80F1254(TVShow *shows) u8 TV_GetStringLanguage(u8 *str) { - return IsStringJapanese(str) ? LANGUAGE_JAPANESE : LANGUAGE_ENGLISH; + return IsStringJapanese(str) ? LANGUAGE_JAPANESE : GAME_LANGUAGE; } static void sub_80F12A4(TVShow *shows) @@ -6603,98 +6597,100 @@ static void DoTVShowSpotTheCuties(void) show = &gSaveBlock1Ptr->tvShows[gSpecialVar_0x8004]; gSpecialVar_Result = FALSE; + + // For each state, in addition to the switch a message + // is printed from the table at the bottom state = sTVShowState; switch (state) { - case 0: + case SPOTCUTIES_STATE_INTRO: TVShowConvertInternationalString(gStringVar1, show->cuties.playerName, show->cuties.language); TVShowConvertInternationalString(gStringVar2, show->cuties.nickname, show->cuties.pokemonNameLanguage); + + // Comments following the intro depend on how many ribbons the pokemon has if (show->cuties.nRibbons < 10) - { - sTVShowState = 1; - } + sTVShowState = SPOTCUTIES_STATE_RIBBONS_LOW; else if (show->cuties.nRibbons < 20) - { - sTVShowState = 2; - } + sTVShowState = SPOTCUTIES_STATE_RIBBONS_MID; else - { - sTVShowState = 3; - } + sTVShowState = SPOTCUTIES_STATE_RIBBONS_HIGH; break; - case 1: - case 2: - case 3: + case SPOTCUTIES_STATE_RIBBONS_LOW: + case SPOTCUTIES_STATE_RIBBONS_MID: + case SPOTCUTIES_STATE_RIBBONS_HIGH: TVShowConvertInternationalString(gStringVar1, show->cuties.playerName, show->cuties.language); TVShowConvertInternationalString(gStringVar2, show->cuties.nickname, show->cuties.pokemonNameLanguage); TV_PrintIntToStringVar(2, show->cuties.nRibbons); - sTVShowState = 4; + sTVShowState = SPOTCUTIES_STATE_RIBBON_INTRO; break; - case 4: + case SPOTCUTIES_STATE_RIBBON_INTRO: TVShowConvertInternationalString(gStringVar2, show->cuties.nickname, show->cuties.pokemonNameLanguage); switch (show->cuties.selectedRibbon) { - case 0: - sTVShowState = 5; - break; - case 1: - case 2: - case 3: - case 4: - sTVShowState = 6; - break; - case 5: - case 6: - case 7: - case 8: - sTVShowState = 7; - break; - case 9: - case 10: - case 11: - case 12: - sTVShowState = 8; - break; - case 13: - case 14: - case 15: - case 16: - sTVShowState = 9; - break; - case 17: - case 18: - case 19: - case 20: - sTVShowState = 10; - break; - case 21: - sTVShowState = 11; - break; - case 22: - sTVShowState = 12; - break; - case 23: - sTVShowState = 13; - break; - case 24: - sTVShowState = 14; - break; + case CHAMPION_RIBBON: + sTVShowState = SPOTCUTIES_STATE_RIBBON_CHAMPION; + break; + case COOL_RIBBON_NORMAL: + case COOL_RIBBON_SUPER: + case COOL_RIBBON_HYPER: + case COOL_RIBBON_MASTER: + sTVShowState = SPOTCUTIES_STATE_RIBBON_COOL; + break; + case BEAUTY_RIBBON_NORMAL: + case BEAUTY_RIBBON_SUPER: + case BEAUTY_RIBBON_HYPER: + case BEAUTY_RIBBON_MASTER: + sTVShowState = SPOTCUTIES_STATE_RIBBON_BEAUTY; + break; + case CUTE_RIBBON_NORMAL: + case CUTE_RIBBON_SUPER: + case CUTE_RIBBON_HYPER: + case CUTE_RIBBON_MASTER: + sTVShowState = SPOTCUTIES_STATE_RIBBON_CUTE; + break; + case SMART_RIBBON_NORMAL: + case SMART_RIBBON_SUPER: + case SMART_RIBBON_HYPER: + case SMART_RIBBON_MASTER: + sTVShowState = SPOTCUTIES_STATE_RIBBON_SMART; + break; + case TOUGH_RIBBON_NORMAL: + case TOUGH_RIBBON_SUPER: + case TOUGH_RIBBON_HYPER: + case TOUGH_RIBBON_MASTER: + sTVShowState = SPOTCUTIES_STATE_RIBBON_TOUGH; + break; + case WINNING_RIBBON: + sTVShowState = SPOTCUTIES_STATE_RIBBON_WINNING; + break; + case VICTORY_RIBBON: + sTVShowState = SPOTCUTIES_STATE_RIBBON_VICTORY; + break; + case ARTIST_RIBBON: + sTVShowState = SPOTCUTIES_STATE_RIBBON_ARTIST; + break; + case EFFORT_RIBBON: + sTVShowState = SPOTCUTIES_STATE_RIBBON_EFFORT; + break; + // No comment is made for any of the gift ribbons. + // If the show is created for a gift ribbon + // then this state will repeat indefinitely } break; - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: + case SPOTCUTIES_STATE_RIBBON_CHAMPION: + case SPOTCUTIES_STATE_RIBBON_COOL: + case SPOTCUTIES_STATE_RIBBON_BEAUTY: + case SPOTCUTIES_STATE_RIBBON_CUTE: + case SPOTCUTIES_STATE_RIBBON_SMART: + case SPOTCUTIES_STATE_RIBBON_TOUGH: + case SPOTCUTIES_STATE_RIBBON_WINNING: + case SPOTCUTIES_STATE_RIBBON_VICTORY: + case SPOTCUTIES_STATE_RIBBON_ARTIST: + case SPOTCUTIES_STATE_RIBBON_EFFORT: TVShowConvertInternationalString(gStringVar2, show->cuties.nickname, show->cuties.pokemonNameLanguage); - sTVShowState = 15; + sTVShowState = SPOTCUTIES_STATE_OUTRO; break; - case 15: + case SPOTCUTIES_STATE_OUTRO: TVShowDone(); } ShowFieldMessage(sTVCutiesTextGroup[state]); diff --git a/src/union_room.c b/src/union_room.c index 479792a7c..a12b385f5 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -2986,7 +2986,7 @@ static void Task_RunUnionRoom(u8 taskId) uroom->state = UR_STATE_START_ACTIVITY_FADE; break; case UR_STATE_START_ACTIVITY_FADE: - BeginNormalPaletteFade(-1, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); uroom->state = UR_STATE_START_ACTIVITY; break; case UR_STATE_START_ACTIVITY: @@ -3050,7 +3050,7 @@ static void Task_RunUnionRoom(u8 taskId) } break; case UR_STATE_REGISTER_SELECT_MON_FADE: - BeginNormalPaletteFade(-1, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); uroom->state = UR_STATE_REGISTER_SELECT_MON; break; case UR_STATE_REGISTER_SELECT_MON: diff --git a/src/union_room_battle.c b/src/union_room_battle.c index b9ddd74a7..c212e4706 100644 --- a/src/union_room_battle.c +++ b/src/union_room_battle.c @@ -143,7 +143,7 @@ void CB2_UnionRoomBattle(void) } break; case 2: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); ShowBg(0); gMain.state++; break; @@ -169,7 +169,7 @@ void CB2_UnionRoomBattle(void) if (gBlockRecvBuffer[0][0] == (ACTIVITY_ACCEPT | IN_UNION_ROOM) && gBlockRecvBuffer[1][0] == (ACTIVITY_ACCEPT | IN_UNION_ROOM)) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gMain.state = 50; } else diff --git a/src/union_room_chat.c b/src/union_room_chat.c index 75464529f..3733abe1e 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -930,8 +930,8 @@ static void CB2_LoadInterface(void) RunDisplaySubtasks(); if (!IsDisplaySubtask0Active()) { - BlendPalettes(0xFFFFFFFF, 16, RGB_BLACK); - BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + BlendPalettes(PALETTES_ALL, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 16, 0, RGB_BLACK); SetVBlankCallback(VBlankCB_UnionRoomChatMain); gMain.state++; } @@ -1567,7 +1567,7 @@ static void Chat_SaveAndExit(void) sChat->funcState = 12; break; case 12: - BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, -1, 0, 16, RGB_BLACK); sChat->funcState = 13; break; case 13: @@ -2157,8 +2157,8 @@ static void FreeDisplay(void) static void InitDisplay(struct UnionRoomChatDisplay *display) { - display->yesNoMenuWindowId = 0xFF; - display->messageWindowId = 0xFF; + display->yesNoMenuWindowId = WINDOW_NONE; + display->messageWindowId = WINDOW_NONE; display->currLine = 0; } @@ -2724,7 +2724,7 @@ static void AddYesNoMenuAt(u8 left, u8 top, u8 initialCursorPos) template.paletteNum = 14; template.baseBlock = 0x52; sDisplay->yesNoMenuWindowId = AddWindow(&template); - if (sDisplay->yesNoMenuWindowId != 0xFF) + if (sDisplay->yesNoMenuWindowId != WINDOW_NONE) { FillWindowPixelBuffer(sDisplay->yesNoMenuWindowId, PIXEL_FILL(1)); PutWindowTilemap(sDisplay->yesNoMenuWindowId); @@ -2737,7 +2737,7 @@ static void AddYesNoMenuAt(u8 left, u8 top, u8 initialCursorPos) static void HideYesNoMenuWindow(void) { - if (sDisplay->yesNoMenuWindowId != 0xFF) + if (sDisplay->yesNoMenuWindowId != WINDOW_NONE) { ClearStdWindowAndFrameToTransparent(sDisplay->yesNoMenuWindowId, FALSE); ClearWindowTilemap(sDisplay->yesNoMenuWindowId); @@ -2746,10 +2746,10 @@ static void HideYesNoMenuWindow(void) static void DestroyYesNoMenuWindow(void) { - if (sDisplay->yesNoMenuWindowId != 0xFF) + if (sDisplay->yesNoMenuWindowId != WINDOW_NONE) { RemoveWindow(sDisplay->yesNoMenuWindowId); - sDisplay->yesNoMenuWindowId = 0xFF; + sDisplay->yesNoMenuWindowId = WINDOW_NONE; } } @@ -2778,7 +2778,7 @@ static void AddStdMessageWindow(int msgId, u16 bg0vofs) sDisplay->messageWindowId = AddWindow(&template); windowId = sDisplay->messageWindowId; - if (sDisplay->messageWindowId == 0xFF) + if (sDisplay->messageWindowId == WINDOW_NONE) return; if (sDisplayStdMessages[msgId].hasPlaceholders) @@ -2828,7 +2828,7 @@ static void AddStdMessageWindow(int msgId, u16 bg0vofs) static void HideStdMessageWindow(void) { - if (sDisplay->messageWindowId != 0xFF) + if (sDisplay->messageWindowId != WINDOW_NONE) { ClearStdWindowAndFrameToTransparent(sDisplay->messageWindowId, FALSE); ClearWindowTilemap(sDisplay->messageWindowId); @@ -2839,10 +2839,10 @@ static void HideStdMessageWindow(void) static void DestroyStdMessageWindow(void) { - if (sDisplay->messageWindowId != 0xFF) + if (sDisplay->messageWindowId != WINDOW_NONE) { RemoveWindow(sDisplay->messageWindowId); - sDisplay->messageWindowId = 0xFF; + sDisplay->messageWindowId = WINDOW_NONE; } } diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c index b4ccbfe06..5d8f5ce24 100644 --- a/src/use_pokeblock.c +++ b/src/use_pokeblock.c @@ -486,7 +486,7 @@ static void LoadUsePokeblockMenu(void) switch (sInfo->mainState) { case 0: - sMenu->curMonSpriteId = 0xFF; + sMenu->curMonSpriteId = SPRITE_NONE; InitConditionGraphData(&sMenu->graph); sInfo->mainState++; break; @@ -569,7 +569,7 @@ static void ShowUsePokeblockMenu(void) switch (sInfo->mainState) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); SetVBlankCallback(VBlankCB_UsePokeblockMenu); ShowBg(0); ShowBg(1); @@ -695,7 +695,7 @@ static void FeedPokeblockToMon(void) gPokeblockMonId = GetPartyIdFromSelectionId(sMenu->info.curSelection); sExitCallback = sInfo->exitCallback; sPokeblock = sInfo->pokeblock; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sInfo->mainState++; break; case 1: @@ -739,7 +739,7 @@ static void ShowUsePokeblockMenuForResults(void) case 2: break; case 3: - BlendPalettes(0xFFFFFFFF, 16, RGB_BLACK); + BlendPalettes(PALETTES_ALL, 16, RGB_BLACK); sInfo->mainState++; break; case 4: @@ -751,7 +751,7 @@ static void ShowUsePokeblockMenuForResults(void) break; case 5: SetVBlankCallback(VBlankCB_UsePokeblockMenu); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); sInfo->mainState++; break; case 6: @@ -827,7 +827,7 @@ static void CloseUsePokeblockMenu(void) switch (sInfo->mainState) { case 0: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); sInfo->mainState++; break; case 1: @@ -853,7 +853,7 @@ static void CloseUsePokeblockMenu(void) for (i = 0; i < ARRAY_COUNT(sMenu->condition); i++) DestroySprite(sMenu->condition[i]); - if (sMenu->curMonSpriteId != 0xFF) + if (sMenu->curMonSpriteId != SPRITE_NONE) DestroySprite(&gSprites[sMenu->curMonSpriteId]); SetVBlankCallback(NULL); @@ -1215,7 +1215,7 @@ static void UpdateMonPic(u8 loadId) struct SpriteSheet spriteSheet; struct SpritePalette spritePal; - if (sMenu->curMonSpriteId == 0xFF) + if (sMenu->curMonSpriteId == SPRITE_NONE) { LoadConditionMonPicTemplate(&spriteSheet, &spriteTemplate, &spritePal); spriteSheet.data = sMenu->partySheets[loadId]; @@ -1228,7 +1228,7 @@ static void UpdateMonPic(u8 loadId) { FreeSpriteTilesByTag(TAG_CONDITION_MON); FreeSpritePaletteByTag(TAG_CONDITION_MON); - sMenu->curMonSpriteId = 0xFF; + sMenu->curMonSpriteId = SPRITE_NONE; } else { diff --git a/src/util.c b/src/util.c index 8aa54857a..a4e3fa4cf 100644 --- a/src/util.c +++ b/src/util.c @@ -2,6 +2,7 @@ #include "util.h" #include "sprite.h" #include "palette.h" +#include "constants/rgb.h" const u32 gBitTable[] = { @@ -271,8 +272,8 @@ void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor) s8 g = data1->g; s8 b = data1->b; struct PlttData *data2 = (struct PlttData *)&blendColor; - gPlttBufferFaded[index] = ((r + (((data2->r - r) * coeff) >> 4)) << 0) - | ((g + (((data2->g - g) * coeff) >> 4)) << 5) - | ((b + (((data2->b - b) * coeff) >> 4)) << 10); + gPlttBufferFaded[index] = RGB(r + (((data2->r - r) * coeff) >> 4), + g + (((data2->g - g) * coeff) >> 4), + b + (((data2->b - b) * coeff) >> 4)); } } diff --git a/src/wallclock.c b/src/wallclock.c index c38dd99e3..4d1c1fd8f 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -665,7 +665,7 @@ static void LoadWallClockGraphics(void) static void WallClockInit(void) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); EnableInterrupts(INTR_FLAG_VBLANK); SetVBlankCallback(VBlankCB_WallClock); SetMainCallback2(CB2_WallClock); @@ -856,7 +856,7 @@ static void Task_SetClock_HandleConfirmInput(u8 taskId) static void Task_SetClock_Confirmed(u8 taskId) { RtcInitLocalTimeOffset(gTasks[taskId].tHours, gTasks[taskId].tMinutes); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].func = Task_SetClock_Exit; } @@ -884,7 +884,7 @@ static void Task_ViewClock_HandleInput(u8 taskId) static void Task_ViewClock_FadeOut(u8 taskId) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); gTasks[taskId].func = Task_ViewClock_Exit; } diff --git a/src/wireless_communication_status_screen.c b/src/wireless_communication_status_screen.c index 87b200f14..23d63832f 100644 --- a/src/wireless_communication_status_screen.c +++ b/src/wireless_communication_status_screen.c @@ -260,7 +260,7 @@ static void Task_WirelessCommunicationScreen(u8 taskId) gTasks[taskId].tState++; break; case 1: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); + BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, 0); ShowBg(1); CopyBgTilemapBufferToVram(0); ShowBg(0); @@ -296,7 +296,7 @@ static void Task_WirelessCommunicationScreen(u8 taskId) WCSS_CyclePalette(&gTasks[taskId].data[7], &gTasks[taskId].data[8]); break; case 4: - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, 0); gTasks[taskId].tState++; break; case 5: diff --git a/sym_common.txt b/sym_common.txt index 02fde8971..22d70d706 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -9,7 +9,7 @@ gUnneededFireRedVariable: gTransparentTileNumber: .space 1 .align 4 -gUnknown_03002F70: +gWindowBgTilemapBuffers: .space 16 @ ../gflib/text.o .align 4