summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscnorton <scnorton@biociphers.org>2019-01-06 16:17:40 -0500
committerscnorton <scnorton@biociphers.org>2019-01-06 16:17:40 -0500
commit1581631e6286e0ec8178630433e8c15cd7076ead (patch)
tree996dc1a413c8818d6efb746ecf15c3fae28b983e
parentabac6f3ec853f451a7d456cfd336d8c51c0541c1 (diff)
Finish decompiling scrcmd
-rw-r--r--asm/scrcmd.s117
-rw-r--r--include/script.h2
-rw-r--r--ld_script.txt1
-rw-r--r--src/scrcmd.c40
4 files changed, 42 insertions, 118 deletions
diff --git a/asm/scrcmd.s b/asm/scrcmd.s
deleted file mode 100644
index 0c45d5108..000000000
--- a/asm/scrcmd.s
+++ /dev/null
@@ -1,117 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .syntax unified
-
- .text
-
- thumb_func_start ScrCmd_cmdCA
-ScrCmd_cmdCA: @ 806C7BC
- push {lr}
- bl sub_8069A20
- movs r0, 0
- pop {r1}
- bx r1
- thumb_func_end ScrCmd_cmdCA
-
- thumb_func_start ScrCmd_cmdCB
-ScrCmd_cmdCB: @ 806C7C8
- push {lr}
- bl sub_8069A2C
- movs r0, 0
- pop {r1}
- bx r1
- thumb_func_end ScrCmd_cmdCB
-
- thumb_func_start ScrCmd_setmonobedient
-ScrCmd_setmonobedient: @ 806C7D4
- push {lr}
- sub sp, 0x4
- movs r2, 0x1
- mov r1, sp
- strb r2, [r1]
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- lsls r0, 16
- lsrs r0, 16
- movs r1, 0x64
- muls r0, r1
- ldr r1, _0806C808 @ =gPlayerParty
- adds r0, r1
- movs r1, 0x50
- mov r2, sp
- bl SetMonData
- movs r0, 0
- add sp, 0x4
- pop {r1}
- bx r1
- .align 2, 0
-_0806C808: .4byte gPlayerParty
- thumb_func_end ScrCmd_setmonobedient
-
- thumb_func_start ScrCmd_checkmonobedience
-ScrCmd_checkmonobedience: @ 806C80C
- push {r4,lr}
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- lsls r0, 16
- lsrs r0, 16
- ldr r4, _0806C83C @ =gSpecialVar_Result
- movs r1, 0x64
- muls r0, r1
- ldr r1, _0806C840 @ =gPlayerParty
- adds r0, r1
- movs r1, 0x50
- movs r2, 0
- bl GetMonData
- strh r0, [r4]
- movs r0, 0
- pop {r4}
- pop {r1}
- bx r1
- .align 2, 0
-_0806C83C: .4byte gSpecialVar_Result
-_0806C840: .4byte gPlayerParty
- thumb_func_end ScrCmd_checkmonobedience
-
- thumb_func_start ScrCmd_setmonmetlocation
-ScrCmd_setmonmetlocation: @ 806C844
- push {r4,lr}
- sub sp, 0x4
- adds r4, r0, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- lsls r0, 16
- lsrs r3, r0, 16
- ldr r0, [r4, 0x8]
- ldrb r2, [r0]
- mov r1, sp
- strb r2, [r1]
- adds r0, 0x1
- str r0, [r4, 0x8]
- cmp r3, 0x5
- bhi _0806C87A
- movs r0, 0x64
- muls r0, r3
- ldr r1, _0806C884 @ =gPlayerParty
- adds r0, r1
- movs r1, 0x23
- mov r2, sp
- bl SetMonData
-_0806C87A:
- movs r0, 0
- add sp, 0x4
- pop {r4}
- pop {r1}
- bx r1
- .align 2, 0
-_0806C884: .4byte gPlayerParty
- thumb_func_end ScrCmd_setmonmetlocation
-
- .align 2, 0 @ Don't pad with nop.
diff --git a/include/script.h b/include/script.h
index 88e729526..8ffbe1563 100644
--- a/include/script.h
+++ b/include/script.h
@@ -70,6 +70,8 @@ void sub_80699F8(void);
void sub_8069964(void);
void sub_80699A4(void);
void sub_8069970(void);
+void sub_8069A20(void);
+void sub_8069A2C(void);
extern const u8 *gRAMScriptPtr;
diff --git a/ld_script.txt b/ld_script.txt
index cdec8f7c6..5bfe7f28c 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -104,7 +104,6 @@ SECTIONS {
asm/text_window_graphics.o(.text);
src/script.o(.text);
src/scrcmd.o(.text);
- asm/scrcmd.o(.text);
asm/field_control_avatar.o(.text);
asm/event_data.o(.text);
asm/coord_event_weather.o(.text);
diff --git a/src/scrcmd.c b/src/scrcmd.c
index c6f6ab5d3..911ad2a42 100644
--- a/src/scrcmd.c
+++ b/src/scrcmd.c
@@ -2228,3 +2228,43 @@ SCRCMD_DEF(takecoins)
gSpecialVar_Result = 1;
return FALSE;
}
+
+SCRCMD_DEF(cmdCA)
+{
+ sub_8069A20();
+ return FALSE;
+}
+
+SCRCMD_DEF(cmdCB)
+{
+ sub_8069A2C();
+ return FALSE;
+}
+
+// This command will force the Pokémon to be obedient, you don't get to make it disobedient.
+SCRCMD_DEF(setmonobedient)
+{
+ bool8 obedient = TRUE;
+ u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
+
+ SetMonData(&gPlayerParty[partyIndex], MON_DATA_OBEDIENCE, &obedient);
+ return FALSE;
+}
+
+SCRCMD_DEF(checkmonobedience)
+{
+ u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
+
+ gSpecialVar_Result = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OBEDIENCE, NULL);
+ return FALSE;
+}
+
+SCRCMD_DEF(setmonmetlocation)
+{
+ u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
+ u8 location = ScriptReadByte(ctx);
+
+ if (partyIndex < PARTY_SIZE)
+ SetMonData(&gPlayerParty[partyIndex], MON_DATA_MET_LOCATION, &location);
+ return FALSE;
+}