Skip to content

Commit 4459a47

Browse files
committed
UI interface and added different modes for result of crash
1 parent 32c0aac commit 4459a47

File tree

9 files changed

+79
-7
lines changed

9 files changed

+79
-7
lines changed

src/constants.asm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,10 @@ MODE_LINECAP
8585
MODE_DASONLY
8686
MODE_QUAL
8787
MODE_PAL
88+
MODE_CRASH
8889
.endenum
8990

90-
MODE_QUANTITY = MODE_PAL + 1
91+
MODE_QUANTITY = MODE_CRASH + 1
9192
MODE_GAME_QUANTITY = MODE_HARDDROP + 1
9293

9394
SCORING_CLASSIC := 0 ; for scoringModifier
@@ -102,6 +103,11 @@ LINECAP_FLOOR := 2
102103
LINECAP_INVISIBLE := 3
103104
LINECAP_HALT := 4
104105

106+
CRASH_SHOW := 0
107+
CRASH_TOPOUT := 1
108+
CRASH_CRASH := 2
109+
CRASH_OFF := 3
110+
105111
LINECAP_WHEN_STRING_OFFSET := $10
106112
LINECAP_HOW_STRING_OFFSET := $12
107113

@@ -144,6 +150,7 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
144150
.byte $1 ; MODE_DASONLY
145151
.byte $1 ; MODE_QUAL
146152
.byte $1 ; MODE_PAL
153+
.byte $3 ; MODE_CRASH
147154
.endmacro
148155

149156
.macro MODENAMES

src/gamemode/gametypemenu/menu.asm

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,9 @@ menuYTmp := tmp2
487487
lda menuCounter
488488
cmp #MODE_SCORE_DISPLAY
489489
beq @renderScoreName
490+
491+
cmp #MODE_CRASH
492+
beq @renderCrashMode
490493

491494
ldx oamStagingLength
492495

@@ -547,6 +550,28 @@ menuYTmp := tmp2
547550
jsr stringSpriteAlignRight
548551
jmp @loopNext
549552

553+
@renderCrashMode:
554+
lda menuScrollY
555+
cmp #$58
556+
bcs @doRender
557+
jmp @loopNext
558+
@doRender:
559+
lda crashMode
560+
cmp #CRASH_OFF
561+
bne @notOff
562+
lda #$F1
563+
@notOff:
564+
adc #$16
565+
sta spriteIndexInOamContentLookup
566+
lda #(MODE_CRASH*8)-256 + MENU_SPRITE_Y_BASE + 1
567+
sec
568+
sbc menuScrollY
569+
sta spriteYOffset
570+
lda #$e9
571+
sta spriteXOffset
572+
jsr stringSpriteAlignRight
573+
jmp @loopNext
574+
550575
; <- menu item index in A
551576
; -> high byte of offset in A
552577
; -> low byte in X

src/gamemodestate/initstate.asm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ gameModeState_initGameState:
1212
bne @initStatsByType
1313
lda #$05
1414
sta tetriminoX
15+
16+
;init for crash frame parity
17+
lda frameCounter
18+
and #$01
19+
sta startParity
1520

1621
; set seed init
1722
lda set_seed_input

src/nametables/game_type_menu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ drawTiles(buffer, lookup, `
7575
#a DAS ONLY d#
7676
#a QUAL MODE d#
7777
#a PAL MODE d#
78-
#a d#
78+
#a CRASH MODE d#
7979
#a d#
8080
#a V5 d#
8181
#a d#

src/nametables/game_type_menu_nametable_extra.bin

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
��<b�;��
99
�"��<B�;��
1010
���<�r;��
11-
���<a�;��<rb;��<�r;��tuvwxyz{|}~������������<��;��<a`;��<�p;��<��;��<�a;��<��;��<bs;��<��;��<sa;��<aq;��<�a;��<a�;��<qb;��<�r;��<br;��<r�;��<������� ��
11+
���<a�;�� 
12+
���<rb;��<�r;��tuvwxyz{|}~������������<��;��<a`;��<�p;��<��;��<�a;��<��;��<bs;��<��;��<sa;��<aq;��<�a;��<a�;��<qb;��<�r;��<br;��<r�;��<������� ��

src/nmi/render_mode_play_and_demo.asm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,13 @@ render_mode_play_and_demo:
9090
; 3 added in float
9191

9292
; scorecap
93+
lda crashMode
94+
cmp #CRASH_SHOW
95+
bne @noCrash
9396
lda crashFlag
9497
cmp #$F0
9598
bne @noCrash
99+
96100
lda #$20
97101
sta PPUADDR
98102
lda #$FD

src/playstate/updatestats.asm

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,16 +654,17 @@ testCrash:
654654
sta allegroIndex
655655
lda frameCounter
656656
and #$01 ; RNG for frame length
657+
ora startParity ; set to 0 or 1 at start of game, so result isn't always 0
657658
adc allegroIndex
658659
sta allegroIndex
659-
lda rng_seed ; RNG for RNG
660+
lda rng_seed ; checking whether PRNG had extra cycle
660661
asl
661662
bcc @newBit0
662663
inc allegroIndex
663664
@newBit0:
664665
lda nmiReturnAddr
665666
cmp #<updateAudioWaitForNmiAndResetOamStaging+10
666-
beq @returnLate ; RNG for which instruction returned to
667+
beq @returnLate ; checking which instruction returned to
667668
lda #$03
668669
clc
669670
adc allegroIndex
@@ -715,13 +716,31 @@ testCrash:
715716
@crashGraphics:
716717
lda #$00
717718
sta allegroIndex
719+
lda crashMode
720+
bne @otherMode
718721
lda outOfDateRenderFlags
719722
ora #$04
720723
sta outOfDateRenderFlags
721724
lda #$02
722725
sta soundEffectSlot0Init
723726
rts
724-
727+
@otherMode:
728+
cmp #CRASH_CRASH
729+
bcc @topout
730+
bne @allegroClear
731+
.byte 02
732+
@topout:
733+
lda outOfDateRenderFlags ; Flag needed to reveal hidden score
734+
ora #$04
735+
sta outOfDateRenderFlags
736+
lda #$02
737+
sta soundEffectSlot0Init
738+
lda #$0A ; playState_checkStartGameOver
739+
sta playState
740+
lda #$F0
741+
sta curtainRow
742+
jsr updateAudio2
743+
rts
725744
factorTable:
726745
.byte $53, $88, $7D, $7D, $7D
727746
sumTable:

src/ram.asm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ pointerAddr: .res 2 ; $001B ; used in debug, harddrop
2222
pointerAddrB: .res 2 ; $001D ; used in harddrop
2323
allegroIndex: .res 1 ; $001F for crash
2424
wasAllegro: .res 1 ; $0020 for crash
25-
.res $12
25+
startParity: .res 1 ; $0021 for crash
26+
.res $11
2627

2728
verticalBlankingInterval: .res 1 ; $0033
2829
set_seed: .res 3 ; $0034 ; rng_seed, rng_seed+1, spawnCount
@@ -342,5 +343,6 @@ linecapFlag: .res 1
342343
dasOnlyFlag: .res 1
343344
qualFlag: .res 1
344345
palFlag: .res 1
346+
crashMode: .res 1
345347

346348
; ... $7FF

src/util/strings.asm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ stringLookup:
9292
.byte stringFromBelow-stringLookup
9393
.byte stringInviz-stringLookup
9494
.byte stringHalt-stringLookup
95+
.byte stringShown-stringLookup ;16
96+
.byte stringTopout-stringLookup
97+
.byte stringCrash-stringLookup
9598
stringClassic:
9699
.byte $7,'C','L','A','S','S','I','C'
97100
stringLetters:
@@ -138,3 +141,9 @@ stringHalt:
138141
.byte $4,'H','A','L','T'
139142
stringNull:
140143
.byte $0
144+
stringShown:
145+
.byte $5,'S','H','O','W','N'
146+
stringTopout:
147+
.byte $6,'T','O','P','O','U','T'
148+
stringCrash:
149+
.byte $5,'C','R','A','S','H'

0 commit comments

Comments
 (0)