2018-01-11 19:16:17 -08:00
|
|
|
NAMINGSCREEN_CURSOR EQU $7e
|
|
|
|
|
2018-01-18 23:30:19 -08:00
|
|
|
NAMINGSCREEN_BORDER EQUS "\"■\"" ; $60
|
2018-01-11 19:16:17 -08:00
|
|
|
NAMINGSCREEN_MIDDLELINE EQUS "\"→\"" ; $eb
|
|
|
|
NAMINGSCREEN_UNDERLINE EQUS "\"<DOT>\"" ; $f2
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
_NamingScreen:
|
2015-11-11 13:11:08 -08:00
|
|
|
call DisableSpriteUpdates
|
|
|
|
call NamingScreen
|
2015-12-18 17:07:09 -08:00
|
|
|
call ReturnToMapWithSpeechTextbox
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenDestinationPointer
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenType
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [hl], b
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wOptions
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
set NO_TEXT_SCROLL, [hl]
|
|
|
|
ld a, [hMapAnims]
|
|
|
|
push af
|
|
|
|
xor a
|
|
|
|
ld [hMapAnims], a
|
|
|
|
ld a, [hInMenu]
|
|
|
|
push af
|
|
|
|
ld a, $1
|
|
|
|
ld [hInMenu], a
|
2016-01-09 13:28:22 -08:00
|
|
|
call .SetUpNamingScreen
|
2015-11-11 13:11:08 -08:00
|
|
|
call DelayFrame
|
2016-01-09 13:28:22 -08:00
|
|
|
.loop
|
|
|
|
call NamingScreenJoypadLoop
|
|
|
|
jr nc, .loop
|
2015-11-11 13:11:08 -08:00
|
|
|
pop af
|
|
|
|
ld [hInMenu], a
|
|
|
|
pop af
|
|
|
|
ld [hMapAnims], a
|
|
|
|
pop af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wOptions], a
|
2015-11-11 13:11:08 -08:00
|
|
|
call ClearJoypad
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.SetUpNamingScreen:
|
2015-11-11 20:38:57 -08:00
|
|
|
call ClearBGPalettes
|
2016-06-06 15:23:00 -07:00
|
|
|
ld b, SCGB_DIPLOMA
|
2015-11-11 13:11:08 -08:00
|
|
|
call GetSGBLayout
|
|
|
|
call DisableLCD
|
2016-01-09 13:28:22 -08:00
|
|
|
call LoadNamingScreenGFX
|
|
|
|
call NamingScreen_InitText
|
2017-12-29 10:22:33 -08:00
|
|
|
ld a, LCDC_DEFAULT
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [rLCDC], a
|
2016-01-09 13:28:22 -08:00
|
|
|
call .GetNamingScreenSetup
|
2015-11-11 13:11:08 -08:00
|
|
|
call WaitBGMap
|
|
|
|
call WaitTop
|
|
|
|
call SetPalettes
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_InitNameEntry
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.GetNamingScreenSetup:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [wNamingScreenType]
|
2015-11-11 13:11:08 -08:00
|
|
|
and 7
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, .Jumptable
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, de
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, de
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 14:01:10 -07:00
|
|
|
jp hl
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Jumptable:
|
2016-01-09 13:28:22 -08:00
|
|
|
dw .Pokemon
|
|
|
|
dw .Player
|
|
|
|
dw .Rival
|
|
|
|
dw .Mom
|
|
|
|
dw .Box
|
|
|
|
dw .Tomodachi
|
|
|
|
dw .Pokemon
|
|
|
|
dw .Pokemon
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Pokemon:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [wd265], a
|
2016-03-01 19:31:21 -08:00
|
|
|
ld hl, LoadMenuMonIcon
|
|
|
|
ld a, BANK(LoadMenuMonIcon)
|
2015-11-11 13:11:08 -08:00
|
|
|
ld e, $1
|
2016-03-01 19:31:21 -08:00
|
|
|
rst FarCall ; ; indirect jump to LoadMenuMonIcon (8e83f (23:683f))
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [wd265], a
|
|
|
|
call GetPokemonName
|
|
|
|
hlcoord 5, 2
|
|
|
|
call PlaceString
|
|
|
|
ld l, c
|
|
|
|
ld h, b
|
2016-01-09 13:28:22 -08:00
|
|
|
ld de, .NicknameStrings
|
2015-11-11 13:11:08 -08:00
|
|
|
call PlaceString
|
|
|
|
inc de
|
|
|
|
hlcoord 5, 4
|
|
|
|
call PlaceString
|
2018-01-16 11:30:10 -08:00
|
|
|
farcall GetGender
|
2016-01-09 13:28:22 -08:00
|
|
|
jr c, .genderless
|
|
|
|
ld a, "♂"
|
|
|
|
jr nz, .place_gender
|
|
|
|
ld a, "♀"
|
|
|
|
.place_gender
|
2015-11-11 13:11:08 -08:00
|
|
|
hlcoord 1, 2
|
|
|
|
ld [hl], a
|
2016-01-09 13:28:22 -08:00
|
|
|
.genderless
|
|
|
|
call .StoreMonIconParams
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.NicknameStrings:
|
2015-11-11 13:11:08 -08:00
|
|
|
db "'S@"
|
|
|
|
db "NICKNAME?@"
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Player:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall GetPlayerIcon
|
2016-01-09 13:28:22 -08:00
|
|
|
call .LoadSprite
|
2015-11-11 13:11:08 -08:00
|
|
|
hlcoord 5, 2
|
2016-01-09 13:28:22 -08:00
|
|
|
ld de, .PlayerNameString
|
2015-11-11 13:11:08 -08:00
|
|
|
call PlaceString
|
2016-01-09 13:28:22 -08:00
|
|
|
call .StoreSpriteIconParams
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PlayerNameString:
|
2015-11-11 13:11:08 -08:00
|
|
|
db "YOUR NAME?@"
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Rival:
|
2015-11-11 13:11:08 -08:00
|
|
|
ld de, SilverSpriteGFX
|
|
|
|
ld b, BANK(SilverSpriteGFX)
|
2016-01-09 13:28:22 -08:00
|
|
|
call .LoadSprite
|
2015-11-11 13:11:08 -08:00
|
|
|
hlcoord 5, 2
|
2016-01-09 13:28:22 -08:00
|
|
|
ld de, .RivalNameString
|
2015-11-11 13:11:08 -08:00
|
|
|
call PlaceString
|
2016-01-09 13:28:22 -08:00
|
|
|
call .StoreSpriteIconParams
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.RivalNameString:
|
2015-11-11 13:11:08 -08:00
|
|
|
db "RIVAL'S NAME?@"
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Mom:
|
2015-11-11 13:11:08 -08:00
|
|
|
ld de, MomSpriteGFX
|
|
|
|
ld b, BANK(MomSpriteGFX)
|
2016-01-09 13:28:22 -08:00
|
|
|
call .LoadSprite
|
2015-11-11 13:11:08 -08:00
|
|
|
hlcoord 5, 2
|
2016-01-09 13:28:22 -08:00
|
|
|
ld de, .MomNameString
|
2015-11-11 13:11:08 -08:00
|
|
|
call PlaceString
|
2016-01-09 13:28:22 -08:00
|
|
|
call .StoreSpriteIconParams
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.MomNameString:
|
2015-11-11 13:11:08 -08:00
|
|
|
db "MOTHER'S NAME?@"
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Box:
|
2015-11-11 13:11:08 -08:00
|
|
|
ld de, PokeBallSpriteGFX
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles0 tile $00
|
2018-01-14 16:43:35 -08:00
|
|
|
lb bc, BANK(PokeBallSpriteGFX), 4
|
2015-11-11 13:11:08 -08:00
|
|
|
call Request2bpp
|
|
|
|
xor a
|
2016-01-09 20:41:03 -08:00
|
|
|
ld hl, wSpriteAnimDict
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
2015-11-18 10:01:55 -08:00
|
|
|
depixel 4, 4, 4, 0
|
2016-01-09 20:41:03 -08:00
|
|
|
ld a, SPRITE_ANIM_INDEX_RED_WALK
|
2015-11-13 07:48:49 -08:00
|
|
|
call _InitSpriteAnimStruct
|
2015-12-05 12:38:25 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $0
|
|
|
|
hlcoord 5, 2
|
2016-01-09 13:28:22 -08:00
|
|
|
ld de, .BoxNameString
|
2015-11-11 13:11:08 -08:00
|
|
|
call PlaceString
|
2016-01-09 13:28:22 -08:00
|
|
|
call .StoreBoxIconParams
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.BoxNameString:
|
2015-11-11 13:11:08 -08:00
|
|
|
db "BOX NAME?@"
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Tomodachi:
|
2015-11-11 13:11:08 -08:00
|
|
|
hlcoord 3, 2
|
2016-01-09 13:28:22 -08:00
|
|
|
ld de, .oTomodachi_no_namae_sutoringu
|
2015-11-11 13:11:08 -08:00
|
|
|
call PlaceString
|
2016-01-09 13:28:22 -08:00
|
|
|
call .StoreSpriteIconParams
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.oTomodachi_no_namae_sutoringu
|
2018-01-19 18:49:16 -08:00
|
|
|
db "おともだち の なまえは?@"
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.LoadSprite:
|
2015-11-11 13:11:08 -08:00
|
|
|
push de
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles0 tile $00
|
2015-11-11 13:11:08 -08:00
|
|
|
ld c, $4
|
|
|
|
push bc
|
|
|
|
call Request2bpp
|
|
|
|
pop bc
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, 12 tiles
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, de
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles0 tile $04
|
2015-11-11 13:11:08 -08:00
|
|
|
call Request2bpp
|
|
|
|
xor a
|
2016-01-09 20:41:03 -08:00
|
|
|
ld hl, wSpriteAnimDict
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
pop de
|
2016-01-09 20:41:03 -08:00
|
|
|
ld b, SPRITE_ANIM_INDEX_RED_WALK
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, d
|
2017-12-25 10:40:10 -08:00
|
|
|
cp HIGH(KrisSpriteGFX)
|
2016-01-09 13:28:22 -08:00
|
|
|
jr nz, .not_kris
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, e
|
2017-12-25 10:40:10 -08:00
|
|
|
cp LOW(KrisSpriteGFX)
|
2016-01-09 13:28:22 -08:00
|
|
|
jr nz, .not_kris
|
2016-01-09 20:41:03 -08:00
|
|
|
ld b, SPRITE_ANIM_INDEX_BLUE_WALK
|
2016-01-09 13:28:22 -08:00
|
|
|
.not_kris
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, b
|
2015-11-18 10:01:55 -08:00
|
|
|
depixel 4, 4, 4, 0
|
2015-11-13 07:48:49 -08:00
|
|
|
call _InitSpriteAnimStruct
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.StoreMonIconParams:
|
2018-01-20 09:25:55 -08:00
|
|
|
ld a, MON_NAME_LENGTH - 1
|
2015-11-11 13:11:08 -08:00
|
|
|
hlcoord 5, 6
|
2016-01-09 13:28:22 -08:00
|
|
|
jr .StoreParams
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.StoreSpriteIconParams:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, PLAYER_NAME_LENGTH - 1
|
2015-11-11 13:11:08 -08:00
|
|
|
hlcoord 5, 6
|
2016-01-09 13:28:22 -08:00
|
|
|
jr .StoreParams
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.StoreBoxIconParams:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, BOX_NAME_LENGTH - 1
|
2015-11-11 13:11:08 -08:00
|
|
|
hlcoord 5, 4
|
2016-01-09 13:28:22 -08:00
|
|
|
jr .StoreParams
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.StoreParams:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld [wNamingScreenMaxNameLength], a
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, l
|
2016-01-09 13:28:22 -08:00
|
|
|
ld [wNamingScreenStringEntryCoord], a
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, h
|
2016-01-09 13:28:22 -08:00
|
|
|
ld [wNamingScreenStringEntryCoord + 1], a
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen_IsTargetBox:
|
2015-11-11 13:11:08 -08:00
|
|
|
push bc
|
|
|
|
push af
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [wNamingScreenType]
|
2015-11-11 13:11:08 -08:00
|
|
|
sub $3
|
|
|
|
ld b, a
|
|
|
|
pop af
|
|
|
|
dec b
|
|
|
|
pop bc
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen_InitText:
|
2015-11-11 13:11:08 -08:00
|
|
|
call WaitTop
|
|
|
|
hlcoord 0, 0
|
|
|
|
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
|
2018-01-11 19:16:17 -08:00
|
|
|
ld a, NAMINGSCREEN_BORDER
|
2015-11-11 13:11:08 -08:00
|
|
|
call ByteFill
|
|
|
|
hlcoord 1, 1
|
|
|
|
lb bc, 6, 18
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_IsTargetBox
|
|
|
|
jr nz, .not_box
|
2015-11-11 13:11:08 -08:00
|
|
|
lb bc, 4, 18
|
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
.not_box
|
2015-11-11 13:11:08 -08:00
|
|
|
call ClearBox
|
|
|
|
ld de, NameInputUpper
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen_ApplyTextInputMode:
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_IsTargetBox
|
|
|
|
jr nz, .not_box
|
2015-11-11 13:11:08 -08:00
|
|
|
ld hl, BoxNameInputLower - NameInputLower
|
|
|
|
add hl, de
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
.not_box
|
2015-11-11 13:11:08 -08:00
|
|
|
push de
|
|
|
|
hlcoord 1, 8
|
|
|
|
lb bc, 7, 18
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_IsTargetBox
|
|
|
|
jr nz, .not_box_2
|
2015-11-11 13:11:08 -08:00
|
|
|
hlcoord 1, 6
|
|
|
|
lb bc, 9, 18
|
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
.not_box_2
|
2015-11-11 13:11:08 -08:00
|
|
|
call ClearBox
|
|
|
|
hlcoord 1, 16
|
|
|
|
lb bc, 1, 18
|
|
|
|
call ClearBox
|
|
|
|
pop de
|
|
|
|
hlcoord 2, 8
|
|
|
|
ld b, $5
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_IsTargetBox
|
|
|
|
jr nz, .row
|
2015-11-11 13:11:08 -08:00
|
|
|
hlcoord 2, 6
|
|
|
|
ld b, $6
|
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
.row
|
2015-11-11 13:11:08 -08:00
|
|
|
ld c, $11
|
2016-01-09 13:28:22 -08:00
|
|
|
.col
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [de]
|
|
|
|
ld [hli], a
|
|
|
|
inc de
|
|
|
|
dec c
|
2016-01-09 13:28:22 -08:00
|
|
|
jr nz, .col
|
2015-11-11 13:11:08 -08:00
|
|
|
push de
|
2016-01-09 13:28:22 -08:00
|
|
|
ld de, 2 * SCREEN_WIDTH - $11
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, de
|
|
|
|
pop de
|
|
|
|
dec b
|
2016-01-09 13:28:22 -08:00
|
|
|
jr nz, .row
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreenJoypadLoop:
|
2015-11-11 13:11:08 -08:00
|
|
|
call JoyTextDelay
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
bit 7, a
|
2016-01-09 13:28:22 -08:00
|
|
|
jr nz, .quit
|
|
|
|
call .RunJumptable
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall PlaySpriteAnimationsAndDelayFrame
|
2016-01-09 13:28:22 -08:00
|
|
|
call .UpdateStringEntry
|
2015-11-11 13:11:08 -08:00
|
|
|
call DelayFrame
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
.quit
|
2017-12-24 09:47:30 -08:00
|
|
|
callfar ClearSpriteAnims
|
2015-11-11 13:11:08 -08:00
|
|
|
call ClearSprites
|
|
|
|
xor a
|
|
|
|
ld [hSCX], a
|
|
|
|
ld [hSCY], a
|
|
|
|
scf
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.UpdateStringEntry:
|
2015-11-11 13:11:08 -08:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
hlcoord 1, 5
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_IsTargetBox
|
|
|
|
jr nz, .got_coords
|
2015-11-11 13:11:08 -08:00
|
|
|
hlcoord 1, 3
|
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
.got_coords
|
2015-11-11 13:11:08 -08:00
|
|
|
lb bc, 1, 18
|
|
|
|
call ClearBox
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenDestinationPointer
|
2015-11-11 13:11:08 -08:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenStringEntryCoord
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
call PlaceString
|
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.RunJumptable:
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, .Jumptable
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, de
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, de
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 14:01:10 -07:00
|
|
|
jp hl
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Jumptable:
|
2016-01-09 13:28:22 -08:00
|
|
|
dw .InitCursor
|
|
|
|
dw .ReadButtons
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.InitCursor:
|
2015-11-18 10:01:55 -08:00
|
|
|
depixel 10, 3
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_IsTargetBox
|
|
|
|
jr nz, .got_cursor_position
|
2015-11-18 10:01:55 -08:00
|
|
|
ld d, 8 * 8
|
2016-01-09 13:28:22 -08:00
|
|
|
.got_cursor_position
|
2017-12-08 21:50:59 -08:00
|
|
|
ld a, SPRITE_ANIM_INDEX_NAMING_SCREEN_CURSOR
|
2015-11-13 07:48:49 -08:00
|
|
|
call _InitSpriteAnimStruct
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, c
|
2016-01-09 13:28:22 -08:00
|
|
|
ld [wNamingScreenCursorObjectPointer], a
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, b
|
2016-01-09 20:41:03 -08:00
|
|
|
ld [wNamingScreenCursorObjectPointer + 1], a
|
2015-12-05 12:38:25 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0E
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ld hl, wJumptableIndex
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.ReadButtons:
|
2015-11-11 13:11:08 -08:00
|
|
|
ld hl, hJoyPressed ; $ffa7
|
|
|
|
ld a, [hl]
|
|
|
|
and A_BUTTON
|
|
|
|
jr nz, .a
|
|
|
|
ld a, [hl]
|
|
|
|
and B_BUTTON
|
|
|
|
jr nz, .b
|
|
|
|
ld a, [hl]
|
|
|
|
and START
|
|
|
|
jr nz, .start
|
|
|
|
ld a, [hl]
|
|
|
|
and SELECT
|
|
|
|
jr nz, .select
|
|
|
|
ret
|
|
|
|
|
|
|
|
.a
|
2016-01-09 13:28:22 -08:00
|
|
|
call .GetCursorPosition
|
2015-11-11 13:11:08 -08:00
|
|
|
cp $1
|
|
|
|
jr z, .select
|
|
|
|
cp $2
|
|
|
|
jr z, .b
|
|
|
|
cp $3
|
2016-01-09 13:28:22 -08:00
|
|
|
jr z, .end
|
|
|
|
call NamingScreen_GetLastCharacter
|
|
|
|
call NamingScreen_TryAddCharacter
|
2015-11-11 13:11:08 -08:00
|
|
|
ret nc
|
|
|
|
|
|
|
|
.start
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenCursorObjectPointer
|
2015-11-11 13:11:08 -08:00
|
|
|
ld c, [hl]
|
|
|
|
inc hl
|
|
|
|
ld b, [hl]
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $8
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $4
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_IsTargetBox
|
2015-11-11 13:11:08 -08:00
|
|
|
ret nz
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
|
|
|
.b
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_DeleteCharacter
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
.end
|
|
|
|
call NamingScreen_StoreEntry
|
2015-11-11 13:11:08 -08:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
set 7, [hl]
|
|
|
|
ret
|
|
|
|
|
|
|
|
.select
|
2018-01-11 12:36:11 -08:00
|
|
|
ld hl, wNamingScreenLetterCase
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hl]
|
|
|
|
xor 1
|
|
|
|
ld [hl], a
|
2016-01-09 13:28:22 -08:00
|
|
|
jr z, .upper
|
2015-11-11 13:11:08 -08:00
|
|
|
ld de, NameInputLower
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_ApplyTextInputMode
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
.upper
|
2015-11-11 13:11:08 -08:00
|
|
|
ld de, NameInputUpper
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_ApplyTextInputMode
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.GetCursorPosition:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenCursorObjectPointer
|
2015-11-11 13:11:08 -08:00
|
|
|
ld c, [hl]
|
|
|
|
inc hl
|
|
|
|
ld b, [hl]
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen_GetCursorPosition:
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
push bc
|
|
|
|
ld b, $4
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_IsTargetBox
|
|
|
|
jr nz, .not_box
|
2015-11-11 13:11:08 -08:00
|
|
|
inc b
|
2016-01-09 13:28:22 -08:00
|
|
|
.not_box
|
2015-11-11 13:11:08 -08:00
|
|
|
cp b
|
|
|
|
pop bc
|
2016-01-09 13:28:22 -08:00
|
|
|
jr nz, .not_bottom_row
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp $3
|
2016-01-09 13:28:22 -08:00
|
|
|
jr c, .case_switch
|
2015-11-11 13:11:08 -08:00
|
|
|
cp $6
|
2016-01-09 13:28:22 -08:00
|
|
|
jr c, .delete
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, $3
|
|
|
|
ret
|
2016-01-09 13:28:22 -08:00
|
|
|
|
|
|
|
.case_switch
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, $1
|
|
|
|
ret
|
2016-01-09 13:28:22 -08:00
|
|
|
|
|
|
|
.delete
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, $2
|
|
|
|
ret
|
2016-01-09 13:28:22 -08:00
|
|
|
|
|
|
|
.not_bottom_row
|
2015-11-11 13:11:08 -08:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen_AnimateCursor:
|
2016-01-09 13:28:22 -08:00
|
|
|
call .GetDPad
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld e, a
|
|
|
|
swap e
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], e
|
|
|
|
ld d, $4
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_IsTargetBox
|
|
|
|
jr nz, .ok
|
2015-11-11 13:11:08 -08:00
|
|
|
inc d
|
2016-01-09 13:28:22 -08:00
|
|
|
.ok
|
2015-11-11 13:11:08 -08:00
|
|
|
cp d
|
2016-01-09 13:28:22 -08:00
|
|
|
ld de, .LetterEntries
|
2018-01-12 14:23:50 -08:00
|
|
|
ld a, SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR - SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR ; 0
|
2016-01-09 13:28:22 -08:00
|
|
|
jr nz, .ok2
|
|
|
|
ld de, .CaseDelEnd
|
2018-01-12 14:23:50 -08:00
|
|
|
ld a, SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR_BIG - SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR ; 1
|
2016-01-09 13:28:22 -08:00
|
|
|
.ok2
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0E
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
2018-01-12 14:23:50 -08:00
|
|
|
add [hl] ; default SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR
|
2015-12-05 12:38:25 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld l, [hl]
|
|
|
|
ld h, $0
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_XOFFSET
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.LetterEntries:
|
2015-11-11 13:11:08 -08:00
|
|
|
db $00, $10, $20, $30, $40, $50, $60, $70, $80
|
2016-01-09 13:28:22 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CaseDelEnd:
|
2015-11-11 13:11:08 -08:00
|
|
|
db $00, $00, $00, $30, $30, $30, $60, $60, $60
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.GetDPad:
|
2015-11-11 13:11:08 -08:00
|
|
|
ld hl, hJoyLast
|
|
|
|
ld a, [hl]
|
|
|
|
and D_UP
|
|
|
|
jr nz, .up
|
|
|
|
ld a, [hl]
|
|
|
|
and D_DOWN
|
|
|
|
jr nz, .down
|
|
|
|
ld a, [hl]
|
|
|
|
and D_LEFT
|
|
|
|
jr nz, .left
|
|
|
|
ld a, [hl]
|
|
|
|
and D_RIGHT
|
|
|
|
jr nz, .right
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2015-11-11 13:11:08 -08:00
|
|
|
.right
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_GetCursorPosition
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
jr nz, .asm_11ab7
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp $8
|
|
|
|
jr nc, .asm_11ab4
|
|
|
|
inc [hl]
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2015-11-11 13:11:08 -08:00
|
|
|
.asm_11ab4
|
|
|
|
ld [hl], $0
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2015-11-11 13:11:08 -08:00
|
|
|
.asm_11ab7
|
|
|
|
cp $3
|
|
|
|
jr nz, .asm_11abc
|
|
|
|
xor a
|
|
|
|
.asm_11abc
|
|
|
|
ld e, a
|
|
|
|
add a
|
|
|
|
add e
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2015-11-11 13:11:08 -08:00
|
|
|
.left
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_GetCursorPosition
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
jr nz, .asm_11ad8
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .asm_11ad5
|
|
|
|
dec [hl]
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2015-11-11 13:11:08 -08:00
|
|
|
.asm_11ad5
|
|
|
|
ld [hl], $8
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2015-11-11 13:11:08 -08:00
|
|
|
.asm_11ad8
|
|
|
|
cp $1
|
|
|
|
jr nz, .asm_11ade
|
|
|
|
ld a, $4
|
|
|
|
.asm_11ade
|
|
|
|
dec a
|
2016-05-04 08:46:23 -07:00
|
|
|
dec a
|
2015-11-11 13:11:08 -08:00
|
|
|
ld e, a
|
|
|
|
add a
|
|
|
|
add e
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2015-11-11 13:11:08 -08:00
|
|
|
.down
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_IsTargetBox
|
2015-11-11 13:11:08 -08:00
|
|
|
jr nz, .asm_11af9
|
|
|
|
cp $5
|
|
|
|
jr nc, .asm_11aff
|
|
|
|
inc [hl]
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2015-11-11 13:11:08 -08:00
|
|
|
.asm_11af9
|
|
|
|
cp $4
|
|
|
|
jr nc, .asm_11aff
|
|
|
|
inc [hl]
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2015-11-11 13:11:08 -08:00
|
|
|
.asm_11aff
|
|
|
|
ld [hl], $0
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2015-11-11 13:11:08 -08:00
|
|
|
.up
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .asm_11b0c
|
|
|
|
dec [hl]
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2015-11-11 13:11:08 -08:00
|
|
|
.asm_11b0c
|
|
|
|
ld [hl], $4
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_IsTargetBox
|
2015-11-11 13:11:08 -08:00
|
|
|
ret nz
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen_TryAddCharacter:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [wNamingScreenLastCharacter] ; lost
|
2018-06-24 07:09:41 -07:00
|
|
|
MailComposition_TryAddCharacter:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [wNamingScreenMaxNameLength]
|
2015-11-11 13:11:08 -08:00
|
|
|
ld c, a
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [wNamingScreenCurrNameLength]
|
2015-11-11 13:11:08 -08:00
|
|
|
cp c
|
|
|
|
ret nc
|
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [wNamingScreenLastCharacter]
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen_LoadNextCharacter:
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_GetTextCursorPosition
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [hl], a
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen_AdvanceCursor_CheckEndOfString:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenCurrNameLength
|
2015-11-11 13:11:08 -08:00
|
|
|
inc [hl]
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_GetTextCursorPosition
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hl]
|
2016-01-09 13:28:22 -08:00
|
|
|
cp "@"
|
|
|
|
jr z, .end_of_string
|
2018-01-11 19:16:17 -08:00
|
|
|
ld [hl], NAMINGSCREEN_UNDERLINE
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
ret
|
2016-01-09 13:28:22 -08:00
|
|
|
|
|
|
|
.end_of_string
|
2015-11-11 13:11:08 -08:00
|
|
|
scf
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-01-02 04:24:05 -08:00
|
|
|
; unused
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [wNamingScreenCurrNameLength]
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
push hl
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenCurrNameLength
|
2015-11-11 13:11:08 -08:00
|
|
|
dec [hl]
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_GetTextCursorPosition
|
2015-11-11 13:11:08 -08:00
|
|
|
ld c, [hl]
|
|
|
|
pop hl
|
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
.loop
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hli]
|
|
|
|
cp $ff
|
2016-01-09 13:28:22 -08:00
|
|
|
jr z, NamingScreen_AdvanceCursor_CheckEndOfString
|
2015-11-11 13:11:08 -08:00
|
|
|
cp c
|
2016-01-09 13:28:22 -08:00
|
|
|
jr z, .done
|
2015-11-11 13:11:08 -08:00
|
|
|
inc hl
|
2016-01-09 13:28:22 -08:00
|
|
|
jr .loop
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
.done
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hl]
|
2016-01-09 13:28:22 -08:00
|
|
|
jr NamingScreen_LoadNextCharacter
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-01-22 14:33:52 -08:00
|
|
|
INCLUDE "data/text/unused_dakutens.asm"
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen_DeleteCharacter:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenCurrNameLength
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
dec [hl]
|
2016-01-09 13:28:22 -08:00
|
|
|
call NamingScreen_GetTextCursorPosition
|
2018-01-11 19:16:17 -08:00
|
|
|
ld [hl], NAMINGSCREEN_UNDERLINE
|
2015-11-11 13:11:08 -08:00
|
|
|
inc hl
|
|
|
|
ld a, [hl]
|
2018-01-11 19:16:17 -08:00
|
|
|
cp NAMINGSCREEN_UNDERLINE
|
2015-11-11 13:11:08 -08:00
|
|
|
ret nz
|
2018-01-11 19:16:17 -08:00
|
|
|
ld [hl], NAMINGSCREEN_MIDDLELINE
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen_GetTextCursorPosition:
|
2015-11-11 13:11:08 -08:00
|
|
|
push af
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenDestinationPointer
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [wNamingScreenCurrNameLength]
|
2015-11-11 13:11:08 -08:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
|
|
|
pop af
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen_InitNameEntry:
|
2018-01-11 19:16:17 -08:00
|
|
|
; load NAMINGSCREEN_UNDERLINE, (NAMINGSCREEN_MIDDLELINE * [wNamingScreenMaxNameLength]), "@" into the dw address at wNamingScreenDestinationPointer
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenDestinationPointer
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2018-01-11 19:16:17 -08:00
|
|
|
ld [hl], NAMINGSCREEN_UNDERLINE
|
2015-11-11 13:11:08 -08:00
|
|
|
inc hl
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [wNamingScreenMaxNameLength]
|
2015-11-11 13:11:08 -08:00
|
|
|
dec a
|
|
|
|
ld c, a
|
2018-01-11 19:16:17 -08:00
|
|
|
ld a, NAMINGSCREEN_MIDDLELINE
|
2015-11-11 13:11:08 -08:00
|
|
|
.loop
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
ld [hl], "@"
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen_StoreEntry:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenDestinationPointer
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [wNamingScreenMaxNameLength]
|
2015-11-11 13:11:08 -08:00
|
|
|
ld c, a
|
2016-01-09 13:28:22 -08:00
|
|
|
.loop
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hl]
|
2018-01-11 19:16:17 -08:00
|
|
|
cp NAMINGSCREEN_MIDDLELINE
|
2016-01-09 13:28:22 -08:00
|
|
|
jr z, .terminator
|
2018-01-11 19:16:17 -08:00
|
|
|
cp NAMINGSCREEN_UNDERLINE
|
2016-01-09 13:28:22 -08:00
|
|
|
jr nz, .not_terminator
|
|
|
|
.terminator
|
|
|
|
ld [hl], "@"
|
|
|
|
.not_terminator
|
2015-11-11 13:11:08 -08:00
|
|
|
inc hl
|
|
|
|
dec c
|
2016-01-09 13:28:22 -08:00
|
|
|
jr nz, .loop
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen_GetLastCharacter:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenCursorObjectPointer
|
2015-11-11 13:11:08 -08:00
|
|
|
ld c, [hl]
|
|
|
|
inc hl
|
|
|
|
ld b, [hl]
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_XOFFSET
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_XCOORD
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
add [hl]
|
|
|
|
sub $8
|
|
|
|
srl a
|
|
|
|
srl a
|
|
|
|
srl a
|
|
|
|
ld e, a
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2015-12-04 05:46:11 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_YCOORD
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
add [hl]
|
|
|
|
sub $10
|
|
|
|
srl a
|
|
|
|
srl a
|
|
|
|
srl a
|
|
|
|
ld d, a
|
|
|
|
hlcoord 0, 0
|
2016-01-09 13:28:22 -08:00
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
.loop
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, d
|
|
|
|
and a
|
2016-01-09 13:28:22 -08:00
|
|
|
jr z, .done
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, bc
|
|
|
|
dec d
|
2016-01-09 13:28:22 -08:00
|
|
|
jr .loop
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
.done
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
2016-01-09 13:28:22 -08:00
|
|
|
ld [wNamingScreenLastCharacter], a
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
LoadNamingScreenGFX:
|
2015-11-11 13:11:08 -08:00
|
|
|
call ClearSprites
|
2017-12-24 09:47:30 -08:00
|
|
|
callfar ClearSpriteAnims
|
2015-11-11 13:11:08 -08:00
|
|
|
call LoadStandardFont
|
|
|
|
call LoadFontsExtra
|
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
ld de, NamingScreenGFX_MiddleLine
|
2018-01-11 19:16:17 -08:00
|
|
|
ld hl, vTiles0 tile NAMINGSCREEN_MIDDLELINE
|
2016-01-09 13:28:22 -08:00
|
|
|
lb bc, BANK(NamingScreenGFX_MiddleLine), 1
|
2015-11-11 13:11:08 -08:00
|
|
|
call Get1bpp
|
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
ld de, NamingScreenGFX_UnderLine
|
2018-01-11 19:16:17 -08:00
|
|
|
ld hl, vTiles0 tile NAMINGSCREEN_UNDERLINE
|
2016-01-09 13:28:22 -08:00
|
|
|
lb bc, BANK(NamingScreenGFX_UnderLine), 1
|
2015-11-11 13:11:08 -08:00
|
|
|
call Get1bpp
|
|
|
|
|
2018-01-11 19:16:17 -08:00
|
|
|
ld de, vTiles2 tile NAMINGSCREEN_BORDER
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, NamingScreenGFX_Border
|
|
|
|
ld bc, 1 tiles
|
|
|
|
ld a, BANK(NamingScreenGFX_Border)
|
2015-11-11 13:11:08 -08:00
|
|
|
call FarCopyBytes
|
|
|
|
|
2018-01-11 19:16:17 -08:00
|
|
|
ld de, vTiles0 tile NAMINGSCREEN_CURSOR
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, NamingScreenGFX_Cursor
|
|
|
|
ld bc, 2 tiles
|
|
|
|
ld a, BANK(NamingScreenGFX_Cursor)
|
2015-11-11 13:11:08 -08:00
|
|
|
call FarCopyBytes
|
|
|
|
|
|
|
|
ld a, $5
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wSpriteAnimDict + 9 * 2
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [hli], a
|
2018-01-11 19:16:17 -08:00
|
|
|
ld [hl], NAMINGSCREEN_CURSOR
|
2015-11-11 13:11:08 -08:00
|
|
|
xor a
|
|
|
|
ld [hSCY], a
|
2015-12-02 14:59:05 -08:00
|
|
|
ld [wGlobalAnimYOffset], a
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [hSCX], a
|
2015-12-02 14:59:05 -08:00
|
|
|
ld [wGlobalAnimXOffset], a
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [wJumptableIndex], a
|
2018-01-11 12:36:11 -08:00
|
|
|
ld [wNamingScreenLetterCase], a
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [hBGMapMode], a
|
2016-01-09 13:28:22 -08:00
|
|
|
ld [wNamingScreenCurrNameLength], a
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, $7
|
|
|
|
ld [hWX], a
|
|
|
|
ret
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreenGFX_Border:
|
2018-01-21 10:58:16 -08:00
|
|
|
INCBIN "gfx/naming_screen/border.2bpp"
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreenGFX_Cursor:
|
2018-01-21 10:58:16 -08:00
|
|
|
INCBIN "gfx/naming_screen/cursor.2bpp"
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-01-22 14:33:52 -08:00
|
|
|
INCLUDE "data/text/name_input_chars.asm"
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2017-12-09 20:37:08 -08:00
|
|
|
NamingScreenGFX_End: ; unused
|
2018-01-21 10:58:16 -08:00
|
|
|
INCBIN "gfx/naming_screen/end.1bpp"
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2016-01-09 13:28:22 -08:00
|
|
|
NamingScreenGFX_MiddleLine:
|
2018-01-21 10:58:16 -08:00
|
|
|
INCBIN "gfx/naming_screen/middle_line.1bpp"
|
2015-11-11 13:11:08 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreenGFX_UnderLine:
|
2018-01-21 10:58:16 -08:00
|
|
|
INCBIN "gfx/naming_screen/underline.1bpp"
|
2016-01-09 13:28:22 -08:00
|
|
|
|
2018-06-24 18:39:23 -07:00
|
|
|
_ComposeMailMessage:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenDestinationPointer
|
|
|
|
ld [hl], e
|
|
|
|
inc hl
|
|
|
|
ld [hl], d
|
|
|
|
ld a, [hMapAnims]
|
|
|
|
push af
|
|
|
|
xor a
|
|
|
|
ld [hMapAnims], a
|
|
|
|
ld a, [hInMenu]
|
|
|
|
push af
|
|
|
|
ld a, $1
|
|
|
|
ld [hInMenu], a
|
|
|
|
call .InitBlankMail
|
|
|
|
call DelayFrame
|
|
|
|
|
|
|
|
.loop
|
|
|
|
call .DoMailEntry
|
|
|
|
jr nc, .loop
|
|
|
|
|
|
|
|
pop af
|
|
|
|
ld [hInMenu], a
|
|
|
|
pop af
|
|
|
|
ld [hMapAnims], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.InitBlankMail:
|
2016-01-09 13:28:22 -08:00
|
|
|
call ClearBGPalettes
|
|
|
|
call DisableLCD
|
|
|
|
call LoadNamingScreenGFX
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles0 tile $00
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, .MailIcon
|
|
|
|
ld bc, 8 tiles
|
|
|
|
ld a, BANK(.MailIcon)
|
|
|
|
call FarCopyBytes
|
|
|
|
xor a
|
|
|
|
ld hl, wSpriteAnimDict
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
; init mail icon
|
|
|
|
depixel 3, 2
|
2017-12-08 21:50:59 -08:00
|
|
|
ld a, SPRITE_ANIM_INDEX_PARTY_MON
|
2016-01-09 13:28:22 -08:00
|
|
|
call _InitSpriteAnimStruct
|
|
|
|
|
|
|
|
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $0
|
|
|
|
call .InitCharset
|
2017-12-29 10:22:33 -08:00
|
|
|
ld a, LCDC_DEFAULT
|
2016-01-09 13:28:22 -08:00
|
|
|
ld [rLCDC], a
|
|
|
|
call .initwNamingScreenMaxNameLength
|
2016-06-06 15:23:00 -07:00
|
|
|
ld b, SCGB_DIPLOMA
|
2016-01-09 13:28:22 -08:00
|
|
|
call GetSGBLayout
|
|
|
|
call WaitBGMap
|
|
|
|
call WaitTop
|
|
|
|
ld a, %11100100
|
|
|
|
call DmgToCgbBGPals
|
|
|
|
ld a, %11100100
|
|
|
|
call DmgToCgbObjPal0
|
|
|
|
call NamingScreen_InitNameEntry
|
|
|
|
ld hl, wNamingScreenDestinationPointer
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2018-01-11 19:16:17 -08:00
|
|
|
ld hl, MAIL_LINE_LENGTH
|
2016-01-09 13:28:22 -08:00
|
|
|
add hl, de
|
2018-01-11 19:16:17 -08:00
|
|
|
ld [hl], "<NEXT>"
|
2016-01-09 13:28:22 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.MailIcon:
|
2018-01-21 10:58:16 -08:00
|
|
|
INCBIN "gfx/icons/mail_big.2bpp"
|
2016-01-09 13:28:22 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.initwNamingScreenMaxNameLength
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, MAIL_MSG_LENGTH + 1
|
|
|
|
ld [wNamingScreenMaxNameLength], a
|
|
|
|
ret
|
|
|
|
|
2018-01-02 10:38:56 -08:00
|
|
|
.UnusedString11f7a:
|
2018-01-19 18:49:16 -08:00
|
|
|
db "メールを かいてね@"
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.InitCharset:
|
2016-01-09 13:28:22 -08:00
|
|
|
call WaitTop
|
|
|
|
hlcoord 0, 0
|
|
|
|
ld bc, 6 * SCREEN_WIDTH
|
2018-01-11 19:16:17 -08:00
|
|
|
ld a, NAMINGSCREEN_BORDER
|
2016-01-09 13:28:22 -08:00
|
|
|
call ByteFill
|
|
|
|
hlcoord 0, 6
|
|
|
|
ld bc, 12 * SCREEN_WIDTH
|
|
|
|
ld a, " "
|
|
|
|
call ByteFill
|
|
|
|
hlcoord 1, 1
|
|
|
|
lb bc, 4, SCREEN_WIDTH - 2
|
|
|
|
call ClearBox
|
|
|
|
ld de, MailEntry_Uppercase
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PlaceMailCharset:
|
2016-01-09 13:28:22 -08:00
|
|
|
hlcoord 1, 7
|
|
|
|
ld b, 6
|
|
|
|
.next
|
|
|
|
ld c, SCREEN_WIDTH - 1
|
|
|
|
.loop_
|
|
|
|
ld a, [de]
|
|
|
|
ld [hli], a
|
|
|
|
inc de
|
|
|
|
dec c
|
|
|
|
jr nz, .loop_
|
|
|
|
push de
|
|
|
|
ld de, SCREEN_WIDTH + 1
|
|
|
|
add hl, de
|
|
|
|
pop de
|
|
|
|
dec b
|
|
|
|
jr nz, .next
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.DoMailEntry:
|
2016-01-09 13:28:22 -08:00
|
|
|
call JoyTextDelay
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
bit 7, a
|
|
|
|
jr nz, .exit_mail
|
|
|
|
call .DoJumptable
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall PlaySpriteAnimationsAndDelayFrame
|
2016-01-09 13:28:22 -08:00
|
|
|
call .Update
|
|
|
|
call DelayFrame
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.exit_mail
|
2017-12-24 09:47:30 -08:00
|
|
|
callfar ClearSpriteAnims
|
2016-01-09 13:28:22 -08:00
|
|
|
call ClearSprites
|
|
|
|
xor a
|
|
|
|
ld [hSCX], a
|
|
|
|
ld [hSCY], a
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Update:
|
2016-01-09 13:28:22 -08:00
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
hlcoord 1, 1
|
|
|
|
lb bc, 4, 18
|
|
|
|
call ClearBox
|
|
|
|
ld hl, wNamingScreenDestinationPointer
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
hlcoord 2, 2
|
|
|
|
call PlaceString
|
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.DoJumptable:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
ld hl, .Jumptable
|
|
|
|
add hl, de
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, de
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 14:01:10 -07:00
|
|
|
jp hl
|
2016-01-09 13:28:22 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Jumptable:
|
2016-01-09 13:28:22 -08:00
|
|
|
dw .init_blinking_cursor
|
|
|
|
dw .process_joypad
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.init_blinking_cursor
|
2016-01-09 13:28:22 -08:00
|
|
|
depixel 9, 2
|
2017-12-08 21:50:59 -08:00
|
|
|
ld a, SPRITE_ANIM_INDEX_COMPOSE_MAIL_CURSOR
|
2016-01-09 13:28:22 -08:00
|
|
|
call _InitSpriteAnimStruct
|
|
|
|
ld a, c
|
|
|
|
ld [wNamingScreenCursorObjectPointer], a
|
|
|
|
ld a, b
|
|
|
|
ld [wNamingScreenCursorObjectPointer + 1], a
|
|
|
|
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0E
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ld hl, wJumptableIndex
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.process_joypad
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, hJoyPressed ; $ffa7
|
|
|
|
ld a, [hl]
|
|
|
|
and A_BUTTON
|
|
|
|
jr nz, .a
|
|
|
|
ld a, [hl]
|
|
|
|
and B_BUTTON
|
|
|
|
jr nz, .b
|
|
|
|
ld a, [hl]
|
|
|
|
and START
|
|
|
|
jr nz, .start
|
|
|
|
ld a, [hl]
|
|
|
|
and SELECT
|
|
|
|
jr nz, .select
|
|
|
|
ret
|
|
|
|
|
|
|
|
.a
|
2016-01-09 16:34:14 -08:00
|
|
|
call NamingScreen_PressedA_GetCursorCommand
|
2016-01-09 13:28:22 -08:00
|
|
|
cp $1
|
|
|
|
jr z, .select
|
|
|
|
cp $2
|
|
|
|
jr z, .b
|
|
|
|
cp $3
|
|
|
|
jr z, .finished
|
|
|
|
call NamingScreen_GetLastCharacter
|
2016-01-09 16:34:14 -08:00
|
|
|
call MailComposition_TryAddLastCharacter
|
2016-01-09 13:28:22 -08:00
|
|
|
jr c, .start
|
|
|
|
ld hl, wNamingScreenCurrNameLength
|
|
|
|
ld a, [hl]
|
2018-01-11 19:16:17 -08:00
|
|
|
cp MAIL_LINE_LENGTH
|
2016-01-09 13:28:22 -08:00
|
|
|
ret nz
|
|
|
|
inc [hl]
|
|
|
|
call NamingScreen_GetTextCursorPosition
|
2018-01-11 19:16:17 -08:00
|
|
|
ld [hl], NAMINGSCREEN_UNDERLINE
|
2016-01-09 13:28:22 -08:00
|
|
|
dec hl
|
2018-01-11 19:16:17 -08:00
|
|
|
ld [hl], "<NEXT>"
|
2016-01-09 13:28:22 -08:00
|
|
|
ret
|
|
|
|
|
|
|
|
.start
|
|
|
|
ld hl, wNamingScreenCursorObjectPointer
|
|
|
|
ld c, [hl]
|
|
|
|
inc hl
|
|
|
|
ld b, [hl]
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $9
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $5
|
|
|
|
ret
|
|
|
|
|
|
|
|
.b
|
|
|
|
call NamingScreen_DeleteCharacter
|
|
|
|
ld hl, wNamingScreenCurrNameLength
|
|
|
|
ld a, [hl]
|
2018-01-11 19:16:17 -08:00
|
|
|
cp MAIL_LINE_LENGTH
|
2016-01-09 13:28:22 -08:00
|
|
|
ret nz
|
|
|
|
dec [hl]
|
|
|
|
call NamingScreen_GetTextCursorPosition
|
2018-01-11 19:16:17 -08:00
|
|
|
ld [hl], NAMINGSCREEN_UNDERLINE
|
2016-01-09 13:28:22 -08:00
|
|
|
inc hl
|
2018-01-11 19:16:17 -08:00
|
|
|
ld [hl], "<NEXT>"
|
2016-01-09 13:28:22 -08:00
|
|
|
ret
|
|
|
|
|
|
|
|
.finished
|
|
|
|
call NamingScreen_StoreEntry
|
|
|
|
ld hl, wJumptableIndex
|
|
|
|
set 7, [hl]
|
|
|
|
ret
|
|
|
|
|
|
|
|
.select
|
2018-01-11 12:36:11 -08:00
|
|
|
ld hl, wNamingScreenLetterCase
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [hl]
|
2018-01-11 12:36:11 -08:00
|
|
|
xor 1
|
2016-01-09 13:28:22 -08:00
|
|
|
ld [hl], a
|
|
|
|
jr nz, .switch_to_lowercase
|
|
|
|
ld de, MailEntry_Uppercase
|
|
|
|
call .PlaceMailCharset
|
|
|
|
ret
|
|
|
|
|
|
|
|
.switch_to_lowercase
|
|
|
|
ld de, MailEntry_Lowercase
|
|
|
|
call .PlaceMailCharset
|
|
|
|
ret
|
|
|
|
|
|
|
|
; called from engine/sprite_anims.asm
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ComposeMail_AnimateCursor:
|
2016-01-09 16:34:14 -08:00
|
|
|
call .GetDPad
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld e, a
|
|
|
|
swap e
|
|
|
|
ld hl, SPRITEANIMSTRUCT_YOFFSET
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], e
|
|
|
|
cp $5
|
2016-01-09 16:34:14 -08:00
|
|
|
ld de, .LetterEntries
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, 0
|
2016-01-09 16:34:14 -08:00
|
|
|
jr nz, .got_pointer
|
|
|
|
ld de, .CaseDelEnd
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, 1
|
2016-01-09 16:34:14 -08:00
|
|
|
.got_pointer
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0E
|
|
|
|
add hl, bc
|
|
|
|
add [hl]
|
|
|
|
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
|
|
|
add hl, bc
|
|
|
|
ld l, [hl]
|
|
|
|
ld h, 0
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
ld hl, SPRITEANIMSTRUCT_XOFFSET
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.LetterEntries:
|
2016-01-09 13:28:22 -08:00
|
|
|
db $00, $10, $20, $30, $40, $50, $60, $70, $80, $90
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CaseDelEnd:
|
2016-01-09 13:28:22 -08:00
|
|
|
db $00, $00, $00, $30, $30, $30, $60, $60, $60, $60
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.GetDPad:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, hJoyLast
|
|
|
|
ld a, [hl]
|
|
|
|
and D_UP
|
|
|
|
jr nz, .up
|
|
|
|
ld a, [hl]
|
|
|
|
and D_DOWN
|
|
|
|
jr nz, .down
|
|
|
|
ld a, [hl]
|
|
|
|
and D_LEFT
|
|
|
|
jr nz, .left
|
|
|
|
ld a, [hl]
|
|
|
|
and D_RIGHT
|
|
|
|
jr nz, .right
|
|
|
|
ret
|
|
|
|
|
|
|
|
.right
|
2016-01-09 16:34:14 -08:00
|
|
|
call ComposeMail_GetCursorPosition
|
2016-01-09 13:28:22 -08:00
|
|
|
and a
|
2016-01-09 16:34:14 -08:00
|
|
|
jr nz, .case_del_done_right
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp $9
|
2016-01-09 16:34:14 -08:00
|
|
|
jr nc, .wrap_around_letter_right
|
2016-01-09 13:28:22 -08:00
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2016-01-09 16:34:14 -08:00
|
|
|
.wrap_around_letter_right
|
2016-01-09 13:28:22 -08:00
|
|
|
ld [hl], $0
|
|
|
|
ret
|
|
|
|
|
2016-01-09 16:34:14 -08:00
|
|
|
.case_del_done_right
|
2016-01-09 13:28:22 -08:00
|
|
|
cp $3
|
2016-01-09 16:34:14 -08:00
|
|
|
jr nz, .wrap_around_command_right
|
2016-01-09 13:28:22 -08:00
|
|
|
xor a
|
2016-01-09 16:34:14 -08:00
|
|
|
.wrap_around_command_right
|
2016-01-09 13:28:22 -08:00
|
|
|
ld e, a
|
|
|
|
add a
|
|
|
|
add e
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.left
|
2016-01-09 16:34:14 -08:00
|
|
|
call ComposeMail_GetCursorPosition
|
2016-01-09 13:28:22 -08:00
|
|
|
and a
|
2016-01-09 16:34:14 -08:00
|
|
|
jr nz, .caps_del_done_left
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2016-01-09 16:34:14 -08:00
|
|
|
jr z, .wrap_around_letter_left
|
2016-01-09 13:28:22 -08:00
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2016-01-09 16:34:14 -08:00
|
|
|
.wrap_around_letter_left
|
2016-01-09 13:28:22 -08:00
|
|
|
ld [hl], $9
|
|
|
|
ret
|
|
|
|
|
2016-01-09 16:34:14 -08:00
|
|
|
.caps_del_done_left
|
2016-01-09 13:28:22 -08:00
|
|
|
cp $1
|
2016-01-09 16:34:14 -08:00
|
|
|
jr nz, .wrap_around_command_left
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, $4
|
2016-01-09 16:34:14 -08:00
|
|
|
.wrap_around_command_left
|
2016-01-09 13:28:22 -08:00
|
|
|
dec a
|
2016-05-04 08:46:23 -07:00
|
|
|
dec a
|
2016-01-09 13:28:22 -08:00
|
|
|
ld e, a
|
|
|
|
add a
|
|
|
|
add e
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.down
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp $5
|
2016-01-09 16:34:14 -08:00
|
|
|
jr nc, .wrap_around_down
|
2016-01-09 13:28:22 -08:00
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2016-01-09 16:34:14 -08:00
|
|
|
.wrap_around_down
|
2016-01-09 13:28:22 -08:00
|
|
|
ld [hl], $0
|
|
|
|
ret
|
|
|
|
|
|
|
|
.up
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2016-01-09 16:34:14 -08:00
|
|
|
jr z, .wrap_around_up
|
2016-01-09 13:28:22 -08:00
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2016-01-09 16:34:14 -08:00
|
|
|
.wrap_around_up
|
2016-01-09 13:28:22 -08:00
|
|
|
ld [hl], $5
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NamingScreen_PressedA_GetCursorCommand:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, wNamingScreenCursorObjectPointer
|
|
|
|
ld c, [hl]
|
|
|
|
inc hl
|
|
|
|
ld b, [hl]
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ComposeMail_GetCursorPosition:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0D
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp $5
|
2016-01-09 16:34:14 -08:00
|
|
|
jr nz, .letter
|
2016-01-09 13:28:22 -08:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp $3
|
2016-01-09 16:34:14 -08:00
|
|
|
jr c, .case
|
2016-01-09 13:28:22 -08:00
|
|
|
cp $6
|
2016-01-09 16:34:14 -08:00
|
|
|
jr c, .del
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, $3
|
|
|
|
ret
|
|
|
|
|
2016-01-09 16:34:14 -08:00
|
|
|
.case
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, $1
|
|
|
|
ret
|
|
|
|
|
2016-01-09 16:34:14 -08:00
|
|
|
.del
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, $2
|
|
|
|
ret
|
|
|
|
|
2016-01-09 16:34:14 -08:00
|
|
|
.letter
|
2016-01-09 13:28:22 -08:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
MailComposition_TryAddLastCharacter:
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [wNamingScreenLastCharacter]
|
|
|
|
jp MailComposition_TryAddCharacter
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-01-02 04:24:05 -08:00
|
|
|
; unused
|
2016-01-09 13:28:22 -08:00
|
|
|
ld a, [wNamingScreenCurrNameLength]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
cp $11
|
|
|
|
jr nz, .asm_121c3
|
|
|
|
push hl
|
|
|
|
ld hl, wNamingScreenCurrNameLength
|
|
|
|
dec [hl]
|
2016-05-04 08:46:23 -07:00
|
|
|
dec [hl]
|
2016-01-09 13:28:22 -08:00
|
|
|
jr .asm_121c8
|
|
|
|
|
|
|
|
.asm_121c3
|
|
|
|
push hl
|
|
|
|
ld hl, wNamingScreenCurrNameLength
|
|
|
|
dec [hl]
|
|
|
|
|
|
|
|
.asm_121c8
|
|
|
|
call NamingScreen_GetTextCursorPosition
|
|
|
|
ld c, [hl]
|
|
|
|
pop hl
|
|
|
|
.asm_121cd
|
|
|
|
ld a, [hli]
|
|
|
|
cp $ff
|
|
|
|
jp z, NamingScreen_AdvanceCursor_CheckEndOfString
|
|
|
|
cp c
|
|
|
|
jr z, .asm_121d9
|
|
|
|
inc hl
|
|
|
|
jr .asm_121cd
|
|
|
|
|
|
|
|
.asm_121d9
|
|
|
|
ld a, [hl]
|
|
|
|
jp NamingScreen_LoadNextCharacter
|
2016-01-09 20:41:03 -08:00
|
|
|
|
2018-01-22 14:33:52 -08:00
|
|
|
INCLUDE "data/text/mail_input_chars.asm"
|