summaryrefslogtreecommitdiff
path: root/arm9/src
diff options
context:
space:
mode:
Diffstat (limited to 'arm9/src')
-rw-r--r--arm9/src/scrcmd_8.c87
-rw-r--r--arm9/src/unk_020286F8.c9
2 files changed, 91 insertions, 5 deletions
diff --git a/arm9/src/scrcmd_8.c b/arm9/src/scrcmd_8.c
new file mode 100644
index 00000000..ba35b302
--- /dev/null
+++ b/arm9/src/scrcmd_8.c
@@ -0,0 +1,87 @@
+#include "scrcmd.h"
+#include "math_util.h"
+#include "unk_020286F8.h"
+
+extern void* FUN_02039438(struct UnkSavStruct80*, u8 idx);
+
+extern void FUN_020385CC(struct UnkStruct_0204639C*, u32, u32, u32, u32, u16*, u16* ret_ptr);
+extern BOOL FUN_020612EC(struct UnkSavStruct80*);
+extern BOOL FUN_020612F8(struct UnkSavStruct80*);
+
+THUMB_FUNC BOOL ScrCmd_Unk021D(struct ScriptContext* ctx)
+{
+ struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15);
+ struct UnkSaveStruct_020286F8* unk_sav_ptr = FUN_0202881C(ctx->unk80->saveBlock2);
+ struct SaveBlock2* sav2 = ctx->unk80->saveBlock2;
+
+ u16 unk = ScriptReadHalfword(ctx);
+ switch (unk)
+ {
+ case 0: {
+ u16 unk_var = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+
+ *ret_ptr = (u16)FUN_02028828(unk_sav_ptr, unk_var);
+ return FALSE;
+ }
+ case 1: {
+ u16 unk_var = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+
+ *ret_ptr = (u16)FUN_02028840(unk_sav_ptr, unk_var);
+ return FALSE;
+ }
+ case 2: {
+ u16 unk_var = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+
+ BufferEasyChatWord(*mgr, sav2, unk_var, idx, 0);
+ break;
+ }
+ case 3: {
+ u16 unk_var = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+
+ BufferEasyChatWord(*mgr, sav2, unk_var, idx, 1);
+ break;
+ }
+ case 4: {
+ u16* unk_str_ptr = FUN_020287A8(unk_sav_ptr, 0, 0);
+ u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx));
+
+ FUN_020385CC(ctx->unk74, 5, 0, 7, 0, unk_str_ptr, ret_ptr);
+ return TRUE;
+ }
+ case 5: {
+ u16 src_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ BOOL unk_bool = FUN_02028828(unk_sav_ptr, 1);
+
+ FUN_02028700(unk_sav_ptr, src_idx, 1);
+ if (unk_bool != FALSE)
+ {
+ FUN_020612F8(ctx->unk80);
+ }
+
+ return FALSE;
+ }
+ case 6: {
+ struct String* player_name = String_ctor(64, 32);
+ struct PlayerData* player = Sav2_PlayerData_GetProfileAddr(ctx->unk80->saveBlock2);
+
+ PlayerName_FlatToString(player, player_name);
+ FUN_020287C0(unk_sav_ptr, 0, 1, player_name);
+ FUN_020287EC(unk_sav_ptr, 0, PlayerProfile_GetTrainerGender(player));
+ FUN_02028810(unk_sav_ptr, 0, 2);
+ FUN_02028788(unk_sav_ptr, 0, MTRandom());
+
+ String_dtor(player_name);
+
+ FUN_02028700(unk_sav_ptr, 0, 1);
+ FUN_020612EC(ctx->unk80);
+
+ break;
+ }
+ }
+
+ return FALSE;
+}
diff --git a/arm9/src/unk_020286F8.c b/arm9/src/unk_020286F8.c
index f54d1e2e..a23a94ff 100644
--- a/arm9/src/unk_020286F8.c
+++ b/arm9/src/unk_020286F8.c
@@ -75,9 +75,9 @@ void FUN_020287C0(struct UnkSaveStruct_020286F8 * ptr, u32 i, u32 j, struct Stri
CopyStringToU16Array(k, ptr[i].unk_10, 8);
}
-void FUN_020287EC(struct UnkSaveStruct_020286F8 * ptr, u32 i, u8 j)
+void FUN_020287EC(struct UnkSaveStruct_020286F8 * ptr, u32 i, u32 j)
{
- ptr[i].unk_20 = j;
+ ptr[i].unk_20 = (u8)j;
}
u8 FUN_020287F8(struct UnkSaveStruct_020286F8 * ptr, u32 i)
@@ -90,10 +90,9 @@ u8 FUN_02028804(struct UnkSaveStruct_020286F8 * ptr, u32 i)
return ptr[i].unk_21;
}
-
-void FUN_02028810(struct UnkSaveStruct_020286F8 * ptr, u32 i, u8 j)
+void FUN_02028810(struct UnkSaveStruct_020286F8 * ptr, u32 i, u32 j)
{
- ptr[i].unk_21 = j;
+ ptr[i].unk_21 = (u8)j;
}
struct UnkSaveStruct_020286F8 * FUN_0202881C(struct SaveBlock2 * sav2)