Finish labelling and split off bank03, bank09, and bank0b (#119)
Some checks failed
CI / build (push) Has been cancelled

* Fully labelled bank09.asm, started bank03.asm

* Finished labelling bank03.asm and bank0b.asm

* Tying up loose ends, splitting most of the completely labelled bank dumps

* Moved pokedex letter graphics out of charmap
This commit is contained in:
DrippingYellow 2025-07-30 16:35:58 -05:00 committed by GitHub
parent 030186d4cf
commit e384ea25ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
107 changed files with 12604 additions and 10906 deletions

View File

@ -175,10 +175,6 @@ DEF ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP
const SUBSTATUS_ROLLOUT
const SUBSTATUS_IN_LOVE
; wPlayerSubStatus2 or wEnemySubStatus2 bit flags
const_def
const SUBSTATUS_CURLED
; wPlayerSubStatus3 or wEnemySubStatus3 bit flags
const_def
const SUBSTATUS_BIDE

View File

@ -273,7 +273,7 @@
charmap "▷", $ec
charmap "▶", $ed
charmap "▲", $ed
; charmap "▲", $ed
charmap "▼", $ee
charmap "♂", $ef
charmap "円", $f0

View File

@ -267,5 +267,9 @@ DEF NUM_HMS = const_value - ITEM_HM01
DEF NUM_TM_HM = NUM_TMS + NUM_HMS
; leftovers from pokered
DEF ITEM_HM01_RED EQU $c4
DEF ITEM_TM01_RED EQU $c9
DEF ITEM_X_ATTACK_RED EQU $41
DEF ITEM_ETHER_RED EQU $50
DEF ITEM_MAX_ETHER_RED EQU $51
DEF ITEM_ELIXER_RED EQU $52
DEF ITEM_HM01_RED EQU $c4
DEF ITEM_TM01_RED EQU $c9

View File

@ -17,7 +17,7 @@ DEF ITEMATTR_STRUCT_LENGTH EQU const_value
const TM_HM ; 4
; item menu types
; UseItem.dw indexes (see engine/items/pack.asm)
; DoItemEffect.dw indexes (see engine/items/pack.asm)
; UseRegisteredItem.SwitchTo indexes (see engine/overworld/select_menu.asm)
const_def
const ITEMMENU_NOUSE ; 0
@ -46,6 +46,8 @@ DEF MAX_ITEMS EQU 20
DEF MAX_KEY_ITEMS EQU 20
DEF MAX_PC_ITEMS EQU 50
DEF MAX_ITEM_STACK EQU 99
; held item effects
const_def
const HELD_NONE

View File

@ -24,8 +24,8 @@
const_def
shift_const SCROLLINGMENU_CALL_FUNCTION1_CANCEL
shift_const SCROLLINGMENU_CALL_FUNCTION3_NO_SWITCH
shift_const SCROLLINGMENU_ENABLE_LEFT
shift_const SCROLLINGMENU_ENABLE_RIGHT
shift_const SCROLLINGMENU_ENABLE_LEFT
shift_const SCROLLINGMENU_DISPLAY_ARROWS
shift_const SCROLLINGMENU_ENABLE_FUNCTION3
shift_const SCROLLINGMENU_ENABLE_START
@ -82,7 +82,7 @@ DEF HMENURETURN_SCRIPT EQU %10000000
DEF HMENURETURN_ASM EQU %11111111
; PartyMenuQualityPointers indexes (see data/party_menu_qualities.asm)
; PrintPartyMenuText indexes (see data/party_menu_qualities.asm)
const_def
const PARTYMENUACTION_CHOOSE_POKEMON
const PARTYMENUACTION_HEALING_ITEM
@ -93,7 +93,6 @@ DEF HMENURETURN_ASM EQU %11111111
const PARTYMENUACTION_GIVE_MON
const PARTYMENUACTION_GIVE_MON_FEMALE ; unused
const PARTYMENUACTION_GIVE_ITEM
const PARTYMENUACTION_MOBILE ; mobile
; PrintPartyMenuActionText arguments (see engine/pokemon/party_menu.asm)
const_def $f0
const PARTYMENUTEXT_HEAL_PSN
@ -111,6 +110,8 @@ DEF HMENURETURN_ASM EQU %11111111
const_def 1
const SCROLLINGMENU_ITEMS_NORMAL
const SCROLLINGMENU_ITEMS_QUANTITY
const_skip 4
shift_const SCROLLINGMENU_BALL_POCKET
; Naming types (see engine/menus/naming_screen.asm)
const_def

View File

@ -126,6 +126,7 @@ DEF NUM_WATERMON EQU 3 ; data/wild/*_water.asm table size
DEF GRASS_WILDDATA_LENGTH EQU (NUM_GRASSMON * 2 + 1) * 3 + 2
DEF WATER_WILDDATA_LENGTH EQU (NUM_WATERMON * 2 + 1) * 1 + 2
DEF BASE_HAPPINESS EQU 70
; PP
DEF PP_UP_MASK EQU %11000000

View File

@ -146,7 +146,7 @@ DEF NUM_SPRITEANIMDICT_ENTRIES EQU 10
const SPRITE_ANIM_OBJ_TRADE_TUBE_BULGE ; 47
const SPRITE_ANIM_OBJ_TRADEMON_ICON ; 48
const SPRITE_ANIM_OBJ_TRADEMON_BUBBLE ; 49
const SPRITE_ANIM_OBJ_4A ; 4a
const SPRITE_ANIM_OBJ_EVOLUTION_BALL_OF_LIGHT ; 4a
const SPRITE_ANIM_OBJ_RADIO_FREQUENCY_METER ; 4b
DEF NUM_SPRITE_ANIM_OBJS EQU const_value
@ -192,7 +192,7 @@ const_def
const SPRITE_ANIM_FUNC_TRADE_POKE_BALL ; 25
const SPRITE_ANIM_FUNC_TRADE_TUBE_BULGE ; 26
const SPRITE_ANIM_FUNC_TRADEMON_IN_TUBE ; 27
const SPRITE_ANIM_FUNC_UNKNOWN ; 28
const SPRITE_ANIM_FUNC_REVEAL_NEW_MON ; 28
const SPRITE_ANIM_FUNC_RADIO_FREQUENCY_METER ; 29
DEF NUM_SPRITE_ANIM_FUNCS EQU const_value
@ -235,7 +235,7 @@ DEF NUM_SPRITE_ANIM_FUNCS EQU const_value
const SPRITE_ANIM_FRAMESET_SLOTS_CHANSEY ; 22
const SPRITE_ANIM_FRAMESET_SLOTS_CHANSEY_2 ; 23
const SPRITE_ANIM_FRAMESET_SLOTS_EGG ; 24
const SPRITE_ANIM_FRAMESET_WALK ; 25
const SPRITE_ANIM_FRAMESET_WALK ; 25
const SPRITE_ANIM_FRAMESET_STILL_CURSOR ; 26
const SPRITE_ANIM_FRAMESET_TRADE_POKE_BALL ; 27
const SPRITE_ANIM_FRAMESET_TRADE_POKE_BALL_WOBBLE ; 28
@ -243,7 +243,7 @@ DEF NUM_SPRITE_ANIM_FUNCS EQU const_value
const SPRITE_ANIM_FRAMESET_TRADE_TUBE_BULGE ; 2a
const SPRITE_ANIM_FRAMESET_TRADEMON_ICON ; 2b
const SPRITE_ANIM_FRAMESET_TRADEMON_BUBBLE ; 2c
const SPRITE_ANIM_FRAMESET_UNKNOWN ; 2d
const SPRITE_ANIM_FRAMESET_EVOLUTION_BALL_OF_LIGHT ; 2d
const SPRITE_ANIM_FRAMESET_RADIO_FREQUENCY_METER ; 2e
DEF NUM_SPRITE_ANIM_FRAMESETS EQU const_value
@ -314,5 +314,5 @@ DEF NUM_SPRITE_ANIM_FRAMESETS EQU const_value
const SPRITE_ANIM_OAMSET_TRADEMON_ICON_1 ; 3e
const SPRITE_ANIM_OAMSET_TRADEMON_ICON_2 ; 3f
const SPRITE_ANIM_OAMSET_TRADEMON_BUBBLE ; 40
const SPRITE_ANIM_OAMSET_UNKNOWN_41 ; 41
const SPRITE_ANIM_OAMSET_EVOLUTION_BALL_OF_LIGHT ; 41
const SPRITE_ANIM_OAMSET_RADIO_FREQUENCY_METER ; 42

View File

@ -1,9 +1,10 @@
; name lengths
DEF NAME_LENGTH EQU 11 ; English
DEF PLAYER_NAME_LENGTH EQU 6 ; Japanese
DEF BOX_NAME_LENGTH EQU 9 ; English
DEF BOX_NAME_LENGTH EQU 9
DEF MON_NAME_LENGTH EQU 6
DEF MOVE_NAME_LENGTH EQU 5
DEF TYPE_NAME_LENGTH EQU 5
DEF MOVE_NAME_LENGTH EQU 8
DEF ITEM_NAME_LENGTH EQU 11
DEF TRAINER_CLASS_NAME_LENGTH EQU 13 ; English

View File

@ -21,6 +21,22 @@ DEF SCRIPTED_MOVEMENT_STATE_F EQU 7
DEF SPRITES_SKIP_WALKING_GFX_F EQU 6
DEF SPRITES_SKIP_STANDING_GFX_F EQU 7
; wPokemonWithdrawDepositParameter::
DEF PC_WITHDRAW EQU 0
DEF PC_DEPOSIT EQU 1
DEF REMOVE_PARTY EQU 0
DEF REMOVE_BOX EQU 1
DEF BUFFERMON_WITHDRAW EQU 2
DEF BUFFERMON_DEPOSIT EQU 3
DEF GET_BUFFER_MON EQU 0
DEF GET_BREED_MON EQU 1
; wBreederStatus::
DEF BREEDER_ONE_BREEDMON EQU 1
DEF BREEDER_TWO_BREEDMON EQU 2
DEF BREEDER_EGG_READY EQU 3
DEF BREEDER_GAVE_EGG EQU 4
; wPlayerStepFlags::
const_def 4
const PLAYERSTEP_MIDAIR_F ; 4

97
data/items/super_rod.inc Normal file
View File

@ -0,0 +1,97 @@
; Old super rod encounter table.
SuperRodData:
dbw $00, .Group1 ; PALLET_TOWN
dbw $01, .Group1 ; VIRIDIAN_CITY
dbw $03, .Group3 ; CERULEAN_CITY
dbw $05, .Group4 ; VERMILION_CITY
dbw $06, .Group5 ; CELADON_CITY
dbw $07, .Group10 ; FUCHSIA_CITY
dbw $08, .Group8 ; CINNABAR_ISLAND
dbw $0f, .Group3 ; ROUTE_4
dbw $11, .Group4 ; ROUTE_6
dbw $15, .Group5 ; ROUTE_10
dbw $16, .Group4 ; ROUTE_11
dbw $17, .Group7 ; ROUTE_12
dbw $18, .Group7 ; ROUTE_13
dbw $1c, .Group7 ; ROUTE_17
dbw $1d, .Group7 ; ROUTE_18
dbw $1e, .Group8 ; ROUTE_19
dbw $1f, .Group8 ; ROUTE_20
dbw $20, .Group8 ; ROUTE_21
dbw $21, .Group2 ; ROUTE_22
dbw $22, .Group9 ; ROUTE_23
dbw $23, .Group3 ; ROUTE_24
dbw $24, .Group3 ; ROUTE_25
dbw $41, .Group3 ; CERULEAN_GYM
dbw $5e, .Group4 ; VERMILION_DOCK
dbw $a1, .Group8 ; SEAFOAM_ISLANDS_B3F
dbw $a2, .Group8 ; SEAFOAM_ISLANDS_B4F
dbw $d9, .Group6 ; SAFARI_ZONE_EAST
dbw $da, .Group6 ; SAFART_ZONE_NORTH
dbw $db, .Group6 ; SAFARI_ZONE_WEST
dbw $dc, .Group6 ; SAFARI_ZONE_CENTER
dbw $e2, .Group9 ; CERULEAN_CAVE_2F
dbw $e3, .Group9 ; CERULEAN_CAVE_B1F
dbw $e4, .Group9 ; CERLIEAN_CAVE_1F
db -1 ; end
.Group1:
db 2
db 15, MON_TENTACOOL
db 15, MON_POLIWAG
.Group2:
db 2
db 15, MON_GOLDEEN
db 15, MON_POLIWAG
.Group3:
db 3
db 15, MON_PSYDUCK
db 15, MON_GOLDEEN
db 15, MON_KRABBY
.Group4:
db 2
db 15, MON_KRABBY
db 15, MON_SHELLDER
.Group5:
db 2
db 23, MON_POLIWHIRL
db 15, MON_SLOWPOKE
.Group6:
db 4
db 15, MON_DRATINI
db 15, MON_KRABBY
db 15, MON_PSYDUCK
db 15, MON_SLOWPOKE
.Group7:
db 4
db 5, MON_TENTACOOL
db 15, MON_KRABBY
db 15, MON_GOLDEEN
db 15, MON_MAGIKARP
.Group8:
db 4
db 15, MON_STARYU
db 15, MON_HORSEA
db 15, MON_SHELLDER
db 15, MON_GOLDEEN
.Group9:
db 4
db 23, MON_SLOWBRO
db 23, MON_SEAKING
db 23, MON_KINGLER
db 23, MON_SEADRA
.Group10:
db 4
db 23, MON_SEAKING
db 15, MON_KRABBY
db 15, MON_GOLDEEN
db 15, MON_MAGIKARP

83
data/mon_menu.inc Normal file
View File

@ -0,0 +1,83 @@
; An unreferenced, nonfunctional menu that resembles the field debug menu.
Unreferenced_FieldMoveMenu:
ld hl, .MenuData
call LoadMenuHeader
call VerticalMenu
ret
.MenuData:
db MENU_BACKUP_TILES
menu_coords 0, 0, 6, 10
dw .MenuText
db 1
.MenuText:
db (STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING)
db 3 ; amount of options
db "うる@" ; Switch
db "かう@" ; Buy
db "やめる@" ; Cancel
db "くさかり@" ; "Mower"? (replaced by Uproot)
db "とんでけ@" ; "Flight"? (replaced by Wind Ride)
db "どんぶらこ@" ; "Splash"? (replaced by Water Sport)
db "フルパワー@" ; "Full Power" (replaced by Strong Arm)
db "ひかりゴケ@" ; Bright Moss
db "うずしお@" ; Whirlpool
db "とびはねる@" ; Bounce
db "あなをほる@" ; Dig
db "テレポート@" ; Teleport
db "タマゴうみ@" ; Softboiled
; MonMenuOptionStrings indexes
const_def 1
const MONMENUVALUE_STATS ; 1
const MONMENUVALUE_SWITCH ; 2
const MONMENUVALUE_ITEM ; 3
const MONMENUVALUE_CANCEL ; 4
const MONMENUVALUE_MOVE ; 5
const MONMENUVALUE_MAIL ; 6
const MONMENUVALUE_ERROR ; 7
DEF NUM_MONMENUVALUES EQU const_value - 1
MonMenuOptionStrings:
db "つよさをみる@" ; Stats
db "ならびかえ@" ; Switch
db "そうび@" ; Item
db "キャンセル@" ; Cancel
db "もちわざ@" ; Moves
db "メール@" ; Mail
db "エラー!@" ; Error!
Unreferenced_FieldMoveList:
db MOVE_UPROOT, MONMENUITEM_CUT
db MOVE_WIND_RIDE, MONMENUITEM_FLY
db MOVE_WATER_SPORT, MONMENUITEM_SURF
db MOVE_STRONG_ARM, MONMENUITEM_STRENGTH
db MOVE_BRIGHT_MOSS, MONMENUITEM_FLASH
db MOVE_WHIRLPOOL, MONMENUITEM_WHIRLPOOL
db MOVE_BOUNCE, MONMENUITEM_BOUNCE
db MOVE_DIG, MONMENUITEM_DIG
db MOVE_TELEPORT, MONMENUITEM_TELEPORT
db MOVE_SOFTBOILED, MONMENUITEM_SOFTBOILED
db -1
MonMenuOptions:
db MONMENU_FIELD_MOVE, MONMENUITEM_CUT, MOVE_UPROOT
db MONMENU_FIELD_MOVE, MONMENUITEM_FLY, MOVE_WIND_RIDE
db MONMENU_FIELD_MOVE, MONMENUITEM_SURF, MOVE_WATER_SPORT
db MONMENU_FIELD_MOVE, MONMENUITEM_STRENGTH, MOVE_STRONG_ARM
db MONMENU_FIELD_MOVE, MONMENUITEM_FLASH, MOVE_BRIGHT_MOSS
db MONMENU_FIELD_MOVE, MONMENUITEM_WHIRLPOOL, MOVE_WHIRLPOOL
db MONMENU_FIELD_MOVE, MONMENUITEM_BOUNCE, MOVE_BOUNCE
db MONMENU_FIELD_MOVE, MONMENUITEM_DIG, MOVE_DIG
db MONMENU_FIELD_MOVE, MONMENUITEM_TELEPORT, MOVE_TELEPORT
db MONMENU_FIELD_MOVE, MONMENUITEM_SOFTBOILED, MOVE_SOFTBOILED
db MONMENU_MENUOPTION, MONMENUITEM_STATS, MONMENUVALUE_STATS
db MONMENU_MENUOPTION, MONMENUITEM_SWITCH, MONMENUVALUE_SWITCH
db MONMENU_MENUOPTION, MONMENUITEM_ITEM, MONMENUVALUE_ITEM
db MONMENU_MENUOPTION, MONMENUITEM_CANCEL, MONMENUVALUE_CANCEL
db MONMENU_MENUOPTION, MONMENUITEM_MOVE, MONMENUVALUE_MOVE
db MONMENU_MENUOPTION, MONMENUITEM_MAIL, MONMENUVALUE_MAIL
db MONMENU_MENUOPTION, MONMENUITEM_ERROR, MONMENUVALUE_ERROR
db -1

View File

@ -17,8 +17,8 @@ EvosAttacks::
; - Evolution methods:
; * db EVOLVE_LEVEL, level, dex
; * db EVOLVE_STONE, 1, used item, dex
; * db EVOLVE_ITEM, 1, held? item, dex
; * db EVOLVE_TRADE, 1, dex
; * db EVOLVE_ITEM, min level (1), held? item, dex
; * db EVOLVE_TRADE, min level (1), dex
; - db 0 ; no more evolutions
; - Learnset (in increasing level order):
; * db level, move

260
data/pokemon/gen1_order.inc Normal file
View File

@ -0,0 +1,260 @@
Pokered_MonIndices::
; BUG: Notice anything odd about this list? There are only 250 entries; Riifi is missing!
; Presumably, it was such a recent addition that it hadn't yet been included in this list.
; This causes ConvertMon_2to1 to search out of bounds for byte $FB, eventually finding it and loading Nidorina's cry.
; Note that in the final game, Celebi is also missing from this list, meaning that they never actually fixed this
; before they switched the cry order to match the Pokédex order.
db DEX_RHYDON ; 01
db DEX_KANGASKHAN ; 02
db DEX_NIDORAN_M ; 03
db DEX_CLEFAIRY ; 04
db DEX_SPEAROW ; 05
db DEX_VOLTORB ; 06
db DEX_NIDOKING ; 07
db DEX_SLOWBRO ; 08
db DEX_IVYSAUR ; 09
db DEX_EXEGGUTOR ; 0a
db DEX_LICKITUNG ; 0b
db DEX_EXEGGCUTE ; 0c
db DEX_GRIMER ; 0d
db DEX_GENGAR ; 0e
db DEX_NIDORAN_F ; 0f
db DEX_NIDOQUEEN ; 10
db DEX_CUBONE ; 11
db DEX_RHYHORN ; 12
db DEX_LAPRAS ; 13
db DEX_ARCANINE ; 14
db DEX_MEW ; 15
db DEX_GYARADOS ; 16
db DEX_SHELLDER ; 17
db DEX_TENTACOOL ; 18
db DEX_GASTLY ; 19
db DEX_SCYTHER ; 1a
db DEX_STARYU ; 1b
db DEX_BLASTOISE ; 1c
db DEX_PINSIR ; 1d
db DEX_TANGELA ; 1e
db DEX_KAPOERER ; 1f
db DEX_PUDIE ; 20
db DEX_GROWLITHE ; 21
db DEX_ONIX ; 22
db DEX_FEAROW ; 23
db DEX_PIDGEY ; 24
db DEX_SLOWPOKE ; 25
db DEX_KADABRA ; 26
db DEX_GRAVELER ; 27
db DEX_CHANSEY ; 28
db DEX_MACHOKE ; 29
db DEX_MRMIME ; 2a
db DEX_HITMONLEE ; 2b
db DEX_HITMONCHAN ; 2c
db DEX_ARBOK ; 2d
db DEX_PARASECT ; 2e
db DEX_PSYDUCK ; 2f
db DEX_DROWZEE ; 30
db DEX_GOLEM ; 31
db DEX_HANEKO ; 32
db DEX_MAGMAR ; 33
db DEX_TAIL ; 34
db DEX_ELECTABUZZ ; 35
db DEX_MAGNETON ; 36
db DEX_KOFFING ; 37
db DEX_POPONEKO ; 38
db DEX_MANKEY ; 39
db DEX_SEEL ; 3a
db DEX_DIGLETT ; 3b
db DEX_TAUROS ; 3c
db DEX_WATANEKO ; 3d
db DEX_BARIRINA ; 3e
db DEX_LIP ; 3f
db DEX_FARFETCHD ; 40
db DEX_VENONAT ; 41
db DEX_DRAGONITE ; 42
db DEX_ELEBABY ; 43
db DEX_BOOBY ; 44
db DEX_KIREIHANA ; 45
db DEX_DODUO ; 46
db DEX_POLIWAG ; 47
db DEX_JYNX ; 48
db DEX_MOLTRES ; 49
db DEX_ARTICUNO ; 4a
db DEX_ZAPDOS ; 4b
db DEX_DITTO ; 4c
db DEX_MEOWTH ; 4d
db DEX_KRABBY ; 4e
db DEX_TSUBOMITTO ; 4f
db DEX_MILTANK ; 50
db DEX_BOMBSEEKER ; 51
db DEX_VULPIX ; 52
db DEX_NINETALES ; 53
db DEX_PIKACHU ; 54
db DEX_RAICHU ; 55
db DEX_GIFT ; 56
db DEX_KOTORA ; 57
db DEX_DRATINI ; 58
db DEX_DRAGONAIR ; 59
db DEX_KABUTO ; 5a
db DEX_KABUTOPS ; 5b
db DEX_HORSEA ; 5c
db DEX_SEADRA ; 5d
db DEX_RAITORA ; 5e
db DEX_MADAME ; 5f
db DEX_SANDSHREW ; 60
db DEX_SANDSLASH ; 61
db DEX_OMANYTE ; 62
db DEX_OMASTAR ; 63
db DEX_JIGGLYPUFF ; 64
db DEX_WIGGLYTUFF ; 65
db DEX_EEVEE ; 66
db DEX_FLAREON ; 67
db DEX_JOLTEON ; 68
db DEX_VAPOREON ; 69
db DEX_MACHOP ; 6a
db DEX_ZUBAT ; 6b
db DEX_EKANS ; 6c
db DEX_PARAS ; 6d
db DEX_POLIWHIRL ; 6e
db DEX_POLIWRATH ; 6f
db DEX_WEEDLE ; 70
db DEX_KAKUNA ; 71
db DEX_BEEDRILL ; 72
db DEX_NOROWARA ; 73
db DEX_DODRIO ; 74
db DEX_PRIMEAPE ; 75
db DEX_DUGTRIO ; 76
db DEX_VENOMOTH ; 77
db DEX_DEWGONG ; 78
db DEX_KYONPAN ; 79
db DEX_YAMIKARASU ; 7a
db DEX_CATERPIE ; 7b
db DEX_METAPOD ; 7c
db DEX_BUTTERFREE ; 7d
db DEX_MACHAMP ; 7e
db DEX_HAPPI ; 7f
db DEX_GOLDUCK ; 80
db DEX_HYPNO ; 81
db DEX_GOLBAT ; 82
db DEX_MEWTWO ; 83
db DEX_SNORLAX ; 84
db DEX_MAGIKARP ; 85
db DEX_SCISSORS ; 86
db DEX_PURAKKUSU ; 87
db DEX_MUK ; 88
db DEX_DEVIL ; 89
db DEX_KINGLER ; 8a
db DEX_CLOYSTER ; 8b
db DEX_HELGAA ; 8c
db DEX_ELECTRODE ; 8d
db DEX_CLEFABLE ; 8e
db DEX_WEEZING ; 8f
db DEX_PERSIAN ; 90
db DEX_MAROWAK ; 91
db DEX_WOLFMAN ; 92
db DEX_HAUNTER ; 93
db DEX_ABRA ; 94
db DEX_ALAKAZAM ; 95
db DEX_PIDGEOTTO ; 96
db DEX_PIDGEOT ; 97
db DEX_STARMIE ; 98
db DEX_BULBASAUR ; 99
db DEX_VENUSAUR ; 9a
db DEX_TENTACRUEL ; 9b
db DEX_WARWOLF ; 9c
db DEX_GOLDEEN ; 9d
db DEX_SEAKING ; 9e
db DEX_PORYGON2 ; 9f
db DEX_NAMEIL ; a0
db DEX_HAGANEIL ; a1
db DEX_KINGDRA ; a2
db DEX_PONYTA ; a3
db DEX_RAPIDASH ; a4
db DEX_RATTATA ; a5
db DEX_RATICATE ; a6
db DEX_NIDORINO ; a7
db DEX_NIDORINA ; a8
db DEX_GEODUDE ; a9
db DEX_PORYGON ; aa
db DEX_AERODACTYL ; ab
db DEX_RAI ; ac
db DEX_MAGNEMITE ; ad
db DEX_EN ; ae
db DEX_SUI ; af
db DEX_CHARMANDER ; b0
db DEX_SQUIRTLE ; b1
db DEX_CHARMELEON ; b2
db DEX_WARTORTLE ; b3
db DEX_CHARIZARD ; b4
db DEX_NYULA ; b5
db DEX_HOUOU ; b6
db DEX_TOGEPY ; b7
db DEX_BULU ; b8
db DEX_ODDISH ; b9
db DEX_GLOOM ; ba
db DEX_VILEPLUME ; bb
db DEX_BELLSPROUT ; bc
db DEX_WEEPINBELL ; bd
db DEX_VICTREEBEL ; be
db DEX_HAPPA ; bf
db DEX_HANAMOGURA ; c0
db DEX_HANARYU ; c1
db DEX_HONOGUMA ; c2
db DEX_VOLBEAR ; c3
db DEX_DYNABEAR ; c4
db DEX_KURUSU ; c5
db DEX_AQUA ; c6
db DEX_AQUARIA ; c7
db DEX_HOHO ; c8
db DEX_BOBO ; c9
db DEX_PACHIMEE ; ca
db DEX_MOKOKO ; cb
db DEX_DENRYU ; cc
db DEX_MIKON ; cd
db DEX_MONJA ; ce
db DEX_JARANRA ; cf
db DEX_HANEEI ; d0
db DEX_PUKU ; d1
db DEX_SHIBIREFUGU ; d2
db DEX_PICHU ; d3
db DEX_PY ; d4
db DEX_PUPURIN ; d5
db DEX_MIZUUO ; d6
db DEX_NATY ; d7
db DEX_NATIO ; d8
db DEX_GYOPIN ; d9
db DEX_MARIL ; da
db DEX_MANBO1 ; db
db DEX_IKARI ; dc
db DEX_GROTESS ; dd
db DEX_EKSING ; de
db DEX_PARA ; df
db DEX_KOKUMO ; e0
db DEX_TWOHEAD ; e1
db DEX_YOROIDORI ; e2
db DEX_ANIMON ; e3
db DEX_HINAZU ; e4
db DEX_SUNNY ; e5
db DEX_PAON ; e6
db DEX_DONPHAN ; e7
db DEX_TWINZ ; e8
db DEX_KIRINRIKI ; e9
db DEX_PAINTER ; ea
db DEX_KOUNYA ; eb
db DEX_RINRIN ; ec
db DEX_BERURUN ; ed
db DEX_NYOROTONO ; ee
db DEX_YADOKING ; ef
db DEX_ANNON ; f0
db DEX_REDIBA ; f1
db DEX_MITSUBOSHI ; f2
db DEX_PUCHICORN ; f3
db DEX_EIFIE ; f4
db DEX_BLACKY ; f5
db DEX_TURBAN ; f6
db DEX_BETBABY ; f7
db DEX_TEPPOUO ; f8
db DEX_OKUTANK ; f9
db DEX_GONGU ; fa
db DEX_REDIBA ; fb
db DEX_REDIBA ; fc

View File

@ -28,34 +28,34 @@ GiveItemPredef::
dbw 3, GiveItem
add_predef ComputeHPBarPixels
add_predef FillPP
add_predef Functiond886 ; 10
add_predef Functionda4f
add_predef Functiondac8
add_predef Functiondcfc
add_predef Functiondc16
add_predef Functiondd5c
add_predef Functionde79
add_predef TryAddMonToParty ; 10
add_predef AddTempmonToParty
add_predef SendGetMonIntoFromBox
add_predef DepositBreedmonOrBuffermon
add_predef RetrieveBreedmonOrBuffermon
add_predef SendMonIntoBox
add_predef GiveEgg
add_predef UpdateHPBar
add_predef CalcMonStats ; 18
add_predef CalcMonStatC
add_predef CanLearnTMHMMove
add_predef GetTMHMMove
add_predef LinkTextboxAtHL
add_predef Function2d663
add_predef PrintMoveDescription
add_predef UpdatePlayerHUD
add_predef PlaceGraphic
add_predef Function3f068 ; 20
add_predef LoadMonBackPic
add_predef AnyPartyAlive
add_predef UpdateEnemyHUD
add_predef Function3e1a4
add_predef DoubleOrHalveSelectedStats_Old
add_predef Function3ef19
add_predef CalcAndPlaceExpBar
add_predef GetBattleMonBackpic
add_predef GetEnemyMonFrontpic ; 28
add_predef Function421f8
add_predef LearnLevelMoves
add_predef FillMoves
add_predef Function41fa1
add_predef EvolveAfterBattle
add_predef Function28da4
add_predef Function28d6e
add_predef NewPokedexEntry
@ -65,13 +65,13 @@ GiveItemPredef::
add_predef ListMoves
add_predef GetMonBackpic
add_predef PlaceNonFaintStatus
add_predef Function508c4
add_predef PartyMenuInBattle_Setup
add_predef PartyMenuInBattle
add_predef Function5081f ; 38
add_predef PlacePartyMember
add_predef OpenPartyMenu_ClearGraphics
add_predef OpenPartyMenu
add_predef InitPartyMenuLayout ; 38
add_predef ListMovePP
add_predef GetGender
add_predef Function502b5
add_predef StatsScreenMain
add_predef DrawPlayerHP
add_predef DrawEnemyHP
add_predef GetTypeName

View File

@ -50,7 +50,7 @@ BlkPacket_SlotMachine:
attr_blk_data %011, 0,0,0, 04,04, 15,09
attr_blk_data %011, 0,0,0, 00,12, 19,17
BlkPacket_98fc:
BlkPacket_PartyMenu:
attr_blk 7
attr_blk_data %111, 0,0,1, 00,00, 02,12
attr_blk_data %010, 0,0,0, 12,00, 18,01

View File

@ -44,7 +44,7 @@ SpriteAnimFrameData:
dw .Frameset_TradeTubeBulge ; SPRITE_ANIM_FRAMESET_TRADE_TUBE_BULGE
dw .Frameset_TrademonIcon ; SPRITE_ANIM_FRAMESET_TRADEMON_ICON
dw .Frameset_TrademonBubble ; SPRITE_ANIM_FRAMESET_TRADEMON_BUBBLE
dw .Frameset_Unknown ; SPRITE_ANIM_FRAMESET_UNKNOWN
dw .Frameset_EvolutionBallOfLight ; SPRITE_ANIM_FRAMESET_EVOLUTION_BALL_OF_LIGHT
dw .Frameset_RadioFrequencyMeter ; SPRITE_ANIM_FRAMESET_RADIO_FREQUENCY_METER
.Frameset_00:
@ -275,8 +275,8 @@ SpriteAnimFrameData:
oamframe SPRITE_ANIM_OAMSET_TRADEMON_BUBBLE, 32
oamend
.Frameset_Unknown:
oamframe SPRITE_ANIM_OAMSET_UNKNOWN_41, 32
.Frameset_EvolutionBallOfLight:
oamframe SPRITE_ANIM_OAMSET_EVOLUTION_BALL_OF_LIGHT, 32
oamend
.Frameset_RadioFrequencyMeter:

View File

@ -70,7 +70,7 @@ SpriteAnimOAMData:
spriteanimoam $00, .OAMData_Walk ; SPRITE_ANIM_OAMSET_TRADEMON_ICON_1
spriteanimoam $04, .OAMData_Walk ; SPRITE_ANIM_OAMSET_TRADEMON_ICON_2
spriteanimoam $10, .OAMData_TradePoofBubble ; SPRITE_ANIM_OAMSET_TRADEMON_BUBBLE
spriteanimoam $00, .OAMData_Unknown1 ; SPRITE_ANIM_OAMSET_UNKNOWN_41
spriteanimoam $00, .OAMData_Unknown1 ; SPRITE_ANIM_OAMSET_EVOLUTION_BALL_OF_LIGHT
spriteanimoam $00, .OAMData_RadioFrequencyMeter ; SPRITE_ANIM_OAMSET_RADIO_FREQUENCY_METER
.OAMData_1x1_Palette0:

View File

@ -149,7 +149,7 @@ SpriteAnimObjects:
db SPRITE_ANIM_FRAMESET_TRADEMON_ICON, SPRITE_ANIM_FUNC_TRADEMON_IN_TUBE, SPRITE_ANIM_DICT_DEFAULT
; SPRITE_ANIM_OBJ_TRADEMON_BUBBLE
db SPRITE_ANIM_FRAMESET_TRADEMON_BUBBLE, SPRITE_ANIM_FUNC_TRADEMON_IN_TUBE, SPRITE_ANIM_DICT_DEFAULT
; SPRITE_ANIM_OBJ_4A
db SPRITE_ANIM_FRAMESET_UNKNOWN, SPRITE_ANIM_FUNC_UNKNOWN, SPRITE_ANIM_DICT_DEFAULT
; SPRITE_ANIM_OBJ_EVOLUTION_BALL_OF_LIGHT
db SPRITE_ANIM_FRAMESET_EVOLUTION_BALL_OF_LIGHT, SPRITE_ANIM_FUNC_REVEAL_NEW_MON, SPRITE_ANIM_DICT_DEFAULT
; SPRITE_ANIM_OBJ_RADIO_FREQUENCY_METER
db SPRITE_ANIM_FRAMESET_RADIO_FREQUENCY_METER, SPRITE_ANIM_FUNC_RADIO_FREQUENCY_METER, SPRITE_ANIM_DICT_DEFAULT

220
engine/battle/menu.asm Normal file
View File

@ -0,0 +1,220 @@
INCLUDE "constants.asm"
SECTION "engine/battle/menu.asm", ROMX
LoadBattleMenu::
ld hl, BattleMenuHeader
jr CommonBattleMenu
; Unreferenced.
SafariBattleMenu::
ld hl, SafariBattleMenuHeader
; fallthrough
CommonBattleMenu:
call LoadMenuHeader
ld a, [wBattleMenuCursorPosition]
ld [wMenuCursorPosition], a
call Battle_2DMenu
ld a, [wMenuCursorPosition]
ld [wBattleMenuCursorPosition], a
call ExitMenu
ret
BattleMenuHeader:
db MENU_BACKUP_TILES
menu_coords 9, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
dw .MenuData
db 1
.MenuData:
db STATICMENU_CURSOR
dn 2, 2
db 5
db "たたかう@" ; "FIGHT"
db "どうぐ@" ; "ITEM"
db "#@" ; "<PK><MN>"
db "にげる@" ; "RUN"
SafariBattleMenuHeader:
db MENU_BACKUP_TILES
menu_coords 0, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
dw .MenuData
db 1
.MenuData:
db STATICMENU_CURSOR
dn 2, 2
db 11
db "サファりボール×   @" ; "SAFARI BALL× @"
db "エサをなげる@" ; "THROW BAIT"
db "いしをなげる@" ; "THROW ROCK"
db "にげる@" ; "RUN"
Battle_2DMenu:
call CopyMenuData
call MenuBox
ld a, [wMenuData_2DMenuDimensions]
ld b, a
and $0f
ld [wBattleMenuRows], a ; rows
ld a, b
and $f0
swap a
ld [wBattleMenuColumns], a ; columns
call .PlaceStrings
call .InitAndHandleCursor
call StaticMenuJoypad
ldh a, [hJoySum]
bit SELECT_F, a
jr nz, .quit
ld a, [w2DMenuNumRows]
ld c, a
ld a, [wMenuCursorY]
dec a
call .GetNewCursorPos
ld c, a
ld a, [wMenuCursorX]
add c
ld [wMenuCursorPosition], a
and a
ret
.quit
scf
ret
.GetNewCursorPos:
and a
ret z
push bc
ld b, a
xor a
.loop
add c
dec b
jr nz, .loop
pop bc
ret
.unreferenced_24baf:
ld b, 0
.loop2
inc b
sub c
jr nc, .loop2
dec b
add c
ret
.PlaceStrings:
ld hl, wMenuDataPointer
ld a, [hli]
ld h, [hl]
ld l, a
ld de, 3
add hl, de
ld d, h
ld e, l
call GetMenuTextStartCoord
call Coord2Tile
ld a, [wBattleMenuRows]
ld b, a
.column_loop
push bc
push hl
ld a, [wBattleMenuColumns]
ld c, a
.row_loop
push bc
call PlaceString
inc de
ld a, [wMenuData_2DMenuSpacing]
ld c, a
ld b, 0
add hl, bc
pop bc
dec c
jr nz, .row_loop
pop hl
ld bc, 2 * SCREEN_WIDTH
add hl, bc
pop bc
dec b
jr nz, .column_loop
ret
.InitAndHandleCursor:
call GetMenuTextStartCoord
ld a, b
ld [w2DMenuCursorInitY], a
dec c
ld a, c
ld [w2DMenuCursorInitX], a
ld a, [wBattleMenuRows]
ld [w2DMenuNumRows], a
ld a, [wBattleMenuColumns]
ld [w2DMenuNumCols], a
ld a, [wMenuDataFlags]
ld d, a
bit STATICMENU_WRAP_F, d
ld a, 0
jr z, .no_wrap
ld a, _2DMENU_WRAP_LEFT_RIGHT | _2DMENU_WRAP_UP_DOWN
.no_wrap
ld [w2DMenuFlags1], a
ld a, [wMenuData_2DMenuSpacing]
or $20
ld [w2DMenuCursorOffsets], a
ld a, A_BUTTON | SELECT
ld [wMenuJoypadFilter], a
ld a, [w2DMenuNumCols]
ld e, a
ld a, [wMenuCursorPosition]
ld b, a
xor a
ld d, 0
.loop3
inc d
add e
cp b
jr c, .loop3
sub e
ld c, a
ld a, b
sub c
and a
jr z, .left_wrap
cp e
jr z, .right_wrap
jr c, .right_wrap
.left_wrap
ld a, 1
.right_wrap
ld [wMenuCursorX], a
ld a, [w2DMenuNumRows]
ld e, a
ld a, d
and a
jr z, .up_wrap
cp e
jr z, .down_wrap
jr c, .down_wrap
.up_wrap
ld a, 1
.down_wrap
ld [wMenuCursorY], a
xor a
ld [wCursorOffCharacter], a
ld [wCursorCurrentTile], a
ld [wCursorCurrentTile + 1], a
ret

View File

@ -1,6 +1,6 @@
INCLUDE "constants.asm"
SECTION "engine/battle_anims/helper.asm", ROMX
SECTION "engine/battle_anims/helpers.asm", ROMX
ReinitBattleAnimFrameset:
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID

View File

@ -0,0 +1,72 @@
INCLUDE "constants.asm"
SECTION "engine/battle_anims/pokeball_wobble.asm", ROMX
GetPokeBallWobble:
; Returns whether a Poke Ball will wobble in the catch animation.
; Whether a Pokemon is caught is determined beforehand.
ld a, [wThrownBallWobbleCount]
inc a
ld [wThrownBallWobbleCount], a
; Wobble up to 3 times.
cp 3 + 1
jr z, .finished
ld a, [wWildMon]
and a
ld c, 0 ; next
ret nz
ld hl, WobbleProbabilities
ld a, [wFinalCatchRate]
ld b, a
.loop
ld a, [hli]
cp b
jr nc, .checkwobble
inc hl
jr .loop
.checkwobble
ld b, [hl]
call Random
cp b
ld c, 0 ; next
ret c
ld c, 2 ; escaped
ret
.finished
ld a, [wWildMon]
and a
ld c, 1 ; caught
ret nz
ld c, 2 ; escaped
ret
WobbleProbabilities:
; catch rate, chance of wobbling / 255
; nLeft/255 = (nRight/255) ** 4
db 1, 63
db 2, 75
db 3, 84
db 4, 90
db 5, 95
db 7, 103
db 10, 113
db 15, 126
db 20, 134
db 30, 149
db 40, 160
db 50, 169
db 60, 177
db 80, 191
db 100, 201
db 120, 211
db 140, 220
db 160, 227
db 180, 234
db 200, 240
db 220, 246
db 240, 251
db 254, 253
db 255, 255

View File

@ -137,17 +137,17 @@ SetDemoEventFlags:
set 2, [hl] ; beat rival in lab
ld hl, wd41b
set 2, [hl] ; chose a starter
ld a, %1
ld a, 1
ld [wd29a], a
ld a, %1
ld a, 1
ld [wd29b], a
ld a, %110
ld a, 6
ld [wd29c], a
ld a, %10010
ld a, 18
ld [wd29d], a
ld a, %110
ld a, 6
ld [wd29e], a
ld a, %10
ld a, 2
ld [wd2a0], a
ret

View File

@ -5,7 +5,7 @@ FieldDebug_ChangeTileset:
call LoadMenuHeader
ld a, [wMapTileset]
inc a
ld [wMenuCursorBuffer], a
ld [wMenuCursorPosition], a
call VerticalMenu
call CloseWindow
jr c, .reopen

View File

@ -3,7 +3,7 @@ FieldDebug_ChangeTransportation:
call LoadMenuHeader
ld a, [wPlayerState]
call GetActiveTransportation
ld [wMenuCursorBuffer], a
ld [wMenuCursorPosition], a
dec a
call CopyNameFromMenu
call VerticalMenu

View File

@ -10,7 +10,7 @@ ItemTest_BagMenu:
db 1
.MenuData:
db SCROLLINGMENU_ENABLE_LEFT | SCROLLINGMENU_ENABLE_RIGHT | SCROLLINGMENU_ENABLE_FUNCTION3
db SCROLLINGMENU_ENABLE_RIGHT | SCROLLINGMENU_ENABLE_LEFT | SCROLLINGMENU_ENABLE_FUNCTION3
db 4, 8 ; rows, columns
db SCROLLINGMENU_ITEMS_QUANTITY
dbw 0, wItems
@ -34,7 +34,7 @@ ItemTest_KeyItemMenu:
db 1
.MenuData:
db SCROLLINGMENU_ENABLE_LEFT | SCROLLINGMENU_ENABLE_RIGHT | SCROLLINGMENU_ENABLE_FUNCTION3
db SCROLLINGMENU_ENABLE_RIGHT | SCROLLINGMENU_ENABLE_LEFT | SCROLLINGMENU_ENABLE_FUNCTION3
db 4, 8 ; rows, columns
db SCROLLINGMENU_ITEMS_QUANTITY
dbw 0, wNumKeyItems
@ -73,7 +73,7 @@ FieldDebug_ItemTest:
call .ClearTilemap
.bag_menu
ld hl, ItemTest_BagMenu
call Function3810
call ScrollingMenu_FromTable
ld a, [wMenuJoypad]
cp B_BUTTON
jr z, .exit_menu
@ -85,7 +85,7 @@ FieldDebug_ItemTest:
.key_item_menu
ld hl, ItemTest_KeyItemMenu
call Function3810
call ScrollingMenu_FromTable
ld a, [wMenuJoypad]
cp B_BUTTON
jr z, .exit_menu
@ -243,11 +243,11 @@ FieldDebug_ItemTest:
ld a, [wCurItem]
call ItemTest_FindUsableItem
jr c, .use_item2
call UseItem
call DoItemEffect
jp .restart
.use_item
call UseItem
call DoItemEffect
ld a, [wFieldMoveSucceeded]
and a
jp z, .restart
@ -255,7 +255,7 @@ FieldDebug_ItemTest:
ret
.use_item2
call UseItem
call DoItemEffect
call ClearBGPalettes
call RestoreScreenAndReloadTiles
jp .restart

View File

@ -178,7 +178,7 @@ DebugMapViewer_ShowViewerPrompt:
ld a, DEBUGMAPVIEWER_MOVE_CURSOR_TO_PLAYER
ldh [hDebugMapViewerJumptable], a
.no
call Function1fea
call ScreenCleanup
ret
.ChangeViewerPrompt:
@ -194,7 +194,7 @@ DebugMapViewer_ShowSelectedDetails:
jr nc, .skip
call RefreshScreen
call .DisplayActorCastID
call Function1fea
call ScreenCleanup
ret
.skip
call DisplayBGEventDetails
@ -370,7 +370,7 @@ DisplayBGEventDetails:
call .PrintTableDetails
call .WaitInput
call CloseWindow
call Function1fea
call ScreenCleanup
ret
.Functionfd0cc:

View File

@ -46,7 +46,7 @@ FieldDebug_Minigames:
call ClearTileMap
call WaitBGMap
ld hl, wQueuedScriptBank
call CallFar_atHL
call CallPointerAt
call ClearPalettes
call ReloadSpritesAndFont
call LoadTilesetGFX

View File

@ -36,7 +36,7 @@ FieldDebug_MoveToRoute1Entrance:
ld a, PLAYER_OBJECT
ld hl, wMovementBuffer
call LoadMovementDataPointer
call Function1fea
call ScreenCleanup
ret
.MoveText:

View File

@ -8,7 +8,7 @@ FieldDebug_PokemartMenu:
.DoPokemartMenu:
call LoadStandardMenuHeader
callfar asm_24860
callfar PlaceMoneyTopRight
ld hl, DebugMart_PokemartMenuText
call PrintText
ld hl, .MenuHeader
@ -118,11 +118,11 @@ DebugMart_Buy:
cp A_BUTTON
jr z, .buy_item
.buy_item
ld a, 99
ld a, MAX_ITEM_STACK
ld [wItemQuantityBuffer], a
ld hl, .HowManyText
call PrintText
callfar asm_24c64
callfar SelectQuantityToBuy
call ExitMenu
jr c, .done
predef LoadItemData
@ -152,10 +152,10 @@ DebugMart_Buy:
.ConfirmPurchaseText:
text_from_ram wStringBuffer2
text "を @"
deciram wItemQuantity, 1, $2
deciram wItemQuantity, 1, 2
text "こで"
line "@"
deciram hFFCD, 3, $6
deciram hMoneyTemp, 3, 6
text "円 おかいあげですか?"
done
@ -260,7 +260,7 @@ DebugMart_Sell:
.ItemQuantityPrompt:
ld hl, .HowManyItemsText
call PrintText
callfar asm_24c64
callfar SelectQuantityToBuy
jr c, .got_quantity
jr .CannotSellItem
@ -300,11 +300,11 @@ DebugMart_LoadItems:
ld [wCurItem], a
callfar GetItemPrice
ld a, d
ld [wMiscStringBuffer], a
ld [wBuySellItemPrice], a
ld a, e
ld [wMiscStringBuffer + 1], a
ld [wBuySellItemPrice + 1], a
ld hl, wStringBuffer1
ld de, wMiscStringBuffer
ld de, wBuySellItemPrice
lb bc, PRINTNUM_LEADINGZEROS | 2, 6
call PrintNumber
pop hl

View File

@ -169,7 +169,7 @@ FieldDebug_SpriteViewer:
.UpdateMenu:
call .SetMenuAttributes
.loop2
call Get2DMenuJoypad
call StaticMenuJoypad
ld a, [wMenuCursorY]
ld [wSpriteViewerSavedMenuPointerY], a
ldh a, [hJoySum]

View File

@ -62,7 +62,7 @@ OpenToolgearMenu:
ld hl, .MenuHeader
call LoadMenuHeader
call .AfterToolgearOpen
ld [wMenuCursorBuffer], a
ld [wMenuCursorPosition], a
call VerticalMenu
call CloseWindow
ret

View File

@ -35,7 +35,7 @@ FieldDebug_ShowWarpToText:
call CopyStringToStringBuffer2
ld hl, .WarpToText
call FieldDebug_ShowTextboxAndExit
call Function1fea
call ScreenCleanup
ret
.WarpToText:

View File

@ -41,10 +41,10 @@ FieldDebugMenu::
call UpdateTimePals
call UpdateSprites
ld a, [wFieldDebugMenuCursorBuffer]
ld [wMenuCursorBuffer], a
ld [wMenuCursorPosition], a
call OpenMenu
jr c, .WaitInput
ld a, [wMenuCursorBuffer]
ld a, [wMenuCursorPosition]
ld [wFieldDebugMenuCursorBuffer], a
call PlaceHollowCursor
@ -83,7 +83,7 @@ FieldDebugMenu::
.Cleanup:
push af
call Function1fea
call ScreenCleanup
pop af
ret

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,475 +0,0 @@
INCLUDE "constants.asm"
SECTION "engine/dumps/bank0b.asm", ROMX
ShowItemDescription::
push de
ld hl, ItemDescriptions
ld a, [wSelectedItem]
dec a
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
pop hl
jp PlaceString
INCLUDE "data/items/descriptions.inc"
Function2d2fc:
ld a, $1
ldh [hInMenu], a
call sub_2d436
ld a, $0
ldh [hInMenu], a
ret nc
call PlaceHollowCursor
call WaitBGMap
ld a, $1
ldh [hBGMapMode], a
ld a, [wCurItem]
cp $3a
ret nc
ld [wce37], a
ld a, $1b
call Predef
ld a, [wce37]
ld [wPutativeTMHMMove], a
call GetMoveName
call CopyStringToStringBuffer2
ld hl, text_2d3bf
call PrintText
ld hl, text_2d3d9
call PrintText
call YesNoBox
jp c, asm_2d3a8
asm_2d33e:
ld hl, wStringBuffer2
ld de, wcd1d
ld bc, $8
call CopyBytes
ld hl, wStateFlags
res SPRITE_UPDATES_DISABLED_F, [hl]
ld a, $3
ld [wPartyMenuActionText], a
ld a, $36
call Predef
push af
ld hl, wcd1d
ld de, wStringBuffer2
ld bc, $8
call CopyBytes
pop af
jr nc, asm_2d36c
jp asm_2d3ad
asm_2d36c:
ld a, $1a
call Predef
push bc
ld a, [wCurPartyMon]
ld hl, wPartyMonNicknames
call GetNick
pop bc
ld a, c
and a
jr nz, asm_2d390
push de
ld de, $14
call PlaySFX
pop de
ld hl, text_2d404
call PrintText
jr asm_2d33e
asm_2d390:
callfar Functionfdab
jr c, asm_2d33e
ld a, $0
call Predef
ld a, b
and a
jr z, asm_2d3a8
call sub_2d64e
jr asm_2d3ad
asm_2d3a8:
ld a, $2
ld [wFieldMoveSucceeded], a
asm_2d3ad:
call ClearBGPalettes
call ClearSprites
ld hl, wStateFlags
set SPRITE_UPDATES_DISABLED_F, [hl]
call RestoreScreenAndReloadTiles
call GetMemSGBLayout
ret
text_2d3bf:
text "<TM>を きどうした!"
prompt
text "ひでんマシンを きどうした!"
text_2d3d9:
text "なかには @"
text_from_ram wStringBuffer2
text "が"
line "きろくされていた!"
para "@"
text_from_ram wStringBuffer2
text "を"
line "#に おぼえさせますか?"
done
text_2d404:
text_from_ram wStringBuffer1
text "と @"
text_from_ram wStringBuffer2
text "は"
line "あいしょうが わるかった!"
para "@"
text_from_ram wStringBuffer2
text "は おぼえられない!"
prompt
db $02, $04, $00, $01
db $0c, $20
db $c3
sub_2d436:
xor a
ldh [hBGMapMode], a
call sub_2d577
ld a, $2
ld [w2DMenuCursorInitY], a
ld a, $4
ld [w2DMenuCursorInitY + 1], a
ld a, $1
ld [w2DMenuNumCols], a
ld a, $4
sub d
inc a
cp $5
jr nz, asm_2d454
dec a
asm_2d454:
ld [w2DMenuNumRows], a
ld a, $c
ld [w2DMenuFlags1], a
xor a
ld [w2DMenuFlags2], a
ld a, $20
ld [w2DMenuCursorOffsets], a
ld a, $c3
ld [w2DMenuCursorOffsets + 1], a
ld a, [wcd42]
inc a
ld [wMenuCursorY], a
ld a, $1
ld [wMenuCursorX], a
jr asm_2d4a3
asm_2d478:
call sub_2d577
asm_2d47b:
call WaitBGMap
ld a, $1
ldh [hBGMapMode], a
call Get2DMenuJoypad
ld b, a
ld a, [wMenuCursorY]
dec a
ld [wcd42], a
xor a
ldh [hBGMapMode], a
ld a, [w2DMenuFlags2]
bit 7, a
jp nz, asm_2d537
ld a, b
bit 0, a
jp nz, sub_2d51a
bit 1, a
jp nz, asm_2d535
asm_2d4a3:
call sub_2d51a
ld hl, $c368
ld b, $6
ld c, $12
call DrawTextBox
call UpdateSprites
ld a, [wCurItem]
cp $3a
jr nc, asm_2d47b
ld [wce37], a
ld hl, $c391
ld de, string_2d572
call PlaceString
ld a, $1b
call Predef
ld a, [wce37]
ld [wCurSpecies], a
ld b, a
ld hl, $c395
predef PrintMoveType
ld hl, $c3b9
call Function2d663
ld hl, $c39b
ld de, string_2d568
call PlaceString
ld a, [wCurSpecies]
dec a
ld hl, Moves + MOVE_POWER
ld bc, MOVE_LENGTH
call AddNTimes
ld a, BANK(Moves)
call GetFarByte
ld hl, $c3a0
cp $2
jr c, asm_2d511
ld [wce37], a
ld de, wce37
ld bc, $103
call PrintNumber
jp asm_2d478
asm_2d511:
ld de, string_2d56e
call PlaceString
jp asm_2d478
sub_2d51a:
call sub_2d5f8
ld a, [wMenuCursorY]
ld b, a
asm_2d521:
inc c
ld a, c
cp $3a
jr nc, asm_2d52f
ld a, [hli]
and a
jr z, asm_2d521
dec b
jr nz, asm_2d521
ld a, c
asm_2d52f:
ld [wCurItem], a
cp $ff
ret
asm_2d535:
and a
ret
asm_2d537:
ld a, b
bit 7, a
jr nz, asm_2d54b
ld hl, wcd47
ld a, [hl]
and a
jp z, asm_2d478
dec [hl]
call sub_2d577
jp asm_2d4a3
asm_2d54b:
call sub_2d5f8
ld b, $5
asm_2d550:
inc c
ld a, c
cp $3a
jp nc, asm_2d478
ld a, [hli]
and a
jr z, asm_2d550
dec b
jr nz, asm_2d550
ld hl, wcd47
inc [hl]
call sub_2d577
jp asm_2d4a3
string_2d568:
db "いりょく/@"
string_2d56e:
db "ーーー@"
string_2d572:
db "タイプ/@"
sub_2d577:
ld hl, $c2a3
ld b, $8
ld c, $f
call DrawTextBox
call sub_2d5f8
ld d, $4
asm_2d586:
inc c
ld a, c
cp $3a
jr nc, asm_2d5dd
ld a, [hli]
and a
jr z, asm_2d586
ld b, a
ld a, c
ld [wce37], a
push hl
push de
push bc
call sub_2d5e9
push hl
ld de, wce37
ld bc, $8102
call PrintNumber
ld a, $1b
call Predef
ld a, [wce37]
ld [wPutativeTMHMMove], a
call GetMoveName
pop hl
ld bc, $3
add hl, bc
push hl
call PlaceString
pop hl
ld bc, $8
add hl, bc
ld [hl], $f1
inc hl
ld a, $f6
pop bc
push bc
ld a, b
ld [wce37], a
ld de, wce37
ld bc, $102
call PrintNumber
pop bc
pop de
pop hl
dec d
jr nz, asm_2d586
jr asm_2d5e8
asm_2d5dd:
call sub_2d5e9
ld a, $d4
ld [hli], a
ld a, $d2
ld [hli], a
ld [hl], $d9
asm_2d5e8:
ret
sub_2d5e9:
ld hl, $c2a5
ld bc, $28
ld a, $5
sub d
ld d, a
asm_2d5f3:
add hl, bc
dec d
jr nz, asm_2d5f3
ret
sub_2d5f8:
ld hl, wTMsHMs
ld a, [wcd47]
ld b, a
inc b
ld c, $0
asm_2d602:
inc c
ld a, [hli]
and a
jr z, asm_2d602
dec b
jr nz, asm_2d602
dec hl
dec c
ret
call sub_2d63c
ld hl, text_2d61b
jr nc, asm_2d618
ld hl, text_2d62f
asm_2d618:
jp PrintText
text_2d61b:
text_from_ram wStringBuffer1
text "は これいじょう"
line "もてません!"
prompt
text_2d62f:
text_from_ram wStringBuffer1
text "を てにいれた!"
prompt
sub_2d63c:
ld a, [wCurItem]
dec a
ld hl, wTMsHMs
ld b, $0
ld c, a
add hl, bc
ld a, [hl]
inc a
cp $a
ret nc
ld [hl], a
ret
sub_2d64e:
ld a, [wCurItem]
dec a
ld hl, wTMsHMs
ld b, $0
ld c, a
add hl, bc
ld a, [hl]
and a
ret z
dec a
ld [hl], a
ret nz
ld [wcd47], a
ret
Function2d663:
push hl
ld hl, MoveDescriptions
ld a, [wCurSpecies]
dec a
ld c, a
ld b, $0
add hl, bc
add hl, bc
ld a, [hli]
ld e, a
ld d, [hl]
pop hl
jp PlaceString
INCLUDE "data/moves/descriptions.inc"

View File

@ -4382,7 +4382,7 @@ UpdateMoveData:
push bc
ld a, [wCurPlayerSelectedMove]
ld b, a
ld a, [wcabe]
ld a, [wPlayerDebugSelectedMove]
and a
jr z, .get_move_data
ld b, a
@ -8437,7 +8437,7 @@ BattleCommand_BatonPass:
call LoadStandardMenuHeader
ld a, PARTYMENUACTION_SWITCH
ld [wPartyMenuActionText], a
predef PartyMenuInBattle_Setup
predef OpenPartyMenu_ClearGraphics
.player_loop
jr c, .pressed_b
@ -8450,7 +8450,7 @@ BattleCommand_BatonPass:
call PrintText
.pressed_b
predef PartyMenuInBattle
predef OpenPartyMenu
jr .player_loop
.picked_mon

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@ CopyMonToTempMon::
ld bc, BOXMON_STRUCT_LENGTH
cp BOXMON
jr z, .getmonaddress
ld hl, wd882
ld hl, wBufferMon
jr .copywholestruct
.getmonaddress
@ -44,7 +44,7 @@ GetMonSpecies::
cp BOXMON
jr z, .boxmon
cp TEMPMON
jr z, .breedmon
jr z, .buffermon
; WILDMON
.partymon
@ -56,11 +56,11 @@ GetMonSpecies::
jr .done
.boxmon
ld hl, wBoxList
ld hl, wBoxSpecies
jr .done
.breedmon
ld a, [wd882]
.buffermon
ld a, [wBufferMonSpecies]
jr .done2
.done
@ -148,7 +148,7 @@ GetTypeName::
ld h, [hl]
ld l, a
ld de, wStringBuffer1
ld bc, MOVE_NAME_LENGTH
ld bc, TYPE_NAME_LENGTH
jp CopyBytes
SECTION "engine/dumps/bank14.asm@GetTrainerClassName_Old", ROMX
@ -338,15 +338,16 @@ DrawHP:
pop de
ret
Function502b5::
; TODO: Finish this baby up.
StatsScreenMain::
ld a, [wCurPartySpecies]
cp DEX_EGG
jr z, .asm_502d9
jr z, .got_stats
call CopyMonToTempMon
ld a, [wMonType]
cp 2
jr c, .asm_502d9
cp BOXMON
jr c, .got_stats
ld a, [wTempMonLevel]
ld [wCurPartyLevel], a
@ -354,7 +355,8 @@ Function502b5::
ld de, wTempMonMaxHP
ld b, 1
predef CalcMonStats
.asm_502d9
.got_stats
ld hl, wd4a7
set 1, [hl]
call ClearBGPalettes
@ -732,7 +734,7 @@ Function50562::
ld de, wStringBuffer1
push de
ld bc, 6
ld bc, MON_NAME_LENGTH
call CopyBytes
pop de
@ -741,7 +743,7 @@ Function50562::
call PlaceString
ld d, 0
call Function50628
call PrintTempMonStats
hlcoord 10, 6
ld de, .Parameters
call PlaceString
@ -762,7 +764,7 @@ Function50562::
.OTPointers
dw wPartyMonOTs
dw wOTPartyMonOT
dw wBoxMonOT
dw wBoxMonOTs
dw wBufferMonOT
Function505d9::
@ -812,10 +814,12 @@ GetNicknamePointer::
ld a, [wCurPartyMon]
jp SkipNames
Function50628::
; Prints a text box containing wTempMon's stats.
; If d = 0, print it closer to the middle. Else, print it on the side.
PrintTempMonStats::
ld a, d
and a
jr nz, .asm_5063e
jr nz, .level_up_screen
hlcoord 8, 6
ld b, 10
@ -823,57 +827,58 @@ Function50628::
call DrawTextBox
hlcoord 9, 8
ld bc, $0006
jr .asm_5064e
lb bc, 0, 6
jr .next
.asm_5063e
.level_up_screen
hlcoord 9, 0
ld b, 10
ld c, 9
call DrawTextBox
hlcoord 11, 2
ld bc, $0004
.asm_5064e
lb bc, 0, 4
.next
push bc
push hl
ld de, Data_50684
ld de, .StatNames
call PlaceString
pop hl
pop bc
add hl, bc
ld de, wTempMonAttack
ld bc, $0203
call .asm_5067a
lb bc, 2, 3
call .PrintStat
ld de, wTempMonDefense
call .asm_5067a
call .PrintStat
ld de, wTempMonSpclAtk
call .asm_5067a
call .PrintStat
ld de, wTempMonSpclDef
call .asm_5067a
call .PrintStat
ld de, wTempMonSpeed
jp PrintNumber
.asm_5067a
.PrintStat
push hl
call PrintNumber
pop hl
; Print next numbers two tiles lower
ld de, $0028
ld de, 2 * SCREEN_WIDTH
add hl, de
ret
Data_50684:
db "こうげき"
next "ぼうぎょ"
next "とくこう"
next "とくぼう"
next "すばやさ"
.StatNames:
db "こうげき" ; "ATTACK"
next "ぼうぎょ" ; "DEFENSE"
next "とくこう" ; "SPCL.ATK"
next "とくぼう" ; "SPCL.DEF"
next "すばやさ" ; "SPEED"
next "@"
GetGender::
@ -1036,10 +1041,10 @@ ClearGraphicsForPartyMenu::
call UpdateSprites
ret
PartyMenuInBattle_Setup::
OpenPartyMenu_ClearGraphics::
call ClearGraphicsForPartyMenu
; Fallthrough
PartyMenuInBattle::
OpenPartyMenu::
ldh a, [hMapAnims]
push af
xor a
@ -1047,9 +1052,9 @@ PartyMenuInBattle::
ld hl, wOptions
set NO_TEXT_SCROLL_F, [hl]
call PartyMenuInBattle_SetMenuAttributes
call Function5081f
call Function507cf
call .SetMenuAttributes
call InitPartyMenuLayout
call PartyMenuSelect
ld hl, wOptions
res NO_TEXT_SCROLL_F, [hl]
@ -1058,7 +1063,7 @@ PartyMenuInBattle::
ldh [hMapAnims], a
ret
PartyMenuInBattle_SetMenuAttributes::
.SetMenuAttributes:
call LoadFontsBattleExtra
xor a
ld [wMonType], a
@ -1078,7 +1083,7 @@ PartyMenuInBattle_SetMenuAttributes::
ld a, $01
.asm_507b4
ld [wMenuJoypadFilter], a
ld a, [wcd3c]
ld a, [wPartyMenuCursor]
and a
jr z, .asm_507c1
inc b
@ -1093,11 +1098,11 @@ PartyMenuInBattle_SetMenuAttributes::
Data_507c7:
db $01, $00, $00, $01, $60, $00, $20, $00
Function507cf::
call Get2DMenuJoypad
PartyMenuSelect::
call StaticMenuJoypad
call PlaceHollowCursor
ld a, [wMenuCursorY]
ld [wcd3c], a
ld [wPartyMenuCursor], a
ldh a, [hJoySum]
ld b, a
ld a, [wSelectedSwapPosition]
@ -1131,20 +1136,21 @@ Function507cf::
jr nz, .asm_5080f
call _SwitchPartyMons
.asm_5080f
call Function50eca
call PartyMenu_ClearCursor
xor a
ld [wSelectedSwapPosition], a
ld [wPartyMenuActionText], a
call Function5081f
jp Function507cf
call InitPartyMenuLayout
jp PartyMenuSelect
Function5081f::
InitPartyMenuLayout::
ld a, [wPartyMenuActionText]
cp PARTYMENUACTION_MOVE
jp z, Function509dd
jp z, PrintPartyMenuText
callfar LoadOverworldMonIcon
call Function50eca
callfar Function95f8
call PartyMenu_ClearCursor
callfar InitPartyMenuPalettes
hlcoord 3, 1
ld de, wPartySpecies
ld a, [wCurPartyMon]
@ -1152,12 +1158,12 @@ Function5081f::
xor a
ld [wCurPartyMon], a
ld [wcce1], a
.asm_5084b
.loop
ld a, [de]
cp $FF
jp z, .asm_50877
cp -1
jp z, .done
push de
call Function508c4
call PlacePartyMember
pop de
ld a, [wCurPartyMon]
ldh [hObjectStructIndex], a
@ -1165,60 +1171,62 @@ Function5081f::
push de
ld hl, LoadMenuMonIcon
ld a, BANK(LoadMenuMonIcon) ; ...What macro do I use here?
ld a, BANK(LoadMenuMonIcon)
ld e, MONICON_PARTYMENU
call FarCall_hl
pop de
inc de
pop hl
ld bc, $0028
ld bc, 2 * SCREEN_WIDTH
add hl, bc
ld a, [wCurPartyMon]
inc a
ld [wCurPartyMon], a
jr .loop
jr .asm_5084b
.asm_50877
.done
pop af
ld [wCurPartyMon], a
jp Function509d8
jp PrintPartyText_GetSGBLayout
Function5087e::
WritePartyMenuTilemapAndText::
ld a, [wPartyMenuActionText]
cp PARTYMENUACTION_MOVE
jp z, Function509dd
callfar Function95f8
ld hl, $c2b7
jp z, PrintPartyMenuText
callfar InitPartyMenuPalettes
hlcoord 3, 1
ld de, wPartySpecies
ld a, [wCurPartyMon]
push af
xor a
ld [wCurPartyMon], a
ld [wcce1], a
.asm_5089f
.loop
ld a, [de]
cp $FF
jp z, .asm_508bd
cp -1
jp z, .done
push de
call Function508c4
call PlacePartyMember
pop de
ld a, [wCurPartyMon]
ldh [hEventID], a
inc de
ld bc, $0028
ld bc, 2 * SCREEN_WIDTH
add hl, bc
ld a, [wCurPartyMon]
ld a, [wCurPartyMon] ; redundant
inc a
ld [wCurPartyMon], a
jr .asm_5089f
.asm_508bd
jr .loop
.done
pop af
ld [wCurPartyMon], a
jp Function509d8
jp PrintPartyText_GetSGBLayout
Function508c4::
; Places the tilemap of the party member at wCurPartyMon.
PlacePartyMember::
push bc
push hl
push hl
@ -1229,15 +1237,18 @@ Function508c4::
call PlaceString
call CopyMonToTempMon
pop hl
push hl
ld a, [wSelectedSwapPosition]
and a
jr z, .asm_508ef
jr z, .not_switching
dec a
ld b, a
ld a, [wCurPartyMon]
cp b
jr nz, .asm_508ef
jr nz, .not_switching
dec hl
dec hl
dec hl
@ -1245,50 +1256,51 @@ Function508c4::
ld [hli], a
inc hl
inc hl
.asm_508ef
.not_switching
ld a, [wPartyMenuActionText]
cp PARTYMENUACTION_TEACH_TMHM
jr z, .asm_50922
jr z, .PlacePartyMonTMHMCompatibility
cp PARTYMENUACTION_EVO_STONE
jr z, .DetermineCompatibility
jr z, .PlacePartyMonEvoStoneCompatibility
cp PARTYMENUACTION_GIVE_MON
jp z, .asm_509b5
jp z, .PlacePartyMonGender
cp PARTYMENUACTION_GIVE_MON_FEMALE
jp z, .asm_509b5
jp z, .PlacePartyMonGender
push hl
ld bc, hRTCRandom
ld bc, -15
add hl, bc
ld de, wTempMonStatus
call PlaceStatusString
pop hl
push hl
ld bc, hCurMapTextSubroutinePtr + 1
ld bc, -12
add hl, bc
ld b, $00
ld b, 0
call DrawEnemyHP
push de
call Function50b66
call SetPartyHPBarPalette
pop de
pop hl
jr .asm_5093c
jr .PrintLevel
.asm_50922
.PlacePartyMonTMHMCompatibility
push hl
predef CanLearnTMHMMove
pop hl
ld de, .text_50948
ld de, .string_able
ld a, c
and a
jr nz, .asm_50933
ld de, .text_5094f
.asm_50933
jr nz, .able
ld de, .string_not_able
.able
push hl
ld bc, $0009
ld bc, 9
add hl, bc
call PlaceString
pop hl
.asm_5093c
ld bc, $0005
.PrintLevel
ld bc, 5
add hl, bc
push de
call PrintLevel
@ -1297,21 +1309,24 @@ Function508c4::
pop bc
ret
.text_50948:
db "おぼえられる@"
.string_able:
db "おぼえられる@" ; "ABLE"
.text_5094f:
db "おぼえられない@"
.string_not_able:
db "おぼえられない@" ; "NOT ABLE"
.DetermineCompatibility:
.PlacePartyMonEvoStoneCompatibility:
push hl
ld hl, EvosAttacksPointers
ld a, [wTempMonSpecies] ; Species of selected pokemon?
ld a, [wTempMonSpecies]
dec a
ld c, a
ld b, $00
ld b, 0
add hl, bc
add hl, bc
; BUG: Only the first three evolution entries can have Stone compatibility reported correctly.
; While this never comes up in the final game, this prototype has Espeon and Umbreon evolving from
; Heart Stones and Poison Stones respectively, making it five evolution stone entries for Eevee.
ld de, wStringBuffer1
ld a, BANK(EvosAttacksPointers)
ld bc, 2
@ -1325,16 +1340,16 @@ Function508c4::
ld bc, 10
call FarCopyBytes
ld hl, wStringBuffer1
ld de, .string_not_able
; Fallthrough
.asm_50986
ld de, .string_cant_use
.loop
ld a, [hli]
and a
jr z, .asm_5099e
jr z, .nope
inc hl
inc hl
cp EVOLVE_STONE
jr nz, .asm_50986
jr nz, .loop
dec hl
dec hl
ld b, [hl]
@ -1342,23 +1357,24 @@ Function508c4::
inc hl
inc hl
cp b
jr nz, .asm_50986
ld de, .string_able
.asm_5099e
jr nz, .loop
ld de, .string_can_use
.nope
pop hl
push hl
ld bc, $0009
ld bc, 9
add hl, bc
call PlaceString
pop hl
jr .asm_5093c
jr .PrintLevel
.string_able
db "つかえる@"
.string_not_able
db "つかえない@"
.string_can_use
db "つかえる@" ; "ABLE"
.string_cant_use
db "つかえない@" ; "NOT ABLE"
.asm_509b5
.PlacePartyMonGender
xor a
ld [wMonType], a
push hl
@ -1369,11 +1385,11 @@ Function508c4::
ld de, .female
.got_gender
push hl
ld bc, $0009
ld bc, 9
add hl, bc
call PlaceString
pop hl
jp .asm_5093c
jp .PrintLevel
.male
db "オス@"
@ -1381,35 +1397,37 @@ Function508c4::
.female
db "メス@"
Function509d8::
ld b, $0a
PrintPartyText_GetSGBLayout::
ld b, SGB_PARTY_MENU
call GetSGBLayout
Function509dd::
PrintPartyMenuText::
ld hl, wOptions
ld a, [hl]
push af
push hl
set NO_TEXT_SCROLL_F, [hl]
ld a, [wPartyMenuActionText]
cp PARTYMENUTEXT_HEAL_PSN
jr nc, .asm_509fc
jr nc, .heal
add a
ld c, a
ld b, $00
ld hl, .data_50a33
ld b, 0
ld hl, .PartyMenuStrings
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
call PrintText
jr .asm_50a17
jr .done
.asm_509fc
and $0f
.heal
and $f
add a
ld c, a
ld b, $00
ld hl, .data_50a21
ld b, 0
ld hl, .MenuActionStrings
add hl, bc
ld a, [hli]
ld h, [hl]
@ -1420,7 +1438,7 @@ Function509dd::
call GetNick
pop hl
call PrintText
.asm_50a17
.done
pop hl
pop af
ld [hl], a
@ -1428,58 +1446,58 @@ Function509dd::
call SetPalettes
ret
.data_50a21
dw Text_50acb
dw Text_50af9
dw Text_50b09
dw Text_50b1d
dw Text_50ae5
dw Text_50ab0
dw Text_50b2b
dw Text_50b3b
dw Text_50b4e
.MenuActionStrings
dw CuredOfPoisonText
dw BurnWasHealedText
dw _WasDefrostedText
dw _WokeUpText
dw RidOfParalysisText
dw RecoveredSomeHPText
dw HealthReturnedText
dw RevitalizedText
dw _GrewToLevelText
.data_50a33
dw Text_50a43
dw Text_50a51
dw Text_50a5f
dw Text_50a6c
dw Text_50a7a
dw Text_50a51
dw Text_50a88
dw Text_50a9c
.PartyMenuStrings
dw ChooseAMonString
dw UseOnWhichPKMNString
dw WhichPKMNString
dw TeachWhichPKMNString
dw MoveToWhereString
dw UseOnWhichPKMNString
dw ChooseFirstMonString
dw ChooseSecondMonString
Text_50a43: ; Choose a pokemon
ChooseAMonString:
text "#を えらんで ください"
done
Text_50a51:
UseOnWhichPKMNString:
text "どの#に つかいますか?"
done
Text_50a5f:
WhichPKMNString:
text "どの#を だしますか?"
done
Text_50a6c:
TeachWhichPKMNString:
text "どの#に おしえますか?"
done
Text_50a7a:
MoveToWhereString:
text "どこに いどうしますか?"
done
Text_50a88: ; first Pokemon in Daycare?
ChooseFirstMonString:
text "1ぴきめの #を"
line "えらんで ください"
done
Text_50a9c: ; second Pokemon in Daycare?
ChooseSecondMonString:
text "2ひきめの #を"
line "えらんで ください"
done
Text_50ab0: ; restored hp
RecoveredSomeHPText:
text_from_ram wStringBuffer1
text "の たいりょくが"
line "@"
@ -1487,62 +1505,62 @@ Text_50ab0: ; restored hp
text " かいふくした"
done
Text_50acb: ; cured poison
CuredOfPoisonText:
text_from_ram wStringBuffer1
text "の どくは"
line "きれい さっぱり なくなった!"
done
Text_50ae5: ; cured paralysis
RidOfParalysisText:
text_from_ram wStringBuffer1
text "の からだの"
line "しびれが とれた"
done
Text_50af9: ; cured burn
BurnWasHealedText:
text_from_ram wStringBuffer1
text "の"
line "やけどが なおった"
done
Text_50b09: ; cured frozen
_WasDefrostedText:
text_from_ram wStringBuffer1
text "の からだの"
line "こおりが とけた"
done
Text_50b1d: ; cured asleep
_WokeUpText:
text_from_ram wStringBuffer1
text "は"
line "めを さました"
done
Text_50b2b: ; health returned (presumably for Sacred Fire)
HealthReturnedText:
text_from_ram wStringBuffer1
text "は"
line "けんこうになった!"
done
Text_50b3b: ; revived
RevitalizedText:
text_from_ram wStringBuffer1
text "は"
line "げんきを とりもどした!"
done
Text_50b4e: ; leveled up
_GrewToLevelText:
text_from_ram wStringBuffer1
text "の レべルが@"
deciram wCurPartyLevel, 1, 3
text "になった@"
sound_dex_fanfare_50_79
text_waitbutton
db "@"
Function50b66::
text_end
SetPartyHPBarPalette::
ld hl, wHPPals
ld a, [wcce1]
ld c, a
ld b, $00
ld b, 0
add hl, bc
call SetHPPal
ld b, SGB_PARTY_MENU_HP_PALS
@ -1755,12 +1773,12 @@ Function50c48::
ld [wItemAttributesPointer + 1], a
ret
Function50caa::
CalcLevel::
ld a, [wTempMonSpecies]
ld [wCurSpecies], a
call GetBaseData
ld d, $01
.asm_50cb5
ld d, 1
.next_level
inc d
call CalcExpAtLevel
push hl
@ -1778,7 +1796,9 @@ Function50caa::
ld a, [hl]
sbc c
pop hl
jr nc, .asm_50cb5
jr nc, .next_level
.got_level
dec d
ret
@ -2077,15 +2097,15 @@ _SwitchPartyMons::
call CopyBytes
ret
Function50eca::
PartyMenu_ClearCursor::
hlcoord 0, 1
ld bc, $0028
ld a, $06
.asm_50ed2
ld [hl], $7f
ld bc, 2 * SCREEN_WIDTH
ld a, PARTY_LENGTH
.next
ld [hl], " "
add hl, bc
dec a
jr nz, .asm_50ed2
jr nz, .next
ret
GetUnownLetter::
@ -2135,5 +2155,5 @@ GetUnownLetter::
; Increment to get 1-26
ldh a, [hQuotient + 3]
inc a
ld [wAnnonID], a ; $d874
ld [wAnnonID], a
ret

275
engine/events/breeder.asm Normal file
View File

@ -0,0 +1,275 @@
INCLUDE "constants.asm"
SECTION "engine/events/breeder.asm", ROMX
_Breeder::
ld a, [wBreederStatus]
cp BREEDER_TWO_BREEDMON
jr c, .continue
cp BREEDER_EGG_READY
jp z, .AskGiveEgg
cp BREEDER_GAVE_EGG
jr z, .continue
call .CheckBreedmonCompatibility
ld a, [wBreedingCompatibility]
and a
jr z, .no_egg_yet
; Autogenerates an egg if the Pokémon are compatible.
ld a, BREEDER_EGG_READY
ld [wBreederStatus], a
.no_egg_yet
ld hl, .NoEggYetText
call PrintText
.continue
ld hl, .IntroText
call PrintText
ld hl, .MenuHeader
call LoadMenuHeader
call VerticalMenu
push af
call CloseWindow
pop af
jp c, .Exit
ld a, [wMenuCursorY]
cp 3
jp z, .Exit
cp 1
jr z, .Deposit
ld a, [wBreederStatus]
and a
jr z, .no_breedmons
cp BREEDER_TWO_BREEDMON
jr nz, .Withdraw
ld hl, .CheckOnPokemonText
call PrintText
call YesNoBox
jp c, .Exit
jr .Withdraw
.no_breedmons
ld hl, .DoesntHavePokemonText
call PrintText
jp .Exit
.Withdraw:
ld a, GET_BREED_MON
ld [wPokemonWithdrawDepositParameter], a
predef RetrieveBreedmonOrBuffermon
jp c, .party_full
ld a, [wBreederStatus]
sub 1
jr z, .last_mon
ld a, BREEDER_ONE_BREEDMON
.last_mon
ld [wBreederStatus], a
ld a, [wBreedMonGenders]
srl a
ld [wBreedMonGenders], a
ld hl, .WithdrawnText
call PrintText
jp .Exit
.Deposit:
ld a, [wBreederStatus]
cp BREEDER_TWO_BREEDMON
jp nc, .empty
add PARTYMENUACTION_GIVE_MON
call UseItem_SelectMon
jp c, .Exit
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
call GetBaseData
xor a
ld [wMonType], a
predef GetGender
ld a, [wBreedMonGenders]
rla
ld [wBreedMonGenders], a
ld a, [wCurPartyMon]
ld hl, wPartyMonNicknames
call GetNick
ld a, GET_BREED_MON
ld [wPokemonWithdrawDepositParameter], a
predef DepositBreedmonOrBuffermon
xor a ; REMOVE_PARTY
ld [wPokemonWithdrawDepositParameter], a
callfar RemoveMonFromPartyOrBox ; in the same bank, no need to farcall!
ld a, [wCurPartySpecies]
call PlayCry
ld hl, .DepositedText
call PrintText
ld a, [wBreederStatus]
inc a
ld [wBreederStatus], a
cp BREEDER_TWO_BREEDMON
jr nz, .Exit
ld hl, .LetsMakeBabiesText
call PrintText
call .CheckBreedmonCompatibility
ld a, [wBreedingCompatibility]
cp 80
ld hl, .SeemToGetAlongText
call z, PrintText
ld a, [wBreedingCompatibility]
cp 20
ld hl, .DontSeemToGetAlongText
call z, PrintText
ld a, [wBreedingCompatibility]
and a
ld hl, .GendersDontMatchText
call z, PrintText
jr .Exit
.empty
ld hl, .AlreadyHasTwoPokemonText
call PrintText
jr .Exit
.Exit:
call ClearBGPalettes
call RestoreScreenAndReloadTiles
call GetMemSGBLayout
jp ReloadFontAndTileset
.party_full
ld hl, .BoxAndPartyFullText
jp PrintText
.CheckBreedmonCompatibility:
; Assumes that wBreedMonGenders has already been set from opening the Breeder menu with 1 or fewer Pokémon.
; If you open the breeder after saving and resetting the game while they have two Pokémon
; (assuming the BreedMons GET saved at this point in development),
; then this check will fail until you change out the BreedMons again.
ld a, [wBreedMonGenders]
ld b, a
srl b
xor b
and $1
jr z, .done
ld a, [wBreedMon1ID]
ld b, a
ld a, [wBreedMon2ID]
cp b
jr nz, .different_id
ld a, [wBreedMon1ID + 1]
ld b, a
ld a, [wBreedMon2ID + 1]
cp b
jr nz, .different_id
ld a, 20
jr .done
.different_id
ld a, 80
.done
ld [wBreedingCompatibility], a
ret
.IntroText:
text "わたしは こずくりやさん"
line "さて どうする?"
done
.MenuHeader:
db MENU_BACKUP_TILES
menu_coords 13, 4, 19, 11
dw .MenuData
db 1
.MenuData:
db STATICMENU_CURSOR
db 3
db "あずける@" ; Deposit
db "ひきとる@" ; Withdraw
db "やめる@" ; Cancel
.DepositedText:
text "あずけた!"
prompt
.AlreadyHasTwoPokemonText:
text "すでに 2ひきの#を"
line "あずかっています"
prompt
.CheckOnPokemonText:
text "こずくりを ちゅうししますか?"
done
.DoesntHavePokemonText:
text "#は いっぴきも"
line "あずかってませんが"
prompt
.WithdrawnText:
text "ひきとった!"
prompt
.BoxAndPartyFullText:
text "てもちも マサキの <PC>も"
line "#で いっぱいのようです"
prompt
.LetsMakeBabiesText:
text "それでは こづくりします!"
prompt
.SeemToGetAlongText:
text "あいしょうが いいようです"
prompt
.DontSeemToGetAlongText:
text "あいしょうが わるいようです"
prompt
.GendersDontMatchText:
text "せいべつが あわないようです"
prompt
.NoEggYetText:
text "ざんねんながら まだ うまれて"
line "こないようです"
prompt
.AskGiveEgg:
ld hl, .EggLaidText
call PrintText
call YesNoBox
jp c, .Exit
ld a, BREEDER_GAVE_EGG
ld [wBreederStatus], a
ld a, [wBreedMon1Species]
ld [wCurPartySpecies], a
call PlayCry
xor a
ld [wMonType], a
ld a, 5
ld [wCurPartyLevel], a
predef GiveEgg
jp .Exit
.EggLaidText:
text "タマゴが うまれました!"
line "ひきとりますか?"
done
Stub_MailEffect::
ret

View File

@ -168,7 +168,7 @@ CutScript:
call LoadMapPart
call UpdateSprites
call WaitBGMap
call Function1fea
call ScreenCleanup
scf
ret
@ -252,7 +252,7 @@ SurfScript:
call RedrawPlayerSprite
call PlayMapMusic
call MovePlayerIntoWater
call Function1fea
call ScreenCleanup
ret
Text_UsedSurf:
@ -531,7 +531,7 @@ TeleportScript:
ld c, 60
call DelayFrames
call CloseWindow
call Function1fea
call ScreenCleanup
ld a, MAPSETUP_TELEPORT
ldh [hMapEntryMethod], a
jpfar DoTeleportAnimation

View File

@ -462,7 +462,7 @@ PCItemsJoypad:
ld hl, .MenuHeader
call CopyMenuHeader
ld a, [wBackpackAndKeyItemsCursor]
ld [wMenuCursorBuffer], a
ld [wMenuCursorPosition], a
ld a, [wBackpackAndKeyItemsScrollPosition]
ld [wMenuScrollPosition], a
call ScrollingMenu

46
engine/events/pokepic.asm Normal file
View File

@ -0,0 +1,46 @@
INCLUDE "constants.asm"
SECTION "engine/events/pokepic.asm", ROMX
Pokepic::
ld a, 1
ldh [hBGMapMode], a
ld hl, .PokepicMenuHeader
call LoadMenuHeader
call MenuBox
call UpdateSprites
ld b, SGB_POKEPIC
call GetSGBLayout
xor a
ldh [hBGMapMode], a
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
call GetBaseData
ld de, vChars1
call LoadMonFrontSprite
ld a, [wMenuBorderTopCoord]
inc a
ld b, a
ld a, [wMenuBorderLeftCoord]
inc a
ld c, a
call Coord2Tile
ld a, $80
ldh [hGraphicStartTile], a
lb bc, 7, 7
predef PlaceGraphic
ld a, 1
ldh [hBGMapMode], a
call TextboxWaitPressAorB_BlinkCursor
call ClearMenuBoxInterior
call WaitBGMap
call GetMemSGBLayout
call CloseWindow
call LoadFont
ret
.PokepicMenuHeader:
db MENU_BACKUP_TILES
menu_coords 6, 4, 14, 13
dw 0
db 1

View File

@ -0,0 +1,32 @@
INCLUDE "constants.asm"
SECTION "engine/events/starter_dex.asm", ROMX
; Brings up the Pokédex entry of the index in wTempSpecies/wNamedObjectIndex to show as if it were caught.
StarterDex::
call RefreshScreen
call LowVolume
ldh a, [hMapAnims]
push af
xor a
ldh [hMapAnims], a
ld hl, wStateFlags
res SPRITE_UPDATES_DISABLED_F, [hl]
call ClearBGPalettes
call ClearSprites
call LoadStandardMenuHeader
callfar LoadPokeDexGraphics
call ClearTileMap
callfar _NewPokedexEntry
call ClearBGPalettes
ld hl, wStateFlags
set SPRITE_UPDATES_DISABLED_F, [hl]
call ExitMenu
call LoadTilesetGFX_LCDOff
call RestoreScreenAndReloadTiles
call UpdateTimePals
pop af
ldh [hMapAnims], a
call MaxVolume
call ScreenCleanup
ret

322
engine/events/town_map.asm Normal file
View File

@ -0,0 +1,322 @@
INCLUDE "constants.asm"
SECTION "engine/events/town_map.asm", ROMX
TownMap::
call InitTownMap
callfar ClearSpriteAnims
call TownMap_InitPlayerIcon
call WaitBGMap
call SetPalettes
.loop
call DelayFrame
call GetJoypadDebounced
callfar PlaySpriteAnimations
ld hl, hJoyDown
ld a, [hl]
and A_BUTTON | B_BUTTON
jr z, .loop
ret
FlyMap::
ld hl, hInMenu
ld a, [hl]
push af
ld [hl], 1
call InitTownMap
callfar ClearSpriteAnims
call TownMap_InitPlayerIcon
call FlyMap_InitPidgeyIcon
ld hl, wFlyIconAnimStructPointer
ld [hl], c
inc hl
ld [hl], b
hlcoord 1, 15
ld de, ChooseADestinationText
call PlaceString
call WaitBGMap
call SetPalettes
xor a
ld [wFlyDestination], a
.loop
call DelayFrame
call GetJoypadDebounced
callfar PlaySpriteAnimations
ld hl, hJoyDown
ld a, [hl]
and B_BUTTON
jr nz, .cancel
ld a, [hl]
and A_BUTTON
jr nz, .fly
call .HandleDPad
callfar GetFlyPointMapLocation
ld d, 0
ld hl, LandmarkPositions
add hl, de
add hl, de
ld d, [hl]
inc hl
ld e, [hl]
ld hl, wFlyIconAnimStructPointer
ld c, [hl]
inc hl
ld b, [hl]
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], e
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld [hl], d
jr .loop
.cancel
ld a, -1
ld [wFlyDestination], a
.fly
pop af
ldh [hInMenu], a
ret
.HandleDPad:
ld a, [wFlyDestination]
ld l, a
ld h, 0
add hl, hl
add hl, hl
ld de, FlyPointPaths
add hl, de
ld de, hJoySum
ld a, [de]
and D_UP
jr nz, .get_point
inc hl
ld a, [de]
and D_DOWN
jr nz, .get_point
inc hl
ld a, [de]
and D_LEFT
jr nz, .get_point
inc hl
ld a, [de]
and D_RIGHT
jr nz, .get_point
ret
.get_point
ld a, [hl]
cp -1
ret z
ld [wFlyDestination], a
ret
ChooseADestinationText:
db "とびさき を えらんでください@"
Pokedex_GetArea:
ld a, [wNestIconBlinkCounter]
push af
xor a
ld [wNestIconBlinkCounter], a
call InitTownMap
ld de, PokedexNestIconGFX
ld hl, vChars0 tile $7f
lb bc, BANK(PokedexNestIconGFX), 1
call Request1bpp
call GetPokemonName
hlcoord 4, 15
call PlaceString
hlcoord 9, 15
ld de, .String_SNest
call PlaceString
call WaitBGMap
call SetPalettes
xor a
ldh [hBGMapMode], a
ld hl, wTileMap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call ByteFill
callfar FindNest
.loop
call .PlaceNest
call GetJoypadDebounced
ldh a, [hJoyDown]
and A_BUTTON | B_BUTTON
jr nz, .done
ld hl, wNestIconBlinkCounter
inc [hl]
call DelayFrame
jr .loop
.done
pop af
ld [wNestIconBlinkCounter], a
ret
.String_SNest:
db "の すみか@"
.PlaceNest:
ld a, [wNestIconBlinkCounter]
and $10
jr z, .done_nest
ld de, wTileMap
ld hl, wShadowOAMSprite00
.nestloop
ld a, [de]
and a
ret z
push de
push hl
ld e, a
ld d, $00
ld hl, LandmarkPositions
add hl, de
add hl, de
ld e, l
ld d, h
; load into OAM
pop hl
; X position
ld a, [de]
inc de
sub 4
ld [hli], a
; Y position
ld a, [de]
inc de
sub 4
ld [hli], a
; Nest icon -> Tile ID
ld a, $7f
ld [hli], a
; Blank out attributes
xor a
ld [hli], a
pop de
inc de
jr .nestloop
.done_nest
call ClearSprites
ret
InitTownMap:
call ClearBGPalettes
call ClearTileMap
call UpdateSprites
call DisableLCD
ld hl, TownMapGFX
ld de, vTilesetEnd
ld bc, TownMapGFX.End - TownMapGFX
ld a, BANK(TownMapGFX)
call FarCopyData
ld hl, wTileMap
call DecompTownMapTilemap
hlcoord 0, 13
ld b, 3
ld c, 18
call DrawTextBox
ld a, 3
call UpdateSoundNTimes
call EnableLCD
ld b, SGB_TOWN_MAP
call GetSGBLayout
ret
DecompTownMapTilemap:
ld de, TownMapTilemap
.loop
ld a, [de]
and a
ret z
ld b, a
inc de
ld a, [de]
ld c, a
ld a, b
add $60
.keep_placing_tile
ld [hli], a
dec c
jr nz, .keep_placing_tile
inc de
jr .loop
TownMap_InitPlayerIcon:
ld de, GoldSpriteGFX
ld hl, vChars0
lb bc, BANK(GoldSpriteGFX), $04
call Request2bpp
ld de, GoldSpriteGFX + 12 tiles
ld hl, vChars0 tile $04
lb bc, BANK(GoldSpriteGFX), $04
call Request2bpp
depixel 0, 0
ld a, SPRITE_ANIM_OBJ_MAP_CHARACTER_ICON
call InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], $00
push bc
ld a, [wMapGroup]
ld b, a
ld a, [wMapId]
ld c, a
call GetWorldMapLocation
ld e, a
ld d, $00
ld hl, LandmarkPositions
add hl, de
add hl, de
ld d, [hl]
inc hl
ld e, [hl]
pop bc
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], e
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld [hl], d
ret
FlyMap_InitPidgeyIcon:
ld de, PidgeySpriteGFX
ld hl, vChars0 tile $08
lb bc, BANK(PidgeySpriteGFX), 4
call Request2bpp
ld de, PidgeySpriteGFX + 12 tiles
ld hl, vChars0 tile $0c
lb bc, BANK(PidgeySpriteGFX), 4
call Request2bpp
depixel 0, 0
ld a, SPRITE_ANIM_OBJ_MAP_CHARACTER_ICON
call InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], 8
ret
TownMapTilemap:
INCBIN "gfx/trainer_gear/town_map.tilemap.rle"

View File

@ -0,0 +1,143 @@
INCLUDE "constants.asm"
SECTION "engine/gfx/load_minor_object_gfx.asm", ROMX
_LoadMinorObjectGFX::
ld hl, wQueuedMinorObjectGFX
push hl
ld a, [hl]
ld l, a
ld h, 0
ld de, .MinorObjectGFX
add hl, hl
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
pop hl
push de
ret
.MinorObjectGFX:
dw .LoadNull
dw .LoadJumpShadow
dw .LoadUnknownBouncingOrb
dw .LoadShockEmote
dw .LoadQuestionEmote
dw .LoadHappyEmote
dw .LoadBoulderDust
dw .LoadGrampsSpriteStandPt0
dw .LoadGrampsSpriteStandPt1
dw .LoadGrampsSpriteWalkPt0
dw .LoadGrampsSpriteWalkPt1
dw .LoadClefairySpriteStandPt0
dw .LoadClefairySpriteStandPt1
dw .LoadClefairySpriteWalkPt0
dw .LoadClefairySpriteWalkPt1
.FarCopy:
ld a, c
ld [wVBCopyFarSrcBank], a
ld a, l
ld [wVBCopyFarSrc], a
ld a, h
ld [wVBCopyFarSrc+1], a
.ContinueFarCopyNewDst:
ld a, e
ld [wVBCopyFarDst], a
ld a, d
ld [wVBCopyFarDst+1], a
.ContinueFarCopy:
ld a, b
ld [wVBCopyFarSize], a
ret
.LoadNull:
ret
.LoadShockEmote:
ld hl, ShockEmoteGFX
jr .load_emote
.LoadQuestionEmote:
ld hl, QuestionEmoteGFX
jr .load_emote
.LoadHappyEmote:
ld hl, HappyEmoteGFX
.load_emote:
ld de, vChars1 tile $78
ld b, (HappyEmoteGFX.end - HappyEmoteGFX) / LEN_2BPP_TILE
ld c, BANK(EmoteGFX)
jp .FarCopy
.LoadJumpShadow:
ld [hl], $00
ld hl, JumpShadowGFX
ld de, vChars1 tile $7c
ld b, (JumpShadowGFX.end - JumpShadowGFX) / LEN_2BPP_TILE
ld c, BANK(JumpShadowGFX)
jp .FarCopy
.LoadUnknownBouncingOrb:
ld [hl], $00
ld hl, UnknownBouncingOrbGFX
ld de, vChars1 tile $7c
ld b, (UnknownBouncingOrbGFX.end - UnknownBouncingOrbGFX) / LEN_2BPP_TILE
ld c, BANK(UnknownBouncingOrbGFX)
jp .FarCopy
.LoadBoulderDust:
ld [hl], $00
ld hl, BoulderDustGFX
ld de, vChars1 tile $7c
ld b, (BoulderDustGFX.end - BoulderDustGFX) / LEN_2BPP_TILE
ld c, BANK(BoulderDustGFX)
jp .FarCopy
.LoadGrampsSpriteStandPt0:
inc [hl]
ld hl, GrampsSpriteGFX
ld de, vChars0
ld b, (GrampsSpriteGFX.end - GrampsSpriteGFX) / LEN_2BPP_TILE / 4
ld c, BANK(GrampsSpriteGFX)
jp .FarCopy
.LoadGrampsSpriteStandPt1:
inc [hl]
ld b, (GrampsSpriteGFX.end - GrampsSpriteGFX) / LEN_2BPP_TILE / 4
jp .ContinueFarCopy
.LoadGrampsSpriteWalkPt0:
inc [hl]
ld de, vChars1
ld b, (GrampsSpriteGFX.end - GrampsSpriteGFX) / LEN_2BPP_TILE / 4
jp .ContinueFarCopyNewDst
.LoadGrampsSpriteWalkPt1:
ld [hl], $00
ld b, (GrampsSpriteGFX.end - GrampsSpriteGFX) / LEN_2BPP_TILE / 4
jp .ContinueFarCopy
.LoadClefairySpriteStandPt0:
inc [hl]
ld hl, ClefairySpriteGFX
ld de, vChars0
ld b, (ClefairySpriteGFX.end - ClefairySpriteGFX) / LEN_2BPP_TILE / 4
ld c, BANK(ClefairySpriteGFX)
jp .FarCopy
.LoadClefairySpriteStandPt1:
inc [hl]
ld b, (ClefairySpriteGFX.end - ClefairySpriteGFX) / LEN_2BPP_TILE / 4
jp .ContinueFarCopy
.LoadClefairySpriteWalkPt0:
inc [hl]
ld de, vChars1
ld b, (ClefairySpriteGFX.end - ClefairySpriteGFX) / LEN_2BPP_TILE / 4
jp .ContinueFarCopyNewDst
.LoadClefairySpriteWalkPt1:
ld [hl], $00
ld b, (ClefairySpriteGFX.end - ClefairySpriteGFX) / LEN_2BPP_TILE / 4
jp .ContinueFarCopy

View File

@ -533,8 +533,8 @@ GetMonSGBPaletteFlags:
.return
ret
Function95f8:
ld hl, BlkPacket_98fc
InitPartyMenuPalettes:
ld hl, BlkPacket_PartyMenu
ld de, wcce2
ld bc, $0030
jp CopyBytes

View File

@ -0,0 +1,185 @@
INCLUDE "constants.asm"
SECTION "engine/items/buy_sell_toss.asm", ROMX
SelectQuantityToToss::
ld hl, TossItem_MenuHeader
call LoadMenuHeader
call Toss_Sell_Loop
ret
SelectQuantityToBuy::
callfar GetItemPrice
ld a, d
ld [wBuySellItemPrice], a
ld a, e
ld [wBuySellItemPrice + 1], a
ld hl, BuyItem_MenuHeader
call LoadMenuHeader
call Toss_Sell_Loop
ret
Toss_Sell_Loop:
ld a, 1
ld [wItemQuantity], a
.preloop
; It won't progress if you're holding the A Button...
call GetJoypad
ldh a, [hJoyState]
bit A_BUTTON_F, a
jr nz, .preloop
.loop
call BuySellToss_UpdateQuantityDisplayAndPrice
call BuySellToss_InterpretJoypad
jr nc, .loop
cp -1
jr nz, .nope ; pressed B
scf
ret
.nope
and a
ret
BuySellToss_InterpretJoypad:
.loop
call DelayFrame
ldh a, [hInMenu]
push af
ld a, 1
ldh [hInMenu], a
call GetJoypadDebounced
pop af
ldh [hInMenu], a
ldh a, [hJoyDown]
bit B_BUTTON_F, a
jr nz, .b
bit A_BUTTON_F, a
jr nz, .a
ldh a, [hJoySum]
bit D_DOWN_F, a
jr nz, .down
bit D_UP_F, a
jr nz, .up
bit D_LEFT_F, a
jr nz, .left
bit D_RIGHT_F, a
jr nz, .right
jr .loop
.b
ld a, -1
scf
ret
.a
scf
ret
.down
ld hl, wItemQuantity
dec [hl]
jr nz, .finish_down
ld a, [wItemQuantityBuffer]
ld [hl], a
.finish_down
and a
ret
.up
ld hl, wItemQuantity
inc [hl]
ld a, [wItemQuantityBuffer]
cp [hl]
jr nc, .finish_up
ld [hl], 1
.finish_up
and a
ret
.left
ld a, [wItemQuantity]
sub 10
jr c, .load_1
jr z, .load_1
jr .finish_left
.load_1
ld a, 1
.finish_left
ld [wItemQuantity], a
and a
ret
.right
ld a, [wItemQuantity]
add 10
ld b, a
ld a, [wItemQuantityBuffer]
cp b
jr nc, .finish_right
ld b, a
.finish_right
ld a, b
ld [wItemQuantity], a
and a
ret
BuySellToss_UpdateQuantityDisplayAndPrice:
call MenuBox
call MenuBoxCoord2Tile
ld de, SCREEN_WIDTH + 1
add hl, de
ld [hl], "×"
inc hl
ld de, wItemQuantity
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNumber
ld a, [wMenuDataPointer]
cp -1
ret nz
xor a
ldh [hMultiplicand], a
ld a, [wBuySellItemPrice]
ldh [hMultiplicand + 1], a
ld a, [wBuySellItemPrice + 1]
ldh [hMultiplicand + 2], a
ld a, [wItemQuantity]
ldh [hMultiplier], a
push hl
call Multiply
ld hl, hMoneyTemp
ldh a, [hProduct + 1]
ld [hli], a
ldh a, [hProduct + 2]
ld [hli], a
ldh a, [hProduct + 3]
ld [hl], a
pop hl
inc hl
ld de, hMoneyTemp
lb bc, 4, 6
call PrintNumber
ld [hl], "円"
call WaitBGMap
ret
TossItem_MenuHeader:
db MENU_BACKUP_TILES
menu_coords 15, 9, $13, 11
dw NULL
db 0
BuyItem_MenuHeader:
db MENU_BACKUP_TILES
menu_coords 7, 15, $13, $11
dw $ff
db $ff

View File

@ -2,6 +2,141 @@ INCLUDE "constants.asm"
SECTION "engine/items/inventory.asm@Inventory", ROMX
; Leftover from Generation I. Equivalent to pokered's AddItemToInventory_.
Unreferenced_ReceiveItem_Old:
ld a, [wItemQuantity]
push af
push bc
push de
push hl
push hl
ld d, 50 ; PC_ITEM_CAPACITY
push hl
ld bc, $2e62 ; TODO: ???
add hl, bc
ld a, h
or l
pop hl
jr nz, .check_if_inventory_full
ld d, 20 ; BAG_ITEM_CAPACITY
.check_if_inventory_full
ld a, [hl]
sub d
ld d, a
ld a, [hli]
and a
jr z, .add_new_item
.not_at_end_of_inventory
ld a, [hli]
ld b, a
ld a, [wCurItem]
cp b
jp z, .increase_item_quantity
inc hl
ld a, [hl]
cp -1
jr nz, .not_at_end_of_inventory
.add_new_item
pop hl
ld a, d
and a
jr z, .done
inc [hl]
ld a, [hl]
add a
dec a
ld c, a
ld b, 0
add hl, bc ; address to store item
ld a, [wCurItem]
ld [hli], a
ld a, [wItemQuantity]
ld [hli], a
ld [hl], -1
jp .success
.increase_item_quantity
ld a, [wItemQuantity]
ld b, a
ld a, [hl]
add b
cp MAX_ITEM_STACK + 1
jp c, .store_new_quantity
sub MAX_ITEM_STACK
ld [wItemQuantity], a
ld a, d
and a
jr z, .increase_item_quantity_failed
ld a, MAX_ITEM_STACK
ld [hli], a
jp .not_at_end_of_inventory
.increase_item_quantity_failed
pop hl
and a
jr .done
.store_new_quantity
ld [hl], a
pop hl
.success
scf
.done
pop hl
pop de
pop bc
pop bc
ld a, b
ld [wItemQuantity], a
ret
Unreferenced_RemoveItemFromInventory_Old:
push hl
inc hl
ld a, [wItemIndex]
ld e, a
ld d, 0
add hl, de
add hl, de
inc hl
ld a, [wItemQuantity]
ld e, a
ld a, [hl]
sub e
ld [hld], a
ld [wItemQuantityBuffer], a
and a
jr nz, .skip_moving_up_slots
ld e, l
ld d, h
inc de
inc de
.loop
ld a, [de]
inc de
ld [hli], a
cp -1
jr nz, .loop
xor a
ld [wMenuScrollPosition], a
ld [wRegularItemsCursor], a
pop hl
ld a, [hl]
dec a
ld [hl], a
ld [wScrollingMenuListSize], a
cp 2
jr c, .done
jr .done
.skip_moving_up_slots
pop hl
.done
ret
_ReceiveItem:
call DoesHLEqualwNumBagItems
jp nz, PutItemInPocket
@ -149,7 +284,7 @@ PutItemInPocket:
jr z, .terminator
cp c
jr nz, .next
ld a, 99
ld a, MAX_ITEM_STACK
sub [hl]
add b
ld b, a
@ -192,12 +327,12 @@ PutItemInPocket:
ld [hl], a
jr .done
; set this slot's quantity to 99,
; set this slot's quantity to MAX_ITEM_STACK,
; and keep iterating through list
; to add remaining amount
.set_max
ld [hl], 99
sub 99
ld [hl], MAX_ITEM_STACK
sub MAX_ITEM_STACK
ld [wItemQuantity], a
jr .loop2
@ -721,3 +856,94 @@ GetItemPrice:
pop bc
pop hl
ret
Unreferenced_TossItem_Old:
push hl
call Unused_IsKeyItem_Old
ld a, [wItemAttributeValue]
and a
jr nz, .cant_toss
ld a, [wCurItem]
ld [wNamedObjectIndexBuffer], a
call GetItemName
call CopyStringToStringBuffer2
ld hl, .ItemsThrowAwayText
call MenuTextBox
call YesNoBox
call CloseWindow
jr c, .cancel
ld a, [wItemIndex]
pop hl
call TossItem
ld a, [wCurItem]
ld [wNamedObjectIndexBuffer], a
call GetItemName
call CopyStringToStringBuffer2
ld hl, .ItemsDiscardedText
call MenuTextBox
call CloseWindow
and a
ret
.cant_toss
ld hl, .ItemsTooImportantText
call MenuTextBox
call CloseWindow
.cancel
pop hl
scf
ret
.ItemsDiscardedText:
text_from_ram wStringBuffer1
text "を" ; "Threw away"
line "すてました!" ; "(item?)!"
prompt
.ItemsThrowAwayText:
text_from_ram wStringBuffer2
text "を すてます" ; "Are you sure you want"
line "ほんとに よろしいですか?" ; "to throw (item?) away?"
prompt
.ItemsTooImportantText:
text "それは とても たいせつなモノです" ; "You can't throw away"
line "すてることは できません!" ; "something that special!"
prompt
Unused_IsKeyItem_Old:
push hl
push bc
ld a, 1
ld [wItemAttributeValue], a
ld a, [wCurItem]
cp ITEM_HM01_RED
jr nc, .check_if_hm
ld hl, ItemAttributes + ITEMATTR_PERMISSIONS
dec a
ld c, a
ld b, 0
rept 5
add hl, bc
endr
ld a, BANK(ItemAttributes)
call GetFarByte
bit 0, a
jr nz, .cant_toss
jr .can_toss
.check_if_hm
ld a, [wCurItem]
call IsHM
jr c, .cant_toss
.can_toss
xor a
ld [wItemAttributeValue], a
.cant_toss
pop bc
pop hl
ret

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
INCLUDE "constants.asm"
SECTION "engine/items/print_item_description.asm", ROMX
PrintItemDescription::
push de
ld hl, ItemDescriptions
ld a, [wSelectedItem]
dec a
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
pop hl
jp PlaceString
INCLUDE "data/items/descriptions.inc"

View File

@ -0,0 +1,241 @@
INCLUDE "constants.asm"
SECTION "engine/items/switch_items.asm", ROMX
SwitchItemsInBag::
ld a, [wSelectedSwapPosition]
and a
jr z, .init
ld b, a
ld a, [wScrollingMenuCursorPosition]
inc a
cp b
jr z, .trivial
ld a, [wScrollingMenuCursorPosition]
call ItemSwitch_GetNthItem
ld a, [hl]
cp -1
ret z
ld a, [wSelectedSwapPosition]
dec a
ld [wSelectedSwapPosition], a
ld a, [wSelectedSwapPosition]
call ItemSwitch_GetNthItem
push hl
ld a, [wScrollingMenuCursorPosition]
call ItemSwitch_GetNthItem
ld a, [hl]
pop hl
cp [hl]
jr z, .combine_stacks
ld a, [wScrollingMenuCursorPosition]
ld c, a
ld a, [wSelectedSwapPosition]
cp c
jr c, .above
jr .below
.init:
ld a, [wScrollingMenuCursorPosition]
inc a
ld [wSelectedSwapPosition], a
ret
.trivial:
xor a
ld [wSelectedSwapPosition], a
ret
.below:
ld a, [wSelectedSwapPosition]
call ItemSwitch_CopyItemToBuffer
ld a, [wScrollingMenuCursorPosition]
ld d, a
ld a, [wSelectedSwapPosition]
ld e, a
call ItemSwitch_GetItemOffset
push bc
ld a, [wSelectedSwapPosition]
call ItemSwitch_GetNthItem
dec hl
push hl
call ItemSwitch_GetItemFormatSize
add hl, bc
ld d, h
ld e, l
pop hl
pop bc
call ItemSwitch_BackwardsCopyBytes
ld a, [wScrollingMenuCursorPosition]
call ItemSwitch_CopyBufferToItem
xor a
ld [wSelectedSwapPosition], a
ret
.above:
ld a, [wSelectedSwapPosition]
call ItemSwitch_CopyItemToBuffer
ld a, [wScrollingMenuCursorPosition]
ld d, a
ld a, [wSelectedSwapPosition]
ld e, a
call ItemSwitch_GetItemOffset
push bc
ld a, [wSelectedSwapPosition]
call ItemSwitch_GetNthItem
ld d, h
ld e, l
call ItemSwitch_GetItemFormatSize
add hl, bc
pop bc
call CopyBytes
ld a, [wScrollingMenuCursorPosition]
call ItemSwitch_CopyBufferToItem
xor a
ld [wSelectedSwapPosition], a
ret
.combine_stacks:
ld a, [wSelectedSwapPosition]
call ItemSwitch_GetNthItem
inc hl
push hl
ld a, [wScrollingMenuCursorPosition]
call ItemSwitch_GetNthItem
inc hl
ld a, [hl]
pop hl
add [hl]
cp MAX_ITEM_STACK + 1
jr c, .merge_stacks
sub MAX_ITEM_STACK
push af
ld a, [wScrollingMenuCursorPosition]
call ItemSwitch_GetNthItem
inc hl
ld [hl], MAX_ITEM_STACK
ld a, [wSelectedSwapPosition]
call ItemSwitch_GetNthItem
inc hl
pop af
ld [hl], a
xor a
ld [wSelectedSwapPosition], a
ret
.merge_stacks:
push af
ld a, [wScrollingMenuCursorPosition]
call ItemSwitch_GetNthItem
inc hl
pop af
ld [hl], a
ld hl, wMenuData_ItemsPointerAddr
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [wSelectedSwapPosition]
cp [hl]
jr nz, .not_combining_last_item
dec [hl]
ld a, [wSelectedSwapPosition]
call ItemSwitch_GetNthItem
ld [hl], -1 ; end
xor a
ld [wSelectedSwapPosition], a
ret
.not_combining_last_item:
dec [hl]
call ItemSwitch_GetItemFormatSize
push bc
ld a, [wSelectedSwapPosition]
call ItemSwitch_GetNthItem
pop bc
push hl
add hl, bc
pop de
.copy_loop
ld a, [hli]
ld [de], a
inc de
cp -1 ; end?
jr nz, .copy_loop
xor a
ld [wSelectedSwapPosition], a
ret
ItemSwitch_CopyItemToBuffer:
call ItemSwitch_GetNthItem
ld de, wSwitchItemBuffer
call ItemSwitch_GetItemFormatSize
call CopyBytes
ret
ItemSwitch_CopyBufferToItem:
call ItemSwitch_GetNthItem
ld d, h
ld e, l
ld hl, wSwitchItemBuffer
call ItemSwitch_GetItemFormatSize
call CopyBytes
ret
ItemSwitch_GetNthItem:
push af
call ItemSwitch_GetItemFormatSize
ld hl, wMenuDataDisplayFunctionPointer + 1
ld a, [hli]
ld h, [hl]
ld l, a
inc hl
pop af
call AddNTimes
ret
ItemSwitch_GetItemOffset:
push hl
call ItemSwitch_GetItemFormatSize
ld a, d
sub e
jr nc, .dont_negate
dec a
cpl
.dont_negate
ld hl, 0
call AddNTimes
ld b, h
ld c, l
pop hl
ret
ItemSwitch_GetItemFormatSize:
push hl
ld a, [wMenuData_ScrollingMenuItemFormat]
ld c, a
ld b, 0
ld hl, .item_format_sizes
add hl, bc
add hl, bc
ld c, [hl]
inc hl
ld b, [hl]
pop hl
ret
.item_format_sizes:
; entries correspond to SCROLLINGMENU_ITEMS_* constants
dw 0 ; unused
dw 1 ; SCROLLINGMENU_ITEMS_NORMAL
dw 2 ; SCROLLINGMENU_ITEMS_QUANTITY
ItemSwitch_BackwardsCopyBytes:
.loop
ld a, [hld]
ld [de], a
dec de
dec bc
ld a, b
or c
jr nz, .loop
ret

459
engine/items/tm_holder.asm Normal file
View File

@ -0,0 +1,459 @@
INCLUDE "constants.asm"
SECTION "engine/items/tm_holder.asm", ROMX
_TMHolder:
ld a, 1
ldh [hInMenu], a
call TM_HolderLoop
ld a, 0
ldh [hInMenu], a
ret nc
call PlaceHollowCursor
call WaitBGMap
ld a, 1
ldh [hBGMapMode], a
ld a, [wCurItem]
cp NUM_TM_HM + 1
ret nc
ld [wTempTMHM], a
predef GetTMHMMove
ld a, [wTempTMHM]
ld [wPutativeTMHMMove], a
call GetMoveName
call CopyStringToStringBuffer2
ld hl, BootedTMText
call PrintText
ld hl, ContainedMoveText
call PrintText
call YesNoBox
jp c, .cancel
.AskTeachTMHM:
.loopback
ld hl, wStringBuffer2
ld de, wTMHMMoveNameBackup
ld bc, MOVE_NAME_LENGTH
call CopyBytes
ld hl, wStateFlags
res SPRITE_UPDATES_DISABLED_F, [hl]
ld a, PARTYMENUACTION_TEACH_TMHM
ld [wPartyMenuActionText], a
predef OpenPartyMenu_ClearGraphics
push af
ld hl, wTMHMMoveNameBackup
ld de, wStringBuffer2
ld bc, MOVE_NAME_LENGTH
call CopyBytes
pop af
jr nc, .TeachTMHM
jp .done
.TeachTMHM:
predef CanLearnTMHMMove
push bc
ld a, [wCurPartyMon]
ld hl, wPartyMonNicknames
call GetNick
pop bc
ld a, c
and a
jr nz, .compatible
push de
ld de, SFX_WRONG
call PlaySFX
pop de
ld hl, TMHMNotCompatibleText
call PrintText
jr .loopback
.compatible
callfar KnowsMove
jr c, .loopback
predef LearnMove
ld a, b
and a
jr z, .cancel
call ConsumeTM
jr .done
.cancel
ld a, $2
ld [wItemEffectSucceeded], a
.done
call ClearBGPalettes
call ClearSprites
ld hl, wStateFlags
set SPRITE_UPDATES_DISABLED_F, [hl]
call RestoreScreenAndReloadTiles
call GetMemSGBLayout
ret
BootedTMText:
text "<TM>を きどうした!"
prompt
Unreferenced_BootedHMText:
text "ひでんマシンを きどうした!"
ContainedMoveText:
text "なかには @"
text_from_ram wStringBuffer2
text "が"
line "きろくされていた!"
para "@"
text_from_ram wStringBuffer2
text "を"
line "#に おぼえさせますか?"
done
TMHMNotCompatibleText:
text_from_ram wStringBuffer1
text "と @"
text_from_ram wStringBuffer2
text "は"
line "あいしょうが わるかった!"
para "@"
text_from_ram wStringBuffer2
text "は おぼえられない!"
prompt
db $02, $04, $00, $01
db $0c, $20
db $c3
TM_HolderLoop:
xor a
ldh [hBGMapMode], a
call TMHolder_DisplayItems
ld a, 2
ld [w2DMenuCursorInitY], a
ld a, 4
ld [w2DMenuCursorInitX], a
ld a, 1
ld [w2DMenuNumCols], a
ld a, 4
sub d
inc a
cp 5
jr nz, .okay
dec a
.okay
ld [w2DMenuNumRows], a
ld a, _2DMENU_EXIT_UP | _2DMENU_EXIT_DOWN
ld [w2DMenuFlags1], a
xor a
ld [w2DMenuFlags2], a
ld a, $20
ld [w2DMenuCursorOffsets], a
ld a, D_UP | D_DOWN | A_BUTTON | B_BUTTON
ld [wMenuJoypadFilter], a
ld a, [wTMHolderCursor]
inc a
ld [wMenuCursorY], a
ld a, 1
ld [wMenuCursorX], a
jr TMHolder_ShowTMMoveDescription
TMHolder_JoypadLoop:
call TMHolder_DisplayItems
TMHolder_JoypadLoop_SkipDisplay:
call WaitBGMap
ld a, $1
ldh [hBGMapMode], a
call StaticMenuJoypad
ld b, a
ld a, [wMenuCursorY]
dec a
ld [wTMHolderCursor], a
xor a
ldh [hBGMapMode], a
ld a, [w2DMenuFlags2]
bit _2DMENU_EXITING_F, a
jp nz, TMHM_ScrollHolder
ld a, b
bit A_BUTTON_F, a
jp nz, TMHM_CheckHoveringOverCancel
bit B_BUTTON_F, a
jp nz, ExitTMHolder
TMHolder_ShowTMMoveDescription:
call TMHM_CheckHoveringOverCancel
hlcoord 0, 10
ld b, 6
ld c, SCREEN_WIDTH - 2
call DrawTextBox
call UpdateSprites
ld a, [wCurItem]
cp NUM_TM_HM + 1
jr nc, TMHolder_JoypadLoop_SkipDisplay
ld [wTempTMHM], a
hlcoord 1, 12
ld de, TMHM_TypeString
call PlaceString
predef GetTMHMMove
ld a, [wTempTMHM]
ld [wSelectedItem], a
ld b, a
hlcoord 5, 12
predef PrintMoveType
hlcoord 1, 14
call PrintMoveDescription
hlcoord 11, 12
ld de, TMHM_PowerString
call PlaceString
ld a, [wSelectedItem]
dec a
ld hl, Moves + MOVE_POWER
ld bc, MOVE_LENGTH
call AddNTimes
ld a, BANK(Moves)
call GetFarByte
hlcoord 16, 12
cp 2
jr c, .no_power
; Store the power of the move in wTempByteValue.
ld [wTempByteValue], a
ld de, wTempByteValue
lb bc, 1, 3
call PrintNumber
jp TMHolder_JoypadLoop
.no_power
ld de, TMHM_ThreeDashesString
call PlaceString
jp TMHolder_JoypadLoop
TMHM_CheckHoveringOverCancel:
call TMHM_GetCurrentHolderPosition
ld a, [wMenuCursorY]
ld b, a
.loop
inc c
ld a, c
cp NUM_TM_HM + 1
jr nc, .okay
ld a, [hli]
and a
jr z, .loop
dec b
jr nz, .loop
ld a, c
.okay
ld [wCurItem], a
cp -1
ret
ExitTMHolder:
and a
ret
TMHM_ScrollHolder:
ld a, b
bit D_DOWN_F, a
jr nz, .down
ld hl, wTMHolderScrollPosition
ld a, [hl]
and a
jp z, TMHolder_JoypadLoop
dec [hl]
call TMHolder_DisplayItems
jp TMHolder_ShowTMMoveDescription
.down
call TMHM_GetCurrentHolderPosition
ld b, $5
.loop:
inc c
ld a, c
cp NUM_TM_HM + 1
jp nc, TMHolder_JoypadLoop
ld a, [hli]
and a
jr z, .loop
dec b
jr nz, .loop
ld hl, wTMHolderScrollPosition
inc [hl]
call TMHolder_DisplayItems
jp TMHolder_ShowTMMoveDescription
TMHM_PowerString:
db "いりょく/@"
TMHM_ThreeDashesString:
db "ーーー@"
TMHM_TypeString:
db "タイプ/@"
TMHolder_DisplayItems:
hlcoord 3, 0
ld b, 8
ld c, 15
call DrawTextBox
call TMHM_GetCurrentHolderPosition
ld d, 4
.next
inc c
ld a, c
cp NUM_TM_HM + 1
jr nc, .cancel
ld a, [hli]
and a
jr z, .next
ld b, a
ld a, c
ld [wTempTMHM], a
push hl
push de
push bc
call .GetCurrentLineCoord
push hl
ld de, wTempTMHM
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNumber
predef GetTMHMMove
ld a, [wTempTMHM]
ld [wPutativeTMHMMove], a
call GetMoveName
pop hl
ld bc, $3
add hl, bc
push hl
call PlaceString
pop hl
ld bc, $8
add hl, bc
ld [hl], "×"
inc hl
ld a, ""
pop bc
push bc
ld a, b
ld [wTempTMHM], a
ld de, wTempTMHM
lb bc, 1, 2
call PrintNumber
pop bc
pop de
pop hl
dec d
jr nz, .next
jr .done
.cancel
call .GetCurrentLineCoord
; Write "CANCEL"
ld a, "や"
ld [hli], a
ld a, "め"
ld [hli], a
ld [hl], "る"
.done
ret
.GetCurrentLineCoord:
hlcoord 5, 0
ld bc, SCREEN_WIDTH * 2
ld a, 5
sub d
ld d, a
.line_loop
add hl, bc
dec d
jr nz, .line_loop
ret
TMHM_GetCurrentHolderPosition:
ld hl, wTMsHMs
ld a, [wTMHolderScrollPosition]
ld b, a
inc b
ld c, 0
.loop
inc c
ld a, [hli]
and a
jr z, .loop
dec b
jr nz, .loop
dec hl
dec c
ret
Unreferenced_VerboseReceiveTMHM_Old:
call .CheckHaveRoomForTMHM
ld hl, .NoRoomTMHMText
jr nc, .full
ld hl, .ReceivedTMHMText
.full
jp PrintText
.NoRoomTMHMText:
text_from_ram wStringBuffer1
text "は これいじょう"
line "もてません!"
prompt
.ReceivedTMHMText:
text_from_ram wStringBuffer1
text "を てにいれた!"
prompt
.CheckHaveRoomForTMHM:
ld a, [wCurItem]
dec a
ld hl, wTMsHMs
ld b, $0
ld c, a
add hl, bc
ld a, [hl]
inc a
cp 10
ret nc
ld [hl], a
ret
ConsumeTM:
ld a, [wCurItem]
dec a
ld hl, wTMsHMs
ld b, $0
ld c, a
add hl, bc
ld a, [hl]
and a
ret z
dec a
ld [hl], a
ret nz
ld [wTMHolderScrollPosition], a
ret

View File

@ -8,7 +8,7 @@ CanLearnTMHMMove:
; Sets register c to 1 if TM/HM is in learnset OR if debug is enabled.
ld a, [wDebugFlags]
ld c, 01
bit 1, a
bit DEBUG_FIELD_F, a
ret nz
ld a, [wCurPartySpecies]

View File

@ -0,0 +1,14 @@
INCLUDE "constants.asm"
SECTION "engine/items/update_item_description.asm", ROMX
UpdateItemDescription::
ld a, [wMenuSelection]
ld [wSelectedItem], a
hlcoord 0, 12
ld b, 4
ld c, 18
call DrawTextBox
decoord 1, 14
callfar PrintItemDescription
ret

View File

@ -0,0 +1,43 @@
INCLUDE "constants.asm"
SECTION "engine/link/time_capsule_2.asm", ROMX
; Takes the DEX_* index stored in wTempSpecies,
; finds its MON_* in the Pokered_MonIndices table,
; and returns its index in wTempSpecies.
ConvertMon_2to1::
push bc
push hl
ld a, [wTempSpecies]
ld b, a
ld c, $00
ld hl, Pokered_MonIndices
.loop
inc c
ld a, [hli]
cp b
jr nz, .loop
ld a, c
ld [wTempSpecies], a
pop hl
pop bc
ret
; Takes the MON_* value stored in wTempSpecies
; and returns the corresponding DEX_* value from Pokered_MonIndices in wTempSpecies.
ConvertMon_1to2::
push bc
push hl
ld a, [wTempSpecies]
dec a
ld hl, Pokered_MonIndices
ld b, $00
ld c, a
add hl, bc
ld a, [hl]
ld [wTempSpecies], a
pop hl
pop bc
ret
INCLUDE "data/pokemon/gen1_order.inc"

View File

@ -7,7 +7,7 @@ FrameTypeDialog:
call LoadMenuHeader
ld a, [wActiveFrame]
inc a
ld [wMenuCursorBuffer], a
ld [wMenuCursorPosition], a
call VerticalMenu
jr c, .close
ld a, [wMenuCursorY]

View File

@ -51,7 +51,7 @@ InitializeNewGameWRAM:
ld hl, wPartyCount
call .InitList
ld hl, wBoxListLength
ld hl, wBoxCount
call .InitList
ld hl, wNumBagItems
call .InitList

384
engine/menu/menu.asm Normal file
View File

@ -0,0 +1,384 @@
INCLUDE "constants.asm"
SECTION "engine/menu/menu.asm", ROMX
_PushWindow::
xor a ; BANK(sWindowStack)
call OpenSRAM
ld hl, wWindowStackPointer
ld e, [hl]
inc hl
ld d, [hl]
push de
ld b, wMenuDataHeaderEnd - wMenuDataHeader
ld hl, wMenuDataHeader
.loop
ld a, [hli]
ld [de], a
dec de
dec b
jr nz, .loop
; If bit MENU_BACKUP_TILES_F or MENU_BACKUP_TILES_2_F of the menu flags is set,
; also set bit MENU_RESTORE_TILES_F of the address at 7:[wWindowStackPointer],
; and draw the menu using the coordinates from the header.
; Otherwise, reset bit MENU_RESTORE_TILES_F of 7:[wWindowStackPointer].
ld a, [wMenuFlags]
bit MENU_BACKUP_TILES_F, a
jr nz, .backup_tiles
bit MENU_BACKUP_TILES_2_F, a
jr z, .no_backup_tiles
; Don't bother backing up tiles if it doesn't overlap with any other windows.
push de
call PushWindow_CheckForOtherWindowOverlap
pop de
jr nc, .no_backup_tiles
.backup_tiles
ld hl, wWindowStackPointer
ld a, [hli]
ld h, [hl]
ld l, a
set MENU_RESTORE_TILES_F, [hl]
call MenuBoxCoord2Tile
call GetMenuBoxDims
inc b
inc c
call .CheckForOverflow
.row
push bc
push hl
.col
ld a, [hli]
ld [de], a
dec de
dec c
jr nz, .col
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
jr nz, .row
jr .done
.no_backup_tiles
pop hl ; last-pushed register was de
push hl
ld a, [hld]
ld l, [hl]
ld h, a
res MENU_RESTORE_TILES_F, [hl]
.done
pop hl ; last-pushed register was de
call .CheckForOverflow
; Push the previous window address onto the bottom for easy access
ld a, h
ld [de], a
dec de
ld a, l
ld [de], a
dec de
ld hl, wWindowStackPointer
ld [hl], e
inc hl
ld [hl], d
call CloseSRAM
ld hl, wWindowStackSize
inc [hl]
ret
; Dummied out in the final game. See _PushWindow.ret in pokegold.
; hl = starting position of search.
; de = ending position of search.
; bc = dimensions of menu box (optional)
.CheckForOverflow:
push bc
push de
push hl
xor a
ld l, c
ld h, 0
ld c, b
ld b, 0
ld a, SCREEN_WIDTH
call AddNTimes
ld a, h
cpl
ld h, a
ld a, l
cpl
ld l, a
inc hl
add hl, de
ld a, e
sub LOW(sWindowStackBottom)
ld a, d
sbc HIGH(sWindowStackBottom)
jr c, .window_stack_overflow
pop hl
pop de
pop bc
ret
.window_stack_overflow:
ld hl, .WindowSaveAreaOverflowText
call PrintText
call WaitBGMap
.indefinite_loop
nop
jr .indefinite_loop
.WindowSaveAreaOverflowText:
text "ウィンドウセーブエりアが"
next "オーバーしました"
done
; Returns the carry flag if any of the other windows overlap with the current window.
PushWindow_CheckForOtherWindowOverlap:
ld hl, wWindowStackPointer
ld a, [hli]
ld h, [hl]
ld l, a
.loop
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
or h
jr z, .stack_bottom_reached
push hl
dec hl ; top coord
ld b, [hl]
dec hl ; left coord
ld c, [hl]
dec hl ; bottom coord
ld d, [hl]
dec hl ; right coord
ld e, [hl]
call .AvoidRedundantTiles
pop hl
ret c
jr .loop
; Check again, but in reverse: if the current window overlaps with any other windows, set the carry flag.
.stack_bottom_reached:
ld hl, wMenuBorderTopCoord
ld b, [hl]
inc hl ; wMenuBorderLeftCoord
ld c, [hl]
inc hl ; wMenuBorderBottomCoord
ld d, [hl]
inc hl ; wMenuBorderRightCoord
ld e, [hl]
inc hl ; not necessary if we're overwriting hl right after
ld hl, wWindowStackPointer
ld a, [hli]
ld h, [hl]
ld l, a
.loop2
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
or h
ret z
push hl
ld a, [hld] ; top coord
ld l, [hl] ; left coord
ld h, a
call .CheckIfInCoordRange
pop hl
ret c
jr .loop2
.AvoidRedundantTiles:
ld a, [wMenuBorderTopCoord]
ld h, a
ld a, [wMenuBorderLeftCoord]
ld l, a
call .CheckIfInCoordRange
ret c
ld a, [wMenuBorderBottomCoord]
ld h, a
call .CheckIfInCoordRange
ret c
ld a, [wMenuBorderRightCoord]
ld l, a
call .CheckIfInCoordRange
ret c
ld a, [wMenuBorderTopCoord]
ld h, a
call .CheckIfInCoordRange
ret
; If b <= h <= d && c <= l <= e, set carry flag.
; b, h, and d are generally used for vertical positioning, and the others for horizontal positioning.
; It doesn't really matter which one has which, though.
.CheckIfInCoordRange:
ld a, h
cp b
jr c, .out_of_range
cp d
jr c, .next_range
jr nz, .out_of_range
.next_range
ld a, l
cp c
jr c, .out_of_range
cp e
jr c, .in_range
jr nz, .out_of_range
.in_range
scf
ret
.out_of_range
and a
ret
_ExitMenu::
xor a
ldh [hBGMapMode], a
xor a ; BANK(sWindowStack)
call OpenSRAM
call GetWindowStackTop
ld a, l
or h
jp z, Error_Cant_ExitMenu
ld a, l
ld [wWindowStackPointer], a
ld a, h
ld [wWindowStackPointer + 1], a
call PopWindow
ld a, [wMenuFlags]
bit MENU_RESTORE_TILES_F, a
jr z, .loop
ld d, h
ld e, l
call RestoreTileBackup
.loop
call GetWindowStackTop
ld a, h
or l
jr z, .done
call PopWindow
.done
call CloseSRAM
ld hl, wWindowStackSize
dec [hl]
ret
Error_Cant_ExitMenu:
ld hl, .WindowPoppingErrorText
call PrintText
call WaitBGMap
.infinite_loop
jr .infinite_loop
.WindowPoppingErrorText:
text "ポップできる ウィンドウが"
next "ありません!"
done
_ExitAllMenus::
.loop
xor a ; BANK(sWindowStack)
call OpenSRAM
call GetWindowStackTop
ld a, l
or h
jr z, .stack_bottom_reached
call _ExitMenu
jr .loop
.stack_bottom_reached
call CloseSRAM
ret
_InitVerticalMenuCursor::
ld a, [wMenuDataHeaderEnd]
ld b, a
ld hl, wMoreMenuData
ld a, [wMenuBorderTopCoord]
inc a
bit STATICMENU_NO_TOP_SPACING_F, b
jr nz, .skip_offset
inc a
.skip_offset
ld [hli], a
; w2DMenuCursorInitX
ld a, [wMenuBorderLeftCoord]
inc a
ld [hli], a
; w2DMenuNumRows
ld a, [wMenuDataItems]
ld [hli], a
; w2DMenuNumCols
ld a, 1
ld [hli], a
; w2DMenuFlags1
ld [hl], 0
bit STATICMENU_WRAP_F, b
jr z, .skip_bit_5
set _2DMENU_WRAP_UP_DOWN_F, [hl]
.skip_bit_5
ld a, [wMenuFlags]
bit MENU_SPRITE_ANIMS_F, a
jr z, .skip_bit_6
set _2DMENU_ENABLE_SPRITE_ANIMS_F, [hl]
.skip_bit_6
inc hl
; w2DMenuFlags2
xor a
ld [hli], a
; w2DMenuCursorOffsets
ln a, 2, 0
ld [hli], a
; wMenuJoypadFilter
ld a, A_BUTTON
bit STATICMENU_DISABLE_B_F, b
jr nz, .skip_bit_1
add B_BUTTON
.skip_bit_1
ld [hli], a
; wMenuCursorY
ld a, [wMenuCursorPosition]
and a
jr z, .load_at_the_top
ld c, a
ld a, [wMenuDataItems]
cp c
jr nc, .load_position
.load_at_the_top
ld c, 1
.load_position
ld [hl], c
inc hl
; wMenuCursorX
ld a, 1
ld [hli], a
; wCursorOffCharacter, wCursorCurrentTile
xor a
ld [hli], a
ld [hli], a
ld [hli], a
ret

201
engine/menu/menu_2.asm Normal file
View File

@ -0,0 +1,201 @@
INCLUDE "constants.asm"
SECTION "engine/menu/menu_2.asm", ROMX
PlacePackItems::
ld a, [wMenuSelection]
cp -1
jr z, .cancel
push de
callfar CheckItemMenu
ld a, [wItemAttributeValue]
ld e, a
ld d, 0
ld hl, .attribute_icons
add hl, de
ld a, [hl]
pop de
ld [de], a
inc de
jr PlaceMenuItemName
.attribute_icons:
db " "
db $62 ; TM Holder icon
db $64 ; Ball Holder icon
db $63 ; Key Items icon
db " "
db " "
db " "
.cancel
ld h, d
ld l, e
ld de, .CancelString
call PlaceString
ret
.CancelString:
db " ーーやめるーー@"
PlaceMenuItemName::
push de
ld a, [wMenuSelection]
ld [wNamedObjectIndexBuffer], a
call GetItemName
pop hl
call PlaceString
ret
PlaceMenuItemQuantity::
push de
ld a, [wMenuSelection]
ld [wCurItem], a
callfar _CheckTossableItem
ld a, [wItemAttributeValue]
pop hl
and a
jr nz, .done
ld [hl], "×"
inc hl
ld de, wMenuSelectionQuantity
lb bc, 1, 2
call PrintNumber
.done
ret
PlacePartyMonNicknames::
ld hl, wPartyMonNicknames
jr PlaceMonNicknames
PlaceBoxMonNicknames::
ld hl, wBoxMonNicknames
PlaceMonNicknames:
push de
ld a, [wScrollingMenuCursorPosition]
call GetNick
pop hl
call PlaceString
ret
PlacePartyMonLevels::
ld a, PARTYMON
ld [wMonType], a
jr PlaceMonLevels
PlaceBoxMonLevels::
ld a, BOXMON
ld [wMonType], a
PlaceMonLevels:
push de
ld a, [wScrollingMenuCursorPosition]
ld [wCurPartyMon], a
predef CopyMonToTempMon
pop hl
call PrintLevel
ret
; Unreferenced.
ret
; Prints the names, nicknames, levels, and genders of Pokémon.
PlaceDetailedBoxMonView::
push de
ld a, [wScrollingMenuCursorPosition]
ld c, a
ld b, 0
ld hl, wBoxSpecies
add hl, bc
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
pop hl
call PlaceString
ld de, MON_NAME_LENGTH
add hl, de
push hl
ld a, [wScrollingMenuCursorPosition]
ld hl, wBoxMonNicknames
call GetNick
pop hl
call PlaceString
ld de, MON_NAME_LENGTH
add hl, de
push hl
ld a, [wScrollingMenuCursorPosition]
ld [wCurPartyMon], a
ld a, BOXMON
ld [wMonType], a
predef CopyMonToTempMon
pop hl
push hl
call PrintLevel
pop hl
ld de, 3
add hl, de
push hl
callfar GetGender
ld a, "♂"
jr c, .male
ld a, "♀"
.male
pop hl
ld [hl], a
ret
Unreferenced_PlaceMoneyTextbox_Old::
ld hl, .MenuHeader
call CopyMenuHeader
call MenuBox
call PlaceVerticalMenuItems
call MenuBoxCoord2Tile
ld de, SCREEN_WIDTH + 1
add hl, de
ld de, wMoney
lb bc, PRINTNUM_RIGHTALIGN | 3, 6
call PrintNumber
ret
.MenuHeader:
db 0
menu_coords 11, 0, SCREEN_WIDTH - 1, 2
dw .MenuData
db 1
.MenuData:
db STATICMENU_NO_TOP_SPACING
db 1
db "      円@"
PlaceMoneyTopRight::
ld hl, MoneyTopRightMenuHeader
call CopyMenuHeader
jr PlaceMoneyTextbox
; Unreferenced.
PlaceMoneyAtTopLeftOfTextbox::
ld hl, MoneyTopRightMenuHeader
ld d, 11
ld e, 0
call OffsetMenuHeader
PlaceMoneyTextbox:
call MenuBox
call MenuBoxCoord2Tile
ld de, SCREEN_WIDTH + 1
add hl, de
ld de, wMoney
lb bc, PRINTNUM_RIGHTALIGN | 3, 6
call PrintNumber
ld [hl], "円"
ret
MoneyTopRightMenuHeader:
db MENU_BACKUP_TILES
menu_coords 11, 0, SCREEN_WIDTH - 1, 2
dw NULL
db 1

View File

@ -0,0 +1,514 @@
INCLUDE "constants.asm"
SECTION "engine/menu/scrolling_menu.asm", ROMX
_InitScrollingMenu::
xor a
ld [wMenuJoypad], a
ldh [hBGMapMode], a
inc a
ldh [hInMenu], a
ld hl, wOptions
set NO_TEXT_SCROLL_F, [hl]
call InitScrollingMenuCursor
call ScrollingMenu_InitFlags
ld c, 10
call DelayFrames
call ScrollingMenuMain
ret
_ScrollingMenu::
.loop
call ScrollingMenuJoyAction
jp c, .exit
ld a, 0
ldh [hJoypadSum], a
call z, ScrollingMenuMain
jr .loop
.exit
ld [wMenuJoypad], a
ld a, 0
ldh [hInMenu], a
ld hl, wOptions
res NO_TEXT_SCROLL_F, [hl]
ret
ScrollingMenuMain::
xor a
ldh [hBGMapMode], a
call ScrollingMenu_UpdateDisplay
call ScrollingMenu_PlaceCursor
call ScrollingMenu_CheckCallFunction3
xor a
ldh [hJoypadSum], a
call WaitBGMap
ret
ScrollingMenuJoyAction::
call ScrollingMenuJoypad
ldh a, [hJoySum]
and D_PAD
ld b, a
ldh a, [hJoypadSum]
and BUTTONS
or b
bit A_BUTTON_F, a
jp nz, .a_button
bit B_BUTTON_F, a
jp nz, .b_button
bit SELECT_F, a
jp nz, .select
bit START_F, a
jp nz, .start
bit D_RIGHT_F, a
jp nz, .d_right
bit D_LEFT_F, a
jp nz, .d_left
bit D_UP_F, a
jp nz, .d_up
bit D_DOWN_F, a
jp nz, .d_down
jr ScrollingMenuJoyAction
; unreferenced
.no_zero_no_carry
ld a, -1
and a
ret
.a_button
call PlaceHollowCursor
ld a, [wMenuCursorY]
dec a
call ScrollingMenu_GetListItemCoordAndFunctionArgs
ld a, [wMenuSelection]
ld [wCurItem], a
ld a, [wMenuSelectionQuantity]
ld [wItemQuantityBuffer], a
call ScrollingMenu_GetCursorPosition
dec a
ld [wScrollingMenuCursorPosition], a
ld [wCurItemQuantity], a
ld a, [wMenuSelection]
cp -1
jr z, .b_button
ld a, A_BUTTON
scf
ret
.b_button
ld a, B_BUTTON
scf
ret
.select
ld a, [wMenuDataFlags]
bit SCROLLINGMENU_ENABLE_SELECT_F, a
jp z, xor_a_dec_a
ld a, [wMenuCursorY]
dec a
call ScrollingMenu_GetListItemCoordAndFunctionArgs
ld a, [wMenuSelection]
cp -1
jp z, xor_a_dec_a
call ScrollingMenu_GetCursorPosition
dec a
ld [wScrollingMenuCursorPosition], a
ld a, SELECT
scf
ret
.start
ld a, [wMenuDataFlags]
bit SCROLLINGMENU_ENABLE_START_F, a
jp z, xor_a_dec_a
ld a, START
scf
ret
.d_left
ld hl, w2DMenuFlags2
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, [hl]
jp z, xor_a_dec_a
ld a, [wMenuDataHeaderEnd]
bit SCROLLINGMENU_ENABLE_LEFT_F, a
jp z, xor_a_dec_a
ld a, D_LEFT
scf
ret
.d_right
ld hl, w2DMenuFlags2
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, [hl]
jp z, xor_a_dec_a
ld a, [wMenuDataHeaderEnd]
bit SCROLLINGMENU_ENABLE_RIGHT_F, a
jp z, xor_a_dec_a
ld a, D_RIGHT
scf
ret
.d_up
ld hl, w2DMenuFlags2
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, [hl]
jp z, xor_a
ld hl, wMenuScrollPosition
ld a, [hl]
and a
jp z, xor_a ; xor_a_dec_a in final game
dec [hl]
jp xor_a
.d_down
ld hl, w2DMenuFlags2
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, [hl]
jp z, xor_a
ld hl, wMenuScrollPosition
ld a, [wMenuData_ScrollingMenuHeight]
add [hl]
ld b, a
ld a, [wScrollingMenuListSize]
cp b
jp c, xor_a ; xor_a_dec_a in final game
inc [hl]
jp xor_a
ScrollingMenu_GetCursorPosition:
ld a, [wMenuScrollPosition]
ld c, a
ld a, [wMenuCursorY]
add c
ld c, a
ret
ScrollingMenu_ClearLeftColumn::
call MenuBoxCoord2Tile
ld de, SCREEN_WIDTH
add hl, de
ld de, 2 * SCREEN_WIDTH
ld a, [wMenuData_ScrollingMenuHeight]
.loop
ld [hl], " "
add hl, de
dec a
jr nz, .loop
ret
InitScrollingMenuCursor::
ld hl, wMenuData_ItemsPointerAddr
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [wMenuData_ItemsPointerBank]
call GetFarByte
ld [wScrollingMenuListSize], a
ld a, [wMenuScrollPosition]
ld c, a
ld a, [wMenuCursorPosition]
add c
ld b, a
ld a, [wScrollingMenuListSize]
inc a
cp b
jr c, .wrap
ld a, [wMenuScrollPosition]
ld c, a
ld a, [wMenuData_ScrollingMenuHeight]
add c
ld b, a
ld a, [wScrollingMenuListSize]
inc a
cp b
jr nc, .done
.wrap
xor a
ld [wMenuScrollPosition], a
ld a, 1
ld [wMenuCursorPosition], a
.done
ret
ScrollingMenu_InitFlags::
ld a, [wMenuDataFlags]
ld c, a
ld a, [wScrollingMenuListSize]
ld b, a
ld a, [wMenuBorderTopCoord]
add 1
ld [w2DMenuCursorInitY], a
ld a, [wMenuBorderLeftCoord]
add 0
ld [w2DMenuCursorInitX], a
ld a, [wMenuData_ScrollingMenuHeight]
cp b
jr c, .no_extra_row
jr z, .no_extra_row
ld a, b
inc a
.no_extra_row
ld [w2DMenuNumRows], a
ld a, 1
ld [w2DMenuNumCols], a
ld a, _2DMENU_EXIT_UP | _2DMENU_EXIT_DOWN | _2DMENU_DISABLE_JOYPAD_FILTER
bit SCROLLINGMENU_ENABLE_RIGHT_F, c
jr z, .skip_set_0
set _2DMENU_EXIT_RIGHT_F, a
.skip_set_0
bit SCROLLINGMENU_ENABLE_LEFT_F, c
jr z, .skip_set_1
set _2DMENU_EXIT_LEFT_F, a
.skip_set_1
ld [w2DMenuFlags1], a
xor a
ld [w2DMenuFlags2], a
ld a, $20
ld [w2DMenuCursorOffsets], a
ld a, A_BUTTON | B_BUTTON | D_UP | D_DOWN
bit SCROLLINGMENU_ENABLE_SELECT_F, c
jr z, .disallow_select
add SELECT
.disallow_select
bit SCROLLINGMENU_ENABLE_START_F, c
jr z, .disallow_start
add START
.disallow_start
ld [wMenuJoypadFilter], a
ld a, [w2DMenuNumRows]
ld b, a
ld a, [wMenuCursorPosition]
and a
jr z, .reset_cursor
cp b
jr z, .cursor_okay
jr c, .cursor_okay
.reset_cursor
ld a, 1
.cursor_okay
ld [wMenuCursorY], a
ld a, 1
ld [wMenuCursorX], a
xor a
ld [wCursorCurrentTile], a
ld [wCursorCurrentTile + 1], a
ld [wCursorOffCharacter], a
ret
ScrollingMenu_UpdateDisplay::
call ClearWholeMenuBox
ld a, [wMenuScrollPosition]
and a
jr z, .okay
ld a, [wMenuBorderTopCoord]
ld b, a
ld a, [wMenuBorderRightCoord]
ld c, a
call Coord2Tile
ld [hl], "▲"
.okay
call MenuBoxCoord2Tile
ld bc, SCREEN_WIDTH + 1
add hl, bc
ld a, [wMenuDataItems]
ld b, a
ld c, 0
.loop
ld a, [wMenuScrollPosition]
add c
ld [wScrollingMenuCursorPosition], a
ld a, c
call ScrollingMenu_GetListItemCoordAndFunctionArgs
ld a, [wMenuSelection]
cp -1
jr z, .cancel
push bc
push hl
call ScrollingMenu_CallFunctions1and2
pop hl
ld bc, 2 * SCREEN_WIDTH
add hl, bc
pop bc
inc c
ld a, c
cp b
jr nz, .loop
ld a, [wMenuBorderBottomCoord]
ld b, a
ld a, [wMenuBorderRightCoord]
ld c, a
call Coord2Tile
ld [hl], "▼"
ret
.cancel
ld a, [wMenuDataHeaderEnd]
bit SCROLLINGMENU_CALL_FUNCTION1_CANCEL_F, a
jr nz, .call_function
ld de, .CancelString
call PlaceString
ret
.CancelString:
db "やめる@"
.call_function
ld d, h
ld e, l
ld hl, wMenuData_ScrollingMenuFunction1
jp CallPointerAt
ScrollingMenu_CallFunctions1and2::
push hl
ld d, h
ld e, l
ld hl, wMenuData_ScrollingMenuFunction1
call CallPointerAt
pop hl
ld a, [wMenuDataIndicesPointer]
and a
jr z, .done
ld e, a
ld d, 0
add hl, de
ld d, h
ld e, l
ld hl, wMenuData_ScrollingMenuFunction2
call CallPointerAt
.done
ret
ScrollingMenu_PlaceCursor:
ld a, [wSelectedSwapPosition]
and a
jr z, .done
ld b, a
ld a, [wMenuScrollPosition]
cp b
jr nc, .done
ld c, a
ld a, [wMenuData_ScrollingMenuHeight]
add c
cp b
jr c, .done
ld a, b
sub c
dec a
add a
add $1
ld c, a
ld a, [wMenuBorderTopCoord]
add c
ld b, a
ld a, [wMenuBorderLeftCoord]
add $0
ld c, a
call Coord2Tile
ld [hl], "▷"
.done
ret
; Seems to be more specialized compared to the final game...
; It automatically draws a text box and predefines a decoord.
ScrollingMenu_CheckCallFunction3:
ld a, [wMenuDataFlags]
bit SCROLLINGMENU_ENABLE_FUNCTION3_F, a
ret z
hlcoord 0, 12
ld b, 4
ld c, SCREEN_HEIGHT
call DrawTextBox
ld a, [wMenuCursorY]
dec a
call ScrollingMenu_GetListItemCoordAndFunctionArgs
ld a, [wMenuSelection]
cp -1
jr z, .done
decoord 1, 14
ld hl, wMenuData_ScrollingMenuFunction3
call CallPointerAt
ret
.done
ret
ScrollingMenu_GetListItemCoordAndFunctionArgs::
push de
push hl
ld e, a
ld a, [wMenuScrollPosition]
add e
ld e, a
ld d, 0
ld hl, wMenuData_ItemsPointerAddr
ld a, [hli]
ld h, [hl]
ld l, a
inc hl
ld a, [wMenuData_ScrollingMenuItemFormat]
cp SCROLLINGMENU_ITEMS_NORMAL
jr z, .got_spacing
cp SCROLLINGMENU_ITEMS_QUANTITY
jr z, .pointless_jump
cp SCROLLINGMENU_BALL_POCKET
jr z, .ball_pocket
.pointless_jump
add hl, de
.got_spacing
add hl, de
ld a, [wMenuData_ItemsPointerBank]
call GetFarByte
ld [wMenuSelection], a
ld [wCurItem], a
inc hl
ld a, [wMenuData_ItemsPointerBank]
call GetFarByte
ld [wMenuSelectionQuantity], a
pop hl
pop de
ret
.ball_pocket:
ld a, [wScrollingMenuListSize]
ld d, a
ld a, e
cp d ; if menu scroll position <= menu list size
jr nc, .failure
inc e
ld d, 0
.loop
inc d
ld a, [hli]
and a
jr z, .loop
dec e
jr nz, .loop
dec hl
dec d
push bc
push hl
ld c, d
callfar GetBallByIndex
ld d, c
pop hl
pop bc
jr .done
.failure
ld d, -1
.done
ld a, d
ld [wMenuSelection], a
ld [wCurItem], a
ld a, [hl]
ld [wMenuSelectionQuantity], a
pop hl
pop de
ret

View File

@ -14,10 +14,10 @@ DisplayStartMenu:
call ClearJoypad
call GetStartMenuState
ld a, [wStartmenuCursor]
ld [wMenuCursorBuffer], a
ld [wMenuCursorPosition], a
call OpenMenu
jr c, .MainReturn
ld a, [wMenuCursorBuffer]
ld a, [wMenuCursorPosition]
ld [wStartmenuCursor], a
call PlaceHollowCursor
ld a, [wMenuSelection]
@ -39,7 +39,7 @@ DisplayStartMenu:
.exit
call ExitMenu
.UpdateTime
call Function1fea
call ScreenCleanup
call UpdateTimePals
ret
@ -72,7 +72,7 @@ DisplayStartMenu:
db $A8 ; flags
db 0 ; items
dw StartMenuItems
db $8A, $1F
dw PlaceMenuStrings
dw .Strings
.Strings:
@ -263,7 +263,7 @@ ToolsPocketHeader:
db 4, 9, 2, 0
dw wNumBagItems
dba Function2473b
dba PlacePackItems
dba PlaceMenuItemQuantity
dba UpdateItemDescription
@ -282,7 +282,7 @@ KeyItemsPocketHeader:
db 4, 9, 1, 0
dw wNumKeyItems
dba Function2473b
dba PlacePackItems
dba PlaceMenuItemQuantity
dba UpdateItemDescription
@ -297,7 +297,7 @@ BackpackMenuHeader:
db 4, 9, 2, 0
dw wNumBagItems
dba Function2473b
dba PlacePackItems
dba PlaceMenuItemQuantity
dba UpdateItemDescription
@ -392,7 +392,7 @@ StartMenu_Backpack:
DebugBackpackLoop:
; checks the field debug flag, if set this runs
; otherwise NondebugBackpackLoop runs
; if wactivebackpackpocket is 1 (doesn't have key items) then jumps below
; if wActiveBackpackPocket is 1 (doesn't have key items) then jumps below
ld a, [wDebugFlags]
bit DEBUG_FIELD_F, a
jp z, NondebugBackpackLoop
@ -404,7 +404,7 @@ DebugBackpackLoop:
ld de, .ToolsPocketText
call DrawBackpackTitleRow
ld a, [wRegularItemsCursor]
ld [wMenuCursorBuffer], a
ld [wMenuCursorPosition], a
ld a, [wRegularItemsScrollPosition]
ld [wMenuScrollPosition], a
call ScrollingMenu
@ -424,7 +424,7 @@ DebugBackpackLoop:
ld de, KeyItemsPocketText
call DrawBackpackTitleRow
ld a, [wBackpackAndKeyItemsCursor]
ld [wMenuCursorBuffer], a
ld [wMenuCursorPosition], a
ld a, [wBackpackAndKeyItemsScrollPosition]
ld [wMenuScrollPosition], a
call ScrollingMenu
@ -444,7 +444,7 @@ NondebugBackpackLoop:
ld de, BackpackHeaderText
call DrawBackpackTitleRow
ld a, [wBackpackAndKeyItemsCursor]
ld [wMenuCursorBuffer], a
ld [wMenuCursorPosition], a
ld a, [wBackpackAndKeyItemsScrollPosition]
ld [wMenuScrollPosition], a
call ScrollingMenu
@ -509,7 +509,7 @@ BackpackSelected:
.BagSelectJumptable:
dw SelectItem
dw .UnknownSelection
dw .TMHolder
dw BallPocketLoop
dw .SwapPocket
dw SelectItem
@ -523,9 +523,9 @@ BackpackSelected:
and a
ret
.UnknownSelection
.TMHolder
call LoadStandardMenuHeader
callfar Function2d2fc
callfar _TMHolder
call ExitMenu
call DrawBackpack
and a
@ -630,14 +630,14 @@ UseItemSelection:
ret
.SimpleItem:
call UseItem
call DoItemEffect
and a
ret
.SpriteItem:
; might be a better name for this once
; bank 5 gets sorted out
call UseItem
call DoItemEffect
call ClearBGPalettes
call StartMenuLoadSprites
call DrawBackpack
@ -645,7 +645,7 @@ UseItemSelection:
ret
.FieldMove:
call UseItem
call DoItemEffect
ld a, [wFieldMoveSucceeded]
and a
jr z, .FailedMove
@ -794,10 +794,8 @@ BallPocket:
.MenuData:
db SCROLLINGMENU_ENABLE_FUNCTION3 ; flags
db 4, 8 ; rows, columns
db $80 ; horizontal spacing?
db 0 ; ???
dw wNumBallItems
db SCROLLINGMENU_BALL_POCKET
dbw 0, wNumBallItems
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
@ -901,7 +899,7 @@ HandleSelectedPokemon:
xor a
ld [wPartyMenuActionText], a
ld [wSelectedSwapPosition], a
predef PartyMenuInBattle
predef OpenPartyMenu
jr PartyPrompt.partypromptreturn
PartyPrompt:
@ -911,7 +909,7 @@ PartyPrompt:
callfar UnfreezeMonIcons
ld a, PARTYMENUACTION_MOVE
ld [wPartyMenuActionText], a
predef PartyMenuInBattle
predef OpenPartyMenu
.partypromptreturn
jr c, .return
jp SelectedPokemonSubmenu
@ -1361,7 +1359,7 @@ PartyPokemonSummary:
xor a
ld [wMonType], a
call LowVolume
predef Function502b5
predef StatsScreenMain
call MaxVolume
call ReloadFontAndTileset
call Call_ExitMenu
@ -1416,7 +1414,7 @@ PartyTryDig:
jp PartyPromptExit
PartyCalculateHealth:
ld a, MON_MAXHP ; might be wrong, was $24
ld a, MON_MAXHP
call GetPartyParamLocation
ld a, [hli]
ldh [hDividend], a
@ -1426,7 +1424,7 @@ PartyCalculateHealth:
ldh [hDivisor], a
ld b, 2
call Divide
ld a, MON_HP + 1 ; might be wrong, was $23
ld a, MON_HP + 1
call GetPartyParamLocation
ldh a, [hQuotient + 3]
sub [hl]
@ -1434,7 +1432,7 @@ PartyCalculateHealth:
ldh a, [hQuotient + 2]
sbc [hl]
jp nc, PrintNotHealthyEnoughText
callfar Functionf218
callfar SoftboiledFunction
jp HandleSelectedPokemon
PrintNotHealthyEnoughText:
@ -1492,7 +1490,7 @@ PokeSummary:
lb bc, 2, $12
call ClearBox
hlcoord 3, 1
predef Function508c4
predef PlacePartyMember
ld hl, wPlayerHPPal
call SetHPPal
ld b, $0E
@ -1546,7 +1544,7 @@ SummaryDrawPoke:
set 6, [hl]
jr PartySelectionInputs.PartySelectSkipInputs
PartySelectionInputs:
call Get2DMenuJoypad + 3
call StaticMenuJoypad + 3
bit B_BUTTON_F, a
jp nz, PartySelectionBackOut
bit A_BUTTON_F, a
@ -1600,7 +1598,7 @@ PartySelectionInputs:
call PlaceString
.step
hlcoord 1, 14
predef Function2d663
predef PrintMoveDescription
jp PartySelectionInputs
.DrawMovePokeText
@ -1737,7 +1735,7 @@ CheckRegisteredItem:
call RefreshScreen
ld hl, .NothingRegisteredText
call MenuTextBoxBackup
call Function1fea
call ScreenCleanup
ret
.NothingRegisteredText:
@ -1811,14 +1809,14 @@ UseRegisteredItem:
.CantUse
call RefreshScreen
call PrintCantUseText
call Function1fea
call ScreenCleanup
and a
ret
.UnusedSimpleUse
call RefreshScreen
call UseItem
call Function1fea
call DoItemEffect
call ScreenCleanup
and a
ret
@ -1826,16 +1824,16 @@ UseRegisteredItem:
call RefreshScreen
ld hl, wStateFlags
res SPRITE_UPDATES_DISABLED_F, [hl]
call UseItem
call DoItemEffect
call ClearPalettes
call StartMenuLoadSprites
call UpdateTimePals
call Function1fea
call ScreenCleanup
and a
ret
.FieldMove
call UseItem
call DoItemEffect
ld a, [wFieldMoveSucceeded]
and a
jr z, .CantUse2
@ -1848,7 +1846,7 @@ UseRegisteredItem:
.CantUse2
call RefreshScreen
call PrintCantUseText
call Function1fea
call ScreenCleanup
and a
ret

View File

@ -0,0 +1,239 @@
EvolutionAnimation::
push hl
push de
push bc
ld a, [wCurSpecies]
push af
ld de, MUSIC_NONE
call PlayMusic
xor a
ld [wLowHealthAlarm], a
ld a, 1
ldh [hBGMapMode], a
call WaitBGMap
xor a
ldh [hBGMapMode], a
ldh [hMapAnims], a
ld a, [wEvolutionOldSpecies]
ld [wPlayerHPPal], a
ld c, FALSE
call .GetSGBLayout
ld a, [wEvolutionNewSpecies]
ld [wCurPartySpecies], a
ld [wCurSpecies], a
call .PlaceFrontpic
ld de, vChars2
ld hl, vChars2 tile $31
ld bc, 7 * 7
call Request2bpp
ld a, [wEvolutionOldSpecies]
ld [wCurPartySpecies], a
ld [wCurSpecies], a
call .PlaceFrontpic
ld a, 1
ldh [hBGMapMode], a
ld a, [wEvolutionOldSpecies]
call PlayCry
ld de, MUSIC_EVOLUTION
call PlayMusic
ld c, 80
call DelayFrames
ld c, TRUE
call .GetSGBLayout
lb bc, 1, 16 ; flash b times, wait c frames in between
.loop
push bc
call .WaitFrames_CheckPressedB
jr c, .cancel_evo
call .Flash
pop bc
inc b
dec c
dec c
jr nz, .loop
xor a
ld [wEvolutionCanceled], a
ld a, 7 * 7
ld [wEvolutionPicOffset], a
call .ReplaceFrontpic
ld a, [wEvolutionNewSpecies]
.return
ld [wPlayerHPPal], a
ld a, [wPlayerHPPal]
call PlayCry
ld c, FALSE
call .GetSGBLayout
call .PlayEvolvedSFX
pop af
ld [wCurSpecies], a
pop bc
pop de
pop hl
ld a, [wEvolutionCanceled]
and a
ret z
scf
ret
.cancel_evo
pop bc
ld a, TRUE
ld [wEvolutionCanceled], a
ld a, [wEvolutionOldSpecies]
jr .return
.GetSGBLayout:
ld b, SGB_EVOLUTION
jp GetSGBLayout
.PlaceFrontpic:
call GetBaseData
hlcoord 7, 2
jp PrepMonFrontpic
.Flash:
ld a, 7 * 7 ; previous stage
ld [wEvolutionPicOffset], a
call .ReplaceFrontpic
ld a, -7 * 7 ; new stage
ld [wEvolutionPicOffset], a
call .ReplaceFrontpic
dec b
jr nz, .Flash
ret
.ReplaceFrontpic:
push bc
xor a
ldh [hBGMapMode], a
hlcoord 7, 2
lb bc, 7, 7
ld de, SCREEN_WIDTH - 7
.loop1
push bc
.loop2
ld a, [wEvolutionPicOffset]
add [hl]
ld [hli], a
dec c
jr nz, .loop2
pop bc
add hl, de
dec b
jr nz, .loop1
ld a, $1
ldh [hBGMapMode], a
call WaitBGMap
pop bc
ret
.WaitFrames_CheckPressedB:
call DelayFrame
push bc
call GetJoypadDebounced
ldh a, [hJoySum]
pop bc
and B_BUTTON
jr nz, .pressed_b
.loop3
dec c
jr nz, .WaitFrames_CheckPressedB
and a
ret
.pressed_b
ld a, [wForceEvolution]
and a
jr nz, .loop3
scf
ret
.PlayEvolvedSFX:
ret
ld a, [wEvolutionCanceled]
and a
ret nz
ldh a, [rOBP0]
push af
ld a, %11100100
ldh [rOBP0], a
callfar ClearSpriteAnims
ld de, .GFX
ld hl, vChars0
lb bc, BANK(.GFX), 2
call Request2bpp
xor a
ld [wJumptableIndex], a
.loop4
call .balls_of_light
jr nc, .done
call .AnimateBallsOfLight
jr .loop4
.done
ld c, 16 ; half as much as final
.loop5
call .AnimateBallsOfLight
dec c
jr nz, .loop5
pop af
ldh [rOBP0], a
ret
.balls_of_light
ld hl, wJumptableIndex
ld a, [hl]
cp 64
ret nc
inc [hl]
depixel 9, 11
ld a, SPRITE_ANIM_OBJ_EVOLUTION_BALL_OF_LIGHT
call InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], 0
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [wJumptableIndex]
and %1110
sla a
sla a
ld [hl], a
scf
ret
.AnimateBallsOfLight:
push bc
callfar PlaySpriteAnimations
pop bc
call DelayFrame
ret
.GFX:
INCBIN "gfx/evo/bubbles.2bpp"

View File

@ -281,7 +281,7 @@ GivePokemon::
ld [wCurPartySpecies], a
ld a, b
ld [wCurPartyLevel], a
predef Functiond886
predef TryAddMonToParty
ret
AddRandomPokemonToBox:
@ -298,7 +298,7 @@ AddRandomPokemonToBox:
callfar LoadEnemyMon
ld a, [wTempEnemyMonSpecies]
ld [wCurPartySpecies], a
callfar Functiondd5c
callfar SendMonIntoBox
pop af
dec a
jr nz, .loop

View File

@ -1,6 +1,6 @@
INCLUDE "constants.asm"
SECTION "engine/dumps/bank02.asm@_SpawnPlayer", ROMX
SECTION "engine/overworld/player_object.asm", ROMX
_SpawnPlayer::
ld a, PLAYER
@ -669,146 +669,7 @@ ObjectWalkToPlayer::
call ComputePathToWalkToDestination
ret
_LoadMinorObjectGFX::
ld hl, wQueuedMinorObjectGFX
push hl
ld a, [hl]
ld l, a
ld h, 0
ld de, .MinorObjectGFX
add hl, hl
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
pop hl
push de
ret
.MinorObjectGFX:
dw .LoadNull
dw .LoadJumpShadow
dw .LoadUnknownBouncingOrb
dw .LoadShockEmote
dw .LoadQuestionEmote
dw .LoadHappyEmote
dw .LoadBoulderDust
dw .LoadGrampsSpriteStandPt0
dw .LoadGrampsSpriteStandPt1
dw .LoadGrampsSpriteWalkPt0
dw .LoadGrampsSpriteWalkPt1
dw .LoadClefairySpriteStandPt0
dw .LoadClefairySpriteStandPt1
dw .LoadClefairySpriteWalkPt0
dw .LoadClefairySpriteWalkPt1
.FarCopy:
ld a, c
ld [wVBCopyFarSrcBank], a
ld a, l
ld [wVBCopyFarSrc], a
ld a, h
ld [wVBCopyFarSrc+1], a
.ContinueFarCopyNewDst:
ld a, e
ld [wVBCopyFarDst], a
ld a, d
ld [wVBCopyFarDst+1], a
.ContinueFarCopy:
ld a, b
ld [wVBCopyFarSize], a
ret
.LoadNull:
ret
.LoadShockEmote:
ld hl, ShockEmoteGFX
jr .load_emote
.LoadQuestionEmote:
ld hl, QuestionEmoteGFX
jr .load_emote
.LoadHappyEmote:
ld hl, HappyEmoteGFX
.load_emote:
ld de, vChars1 tile $78
ld b, (HappyEmoteGFX.end - HappyEmoteGFX) / LEN_2BPP_TILE
ld c, BANK(EmoteGFX)
jp .FarCopy
.LoadJumpShadow:
ld [hl], $00
ld hl, JumpShadowGFX
ld de, vChars1 tile $7c
ld b, (JumpShadowGFX.end - JumpShadowGFX) / LEN_2BPP_TILE
ld c, BANK(JumpShadowGFX)
jp .FarCopy
.LoadUnknownBouncingOrb:
ld [hl], $00
ld hl, UnknownBouncingOrbGFX
ld de, vChars1 tile $7c
ld b, (UnknownBouncingOrbGFX.end - UnknownBouncingOrbGFX) / LEN_2BPP_TILE
ld c, BANK(UnknownBouncingOrbGFX)
jp .FarCopy
.LoadBoulderDust:
ld [hl], $00
ld hl, BoulderDustGFX
ld de, vChars1 tile $7c
ld b, (BoulderDustGFX.end - BoulderDustGFX) / LEN_2BPP_TILE
ld c, BANK(BoulderDustGFX)
jp .FarCopy
.LoadGrampsSpriteStandPt0:
inc [hl]
ld hl, GrampsSpriteGFX
ld de, vChars0
ld b, (GrampsSpriteGFX.end - GrampsSpriteGFX) / LEN_2BPP_TILE / 4
ld c, BANK(GrampsSpriteGFX)
jp .FarCopy
.LoadGrampsSpriteStandPt1:
inc [hl]
ld b, (GrampsSpriteGFX.end - GrampsSpriteGFX) / LEN_2BPP_TILE / 4
jp .ContinueFarCopy
.LoadGrampsSpriteWalkPt0:
inc [hl]
ld de, vChars1
ld b, (GrampsSpriteGFX.end - GrampsSpriteGFX) / LEN_2BPP_TILE / 4
jp .ContinueFarCopyNewDst
.LoadGrampsSpriteWalkPt1:
ld [hl], $00
ld b, (GrampsSpriteGFX.end - GrampsSpriteGFX) / LEN_2BPP_TILE / 4
jp .ContinueFarCopy
.LoadClefairySpriteStandPt0:
inc [hl]
ld hl, ClefairySpriteGFX
ld de, vChars0
ld b, (ClefairySpriteGFX.end - ClefairySpriteGFX) / LEN_2BPP_TILE / 4
ld c, BANK(ClefairySpriteGFX)
jp .FarCopy
.LoadClefairySpriteStandPt1:
inc [hl]
ld b, (ClefairySpriteGFX.end - ClefairySpriteGFX) / LEN_2BPP_TILE / 4
jp .ContinueFarCopy
.LoadClefairySpriteWalkPt0:
inc [hl]
ld de, vChars1
ld b, (ClefairySpriteGFX.end - ClefairySpriteGFX) / LEN_2BPP_TILE / 4
jp .ContinueFarCopyNewDst
.LoadClefairySpriteWalkPt1:
ld [hl], $00
ld b, (ClefairySpriteGFX.end - ClefairySpriteGFX) / LEN_2BPP_TILE / 4
jp .ContinueFarCopy
SECTION "engine/dumps/bank02.asm@QueueFollowerFirstStep", ROMX
SECTION "engine/overworld/player_object.asm@QueueFollowerFirstStep", ROMX
QueueFollowerFirstStep::
call .QueueFirstStep
@ -873,322 +734,3 @@ QueueFollowerFirstStep::
_Sine::
ld a, e
calc_sine_wave
TownMap::
call InitTownMap
callfar ClearSpriteAnims
call TownMap_InitPlayerIcon
call WaitBGMap
call SetPalettes
.loop
call DelayFrame
call GetJoypadDebounced
callfar PlaySpriteAnimations
ld hl, hJoyDown
ld a, [hl]
and A_BUTTON | B_BUTTON
jr z, .loop
ret
FlyMap::
ld hl, hInMenu
ld a, [hl]
push af
ld [hl], 1
call InitTownMap
callfar ClearSpriteAnims
call TownMap_InitPlayerIcon
call FlyMap_InitPidgeyIcon
ld hl, wFlyIconAnimStructPointer
ld [hl], c
inc hl
ld [hl], b
hlcoord 1, 15
ld de, ChooseADestinationText
call PlaceString
call WaitBGMap
call SetPalettes
xor a
ld [wFlyDestination], a
.loop
call DelayFrame
call GetJoypadDebounced
callfar PlaySpriteAnimations
ld hl, hJoyDown
ld a, [hl]
and B_BUTTON
jr nz, .cancel
ld a, [hl]
and A_BUTTON
jr nz, .fly
call .HandleDPad
callfar GetFlyPointMapLocation
ld d, 0
ld hl, LandmarkPositions
add hl, de
add hl, de
ld d, [hl]
inc hl
ld e, [hl]
ld hl, wFlyIconAnimStructPointer
ld c, [hl]
inc hl
ld b, [hl]
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], e
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld [hl], d
jr .loop
.cancel
ld a, -1
ld [wFlyDestination], a
.fly
pop af
ldh [hInMenu], a
ret
.HandleDPad:
ld a, [wFlyDestination]
ld l, a
ld h, 0
add hl, hl
add hl, hl
ld de, FlyPointPaths
add hl, de
ld de, hJoySum
ld a, [de]
and D_UP
jr nz, .get_point
inc hl
ld a, [de]
and D_DOWN
jr nz, .get_point
inc hl
ld a, [de]
and D_LEFT
jr nz, .get_point
inc hl
ld a, [de]
and D_RIGHT
jr nz, .get_point
ret
.get_point
ld a, [hl]
cp -1
ret z
ld [wFlyDestination], a
ret
ChooseADestinationText:
db "とびさき を えらんでください@"
Pokedex_GetArea:
ld a, [wNestIconBlinkCounter]
push af
xor a
ld [wNestIconBlinkCounter], a
call InitTownMap
ld de, PokedexNestIconGFX
ld hl, vChars0 tile $7f
lb bc, BANK(PokedexNestIconGFX), 1
call Request1bpp
call GetPokemonName
hlcoord 4, 15
call PlaceString
hlcoord 9, 15
ld de, .String_SNest
call PlaceString
call WaitBGMap
call SetPalettes
xor a
ldh [hBGMapMode], a
ld hl, wTileMap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call ByteFill
callfar FindNest
.loop
call .PlaceNest
call GetJoypadDebounced
ldh a, [hJoyDown]
and A_BUTTON | B_BUTTON
jr nz, .done
ld hl, wNestIconBlinkCounter
inc [hl]
call DelayFrame
jr .loop
.done
pop af
ld [wNestIconBlinkCounter], a
ret
.String_SNest:
db "の すみか@"
.PlaceNest:
ld a, [wNestIconBlinkCounter]
and $10
jr z, .done_nest
ld de, wTileMap
ld hl, wShadowOAMSprite00
.nestloop
ld a, [de]
and a
ret z
push de
push hl
ld e, a
ld d, $00
ld hl, LandmarkPositions
add hl, de
add hl, de
ld e, l
ld d, h
; load into OAM
pop hl
; X position
ld a, [de]
inc de
sub 4
ld [hli], a
; Y position
ld a, [de]
inc de
sub 4
ld [hli], a
; Nest icon -> Tile ID
ld a, $7f
ld [hli], a
; Blank out attributes
xor a
ld [hli], a
pop de
inc de
jr .nestloop
.done_nest
call ClearSprites
ret
InitTownMap:
call ClearBGPalettes
call ClearTileMap
call UpdateSprites
call DisableLCD
ld hl, TownMapGFX
ld de, vTilesetEnd
ld bc, TownMapGFX.End - TownMapGFX
ld a, BANK(TownMapGFX)
call FarCopyData
ld hl, wTileMap
call DecompTownMapTilemap
hlcoord 0, 13
ld b, 3
ld c, 18
call DrawTextBox
ld a, 3
call UpdateSoundNTimes
call EnableLCD
ld b, SGB_TOWN_MAP
call GetSGBLayout
ret
DecompTownMapTilemap:
ld de, TownMapTilemap
.loop
ld a, [de]
and a
ret z
ld b, a
inc de
ld a, [de]
ld c, a
ld a, b
add $60
.keep_placing_tile
ld [hli], a
dec c
jr nz, .keep_placing_tile
inc de
jr .loop
TownMap_InitPlayerIcon:
ld de, GoldSpriteGFX
ld hl, vChars0
lb bc, BANK(GoldSpriteGFX), $04
call Request2bpp
ld de, GoldSpriteGFX + 12 tiles
ld hl, vChars0 tile $04
lb bc, BANK(GoldSpriteGFX), $04
call Request2bpp
depixel 0, 0
ld a, SPRITE_ANIM_OBJ_MAP_CHARACTER_ICON
call InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], $00
push bc
ld a, [wMapGroup]
ld b, a
ld a, [wMapId]
ld c, a
call GetWorldMapLocation
ld e, a
ld d, $00
ld hl, LandmarkPositions
add hl, de
add hl, de
ld d, [hl]
inc hl
ld e, [hl]
pop bc
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], e
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld [hl], d
ret
FlyMap_InitPidgeyIcon:
ld de, PidgeySpriteGFX
ld hl, vChars0 tile $08
lb bc, BANK(PidgeySpriteGFX), 4
call Request2bpp
ld de, PidgeySpriteGFX + 12 tiles
ld hl, vChars0 tile $0c
lb bc, BANK(PidgeySpriteGFX), 4
call Request2bpp
depixel 0, 0
ld a, SPRITE_ANIM_OBJ_MAP_CHARACTER_ICON
call InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], 8
ret
TownMapTilemap:
INCBIN "gfx/trainer_gear/town_map.tilemap.rle"

View File

@ -0,0 +1,565 @@
INCLUDE "constants.asm"
SECTION "engine/overworld/player_step.asm", ROMX
; TODO: How does this differ from _HandlePlayerStep, aside from where it's called from?
_HandlePlayerStep_Limited:
ld a, [wPlayerStepFlags]
and a
ret z
bit PLAYERSTEP_START_F, a
jr nz, .start
bit PLAYERSTEP_STOP_F, a
jr nz, .update_player_coords
bit PLAYERSTEP_CONTINUE_F, a
jr nz, HandlePlayerStep_Finish
ret
.start
jr ._start
.unreferenced_d4fa
call UpdatePlayerCoords
callfar EmptyFunction8261
._start
ld a, 4
ld [wHandlePlayerStep], a
ldh a, [hOverworldFlashlightEffect]
and a
jr nz, .update_overworld_map
call UpdateOverworldMap_Old
jr HandlePlayerStep_Finish
.update_overworld_map
call UpdateOverworldMap
jr HandlePlayerStep_Finish
.update_player_coords
call UpdatePlayerCoords
jr HandlePlayerStep_Finish
UpdatePlayerCoords:
ld a, [wPlayerStepDirection]
and a
jr nz, .check_step_down
ld hl, wYCoord
inc [hl]
ret
.check_step_down
cp UP
jr nz, .check_step_left
ld hl, wYCoord
dec [hl]
ret
.check_step_left
cp LEFT
jr nz, .check_step_right
ld hl, wXCoord
dec [hl]
ret
.check_step_right
cp RIGHT
ret nz
ld hl, wXCoord
inc [hl]
ret
HandlePlayerStep_Finish:
call HandlePlayerStep
ld a, [wPlayerStepVectorX]
ld d, a
ld a, [wPlayerStepVectorY]
ld e, a
call ScrollNPCs
call ScrollMinorObjects
ldh a, [hSCX]
add d
ldh [hSCX], a
ldh a, [hSCY]
add e
ldh [hSCY], a
ret
ScrollNPCs:
ld bc, wObjectStructs
xor a
.loop
ldh [hMapObjectIndex], a
ld hl, OBJECT_SPRITE
add hl, bc
ld a, [hl]
and a
jr z, .skip
ld hl, OBJECT_FLAGS1
add hl, bc
bit CENTERED_OBJECT_F, [hl]
jr nz, .skip
ld hl, OBJECT_SPRITE_X
add hl, bc
ld a, [hl]
sub d
ld [hl], a
ld hl, OBJECT_SPRITE_Y
add hl, bc
ld a, [hl]
sub e
ld [hl], a
.skip
ld hl, OBJECT_LENGTH
add hl, bc
ld b, h
ld c, l
ldh a, [hMapObjectIndex]
inc a
cp NUM_OBJECT_STRUCTS
jr nz, .loop
ret
ScrollMinorObjects:
ld bc, wMinorObjects
ld a, 1
.loop
ldh [hMapObjectIndex], a
ld hl, MINOR_OBJECT_PARENT_OBJECT
add hl, bc
ld a, [wCenteredObject]
inc a
cp [hl]
jr z, .skip
ld hl, MINOR_OBJECT_X_POS
add hl, bc
ld a, [hl]
sub d
ld [hl], a
ld hl, MINOR_OBJECT_Y_POS
add hl, bc
ld a, [hl]
sub e
ld [hl], a
.skip
ld hl, MINOR_OBJECT_LENGTH
add hl, bc
ld b, h
ld c, l
ldh a, [hMapObjectIndex]
inc a
cp NUM_MINOR_OBJECTS + 1
jr nz, .loop
ret
HandlePlayerStep::
ld hl, wHandlePlayerStep
ld a, [hl]
and a
ret z
dec [hl]
ld a, [hl]
add a
ld e, a
ld d, 0
ld hl, .Jumptable
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
.Jumptable:
dw RefreshTiles
dw Functionc9c1
dw BufferScreen
dw .fail
dw .fail
dw .fail
dw .fail
dw .fail
dw .fail
dw .fail
dw .fail
.fail
ret
Functionc9c1:
callfar _Functionc9c1
ret
UpdateOverworldMap_Old:
ld a, [wPlayerStepDirection]
and a ; DOWN
jr z, .step_down
cp UP
jr z, .step_up
cp LEFT
jr z, .step_left
cp RIGHT
jr z, .step_right
ret
.step_down
call ScrollOverworldMapDown
call LoadMapPart
call ScheduleSouthRowRedraw
ret
.step_up
call ScrollOverworldMapUp
call LoadMapPart
call ScheduleNorthRowRedraw
ret
.step_left
call ScrollOverworldMapLeft
call LoadMapPart
call ScheduleWestColumnRedraw
ret
.step_right
call ScrollOverworldMapRight
call LoadMapPart
call ScheduleEastColumnRedraw
ret
ScrollOverworldMapDown:
ld a, [wBGMapAnchor]
add BG_MAP_WIDTH * 2
ld [wBGMapAnchor], a
jr nc, .no_overflow
ld a, [wBGMapAnchor + 1]
inc a
and %11
or HIGH(vBGMap0)
ld [wBGMapAnchor + 1], a
.no_overflow
ld hl, wMetatileNextY
inc [hl]
ld a, [hl]
cp 2
jr nz, .done
ld [hl], 0
call .ScrollMapDataDown
.done
ret
.ScrollMapDataDown:
ld hl, wOverworldMapAnchor
ld a, [wMapWidth]
add 3 * 2 ; surrounding tiles
add [hl]
ld [hli], a
ret nc
inc [hl]
ret
ScrollOverworldMapUp:
ld a, [wBGMapAnchor]
sub BG_MAP_WIDTH * 2
ld [wBGMapAnchor], a
jr nc, .not_underflowed
ld a, [wBGMapAnchor+1]
dec a
and %11
or HIGH(vBGMap0)
ld [wBGMapAnchor+1], a
.not_underflowed
ld hl, wMetatileNextY
dec [hl]
ld a, [hl]
cp -1
jr nz, .done_up
ld [hl], 1
call .ScrollMapDataUp
.done_up
ret
.ScrollMapDataUp:
ld hl, wOverworldMapAnchor
ld a, [wMapWidth]
add 3 * 2
ld b, a
ld a, [hl]
sub b
ld [hli], a
ret nc
dec [hl]
ret
ScrollOverworldMapLeft:
ld a, [wBGMapAnchor]
ld e, a
and ~(BG_MAP_WIDTH - 1)
ld d, a
ld a, e
sub 2
maskbits BG_MAP_WIDTH - 1
or d
ld [wBGMapAnchor], a
ld hl, wMetatileNextX
dec [hl]
ld a, [hl]
cp -1
jr nz, .done_left
ld [hl], 1
call .ScrollMapDataLeft
.done_left
ret
.ScrollMapDataLeft:
ld hl, wOverworldMapAnchor
ld a, [hl]
sub 1
ld [hli], a
ret nc
dec [hl]
ret
ScrollOverworldMapRight:
ld a, [wBGMapAnchor]
ld e, a
and ~(BG_MAP_WIDTH - 1)
ld d, a
ld a, e
add 2
maskbits BG_MAP_WIDTH - 1
or d
ld [wBGMapAnchor], a
ld hl, wMetatileNextX
inc [hl]
ld a, [hl]
cp 2
jr nz, .done_right
ld [hl], $00
call .ScrollMapDataRight
.done_right
ret
.ScrollMapDataRight:
ld hl, wOverworldMapAnchor
ld a, [hl]
add 1
ld [hli], a
ret nc
inc [hl]
ret
_HandlePlayerStep:
ld a, [wPlayerStepFlags]
and a
ret z
bit PLAYERSTEP_START_F, a
jr nz, .update_overworld_map
bit PLAYERSTEP_STOP_F, a
jr nz, .update_player_coords
bit PLAYERSTEP_CONTINUE_F, a
jp nz, HandlePlayerStep_Finish
ret
.update_overworld_map
ld a, 4
ld [wHandlePlayerStep], a
call UpdateOverworldMap
jp HandlePlayerStep_Finish
.update_player_coords
call UpdatePlayerCoords
jp HandlePlayerStep_Finish
UpdateOverworldMap:
ld a, [wPlayerStepDirection]
and a
jr z, .step_down
cp UP
jr z, .step_up
cp LEFT
jr z, .step_left
cp RIGHT
jr z, .step_right
ret
.step_down
call ScrollOverworldMapDown
call LoadMapPart
ld a, 2
call ScrollOverworldFlashlight
ret
.step_up
call ScrollOverworldMapUp
call LoadMapPart
ld a, 1
call ScrollOverworldFlashlight
ret
.step_left
call ScrollOverworldMapLeft
call LoadMapPart
ld a, 3
call ScrollOverworldFlashlight
ret
.step_right
call ScrollOverworldMapRight
call LoadMapPart
ld a, 4
call ScrollOverworldFlashlight
ret
ScrollOverworldFlashlight::
push af
call .GetFlashlightVariables
call .GetFlashlightSize
pop af
add 2
ldh [hRedrawRowOrColumnMode], a
ret
.GetFlashlightVariables:
dec a
ld l, a
ld h, 0
add hl, hl
add hl, hl
add hl, hl
ldh a, [hOverworldFlashlightEffect]
dec a
swap a ; * 16
sla a ; * 2
ld e, a
ld d, 0
add hl, de
ld de, .FlashlightColumns
add hl, de
call .ReadFlashlightDst
ld a, e
ld [wRedrawFlashlightDst0], a
ld a, d
ld [wRedrawFlashlightDst0 + 1], a
call .GetFlashlightSrc
ld a, e
ld [wRedrawFlashlightSrc0], a
ld a, d
ld [wRedrawFlashlightSrc0 + 1], a
call .ReadFlashlightDst
ld a, e
ld [wRedrawFlashlightBlackDst0], a
ld a, d
ld [wRedrawFlashlightBlackDst0 + 1], a
call .ReadFlashlightDst
ld a, e
ld [wRedrawFlashlightDst1], a
ld a, d
ld [wRedrawFlashlightDst1 + 1], a
call .GetFlashlightSrc
ld a, e
ld [wRedrawFlashlightSrc1], a
ld a, d
ld [wRedrawFlashlightSrc1 + 1], a
call .ReadFlashlightDst
ld a, e
ld [wRedrawFlashlightBlackDst1], a
ld a, d
ld [wRedrawFlashlightBlackDst1 + 1], a
ret
; The positions of the columns drawn.
; TODO: Wrap these in neat macros.
.FlashlightColumns:
db $02, $03, $02, $11, $02, $02, $02, $10 ; up
db $02, $0e, $02, $00, $02, $0f, $02, $01 ; down
db $03, $02, $11, $02, $02, $02, $10, $02 ; left
db $0e, $02, $00, $02, $0f, $02, $01, $02 ; right
db $04, $05, $04, $0f, $04, $04, $04, $0e
db $04, $0c, $04, $02, $04, $0d, $04, $03
db $05, $04, $0f, $04, $04, $04, $0e, $04
db $0c, $04, $02, $04, $0d, $04, $03, $04
db $06, $07, $06, $0d, $06, $06, $06, $0c
db $06, $0a, $06, $04, $06, $0b, $06, $05
db $07, $06, $0d, $06, $06, $06, $0c, $06
db $0a, $06, $04, $06, $0b, $06, $05, $06
db $08, $09, $08, $0b, $08, $08, $08, $0a
db $08, $08, $08, $06, $08, $09, $08, $07
db $09, $08, $0b, $08, $08, $08, $0a, $08
db $08, $08, $06, $08, $09, $08, $07, $08
.ReadFlashlightDst:
ld c, [hl]
inc hl
ld b, [hl]
inc hl
push hl
push bc
ld a, [wBGMapAnchor]
ld e, a
ld a, [wBGMapAnchor + 1]
ld d, a
.row_loop
ld a, BG_MAP_WIDTH
add e
ld e, a
jr nc, .no_overflow
inc d
.no_overflow
ld a, d
and %11
or HIGH(vBGMap0) ; equivalent of add $98
ld d, a
dec b
jr nz, .row_loop
.tile_loop
ld a, e
inc a
maskbits BG_MAP_WIDTH - 1 ; only works if BG_MAP_WIDTH is 2^n
ld b, a
ld a, e
and ~(BG_MAP_WIDTH - 1)
or b
ld e, a
dec c
jr nz, .tile_loop
pop bc
pop hl
ret
.GetFlashlightSrc:
push hl
ld hl, wTileMap
ld de, SCREEN_WIDTH
.loop
ld a, b
and a
jr z, .last_row
add hl, de
dec b
jr .loop
.last_row
add hl, bc
ld e, l
ld d, h
pop hl
ret
.GetFlashlightSize:
ldh a, [hOverworldFlashlightEffect]
dec a
ld l, a
ld h, 0
ld de, .Sizes
add hl, de
ld a, [hl]
ld [wRedrawFlashlightWidthHeight], a
ret
.Sizes:
db 7, 5, 3, 1

View File

@ -2,6 +2,21 @@ INCLUDE "constants.asm"
SECTION "engine/overworld/spawn_points.asm", ROMX
GetFlyPointMapLocation:
ld a, [wFlyDestination]
ld l, a
ld h, $00
add hl, hl
add hl, hl
ld de, SpawnPoints
add hl, de
ld b, [hl] ; SpawnPoints + (wFlyDestination * 4)
inc hl
ld c, [hl]
call GetWorldMapLocation
ld e, a
ret
LoadSpawnPoint:
; loads the spawn point in wDefaultSpawnPoint
push hl

View File

@ -0,0 +1,138 @@
INCLUDE "constants.asm"
SECTION "engine/pokedex/display_dex_entry.asm", ROMX
; Meters
DEF POKEDEX_m EQU $60
; Kilograms
DEF POKEDEX_k EQU $61
DEF POKEDEX_g EQU $62
_DisplayDexEntry:
hlcoord 9, 6
ld de, PokedexText_HeightWeight
call PlaceString
call GetPokemonName
hlcoord 9, 2
call PlaceString
ld hl, PokedexEntryPointers1
ld a, [wTempSpecies]
cp DEX_VOLTORB
jr c, .got_dex_entries
sub DEX_VOLTORB - 1
ld hl, PokedexEntryPointers2
.got_dex_entries
dec a
ld e, a
ld d, 0
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
hlcoord 9, 4
call PlaceString
ld h, b
ld l, c
push de
ld de, PokedexText_Pokemon
call PlaceString
hlcoord 2, 8
ld a, "№"
ld [hli], a
ld a, ""
ld [hli], a
ld de, wTempSpecies
lb bc, PRINTNUM_LEADINGZEROS | 1, 3
call PrintNumber
; Return if species isn't caught
callfar Pokedex_CheckCaught
push af
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
pop af
pop de
ret z
inc de
ld a, [de]
and a
jr z, .skip_height
hlcoord 13, 6
lb bc, 1, 3
call PrintNumber
hlcoord 14, 6
ld a, [de]
cp 10
jr nc, .less_than_1_meter
ld [hl], ""
.less_than_1_meter
; Shift last digit to the right and put decimal point in its place.
inc hl
ld a, [hli]
ld [hld], a
ld [hl], ""
.skip_height
inc de
ld a, [de]
ld b, a
inc de
ld a, [de]
or b
push de
jr z, .skip_weight
ld hl, hPokedexTempWeight
ld a, [hl]
push af
ld a, [de]
ld [hli], a
ld a, [hl]
push af
dec de
ld a, [de]
ld [hl], a
ld de, hPokedexTempWeight
hlcoord 12, 8
lb bc, 2, 4
call PrintNumber
hlcoord 14, 8
ldh a, [hPokedexTempWeight + 1]
sub 10
ldh a, [hPokedexTempWeight]
sbc 0
jr nc, .less_than_1_kilogram
ld [hl], ""
.less_than_1_kilogram
; Shift last digit to the right and put decimal point in its place.
inc hl
ld a, [hli]
ld [hld], a
ld [hl], ""
pop af
ldh [hPokedexTempWeight + 1], a
pop af
ldh [hPokedexTempWeight], a
.skip_weight
pop de
inc de
hlcoord 1, 11
call PlaceString
ret
PokedexText_HeightWeight:
db "たかさ  ???", POKEDEX_m
next "おもさ  ???", POKEDEX_k, POKEDEX_g
text_end
PokedexText_Pokemon:
db "#" ; "Pokémon" (ポケモン)
text_end

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,970 @@
INCLUDE "constants.asm"
SECTION "engine/pokedex/pokedex_2.asm", ROMX
; Pokedex_UpdateSearchScreen.Jumptable indexes
const_def
const SEARCHSTATE_INIT_FIRST_MON_TYPE
const SEARCHSTATE_UPDATE_FIRST_MON_TYPE
const SEARCHSTATE_INIT_FIRST_TYPE_SELECTED_MENU
const SEARCHSTATE_UPDATE_FIRST_TYPE_SELECTED_MENU
const SEARCHSTATE_INIT_SECOND_MON_TYPE
const SEARCHSTATE_UPDATE_SECOND_MON_TYPE
const SEARCHSTATE_INIT_SECOND_TYPE_SELECTED_MENU
const SEARCHSTATE_UPDATE_SECOND_TYPE_SELECTED_MENU
const SEARCHSTATE_EXIT_NO_SLOWPOKE_ANIM
const SEARCHSTATE_EXIT_PLAY_SLOWPOKE_ANIM
Pokedex_SearchByTypeScreen::
ld hl, wJumptableIndex
ld a, [hl]
push af
xor a
ld [hl], a
ld hl, hInMenu
ld a, [hl]
push af
ld a, 1
ld [hl], a
call ClearSprites
call .Init
.loop
ld a, [wJumptableIndex]
bit JUMPTABLE_EXIT_F, a
jr nz, .return
call Pokedex_UpdateSearchScreen
call DelayFrame
jr .loop
.return
pop af
ldh [hInMenu], a
pop af
ld [wJumptableIndex], a
ret
.Init
ld hl, wDexListingCursor
ld c, wDexPlaySlowpokeAnimation - wDexListingCursor
xor a
.init_loop:
ld [hli], a
dec c
jr nz, .init_loop
ret
Pokedex_UpdateSearchScreen:
jumptable .SearchScreenJumptable, wJumptableIndex
.SearchScreenJumptable:
dw Pokedex_InitSearchMonType, Pokedex_UpdateSearchMonType
dw Pokedex_InitFirstTypeSelectedMenu, Pokedex_UpdateFirstTypeSelectedMenu
dw Pokedex_InitNextSearchMonType, Pokedex_UpdateNextSearchMonType
dw Pokedex_InitSecondTypeSelectedMenu, Pokedex_UpdateSecondTypeSelectedMenu
dw Pokedex_ExitSearch_NoSlowpokeAnimation, Pokedex_ExitSearch_PlaySlowpokeAnimation
Pokedex_InitSearchMonType:
xor a
ld hl, wDexSearchMonType1
ld [hli], a
ld [hli], a
ld [hli], a
call Pokedex_DisplayTypeSearch
ld hl, wJumptableIndex ; SEARCHSTATE_UPDATE_FIRST_MON_TYPE
inc [hl]
ret
Pokedex_UpdateSearchMonType:
call GetJoypadDebounced
ld de, wDexSearchMonType1
call Pokedex_GetSearchMenuJoyDown
ret nc
ld a, SEARCHSTATE_EXIT_NO_SLOWPOKE_ANIM
ld [wJumptableIndex], a
ret
Pokedex_InitFirstTypeSelectedMenu:
ld de, FirstTypeSelectedMenu
call Pokedex_DisplaySearchOptions
ret
Pokedex_UpdateFirstTypeSelectedMenu:
call GetJoypadDebounced
ld hl, hJoyDown
ld a, [hl]
and A_BUTTON
jr nz, .a_pressed
ld a, [hl]
and B_BUTTON
jr nz, .b_pressed
call Pokedex_MoveTypeSelectedMenuCursor
ret
.b_pressed
ld a, SEARCHSTATE_INIT_FIRST_MON_TYPE
ld [wJumptableIndex], a
ret
.a_pressed
ld a, [wDexArrowCursorPosIndex]
and a
jr z, .search
cp 1
jr z, .select_next_type
ld a, SEARCHSTATE_EXIT_NO_SLOWPOKE_ANIM
ld [wJumptableIndex], a
ret
.search
call Pokedex_SearchForMons
ld a, SEARCHSTATE_EXIT_PLAY_SLOWPOKE_ANIM
ld [wJumptableIndex], a
ret
.select_next_type
ld a, SEARCHSTATE_INIT_SECOND_MON_TYPE
ld [wJumptableIndex], a
ret
Pokedex_InitNextSearchMonType:
xor a
ld [wDexSearchMonType2], a
ld [wDexArrowCursorPosIndex], a
call Pokedex_DisplayTypeSearch
ld hl, wJumptableIndex ; SEARCHSTATE_UPDATE_SECOND_MON_TYPE
inc [hl]
ret
Pokedex_UpdateNextSearchMonType:
call GetJoypadDebounced
ld de, wDexSearchMonType2
call Pokedex_GetSearchMenuJoyDown
ret nc
ld a, SEARCHSTATE_INIT_FIRST_TYPE_SELECTED_MENU
ld [wJumptableIndex], a
ret
Pokedex_InitSecondTypeSelectedMenu:
ld de, SecondTypeSelectedMenu
call Pokedex_DisplaySearchOptions
ret
Pokedex_UpdateSecondTypeSelectedMenu:
call GetJoypadDebounced
ld hl, hJoyDown
ld a, [hl]
and A_BUTTON
jr nz, .a_pressed
ld a, [hl]
and B_BUTTON
jr nz, .b_pressed
call Pokedex_MoveTypeSelectedMenuCursor
ret
.b_pressed
ld a, SEARCHSTATE_INIT_SECOND_MON_TYPE
ld [wJumptableIndex], a
ret
.a_pressed
ld a, [wDexArrowCursorPosIndex]
and a
jr z, .search
cp 1
jr z, .back_to_first_type
ld a, SEARCHSTATE_EXIT_NO_SLOWPOKE_ANIM
ld [wJumptableIndex], a
ret
.search
call Pokedex_SearchForMons
ld a, SEARCHSTATE_EXIT_PLAY_SLOWPOKE_ANIM
ld [wJumptableIndex], a
ret
; Unreferenced
.reorder_dex
call Pokedex_OrderMonsByMode
.back_to_first_type
ld a, SEARCHSTATE_INIT_FIRST_MON_TYPE
ld [wJumptableIndex], a
ret
Pokedex_ExitSearch_NoSlowpokeAnimation:
xor a
ld [wDexPlaySlowpokeAnimation], a
ld hl, wJumptableIndex
set JUMPTABLE_EXIT_F, [hl]
ret
Pokedex_ExitSearch_PlaySlowpokeAnimation:
ld a, SEARCHSTATE_UPDATE_FIRST_MON_TYPE
ld [wDexPlaySlowpokeAnimation], a
ld hl, wJumptableIndex
set JUMPTABLE_EXIT_F, [hl]
ret
Pokedex_GetSearchMenuJoyDown:
ld hl, hJoyDown
ld a, [hl]
and A_BUTTON
jr nz, .a_pressed
ld a, [hl]
and B_BUTTON
jr nz, .b_pressed
call Pokedex_MoveSearchMenuCursor
and a
ret
.b_pressed
scf
ret
.a_pressed
ld hl, wDexListingCursor
ld a, [wDexArrowCursorPosIndex]
add [hl]
inc a
ld [de], a
call Pokedex_PlaceSearchScreenTypeStrings
call Pokedex_WaitBGMap
ld hl, wJumptableIndex
inc [hl]
and a
ret
Pokedex_DisplaySearchOptions:
; Erase old cursor
push de
ld a, [wDexArrowCursorPosIndex]
call Pokedex_GetSearchScreenCursorPos
ld [hl], " "
; Place new cursor
hlcoord 13, 12
ld [hl], "▶"
xor a
ld [wDexArrowCursorPosIndex], a
pop de
; Place the options loaded at de
hlcoord 14, 12
call PlaceString
call Pokedex_WaitBGMap
; Move to update code for next Jumptable loop
ld hl, wJumptableIndex
inc [hl]
ret
Pokedex_DisplayTypeSearch:
xor a
ldh [hBGMapMode], a
ld hl, wTileMap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
.fill_screen
ld [hl], $6b
inc hl
dec bc
ld a, c
or b
jr nz, .fill_screen
hlcoord 1, 0
lb bc, 2, 10
call ClearBox
hlcoord 13, 0
lb bc, 2, 6
call ClearBox
hlcoord 0, 2
lb bc, 16, 12
call Pokedex_PlaceBorder
hlcoord 12, 2
lb bc, 6, 8
call Pokedex_PlaceBorder
hlcoord 12, 10
lb bc, 8, 8
call Pokedex_PlaceBorder
hlcoord 1, 1
ld de, .SearchByTypeString
call PlaceString
hlcoord 13, 1
ld de, .SelectedString
call PlaceString
call Pokedex_PlaceSearchScreenTypeList
call Pokedex_PlaceSearchScreenTypeStrings
hlcoord 2, 4
ld [hl], "▶"
call Pokedex_WaitBGMap
ret
.SearchByTypeString:
db "ぞくせい で さがす@"
.SelectedString:
db "えらんだもの@"
FirstTypeSelectedMenu:
db "さがす"
next "もうひとつ"
next "やめる@"
SecondTypeSelectedMenu:
db "さがす"
next "やりなおし"
next "やめる@"
Pokedex_PlaceSearchScreenTypeList:
ld a, [wDexListingCursor]
call Pokedex_GetTypeString
hlcoord 3, 4
ld c, 7
.loop
push bc
push de
push hl
call PlaceString
pop hl
ld de, SCREEN_WIDTH * 2
add hl, de
pop de
rept POKEDEX_TYPE_STRING_LENGTH
inc de
endr
pop bc
dec c
jr nz, .loop
ret
Pokedex_PlaceSearchScreenTypeStrings:
ld a, [wDexSearchMonType1]
call .check_type
hlcoord 14, 4
call PlaceString
ld a, [wDexSearchMonType2]
call .check_type
hlcoord 14, 6
call PlaceString
ret
.check_type
and a
jr z, .no_type_selected
dec a
call Pokedex_GetTypeString
ret
.no_type_selected
ld de, .NoTypeString
ret
.NoTypeString
db "ーーーー@"
Pokedex_GetTypeString:
ld e, a
ld d, $00
ld hl, PokedexTypeSearchStrings
rept POKEDEX_TYPE_STRING_LENGTH
add hl, de
endr
ld e, l
ld d, h
ret
INCLUDE "data/types/search_strings.inc"
Pokedex_MoveSearchMenuCursor:
ld hl, hJoySum
ld a, [hl]
and D_UP
jr nz, .up
ld a, [hl]
and D_DOWN
jr nz, .down
ret
.up
call .MoveUp
ret nc
ld hl, wDexListingCursor
ld a, [hl]
and a
ret z
dec [hl]
hlcoord 3, 3
lb bc, 14, 8
call ClearBox
call Pokedex_PlaceSearchScreenTypeList
call Pokedex_WaitBGMap
ret
.down
call .MoveDown
ret nc
ld hl, wDexListingCursor
ld a, [hl]
cp $8
ret nc
inc [hl]
hlcoord 3, 3
lb bc, 14, 8
call ClearBox
call Pokedex_PlaceSearchScreenTypeList
call Pokedex_WaitBGMap
ret
.MoveUp:
ld a, [wDexArrowCursorPosIndex]
and a
jr z, .set_carry_flag_up
call Pokedex_GetSearchScreenCursorPos
ld [hl], " "
ld hl, wDexArrowCursorPosIndex
dec [hl]
jr .PutArrow
.set_carry_flag_up
scf
ret
.MoveDown:
ld a, [wDexArrowCursorPosIndex]
cp 6
jr nc, .set_carry_flag_down
call Pokedex_GetSearchScreenCursorPos
ld [hl], " "
ld hl, wDexArrowCursorPosIndex
inc [hl]
jr .PutArrow
.set_carry_flag_down
scf
ret
.PutArrow:
ld a, [hl]
call Pokedex_GetSearchScreenCursorPos
ld [hl], "▶"
call Pokedex_WaitBGMap
and a
ret
Pokedex_GetSearchScreenCursorPos:
ld e, a
ld d, $00
ld hl, .CursorPosTable
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ret
.CursorPosTable:
dwcoord 2, 4
dwcoord 2, 6
dwcoord 2, 8
dwcoord 2, 10
dwcoord 2, 12
dwcoord 2, 14
dwcoord 2, 16
Pokedex_MoveTypeSelectedMenuCursor:
ld hl, hJoyDown
ld a, [hl]
and D_UP
jr nz, .up
ld a, [hl]
and D_DOWN
jr nz, .down
ret
.up
ld a, [wDexArrowCursorPosIndex]
and a
ret z
call Pokedex_GetTypeSelectedMenuCursorPos
ld [hl], " "
ld hl, wDexArrowCursorPosIndex
dec [hl]
jr .PutArrow
.down
ld a, [wDexArrowCursorPosIndex]
cp $2
ret nc
call Pokedex_GetTypeSelectedMenuCursorPos
ld [hl], " "
ld hl, wDexArrowCursorPosIndex
inc [hl]
.PutArrow:
ld a, [hl]
call Pokedex_GetTypeSelectedMenuCursorPos
ld [hl], "▶"
call Pokedex_WaitBGMap
and a
ret
Pokedex_GetTypeSelectedMenuCursorPos:
ld e, a
ld d, 0
ld hl, .CursorPosTable
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ret
.CursorPosTable:
dwcoord 13, 12
dwcoord 13, 14
dwcoord 13, 16
Pokedex_SearchForMons:
ld a, [wDexSearchMonType2]
and a
jr z, .next_type
call .Search
.next_type
ld a, [wDexSearchMonType1]
and a
ret z
call .Search
ret
.Search:
dec a
ld e, a
ld d, $00
ld hl, PokedexTypeSearchConversionTable
add hl, de
ld a, [hl]
ld [wDexConvertedMonType], a
ld hl, wPokedexOrder
ld de, wPokedexOrder
ld c, NUM_POKEMON
xor a
ld [wDexSearchResultCount], a
.loop
push bc
ld a, [hl]
and a
jr z, .next_mon
ld [wTempSpecies], a
ld [wCurSpecies], a
call Pokedex_CheckCaught
jr z, .next_mon
push hl
push de
call GetBaseData
pop de
pop hl
ld a, [wDexConvertedMonType]
ld b, a
ld a, [wMonHType1]
cp b
jr z, .match_found
ld a, [wMonHType2]
cp b
jr nz, .next_mon
.match_found
ld a, [wTempSpecies]
ld [de], a
inc de
ld a, [wDexSearchResultCount]
inc a
ld [wDexSearchResultCount], a
.next_mon
inc hl
pop bc
dec c
jr nz, .loop
ld l, e
ld h, d
ld a, [wDexSearchResultCount]
ld [wDexListingEnd], a
ld c, $00
.zero_remaining_mons
cp NUM_POKEMON
jr z, .done
ld [hl], c
inc hl
inc a
jr .zero_remaining_mons
.done
ret
INCLUDE "data/types/search_types.inc"
Pokedex_WaitBGMap:
call WaitBGMap
xor a
ldh [hBGMapMode], a
ret
Pokedex_UnownMode:
ld hl, wJumptableIndex
ld a, [hl]
push af
xor a
ld [hl], a
ld hl, hInMenu
ld a, [hl]
push af
ld a, $01
ld [hl], a
call ClearSprites
call GetDexUnownCount
.Loop
ld a, [wJumptableIndex]
bit JUMPTABLE_EXIT_F, a
jr nz, .done
call Pokedex_RunUnownModeJumptable
call DelayFrame
jr .Loop
.done:
pop af
ldh [hInMenu], a
pop af
ld [wJumptableIndex], a
ret
GetDexUnownCount:
ld hl, wDexListingCursor
ld bc, wDexPlaySlowpokeAnimation - wDexListingCursor
xor a
call ByteFill
ld hl, wUnownDex
ld bc, NUM_UNOWN
.annon_loop:
ld a, [hli]
and a
jr z, .no_annon
inc b
.no_annon
dec c
jr nz, .annon_loop
ld a, b
ld [wDexUnownCount], a
ret
Pokedex_RunUnownModeJumptable:
jumptable .Jumptable, wJumptableIndex
.Jumptable
dw .Init, .Update, .ShowUnownLetter
.Init:
ld hl, wJumptableIndex
inc [hl]
call Pokedex_InitUnownMode
ret
.Update:
call GetJoypadDebounced
ld hl, hJoyDown
ld a, [hl]
and A_BUTTON
jr nz, .selected_unown
ld a, [hl]
and B_BUTTON
jr nz, .exit
call Pokedex_UnownModeHandleDPadInput
ret
.exit
ld hl, wJumptableIndex
set JUMPTABLE_EXIT_F, [hl]
ret
.selected_unown
ld hl, wJumptableIndex
inc [hl]
ret
.ShowUnownLetter:
ld hl, wDexListingCursor
ld a, [wDexArrowCursorPosIndex]
add [hl]
ld e, a
inc a
ld [wDexCurUnownIndex], a
ld d, $00
ld hl, wUnownDex
add hl, de
ld a, [hl]
ld [wAnnonID], a
ld a, DEX_ANNON
ld [wCurPartySpecies], a
ld [wCurSpecies], a
call GetBaseData
xor a
ld [wSpriteFlipped], a
hlcoord 12, 10
call _PrepMonFrontpic
hlcoord 12, 8
call PrintUnownListEntry
call Pokedex_WaitBGMap
ld hl, wJumptableIndex
dec [hl]
ret
Pokedex_InitUnownMode:
xor a
ldh [hBGMapMode], a
ld hl, wTileMap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $6b
call ByteFill
hlcoord 0, 2
lb bc, 16, 11
call Pokedex_PlaceBorder
hlcoord 11, 2
lb bc, 6, 9
call Pokedex_PlaceBorder
hlcoord 11, 9
lb bc, 9, 9
call Pokedex_PlaceBorder
hlcoord 4, 1
ld de, .UnownVariantsString
call PlaceString
hlcoord 13, 4
ld de, .VariantsDiscoveredString
call PlaceString
hlcoord 13, 4
ld de, wDexUnownCount
lb bc, 1, 2
call PrintNumber
hlcoord 12, 8
call PrintUnownListEntry
hlcoord 17, 8
ld a, ""
ld [hli], a
ld [hl], a
call PrintUnownList
hlcoord 2, 4
ld [hl], "▶"
call Pokedex_WaitBGMap
ret
.UnownVariantsString:
db "アンノーン の しゅるい@"
.VariantsDiscoveredString:
db "  しゅるい<NEXT> はっけん!@"
PrintUnownList:
ld a, [wDexUnownCount]
cp 7
jr c, .max_length
ld a, 7
.max_length
ld [wDexUnownModeListLength], a
ld a, [wDexListingCursor]
inc a
ld [wDexCurUnownIndex], a
hlcoord 3, 4
ld a, [wDexUnownModeListLength]
.loop
push af
push hl
call PrintUnownListEntry
ld hl, wDexCurUnownIndex
inc [hl]
pop hl
ld de, SCREEN_WIDTH * 2
add hl, de
pop af
dec a
jr nz, .loop
ret
PrintUnownListEntry:
ld de, .UnownString
call PlaceString
ld l, c
ld h, b
ld de, wDexCurUnownIndex
lb bc, 1 | %10000000, 2
call PrintNumber
ret
.UnownString:
db "アンノーン@"
Pokedex_UnownModeHandleDPadInput:
ld hl, hJoySum
ld a, [hl]
and D_UP
jr nz, .up
ld a, [hl]
and D_DOWN
jr nz, .down
ret
.up
call .ScrollListUp
ret nc
ld hl, wDexListingCursor
ld a, [hl]
and a
ret z
dec [hl]
hlcoord 3, 3
lb bc, 14, 7
call ClearBox
call PrintUnownList
call Pokedex_WaitBGMap
ret
.down
call .ScrollListDown
ret nc
ld a, [wDexUnownCount]
cp 7
ret c
ld a, [wDexUnownCount]
sub 7
ld e, a
ld hl, wDexListingCursor
ld a, [hl]
cp e
ret nc
inc [hl]
hlcoord 3, 3
lb bc, 14, 7
call ClearBox
call PrintUnownList
call Pokedex_WaitBGMap
ret
.ScrollListUp:
ld a, [wDexArrowCursorPosIndex]
and a
jr z, .top_of_list
call .GetCursorPos
ld [hl], " "
ld hl, wDexArrowCursorPosIndex
dec [hl]
jr .PlaceArrow
.top_of_list
scf
ret
.ScrollListDown:
ld a, [wDexUnownCount]
cp 7
jr c, .longer_than_7_entries
ld a, 7
.longer_than_7_entries
dec a
ld e, a
ld a, [wDexArrowCursorPosIndex]
cp e
jr nc, .bottom_of_list
call .GetCursorPos
ld [hl], " "
ld hl, wDexArrowCursorPosIndex
inc [hl]
jr .PlaceArrow
.bottom_of_list
scf
ret
.PlaceArrow:
ld a, [hl]
call Pokedex_GetSearchScreenCursorPos
ld [hl], "▶"
call Pokedex_WaitBGMap
and a
ret
.GetCursorPos:
ld e, a
ld d, $00
ld hl, .CursorPosTable
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ret
.CursorPosTable:
dwcoord 2, 4
dwcoord 2, 6
dwcoord 2, 8
dwcoord 2, 10
dwcoord 2, 12
dwcoord 2, 14
dwcoord 2, 16

653
engine/pokemon/bills_pc.asm Normal file
View File

@ -0,0 +1,653 @@
INCLUDE "constants.asm"
SECTION "engine/pokemon/bills_pc.asm", ROMX
_BillsPC:
call .CheckCanUsePC
ret c
call LoadStandardMenuHeader
call ClearTileMap
call LoadFontsBattleExtra
ld hl, vChars2 tile $78
ld de, PokeBallsGFX
lb bc, BANK(PokeBallsGFX), 1
call Request2bpp
ld hl, .PCWhatText
call MenuTextBox
ld hl, .MenuHeader
call LoadMenuHeader
.loop
call SetPalettes
xor a
ld [wWhichIndexSet], a
call OpenMenu
jr c, .cancel
ld a, [wMenuSelection]
ld hl, .Jumptable
call CallJumptable
jr nc, .loop
.cancel
call CloseWindow
call CloseWindow
call LoadTilesetGFX
call RestoreScreenAndReloadTiles
call LoadFontExtra
call CloseWindow
ret
.PCWhatText:
text "なんに するん?" ; (lit. "What are you going to do?")
done
.MenuHeader:
db MENU_BACKUP_TILES
menu_coords 0, 0, 14, 17
dw .MenuData
db 1
.MenuData:
db MENU_BACKUP_TILES_2
db 0
dw .items
dw PlaceMenuStrings
dw .strings
.strings
db "#の ようすをみる@" ; (lit "look at Pokemon")
db "#を つれていく@" ; "Withdraw (Pokemon)"
db "#を あずける@" ; "Deposit (Pokemon)"
db "#を にがす@" ; "Release (Pokemon)"
db "ボックスを かえる@" ; "Change Box"
db "さようなら@" ; "Goodbye"
.Jumptable:
dw BillsPC_ViewPokemon
dw BillsPC_WithdrawPokemon
dw BillsPC_DepositMon
dw BillsPC_ReleaseMon
dw BillsPC_ChangeBoxMenu
dw BillsPC_SeeYa
.items
db 5 ; # items
db 0 ; VIEW
db 1 ; WITHDRAW
db 2 ; DEPOSIT
db 3 ; RELEASE
db 4 ; CHANGE BOX
db 5 ; SEE YA!
db -1
.CheckCanUsePC:
ld a, [wPartyCount]
and a
ret nz
ld hl, .PCGottaHavePokemonText
call MenuTextBoxBackup
scf
ret
.PCGottaHavePokemonText:
text "#もってへんやつは"
line "おことわりや!"
prompt
BillsPC_SeeYa:
scf
ret
BillsPC_DepositMon:
call .CheckPartySize
jr c, .cant_deposit
call _DepositPKMN
.cant_deposit
and a
ret
.CheckPartySize:
ld a, [wPartyCount]
and a
jr z, .no_mon
cp 2
jr c, .only_one_mon
and a
ret
.no_mon
ld hl, .PCNoSingleMonText
call MenuTextBoxBackup
scf
ret
.only_one_mon
ld hl, .PCCantDepositLastMonText
call MenuTextBoxBackup
scf
ret
.PCNoSingleMonText:
text "1ぴきも もってへんやんか!" ; (lit: "I can't even have one!")
prompt
.PCCantDepositLastMonText:
text "それ あずけたら" ; "You can't deposit"
line "こまるんとちゃう?" ; "the last #MON!"
prompt
_DepositPKMN:
call LoadStandardMenuHeader
ld hl, BillsPC_DepositMenu
call BillsPC_Menu
call CloseWindow
ret c
ld a, [wScrollingMenuCursorPosition]
ld [wCurPartyMon], a
ld a, [wMenuSelection]
ld [wCurPartySpecies], a
ld a, PC_DEPOSIT
ld [wPokemonWithdrawDepositParameter], a
predef SendGetMonIntoFromBox
xor a ; REMOVE_PARTY
ld [wPokemonWithdrawDepositParameter], a
call RemoveMonFromPartyOrBox
ret
BillsPC_WithdrawPokemon:
call .CheckPartySize
jr c, .cant_withdraw
call _WithdrawPKMN
.cant_withdraw
and a
ret
.CheckPartySize:
ld a, [wPartyCount]
cp PARTY_LENGTH
jr nc, .party_full
and a
ret
.party_full
ld hl, .PCCantTakeText
call MenuTextBoxBackup
scf
ret
.PCCantTakeText:
text "それいじょう よくばったって" ; "You can't take any"
line "# もたれへんで!" ; "more #MON."
prompt
_WithdrawPKMN:
call LoadStandardMenuHeader
ld hl, BillsPC_WithdrawReleaseMenu
call BillsPC_Menu
call CloseWindow
ret c
ld a, [wScrollingMenuCursorPosition]
ld [wCurPartyMon], a
ld a, [wMenuSelection]
ld [wCurPartySpecies], a
xor a ; PC_WITHDRAW
ld [wPokemonWithdrawDepositParameter], a
predef SendGetMonIntoFromBox
ld a, REMOVE_BOX
ld [wPokemonWithdrawDepositParameter], a
call RemoveMonFromPartyOrBox
ret
BillsPC_ReleaseMon:
call .ReleasePKMN
and a
ret
.ReleasePKMN:
call LoadStandardMenuHeader
ld hl, BillsPC_WithdrawReleaseMenu
call BillsPC_Menu
call CloseWindow
ld a, [wScrollingMenuCursorPosition]
ld [wCurPartyMon], a
ld a, [wMenuSelection]
ld [wCurPartySpecies], a
ret c
ld hl, .OnceReleasedText
call MenuTextBox
call YesNoBox
call CloseWindow
ret c
ld a, REMOVE_BOX
ld [wPokemonWithdrawDepositParameter], a
call RemoveMonFromPartyOrBox
ret
.OnceReleasedText:
text_from_ram wStringBuffer1
text " をほんとうに" ; "Are you sure you"
next "にがしますか?" ; "want to release (MON)?"
done
BillsPC_ChangeBoxMenu:
call _ChangeBox
and a
ret
_ChangeBox:
call InitDummyBoxNames
call LoadStandardMenuHeader
call ClearPalettes
call ClearTileMap
.sub_e3d4
ld hl, _ChangeBox_MenuHeader
call CopyMenuHeader
call ScrollingMenu
ld a, [wMenuJoypad]
cp B_BUTTON
jr z, .sub_e3e9
call BillsPC_ChangeBoxSubmenu
jr .sub_e3d4
.sub_e3e9
call CloseWindow
ret
; Resets all box names to "ダミーボックス#" ("Dummy Box#"), where # is the box index.
InitDummyBoxNames:
ld hl, wBoxNames
ld c, 0
.loop
push hl
ld de, .DummyBoxText
call CopyString
ld a, ""
add c
dec hl
ld [hli], a
ld [hl], "@"
pop hl
ld de, BOX_NAME_LENGTH
add hl, de
inc c
ld a, c
cp NUM_BOXES
jr c, .loop
ret
.DummyBoxText:
db "ダミーボックス@" ; "Dummy Box"
_ChangeBox_MenuHeader:
db MENU_BACKUP_TILES
menu_coords 0, 0, SCREEN_WIDTH - 1, 12
dw .MenuData
db 1
.MenuData:
db SCROLLINGMENU_ENABLE_FUNCTION3
db 4, 0
db SCROLLINGMENU_ITEMS_NORMAL
dba .Boxes
dba .PrintBoxNames
ds 3
dba BillsPC_PrintBoxCountAndCapacity
.Boxes:
db NUM_BOXES
for x, NUM_BOXES
db x + 1
endr
db -1
.PrintBoxNames:
push de
ld a, [wMenuSelection]
dec a
ld bc, 6 ; length of "No. 0#" strings
ld hl, .BoxNumbers
call AddNTimes
ld d, h
ld e, l
pop hl
call PlaceString
push bc
ld a, [wMenuSelection]
dec a
ld bc, BOX_NAME_LENGTH
ld hl, wBoxNames
call AddNTimes
ld d, h
ld e, l
pop hl
call PlaceString
ret
; TODO: rework this to use a nice macro?
.BoxNumbers:
db "№.01 @"
db "№.02 @"
db "№.03 @"
db "№.04 @"
db "№.05 @"
db "№.06 @"
db "№.07 @"
db "№.08 @"
db "№.09 @"
db "№.10 @"
BillsPC_PrintBoxCountAndCapacity:
ld h, d
ld l, e
ld de, .Pokemon
call PlaceString
ld hl, 3
add hl, bc
push hl
call .GetBoxCount
pop hl
ld de, wStringBuffer1
ld [de], a
lb bc, 1, 2
call PrintNumber
ld de, .OutOf30
call PlaceString
ret
.Pokemon:
db "あずかっている#" ; "Mon in my care"
next " @"
.OutOf30: ; max mon per box
db "@"
.GetBoxCount:
ld a, [wMenuSelection]
dec a
ld c, a
ld b, 0
ld hl, .BoxBankAddresses
add hl, bc
add hl, bc
add hl, bc
ld a, [hli]
call OpenSRAM
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hl]
call CloseSRAM
ret
.BoxBankAddresses:
table_width 3, BillsPC_PrintBoxCountAndCapacity.BoxBankAddresses
for n, 1, NUM_BOXES + 1
dba sBox{d:n}
endr
assert_table_length NUM_BOXES
BillsPC_ChangeBoxSubmenu:
ld hl, .MenuHeader
call LoadMenuHeader
call VerticalMenu
call CloseWindow
ret c
ld a, [wMenuCursorY]
cp 1
jr z, .Switch
cp 2
jr z, .Name
and a
ret
.UnderDev:
ld hl, .BoxChangeUnderDevText
call MenuTextBox
call CloseWindow
ret
.BoxChangeUnderDevText:
text "バンクチェンジは" ; "Box change is"
next "かいはつちゅうです!" ; "under development!"
prompt
.Switch:
ld hl, .ChangeBoxSaveText
call MenuTextBox
call YesNoBox
call CloseWindow
ret c
jr .UnderDev
.Unreferenced_e54d:
ld a, [wMenuSelection]
ret
.ChangeBoxSaveText:
text "# ボックスを かえると" ; "When you change a box"
line "どうじに レポートが かかれます" ; "data will be saved."
para "<⋯⋯> それでも いいですか?" ; "Is that okay?"
done
.Name:
ld b, NAME_BOX
ld de, wTempBoxName
farcall NamingScreen
ld a, [wTempBoxName]
cp "@"
ret z
ld hl, wBoxNames
ld bc, BOX_NAME_LENGTH
ld a, [wMenuSelection]
dec a
call AddNTimes
ld de, wTempBoxName
call CopyString
ret
.MenuHeader:
db MENU_BACKUP_TILES
menu_coords 0, 6, 14, 14
dw .MenuData
db 1
.MenuData:
db STATICMENU_CURSOR
db 3
db "ボックスきりかえ@" ; "Change Box"
db "なまえを かえる@" ; " Change Name"
db "やめる@" ; (lit "stop")
BillsPC_ViewPokemon:
call LoadStandardMenuHeader
call _ViewPKMN
call ClearPalettes
call CloseWindow
and a
ret
_ViewPKMN:
.loop
call ClearBGPalettes
call .InitViewPokemonDisplay
call SetPalettes
ld hl, BillsPC_ViewMenuHeader
call CopyMenuHeader
ld a, [wBillsPCCursor]
ld [wMenuCursorPosition], a
ld a, [wBillsPCScrollPosition]
ld [wMenuScrollPosition], a
call ScrollingMenu
ld a, [wMenuScrollPosition]
ld [wBillsPCScrollPosition], a
ld a, [wMenuCursorY]
ld [wBillsPCCursor], a
call ClearPalettes
ld a, [wMenuJoypad]
cp B_BUTTON
jr z, .exit
call .ViewStats
jr .loop
.exit
ret
.ViewStats
ld a, [wScrollingMenuCursorPosition]
ld [wCurPartyMon], a
ld a, BOXMON
ld [wMonType], a
call LoadStandardMenuHeader
call LowVolume
predef StatsScreenMain
call MaxVolume
call ExitMenu
ret
.InitViewPokemonDisplay
ld hl, wOptions
ld a, [hl]
push af
set NO_TEXT_SCROLL_F, [hl]
call ClearTileMap
; Note that the name of the box doesn't actually gets printed yet: register 'de' is immediately overwritten,
; so the game displays the placeholder "いまの ボックス" ("Current Box"). The setup is here, though.
ld a, [wCurBox]
ld hl, wBoxNames
ld bc, BOX_NAME_LENGTH
call AddNTimes
ld d, h
ld e, l
hlcoord 1, 1
ld de, .CurrentBox
call PlaceString
hlcoord 0, 3
ld a, "┌"
ld [hli], a
ld a, "─"
ld c, SCREEN_WIDTH - 1
.top_border_loop
ld [hli], a
dec c
jr nz, .top_border_loop
ld de, SCREEN_WIDTH
ld a, "│"
ld c, 8
.left_border_loop
ld [hl], a
add hl, de
dec c
jr nz, .left_border_loop
hlcoord 2, 3
ld de, .SpeciesNameLevel
call PlaceString
ld hl, .PCString_ChooseaPKMN
call PrintText
pop af
ld [wOptions], a
ret
.CurrentBox:
db "ボックス/いまの ボックス@" ; "Box/Current Box"
.SpeciesNameLevel:
db "しゅるい  なまえ   レべル@" ; "Species Name Level"
.PCString_ChooseaPKMN:
text "どの#が みたいねん?" ; "Which would you like to see?"
done
BillsPC_Menu::
ld a, l
ld [wListPointer], a
ld a, h
ld [wListPointer + 1], a
hlcoord 4, 2
ld b, 9
ld c, 14
call DrawTextBox
ld hl, wListPointer
ld a, [hli]
ld h, [hl]
ld l, a
call ScrollingMenu_FromTable
ld a, [wMenuJoypad]
cp B_BUTTON
jr z, .exit
ld hl, .PokemonSelected
call MenuTextBoxBackup
and a
ret
.exit
scf
ret
.PokemonSelected:
text "#を えらんだ!" ; "POKéMON selected!"
prompt
BillsPC_DepositMenu:
dw .MenuHeader
dw wBillsPCCursor
dw wBillsPCScrollPosition
.MenuHeader:
db MENU_BACKUP_TILES
menu_coords 5, 3, 18, 11
dw .MenuData
db 1
.MenuData:
db 0
db 4, 8
db SCROLLINGMENU_ITEMS_NORMAL
dbw 0, wPartyCount
dba PlacePartyMonNicknames
dba PlacePartyMonLevels
ds 3
BillsPC_WithdrawReleaseMenu:
dw .MenuHeader
dw wBillsPCCursor
dw wBillsPCScrollPosition
.MenuHeader:
db MENU_BACKUP_TILES
menu_coords 5, 3, 18, 11
dw .MenuData
db 1
.MenuData:
db 0
db 4, 8
db SCROLLINGMENU_ITEMS_NORMAL
dbw 0, wBoxCount
dba PlaceBoxMonNicknames
dba PlaceBoxMonLevels
ds 3
BillsPC_ViewMenu:
dw BillsPC_ViewMenuHeader
dw wBillsPCCursor
dw wBillsPCScrollPosition
BillsPC_ViewMenuHeader:
db MENU_BACKUP_TILES
menu_coords 1, 4, SCREEN_WIDTH - 1, 11
dw .MenuData
db 1
.MenuData:
db 0
db 4, 0
db SCROLLINGMENU_ITEMS_NORMAL
dbw 0, wBoxCount
dba PlaceDetailedBoxMonView
ds 3
ds 3

554
engine/pokemon/evolve.asm Normal file
View File

@ -0,0 +1,554 @@
INCLUDE "constants.asm"
SECTION "engine/pokemon/evolve.asm", ROMX
EvolvePokemon::
ld hl, wEvolvableFlags
xor a
ld [hl], a
ld a, [wCurPartyMon]
ld c, a
ld b, SET_FLAG
call EvoFlagAction
EvolveAfterBattle::
ldh a, [hMapAnims]
push af
xor a
ld [wMonTriedToEvolve], a
dec a
ld [wCurPartyMon], a
push hl
push bc
push de
ld hl, wPartyCount
push hl
EvolveAfterBattle_MasterLoop:
ld hl, wCurPartyMon
inc [hl]
pop hl
inc hl
ld a, [hl]
cp -1
jp z, .ReturnToMap
ld [wEvolutionOldSpecies], a
push hl
ld a, [wCurPartyMon]
ld c, a
ld hl, wEvolvableFlags
ld b, CHECK_FLAG
call EvoFlagAction
ld a, c
and a
jp z, EvolveAfterBattle_MasterLoop
ld a, [wEvolutionOldSpecies]
dec a
ld b, 0
ld c, a
ld hl, EvosAttacksPointers
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
push hl
xor a
ld [wMonType], a
predef CopyMonToTempMon
pop hl
.loop
ld a, [hli]
and a
jr z, EvolveAfterBattle_MasterLoop
ld b, a
cp EVOLVE_ITEM
jr z, .trade
ld a, [wLinkMode]
and a
jr nz, EvolveAfterBattle_MasterLoop
ld a, b
cp EVOLVE_STONE
jr z, .item
ld a, [wForceEvolution]
and a
jr nz, EvolveAfterBattle_MasterLoop
ld a, b
cp EVOLVE_LEVEL
jr z, .level
; EVOLVE_TRADE
.trade
ld a, [wLinkMode]
and a
jp z, .dont_evolve_1
ld a, [hli]
ld b, a
ld a, [wTempMonLevel]
cp b
jp c, EvolveAfterBattle_MasterLoop
ld a, [hli]
ld b, a
and a
jr z, .proceed
ld a, [wTempMonItem]
cp b
jp nz, EvolveAfterBattle_MasterLoop
jr .proceed
.item
ld a, [hli]
ld b, a
ld a, [wTempMonLevel]
cp b
jp c, .dont_evolve_2
ld a, [hli]
ld b, a
ld a, [wCurItem]
cp b
jp nz, .dont_evolve_3
jr .proceed
.level
ld a, [hli]
ld b, a
ld a, [wTempMonLevel]
cp b
jp c, .dont_evolve_3
.proceed
ld a, [wTempMonLevel]
ld [wCurPartyLevel], a
ld a, 1
ld [wMonTriedToEvolve], a
push hl
ld a, [hl]
ld [wEvolutionNewSpecies], a
ld a, [wCurPartyMon]
ld hl, wPartyMonNicknames
call GetNick
call CopyStringToStringBuffer2
ld hl, EvolvingText
call PrintText
ld c, 50
call DelayFrames
xor a
ldh [hBGMapMode], a
hlcoord 0, 0
lb bc, 12, 20
call ClearBox
ld a, $1
ldh [hBGMapMode], a
call ClearSprites
call EvolutionAnimation
jp c, CancelEvolution
ld hl, CongratulationsYourPokemonText
call PrintText
pop hl
ld a, [hl]
ld [wCurSpecies], a
ld [wTempMonSpecies], a
ld [wEvolutionNewSpecies], a
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
push hl
ld hl, EvolvedIntoText
call PrintTextBoxText
push de
ld de, MUSIC_NONE
call PlayMusic
ld de, SFX_GET_KEY_ITEM_RG
call PlaySFX
call WaitSFX
pop de
ld c, 40
call DelayFrames
call ClearTileMap
call UpdateSpeciesNameIfNotNicknamed
call GetBaseData
ld hl, wTempMonExp + 2
ld de, wTempMonMaxHP
ld b, TRUE
predef CalcMonStats
ld a, [wCurPartyMon]
ld hl, wPartyMons
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld e, l
ld d, h
ld bc, MON_MAXHP
add hl, bc
ld a, [hli]
ld b, a
ld c, [hl]
ld hl, wTempMonMaxHP + 1
ld a, [hld]
sub c
ld c, a
ld a, [hl]
sbc b
ld b, a
ld hl, wTempMonHP + 1
ld a, [hl]
add c
ld [hld], a
ld a, [hl]
adc b
ld [hl], a
ld hl, wTempMonSpecies
ld bc, PARTYMON_STRUCT_LENGTH
call CopyBytes
ld a, [wCurSpecies]
ld [wTempSpecies], a
xor a
ld [wMonType], a
call LearnLevelMoves
ld a, [wBattleMode]
and a
call z, Evolve_ReloadTilesetIfNotLinked
ld a, [wTempSpecies]
dec a
ld c, a
ld b, SET_FLAG
ld hl, wPokedexCaught
push bc
call EvoFlagAction
pop bc
ld hl, wPokedexSeen
call EvoFlagAction
pop de
pop hl
ld a, [wTempMon]
ld [hl], a
push hl
ld l, e
ld h, d
jr .dont_evolve_3
.dont_evolve_1
inc hl
.dont_evolve_2
inc hl
.dont_evolve_3
inc hl
jp .loop
.ReturnToMap:
pop de
pop bc
pop hl
pop af
ldh [hMapAnims], a
ld a, [wLinkMode]
and a
ret nz
ld a, [wBattleMode]
and a
ret nz
ld a, [wMonTriedToEvolve]
and a
call nz, PlayMapMusic
ret
UpdateSpeciesNameIfNotNicknamed:
ld a, [wCurSpecies]
push af
ld a, [wMonHIndex]
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
pop af
ld [wCurSpecies], a
ld hl, wStringBuffer1
ld de, wStringBuffer2
.loop
ld a, [de]
inc de
cp [hl]
inc hl
ret nz
cp "@"
jr nz, .loop
ld a, [wCurPartyMon]
ld bc, MON_NAME_LENGTH
ld hl, wPartyMonNicknames
call AddNTimes
push hl
ld a, [wCurSpecies]
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld hl, wStringBuffer1
pop de
ld bc, MON_NAME_LENGTH
jp CopyBytes
CancelEvolution:
ld hl, StoppedEvolvingText
call PrintText
call ClearTileMap
pop hl
call Evolve_ReloadTilesetIfNotLinked
jp EvolveAfterBattle_MasterLoop
CongratulationsYourPokemonText:
text "おめでとう! @"
text_from_ram wStringBuffer2
text "は"
done
EvolvedIntoText:
text "<LINE>@"
text_from_ram wStringBuffer1
text "に しんかした"
done
StoppedEvolvingText:
text "あれ<⋯⋯>"
line "@"
text_from_ram wStringBuffer2
text "の へんかが とまった!"
prompt
EvolvingText:
text "<⋯⋯> おや!?"
line "@"
text_from_ram wStringBuffer2
text "の ようすが<⋯⋯>"
done
Evolve_ReloadTilesetIfNotLinked:
ld a, [wLinkMode]
and a
ret nz
jp LoadTilesetGFX_LCDOff
LearnLevelMoves::
ld a, [wTempSpecies]
ld [wCurPartySpecies], a
dec a
ld b, 0
ld c, a
ld hl, EvosAttacksPointers
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
.skip_evos
ld a, [hli]
and a
jr nz, .skip_evos
.find_move
ld a, [hli]
and a
jr z, .done
ld b, a
ld a, [wCurPartyLevel]
cp b
ld a, [hli]
jr nz, .find_move
push hl
ld d, a
ld hl, wPartyMon1Moves
ld a, [wCurPartyMon]
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld b, NUM_MOVES
.check_move
ld a, [hli]
cp d
jr z, .has_move
dec b
jr nz, .check_move
jr .learn
.has_move
pop hl
jr .find_move
.learn
ld a, d
ld [wPutativeTMHMMove], a
ld [wNamedObjectIndexBuffer], a
call GetMoveName
call CopyStringToStringBuffer2
predef LearnMove
pop hl
jr .find_move
.done
ld a, [wCurPartySpecies]
ld [wTempSpecies], a
ret
FillMoves:
; Fill in moves at de for wCurPartySpecies at wCurPartyLevel
push hl
push de
push bc
ld hl, EvosAttacksPointers
ld b, 0
ld a, [wCurPartySpecies]
dec a
add a
rl b
ld c, a
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
.GoToAttacks:
ld a, [hli]
and a
jr nz, .GoToAttacks
jr .GetLevel
.NextMove:
pop de
.GetMove:
inc hl
.GetLevel:
ld a, [hli]
and a
jp z, .done
ld b, a
ld a, [wCurPartyLevel]
cp b
jp c, .done
ld a, [wSkipMovesBeforeLevelUp]
and a
jr z, .CheckMove
ld a, [wPrevPartyLevel]
cp b
jr nc, .GetMove
.CheckMove:
push de
ld c, NUM_MOVES
.CheckRepeat:
ld a, [de]
inc de
cp [hl]
jr z, .NextMove
dec c
jr nz, .CheckRepeat
pop de
push de
ld c, NUM_MOVES
.CheckSlot:
ld a, [de]
and a
jr z, .LearnMove
inc de
dec c
jr nz, .CheckSlot
pop de
push de
push hl
ld h, d
ld l, e
call ShiftMoves
ld a, [wEvolutionOldSpecies]
and a
jr z, .ShiftedMove
push de
ld bc, wPartyMon1PP - (wPartyMon1Moves + NUM_MOVES - 1)
add hl, bc
ld d, h
ld e, l
call ShiftMoves
pop de
.ShiftedMove:
pop hl
.LearnMove:
ld a, [hl]
ld [de], a
ld a, [wEvolutionOldSpecies]
and a
jr z, .NextMove
push hl
ld a, [hl]
ld hl, MON_PP - MON_MOVES
add hl, de
push hl
dec a
ld hl, Moves + MOVE_PP
ld bc, MOVE_LENGTH
call AddNTimes
ld a, BANK(Moves)
call GetFarByte
pop hl
ld [hl], a
pop hl
jr .NextMove
.done
pop bc
pop de
pop hl
ret
ShiftMoves:
ld c, NUM_MOVES - 1
.loop
inc de
ld a, [de]
ld [hli], a
dec c
jr nz, .loop
ret
EvoFlagAction:
push de
ld d, $0
predef SmallFarFlagAction
pop de
ret
INCLUDE "engine/movie/evolution_animation.inc"

View File

@ -0,0 +1,131 @@
INCLUDE "constants.asm"
SECTION "engine/pokemon/knows_move.asm", ROMX
KnowsMove:
ld a, MON_MOVES
call GetPartyParamLocation
ld a, [wPutativeTMHMMove]
ld b, a
ld c, NUM_MOVES
.loop
ld a, [hli]
cp b
jr z, .knows_move
dec c
jr nz, .loop
and a
ret
.knows_move
ld hl, KnowsMoveText
call PrintText
scf
ret
KnowsMoveText:
text_from_ram wStringBuffer1
text "は すでに"
line "@"
text_from_ram wStringBuffer2
text "を おぼえています"
prompt
Bank03_FillerStart::
Unreferenced_BootedHMTextfde0:
db "います"
prompt
; This is missing the preceeding "text_from_ram" byte
dw wStringBuffer2
text "を おぼえています"
prompt
db $28, $3c
Unreferenced_KnowsMoveText_Old:
ld a, [wPutativeTMHMMove]
ld b, a
ld c, NUM_MOVES
.loop
ld a, [hli]
cp b
jr z, .knows_move
dec c
jr nz, .loop
and a
ret
.knows_move
ld hl, .KnowsMoveText
call PrintText
scf
ret
.KnowsMoveText
text_from_ram wStringBuffer1
text "は すでに"
line "@"
text_from_ram wStringBuffer2
text "を おぼえています"
prompt
Unreferenced_Fillerfe23:
db $e0, $22, $47, $24, $80, $a3, $01, $50
db $02, $85, $b0, $09, $35, $51, $2c, $08
db $24, $25, $0b, $84, $84, $00, $4e, $3b
db $4b, $02, $60, $2a, $26, $21, $01, $40
db $10, $1f, $31, $44, $80, $08, $02, $3c
db $41, $00, $68, $49, $57, $41, $94, $00
db $34, $36, $9c, $e4, $01, $0c, $60, $01
db $81, $23, $a2, $26, $43, $05, $81, $5f
db $16, $a2, $80, $34, $0c, $82, $63, $91
db $44, $52, $02, $ce, $00, $10, $44, $01
db $96, $0e, $ac, $10, $23, $84, $28, $00
db $22, $45, $22, $55, $00, $ef, $ff, $77
db $5b, $fe, $87, $db, $df, $b5, $bf, $d7
db $1f, $d9, $fc, $e9, $fd, $df, $79, $96
db $7d, $af, $d7, $5e, $17, $37, $e7, $ef
db $3e, $ff, $f9, $d4, $7d, $bf, $fb, $df
db $bb, $fe, $db, $53, $fb, $cc, $d3, $fe
db $92, $7f, $bb, $bc, $d7, $3b, $dd, $6f
db $7b, $2f, $b7, $ff, $b9, $d0, $b7, $e5
db $7b, $e0, $c7, $bf, $dd, $df, $6d, $bb
db $f6, $f7, $73, $f9, $ff, $bc, $bb, $f7
db $fd, $bd, $db, $e7, $be, $7b, $35, $5b
db $f3, $98, $df, $f4, $2f, $fb, $ff, $6b
db $fe, $ef, $6b, $ec, $1f, $7a, $3e, $ea
db $9b, $dd, $df, $ed, $ff, $fe, $bf, $26
db $7d, $9e, $ef, $be, $ff, $77, $fb, $ff
db $ff, $5e, $f2, $bc, $fd, $7a, $aa, $fa
db $af, $9d, $ed, $f1, $fd, $10, $10, $2d
db $d1, $00, $21, $14, $d3, $1b, $27, $22
db $85, $45, $5a, $43, $0c, $b1, $74, $61
db $48, $40, $2f, $8c, $84, $08, $c2, $90
db $f7, $44, $45, $80, $90, $12, $c5, $93
db $1c, $11, $6e, $c8, $26, $25, $c1, $25
db $00, $1e, $55, $02, $54, $04, $0f, $10
db $20, $d7, $a2, $3c, $04, $3b, $02, $01
db $22, $00, $c0, $00, $13, $d2, $05, $02
db $48, $2a, $89, $40, $1f, $3e, $44, $12
db $40, $16, $d8, $91, $10, $01, $54, $87
db $1f, $99, $40, $d0, $79, $f8, $25, $4c
db $d0, $a0, $02, $13, $1c, $02, $03, $11
db $a0, $19, $06, $0e, $70, $97, $44, $0e
db $11, $24, $0f, $80, $60, $06, $09, $01
db $c5, $e1, $30, $13, $15, $14, $59, $02
db $4c, $a9, $11, $08, $04, $eb, $df, $9d
db $55, $ff, $b7, $57, $fb, $78, $7e, $7e
db $c7, $3a, $e1, $ff, $5f, $7d, $5f, $fd
db $5f, $f8, $6d, $2f, $bd, $75, $6f, $3f
db $ff, $9f, $fc, $b5, $f6, $c5, $14, $fa
db $d9, $ff, $9d, $fb, $7f, $f3, $ff, $6b
db $fb, $9f, $eb, $5f, $df, $de, $ed, $bf
db $7f, $59, $26, $df, $ee, $b3, $5f, $fd
db $f7, $ff, $ff, $ff, $5b, $f8, $db, $fa
db $7f, $de, $af, $5f, $df, $9f, $d8, $be
db $ea, $bf, $fe, $eb, $dd, $eb, $f9, $e5
db $bd, $f3, $ff, $fe, $ff, $f7, $f7, $d5
db $f5, $f9, $5f, $bf, $fd, $5e, $df, $de
db $ff, $bf, $bb, $93, $fc, $ff, $cc, $af
db $f5, $d7, $7f, $ff, $fe, $b5, $ff, $9f
db $95, $7a, $6b, $7b, $ff, $6f, $bb, $c7
db $ef, $34, $ff, $d7, $3d

View File

@ -121,7 +121,7 @@ ForgetMove::
call PrintText
hlcoord 10, 8
ld b, NUM_MOVES * 2
ld c, MOVE_NAME_LENGTH + 3
ld c, MOVE_NAME_LENGTH
call DrawTextBox
hlcoord 12, 10
ld a, SCREEN_WIDTH * 2
@ -147,7 +147,7 @@ ForgetMove::
ld [w2DMenuFlags2], a
ld a, $20
ld [w2DMenuCursorOffsets], a
call Get2DMenuJoypad
call StaticMenuJoypad
push af
call ReloadTilesFromBuffer
pop af

View File

@ -0,0 +1,290 @@
INCLUDE "constants.asm"
SECTION "engine/pokemon/mon_submenu.asm", ROMX
INCLUDE "data/mon_menu.inc"
MonSubmenu::
xor a
ldh [hBGMapMode], a
call GetMonSubmenuItems
callfar FreezeMonIcons
ld hl, .MenuHeader
call LoadMenuHeader
call .GetTopCoord
call PopulateMonMenu
ld a, 1
ldh [hBGMapMode], a
call MonMenuLoop
ld [wMenuSelection], a
call CloseWindow
ret
.MenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 11, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
dw 0
db 1 ; default option
.GetTopCoord:
; [wMenuBorderTopCoord] = 1 + [wMenuBorderBottomCoord] - 2 * ([wMonSubmenuCount] + 1)
ld a, [wMonSubmenuCount]
inc a
add a
ld b, a
ld a, [wMenuBorderBottomCoord]
sub b
inc a
ld [wMenuBorderTopCoord], a
call MenuBox
ret
MonMenuLoop:
.loop
ld a, MENU_UNUSED | MENU_BACKUP_TILES_2
ld [wMenuDataFlags], a
ld a, [wMonSubmenuCount]
ld [wMenuDataItems], a
call InitVerticalMenuCursor
ld hl, w2DMenuFlags1
set _2DMENU_ENABLE_SPRITE_ANIMS_F, [hl]
call StaticMenuJoypad
ldh a, [hJoyDown]
bit A_BUTTON_F, a
jr nz, .select
bit B_BUTTON_F, a
jr nz, .cancel
jr .loop
.cancel
ld a, MONMENUITEM_CANCEL
ret
.select
ld a, [wMenuCursorY]
dec a
ld c, a
ld b, 0
ld hl, wMonSubmenuItems
add hl, bc
ld a, [hl]
ret
PopulateMonMenu:
call MenuBoxCoord2Tile
ld bc, 2 * SCREEN_WIDTH + 2
add hl, bc
ld de, wMonSubmenuItems
.loop
ld a, [de]
inc de
cp -1
ret z
push de
push hl
call GetMonMenuString
pop hl
call PlaceString
ld bc, 2 * SCREEN_WIDTH
add hl, bc
pop de
jr .loop
GetMonMenuString:
dec a
ld b, a
add a
add b
ld c, a
ld b, 0
ld hl, MonMenuOptions
add hl, bc
ld a, [hli]
and a ; if MONMENU_MENUOPTION
jr z, .NotMove
inc hl
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
call GetMoveName
ret
.NotMove:
inc hl
ld a, [hl]
dec a
ld hl, MonMenuOptionStrings
call GetNthString
ld d, h
ld e, l
ret
GetMonSubmenuItems:
call ResetMonSubmenu
ld a, MON_MOVES
call GetPartyParamLocation
ld d, h
ld e, l
ld hl, wMonSubmenuItems
ld c, NUM_MOVES
.loop
push bc
push de
ld a, [de]
and a ; no move in this slot
jr z, .next
push hl
call IsFieldMove
pop hl
jr nc, .next
call AddMonMenuItem
.next
pop de
inc de
pop bc
dec c
jr nz, .loop
ld a, MONMENUITEM_STATS
call AddMonMenuItem
ld a, MONMENUITEM_SWITCH
call AddMonMenuItem
ld a, MONMENUITEM_MOVE
call AddMonMenuItem
push hl
ld a, MON_ITEM
call GetPartyParamLocation
ld a, [hl]
pop hl
cp ITEM_MAIL
ld a, MONMENUITEM_ITEM
jr nz, .notmail
ld a, MONMENUITEM_MAIL
.notmail
call AddMonMenuItem
ld a, [wMonSubmenuCount]
cp NUM_MONMENU_ITEMS
jr z, .maxitems
ld a, MONMENUITEM_CANCEL
call AddMonMenuItem
.maxitems
call TerminateMonSubmenu
ret
IsFieldMove:
ld b, a
ld hl, MonMenuOptions
.next
ld a, [hli]
cp -1
jr z, .nope
and a ; MONMENU_MENUOPTION
jr z, .nope
ld d, [hl]
inc hl
ld a, [hli]
cp b
jr nz, .next
ld a, d
scf
.nope
ret
ResetMonSubmenu:
xor a
ld [wMonSubmenuCount], a
ld hl, wMonSubmenuItems
ld bc, NUM_MONMENU_ITEMS + 1
call ByteFill
ret
TerminateMonSubmenu:
ld a, [wMonSubmenuCount]
ld e, a
ld d, 0
ld hl, wMonSubmenuItems
add hl, de
ld [hl], -1
ret
AddMonMenuItem:
push hl
push de
push af
ld a, [wMonSubmenuCount]
ld e, a
inc a
ld [wMonSubmenuCount], a
ld d, 0
ld hl, wMonSubmenuItems
add hl, de
pop af
ld [hl], a
pop de
pop hl
ret
BattleMonMenu:
ld hl, .MenuHeader
call CopyMenuHeader
xor a
ldh [hBGMapMode], a
call MenuBox
call UpdateSprites
call PlaceVerticalMenuItems
call WaitBGMap
ld hl, wMenuDataPointer
ld a, [hli]
ld h, [hl]
ld l, a
ld de, wMenuData
ld bc, wMenuDataEnd - wMenuData
call CopyBytes
ld a, [wMenuDataFlags]
bit STATICMENU_CURSOR_F, a
jr z, .set_carry
call InitVerticalMenuCursor
ld hl, w2DMenuFlags1
set _2DMENU_ENABLE_SPRITE_ANIMS_F, [hl]
call StaticMenuJoypad
bit B_BUTTON_F, a
jr z, .clear_carry
ret z
.set_carry
scf
ret
.clear_carry
and a
ret
; Unreferenced.
ret
.MenuHeader:
db 0 ; flags
menu_coords 11, 11, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
dw .MenuText
db 1 ; default option
.MenuText:
db (STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING)
db 3
db "とりかえる@" ; Switch
db "つよさをみる@" ; Stats
db "キャンセル@" ; Cancel

1503
engine/pokemon/move_mon.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
INCLUDE "constants.asm"
SECTION "engine/pokemon/print_move_description.asm", ROMX
PrintMoveDescription::
push hl
ld hl, MoveDescriptions
ld a, [wSelectedItem]
dec a
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld a, [hli]
ld e, a
ld d, [hl]
pop hl
jp PlaceString
INCLUDE "data/moves/descriptions.inc"

View File

@ -52,7 +52,7 @@ DoSpriteAnimFrame:
dw AnimSeq_TradePokeBall
dw AnimSeq_TradeTubeBulge
dw AnimSeq_TrademonInTube
dw AnimSeq_Unknown
dw AnimSeq_RevealNewMon
dw AnimSeq_RadioFrequencyMeter
AnimSeq_Null:
@ -1283,9 +1283,8 @@ AnimSeq_TrademonInTube:
callfar TradeAnim_AnimateTrademonInTube
ret
; Appears to resemble the final game's AnimSeq_RevealNewMon, but it doesn't seem to be used in this build...
; Who knows what it was used for?
AnimSeq_Unknown:
; Unused in this build. See EvolutionAnimation.PlayEvolvedSFX.
AnimSeq_RevealNewMon:
ld hl, SPRITEANIMSTRUCT_VAR1
add hl, bc
ld a, [hl]
@ -1298,6 +1297,7 @@ AnimSeq_Unknown:
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
push af
push de
call AnimSeqs_Sine
@ -1305,6 +1305,7 @@ AnimSeq_Unknown:
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
pop de
pop af
call AnimSeqs_Cosine

View File

@ -9,7 +9,7 @@ Function1130b:
ld a, [wPartyCount]
cp PARTY_LENGTH
jr c, .bigjump
ld a, [wBoxListLength]
ld a, [wBoxCount]
cp MONS_PER_BOX
jr nc, .fullbox
xor a
@ -18,7 +18,7 @@ Function1130b:
ld [wTempEnemyMonSpecies], a
callfar LoadEnemyMon
call RecievePokemon
predef Functiondd5c
predef SendMonIntoBox
and $7F
add a, $F7
ld hl, wStringBuffer2
@ -35,7 +35,7 @@ Function1130b:
ret
.bigjump
call RecievePokemon
predef Functiond886
predef TryAddMonToParty
scf
ret
@ -46,7 +46,7 @@ RecievePokemon:
dec a
ld c, a
ld hl, wPokedexCaught
ld b, 01 ;SET_FLAG
ld b, SET_FLAG
predef SmallFarFlagAction
pop af
ld [wNamedObjectIndexBuffer], a
@ -57,20 +57,18 @@ RecievePokemon:
RecievePokemonText:
text "<PLAYER>は"
line "@"
db $01, $26, $CD
text_from_ram wStringBuffer1
text "を てにいれた!@"
db $0B, "@"
sound_dex_fanfare_50_79
db "@"
BoxCantHoldText:
text "#を もちきれないので"
line "<PC>の ボックス@"
db $01, $31, $CD
text_from_ram wStringBuffer2
text " に"
cont "@"
db $01, $17, $DF
text_from_ram wBoxMonNicknames
text "を てんそうした!"
done

BIN
gfx/evo/bubbles.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

View File

@ -4,7 +4,7 @@ SECTION "gfx.asm@Mon Nest Icon", ROMX
PokedexNestIconGFX::
INCBIN "gfx/trainer_gear/dexmap_nest_icon.1bpp"
SECTION "gfx.asm@Bank 2 Misc GFX", ROMX
SECTION "gfx.asm@Minor Object GFX", ROMX
UnknownBouncingOrbGFX:: INCBIN "gfx/overworld/gfx_84bf.2bpp"
.end:
JumpShadowGFX:: INCBIN "gfx/overworld/shadow.2bpp"

View File

@ -49,3 +49,5 @@ $(BUILD)/gfx/battle_anims/reflect.2bpp: tools/gfx += --remove-whitespace
$(BUILD)/gfx/battle_anims/rocks.2bpp: tools/gfx += --remove-whitespace
$(BUILD)/gfx/battle_anims/skyattack.2bpp: tools/gfx += --remove-whitespace
$(BUILD)/gfx/battle_anims/status.2bpp: tools/gfx += --remove-whitespace
$(BUILD)/gfx/evo/bubbles.2bpp: tools/gfx += --remove-xflip --remove-yflip --remove-whitespace

View File

@ -21,19 +21,20 @@ CallJumptable::
ld l, a
jp hl
CallFar_atHL::
; CallFar_atHL
; Call the function pointed to by
; the 3-byte pointer at hl
; Clobbers: a, hl
; Call the function pointed to by the 3-byte pointer at hl.
; Clobbers: a, hl.
CallPointerAt::
ldh a, [hROMBank]
push af
ld a, [hli]
call Bankswitch
ld a, [hli]
ld h, [hl]
ld l, a
call ._hl_
pop hl
ld a, h
call Bankswitch

View File

@ -1204,7 +1204,7 @@ ApplyFlashlight::
.no_flashlight
ld de, wTileMap
ld b, SCREEN_HEIGHT ; TODO: constantify this
ld b, SCREEN_HEIGHT
.row
ld c, SCREEN_WIDTH
.tile
@ -1692,9 +1692,9 @@ Function2ba8::
call Bankswitch
call HandleNPCStep
call LoadMinorObjectGFX
ld a, BANK(Functiond6e4)
ld a, BANK(_HandlePlayerStep)
call Bankswitch
call Functiond6e4
call _HandlePlayerStep
ld a, BANK(InitSprites)
call Bankswitch
call InitSprites

View File

@ -56,18 +56,18 @@ VerticalMenu::
call PlaceVerticalMenuItems
call WaitBGMap
call CopyMenuData
ld a, [wMenuData2]
bit 7, a
jr z, .asm_1daa
ld a, [wMenuData]
bit STATICMENU_CURSOR_F, a
jr z, .cancel
call InitVerticalMenuCursor
call Get2DMenuJoypad
bit 1, a
jr z, .asm_1dac
.asm_1daa:
call StaticMenuJoypad
bit B_BUTTON_F, a
jr z, .okay
.cancel
scf
ret
.asm_1dac:
.okay
and a
ret
@ -102,6 +102,7 @@ YesNoBox::
PlaceYesNoBox::
jr _YesNoBox
; Unreferenced?
PlaceGenericTwoOptionBox::
call LoadMenuHeader
jr InterpretTwoOptionMenu
@ -169,7 +170,6 @@ _OffsetMenuHeader::
ld h, a
ld a, [wMenuBorderRightCoord]
sub h
.asm_1e3d:
ld h, a
ld a, d
ld [wMenuBorderLeftCoord], a
@ -190,11 +190,11 @@ OpenMenu::
call CopyMenuData
call GetMenuIndexSet
push de
ld a, [wMenuCursorBuffer]
ld a, [wMenuCursorPosition]
push af
call Function1e8a
call .ExitMenu_NoPoppingError
pop af
ld [wMenuCursorBuffer], a
ld [wMenuCursorPosition], a
call AutomaticGetMenuBottomCoord
call PushWindow
call MenuBox
@ -202,17 +202,19 @@ OpenMenu::
call GetMenuIndexSet
push de
call RunMenuItemPrintingFunction
ld a, $1
ld a, 1
ldh [hBGMapMode], a
call UpdateSprites
call GetMenuIndexSet
pop de
call Function1f27
call GetStaticMenuJoypad
ret
Function1e8a::
; Unlike _ExitMenu, there is no error for trying to pop a window when none are available.
.ExitMenu_NoPoppingError:
xor a
ldh [hBGMapMode], a
xor a
call OpenSRAM
call GetWindowStackTop
@ -251,29 +253,31 @@ GetMenuIndexSet::
ld l, a
ld a, [wWhichIndexSet]
and a
jr z, .asm_1ed9
jr z, .skip
ld b, a
ld c, -1
.asm_1ed2:
.loop
ld a, [hli]
cp c
jr nz, .asm_1ed2
jr nz, .loop
dec b
jr nz, .asm_1ed2
.asm_1ed9:
jr nz, .loop
.skip
ld d, h
ld e, l
inc hl
ld c, $ff
.asm_1ede:
ld c, -1
.not_terminator
inc c
ld a, [hli]
cp $ff
jr nz, .asm_1ede
cp -1
jr nz, .not_terminator
ld a, c
ld [wMenuDataItems], a
ret
; Unreferenced?
Function1ee9::
call MenuBoxCoord2Tile
call GetMenuBoxDims
@ -297,7 +301,7 @@ RunMenuItemPrintingFunction::
call MenuBoxCoord2Tile
ld bc, 2 * SCREEN_WIDTH + 2
add hl, bc
.asm_1f09:
.loop
inc de
ld a, [de]
cp -1
@ -313,70 +317,72 @@ RunMenuItemPrintingFunction::
ld de, 2 * SCREEN_WIDTH
add hl, de
pop de
jr .asm_1f09
jr .loop
._hl_:
._hl_
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
Function1f27::
; Combines Crystal functions "InitMenuCursorAndButtonPermissions" and "GetStaticMenuJoypad"
; Combines pokegold functions "InitMenuCursorAndButtonPermissions" and "GetStaticMenuJoypad".
GetStaticMenuJoypad::
push de
call InitVerticalMenuCursor
ld hl, wMenuJoypadFilter
ld a, [wMenuData2]
bit 3, a
jr z, .asm_1f37
set 3, [hl]
.asm_1f37:
bit 2, a
jr z, .asm_1f3f
ld a, [wMenuDataFlags]
bit STATICMENU_ENABLE_START_F, a
jr z, .disallow_start
set START_F, [hl]
.disallow_start
bit STATICMENU_ENABLE_LEFT_RIGHT_F, a
jr z, .disallow_left_right
ld a, [hl]
or D_LEFT | D_RIGHT
ld [hl], a
.asm_1f3f:
call Get2DMenuJoypad
.disallow_left_right:
call StaticMenuJoypad
pop de
bit 0, a
jr nz, .asm_1f66
bit 1, a
jr nz, .asm_1f7e
bit 3, a
jr nz, .asm_1f7e
bit 4, a
jr nz, .asm_1f58
bit 5, a
jr nz, .asm_1f5f
bit A_BUTTON_F, a
jr nz, .a_pressed
bit B_BUTTON_F, a
jr nz, .b_start_pressed
bit START_F, a
jr nz, .b_start_pressed
bit D_RIGHT_F, a
jr nz, .right_pressed
bit D_LEFT_F, a
jr nz, .left_pressed
ret
.asm_1f58:
.right_pressed
ld a, D_RIGHT
ld [wMenuJoypad], a
jr .asm_1f6b
jr .move_cursor
.asm_1f5f:
.left_pressed
ld a, D_LEFT
ld [wMenuJoypad], a
jr .asm_1f6b
jr .move_cursor
.asm_1f66:
.a_pressed
ld a, A_BUTTON
ld [wMenuJoypad], a
.asm_1f6b:
.move_cursor
ld a, [wMenuCursorY]
ld l, a
ld h, $0
ld h, 0
add hl, de
ld a, [hl]
ld [wMenuSelection], a
ld a, [wMenuCursorY]
ld [wMenuCursorBuffer], a
ld [wMenuCursorPosition], a
and a
ret
.asm_1f7e:
.b_start_pressed
ld a, B_BUTTON
ld [wMenuJoypad], a
ld a, -1
@ -400,19 +406,19 @@ PlaceMenuStrings::
ClearWindowData::
ld hl, wWindowStackPointer
call .clear
call .ClearMenuData
ld hl, wMenuDataHeader
call .clear
ld hl, wMenuData2
call .clear
ld hl, wMenuData3
call .clear
call .ClearMenuData
ld hl, wMenuData
call .ClearMenuData
ld hl, wMoreMenuData
call .ClearMenuData
xor a
call OpenSRAM
xor a
ld hl, sWindowStackTop + 1
ld hl, sWindowStackTop
ld [hld], a
ld [hld], a
ld a, l
@ -423,7 +429,7 @@ ClearWindowData::
call CloseSRAM
ret
.clear:
.ClearMenuData:
ld bc, wMenuDataHeaderEnd - wMenuDataHeader
xor a
call ByteFill

View File

@ -5,72 +5,77 @@ SECTION "home/menu_window.asm", ROM0
SetMenuAttributes::
push hl
push bc
ld hl, wMenuData3
ld b, $8
.asm_1a6b:
ld hl, wMoreMenuData
ld b, w2DMenuDataEnd - wMoreMenuData
.loop
ld a, [de]
inc de
ld [hli], a
dec b
jr nz, .asm_1a6b
ld a, $1
ld [hli], a
ld [hli], a
jr nz, .loop
ld a, 1
ld [hli], a ; wMenuCursorY
ld [hli], a ; wMenuCursorX
xor a
ld [hli], a
ld [hli], a
ld [hli], a ; wCursorOffCharacter
ld [hli], a ; wCursorCurrentTile
ld [hli], a
pop bc
pop hl
ret
Get2DMenuJoypad::
StaticMenuJoypad::
call Place2DMenuCursor
Get2DMenuJoypad_NoPlaceCursor::
ScrollingMenuJoypad::
ld hl, w2DMenuFlags2
res 7, [hl]
.loop:
res _2DMENU_DISABLE_JOYPAD_FILTER_F, [hl]
.menu_joypad_loop
call Move2DMenuCursor
call WaitBGMap
.asm_1a8a:
.loopRTC
call UpdateTime
call UpdateTimeOfDayPalettes
call Menu_WasButtonPressed
jr c, .asm_1a9f
jr c, .pressed
ld a, [w2DMenuFlags1]
bit 7, a
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, a
jp nz, .done
jr .asm_1a8a
jr .loopRTC
.asm_1a9f:
.pressed
call _2DMenuInterpretJoypad
jp c, .done
ld a, [w2DMenuFlags1]
bit 7, a
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, a
jr nz, .done
ldh a, [hJoySum]
ld b, a
ld a, [wMenuJoypadFilter]
and b
jp z, .loop
.done:
jp z, .menu_joypad_loop
.done
ldh a, [hJoyDown]
and A_BUTTON | B_BUTTON
jr z, .asm_1ac4
jr z, .a_b_not_pressed
push de
ld de, SE_SELECT
call PlaySFX
pop de
.asm_1ac4:
.a_b_not_pressed
ldh a, [hJoySum]
ret
Menu_WasButtonPressed::
ld a, [w2DMenuFlags1]
bit 6, a
jr z, .asm_1ad6
bit _2DMENU_ENABLE_SPRITE_ANIMS_F, a
jr z, .skip_to_joypad
farcall PlaySpriteAnimationsAndDelayFrame
.asm_1ad6:
.skip_to_joypad
call GetJoypadDebounced
ldh a, [hJoySum]
and a
@ -81,125 +86,125 @@ Menu_WasButtonPressed::
_2DMenuInterpretJoypad::
ldh a, [hJoySum]
bit A_BUTTON_F, a
jp nz, .PressedABStartOrSelect
jp nz, .a_b_start_select
bit B_BUTTON_F, a
jp nz, .PressedABStartOrSelect
jp nz, .a_b_start_select
bit SELECT_F, a
jp nz, .PressedABStartOrSelect
jp nz, .a_b_start_select
bit START_F, a
jp nz, .PressedABStartOrSelect
jp nz, .a_b_start_select
bit D_RIGHT_F, a
jr nz, .PressedRight
jr nz, .d_right
bit D_LEFT_F, a
jr nz, .PressedLeft
jr nz, .d_left
bit D_UP_F, a
jr nz, .PressedUp
jr nz, .d_up
bit D_DOWN_F, a
jr nz, .PressedDown
jr nz, .d_down
and a
ret
.SetFlag15AndCarry:
.set_bit_7
ld hl, w2DMenuFlags2
set 7, [hl]
set _2DMENU_EXITING_F, [hl]
scf
ret
.PressedDown:
.d_down
ld hl, wMenuCursorY
ld a, [w2DMenuNumRows]
cp [hl]
jr z, .asm_1b1a
jr z, .check_wrap_around_down
inc [hl]
xor a
ret
.asm_1b1a:
.check_wrap_around_down
ld a, [w2DMenuFlags1]
bit 5, a
jr nz, .asm_1b28
bit 3, a
jp nz, .SetFlag15AndCarry
bit _2DMENU_WRAP_UP_DOWN_F, a
jr nz, .wrap_around_down
bit _2DMENU_EXIT_DOWN_F, a
jp nz, .set_bit_7
xor a
ret
.asm_1b28:
.wrap_around_down
ld [hl], $1
xor a
ret
.PressedUp:
.d_up
ld hl, wMenuCursorY
ld a, [hl]
dec a
jr z, .asm_1b36
jr z, .check_wrap_around_up
ld [hl], a
xor a
ret
.asm_1b36:
.check_wrap_around_up
ld a, [w2DMenuFlags1]
bit 5, a
jr nz, .asm_1b44
bit 2, a
jp nz, .SetFlag15AndCarry
bit _2DMENU_WRAP_UP_DOWN_F, a
jr nz, .wrap_around_up
bit _2DMENU_EXIT_UP_F, a
jp nz, .set_bit_7
xor a
ret
.asm_1b44:
.wrap_around_up
ld a, [w2DMenuNumRows]
ld [hl], a
xor a
ret
.PressedLeft:
.d_left
ld hl, wMenuCursorX
ld a, [hl]
dec a
jr z, .asm_1b54
jr z, .check_wrap_around_left
ld [hl], a
xor a
ret
.asm_1b54:
.check_wrap_around_left
ld a, [w2DMenuFlags1]
bit 4, a
jr nz, .asm_1b62
bit 1, a
jp nz, .SetFlag15AndCarry
bit _2DMENU_WRAP_LEFT_RIGHT_F, a
jr nz, .wrap_around_left
bit _2DMENU_EXIT_LEFT_F, a
jp nz, .set_bit_7
xor a
ret
.asm_1b62:
.wrap_around_left
ld a, [w2DMenuNumCols]
ld [hl], a
xor a
ret
.PressedRight:
.d_right
ld hl, wMenuCursorX
ld a, [w2DMenuNumCols]
cp [hl]
jr z, .asm_1b74
jr z, .check_wrap_around_right
inc [hl]
xor a
ret
.asm_1b74:
.check_wrap_around_right
ld a, [w2DMenuFlags1]
bit 4, a
jr nz, .asm_1b82
bit 0, a
jp nz, .SetFlag15AndCarry
bit _2DMENU_WRAP_LEFT_RIGHT_F, a
jr nz, .wrap_around_right
bit _2DMENU_EXIT_RIGHT_F, a
jp nz, .set_bit_7
xor a
ret
.asm_1b82:
.wrap_around_right
ld [hl], $1
xor a
ret
.PressedABStartOrSelect:
.a_b_start_select
xor a
ret
@ -209,7 +214,7 @@ Move2DMenuCursor::
ld h, [hl]
ld l, a
ld a, [hl]
cp $ed
cp "▶"
jr nz, Place2DMenuCursor
ld a, [wCursorOffCharacter]
ld [hl], a
@ -227,12 +232,13 @@ Place2DMenuCursor::
ld b, a
xor a
dec b
jr z, .asm_1bb6
.asm_1bb2:
jr z, .got_row
.row_loop
add c
dec b
jr nz, .asm_1bb2
.asm_1bb6:
jr nz, .row_loop
.got_row
ld c, SCREEN_WIDTH
call AddNTimes
ld a, [w2DMenuCursorOffsets]
@ -242,20 +248,22 @@ Place2DMenuCursor::
ld b, a
xor a
dec b
jr z, .asm_1bcd
.asm_1bc9:
jr z, .got_col
.col_loop
add c
dec b
jr nz, .asm_1bc9
.asm_1bcd:
jr nz, .col_loop
.got_col
ld c, a
add hl, bc
ld a, [hl]
cp $ed
jr z, .asm_1bd9
cp "▶"
jr z, .cursor_on
ld [wCursorOffCharacter], a
ld [hl], $ed
.asm_1bd9:
ld [hl], "▶"
.cursor_on
ld a, l
ld [wCursorCurrentTile], a
ld a, h
@ -267,7 +275,7 @@ PlaceHollowCursor::
ld a, [hli]
ld h, [hl]
ld l, a
ld [hl], $ec
ld [hl], "▷"
ret
HideCursor::
@ -275,31 +283,29 @@ HideCursor::
ld a, [hli]
ld h, [hl]
ld l, a
ld [hl], $7f
ld [hl], " "
ret
PushWindow::
ld hl, PlaceWaitingText
ld a, $9
jp FarCall_hl
jpfar _PushWindow
ExitMenu::
push af
callfar _ExitMenu
call Function1c0a
call .ResetBGMap
pop af
ret
Function1c0a::
.ResetBGMap:
ld a, [wStateFlags]
bit SPRITE_UPDATES_DISABLED_F, a
ret z
xor a
xor a ; BANK(sScratch)
call OpenSRAM
hlcoord 0, 0
ld de, sSpriteBuffer0
ld bc, $168
ld de, sScratch
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
call CloseSRAM
@ -307,23 +313,22 @@ Function1c0a::
xor a
call OpenSRAM
ld hl, sSpriteBuffer0
ld hl, sScratch
decoord 0, 0
ld bc, $168
.asm_1c33:
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
.copy_loop
ld a, [hl]
cp $61
jr c, .asm_1c39
cp "▲"
jr c, .skip
ld [de], a
.asm_1c39:
.skip
inc hl
inc de
dec bc
ld a, c
or b
jr nz, .asm_1c33
jr nz, .copy_loop
call CloseSRAM
ret
InitVerticalMenuCursor::
@ -337,40 +342,42 @@ CloseWindow::
pop af
ret
Function1c58::
jpfar Function24185
; Unreferenced.
ExitAllMenus::
jpfar _ExitAllMenus
RestoreTileBackup::
call MenuBoxCoord2Tile
call GetMenuBoxDims
inc b
inc c
.asm_1c68:
.row
push bc
push hl
.asm_1c6a:
.col
ld a, [de]
ld [hli], a
dec de
dec c
jr nz, .asm_1c6a
jr nz, .col
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
jr nz, .asm_1c68
jr nz, .row
ret
PopWindow::
ld b, $10
ld b, wMenuDataHeaderEnd - wMenuDataHeader
ld de, wMenuDataHeader
.asm_1c7f:
.loop
ld a, [hld]
ld [de], a
inc de
dec b
jr nz, .asm_1c7f
jr nz, .loop
ret
GetMenuBoxDims::
@ -399,7 +406,7 @@ CopyMenuData::
ld h, [hl]
ld l, a
ld de, wMenuDataFlags
ld bc, $10
ld bc, wMenuDataHeaderEnd - wMenuDataHeader
call CopyBytes
pop af
pop bc
@ -430,7 +437,7 @@ PlaceVerticalMenuItems::
ld a, [de]
inc de
ld b, a
.asm_1ccc:
.loop
push bc
call PlaceString
inc de
@ -438,17 +445,17 @@ PlaceVerticalMenuItems::
add hl, bc
pop bc
dec b
jr nz, .asm_1ccc
jr nz, .loop
ld a, [wMenuDataFlags]
bit 4, a
bit STATICMENU_PLACE_TITLE_F, a
ret z
call MenuBoxCoord2Tile
ld a, [de]
ld c, a
inc de
ld b, $0
ld b, 0
add hl, bc
jp PlaceString
@ -466,16 +473,20 @@ GetMenuTextStartCoord::
ld a, [wMenuBorderLeftCoord]
ld c, a
inc c
; if not set, leave extra room on top
ld a, [wMenuDataFlags]
bit 6, a
jr nz, .asm_1d08
bit STATICMENU_NO_TOP_SPACING_F, a
jr nz, .no_top_spacing
inc b
.asm_1d08
.no_top_spacing
; if set, leave extra room on the left
ld a, [wMenuDataFlags]
bit 7, a
jr z, .done
bit STATICMENU_CURSOR_F, a
jr z, .no_cursor
inc c
.done
.no_cursor
ret
ClearMenuBoxInterior::

View File

@ -8,7 +8,7 @@ Function32c8::
and a
ret
Function32d0::
GetTerminatingString::
ld hl, .EmptyString
ret

View File

@ -15,8 +15,8 @@ GetPartyParamLocation::
pop bc
ret
UseItem::
farjp _UseItem
DoItemEffect::
farjp _DoItemEffect
CheckTossableItem::
push hl

View File

@ -39,7 +39,7 @@ CheckStartmenuSelectHook:
Function2c4a:
; copy of Function2ba8
; calling Functiond4e6 instead of Functiond6e4
; calling _HandlePlayerStep_Limited instead of _HandlePlayerStep
.loop
call Function2c5a
and a
@ -58,9 +58,9 @@ Function2c5a:
call Bankswitch
call HandleNPCStep
call LoadMinorObjectGFX
ld a, BANK(Functiond4e6)
ld a, BANK(_HandlePlayerStep_Limited)
call Bankswitch
call Functiond4e6
call _HandlePlayerStep_Limited
ld a, BANK(InitSprites)
call Bankswitch
call InitSprites

View File

@ -2,7 +2,11 @@ INCLUDE "constants.asm"
SECTION "home/scrolling_menu.asm", ROM0
Function3810::
; Runs a scrolling menu from a table with the following:
; 1. A pointer to the menu header.
; 2. Pointer to the cursor in RAM.
; 3. Pointer to the menu scroll position in RAM.
ScrollingMenu_FromTable::
ld e, [hl]
inc hl
ld d, [hl]
@ -12,13 +16,15 @@ Function3810::
ld l, e
call CopyMenuHeader
pop hl
ld e, [hl]
inc hl
ld d, [hl]
inc hl
ld a, [de]
ld [wMenuCursorBuffer], a
ld [wMenuCursorPosition], a
push de
ld e, [hl]
inc hl
ld d, [hl]
@ -26,11 +32,13 @@ Function3810::
ld a, [de]
ld [wMenuScrollPosition], a
push de
call ScrollingMenu
pop de
ld a, [wMenuScrollPosition]
ld [de], a
pop de
ld a, [wMenuCursorY]
ld [de], a
ld a, [wMenuJoypad]
@ -54,27 +62,34 @@ ScrollingMenu::
ld a, [wMenuJoypad]
ret
Function385a::
PartyMenu_TextboxBackup::
push hl
jr asm_3865
jr .continue
Function385d::
.unreferenced_385d:
callfar FreezeMonIcons
asm_3865:
.continue
pop hl
call MenuTextBox
ld c, $0
call Function3872
ld c, 0
call PartyMenu_WaitForAorB
call CloseWindow
ret
Function3872::
; BUG: Supposed to wait for at most c frames until the player pushes a button. If c is 0, then wait indefinitely.
; However, there is a bit of a problem: it doesn't actually call DelayFrames at any point.
; Presumably, this function was intended to loop at .unreferenced_3875 at one point,
; but they forgot to add a DelayFrame when they added the jump at the beginning.
;
; TLDR: The Softboiled heal message only shows up for one frame due to a combination of two oversights.
PartyMenu_WaitForAorB::
.loop
push bc
jr asm_387d
jr .continue
Function3875::
.unreferenced_3875:
callfar PlaySpriteAnimationsAndDelayFrame
asm_387d:
.continue
pop bc
call GetJoypad
ldh a, [hJoyDown]
@ -82,8 +97,9 @@ asm_387d:
jr nz, .done
ld a, c
and a
jr z, Function3872
jr z, .loop
dec c
jr z, Function3872
.done:
; BUG: This is supposed to be a jr nz, not jr z
jr z, .loop
.done
ret

View File

@ -44,7 +44,7 @@ Function3055::
cp $ff
ret z
cp b
jp z, SetFFInAccumulator
jp z, xor_a_dec_a
jr .Loop
asm_3062:
@ -70,7 +70,7 @@ Function307a::
ld hl, wTalkingTargetType
res 0, [hl]
res 1, [hl]
call SetFFInAccumulator
call xor_a_dec_a
ret
PrintTextboxDebugNumbers::
@ -105,7 +105,7 @@ PrintTextboxDebugNumbers::
QueueMapTextSubroutine::
ldh a, [hJoyState]
bit A_BUTTON_F, a
jp z, ClearAccumulator ; if we didn't press a
jp z, xor_a ; if we didn't press a
call GetFacingPersonText
jp nc, Function30e8 ; if not talking to a person
ld d, $0
@ -127,12 +127,12 @@ QueueMapTextSubroutine::
ld [de], a
ld hl, wTalkingTargetType
set 0, [hl] ; we're talking to an NPC
call SetFFInAccumulator
call xor_a_dec_a
ret
Function30e8::
call GetFacingSignpost
jp nc, ClearAccumulator ; if not facing person or sign
jp nc, xor_a ; if not facing person or sign
ld a, e
ldh [hFFEB], a
ld a, d
@ -143,7 +143,7 @@ Function30e8::
ldh [hFFEE], a
ld hl, wTalkingTargetType
set 1, [hl] ; we're talking to a sign
call SetFFInAccumulator
call xor_a_dec_a
ret
GetFacingPersonText::
@ -345,11 +345,11 @@ CheckBPressedDebug:
bit B_BUTTON_F, a
ret
ClearAccumulator::
xor_a::
xor a
ret
SetFFInAccumulator::
xor_a_dec_a::
xor a
dec a
ret

View File

@ -79,24 +79,24 @@ RefreshPlayerCoords::
; This piece of code has been removed in pokegold (note that the conditions above were altered, as well)
call GetObjectStruct
ld hl, 16 ; TODO: constantify this
ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
add a, d
ld [hl], a
ld [wMap1ObjectXCoord], a
ld hl, 18 ; TODO: constantify this
ld hl, OBJECT_LAST_MAP_X
add hl, bc
ld a, [hl]
add a, d
ld [hl], a
ld hl, 17 ; TODO: constantify this
ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [hl]
add a, e
ld [hl], a
ld [wMap1ObjectYCoord], a
ld hl, 19
ld hl, OBJECT_LAST_MAP_Y
add hl, bc
ld a, [hl]
add a, e

View File

@ -49,14 +49,14 @@ TestWildBattleStart::
and D_PAD
ret z ; if no directions are down, don't try and trigger a wild encounter
call CheckBPressedDebug
jp nz, ClearAccumulator ; if b button is down, clear acc
jp nz, xor_a ; if b button is down, clear acc
callfar Function3ee3e
ld a, [wBattleMode]
and a
ret z ; if no battle, return
ld a, $3
call WriteIntod637
call SetFFInAccumulator
call xor_a_dec_a
ret
Function3904::

View File

@ -28,9 +28,9 @@ Unreferenced_GetPartyParamLocation_Old:
pop bc
ret
Unreferenced_UseItem_Old:
ld a, BANK(_UseItem)
ld hl, $67C4 ; Early location for _UseItem
Unreferenced_DoItemEffect_Old:
ld a, BANK(_DoItemEffect)
ld hl, $67C4 ; Early location for _DoItemEffect
jp Old_FarCallFunctionAddress
Unreferenced_CheckTossableItem_Old:
@ -293,7 +293,7 @@ Unreferenced_FadeToMapMusic_Old:
jr c, .dont_change
ld a, 8
ld [wMusicFade], a
call PlaceWaitingText
call _DisableAudio
ld a, e
ld [wMusicFadeID], a
ld a, d

View File

@ -16,7 +16,8 @@ RefreshScreen::
call Bankswitch
ret
Function1fea::
; TODO: Better name for this?
ScreenCleanup::
call TextboxCleanup
call ClearWindowData
call InitToolgearBuffer

View File

@ -117,9 +117,11 @@ ROMX $01
"engine/menu_options_menu.asm"
ROMX $02
"engine/dumps/bank02.asm@_SpawnPlayer"
"gfx.asm@Bank 2 Misc GFX"
"engine/dumps/bank02.asm@QueueFollowerFirstStep"
"engine/overworld/player_object.asm"
"engine/gfx/load_minor_object_gfx.asm"
"gfx.asm@Minor Object GFX"
"engine/overworld/player_object.asm@QueueFollowerFirstStep"
"engine/events/town_map.asm"
"gfx.asm@Mon Nest Icon"
"data/maps/flypoints.asm"
@ -141,7 +143,6 @@ ROMX $03
"engine/overworld/player_movement.asm@Player Movement"
"data/collision/collision_type_table.asm"
"engine/overworld/player_movement.asm@Rest of Player Movement"
"engine/dumps/bank03.asm@GetFlyPointMapLocation"
"engine/overworld/spawn_points.asm"
"data/maps/spawn_points.asm"
"data/tileset_headers.asm"
@ -154,9 +155,14 @@ ROMX $03
"engine/pokemon/health.asm@HP Bar"
"engine/events/field_moves.asm"
"engine/items/inventory.asm@_CheckTossableItem"
"engine/dumps/bank03.asm@Functiond41d"
"engine/overworld/player_step.asm"
"engine/pokemon/move_mon.asm"
"engine/pokemon/bills_pc.asm"
"engine/events/starter_dex.asm"
"engine/items/item_effects.asm"
"engine/dumps/bank03.asm@GetMaxPPOfMove"
"engine/events/breeder.asm"
"engine/battle_anims/pokeball_wobble.asm"
"engine/pokemon/knows_move.asm"
ROMX $04
org $4000
@ -223,7 +229,15 @@ ROMX $08
ROMX $09
org $4000
"engine/dumps/bank09.asm@Function24000"
"engine/menu/menu.asm"
"engine/items/update_item_description.asm"
"engine/events/pokepic.asm"
"engine/menu/scrolling_menu.asm"
"engine/items/switch_items.asm"
"engine/menu/menu_2.asm"
"engine/pokemon/mon_submenu.asm"
"engine/battle/menu.asm"
"engine/items/buy_sell_toss.asm"
ROMX $0a
org $4000
@ -232,7 +246,9 @@ ROMX $0a
ROMX $0b
org $4000
"engine/dumps/bank0b.asm"
"engine/items/print_item_description.asm"
"engine/items/tm_holder.asm"
"engine/pokemon/print_move_description.asm"
ROMX $0c
org $4000
@ -273,19 +289,18 @@ ROMX $0f
ROMX $10
org $4000
"engine/dumps/bank10.asm"
org $52a1
"engine/pokedex/pokedex.asm"
"engine/link/time_capsule_2.asm"
"engine/pokedex/pokedex_2.asm"
"data/moves/names.asm"
org $58b6
"data/moves/moves.asm"
org $6493
"engine/pokemon/evolve.asm"
"data/pokemon/evos_attacks.asm"
ROMX $11
org $4000
org $40d5
"engine/pokedex/display_dex_entry.asm"
"gfx.asm@Pokedex GFX"
org $4945
"data/pokemon/dex_entries.asm"
ROMX $12
@ -778,7 +793,7 @@ ROMX $33
"engine/battle_anims/anim_commands.asm"
"engine/dumps/bank33.asm"
"engine/battle_anims/functions.asm"
"engine/battle_anims/helper.asm"
"engine/battle_anims/helpers.asm"
ROMX $34
@ -992,5 +1007,10 @@ SRAM 0
"Sprite Buffers"
org $a600
"Unknown, bank 0"
org $bffe
"Window Stack Top"
org $b800
"SRAM Window Stack"
SRAM $02
"Boxes 1-5"
SRAM $03
"Boxes 6-10"

View File

@ -30,7 +30,7 @@ ENDM
MACRO party_struct
box_struct \1
\1Status:: db
\1Unused:: db
\1Unused4:: db
\1HP:: dw
\1MaxHP:: dw
\1Stats:: ; big endian
@ -101,19 +101,27 @@ MACRO battle_struct
ENDM
MACRO box
\1::
\1Count:: ds 1
\1Species:: ds MONS_PER_BOX + 1
\1Count:: db
\1Species:: ds MONS_PER_BOX + 1
\1Mons::
\1Mon1:: box_struct \1Mon1
\1Mon2:: ds BOXMON_STRUCT_LENGTH * (MONS_PER_BOX +- 1)
\1MonOT:: ds NAME_LENGTH * MONS_PER_BOX
\1MonNicknames:: ds PKMN_NAME_LENGTH * MONS_PER_BOX
; \1Mon1 - \1Mon30
for n, 1, MONS_PER_BOX + 1
\1Mon{d:n}:: box_struct \1Mon{d:n}
endr
\1MonOTs::
; \1Mon1OT - \1Mon30OT
for n, 1, MONS_PER_BOX + 1
\1Mon{d:n}OT:: ds PLAYER_NAME_LENGTH
endr
\1MonNicknames::
; \1Mon1Nickname - \1Mon30Nickname
for n, 1, MONS_PER_BOX + 1
\1Mon{d:n}Nickname:: ds MON_NAME_LENGTH
endr
\1MonNicknamesEnd::
\1End:: ds 2 ; padding
\1End::
ENDM
MACRO map_connection_struct
\1ConnectedMapGroup:: db
\1ConnectedMapNumber:: db

View File

@ -108,6 +108,11 @@ NEXTU
hMapObjectIndex:: db
hObjectStructIndex:: db
hEnemyMonSpeed:: dw
NEXTU
hPokedexTempWeight:: dw
ENDU
UNION
@ -173,8 +178,7 @@ hCurSpriteTile:: db
hCurSpriteOAMFlags:: db
ENDU
hFFCD:: db
ds 2 ; TODO
hMoneyTemp:: ds 3
hLCDCPointer::
db
@ -206,7 +210,7 @@ hWX:: db
hWY:: db
hOverworldFlashlightEffect:: db
; Influences draw distance of map around HIRO
; Influences draw distance of map around the player.
; Meant to go from 0 --> to desired distance
; or else graphical errors will occur.
; 0 - regular distance

View File

@ -3,7 +3,7 @@ INCLUDE "constants.asm"
SECTION "Sprite Buffers", SRAM
UNION
sScratch:: ds SCREEN_WIDTH * SCREEN_HEIGHT
sScratch:: ds SCREEN_WIDTH * SCREEN_HEIGHT
NEXTU
sSpriteBuffer0:: ds SPRITEBUFFERSIZE
sSpriteBuffer1:: ds SPRITEBUFFERSIZE
@ -19,5 +19,33 @@ s0_a600:: ds 7 ; TODO: properly label this and figure out exact size
ENDU
SECTION "Window Stack Top", SRAM
sWindowStackTop:: dw
SECTION "SRAM Window Stack", SRAM
sWindowStackBottom::
ds $800 - 1
sWindowStackTop::
ds 1
; The PC boxes will not fit into one SRAM bank,
; so they use multiple SECTIONs
DEF box_n = 0
MACRO boxes
rept \1
DEF box_n += 1
sBox{d:box_n}:: box sBox{d:box_n}
endr
ENDM
SECTION "Boxes 1-5", SRAM
; sBox1 - sBox5
boxes 5
SECTION "Boxes 6-10", SRAM
; sBox6 - sBox10
boxes 5
; All 10 boxes fit exactly within 2 SRAM banks
assert box_n == NUM_BOXES, \
"boxes: Expected {d:NUM_BOXES} total boxes, got {d:box_n}"

View File

@ -618,18 +618,18 @@ wEnemyEvaLevel:: db
ds 1
wcab9:: ds 1
wForceEvolution:: db
wcaba:: ds 1
ds 1
wPlayerSubstituteHP:: ds 1
wEnemySubstituteHP:: ds 1
wcabe:: ds 1
wPlayerDebugSelectedMove:: ds 1
ds 1
wcac0:: ds 1
wMoveSelectionMenuType:: ds 1
wCurPlayerSelectedMove:: db
wCurEnemySelectedMove:: db
@ -813,28 +813,46 @@ wWindowStackSize:: db
SECTION "CC09", WRAM0[$CC02]
wMenuDataHeader::
db
wMenuFlags:: db
wMenuBorderTopCoord:: db
wMenuBorderLeftCoord:: db
wMenuBorderBottomCoord:: db
wMenuBorderRightCoord:: db
wMenuDataPointer:: dw
wMenuCursorBuffer:: db
ds 8 ; TODO
wMenuCursorPosition:: db
ds 8
wMenuDataHeaderEnd::
wMenuData2::
wMenuData::
wMenuDataFlags:: db
UNION
wMenuDataItems:: db
wMenuDataIndicesPointer:: dw
wMenuDataDisplayFunctionPointer:: dw
wMenuDataPointerTableAddr:: dw
wMenuDataEnd::
ds 2
wcc1c:: dw
ds 1
wcc1f:: dw
ds 1
wMenuData3::
NEXTU
; 2D Menu
wMenuData_2DMenuDimensions:: db
wMenuData_2DMenuSpacing:: db
wMenuData_2DMenuItemStringsBank:: db
wMenuData_2DMenuItemStringsAddr:: dw
wMenuData_2DMenuFunctionBank:: db
wMenuData_2DMenuFunctionAddr:: dw
NEXTU
wMenuData_ScrollingMenuHeight:: db
wMenuData_ScrollingMenuWidth:: db
wMenuData_ScrollingMenuItemFormat:: db
wMenuData_ItemsPointerBank:: db
wMenuData_ItemsPointerAddr:: dw
wMenuData_ScrollingMenuFunction1:: ds 3
wMenuData_ScrollingMenuFunction2:: ds 3
wMenuData_ScrollingMenuFunction3:: ds 3
ENDU
wMoreMenuData::
w2DMenuCursorInitY:: db
w2DMenuCursorInitX:: db
@ -882,6 +900,13 @@ UNION
wcc3a::
wChargeMoveNum::
wPrevPartyLevel::
wRodResponse_Old::
wPokeFluteCuredSleep::
wTempRestorePPItem:: db
NEXTU
wMovementBufferCount:: db
wMovementBufferObject:: db
@ -905,6 +930,19 @@ NEXTU
wPlaceBallsDirection:: db
wTrainerHUDTiles:: ds 4
NEXTU
; switching items in pack
wSwitchItemBuffer:: ds 2
NEXTU
wBattleMenuRows:: db
wBattleMenuColumns:: db
NEXTU
wTempBoxName:: ds BOX_NAME_LENGTH
ENDU
SECTION "CC9A", WRAM0[$CC9A]
@ -991,21 +1029,13 @@ wMonOrItemNameBuffer:: ds MON_NAME_LENGTH
ds MON_NAME_LENGTH
wcd1d:: ds 8
wTMHMMoveNameBackup:: ds 8
ds 1
UNION
wStringBuffer1:: ds STRING_BUFFER_LENGTH
NEXTU
ds 1
wcd27:: ds 1
ds 1
wcd29:: ds 1
wcd2a:: ds 1
ENDU
SECTION "CD31", WRAM0[$CD31]
UNION
@ -1029,7 +1059,9 @@ ENDU
SECTION "CD3C", WRAM0[$CD3C]
wcd3c:: db
wcd3c::
wPartyMenuCursor::
wBillsPCCursor:: db
wRegularItemsCursor:: db
wBackpackAndKeyItemsCursor:: db
@ -1037,17 +1069,17 @@ wBattleMenuCursorPosition::
wStartmenuCursor:: db
wCurMoveNum:: db
wCurBattleMon:: db
wCurBattleMon::
wcd41:: db
wcd42:: db
wTMHolderCursor:: db
wFieldDebugMenuCursorBuffer::
wcd43:: db
wRegularItemsScrollPosition:: db
wBackpackAndKeyItemsScrollPosition:: db
wcd46:: ds 1
wcd47:: ds 1
wBillsPCScrollPosition:: db
wTMHolderScrollPosition:: db
; TODO: change to wSwitchItem, wSwitchMon, wSwappingMove
wSelectedSwapPosition:: db
wMenuScrollPosition:: db
@ -1093,14 +1125,16 @@ wNamesPointer:: dw
wItemAttributesPointer:: dw
wCurItem:: db
wCurItemQuantity::
wItemIndex:: db
wCurPartySpecies: db
wCurPartyMon: db
SECTION "CD7B", WRAM0[$CD7B]
ds 1
wWhichHPBar:: db
wPokemonWithdrawDepositParameter:: ds 1
wPokemonWithdrawDepositParameter:: db
wItemQuantity:: db
wItemQuantityBuffer:: db
@ -1114,7 +1148,7 @@ wTalkingTargetType:: db
;bit 1 = has engaged sign in dialogue
wcdb1:: ds 1
wcdb2:: ds 1
wHandlePlayerStep:: ds 1
ds 1
@ -1143,7 +1177,7 @@ wNextMapGroup:: db
wNextMapNumber:: db
wPrevWarp:: db
wcdc2:: db
wEvolvableFlags:: db
UNION
wSkipMovesBeforeLevelUp::
@ -1155,6 +1189,13 @@ wReplacementBlock:: db
NEXTU
wMonSubmenuCount:: db
wMonSubmenuItems:: ds NUM_MONMENU_ITEMS + 1
NEXTU
; general-purpose HP buffers
wHPBuffer1:: dw
wHPBuffer2:: dw
wHPBuffer3:: dw
NEXTU
wHPBarMaxHP:: dw
@ -1169,7 +1210,10 @@ wEnemyEffectivenessVsPlayerMons:: flag_array PARTY_LENGTH
wPlayerEffectivenessVsEnemyMons:: flag_array PARTY_LENGTH
NEXTU
; Used for an old nickname function and for storing the item price in the shop menu.
wBuySellItemPrice:: dw
NEXTU
; Used for an old nickname function
wMiscStringBuffer:: ds STRING_BUFFER_LENGTH
NEXTU
@ -1195,6 +1239,13 @@ NEXTU
wFinalCatchRate:: db
wThrownBallWobbleCount:: db
NEXTU
; evolution data
wEvolutionOldSpecies:: db
wEvolutionNewSpecies:: db
wEvolutionPicOffset:: db
wEvolutionCanceled:: db
ENDU
wLinkBattleRNs:: ds 10
@ -1209,10 +1260,9 @@ wEnemyMonBaseStats:: ds NUM_EXP_STATS
wEnemyMonCatchRate:: db
wcdff:: ds 1
wBattleMode:: db
wce01:: ds 1
wTempWildMonSpecies:: ds 1
wOtherTrainerClass:: ds 1
wBattleType::
wce03:: ds 1
wBattleType:: db
wce04:: ds 1
wOtherTrainerID:: ds 1
wBattleResult:: ds 1
@ -1281,7 +1331,7 @@ wMonHLearnset::
ds 1
wMonHeaderEnd::
SECTION "CE26", WRAM0[$CE26]
wce26:: ds 1
ds 2
@ -1290,7 +1340,7 @@ wCurDamage:: dw
ds 2
wce2d:: ds 1
wRepelEffect:: db
wListMoves_MoveIndicesBuffer:: ds NUM_MOVES
wPutativeTMHMMove:: db
@ -1303,10 +1353,14 @@ wNamedObjectIndexBuffer::
wNumSetBits::
wTextDecimalByte::
wTempIconSpecies::
wTempPP::
wTempTMHM::
wUsePPUp::
wTempSpecies::
wMoveGrammar::
wTypeMatchup::
wCurType::
wBreedingCompatibility::
wTempByteValue::
wApplyStatLevelMultipliersToEnemy::
wce37::
@ -1317,9 +1371,7 @@ wce38:: ds 1
wNumFleeAttempts::
wce39:: ds 1
SECTION "CE3A", WRAM0[$CE3A]
wce3a:: ds 1
wMonTriedToEvolve:: db
wVBlankSavedROMBank::
db
@ -1472,9 +1524,7 @@ wJohtoBadges::
wKantoBadges::
flag_array NUM_KANTO_BADGES
wTMsHMs:: db
SECTION "D19E", WRAM0[$D19E]
wTMsHMs:: ds NUM_TM_HM
wItems::
wNumBagItems:: db
@ -1546,10 +1596,14 @@ wd41d:: db
wd41e:: db
SECTION "D4A9", WRAM0[$D4A7]
; Bit 0 set when exiting a battle.
; Bit 1 set when viewing summary/opening new dex entry, and reset when closing new dex entry.
wd4a7:: db
ds 1
wd4a9:: db
ds 1 ; TODO
; TODO: change to wJoypadDisable, constantify flags
wJoypadFlags:: db
; 76543210
; ||||\__/
@ -1565,10 +1619,13 @@ wDigWarpNumber:: db
wd4b3:: ds 1
wd4b4:: ds 1
wd4b5:: ds 1
wd4b6:: ds 1
wd4b7:: ds 1
wd4b8:: ds 1
wd4b9:: ds 1
; Doesn't get written to at any point yet, but it's read... once.
wCurBox:: db
ds 2
wBoxNames:: ds BOX_NAME_LENGTH * NUM_BOXES
SECTION "Warp data", WRAM0[$D513]
@ -1720,21 +1777,21 @@ wUnownDex:: ds NUM_UNOWN
wAnnonID:: ds 1
wd875:: ds 1
ds 1
; Buffer used for withdrawing Breeder Pokémon, as well as checking gender.
wBufferMonNickname:: ds MON_NAME_LENGTH
wBufferMonOT:: ds PLAYER_NAME_LENGTH
wBufferMon:: box_struct wBufferMon
wd882:: ds 1
wd883:: ds 1
wd884:: ds 1
; 1 = One Pokémon deposited.
; 2 = Two Pokémon deposited.
; 3 = Egg laid.
; 4 = Egg received, don't lay another egg.
wBreederStatus:: ds 1
SECTION "D8A2", WRAM0[$D8A2]
wd8a2:: ds 1
wd8a3:: ds 1
wd8a4:: ds 1
ds 2
wBreedMon1Nickname:: ds MON_NAME_LENGTH
wBreedMon1OT:: ds PLAYER_NAME_LENGTH
@ -1744,9 +1801,9 @@ wBreedMon2Nickname:: ds MON_NAME_LENGTH
wBreedMon2OT:: ds PLAYER_NAME_LENGTH
wBreedMon2:: box_struct wBreedMon2
SECTION "D8FD", WRAM0[$D8FD]
wd8fd:: ds 1
; Uses the last two bits to keep track of your breeder mons' genders.
; Bit clear = male, bit set = female
wBreedMonGenders:: db
wd8fe:: ds 1
SECTION "D913", WRAM0[$D913]
@ -1781,38 +1838,7 @@ endr
wOTPartyDataEnd::
ENDU
SECTION "DA83", WRAM0[$DA83]
wBoxListLength:: db
wBoxList:: ds MONS_PER_BOX
wBoxListEnd:: db
SECTION "DAA3", WRAM0[$DAA3]
wBoxMons::
; wBoxMon1 - wBoxMon30
for n, 1, MONS_PER_BOX + 1
wBoxMon{d:n}:: box_struct wBoxMon{d:n}
endr
wBoxDataEnd::
SECTION "DE63", WRAM0[$DE63]
wBoxMonOT::
; wBoxMon1OT - wBoxMon30OT
for n, 1, MONS_PER_BOX + 1
wBoxMon{d:n}OT:: ds PLAYER_NAME_LENGTH
endr
wBoxMonOTEnd::
wBoxMonNicknames::
; wBoxMon1Nick - wBoxMon30Nick
for n, 1, MONS_PER_BOX + 1
wBoxMon{d:n}Nick:: ds MON_NAME_LENGTH
endr
wBoxMonNicknamesEnd::
wdfcb:: ds 1
wBox:: box wBox
SECTION "Stack Bottom", WRAM0

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