fish: work on animations

This commit is contained in:
Vince Weaver 2024-06-08 00:59:56 -04:00
parent d758fc265b
commit db320728dc
8 changed files with 187 additions and 209 deletions

View File

@ -24,7 +24,7 @@ sb.dsk: QBOOT QLOAD TITLE DUCK_POND ROOF ASPLODE BACK_OFF \
$(DOS33_RAW) sb.dsk 10 0 ROOF 0 0 $(DOS33_RAW) sb.dsk 10 0 ROOF 0 0
$(DOS33_RAW) sb.dsk 15 0 ASPLODE 0 0 $(DOS33_RAW) sb.dsk 15 0 ASPLODE 0 0
# $(DOS33_RAW) sb.dsk 20 0 TARGET 0 0 # $(DOS33_RAW) sb.dsk 20 0 TARGET 0 0
$(DOS33_RAW) sb.dsk 25 0 ./fish/FISH 0 0 $(DOS33_RAW) sb.dsk 20 0 ./fish/FISH 0 0
$(DOS33_RAW) sb.dsk 30 0 RAT 0 0 $(DOS33_RAW) sb.dsk 30 0 RAT 0 0
$(DOS33_RAW) sb.dsk 32 0 BACK_OFF 0 0 $(DOS33_RAW) sb.dsk 32 0 BACK_OFF 0 0

View File

@ -14,6 +14,8 @@ FISH: fish.o
fish.o: fish.s zx02_optim.s \ fish.o: fish.s zx02_optim.s \
graphics/fish_title.hgr.zx02 \ graphics/fish_title.hgr.zx02 \
graphics/fish_bg.hgr.zx02 \ graphics/fish_bg.hgr.zx02 \
graphics/boat_sprites.inc \
graphics/strongbad_sprites.inc \
sounds/fish.btc.zx02 \ sounds/fish.btc.zx02 \
sounds/get_in_boat.btc.zx02 \ sounds/get_in_boat.btc.zx02 \
hgr_sprite_big.s \ hgr_sprite_big.s \

View File

@ -170,15 +170,15 @@ load_background:
jmp main_loop jmp main_loop
title_data:
.incbin "graphics/fish_title.hgr.zx02"
sound_data_fish: sound_data_fish:
.incbin "sounds/fish.btc.zx02" .incbin "sounds/fish.btc.zx02"
sound_data_boat: sound_data_boat:
.incbin "sounds/get_in_boat.btc.zx02" .incbin "sounds/get_in_boat.btc.zx02"
title_data:
.incbin "graphics/fish_title.hgr.zx02"
; start at least 8k in? ; start at least 8k in?
@ -187,11 +187,11 @@ sound_data_boat:
;=========================== ;===========================
main_loop: main_loop:
.if 0
jsr flip_page jsr flip_page
.if 0
;======================== ;========================
; copy over background ; copy over background
@ -210,57 +210,109 @@ do_bg:
jsr hgr_copy jsr hgr_copy
.endif .endif
lda #<bg_data
sta ZX0_src
lda #>bg_data
sta ZX0_src+1
clc
lda DRAW_PAGE
adc #$20
jsr full_decomp
inc FRAME inc FRAME
;========================== ;==========================
; copy over proper boat ; copy over proper boat
;========================== ;==========================
lda FRAME
; lsr
; lsr
and #$3
tax
lda boat_offsets,X
sta BOAT_OFFSET
lda boat_sprites_l,X
sta INL
lda boat_sprites_h,X
sta INH
lda #8
sta SPRITE_X
lda #94
sta SPRITE_Y
jsr hgr_draw_sprite_big
;=========================== ;===========================
; draw strong bad ; draw strong bad
;=========================== ;===========================
.if 0
lda FRAME
and #$3
bne no_move_head
lda STRONGBAD_X draw_strong_bad:
cmp #21
bcs reverse_head_dir
cmp #12
bcs no_reverse_head_dir
reverse_head_dir:
lda STRONGBAD_DIR
eor #$FF
sta STRONGBAD_DIR
inc STRONGBAD_DIR
no_reverse_head_dir: lda ANIMATION_TYPE
cmp #ANIMATION_LURE
beq draw_lure_animation
cmp #ANIMATION_JIG
beq draw_jig_animation
clc draw_regular_animation:
lda STRONGBAD_X lda #<sb_sprite
adc STRONGBAD_DIR
sta STRONGBAD_X
no_move_head:
;==========================
; draw head
;===========================
ldx HEAD_DAMAGE
lda head_sprites_l,X
sta INL sta INL
lda head_sprites_h,X lda #>sb_sprite
sta INH sta INH
lda STRONGBAD_X
lda #23
sta SPRITE_X sta SPRITE_X
lda #36 lda #42
sta SPRITE_Y sta SPRITE_Y
jmp draw_common_animation
draw_lure_animation:
ldx ANIMATION_COUNT
lda lure_sprites_l,X
sta INL
lda lure_sprites_h,X
sta INH
lda #23
sta SPRITE_X
lda #42
sta SPRITE_Y
jmp draw_common_animation
draw_jig_animation:
ldx ANIMATION_COUNT
lda jig_sprites_l,X
sta INL
lda jig_sprites_h,X
sta INH
lda #22
sta SPRITE_X
lda #27
sta SPRITE_Y
update_animation:
dec ANIMATION_COUNT
bpl draw_common_animation
; done
lda #ANIMATION_NONE
sta ANIMATION_TYPE
draw_common_animation:
lda SPRITE_Y
clc
adc BOAT_OFFSET
sta SPRITE_Y
jsr hgr_draw_sprite_big jsr hgr_draw_sprite_big
.endif
;========================== ;==========================
; update score? ; update score?
@ -308,19 +360,19 @@ done_keyboard_check:
do_jig: do_jig:
jsr play_boat ; `come on and get in the boat' jsr play_boat ; `come on and get in the boat'
; lda PLAYER_X lda #ANIMATION_JIG
; beq no_more_left sta ANIMATION_TYPE
; dec PLAYER_X lda #10
no_more_gire: sta ANIMATION_COUNT
jmp main_loop jmp main_loop
do_lure: do_lure:
jsr play_fish ; 'fish' jsr play_fish ; 'fish'
; lda PLAYER_X lda #ANIMATION_LURE
; cmp #28 ; bge sta ANIMATION_TYPE
; bcs no_more_right lda #10
; inc PLAYER_X sta ANIMATION_COUNT
no_more_lure:
jmp main_loop jmp main_loop
;========================== ;==========================
@ -342,9 +394,7 @@ wait_until_keypress:
bit KEYRESET ; clear the keyboard buffer bit KEYRESET ; clear the keyboard buffer
rts rts
.endif
.include "asplode_head.s"
;========== ;==========
; flip page ; flip page
;========== ;==========
@ -365,95 +415,66 @@ done_flip:
sta DRAW_PAGE sta DRAW_PAGE
rts rts
.endif
boat_sprites_l:
.byte <boat2_sprite,<boat1_sprite,<boat3_sprite,<boat1_sprite
boat_sprites_h:
.byte >boat2_sprite,>boat1_sprite,>boat3_sprite,>boat1_sprite
; add to Y to account for boat moving
; 1 2 3
; 18, 15, 19
boat_offsets:
.byte 0,3,4,3
; 2 3 2 1 2 3 2 1 2 3 2
; c r c l c r c l c r c
jig_sprites_l:
.byte <sb_boat2_sprite,<sb_boat3_sprite
.byte <sb_boat2_sprite,<sb_boat1_sprite
.byte <sb_boat2_sprite,<sb_boat3_sprite
.byte <sb_boat2_sprite,<sb_boat1_sprite
.byte <sb_boat2_sprite,<sb_boat3_sprite
.byte <sb_boat2_sprite
jig_sprites_h:
.byte >sb_boat2_sprite,>sb_boat3_sprite
.byte >sb_boat2_sprite,>sb_boat1_sprite
.byte >sb_boat2_sprite,>sb_boat3_sprite
.byte >sb_boat2_sprite,>sb_boat1_sprite
.byte >sb_boat2_sprite,>sb_boat3_sprite
.byte >sb_boat2_sprite
; 0 1 0 2 0 1 0 2 0 1 0
; m u m d m u m d m u m
lure_sprites_l:
.byte <sb_sprite,<sb_fish1_sprite
.byte <sb_sprite,<sb_fish2_sprite
.byte <sb_sprite,<sb_fish1_sprite
.byte <sb_sprite,<sb_fish2_sprite
.byte <sb_sprite,<sb_fish1_sprite
.byte <sb_sprite
lure_sprites_h:
.byte >sb_sprite,>sb_fish1_sprite
.byte >sb_sprite,>sb_fish2_sprite
.byte >sb_sprite,>sb_fish1_sprite
.byte >sb_sprite,>sb_fish2_sprite
.byte >sb_sprite,>sb_fish1_sprite
.byte >sb_sprite
bg_data: bg_data:
; .incbin "graphics/fish_bg.hgr.zx02" .incbin "graphics/fish_bg.hgr.zx02"
.incbin "graphics/boat2_sb.hgr.zx02"
.include "hgr_tables.s"
.include "zx02_optim.s" .include "zx02_optim.s"
.include "hgr_tables.s"
.include "hgr_sprite_big.s" .include "hgr_sprite_big.s"
.include "hgr_copy_fast.s" .include "hgr_copy_fast.s"
.include "audio.s" .include "audio.s"
.include "play_sounds.s" .include "play_sounds.s"
; .include "asplode_graphics/sb_sprites.inc" .include "graphics/boat_sprites.inc"
.include "graphics/strongbad_sprites.inc"
.if 0
shield_sprites_l:
.byte <player_sprite,<shield_left_sprite
.byte <shield_center_sprite,<shield_right_sprite
shield_sprites_h:
.byte >player_sprite,>shield_left_sprite
.byte >shield_center_sprite,>shield_right_sprite
head_sprites_l:
.byte <big_head0_sprite,<big_head1_sprite,<big_head2_sprite
.byte <big_head3_sprite,<big_head4_sprite
head_sprites_h:
.byte >big_head0_sprite,>big_head1_sprite,>big_head2_sprite
.byte >big_head3_sprite,>big_head4_sprite
y_positions:
; 90 to 160 roughly? Let's say 64?
; have 16 positions? 4 each?
; can probably optimize this
bullet_sprite_l:
.byte <bullet0_sprite, <bullet1_sprite, <bullet2_sprite, <bullet3_sprite
.byte <bullet4_sprite, <bullet5_sprite, <bullet6_sprite, <bullet7_sprite
.byte <bullet8_sprite, <bullet9_sprite,<bullet10_sprite,<bullet11_sprite
.byte <bullet12_sprite,<bullet13_sprite,<bullet14_sprite,<bullet15_sprite
.byte <bullet_done_sprite
bullet_sprite_h:
.byte >bullet0_sprite, >bullet1_sprite, >bullet2_sprite, >bullet3_sprite
.byte >bullet4_sprite, >bullet5_sprite, >bullet6_sprite, >bullet7_sprite
.byte >bullet8_sprite, >bullet9_sprite,>bullet10_sprite,>bullet11_sprite
.byte >bullet12_sprite,>bullet13_sprite,>bullet14_sprite,>bullet15_sprite
.byte >bullet_done_sprite
bullet_sprite_y:
.byte 83,88,93,98
.byte 103,108,113,118
.byte 123,128,133,138
.byte 143,148,153,158
.byte 163
bullet_vals:
.byte $10,$20,$20,$40
bullet_vals_center:
.byte $20,$00,$00,$20
; original
; 1 = 6
; 2 = 12
; 3 = 18
; 4 = 25
; 5 = 32
; 6 = 38
; 7 = 44
; 8 = 50
; 9 = 57
; 10= 63
; 11= 70
; 12= 77
; 13= 82
; 14= 89
; 15= 95
; 27= 167 (peak)
; 30= 148
; 31= 139
; 9,5 -> 22,14 = 12x9 roughly. 3 times smaller, 4x3? 2x6?
.endif

View File

@ -2,11 +2,10 @@ include ../../../../Makefile.inc
ZX02 = ~/research/6502_compression/zx02.git/build/zx02 -f ZX02 = ~/research/6502_compression/zx02.git/build/zx02 -f
PNG_TO_HGR = ../../../../utils/hgr-utils/png2hgr PNG_TO_HGR = ../../../../utils/hgr-utils/png2hgr
HGR_SPRITE = ../../../utils/hgr-utils/hgr_make_sprite HGR_SPRITE = ../../../../utils/hgr-utils/hgr_make_sprite
all: fish_title.hgr.zx02 fish_bg.hgr.zx02 boat2_sb.hgr.zx02 all: fish_title.hgr.zx02 fish_bg.hgr.zx02 boat2_sb.hgr.zx02 \
boat_sprites.inc strongbad_sprites.inc
# sb_sprites.inc
#### ####
@ -37,67 +36,29 @@ boat2_sb.hgr: boat2_sb.png
#### ####
# TODO: optimize these a bit boat_sprites.inc: boat_sprites.png
$(HGR_SPRITE) -s -l boat1_sprite boat_sprites.png 0 0 188 45 > boat_sprites.inc
$(HGR_SPRITE) -s -l boat2_sprite boat_sprites.png 0 46 188 91 >> boat_sprites.inc
$(HGR_SPRITE) -s -l boat3_sprite boat_sprites.png 0 92 188 137 >> boat_sprites.inc
####
strongbad_sprites.inc: strongbad_sprites.png
$(HGR_SPRITE) -s -l sb_sprite strongbad_sprites.png 0 0 55 66 > strongbad_sprites.inc
$(HGR_SPRITE) -s -l sb_fish1_sprite strongbad_sprites.png 70 0 125 66 >> strongbad_sprites.inc
$(HGR_SPRITE) -s -l sb_fish2_sprite strongbad_sprites.png 140 0 195 66 >> strongbad_sprites.inc
$(HGR_SPRITE) -s -l sb_boat1_sprite strongbad_sprites.png 0 112 69 192 >> strongbad_sprites.inc
$(HGR_SPRITE) -s -l sb_boat2_sprite strongbad_sprites.png 84 112 153 192 >> strongbad_sprites.inc
$(HGR_SPRITE) -s -l sb_boat3_sprite strongbad_sprites.png 161 112 230 192 >> strongbad_sprites.inc
sb_sprites.inc: sb_sprites.png
$(HGR_SPRITE) -s -l big_head0_sprite sb_sprites.png 0 78 47 134 > sb_sprites.inc
$(HGR_SPRITE) -s -l big_head1_sprite sb_sprites.png 56 78 103 134 >> sb_sprites.inc
$(HGR_SPRITE) -s -l big_head2_sprite sb_sprites.png 112 78 159 134 >> sb_sprites.inc
$(HGR_SPRITE) -s -l big_head3_sprite sb_sprites.png 56 21 103 77 >> sb_sprites.inc
$(HGR_SPRITE) -s -l big_head4_sprite sb_sprites.png 112 21 159 77 >> sb_sprites.inc
$(HGR_SPRITE) -s -l player_sprite sb_sprites.png 98 138 181 192 >> sb_sprites.inc
$(HGR_SPRITE) -s -l shield_left_sprite sb_sprites.png 0 138 83 192 >> sb_sprites.inc
$(HGR_SPRITE) -s -l shield_center_sprite sb_sprites.png 196 83 279 137 >> sb_sprites.inc
$(HGR_SPRITE) -s -l shield_right_sprite sb_sprites.png 196 138 279 192 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet0_sprite sb_sprites.png 168 1 181 7 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet1_sprite sb_sprites.png 168 8 181 14 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet2_sprite sb_sprites.png 168 15 181 21 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet3_sprite sb_sprites.png 168 22 181 28 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet4_sprite sb_sprites.png 168 29 181 35 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet5_sprite sb_sprites.png 168 36 181 42 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet6_sprite sb_sprites.png 168 43 181 49 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet7_sprite sb_sprites.png 168 50 181 56 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet8_sprite sb_sprites.png 168 57 181 63 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet9_sprite sb_sprites.png 168 64 181 70 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet10_sprite sb_sprites.png 168 71 181 77 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet11_sprite sb_sprites.png 168 78 181 84 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet12_sprite sb_sprites.png 168 85 181 91 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet13_sprite sb_sprites.png 168 92 181 98 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet14_sprite sb_sprites.png 168 99 181 105 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet15_sprite sb_sprites.png 168 106 181 112 >> sb_sprites.inc
$(HGR_SPRITE) -s -l your_sprite sb_sprites.png 0 0 41 20 >> sb_sprites.inc
$(HGR_SPRITE) -s -l head_sprite sb_sprites.png 56 0 90 20 >> sb_sprites.inc
$(HGR_SPRITE) -s -l a_sprite sb_sprites.png 98 0 104 20 >> sb_sprites.inc
$(HGR_SPRITE) -s -l splode_sprite sb_sprites.png 112 0 166 20 >> sb_sprites.inc
$(HGR_SPRITE) -s -l your_med_sprite sb_sprites.png 0 22 33 31 >> sb_sprites.inc
$(HGR_SPRITE) -s -l head_med_sprite sb_sprites.png 0 32 26 41 >> sb_sprites.inc
$(HGR_SPRITE) -s -l a_med_sprite sb_sprites.png 42 32 47 41 >> sb_sprites.inc
$(HGR_SPRITE) -s -l splode_med_sprite sb_sprites.png 0 42 40 51 >> sb_sprites.inc
$(HGR_SPRITE) -s -l your_sm_sprite sb_sprites.png 0 52 19 57 >> sb_sprites.inc
$(HGR_SPRITE) -s -l head_sm_sprite sb_sprites.png 28 52 47 57 >> sb_sprites.inc
$(HGR_SPRITE) -s -l a_sm_sprite sb_sprites.png 0 58 5 63 >> sb_sprites.inc
$(HGR_SPRITE) -s -l splode_sm_sprite sb_sprites.png 14 58 33 63 >> sb_sprites.inc
$(HGR_SPRITE) -s -l bullet_done_sprite sb_sprites.png 168 114 180 123 >> sb_sprites.inc
$(HGR_SPRITE) -s -l asploding1_sprite sb_sprites.png 196 27 222 52 >> sb_sprites.inc
$(HGR_SPRITE) -s -l asploding2_sprite sb_sprites.png 238 27 264 52 >> sb_sprites.inc
$(HGR_SPRITE) -s -l asploding3_sprite sb_sprites.png 196 53 222 78 >> sb_sprites.inc
$(HGR_SPRITE) -s -l asploding4_sprite sb_sprites.png 238 53 264 78 >> sb_sprites.inc
###
bob_sprites.inc: bob_sprites.png Makefile
$(HGR_SPRITE) -s -l back_sprite bob_sprites.png 0 0 41 20 > bob_sprites.inc
$(HGR_SPRITE) -s -l off_sprite bob_sprites.png 56 0 90 20 >> bob_sprites.inc
$(HGR_SPRITE) -s -l baby_sprite bob_sprites.png 98 0 131 20 >> bob_sprites.inc
$(HGR_SPRITE) -s -l back_med_sprite bob_sprites.png 0 22 33 31 >> bob_sprites.inc
$(HGR_SPRITE) -s -l off_med_sprite bob_sprites.png 0 32 26 41 >> bob_sprites.inc
$(HGR_SPRITE) -s -l baby_med_sprite bob_sprites.png 0 42 40 51 >> bob_sprites.inc
$(HGR_SPRITE) -s -l back_sm_sprite bob_sprites.png 0 52 19 57 >> bob_sprites.inc
$(HGR_SPRITE) -s -l off_sm_sprite bob_sprites.png 28 52 47 57 >> bob_sprites.inc
$(HGR_SPRITE) -s -l baby_sm_sprite bob_sprites.png 14 58 33 63 >> bob_sprites.inc
#### ####
clean: clean:
rm -f *~ *.o *.lst *.zx02 *.hgr sb_sprites.inc bob_sprites.inc rm -f *~ *.o *.lst *.zx02 *.hgr strongbad_sprites.inc boat_sprites.inc

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -64,20 +64,14 @@ OLD_MENU_ITEM = $69
NOT_FIRST_TIME = $6A NOT_FIRST_TIME = $6A
STRONGBAD_X = $6B STRONGBAD_X = $6B
PLAYER_X = $6C PLAYER_X = $6C
STRONGBAD_DIR = $6D
SHIELD_POSITION = $6E BOAT_OFFSET = $6D
SHIELD_DOWN = 0 ANIMATION_TYPE = $6E
SHIELD_UP_LEFT = 1 ANIMATION_NONE = $00
SHIELD_UP_CENTER = 2 ANIMATION_JIG = $01
SHIELD_UP_RIGHT = 3 ANIMATION_LURE = $02
SHIELD_COUNT = $6F ANIMATION_COUNT = $6F
BULLET_X = $70
BULLET_X_L = $71
BULLET_Y = $72
HEAD_DAMAGE = $73
BULLET_X_VEL = $74
BULLET_X_VEL_L = $75
BULLET_YDIR = $76
.if 0 .if 0
REGISTER_DUMP = $70 REGISTER_DUMP = $70

View File

@ -176,7 +176,7 @@ load_address_array:
track_array: track_array:
.byte 2, 5,10,15 ; TITLE, DUCK, ROOF, ASPLODE .byte 2, 5,10,15 ; TITLE, DUCK, ROOF, ASPLODE
.byte 20,25,30,32 ; ?, FISH, RAT, BACK_OFF .byte 20,20,30,32 ; ?, FISH, RAT, BACK_OFF
sector_array: sector_array:
@ -186,7 +186,7 @@ sector_array:
length_array: length_array:
.byte 40, 16, 16, 70 ; TITLE, DUCK, ROOF, ASPLODE .byte 40, 16, 16, 70 ; TITLE, DUCK, ROOF, ASPLODE
.byte 32, 70, 32, 24 ; ?, FISH, RAT, BACK_OFF .byte 32, 90, 32, 24 ; ?, FISH, RAT, BACK_OFF
qload_end: qload_end: