pokered/scripts/VermilionGym.asm

247 lines
5.1 KiB
NASM
Raw Normal View History

VermilionGym_Script:
2016-01-03 19:17:10 +00:00
ld hl, wCurrentMapScriptFlags
2014-05-18 18:19:10 +00:00
bit 5, [hl]
res 5, [hl]
push hl
2020-07-18 18:01:13 +00:00
call nz, .LoadNames
2014-05-18 18:19:10 +00:00
pop hl
bit 6, [hl]
res 6, [hl]
2020-05-06 01:28:19 +00:00
call nz, VermilionGymSetDoorTile
2014-05-18 18:19:10 +00:00
call EnableAutoTextBoxDrawing
ld hl, VermilionGymTrainerHeader0
ld de, VermilionGym_ScriptPointers
2015-08-31 02:38:41 +00:00
ld a, [wVermilionGymCurScript]
2014-05-18 18:19:10 +00:00
call ExecuteCurMapScriptInTable
2015-08-31 02:38:41 +00:00
ld [wVermilionGymCurScript], a
2014-05-18 18:19:10 +00:00
ret
2020-07-18 18:01:13 +00:00
.LoadNames:
ld hl, .CityName
ld de, .LeaderName
2014-05-18 18:19:10 +00:00
jp LoadGymLeaderAndCityName
2020-07-18 18:01:13 +00:00
.CityName:
2014-05-18 18:19:10 +00:00
db "VERMILION CITY@"
2020-07-18 18:01:13 +00:00
.LeaderName:
2014-05-18 18:19:10 +00:00
db "LT.SURGE@"
2020-05-06 01:28:19 +00:00
VermilionGymSetDoorTile:
2015-07-21 01:32:02 +00:00
CheckEvent EVENT_2ND_LOCK_OPENED
2019-10-07 05:23:57 +00:00
jr nz, .doorsOpen
2020-05-06 01:28:19 +00:00
ld a, $24 ; double door tile ID
2019-10-07 05:23:57 +00:00
jr .replaceTile
.doorsOpen
2015-07-19 08:46:12 +00:00
ld a, SFX_GO_INSIDE
2014-05-18 18:19:10 +00:00
call PlaySound
2020-05-06 01:28:19 +00:00
ld a, $5 ; clear floor tile ID
2019-10-07 05:23:57 +00:00
.replaceTile
2015-07-24 21:39:45 +00:00
ld [wNewTileBlockID], a
2015-08-05 21:20:29 +00:00
lb bc, 2, 2
2014-09-14 18:29:18 +00:00
predef_jump ReplaceTileBlock
2014-05-18 18:19:10 +00:00
2020-05-06 01:28:19 +00:00
VermilionGymResetScripts:
2014-05-18 18:19:10 +00:00
xor a
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
2015-08-31 02:38:41 +00:00
ld [wVermilionGymCurScript], a
ld [wCurMapScript], a
2014-05-18 18:19:10 +00:00
ret
VermilionGym_ScriptPointers:
2014-05-18 18:19:10 +00:00
dw CheckFightingMapTrainers
2014-09-14 18:29:18 +00:00
dw DisplayEnemyTrainerTextAndStartBattle
2014-05-18 18:19:10 +00:00
dw EndTrainerBattle
2020-05-06 01:28:19 +00:00
dw VermilionGymLTSurgePostBattle
2014-05-18 18:19:10 +00:00
2020-05-06 01:28:19 +00:00
VermilionGymLTSurgePostBattle:
2015-08-31 02:38:41 +00:00
ld a, [wIsInBattle]
2020-05-06 01:28:19 +00:00
cp $ff ; did we lose?
jp z, VermilionGymResetScripts
2020-05-06 01:42:40 +00:00
ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
2014-05-18 18:19:10 +00:00
2020-05-06 01:28:19 +00:00
VermilionGymReceiveTM24:
2014-05-18 18:19:10 +00:00
ld a, $6
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
2015-07-21 02:41:23 +00:00
SetEvent EVENT_BEAT_LT_SURGE
2020-07-06 02:52:27 +00:00
lb bc, TM_THUNDERBOLT, 1
2014-05-18 18:19:10 +00:00
call GiveItem
jr nc, .BagFull
ld a, $7
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
2015-07-21 02:41:23 +00:00
SetEvent EVENT_GOT_TM24
2019-10-07 05:23:57 +00:00
jr .gymVictory
2014-05-18 18:19:10 +00:00
.BagFull
ld a, $8
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
2019-10-07 05:23:57 +00:00
.gymVictory
2015-08-31 02:38:41 +00:00
ld hl, wObtainedBadges
set BIT_THUNDERBADGE, [hl]
2015-07-26 02:26:54 +00:00
ld hl, wBeatGymFlags
set BIT_THUNDERBADGE, [hl]
2014-05-18 18:19:10 +00:00
; deactivate gym trainers
2015-07-21 01:32:02 +00:00
SetEventRange EVENT_BEAT_VERMILION_GYM_TRAINER_0, EVENT_BEAT_VERMILION_GYM_TRAINER_2
2014-05-18 18:19:10 +00:00
2020-05-06 01:28:19 +00:00
jp VermilionGymResetScripts
2014-05-18 18:19:10 +00:00
VermilionGym_TextPointers:
2020-05-06 01:28:19 +00:00
dw LTSurgeText
dw VermilionGymTrainerText1
dw VermilionGymTrainerText2
dw VermilionGymTrainerText3
dw VermilionGymFanText
dw LTSurgeThunderbadgeInfoText
dw ReceivedTM24Text
dw TM24NoRoomText
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
VermilionGymTrainerHeader0:
trainer EVENT_BEAT_VERMILION_GYM_TRAINER_0, 3, VermilionGymBattleText1, VermilionGymEndBattleText1, VermilionGymAfterBattleText1
2016-06-12 00:24:04 +00:00
VermilionGymTrainerHeader1:
trainer EVENT_BEAT_VERMILION_GYM_TRAINER_1, 2, VermilionGymBattleText2, VermilionGymEndBattleText2, VermilionGymAfterBattleText2
2016-06-12 00:24:04 +00:00
VermilionGymTrainerHeader2:
trainer EVENT_BEAT_VERMILION_GYM_TRAINER_2, 3, VermilionGymBattleText3, VermilionGymEndBattleText3, VermilionGymAfterBattleText3
db -1 ; end
2014-05-18 18:19:10 +00:00
2020-05-06 01:28:19 +00:00
LTSurgeText:
text_asm
2015-07-21 02:41:23 +00:00
CheckEvent EVENT_BEAT_LT_SURGE
2019-10-07 05:23:57 +00:00
jr z, .beforeBeat
2015-07-21 02:41:23 +00:00
CheckEventReuseA EVENT_GOT_TM24
2019-10-07 05:23:57 +00:00
jr nz, .afterBeat
2020-05-06 01:28:19 +00:00
call z, VermilionGymReceiveTM24
2014-05-18 18:19:10 +00:00
call DisableWaitingAfterTextDisplay
2019-10-07 05:23:57 +00:00
jr .done
.afterBeat
2020-05-06 01:28:19 +00:00
ld hl, LTSurgePostBattleAdviceText
2014-05-18 18:19:10 +00:00
call PrintText
2019-10-07 05:23:57 +00:00
jr .done
.beforeBeat
2020-05-06 01:28:19 +00:00
ld hl, LTSurgePreBattleText
2014-05-18 18:19:10 +00:00
call PrintText
ld hl, wd72d
2014-05-18 18:19:10 +00:00
set 6, [hl]
set 7, [hl]
ld hl, ReceivedThunderbadgeText
ld de, ReceivedThunderbadgeText
2014-09-14 18:29:18 +00:00
call SaveEndBattleTextPointers
ldh a, [hSpriteIndex]
2014-09-13 07:50:56 +00:00
ld [wSpriteIndex], a
2014-05-18 18:19:10 +00:00
call EngageMapTrainer
call InitBattleEnemyParameters
ld a, $3
2015-08-31 02:38:41 +00:00
ld [wGymLeaderNo], a
2014-05-18 18:19:10 +00:00
xor a
ldh [hJoyHeld], a
2020-05-06 01:28:19 +00:00
ld a, $3 ; set script index to LT Surge post-battle script
2015-08-31 02:38:41 +00:00
ld [wVermilionGymCurScript], a
ld [wCurMapScript], a
2019-10-07 05:23:57 +00:00
.done
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
2020-05-06 01:28:19 +00:00
LTSurgePreBattleText:
text_far _LTSurgePreBattleText
text_end
2014-05-18 18:19:10 +00:00
2020-05-06 01:28:19 +00:00
LTSurgePostBattleAdviceText:
text_far _LTSurgePostBattleAdviceText
text_end
2014-05-18 18:19:10 +00:00
2020-05-06 01:28:19 +00:00
LTSurgeThunderbadgeInfoText:
text_far _LTSurgeThunderbadgeInfoText
text_end
2014-05-18 18:19:10 +00:00
2020-05-06 01:28:19 +00:00
ReceivedTM24Text:
text_far _ReceivedTM24Text
sound_get_key_item
text_far _TM24ExplanationText
text_end
2014-05-18 18:19:10 +00:00
2020-05-06 01:28:19 +00:00
TM24NoRoomText:
text_far _TM24NoRoomText
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
ReceivedThunderbadgeText:
text_far _ReceivedThunderbadgeText
text_end
2014-05-18 18:19:10 +00:00
2020-05-06 01:28:19 +00:00
VermilionGymTrainerText1:
text_asm
2014-05-18 18:19:10 +00:00
ld hl, VermilionGymTrainerHeader0
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
VermilionGymBattleText1:
text_far _VermilionGymBattleText1
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
VermilionGymEndBattleText1:
text_far _VermilionGymEndBattleText1
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
VermilionGymAfterBattleText1:
text_far _VermilionGymAfterBattleText1
text_end
2014-05-18 18:19:10 +00:00
2020-05-06 01:28:19 +00:00
VermilionGymTrainerText2:
text_asm
2014-05-18 18:19:10 +00:00
ld hl, VermilionGymTrainerHeader1
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
VermilionGymBattleText2:
text_far _VermilionGymBattleText2
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
VermilionGymEndBattleText2:
text_far _VermilionGymEndBattleText2
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
VermilionGymAfterBattleText2:
text_far _VermilionGymAfterBattleText2
text_end
2014-05-18 18:19:10 +00:00
2020-05-06 01:28:19 +00:00
VermilionGymTrainerText3:
text_asm
2014-05-18 18:19:10 +00:00
ld hl, VermilionGymTrainerHeader2
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
VermilionGymBattleText3:
text_far _VermilionGymBattleText3
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
VermilionGymEndBattleText3:
text_far _VermilionGymEndBattleText3
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
VermilionGymAfterBattleText3:
text_far _VermilionGymAfterBattleText3
text_end
2014-05-18 18:19:10 +00:00
2020-05-06 01:28:19 +00:00
VermilionGymFanText:
text_asm
2015-07-26 02:26:54 +00:00
ld a, [wBeatGymFlags]
bit BIT_THUNDERBADGE, a
2020-05-06 01:28:19 +00:00
jr nz, .afterBeat
ld hl, VermilionGymFanPreBattleText
2014-05-18 18:19:10 +00:00
call PrintText
2020-05-06 01:28:19 +00:00
jr .done
.afterBeat
ld hl, VermilionGymFanPostBattleText
2014-05-18 18:19:10 +00:00
call PrintText
2020-05-06 01:28:19 +00:00
.done
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
2020-05-06 01:28:19 +00:00
VermilionGymFanPreBattleText:
text_far _VermilionGymFanPreBattleText
text_end
2014-05-18 18:19:10 +00:00
2020-05-06 01:28:19 +00:00
VermilionGymFanPostBattleText:
text_far _VermilionGymFanPostBattleText
text_end