summaryrefslogtreecommitdiff
path: root/arm9/src
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2020-08-13 08:41:21 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2020-08-13 08:41:21 -0400
commita13a7535cd78a113d23a8cccddced3d5f13ad479 (patch)
tree0a7e672c5a7acc6261ca714538198d80c13fff47 /arm9/src
parentdd47776b7c311afdbfbb123485ecf2bf695a3c04 (diff)
Decompile igt
Diffstat (limited to 'arm9/src')
-rw-r--r--arm9/src/igt.c50
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;
+}