From 276515a1338feb72e38825dd920a23ac525d241b Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Sun, 8 Mar 2026 16:10:52 +0100 Subject: State game over only when all players are dead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a bit contrary to the original game, where each player would get its own "Game over" event. Signed-off-by: Miquel Sabaté Solà --- .nasm/segments.txt | 4 ++++ assets/session.nss | 26 +++++++++++------------ src/driver.s | 5 +++-- src/jetpac.s | 4 ++-- src/over.s | 14 ++++-------- src/player.s | 62 ++++++++++++++++++++++++++++++++++++++++++++++++------ 6 files changed, 81 insertions(+), 34 deletions(-) diff --git a/.nasm/segments.txt b/.nasm/segments.txt index 35b446b..e5b18a5 100644 --- a/.nasm/segments.txt +++ b/.nasm/segments.txt @@ -1,4 +1,8 @@ - HEADER: 16/16 (100%) +<<<<<<< HEAD - ROM0: 6609/32762 (20.17%) +======= +- ROM0: 6658/32762 (20.32%) +>>>>>>> 823e1f6ed102 (State game over only when all players are dead) - ROMV: 6/6 (100%) - ROM2: 8192/8192 (100%) diff --git a/assets/session.nss b/assets/session.nss index 0220a55..a8197ef 100644 --- a/assets/session.nss +++ b/assets/session.nss @@ -10,7 +10,7 @@ BtnChrBank4=0 BtnGridAll=1 BtnGridTile=0 BtnGridAtr=1 -BtnGridBlock=0 +BtnGridBlock=1 BtnGridScr=0 BtnSelectedOnlyInverted=0 BtnSolidityMask=0 @@ -54,8 +54,8 @@ VarPalBank_mapBuffer=0 VarPalBank_msprBuffer=0 VarTileViewTagBuf=0 VarBgPalCur=0 -VarPalActive=0 -VarTileActive=0 +VarPalActive=1 +VarTileActive=48 VarBankActive=0 VarPPUMask=0 VarPPUMaskSet0=0 @@ -75,16 +75,16 @@ VarNameViewX=0 VarNameViewY=0 VarNameViewX2=0 VarNameViewY2=0 -VarNameSelectionL=-1 -VarNameSelectionR=19 -VarNameSelectionT=-1 -VarNameSelectionB=5 +VarNameSelectionL=12 +VarNameSelectionR=21 +VarNameSelectionT=11 +VarNameSelectionB=12 VarNameCopyW=17 VarNameCopyH=3 VarCHRSelectionL=0 VarCHRSelectionR=1 -VarCHRSelectionT=0 -VarCHRSelectionB=1 +VarCHRSelectionT=3 +VarCHRSelectionB=4 VarCHRCopyW=2 VarCHRCopyH=2 VarCHRCopyRect=1 @@ -160,7 +160,7 @@ RadioAutoexport_UseSubDir_NEXXT=0 CheckAutoexport_MetatileAsBMP=0 -VarCHRSelected=0100[ff] +VarCHRSelected=00[30]0100[cf] Palette=0f302c280f16101b0f1610300f1630000f302c280f1122330f282c160f1324350f1324360f1526370f1627370f1928380f1829380f1b2a390f1b2b3c0f1c2c3b @@ -178,19 +178,19 @@ CHRUndo=00[10]2f7fffddfb7b71212f7fffddfb7b7121bdff[2]f7ebddad04bdff[2]f7ebddad04 CHRCopy=00[2]092e4f33f1fc00[2]092e4f33f1fc00[3]2080e4f07400[3]2080e4f074f1c7797531190e00f1c7797531190e00d6e1e4f2b8402000d6e1e4f2b84020009fa0c0ff00[4]9fa0c0ff00[4]f90503ff00[4]f90503ff00[4]807fff[3]bf9f[2]807fff[3]bf9f[2]30d0f0[6]30d0f0[6]00[10]9f[10]f0fefffcfeff[3]f0fefffcfeff[3]00[2]c06030188cc400[2]c06030188cc48f80407f00[4]8f80407f00[4]ff00[2]ff00[4]ff00[2]ff00[4]e6160cf800[4]e6160cf800[24]9fa0c0ff00[4]9fa0c0ff00[4]f90503ff00[4]f90503ff00[1c]4f48f0ff00[c]ff0100ff00[c]860488f800[c]9fa0c0ff00[c]f90503ff00[c]ff[8]00[8]fcfbf8f0f1e1[2]c300[8]1f7f9f[6]00[8]f9[8]00[8]9f[8]00[8]f0fefffcfeff[3]00[a]c06030188cc400[8]4f48f0ff00[c]ff0100ff00[c]860488f800[c]9fa0c0ff00[c]f90503ff00[c]8f80601f00[c]ff00[2]ff00[c]e4140cfc00[a]44aa00[6]993380[6]558880[6]991180[6]44aa00[6]881100[5]0145a800[6]88132040[2]80[2]00548a200040008000893300[6]44aa000200040008993300[6]558800[6]991114[4]10[2]44aa04[3]00[2]01881100[6]45a800[6]881304000201[2]00548a040002000100893300[5]2a44aa00[5]44993300[3cd0] -NameTable=00[44]112f2a00[3]3500[4]222300[6]3500[2]122f2a00[30]2a1b2f2d1f1e00[a5]0103[4]020300[28]211b271f0029301f2c002a261b331f2c001100[a]0103[4]020300[65]0103[2]020300[4b]aa00[1f]ba00[c0]0103[1e]0200[c4]112f4000[8]222300[9]122f4000[43]36[20]26[21]27[1e]26[2]00[1e]26[2]00[2]2829[2]250044452a002829[2]25002b29[2]4c535029610044452a00[2]26[2]00[2]383934350054553a0038393435003b3c3d5c657570600054325800[2]26[2]00[3]636400[2]66676800[2]636400[2]696a6b6c3e62[2]7100665900[3]26[2]00[2]72737400[2]766d5d00[2]767400[2]7674004d4e4f6e740076522400[2]26[2]00[2]51565700[2]3f565f00[2]375700[2]3757005e6f313757003f565f00[2]26[2]00[1e]26[41]00[8a]110040481b2c1f4600211b491f00[53]120040481b2c1f4600211b491f00[a9] +NameTable=00[44]112f2a00[3]3500[4]222300[6]3500[2]122f2a00[30]2a1b2f2d1f1e00[a5]0103[4]020300[2d]211b271f0029301f2c00[e]0103[4]020300[65]0103[2]020300[4b]aa00[1f]ba00[c0]0103[1e]0200[c4]112f4000[8]222300[9]122f4000[43]36[20]26[21]27[1e]26[2]00[1e]26[2]00[2]2829[2]250044452a002829[2]25002b29[2]4c535029610044452a00[2]26[2]00[2]383934350054553a0038393435003b3c3d5c657570600054325800[2]26[2]00[3]636400[2]66676800[2]636400[2]696a6b6c3e62[2]7100665900[3]26[2]00[2]72737400[2]766d5d00[2]767400[2]7674004d4e4f6e740076522400[2]26[2]00[2]51565700[2]3f565f00[2]375700[2]3757005e6f313757003f565f00[2]26[2]00[1e]26[41]00[8a]110040481b2c1f4600211b491f00[53]120040481b2c1f4600211b491f00[a9] NameCopy=7172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d858e8f909192939495969798999a9b9c9d9e9fa0a1a200[74d] -NameUndo=00[44]112f2a00[3]3500[4]222300[6]35[2]00122f2a00[30]2a1b2f2d1f1e00[a5]0103[4]020300[28]211b271f0029301f2c002a261b331f2c001100[a]0103[4]020300[65]0103[2]020300[4b]aa00[1f]ba00[c0]0103[1e]0200[c4]112f4000[8]222300[9]122f4000[43]36[20]26[21]27[1e]26[2]00[1e]26[2]00[2]2829[2]250044452a002829[2]25002b29[2]4c535029610044452a00[2]26[2]00[2]383934350054553a0038393435003b3c3d5c657570600054325800[2]26[2]00[3]636400[2]66676800[2]636400[2]696a6b6c3e62[2]7100665900[3]26[2]00[2]72737400[2]766d5d00[2]767400[2]7674004d4e4f6e740076522400[2]26[2]00[2]51565700[2]3f565f00[2]375700[2]3757005e6f313757003f565f00[2]26[2]00[1e]26[41]00[8a]110040481b2c1f4600211b491f00[53]120040481b2c1f4600211b491f00[a9] +NameUndo=00[44]112f2a00[3]3500[4]222300[6]3500[2]122f2a00[30]2a1b2f2d1f1e00[a5]0103[4]020300[2e]211b271f0029301f2c00[d]0103[4]020300[65]0103[2]020300[4b]aa00[1f]ba00[c0]0103[1e]0200[c4]112f4000[8]222300[9]122f4000[43]36[20]26[21]27[1e]26[2]00[1e]26[2]00[2]2829[2]250044452a002829[2]25002b29[2]4c535029610044452a00[2]26[2]00[2]383934350054553a0038393435003b3c3d5c657570600054325800[2]26[2]00[3]636400[2]66676800[2]636400[2]696a6b6c3e62[2]7100665900[3]26[2]00[2]72737400[2]766d5d00[2]767400[2]7674004d4e4f6e740076522400[2]26[2]00[2]51565700[2]3f565f00[2]375700[2]3757005e6f313757003f565f00[2]26[2]00[1e]26[41]00[8a]110040481b2c1f4600211b491f00[53]120040481b2c1f4600211b491f00[a9] AttrTable=0300[15]85150405c1515000[2]c000010005[2]00[2]4400[18]a0[8]aa[18]00[18] -AttrCopy=a0acaf[2]abaa[13]00[60] +AttrCopy=a0[2]acafabaa[13]00[60] AttrUndo=0300[15]85150405c1515000[2]c000010005[2]00[2]4400[18]a0[8]aa[18]00[18] diff --git a/src/driver.s b/src/driver.s index 1ac5718..3bf4399 100644 --- a/src/driver.s +++ b/src/driver.s @@ -258,8 +258,9 @@ lda Explosions::zp_active bne @sprite_cycling - ;; After all the explosions have been done, do we have any life left? - lda Player::zp_lifes + ;; After all the explosions have been done, is any player alive? + lda Globals::zp_multiplayer + and #%00000110 bne @reset_timer ;; No! Toggle the game over bit. diff --git a/src/jetpac.s b/src/jetpac.s index e8d6543..4802e74 100644 --- a/src/jetpac.s +++ b/src/jetpac.s @@ -111,7 +111,7 @@ .endproc .proc main - ;; TODO: score initialization has to happen here. + ;; TODO: high score initialization has to happen here. @init: ;; Disable the PPU and zero out variables which shadow PPU registers. @@ -239,7 +239,7 @@ bit Globals::zp_flags bmi @wait_for_render_over - ;; Did the user want to start over? + ;; Can the player start over? lda Globals::zp_tmp0 beq @main_game_loop jmp @init diff --git a/src/over.s b/src/over.s index a2a0f9f..6d8ed8d 100644 --- a/src/over.s +++ b/src/over.s @@ -147,15 +147,13 @@ rts .endproc - ;; Render the regular "Game over player X" screen. - ;; - ;; TODO: multiplayer support. + ;; Render the regular "Game over" screen. .proc render_regular_game_over ;; Set the position. bit PPU::m_status ldx #$29 stx PPU::m_address - ldx #$67 + ldx #$6C stx PPU::m_address ;; And just iterate over the "message" until we reach the end of string @@ -186,11 +184,7 @@ message: ;; "GAME " .byte $21, $1B, $27, $1F, $00 - ;; "OVER " - .byte $29, $30, $1F, $2C, $00 - ;; "PLAYER " - .byte $2A, $26, $1B, $33, $1F, $2C, $00 - ;; "1" - .byte $11, $FF + ;; "OVER" + .byte $29, $30, $1F, $2C, $FF .endproc .endscope diff --git a/src/player.s b/src/player.s index 7e215a5..53695b4 100644 --- a/src/player.s +++ b/src/player.s @@ -834,13 +834,25 @@ ;; That's just german for "the Bart, the". .proc die_bart_die - ;; Decrement the life. If we reach zero, then there's no point on - ;; signaling the NMI code to render this change. - ;; - ;; TODO: this is just considering the first player only!. - dec Player::zp_lifes - beq @skip_life_update - + ;; Decrement the life. + lda Globals::zp_multiplayer + and #$01 + tax + dec Player::zp_lifes, x + bne @nmi_update + + ;; If this poor guy is over, then mark it in the multiplayer bitmap. + cpx #0 + bne @player_2_over + lda #%11111101 + bne @set_multi + @player_2_over: + lda #%11111011 + @set_multi: + and Globals::zp_multiplayer + sta Globals::zp_multiplayer + + @nmi_update: ;; Notify NMI code to render lifes again, as they have changed. lda Player::zp_state ora #%00001000 @@ -862,6 +874,9 @@ ora Globals::zp_flags sta Globals::zp_flags + ;; Try to switch the player. + jsr Player::try_player_switch + ;; Create an explosion. lda Player::zp_screen_y sta Globals::zp_arg2 @@ -869,4 +884,37 @@ sta Globals::zp_arg3 JAL Explosions::create .endproc + + ;; Try to switch the active player if we are in multiplayer. + .proc try_player_switch + ;; If multiplayer is not enabled, don't even bother. + bit Globals::zp_multiplayer + bpl @end + + lda Globals::zp_multiplayer + tax + and #$01 + beq @try_player_2 + + ;; Switch to player 1 if it's still alive. + txa + and #$02 + beq @end + txa + and #$FE + bne @set_and_end + + @try_player_2: + ;; Switch to player 2 if it's still alive. + txa + and #$04 + beq @end + txa + ora #$01 + + @set_and_end: + sta Globals::zp_multiplayer + @end: + rts + .endproc .endscope -- cgit v1.2.3