2013-11-22 01:51:47 -08:00
|
|
|
; Event scripting commands.
|
|
|
|
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
EnableScriptMode:: ; 96c56
|
2013-11-22 01:51:47 -08:00
|
|
|
push af
|
2015-07-15 12:48:44 -07:00
|
|
|
ld a, SCRIPT_READ
|
2013-11-22 01:51:47 -08:00
|
|
|
ld [ScriptMode], a
|
|
|
|
pop af
|
|
|
|
ret
|
|
|
|
; 96c5e
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
ScriptEvents:: ; 96c5e
|
2013-11-22 01:51:47 -08:00
|
|
|
call StartScript
|
|
|
|
.loop
|
|
|
|
ld a, [ScriptMode]
|
|
|
|
ld hl, .modes
|
|
|
|
rst JumpTable
|
|
|
|
call CheckScript
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
; 96c6e
|
|
|
|
|
|
|
|
.modes ; 96c6e
|
|
|
|
dw EndScript
|
|
|
|
dw RunScriptCommand
|
|
|
|
dw WaitScriptMovement
|
|
|
|
dw WaitScript
|
|
|
|
|
|
|
|
EndScript: ; 96c76
|
|
|
|
call StopScript
|
|
|
|
ret
|
|
|
|
; 96c7a
|
|
|
|
|
|
|
|
WaitScript: ; 96c7a
|
|
|
|
call StopScript
|
|
|
|
|
|
|
|
ld hl, ScriptDelay
|
|
|
|
dec [hl]
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
callba Function58b9
|
|
|
|
|
|
|
|
ld a, SCRIPT_READ
|
|
|
|
ld [ScriptMode], a
|
|
|
|
call StartScript
|
|
|
|
ret
|
|
|
|
; 96c91
|
|
|
|
|
|
|
|
WaitScriptMovement: ; 96c91
|
|
|
|
call StopScript
|
|
|
|
|
|
|
|
ld hl, VramState
|
|
|
|
bit 7, [hl]
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
callba Function58b9
|
|
|
|
|
|
|
|
ld a, SCRIPT_READ
|
|
|
|
ld [ScriptMode], a
|
|
|
|
call StartScript
|
|
|
|
ret
|
|
|
|
; 96ca9
|
|
|
|
|
|
|
|
RunScriptCommand: ; 96ca9
|
|
|
|
call GetScriptByte
|
|
|
|
ld hl, ScriptCommandTable
|
|
|
|
rst JumpTable
|
|
|
|
ret
|
|
|
|
; 96cb1
|
|
|
|
|
|
|
|
|
2013-02-27 21:31:12 -08:00
|
|
|
ScriptCommandTable: ; 0x96cb1
|
2013-02-28 13:04:26 -08:00
|
|
|
dw Script_2call
|
|
|
|
dw Script_3call
|
|
|
|
dw Script_2ptcall
|
|
|
|
dw Script_2jump
|
|
|
|
dw Script_3jump
|
|
|
|
dw Script_2ptjump
|
|
|
|
dw Script_if_equal
|
|
|
|
dw Script_if_not_equal
|
|
|
|
dw Script_iffalse
|
|
|
|
dw Script_iftrue
|
|
|
|
dw Script_if_greater_than
|
2013-09-26 15:40:20 -07:00
|
|
|
dw Script_if_less_than
|
2013-02-28 13:04:26 -08:00
|
|
|
dw Script_jumpstd
|
|
|
|
dw Script_callstd
|
|
|
|
dw Script_3callasm
|
|
|
|
dw Script_special
|
|
|
|
dw Script_2ptcallasm
|
|
|
|
dw Script_checkmaptriggers
|
|
|
|
dw Script_domaptrigger
|
|
|
|
dw Script_checktriggers
|
|
|
|
dw Script_dotrigger
|
|
|
|
dw Script_writebyte
|
|
|
|
dw Script_addvar
|
|
|
|
dw Script_random
|
|
|
|
dw Script_checkver
|
|
|
|
dw Script_copybytetovar
|
|
|
|
dw Script_copyvartobyte
|
|
|
|
dw Script_loadvar
|
|
|
|
dw Script_checkcode
|
|
|
|
dw Script_writevarcode
|
|
|
|
dw Script_writecode
|
|
|
|
dw Script_giveitem
|
|
|
|
dw Script_takeitem
|
|
|
|
dw Script_checkitem
|
|
|
|
dw Script_givemoney
|
|
|
|
dw Script_takemoney
|
|
|
|
dw Script_checkmoney
|
|
|
|
dw Script_givecoins
|
|
|
|
dw Script_takecoins
|
|
|
|
dw Script_checkcoins
|
|
|
|
dw Script_addcellnum
|
|
|
|
dw Script_delcellnum
|
|
|
|
dw Script_checkcellnum
|
|
|
|
dw Script_checktime
|
|
|
|
dw Script_checkpoke
|
|
|
|
dw Script_givepoke
|
|
|
|
dw Script_giveegg
|
|
|
|
dw Script_givepokeitem
|
|
|
|
dw Script_checkpokeitem
|
2013-09-24 00:48:58 -07:00
|
|
|
dw Script_checkevent
|
|
|
|
dw Script_clearevent
|
|
|
|
dw Script_setevent
|
2013-09-24 00:51:42 -07:00
|
|
|
dw Script_checkflag
|
|
|
|
dw Script_clearflag
|
|
|
|
dw Script_setflag
|
2013-02-28 13:04:26 -08:00
|
|
|
dw Script_wildon
|
2013-09-24 00:29:37 -07:00
|
|
|
dw Script_wildoff
|
2013-02-28 13:04:26 -08:00
|
|
|
dw Script_xycompare
|
|
|
|
dw Script_warpmod
|
|
|
|
dw Script_blackoutmod
|
|
|
|
dw Script_warp
|
|
|
|
dw Script_readmoney
|
|
|
|
dw Script_readcoins
|
|
|
|
dw Script_RAM2MEM
|
|
|
|
dw Script_pokenamemem
|
|
|
|
dw Script_itemtotext
|
|
|
|
dw Script_mapnametotext
|
|
|
|
dw Script_trainertotext
|
|
|
|
dw Script_stringtotext
|
|
|
|
dw Script_itemnotify
|
|
|
|
dw Script_pocketisfull
|
|
|
|
dw Script_loadfont
|
|
|
|
dw Script_refreshscreen
|
|
|
|
dw Script_loadmovesprites
|
|
|
|
dw Script_loadbytec1ce
|
|
|
|
dw Script_3writetext
|
|
|
|
dw Script_2writetext
|
|
|
|
dw Script_repeattext
|
|
|
|
dw Script_yesorno
|
|
|
|
dw Script_loadmenudata
|
|
|
|
dw Script_writebackup
|
|
|
|
dw Script_jumptextfaceplayer
|
2013-11-22 01:51:47 -08:00
|
|
|
IF _CRYSTAL
|
2013-02-28 13:04:26 -08:00
|
|
|
dw Script_3jumptext
|
2013-11-22 01:51:47 -08:00
|
|
|
ENDC
|
2013-02-28 13:04:26 -08:00
|
|
|
dw Script_jumptext
|
|
|
|
dw Script_closetext
|
|
|
|
dw Script_keeptextopen
|
|
|
|
dw Script_pokepic
|
|
|
|
dw Script_pokepicyesorno
|
|
|
|
dw Script_interpretmenu
|
|
|
|
dw Script_interpretmenu2
|
|
|
|
dw Script_loadpikachudata
|
|
|
|
dw Script_battlecheck
|
|
|
|
dw Script_loadtrainerdata
|
|
|
|
dw Script_loadpokedata
|
|
|
|
dw Script_loadtrainer
|
|
|
|
dw Script_startbattle
|
|
|
|
dw Script_returnafterbattle
|
|
|
|
dw Script_catchtutorial
|
|
|
|
dw Script_trainertext
|
|
|
|
dw Script_trainerstatus
|
|
|
|
dw Script_winlosstext
|
|
|
|
dw Script_scripttalkafter
|
|
|
|
dw Script_talkaftercancel
|
|
|
|
dw Script_talkaftercheck
|
|
|
|
dw Script_setlasttalked
|
|
|
|
dw Script_applymovement
|
|
|
|
dw Script_applymovement2
|
|
|
|
dw Script_faceplayer
|
|
|
|
dw Script_faceperson
|
|
|
|
dw Script_variablesprite
|
|
|
|
dw Script_disappear
|
|
|
|
dw Script_appear
|
|
|
|
dw Script_follow
|
|
|
|
dw Script_stopfollow
|
|
|
|
dw Script_moveperson
|
|
|
|
dw Script_writepersonxy
|
|
|
|
dw Script_loademote
|
|
|
|
dw Script_showemote
|
|
|
|
dw Script_spriteface
|
|
|
|
dw Script_follownotexact
|
|
|
|
dw Script_earthquake
|
|
|
|
dw Script_changemap
|
|
|
|
dw Script_changeblock
|
|
|
|
dw Script_reloadmap
|
|
|
|
dw Script_reloadmappart
|
|
|
|
dw Script_writecmdqueue
|
|
|
|
dw Script_delcmdqueue
|
|
|
|
dw Script_playmusic
|
|
|
|
dw Script_playrammusic
|
|
|
|
dw Script_musicfadeout
|
|
|
|
dw Script_playmapmusic
|
|
|
|
dw Script_reloadmapmusic
|
|
|
|
dw Script_cry
|
|
|
|
dw Script_playsound
|
|
|
|
dw Script_waitbutton
|
|
|
|
dw Script_warpsound
|
|
|
|
dw Script_specialsound
|
|
|
|
dw Script_passtoengine
|
|
|
|
dw Script_newloadmap
|
|
|
|
dw Script_pause
|
|
|
|
dw Script_deactivatefacing
|
|
|
|
dw Script_priorityjump
|
|
|
|
dw Script_warpcheck
|
|
|
|
dw Script_ptpriorityjump
|
|
|
|
dw Script_return
|
|
|
|
dw Script_end
|
|
|
|
dw Script_reloadandreturn
|
|
|
|
dw Script_resetfuncs
|
|
|
|
dw Script_pokemart
|
|
|
|
dw Script_elevator
|
|
|
|
dw Script_trade
|
|
|
|
dw Script_askforphonenumber
|
|
|
|
dw Script_phonecall
|
|
|
|
dw Script_hangup
|
|
|
|
dw Script_describedecoration
|
|
|
|
dw Script_fruittree
|
|
|
|
dw Script_specialphonecall
|
|
|
|
dw Script_checkphonecall
|
|
|
|
dw Script_verbosegiveitem
|
|
|
|
dw Script_verbosegiveitem2
|
|
|
|
dw Script_loadwilddata
|
|
|
|
dw Script_halloffame
|
|
|
|
dw Script_credits
|
|
|
|
dw Script_warpfacing
|
|
|
|
dw Script_storetext
|
|
|
|
dw Script_displaylocation
|
2013-09-30 22:13:04 -07:00
|
|
|
dw Script_trainerclassname
|
|
|
|
dw Script_name
|
2013-09-30 22:03:08 -07:00
|
|
|
dw Script_wait
|
2013-02-28 13:04:26 -08:00
|
|
|
dw Script_unknown0xa9
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x96e05
|
|
|
|
|
2013-07-04 02:37:20 -07:00
|
|
|
StartScript: ; 0x96e05
|
|
|
|
ld hl, ScriptFlags
|
|
|
|
set SCRIPT_RUNNING, [hl]
|
2013-07-04 01:11:45 -07:00
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x96e0b
|
|
|
|
|
2013-07-04 02:37:20 -07:00
|
|
|
CheckScript: ; 0x96e0b
|
|
|
|
ld hl, ScriptFlags
|
|
|
|
bit SCRIPT_RUNNING, [hl]
|
2013-07-04 01:11:45 -07:00
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x96e11
|
|
|
|
|
2013-07-04 02:37:20 -07:00
|
|
|
StopScript: ; 0x96e11
|
|
|
|
ld hl, ScriptFlags
|
|
|
|
res SCRIPT_RUNNING, [hl]
|
2013-07-04 01:11:45 -07:00
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x96e17
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_3callasm: ; 0x96e17
|
|
|
|
; script command 0xe
|
|
|
|
; parameters:
|
|
|
|
; asm (AsmPointerParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
|
|
|
ld a, b
|
2013-10-01 18:55:40 -07:00
|
|
|
rst FarCall
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96e26
|
|
|
|
|
|
|
|
Script_special: ; 0x96e26
|
|
|
|
; script command 0xf
|
|
|
|
; parameters:
|
|
|
|
; predefined_script (MultiByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2014-07-19 14:02:58 -07:00
|
|
|
callba Special
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96e35
|
|
|
|
|
|
|
|
Script_2ptcallasm: ; 0x96e35
|
|
|
|
; script command 0x10
|
|
|
|
; parameters:
|
|
|
|
; asm (PointerToAsmPointerParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
|
|
|
ld b, [hl]
|
|
|
|
inc hl
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld a, b
|
2013-10-01 18:55:40 -07:00
|
|
|
rst FarCall
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96e45
|
|
|
|
|
|
|
|
Script_jumptextfaceplayer: ; 0x96e45
|
|
|
|
; script command 0x51
|
|
|
|
; parameters:
|
|
|
|
; text_pointer (RawTextPointerLabelParam)
|
|
|
|
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd44e], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd44f], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd450], a
|
2013-07-04 01:11:45 -07:00
|
|
|
ld b, BANK(JumpTextFacePlayerScript)
|
|
|
|
ld hl, JumpTextFacePlayerScript
|
2013-05-03 11:27:24 -07:00
|
|
|
jp ScriptJump
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x96e5f
|
|
|
|
|
|
|
|
Script_jumptext: ; 0x96e5f
|
|
|
|
; script command 0x53
|
|
|
|
; parameters:
|
|
|
|
; text_pointer (RawTextPointerLabelParam)
|
|
|
|
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd44e], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd44f], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd450], a
|
2013-07-04 01:11:45 -07:00
|
|
|
ld b, BANK(JumpTextScript)
|
|
|
|
ld hl, JumpTextScript
|
2013-05-03 11:27:24 -07:00
|
|
|
jp ScriptJump
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x96e79
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
JumpTextFacePlayerScript: ; 0x96e79
|
|
|
|
faceplayer
|
|
|
|
JumpTextScript: ; 0x96e7a
|
|
|
|
loadfont
|
2015-07-15 12:48:44 -07:00
|
|
|
repeattext -1, -1
|
2013-07-04 01:11:45 -07:00
|
|
|
closetext
|
|
|
|
loadmovesprites
|
|
|
|
end
|
|
|
|
; 0x96e81
|
2013-02-27 21:31:12 -08:00
|
|
|
|
2013-11-22 01:51:47 -08:00
|
|
|
|
|
|
|
IF _CRYSTAL
|
|
|
|
|
2013-02-27 21:31:12 -08:00
|
|
|
Script_3jumptext: ; 0x96e81
|
|
|
|
; script command 0x52
|
|
|
|
; parameters:
|
|
|
|
; text_pointer (PointerLabelBeforeBank)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd44e], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd44f], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd450], a
|
2013-07-04 01:11:45 -07:00
|
|
|
ld b, BANK(JumpTextScript)
|
|
|
|
ld hl, JumpTextScript
|
2013-05-03 11:27:24 -07:00
|
|
|
jp ScriptJump
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x96e9b
|
|
|
|
|
2013-11-22 01:51:47 -08:00
|
|
|
ENDC
|
|
|
|
|
|
|
|
|
2013-02-27 21:31:12 -08:00
|
|
|
Script_2writetext: ; 0x96e9b
|
|
|
|
; script command 0x4c
|
|
|
|
; parameters:
|
|
|
|
; text_pointer (RawTextPointerLabelParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2015-07-15 12:48:44 -07:00
|
|
|
call MapTextbox
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96eab
|
|
|
|
|
|
|
|
Script_3writetext: ; 0x96eab
|
|
|
|
; script command 0x4b
|
|
|
|
; parameters:
|
|
|
|
; text_pointer (PointerLabelBeforeBank)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
2015-07-15 12:48:44 -07:00
|
|
|
call MapTextbox
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96ebb
|
|
|
|
|
|
|
|
Script_repeattext: ; 0x96ebb
|
|
|
|
; script command 0x4d
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
2015-07-15 12:48:44 -07:00
|
|
|
cp -1
|
|
|
|
jr nz, .done ; 0x96ec5 $11
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, l
|
2015-07-15 12:48:44 -07:00
|
|
|
cp -1
|
|
|
|
jr nz, .done ; 0x96eca $c
|
2015-02-10 15:14:21 -08:00
|
|
|
ld hl, wd44e
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-07-15 12:48:44 -07:00
|
|
|
call MapTextbox
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
2015-07-15 12:48:44 -07:00
|
|
|
.done
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96ed9
|
|
|
|
|
|
|
|
Script_closetext: ; 0x96ed9
|
|
|
|
; script command 0x54
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
jp CloseText
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x96edc
|
|
|
|
|
|
|
|
Script_keeptextopen: ; 0x96edc
|
|
|
|
; script command 0x55
|
|
|
|
|
|
|
|
ld a, [$ffd8]
|
|
|
|
push af
|
|
|
|
ld a, $1
|
|
|
|
ld [$ffd8], a
|
2013-08-29 20:20:09 -07:00
|
|
|
call WaitBGMap
|
2015-07-15 12:48:44 -07:00
|
|
|
call KeepTextOpen
|
2013-02-27 21:31:12 -08:00
|
|
|
pop af
|
|
|
|
ld [$ffd8], a
|
|
|
|
ret
|
|
|
|
; 0x96eed
|
|
|
|
|
|
|
|
Script_yesorno: ; 0x96eed
|
|
|
|
; script command 0x4e
|
|
|
|
|
2013-12-03 23:49:12 -08:00
|
|
|
call YesNoBox
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, 0
|
2015-07-15 12:48:44 -07:00
|
|
|
jr c, .no ; 0x96ef2 $2
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, 1
|
2015-07-15 12:48:44 -07:00
|
|
|
.no
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96efa
|
|
|
|
|
|
|
|
Script_loadmenudata: ; 0x96efa
|
|
|
|
; script command 0x4f
|
|
|
|
; parameters:
|
|
|
|
; data (MenuDataPointerParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
2015-05-18 01:07:28 -07:00
|
|
|
ld de, LoadMenuDataHeader
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2015-07-15 12:48:44 -07:00
|
|
|
call Call_a_de
|
2015-07-22 12:57:02 -07:00
|
|
|
call UpdateSprites
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96f0f
|
|
|
|
|
|
|
|
Script_writebackup: ; 0x96f0f
|
|
|
|
; script command 0x50
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
call WriteBackup
|
2015-07-22 12:57:02 -07:00
|
|
|
call UpdateSprites
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96f16
|
|
|
|
|
|
|
|
Script_pokepic: ; 0x96f16
|
|
|
|
; script command 0x56
|
|
|
|
; parameters:
|
|
|
|
; pokemon (PokemonParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
and a
|
2014-05-21 13:21:46 -07:00
|
|
|
jr nz, .ok
|
|
|
|
ld a, [ScriptVar]
|
|
|
|
.ok
|
|
|
|
ld [CurPartySpecies], a
|
2015-07-15 12:48:44 -07:00
|
|
|
callba Pokepic
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96f29
|
|
|
|
|
|
|
|
Script_pokepicyesorno: ; 0x96f29
|
|
|
|
; script command 0x57
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
callba PokepicYesOrNo
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96f30
|
|
|
|
|
|
|
|
Script_interpretmenu2: ; 0x96f30
|
|
|
|
; script command 0x59
|
|
|
|
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2015-07-15 12:48:44 -07:00
|
|
|
ld hl, InterpretMenu2
|
2013-10-01 18:55:40 -07:00
|
|
|
rst FarCall
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [wcfa9]
|
2014-05-21 13:21:46 -07:00
|
|
|
jr nc, .ok
|
2013-02-27 21:31:12 -08:00
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
.ok
|
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96f41
|
|
|
|
|
|
|
|
Script_interpretmenu: ; 0x96f41
|
|
|
|
; script command 0x58
|
|
|
|
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2015-07-15 12:48:44 -07:00
|
|
|
ld hl, InterpretMenu
|
2013-10-01 18:55:40 -07:00
|
|
|
rst FarCall
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [wcf88]
|
2014-05-21 13:21:46 -07:00
|
|
|
jr nc, .ok
|
2013-02-27 21:31:12 -08:00
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
.ok
|
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96f52
|
|
|
|
|
|
|
|
Script_storetext: ; 0x96f52
|
|
|
|
; script command 0xa4
|
|
|
|
; parameters:
|
|
|
|
; pointer (PointerLabelBeforeBank)
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
call SetUpTextBox
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
2015-07-15 12:48:44 -07:00
|
|
|
callba StoreText
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96f60
|
|
|
|
|
|
|
|
Script_verbosegiveitem: ; 0x96f60
|
|
|
|
; script command 0x9e
|
|
|
|
; parameters:
|
|
|
|
; item (ItemLabelByte)
|
|
|
|
; quantity (DecimalParam)
|
|
|
|
|
2013-07-19 23:27:48 -07:00
|
|
|
call Script_giveitem
|
2013-07-04 01:11:45 -07:00
|
|
|
call CurItemName
|
|
|
|
ld de, StringBuffer1
|
2015-07-15 12:48:44 -07:00
|
|
|
ld a, 1
|
|
|
|
call CopyConvertedText
|
2013-07-04 01:11:45 -07:00
|
|
|
ld b, BANK(GiveItemScript)
|
|
|
|
ld de, GiveItemScript
|
|
|
|
jp ScriptCall
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x96f76
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
|
|
|
|
Function96f76: ; 96f76
|
|
|
|
ret
|
|
|
|
; 96f77
|
|
|
|
|
|
|
|
GiveItemScript: ; 96f77
|
2015-01-20 00:01:23 -08:00
|
|
|
callasm Function96f76
|
|
|
|
writetext ReceivedItemText
|
2013-07-04 01:11:45 -07:00
|
|
|
iffalse .Full
|
|
|
|
waitbutton
|
|
|
|
specialsound
|
|
|
|
closetext
|
|
|
|
itemnotify
|
|
|
|
end
|
|
|
|
|
|
|
|
.Full
|
|
|
|
keeptextopen
|
|
|
|
pocketisfull
|
|
|
|
end
|
|
|
|
; 96f89
|
|
|
|
|
|
|
|
ReceivedItemText: ; 96f89
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c4719
|
2013-07-04 01:11:45 -07:00
|
|
|
db "@"
|
|
|
|
; 96f8e
|
|
|
|
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_verbosegiveitem2: ; 0x96f8e
|
|
|
|
; script command 0x9f
|
|
|
|
; parameters:
|
|
|
|
; item (ItemLabelByte)
|
|
|
|
; var (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
cp -1
|
2014-05-21 13:21:46 -07:00
|
|
|
jr nz, .ok
|
|
|
|
ld a, [ScriptVar]
|
|
|
|
.ok
|
|
|
|
ld [CurItem], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetVarAction
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, [de]
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd10c], a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld hl, NumItems
|
2013-09-07 22:35:10 -07:00
|
|
|
call ReceiveItem
|
2015-07-15 12:48:44 -07:00
|
|
|
ld a, 1
|
2014-05-21 13:21:46 -07:00
|
|
|
jr c, .ok2
|
2013-02-27 21:31:12 -08:00
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
.ok2
|
|
|
|
ld [ScriptVar], a
|
2013-07-04 01:11:45 -07:00
|
|
|
call CurItemName
|
|
|
|
ld de, StringBuffer1
|
2015-07-15 12:48:44 -07:00
|
|
|
ld a, 1
|
|
|
|
call CopyConvertedText
|
2013-07-04 01:11:45 -07:00
|
|
|
ld b, BANK(GiveItemScript)
|
|
|
|
ld de, GiveItemScript
|
|
|
|
jp ScriptCall
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x96fc6
|
|
|
|
|
|
|
|
Script_itemnotify: ; 0x96fc6
|
|
|
|
; script command 0x45
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
call GetPocketName
|
|
|
|
call CurItemName
|
|
|
|
ld b, BANK(PutItemInPocketText)
|
|
|
|
ld hl, PutItemInPocketText
|
2015-07-15 12:48:44 -07:00
|
|
|
call MapTextbox
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96fd5
|
|
|
|
|
|
|
|
Script_pocketisfull: ; 0x96fd5
|
|
|
|
; script command 0x46
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
call GetPocketName
|
|
|
|
call CurItemName
|
|
|
|
ld b, BANK(PocketIsFullText)
|
|
|
|
ld hl, PocketIsFullText
|
2015-07-15 12:48:44 -07:00
|
|
|
call MapTextbox
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96fe4
|
|
|
|
|
|
|
|
Script_specialsound: ; 0x96fe4
|
|
|
|
; script command 0x88
|
|
|
|
|
2013-10-01 18:20:48 -07:00
|
|
|
callba CheckItemPocket
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [wd142]
|
2013-05-02 17:27:39 -07:00
|
|
|
cp TM_HM
|
|
|
|
ld de, SFX_GET_TM
|
|
|
|
jr z, .play
|
|
|
|
ld de, SFX_ITEM
|
|
|
|
.play
|
2013-10-08 10:10:36 -07:00
|
|
|
call PlaySFX
|
2013-05-02 17:27:39 -07:00
|
|
|
call WaitSFX
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x96ffe
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
|
|
|
|
GetPocketName: ; 96ffe
|
|
|
|
callba CheckItemPocket
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [wd142]
|
2013-07-04 01:11:45 -07:00
|
|
|
dec a
|
|
|
|
ld hl, .Pockets
|
|
|
|
and 3
|
|
|
|
add a
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, [hl]
|
|
|
|
ld e, a
|
|
|
|
ld hl, StringBuffer3
|
|
|
|
call CopyName2
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Pockets
|
|
|
|
dw .Item
|
|
|
|
dw .Key
|
|
|
|
dw .Ball
|
|
|
|
dw .TM
|
|
|
|
|
|
|
|
.Item
|
|
|
|
db "ITEM POCKET@"
|
|
|
|
.Key
|
|
|
|
db "KEY POCKET@"
|
|
|
|
.Ball
|
|
|
|
db "BALL POCKET@"
|
|
|
|
.TM
|
|
|
|
db "TM POCKET@"
|
|
|
|
; 97051
|
|
|
|
|
|
|
|
CurItemName: ; 97051
|
|
|
|
ld a, [CurItem]
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd265], a
|
2013-07-04 01:11:45 -07:00
|
|
|
call GetItemName
|
|
|
|
ret
|
|
|
|
; 9705b
|
|
|
|
|
|
|
|
|
|
|
|
PutItemInPocketText: ; 9705b
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c472c
|
2013-07-04 01:11:45 -07:00
|
|
|
db "@"
|
|
|
|
; 97060
|
|
|
|
|
|
|
|
PocketIsFullText: ; 97060
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c474b
|
2013-07-04 01:11:45 -07:00
|
|
|
db "@"
|
|
|
|
; 97065
|
|
|
|
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_pokemart: ; 0x97065
|
|
|
|
; script command 0x94
|
|
|
|
; parameters:
|
|
|
|
; dialog_id (SingleByteParam)
|
|
|
|
; mart_id (MultiByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-10-01 18:20:48 -07:00
|
|
|
callba OpenMartDialog
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x9707c
|
|
|
|
|
|
|
|
Script_elevator: ; 0x9707c
|
|
|
|
; script command 0x95
|
|
|
|
; parameters:
|
|
|
|
; floor_list_pointer (PointerLabelParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2015-07-15 12:48:44 -07:00
|
|
|
callba Elevator
|
2013-02-27 21:31:12 -08:00
|
|
|
ret c
|
|
|
|
ld a, $1
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97099
|
|
|
|
|
|
|
|
Script_trade: ; 0x97099
|
|
|
|
; script command 0x96
|
|
|
|
; parameters:
|
|
|
|
; trade_id (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-12-27 19:20:24 -08:00
|
|
|
callba NPCTrade
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x970a4
|
|
|
|
|
|
|
|
Script_phonecall: ; 0x970a4
|
|
|
|
; script command 0x98
|
|
|
|
; parameters:
|
|
|
|
; caller_name (RawTextPointerLabelParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2015-07-15 12:48:44 -07:00
|
|
|
callba PhoneCall
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x970b7
|
|
|
|
|
|
|
|
Script_hangup: ; 0x970b7
|
|
|
|
; script command 0x99
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
callba HangUp
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x970be
|
|
|
|
|
|
|
|
Script_askforphonenumber: ; 0x970be
|
|
|
|
; script command 0x97
|
|
|
|
; parameters:
|
|
|
|
; number (SingleByteParam)
|
|
|
|
|
2013-12-03 23:49:12 -08:00
|
|
|
call YesNoBox
|
2015-07-15 12:48:44 -07:00
|
|
|
jr c, .refused ; 0x970c1 $13
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
2015-07-15 12:48:44 -07:00
|
|
|
callba AddPhoneNumber
|
|
|
|
jr c, .phonefull ; 0x970cd $3
|
2013-02-27 21:31:12 -08:00
|
|
|
xor a
|
2015-07-15 12:48:44 -07:00
|
|
|
jr .done ; 0x970d0 $9
|
|
|
|
.phonefull
|
|
|
|
ld a, 1
|
|
|
|
jr .done ; 0x970d4 $5
|
|
|
|
.refused
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
ld a, 2
|
|
|
|
.done
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x970df
|
|
|
|
|
|
|
|
Script_describedecoration: ; 0x970df
|
|
|
|
; script command 0x9a
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2015-07-15 12:48:44 -07:00
|
|
|
callba DescribeDecoration
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, d
|
|
|
|
ld l, e
|
2013-05-03 11:27:24 -07:00
|
|
|
jp ScriptJump
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x970ee
|
|
|
|
|
|
|
|
Script_fruittree: ; 0x970ee
|
|
|
|
; script command 0x9b
|
|
|
|
; parameters:
|
|
|
|
; tree_id (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-05-03 12:40:45 -07:00
|
|
|
ld [CurFruitTree], a
|
|
|
|
ld b, BANK(FruitTreeScript)
|
|
|
|
ld hl, FruitTreeScript
|
2013-05-03 11:27:24 -07:00
|
|
|
jp ScriptJump
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x970fc
|
|
|
|
|
|
|
|
Script_loadwilddata: ; 0x970fc
|
|
|
|
; script command 0xa0
|
|
|
|
; parameters:
|
2014-07-22 22:05:06 -07:00
|
|
|
; flag (SingleByteParam)
|
2013-02-27 21:31:12 -08:00
|
|
|
; map_group (MapGroupParam)
|
|
|
|
; map_id (MapIdParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2015-07-15 12:48:44 -07:00
|
|
|
callba LoadWildData
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x9710f
|
|
|
|
|
|
|
|
Script_trainertext: ; 0x9710f
|
|
|
|
; script command 0x62
|
|
|
|
; parameters:
|
|
|
|
; which_text (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
2015-07-15 12:48:44 -07:00
|
|
|
ld b, 0
|
2015-02-10 15:14:21 -08:00
|
|
|
ld hl, WalkingX
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-02-27 21:31:12 -08:00
|
|
|
add hl, bc
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [EngineBuffer1]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2015-07-15 12:48:44 -07:00
|
|
|
call MapTextbox
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97125
|
|
|
|
|
|
|
|
Script_scripttalkafter: ; 0x97125
|
|
|
|
; script command 0x65
|
|
|
|
|
2015-02-10 15:14:21 -08:00
|
|
|
ld hl, wd04b
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [EngineBuffer1]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-05-03 11:27:24 -07:00
|
|
|
jp ScriptJump
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97132
|
|
|
|
|
|
|
|
Script_trainerstatus: ; 0x97132
|
|
|
|
; script command 0x63
|
|
|
|
; parameters:
|
|
|
|
; action (SingleByteParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2015-02-10 15:14:21 -08:00
|
|
|
ld hl, wd041
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-08-23 12:48:26 -07:00
|
|
|
call EventFlagAction
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
ret z
|
2015-07-15 12:48:44 -07:00
|
|
|
ld a, 1
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x9714c
|
|
|
|
|
|
|
|
Script_winlosstext: ; 0x9714c
|
|
|
|
; script command 0x64
|
|
|
|
; parameters:
|
|
|
|
; win_text_pointer (TextPointerLabelParam)
|
|
|
|
; loss_text_pointer (TextPointerLabelParam)
|
|
|
|
|
2015-07-18 20:45:39 -07:00
|
|
|
ld hl, wWinTextPointer ; d047
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [hli], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [hli], a
|
2015-07-18 20:45:39 -07:00
|
|
|
ld hl, wLossTextPointer ; d049; this is unnecessary
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [hli], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [hli], a
|
|
|
|
ret
|
|
|
|
; 0x97163
|
|
|
|
|
|
|
|
Script_talkaftercancel: ; 0x97163
|
|
|
|
; script command 0x66
|
|
|
|
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [wd04d]
|
2013-02-27 21:31:12 -08:00
|
|
|
and a
|
|
|
|
ret z
|
2013-07-04 02:37:20 -07:00
|
|
|
jp Script_end
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x9716b
|
|
|
|
|
|
|
|
Script_talkaftercheck: ; 0x9716b
|
|
|
|
; script command 0x67
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
ld a, 1
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [wd04d]
|
2013-02-27 21:31:12 -08:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x9717a
|
|
|
|
|
|
|
|
Script_playrammusic: ; 0x9717a
|
|
|
|
; script command 0x80
|
|
|
|
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [OtherTrainerClass]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-10-01 18:20:48 -07:00
|
|
|
callba PlayTrainerEncounterMusic
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97185
|
|
|
|
|
|
|
|
Script_playmapmusic: ; 0x97185
|
|
|
|
; script command 0x82
|
|
|
|
|
2014-05-21 13:21:46 -07:00
|
|
|
call PlayMapMusic
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97189
|
|
|
|
|
|
|
|
Script_playmusic: ; 0x97189
|
|
|
|
; script command 0x7f
|
|
|
|
; parameters:
|
|
|
|
; music_pointer (MultiByteParam)
|
|
|
|
|
2014-05-21 13:21:46 -07:00
|
|
|
ld de, MUSIC_NONE
|
2013-10-08 10:21:15 -07:00
|
|
|
call PlayMusic
|
2013-02-27 21:31:12 -08:00
|
|
|
xor a
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [MusicFade], a
|
2013-02-27 21:31:12 -08:00
|
|
|
call MaxVolume
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2013-10-08 10:21:15 -07:00
|
|
|
call PlayMusic
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x971a2
|
|
|
|
|
|
|
|
Script_musicfadeout: ; 0x971a2
|
|
|
|
; script command 0x81
|
|
|
|
; parameters:
|
|
|
|
; music (MultiByteParam)
|
|
|
|
; fadetime (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [MusicFadeID], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [MusicFadeID + 1], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
and $7f
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [MusicFade], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x971b7
|
|
|
|
|
|
|
|
Script_playsound: ; 0x971b7
|
|
|
|
; script command 0x85
|
|
|
|
; parameters:
|
|
|
|
; sound_pointer (MultiByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2013-10-08 10:10:36 -07:00
|
|
|
call PlaySFX
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x971c3
|
|
|
|
|
|
|
|
Script_waitbutton: ; 0x971c3
|
|
|
|
; script command 0x86
|
|
|
|
|
2013-05-02 17:27:39 -07:00
|
|
|
call WaitSFX
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x971c7
|
|
|
|
|
|
|
|
Script_warpsound: ; 0x971c7
|
|
|
|
; script command 0x87
|
|
|
|
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Function14a07
|
2013-10-08 10:10:36 -07:00
|
|
|
call PlaySFX
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x971d1
|
|
|
|
|
|
|
|
Script_cry: ; 0x971d1
|
|
|
|
; script command 0x84
|
|
|
|
; parameters:
|
|
|
|
; cry_id (MultiByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
push af
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
pop af
|
|
|
|
and a
|
2014-07-18 10:25:03 -07:00
|
|
|
jr nz, .ok
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, [ScriptVar]
|
2014-07-18 10:25:03 -07:00
|
|
|
.ok
|
|
|
|
call PlayCry
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x971e3
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
GetScriptPerson: ; 0x971e3
|
2013-07-04 01:11:45 -07:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
cp $fe
|
|
|
|
ret z
|
|
|
|
dec a
|
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x971ea
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_setlasttalked: ; 0x971ea
|
|
|
|
; script command 0x68
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetScriptPerson
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [$ffe0], a
|
|
|
|
ret
|
|
|
|
; 0x971f3
|
|
|
|
|
|
|
|
Script_applymovement: ; 0x971f3
|
|
|
|
; script command 0x69
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
; data (MovementPointerLabelParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetScriptPerson
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
2013-07-19 23:27:48 -07:00
|
|
|
; 971fa
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
ApplyMovement: ; 971fa
|
2013-02-27 21:31:12 -08:00
|
|
|
push bc
|
|
|
|
ld a, c
|
2015-07-15 12:48:44 -07:00
|
|
|
callba SetFlagsForMovement_1
|
2013-02-27 21:31:12 -08:00
|
|
|
pop bc
|
|
|
|
push bc
|
2015-07-15 12:48:44 -07:00
|
|
|
call SetFlagsForMovement_2
|
2013-02-27 21:31:12 -08:00
|
|
|
pop bc
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetMovementData
|
2013-02-27 21:31:12 -08:00
|
|
|
ret c
|
2013-07-04 02:37:20 -07:00
|
|
|
ld a, SCRIPT_WAIT_MOVEMENT
|
|
|
|
ld [ScriptMode], a
|
|
|
|
call StopScript
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97221
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
SetFlagsForMovement_2: ; 0x97221
|
|
|
|
callba _SetFlagsForMovement_2
|
2013-07-04 01:11:45 -07:00
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x97228
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_applymovement2: ; 0x97228
|
|
|
|
; script command 0x6a
|
|
|
|
; parameters:
|
|
|
|
; data (MovementPointerLabelParam)
|
|
|
|
|
|
|
|
ld a, [$ffe0]
|
|
|
|
ld c, a
|
2015-07-15 12:48:44 -07:00
|
|
|
jp ApplyMovement
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x9722e
|
|
|
|
|
|
|
|
Script_faceplayer: ; 0x9722e
|
|
|
|
; script command 0x6b
|
|
|
|
|
|
|
|
ld a, [$ffe0]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld d, $0
|
|
|
|
ld a, [$ffe0]
|
|
|
|
ld e, a
|
2015-07-15 12:48:44 -07:00
|
|
|
callba GetRelativeFacing
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, d
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-02-27 21:31:12 -08:00
|
|
|
add a
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
|
|
|
ld a, [$ffe0]
|
|
|
|
ld d, a
|
2015-07-15 12:48:44 -07:00
|
|
|
call ApplyPersonFacing
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97248
|
|
|
|
|
|
|
|
Script_faceperson: ; 0x97248
|
|
|
|
; script command 0x6c
|
|
|
|
; parameters:
|
|
|
|
; person1 (SingleByteParam)
|
|
|
|
; person2 (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetScriptPerson
|
2013-02-27 21:31:12 -08:00
|
|
|
cp $fe
|
|
|
|
jr c, .asm_97254 ; 0x97250 $2
|
|
|
|
ld a, [$ffe0]
|
|
|
|
.asm_97254
|
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetScriptPerson
|
2013-02-27 21:31:12 -08:00
|
|
|
cp $fe
|
|
|
|
jr nz, .asm_97261 ; 0x9725d $2
|
|
|
|
ld a, [$ffe0]
|
|
|
|
.asm_97261
|
|
|
|
ld d, a
|
|
|
|
push de
|
2015-07-15 12:48:44 -07:00
|
|
|
callba GetRelativeFacing
|
2013-02-27 21:31:12 -08:00
|
|
|
pop bc
|
|
|
|
ret c
|
|
|
|
ld a, d
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-02-27 21:31:12 -08:00
|
|
|
add a
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
|
|
|
ld d, c
|
2015-07-15 12:48:44 -07:00
|
|
|
call ApplyPersonFacing
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97274
|
|
|
|
|
|
|
|
Script_spriteface: ; 0x97274
|
|
|
|
; script command 0x76
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
; facing (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetScriptPerson
|
2013-02-27 21:31:12 -08:00
|
|
|
cp $fe
|
|
|
|
jr nz, .asm_97280 ; 0x9727c $2
|
|
|
|
ld a, [$ffe0]
|
|
|
|
.asm_97280
|
|
|
|
ld d, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-02-27 21:31:12 -08:00
|
|
|
add a
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2015-07-15 12:48:44 -07:00
|
|
|
call ApplyPersonFacing
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x9728b
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
ApplyPersonFacing: ; 0x9728b
|
2013-07-04 01:11:45 -07:00
|
|
|
ld a, d
|
|
|
|
push de
|
2013-08-29 20:20:09 -07:00
|
|
|
call Function18de
|
2015-07-15 12:48:44 -07:00
|
|
|
jr c, .not_visible ; 0x97290 $27
|
|
|
|
ld hl, OBJECT_SPRITE
|
2013-07-04 01:11:45 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
push bc
|
2013-08-29 20:20:09 -07:00
|
|
|
call Function1836
|
2013-07-04 01:11:45 -07:00
|
|
|
pop bc
|
2015-07-15 12:48:44 -07:00
|
|
|
jr c, .not_visible ; 0x9729c $1b
|
|
|
|
ld hl, OBJECT_04
|
2013-07-04 01:11:45 -07:00
|
|
|
add hl, bc
|
|
|
|
bit 2, [hl]
|
2015-07-15 12:48:44 -07:00
|
|
|
jr nz, .not_visible ; 0x972a4 $13
|
2013-07-04 01:11:45 -07:00
|
|
|
pop de
|
|
|
|
ld a, e
|
2015-07-15 12:48:44 -07:00
|
|
|
call SetSpriteDirection
|
2015-02-10 15:14:21 -08:00
|
|
|
ld hl, VramState
|
2013-07-04 01:11:45 -07:00
|
|
|
bit 6, [hl]
|
|
|
|
jr nz, .asm_972b5 ; 0x972b0 $3
|
2014-05-21 13:21:46 -07:00
|
|
|
call Function972bc
|
2013-02-28 13:28:29 -08:00
|
|
|
.asm_972b5
|
2015-07-22 12:57:02 -07:00
|
|
|
call UpdateSprites
|
2013-07-04 01:11:45 -07:00
|
|
|
ret
|
2015-07-15 12:48:44 -07:00
|
|
|
.not_visible
|
2013-07-04 01:11:45 -07:00
|
|
|
pop de
|
|
|
|
scf
|
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x972bc
|
|
|
|
|
2014-05-21 13:21:46 -07:00
|
|
|
Function972bc: ; 0x972bc
|
2013-08-29 20:20:09 -07:00
|
|
|
call Function217a
|
2015-07-22 12:57:02 -07:00
|
|
|
hlcoord 0, 0
|
|
|
|
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
|
2013-02-28 13:28:29 -08:00
|
|
|
.asm_972c5
|
2013-07-04 01:11:45 -07:00
|
|
|
res 7, [hl]
|
|
|
|
inc hl
|
|
|
|
dec bc
|
|
|
|
ld a, b
|
|
|
|
or c
|
|
|
|
jr nz, .asm_972c5 ; 0x972cb $f8
|
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x972ce
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_variablesprite: ; 0x972ce
|
|
|
|
; script command 0x6d
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
; sprite (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
2015-02-10 15:14:21 -08:00
|
|
|
ld hl, VariableSprites
|
2013-02-27 21:31:12 -08:00
|
|
|
add hl, de
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 0x972dd
|
|
|
|
|
|
|
|
Script_appear: ; 0x972dd
|
|
|
|
; script command 0x6f
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetScriptPerson
|
2015-07-18 12:46:38 -07:00
|
|
|
call _CopyObjectStruct
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, [$ffaf]
|
2015-07-18 12:46:38 -07:00
|
|
|
ld b, 0 ; clear
|
|
|
|
call ApplyEventActionAppearDisappear
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x972ee
|
|
|
|
|
|
|
|
Script_disappear: ; 0x972ee
|
|
|
|
; script command 0x6e
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetScriptPerson
|
2015-07-18 12:46:38 -07:00
|
|
|
cp -2
|
|
|
|
jr nz, .skip ; 0x972f6 $2
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, [$ffe0]
|
2015-07-18 12:46:38 -07:00
|
|
|
.skip
|
|
|
|
call DeleteObjectStruct
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, [$ffaf]
|
2015-07-18 12:46:38 -07:00
|
|
|
ld b, 1 ; set
|
|
|
|
call ApplyEventActionAppearDisappear
|
|
|
|
callba RefreshMapAppearDisappear
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x9730b
|
|
|
|
|
2015-07-18 12:46:38 -07:00
|
|
|
ApplyEventActionAppearDisappear: ; 0x9730b
|
2013-07-04 01:11:45 -07:00
|
|
|
push bc
|
2013-08-29 20:20:09 -07:00
|
|
|
call GetMapObject
|
2015-07-18 12:46:38 -07:00
|
|
|
ld hl, MAPOBJECT_EVENT_FLAG
|
2013-07-04 01:11:45 -07:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2015-07-18 12:46:38 -07:00
|
|
|
ld a, -1
|
2013-07-04 01:11:45 -07:00
|
|
|
cp e
|
2015-07-18 12:46:38 -07:00
|
|
|
jr nz, .okay ; 0x9731a $5
|
2013-07-04 01:11:45 -07:00
|
|
|
cp d
|
2015-07-18 12:46:38 -07:00
|
|
|
jr nz, .okay ; 0x9731d $2
|
2013-07-04 01:11:45 -07:00
|
|
|
xor a
|
|
|
|
ret
|
2015-07-18 12:46:38 -07:00
|
|
|
.okay
|
2013-08-23 12:48:26 -07:00
|
|
|
call EventFlagAction
|
2013-07-04 01:11:45 -07:00
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x97325
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_follow: ; 0x97325
|
|
|
|
; script command 0x70
|
|
|
|
; parameters:
|
|
|
|
; person2 (SingleByteParam)
|
|
|
|
; person1 (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetScriptPerson
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetScriptPerson
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Function5803
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x9733a
|
|
|
|
|
|
|
|
Script_stopfollow: ; 0x9733a
|
|
|
|
; script command 0x71
|
|
|
|
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Function581f
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97341
|
|
|
|
|
|
|
|
Script_moveperson: ; 0x97341
|
|
|
|
; script command 0x72
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
; x (SingleByteParam)
|
|
|
|
; y (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetScriptPerson
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
add $4
|
|
|
|
ld d, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
add $4
|
|
|
|
ld e, a
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Function807e
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x9735b
|
|
|
|
|
|
|
|
Script_writepersonxy: ; 0x9735b
|
|
|
|
; script command 0x73
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetScriptPerson
|
2013-02-27 21:31:12 -08:00
|
|
|
cp $fe
|
|
|
|
jr nz, .asm_97367 ; 0x97363 $2
|
|
|
|
ld a, [$ffe0]
|
|
|
|
.asm_97367
|
|
|
|
ld b, a
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Function80a1
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x9736f
|
|
|
|
|
|
|
|
Script_follownotexact: ; 0x9736f
|
|
|
|
; script command 0x77
|
|
|
|
; parameters:
|
|
|
|
; person2 (SingleByteParam)
|
|
|
|
; person1 (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetScriptPerson
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetScriptPerson
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Function839e
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97384
|
|
|
|
|
|
|
|
Script_loademote: ; 0x97384
|
|
|
|
; script command 0x74
|
|
|
|
; parameters:
|
|
|
|
; bubble (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
cp $ff
|
|
|
|
jr nz, .asm_9738e ; 0x97389 $3
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, [ScriptVar]
|
2013-02-27 21:31:12 -08:00
|
|
|
.asm_9738e
|
|
|
|
ld c, a
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Function1442f
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97396
|
|
|
|
|
|
|
|
Script_showemote: ; 0x97396
|
|
|
|
; script command 0x75
|
|
|
|
; parameters:
|
|
|
|
; bubble (SingleByteParam)
|
|
|
|
; person (SingleByteParam)
|
|
|
|
; time (DecimalParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetScriptPerson
|
2013-02-27 21:31:12 -08:00
|
|
|
cp $fe
|
|
|
|
jr z, .asm_973a8 ; 0x973a4 $2
|
|
|
|
ld [$ffe0], a
|
|
|
|
.asm_973a8
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-07-04 02:37:20 -07:00
|
|
|
ld [ScriptDelay], a
|
2013-07-04 01:11:45 -07:00
|
|
|
ld b, BANK(ShowEmoteScript)
|
|
|
|
ld de, ShowEmoteScript
|
|
|
|
jp ScriptCall
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x973b6
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
ShowEmoteScript: ; 973b6
|
|
|
|
loademote $ff
|
|
|
|
applymovement2 .Show
|
|
|
|
pause 0
|
|
|
|
applymovement2 .Hide
|
|
|
|
end
|
|
|
|
|
|
|
|
.Show
|
|
|
|
show_emote
|
|
|
|
show_person
|
|
|
|
step_end
|
|
|
|
|
|
|
|
.Hide
|
|
|
|
hide_emote
|
|
|
|
show_person
|
|
|
|
step_end
|
|
|
|
; 973c7
|
|
|
|
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_earthquake: ; 0x973c7
|
|
|
|
; script command 0x78
|
|
|
|
; parameters:
|
|
|
|
; param (DecimalParam)
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
ld hl, EarthquakeMovement
|
2015-02-10 15:14:21 -08:00
|
|
|
ld de, wd002
|
2013-07-04 01:11:45 -07:00
|
|
|
ld bc, EarthquakeMovementEnd - EarthquakeMovement
|
2013-02-27 21:31:12 -08:00
|
|
|
call CopyBytes
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd003], a
|
2013-02-27 21:31:12 -08:00
|
|
|
and $3f
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd005], a
|
2013-07-04 01:11:45 -07:00
|
|
|
ld b, BANK(UnknownScript_0x973e6)
|
|
|
|
ld de, UnknownScript_0x973e6
|
|
|
|
jp ScriptCall
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x973e6
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
UnknownScript_0x973e6: ; 973e6
|
2015-02-10 15:14:21 -08:00
|
|
|
applymovement $0, wd002
|
2013-07-04 01:11:45 -07:00
|
|
|
end
|
|
|
|
; 973eb
|
|
|
|
|
|
|
|
EarthquakeMovement: ; 973eb
|
|
|
|
step_shake 16
|
|
|
|
step_sleep 16
|
|
|
|
step_end
|
|
|
|
EarthquakeMovementEnd
|
|
|
|
; 973f0
|
|
|
|
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_loadpikachudata: ; 0x973f0
|
|
|
|
; script command 0x5a
|
|
|
|
|
2015-05-18 02:16:11 -07:00
|
|
|
ld a, PIKACHU
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd22e], a
|
2015-05-18 02:16:11 -07:00
|
|
|
ld a, 5
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [CurPartyLevel], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x973fb
|
|
|
|
|
|
|
|
Script_battlecheck: ; 0x973fb
|
|
|
|
; script command 0x5b
|
|
|
|
|
|
|
|
xor a
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd459], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97400
|
|
|
|
|
|
|
|
Script_loadtrainerdata: ; 0x97400
|
|
|
|
; script command 0x5c
|
|
|
|
|
|
|
|
ld a, $81
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd459], a
|
|
|
|
ld a, [WalkingDirection]
|
|
|
|
ld [OtherTrainerClass], a
|
|
|
|
ld a, [FacingDirection]
|
|
|
|
ld [OtherTrainerID], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97412
|
|
|
|
|
|
|
|
Script_loadpokedata: ; 0x97412
|
|
|
|
; script command 0x5d
|
|
|
|
; parameters:
|
|
|
|
; pokemon (PokemonParam)
|
|
|
|
; level (DecimalParam)
|
|
|
|
|
|
|
|
ld a, $80
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd459], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd22e], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [CurPartyLevel], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97424
|
|
|
|
|
|
|
|
Script_loadtrainer: ; 0x97424
|
|
|
|
; script command 0x5e
|
|
|
|
; parameters:
|
|
|
|
; trainer_group (TrainerGroupParam)
|
|
|
|
; trainer_id (TrainerIdParam)
|
|
|
|
|
|
|
|
ld a, $81
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd459], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [OtherTrainerClass], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [OtherTrainerID], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97436
|
|
|
|
|
|
|
|
Script_startbattle: ; 0x97436
|
|
|
|
; script command 0x5f
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
call BufferScreen
|
2014-06-16 11:20:01 -07:00
|
|
|
predef StartBattle
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [wd0ee]
|
2013-02-27 21:31:12 -08:00
|
|
|
and $3f
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97447
|
|
|
|
|
|
|
|
Script_catchtutorial: ; 0x97447
|
|
|
|
; script command 0x61
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-06-17 11:58:11 -07:00
|
|
|
ld [BattleType], a
|
2015-07-15 12:48:44 -07:00
|
|
|
call BufferScreen
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Function4e554
|
2013-07-04 01:11:45 -07:00
|
|
|
jp Script_reloadmap
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97459
|
|
|
|
|
|
|
|
Script_returnafterbattle: ; 0x97459
|
|
|
|
; script command 0x60
|
|
|
|
|
2015-02-10 15:14:21 -08:00
|
|
|
ld hl, wd459
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, [hl]
|
|
|
|
ld [hl], $0
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [wd0ee]
|
2013-02-27 21:31:12 -08:00
|
|
|
and $3f
|
|
|
|
cp $1
|
|
|
|
jr nz, .asm_97470 ; 0x97466 $8
|
2014-03-01 07:18:26 -08:00
|
|
|
ld b, BANK(UnknownScript_0x124c1)
|
|
|
|
ld hl, UnknownScript_0x124c1
|
2013-05-03 11:27:24 -07:00
|
|
|
jp ScriptJump
|
2013-02-27 21:31:12 -08:00
|
|
|
.asm_97470
|
|
|
|
bit 0, d
|
|
|
|
jr z, .asm_9747c ; 0x97472 $8
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Functionfcfec
|
2013-02-27 21:31:12 -08:00
|
|
|
jr .asm_9748e ; 0x9747a $12
|
|
|
|
.asm_9747c
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [wd0ee]
|
2013-02-27 21:31:12 -08:00
|
|
|
bit 7, a
|
|
|
|
jr z, .asm_9748e ; 0x97481 $b
|
2014-06-17 11:58:11 -07:00
|
|
|
ld b, BANK(UnknownScript_0x90255)
|
|
|
|
ld de, UnknownScript_0x90255
|
2013-07-19 23:27:48 -07:00
|
|
|
callba Function97c4f
|
2013-02-27 21:31:12 -08:00
|
|
|
.asm_9748e
|
2013-07-04 01:11:45 -07:00
|
|
|
jp Script_reloadmap
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97491
|
|
|
|
|
|
|
|
Script_reloadmap: ; 0x97491
|
|
|
|
; script command 0x7b
|
|
|
|
|
|
|
|
xor a
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd459], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, $f3
|
|
|
|
ld [$ff9f], a
|
|
|
|
ld a, $1
|
2015-07-15 12:48:44 -07:00
|
|
|
call LoadMapStatus
|
2013-07-04 02:37:20 -07:00
|
|
|
call StopScript
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x974a2
|
|
|
|
|
|
|
|
Script_2call: ; 0x974a2
|
|
|
|
; script command 0x0
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2013-02-27 23:16:08 -08:00
|
|
|
jr ScriptCall
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x974b0
|
|
|
|
|
|
|
|
Script_3call: ; 0x974b0
|
|
|
|
; script command 0x1
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelBeforeBank)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2013-02-27 23:16:08 -08:00
|
|
|
jr ScriptCall
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x974be
|
|
|
|
|
|
|
|
Script_2ptcall: ; 0x974be
|
|
|
|
; script command 0x2
|
|
|
|
; parameters:
|
|
|
|
; pointer (PointerLabelToScriptPointer)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
|
|
|
ld b, [hl]
|
|
|
|
inc hl
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2013-02-27 23:16:08 -08:00
|
|
|
; fallthrough
|
2013-02-27 21:31:12 -08:00
|
|
|
|
2013-02-27 23:16:08 -08:00
|
|
|
ScriptCall: ; 0x974cb
|
2013-02-27 21:31:12 -08:00
|
|
|
push de
|
2015-02-10 15:14:21 -08:00
|
|
|
ld hl, wd43c
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, [hl]
|
|
|
|
inc [hl]
|
|
|
|
ld d, $0
|
2015-02-10 15:14:21 -08:00
|
|
|
ld hl, wd43d
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 3
|
2013-02-27 21:31:12 -08:00
|
|
|
add hl, de
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-02-27 21:31:12 -08:00
|
|
|
pop de
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [hli], a
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptPos]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [hli], a
|
2013-05-03 11:27:24 -07:00
|
|
|
ld a, [ScriptPos + 1]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [hl], a
|
|
|
|
ld a, b
|
2013-02-28 18:39:40 -08:00
|
|
|
ld [ScriptBank], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, e
|
2013-02-28 18:39:40 -08:00
|
|
|
ld [ScriptPos], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, d
|
2013-05-03 11:27:24 -07:00
|
|
|
ld [ScriptPos + 1], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x974f3
|
|
|
|
|
2014-05-21 13:21:46 -07:00
|
|
|
Function974f3:: ; 0x974f3
|
2013-07-04 01:11:45 -07:00
|
|
|
ld a, [ScriptBank]
|
|
|
|
or $80
|
|
|
|
ld [ScriptBank], a
|
|
|
|
jp ScriptCall
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x974fe
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_2jump: ; 0x974fe
|
|
|
|
; script command 0x3
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-05-03 11:27:24 -07:00
|
|
|
jp ScriptJump
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x9750d
|
|
|
|
|
|
|
|
Script_3jump: ; 0x9750d
|
|
|
|
; script command 0x4
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelBeforeBank)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
2013-05-03 11:27:24 -07:00
|
|
|
jp ScriptJump
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x9751c
|
|
|
|
|
|
|
|
Script_2ptjump: ; 0x9751c
|
|
|
|
; script command 0x5
|
|
|
|
; parameters:
|
|
|
|
; pointer (PointerLabelToScriptPointer)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
|
|
|
ld b, [hl]
|
|
|
|
inc hl
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2013-05-03 11:27:24 -07:00
|
|
|
jp ScriptJump
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x9752c
|
|
|
|
|
|
|
|
Script_iffalse: ; 0x9752c
|
|
|
|
; script command 0x8
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, [ScriptVar]
|
2013-02-27 21:31:12 -08:00
|
|
|
and a
|
2013-07-04 01:11:45 -07:00
|
|
|
jp nz, SkipTwoScriptBytes
|
2013-02-27 23:16:08 -08:00
|
|
|
jp Script_2jump
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97536
|
|
|
|
|
|
|
|
Script_iftrue: ; 0x97536
|
|
|
|
; script command 0x9
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, [ScriptVar]
|
2013-02-27 21:31:12 -08:00
|
|
|
and a
|
2013-02-27 23:16:08 -08:00
|
|
|
jp nz, Script_2jump
|
2013-07-04 01:11:45 -07:00
|
|
|
jp SkipTwoScriptBytes
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97540
|
|
|
|
|
|
|
|
Script_if_equal: ; 0x97540
|
|
|
|
; script command 0x6
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld hl, ScriptVar
|
2013-02-27 21:31:12 -08:00
|
|
|
cp [hl]
|
|
|
|
jr z, Script_2jump ; 0x97547 $b5
|
2013-07-04 01:11:45 -07:00
|
|
|
jr SkipTwoScriptBytes ; 0x97549 $4b
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x9754b
|
|
|
|
|
|
|
|
Script_if_not_equal: ; 0x9754b
|
|
|
|
; script command 0x7
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld hl, ScriptVar
|
2013-02-27 21:31:12 -08:00
|
|
|
cp [hl]
|
|
|
|
jr nz, Script_2jump ; 0x97552 $aa
|
2013-07-04 01:11:45 -07:00
|
|
|
jr SkipTwoScriptBytes ; 0x97554 $40
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97556
|
|
|
|
|
2013-09-26 15:40:20 -07:00
|
|
|
Script_if_greater_than: ; 0x97556
|
2013-02-27 21:31:12 -08:00
|
|
|
; script command 0xa
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, [ScriptVar]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
cp b
|
|
|
|
jr c, Script_2jump ; 0x9755e $9e
|
2013-07-04 01:11:45 -07:00
|
|
|
jr SkipTwoScriptBytes ; 0x97560 $34
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97562
|
|
|
|
|
2013-09-26 15:40:20 -07:00
|
|
|
Script_if_less_than: ; 0x97562
|
2013-02-27 21:31:12 -08:00
|
|
|
; script command 0xb
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, [ScriptVar]
|
2013-02-27 21:31:12 -08:00
|
|
|
cp b
|
|
|
|
jr c, Script_2jump ; 0x9756a $92
|
2013-07-04 01:11:45 -07:00
|
|
|
jr SkipTwoScriptBytes ; 0x9756c $28
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x9756e
|
|
|
|
|
|
|
|
Script_jumpstd: ; 0x9756e
|
|
|
|
; script command 0xc
|
|
|
|
; parameters:
|
|
|
|
; predefined_script (MultiByteParam)
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
call StdScript
|
2013-05-03 11:27:24 -07:00
|
|
|
jr ScriptJump ; 0x97571 $2a
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97573
|
|
|
|
|
|
|
|
Script_callstd: ; 0x97573
|
|
|
|
; script command 0xd
|
|
|
|
; parameters:
|
|
|
|
; predefined_script (MultiByteParam)
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
call StdScript
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2013-07-04 01:11:45 -07:00
|
|
|
jp ScriptCall
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x9757b
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
StdScript: ; 0x9757b
|
|
|
|
call GetScriptByte
|
|
|
|
ld e, a
|
|
|
|
call GetScriptByte
|
|
|
|
ld d, a
|
2013-09-07 02:08:34 -07:00
|
|
|
ld hl, StdScripts
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 3
|
2013-07-04 01:11:45 -07:00
|
|
|
add hl, de
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-09-07 02:08:34 -07:00
|
|
|
ld a, BANK(StdScripts)
|
2013-07-04 01:11:45 -07:00
|
|
|
call GetFarByte
|
|
|
|
ld b, a
|
|
|
|
inc hl
|
2013-09-07 02:08:34 -07:00
|
|
|
ld a, BANK(StdScripts)
|
2013-07-04 01:11:45 -07:00
|
|
|
call GetFarHalfword
|
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x97596
|
2013-02-27 21:31:12 -08:00
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
SkipTwoScriptBytes: ; 0x97596
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
|
|
|
call GetScriptByte
|
2013-02-28 13:04:26 -08:00
|
|
|
ret
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x9759d
|
|
|
|
|
2013-05-03 11:27:24 -07:00
|
|
|
ScriptJump: ; 0x9759d
|
2013-02-28 13:04:26 -08:00
|
|
|
ld a, b
|
2013-02-28 18:39:40 -08:00
|
|
|
ld [ScriptBank], a
|
2013-02-28 13:04:26 -08:00
|
|
|
ld a, l
|
2013-02-28 18:39:40 -08:00
|
|
|
ld [ScriptPos], a
|
2013-02-28 13:04:26 -08:00
|
|
|
ld a, h
|
2013-05-03 11:27:24 -07:00
|
|
|
ld [ScriptPos + 1], a
|
2013-02-28 13:04:26 -08:00
|
|
|
ret
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x975aa
|
|
|
|
|
|
|
|
Script_priorityjump: ; 0x975aa
|
|
|
|
; script command 0x8d
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd44e], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd44f], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd450], a
|
2013-07-04 02:37:20 -07:00
|
|
|
ld hl, ScriptFlags
|
2013-02-27 21:31:12 -08:00
|
|
|
set 3, [hl]
|
|
|
|
ret
|
|
|
|
; 0x975c2
|
|
|
|
|
|
|
|
Script_checktriggers: ; 0x975c2
|
|
|
|
; script command 0x13
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
call CheckTriggers
|
2013-02-27 21:31:12 -08:00
|
|
|
jr z, .asm_975cb ; 0x975c5 $4
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
.asm_975cb
|
|
|
|
ld a, $ff
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x975d1
|
|
|
|
|
|
|
|
Script_checkmaptriggers: ; 0x975d1
|
|
|
|
; script command 0x11
|
|
|
|
; parameters:
|
|
|
|
; map_group (SingleByteParam)
|
|
|
|
; map_id (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
2014-03-03 19:53:43 -08:00
|
|
|
call GetMapTrigger
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, d
|
|
|
|
or e
|
|
|
|
jr z, .asm_975e5 ; 0x975de $5
|
|
|
|
ld a, [de]
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
.asm_975e5
|
|
|
|
ld a, $ff
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x975eb
|
|
|
|
|
|
|
|
Script_dotrigger: ; 0x975eb
|
|
|
|
; script command 0x14
|
|
|
|
; parameters:
|
|
|
|
; trigger_id (SingleByteParam)
|
|
|
|
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [MapGroup]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [MapNumber]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
|
|
|
jr Unknown_975fd ; 0x975f3 $8
|
|
|
|
; 0x975f5
|
|
|
|
|
|
|
|
Script_domaptrigger: ; 0x975f5
|
|
|
|
; script command 0x12
|
|
|
|
; parameters:
|
|
|
|
; map_group (MapGroupParam)
|
|
|
|
; map_id (MapIdParam)
|
|
|
|
; trigger_id (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
2013-02-27 23:16:08 -08:00
|
|
|
; fallthrough
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Unknown_975fd: ; 0x975fd
|
2014-03-03 19:53:43 -08:00
|
|
|
call GetMapTrigger
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, d
|
|
|
|
or e
|
|
|
|
jr z, .asm_97608 ; 0x97602 $4
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [de], a
|
|
|
|
.asm_97608
|
|
|
|
ret
|
|
|
|
; 0x97609
|
|
|
|
|
|
|
|
Script_copybytetovar: ; 0x97609
|
|
|
|
; script command 0x19
|
|
|
|
; parameters:
|
|
|
|
; address (RAMAddressParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
|
|
|
ld a, [hl]
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97616
|
|
|
|
|
|
|
|
Script_copyvartobyte: ; 0x97616
|
|
|
|
; script command 0x1a
|
|
|
|
; parameters:
|
|
|
|
; address (RAMAddressParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, [ScriptVar]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 0x97623
|
|
|
|
|
|
|
|
Script_loadvar: ; 0x97623
|
|
|
|
; script command 0x1b
|
|
|
|
; parameters:
|
|
|
|
; address (RAMAddressParam)
|
|
|
|
; value (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 0x97630
|
|
|
|
|
|
|
|
Script_writebyte: ; 0x97630
|
|
|
|
; script command 0x15
|
|
|
|
; parameters:
|
|
|
|
; value (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97637
|
|
|
|
|
|
|
|
Script_addvar: ; 0x97637
|
|
|
|
; script command 0x16
|
|
|
|
; parameters:
|
|
|
|
; value (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld hl, ScriptVar
|
2013-02-27 21:31:12 -08:00
|
|
|
add [hl]
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 0x97640
|
|
|
|
|
|
|
|
Script_random: ; 0x97640
|
|
|
|
; script command 0x17
|
|
|
|
; parameters:
|
|
|
|
; input (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld c, a
|
2014-05-21 13:21:46 -07:00
|
|
|
call Function97673
|
2013-02-27 21:31:12 -08:00
|
|
|
and a
|
|
|
|
jr z, .asm_9765f ; 0x9764d $10
|
|
|
|
ld b, a
|
|
|
|
xor a
|
|
|
|
sub b
|
|
|
|
ld b, a
|
|
|
|
.asm_97653
|
|
|
|
push bc
|
2013-08-30 19:59:40 -07:00
|
|
|
call Random
|
2013-02-27 21:31:12 -08:00
|
|
|
pop bc
|
|
|
|
ld a, [$ffe1]
|
|
|
|
cp b
|
|
|
|
jr nc, .asm_97653 ; 0x9765b $f6
|
|
|
|
jr .asm_97666 ; 0x9765d $7
|
|
|
|
.asm_9765f
|
|
|
|
push bc
|
2013-08-30 19:59:40 -07:00
|
|
|
call Random
|
2013-02-27 21:31:12 -08:00
|
|
|
pop bc
|
|
|
|
ld a, [$ffe1]
|
|
|
|
.asm_97666
|
|
|
|
push af
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, [ScriptVar]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
|
|
|
pop af
|
2013-08-29 20:20:09 -07:00
|
|
|
call SimpleDivide
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97673
|
|
|
|
|
2014-05-21 13:21:46 -07:00
|
|
|
Function97673: ; 0x97673
|
2013-07-04 01:11:45 -07:00
|
|
|
xor a
|
|
|
|
ld b, a
|
|
|
|
sub c
|
2013-02-28 13:28:29 -08:00
|
|
|
.asm_97676
|
2013-07-04 01:11:45 -07:00
|
|
|
inc b
|
|
|
|
sub c
|
|
|
|
jr nc, .asm_97676 ; 0x97678 $fc
|
|
|
|
dec b
|
|
|
|
add c
|
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x9767d
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_checkcode: ; 0x9767d
|
|
|
|
; script command 0x1c
|
|
|
|
; parameters:
|
|
|
|
; variable_id (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetVarAction
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, [de]
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97688
|
|
|
|
|
|
|
|
Script_writevarcode: ; 0x97688
|
|
|
|
; script command 0x1d
|
|
|
|
; parameters:
|
|
|
|
; variable_id (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetVarAction
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, [ScriptVar]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [de], a
|
|
|
|
ret
|
|
|
|
; 0x97693
|
|
|
|
|
|
|
|
Script_writecode: ; 0x97693
|
|
|
|
; script command 0x1e
|
|
|
|
; parameters:
|
|
|
|
; variable_id (SingleByteParam)
|
|
|
|
; value (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetVarAction
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [de], a
|
|
|
|
ret
|
|
|
|
; 0x9769e
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
GetVarAction: ; 0x9769e
|
2013-07-04 01:11:45 -07:00
|
|
|
ld c, a
|
2015-07-15 12:48:44 -07:00
|
|
|
callba _GetVarAction
|
2013-07-04 01:11:45 -07:00
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x976a6
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_checkver: ; 0x976a6
|
|
|
|
; script command 0x18
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
ld a, [Version]
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x976ad
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
Version: ; 976ad
|
2013-11-22 01:51:47 -08:00
|
|
|
db VERSION
|
2013-07-04 01:11:45 -07:00
|
|
|
; 976ae
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_pokenamemem: ; 0x976ae
|
|
|
|
; script command 0x40
|
|
|
|
; parameters:
|
2015-07-15 12:48:44 -07:00
|
|
|
; pokemon (PokemonParam); leave $0 to draw from script var
|
2013-02-27 21:31:12 -08:00
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
and a
|
2015-07-15 12:48:44 -07:00
|
|
|
jr nz, .gotit ; 0x976b2 $3
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, [ScriptVar]
|
2015-07-15 12:48:44 -07:00
|
|
|
.gotit
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd265], a
|
2013-08-29 20:20:09 -07:00
|
|
|
call GetPokemonName
|
2013-07-04 01:11:45 -07:00
|
|
|
ld de, StringBuffer1
|
2013-02-27 21:31:12 -08:00
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
ConvertMemToText: ; 0x976c0
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-09-30 11:19:33 -07:00
|
|
|
cp 3
|
|
|
|
jr c, .ok
|
2013-02-27 21:31:12 -08:00
|
|
|
xor a
|
2014-09-30 11:19:33 -07:00
|
|
|
.ok
|
2013-07-19 23:27:48 -07:00
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
CopyConvertedText: ; 976c8
|
2013-07-04 01:11:45 -07:00
|
|
|
ld hl, StringBuffer3
|
2015-07-20 00:51:52 -07:00
|
|
|
ld bc, StringBuffer4 - StringBuffer3
|
2013-02-27 21:31:12 -08:00
|
|
|
call AddNTimes
|
|
|
|
call CopyName2
|
|
|
|
ret
|
|
|
|
; 0x976d5
|
|
|
|
|
|
|
|
Script_itemtotext: ; 0x976d5
|
|
|
|
; script command 0x41
|
|
|
|
; parameters:
|
|
|
|
; item (ItemLabelByte)
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
and a
|
2015-07-15 12:48:44 -07:00
|
|
|
jr nz, .ok ; 0x976d9 $3
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, [ScriptVar]
|
2015-07-15 12:48:44 -07:00
|
|
|
.ok
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd265], a
|
2013-02-27 21:31:12 -08:00
|
|
|
call GetItemName
|
2013-07-04 01:11:45 -07:00
|
|
|
ld de, StringBuffer1
|
2015-07-15 12:48:44 -07:00
|
|
|
jr ConvertMemToText ; 0x976e7 $d7
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x976e9
|
|
|
|
|
|
|
|
Script_mapnametotext: ; 0x976e9
|
|
|
|
; script command 0x42
|
|
|
|
; parameters:
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [MapGroup]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [MapNumber]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
|
|
|
call GetWorldMapLocation
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
ConvertLandmarkToText: ; 0x976f4
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-10-01 18:20:48 -07:00
|
|
|
callba GetLandmarkName
|
2013-07-04 01:11:45 -07:00
|
|
|
ld de, StringBuffer1
|
2015-07-15 12:48:44 -07:00
|
|
|
jp ConvertMemToText
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97701
|
|
|
|
|
|
|
|
Script_displaylocation: ; 0x97701
|
|
|
|
; script command 0xa5
|
|
|
|
; parameters:
|
|
|
|
; id (SingleByteParam)
|
2013-09-30 22:13:04 -07:00
|
|
|
; memory (SingleByteParam)
|
2013-02-27 21:31:12 -08:00
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
jr ConvertLandmarkToText ; 0x97704 $ee
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97706
|
|
|
|
|
|
|
|
Script_trainertotext: ; 0x97706
|
|
|
|
; script command 0x43
|
|
|
|
; parameters:
|
|
|
|
; trainer_id (TrainerGroupParam)
|
|
|
|
; trainer_group (TrainerIdParam)
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2015-07-15 12:48:44 -07:00
|
|
|
callba GetTrainerName
|
|
|
|
jr ConvertMemToText ; 0x97714 $aa
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97716
|
|
|
|
|
2013-09-30 22:13:04 -07:00
|
|
|
Script_name: ; 0x97716
|
2013-02-27 21:31:12 -08:00
|
|
|
; script command 0xa7
|
2013-09-30 22:13:04 -07:00
|
|
|
; parameters:
|
|
|
|
; type (SingleByteParam)
|
|
|
|
; id (SingleByteParam)
|
2014-07-22 22:39:41 -07:00
|
|
|
; memory (SingleByteParam)
|
2013-02-27 21:31:12 -08:00
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wcf61], a
|
2013-02-27 21:31:12 -08:00
|
|
|
|
2015-07-20 00:51:52 -07:00
|
|
|
ContinueToGetName: ; 0x9771c
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [CurSpecies], a
|
2013-02-27 21:31:12 -08:00
|
|
|
call GetName
|
2013-07-04 01:11:45 -07:00
|
|
|
ld de, StringBuffer1
|
2015-07-15 12:48:44 -07:00
|
|
|
jp ConvertMemToText
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x9772b
|
|
|
|
|
2013-09-30 22:13:04 -07:00
|
|
|
Script_trainerclassname: ; 0x9772b
|
2013-02-27 21:31:12 -08:00
|
|
|
; script command 0xa6
|
2014-07-22 22:39:41 -07:00
|
|
|
; parameters:
|
|
|
|
; id (SingleByteParam)
|
|
|
|
; memory (SingleByteParam)
|
2013-02-27 21:31:12 -08:00
|
|
|
|
2015-05-18 02:16:11 -07:00
|
|
|
ld a, TRAINER_NAME
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wcf61], a
|
2015-07-20 00:51:52 -07:00
|
|
|
jr ContinueToGetName ; 0x97730 $ea
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97732
|
|
|
|
|
|
|
|
Script_readmoney: ; 0x97732
|
|
|
|
; script command 0x3d
|
|
|
|
; parameters:
|
|
|
|
; account (SingleByteParam)
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
call ResetStringBuffer1
|
|
|
|
call GetMoneyAccount
|
2013-07-04 01:11:45 -07:00
|
|
|
ld hl, StringBuffer1
|
2013-02-27 21:31:12 -08:00
|
|
|
ld bc, $4306
|
2013-08-29 20:20:09 -07:00
|
|
|
call PrintNum
|
2013-07-04 01:11:45 -07:00
|
|
|
ld de, StringBuffer1
|
2015-07-15 12:48:44 -07:00
|
|
|
jp ConvertMemToText
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97747
|
|
|
|
|
|
|
|
Script_readcoins: ; 0x97747
|
|
|
|
; script command 0x3e
|
|
|
|
; parameters:
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
call ResetStringBuffer1
|
2013-07-04 01:11:45 -07:00
|
|
|
ld hl, StringBuffer1
|
2013-08-30 14:50:08 -07:00
|
|
|
ld de, Coins
|
2013-02-27 21:31:12 -08:00
|
|
|
ld bc, $4206
|
2013-08-29 20:20:09 -07:00
|
|
|
call PrintNum
|
2013-07-04 01:11:45 -07:00
|
|
|
ld de, StringBuffer1
|
2015-07-15 12:48:44 -07:00
|
|
|
jp ConvertMemToText
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x9775c
|
|
|
|
|
|
|
|
Script_RAM2MEM: ; 0x9775c
|
|
|
|
; script command 0x3f
|
|
|
|
; parameters:
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
call ResetStringBuffer1
|
2014-05-21 13:21:46 -07:00
|
|
|
ld de, ScriptVar
|
2013-07-04 01:11:45 -07:00
|
|
|
ld hl, StringBuffer1
|
2013-02-27 21:31:12 -08:00
|
|
|
ld bc, $4103
|
2013-08-29 20:20:09 -07:00
|
|
|
call PrintNum
|
2013-07-04 01:11:45 -07:00
|
|
|
ld de, StringBuffer1
|
2015-07-15 12:48:44 -07:00
|
|
|
jp ConvertMemToText
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97771
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
ResetStringBuffer1: ; 0x97771
|
2013-07-04 01:11:45 -07:00
|
|
|
ld hl, StringBuffer1
|
2015-07-15 12:48:44 -07:00
|
|
|
ld bc, NAME_LENGTH
|
2013-07-04 01:11:45 -07:00
|
|
|
ld a, "@"
|
|
|
|
call ByteFill
|
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x9777d
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_stringtotext: ; 0x9777d
|
|
|
|
; script command 0x44
|
|
|
|
; parameters:
|
|
|
|
; text_pointer (EncodedTextLabelParam)
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2014-04-12 12:45:40 -07:00
|
|
|
ld hl, CopyName1
|
2013-10-01 18:55:40 -07:00
|
|
|
rst FarCall
|
2013-07-04 01:11:45 -07:00
|
|
|
ld de, StringBuffer2
|
2015-07-15 12:48:44 -07:00
|
|
|
jp ConvertMemToText
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97792
|
|
|
|
|
|
|
|
Script_givepokeitem: ; 0x97792
|
|
|
|
; script command 0x2f
|
|
|
|
; parameters:
|
|
|
|
; pointer (PointerParamToItemAndLetter)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2013-02-27 21:31:12 -08:00
|
|
|
call GetFarByte
|
|
|
|
ld b, a
|
|
|
|
push bc
|
|
|
|
inc hl
|
2015-07-15 12:48:44 -07:00
|
|
|
ld bc, MAIL_MAX_LENGTH
|
2015-02-10 15:14:21 -08:00
|
|
|
ld de, wd002
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2013-02-27 21:31:12 -08:00
|
|
|
call FarCopyBytes
|
|
|
|
pop bc
|
2015-07-15 12:48:44 -07:00
|
|
|
callba GivePokeItem
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x977b7
|
|
|
|
|
|
|
|
Script_checkpokeitem: ; 0x977b7
|
|
|
|
; script command 0x30
|
|
|
|
; parameters:
|
|
|
|
; pointer (PointerParamToItemAndLetter)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Function44654
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x977ca
|
|
|
|
|
|
|
|
Script_giveitem: ; 0x977ca
|
|
|
|
; script command 0x1f
|
|
|
|
; parameters:
|
|
|
|
; item (ItemLabelByte)
|
|
|
|
; quantity (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-15 12:48:44 -07:00
|
|
|
cp -1
|
|
|
|
jr nz, .ok ; 0x977cf $3
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, [ScriptVar]
|
2015-07-15 12:48:44 -07:00
|
|
|
.ok
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [CurItem], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd10c], a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld hl, NumItems
|
2013-09-07 22:35:10 -07:00
|
|
|
call ReceiveItem
|
2015-07-15 12:48:44 -07:00
|
|
|
jr nc, .full ; 0x977e3 $6
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, $1
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
2015-07-15 12:48:44 -07:00
|
|
|
.full
|
2013-02-27 21:31:12 -08:00
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x977f0
|
|
|
|
|
|
|
|
Script_takeitem: ; 0x977f0
|
|
|
|
; script command 0x20
|
|
|
|
; parameters:
|
|
|
|
; item (ItemLabelByte)
|
|
|
|
; quantity (DecimalParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [CurItem], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd10c], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, $ff
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd107], a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld hl, NumItems
|
2013-09-07 22:35:10 -07:00
|
|
|
call TossItem
|
2013-02-27 21:31:12 -08:00
|
|
|
ret nc
|
|
|
|
ld a, $1
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97812
|
|
|
|
|
|
|
|
Script_checkitem: ; 0x97812
|
|
|
|
; script command 0x21
|
|
|
|
; parameters:
|
|
|
|
; item (ItemLabelByte)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [CurItem], a
|
|
|
|
ld hl, NumItems
|
2013-09-07 22:35:10 -07:00
|
|
|
call CheckItem
|
2013-02-27 21:31:12 -08:00
|
|
|
ret nc
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, 1
|
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97829
|
|
|
|
|
|
|
|
Script_givemoney: ; 0x97829
|
|
|
|
; script command 0x22
|
|
|
|
; parameters:
|
|
|
|
; account (SingleByteParam)
|
|
|
|
; money (MoneyByteParam)
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetMoneyAccount
|
|
|
|
call LoadMoneyAmountToMem
|
|
|
|
callba GiveMoney
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97836
|
|
|
|
|
|
|
|
Script_takemoney: ; 0x97836
|
|
|
|
; script command 0x23
|
|
|
|
; parameters:
|
|
|
|
; account (SingleByteParam)
|
|
|
|
; money (MoneyByteParam)
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetMoneyAccount
|
|
|
|
call LoadMoneyAmountToMem
|
|
|
|
callba TakeMoney
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97843
|
|
|
|
|
|
|
|
Script_checkmoney: ; 0x97843
|
|
|
|
; script command 0x24
|
|
|
|
; parameters:
|
|
|
|
; account (SingleByteParam)
|
|
|
|
; money (MoneyByteParam)
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetMoneyAccount
|
|
|
|
call LoadMoneyAmountToMem
|
|
|
|
callba CheckMoney
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x9784f
|
2013-02-27 21:31:12 -08:00
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
CheckMoneyAction: ; 0x9784f
|
2014-05-21 13:21:46 -07:00
|
|
|
jr c, .two
|
|
|
|
jr z, .one
|
|
|
|
ld a, 0
|
|
|
|
jr .done
|
|
|
|
.one
|
|
|
|
ld a, 1
|
|
|
|
jr .done
|
|
|
|
.two
|
|
|
|
ld a, 2
|
|
|
|
.done
|
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97861
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
GetMoneyAccount: ; 0x97861
|
2013-07-04 01:11:45 -07:00
|
|
|
call GetScriptByte
|
|
|
|
and a
|
2015-02-10 15:14:21 -08:00
|
|
|
ld de, Money
|
2013-07-04 01:11:45 -07:00
|
|
|
ret z
|
2015-02-10 15:14:21 -08:00
|
|
|
ld de, wMomsMoney
|
2013-07-04 01:11:45 -07:00
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x9786d
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
LoadMoneyAmountToMem: ; 0x9786d
|
2015-07-17 14:17:10 -07:00
|
|
|
ld bc, hMoneyTemp
|
2013-07-04 01:11:45 -07:00
|
|
|
push bc
|
|
|
|
call GetScriptByte
|
|
|
|
ld [bc], a
|
|
|
|
inc bc
|
|
|
|
call GetScriptByte
|
|
|
|
ld [bc], a
|
|
|
|
inc bc
|
|
|
|
call GetScriptByte
|
|
|
|
ld [bc], a
|
|
|
|
pop bc
|
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x97881
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_givecoins: ; 0x97881
|
|
|
|
; script command 0x25
|
|
|
|
; parameters:
|
|
|
|
; coins (CoinByteParam)
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
call LoadCoinAmountToMem
|
|
|
|
callba GiveCoins
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x9788b
|
|
|
|
|
|
|
|
Script_takecoins: ; 0x9788b
|
|
|
|
; script command 0x26
|
|
|
|
; parameters:
|
|
|
|
; coins (CoinByteParam)
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
call LoadCoinAmountToMem
|
|
|
|
callba TakeCoins
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97895
|
|
|
|
|
|
|
|
Script_checkcoins: ; 0x97895
|
|
|
|
; script command 0x27
|
|
|
|
; parameters:
|
|
|
|
; coins (CoinByteParam)
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
call LoadCoinAmountToMem
|
|
|
|
callba CheckCoins
|
|
|
|
jr CheckMoneyAction
|
2013-07-19 23:27:48 -07:00
|
|
|
; 978a0
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
LoadCoinAmountToMem: ; 978a0
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [$ffc4], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-17 14:17:10 -07:00
|
|
|
ld [hMoneyTemp], a
|
|
|
|
ld bc, hMoneyTemp
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x978ae
|
|
|
|
|
|
|
|
Script_checktime: ; 0x978ae
|
|
|
|
; script command 0x2b
|
|
|
|
; parameters:
|
|
|
|
; time (SingleByteParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2015-07-15 12:48:44 -07:00
|
|
|
callba CheckTime
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
and c
|
|
|
|
ret z
|
|
|
|
ld a, $1
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x978c3
|
|
|
|
|
|
|
|
Script_checkpoke: ; 0x978c3
|
|
|
|
; script command 0x2c
|
|
|
|
; parameters:
|
|
|
|
; pkmn (PokemonParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld hl, PartySpecies
|
|
|
|
ld de, 1
|
2013-02-27 21:31:12 -08:00
|
|
|
call IsInArray
|
|
|
|
ret nc
|
2014-05-21 13:21:46 -07:00
|
|
|
ld a, 1
|
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x978da
|
|
|
|
|
|
|
|
Script_addcellnum: ; 0x978da
|
|
|
|
; script command 0x28
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
2015-07-15 12:48:44 -07:00
|
|
|
callba AddPhoneNumber
|
2013-02-27 21:31:12 -08:00
|
|
|
ret nc
|
|
|
|
ld a, $1
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x978ef
|
|
|
|
|
|
|
|
Script_delcellnum: ; 0x978ef
|
|
|
|
; script command 0x29
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
2015-07-15 12:48:44 -07:00
|
|
|
callba DelCellNum
|
2013-02-27 21:31:12 -08:00
|
|
|
ret nc
|
|
|
|
ld a, $1
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97904
|
|
|
|
|
|
|
|
Script_checkcellnum: ; 0x97904
|
|
|
|
; script command 0x2a
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
2015-07-17 14:17:10 -07:00
|
|
|
; returns false if the cell number is not in your phone
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld c, a
|
2015-07-15 12:48:44 -07:00
|
|
|
callba CheckCellNum
|
2013-02-27 21:31:12 -08:00
|
|
|
ret nc
|
|
|
|
ld a, $1
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97919
|
|
|
|
|
|
|
|
Script_specialphonecall: ; 0x97919
|
|
|
|
; script command 0x9c
|
|
|
|
; parameters:
|
|
|
|
; call_id (MultiByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-17 14:17:10 -07:00
|
|
|
ld [wSpecialPhoneCallID], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-17 14:17:10 -07:00
|
|
|
ld [wSpecialPhoneCallID + 1], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97926
|
|
|
|
|
|
|
|
Script_checkphonecall: ; 0x97926
|
|
|
|
; script command 0x9d
|
2015-07-17 14:17:10 -07:00
|
|
|
; returns false if no special phone call is stored
|
2013-02-27 21:31:12 -08:00
|
|
|
|
2015-07-17 14:17:10 -07:00
|
|
|
ld a, [wSpecialPhoneCallID]
|
2013-02-27 21:31:12 -08:00
|
|
|
and a
|
2014-05-21 13:21:46 -07:00
|
|
|
jr z, .ok
|
|
|
|
ld a, 1
|
|
|
|
.ok
|
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97932
|
|
|
|
|
|
|
|
Script_givepoke: ; 0x97932
|
|
|
|
; script command 0x2d
|
|
|
|
; parameters:
|
|
|
|
; pokemon (PokemonParam)
|
|
|
|
; level (DecimalParam)
|
|
|
|
; item (ItemLabelByte)
|
|
|
|
; trainer (DecimalParam)
|
|
|
|
; trainer_name_pointer (MultiByteParam)
|
|
|
|
; pkmn_nickname (MultiByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [CurPartySpecies], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [CurPartyLevel], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [CurItem], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
and a
|
|
|
|
ld b, a
|
2014-05-21 13:21:46 -07:00
|
|
|
jr z, .ok
|
2013-02-28 18:39:40 -08:00
|
|
|
ld hl, ScriptPos
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
|
|
|
call GetScriptByte
|
|
|
|
call GetScriptByte
|
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
.ok
|
2015-07-15 12:48:44 -07:00
|
|
|
callba GivePoke
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, b
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97968
|
|
|
|
|
|
|
|
Script_giveegg: ; 0x97968
|
|
|
|
; script command 0x2e
|
|
|
|
; parameters:
|
|
|
|
; pkmn (PokemonParam)
|
|
|
|
; level (DecimalParam)
|
2015-07-17 14:17:10 -07:00
|
|
|
; if no room in the party, return 0 in ScriptVar; else, return 2
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [MonType], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [CurPartySpecies], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [CurPartyLevel], a
|
2014-06-12 18:32:42 -07:00
|
|
|
callba GiveEgg
|
2013-02-27 21:31:12 -08:00
|
|
|
ret nc
|
2015-07-17 14:17:10 -07:00
|
|
|
ld a, 2
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97988
|
|
|
|
|
2013-09-24 00:48:58 -07:00
|
|
|
Script_setevent: ; 0x97988
|
2013-02-27 21:31:12 -08:00
|
|
|
; script command 0x33
|
|
|
|
; parameters:
|
|
|
|
; bit_number (MultiByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2015-07-18 20:45:39 -07:00
|
|
|
ld b, SET_FLAG
|
2013-08-23 12:48:26 -07:00
|
|
|
call EventFlagAction
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97996
|
|
|
|
|
2013-09-24 00:48:58 -07:00
|
|
|
Script_clearevent: ; 0x97996
|
2013-02-27 21:31:12 -08:00
|
|
|
; script command 0x32
|
|
|
|
; parameters:
|
|
|
|
; bit_number (MultiByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2015-07-18 20:45:39 -07:00
|
|
|
ld b, RESET_FLAG
|
2013-08-23 12:48:26 -07:00
|
|
|
call EventFlagAction
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x979a4
|
|
|
|
|
2013-09-24 00:48:58 -07:00
|
|
|
Script_checkevent: ; 0x979a4
|
2013-02-27 21:31:12 -08:00
|
|
|
; script command 0x31
|
|
|
|
; parameters:
|
|
|
|
; bit_number (MultiByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2015-07-18 20:45:39 -07:00
|
|
|
ld b, CHECK_FLAG
|
2013-08-23 12:48:26 -07:00
|
|
|
call EventFlagAction
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, c
|
|
|
|
and a
|
2015-07-17 14:17:10 -07:00
|
|
|
jr z, .false ; 0x979b3 $2
|
|
|
|
ld a, 1
|
|
|
|
.false
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x979bb
|
|
|
|
|
2013-09-24 00:51:42 -07:00
|
|
|
Script_setflag: ; 0x979bb
|
2013-02-27 21:31:12 -08:00
|
|
|
; script command 0x36
|
|
|
|
; parameters:
|
|
|
|
; bit_number (MultiByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2015-07-17 14:17:10 -07:00
|
|
|
ld b, 1 ; set
|
2015-07-15 12:48:44 -07:00
|
|
|
call _EngineFlagAction
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x979c9
|
|
|
|
|
2013-09-24 00:51:42 -07:00
|
|
|
Script_clearflag: ; 0x979c9
|
2013-02-27 21:31:12 -08:00
|
|
|
; script command 0x35
|
|
|
|
; parameters:
|
|
|
|
; bit_number (MultiByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2015-07-17 14:17:10 -07:00
|
|
|
ld b, 0 ; clear
|
2015-07-15 12:48:44 -07:00
|
|
|
call _EngineFlagAction
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x979d7
|
|
|
|
|
2013-09-24 00:51:42 -07:00
|
|
|
Script_checkflag: ; 0x979d7
|
2013-02-27 21:31:12 -08:00
|
|
|
; script command 0x34
|
|
|
|
; parameters:
|
|
|
|
; bit_number (MultiByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2015-07-17 14:17:10 -07:00
|
|
|
ld b, 2 ; check
|
2015-07-15 12:48:44 -07:00
|
|
|
call _EngineFlagAction
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, c
|
|
|
|
and a
|
2015-07-17 14:17:10 -07:00
|
|
|
jr z, .false ; 0x979e6 $2
|
|
|
|
ld a, 1
|
|
|
|
.false
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x979ee
|
|
|
|
|
2015-07-15 12:48:44 -07:00
|
|
|
_EngineFlagAction: ; 0x979ee
|
2013-10-01 18:20:48 -07:00
|
|
|
callba EngineFlagAction
|
2013-07-04 01:11:45 -07:00
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x979f5
|
2013-02-27 21:31:12 -08:00
|
|
|
|
2013-09-24 00:29:37 -07:00
|
|
|
Script_wildoff: ; 0x979f5
|
2013-02-27 21:31:12 -08:00
|
|
|
; script command 0x38
|
|
|
|
|
2013-09-24 00:31:00 -07:00
|
|
|
ld hl, StatusFlags
|
2013-02-27 21:31:12 -08:00
|
|
|
set 5, [hl]
|
|
|
|
ret
|
|
|
|
; 0x979fb
|
|
|
|
|
2013-09-24 00:29:37 -07:00
|
|
|
Script_wildon: ; 0x979fb
|
2013-02-27 21:31:12 -08:00
|
|
|
; script command 0x37
|
|
|
|
|
2013-09-24 00:31:00 -07:00
|
|
|
ld hl, StatusFlags
|
2013-02-27 21:31:12 -08:00
|
|
|
res 5, [hl]
|
|
|
|
ret
|
|
|
|
; 0x97a01
|
|
|
|
|
|
|
|
Script_xycompare: ; 0x97a01
|
|
|
|
; script command 0x39
|
|
|
|
; parameters:
|
|
|
|
; pointer (MultiByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd453], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd454], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97a0e
|
|
|
|
|
|
|
|
Script_warpfacing: ; 0x97a0e
|
|
|
|
; script command 0xa3
|
|
|
|
; parameters:
|
|
|
|
; facing (SingleByteParam)
|
|
|
|
; map_group (MapGroupParam)
|
|
|
|
; map_id (MapIdParam)
|
|
|
|
; x (SingleByteParam)
|
|
|
|
; y (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
and $3
|
|
|
|
ld c, a
|
2015-02-10 15:14:21 -08:00
|
|
|
ld a, [wd45b]
|
2013-02-27 21:31:12 -08:00
|
|
|
set 5, a
|
|
|
|
or c
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd45b], a
|
2015-07-17 14:17:10 -07:00
|
|
|
; fall through
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_warp: ; 0x97a1d
|
|
|
|
; script command 0x3c
|
|
|
|
; parameters:
|
|
|
|
; map_group (MapGroupParam)
|
|
|
|
; map_id (MapIdParam)
|
|
|
|
; x (SingleByteParam)
|
|
|
|
; y (SingleByteParam)
|
|
|
|
|
2015-07-17 14:17:10 -07:00
|
|
|
; This seems to be some sort of error handling case.
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
and a
|
2015-07-15 12:48:44 -07:00
|
|
|
jr z, .not_ok ; 0x97a21 $27
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [MapGroup], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [MapNumber], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [XCoord], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [YCoord], a
|
2015-07-17 14:17:10 -07:00
|
|
|
ld a, -1
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd001], a
|
2015-07-17 14:17:10 -07:00
|
|
|
ld a, -15
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [$ff9f], a
|
2015-07-17 14:17:10 -07:00
|
|
|
ld a, 1
|
2015-07-15 12:48:44 -07:00
|
|
|
call LoadMapStatus
|
2013-07-04 02:37:20 -07:00
|
|
|
call StopScript
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
2015-07-15 12:48:44 -07:00
|
|
|
.not_ok
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
|
|
|
call GetScriptByte
|
|
|
|
call GetScriptByte
|
2015-07-17 14:17:10 -07:00
|
|
|
ld a, -1
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd001], a
|
2015-07-17 14:17:10 -07:00
|
|
|
ld a, -5
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [$ff9f], a
|
2015-07-17 14:17:10 -07:00
|
|
|
ld a, 1
|
2015-07-15 12:48:44 -07:00
|
|
|
call LoadMapStatus
|
2013-07-04 02:37:20 -07:00
|
|
|
call StopScript
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97a65
|
|
|
|
|
|
|
|
Script_warpmod: ; 0x97a65
|
|
|
|
; script command 0x3a
|
|
|
|
; parameters:
|
|
|
|
; warp_id (SingleByteParam)
|
|
|
|
; map_group (MapGroupParam)
|
|
|
|
; map_id (MapIdParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wdcac], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [BackupMapGroup], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [BackupMapNumber], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97a78
|
|
|
|
|
|
|
|
Script_blackoutmod: ; 0x97a78
|
|
|
|
; script command 0x3b
|
|
|
|
; parameters:
|
|
|
|
; map_group (MapGroupParam)
|
|
|
|
; map_id (MapIdParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wdcb2], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wdcb3], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97a85
|
|
|
|
|
|
|
|
Script_reloadmapmusic: ; 0x97a85
|
|
|
|
; script command 0x83
|
|
|
|
|
2015-07-17 14:17:10 -07:00
|
|
|
ld a, 1
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wc2c1], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97a8b
|
|
|
|
|
|
|
|
Script_writecmdqueue: ; 0x97a8b
|
|
|
|
; script command 0x7d
|
|
|
|
; parameters:
|
|
|
|
; queue_pointer (MultiByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2013-02-28 18:39:40 -08:00
|
|
|
ld a, [ScriptBank]
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-07-19 23:27:48 -07:00
|
|
|
callba Function97e31
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97a9e
|
|
|
|
|
|
|
|
Script_delcmdqueue: ; 0x97a9e
|
|
|
|
; script command 0x7e
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld b, a
|
2013-07-19 23:27:48 -07:00
|
|
|
callba Function97e5c
|
2013-02-27 21:31:12 -08:00
|
|
|
ret c
|
2015-07-17 14:17:10 -07:00
|
|
|
ld a, 1
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97ab3
|
|
|
|
|
|
|
|
Script_changemap: ; 0x97ab3
|
|
|
|
; script command 0x79
|
|
|
|
; parameters:
|
|
|
|
; map_data_pointer (MapDataPointerParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [MapBlockDataBank], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [MapBlockDataPointer], a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [MapBlockDataPointer + 1], a
|
2015-07-15 12:48:44 -07:00
|
|
|
call ChangeMap
|
|
|
|
call BufferScreen
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97acc
|
|
|
|
|
|
|
|
Script_changeblock: ; 0x97acc
|
|
|
|
; script command 0x7a
|
|
|
|
; parameters:
|
|
|
|
; x (SingleByteParam)
|
|
|
|
; y (SingleByteParam)
|
|
|
|
; block (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-17 14:17:10 -07:00
|
|
|
add 4
|
2013-02-27 21:31:12 -08:00
|
|
|
ld d, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-17 14:17:10 -07:00
|
|
|
add 4
|
2013-02-27 21:31:12 -08:00
|
|
|
ld e, a
|
2015-07-15 12:48:44 -07:00
|
|
|
call GetBlockLocation
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [hl], a
|
2015-07-15 12:48:44 -07:00
|
|
|
call BufferScreen
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97ae3
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Script_reloadmappart:: ; 0x97ae3
|
2013-02-27 21:31:12 -08:00
|
|
|
; script command 0x7c
|
|
|
|
|
|
|
|
xor a
|
|
|
|
ld [$ffd4], a
|
2013-08-29 20:20:09 -07:00
|
|
|
call Function2173
|
|
|
|
call Function2914
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Function104061
|
2015-07-22 12:57:02 -07:00
|
|
|
call UpdateSprites
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97af6
|
|
|
|
|
|
|
|
Script_warpcheck: ; 0x97af6
|
|
|
|
; script command 0x8e
|
|
|
|
|
2013-08-29 20:20:09 -07:00
|
|
|
call Function224a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret nc
|
2015-07-15 12:48:44 -07:00
|
|
|
callba SetAll_ScriptFlags3
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97b01
|
|
|
|
|
2014-05-21 13:21:46 -07:00
|
|
|
Function97b01: ; 0x97b01
|
2015-07-15 12:48:44 -07:00
|
|
|
callba SetAll_ScriptFlags3
|
2013-07-04 01:11:45 -07:00
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x97b08
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_newloadmap: ; 0x97b08
|
|
|
|
; script command 0x8a
|
|
|
|
; parameters:
|
|
|
|
; which_method (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld [$ff9f], a
|
2015-07-17 14:17:10 -07:00
|
|
|
ld a, 1
|
2015-07-15 12:48:44 -07:00
|
|
|
call LoadMapStatus
|
2013-07-04 02:37:20 -07:00
|
|
|
call StopScript
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97b16
|
|
|
|
|
|
|
|
Script_reloadandreturn: ; 0x97b16
|
|
|
|
; script command 0x92
|
|
|
|
|
2013-07-19 23:27:48 -07:00
|
|
|
call Script_newloadmap
|
2013-07-04 02:37:20 -07:00
|
|
|
jp Script_end
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97b1c
|
|
|
|
|
|
|
|
Script_loadfont: ; 0x97b1c
|
|
|
|
; script command 0x47
|
|
|
|
|
2013-08-29 20:20:09 -07:00
|
|
|
call Function2e08
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97b20
|
|
|
|
|
|
|
|
Script_refreshscreen: ; 0x97b20
|
|
|
|
; script command 0x48
|
|
|
|
; parameters:
|
|
|
|
; dummy (SingleByteParam)
|
|
|
|
|
2013-08-29 20:20:09 -07:00
|
|
|
call ResetWindow
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97b27
|
|
|
|
|
|
|
|
Script_loadbytec1ce: ; 0x97b27
|
|
|
|
; script command 0x4a
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wc2cf], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97b2e
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
|
|
|
|
LoadMoveSpritesScript: ; 97b2e
|
|
|
|
loadmovesprites
|
|
|
|
; 97b2f
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_loadmovesprites: ; 0x97b2f
|
|
|
|
; script command 0x49
|
|
|
|
|
2013-08-29 20:20:09 -07:00
|
|
|
call Function2e20
|
|
|
|
call Function2dcf
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97b36
|
|
|
|
|
2013-07-04 01:11:45 -07:00
|
|
|
|
2013-02-27 21:31:12 -08:00
|
|
|
Script_passtoengine: ; 0x97b36
|
|
|
|
; script command 0x89
|
|
|
|
; parameters:
|
|
|
|
; data_pointer (PointerLabelBeforeBank)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
push af
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld l, a
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
ld h, a
|
|
|
|
pop af
|
|
|
|
call StartAutoInput
|
|
|
|
ret
|
|
|
|
; 0x97b47
|
|
|
|
|
|
|
|
Script_pause: ; 0x97b47
|
|
|
|
; script command 0x8b
|
|
|
|
; parameters:
|
|
|
|
; length (DecimalParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
and a
|
2015-07-17 14:17:10 -07:00
|
|
|
jr z, .loop ; 0x97b4b $3
|
2013-07-04 02:37:20 -07:00
|
|
|
ld [ScriptDelay], a
|
2015-07-17 14:17:10 -07:00
|
|
|
.loop
|
2013-07-04 02:37:20 -07:00
|
|
|
ld c, 2
|
2013-02-27 21:31:12 -08:00
|
|
|
call DelayFrames
|
2013-07-04 02:37:20 -07:00
|
|
|
ld hl, ScriptDelay
|
2013-02-27 21:31:12 -08:00
|
|
|
dec [hl]
|
2015-07-17 14:17:10 -07:00
|
|
|
jr nz, .loop ; 0x97b59 $f5
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97b5c
|
|
|
|
|
|
|
|
Script_deactivatefacing: ; 0x97b5c
|
|
|
|
; script command 0x8c
|
|
|
|
; parameters:
|
|
|
|
; time (SingleByteParam)
|
|
|
|
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2013-02-27 21:31:12 -08:00
|
|
|
and a
|
2015-07-17 14:17:10 -07:00
|
|
|
jr z, .no_time ; 0x97b60 $3
|
2013-07-04 02:37:20 -07:00
|
|
|
ld [ScriptDelay], a
|
2015-07-17 14:17:10 -07:00
|
|
|
.no_time
|
2013-07-04 02:37:20 -07:00
|
|
|
ld a, SCRIPT_WAIT
|
|
|
|
ld [ScriptMode], a
|
|
|
|
call StopScript
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97b6e
|
|
|
|
|
|
|
|
Script_ptpriorityjump: ; 0x97b6e
|
|
|
|
; script command 0x8f
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2013-07-04 02:37:20 -07:00
|
|
|
call StopScript
|
2013-02-27 23:16:08 -08:00
|
|
|
jp Script_2jump
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97b74
|
|
|
|
|
|
|
|
Script_end: ; 0x97b74
|
|
|
|
; script command 0x91
|
|
|
|
|
2013-07-04 02:37:20 -07:00
|
|
|
call ExitScriptSubroutine
|
2015-07-17 14:17:10 -07:00
|
|
|
jr c, .resume
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
2015-07-17 14:17:10 -07:00
|
|
|
.resume
|
2013-02-27 21:31:12 -08:00
|
|
|
xor a
|
2013-07-04 01:11:45 -07:00
|
|
|
ld [ScriptRunning], a
|
2013-07-04 02:37:20 -07:00
|
|
|
ld a, SCRIPT_OFF
|
|
|
|
ld [ScriptMode], a
|
|
|
|
ld hl, ScriptFlags
|
2013-02-27 21:31:12 -08:00
|
|
|
res 0, [hl]
|
2013-07-04 02:37:20 -07:00
|
|
|
call StopScript
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97b8c
|
|
|
|
|
|
|
|
Script_return: ; 0x97b8c
|
|
|
|
; script command 0x90
|
|
|
|
|
2013-07-04 02:37:20 -07:00
|
|
|
call ExitScriptSubroutine
|
2015-07-17 14:17:10 -07:00
|
|
|
jr c, .dummy
|
|
|
|
.dummy
|
2013-07-04 02:37:20 -07:00
|
|
|
ld hl, ScriptFlags
|
2013-02-27 21:31:12 -08:00
|
|
|
res 0, [hl]
|
2013-07-04 02:37:20 -07:00
|
|
|
call StopScript
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97b9a
|
|
|
|
|
2013-07-04 02:37:20 -07:00
|
|
|
ExitScriptSubroutine: ; 0x97b9a
|
|
|
|
; Return carry if there's no parent to return to.
|
|
|
|
|
2015-02-10 15:14:21 -08:00
|
|
|
ld hl, wd43c
|
2013-07-04 01:11:45 -07:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-07-17 14:17:10 -07:00
|
|
|
jr z, .done ; 0x97b9f $1d
|
2013-07-04 01:11:45 -07:00
|
|
|
dec [hl]
|
|
|
|
ld e, [hl]
|
|
|
|
ld d, $0
|
2015-02-10 15:14:21 -08:00
|
|
|
ld hl, wd43d
|
2015-07-20 08:28:05 -07:00
|
|
|
rept 3
|
|
|
|
add hl,de
|
|
|
|
endr
|
2013-07-04 01:11:45 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
2015-07-17 14:17:10 -07:00
|
|
|
and " "
|
2013-07-04 01:11:45 -07:00
|
|
|
ld [ScriptBank], a
|
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
|
|
|
ld [ScriptPos], a
|
|
|
|
ld a, [hl]
|
|
|
|
ld d, a
|
|
|
|
ld [ScriptPos + 1], a
|
|
|
|
and a
|
|
|
|
ret
|
2015-07-17 14:17:10 -07:00
|
|
|
.done
|
2013-07-04 01:11:45 -07:00
|
|
|
scf
|
|
|
|
ret
|
2013-02-28 13:28:29 -08:00
|
|
|
; 0x97bc0
|
2013-02-27 21:31:12 -08:00
|
|
|
|
|
|
|
Script_resetfuncs: ; 0x97bc0
|
|
|
|
; script command 0x93
|
|
|
|
|
|
|
|
xor a
|
2015-02-10 15:14:21 -08:00
|
|
|
ld [wd43c], a
|
2013-07-04 01:11:45 -07:00
|
|
|
ld [ScriptRunning], a
|
2013-07-04 02:37:20 -07:00
|
|
|
ld a, SCRIPT_OFF
|
|
|
|
ld [ScriptMode], a
|
|
|
|
ld hl, ScriptFlags
|
2013-02-27 21:31:12 -08:00
|
|
|
res 0, [hl]
|
2013-07-04 02:37:20 -07:00
|
|
|
call StopScript
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97bd5
|
|
|
|
|
|
|
|
Script_halloffame: ; 0x97bd5
|
|
|
|
; script command 0xa1
|
|
|
|
|
2015-02-10 15:14:21 -08:00
|
|
|
ld hl, GameTimerPause
|
2013-02-27 21:31:12 -08:00
|
|
|
res 0, [hl]
|
2013-09-15 16:07:38 -07:00
|
|
|
callba Mobile_HallOfFame
|
|
|
|
callba Mobile_HallOfFame2
|
|
|
|
callba HallOfFame
|
2015-02-10 15:14:21 -08:00
|
|
|
ld hl, GameTimerPause
|
2013-02-27 21:31:12 -08:00
|
|
|
set 0, [hl]
|
2013-02-27 23:16:08 -08:00
|
|
|
jr DisplayCredits
|
2013-02-27 21:31:12 -08:00
|
|
|
; 0x97bf3
|
|
|
|
|
|
|
|
Script_credits: ; 0x97bf3
|
|
|
|
; script command 0xa2
|
|
|
|
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Function86455
|
2013-02-27 23:16:08 -08:00
|
|
|
; fallthrough
|
2013-07-19 23:27:48 -07:00
|
|
|
|
2013-02-27 23:16:08 -08:00
|
|
|
DisplayCredits:
|
2013-07-19 23:27:48 -07:00
|
|
|
call Script_resetfuncs
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, $3
|
2015-07-15 12:48:44 -07:00
|
|
|
call LoadMapStatus
|
2013-07-04 02:37:20 -07:00
|
|
|
call StopScript
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
2013-11-22 01:51:47 -08:00
|
|
|
; 0x97c051
|
2013-02-27 21:31:12 -08:00
|
|
|
|
2013-09-30 22:03:08 -07:00
|
|
|
Script_wait: ; 0x97c05
|
2013-02-27 21:31:12 -08:00
|
|
|
; script command 0xa8
|
|
|
|
; parameters:
|
|
|
|
; unknown (SingleByteParam)
|
|
|
|
|
|
|
|
push bc
|
2013-02-28 13:36:21 -08:00
|
|
|
call GetScriptByte
|
2015-07-17 14:17:10 -07:00
|
|
|
.loop
|
2013-02-27 21:31:12 -08:00
|
|
|
push af
|
2013-07-04 02:37:20 -07:00
|
|
|
ld c, 6
|
2013-02-27 21:31:12 -08:00
|
|
|
call DelayFrames
|
|
|
|
pop af
|
|
|
|
dec a
|
2015-07-17 14:17:10 -07:00
|
|
|
jr nz, .loop ; 0x97c11 $f6
|
2013-02-27 21:31:12 -08:00
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
; 0x97c15
|
|
|
|
|
|
|
|
Script_unknown0xa9: ; 0x97c15
|
|
|
|
; script command 0xa9
|
|
|
|
|
2013-10-01 18:20:48 -07:00
|
|
|
callba Function4cffe
|
2013-02-27 21:31:12 -08:00
|
|
|
ld a, c
|
2014-05-21 13:21:46 -07:00
|
|
|
ld [ScriptVar], a
|
2013-02-27 21:31:12 -08:00
|
|
|
ret
|
|
|
|
; 0x97c20
|
2013-07-04 01:11:45 -07:00
|
|
|
|
2013-11-22 01:51:47 -08:00
|
|
|
|
2015-07-17 14:17:10 -07:00
|
|
|
Function97c20: ; 97c20 unreferenced
|
2013-11-22 01:51:47 -08:00
|
|
|
ld a, [.byte]
|
|
|
|
ld [ScriptVar], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.byte
|
|
|
|
db 0
|
|
|
|
; 97c28
|