mirror of
https://github.com/Pecusx/scorch_src.git
synced 2026-05-21 21:34:20 +02:00
Tanks sequence randomization opty
This commit is contained in:
@@ -927,26 +927,22 @@ MakeTanksVisible
|
|||||||
; repeat untill NumberOfPlayers
|
; repeat untill NumberOfPlayers
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
GetRandomAgain0
|
|
||||||
lda RANDOM
|
|
||||||
and #$07 ;NumberOfPlayers < 7
|
|
||||||
cmp NumberOfPlayers
|
|
||||||
bcs GetRandomAgain0
|
|
||||||
sta TankSequence,x
|
|
||||||
;now first slot is ready, nexts slots are handled
|
|
||||||
;in a more complicated way
|
|
||||||
|
|
||||||
GetRandomAgainX
|
GetRandomAgainX
|
||||||
|
txa ; destroy A!
|
||||||
|
tay
|
||||||
|
dey
|
||||||
lda RANDOM
|
lda RANDOM
|
||||||
and #$07 ;NumberOfPlayers < 7
|
|
||||||
cmp NumberOfPlayers
|
cmp NumberOfPlayers
|
||||||
bcs GetRandomAgainX
|
bcs GetRandomAgainX
|
||||||
|
cpx #0
|
||||||
|
bne NotFirstSlot
|
||||||
|
sta TankSequence,x ;now first slot is ready
|
||||||
|
inx
|
||||||
|
bne GetRandomAgainX
|
||||||
|
NotFirstSlot
|
||||||
;now we have to check if the value was not used
|
;now we have to check if the value was not used
|
||||||
;in previous slots
|
;in previous slots
|
||||||
|
|
||||||
stx temp
|
|
||||||
ldy temp
|
|
||||||
UsageLoop
|
UsageLoop
|
||||||
cmp TankSequence,y
|
cmp TankSequence,y
|
||||||
beq GetRandomAgainX ;apparently we have already used this value
|
beq GetRandomAgainX ;apparently we have already used this value
|
||||||
@@ -954,14 +950,11 @@ UsageLoop
|
|||||||
bpl UsageLoop
|
bpl UsageLoop
|
||||||
|
|
||||||
;well, looks like this value is new!
|
;well, looks like this value is new!
|
||||||
inx
|
|
||||||
sta TankSequence,x
|
sta TankSequence,x
|
||||||
|
inx
|
||||||
|
|
||||||
stx temp
|
cpx NumberOfPlayers
|
||||||
inc:lda temp ;x+1
|
bcc GetRandomAgainX
|
||||||
|
|
||||||
cmp NumberOfPlayers
|
|
||||||
bne GetRandomAgainX
|
|
||||||
rts
|
rts
|
||||||
.endp
|
.endp
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
@@ -972,9 +965,7 @@ UsageLoop
|
|||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
|
|
||||||
; lets randomize someting between 0 and 180
|
; lets randomize someting between 0 and 180
|
||||||
lda RANDOM
|
randomize 0 180
|
||||||
cmp #180
|
|
||||||
bcs RandomizeAngle
|
|
||||||
rts
|
rts
|
||||||
.endp
|
.endp
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
|
|||||||
BIN
Binary file not shown.
Reference in New Issue
Block a user