pokered/engine/oak_speech2.asm

283 lines
4.6 KiB
NASM
Raw Normal View History

2015-07-18 15:17:29 +00:00
ChoosePlayerName: ; 695d (1:695d)
call OakSpeechSlidePicRight
ld de, DefaultNamesPlayer
2014-05-22 22:13:20 +00:00
call DisplayIntroNameTextBox
ld a, [wCurrentMenuItem]
2014-05-22 22:13:20 +00:00
and a
2015-07-18 15:17:29 +00:00
jr z, .customName
ld hl, DefaultNamesPlayerList
2015-07-18 15:17:29 +00:00
call GetDefaultName
ld de, wPlayerName
2015-07-18 15:17:29 +00:00
call OakSpeechSlidePicLeft
jr .done
.customName
ld hl, wPlayerName
xor a ; NAME_PLAYER_SCREEN
ld [wNamingScreenType], a
2014-05-22 22:13:20 +00:00
call DisplayNamingScreen
ld a, [wcf4b]
2015-07-18 15:17:29 +00:00
cp "@"
jr z, .customName
2014-05-22 22:13:20 +00:00
call ClearScreen
call Delay3
ld de, RedPicFront
2014-05-22 22:13:20 +00:00
ld b, BANK(RedPicFront)
2015-07-18 15:17:29 +00:00
call IntroDisplayPicCenteredOrUpperRight
.done
2014-05-22 22:13:20 +00:00
ld hl, YourNameIsText
jp PrintText
YourNameIsText: ; 699f (1:699f)
TX_FAR _YourNameIsText
db "@"
2015-07-18 15:17:29 +00:00
ChooseRivalName: ; 69a4 (1:69a4)
call OakSpeechSlidePicRight
2014-05-22 22:13:20 +00:00
ld de, DefaultNamesRival
call DisplayIntroNameTextBox
ld a, [wCurrentMenuItem]
2014-05-22 22:13:20 +00:00
and a
2015-07-18 15:17:29 +00:00
jr z, .customName
2014-05-22 22:13:20 +00:00
ld hl, DefaultNamesRivalList
2015-07-18 15:17:29 +00:00
call GetDefaultName
ld de, W_RIVALNAME
2015-07-18 15:17:29 +00:00
call OakSpeechSlidePicLeft
jr .done
.customName
ld hl, W_RIVALNAME
ld a, NAME_RIVAL_SCREEN
ld [wNamingScreenType], a
2014-05-22 22:13:20 +00:00
call DisplayNamingScreen
ld a, [wcf4b]
2015-07-18 15:17:29 +00:00
cp "@"
jr z, .customName
2014-05-22 22:13:20 +00:00
call ClearScreen
call Delay3
ld de, Rival1Pic
2014-05-22 22:13:20 +00:00
ld b, $13
2015-07-18 15:17:29 +00:00
call IntroDisplayPicCenteredOrUpperRight
.done
2014-05-22 22:13:20 +00:00
ld hl, HisNameIsText
jp PrintText
HisNameIsText: ; 69e7 (1:69e7)
TX_FAR _HisNameIsText
db "@"
2015-07-18 15:17:29 +00:00
OakSpeechSlidePicLeft: ; 69ec (1:69ec)
2014-05-22 22:13:20 +00:00
push de
2015-07-18 20:52:03 +00:00
coord hl, 0, 0
2015-07-18 15:17:29 +00:00
lb bc, 12, 11
call ClearScreenArea ; clear the name list text box
ld c, 10
2014-05-22 22:13:20 +00:00
call DelayFrames
pop de
ld hl, wcd6d
ld bc, NAME_LENGTH
2014-05-22 22:13:20 +00:00
call CopyData
call Delay3
2015-07-18 20:52:03 +00:00
coord hl, 12, 4
2015-07-18 15:17:29 +00:00
lb de, 6, 6 * SCREEN_WIDTH + 5
2014-05-22 22:13:20 +00:00
ld a, $ff
2015-07-18 15:17:29 +00:00
jr OakSpeechSlidePicCommon
2014-05-22 22:13:20 +00:00
2015-07-18 15:17:29 +00:00
OakSpeechSlidePicRight: ; 6a12 (1:6a12)
2015-07-18 20:52:03 +00:00
coord hl, 5, 4
2015-07-18 15:17:29 +00:00
lb de, 6, 6 * SCREEN_WIDTH + 5
2014-05-22 22:13:20 +00:00
xor a
2015-07-18 15:17:29 +00:00
OakSpeechSlidePicCommon: ; 6a19 (1:6a19)
2014-05-22 22:13:20 +00:00
push hl
push de
push bc
2015-07-18 15:17:29 +00:00
ld [hSlideDirection], a
2014-05-22 22:13:20 +00:00
ld a, d
2015-07-18 15:17:29 +00:00
ld [hSlideAmount], a
2014-05-22 22:13:20 +00:00
ld a, e
2015-07-18 15:17:29 +00:00
ld [hSlidingRegionSize], a
2014-05-22 22:13:20 +00:00
ld c, a
2015-07-18 15:17:29 +00:00
ld a, [hSlideDirection]
2014-05-22 22:13:20 +00:00
and a
2015-07-18 15:17:29 +00:00
jr nz, .next
; If sliding right, point hl to the end of the pic's tiles.
ld d, 0
2014-05-22 22:13:20 +00:00
add hl, de
2015-07-18 15:17:29 +00:00
.next
2014-05-22 22:13:20 +00:00
ld d, h
ld e, l
2015-07-18 15:17:29 +00:00
.loop
2014-05-22 22:13:20 +00:00
xor a
ld [H_AUTOBGTRANSFERENABLED], a
2015-07-18 15:17:29 +00:00
ld a, [hSlideDirection]
2014-05-22 22:13:20 +00:00
and a
2015-07-18 15:17:29 +00:00
jr nz, .slideLeft
; sliding right
2014-05-22 22:13:20 +00:00
ld a, [hli]
ld [hld], a
dec hl
2015-07-18 15:17:29 +00:00
jr .next2
.slideLeft
2014-05-22 22:13:20 +00:00
ld a, [hld]
ld [hli], a
inc hl
2015-07-18 15:17:29 +00:00
.next2
2014-05-22 22:13:20 +00:00
dec c
2015-07-18 15:17:29 +00:00
jr nz, .loop
ld a, [hSlideDirection]
2014-05-22 22:13:20 +00:00
and a
2015-07-18 15:17:29 +00:00
jr z, .next3
; If sliding left, we need to zero the last tile in the pic (there is no need
; to take a corresponding action when sliding right because hl initially points
; to a 0 tile in that case).
2014-05-22 22:13:20 +00:00
xor a
dec hl
ld [hl], a
2015-07-18 15:17:29 +00:00
.next3
ld a, 1
ld [H_AUTOBGTRANSFERENABLED], a
2014-05-22 22:13:20 +00:00
call Delay3
2015-07-18 15:17:29 +00:00
ld a, [hSlidingRegionSize]
2014-05-22 22:13:20 +00:00
ld c, a
ld h, d
ld l, e
2015-07-18 15:17:29 +00:00
ld a, [hSlideDirection]
2014-05-22 22:13:20 +00:00
and a
2015-07-18 15:17:29 +00:00
jr nz, .slideLeft2
2014-05-22 22:13:20 +00:00
inc hl
2015-07-18 15:17:29 +00:00
jr .next4
.slideLeft2
2014-05-22 22:13:20 +00:00
dec hl
2015-07-18 15:17:29 +00:00
.next4
2014-05-22 22:13:20 +00:00
ld d, h
ld e, l
2015-07-18 15:17:29 +00:00
ld a, [hSlideAmount]
2014-05-22 22:13:20 +00:00
dec a
2015-07-18 15:17:29 +00:00
ld [hSlideAmount], a
jr nz, .loop
2014-05-22 22:13:20 +00:00
pop bc
pop de
pop hl
ret
DisplayIntroNameTextBox: ; 6a6c (1:6a6c)
push de
2015-07-18 20:52:03 +00:00
coord hl, 0, 0
2014-05-22 22:13:20 +00:00
ld b, $a
ld c, $9
call TextBoxBorder
2015-07-18 20:52:03 +00:00
coord hl, 3, 0
ld de, .namestring
2014-05-22 22:13:20 +00:00
call PlaceString
pop de
2015-07-18 20:52:03 +00:00
coord hl, 2, 2
2014-05-22 22:13:20 +00:00
call PlaceString
call UpdateSprites
xor a
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
2014-05-22 22:13:20 +00:00
inc a
ld [wTopMenuItemX], a
ld [wMenuWatchedKeys], a
2014-05-22 22:13:20 +00:00
inc a
ld [wTopMenuItemY], a
2014-05-22 22:13:20 +00:00
inc a
ld [wMaxMenuItem], a
2014-05-22 22:13:20 +00:00
jp HandleMenuInput
.namestring ; 6aa3 (1:6aa3)
db "NAME@"
2014-10-17 08:42:32 +00:00
IF DEF(_RED)
2014-05-22 22:13:20 +00:00
DefaultNamesPlayer: ; 6aa8 (1:6aa8)
db "NEW NAME"
next "RED"
next "ASH"
next "JACK"
db "@"
DefaultNamesRival: ; 6abe (1:6abe)
db "NEW NAME"
next "BLUE"
next "GARY"
next "JOHN"
db "@"
ENDC
2014-10-17 08:42:32 +00:00
IF DEF(_BLUE)
2014-05-22 22:13:20 +00:00
DefaultNamesPlayer: ; 6aa8 (1:6aa8)
db "NEW NAME"
next "BLUE"
next "GARY"
next "JOHN"
db "@"
DefaultNamesRival: ; 6abe (1:6abe)
db "NEW NAME"
next "RED"
next "ASH"
next "JACK"
db "@"
ENDC
2014-10-17 08:42:32 +00:00
IF DEF(_YELLOW)
2014-10-09 06:14:18 +00:00
DefaultNamesPlayer:
db "NEW NAME"
next "YELLOW"
next "ASH"
next "JACK"
db "@"
DefaultNamesRival:
db "NEW NAME"
next "BLUE"
next "GARY"
next "JOHN"
db "@"
ENDC
2015-07-18 15:17:29 +00:00
GetDefaultName: ; 6ad6 (1:6ad6)
; a = name index
; hl = name list
2014-05-22 22:13:20 +00:00
ld b, a
2015-07-18 15:17:29 +00:00
ld c, 0
.loop
2014-05-22 22:13:20 +00:00
ld d, h
ld e, l
2015-07-18 15:17:29 +00:00
.innerLoop
2014-05-22 22:13:20 +00:00
ld a, [hli]
2015-07-18 15:17:29 +00:00
cp "@"
jr nz, .innerLoop
2014-05-22 22:13:20 +00:00
ld a, b
cp c
2015-07-18 15:17:29 +00:00
jr z, .foundName
2014-05-22 22:13:20 +00:00
inc c
2015-07-18 15:17:29 +00:00
jr .loop
.foundName
2014-05-22 22:13:20 +00:00
ld h, d
ld l, e
ld de, wcd6d
2014-05-22 22:13:20 +00:00
ld bc, $14
jp CopyData
2015-07-14 07:16:19 +00:00
2014-10-17 08:42:32 +00:00
IF DEF(_RED)
2014-05-22 22:13:20 +00:00
DefaultNamesPlayerList: ; 6af2 (1:6af2)
db "NEW NAME@RED@ASH@JACK@"
DefaultNamesRivalList: ; 6b08 (1:6b08)
db "NEW NAME@BLUE@GARY@JOHN@"
ENDC
2014-10-17 08:42:32 +00:00
IF DEF(_BLUE)
2014-05-22 22:13:20 +00:00
DefaultNamesPlayerList: ; 6af2 (1:6af2)
db "NEW NAME@BLUE@GARY@JOHN@"
DefaultNamesRivalList: ; 6b08 (1:6b08)
db "NEW NAME@RED@ASH@JACK@"
ENDC
2014-10-17 08:42:32 +00:00
IF DEF(_YELLOW)
2014-10-09 06:14:18 +00:00
DefaultNamesPlayerList:
db "NEW NAME@YELLOW@ASH@JACK@"
DefaultNamesRivalList:
db "NEW NAME@BLUE@GARY@JOHN@"
ENDC
2014-05-22 22:13:20 +00:00
TextTerminator_6b20: ; 6b20 (1:6b20)
db "@"