summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arm9/arm9.lsf2
-rw-r--r--arm9/asm/player_data.s2
-rw-r--r--arm9/asm/unk_02015E30.s2
-rw-r--r--arm9/asm/unk_02028980.s4
-rw-r--r--arm9/asm/unk_02029E48.s76
-rw-r--r--arm9/asm/unk_02064E90.s4
-rw-r--r--arm9/global.inc8
-rw-r--r--arm9/modules/05/asm/module_05.s4
-rw-r--r--arm9/modules/57/asm/module_57.s10
-rw-r--r--arm9/modules/69/asm/module_69.s4
-rw-r--r--arm9/modules/83/asm/module_83.s4
-rw-r--r--arm9/src/igt.c50
-rw-r--r--include/igt.h16
-rw-r--r--include/player_data.h7
14 files changed, 92 insertions, 101 deletions
diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf
index fa1828ce..2265303b 100644
--- a/arm9/arm9.lsf
+++ b/arm9/arm9.lsf
@@ -104,7 +104,7 @@ Static arm9
Object unk_02029AE0.o
Object unk_02029C58.o
Object unk_02029CEC.o
- Object unk_02029E48.o
+ Object igt.o
Object unk_02029EC4.o
Object unk_02029FB0.o
Object unk_0202A1E0.o
diff --git a/arm9/asm/player_data.s b/arm9/asm/player_data.s
index edcf1391..f434845a 100644
--- a/arm9/asm/player_data.s
+++ b/arm9/asm/player_data.s
@@ -25,7 +25,7 @@ Sav2_PlayerData_init: ; 0x020238C8
bl InitCoins
add r4, #0x26
add r0, r4, #0x0
- bl FUN_02029E48
+ bl InitIGT
pop {r4, pc}
thumb_func_start Sav2_GetPlayerDataPtr
diff --git a/arm9/asm/unk_02015E30.s b/arm9/asm/unk_02015E30.s
index 7a147859..9ca09399 100644
--- a/arm9/asm/unk_02015E30.s
+++ b/arm9/asm/unk_02015E30.s
@@ -62,7 +62,7 @@ FUN_02015E60: ; 0x02015E60
bhs _02015E9A
ldr r0, [r1, #0x4]
sub r1, r4, r3
- bl FUN_02029E54
+ bl AddIGTSeconds
ldr r0, _02015E9C ; =UNK_021C4898
str r4, [r0, #0x8]
str r5, [r0, #0xc]
diff --git a/arm9/asm/unk_02028980.s b/arm9/asm/unk_02028980.s
index 260e868f..d307ef03 100644
--- a/arm9/asm/unk_02028980.s
+++ b/arm9/asm/unk_02028980.s
@@ -1248,7 +1248,7 @@ FUN_0202918C: ; 0x0202918C
orr r0, r1
strb r0, [r4, #0x1]
ldr r0, [sp, #0x0]
- bl FUN_02029EC0
+ bl GetIGTMinutes
mov r1, #0xa
bl _s32_div_f
lsl r0, r0, #0x18
@@ -1317,7 +1317,7 @@ FUN_0202920C: ; 0x0202920C
orr r0, r1
strb r0, [r4, #0x1]
ldr r0, [sp, #0x0]
- bl FUN_02029EC0
+ bl GetIGTMinutes
mov r1, #0xa
bl _s32_div_f
lsl r0, r0, #0x18
diff --git a/arm9/asm/unk_02029E48.s b/arm9/asm/unk_02029E48.s
deleted file mode 100644
index c54c2176..00000000
--- a/arm9/asm/unk_02029E48.s
+++ /dev/null
@@ -1,76 +0,0 @@
- .include "asm/macros.inc"
- .include "global.inc"
-
- .text
-
- thumb_func_start FUN_02029E48
-FUN_02029E48: ; 0x02029E48
- mov r1, #0x0
- strh r1, [r0, #0x0]
- strb r1, [r0, #0x2]
- strb r1, [r0, #0x3]
- bx lr
- .balign 4
-
- thumb_func_start FUN_02029E54
-FUN_02029E54: ; 0x02029E54
- push {r3-r7, lr}
- add r5, r0, #0x0
- ldrh r6, [r5, #0x0]
- ldr r0, _02029EB8 ; =0x000003E7
- cmp r6, r0
- bne _02029E6C
- ldrb r0, [r5, #0x2]
- cmp r0, #0x3b
- bne _02029E6C
- ldrb r0, [r5, #0x3]
- cmp r0, #0x3b
- beq _02029EB4
-_02029E6C:
- ldrb r0, [r5, #0x3]
- ldrb r4, [r5, #0x2]
- add r7, r0, r1
- cmp r7, #0x3b
- bls _02029EAE
- add r0, r7, #0x0
- mov r1, #0x3c
- bl _u32_div_f
- add r4, r4, r0
- add r0, r7, #0x0
- mov r1, #0x3c
- bl _u32_div_f
- add r7, r1, #0x0
- cmp r4, #0x3b
- bls _02029EAE
- add r0, r4, #0x0
- mov r1, #0x3c
- bl _u32_div_f
- add r6, r6, r0
- add r0, r4, #0x0
- mov r1, #0x3c
- bl _u32_div_f
- ldr r0, _02029EB8 ; =0x000003E7
- add r4, r1, #0x0
- cmp r6, r0
- blo _02029EAE
- mov r4, #0x3b
- add r6, r0, #0x0
- add r7, r4, #0x0
-_02029EAE:
- strh r6, [r5, #0x0]
- strb r4, [r5, #0x2]
- strb r7, [r5, #0x3]
-_02029EB4:
- pop {r3-r7, pc}
- nop
-_02029EB8: .word 0x000003E7
-
- thumb_func_start FUN_02029EBC
-FUN_02029EBC: ; 0x02029EBC
- ldrh r0, [r0, #0x0]
- bx lr
-
- thumb_func_start FUN_02029EC0
-FUN_02029EC0: ; 0x02029EC0
- ldrb r0, [r0, #0x2]
- bx lr
diff --git a/arm9/asm/unk_02064E90.s b/arm9/asm/unk_02064E90.s
index ef39e346..5fb820cc 100644
--- a/arm9/asm/unk_02064E90.s
+++ b/arm9/asm/unk_02064E90.s
@@ -385,10 +385,10 @@ FUN_020651BC: ; 0x020651BC
add r5, r2, #0x0
add r6, r3, #0x0
ldr r7, [sp, #0x20]
- bl FUN_02029EBC
+ bl GetIGTHours
strh r0, [r4, #0x2a]
ldr r0, [sp, #0x4]
- bl FUN_02029EC0
+ bl GetIGTMinutes
add r1, r4, #0x0
add r1, #0x2e
strb r0, [r1, #0x0]
diff --git a/arm9/global.inc b/arm9/global.inc
index c50189e6..3288a315 100644
--- a/arm9/global.inc
+++ b/arm9/global.inc
@@ -1978,10 +1978,10 @@
.extern FUN_02029DD4
.extern FUN_02029E0C
.extern FUN_02029E2C
-.extern FUN_02029E48
-.extern FUN_02029E54
-.extern FUN_02029EBC
-.extern FUN_02029EC0
+.extern InitIGT
+.extern AddIGTSeconds
+.extern GetIGTHours
+.extern GetIGTMinutes
.extern FUN_02029EC4
.extern FUN_02029ECC
.extern FUN_02029EE4
diff --git a/arm9/modules/05/asm/module_05.s b/arm9/modules/05/asm/module_05.s
index 88100c11..d9293d4c 100644
--- a/arm9/modules/05/asm/module_05.s
+++ b/arm9/modules/05/asm/module_05.s
@@ -11583,7 +11583,7 @@ _021E83A8:
mov r1, #3
bl FUN_0200AD38
ldr r0, [r4, #0xc]
- bl FUN_02029EBC
+ bl GetIGTHours
add r2, r0, #0
cmp r2, #0x64
blt _021E83C8
@@ -11607,7 +11607,7 @@ _021E83D6:
mov r1, #4
bl FUN_0200AD38
ldr r0, [r4, #0xc]
- bl FUN_02029EC0
+ bl GetIGTMinutes
mov r3, #2
add r2, r0, #0
str r3, [sp]
diff --git a/arm9/modules/57/asm/module_57.s b/arm9/modules/57/asm/module_57.s
index a2811684..f317d49f 100644
--- a/arm9/modules/57/asm/module_57.s
+++ b/arm9/modules/57/asm/module_57.s
@@ -2896,7 +2896,7 @@ _021D8BA4:
lsr r0, r0, #0x1f
beq _021D8C02
ldr r0, [r6, #0x18]
- bl FUN_02029EBC
+ bl GetIGTHours
add r2, r0, #0
mov r0, #1
str r0, [sp]
@@ -2906,7 +2906,7 @@ _021D8BA4:
mov r3, #3
bl FUN_0200AD38
ldr r0, [r6, #0x18]
- bl FUN_02029EC0
+ bl GetIGTMinutes
mov r3, #2
add r2, r0, #0
str r3, [sp]
@@ -3445,7 +3445,7 @@ MOD57_021D905C: ; 0x021D905C
bl ErrorHandling
_021D906E:
ldr r0, [r5, #0x18]
- bl FUN_02029EBC
+ bl GetIGTHours
mov r0, #0x28
str r0, [sp]
mov r0, #0x10
@@ -3476,7 +3476,7 @@ _021D906E:
bl FUN_0200AA90
add r6, r0, #0
ldr r0, [r5, #0x18]
- bl FUN_02029EBC
+ bl GetIGTHours
add r2, r0, #0
mov r0, #1
str r0, [sp]
@@ -3486,7 +3486,7 @@ _021D906E:
mov r3, #3
bl FUN_0200AD38
ldr r0, [r5, #0x18]
- bl FUN_02029EC0
+ bl GetIGTMinutes
mov r3, #2
add r2, r0, #0
str r3, [sp]
diff --git a/arm9/modules/69/asm/module_69.s b/arm9/modules/69/asm/module_69.s
index bd245269..0c2c8879 100644
--- a/arm9/modules/69/asm/module_69.s
+++ b/arm9/modules/69/asm/module_69.s
@@ -2684,7 +2684,7 @@ MOD69_0222EB4C: ; 0x0222EB4C
bl FUN_0200AD38
ldr r0, [r4, #0xc]
ldr r0, [r0, #8]
- bl FUN_02029EBC
+ bl GetIGTHours
add r2, r0, #0
mov r0, #0
str r0, [sp]
@@ -2697,7 +2697,7 @@ MOD69_0222EB4C: ; 0x0222EB4C
bl FUN_0200AD38
ldr r0, [r4, #0xc]
ldr r0, [r0, #8]
- bl FUN_02029EC0
+ bl GetIGTMinutes
mov r3, #2
add r2, r0, #0
str r3, [sp]
diff --git a/arm9/modules/83/asm/module_83.s b/arm9/modules/83/asm/module_83.s
index 70a0b70b..ebd0150e 100644
--- a/arm9/modules/83/asm/module_83.s
+++ b/arm9/modules/83/asm/module_83.s
@@ -1052,13 +1052,13 @@ _0222DDB8:
bl MOD83_0222DCA0
ldr r0, [sp, #0x10]
ldr r0, [r0, #0x10]
- bl FUN_02029EBC
+ bl GetIGTHours
add r1, r0, #0
ldr r0, [sp, #0x28]
bl MOD83_0222DCF4
ldr r0, [sp, #0x10]
ldr r0, [r0, #0x10]
- bl FUN_02029EC0
+ bl GetIGTMinutes
add r2, r0, #0
mov r3, #2
ldr r0, [sp, #0x28]
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;
+}
diff --git a/include/igt.h b/include/igt.h
new file mode 100644
index 00000000..bf5e5a63
--- /dev/null
+++ b/include/igt.h
@@ -0,0 +1,16 @@
+#ifndef POKEDIAMOND_IGT_H
+#define POKEDIAMOND_IGT_H
+
+struct IGT
+{
+ u16 hours;
+ u8 minutes;
+ u8 seconds;
+};
+
+void InitIGT(struct IGT * igt);
+void AddIGTSeconds(struct IGT * igt, u32 seconds);
+u16 GetIGTHours(struct IGT * igt);
+u8 GetIGTMinutes(struct IGT * igt);
+
+#endif //POKEDIAMOND_IGT_H
diff --git a/include/player_data.h b/include/player_data.h
index f051b1ce..04583052 100644
--- a/include/player_data.h
+++ b/include/player_data.h
@@ -2,6 +2,7 @@
#define POKEDIAMOND_PLAYER_DATA_H
#include "options.h"
+#include "igt.h"
struct SaveBlock2;
@@ -26,9 +27,9 @@ struct PlayerDataSav
struct Options options;
u8 padding[2];
struct PlayerData data;
- u16 field_24;
- u16 field_26;
- u32 field_28;
+ u16 coins;
+ struct IGT igt;
+ u8 padding2[2];
};
struct Options * LoadPlayerDataAddress(struct SaveBlock2 *);