million-perfect-letters/src/ui.interstitial.a

118 lines
2.8 KiB
Plaintext

;license:MIT
;(c) 2019 by qkumba
;(c) 2020 by 4am
;
; animated interstitial screen
;
; Public functions:
; - MaybeShowInterstitial
;
progressStringsLo
!byte <sProgress10
!byte <sProgress20
!byte <sProgress30
!byte <sProgress40
!byte <sProgress50
!byte <sProgress60
!byte <sProgress70
!byte <sProgress80
!byte <sProgress90
!byte <sProgress100
progressStringsHi
!byte >sProgress10
!byte >sProgress20
!byte >sProgress30
!byte >sProgress40
!byte >sProgress50
!byte >sProgress60
!byte >sProgress70
!byte >sProgress80
!byte >sProgress90
!byte >sProgress100
progressHTABs
!byte 7
!byte 8
!byte 8
!byte 8
!byte 7
!byte 2
!byte 9
!byte 7
!byte 6
!byte 4
;------------------------------------------------------------------------------
; MaybeShowInterstitial
; display interstitial progress animation after every 10 completed puzzles
;
; in: A = next puzzle ID (in this world)
; X = # of puzzles completed (in this world)
; out: preserves A
; C set if all puzzles were completed
; C clear if there are more puzzles in this world (and A = next puzzle ID)
; Y, other flags clobbered
;------------------------------------------------------------------------------
MaybeShowInterstitial
pha
cpx #100
bne +
ldy #10
jsr ShowInterstitialWorldComplete
sec
bcs @exit ; always branches
+ ldy #0
- iny
dex
dex
dex
dex
dex
dex
dex
dex
dex
dex ; don't judge me
bmi +
bne -
jsr ShowInterstitialWorldProgress
+ clc
@exit pla
rts
ShowInterstitialWorldProgress
ShowInterstitialWorldComplete
; [private]
; in: Y = which progress string to display (1..9)
; out: all registers and flags clobbered
bit CLEARKBD
tya
tax
dex
jsr Home
lda #11
sta targetVTAB
lda progressHTABs, x
sta minHTAB
lda progressStringsHi, x
tay
lda progressStringsLo, x
jsr HeavySilkReveal
lda KBD
bmi +
; wildcard, will allow any key to terminate sound
+LDADDR sOneSpace
+ST16 $EE
+LDADDR InterstitialProgressMusic
jsr PlaySound
ldx #21
jsr LongWaitForKeyWithTimeout
bmi +
lda #0
sta targetVTAB
sta minHTAB
+LDADDR sOneSpace
jsr HeavySilkReveal
+ jmp Home