summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2016-10-18 21:15:22 -0700
committerYamaArashi <shadow962@live.com>2016-10-18 21:15:22 -0700
commit98520842e6db9f3cade035ffaec67ce919c30bb3 (patch)
treec9c27c9518157017373ef2546a67956519697e7f
parent89dea52f12456f7d6ebca8f99aab846bb5577042 (diff)
script condition table
-rw-r--r--data/data2.s10
-rw-r--r--data/event_scripts.s2
-rw-r--r--src/scrcmd.c14
3 files changed, 16 insertions, 10 deletions
diff --git a/data/data2.s b/data/data2.s
index 9e7be5b6e..a9b66e062 100644
--- a/data/data2.s
+++ b/data/data2.s
@@ -7077,8 +7077,14 @@ gMessageBoxTilemap:: @ 8376290
gUnknown_083762D8:: @ 83762D8
.4byte NULL
-gUnknown_083762DC:: @ 83762DC
- .incbin "baserom.gba", 0x003762dc, 0x14
+gScriptConditionTable:: @ 83762DC
+ @ < = >
+ .byte 1, 0, 0 @ <
+ .byte 0, 1, 0 @ =
+ .byte 0, 0, 1 @ >
+ .byte 1, 1, 0 @ <=
+ .byte 0, 1, 1 @ >=
+ .byte 1, 0, 1 @ !=
.align 2
gUnknown_083762F0:: @ 83762F0
diff --git a/data/event_scripts.s b/data/event_scripts.s
index cd9f7766a..73e7da981 100644
--- a/data/event_scripts.s
+++ b/data/event_scripts.s
@@ -22,7 +22,7 @@ gSpecialVars::
.4byte 0x202e8d8
.4byte 0x202e8da
.4byte 0x202e8e0
- .4byte 0x202e8dc
+ .4byte gScriptResult
.4byte 0x203855e
.4byte 0x202e8de
.4byte 0x203869e
diff --git a/src/scrcmd.c b/src/scrcmd.c
index c88a7499b..d2cdaf278 100644
--- a/src/scrcmd.c
+++ b/src/scrcmd.c
@@ -171,7 +171,7 @@ extern u8 *gStdScripts_End[];
extern u8 gSpeciesNames[][11];
extern u8 gMoveNames[][13];
-extern u8 gUnknown_083762DC[6][3];
+extern u8 gScriptConditionTable[6][3];
extern u8 * const gUnknown_083762F0[];
extern u8 * const gUnknown_083CE048[];
extern struct Decoration gDecorations[];
@@ -251,7 +251,7 @@ bool8 ScrCmd_jumpif(struct ScriptContext *ctx)
{
u8 condition = *(ctx->scriptPtr++);
u8 *ptr = (u8 *)ScriptReadWord(ctx);
- if (gUnknown_083762DC[condition][ctx->comparisonResult] == 1)
+ if (gScriptConditionTable[condition][ctx->comparisonResult] == 1)
ScriptJump(ctx, ptr);
return FALSE;
}
@@ -260,7 +260,7 @@ bool8 ScrCmd_callif(struct ScriptContext *ctx)
{
u8 condition = *(ctx->scriptPtr++);
u8 *ptr = (u8 *)ScriptReadWord(ctx);
- if (gUnknown_083762DC[condition][ctx->comparisonResult] == 1)
+ if (gScriptConditionTable[condition][ctx->comparisonResult] == 1)
ScriptCall(ctx, ptr);
return FALSE;
}
@@ -291,7 +291,7 @@ bool8 ScrCmd_if5(struct ScriptContext *ctx)
{
u8 condition = *(ctx->scriptPtr++);
u8 *ptr = (u8 *)(ScriptReadWord(ctx) - gUnknown_0202E8B0);
- if (gUnknown_083762DC[condition][ctx->comparisonResult] == 1)
+ if (gScriptConditionTable[condition][ctx->comparisonResult] == 1)
ScriptJump(ctx, ptr);
return FALSE;
}
@@ -300,7 +300,7 @@ bool8 ScrCmd_if6(struct ScriptContext *ctx)
{
u8 condition = *(ctx->scriptPtr++);
u8 *ptr = (u8 *)(ScriptReadWord(ctx) - gUnknown_0202E8B0);
- if (gUnknown_083762DC[condition][ctx->comparisonResult] == 1)
+ if (gScriptConditionTable[condition][ctx->comparisonResult] == 1)
ScriptCall(ctx, ptr);
return FALSE;
}
@@ -327,7 +327,7 @@ bool8 ScrCmd_jumpstdif(struct ScriptContext *ctx)
{
u8 condition = *(ctx->scriptPtr++);
u8 index = *(ctx->scriptPtr++);
- if (gUnknown_083762DC[condition][ctx->comparisonResult] == 1)
+ if (gScriptConditionTable[condition][ctx->comparisonResult] == 1)
{
u8 **ptr = &gStdScripts[index];
if (ptr < gStdScripts_End)
@@ -340,7 +340,7 @@ bool8 ScrCmd_callstdif(struct ScriptContext *ctx)
{
u8 condition = *(ctx->scriptPtr++);
u8 index = *(ctx->scriptPtr++);
- if (gUnknown_083762DC[condition][ctx->comparisonResult] == 1)
+ if (gScriptConditionTable[condition][ctx->comparisonResult] == 1)
{
u8 **ptr = &gStdScripts[index];
if (ptr < gStdScripts_End)