Skip to content

Commit 844eed6

Browse files
Merge branch 'master' into darkmode_toggle
2 parents f1b3d71 + 1ac2a80 commit 844eed6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2244
-570
lines changed

.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,3 @@ tetris.map
1111
tetris.dbg
1212
release/*
1313
target
14-
15-
!src/nametables/enter_high_score_nametable.bin
16-
!src/nametables/game_nametable.bin
17-
!src/nametables/game_type_menu_nametable.bin
18-
!src/nametables/level_menu_nametable.bin

CHANGELOG.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
# Changelog
22

33
## [unreleased]
4+
* Crash Behaviours
45
* Crunch Mode
56
* Marathon Mode
67
* Hidden Score Mode
78
* Dark Mode
9+
* Low Stack Mode
810
* M Score changed to Classic Scoring + Millions counter
911
* Invisible linecap turns entire playfield invisible
1012
* Invisible mode preserves original piece colors
13+
* Added "negative delay" to the hz display
14+
* Block Tool pieces wrap around
15+
* Always Next Box removed
16+
* 0001 seeds are ignored
1117
* Floor no longer gobbled up by top line clear
1218
* Floor 0 has original no-burns behaviour again
13-
* Fixed ingame score display at 8 million with Classic Scoring
19+
* [Fixed ingame score display at 8/9 million with Classic Scoring](https://www.youtube.com/watch?v=fYdXky2i5AE)
1420
* Fixed CNROM legal screen CHR bank
1521
* Fixed CNROM legal to title flicker
16-
* Block Tool pieces wrap around
17-
* 0001 seeds are ignored
22+
* Fixed piece skip when doing Sonic Drop then Hard Drop immediately
23+
* Fixed storage bug for push down points
24+
* Fixed crashes in garbage mode 4
25+
* Fixed line clearing happening on pause
26+
* Fixed PAL colours
27+
* Keep hz display enabled when topped out
1828
* Famicom Keyboard support
1929
* MMC3 Support
2030
* MMC5 Support

README.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
* [Setups](#setups)
1717
* [B-Type](#b-type)
1818
* [Floor](#floor)
19-
* [Crunch](#crunch)
2019
* [(Quick)Tap](#quicktap)
2120
* [Tap Quantity](#tap-quantity)
2221
* [Checkerboard](#checkerboard)
2322
* [Transition](#transition)
24-
* [Marathon](#marathon)
2523
* [Garbage](#garbage)
2624
* [Drought](#drought)
2725
* [DAS Delay](#das-delay)
@@ -76,7 +74,7 @@ Like in the original ROM, holding `a` `b` `select` and then pressing `start` wil
7674

7775
![Tetris](./assets/screens/levelmenu.png)
7876

79-
Same gameplay as A-Type, with some improvements: no score cap, no rocket, no curtain, no music, always next box, better pause, start on any level.
77+
Same gameplay as A-Type, with some improvements: no score cap, no rocket, no curtain, no music, better pause, start on any level.
8078

8179
### T-Spins
8280

@@ -154,16 +152,6 @@ Fill in the floor to a certain height to force higher stacking. This mode is oft
154152

155153
Setting the height to zero will result in a game mode with burns disabled.
156154

157-
### Crunch
158-
159-
![Crunch](./assets/screens/crunch.png)
160-
161-
Shrink the width of the playfield to force cramped stacking.
162-
163-
Every increment of 4 will decrease the width from the left.
164-
165-
Every increment of 1 will decrease the width from the right until it reaches its maximum of 3, where it will be reset to 0.
166-
167155
### (Quick)Tap
168156

169157
![Tap](./assets/screens/tap.png)
@@ -194,10 +182,6 @@ Puts you ten lines before transition. The value given will be added to your scor
194182

195183
Setting the value to G causes the mode to act identical to the game genie code `SXTOKL`
196184

197-
### Marathon
198-
199-
Play as long as you are able to survive at a consistent speed. While the level will increase normally, the drop rate and the points rewarded will remain fixed based on the starting level.
200-
201185
### Garbage
202186

203187
![Garbage](./assets/screens/garbage.png)

assets/screens/lowstack.png

4.76 KB
Loading

build.js

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const fs = require('fs');
22
const path = require('path');
33
const crypto = require('crypto');
4-
const { spawnSync } = require('child_process');
54

65
console.log('TetrisGYM buildscript');
76
console.time('build');
@@ -117,7 +116,10 @@ console.timeEnd('CHR');
117116

118117
// build object files
119118

120-
function handleSpawn(exe, ...args) {
119+
const { spawnSync } = require('child_process');
120+
121+
function exec(cmd) {
122+
const [exe, ...args] = cmd.split(' ');
121123
const output = spawnSync(exe, args).output.flatMap(
122124
(d) => d?.toString() || [],
123125
);
@@ -127,36 +129,23 @@ function handleSpawn(exe, ...args) {
127129
}
128130
}
129131

130-
const ca65bin = nativeCC65 ? ['ca65'] : ['node', './tools/assemble/ca65.js'];
132+
const ca65bin = nativeCC65 ? 'ca65' : 'node ./tools/assemble/ca65.js';
133+
const flags = compileFlags.join(' ');
131134

132135
console.time('assemble');
133136

134-
handleSpawn(
135-
...ca65bin,
136-
...compileFlags,
137-
...'-g src/header.asm -o header.o'.split(' '),
138-
);
139-
140-
handleSpawn(
141-
...ca65bin,
142-
...compileFlags,
143-
...'-l tetris.lst -g src/main.asm -o main.o'.split(' '),
144-
);
137+
exec(`${ca65bin} ${flags} -g src/header.asm -o header.o`);
138+
exec(`${ca65bin} ${flags} -l tetris.lst -g src/main.asm -o main.o`);
145139

146140
console.timeEnd('assemble');
147141

148142
// link object files
149143

150-
const ld65bin = nativeCC65 ? ['ld65'] : ['node', './tools/assemble/ld65.js'];
144+
const ld65bin = nativeCC65 ? 'ld65' : 'node ./tools/assemble/ld65.js';
151145

152146
console.time('link');
153147

154-
handleSpawn(
155-
...ld65bin,
156-
...'-m tetris.map -Ln tetris.lbl --dbgfile tetris.dbg -o tetris.nes -C src/tetris.nes.cfg main.o header.o'.split(
157-
' ',
158-
),
159-
);
148+
exec(`${ld65bin} -m tetris.map -Ln tetris.lbl --dbgfile tetris.dbg -o tetris.nes -C src/tetris.nes.cfg main.o header.o`);
160149

161150
console.timeEnd('link');
162151

@@ -200,5 +189,5 @@ console.timeEnd('build');
200189

201190
if (args.includes('-t')) {
202191
console.log('\nrunning tests');
203-
handleSpawn('cargo', ...'run --release --manifest-path tests/Cargo.toml -- -t'.split(' '));
192+
exec('cargo run --release --manifest-path tests/Cargo.toml -- -t');
204193
}

src/chr/game_tileset.png

-21.8 KB
Loading

src/constants.asm

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ BTYPE_START_LINES := $25 ; bcd
3434
MENU_HIGHLIGHT_COLOR := $12 ; $12 in gym, $16 in original
3535
BLOCK_TILES := $7B
3636
EMPTY_TILE := $EF
37+
LOW_STACK_LINE := $DF
3738
TETRIMINO_X_HIDE := $EF
3839

3940
PAUSE_SPRITE_X := $74
@@ -52,6 +53,14 @@ BUTTON_SELECT := $20
5253
BUTTON_START := $10
5354
BUTTON_DPAD := BUTTON_UP | BUTTON_DOWN | BUTTON_LEFT | BUTTON_RIGHT
5455

56+
RENDER_LINES = $01
57+
RENDER_LEVEL = $02
58+
RENDER_SCORE = $04
59+
RENDER_DEBUG = $08
60+
RENDER_HZ = $10
61+
RENDER_STATS = $40
62+
RENDER_HIGH_SCORE_LETTER = $80
63+
5564
.enum
5665
MODE_TETRIS
5766
MODE_TSPINS
@@ -70,11 +79,14 @@ MODE_CHECKERBOARD
7079
MODE_GARBAGE
7180
MODE_DROUGHT
7281
MODE_DAS
82+
MODE_LOWSTACK
7383
MODE_KILLX2
7484
MODE_INVISIBLE
7585
MODE_HARDDROP
7686
MODE_SPEED_TEST
7787
MODE_SCORE_DISPLAY
88+
MODE_CRASH
89+
MODE_STRICT
7890
MODE_HZ_DISPLAY
7991
MODE_INPUT_DISPLAY
8092
MODE_DISABLE_FLASH
@@ -103,11 +115,16 @@ LINECAP_FLOOR := 2
103115
LINECAP_INVISIBLE := 3
104116
LINECAP_HALT := 4
105117

118+
CRASH_SHOW := 0
119+
CRASH_TOPOUT := 1
120+
CRASH_CRASH := 2
121+
CRASH_OFF := 3
122+
106123
LINECAP_WHEN_STRING_OFFSET := $10
107124
LINECAP_HOW_STRING_OFFSET := $12
108125

109126
MENU_SPRITE_Y_BASE := $47
110-
MENU_MAX_Y_SCROLL := $78
127+
MENU_MAX_Y_SCROLL := $98
111128
MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
112129

113130
; menuConfigSizeLookup
@@ -124,17 +141,20 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
124141
.byte $F ; MODE_CRUNCH
125142
.byte $20 ; MODE_TAP
126143
.byte $10 ; MODE_TRANSITION
127-
.byte $0 ; MODE_MARATHON
144+
.byte $2 ; MODE_MARATHON
128145
.byte $1F ; MODE_TAPQTY
129146
.byte $8 ; MODE_CHECKERBOARD
130147
.byte $4 ; MODE_GARBAGE
131148
.byte $12 ; MODE_DROUGHT
132149
.byte $10 ; MODE_DAS
150+
.byte $0F ; MODE_LOWSTACK
133151
.byte $0 ; MODE_KILLX2
134152
.byte $0 ; MODE_INVISIBLE
135153
.byte $0 ; MODE_HARDDROP
136154
.byte $0 ; MODE_SPEED_TEST
137155
.byte $5 ; MODE_SCORE_DISPLAY
156+
.byte $3 ; MODE_CRASH
157+
.byte $1 ; MODE_STRICT
138158
.byte $1 ; MODE_HZ_DISPLAY
139159
.byte $1 ; MODE_INPUT_DISPLAY
140160
.byte $1 ; MODE_DISABLE_FLASH
@@ -166,6 +186,7 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
166186
.byte "GARBGE"
167187
.byte "LOBARS"
168188
.byte "DASDLY"
189+
.byte "LOWSTK"
169190
.byte "KILLX2"
170191
.byte "INVZBL"
171192
.byte "HRDDRP"

src/gamemode/gametypemenu/linecap.asm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ linecapMenuCursorIndices := 3
1111
jsr bulkCopyToPpu
1212
.addr linecapMenuNametable
1313

14-
lda #1
15-
sta outOfDateRenderFlags
14+
lda #RENDER_LINES
15+
sta renderFlags
1616

1717
lda #$02
1818
sta soundEffectSlot1Init
@@ -115,8 +115,8 @@ linecapMenuControlsWhen:
115115
beq @ret
116116
lda #$01
117117
sta soundEffectSlot1Init
118-
lda #1
119-
sta outOfDateRenderFlags
118+
lda #RENDER_LINES
119+
sta renderFlags
120120
lda linecapWhen
121121
eor #1
122122
sta linecapWhen
@@ -153,8 +153,8 @@ linecapMenuControlsAdjLevel:
153153
linecapMenuControlsBoopAndRender:
154154
lda #$01
155155
sta soundEffectSlot1Init
156-
lda #1
157-
sta outOfDateRenderFlags
156+
lda #RENDER_LINES
157+
sta renderFlags
158158
rts
159159

160160
linecapMenuControlsAdjLinesUp:

src/gamemode/gametypemenu/menu.asm

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ gameMode_gameTypeMenu:
99
jsr calc_menuScrollY
1010
sta menuScrollY
1111
lda #0
12-
sta displayNextPiece
12+
sta hideNextPiece
1313
RESET_MMC1
1414
.if HAS_MMC
1515
; switch to blank charmap
@@ -488,15 +488,16 @@ menuYTmp := tmp2
488488
cmp #MODE_SCORE_DISPLAY
489489
beq @renderScoreName
490490

491+
cmp #MODE_CRASH
492+
beq @renderCrashMode
493+
494+
495+
jsr menuItemY16Offset
496+
bne @loopNext
497+
txa
498+
491499
ldx oamStagingLength
492500

493-
; get Y offset
494-
lda menuCounter
495-
asl
496-
asl
497-
asl
498-
adc #MENU_SPRITE_Y_BASE + 1
499-
sbc menuScrollY
500501
sta oamStaging, x
501502
inx
502503
lda menuVars, y
@@ -547,6 +548,26 @@ menuYTmp := tmp2
547548
jsr stringSpriteAlignRight
548549
jmp @loopNext
549550

551+
@renderCrashMode:
552+
jsr menuItemY16Offset
553+
bne @loopNext
554+
@doRender:
555+
lda crashModifier
556+
cmp #CRASH_OFF
557+
bne @notOff
558+
lda #$F1
559+
@notOff:
560+
adc #$16
561+
sta spriteIndexInOamContentLookup
562+
lda #(MODE_CRASH*8) + MENU_SPRITE_Y_BASE + 1
563+
sec
564+
sbc menuScrollY
565+
sta spriteYOffset
566+
lda #$e9
567+
sta spriteXOffset
568+
jsr stringSpriteAlignRight
569+
jmp @loopNext
570+
550571
; <- menu item index in A
551572
; -> high byte of offset in A
552573
; -> low byte in X

0 commit comments

Comments
 (0)