ref: 6ecf18aa52b79131fbf0cce85c41d3cae617100a
parent: 2e0a9ea081e6978ec723933c1fb4d5dc52a46296
author: Rangi <[email protected]>
date: Mon Jan 22 07:03:18 EST 2018
Engine flag bit constants for wPokegearFlags
--- a/Makefile
+++ b/Makefile
@@ -76,15 +76,15 @@
endif
-pokecrystal11.gbc: $(crystal11_obj) pokecrystal.link
- $(RGBLINK) -n pokecrystal11.sym -m pokecrystal11.map -l pokecrystal.link -o $@ $(crystal11_obj)
- $(RGBFIX) -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -n 1 -p 0 -r 3 -t PM_CRYSTAL $@
- tools/sort_symfile.sh pokecrystal11.sym
-
pokecrystal.gbc: $(crystal_obj) pokecrystal.link
$(RGBLINK) -n pokecrystal.sym -m pokecrystal.map -l pokecrystal.link -o $@ $(crystal_obj)
$(RGBFIX) -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
tools/sort_symfile.sh pokecrystal.sym
+
+pokecrystal11.gbc: $(crystal11_obj) pokecrystal.link
+ $(RGBLINK) -n pokecrystal11.sym -m pokecrystal11.map -l pokecrystal.link -o $@ $(crystal11_obj)
+ $(RGBFIX) -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -n 1 -p 0 -r 3 -t PM_CRYSTAL $@
+ tools/sort_symfile.sh pokecrystal11.sym
# For files that the compressor can't match, there will be a .lz file suffixed with the md5 hash of the correct uncompressed file.
--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -1,3 +1,13 @@
+; InputType: ; c2c7
+AUTO_INPUT EQU $ff
+
+; wCurrentDexMode: ; c7d4
+ const_def
+ const DEXMODE_NEW
+ const DEXMODE_OLD
+ const DEXMODE_ABC
+ const DEXMODE_UNOWN
+
; MonType: ; cf5f
const_def
const PARTYMON ; 0
@@ -6,7 +16,8 @@
const TEMPMON ; 3
const WILDMON ; 4
-; Options: (bits) ; cfcc
+; Options: ; cfcc
+
const_value set 4
const NO_TEXT_SCROLL ; 4
const STEREO ; 5
@@ -13,7 +24,6 @@
const BATTLE_SHIFT ; 6
const BATTLE_SCENE ; 7
-; Options: (bits 0-2)
TEXT_DELAY_FAST EQU 1
TEXT_DELAY_MED EQU 3
TEXT_DELAY_SLOW EQU 5
@@ -30,16 +40,12 @@
const FRAME_8 ; 7
NUM_FRAMES EQU const_value
-; TextBoxFlags:
+; TextBoxFlags: ; cfcf
const_def
const FAST_TEXT_DELAY_F ; 0
const NO_TEXT_DELAY_F ; 1
-; Options2:
- const_def
- const MENU_ACCOUNT ; 0
-
-; GBPrinter:
+; GBPrinter: ; cfd0
GBPRINTER_LIGHTEST EQU $00
GBPRINTER_LIGHTER EQU $20
GBPRINTER_NORMAL EQU $40
@@ -46,6 +52,10 @@
GBPRINTER_DARKER EQU $60
GBPRINTER_DARKEST EQU $7f
+; Options2: ; cfd1
+ const_def
+ const MENU_ACCOUNT ; 0
+
; WalkingDirection: ; d043
const_value set -1
const STANDING ; -1
@@ -62,11 +72,24 @@
; FacingDirection: ; d044
FACE_CURRENT EQU 0
-FACE_DOWN EQU 8
-FACE_UP EQU 4
-FACE_LEFT EQU 2
-FACE_RIGHT EQU 1
+FACE_DOWN EQU 8
+FACE_UP EQU 4
+FACE_LEFT EQU 2
+FACE_RIGHT EQU 1
+; wPokemonWithdrawDepositParameter: ; d10b
+PC_WITHDRAW EQU 0
+PC_DEPOSIT EQU 1
+DAY_CARE_WITHDRAW EQU 2
+DAY_CARE_DEPOSIT EQU 3
+
+; wInitListType: ; d263
+INIT_ENEMYOT_LIST EQU 1
+INIT_BAG_ITEM_LIST EQU 2
+INIT_OTHER_ITEM_LIST EQU 3
+INIT_PLAYEROT_LIST EQU 4
+INIT_MON_LIST EQU 5
+
; TimeOfDay: ; d269
const_def
const MORN_F ; 0
@@ -91,6 +114,10 @@
SCRIPT_WAIT_MOVEMENT EQU 2
SCRIPT_WAIT EQU 3
+; wSpawnAfterChampion: ; d4b5
+SPAWN_LANCE EQU 1
+SPAWN_RED EQU 2
+
; CurDay: ; d4cb
const_def
const SUNDAY ; 0
@@ -102,44 +129,11 @@
const SATURDAY ; 6
; MapObjects: ; d71e
-
PLAYER_OBJECT EQU 0
-
NUM_OBJECTS EQU $10
-; InputType: ; c2c7
-AUTO_INPUT EQU $ff
-
-; WhichRegisteredItem: ; d95b
-REGISTERED_POCKET EQU %11000000
-REGISTERED_NUMBER EQU %00111111
-
-; PlayerState: ; d95d
-PLAYER_NORMAL EQU 0
-PLAYER_BIKE EQU 1
-PLAYER_SKATE EQU 2
-PLAYER_SURF EQU 4
-PLAYER_SURF_PIKA EQU 8
-
-; After-Champion Spawn
-SPAWN_LANCE EQU 1
-SPAWN_RED EQU 2
-
-; wPokemonWithdrawDepositParameter
-PC_WITHDRAW EQU 0
-PC_DEPOSIT EQU 1
-DAY_CARE_WITHDRAW EQU 2
-DAY_CARE_DEPOSIT EQU 3
-
-; wCurrentDexMode
+; wJohtoBadges: ; d857
const_def
- const DEXMODE_NEW
- const DEXMODE_OLD
- const DEXMODE_ABC
- const DEXMODE_UNOWN
-
-; wJohtoBadges:
- const_def
const ZEPHYRBADGE
const HIVEBADGE
const PLAINBADGE
@@ -150,7 +144,7 @@
const RISINGBADGE
NUM_JOHTO_BADGES EQU const_value
-; wKantoBadges:
+; wKantoBadges: ; d858
const_def
const BOULDERBADGE
const CASCADEBADGE
@@ -163,9 +157,22 @@
NUM_KANTO_BADGES EQU const_value
NUM_BADGES EQU NUM_JOHTO_BADGES + NUM_KANTO_BADGES
-; wInitListType:
-INIT_ENEMYOT_LIST EQU 1
-INIT_BAG_ITEM_LIST EQU 2
-INIT_OTHER_ITEM_LIST EQU 3
-INIT_PLAYEROT_LIST EQU 4
-INIT_MON_LIST EQU 5
+; wPokegearFlags: ; d957
+ const_def
+ const POKEGEAR_MAP_CARD_F ; 0
+ const POKEGEAR_RADIO_CARD_F ; 1
+ const POKEGEAR_PHONE_CARD_F ; 2
+ const POKEGEAR_EXPN_CARD_F ; 3
+
+POKEGEAR_OBTAINED_F EQU 7
+
+; WhichRegisteredItem: ; d95b
+REGISTERED_POCKET EQU %11000000
+REGISTERED_NUMBER EQU %00111111
+
+; PlayerState: ; d95d
+PLAYER_NORMAL EQU 0
+PLAYER_BIKE EQU 1
+PLAYER_SKATE EQU 2
+PLAYER_SURF EQU 4
+PLAYER_SURF_PIKA EQU 8
--- a/data/engine_flags.asm
+++ b/data/engine_flags.asm
@@ -7,11 +7,11 @@
; (all locations are in WRAM bank 1)
; pokegear
- engine_flag wPokegearFlags, 1 ; radio card ; $0
- engine_flag wPokegearFlags, 0 ; map card
- engine_flag wPokegearFlags, 2 ; phone card
- engine_flag wPokegearFlags, 3 ; expn card
- engine_flag wPokegearFlags, 7 ; on/off
+ engine_flag wPokegearFlags, POKEGEAR_RADIO_CARD_F ; $0
+ engine_flag wPokegearFlags, POKEGEAR_MAP_CARD_F
+ engine_flag wPokegearFlags, POKEGEAR_PHONE_CARD_F
+ engine_flag wPokegearFlags, POKEGEAR_EXPN_CARD_F
+ engine_flag wPokegearFlags, POKEGEAR_OBTAINED_F
; wDayCareMan, 7 ; day-care 1 on
engine_flag wDayCareMan, 6 ; egg is ready
@@ -44,23 +44,23 @@
engine_flag wBikeFlags, 1 ; always on bike (cant surf)
engine_flag wBikeFlags, 2 ; downhill (cycling road)
- engine_flag wJohtoBadges, 0 ; zephyrbadge
- engine_flag wJohtoBadges, 1 ; hivebadge
- engine_flag wJohtoBadges, 2 ; plainbadge
- engine_flag wJohtoBadges, 3 ; fogbadge
- engine_flag wJohtoBadges, 4 ; mineralbadge
- engine_flag wJohtoBadges, 5 ; stormbadge ; $20
- engine_flag wJohtoBadges, 6 ; glacierbadge
- engine_flag wJohtoBadges, 7 ; risingbadge
+ engine_flag wJohtoBadges, ZEPHYRBADGE
+ engine_flag wJohtoBadges, HIVEBADGE
+ engine_flag wJohtoBadges, PLAINBADGE
+ engine_flag wJohtoBadges, FOGBADGE
+ engine_flag wJohtoBadges, MINERALBADGE
+ engine_flag wJohtoBadges, STORMBADGE ; $20
+ engine_flag wJohtoBadges, GLACIERBADGE
+ engine_flag wJohtoBadges, RISINGBADGE
- engine_flag wKantoBadges, 0 ; boulderbadge
- engine_flag wKantoBadges, 1 ; cascadebadge
- engine_flag wKantoBadges, 2 ; thunderbadge
- engine_flag wKantoBadges, 3 ; rainbowbadge
- engine_flag wKantoBadges, 4 ; soulbadge
- engine_flag wKantoBadges, 5 ; marshbadge ; $28
- engine_flag wKantoBadges, 6 ; volcanobadge
- engine_flag wKantoBadges, 7 ; earthbadge
+ engine_flag wKantoBadges, BOULDERBADGE
+ engine_flag wKantoBadges, CASCADEBADGE
+ engine_flag wKantoBadges, THUNDERBADGE
+ engine_flag wKantoBadges, RAINBOWBADGE
+ engine_flag wKantoBadges, SOULBADGE
+ engine_flag wKantoBadges, MARSHBADGE ; $28
+ engine_flag wKantoBadges, VOLCANOBADGE
+ engine_flag wKantoBadges, EARTHBADGE
; unown sets
engine_flag wUnlockedUnowns, 0 ; 1
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -411,13 +411,13 @@
call ByteFill
ld de, wPokegearFlags
ld a, [de]
- bit 0, a ; ENGINE_MAP_CARD
+ bit POKEGEAR_MAP_CARD_F, a
call nz, .PlaceMapIcon
ld a, [de]
- bit 2, a ; ENGINE_PHONE_CARD
+ bit POKEGEAR_PHONE_CARD_F, a
call nz, .PlacePhoneIcon
ld a, [de]
- bit 1, a ; ENGINE_RADIO_CARD
+ bit POKEGEAR_RADIO_CARD_F, a
call nz, .PlaceRadioIcon
hlcoord 0, 0
ld a, $46
@@ -496,7 +496,7 @@
and D_RIGHT
ret z
ld a, [wPokegearFlags]
- bit 0, a ; ENGINE_MAP_CARD
+ bit POKEGEAR_MAP_CARD_F, a
jr z, .no_map_card
ld c, POKEGEARSTATE_MAPCHECKREGION
ld b, POKEGEARCARD_MAP
@@ -504,7 +504,7 @@
.no_map_card
ld a, [wPokegearFlags]
- bit 2, a ; ENGINE_PHONE_CARD
+ bit POKEGEAR_PHONE_CARD_F, a
jr z, .no_phone_card
ld c, POKEGEARSTATE_PHONEINIT
ld b, POKEGEARCARD_PHONE
@@ -512,7 +512,7 @@
.no_phone_card
ld a, [wPokegearFlags]
- bit 1, a ; ENGINE_RADIO_CARD
+ bit POKEGEAR_RADIO_CARD_F, a
ret z
ld c, POKEGEARSTATE_RADIOINIT
ld b, POKEGEARCARD_RADIO
@@ -613,7 +613,7 @@
.right
ld a, [wPokegearFlags]
- bit 2, a ; ENGINE_PHONE_CARD
+ bit POKEGEAR_PHONE_CARD_F, a
jr z, .no_phone
ld c, POKEGEARSTATE_PHONEINIT
ld b, POKEGEARCARD_PHONE
@@ -621,7 +621,7 @@
.no_phone
ld a, [wPokegearFlags]
- bit 1, a ; ENGINE_RADIO_CARD
+ bit POKEGEAR_RADIO_CARD_F, a
ret z
ld c, POKEGEARSTATE_RADIOINIT
ld b, POKEGEARCARD_RADIO
@@ -810,7 +810,7 @@
.left
ld a, [wPokegearFlags]
- bit 2, a ; ENGINE_PHONE_CARD
+ bit POKEGEAR_PHONE_CARD_F, a
jr z, .no_phone
ld c, POKEGEARSTATE_PHONEINIT
ld b, POKEGEARCARD_PHONE
@@ -818,7 +818,7 @@
.no_phone
ld a, [wPokegearFlags]
- bit 0, a ; ENGINE_MAP_CARD
+ bit POKEGEAR_MAP_CARD_F, a
jr z, .no_map
ld c, POKEGEARSTATE_MAPCHECKREGION
ld b, POKEGEARCARD_MAP
@@ -869,7 +869,7 @@
.left
ld a, [wPokegearFlags]
- bit 0, a ; ENGINE_MAP_CARD
+ bit POKEGEAR_MAP_CARD_F, a
jr z, .no_map
ld c, POKEGEARSTATE_MAPCHECKREGION
ld b, POKEGEARCARD_MAP
@@ -882,7 +882,7 @@
.right
ld a, [wPokegearFlags]
- bit 1, a ; ENGINE_RADIO_CARD
+ bit POKEGEAR_RADIO_CARD_F, a
ret z
ld c, POKEGEARSTATE_RADIOINIT
ld b, POKEGEARCARD_RADIO
@@ -1590,7 +1590,7 @@
call .InJohto
jr c, .NoSignal
ld a, [wPokegearFlags]
- bit 3, a ; ENGINE_EXPN_CARD
+ bit POKEGEAR_EXPN_CARD_F, a
jr z, .NoSignal
jp LoadStation_PlacesAndPeople
@@ -1598,7 +1598,7 @@
call .InJohto
jr c, .NoSignal
ld a, [wPokegearFlags]
- bit 3, a ; ENGINE_EXPN_CARD
+ bit POKEGEAR_EXPN_CARD_F, a
jr z, .NoSignal
jp LoadStation_LetsAllSing
@@ -1606,7 +1606,7 @@
call .InJohto
jr c, .NoSignal
ld a, [wPokegearFlags]
- bit 3, a ; ENGINE_EXPN_CARD
+ bit POKEGEAR_EXPN_CARD_F, a
jr z, .NoSignal
jp LoadStation_PokeFluteRadio
--- a/engine/start_menu.asm
+++ b/engine/start_menu.asm
@@ -1,3 +1,16 @@
+; StartMenu.Items indexes
+ const_def
+ const STARTMENUITEM_POKEDEX ; 0
+ const STARTMENUITEM_POKEMON ; 1
+ const STARTMENUITEM_PACK ; 2
+ const STARTMENUITEM_STATUS ; 3
+ const STARTMENUITEM_SAVE ; 4
+ const STARTMENUITEM_OPTION ; 5
+ const STARTMENUITEM_EXIT ; 6
+ const STARTMENUITEM_POKEGEAR ; 7
+ const STARTMENUITEM_QUIT ; 8
+
+
StartMenu:: ; 125cd
call ClearWindowData
@@ -171,6 +184,7 @@
dw .Items
.Items:
+; entries correspond to STARTMENUITEM_* constants
dw StartMenu_Pokedex, .PokedexString, .PokedexDesc
dw StartMenu_Pokemon, .PartyString, .PartyDesc
dw StartMenu_Pack, .PackString, .PackDesc
@@ -181,41 +195,50 @@
dw StartMenu_Pokegear, .PokegearString, .PokegearDesc
dw StartMenu_Quit, .QuitString, .QuitDesc
-.PokedexString: db "#DEX@"
-.PartyString: db "#MON@"
-.PackString: db "PACK@"
-.StatusString: db "<PLAYER>@"
-.SaveString: db "SAVE@"
-.OptionString: db "OPTION@"
-.ExitString: db "EXIT@"
-.PokegearString: db "<POKE>GEAR@"
-.QuitString: db "QUIT@"
+.PokedexString: db "#DEX@"
+.PartyString: db "#MON@"
+.PackString: db "PACK@"
+.StatusString: db "<PLAYER>@"
+.SaveString: db "SAVE@"
+.OptionString: db "OPTION@"
+.ExitString: db "EXIT@"
+.PokegearString: db "<POKE>GEAR@"
+.QuitString: db "QUIT@"
-.PokedexDesc: db "#MON"
+.PokedexDesc:
+ db "#MON"
next "database@"
-.PartyDesc: db "Party <PKMN>"
+.PartyDesc:
+ db "Party <PKMN>"
next "status@"
-.PackDesc: db "Contains"
+.PackDesc:
+ db "Contains"
next "items@"
-.PokegearDesc: db "Trainer's"
+.PokegearDesc:
+ db "Trainer's"
next "key device@"
-.StatusDesc: db "Your own"
+.StatusDesc:
+ db "Your own"
next "status@"
-.SaveDesc: db "Save your"
+.SaveDesc:
+ db "Save your"
next "progress@"
-.OptionDesc: db "Change"
+.OptionDesc:
+ db "Change"
next "settings@"
-.ExitDesc: db "Close this"
+.ExitDesc:
+ db "Close this"
next "menu@"
-.QuitDesc: db "Quit and"
+.QuitDesc:
+ db "Quit and"
next "be judged.@"
@@ -285,7 +308,7 @@
ld hl, wStatusFlags
bit 0, [hl]
jr z, .no_pokedex
- ld a, 0 ; pokedex
+ ld a, STARTMENUITEM_POKEDEX
call .AppendMenuList
.no_pokedex
@@ -292,7 +315,7 @@
ld a, [PartyCount]
and a
jr z, .no_pokemon
- ld a, 1 ; pokemon
+ ld a, STARTMENUITEM_POKEMON
call .AppendMenuList
.no_pokemon
@@ -302,14 +325,14 @@
ld hl, wStatusFlags2
bit 2, [hl] ; bug catching contest
jr nz, .no_pack
- ld a, 2 ; pack
+ ld a, STARTMENUITEM_PACK
call .AppendMenuList
.no_pack
ld hl, wPokegearFlags
- bit 7, [hl]
+ bit POKEGEAR_OBTAINED_F, [hl]
jr z, .no_pokegear
- ld a, 7 ; pokegear
+ ld a, STARTMENUITEM_POKEGEAR
call .AppendMenuList
.no_pokegear
@@ -321,16 +344,16 @@
jr nz, .no_save
ld hl, wStatusFlags2
bit 2, [hl] ; bug catching contest
- ld a, 8 ; quit
+ ld a, STARTMENUITEM_QUIT
jr nz, .write
- ld a, 4 ; save
+ ld a, STARTMENUITEM_SAVE
.write
call .AppendMenuList
.no_save
- ld a, 5 ; option
+ ld a, STARTMENUITEM_OPTION
call .AppendMenuList
- ld a, 6 ; exit
+ ld a, STARTMENUITEM_EXIT
call .AppendMenuList
ld a, c
ld [MenuItemsList], a
@@ -383,7 +406,7 @@
.IsMenuAccountOn: ; 128cb
ld a, [Options2]
- and 1
+ and 1 << MENU_ACCOUNT
ret
; 128d1
@@ -706,26 +729,26 @@
ret
.Actions:
- dbw MONMENU_CUT, MonMenu_Cut ; Cut
- dbw MONMENU_FLY, MonMenu_Fly ; Fly
- dbw MONMENU_SURF, MonMenu_Surf ; Surf
- dbw MONMENU_STRENGTH, MonMenu_Strength ; Strength
- dbw MONMENU_FLASH, MonMenu_Flash ; Flash
- dbw MONMENU_WHIRLPOOL, MonMenu_Whirlpool ; Whirlpool
- dbw MONMENU_DIG, MonMenu_Dig ; Dig
- dbw MONMENU_TELEPORT, MonMenu_Teleport ; Teleport
- dbw MONMENU_SOFTBOILED, MonMenu_Softboiled_MilkDrink ; Softboiled
- dbw MONMENU_MILKDRINK, MonMenu_Softboiled_MilkDrink ; MilkDrink
- dbw MONMENU_HEADBUTT, MonMenu_Headbutt ; Headbutt
- dbw MONMENU_WATERFALL, MonMenu_Waterfall ; Waterfall
- dbw MONMENU_ROCKSMASH, MonMenu_RockSmash ; RockSmash
- dbw MONMENU_SWEETSCENT, MonMenu_SweetScent ; SweetScent
+ dbw MONMENU_CUT, MonMenu_Cut
+ dbw MONMENU_FLY, MonMenu_Fly
+ dbw MONMENU_SURF, MonMenu_Surf
+ dbw MONMENU_STRENGTH, MonMenu_Strength
+ dbw MONMENU_FLASH, MonMenu_Flash
+ dbw MONMENU_WHIRLPOOL, MonMenu_Whirlpool
+ dbw MONMENU_DIG, MonMenu_Dig
+ dbw MONMENU_TELEPORT, MonMenu_Teleport
+ dbw MONMENU_SOFTBOILED, MonMenu_Softboiled_MilkDrink
+ dbw MONMENU_MILKDRINK, MonMenu_Softboiled_MilkDrink
+ dbw MONMENU_HEADBUTT, MonMenu_Headbutt
+ dbw MONMENU_WATERFALL, MonMenu_Waterfall
+ dbw MONMENU_ROCKSMASH, MonMenu_RockSmash
+ dbw MONMENU_SWEETSCENT, MonMenu_SweetScent
dbw MONMENU_STATS, OpenPartyStats
dbw MONMENU_SWITCH, SwitchPartyMons
dbw MONMENU_ITEM, GiveTakePartyMonItem
dbw MONMENU_CANCEL, CancelPokemonAction
- dbw MONMENU_MOVE, ManagePokemonMoves ; move
- dbw MONMENU_MAIL, MonMailAction ; mail
+ dbw MONMENU_MOVE, ManagePokemonMoves
+ dbw MONMENU_MAIL, MonMailAction
; 12aec
@@ -749,7 +772,7 @@
farcall PrintPartyMenuText
hlcoord 0, 1
- ld bc, 20 * 2
+ ld bc, SCREEN_WIDTH * 2
ld a, [wSwitchMon]
dec a
call AddNTimes
@@ -1038,7 +1061,7 @@
ReceiveItemFromPokemon: ; 12cdf
- ld a, $1
+ ld a, 1
ld [wItemQuantityChangeBuffer], a
ld hl, NumItems
jp ReceiveItem
@@ -1046,7 +1069,7 @@
GiveItemToPokemon: ; 12cea (4:6cea)
- ld a, $1
+ ld a, 1
ld [wItemQuantityChangeBuffer], a
ld hl, NumItems
jp TossItem