2015-10-24 07:34:19 -07:00
|
|
|
_InitializeStartDay: ; 113d6
|
|
|
|
call InitializeStartDay
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 113da
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
ClearDailyTimers: ; 113da
|
2015-10-02 19:49:26 -07:00
|
|
|
xor a
|
2015-10-10 14:03:04 -07:00
|
|
|
ld [wLuckyNumberDayBuffer], a
|
2015-10-24 07:34:19 -07:00
|
|
|
ld [wUnusedTwoDayTimer], a
|
|
|
|
ld [wDailyResetTimer], a
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 113e5
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
InitCallReceiveDelay:: ; 113e5
|
2015-10-02 19:49:26 -07:00
|
|
|
xor a
|
2015-10-24 07:34:19 -07:00
|
|
|
ld [wTimeCyclesSinceLastCall], a
|
2015-10-02 19:49:26 -07:00
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
NextCallReceiveDelay: ; 113e9
|
|
|
|
ld a, [wTimeCyclesSinceLastCall]
|
2015-10-02 19:49:26 -07:00
|
|
|
cp 3
|
2015-10-24 07:34:19 -07:00
|
|
|
jr c, .okay
|
2015-10-02 19:49:26 -07:00
|
|
|
ld a, 3
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
.okay
|
2015-10-02 19:49:26 -07:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-10-24 07:34:19 -07:00
|
|
|
ld hl, .ReceiveCallDelays
|
2015-10-02 19:49:26 -07:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
2015-10-24 07:34:19 -07:00
|
|
|
jp RestartReceiveCallDelay
|
2015-10-02 19:49:26 -07:00
|
|
|
; 113fd
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.ReceiveCallDelays:
|
2015-10-02 19:49:26 -07:00
|
|
|
db 20, 10, 5, 3
|
|
|
|
; 11401
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
CheckReceiveCallTimer: ; 11401
|
|
|
|
call CheckReceiveCallDelay ; check timer
|
2015-10-02 19:49:26 -07:00
|
|
|
ret nc
|
2015-10-24 07:34:19 -07:00
|
|
|
ld hl, wTimeCyclesSinceLastCall
|
2015-10-02 19:49:26 -07:00
|
|
|
ld a, [hl]
|
|
|
|
cp 3
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nc, .ok
|
2015-10-02 19:49:26 -07:00
|
|
|
inc [hl]
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
.ok
|
|
|
|
call NextCallReceiveDelay ; restart timer
|
2015-10-02 19:49:26 -07:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 11413
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
InitOneDayCountdown: ; 11413
|
2015-10-02 19:49:26 -07:00
|
|
|
ld a, 1
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
InitNDaysCountdown: ; 11415
|
2015-10-02 19:49:26 -07:00
|
|
|
ld [hl], a
|
|
|
|
push hl
|
|
|
|
call UpdateTime
|
|
|
|
pop hl
|
|
|
|
inc hl
|
2015-10-24 07:34:19 -07:00
|
|
|
call CopyDayToHL
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 11420
|
|
|
|
|
2015-10-16 10:35:43 -07:00
|
|
|
CheckDayDependentEventHL: ; 11420
|
2015-10-02 19:49:26 -07:00
|
|
|
inc hl
|
|
|
|
push hl
|
2015-10-24 07:34:19 -07:00
|
|
|
call CalcDaysSince
|
|
|
|
call GetDaysSince
|
2015-10-02 19:49:26 -07:00
|
|
|
pop hl
|
|
|
|
dec hl
|
2015-10-24 07:34:19 -07:00
|
|
|
call UpdateTimeRemaining
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 1142e
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
RestartReceiveCallDelay: ; 1142e
|
|
|
|
ld hl, wReceiveCallDelay_MinsRemaining
|
2015-10-02 19:49:26 -07:00
|
|
|
ld [hl], a
|
|
|
|
call UpdateTime
|
2015-10-24 07:34:19 -07:00
|
|
|
ld hl, wReceiveCallDelay_StartTime
|
|
|
|
call CopyDayHourMinToHL
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 1143c
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
CheckReceiveCallDelay: ; 1143c
|
|
|
|
ld hl, wReceiveCallDelay_StartTime
|
|
|
|
call CalcMinsHoursDaysSince
|
|
|
|
call GetMinutesSinceIfLessThan60
|
|
|
|
ld hl, wReceiveCallDelay_MinsRemaining
|
|
|
|
call UpdateTimeRemaining
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 1144c
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
RestartDailyResetTimer: ; 1144c
|
|
|
|
ld hl, wDailyResetTimer
|
|
|
|
jp InitOneDayCountdown
|
2015-10-02 19:49:26 -07:00
|
|
|
; 11452
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
CheckDailyResetTimer:: ; 11452
|
|
|
|
ld hl, wDailyResetTimer
|
2015-10-16 10:35:43 -07:00
|
|
|
call CheckDayDependentEventHL
|
2015-10-02 19:49:26 -07:00
|
|
|
ret nc
|
|
|
|
xor a
|
|
|
|
ld hl, DailyFlags
|
|
|
|
ld [hli], a
|
2016-05-10 09:31:49 -07:00
|
|
|
ld [hli], a
|
|
|
|
ld [hli], a
|
2015-10-02 19:49:26 -07:00
|
|
|
ld [hl], a
|
|
|
|
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 12:35:28 -08:00
|
|
|
ld hl, wKenjiBreakTimer
|
2015-10-02 19:49:26 -07:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-10-24 07:34:19 -07:00
|
|
|
jr z, .RestartKenjiBreakCountdown
|
2015-10-02 19:49:26 -07:00
|
|
|
dec [hl]
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nz, .DontRestartKenjiBreakCountdown
|
2016-04-10 11:42:14 -07:00
|
|
|
.RestartKenjiBreakCountdown:
|
2015-10-24 07:34:19 -07:00
|
|
|
call Special_SampleKenjiBreakCountdown
|
2016-04-10 11:42:14 -07:00
|
|
|
.DontRestartKenjiBreakCountdown:
|
2015-10-24 07:34:19 -07:00
|
|
|
jr RestartDailyResetTimer
|
2015-10-02 19:49:26 -07:00
|
|
|
; 11485
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
Special_SampleKenjiBreakCountdown: ; 11485
|
2016-03-01 19:31:21 -08:00
|
|
|
; Generate a random number between 3 and 6
|
2015-10-02 19:49:26 -07:00
|
|
|
call Random
|
|
|
|
and 3
|
|
|
|
add 3
|
2015-12-01 12:35:28 -08:00
|
|
|
ld [wKenjiBreakTimer], a
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 11490
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
StartBugContestTimer: ; 11490
|
|
|
|
ld a, 20
|
|
|
|
ld [wBugContestMinsRemaining], a
|
|
|
|
ld a, 0
|
|
|
|
ld [wBugContestSecsRemaining], a
|
2015-10-02 19:49:26 -07:00
|
|
|
call UpdateTime
|
2015-10-24 07:34:19 -07:00
|
|
|
ld hl, wBugContestStartTime
|
|
|
|
call CopyDayHourMinSecToHL
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 114a4
|
|
|
|
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
CheckBugContestTimer:: ; 114a4 (4:54a4)
|
|
|
|
ld hl, wBugContestStartTime
|
|
|
|
call CalcSecsMinsHoursDaysSince
|
|
|
|
ld a, [wDaysSince]
|
2015-10-02 19:49:26 -07:00
|
|
|
and a
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nz, .timed_out
|
|
|
|
ld a, [wHoursSince]
|
2015-10-02 19:49:26 -07:00
|
|
|
and a
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nz, .timed_out
|
|
|
|
ld a, [wSecondsSince]
|
2015-10-02 19:49:26 -07:00
|
|
|
ld b, a
|
2015-10-24 07:34:19 -07:00
|
|
|
ld a, [wBugContestSecsRemaining]
|
2015-10-02 19:49:26 -07:00
|
|
|
sub b
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nc, .okay
|
|
|
|
add 60
|
|
|
|
|
|
|
|
.okay
|
|
|
|
ld [wBugContestSecsRemaining], a
|
|
|
|
ld a, [wMinutesSince]
|
2015-10-02 19:49:26 -07:00
|
|
|
ld b, a
|
2015-10-24 07:34:19 -07:00
|
|
|
ld a, [wBugContestMinsRemaining]
|
2015-10-02 19:49:26 -07:00
|
|
|
sbc b
|
2015-10-24 07:34:19 -07:00
|
|
|
ld [wBugContestMinsRemaining], a
|
|
|
|
jr c, .timed_out
|
2015-10-02 19:49:26 -07:00
|
|
|
and a
|
|
|
|
ret
|
2015-10-24 07:34:19 -07:00
|
|
|
|
|
|
|
.timed_out
|
2015-10-02 19:49:26 -07:00
|
|
|
xor a
|
2015-10-24 07:34:19 -07:00
|
|
|
ld [wBugContestMinsRemaining], a
|
|
|
|
ld [wBugContestSecsRemaining], a
|
2015-10-02 19:49:26 -07:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
InitializeStartDay: ; 114dd
|
2015-10-02 19:49:26 -07:00
|
|
|
call UpdateTime
|
2015-10-24 07:34:19 -07:00
|
|
|
ld hl, wStartDay
|
|
|
|
call CopyDayToHL
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 114e7
|
|
|
|
|
2016-01-05 05:46:37 -08:00
|
|
|
CheckPokerusTick:: ; 114e7
|
2015-10-24 07:34:19 -07:00
|
|
|
ld hl, wStartDay
|
|
|
|
call CalcDaysSince
|
|
|
|
call GetDaysSince
|
2015-10-02 19:49:26 -07:00
|
|
|
and a
|
2016-01-10 14:44:09 -08:00
|
|
|
jr z, .done ; not even a day has passed since game start
|
2015-10-02 19:49:26 -07:00
|
|
|
ld b, a
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall ApplyPokerusTick
|
2015-10-24 07:34:19 -07:00
|
|
|
.done
|
2015-10-02 19:49:26 -07:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
; 114fc
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
SetUnusedTwoDayTimer: ; 114fc
|
|
|
|
ld a, 2
|
|
|
|
ld hl, wUnusedTwoDayTimer
|
2015-10-02 19:49:26 -07:00
|
|
|
ld [hl], a
|
|
|
|
call UpdateTime
|
2015-10-24 07:34:19 -07:00
|
|
|
ld hl, wUnusedTwoDayTimerStartDate
|
|
|
|
call CopyDayToHL
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 1150c
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
CheckUnusedTwoDayTimer: ; 1150c
|
|
|
|
ld hl, wUnusedTwoDayTimerStartDate
|
|
|
|
call CalcDaysSince
|
|
|
|
call GetDaysSince
|
|
|
|
ld hl, wUnusedTwoDayTimer
|
|
|
|
call UpdateTimeRemaining
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 1151c
|
|
|
|
|
2016-01-10 14:44:09 -08:00
|
|
|
; XXX
|
2015-10-02 19:49:26 -07:00
|
|
|
ld hl, DailyFlags
|
|
|
|
set 2, [hl]
|
|
|
|
ret
|
|
|
|
; 11522
|
|
|
|
|
2016-01-10 14:44:09 -08:00
|
|
|
; XXX
|
2015-10-02 19:49:26 -07:00
|
|
|
and a
|
|
|
|
ld hl, DailyFlags
|
|
|
|
bit 2, [hl]
|
|
|
|
ret nz
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 1152b
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
RestartLuckyNumberCountdown: ; 1152b
|
2015-10-10 14:03:04 -07:00
|
|
|
call .GetDaysUntilNextFriday
|
|
|
|
ld hl, wLuckyNumberDayBuffer
|
2015-10-24 07:34:19 -07:00
|
|
|
jp InitNDaysCountdown
|
2015-10-02 19:49:26 -07:00
|
|
|
; 11534
|
|
|
|
|
2015-10-10 14:03:04 -07:00
|
|
|
.GetDaysUntilNextFriday: ; 11534
|
2015-10-02 19:49:26 -07:00
|
|
|
call GetWeekday
|
|
|
|
ld c, a
|
2015-10-10 14:03:04 -07:00
|
|
|
ld a, FRIDAY
|
2015-10-02 19:49:26 -07:00
|
|
|
sub c
|
2015-10-10 14:03:04 -07:00
|
|
|
jr z, .friday_saturday
|
|
|
|
jr nc, .earlier ; should've done "ret nc"
|
2015-10-02 19:49:26 -07:00
|
|
|
|
2015-10-10 14:03:04 -07:00
|
|
|
.friday_saturday
|
|
|
|
add 7
|
2015-10-02 19:49:26 -07:00
|
|
|
|
2015-10-10 14:03:04 -07:00
|
|
|
.earlier
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 11542
|
|
|
|
|
2015-10-16 10:35:43 -07:00
|
|
|
CheckLuckyNumberShowFlag: ; 11542
|
2015-10-10 14:03:04 -07:00
|
|
|
ld hl, wLuckyNumberDayBuffer
|
2015-10-16 10:35:43 -07:00
|
|
|
jp CheckDayDependentEventHL
|
2015-10-02 19:49:26 -07:00
|
|
|
; 11548
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
DoMysteryGiftIfDayHasPassed: ; 11548
|
|
|
|
ld a, BANK(sMysteryGiftTimer)
|
2015-10-02 19:49:26 -07:00
|
|
|
call GetSRAMBank
|
2015-10-24 07:34:19 -07:00
|
|
|
ld hl, sMysteryGiftTimer
|
2015-10-02 19:49:26 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld [Buffer1], a
|
|
|
|
ld a, [hl]
|
|
|
|
ld [Buffer2], a
|
|
|
|
call CloseSRAM
|
2015-10-24 07:34:19 -07:00
|
|
|
|
2015-10-02 19:49:26 -07:00
|
|
|
ld hl, Buffer1
|
2015-10-16 10:35:43 -07:00
|
|
|
call CheckDayDependentEventHL
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nc, .not_timed_out
|
2015-10-02 19:49:26 -07:00
|
|
|
ld hl, Buffer1
|
2015-10-24 07:34:19 -07:00
|
|
|
call InitOneDayCountdown
|
2015-10-02 19:49:26 -07:00
|
|
|
call CloseSRAM
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall Function1050c8
|
2015-10-02 19:49:26 -07:00
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
.not_timed_out
|
|
|
|
ld a, BANK(sMysteryGiftTimer)
|
2015-10-02 19:49:26 -07:00
|
|
|
call GetSRAMBank
|
|
|
|
ld hl, Buffer1
|
|
|
|
ld a, [hli]
|
2015-10-24 07:34:19 -07:00
|
|
|
ld [sMysteryGiftTimer], a
|
2015-10-02 19:49:26 -07:00
|
|
|
ld a, [hl]
|
2015-10-24 07:34:19 -07:00
|
|
|
ld [sMysteryGiftTimer + 1], a
|
2015-10-02 19:49:26 -07:00
|
|
|
call CloseSRAM
|
|
|
|
ret
|
|
|
|
; 11586
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
UpdateTimeRemaining: ; 11586
|
|
|
|
; If the amount of time elapsed exceeds the capacity of its
|
|
|
|
; unit, skip this part.
|
2015-10-04 11:14:51 -07:00
|
|
|
cp -1
|
2015-10-24 07:34:19 -07:00
|
|
|
jr z, .set_carry
|
2015-10-02 19:49:26 -07:00
|
|
|
ld c, a
|
2015-10-24 07:34:19 -07:00
|
|
|
ld a, [hl] ; time remaining
|
2015-10-02 19:49:26 -07:00
|
|
|
sub c
|
2015-10-04 11:14:51 -07:00
|
|
|
jr nc, .ok
|
2015-10-02 19:49:26 -07:00
|
|
|
xor a
|
|
|
|
|
2015-10-04 11:14:51 -07:00
|
|
|
.ok
|
2015-10-02 19:49:26 -07:00
|
|
|
ld [hl], a
|
2015-10-24 07:34:19 -07:00
|
|
|
jr z, .set_carry
|
2015-10-02 19:49:26 -07:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
.set_carry
|
2015-10-02 19:49:26 -07:00
|
|
|
xor a
|
|
|
|
ld [hl], a
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 11599
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
GetSecondsSinceIfLessThan60: ; 11599
|
|
|
|
ld a, [wDaysSince]
|
2015-10-02 19:49:26 -07:00
|
|
|
and a
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
|
|
|
ld a, [wHoursSince]
|
2015-10-02 19:49:26 -07:00
|
|
|
and a
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
|
|
|
ld a, [wMinutesSince]
|
|
|
|
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
|
|
|
ld a, [wSecondsSince]
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 115ae
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
GetMinutesSinceIfLessThan60: ; 115ae
|
|
|
|
ld a, [wDaysSince]
|
2015-10-02 19:49:26 -07:00
|
|
|
and a
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
|
|
|
ld a, [wHoursSince]
|
2015-10-02 19:49:26 -07:00
|
|
|
and a
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
|
|
|
ld a, [wMinutesSince]
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 115be
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
GetHoursSinceIfLessThan24: ; 115be
|
|
|
|
ld a, [wDaysSince]
|
2015-10-02 19:49:26 -07:00
|
|
|
and a
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
|
|
|
ld a, [wHoursSince]
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 115c8
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
GetDaysSince: ; 115c8
|
|
|
|
ld a, [wDaysSince]
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 115cc
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
GetTimeElapsed_ExceedsUnitLimit: ; 115cc
|
|
|
|
ld a, -1
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 115cf
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
CalcDaysSince: ; 115cf
|
2015-10-02 19:49:26 -07:00
|
|
|
xor a
|
2015-10-24 07:34:19 -07:00
|
|
|
jr _CalcDaysSince
|
2015-10-02 19:49:26 -07:00
|
|
|
; 115d2
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
CalcHoursDaysSince: ; 115d2
|
2015-10-02 19:49:26 -07:00
|
|
|
inc hl
|
|
|
|
xor a
|
2015-10-24 07:34:19 -07:00
|
|
|
jr _CalcHoursDaysSince
|
2015-10-02 19:49:26 -07:00
|
|
|
; 115d6
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
CalcMinsHoursDaysSince: ; 115d6
|
2015-10-02 19:49:26 -07:00
|
|
|
inc hl
|
2016-05-04 08:46:23 -07:00
|
|
|
inc hl
|
2015-10-02 19:49:26 -07:00
|
|
|
xor a
|
2015-10-24 07:34:19 -07:00
|
|
|
jr _CalcMinsHoursDaysSince
|
2015-10-02 19:49:26 -07:00
|
|
|
; 115db
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
CalcSecsMinsHoursDaysSince: ; 115db
|
2015-10-02 19:49:26 -07:00
|
|
|
inc hl
|
2016-05-10 09:31:49 -07:00
|
|
|
inc hl
|
|
|
|
inc hl
|
2015-10-02 19:49:26 -07:00
|
|
|
ld a, [hSeconds]
|
|
|
|
ld c, a
|
|
|
|
sub [hl]
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nc, .skip
|
2015-10-02 19:49:26 -07:00
|
|
|
add 60
|
2015-10-24 07:34:19 -07:00
|
|
|
.skip
|
|
|
|
ld [hl], c ; current seconds
|
2015-10-02 19:49:26 -07:00
|
|
|
dec hl
|
2015-10-24 07:34:19 -07:00
|
|
|
ld [wSecondsSince], a ; seconds since
|
2015-10-02 19:49:26 -07:00
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
_CalcMinsHoursDaysSince: ; 115eb
|
2015-10-02 19:49:26 -07:00
|
|
|
ld a, [hMinutes]
|
|
|
|
ld c, a
|
|
|
|
sbc [hl]
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nc, .skip
|
2015-10-02 19:49:26 -07:00
|
|
|
add 60
|
2015-10-24 07:34:19 -07:00
|
|
|
.skip
|
|
|
|
ld [hl], c ; current minutes
|
2015-10-02 19:49:26 -07:00
|
|
|
dec hl
|
2015-10-24 07:34:19 -07:00
|
|
|
ld [wMinutesSince], a ; minutes since
|
2015-10-02 19:49:26 -07:00
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
_CalcHoursDaysSince: ; 115f8
|
2015-10-02 19:49:26 -07:00
|
|
|
ld a, [hHours]
|
|
|
|
ld c, a
|
|
|
|
sbc [hl]
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nc, .skip
|
2015-10-02 19:49:26 -07:00
|
|
|
add 24
|
2015-10-24 07:34:19 -07:00
|
|
|
.skip
|
|
|
|
ld [hl], c ; current hours
|
2015-10-02 19:49:26 -07:00
|
|
|
dec hl
|
2015-10-24 07:34:19 -07:00
|
|
|
ld [wHoursSince], a ; hours since
|
2015-10-02 19:49:26 -07:00
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
_CalcDaysSince:
|
2015-10-02 19:49:26 -07:00
|
|
|
ld a, [CurDay]
|
|
|
|
ld c, a
|
|
|
|
sbc [hl]
|
|
|
|
jr nc, .skip
|
|
|
|
add 20 * 7
|
|
|
|
.skip
|
2015-10-24 07:34:19 -07:00
|
|
|
ld [hl], c ; current days
|
|
|
|
ld [wDaysSince], a ; days since
|
2015-10-02 19:49:26 -07:00
|
|
|
ret
|
|
|
|
; 11613
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
CopyDayHourMinSecToHL: ; 11613
|
2015-10-02 19:49:26 -07:00
|
|
|
ld a, [CurDay]
|
|
|
|
ld [hli], a
|
|
|
|
ld a, [hHours]
|
|
|
|
ld [hli], a
|
|
|
|
ld a, [hMinutes]
|
|
|
|
ld [hli], a
|
|
|
|
ld a, [hSeconds]
|
|
|
|
ld [hli], a
|
|
|
|
ret
|
|
|
|
; 11621
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
CopyDayToHL: ; 11621
|
2015-10-02 19:49:26 -07:00
|
|
|
ld a, [CurDay]
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 11626
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
CopyDayHourToHL: ; 11626
|
2015-10-02 19:49:26 -07:00
|
|
|
ld a, [CurDay]
|
|
|
|
ld [hli], a
|
|
|
|
ld a, [hHours]
|
|
|
|
ld [hli], a
|
|
|
|
ret
|
|
|
|
; 1162e
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
CopyDayHourMinToHL: ; 1162e
|
2015-10-02 19:49:26 -07:00
|
|
|
ld a, [CurDay]
|
|
|
|
ld [hli], a
|
|
|
|
ld a, [hHours]
|
|
|
|
ld [hli], a
|
|
|
|
ld a, [hMinutes]
|
|
|
|
ld [hli], a
|
|
|
|
ret
|
2017-05-28 12:54:03 -07:00
|
|
|
; 11639
|