2019-02-16 09:17:55 -08:00
|
|
|
TIMESET_UP_ARROW EQU "♂" ; $ef
|
|
|
|
TIMESET_DOWN_ARROW EQU "♀" ; $f5
|
2018-01-11 19:16:17 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
InitClock:
|
2015-11-16 18:46:36 -08:00
|
|
|
; Ask the player to set the time.
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hInMenu]
|
2015-11-16 18:46:36 -08:00
|
|
|
push af
|
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hInMenu], a
|
2015-11-16 18:46:36 -08:00
|
|
|
|
|
|
|
ld a, $0
|
2015-11-25 07:16:29 -08:00
|
|
|
ld [wSpriteUpdatesEnabled], a
|
2015-11-16 18:46:36 -08:00
|
|
|
ld a, $10
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMusicFade], a
|
2017-12-25 10:40:10 -08:00
|
|
|
ld a, LOW(MUSIC_NONE)
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMusicFadeID], a
|
2017-12-25 10:40:10 -08:00
|
|
|
ld a, HIGH(MUSIC_NONE)
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMusicFadeID + 1], a
|
2015-11-16 18:46:36 -08:00
|
|
|
ld c, 8
|
|
|
|
call DelayFrames
|
2015-11-20 08:47:52 -08:00
|
|
|
call RotateFourPalettesLeft
|
2020-02-13 09:30:13 -08:00
|
|
|
call ClearTilemap
|
2015-11-16 18:46:36 -08:00
|
|
|
call ClearSprites
|
2016-06-06 15:23:00 -07:00
|
|
|
ld b, SCGB_DIPLOMA
|
2015-11-16 18:46:36 -08:00
|
|
|
call GetSGBLayout
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-16 18:46:36 -08:00
|
|
|
call LoadStandardFont
|
2017-12-09 20:37:08 -08:00
|
|
|
ld de, TimeSetBackgroundGFX
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles2 tile $00
|
2017-12-09 20:37:08 -08:00
|
|
|
lb bc, BANK(TimeSetBackgroundGFX), 1
|
2015-11-16 18:46:36 -08:00
|
|
|
call Request1bpp
|
2017-12-09 20:37:08 -08:00
|
|
|
ld de, TimeSetUpArrowGFX
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles2 tile $01
|
2017-12-09 20:37:08 -08:00
|
|
|
lb bc, BANK(TimeSetUpArrowGFX), 1
|
2015-11-16 18:46:36 -08:00
|
|
|
call Request1bpp
|
2017-12-09 20:37:08 -08:00
|
|
|
ld de, TimeSetDownArrowGFX
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles2 tile $02
|
2017-12-09 20:37:08 -08:00
|
|
|
lb bc, BANK(TimeSetDownArrowGFX), 1
|
2015-11-16 18:46:36 -08:00
|
|
|
call Request1bpp
|
|
|
|
call .ClearScreen
|
|
|
|
call WaitBGMap
|
2015-11-20 08:47:52 -08:00
|
|
|
call RotateFourPalettesRight
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, OakTimeWokeUpText
|
2015-11-16 18:46:36 -08:00
|
|
|
call PrintText
|
2017-12-23 08:34:55 -08:00
|
|
|
ld hl, wTimeSetBuffer
|
2019-02-08 12:38:31 -08:00
|
|
|
ld bc, wTimeSetBufferEnd - wTimeSetBuffer
|
2015-11-16 18:46:36 -08:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
2017-12-11 09:20:01 -08:00
|
|
|
ld a, 10 ; default hour = 10 AM
|
2015-11-16 18:46:36 -08:00
|
|
|
ld [wInitHourBuffer], a
|
|
|
|
|
|
|
|
.loop
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, OakTimeWhatTimeIsItText
|
2015-11-16 18:46:36 -08:00
|
|
|
call PrintText
|
|
|
|
hlcoord 3, 7
|
|
|
|
ld b, 2
|
|
|
|
ld c, 15
|
2019-04-08 05:15:10 -07:00
|
|
|
call Textbox
|
2015-11-16 18:46:36 -08:00
|
|
|
hlcoord 11, 7
|
|
|
|
ld [hl], $1
|
|
|
|
hlcoord 11, 10
|
|
|
|
ld [hl], $2
|
|
|
|
hlcoord 4, 9
|
|
|
|
call DisplayHourOClock
|
|
|
|
ld c, 10
|
|
|
|
call DelayFrames
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.SetHourLoop:
|
2015-11-16 18:46:36 -08:00
|
|
|
call JoyTextDelay
|
|
|
|
call SetHour
|
|
|
|
jr nc, .SetHourLoop
|
|
|
|
|
|
|
|
ld a, [wInitHourBuffer]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wStringBuffer2 + 1], a
|
2015-11-16 18:46:36 -08:00
|
|
|
call .ClearScreen
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, OakTimeWhatHoursText
|
2015-11-16 18:46:36 -08:00
|
|
|
call PrintText
|
|
|
|
call YesNoBox
|
|
|
|
jr nc, .HourIsSet
|
|
|
|
call .ClearScreen
|
|
|
|
jr .loop
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.HourIsSet:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, OakTimeHowManyMinutesText
|
2015-11-16 18:46:36 -08:00
|
|
|
call PrintText
|
|
|
|
hlcoord 11, 7
|
|
|
|
lb bc, 2, 7
|
2019-04-08 05:15:10 -07:00
|
|
|
call Textbox
|
2015-11-16 18:46:36 -08:00
|
|
|
hlcoord 15, 7
|
|
|
|
ld [hl], $1
|
|
|
|
hlcoord 15, 10
|
|
|
|
ld [hl], $2
|
|
|
|
hlcoord 12, 9
|
|
|
|
call DisplayMinutesWithMinString
|
|
|
|
ld c, 10
|
|
|
|
call DelayFrames
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.SetMinutesLoop:
|
2015-11-16 18:46:36 -08:00
|
|
|
call JoyTextDelay
|
|
|
|
call SetMinutes
|
|
|
|
jr nc, .SetMinutesLoop
|
|
|
|
|
2017-12-11 09:20:01 -08:00
|
|
|
ld a, [wInitMinuteBuffer]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wStringBuffer2 + 2], a
|
2015-11-16 18:46:36 -08:00
|
|
|
call .ClearScreen
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, OakTimeWhoaMinutesText
|
2015-11-16 18:46:36 -08:00
|
|
|
call PrintText
|
|
|
|
call YesNoBox
|
|
|
|
jr nc, .MinutesAreSet
|
|
|
|
call .ClearScreen
|
|
|
|
jr .HourIsSet
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.MinutesAreSet:
|
2018-01-24 08:12:02 -08:00
|
|
|
call InitTimeOfDay
|
2015-11-16 18:46:36 -08:00
|
|
|
ld hl, OakText_ResponseToSetTime
|
|
|
|
call PrintText
|
|
|
|
call WaitPressAorB_BlinkCursor
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hInMenu], a
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.ClearScreen:
|
2015-11-16 18:46:36 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-16 18:46:36 -08:00
|
|
|
hlcoord 0, 0
|
|
|
|
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
|
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SetHour:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hJoyPressed]
|
2015-11-16 18:46:36 -08:00
|
|
|
and A_BUTTON
|
|
|
|
jr nz, .Confirm
|
|
|
|
|
|
|
|
ld hl, hJoyLast
|
|
|
|
ld a, [hl]
|
|
|
|
and D_UP
|
|
|
|
jr nz, .up
|
|
|
|
ld a, [hl]
|
|
|
|
and D_DOWN
|
|
|
|
jr nz, .down
|
|
|
|
call DelayFrame
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.down
|
|
|
|
ld hl, wInitHourBuffer
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr nz, .DecreaseThroughMidnight
|
|
|
|
ld a, 23 + 1
|
2016-04-10 11:42:14 -07:00
|
|
|
.DecreaseThroughMidnight:
|
2015-11-16 18:46:36 -08:00
|
|
|
dec a
|
|
|
|
ld [hl], a
|
|
|
|
jr .okay
|
|
|
|
|
|
|
|
.up
|
|
|
|
ld hl, wInitHourBuffer
|
|
|
|
ld a, [hl]
|
|
|
|
cp 23
|
|
|
|
jr c, .AdvanceThroughMidnight
|
|
|
|
ld a, -1
|
2016-04-10 11:42:14 -07:00
|
|
|
.AdvanceThroughMidnight:
|
2015-11-16 18:46:36 -08:00
|
|
|
inc a
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
.okay
|
|
|
|
hlcoord 4, 9
|
|
|
|
ld a, " "
|
|
|
|
ld bc, 15
|
|
|
|
call ByteFill
|
|
|
|
hlcoord 4, 9
|
|
|
|
call DisplayHourOClock
|
|
|
|
call WaitBGMap
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Confirm:
|
2015-11-16 18:46:36 -08:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DisplayHourOClock:
|
2015-11-16 18:46:36 -08:00
|
|
|
push hl
|
|
|
|
ld a, [wInitHourBuffer]
|
|
|
|
ld c, a
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
|
|
|
call PrintHour
|
|
|
|
inc hl
|
|
|
|
ld de, String_oclock
|
|
|
|
call PlaceString
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2020-10-05 17:10:01 -07:00
|
|
|
DisplayHoursMinutesWithMinString: ; unreferenced
|
2015-11-16 18:46:36 -08:00
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
push hl
|
|
|
|
call DisplayHourOClock
|
|
|
|
pop de
|
|
|
|
inc de
|
2016-05-04 08:46:23 -07:00
|
|
|
inc de
|
2015-12-18 17:07:09 -08:00
|
|
|
ld a, ":"
|
2015-11-16 18:46:36 -08:00
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
push de
|
2015-12-18 17:07:09 -08:00
|
|
|
ld hl, 3
|
2015-11-16 18:46:36 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld [hli], a
|
|
|
|
ld a, [de]
|
|
|
|
ld [hl], a
|
|
|
|
pop hl
|
|
|
|
call DisplayMinutesWithMinString
|
|
|
|
inc hl
|
2016-05-10 09:31:49 -07:00
|
|
|
inc hl
|
|
|
|
inc hl
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SetMinutes:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hJoyPressed]
|
2015-11-16 18:46:36 -08:00
|
|
|
and A_BUTTON
|
2015-12-18 17:07:09 -08:00
|
|
|
jr nz, .a_button
|
2015-11-16 18:46:36 -08:00
|
|
|
ld hl, hJoyLast
|
|
|
|
ld a, [hl]
|
|
|
|
and D_UP
|
2015-12-18 17:07:09 -08:00
|
|
|
jr nz, .d_up
|
2015-11-16 18:46:36 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and D_DOWN
|
2015-12-18 17:07:09 -08:00
|
|
|
jr nz, .d_down
|
2015-11-16 18:46:36 -08:00
|
|
|
call DelayFrame
|
|
|
|
and a
|
|
|
|
ret
|
2015-12-18 17:07:09 -08:00
|
|
|
|
|
|
|
.d_down
|
2017-12-11 09:20:01 -08:00
|
|
|
ld hl, wInitMinuteBuffer
|
2015-11-16 18:46:36 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-18 17:07:09 -08:00
|
|
|
jr nz, .decrease
|
2015-11-16 18:46:36 -08:00
|
|
|
ld a, 59 + 1
|
2015-12-18 17:07:09 -08:00
|
|
|
.decrease
|
2015-11-16 18:46:36 -08:00
|
|
|
dec a
|
|
|
|
ld [hl], a
|
2015-12-18 17:07:09 -08:00
|
|
|
jr .finish_dpad
|
|
|
|
|
|
|
|
.d_up
|
2017-12-11 09:20:01 -08:00
|
|
|
ld hl, wInitMinuteBuffer
|
2015-11-16 18:46:36 -08:00
|
|
|
ld a, [hl]
|
|
|
|
cp 59
|
2015-12-18 17:07:09 -08:00
|
|
|
jr c, .increase
|
2015-11-16 18:46:36 -08:00
|
|
|
ld a, -1
|
2015-12-18 17:07:09 -08:00
|
|
|
.increase
|
2015-11-16 18:46:36 -08:00
|
|
|
inc a
|
|
|
|
ld [hl], a
|
2015-12-18 17:07:09 -08:00
|
|
|
.finish_dpad
|
2015-11-16 18:46:36 -08:00
|
|
|
hlcoord 12, 9
|
|
|
|
ld a, " "
|
|
|
|
ld bc, 7
|
|
|
|
call ByteFill
|
|
|
|
hlcoord 12, 9
|
|
|
|
call DisplayMinutesWithMinString
|
|
|
|
call WaitBGMap
|
|
|
|
and a
|
|
|
|
ret
|
2015-12-18 17:07:09 -08:00
|
|
|
.a_button
|
2015-11-16 18:46:36 -08:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DisplayMinutesWithMinString:
|
2017-12-11 09:20:01 -08:00
|
|
|
ld de, wInitMinuteBuffer
|
2019-11-03 17:17:04 -08:00
|
|
|
call PrintTwoDigitNumberLeftAlign
|
2015-11-16 18:46:36 -08:00
|
|
|
inc hl
|
|
|
|
ld de, String_min
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
|
2019-11-03 17:17:04 -08:00
|
|
|
PrintTwoDigitNumberLeftAlign:
|
2015-11-16 18:46:36 -08:00
|
|
|
push hl
|
|
|
|
ld a, " "
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
pop hl
|
2019-11-03 17:17:04 -08:00
|
|
|
lb bc, PRINTNUM_LEFTALIGN | 1, 2
|
2015-11-16 18:46:36 -08:00
|
|
|
call PrintNum
|
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
OakTimeWokeUpText:
|
|
|
|
text_far _OakTimeWokeUpText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-16 18:46:36 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
OakTimeWhatTimeIsItText:
|
|
|
|
text_far _OakTimeWhatTimeIsItText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-16 18:46:36 -08:00
|
|
|
|
|
|
|
String_oclock:
|
|
|
|
db "o'clock@"
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
OakTimeWhatHoursText:
|
2015-11-16 18:46:36 -08:00
|
|
|
; What?@ @
|
2019-10-20 15:24:17 -07:00
|
|
|
text_far _OakTimeWhatHoursText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_asm
|
2015-11-16 18:46:36 -08:00
|
|
|
hlcoord 1, 16
|
|
|
|
call DisplayHourOClock
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .OakTimeHoursQuestionMarkText
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.OakTimeHoursQuestionMarkText:
|
|
|
|
text_far _OakTimeHoursQuestionMarkText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-16 18:46:36 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
OakTimeHowManyMinutesText:
|
|
|
|
text_far _OakTimeHowManyMinutesText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-16 18:46:36 -08:00
|
|
|
|
|
|
|
String_min:
|
|
|
|
db "min.@"
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
OakTimeWhoaMinutesText:
|
2015-11-16 18:46:36 -08:00
|
|
|
; Whoa!@ @
|
2019-10-20 15:24:17 -07:00
|
|
|
text_far _OakTimeWhoaMinutesText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_asm
|
2015-11-16 18:46:36 -08:00
|
|
|
hlcoord 7, 14
|
|
|
|
call DisplayMinutesWithMinString
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .OakTimeMinutesQuestionMarkText
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.OakTimeMinutesQuestionMarkText:
|
|
|
|
text_far _OakTimeMinutesQuestionMarkText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-16 18:46:36 -08:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
OakText_ResponseToSetTime:
|
2018-11-17 10:33:03 -08:00
|
|
|
text_asm
|
2015-11-16 18:46:36 -08:00
|
|
|
decoord 1, 14
|
|
|
|
ld a, [wInitHourBuffer]
|
|
|
|
ld c, a
|
|
|
|
call PrintHour
|
|
|
|
ld [hl], ":"
|
|
|
|
inc hl
|
2017-12-11 09:20:01 -08:00
|
|
|
ld de, wInitMinuteBuffer
|
2015-11-16 18:46:36 -08:00
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
|
|
|
|
call PrintNum
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
ld a, [wInitHourBuffer]
|
2017-12-11 09:20:01 -08:00
|
|
|
cp MORN_HOUR
|
2017-12-10 22:02:28 -08:00
|
|
|
jr c, .nite
|
2017-12-11 09:20:01 -08:00
|
|
|
cp DAY_HOUR + 1
|
2017-12-10 22:02:28 -08:00
|
|
|
jr c, .morn
|
2017-12-11 09:20:01 -08:00
|
|
|
cp NITE_HOUR
|
2017-12-10 22:02:28 -08:00
|
|
|
jr c, .day
|
2019-10-20 15:24:17 -07:00
|
|
|
.nite
|
|
|
|
ld hl, .OakTimeSoDarkText
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
2019-10-20 15:24:17 -07:00
|
|
|
.morn
|
|
|
|
ld hl, .OakTimeOversleptText
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
2019-10-20 15:24:17 -07:00
|
|
|
.day
|
|
|
|
ld hl, .OakTimeYikesText
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.OakTimeOversleptText:
|
|
|
|
text_far _OakTimeOversleptText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-16 18:46:36 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.OakTimeYikesText:
|
|
|
|
text_far _OakTimeYikesText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-16 18:46:36 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.OakTimeSoDarkText:
|
|
|
|
text_far _OakTimeSoDarkText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-16 18:46:36 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TimeSetBackgroundGFX:
|
2018-01-21 10:58:16 -08:00
|
|
|
INCBIN "gfx/new_game/timeset_bg.1bpp"
|
2018-06-24 07:09:41 -07:00
|
|
|
TimeSetUpArrowGFX:
|
2018-01-21 10:58:16 -08:00
|
|
|
INCBIN "gfx/new_game/up_arrow.1bpp"
|
2018-06-24 07:09:41 -07:00
|
|
|
TimeSetDownArrowGFX:
|
2018-01-21 10:58:16 -08:00
|
|
|
INCBIN "gfx/new_game/down_arrow.1bpp"
|
2015-11-16 18:46:36 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SetDayOfWeek:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hInMenu]
|
2015-11-16 18:46:36 -08:00
|
|
|
push af
|
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hInMenu], a
|
2017-12-09 20:37:08 -08:00
|
|
|
ld de, TimeSetUpArrowGFX
|
2018-01-11 19:16:17 -08:00
|
|
|
ld hl, vTiles0 tile TIMESET_UP_ARROW
|
2017-12-09 20:37:08 -08:00
|
|
|
lb bc, BANK(TimeSetUpArrowGFX), 1
|
2015-11-16 18:46:36 -08:00
|
|
|
call Request1bpp
|
2017-12-09 20:37:08 -08:00
|
|
|
ld de, TimeSetDownArrowGFX
|
2018-01-11 19:16:17 -08:00
|
|
|
ld hl, vTiles0 tile TIMESET_DOWN_ARROW
|
2017-12-09 20:37:08 -08:00
|
|
|
lb bc, BANK(TimeSetDownArrowGFX), 1
|
2015-11-16 18:46:36 -08:00
|
|
|
call Request1bpp
|
|
|
|
xor a
|
2015-12-18 17:07:09 -08:00
|
|
|
ld [wTempDayOfWeek], a
|
|
|
|
.loop
|
2015-11-16 18:46:36 -08:00
|
|
|
hlcoord 0, 12
|
|
|
|
lb bc, 4, 18
|
2019-04-08 05:15:10 -07:00
|
|
|
call Textbox
|
2018-01-23 13:08:43 -08:00
|
|
|
call LoadStandardMenuHeader
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .OakTimeWhatDayIsItText
|
2015-11-16 18:46:36 -08:00
|
|
|
call PrintText
|
|
|
|
hlcoord 9, 3
|
|
|
|
ld b, 2
|
|
|
|
ld c, 9
|
2019-04-08 05:15:10 -07:00
|
|
|
call Textbox
|
2015-11-16 18:46:36 -08:00
|
|
|
hlcoord 14, 3
|
2018-01-11 19:16:17 -08:00
|
|
|
ld [hl], TIMESET_UP_ARROW
|
2015-11-16 18:46:36 -08:00
|
|
|
hlcoord 14, 6
|
2018-01-11 19:16:17 -08:00
|
|
|
ld [hl], TIMESET_DOWN_ARROW
|
2015-11-16 18:46:36 -08:00
|
|
|
hlcoord 10, 5
|
2015-12-18 17:07:09 -08:00
|
|
|
call .PlaceWeekdayString
|
2015-11-25 07:16:29 -08:00
|
|
|
call ApplyTilemap
|
2015-11-16 18:46:36 -08:00
|
|
|
ld c, 10
|
|
|
|
call DelayFrames
|
2015-12-18 17:07:09 -08:00
|
|
|
.loop2
|
2015-11-16 18:46:36 -08:00
|
|
|
call JoyTextDelay
|
2015-12-18 17:07:09 -08:00
|
|
|
call .GetJoypadAction
|
|
|
|
jr nc, .loop2
|
2015-11-16 18:46:36 -08:00
|
|
|
call ExitMenu
|
|
|
|
call UpdateSprites
|
2015-12-18 17:07:09 -08:00
|
|
|
ld hl, .ConfirmWeekdayText
|
2015-11-16 18:46:36 -08:00
|
|
|
call PrintText
|
|
|
|
call YesNoBox
|
2015-12-18 17:07:09 -08:00
|
|
|
jr c, .loop
|
|
|
|
ld a, [wTempDayOfWeek]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wStringBuffer2], a
|
2018-01-24 08:12:02 -08:00
|
|
|
call InitDayOfWeek
|
2015-11-16 18:46:36 -08:00
|
|
|
call LoadStandardFont
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hInMenu], a
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.GetJoypadAction:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hJoyPressed]
|
2015-11-16 18:46:36 -08:00
|
|
|
and A_BUTTON
|
2015-12-18 17:07:09 -08:00
|
|
|
jr z, .not_A
|
2015-11-16 18:46:36 -08:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2015-12-18 17:07:09 -08:00
|
|
|
.not_A
|
2015-11-16 18:46:36 -08:00
|
|
|
ld hl, hJoyLast
|
|
|
|
ld a, [hl]
|
|
|
|
and D_UP
|
2015-12-18 17:07:09 -08:00
|
|
|
jr nz, .d_up
|
2015-11-16 18:46:36 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and D_DOWN
|
2015-12-18 17:07:09 -08:00
|
|
|
jr nz, .d_down
|
2015-11-16 18:46:36 -08:00
|
|
|
call DelayFrame
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2015-12-18 17:07:09 -08:00
|
|
|
.d_down
|
|
|
|
ld hl, wTempDayOfWeek
|
2015-11-16 18:46:36 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-18 17:07:09 -08:00
|
|
|
jr nz, .decrease
|
2017-12-11 09:20:01 -08:00
|
|
|
ld a, SATURDAY + 1
|
2015-11-16 18:46:36 -08:00
|
|
|
|
2015-12-18 17:07:09 -08:00
|
|
|
.decrease
|
2015-11-16 18:46:36 -08:00
|
|
|
dec a
|
|
|
|
ld [hl], a
|
2015-12-18 17:07:09 -08:00
|
|
|
jr .finish_dpad
|
2015-11-16 18:46:36 -08:00
|
|
|
|
2015-12-18 17:07:09 -08:00
|
|
|
.d_up
|
|
|
|
ld hl, wTempDayOfWeek
|
2015-11-16 18:46:36 -08:00
|
|
|
ld a, [hl]
|
|
|
|
cp 6
|
2015-12-18 17:07:09 -08:00
|
|
|
jr c, .increase
|
2017-12-11 09:20:01 -08:00
|
|
|
ld a, SUNDAY - 1
|
2015-11-16 18:46:36 -08:00
|
|
|
|
2015-12-18 17:07:09 -08:00
|
|
|
.increase
|
2015-11-16 18:46:36 -08:00
|
|
|
inc a
|
|
|
|
ld [hl], a
|
|
|
|
|
2015-12-18 17:07:09 -08:00
|
|
|
.finish_dpad
|
2015-11-16 18:46:36 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-16 18:46:36 -08:00
|
|
|
hlcoord 10, 4
|
2015-12-18 17:07:09 -08:00
|
|
|
ld b, 2
|
|
|
|
ld c, 9
|
2015-11-16 18:46:36 -08:00
|
|
|
call ClearBox
|
|
|
|
hlcoord 10, 5
|
2015-12-18 17:07:09 -08:00
|
|
|
call .PlaceWeekdayString
|
2015-11-16 18:46:36 -08:00
|
|
|
call WaitBGMap
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PlaceWeekdayString:
|
2015-11-16 18:46:36 -08:00
|
|
|
push hl
|
2015-12-18 17:07:09 -08:00
|
|
|
ld a, [wTempDayOfWeek]
|
2015-11-16 18:46:36 -08:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-18 17:07:09 -08:00
|
|
|
ld hl, .WeekdayStrings
|
2015-11-16 18:46:36 -08:00
|
|
|
add hl, de
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, de
|
2015-11-16 18:46:36 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld d, [hl]
|
|
|
|
ld e, a
|
|
|
|
pop hl
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.WeekdayStrings:
|
2018-01-23 14:39:09 -08:00
|
|
|
; entries correspond to wCurDay constants (see constants/wram_constants.asm)
|
2015-12-18 17:07:09 -08:00
|
|
|
dw .Sunday
|
|
|
|
dw .Monday
|
|
|
|
dw .Tuesday
|
|
|
|
dw .Wednesday
|
|
|
|
dw .Thursday
|
|
|
|
dw .Friday
|
|
|
|
dw .Saturday
|
|
|
|
dw .Sunday
|
|
|
|
|
|
|
|
.Sunday: db " SUNDAY@"
|
|
|
|
.Monday: db " MONDAY@"
|
|
|
|
.Tuesday: db " TUESDAY@"
|
|
|
|
.Wednesday: db "WEDNESDAY@"
|
|
|
|
.Thursday: db "THURSDAY@"
|
|
|
|
.Friday: db " FRIDAY@"
|
|
|
|
.Saturday: db "SATURDAY@"
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.OakTimeWhatDayIsItText:
|
|
|
|
text_far _OakTimeWhatDayIsItText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-16 18:46:36 -08:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
.ConfirmWeekdayText:
|
2018-11-17 10:33:03 -08:00
|
|
|
text_asm
|
2015-11-16 18:46:36 -08:00
|
|
|
hlcoord 1, 14
|
2015-12-18 17:07:09 -08:00
|
|
|
call .PlaceWeekdayString
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .OakTimeIsItText
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.OakTimeIsItText:
|
|
|
|
text_far _OakTimeIsItText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-16 18:46:36 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
InitialSetDSTFlag:
|
2015-11-16 18:46:36 -08:00
|
|
|
ld a, [wDST]
|
|
|
|
set 7, a
|
|
|
|
ld [wDST], a
|
|
|
|
hlcoord 1, 14
|
|
|
|
lb bc, 3, 18
|
|
|
|
call ClearBox
|
2015-12-18 17:07:09 -08:00
|
|
|
ld hl, .Text
|
2016-05-08 11:11:24 -07:00
|
|
|
call PlaceHLTextAtBC
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Text:
|
2018-11-17 10:33:03 -08:00
|
|
|
text_asm
|
2015-11-16 18:46:36 -08:00
|
|
|
call UpdateTime
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hHours]
|
2015-11-16 18:46:36 -08:00
|
|
|
ld b, a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hMinutes]
|
2015-11-16 18:46:36 -08:00
|
|
|
ld c, a
|
|
|
|
decoord 1, 14
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall PrintHoursMins
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .DSTIsThatOKText
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.DSTIsThatOKText:
|
|
|
|
text_far _DSTIsThatOKText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-16 18:46:36 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
InitialClearDSTFlag:
|
2015-11-16 18:46:36 -08:00
|
|
|
ld a, [wDST]
|
|
|
|
res 7, a
|
|
|
|
ld [wDST], a
|
|
|
|
hlcoord 1, 14
|
|
|
|
lb bc, 3, 18
|
|
|
|
call ClearBox
|
2015-12-18 17:07:09 -08:00
|
|
|
ld hl, .Text
|
2016-05-08 11:11:24 -07:00
|
|
|
call PlaceHLTextAtBC
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Text:
|
2018-11-17 10:33:03 -08:00
|
|
|
text_asm
|
2015-11-16 18:46:36 -08:00
|
|
|
call UpdateTime
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hHours]
|
2015-11-16 18:46:36 -08:00
|
|
|
ld b, a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hMinutes]
|
2015-11-16 18:46:36 -08:00
|
|
|
ld c, a
|
|
|
|
decoord 1, 14
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall PrintHoursMins
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .TimeAskOkayText
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.TimeAskOkayText:
|
|
|
|
text_far _TimeAskOkayText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-16 18:46:36 -08:00
|
|
|
|
2020-06-21 13:27:43 -07:00
|
|
|
MrChrono: ; unreferenced
|
2015-11-16 18:46:36 -08:00
|
|
|
hlcoord 1, 14
|
|
|
|
lb bc, 3, SCREEN_WIDTH - 2
|
|
|
|
call ClearBox
|
2015-12-18 17:07:09 -08:00
|
|
|
ld hl, .Text
|
2016-05-08 11:11:24 -07:00
|
|
|
call PlaceHLTextAtBC
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
.Text:
|
2018-11-17 10:33:03 -08:00
|
|
|
text_asm
|
2015-11-16 18:46:36 -08:00
|
|
|
call UpdateTime
|
|
|
|
|
|
|
|
hlcoord 1, 14
|
|
|
|
ld [hl], "R"
|
|
|
|
inc hl
|
|
|
|
ld [hl], "T"
|
|
|
|
inc hl
|
|
|
|
ld [hl], " "
|
|
|
|
inc hl
|
|
|
|
|
|
|
|
ld de, hRTCDayLo
|
2015-12-18 17:07:09 -08:00
|
|
|
call .PrintTime
|
2015-11-16 18:46:36 -08:00
|
|
|
|
|
|
|
hlcoord 1, 16
|
|
|
|
ld [hl], "D"
|
|
|
|
inc hl
|
|
|
|
ld [hl], "F"
|
|
|
|
inc hl
|
|
|
|
ld [hl], " "
|
|
|
|
inc hl
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wStartDay
|
2015-12-18 17:07:09 -08:00
|
|
|
call .PrintTime
|
2015-11-16 18:46:36 -08:00
|
|
|
|
|
|
|
ld [hl], " "
|
|
|
|
inc hl
|
|
|
|
|
|
|
|
ld a, [wDST]
|
|
|
|
bit 7, a
|
|
|
|
jr z, .off
|
|
|
|
|
|
|
|
ld [hl], "O"
|
|
|
|
inc hl
|
|
|
|
ld [hl], "N"
|
|
|
|
inc hl
|
|
|
|
jr .done
|
|
|
|
|
|
|
|
.off
|
|
|
|
ld [hl], "O"
|
|
|
|
inc hl
|
|
|
|
ld [hl], "F"
|
|
|
|
inc hl
|
|
|
|
ld [hl], "F"
|
|
|
|
inc hl
|
|
|
|
|
|
|
|
.done
|
2015-12-18 17:07:09 -08:00
|
|
|
ld hl, .NowOnDebug
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
.NowOnDebug:
|
2015-11-16 18:46:36 -08:00
|
|
|
text "<PARA>Now on DEBUG…"
|
|
|
|
prompt
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PrintTime:
|
2015-11-16 18:46:36 -08:00
|
|
|
lb bc, 1, 3
|
|
|
|
call PrintNum
|
|
|
|
ld [hl], "."
|
|
|
|
inc hl
|
|
|
|
inc de
|
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
|
|
|
|
call PrintNum
|
|
|
|
ld [hl], ":"
|
|
|
|
inc hl
|
|
|
|
inc de
|
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
|
|
|
|
call PrintNum
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PrintHour:
|
2015-11-16 18:46:36 -08:00
|
|
|
ld l, e
|
|
|
|
ld h, d
|
|
|
|
push bc
|
|
|
|
call GetTimeOfDayString
|
|
|
|
call PlaceString
|
|
|
|
ld l, c
|
|
|
|
ld h, b
|
|
|
|
inc hl
|
|
|
|
pop bc
|
|
|
|
call AdjustHourForAMorPM
|
2018-07-28 16:27:34 -07:00
|
|
|
ld [wDeciramBuffer], a
|
|
|
|
ld de, wDeciramBuffer
|
2019-11-03 17:17:04 -08:00
|
|
|
call PrintTwoDigitNumberLeftAlign
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetTimeOfDayString:
|
2015-11-16 18:46:36 -08:00
|
|
|
ld a, c
|
2017-12-11 09:20:01 -08:00
|
|
|
cp MORN_HOUR
|
2015-11-16 18:46:36 -08:00
|
|
|
jr c, .nite
|
2017-12-11 09:20:01 -08:00
|
|
|
cp DAY_HOUR
|
2015-11-16 18:46:36 -08:00
|
|
|
jr c, .morn
|
2017-12-11 09:20:01 -08:00
|
|
|
cp NITE_HOUR
|
2015-11-16 18:46:36 -08:00
|
|
|
jr c, .day
|
|
|
|
.nite
|
2017-12-10 22:02:28 -08:00
|
|
|
ld de, .nite_string
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
.morn
|
2017-12-10 22:02:28 -08:00
|
|
|
ld de, .morn_string
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
.day
|
2017-12-10 22:02:28 -08:00
|
|
|
ld de, .day_string
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
2017-12-10 22:02:28 -08:00
|
|
|
.nite_string: db "NITE@"
|
|
|
|
.morn_string: db "MORN@"
|
|
|
|
.day_string: db "DAY@"
|
2015-11-16 18:46:36 -08:00
|
|
|
|
|
|
|
AdjustHourForAMorPM:
|
|
|
|
; Convert the hour stored in c (0-23) to a 1-12 value
|
|
|
|
ld a, c
|
|
|
|
or a
|
|
|
|
jr z, .midnight
|
2017-12-11 09:20:01 -08:00
|
|
|
cp NOON_HOUR
|
2015-11-16 18:46:36 -08:00
|
|
|
ret c
|
|
|
|
ret z
|
2017-12-11 09:20:01 -08:00
|
|
|
sub NOON_HOUR
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|
|
|
|
|
|
|
|
.midnight
|
2017-12-11 09:20:01 -08:00
|
|
|
ld a, NOON_HOUR
|
2015-11-16 18:46:36 -08:00
|
|
|
ret
|