Merge pull request #101 from pkali/develop

build 146
This commit is contained in:
2022-07-03 23:36:12 -04:00
committed by GitHub
12 changed files with 654 additions and 760 deletions
+23 -3
View File
@@ -47,20 +47,40 @@ With the advent of fujinet (https://fujinet.online/) we are thinking about makin
## Changes: ## Changes:
###### Build 146
2022-07-03
Super heavy rewrite build.
Not much changed visually since the last build, but really large parts of the code were rewritten, optimized and improved. A fresh swath of buggies certainly introduced, too.
- completely new tank falling routine by @Pecusx - over 300 bytes saved, complexity reduced, more just energy deduction when falling.
- silly angle system rewritten to a proper, primary school angling. BTW - I had to dig into 8th grade trig to make it work. About 200 bytes saved, complexity reduced. Next build will have improved angle speed UI. I will also allow for an easier improvement of tank visuals.
- Weapon price and quantity balance - this is our honest attempt to make game more fun. We'll accept any critique and improvement proposals.
- New AI opponent - Tosser! Not much better than Poolshark, but still beats sharks most of the time.
- AI opponents can purchase defensive weapons what makes playing against AI somewhat more challenging.
- Improved Laser. It is still not ideal, but better. Still hard to aim :]
- Few small parachute related bugs fixed
- Death's Head bug fix
Issues closed:
- https://github.com/pkali/scorch_src/issues/87 Angles are reasonable now. PROFIT!!!
###### Build 145 ###### Build 145
2022-06-26 2022-06-26
Possibly last round of weapon additions! Possibly last round of weapon additions!
@Pecusx added @Pecusx added
- working White Flag -- it is a way to give up while not making opponents richer! - working White Flag -- it is a way to give up while not making opponents richer!
- Battery - a must for every tank with low energy. - Battery - a must for every tank with low energy.
- Strong Parachute - like a normal parachute, but stronger (it has energy and can work more than once) - Strong Parachute - like a normal parachute, but stronger (it has energy and can work more than once)
- Nuclear Winter - a quick and efficient solution to global worming, err, warning, WARMING! - Nuclear Winter - a quick and efficient solution to global worming, err, warning, WARMING!
@mikerro added new SFX and in-game-tunes. @mikerro added new SFX and in-game-tunes.
- Pressing [S] turns on/off SFX (when aiming). Pressing [M] turns on/off in-game tunes. - Pressing [S] turns on/off SFX (when aiming). Pressing [M] turns on/off in-game tunes.
Tickets closed: Tickets closed:
- https://github.com/pkali/scorch_src/issues/54 - holding joystick up or down longer speeds up force change. It makes playing with joystick much nicer. - https://github.com/pkali/scorch_src/issues/54 - holding a joystick up or down speeds up force change. It makes playing with a joystick much nicer.
- https://github.com/pkali/scorch_src/issues/76 - a beginning of visual tweaks by Adam - https://github.com/pkali/scorch_src/issues/76 - a beginning of visual tweaks by @6502adam
- infinite defensive weapons purchase bug fixed, to chagrin of some... - infinite defensive weapons purchase bug fixed, to the chagrin of some...
###### Build 144 ###### Build 144
2022-06-19 2022-06-19
+186 -66
View File
@@ -9,7 +9,7 @@
; greeeting to myself 10 years older in 2013-11-09... still no idea ; greeeting to myself 10 years older in 2013-11-09... still no idea
;---------------------------------------------- ;----------------------------------------------
MakeLowResDistances .proc .proc MakeLowResDistances
; create low precision table of positions ; create low precision table of positions
; by dividing positions by 4 ; by dividing positions by 4
@@ -30,7 +30,7 @@ loop
.endp .endp
;---------------------------------------------- ;----------------------------------------------
ArtificialIntelligence .proc ; .proc ArtificialIntelligence ;
; A - skill of the TankNr ; A - skill of the TankNr
; returns shoot energy and angle in ; returns shoot energy and angle in
; ForceTable/L/H and AngleTable ; ForceTable/L/H and AngleTable
@@ -42,6 +42,13 @@ ArtificialIntelligence .proc ;
pha pha
lda AIRoutines,x lda AIRoutines,x
pha pha
ldx TankNr ; common values used in AI routines
; address of weapons table (for future use)
lda TanksWeaponsTableL,x
sta temp
lda TanksWeaponsTableH,x
sta temp+1
rts rts
.endp .endp
;---------------- ;----------------
@@ -49,15 +56,14 @@ AIRoutines
.word Moron-1 .word Moron-1
.word Shooter-1 ;Shooter .word Shooter-1 ;Shooter
.word Poolshark-1 ;Poolshark .word Poolshark-1 ;Poolshark
.word Poolshark-1 ;Toosser .word Tosser-1 ;Tosser
.word Poolshark-1 ;Chooser .word Poolshark-1 ;Chooser
.word Poolshark-1 ;Spoiler .word Poolshark-1 ;Spoiler
.word Poolshark-1 ;Cyborg .word Poolshark-1 ;Cyborg
.word Poolshark-1 ;Unknown .word Poolshark-1 ;Unknown
;---------------------------------------------- ;----------------------------------------------
Moron .proc .proc Moron
ldx TankNr
jsr RandomizeAngle jsr RandomizeAngle
sta NewAngle sta NewAngle
mwa #80 RandBoundaryLow mwa #80 RandBoundaryLow
@@ -66,21 +72,29 @@ Moron .proc
rts rts
.endp .endp
;---------------------------------------------- ;----------------------------------------------
Shooter .proc .proc Shooter
ldx TankNr
lda PreviousAngle,x lda PreviousAngle,x
ora PreviousEnergyL,x ora PreviousEnergyL,x
ora PreviousEnergyH,x ora PreviousEnergyH,x
beq firstShoot beq firstShoot
lda PreviousAngle,x lda PreviousAngle,x
cmp #90
bcs shootingLeftAtThisMomentOfTime
; shooting right at this moment of time
sec
sbc #5
cmp #10
bcs @+ ;not smaller than 10
bcc firstShoot ; GET THE aim againg
shootingLeftAtThisMomentOfTime
clc clc
adc #5 adc #5
bmi @+ cmp #170 ; maximum shooter angle
cmp #90 bcs firstShoot
bcc @+
lda #(-90)
@ @
sta NewAngle sta NewAngle
@@ -89,42 +103,36 @@ Shooter .proc
sbc #5 sbc #5
sta ForceTableL,x sta ForceTableL,x
lda PreviousEnergyH,x lda PreviousEnergyH,x
sbc #0 sbc #0
sta ForceTableH,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 xTanksTableH,x
cmp #>(screenwidth/2)
bne @+
lda xTanksTableL,x lda xTanksTableL,x
sta temp cmp #<(screenwidth/2)
lda xTanksTableH,x @ bcc tankIsOnTheRight
sta temp+1
cpw temp #(screenwidth/2)
bcs tankIsOnTheRight
lda RANDOM
and #$1F
clc
adc #5
; enemy tank is on the left
randomize 95 125
sta NewAngle sta NewAngle
jmp forceNow bne forceNow
tankIsOnTheRight tankIsOnTheRight
lda RANDOM randomize 55 85
and #$1F sta NewAngle
clc
adc #(-85)
;lda #-45
sta NewAngle
forceNow forceNow
mwa #100 RandBoundaryLow mwa #100 RandBoundaryLow
mwa #800 RandBoundaryHigh mwa #800 RandBoundaryHigh
ldx TankNr ;this is possibly not necessary ;ldx TankNr ;this is possibly not necessary
jsr RandomizeForce jsr RandomizeForce
endo endo
ldx TankNr ;this is possibly not necessary ;ldx TankNr ;this is possibly not necessary
jsr RandomizeForce.LimitForce jsr RandomizeForce.LimitForce
lda NewAngle lda NewAngle
sta PreviousAngle,x sta PreviousAngle,x
@@ -135,28 +143,66 @@ endo
; choose the best weapon ; choose the best weapon
lda TanksWeaponsTableL,x
sta temp
lda TanksWeaponsTableH,x
sta temp+1
ldy #32 ;the last weapon ldy #32 ;the last weapon
loop loop
dey dey
lda (temp),y lda (temp),y ; this is set up before calling the routine, has address of TanksWeaponsTable
beq loop beq loop
tya tya
sta ActiveWeapon,x sta ActiveWeapon,x
rts rts
.endp .endp
;---------------------------------------------- ;----------------------------------------------
Poolshark .proc .proc Poolshark
; defensives
; if low energy ten use battery
lda Energy,x
cmp #30
bcs EnoughEnergy
; lower than 30 units - check battery
ldy #ind_Battery________
lda (temp),y ; has address of TanksWeaponsTable
beq NoBatteries
; we have batteries - use one
clc
sbc #1
sta (temp),y
lda #99
sta Energy,x
NoBatteries
EnoughEnergy
; use best defensive :)
; but not allways
randomize 1 3
cmp #1
bne NoUseDefensive
; first check check if any is in use
lda ActiveDefenceWeapon,x
bne DefensiveInUse
ldy #ind_Nuclear_Winter_+1 ;the last defensive weapon
@
dey
cpy #ind_Battery________ ;first defensive weapon (White Flag nad Battery - never use)
beq NoUseDefensive
lda (temp),y ; has address of TanksWeaponsTable
beq @-
tya
; activate defensive weapon
sta ActiveDefenceWeapon,x
lda DefensiveEnergy,y
sta ShieldEnergy,x
; decrease in inventory
clc
sbc #1
sta (temp),y ; has address of TanksWeaponsTable
NoUseDefensive
DefensiveInUse
firstShoot firstShoot
;find nearest tank neighbour ;find nearest tank neighbour
jsr MakeLowResDistances jsr MakeLowResDistances
mva #$ff temp2 ; min possible distance mva #$ff temp2 ; min possible distance
ldx TankNr ;ldx TankNr
ldy NumberOfPlayers ldy NumberOfPlayers
dey dey
@@ -217,7 +263,7 @@ forceNow
jsr RandomizeForce jsr RandomizeForce
endo endo
ldx TankNr ;this is possibly not necessary ;ldx TankNr ;this is possibly not necessary
; choose the best weapon ; choose the best weapon
@@ -225,7 +271,7 @@ endo
sta temp sta temp
lda TanksWeaponsTableH,x lda TanksWeaponsTableH,x
sta temp+1 sta temp+1
ldy #32 ;the last weapon ldy #ind_Laser__________ ;the last offensive weapon
loop loop
dey dey
lda (temp),y lda (temp),y
@@ -236,11 +282,39 @@ loop
;---------------------------------------------- ;----------------------------------------------
AngleTable ; 16 bytes ;ba w $348b L$3350 AngleTable ; 16 bytes ;ba w $348b L$3350
.by 178,186,194,202,210,218,226,234 .by 106,114,122,130,138,146,154,162
.by 16,24,32,40,48,56,64,72 .by 18,26,34,43,50,58,66,74
.endp .endp
;---------------------------------------------- ;----------------------------------------------
PurchaseAI .proc ; .proc Tosser
; use best defensive :)
; allways
; first check check if any is in use
lda ActiveDefenceWeapon,x
bne DefensiveInUse
ldy #ind_Nuclear_Winter_+1 ;the last defensive weapon
@
dey
cpy #ind_Battery________ ;first defensive weapon (White Flag nad Battery - never use)
beq NoUseDefensive
lda (temp),y ; has address of TanksWeaponsTable
beq @-
tya
; activate defensive weapon
sta ActiveDefenceWeapon,x
lda DefensiveEnergy,y
sta ShieldEnergy,x
; decrease in inventory
clc
sbc #1
sta (temp),y
DefensiveInUse
NoUseDefensive
; Toosser is like Poolshark but allways uses defensives
jmp Poolshark
.endp
;----------------------------------------------
.proc PurchaseAI ;
; A - skill of the TankNr ; A - skill of the TankNr
; makes purchase for AI opponents ; makes purchase for AI opponents
; results of this routine are not visible on the screen ; results of this routine are not visible on the screen
@@ -260,21 +334,22 @@ PurchaseAIRoutines
.word MoronPurchase-1 .word MoronPurchase-1
.word ShooterPurchase-1 ;ShooterPurchase .word ShooterPurchase-1 ;ShooterPurchase
.word PoolsharkPurchase-1 ;PoolsharkPurchase .word PoolsharkPurchase-1 ;PoolsharkPurchase
.word PoolsharkPurchase-1 ;ToosserPurchase .word TosserPurchase-1 ;TosserPurchase
.word PoolsharkPurchase-1 ;ChooserPurchase .word PoolsharkPurchase-1 ;ChooserPurchase
.word PoolsharkPurchase-1 ;SpoilerPurchase .word PoolsharkPurchase-1 ;SpoilerPurchase
.word PoolsharkPurchase-1 ;CyborgPurchase .word PoolsharkPurchase-1 ;CyborgPurchase
.word PoolsharkPurchase-1 ;UnknownPurchase .word PoolsharkPurchase-1 ;UnknownPurchase
;---------------------------------------------- ;----------------------------------------------
MoronPurchase .proc MoronPurchase
;Moron buys nothing ;Moron buys nothing
rts rts
.endp
;------- ;-------
TryToPurchaseOnePiece .proc .proc TryToPurchaseOnePiece
; A - weapon number, better it will be in range(1,32) ; A - weapon number, better it will be in range(1,32)
; TankNr in X ; TankNr in X
; DOES NOT CHANGE X
tay tay
lda PurchaseMeTable,y lda PurchaseMeTable,y
beq SorryNoPurchase beq SorryNoPurchase
@@ -320,28 +395,73 @@ SorryNoPurchase
;---------------------------------------------- ;----------------------------------------------
ShooterPurchase .proc .proc ShooterPurchase
mva #4 tempXroller; number of purchases to perform ; first try to buy defensives
mva #2 tempXroller; number of offensive purchases to perform
ldx TankNr ldx TankNr
loop @
randomize 1 14 randomize ind_Battery________ ind_StrongParachute
jsr TryToPurchaseOnePiece jsr TryToPurchaseOnePiece
dec tempXroller dec tempXroller
bne loop bne @-
rts ; and now offensives
.endp mva #4 tempXroller; number of offensive purchases to perform
;---------------------------------------------- ;ldx TankNr
PoolsharkPurchase .proc @
mva #8 tempXroller; number of purchases to perform randomize ind_Missile________ ind_Heavy_Roller___
ldx TankNr
loop
randomize 1 30
jsr TryToPurchaseOnePiece jsr TryToPurchaseOnePiece
dec tempXroller dec tempXroller
bne loop bne @-
rts rts
.endp .endp
;----------------------------------------------
.proc PoolsharkPurchase
; first try to buy defensives
mva #3 tempXroller; number of offensive purchases to perform
ldx TankNr
@
randomize ind_Battery________ ind_Auto_Defense___
jsr TryToPurchaseOnePiece
dec tempXroller
bne @-
; and now offensives
mva #8 tempXroller; number of purchases to perform
;ldx TankNr
@
randomize ind_Missile________ ind_Dirt_Charge____
jsr TryToPurchaseOnePiece
dec tempXroller
bne @-
rts
.endp
;----------------------------------------------
.proc TosserPurchase
; what is my money level
ldx TankNr
lda MoneyH,x ; money / 256
sta tempXroller ; perform this many purchase attempts
; first try to buy defensives
mva #3 tempXroller; number of defensive purchases to perform
@
randomize ind_Battery________ ind_Auto_Defense___
jsr TryToPurchaseOnePiece
dec tempXroller
bne @-
; and now offensives
lda MoneyH,x ; money / 256
asl ;*2
sta tempXroller ; perform this many purchase attempts
@
randomize ind_Missile________ ind_Dirt_Charge____
jsr TryToPurchaseOnePiece
dec tempXroller
bne @-
rts
.endp
Binary file not shown.
+110 -352
View File
@@ -70,32 +70,6 @@ pmtableH
.by >(pmgraph+$700) .by >(pmgraph+$700)
.by >(pmgraph+$300) .by >(pmgraph+$300)
;----------- ;-----------
; this table changes Angle to the appropriate tank character
BarrelTableL
.by $02,$02,$02,$02,$02,$02,$02,$02
.by $04,$04,$04,$04,$04,$04,$04,$04
.by $06,$06,$06,$06,$06,$06,$06,$06,$06
.by $08,$08,$08,$08,$08,$08,$08,$08
.by $0a,$0a,$0a,$0a,$0a,$0a,$0a,$0a
.by $0c,$0c,$0c,$0c,$0c,$0c,$0c,$0c,$0c
.by $0e,$0e,$0e,$0e,$0e,$0e,$0e,$0e
.by $10,$10,$10,$10,$10,$10,$10,$10
.by $12,$12,$12,$12,$12,$12,$12,$12,$12
.by $14,$14,$14,$14,$14,$14,$14,$14
.by $16,$16,$16,$16,$16,$16,$16,$16
BarrelTableR
.by $2c,$2c,$2c,$2c,$2c,$2c,$2c,$2c
.by $2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a
.by $28,$28,$28,$28,$28,$28,$28,$28,$28
.by $26,$26,$26,$26,$26,$26,$26,$26
.by $24,$24,$24,$24,$24,$24,$24,$24
.by $22,$22,$22,$22,$22,$22,$22,$22,$22
.by $20,$20,$20,$20,$20,$20,$20,$20
.by $1e,$1e,$1e,$1e,$1e,$1e,$1e,$1e
.by $1c,$1c,$1c,$1c,$1c,$1c,$1c,$1c,$1c
.by $1a,$1a,$1a,$1a,$1a,$1a,$1a,$1a
.by $18,$18,$18,$18,$18,$18,$18,$18
sintable sintable
.by 0 .by 0
.by 4 .by 4
@@ -210,332 +184,100 @@ disktance ;tanks distance
; this table is for deciding where a tank should slide ; this table is for deciding where a tank should slide
; accordingly to what is below the tank ; accordingly to what is below the tank
; there are 3 bits used here ; values in table mean that tank is moving to the left
; bit 0 - go down SlideLeftTable
; bit 1 - go left .BY %00000001
; bit 2 - go right .BY %00000010
; position in the table equals to bit pattern of soil below tank .BY %00000011
.BY %00000100
.BY %00000101
.BY %00000110
.BY %00000111
.BY %00001100
WhereToSlideTable ;-----------------------------------------------------------
; we have 3 bits, when set: 2 - go left, 1 - go right, 0 - go down ; this table changes Angle to the appropriate tank character
.BY %001 ; 00000000 BarrelTable
.BY %101 ; 00000001
.BY %100 ; 00000010 .by $2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2A,$2A,
.BY %100 ; 00000011 .by $2A,$2A,$2A,$2A,$2A,$2A,$28,$28,$28,$28,
.BY %100 ; 00000100 .by $28,$28,$28,$28,$28,$26,$26,$26,$26,$26,
.BY %100 ; 00000101 .by $26,$26,$26,$24,$24,$24,$24,$24,$24,$24,
.BY %100 ; 00000110 .by $24,$22,$22,$22,$22,$22,$22,$22,$22,$22,
.BY %100 ; 00000111 .by $20,$20,$20,$20,$20,$20,$20,$20,$1E,$1E,
.BY %000 ; 00001000 .by $1E,$1E,$1E,$1E,$1E,$1E,$1C,$1C,$1C,$1C,
.BY %000 ; 00001001 .by $1C,$1C,$1C,$1C,$1C,$1A,$1A,$1A,$1A,$1A,
.BY %000 ; 00001010 .by $1A,$1A,$1A,$18,$18,$18,$18,$18,$18,$18,
.BY %000 ; 00001011 ;.by $18,
.BY %100 ; 00001100
.BY %000 ; 00001101 .by $16,$16,$16,$16,$16,$16,$16,$16,$14,$14,
.BY %000 ; 00001110 .by $14,$14,$14,$14,$14,$14,$12,$12,$12,$12,
.BY %000 ; 00001111 .by $12,$12,$12,$12,$12,$10,$10,$10,$10,$10,
.BY %000 ; 00010000 .by $10,$10,$10,$0E,$0E,$0E,$0E,$0E,$0E,$0E,
.BY %000 ; 00010001 .by $0E,$0C,$0C,$0C,$0C,$0C,$0C,$0C,$0C,$0C,
.BY %000 ; 00010010 .by $0A,$0A,$0A,$0A,$0A,$0A,$0A,$0A,$08,$08,
.BY %000 ; 00010011 .by $08,$08,$08,$08,$08,$08,$06,$06,$06,$06,
.BY %000 ; 00010100 .by $06,$06,$06,$06,$06,$04,$04,$04,$04,$04,
.BY %000 ; 00010101 .by $04,$04,$04,$02,$02,$02,$02,$02,$02,$02,
.BY %000 ; 00010110 .by $02,
.BY %000 ; 00010111
.BY %000 ; 00011000
.BY %000 ; 00011001
.BY %000 ; 00011010
.BY %000 ; 00011011
.BY %000 ; 00011100
.BY %000 ; 00011101
.BY %000 ; 00011110
.BY %000 ; 00011111
.BY %010 ; 00100000
.BY %000 ; 00100001
.BY %000 ; 00100010
.BY %000 ; 00100011
.BY %000 ; 00100100
.BY %000 ; 00100101
.BY %000 ; 00100110
.BY %000 ; 00100111
.BY %000 ; 00101000
.BY %000 ; 00101001
.BY %000 ; 00101010
.BY %000 ; 00101011
.BY %000 ; 00101100
.BY %000 ; 00101101
.BY %000 ; 00101110
.BY %000 ; 00101111
.BY %010 ; 00110000
.BY %000 ; 00110001
.BY %000 ; 00110010
.BY %000 ; 00110011
.BY %000 ; 00110100
.BY %000 ; 00110101
.BY %000 ; 00110110
.BY %000 ; 00110111
.BY %000 ; 00111000
.BY %000 ; 00111001
.BY %000 ; 00111010
.BY %000 ; 00111011
.BY %000 ; 00111100
.BY %000 ; 00111101
.BY %000 ; 00111110
.BY %000 ; 00111111
.BY %010 ; 01000000
.BY %000 ; 01000001
.BY %000 ; 01000010
.BY %000 ; 01000011
.BY %000 ; 01000100
.BY %000 ; 01000101
.BY %000 ; 01000110
.BY %000 ; 01000111
.BY %000 ; 01001000
.BY %000 ; 01001001
.BY %000 ; 01001010
.BY %000 ; 01001011
.BY %000 ; 01001100
.BY %000 ; 01001101
.BY %000 ; 01001110
.BY %000 ; 01001111
.BY %000 ; 01010000
.BY %000 ; 01010001
.BY %000 ; 01010010
.BY %000 ; 01010011
.BY %000 ; 01010100
.BY %000 ; 01010101
.BY %000 ; 01010110
.BY %000 ; 01010111
.BY %000 ; 01011000
.BY %000 ; 01011001
.BY %000 ; 01011010
.BY %000 ; 01011011
.BY %000 ; 01011100
.BY %000 ; 01011101
.BY %000 ; 01011110
.BY %000 ; 01011111
.BY %010 ; 01100000
.BY %000 ; 01100001
.BY %000 ; 01100010
.BY %000 ; 01100011
.BY %000 ; 01100100
.BY %000 ; 01100101
.BY %000 ; 01100110
.BY %000 ; 01100111
.BY %000 ; 01101000
.BY %000 ; 01101001
.BY %000 ; 01101010
.BY %000 ; 01101011
.BY %000 ; 01101100
.BY %000 ; 01101101
.BY %000 ; 01101110
.BY %000 ; 01101111
.BY %000 ; 01110000
.BY %000 ; 01110001
.BY %000 ; 01110010
.BY %000 ; 01110011
.BY %000 ; 01110100
.BY %000 ; 01110101
.BY %000 ; 01110110
.BY %000 ; 01110111
.BY %000 ; 01111000
.BY %000 ; 01111001
.BY %000 ; 01111010
.BY %000 ; 01111011
.BY %000 ; 01111100
.BY %000 ; 01111101
.BY %000 ; 01111110
.BY %000 ; 01111111
.BY %011 ; 10000000
.BY %000 ; 10000001
.BY %000 ; 10000010
.BY %000 ; 10000011
.BY %000 ; 10000100
.BY %000 ; 10000101
.BY %000 ; 10000110
.BY %000 ; 10000111
.BY %000 ; 10001000
.BY %000 ; 10001001
.BY %000 ; 10001010
.BY %000 ; 10001011
.BY %000 ; 10001100
.BY %000 ; 10001101
.BY %000 ; 10001110
.BY %000 ; 10001111
.BY %000 ; 10010000
.BY %000 ; 10010001
.BY %000 ; 10010010
.BY %000 ; 10010011
.BY %000 ; 10010100
.BY %000 ; 10010101
.BY %000 ; 10010110
.BY %000 ; 10010111
.BY %000 ; 10011000
.BY %000 ; 10011001
.BY %000 ; 10011010
.BY %000 ; 10011011
.BY %000 ; 10011100
.BY %000 ; 10011101
.BY %000 ; 10011110
.BY %000 ; 10011111
.BY %010 ; 10100000
.BY %000 ; 10100001
.BY %000 ; 10100010
.BY %000 ; 10100011
.BY %000 ; 10100100
.BY %000 ; 10100101
.BY %000 ; 10100110
.BY %000 ; 10100111
.BY %000 ; 10101000
.BY %000 ; 10101001
.BY %000 ; 10101010
.BY %000 ; 10101011
.BY %000 ; 10101100
.BY %000 ; 10101101
.BY %000 ; 10101110
.BY %000 ; 10101111
.BY %000 ; 10110000
.BY %000 ; 10110001
.BY %000 ; 10110010
.BY %000 ; 10110011
.BY %000 ; 10110100
.BY %000 ; 10110101
.BY %000 ; 10110110
.BY %000 ; 10110111
.BY %000 ; 10111000
.BY %000 ; 10111001
.BY %000 ; 10111010
.BY %000 ; 10111011
.BY %000 ; 10111100
.BY %000 ; 10111101
.BY %000 ; 10111110
.BY %000 ; 10111111
.BY %010 ; 11000000
.BY %000 ; 11000001
.BY %000 ; 11000010
.BY %000 ; 11000011
.BY %000 ; 11000100
.BY %000 ; 11000101
.BY %000 ; 11000110
.BY %000 ; 11000111
.BY %000 ; 11001000
.BY %000 ; 11001001
.BY %000 ; 11001010
.BY %000 ; 11001011
.BY %000 ; 11001100
.BY %000 ; 11001101
.BY %000 ; 11001110
.BY %000 ; 11001111
.BY %000 ; 11010000
.BY %000 ; 11010001
.BY %000 ; 11010010
.BY %000 ; 11010011
.BY %000 ; 11010100
.BY %000 ; 11010101
.BY %000 ; 11010110
.BY %000 ; 11010111
.BY %000 ; 11011000
.BY %000 ; 11011001
.BY %000 ; 11011010
.BY %000 ; 11011011
.BY %000 ; 11011100
.BY %000 ; 11011101
.BY %000 ; 11011110
.BY %000 ; 11011111
.BY %010 ; 11100000
.BY %000 ; 11100001
.BY %000 ; 11100010
.BY %000 ; 11100011
.BY %000 ; 11100100
.BY %000 ; 11100101
.BY %000 ; 11100110
.BY %000 ; 11100111
.BY %000 ; 11101000
.BY %000 ; 11101001
.BY %000 ; 11101010
.BY %000 ; 11101011
.BY %000 ; 11101100
.BY %000 ; 11101101
.BY %000 ; 11101110
.BY %000 ; 11101111
.BY %000 ; 11110000
.BY %000 ; 11110001
.BY %000 ; 11110010
.BY %000 ; 11110011
.BY %000 ; 11110100
.BY %000 ; 11110101
.BY %000 ; 11110110
.BY %000 ; 11110111
.BY %000 ; 11111000
.BY %000 ; 11111001
.BY %000 ; 11111010
.BY %000 ; 11111011
.BY %000 ; 11111100
.BY %000 ; 11111101
.BY %000 ; 11111110
.BY %000 ; 11111111
EndOfTheBarrelX EndOfTheBarrelX
; right angles from 0 (vertically up) to 90 (horizontally to the right) ; right angles from 0 (horizontally right) to 90 (up)
.by 4,4,4,4,4,4,4,4,4,4,4
.by 5,5,5,5,5,5,5,5,5,5
.by 6,6,6,6,6,6,6,6,6
.by 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
.by 7,7,7,7,7,7,7,7,7
.by 7,7,7,7,7,7,7,7,7,7
.by 7,7,7,7,7,7,7,7,7,7,7,7,7
.by 7,7,7,7,7,7,7,7,7,7,7,7,7,7
.by 0,0,0,0,0,0,0,0,0,0 ; not used .by 7,7,7,7,7,7,7,7,7,7,
.by 0,0,0,0,0,0,0,0,0,0 ; not used .by 7,7,7,7,7,7,7,7,7,7,
.by 0,0,0,0,0,0,0,0,0,0 ; not used .by 7,7,7,7,7,7,7,7,7,7,
.by 0,0,0,0,0,0,0,0,0,0 ; not used .by 7,7,7,7,7,7,7,7,7,7,
.by 0,0,0,0,0,0,0,0,0,0 ; not used .by 7,7,7,7,7,7,7,7,7,7,
.by 0,0,0,0,0,0,0,0,0,0 ; not used .by 7,7,7,7,7,7,7,7,7,7,
.by 0,0,0,0,0,0,0,0,0,0 ; not used .by 7,6,6,6,6,6,6,6,6,6,
.by 0,0,0,0 ; not used .by 5,5,5,5,5,5,5,5,5,5,
.by 4,4,4,4,4,4,4,4,4,4,
;.by 4,
; left angles from 90 (horizontally to the left) to 1 (vertically up) ; left angles from 90 (vertical) to 180 (horizontally left)
.by 0,0,0,0,0,0,0,0,0,0,0,0,0,0 .by 3,3,3,3,3,3,3,3,3,3,
.by 0,0,0,0,0,0,0,0,0,0,0,0,0 .by 3,2,2,2,2,2,2,2,2,2,
.by 0,0,0,0,0,0,0,0,0,0 .by 2,1,1,1,1,1,1,1,1,1,
.by 0,0,0,0,0,0,0,0,0 .by 0,0,0,0,0,0,0,0,0,0,
.by 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 .by 0,0,0,0,0,0,0,0,0,0,
.by 1,1,1,1,1,1,1,1,1 .by 0,0,0,0,0,0,0,0,0,0,
.by 2,2,2,2,2,2,2,2,2,2 .by 0,0,0,0,0,0,0,0,0,0,
.by 3,3,3,3,3,3,3,3,3,3,3 .by 0,0,0,0,0,0,0,0,0,0,
.by 0,0,0,0,0,0,0,0,0,0,
.by 0
EndOfTheBarrelY EndOfTheBarrelY
; right angles from 0 (vertically up) to 90 (horizontally to the right) ; right angles from 0 (horizontally right) to 90 (up)
.by 7,7,7,7,7,7,7,7,7,7,7
.by 7,7,7,7,7,7,7,7,7,7
.by 7,7,7,7,7,7,7,7,7
.by 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
.by 6,6,6,6,6,6,6,6,6
.by 5,5,5,5,5,5,5,5,5,5
.by 4,4,4,4,4,4,4,4,4,4,4,4,4
.by 4,4,4,4,4,4,4,4,4,4,4,4,4,4 ; one pixel Up for fix problems with colision check
; .by 3,3,3,3,3,3,3,3,3,3,3,3,3,3
.by 0,0,0,0,0,0,0,0,0,0 ; not used ; one pixel Up for fix problems with colision check
.by 0,0,0,0,0,0,0,0,0,0 ; not used ;.by 3,3,3,3,3,3,3,3,3,3,3,3,3,3
.by 0,0,0,0,0,0,0,0,0,0 ; not used .by 4,4,4,4,4,4,4,4,4,4,
.by 0,0,0,0,0,0,0,0,0,0 ; not used .by 4,4,4,4,4,4,4,4,4,4,
.by 0,0,0,0,0,0,0,0,0,0 ; not used .by 4,4,4,4,4,4,4,5,5,5,
.by 0,0,0,0,0,0,0,0,0,0 ; not used .by 5,5,5,5,5,5,5,6,6,6,
.by 0,0,0,0,0,0,0,0,0,0 ; not used .by 6,6,6,6,6,6,7,7,7,7,
.by 0,0,0,0 ; not used .by 7,7,7,7,7,7,7,7,7,7,
.by 7,7,7,7,7,7,7,7,7,7,
.by 7,7,7,7,7,7,7,7,7,7,
.by 7,7,7,7,7,7,7,7,7,7,
;.by 7,
; left angles from 90 (vertical) to 180 (horizontally left)
.by 7,7,7,7,7,7,7,7,7,7,
.by 7,7,7,7,7,7,7,7,7,7,
.by 7,7,7,7,7,7,7,7,7,7,
.by 7,7,7,7,7,7,7,7,7,7,
.by 7,7,7,7,7,6,6,6,6,6,
.by 6,6,6,6,5,5,5,5,5,5,
.by 5,5,5,5,4,4,4,4,4,4,
.by 4,4,4,4,4,4,4,4,4,4,
.by 4,4,4,4,4,4,4,4,4,4,
.by 4,
; one pixel Up for fix problems with colision check
;.by 3,3,3,3,3,3,3,3,3,3,3,3,3,3
; left angles from 90 (horizontally to the left) to 1 (vertically up)
; .by 3,3,3,3,3,3,3,3,3,3,3,3,3,3
.by 4,4,4,4,4,4,4,4,4,4,4,4,4,4 ; one pixel Up for fix problems with colision check
.by 4,4,4,4,4,4,4,4,4,4,4,4,4
.by 5,5,5,5,5,5,5,5,5,5
.by 6,6,6,6,6,6,6,6,6
.by 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
.by 7,7,7,7,7,7,7,7,7
.by 7,7,7,7,7,7,7,7,7,7
.by 7,7,7,7,7,7,7,7,7,7,7
;------------------------------------------------- ;-------------------------------------------------
TanksNamesDefault TanksNamesDefault
@@ -687,18 +429,18 @@ WeaponPriceL
WeaponUnits WeaponUnits
.by 10 ;Baby_Missile___ .by 10 ;Baby_Missile___
.by 5 ;Missile________ .by 5 ;Missile________
.by 3 ;Baby_Nuke______ .by 2 ;Baby_Nuke______
.by 1 ;Nuke___________ .by 1 ;Nuke___________
.by 2 ;LeapFrog_______ .by 2 ;LeapFrog_______
.by 2 ;Funky_Bomb_____ .by 3 ;Funky_Bomb_____
.by 3 ;MIRV___________ .by 2 ;MIRV___________
.by 1 ;Death_s_Head___ .by 1 ;Death_s_Head___
.by 10 ;Napalm_________ .by 10 ;Napalm_________
.by 2 ;Hot_Napalm_____ .by 2 ;Hot_Napalm_____
.by 20 ;Tracer_________ .by 20 ;Tracer_________
.by 10 ;Smoke_Tracer___ .by 10 ;Smoke_Tracer___
.by 10 ;Baby_Roller____ .by 5 ;Baby_Roller____
.by 5 ;Roller_________ .by 3 ;Roller_________
.by 2 ;Heavy_Roller___ .by 2 ;Heavy_Roller___
.by 5 ;Riot_Charge____ .by 5 ;Riot_Charge____
.by 2 ;Riot_Blast_____ .by 2 ;Riot_Blast_____
@@ -710,9 +452,9 @@ WeaponUnits
.by 10 ;Baby_Sandhog___ .by 10 ;Baby_Sandhog___
.by 5 ;Sandhog________ .by 5 ;Sandhog________
.by 2 ;Heavy_Sandhog__ .by 2 ;Heavy_Sandhog__
.by 10 ;Dirt_Clod______ .by 5 ;Dirt_Clod______
.by 5 ;Dirt_Ball______ .by 3 ;Dirt_Ball______
.by 2 ;Ton_of_Dirt____ .by 1 ;Ton_of_Dirt____
.by 4 ;Liquid_Dirt____ .by 4 ;Liquid_Dirt____
.by 2 ;Dirt_Charge____ .by 2 ;Dirt_Charge____
.by 10 ;Earth_Disrupter .by 10 ;Earth_Disrupter
@@ -739,7 +481,7 @@ WeaponUnits
.by 5 ;Horz_Guidance__ .by 5 ;Horz_Guidance__
.by 5 ;Vert_Guidance__ .by 5 ;Vert_Guidance__
.by 2 ;Lazy_Boy_______ .by 2 ;Lazy_Boy_______
.by 8 ;Parachute______ .by 3 ;Parachute______
.by 2 ;StrongParachute .by 2 ;StrongParachute
.by 2 ;Mag_Deflector__ .by 2 ;Mag_Deflector__
.by 3 ;Shield_________ .by 3 ;Shield_________
@@ -800,6 +542,22 @@ PurchaseMeTable ;weapons good to be purchased by the robot
dta 0 ;"----------------" ; 45 dta 0 ;"----------------" ; 45
dta 0 ;"----------------" ; 46 dta 0 ;"----------------" ; 46
dta 0 ;"----------------" ; 47 dta 0 ;"----------------" ; 47
dta 0 ;"White Flag " ; 48
dta 1 ;"Battery " ; 49
dta 0 ;"Bal Guidance " ; 50
dta 0 ;"Horz Guidance " ; 51
dta 0 ;"Vert Guidance " ; 52
dta 0 ;"Lazy Boy " ; 53
dta 1 ;"Parachute " ; 54
dta 1 ;"Strong Parachute" ; 55
dta 1 ;"Mag Deflector " ; 56
dta 1 ;"Shield " ; 57
dta 1 ;"Force Shield " ; 58
dta 1 ;"Heavy Shield " ; 59
dta 0 ;"Super Mag " ; 60
dta 1 ;"Auto Defense " ; 61
dta 0 ;"Fuel Tank " ; 62
dta 0 ;"Nuclear Winter " ; 63
;------------------------------------------------- ;-------------------------------------------------
+19 -19
View File
@@ -23,27 +23,27 @@ price_Napalm_________ = $ffff ;496 ;_8
price_Hot_Napalm_____ = $ffff ;511 ;_9 price_Hot_Napalm_____ = $ffff ;511 ;_9
price_Tracer_________ = 102 ;_10 price_Tracer_________ = 102 ;_10
price_Smoke_Tracer___ = 291 ;_11 price_Smoke_Tracer___ = 291 ;_11
price_Baby_Roller____ = 689 ;_12 price_Baby_Roller____ = 211 ;_12
price_Roller_________ = 600 ;_13 price_Roller_________ = 244 ;_13
price_Heavy_Roller___ = 592 ;_14 price_Heavy_Roller___ = 326 ;_14
price_Riot_Charge____ = 330 ;_15 price_Riot_Charge____ = 230 ;_15
price_Riot_Blast_____ = 341 ;_16 price_Riot_Blast_____ = 241 ;_16
price_Riot_Bomb______ = 369 ;_17 price_Riot_Bomb______ = 259 ;_17
price_Heavy_Riot_Bomb = 322 ;_18 price_Heavy_Riot_Bomb = 272 ;_18
price_Baby_Digger____ = 336 ;_19 price_Baby_Digger____ = 136 ;_19
price_Digger_________ = 276 ;_20 price_Digger_________ = 176 ;_20
price_Heavy_Digger___ = 253 ;_21 price_Heavy_Digger___ = 207 ;_21
price_Baby_Sandhog___ = 218 ;_22 price_Baby_Sandhog___ = 158 ;_22
price_Sandhog________ = 191 ;_23 price_Sandhog________ = 191 ;_23
price_Heavy_Sandhog__ = 305 ;_24 price_Heavy_Sandhog__ = 223 ;_24
price_Dirt_Clod______ = 104 ;_25 price_Dirt_Clod______ = 104 ;_25
price_Dirt_Ball______ = 130 ;_26 price_Dirt_Ball______ = 130 ;_26
price_Ton_of_Dirt____ = 171 ;_27 price_Ton_of_Dirt____ = 171 ;_27
price_Liquid_Dirt____ = 530 ;_28 price_Liquid_Dirt____ = 330 ;_28
price_Dirt_Charge____ = 581 ;_29 price_Dirt_Charge____ = 343 ;_29
price_Earth_Disrupter = $ffff ;430 ;_30 price_Earth_Disrupter = $ffff ;430 ;_30
price_Plasma_Blast___ = $ffff ;274 ;_31 price_Plasma_Blast___ = $ffff ;274 ;_31
price_Laser__________ = 577 ;_32 price_Laser__________ = 277 ;_32
price______________33 = 0 price______________33 = 0
price______________34 = 0 price______________34 = 0
price______________35 = 0 price______________35 = 0
@@ -67,10 +67,10 @@ price_Vert_Guidance__ = $ffff ;_52
price_Lazy_Boy_______ = $ffff ;_53 price_Lazy_Boy_______ = $ffff ;_53
price_Parachute______ = 234 ;_54 price_Parachute______ = 234 ;_54
price_StrongParachute = 1000 ;_55 price_StrongParachute = 1000 ;_55
price_Mag_Deflector__ = 245 ;_56 price_Mag_Deflector__ = 745 ;_56
price_Shield_________ = 112 ;_57 price_Shield_________ = 224 ;_57
price_Force_Shield___ = 268 ;_58 price_Force_Shield___ = 1100 ;_58
price_Heavy_Shield___ = 375 ;_59 price_Heavy_Shield___ = 628 ;_59
price_Super_Mag______ = $ffff ;_60 price_Super_Mag______ = $ffff ;_60
price_Auto_Defense___ = 512 ;_61 price_Auto_Defense___ = 512 ;_61
price_Fuel_Tank______ = $ffff ;_62 price_Fuel_Tank______ = $ffff ;_62
+5 -16
View File
@@ -609,29 +609,18 @@ DrawNextTank
ldx tankNr ldx tankNr
; let's check the energy ; let's check the energy
lda eXistenZ,x lda eXistenZ,x
bne SkipRemovigPM ; if energy=0 then no tank bne SkipHidingPM ; if energy=0 then no tank
; hide P/M ; hide P/M
lda #0 lda #0
sta hposp0,x sta hposp0,x
jmp DoNotDrawTankNr jmp DoNotDrawTankNr
SkipRemovigPM SkipHidingPM
lda AngleTable,x lda AngleTable,x
bmi AngleToLeft01
lda #90
sec
sbc AngleTable,x
tay tay
lda BarrelTableR,y lda BarrelTable,y
jmp CharacterAlreadyKnown
AngleToLeft01
sec
sbc #(255-90)
tay
lda BarrelTableL,y
CharacterAlreadyKnown
sta CharCode sta CharCode
DrawTankNrX DrawTankNrX
ldx tanknr ldx tanknr
@@ -742,11 +731,11 @@ tankflash_loop
sne:mva #1 fs ; finish it sne:mva #1 fs ; finish it
mva #1 Erase mva #1 Erase
ldx TankNr ldx TankNr
jsr DrawTankNr.SkipRemovigPM ; it's necessary becouse DrawTankNr skips tanks with no energy ! jsr DrawTankNr.SkipHidingPM ; it's necessary becouse DrawTankNr skips tanks with no energy !
PAUSE 2 PAUSE 2
mva #0 Erase mva #0 Erase
ldx TankNr ldx TankNr
jsr DrawTankNr.SkipRemovigPM jsr DrawTankNr.SkipHidingPM
PAUSE 2 PAUSE 2
dec fs dec fs
jne tankflash_loop jne tankflash_loop
+3
View File
@@ -104,6 +104,9 @@
.macro randomize .macro randomize
;usage: randomize floor ceiling ;usage: randomize floor ceiling
;returns (in A) a random .byte between "floor" and "ceiling" ;returns (in A) a random .byte between "floor" and "ceiling"
.if :2 < :1
.error "floor higher than ceiling"
.endif
?rand ?rand
lda random lda random
cmp #:1 ;floor cmp #:1 ;floor
+24 -26
View File
@@ -36,7 +36,7 @@
;we decided it must go in 'English' to let other people work on it ;we decided it must go in 'English' to let other people work on it
.macro build .macro build
dta d"145" ; number of this build (3 bytes) dta d"146" ; number of this build (3 bytes)
.endm .endm
icl 'definitions.asm' icl 'definitions.asm'
@@ -73,6 +73,9 @@
.zpvar dd .word .zpvar dd .word
.zpvar di .word .zpvar di .word
.zpvar dp .word .zpvar dp .word
;----------------------------
.zpvar UnderTank1 .byte
.zpvar UnderTank2 .byte
;---------------------------- ;----------------------------
.zpvar weaponPointer .word .zpvar weaponPointer .word
.zpvar dliCounter .byte .zpvar dliCounter .byte
@@ -308,12 +311,16 @@ SettingEnergies
jsr SetMainScreen jsr SetMainScreen
jsr ColorsOfSprites jsr ColorsOfSprites
lda #0
sta colpf2s ; status line "off"
sta colpf1s
jsr drawmountains ;draw them jsr drawmountains ;draw them
jsr drawtanks ;finally draw tanks jsr drawtanks ;finally draw tanks
mva #0 TankSequencePointer mva #0 TankSequencePointer
;---------round screen is ready--------- ;---------round screen is ready---------
mva #TextForegroundColor colpf1s ; status line "on"
rts rts
.endp .endp
@@ -373,6 +380,7 @@ DoNotFinishTheRound
mva #0 noDeathCounter mva #0 noDeathCounter
mva #sfx_seppuku sfx_effect mva #sfx_seppuku sfx_effect
jsr DisplaySeppuku jsr DisplaySeppuku
jmp Seppuku jmp Seppuku
@@ -485,12 +493,15 @@ AfterExplode
NoFallDown2 NoFallDown2
;here tanks are falling down ;here tanks are falling down
mva tankNr tempor2 mva tankNr tempor2
mva #0 TankNr mvx #0 TankNr
TanksFallDown TanksFallDown
lda eXistenZ,x
beq NoExistNoFall
jsr TankFalls jsr TankFalls
inc:lda TankNr NoExistNoFall
cmp NumberOfPlayers inc:ldx TankNr
cpx NumberOfPlayers
bne TanksFallDown bne TanksFallDown
mva tempor2 TankNr mva tempor2 TankNr
missed missed
@@ -741,6 +752,9 @@ NotNegativeShieldEnergy
sta ydraw+1 sta ydraw+1
; get position of the tank ; get position of the tank
ldx TankNr ldx TankNr
lda #0 ; turn off defense weapons when hara-kiring
sta ActiveDefenceWeapon,x
sta ShieldEnergy,x
lda xtankstableL,x lda xtankstableL,x
sta xdraw sta xdraw
lda xtankstableH,x lda xtankstableH,x
@@ -1076,9 +1090,9 @@ UsageLoop
bcs RandomizeAngle bcs RandomizeAngle
sta temp ;sta temp
lda #90 ; CARRY=0 here ;lda #90 ; CARRY=0 here
sbc temp ;sbc temp
rts rts
.endp .endp
@@ -1132,32 +1146,16 @@ LimitForce
.proc MoveBarrelToNewPosition .proc MoveBarrelToNewPosition
jsr DrawTankNr jsr DrawTankNr
ldx TankNr ldx TankNr
lda AngleTable,x
clc
adc #90 ;shift angle to the positive values
sta temp
lda NewAngle lda NewAngle
clc cmp AngleTable,x
adc #90
cmp temp
beq BarrelPositionIsFine beq BarrelPositionIsFine
bcc rotateLeft ; older is bigger bcc rotateLeft ; older is bigger
rotateRight;older is lower rotateRight;older is lower
inc angleTable,x inc angleTable,x
bne MoveBarrelToNewPosition
mva #$30 CharCode ; if angle goes through 0 we clear the barrel
jsr DrawTankNr.drawtankNrX
jmp MoveBarrelToNewPosition jmp MoveBarrelToNewPosition
rotateLeft rotateLeft
dec angleTable,x dec angleTable,x
bpl MoveBarrelToNewPosition
mva #$2e CharCode
jsr DrawTankNr.drawtankNrX
jmp MoveBarrelToNewPosition jmp MoveBarrelToNewPosition
BarrelPositionIsFine BarrelPositionIsFine
rts rts
@@ -1344,7 +1342,7 @@ font4x4
ins 'artwork/font4x4s.bmp',+62 ins 'artwork/font4x4s.bmp',+62
;---------------------------------------------- ;----------------------------------------------
TankFont TankFont
ins 'artwork/tanks.fnt' ins 'artwork/tanksv2.fnt'
;---------------------------------------------- ;----------------------------------------------
icl 'variables.asm' icl 'variables.asm'
;---------------------------------------------- ;----------------------------------------------
@@ -1364,7 +1362,7 @@ MODUL equ $b000 ;address of RMT module
TheEnd TheEnd
.ECHO 'TheEnd: ',TheEnd .ECHO 'TheEnd: ',TheEnd
.if TheEnd > PMGraph + $300 .if TheEnd > PMGraph + $300
.error memory conflict .error "memory conflict"
.endif .endif
;---------------------------------------------- ;----------------------------------------------
BIN
View File
Binary file not shown.
+25 -20
View File
@@ -803,7 +803,11 @@ NotBattery
beq DefActivationEnd beq DefActivationEnd
NotWhiteFlag NotWhiteFlag
NoDeactivateWhiteFlag NoDeactivateWhiteFlag
; activate new defensive
sta ActiveDefenceWeapon,x sta ActiveDefenceWeapon,x
; set defensive energy
lda DefensiveEnergy,y
sta ShieldEnergy,x
DecreaseDefensive DecreaseDefensive
; decrease number of defensives ; decrease number of defensives
lda TanksWeaponsTableL,x lda TanksWeaponsTableL,x
@@ -815,8 +819,6 @@ DecreaseDefensive
sbc #1 sbc #1
sta (weaponPointer),y sta (weaponPointer),y
lda DefensiveEnergy,y
sta ShieldEnergy,x
DefActivationEnd DefActivationEnd
jmp WaitForKeyRelease ; rts jmp WaitForKeyRelease ; rts
@@ -1203,7 +1205,7 @@ CheckNextLevel
.proc displaydec ;decimal (word), displayposition (word) .proc displaydec ;decimal (word), displayposition (word)
;-------------------------------------------------- ;--------------------------------------------------
; displays decimal number as in parameters (in text mode) ; displays decimal number as in parameters (in text mode)
; leading zeores are removed ; leading zeroes are removed
; the range is (0000..9999 - two bytes) ; the range is (0000..9999 - two bytes)
ldy #3 ; there will be 4 digits ldy #3 ; there will be 4 digits
@@ -1905,33 +1907,36 @@ NoShieldEnergy
ldx TankNr ldx TankNr
lda AngleTable,x lda AngleTable,x
bmi AngleToLeft bmi AngleToLeft
lda #$7f ; (tab) character
sta textbuffer+40+25 lda AngleTable,x
lda #0 ;space
sta textbuffer+40+22
lda #90
sec
sbc AngleTable,x
sta decimal sta decimal
;lda #$7f ; (tab) character
;sta textbuffer+40+25
lda #0 ;space
;sta textbuffer+40+22
sta decimal+1 ; angle is single byte, but displayed with displaydec (word) routine
;lda #90
;sec
;sbc AngleTable,x
tay tay
lda BarrelTableR,y lda BarrelTable,y
sta CharCode sta CharCode
bne AngleDisplay ;like jmp, because code always <>0 bne AngleDisplay ;like jmp, because code always <>0
AngleToLeft AngleToLeft
sec ;sec
sbc #(255-90) ;sbc #(255-90)
sta decimal sta decimal
tay tay
lda BarrelTableL,y lda BarrelTable,y
sta CharCode sta CharCode
lda #$7e ;(del) char ;lda #$7e ;(del) char
sta textbuffer+40+22 ;sta textbuffer+40+22
lda #0 ;space ;lda #0 ;space
sta textbuffer+40+25 ;sta textbuffer+40+25
AngleDisplay AngleDisplay
mwa #textbuffer+40+23 displayposition mwa #textbuffer+40+21 displayposition
jsr displaybyte jsr displaydec
;========================= ;=========================
;display Wind ;display Wind
+2 -2
View File
@@ -12,7 +12,7 @@ TanksNames ; DO NOT ZERO - ticket #24
:6 dta d" " :6 dta d" "
;---------------------------------------------------- ;----------------------------------------------------
;Options DO NOT ZERO - ticket #27 ;Options DO NOT ZERO - ticket #27
OptionsTable .by 0,0,2,2,0,1,3 OptionsTable .by 0,1,2,2,0,1,3
RoundsInTheGame .by 10 ;how many rounds in the current game RoundsInTheGame .by 10 ;how many rounds in the current game
seppukuVal .by 75 seppukuVal .by 75
;---------------------------------------------------- ;----------------------------------------------------
@@ -178,7 +178,7 @@ xcircle .DS 2
ycircle .DS 2 ycircle .DS 2
tempcir .DS 2 tempcir .DS 2
;TankFalls ;TankFalls
IfFallDown .DS 1 FallingSoundBit .DS 1
PreviousFall .DS 1 PreviousFall .DS 1
EndOfTheFallFlag .DS 1 ; in case of the infinite fall EndOfTheFallFlag .DS 1 ; in case of the infinite fall
Parachute .DS 1 ; are you insured with parachute? Parachute .DS 1 ; are you insured with parachute?
+257 -256
View File
@@ -202,11 +202,8 @@ FunkyBombLoop
lda random lda random
sta Force sta Force
mva #1 Force+1 mva #1 Force+1
;Angle randomization Range: (-16..+16) ;Angle randomization Range: (70-110 degrees)
lda random randomize 70 110
lsr
and #%00011111
scc:eor #$ff
sta Angle sta Angle
lda #0 lda #0
@@ -235,16 +232,22 @@ NoExplosionInFunkyBomb
mva #31 ExplosionRadius mva #31 ExplosionRadius
jsr CalculateExplosionRange jsr CalculateExplosionRange
mva #sfx_nuke sfx_effect mva #sfx_nuke sfx_effect
SaveDrawXY
jsr xmissile jsr xmissile
UnSaveDrawXY
sbw xdraw #35 sbw xdraw #35
jsr CalculateExplosionRange jsr CalculateExplosionRange
mva #sfx_nuke sfx_effect mva #sfx_nuke sfx_effect
SaveDrawXY
jsr xmissile jsr xmissile
UnSaveDrawXY
adw xdraw #70 adw xdraw #70
jsr CalculateExplosionRange jsr CalculateExplosionRange
mva #sfx_nuke sfx_effect mva #sfx_nuke sfx_effect
SaveDrawXY
jsr xmissile jsr xmissile
UnSaveDrawXY
sbw xdraw #35 sbw xdraw #35
; ;
sbw ydraw #35 sbw ydraw #35
@@ -252,18 +255,32 @@ NoExplosionInFunkyBomb
cpw ydraw #screenHeight cpw ydraw #screenHeight
bcs NoUpperCircle bcs NoUpperCircle
mva #sfx_nuke sfx_effect mva #sfx_nuke sfx_effect
SaveDrawXY
jsr xmissile jsr xmissile
UnSaveDrawXY
NoUpperCircle NoUpperCircle
adw ydraw #70 adw ydraw #70
;jsr CalculateExplosionRange ;jsr CalculateExplosionRange
cpw ydraw #screenHeight cpw ydraw #screenHeight
bcs NoLowerCircle bcs NoLowerCircle
mva #sfx_nuke sfx_effect mva #sfx_nuke sfx_effect
SaveDrawXY
jsr xmissile jsr xmissile
UnSaveDrawXY
NoLowerCircle NoLowerCircle
mva #sfx_silencer sfx_effect mva #sfx_silencer sfx_effect
rts rts
.endp .endp
.proc SaveDrawXY
mwa xdraw tempXROLLER
mwa ydraw modify
rts
.endp
.proc UnSaveDrawXY
mwa tempXROLLER xdraw
mwa modify ydraw
rts
.endp
; ------------------------ ; ------------------------
.proc babyroller .proc babyroller
inc FallDown2 inc FallDown2
@@ -536,35 +553,30 @@ DiggerCharacter
lda #$00 lda #$00
sbc #$00 sbc #$00
sta ybyte+1 sta ybyte+1
mva #0 drawFunction mva #0 drawFunction
mwa xdraw LaserCoordinate mwa xdraw LaserCoordinate
mwa ydraw LaserCoordinate+2 mwa ydraw LaserCoordinate+2
mwa xbyte LaserCoordinate+4 mwa xbyte LaserCoordinate+4
mwa ybyte LaserCoordinate+6 mwa ybyte LaserCoordinate+6
mva #sfx_lightning sfx_effect
jsr draw
mva #0 color
mwa LaserCoordinate xdraw
mwa LaserCoordinate+2 ydraw
mwa LaserCoordinate+4 xbyte
mwa LaserCoordinate+6 ybyte
mva #sfx_lightning sfx_effect mva #sfx_lightning sfx_effect
jsr draw mva #51 yc ; laser blink counter
mva #1 color @
mwa LaserCoordinate xdraw lda yc
mwa LaserCoordinate+2 ydraw and #$01
mwa LaserCoordinate+4 xbyte sta color
mwa LaserCoordinate+6 ybyte mwa LaserCoordinate xdraw
mva #sfx_lightning sfx_effect mwa LaserCoordinate+2 ydraw
jsr draw mwa LaserCoordinate+4 xbyte
mva #0 color mwa LaserCoordinate+6 ybyte
mwa LaserCoordinate xdraw mva #sfx_lightning sfx_effect
mwa LaserCoordinate+2 ydraw jsr draw
mwa LaserCoordinate+4 xbyte
mwa LaserCoordinate+6 ybyte dec:lda yc
mva #sfx_lightning sfx_effect bpl @-
jsr draw
mva #1 color mva #1 color
mwa LaserCoordinate xdraw mwa LaserCoordinate xdraw
mwa LaserCoordinate+2 ydraw mwa LaserCoordinate+2 ydraw
@@ -1179,34 +1191,34 @@ CTRLPressedDown
bmi ForceGoesZero bmi ForceGoesZero
jmp BeforeFire jmp BeforeFire
pressedLeft pressedRight
mva #sfx_set_power_2 sfx_effect mva #sfx_set_power_2 sfx_effect
ldx TankNr ldx TankNr
dec AngleTable,x dec AngleTable,x
lda AngleTable,x lda AngleTable,x
cmp #$ff ; if angle goes through 0 we clear the barrel ;cmp #180 ; if angle goes through 180 we clear the barrel
bne NotThrough90DegreesLeft ;bne NotThrough90DegreesLeft
mva #$2e CharCode ;mva #$2e CharCode ; TODO: change
jsr DrawTankNr.drawtankNrX ;jsr DrawTankNr.drawtankNrX
NotThrough90DegreesLeft ;NotThrough90DegreesLeft
cmp #(255-91) cmp #255 ; -1
jne BeforeFire jne BeforeFire
lda #90 lda #180
sta AngleTable,x sta AngleTable,x
jmp BeforeFire jmp BeforeFire
pressedRight pressedLeft
mva #sfx_set_power_2 sfx_effect mva #sfx_set_power_2 sfx_effect
ldx TankNr ldx TankNr
INC AngleTable,x INC AngleTable,x
lda AngleTable,x lda AngleTable,x
bne NotThrough90DegreesRight ;bne NotThrough90DegreesRight
mva #$30 CharCode ; if angle goes through 0 we clear the barrel ;mva #$30 CharCode ; if angle goes through 0 we clear the barrel
jsr DrawTankNr.drawtankNrX ;jsr DrawTankNr.drawtankNrX
NotThrough90DegreesRight ;NotThrough90DegreesRight
cmp #91 cmp #181
jne BeforeFire jne BeforeFire
lda #(255-90) lda #0
sta AngleTable,x sta AngleTable,x
jmp BeforeFire jmp BeforeFire
@@ -1354,15 +1366,14 @@ ShotUnderGround
rts rts
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
.proc TankFalls; .proc TankFalls;
;-------------------------------------------------- ;--------------------------------------------------
mva #sfx_shield_off sfx_effect
lda #0 lda #0
sta PreviousFall sta PreviousFall ; bit 7 - left, bit 6 - right
sta EndOfTheFallFlag sta EndOfTheFallFlag
sta Parachute sta Parachute
mva #2 FallingSoundBit ; another trick for only one sfx initialization in loop
; let's check if the given tank has got the parachute ; let's check if the given tank has got the parachute
ldx TankNr ldx TankNr
@@ -1376,155 +1387,13 @@ ShotUnderGround
ParachuteActive ParachuteActive
inc Parachute inc Parachute
TankFallsX TankFallsX
; coordinates of the first pixel under the tank ; sound only if really falls
ldx TankNr lda Parachute
lda XtankstableL,x and FallingSoundBit ; bit 1
sta xdraw beq NoFallingSound
lda XtankstableH,x mva #0 FallingSoundBit
sta xdraw+1 mva #sfx_shield_off sfx_effect
lda Ytankstable,x NoFallingSound
clc
adc #1 ; in this point the comment helped us! For the very first
; time in our lives! Tada! It opens a new chapter!!!
sta ydraw
;
lda #08
sta mask2 ; Loop Counter
ByteBelowTank
jsr point
beq EmptyPoint2
sec
bcs ROLPoint2
EmptyPoint2
clc
ROLPoint2
rol mask1
inw xdraw
dec mask2
bne ByteBelowTank
ldx mask1
lda WhereToSlideTable,x
sta IfFallDown ; taking directions of falling down from the table
bne ItStillFalls
; Tank falling down already finished, but it is not sure that
; the horizontal coordinate is even.
; If it is odd then it must be corrected because otherwise
; P/M graphics background would not look OK
ldx TankNr
lda XtanksTableL,x
and #$01
jeq EndOfFall ; if it is even then it is the end
; and if not, we push it one pixel the way it was falling before
lda PreviousFall
sta IfFallDown
inc EndOfTheFallFlag ; because after this correction is shouldn't fall anymore
; we have 3 bits: 0 - go down, 1 - go right, 2 - go left
;---
ItStillFalls
lda Parachute
and #1
bne ParachutePresent
; decreasing energy - if the vertical fall, substract 2
; and if at an angle then substract 1
ldy #1 ; how much energy to substract
lda IfFallDown
and #1
beq NoFallingDown
ldx TankNr
jsr DecreaseEnergyX
lda IfFallDown
and #6
bne FallDiagonally
ldx TankNr
jsr DecreaseEnergyX
FallDiagonally
NoFallingDown
ParachutePresent
; check parachute type
lda ActiveDefenceWeapon,x
cmp #ind_StrongParachute ; strong parachute
bne OneTimeParachute
; decreasing energy of parachute - if the vertical fall, substract 2
; and if at an angle then substract 1
ldy #1 ; how much energy to substract
lda IfFallDown
and #1
beq NoFallingDown2
ldx TankNr
jsr DecreaseShieldEnergyX
cpy #0 ; is necessary to reduce tenk energy ?
beq @+
jsr DecreaseEnergyX
@
ldy #1
lda IfFallDown
and #6
bne FallDiagonally2
ldx TankNr
jsr DecreaseShieldEnergyX
cpy #0 ; is necessary to reduce tenk energy ?
beq @+
jsr DecreaseEnergyX
@
; check energy of parachute
lda ShieldEnergy,x
bne OneTimeParachute
mva #0 Parachute
mva #0 ActiveDefenceWeapon,x ; deactivate defence weapon (parachute)
; and now we must clear parachute symbol
mva #1 Erase
jsr DrawTankParachute
FallDiagonally2
NoFallingDown2
OneTimeParachute
; we must set flag meaning that the tank was falling down
; because later maybe the number of parachutes will decrease
; (if there were parachutes and they were ON)
lda Parachute
ora #2 ; we set bit nr 1 (nr 0 means that parachute is present)
sta Parachute
testowanie
; storing last direction of falling
; (it is not necessarily the direction from the previous
; iteraction, so we must check directional bits before storing)
lda IfFallDown
and #$06
beq FallStraightDown
sta PreviousFall
FallStraightDown
lda Parachute
and #01
beq RapidFalling
wait
RapidFalling
; we finish falling down if the tank reached the edge of the screen
; but if it falls straight down or the other way than the edge,
; then continue falling!
ldx TankNr
lda XtanksTableL,x
bne NotLeftEdge
lda XtanksTableH,x
bne NotLeftEdge
lda IfFallDown
and #$04 ; check if it does not fall left
jne EndOfFall ; if so then maybe we finish
NotLeftEdge
clc
lda XtanksTableL,x
adc #$08 ; we'll check right side of the char
sta temp
lda XtanksTableH,x
adc #0
sta temp+1
cpw temp #screenwidth
bne NotRightEdge
lda IfFallDown
and #$02 ; check if it does not fall right
jne EndOfFall ; if so then maybe we finish
NotRightEdge
; clear previous position ; clear previous position
mva #1 Erase mva #1 Erase
jsr DrawTankNr jsr DrawTankNr
@@ -1538,17 +1407,100 @@ NotRightEdge
DoNotClearParachute DoNotClearParachute
mva #0 Erase mva #0 Erase
ldx TankNr ldx TankNr
lsr IfFallDown ; bit nr 0 (down) lda EndOfTheFallFlag ; We only get byte below the tank if still falling
bcc DoesNotFallDown bne NoGroundCheck
; tank is falling down ; coordinates of the first pixel under the tank
ldx TankNr
lda XtankstableL,x
sta xdraw
lda XtankstableH,x
sta xdraw+1
lda Ytankstable,x
clc
adc #1 ; in this point the comment helped us! For the very first
; time in our lives! Tada! It opens a new chapter!!!
sta ydraw
;
; UnderTank1 ; byte under tank
; UnderTank2 ; byte under tank reversed (for simple check right direction)
lda #08
sta temp ; Loop Counter
ByteBelowTank
jsr point
beq EmptyPoint2
sec
ror UnderTank2
sec
bcs ROLPoint2
EmptyPoint2
clc
ror UnderTank2
clc
ROLPoint2
rol UnderTank1
inw xdraw
dec temp
bne ByteBelowTank
NoGroundCheck
ldx TankNr
lda UnderTank1
bne NoFallingDown
; Tank falling down ----
lda Parachute
and #1
bne ParachutePresent
; decreasing energy
ldy #2 ; how much energy to substract
jsr DecreaseEnergyX
ParachutePresent
; check parachute type
lda ActiveDefenceWeapon,x
cmp #ind_StrongParachute ; strong parachute
bne OneTimeParachute
; decreasing energy of parachute
ldy #2 ; how much energy to substract
jsr DecreaseShieldEnergyX
cpy #0 ; is necessary to reduce tenk energy ?
beq @+
jsr DecreaseEnergyX
@
; check energy of parachute
lda ShieldEnergy,x
bne OneTimeParachute
mva #0 Parachute
mva #0 ActiveDefenceWeapon,x ; deactivate defence
OneTimeParachute
lda Parachute
ora #2 ; we set bit nr 1 (nr 0 means that parachute is present)
sta Parachute
; tank is falling down - modify coorinates
lda Ytankstable,x lda Ytankstable,x
clc clc
adc #1 adc #1
sta Ytankstable,x sta Ytankstable,x
DoesNotFallDown jmp EndOfFCycle
lsr IfFallDown ; bit nr 1 (right) NoFallingDown
bcc DoesNotFallLeft ; check direction (left or right)
; tank is falling left ldy #7 ; SlideLeftTable length -1 (from 0 to 7)
@ lda SlideLeftTable,y
cmp UnderTank1
beq FallingRight
cmp UnderTank2
beq FallingLeft
dey
bpl @-
bmi NoLeftOrRight
FallingLeft
; tank is falling left
bit PreviousFall ; bit 6 - right
bvs EndLeftFall
; we finish falling left if the tank reached the edge of the screen
lda XtanksTableL,x
bne NotLeftEdge
lda XtanksTableH,x
beq EndLeftFall
NotLeftEdge
; tank is falling left - modify coorinates
clc clc
lda XtankstableL,x lda XtankstableL,x
adc #1 adc #1
@@ -1556,10 +1508,23 @@ DoesNotFallDown
lda XtankstableH,x lda XtankstableH,x
adc #0 adc #0
sta XtankstableH,x sta XtankstableH,x
DoesNotFallLeft mva #%10000000 PreviousFall ; set bit 7 - left
lsr IfFallDown ; bit nr 2 (left) bne EndOfFCycle
bcc DoesNotFallRight FallingRight
; tank is falling right ; tank is falling right
bit PreviousFall ; bit 7 - left
bmi EndRightFall
; we finish falling right if the tank reached the edge of the screen
clc
lda XtanksTableL,x
adc #$08 ; we'll check right side of the char
sta temp
lda XtanksTableH,x
adc #0
sta temp+1
cpw temp #screenwidth
beq EndRightFall
; tank is falling right - modify coorinates
sec sec
lda XtankstableL,x lda XtankstableL,x
sbc #1 sbc #1
@@ -1567,44 +1532,72 @@ DoesNotFallLeft
lda XtankstableH,x lda XtankstableH,x
sbc #0 sbc #0
sta XtankstableH,x sta XtankstableH,x
DoesNotFallRight mva #%01000000 PreviousFall ; set bit 6 - right
jsr DrawTankNr bne EndOfFCycle
EndLeftFall
EndRightFall
NoLeftOrRight
inc EndOfTheFallFlag ; after this is shouldn't fall
EndOfFCycle
; draw tank on new position
jsr DrawTankNr ; ew have TankNr in X (I hope :) )
; checking is parachute present and if so, draw it ; checking is parachute present and if so, draw it
lda Parachute lda Parachute
and #01 cmp #3 ; parachute and falling
beq DoNotDrawParachute bne DoNotDrawParachute
; here we draw parachute ; here we draw parachute
ldx TankNr ldx TankNr
jsr DrawTankParachute jsr DrawTankParachute
wait ; onli if tank with patachute
RapidFalling
DoNotDrawParachute DoNotDrawParachute
lda EndOfTheFallFlag lda EndOfTheFallFlag
jeq TankFallsX jeq TankFallsX
; Tank falling down already finished, but it is not sure that
; the horizontal coordinate is even.
; If it is odd then it must be corrected because otherwise
; P/M graphics background would not look OK
ldx TankNr
lda XtanksTableL,x
and #$01
beq EndOfFall ; if it is even then it is the end
; and if not, we push it one pixel the way it was falling before
lda #%10000000 ; set "virtual ground" for right falling
ldy #%00000001
bit PreviousFall
bmi ForceFallLeft
tay ; tricky - replaces ldy #%10000000
lda #%00000001 ; set "virtual ground" for left falling
ForceFallLeft
sta UnderTank1
sty UnderTank2
jne TankFallsX
EndOfFall EndOfFall
jsr DrawTankNr mva #1 Erase
ldx TankNr
; if tank was falling down having parachute, ; if tank was falling down having parachute,
; we must deduct one parachute ; we must deduct one parachute
lda Parachute lda Parachute
cmp #$03 ; was falling down and the parachute cmp #$03 ; was falling down and the parachute
bne ThereWasNoParachute bne NoParachuteWeapon
; first we clear parachute on the screen ; first we check type of parachute
mva #1 Erase
ldx TankNr
lda ActiveDefenceWeapon,x lda ActiveDefenceWeapon,x
cmp #ind_Parachute______ ; deactivate weapon only if parachute (54) cmp #ind_Parachute______ ; deactivate weapon only if parachute (54)
bne NoParachuteWeapon bne NoParachuteWeapon
mva #0 ActiveDefenceWeapon,x ; deactivate defence weapon (parachute) mva #0 ActiveDefenceWeapon,x ; deactivate defence weapon (parachute)
NoParachuteWeapon NoParachuteWeapon
; now we clear parachute on the screen if present
lda Parachute
and #01
beq ThereWasNoParachute
jsr DrawTankParachute jsr DrawTankParachute
ThereWasNoParachute
mva #0 Erase mva #0 Erase
ldx TankNr ldx TankNr
jsr DrawTankNr ; redraw tank after erase parachute (exactly for redraw leaky schield :) ) jsr DrawTankNr ; redraw tank after erase parachute (exactly for redraw leaky schield :) )
ThereWasNoParachute
mva #sfx_silencer sfx_effect mva #sfx_silencer sfx_effect
rts rts
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
@@ -1629,8 +1622,8 @@ ThereWasNoParachute
; Angle(byte) 128=0, 255=maxright, 0=maxleft ; Angle(byte) 128=0, 255=maxright, 0=maxleft
;-------------------------------------------------- ;--------------------------------------------------
;g=-0.1 ;g=-0.1
;vx=Force*sin(Angle) ;vx=Force*cos(Angle)
;vy=Force*cos(Angle) ;vy=Force*sin(Angle)
; ;
;:begin ;:begin
;ytraj=ytray-vy ;ytraj=ytray-vy
@@ -1640,6 +1633,9 @@ ThereWasNoParachute
;plot xtraj,ytraj - there is clearing in plot ;plot xtraj,ytraj - there is clearing in plot
;goto begin ;goto begin
; smoke tracer :) ; smoke tracer :)
ldy #0 ldy #0
ldx TankNr ldx TankNr
@@ -1667,45 +1663,41 @@ RepeatFlight
sta ydraw+1 sta ydraw+1
;vx calculation ;vx calculation
;vx = sin(90-Angle) for Angle <=90
;vx = -sin(Angle-90) for 90 < Angle <= 180
aslw Force ;Force = Force * 2 aslw Force ;Force = Force * 2
;sin(Angle) ;cos(Angle) (but we use sin table only so some shenanigans happen)
ldx Angle ldx Angle
stx LeapFrogAngle ; we will need it later stx LeapFrogAngle ; we will need it later
;Angle works like this: ;Angle works like this:
;0 'degrees' is straight up ;0 'degrees' is horizontally right
;90 'degrees' is horizontally right ;90 'degrees' is straight up
;255 is straight up (same as 0) ;180 horizontally left
;255-90 (165) horizontally left
bpl FlightRight ; (we have to set goleft used in rolling weapons)
cpx #91
bcc angleUnder90
;and if the highest bit is set then ;over 90
;Flight to LEFT
;calculate Angle with this formula:
;Angle=90-(Angle-165)
sec
txa
sbc #165 ;(Angle-165)
sta temp
lda #90
sbc temp ;90-(Angle-165)
;and we have rady angle here ... and we go LEFT!
tax
sta Angle
; and now we contine as if nothing happened
; (but we have goleft set to 1!!!)
mva #1 goleft mva #1 goleft
bne @+ sec
txa ; lda # Angle
sbc #90
tax
jmp @+
FlightRight angleUnder90
mva #0 goleft mva #0 goleft
@ sec ; X = 90-Angle
lda sintable,x ;sin(Angle) lda #90
sta Multiplee ;sin(Angle)*Force sbc Angle
tax
@
lda sintable,x ; cos(X)
sta Multiplee ; *Force
mwa Force Multiplier mwa Force Multiplier
lda #$0 lda #$0
sta Multiplier+2 sta Multiplier+2
@@ -1744,18 +1736,27 @@ DoNotAdd
.endr .endr
@ @
;======vy ;======vy
lda #0 ;cos(Angle) ;vy = sin(Angle) for Angle <=90
;vy = sin(180-Angle) for 90 < Angle <= 180
lda #0
sta vy sta vy
sta vy+1 sta vy+1
sta vy+2 sta vy+2
;-- ;--
lda #90 ldx Angle
cpx #91
bcc YangleUnder90
lda #180
sec sec
sbc Angle sbc Angle
tax tax
YangleUnder90
lda sintable,x lda sintable,x
sta Multiplee ;cos(Angle)*Force sta Multiplee ;sin(Angle)*Force
mwa Force Multiplier mwa Force Multiplier
lda #$0 lda #$0
sta Multiplier+2 sta Multiplier+2
@@ -1814,7 +1815,7 @@ Loopi
; we check if it is MIRV and if so, jump to MIRV routine ; we check if it is MIRV and if so, jump to MIRV routine
ldx TankNr ldx TankNr
lda ActiveWeapon,x lda ActiveWeapon,x
cmp #6 ; MIRV cmp #ind_MIRV___________ ; MIRV
jeq MIRVdownLoop jeq MIRVdownLoop
StillUp StillUp