2013-11-22 09:51:47 +00:00
|
|
|
; Event scripting commands.
|
|
|
|
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
EnableScriptMode::
|
2013-11-22 09:51:47 +00:00
|
|
|
push af
|
2015-07-15 19:48:44 +00:00
|
|
|
ld a, SCRIPT_READ
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptMode], a
|
2013-11-22 09:51:47 +00:00
|
|
|
pop af
|
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ScriptEvents::
|
2013-11-22 09:51:47 +00:00
|
|
|
call StartScript
|
|
|
|
.loop
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptMode]
|
2013-11-22 09:51:47 +00:00
|
|
|
ld hl, .modes
|
|
|
|
rst JumpTable
|
|
|
|
call CheckScript
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
.modes
|
2013-11-22 09:51:47 +00:00
|
|
|
dw EndScript
|
|
|
|
dw RunScriptCommand
|
|
|
|
dw WaitScriptMovement
|
|
|
|
dw WaitScript
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
EndScript:
|
2013-11-22 09:51:47 +00:00
|
|
|
call StopScript
|
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
WaitScript:
|
2013-11-22 09:51:47 +00:00
|
|
|
call StopScript
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wScriptDelay
|
2013-11-22 09:51:47 +00:00
|
|
|
dec [hl]
|
|
|
|
ret nz
|
|
|
|
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall Function58b9
|
2013-11-22 09:51:47 +00:00
|
|
|
|
|
|
|
ld a, SCRIPT_READ
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptMode], a
|
2013-11-22 09:51:47 +00:00
|
|
|
call StartScript
|
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
WaitScriptMovement:
|
2013-11-22 09:51:47 +00:00
|
|
|
call StopScript
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wVramState
|
2013-11-22 09:51:47 +00:00
|
|
|
bit 7, [hl]
|
|
|
|
ret nz
|
|
|
|
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall Function58b9
|
2013-11-22 09:51:47 +00:00
|
|
|
|
|
|
|
ld a, SCRIPT_READ
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptMode], a
|
2013-11-22 09:51:47 +00:00
|
|
|
call StartScript
|
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
RunScriptCommand:
|
2013-11-22 09:51:47 +00:00
|
|
|
call GetScriptByte
|
|
|
|
ld hl, ScriptCommandTable
|
|
|
|
rst JumpTable
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ScriptCommandTable:
|
2017-12-26 23:45:04 +00:00
|
|
|
; entries correspond to macros/scripts/events.asm enumeration
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_scall ; 00
|
|
|
|
dw Script_farscall ; 01
|
|
|
|
dw Script_ptcall ; 02
|
|
|
|
dw Script_jump ; 03
|
|
|
|
dw Script_farjump ; 04
|
|
|
|
dw Script_ptjump ; 05
|
2018-02-03 02:09:17 +00:00
|
|
|
dw Script_ifequal ; 06
|
|
|
|
dw Script_ifnotequal ; 07
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_iffalse ; 08
|
|
|
|
dw Script_iftrue ; 09
|
2018-02-03 02:09:17 +00:00
|
|
|
dw Script_ifgreater ; 0a
|
|
|
|
dw Script_ifless ; 0b
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_jumpstd ; 0c
|
|
|
|
dw Script_callstd ; 0d
|
|
|
|
dw Script_callasm ; 0e
|
|
|
|
dw Script_special ; 0f
|
|
|
|
dw Script_ptcallasm ; 10
|
2017-12-24 18:46:34 +00:00
|
|
|
dw Script_checkmapscene ; 11
|
|
|
|
dw Script_setmapscene ; 12
|
|
|
|
dw Script_checkscene ; 13
|
|
|
|
dw Script_setscene ; 14
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_writebyte ; 15
|
|
|
|
dw Script_addvar ; 16
|
|
|
|
dw Script_random ; 17
|
|
|
|
dw Script_checkver ; 18
|
|
|
|
dw Script_copybytetovar ; 19
|
|
|
|
dw Script_copyvartobyte ; 1a
|
|
|
|
dw Script_loadvar ; 1b
|
|
|
|
dw Script_checkcode ; 1c
|
|
|
|
dw Script_writevarcode ; 1d
|
|
|
|
dw Script_writecode ; 1e
|
|
|
|
dw Script_giveitem ; 1f
|
|
|
|
dw Script_takeitem ; 20
|
|
|
|
dw Script_checkitem ; 21
|
|
|
|
dw Script_givemoney ; 22
|
|
|
|
dw Script_takemoney ; 23
|
|
|
|
dw Script_checkmoney ; 24
|
|
|
|
dw Script_givecoins ; 25
|
|
|
|
dw Script_takecoins ; 26
|
|
|
|
dw Script_checkcoins ; 27
|
|
|
|
dw Script_addcellnum ; 28
|
|
|
|
dw Script_delcellnum ; 29
|
|
|
|
dw Script_checkcellnum ; 2a
|
|
|
|
dw Script_checktime ; 2b
|
|
|
|
dw Script_checkpoke ; 2c
|
|
|
|
dw Script_givepoke ; 2d
|
|
|
|
dw Script_giveegg ; 2e
|
|
|
|
dw Script_givepokeitem ; 2f
|
|
|
|
dw Script_checkpokeitem ; 30
|
|
|
|
dw Script_checkevent ; 31
|
|
|
|
dw Script_clearevent ; 32
|
|
|
|
dw Script_setevent ; 33
|
|
|
|
dw Script_checkflag ; 34
|
|
|
|
dw Script_clearflag ; 35
|
|
|
|
dw Script_setflag ; 36
|
|
|
|
dw Script_wildon ; 37
|
|
|
|
dw Script_wildoff ; 38
|
|
|
|
dw Script_xycompare ; 39
|
|
|
|
dw Script_warpmod ; 3a
|
|
|
|
dw Script_blackoutmod ; 3b
|
|
|
|
dw Script_warp ; 3c
|
|
|
|
dw Script_readmoney ; 3d
|
|
|
|
dw Script_readcoins ; 3e
|
2018-01-12 06:40:20 +00:00
|
|
|
dw Script_vartomem ; 3f
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_pokenamemem ; 40
|
|
|
|
dw Script_itemtotext ; 41
|
|
|
|
dw Script_mapnametotext ; 42
|
|
|
|
dw Script_trainertotext ; 43
|
|
|
|
dw Script_stringtotext ; 44
|
|
|
|
dw Script_itemnotify ; 45
|
|
|
|
dw Script_pocketisfull ; 46
|
2018-02-03 02:09:17 +00:00
|
|
|
dw Script_opentext ; 47
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_refreshscreen ; 48
|
|
|
|
dw Script_closetext ; 49
|
|
|
|
dw Script_loadbytec2cf ; 4a
|
|
|
|
dw Script_farwritetext ; 4b
|
|
|
|
dw Script_writetext ; 4c
|
|
|
|
dw Script_repeattext ; 4d
|
|
|
|
dw Script_yesorno ; 4e
|
2018-02-26 01:05:37 +00:00
|
|
|
dw Script_loadmenu ; 4f
|
2015-12-25 03:58:42 +00:00
|
|
|
dw Script_closewindow ; 50
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_jumptextfaceplayer ; 51
|
2017-12-29 02:22:35 +00:00
|
|
|
if _CRYSTAL
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_farjumptext ; 52
|
2017-12-29 02:22:35 +00:00
|
|
|
endc
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_jumptext ; 53
|
|
|
|
dw Script_waitbutton ; 54
|
|
|
|
dw Script_buttonsound ; 55
|
|
|
|
dw Script_pokepic ; 56
|
|
|
|
dw Script_closepokepic ; 57
|
2016-01-06 21:59:56 +00:00
|
|
|
dw Script__2dmenu ; 58
|
|
|
|
dw Script_verticalmenu ; 59
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_loadpikachudata ; 5a
|
|
|
|
dw Script_randomwildmon ; 5b
|
|
|
|
dw Script_loadmemtrainer ; 5c
|
|
|
|
dw Script_loadwildmon ; 5d
|
|
|
|
dw Script_loadtrainer ; 5e
|
|
|
|
dw Script_startbattle ; 5f
|
2016-01-06 21:59:56 +00:00
|
|
|
dw Script_reloadmapafterbattle ; 60
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_catchtutorial ; 61
|
|
|
|
dw Script_trainertext ; 62
|
|
|
|
dw Script_trainerflagaction ; 63
|
|
|
|
dw Script_winlosstext ; 64
|
|
|
|
dw Script_scripttalkafter ; 65
|
2018-02-03 02:09:17 +00:00
|
|
|
dw Script_endifjustbattled ; 66
|
|
|
|
dw Script_checkjustbattled ; 67
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_setlasttalked ; 68
|
|
|
|
dw Script_applymovement ; 69
|
|
|
|
dw Script_applymovement2 ; 6a
|
|
|
|
dw Script_faceplayer ; 6b
|
2017-12-24 18:46:34 +00:00
|
|
|
dw Script_faceobject ; 6c
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_variablesprite ; 6d
|
|
|
|
dw Script_disappear ; 6e
|
|
|
|
dw Script_appear ; 6f
|
|
|
|
dw Script_follow ; 70
|
|
|
|
dw Script_stopfollow ; 71
|
2017-12-24 18:46:34 +00:00
|
|
|
dw Script_moveobject ; 72
|
|
|
|
dw Script_writeobjectxy ; 73
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_loademote ; 74
|
|
|
|
dw Script_showemote ; 75
|
2018-02-26 01:05:37 +00:00
|
|
|
dw Script_turnobject ; 76
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_follownotexact ; 77
|
|
|
|
dw Script_earthquake ; 78
|
|
|
|
dw Script_changemap ; 79
|
|
|
|
dw Script_changeblock ; 7a
|
|
|
|
dw Script_reloadmap ; 7b
|
|
|
|
dw Script_reloadmappart ; 7c
|
|
|
|
dw Script_writecmdqueue ; 7d
|
|
|
|
dw Script_delcmdqueue ; 7e
|
|
|
|
dw Script_playmusic ; 7f
|
|
|
|
dw Script_encountermusic ; 80
|
|
|
|
dw Script_musicfadeout ; 81
|
|
|
|
dw Script_playmapmusic ; 82
|
2016-01-06 21:59:56 +00:00
|
|
|
dw Script_dontrestartmapmusic ; 83
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_cry ; 84
|
|
|
|
dw Script_playsound ; 85
|
|
|
|
dw Script_waitsfx ; 86
|
|
|
|
dw Script_warpsound ; 87
|
|
|
|
dw Script_specialsound ; 88
|
|
|
|
dw Script_passtoengine ; 89
|
|
|
|
dw Script_newloadmap ; 8a
|
|
|
|
dw Script_pause ; 8b
|
|
|
|
dw Script_deactivatefacing ; 8c
|
|
|
|
dw Script_priorityjump ; 8d
|
|
|
|
dw Script_warpcheck ; 8e
|
|
|
|
dw Script_ptpriorityjump ; 8f
|
|
|
|
dw Script_return ; 90
|
|
|
|
dw Script_end ; 91
|
|
|
|
dw Script_reloadandreturn ; 92
|
2018-02-03 02:09:17 +00:00
|
|
|
dw Script_endall ; 93
|
2015-12-09 16:38:40 +00:00
|
|
|
dw Script_pokemart ; 94
|
|
|
|
dw Script_elevator ; 95
|
|
|
|
dw Script_trade ; 96
|
|
|
|
dw Script_askforphonenumber ; 97
|
|
|
|
dw Script_phonecall ; 98
|
|
|
|
dw Script_hangup ; 99
|
|
|
|
dw Script_describedecoration ; 9a
|
|
|
|
dw Script_fruittree ; 9b
|
|
|
|
dw Script_specialphonecall ; 9c
|
|
|
|
dw Script_checkphonecall ; 9d
|
|
|
|
dw Script_verbosegiveitem ; 9e
|
|
|
|
dw Script_verbosegiveitem2 ; 9f
|
|
|
|
dw Script_swarm ; a0
|
|
|
|
dw Script_halloffame ; a1
|
|
|
|
dw Script_credits ; a2
|
|
|
|
dw Script_warpfacing ; a3
|
|
|
|
dw Script_battletowertext ; a4
|
|
|
|
dw Script_landmarktotext ; a5
|
|
|
|
dw Script_trainerclassname ; a6
|
|
|
|
dw Script_name ; a7
|
|
|
|
dw Script_wait ; a8
|
2018-02-03 02:09:17 +00:00
|
|
|
dw Script_checksave ; a9
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
StartScript:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wScriptFlags
|
2013-07-04 09:37:20 +00:00
|
|
|
set SCRIPT_RUNNING, [hl]
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2013-02-28 21:28:29 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
CheckScript:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wScriptFlags
|
2013-07-04 09:37:20 +00:00
|
|
|
bit SCRIPT_RUNNING, [hl]
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2013-02-28 21:28:29 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
StopScript:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wScriptFlags
|
2013-07-04 09:37:20 +00:00
|
|
|
res SCRIPT_RUNNING, [hl]
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_callasm:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xe
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: asm
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_special:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xf
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: predefined_script
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall Special
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_ptcallasm:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x10
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: asm
|
2013-02-28 05:31:12 +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
|
|
|
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_jumptextfaceplayer:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x51
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: text_pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [wScriptTextBank], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [wScriptTextAddr], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [wScriptTextAddr + 1], 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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_jumptext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x53
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: text_pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [wScriptTextBank], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [wScriptTextAddr], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [wScriptTextAddr + 1], 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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
JumpTextFacePlayerScript:
|
2013-07-04 08:11:45 +00:00
|
|
|
faceplayer
|
2017-02-23 04:49:44 +00:00
|
|
|
JumpTextScript:
|
2015-12-09 23:25:44 +00:00
|
|
|
opentext
|
2015-07-15 19:48:44 +00:00
|
|
|
repeattext -1, -1
|
2015-11-25 15:16:29 +00:00
|
|
|
waitbutton
|
2013-07-04 08:11:45 +00:00
|
|
|
closetext
|
|
|
|
end
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-11-22 09:51:47 +00:00
|
|
|
|
2017-12-29 02:22:35 +00:00
|
|
|
if _CRYSTAL
|
2013-11-22 09:51:47 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_farjumptext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x52
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: text_pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [wScriptTextBank], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [wScriptTextAddr], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [wScriptTextAddr + 1], 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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-12-29 02:22:35 +00:00
|
|
|
endc
|
2013-11-22 09:51:47 +00:00
|
|
|
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_writetext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x4c
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: text_pointer
|
2013-02-28 05:31:12 +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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_farwritetext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x4b
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: text_pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_repeattext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x4d
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: byte, byte
|
2013-02-28 05:31:12 +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
|
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-11-28 20:13:40 +00:00
|
|
|
ld hl, wScriptTextBank
|
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-11-28 20:13:40 +00:00
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
.done
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_waitbutton:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x54
|
|
|
|
|
2015-11-25 15:16:29 +00:00
|
|
|
jp WaitButton
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_buttonsound:
|
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-11-30 03:29:45 +00:00
|
|
|
call ButtonSound
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_yesorno:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x4e
|
|
|
|
|
2013-12-04 07:49:12 +00:00
|
|
|
call YesNoBox
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, FALSE
|
2015-11-16 16:53:26 +00:00
|
|
|
jr c, .no
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2015-07-15 19:48:44 +00:00
|
|
|
.no
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2018-02-26 01:05:37 +00:00
|
|
|
Script_loadmenu:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x4f
|
2018-01-23 21:08:43 +00:00
|
|
|
; parameters: menu_header
|
2013-02-28 05:31:12 +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
|
2018-01-23 21:08:43 +00:00
|
|
|
ld de, LoadMenuHeader
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_closewindow:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x50
|
|
|
|
|
2015-12-25 03:58:42 +00:00
|
|
|
call CloseWindow
|
2015-07-22 19:57:02 +00:00
|
|
|
call UpdateSprites
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_pokepic:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x56
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pokemon
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
2014-05-21 20:21:46 +00:00
|
|
|
.ok
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurPartySpecies], a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall Pokepic
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_closepokepic:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x57
|
|
|
|
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ClosePokepic
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_verticalmenu:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x59
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2015-12-15 23:59:49 +00:00
|
|
|
ld hl, VerticalMenu
|
2013-10-02 01:55:40 +00:00
|
|
|
rst FarCall
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script__2dmenu:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x58
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2015-12-15 23:59:49 +00:00
|
|
|
ld hl, _2DMenu
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_battletowertext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa4
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pointer, memory
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall BattleTowerText
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_verbosegiveitem:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x9e
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: item, quantity
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-07-20 06:27:48 +00:00
|
|
|
call Script_giveitem
|
2013-07-04 08:11:45 +00:00
|
|
|
call CurItemName
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wStringBuffer1
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ret_96f76:
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
GiveItemScript:
|
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
|
2015-11-25 15:16:29 +00:00
|
|
|
waitsfx
|
2013-07-04 08:11:45 +00:00
|
|
|
specialsound
|
2015-11-25 15:16:29 +00:00
|
|
|
waitbutton
|
2013-07-04 08:11:45 +00:00
|
|
|
itemnotify
|
|
|
|
end
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Full:
|
2015-11-30 03:29:45 +00:00
|
|
|
buttonsound
|
2013-07-04 08:11:45 +00:00
|
|
|
pocketisfull
|
|
|
|
end
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ReceivedItemText:
|
2013-12-01 22:54:09 +00:00
|
|
|
text_jump UnknownText_0x1c4719
|
2013-07-04 08:11:45 +00:00
|
|
|
db "@"
|
|
|
|
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_verbosegiveitem2:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x9f
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: item, var
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
2014-05-21 20:21:46 +00:00
|
|
|
.ok
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurItem], 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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wNumItems
|
2013-09-08 05:35:10 +00:00
|
|
|
call ReceiveItem
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-07-04 08:11:45 +00:00
|
|
|
call CurItemName
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wStringBuffer1
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_itemnotify:
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_pocketisfull:
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_specialsound:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x88
|
|
|
|
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall 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
|
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
GetPocketName:
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall 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
|
2018-01-16 22:27:50 +00:00
|
|
|
maskbits NUM_POCKETS
|
2013-07-04 08:11:45 +00:00
|
|
|
add a
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, [hl]
|
|
|
|
ld e, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wStringBuffer3
|
2013-07-04 08:11:45 +00:00
|
|
|
call CopyName2
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Pockets:
|
2013-07-04 08:11:45 +00:00
|
|
|
dw .Item
|
|
|
|
dw .Key
|
|
|
|
dw .Ball
|
|
|
|
dw .TM
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Item:
|
2013-07-04 08:11:45 +00:00
|
|
|
db "ITEM POCKET@"
|
2016-04-10 18:42:14 +00:00
|
|
|
.Key:
|
2013-07-04 08:11:45 +00:00
|
|
|
db "KEY POCKET@"
|
2016-04-10 18:42:14 +00:00
|
|
|
.Ball:
|
2013-07-04 08:11:45 +00:00
|
|
|
db "BALL POCKET@"
|
2016-04-10 18:42:14 +00:00
|
|
|
.TM:
|
2013-07-04 08:11:45 +00:00
|
|
|
db "TM POCKET@"
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
CurItemName:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurItem]
|
2015-02-10 23:14:21 +00:00
|
|
|
ld [wd265], a
|
2013-07-04 08:11:45 +00:00
|
|
|
call GetItemName
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
PutItemInPocketText:
|
2013-12-01 22:54:09 +00:00
|
|
|
text_jump UnknownText_0x1c472c
|
2013-07-04 08:11:45 +00:00
|
|
|
db "@"
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
PocketIsFullText:
|
2013-12-01 22:54:09 +00:00
|
|
|
text_jump UnknownText_0x1c474b
|
2013-07-04 08:11:45 +00:00
|
|
|
db "@"
|
|
|
|
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_pokemart:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x94
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: dialog_id, mart_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall OpenMartDialog
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_elevator:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x95
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: floor_list_pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], 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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall Elevator
|
2013-02-28 05:31:12 +00:00
|
|
|
ret c
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_trade:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x96
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: trade_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall NPCTrade
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_phonecall:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x98
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: caller_name
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall PhoneCall
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_hangup:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x99
|
|
|
|
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall HangUp
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_askforphonenumber:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x97
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: number
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall AddPhoneNumber
|
2015-11-16 16:53:26 +00:00
|
|
|
jr c, .phonefull
|
2018-01-12 06:40:20 +00:00
|
|
|
xor a ; PHONE_CONTACT_GOT
|
2015-11-16 16:53:26 +00:00
|
|
|
jr .done
|
2015-07-15 19:48:44 +00:00
|
|
|
.phonefull
|
2018-01-12 06:40:20 +00:00
|
|
|
ld a, PHONE_CONTACTS_FULL
|
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
|
2018-01-12 06:40:20 +00:00
|
|
|
ld a, PHONE_CONTACT_REFUSED
|
2015-07-15 19:48:44 +00:00
|
|
|
.done
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_describedecoration:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x9a
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: byte
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall 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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_fruittree:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x9b
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: tree_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurFruitTree], a
|
2013-05-03 19:40:45 +00:00
|
|
|
ld b, BANK(FruitTreeScript)
|
|
|
|
ld hl, FruitTreeScript
|
2013-05-03 18:27:24 +00:00
|
|
|
jp ScriptJump
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_swarm:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa0
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: flag, map_group, map_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall StoreSwarmMapIndices
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_trainertext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x62
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: which_text
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wWalkingX
|
2013-02-28 05:31:12 +00:00
|
|
|
add hl, bc
|
2015-12-27 02:59:03 +00:00
|
|
|
add hl, bc
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wEngineBuffer1]
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_scripttalkafter:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x65
|
|
|
|
|
2015-12-19 01:07:09 +00:00
|
|
|
ld hl, wScriptAfterPointer
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wEngineBuffer1]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-05-03 18:27:24 +00:00
|
|
|
jp ScriptJump
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_trainerflagaction:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x63
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: action
|
2013-02-28 05:31:12 +00:00
|
|
|
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], 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-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_winlosstext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x64
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: win_text_pointer, loss_text_pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ld hl, wWinTextPointer
|
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
|
2017-02-23 04:49:44 +00:00
|
|
|
ld hl, wLossTextPointer
|
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
|
|
|
|
|
2018-02-03 02:09:17 +00:00
|
|
|
Script_endifjustbattled:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x66
|
|
|
|
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, [wRunningTrainerBattleScript]
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2013-07-04 09:37:20 +00:00
|
|
|
jp Script_end
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-02-03 02:09:17 +00:00
|
|
|
Script_checkjustbattled:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x67
|
|
|
|
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, [wRunningTrainerBattleScript]
|
2013-02-28 05:31:12 +00:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_encountermusic:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x80
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wOtherTrainerClass]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall PlayTrainerEncounterMusic
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_playmapmusic:
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_playmusic:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x7f
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: music_pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMusicFade], 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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_musicfadeout:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x81
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: music, fadetime
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMusicFadeID], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMusicFadeID + 1], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-09 22:20:47 +00:00
|
|
|
and $ff ^ (1 << MUSIC_FADE_IN_F)
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMusicFade], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_playsound:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x85
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: sound_pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_waitsfx:
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_warpsound:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x87
|
|
|
|
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GetWarpSFX
|
2013-10-08 17:10:36 +00:00
|
|
|
call PlaySFX
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_cry:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x84
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: cry_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
2014-07-18 17:25:03 +00:00
|
|
|
.ok
|
2018-01-17 04:47:45 +00:00
|
|
|
call PlayMonCry
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-12-24 18:46:34 +00:00
|
|
|
GetScriptObject:
|
2017-12-09 05:50:59 +00:00
|
|
|
and a ; PLAYER?
|
2013-07-04 08:11:45 +00:00
|
|
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_setlasttalked:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x68
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: object_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetScriptObject
|
2015-07-22 06:49:18 +00:00
|
|
|
ld [hLastTalked], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_applymovement:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x69
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: object_id, data
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetScriptObject
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2013-07-20 06:27:48 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ApplyMovement:
|
2013-02-28 05:31:12 +00:00
|
|
|
push bc
|
|
|
|
ld a, c
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall 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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptMode], a
|
2013-07-04 09:37:20 +00:00
|
|
|
call StopScript
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
SetFlagsForMovement_2:
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall _SetFlagsForMovement_2
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_applymovement2:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x6a
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: data
|
|
|
|
; apply movement to last talked
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_faceplayer:
|
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
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GetRelativeFacing
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, d
|
|
|
|
add a
|
2015-12-27 02:59:03 +00:00
|
|
|
add a
|
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
|
2017-12-24 18:46:34 +00:00
|
|
|
call ApplyObjectFacing
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-12-24 18:46:34 +00:00
|
|
|
Script_faceobject:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x6c
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: object1, object2
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetScriptObject
|
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
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetScriptObject
|
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
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GetRelativeFacing
|
2013-02-28 05:31:12 +00:00
|
|
|
pop bc
|
|
|
|
ret c
|
|
|
|
ld a, d
|
|
|
|
add a
|
2015-12-27 02:59:03 +00:00
|
|
|
add a
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
|
|
|
ld d, c
|
2017-12-24 18:46:34 +00:00
|
|
|
call ApplyObjectFacing
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2018-02-26 01:05:37 +00:00
|
|
|
Script_turnobject:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x76
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: object_id, facing
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetScriptObject
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
add a
|
2015-12-27 02:59:03 +00:00
|
|
|
add a
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2017-12-24 18:46:34 +00:00
|
|
|
call ApplyObjectFacing
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-12-24 18:46:34 +00:00
|
|
|
ApplyObjectFacing:
|
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
|
2016-01-05 13:46:37 +00:00
|
|
|
bit FIXED_FACING, [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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wVramState
|
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
|
2013-02-28 21:28:29 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
.DisableTextTiles:
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_variablesprite:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x6d
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: byte, sprite
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
|
|
|
ld d, $0
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wVariableSprites
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_appear:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x6f
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: object_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetScriptObject
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_disappear:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x6e
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: object_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetScriptObject
|
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
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall _UpdateSprites
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ApplyEventActionAppearDisappear:
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_follow:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x70
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: object2, object1
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetScriptObject
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetScriptObject
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall StartFollow
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_stopfollow:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x71
|
|
|
|
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall StopFollow
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-12-24 18:46:34 +00:00
|
|
|
Script_moveobject:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x72
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: object id, x, y
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetScriptObject
|
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
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall CopyDECoordsToMapObject
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-12-24 18:46:34 +00:00
|
|
|
Script_writeobjectxy:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x73
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: object_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetScriptObject
|
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
|
2017-12-24 18:46:34 +00:00
|
|
|
farcall WriteObjectXY
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_follownotexact:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x77
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: object2, object1
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetScriptObject
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetScriptObject
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall FollowNotExact
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_loademote:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x74
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: bubble
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
2015-10-24 14:34:19 +00:00
|
|
|
.not_var_emote
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall LoadEmote
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_showemote:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x75
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: bubble, object_id, time
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetScriptObject
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptDelay], a
|
2013-07-04 08:11:45 +00:00
|
|
|
ld b, BANK(ShowEmoteScript)
|
|
|
|
ld de, ShowEmoteScript
|
|
|
|
jp ScriptCall
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ShowEmoteScript:
|
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
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Show:
|
2013-07-04 08:11:45 +00:00
|
|
|
show_emote
|
2016-05-14 16:28:00 +00:00
|
|
|
step_sleep 1
|
2013-07-04 08:11:45 +00:00
|
|
|
step_end
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Hide:
|
2013-07-04 08:11:45 +00:00
|
|
|
hide_emote
|
2016-05-14 16:28:00 +00:00
|
|
|
step_sleep 1
|
2013-07-04 08:11:45 +00:00
|
|
|
step_end
|
|
|
|
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_earthquake:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x78
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: param
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
ld hl, EarthquakeMovement
|
2017-12-10 00:41:03 +00:00
|
|
|
ld de, wEarthquakeMovementDataBuffer
|
2018-01-22 18:00:35 +00:00
|
|
|
ld bc, EarthquakeMovement.End - EarthquakeMovement
|
2013-02-28 05:31:12 +00:00
|
|
|
call CopyBytes
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2017-12-10 00:41:03 +00:00
|
|
|
ld [wEarthquakeMovementDataBuffer + 1], a
|
|
|
|
and %00111111
|
|
|
|
ld [wEarthquakeMovementDataBuffer + 3], 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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
.script
|
2017-12-10 00:41:03 +00:00
|
|
|
applymovement PLAYER, wEarthquakeMovementDataBuffer
|
2013-07-04 08:11:45 +00:00
|
|
|
end
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
EarthquakeMovement:
|
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
|
2018-01-22 18:00:35 +00:00
|
|
|
.End
|
2013-07-04 08:11:45 +00:00
|
|
|
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_loadpikachudata:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x5a
|
|
|
|
|
2015-05-18 09:16:11 +00:00
|
|
|
ld a, PIKACHU
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wTempWildMonSpecies], a
|
2015-05-18 09:16:11 +00:00
|
|
|
ld a, 5
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurPartyLevel], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_randomwildmon:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x5b
|
|
|
|
|
|
|
|
xor a
|
2015-11-25 15:16:29 +00:00
|
|
|
ld [wBattleScriptFlags], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_loadmemtrainer:
|
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-11-25 15:16:29 +00:00
|
|
|
ld [wBattleScriptFlags], a
|
2015-12-02 02:54:11 +00:00
|
|
|
ld a, [wTempTrainerClass]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wOtherTrainerClass], a
|
2015-12-02 02:54:11 +00:00
|
|
|
ld a, [wTempTrainerID]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wOtherTrainerID], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_loadwildmon:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x5d
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pokemon, level
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, (1 << 7)
|
2015-11-25 15:16:29 +00:00
|
|
|
ld [wBattleScriptFlags], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wTempWildMonSpecies], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurPartyLevel], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_loadtrainer:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x5e
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: trainer_group, trainer_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, (1 << 7) | 1
|
2015-11-25 15:16:29 +00:00
|
|
|
ld [wBattleScriptFlags], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wOtherTrainerClass], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wOtherTrainerID], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_startbattle:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x5f
|
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call BufferScreen
|
2018-01-16 19:30:10 +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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_catchtutorial:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x61
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: byte
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBattleType], a
|
2015-07-15 19:48:44 +00:00
|
|
|
call BufferScreen
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall CatchTutorial
|
2013-07-04 08:11:45 +00:00
|
|
|
jp Script_reloadmap
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_reloadmapafterbattle:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x60
|
|
|
|
|
2015-11-25 15:16:29 +00:00
|
|
|
ld hl, wBattleScriptFlags
|
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
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall 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
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall LoadScriptBDE
|
2015-10-19 20:49:29 +00:00
|
|
|
.done
|
2013-07-04 08:11:45 +00:00
|
|
|
jp Script_reloadmap
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_reloadmap:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x7b
|
|
|
|
|
|
|
|
xor a
|
2015-11-25 15:16:29 +00:00
|
|
|
ld [wBattleScriptFlags], 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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_scall:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x0
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_farscall:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x1
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_ptcall:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x2
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pointer
|
2013-02-28 05:31:12 +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
|
|
|
|
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
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ScriptCall:
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
; to wScriptDelay, causing the script to return to the rst/interrupt
|
2015-11-16 16:53:26 +00:00
|
|
|
; 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-12-02 02:54:11 +00:00
|
|
|
ld hl, wScriptStack
|
2013-02-28 05:31:12 +00:00
|
|
|
add hl, de
|
2016-05-10 16:31:49 +00:00
|
|
|
add hl, de
|
|
|
|
add hl, de
|
2013-02-28 05:31:12 +00:00
|
|
|
pop de
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hli], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptPos]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hli], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptPos + 1]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hl], a
|
|
|
|
ld a, b
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptBank], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, e
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptPos], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, d
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptPos + 1], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
CallCallback::
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2013-07-04 08:11:45 +00:00
|
|
|
or $80
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptBank], a
|
2013-07-04 08:11:45 +00:00
|
|
|
jp ScriptCall
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_jump:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x3
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pointer
|
2013-02-28 05:31:12 +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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2013-05-03 18:27:24 +00:00
|
|
|
jp ScriptJump
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_farjump:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x4
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_ptjump:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x5
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pointer
|
2013-02-28 05:31:12 +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
|
|
|
|
ld b, [hl]
|
|
|
|
inc hl
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2013-05-03 18:27:24 +00:00
|
|
|
jp ScriptJump
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_iffalse:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x8
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_iftrue:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x9
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-02-03 02:09:17 +00:00
|
|
|
Script_ifequal:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x6
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: byte, pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wScriptVar
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-02-03 02:09:17 +00:00
|
|
|
Script_ifnotequal:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x7
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: byte, pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wScriptVar
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-02-03 02:09:17 +00:00
|
|
|
Script_ifgreater:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: byte, pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-02-03 02:09:17 +00:00
|
|
|
Script_ifless:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xb
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: byte, pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_jumpstd:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xc
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: predefined_script
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
call StdScript
|
2015-11-16 16:53:26 +00:00
|
|
|
jr ScriptJump
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_callstd:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xd
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: predefined_script
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
StdScript:
|
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
|
2013-07-04 08:11:45 +00:00
|
|
|
add hl, de
|
2016-05-10 16:31:49 +00:00
|
|
|
add hl, de
|
|
|
|
add hl, de
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
SkipTwoScriptBytes:
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
|
|
|
call GetScriptByte
|
2013-02-28 21:04:26 +00:00
|
|
|
ret
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ScriptJump:
|
2013-02-28 21:04:26 +00:00
|
|
|
ld a, b
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptBank], a
|
2013-02-28 21:04:26 +00:00
|
|
|
ld a, l
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptPos], a
|
2013-02-28 21:04:26 +00:00
|
|
|
ld a, h
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptPos + 1], a
|
2013-02-28 21:04:26 +00:00
|
|
|
ret
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_priorityjump:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x8d
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [wPriorityScriptBank], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [wPriorityScriptAddr], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [wPriorityScriptAddr + 1], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wScriptFlags
|
2013-02-28 05:31:12 +00:00
|
|
|
set 3, [hl]
|
|
|
|
ret
|
|
|
|
|
2017-12-24 18:46:34 +00:00
|
|
|
Script_checkscene:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x13
|
|
|
|
|
2017-12-24 18:46:34 +00:00
|
|
|
call CheckScenes
|
|
|
|
jr z, .no_scene
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
|
2017-12-24 18:46:34 +00:00
|
|
|
.no_scene
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, $ff
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-12-24 18:46:34 +00:00
|
|
|
Script_checkmapscene:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x11
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: map_group, map_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2017-12-24 18:46:34 +00:00
|
|
|
call GetMapSceneID
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, d
|
|
|
|
or e
|
2017-12-24 18:46:34 +00:00
|
|
|
jr z, .no_scene
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, [de]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2015-11-16 17:49:42 +00:00
|
|
|
|
2017-12-24 18:46:34 +00:00
|
|
|
.no_scene
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, $ff
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-12-24 18:46:34 +00:00
|
|
|
Script_setscene:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x14
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: scene_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMapGroup]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMapNumber]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2017-12-24 18:46:34 +00:00
|
|
|
jr DoScene
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-12-24 18:46:34 +00:00
|
|
|
Script_setmapscene:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x12
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: map_group, map_id, scene_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2017-12-24 18:46:34 +00:00
|
|
|
DoScene:
|
|
|
|
call GetMapSceneID
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, d
|
|
|
|
or e
|
2017-12-24 18:46:34 +00:00
|
|
|
jr z, .no_scene
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [de], a
|
2017-12-24 18:46:34 +00:00
|
|
|
.no_scene
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_copybytetovar:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x19
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: address
|
2013-02-28 05:31:12 +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
|
|
|
|
ld a, [hl]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_copyvartobyte:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x1a
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: address
|
2013-02-28 05:31:12 +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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_loadvar:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x1b
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: address, value
|
2013-02-28 05:31:12 +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-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_writebyte:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x15
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: value
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_addvar:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x16
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: value
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wScriptVar
|
2013-02-28 05:31:12 +00:00
|
|
|
add [hl]
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_random:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x17
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: input
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], 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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
|
|
|
pop af
|
2013-08-30 03:20:09 +00:00
|
|
|
call SimpleDivide
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
.Divide256byC:
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_checkcode:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x1c
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: variable_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_writevarcode:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x1d
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: variable_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetVarAction
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld [de], a
|
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_writecode:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x1e
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: variable_id, value
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
GetVarAction:
|
2013-07-04 08:11:45 +00:00
|
|
|
ld c, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall _GetVarAction
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_checkver:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x18
|
|
|
|
|
2018-01-09 05:51:53 +00:00
|
|
|
ld a, [.gs_version]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2018-01-09 05:51:53 +00:00
|
|
|
.gs_version:
|
|
|
|
db GS_VERSION
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_pokenamemem:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x40
|
2018-01-23 22:39:09 +00:00
|
|
|
; parameters: pokemon (0 aka USE_SCRIPT_VAR to use wScriptVar), memory
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wStringBuffer1
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ConvertMemToText:
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-12 06:40:20 +00:00
|
|
|
cp NUM_MEM_BUFFERS
|
2014-09-30 18:19:33 +00:00
|
|
|
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
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
CopyConvertedText:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wStringBuffer3
|
|
|
|
ld bc, wStringBuffer4 - wStringBuffer3
|
2013-02-28 05:31:12 +00:00
|
|
|
call AddNTimes
|
|
|
|
call CopyName2
|
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_itemtotext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x41
|
2018-01-23 22:39:09 +00:00
|
|
|
; parameters: item (0 aka USE_SCRIPT_VAR to use wScriptVar), memory
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-12 06:40:20 +00:00
|
|
|
and a ; USE_SCRIPT_VAR
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nz, .ok
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wStringBuffer1
|
2015-11-16 16:53:26 +00:00
|
|
|
jr ConvertMemToText
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_mapnametotext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x42
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: memory
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMapGroup]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMapNumber]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
|
|
|
call GetWorldMapLocation
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ConvertLandmarkToText:
|
2013-02-28 05:31:12 +00:00
|
|
|
ld e, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GetLandmarkName
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wStringBuffer1
|
2015-07-15 19:48:44 +00:00
|
|
|
jp ConvertMemToText
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_landmarktotext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa5
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: id, memory
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_trainertotext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x43
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: trainer_id, trainer_group, memory
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GetTrainerName
|
2015-11-16 16:53:26 +00:00
|
|
|
jr ConvertMemToText
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_name:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa7
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: type, id, memory
|
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
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ContinueToGetName:
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurSpecies], a
|
2013-02-28 05:31:12 +00:00
|
|
|
call GetName
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wStringBuffer1
|
2015-07-15 19:48:44 +00:00
|
|
|
jp ConvertMemToText
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_trainerclassname:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa6
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: id, memory
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_readmoney:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x3d
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: account, memory
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call ResetStringBuffer1
|
|
|
|
call GetMoneyAccount
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wStringBuffer1
|
2015-10-10 21:03:04 +00:00
|
|
|
lb bc, PRINTNUM_RIGHTALIGN | 3, 6
|
2013-08-30 03:20:09 +00:00
|
|
|
call PrintNum
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wStringBuffer1
|
2015-07-15 19:48:44 +00:00
|
|
|
jp ConvertMemToText
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_readcoins:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x3e
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: memory
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call ResetStringBuffer1
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wStringBuffer1
|
2018-01-23 21:45:34 +00:00
|
|
|
ld de, wCoins
|
2015-10-10 21:03:04 +00:00
|
|
|
lb bc, PRINTNUM_RIGHTALIGN | 2, 6
|
2013-08-30 03:20:09 +00:00
|
|
|
call PrintNum
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wStringBuffer1
|
2015-07-15 19:48:44 +00:00
|
|
|
jp ConvertMemToText
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-01-12 06:40:20 +00:00
|
|
|
Script_vartomem:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x3f
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: memory
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call ResetStringBuffer1
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wScriptVar
|
|
|
|
ld hl, wStringBuffer1
|
2015-10-10 21:03:04 +00:00
|
|
|
lb bc, PRINTNUM_RIGHTALIGN | 1, 3
|
2013-08-30 03:20:09 +00:00
|
|
|
call PrintNum
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wStringBuffer1
|
2015-07-15 19:48:44 +00:00
|
|
|
jp ConvertMemToText
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ResetStringBuffer1:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wStringBuffer1
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_stringtotext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x44
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: text_pointer, memory
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2014-04-12 19:45:40 +00:00
|
|
|
ld hl, CopyName1
|
2013-10-02 01:55:40 +00:00
|
|
|
rst FarCall
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wStringBuffer2
|
2015-07-15 19:48:44 +00:00
|
|
|
jp ConvertMemToText
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_givepokeitem:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x2f
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pointer
|
2013-02-28 05:31:12 +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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
call GetFarByte
|
|
|
|
ld b, a
|
|
|
|
push bc
|
|
|
|
inc hl
|
2017-12-09 05:50:59 +00:00
|
|
|
ld bc, MAIL_MSG_LENGTH
|
2015-02-10 23:14:21 +00:00
|
|
|
ld de, wd002
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
call FarCopyBytes
|
|
|
|
pop bc
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GivePokeItem
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_checkpokeitem:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x30
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall CheckPokeItem
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_giveitem:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x1f
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: item, quantity
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptVar]
|
2015-07-15 19:48:44 +00:00
|
|
|
.ok
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurItem], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2015-11-01 23:13:31 +00:00
|
|
|
ld [wItemQuantityChangeBuffer], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wNumItems
|
2013-09-08 05:35:10 +00:00
|
|
|
call ReceiveItem
|
2015-11-16 16:53:26 +00:00
|
|
|
jr nc, .full
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], 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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_takeitem:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x20
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: item, quantity
|
2013-02-28 05:31:12 +00:00
|
|
|
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurItem], 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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurItemQuantity], a
|
|
|
|
ld hl, wNumItems
|
2013-09-08 05:35:10 +00:00
|
|
|
call TossItem
|
2013-02-28 05:31:12 +00:00
|
|
|
ret nc
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_checkitem:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x21
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: item
|
2013-02-28 05:31:12 +00:00
|
|
|
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurItem], a
|
|
|
|
ld hl, wNumItems
|
2013-09-08 05:35:10 +00:00
|
|
|
call CheckItem
|
2013-02-28 05:31:12 +00:00
|
|
|
ret nc
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_givemoney:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x22
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: account, money
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetMoneyAccount
|
|
|
|
call LoadMoneyAmountToMem
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GiveMoney
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_takemoney:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x23
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: account, money
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetMoneyAccount
|
|
|
|
call LoadMoneyAmountToMem
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall TakeMoney
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_checkmoney:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x24
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: account, money
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call GetMoneyAccount
|
|
|
|
call LoadMoneyAmountToMem
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall CompareMoney
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
CompareMoneyAction:
|
2018-01-12 06:40:20 +00:00
|
|
|
jr c, .less
|
|
|
|
jr z, .exact
|
|
|
|
ld a, HAVE_MORE
|
2014-05-21 20:21:46 +00:00
|
|
|
jr .done
|
2018-01-12 06:40:20 +00:00
|
|
|
.exact
|
|
|
|
ld a, HAVE_AMOUNT
|
2014-05-21 20:21:46 +00:00
|
|
|
jr .done
|
2018-01-12 06:40:20 +00:00
|
|
|
.less
|
|
|
|
ld a, HAVE_LESS
|
2014-05-21 20:21:46 +00:00
|
|
|
.done
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
GetMoneyAccount:
|
2013-07-04 08:11:45 +00:00
|
|
|
call GetScriptByte
|
|
|
|
and a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wMoney ; YOUR_MONEY
|
2013-07-04 08:11:45 +00:00
|
|
|
ret z
|
2018-01-12 06:40:20 +00:00
|
|
|
ld de, wMomsMoney ; MOMS_MONEY
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2013-02-28 21:28:29 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
LoadMoneyAmountToMem:
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_givecoins:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x25
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: coins
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call LoadCoinAmountToMem
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GiveCoins
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_takecoins:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x26
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: coins
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call LoadCoinAmountToMem
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall TakeCoins
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_checkcoins:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x27
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: coins
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-07-15 19:48:44 +00:00
|
|
|
call LoadCoinAmountToMem
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall CheckCoins
|
2015-10-30 03:32:11 +00:00
|
|
|
jr CompareMoneyAction
|
2013-07-20 06:27:48 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
LoadCoinAmountToMem:
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_checktime:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x2b
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: time
|
2013-02-28 05:31:12 +00:00
|
|
|
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall CheckTime
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
and c
|
|
|
|
ret z
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_checkpoke:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x2c
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pokemon
|
2013-02-28 05:31:12 +00:00
|
|
|
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartySpecies
|
2014-05-21 20:21:46 +00:00
|
|
|
ld de, 1
|
2013-02-28 05:31:12 +00:00
|
|
|
call IsInArray
|
|
|
|
ret nc
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_addcellnum:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x28
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: person
|
2013-02-28 05:31:12 +00:00
|
|
|
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall AddPhoneNumber
|
2013-02-28 05:31:12 +00:00
|
|
|
ret nc
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_delcellnum:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x29
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: person
|
2013-02-28 05:31:12 +00:00
|
|
|
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall DelCellNum
|
2013-02-28 05:31:12 +00:00
|
|
|
ret nc
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_checkcellnum:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x2a
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: person
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall CheckCellNum
|
2013-02-28 05:31:12 +00:00
|
|
|
ret nc
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_specialphonecall:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x9c
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: call_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_checkphonecall:
|
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
|
2015-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2014-05-21 20:21:46 +00:00
|
|
|
.ok
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_givepoke:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x2d
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pokemon, level, item, trainer, trainer_name_pointer, pkmn_nickname
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurPartySpecies], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurPartyLevel], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurItem], 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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wScriptPos
|
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
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GivePoke
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, b
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_giveegg:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x2e
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pokemon, level
|
2018-01-23 22:39:09 +00:00
|
|
|
; if no room in the party, return 0 in wScriptVar; else, return 2
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-10-08 01:27:32 +00:00
|
|
|
xor a ; PARTYMON
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
|
|
|
ld [wMonType], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurPartySpecies], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurPartyLevel], a
|
2018-01-16 19:30:10 +00:00
|
|
|
farcall GiveEgg
|
2013-02-28 05:31:12 +00:00
|
|
|
ret nc
|
2015-07-17 21:17:10 +00:00
|
|
|
ld a, 2
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_setevent:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x33
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: bit_number
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_clearevent:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x32
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: bit_number
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_checkevent:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x31
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: bit_number
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2015-07-17 21:17:10 +00:00
|
|
|
.false
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_setflag:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x36
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: bit_number
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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-11-25 15:16:29 +00:00
|
|
|
ld b, SET_FLAG
|
2015-07-15 19:48:44 +00:00
|
|
|
call _EngineFlagAction
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_clearflag:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x35
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: bit_number
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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-11-25 15:16:29 +00:00
|
|
|
ld b, RESET_FLAG
|
2015-07-15 19:48:44 +00:00
|
|
|
call _EngineFlagAction
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_checkflag:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x34
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: bit_number
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-12 06:40:20 +00:00
|
|
|
ld b, CHECK_FLAG
|
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-11-25 15:16:29 +00:00
|
|
|
ld a, TRUE
|
2015-07-17 21:17:10 +00:00
|
|
|
.false
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
_EngineFlagAction:
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall EngineFlagAction
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_wildoff:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x38
|
|
|
|
|
2017-12-28 12:15:46 +00:00
|
|
|
ld hl, wStatusFlags
|
2018-01-22 20:40:43 +00:00
|
|
|
set STATUSFLAGS_NO_WILD_ENCOUNTERS_F, [hl]
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_wildon:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x37
|
|
|
|
|
2017-12-28 12:15:46 +00:00
|
|
|
ld hl, wStatusFlags
|
2018-01-22 20:40:43 +00:00
|
|
|
res STATUSFLAGS_NO_WILD_ENCOUNTERS_F, [hl]
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_xycompare:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x39
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2016-01-12 17:46:18 +00:00
|
|
|
ld [wXYComparePointer], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2016-01-12 17:46:18 +00:00
|
|
|
ld [wXYComparePointer + 1], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_warpfacing:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa3
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: facing, map_group, map_id, x, y
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-16 22:27:50 +00:00
|
|
|
maskbits NUM_DIRECTIONS
|
2013-02-28 05:31:12 +00:00
|
|
|
ld c, a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wPlayerSpriteSetupFlags]
|
2018-01-22 19:34:55 +00:00
|
|
|
set PLAYERSPRITESETUP_CUSTOM_FACING_F, a
|
2013-02-28 05:31:12 +00:00
|
|
|
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
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_warp:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x3c
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: map_group, map_id, x, y
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMapGroup], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMapNumber], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wXCoord], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wYCoord], a
|
2015-07-17 21:17:10 +00:00
|
|
|
ld a, -1
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wDefaultSpawnpoint], 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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wDefaultSpawnpoint], 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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_warpmod:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x3a
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: warp_id, map_group, map_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBackupWarpNumber], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBackupMapGroup], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wBackupMapNumber], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_blackoutmod:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x3b
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: map_group, map_id
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_dontrestartmapmusic:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x83
|
|
|
|
|
2015-07-17 21:17:10 +00:00
|
|
|
ld a, 1
|
2015-12-26 23:11:55 +00:00
|
|
|
ld [wDontPlayMapMusicOnReload], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_writecmdqueue:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x7d
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: queue_pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wScriptBank]
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall WriteCmdQueue ; no need to farcall
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_delcmdqueue:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x7e
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: byte
|
2013-02-28 05:31:12 +00:00
|
|
|
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ld b, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall 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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_changemap:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x79
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: map_data_pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMapBlocksBank], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMapBlocksPointer], a
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMapBlocksPointer + 1], a
|
2015-07-15 19:48:44 +00:00
|
|
|
call ChangeMap
|
|
|
|
call BufferScreen
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_changeblock:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x7a
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: x, y, block
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_reloadmappart::
|
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
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ReloadMapPart
|
2015-07-22 19:57:02 +00:00
|
|
|
call UpdateSprites
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_warpcheck:
|
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
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall EnableEvents
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2018-01-02 15:04:21 +00:00
|
|
|
Script_enableevents:
|
|
|
|
; unused
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall EnableEvents
|
2013-07-04 08:11:45 +00:00
|
|
|
ret
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_newloadmap:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x8a
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: which_method
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_reloadandreturn:
|
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
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-02-03 02:09:17 +00:00
|
|
|
Script_opentext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x47
|
|
|
|
|
2015-12-09 23:25:44 +00:00
|
|
|
call OpenText
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_refreshscreen:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x48
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: dummy
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2015-12-25 03:58:42 +00:00
|
|
|
call RefreshScreen
|
2013-02-28 21:36:21 +00:00
|
|
|
call GetScriptByte
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_loadbytec2cf:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x4a
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: byte
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
|
|
|
|
2018-01-15 03:56:36 +00:00
|
|
|
db closetext_command ; unused
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_closetext:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x49
|
|
|
|
|
2016-05-05 02:34:09 +00:00
|
|
|
call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
|
2015-11-25 15:16:29 +00:00
|
|
|
call CloseText
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2013-07-04 08:11:45 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_passtoengine:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x89
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: data_pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_pause:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x8b
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: length
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptDelay], 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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wScriptDelay
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_deactivatefacing:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x8c
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: time
|
2013-02-28 05:31:12 +00:00
|
|
|
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptDelay], a
|
2015-07-17 21:17:10 +00:00
|
|
|
.no_time
|
2013-07-04 09:37:20 +00:00
|
|
|
ld a, SCRIPT_WAIT
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptMode], a
|
2013-07-04 09:37:20 +00:00
|
|
|
call StopScript
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_ptpriorityjump:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x8f
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: pointer
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2013-07-04 09:37:20 +00:00
|
|
|
call StopScript
|
2015-11-16 17:49:42 +00:00
|
|
|
jp Script_jump
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_end:
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptRunning], a
|
2013-07-04 09:37:20 +00:00
|
|
|
ld a, SCRIPT_OFF
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptMode], a
|
|
|
|
ld hl, wScriptFlags
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_return:
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wScriptFlags
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
ExitScriptSubroutine:
|
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-12-02 02:54:11 +00:00
|
|
|
ld hl, wScriptStack
|
2017-12-09 05:50:59 +00:00
|
|
|
add hl, de
|
|
|
|
add hl, de
|
|
|
|
add hl, de
|
2013-07-04 08:11:45 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
2015-07-17 21:17:10 +00:00
|
|
|
and " "
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptBank], a
|
2013-07-04 08:11:45 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptPos], a
|
2013-07-04 08:11:45 +00:00
|
|
|
ld a, [hl]
|
|
|
|
ld d, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptPos + 1], a
|
2013-07-04 08:11:45 +00:00
|
|
|
and a
|
|
|
|
ret
|
2015-07-17 21:17:10 +00:00
|
|
|
.done
|
2013-07-04 08:11:45 +00:00
|
|
|
scf
|
|
|
|
ret
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2018-02-03 02:09:17 +00:00
|
|
|
Script_endall:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0x93
|
|
|
|
|
|
|
|
xor a
|
2015-11-16 16:53:26 +00:00
|
|
|
ld [wScriptStackSize], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptRunning], a
|
2013-07-04 09:37:20 +00:00
|
|
|
ld a, SCRIPT_OFF
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptMode], a
|
|
|
|
ld hl, wScriptFlags
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_halloffame:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa1
|
|
|
|
|
2017-12-28 12:15:46 +00:00
|
|
|
ld hl, wGameTimerPause
|
2018-01-23 17:40:29 +00:00
|
|
|
res GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
|
2018-01-02 19:00:14 +00:00
|
|
|
farcall StubbedTrainerRankings_HallOfFame
|
|
|
|
farcall StubbedTrainerRankings_HallOfFame2
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall HallOfFame
|
2017-12-28 12:15:46 +00:00
|
|
|
ld hl, wGameTimerPause
|
2018-01-23 17:40:29 +00:00
|
|
|
set GAMETIMERPAUSE_TIMER_PAUSED_F, [hl]
|
2015-12-15 01:06:41 +00:00
|
|
|
jr ReturnFromCredits
|
2013-02-28 05:31:12 +00:00
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_credits:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa2
|
|
|
|
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall RedCredits
|
2015-12-15 01:06:41 +00:00
|
|
|
ReturnFromCredits:
|
2018-02-03 02:09:17 +00:00
|
|
|
call Script_endall
|
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
|
|
|
|
|
2017-02-23 04:49:44 +00:00
|
|
|
Script_wait:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa8
|
2018-01-09 06:02:29 +00:00
|
|
|
; parameters: unknown
|
2013-02-28 05:31:12 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2018-02-03 02:09:17 +00:00
|
|
|
Script_checksave:
|
2013-02-28 05:31:12 +00:00
|
|
|
; script command 0xa9
|
|
|
|
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall CheckSave
|
2013-02-28 05:31:12 +00:00
|
|
|
ld a, c
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-02-28 05:31:12 +00:00
|
|
|
ret
|
2013-07-04 08:11:45 +00:00
|
|
|
|
2013-11-22 09:51:47 +00:00
|
|
|
|
2018-01-02 15:04:21 +00:00
|
|
|
; unused
|
2013-11-22 09:51:47 +00:00
|
|
|
ld a, [.byte]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2013-11-22 09:51:47 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
.byte
|
|
|
|
db 0
|