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