Shield with energy added

Only for test.
Now all players has active Shield with energy (99) before game.
This commit is contained in:
Pecusx
2022-06-08 21:52:19 +02:00
parent 4c6b56a1e2
commit eace9eb5cf
8 changed files with 97 additions and 17 deletions
+2 -2
View File
@@ -871,9 +871,9 @@ NamesOfWeapons ;the comment is an index in the tables
dta d"Parachute " ; 53
dta d"Battery " ; 54
dta d"Mag Deflector " ; 55
dta d"Shield " ; 56
dta d"Shield " ; 56 - shield for one shot
dta d"Force Shield " ; 57
dta d"Heavy Shield " ; 58
dta d"Heavy Shield " ; 58 - shield with energy
dta d"Super Mag " ; 59
dta d"Auto Defense " ; 60
dta d"Fuel Tank " ; 61
+17 -3
View File
@@ -642,6 +642,7 @@ DrawTankNrX
sta xdraw+1
lda ytankstable,x
sta ydraw
mva #0 ydraw+1
jsr TypeChar
@@ -694,9 +695,12 @@ NoPlayerMissile
; draw defensive weapons like shield ( tank number in X )
; in xdraw, ydraw we have coordinates left LOWER corner of Tank char
lda ActiveDefenceWeapon,x
cmp #56 ; check shield activation
cmp #56 ; check one shot shield activation
beq ShieldDraw
cmp #58 ; check shield with energy activation
bne NoShieldDraw
jsr DrawTankShield
ShieldDraw
jsr DrawTankShield.DrawInPosition
NoShieldDraw
DoNotDrawTankNr
rts
@@ -726,11 +730,21 @@ tankflash_loop
;--------------------------------------------------
.proc DrawTankShield
; X - tank number
; if use DrawInPosition entry point then:
; xdraw, ydraw - coordinates left LOWER corner of Tank char
; values remain there after a DrawTankNr proc.
;
; this proc change xdraw, ydraw and temp!
;--------------------------------------------------
lda xtankstableL,x
sta xdraw
lda xtankstableH,x
sta xdraw+1
lda ytankstable,x
sta ydraw
mva #0 ydraw+1
DrawInPosition
mva #1 color
lda erase
beq ShieldVisible
+31 -4
View File
@@ -129,12 +129,12 @@ START
jsr RandomizeSequence
; for the round #1 shooting sequence is random
; activate shield for all players (test)
lda #56
; activate shield with energy for all players (test)
ldx numberOfPlayers
dex
@
sta ActiveDefenceWeapon,x
mva #58 ActiveDefenceWeapon,x
mva #99 ShieldEnergy,x ; set energy of shield
dex
bpl @-
; shield activated! (test)
@@ -658,7 +658,7 @@ MetodOfDeath
;--------------------------------------------------
.proc DecreaseEnergyX
;Decreases energy of player nr X
;Decreases energy of player nr X by the value Y
;increases his financial loss
;increases gain of tank TankNr
;--------------------------------------------------
@@ -696,6 +696,33 @@ NotNegativeEnergy
rts
.endp
;--------------------------------------------------
.proc DecreaseShieldEnergyX
; Decreases energy of shield player nr X by the value Y
; if shield energy is 0 after decrease then in Y we have
; rest of the energy - to decrease tank energy
;--------------------------------------------------
sty EnergyDecrease
ldy #0 ; if Shield survive then no decrease tank anergy
; Energy cannot be less than 0
lda ShieldEnergy,x
cmp EnergyDecrease
bcc ldahashzero
;sec
sbc EnergyDecrease
bpl NotNegativeEnergy
ldahashzero
; now calculate rest of energy for future tank energy decrease
sec
lda EnergyDecrease
sbc ShieldEnergy,x
tay
lda #0
NotNegativeEnergy
sta ShieldEnergy,x
rts
.endp
;---------------------------------
.proc Seppuku
lda #0
BIN
View File
Binary file not shown.
+28 -6
View File
@@ -1709,6 +1709,28 @@ FinishResultDisplay
mwa #textbuffer+48 displayposition
jsr displaybyte
;---------------------
;displaying the energy of a tank shield (if exist)
;---------------------
; clear (if no shield)
lda #$00 ; space
sta textbuffer+40+10
sta textbuffer+40+11
sta textbuffer+40+12
sta textbuffer+40+13
; check shield energy and display it
ldx TankNr
lda ShieldEnergy,x
beq NoShieldEnergy
sta decimal ; displayed value
lda #$08 ; (
sta textbuffer+40+10
mwa #textbuffer+40+11 displayposition
jsr displaybyte
lda #$09 ; )
sta textbuffer+40+13
NoShieldEnergy
;=========================
;display Force
;=========================
@@ -1717,7 +1739,7 @@ FinishResultDisplay
sta decimal
lda ForceTableH,x
sta decimal+1
mwa #textbuffer+40+34 displayposition
mwa #textbuffer+40+36 displayposition
jsr displaydec
;=========================
@@ -1729,9 +1751,9 @@ FinishResultDisplay
lda AngleTable,x
bmi AngleToLeft
lda #$7f ; (tab) character
sta textbuffer+40+23
sta textbuffer+40+25
lda #0 ;space
sta textbuffer+40+20
sta textbuffer+40+22
lda #90
sec
sbc AngleTable,x
@@ -1748,12 +1770,12 @@ AngleToLeft
lda BarrelTableL,y
sta CharCode
lda #$7e ;(del) char
sta textbuffer+40+20
sta textbuffer+40+22
lda #0 ;space
sta textbuffer+40+23
sta textbuffer+40+25
AngleDisplay
mwa #textbuffer+40+21 displayposition
mwa #textbuffer+40+23 displayposition
jsr displaybyte
;=========================
+2
View File
@@ -66,6 +66,8 @@ looseL
;----------------------------------------------------
Energy
.DS [MaxPlayers]
ShieldEnergy
.DS [MaxPlayers]
EnergyDecrease .DS 1
eXistenZ
.DS [MaxPlayers]
+16 -1
View File
@@ -667,11 +667,26 @@ DistanceCheckLoop
tay
; check shields
lda ActiveDefenceWeapon,x
cmp #56 ; shield
cmp #56 ; one hit shield
beq UseShield
cmp #58 ; shield with energy
beq UseShieldWithEnergy
jsr DecreaseEnergyX
jmp EndOfDistanceCheckLoop
UseShieldWithEnergy
jsr DecreaseShieldEnergyX
cpy #0 ; is necessary to reduce tenk energy ?
beq ShieldCoveredTank
jsr DecreaseEnergyX
ShieldCoveredTank
lda ShieldEnergy,x
jne EndOfDistanceCheckLoop
ShieldEnergy0 ; deactivate if no energy. it's like use one hit shield :)
UseShield
mva #1 Erase
phx
jsr DrawTankShield
plx
mva #0 ActiveDefenceWeapon,x ; deactivate defense weapons
TankIsNotWithinTheRange
EndOfDistanceCheckLoop