decompile script.s

This commit is contained in:
DizzyEggg 2017-09-10 23:05:23 +02:00
parent 7e9948ba2b
commit a2a66181fb
53 changed files with 1012 additions and 1446 deletions

View File

@ -108,7 +108,7 @@ sub_80B06B0: @ 80B06B0
thumb_func_start sub_80B06BC
sub_80B06BC: @ 80B06BC
push {r4,lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
bl sub_808BCF4
ldr r1, =gMain
@ -150,7 +150,7 @@ _080B06F2:
thumb_func_start sub_80B072C
sub_80B072C: @ 80B072C
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
bl sub_808BCF4
ldr r1, =gMain
@ -179,7 +179,7 @@ sub_80B072C: @ 80B072C
thumb_func_start sub_80B077C
sub_80B077C: @ 80B077C
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
bl sub_808BCF4
ldr r1, =gMain
@ -201,7 +201,7 @@ sub_80B077C: @ 80B077C
thumb_func_start sub_80B07B4
sub_80B07B4: @ 80B07B4
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
bl sub_808BCF4
ldr r1, =gMain
@ -283,7 +283,7 @@ sub_80B086C: @ 80B086C
lsls r1, 1
movs r2, 0x5
bl CreateMaleMon
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r1, =gMain
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
str r0, [r1, 0x8]
@ -302,7 +302,7 @@ sub_80B086C: @ 80B086C
thumb_func_start sub_80B08A8
sub_80B08A8: @ 80B08A8
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r1, =gMain
ldr r0, =sub_80B0B6C
str r0, [r1, 0x8]
@ -328,7 +328,7 @@ sub_80B08A8: @ 80B08A8
thumb_func_start sub_80B08EC
sub_80B08EC: @ 80B08EC
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r1, =gMain
ldr r0, =sub_80B0B6C
str r0, [r1, 0x8]
@ -355,7 +355,7 @@ sub_80B08EC: @ 80B08EC
thumb_func_start sub_80B0934
sub_80B0934: @ 80B0934
push {r4,lr}
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r1, =gMain
ldr r0, =sub_80B0B6C
str r0, [r1, 0x8]
@ -457,7 +457,7 @@ _080B09FE:
thumb_func_start sub_80B0A18
sub_80B0A18: @ 80B0A18
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r1, =gMain
ldr r0, =sub_80B0B6C
str r0, [r1, 0x8]
@ -494,7 +494,7 @@ _080B0A5A:
thumb_func_start sub_80B0A74
sub_80B0A74: @ 80B0A74
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r1, =gMain
ldr r0, =sub_80B0B6C
str r0, [r1, 0x8]
@ -1895,7 +1895,7 @@ SingleTrainerWantsBattle: @ 80B162C
bl TrainerBattleConfigure
ldr r0, =gUnknown_08271354
bl ScriptContext1_SetupScript
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r4}
pop {r0}
bx r0
@ -1933,7 +1933,7 @@ TwoTrainersWantBattleExecuteScript: @ 80B16A4
push {lr}
ldr r0, =gUnknown_08271354
bl ScriptContext1_SetupScript
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
.pool
@ -2213,7 +2213,7 @@ _080B18E8:
_080B1908:
bl task_add_01_battle_start_with_music_and_stats
_080B190C:
bl script_env_2_set_ctx_paused
bl ScriptContext1_Stop
pop {r4}
pop {r0}
bx r0
@ -2315,7 +2315,7 @@ sub_80B19EC: @ 80B19EC
ldr r0, =sub_80B1994
str r0, [r1, 0x8]
bl task_add_01_battle_start_with_music_and_stats
bl script_env_2_set_ctx_paused
bl ScriptContext1_Stop
pop {r0}
bx r0
.pool

View File

@ -73,7 +73,7 @@ sub_817963C: @ 817963C
bl PlaySE
ldr r0, =0x000008af
bl FlagSet
bl script_env_2_disable
bl ScriptContext2_Disable
pop {r0}
bx r0
.pool
@ -218,7 +218,7 @@ sub_8179778: @ 8179778
bne _081797D0
adds r0, r5, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
bl InstallCameraPanAheadCallback
_081797D0:
pop {r4,r5}
@ -326,7 +326,7 @@ sub_8179860: @ 8179860
movs r0, 0x8B
lsls r0, 4
bl FlagSet
bl script_env_2_disable
bl ScriptContext2_Disable
pop {r0}
bx r0
.pool
@ -421,7 +421,7 @@ sub_8179944: @ 8179944
bl PlaySE
ldr r0, =0x000008b2
bl FlagSet
bl script_env_2_disable
bl ScriptContext2_Disable
pop {r0}
bx r0
.pool

View File

@ -31,7 +31,7 @@ _0814FC8E:
sub_814FC9C: @ 814FC9C
push {lr}
sub sp, 0x4
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =sub_814FC70
movs r1, 0x1
bl CreateTask

View File

@ -999,7 +999,7 @@ _080B2BEC:
adds r0, r1
ldrh r0, [r0, 0x12]
bl sub_80B241C
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
lsls r0, r4, 24
lsrs r0, 24
bl DestroyTask
@ -1093,7 +1093,7 @@ sub_80B2CB0: @ 80B2CB0
adds r4, r0
ldrh r0, [r4, 0x12]
bl sub_80B241C
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
ldrb r0, [r4, 0x12]
bl RemoveWindow
adds r0, r5, 0
@ -1124,7 +1124,7 @@ sub_80B2CEC: @ 80B2CEC
bl sub_8098374
ldrb r0, [r4, 0x12]
bl RemoveWindow
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r5, 0
bl DestroyTask
pop {r4,r5}
@ -1152,7 +1152,7 @@ sub_80B2D2C: @ 80B2D2C
ldrb r0, [r4, 0x12]
bl RemoveWindow
bl textbox_close
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r5, 0
bl DestroyTask
pop {r4,r5}
@ -1429,7 +1429,7 @@ _080B2F82:
b _080B2FC6
.pool
_080B2FA8:
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r6, 0
bl DestroyTask
b _080B2FC6
@ -1438,7 +1438,7 @@ _080B2FB4:
ldrb r0, [r0]
cmp r0, 0
bne _080B2FC6
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r6, 0
bl DestroyTask
_080B2FC6:
@ -2342,7 +2342,7 @@ _080B37B8:
bl sub_8197AE8
adds r0, r4, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_080B37CC:
pop {r4,r5}
pop {r0}
@ -2362,7 +2362,7 @@ sub_80B37D4: @ 80B37D4
adds r1, r4, 0
adds r2, r5, 0
bl SetTaskFuncWithFollowupFunc
bl script_env_2_set_ctx_paused
bl ScriptContext1_Stop
pop {r4,r5}
pop {r0}
bx r0
@ -2396,7 +2396,7 @@ _080B3824:
beq _080B3870
b _080B3884
_080B382E:
bl script_env_2_enable
bl ScriptContext2_Enable
movs r0, 0x1
movs r1, 0
bl fade_screen
@ -2467,7 +2467,7 @@ _080B38BC:
beq _080B3908
b _080B391C
_080B38C6:
bl script_env_2_enable
bl ScriptContext2_Enable
movs r0, 0x1
movs r1, 0
bl fade_screen
@ -2575,7 +2575,7 @@ sub_80B39A4: @ 80B39A4
ldr r0, =sub_80B3728
movs r1, 0x50
bl CreateTask
bl script_env_2_set_ctx_paused
bl ScriptContext1_Stop
pop {r0}
bx r0
.pool
@ -2695,7 +2695,7 @@ sub_80B3AAC: @ 80B3AAC
ldrb r0, [r0]
cmp r0, 0
bne _080B3AC4
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r4, 0
bl DestroyTask
_080B3AC4:

View File

@ -5599,8 +5599,8 @@ _080DA860:
thumb_func_start sub_80DA874
sub_80DA874: @ 80DA874
push {lr}
bl script_env_2_disable
bl script_env_2_enable_and_set_ctx_running
bl ScriptContext2_Disable
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_80DA874

View File

@ -5196,7 +5196,7 @@ _080F83FE:
sub_80F840C: @ 80F840C
push {lr}
sub sp, 0x4
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =sub_80F83E0
movs r1, 0xA
bl CreateTask
@ -5252,7 +5252,7 @@ _080F8476:
sub_80F8484: @ 80F8484
push {lr}
sub sp, 0x4
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =sub_80F8458
movs r1, 0xA
bl CreateTask
@ -5285,7 +5285,7 @@ sub_80F84C4: @ 80F84C4
adds r5, r0, 0
lsls r5, 24
lsrs r5, 24
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r6, =sub_80FC580
adds r0, r6, 0
movs r1, 0
@ -5599,8 +5599,8 @@ _080F874C:
negs r3, r3
movs r0, 0
bl saved_warp2_set
bl script_env_2_disable
bl script_env_2_enable_and_set_ctx_running
bl ScriptContext2_Disable
bl EnableBothScriptContexts
_080F877E:
pop {r4-r6}
pop {r0}
@ -5639,8 +5639,8 @@ sub_80F87B4: @ 80F87B4
bne _080F87D0
adds r0, r1, 0
bl DestroyTask
bl script_env_2_disable
bl script_env_2_enable_and_set_ctx_running
bl ScriptContext2_Disable
bl EnableBothScriptContexts
_080F87D0:
pop {r0}
bx r0

View File

@ -3100,7 +3100,7 @@ _0807124E:
bl RemoveWindow
adds r0, r5, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
b _080712B4
.pool
_08071284:
@ -3122,7 +3122,7 @@ _08071284:
bl RemoveWindow
adds r0, r5, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_080712B4:
pop {r4,r5}
pop {r0}

View File

@ -161,7 +161,7 @@ sub_8126ABC: @ 8126ABC
ldr r1, =gUnknown_0203A150
movs r0, 0
strb r0, [r1]
bl script_env_2_enable
bl ScriptContext2_Enable
bl sub_8126A88
bl sub_8126C08
pop {r0}
@ -4132,7 +4132,7 @@ c1_overworld_prev_quest: @ 8128BEC
b _08128C4C
.pool
_08128C10:
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
@ -4198,7 +4198,7 @@ _08128C9C:
b _08128CAC
.pool
_08128CA8:
bl script_env_2_enable
bl ScriptContext2_Enable
_08128CAC:
ldrh r0, [r4, 0x4]
adds r0, 0x1
@ -4225,7 +4225,7 @@ _08128CCA:
thumb_func_start sub_8128CD4
sub_8128CD4: @ 8128CD4
push {r4,lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl pal_fill_black
ldr r0, =sub_8128C64
movs r1, 0x8
@ -5796,7 +5796,7 @@ _08129928:
b _08129994
.pool
_08129954:
bl script_env_2_enable
bl ScriptContext2_Enable
adds r0, r5, 0
bl sub_8127814
bl pal_fill_black
@ -6956,7 +6956,7 @@ _0812A2FC:
b _0812A30C
.pool
_0812A308:
bl script_env_2_enable
bl ScriptContext2_Enable
_0812A30C:
ldrh r0, [r4, 0x4]
adds r0, 0x1

View File

@ -468,7 +468,7 @@ sub_807172C: @ 807172C
thumb_func_start sub_8071740
sub_8071740: @ 8071740
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =sub_8071760
movs r1, 0xA
bl CreateTask

View File

@ -689,7 +689,7 @@ _0809C442:
adds r1, r0, 0
ldr r0, =gScriptLastTalked
ldrb r0, [r0]
bl sub_8099188
bl GetRamScript
adds r1, r0, 0
_0809C44E:
pop {r4-r7}

View File

@ -1960,7 +1960,7 @@ mapldr_080842E8: @ 80B69FC
ldr r0, =task00_8084310
movs r1, 0
bl CreateTask
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
ldr r1, =gUnknown_03005DAC
movs r0, 0
@ -2056,7 +2056,7 @@ mapldr_08084390: @ 80B6AA4
movs r1, 0x3
bl FieldObjectTurn
_080B6AE6:
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
ldr r1, =gUnknown_03005DAC
movs r0, 0
@ -2099,7 +2099,7 @@ _080B6B3E:
lsls r0, 24
cmp r0, 0
bne _080B6B58
bl script_env_2_disable
bl ScriptContext2_Disable
bl sub_809757C
adds r0, r5, 0
bl DestroyTask
@ -2115,7 +2115,7 @@ sub_80B6B68: @ 80B6B68
push {lr}
bl sub_8085784
bl pal_fill_for_maplights
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
ldr r0, =sub_80B6B94
movs r1, 0
@ -2457,7 +2457,7 @@ sub_80B6E18: @ 80B6E18
ldr r1, =gUnknown_02037590
movs r0, 0
strb r0, [r1, 0x6]
bl script_env_2_disable
bl ScriptContext2_Disable
bl CameraObjectReset1
bl sub_809757C
bl InstallCameraPanAheadCallback
@ -2782,7 +2782,7 @@ sub_80B70B4: @ 80B70B4
push {lr}
bl sub_8085784
bl pal_fill_for_maplights
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =sub_80B70DC
movs r1, 0
bl CreateTask
@ -3076,7 +3076,7 @@ sub_80B72F4: @ 80B72F4
cmp r0, 0
beq _080B7338
bl CameraObjectReset1
bl script_env_2_disable
bl ScriptContext2_Disable
movs r0, 0x4
bl GetGoSpeed0AnimId
adds r1, r0, 0
@ -3161,7 +3161,7 @@ _080B7396:
sub_80B73D0: @ 80B73D0
push {r4,lr}
adds r4, r0, 0
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r1, =gUnknown_02037590
movs r0, 0x1
strb r0, [r1, 0x6]
@ -3180,7 +3180,7 @@ waterfall_1_do_anim_probably: @ 80B73F0
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
bl script_env_2_enable
bl ScriptContext2_Enable
adds r0, r5, 0
bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive
lsls r0, 24
@ -3267,7 +3267,7 @@ _080B748E:
lsrs r4, r0, 24
cmp r4, 0
bne _080B74C4
bl script_env_2_disable
bl ScriptContext2_Disable
ldr r0, =gUnknown_02037590
strb r4, [r0, 0x6]
ldr r0, =sub_80B7384
@ -3362,7 +3362,7 @@ dive_1_lock: @ 80B7544
dive_2_unknown: @ 80B7558
push {r4,lr}
adds r4, r0, 0
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r1, =gUnknown_02038C08
movs r2, 0x26
ldrsh r0, [r4, r2]
@ -3749,7 +3749,7 @@ mapldr_080851BC: @ 80B7868
push {lr}
bl sub_8085784
bl pal_fill_for_maplights
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =gUnknown_03005DAC
movs r1, 0
str r1, [r0]
@ -3918,7 +3918,7 @@ sub_80B79BC: @ 80B79BC
ldr r1, =gUnknown_02037590
movs r0, 0
strb r0, [r1, 0x6]
bl script_env_2_disable
bl ScriptContext2_Disable
bl sub_809757C
ldr r0, =sub_80B7890
bl FindTaskIdByFunc
@ -4286,7 +4286,7 @@ _080B7CC4:
thumb_func_start sub_80B7CC8
sub_80B7CC8: @ 80B7CC8
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
ldr r0, =sub_80B7CE4
movs r1, 0x50
@ -4460,7 +4460,7 @@ mapldr_080859D4: @ 80B7E48
push {lr}
bl sub_8085784
bl pal_fill_for_maplights
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
ldr r1, =gUnknown_03005DAC
movs r0, 0
@ -4582,7 +4582,7 @@ _080B7F32:
negs r0, r0
ands r0, r1
strb r0, [r6, 0x1]
bl script_env_2_disable
bl ScriptContext2_Disable
bl sub_809757C
ldr r0, =sub_80B7E94
bl FindTaskIdByFunc
@ -4671,7 +4671,7 @@ sub_80B7FDC: @ 80B7FDC
sub_80B800C: @ 80B800C
push {r4,lr}
adds r4, r0, 0
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
bl CameraObjectReset2
bl player_get_direction_lower_nybble
@ -4905,7 +4905,7 @@ mapldr_08085D88: @ 80B8200
push {lr}
bl sub_8085784
bl pal_fill_for_maplights
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
ldr r1, =gUnknown_03005DAC
movs r0, 0
@ -5192,7 +5192,7 @@ sub_80B8410: @ 80B8410
lsrs r0, 28
cmp r1, r0
bne _080B8484
bl script_env_2_disable
bl ScriptContext2_Disable
bl CameraObjectReset1
bl sub_809757C
ldr r0, =sub_80B8250
@ -6333,7 +6333,7 @@ sub_80B8DB4: @ 80B8DB4
mov r6, r8
push {r6}
adds r4, r0, 0
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
ldr r5, =gUnknown_02037590
movs r0, 0x1
@ -6528,7 +6528,7 @@ sub_80B8F24: @ 80B8F24
movs r1, 0x1
bl sub_81555AC
bl sub_809757C
bl script_env_2_disable
bl ScriptContext2_Disable
movs r0, 0x9
bl FieldEffectActiveListRemove
ldr r0, =sub_80B8D84

View File

@ -3452,7 +3452,7 @@ _0808C360:
sub_808C3A4: @ 808C3A4
push {r4,lr}
adds r4, r0, 0
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r1, =gUnknown_02037590
movs r0, 0x1
strb r0, [r1, 0x6]
@ -3574,7 +3574,7 @@ sub_808C484: @ 808C484
ldr r1, =gUnknown_02037590
movs r0, 0
strb r0, [r1, 0x6]
bl script_env_2_disable
bl ScriptContext2_Disable
ldr r0, =taskFF_bump_boulder
bl FindTaskIdByFunc
lsls r0, 24
@ -3752,7 +3752,7 @@ sub_808C61C: @ 808C61C
ldr r1, =gUnknown_02037590
movs r0, 0x1
strb r0, [r1, 0x6]
bl script_env_2_enable
bl ScriptContext2_Enable
movs r0, 0x2D
bl PlaySE
movs r0, 0x1
@ -3872,7 +3872,7 @@ sub_808C6FC: @ 808C6FC
lsrs r1, 24
adds r0, r5, 0
bl FieldObjectSetSpecialAnim
bl script_env_2_disable
bl ScriptContext2_Disable
ldr r1, =gUnknown_02037590
movs r0, 0
strb r0, [r1, 0x6]
@ -3895,7 +3895,7 @@ sub_808C750: @ 808C750
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl script_env_2_enable
bl ScriptContext2_Enable
bl sav1_reset_battle_music_maybe
bl sub_8085898
ldr r2, =gUnknown_02037590
@ -4008,7 +4008,7 @@ sub_808C814: @ 808C814
bl FieldObjectSetSpecialAnim
movs r0, 0
strb r0, [r6, 0x6]
bl script_env_2_disable
bl ScriptContext2_Disable
ldrb r1, [r4, 0x1A]
lsls r0, r1, 4
adds r0, r1
@ -4082,7 +4082,7 @@ _0808C8D2:
fish0: @ 808C8F8
push {r4,lr}
adds r4, r0, 0
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r1, =gUnknown_02037590
movs r0, 0x1
strb r0, [r1, 0x6]
@ -4636,7 +4636,7 @@ _0808CD58:
ldr r1, =gUnknown_02037590
movs r0, 0
strb r0, [r1, 0x6]
bl script_env_2_disable
bl ScriptContext2_Disable
ldrh r0, [r5, 0x26]
lsls r0, 24
lsrs r0, 24
@ -4857,7 +4857,7 @@ fishF: @ 808CF2C
bne _0808CF68
ldr r0, =gUnknown_02037590
strb r1, [r0, 0x6]
bl script_env_2_disable
bl ScriptContext2_Disable
bl sub_809757C
movs r0, 0
movs r1, 0x1

View File

@ -227,7 +227,7 @@ _080F9714:
ldr r0, =gScriptResult
strh r1, [r0]
_080F9718:
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r6, 0
bl DestroyTask
_080F9722:
@ -243,7 +243,7 @@ sub_80F972C: @ 80F972C
ldr r0, =sub_80F9654
movs r1, 0x50
bl CreateTask
bl script_env_2_set_ctx_paused
bl ScriptContext1_Stop
pop {r0}
bx r0
.pool

View File

@ -80,7 +80,7 @@ sub_809D908: @ 809D908
lsls r1, 3
ldr r0, =gTasks + 0x8
adds r4, r1, r0
bl script_env_2_is_enabled
bl ScriptContext2_IsEnabled
lsls r0, 24
cmp r0, 0
bne _0809D930

View File

@ -769,7 +769,7 @@ sub_80FA1D8: @ 80FA1D8
push {lr}
movs r1, 0x37
bl FieldEffectStop
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_80FA1D8
@ -942,7 +942,7 @@ sub_80FA33C: @ 80FA33C
push {lr}
movs r1, 0x38
bl FieldEffectStop
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_80FA33C
@ -1077,7 +1077,7 @@ sub_80FA448: @ 80FA448
push {lr}
movs r1, 0x39
bl FieldEffectStop
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_80FA448
@ -1195,7 +1195,7 @@ _080FA540:
bl CurrentMapDrawMetatileAt
movs r0, 0x3D
bl FieldEffectActiveListRemove
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r5, 0
bl DestroyTask
b _080FA574
@ -1801,7 +1801,7 @@ _080FAA5E:
sub_80FAA7C: @ 80FAA7C
push {r4,lr}
sub sp, 0x4
bl script_env_2_enable
bl ScriptContext2_Enable
mov r4, sp
adds r4, 0x2
mov r0, sp
@ -2012,7 +2012,7 @@ sub_80FAC68: @ 80FAC68
push {lr}
movs r1, 0x34
bl FieldEffectStop
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_80FAC68
@ -2414,7 +2414,7 @@ sub_80FAFD4: @ 80FAFD4
bl SetPlayerAvatarTransitionFlags
adds r0, r4, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r4}
pop {r0}
bx r0

View File

@ -85,7 +85,7 @@ sub_8145E74: @ 8145E74
push {lr}
movs r0, 0x28
bl FieldEffectActiveListRemove
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_8145E74

View File

@ -218,7 +218,7 @@ CleanUpAfterFailingToUseRegisteredKeyItemOnField: @ 80FD1F8
adds r0, r4, 0
bl DestroyTask
bl sub_80984F4
bl script_env_2_disable
bl ScriptContext2_Disable
pop {r4}
pop {r0}
bx r0
@ -396,7 +396,7 @@ _080FD378:
bl GetOnOffBike
_080FD37E:
bl sub_80984F4
bl script_env_2_disable
bl ScriptContext2_Disable
adds r0, r4, 0
bl DestroyTask
pop {r4}
@ -687,7 +687,7 @@ sub_80FD5CC: @ 80FD5CC
movs r1, 0x1
bl sub_8197434
bl sub_80984F4
bl script_env_2_disable
bl ScriptContext2_Disable
adds r0, r4, 0
bl DestroyTask
pop {r4}
@ -1665,7 +1665,7 @@ sub_80FDD74: @ 80FDD74
ldrh r0, [r0]
movs r1, 0x1
bl RemoveBagItem
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =gUnknown_08274482
bl ScriptContext1_SetupScript
adds r0, r4, 0
@ -1727,7 +1727,7 @@ sub_80FDE08: @ 80FDE08
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =gUnknown_082744C0
bl ScriptContext1_SetupScript
adds r0, r4, 0
@ -1786,7 +1786,7 @@ sub_80FDE7C: @ 80FDE7C
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =gUnknown_08242CFC
bl ScriptContext1_SetupScript
adds r0, r4, 0

View File

@ -652,7 +652,7 @@ sub_818DEDC: @ 818DEDC
thumb_func_start sub_818DEF4
sub_818DEF4: @ 818DEF4
push {lr}
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_818DEF4
@ -1415,7 +1415,7 @@ sub_818E538: @ 818E538
thumb_func_start sub_818E564
sub_818E564: @ 818E564
push {lr}
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_818E564

View File

@ -18888,7 +18888,7 @@ _08012ED0:
strb r0, [r6, 0xC]
b _08012F50
_08012EE6:
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r4, 0
bl DestroyTask
ldr r1, =gScriptResult
@ -18897,7 +18897,7 @@ _08012EE6:
b _08012F50
.pool
_08012EFC:
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r4, 0
bl DestroyTask
ldr r1, =gScriptResult
@ -21551,7 +21551,7 @@ _08014764:
ldrb r0, [r0]
cmp r0, 0x44
beq _0801477C
bl script_env_2_disable
bl ScriptContext2_Disable
_0801477C:
add sp, 0x4
pop {r4}
@ -21673,12 +21673,12 @@ _080148B8:
adds r0, r4, 0
bl DestroyTask
_080148C2:
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
movs r0, 0x1
strh r0, [r7]
b _080149B2
_080148CC:
bl script_env_context_is_running
bl ScriptContext1_IsScriptSetUp
lsls r0, 24
cmp r0, 0
bne _080149B2
@ -21756,7 +21756,7 @@ _08014980:
strh r0, [r7]
b _080149B2
_08014986:
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r4, 0
bl DestroyTask
b _080149B2
@ -21771,7 +21771,7 @@ _0801499C:
cmp r0, 0
bne _080149B2
bl sub_800E084
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r4, 0
bl DestroyTask
_080149B2:
@ -23529,7 +23529,7 @@ _08015A02:
strh r1, [r4]
bl _08016878
_08015A0A:
bl script_env_2_is_enabled
bl ScriptContext2_IsEnabled
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -26501,7 +26501,7 @@ sub_80173B0: @ 80173B0
thumb_func_start sub_80173D4
sub_80173D4: @ 80173D4
push {lr}
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_80173D4
@ -28285,7 +28285,7 @@ sub_801818C: @ 801818C
push {r4,lr}
adds r4, r0, 0
bl sub_80173B0
bl script_env_2_disable
bl ScriptContext2_Disable
bl sub_8098524
ldr r1, =gUnknown_02022C2C
movs r0, 0
@ -28311,7 +28311,7 @@ _080181BC:
thumb_func_start sub_80181CC
sub_80181CC: @ 80181CC
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl sub_80983E8
pop {r0}
bx r0
@ -31424,7 +31424,7 @@ sub_8019B3C: @ 8019B3C
b _08019B9E
.pool
_08019B84:
bl script_env_2_is_enabled
bl ScriptContext2_IsEnabled
lsls r0, 24
cmp r0, 0
bne _08019B96
@ -34149,7 +34149,7 @@ sub_801B1E8: @ 801B1E8
bl sub_801B330
bl sub_801B368
bl sub_801B9F8
bl killram
bl ClearRamScript
bl sub_809D4D8
bl sub_809D570
ldr r0, =gSaveBlock2Ptr
@ -48339,8 +48339,8 @@ _08022494:
bl RemoveWindow
adds r0, r4, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl script_env_2_disable
bl EnableBothScriptContexts
bl ScriptContext2_Disable
mov r0, r9
b _080224BE
_080224BA:
@ -48362,7 +48362,7 @@ _080224C0:
thumb_func_start sub_80224D0
sub_80224D0: @ 80224D0
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =sub_8022250
movs r1, 0
bl CreateTask
@ -59368,7 +59368,7 @@ _08027BC8:
bl RemoveWindow
adds r0, r4, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_08027BE2:
add sp, 0x8
pop {r4-r7}
@ -72365,7 +72365,7 @@ _0802E4DC:
bl RemoveWindow
adds r0, r4, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_0802E4F6:
add sp, 0x8
pop {r4-r7}

View File

@ -339,7 +339,7 @@ sub_8120340: @ 8120340
ldr r0, =gSpecialVar_0x8004
ldrb r0, [r0]
bl sub_81206C0
bl script_env_2_set_ctx_paused
bl ScriptContext1_Stop
pop {r0}
bx r0
.pool
@ -1231,7 +1231,7 @@ _08120A7E:
ldr r0, =gMPlay_SE2
movs r1, 0x2
bl m4aMPlayFadeOutTemporarily
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r6, 0
bl DestroyTask
b _08120B50
@ -2398,7 +2398,7 @@ _08121364:
bl sub_80E2A78
adds r0, r6, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_08121376:
pop {r4-r6}
pop {r0}

View File

@ -59,10 +59,10 @@ sub_8153820: @ 8153820
adds r5, r1, 0
ldr r1, =gUnknown_082DED2C
ldr r2, =gUnknown_082DED2C + 0x44
bl script_env_init
bl InitScriptContext
adds r0, r4, 0
adds r1, r5, 0
bl script_setup_bytecode_script
bl SetupBytecodeScript
str r5, [r4, 0x64]
movs r0, 0
str r0, [r4, 0x68]
@ -78,7 +78,7 @@ sub_8153820: @ 8153820
sub_8153850: @ 8153850
push {r4,lr}
adds r4, r0, 0
bl script_main_handler
bl RunScriptCommand
lsls r0, 24
cmp r0, 0
beq _08153868
@ -317,7 +317,7 @@ _08153A1A:
thumb_func_start script_status_stop_and_ret_1
script_status_stop_and_ret_1: @ 8153A24
push {lr}
bl script_stop
bl StopScript
movs r0, 0x1
pop {r1}
bx r1
@ -327,23 +327,23 @@ script_status_stop_and_ret_1: @ 8153A24
sub_8153A30: @ 8153A30
push {r4-r7,lr}
adds r7, r0, 0
bl script_read_word
bl ScriptReadWord
str r0, [r7, 0x68]
adds r0, r7, 0
bl script_read_halfword
bl ScriptReadHalfword
adds r5, r0, 0
lsls r5, 16
lsrs r5, 16
adds r0, r7, 0
bl script_read_word
bl ScriptReadWord
adds r6, r0, 0
adds r0, r7, 0
bl script_read_halfword
bl ScriptReadHalfword
adds r4, r0, 0
lsls r4, 16
lsrs r4, 16
adds r0, r7, 0
bl script_read_word
bl ScriptReadWord
adds r3, r0, 0
adds r0, r5, 0
adds r1, r6, 0
@ -388,7 +388,7 @@ sub_8153A94: @ 8153A94
adds r0, 0x1
str r0, [r4, 0x8]
adds r0, r4, 0
bl script_read_word
bl ScriptReadWord
ldr r1, [r4, 0x68]
subs r0, r1
ldr r1, [r4, 0x64]
@ -413,7 +413,7 @@ _08153ABE:
sub_8153ACC: @ 8153ACC
push {r4,lr}
adds r4, r0, 0
bl script_read_word
bl ScriptReadWord
ldr r1, [r4, 0x68]
subs r0, r1
ldr r1, [r4, 0x64]
@ -435,7 +435,7 @@ sub_8153AE8: @ 8153AE8
bl sub_80E162C
mov r8, r0
adds r0, r7, 0
bl script_read_word
bl ScriptReadWord
adds r4, r0, 0
ldr r0, [r7, 0x68]
subs r4, r0
@ -547,14 +547,14 @@ sub_8153BE4: @ 8153BE4
adds r1, 0x1
str r1, [r4, 0x8]
adds r0, r4, 0
bl script_read_word
bl ScriptReadWord
adds r5, r0, 0
ldr r0, [r4, 0x68]
subs r5, r0
ldr r0, [r4, 0x64]
adds r5, r0
adds r0, r4, 0
bl script_read_word
bl ScriptReadWord
adds r1, r0, 0
ldr r0, [r4, 0x68]
subs r1, r0
@ -567,7 +567,7 @@ sub_8153BE4: @ 8153BE4
adds r0, r5, 0
mov r2, r9
mov r3, r8
bl sub_80990FC
bl InitRamScript
movs r0, 0
add sp, 0x4
pop {r3,r4}
@ -626,7 +626,7 @@ sub_8153C9C: @ 8153C9C
ldrb r4, [r1]
adds r1, 0x1
str r1, [r0, 0x8]
bl script_read_halfword
bl ScriptReadHalfword
adds r2, r0, 0
lsls r2, 16
lsrs r2, 16
@ -646,7 +646,7 @@ sub_8153CC8: @ 8153CC8
push {r7}
sub sp, 0x88
adds r6, r0, 0
bl script_read_word
bl ScriptReadWord
ldr r1, [r6, 0x68]
subs r0, r1
ldr r1, [r6, 0x64]
@ -751,7 +751,7 @@ _08153DB6:
sub_8153DD4: @ 8153DD4
push {r4,lr}
adds r4, r0, 0
bl script_read_word
bl ScriptReadWord
adds r1, r0, 0
ldr r0, [r4, 0x68]
subs r1, r0
@ -797,17 +797,17 @@ sub_8153E1C: @ 8153E1C
sub_8153E40: @ 8153E40
push {r4-r6,lr}
adds r6, r0, 0
bl script_read_word
bl ScriptReadWord
adds r5, r0, 0
adds r0, r6, 0
bl script_read_word
bl ScriptReadWord
adds r4, r0, 0
ldr r0, [r6, 0x68]
subs r4, r0
ldr r0, [r6, 0x64]
adds r4, r0
adds r0, r6, 0
bl script_read_word
bl ScriptReadWord
adds r1, r0, 0
ldr r0, [r6, 0x68]
subs r1, r0
@ -833,17 +833,17 @@ _08153E7E:
sub_8153E88: @ 8153E88
push {r4-r6,lr}
adds r6, r0, 0
bl script_read_word
bl ScriptReadWord
adds r5, r0, 0
adds r0, r6, 0
bl script_read_word
bl ScriptReadWord
adds r4, r0, 0
ldr r0, [r6, 0x68]
subs r4, r0
ldr r0, [r6, 0x64]
adds r4, r0
adds r0, r6, 0
bl script_read_word
bl ScriptReadWord
adds r1, r0, 0
ldr r0, [r6, 0x68]
subs r1, r0

View File

@ -389,7 +389,7 @@ _0816B174:
b _0816B184
.pool
_0816B180:
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_0816B184:
adds r0, r4, 0
bl DestroyTask

View File

@ -246,7 +246,7 @@ sub_80FB768: @ 80FB768
ldr r0, =sub_80FB5E8
movs r1, 0x50
bl CreateTask
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
.pool

View File

@ -677,7 +677,7 @@ _080E72F8:
bl sub_8197434
adds r0, r4, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_080E730A:
pop {r4,r5}
pop {r0}

View File

@ -3015,7 +3015,7 @@ c1_overworld_normal: @ 8085DAC
adds r1, r5, 0
adds r2, r4, 0
bl process_overworld_input
bl script_env_2_is_enabled
bl ScriptContext2_IsEnabled
lsls r0, 24
cmp r0, 0
bne _08085DFA
@ -3023,7 +3023,7 @@ c1_overworld_normal: @ 8085DAC
bl sub_809C014
cmp r0, 0x1
bne _08085DF0
bl script_env_2_enable
bl ScriptContext2_Enable
bl HideMapNamePopUpWindow
b _08085DFA
_08085DF0:
@ -3059,7 +3059,7 @@ _08085E18:
@ void c2_overworld_basic()
c2_overworld_basic: @ 8085E24
push {lr}
bl script_env_2_run_current_script
bl ScriptContext2_RunScript
bl RunTasks
bl AnimateSprites
bl CameraUpdate
@ -3172,8 +3172,8 @@ CB2_NewGame: @ 8085EF8
bl NewGameInitData
bl player_avatar_init_params_reset
bl PlayTimeCounter_Start
bl script_env_1_init
bl script_env_2_disable
bl ScriptContext1_Init
bl ScriptContext2_Disable
ldr r1, =gUnknown_03005DAC
ldr r0, =sub_80FB4E0
str r0, [r1]
@ -3212,8 +3212,8 @@ c2_whiteout: @ 8085F58
bl ResetSafariZoneFlag_
bl sub_8084620
bl player_avatar_init_params_reset
bl script_env_1_init
bl script_env_2_disable
bl ScriptContext1_Init
bl ScriptContext2_Disable
ldr r1, =gUnknown_03005DAC
ldr r0, =sub_80AF3C8
str r0, [r1]
@ -3238,8 +3238,8 @@ _08085FB0:
c2_load_new_map: @ 8085FCC
push {lr}
bl sub_808631C
bl script_env_1_init
bl script_env_2_disable
bl ScriptContext1_Init
bl ScriptContext2_Disable
movs r0, 0
bl set_callback1
ldr r0, =c2_change_map
@ -3278,8 +3278,8 @@ sub_8086024: @ 8086024
cmp r0, 0
bne _08086046
bl sub_808631C
bl script_env_1_init
bl script_env_2_disable
bl ScriptContext1_Init
bl ScriptContext2_Disable
movs r0, 0
bl set_callback1
_08086046:
@ -3408,8 +3408,8 @@ _08086174:
ldr r0, =sub_80AF214
_08086178:
str r0, [r1]
bl script_env_1_init
bl script_env_2_disable
bl ScriptContext1_Init
bl ScriptContext2_Disable
bl c2_exit_to_overworld_2_switch
pop {r0}
bx r0
@ -3546,8 +3546,8 @@ _080862BA:
bl sub_8087D74
_080862BE:
bl PlayTimeCounter_Start
bl script_env_1_init
bl script_env_2_disable
bl ScriptContext1_Init
bl ScriptContext2_Disable
bl sub_8195E10
bl sav2_x1_query_bit1
cmp r0, 0x1
@ -3711,8 +3711,8 @@ _08086414:
.4byte _0808650E
_0808644C:
bl overworld_bg_setup
bl script_env_1_init
bl script_env_2_disable
bl ScriptContext1_Init
bl ScriptContext2_Disable
bl MoveSaveBlocks_ResetHeap_
bl sub_80867D8
b _08086506
@ -5170,7 +5170,7 @@ _080870A2:
sub_80870B0: @ 80870B0
push {r4,lr}
adds r4, r0, 0
bl script_env_2_is_enabled
bl ScriptContext2_IsEnabled
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -5212,7 +5212,7 @@ sub_80870EC: @ 80870EC
thumb_func_start sub_80870F8
sub_80870F8: @ 80870F8
push {r4,lr}
bl script_env_2_is_enabled
bl ScriptContext2_IsEnabled
lsls r0, 24
lsrs r0, 24
movs r4, 0x11
@ -5237,7 +5237,7 @@ sub_808711C: @ 808711C
cmp r0, 0x2
bhi _08087134
movs r4, 0x1A
bl script_env_2_disable
bl ScriptContext2_Disable
ldr r0, =sub_80870EC
bl c1_link_related_func_set
_08087134:
@ -5256,7 +5256,7 @@ sub_8087140: @ 8087140
cmp r0, 0x2
bhi _08087158
movs r4, 0x1A
bl script_env_2_disable
bl ScriptContext2_Disable
ldr r0, =sub_80870EC
bl c1_link_related_func_set
_08087158:
@ -5751,7 +5751,7 @@ _0808750A:
thumb_func_start sub_8087510
sub_8087510: @ 8087510
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
thumb_func_end sub_8087510
@ -5762,7 +5762,7 @@ sub_808751C: @ 808751C
movs r0, 0x6
bl PlaySE
bl sub_809FA9C
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
thumb_func_end sub_808751C
@ -5775,7 +5775,7 @@ sub_8087530: @ 8087530
bl PlaySE
adds r0, r4, 0
bl ScriptContext1_SetupScript
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r4}
pop {r0}
bx r0
@ -5788,7 +5788,7 @@ sub_808754C: @ 808754C
bl PlaySE
ldr r0, =gUnknown_082774EF
bl ScriptContext1_SetupScript
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
.pool
@ -5802,7 +5802,7 @@ sub_8087568: @ 8087568
bl PlaySE
adds r0, r4, 0
bl ScriptContext1_SetupScript
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r4}
pop {r0}
bx r0
@ -5813,7 +5813,7 @@ sub_8087584: @ 8087584
push {lr}
ldr r0, =gUnknown_08277509
bl ScriptContext1_SetupScript
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
.pool

View File

@ -67,7 +67,7 @@ task08_080C9820: @ 813549C
lsls r0, 24
lsrs r5, r0, 24
adds r6, r5, 0
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r1, =gUnknown_02037590
movs r0, 0x1
strb r0, [r1, 0x6]
@ -344,7 +344,7 @@ sub_8135714: @ 8135714
bl PlaySE
movs r0, 0x25
bl FieldEffectActiveListRemove
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_8135714
@ -4353,7 +4353,7 @@ sub_81379D8: @ 81379D8
lsls r0, 24
cmp r0, 0
beq _081379F2
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r4, 0
bl DestroyTask
_081379F2:
@ -4640,7 +4640,7 @@ sub_8137C28: @ 8137C28
push {lr}
ldr r0, =sub_8174194
bl SetMainCallback2
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
.pool
@ -4663,7 +4663,7 @@ sub_8137C3C: @ 8137C3C
mapldr_080CA5C0: @ 8137C5C
push {lr}
sub sp, 0x4
bl script_env_2_enable
bl ScriptContext2_Enable
bl sub_8085784
bl sp109_CreatePCMenu
bl sub_80E2514
@ -4707,7 +4707,7 @@ sub_8137CB4: @ 8137CB4
push {lr}
ldr r0, =sub_8177888
bl SetMainCallback2
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
.pool
@ -4721,7 +4721,7 @@ Special_ViewWallClock: @ 8137CC8
str r1, [r0, 0x8]
ldr r0, =Cb2_ViewWallClock
bl SetMainCallback2
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
.pool
@ -6192,7 +6192,7 @@ sub_8138910: @ 8138910
bne _08138970
adds r0, r6, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
b _08138970
.pool
_0813896C:
@ -7829,7 +7829,7 @@ sub_8139620: @ 8139620
lsls r0, 24
lsrs r0, 24
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_8139620
@ -8488,7 +8488,7 @@ sub_8139AF4: @ 8139AF4
bl PlaySE
adds r0, r5, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
bl InstallCameraPanAheadCallback
_08139B54:
pop {r4,r5}
@ -9406,7 +9406,7 @@ sub_813A2DC: @ 813A2DC
lsls r0, 3
ldr r1, =gTasks
adds r6, r0, r1
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =gUnknown_0203AB68
movs r5, 0
strh r5, [r0]
@ -9680,7 +9680,7 @@ _0813A558:
bl sub_813A738
ldr r0, =sub_813A600
str r0, [r6]
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_0813A566:
pop {r4-r6}
pop {r0}
@ -9741,7 +9741,7 @@ sub_813A570: @ 813A570
bl RemoveWindow
adds r0, r5, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
add sp, 0x4
pop {r4,r5}
pop {r0}
@ -9784,7 +9784,7 @@ sub_813A630: @ 813A630
lsrs r2, r0, 24
cmp r2, 0xFF
bne _0813A64C
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
b _0813A65C
.pool
_0813A64C:
@ -9808,7 +9808,7 @@ sub_813A664: @ 813A664
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl script_env_2_enable
bl ScriptContext2_Enable
adds r0, r4, 0
bl sub_813A694
ldr r1, =gTasks
@ -10975,7 +10975,7 @@ _0813B05C:
movs r0, 0x2
_0813B06A:
strh r0, [r1]
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_0813B070:
adds r0, r7, 0
bl DestroyTask
@ -11092,7 +11092,7 @@ sub_813B160: @ 813B160
lsls r0, 24
cmp r0, 0
bne _0813B17C
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r4, 0
bl DestroyTask
_0813B17C:
@ -11833,7 +11833,7 @@ _0813B7B4:
ldr r1, =gUnknown_0203AB70
ldr r1, [r1]
str r1, [r0]
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r4, 0
bl DestroyTask
_0813B7C6:
@ -12026,7 +12026,7 @@ _0813B8F4:
bne _0813B94E
mov r0, r9
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_0813B94E:
pop {r3-r5}
mov r8, r3

View File

@ -163,7 +163,7 @@ _080AF120:
thumb_func_start sub_80AF128
sub_80AF128: @ 80AF128
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl sub_8085784
bl pal_fill_black
ldr r0, =task0A_nop_for_a_while
@ -184,7 +184,7 @@ task0A_asap_script_env_2_enable_and_set_ctx_running: @ 80AF148
bne _080AF160
adds r0, r4, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_080AF160:
pop {r4}
pop {r0}
@ -194,7 +194,7 @@ _080AF160:
thumb_func_start sub_80AF168
sub_80AF168: @ 80AF168
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl sub_8085784
bl pal_fill_black
ldr r0, =task0A_asap_script_env_2_enable_and_set_ctx_running
@ -208,7 +208,7 @@ sub_80AF168: @ 80AF168
thumb_func_start sub_80AF188
sub_80AF188: @ 80AF188
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl pal_fill_black
ldr r0, =task0A_asap_script_env_2_enable_and_set_ctx_running
movs r1, 0xA
@ -268,7 +268,7 @@ _080AF1FC:
bl sub_80AF71C
cmp r0, 0x1
bne _080AF20E
bl script_env_2_disable
bl ScriptContext2_Disable
adds r0, r5, 0
bl DestroyTask
_080AF20E:
@ -280,7 +280,7 @@ _080AF20E:
thumb_func_start sub_80AF214
sub_80AF214: @ 80AF214
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl sub_8085784
bl palette_bg_faded_fill_black
ldr r0, =task_mpl_807DD60
@ -347,7 +347,7 @@ _080AF298:
cmp r0, 0x1
bne _080AF2AE
bl sub_8009F18
bl script_env_2_disable
bl ScriptContext2_Disable
adds r0, r5, 0
bl DestroyTask
_080AF2AE:
@ -396,7 +396,7 @@ _080AF2F2:
_080AF2FA:
bl sub_8009F18
bl sub_8086C2C
bl script_env_2_disable
bl ScriptContext2_Disable
adds r0, r5, 0
bl DestroyTask
_080AF30C:
@ -408,7 +408,7 @@ _080AF30C:
thumb_func_start sub_80AF314
sub_80AF314: @ 80AF314
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl sub_8085784
bl palette_bg_faded_fill_black
ldr r0, =sub_80AF234
@ -471,7 +471,7 @@ mapldr_default: @ 80AF398
bl sub_8085784
bl pal_fill_for_maplights
bl sub_80AF334
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
thumb_func_end mapldr_default
@ -482,7 +482,7 @@ sub_80AF3B0: @ 80AF3B0
bl sub_8085784
bl sub_80AF08C
bl sub_80AF334
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
thumb_func_end sub_80AF3B0
@ -497,7 +497,7 @@ sub_80AF3C8: @ 80AF3C8
_080AF3D6:
bl pal_fill_black
bl sub_80AF334
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
thumb_func_end sub_80AF3C8
@ -512,7 +512,7 @@ sub_80AF3E8: @ 80AF3E8
ldr r0, =task0A_mpl_807E31C
movs r1, 0xA
bl CreateTask
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
.pool
@ -528,7 +528,7 @@ sub_80AF40C: @ 80AF40C
ldr r0, =task_map_chg_seq_0807E2CC
movs r1, 0xA
bl CreateTask
bl script_env_2_enable
bl ScriptContext2_Enable
movs r0, 0xE
bl sub_8085540
pop {r0}
@ -655,7 +655,7 @@ _080AF536:
strh r0, [r5, 0x8]
b _080AF54A
_080AF540:
bl script_env_2_disable
bl ScriptContext2_Disable
adds r0, r4, 0
bl DestroyTask
_080AF54A:
@ -744,7 +744,7 @@ _080AF5EC:
strh r0, [r5, 0x8]
b _080AF60A
_080AF600:
bl script_env_2_disable
bl ScriptContext2_Disable
adds r0, r4, 0
bl DestroyTask
_080AF60A:
@ -773,7 +773,7 @@ task_map_chg_seq_0807E2CC: @ 80AF610
.pool
_080AF634:
bl player_bitmagic
bl script_env_2_enable
bl ScriptContext2_Enable
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
@ -783,7 +783,7 @@ _080AF644:
cmp r0, 0
beq _080AF65A
bl sub_809757C
bl script_env_2_disable
bl ScriptContext2_Disable
adds r0, r5, 0
bl DestroyTask
_080AF65A:
@ -819,7 +819,7 @@ sub_80AF688: @ 80AF688
ldr r0, =sub_80AF660
movs r1, 0x50
bl CreateTask
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
.pool
@ -842,7 +842,7 @@ task_mpl_807E3C8: @ 80AF6B0
bl sub_80AF71C
cmp r0, 0x1
bne _080AF6CC
bl script_env_2_disable
bl ScriptContext2_Disable
adds r0, r4, 0
bl DestroyTask
bl sub_80984F4
@ -855,7 +855,7 @@ _080AF6CC:
thumb_func_start sub_80AF6D4
sub_80AF6D4: @ 80AF6D4
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl pal_fill_black
ldr r0, =task_mpl_807E3C8
movs r1, 0xA
@ -868,7 +868,7 @@ sub_80AF6D4: @ 80AF6D4
thumb_func_start sub_80AF6F0
sub_80AF6F0: @ 80AF6F0
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl sub_8085784
bl pal_fill_black
ldr r0, =task_mpl_807E3C8
@ -908,7 +908,7 @@ _080AF730:
thumb_func_start sub_80AF734
sub_80AF734: @ 80AF734
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl music_something
bl sub_80AF0B4
bl play_some_sound
@ -928,7 +928,7 @@ sub_80AF734: @ 80AF734
thumb_func_start sp13E_warp_to_last_warp
sp13E_warp_to_last_warp: @ 80AF76C
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl music_something
bl sub_80AF0B4
bl play_some_sound
@ -946,7 +946,7 @@ sp13E_warp_to_last_warp: @ 80AF76C
thumb_func_start sub_80AF79C
sub_80AF79C: @ 80AF79C
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl music_something
movs r0, 0x3
movs r1, 0x8
@ -966,7 +966,7 @@ sub_80AF79C: @ 80AF79C
thumb_func_start sub_80AF7D0
sub_80AF7D0: @ 80AF7D0
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =gUnknown_03005DAC
ldr r1, =mapldr_default
str r1, [r0]
@ -996,7 +996,7 @@ sub_80AF80C: @ 80AF80C
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl script_env_2_enable
bl ScriptContext2_Enable
adds r0, r4, 0
movs r1, 0xA
bl sub_80B6E4C
@ -1008,7 +1008,7 @@ sub_80AF80C: @ 80AF80C
thumb_func_start sub_80AF828
sub_80AF828: @ 80AF828
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
movs r0, 0xA
bl sub_80B75D8
pop {r0}
@ -1018,7 +1018,7 @@ sub_80AF828: @ 80AF828
thumb_func_start sub_80AF838
sub_80AF838: @ 80AF838
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
movs r0, 0xA
bl sub_80B7A74
pop {r0}
@ -1028,7 +1028,7 @@ sub_80AF838: @ 80AF838
thumb_func_start sub_80AF848
sub_80AF848: @ 80AF848
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl music_something
bl sub_80AF0B4
movs r0, 0x2D
@ -1049,7 +1049,7 @@ sub_80AF87C: @ 80AF87C
push {lr}
movs r0, 0x1
bl sub_8085540
bl script_env_2_enable
bl ScriptContext2_Enable
bl save_serialize_npcs
bl music_something
bl sub_80AF0B4
@ -1069,7 +1069,7 @@ sub_80AF87C: @ 80AF87C
thumb_func_start sub_80AF8B8
sub_80AF8B8: @ 80AF8B8
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl sub_80AF0B4
ldr r0, =sub_80AFA0C
movs r1, 0xA
@ -1107,7 +1107,7 @@ _080AF908:
beq _080AF92E
b _080AF93E
_080AF90E:
bl script_env_2_enable
bl ScriptContext2_Enable
b _080AF926
_080AF914:
bl sub_80AF710
@ -1138,7 +1138,7 @@ _080AF93E:
thumb_func_start sub_80AF948
sub_80AF948: @ 80AF948
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl music_something
bl sub_80AF0B4
movs r0, 0x9
@ -1252,7 +1252,7 @@ _080AFA34:
b _080AFA7C
_080AFA3A:
bl player_bitmagic
bl script_env_2_enable
bl ScriptContext2_Enable
b _080AFA64
_080AFA44:
bl sub_80AF710
@ -1480,7 +1480,7 @@ _080AFC1C:
b _080AFC56
_080AFC22:
bl player_bitmagic
bl script_env_2_enable
bl ScriptContext2_Enable
b _080AFC3E
_080AFC2C:
bl sub_80AF710
@ -1511,7 +1511,7 @@ _080AFC56:
thumb_func_start sub_80AFC60
sub_80AFC60: @ 80AFC60
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl music_something
bl sub_80AF0B4
bl play_some_sound
@ -1932,7 +1932,7 @@ sub_80AFF90: @ 80AFF90
lsls r0, 24
cmp r0, 0
bne _080AFFAC
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r4, 0
bl DestroyTask
_080AFFAC:
@ -2088,7 +2088,7 @@ _080B00B6:
movs r1, 0x50
bl sub_80AFFDC
bl sub_80AFFB8
bl script_env_2_enable
bl ScriptContext2_Enable
add sp, 0x8
pop {r4,r5}
pop {r0}
@ -2172,7 +2172,7 @@ task0A_mpl_807E31C: @ 80B0160
.pool
_080B0184:
bl player_bitmagic
bl script_env_2_enable
bl ScriptContext2_Enable
bl sub_808D194
ldrh r0, [r4, 0x8]
adds r0, 0x1
@ -2186,7 +2186,7 @@ _080B0198:
cmp r0, 0x1
beq _080B01B6
bl sub_809757C
bl script_env_2_disable
bl ScriptContext2_Disable
adds r0, r5, 0
bl DestroyTask
_080B01B6:
@ -2223,7 +2223,7 @@ _080B01E4:
b _080B023A
_080B01EE:
bl player_bitmagic
bl script_env_2_enable
bl ScriptContext2_Enable
movs r0, 0x2D
bl PlaySE
bl sub_808D1C8
@ -2263,7 +2263,7 @@ _080B023A:
thumb_func_start sub_80B0244
sub_80B0244: @ 80B0244
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =sub_80AFA0C
movs r1, 0xA
bl CreateTask
@ -2278,7 +2278,7 @@ sub_80B0244: @ 80B0244
thumb_func_start sub_80B0268
sub_80B0268: @ 80B0268
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =gUnknown_03005DAC
ldr r1, =mapldr_default
str r1, [r0]
@ -2500,7 +2500,7 @@ _080B0450:
lsls r0, 24
cmp r0, 0
bne _080B052C
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
movs r0, 0x3
strh r0, [r5]
b _080B052C
@ -2590,7 +2590,7 @@ _080B04F2:
ldrh r1, [r5, 0x14]
movs r0, 0x4A
bl SetGpuReg
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r4, 0
bl DestroyTask
_080B052C:
@ -2688,7 +2688,7 @@ task50_0807F0C8: @ 80B05CC
bne _080B05E8
adds r0, r4, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_080B05E8:
pop {r4}
pop {r0}

View File

@ -564,8 +564,8 @@ _080C73D0:
lsrs r0, 24
movs r1, 0x1
bl sub_819746C
bl script_env_2_disable
bl script_env_2_enable_and_set_ctx_running
bl ScriptContext2_Disable
bl EnableBothScriptContexts
ldrh r0, [r5, 0x26]
lsls r0, 24
lsrs r0, 24
@ -769,7 +769,7 @@ sub_80C7578: @ 80C7578
movs r0, 0
strh r0, [r1, 0x8]
strh r0, [r1, 0xA]
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
.pool
@ -25376,7 +25376,7 @@ _080D41D4:
movs r0, 0
str r0, [r6]
bl sub_80984F4
bl script_env_2_disable
bl ScriptContext2_Disable
bl unown_chamber_related
lsls r0, 24
lsrs r0, 24
@ -25537,7 +25537,7 @@ sub_80D4354: @ 80D4354
bl PlaySE
movs r0, 0x2
bl FieldEffectActiveListRemove
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_80D4354

View File

@ -12499,7 +12499,7 @@ sub_8160624: @ 8160624
sub_8160638: @ 8160638
push {lr}
sub sp, 0x4
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =sub_8160664
movs r1, 0xA
bl CreateTask

View File

@ -13886,7 +13886,7 @@ task_prev_quest: @ 81960A8
ldrb r0, [r0, 0x7]
cmp r0, 0
bne _081960C2
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
bl sub_808B864
bl sub_808BCF4
@ -14297,7 +14297,7 @@ sub_81963F0: @ 81963F0
bl FieldObjectClearAnimIfSpecialAnimFinished
bl sub_80D338C
bl sub_809757C
bl script_env_2_disable
bl ScriptContext2_Disable
_08196446:
movs r0, 0x1
b _08196456
@ -32722,7 +32722,7 @@ _0819F9DC:
thumb_func_start sub_819FA50
sub_819FA50: @ 819FA50
push {lr}
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_819FA50
@ -34416,7 +34416,7 @@ _081A0768:
bl sub_81A07E8
adds r0, r5, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_081A0778:
pop {r4,r5}
pop {r0}
@ -34801,12 +34801,12 @@ sub_81A0A34: @ 81A0A34
ldrh r0, [r0]
cmp r0, 0
beq _081A0A64
ldr r0, =script_env_2_enable_and_set_ctx_running
ldr r0, =EnableBothScriptContexts
bl sub_81A172C
b _081A0A68
.pool
_081A0A64:
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_081A0A68:
pop {r4}
pop {r0}
@ -35033,7 +35033,7 @@ _081A0C66:
b _081A0C7A
.pool
_081A0C74:
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
b _081A0C8E
_081A0C7A:
ldr r0, =gStringVar4
@ -35052,7 +35052,7 @@ _081A0C8E:
thumb_func_start sub_81A0C9C
sub_81A0C9C: @ 81A0C9C
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
bl sub_808B864
bl sub_808BCF4
@ -48555,7 +48555,7 @@ _081A7F1C:
lsls r0, 24
cmp r0, 0
beq _081A7F30
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r4, 0
bl DestroyTask
_081A7F30:
@ -58748,7 +58748,7 @@ _081AD550:
lsrs r6, r0, 24
cmp r6, 0x1
bne _081AD5C4
bl script_env_2_enable
bl ScriptContext2_Enable
bl player_bitmagic
bl sub_808B864
bl sub_808BCF4
@ -81419,8 +81419,8 @@ task_hm_without_phase_2: @ 81B93E0
beq _081B93FE
adds r0, r4, 0
bl DestroyTask
bl script_env_2_disable
bl script_env_2_enable_and_set_ctx_running
bl ScriptContext2_Disable
bl EnableBothScriptContexts
_081B93FE:
pop {r4}
pop {r0}
@ -81430,7 +81430,7 @@ _081B93FE:
thumb_func_start sub_81B9404
sub_81B9404: @ 81B9404
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
movs r0, 0x1
movs r1, 0
bl fade_screen
@ -81506,7 +81506,7 @@ _081B9486:
thumb_func_start sub_81B94B0
sub_81B94B0: @ 81B94B0
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
movs r0, 0x1
movs r1, 0
bl fade_screen
@ -81556,7 +81556,7 @@ _081B9508:
thumb_func_start sub_81B951C
sub_81B951C: @ 81B951C
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
movs r0, 0x1
movs r1, 0
bl fade_screen
@ -81677,7 +81677,7 @@ _081B9614:
thumb_func_start sub_81B9620
sub_81B9620: @ 81B9620
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
movs r0, 0x1
movs r1, 0
bl fade_screen

View File

@ -266,7 +266,7 @@ sub_81BE808: @ 81BE808
blt _081BE882
adds r0, r5, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_081BE882:
add sp, 0x4
pop {r4,r5}
@ -459,7 +459,7 @@ sub_81BEA00: @ 81BEA00
bl FreeSpriteTilesByTag
adds r0, r4, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r4}
pop {r0}
bx r0
@ -839,7 +839,7 @@ _081BED1C:
bl CreateTask
adds r0, r5, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_081BED40:
add sp, 0xC
pop {r4,r5}
@ -1159,7 +1159,7 @@ _081BEFF0:
_081BEFF8:
mov r0, r10
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_081BF002:
ldr r0, =gTasks
mov r2, r10
@ -1404,7 +1404,7 @@ _081BF1CC:
b _081BF228
.pool
_081BF224:
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_081BF228:
ldr r0, =gTasks
lsls r1, r7, 2
@ -12035,7 +12035,7 @@ sub_81C4F10: @ 81C4F10
thumb_func_start sub_81C4F24
sub_81C4F24: @ 81C4F24
push {lr}
bl script_env_2_enable
bl ScriptContext2_Enable
movs r0, 0x1
movs r1, 0
bl fade_screen

View File

@ -4590,7 +4590,7 @@ sub_814297C: @ 814297C
movs r1, 0
bl sub_819746C
bl HideCoinsWindow
bl script_env_2_disable
bl ScriptContext2_Disable
adds r0, r4, 0
bl DestroyTask
pop {r4}
@ -4624,7 +4624,7 @@ sub_81429A0: @ 81429A0
movs r0, 0
movs r1, 0x1
bl sub_819746C
bl script_env_2_disable
bl ScriptContext2_Disable
adds r0, r4, 0
bl DestroyTask
_081429DE:
@ -4829,7 +4829,7 @@ _08142BB0:
thumb_func_start sub_8142BC8
sub_8142BC8: @ 8142BC8
push {r4,lr}
bl script_env_2_enable
bl ScriptContext2_Enable
bl GetCoins
lsls r0, 16
lsrs r0, 16

File diff suppressed because it is too large Load Diff

View File

@ -1,879 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start script_env_init
@ void script_env_init(script_env *env, int a2, int a3)
script_env_init: @ 8098CB8
push {lr}
adds r3, r0, 0
movs r0, 0
strb r0, [r3, 0x1]
str r0, [r3, 0x8]
strb r0, [r3]
str r0, [r3, 0x4]
str r1, [r3, 0x5C]
str r2, [r3, 0x60]
movs r2, 0
movs r1, 0x3
adds r0, r3, 0
adds r0, 0x70
_08098CD2:
str r2, [r0]
subs r0, 0x4
subs r1, 0x1
cmp r1, 0
bge _08098CD2
adds r1, r3, 0
adds r1, 0xC
movs r2, 0
adds r0, r3, 0
adds r0, 0x58
_08098CE6:
str r2, [r0]
subs r0, 0x4
cmp r0, r1
bge _08098CE6
pop {r0}
bx r0
thumb_func_end script_env_init
thumb_func_start script_setup_bytecode_script
@ int script_setup_bytecode_script(script_env *env, void *script_ptr)
script_setup_bytecode_script: @ 8098CF4
str r1, [r0, 0x8]
movs r1, 0x1
strb r1, [r0, 0x1]
movs r0, 0x1
bx lr
thumb_func_end script_setup_bytecode_script
thumb_func_start script_setup_asm_script
script_setup_asm_script: @ 8098D00
movs r2, 0x2
strb r2, [r0, 0x1]
str r1, [r0, 0x4]
bx lr
thumb_func_end script_setup_asm_script
thumb_func_start script_stop
@ void script_stop(script_env *env)
script_stop: @ 8098D08
movs r1, 0
strb r1, [r0, 0x1]
str r1, [r0, 0x8]
bx lr
thumb_func_end script_stop
thumb_func_start script_main_handler
@ int script_main_handler(script_env *env)
script_main_handler: @ 8098D10
push {r4,lr}
adds r4, r0, 0
ldrb r0, [r4, 0x1]
cmp r0, 0
bne _08098D1E
_08098D1A:
movs r0, 0
b _08098D90
_08098D1E:
ldrb r0, [r4, 0x1]
cmp r0, 0x1
beq _08098D56
cmp r0, 0x1
bgt _08098D2E
cmp r0, 0
beq _08098D1A
b _08098D8E
_08098D2E:
cmp r0, 0x2
bne _08098D8E
ldr r0, [r4, 0x4]
cmp r0, 0
beq _08098D52
bl _call_via_r0
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _08098D8E
strb r0, [r4, 0x1]
b _08098D8E
_08098D48:
strb r2, [r4, 0x1]
b _08098D1A
_08098D4C:
movs r0, 0
strb r0, [r4, 0x1]
b _08098D90
_08098D52:
movs r0, 0x1
strb r0, [r4, 0x1]
_08098D56:
ldr r2, [r4, 0x8]
cmp r2, 0
beq _08098D48
ldr r0, =gUnknown_085102BC
ldr r0, [r0]
cmp r2, r0
bne _08098D6C
_08098D64:
swi 0x2
b _08098D64
.pool
_08098D6C:
ldrb r1, [r2]
adds r0, r2, 0x1
str r0, [r4, 0x8]
lsls r1, 2
ldr r0, [r4, 0x5C]
adds r1, r0, r1
ldr r0, [r4, 0x60]
cmp r1, r0
bcs _08098D4C
ldr r1, [r1]
adds r0, r4, 0
bl _call_via_r1
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _08098D56
_08098D8E:
movs r0, 0x1
_08098D90:
pop {r4}
pop {r1}
bx r1
thumb_func_end script_main_handler
thumb_func_start script_stack_push
@ int script_stack_push(script_env *env, int value)
script_stack_push: @ 8098D98
push {lr}
adds r2, r0, 0
adds r3, r1, 0
ldrb r1, [r2]
adds r0, r1, 0x1
cmp r0, 0x13
bgt _08098DBA
lsls r0, r1, 2
adds r1, r2, 0
adds r1, 0xC
adds r1, r0
str r3, [r1]
ldrb r0, [r2]
adds r0, 0x1
strb r0, [r2]
movs r0, 0
b _08098DBC
_08098DBA:
movs r0, 0x1
_08098DBC:
pop {r1}
bx r1
thumb_func_end script_stack_push
thumb_func_start script_stack_pop
@ int script_stack_pop(script_env *env)
script_stack_pop: @ 8098DC0
push {lr}
adds r2, r0, 0
ldrb r0, [r2]
cmp r0, 0
beq _08098DDC
subs r0, 0x1
strb r0, [r2]
ldrb r1, [r2]
lsls r1, 2
adds r0, r2, 0
adds r0, 0xC
adds r0, r1
ldr r0, [r0]
b _08098DDE
_08098DDC:
movs r0, 0
_08098DDE:
pop {r1}
bx r1
thumb_func_end script_stack_pop
thumb_func_start script_jump
@ void script_jump(script_env *env, int address)
script_jump: @ 8098DE4
str r1, [r0, 0x8]
bx lr
thumb_func_end script_jump
thumb_func_start script_call
@ void script_call(script_env *env, int address)
script_call: @ 8098DE8
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
ldr r1, [r4, 0x8]
bl script_stack_push
str r5, [r4, 0x8]
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end script_call
thumb_func_start script_return
@ void script_return(script_env *env)
script_return: @ 8098DFC
push {r4,lr}
adds r4, r0, 0
bl script_stack_pop
str r0, [r4, 0x8]
pop {r4}
pop {r0}
bx r0
thumb_func_end script_return
thumb_func_start script_read_halfword
@ int script_read_halfword(script_env *env)
script_read_halfword: @ 8098E0C
adds r3, r0, 0
ldr r2, [r3, 0x8]
ldrb r0, [r2]
adds r2, 0x1
str r2, [r3, 0x8]
ldrb r1, [r2]
lsls r1, 8
orrs r0, r1
adds r2, 0x1
str r2, [r3, 0x8]
bx lr
thumb_func_end script_read_halfword
thumb_func_start script_read_word
@ int script_read_word(script_env *env)
script_read_word: @ 8098E24
push {r4-r6,lr}
adds r3, r0, 0
ldr r0, [r3, 0x8]
ldrb r6, [r0]
adds r0, 0x1
str r0, [r3, 0x8]
ldrb r5, [r0]
adds r2, r0, 0x1
str r2, [r3, 0x8]
ldrb r4, [r0, 0x1]
adds r1, r2, 0x1
str r1, [r3, 0x8]
ldrb r0, [r2, 0x1]
adds r1, 0x1
str r1, [r3, 0x8]
lsls r0, 8
adds r0, r4
lsls r0, 8
adds r0, r5
lsls r0, 8
adds r0, r6
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end script_read_word
thumb_func_start script_env_2_enable
script_env_2_enable: @ 8098E54
ldr r1, =gUnknown_03000F2C
movs r0, 0x1
strb r0, [r1]
bx lr
.pool
thumb_func_end script_env_2_enable
thumb_func_start script_env_2_disable
@ void script_env_2_disable()
script_env_2_disable: @ 8098E60
ldr r1, =gUnknown_03000F2C
movs r0, 0
strb r0, [r1]
bx lr
.pool
thumb_func_end script_env_2_disable
thumb_func_start script_env_2_is_enabled
@ int script_env_2_is_enabled()
script_env_2_is_enabled: @ 8098E6C
ldr r0, =gUnknown_03000F2C
ldrb r0, [r0]
bx lr
.pool
thumb_func_end script_env_2_is_enabled
thumb_func_start script_env_context_is_running
@ int script_env_context_is_running()
script_env_context_is_running: @ 8098E78
push {lr}
ldr r0, =gUnknown_03000E38
ldrb r0, [r0]
cmp r0, 0
beq _08098E8C
movs r0, 0
b _08098E8E
.pool
_08098E8C:
movs r0, 0x1
_08098E8E:
pop {r1}
bx r1
thumb_func_end script_env_context_is_running
thumb_func_start script_env_1_init
script_env_1_init: @ 8098E94
push {lr}
ldr r0, =gUnknown_03000E40
ldr r1, =gEventScriptCommandFunctionTable
ldr r2, =gUnknown_081DBA08
bl script_env_init
ldr r1, =gUnknown_03000E38
movs r0, 0x2
strb r0, [r1]
pop {r0}
bx r0
.pool
thumb_func_end script_env_1_init
thumb_func_start script_env_2_run_current_script
script_env_2_run_current_script: @ 8098EBC
push {r4,lr}
ldr r4, =gUnknown_03000E38
ldrb r0, [r4]
cmp r0, 0x2
beq _08098EF0
cmp r0, 0x1
beq _08098EF0
bl script_env_2_enable
ldr r0, =gUnknown_03000E40
bl script_main_handler
lsls r0, 24
cmp r0, 0
beq _08098EE8
movs r0, 0x1
b _08098EF2
.pool
_08098EE8:
movs r0, 0x2
strb r0, [r4]
bl script_env_2_disable
_08098EF0:
movs r0, 0
_08098EF2:
pop {r4}
pop {r1}
bx r1
thumb_func_end script_env_2_run_current_script
thumb_func_start ScriptContext1_SetupScript
ScriptContext1_SetupScript: @ 8098EF8
push {r4,r5,lr}
adds r5, r0, 0
ldr r4, =gUnknown_03000E40
ldr r1, =gEventScriptCommandFunctionTable
ldr r2, =gUnknown_081DBA08
adds r0, r4, 0
bl script_env_init
adds r0, r4, 0
adds r1, r5, 0
bl script_setup_bytecode_script
bl script_env_2_enable
ldr r1, =gUnknown_03000E38
movs r0, 0
strb r0, [r1]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end ScriptContext1_SetupScript
thumb_func_start script_env_2_set_ctx_paused
script_env_2_set_ctx_paused: @ 8098F30
ldr r1, =gUnknown_03000E38
movs r0, 0x1
strb r0, [r1]
bx lr
.pool
thumb_func_end script_env_2_set_ctx_paused
thumb_func_start script_env_2_enable_and_set_ctx_running
script_env_2_enable_and_set_ctx_running: @ 8098F3C
push {lr}
ldr r1, =gUnknown_03000E38
movs r0, 0
strb r0, [r1]
bl script_env_2_enable
pop {r0}
bx r0
.pool
thumb_func_end script_env_2_enable_and_set_ctx_running
thumb_func_start ScriptContext2_RunNewScript
@ void ScriptContext2_RunNewScript(void *script_ptr)
ScriptContext2_RunNewScript: @ 8098F50
push {r4,r5,lr}
adds r5, r0, 0
ldr r4, =gUnknown_03000EB8
ldr r1, =gEventScriptCommandFunctionTable
ldr r2, =gUnknown_081DBA08
adds r0, r4, 0
bl script_env_init
adds r0, r4, 0
adds r1, r5, 0
bl script_setup_bytecode_script
_08098F68:
ldr r0, =gUnknown_03000EB8
bl script_main_handler
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _08098F68
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end ScriptContext2_RunNewScript
thumb_func_start mapheader_get_tagged_pointer
mapheader_get_tagged_pointer: @ 8098F88
push {lr}
lsls r0, 24
lsrs r1, r0, 24
ldr r0, =gMapHeader
ldr r2, [r0, 0x8]
cmp r2, 0
beq _08098F9C
_08098F96:
ldrb r0, [r2]
cmp r0, 0
bne _08098FA4
_08098F9C:
movs r0, 0
b _08098FC2
.pool
_08098FA4:
cmp r0, r1
beq _08098FAC
adds r2, 0x5
b _08098F96
_08098FAC:
adds r2, 0x1
ldrb r0, [r2]
ldrb r1, [r2, 0x1]
lsls r1, 8
adds r0, r1
ldrb r1, [r2, 0x2]
lsls r1, 16
adds r0, r1
ldrb r1, [r2, 0x3]
lsls r1, 24
adds r0, r1
_08098FC2:
pop {r1}
bx r1
thumb_func_end mapheader_get_tagged_pointer
thumb_func_start mapheader_run_script_by_tag
mapheader_run_script_by_tag: @ 8098FC8
push {lr}
lsls r0, 24
lsrs r0, 24
bl mapheader_get_tagged_pointer
cmp r0, 0
beq _08098FDA
bl ScriptContext2_RunNewScript
_08098FDA:
pop {r0}
bx r0
thumb_func_end mapheader_run_script_by_tag
thumb_func_start mapheader_get_first_match_from_tagged_ptr_list
@ int mapheader_get_first_match_from_tagged_ptr_list(int tag)
mapheader_get_first_match_from_tagged_ptr_list: @ 8098FE0
push {r4-r6,lr}
lsls r0, 24
lsrs r0, 24
bl mapheader_get_tagged_pointer
adds r6, r0, 0
cmp r6, 0
beq _08098FFC
_08098FF0:
ldrb r1, [r6]
ldrb r0, [r6, 0x1]
lsls r0, 8
orrs r1, r0
cmp r1, 0
bne _08099000
_08098FFC:
movs r0, 0
b _0809903A
_08099000:
adds r6, 0x2
ldrb r5, [r6]
ldrb r0, [r6, 0x1]
lsls r0, 8
orrs r5, r0
adds r6, 0x2
adds r0, r1, 0
bl VarGet
adds r4, r0, 0
adds r0, r5, 0
bl VarGet
lsls r4, 16
lsls r0, 16
cmp r4, r0
beq _08099026
adds r6, 0x4
b _08098FF0
_08099026:
ldrb r0, [r6]
ldrb r1, [r6, 0x1]
lsls r1, 8
adds r0, r1
ldrb r1, [r6, 0x2]
lsls r1, 16
adds r0, r1
ldrb r1, [r6, 0x3]
lsls r1, 24
adds r0, r1
_0809903A:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end mapheader_get_first_match_from_tagged_ptr_list
thumb_func_start mapheader_run_script_with_tag_x1
mapheader_run_script_with_tag_x1: @ 8099040
push {lr}
movs r0, 0x1
bl mapheader_run_script_by_tag
pop {r0}
bx r0
thumb_func_end mapheader_run_script_with_tag_x1
thumb_func_start mapheader_run_script_with_tag_x3
mapheader_run_script_with_tag_x3: @ 809904C
push {lr}
movs r0, 0x3
bl mapheader_run_script_by_tag
pop {r0}
bx r0
thumb_func_end mapheader_run_script_with_tag_x3
thumb_func_start mapheader_run_script_with_tag_x5
mapheader_run_script_with_tag_x5: @ 8099058
push {lr}
movs r0, 0x5
bl mapheader_run_script_by_tag
pop {r0}
bx r0
thumb_func_end mapheader_run_script_with_tag_x5
thumb_func_start mapheader_run_script_with_tag_x7
mapheader_run_script_with_tag_x7: @ 8099064
push {lr}
movs r0, 0x7
bl mapheader_run_script_by_tag
pop {r0}
bx r0
thumb_func_end mapheader_run_script_with_tag_x7
thumb_func_start mapheader_run_script_with_tag_x6
mapheader_run_script_with_tag_x6: @ 8099070
push {lr}
movs r0, 0x6
bl mapheader_run_script_by_tag
pop {r0}
bx r0
thumb_func_end mapheader_run_script_with_tag_x6
thumb_func_start mapheader_run_first_tag2_script_list_match
@ int mapheader_run_first_tag2_script_list_match()
mapheader_run_first_tag2_script_list_match: @ 809907C
push {lr}
movs r0, 0x2
bl mapheader_get_first_match_from_tagged_ptr_list
cmp r0, 0
beq _08099090
bl ScriptContext1_SetupScript
movs r0, 0x1
b _08099092
_08099090:
movs r0, 0
_08099092:
pop {r1}
bx r1
thumb_func_end mapheader_run_first_tag2_script_list_match
thumb_func_start mapheader_run_first_tag4_script_list_match
@ void mapheader_run_first_tag4_script_list_match()
mapheader_run_first_tag4_script_list_match: @ 8099098
push {lr}
movs r0, 0x4
bl mapheader_get_first_match_from_tagged_ptr_list
cmp r0, 0
beq _080990A8
bl ScriptContext2_RunNewScript
_080990A8:
pop {r0}
bx r0
thumb_func_end mapheader_run_first_tag4_script_list_match
thumb_func_start sub_80990AC
sub_80990AC: @ 80990AC
push {lr}
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldr r1, =0x0000372c
adds r0, r1
movs r1, 0xFA
lsls r1, 2
bl CalcCRC16WithTable
lsls r0, 16
lsrs r0, 16
pop {r1}
bx r1
.pool
thumb_func_end sub_80990AC
thumb_func_start killram
killram: @ 80990D0
push {lr}
sub sp, 0x4
movs r0, 0
str r0, [sp]
ldr r0, =gSaveBlock1Ptr
ldr r1, [r0]
ldr r0, =0x00003728
adds r1, r0
ldr r2, =0x050000fb
mov r0, sp
bl CpuSet
add sp, 0x4
pop {r0}
bx r0
.pool
thumb_func_end killram
thumb_func_start sub_80990FC
sub_80990FC: @ 80990FC
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x4
str r0, [sp]
ldr r0, [sp, 0x24]
lsls r1, 16
lsrs r1, 16
mov r8, r1
lsls r2, 24
lsrs r2, 24
mov r9, r2
lsls r3, 24
lsrs r7, r3, 24
lsls r0, 24
lsrs r6, r0, 24
ldr r0, =gSaveBlock1Ptr
mov r10, r0
ldr r5, [r0]
ldr r1, =0x0000372c
adds r4, r5, r1
bl killram
ldr r0, =0x000003e3
cmp r8, r0
bhi _08099174
movs r0, 0x33
strb r0, [r4]
mov r2, r9
strb r2, [r4, 0x1]
strb r7, [r4, 0x2]
strb r6, [r4, 0x3]
ldr r1, =0x00003730
adds r0, r5, r1
ldr r1, [sp]
mov r2, r8
bl memcpy
bl sub_80990AC
mov r2, r10
ldr r1, [r2]
ldr r2, =0x00003728
adds r1, r2
str r0, [r1]
movs r0, 0x1
b _08099176
.pool
_08099174:
movs r0, 0
_08099176:
add sp, 0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_80990FC
thumb_func_start sub_8099188
@ u32 sub_8099188(u8 a1, u32 script)
sub_8099188: @ 8099188
push {r4-r7,lr}
adds r4, r1, 0
lsls r0, 24
lsrs r3, r0, 24
ldr r6, =gSaveBlock1Ptr
ldr r5, [r6]
ldr r0, =0x0000372c
adds r2, r5, r0
ldr r7, =gUnknown_020375C0
movs r0, 0
str r0, [r7]
ldrb r0, [r2]
cmp r0, 0x33
bne _080991F0
ldrb r1, [r2, 0x1]
movs r0, 0x4
ldrsb r0, [r5, r0]
cmp r1, r0
bne _080991F0
ldrb r1, [r2, 0x2]
movs r0, 0x5
ldrsb r0, [r5, r0]
cmp r1, r0
bne _080991F0
ldrb r0, [r2, 0x3]
cmp r0, r3
bne _080991F0
bl sub_80990AC
ldr r1, [r6]
ldr r2, =0x00003728
adds r1, r2
ldr r1, [r1]
cmp r0, r1
bne _080991EC
str r4, [r7]
ldr r1, =0x00003730
adds r0, r5, r1
b _080991F2
.pool
_080991EC:
bl killram
_080991F0:
adds r0, r4, 0
_080991F2:
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_8099188
thumb_func_start sub_80991F8
sub_80991F8: @ 80991F8
push {r4,lr}
ldr r4, =gSaveBlock1Ptr
ldr r0, [r4]
ldr r2, =0x0000372c
adds r1, r0, r2
ldrb r0, [r1]
cmp r0, 0x33
bne _0809923C
ldrb r0, [r1, 0x1]
cmp r0, 0xFF
bne _0809923C
ldrb r0, [r1, 0x2]
cmp r0, 0xFF
bne _0809923C
ldrb r0, [r1, 0x3]
cmp r0, 0xFF
bne _0809923C
bl sub_80990AC
ldr r1, [r4]
ldr r2, =0x00003728
adds r1, r2
ldr r1, [r1]
cmp r0, r1
bne _0809923C
movs r0, 0x1
b _0809923E
.pool
_0809923C:
movs r0, 0
_0809923E:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_80991F8
thumb_func_start sub_8099244
sub_8099244: @ 8099244
push {r4-r6,lr}
ldr r6, =gSaveBlock1Ptr
ldr r5, [r6]
ldr r0, =0x0000372c
adds r4, r5, r0
bl sub_801B27C
cmp r0, 0
beq _08099298
ldrb r0, [r4]
cmp r0, 0x33
bne _08099298
ldrb r0, [r4, 0x1]
cmp r0, 0xFF
bne _08099298
ldrb r0, [r4, 0x2]
cmp r0, 0xFF
bne _08099298
ldrb r0, [r4, 0x3]
cmp r0, 0xFF
bne _08099298
bl sub_80990AC
ldr r1, [r6]
ldr r2, =0x00003728
adds r1, r2
ldr r1, [r1]
cmp r0, r1
bne _08099294
ldr r1, =0x00003730
adds r0, r5, r1
b _0809929A
.pool
_08099294:
bl killram
_08099298:
movs r0, 0
_0809929A:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_8099244
thumb_func_start sub_80992A0
sub_80992A0: @ 80992A0
push {lr}
sub sp, 0x4
adds r2, r0, 0
lsls r1, 16
lsrs r1, 16
ldr r0, =0x000003e3
cmp r1, r0
bls _080992B2
adds r1, r0, 0
_080992B2:
movs r0, 0xFF
str r0, [sp]
adds r0, r2, 0
movs r2, 0xFF
movs r3, 0xFF
bl sub_80990FC
add sp, 0x4
pop {r0}
bx r0
.pool
thumb_func_end sub_80992A0
.align 2, 0 @ Don't pad with nop.

View File

@ -371,7 +371,7 @@ _080E20EC:
bl sub_80E2A78
adds r0, r6, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_080E20FC:
pop {r4-r6}
pop {r0}
@ -477,7 +477,7 @@ _080E21B8:
_080E21BA:
adds r0, r4, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_080E21C4:
pop {r4}
pop {r0}
@ -668,7 +668,7 @@ _080E2350:
bl sub_80E2A78
adds r0, r4, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_080E2360:
pop {r4,r5}
pop {r0}

View File

@ -1063,7 +1063,7 @@ sub_80F9088: @ 80F9088
lsrs r0, 24
cmp r0, 0x1
bne _080F90D4
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r5, 0
bl DestroyTask
b _080F90D4

View File

@ -765,7 +765,7 @@ sub_80E90C8: @ 80E90C8
lsrs r0, 24
cmp r0, 0x1
bne _080E90F8
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r4, 0
bl DestroyTask
_080E90F8:
@ -779,7 +779,7 @@ _080E90F8:
sub_80E9108: @ 80E9108
push {r4,lr}
sub sp, 0x4
bl script_env_2_enable
bl ScriptContext2_Enable
bl HideMapNamePopUpWindow
mov r4, sp
adds r4, 0x2
@ -1467,7 +1467,7 @@ _080E96CC:
beq _080E96F4
b _080E9714
_080E96D2:
bl script_env_2_enable
bl ScriptContext2_Enable
movs r0, 0x1
strh r0, [r4, 0x8]
b _080E9714
@ -1491,7 +1491,7 @@ _080E96F4:
str r1, [r0]
ldr r0, =c2_load_new_map
bl SetMainCallback2
bl script_env_2_disable
bl ScriptContext2_Disable
adds r0, r5, 0
bl DestroyTask
_080E9714:
@ -2171,7 +2171,7 @@ sub_80E9C9C: @ 80E9C9C
ldr r0, =gTasks + 0x8
mov r8, r0
adds r5, r7, r0
bl script_env_2_enable
bl ScriptContext2_Enable
bl sub_80E9BA8
lsls r0, 24
lsrs r0, 24

View File

@ -13,7 +13,7 @@ CreateShopMenu: @ 80DFA78
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r5, =gUnknown_02039F60
strb r4, [r5, 0xF]
cmp r4, 0
@ -251,7 +251,7 @@ HandleShopMenuQuit: @ 80DFC68
ldrb r0, [r5, 0xE]
bl RemoveWindow
bl SaveRecordedItemPurchasesForTVShow
bl script_env_2_disable
bl ScriptContext2_Disable
adds r0, r4, 0
bl DestroyTask
ldr r5, [r5]
@ -2812,7 +2812,7 @@ CreatePokemartMenu: @ 80E1284
adds r0, r4, 0
bl SetShopItemsForSale
bl ClearItemPurchases
ldr r0, =script_env_2_enable_and_set_ctx_running
ldr r0, =EnableBothScriptContexts
bl SetShopMenuCallback
pop {r4}
pop {r0}
@ -2829,7 +2829,7 @@ CreateDecorationShop1Menu: @ 80E12A8
bl CreateShopMenu
adds r0, r4, 0
bl SetShopItemsForSale
ldr r0, =script_env_2_enable_and_set_ctx_running
ldr r0, =EnableBothScriptContexts
bl SetShopMenuCallback
pop {r4}
pop {r0}
@ -2846,7 +2846,7 @@ CreateDecorationShop2Menu: @ 80E12C8
bl CreateShopMenu
adds r0, r4, 0
bl SetShopItemsForSale
ldr r0, =script_env_2_enable_and_set_ctx_running
ldr r0, =EnableBothScriptContexts
bl SetShopMenuCallback
pop {r4}
pop {r0}

View File

@ -362,7 +362,7 @@ sub_809FA9C: @ 809FA9C
_0809FAB2:
ldr r0, =sub_809FA34
bl sub_809F9D0
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
.pool
@ -731,7 +731,7 @@ sub_809FDD4: @ 809FDD4
bl sub_80984F4
ldr r0, =sub_809FA34
bl sub_809F9D0
bl script_env_2_enable
bl ScriptContext2_Enable
pop {r0}
bx r0
.pool
@ -805,7 +805,7 @@ _0809FE7C:
movs r1, 0x1
bl sub_8197DF8
bl sub_80984F4
bl script_env_2_disable
bl ScriptContext2_Disable
bl sub_81A9EC8
movs r0, 0x1
b _0809FE96
@ -867,7 +867,7 @@ _0809FF00:
movs r1, 0x1
bl sub_8197DF8
bl sub_80984F4
bl script_env_2_disable
bl ScriptContext2_Disable
ldr r0, =gUnknown_08252C88
bl ScriptContext1_SetupScript
movs r0, 0x1
@ -985,7 +985,7 @@ _0809FFFC:
_080A0000:
adds r0, r4, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_080A000A:
pop {r4}
pop {r0}
@ -2022,7 +2022,7 @@ sub_80A08A4: @ 80A08A4
bne _080A08C0
adds r0, r4, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
_080A08C0:
pop {r4}
pop {r0}
@ -2072,7 +2072,7 @@ sub_80A0914: @ 80A0914
bl sub_819746C
bl remove_start_menu_window_maybe
bl sub_80984F4
bl script_env_2_disable
bl ScriptContext2_Disable
pop {r0}
bx r0
thumb_func_end sub_80A0914

View File

@ -14165,7 +14165,7 @@ _0807F0BE:
sub_807F0E4: @ 807F0E4
push {lr}
sub sp, 0x4
bl script_env_2_enable
bl ScriptContext2_Enable
ldr r0, =sub_807F110
movs r1, 0xA
bl CreateTask

View File

@ -257,7 +257,7 @@ _08133C18:
bl schedule_bg_copy_tilemap_to_vram
adds r0, r5, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r4,r5}
pop {r0}
bx r0
@ -468,7 +468,7 @@ _08133DFC:
_08133E04:
adds r0, r6, 0
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r4-r6}
pop {r0}
bx r0
@ -484,7 +484,7 @@ sub_8133E1C: @ 8133E1C
movs r1, 0
strh r1, [r2]
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r0}
bx r0
.pool

View File

@ -1282,7 +1282,7 @@ sub_80B45BC: @ 80B45BC
lsls r0, 24
lsrs r0, 24
bl DestroyTask
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_80B45BC

View File

@ -503,7 +503,7 @@ _080FB492:
bl PlaySE
adds r0, r5, 0
bl DestroyTask
bl script_env_2_disable
bl ScriptContext2_Disable
_080FB4D8:
pop {r4,r5}
pop {r0}
@ -527,7 +527,7 @@ sub_80FB4E0: @ 80FB4E0
movs r1, 0xA
bl MapGridSetMetatileIdAt
bl DrawWholeMapView
bl script_env_2_enable
bl ScriptContext2_Enable
movs r0, 0
str r0, [sp]
ldr r1, =gPlttBufferFaded

View File

@ -3127,7 +3127,7 @@ _080AC910:
strh r0, [r4, 0x8]
b _080AC922
_080AC918:
bl script_env_2_enable_and_set_ctx_running
bl EnableBothScriptContexts
adds r0, r5, 0
bl DestroyTask
_080AC922:

View File

@ -1208,7 +1208,7 @@ gUnknown_0851017C:: @ 851017C
gUnknown_0851021C:: @ 851021C
.incbin "baserom.gba", 0x51021c, 0xa0
gUnknown_085102BC:: @ 85102BC
gNullScriptPtr:: @ 85102BC
.incbin "baserom.gba", 0x5102bc, 0x4
gUnknown_085102C0:: @ 85102C0

View File

@ -1,5 +1,5 @@
.align 2
gEventScriptCommandFunctionTable:: @ 81DB67C
gScriptCmdTable:: @ 81DB67C
.4byte s00_nop
.4byte s01_nop
.4byte s02_end

View File

@ -6,7 +6,7 @@
@ 81DB67C
.include "data/event_script_command_function_table.inc"
gUnknown_081DBA08:: @ 81DBA08
gScriptCmdTableEnd:: @ 81DBA08
.incbin "baserom.gba", 0x1dba08, 0x4
gSpecialVars:: @ 81DBA0C

View File

@ -23,9 +23,9 @@ struct ScriptContext
void InitScriptContext(struct ScriptContext *ctx, void *cmdTable, void *cmdTableEnd);
u8 SetupBytecodeScript(struct ScriptContext *ctx, const u8 *ptr);
void SetupNativeScript(struct ScriptContext *ctx, void *ptr);
void SetupNativeScript(struct ScriptContext *ctx, bool8 (*ptr)(void));
void StopScript(struct ScriptContext *ctx);
u8 RunScriptCommand(struct ScriptContext *ctx);
bool8 RunScriptCommand(struct ScriptContext *ctx);
u8 ScriptPush(struct ScriptContext *ctx, const u8 *ptr);
const u8 *ScriptPop(struct ScriptContext *ctx);
void ScriptJump(struct ScriptContext *ctx, u8 *ptr);
@ -37,6 +37,7 @@ void ScriptContext2_Enable(void);
void ScriptContext2_Disable(void);
bool8 ScriptContext2_IsEnabled(void);
void ScriptContext1_Init(void);
bool8 ScriptContext1_IsScriptSetUp(void);
bool8 ScriptContext2_RunScript(void);
void ScriptContext1_SetupScript(const u8 *ptr);
void ScriptContext1_Stop(void);
@ -48,6 +49,7 @@ u8 *mapheader_get_first_match_from_tagged_ptr_list(u8 tag);
void mapheader_run_script_with_tag_x1(void);
void mapheader_run_script_with_tag_x3(void);
void mapheader_run_script_with_tag_x5(void);
void mapheader_run_script_with_tag_x7(void);
void mapheader_run_script_with_tag_x6(void);
bool8 mapheader_run_first_tag2_script_list_match(void);
void mapheader_run_first_tag4_script_list_match(void);
@ -55,5 +57,8 @@ u32 CalculateRamScriptChecksum(void);
void ClearRamScript(void);
bool8 InitRamScript(u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 objectId);
u8 *GetRamScript(u8 objectId, u8 *script);
bool32 sub_80991F8(void);
u8 *sub_8099244(void);
void sub_80992A0(u8 *script, u16 scriptSize);
#endif // GUARD_SCRIPT_H

15
include/util.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef GUARD_UTIL_H
#define GUARD_UTIL_H
#include "sprite.h"
extern const u8 gMiscBlank_Gfx[];
extern const u32 gBitTable[];
u8 CreateInvisibleSpriteWithCallback(void (*)(struct Sprite *));
void StoreWordInTwoHalfwords(u16 *, u32);
void LoadWordFromTwoHalfwords(u16 *, u32 *);
u16 CalcCRC16(u8 *data, s32 length);
u16 CalcCRC16WithTable(u8 *data, s32 length);
#endif // GUARD_UTIL_H

View File

@ -99,7 +99,7 @@ SECTIONS {
asm/field_message_box.o(.text);
asm/map_obj_lock.o(.text);
src/text_window.o(.text);
asm/script.o(.text);
src/script.o(.text);
asm/scrcmd.o(.text);
asm/field_control_avatar.o(.text);
src/event_data.o(.text);

View File

@ -34,7 +34,7 @@ extern void c2_exit_to_overworld_2_switch(void);
extern void c2_exit_to_overworld_1_continue_scripts_restart_music(void);
extern void c2_load_new_map(void);
extern void sub_80AF6F0(void);
extern void script_env_2_set_ctx_paused(void);
extern void ScriptContext1_Stop(void);
extern void warp_in(void);
extern void GetXYCoordsOneStepInFrontOfPlayer(s16* x, s16* y);
extern void PlayerGetDestCoords(s16* x, s16* y);
@ -124,7 +124,7 @@ void sub_80FC190(void)
else if (gBattleOutcome == BATTLE_CAUGHT)
{
ScriptContext1_SetupScript(gUnknown_082A4B9B);
script_env_2_set_ctx_paused();
ScriptContext1_Stop();
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
}
}

434
src/script.c Normal file
View File

@ -0,0 +1,434 @@
#include "global.h"
#include "script.h"
#include "event_data.h"
#include "util.h"
#define RAM_SCRIPT_MAGIC 51
extern u8* gUnknown_020375C0;
extern bool32 sub_801B27C(void);
// ewram bss
IWRAM_DATA u8 sScriptContext1Status;
IWRAM_DATA u32 sUnusedVariable1;
IWRAM_DATA struct ScriptContext sScriptContext1;
IWRAM_DATA u32 sUnusedVariable2;
IWRAM_DATA struct ScriptContext sScriptContext2;
IWRAM_DATA bool8 sScriptContext2Enabled;
extern ScrCmdFunc gScriptCmdTable[];
extern ScrCmdFunc gScriptCmdTableEnd[];
extern void *gNullScriptPtr;
void InitScriptContext(struct ScriptContext *ctx, void *cmdTable, void *cmdTableEnd)
{
s32 i;
ctx->mode = 0;
ctx->scriptPtr = 0;
ctx->stackDepth = 0;
ctx->nativePtr = 0;
ctx->cmdTable = cmdTable;
ctx->cmdTableEnd = cmdTableEnd;
for (i = 0; i < 4; i++)
ctx->data[i] = 0;
for (i = 0; i < 20; i++)
ctx->stack[i] = 0;
}
u8 SetupBytecodeScript(struct ScriptContext *ctx, const u8 *ptr)
{
ctx->scriptPtr = ptr;
ctx->mode = 1;
return 1;
}
void SetupNativeScript(struct ScriptContext *ctx, bool8 (*ptr)(void))
{
ctx->mode = 2;
ctx->nativePtr = ptr;
}
void StopScript(struct ScriptContext *ctx)
{
ctx->mode = 0;
ctx->scriptPtr = 0;
}
bool8 RunScriptCommand(struct ScriptContext *ctx)
{
if (ctx->mode == 0)
return FALSE;
switch (ctx->mode)
{
case 0:
return FALSE;
case 2:
if (ctx->nativePtr)
{
if (ctx->nativePtr() == TRUE)
ctx->mode = 1;
return TRUE;
}
ctx->mode = 1;
case 1:
while (1)
{
u8 cmdCode;
ScrCmdFunc *func;
if (!ctx->scriptPtr)
{
ctx->mode = 0;
return FALSE;
}
if (ctx->scriptPtr == gNullScriptPtr)
{
while (1)
asm("svc 2"); // HALT
}
cmdCode = *(ctx->scriptPtr);
ctx->scriptPtr++;
func = &ctx->cmdTable[cmdCode];
if (func >= ctx->cmdTableEnd)
{
ctx->mode = 0;
return FALSE;
}
if ((*func)(ctx) == 1)
return TRUE;
}
}
return TRUE;
}
u8 ScriptPush(struct ScriptContext *ctx, const u8 *ptr)
{
if (ctx->stackDepth + 1 >= 20)
{
return 1;
}
else
{
ctx->stack[ctx->stackDepth] = ptr;
ctx->stackDepth++;
return 0;
}
}
const u8 *ScriptPop(struct ScriptContext *ctx)
{
if (ctx->stackDepth == 0)
return NULL;
ctx->stackDepth--;
return ctx->stack[ctx->stackDepth];
}
void ScriptJump(struct ScriptContext *ctx, u8 *ptr)
{
ctx->scriptPtr = ptr;
}
void ScriptCall(struct ScriptContext *ctx, u8 *ptr)
{
ScriptPush(ctx, ctx->scriptPtr);
ctx->scriptPtr = ptr;
}
void ScriptReturn(struct ScriptContext *ctx)
{
ctx->scriptPtr = ScriptPop(ctx);
}
u16 ScriptReadHalfword(struct ScriptContext *ctx)
{
u16 value = *(ctx->scriptPtr++);
value |= *(ctx->scriptPtr++) << 8;
return value;
}
u32 ScriptReadWord(struct ScriptContext *ctx)
{
u32 value0 = *(ctx->scriptPtr++);
u32 value1 = *(ctx->scriptPtr++);
u32 value2 = *(ctx->scriptPtr++);
u32 value3 = *(ctx->scriptPtr++);
return (((((value3 << 8) + value2) << 8) + value1) << 8) + value0;
}
void ScriptContext2_Enable(void)
{
sScriptContext2Enabled = TRUE;
}
void ScriptContext2_Disable(void)
{
sScriptContext2Enabled = FALSE;
}
bool8 ScriptContext2_IsEnabled(void)
{
return sScriptContext2Enabled;
}
bool8 ScriptContext1_IsScriptSetUp(void)
{
if (sScriptContext1Status == 0)
return TRUE;
else
return FALSE;
}
void ScriptContext1_Init(void)
{
InitScriptContext(&sScriptContext1, gScriptCmdTable, gScriptCmdTableEnd);
sScriptContext1Status = 2;
}
bool8 ScriptContext2_RunScript(void)
{
if (sScriptContext1Status == 2)
return 0;
if (sScriptContext1Status == 1)
return 0;
ScriptContext2_Enable();
if (!RunScriptCommand(&sScriptContext1))
{
sScriptContext1Status = 2;
ScriptContext2_Disable();
return 0;
}
return 1;
}
void ScriptContext1_SetupScript(const u8 *ptr)
{
InitScriptContext(&sScriptContext1, gScriptCmdTable, gScriptCmdTableEnd);
SetupBytecodeScript(&sScriptContext1, ptr);
ScriptContext2_Enable();
sScriptContext1Status = 0;
}
void ScriptContext1_Stop(void)
{
sScriptContext1Status = 1;
}
void EnableBothScriptContexts(void)
{
sScriptContext1Status = 0;
ScriptContext2_Enable();
}
void ScriptContext2_RunNewScript(const u8 *ptr)
{
InitScriptContext(&sScriptContext2, &gScriptCmdTable, &gScriptCmdTableEnd);
SetupBytecodeScript(&sScriptContext2, ptr);
while (RunScriptCommand(&sScriptContext2) == TRUE);
}
u8 *mapheader_get_tagged_pointer(u8 tag)
{
u8 *mapScripts = gMapHeader.mapScripts;
if (!mapScripts)
return NULL;
while (1)
{
if (!*mapScripts)
return NULL;
if (*mapScripts == tag)
{
mapScripts++;
return (u8 *)(mapScripts[0] + (mapScripts[1] << 8) + (mapScripts[2] << 16) + (mapScripts[3] << 24));
}
mapScripts += 5;
}
}
void mapheader_run_script_by_tag(u8 tag)
{
u8 *ptr = mapheader_get_tagged_pointer(tag);
if (ptr)
ScriptContext2_RunNewScript(ptr);
}
u8 *mapheader_get_first_match_from_tagged_ptr_list(u8 tag)
{
u8 *ptr = mapheader_get_tagged_pointer(tag);
if (!ptr)
return NULL;
while (1)
{
u16 varIndex1;
u16 varIndex2;
varIndex1 = ptr[0] | (ptr[1] << 8);
if (!varIndex1)
return NULL;
ptr += 2;
varIndex2 = ptr[0] | (ptr[1] << 8);
ptr += 2;
if (VarGet(varIndex1) == VarGet(varIndex2))
return (u8 *)(ptr[0] + (ptr[1] << 8) + (ptr[2] << 16) + (ptr[3] << 24));
ptr += 4;
}
}
void mapheader_run_script_with_tag_x1(void)
{
mapheader_run_script_by_tag(1);
}
void mapheader_run_script_with_tag_x3(void)
{
mapheader_run_script_by_tag(3);
}
void mapheader_run_script_with_tag_x5(void)
{
mapheader_run_script_by_tag(5);
}
void mapheader_run_script_with_tag_x7(void)
{
mapheader_run_script_by_tag(7);
}
void mapheader_run_script_with_tag_x6(void)
{
mapheader_run_script_by_tag(6);
}
bool8 mapheader_run_first_tag2_script_list_match(void)
{
u8 *ptr = mapheader_get_first_match_from_tagged_ptr_list(2);
if (!ptr)
return 0;
ScriptContext1_SetupScript(ptr);
return 1;
}
void mapheader_run_first_tag4_script_list_match(void)
{
u8 *ptr = mapheader_get_first_match_from_tagged_ptr_list(4);
if (ptr)
ScriptContext2_RunNewScript(ptr);
}
u32 CalculateRamScriptChecksum(void)
{
return CalcCRC16WithTable((u8*)(&gSaveBlock1Ptr->ramScript.data), sizeof(gSaveBlock1Ptr->ramScript.data));
}
void ClearRamScript(void)
{
CpuFill32(0, &gSaveBlock1Ptr->ramScript, sizeof(struct RamScript));
}
bool8 InitRamScript(u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 objectId)
{
struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data;
ClearRamScript();
if (scriptSize > sizeof(scriptData->script))
return FALSE;
scriptData->magic = RAM_SCRIPT_MAGIC;
scriptData->mapGroup = mapGroup;
scriptData->mapNum = mapNum;
scriptData->objectId = objectId;
memcpy(scriptData->script, script, scriptSize);
gSaveBlock1Ptr->ramScript.checksum = CalculateRamScriptChecksum();
return TRUE;
}
u8 *GetRamScript(u8 objectId, u8 *script)
{
struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data;
gUnknown_020375C0 = NULL;
if (scriptData->magic != RAM_SCRIPT_MAGIC)
return script;
if (scriptData->mapGroup != gSaveBlock1Ptr->location.mapGroup)
return script;
if (scriptData->mapNum != gSaveBlock1Ptr->location.mapNum)
return script;
if (scriptData->objectId != objectId)
return script;
if (CalculateRamScriptChecksum() != gSaveBlock1Ptr->ramScript.checksum)
{
ClearRamScript();
return script;
}
else
{
gUnknown_020375C0 = script;
return scriptData->script;
}
}
bool32 sub_80991F8(void)
{
struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data;
if (scriptData->magic != RAM_SCRIPT_MAGIC)
return FALSE;
if (scriptData->mapGroup != 0xFF)
return FALSE;
if (scriptData->mapNum != 0xFF)
return FALSE;
if (scriptData->objectId != 0xFF)
return FALSE;
if (CalculateRamScriptChecksum() != gSaveBlock1Ptr->ramScript.checksum)
return FALSE;
return TRUE;
}
u8 *sub_8099244(void)
{
struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data;
if (!sub_801B27C())
return NULL;
if (scriptData->magic != RAM_SCRIPT_MAGIC)
return NULL;
if (scriptData->mapGroup != 0xFF)
return NULL;
if (scriptData->mapNum != 0xFF)
return NULL;
if (scriptData->objectId != 0xFF)
return NULL;
if (CalculateRamScriptChecksum() != gSaveBlock1Ptr->ramScript.checksum)
{
ClearRamScript();
return NULL;
}
else
{
return scriptData->script;
}
}
void sub_80992A0(u8 *script, u16 scriptSize)
{
if (scriptSize > sizeof(gSaveBlock1Ptr->ramScript.data.script))
scriptSize = sizeof(gSaveBlock1Ptr->ramScript.data.script);
InitRamScript(script, scriptSize, 0xFF, 0xFF, 0xFF);
}

View File

@ -175,18 +175,9 @@ gUnknown_03000E2C: @ 3000E2C
gUnknown_03000E30: @ 3000E30
.space 0x8
gUnknown_03000E38: @ 3000E38
.space 0x8
gUnknown_03000E40: @ 3000E40
.space 0x78
gUnknown_03000EB8: @ 3000EB8
.space 0x74
gUnknown_03000F2C: @ 3000F2C
.space 0x4
.include "src/script.o"
.align 2
gUnknown_03000F30: @ 3000F30
.space 0x4