diff --git a/games/peasant/Makefile b/games/peasant/Makefile index 82f50cc8..cebe235b 100644 --- a/games/peasant/Makefile +++ b/games/peasant/Makefile @@ -119,7 +119,6 @@ qload.inc: generate_common QLOAD ./generate_common -a 0xb00 -s hgr2 qload.lst >> qload.inc ./generate_common -a 0xb00 -s hgr_make_tables qload.lst >> qload.inc ./generate_common -a 0xb00 -s hgr_put_string qload.lst >> qload.inc - ./generate_common -a 0xb00 -s save_bg_1x28 qload.lst >> qload.inc ./generate_common -a 0xb00 -s restore_bg_1x28 qload.lst >> qload.inc ./generate_common -a 0xb00 -s hgr_draw_sprite_1x28 qload.lst >> qload.inc ./generate_common -a 0xb00 -s input_buffer qload.lst >> qload.inc diff --git a/games/peasant/hgr_1x28_sprite_mask.s b/games/peasant/hgr_1x28_sprite_mask.s index 35f2b12a..35312f6f 100644 --- a/games/peasant/hgr_1x28_sprite_mask.s +++ b/games/peasant/hgr_1x28_sprite_mask.s @@ -105,12 +105,12 @@ draw_sprite_skip: rts - +.if 0 ;====================== ; save bg 1x28 ;====================== -save_bg_1x28: +bsave_bg_1x28: ldx #0 save_yloop: @@ -142,6 +142,7 @@ save_yloop: bne save_yloop rts +.endif ;====================== ; restore bg 1x28 @@ -149,28 +150,41 @@ save_yloop: restore_bg_1x28: - ldx #0 -restore_yloop: - txa ; current row - clc - adc CURSOR_Y ; add in y start point + ; restore bg behind peasant + ; is this actually faster than using the generic version? + + ldy CURSOR_Y ; y start point + + ldx #27 ; height + +restore_yloop: ; calc GBASL/GBASH using lookup table - tay + clc lda hposn_low,Y - sta GBASL + adc PEASANT_X + sta restore_page1_smc+1 + sta restore_page2_smc+1 + + ; $40 -> $20 0100 0000 -> 0010 0000 + ; $41 -> $21 0100 0001 -> 0010 0001 + ; $51 -> $31 0101 0011 -> 0101 0001 + lda hposn_high,Y - sta GBASH + sta restore_page2_smc+2 + eor #$60 + sta restore_page1_smc+2 - ldy CURSOR_X +restore_page1_smc: + lda $DDDD +restore_page2_smc: + sta $DDDD - lda save_sprite_1x28,X - sta (GBASL),Y + iny - inx - cpx #28 - bne restore_yloop + dex + bpl restore_yloop rts @@ -285,9 +299,9 @@ mask_false: ; save area ;==================== -save_sprite_1x28: -.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 -.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 +;save_sprite_1x28: +;.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 +;.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 ysave: .byte $00 diff --git a/games/peasant/inn.s b/games/peasant/inn.s index 2e32decb..3e922c08 100644 --- a/games/peasant/inn.s +++ b/games/peasant/inn.s @@ -133,24 +133,46 @@ new_location: ;==================== ; save background - lda PEASANT_X - sta CURSOR_X - lda PEASANT_Y - sta CURSOR_Y +; lda PEASANT_X +; sta CURSOR_X +; lda PEASANT_Y +; sta CURSOR_Y ;======================= ; draw initial peasant - jsr save_bg_1x28 +; jsr save_bg_1x28 - jsr draw_peasant +; jsr draw_peasant + + ;=========================== + ;=========================== + ;=========================== + ; main loop + ;=========================== + ;=========================== + ;=========================== game_loop: + ;======================== + ; move the peasant + jsr move_peasant + ;======================== + ; draw the peasant + + jsr draw_peasant + + ;======================== + ; increment the frame + inc FRAME + ;======================== + ; check the keyboard + jsr check_keyboard ;===================== diff --git a/games/peasant/intro.s b/games/peasant/intro.s index b3b1a86a..28a2dade 100644 --- a/games/peasant/intro.s +++ b/games/peasant/intro.s @@ -14,15 +14,16 @@ peasant_quest_intro: lda #0 sta ESC_PRESSED + sta LEVEL_OVER jsr hgr_make_tables jsr hgr2 - ;******************************* + ;=============================== ; restart music, only drum loop - ;****************************** + ;=============================== lda SOUND_STATUS and #SOUND_MOCKINGBOARD @@ -41,51 +42,51 @@ peasant_quest_intro: cli mockingboard_notfound: - ;************************ + ;======================== ; Cottage - ;************************ + ;======================== jsr cottage lda ESC_PRESSED bne escape_handler - ;************************ + ;======================== ; Lake West - ;************************ + ;======================== jsr lake_west lda ESC_PRESSED bne escape_handler - ;************************ + ;======================== ; Lake East - ;************************ + ;======================== jsr lake_east lda ESC_PRESSED bne escape_handler - ;************************ + ;======================== ; River - ;************************ + ;======================== jsr river lda ESC_PRESSED bne escape_handler - ;************************ + ;======================== ; Knight - ;************************ + ;======================== jsr knight - ;************************ + ;======================== ; Start actual game - ;************************ + ;======================== jsr draw_peasant @@ -119,9 +120,6 @@ mockingboard_notfound2: .include "new_game.s" - -;.include "wait_keypress.s" - .include "intro_cottage.s" .include "intro_lake_w.s" .include "intro_lake_e.s" @@ -130,21 +128,12 @@ mockingboard_notfound2: .include "draw_peasant.s" -;.include "decompress_fast_v2.s" -;.include "hgr_font.s" -;.include "draw_box.s" -;.include "hgr_rectangle.s" -;.include "hgr_1x28_sprite.s" -;.include "hgr_partial_save.s" -;.include "hgr_input.s" -;.include "hgr_tables.s" -;.include "hgr_text_box.s" -;.include "hgr_hgr2.s" - .include "hgr_1x5_sprite.s" +.include "hgr_sprite.s" .include "gr_copy.s" +.include "hgr_copy.s" .include "wait.s" .include "wait_a_bit.s" diff --git a/games/peasant/intro_cottage.s b/games/peasant/intro_cottage.s index 5ab3e527..11c3adb6 100644 --- a/games/peasant/intro_cottage.s +++ b/games/peasant/intro_cottage.s @@ -1,11 +1,12 @@ ; THATCHED ROOF COTTAGES + ; More specifically, the Dashing Residence cottage: - ;************************ + ;======================== ; Cottage - ;************************ + ;======================== lda #0 sta FRAME @@ -22,19 +23,7 @@ cottage: lda #PEASANT_DIR_RIGHT sta PEASANT_DIR - ;================== - ; draw background - - lda #<(cottage_lzsa) - sta getsrc_smc+1 - lda #>(cottage_lzsa) - sta getsrc_smc+2 - - lda #$40 - - jsr decompress_lzsa2_fast - - + ;============================= ; load priority to $400 ; indirectly as we can't trash screen holes @@ -52,6 +41,21 @@ cottage: jsr gr_copy_to_page1 + + ;========================== + ; load background to $2000 (PAGE1) + + lda #<(cottage_lzsa) + sta getsrc_smc+1 + lda #>(cottage_lzsa) + sta getsrc_smc+2 + + lda #$20 + + jsr decompress_lzsa2_fast + + jsr hgr_copy + ;=================== ; print title @@ -60,15 +64,15 @@ cottage: ;==================== ; save background - lda PEASANT_X - sta CURSOR_X - lda PEASANT_Y - sta CURSOR_Y +; lda PEASANT_X +; sta CURSOR_X +; lda PEASANT_Y +; sta CURSOR_Y ;======================= ; walking - jsr save_bg_1x28 +; jsr save_bg_1x28 cottage_walk_loop: @@ -98,20 +102,20 @@ cottage_walk_loop: sta PEASANT_Y sta CURSOR_Y - jsr save_bg_1x28 +; jsr save_bg_1x28 jsr draw_peasant - ;======================== - ; handle special - + ;====================== + ; handle special action lda FRAME check_cottage_action1: cmp #0 bne check_cottage_action2 + ;======================== ; display cottage text 1 lda #cottage_text2 - jmp finish_cottage_action check_cottage_action3: cmp #13 bne done_cottage_action + + ;========================= + ; undraw the text box lda #0 ldx #39 jsr hgr_partial_restore + ;========================= ; display cottage text 3 lda #(lake_w_lzsa) - sta getsrc_smc+2 - - lda #$40 - - jsr decompress_lzsa2_fast - - ;================ - ; print title - - jsr intro_print_title - - + ;=============================== ; load priority to $400 ; indirectly as we can't trash screen holes @@ -54,18 +40,38 @@ lake_west: jsr gr_copy_to_page1 + ;================== + ; load background + + lda #<(lake_w_lzsa) + sta getsrc_smc+1 + lda #>(lake_w_lzsa) + sta getsrc_smc+2 + + lda #$20 + + jsr decompress_lzsa2_fast + + jsr hgr_copy + + ;================ + ; print title + + jsr intro_print_title + + ;==================== ; save background - lda PEASANT_X - sta CURSOR_X - lda PEASANT_Y - sta CURSOR_Y +; lda PEASANT_X +; sta CURSOR_X +; lda PEASANT_Y +; sta CURSOR_Y ;======================= ; walking - jsr save_bg_1x28 +; jsr save_bg_1x28 lake_w_walk_loop: @@ -92,7 +98,7 @@ lake_w_walk_loop: sta PEASANT_Y sta CURSOR_Y - jsr save_bg_1x28 +; jsr save_bg_1x28 jsr draw_peasant @@ -104,6 +110,7 @@ check_lake_w_action1: cmp #0 bne check_lake_w_action2 + ;========================== ; re-display cottage text 3 lda # peasant_sprites.inc @@ -156,9 +156,18 @@ trogdor_sprites.inc: trogdor_sprites.png waterfall_sprites.inc: waterfall_sprites.png $(HGR_SPRITE) -s -l waterfall_sprite waterfall_sprites.png 14 5 27 52 > waterfall_sprites.inc +bubble_sprites.inc: bubble_sprites.png + $(HGR_SPRITE) -s -l bubble_sprite0 bubble_sprites.png 7 1 13 6 > bubble_sprites.inc + $(HGR_SPRITE) -s -l bubble_sprite1 bubble_sprites.png 7 8 13 13 >> bubble_sprites.inc + $(HGR_SPRITE) -s -l bubble_sprite2 bubble_sprites.png 7 15 13 20 >> bubble_sprites.inc + $(HGR_SPRITE) -s -l bubble_sprite3 bubble_sprites.png 7 22 13 27 >> bubble_sprites.inc + $(HGR_SPRITE) -s -l bubble_sprite4 bubble_sprites.png 7 29 13 34 >> bubble_sprites.inc + $(HGR_SPRITE) -s -l bubble_sprite5 bubble_sprites.png 7 36 13 41 >> bubble_sprites.inc + + clean: rm -f *~ peasant_sprites.inc inventory_sprites.inc \ ending_sprites.inc trogdor_sprites.inc ned_sprites.inc \ peasant_robe_sprites.inc kerrek_sprites.inc \ - waterfall_sprites.inc + waterfall_sprites.inc bubble_sprites.inc diff --git a/games/peasant/sprites/bubble_sprites.png b/games/peasant/sprites/bubble_sprites.png new file mode 100644 index 00000000..e13ddfa2 Binary files /dev/null and b/games/peasant/sprites/bubble_sprites.png differ