pokered/scripts/CeruleanCity.asm

461 lines
10 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
2023-11-19 00:44:03 +00:00
CeruleanCityClearScripts:
xor a ; SCRIPT_CERULEANCITY_DEFAULT
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:
def_script_pointers
dw_const CeruleanCityDefaultScript, SCRIPT_CERULEANCITY_DEFAULT
dw_const CeruleanCityRivalBattleScript, SCRIPT_CERULEANCITY_RIVAL_BATTLE
dw_const CeruleanCityRivalDefeatedScript, SCRIPT_CERULEANCITY_RIVAL_DEFEATED
dw_const CeruleanCityRivalCleanupScript, SCRIPT_CERULEANCITY_RIVAL_CLEANUP
dw_const CeruleanCityRocketDefeatedScript, SCRIPT_CERULEANCITY_ROCKET_DEFEATED
CeruleanCityRocketDefeatedScript:
2015-08-31 02:38:41 +00:00
ld a, [wIsInBattle]
2014-05-18 18:19:10 +00:00
cp $ff
2023-11-19 00:44:03 +00:00
jp z, CeruleanCityClearScripts
ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN
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
ld a, TEXT_CERULEANCITY_ROCKET
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
call DisplayTextID
xor a ; SCRIPT_CERULEANCITY_DEFAULT
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
CeruleanCityDefaultScript:
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
2021-05-31 15:41:36 +00:00
jr nz, .skipRocketThiefEncounter
2014-05-18 18:19:10 +00:00
ld hl, CeruleanCityCoords1
call ArePlayerCoordsInArray
2021-05-31 15:41:36 +00:00
jr nc, .skipRocketThiefEncounter
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
2021-05-31 15:41:36 +00:00
jr nz, .playerBelowRocketThief
2015-07-20 00:52:26 +00:00
ld a, PLAYER_DIR_DOWN
ld b, SPRITE_FACING_UP
2021-05-31 15:41:36 +00:00
.playerBelowRocketThief
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, TEXT_CERULEANCITY_ROCKET
ldh [hSpriteIndexOrTextID], a
2014-05-18 18:19:10 +00:00
jp DisplayTextID
2021-05-31 15:41:36 +00:00
.skipRocketThiefEncounter
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
2021-05-31 15:41:36 +00:00
jr z, .walking
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
2021-05-31 15:41:36 +00:00
.walking
2014-05-18 18:19:10 +00:00
ld c, BANK(Music_MeetRival)
ld a, MUSIC_MEET_RIVAL
call PlayMusic
xor a
ldh [hJoyHeld], a
ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
2015-08-31 02:38:41 +00:00
ld a, [wXCoord]
2021-05-31 20:00:32 +00:00
cp 20 ; is the player standing on the right side of the bridge?
2021-05-31 15:41:36 +00:00
jr z, .playerOnRightSideOfBridge
ld a, CERULEANCITY_RIVAL
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
2021-05-31 15:41:36 +00:00
.playerOnRightSideOfBridge
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, CERULEANCITY_RIVAL
ldh [hSpriteIndex], a
2014-05-18 18:19:10 +00:00
call MoveSprite
ld a, SCRIPT_CERULEANCITY_RIVAL_BATTLE
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
2023-11-19 00:44:03 +00:00
CeruleanCityFaceRivalScript:
ld a, CERULEANCITY_RIVAL
ldh [hSpriteIndex], a
xor a ; SPRITE_FACING_DOWN
ldh [hSpriteFacingDirection], a
jp SetSpriteFacingDirectionAndDelay ; face object
2014-05-18 18:19:10 +00:00
CeruleanCityRivalBattleScript:
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
ld a, TEXT_CERULEANCITY_RIVAL
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, CeruleanCityRivalDefeatedText
ld de, CeruleanCityRivalVictoryText
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
2023-11-19 00:44:03 +00:00
call CeruleanCityFaceRivalScript
ld a, SCRIPT_CERULEANCITY_RIVAL_DEFEATED
2015-08-31 02:38:41 +00:00
ld [wCeruleanCityCurScript], a
2014-05-18 18:19:10 +00:00
ret
CeruleanCityRivalDefeatedScript:
2015-08-31 02:38:41 +00:00
ld a, [wIsInBattle]
2014-05-18 18:19:10 +00:00
cp $ff
2023-11-19 00:44:03 +00:00
jp z, CeruleanCityClearScripts
call CeruleanCityFaceRivalScript
ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
2015-07-21 17:36:03 +00:00
SetEvent EVENT_BEAT_CERULEAN_RIVAL
ld a, TEXT_CERULEANCITY_RIVAL
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
ld a, CERULEANCITY_RIVAL
ldh [hSpriteIndex], a
2014-05-18 18:19:10 +00:00
call SetSpriteMovementBytesToFF
2015-08-31 02:38:41 +00:00
ld a, [wXCoord]
2021-05-31 20:00:32 +00:00
cp 20 ; is the player standing on the right side of the bridge?
2021-05-31 15:41:36 +00:00
jr nz, .playerOnRightSideOfBridge
2014-05-18 18:19:10 +00:00
ld de, CeruleanCityMovement4
2021-05-31 15:41:36 +00:00
jr .skip
.playerOnRightSideOfBridge
2014-05-18 18:19:10 +00:00
ld de, CeruleanCityMovement3
2021-05-31 15:41:36 +00:00
.skip
ld a, CERULEANCITY_RIVAL
ldh [hSpriteIndex], a
2014-05-18 18:19:10 +00:00
call MoveSprite
ld a, SCRIPT_CERULEANCITY_RIVAL_CLEANUP
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
CeruleanCityRivalCleanupScript:
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
ld a, SCRIPT_CERULEANCITY_DEFAULT
2015-08-31 02:38:41 +00:00
ld [wCeruleanCityCurScript], a
2014-05-18 18:19:10 +00:00
ret
CeruleanCity_TextPointers:
def_text_pointers
dw_const CeruleanCityRivalText, TEXT_CERULEANCITY_RIVAL
dw_const CeruleanCityRocketText, TEXT_CERULEANCITY_ROCKET
dw_const CeruleanCityCooltrainerMText, TEXT_CERULEANCITY_COOLTRAINER_M
dw_const CeruleanCitySuperNerd1Text, TEXT_CERULEANCITY_SUPER_NERD1
dw_const CeruleanCitySuperNerd2Text, TEXT_CERULEANCITY_SUPER_NERD2
dw_const CeruleanCityGuardText, TEXT_CERULEANCITY_GUARD1
dw_const CeruleanCityCooltrainerF1Text, TEXT_CERULEANCITY_COOLTRAINER_F1
dw_const CeruleanCitySlowbroText, TEXT_CERULEANCITY_SLOWBRO
dw_const CeruleanCityCooltrainerF2Text, TEXT_CERULEANCITY_COOLTRAINER_F2
dw_const CeruleanCitySuperNerd3Text, TEXT_CERULEANCITY_SUPER_NERD3
dw_const CeruleanCityGuardText, TEXT_CERULEANCITY_GUARD2
dw_const CeruleanCitySignText, TEXT_CERULEANCITY_SIGN
dw_const CeruleanCityTrainerTipsText, TEXT_CERULEANCITY_TRAINER_TIPS
dw_const MartSignText, TEXT_CERULEANCITY_MART_SIGN
dw_const PokeCenterSignText, TEXT_CERULEANCITY_POKECENTER_SIGN
dw_const CeruleanCityBikeShopSign, TEXT_CERULEANCITY_BIKESHOP_SIGN
dw_const CeruleanCityGymSign, TEXT_CERULEANCITY_GYM_SIGN
CeruleanCityRivalText:
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, .PreBattle
2014-05-18 18:19:10 +00:00
; or talk about bill
ld hl, CeruleanCityRivalIWentToBillsText
2014-05-18 18:19:10 +00:00
call PrintText
jr .end
.PreBattle
ld hl, .PreBattleText
2014-05-18 18:19:10 +00:00
call PrintText
.end
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
.PreBattleText:
text_far _CeruleanCityRivalPreBattleText
text_end
2014-05-18 18:19:10 +00:00
CeruleanCityRivalDefeatedText:
text_far _CeruleanCityRivalDefeatedText
text_end
2014-05-18 18:19:10 +00:00
CeruleanCityRivalVictoryText:
text_far _CeruleanCityRivalVictoryText
text_end
2014-05-18 18:19:10 +00:00
CeruleanCityRivalIWentToBillsText:
text_far _CeruleanCityRivalIWentToBillsText
text_end
2014-05-18 18:19:10 +00:00
CeruleanCityRocketText:
text_asm
2015-07-21 17:36:03 +00:00
CheckEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF
2021-05-31 15:41:36 +00:00
jr nz, .beatRocketThief
ld hl, .Text
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, .IGiveUpText
ld de, .IGiveUpText
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, SCRIPT_CERULEANCITY_ROCKET_DEFEATED
2015-08-31 02:38:41 +00:00
ld [wCeruleanCityCurScript], a
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
2021-05-31 15:41:36 +00:00
.beatRocketThief
ld hl, .IllReturnTheTMText
2014-05-18 18:19:10 +00:00
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
2014-05-18 18:19:10 +00:00
call PrintText
jr .Done
.Success
ld a, $1
2014-09-13 07:50:56 +00:00
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ld hl, .ReceivedTM28Text
2014-05-18 18:19:10 +00:00
call PrintText
farcall CeruleanHideRocket
2014-05-18 18:19:10 +00:00
.Done
jp TextScriptEnd
.Text:
text_far _CeruleanCityRocketText
text_end
2014-05-18 18:19:10 +00:00
.ReceivedTM28Text:
text_far _CeruleanCityRocketReceivedTM28Text
sound_get_item_1
text_far _CeruleanCityRocketIBetterGetMovingText
text_waitbutton
text_end
2014-05-18 18:19:10 +00:00
.TM28NoRoomText:
text_far _CeruleanCityRocketTM28NoRoomText
text_end
2014-05-18 18:19:10 +00:00
.IGiveUpText:
text_far _CeruleanCityRocketIGiveUpText
text_end
2014-05-18 18:19:10 +00:00
.IllReturnTheTMText:
text_far _CeruleanCityRocketIllReturnTheTMText
text_end
2014-05-18 18:19:10 +00:00
CeruleanCityCooltrainerMText:
text_far _CeruleanCityCooltrainerMText
text_end
2014-05-18 18:19:10 +00:00
CeruleanCitySuperNerd1Text:
text_far _CeruleanCitySuperNerd1Text
text_end
2014-05-18 18:19:10 +00:00
CeruleanCitySuperNerd2Text:
text_far _CeruleanCitySuperNerd2Text
text_end
2014-05-18 18:19:10 +00:00
CeruleanCityGuardText:
text_far _CeruleanCityGuardText
text_end
2014-05-18 18:19:10 +00:00
CeruleanCityCooltrainerF1Text:
text_asm
ldh a, [hRandomAdd]
2021-05-31 20:00:32 +00:00
cp 180 ; 76/256 chance of 1st dialogue
2021-05-31 15:41:36 +00:00
jr c, .notFirstText
ld hl, .SlowbroUseSonicboomText
2014-05-18 18:19:10 +00:00
call PrintText
2021-05-31 15:41:36 +00:00
jr .end
.notFirstText
2021-05-31 20:00:32 +00:00
cp 100 ; 80/256 chance of 2nd dialogue
2021-05-31 15:41:36 +00:00
jr c, .notSecondText
ld hl, .SlowbroPunchText
2014-05-18 18:19:10 +00:00
call PrintText
2021-05-31 15:41:36 +00:00
jr .end
.notSecondText
2021-05-31 20:00:32 +00:00
; 100/256 chance of 3rd dialogue
ld hl, .SlowbroWithdrawText
2014-05-18 18:19:10 +00:00
call PrintText
2021-05-31 15:41:36 +00:00
.end
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
.SlowbroUseSonicboomText:
text_far _CeruleanCityCooltrainerF1SlowbroUseSonicboomText
text_end
2014-05-18 18:19:10 +00:00
.SlowbroPunchText:
text_far _CeruleanCityCooltrainerF1SlowbroPunchText
text_end
2014-05-18 18:19:10 +00:00
.SlowbroWithdrawText:
text_far _CeruleanCityCooltrainerF1SlowbroWithdrawText
text_end
2014-05-18 18:19:10 +00:00
CeruleanCitySlowbroText:
text_asm
ldh a, [hRandomAdd]
2021-05-31 20:00:32 +00:00
cp 180 ; 76/256 chance of 1st dialogue
2021-05-31 15:41:36 +00:00
jr c, .notFirstText
ld hl, .TookASnoozeText
2014-05-18 18:19:10 +00:00
call PrintText
2021-05-31 15:41:36 +00:00
jr .end
.notFirstText
2021-05-31 20:00:32 +00:00
cp 120 ; 60/256 chance of 2nd dialogue
2021-05-31 15:41:36 +00:00
jr c, .notSecondText
ld hl, .IsLoafingAroundText
2014-05-18 18:19:10 +00:00
call PrintText
2021-05-31 15:41:36 +00:00
jr .end
.notSecondText
2021-05-31 20:00:32 +00:00
cp 60 ; 60/256 chance of 3rd dialogue
2021-05-31 15:41:36 +00:00
jr c, .notThirdText
ld hl, .TurnedAwayText
2014-05-18 18:19:10 +00:00
call PrintText
2021-05-31 15:41:36 +00:00
jr .end
.notThirdText
2021-05-31 20:00:32 +00:00
; 60/256 chance of 4th dialogue
ld hl, .IgnoredOrdersText
2014-05-18 18:19:10 +00:00
call PrintText
2021-05-31 15:41:36 +00:00
.end
2014-05-18 18:19:10 +00:00
jp TextScriptEnd
.TookASnoozeText:
text_far _CeruleanCitySlowbroTookASnoozeText
text_end
2014-05-18 18:19:10 +00:00
.IsLoafingAroundText:
text_far _CeruleanCitySlowbroIsLoafingAroundText
text_end
2014-05-18 18:19:10 +00:00
.TurnedAwayText:
text_far _CeruleanCitySlowbroTurnedAwayText
text_end
2014-05-18 18:19:10 +00:00
.IgnoredOrdersText:
text_far _CeruleanCitySlowbroIgnoredOrdersText
text_end
2014-05-18 18:19:10 +00:00
CeruleanCityCooltrainerF2Text:
text_far _CeruleanCityCooltrainerF2Text
text_end
2014-05-18 18:19:10 +00:00
CeruleanCitySuperNerd3Text:
text_far _CeruleanCitySuperNerd3Text
text_end
2014-05-18 18:19:10 +00:00
CeruleanCitySignText:
text_far _CeruleanCitySignText
text_end
2014-05-18 18:19:10 +00:00
CeruleanCityTrainerTipsText:
text_far _CeruleanCityTrainerTipsText
text_end
2014-05-18 18:19:10 +00:00
CeruleanCityBikeShopSign:
text_far _CeruleanCityBikeShopSign
text_end
2014-05-18 18:19:10 +00:00
CeruleanCityGymSign:
text_far _CeruleanCityGymSign
text_end