Merge pull request #325 from CelestialAmber/master

Partially document CeruleanCity.asm
This commit is contained in:
Daniel Harding 2021-05-31 15:43:57 -05:00 committed by GitHub
commit f3dbec09a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,18 +40,18 @@ IF DEF(_DEBUG)
ret nz ret nz
ENDC ENDC
CheckEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF CheckEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF
jr nz, .asm_194f7 jr nz, .skipRocketThiefEncounter
ld hl, CeruleanCityCoords1 ld hl, CeruleanCityCoords1
call ArePlayerCoordsInArray call ArePlayerCoordsInArray
jr nc, .asm_194f7 jr nc, .skipRocketThiefEncounter
ld a, [wCoordIndex] ld a, [wCoordIndex]
cp $1 cp $1
ld a, PLAYER_DIR_UP ld a, PLAYER_DIR_UP
ld b, SPRITE_FACING_DOWN ld b, SPRITE_FACING_DOWN
jr nz, .asm_194e6 jr nz, .playerBelowRocketThief
ld a, PLAYER_DIR_DOWN ld a, PLAYER_DIR_DOWN
ld b, SPRITE_FACING_UP ld b, SPRITE_FACING_UP
.asm_194e6 .playerBelowRocketThief
ld [wPlayerMovingDirection], a ld [wPlayerMovingDirection], a
ld a, b ld a, b
ld [wSprite02StateData1FacingDirection], a ld [wSprite02StateData1FacingDirection], a
@ -59,7 +59,7 @@ ENDC
ld a, $2 ld a, $2
ldh [hSpriteIndexOrTextID], a ldh [hSpriteIndexOrTextID], a
jp DisplayTextID jp DisplayTextID
.asm_194f7 .skipRocketThiefEncounter
CheckEvent EVENT_BEAT_CERULEAN_RIVAL CheckEvent EVENT_BEAT_CERULEAN_RIVAL
ret nz ret nz
ld hl, CeruleanCityCoords2 ld hl, CeruleanCityCoords2
@ -67,11 +67,11 @@ ENDC
ret nc ret nc
ld a, [wWalkBikeSurfState] ld a, [wWalkBikeSurfState]
and a and a
jr z, .asm_19512 jr z, .walking
ld a, SFX_STOP_ALL_MUSIC ld a, SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a ld [wNewSoundID], a
call PlaySound call PlaySound
.asm_19512 .walking
ld c, BANK(Music_MeetRival) ld c, BANK(Music_MeetRival)
ld a, MUSIC_MEET_RIVAL ld a, MUSIC_MEET_RIVAL
call PlayMusic call PlayMusic
@ -80,15 +80,15 @@ ENDC
ld a, $f0 ld a, $f0
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld a, [wXCoord] ld a, [wXCoord]
cp 20 cp 20 ; is the player standing on the right side of the bridge?
jr z, .asm_19535 jr z, .playerOnRightSideOfBridge
ld a, $1 ld a, $1
ldh [hSpriteIndex], a ldh [hSpriteIndex], a
ld a, SPRITESTATEDATA2_MAPX ld a, SPRITESTATEDATA2_MAPX
ldh [hSpriteDataOffset], a ldh [hSpriteDataOffset], a
call GetPointerWithinSpriteStateData2 call GetPointerWithinSpriteStateData2
ld [hl], 25 ld [hl], 25
.asm_19535 .playerOnRightSideOfBridge
ld a, HS_CERULEAN_RIVAL ld a, HS_CERULEAN_RIVAL
ld [wMissableObjectIndex], a ld [wMissableObjectIndex], a
predef ShowObject predef ShowObject
@ -183,13 +183,13 @@ CeruleanCityScript2:
ldh [hSpriteIndex], a ldh [hSpriteIndex], a
call SetSpriteMovementBytesToFF call SetSpriteMovementBytesToFF
ld a, [wXCoord] ld a, [wXCoord]
cp 20 cp 20 ; is the player standing on the right side of the bridge?
jr nz, .asm_195f0 jr nz, .playerOnRightSideOfBridge
ld de, CeruleanCityMovement4 ld de, CeruleanCityMovement4
jr .asm_195f3 jr .skip
.asm_195f0 .playerOnRightSideOfBridge
ld de, CeruleanCityMovement3 ld de, CeruleanCityMovement3
.asm_195f3 .skip
ld a, $1 ld a, $1
ldh [hSpriteIndex], a ldh [hSpriteIndex], a
call MoveSprite call MoveSprite
@ -284,7 +284,7 @@ CeruleanCityText_19677:
CeruleanCityText2: CeruleanCityText2:
text_asm text_asm
CheckEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF CheckEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF
jr nz, .asm_4ca20 jr nz, .beatRocketThief
ld hl, CeruleanCityText_196d9 ld hl, CeruleanCityText_196d9
call PrintText call PrintText
ld hl, wd72d ld hl, wd72d
@ -300,7 +300,7 @@ CeruleanCityText2:
ld a, $4 ld a, $4
ld [wCeruleanCityCurScript], a ld [wCeruleanCityCurScript], a
jp TextScriptEnd jp TextScriptEnd
.asm_4ca20 .beatRocketThief
ld hl, CeruleanCityText_196f3 ld hl, CeruleanCityText_196f3
call PrintText call PrintText
lb bc, TM_DIG, 1 lb bc, TM_DIG, 1
@ -361,21 +361,22 @@ CeruleanCityText6:
CeruleanCityText7: CeruleanCityText7:
text_asm text_asm
ldh a, [hRandomAdd] ldh a, [hRandomAdd]
cp 180 cp 180 ; 76/256 chance of 1st dialogue
jr c, .asm_e9fc9 jr c, .notFirstText
ld hl, CeruleanCityText_19730 ld hl, CeruleanCityText_19730
call PrintText call PrintText
jr .asm_d486e jr .end
.asm_e9fc9 .notFirstText
cp 100 cp 100 ; 80/256 chance of 2nd dialogue
jr c, .asm_df99b jr c, .notSecondText
ld hl, CeruleanCityText_19735 ld hl, CeruleanCityText_19735
call PrintText call PrintText
jr .asm_d486e jr .end
.asm_df99b .notSecondText
; 100/256 chance of 3rd dialogue
ld hl, CeruleanCityText_1973a ld hl, CeruleanCityText_1973a
call PrintText call PrintText
.asm_d486e .end
jp TextScriptEnd jp TextScriptEnd
CeruleanCityText_19730: CeruleanCityText_19730:
@ -393,27 +394,28 @@ CeruleanCityText_1973a:
CeruleanCityText8: CeruleanCityText8:
text_asm text_asm
ldh a, [hRandomAdd] ldh a, [hRandomAdd]
cp 180 cp 180 ; 76/256 chance of 1st dialogue
jr c, .asm_e28da jr c, .notFirstText
ld hl, CeruleanCityText_1976f ld hl, CeruleanCityText_1976f
call PrintText call PrintText
jr .asm_f2f38 jr .end
.asm_e28da .notFirstText
cp 120 cp 120 ; 60/256 chance of 2nd dialogue
jr c, .asm_15d08 jr c, .notSecondText
ld hl, CeruleanCityText_19774 ld hl, CeruleanCityText_19774
call PrintText call PrintText
jr .asm_f2f38 jr .end
.asm_15d08 .notSecondText
cp 60 cp 60 ; 60/256 chance of 3rd dialogue
jr c, .asm_d7fea jr c, .notThirdText
ld hl, CeruleanCityText_19779 ld hl, CeruleanCityText_19779
call PrintText call PrintText
jr .asm_f2f38 jr .end
.asm_d7fea .notThirdText
; 60/256 chance of 4th dialogue
ld hl, CeruleanCityText_1977e ld hl, CeruleanCityText_1977e
call PrintText call PrintText
.asm_f2f38 .end
jp TextScriptEnd jp TextScriptEnd
CeruleanCityText_1976f: CeruleanCityText_1976f: