more scripting cleanup

This commit is contained in:
yenatch 2013-07-04 05:37:20 -04:00
parent a3870db643
commit 0988d69d9d
2 changed files with 67 additions and 55 deletions

View File

@ -171,21 +171,21 @@ ScriptCommandTable: ; 0x96cb1
dw Script_unknown0xa9 dw Script_unknown0xa9
; 0x96e05 ; 0x96e05
Unknown_0x96e05: ; 0x96e05 StartScript: ; 0x96e05
ld hl, $d434 ld hl, ScriptFlags
set 2, [hl] set SCRIPT_RUNNING, [hl]
ret ret
; 0x96e0b ; 0x96e0b
Unknown_0x96e0b: ; 0x96e0b CheckScript: ; 0x96e0b
ld hl, $d434 ld hl, ScriptFlags
bit 2, [hl] bit SCRIPT_RUNNING, [hl]
ret ret
; 0x96e11 ; 0x96e11
Unknown_0x96e11: ; 0x96e11 StopScript: ; 0x96e11
ld hl, $d434 ld hl, ScriptFlags
res 2, [hl] res SCRIPT_RUNNING, [hl]
ret ret
; 0x96e17 ; 0x96e17
@ -877,7 +877,7 @@ Script_talkaftercancel: ; 0x97163
ld a, [$d04d] ld a, [$d04d]
and a and a
ret z ret z
jp $7b74 jp Script_end
; 0x9716b ; 0x9716b
Script_talkaftercheck: ; 0x9716b Script_talkaftercheck: ; 0x9716b
@ -1038,9 +1038,9 @@ Script_applymovement: ; 0x971f3
ld b, a ld b, a
call $26c7 call $26c7
ret c ret c
ld a, $2 ld a, SCRIPT_WAIT_MOVEMENT
ld [$d437], a ld [ScriptMode], a
call Unknown_0x96e11 call StopScript
ret ret
; 0x97221 ; 0x97221
@ -1375,7 +1375,7 @@ Script_showemote: ; 0x97396
ld [$ffe0], a ld [$ffe0], a
.asm_973a8 .asm_973a8
call GetScriptByte call GetScriptByte
ld [$d44d], a ld [ScriptDelay], a
ld b, BANK(ShowEmoteScript) ld b, BANK(ShowEmoteScript)
ld de, ShowEmoteScript ld de, ShowEmoteScript
jp ScriptCall jp ScriptCall
@ -1559,7 +1559,7 @@ Script_reloadmap: ; 0x97491
ld [$ff9f], a ld [$ff9f], a
ld a, $1 ld a, $1
call $261b call $261b
call Unknown_0x96e11 call StopScript
ret ret
; 0x974a2 ; 0x974a2
@ -1826,7 +1826,7 @@ Script_priorityjump: ; 0x975aa
ld [$d44f], a ld [$d44f], a
call GetScriptByte call GetScriptByte
ld [$d450], a ld [$d450], a
ld hl, $d434 ld hl, ScriptFlags
set 3, [hl] set 3, [hl]
ret ret
; 0x975c2 ; 0x975c2
@ -2833,7 +2833,7 @@ Script_warp: ; 0x97a1d
ld [$ff9f], a ld [$ff9f], a
ld a, $1 ld a, $1
call $261b call $261b
call Unknown_0x96e11 call StopScript
ret ret
.asm_97a4a .asm_97a4a
call GetScriptByte call GetScriptByte
@ -2845,7 +2845,7 @@ Script_warp: ; 0x97a1d
ld [$ff9f], a ld [$ff9f], a
ld a, $1 ld a, $1
call $261b call $261b
call Unknown_0x96e11 call StopScript
ret ret
; 0x97a65 ; 0x97a65
@ -2998,7 +2998,7 @@ Script_newloadmap: ; 0x97b08
ld [$ff9f], a ld [$ff9f], a
ld a, $1 ld a, $1
call $261b call $261b
call Unknown_0x96e11 call StopScript
ret ret
; 0x97b16 ; 0x97b16
@ -3006,7 +3006,7 @@ Script_reloadandreturn: ; 0x97b16
; script command 0x92 ; script command 0x92
call $7b08 call $7b08
jp $7b74 jp Script_end
; 0x97b1c ; 0x97b1c
Script_loadfont: ; 0x97b1c Script_loadfont: ; 0x97b1c
@ -3074,11 +3074,11 @@ Script_pause: ; 0x97b47
call GetScriptByte call GetScriptByte
and a and a
jr z, .asm_97b50 ; 0x97b4b $3 jr z, .asm_97b50 ; 0x97b4b $3
ld [$d44d], a ld [ScriptDelay], a
.asm_97b50 .asm_97b50
ld c, $2 ld c, 2
call DelayFrames call DelayFrames
ld hl, $d44d ld hl, ScriptDelay
dec [hl] dec [hl]
jr nz, .asm_97b50 ; 0x97b59 $f5 jr nz, .asm_97b50 ; 0x97b59 $f5
ret ret
@ -3092,11 +3092,11 @@ Script_deactivatefacing: ; 0x97b5c
call GetScriptByte call GetScriptByte
and a and a
jr z, .asm_97b65 ; 0x97b60 $3 jr z, .asm_97b65 ; 0x97b60 $3
ld [$d44d], a ld [ScriptDelay], a
.asm_97b65 .asm_97b65
ld a, $3 ld a, SCRIPT_WAIT
ld [$d437], a ld [ScriptMode], a
call Unknown_0x96e11 call StopScript
ret ret
; 0x97b6e ; 0x97b6e
@ -3105,40 +3105,42 @@ Script_ptpriorityjump: ; 0x97b6e
; parameters: ; parameters:
; pointer (ScriptPointerLabelParam) ; pointer (ScriptPointerLabelParam)
call Unknown_0x96e11 call StopScript
jp Script_2jump jp Script_2jump
; 0x97b74 ; 0x97b74
Script_end: ; 0x97b74 Script_end: ; 0x97b74
; script command 0x91 ; script command 0x91
call $7b9a call ExitScriptSubroutine
jr c, .asm_97b7a ; 0x97b77 $1 jr c, .asm_97b7a
ret ret
.asm_97b7a .asm_97b7a
xor a xor a
ld [ScriptRunning], a ld [ScriptRunning], a
ld a, $0 ld a, SCRIPT_OFF
ld [$d437], a ld [ScriptMode], a
ld hl, $d434 ld hl, ScriptFlags
res 0, [hl] res 0, [hl]
call Unknown_0x96e11 call StopScript
ret ret
; 0x97b8c ; 0x97b8c
Script_return: ; 0x97b8c Script_return: ; 0x97b8c
; script command 0x90 ; script command 0x90
call $7b9a call ExitScriptSubroutine
jr c, .asm_97b91 ; 0x97b8f $0 jr c, .asm_97b91
.asm_97b91 .asm_97b91
ld hl, $d434 ld hl, ScriptFlags
res 0, [hl] res 0, [hl]
call Unknown_0x96e11 call StopScript
ret ret
; 0x97b9a ; 0x97b9a
Unknown_0x97b9a: ; 0x97b9a ExitScriptSubroutine: ; 0x97b9a
; Return carry if there's no parent to return to.
ld hl, $d43c ld hl, $d43c
ld a, [hl] ld a, [hl]
and a and a
@ -3173,11 +3175,11 @@ Script_resetfuncs: ; 0x97bc0
xor a xor a
ld [$d43c], a ld [$d43c], a
ld [ScriptRunning], a ld [ScriptRunning], a
ld a, $0 ld a, SCRIPT_OFF
ld [$d437], a ld [ScriptMode], a
ld hl, $d434 ld hl, ScriptFlags
res 0, [hl] res 0, [hl]
call Unknown_0x96e11 call StopScript
ret ret
; 0x97bd5 ; 0x97bd5
@ -3186,15 +3188,9 @@ Script_halloffame: ; 0x97bd5
ld hl, $cfbc ld hl, $cfbc
res 0, [hl] res 0, [hl]
ld a, BANK(HallOfFame1) callba HallOfFame1
ld hl, HallOfFame1 callba HallOfFame2
rst $8 callba HallOfFame3
ld a, BANK(HallOfFame2)
ld hl, HallOfFame2
rst $8
ld a, BANK(HallOfFame3)
ld hl, HallOfFame3
rst $8
ld hl, $cfbc ld hl, $cfbc
set 0, [hl] set 0, [hl]
jr DisplayCredits jr DisplayCredits
@ -3211,7 +3207,7 @@ DisplayCredits:
call $7bc0 call $7bc0
ld a, $3 ld a, $3
call $261b call $261b
call Unknown_0x96e11 call StopScript
ret ret
; 0x97c05 ; 0x97c05
@ -3224,7 +3220,7 @@ Script_unknown0xa8: ; 0x97c05
call GetScriptByte call GetScriptByte
.asm_97c09 .asm_97c09
push af push af
ld c, $6 ld c, 6
call DelayFrames call DelayFrames
pop af pop af
dec a dec a

View File

@ -1526,8 +1526,19 @@ OTPartyMon5Nickname: ; d416
OTPartyMon6Nickname: ; d421 OTPartyMon6Nickname: ; d421
ds 11 ds 11
SECTION "Scripting",BSS[$d438] SECTION "Scripting",BSS[$d434]
ScriptFlags: ; d434
SCRIPT_RUNNING EQU 2
ds 1
ds 2
ScriptMode: ; d437
SCRIPT_OFF EQU 0
SCRIPT_READ EQU 1
SCRIPT_WAIT_MOVEMENT EQU 2
SCRIPT_WAIT EQU 3
ds 1
ScriptRunning: ; d438 ScriptRunning: ; d438
ds 1 ds 1
ScriptBank: ; d439 ScriptBank: ; d439
@ -1535,6 +1546,11 @@ ScriptBank: ; d439
ScriptPos: ; d43a ScriptPos: ; d43a
ds 2 ds 2
ds 17
ScriptDelay: ; d44d
ds 1
SECTION "Player",BSS[$d472] SECTION "Player",BSS[$d472]
PlayerGender: ; d472 PlayerGender: ; d472
; bit 0: ; bit 0: