summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscnorton <scnorton@biociphers.org>2019-01-06 16:14:59 -0500
committerscnorton <scnorton@biociphers.org>2019-01-06 16:14:59 -0500
commitabac6f3ec853f451a7d456cfd336d8c51c0541c1 (patch)
treed4e50ebe8bd270cd14ba28558f527048019c4225
parentfdd7b1033cb32f02eb861ca87fa92b9886bdfe37 (diff)
Through ScrCmd_takecoins
-rw-r--r--asm/field_door.s36
-rw-r--r--asm/field_fadetransition.s20
-rw-r--r--asm/overworld.s6
-rw-r--r--asm/scrcmd.s552
-rw-r--r--asm/shop.s12
-rw-r--r--asm/slot_machine.s6
-rw-r--r--data/script_cmd_table.inc2
-rw-r--r--include/overworld.h1
-rw-r--r--src/scrcmd.c270
9 files changed, 311 insertions, 594 deletions
diff --git a/asm/field_door.s b/asm/field_door.s
index 9c7e5eb10..4384531d0 100644
--- a/asm/field_door.s
+++ b/asm/field_door.s
@@ -478,8 +478,8 @@ _0805B25C:
_0805B264: .4byte gUnknown_835B4B0
thumb_func_end sub_805B210
- thumb_func_start sub_805B268
-sub_805B268: @ 805B268
+ thumb_func_start FieldSetDoorOpened
+FieldSetDoorOpened: @ 805B268
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
@@ -504,10 +504,10 @@ _0805B292:
bx r0
.align 2, 0
_0805B298: .4byte gUnknown_835B5D8
- thumb_func_end sub_805B268
+ thumb_func_end FieldSetDoorOpened
- thumb_func_start sub_805B29C
-sub_805B29C: @ 805B29C
+ thumb_func_start FieldSetDoorClosed
+FieldSetDoorClosed: @ 805B29C
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
@@ -532,10 +532,10 @@ _0805B2C6:
bx r0
.align 2, 0
_0805B2CC: .4byte gUnknown_835B5D8
- thumb_func_end sub_805B29C
+ thumb_func_end FieldSetDoorClosed
- thumb_func_start sub_805B2D0
-sub_805B2D0: @ 805B2D0
+ thumb_func_start FieldAnimateDoorClose
+FieldAnimateDoorClose: @ 805B2D0
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
@@ -566,10 +566,10 @@ _0805B308:
pop {r4,r5}
pop {r1}
bx r1
- thumb_func_end sub_805B2D0
+ thumb_func_end FieldAnimateDoorClose
- thumb_func_start sub_805B310
-sub_805B310: @ 805B310
+ thumb_func_start FieldAnimateDoorOpen
+FieldAnimateDoorOpen: @ 805B310
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
@@ -600,10 +600,10 @@ _0805B348:
pop {r4,r5}
pop {r1}
bx r1
- thumb_func_end sub_805B310
+ thumb_func_end FieldAnimateDoorOpen
- thumb_func_start sub_805B350
-sub_805B350: @ 805B350
+ thumb_func_start FieldIsDoorAnimationRunning
+FieldIsDoorAnimationRunning: @ 805B350
push {lr}
ldr r0, _0805B360 @ =sub_805B028
bl FuncIsActiveTask
@@ -613,10 +613,10 @@ sub_805B350: @ 805B350
bx r1
.align 2, 0
_0805B360: .4byte sub_805B028
- thumb_func_end sub_805B350
+ thumb_func_end FieldIsDoorAnimationRunning
- thumb_func_start sub_805B364
-sub_805B364: @ 805B364
+ thumb_func_start GetDoorSoundEffect
+GetDoorSoundEffect: @ 805B364
push {lr}
adds r3, r0, 0
adds r2, r1, 0
@@ -635,7 +635,7 @@ _0805B380:
_0805B382:
pop {r1}
bx r1
- thumb_func_end sub_805B364
+ thumb_func_end GetDoorSoundEffect
thumb_func_start sub_805B388
sub_805B388: @ 805B388
diff --git a/asm/field_fadetransition.s b/asm/field_fadetransition.s
index f701e579b..494c3e61e 100644
--- a/asm/field_fadetransition.s
+++ b/asm/field_fadetransition.s
@@ -661,7 +661,7 @@ _0807E028:
ldrsh r0, [r6, r2]
movs r2, 0
ldrsh r1, [r7, r2]
- bl sub_805B268
+ bl FieldSetDoorOpened
movs r0, 0x1
strh r0, [r4, 0x8]
b _0807E206
@@ -691,7 +691,7 @@ _0807E074:
ldrsh r0, [r6, r1]
movs r2, 0
ldrsh r1, [r7, r2]
- bl sub_805B364
+ bl GetDoorSoundEffect
lsls r0, 16
lsrs r0, 16
bl PlaySE
@@ -699,12 +699,12 @@ _0807E074:
ldrsh r0, [r6, r1]
movs r2, 0
ldrsh r1, [r7, r2]
- bl sub_805B310
+ bl FieldAnimateDoorOpen
movs r0, 0x7
strh r0, [r4, 0x8]
b _0807E206
_0807E0A2:
- bl sub_805B350
+ bl FieldIsDoorAnimationRunning
lsls r0, 24
cmp r0, 0
beq _0807E0AE
@@ -750,7 +750,7 @@ _0807E0FC:
ldrsh r0, [r4, r1]
movs r2, 0x22
ldrsh r1, [r4, r2]
- bl sub_805B2D0
+ bl FieldAnimateDoorClose
movs r0, 0x9
strh r0, [r4, 0x8]
b _0807E206
@@ -762,7 +762,7 @@ _0807E10E:
lsls r0, 24
cmp r0, 0
beq _0807E206
- bl sub_805B350
+ bl FieldIsDoorAnimationRunning
lsls r0, 24
cmp r0, 0
bne _0807E206
@@ -822,7 +822,7 @@ _0807E198:
ldrsh r0, [r6, r1]
movs r2, 0
ldrsh r1, [r7, r2]
- bl sub_805B2D0
+ bl FieldAnimateDoorClose
lsls r0, 24
asrs r0, 24
strh r0, [r4, 0xA]
@@ -1690,7 +1690,7 @@ _0807E85C:
movs r2, 0
ldrsh r1, [r6, r2]
subs r1, 0x1
- bl sub_805B364
+ bl GetDoorSoundEffect
lsls r0, 16
lsrs r0, 16
bl PlaySE
@@ -1699,7 +1699,7 @@ _0807E85C:
movs r2, 0
ldrsh r1, [r6, r2]
subs r1, 0x1
- bl sub_805B310
+ bl FieldAnimateDoorOpen
lsls r0, 24
asrs r0, 24
strh r0, [r5, 0xA]
@@ -1760,7 +1760,7 @@ _0807E8F4:
movs r2, 0
ldrsh r1, [r6, r2]
subs r1, 0x1
- bl sub_805B2D0
+ bl FieldAnimateDoorClose
lsls r0, 24
asrs r0, 24
strh r0, [r5, 0xA]
diff --git a/asm/overworld.s b/asm/overworld.s
index eabb38228..071cca7e6 100644
--- a/asm/overworld.s
+++ b/asm/overworld.s
@@ -1185,8 +1185,8 @@ sub_80554BC: @ 80554BC
_080554C8: .4byte gUnknown_2031DBC
thumb_func_end sub_80554BC
- thumb_func_start sub_80554CC
-sub_80554CC: @ 80554CC
+ thumb_func_start SetLastHealLocationWarp
+SetLastHealLocationWarp: @ 80554CC
push {r4,r5,lr}
sub sp, 0x8
lsls r0, 24
@@ -1218,7 +1218,7 @@ _08055500:
bx r0
.align 2, 0
_08055508: .4byte gSaveBlock1Ptr
- thumb_func_end sub_80554CC
+ thumb_func_end SetLastHealLocationWarp
thumb_func_start sub_805550C
sub_805550C: @ 805550C
diff --git a/asm/scrcmd.s b/asm/scrcmd.s
index 8ffce84cd..0c45d5108 100644
--- a/asm/scrcmd.s
+++ b/asm/scrcmd.s
@@ -5,558 +5,6 @@
.text
- thumb_func_start ScrCmd_pokemartdecoration
-ScrCmd_pokemartdecoration: @ 806C3C0
- push {lr}
- bl ScriptReadWord
- bl sub_809C1A0
- bl ScriptContext1_Stop
- movs r0, 0x1
- pop {r1}
- bx r1
- thumb_func_end ScrCmd_pokemartdecoration
-
- thumb_func_start ScrCmd_pokemartdecoration2
-ScrCmd_pokemartdecoration2: @ 806C3D4
- push {lr}
- bl ScriptReadWord
- bl sub_809C1BC
- bl ScriptContext1_Stop
- movs r0, 0x1
- pop {r1}
- bx r1
- thumb_func_end ScrCmd_pokemartdecoration2
-
- thumb_func_start ScrCmd_playslotmachine
-ScrCmd_playslotmachine: @ 806C3E8
- push {lr}
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- lsls r0, 24
- lsrs r0, 24
- ldr r1, _0806C40C @ =c2_exit_to_overworld_1_continue_scripts_restart_music
- bl sub_813F804
- bl ScriptContext1_Stop
- movs r0, 0x1
- pop {r1}
- bx r1
- .align 2, 0
-_0806C40C: .4byte c2_exit_to_overworld_1_continue_scripts_restart_music
- thumb_func_end ScrCmd_playslotmachine
-
- thumb_func_start ScrCmd_setberrytree
-ScrCmd_setberrytree: @ 806C410
- movs r0, 0
- bx lr
- thumb_func_end ScrCmd_setberrytree
-
- thumb_func_start ScrCmd_getpricereduction
-ScrCmd_getpricereduction: @ 806C414
- movs r0, 0
- bx lr
- thumb_func_end ScrCmd_getpricereduction
-
- thumb_func_start ScrCmd_choosecontestmon
-ScrCmd_choosecontestmon: @ 806C418
- push {lr}
- bl ScriptContext1_Stop
- movs r0, 0x1
- pop {r1}
- bx r1
- thumb_func_end ScrCmd_choosecontestmon
-
- thumb_func_start ScrCmd_startcontest
-ScrCmd_startcontest: @ 806C424
- movs r0, 0
- bx lr
- thumb_func_end ScrCmd_startcontest
-
- thumb_func_start ScrCmd_showcontestresults
-ScrCmd_showcontestresults: @ 806C428
- movs r0, 0
- bx lr
- thumb_func_end ScrCmd_showcontestresults
-
- thumb_func_start ScrCmd_contestlinktransfer
-ScrCmd_contestlinktransfer: @ 806C42C
- movs r0, 0
- bx lr
- thumb_func_end ScrCmd_contestlinktransfer
-
- thumb_func_start ScrCmd_dofieldeffect
-ScrCmd_dofieldeffect: @ 806C430
- push {lr}
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- lsls r0, 16
- lsrs r0, 16
- ldr r1, _0806C454 @ =gUnknown_20370B6
- strh r0, [r1]
- lsls r0, 24
- lsrs r0, 24
- bl FieldEffectStart
- movs r0, 0
- pop {r1}
- bx r1
- .align 2, 0
-_0806C454: .4byte gUnknown_20370B6
- thumb_func_end ScrCmd_dofieldeffect
-
- thumb_func_start ScrCmd_setfieldeffectarg
-ScrCmd_setfieldeffectarg: @ 806C458
- push {r4,lr}
- ldr r1, [r0, 0x8]
- ldrb r4, [r1]
- adds r1, 0x1
- str r1, [r0, 0x8]
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- ldr r1, _0806C484 @ =gFieldEffectArguments
- lsls r4, 2
- adds r4, r1
- lsls r0, 16
- asrs r0, 16
- str r0, [r4]
- movs r0, 0
- pop {r4}
- pop {r1}
- bx r1
- .align 2, 0
-_0806C484: .4byte gFieldEffectArguments
- thumb_func_end ScrCmd_setfieldeffectarg
-
- thumb_func_start WaitForFieldEffectFinish
-WaitForFieldEffectFinish: @ 806C488
- push {lr}
- ldr r0, _0806C49C @ =gUnknown_20370B6
- ldrb r0, [r0]
- bl FieldEffectActiveListContains
- lsls r0, 24
- cmp r0, 0
- beq _0806C4A0
- movs r0, 0
- b _0806C4A2
- .align 2, 0
-_0806C49C: .4byte gUnknown_20370B6
-_0806C4A0:
- movs r0, 0x1
-_0806C4A2:
- pop {r1}
- bx r1
- thumb_func_end WaitForFieldEffectFinish
-
- thumb_func_start ScrCmd_waitfieldeffect
-ScrCmd_waitfieldeffect: @ 806C4A8
- push {r4,lr}
- adds r4, r0, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- ldr r1, _0806C4CC @ =gUnknown_20370B6
- strh r0, [r1]
- ldr r1, _0806C4D0 @ =WaitForFieldEffectFinish
- adds r0, r4, 0
- bl SetupNativeScript
- movs r0, 0x1
- pop {r4}
- pop {r1}
- bx r1
- .align 2, 0
-_0806C4CC: .4byte gUnknown_20370B6
-_0806C4D0: .4byte WaitForFieldEffectFinish
- thumb_func_end ScrCmd_waitfieldeffect
-
- thumb_func_start ScrCmd_setrespawn
-ScrCmd_setrespawn: @ 806C4D4
- push {lr}
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- lsls r0, 24
- lsrs r0, 24
- bl sub_80554CC
- movs r0, 0
- pop {r1}
- bx r1
- thumb_func_end ScrCmd_setrespawn
-
- thumb_func_start ScrCmd_checkplayergender
-ScrCmd_checkplayergender: @ 806C4F0
- ldr r1, _0806C500 @ =gSpecialVar_Result
- ldr r0, _0806C504 @ =gSaveBlock2Ptr
- ldr r0, [r0]
- ldrb r0, [r0, 0x8]
- strh r0, [r1]
- movs r0, 0
- bx lr
- .align 2, 0
-_0806C500: .4byte gSpecialVar_Result
-_0806C504: .4byte gSaveBlock2Ptr
- thumb_func_end ScrCmd_checkplayergender
-
- thumb_func_start ScrCmd_playmoncry
-ScrCmd_playmoncry: @ 806C508
- push {r4,r5,lr}
- adds r5, r0, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- adds r4, r0, 0
- lsls r4, 16
- lsrs r4, 16
- adds r0, r5, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- adds r1, r0, 0
- lsls r1, 24
- lsrs r1, 24
- adds r0, r4, 0
- bl PlayCry7
- movs r0, 0
- pop {r4,r5}
- pop {r1}
- bx r1
- thumb_func_end ScrCmd_playmoncry
-
- thumb_func_start ScrCmd_waitmoncry
-ScrCmd_waitmoncry: @ 806C540
- push {lr}
- ldr r1, _0806C550 @ =IsCryFinished
- bl SetupNativeScript
- movs r0, 0x1
- pop {r1}
- bx r1
- .align 2, 0
-_0806C550: .4byte IsCryFinished
- thumb_func_end ScrCmd_waitmoncry
-
- thumb_func_start ScrCmd_setmetatile
-ScrCmd_setmetatile: @ 806C554
- push {r4-r7,lr}
- adds r4, r0, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- lsls r0, 16
- lsrs r6, r0, 16
- adds r0, r4, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- lsls r0, 16
- lsrs r5, r0, 16
- adds r0, r4, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- lsls r0, 16
- lsrs r7, r0, 16
- adds r0, r4, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- lsls r0, 16
- adds r1, r6, 0x7
- lsls r1, 16
- lsrs r6, r1, 16
- adds r1, r5, 0x7
- lsls r1, 16
- lsrs r5, r1, 16
- cmp r0, 0
- bne _0806C5B8
- adds r0, r6, 0
- adds r1, r5, 0
- adds r2, r7, 0
- bl MapGridSetMetatileIdAt
- b _0806C5CA
-_0806C5B8:
- movs r1, 0xC0
- lsls r1, 4
- adds r0, r1, 0
- adds r2, r7, 0
- orrs r2, r0
- adds r0, r6, 0
- adds r1, r5, 0
- bl MapGridSetMetatileIdAt
-_0806C5CA:
- movs r0, 0
- pop {r4-r7}
- pop {r1}
- bx r1
- thumb_func_end ScrCmd_setmetatile
-
- thumb_func_start ScrCmd_opendoor
-ScrCmd_opendoor: @ 806C5D4
- push {r4,r5,lr}
- adds r4, r0, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- adds r5, r0, 0
- lsls r5, 16
- lsrs r5, 16
- adds r0, r4, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- adds r4, r0, 0
- lsls r4, 16
- adds r5, 0x7
- lsls r5, 16
- lsrs r5, 16
- movs r0, 0xE0
- lsls r0, 11
- adds r4, r0
- lsrs r4, 16
- adds r0, r5, 0
- adds r1, r4, 0
- bl sub_805B364
- lsls r0, 16
- lsrs r0, 16
- bl PlaySE
- adds r0, r5, 0
- adds r1, r4, 0
- bl sub_805B310
- movs r0, 0
- pop {r4,r5}
- pop {r1}
- bx r1
- thumb_func_end ScrCmd_opendoor
-
- thumb_func_start ScrCmd_closedoor
-ScrCmd_closedoor: @ 806C62C
- push {r4,r5,lr}
- adds r5, r0, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- adds r4, r0, 0
- lsls r4, 16
- lsrs r4, 16
- adds r0, r5, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- adds r1, r0, 0
- lsls r1, 16
- adds r4, 0x7
- lsls r4, 16
- lsrs r4, 16
- movs r0, 0xE0
- lsls r0, 11
- adds r1, r0
- lsrs r1, 16
- adds r0, r4, 0
- bl sub_805B2D0
- movs r0, 0
- pop {r4,r5}
- pop {r1}
- bx r1
- thumb_func_end ScrCmd_closedoor
-
- thumb_func_start sub_806C670
-sub_806C670: @ 806C670
- push {lr}
- bl sub_805B350
- lsls r0, 24
- cmp r0, 0
- beq _0806C680
- movs r0, 0
- b _0806C682
-_0806C680:
- movs r0, 0x1
-_0806C682:
- pop {r1}
- bx r1
- thumb_func_end sub_806C670
-
- thumb_func_start ScrCmd_waitdoranim
-ScrCmd_waitdoranim: @ 806C688
- push {lr}
- ldr r1, _0806C698 @ =sub_806C670
- bl SetupNativeScript
- movs r0, 0x1
- pop {r1}
- bx r1
- .align 2, 0
-_0806C698: .4byte sub_806C670
- thumb_func_end ScrCmd_waitdoranim
-
- thumb_func_start ScrCmd_setdooropen
-ScrCmd_setdooropen: @ 806C69C
- push {r4,r5,lr}
- adds r5, r0, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- adds r4, r0, 0
- lsls r4, 16
- lsrs r4, 16
- adds r0, r5, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- adds r1, r0, 0
- lsls r1, 16
- adds r4, 0x7
- lsls r4, 16
- lsrs r4, 16
- movs r0, 0xE0
- lsls r0, 11
- adds r1, r0
- lsrs r1, 16
- adds r0, r4, 0
- bl sub_805B268
- movs r0, 0
- pop {r4,r5}
- pop {r1}
- bx r1
- thumb_func_end ScrCmd_setdooropen
-
- thumb_func_start ScrCmd_setdoorclosed
-ScrCmd_setdoorclosed: @ 806C6E0
- push {r4,r5,lr}
- adds r5, r0, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- adds r4, r0, 0
- lsls r4, 16
- lsrs r4, 16
- adds r0, r5, 0
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- adds r1, r0, 0
- lsls r1, 16
- adds r4, 0x7
- lsls r4, 16
- lsrs r4, 16
- movs r0, 0xE0
- lsls r0, 11
- adds r1, r0
- lsrs r1, 16
- adds r0, r4, 0
- bl sub_805B29C
- movs r0, 0
- pop {r4,r5}
- pop {r1}
- bx r1
- thumb_func_end ScrCmd_setdoorclosed
-
- thumb_func_start ScrCmd_addelevmenuitem
-ScrCmd_addelevmenuitem: @ 806C724
- movs r0, 0
- bx lr
- thumb_func_end ScrCmd_addelevmenuitem
-
- thumb_func_start ScrCmd_showelevmenu
-ScrCmd_showelevmenu: @ 806C728
- movs r0, 0
- bx lr
- thumb_func_end ScrCmd_showelevmenu
-
- thumb_func_start ScrCmd_checkcoins
-ScrCmd_checkcoins: @ 806C72C
- push {r4,lr}
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl GetVarPointer
- adds r4, r0, 0
- bl GetCoins
- strh r0, [r4]
- movs r0, 0
- pop {r4}
- pop {r1}
- bx r1
- thumb_func_end ScrCmd_checkcoins
-
- thumb_func_start ScrCmd_givecoins
-ScrCmd_givecoins: @ 806C74C
- push {lr}
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- lsls r0, 16
- lsrs r0, 16
- bl GiveCoins
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x1
- bne _0806C774
- ldr r1, _0806C770 @ =gSpecialVar_Result
- movs r0, 0
- b _0806C778
- .align 2, 0
-_0806C770: .4byte gSpecialVar_Result
-_0806C774:
- ldr r1, _0806C780 @ =gSpecialVar_Result
- movs r0, 0x1
-_0806C778:
- strh r0, [r1]
- movs r0, 0
- pop {r1}
- bx r1
- .align 2, 0
-_0806C780: .4byte gSpecialVar_Result
- thumb_func_end ScrCmd_givecoins
-
- thumb_func_start ScrCmd_takecoins
-ScrCmd_takecoins: @ 806C784
- push {lr}
- bl ScriptReadHalfword
- lsls r0, 16
- lsrs r0, 16
- bl VarGet
- lsls r0, 16
- lsrs r0, 16
- bl TakeCoins
- lsls r0, 24
- lsrs r0, 24
- cmp r0, 0x1
- bne _0806C7AC
- ldr r1, _0806C7A8 @ =gSpecialVar_Result
- movs r0, 0
- b _0806C7B0
- .align 2, 0
-_0806C7A8: .4byte gSpecialVar_Result
-_0806C7AC:
- ldr r1, _0806C7B8 @ =gSpecialVar_Result
- movs r0, 0x1
-_0806C7B0:
- strh r0, [r1]
- movs r0, 0
- pop {r1}
- bx r1
- .align 2, 0
-_0806C7B8: .4byte gSpecialVar_Result
- thumb_func_end ScrCmd_takecoins
-
thumb_func_start ScrCmd_cmdCA
ScrCmd_cmdCA: @ 806C7BC
push {lr}
diff --git a/asm/shop.s b/asm/shop.s
index 5e44baa4a..25a2311ce 100644
--- a/asm/shop.s
+++ b/asm/shop.s
@@ -2853,8 +2853,8 @@ _0809C198: .4byte gUnknown_203996C
_0809C19C: .4byte gMapHeader
thumb_func_end CreatePokemartMenu
- thumb_func_start sub_809C1A0
-sub_809C1A0: @ 809C1A0
+ thumb_func_start CreateDecorationShop1Menu
+CreateDecorationShop1Menu: @ 809C1A0
push {lr}
bl sub_809ABD8
movs r0, 0x2
@@ -2865,10 +2865,10 @@ sub_809C1A0: @ 809C1A0
bx r0
.align 2, 0
_0809C1B8: .4byte EnableBothScriptContexts
- thumb_func_end sub_809C1A0
+ thumb_func_end CreateDecorationShop1Menu
- thumb_func_start sub_809C1BC
-sub_809C1BC: @ 809C1BC
+ thumb_func_start CreateDecorationShop2Menu
+CreateDecorationShop2Menu: @ 809C1BC
push {lr}
bl sub_809ABD8
movs r0, 0x3
@@ -2879,7 +2879,7 @@ sub_809C1BC: @ 809C1BC
bx r0
.align 2, 0
_0809C1D4: .4byte EnableBothScriptContexts
- thumb_func_end sub_809C1BC
+ thumb_func_end CreateDecorationShop2Menu
thumb_func_start sub_809C1D8
sub_809C1D8: @ 809C1D8
diff --git a/asm/slot_machine.s b/asm/slot_machine.s
index 2d1be0535..07483bb5e 100644
--- a/asm/slot_machine.s
+++ b/asm/slot_machine.s
@@ -5,8 +5,8 @@
.text
- thumb_func_start sub_813F804
-sub_813F804: @ 813F804
+ thumb_func_start PlaySlotMachine
+PlaySlotMachine: @ 813F804
push {r4-r6,lr}
adds r6, r1, 0
lsls r0, 16
@@ -39,7 +39,7 @@ _0813F840:
bx r0
.align 2, 0
_0813F848: .4byte sub_813F898
- thumb_func_end sub_813F804
+ thumb_func_end PlaySlotMachine
thumb_func_start sub_813F84C
sub_813F84C: @ 813F84C
diff --git a/data/script_cmd_table.inc b/data/script_cmd_table.inc
index 98c74b501..2faa40381 100644
--- a/data/script_cmd_table.inc
+++ b/data/script_cmd_table.inc
@@ -175,7 +175,7 @@ gScriptCmdTable:: @ 815F9B4
.4byte ScrCmd_turnvobject
.4byte ScrCmd_opendoor
.4byte ScrCmd_closedoor
- .4byte ScrCmd_waitdoranim
+ .4byte ScrCmd_waitdooranim
.4byte ScrCmd_setdooropen
.4byte ScrCmd_setdoorclosed
.4byte ScrCmd_addelevmenuitem
diff --git a/include/overworld.h b/include/overworld.h
index 53914b627..fbea3a4d9 100644
--- a/include/overworld.h
+++ b/include/overworld.h
@@ -95,5 +95,6 @@ extern u8 gUnknown_2031DD8;
extern u8 gUnknown_2036E28;
extern bool8 (* gUnknown_3005024)(void);
+void SetLastHealLocationWarp(u8 healLocaionId);
#endif //GUARD_ROM4_H
diff --git a/src/scrcmd.c b/src/scrcmd.c
index 3d7200b5b..c6f6ab5d3 100644
--- a/src/scrcmd.c
+++ b/src/scrcmd.c
@@ -36,6 +36,10 @@
#include "battle_setup.h"
#include "shop.h"
#include "script_pokemon_80F8.h"
+#include "slot_machine.h"
+#include "field_effect.h"
+#include "fieldmap.h"
+#include "field_door.h"
extern u16 (*const gSpecials[])(void);
extern u16 (*const gSpecialsEnd[])(void);
@@ -48,7 +52,7 @@ EWRAM_DATA u16 sPauseCounter = 0;
EWRAM_DATA u16 sMovingNpcId = 0;
EWRAM_DATA u16 sMovingNpcMapBank = 0;
EWRAM_DATA u16 sMovingNpcMapId = 0;
-EWRAM_DATA u16 gUnknown_20370B6 = 0;
+EWRAM_DATA u16 sFieldEffectScriptId = 0;
extern u8 gSelectedEventObject;
@@ -1960,3 +1964,267 @@ SCRCMD_DEF(pokemart)
ScriptContext1_Stop();
return TRUE;
}
+
+SCRCMD_DEF(pokemartdecoration)
+{
+ const void *ptr = (void *)ScriptReadWord(ctx);
+
+ CreateDecorationShop1Menu(ptr);
+ ScriptContext1_Stop();
+ return TRUE;
+}
+
+SCRCMD_DEF(pokemartdecoration2)
+{
+ const void *ptr = (void *)ScriptReadWord(ctx);
+
+ CreateDecorationShop2Menu(ptr);
+ ScriptContext1_Stop();
+ return TRUE;
+}
+
+SCRCMD_DEF(playslotmachine)
+{
+ u8 slotMachineIndex = VarGet(ScriptReadHalfword(ctx));
+
+ PlaySlotMachine(slotMachineIndex, c2_exit_to_overworld_1_continue_scripts_restart_music);
+ ScriptContext1_Stop();
+ return TRUE;
+}
+
+SCRCMD_DEF(setberrytree)
+{
+// u8 treeId = ScriptReadByte(ctx);
+// u8 berry = ScriptReadByte(ctx);
+// u8 growthStage = ScriptReadByte(ctx);
+//
+// if (berry == 0)
+// PlantBerryTree(treeId, 0, growthStage, FALSE);
+// else
+// PlantBerryTree(treeId, berry, growthStage, FALSE);
+ return FALSE;
+}
+
+SCRCMD_DEF(getpricereduction)
+{
+// u16 value = VarGet(ScriptReadHalfword(ctx));
+//
+// gSpecialVar_Result = GetPriceReduction(value);
+ return FALSE;
+}
+
+SCRCMD_DEF(choosecontestmon)
+{
+// sub_81B9404();
+ ScriptContext1_Stop();
+ return TRUE;
+}
+
+
+SCRCMD_DEF(startcontest)
+{
+// sub_80F840C();
+// ScriptContext1_Stop();
+// return TRUE;
+ return FALSE;
+}
+
+SCRCMD_DEF(showcontestresults)
+{
+// sub_80F8484();
+// ScriptContext1_Stop();
+// return TRUE;
+ return FALSE;
+}
+
+SCRCMD_DEF(contestlinktransfer)
+{
+// sub_80F84C4(gSpecialVar_ContestCategory);
+// ScriptContext1_Stop();
+// return TRUE;
+ return FALSE;
+}
+
+SCRCMD_DEF(dofieldeffect)
+{
+ u16 effectId = VarGet(ScriptReadHalfword(ctx));
+
+ sFieldEffectScriptId = effectId;
+ FieldEffectStart(sFieldEffectScriptId);
+ return FALSE;
+}
+
+SCRCMD_DEF(setfieldeffectarg)
+{
+ u8 argNum = ScriptReadByte(ctx);
+
+ gFieldEffectArguments[argNum] = (s16)VarGet(ScriptReadHalfword(ctx));
+ return FALSE;
+}
+
+static bool8 WaitForFieldEffectFinish(void)
+{
+ if (!FieldEffectActiveListContains(sFieldEffectScriptId))
+ return TRUE;
+ else
+ return FALSE;
+}
+
+SCRCMD_DEF(waitfieldeffect)
+{
+ sFieldEffectScriptId = VarGet(ScriptReadHalfword(ctx));
+ SetupNativeScript(ctx, WaitForFieldEffectFinish);
+ return TRUE;
+}
+
+SCRCMD_DEF(setrespawn)
+{
+ u16 healLocationId = VarGet(ScriptReadHalfword(ctx));
+
+ SetLastHealLocationWarp(healLocationId);
+ return FALSE;
+}
+
+SCRCMD_DEF(checkplayergender)
+{
+ gSpecialVar_Result = gSaveBlock2Ptr->playerGender;
+ return FALSE;
+}
+
+SCRCMD_DEF(playmoncry)
+{
+ u16 species = VarGet(ScriptReadHalfword(ctx));
+ u16 mode = VarGet(ScriptReadHalfword(ctx));
+
+ PlayCry7(species, mode);
+ return FALSE;
+}
+
+SCRCMD_DEF(waitmoncry)
+{
+ SetupNativeScript(ctx, IsCryFinished);
+ return TRUE;
+}
+
+SCRCMD_DEF(setmetatile)
+{
+ u16 x = VarGet(ScriptReadHalfword(ctx));
+ u16 y = VarGet(ScriptReadHalfword(ctx));
+ u16 tileId = VarGet(ScriptReadHalfword(ctx));
+ u16 v8 = VarGet(ScriptReadHalfword(ctx));
+
+ x += 7;
+ y += 7;
+ if (!v8)
+ MapGridSetMetatileIdAt(x, y, tileId);
+ else
+ MapGridSetMetatileIdAt(x, y, tileId | 0xC00);
+ return FALSE;
+}
+
+SCRCMD_DEF(opendoor)
+{
+ u16 x = VarGet(ScriptReadHalfword(ctx));
+ u16 y = VarGet(ScriptReadHalfword(ctx));
+
+ x += 7;
+ y += 7;
+ PlaySE(GetDoorSoundEffect(x, y));
+ FieldAnimateDoorOpen(x, y);
+ return FALSE;
+}
+
+SCRCMD_DEF(closedoor)
+{
+ u16 x = VarGet(ScriptReadHalfword(ctx));
+ u16 y = VarGet(ScriptReadHalfword(ctx));
+
+ x += 7;
+ y += 7;
+ FieldAnimateDoorClose(x, y);
+ return FALSE;
+}
+
+static bool8 IsDoorAnimationStopped(void)
+{
+ if (!FieldIsDoorAnimationRunning())
+ return TRUE;
+ else
+ return FALSE;
+}
+
+SCRCMD_DEF(waitdooranim)
+{
+ SetupNativeScript(ctx, IsDoorAnimationStopped);
+ return TRUE;
+}
+
+SCRCMD_DEF(setdooropen)
+{
+ u16 x = VarGet(ScriptReadHalfword(ctx));
+ u16 y = VarGet(ScriptReadHalfword(ctx));
+
+ x += 7;
+ y += 7;
+ FieldSetDoorOpened(x, y);
+ return FALSE;
+}
+
+SCRCMD_DEF(setdoorclosed)
+{
+ u16 x = VarGet(ScriptReadHalfword(ctx));
+ u16 y = VarGet(ScriptReadHalfword(ctx));
+
+ x += 7;
+ y += 7;
+ FieldSetDoorClosed(x, y);
+ return FALSE;
+}
+
+SCRCMD_DEF(addelevmenuitem)
+{
+// u8 v3 = ScriptReadByte(ctx);
+// u16 v5 = VarGet(ScriptReadHalfword(ctx));
+// u16 v7 = VarGet(ScriptReadHalfword(ctx));
+// u16 v9 = VarGet(ScriptReadHalfword(ctx));
+
+ //ScriptAddElevatorMenuItem(v3, v5, v7, v9);
+ return FALSE;
+}
+
+SCRCMD_DEF(showelevmenu)
+{
+ /*ScriptShowElevatorMenu();
+ ScriptContext1_Stop();
+ return TRUE;*/
+ return FALSE;
+}
+
+SCRCMD_DEF(checkcoins)
+{
+ u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx));
+ *ptr = GetCoins();
+ return FALSE;
+}
+
+SCRCMD_DEF(givecoins)
+{
+ u16 coins = VarGet(ScriptReadHalfword(ctx));
+
+ if (GiveCoins(coins) == TRUE)
+ gSpecialVar_Result = 0;
+ else
+ gSpecialVar_Result = 1;
+ return FALSE;
+}
+
+SCRCMD_DEF(takecoins)
+{
+ u16 coins = VarGet(ScriptReadHalfword(ctx));
+
+ if (TakeCoins(coins) == TRUE)
+ gSpecialVar_Result = 0;
+ else
+ gSpecialVar_Result = 1;
+ return FALSE;
+}