new angles #87

This commit is contained in:
2022-07-03 00:05:03 -04:00
6 changed files with 178 additions and 190 deletions
+76 -80
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
@@ -221,67 +195,89 @@ SlideLeftTable
.BY %00000111 .BY %00000111
.BY %00001100 .BY %00001100
;-----------------------------------------------------------
; this table changes Angle to the appropriate tank character
BarrelTable
.by $2C,$2C,$2C,$2C,$2C,$2C,$2C,$2C,$2A,$2A,
.by $2A,$2A,$2A,$2A,$2A,$2A,$28,$28,$28,$28,
.by $28,$28,$28,$28,$28,$26,$26,$26,$26,$26,
.by $26,$26,$26,$24,$24,$24,$24,$24,$24,$24,
.by $24,$22,$22,$22,$22,$22,$22,$22,$22,$22,
.by $20,$20,$20,$20,$20,$20,$20,$20,$1E,$1E,
.by $1E,$1E,$1E,$1E,$1E,$1E,$1C,$1C,$1C,$1C,
.by $1C,$1C,$1C,$1C,$1C,$1A,$1A,$1A,$1A,$1A,
.by $1A,$1A,$1A,$18,$18,$18,$18,$18,$18,$18,
;.by $18,
.by $16,$16,$16,$16,$16,$16,$16,$16,$14,$14,
.by $14,$14,$14,$14,$14,$14,$12,$12,$12,$12,
.by $12,$12,$12,$12,$12,$10,$10,$10,$10,$10,
.by $10,$10,$10,$0E,$0E,$0E,$0E,$0E,$0E,$0E,
.by $0E,$0C,$0C,$0C,$0C,$0C,$0C,$0C,$0C,$0C,
.by $0A,$0A,$0A,$0A,$0A,$0A,$0A,$0A,$08,$08,
.by $08,$08,$08,$08,$08,$08,$06,$06,$06,$06,
.by $06,$06,$06,$06,$06,$04,$04,$04,$04,$04,
.by $04,$04,$04,$02,$02,$02,$02,$02,$02,$02,
.by $02,
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
+1 -12
View File
@@ -619,19 +619,8 @@ SkipRemovigPM
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
+4 -4
View File
@@ -1082,9 +1082,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
@@ -1350,7 +1350,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'
;---------------------------------------------- ;----------------------------------------------
BIN
View File
Binary file not shown.
+21 -18
View File
@@ -1205,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
@@ -1907,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
+74 -74
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
@@ -536,35 +533,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 +1171,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
@@ -1610,8 +1602,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
@@ -1621,6 +1613,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
@@ -1648,45 +1643,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)
;and if the highest bit is set then cpx #91
;Flight to LEFT bcc angleUnder90
;calculate Angle with this formula:
;Angle=90-(Angle-165)
sec ;over 90
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 #90
sbc Angle
tax
@ @
lda sintable,x ;sin(Angle) lda sintable,x ; cos(X)
sta Multiplee ;sin(Angle)*Force sta Multiplee ; *Force
mwa Force Multiplier mwa Force Multiplier
lda #$0 lda #$0
sta Multiplier+2 sta Multiplier+2
@@ -1725,18 +1716,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
@@ -1795,7 +1795,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