peasant: animate gary

This commit is contained in:
Vince Weaver 2022-01-07 14:19:15 -05:00
parent 24f8399122
commit bf7c9b3b9c
6 changed files with 195 additions and 3 deletions

View File

@ -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 \

View File

@ -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

View File

@ -123,7 +123,7 @@ hposn:
and #$1F
ora HGR_PAGE
ora HGR_PAGE ; default is $40 in this game
sta GBASH
; txa

View File

@ -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 INL
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
sta INL
lda #>gary_tail1_sprite
jmp draw_flies
draw_tail2:
lda #<gary_tail2_sprite
sta INL
lda #>gary_tail2_sprite
jmp draw_flies
draw_fly2:
lda #<gary_fly2_sprite
sta INL
lda #>gary_fly2_sprite
jmp draw_flies
draw_fly1:
lda #<gary_fly1_sprite
sta INL
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
sta INL
lda #>gary_foot0_sprite
jmp draw_foot
draw_foot1:
lda #<gary_foot1_sprite
sta INL
lda #>gary_foot1_sprite
jmp draw_foot
draw_foot2:
lda #<gary_foot2_sprite
sta INL
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 <gary_lzsa ; 0 -- gary the horse
@ -371,6 +544,8 @@ verb_tables_hi:
.byte >waterfall_verb_table ; 4 -- waterfall
peasant1_text_lzsa:
.incbin "DIALOG_PEASANT1.LZSA"

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB