pokered/engine/movie/oak_speech/oak_speech2.asm

220 lines
3.5 KiB
NASM
Raw Normal View History

2016-06-12 00:24:04 +00:00
ChoosePlayerName:
2015-07-18 15:17:29 +00:00
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
2016-06-12 00:24:04 +00:00
YourNameIsText:
text_far _YourNameIsText
text_end
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
ChooseRivalName:
2015-07-18 15:17:29 +00:00
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
2015-08-31 02:38:41 +00:00
ld de, wRivalName
2015-07-18 15:17:29 +00:00
call OakSpeechSlidePicLeft
jr .done
.customName
2015-08-31 02:38:41 +00:00
ld hl, wRivalName
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
2016-06-12 00:24:04 +00:00
HisNameIsText:
text_far _HisNameIsText
text_end
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
OakSpeechSlidePicLeft:
2014-05-22 22:13:20 +00:00
push de
hlcoord 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
hlcoord 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
2016-06-12 00:24:04 +00:00
OakSpeechSlidePicRight:
hlcoord 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
2016-06-12 00:24:04 +00:00
OakSpeechSlidePicCommon:
2014-05-22 22:13:20 +00:00
push hl
push de
push bc
ldh [hSlideDirection], a
2014-05-22 22:13:20 +00:00
ld a, d
ldh [hSlideAmount], a
2014-05-22 22:13:20 +00:00
ld a, e
ldh [hSlidingRegionSize], a
2014-05-22 22:13:20 +00:00
ld c, a
ldh 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
ldh [hAutoBGTransferEnabled], a
ldh 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
ldh 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
ldh [hAutoBGTransferEnabled], a
2014-05-22 22:13:20 +00:00
call Delay3
ldh a, [hSlidingRegionSize]
2014-05-22 22:13:20 +00:00
ld c, a
ld h, d
ld l, e
ldh 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
ldh a, [hSlideAmount]
2014-05-22 22:13:20 +00:00
dec a
ldh [hSlideAmount], a
2015-07-18 15:17:29 +00:00
jr nz, .loop
2014-05-22 22:13:20 +00:00
pop bc
pop de
pop hl
ret
2016-06-12 00:24:04 +00:00
DisplayIntroNameTextBox:
2014-05-22 22:13:20 +00:00
push de
hlcoord 0, 0
2014-05-22 22:13:20 +00:00
ld b, $a
ld c, $9
call TextBoxBorder
hlcoord 3, 0
ld de, .namestring
2014-05-22 22:13:20 +00:00
call PlaceString
pop de
hlcoord 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
2015-08-11 05:34:32 +00:00
ld [wMenuWatchedKeys], a ; A_BUTTON
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
2016-06-12 06:42:19 +00:00
.namestring
2014-05-22 22:13:20 +00:00
db "NAME@"
INCLUDE "data/player_names.asm"
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
GetDefaultName:
2015-07-18 15:17:29 +00:00
; 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
ld bc, NAME_BUFFER_LENGTH
2014-05-22 22:13:20 +00:00
jp CopyData
2015-07-14 07:16:19 +00:00
INCLUDE "data/player_names_list.asm"
2014-05-22 22:13:20 +00:00
LinkMenuEmptyText:
text_end