2014-02-02 01:26:39 +00:00
|
|
|
JoypadInt:: ; 92e
|
2013-02-20 04:57:07 +00:00
|
|
|
; Replaced by Joypad, called from VBlank instead of the useless
|
|
|
|
; joypad interrupt.
|
|
|
|
|
|
|
|
; This is a placeholder in case the interrupt is somehow enabled.
|
|
|
|
reti
|
|
|
|
; 92f
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
ClearJoypad:: ; 92f
|
2013-02-20 04:57:07 +00:00
|
|
|
xor a
|
|
|
|
; Pressed this frame (delta)
|
2013-03-21 02:55:09 +00:00
|
|
|
ld [hJoyPressed], a
|
2013-02-20 04:57:07 +00:00
|
|
|
; Currently pressed
|
2013-03-21 02:55:09 +00:00
|
|
|
ld [hJoyDown], a
|
2013-02-20 04:57:07 +00:00
|
|
|
ret
|
|
|
|
; 935
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Joypad:: ; 935
|
2013-02-20 04:57:07 +00:00
|
|
|
; Read the joypad register and translate it to something more
|
|
|
|
; workable for use in-game. There are 8 buttons, so we can use
|
|
|
|
; one byte to contain all player input.
|
|
|
|
|
|
|
|
; Updates:
|
|
|
|
|
2013-03-21 02:55:09 +00:00
|
|
|
; hJoypadReleased: released this frame (delta)
|
|
|
|
; hJoypadPressed: pressed this frame (delta)
|
|
|
|
; hJoypadDown: currently pressed
|
|
|
|
; hJoypadSum: pressed so far
|
2013-02-20 04:57:07 +00:00
|
|
|
|
|
|
|
; Any of these three bits can be used to disable input.
|
2015-02-10 23:14:41 +00:00
|
|
|
ld a, [wcfbe]
|
2013-02-20 04:57:07 +00:00
|
|
|
and %11010000
|
|
|
|
ret nz
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; If we're saving, input is disabled.
|
2016-05-08 18:11:24 +00:00
|
|
|
ld a, [wGameLogicPaused]
|
2013-02-20 04:57:07 +00:00
|
|
|
and a
|
|
|
|
ret nz
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; We can only get four inputs at a time.
|
|
|
|
; We take d-pad first for no particular reason.
|
2015-10-16 17:35:43 +00:00
|
|
|
ld a, R_DPAD
|
2013-02-20 07:46:40 +00:00
|
|
|
ld [rJOYP], a
|
2013-02-20 04:57:07 +00:00
|
|
|
; Read twice to give the request time to take.
|
2013-02-20 07:46:40 +00:00
|
|
|
ld a, [rJOYP]
|
2016-05-04 15:46:23 +00:00
|
|
|
ld a, [rJOYP]
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; The Joypad register output is in the lo nybble (inversed).
|
|
|
|
; We make the hi nybble of our new container d-pad input.
|
|
|
|
cpl
|
|
|
|
and $f
|
|
|
|
swap a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; We'll keep this in b for now.
|
|
|
|
ld b, a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; Buttons make 8 total inputs (A, B, Select, Start).
|
|
|
|
; We can fit this into one byte.
|
2015-10-16 17:35:43 +00:00
|
|
|
ld a, R_BUTTONS
|
2013-02-20 07:46:40 +00:00
|
|
|
ld [rJOYP], a
|
2013-02-20 04:57:07 +00:00
|
|
|
; Wait for input to stabilize.
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 6
|
2013-02-20 07:46:40 +00:00
|
|
|
ld a, [rJOYP]
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-02-20 04:57:07 +00:00
|
|
|
; Buttons take the lo nybble.
|
|
|
|
cpl
|
|
|
|
and $f
|
|
|
|
or b
|
|
|
|
ld b, a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; Reset the joypad register since we're done with it.
|
|
|
|
ld a, $30
|
2013-02-20 07:46:40 +00:00
|
|
|
ld [rJOYP], a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; To get the delta we xor the last frame's input with the new one.
|
2013-03-21 02:55:09 +00:00
|
|
|
ld a, [hJoypadDown] ; last frame
|
2013-02-20 04:57:07 +00:00
|
|
|
ld e, a
|
|
|
|
xor b
|
|
|
|
ld d, a
|
|
|
|
; Released this frame:
|
|
|
|
and e
|
2013-03-21 02:55:09 +00:00
|
|
|
ld [hJoypadReleased], a
|
2013-02-20 04:57:07 +00:00
|
|
|
; Pressed this frame:
|
|
|
|
ld a, d
|
|
|
|
and b
|
2013-03-21 02:55:09 +00:00
|
|
|
ld [hJoypadPressed], a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; Add any new presses to the list of collective presses:
|
|
|
|
ld c, a
|
2013-03-21 02:55:09 +00:00
|
|
|
ld a, [hJoypadSum]
|
2013-02-20 04:57:07 +00:00
|
|
|
or c
|
2013-03-21 02:55:09 +00:00
|
|
|
ld [hJoypadSum], a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; Currently pressed:
|
|
|
|
ld a, b
|
2013-03-21 02:55:09 +00:00
|
|
|
ld [hJoypadDown], a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; Now that we have the input, we can do stuff with it.
|
|
|
|
|
|
|
|
; For example, soft reset:
|
2013-09-08 03:49:20 +00:00
|
|
|
and A_BUTTON | B_BUTTON | SELECT | START
|
|
|
|
cp A_BUTTON | B_BUTTON | SELECT | START
|
2013-07-27 03:49:33 +00:00
|
|
|
jp z, Reset
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
ret
|
|
|
|
; 984
|
|
|
|
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
GetJoypad:: ; 984
|
2013-03-21 02:55:09 +00:00
|
|
|
; Update mirror joypad input from hJoypadDown (real input)
|
2013-02-20 04:57:07 +00:00
|
|
|
|
2013-03-21 02:55:09 +00:00
|
|
|
; hJoyReleased: released this frame (delta)
|
|
|
|
; hJoyPressed: pressed this frame (delta)
|
|
|
|
; hJoyDown: currently pressed
|
2013-02-20 04:57:07 +00:00
|
|
|
|
|
|
|
; bit 0 A
|
|
|
|
; 1 B
|
|
|
|
; 2 SELECT
|
|
|
|
; 3 START
|
|
|
|
; 4 RIGHT
|
|
|
|
; 5 LEFT
|
|
|
|
; 6 UP
|
|
|
|
; 7 DOWN
|
|
|
|
|
|
|
|
push af
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; The player input can be automated using an input stream.
|
|
|
|
; See more below.
|
|
|
|
ld a, [InputType]
|
2017-12-10 05:06:20 +00:00
|
|
|
cp AUTO_INPUT
|
2013-02-20 04:57:07 +00:00
|
|
|
jr z, .auto
|
|
|
|
|
|
|
|
; To get deltas, take this and last frame's input.
|
2013-03-21 02:55:09 +00:00
|
|
|
ld a, [hJoypadDown] ; real input
|
2013-02-20 04:57:07 +00:00
|
|
|
ld b, a
|
2013-03-21 02:55:09 +00:00
|
|
|
ld a, [hJoyDown] ; last frame mirror
|
2013-02-20 04:57:07 +00:00
|
|
|
ld e, a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; Released this frame:
|
|
|
|
xor b
|
|
|
|
ld d, a
|
|
|
|
and e
|
2013-03-21 02:55:09 +00:00
|
|
|
ld [hJoyReleased], a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; Pressed this frame:
|
|
|
|
ld a, d
|
|
|
|
and b
|
2013-03-21 02:55:09 +00:00
|
|
|
ld [hJoyPressed], a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; It looks like the collective presses got commented out here.
|
|
|
|
ld c, a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; Currently pressed:
|
|
|
|
ld a, b
|
2013-03-21 02:55:09 +00:00
|
|
|
ld [hJoyDown], a ; frame input
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
.quit
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
pop af
|
2016-04-10 18:42:14 +00:00
|
|
|
ret
|
2013-02-20 04:57:07 +00:00
|
|
|
|
|
|
|
.auto
|
|
|
|
; Use a predetermined input stream (used in the catching tutorial).
|
|
|
|
|
|
|
|
; Stream format: [input][duration]
|
|
|
|
; A value of $ff will immediately end the stream.
|
|
|
|
|
|
|
|
; Read from the input stream.
|
2013-03-21 02:55:09 +00:00
|
|
|
ld a, [hROMBank]
|
2013-02-20 04:57:07 +00:00
|
|
|
push af
|
|
|
|
ld a, [AutoInputBank]
|
|
|
|
rst Bankswitch
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
ld hl, AutoInputAddress
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; We only update when the input duration has expired.
|
|
|
|
ld a, [AutoInputLength]
|
|
|
|
and a
|
|
|
|
jr z, .updateauto
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; Until then, don't change anything.
|
|
|
|
dec a
|
|
|
|
ld [AutoInputLength], a
|
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
jr .quit
|
2016-04-10 18:42:14 +00:00
|
|
|
|
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
.updateauto
|
|
|
|
; An input of $ff will end the stream.
|
|
|
|
ld a, [hli]
|
2017-12-10 05:06:20 +00:00
|
|
|
cp -1
|
2013-02-20 04:57:07 +00:00
|
|
|
jr z, .stopauto
|
|
|
|
ld b, a
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; A duration of $ff will end the stream indefinitely.
|
|
|
|
ld a, [hli]
|
|
|
|
ld [AutoInputLength], a
|
2017-12-10 05:06:20 +00:00
|
|
|
cp -1
|
2013-02-20 04:57:07 +00:00
|
|
|
jr nz, .next
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
; The current input is overwritten.
|
|
|
|
dec hl
|
2016-05-04 15:46:23 +00:00
|
|
|
dec hl
|
2013-02-20 04:57:07 +00:00
|
|
|
ld b, NO_INPUT
|
|
|
|
jr .finishauto
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
.next
|
|
|
|
; On to the next input...
|
|
|
|
ld a, l
|
|
|
|
ld [AutoInputAddress], a
|
|
|
|
ld a, h
|
|
|
|
ld [AutoInputAddress+1], a
|
|
|
|
jr .finishauto
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
.stopauto
|
|
|
|
call StopAutoInput
|
|
|
|
ld b, NO_INPUT
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
.finishauto
|
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
ld a, b
|
2013-03-21 02:55:09 +00:00
|
|
|
ld [hJoyPressed], a ; pressed
|
|
|
|
ld [hJoyDown], a ; input
|
2013-02-20 04:57:07 +00:00
|
|
|
jr .quit
|
|
|
|
; 9ee
|
|
|
|
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
StartAutoInput:: ; 9ee
|
2013-02-20 04:57:07 +00:00
|
|
|
; Start reading automated input stream at a:hl.
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
ld [AutoInputBank], a
|
|
|
|
ld a, l
|
|
|
|
ld [AutoInputAddress], a
|
|
|
|
ld a, h
|
|
|
|
ld [AutoInputAddress+1], a
|
|
|
|
; Start reading the stream immediately.
|
|
|
|
xor a
|
|
|
|
ld [AutoInputLength], a
|
|
|
|
; Reset input mirrors.
|
|
|
|
xor a
|
2013-03-21 02:55:09 +00:00
|
|
|
ld [hJoyPressed], a ; pressed this frame
|
|
|
|
ld [hJoyReleased], a ; released this frame
|
|
|
|
ld [hJoyDown], a ; currently pressed
|
2016-04-10 18:42:14 +00:00
|
|
|
|
2013-02-20 04:57:07 +00:00
|
|
|
ld a, AUTO_INPUT
|
|
|
|
ld [InputType], a
|
|
|
|
ret
|
|
|
|
; a0a
|
|
|
|
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
StopAutoInput:: ; a0a
|
2013-02-20 04:57:07 +00:00
|
|
|
; Clear variables related to automated input.
|
|
|
|
xor a
|
|
|
|
ld [AutoInputBank], a
|
|
|
|
ld [AutoInputAddress], a
|
|
|
|
ld [AutoInputAddress+1], a
|
|
|
|
ld [AutoInputLength], a
|
|
|
|
; Back to normal input.
|
|
|
|
ld [InputType], a
|
|
|
|
ret
|
|
|
|
; a1b
|
|
|
|
|
2013-08-29 23:10:06 +00:00
|
|
|
|
2015-10-17 16:58:26 +00:00
|
|
|
JoyTitleScreenInput:: ; a1b
|
|
|
|
.loop
|
2013-08-29 23:10:06 +00:00
|
|
|
|
|
|
|
call DelayFrame
|
|
|
|
|
|
|
|
push bc
|
2015-10-17 16:58:26 +00:00
|
|
|
call JoyTextDelay
|
2013-08-29 23:10:06 +00:00
|
|
|
pop bc
|
|
|
|
|
|
|
|
ld a, [hJoyDown]
|
2013-09-08 03:49:20 +00:00
|
|
|
cp D_UP | SELECT | B_BUTTON
|
2015-10-17 16:58:26 +00:00
|
|
|
jr z, .keycombo
|
2013-08-29 23:10:06 +00:00
|
|
|
|
2015-10-16 17:35:43 +00:00
|
|
|
ld a, [hJoyLast]
|
2013-09-08 03:49:20 +00:00
|
|
|
and START | A_BUTTON
|
2015-10-17 16:58:26 +00:00
|
|
|
jr nz, .keycombo
|
2013-08-29 23:10:06 +00:00
|
|
|
|
|
|
|
dec c
|
2015-10-17 16:58:26 +00:00
|
|
|
jr nz, .loop
|
2013-08-29 23:10:06 +00:00
|
|
|
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2015-10-17 16:58:26 +00:00
|
|
|
.keycombo
|
2013-08-29 23:10:06 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; a36
|
|
|
|
|
|
|
|
|
2015-10-17 16:58:26 +00:00
|
|
|
JoyWaitAorB:: ; a36
|
|
|
|
.loop
|
2013-08-29 23:10:06 +00:00
|
|
|
call DelayFrame
|
2013-12-22 22:30:35 +00:00
|
|
|
call GetJoypad
|
2013-08-29 23:10:06 +00:00
|
|
|
ld a, [hJoyPressed]
|
2013-09-08 03:49:20 +00:00
|
|
|
and A_BUTTON | B_BUTTON
|
2013-08-29 23:10:06 +00:00
|
|
|
ret nz
|
|
|
|
call RTC
|
2015-10-17 16:58:26 +00:00
|
|
|
jr .loop
|
2013-08-29 23:10:06 +00:00
|
|
|
; a46
|
|
|
|
|
2015-11-25 15:16:29 +00:00
|
|
|
WaitButton:: ; a46
|
2013-08-29 23:10:06 +00:00
|
|
|
ld a, [hOAMUpdate]
|
|
|
|
push af
|
|
|
|
ld a, 1
|
|
|
|
ld [hOAMUpdate], a
|
|
|
|
call WaitBGMap
|
2015-10-17 16:58:26 +00:00
|
|
|
call JoyWaitAorB
|
2013-08-29 23:10:06 +00:00
|
|
|
pop af
|
|
|
|
ld [hOAMUpdate], a
|
|
|
|
ret
|
|
|
|
; a57
|
|
|
|
|
2015-10-17 16:58:26 +00:00
|
|
|
JoyTextDelay:: ; a57
|
2013-12-22 22:30:35 +00:00
|
|
|
call GetJoypad
|
2015-10-16 17:35:43 +00:00
|
|
|
ld a, [hInMenu]
|
2013-08-29 23:10:06 +00:00
|
|
|
and a
|
|
|
|
ld a, [hJoyPressed]
|
2015-10-16 17:35:43 +00:00
|
|
|
jr z, .ok
|
2013-08-29 23:10:06 +00:00
|
|
|
ld a, [hJoyDown]
|
2015-10-16 17:35:43 +00:00
|
|
|
.ok
|
2015-10-11 16:15:03 +00:00
|
|
|
ld [hJoyLast], a
|
2013-08-29 23:10:06 +00:00
|
|
|
ld a, [hJoyPressed]
|
|
|
|
and a
|
2015-10-16 17:35:43 +00:00
|
|
|
jr z, .checkframedelay
|
2013-08-29 23:10:06 +00:00
|
|
|
ld a, 15
|
|
|
|
ld [TextDelayFrames], a
|
|
|
|
ret
|
|
|
|
|
2015-10-16 17:35:43 +00:00
|
|
|
.checkframedelay
|
2013-08-29 23:10:06 +00:00
|
|
|
ld a, [TextDelayFrames]
|
|
|
|
and a
|
2015-10-16 17:35:43 +00:00
|
|
|
jr z, .restartframedelay
|
2013-08-29 23:10:06 +00:00
|
|
|
xor a
|
2015-10-11 16:15:03 +00:00
|
|
|
ld [hJoyLast], a
|
2013-08-29 23:10:06 +00:00
|
|
|
ret
|
|
|
|
|
2015-10-16 17:35:43 +00:00
|
|
|
.restartframedelay
|
2013-08-29 23:10:06 +00:00
|
|
|
ld a, 5
|
|
|
|
ld [TextDelayFrames], a
|
|
|
|
ret
|
|
|
|
; a80
|
|
|
|
|
2015-11-11 04:23:28 +00:00
|
|
|
WaitPressAorB_BlinkCursor:: ; a80
|
2015-11-02 16:15:32 +00:00
|
|
|
ld a, [hMapObjectIndexBuffer]
|
2013-08-29 23:10:06 +00:00
|
|
|
push af
|
2015-11-02 16:15:32 +00:00
|
|
|
ld a, [hObjectStructIndexBuffer]
|
2013-08-29 23:10:06 +00:00
|
|
|
push af
|
|
|
|
xor a
|
2015-11-02 16:15:32 +00:00
|
|
|
ld [hMapObjectIndexBuffer], a
|
2015-10-19 14:23:58 +00:00
|
|
|
ld a, 6
|
2015-11-02 16:15:32 +00:00
|
|
|
ld [hObjectStructIndexBuffer], a
|
2015-10-19 14:23:58 +00:00
|
|
|
|
|
|
|
.loop
|
2013-08-29 23:10:06 +00:00
|
|
|
push hl
|
2015-02-10 23:14:41 +00:00
|
|
|
hlcoord 18, 17
|
2015-11-11 04:23:28 +00:00
|
|
|
call BlinkCursor
|
2013-08-29 23:10:06 +00:00
|
|
|
pop hl
|
2015-10-19 14:23:58 +00:00
|
|
|
|
2015-10-17 16:58:26 +00:00
|
|
|
call JoyTextDelay
|
2015-10-16 17:35:43 +00:00
|
|
|
ld a, [hJoyLast]
|
2015-10-19 14:23:58 +00:00
|
|
|
and A_BUTTON | B_BUTTON
|
|
|
|
jr z, .loop
|
|
|
|
|
2013-08-29 23:10:06 +00:00
|
|
|
pop af
|
2015-11-02 16:15:32 +00:00
|
|
|
ld [hObjectStructIndexBuffer], a
|
2013-08-29 23:10:06 +00:00
|
|
|
pop af
|
2015-11-02 16:15:32 +00:00
|
|
|
ld [hMapObjectIndexBuffer], a
|
2013-08-29 23:10:06 +00:00
|
|
|
ret
|
|
|
|
; aa5
|
|
|
|
|
2015-11-11 04:23:28 +00:00
|
|
|
SimpleWaitPressAorB:: ; aa5
|
2015-10-19 14:23:58 +00:00
|
|
|
.loop
|
2015-10-17 16:58:26 +00:00
|
|
|
call JoyTextDelay
|
2015-10-16 17:35:43 +00:00
|
|
|
ld a, [hJoyLast]
|
2013-09-08 03:49:20 +00:00
|
|
|
and A_BUTTON | B_BUTTON
|
2015-10-19 14:23:58 +00:00
|
|
|
jr z, .loop
|
2013-08-29 23:10:06 +00:00
|
|
|
ret
|
|
|
|
; aaf
|
|
|
|
|
2015-11-30 03:29:45 +00:00
|
|
|
ButtonSound:: ; aaf
|
2015-10-19 14:23:58 +00:00
|
|
|
ld a, [wLinkMode]
|
2013-08-29 23:10:06 +00:00
|
|
|
and a
|
2015-10-19 14:23:58 +00:00
|
|
|
jr nz, .link
|
|
|
|
call .wait_input
|
2013-08-29 23:10:06 +00:00
|
|
|
push de
|
|
|
|
ld de, SFX_READ_TEXT_2
|
2013-10-08 17:10:36 +00:00
|
|
|
call PlaySFX
|
2013-08-29 23:10:06 +00:00
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2015-10-19 14:23:58 +00:00
|
|
|
.link
|
2013-08-29 23:10:06 +00:00
|
|
|
ld c, 65
|
|
|
|
jp DelayFrames
|
|
|
|
; ac6
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.wait_input ; ac6
|
2013-08-29 23:10:06 +00:00
|
|
|
ld a, [hOAMUpdate]
|
|
|
|
push af
|
|
|
|
ld a, $1
|
|
|
|
ld [hOAMUpdate], a
|
|
|
|
ld a, [InputType]
|
|
|
|
or a
|
2015-10-19 14:23:58 +00:00
|
|
|
jr z, .input_wait_loop
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall _DudeAutoInput_A
|
2015-10-19 14:23:58 +00:00
|
|
|
|
|
|
|
.input_wait_loop
|
|
|
|
call .blink_cursor
|
2015-10-17 16:58:26 +00:00
|
|
|
call JoyTextDelay
|
2013-08-29 23:10:06 +00:00
|
|
|
ld a, [hJoyPressed]
|
2015-10-19 14:23:58 +00:00
|
|
|
and A_BUTTON | B_BUTTON
|
|
|
|
jr nz, .received_input
|
2013-08-29 23:10:06 +00:00
|
|
|
call RTC
|
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
call DelayFrame
|
2015-10-19 14:23:58 +00:00
|
|
|
jr .input_wait_loop
|
2013-08-29 23:10:06 +00:00
|
|
|
|
2015-10-19 14:23:58 +00:00
|
|
|
.received_input
|
2013-08-29 23:10:06 +00:00
|
|
|
pop af
|
|
|
|
ld [hOAMUpdate], a
|
|
|
|
ret
|
|
|
|
; af5
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.blink_cursor ; af5
|
2015-11-10 04:01:45 +00:00
|
|
|
ld a, [hVBlankCounter]
|
2015-10-19 14:23:58 +00:00
|
|
|
and %00010000 ; bit 4, a
|
|
|
|
jr z, .cursor_off
|
|
|
|
ld a, "▼"
|
|
|
|
jr .load_cursor_state
|
2013-08-29 23:10:06 +00:00
|
|
|
|
2015-10-19 14:23:58 +00:00
|
|
|
.cursor_off
|
2017-12-29 22:07:21 +00:00
|
|
|
lda_coord 17, 17
|
2013-08-29 23:10:06 +00:00
|
|
|
|
2015-10-19 14:23:58 +00:00
|
|
|
.load_cursor_state
|
2017-12-29 22:07:21 +00:00
|
|
|
ldcoord_a 18, 17
|
2013-08-29 23:10:06 +00:00
|
|
|
ret
|
|
|
|
; b06
|
|
|
|
|
2015-11-11 04:23:28 +00:00
|
|
|
BlinkCursor:: ; b06
|
2013-08-29 23:10:06 +00:00
|
|
|
push bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld b, a
|
2015-10-19 14:23:58 +00:00
|
|
|
ld a, "▼"
|
2013-08-29 23:10:06 +00:00
|
|
|
cp b
|
|
|
|
pop bc
|
2015-11-11 04:23:28 +00:00
|
|
|
jr nz, .place_arrow
|
2015-11-02 16:15:32 +00:00
|
|
|
ld a, [hMapObjectIndexBuffer]
|
2013-08-29 23:10:06 +00:00
|
|
|
dec a
|
2015-11-02 16:15:32 +00:00
|
|
|
ld [hMapObjectIndexBuffer], a
|
2013-08-29 23:10:06 +00:00
|
|
|
ret nz
|
2015-11-02 16:15:32 +00:00
|
|
|
ld a, [hObjectStructIndexBuffer]
|
2013-08-29 23:10:06 +00:00
|
|
|
dec a
|
2015-11-02 16:15:32 +00:00
|
|
|
ld [hObjectStructIndexBuffer], a
|
2013-08-29 23:10:06 +00:00
|
|
|
ret nz
|
2015-10-19 14:23:58 +00:00
|
|
|
ld a, "─"
|
2013-08-29 23:10:06 +00:00
|
|
|
ld [hl], a
|
2015-10-19 14:23:58 +00:00
|
|
|
ld a, -1
|
2015-11-02 16:15:32 +00:00
|
|
|
ld [hMapObjectIndexBuffer], a
|
2015-10-19 14:23:58 +00:00
|
|
|
ld a, 6
|
2015-11-02 16:15:32 +00:00
|
|
|
ld [hObjectStructIndexBuffer], a
|
2013-08-29 23:10:06 +00:00
|
|
|
ret
|
|
|
|
|
2015-11-11 04:23:28 +00:00
|
|
|
.place_arrow
|
2015-11-02 16:15:32 +00:00
|
|
|
ld a, [hMapObjectIndexBuffer]
|
2013-08-29 23:10:06 +00:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
dec a
|
2015-11-02 16:15:32 +00:00
|
|
|
ld [hMapObjectIndexBuffer], a
|
2013-08-29 23:10:06 +00:00
|
|
|
ret nz
|
|
|
|
dec a
|
2015-11-02 16:15:32 +00:00
|
|
|
ld [hMapObjectIndexBuffer], a
|
|
|
|
ld a, [hObjectStructIndexBuffer]
|
2013-08-29 23:10:06 +00:00
|
|
|
dec a
|
2015-11-02 16:15:32 +00:00
|
|
|
ld [hObjectStructIndexBuffer], a
|
2013-08-29 23:10:06 +00:00
|
|
|
ret nz
|
2015-11-11 04:23:28 +00:00
|
|
|
ld a, 6
|
2015-11-02 16:15:32 +00:00
|
|
|
ld [hObjectStructIndexBuffer], a
|
2015-11-11 04:23:28 +00:00
|
|
|
ld a, "▼"
|
2013-08-29 23:10:06 +00:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; b40
|