diff options
| author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-07-03 13:23:51 -0400 |
|---|---|---|
| committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-07-03 13:23:51 -0400 |
| commit | e882708b85e19cf30e05fcf31ccedc5f03367702 (patch) | |
| tree | 05d84be6cc3b04ccabdc4071f601a9761e845775 /engine/events/hidden_objects/safari_game.asm | |
| parent | Reorganize home header (diff) | |
| download | pokeyellow-e882708b85e19cf30e05fcf31ccedc5f03367702.tar.gz pokeyellow-e882708b85e19cf30e05fcf31ccedc5f03367702.tar.xz pokeyellow-e882708b85e19cf30e05fcf31ccedc5f03367702.zip | |
Split up engine/events/hidden_object_functions
Diffstat (limited to 'engine/events/hidden_objects/safari_game.asm')
| -rw-r--r-- | engine/events/hidden_objects/safari_game.asm | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/engine/events/hidden_objects/safari_game.asm b/engine/events/hidden_objects/safari_game.asm new file mode 100644 index 00000000..785bab7f --- /dev/null +++ b/engine/events/hidden_objects/safari_game.asm @@ -0,0 +1,79 @@ +SafariZoneCheck:: + CheckEventHL EVENT_IN_SAFARI_ZONE ; if we are not in the Safari Zone, + jr z, SafariZoneGameStillGoing ; don't bother printing game over text + ld a, [wNumSafariBalls] + and a + jr z, SafariZoneGameOver + jr SafariZoneGameStillGoing + +SafariZoneCheckSteps:: + ld a, [wSafariSteps] + ld b, a + ld a, [wSafariSteps + 1] + ld c, a + or b + jr z, SafariZoneGameOver + dec bc + ld a, b + ld [wSafariSteps], a + ld a, c + ld [wSafariSteps + 1], a +SafariZoneGameStillGoing: + xor a + ld [wSafariZoneGameOver], a + ret + +SafariZoneGameOver: + call EnableAutoTextBoxDrawing + xor a + ld [wAudioFadeOutControl], a + dec a + call PlaySound + ld c, BANK(SFX_Safari_Zone_PA) + ld a, SFX_SAFARI_ZONE_PA + call PlayMusic +.waitForMusicToPlay + ld a, [wChannelSoundIDs + Ch5] + cp SFX_SAFARI_ZONE_PA + jr nz, .waitForMusicToPlay + ld a, TEXT_SAFARI_GAME_OVER + ld [hSpriteIndexOrTextID], a + call DisplayTextID + xor a + ld [wPlayerMovingDirection], a + ld a, SAFARI_ZONE_GATE + ld [hWarpDestinationMap], a + ld a, $3 + ld [wDestinationWarpID], a + ld a, $5 + ld [wSafariZoneGateCurScript], a + SetEvent EVENT_SAFARI_GAME_OVER + ld a, 1 + ld [wSafariZoneGameOver], a + ret + +PrintSafariGameOverText:: + xor a + ld [wJoyIgnore], a + ld hl, SafariGameOverText + jp PrintText + +SafariGameOverText: + TX_ASM + ld a, [wNumSafariBalls] + and a + jr z, .noMoreSafariBalls + ld hl, TimesUpText + call PrintText +.noMoreSafariBalls + ld hl, GameOverText + call PrintText + jp TextScriptEnd + +TimesUpText: + TX_FAR _TimesUpText + db "@" + +GameOverText: + TX_FAR _GameOverText + db "@" |
