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