2023-07-23 21:59:55 +00:00
|
|
|
;
|
|
|
|
; titleScreen
|
|
|
|
; A friendly place to start the game
|
|
|
|
;
|
|
|
|
; Created by Quinn Dunki on 7/23/23
|
|
|
|
;
|
|
|
|
|
|
|
|
.a16
|
|
|
|
.i16
|
|
|
|
|
|
|
|
titlePalette:
|
|
|
|
.word $06af,$0072,$0072,$0861,$0c93,$0eb4,$0d66,$0f9a,$0777,$0d00,$0bbb,$ddd,$007b,$0a5b,$0000,$0fff
|
|
|
|
|
|
|
|
TITLE_ANIMATION_FRAMES = 5
|
|
|
|
CAT_DELAY = 300
|
2023-07-25 03:29:11 +00:00
|
|
|
CAT0_VRAM = $5d79
|
|
|
|
CAT1_VRAM = $5da0
|
2023-07-23 21:59:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; titleScreen
|
|
|
|
;
|
|
|
|
; Shows the title screen and main game menu
|
|
|
|
;
|
|
|
|
titleScreen:
|
|
|
|
lda #%10000000 ; Set all SCBs to 320, no interrupts, palette 0
|
|
|
|
jsr initSCBs
|
2023-07-25 21:33:23 +00:00
|
|
|
stz leftScreenEdge
|
2023-07-23 21:59:55 +00:00
|
|
|
|
|
|
|
; Copy title screen art from where it was loaded in bank 6
|
|
|
|
; This isn't fast, but doesn't need to be
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
titleScreenCopyLoop:
|
|
|
|
lda $060000,x
|
2023-07-25 03:29:11 +00:00
|
|
|
sta SHADOWVRAM,x
|
2023-07-23 21:59:55 +00:00
|
|
|
inx
|
|
|
|
inx
|
|
|
|
cpx #$7d00
|
|
|
|
bne titleScreenCopyLoop
|
|
|
|
|
|
|
|
; Set up sprite rendering
|
|
|
|
BITS8
|
|
|
|
lda #3
|
|
|
|
sta SpriteBankBank00+3 ; Tell compiled sprites what bank they are in
|
|
|
|
BITS16
|
|
|
|
|
|
|
|
; Set up audio
|
|
|
|
jsr initSoundSystem
|
|
|
|
|
2023-07-25 03:29:11 +00:00
|
|
|
; Render menu text
|
|
|
|
jsr titleScreenRenderMenu
|
|
|
|
|
2023-07-29 23:31:17 +00:00
|
|
|
jsr setBorderAtScanLine
|
|
|
|
|
2023-07-23 21:59:55 +00:00
|
|
|
; Fade in
|
|
|
|
lda #titlePalette
|
|
|
|
sta PARAML2
|
|
|
|
jsr paletteFade
|
|
|
|
|
2023-07-25 03:29:11 +00:00
|
|
|
ldy #CAT0_VRAM ; Save a generic background to erase cats
|
|
|
|
jsr protectAnimation16x16
|
|
|
|
|
2023-07-23 21:59:55 +00:00
|
|
|
titleScreenMainLoop:
|
|
|
|
|
|
|
|
; Track animations
|
2023-07-29 23:35:11 +00:00
|
|
|
;jsr syncOverscanBottom ; This looks awesome but makes interactivity terrible
|
2023-07-29 23:31:17 +00:00
|
|
|
jsr syncVBL
|
2023-07-29 23:35:11 +00:00
|
|
|
;BORDER_COLOR #$7
|
2023-07-29 23:31:17 +00:00
|
|
|
|
2023-07-23 21:59:55 +00:00
|
|
|
lda titleAnimationCounter
|
|
|
|
inc
|
|
|
|
cmp TITLE_ANIMATION_FRAMES
|
|
|
|
jsr titleScreenResetAnimation
|
|
|
|
|
2023-07-29 23:31:17 +00:00
|
|
|
; Update current animation if needed
|
|
|
|
lda animationState+AS_CURRENTFRAME
|
|
|
|
bmi titleScreenIdle
|
|
|
|
jsr tickAnimation
|
|
|
|
bra titleScreenKeyboard
|
|
|
|
|
|
|
|
titleScreenIdle:
|
|
|
|
|
|
|
|
; Time start of cat 0 animation
|
2023-07-23 21:59:55 +00:00
|
|
|
lda animationDelay0
|
|
|
|
dec
|
|
|
|
bne titleScreenStillCat
|
|
|
|
lda #CAT_DELAY
|
|
|
|
sta animationDelay0
|
|
|
|
|
2023-07-29 23:31:17 +00:00
|
|
|
; Start new cat 0 animation
|
2023-07-25 03:29:11 +00:00
|
|
|
ldy #CAT0_VRAM
|
|
|
|
jsr unrenderAnimation16x16
|
|
|
|
|
2023-07-23 21:59:55 +00:00
|
|
|
lda #titleAnimationPos0
|
|
|
|
sta PARAML0
|
|
|
|
ldx #TITLE_ANIMATION_FRAMES
|
|
|
|
ldy #30
|
|
|
|
lda #ANIMATION_SIZE_16x32
|
2023-07-29 23:31:17 +00:00
|
|
|
jsr startAnimation
|
2023-07-23 21:59:55 +00:00
|
|
|
bra titleScreenNextCat
|
|
|
|
|
|
|
|
titleScreenStillCat:
|
2023-07-29 23:31:17 +00:00
|
|
|
|
|
|
|
; Render idle cat 0
|
2023-07-23 21:59:55 +00:00
|
|
|
sta animationDelay0
|
2023-07-25 03:29:11 +00:00
|
|
|
ldy #CAT0_VRAM
|
2023-07-23 21:59:55 +00:00
|
|
|
lda #29
|
|
|
|
jsr drawSpriteBankSafe
|
|
|
|
|
|
|
|
titleScreenNextCat:
|
2023-07-29 23:31:17 +00:00
|
|
|
|
|
|
|
; Time start of cat 1 animation
|
2023-07-23 21:59:55 +00:00
|
|
|
lda animationDelay1
|
|
|
|
dec
|
|
|
|
bne titleScreenStillCat2
|
|
|
|
lda #CAT_DELAY
|
|
|
|
sta animationDelay1
|
|
|
|
|
2023-07-29 23:31:17 +00:00
|
|
|
; Start new cat 1 animation
|
2023-07-25 03:29:11 +00:00
|
|
|
ldy #CAT1_VRAM
|
|
|
|
jsr unrenderAnimation16x16
|
|
|
|
|
2023-07-23 21:59:55 +00:00
|
|
|
lda #titleAnimationPos1
|
|
|
|
sta PARAML0
|
|
|
|
ldx #TITLE_ANIMATION_FRAMES
|
|
|
|
ldy #21
|
|
|
|
lda #ANIMATION_SIZE_16x32
|
2023-07-29 23:31:17 +00:00
|
|
|
jsr startAnimation
|
2023-07-23 21:59:55 +00:00
|
|
|
bra titleScreenKeyboard
|
|
|
|
|
|
|
|
titleScreenStillCat2:
|
2023-07-29 23:31:17 +00:00
|
|
|
|
|
|
|
; Render idle cat 1
|
2023-07-23 21:59:55 +00:00
|
|
|
sta animationDelay1
|
2023-07-25 03:29:11 +00:00
|
|
|
ldy #CAT1_VRAM
|
2023-07-23 21:59:55 +00:00
|
|
|
lda #20
|
|
|
|
jsr drawSpriteBankSafe
|
|
|
|
|
|
|
|
titleScreenKeyboard:
|
2023-07-29 23:31:17 +00:00
|
|
|
|
2023-07-23 21:59:55 +00:00
|
|
|
; Check for selection
|
|
|
|
jsr kbdScanTitle
|
2023-07-25 21:33:23 +00:00
|
|
|
jsr kbdScanDebug
|
2023-07-23 21:59:55 +00:00
|
|
|
lda menuActionRequested
|
2023-07-25 03:29:11 +00:00
|
|
|
beq titleScreenMainLoopEndFrame
|
2023-07-23 21:59:55 +00:00
|
|
|
|
2023-07-25 03:29:11 +00:00
|
|
|
cmp #-1
|
|
|
|
beq titleScreenKeyboardMenuUp
|
|
|
|
cmp #1
|
|
|
|
beq titleScreenKeyboardMenuDown
|
|
|
|
cmp #2
|
|
|
|
beq titleScreenKeyboardMenuGo
|
|
|
|
bra titleScreenMainLoopEndFrame
|
2023-07-23 21:59:55 +00:00
|
|
|
|
|
|
|
titleScreenResetAnimation:
|
|
|
|
stz titleAnimationCounter
|
|
|
|
rts
|
|
|
|
|
2023-07-25 03:29:11 +00:00
|
|
|
titleScreenKeyboardMenuUp:
|
|
|
|
lda menuSelection
|
|
|
|
beq titleScreenMainLoopEndFrame
|
|
|
|
dec
|
|
|
|
sta menuSelection
|
|
|
|
jsr titleScreenRenderMenu
|
|
|
|
bra titleScreenMainLoopEndFrame
|
|
|
|
|
|
|
|
titleScreenKeyboardMenuDown:
|
|
|
|
lda menuSelection
|
|
|
|
cmp #2
|
|
|
|
beq titleScreenMainLoopEndFrame
|
|
|
|
inc
|
|
|
|
sta menuSelection
|
|
|
|
jsr titleScreenRenderMenu
|
|
|
|
bra titleScreenMainLoopEndFrame
|
|
|
|
|
|
|
|
titleScreenKeyboardMenuGo:
|
|
|
|
lda menuSelection
|
|
|
|
beq titleScreenBeginGame
|
2023-08-06 22:55:42 +00:00
|
|
|
cmp #1
|
|
|
|
beq titleScreenHelp
|
2023-07-25 03:29:11 +00:00
|
|
|
cmp #2
|
|
|
|
beq titleScreenQuit
|
|
|
|
|
|
|
|
titleScreenMainLoopEndFrame:
|
|
|
|
stz menuActionRequested
|
|
|
|
jmp titleScreenMainLoop
|
|
|
|
|
|
|
|
titleScreenBeginGame:
|
2023-07-25 21:33:23 +00:00
|
|
|
; Transition to gameplay
|
2023-08-06 22:55:42 +00:00
|
|
|
jsr titleScreenRemoveBorderEffect
|
2023-07-25 21:33:23 +00:00
|
|
|
stz menuActionRequested
|
|
|
|
lda #skyPalette
|
|
|
|
sta PARAML2
|
|
|
|
jsr paletteFade
|
2023-07-25 03:29:11 +00:00
|
|
|
jmp beginGameplay
|
|
|
|
|
|
|
|
titleScreenQuit:
|
2023-08-06 22:55:42 +00:00
|
|
|
jsr titleScreenRemoveBorderEffect
|
2023-07-25 03:29:11 +00:00
|
|
|
jmp quitGame
|
|
|
|
|
2023-08-06 22:55:42 +00:00
|
|
|
titleScreenHelp:
|
|
|
|
jsr titleScreenRemoveBorderEffect
|
|
|
|
stz menuActionRequested
|
|
|
|
|
|
|
|
; Fade out
|
|
|
|
lda #skyPalette
|
|
|
|
sta PARAML2
|
|
|
|
jsr paletteFade
|
|
|
|
jmp titleScreenRenderHelp
|
|
|
|
|
|
|
|
titleScreenRemoveBorderEffect:
|
|
|
|
jsr unsetVBLInterruptVector
|
|
|
|
jsr unsetScanLineInterruptVector
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2023-07-23 21:59:55 +00:00
|
|
|
titleAnimationCounter:
|
|
|
|
.word 0
|
|
|
|
titleAnimationPos0:
|
2023-07-25 21:33:23 +00:00
|
|
|
.word 114,120
|
2023-07-23 21:59:55 +00:00
|
|
|
titleAnimationPos1:
|
2023-07-25 21:33:23 +00:00
|
|
|
.word 192,120
|
2023-07-23 21:59:55 +00:00
|
|
|
animationDelay0:
|
|
|
|
.word CAT_DELAY/2
|
|
|
|
animationDelay1:
|
|
|
|
.word CAT_DELAY
|
|
|
|
menuActionRequested:
|
|
|
|
.word 0
|
2023-07-25 03:29:11 +00:00
|
|
|
selectionString:
|
|
|
|
pstring "[[[[[[[[[[[[[[[["
|
|
|
|
unselectionString:
|
|
|
|
pstring "\\\\\\\\\\\\\\\\"
|
|
|
|
startString:
|
|
|
|
pstring "BEGIN GAME"
|
|
|
|
helpString:
|
|
|
|
pstring "HOW TO PLAY"
|
|
|
|
quitString:
|
|
|
|
pstring "QUIT"
|
|
|
|
menuSelection:
|
|
|
|
.word 0
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; titleScreenRenderMenu
|
|
|
|
;
|
|
|
|
; Render the game menu
|
|
|
|
;
|
|
|
|
; Trashes A
|
|
|
|
;
|
|
|
|
titleScreenRenderMenu:
|
|
|
|
|
|
|
|
ldy #$78f0
|
|
|
|
jsr titleScreenUnRenderSelection
|
|
|
|
lda menuSelection
|
|
|
|
bne titleScreenRenderMenuItem0
|
|
|
|
ldy #$78f0
|
|
|
|
jsr titleScreenRenderSelection
|
|
|
|
|
|
|
|
titleScreenRenderMenuItem0:
|
|
|
|
lda #startString
|
|
|
|
sta PARAML0
|
|
|
|
lda #1
|
|
|
|
ldy #$78fc
|
|
|
|
jsl renderStringFar
|
|
|
|
|
|
|
|
ldy #$7f30
|
|
|
|
jsr titleScreenUnRenderSelection
|
|
|
|
lda menuSelection
|
|
|
|
cmp #1
|
|
|
|
bne titleScreenRenderMenuItem1
|
|
|
|
ldy #$7f30
|
|
|
|
jsr titleScreenRenderSelection
|
|
|
|
|
|
|
|
titleScreenRenderMenuItem1:
|
|
|
|
lda #helpString
|
|
|
|
sta PARAML0
|
|
|
|
lda #1
|
|
|
|
ldy #$7f39
|
|
|
|
jsl renderStringFar
|
|
|
|
|
|
|
|
ldy #$8570
|
|
|
|
jsr titleScreenUnRenderSelection
|
|
|
|
lda menuSelection
|
|
|
|
cmp #2
|
|
|
|
bne titleScreenRenderMenuItem2
|
|
|
|
ldy #$8570
|
|
|
|
jsr titleScreenRenderSelection
|
|
|
|
|
|
|
|
titleScreenRenderMenuItem2:
|
|
|
|
lda #quitString
|
|
|
|
sta PARAML0
|
|
|
|
lda #1
|
|
|
|
ldy #$8588
|
|
|
|
jsl renderStringFar
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; titleScreenRenderSelection
|
|
|
|
;
|
|
|
|
; Render the menu selection bar
|
|
|
|
;
|
|
|
|
; Y = VRAM position of bar
|
|
|
|
;
|
|
|
|
titleScreenRenderSelection:
|
|
|
|
lda #selectionString
|
|
|
|
sta PARAML0
|
|
|
|
lda #1
|
|
|
|
jsl renderStringFar
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; titleScreenUnRenderSelection
|
|
|
|
;
|
|
|
|
; Unrender the menu selection bar
|
|
|
|
;
|
|
|
|
; Y = VRAM position of bar
|
|
|
|
;
|
|
|
|
titleScreenUnRenderSelection:
|
|
|
|
lda #unselectionString
|
|
|
|
sta PARAML0
|
|
|
|
lda #1
|
|
|
|
jsl renderStringFar
|
|
|
|
rts
|
2023-08-06 22:55:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; titleScreenRenderHelp
|
|
|
|
;
|
|
|
|
; Render the help menu
|
|
|
|
;
|
|
|
|
titleScreenRenderHelp:
|
|
|
|
SAVE_AXY
|
|
|
|
|
|
|
|
; Clear screen
|
|
|
|
ldx #0
|
|
|
|
ldy #200
|
|
|
|
jsr colorFill
|
|
|
|
|
|
|
|
; Draw help text
|
|
|
|
lda #helpText0
|
|
|
|
sta PARAML0
|
|
|
|
ldy #$2c8a
|
|
|
|
lda #1
|
|
|
|
jsl renderStringFar
|
|
|
|
|
|
|
|
lda #helpText1
|
|
|
|
sta PARAML0
|
|
|
|
ldy #$32ca
|
|
|
|
lda #1
|
|
|
|
jsl renderStringFar
|
|
|
|
|
|
|
|
lda #helpText2
|
|
|
|
sta PARAML0
|
|
|
|
ldy #$390a
|
|
|
|
lda #1
|
|
|
|
jsl renderStringFar
|
|
|
|
|
|
|
|
lda #helpText3
|
|
|
|
sta PARAML0
|
|
|
|
ldy #$4bed
|
|
|
|
lda #2
|
|
|
|
jsl renderStringFar
|
|
|
|
|
|
|
|
lda #helpText4
|
|
|
|
sta PARAML0
|
|
|
|
ldy #$572d
|
|
|
|
lda #2
|
|
|
|
jsl renderStringFar
|
|
|
|
|
|
|
|
lda #helpText5
|
|
|
|
sta PARAML0
|
|
|
|
ldy #$6265
|
|
|
|
lda #2
|
|
|
|
jsl renderStringFar
|
|
|
|
|
|
|
|
lda #helpText6
|
|
|
|
sta PARAML0
|
|
|
|
ldy #$6dad
|
|
|
|
lda #2
|
|
|
|
jsl renderStringFar
|
|
|
|
|
|
|
|
lda #helpText7
|
|
|
|
sta PARAML0
|
|
|
|
ldy #$78ed
|
|
|
|
lda #2
|
|
|
|
jsl renderStringFar
|
|
|
|
|
|
|
|
lda #helpText8
|
|
|
|
sta PARAML0
|
2023-08-06 23:58:32 +00:00
|
|
|
ldy #$8435
|
|
|
|
lda #2
|
|
|
|
jsl renderStringFar
|
|
|
|
|
|
|
|
lda #helpText9
|
|
|
|
sta PARAML0
|
2023-08-06 22:55:42 +00:00
|
|
|
ldy #$90b7
|
|
|
|
lda #1
|
|
|
|
jsl renderStringFar
|
|
|
|
|
|
|
|
; Fade in
|
|
|
|
lda #titlePalette
|
|
|
|
sta PARAML2
|
|
|
|
jsr paletteFade
|
|
|
|
|
|
|
|
jsr kbdWaitForAnyKey
|
|
|
|
|
|
|
|
; Fade out
|
|
|
|
lda #skyPalette
|
|
|
|
sta PARAML2
|
|
|
|
jsr paletteFade
|
|
|
|
|
|
|
|
RESTORE_AXY
|
|
|
|
jmp titleScreen
|
|
|
|
|
|
|
|
helpText0:
|
|
|
|
pstring "SPROCKET AND TINKER DO NOT GET ALONG!"
|
|
|
|
helpText1:
|
|
|
|
pstring "YOUR GOAL IS TO ANGER THE OTHER CAT"
|
|
|
|
helpText2:
|
|
|
|
pstring "SO MUCH THAT SHE PEES AND RUNS OFF."
|
|
|
|
helpText3:
|
|
|
|
pstring "_^ AIM"
|
|
|
|
helpText4:
|
|
|
|
pstring "\] POWER"
|
|
|
|
helpText5:
|
|
|
|
pstring "`ab FIRE"
|
|
|
|
helpText6:
|
|
|
|
pstring "ef WEAPON"
|
|
|
|
helpText7:
|
|
|
|
pstring "cd SCROLL"
|
|
|
|
helpText8:
|
2023-08-06 23:58:32 +00:00
|
|
|
pstring "g QUIT"
|
|
|
|
helpText9:
|
2023-08-06 22:55:42 +00:00
|
|
|
pstring "PRESS ANY KEY"
|