summaryrefslogtreecommitdiff
path: root/arm9/src/scrcmd.c
diff options
context:
space:
mode:
authorAkira Akashi <rubenru09@aol.com>2021-06-02 22:13:57 +0100
committerGitHub <noreply@github.com>2021-06-02 22:13:57 +0100
commit9d3d4a2acff67f43896e9e0dcd26e7aaeb55e3b3 (patch)
treed707aa8fead427dadbbb29b886875e6c8961bd5a /arm9/src/scrcmd.c
parenta2a17a9426f16ee601ff17840b8bb7851fef7138 (diff)
parent7e32d3758e7e36d7a67a1442cdb9386f9aa18a6e (diff)
Merge branch 'master' into 0202A1E0
Diffstat (limited to 'arm9/src/scrcmd.c')
-rw-r--r--arm9/src/scrcmd.c83
1 files changed, 51 insertions, 32 deletions
diff --git a/arm9/src/scrcmd.c b/arm9/src/scrcmd.c
index 4ad17e51..7adb1fe8 100644
--- a/arm9/src/scrcmd.c
+++ b/arm9/src/scrcmd.c
@@ -4,6 +4,7 @@
#include "options.h"
#include "player_data.h"
#include "text.h"
+#include "unk_02016B94.h"
extern void *FUN_02039438(struct UnkSavStruct80* arg, u32 id);
extern void *CreateScriptContext(struct UnkSavStruct80* arg, u16 id);
@@ -27,16 +28,14 @@ extern void FUN_02055304(u32 param0, u32 param1);
extern void FUN_02039460(struct UnkSavStruct80 *arg);
extern void FUN_020545B8(u32 param0, u8 *param1, u32 param2);
extern void FUN_02054608(u8 *param0, struct Options *options);
-extern void FUN_0200D0E0(u32 *param0, u32 param1);
-extern void FUN_02019178(u32 *param0);
-extern void FUN_020179E0(u32 param0, u32 param1, u32 param2, u16 val);
+extern void FUN_0200D0E0(struct Window *param0, u32 param1);
extern u32 FUN_02058510(u32 param0, u32 param1);
extern void MOD05_021E8128(u32 param0, u8 type, u16 map);
extern void MOD05_021E8130(u32 param0, u32 param1);
extern void MOD05_021E8158(struct UnkSavStruct80 *unk80);
-extern u32 MOD05_021E8140(u32 param0);
+extern struct Window * MOD05_021E8140(u32 param0);
extern BOOL MOD05_021E8148(u32 param0);
-extern u8 FUN_02054658(u32 param0, struct String *str, struct Options *opt, u32 param3);
+extern u8 FUN_02054658(struct Window * param0, struct String *str, struct Options *opt, u32 param3);
extern void MOD05_021E8144(u32 param0);
extern void FUN_0200CB00(u32 param0, u32 param1, u32 param2, u32 param3, u32 param4, u32 param5);
extern u32 Std_CreateYesNoMenu(u32 param0, u8 **param1, u32 param2, u32 param3, u32 param4);
@@ -55,6 +54,10 @@ extern void MOD05_021E26CC(u32 param0, u8 param1);
extern void MOD05_021E2B80(u32 param0, u8 param1);
extern void MOD05_021E2B9C(u32 param0, u8 param1);
+extern u32 FUN_0203B120(struct UnkSavStruct80 *arg, u16 param1);
+extern u32 FUN_0205AEA4(u32 param0, const u8 *ptr);
+extern void FUN_0203B174(struct UnkSavStruct80 *arg, u32 param1, u32 param2);
+
extern u8 *UNK_020F34E0;
static BOOL RunPauseTimer(struct ScriptContext *ctx);
@@ -575,7 +578,7 @@ THUMB_FUNC BOOL ScrCmd_Unk01FF(struct ScriptContext *ctx)
return TRUE;
}
-THUMB_FUNC BOOL ScrCmd_Unk026D(struct ScriptContext *ctx) //message unown font?
+THUMB_FUNC BOOL ScrCmd_MessageUnown(struct ScriptContext *ctx)
{
struct UnkStruct_0203A288 myLocalStruct;
u16 msg = ScriptReadHalfword(ctx);
@@ -672,7 +675,7 @@ THUMB_FUNC BOOL ScrCmd_WaitButtonAB(struct ScriptContext *ctx)
THUMB_FUNC static BOOL FUN_0203A46C(struct ScriptContext *ctx)
{
#pragma unused(ctx)
- if (gMain.unk48 & 0x3) // Mask (A | B) ?
+ if (gMain.newKeys & 0x3) // Mask (A | B) ?
{
return TRUE;
}
@@ -688,7 +691,7 @@ THUMB_FUNC BOOL ScrCmd_WaitButtonABTime(struct ScriptContext *ctx)
THUMB_FUNC static BOOL FUN_0203A4AC(struct ScriptContext *ctx)
{
- if (gMain.unk48 & 0x3) // Mask (A | B) ?
+ if (gMain.newKeys & 0x3) // Mask (A | B) ?
{
return TRUE;
}
@@ -709,27 +712,27 @@ THUMB_FUNC BOOL ScrCmd_WaitButton(struct ScriptContext *ctx)
THUMB_FUNC static BOOL FUN_0203A4E0(struct ScriptContext *ctx)
{
- if (gMain.unk48 & 3)
+ if (gMain.newKeys & 3)
{
return TRUE;
}
- else if (gMain.unk48 & 0x40)
+ else if (gMain.newKeys & 0x40)
{
FUN_02055304(ctx->unk80->unk38, 0);
}
- else if (gMain.unk48 & 0x80)
+ else if (gMain.newKeys & 0x80)
{
FUN_02055304(ctx->unk80->unk38, 1);
}
- else if (gMain.unk48 & 0x20)
+ else if (gMain.newKeys & 0x20)
{
FUN_02055304(ctx->unk80->unk38, 2);
}
- else if (gMain.unk48 & 0x10)
+ else if (gMain.newKeys & 0x10)
{
FUN_02055304(ctx->unk80->unk38, 3);
}
- else if (gMain.unk48 & 0x400)
+ else if (gMain.newKeys & 0x400)
{
FUN_02039460(ctx->unk80);
}
@@ -740,7 +743,7 @@ THUMB_FUNC static BOOL FUN_0203A4E0(struct ScriptContext *ctx)
return TRUE;
}
-THUMB_FUNC BOOL ScrCmd_Unk0032(struct ScriptContext *ctx)
+THUMB_FUNC BOOL ScrCmd_WaitButtonABPad(struct ScriptContext *ctx)
{
SetupNativeScript(ctx, FUN_0203A570);
return TRUE;
@@ -749,11 +752,11 @@ THUMB_FUNC BOOL ScrCmd_Unk0032(struct ScriptContext *ctx)
THUMB_FUNC static BOOL FUN_0203A570(struct ScriptContext *ctx)
{
#pragma unused(ctx)
- if (gMain.unk48 & 0x3)
+ if (gMain.newKeys & 0x3)
{
return TRUE;
}
- else if (gMain.unk48 & 0xf0)
+ else if (gMain.newKeys & 0xf0)
{
return TRUE;
}
@@ -770,10 +773,10 @@ THUMB_FUNC BOOL ScrCmd_Unk0033(struct ScriptContext *ctx)
return FALSE;
}
-THUMB_FUNC BOOL ScrCmd_Unk0034(struct ScriptContext* ctx)
+THUMB_FUNC BOOL ScrCmd_CloseMessageBox(struct ScriptContext* ctx)
{
struct UnkSavStruct80 *unk80 = ctx->unk80;
- u32 *unk = FUN_02039438(unk80, 0x1); //windowID?
+ struct Window *unk = FUN_02039438(unk80, 0x1);
u8 *unk2 = FUN_02039438(unk80, 0x6);
FUN_0200D0E0(unk, 0); //clear window?
FUN_02019178(unk);
@@ -784,7 +787,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0034(struct ScriptContext* ctx)
THUMB_FUNC BOOL ScrCmd_Unk0035(struct ScriptContext* ctx)
{
struct UnkSavStruct80 *unk80 = ctx->unk80;
- u32 *unk = FUN_02039438(unk80, 0x1); //windowID?
+ struct Window *unk = FUN_02039438(unk80, 0x1);
u8 *unk2 = FUN_02039438(unk80, 0x6);
FUN_02019178(unk);
*unk2 = 0;
@@ -889,7 +892,7 @@ THUMB_FUNC BOOL ScrCmd_CreateMessageBox(struct ScriptContext* ctx)
MOD05_021E8158(unk80);
ReadMsgDataIntoString(ctx->msgData, msg, *unk1);
StringExpandPlaceholders(*unk3, *unk2, *unk1);
- AddTextPrinterParameterized(MOD05_021E8140(unk80->unk60), 1, (u16 *)*unk2, 0, 0, 0, NULL);
+ AddTextPrinterParameterized(MOD05_021E8140(unk80->unk60), 1, *unk2, 0, 0, 0, NULL);
return TRUE;
}
@@ -969,19 +972,19 @@ THUMB_FUNC static BOOL FUN_0203A94C(struct ScriptContext *ctx)
return TRUE;
}
- if (gMain.unk48 & 0x40)
+ if (gMain.newKeys & 0x40)
{
tmp = 0;
}
- else if (gMain.unk48 & 0x80)
+ else if (gMain.newKeys & 0x80)
{
tmp = 1;
}
- else if (gMain.unk48 & 0x20)
+ else if (gMain.newKeys & 0x20)
{
tmp = 2;
}
- else if (gMain.unk48 & 0x10)
+ else if (gMain.newKeys & 0x10)
{
tmp = 3;
}
@@ -995,7 +998,7 @@ THUMB_FUNC static BOOL FUN_0203A94C(struct ScriptContext *ctx)
}
else
{
- if (gMain.unk48 & 0x400)
+ if (gMain.newKeys & 0x400)
{
FUN_0201BD7C(*unk1);
*varPtr = 1;
@@ -1018,24 +1021,24 @@ THUMB_FUNC static BOOL FUN_0203AA0C(struct ScriptContext *ctx)
u16 *unk = GetVarPointer(ctx->unk80, (u16)ctx->data[0]);
u32 tmp = 0xFFFF;
- if (gMain.unk48 & 0x3)
+ if (gMain.newKeys & 0x3)
{
*unk = 0;
return TRUE;
}
- else if (gMain.unk48 & 0x40)
+ else if (gMain.newKeys & 0x40)
{
tmp = 0;
}
- else if (gMain.unk48 & 0x80)
+ else if (gMain.newKeys & 0x80)
{
tmp = 1;
}
- else if (gMain.unk48 & 0x20)
+ else if (gMain.newKeys & 0x20)
{
tmp = 2;
}
- else if (gMain.unk48 & 0x10)
+ else if (gMain.newKeys & 0x10)
{
tmp = 3;
}
@@ -1048,7 +1051,7 @@ THUMB_FUNC static BOOL FUN_0203AA0C(struct ScriptContext *ctx)
}
else
{
- if (gMain.unk48 & 0x400)
+ if (gMain.newKeys & 0x400)
{
*unk = 1;
return TRUE;
@@ -1298,3 +1301,19 @@ THUMB_FUNC BOOL ScrCmd_Unk02D0(struct ScriptContext *ctx)
MOD05_021E2B9C(*unk, ScriptReadByte(ctx));
return TRUE;
}
+
+THUMB_FUNC BOOL ScrCmd_Unk005E(struct ScriptContext *ctx) //ApplyMovement?
+{
+ u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ u32 unk2 = ScriptReadWord(ctx);
+
+ u32 unk3 = FUN_0203B120(ctx->unk80, unk);
+ GF_ASSERT(unk3);
+
+ u32 unk4 = FUN_0205AEA4(unk3, ctx->scriptPtr + unk2);
+ u8 *unk5 = FUN_02039438(ctx->unk80, 4);
+ (*unk5)++;
+
+ FUN_0203B174(ctx->unk80, unk4, 0);
+ return FALSE;
+}