Hovercraft fly high and low

This commit is contained in:
Pecusx
2022-08-21 16:53:07 +02:00
parent 1c55872935
commit b67c3230be
3 changed files with 38 additions and 7 deletions
+22
View File
@@ -1521,6 +1521,28 @@ EndDrawing
rts
.endp
;--------------------------------------------------
.proc CheckMaxMountain
; in A return y coordinate of highest mountain
;--------------------------------------------------
mwa #mountaintable modify
ldy #0
ldx #screenheight-1
nextPointChecking
txa
cmp (modify),y
bcc NotHigher
lda (modify),y
tax
NotHigher
inw modify
cpw modify #(mountaintable+screenwidth)
bne nextPointChecking
txa
rts
.endp
/*
;--------------------------------------------------
.proc calculatemountains0
BIN
View File
Binary file not shown.
+16 -7
View File
@@ -2422,8 +2422,16 @@ InverseScreenByte
; X and TankNr - index of flying tank
; -------------------------------------------------
; Let's designate the flight altitude.
mva #17 FloatingAlt ; for testing
; mwa #mountaintable temp
jsr CheckMaxMountain
cmp #(12+18) ; tank witch shield (12) and max alt (18) check
bcc IsToHigh
sbc #12 ; tank witch shield high correction
bne StoreMaxAlt
IsToHigh
lda #18
StoreMaxAlt
sta FloatingAlt
; mva #18 FloatingAlt ; for testing
mva #sfx_plasma_2_2 sfx_effect
; display text 4x4 - fuel full
@@ -2436,15 +2444,15 @@ InverseScreenByte
; TankNr in X reg.
; now animate Up
mva #0 FloatingAlt ; now it's a counter
mva #0 modify ; it's a counter
TankGoUp
lda ytankstable,x
cmp #18 ; Floating altitude
cmp FloatingAlt ; Floating altitude
bcc ReachSky
; first erase old tank position
mva #1 Erase
jsr DrawTankNr
lda FloatingAlt
lda modify
cmp #5
bcc NoEngineClear
mva #0 color
@@ -2452,10 +2460,10 @@ TankGoUp
NoEngineClear
mva #0 Erase
dec ytankstable,x
inc FloatingAlt
inc modify
; then draw tank on new position
jsr DrawTankNr
lda FloatingAlt
lda modify
cmp #5
bcc NoEngine
lda random
@@ -2465,6 +2473,7 @@ NoEngineClear
NoEngine
; jsr WaitOneFrame
jmp TankGoUp
ReachSky
; engine symbol erase
mva #0 color