pokered/scripts/CeruleanCity.asm

458 lines
8.1 KiB
NASM
Raw Normal View History

CeruleanCity_Script:
2014-05-18 18:19:10 +00:00
call EnableAutoTextBoxDrawing
ld hl, CeruleanCity_ScriptPointers
2015-08-31 02:38:41 +00:00
ld a, [wCeruleanCityCurScript]
2014-05-18 18:19:10 +00:00
jp CallFunctionInTable
2016-06-12 00:24:04 +00:00
CeruleanCityScript_1948c:
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 [wCeruleanCityCurScript], a
ld a, HS_CERULEAN_RIVAL
2015-07-25 03:27:59 +00:00
ld [wMissableObjectIndex], a
predef_jump HideObject
2014-05-18 18:19:10 +00:00
CeruleanCity_ScriptPointers:
2014-05-18 18:19:10 +00:00
dw CeruleanCityScript0
dw CeruleanCityScript1
dw CeruleanCityScript2
dw CeruleanCityScript3
dw CeruleanCityScript4
2016-06-12 00:24:04 +00:00
CeruleanCityScript4:
2015-08-31 02:38:41 +00:00
ld a, [wIsInBattle]
2014-05-18 18:19:10 +00:00
cp $ff
jp z, CeruleanCityScript_1948c
ld a, $f0
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
2015-07-21 17:36:03 +00:00
SetEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF
2014-05-18 18:19:10 +00:00
ld a, $2
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
xor a
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
2015-08-31 02:38:41 +00:00
ld [wCeruleanCityCurScript], a
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
CeruleanCityScript0:
2020-07-15 17:35:39 +00:00
IF DEF(_DEBUG)
call DebugPressedOrHeldB
ret nz
ENDC
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF
jr nz, .asm_194f7
2014-05-18 18:19:10 +00:00
ld hl, CeruleanCityCoords1
call ArePlayerCoordsInArray
jr nc, .asm_194f7
2015-07-19 03:49:52 +00:00
ld a, [wCoordIndex]
2014-05-18 18:19:10 +00:00
cp $1
2015-07-20 00:52:26 +00:00
ld a, PLAYER_DIR_UP
ld b, SPRITE_FACING_DOWN
jr nz, .asm_194e6
2015-07-20 00:52:26 +00:00
ld a, PLAYER_DIR_DOWN
ld b, SPRITE_FACING_UP
2014-05-18 18:19:10 +00:00
.asm_194e6
2015-07-20 00:52:26 +00:00
ld [wPlayerMovingDirection], a
2014-05-18 18:19:10 +00:00
ld a, b
ld [wSprite02StateData1FacingDirection], a
2014-05-18 18:19:10 +00:00
call Delay3
ld a, $2
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
jp DisplayTextID
.asm_194f7
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_BEAT_CERULEAN_RIVAL
2014-05-18 18:19:10 +00:00
ret nz
ld hl, CeruleanCityCoords2
call ArePlayerCoordsInArray
ret nc
2014-09-13 07:50:56 +00:00
ld a, [wWalkBikeSurfState]
2014-05-18 18:19:10 +00:00
and a
jr z, .asm_19512
ld a, SFX_STOP_ALL_MUSIC
2015-08-09 05:32:44 +00:00
ld [wNewSoundID], a
2014-05-18 18:19:10 +00:00
call PlaySound
.asm_19512
ld c, BANK(Music_MeetRival)
ld a, MUSIC_MEET_RIVAL
call PlayMusic
xor a
ldh [hJoyHeld], a
2014-05-18 18:19:10 +00:00
ld a, $f0
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
2015-08-31 02:38:41 +00:00
ld a, [wXCoord]
cp 20
jr z, .asm_19535
2014-05-18 18:19:10 +00:00
ld a, $1
ldh [hSpriteIndex], a
2020-08-30 20:33:14 +00:00
ld a, SPRITESTATEDATA2_MAPX
ldh [hSpriteDataOffset], a
call GetPointerWithinSpriteStateData2
2020-08-30 20:33:14 +00:00
ld [hl], 25
2014-05-18 18:19:10 +00:00
.asm_19535
ld a, HS_CERULEAN_RIVAL
2015-07-25 03:27:59 +00:00
ld [wMissableObjectIndex], a
predef ShowObject
2014-05-18 18:19:10 +00:00
ld de, CeruleanCityMovement1
ld a, $1
ldh [hSpriteIndex], a
2014-05-18 18:19:10 +00:00
call MoveSprite
ld a, $1
2015-08-31 02:38:41 +00:00
ld [wCeruleanCityCurScript], a
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
CeruleanCityCoords1:
dbmapcoord 30, 7
dbmapcoord 30, 9
db -1 ; end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityCoords2:
dbmapcoord 20, 6
dbmapcoord 21, 6
db -1 ; end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityMovement1:
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db -1 ; end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityScript_1955d:
ld a, 1
ldh [hSpriteIndex], a
xor a ; SPRITE_FACING_DOWN
ldh [hSpriteFacingDirection], a
jp SetSpriteFacingDirectionAndDelay ; face object
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityScript1:
ld a, [wd730]
2014-05-18 18:19:10 +00:00
bit 0, a
ret nz
xor a
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
2014-05-18 18:19:10 +00:00
ld a, $1
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
ld hl, wd72d
2014-05-18 18:19:10 +00:00
set 6, [hl]
set 7, [hl]
ld hl, CeruleanCityText_1966d
ld de, CeruleanCityText_19672
2014-09-14 18:29:18 +00:00
call SaveEndBattleTextPointers
2020-07-17 17:27:27 +00:00
ld a, OPP_RIVAL1
2015-08-31 02:38:41 +00:00
ld [wCurOpponent], a
2014-05-18 18:19:10 +00:00
; select which team to use during the encounter
2015-08-31 02:38:41 +00:00
ld a, [wRivalStarter]
2014-05-21 12:48:30 +00:00
cp STARTER2
jr nz, .NotSquirtle
2014-05-18 18:19:10 +00:00
ld a, $7
jr .done
.NotSquirtle
2014-05-21 12:48:30 +00:00
cp STARTER3
jr nz, .Charmander
2014-05-18 18:19:10 +00:00
ld a, $8
jr .done
.Charmander
ld a, $9
.done
2015-08-31 02:38:41 +00:00
ld [wTrainerNo], a
2014-05-18 18:19:10 +00:00
xor a
ldh [hJoyHeld], a
2014-05-18 18:19:10 +00:00
call CeruleanCityScript_1955d
ld a, $2
2015-08-31 02:38:41 +00:00
ld [wCeruleanCityCurScript], a
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
CeruleanCityScript2:
2015-08-31 02:38:41 +00:00
ld a, [wIsInBattle]
2014-05-18 18:19:10 +00:00
cp $ff
jp z, CeruleanCityScript_1948c
call CeruleanCityScript_1955d
ld a, $f0
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
2015-07-21 17:36:03 +00:00
SetEvent EVENT_BEAT_CERULEAN_RIVAL
2014-05-18 18:19:10 +00:00
ld a, $1
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
ld a, SFX_STOP_ALL_MUSIC
2015-08-09 05:32:44 +00:00
ld [wNewSoundID], a
2014-05-18 18:19:10 +00:00
call PlaySound
farcall Music_RivalAlternateStart
2014-05-18 18:19:10 +00:00
ld a, $1
ldh [hSpriteIndex], a
2014-05-18 18:19:10 +00:00
call SetSpriteMovementBytesToFF
2015-08-31 02:38:41 +00:00
ld a, [wXCoord]
cp 20
jr nz, .asm_195f0
2014-05-18 18:19:10 +00:00
ld de, CeruleanCityMovement4
jr .asm_195f3
2014-05-18 18:19:10 +00:00
.asm_195f0
ld de, CeruleanCityMovement3
.asm_195f3
ld a, $1
ldh [hSpriteIndex], a
2014-05-18 18:19:10 +00:00
call MoveSprite
ld a, $3
2015-08-31 02:38:41 +00:00
ld [wCeruleanCityCurScript], a
2014-05-18 18:19:10 +00:00
ret
2016-06-12 00:24:04 +00:00
CeruleanCityMovement3:
db NPC_MOVEMENT_LEFT
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db -1 ; end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityMovement4:
db NPC_MOVEMENT_RIGHT
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db -1 ; end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityScript3:
ld a, [wd730]
2014-05-18 18:19:10 +00:00
bit 0, a
ret nz
ld a, HS_CERULEAN_RIVAL
2015-07-25 03:27:59 +00:00
ld [wMissableObjectIndex], a
predef HideObject
2014-05-18 18:19:10 +00:00
xor a
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
call PlayDefaultMusic
2014-05-18 18:19:10 +00:00
ld a, $0
2015-08-31 02:38:41 +00:00
ld [wCeruleanCityCurScript], a
2014-05-18 18:19:10 +00:00
ret
CeruleanCity_TextPointers:
2014-05-18 18:19:10 +00:00
dw CeruleanCityText1
dw CeruleanCityText2
dw CeruleanCityText3
dw CeruleanCityText4
dw CeruleanCityText5
dw CeruleanCityText6
dw CeruleanCityText7
dw CeruleanCityText8
dw CeruleanCityText9
dw CeruleanCityText10
dw CeruleanCityText11
dw CeruleanCityText12
dw CeruleanCityText13
dw MartSignText
dw PokeCenterSignText
dw CeruleanCityText16
dw CeruleanCityText17
2016-06-12 00:24:04 +00:00
CeruleanCityText1:
text_asm
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_BEAT_CERULEAN_RIVAL
2014-05-18 18:19:10 +00:00
; do pre-battle text
jr z, .PreBattleText
; or talk about bill
ld hl, CeruleanCityText_19677
call PrintText
jr .end
.PreBattleText
2014-05-18 18:19:10 +00:00
ld hl, CeruleanCityText_19668
call PrintText
.end
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeruleanCityText_19668:
text_far _CeruleanCityText_19668
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText_1966d:
text_far _CeruleanCityText_1966d
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText_19672:
text_far _CeruleanCityText_19672
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText_19677:
text_far _CeruleanCityText_19677
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText2:
text_asm
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF
jr nz, .asm_4ca20
2014-05-18 18:19:10 +00:00
ld hl, CeruleanCityText_196d9
call PrintText
ld hl, wd72d
2014-05-18 18:19:10 +00:00
set 6, [hl]
set 7, [hl]
ld hl, CeruleanCityText_196ee
ld de, CeruleanCityText_196ee
2014-09-14 18:29:18 +00:00
call SaveEndBattleTextPointers
ldh a, [hSpriteIndexOrTextID]
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 [wCeruleanCityCurScript], a
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
.asm_4ca20
2014-05-18 18:19:10 +00:00
ld hl, CeruleanCityText_196f3
call PrintText
2020-07-06 02:52:27 +00:00
lb bc, TM_DIG, 1
2014-05-18 18:19:10 +00:00
call GiveItem
jr c, .Success
ld hl, TM28NoRoomText
call PrintText
jr .Done
.Success
ld a, $1
2014-09-13 07:50:56 +00:00
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
2014-05-18 18:19:10 +00:00
ld hl, ReceivedTM28Text
call PrintText
farcall CeruleanHideRocket
2014-05-18 18:19:10 +00:00
.Done
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeruleanCityText_196d9:
text_far _CeruleanCityText_196d9
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
ReceivedTM28Text:
text_far _ReceivedTM28Text
sound_get_item_1
text_far _ReceivedTM28Text2
text_waitbutton
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
TM28NoRoomText:
text_far _TM28NoRoomText
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText_196ee:
text_far _CeruleanCityText_196ee
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText_196f3:
text_far _CeruleanCityText_196f3
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText3:
text_far _CeruleanCityText3
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText4:
text_far _CeruleanCityText4
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText5:
text_far _CeruleanCityText5
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText11:
CeruleanCityText6:
text_far _CeruleanCityText6
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText7:
text_asm
ldh a, [hRandomAdd]
2016-07-18 06:17:03 +00:00
cp 180
jr c, .asm_e9fc9
2014-05-18 18:19:10 +00:00
ld hl, CeruleanCityText_19730
call PrintText
jr .asm_d486e
.asm_e9fc9
2016-07-18 06:17:03 +00:00
cp 100
jr c, .asm_df99b
2014-05-18 18:19:10 +00:00
ld hl, CeruleanCityText_19735
call PrintText
jr .asm_d486e
.asm_df99b
2014-05-18 18:19:10 +00:00
ld hl, CeruleanCityText_1973a
call PrintText
.asm_d486e
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeruleanCityText_19730:
text_far _CeruleanCityText_19730
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText_19735:
text_far _CeruleanCityText_19735
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText_1973a:
text_far _CeruleanCityText_1973a
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText8:
text_asm
ldh a, [hRandomAdd]
2016-07-18 06:17:03 +00:00
cp 180
jr c, .asm_e28da
2014-05-18 18:19:10 +00:00
ld hl, CeruleanCityText_1976f
call PrintText
jr .asm_f2f38
.asm_e28da
2016-07-18 06:17:03 +00:00
cp 120
jr c, .asm_15d08
2014-05-18 18:19:10 +00:00
ld hl, CeruleanCityText_19774
call PrintText
jr .asm_f2f38
.asm_15d08
2016-07-18 06:17:03 +00:00
cp 60
jr c, .asm_d7fea
2014-05-18 18:19:10 +00:00
ld hl, CeruleanCityText_19779
call PrintText
jr .asm_f2f38
.asm_d7fea
2014-05-18 18:19:10 +00:00
ld hl, CeruleanCityText_1977e
call PrintText
.asm_f2f38
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
2016-06-12 00:24:04 +00:00
CeruleanCityText_1976f:
text_far _CeruleanCityText_1976f
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText_19774:
text_far _CeruleanCityText_19774
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText_19779:
text_far _CeruleanCityText_19779
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText_1977e:
text_far _CeruleanCityText_1977e
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText9:
text_far _CeruleanCityText9
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText10:
text_far _CeruleanCityText10
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText12:
text_far _CeruleanCityText12
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText13:
text_far _CeruleanCityText13
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText16:
text_far _CeruleanCityText16
text_end
2014-05-18 18:19:10 +00:00
2016-06-12 00:24:04 +00:00
CeruleanCityText17:
text_far _CeruleanCityText17
text_end