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 rts
.endp .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 .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 ; X and TankNr - index of flying tank
; ------------------------------------------------- ; -------------------------------------------------
; Let's designate the flight altitude. ; Let's designate the flight altitude.
mva #17 FloatingAlt ; for testing jsr CheckMaxMountain
; mwa #mountaintable temp 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 mva #sfx_plasma_2_2 sfx_effect
; display text 4x4 - fuel full ; display text 4x4 - fuel full
@@ -2436,15 +2444,15 @@ InverseScreenByte
; TankNr in X reg. ; TankNr in X reg.
; now animate Up ; now animate Up
mva #0 FloatingAlt ; now it's a counter mva #0 modify ; it's a counter
TankGoUp TankGoUp
lda ytankstable,x lda ytankstable,x
cmp #18 ; Floating altitude cmp FloatingAlt ; Floating altitude
bcc ReachSky bcc ReachSky
; first erase old tank position ; first erase old tank position
mva #1 Erase mva #1 Erase
jsr DrawTankNr jsr DrawTankNr
lda FloatingAlt lda modify
cmp #5 cmp #5
bcc NoEngineClear bcc NoEngineClear
mva #0 color mva #0 color
@@ -2452,10 +2460,10 @@ TankGoUp
NoEngineClear NoEngineClear
mva #0 Erase mva #0 Erase
dec ytankstable,x dec ytankstable,x
inc FloatingAlt inc modify
; then draw tank on new position ; then draw tank on new position
jsr DrawTankNr jsr DrawTankNr
lda FloatingAlt lda modify
cmp #5 cmp #5
bcc NoEngine bcc NoEngine
lda random lda random
@@ -2465,6 +2473,7 @@ NoEngineClear
NoEngine NoEngine
; jsr WaitOneFrame ; jsr WaitOneFrame
jmp TankGoUp jmp TankGoUp
ReachSky ReachSky
; engine symbol erase ; engine symbol erase
mva #0 color mva #0 color