2013-11-22 09:51:47 +00:00
|
|
|
; Event scripting commands.
|
|
|
|
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
EnableScriptMode:: ; 96c56
|
2013-11-22 09:51:47 +00:00
|
|
|
push af
|
2015-07-15 19:48:44 +00:00
|
|
|
ld a, SCRIPT_READ
|
2013-11-22 09:51:47 +00:00
|
|
|
ld [ScriptMode], a
|
|
|
|
pop af
|
|
|
|
ret
|
|
|
|
; 96c5e
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
ScriptEvents:: ; 96c5e
|
2013-11-22 09:51:47 +00: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
|
|
|
|
|
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
ScriptCommandTable: ; 96cb1
|
|
|
|
dw Script_scall
|
|
|
|
dw Script_farscall
|
|
|
|
dw Script_ptcall
|
|
|
|
dw Script_jump
|
|
|
|
dw Script_farjump
|
|
|
|
dw Script_ptjump
|
2013-02-28 21:04:26 +00:00
|
|
|
dw Script_if_equal
|
|
|
|
dw Script_if_not_equal
|
|
|
|
dw Script_iffalse
|
|
|
|
dw Script_iftrue
|
|
|
|
dw Script_if_greater_than
|
2013-09-26 22:40:20 +00:00
|
|
|
dw Script_if_less_than
|
2013-02-28 21:04:26 +00:00
|
|
|
dw Script_jumpstd
|
|
|
|
dw Script_callstd
|
2015-11-16 17:49:42 +00:00
|
|
|
dw Script_callasm
|
2013-02-28 21:04:26 +00:00
|
|
|
dw Script_special
|
2015-11-16 17:49:42 +00:00
|
|
|
dw Script_ptcallasm
|
2013-02-28 21:04:26 +00:00
|
|
|
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 07:48:58 +00:00
|
|
|
dw Script_checkevent
|
|
|
|
dw Script_clearevent
|
|
|
|
dw Script_setevent
|
2013-09-24 07:51:42 +00:00
|
|
|
dw Script_checkflag
|
|
|
|
dw Script_clearflag
|
|
|
|
dw Script_setflag
|
2013-02-28 21:04:26 +00:00
|
|
|
dw Script_wildon
|
2013-09-24 07:29:37 +00:00
|
|
|
dw Script_wildoff
|
2013-02-28 21:04:26 +00: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
|
2015-11-16 17:49:42 +00:00
|
|
|
dw Script_loadbytec2cf
|
|
|
|
dw Script_farwritetext
|
|
|
|
dw Script_writetext
|
2013-02-28 21:04:26 +00:00
|
|
|
dw Script_repeattext
|
|
|
|
dw Script_yesorno
|
|
|
|
dw Script_loadmenudata
|
|
|
|
dw Script_writebackup
|
|
|
|
dw Script_jumptextfaceplayer
|
2013-11-22 09:51:47 +00:00
|
|
|
IF _CRYSTAL
|
2015-11-16 17:49:42 +00:00
|
|
|
dw Script_farjumptext
|
2013-11-22 09:51:47 +00:00
|
|
|
ENDC
|
2013-02-28 21:04:26 +00: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
|
2015-11-04 03:35:36 +00:00
|
|
|
dw Script_battletowertext
|
2013-02-28 21:04:26 +00:00
|
|
|
dw Script_displaylocation
|
2013-10-01 05:13:04 +00:00
|
|
|
dw Script_trainerclassname
|
|
|
|
dw Script_name
|
2013-10-01 05:03:08 +00:00
|
|
|
dw Script_wait
|
2015-11-16 16:53:26 +00:00
|
|
|
dw Script_check_save
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96e05
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
StartScript: ; 96e05
|
2013-07-04 09:37:20 +00:00
|
|
|
ld hl, ScriptFlags
|
|
|
|
set SCRIPT_RUNNING, [hl]
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96e0b
|
2013-02-28 21:28:29 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
CheckScript: ; 96e0b
|
2013-07-04 09:37:20 +00:00
|
|
|
ld hl, ScriptFlags
|
|
|
|
bit SCRIPT_RUNNING, [hl]
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96e11
|
2013-02-28 21:28:29 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
StopScript: ; 96e11
|
2013-07-04 09:37:20 +00:00
|
|
|
ld hl, ScriptFlags
|
|
|
|
res SCRIPT_RUNNING, [hl]
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96e17
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_callasm: ; 96e17
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xe
|
|
|
|
; parameters:
|
|
|
|
; asm (AsmPointerParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
|
|
|
ld a, b
|
2013-10-02 01:55:40 +00:00
|
|
|
rst FarCall
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96e26
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_special: ; 96e26
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xf
|
|
|
|
; parameters:
|
|
|
|
; predefined_script (MultiByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2014-07-19 21:02:58 +00:00
|
|
|
callba Special
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96e35
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_ptcallasm: ; 96e35
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x10
|
|
|
|
; parameters:
|
|
|
|
; asm (PointerToAsmPointerParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
|
|
|
ld b, [hl]
|
|
|
|
inc hl
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld a, b
|
2013-10-02 01:55:40 +00:00
|
|
|
rst FarCall
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96e45
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_jumptextfaceplayer: ; 96e45
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x51
|
|
|
|
; parameters:
|
|
|
|
; text_pointer (RawTextPointerLabelParam)
|
|
|
|
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd44e], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd44f], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd450], a
|
2013-07-04 08:11:45 +00:00
|
|
|
ld b, BANK(JumpTextFacePlayerScript)
|
|
|
|
ld hl, JumpTextFacePlayerScript
|
2013-05-03 18:27:24 +00:00
|
|
|
jp ScriptJump
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96e5f
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_jumptext: ; 96e5f
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x53
|
|
|
|
; parameters:
|
|
|
|
; text_pointer (RawTextPointerLabelParam)
|
|
|
|
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd44e], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd44f], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd450], a
|
2013-07-04 08:11:45 +00:00
|
|
|
ld b, BANK(JumpTextScript)
|
|
|
|
ld hl, JumpTextScript
|
2013-05-03 18:27:24 +00:00
|
|
|
jp ScriptJump
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96e79
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
JumpTextFacePlayerScript: ; 96e79
|
2013-07-04 08:11:45 +00:00
|
|
|
faceplayer
|
2015-11-16 17:49:42 +00:00
|
|
|
JumpTextScript: ; 96e7a
|
2013-07-04 08:11:45 +00:00
|
|
|
loadfont
|
2015-07-15 19:48:44 +00:00
|
|
|
repeattext -1, -1
|
2013-07-04 08:11:45 +00:00
|
|
|
closetext
|
|
|
|
loadmovesprites
|
|
|
|
end
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96e81
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-11-22 09:51:47 +00:00
|
|
|
|
|
|
|
IF _CRYSTAL
|
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_farjumptext: ; 96e81
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x52
|
|
|
|
; parameters:
|
|
|
|
; text_pointer (PointerLabelBeforeBank)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd44e], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd44f], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd450], a
|
2013-07-04 08:11:45 +00:00
|
|
|
ld b, BANK(JumpTextScript)
|
|
|
|
ld hl, JumpTextScript
|
2013-05-03 18:27:24 +00:00
|
|
|
jp ScriptJump
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96e9b
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-11-22 09:51:47 +00:00
|
|
|
ENDC
|
|
|
|
|
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_writetext: ; 96e9b
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x4c
|
|
|
|
; parameters:
|
|
|
|
; text_pointer (RawTextPointerLabelParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2015-07-15 19:48:44 +00:00
|
|
|
call MapTextbox
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96eab
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_farwritetext: ; 96eab
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x4b
|
|
|
|
; parameters:
|
|
|
|
; text_pointer (PointerLabelBeforeBank)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
2015-07-15 19:48:44 +00:00
|
|
|
call MapTextbox
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96ebb
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_repeattext: ; 96ebb
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x4d
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
2015-07-15 19:48:44 +00:00
|
|
|
cp -1
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .done
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, l
|
2015-07-15 19:48:44 +00:00
|
|
|
cp -1
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .done
|
2015-02-10 23:14:21 +00:00
|
|
|
ld hl, wd44e
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-07-15 19:48:44 +00:00
|
|
|
call MapTextbox
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-07-15 19:48:44 +00:00
|
|
|
.done
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96ed9
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_closetext: ; 96ed9
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x54
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
jp CloseText
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96edc
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_keeptextopen: ; 96edc
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x55
|
|
|
|
|
2015-11-09 21:41:09 +00:00
|
|
|
ld a, [hOAMUpdate]
|
2013-02-28 05:31:12 +00:00
|
|
|
push af
|
|
|
|
ld a, $1
|
2015-11-09 21:41:09 +00:00
|
|
|
ld [hOAMUpdate], a
|
2013-08-30 03:20:09 +00:00
|
|
|
call WaitBGMap
|
2015-07-15 19:48:44 +00:00
|
|
|
call KeepTextOpen
|
2013-02-28 05:31:12 +00:00
|
|
|
pop af
|
2015-11-09 21:41:09 +00:00
|
|
|
ld [hOAMUpdate], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96eed
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_yesorno: ; 96eed
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x4e
|
|
|
|
|
2013-12-04 07:49:12 +00:00
|
|
|
call YesNoBox
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, 0
|
2015-11-16 16:53:26 +00:00
|
|
|
jr c, .no
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, 1
|
2015-07-15 19:48:44 +00:00
|
|
|
.no
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96efa
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_loadmenudata: ; 96efa
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x4f
|
|
|
|
; parameters:
|
|
|
|
; data (MenuDataPointerParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
2015-05-18 08:07:28 +00:00
|
|
|
ld de, LoadMenuDataHeader
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2015-07-15 19:48:44 +00:00
|
|
|
call Call_a_de
|
2015-07-22 19:57:02 +00:00
|
|
|
call UpdateSprites
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96f0f
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_writebackup: ; 96f0f
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x50
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call WriteBackup
|
2015-07-22 19:57:02 +00:00
|
|
|
call UpdateSprites
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96f16
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_pokepic: ; 96f16
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x56
|
|
|
|
; parameters:
|
|
|
|
; pokemon (PokemonParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
2014-05-21 20:21:46 +00:00
|
|
|
jr nz, .ok
|
|
|
|
ld a, [ScriptVar]
|
|
|
|
.ok
|
|
|
|
ld [CurPartySpecies], a
|
2015-07-15 19:48:44 +00:00
|
|
|
callba Pokepic
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96f29
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_pokepicyesorno: ; 96f29
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x57
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
callba PokepicYesOrNo
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96f30
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_interpretmenu2: ; 96f30
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x59
|
|
|
|
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2015-07-15 19:48:44 +00:00
|
|
|
ld hl, InterpretMenu2
|
2013-10-02 01:55:40 +00:00
|
|
|
rst FarCall
|
2015-11-04 19:02:11 +00:00
|
|
|
ld a, [MenuSelection2]
|
2014-05-21 20:21:46 +00:00
|
|
|
jr nc, .ok
|
2013-02-28 05:31:12 +00:00
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
.ok
|
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96f41
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_interpretmenu: ; 96f41
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x58
|
|
|
|
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2015-07-15 19:48:44 +00:00
|
|
|
ld hl, InterpretMenu
|
2013-10-02 01:55:40 +00:00
|
|
|
rst FarCall
|
2015-11-01 17:44:30 +00:00
|
|
|
ld a, [wMenuCursorBuffer]
|
2014-05-21 20:21:46 +00:00
|
|
|
jr nc, .ok
|
2013-02-28 05:31:12 +00:00
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
.ok
|
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96f52
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_battletowertext: ; 96f52
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa4
|
|
|
|
; parameters:
|
|
|
|
; pointer (PointerLabelBeforeBank)
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call SetUpTextBox
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2015-11-04 03:35:36 +00:00
|
|
|
callba BattleTowerText
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96f60
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_verbosegiveitem: ; 96f60
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x9e
|
|
|
|
; parameters:
|
|
|
|
; item (ItemLabelByte)
|
|
|
|
; quantity (DecimalParam)
|
|
|
|
|
2013-07-20 06:27:48 +00:00
|
|
|
call Script_giveitem
|
2013-07-04 08:11:45 +00:00
|
|
|
call CurItemName
|
|
|
|
ld de, StringBuffer1
|
2015-07-15 19:48:44 +00:00
|
|
|
ld a, 1
|
|
|
|
call CopyConvertedText
|
2013-07-04 08:11:45 +00:00
|
|
|
ld b, BANK(GiveItemScript)
|
|
|
|
ld de, GiveItemScript
|
|
|
|
jp ScriptCall
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96f76
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
|
2015-11-16 16:53:26 +00:00
|
|
|
ret_96f76: ; 96f76
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
|
|
|
; 96f77
|
|
|
|
|
|
|
|
GiveItemScript: ; 96f77
|
2015-11-16 16:53:26 +00:00
|
|
|
callasm ret_96f76
|
2015-01-20 08:01:23 +00:00
|
|
|
writetext ReceivedItemText
|
2013-07-04 08:11:45 +00:00
|
|
|
iffalse .Full
|
|
|
|
waitbutton
|
|
|
|
specialsound
|
|
|
|
closetext
|
|
|
|
itemnotify
|
|
|
|
end
|
|
|
|
|
|
|
|
.Full
|
|
|
|
keeptextopen
|
|
|
|
pocketisfull
|
|
|
|
end
|
|
|
|
; 96f89
|
|
|
|
|
|
|
|
ReceivedItemText: ; 96f89
|
2013-12-01 22:54:09 +00:00
|
|
|
text_jump UnknownText_0x1c4719
|
2013-07-04 08:11:45 +00:00
|
|
|
db "@"
|
|
|
|
; 96f8e
|
|
|
|
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_verbosegiveitem2: ; 96f8e
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x9f
|
|
|
|
; parameters:
|
|
|
|
; item (ItemLabelByte)
|
|
|
|
; var (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
cp -1
|
2014-05-21 20:21:46 +00:00
|
|
|
jr nz, .ok
|
|
|
|
ld a, [ScriptVar]
|
|
|
|
.ok
|
|
|
|
ld [CurItem], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetVarAction
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, [de]
|
2015-11-01 23:13:31 +00:00
|
|
|
ld [wItemQuantityChangeBuffer], a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld hl, NumItems
|
2013-09-08 05:35:10 +00:00
|
|
|
call ReceiveItem
|
2015-07-15 19:48:44 +00:00
|
|
|
ld a, 1
|
2014-05-21 20:21:46 +00:00
|
|
|
jr c, .ok2
|
2013-02-28 05:31:12 +00:00
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
.ok2
|
|
|
|
ld [ScriptVar], a
|
2013-07-04 08:11:45 +00:00
|
|
|
call CurItemName
|
|
|
|
ld de, StringBuffer1
|
2015-07-15 19:48:44 +00:00
|
|
|
ld a, 1
|
|
|
|
call CopyConvertedText
|
2013-07-04 08:11:45 +00:00
|
|
|
ld b, BANK(GiveItemScript)
|
|
|
|
ld de, GiveItemScript
|
|
|
|
jp ScriptCall
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96fc6
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_itemnotify: ; 96fc6
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x45
|
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
call GetPocketName
|
|
|
|
call CurItemName
|
|
|
|
ld b, BANK(PutItemInPocketText)
|
|
|
|
ld hl, PutItemInPocketText
|
2015-07-15 19:48:44 +00:00
|
|
|
call MapTextbox
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96fd5
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_pocketisfull: ; 96fd5
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x46
|
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
call GetPocketName
|
|
|
|
call CurItemName
|
|
|
|
ld b, BANK(PocketIsFullText)
|
|
|
|
ld hl, PocketIsFullText
|
2015-07-15 19:48:44 +00:00
|
|
|
call MapTextbox
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96fe4
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_specialsound: ; 96fe4
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x88
|
|
|
|
|
2013-10-02 01:20:48 +00:00
|
|
|
callba CheckItemPocket
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wItemAttributeParamBuffer]
|
2013-05-03 00:27:39 +00:00
|
|
|
cp TM_HM
|
|
|
|
ld de, SFX_GET_TM
|
|
|
|
jr z, .play
|
|
|
|
ld de, SFX_ITEM
|
|
|
|
.play
|
2013-10-08 17:10:36 +00:00
|
|
|
call PlaySFX
|
2013-05-03 00:27:39 +00:00
|
|
|
call WaitSFX
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 96ffe
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
|
|
|
|
GetPocketName: ; 96ffe
|
|
|
|
callba CheckItemPocket
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wItemAttributeParamBuffer]
|
2013-07-04 08:11:45 +00: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 23:14:21 +00:00
|
|
|
ld [wd265], a
|
2013-07-04 08:11:45 +00:00
|
|
|
call GetItemName
|
|
|
|
ret
|
|
|
|
; 9705b
|
|
|
|
|
|
|
|
|
|
|
|
PutItemInPocketText: ; 9705b
|
2013-12-01 22:54:09 +00:00
|
|
|
text_jump UnknownText_0x1c472c
|
2013-07-04 08:11:45 +00:00
|
|
|
db "@"
|
|
|
|
; 97060
|
|
|
|
|
|
|
|
PocketIsFullText: ; 97060
|
2013-12-01 22:54:09 +00:00
|
|
|
text_jump UnknownText_0x1c474b
|
2013-07-04 08:11:45 +00:00
|
|
|
db "@"
|
|
|
|
; 97065
|
|
|
|
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_pokemart: ; 97065
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x94
|
|
|
|
; parameters:
|
|
|
|
; dialog_id (SingleByteParam)
|
|
|
|
; mart_id (MultiByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-10-02 01:20:48 +00:00
|
|
|
callba OpenMartDialog
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9707c
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_elevator: ; 9707c
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x95
|
|
|
|
; parameters:
|
|
|
|
; floor_list_pointer (PointerLabelParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2015-07-15 19:48:44 +00:00
|
|
|
callba Elevator
|
2013-02-28 05:31:12 +00:00
|
|
|
ret c
|
|
|
|
ld a, $1
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97099
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_trade: ; 97099
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x96
|
|
|
|
; parameters:
|
|
|
|
; trade_id (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-12-28 03:20:24 +00:00
|
|
|
callba NPCTrade
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 970a4
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_phonecall: ; 970a4
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x98
|
|
|
|
; parameters:
|
|
|
|
; caller_name (RawTextPointerLabelParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2015-07-15 19:48:44 +00:00
|
|
|
callba PhoneCall
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 970b7
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_hangup: ; 970b7
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x99
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
callba HangUp
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 970be
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_askforphonenumber: ; 970be
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x97
|
|
|
|
; parameters:
|
|
|
|
; number (SingleByteParam)
|
|
|
|
|
2013-12-04 07:49:12 +00:00
|
|
|
call YesNoBox
|
2015-11-16 16:53:26 +00:00
|
|
|
jr c, .refused
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2015-07-15 19:48:44 +00:00
|
|
|
callba AddPhoneNumber
|
2015-11-16 16:53:26 +00:00
|
|
|
jr c, .phonefull
|
2013-02-28 05:31:12 +00:00
|
|
|
xor a
|
2015-11-16 16:53:26 +00:00
|
|
|
jr .done
|
2015-07-15 19:48:44 +00:00
|
|
|
.phonefull
|
|
|
|
ld a, 1
|
2015-11-16 16:53:26 +00:00
|
|
|
jr .done
|
2015-07-15 19:48:44 +00:00
|
|
|
.refused
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
ld a, 2
|
|
|
|
.done
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 970df
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_describedecoration: ; 970df
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x9a
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2015-07-15 19:48:44 +00:00
|
|
|
callba DescribeDecoration
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, d
|
|
|
|
ld l, e
|
2013-05-03 18:27:24 +00:00
|
|
|
jp ScriptJump
|
2015-11-16 17:49:42 +00:00
|
|
|
; 970ee
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_fruittree: ; 970ee
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x9b
|
|
|
|
; parameters:
|
|
|
|
; tree_id (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-05-03 19:40:45 +00:00
|
|
|
ld [CurFruitTree], a
|
|
|
|
ld b, BANK(FruitTreeScript)
|
|
|
|
ld hl, FruitTreeScript
|
2013-05-03 18:27:24 +00:00
|
|
|
jp ScriptJump
|
2015-11-16 17:49:42 +00:00
|
|
|
; 970fc
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_loadwilddata: ; 970fc
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa0
|
|
|
|
; parameters:
|
2014-07-23 05:05:06 +00:00
|
|
|
; flag (SingleByteParam)
|
2013-02-28 05:31:12 +00:00
|
|
|
; map_group (MapGroupParam)
|
|
|
|
; map_id (MapIdParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2015-07-15 19:48:44 +00:00
|
|
|
callba LoadWildData
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9710f
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_trainertext: ; 9710f
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x62
|
|
|
|
; parameters:
|
|
|
|
; which_text (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2015-07-15 19:48:44 +00:00
|
|
|
ld b, 0
|
2015-02-10 23:14:21 +00:00
|
|
|
ld hl, WalkingX
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 2
|
2013-02-28 05:31:12 +00:00
|
|
|
add hl, bc
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-02-10 23:14:21 +00:00
|
|
|
ld a, [EngineBuffer1]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2015-07-15 19:48:44 +00:00
|
|
|
call MapTextbox
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97125
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_scripttalkafter: ; 97125
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x65
|
|
|
|
|
2015-02-10 23:14:21 +00:00
|
|
|
ld hl, wd04b
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-02-10 23:14:21 +00:00
|
|
|
ld a, [EngineBuffer1]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-05-03 18:27:24 +00:00
|
|
|
jp ScriptJump
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97132
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_trainerstatus: ; 97132
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x63
|
|
|
|
; parameters:
|
|
|
|
; action (SingleByteParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2015-02-10 23:14:21 +00:00
|
|
|
ld hl, wd041
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-08-23 19:48:26 +00:00
|
|
|
call EventFlagAction
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
ret z
|
2015-07-15 19:48:44 +00:00
|
|
|
ld a, 1
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9714c
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_winlosstext: ; 9714c
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x64
|
|
|
|
; parameters:
|
|
|
|
; win_text_pointer (TextPointerLabelParam)
|
|
|
|
; loss_text_pointer (TextPointerLabelParam)
|
|
|
|
|
2015-07-19 03:45:39 +00:00
|
|
|
ld hl, wWinTextPointer ; d047
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hli], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hli], a
|
2015-07-19 03:45:39 +00:00
|
|
|
ld hl, wLossTextPointer ; d049; this is unnecessary
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hli], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hli], a
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97163
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_talkaftercancel: ; 97163
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x66
|
|
|
|
|
2015-02-10 23:14:21 +00:00
|
|
|
ld a, [wd04d]
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2013-07-04 09:37:20 +00:00
|
|
|
jp Script_end
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9716b
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_talkaftercheck: ; 9716b
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x67
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
ld a, 1
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2015-02-10 23:14:21 +00:00
|
|
|
ld a, [wd04d]
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9717a
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_playrammusic: ; 9717a
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x80
|
|
|
|
|
2015-02-10 23:14:21 +00:00
|
|
|
ld a, [OtherTrainerClass]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-10-02 01:20:48 +00:00
|
|
|
callba PlayTrainerEncounterMusic
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97185
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_playmapmusic: ; 97185
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x82
|
|
|
|
|
2014-05-21 20:21:46 +00:00
|
|
|
call PlayMapMusic
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97189
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_playmusic: ; 97189
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x7f
|
|
|
|
; parameters:
|
|
|
|
; music_pointer (MultiByteParam)
|
|
|
|
|
2014-05-21 20:21:46 +00:00
|
|
|
ld de, MUSIC_NONE
|
2013-10-08 17:21:15 +00:00
|
|
|
call PlayMusic
|
2013-02-28 05:31:12 +00:00
|
|
|
xor a
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [MusicFade], a
|
2013-02-28 05:31:12 +00:00
|
|
|
call MaxVolume
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2013-10-08 17:21:15 +00:00
|
|
|
call PlayMusic
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 971a2
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_musicfadeout: ; 971a2
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x81
|
|
|
|
; parameters:
|
|
|
|
; music (MultiByteParam)
|
|
|
|
; fadetime (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [MusicFadeID], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [MusicFadeID + 1], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
and $7f
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [MusicFade], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 971b7
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_playsound: ; 971b7
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x85
|
|
|
|
; parameters:
|
|
|
|
; sound_pointer (MultiByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2013-10-08 17:10:36 +00:00
|
|
|
call PlaySFX
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 971c3
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_waitbutton: ; 971c3
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x86
|
|
|
|
|
2013-05-03 00:27:39 +00:00
|
|
|
call WaitSFX
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 971c7
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_warpsound: ; 971c7
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x87
|
|
|
|
|
2013-10-02 01:20:48 +00:00
|
|
|
callba Function14a07
|
2013-10-08 17:10:36 +00:00
|
|
|
call PlaySFX
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 971d1
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_cry: ; 971d1
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x84
|
|
|
|
; parameters:
|
|
|
|
; cry_id (MultiByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
push af
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
pop af
|
|
|
|
and a
|
2014-07-18 17:25:03 +00:00
|
|
|
jr nz, .ok
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, [ScriptVar]
|
2014-07-18 17:25:03 +00:00
|
|
|
.ok
|
|
|
|
call PlayCry
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 971e3
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
GetScriptPerson: ; 971e3
|
2013-07-04 08:11:45 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2015-07-22 06:49:18 +00:00
|
|
|
cp LAST_TALKED
|
2013-07-04 08:11:45 +00:00
|
|
|
ret z
|
|
|
|
dec a
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 971ea
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_setlasttalked: ; 971ea
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x68
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetScriptPerson
|
2015-07-22 06:49:18 +00:00
|
|
|
ld [hLastTalked], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 971f3
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_applymovement: ; 971f3
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x69
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
; data (MovementPointerLabelParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetScriptPerson
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2013-07-20 06:27:48 +00:00
|
|
|
; 971fa
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
ApplyMovement: ; 971fa
|
2013-02-28 05:31:12 +00:00
|
|
|
push bc
|
|
|
|
ld a, c
|
2015-07-15 19:48:44 +00:00
|
|
|
callba SetFlagsForMovement_1
|
2013-02-28 05:31:12 +00:00
|
|
|
pop bc
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2013-02-28 05:31:12 +00:00
|
|
|
push bc
|
2015-07-15 19:48:44 +00:00
|
|
|
call SetFlagsForMovement_2
|
2013-02-28 05:31:12 +00:00
|
|
|
pop bc
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetMovementData
|
2013-02-28 05:31:12 +00:00
|
|
|
ret c
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2013-07-04 09:37:20 +00:00
|
|
|
ld a, SCRIPT_WAIT_MOVEMENT
|
|
|
|
ld [ScriptMode], a
|
|
|
|
call StopScript
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97221
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
SetFlagsForMovement_2: ; 97221
|
2015-07-15 19:48:44 +00:00
|
|
|
callba _SetFlagsForMovement_2
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97228
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_applymovement2: ; 97228
|
2015-11-12 04:38:57 +00:00
|
|
|
; apply movement to last talked
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x6a
|
|
|
|
; parameters:
|
|
|
|
; data (MovementPointerLabelParam)
|
|
|
|
|
2015-07-22 06:49:18 +00:00
|
|
|
ld a, [hLastTalked]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2015-07-15 19:48:44 +00:00
|
|
|
jp ApplyMovement
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9722e
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_faceplayer: ; 9722e
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x6b
|
|
|
|
|
2015-07-22 06:49:18 +00:00
|
|
|
ld a, [hLastTalked]
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld d, $0
|
2015-07-22 06:49:18 +00:00
|
|
|
ld a, [hLastTalked]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2015-07-15 19:48:44 +00:00
|
|
|
callba GetRelativeFacing
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, d
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 2
|
2013-02-28 05:31:12 +00:00
|
|
|
add a
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2015-07-22 06:49:18 +00:00
|
|
|
ld a, [hLastTalked]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2015-07-15 19:48:44 +00:00
|
|
|
call ApplyPersonFacing
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97248
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_faceperson: ; 97248
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x6c
|
|
|
|
; parameters:
|
|
|
|
; person1 (SingleByteParam)
|
|
|
|
; person2 (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetScriptPerson
|
2015-07-22 06:49:18 +00:00
|
|
|
cp LAST_TALKED
|
|
|
|
jr c, .ok
|
|
|
|
ld a, [hLastTalked]
|
|
|
|
.ok
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetScriptPerson
|
2015-07-22 06:49:18 +00:00
|
|
|
cp LAST_TALKED
|
|
|
|
jr nz, .ok2
|
|
|
|
ld a, [hLastTalked]
|
|
|
|
.ok2
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
|
|
|
push de
|
2015-07-15 19:48:44 +00:00
|
|
|
callba GetRelativeFacing
|
2013-02-28 05:31:12 +00:00
|
|
|
pop bc
|
|
|
|
ret c
|
|
|
|
ld a, d
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 2
|
2013-02-28 05:31:12 +00:00
|
|
|
add a
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
|
|
|
ld d, c
|
2015-07-15 19:48:44 +00:00
|
|
|
call ApplyPersonFacing
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97274
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_spriteface: ; 97274
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x76
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
; facing (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetScriptPerson
|
2015-07-22 06:49:18 +00:00
|
|
|
cp LAST_TALKED
|
|
|
|
jr nz, .ok
|
|
|
|
ld a, [hLastTalked]
|
|
|
|
.ok
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 2
|
2013-02-28 05:31:12 +00:00
|
|
|
add a
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2015-07-15 19:48:44 +00:00
|
|
|
call ApplyPersonFacing
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9728b
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
ApplyPersonFacing: ; 9728b
|
2013-07-04 08:11:45 +00:00
|
|
|
ld a, d
|
|
|
|
push de
|
2015-11-02 16:15:32 +00:00
|
|
|
call CheckObjectVisibility
|
2015-11-16 16:53:26 +00:00
|
|
|
jr c, .not_visible
|
2015-07-15 19:48:44 +00:00
|
|
|
ld hl, OBJECT_SPRITE
|
2013-07-04 08:11:45 +00:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
push bc
|
2015-11-05 01:20:14 +00:00
|
|
|
call DoesSpriteHaveFacings
|
2013-07-04 08:11:45 +00:00
|
|
|
pop bc
|
2015-11-05 01:20:14 +00:00
|
|
|
jr c, .not_visible ; STILL_SPRITE
|
2015-10-30 03:32:11 +00:00
|
|
|
ld hl, OBJECT_FLAGS1
|
2013-07-04 08:11:45 +00:00
|
|
|
add hl, bc
|
|
|
|
bit 2, [hl]
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .not_visible
|
2013-07-04 08:11:45 +00:00
|
|
|
pop de
|
|
|
|
ld a, e
|
2015-07-15 19:48:44 +00:00
|
|
|
call SetSpriteDirection
|
2015-02-10 23:14:21 +00:00
|
|
|
ld hl, VramState
|
2013-07-04 08:11:45 +00:00
|
|
|
bit 6, [hl]
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .text_state
|
2015-11-02 17:54:27 +00:00
|
|
|
call .DisableTextTiles
|
|
|
|
.text_state
|
2015-07-22 19:57:02 +00:00
|
|
|
call UpdateSprites
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2015-11-02 17:54:27 +00:00
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
.not_visible
|
2013-07-04 08:11:45 +00:00
|
|
|
pop de
|
|
|
|
scf
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 972bc
|
2013-02-28 21:28:29 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
.DisableTextTiles: ; 972bc
|
2015-11-05 19:06:03 +00:00
|
|
|
call LoadMapPart
|
2015-07-22 19:57:02 +00:00
|
|
|
hlcoord 0, 0
|
|
|
|
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
|
2015-11-02 17:54:27 +00:00
|
|
|
.loop
|
2013-07-04 08:11:45 +00:00
|
|
|
res 7, [hl]
|
|
|
|
inc hl
|
|
|
|
dec bc
|
|
|
|
ld a, b
|
|
|
|
or c
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .loop
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 972ce
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_variablesprite: ; 972ce
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x6d
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
; sprite (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
2015-02-10 23:14:21 +00:00
|
|
|
ld hl, VariableSprites
|
2013-02-28 05:31:12 +00:00
|
|
|
add hl, de
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 972dd
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_appear: ; 972dd
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x6f
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetScriptPerson
|
2015-07-18 19:46:38 +00:00
|
|
|
call _CopyObjectStruct
|
2015-11-02 16:15:32 +00:00
|
|
|
ld a, [hMapObjectIndexBuffer]
|
2015-07-18 19:46:38 +00:00
|
|
|
ld b, 0 ; clear
|
|
|
|
call ApplyEventActionAppearDisappear
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 972ee
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_disappear: ; 972ee
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x6e
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetScriptPerson
|
2015-07-22 06:49:18 +00:00
|
|
|
cp LAST_TALKED
|
|
|
|
jr nz, .ok
|
|
|
|
ld a, [hLastTalked]
|
|
|
|
.ok
|
2015-07-18 19:46:38 +00:00
|
|
|
call DeleteObjectStruct
|
2015-11-02 16:15:32 +00:00
|
|
|
ld a, [hMapObjectIndexBuffer]
|
2015-07-18 19:46:38 +00:00
|
|
|
ld b, 1 ; set
|
|
|
|
call ApplyEventActionAppearDisappear
|
2015-11-16 02:28:15 +00:00
|
|
|
callba _UpdateSprites
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9730b
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
ApplyEventActionAppearDisappear: ; 9730b
|
2013-07-04 08:11:45 +00:00
|
|
|
push bc
|
2013-08-30 03:20:09 +00:00
|
|
|
call GetMapObject
|
2015-07-18 19:46:38 +00:00
|
|
|
ld hl, MAPOBJECT_EVENT_FLAG
|
2013-07-04 08:11:45 +00:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2015-07-18 19:46:38 +00:00
|
|
|
ld a, -1
|
2013-07-04 08:11:45 +00:00
|
|
|
cp e
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .okay
|
2013-07-04 08:11:45 +00:00
|
|
|
cp d
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .okay
|
2013-07-04 08:11:45 +00:00
|
|
|
xor a
|
|
|
|
ret
|
2015-07-18 19:46:38 +00:00
|
|
|
.okay
|
2013-08-23 19:48:26 +00:00
|
|
|
call EventFlagAction
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97325
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_follow: ; 97325
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x70
|
|
|
|
; parameters:
|
|
|
|
; person2 (SingleByteParam)
|
|
|
|
; person1 (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetScriptPerson
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetScriptPerson
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2015-11-02 16:15:32 +00:00
|
|
|
callba StartFollow
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9733a
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_stopfollow: ; 9733a
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x71
|
|
|
|
|
2015-11-02 16:15:32 +00:00
|
|
|
callba StopFollow
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97341
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_moveperson: ; 97341
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x72
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
; x (SingleByteParam)
|
|
|
|
; y (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetScriptPerson
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-10-24 14:34:19 +00:00
|
|
|
add 4
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-10-24 14:34:19 +00:00
|
|
|
add 4
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2015-10-24 14:34:19 +00:00
|
|
|
callba CopyDECoordsToMapObject
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9735b
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_writepersonxy: ; 9735b
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x73
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetScriptPerson
|
2015-07-22 06:49:18 +00:00
|
|
|
cp LAST_TALKED
|
|
|
|
jr nz, .ok
|
|
|
|
ld a, [hLastTalked]
|
|
|
|
.ok
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2015-11-08 18:27:26 +00:00
|
|
|
callba WritePersonXY
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9736f
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_follownotexact: ; 9736f
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x77
|
|
|
|
; parameters:
|
|
|
|
; person2 (SingleByteParam)
|
|
|
|
; person1 (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetScriptPerson
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetScriptPerson
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2015-11-08 18:27:26 +00:00
|
|
|
callba FollowNotExact
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97384
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_loademote: ; 97384
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x74
|
|
|
|
; parameters:
|
|
|
|
; bubble (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-10-24 14:34:19 +00:00
|
|
|
cp -1
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .not_var_emote
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, [ScriptVar]
|
2015-10-24 14:34:19 +00:00
|
|
|
.not_var_emote
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2015-10-30 03:32:11 +00:00
|
|
|
callba LoadEmote
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97396
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_showemote: ; 97396
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x75
|
|
|
|
; parameters:
|
|
|
|
; bubble (SingleByteParam)
|
|
|
|
; person (SingleByteParam)
|
|
|
|
; time (DecimalParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetScriptPerson
|
2015-07-22 06:49:18 +00:00
|
|
|
cp LAST_TALKED
|
|
|
|
jr z, .ok
|
|
|
|
ld [hLastTalked], a
|
|
|
|
.ok
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-07-04 09:37:20 +00:00
|
|
|
ld [ScriptDelay], a
|
2013-07-04 08:11:45 +00:00
|
|
|
ld b, BANK(ShowEmoteScript)
|
|
|
|
ld de, ShowEmoteScript
|
|
|
|
jp ScriptCall
|
2015-11-16 17:49:42 +00:00
|
|
|
; 973b6
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
ShowEmoteScript: ; 973b6
|
2015-11-01 01:05:02 +00:00
|
|
|
loademote EMOTE_MEM
|
2013-07-04 08:11:45 +00:00
|
|
|
applymovement2 .Show
|
|
|
|
pause 0
|
|
|
|
applymovement2 .Hide
|
|
|
|
end
|
|
|
|
|
|
|
|
.Show
|
|
|
|
show_emote
|
2015-11-12 04:38:57 +00:00
|
|
|
step_sleep_1
|
2013-07-04 08:11:45 +00:00
|
|
|
step_end
|
|
|
|
|
|
|
|
.Hide
|
|
|
|
hide_emote
|
2015-11-12 04:38:57 +00:00
|
|
|
step_sleep_1
|
2013-07-04 08:11:45 +00:00
|
|
|
step_end
|
|
|
|
; 973c7
|
|
|
|
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_earthquake: ; 973c7
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x78
|
|
|
|
; parameters:
|
|
|
|
; param (DecimalParam)
|
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
ld hl, EarthquakeMovement
|
2015-02-10 23:14:21 +00:00
|
|
|
ld de, wd002
|
2013-07-04 08:11:45 +00:00
|
|
|
ld bc, EarthquakeMovementEnd - EarthquakeMovement
|
2013-02-28 05:31:12 +00:00
|
|
|
call CopyBytes
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd003], a
|
2015-10-30 03:32:11 +00:00
|
|
|
and (1 << 6) - 1
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd005], a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld b, BANK(.script)
|
|
|
|
ld de, .script
|
2013-07-04 08:11:45 +00:00
|
|
|
jp ScriptCall
|
2015-11-16 17:49:42 +00:00
|
|
|
; 973e6
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
.script: ; 973e6
|
2015-07-22 06:49:18 +00:00
|
|
|
applymovement PLAYER, wd002
|
2013-07-04 08:11:45 +00:00
|
|
|
end
|
|
|
|
; 973eb
|
|
|
|
|
|
|
|
EarthquakeMovement: ; 973eb
|
2015-11-12 04:38:57 +00:00
|
|
|
step_shake 16 ; the 16 gets overwritten with the script byte
|
|
|
|
step_sleep 16 ; the 16 gets overwritten with the lower 6 bits of the script byte
|
2013-07-04 08:11:45 +00:00
|
|
|
step_end
|
|
|
|
EarthquakeMovementEnd
|
|
|
|
; 973f0
|
|
|
|
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_loadpikachudata: ; 973f0
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x5a
|
|
|
|
|
2015-05-18 09:16:11 +00:00
|
|
|
ld a, PIKACHU
|
2015-07-23 07:41:52 +00:00
|
|
|
ld [TempWildMonSpecies], a
|
2015-05-18 09:16:11 +00:00
|
|
|
ld a, 5
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [CurPartyLevel], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 973fb
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_battlecheck: ; 973fb
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x5b
|
|
|
|
|
|
|
|
xor a
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd459], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97400
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_loadtrainerdata: ; 97400
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x5c
|
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, (1 << 7) | 1
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd459], a
|
|
|
|
ld a, [WalkingDirection]
|
|
|
|
ld [OtherTrainerClass], a
|
|
|
|
ld a, [FacingDirection]
|
|
|
|
ld [OtherTrainerID], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97412
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_loadpokedata: ; 97412
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x5d
|
|
|
|
; parameters:
|
|
|
|
; pokemon (PokemonParam)
|
|
|
|
; level (DecimalParam)
|
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, (1 << 7)
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd459], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-23 07:41:52 +00:00
|
|
|
ld [TempWildMonSpecies], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [CurPartyLevel], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97424
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_loadtrainer: ; 97424
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x5e
|
|
|
|
; parameters:
|
|
|
|
; trainer_group (TrainerGroupParam)
|
|
|
|
; trainer_id (TrainerIdParam)
|
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, (1 << 7) | 1
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd459], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [OtherTrainerClass], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [OtherTrainerID], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97436
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_startbattle: ; 97436
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x5f
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call BufferScreen
|
2014-06-16 18:20:01 +00:00
|
|
|
predef StartBattle
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wBattleResult]
|
2013-02-28 05:31:12 +00:00
|
|
|
and $3f
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97447
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_catchtutorial: ; 97447
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x61
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-06-17 18:58:11 +00:00
|
|
|
ld [BattleType], a
|
2015-07-15 19:48:44 +00:00
|
|
|
call BufferScreen
|
2015-11-08 18:27:26 +00:00
|
|
|
callba CatchTutorial
|
2013-07-04 08:11:45 +00:00
|
|
|
jp Script_reloadmap
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97459
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_returnafterbattle: ; 97459
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x60
|
|
|
|
|
2015-02-10 23:14:21 +00:00
|
|
|
ld hl, wd459
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, [hl]
|
|
|
|
ld [hl], $0
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wBattleResult]
|
2013-02-28 05:31:12 +00:00
|
|
|
and $3f
|
|
|
|
cp $1
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .notblackedout
|
2015-11-11 21:11:08 +00:00
|
|
|
ld b, BANK(Script_BattleWhiteout)
|
|
|
|
ld hl, Script_BattleWhiteout
|
2013-05-03 18:27:24 +00:00
|
|
|
jp ScriptJump
|
2015-10-19 20:49:29 +00:00
|
|
|
|
|
|
|
.notblackedout
|
2013-02-28 05:31:12 +00:00
|
|
|
bit 0, d
|
2015-11-16 16:53:26 +00:00
|
|
|
jr z, .was_wild
|
2015-10-19 20:49:29 +00:00
|
|
|
callba MomTriesToBuySomething
|
2015-11-16 16:53:26 +00:00
|
|
|
jr .done
|
2015-10-19 20:49:29 +00:00
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
.was_wild
|
|
|
|
ld a, [wBattleResult]
|
2013-02-28 05:31:12 +00:00
|
|
|
bit 7, a
|
2015-11-16 16:53:26 +00:00
|
|
|
jr z, .done
|
2015-10-19 20:49:29 +00:00
|
|
|
ld b, BANK(Script_SpecialBillCall)
|
|
|
|
ld de, Script_SpecialBillCall
|
2015-10-24 14:34:19 +00:00
|
|
|
callba LoadScriptBDE
|
2015-10-19 20:49:29 +00:00
|
|
|
.done
|
2013-07-04 08:11:45 +00:00
|
|
|
jp Script_reloadmap
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97491
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_reloadmap: ; 97491
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x7b
|
|
|
|
|
|
|
|
xor a
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd459], a
|
2015-10-24 23:49:19 +00:00
|
|
|
ld a, MAPSETUP_RELOADMAP
|
2015-10-07 17:19:41 +00:00
|
|
|
ld [hMapEntryMethod], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, $1
|
2015-07-15 19:48:44 +00:00
|
|
|
call LoadMapStatus
|
2013-07-04 09:37:20 +00:00
|
|
|
call StopScript
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 974a2
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_scall: ; 974a2
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x0
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2013-02-28 07:16:08 +00:00
|
|
|
jr ScriptCall
|
2015-11-16 17:49:42 +00:00
|
|
|
; 974b0
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_farscall: ; 974b0
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x1
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelBeforeBank)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2013-02-28 07:16:08 +00:00
|
|
|
jr ScriptCall
|
2015-11-16 17:49:42 +00:00
|
|
|
; 974be
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_ptcall: ; 974be
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x2
|
|
|
|
; parameters:
|
|
|
|
; pointer (PointerLabelToScriptPointer)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
|
|
|
ld b, [hl]
|
|
|
|
inc hl
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2013-02-28 07:16:08 +00:00
|
|
|
; fallthrough
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
ScriptCall: ; 974cb
|
2015-11-16 16:53:26 +00:00
|
|
|
; Bug: The script stack has a capacity of 5 scripts, yet there is
|
|
|
|
; nothing to stop you from pushing a sixth script. The high part
|
|
|
|
; of the script address can then be overwritten by modifications
|
|
|
|
; to ScriptDelay, causing the script to return to the rst/interrupt
|
|
|
|
; space.
|
|
|
|
|
2013-02-28 05:31:12 +00:00
|
|
|
push de
|
2015-11-16 16:53:26 +00:00
|
|
|
ld hl, wScriptStackSize
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, [hl]
|
|
|
|
inc [hl]
|
|
|
|
ld d, $0
|
2015-11-16 16:53:26 +00:00
|
|
|
ld hl, wScriptStackBA1
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 3
|
2013-02-28 05:31:12 +00:00
|
|
|
add hl, de
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-02-28 05:31:12 +00:00
|
|
|
pop de
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hli], a
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptPos]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hli], a
|
2013-05-03 18:27:24 +00:00
|
|
|
ld a, [ScriptPos + 1]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hl], a
|
|
|
|
ld a, b
|
2013-03-01 02:39:40 +00:00
|
|
|
ld [ScriptBank], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, e
|
2013-03-01 02:39:40 +00:00
|
|
|
ld [ScriptPos], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, d
|
2013-05-03 18:27:24 +00:00
|
|
|
ld [ScriptPos + 1], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 974f3
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
CallCallback:: ; 974f3
|
2013-07-04 08:11:45 +00:00
|
|
|
ld a, [ScriptBank]
|
|
|
|
or $80
|
|
|
|
ld [ScriptBank], a
|
|
|
|
jp ScriptCall
|
2015-11-16 17:49:42 +00:00
|
|
|
; 974fe
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_jump: ; 974fe
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x3
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-05-03 18:27:24 +00:00
|
|
|
jp ScriptJump
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9750d
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_farjump: ; 9750d
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x4
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelBeforeBank)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
2013-05-03 18:27:24 +00:00
|
|
|
jp ScriptJump
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9751c
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_ptjump: ; 9751c
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x5
|
|
|
|
; parameters:
|
|
|
|
; pointer (PointerLabelToScriptPointer)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
|
|
|
ld b, [hl]
|
|
|
|
inc hl
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2013-05-03 18:27:24 +00:00
|
|
|
jp ScriptJump
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9752c
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_iffalse: ; 9752c
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x8
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, [ScriptVar]
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
2013-07-04 08:11:45 +00:00
|
|
|
jp nz, SkipTwoScriptBytes
|
2015-11-16 17:49:42 +00:00
|
|
|
jp Script_jump
|
|
|
|
; 97536
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_iftrue: ; 97536
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x9
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, [ScriptVar]
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
2015-11-16 17:49:42 +00:00
|
|
|
jp nz, Script_jump
|
2013-07-04 08:11:45 +00:00
|
|
|
jp SkipTwoScriptBytes
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97540
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_if_equal: ; 97540
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x6
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld hl, ScriptVar
|
2013-02-28 05:31:12 +00:00
|
|
|
cp [hl]
|
2015-11-16 17:49:42 +00:00
|
|
|
jr z, Script_jump
|
2015-11-16 16:53:26 +00:00
|
|
|
jr SkipTwoScriptBytes
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9754b
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_if_not_equal: ; 9754b
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x7
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld hl, ScriptVar
|
2013-02-28 05:31:12 +00:00
|
|
|
cp [hl]
|
2015-11-16 17:49:42 +00:00
|
|
|
jr nz, Script_jump
|
2015-11-16 16:53:26 +00:00
|
|
|
jr SkipTwoScriptBytes
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97556
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_if_greater_than: ; 97556
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, [ScriptVar]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
cp b
|
2015-11-16 17:49:42 +00:00
|
|
|
jr c, Script_jump
|
2015-11-16 16:53:26 +00:00
|
|
|
jr SkipTwoScriptBytes
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97562
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_if_less_than: ; 97562
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xb
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, [ScriptVar]
|
2013-02-28 05:31:12 +00:00
|
|
|
cp b
|
2015-11-16 17:49:42 +00:00
|
|
|
jr c, Script_jump
|
2015-11-16 16:53:26 +00:00
|
|
|
jr SkipTwoScriptBytes
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9756e
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_jumpstd: ; 9756e
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xc
|
|
|
|
; parameters:
|
|
|
|
; predefined_script (MultiByteParam)
|
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
call StdScript
|
2015-11-16 16:53:26 +00:00
|
|
|
jr ScriptJump
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97573
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_callstd: ; 97573
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xd
|
|
|
|
; parameters:
|
|
|
|
; predefined_script (MultiByteParam)
|
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
call StdScript
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2013-07-04 08:11:45 +00:00
|
|
|
jp ScriptCall
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9757b
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
StdScript: ; 9757b
|
2013-07-04 08:11:45 +00:00
|
|
|
call GetScriptByte
|
|
|
|
ld e, a
|
|
|
|
call GetScriptByte
|
|
|
|
ld d, a
|
2013-09-07 09:08:34 +00:00
|
|
|
ld hl, StdScripts
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 3
|
2013-07-04 08:11:45 +00:00
|
|
|
add hl, de
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-09-07 09:08:34 +00:00
|
|
|
ld a, BANK(StdScripts)
|
2013-07-04 08:11:45 +00:00
|
|
|
call GetFarByte
|
|
|
|
ld b, a
|
|
|
|
inc hl
|
2013-09-07 09:08:34 +00:00
|
|
|
ld a, BANK(StdScripts)
|
2013-07-04 08:11:45 +00:00
|
|
|
call GetFarHalfword
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97596
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
SkipTwoScriptBytes: ; 97596
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
|
|
|
call GetScriptByte
|
2013-02-28 21:04:26 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9759d
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
ScriptJump: ; 9759d
|
2013-02-28 21:04:26 +00:00
|
|
|
ld a, b
|
2013-03-01 02:39:40 +00:00
|
|
|
ld [ScriptBank], a
|
2013-02-28 21:04:26 +00:00
|
|
|
ld a, l
|
2013-03-01 02:39:40 +00:00
|
|
|
ld [ScriptPos], a
|
2013-02-28 21:04:26 +00:00
|
|
|
ld a, h
|
2013-05-03 18:27:24 +00:00
|
|
|
ld [ScriptPos + 1], a
|
2013-02-28 21:04:26 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 975aa
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_priorityjump: ; 975aa
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x8d
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd44e], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd44f], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd450], a
|
2013-07-04 09:37:20 +00:00
|
|
|
ld hl, ScriptFlags
|
2013-02-28 05:31:12 +00:00
|
|
|
set 3, [hl]
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 975c2
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_checktriggers: ; 975c2
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x13
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call CheckTriggers
|
2015-11-16 17:49:42 +00:00
|
|
|
jr z, .no_triggers
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
|
|
|
|
.no_triggers
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, $ff
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 975d1
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_checkmaptriggers: ; 975d1
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x11
|
|
|
|
; parameters:
|
|
|
|
; map_group (SingleByteParam)
|
|
|
|
; map_id (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2014-03-04 03:53:43 +00:00
|
|
|
call GetMapTrigger
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, d
|
|
|
|
or e
|
2015-11-16 17:49:42 +00:00
|
|
|
jr z, .no_triggers
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, [de]
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
|
|
|
|
.no_triggers
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, $ff
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 975eb
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_dotrigger: ; 975eb
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x14
|
|
|
|
; parameters:
|
|
|
|
; trigger_id (SingleByteParam)
|
|
|
|
|
2015-02-10 23:14:21 +00:00
|
|
|
ld a, [MapGroup]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2015-02-10 23:14:21 +00:00
|
|
|
ld a, [MapNumber]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2015-11-16 17:49:42 +00:00
|
|
|
jr DoTrigger
|
|
|
|
; 975f5
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_domaptrigger: ; 975f5
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x12
|
|
|
|
; parameters:
|
|
|
|
; map_group (MapGroupParam)
|
|
|
|
; map_id (MapIdParam)
|
|
|
|
; trigger_id (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2015-11-16 17:49:42 +00:00
|
|
|
DoTrigger: ; 975fd
|
2014-03-04 03:53:43 +00:00
|
|
|
call GetMapTrigger
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, d
|
|
|
|
or e
|
2015-11-16 17:49:42 +00:00
|
|
|
jr z, .no_trigger
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [de], a
|
2015-11-16 17:49:42 +00:00
|
|
|
.no_trigger
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97609
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_copybytetovar: ; 97609
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x19
|
|
|
|
; parameters:
|
|
|
|
; address (RAMAddressParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
|
|
|
ld a, [hl]
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97616
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_copyvartobyte: ; 97616
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x1a
|
|
|
|
; parameters:
|
|
|
|
; address (RAMAddressParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, [ScriptVar]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97623
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_loadvar: ; 97623
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x1b
|
|
|
|
; parameters:
|
|
|
|
; address (RAMAddressParam)
|
|
|
|
; value (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97630
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_writebyte: ; 97630
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x15
|
|
|
|
; parameters:
|
|
|
|
; value (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97637
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_addvar: ; 97637
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x16
|
|
|
|
; parameters:
|
|
|
|
; value (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld hl, ScriptVar
|
2013-02-28 05:31:12 +00:00
|
|
|
add [hl]
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97640
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_random: ; 97640
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x17
|
|
|
|
; parameters:
|
|
|
|
; input (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2015-11-16 16:53:26 +00:00
|
|
|
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2015-11-16 16:53:26 +00:00
|
|
|
call .Divide256byC
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
2015-11-16 16:53:26 +00:00
|
|
|
jr z, .no_restriction ; 256 % b == 0
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
|
|
|
xor a
|
|
|
|
sub b
|
|
|
|
ld b, a
|
2015-11-16 16:53:26 +00:00
|
|
|
.loop
|
2013-02-28 05:31:12 +00:00
|
|
|
push bc
|
2013-08-31 02:59:40 +00:00
|
|
|
call Random
|
2013-02-28 05:31:12 +00:00
|
|
|
pop bc
|
2015-11-16 16:53:26 +00:00
|
|
|
ld a, [hRandomAdd]
|
2013-02-28 05:31:12 +00:00
|
|
|
cp b
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nc, .loop
|
|
|
|
jr .finish
|
|
|
|
|
|
|
|
.no_restriction
|
2013-02-28 05:31:12 +00:00
|
|
|
push bc
|
2013-08-31 02:59:40 +00:00
|
|
|
call Random
|
2013-02-28 05:31:12 +00:00
|
|
|
pop bc
|
2015-11-16 16:53:26 +00:00
|
|
|
ld a, [hRandomAdd]
|
|
|
|
|
|
|
|
.finish
|
2013-02-28 05:31:12 +00:00
|
|
|
push af
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, [ScriptVar]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
|
|
|
pop af
|
2013-08-30 03:20:09 +00:00
|
|
|
call SimpleDivide
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97673
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
.Divide256byC: ; 97673
|
2013-07-04 08:11:45 +00:00
|
|
|
xor a
|
|
|
|
ld b, a
|
|
|
|
sub c
|
2015-11-16 16:53:26 +00:00
|
|
|
.mod_loop
|
2013-07-04 08:11:45 +00:00
|
|
|
inc b
|
|
|
|
sub c
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nc, .mod_loop
|
2013-07-04 08:11:45 +00:00
|
|
|
dec b
|
|
|
|
add c
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9767d
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_checkcode: ; 9767d
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x1c
|
|
|
|
; parameters:
|
|
|
|
; variable_id (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetVarAction
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, [de]
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97688
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_writevarcode: ; 97688
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x1d
|
|
|
|
; parameters:
|
|
|
|
; variable_id (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetVarAction
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, [ScriptVar]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [de], a
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97693
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_writecode: ; 97693
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x1e
|
|
|
|
; parameters:
|
|
|
|
; variable_id (SingleByteParam)
|
|
|
|
; value (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetVarAction
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [de], a
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9769e
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
GetVarAction: ; 9769e
|
2013-07-04 08:11:45 +00:00
|
|
|
ld c, a
|
2015-07-15 19:48:44 +00:00
|
|
|
callba _GetVarAction
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 976a6
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_checkver: ; 976a6
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x18
|
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
ld a, [Version]
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 976ad
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
Version: ; 976ad
|
2013-11-22 09:51:47 +00:00
|
|
|
db VERSION
|
2013-07-04 08:11:45 +00:00
|
|
|
; 976ae
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_pokenamemem: ; 976ae
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x40
|
|
|
|
; parameters:
|
2015-07-15 19:48:44 +00:00
|
|
|
; pokemon (PokemonParam); leave $0 to draw from script var
|
2013-02-28 05:31:12 +00:00
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .gotit
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, [ScriptVar]
|
2015-07-15 19:48:44 +00:00
|
|
|
.gotit
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd265], a
|
2013-08-30 03:20:09 +00:00
|
|
|
call GetPokemonName
|
2013-07-04 08:11:45 +00:00
|
|
|
ld de, StringBuffer1
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
ConvertMemToText: ; 976c0
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-09-30 18:19:33 +00:00
|
|
|
cp 3
|
|
|
|
jr c, .ok
|
2013-02-28 05:31:12 +00:00
|
|
|
xor a
|
2014-09-30 18:19:33 +00:00
|
|
|
.ok
|
2013-07-20 06:27:48 +00:00
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
CopyConvertedText: ; 976c8
|
2013-07-04 08:11:45 +00:00
|
|
|
ld hl, StringBuffer3
|
2015-07-20 07:51:52 +00:00
|
|
|
ld bc, StringBuffer4 - StringBuffer3
|
2013-02-28 05:31:12 +00:00
|
|
|
call AddNTimes
|
|
|
|
call CopyName2
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 976d5
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_itemtotext: ; 976d5
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x41
|
|
|
|
; parameters:
|
2015-11-19 04:16:25 +00:00
|
|
|
; item (ItemLabelByte); use 0 to draw from ScriptVar
|
2013-02-28 05:31:12 +00:00
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .ok
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, [ScriptVar]
|
2015-07-15 19:48:44 +00:00
|
|
|
.ok
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd265], a
|
2013-02-28 05:31:12 +00:00
|
|
|
call GetItemName
|
2013-07-04 08:11:45 +00:00
|
|
|
ld de, StringBuffer1
|
2015-11-16 16:53:26 +00:00
|
|
|
jr ConvertMemToText
|
2015-11-16 17:49:42 +00:00
|
|
|
; 976e9
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_mapnametotext: ; 976e9
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x42
|
|
|
|
; parameters:
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2015-02-10 23:14:21 +00:00
|
|
|
ld a, [MapGroup]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2015-02-10 23:14:21 +00:00
|
|
|
ld a, [MapNumber]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
|
|
|
call GetWorldMapLocation
|
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
ConvertLandmarkToText: ; 976f4
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-10-02 01:20:48 +00:00
|
|
|
callba GetLandmarkName
|
2013-07-04 08:11:45 +00:00
|
|
|
ld de, StringBuffer1
|
2015-07-15 19:48:44 +00:00
|
|
|
jp ConvertMemToText
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97701
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_displaylocation: ; 97701
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa5
|
|
|
|
; parameters:
|
|
|
|
; id (SingleByteParam)
|
2013-10-01 05:13:04 +00:00
|
|
|
; memory (SingleByteParam)
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-16 16:53:26 +00:00
|
|
|
jr ConvertLandmarkToText
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97706
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_trainertotext: ; 97706
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x43
|
|
|
|
; parameters:
|
|
|
|
; trainer_id (TrainerGroupParam)
|
|
|
|
; trainer_group (TrainerIdParam)
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2015-07-15 19:48:44 +00:00
|
|
|
callba GetTrainerName
|
2015-11-16 16:53:26 +00:00
|
|
|
jr ConvertMemToText
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97716
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_name: ; 97716
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa7
|
2013-10-01 05:13:04 +00:00
|
|
|
; parameters:
|
|
|
|
; type (SingleByteParam)
|
|
|
|
; id (SingleByteParam)
|
2014-07-23 05:39:41 +00:00
|
|
|
; memory (SingleByteParam)
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-10-17 21:18:52 +00:00
|
|
|
ld [wNamedObjectTypeBuffer], a
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
ContinueToGetName: ; 9771c
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [CurSpecies], a
|
2013-02-28 05:31:12 +00:00
|
|
|
call GetName
|
2013-07-04 08:11:45 +00:00
|
|
|
ld de, StringBuffer1
|
2015-07-15 19:48:44 +00:00
|
|
|
jp ConvertMemToText
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9772b
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_trainerclassname: ; 9772b
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa6
|
2014-07-23 05:39:41 +00:00
|
|
|
; parameters:
|
|
|
|
; id (SingleByteParam)
|
|
|
|
; memory (SingleByteParam)
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-05-18 09:16:11 +00:00
|
|
|
ld a, TRAINER_NAME
|
2015-10-17 21:18:52 +00:00
|
|
|
ld [wNamedObjectTypeBuffer], a
|
2015-11-16 16:53:26 +00:00
|
|
|
jr ContinueToGetName
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97732
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_readmoney: ; 97732
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x3d
|
|
|
|
; parameters:
|
|
|
|
; account (SingleByteParam)
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call ResetStringBuffer1
|
|
|
|
call GetMoneyAccount
|
2013-07-04 08:11:45 +00:00
|
|
|
ld hl, StringBuffer1
|
2015-10-10 21:03:04 +00:00
|
|
|
lb bc, PRINTNUM_RIGHTALIGN | 3, 6
|
2013-08-30 03:20:09 +00:00
|
|
|
call PrintNum
|
2013-07-04 08:11:45 +00:00
|
|
|
ld de, StringBuffer1
|
2015-07-15 19:48:44 +00:00
|
|
|
jp ConvertMemToText
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97747
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_readcoins: ; 97747
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x3e
|
|
|
|
; parameters:
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call ResetStringBuffer1
|
2013-07-04 08:11:45 +00:00
|
|
|
ld hl, StringBuffer1
|
2013-08-30 21:50:08 +00:00
|
|
|
ld de, Coins
|
2015-10-10 21:03:04 +00:00
|
|
|
lb bc, PRINTNUM_RIGHTALIGN | 2, 6
|
2013-08-30 03:20:09 +00:00
|
|
|
call PrintNum
|
2013-07-04 08:11:45 +00:00
|
|
|
ld de, StringBuffer1
|
2015-07-15 19:48:44 +00:00
|
|
|
jp ConvertMemToText
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9775c
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_RAM2MEM: ; 9775c
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x3f
|
|
|
|
; parameters:
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call ResetStringBuffer1
|
2014-05-21 20:21:46 +00:00
|
|
|
ld de, ScriptVar
|
2013-07-04 08:11:45 +00:00
|
|
|
ld hl, StringBuffer1
|
2015-10-10 21:03:04 +00:00
|
|
|
lb bc, PRINTNUM_RIGHTALIGN | 1, 3
|
2013-08-30 03:20:09 +00:00
|
|
|
call PrintNum
|
2013-07-04 08:11:45 +00:00
|
|
|
ld de, StringBuffer1
|
2015-07-15 19:48:44 +00:00
|
|
|
jp ConvertMemToText
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97771
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
ResetStringBuffer1: ; 97771
|
2013-07-04 08:11:45 +00:00
|
|
|
ld hl, StringBuffer1
|
2015-07-15 19:48:44 +00:00
|
|
|
ld bc, NAME_LENGTH
|
2013-07-04 08:11:45 +00:00
|
|
|
ld a, "@"
|
|
|
|
call ByteFill
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9777d
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_stringtotext: ; 9777d
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x44
|
|
|
|
; parameters:
|
|
|
|
; text_pointer (EncodedTextLabelParam)
|
|
|
|
; memory (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2014-04-12 19:45:40 +00:00
|
|
|
ld hl, CopyName1
|
2013-10-02 01:55:40 +00:00
|
|
|
rst FarCall
|
2013-07-04 08:11:45 +00:00
|
|
|
ld de, StringBuffer2
|
2015-07-15 19:48:44 +00:00
|
|
|
jp ConvertMemToText
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97792
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_givepokeitem: ; 97792
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x2f
|
|
|
|
; parameters:
|
|
|
|
; pointer (PointerParamToItemAndLetter)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
call GetFarByte
|
|
|
|
ld b, a
|
|
|
|
push bc
|
|
|
|
inc hl
|
2015-07-15 19:48:44 +00:00
|
|
|
ld bc, MAIL_MAX_LENGTH
|
2015-02-10 23:14:21 +00:00
|
|
|
ld de, wd002
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
call FarCopyBytes
|
|
|
|
pop bc
|
2015-07-15 19:48:44 +00:00
|
|
|
callba GivePokeItem
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 977b7
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_checkpokeitem: ; 977b7
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x30
|
|
|
|
; parameters:
|
|
|
|
; pointer (PointerParamToItemAndLetter)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2015-11-18 15:42:42 +00:00
|
|
|
callba CheckPokeItem
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 977ca
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_giveitem: ; 977ca
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x1f
|
|
|
|
; parameters:
|
|
|
|
; item (ItemLabelByte)
|
|
|
|
; quantity (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-03 20:05:19 +00:00
|
|
|
cp ITEM_FROM_MEM
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .ok
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, [ScriptVar]
|
2015-07-15 19:48:44 +00:00
|
|
|
.ok
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [CurItem], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-01 23:13:31 +00:00
|
|
|
ld [wItemQuantityChangeBuffer], a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld hl, NumItems
|
2013-09-08 05:35:10 +00:00
|
|
|
call ReceiveItem
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nc, .full
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, $1
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-07-15 19:48:44 +00:00
|
|
|
.full
|
2013-02-28 05:31:12 +00:00
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 977f0
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_takeitem: ; 977f0
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x20
|
|
|
|
; parameters:
|
|
|
|
; item (ItemLabelByte)
|
|
|
|
; quantity (DecimalParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [CurItem], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-01 23:13:31 +00:00
|
|
|
ld [wItemQuantityChangeBuffer], a
|
2015-11-04 03:35:36 +00:00
|
|
|
ld a, -1
|
|
|
|
ld [ItemCountBuffer], a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld hl, NumItems
|
2013-09-08 05:35:10 +00:00
|
|
|
call TossItem
|
2013-02-28 05:31:12 +00:00
|
|
|
ret nc
|
|
|
|
ld a, $1
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97812
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_checkitem: ; 97812
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x21
|
|
|
|
; parameters:
|
|
|
|
; item (ItemLabelByte)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [CurItem], a
|
|
|
|
ld hl, NumItems
|
2013-09-08 05:35:10 +00:00
|
|
|
call CheckItem
|
2013-02-28 05:31:12 +00:00
|
|
|
ret nc
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, 1
|
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97829
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_givemoney: ; 97829
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x22
|
|
|
|
; parameters:
|
|
|
|
; account (SingleByteParam)
|
|
|
|
; money (MoneyByteParam)
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetMoneyAccount
|
|
|
|
call LoadMoneyAmountToMem
|
|
|
|
callba GiveMoney
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97836
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_takemoney: ; 97836
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x23
|
|
|
|
; parameters:
|
|
|
|
; account (SingleByteParam)
|
|
|
|
; money (MoneyByteParam)
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetMoneyAccount
|
|
|
|
call LoadMoneyAmountToMem
|
|
|
|
callba TakeMoney
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97843
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_checkmoney: ; 97843
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x24
|
|
|
|
; parameters:
|
|
|
|
; account (SingleByteParam)
|
|
|
|
; money (MoneyByteParam)
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetMoneyAccount
|
|
|
|
call LoadMoneyAmountToMem
|
2015-10-30 03:32:11 +00:00
|
|
|
callba CompareMoney
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9784f
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
CompareMoneyAction: ; 9784f
|
2014-05-21 20:21:46 +00: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-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97861
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
GetMoneyAccount: ; 97861
|
2013-07-04 08:11:45 +00:00
|
|
|
call GetScriptByte
|
|
|
|
and a
|
2015-02-10 23:14:21 +00:00
|
|
|
ld de, Money
|
2013-07-04 08:11:45 +00:00
|
|
|
ret z
|
2015-02-10 23:14:21 +00:00
|
|
|
ld de, wMomsMoney
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9786d
|
2013-02-28 21:28:29 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
LoadMoneyAmountToMem: ; 9786d
|
2015-07-17 21:17:10 +00:00
|
|
|
ld bc, hMoneyTemp
|
2013-07-04 08:11:45 +00: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
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97881
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_givecoins: ; 97881
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x25
|
|
|
|
; parameters:
|
|
|
|
; coins (CoinByteParam)
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call LoadCoinAmountToMem
|
|
|
|
callba GiveCoins
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 9788b
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_takecoins: ; 9788b
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x26
|
|
|
|
; parameters:
|
|
|
|
; coins (CoinByteParam)
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call LoadCoinAmountToMem
|
|
|
|
callba TakeCoins
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97895
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_checkcoins: ; 97895
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x27
|
|
|
|
; parameters:
|
|
|
|
; coins (CoinByteParam)
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call LoadCoinAmountToMem
|
|
|
|
callba CheckCoins
|
2015-10-30 03:32:11 +00:00
|
|
|
jr CompareMoneyAction
|
2013-07-20 06:27:48 +00:00
|
|
|
; 978a0
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
LoadCoinAmountToMem: ; 978a0
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-10-30 03:32:11 +00:00
|
|
|
ld [hMoneyTemp + 1], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-17 21:17:10 +00:00
|
|
|
ld [hMoneyTemp], a
|
|
|
|
ld bc, hMoneyTemp
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 978ae
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_checktime: ; 978ae
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x2b
|
|
|
|
; parameters:
|
|
|
|
; time (SingleByteParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2015-07-15 19:48:44 +00:00
|
|
|
callba CheckTime
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
and c
|
|
|
|
ret z
|
|
|
|
ld a, $1
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 978c3
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_checkpoke: ; 978c3
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x2c
|
|
|
|
; parameters:
|
|
|
|
; pkmn (PokemonParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld hl, PartySpecies
|
|
|
|
ld de, 1
|
2013-02-28 05:31:12 +00:00
|
|
|
call IsInArray
|
|
|
|
ret nc
|
2014-05-21 20:21:46 +00:00
|
|
|
ld a, 1
|
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 978da
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_addcellnum: ; 978da
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x28
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2015-07-15 19:48:44 +00:00
|
|
|
callba AddPhoneNumber
|
2013-02-28 05:31:12 +00:00
|
|
|
ret nc
|
|
|
|
ld a, $1
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 978ef
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_delcellnum: ; 978ef
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x29
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2015-07-15 19:48:44 +00:00
|
|
|
callba DelCellNum
|
2013-02-28 05:31:12 +00:00
|
|
|
ret nc
|
|
|
|
ld a, $1
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97904
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_checkcellnum: ; 97904
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x2a
|
|
|
|
; parameters:
|
|
|
|
; person (SingleByteParam)
|
2015-07-17 21:17:10 +00:00
|
|
|
; returns false if the cell number is not in your phone
|
2013-02-28 05:31:12 +00:00
|
|
|
|
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2015-07-15 19:48:44 +00:00
|
|
|
callba CheckCellNum
|
2013-02-28 05:31:12 +00:00
|
|
|
ret nc
|
|
|
|
ld a, $1
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97919
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_specialphonecall: ; 97919
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x9c
|
|
|
|
; parameters:
|
|
|
|
; call_id (MultiByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-17 21:17:10 +00:00
|
|
|
ld [wSpecialPhoneCallID], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-17 21:17:10 +00:00
|
|
|
ld [wSpecialPhoneCallID + 1], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97926
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_checkphonecall: ; 97926
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x9d
|
2015-07-17 21:17:10 +00:00
|
|
|
; returns false if no special phone call is stored
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-07-17 21:17:10 +00:00
|
|
|
ld a, [wSpecialPhoneCallID]
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
2014-05-21 20:21:46 +00:00
|
|
|
jr z, .ok
|
|
|
|
ld a, 1
|
|
|
|
.ok
|
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97932
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_givepoke: ; 97932
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x2d
|
|
|
|
; parameters:
|
|
|
|
; pokemon (PokemonParam)
|
|
|
|
; level (DecimalParam)
|
|
|
|
; item (ItemLabelByte)
|
|
|
|
; trainer (DecimalParam)
|
|
|
|
; trainer_name_pointer (MultiByteParam)
|
|
|
|
; pkmn_nickname (MultiByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [CurPartySpecies], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [CurPartyLevel], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [CurItem], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
|
|
|
ld b, a
|
2014-05-21 20:21:46 +00:00
|
|
|
jr z, .ok
|
2013-03-01 02:39:40 +00:00
|
|
|
ld hl, ScriptPos
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
|
|
|
call GetScriptByte
|
|
|
|
call GetScriptByte
|
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
.ok
|
2015-07-15 19:48:44 +00:00
|
|
|
callba GivePoke
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, b
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97968
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_giveegg: ; 97968
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x2e
|
|
|
|
; parameters:
|
|
|
|
; pkmn (PokemonParam)
|
|
|
|
; level (DecimalParam)
|
2015-07-17 21:17:10 +00:00
|
|
|
; if no room in the party, return 0 in ScriptVar; else, return 2
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-10-08 01:27:32 +00:00
|
|
|
xor a ; PARTYMON
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [MonType], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [CurPartySpecies], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [CurPartyLevel], a
|
2014-06-13 01:32:42 +00:00
|
|
|
callba GiveEgg
|
2013-02-28 05:31:12 +00:00
|
|
|
ret nc
|
2015-07-17 21:17:10 +00:00
|
|
|
ld a, 2
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97988
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_setevent: ; 97988
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x33
|
|
|
|
; parameters:
|
|
|
|
; bit_number (MultiByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2015-07-19 03:45:39 +00:00
|
|
|
ld b, SET_FLAG
|
2013-08-23 19:48:26 +00:00
|
|
|
call EventFlagAction
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97996
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_clearevent: ; 97996
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x32
|
|
|
|
; parameters:
|
|
|
|
; bit_number (MultiByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2015-07-19 03:45:39 +00:00
|
|
|
ld b, RESET_FLAG
|
2013-08-23 19:48:26 +00:00
|
|
|
call EventFlagAction
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 979a4
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_checkevent: ; 979a4
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x31
|
|
|
|
; parameters:
|
|
|
|
; bit_number (MultiByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2015-07-19 03:45:39 +00:00
|
|
|
ld b, CHECK_FLAG
|
2013-08-23 19:48:26 +00:00
|
|
|
call EventFlagAction
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, c
|
|
|
|
and a
|
2015-11-16 16:53:26 +00:00
|
|
|
jr z, .false
|
2015-07-17 21:17:10 +00:00
|
|
|
ld a, 1
|
|
|
|
.false
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 979bb
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_setflag: ; 979bb
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x36
|
|
|
|
; parameters:
|
|
|
|
; bit_number (MultiByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2015-07-17 21:17:10 +00:00
|
|
|
ld b, 1 ; set
|
2015-07-15 19:48:44 +00:00
|
|
|
call _EngineFlagAction
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 979c9
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_clearflag: ; 979c9
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x35
|
|
|
|
; parameters:
|
|
|
|
; bit_number (MultiByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2015-07-17 21:17:10 +00:00
|
|
|
ld b, 0 ; clear
|
2015-07-15 19:48:44 +00:00
|
|
|
call _EngineFlagAction
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 979d7
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_checkflag: ; 979d7
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x34
|
|
|
|
; parameters:
|
|
|
|
; bit_number (MultiByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2015-07-17 21:17:10 +00:00
|
|
|
ld b, 2 ; check
|
2015-07-15 19:48:44 +00:00
|
|
|
call _EngineFlagAction
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, c
|
|
|
|
and a
|
2015-11-16 16:53:26 +00:00
|
|
|
jr z, .false
|
2015-07-17 21:17:10 +00:00
|
|
|
ld a, 1
|
|
|
|
.false
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 979ee
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
_EngineFlagAction: ; 979ee
|
2013-10-02 01:20:48 +00:00
|
|
|
callba EngineFlagAction
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 979f5
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_wildoff: ; 979f5
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x38
|
|
|
|
|
2013-09-24 07:31:00 +00:00
|
|
|
ld hl, StatusFlags
|
2013-02-28 05:31:12 +00:00
|
|
|
set 5, [hl]
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 979fb
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_wildon: ; 979fb
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x37
|
|
|
|
|
2013-09-24 07:31:00 +00:00
|
|
|
ld hl, StatusFlags
|
2013-02-28 05:31:12 +00:00
|
|
|
res 5, [hl]
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97a01
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_xycompare: ; 97a01
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x39
|
|
|
|
; parameters:
|
|
|
|
; pointer (MultiByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd453], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd454], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97a0e
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_warpfacing: ; 97a0e
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa3
|
|
|
|
; parameters:
|
|
|
|
; facing (SingleByteParam)
|
|
|
|
; map_group (MapGroupParam)
|
|
|
|
; map_id (MapIdParam)
|
|
|
|
; x (SingleByteParam)
|
|
|
|
; y (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
and $3
|
|
|
|
ld c, a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wPlayerSpriteSetupFlags]
|
2013-02-28 05:31:12 +00:00
|
|
|
set 5, a
|
|
|
|
or c
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wPlayerSpriteSetupFlags], a
|
2015-07-17 21:17:10 +00:00
|
|
|
; fall through
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_warp: ; 97a1d
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x3c
|
|
|
|
; parameters:
|
|
|
|
; map_group (MapGroupParam)
|
|
|
|
; map_id (MapIdParam)
|
|
|
|
; x (SingleByteParam)
|
|
|
|
; y (SingleByteParam)
|
|
|
|
|
2015-07-17 21:17:10 +00:00
|
|
|
; This seems to be some sort of error handling case.
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
2015-11-16 16:53:26 +00:00
|
|
|
jr z, .not_ok
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [MapGroup], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [MapNumber], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [XCoord], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [YCoord], a
|
2015-07-17 21:17:10 +00:00
|
|
|
ld a, -1
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd001], a
|
2015-10-24 23:49:19 +00:00
|
|
|
ld a, MAPSETUP_WARP
|
2015-10-07 17:19:41 +00:00
|
|
|
ld [hMapEntryMethod], a
|
2015-07-17 21:17:10 +00:00
|
|
|
ld a, 1
|
2015-07-15 19:48:44 +00:00
|
|
|
call LoadMapStatus
|
2013-07-04 09:37:20 +00:00
|
|
|
call StopScript
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
.not_ok
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
|
|
|
call GetScriptByte
|
|
|
|
call GetScriptByte
|
2015-07-17 21:17:10 +00:00
|
|
|
ld a, -1
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd001], a
|
2015-10-24 23:49:19 +00:00
|
|
|
ld a, MAPSETUP_BADWARP
|
2015-10-07 17:19:41 +00:00
|
|
|
ld [hMapEntryMethod], a
|
2015-07-17 21:17:10 +00:00
|
|
|
ld a, 1
|
2015-07-15 19:48:44 +00:00
|
|
|
call LoadMapStatus
|
2013-07-04 09:37:20 +00:00
|
|
|
call StopScript
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97a65
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_warpmod: ; 97a65
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x3a
|
|
|
|
; parameters:
|
|
|
|
; warp_id (SingleByteParam)
|
|
|
|
; map_group (MapGroupParam)
|
|
|
|
; map_id (MapIdParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-12 16:10:19 +00:00
|
|
|
ld [BackupWarpNumber], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [BackupMapGroup], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [BackupMapNumber], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97a78
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_blackoutmod: ; 97a78
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x3b
|
|
|
|
; parameters:
|
|
|
|
; map_group (MapGroupParam)
|
|
|
|
; map_id (MapIdParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-11 21:11:08 +00:00
|
|
|
ld [wLastSpawnMapGroup], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-11 21:11:08 +00:00
|
|
|
ld [wLastSpawnMapNumber], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97a85
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_reloadmapmusic: ; 97a85
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x83
|
|
|
|
|
2015-07-17 21:17:10 +00:00
|
|
|
ld a, 1
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wc2c1], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97a8b
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_writecmdqueue: ; 97a8b
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x7d
|
|
|
|
; parameters:
|
|
|
|
; queue_pointer (MultiByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2013-03-01 02:39:40 +00:00
|
|
|
ld a, [ScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2015-11-19 04:16:25 +00:00
|
|
|
callba WriteCmdQueue ; no need to farcall
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97a9e
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_delcmdqueue: ; 97a9e
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x7e
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
|
|
|
|
xor a
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2015-11-19 04:16:25 +00:00
|
|
|
callba DelCmdQueue ; no need to farcall
|
2013-02-28 05:31:12 +00:00
|
|
|
ret c
|
2015-07-17 21:17:10 +00:00
|
|
|
ld a, 1
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97ab3
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_changemap: ; 97ab3
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x79
|
|
|
|
; parameters:
|
|
|
|
; map_data_pointer (MapDataPointerParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [MapBlockDataBank], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [MapBlockDataPointer], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [MapBlockDataPointer + 1], a
|
2015-07-15 19:48:44 +00:00
|
|
|
call ChangeMap
|
|
|
|
call BufferScreen
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97acc
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_changeblock: ; 97acc
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x7a
|
|
|
|
; parameters:
|
|
|
|
; x (SingleByteParam)
|
|
|
|
; y (SingleByteParam)
|
|
|
|
; block (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-17 21:17:10 +00:00
|
|
|
add 4
|
2013-02-28 05:31:12 +00:00
|
|
|
ld d, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-17 21:17:10 +00:00
|
|
|
add 4
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetBlockLocation
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hl], a
|
2015-07-15 19:48:44 +00:00
|
|
|
call BufferScreen
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97ae3
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_reloadmappart:: ; 97ae3
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x7c
|
|
|
|
|
|
|
|
xor a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [hBGMapMode], a
|
2015-11-11 19:12:46 +00:00
|
|
|
call OverworldTextModeSwitch
|
2015-11-19 23:07:20 +00:00
|
|
|
call GetMovementPermissions
|
|
|
|
callba ReloadMapPart
|
2015-07-22 19:57:02 +00:00
|
|
|
call UpdateSprites
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97af6
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_warpcheck: ; 97af6
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x8e
|
|
|
|
|
2015-11-12 16:10:19 +00:00
|
|
|
call WarpCheck
|
2013-02-28 05:31:12 +00:00
|
|
|
ret nc
|
2015-11-13 23:59:49 +00:00
|
|
|
callba EnableEvents
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97b01
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-13 23:59:49 +00:00
|
|
|
Script_enableevents: ; unreferenced
|
|
|
|
callba EnableEvents
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97b08
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_newloadmap: ; 97b08
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x8a
|
|
|
|
; parameters:
|
|
|
|
; which_method (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-10-07 17:19:41 +00:00
|
|
|
ld [hMapEntryMethod], a
|
2015-07-17 21:17:10 +00:00
|
|
|
ld a, 1
|
2015-07-15 19:48:44 +00:00
|
|
|
call LoadMapStatus
|
2013-07-04 09:37:20 +00:00
|
|
|
call StopScript
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97b16
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_reloadandreturn: ; 97b16
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x92
|
|
|
|
|
2013-07-20 06:27:48 +00:00
|
|
|
call Script_newloadmap
|
2013-07-04 09:37:20 +00:00
|
|
|
jp Script_end
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97b1c
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_loadfont: ; 97b1c
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x47
|
|
|
|
|
2015-10-18 00:49:34 +00:00
|
|
|
call LoadFont
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97b20
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_refreshscreen: ; 97b20
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x48
|
|
|
|
; parameters:
|
|
|
|
; dummy (SingleByteParam)
|
|
|
|
|
2013-08-30 03:20:09 +00:00
|
|
|
call ResetWindow
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97b27
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_loadbytec2cf: ; 97b27
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x4a
|
|
|
|
; parameters:
|
|
|
|
; byte (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wc2cf], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97b2e
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
|
|
|
|
LoadMoveSpritesScript: ; 97b2e
|
|
|
|
loadmovesprites
|
|
|
|
; 97b2f
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_loadmovesprites: ; 97b2f
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x49
|
|
|
|
|
2013-08-30 03:20:09 +00:00
|
|
|
call Function2e20
|
2015-10-24 14:34:19 +00:00
|
|
|
call LoadMoveSprites
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97b36
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_passtoengine: ; 97b36
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x89
|
|
|
|
; parameters:
|
|
|
|
; data_pointer (PointerLabelBeforeBank)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
push af
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld l, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld h, a
|
|
|
|
pop af
|
|
|
|
call StartAutoInput
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97b47
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_pause: ; 97b47
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x8b
|
|
|
|
; parameters:
|
|
|
|
; length (DecimalParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
2015-11-16 16:53:26 +00:00
|
|
|
jr z, .loop
|
2013-07-04 09:37:20 +00:00
|
|
|
ld [ScriptDelay], a
|
2015-07-17 21:17:10 +00:00
|
|
|
.loop
|
2013-07-04 09:37:20 +00:00
|
|
|
ld c, 2
|
2013-02-28 05:31:12 +00:00
|
|
|
call DelayFrames
|
2013-07-04 09:37:20 +00:00
|
|
|
ld hl, ScriptDelay
|
2013-02-28 05:31:12 +00:00
|
|
|
dec [hl]
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .loop
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97b5c
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_deactivatefacing: ; 97b5c
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x8c
|
|
|
|
; parameters:
|
|
|
|
; time (SingleByteParam)
|
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
2015-11-16 16:53:26 +00:00
|
|
|
jr z, .no_time
|
2013-07-04 09:37:20 +00:00
|
|
|
ld [ScriptDelay], a
|
2015-07-17 21:17:10 +00:00
|
|
|
.no_time
|
2013-07-04 09:37:20 +00:00
|
|
|
ld a, SCRIPT_WAIT
|
|
|
|
ld [ScriptMode], a
|
|
|
|
call StopScript
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97b6e
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_ptpriorityjump: ; 97b6e
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x8f
|
|
|
|
; parameters:
|
|
|
|
; pointer (ScriptPointerLabelParam)
|
|
|
|
|
2013-07-04 09:37:20 +00:00
|
|
|
call StopScript
|
2015-11-16 17:49:42 +00:00
|
|
|
jp Script_jump
|
|
|
|
; 97b74
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_end: ; 97b74
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x91
|
|
|
|
|
2013-07-04 09:37:20 +00:00
|
|
|
call ExitScriptSubroutine
|
2015-07-17 21:17:10 +00:00
|
|
|
jr c, .resume
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-12 04:38:57 +00:00
|
|
|
|
2015-07-17 21:17:10 +00:00
|
|
|
.resume
|
2013-02-28 05:31:12 +00:00
|
|
|
xor a
|
2013-07-04 08:11:45 +00:00
|
|
|
ld [ScriptRunning], a
|
2013-07-04 09:37:20 +00:00
|
|
|
ld a, SCRIPT_OFF
|
|
|
|
ld [ScriptMode], a
|
|
|
|
ld hl, ScriptFlags
|
2013-02-28 05:31:12 +00:00
|
|
|
res 0, [hl]
|
2013-07-04 09:37:20 +00:00
|
|
|
call StopScript
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97b8c
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_return: ; 97b8c
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x90
|
|
|
|
|
2013-07-04 09:37:20 +00:00
|
|
|
call ExitScriptSubroutine
|
2015-07-17 21:17:10 +00:00
|
|
|
jr c, .dummy
|
|
|
|
.dummy
|
2013-07-04 09:37:20 +00:00
|
|
|
ld hl, ScriptFlags
|
2013-02-28 05:31:12 +00:00
|
|
|
res 0, [hl]
|
2013-07-04 09:37:20 +00:00
|
|
|
call StopScript
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97b9a
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
ExitScriptSubroutine: ; 97b9a
|
2013-07-04 09:37:20 +00:00
|
|
|
; Return carry if there's no parent to return to.
|
|
|
|
|
2015-11-16 16:53:26 +00:00
|
|
|
ld hl, wScriptStackSize
|
2013-07-04 08:11:45 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-11-16 16:53:26 +00:00
|
|
|
jr z, .done
|
2013-07-04 08:11:45 +00:00
|
|
|
dec [hl]
|
|
|
|
ld e, [hl]
|
|
|
|
ld d, $0
|
2015-11-16 16:53:26 +00:00
|
|
|
ld hl, wScriptStackBA1
|
2015-07-20 15:28:05 +00:00
|
|
|
rept 3
|
|
|
|
add hl,de
|
|
|
|
endr
|
2013-07-04 08:11:45 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
2015-07-17 21:17:10 +00:00
|
|
|
and " "
|
2013-07-04 08:11:45 +00: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 21:17:10 +00:00
|
|
|
.done
|
2013-07-04 08:11:45 +00:00
|
|
|
scf
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97bc0
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_resetfuncs: ; 97bc0
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x93
|
|
|
|
|
|
|
|
xor a
|
2015-11-16 16:53:26 +00:00
|
|
|
ld [wScriptStackSize], a
|
2013-07-04 08:11:45 +00:00
|
|
|
ld [ScriptRunning], a
|
2013-07-04 09:37:20 +00:00
|
|
|
ld a, SCRIPT_OFF
|
|
|
|
ld [ScriptMode], a
|
|
|
|
ld hl, ScriptFlags
|
2013-02-28 05:31:12 +00:00
|
|
|
res 0, [hl]
|
2013-07-04 09:37:20 +00:00
|
|
|
call StopScript
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97bd5
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_halloffame: ; 97bd5
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa1
|
|
|
|
|
2015-02-10 23:14:21 +00:00
|
|
|
ld hl, GameTimerPause
|
2013-02-28 05:31:12 +00:00
|
|
|
res 0, [hl]
|
2013-09-15 23:07:38 +00:00
|
|
|
callba Mobile_HallOfFame
|
|
|
|
callba Mobile_HallOfFame2
|
|
|
|
callba HallOfFame
|
2015-02-10 23:14:21 +00:00
|
|
|
ld hl, GameTimerPause
|
2013-02-28 05:31:12 +00:00
|
|
|
set 0, [hl]
|
2013-02-28 07:16:08 +00:00
|
|
|
jr DisplayCredits
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97bf3
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_credits: ; 97bf3
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa2
|
|
|
|
|
2015-10-07 17:19:41 +00:00
|
|
|
callba RedCredits
|
2013-02-28 07:16:08 +00:00
|
|
|
; fallthrough
|
2013-07-20 06:27:48 +00:00
|
|
|
|
2013-02-28 07:16:08 +00:00
|
|
|
DisplayCredits:
|
2013-07-20 06:27:48 +00:00
|
|
|
call Script_resetfuncs
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, $3
|
2015-07-15 19:48:44 +00:00
|
|
|
call LoadMapStatus
|
2013-07-04 09:37:20 +00:00
|
|
|
call StopScript
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97c051
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_wait: ; 97c05
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa8
|
|
|
|
; parameters:
|
|
|
|
; unknown (SingleByteParam)
|
|
|
|
|
|
|
|
push bc
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-17 21:17:10 +00:00
|
|
|
.loop
|
2013-02-28 05:31:12 +00:00
|
|
|
push af
|
2013-07-04 09:37:20 +00:00
|
|
|
ld c, 6
|
2013-02-28 05:31:12 +00:00
|
|
|
call DelayFrames
|
|
|
|
pop af
|
|
|
|
dec a
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .loop
|
2013-02-28 05:31:12 +00:00
|
|
|
pop bc
|
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97c15
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-11-16 17:49:42 +00:00
|
|
|
Script_check_save: ; 97c15
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa9
|
|
|
|
|
2015-11-16 16:53:26 +00:00
|
|
|
callba CheckSave
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, c
|
2014-05-21 20:21:46 +00:00
|
|
|
ld [ScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
; 97c20
|
2013-07-04 08:11:45 +00:00
|
|
|
|
2013-11-22 09:51:47 +00:00
|
|
|
|
2015-11-16 16:53:26 +00:00
|
|
|
; 97c20 unreferenced
|
2013-11-22 09:51:47 +00:00
|
|
|
ld a, [.byte]
|
|
|
|
ld [ScriptVar], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.byte
|
|
|
|
db 0
|
|
|
|
; 97c28
|