ref: 8360a1a2e81d3c3d6c2529c9a6834b011fd66f36
parent: f7ee74c3b8fdd57c92844f3f9d7a89c0f9770d6d
author: PikalaxALT <[email protected]>
date: Sat Jan 9 18:41:03 EST 2016
Pokegear functions and RAM labels
--- a/constants/sprite_constants.asm
+++ b/constants/sprite_constants.asm
@@ -482,7 +482,7 @@
const SPRITE_ANIM_INDEX_SLOTS_CHANSEY
const SPRITE_ANIM_INDEX_SLOTS_EGG
const SPRITE_ANIM_INDEX_09
- const SPRITE_ANIM_INDEX_WALK_CYCLE
+ const SPRITE_ANIM_INDEX_RED_WALK
const SPRITE_ANIM_INDEX_0B
const SPRITE_ANIM_INDEX_0C
const SPRITE_ANIM_INDEX_0D
@@ -502,7 +502,7 @@
const SPRITE_ANIM_INDEX_1B
const SPRITE_ANIM_INDEX_1C
const SPRITE_ANIM_INDEX_1D
- const SPRITE_ANIM_INDEX_1E
+ const SPRITE_ANIM_INDEX_BLUE_WALK
const SPRITE_ANIM_INDEX_1F
const SPRITE_ANIM_INDEX_20
const SPRITE_ANIM_INDEX_21
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -578,7 +578,7 @@
rept 3
ld [hli], a
endr
- ld b, wc6d3 - (wMisc + 3)
+ ld b, $c8
xor a
.loop3
ld [hli], a
--- a/engine/namingscreen.asm
+++ b/engine/namingscreen.asm
@@ -3,6 +3,7 @@
call NamingScreen
call ReturnToMapWithSpeechTextbox
ret
+
; 0x116c1
NamingScreen: ; 116c1
@@ -37,6 +38,7 @@
ld [Options], a
call ClearJoypad
ret
+
; 116f8
.SetUpNamingScreen: ; 116f8
@@ -54,6 +56,7 @@
call SetPalettes
call NamingScreen_InitNameEntry
ret
+
; 1171d
.GetNamingScreenSetup: ; 1171d
@@ -69,9 +72,9 @@
ld h, [hl]
ld l, a
jp [hl]
+
; 1172e
-
.Jumptable: ; 1172e (4:572e)
dw .Pokemon
dw .Player
@@ -82,7 +85,6 @@
dw .Pokemon
dw .Pokemon
-
.Pokemon: ; 1173e (4:573e)
ld a, [CurPartySpecies]
ld [wd265], a
@@ -113,11 +115,13 @@
.genderless
call .StoreMonIconParams
ret
+
; 11780 (4:5780)
.NicknameStrings: ; 11780
db "'S@"
db "NICKNAME?@"
+
; 1178d
.Player: ; 1178d (4:578d)
@@ -128,10 +132,12 @@
call PlaceString
call .StoreSpriteIconParams
ret
+
; 117a3 (4:57a3)
.PlayerNameString: ; 117a3
db "YOUR NAME?@"
+
; 117ae
.Rival: ; 117ae (4:57ae)
@@ -143,10 +149,12 @@
call PlaceString
call .StoreSpriteIconParams
ret
+
; 117c3 (4:57c3)
.RivalNameString: ; 117c3
db "RIVAL'S NAME?@"
+
; 117d1
.Mom: ; 117d1 (4:57d1)
@@ -158,10 +166,12 @@
call PlaceString
call .StoreSpriteIconParams
ret
+
; 117e6 (4:57e6)
.MomNameString: ; 117e6
db "MOTHER'S NAME?@"
+
; 117f5
.Box: ; 117f5 (4:57f5)
@@ -170,11 +180,11 @@
lb bc, BANK(PokeBallSpriteGFX), $4
call Request2bpp
xor a
- ld hl, wc300
+ ld hl, wSpriteAnimDict
ld [hli], a
ld [hl], a
depixel 4, 4, 4, 0
- ld a, SPRITE_ANIM_INDEX_WALK_CYCLE
+ ld a, SPRITE_ANIM_INDEX_RED_WALK
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc
@@ -184,10 +194,12 @@
call PlaceString
call .StoreBoxIconParams
ret
+
; 11822 (4:5822)
.BoxNameString: ; 11822
db "BOX NAME?@"
+
; 1182c
.Tomodachi: ; 1182c (4:582c)
@@ -196,10 +208,12 @@
call PlaceString
call .StoreSpriteIconParams
ret
+
; 11839 (4:5839)
.oTomodachi_no_namae_sutoringu: ; 11839
db "おともだち の なまえは?@"
+
; 11847
.LoadSprite: ; 11847 (4:5847)
@@ -216,11 +230,11 @@
ld hl, VTiles0 tile $04
call Request2bpp
xor a
- ld hl, wc300
+ ld hl, wSpriteAnimDict
ld [hli], a
ld [hl], a
pop de
- ld b, SPRITE_ANIM_INDEX_WALK_CYCLE
+ ld b, SPRITE_ANIM_INDEX_RED_WALK
ld a, d
cp KrisSpriteGFX / $100
jr nz, .not_kris
@@ -227,7 +241,7 @@
ld a, e
cp KrisSpriteGFX % $100
jr nz, .not_kris
- ld b, SPRITE_ANIM_INDEX_1E
+ ld b, SPRITE_ANIM_INDEX_BLUE_WALK
.not_kris
ld a, b
depixel 4, 4, 4, 0
@@ -257,7 +271,6 @@
ld [wNamingScreenStringEntryCoord + 1], a
ret
-
NamingScreen_IsTargetBox: ; 1189c
push bc
push af
@@ -268,6 +281,7 @@
dec b
pop bc
ret
+
; 118a8
NamingScreen_InitText: ; 118a8
@@ -330,6 +344,7 @@
dec b
jr nz, .row
ret
+
; 11915
NamingScreenJoypadLoop: ; 11915
@@ -352,6 +367,7 @@
ld [hSCY], a
scf
ret
+
; 11940
.UpdateStringEntry: ; 11940
@@ -377,6 +393,7 @@
ld a, $1
ld [hBGMapMode], a
ret
+
; 11968
.RunJumptable: ; 11968
@@ -391,14 +408,13 @@
ld h, [hl]
ld l, a
jp [hl]
+
; 11977
-
.Jumptable: ; 11977 (4:5977)
dw .InitCursor
dw .ReadButtons
-
.InitCursor: ; 1197b (4:597b)
depixel 10, 3
call NamingScreen_IsTargetBox
@@ -410,7 +426,7 @@
ld a, c
ld [wNamingScreenCursorObjectPointer], a
ld a, b
- ld [wc6d6], a
+ ld [wNamingScreenCursorObjectPointer + 1], a
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc
ld a, [hl]
@@ -569,6 +585,7 @@
add hl, bc
ld [hl], a
ret
+
; 11a79 (4:5a79)
.LetterEntries: ; 11a79
@@ -576,6 +593,7 @@
.CaseDelEnd: ; 11a82
db $00, $00, $00, $30, $30, $30, $60, $60, $60
+
; 11a8b
.GetDPad: ; 11a8b (4:5a8b)
@@ -593,6 +611,7 @@
and D_RIGHT
jr nz, .right
ret
+
.right
call NamingScreen_GetCursorPosition
and a
@@ -604,9 +623,11 @@
jr nc, .asm_11ab4
inc [hl]
ret
+
.asm_11ab4
ld [hl], $0
ret
+
.asm_11ab7
cp $3
jr nz, .asm_11abc
@@ -619,6 +640,7 @@
add hl, bc
ld [hl], a
ret
+
.left
call NamingScreen_GetCursorPosition
and a
@@ -630,9 +652,11 @@
jr z, .asm_11ad5
dec [hl]
ret
+
.asm_11ad5
ld [hl], $8
ret
+
.asm_11ad8
cp $1
jr nz, .asm_11ade
@@ -648,6 +672,7 @@
add hl, bc
ld [hl], a
ret
+
.down
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
@@ -658,14 +683,17 @@
jr nc, .asm_11aff
inc [hl]
ret
+
.asm_11af9
cp $4
jr nc, .asm_11aff
inc [hl]
ret
+
.asm_11aff
ld [hl], $0
ret
+
.up
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
@@ -674,6 +702,7 @@
jr z, .asm_11b0c
dec [hl]
ret
+
.asm_11b0c
ld [hl], $4
call NamingScreen_IsTargetBox
@@ -710,6 +739,7 @@
.end_of_string
scf
ret
+
; 11b39 (4:5b39)
; XXX
@@ -735,6 +765,7 @@
.done
ld a, [hl]
jr NamingScreen_LoadNextCharacter
+
; 11b56
Dakutens: ; Dummied out
@@ -752,6 +783,7 @@
db "はぱ", "ひぴ", "ふぷ", "へぺ", "ほぽ"
db "ハパ", "ヒピ", "フプ", "へぺ", "ホポ"
db $ff
+
; 11bbc
NamingScreen_DeleteCharacter: ; 11bbc (4:5bbc)
@@ -781,6 +813,7 @@
add hl, de
pop af
ret
+
; 11be0
NamingScreen_InitNameEntry: ; 11be0
@@ -801,9 +834,9 @@
jr nz, .loop
ld [hl], "@"
ret
+
; 11bf7
-
NamingScreen_StoreEntry: ; 11bf7 (4:5bf7)
ld hl, wNamingScreenDestinationPointer
ld a, [hli]
@@ -861,6 +894,7 @@
add hl, bc
dec d
jr .loop
+
.done
add hl, de
ld a, [hl]
@@ -867,7 +901,6 @@
ld [wNamingScreenLastCharacter], a
ret
-
LoadNamingScreenGFX: ; 11c51
call ClearSprites
callab ClearSpriteAnims
@@ -912,6 +945,7 @@
ld a, $7
ld [hWX], a
ret
+
; 11cb7
NamingScreenGFX_Border: ; 11cb7
@@ -928,6 +962,7 @@
db "s t u v w x y z "
db "× ( ) : ; [ ] <PK> <MN>"
db "UPPER DEL END "
+
BoxNameInputLower:
db "a b c d e f g h i"
db "j k l m n o p q r"
@@ -935,6 +970,7 @@
db "é 'd 'l 'm 'r 's 't 'v 0"
db "1 2 3 4 5 6 7 8 9"
db "UPPER DEL END "
+
NameInputUpper: ; Unreferenced?
db "A B C D E F G H I"
db "J K L M N O P Q R"
@@ -941,6 +977,7 @@
db "S T U V W X Y Z "
db "- ? ! / . , "
db "lower DEL END "
+
BoxNameInputUpper:
db "A B C D E F G H I"
db "J K L M N O P Q R"
@@ -948,6 +985,7 @@
db "× ( ) : ; [ ] <PK> <MN>"
db "- ? ! ♂ ♀ / . , &"
db "lower DEL END "
+
; 11e5d
GFX_11e5d: ; ????
@@ -1047,6 +1085,7 @@
.Dummy: ; dummied out
db "メールを かいてね@"
+
; 11f84
.InitCharset: ; 11f84 (4:5f84)
@@ -1137,7 +1176,6 @@
dw .init_blinking_cursor
dw .process_joypad
-
.init_blinking_cursor: ; 1201b (4:601b)
depixel 9, 2
ld a, SPRITE_ANIM_INDEX_09
@@ -1242,6 +1280,7 @@
ret
; called from engine/sprite_anims.asm
+
ComposeMail_AnimateCursor: ; 120c1 (4:60c1)
call .GetDPad
ld hl, SPRITEANIMSTRUCT_0D
@@ -1283,6 +1322,7 @@
.CaseDelEnd: ; 12102
db $00, $00, $00, $30, $30, $30, $60, $60, $60, $60
+
; 1210c
.GetDPad: ; 1210c (4:610c)
@@ -1425,6 +1465,7 @@
MailComposition_TryAddLastCharacter: ; 121ac (4:61ac)
ld a, [wNamingScreenLastCharacter]
jp MailComposition_TryAddCharacter
+
; 121b2 (4:61b2)
; XXX
@@ -1461,6 +1502,7 @@
.asm_121d9
ld a, [hl]
jp NamingScreen_LoadNextCharacter
+
; 121dd
MailEntry_Uppercase: ; 122dd
@@ -1470,6 +1512,7 @@
db "1 2 3 4 5 6 7 8 9 0"
db "<PK> <MN> <PO> <KE> é ♂ ♀ ¥ … ×"
db "lower DEL END "
+
; 1224f
MailEntry_Lowercase: ; 1224f
@@ -1479,4 +1522,5 @@
db "'d 'l 'm 'r 's 't 'v & ( )"
db "<``> <''> [ ] ' : ; "
db "UPPER DEL END "
+
; 122c1
--- a/engine/phone.asm
+++ b/engine/phone.asm
@@ -651,15 +651,16 @@
call GetCallerName
ret
-Function9038a: ; 9038a (24:438a)
+CheckCanDeletePhoneNumber: ; 9038a (24:438a)
ld a, c
call GetCallerTrainerClass
ld a, c
+ ; and a
ret nz
ld a, b
- cp $1
+ cp PHONECONTACT_MOM
ret z
- cp $4
+ cp PHONECONTACT_ELM
ret z
ld c, $1
ret
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -3,20 +3,16 @@
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
-
ld a, [hInMenu]
push af
ld a, $1
ld [hInMenu], a
-
ld a, [VramState]
push af
xor a
ld [VramState], a
-
call Function90bea
call DelayFrame
-
.loop
call UpdateTime
call JoyTextDelay
@@ -23,7 +19,7 @@
ld a, [wJumptableIndex]
bit 7, a
jr nz, .done
- call Function90f04
+ call PokegearJumptable
callba PlaySpriteAnimations
call DelayFrame
jr .loop
@@ -71,14 +67,14 @@
ld [wcf64], a
ld [wcf65], a
ld [wcf66], a
- ld [wc6d2], a
- ld [wc6d1], a
- ld [wc6d3], a
- ld [wc6d9], a
- ld [wc6da], a
- ld [wc6db], a
- call Function90d9e
- call Function90da8
+ ld [wPokegearPhoneScrollPosition], a
+ ld [wPokegearPhoneCursorPosition], a
+ ld [wPokegearPhoneSelectedPerson], a
+ ld [wPokegearRadioChannelBank], a
+ ld [wPokegearRadioChannelAddr], a
+ ld [wPokegearRadioChannelAddr + 1], a
+ call Pokegear_InitJumptableIndices
+ call InitPokegearTilemap
ld b, SCGB_POKEGEAR_PALS
call GetSGBLayout
call SetPalettes
@@ -95,17 +91,14 @@
ld de, VTiles2
ld a, BANK(TownMapGFX)
call FarDecompress
-
ld hl, PokegearGFX
ld de, VTiles2 + $30 tiles
ld a, BANK(PokegearGFX)
call FarDecompress
-
ld hl, PokegearSpritesGFX
ld de, VTiles0
ld a, BANK(PokegearSpritesGFX)
call Decompress
-
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
@@ -113,14 +106,11 @@
call GetWorldMapLocation
cp FAST_SHIP
jr z, .ssaqua
-
callba GetPlayerIcon
-
push de
ld h, d
ld l, e
ld a, b
-
; standing sprite
push af
ld de, VTiles0 tile $10
@@ -127,9 +117,7 @@
ld bc, 4 tiles
call FarCopyBytes
pop af
-
pop hl
-
; walking sprite
ld de, 12 tiles
add hl, de
@@ -144,6 +132,7 @@
ld bc, 8 tiles
call CopyBytes
ret
+
; 90cb2
FastShipGFX: ; 90cb2
@@ -170,6 +159,7 @@
add hl, bc
ld [hl], a
ret
+
; 90d52 (24:4d52)
Unknown_90d52: ; 90d52
@@ -190,9 +180,9 @@
ld c, a
call GetWorldMapLocation
ret
+
; 90d70
-
Function90d70: ; 90d70 (24:4d70)
ld a, [MapGroup]
ld b, a
@@ -199,19 +189,15 @@
ld a, [MapNumber]
ld c, a
call GetWorldMapLocation
-
cp FAST_SHIP
jr z, .FastShip
-
cp SPECIAL_MAP
jr nz, .LoadLandmark
-
ld a, [BackupMapGroup]
ld b, a
ld a, [BackupMapNumber]
ld c, a
call GetWorldMapLocation
-
.LoadLandmark
ld [wTownMapPlayerIconLandmark], a
ld [wTownMapCursorLandmark], a
@@ -223,7 +209,7 @@
ld [wTownMapCursorLandmark], a
ret
-Function90d9e: ; 90d9e (24:4d9e)
+Pokegear_InitJumptableIndices: ; 90d9e (24:4d9e)
ld a, $0
ld [wJumptableIndex], a
xor a
@@ -230,7 +216,7 @@
ld [wcf64], a
ret
-Function90da8: ; 90da8 (24:4da8)
+InitPokegearTilemap: ; 90da8 (24:4da8)
xor a
ld [hBGMapMode], a
hlcoord 0, 0
@@ -242,39 +228,37 @@
add a
ld e, a
ld d, 0
- ld hl, Jumptable_90e12
+ ld hl, .Jumptable
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
- ld de, .asm_90dcb
+ ld de, .return_from_jumptable
push de
jp [hl]
-.asm_90dcb
+.return_from_jumptable
call Function90eb0
callba TownMapPals
ld a, [wcf65]
and a
- jr nz, .asm_90de8
-
+ jr nz, .kanto_0
xor a
ld [hBGMapAddress], a
ld a, VBGMap0 / $100
ld [hBGMapAddress + 1], a
- call Function90e00
+ call .UpdateBGMap
ld a, $90
- jr .asm_90df3
+ jr .finish
-.asm_90de8
+.kanto_0
xor a
ld [hBGMapAddress], a
ld a, VBGMap1 / $100
ld [hBGMapAddress + 1], a
- call Function90e00
+ call .UpdateBGMap
xor a
-
-.asm_90df3
+.finish
ld [hWY], a
ld a, [wcf65]
and 1
@@ -282,7 +266,7 @@
ld [wcf65], a
ret
-Function90e00: ; 90e00 (24:4e00)
+.UpdateBGMap: ; 90e00 (24:4e00)
ld a, [hCGB]
and a
jr z, .asm_90e0e
@@ -293,18 +277,20 @@
.asm_90e0e
call WaitBGMap
ret
+
; 90e12 (24:4e12)
-Jumptable_90e12: ; 90e12
- dw Function90e1a
- dw Function90e3f
- dw Function90e82
- dw Function90e72
+.Jumptable: ; 90e12
+ dw .Clock
+ dw .Map
+ dw .Phone
+ dw .Radio
+
; 90e1a
-Function90e1a: ; 90e1a
+.Clock: ; 90e1a
ld de, ClockTilemapRLE
- call Function914bb
+ call Pokegear_LoadTilemapRLE
hlcoord 12, 1
ld de, .switch
call PlaceString
@@ -311,8 +297,9 @@
hlcoord 0, 12
lb bc, 4, 18
call TextBox
- call Function90f86
+ call Pokegear_UpdateClock
ret
+
; 90e36 (24:4e36)
.switch
@@ -319,8 +306,7 @@
db " SWITCH▶@"
; 90e3f
-Function90e3f: ; 90e3f
-
+.Map: ; 90e3f
ld a, [wTownMapPlayerIconLandmark]
cp FAST_SHIP
jr z, .johto
@@ -329,6 +315,7 @@
.johto
ld e, 0
jr .ok
+
.kanto
ld e, 1
.ok
@@ -344,26 +331,29 @@
ld a, [wTownMapCursorLandmark]
call Function910b4
ret
+
; 90e72
-Function90e72: ; 90e72
+.Radio: ; 90e72
ld de, RadioTilemapRLE
- call Function914bb
+ call Pokegear_LoadTilemapRLE
hlcoord 0, 12
lb bc, 4, 18
call TextBox
ret
+
; 90e82
-Function90e82: ; 90e82
+.Phone: ; 90e82
ld de, PhoneTilemapRLE
- call Function914bb
+ call Pokegear_LoadTilemapRLE
hlcoord 0, 12
lb bc, 4, 18
call TextBox
call Function90e98
- call Function912d8
+ call PokegearPhone_UpdateDisplayList
ret
+
; 90e98
Function90e98: ; 90e98 (24:4e98)
@@ -419,7 +409,6 @@
Function90ef2: ; 90ef2 (24:4ef2)
hlcoord 6, 0
ld a, $42
-
Function90ef7: ; 90ef7 (24:4ef7)
ld [hli], a
inc a
@@ -432,38 +421,36 @@
ld [hld], a
ret
-Function90f04: ; 90f04 (24:4f04)
+PokegearJumptable: ; 90f04 (24:4f04)
ld a, [wJumptableIndex]
ld e, a
ld d, 0
- ld hl, Jumptable_90f13
-rept 2
+ ld hl, .Jumptable
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
-Jumptable_90f13: ; 90f13 (24:4f13)
- dw Function90f2d
- dw Function90f3e
- dw Function90fb4
- dw Function90fcd
- dw Function90fee
- dw Function90fcd
- dw Function90fe9
- dw Function91156
- dw Function91171
- dw Function911eb
- dw Function91256
- dw Function910f9
- dw Function91112
+.Jumptable: ; 90f13 (24:4f13)
+ dw PokegearClock_Init
+ dw PokegearClock_Joypad
+ dw PokegearMap_CheckRegion
+ dw PokegearMap_Init
+ dw PokegearMap_JohtoMap
+ dw PokegearMap_Init
+ dw PokegearMap_KantoMap
+ dw PokegearPhone_Init
+ dw PokegearPhone_Joypad
+ dw PokegearPhone_MakePhoneCall
+ dw PokegearPhone_FinishPhoneCall
+ dw PokegearRadio_Init
+ dw PokegearRadio_Joypad
-
-Function90f2d: ; 90f2d (24:4f2d)
- call Function90da8
- ld hl, UnknownText_0x914d3
+PokegearClock_Init: ; 90f2d (24:4f2d)
+ call InitPokegearTilemap
+ ld hl, PokegearText_PressAnyButtonToExit
call PrintText
ld hl, wJumptableIndex
inc [hl]
@@ -470,59 +457,54 @@
call Function91492
ret
-Function90f3e: ; 90f3e (24:4f3e)
- call Function90f7b
+PokegearClock_Joypad: ; 90f3e (24:4f3e)
+ call .UpdateClock
ld hl, hJoyLast
-
ld a, [hl]
and A_BUTTON + B_BUTTON + START + SELECT
- jr nz, .asm_90f75
-
+ jr nz, .quit
ld a, [hl]
and D_RIGHT
ret z
-
ld a, [wPokegearFlags]
bit 0, a
- jr z, .asm_90f5a
+ jr z, .no_map_card
ld c, $2
ld b, $1
- jr .asm_90f71
-.asm_90f5a
+ jr .done
+.no_map_card
ld a, [wPokegearFlags]
bit 2, a
- jr z, .asm_90f67
+ jr z, .no_phone_card
ld c, $7
ld b, $2
- jr .asm_90f71
-.asm_90f67
+ jr .done
+.no_phone_card
ld a, [wPokegearFlags]
bit 1, a
ret z
-
ld c, $b
ld b, $3
-
-.asm_90f71
- call Function91480
+.done
+ call Pokegear_SwitchPage
ret
-.asm_90f75
+.quit
ld hl, wJumptableIndex
set 7, [hl]
ret
-Function90f7b: ; 90f7b (24:4f7b)
+.UpdateClock: ; 90f7b (24:4f7b)
xor a
ld [hBGMapMode], a
- call Function90f86
+ call Pokegear_UpdateClock
ld a, $1
ld [hBGMapMode], a
ret
-Function90f86: ; 90f86 (24:4f86)
+Pokegear_UpdateClock: ; 90f86 (24:4f86)
hlcoord 3, 5
lb bc, 5, 14
call ClearBox
@@ -532,21 +514,22 @@
ld c, a
decoord 6, 8
callba PrintHoursMins
- ld hl, UnknownText_0x90faf
+ ld hl, .DayText
bccoord 6, 6
call PlaceWholeStringInBoxAtOnce
ret
+
; 90fa8 (24:4fa8)
+ db "ごぜん@"
+ db "ごご@"
-String_90fa8: db "ごぜん@"
-String_90fac: db "ごご@"
-
-UnknownText_0x90faf: ; 0x90faf
+.DayText: ; 0x90faf
text_jump UnknownText_0x1c5821
db "@"
+
; 0x90fb4
-Function90fb4: ; 90fb4 (24:4fb4)
+PokegearMap_CheckRegion: ; 90fb4 (24:4fb4)
ld a, [wTownMapPlayerIconLandmark]
cp FAST_SHIP
jr z, .johto
@@ -555,7 +538,6 @@
.johto
ld a, 3
jr .done
-
ret
.kanto
@@ -565,28 +547,28 @@
call Function91492
ret
-Function90fcd: ; 90fcd (24:4fcd)
- call Function90da8
+PokegearMap_Init: ; 90fcd (24:4fcd)
+ call InitPokegearTilemap
ld a, [wTownMapPlayerIconLandmark]
- call Function9106a
+ call PokegearMap_InitPlayerIcon
ld a, [wTownMapCursorLandmark]
- call Function91098
+ call PokegearMap_InitCursor
ld a, c
- ld [wc6d5], a
+ ld [wPokegearMapCursorObjectPointer], a
ld a, b
- ld [wc6d6], a
+ ld [wPokegearMapCursorObjectPointer + 1], a
ld hl, wJumptableIndex
inc [hl]
ret
-Function90fe9: ; 90fe9 (24:4fe9)
+PokegearMap_KantoMap: ; 90fe9 (24:4fe9)
call TownMap_GetKantoLandmarkLimits
- jr Function90ff2
+ jr PokegearMap_ContinueMap
-Function90fee: ; 90fee (24:4fee)
- ld d, $2e
- ld e, $1
-Function90ff2: ; 90ff2 (24:4ff2)
+PokegearMap_JohtoMap: ; 90fee (24:4fee)
+ ld d, SILVER_CAVE
+ ld e, NEW_BARK_TOWN
+PokegearMap_ContinueMap: ; 90ff2 (24:4ff2)
ld hl, hJoyLast
ld a, [hl]
and B_BUTTON
@@ -597,18 +579,18 @@
ld a, [hl]
and D_LEFT
jr nz, .left
- call Function9102f
+ call .DPad
ret
.right
ld a, [wPokegearFlags]
bit 2, a
- jr z, .asm_91015
+ jr z, .no_phone
ld c, $7
ld b, $2
jr .done
-.asm_91015
+.no_phone
ld a, [wPokegearFlags]
bit 1, a
ret z
@@ -620,14 +602,15 @@
ld c, $0
ld b, $0
.done
- call Function91480
+ call Pokegear_SwitchPage
ret
+
.cancel
ld hl, wJumptableIndex
set 7, [hl]
ret
-Function9102f: ; 9102f (24:502f)
+.DPad: ; 9102f (24:502f)
ld hl, hJoyLast
ld a, [hl]
and D_UP
@@ -636,50 +619,49 @@
and D_DOWN
jr nz, .down
ret
+
.up
ld hl, wTownMapCursorLandmark
ld a, [hl]
cp d
- jr c, .asm_91047
+ jr c, .wrap_around_up
ld a, e
dec a
ld [hl], a
-.asm_91047
+.wrap_around_up
inc [hl]
- jr .done
+ jr .done_dpad
.down
ld hl, wTownMapCursorLandmark
ld a, [hl]
cp e
- jr nz, .asm_91054
+ jr nz, .wrap_around_down
ld a, d
inc a
ld [hl], a
-.asm_91054
+.wrap_around_down
dec [hl]
-
-.done
+.done_dpad
ld a, [wTownMapCursorLandmark]
call Function910b4
- ld a, [wc6d5]
+ ld a, [wPokegearMapCursorObjectPointer]
ld c, a
- ld a, [wc6d6]
+ ld a, [wPokegearMapCursorObjectPointer + 1]
ld b, a
ld a, [wTownMapCursorLandmark]
call Function910d4
ret
-Function9106a: ; 9106a
+PokegearMap_InitPlayerIcon: ; 9106a
push af
depixel 0, 0
- ld b, SPRITE_ANIM_INDEX_WALK_CYCLE
+ ld b, SPRITE_ANIM_INDEX_RED_WALK
ld a, [PlayerGender]
bit 0, a
- jr z, .asm_91079
- ld b, SPRITE_ANIM_INDEX_1E
-
-.asm_91079
+ jr z, .got_gender
+ ld b, SPRITE_ANIM_INDEX_BLUE_WALK
+.got_gender
ld a, b
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
@@ -697,9 +679,10 @@
add hl, bc
ld [hl], d
ret
+
; 91098
-Function91098: ; 91098
+PokegearMap_InitCursor: ; 91098
push af
depixel 0, 0
ld a, SPRITE_ANIM_INDEX_0D
@@ -715,6 +698,7 @@
call Function910d4
pop bc
ret
+
; 910b4
Function910b4: ; 910b4
@@ -731,6 +715,7 @@
hlcoord 8, 0
ld [hl], $34
ret
+
; 910d4
Function910d4: ; 910d4
@@ -745,6 +730,7 @@
add hl, bc
ld [hl], d
ret
+
; 910e8
TownMap_GetKantoLandmarkLimits: ; 910e8
@@ -759,11 +745,11 @@
ld d, ROUTE_28
ld e, VICTORY_ROAD
ret
+
; 910f9
-
-Function910f9: ; 910f9 (24:50f9)
- call Function90da8
+PokegearRadio_Init: ; 910f9 (24:50f9)
+ call InitPokegearTilemap
depixel 4, 10, 4, 4
ld a, SPRITE_ANIM_INDEX_14
call _InitSpriteAnimStruct
@@ -775,7 +761,7 @@
inc [hl]
ret
-Function91112: ; 91112 (24:5112)
+PokegearRadio_Joypad: ; 91112 (24:5112)
ld hl, hJoyLast
ld a, [hl]
and B_BUTTON
@@ -783,11 +769,11 @@
ld a, [hl]
and D_LEFT
jr nz, .left
- ld a, [wc6da]
+ ld a, [wPokegearRadioChannelAddr]
ld l, a
- ld a, [wc6db]
+ ld a, [wPokegearRadioChannelAddr + 1]
ld h, a
- ld a, [wc6d9]
+ ld a, [wPokegearRadioChannelBank]
and a
ret z
rst FarCall
@@ -813,7 +799,7 @@
ld c, $0
ld b, $0
.asm_9114c
- call Function91480
+ call Pokegear_SwitchPage
ret
.cancel
@@ -821,20 +807,20 @@
set 7, [hl]
ret
-Function91156: ; 91156 (24:5156)
+PokegearPhone_Init: ; 91156 (24:5156)
ld hl, wJumptableIndex
inc [hl]
xor a
- ld [wc6d2], a
- ld [wc6d1], a
- ld [wc6d3], a
- call Function90da8
+ ld [wPokegearPhoneScrollPosition], a
+ ld [wPokegearPhoneCursorPosition], a
+ ld [wPokegearPhoneSelectedPerson], a
+ call InitPokegearTilemap
call Function91492
- ld hl, UnknownText_0x914ce
+ ld hl, PokegearText_WhomToCall
call PrintText
ret
-Function91171: ; 91171 (24:5171)
+PokegearPhone_Joypad: ; 91171 (24:5171)
ld hl, hJoyPressed
ld a, [hl]
and B_BUTTON
@@ -849,7 +835,7 @@
ld a, [hl]
and D_RIGHT
jr nz, .right
- call Function9126d
+ call PokegearPhone_GetDPad
ret
.left
@@ -859,6 +845,7 @@
ld c, $2
ld b, $1
jr .asm_911ac
+
.asm_9119c
ld c, $0
ld b, $0
@@ -871,7 +858,7 @@
ld c, $b
ld b, $3
.asm_911ac
- call Function91480
+ call Pokegear_SwitchPage
ret
.b
@@ -881,11 +868,11 @@
.a
ld hl, wPhoneList
- ld a, [wc6d2]
+ ld a, [wPokegearPhoneScrollPosition]
ld e, a
ld d, 0
add hl, de
- ld a, [wc6d1]
+ ld a, [wPokegearPhoneCursorPosition]
ld e, a
ld d, 0
add hl, de
@@ -892,16 +879,14 @@
ld a, [hl]
and a
ret z
-
- ld [wc6d3], a
+ ld [wPokegearPhoneSelectedPerson], a
hlcoord 1, 4
- ld a, [wc6d1]
+ ld a, [wPokegearPhoneCursorPosition]
ld bc, 20 * 2
call AddNTimes
ld [hl], "▷"
- call Function91342
+ call PokegearPhoneContactSubmenu
jr c, .asm_911e5
-
ld hl, wJumptableIndex
inc [hl]
ret
@@ -911,7 +896,7 @@
ld [wJumptableIndex], a
ret
-Function911eb: ; 911eb (24:51eb)
+PokegearPhone_MakePhoneCall: ; 911eb (24:51eb)
call GetMapHeaderPhoneServiceNybble
and a
jr nz, .asm_91234
@@ -929,7 +914,7 @@
ld hl, UnknownText_0x9124c
call PrintText
call WaitSFX
- ld a, [wc6d3]
+ ld a, [wPokegearPhoneSelectedPerson]
ld b, a
call Function90199
ld c, 10
@@ -938,10 +923,11 @@
set NO_TEXT_SCROLL, [hl]
ld a, $1
ld [hInMenu], a
- call Function912b7
+ call PokegearPhone_UpdateCursor
ld hl, wJumptableIndex
inc [hl]
ret
+
.asm_91234
callba Phone_NoSignal
ld hl, OutOfServiceAreaText
@@ -948,9 +934,10 @@
call PrintText
ld a, $8
ld [wJumptableIndex], a
- ld hl, UnknownText_0x914ce
+ ld hl, PokegearText_WhomToCall
call PrintText
ret
+
; 9124c (24:524c)
UnknownText_0x9124c: ; 0x9124c
@@ -957,6 +944,7 @@
;
text_jump UnknownText_0x1c5824
db "@"
+
; 0x91251
OutOfServiceAreaText: ; 0x91251
@@ -963,9 +951,10 @@
; You're out of the service area.
text_jump UnknownText_0x1c5827
db "@"
+
; 0x91256
-Function91256: ; 91256 (24:5256)
+PokegearPhone_FinishPhoneCall: ; 91256 (24:5256)
ld a, [hJoyPressed]
and A_BUTTON | B_BUTTON
ret z
@@ -972,11 +961,11 @@
callba HangUp
ld a, $8
ld [wJumptableIndex], a
- ld hl, UnknownText_0x914ce
+ ld hl, PokegearText_WhomToCall
call PrintText
ret
-Function9126d: ; 9126d (24:526d)
+PokegearPhone_GetDPad: ; 9126d (24:526d)
ld hl, hJoyLast
ld a, [hl]
and D_UP
@@ -987,52 +976,52 @@
ret
.up
- ld hl, wc6d1
+ ld hl, wPokegearPhoneCursorPosition
ld a, [hl]
and a
- jr z, .asm_91285
+ jr z, .scroll_page_up
dec [hl]
- jr .asm_912a3
+ jr .done_joypad_same_page
-.asm_91285
- ld hl, wc6d2
+.scroll_page_up
+ ld hl, wPokegearPhoneScrollPosition
ld a, [hl]
and a
ret z
dec [hl]
- jr .asm_912ad
+ jr .done_joypad_update_page
.down
- ld hl, wc6d1
+ ld hl, wPokegearPhoneCursorPosition
ld a, [hl]
cp $3
- jr nc, .asm_91299
+ jr nc, .scroll_page_down
inc [hl]
- jr .asm_912a3
+ jr .done_joypad_same_page
-.asm_91299
- ld hl, wc6d2
+.scroll_page_down
+ ld hl, wPokegearPhoneScrollPosition
ld a, [hl]
cp $6
ret nc
inc [hl]
- jr .asm_912ad
+ jr .done_joypad_update_page
-.asm_912a3
+.done_joypad_same_page
xor a
ld [hBGMapMode], a
- call Function912b7
+ call PokegearPhone_UpdateCursor
call WaitBGMap
ret
-.asm_912ad
+.done_joypad_update_page
xor a
ld [hBGMapMode], a
- call Function912d8
+ call PokegearPhone_UpdateDisplayList
call WaitBGMap
ret
-Function912b7: ; 912b7 (24:52b7)
+PokegearPhone_UpdateCursor: ; 912b7 (24:52b7)
ld a, " "
hlcoord 1, 4
ld [hl], a
@@ -1043,41 +1032,40 @@
hlcoord 1, 10
ld [hl], a
hlcoord 1, 4
- ld a, [wc6d1]
- ld bc, $28
+ ld a, [wPokegearPhoneCursorPosition]
+ ld bc, 2 * SCREEN_WIDTH
call AddNTimes
ld [hl], "▶"
ret
-Function912d8: ; 912d8 (24:52d8)
+PokegearPhone_UpdateDisplayList: ; 912d8 (24:52d8)
hlcoord 1, 3
- ld b, $9
- ld a, $7f
-.asm_912df
- ld c, $12
-.asm_912e1
+ ld b, 9
+ ld a, " "
+.row
+ ld c, 18
+.col
ld [hli], a
dec c
- jr nz, .asm_912e1
-rept 2
+ jr nz, .col
inc hl
-endr
+ inc hl
dec b
- jr nz, .asm_912df
- ld a, [wc6d2]
+ jr nz, .row
+ ld a, [wPokegearPhoneScrollPosition]
ld e, a
ld d, $0
ld hl, wPhoneList
add hl, de
xor a
- ld [wc6d0], a
-.asm_912f8
+ ld [wPokegearPhoneLoadNameBuffer], a
+.loop
ld a, [hli]
push hl
push af
hlcoord 2, 4
- ld a, [wc6d0]
- ld bc, $28
+ ld a, [wPokegearPhoneLoadNameBuffer]
+ ld bc, 2 * SCREEN_WIDTH
call AddNTimes
ld d, h
ld e, l
@@ -1085,66 +1073,66 @@
ld b, a
call Function90380
pop hl
- ld a, [wc6d0]
+ ld a, [wPokegearPhoneLoadNameBuffer]
inc a
- ld [wc6d0], a
+ ld [wPokegearPhoneLoadNameBuffer], a
cp $4
- jr c, .asm_912f8
- call Function912b7
+ jr c, .loop
+ call PokegearPhone_UpdateCursor
ret
+
; 9131e (24:531e)
-Function9131e: ; 9131e
+PokegearPhone_DeletePhoneNumber: ; 9131e
ld hl, wPhoneList
- ld a, [wc6d2]
+ ld a, [wPokegearPhoneScrollPosition]
ld e, a
ld d, 0
add hl, de
- ld a, [wc6d1]
+ ld a, [wPokegearPhoneCursorPosition]
ld e, a
ld d, 0
add hl, de
ld [hl], 0
ld hl, wPhoneList
- ld c, $a
-.asm_91336
+ ld c, CONTACT_LIST_SIZE
+.loop
ld a, [hli]
and a
- jr nz, .asm_9133e
+ jr nz, .skip
ld a, [hld]
ld [hli], a
ld [hl], 0
-.asm_9133e
+.skip
dec c
- jr nz, .asm_91336
+ jr nz, .loop
ret
+
; 91342
-Function91342: ; 91342 (24:5342)
+PokegearPhoneContactSubmenu: ; 91342 (24:5342)
ld hl, wPhoneList
- ld a, [wc6d2]
+ ld a, [wPokegearPhoneScrollPosition]
ld e, a
ld d, 0
add hl, de
- ld a, [wc6d1]
+ ld a, [wPokegearPhoneCursorPosition]
ld e, a
ld d, 0
add hl, de
ld c, [hl]
- callba Function9038a
+ callba CheckCanDeletePhoneNumber
ld a, c
and a
- jr z, .asm_91366
+ jr z, .cant_delete
+ ld hl, .CallDeleteCancelJumptable
+ ld de, .CallDeleteCancelStrings
+ jr .got_menu_data
- ld hl, Jumptable_91455
- ld de, Unknown_9143f
- jr .asm_9136c
-
-.asm_91366
- ld hl, Jumptable_9146a
- ld de, Unknown_9145b
-
-.asm_9136c
+.cant_delete
+ ld hl, .CallCancelJumptable
+ ld de, .CallCancelStrings
+.got_menu_data
xor a
ld [hBGMapMode], a
push hl
@@ -1171,11 +1159,10 @@
call PlaceString
pop de
xor a
- ld [wc6d4], a
- call Function9141d
+ ld [wPokegearPhoneSubmenuCursor], a
+ call .UpdateCursor
call WaitBGMap
-
-.asm_91398
+.loop
push de
call JoyTextDelay
pop de
@@ -1182,89 +1169,90 @@
ld hl, hJoyPressed
ld a, [hl]
and D_UP
- jr nz, .asm_913b4
+ jr nz, .d_up
ld a, [hl]
and D_DOWN
- jr nz, .asm_913c1
+ jr nz, .d_down
ld a, [hl]
and A_BUTTON | B_BUTTON
- jr nz, .asm_913d4
+ jr nz, .a_b
call DelayFrame
- jr .asm_91398
+ jr .loop
-.asm_913b4
- ld hl, wc6d4
+.d_up
+ ld hl, wPokegearPhoneSubmenuCursor
ld a, [hl]
and a
- jr z, .asm_91398
+ jr z, .loop
dec [hl]
- call Function9141d
- jr .asm_91398
+ call .UpdateCursor
+ jr .loop
-.asm_913c1
+.d_down
ld hl, 2
add hl, de
- ld a, [wc6d4]
+ ld a, [wPokegearPhoneSubmenuCursor]
inc a
cp [hl]
- jr nc, .asm_91398
- ld [wc6d4], a
- call Function9141d
- jr .asm_91398
+ jr nc, .loop
+ ld [wPokegearPhoneSubmenuCursor], a
+ call .UpdateCursor
+ jr .loop
-.asm_913d4
+.a_b
xor a
ld [hBGMapMode], a
- call Function912d8
+ call PokegearPhone_UpdateDisplayList
ld a, $1
ld [hBGMapMode], a
pop hl
ld a, [hJoyPressed]
and B_BUTTON
- jr nz, Function913f1
-
- ld a, [wc6d4]
+ jr nz, .Cancel
+ ld a, [wPokegearPhoneSubmenuCursor]
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
-Function913f1: ; 913f1
- ld hl, UnknownText_0x914ce
+.Cancel: ; 913f1
+ ld hl, PokegearText_WhomToCall
call PrintText
scf
ret
+
; 913f9 (24:53f9)
-Function913f9: ; 913f9
- ld hl, UnknownText_0x914d8
+.Delete: ; 913f9
+ ld hl, PokegearText_DeleteStoredNumber
call MenuTextBox
call YesNoBox
call ExitMenu
- jr c, .asm_91419
- call Function9131e
+ jr c, .CancelDelete
+ call PokegearPhone_DeletePhoneNumber
xor a
ld [hBGMapMode], a
- call Function912d8
- ld hl, UnknownText_0x914ce
+ call PokegearPhone_UpdateDisplayList
+ ld hl, PokegearText_WhomToCall
call PrintText
call WaitBGMap
-.asm_91419
+.CancelDelete
scf
ret
+
; 9141b
-Function9141b: ; 9141b
+.Call: ; 9141b
and a
ret
+
; 9141d
-Function9141d: ; 9141d (24:541d)
+.UpdateCursor: ; 9141d (24:541d)
push de
ld a, [de]
inc de
@@ -1276,22 +1264,23 @@
ld c, a
push hl
ld a, " "
- ld de, 20 * 2
-.asm_9142c
+ ld de, SCREEN_WIDTH * 2
+.clear_column
ld [hl], a
add hl, de
dec c
- jr nz, .asm_9142c
+ jr nz, .clear_column
pop hl
- ld a, [wc6d4]
- ld bc, 20 * 2
+ ld a, [wPokegearPhoneSubmenuCursor]
+ ld bc, SCREEN_WIDTH * 2
call AddNTimes
ld [hl], "▶"
pop de
ret
+
; 9143f (24:543f)
-Unknown_9143f: ; 9143f
+.CallDeleteCancelStrings: ; 9143f
dwcoord 10, 6
db 3
db "CALL"
@@ -1300,13 +1289,14 @@
db "@"
; 91455
-Jumptable_91455: ; 91455
- dw Function9141b
- dw Function913f9
- dw Function913f1
+.CallDeleteCancelJumptable: ; 91455
+ dw .Call
+ dw .Delete
+ dw .Cancel
+
; 9145b
-Unknown_9145b: ; 9145b
+.CallCancelStrings: ; 9145b
dwcoord 10, 8
db 2
db "CALL"
@@ -1314,29 +1304,29 @@
db "@"
; 9146a
-Jumptable_9146a: ; 9146a
- dw Function9141b
- dw Function913f1
+.CallCancelJumptable: ; 9146a
+ dw .Call
+ dw .Cancel
+
; 9146e
-
-Function9146e: ; 9146e
+; XXX
ld a, [hHours]
cp 12
- jr c, .asm_9147b
+ jr c, .am
sub 12
ld [wd265], a
scf
ret
-.asm_9147b
+.am
ld [wd265], a
and a
ret
+
; 91480
-
-Function91480: ; 91480 (24:5480)
+Pokegear_SwitchPage: ; 91480 (24:5480)
ld de, SFX_READ_TEXT_2
call PlaySFX
ld a, c
@@ -1347,23 +1337,23 @@
ret
Function91492: ; 91492
- ld a, [wc6dc]
+ ld a, [wPokegearRadioMusicPlaying]
cp $fe
jr z, .asm_914a3
cp $ff
call z, EnterMapMusic
xor a
- ld [wc6dc], a
+ ld [wPokegearRadioMusicPlaying], a
ret
.asm_914a3
call RestartMapMusic
xor a
- ld [wc6dc], a
+ ld [wPokegearRadioMusicPlaying], a
ret
+
; 914ab
-
DeleteSpriteAnimStruct2ToEnd: ; 914ab (24:54ab)
ld hl, SpriteAnim2
ld bc, wSpriteAnimationStructsEnd - SpriteAnim2
@@ -1373,9 +1363,9 @@
ld [wSpriteAnimCount], a
ret
-Function914bb: ; 914bb (24:54bb)
+Pokegear_LoadTilemapRLE: ; 914bb (24:54bb)
hlcoord 0, 0
-.asm_914be
+.row
ld a, [de]
cp $ff
ret z
@@ -1385,32 +1375,35 @@
ld c, a
inc de
ld a, b
-.asm_914c8
+.col
ld [hli], a
dec c
- jr nz, .asm_914c8
- jr .asm_914be
+ jr nz, .col
+ jr .row
+
; 914ce (24:54ce)
-UnknownText_0x914ce: ; 0x914ce
+PokegearText_WhomToCall: ; 0x914ce
; Whom do you want to call?
text_jump UnknownText_0x1c5847
db "@"
+
; 0x914d3
-UnknownText_0x914d3: ; 0x914d3
+PokegearText_PressAnyButtonToExit: ; 0x914d3
; Press any button to exit.
text_jump UnknownText_0x1c5862
db "@"
+
; 0x914d8
-UnknownText_0x914d8: ; 0x914d8
+PokegearText_DeleteStoredNumber: ; 0x914d8
; Delete this stored phone number?
text_jump UnknownText_0x1c587d
db "@"
+
; 0x914dd
-
PokegearSpritesGFX: ; 914dd
INCBIN "gfx/misc/pokegear_sprites.2bpp.lz"
; 9150d
@@ -1417,17 +1410,17 @@
RadioTilemapRLE: ; 9150d
INCBIN "gfx/unknown/09150d.tilemap.rle"
-
PhoneTilemapRLE: ; 9158a
INCBIN "gfx/unknown/09158a.tilemap.rle"
-
ClockTilemapRLE: ; 915db
INCBIN "gfx/unknown/0915db.tilemap.rle"
; 9163e
+
_UpdateRadioStation: ; 9163e (24:563e)
jr UpdateRadioStation
; called from engine/sprite_anims.asm
+
AnimateTuningKnob: ; 91640 (24:5640)
push bc
call .TuningKnob
@@ -1453,9 +1446,8 @@
ld a, [hl]
and a
ret z
-rept 2
dec [hl]
-endr
+ dec [hl]
jr .update
.up
@@ -1463,12 +1455,9 @@
ld a, [hl]
cp 80
ret nc
-rept 2
inc [hl]
-endr
-
+ inc [hl]
.update
-
UpdateRadioStation: ; 9166f (24:566f)
ld hl, wRadioTuningKnob
ld d, [hl]
@@ -1479,9 +1468,8 @@
jr z, .nostation
cp d
jr z, .foundstation
-rept 2
inc hl
-endr
+ inc hl
jr .loop
.nostation
@@ -1495,8 +1483,9 @@
ld de, .returnafterstation
push de
jp [hl]
+
.returnafterstation
- ld a, [wc6d9]
+ ld a, [wPokegearRadioChannelBank]
and a
ret z
xor a
@@ -1506,20 +1495,22 @@
ld a, $1
ld [hBGMapMode], a
ret
+
; 916a1 (24:56a1)
Function916a1: ; 916a1
- ld [wc6d9], a
+ ld [wPokegearRadioChannelBank], a
ld a, [hli]
- ld [wc6da], a
+ ld [wPokegearRadioChannelAddr], a
ld a, [hli]
- ld [wc6db], a
+ ld [wPokegearRadioChannelAddr + 1], a
ret
+
; 916ad
-
RadioChannels:
; frequencies and the shows that play on them.
+
; frequency value given here = 4 × ingame_frequency − 2
dbw 16, .PkmnTalkAndPokedexShow
dbw 28, .PokemonMusic
@@ -1534,6 +1525,7 @@
.PkmnTalkAndPokedexShow
; Pokédex Show in the morning
+
; Oak's Pokémon Talk in the afternoon and evening
call .InJohto
jr nc, .NoSignal
@@ -1589,11 +1581,9 @@
.EvolutionRadio
; This station airs in the Lake of Rage area when Rocket are still in Mahogany.
-
ld a, [StatusFlags]
bit 4, a
jr z, .NoSignal
-
ld a, [wTownMapPlayerIconLandmark]
cp MAHOGANY_TOWN
jr z, .ok
@@ -1610,6 +1600,7 @@
.InJohto
; if in Johto or on the S.S. Aqua, set carry
+
; otherwise clear carry
ld a, [wTownMapPlayerIconLandmark]
cp FAST_SHIP
@@ -1619,12 +1610,11 @@
.kanto
and a
ret
+
.johto
scf
ret
-
-
LoadStation_OaksPokemonTalk: ; 91753 (24:5753)
xor a ; OAKS_POKEMON_TALK
ld [wd002], a
@@ -1682,6 +1672,7 @@
ret z
ld de, BuenasPasswordName
ret
+
; 917c3 (24:57c3)
BuenasPasswordName: db "BUENA'S PASSWORD@"
@@ -1719,6 +1710,7 @@
call Radio_BackUpFarCallParams
ld de, LetsAllSingName
ret
+
; 91814 (24:5814)
LoadStation_RocketRadio: ; 91814
@@ -1731,6 +1723,7 @@
call Radio_BackUpFarCallParams
ld de, LetsAllSingName
ret
+
; 91829
LoadStation_PokeFluteRadio: ; 91829 (24:5829)
@@ -1754,6 +1747,7 @@
call Radio_BackUpFarCallParams
ld de, UnknownStationName
ret
+
; 91853 (24:5853)
LoadStation_Dummy: ; 91853
@@ -1762,7 +1756,7 @@
RadioMusicRestartDE: ; 91854 (24:5854)
push de
ld a, e
- ld [wc6dc], a
+ ld [wPokegearRadioMusicPlaying], a
ld de, MUSIC_NONE
call PlayMusic
pop de
@@ -1774,7 +1768,7 @@
RadioMusicRestartPokemonChannel: ; 91868 (24:5868)
push de
ld a, $fe
- ld [wc6dc], a
+ ld [wPokegearRadioMusicPlaying], a
ld de, MUSIC_NONE
call PlayMusic
pop de
@@ -1783,11 +1777,11 @@
ret
Radio_BackUpFarCallParams: ; 9187c (24:587c)
- ld [wc6d9], a
+ ld [wPokegearRadioChannelBank], a
ld a, l
- ld [wc6da], a
+ ld [wPokegearRadioChannelAddr], a
ld a, h
- ld [wc6db], a
+ ld [wPokegearRadioChannelAddr + 1], a
ret
NoRadioStation: ; 91888 (24:5888)
@@ -1794,9 +1788,9 @@
call NoRadioMusic
call NoRadioName
xor a
- ld [wc6d9], a
- ld [wc6da], a
- ld [wc6db], a
+ ld [wPokegearRadioChannelBank], a
+ ld [wPokegearRadioChannelAddr], a
+ ld [wPokegearRadioChannelAddr + 1], a
ld a, $1
ld [hBGMapMode], a
ret
@@ -1805,7 +1799,7 @@
ld de, MUSIC_NONE
call PlayMusic
ld a, $ff
- ld [wc6dc], a
+ ld [wPokegearRadioMusicPlaying], a
ret
NoRadioName: ; 918a9 (24:58a9)
@@ -1818,6 +1812,7 @@
ld bc, $412
call TextBox
ret
+
; 918bf
OaksPkmnTalkName: db "OAK's <PK><MN> Talk@"
@@ -1825,13 +1820,183 @@
PokemonMusicName: db "#MON Music@"
LuckyChannelName: db "Lucky Channel@"
UnknownStationName: db "?????@"
+
PlacesAndPeopleName: db "Places & People@"
LetsAllSingName: db "Let's All Sing!@"
PokeFluteStationName: db "# FLUTE@"
; 9191c
-INCLUDE "engine/town_map.asm"
+_TownMap: ; 9191c
+ ld hl, Options
+ ld a, [hl]
+ push af
+ set NO_TEXT_SCROLL, [hl]
+ ld a, [hInMenu]
+ push af
+ ld a, $1
+ ld [hInMenu], a
+
+ ld a, [VramState]
+ push af
+ xor a
+ ld [VramState], a
+
+ call ClearBGPalettes
+ call ClearTileMap
+ call ClearSprites
+ call DisableLCD
+ call Function90c4e
+ callba ClearSpriteAnims
+ ld a, 8
+ call SkipMusic
+ ld a, $e3
+ ld [rLCDC], a
+ call Function90d56
+ ld [wd002], a
+ ld [wd003], a
+ xor a
+ ld [hBGMapMode], a
+ call .InitTilemap
+ call WaitBGMap2
+ ld a, [wd002]
+ call PokegearMap_InitPlayerIcon
+ ld a, [wd003]
+ call PokegearMap_InitCursor
+ ld a, c
+ ld [wd004], a
+ ld a, b
+ ld [wd005], a
+ ld b, SCGB_POKEGEAR_PALS
+ call GetSGBLayout
+ call SetPalettes
+ ld a, [hCGB]
+ and a
+ jr z, .dmg
+ ld a, %11100100
+ call DmgToCgbObjPal0
+ call DelayFrame
+
+.dmg
+ ld a, [wd002]
+ cp KANTO_LANDMARK
+ jr nc, .kanto
+ ld d, KANTO_LANDMARK - 1
+ ld e, 1
+ call .loop
+ jr .resume
+
+.kanto
+ call TownMap_GetKantoLandmarkLimits
+ call .loop
+
+.resume
+ pop af
+ ld [VramState], a
+ pop af
+ ld [hInMenu], a
+ pop af
+ ld [Options], a
+ call ClearBGPalettes
+ ret
+
+.loop
+ call JoyTextDelay
+ ld hl, hJoyPressed
+ ld a, [hl]
+ and B_BUTTON
+ ret nz
+
+ ld hl, hJoyLast
+ ld a, [hl]
+ and D_UP
+ jr nz, .pressed_up
+
+ ld a, [hl]
+ and D_DOWN
+ jr nz, .pressed_down
+.loop2
+ push de
+ callba PlaySpriteAnimations
+ pop de
+ call DelayFrame
+ jr .loop
+
+.pressed_up
+ ld hl, wd003
+ ld a, [hl]
+ cp d
+ jr c, .okay
+ ld a, e
+ dec a
+ ld [hl], a
+
+.okay
+ inc [hl]
+ jr .next
+
+.pressed_down
+ ld hl, wd003
+ ld a, [hl]
+ cp e
+ jr nz, .okay2
+ ld a, d
+ inc a
+ ld [hl], a
+
+.okay2
+ dec [hl]
+
+.next
+ push de
+ ld a, [wd003]
+ call Function910b4
+ ld a, [wd004]
+ ld c, a
+ ld a, [wd005]
+ ld b, a
+ ld a, [wd003]
+ call Function910d4
+ pop de
+ jr .loop2
+; 91a04
+
+.InitTilemap: ; 91a04
+ ld a, [wd002]
+ cp KANTO_LANDMARK
+ jr nc, .kanto
+ ld e, $0
+ jr .okay
+
+.kanto
+ ld e, $1
+
+.okay
+ callba PokegearMap
+ ld a, $7
+ ld bc, 6
+ hlcoord 1, 0
+ call ByteFill
+ hlcoord 0, 0
+ ld [hl], $6
+ hlcoord 7, 0
+ ld [hl], $17
+ hlcoord 7, 1
+ ld [hl], $16
+ hlcoord 7, 2
+ ld [hl], $26
+ ld a, $7
+ ld bc, NAME_LENGTH
+ hlcoord 8, 2
+ call ByteFill
+ hlcoord 19, 2
+ ld [hl], $17
+ ld a, [wd003]
+ call Function910b4
+ callba TownMapPals
+ ret
+; 91a53
+
PlayRadio: ; 91a53
ld hl, Options
ld a, [hl]
@@ -1845,15 +2010,14 @@
ld a, [hJoyPressed]
and A_BUTTON | B_BUTTON
jr nz, .stop
- ld a, [wc6da]
+ ld a, [wPokegearRadioChannelAddr]
ld l, a
- ld a, [wc6db]
+ ld a, [wPokegearRadioChannelAddr + 1]
ld h, a
- ld a, [wc6d9]
+ ld a, [wPokegearRadioChannelBank]
and a
jr z, .zero
rst FarCall
-
.zero
call DelayFrame
jr .loop
@@ -1863,6 +2027,7 @@
ld [Options], a
call Function91492
ret
+
; 91a87
.PlayStation: ; 91a87
@@ -1870,9 +2035,8 @@
ld [EnemyTurnsTaken], a
ld hl, .StationPointers
ld d, $0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1895,6 +2059,7 @@
ld [hl], $73
call WaitBGMap
ret
+
; 91ab9
.StationPointers: ; 91ab9
@@ -1907,6 +2072,7 @@
dw LoadStation_PlacesAndPeople
dw LoadStation_LetsAllSing
dw LoadStation_RocketRadio
+
; 91acb
.OakOrPnP: ; 91acb
@@ -1921,6 +2087,7 @@
.kanto
jp LoadStation_PlacesAndPeople
+
; 91ae1
PokegearMap: ; 91ae1
@@ -1935,6 +2102,7 @@
call LoadTownMapGFX
call FillKantoMap
ret
+
; 91af3
_FlyMap: ; 91af3
@@ -1985,7 +2153,6 @@
ld de, Flypoints + 1
add hl, de
ld a, [hl]
-
.exit
ld [wd002], a
pop af
@@ -2000,6 +2167,7 @@
ld a, [wd002]
ld e, a
ret
+
; 91b73
FlyMapScroll: ; 91b73
@@ -2024,7 +2192,6 @@
ld a, e
dec a
ld [hl], a
-
.NotAtEndYet
inc [hl]
call CheckIfVisitedFlypoint
@@ -2039,12 +2206,10 @@
ld a, d
inc a
ld [hl], a
-
.NotAtStartYet
dec [hl]
call CheckIfVisitedFlypoint
jr z, .ScrollPrev
-
.Finally
call TownMapBubble
call WaitBGMap
@@ -2051,6 +2216,7 @@
xor a
ld [hBGMapMode], a
ret
+
; 91bb5
TownMapBubble: ; 91bb5
@@ -2060,47 +2226,38 @@
hlcoord 1, 0
ld a, $30
ld [hli], a
-
; Top row
ld bc, 16
ld a, " "
call ByteFill
-
; Top-right corner
ld a, $31
ld [hl], a
hlcoord 1, 1
-
; Middle row
ld bc, 18
ld a, " "
call ByteFill
-
; Bottom-left corner
hlcoord 1, 2
ld a, $32
ld [hli], a
-
; Bottom row
ld bc, 16
ld a, " "
call ByteFill
-
; Bottom-right corner
ld a, $33
ld [hl], a
-
; Print "Where?"
hlcoord 2, 0
ld de, .Where
call PlaceString
-
; Print the name of the default flypoint
call .Name
-
; Up/down arrows
hlcoord 18, 1
ld [hl], $34
@@ -2118,13 +2275,12 @@
ld de, Flypoints
add hl, de
ld e, [hl]
-
callba GetLandmarkName
-
hlcoord 2, 1
ld de, StringBuffer1
call PlaceString
ret
+
; 91c17
GetMapCursorCoordinates: ; 91c17
@@ -2147,6 +2303,7 @@
add hl, bc
ld [hl], d
ret
+
; 91c3c
CheckIfVisitedFlypoint: ; 91c3c
@@ -2166,6 +2323,7 @@
pop bc
and a
ret
+
; 91c50
HasVisitedSpawn: ; 91c50
@@ -2176,18 +2334,16 @@
predef FlagPredef
ld a, c
ret
+
; 91c5e
Flypoints: ; 91c5e
; landmark, spawn point
-
const_def
-
flypoint: MACRO
const FLY_\1
db \2, SPAWN_\1
ENDM
-
; Johto
flypoint NEW_BARK, NEW_BARK_TOWN
flypoint CHERRYGROVE, CHERRYGROVE_CITY
@@ -2201,10 +2357,9 @@
flypoint LAKE, LAKE_OF_RAGE
flypoint BLACKTHORN, BLACKTHORN_CITY
flypoint MT_SILVER, SILVER_CAVE
-
; Kanto
-KANTO_FLYPOINT EQU const_value
+KANTO_FLYPOINT EQU const_value
flypoint PALLET, PALLET_TOWN
flypoint VIRIDIAN, VIRIDIAN_CITY
flypoint PEWTER, PEWTER_CITY
@@ -2217,54 +2372,46 @@
flypoint FUCHSIA, FUCHSIA_CITY
flypoint CINNABAR, CINNABAR_ISLAND
flypoint INDIGO, INDIGO_PLATEAU
-
db -1
+
; 91c8f
ret_91c8f: ; 91c8f
ret
+
; 91c90
FlyMap: ; 91c90
-
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
ld c, a
call GetWorldMapLocation
-
; If we're not in a valid location, i.e. Pokecenter floor 2F,
-; the backup map information is used
+; the backup map information is used
cp SPECIAL_MAP
jr nz, .CheckRegion
-
ld a, [BackupMapGroup]
ld b, a
ld a, [BackupMapNumber]
ld c, a
call GetWorldMapLocation
-
.CheckRegion
; The first 46 locations are part of Johto. The rest are in Kanto
cp KANTO_LANDMARK
jr nc, .KantoFlyMap
-
.JohtoFlyMap
; Note that .NoKanto should be modified in tandem with this branch
-
push af
-
; Start from New Bark Town
ld a, FLY_NEW_BARK
ld [wd002], a
-
; Flypoints begin at New Bark Town...
ld [StartFlypoint], a
; ..and end at Silver Cave
ld a, FLY_MT_SILVER
ld [EndFlypoint], a
-
; Fill out the map
call FillJohtoMap
call .MapHud
@@ -2273,23 +2420,23 @@
ret
.KantoFlyMap
-
; The event that there are no flypoints enabled in a map is not
+
; accounted for. As a result, if you attempt to select a flypoint
; when there are none enabled, the game will crash. Additionally,
+
; the flypoint selection has a default starting point that
; can be flown to even if none are enabled
; To prevent both of these things from happening when the player
; enters Kanto, fly access is restricted until Indigo Plateau is
-; visited and its flypoint enabled
+; visited and its flypoint enabled
push af
ld c, SPAWN_INDIGO
call HasVisitedSpawn
and a
jr z, .NoKanto
-
; Kanto's map is only loaded if we've visited Indigo Plateau
; Flypoints begin at Pallet Town...
@@ -2298,11 +2445,10 @@
; ...and end at Indigo Plateau
ld a, FLY_INDIGO
ld [EndFlypoint], a
-
; Because Indigo Plateau is the first flypoint the player
+
; visits, it's made the default flypoint
ld [wd002], a
-
; Fill out the map
call FillKantoMap
call .MapHud
@@ -2316,24 +2462,18 @@
; Start from New Bark Town
ld a, FLY_NEW_BARK
ld [wd002], a
-
; Flypoints begin at New Bark Town...
ld [StartFlypoint], a
; ..and end at Silver Cave
ld a, FLY_MT_SILVER
ld [EndFlypoint], a
-
call FillJohtoMap
-
pop af
-
.MapHud
call TownMapBubble
call TownMapPals
-
hlbgcoord 0, 0 ; BG Map 0
call TownMapBGUpdate
-
call TownMapMon
ld a, c
ld [wd003], a
@@ -2340,6 +2480,7 @@
ld a, b
ld [wd004], a
ret
+
; 91d11
_Area: ; 91d11
@@ -2355,17 +2496,14 @@
ld [hBGMapMode], a
ld a, $1
ld [hInMenu], a
-
ld de, PokedexNestIconGFX
ld hl, VTiles0 tile $7f
lb bc, BANK(PokedexNestIconGFX), 1
call Request2bpp
-
call .GetPlayerOrFastShipIcon
ld hl, VTiles0 tile $78
ld c, 4
call Request2bpp
-
call LoadTownMapGFX
call FillKantoMap
call .PlaceString_MonsNest
@@ -2399,7 +2537,6 @@
.select
call .HideNestsShowPlayer
-
.next
call DelayFrame
jr .loop
@@ -2411,6 +2548,7 @@
pop af
ld [wd002], a
ret
+
; 91d9b
.LeftRightInput: ; 91d9b
@@ -2446,6 +2584,7 @@
ld a, 1 ; Kanto
call .GetAndPlaceNest
ret
+
; 91dcd
.BlinkNestIcons: ; 91dcd
@@ -2465,6 +2604,7 @@
ld bc, SpritesEnd - Sprites
call CopyBytes
ret
+
; 91de9
.PlaceString_MonsNest: ; 91de9
@@ -2487,6 +2627,7 @@
ld de, .String_SNest
call PlaceString
ret
+
; 91e16
.String_SNest:
@@ -2530,12 +2671,12 @@
ld bc, SpritesEnd - Sprites
call CopyBytes
ret
+
; 91e5a
.HideNestsShowPlayer: ; 91e5a
call .CheckPlayerLocation
ret c
-
ld a, [wd002]
ld e, a
callba GetLandmarkCoords
@@ -2547,21 +2688,17 @@
ld a, [de]
cp $80
jr z, .copy
-
add b
ld [hli], a
inc de
-
ld a, [de]
add c
ld [hli], a
inc de
-
ld a, [de]
add $78 ; where the player's sprite is loaded
ld [hli], a
inc de
-
push bc
ld c, 0 ; RED
ld a, [PlayerGender]
@@ -2572,7 +2709,6 @@
ld a, c
ld [hli], a
pop bc
-
jr .ShowPlayerLoop
.copy
@@ -2581,6 +2717,7 @@
xor a
call ByteFill
ret
+
; 91e9c
.PlayerOAM: ; 91e9c
@@ -2593,6 +2730,7 @@
.CheckPlayerLocation: ; 91ea9
; Don't show the player's sprite if you're
+
; not in the same region as what's currently
; on the screen.
ld a, [wd002]
@@ -2600,7 +2738,6 @@
jr z, .johto
cp KANTO_LANDMARK
jr c, .johto
-
.kanto
ld a, [wd003]
and a
@@ -2611,7 +2748,6 @@
ld a, [wd003]
and a
jr nz, .clear
-
.ok
and a
ret
@@ -2623,6 +2759,7 @@
call ByteFill
scf
ret
+
; 91ed0
.GetPlayerOrFastShipIcon: ; 91ed0
@@ -2636,6 +2773,7 @@
ld de, FastShipGFX
ld b, BANK(FastShipGFX)
ret
+
; 91ee4
TownMapBGUpdate: ; 91ee4
@@ -2646,29 +2784,26 @@
ld [hBGMapAddress], a
ld a, h
ld [hBGMapAddress + 1], a
-
; Only update palettes on CGB
ld a, [hCGB]
and a
jr z, .tiles
-
; BG Map mode 2 (palettes)
ld a, 2
ld [hBGMapMode], a
-
; The BG Map is updated in thirds, so we wait
+
; 3 frames to update the whole screen's palettes.
ld c, 3
call DelayFrames
-
.tiles
; Update BG Map tiles
call WaitBGMap
-
; Turn off BG Map update
xor a
ld [hBGMapMode], a
ret
+
; 91eff
FillJohtoMap: ; 91eff
@@ -2677,7 +2812,6 @@
FillKantoMap: ; 91f04
ld de, KantoMap
-
FillTownMap: ; 91f07
hlcoord 0, 0
.loop
@@ -2688,11 +2822,11 @@
ld [hli], a
inc de
jr .loop
+
; 91f13
TownMapPals: ; 91f13
; Assign palettes based on tile ids
-
hlcoord 0, 0
decoord 0, 0, AttrMap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
@@ -2700,17 +2834,15 @@
; Current tile
ld a, [hli]
push hl
-
; HP/borders use palette 0
cp $60
jr nc, .pal0
-
; The palette data is condensed to nybbles,
+
; least-significant first.
ld hl, TownMapPalMap
srl a
jr c, .odd
-
; Even-numbered tile ids take the bottom nybble...
add l
ld l, a
@@ -2735,7 +2867,6 @@
.pal0
xor a
-
.update
pop hl
ld [de], a
@@ -2766,16 +2897,13 @@
add hl, de
ld a, [hl]
ld [wd265], a
-
; Get FlyMon icon
ld e, 8 ; starting tile in VRAM
callba GetSpeciesIcon
-
; Animation/palette
depixel 0, 0
ld a, SPRITE_ANIM_INDEX_00
call _InitSpriteAnimStruct
-
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], $8
@@ -2783,19 +2911,17 @@
add hl, bc
ld [hl], SPRITE_ANIM_SEQ_NULL
ret
+
; 91fa6
TownMapPlayerIcon: ; 91fa6
; Draw the player icon at town map location in a
push af
-
callba GetPlayerIcon
-
; Standing icon
ld hl, VTiles0 tile $10
ld c, 4 ; # tiles
call Request2bpp
-
; Walking icon
ld hl, $c0
add hl, de
@@ -2805,28 +2931,24 @@
ld c, 4 ; # tiles
ld a, BANK(ChrisSpriteGFX) ; does nothing
call Request2bpp
-
; Animation/palette
depixel 0, 0
- ld b, SPRITE_ANIM_INDEX_WALK_CYCLE ; Male
+ ld b, SPRITE_ANIM_INDEX_RED_WALK ; Male
ld a, [PlayerGender]
bit 0, a
jr z, .got_gender
- ld b, SPRITE_ANIM_INDEX_1E ; Female
+ ld b, SPRITE_ANIM_INDEX_BLUE_WALK ; Female
.got_gender
ld a, b
call _InitSpriteAnimStruct
-
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], $10
-
pop af
ld e, a
push bc
callba GetLandmarkCoords
pop bc
-
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], e
@@ -2834,6 +2956,7 @@
add hl, bc
ld [hl], d
ret
+
; 0x91ff2
LoadTownMapGFX: ; 91ff2
@@ -2842,9 +2965,9 @@
lb bc, BANK(TownMapGFX), $30
call DecompressRequest2bpp
ret
+
; 91fff
-
JohtoMap: ; 91fff
INCBIN "gfx/misc/johto.bin"
; 92168
@@ -2855,10 +2978,8 @@
PokedexNestIconGFX: ; 922d1
INCBIN "gfx/pokegear/dexmap_nest_icon.2bpp"
-
FlyMapLabelBorderGFX: ; 922e1
INCBIN "gfx/pokegear/flymap_label_border.2bpp"
-
Function92311: ; 92311
; unreferenced
xor a
@@ -2923,7 +3044,6 @@
ld de, Flypoints + 1
add hl, de
ld a, [hl]
-
.asm_9239f
ld [wd002], a
pop af
@@ -2938,6 +3058,7 @@
ld a, [wd002]
ld e, a
ret
+
; 923b8
.HandleDPad: ; 923b8
@@ -2968,12 +3089,10 @@
ld [hl], FLY_INDIGO + 1
.okay_ul
dec [hl]
-
.continue
ld a, [wd002]
cp KANTO_FLYPOINT
jr c, .johto
-
call FillKantoMap
xor a
ld b, $9c
@@ -2983,7 +3102,6 @@
call FillJohtoMap
ld a, $90
ld b, $98
-
.finish
ld [hWY], a
ld a, b
@@ -2993,4 +3111,5 @@
xor a
ld [hBGMapMode], a
ret
+
; 92402
--- a/engine/town_map.asm
+++ /dev/null
@@ -1,171 +1,0 @@
-
-_TownMap: ; 9191c
- ld hl, Options
- ld a, [hl]
- push af
- set NO_TEXT_SCROLL, [hl]
-
- ld a, [hInMenu]
- push af
- ld a, $1
- ld [hInMenu], a
-
- ld a, [VramState]
- push af
- xor a
- ld [VramState], a
-
- call ClearBGPalettes
- call ClearTileMap
- call ClearSprites
- call DisableLCD
- call Function90c4e
- callba ClearSpriteAnims
- ld a, 8
- call SkipMusic
- ld a, $e3
- ld [rLCDC], a
- call Function90d56
- ld [wd002], a
- ld [wd003], a
- xor a
- ld [hBGMapMode], a
- call Function91a04
- call WaitBGMap2
- ld a, [wd002]
- call Function9106a
- ld a, [wd003]
- call Function91098
- ld a, c
- ld [wd004], a
- ld a, b
- ld [wd005], a
- ld b, SCGB_POKEGEAR_PALS
- call GetSGBLayout
- call SetPalettes
- ld a, [hCGB]
- and a
- jr z, .dmg
- ld a, %11100100
- call DmgToCgbObjPal0
- call DelayFrame
-
-.dmg
- ld a, [wd002]
- cp KANTO_LANDMARK
- jr nc, .kanto
- ld d, KANTO_LANDMARK - 1
- ld e, 1
- call .loop
- jr .resume
-
-.kanto
- call TownMap_GetKantoLandmarkLimits
- call .loop
-
-.resume
- pop af
- ld [VramState], a
- pop af
- ld [hInMenu], a
- pop af
- ld [Options], a
- call ClearBGPalettes
- ret
-
-.loop
- call JoyTextDelay
- ld hl, hJoyPressed
- ld a, [hl]
- and B_BUTTON
- ret nz
-
- ld hl, hJoyLast
- ld a, [hl]
- and D_UP
- jr nz, .pressed_up
-
- ld a, [hl]
- and D_DOWN
- jr nz, .pressed_down
-.loop2
- push de
- callba PlaySpriteAnimations
- pop de
- call DelayFrame
- jr .loop
-
-.pressed_up
- ld hl, wd003
- ld a, [hl]
- cp d
- jr c, .okay
- ld a, e
- dec a
- ld [hl], a
-
-.okay
- inc [hl]
- jr .next
-
-.pressed_down
- ld hl, wd003
- ld a, [hl]
- cp e
- jr nz, .okay2
- ld a, d
- inc a
- ld [hl], a
-
-.okay2
- dec [hl]
-
-.next
- push de
- ld a, [wd003]
- call Function910b4
- ld a, [wd004]
- ld c, a
- ld a, [wd005]
- ld b, a
- ld a, [wd003]
- call Function910d4
- pop de
- jr .loop2
-; 91a04
-
-Function91a04: ; 91a04
- ld a, [wd002]
- cp KANTO_LANDMARK
- jr nc, .kanto
- ld e, $0
- jr .okay
-
-.kanto
- ld e, $1
-
-.okay
- callba PokegearMap
- ld a, $7
- ld bc, 6
- hlcoord 1, 0
- call ByteFill
- hlcoord 0, 0
- ld [hl], $6
- hlcoord 7, 0
- ld [hl], $17
- hlcoord 7, 1
- ld [hl], $16
- hlcoord 7, 2
- ld [hl], $26
- ld a, $7
- ld bc, NAME_LENGTH
- hlcoord 8, 2
- call ByteFill
- hlcoord 19, 2
- ld [hl], $17
- ld a, [wd003]
- call Function910b4
- callba TownMapPals
- ret
-; 91a53
--- a/event/field_moves.asm
+++ b/event/field_moves.asm
@@ -330,7 +330,7 @@
ld [VramState], a
call FlyFunction_InitGFX
depixel 10, 10, 4, 0
- ld a, SPRITE_ANIM_INDEX_WALK_CYCLE
+ ld a, SPRITE_ANIM_INDEX_RED_WALK
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
@@ -365,7 +365,7 @@
ld [VramState], a
call FlyFunction_InitGFX
depixel 31, 10, 4, 0
- ld a, SPRITE_ANIM_INDEX_WALK_CYCLE
+ ld a, SPRITE_ANIM_INDEX_RED_WALK
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
--- a/macros/wram.asm
+++ b/macros/wram.asm
@@ -232,3 +232,20 @@
\1PP:: ds 1
\1EffectChance:: ds 1
endm
+
+slot_reel: MACRO
+\1ReelAction:: db
+\1TilemapAddr:: dw
+\1Position:: db
+\1SpinDistance:: db
+\1SpinRate:: db
+\1OAMAddr:: dw
+\1XCoord:: db
+\1Slot09:: ds 1
+\1Slot0a:: ds 1
+\1Slot0b:: ds 1
+\1Slot0c:: ds 1
+\1Slot0d:: ds 1
+\1Slot0e:: ds 1
+\1Slot0f:: ds 1
+endm
\ No newline at end of file
--- a/text/common_1.asm
+++ b/text/common_1.asm
@@ -368,10 +368,10 @@
done
UnknownText_0x1bc6e9::
- text_from_ram wc6d1
+ text_from_ram wPlayerTrademonSpeciesName
text " was"
line "sent to @"
- text_from_ram wc719
+ text_from_ram wOTTrademonSenderName
text "."
done
@@ -380,13 +380,13 @@
done
UnknownText_0x1bc703::
- text_from_ram wc719
+ text_from_ram wOTTrademonSenderName
text " bids"
line "farewell to"
done
UnknownText_0x1bc719::
- text_from_ram wc703
+ text_from_ram wOTTrademonSpeciesName
text "."
done
@@ -393,64 +393,64 @@
UnknownText_0x1bc71f::
text "Take good care of"
line "@"
- text_from_ram wc703
+ text_from_ram wOTTrademonSpeciesName
text "."
done
UnknownText_0x1bc739::
text "For @"
- text_from_ram wc6e7
+ text_from_ram wPlayerTrademonSenderName
text "'s"
line "@"
- text_from_ram wc6d1
+ text_from_ram wPlayerTrademonSpeciesName
text ","
done
UnknownText_0x1bc74c::
- text_from_ram wc719
+ text_from_ram wOTTrademonSenderName
text " sends"
line "@"
- text_from_ram wc703
+ text_from_ram wOTTrademonSpeciesName
text "."
done
UnknownText_0x1bc75e::
- text_from_ram wc719
+ text_from_ram wOTTrademonSenderName
text " will"
line "trade @"
- text_from_ram wc703
+ text_from_ram wOTTrademonSpeciesName
db "@@"
UnknownText_0x1bc774::
text "for @"
- text_from_ram wc6e7
+ text_from_ram wPlayerTrademonSenderName
text "'s"
line "@"
- text_from_ram wc6d1
+ text_from_ram wPlayerTrademonSpeciesName
text "."
done
UnknownText_0x1bc787::
- text_from_ram wc6e7
+ text_from_ram wPlayerTrademonSenderName
text " will"
line "trade @"
- text_from_ram wc6d1
+ text_from_ram wPlayerTrademonSpeciesName
db "@@"
UnknownText_0x1bc79d::
text "for @"
- text_from_ram wc719
+ text_from_ram wOTTrademonSenderName
text "'s"
line "@"
- text_from_ram wc703
+ text_from_ram wOTTrademonSpeciesName
text "."
done
UnknownText_0x1bc7b0::
- text_from_ram wc6e7
+ text_from_ram wPlayerTrademonSenderName
text "'s"
line "@"
- text_from_ram wc6d1
+ text_from_ram wPlayerTrademonSpeciesName
text " trade…"
done
@@ -457,15 +457,15 @@
UnknownText_0x1bc7c3::
text "Take good care of"
line "@"
- text_from_ram wc703
+ text_from_ram wOTTrademonSpeciesName
text "."
done
UnknownText_0x1bc7dd::
- text_from_ram wc6e7
+ text_from_ram wPlayerTrademonSenderName
text "'s"
line "@"
- text_from_ram wc6d1
+ text_from_ram wPlayerTrademonSpeciesName
text " trade…"
done
@@ -472,12 +472,12 @@
UnknownText_0x1bc7f0::
text "Take good care of"
line "@"
- text_from_ram wc703
+ text_from_ram wOTTrademonSpeciesName
text "."
done
UnknownText_0x1bc80a::
- text_from_ram wc703
+ text_from_ram wOTTrademonSpeciesName
text " came"
line "back!"
done
--- a/wram.asm
+++ b/wram.asm
@@ -574,44 +574,34 @@
wc6d0::
PlayerSDefLevel:: ; c6d0
ds 1
-wc6d1::
PlayerAccLevel:: ; c6d1
ds 1
-wc6d2::
PlayerEvaLevel:: ; c6d2
ds 1
; c6d3
-wc6d3:: ds 1
+ ds 1
PlayerStatLevelsEnd::
-wc6d4::
EnemyStatLevels:: ; c6d4
; 07 neutral
EnemyAtkLevel:: ; c6d4
ds 1
-wc6d5::
EnemyDefLevel:: ; c6d5
ds 1
-wc6d6::
EnemySpdLevel:: ; c6d6
ds 1
-wc6d7::
wTownMapCursorLandmark::
EnemySAtkLevel:: ; c6d7
ds 1
-wc6d8::
wTownMapPlayerIconLandmark::
EnemySDefLevel:: ; c6d8
ds 1
-wc6d9::
EnemyAccLevel:: ; c6d9
ds 1
-wc6da::
EnemyEvaLevel:: ; c6da
ds 1
-wc6db:: ds 1
-wc6dc::
+ ds 1
EnemyTurnsTaken:: ; c6dc
ds 1
PlayerTurnsTaken:: ; c6dd
@@ -621,7 +611,6 @@
PlayerSubstituteHP:: ; c6df
ds 1
-wc6e0::
EnemySubstituteHP:: ; c6e0
ds 1
@@ -820,6 +809,7 @@
wc7bd::
ds wc6d0 - @
+; naming screen
wNamingScreenDestinationPointer:: ds 2 ; c6d0
wNamingScreenCurrNameLength:: ds 1 ; c6d2
wNamingScreenMaxNameLength:: ds 1 ; c6d3
@@ -829,24 +819,21 @@
wNamingScreenStringEntryCoord:: ds 2 ; c6d8
ds wc6d0 - @
-; Slot Machine
+; pokegear
+wPokegearPhoneLoadNameBuffer:: ds 1 ; c6d0
+wPokegearPhoneCursorPosition:: ds 1 ; c6d1
+wPokegearPhoneScrollPosition:: ds 1 ; c6d2
+wPokegearPhoneSelectedPerson:: ds 1 ; c6d3
+wPokegearPhoneSubmenuCursor:: ds 1 ; c6d4
+wPokegearMapCursorObjectPointer:: ds 2 ; c6d5
+ ds 2
+wPokegearRadioChannelBank:: ds 1 ; c6d9
+wPokegearRadioChannelAddr:: ds 2 ; c6da
+wPokegearRadioMusicPlaying:: ds 1 ; c6dc
+ ds wc6d0 - @
+
wSlots::
-slot_reel: MACRO
-\1ReelAction:: db
-\1TilemapAddr:: dw
-\1Position:: db
-\1SpinDistance:: db
-\1SpinRate:: db
-\1OAMAddr:: dw
-\1XCoord:: db
-\1Slot09:: ds 1
-\1Slot0a:: ds 1
-\1Slot0b:: ds 1
-\1Slot0c:: ds 1
-\1Slot0d:: ds 1
-\1Slot0e:: ds 1
-\1Slot0f:: ds 1
-endm
+; Slot Machine
; c6d0
wReel1:: slot_reel wReel1
wReel2:: slot_reel wReel2
@@ -2577,6 +2564,11 @@
ds 1
wPokegearFlags:: ds 1
+; bit 0: map
+; bit 1: radio
+; bit 2: phone
+; bit 3: expn
+; bit 7: on/off
wRadioTuningKnob:: ds 1
wLastDexMode:: ds 2
WhichRegisteredItem:: ; d95b