Teams results calculation and display

This commit is contained in:
Pecusx
2025-12-22 10:50:32 +01:00
parent c31de4884d
commit 12eba970d9
4 changed files with 55 additions and 3 deletions
+4
View File
@@ -2098,6 +2098,10 @@ AngleDisplay
.proc RoundOverSprites .proc RoundOverSprites
; fill sprites with bytes ; fill sprites with bytes
ldy numberOfPlayers ldy numberOfPlayers
bit TeamGame
bvc NoTeamSprites
ldy #2 ; 2 teams
NoTeamSprites
dey dey
lda gameOverSpritesTop,y lda gameOverSpritesTop,y
sta temp sta temp
+50 -2
View File
@@ -173,9 +173,45 @@ esubstractlose
sbc loseH,x sbc loseH,x
sta EarnedMoneyH,x sta EarnedMoneyH,x
eskipzeroing eskipzeroing
dex dex
jpl CalculateGainsLoop jpl CalculateGainsLoop
; Team game calculations
; set initial values
inx ; now X=0
txa
inx ; now X=1
initialTeamsVal
sta ResultsTable+MaxPlayers,x
sta DirectHits+MaxPlayers,x
sta EarnedMoneyH+MaxPlayers,x
sta EarnedMoneyL+MaxPlayers,x
dex
bpl initialTeamsVal
; and now Team scores calculations
tax ; now X=0
tay
CalculateTeamsResults
clc
lda ResultsTable+MaxPlayers,y
adc ResultsTable,x
sta ResultsTable+MaxPlayers,y
clc
lda DirectHits+MaxPlayers,y
adc DirectHits,x
sta DirectHits+MaxPlayers,y
clc
lda EarnedMoneyL+MaxPlayers,y
adc EarnedMoneyL,x
sta EarnedMoneyL+MaxPlayers,y
lda EarnedMoneyH+MaxPlayers,y
adc EarnedMoneyH,x
sta EarnedMoneyH+MaxPlayers,y
tya
eor #$01 ; swap team
tay
inx
cpx NumberOfPlayers
bne CalculateTeamsResults
rts rts
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
@@ -978,6 +1014,11 @@ UsageLoop
cpx NumberOfPlayers cpx NumberOfPlayers
bcc GetRandomAgainX bcc GetRandomAgainX
; and "sequence" for teans
ldx #MaxPlayers
stx TankSequence+MaxPlayers+1 ; B-Team
inx
stx TankSequence+MaxPlayers ; A-Team
rts rts
.endp .endp
;---------------------------------------------- ;----------------------------------------------
@@ -1353,6 +1394,10 @@ GameOver4x4
sbb ResultY #2 ;next line (was empty) sbb ResultY #2 ;next line (was empty)
ldx NumberOfPlayers ;we start from the highest (best) tank ldx NumberOfPlayers ;we start from the highest (best) tank
bit TeamGame
bvc NoTeamsResults
ldx #MaxPlayers+2 ; set pointer to teams results
NoTeamsResults
dex ;and it is the last one dex ;and it is the last one
stx ResultOfTankNr ;in TankSequence table stx ResultOfTankNr ;in TankSequence table
@@ -1419,7 +1464,10 @@ TankNameCopyLoop
jsr TL4x4_empty jsr TL4x4_empty
dec ResultOfTankNr dec ResultOfTankNr
bmi FinishResultDisplay bmi FinishResultDisplay ; check for last player
lda ResultOfTankNr
cmp #MaxPlayers-1 ; check for last team
beq FinishResultDisplay
sbb ResultY #2 ;distance between lines is smaller sbb ResultY #2 ;distance between lines is smaller
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -67,7 +67,7 @@ OptionsY .ds 1 ;vertical position of cursor on Options screen
flyDelay .ds 1 flyDelay .ds 1
;-------------- ;--------------
;NumberOfPlayers .DS 1 ;current number of players (counted from 1) ;NumberOfPlayers .DS 1 ;current number of players (counted from 1)
TankSequence .DS MaxPlayers ;sequence of shooting during the Round TankSequence .DS MaxPlayers+2 ;sequence of shooting during the Round (+2 for teams)
GameIsOver .DS 1 ; 1 means it was the last round in the game GameIsOver .DS 1 ; 1 means it was the last round in the game
;---------------------------------------------------- ;----------------------------------------------------
moneyH ;we place zero at the end of prices and money moneyH ;we place zero at the end of prices and money