mirror of
https://github.com/Pecusx/scorch_src.git
synced 2026-05-20 22:33:43 +02:00
Round end in Team game
This commit is contained in:
@@ -443,6 +443,7 @@ ChoosingItemForPurchase
|
||||
|
||||
jsr PutLitteChar ; Places pointer at the right position
|
||||
jsr getkey
|
||||
and #$3f ;CTRL and SHIFT ellimination
|
||||
bit escFlag
|
||||
bpl @+
|
||||
mva #0 escFlag
|
||||
@@ -1188,6 +1189,7 @@ CheckKeys
|
||||
sta NameScreen2+15 ; display tank shape number
|
||||
jsr CursorDisplay
|
||||
jsr getkey
|
||||
and #$3f ;CTRL and SHIFT ellimination
|
||||
bit escFlag
|
||||
spl:rts
|
||||
|
||||
|
||||
@@ -290,35 +290,38 @@ NoEnergy
|
||||
bpl CheckingIfRoundIsFinished
|
||||
|
||||
cpy #2 ; is it less than 2 tanks have energy >0 ?
|
||||
bcs DoNotFinishTheRound
|
||||
|
||||
;points for the last living tank
|
||||
bcc FinishTheRound
|
||||
bit TeamGame
|
||||
bvc NoTeams
|
||||
; Check if one team is not dead
|
||||
; check team 1
|
||||
ldx NumberOfPlayers
|
||||
jsr CheckTeamDead
|
||||
beq FinishTheRound
|
||||
; check team 2
|
||||
ldx NumberOfPlayers
|
||||
dex ; for team 2
|
||||
jsr CheckTeamDead
|
||||
beq FinishTheRound
|
||||
NoTeams
|
||||
jmp DoNotFinishTheRound
|
||||
FinishTheRound
|
||||
;points for the last living tank(s)
|
||||
ldx NumberOfPlayers
|
||||
dex
|
||||
WhichTankWonLoop
|
||||
lda eXistenZ,x
|
||||
bne ThisOneWon
|
||||
dex
|
||||
bpl WhichTankWonLoop
|
||||
;error was here!!!
|
||||
; somehow I believed program will be never here
|
||||
; but it was a bad assumption
|
||||
; god knows when there is such a situation
|
||||
; (we've got a SITUATION here, if you know what I mean)
|
||||
; there are two tanks left.
|
||||
; one of them is killed by the second tank
|
||||
; second tank explodes and kills the first one.
|
||||
; and code lands here...
|
||||
; looks like no one won!
|
||||
rts
|
||||
|
||||
ThisOneWon
|
||||
beq CheckNext
|
||||
; set winning tanks points
|
||||
lda CurrentResult
|
||||
clc
|
||||
adc ResultsTable,x
|
||||
sta ResultsTable,x
|
||||
|
||||
rts ; this Round is finished
|
||||
inc CurrentResult ; this is for honesty (in Team game) :)
|
||||
CheckNext
|
||||
dex
|
||||
bpl WhichTankWonLoop
|
||||
rts
|
||||
|
||||
DoNotFinishTheRound
|
||||
; Seppuku here
|
||||
@@ -563,6 +566,24 @@ NotLastPlayerInRound
|
||||
jmp MainRoundLoop
|
||||
.endp
|
||||
|
||||
;---------------------------------
|
||||
.proc CheckTeamDead
|
||||
; Optimalisation procedure
|
||||
; Counts alive in Team
|
||||
;---------------------------------
|
||||
dex
|
||||
ldy #0 ; in Y - number of tanks with energy greater than zero
|
||||
CheckingTeam
|
||||
lda eXistenZ,x
|
||||
beq NoEnergy
|
||||
iny
|
||||
NoEnergy
|
||||
dex
|
||||
dex
|
||||
bpl CheckingTeam
|
||||
cpy #0
|
||||
rts
|
||||
.endp
|
||||
;---------------------------------
|
||||
.proc PlayerXdeath
|
||||
; this tank should not explode anymore:
|
||||
|
||||
BIN
Binary file not shown.
+4
-3
@@ -1360,11 +1360,12 @@ NoSpyHard
|
||||
mva #0 escFlag
|
||||
jmp ReleaseAndLoop
|
||||
@
|
||||
/* cmp #$80|@kbcode._up
|
||||
/* .IF TARGET = 800
|
||||
cmp #$80|@kbcode._up ; Ctrl + Up or Down only in A800
|
||||
jeq CTRLPressedUp
|
||||
cmp #$80|@kbcode._down
|
||||
jeq CTRLPressedDown */
|
||||
|
||||
jeq CTRLPressedDown
|
||||
.ENDIF */
|
||||
cmp #$80|@kbcode._tab
|
||||
jeq CTRLPressedTAB
|
||||
|
||||
|
||||
Reference in New Issue
Block a user