diff options
author | Cleverking2003 <30466983+Cleverking2003@users.noreply.github.com> | 2020-08-13 19:12:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-13 19:12:12 +0300 |
commit | a82d0d55a67b12757b185fd149d6a14dcc7cad02 (patch) | |
tree | 829d21a866de69dc92e1b8e5bb1857a21104027c /arm9/src/igt.c | |
parent | c259e6ed18294c001033fed62d924d379276021a (diff) | |
parent | ddd20f2c76a34b4fc46503c8bf88d53a755453a8 (diff) |
Merge pull request #261 from PikalaxALT/pikalax_work
Name some scrcmds; save block 2 struct resolution
Diffstat (limited to 'arm9/src/igt.c')
-rw-r--r-- | arm9/src/igt.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/arm9/src/igt.c b/arm9/src/igt.c new file mode 100644 index 00000000..843ef396 --- /dev/null +++ b/arm9/src/igt.c @@ -0,0 +1,50 @@ +#include "global.h" +#include "igt.h" + +#pragma thumb on + +void InitIGT(struct IGT * igt) +{ + igt->hours = 0; + igt->minutes = 0; + igt->seconds = 0; +} + +void AddIGTSeconds(struct IGT * igt, u32 to_add) +{ + u32 hours, minutes, seconds; + if (igt->hours == 999 && igt->minutes == 59 && igt->seconds == 59) + return; + seconds = (u32)(igt->seconds + to_add); + minutes = (u32)igt->minutes; + hours = (u32)igt->hours; + if (seconds > 59) + { + minutes += seconds / 60; + seconds %= 60; + if (minutes > 59) + { + hours += minutes / 60; + minutes %= 60; + if (hours >= 999) + { + hours = 999; + minutes = 59; + seconds = 59; + } + } + } + igt->hours = (u16)hours; + igt->minutes = (u8)minutes; + igt->seconds = (u8)seconds; +} + +u16 GetIGTHours(struct IGT * igt) +{ + return igt->hours; +} + +u8 GetIGTMinutes(struct IGT * igt) +{ + return igt->minutes; +} |