Skip to content

Commit ffac191

Browse files
authored
Merge branch 'master' into mapper_edit
2 parents a6ace2c + 4831ac0 commit ffac191

File tree

18 files changed

+657
-51
lines changed

18 files changed

+657
-51
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
## [unreleased]
4+
* Crash Detection / Simulation
45
* Crunch Mode
56
* Marathon Mode
67
* Hidden Score Mode
@@ -13,6 +14,7 @@
1314
* Fixed CNROM legal screen CHR bank
1415
* Fixed CNROM legal to title flicker
1516
* Block Tool pieces wrap around
17+
* Always Next Box removed
1618
* 0001 seeds are ignored
1719
* Famicom Keyboard support
1820
* Autodetect MMC1/CNROM

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Like in the original ROM, holding `a` `b` `select` and then pressing `start` wil
7676

7777
![Tetris](./assets/screens/levelmenu.png)
7878

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.
79+
Same gameplay as A-Type, with some improvements: no score cap, no rocket, no curtain, no music, better pause, start on any level.
8080

8181
### T-Spins
8282

@@ -196,7 +196,11 @@ Setting the value to G causes the mode to act identical to the game genie code `
196196

197197
### Marathon
198198

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.
199+
Play as long as you are able to survive at a consistent speed.
200+
201+
0. Level transitions do not happen, game remains on the same level for as long as you are able to survive.
202+
1. Levels will transition normally, but speed and points will remain fixed based on your starting level.
203+
2. Similar to 1, speed and points will remain fixed based on the starting level you choose, but actual game will begin at level 0.
200204

201205
### Garbage
202206

src/chr/game_tileset.png

679 Bytes
Loading

src/constants.asm

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ MODE_INVISIBLE
7777
MODE_HARDDROP
7878
MODE_SPEED_TEST
7979
MODE_SCORE_DISPLAY
80+
MODE_CRASH
8081
MODE_HZ_DISPLAY
8182
MODE_INPUT_DISPLAY
8283
MODE_DISABLE_FLASH
@@ -104,11 +105,16 @@ LINECAP_FLOOR := 2
104105
LINECAP_INVISIBLE := 3
105106
LINECAP_HALT := 4
106107

108+
CRASH_SHOW := 0
109+
CRASH_TOPOUT := 1
110+
CRASH_CRASH := 2
111+
CRASH_OFF := 3
112+
107113
LINECAP_WHEN_STRING_OFFSET := $10
108114
LINECAP_HOW_STRING_OFFSET := $12
109115

110116
MENU_SPRITE_Y_BASE := $47
111-
MENU_MAX_Y_SCROLL := $78
117+
MENU_MAX_Y_SCROLL := $80
112118
MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
113119

114120
; menuConfigSizeLookup
@@ -125,7 +131,7 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
125131
.byte $F ; MODE_CRUNCH
126132
.byte $20 ; MODE_TAP
127133
.byte $10 ; MODE_TRANSITION
128-
.byte $0 ; MODE_MARATHON
134+
.byte $2 ; MODE_MARATHON
129135
.byte $1F ; MODE_TAPQTY
130136
.byte $8 ; MODE_CHECKERBOARD
131137
.byte $4 ; MODE_GARBAGE
@@ -136,6 +142,7 @@ MENU_TOP_MARGIN_SCROLL := 7 ; in blocks
136142
.byte $0 ; MODE_HARDDROP
137143
.byte $0 ; MODE_SPEED_TEST
138144
.byte $5 ; MODE_SCORE_DISPLAY
145+
.byte $3 ; MODE_CRASH
139146
.byte $1 ; MODE_HZ_DISPLAY
140147
.byte $1 ; MODE_INPUT_DISPLAY
141148
.byte $1 ; MODE_DISABLE_FLASH

src/gamemode/gametypemenu/menu.asm

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -465,15 +465,16 @@ menuYTmp := tmp2
465465
cmp #MODE_SCORE_DISPLAY
466466
beq @renderScoreName
467467

468+
cmp #MODE_CRASH
469+
beq @renderCrashMode
470+
471+
472+
jsr menuItemY16Offset
473+
bne @loopNext
474+
txa
475+
468476
ldx oamStagingLength
469477

470-
; get Y offset
471-
lda menuCounter
472-
asl
473-
asl
474-
asl
475-
adc #MENU_SPRITE_Y_BASE + 1
476-
sbc menuScrollY
477478
sta oamStaging, x
478479
inx
479480
lda menuVars, y
@@ -524,6 +525,26 @@ menuYTmp := tmp2
524525
jsr stringSpriteAlignRight
525526
jmp @loopNext
526527

528+
@renderCrashMode:
529+
jsr menuItemY16Offset
530+
bne @loopNext
531+
@doRender:
532+
lda crashModifier
533+
cmp #CRASH_OFF
534+
bne @notOff
535+
lda #$F1
536+
@notOff:
537+
adc #$16
538+
sta spriteIndexInOamContentLookup
539+
lda #(MODE_CRASH*8) + MENU_SPRITE_Y_BASE + 1
540+
sec
541+
sbc menuScrollY
542+
sta spriteYOffset
543+
lda #$e9
544+
sta spriteXOffset
545+
jsr stringSpriteAlignRight
546+
jmp @loopNext
547+
527548
; <- menu item index in A
528549
; -> high byte of offset in A
529550
; -> low byte in X

src/gamemode/levelmenu.asm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ levelMenuCheckStartGame:
126126
sta startLevel
127127
@startGame:
128128
; lda startLevel
129+
ldy practiseType
130+
cpy #MODE_MARATHON
131+
bne @noLevelModification
132+
ldy marathonModifier
133+
cpy #2 ; marathon mode 2 starts at level 0
134+
bne @noLevelModification
135+
lda #0
136+
@noLevelModification:
129137
sta levelNumber
130138
lda #$00
131139
sta gameModeState

src/gamemodestate/initstate.asm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ gameModeState_initGameState:
1313
lda #$05
1414
sta tetriminoX
1515

16+
;init for crash frame parity
17+
lda frameCounter
18+
and #$01
19+
sta startParity
20+
1621
; set seed init
1722
lda set_seed_input
1823
sta set_seed

src/gamemodestate/updatecounters.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ gameModeState_updateCountersAndNonPlayerState:
66
; next code makes acc behave as normal
77
; (dont edit unless you know what you're doing)
88
lda newlyPressedButtons_player1
9-
and #$20
9+
and #BUTTON_SELECT
1010
beq @ret
1111
lda displayNextPiece
1212
eor #$01

src/nametables/game_type_menu.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ drawTiles(buffer, lookup, `
6565
#a TAP/ROLL SPEED d#
6666
`);drawTiles(extra, lookup, `
6767
#a SCORING d#
68+
#a CRASH d#
6869
#a HZ DISPLAY d#
6970
#a INPUT DISPLAY d#
7071
#a DISABLE FLASH d#
@@ -93,15 +94,14 @@ drawTiles(buffer, lookup, `
9394
#a d#
9495
#a d#
9596
#a d#
96-
#a d#
9797
`);
9898

9999

100100
drawRect(buffer, 8, 2, 10, 5, 0xB0); // draw logo
101101
// drawRect(extra, 20, 0, 5, 5, 0x9A); // draw QR code
102102

103103
const urlX = 3;
104-
const urlY = 13;
104+
const urlY = 14;
105105
drawRect(extra, urlX, urlY, 12, 1, 0x74);
106106
drawRect(extra, urlX+12, urlY, 12, 1, 0x84);
107107

@@ -134,8 +134,8 @@ drawAttrs(extra, [`
134134
2222222222222222
135135
2222222222222222
136136
2222222222222222
137-
2333333333333332
138137
2222222222222222
138+
2333333333333332
139139
`, screen]);
140140

141141
writeRLE(

src/nmi/nmi.asm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ nmi: pha
2727
jsr generateNextPseudorandomNumber
2828
jsr copyCurrentScrollAndCtrlToPPU
2929
jsr pollControllerButtons
30+
lda #$00
31+
sta lagState ; clear flag after lag frame achieved
3032
.if KEYBOARD
3133
; Read Family BASIC Keyboard
3234
jsr pollKeyboard
@@ -35,6 +37,9 @@ nmi: pha
3537
sta verticalBlankingInterval
3638
pla
3739
tay
40+
tsx
41+
lda stack+4,x
42+
sta nmiReturnAddr
3843
pla
3944
tax
4045
pla

0 commit comments

Comments
 (0)