2018-06-24 14:09:41 +00:00
|
|
|
_InitializeStartDay:
|
2015-10-24 14:34:19 +00:00
|
|
|
call InitializeStartDay
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ClearDailyTimers:
|
2015-10-03 02:49:26 +00:00
|
|
|
xor a
|
2015-10-10 21:03:04 +00:00
|
|
|
ld [wLuckyNumberDayBuffer], a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wUnusedTwoDayTimer], a
|
|
|
|
ld [wDailyResetTimer], a
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
InitCallReceiveDelay::
|
2015-10-03 02:49:26 +00:00
|
|
|
xor a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wTimeCyclesSinceLastCall], a
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
NextCallReceiveDelay:
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wTimeCyclesSinceLastCall]
|
2015-10-03 02:49:26 +00:00
|
|
|
cp 3
|
2015-10-24 14:34:19 +00:00
|
|
|
jr c, .okay
|
2015-10-03 02:49:26 +00:00
|
|
|
ld a, 3
|
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
.okay
|
2015-10-03 02:49:26 +00:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-10-24 14:34:19 +00:00
|
|
|
ld hl, .ReceiveCallDelays
|
2015-10-03 02:49:26 +00:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
2015-10-24 14:34:19 +00:00
|
|
|
jp RestartReceiveCallDelay
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.ReceiveCallDelays:
|
2015-10-03 02:49:26 +00:00
|
|
|
db 20, 10, 5, 3
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CheckReceiveCallTimer:
|
2015-10-24 14:34:19 +00:00
|
|
|
call CheckReceiveCallDelay ; check timer
|
2015-10-03 02:49:26 +00:00
|
|
|
ret nc
|
2015-10-24 14:34:19 +00:00
|
|
|
ld hl, wTimeCyclesSinceLastCall
|
2015-10-03 02:49:26 +00:00
|
|
|
ld a, [hl]
|
|
|
|
cp 3
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nc, .ok
|
2015-10-03 02:49:26 +00:00
|
|
|
inc [hl]
|
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
.ok
|
|
|
|
call NextCallReceiveDelay ; restart timer
|
2015-10-03 02:49:26 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
InitOneDayCountdown:
|
2015-10-03 02:49:26 +00:00
|
|
|
ld a, 1
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
InitNDaysCountdown:
|
2015-10-03 02:49:26 +00:00
|
|
|
ld [hl], a
|
|
|
|
push hl
|
|
|
|
call UpdateTime
|
|
|
|
pop hl
|
|
|
|
inc hl
|
2015-10-24 14:34:19 +00:00
|
|
|
call CopyDayToHL
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CheckDayDependentEventHL:
|
2015-10-03 02:49:26 +00:00
|
|
|
inc hl
|
|
|
|
push hl
|
2015-10-24 14:34:19 +00:00
|
|
|
call CalcDaysSince
|
|
|
|
call GetDaysSince
|
2015-10-03 02:49:26 +00:00
|
|
|
pop hl
|
|
|
|
dec hl
|
2015-10-24 14:34:19 +00:00
|
|
|
call UpdateTimeRemaining
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
RestartReceiveCallDelay:
|
2015-10-24 14:34:19 +00:00
|
|
|
ld hl, wReceiveCallDelay_MinsRemaining
|
2015-10-03 02:49:26 +00:00
|
|
|
ld [hl], a
|
|
|
|
call UpdateTime
|
2015-10-24 14:34:19 +00:00
|
|
|
ld hl, wReceiveCallDelay_StartTime
|
|
|
|
call CopyDayHourMinToHL
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CheckReceiveCallDelay:
|
2015-10-24 14:34:19 +00:00
|
|
|
ld hl, wReceiveCallDelay_StartTime
|
|
|
|
call CalcMinsHoursDaysSince
|
|
|
|
call GetMinutesSinceIfLessThan60
|
|
|
|
ld hl, wReceiveCallDelay_MinsRemaining
|
|
|
|
call UpdateTimeRemaining
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
RestartDailyResetTimer:
|
2015-10-24 14:34:19 +00:00
|
|
|
ld hl, wDailyResetTimer
|
|
|
|
jp InitOneDayCountdown
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CheckDailyResetTimer::
|
2015-10-24 14:34:19 +00:00
|
|
|
ld hl, wDailyResetTimer
|
2015-10-16 17:35:43 +00:00
|
|
|
call CheckDayDependentEventHL
|
2015-10-03 02:49:26 +00:00
|
|
|
ret nc
|
|
|
|
xor a
|
2017-12-28 12:15:46 +00:00
|
|
|
ld hl, wDailyFlags
|
2018-01-22 20:59:24 +00:00
|
|
|
ld [hli], a ; wDailyFlags
|
|
|
|
ld [hli], a ; wWeeklyFlags
|
|
|
|
ld [hli], a ; wSwarmFlags
|
|
|
|
ld [hl], a ; wSwarmFlags + 1
|
2015-10-03 02:49:26 +00:00
|
|
|
ld hl, wDailyRematchFlags
|
|
|
|
rept 4
|
|
|
|
ld [hli], a
|
|
|
|
endr
|
|
|
|
ld hl, wDailyPhoneItemFlags
|
|
|
|
rept 4
|
|
|
|
ld [hli], a
|
|
|
|
endr
|
|
|
|
ld hl, wDailyPhoneTimeOfDayFlags
|
|
|
|
rept 4
|
|
|
|
ld [hli], a
|
|
|
|
endr
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, wKenjiBreakTimer
|
2015-10-03 02:49:26 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr z, .RestartKenjiBreakCountdown
|
2015-10-03 02:49:26 +00:00
|
|
|
dec [hl]
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nz, .DontRestartKenjiBreakCountdown
|
2016-04-10 18:42:14 +00:00
|
|
|
.RestartKenjiBreakCountdown:
|
2018-01-24 16:17:05 +00:00
|
|
|
call SampleKenjiBreakCountdown
|
2016-04-10 18:42:14 +00:00
|
|
|
.DontRestartKenjiBreakCountdown:
|
2015-10-24 14:34:19 +00:00
|
|
|
jr RestartDailyResetTimer
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SampleKenjiBreakCountdown:
|
2016-03-02 03:31:21 +00:00
|
|
|
; Generate a random number between 3 and 6
|
2015-10-03 02:49:26 +00:00
|
|
|
call Random
|
2018-01-11 17:00:01 +00:00
|
|
|
and %11
|
2015-10-03 02:49:26 +00:00
|
|
|
add 3
|
2015-12-01 20:35:28 +00:00
|
|
|
ld [wKenjiBreakTimer], a
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
StartBugContestTimer:
|
2018-01-11 17:00:01 +00:00
|
|
|
ld a, BUG_CONTEST_MINUTES
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wBugContestMinsRemaining], a
|
2018-01-11 17:00:01 +00:00
|
|
|
ld a, BUG_CONTEST_SECONDS
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wBugContestSecsRemaining], a
|
2015-10-03 02:49:26 +00:00
|
|
|
call UpdateTime
|
2015-10-24 14:34:19 +00:00
|
|
|
ld hl, wBugContestStartTime
|
|
|
|
call CopyDayHourMinSecToHL
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CheckBugContestTimer::
|
2015-10-24 14:34:19 +00:00
|
|
|
ld hl, wBugContestStartTime
|
|
|
|
call CalcSecsMinsHoursDaysSince
|
|
|
|
ld a, [wDaysSince]
|
2015-10-03 02:49:26 +00:00
|
|
|
and a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nz, .timed_out
|
|
|
|
ld a, [wHoursSince]
|
2015-10-03 02:49:26 +00:00
|
|
|
and a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nz, .timed_out
|
|
|
|
ld a, [wSecondsSince]
|
2015-10-03 02:49:26 +00:00
|
|
|
ld b, a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wBugContestSecsRemaining]
|
2015-10-03 02:49:26 +00:00
|
|
|
sub b
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nc, .okay
|
|
|
|
add 60
|
|
|
|
|
|
|
|
.okay
|
|
|
|
ld [wBugContestSecsRemaining], a
|
|
|
|
ld a, [wMinutesSince]
|
2015-10-03 02:49:26 +00:00
|
|
|
ld b, a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wBugContestMinsRemaining]
|
2015-10-03 02:49:26 +00:00
|
|
|
sbc b
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wBugContestMinsRemaining], a
|
|
|
|
jr c, .timed_out
|
2015-10-03 02:49:26 +00:00
|
|
|
and a
|
|
|
|
ret
|
2015-10-24 14:34:19 +00:00
|
|
|
|
|
|
|
.timed_out
|
2015-10-03 02:49:26 +00:00
|
|
|
xor a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wBugContestMinsRemaining], a
|
|
|
|
ld [wBugContestSecsRemaining], a
|
2015-10-03 02:49:26 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
InitializeStartDay:
|
2015-10-03 02:49:26 +00:00
|
|
|
call UpdateTime
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wTimerEventStartDay
|
2015-10-24 14:34:19 +00:00
|
|
|
call CopyDayToHL
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CheckPokerusTick::
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wTimerEventStartDay
|
2015-10-24 14:34:19 +00:00
|
|
|
call CalcDaysSince
|
|
|
|
call GetDaysSince
|
2015-10-03 02:49:26 +00:00
|
|
|
and a
|
2016-01-10 22:44:09 +00:00
|
|
|
jr z, .done ; not even a day has passed since game start
|
2015-10-03 02:49:26 +00:00
|
|
|
ld b, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ApplyPokerusTick
|
2015-10-24 14:34:19 +00:00
|
|
|
.done
|
2015-10-03 02:49:26 +00:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SetUnusedTwoDayTimer:
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, 2
|
|
|
|
ld hl, wUnusedTwoDayTimer
|
2015-10-03 02:49:26 +00:00
|
|
|
ld [hl], a
|
|
|
|
call UpdateTime
|
2015-10-24 14:34:19 +00:00
|
|
|
ld hl, wUnusedTwoDayTimerStartDate
|
|
|
|
call CopyDayToHL
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CheckUnusedTwoDayTimer:
|
2015-10-24 14:34:19 +00:00
|
|
|
ld hl, wUnusedTwoDayTimerStartDate
|
|
|
|
call CalcDaysSince
|
|
|
|
call GetDaysSince
|
|
|
|
ld hl, wUnusedTwoDayTimer
|
|
|
|
call UpdateTimeRemaining
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-01-02 12:24:05 +00:00
|
|
|
; unused
|
2017-12-28 12:15:46 +00:00
|
|
|
ld hl, wDailyFlags
|
2018-01-22 20:59:24 +00:00
|
|
|
set DAILYFLAGS_FISH_SWARM_F, [hl]
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-01-02 12:24:05 +00:00
|
|
|
; unused
|
2015-10-03 02:49:26 +00:00
|
|
|
and a
|
2017-12-28 12:15:46 +00:00
|
|
|
ld hl, wDailyFlags
|
2018-01-22 20:59:24 +00:00
|
|
|
bit DAILYFLAGS_FISH_SWARM_F, [hl]
|
2015-10-03 02:49:26 +00:00
|
|
|
ret nz
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
RestartLuckyNumberCountdown:
|
2015-10-10 21:03:04 +00:00
|
|
|
call .GetDaysUntilNextFriday
|
|
|
|
ld hl, wLuckyNumberDayBuffer
|
2015-10-24 14:34:19 +00:00
|
|
|
jp InitNDaysCountdown
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.GetDaysUntilNextFriday:
|
2015-10-03 02:49:26 +00:00
|
|
|
call GetWeekday
|
|
|
|
ld c, a
|
2015-10-10 21:03:04 +00:00
|
|
|
ld a, FRIDAY
|
2015-10-03 02:49:26 +00:00
|
|
|
sub c
|
2015-10-10 21:03:04 +00:00
|
|
|
jr z, .friday_saturday
|
2018-01-11 17:00:01 +00:00
|
|
|
jr nc, .earlier ; could have done "ret nc"
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2015-10-10 21:03:04 +00:00
|
|
|
.friday_saturday
|
|
|
|
add 7
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2015-10-10 21:03:04 +00:00
|
|
|
.earlier
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
_CheckLuckyNumberShowFlag:
|
2015-10-10 21:03:04 +00:00
|
|
|
ld hl, wLuckyNumberDayBuffer
|
2015-10-16 17:35:43 +00:00
|
|
|
jp CheckDayDependentEventHL
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DoMysteryGiftIfDayHasPassed:
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, BANK(sMysteryGiftTimer)
|
2015-10-03 02:49:26 +00:00
|
|
|
call GetSRAMBank
|
2015-10-24 14:34:19 +00:00
|
|
|
ld hl, sMysteryGiftTimer
|
2015-10-03 02:49:26 +00:00
|
|
|
ld a, [hli]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBuffer1], a
|
2015-10-03 02:49:26 +00:00
|
|
|
ld a, [hl]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBuffer2], a
|
2015-10-03 02:49:26 +00:00
|
|
|
call CloseSRAM
|
2015-10-24 14:34:19 +00:00
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wBuffer1
|
2015-10-16 17:35:43 +00:00
|
|
|
call CheckDayDependentEventHL
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nc, .not_timed_out
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wBuffer1
|
2015-10-24 14:34:19 +00:00
|
|
|
call InitOneDayCountdown
|
2015-10-03 02:49:26 +00:00
|
|
|
call CloseSRAM
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall Function1050c8
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
.not_timed_out
|
|
|
|
ld a, BANK(sMysteryGiftTimer)
|
2015-10-03 02:49:26 +00:00
|
|
|
call GetSRAMBank
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wBuffer1
|
2015-10-03 02:49:26 +00:00
|
|
|
ld a, [hli]
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [sMysteryGiftTimer], a
|
2015-10-03 02:49:26 +00:00
|
|
|
ld a, [hl]
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [sMysteryGiftTimer + 1], a
|
2015-10-03 02:49:26 +00:00
|
|
|
call CloseSRAM
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
UpdateTimeRemaining:
|
2015-10-24 14:34:19 +00:00
|
|
|
; If the amount of time elapsed exceeds the capacity of its
|
|
|
|
; unit, skip this part.
|
2015-10-04 18:14:51 +00:00
|
|
|
cp -1
|
2015-10-24 14:34:19 +00:00
|
|
|
jr z, .set_carry
|
2015-10-03 02:49:26 +00:00
|
|
|
ld c, a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [hl] ; time remaining
|
2015-10-03 02:49:26 +00:00
|
|
|
sub c
|
2015-10-04 18:14:51 +00:00
|
|
|
jr nc, .ok
|
2015-10-03 02:49:26 +00:00
|
|
|
xor a
|
|
|
|
|
2015-10-04 18:14:51 +00:00
|
|
|
.ok
|
2015-10-03 02:49:26 +00:00
|
|
|
ld [hl], a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr z, .set_carry
|
2015-10-03 02:49:26 +00:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
.set_carry
|
2015-10-03 02:49:26 +00:00
|
|
|
xor a
|
|
|
|
ld [hl], a
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetSecondsSinceIfLessThan60:
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wDaysSince]
|
2015-10-03 02:49:26 +00:00
|
|
|
and a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
|
|
|
ld a, [wHoursSince]
|
2015-10-03 02:49:26 +00:00
|
|
|
and a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
|
|
|
ld a, [wMinutesSince]
|
|
|
|
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
|
|
|
ld a, [wSecondsSince]
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetMinutesSinceIfLessThan60:
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wDaysSince]
|
2015-10-03 02:49:26 +00:00
|
|
|
and a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
|
|
|
ld a, [wHoursSince]
|
2015-10-03 02:49:26 +00:00
|
|
|
and a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
|
|
|
ld a, [wMinutesSince]
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetHoursSinceIfLessThan24:
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wDaysSince]
|
2015-10-03 02:49:26 +00:00
|
|
|
and a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
|
|
|
ld a, [wHoursSince]
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetDaysSince:
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wDaysSince]
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetTimeElapsed_ExceedsUnitLimit:
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, -1
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CalcDaysSince:
|
2015-10-03 02:49:26 +00:00
|
|
|
xor a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr _CalcDaysSince
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CalcHoursDaysSince:
|
2015-10-03 02:49:26 +00:00
|
|
|
inc hl
|
|
|
|
xor a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr _CalcHoursDaysSince
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CalcMinsHoursDaysSince:
|
2015-10-03 02:49:26 +00:00
|
|
|
inc hl
|
2016-05-04 15:46:23 +00:00
|
|
|
inc hl
|
2015-10-03 02:49:26 +00:00
|
|
|
xor a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr _CalcMinsHoursDaysSince
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CalcSecsMinsHoursDaysSince:
|
2015-10-03 02:49:26 +00:00
|
|
|
inc hl
|
2016-05-10 16:31:49 +00:00
|
|
|
inc hl
|
|
|
|
inc hl
|
2015-10-03 02:49:26 +00:00
|
|
|
ld a, [hSeconds]
|
|
|
|
ld c, a
|
|
|
|
sub [hl]
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nc, .skip
|
2015-10-03 02:49:26 +00:00
|
|
|
add 60
|
2015-10-24 14:34:19 +00:00
|
|
|
.skip
|
|
|
|
ld [hl], c ; current seconds
|
2015-10-03 02:49:26 +00:00
|
|
|
dec hl
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wSecondsSince], a ; seconds since
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
_CalcMinsHoursDaysSince:
|
2015-10-03 02:49:26 +00:00
|
|
|
ld a, [hMinutes]
|
|
|
|
ld c, a
|
|
|
|
sbc [hl]
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nc, .skip
|
2015-10-03 02:49:26 +00:00
|
|
|
add 60
|
2015-10-24 14:34:19 +00:00
|
|
|
.skip
|
|
|
|
ld [hl], c ; current minutes
|
2015-10-03 02:49:26 +00:00
|
|
|
dec hl
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wMinutesSince], a ; minutes since
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
_CalcHoursDaysSince:
|
2015-10-03 02:49:26 +00:00
|
|
|
ld a, [hHours]
|
|
|
|
ld c, a
|
|
|
|
sbc [hl]
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nc, .skip
|
2015-10-03 02:49:26 +00:00
|
|
|
add 24
|
2015-10-24 14:34:19 +00:00
|
|
|
.skip
|
|
|
|
ld [hl], c ; current hours
|
2015-10-03 02:49:26 +00:00
|
|
|
dec hl
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wHoursSince], a ; hours since
|
2015-10-03 02:49:26 +00:00
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
_CalcDaysSince:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurDay]
|
2015-10-03 02:49:26 +00:00
|
|
|
ld c, a
|
|
|
|
sbc [hl]
|
|
|
|
jr nc, .skip
|
|
|
|
add 20 * 7
|
|
|
|
.skip
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [hl], c ; current days
|
|
|
|
ld [wDaysSince], a ; days since
|
2015-10-03 02:49:26 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CopyDayHourMinSecToHL:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurDay]
|
2015-10-03 02:49:26 +00:00
|
|
|
ld [hli], a
|
|
|
|
ld a, [hHours]
|
|
|
|
ld [hli], a
|
|
|
|
ld a, [hMinutes]
|
|
|
|
ld [hli], a
|
|
|
|
ld a, [hSeconds]
|
|
|
|
ld [hli], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CopyDayToHL:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurDay]
|
2015-10-03 02:49:26 +00:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CopyDayHourToHL:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurDay]
|
2015-10-03 02:49:26 +00:00
|
|
|
ld [hli], a
|
|
|
|
ld a, [hHours]
|
|
|
|
ld [hli], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CopyDayHourMinToHL:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurDay]
|
2015-10-03 02:49:26 +00:00
|
|
|
ld [hli], a
|
|
|
|
ld a, [hHours]
|
|
|
|
ld [hli], a
|
|
|
|
ld a, [hMinutes]
|
|
|
|
ld [hli], a
|
|
|
|
ret
|