pokered/scripts/pewtergym.asm

230 lines
4.6 KiB
NASM
Raw Normal View History

2014-05-18 18:19:10 +00:00
PewterGymScript: ; 5c387 (17:4387)
ld hl, wd126
2014-05-18 18:19:10 +00:00
bit 6, [hl]
res 6, [hl]
call nz, PewterGymScript_5c3a4
call EnableAutoTextBoxDrawing
ld hl, PewterGymTrainerHeaders
ld de, PewterGymScriptPointers
ld a, [W_PEWTERGYMCURSCRIPT]
call ExecuteCurMapScriptInTable
ld [W_PEWTERGYMCURSCRIPT], a
ret
PewterGymScript_5c3a4: ; 5c3a4 (17:43a4)
ld hl, Gym1CityName
ld de, Gym1LeaderName
2014-05-18 18:19:10 +00:00
jp LoadGymLeaderAndCityName
Gym1CityName: ; 5c3ad (17:43ad)
db "PEWTER CITY@"
Gym1LeaderName: ; 5c3b9 (17:43b9)
db "BROCK@"
PewterGymScript_5c3bf: ; 5c3bf (17:43bf)
xor a
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
2014-05-18 18:19:10 +00:00
ld [W_PEWTERGYMCURSCRIPT], a
ld [W_CURMAPSCRIPT], a
ret
PewterGymScriptPointers: ; 5c3ca (17:43ca)
dw CheckFightingMapTrainers
2014-09-14 18:29:18 +00:00
dw DisplayEnemyTrainerTextAndStartBattle
2014-05-18 18:19:10 +00:00
dw EndTrainerBattle
dw PewterGymScript3
PewterGymScript3: ; 5c3d2 (17:43d2)
ld a, [W_ISINBATTLE]
2014-05-18 18:19:10 +00:00
cp $ff
jp z, PewterGymScript_5c3bf
ld a, $f0
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
2014-05-18 18:19:10 +00:00
PewterGymScript_5c3df: ; 5c3df (17:43df)
ld a, $4
2015-07-18 15:17:29 +00:00
ld [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
2015-07-21 02:41:23 +00:00
SetEvent EVENT_BEAT_BROCK
2014-05-18 18:19:10 +00:00
ld bc, (TM_34 << 8) | 1
call GiveItem
jr nc, .BagFull
ld a, $5
2015-07-18 15:17:29 +00:00
ld [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
2015-07-21 02:41:23 +00:00
SetEvent EVENT_GOT_TM34
2014-05-18 18:19:10 +00:00
jr .asm_5c408
.BagFull
ld a, $6
2015-07-18 15:17:29 +00:00
ld [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
.asm_5c408
ld hl, W_OBTAINEDBADGES
set 0, [hl]
ld hl, wd72a
2014-05-18 18:19:10 +00:00
set 0, [hl]
ld a, HS_GYM_GUY
ld [wcc4d], a
predef HideObject
ld a, HS_ROUTE_22_RIVAL_1
ld [wcc4d], 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 PewterGymScript_5c3bf
PewterGymTextPointers: ; 5c435 (17:4435)
dw PewterGymText1
dw PewterGymText2
dw PewterGymText3
dw PewterGymText4
dw PewterGymText5
dw PewterGymText6
PewterGymTrainerHeaders: ; 5c441 (17:4441)
PewterGymTrainerHeader0: ; 5c441 (17:4441)
2015-07-21 01:32:02 +00:00
dbEventFlagBit EVENT_BEAT_PEWTER_GYM_TRAINER_0
2014-05-18 18:19:10 +00:00
db ($5 << 4) ; trainer's view range
2015-07-21 01:32:02 +00:00
dwEventFlagAddress EVENT_BEAT_PEWTER_GYM_TRAINER_0
dw PewterGymBattleText1 ; TextBeforeBattle
dw PewterGymAfterBattleText1 ; TextAfterBattle
dw PewterGymEndBattleText1 ; TextEndBattle
dw PewterGymEndBattleText1 ; TextEndBattle
2014-05-18 18:19:10 +00:00
db $ff
PewterGymText1: ; 5c44e (17:444e)
2015-07-03 19:58:50 +00:00
TX_ASM
2015-07-21 02:41:23 +00:00
CheckEvent EVENT_BEAT_BROCK
jr z, .asm_5c46a
2015-07-21 02:41:23 +00:00
CheckEventReuseA EVENT_GOT_TM34
jr nz, .asm_5c462
2014-05-18 18:19:10 +00:00
call z, PewterGymScript_5c3df
call DisableWaitingAfterTextDisplay
jr .asm_5c49b
.asm_5c462
2014-05-18 18:19:10 +00:00
ld hl, PewterGymText_5c4a3
call PrintText
jr .asm_5c49b
.asm_5c46a
2014-05-18 18:19:10 +00:00
ld hl, PewterGymText_5c49e
call PrintText
ld hl, wd72d
2014-05-18 18:19:10 +00:00
set 6, [hl]
set 7, [hl]
ld hl, PewterGymText_5c4bc
ld de, PewterGymText_5c4bc
2014-09-14 18:29:18 +00:00
call SaveEndBattleTextPointers
2015-07-03 20:13:35 +00:00
ld a, [H_SPRITEINDEX]
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
ld [W_GYMLEADERNO], a
2014-05-18 18:19:10 +00:00
xor a
2015-07-03 20:13:35 +00:00
ld [hJoyHeld], a
2014-05-18 18:19:10 +00:00
ld a, $3
ld [W_PEWTERGYMCURSCRIPT], a
ld [W_CURMAPSCRIPT], a
.asm_5c49b
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
PewterGymText_5c49e: ; 5c49e (17:449e)
TX_FAR _PewterGymText_5c49e
db "@"
PewterGymText_5c4a3: ; 5c4a3 (17:44a3)
TX_FAR _PewterGymText_5c4a3
db "@"
PewterGymText4: ; 5c4a8 (17:44a8)
TX_FAR _TM34PreReceiveText
db "@"
PewterGymText5: ; 5c4ad (17:44ad)
TX_FAR _ReceivedTM34Text
db $0B
TX_FAR _TM34ExplanationText
db "@"
PewterGymText6: ; 5c4b7 (17:44b7)
TX_FAR _TM34NoRoomText
db "@"
PewterGymText_5c4bc: ; 5c4bc (17:44bc)
TX_FAR _PewterGymText_5c4bc
db $0B
TX_FAR _PewterGymText_5c4c1
db "@"
PewterGymText2: ; 5c4c6 (17:44c6)
2015-07-03 19:58:50 +00:00
TX_ASM
2014-05-18 18:19:10 +00:00
ld hl, PewterGymTrainerHeader0
call TalkToTrainer
jp TextScriptEnd
PewterGymBattleText1: ; 5c4d0 (17:44d0)
TX_FAR _PewterGymBattleText1
db "@"
PewterGymEndBattleText1: ; 5c4d5 (17:44d5)
TX_FAR _PewterGymEndBattleText1
db "@"
PewterGymAfterBattleText1: ; 5c4da (17:44da)
TX_FAR _PewterGymAfterBattleText1
db "@"
PewterGymText3: ; 5c4df (17:44df)
2015-07-03 19:58:50 +00:00
TX_ASM
ld a, [wd72a]
2014-05-18 18:19:10 +00:00
bit 0, a
jr nz, .asm_5c50c
2014-05-18 18:19:10 +00:00
ld hl, PewterGymText_5c515
call PrintText
call YesNoChoice
ld a, [wCurrentMenuItem]
2014-05-18 18:19:10 +00:00
and a
jr nz, .asm_5c4fe
2014-05-18 18:19:10 +00:00
ld hl, PewterGymText_5c51a
call PrintText
jr .asm_5c504
.asm_5c4fe
2014-05-18 18:19:10 +00:00
ld hl, PewterGymText_5c524
call PrintText
.asm_5c504
2014-05-18 18:19:10 +00:00
ld hl, PewterGymText_5c51f
call PrintText
jr .asm_5c512
.asm_5c50c
2014-05-18 18:19:10 +00:00
ld hl, PewterGymText_5c529
call PrintText
.asm_5c512
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
PewterGymText_5c515: ; 5c515 (17:4515)
TX_FAR _PewterGymText_5c515
db "@"
PewterGymText_5c51a: ; 5c51a (17:451a)
TX_FAR _PewterGymText_5c51a
db "@"
PewterGymText_5c51f: ; 5c51f (17:451f)
TX_FAR _PewterGymText_5c51f
db "@"
PewterGymText_5c524: ; 5c524 (17:4524)
TX_FAR _PewterGymText_5c524
db "@"
PewterGymText_5c529: ; 5c529 (17:4529)
TX_FAR _PewterGymText_5c529
db "@"