keen: fix up mars startup code

properly fade out when enter level, preserve mars co-ords
This commit is contained in:
Vince Weaver 2024-04-14 19:16:14 -04:00
parent 26fb4f3c6a
commit f43edf23ea
2 changed files with 53 additions and 28 deletions

View File

@ -55,17 +55,6 @@ plenty_of_keens:
not_game_over:
; TODO: set this in title, don't over-write
lda #10
sta MARS_TILEX
lda #34
sta MARS_TILEY
lda #0
sta MARS_X
sta MARS_Y
;====================================
; load mars tilemap
;====================================
@ -82,28 +71,18 @@ not_game_over:
; copy in tilemap subset
;====================================
; first center map around current location
jsr recenter_map
; copy mini tileset
jsr copy_tilemap_subset
; make a copy in $c00 for fade-in purposes
lda DRAW_PAGE ; necssary
pha
; snapshot current tileset for fade purposes
lda #8
sta DRAW_PAGE
jsr draw_tilemap
pla
sta DRAW_PAGE
lda #1
sta INITIAL_SOUND
jsr snapshot_tilemap
jsr fade_in
@ -195,6 +174,8 @@ done_with_keen:
ldy #SFX_WLDENTRSND
jsr play_sfx
jsr snapshot_tilemap
jsr fade_out
; set up proper level to load
@ -387,6 +368,37 @@ done_parts:
rts
;===============================
;===============================
; snapshot tile map
;===============================
;===============================
; copy currnet tilemap graphics
; to $c00 for fade-in/fade-out
snapshot_tilemap:
; make a copy in $c00 for fade-in purposes
lda DRAW_PAGE ; necssary
pha
lda #8
sta DRAW_PAGE
jsr draw_tilemap
pla
sta DRAW_PAGE
lda #1
sta INITIAL_SOUND
rts
;====================================
;====================================
; Mars action (enter pressed on map)
@ -545,6 +557,9 @@ transport_right:
lda #3
sta MARS_TILEY
ldy #SFX_TELEPORTSND
jsr play_sfx
jsr recenter_map ; fallthrough?
jsr copy_tilemap_subset
@ -565,6 +580,9 @@ transport_left:
lda #4
sta MARS_TILEY
ldy #SFX_TELEPORTSND
jsr play_sfx
jsr recenter_map ; fallthrough?
jsr copy_tilemap_subset
@ -586,6 +604,9 @@ transport_secret:
lda #24
sta MARS_TILEY
ldy #SFX_TELEPORTSND
jsr play_sfx
jsr recenter_map ; fallthrough?
jsr copy_tilemap_subset

View File

@ -203,13 +203,17 @@ init_vars:
;============================
; set up initial location
lda #18
lda #10
sta MARS_TILEX
lda #34
sta MARS_TILEY
lda #0
sta MARS_X
lda #11
sta MARS_Y
lda #LOAD_MARS
sta WHICH_LOAD ; start at first level
sta WHICH_LOAD ; assume new game (mars map)
rts