fish: add ripples

This commit is contained in:
Vince Weaver 2024-06-12 16:53:42 -04:00
parent b5bdbe03f6
commit 97d244867c
6 changed files with 174 additions and 10 deletions

View File

@ -289,6 +289,38 @@ main_loop:
;===========================
; draw ripples
; should we do this last?
lda FRAME
and #$3
tax
lda ripple_l_sprites_l,X
sta INL
lda ripple_l_sprites_h,X
sta INH
lda #8
sta SPRITE_X
lda #136
sta SPRITE_Y
jsr hgr_draw_sprite
lda FRAME
and #$3
tax
lda ripple_r_sprites_l,X
sta INL
lda ripple_r_sprites_h,X
sta INH
lda #32
sta SPRITE_X
lda #139
sta SPRITE_Y
jsr hgr_draw_sprite
;===========================
; draw strong bad
@ -896,6 +928,7 @@ bg_data:
.include "play_sounds.s"
.include "text_print.s"
.include "gr_offsets.s"
.include "random16.s"
.include "graphics/boat_sprites.inc"
.include "graphics/strongbad_sprites.inc"
@ -1013,3 +1046,13 @@ bubble_mask_table_h:
.byte >big_bubble_mask,>big_bubble_mask
.byte >med2_bubble_mask,>med2_bubble_mask
ripple_l_sprites_l:
.byte <ripple_l1_sprite,<ripple_l2_sprite,<ripple_l3_sprite,<ripple_none_sprite
ripple_l_sprites_h:
.byte >ripple_l1_sprite,>ripple_l2_sprite,>ripple_l3_sprite,>ripple_none_sprite
ripple_r_sprites_l:
.byte <ripple_r1_sprite,<ripple_r2_sprite,<ripple_r3_sprite,<ripple_none_sprite
ripple_r_sprites_h:
.byte >ripple_r1_sprite,>ripple_r2_sprite,>ripple_r3_sprite,>ripple_none_sprite

View File

@ -40,6 +40,13 @@ 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
$(HGR_SPRITE) -s -l ripple_l1_sprite boat_sprites.png 0 142 13 146 >> boat_sprites.inc
$(HGR_SPRITE) -s -l ripple_l2_sprite boat_sprites.png 0 156 13 160 >> boat_sprites.inc
$(HGR_SPRITE) -s -l ripple_l3_sprite boat_sprites.png 0 171 13 175 >> boat_sprites.inc
$(HGR_SPRITE) -s -l ripple_r1_sprite boat_sprites.png 168 144 181 148 >> boat_sprites.inc
$(HGR_SPRITE) -s -l ripple_r2_sprite boat_sprites.png 168 159 181 163 >> boat_sprites.inc
$(HGR_SPRITE) -s -l ripple_r3_sprite boat_sprites.png 168 174 181 178 >> boat_sprites.inc
$(HGR_SPRITE) -s -l ripple_none_sprite boat_sprites.png 0 168 6 169 >> boat_sprites.inc
####
@ -83,12 +90,6 @@ fish_sprites.inc: fish_sprites.png
$(HGR_SPRITE) -s -l big_bubble_mask fish_sprites.png 0 101 6 104 >> fish_sprites.inc
$(HGR_SPRITE) -s -l med2_bubble_mask fish_sprites.png 0 108 6 110 >> fish_sprites.inc
####
clean:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

119
games/sb/fish/random16.s Normal file
View File

@ -0,0 +1,119 @@
; 16-bit 6502 Random Number Generator (cycle-invariant version)
; Linear feedback shift register PRNG by White Flame
; http://codebase64.org/doku.php?id=base:small_fast_16-bit_prng
; The Apple II KEYIN routine increments SEEDL:SEEDH
; while waiting for keypress
;SEEDL = $4E
;SEEDH = $4F
XOR_MAGIC = $7657 ; "vW"
;=============================
; random16
;=============================
; takes:
; not 0, cs = 6(r16)+12(lnz)+5(nop)+ 19(deo) = 42
; not 0, cc = 6(r16)+14(lnz)+2(nop)+ 20(neo) = 42
; $0000 = 6(r16)+ 6(loz)+11nops+ 19(deo) = 42
; $8000 = 6(r16)+ 6(loz)+ 4(ceo) + 6nops+ 20(neo) = 42
; $XX00 cc = 6(r16)+ 6(loz)+4(ceo)+2(cep) +4nops+ 20(neo) = 42
; $XX00 cs = 6(r16)+ 6(loz)+4(ceo)+4(cep) +3nops+ 19(deo) = 42*
random16:
lda SEEDL ; 3
beq low_zero ; $0000 and $8000 are special values ; 3
;==========
; 6
lownz:
; -1
asl SEEDL ; Do a normal shift ; 5
lda SEEDH ; 3
rol ; 2
bcs five_cycle_do_eor ; 3
;===========
; 12
bcc two_cycle_no_eor ; 3
;==========
; 12+3-1 = 14
;===================================================================
eleven_cycle_do_eor:
nop ; 2
nop ; 2
nop ; 2
five_cycle_do_eor:
nop ; 2
three_cycle_do_eor:
sta SEEDH ; nop ; 3
do_eor:
; high byte is in A
eor #>XOR_MAGIC ; 2
sta SEEDH ; 3
lda SEEDL ; 3
eor #<XOR_MAGIC ; 2
sta SEEDL ; 3
eor_rts:
rts ; 6
;===========
; 19
;=========================================================================
six_cycles_no_eor:
nop ; 2
four_cycle_no_eor:
nop ; 2
two_cycle_no_eor:
nop ; 2
no_eor:
nop ; 2
nop ; 2
nop ; 2
nop ; 2
sta SEEDH ; 3
jmp eor_rts ; 3+6
;===========
; 20
;======================================================================
;======================================================================
low_zero:
lda SEEDH ; 3
beq eleven_cycle_do_eor ; High byte is also zero ; 3
; so apply the EOR
;============
; 6
ceo:
; -1
; wasn't zero, check for $8000
asl ; 2
beq six_cycles_no_eor ; if $00 is left after the shift; 3
; then it was $80
;===========
; 4
; else, do the EOR based on the carry
cep:
; -1
bcc four_cycle_no_eor ; 3
;============
; 2
bcs three_cycle_do_eor ; 2+3-1 = 4

View File

@ -38,11 +38,12 @@ INSTRUMENT1 = $09
INSTRUMENT2 = $1D
MADDRL = $1E
MADDRH = $1F
LOC4E = $4E
COUNT256 = $4F
;LOC4E = $4E
;COUNT256 = $4F
WHICH_PAGE = $50
SEEDL = $4E
SEEDH = $4F
; dos33 zero page = 26-2f, 35-38, 3e 3f 40-4d
; overlap applesoft 67-6a,6f,70,af,b0,ca-cd,d8

View File

@ -186,7 +186,7 @@ sector_array:
length_array:
.byte 40, 16, 16, 70 ; TITLE, DUCK, ROOF, ASPLODE
.byte 32, 90, 32, 24 ; ?, FISH, RAT, BACK_OFF
.byte 32, 92, 32, 24 ; ?, FISH, RAT, BACK_OFF
qload_end: