diff --git a/constants.asm b/constants.asm index e39389b..98d315e 100644 --- a/constants.asm +++ b/constants.asm @@ -70,32 +70,6 @@ pmtableH .by >(pmgraph+$700) .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 .by 0 .by 4 @@ -221,67 +195,89 @@ SlideLeftTable .BY %00000111 .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 - ; right angles from 0 (vertically up) to 90 (horizontally to the right) - .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 + ; right angles from 0 (horizontally right) to 90 (up) - .by 0,0,0,0,0,0,0,0,0,0 ; not used - .by 0,0,0,0,0,0,0,0,0,0 ; not used - .by 0,0,0,0,0,0,0,0,0,0 ; not used - .by 0,0,0,0,0,0,0,0,0,0 ; not used - .by 0,0,0,0,0,0,0,0,0,0 ; not used - .by 0,0,0,0,0,0,0,0,0,0 ; not used - .by 0,0,0,0,0,0,0,0,0,0 ; not used - .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,7,7,7,7,7,7,7,7,7, + .by 7,7,7,7,7,7,7,7,7,7, + .by 7,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, + ;.by 4, - ; left angles from 90 (horizontally to the left) to 1 (vertically up) - .by 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,0,0,0 - .by 0,0,0,0,0,0,0,0,0,0 - .by 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 1,1,1,1,1,1,1,1,1 - .by 2,2,2,2,2,2,2,2,2,2 - .by 3,3,3,3,3,3,3,3,3,3,3 + ; left angles from 90 (vertical) to 180 (horizontally left) + .by 3,3,3,3,3,3,3,3,3,3, + .by 3,2,2,2,2,2,2,2,2,2, + .by 2,1,1,1,1,1,1,1,1,1, + .by 0,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, + .by 0,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, + .by 0 EndOfTheBarrelY - ; right angles from 0 (vertically up) to 90 (horizontally to the right) - .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 +; right angles from 0 (horizontally right) to 90 (up) - .by 0,0,0,0,0,0,0,0,0,0 ; not used - .by 0,0,0,0,0,0,0,0,0,0 ; not used - .by 0,0,0,0,0,0,0,0,0,0 ; not used - .by 0,0,0,0,0,0,0,0,0,0 ; not used - .by 0,0,0,0,0,0,0,0,0,0 ; not used - .by 0,0,0,0,0,0,0,0,0,0 ; not used - .by 0,0,0,0,0,0,0,0,0,0 ; not used - .by 0,0,0,0 ; not used + ; 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 4,4,4,4,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,5,5,5, + .by 5,5,5,5,5,5,5,6,6,6, + .by 6,6,6,6,6,6,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,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 diff --git a/grafproc.asm b/grafproc.asm index 218498e..1a55c8b 100644 --- a/grafproc.asm +++ b/grafproc.asm @@ -619,19 +619,8 @@ SkipRemovigPM lda AngleTable,x - bmi AngleToLeft01 - lda #90 - sec - sbc AngleTable,x tay - lda BarrelTableR,y - jmp CharacterAlreadyKnown -AngleToLeft01 - sec - sbc #(255-90) - tay - lda BarrelTableL,y -CharacterAlreadyKnown + lda BarrelTable,y sta CharCode DrawTankNrX ldx tanknr diff --git a/scorch.asm b/scorch.asm index 6efeb07..e4c6429 100644 --- a/scorch.asm +++ b/scorch.asm @@ -1082,9 +1082,9 @@ UsageLoop bcs RandomizeAngle - sta temp - lda #90 ; CARRY=0 here - sbc temp + ;sta temp + ;lda #90 ; CARRY=0 here + ;sbc temp rts .endp @@ -1350,7 +1350,7 @@ font4x4 ins 'artwork/font4x4s.bmp',+62 ;---------------------------------------------- TankFont - ins 'artwork/tanks.fnt' + ins 'artwork/tanksv2.fnt' ;---------------------------------------------- icl 'variables.asm' ;---------------------------------------------- diff --git a/scorch.xex b/scorch.xex index 3c3aa44..8fa205c 100644 Binary files a/scorch.xex and b/scorch.xex differ diff --git a/textproc.asm b/textproc.asm index e632d29..cac0e40 100644 --- a/textproc.asm +++ b/textproc.asm @@ -1205,7 +1205,7 @@ CheckNextLevel .proc displaydec ;decimal (word), displayposition (word) ;-------------------------------------------------- ; displays decimal number as in parameters (in text mode) -; leading zeores are removed +; leading zeroes are removed ; the range is (0000..9999 - two bytes) ldy #3 ; there will be 4 digits @@ -1907,33 +1907,36 @@ NoShieldEnergy ldx TankNr lda AngleTable,x bmi AngleToLeft - lda #$7f ; (tab) character - sta textbuffer+40+25 - lda #0 ;space - sta textbuffer+40+22 - lda #90 - sec - sbc AngleTable,x + + lda AngleTable,x 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 - lda BarrelTableR,y + lda BarrelTable,y sta CharCode bne AngleDisplay ;like jmp, because code always <>0 AngleToLeft - sec - sbc #(255-90) + ;sec + ;sbc #(255-90) sta decimal tay - lda BarrelTableL,y + lda BarrelTable,y sta CharCode - lda #$7e ;(del) char - sta textbuffer+40+22 - lda #0 ;space - sta textbuffer+40+25 + ;lda #$7e ;(del) char + ;sta textbuffer+40+22 + ;lda #0 ;space + ;sta textbuffer+40+25 AngleDisplay - mwa #textbuffer+40+23 displayposition - jsr displaybyte + mwa #textbuffer+40+21 displayposition + jsr displaydec ;========================= ;display Wind diff --git a/weapons.asm b/weapons.asm index 2acd29f..7d34b7f 100644 --- a/weapons.asm +++ b/weapons.asm @@ -202,11 +202,8 @@ FunkyBombLoop lda random sta Force mva #1 Force+1 - ;Angle randomization Range: (-16..+16) - lda random - lsr - and #%00011111 - scc:eor #$ff + ;Angle randomization Range: (70-110 degrees) + randomize 70 110 sta Angle lda #0 @@ -536,35 +533,30 @@ DiggerCharacter lda #$00 sbc #$00 sta ybyte+1 + mva #0 drawFunction + mwa xdraw LaserCoordinate mwa ydraw LaserCoordinate+2 mwa xbyte LaserCoordinate+4 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 - jsr draw - mva #1 color - mwa LaserCoordinate xdraw - mwa LaserCoordinate+2 ydraw - mwa LaserCoordinate+4 xbyte - mwa LaserCoordinate+6 ybyte - 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 - jsr draw + mva #51 yc ; laser blink counter +@ + lda yc + and #$01 + sta color + mwa LaserCoordinate xdraw + mwa LaserCoordinate+2 ydraw + mwa LaserCoordinate+4 xbyte + mwa LaserCoordinate+6 ybyte + mva #sfx_lightning sfx_effect + jsr draw + + dec:lda yc + bpl @- + mva #1 color mwa LaserCoordinate xdraw mwa LaserCoordinate+2 ydraw @@ -1179,34 +1171,34 @@ CTRLPressedDown bmi ForceGoesZero jmp BeforeFire -pressedLeft +pressedRight mva #sfx_set_power_2 sfx_effect ldx TankNr dec AngleTable,x lda AngleTable,x - cmp #$ff ; if angle goes through 0 we clear the barrel - bne NotThrough90DegreesLeft - mva #$2e CharCode - jsr DrawTankNr.drawtankNrX -NotThrough90DegreesLeft - cmp #(255-91) + ;cmp #180 ; if angle goes through 180 we clear the barrel + ;bne NotThrough90DegreesLeft + ;mva #$2e CharCode ; TODO: change + ;jsr DrawTankNr.drawtankNrX +;NotThrough90DegreesLeft + cmp #255 ; -1 jne BeforeFire - lda #90 + lda #180 sta AngleTable,x jmp BeforeFire -pressedRight +pressedLeft mva #sfx_set_power_2 sfx_effect ldx TankNr INC AngleTable,x lda AngleTable,x - bne NotThrough90DegreesRight - mva #$30 CharCode ; if angle goes through 0 we clear the barrel - jsr DrawTankNr.drawtankNrX -NotThrough90DegreesRight - cmp #91 + ;bne NotThrough90DegreesRight + ;mva #$30 CharCode ; if angle goes through 0 we clear the barrel + ;jsr DrawTankNr.drawtankNrX +;NotThrough90DegreesRight + cmp #181 jne BeforeFire - lda #(255-90) + lda #0 sta AngleTable,x jmp BeforeFire @@ -1610,8 +1602,8 @@ ThereWasNoParachute ; Angle(byte) 128=0, 255=maxright, 0=maxleft ;-------------------------------------------------- ;g=-0.1 -;vx=Force*sin(Angle) -;vy=Force*cos(Angle) +;vx=Force*cos(Angle) +;vy=Force*sin(Angle) ; ;:begin ;ytraj=ytray-vy @@ -1621,6 +1613,9 @@ ThereWasNoParachute ;plot xtraj,ytraj - there is clearing in plot ;goto begin + + + ; smoke tracer :) ldy #0 ldx TankNr @@ -1648,45 +1643,41 @@ RepeatFlight sta ydraw+1 ;vx calculation + ;vx = sin(90-Angle) for Angle <=90 + ;vx = -sin(Angle-90) for 90 < Angle <= 180 aslw Force ;Force = Force * 2 - ;sin(Angle) + ;cos(Angle) (but we use sin table only so some shenanigans happen) ldx Angle stx LeapFrogAngle ; we will need it later ;Angle works like this: - ;0 'degrees' is straight up - ;90 'degrees' is horizontally right - ;255 is straight up (same as 0) - ;255-90 (165) horizontally left + ;0 'degrees' is horizontally right + ;90 'degrees' is straight up + ;180 horizontally left - bpl FlightRight + ; (we have to set goleft used in rolling weapons) + + cpx #91 + bcc angleUnder90 - ;and if the highest bit is set then - ;Flight to LEFT - ;calculate Angle with this formula: - ;Angle=90-(Angle-165) - - sec - 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!!!) + ;over 90 mva #1 goleft - bne @+ + sec + txa ; lda # Angle + sbc #90 + tax + jmp @+ -FlightRight +angleUnder90 mva #0 goleft -@ - lda sintable,x ;sin(Angle) - sta Multiplee ;sin(Angle)*Force + sec ; X = 90-Angle + lda #90 + sbc Angle + tax +@ + lda sintable,x ; cos(X) + sta Multiplee ; *Force mwa Force Multiplier lda #$0 sta Multiplier+2 @@ -1725,18 +1716,27 @@ DoNotAdd .endr @ ;======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+1 sta vy+2 ;-- - lda #90 + ldx Angle + cpx #91 + bcc YangleUnder90 + + lda #180 sec sbc Angle tax + +YangleUnder90 lda sintable,x - sta Multiplee ;cos(Angle)*Force + sta Multiplee ;sin(Angle)*Force mwa Force Multiplier lda #$0 sta Multiplier+2 @@ -1795,7 +1795,7 @@ Loopi ; we check if it is MIRV and if so, jump to MIRV routine ldx TankNr lda ActiveWeapon,x - cmp #6 ; MIRV + cmp #ind_MIRV___________ ; MIRV jeq MIRVdownLoop StillUp