cover fade animation

This commit is contained in:
4am 2019-06-21 13:10:29 -04:00
parent d660ef4da6
commit bba3d755e2
84 changed files with 8438 additions and 31 deletions

View File

@ -23,6 +23,7 @@ CADIUS=cadius
asm: md
$(ACME) -r build/4cade.lst src/4cade.a 2>build/relbase.log
$(ACME) -r build/4cade.lst -DRELBASE=`cat build/relbase.log | grep "RELBASE =" | cut -d"=" -f2 | cut -d"(" -f2 | cut -d")" -f1` src/4cade.a
$(ACME) src/fx/fx.cover.fade.a
$(ACME) src/fx/fx.dhgr.ripple.a
$(ACME) src/fx/fx.dhgr.iris.a
$(ACME) src/fx/fx.dhgr.radial.a

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

24
res/cover-animation/generate.py Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
STAGES = 75
BASE_ADDRESS = 8192
print("TransformLo")
for i in range(0, STAGES):
print(" !byte <Transform{:02d}".format(i))
print("TransformHi")
for i in range(0, STAGES):
print(" !byte >Transform{:02d}".format(i))
print()
for i in range(0, STAGES):
with open("PI.A{:02d}#064000".format(i) , "rb") as f:
olddata = f.read()
with open("PI.A{:02d}#064000".format(i + 1), "rb") as f:
newdata = f.read()
print("Transform{:02d}".format(i))
print(" lda #$00")
for j in range(0, len(olddata)):
if olddata[j] != newdata[j]:
print(" sta ${:04X}".format(BASE_ADDRESS + j))
print(" rts")
print()

View File

@ -1,3 +1,4 @@
COVERFADE=Type(06),AuxType(6000),Access(C3)
DIAGONAL=Type(06),AuxType(6000),Access(C3)
FIZZLE=Type(06),AuxType(6000),Access(C3)
INTERLOCK.UD=Type(06),AuxType(6000),Access(C3)

View File

@ -62,7 +62,7 @@ Main
jsr SearchMode
jmp @loop
Mode
!byte $80
!byte $00
; these routines will only be called after relocating to language card
!source "src/ui.search.mode.a"

104
src/fx/fx.cover.fade.a Normal file
View File

@ -0,0 +1,104 @@
;license:MIT
;(c) 2019 by 4am
;
; randomized fade-to-black routine customized for a specific piece of cover art
; with 75 fill rectangles
;
; Linear Congruential Pseudo-Random Number Generator
; (c) 2004 Bruce Clark
; http://www.6502.org/source/integers/random/random.html
!cpu 6502
!to "build/FX/COVERFADE",plain
*=$6000
COUNTER = $F7
SEED = $F8 ; 4 bytes
TMP = $FC ; 4 bytes
jsr InitPRNG
lda #75
sta COUNTER
- jsr PRNG
lda SEED+3
and #$7F
cmp #75
bcs -
tax
ldy Order,x
cpy #$FF
bne -
dec COUNTER
lda COUNTER
sta Order,x
bne -
lda #74
sta COUNTER
- lda $C000
bmi @done
ldx COUNTER
ldy Order,x
lda TransformHi,y
sta @j+2
lda TransformLo,y
sta @j+1
@j jsr $FDFD ; SMC
lda #80
jsr WaitForKeyWithTimeout
dec COUNTER
bpl -
@done rts
InitPRNG
lda $4E
sta SEED
lda $4F
sta SEED+1
lda $c050
sta SEED+2
lda $c000
sta SEED+3
rts
RAND7BIT
rts
PRNG
lda #$01
ldx #$03
- sta TMP,x
lsr
dex
bpl -
ldy #$20
bne @rotateseed ; always branches
@loop bcc @rotatetmp
clc
ldx #$03
- lda TMP,x
adc @randtable,x
sta TMP,x
dex
bpl -
@rotatetmp
ror TMP
ror TMP+1
ror TMP+2
ror TMP+3
@rotateseed
ror SEED+3
ror SEED+2
ror SEED+1
ror SEED
dey
bpl @loop
rts
@randtable
!byte $00,$19,$66,$0D
Order
!fill 75,$FF
!source "src/wait.a"
!source "src/fx/fx.cover.fade.data.a"

4197
src/fx/fx.cover.fade.data.a Normal file

File diff suppressed because it is too large Load Diff

View File

@ -33,23 +33,30 @@ SearchMode
bit $C050
bit $C010
jsr _ResetInputTimeout
InputLoop
_SearchModeInputLoop
- lda $C000
bmi +
dec $4F
bne -
dec $4E
bne -
dec $4D
bmi @gotKey
inc $4F ; these are only ever incremented, never
bne + ; reset (used as a pseudorandom seed)
inc $4E
+
dec $50 ; these are a 3-byte timeout counter
bne - ; that counts down from a number set
dec $51 ; in _ResetInputTimeout and reset
bne - ; on every keypress (whether or not
dec $52 ; the key leads to an action)
bne -
jsr _CoverFade
lda #kAttractMode ; no input for ~30 seconds
sta Mode ; switch to attract mode
rts
+
@gotKey
jsr _ResetInputTimeout
cmp #$9B ; Esc clears the input buffer
bne +
cmp #$9B ; Esc clears the input buffer (if any)
bne + ; or switches to attract mode
ldx #kInputClear
bne InputDispatch ; always branches
+
@ -87,7 +94,7 @@ InputLoop
; execution falls through here
@badkey
jsr SoftBell ; beep on invalid input
jmp InputLoop ; and start over
jmp _SearchModeInputLoop ; and start over
@goodkey
ldx #kInputSearch
@ -103,7 +110,7 @@ InputDispatch
sta @j+2
pla ; restore key pressed
@j jsr $FDFD ; SMC
jmp InputLoop
jmp _SearchModeInputLoop
OnClear
ldx InputLength
@ -114,7 +121,7 @@ OnClear
rts
+ ldx #0
stx InputLength
bit $c010
bit $C010
jmp OnInputChanged
OnBack
@ -123,7 +130,7 @@ OnBack
jsr SoftBell
rts
+ dec InputLength
bit $c010
bit $C010
jmp OnInputChanged
OnLaunch
@ -163,17 +170,7 @@ OnInputChanged
lda #$7F
sta UILine2+1
lda OffscreenPage
beq +
lda #$40
+HIDE_NEXT_2_BYTES
+ lda #$20
sta @coveraddress+1
+LDADDR Cover
jsr SetPath
jsr LoadFileAt ; load default background
@coveraddress
!word $FD00
jsr _LoadCoverOffscreen
jsr _DrawSearchBarOffscreen
jmp _ShowOtherPage
@ -271,6 +268,22 @@ OnInputChanged
jsr _DrawSearchBarOffscreen; actually draw the search UI (offscreen)
jmp _ShowOtherPage ; now show everything at once
;------------------------------------------------------------------------------
_LoadCoverOffscreen
lda OffscreenPage
beq +
lda #$40
+HIDE_NEXT_2_BYTES
+ lda #$20
sta @coveraddress+1
+LDADDR Cover
jsr SetPath
jsr LoadFileAt ; load default background
@coveraddress
!word $FD00 ; SMC
rts
_DrawSearchBarOffscreen
lda #22 ; draw visible search bar
sta VTAB
@ -330,13 +343,34 @@ _UpdateGameCount
_ResetInputTimeout
; clobbers X, preserves A/Y
ldx #$24
stx $4D ; timeout counter
stx $4E
stx $4F
ldx #$16
stx $50 ; timeout counter
stx $51
stx $52
rts
;------------------------------------------------------------------------------
_CoverFade
jsr _LoadCoverOffscreen
jsr _ShowOtherPage
lda OffscreenPage
bne +
jsr _LoadCoverOffscreen
jsr _ShowOtherPage
+
; load transition effect code at $6000
+LDADDR kFXDirectory
jsr SetPath
+LDADDR kPathSeparator
jsr AddToPath
+LDADDR kFXCoverFade
jsr AddToPath
jsr LoadFile
jmp $6000
kFXCoverFade
!byte 9
!text "COVERFADE"
Cover !byte 5
!text "COVER"