pokered/scripts/CeladonGym.asm

336 lines
7.2 KiB
NASM
Raw Normal View History

CeladonGym_Script:
2016-01-03 19:17:10 +00:00
ld hl, wCurrentMapScriptFlags
2014-05-18 18:19:10 +00:00
bit 6, [hl]
res 6, [hl]
call nz, CeladonGymScript_48927
call EnableAutoTextBoxDrawing
ld hl, CeladonGymTrainerHeader0
ld de, CeladonGym_ScriptPointers
2015-08-31 02:38:41 +00:00
ld a, [wCeladonGymCurScript]
2014-05-18 18:19:10 +00:00
call ExecuteCurMapScriptInTable
2015-08-31 02:38:41 +00:00
ld [wCeladonGymCurScript], a
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
CeladonGymScript_48927:
ld hl, Gym4CityName
ld de, Gym4LeaderName
2014-05-18 18:19:10 +00:00
jp LoadGymLeaderAndCityName
2016-06-12 00:24:04 +00:00
Gym4CityName:
2014-05-18 18:19:10 +00:00
db "CELADON CITY@"
2016-06-12 00:24:04 +00:00
Gym4LeaderName:
2014-05-18 18:19:10 +00:00
db "ERIKA@"
2016-06-12 00:24:04 +00:00
CeladonGymText_48943:
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 [wCeladonGymCurScript], a
ld [wCurMapScript], a
2014-05-18 18:19:10 +00:00
ret
CeladonGym_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
dw CeladonGymScript3
2016-06-12 00:24:04 +00:00
CeladonGymScript3:
2015-08-31 02:38:41 +00:00
ld a, [wIsInBattle]
2014-05-18 18:19:10 +00:00
cp $ff
jp z, CeladonGymText_48943
ld a, $f0
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymText_48963:
2014-05-18 18:19:10 +00:00
ld a, $9
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
2015-07-21 02:41:23 +00:00
SetEvent EVENT_BEAT_ERIKA
2020-07-06 02:52:27 +00:00
lb bc, TM_MEGA_DRAIN, 1
2014-05-18 18:19:10 +00:00
call GiveItem
jr nc, .BagFull
ld a, $a
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
2015-07-21 02:41:23 +00:00
SetEvent EVENT_GOT_TM21
2019-10-07 05:23:57 +00:00
jr .gymVictory
2014-05-18 18:19:10 +00:00
.BagFull
ld a, $b
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_RAINBOWBADGE, [hl]
2015-07-26 02:26:54 +00:00
ld hl, wBeatGymFlags
set BIT_RAINBOWBADGE, [hl]
2014-05-18 18:19:10 +00:00
; deactivate gym trainers
SetEventRange EVENT_BEAT_CELADON_GYM_TRAINER_0, EVENT_BEAT_CELADON_GYM_TRAINER_6
2014-05-18 18:19:10 +00:00
jp CeladonGymText_48943
CeladonGym_TextPointers:
2014-05-18 18:19:10 +00:00
dw CeladonGymText1
dw CeladonGymText2
dw CeladonGymText3
dw CeladonGymText4
dw CeladonGymText5
dw CeladonGymText6
dw CeladonGymText7
dw CeladonGymText8
dw CeladonGymText9
dw TM21Text
dw TM21NoRoomText
2016-06-12 00:24:04 +00:00
CeladonGymTrainerHeader0:
2015-07-21 01:32:02 +00:00
dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_0
2014-05-18 18:19:10 +00:00
db ($2 << 4) ; trainer's view range
2015-07-21 01:32:02 +00:00
dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_0
dw CeladonGymBattleText2 ; TextBeforeBattle
dw CeladonGymAfterBattleText2 ; TextAfterBattle
dw CeladonGymEndBattleText2 ; TextEndBattle
dw CeladonGymEndBattleText2 ; TextEndBattle
2014-05-18 18:19:10 +00:00
CeladonGymTrainerHeader1:
dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_1
2014-05-18 18:19:10 +00:00
db ($2 << 4) ; trainer's view range
dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_1
dw CeladonGymBattleText3 ; TextBeforeBattle
dw CeladonGymAfterBattleText3 ; TextAfterBattle
dw CeladonGymEndBattleText3 ; TextEndBattle
dw CeladonGymEndBattleText3 ; TextEndBattle
2014-05-18 18:19:10 +00:00
CeladonGymTrainerHeader2:
dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_2
2014-05-18 18:19:10 +00:00
db ($4 << 4) ; trainer's view range
dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_2
dw CeladonGymBattleText4 ; TextBeforeBattle
dw CeladonGymAfterBattleText4 ; TextAfterBattle
dw CeladonGymEndBattleText4 ; TextEndBattle
dw CeladonGymEndBattleText4 ; TextEndBattle
2014-05-18 18:19:10 +00:00
CeladonGymTrainerHeader3:
dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_3
2014-05-18 18:19:10 +00:00
db ($4 << 4) ; trainer's view range
dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_3
dw CeladonGymBattleText5 ; TextBeforeBattle
dw CeladonGymAfterBattleText5 ; TextAfterBattle
dw CeladonGymEndBattleText5 ; TextEndBattle
dw CeladonGymEndBattleText5 ; TextEndBattle
2014-05-18 18:19:10 +00:00
CeladonGymTrainerHeader4:
dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_4
2014-05-18 18:19:10 +00:00
db ($2 << 4) ; trainer's view range
dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_4
dw CeladonGymBattleText6 ; TextBeforeBattle
dw CeladonGymAfterBattleText6 ; TextAfterBattle
dw CeladonGymEndBattleText6 ; TextEndBattle
dw CeladonGymEndBattleText6 ; TextEndBattle
2014-05-18 18:19:10 +00:00
CeladonGymTrainerHeader5:
dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_5
2014-05-18 18:19:10 +00:00
db ($2 << 4) ; trainer's view range
dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_5
dw CeladonGymBattleText7 ; TextBeforeBattle
dw CeladonGymAfterBattleText7 ; TextAfterBattle
dw CeladonGymEndBattleText7 ; TextEndBattle
dw CeladonGymEndBattleText7 ; TextEndBattle
2014-05-18 18:19:10 +00:00
CeladonGymTrainerHeader6:
dbEventFlagBit EVENT_BEAT_CELADON_GYM_TRAINER_6, 1
2014-05-18 18:19:10 +00:00
db ($3 << 4) ; trainer's view range
dwEventFlagAddress EVENT_BEAT_CELADON_GYM_TRAINER_6, 1
dw CeladonGymBattleText8 ; TextBeforeBattle
dw CeladonGymAfterBattleText8 ; TextAfterBattle
dw CeladonGymEndBattleText8 ; TextEndBattle
dw CeladonGymEndBattleText8 ; TextEndBattle
2014-05-18 18:19:10 +00:00
db $ff
2016-06-12 00:24:04 +00:00
CeladonGymText1:
text_asm
2015-07-21 02:41:23 +00:00
CheckEvent EVENT_BEAT_ERIKA
2019-10-07 05:23:57 +00:00
jr z, .beginBattle
2015-07-21 02:41:23 +00:00
CheckEventReuseA EVENT_GOT_TM21
2019-10-07 05:23:57 +00:00
jr nz, .afterVictory
2014-05-18 18:19:10 +00:00
call z, CeladonGymText_48963
call DisableWaitingAfterTextDisplay
2019-10-07 05:23:57 +00:00
jr .done
.afterVictory
2014-05-18 18:19:10 +00:00
ld hl, CeladonGymText_48a68
call PrintText
2019-10-07 05:23:57 +00:00
jr .done
.beginBattle
2014-05-18 18:19:10 +00:00
ld hl, CeladonGymText_48a5e
call PrintText
ld hl, wd72d
2014-05-18 18:19:10 +00:00
set 6, [hl]
set 7, [hl]
ld hl, CeladonGymText_48a63
ld de, CeladonGymText_48a63
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, $4
2015-08-31 02:38:41 +00:00
ld [wGymLeaderNo], a
2014-05-18 18:19:10 +00:00
ld a, $3
2015-08-31 02:38:41 +00:00
ld [wCeladonGymCurScript], a
ld [wCurMapScript], a
2019-10-07 05:23:57 +00:00
.done
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGymText_48a5e:
text_far _CeladonGymText_48a5e
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymText_48a63:
text_far _CeladonGymText_48a63
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymText_48a68:
text_far _CeladonGymText_48a68
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymText9:
text_far _CeladonGymText9
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
TM21Text:
text_far _ReceivedTM21Text
sound_get_item_1
text_far _TM21ExplanationText
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
TM21NoRoomText:
text_far _TM21NoRoomText
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymText2:
text_asm
2014-05-18 18:19:10 +00:00
ld hl, CeladonGymTrainerHeader0
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGymBattleText2:
text_far _CeladonGymBattleText2
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymEndBattleText2:
text_far _CeladonGymEndBattleText2
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymAfterBattleText2:
text_far _CeladonGymAfterBattleText2
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymText3:
text_asm
ld hl, CeladonGymTrainerHeader1
2014-05-18 18:19:10 +00:00
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGymBattleText3:
text_far _CeladonGymBattleText3
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymEndBattleText3:
text_far _CeladonGymEndBattleText3
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymAfterBattleText3:
text_far _CeladonGymAfterBattleText3
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymText4:
text_asm
ld hl, CeladonGymTrainerHeader2
2014-05-18 18:19:10 +00:00
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGymBattleText4:
text_far _CeladonGymBattleText4
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymEndBattleText4:
text_far _CeladonGymEndBattleText4
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymAfterBattleText4:
text_far _CeladonGymAfterBattleText4
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymText5:
text_asm
ld hl, CeladonGymTrainerHeader3
2014-05-18 18:19:10 +00:00
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGymBattleText5:
text_far _CeladonGymBattleText5
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymEndBattleText5:
text_far _CeladonGymEndBattleText5
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymAfterBattleText5:
text_far _CeladonGymAfterBattleText5
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymText6:
text_asm
ld hl, CeladonGymTrainerHeader4
2014-05-18 18:19:10 +00:00
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGymBattleText6:
text_far _CeladonGymBattleText6
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymEndBattleText6:
text_far _CeladonGymEndBattleText6
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymAfterBattleText6:
text_far _CeladonGymAfterBattleText6
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymText7:
text_asm
ld hl, CeladonGymTrainerHeader5
2014-05-18 18:19:10 +00:00
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGymBattleText7:
text_far _CeladonGymBattleText7
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymEndBattleText7:
text_far _CeladonGymEndBattleText7
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymAfterBattleText7:
text_far _CeladonGymAfterBattleText7
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymText8:
text_asm
ld hl, CeladonGymTrainerHeader6
2014-05-18 18:19:10 +00:00
call TalkToTrainer
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeladonGymBattleText8:
text_far _CeladonGymBattleText8
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymEndBattleText8:
text_far _CeladonGymEndBattleText8
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeladonGymAfterBattleText8:
text_far _CeladonGymAfterBattleText8
text_end