2016-06-11 17:24:04 -07:00
|
|
|
|
AskName:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call SaveScreenTilesToBuffer1
|
2014-05-23 15:11:09 -07:00
|
|
|
|
call GetPredefRegisters
|
2014-05-22 18:13:20 -04:00
|
|
|
|
push hl
|
2015-08-30 21:38:41 -05:00
|
|
|
|
ld a, [wIsInBattle]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
dec a
|
2015-07-18 15:52:03 -05:00
|
|
|
|
coord hl, 0, 0
|
2015-08-05 16:20:29 -05:00
|
|
|
|
ld b, 4
|
|
|
|
|
ld c, 11
|
2016-06-11 21:30:05 -07:00
|
|
|
|
call z, ClearScreenArea ; only if in wild battle
|
2014-05-26 14:04:56 -07:00
|
|
|
|
ld a, [wcf91]
|
|
|
|
|
ld [wd11e], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call GetMonName
|
|
|
|
|
ld hl, DoYouWantToNicknameText
|
|
|
|
|
call PrintText
|
2015-07-18 15:52:03 -05:00
|
|
|
|
coord hl, 14, 7
|
2015-08-05 16:20:29 -05:00
|
|
|
|
lb bc, 8, 15
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld a, TWO_OPTION_MENU
|
2015-02-07 02:43:08 -08:00
|
|
|
|
ld [wTextBoxID], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call DisplayTextBoxID
|
|
|
|
|
pop hl
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld a, [wCurrentMenuItem]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
and a
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr nz, .declinedNickname
|
2014-09-13 00:50:56 -07:00
|
|
|
|
ld a, [wUpdateSpritesEnabled]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
push af
|
|
|
|
|
xor a
|
2014-09-13 00:50:56 -07:00
|
|
|
|
ld [wUpdateSpritesEnabled], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
push hl
|
2015-07-13 15:40:33 -07:00
|
|
|
|
ld a, NAME_MON_SCREEN
|
|
|
|
|
ld [wNamingScreenType], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call DisplayNamingScreen
|
2015-08-30 21:38:41 -05:00
|
|
|
|
ld a, [wIsInBattle]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
and a
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr nz, .inBattle
|
2014-09-09 20:55:19 -07:00
|
|
|
|
call ReloadMapSpriteTilePatterns
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.inBattle
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call LoadScreenTilesFromBuffer1
|
|
|
|
|
pop hl
|
|
|
|
|
pop af
|
2014-09-13 00:50:56 -07:00
|
|
|
|
ld [wUpdateSpritesEnabled], a
|
2014-05-26 14:04:56 -07:00
|
|
|
|
ld a, [wcf4b]
|
2016-06-11 21:30:05 -07:00
|
|
|
|
cp "@"
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ret nz
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.declinedNickname
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ld d, h
|
|
|
|
|
ld e, l
|
2014-05-26 14:04:56 -07:00
|
|
|
|
ld hl, wcd6d
|
2015-08-10 23:51:20 -05:00
|
|
|
|
ld bc, NAME_LENGTH
|
2014-05-22 18:13:20 -04:00
|
|
|
|
jp CopyData
|
|
|
|
|
|
2016-06-12 02:19:19 -05:00
|
|
|
|
DoYouWantToNicknameText:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
TX_FAR _DoYouWantToNicknameText
|
|
|
|
|
db "@"
|
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
DisplayNameRaterScreen:
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld hl, wBuffer
|
2014-05-22 18:13:20 -04:00
|
|
|
|
xor a
|
2014-09-13 00:50:56 -07:00
|
|
|
|
ld [wUpdateSpritesEnabled], a
|
2015-07-13 15:40:33 -07:00
|
|
|
|
ld a, NAME_MON_SCREEN
|
|
|
|
|
ld [wNamingScreenType], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call DisplayNamingScreen
|
|
|
|
|
call GBPalWhiteOutWithDelay3
|
2014-09-09 20:55:19 -07:00
|
|
|
|
call RestoreScreenTilesAndReloadTilePatterns
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call LoadGBPal
|
2014-05-26 14:04:56 -07:00
|
|
|
|
ld a, [wcf4b]
|
2015-08-05 16:20:29 -05:00
|
|
|
|
cp "@"
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr z, .playerCancelled
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld hl, wPartyMonNicks
|
2015-08-10 23:51:20 -05:00
|
|
|
|
ld bc, NAME_LENGTH
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld a, [wWhichPokemon]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call AddNTimes
|
|
|
|
|
ld e, l
|
|
|
|
|
ld d, h
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld hl, wBuffer
|
2015-08-10 23:51:20 -05:00
|
|
|
|
ld bc, NAME_LENGTH
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call CopyData
|
|
|
|
|
and a
|
|
|
|
|
ret
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.playerCancelled
|
2014-05-22 18:13:20 -04:00
|
|
|
|
scf
|
|
|
|
|
ret
|
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
DisplayNamingScreen:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
push hl
|
2014-05-26 14:04:56 -07:00
|
|
|
|
ld hl, wd730
|
2014-05-22 18:13:20 -04:00
|
|
|
|
set 6, [hl]
|
|
|
|
|
call GBPalWhiteOutWithDelay3
|
|
|
|
|
call ClearScreen
|
|
|
|
|
call UpdateSprites
|
2015-08-12 02:16:56 -07:00
|
|
|
|
ld b, SET_PAL_GENERIC
|
|
|
|
|
call RunPaletteCommand
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call LoadHpBarAndStatusTilePatterns
|
|
|
|
|
call LoadEDTile
|
2015-03-13 19:22:55 -07:00
|
|
|
|
callba LoadMonPartySpriteGfx
|
2015-07-18 15:52:03 -05:00
|
|
|
|
coord hl, 0, 4
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld b, 9
|
|
|
|
|
ld c, 18
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call TextBoxBorder
|
|
|
|
|
call PrintNamingText
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld a, 3
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld [wTopMenuItemY], a
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld a, 1
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld [wTopMenuItemX], a
|
|
|
|
|
ld [wLastMenuItem], a
|
|
|
|
|
ld [wCurrentMenuItem], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ld a, $ff
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld [wMenuWatchedKeys], a
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld a, 7
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld [wMaxMenuItem], a
|
2016-06-11 21:30:05 -07:00
|
|
|
|
ld a, "@"
|
2014-05-26 14:04:56 -07:00
|
|
|
|
ld [wcf4b], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
xor a
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld hl, wNamingScreenSubmitName
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ld [hli], a
|
|
|
|
|
ld [hli], a
|
2015-07-13 13:35:35 -07:00
|
|
|
|
ld [wAnimCounter], a
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.selectReturnPoint
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call PrintAlphabet
|
|
|
|
|
call GBPalNormal
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.ABStartReturnPoint
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld a, [wNamingScreenSubmitName]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
and a
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr nz, .submitNickname
|
|
|
|
|
call PrintNicknameAndUnderscores
|
|
|
|
|
.dPadReturnPoint
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call PlaceMenuCursor
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.inputLoop
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld a, [wCurrentMenuItem]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
push af
|
|
|
|
|
callba AnimatePartyMon_ForceSpeed1
|
|
|
|
|
pop af
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld [wCurrentMenuItem], a
|
2014-05-25 11:21:48 -07:00
|
|
|
|
call JoypadLowSensitivity
|
2014-05-25 10:51:53 -07:00
|
|
|
|
ld a, [hJoyPressed]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
and a
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr z, .inputLoop
|
|
|
|
|
ld hl, .namingScreenButtonFunctions
|
|
|
|
|
.checkForPressedButton
|
2014-05-22 18:13:20 -04:00
|
|
|
|
sla a
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr c, .foundPressedButton
|
2014-05-22 18:13:20 -04:00
|
|
|
|
inc hl
|
|
|
|
|
inc hl
|
|
|
|
|
inc hl
|
|
|
|
|
inc hl
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr .checkForPressedButton
|
|
|
|
|
.foundPressedButton
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld e, a
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld d, a
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld h, [hl]
|
|
|
|
|
ld l, a
|
|
|
|
|
push de
|
2016-06-11 21:30:05 -07:00
|
|
|
|
jp hl
|
2015-07-14 03:46:23 -05:00
|
|
|
|
|
|
|
|
|
.submitNickname
|
2014-05-22 18:13:20 -04:00
|
|
|
|
pop de
|
2014-05-26 14:04:56 -07:00
|
|
|
|
ld hl, wcf4b
|
2015-08-10 23:51:20 -05:00
|
|
|
|
ld bc, NAME_LENGTH
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call CopyData
|
|
|
|
|
call GBPalWhiteOutWithDelay3
|
|
|
|
|
call ClearScreen
|
2014-05-23 15:34:35 -07:00
|
|
|
|
call ClearSprites
|
2015-08-12 02:16:56 -07:00
|
|
|
|
call RunDefaultPaletteCommand
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call GBPalNormal
|
|
|
|
|
xor a
|
2015-08-29 17:15:05 -07:00
|
|
|
|
ld [wAnimCounter], a
|
2014-05-26 14:04:56 -07:00
|
|
|
|
ld hl, wd730
|
2014-05-22 18:13:20 -04:00
|
|
|
|
res 6, [hl]
|
2015-08-30 21:38:41 -05:00
|
|
|
|
ld a, [wIsInBattle]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
and a
|
|
|
|
|
jp z, LoadTextBoxTilePatterns
|
2015-07-19 11:56:13 -07:00
|
|
|
|
jpab LoadHudTilePatterns
|
2014-05-22 18:13:20 -04:00
|
|
|
|
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.namingScreenButtonFunctions
|
|
|
|
|
dw .dPadReturnPoint
|
|
|
|
|
dw .pressedDown
|
|
|
|
|
dw .dPadReturnPoint
|
|
|
|
|
dw .pressedUp
|
|
|
|
|
dw .dPadReturnPoint
|
|
|
|
|
dw .pressedLeft
|
|
|
|
|
dw .dPadReturnPoint
|
|
|
|
|
dw .pressedRight
|
|
|
|
|
dw .ABStartReturnPoint
|
|
|
|
|
dw .pressedStart
|
|
|
|
|
dw .selectReturnPoint
|
|
|
|
|
dw .pressedSelect
|
|
|
|
|
dw .ABStartReturnPoint
|
|
|
|
|
dw .pressedB
|
|
|
|
|
dw .ABStartReturnPoint
|
|
|
|
|
dw .pressedA
|
2014-05-22 18:13:20 -04:00
|
|
|
|
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.pressedA_changedCase
|
2014-05-22 18:13:20 -04:00
|
|
|
|
pop de
|
2015-07-14 03:46:23 -05:00
|
|
|
|
ld de, .selectReturnPoint
|
2014-05-22 18:13:20 -04:00
|
|
|
|
push de
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.pressedSelect
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld a, [wAlphabetCase]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
xor $1
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld [wAlphabetCase], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ret
|
2015-07-14 03:46:23 -05:00
|
|
|
|
|
|
|
|
|
.pressedStart
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld a, 1
|
|
|
|
|
ld [wNamingScreenSubmitName], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ret
|
2015-07-14 03:46:23 -05:00
|
|
|
|
|
|
|
|
|
.pressedA
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld a, [wCurrentMenuItem]
|
2015-07-14 03:46:23 -05:00
|
|
|
|
cp $5 ; "ED" row
|
|
|
|
|
jr nz, .didNotPressED
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld a, [wTopMenuItemX]
|
2015-07-14 03:46:23 -05:00
|
|
|
|
cp $11 ; "ED" column
|
|
|
|
|
jr z, .pressedStart
|
|
|
|
|
.didNotPressED
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld a, [wCurrentMenuItem]
|
2015-07-24 20:27:59 -07:00
|
|
|
|
cp $6 ; case switch row
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr nz, .didNotPressCaseSwtich
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld a, [wTopMenuItemX]
|
2015-07-14 03:46:23 -05:00
|
|
|
|
cp $1 ; case switch column
|
|
|
|
|
jr z, .pressedA_changedCase
|
|
|
|
|
.didNotPressCaseSwtich
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld hl, wMenuCursorLocation
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld h, [hl]
|
|
|
|
|
ld l, a
|
|
|
|
|
inc hl
|
|
|
|
|
ld a, [hl]
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld [wNamingScreenLetter], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call CalcStringLength
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld a, [wNamingScreenLetter]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
cp $e5
|
2015-07-03 14:37:53 -05:00
|
|
|
|
ld de, Dakutens
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr z, .dakutensAndHandakutens
|
2014-05-22 18:13:20 -04:00
|
|
|
|
cp $e4
|
2015-07-03 14:37:53 -05:00
|
|
|
|
ld de, Handakutens
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr z, .dakutensAndHandakutens
|
2015-07-13 15:40:33 -07:00
|
|
|
|
ld a, [wNamingScreenType]
|
|
|
|
|
cp NAME_MON_SCREEN
|
2014-05-22 18:13:20 -04:00
|
|
|
|
jr nc, .checkMonNameLength
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld a, [wNamingScreenNameLength]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
cp $7 ; max length of player/rival names
|
|
|
|
|
jr .checkNameLength
|
|
|
|
|
.checkMonNameLength
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld a, [wNamingScreenNameLength]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
cp $a ; max length of pokemon nicknames
|
|
|
|
|
.checkNameLength
|
|
|
|
|
jr c, .addLetter
|
|
|
|
|
ret
|
2015-07-14 03:46:23 -05:00
|
|
|
|
|
|
|
|
|
.dakutensAndHandakutens
|
2014-05-22 18:13:20 -04:00
|
|
|
|
push hl
|
2015-07-14 03:46:23 -05:00
|
|
|
|
call DakutensAndHandakutens
|
2014-05-22 18:13:20 -04:00
|
|
|
|
pop hl
|
|
|
|
|
ret nc
|
|
|
|
|
dec hl
|
|
|
|
|
.addLetter
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld a, [wNamingScreenLetter]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ld [hli], a
|
2016-06-11 21:30:05 -07:00
|
|
|
|
ld [hl], "@"
|
2015-07-19 03:46:12 -05:00
|
|
|
|
ld a, SFX_PRESS_AB
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call PlaySound
|
|
|
|
|
ret
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.pressedB
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld a, [wNamingScreenNameLength]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
and a
|
|
|
|
|
ret z
|
|
|
|
|
call CalcStringLength
|
|
|
|
|
dec hl
|
2015-08-05 16:20:29 -05:00
|
|
|
|
ld [hl], "@"
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ret
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.pressedRight
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld a, [wCurrentMenuItem]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
cp $6
|
2015-07-14 03:46:23 -05:00
|
|
|
|
ret z ; can't scroll right on bottom row
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld a, [wTopMenuItemX]
|
2015-07-14 03:46:23 -05:00
|
|
|
|
cp $11 ; max
|
|
|
|
|
jp z, .wrapToFirstColumn
|
2014-05-22 18:13:20 -04:00
|
|
|
|
inc a
|
|
|
|
|
inc a
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr .done
|
|
|
|
|
.wrapToFirstColumn
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ld a, $1
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr .done
|
|
|
|
|
.pressedLeft
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld a, [wCurrentMenuItem]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
cp $6
|
2015-07-14 03:46:23 -05:00
|
|
|
|
ret z ; can't scroll right on bottom row
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld a, [wTopMenuItemX]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
dec a
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jp z, .wrapToLastColumn
|
2014-05-22 18:13:20 -04:00
|
|
|
|
dec a
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr .done
|
|
|
|
|
.wrapToLastColumn
|
|
|
|
|
ld a, $11 ; max
|
|
|
|
|
jr .done
|
|
|
|
|
.pressedUp
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld a, [wCurrentMenuItem]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
dec a
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld [wCurrentMenuItem], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
and a
|
|
|
|
|
ret nz
|
2015-07-14 03:46:23 -05:00
|
|
|
|
ld a, $6 ; wrap to bottom row
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld [wCurrentMenuItem], a
|
2015-07-14 03:46:23 -05:00
|
|
|
|
ld a, $1 ; force left column
|
|
|
|
|
jr .done
|
|
|
|
|
.pressedDown
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld a, [wCurrentMenuItem]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
inc a
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld [wCurrentMenuItem], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
cp $7
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr nz, .wrapToTopRow
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ld a, $1
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld [wCurrentMenuItem], a
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr .done
|
|
|
|
|
.wrapToTopRow
|
2014-05-22 18:13:20 -04:00
|
|
|
|
cp $6
|
|
|
|
|
ret nz
|
|
|
|
|
ld a, $1
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.done
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld [wTopMenuItemX], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
jp EraseMenuCursor
|
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
LoadEDTile:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ld de, ED_Tile
|
2014-05-29 01:31:46 -07:00
|
|
|
|
ld hl, vFont + $700
|
2015-08-09 23:56:20 -05:00
|
|
|
|
ld bc, (ED_TileEnd - ED_Tile) / $8
|
|
|
|
|
; to fix the graphical bug on poor emulators
|
|
|
|
|
;lb bc, BANK(ED_Tile), (ED_TileEnd - ED_Tile) / $8
|
2014-05-22 18:13:20 -04:00
|
|
|
|
jp CopyVideoDataDouble
|
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
ED_Tile:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
INCBIN "gfx/ED_tile.1bpp"
|
2015-08-09 23:56:20 -05:00
|
|
|
|
ED_TileEnd:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
PrintAlphabet:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
xor a
|
2015-07-03 14:37:53 -05:00
|
|
|
|
ld [H_AUTOBGTRANSFERENABLED], a
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld a, [wAlphabetCase]
|
2014-05-22 18:13:20 -04:00
|
|
|
|
and a
|
2015-07-03 14:37:53 -05:00
|
|
|
|
ld de, LowerCaseAlphabet
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr nz, .lowercase
|
2015-07-03 14:37:53 -05:00
|
|
|
|
ld de, UpperCaseAlphabet
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.lowercase
|
2015-07-18 15:52:03 -05:00
|
|
|
|
coord hl, 2, 5
|
2015-08-05 16:20:29 -05:00
|
|
|
|
lb bc, 5, 9 ; 5 rows, 9 columns
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.outerLoop
|
2014-05-22 18:13:20 -04:00
|
|
|
|
push bc
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.innerLoop
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ld a, [de]
|
|
|
|
|
ld [hli], a
|
|
|
|
|
inc hl
|
|
|
|
|
inc de
|
|
|
|
|
dec c
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr nz, .innerLoop
|
|
|
|
|
ld bc, SCREEN_WIDTH + 2
|
2014-05-22 18:13:20 -04:00
|
|
|
|
add hl, bc
|
|
|
|
|
pop bc
|
|
|
|
|
dec b
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr nz, .outerLoop
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call PlaceString
|
|
|
|
|
ld a, $1
|
2015-07-03 14:37:53 -05:00
|
|
|
|
ld [H_AUTOBGTRANSFERENABLED], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
jp Delay3
|
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
LowerCaseAlphabet:
|
2016-07-18 01:48:34 -05:00
|
|
|
|
db "abcdefghijklmnopqrstuvwxyz ×():;[]",$e1,$e2,"-?!♂♀/⠄,¥UPPER CASE@"
|
2014-05-22 18:13:20 -04:00
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
UpperCaseAlphabet:
|
2016-07-18 01:48:34 -05:00
|
|
|
|
db "ABCDEFGHIJKLMNOPQRSTUVWXYZ ×():;[]",$e1,$e2,"-?!♂♀/⠄,¥lower case@"
|
2014-05-22 18:13:20 -04:00
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
PrintNicknameAndUnderscores:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call CalcStringLength
|
|
|
|
|
ld a, c
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld [wNamingScreenNameLength], a
|
2015-07-18 15:52:03 -05:00
|
|
|
|
coord hl, 10, 2
|
2015-08-05 16:20:29 -05:00
|
|
|
|
lb bc, 1, 10
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call ClearScreenArea
|
2015-07-18 15:52:03 -05:00
|
|
|
|
coord hl, 10, 2
|
2014-05-26 14:04:56 -07:00
|
|
|
|
ld de, wcf4b
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call PlaceString
|
2015-07-18 15:52:03 -05:00
|
|
|
|
coord hl, 10, 3
|
2015-07-13 15:40:33 -07:00
|
|
|
|
ld a, [wNamingScreenType]
|
|
|
|
|
cp NAME_MON_SCREEN
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr nc, .pokemon1
|
|
|
|
|
ld b, 7 ; player or rival max name length
|
|
|
|
|
jr .playerOrRival1
|
|
|
|
|
.pokemon1
|
|
|
|
|
ld b, 10 ; pokemon max name length
|
|
|
|
|
.playerOrRival1
|
|
|
|
|
ld a, $76 ; underscore tile id
|
|
|
|
|
.placeUnderscoreLoop
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ld [hli], a
|
|
|
|
|
dec b
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr nz, .placeUnderscoreLoop
|
2015-07-13 15:40:33 -07:00
|
|
|
|
ld a, [wNamingScreenType]
|
|
|
|
|
cp NAME_MON_SCREEN
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld a, [wNamingScreenNameLength]
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr nc, .pokemon2
|
|
|
|
|
cp 7 ; player or rival max name length
|
|
|
|
|
jr .playerOrRival2
|
|
|
|
|
.pokemon2
|
|
|
|
|
cp 10 ; pokemon max name length
|
|
|
|
|
.playerOrRival2
|
|
|
|
|
jr nz, .emptySpacesRemaining
|
|
|
|
|
; when all spaces are filled, force the cursor onto the ED tile
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call EraseMenuCursor
|
2015-07-14 03:46:23 -05:00
|
|
|
|
ld a, $11 ; "ED" x coord
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld [wTopMenuItemX], a
|
2015-07-14 03:46:23 -05:00
|
|
|
|
ld a, $5 ; "ED" y corrd
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld [wCurrentMenuItem], a
|
2015-07-13 15:40:33 -07:00
|
|
|
|
ld a, [wNamingScreenType]
|
|
|
|
|
cp NAME_MON_SCREEN
|
2015-07-14 03:46:23 -05:00
|
|
|
|
ld a, 9 ; keep the last underscore raised
|
|
|
|
|
jr nc, .pokemon3
|
|
|
|
|
ld a, 6 ; keep the last underscore raised
|
|
|
|
|
.pokemon3
|
|
|
|
|
.emptySpacesRemaining
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ld c, a
|
|
|
|
|
ld b, $0
|
2015-07-18 15:52:03 -05:00
|
|
|
|
coord hl, 10, 3
|
2014-05-22 18:13:20 -04:00
|
|
|
|
add hl, bc
|
2015-07-14 03:46:23 -05:00
|
|
|
|
ld [hl], $77 ; raised underscore tile id
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ret
|
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
DakutensAndHandakutens:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
push de
|
|
|
|
|
call CalcStringLength
|
|
|
|
|
dec hl
|
|
|
|
|
ld a, [hl]
|
|
|
|
|
pop hl
|
|
|
|
|
ld de, $2
|
|
|
|
|
call IsInArray
|
|
|
|
|
ret nc
|
|
|
|
|
inc hl
|
|
|
|
|
ld a, [hl]
|
2015-07-24 20:27:59 -07:00
|
|
|
|
ld [wNamingScreenLetter], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ret
|
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
Dakutens:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
db "かが", "きぎ", "くぐ", "けげ", "こご"
|
|
|
|
|
db "さざ", "しじ", "すず", "せぜ", "そぞ"
|
|
|
|
|
db "ただ", "ちぢ", "つづ", "てで", "とど"
|
|
|
|
|
db "はば", "ひび", "ふぶ", "へべ", "ほぼ"
|
|
|
|
|
db "カガ", "キギ", "クグ", "ケゲ", "コゴ"
|
|
|
|
|
db "サザ", "シジ", "スズ", "セゼ", "ソゾ"
|
|
|
|
|
db "タダ", "チヂ", "ツヅ", "テデ", "トド"
|
|
|
|
|
db "ハバ", "ヒビ", "フブ", "へべ", "ホボ"
|
|
|
|
|
db $ff
|
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
Handakutens:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
db "はぱ", "ひぴ", "ふぷ", "へぺ", "ほぽ"
|
|
|
|
|
db "ハパ", "ヒピ", "フプ", "へぺ", "ホポ"
|
|
|
|
|
db $ff
|
|
|
|
|
|
2014-05-26 14:04:56 -07:00
|
|
|
|
; calculates the length of the string at wcf4b and stores it in c
|
2016-06-11 17:24:04 -07:00
|
|
|
|
CalcStringLength:
|
2014-05-26 14:04:56 -07:00
|
|
|
|
ld hl, wcf4b
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ld c, $0
|
2015-07-14 03:46:23 -05:00
|
|
|
|
.loop
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ld a, [hl]
|
2015-08-05 16:20:29 -05:00
|
|
|
|
cp "@"
|
2014-05-22 18:13:20 -04:00
|
|
|
|
ret z
|
|
|
|
|
inc hl
|
|
|
|
|
inc c
|
2015-07-14 03:46:23 -05:00
|
|
|
|
jr .loop
|
2014-05-22 18:13:20 -04:00
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
PrintNamingText:
|
2015-07-18 15:52:03 -05:00
|
|
|
|
coord hl, 0, 1
|
2015-07-13 15:40:33 -07:00
|
|
|
|
ld a, [wNamingScreenType]
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld de, YourTextString
|
2014-05-22 18:13:20 -04:00
|
|
|
|
and a
|
|
|
|
|
jr z, .notNickname
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld de, RivalsTextString
|
2014-05-22 18:13:20 -04:00
|
|
|
|
dec a
|
|
|
|
|
jr z, .notNickname
|
2014-05-26 14:04:56 -07:00
|
|
|
|
ld a, [wcf91]
|
2015-03-14 15:25:21 -07:00
|
|
|
|
ld [wMonPartySpriteSpecies], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
push af
|
2015-03-14 15:25:21 -07:00
|
|
|
|
callba WriteMonPartySpriteOAMBySpecies
|
2014-05-22 18:13:20 -04:00
|
|
|
|
pop af
|
2014-05-26 14:04:56 -07:00
|
|
|
|
ld [wd11e], a
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call GetMonName
|
2015-07-18 15:52:03 -05:00
|
|
|
|
coord hl, 4, 1
|
2014-05-22 18:13:20 -04:00
|
|
|
|
call PlaceString
|
|
|
|
|
ld hl, $1
|
|
|
|
|
add hl, bc
|
|
|
|
|
ld [hl], $c9
|
2015-07-18 15:52:03 -05:00
|
|
|
|
coord hl, 1, 3
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld de, NicknameTextString
|
2014-05-22 18:13:20 -04:00
|
|
|
|
jr .placeString
|
|
|
|
|
.notNickname
|
|
|
|
|
call PlaceString
|
|
|
|
|
ld l, c
|
|
|
|
|
ld h, b
|
2015-02-07 12:27:36 -08:00
|
|
|
|
ld de, NameTextString
|
2014-05-22 18:13:20 -04:00
|
|
|
|
.placeString
|
|
|
|
|
jp PlaceString
|
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
YourTextString:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
db "YOUR @"
|
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
RivalsTextString:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
db "RIVAL's @"
|
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
NameTextString:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
db "NAME?@"
|
|
|
|
|
|
2016-06-11 17:24:04 -07:00
|
|
|
|
NicknameTextString:
|
2014-05-22 18:13:20 -04:00
|
|
|
|
db "NICKNAME?@"
|