Liquid Dirt weapon

Roller bugfix and optimalisations and new weapon: Liquid Dirt (not optimal but works).
This commit is contained in:
Pecusx
2022-05-07 18:06:25 +02:00
parent 70b197392e
commit dde29e2c96
4 changed files with 149 additions and 68 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ price_Heavy_Sandhog__ = 305 ;_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____ = 0 ;530 ;_28 price_Liquid_Dirt____ = 530 ;_28
price_Dirt_Charge____ = 581 ;_29 price_Dirt_Charge____ = 581 ;_29
price_Earth_Disrupter = 0 ;430 ;_30 price_Earth_Disrupter = 0 ;430 ;_30
price_Plasma_Blast___ = 0 ;274 ;_31 price_Plasma_Blast___ = 0 ;274 ;_31
BIN
View File
Binary file not shown.
+3
View File
@@ -148,6 +148,9 @@ digtabxL .DS [8]
digtabxH .DS [8] digtabxH .DS [8]
digtabyL .DS [8] digtabyL .DS [8]
digtabyH .DS [8] digtabyH .DS [8]
; liquiddirt
TempXfill .ds 2
FillCounter .ds 1
;sandhog ;sandhog
sandhogflag .DS 1 ; (0 digger, 8 sandhog) sandhogflag .DS 1 ; (0 digger, 8 sandhog)
;ofdirt ;ofdirt
+145 -67
View File
@@ -50,7 +50,7 @@ ExplosionRoutines
.word dirtclod-1 .word dirtclod-1
.word dirtball-1 .word dirtball-1
.word tonofdirt-1 .word tonofdirt-1
.word VOID-1 ;liquiddirt .word liquiddirt-1 ;liquiddirt
.word dirtcharge-1 .word dirtcharge-1
.word VOID-1 ;earthdisrupter .word VOID-1 ;earthdisrupter
.word VOID-1 ;plasmablast .word VOID-1 ;plasmablast
@@ -666,77 +666,13 @@ rbombLoop
rts rts
.endp .endp
; ---------------- ; ----------------
.proc xroller ; .proc xroller ;
; now collisions are detected with modified draw routine ; now collisions are detected with modified draw routine
; therefore YDRAW value must be taken from mountaintable ; therefore YDRAW value must be taken from mountaintable
ldy #0 jsr checkRollDirection
mwa #mountaintable tempXROLLER ; HowMuchToFall - direction
adw tempXROLLER xdraw
lda (tempXROLLER),y
sta ydraw
lda vx+3
; if horizontal velocity is negative then change the direction
bpl PositiveVelocity
lda goleft
ora #$01
sta goleft
PositiveVelocity
; first we look for the left slope
; then righ slope and set the flag
; $FF - we are in a hole (flying in missile direction) ; $FF - we are in a hole (flying in missile direction)
; 1 - right, 2 - left ; 1 - right, 2 - left
mva #$ff HowMuchToFall
mva ydraw HeightRol
mwa #mountaintable tempXROLLER
adw tempXROLLER xdraw
SeekLeft
.nowarn dew tempXROLLER
lda (tempXROLLER),y ;fukk! beware of Y value
cmp HeightRol
bne HowMuchToFallLeft
lda tempXROLLER
cmp #<mountaintable
bne SeekLeft
lda tempXROLLER+1
cmp #>mountaintable
beq GoRightNow
HowMuchToFallLeft
bcs GoRightNow
mva #1 HowMuchToFall
GoRightNow
mwa #mountaintable tempXROLLER
adw tempXROLLER xdraw
SeekRight
inw tempXROLLER
lda (tempXROLLER),y
cmp HeightRol
bne HowMuchToFallRight
lda tempXROLLER
cmp #<(mountaintable+screenwidth)
bne SeekRight
lda tempXROLLER+1
cmp #>(mountaintable+screenwidth)
beq HowMuchToFallKnown
HowMuchToFallRight
; check if up or down
bcs HowMuchToFallKnown
lda HowMuchToFall
bpl ItIsLeftAlready
mva #2 HowMuchToFall
bne HowMuchToFallKnown
ItIsLeftAlready
mva #$ff HowMuchToFall
HowMuchToFallKnown
lda HowMuchToFall
bpl Rollin
lda #1
clc
adc goleft
sta HowMuchToFall
Rollin Rollin
adw xdraw #mountaintable tempXROLLER adw xdraw #mountaintable tempXROLLER
ldy #0 ldy #0
@@ -798,6 +734,71 @@ ExplodeNow
jmp xmissile jmp xmissile
rts rts
.endp .endp
; --------------------------------------------------
.proc checkRollDirection
; check rolling direction (for roller and other rolling weapons)
ldy #0
mwa #mountaintable tempXROLLER
adw tempXROLLER xdraw
lda (tempXROLLER),y
sta ydraw
lda vx+3
; if horizontal velocity is negative then change the direction
bpl PositiveVelocity
lda goleft
ora #$01
sta goleft
PositiveVelocity
; first we look for the left slope
; then righ slope and set the flag
; $FF - we are in a hole (flying in missile direction)
; 1 - right, 2 - left
mva #$ff HowMuchToFall
mva ydraw HeightRol
;mwa #mountaintable tempXROLLER - It's already done !!!
;adw tempXROLLER xdraw
SeekLeft
cpw tempXROLLER #mountaintable
beq GoRightNow ; "bounce" if we have on left end
.nowarn dew tempXROLLER
lda (tempXROLLER),y ;fukk! beware of Y value
cmp HeightRol
bne HowMuchToFallLeft
HowMuchToFallLeft
bcs GoRightNow
mva #1 HowMuchToFall
GoRightNow
mwa #mountaintable tempXROLLER
adw tempXROLLER xdraw
SeekRight
cpw tempXROLLER #(mountaintable+screenwidth)
beq HowMuchToFallKnown ; "stop" if we have on left end
inw tempXROLLER
lda (tempXROLLER),y
cmp HeightRol
bne HowMuchToFallRight
HowMuchToFallRight
; check if up or down
bcs HowMuchToFallKnown
lda HowMuchToFall
bpl ItIsLeftAlready
mva #2 HowMuchToFall
bne HowMuchToFallKnown
ItIsLeftAlready
mva #$ff HowMuchToFall
HowMuchToFallKnown
lda HowMuchToFall
bpl DirectionChecked
lda #1
clc
adc goleft
sta HowMuchToFall
DirectionChecked
rts
.endp
; -------------------------------------------------- ; --------------------------------------------------
.proc cleanDirt .proc cleanDirt
mva #0 color mva #0 color
@@ -851,6 +852,83 @@ EndOfTheDirt
mva ycircle ydraw mva ycircle ydraw
rts rts
.endp .endp
; ----------------
.proc liquiddirt ;
mva xdraw TempXfill
mva #200 FillCounter
RepeatFill
mva TempXfill xdraw
jsr checkRollDirection
; HowMuchToFall - direction
; $FF - we are in a hole (flying in missile direction)
; 1 - right, 2 - left
adw xdraw #mountaintable tempXROLLER
ldy #0
lda (tempXROLLER),y
sta HeightRol ; relative point
RollinContinuesLiquid
; new point is set
adw xdraw #mountaintable tempXROLLER
ldy #0
lda (tempXROLLER),y
sta ydraw
beq FillNow
cmp HeightRol
beq UpNotYet2
bcc FillNow
UpNotYet2
sec ;clc
sta HeightRol
sbc #1
sta ydraw
jsr unPlot
; let's go the right direction
lda HowMuchToFall
cmp #1
beq HowMuchToFallRight3
.nowarn dew xdraw
lda xdraw
bne RollinContinuesLiquid
lda xdraw+1
jne RollinContinuesLiquid
beq FillNow
HowMuchToFallRight3
inw xdraw
cpw xdraw screenwidth
jne RollinContinuesLiquid
FillNow
mwa xdraw xcircle ; we must store somewhere (BAD)
mva ydraw ycircle ; xdraw and ydraw (BAD)
mwa #0 xdraw
mva #screenheight-1 ydraw
jsr unPlot
mwa xcircle xdraw ;(bad)
mva ycircle ydraw ;(bad)
; finally one pixel more
ldy #0
lda HowMuchToFall
bmi FillHole
cmp#1
beq FillLeft
inw xdraw
inw xdraw ; tricky but we must rollback xdraw in proper direction
FillLeft
.nowarn dew xdraw
FillHole
adw xdraw #mountaintable tempXROLLER
lda (tempXROLLER),y
sta ydraw
dec ydraw ; one pixel up
lda ydraw
sta (tempXROLLER),y ;mountaintable update
mva #1 color
jsr plot
dec FillCounter
jne RepeatFill
rts
.endp
;-------------------------------------------------- ;--------------------------------------------------
BeforeFire .proc ;TankNr (byte) BeforeFire .proc ;TankNr (byte)