Add post credits tracker

This commit is contained in:
Kevin Cathcart
2018-09-09 17:43:40 -04:00
parent 889908368a
commit d8e196bf7a
4 changed files with 184 additions and 17 deletions

View File

@@ -165,13 +165,13 @@ R GAME STATS
- -
- -
- -
-
-
-
-
-
-
- -
COLLECTION RATE $$$$/216 COLLECTION RATE $$$$/216
TOTAL TIME $$$$$$$$$$$ TOTAL TIME $$$$$$$$$$$
-
-
-
-
-
-

View File

@@ -552,7 +552,7 @@ RTS
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
AltBufferTable: AltBufferTable:
LDA.b #$02 : STA $210c ; Have Screen 3 use same tile area as screens 1 LDA.b #$02 : STA $210c ; Have Screen 3 use same tile area as screens 1
.noScreen3Change
REP #$20 REP #$20
LDX.w #$0380 ; 14 rows with 64 bytes (30 tiles * 2 + 4 byte header) LDX.w #$0380 ; 14 rows with 64 bytes (30 tiles * 2 + 4 byte header)
;fill with the blank character ;fill with the blank character
@@ -605,6 +605,59 @@ AltBufferTable:
SEP #$20 SEP #$20
RTL RTL
;--------------------------------------------------------------------------------
AltBufferTable_credits:
JSL AltBufferTable_noScreen3Change
REP #$20
LDA.w #$6168 : STA $1002 ;file 1 top row
LDA.w #$8168 : STA $1042 ;file 1 bottom row
LDA.w #$A168 : STA $1082 ;gap row top
LDA.w #$C168 : STA $10C2 ;gap row bottom
LDA.w #$E168 : STA $1102 ;file 2 top row
LDA.w #$0169 : STA $1142 ;file 2 bottom row
LDA.w #$2169 : STA $1182 ;gap row top
LDA.w #$4169 : STA $11c2 ;gap row bottom
LDA.w #$6169 : STA $1202 ;file 3 top row
LDA.w #$8169 : STA $1242 ;file 3 bottom row
LDA.w #$A169 : STA $1282 ;extra gap row top
LDA.w #$C169 : STA $12c2 ;extra gap row bottom
LDA.w #$E169 : STA $1302 ;extra gap row top
LDA.w #$016A : STA $1342 ;extra gap row bottom
SEP #$20
RTL
;--------------------------------------------------------------------------------
macro LayoutPriority(address)
LDX.w #$003C
- : LDA.w <address>, X : ORA #$2000 : STA.w <address>, X
DEX : DEX : BNE -
endmacro
SetItemLayoutPriority:
REP #$30
%LayoutPriority($1004)
%LayoutPriority($1044)
%LayoutPriority($1084)
%LayoutPriority($10C4)
%LayoutPriority($1104)
%LayoutPriority($1144)
%LayoutPriority($1184)
%LayoutPriority($11c4)
%LayoutPriority($1204)
%LayoutPriority($1244)
%LayoutPriority($1284)
%LayoutPriority($12c4)
%LayoutPriority($1304)
%LayoutPriority($1344)
RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
Validate_SRAM: Validate_SRAM:
RTL RTL
@@ -629,8 +682,8 @@ LoadFullItemTiles:
LDA.b #$30 : STA $2117 ; write VRAM destination address LDA.b #$30 : STA $2117 ; write VRAM destination address
LDA.b #$31 : STA $4304 ; set bus A source bank LDA.b #$31 : STA $4304 ; set bus A source bank
LDA.b #FileSelectNewGraphics : STA $4302 ; set bus A source address to SRAM LDA.b #FileSelectNewGraphics : STA $4302 ; set bus A source address to ROM
LDA.b #FileSelectNewGraphics>>8 : STA $4303 ; set bus A source address to SRAM LDA.b #FileSelectNewGraphics>>8 : STA $4303 ; set bus A source address to ROM
LDA $2100 : PHA : LDA.b #$80 : STA $2100 ; save screen state & turn screen off LDA $2100 : PHA : LDA.b #$80 : STA $2100 ; save screen state & turn screen off
@@ -649,3 +702,51 @@ LoadFullItemTiles:
PLX : PLA PLX : PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadPaletteCredits:
PHA : PHX
REP #$20
LDX.b #$40
-
LDA.l GFX_HUD_Palette, X
STA.l $7EC500, X
DEX : DEX
BPL -
SEP #$20
INC $15 ; ensure CGRAM gets updated
PLX : PLA
RTL
;--------------------------------------------------------------------------------
DrawPlayerFile_credits:
; see $6563C for drawing first file name and hearts
REP #$20 ; set 16 bit accumulator
LDA $7003D9 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,3)
LDA $7003DB : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,5)
LDA $7003DD : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,7)
LDA $7003DF : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,9)
LDA $70036C : AND.w #$00FF : LSR #3 : STA $02
%fs_LDY_screenpos(0,20)
LDA.w #$028F|!FS_COLOR_RED
LDX.w #$000A
.nextHeart
STA.w $0000, Y
INY #2 : DEX : BNE +
PHA
TYA : !ADD.w #$40-$14 : TAY
PLA
+
DEC $02 : BNE .nextHeart
JSL DrawPlayerFile
RTL
;--------------------------------------------------------------------------------

View File

@@ -565,8 +565,8 @@ CreditsLineTable:
dw CreditsLine171, CreditsLine152, CreditsLine171, CreditsLine171, CreditsLine153, CreditsLine154, CreditsLine171, CreditsLine155 dw CreditsLine171, CreditsLine152, CreditsLine171, CreditsLine171, CreditsLine153, CreditsLine154, CreditsLine171, CreditsLine155
dw CreditsLine156, CreditsLine171, CreditsLine157, CreditsLine158, CreditsLine171, CreditsLine159, CreditsLine160, CreditsLine171 dw CreditsLine156, CreditsLine171, CreditsLine157, CreditsLine158, CreditsLine171, CreditsLine159, CreditsLine160, CreditsLine171
dw CreditsLine161, CreditsLine162, CreditsLine171, CreditsLine163, CreditsLine164, CreditsLine171, CreditsLine165, CreditsLine166 dw CreditsLine161, CreditsLine162, CreditsLine171, CreditsLine163, CreditsLine164, CreditsLine171, CreditsLine165, CreditsLine166
dw CreditsLine001, CreditsLine001, CreditsLine001, CreditsLine001, CreditsLine001, CreditsLine001, CreditsLine001, CreditsLine001 dw CreditsLine001, CreditsLine001, CreditsLine001, CreditsLine001, CreditsLine001, CreditsLine167, CreditsLine168, CreditsLine171
dw CreditsLine001, CreditsLine001, CreditsLine001, CreditsLine167, CreditsLine168, CreditsLine171, CreditsLine169, CreditsLine170 dw CreditsLine169, CreditsLine170, CreditsLine001, CreditsLine001, CreditsLine001, CreditsLine001, CreditsLine001, CreditsLine001
!FIRST_SWORD_X = 19 !FIRST_SWORD_X = 19
!FIRST_SWORD_Y = 319 !FIRST_SWORD_Y = 319
@@ -601,6 +601,6 @@ CreditsLineTable:
!TOTAL_LAG_TIME_X = 19 !TOTAL_LAG_TIME_X = 19
!TOTAL_LAG_TIME_Y = 374 !TOTAL_LAG_TIME_Y = 374
!COLLECTION_RATE_X = 22 !COLLECTION_RATE_X = 22
!COLLECTION_RATE_Y = 387 !COLLECTION_RATE_Y = 381
!TOTAL_TIME_X = 19 !TOTAL_TIME_X = 19
!TOTAL_TIME_Y = 390 !TOTAL_TIME_Y = 384

View File

@@ -555,6 +555,42 @@ LoadModifiedFont:
DEX : BPL .nextWord DEX : BPL .nextWord
SEP #$30 SEP #$30
JSL LoadFullItemTilesCredits
RTL
LoadFullItemTilesCredits:
; Based on CopyFontToVram(Bank00)
; copies font graphics to VRAM (for BG3)
; increment on writes to $2119
LDA.b #$80 : STA $2115
; set bank of the source address (see below)
LDA.b #FileSelectNewGraphics>>16 : STA $02
REP #$30
; vram target address is $8000 (word) (Wraps to start of VRAM on normal SNES, but using the correct address so it works on extended VRAM machines)
LDA.w #$8000 : STA $2116
; $00[3] = $0E8000 (offset for the font data)
LDA.w #FileSelectNewGraphics : STA $00
; going to write 0x1000 bytes (0x800 words)
LDX.w #$800-1
.nextWord
; read a word from the font data
LDA [$00] : STA $2118
; increment source address by 2
INC $00 : INC $00
DEX : BPL .nextWord
SEP #$30
RTL RTL
@@ -567,6 +603,30 @@ CheckFontTable:
PLB PLB
RTL RTL
NearEnding:
STZ.w $012A ; disable triforce helper thread
JSL LoadPaletteCredits
REP #$10
JSL AltBufferTable_credits
JSR DrawEndingItems
JML.l $00ec03 ; PaletteFilter_InitTheEndSprite
EndingItems:
; This function is not strictly needed, simply updating the tracker
; every frame, but it is useful for debuging, so should be left in.
REP #$10
JSR DrawEndingItems
REP #$20
LDX.b #$0e
RTL
DrawEndingItems:
JSL DrawPlayerFile_credits
JSL SetItemLayoutPriority
SEP #$30
LDA.b #$01 : STA $14
RTS
FontTable: FontTable:
incbin stats/fonttable.bin incbin stats/fonttable.bin
@@ -574,6 +634,12 @@ CreditsStats:
incsrc stats/statConfig.asm incsrc stats/statConfig.asm
dw $FFFF dw $FFFF
org $0eedd9
JSL EndingItems
org $0eedaf
JSL NearEnding
org $0EE651 org $0EE651
JSL LoadModifiedFont JSL LoadModifiedFont