diff --git a/games/peasant/Makefile b/games/peasant/Makefile index a05026dd..347fe48a 100644 --- a/games/peasant/Makefile +++ b/games/peasant/Makefile @@ -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 diff --git a/games/peasant/graphics/lady_cottage.png b/games/peasant/graphics/lady_cottage.png index 3294865d..ae0c525d 100644 Binary files a/games/peasant/graphics/lady_cottage.png and b/games/peasant/graphics/lady_cottage.png differ diff --git a/games/peasant/graphics/lady_cottage_priority.png b/games/peasant/graphics/lady_cottage_priority.png index 2660974e..808d4f12 100644 Binary files a/games/peasant/graphics/lady_cottage_priority.png and b/games/peasant/graphics/lady_cottage_priority.png differ diff --git a/games/peasant/hgr_7x28_sprite_mask.s b/games/peasant/hgr_7x28_sprite_mask.s index 26fcc491..a2b9c507 100644 --- a/games/peasant/hgr_7x28_sprite_mask.s +++ b/games/peasant/hgr_7x28_sprite_mask.s @@ -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 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;==================== diff --git a/games/peasant/peasant1.s b/games/peasant/peasant1.s index 405e80fd..754c7944 100644 --- a/games/peasant/peasant1.s +++ b/games/peasant/peasant1.s @@ -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" diff --git a/games/peasant/peasant_move.s b/games/peasant/peasant_move.s index 855adc6f..24145e97 100644 --- a/games/peasant/peasant_move.s +++ b/games/peasant/peasant_move.s @@ -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 diff --git a/games/peasant/version.inc b/games/peasant/version.inc index 7b802ee7..785a565e 100644 --- a/games/peasant/version.inc +++ b/games/peasant/version.inc @@ -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 diff --git a/games/peasant/zp.inc b/games/peasant/zp.inc index 4632b86d..6f6e402e 100644 --- a/games/peasant/zp.inc +++ b/games/peasant/zp.inc @@ -15,6 +15,7 @@ BASL = $28 BASH = $29 MASK = $2E MASK_COUNTDOWN = $2F +PEASANT_PRIORITY = $30 PEASANT_X = $60 PEASANT_Y = $61