summaryrefslogtreecommitdiff
path: root/arm9/src/scrcmd_fossils.c
diff options
context:
space:
mode:
authorred031000 <rubenru09@aol.com>2021-05-31 21:12:03 +0100
committerred031000 <rubenru09@aol.com>2021-05-31 21:12:03 +0100
commit1aad76b774edbd598fb024d67cf54e7973ade8db (patch)
tree419a51e87fdee9af164f49c90f980f2979dbf2b5 /arm9/src/scrcmd_fossils.c
parent57d3832f898694df840f7e43781d5f608a2e8a1f (diff)
document a lot of scrcmd commands
Diffstat (limited to 'arm9/src/scrcmd_fossils.c')
-rw-r--r--arm9/src/scrcmd_fossils.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/arm9/src/scrcmd_fossils.c b/arm9/src/scrcmd_fossils.c
new file mode 100644
index 00000000..e4177382
--- /dev/null
+++ b/arm9/src/scrcmd_fossils.c
@@ -0,0 +1,86 @@
+#include "scrcmd.h"
+#include "bag.h"
+
+const u16 gFossilPokemonMap[7][2] = {
+ { ITEM_OLD_AMBER, SPECIES_AERODACTYL },
+ { ITEM_HELIX_FOSSIL, SPECIES_OMANYTE },
+ { ITEM_DOME_FOSSIL, SPECIES_KABUTO },
+ { ITEM_ROOT_FOSSIL, SPECIES_LILEEP },
+ { ITEM_CLAW_FOSSIL, SPECIES_ANORITH },
+ { ITEM_ARMOR_FOSSIL, SPECIES_SHIELDON },
+ { ITEM_SKULL_FOSSIL, SPECIES_CRANIDOS },
+};
+
+THUMB_FUNC BOOL ScrCmd_CountFossils(struct ScriptContext * ctx)
+{
+ struct UnkSavStruct80 * sav_ptr = ctx->unk80;
+
+ u16 *ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+
+ u8 i;
+ u16 total;
+ for (i = 0, total = 0; i < 7; i++)
+ {
+ total += Bag_GetQuantity(Sav2_Bag_get(sav_ptr->saveBlock2), gFossilPokemonMap[i][0], 4);
+ }
+
+ *ret_ptr = total;
+ return FALSE;
+}
+
+THUMB_FUNC BOOL ScrCmd_GetFossilPokemon(struct ScriptContext * ctx)
+{
+ u16 *ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+ u16 fossilId = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+
+ *ret_ptr = 0;
+
+ for (u16 i = 0; i < 7; i++)
+ {
+ if (gFossilPokemonMap[i][0] == fossilId)
+ {
+ *ret_ptr = gFossilPokemonMap[i][1];
+ break;
+ }
+ }
+
+ return FALSE;
+}
+
+THUMB_FUNC BOOL ScrCmd_GetFossilMinimumAmount(struct ScriptContext * ctx)
+{
+ struct UnkSavStruct80* sav_ptr = ctx->unk80;
+ u16 * ret_ptr1 = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+ u16 * ret_ptr2 = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+ u16 needed_amount = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+
+ *ret_ptr1 = 0;
+ *ret_ptr2 = 0;
+
+ u8 i = 0;
+ u16 total = 0;
+ for (; i < 7; i++)
+ {
+ total += Bag_GetQuantity(Sav2_Bag_get(sav_ptr->saveBlock2), gFossilPokemonMap[i][0], 4);
+ if (total >= needed_amount)
+ {
+ *ret_ptr1 = gFossilPokemonMap[i][0];
+ *ret_ptr2 = i;
+ break;
+ }
+ }
+
+ return FALSE;
+}
+
+THUMB_FUNC BOOL ScrCmd_Unk01F2(struct ScriptContext * ctx)
+{
+#pragma unused(ctx)
+ return FALSE;
+}
+
+THUMB_FUNC BOOL ScrCmd_Unk01F3(struct ScriptContext * ctx)
+{
+#pragma unused(ctx)
+ return FALSE;
+}