First attempt at mobile tanks

This commit is contained in:
Pecusx
2022-08-19 13:17:14 +02:00
parent 38345c3359
commit e18c9714fd
6 changed files with 181 additions and 9 deletions
+7 -7
View File
@@ -285,7 +285,7 @@ WeaponPriceH ; weapons prices (tables with prices of weapons)
.by >price_Battery________
.by >price_Bal_Guidance___
.by >price_Horz_Guidance__
.by >price_Vert_Guidance__
.by >price_Floating_Tank__
.by >price_Lazy_Boy_______
.by >price_Parachute______
.by >price_StrongParachute
@@ -351,7 +351,7 @@ WeaponPriceL
.by <price_Battery________
.by <price_Bal_Guidance___
.by <price_Horz_Guidance__
.by <price_Vert_Guidance__
.by <price_Floating_Tank__
.by <price_Lazy_Boy_______
.by <price_Parachute______
.by <price_StrongParachute
@@ -423,7 +423,7 @@ WeaponUnits
.by 3 ;Battery________
.by 0 ;Bal_Guidance___
.by 0 ;Horz_Guidance__
.by 0 ;Vert_Guidance__
.by 5 ;Floating_Tank__
.by 0 ;Lazy_Boy_______
.by 3 ;Parachute______
.by 2 ;StrongParachute
@@ -454,7 +454,7 @@ PurchaseMeTable ;weapons good to be purchased by the robot
.by %00000000
.by 0 ; offset to defensives
; "White Flag ","Battery ","Bal Guidance ","Horz Guidance "
; "Vert Guidance ","Lazy Boy ","Parachute ","Strong Parachute"
; "Let's go! ","Lazy Boy ","Parachute ","Strong Parachute"
.by %01000011
; "Mag Deflector ","Shield ","Heavy Shield ","Force Shield "
; "Super Mag ","Bouncy Castle ","Long Barrel ","Nuclear Winter "
@@ -478,7 +478,7 @@ PurchaseMeTable2 ;weapons good to be purchased by the robot (Cyborg)
.by %00000000
.by 0 ; offset to defensives
; "White Flag ","Battery ","Bal Guidance ","Horz Guidance "
; "Vert Guidance ","Lazy Boy ","Parachute ","Strong Parachute"
; "Let's go! ","Lazy Boy ","Parachute ","Strong Parachute"
.by %01000001
; "Mag Deflector ","Shield ","Heavy Shield ","Force Shield "
; "Super Mag ","Bouncy Castle ","Long Barrel ","Nuclear Winter "
@@ -551,7 +551,7 @@ NamesOfWeapons ;the comment is an index in the tables
dta d"Battery " ; 49
dta d"Bal Guidance " ; 50
dta d"Horz Guidance " ; 51
dta d"Vert Guidance " ; 52
dta d"Let's go! " ; 52
dta d"Lazy Boy " ; 53
dta d"Parachute " ; 54 - no energy
dta d"Strong Parachute" ; 55 - with energy (earlier Battery)
@@ -568,7 +568,7 @@ DefensiveEnergy = * - 48
.by 00 ; Heat Guidance
.by 00 ; Bal Guidance
.by 00 ; Horz Guidance
.by 00 ; Vert Guidance
.by 00 ; Let's go!
.by 00 ; Lazy Boy
.by 00 ; Parachute
.by 99 ; Strong Parachute
+2 -2
View File
@@ -87,7 +87,7 @@ price_White_Flag_____ = $0 ;_48_($30)
price_Battery________ = 300 ;_49
price_Bal_Guidance___ = $ffff ;_50
price_Horz_Guidance__ = $ffff ;_51
price_Vert_Guidance__ = $ffff ;_52
price_Floating_Tank__ = 20 ;_52
price_Lazy_Boy_______ = $ffff ;_53
price_Parachute______ = 234 ;_54
price_StrongParachute = 1000 ;_55
@@ -152,7 +152,7 @@ ind_White_Flag_____ = 48
ind_Battery________ = 49
ind_Bal_Guidance___ = 50
ind_Horz_Guidance__ = 51
ind_Vert_Guidance__ = 52
ind_Floating_Tank__ = 52
ind_Lazy_Boy_______ = 53
ind_Parachute______ = 54
ind_StrongParachute = 55
+9
View File
@@ -569,6 +569,8 @@ AfterManualShooting
; defensive weapons without flight handling
ldx TankNr
lda ActiveDefenceWeapon,x
cmp #ind_Floating_Tank__ ; Floating Tank
beq GoFloat
cmp #ind_White_Flag_____ ; White Flag
beq ShootWhiteFlag
cmp #ind_Nuclear_Winter_
@@ -581,6 +583,13 @@ ShootWhiteFlag
; --- white flag ---
jsr WhiteFlag
jmp NextPlayerShoots ; and we skip shoot
GoFloat
jsr TankFlying
lda #0
sta ActiveDefenceWeapon,x ; deactivate after use
bit escFlag
bpl ManualShooting ; after floating tank can shoot
rts
StandardShoot
inc noDeathCounter
BIN
View File
Binary file not shown.
+1
View File
@@ -197,6 +197,7 @@ FallingSoundBit .DS 1
PreviousFall .DS 1
EndOfTheFallFlag .DS 1 ; in case of the infinite fall
;Parachute .DS 1 ; are you insured with parachute?
FloatingAlt .DS 1 ; floating tank altitude
;----------------------------------------------------
;Flight
;variables for 5 missiles (used for mirv)
+162
View File
@@ -2414,6 +2414,168 @@ InverseScreenByte
rts
.endp
; -------------------------------------------------
.proc TankFlying
; -------------------------------------------------
; This routine is run from inside of the main loop
; and replaces Shoot and Flight routines
; X and TankNr - index of flying tank
; -------------------------------------------------
; Let's designate the flight altitude.
mva #17 FloatingAlt ; for testing
mwa #mountaintable temp
; now animate Up
TankGoUp
lda ytankstable,x
cmp FloatingAlt
beq ReachSky
; first erase old tank position
mva #1 Erase
jsr DrawTankNr
mva #0 Erase
dec ytankstable,x
; then draw tank on new position
jsr DrawTankNr
jsr WaitOneFrame
jmp TankGoUp
ReachSky
; check keyboard/joy and move tank left/right - code copied from BeforeFire
;keyboard reading
; KBCODE keeps code of last keybi
; SKSTAT $ff - nothing pressed
; $FB - any key
; $f7 - shift
; $f3 - shift+key
notpressed
lda SKSTAT
cmp #$ff
jeq checkJoy
cmp #$f7 ; SHIFT
jeq checkJoy
lda kbcode
and #%00111111 ; CTRL and SHIFT elimination
cmp #28 ; ESC
bne @+
jsr AreYouSure
bit escFlag
bpl notpressed
;---esc pressed-quit game---
rts
@
jumpFromStick
cmp #$6
jeq pressedLeft
cmp #$7
jeq pressedRight
cmp #$21
jeq pressedSpace
jmp notpressed
checkJoy
;------------JOY-------------
;happy happy joy joy
;check for joystick now
lda JSTICK0
and #$0f
cmp #$0f
beq notpressedJoy
tay
lda joyToKeyTable,y
jmp jumpFromStick
notpressedJoy
;fire
lda TRIG0S
jeq pressedSpace
mva #$ff pressTimer ; stop counting frames
jmp notpressed
pressedRight
; first erase old tank position
mva #1 Erase
jsr DrawTankNr
mva #0 Erase
lda XtankstableH,x
cmp #>(screenwidth-10) ; tank width correction +2
bne @+
lda XtankstableL,x
cmp #<(screenwidth-10) ; tank width correction +2
@ bcs RightScreenEdge
inc XtankstableL,x
sne:inc XtankstableH,x
RightScreenEdge
mva #25 AngleTable,x
; then draw tank on new position
jsr DrawTankNr
jsr WaitOneFrame
jmp ReachSky
pressedLeft
; first erase old tank position
mva #1 Erase
jsr DrawTankNr
mva #0 Erase
lda XtankstableH,x
cmp #0
bne @+
lda XtankstableL,x
cmp #2 ; 2 pixles from left edge
@ bcc LeftScreenEdge
dec XtankstableL,x
lda XtankstableL,x
cmp #$ff
sne:dec XtankstableH,x
LeftScreenEdge
mva #155 AngleTable,x
; then draw tank on new position
jsr DrawTankNr
jsr WaitOneFrame
jmp ReachSky
pressedSpace
;=================================
;we shoot here!!!
jsr WaitForKeyRelease
mva #1 Erase
jsr DrawTankNr
mva #0 Erase
lda XtankstableL,x
and #%11111110 ; correction for PM
sta XtankstableL,x
GoDown
mwa #mountaintable temp
clc
lda temp
adc XtankstableL,x
sta temp
lda temp+1
adc XtankstableH,x
sta temp+1
adw temp #4 ; center of the tank
ldy #0
lda (temp),y
sta FloatingAlt
FloatDown
lda ytankstable,x
cmp FloatingAlt
beq OnGround
; first erase old tank position
mva #1 Erase
jsr DrawTankNr
mva #0 Erase
inc ytankstable,x
; then draw tank on new position
jsr DrawTankNr
jsr WaitOneFrame
jmp FloatDown
OnGround
rts
.endp
; -------------------------------------------------
.proc CheckCollisionWithTank
; -------------------------------------------------