pokered/scripts/PewterGym.asm

226 lines
5.4 KiB
NASM
Raw Permalink Normal View History

PewterGym_Script:
2016-01-03 19:17:10 +00:00
ld hl, wCurrentMapScriptFlags
bit BIT_CUR_MAP_LOADED_2, [hl]
res BIT_CUR_MAP_LOADED_2, [hl]
2020-07-18 18:01:13 +00:00
call nz, .LoadNames
2014-05-18 18:19:10 +00:00
call EnableAutoTextBoxDrawing
ld hl, PewterGymTrainerHeaders
ld de, PewterGym_ScriptPointers
2015-08-31 02:38:41 +00:00
ld a, [wPewterGymCurScript]
2014-05-18 18:19:10 +00:00
call ExecuteCurMapScriptInTable
2015-08-31 02:38:41 +00:00
ld [wPewterGymCurScript], 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 "PEWTER CITY@"
2020-07-18 18:01:13 +00:00
.LeaderName:
2014-05-18 18:19:10 +00:00
db "BROCK@"
PewterGymResetScripts:
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 [wPewterGymCurScript], a
ld [wCurMapScript], a
2014-05-18 18:19:10 +00:00
ret
PewterGym_ScriptPointers:
def_script_pointers
dw_const CheckFightingMapTrainers, SCRIPT_PEWTERGYM_DEFAULT
dw_const DisplayEnemyTrainerTextAndStartBattle, SCRIPT_PEWTERGYM_START_BATTLE
dw_const EndTrainerBattle, SCRIPT_PEWTERGYM_END_BATTLE
dw_const PewterGymBrockPostBattle, SCRIPT_PEWTERGYM_BROCK_POST_BATTLE
2014-05-18 18:19:10 +00:00
PewterGymBrockPostBattle:
2015-08-31 02:38:41 +00:00
ld a, [wIsInBattle]
2014-05-18 18:19:10 +00:00
cp $ff
jp z, PewterGymResetScripts
ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
; fallthrough
PewterGymScriptReceiveTM34:
ld a, TEXT_PEWTERGYM_BROCK_WAIT_TAKE_THIS
ldh [hTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
2015-07-21 02:41:23 +00:00
SetEvent EVENT_BEAT_BROCK
2020-07-06 02:52:27 +00:00
lb bc, TM_BIDE, 1
2014-05-18 18:19:10 +00:00
call GiveItem
jr nc, .BagFull
ld a, TEXT_PEWTERGYM_RECEIVED_TM34
ldh [hTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
2015-07-21 02:41:23 +00:00
SetEvent EVENT_GOT_TM34
2019-10-07 05:23:57 +00:00
jr .gymVictory
2014-05-18 18:19:10 +00:00
.BagFull
ld a, TEXT_PEWTERGYM_TM34_NO_ROOM
ldh [hTextID], 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_BOULDERBADGE, [hl]
2015-07-26 02:26:54 +00:00
ld hl, wBeatGymFlags
set BIT_BOULDERBADGE, [hl]
2014-05-18 18:19:10 +00:00
ld a, HS_GYM_GUY
2015-07-25 03:27:59 +00:00
ld [wMissableObjectIndex], a
predef HideObject
ld a, HS_ROUTE_22_RIVAL_1
2015-07-25 03:27:59 +00:00
ld [wMissableObjectIndex], a
predef HideObject
2014-05-18 18:19:10 +00:00
ResetEvents EVENT_1ST_ROUTE22_RIVAL_BATTLE, EVENT_ROUTE22_RIVAL_WANTS_BATTLE
2014-05-18 18:19:10 +00:00
; deactivate gym trainers
2015-07-21 01:32:02 +00:00
SetEvent EVENT_BEAT_PEWTER_GYM_TRAINER_0
2014-05-18 18:19:10 +00:00
jp PewterGymResetScripts
2014-05-18 18:19:10 +00:00
PewterGym_TextPointers:
def_text_pointers
dw_const PewterGymBrockText, TEXT_PEWTERGYM_BROCK
dw_const PewterGymCooltrainerMText, TEXT_PEWTERGYM_COOLTRAINER_M
dw_const PewterGymGuideText, TEXT_PEWTERGYM_GYM_GUIDE
dw_const PewterGymBrockWaitTakeThisText, TEXT_PEWTERGYM_BROCK_WAIT_TAKE_THIS
dw_const PewterGymReceivedTM34Text, TEXT_PEWTERGYM_RECEIVED_TM34
dw_const PewterGymTM34NoRoomText, TEXT_PEWTERGYM_TM34_NO_ROOM
2014-05-18 18:19:10 +00:00
PewterGymTrainerHeaders:
def_trainers 2
2016-06-12 00:24:04 +00:00
PewterGymTrainerHeader0:
trainer EVENT_BEAT_PEWTER_GYM_TRAINER_0, 5, PewterGymCooltrainerMBattleText, PewterGymCooltrainerMEndBattleText, PewterGymCooltrainerMAfterBattleText
db -1 ; end
2014-05-18 18:19:10 +00:00
PewterGymBrockText:
text_asm
2015-07-21 02:41:23 +00:00
CheckEvent EVENT_BEAT_BROCK
jr z, .beforeBeat
2015-07-21 02:41:23 +00:00
CheckEventReuseA EVENT_GOT_TM34
jr nz, .afterBeat
call z, PewterGymScriptReceiveTM34
2014-05-18 18:19:10 +00:00
call DisableWaitingAfterTextDisplay
2019-10-07 05:23:57 +00:00
jr .done
.afterBeat
ld hl, .PostBattleAdviceText
2014-05-18 18:19:10 +00:00
call PrintText
2019-10-07 05:23:57 +00:00
jr .done
.beforeBeat
ld hl, .PreBattleText
2014-05-18 18:19:10 +00:00
call PrintText
ld hl, wStatusFlags3
set BIT_TALKED_TO_TRAINER, [hl]
set BIT_PRINT_END_BATTLE_TEXT, [hl]
ld hl, PewterGymBrockReceivedBoulderBadgeText
ld de, PewterGymBrockReceivedBoulderBadgeText
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, $1
2015-08-31 02:38:41 +00:00
ld [wGymLeaderNo], a
2014-05-18 18:19:10 +00:00
xor a
ldh [hJoyHeld], a
ld a, SCRIPT_PEWTERGYM_BROCK_POST_BATTLE
2015-08-31 02:38:41 +00:00
ld [wPewterGymCurScript], a
ld [wCurMapScript], a
2019-10-07 05:23:57 +00:00
.done
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
.PreBattleText:
text_far _PewterGymBrockPreBattleText
text_end
2014-05-18 18:19:10 +00:00
.PostBattleAdviceText:
text_far _PewterGymBrockPostBattleAdviceText
text_end
2014-05-18 18:19:10 +00:00
PewterGymBrockWaitTakeThisText:
text_far _PewterGymBrockWaitTakeThisText
text_end
2014-05-18 18:19:10 +00:00
PewterGymReceivedTM34Text:
text_far _PewterGymReceivedTM34Text
sound_get_item_1
text_far _TM34ExplanationText
text_end
2014-05-18 18:19:10 +00:00
PewterGymTM34NoRoomText:
text_far _PewterGymTM34NoRoomText
text_end
2014-05-18 18:19:10 +00:00
PewterGymBrockReceivedBoulderBadgeText:
text_far _PewterGymBrockReceivedBoulderBadgeText
sound_level_up ; probably supposed to play SFX_GET_ITEM_1 but the wrong music bank is loaded
text_far _PewterGymBrockBoulderBadgeInfoText ; Text to tell that the flash technique can be used
text_end
2014-05-18 18:19:10 +00:00
PewterGymCooltrainerMText:
text_asm
2014-05-18 18:19:10 +00:00
ld hl, PewterGymTrainerHeader0
call TalkToTrainer
jp TextScriptEnd
PewterGymCooltrainerMBattleText:
text_far _PewterGymCooltrainerMBattleText
text_end
2014-05-18 18:19:10 +00:00
PewterGymCooltrainerMEndBattleText:
text_far _PewterGymCooltrainerMEndBattleText
text_end
2014-05-18 18:19:10 +00:00
PewterGymCooltrainerMAfterBattleText:
text_far _PewterGymCooltrainerMAfterBattleText
text_end
2014-05-18 18:19:10 +00:00
PewterGymGuideText:
text_asm
2015-07-26 02:26:54 +00:00
ld a, [wBeatGymFlags]
bit BIT_BOULDERBADGE, a
jr nz, .afterBeat
ld hl, PewterGymGuidePreAdviceText
2014-05-18 18:19:10 +00:00
call PrintText
call YesNoChoice
ld a, [wCurrentMenuItem]
2014-05-18 18:19:10 +00:00
and a
jr nz, .PewterGymGuideBeginAdviceText
ld hl, PewterGymGuideBeginAdviceText
2014-05-18 18:19:10 +00:00
call PrintText
jr .PewterGymGuideAdviceText
.PewterGymGuideBeginAdviceText
ld hl, PewterGymGuideFreeServiceText
2014-05-18 18:19:10 +00:00
call PrintText
.PewterGymGuideAdviceText
ld hl, PewterGymGuideAdviceText
2014-05-18 18:19:10 +00:00
call PrintText
jr .done
.afterBeat
ld hl, PewterGymGuidePostBattleText
2014-05-18 18:19:10 +00:00
call PrintText
.done
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
PewterGymGuidePreAdviceText:
text_far _PewterGymGuidePreAdviceText
text_end
2014-05-18 18:19:10 +00:00
PewterGymGuideBeginAdviceText:
text_far _PewterGymGuideBeginAdviceText
text_end
2014-05-18 18:19:10 +00:00
PewterGymGuideAdviceText:
text_far _PewterGymGuideAdviceText
text_end
2014-05-18 18:19:10 +00:00
PewterGymGuideFreeServiceText:
text_far _PewterGymGuideFreeServiceText
text_end
2014-05-18 18:19:10 +00:00
PewterGymGuidePostBattleText:
text_far _PewterGymGuidePostBattleText
text_end