diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-03-08 16:46:46 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-03-08 22:14:15 +0100 |
| commit | feed0b705daff0001253b6ec89b61c9821d2fe21 (patch) | |
| tree | 0e206a2c47c2c65d00cca73d6b3e4cca9357eafc | |
| parent | 276515a1338feb72e38825dd920a23ac525d241b (diff) | |
| download | jetpac.nes-feed0b705daff0001253b6ec89b61c9821d2fe21.tar.gz jetpac.nes-feed0b705daff0001253b6ec89b61c9821d2fe21.zip | |
Skip initialization of first nametable after game over
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
| -rw-r--r-- | src/jetpac.s | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/jetpac.s b/src/jetpac.s index 4802e74..25fdf5a 100644 --- a/src/jetpac.s +++ b/src/jetpac.s @@ -142,8 +142,13 @@ sta Globals::zp_level_kind .endif - ;; Initialize the assets for the game. + ;; Initialize the assets for the game. If the first sprite is not + ;; initialized to zero, then we are not coming from reset() but from + ;; starting after a "Game over". In this case skip this initialization. + lda OAM::m_address + bne @skip_assets jsr Assets::init +@skip_assets: ;; Initialize some variables from the "Game Over" side of the game. jsr Over::init @@ -242,6 +247,12 @@ ;; Can the player start over? lda Globals::zp_tmp0 beq @main_game_loop + + ;; We will skip the initialization of the assets so to avoid writing into + ;; the first nametable when it's just fine. That being said, we still need + ;; to prepare palettes for the title screen. Do it now before starting over. + jsr Assets::prepare_for_title_screen + jmp @init .endproc |
