peasant: trogdor: move to the new page1 background code

This commit is contained in:
Vince Weaver 2021-12-28 18:25:25 -05:00
parent 07af48da44
commit bedb385b31
5 changed files with 122 additions and 79 deletions

View File

@ -69,25 +69,7 @@ new_location:
sta INH
jsr load_custom_verb_table
;=====================
; load bg
lda MAP_LOCATION
sec
sbc #LOCATION_BASE
tax
lda map_backgrounds_low,X
sta getsrc_smc+1
lda map_backgrounds_hi,X
sta getsrc_smc+2
lda #$40
jsr decompress_lzsa2_fast
;===============================
; load priority to $400
; indirectly as we can't trash screen holes
@ -109,6 +91,27 @@ new_location:
jsr gr_copy_to_page1
;=====================
; load bg
lda MAP_LOCATION
sec
sbc #LOCATION_BASE
tax
lda map_backgrounds_low,X
sta getsrc_smc+1
lda map_backgrounds_hi,X
sta getsrc_smc+2
lda #$20
jsr decompress_lzsa2_fast
jsr hgr_copy
;===================
; put peasant text
lda #<peasant_text
@ -122,35 +125,34 @@ new_location:
jsr print_score
;=====================
; move peasant
; lda #20
; sta PEASANT_X
; lda #150
; sta PEASANT_Y
;====================
; save background
lda PEASANT_X
sta CURSOR_X
lda PEASANT_Y
sta CURSOR_Y
;=======================
; draw initial peasant
jsr save_bg_1x28
jsr draw_peasant
;===========================
;===========================
;===========================
; main loop
;===========================
;===========================
;===========================
game_loop:
;===================
; move peasant
jsr move_peasant
;=====================
; always draw peasant
jsr draw_peasant
;=====================
; increment frame
inc FRAME
;======================
; check keyboard
jsr check_keyboard
lda LEVEL_OVER
@ -235,6 +237,7 @@ level_over:
.include "move_peasant.s"
.include "gr_copy.s"
.include "hgr_copy.s"
.include "new_map_location.s"

View File

@ -1,8 +1,8 @@
;============================
; draw peasant
; draw peasant (tiny)
;============================
draw_peasant:
draw_peasant_tiny:
lda PEASANT_X
sta CURSOR_X
lda PEASANT_Y

View File

@ -1,3 +1,4 @@
.if 0
;======================
; save bg 1x5
;======================
@ -78,3 +79,5 @@ save_sprite_1x5:
;.byte $00
;xsave:
;.byte $00
.endif

View File

@ -1,4 +1,4 @@
; Move that Peasant!
; Move that Peasant (tiny)!
move_peasant_tiny:
@ -6,21 +6,27 @@ move_peasant_tiny:
lda PEASANT_XADD
ora PEASANT_YADD
bne really_move_peasant
bne really_move_peasant_tiny
jmp peasant_the_same
jmp peasant_the_same_tiny
really_move_peasant:
really_move_peasant_tiny:
; restore bg behind peasant
lda PEASANT_X
sta CURSOR_X
lda PEASANT_Y
sta CURSOR_Y
sta SAVED_Y1
clc
adc #5
sta SAVED_Y2
jsr restore_bg_1x5
ldx PEASANT_X
txa
inx
jsr hgr_partial_restore
; jsr restore_bg_1x5
; move peasant
@ -104,23 +110,23 @@ done_movey:
; if we moved off screen, don't re-draw peasant
lda LEVEL_OVER
bne peasant_the_same
bne peasant_the_same_tiny
; save behind new position
lda PEASANT_X
sta CURSOR_X
; lda PEASANT_X
; sta CURSOR_X
lda PEASANT_Y
sta CURSOR_Y
; lda PEASANT_Y
; sta CURSOR_Y
jsr save_bg_1x5
; jsr save_bg_1x5
; draw peasant
jsr draw_peasant
; jsr draw_peasant
peasant_the_same:
peasant_the_same_tiny:
rts

View File

@ -67,23 +67,8 @@ new_location:
sta INH
jsr load_custom_verb_table
;=====================
; load bg
lda MAP_LOCATION
sec
sbc #LOCATION_BASE
tax
lda map_backgrounds_low,X
sta getsrc_smc+1
lda map_backgrounds_hi,X
sta getsrc_smc+2
lda #$40
jsr decompress_lzsa2_fast
;========================
; load priority to $400
; indirectly as we can't trash screen holes
@ -105,6 +90,27 @@ new_location:
jsr gr_copy_to_page1
;=====================
; load bg
lda MAP_LOCATION
sec
sbc #LOCATION_BASE
tax
lda map_backgrounds_low,X
sta getsrc_smc+1
lda map_backgrounds_hi,X
sta getsrc_smc+2
lda #$20
jsr decompress_lzsa2_fast
jsr hgr_copy
;=====================
; update name/score
jsr update_top
@ -120,9 +126,9 @@ new_location:
;=======================
; draw initial peasant
jsr save_bg_1x5
; jsr save_bg_1x5
jsr draw_peasant
jsr draw_peasant_tiny
;===========================
@ -132,11 +138,35 @@ new_location:
ldy #>trogdor_entry_message
jsr finish_parse_message
;==========================
;==========================
;==========================
; main loop
;==========================
;==========================
;==========================
game_loop:
;===================
; move peasant
jsr move_peasant_tiny
;===================
; always draw peasant
jsr draw_peasant_tiny
;====================
; increment frame
inc FRAME
;====================
; check keyboard
jsr check_keyboard
lda LEVEL_OVER
@ -269,9 +299,10 @@ draw_sprite_h:
.include "move_peasant_tiny.s"
.include "draw_peasant_tiny.s"
.include "hgr_1x5_save_bg.s"
;.include "hgr_1x5_save_bg.s"
.include "gr_copy.s"
.include "hgr_copy.s"
.include "keyboard.s"
.include "wait.s"