Skip to content

Commit

Permalink
twoplayer: Allow both players to pause
Browse files Browse the repository at this point in the history
  • Loading branch information
ejona86 committed Mar 18, 2020
1 parent 7a551b7 commit 0e45746
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
35 changes: 35 additions & 0 deletions twoplayer-tetris-PRG.s.diff
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,41 @@
lda frameCounter
and #$07
bne @waitForVBlank
@@ -4296,15 +4479,15 @@ gameModeState_startButtonHandling:

@checkIfInGame:
lda renderMode
cmp #$03
bne @ret
- lda newlyPressedButtons_player1
- and #$10
- bne @startPressed
+ .import isStartNewlyPressed
+ nop ;lda newlyPressedButtons_player1
+ jsr isStartNewlyPressed ;and #$10
+ beq @startPressed ;bne @startPressed
jmp @ret
-
; Do nothing if curtain is being lowered
@startPressed:
lda player1_playState
cmp #$0A
bne @pause
@@ -4327,12 +4510,12 @@ @pauseLoop:
lda #$77
sta spriteYOffset
lda #$05
sta spriteIndexInOamContentLookup
jsr loadSpriteIntoOamStaging
- lda newlyPressedButtons_player1
- cmp #$10
+ nop ;lda newlyPressedButtons_player1
+ jsr isStartNewlyPressed ;cmp #$10
beq @resume
jsr updateAudioWaitForNmiAndResetOamStaging
jmp @pauseLoop

@resume:lda #$1E
@@ -6209,17 +6392,17 @@ dmc1: .byte $6D,$6E,$6F,$5F,$3C,$33,
.byte $87,$78,$84,$7A,$77,$87,$78,$84
.byte $7A,$67,$87,$77,$87,$77,$72,$83
Expand Down
12 changes: 10 additions & 2 deletions twoplayer.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
; "current player" as the palette value.

; TODO:
; Allow player 2 to pause
; Save another RNG to let the behind player catch up.
; Fix background tetrimino pattern
; Demo can be two-player if second player presses start and then the system goes idle. But demo playing is broken in 2 player
; Allow toggling on garbage?
; Allow second player to disable next piece display (minor)

; Integrations:
; Have handicap support 2 players
; Any way to fit stats on screen? Seems like there's no room.
; No room for A/B-Type, high score

Expand Down Expand Up @@ -519,6 +517,16 @@ pickRandomTetrimino_mod:
jsr generateNextPseudorandomNumber
rts


isStartNewlyPressed:
.export isStartNewlyPressed
lda newlyPressedButtons_player1
ora newlyPressedButtons_player2
and #$10
cmp #$10
rts


gameMode_levelMenu_nametable_mod:
.export gameMode_levelMenu_nametable_mod
jsr bulkCopyToPpu
Expand Down

0 comments on commit 0e45746

Please sign in to comment.