From bf7c9b3b9c620a41ca97096d9f7fcdc68df26091 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Fri, 7 Jan 2022 14:19:15 -0500 Subject: [PATCH] peasant: animate gary --- games/peasant/Makefile | 1 + games/peasant/hgr_sprite.s | 5 + games/peasant/hgr_tables.s | 2 +- games/peasant/peasant1.s | 175 +++++++++++++++++++++++++ games/peasant/sprites/Makefile | 15 ++- games/peasant/sprites/gary_sprites.png | Bin 0 -> 1101 bytes 6 files changed, 195 insertions(+), 3 deletions(-) create mode 100644 games/peasant/sprites/gary_sprites.png diff --git a/games/peasant/Makefile b/games/peasant/Makefile index fa568cc4..d1e8a542 100644 --- a/games/peasant/Makefile +++ b/games/peasant/Makefile @@ -339,6 +339,7 @@ peasant1.o: peasant1.s zp.inc inventory.inc \ kerrek_actions.s peasant_common.s \ sprites/peasant_sprites.inc sprites/inventory_sprites.inc \ sprites/kerrek_sprites.inc \ + sprites/gary_sprites.inc \ graphics_peasantry/graphics_peasant1.inc \ graphics_peasantry/priority_peasant1.inc \ draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \ diff --git a/games/peasant/hgr_sprite.s b/games/peasant/hgr_sprite.s index 80451cba..d3004946 100644 --- a/games/peasant/hgr_sprite.s +++ b/games/peasant/hgr_sprite.s @@ -46,6 +46,11 @@ hgr_sprite_yloop: lda hposn_low,Y sta GBASL lda hposn_high,Y + + ; eor #$00 draws on page2 + ; eor #$60 draws on page1 +hgr_sprite_page_smc: + eor #$00 sta GBASH ldy CURSOR_X diff --git a/games/peasant/hgr_tables.s b/games/peasant/hgr_tables.s index 4d95b196..02e558e7 100644 --- a/games/peasant/hgr_tables.s +++ b/games/peasant/hgr_tables.s @@ -123,7 +123,7 @@ hposn: and #$1F - ora HGR_PAGE + ora HGR_PAGE ; default is $40 in this game sta GBASH ; txa diff --git a/games/peasant/peasant1.s b/games/peasant/peasant1.s index 0bac47b5..dbfb1aa8 100644 --- a/games/peasant/peasant1.s +++ b/games/peasant/peasant1.s @@ -108,6 +108,48 @@ new_location: jsr decompress_lzsa2_fast + ;========================= + ; update bg based on gary + + lda MAP_LOCATION + cmp #LOCATION_POOR_GARY + bne no_update_gary + + ; FIXME: draw broken fence if necessary + ; update fence in collision layer if necessary + + ; see if gary out + lda GAME_STATE_0 + and #GARY_SCARED + bne no_draw_gary + + ; draw gary in background before copying + + lda #9 + sta CURSOR_X + lda #120 + sta CURSOR_Y + + lda #gary_base_sprite + sta INH + + ; switch to page1 + lda #$60 + sta hgr_sprite_page_smc+1 + + jsr hgr_draw_sprite + + ; switch back to page2 + lda #$00 + sta hgr_sprite_page_smc+1 + +no_draw_gary: + +no_update_gary: + + ;================== ; copy to $4000 jsr hgr_copy @@ -222,6 +264,136 @@ erase_waterfall: leave_waterfall_alone: + ;======================= + ; animate gary of applicable + + ; check if on gary screen + + lda MAP_LOCATION + cmp #LOCATION_POOR_GARY + beq flies_check_gary_out + jmp no_draw_gary_flies + +flies_check_gary_out: + ; see if gary out + lda GAME_STATE_0 + and #GARY_SCARED + beq do_draw_gary_flies + jmp no_draw_gary_flies + + ;===================== + ; draw the flies +do_draw_gary_flies: + ; flies on 32 frame loop + ; odd = fly1 + ; even= fly2 + ; 12/14 = tail1 + ; 13/15 = tail2 + + lda FRAME + and #$3f ; 63 = $3f + lsr + cmp #12 + beq draw_tail1 + cmp #13 + beq draw_tail2 + cmp #14 + beq draw_tail1 + cmp #15 + beq draw_tail2 + + ; else normal + and #1 + beq draw_fly1 + bne draw_fly2 + +draw_tail1: + lda #gary_tail1_sprite + jmp draw_flies + +draw_tail2: + lda #gary_tail2_sprite + jmp draw_flies + +draw_fly2: + lda #gary_fly2_sprite + jmp draw_flies + +draw_fly1: + lda #gary_fly1_sprite + +draw_flies: + sta INH + + lda #7 + sta CURSOR_X + lda #120 + sta CURSOR_Y + + jsr hgr_draw_sprite + + + ;===================== + ; draw the foot +do_draw_gary_foot: + ; foot on 32 frame loop + ; 28/29 = foot1 + ; 30/31 = foot2 + + lda FRAME + and #$3f ; 63 = $3f + lsr + cmp #28 + beq draw_foot1 + cmp #29 + beq draw_foot2 + cmp #30 + beq draw_foot1 + cmp #31 + beq draw_foot2 + +draw_foot0: + lda #gary_foot0_sprite + jmp draw_foot + +draw_foot1: + lda #gary_foot1_sprite + jmp draw_foot + +draw_foot2: + lda #gary_foot2_sprite + jmp draw_foot + +draw_foot: + sta INH + + lda #11 + sta CURSOR_X + lda #136 + sta CURSOR_Y + + jsr hgr_draw_sprite + +done_draw_foot: + + +no_draw_gary_flies: + + ;====================== ; move peasant @@ -323,6 +495,7 @@ game_over: .include "graphics_peasantry/graphics_peasant1.inc" .include "sprites/waterfall_sprites.inc" +.include "sprites/gary_sprites.inc" map_backgrounds_low: .byte waterfall_verb_table ; 4 -- waterfall + + peasant1_text_lzsa: .incbin "DIALOG_PEASANT1.LZSA" diff --git a/games/peasant/sprites/Makefile b/games/peasant/sprites/Makefile index 4929a4b1..a64b6194 100644 --- a/games/peasant/sprites/Makefile +++ b/games/peasant/sprites/Makefile @@ -4,7 +4,7 @@ all: inventory_sprites.inc ending_sprites.inc trogdor_sprites.inc \ boat_sprites.inc peasant_sprites.inc ned_sprites.inc \ peasant_robe_sprites.inc kerrek_sprites.inc \ waterfall_sprites.inc bubble_sprites_w.inc bubble_sprites_e.inc \ - river_bubble_sprites.inc + river_bubble_sprites.inc gary_sprites.inc peasant_sprites.inc: peasant_sprites.png $(HGR_SPRITE) -l peasant_right1_sprite peasant_sprites.png 35 1 35 29 > peasant_sprites.inc @@ -58,6 +58,16 @@ boat_sprites.inc: boat_sprites.png ned_sprites.inc: ned_sprites.png $(HGR_SPRITE) -s -l rock_moved_sprite ned_sprites.png 7 1 27 12 > ned_sprites.inc +gary_sprites.inc: gary_sprites.png + $(HGR_SPRITE) -s -l gary_base_sprite gary_sprites.png 21 98 55 124 > gary_sprites.inc + $(HGR_SPRITE) -s -l gary_fly1_sprite gary_sprites.png 63 98 76 117 >> gary_sprites.inc + $(HGR_SPRITE) -s -l gary_fly2_sprite gary_sprites.png 91 98 104 117 >> gary_sprites.inc + $(HGR_SPRITE) -s -l gary_tail1_sprite gary_sprites.png 119 98 132 117 >> gary_sprites.inc + $(HGR_SPRITE) -s -l gary_tail2_sprite gary_sprites.png 147 98 160 117 >> gary_sprites.inc + $(HGR_SPRITE) -s -l gary_foot1_sprite gary_sprites.png 91 118 118 128 >> gary_sprites.inc + $(HGR_SPRITE) -s -l gary_foot0_sprite gary_sprites.png 63 118 76 128 >> gary_sprites.inc + $(HGR_SPRITE) -s -l gary_foot1_sprite gary_sprites.png 91 118 104 128 >> gary_sprites.inc + $(HGR_SPRITE) -s -l gary_foot2_sprite gary_sprites.png 119 118 132 128 >> gary_sprites.inc inventory_sprites.inc: inventory.png $(HGR_SPRITE) -l arrow_sprite inventory.png 14 3 27 19 > inventory_sprites.inc @@ -182,4 +192,5 @@ clean: ending_sprites.inc trogdor_sprites.inc ned_sprites.inc \ peasant_robe_sprites.inc kerrek_sprites.inc \ waterfall_sprites.inc bubble_sprites_w.inc \ - bubble_sprites_e.inc river_bubble_sprites.inc + bubble_sprites_e.inc river_bubble_sprites.inc \ + gary_sprites.inc diff --git a/games/peasant/sprites/gary_sprites.png b/games/peasant/sprites/gary_sprites.png new file mode 100644 index 0000000000000000000000000000000000000000..514cf9ac6aa0abe973892572296dd8364a3a0d00 GIT binary patch literal 1101 zcmV-T1hV^yP)EX>4Tx04R}tkv&MmKpe$iQ>7x6f_4yb$WWauh!yFmRVYG*QY*CTU~=gfG-*gu zTpR`0f`cE6RRU6f~epZjwRC4rtTK|Hf* z>74h8!>lYR#OK5l23?T&k?XR{Z=6dG3p_JyWHa-`VPdh=#c~(3vY`@B6Gs$PqkJLf zvch?bvs$gQ_C5Ivg9UA6nd>x1k;EdFkcJ2ubyQG=g($5WDJC+spYZUHIQ}%bWO7x& z$gzMLR7j2={11M2YZhZuZc;D-^uE~k#~2XU1zHW;{yw(t)(PN$2ClS@zt#lepQJZB zTI2`_Z37qA9ZlW?E_Z<8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