peasant: going behind things seems to work

This commit is contained in:
Vince Weaver 2021-08-24 23:48:31 -04:00
parent 8e3b60e1bb
commit 768957fa33
8 changed files with 74 additions and 19 deletions

View File

@ -91,8 +91,9 @@ PEASANT1: peasant1.o
peasant1.o: peasant1.s zp.inc \
graphics/graphics_peasant1.inc sprites/peasant_sprite.inc \
graphics/priority_peasant1.inc \
draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \
hgr_7x28_sprite.s hgr_1x5_sprite.s hgr_save_restore.s \
hgr_7x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s parse_input.s new_map_location.s \
peasant_move.s
@ -105,6 +106,7 @@ PEASANT2: peasant2.o
peasant2.o: peasant2.s zp.inc \
graphics/graphics_peasant2.inc sprites/peasant_sprite.inc \
graphics/priority_peasant2.inc \
draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \
hgr_7x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
@ -120,8 +122,9 @@ PEASANT3: peasant3.o
peasant3.o: peasant3.s zp.inc \
graphics/graphics_peasant3.inc sprites/peasant_sprite.inc \
graphics/priority_peasant3.inc \
draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \
hgr_7x28_sprite.s hgr_1x5_sprite.s hgr_save_restore.s \
hgr_7x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s parse_input.s new_map_location.s \
peasant_move.s
@ -134,8 +137,9 @@ PEASANT4: peasant4.o
peasant4.o: peasant4.s zp.inc \
graphics/graphics_peasant4.inc sprites/peasant_sprite.inc \
graphics/priority_peasant4.inc \
draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \
hgr_7x28_sprite.s hgr_1x5_sprite.s hgr_save_restore.s \
hgr_7x28_sprite_mask.s hgr_1x5_sprite.s hgr_save_restore.s \
wait_a_bit.s draw_peasant.s hgr_text_box.s \
keyboard.s parse_input.s new_map_location.s \
peasant_move.s

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -169,6 +169,20 @@ restore_yloop:
; updates MASK
update_bg_mask:
; calculate peasant priority
; based on head
; FIXME: only do this once at beginning
lda PEASANT_Y
sec
sbc #48 ; Y=48
lsr ; div by 8
lsr
lsr
clc
adc #2
sta PEASANT_PRIORITY
; rrrr rtii top 5 bits row, bit 2 top/bottom
txa
@ -198,15 +212,24 @@ bg_mask_mask:
sta BASH
lda (BASL),Y
and MASK
cmp #$30
beq mask_false ; true if color 3
ldy MASK
cpy #$f0
bne mask_bottom
mask_top:
lsr
lsr
lsr
lsr
jmp mask_mask_mask
mask_bottom:
and #$0f
mask_mask_mask:
sta MASK
cmp #$03
beq mask_false
;bne mask_false
cmp PEASANT_PRIORITY
beq mask_false ; branch less than equal
bcc mask_false ; blt
mask_true:
lda #$ff
@ -219,13 +242,25 @@ mask_false:
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rts
; priorities
; 0 = collision
; 1 = bg = always draw ; Y-48
; 2 0-55
; 3 56-63 ; 8/8+2 = 3
; 4 64-71 ; 16/8+2 = 4
; 5 72-79
; 6 80-87 ; 32/8+2 = 6
; 7 88-95
; 8 96-103
; 9 104-111
; 10 112-119
; 11 120-127
; 12 128-135 ; 8
; 13 136-143
; 14 144-151
; 15 152-159
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;====================

View File

@ -167,7 +167,7 @@ score_text:
.include "hgr_font.s"
.include "draw_box.s"
.include "hgr_rectangle.s"
.include "hgr_7x28_sprite.s"
.include "hgr_7x28_sprite_mask.s"
.include "hgr_1x5_sprite.s"
;.include "hgr_save_restore.s"
.include "hgr_partial_save.s"

View File

@ -203,8 +203,23 @@ peasant_collide_mask:
lda gr_offsets+1,X
sta INH
lda (INL),Y
lda (INL),Y ; get value
and MASK
; ldy MASK
; cpy #$f0
; beq in_top
;in_bottom:
; and #$0f
; jmp done_feet
;in_top:
; lsr
; lsr
; lsr
; lsr
;done_feet:
beq collide_true ; true if color 0
;bne collide_false

View File

@ -1,4 +1,4 @@
version_message:
.byte 0,43,24, 0,253,82
.byte 8,41,"APPLE ][ PEASANT'S QUEST",13
.byte "version 0.4",0
.byte "version 0.5",0

View File

@ -15,6 +15,7 @@ BASL = $28
BASH = $29
MASK = $2E
MASK_COUNTDOWN = $2F
PEASANT_PRIORITY = $30
PEASANT_X = $60
PEASANT_Y = $61