mirror of
https://github.com/Pecusx/scorch_src.git
synced 2026-05-21 21:34:20 +02:00
LimitForce added #70
This commit is contained in:
@@ -33,7 +33,7 @@ loop
|
|||||||
ArtificialIntelligence .proc ;
|
ArtificialIntelligence .proc ;
|
||||||
; A - skill of the TankNr
|
; A - skill of the TankNr
|
||||||
; returns shoot energy and angle in
|
; returns shoot energy and angle in
|
||||||
; EnergyTable/L/H and AngleTable
|
; ForceTable/L/H and AngleTable
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
asl
|
asl
|
||||||
tax
|
tax
|
||||||
@@ -77,24 +77,19 @@ Shooter .proc
|
|||||||
lda PreviousAngle,x
|
lda PreviousAngle,x
|
||||||
clc
|
clc
|
||||||
adc #5
|
adc #5
|
||||||
bmi leftQuadrant
|
bmi @+
|
||||||
cmp #90
|
cmp #90
|
||||||
bcc continue
|
bcc @+
|
||||||
lda #(-90)
|
lda #(-90)
|
||||||
bne continue
|
@
|
||||||
leftQuadrant
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
continue
|
|
||||||
sta NewAngle
|
sta NewAngle
|
||||||
|
|
||||||
lda PreviousEnergyL,x
|
lda PreviousEnergyL,x
|
||||||
sta EnergyTableL,x
|
sta ForceTableL,x
|
||||||
lda PreviousEnergyH,x
|
lda PreviousEnergyH,x
|
||||||
sta EnergyTableH,x
|
sta ForceTableH,x
|
||||||
|
|
||||||
jmp endo
|
jmp endo
|
||||||
|
|
||||||
firstShoot
|
firstShoot
|
||||||
; compare the x position with the middle of the screen
|
; compare the x position with the middle of the screen
|
||||||
lda xTanksTableL,x
|
lda xTanksTableL,x
|
||||||
@@ -108,7 +103,6 @@ firstShoot
|
|||||||
and #$1F
|
and #$1F
|
||||||
clc
|
clc
|
||||||
adc #5
|
adc #5
|
||||||
;lda #45
|
|
||||||
|
|
||||||
sta NewAngle
|
sta NewAngle
|
||||||
jmp forceNow
|
jmp forceNow
|
||||||
@@ -128,11 +122,12 @@ forceNow
|
|||||||
|
|
||||||
endo
|
endo
|
||||||
ldx TankNr ;this is possibly not necessary
|
ldx TankNr ;this is possibly not necessary
|
||||||
|
jsr RandomizeForce.LimitForce
|
||||||
lda NewAngle
|
lda NewAngle
|
||||||
sta PreviousAngle,x
|
sta PreviousAngle,x
|
||||||
lda EnergyTableL,x
|
lda ForceTableL,x
|
||||||
sta PreviousEnergyL,x
|
sta PreviousEnergyL,x
|
||||||
lda EnergyTableH,x
|
lda ForceTableH,x
|
||||||
sta PreviousEnergyH,x
|
sta PreviousEnergyH,x
|
||||||
|
|
||||||
; choose the best weapon
|
; choose the best weapon
|
||||||
|
|||||||
+32
-27
@@ -252,9 +252,9 @@ skipzeroing
|
|||||||
lda #0
|
lda #0
|
||||||
tax
|
tax
|
||||||
@
|
@
|
||||||
sta previousAngle,x
|
sta singleRoundVars,x
|
||||||
inx
|
inx
|
||||||
cpx #(singleRoundVarsEnd-PreviousAngle)
|
cpx #(singleRoundVarsEnd-singleRoundVars)
|
||||||
bne @-
|
bne @-
|
||||||
|
|
||||||
ldx #5
|
ldx #5
|
||||||
@@ -271,13 +271,13 @@ SettingEnergies
|
|||||||
; anything in eXistenZ table means that this tank exist
|
; anything in eXistenZ table means that this tank exist
|
||||||
; in the given round
|
; in the given round
|
||||||
lda #<1000
|
lda #<1000
|
||||||
sta MaxEnergyTableL,x
|
sta MaxForceTableL,x
|
||||||
lda #>1000
|
lda #>1000
|
||||||
sta MaxEnergyTableH,x
|
sta MaxForceTableH,x
|
||||||
lda #<350
|
lda #<350
|
||||||
sta EnergyTableL,x
|
sta ForceTableL,x
|
||||||
lda #>350
|
lda #>350
|
||||||
sta EnergyTableH,x
|
sta ForceTableH,x
|
||||||
|
|
||||||
;lda #(255-45)
|
;lda #(255-45)
|
||||||
;it does not look good when all tanks have
|
;it does not look good when all tanks have
|
||||||
@@ -505,9 +505,9 @@ B0 DEY
|
|||||||
BNE LP0
|
BNE LP0
|
||||||
ror
|
ror
|
||||||
ROR L1
|
ROR L1
|
||||||
STA MaxEnergyTableH,x
|
STA MaxForceTableH,x
|
||||||
lda L1
|
lda L1
|
||||||
sta MaxEnergyTableL,x
|
sta MaxForceTableL,x
|
||||||
|
|
||||||
dex
|
dex
|
||||||
bpl SeteXistenZ
|
bpl SeteXistenZ
|
||||||
@@ -982,7 +982,7 @@ RandomizeAngle .proc ;
|
|||||||
.endp
|
.endp
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
RandomizeForce .proc
|
RandomizeForce .proc
|
||||||
; routine returns in EnergyTable/L/H
|
; routine returns in ForceTable/L/H
|
||||||
; valid force of shooting for TankNr
|
; valid force of shooting for TankNr
|
||||||
; in X must be TankNr
|
; in X must be TankNr
|
||||||
; low and high randomize boundary passed as word value
|
; low and high randomize boundary passed as word value
|
||||||
@@ -990,36 +990,41 @@ RandomizeForce .proc
|
|||||||
; RandBoundaryHigh
|
; RandBoundaryHigh
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
|
|
||||||
lda MaxEnergyTableL,x
|
|
||||||
sta temp
|
|
||||||
lda MaxEnergyTableH,x
|
|
||||||
sta temp+1
|
|
||||||
GetRandomAgain
|
|
||||||
lda RANDOM
|
lda RANDOM
|
||||||
; gets values in range(256,765)
|
|
||||||
sta temp2
|
sta temp2
|
||||||
lda RANDOM ; :)
|
lda RANDOM
|
||||||
and #%00000011 ;(0..1023)
|
and #%00000011 ;(0..1023)
|
||||||
sta temp2+1
|
sta temp2+1
|
||||||
|
|
||||||
cpw RandBoundaryLow temp2
|
cpw RandBoundaryLow temp2
|
||||||
bcs GetRandomAgain
|
bcs RandomizeForce
|
||||||
|
|
||||||
cpw RandBoundaryHigh temp2
|
cpw RandBoundaryHigh temp2
|
||||||
bcc GetRandomAgain
|
bcc RandomizeForce
|
||||||
|
|
||||||
cpw temp temp2
|
|
||||||
bcs EnergyInRange
|
|
||||||
|
|
||||||
mwa temp temp2
|
|
||||||
|
|
||||||
EnergyInRange
|
|
||||||
lda temp2
|
lda temp2
|
||||||
sta EnergyTableL,x
|
sta ForceTableL,x
|
||||||
lda temp2+1
|
lda temp2+1
|
||||||
sta EnergyTableH,x
|
sta ForceTableH,x
|
||||||
|
|
||||||
|
;---------
|
||||||
|
LimitForce
|
||||||
|
; in X must be TankNr
|
||||||
|
; cuts force to MaxForceTable
|
||||||
|
lda MaxForceTableH,x
|
||||||
|
cmp ForceTableH,x
|
||||||
|
bne @+
|
||||||
|
lda MaxForceTableL,x
|
||||||
|
cmp ForceTableL,x
|
||||||
|
@ bcs @+
|
||||||
|
|
||||||
|
lda MaxForceTableL,x
|
||||||
|
sta ForceTableL,x
|
||||||
|
lda MaxForceTableH,x
|
||||||
|
sta ForceTableH,x
|
||||||
|
@
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endp
|
.endp
|
||||||
|
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
|
|||||||
BIN
Binary file not shown.
+2
-2
@@ -1668,9 +1668,9 @@ FinishResultDisplay
|
|||||||
;display Force
|
;display Force
|
||||||
;=========================
|
;=========================
|
||||||
ldx TankNr
|
ldx TankNr
|
||||||
lda EnergyTableL,x
|
lda ForceTableL,x
|
||||||
sta decimal
|
sta decimal
|
||||||
lda EnergyTableH,x
|
lda ForceTableH,x
|
||||||
sta decimal+1
|
sta decimal+1
|
||||||
mwa #textbuffer+40+34 displayposition
|
mwa #textbuffer+40+34 displayposition
|
||||||
jsr displaydec
|
jsr displaydec
|
||||||
|
|||||||
+5
-4
@@ -84,14 +84,14 @@ TempResults
|
|||||||
CurrentResult
|
CurrentResult
|
||||||
.DS 1
|
.DS 1
|
||||||
;-----------------------------------
|
;-----------------------------------
|
||||||
EnergyTableL ;shooting Force of the tank during the round
|
ForceTableL ;shooting Force of the tank during the round
|
||||||
.DS [MaxPlayers]
|
.DS [MaxPlayers]
|
||||||
EnergyTableH
|
ForceTableH
|
||||||
.DS [MaxPlayers] ;maxplayers=6
|
.DS [MaxPlayers] ;maxplayers=6
|
||||||
MaxEnergyTableL ;Energy of the tank during the round
|
MaxForceTableL ;Energy of the tank during the round
|
||||||
;(limes superior force of the Shoot)
|
;(limes superior force of the Shoot)
|
||||||
.DS [MaxPlayers] ;1000 is the default
|
.DS [MaxPlayers] ;1000 is the default
|
||||||
MaxEnergyTableH
|
MaxForceTableH
|
||||||
.DS [MaxPlayers]
|
.DS [MaxPlayers]
|
||||||
;-----------------------------------
|
;-----------------------------------
|
||||||
|
|
||||||
@@ -334,6 +334,7 @@ TextNumberOff .DS 1
|
|||||||
TankTempY
|
TankTempY
|
||||||
.DS 1
|
.DS 1
|
||||||
;-------------- single round variables --------------
|
;-------------- single round variables --------------
|
||||||
|
singleRoundVars
|
||||||
previousAngle
|
previousAngle
|
||||||
.DS [MaxPlayers]
|
.DS [MaxPlayers]
|
||||||
previousEnergyL
|
previousEnergyL
|
||||||
|
|||||||
+33
-33
@@ -977,17 +977,17 @@ ToHighFill
|
|||||||
ldx TankNr
|
ldx TankNr
|
||||||
|
|
||||||
;Checking the maximal force
|
;Checking the maximal force
|
||||||
lda MaxEnergyTableH,x
|
lda MaxForceTableH,x
|
||||||
cmp EnergyTableH,x
|
cmp ForceTableH,x
|
||||||
bne ContinueToCheckMaxForce2
|
bne ContinueToCheckMaxForce2
|
||||||
lda MaxEnergyTableL,x
|
lda MaxForceTableL,x
|
||||||
cmp EnergyTableL,x
|
cmp ForceTableL,x
|
||||||
ContinueToCheckMaxForce2
|
ContinueToCheckMaxForce2
|
||||||
bcs @+
|
bcs @+
|
||||||
lda MaxEnergyTableH,x
|
lda MaxForceTableH,x
|
||||||
sta EnergyTableH,x
|
sta ForceTableH,x
|
||||||
lda MaxEnergyTableL,x
|
lda MaxForceTableL,x
|
||||||
sta EnergyTableL,x
|
sta ForceTableL,x
|
||||||
@
|
@
|
||||||
jsr StatusDisplay ;all digital values like force, angle, wind, etc.
|
jsr StatusDisplay ;all digital values like force, angle, wind, etc.
|
||||||
jsr PutTankNameOnScreen
|
jsr PutTankNameOnScreen
|
||||||
@@ -1058,36 +1058,36 @@ notpressedJoy
|
|||||||
pressedUp
|
pressedUp
|
||||||
;force increaseeee!
|
;force increaseeee!
|
||||||
ldx TankNr
|
ldx TankNr
|
||||||
inc EnergyTableL,x
|
inc ForceTableL,x
|
||||||
bne CheckingMaxForce
|
bne CheckingMaxForce
|
||||||
inc EnergyTableH,x
|
inc ForceTableH,x
|
||||||
CheckingMaxForce
|
CheckingMaxForce
|
||||||
|
|
||||||
mva #sfx_set_power_1 sfx_effect
|
mva #sfx_set_power_1 sfx_effect
|
||||||
|
|
||||||
lda MaxEnergyTableH,x
|
lda MaxForceTableH,x
|
||||||
cmp EnergyTableH,x
|
cmp ForceTableH,x
|
||||||
bne FurtherCheckMaxForce
|
bne FurtherCheckMaxForce
|
||||||
lda MaxEnergyTableL,x
|
lda MaxForceTableL,x
|
||||||
cmp EnergyTableL,x
|
cmp ForceTableL,x
|
||||||
FurtherCheckMaxForce
|
FurtherCheckMaxForce
|
||||||
jcs BeforeFire
|
jcs BeforeFire
|
||||||
|
|
||||||
lda MaxEnergyTableH,x
|
lda MaxForceTableH,x
|
||||||
sta EnergyTableH,x
|
sta ForceTableH,x
|
||||||
lda MaxEnergyTableL,x
|
lda MaxForceTableL,x
|
||||||
sta EnergyTableL,x
|
sta ForceTableL,x
|
||||||
|
|
||||||
jmp BeforeFire
|
jmp BeforeFire
|
||||||
|
|
||||||
CTRLPressedUp
|
CTRLPressedUp
|
||||||
ldx TankNr
|
ldx TankNr
|
||||||
lda EnergyTableL,x
|
lda ForceTableL,x
|
||||||
clc
|
clc
|
||||||
adc #10
|
adc #10
|
||||||
sta EnergyTableL,x
|
sta ForceTableL,x
|
||||||
bcc CheckingMaxForce
|
bcc CheckingMaxForce
|
||||||
inc EnergyTableH,x
|
inc ForceTableH,x
|
||||||
jmp CheckingMaxForce
|
jmp CheckingMaxForce
|
||||||
|
|
||||||
|
|
||||||
@@ -1095,16 +1095,16 @@ pressedDown
|
|||||||
mva #sfx_set_power_1 sfx_effect
|
mva #sfx_set_power_1 sfx_effect
|
||||||
|
|
||||||
ldx TankNr
|
ldx TankNr
|
||||||
dec EnergyTableL,x
|
dec ForceTableL,x
|
||||||
lda EnergyTableL,x
|
lda ForceTableL,x
|
||||||
cmp #$ff
|
cmp #$ff
|
||||||
bne @+
|
bne @+
|
||||||
dec EnergyTableH,x
|
dec ForceTableH,x
|
||||||
bpl @+
|
bpl @+
|
||||||
ForceGoesZero
|
ForceGoesZero
|
||||||
lda #0
|
lda #0
|
||||||
sta EnergyTableH,x
|
sta ForceTableH,x
|
||||||
sta EnergyTableL,x
|
sta ForceTableL,x
|
||||||
@
|
@
|
||||||
jmp BeforeFire
|
jmp BeforeFire
|
||||||
|
|
||||||
@@ -1113,11 +1113,11 @@ CTRLPressedDown
|
|||||||
|
|
||||||
ldx TankNr
|
ldx TankNr
|
||||||
sec
|
sec
|
||||||
lda EnergyTableL,x
|
lda ForceTableL,x
|
||||||
sbc #10
|
sbc #10
|
||||||
sta EnergyTableL,x
|
sta ForceTableL,x
|
||||||
jcs BeforeFire
|
jcs BeforeFire
|
||||||
dec EnergyTableH,x
|
dec ForceTableH,x
|
||||||
bmi ForceGoesZero
|
bmi ForceGoesZero
|
||||||
jmp BeforeFire
|
jmp BeforeFire
|
||||||
|
|
||||||
@@ -1221,9 +1221,9 @@ RandomizeOffensiveText
|
|||||||
sta Force+1
|
sta Force+1
|
||||||
bne AfterStrongShoot
|
bne AfterStrongShoot
|
||||||
NotStrongShoot
|
NotStrongShoot
|
||||||
lda EnergyTableL,x
|
lda ForceTableL,x
|
||||||
sta Force
|
sta Force
|
||||||
lda EnergyTableH,x
|
lda ForceTableH,x
|
||||||
sta Force+1
|
sta Force+1
|
||||||
AfterStrongShoot
|
AfterStrongShoot
|
||||||
lda #$0
|
lda #$0
|
||||||
@@ -1845,9 +1845,9 @@ SecondFlight .proc
|
|||||||
; ---------------- copied code fragment from before firing. not too elegant.
|
; ---------------- copied code fragment from before firing. not too elegant.
|
||||||
; ---------------- get fire parameters again
|
; ---------------- get fire parameters again
|
||||||
ldx TankNr
|
ldx TankNr
|
||||||
lda EnergyTableL,x
|
lda ForceTableL,x
|
||||||
sta Force
|
sta Force
|
||||||
lda EnergyTableH,x
|
lda ForceTableH,x
|
||||||
sta Force+1
|
sta Force+1
|
||||||
lda #$0
|
lda #$0
|
||||||
sta Force+2
|
sta Force+2
|
||||||
|
|||||||
Reference in New Issue
Block a user