diff options
author | Thomas <doodrabbit@hotmail.com> | 2021-12-17 20:57:03 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-17 20:57:03 -0500 |
commit | af67eaffa7ab1a347a6f0e59ed7f1e107749d15a (patch) | |
tree | b9f90f7b047b3dc5a411dbf65117bf07b237a37d /arm9/src/play_timer.c | |
parent | 3ab18655ca1311019212b3a2a9dbe32e5fbee55d (diff) | |
parent | 44cd7753b5dde323d1e8274b2dc8a5599729e83f (diff) |
Real-match math_util.c
Diffstat (limited to 'arm9/src/play_timer.c')
-rw-r--r-- | arm9/src/play_timer.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/arm9/src/play_timer.c b/arm9/src/play_timer.c new file mode 100644 index 00000000..9675e179 --- /dev/null +++ b/arm9/src/play_timer.c @@ -0,0 +1,37 @@ + +#include "play_timer.h" + +u64 sTimer3Start; +u64 sUnused; +u64 sDuration; +struct IGT * sIGT_p; +BOOL sTimerActive; + +THUMB_FUNC void PlayTimerInit() +{ + sTimerActive = FALSE; +} + +THUMB_FUNC void PlayTimerStart(struct IGT *igt) +{ + sTimerActive = TRUE; + sUnused = 0; + sDuration = 0; + sIGT_p = igt; + + sTimer3Start = GetTimer3Count(); +} + +THUMB_FUNC void PlayTimerUpdate(void) +{ + if (sTimerActive) + { + u64 res = Timer3CountToSeconds(GetTimer3Count() - sTimer3Start); + + if (sDuration < res) + { + AddIGTSeconds(sIGT_p, (u32)(res - sDuration)); + sDuration = res; + } + } +} |