summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arm9/asm/unk_0202C144.s42
-rw-r--r--arm9/src/unk_0202C144.c26
-rw-r--r--include/unk_02029FB0.h9
-rw-r--r--include/unk_0202C144.h3
4 files changed, 38 insertions, 42 deletions
diff --git a/arm9/asm/unk_0202C144.s b/arm9/asm/unk_0202C144.s
deleted file mode 100644
index fb5bc6c4..00000000
--- a/arm9/asm/unk_0202C144.s
+++ /dev/null
@@ -1,42 +0,0 @@
- .include "asm/macros.inc"
- .include "global.inc"
-
- .text
-
- thumb_func_start FUN_0202C144
-FUN_0202C144: ; 0x0202C144
- push {r3-r7, lr}
- add r4, r1, #0x0
- add r5, r0, #0x0
- add r0, r4, #0x0
- mov r1, #0x4c
- mov r2, #0x0
- bl GetMonData
- cmp r0, #0x0
- bne _0202C194
- add r0, r5, #0x0
- bl Sav2_Pokedex_get
- add r6, r0, #0x0
- add r0, r5, #0x0
- bl FUN_02029FC8
- add r7, r0, #0x0
- add r0, r4, #0x0
- mov r1, #0x5
- mov r2, #0x0
- bl GetMonData
- add r2, r0, #0x0
- lsl r2, r2, #0x10
- add r0, r7, #0x0
- add r1, r6, #0x0
- lsr r2, r2, #0x10
- bl FUN_0202A1C4
- add r0, r6, #0x0
- add r1, r4, #0x0
- bl Pokedex_SetMonCaughtFlag
- add r0, r5, #0x0
- bl Sav2_Poketch_get
- add r1, r4, #0x0
- bl Sav2_Poketch_PokemonHistoryAddMon
-_0202C194:
- pop {r3-r7, pc}
- .balign 4
diff --git a/arm9/src/unk_0202C144.c b/arm9/src/unk_0202C144.c
new file mode 100644
index 00000000..b7dd45aa
--- /dev/null
+++ b/arm9/src/unk_0202C144.c
@@ -0,0 +1,26 @@
+#include "global.h"
+#include "pokedex.h"
+#include "poketch.h"
+#include "unk_02029FB0.h"
+#include "unk_0202C144.h"
+
+#pragma thumb on
+
+extern struct UnkStruct_02029FB0 * FUN_02029FC8(struct SaveBlock2 * sav2);
+extern void FUN_0202A1C4(struct UnkStruct_02029FB0 * unk, struct Pokedex * pokedex, u16 species);
+
+void FUN_0202C144(struct SaveBlock2 * sav2, struct Pokemon * mon)
+{
+ u32 is_egg = GetMonData(mon, MON_DATA_IS_EGG, NULL);
+ if (!is_egg)
+ {
+ struct Pokedex * pokedex = Sav2_Pokedex_get(sav2);
+ struct UnkStruct_02029FB0 * unk = FUN_02029FC8(sav2);
+ u32 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
+ FUN_0202A1C4(unk, pokedex, (u16)species);
+ Pokedex_SetMonCaughtFlag(pokedex, mon);
+
+ struct SavePoketch * poketch = Sav2_Poketch_get(sav2);
+ Sav2_Poketch_PokemonHistoryAddMon(poketch, &mon->box);
+ }
+}
diff --git a/include/unk_02029FB0.h b/include/unk_02029FB0.h
new file mode 100644
index 00000000..545a6d3a
--- /dev/null
+++ b/include/unk_02029FB0.h
@@ -0,0 +1,9 @@
+#ifndef POKEDIAMOND_UNK_02029FB0_H
+#define POKEDIAMOND_UNK_02029FB0_H
+
+struct UnkStruct_02029FB0
+{
+ u8 unk[0x14C];
+};
+
+#endif
diff --git a/include/unk_0202C144.h b/include/unk_0202C144.h
index 31d3942c..95ca3be4 100644
--- a/include/unk_0202C144.h
+++ b/include/unk_0202C144.h
@@ -1,6 +1,9 @@
#ifndef POKEDIAMOND_UNK_0202C144_H
#define POKEDIAMOND_UNK_0202C144_H
+#include "save_block_2.h"
+#include "pokemon.h"
+
void FUN_0202C144(struct SaveBlock2 * sav2, struct Pokemon * mon);
#endif //POKEDIAMOND_UNK_0202C144_H