mirror of
https://github.com/pkali/scorch_src.git
synced 2026-05-21 06:39:46 +02:00
letting winds #82
This commit is contained in:
+1
-1
@@ -889,7 +889,7 @@ NamesOfWeapons ;the comment is an index in the tables
|
||||
dta d"White Flag " ; 63
|
||||
weaponsOfDeath
|
||||
dta 1,2,3,7,15,16,17,18,19,20,21,22,23,24,25,26,27
|
||||
weaponsOfDeathEnd
|
||||
weaponsOfDeathEnd
|
||||
joyToKeyTable
|
||||
; .by 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15
|
||||
.by $ff,$ff,$ff,$ff,$ff,$ff,$ff,$07,$ff,$ff,$ff,$06,$ff,$0f,$0e,$ff
|
||||
|
||||
+18
-5
@@ -399,7 +399,7 @@ RoboTanks
|
||||
; robotanks shoot here
|
||||
jsr ArtificialIntelligence
|
||||
jsr MoveBarrelToNewPosition
|
||||
jsr StatusDisplay ;all digital values like force, angle, wind, etc.
|
||||
jsr DisplayStatus ;all digital values like force, angle, wind, etc.
|
||||
jsr PutTankNameOnScreen
|
||||
; let's move the tank's barrel so it points the right
|
||||
; direction
|
||||
@@ -414,7 +414,7 @@ AfterManualShooting
|
||||
inc noDeathCounter
|
||||
|
||||
jsr DecreaseWeaponBeforeShoot
|
||||
jsr StatusDisplay
|
||||
jsr DisplayStatus
|
||||
|
||||
ldx TankNr
|
||||
dec Energy,x ; lower energy to eventually let tanks commit suicide
|
||||
@@ -710,18 +710,31 @@ NotNegativeEnergy
|
||||
|
||||
;--------------------------------------------------
|
||||
GetRandomWind .proc
|
||||
;in: MaxWind (byte)
|
||||
;out: Wind (word)
|
||||
;uses: _
|
||||
;--------------------------------------------------
|
||||
lda random
|
||||
cmp MaxWind
|
||||
bcs GetRandomWind ; if more than MaxWind then randomize again
|
||||
sta Wind
|
||||
mva #$00 Wind+1
|
||||
; multiply Wind by 16 and take it as a decimal part (0.Wind)
|
||||
sta Wind+2
|
||||
sta Wind+3
|
||||
; multiply Wind by 16
|
||||
; two bytes of Wind are treated as a decimal part of vx variable
|
||||
:4 aslw Wind
|
||||
; decide the direction
|
||||
lda random
|
||||
and #$01
|
||||
sta WindOrientation
|
||||
rts
|
||||
beq @+
|
||||
sec ; Wind = -Wind
|
||||
.rept 4
|
||||
lda #$00
|
||||
sbc Wind+#
|
||||
sta Wind+#
|
||||
.endr
|
||||
@ rts
|
||||
.endp
|
||||
|
||||
;--------------------------------------------------
|
||||
|
||||
BIN
Binary file not shown.
+12
-8
@@ -1600,7 +1600,7 @@ FinishResultDisplay
|
||||
.endp
|
||||
|
||||
;-------------------------------------------------
|
||||
.proc StatusDisplay
|
||||
.proc DisplayStatus
|
||||
;-------------------------------------------------
|
||||
|
||||
;lda noDeathCounter
|
||||
@@ -1715,24 +1715,28 @@ AngleDisplay
|
||||
;=========================
|
||||
;display Wind
|
||||
;=========================
|
||||
lda WindOrientation
|
||||
bne DisplayLeftWind
|
||||
mwa Wind temp
|
||||
lda Wind+3 ; highest byte of 4 byte wind
|
||||
bmi DisplayLeftWind
|
||||
lda #$7f ; (tab) char
|
||||
sta textbuffer+80+28
|
||||
lda #0 ;space
|
||||
sta textbuffer+80+25
|
||||
beq DisplayWindValue
|
||||
DisplayLeftWind
|
||||
sec ; Wind = -Wind
|
||||
lda #$00
|
||||
sbc temp
|
||||
sta temp
|
||||
lda #$00
|
||||
sbc temp+1
|
||||
sta temp+1
|
||||
lda #$7e ;(del) char
|
||||
sta textbuffer+80+25
|
||||
lda #0 ;space
|
||||
sta textbuffer+80+28
|
||||
DisplayWindValue
|
||||
mwa Wind temp
|
||||
lsrw temp ;divide by 16 to have
|
||||
lsrw temp ;a nice view on a screen
|
||||
lsrw temp
|
||||
lsrw temp
|
||||
:4 lsrw temp ;divide by 16 to have a nice value on a screen
|
||||
lda temp
|
||||
sta decimal
|
||||
mwa #textbuffer+80+26 displayposition
|
||||
|
||||
+3
-2
@@ -113,8 +113,9 @@ L1 .DS 1 ; variable used in multiplications (by 10:)
|
||||
gravity .DS 1 ;only the decimal part (1/10 = 25)
|
||||
;-----------------------------------
|
||||
|
||||
Wind .ds 2 ;walue displayed on the screen
|
||||
;multiplied by 16 (decimal part only)
|
||||
Wind .ds 4 ;format: 0000.hhll
|
||||
;walue displayed on the screen is
|
||||
;decimal portion divided by 16 (>>4)
|
||||
;-----------------------------------
|
||||
MaxWind .ds 1 ;
|
||||
WindOrientation .DS 1 ;(0-right,1-left)
|
||||
|
||||
+36
-114
@@ -991,7 +991,7 @@ ContinueToCheckMaxForce2
|
||||
lda MaxForceTableL,x
|
||||
sta ForceTableL,x
|
||||
@
|
||||
jsr StatusDisplay ;all digital values like force, angle, wind, etc.
|
||||
jsr DisplayStatus ;all digital values like force, angle, wind, etc.
|
||||
jsr PutTankNameOnScreen
|
||||
|
||||
jsr DrawTankNr
|
||||
@@ -1501,7 +1501,8 @@ ThereWasNoParachute
|
||||
.endp
|
||||
|
||||
;--------------------------------------------------
|
||||
.proc Flight ; Force(byte.byte), Angle(byte), Wind(.byte) 128=0, 255=maxright, 0=maxleft
|
||||
.proc Flight ; Force(byte.byte), Wind(0.word)
|
||||
; Angle(byte) 128=0, 255=maxright, 0=maxleft
|
||||
;--------------------------------------------------
|
||||
;g=-0.1
|
||||
;vx=Force*sin(Angle)
|
||||
@@ -1554,7 +1555,7 @@ RepeatIfSmokeTracer
|
||||
;255-90 (165) horizontally left
|
||||
|
||||
bpl FlightRight
|
||||
|
||||
|
||||
;and if the highest bit is set then
|
||||
;Flight to LEFT
|
||||
;calculate Angle with this formula:
|
||||
@@ -1563,12 +1564,14 @@ RepeatIfSmokeTracer
|
||||
sec
|
||||
txa
|
||||
sbc #165 ;(Angle-165)
|
||||
sta temp ;dirty trick with selfmodifying code (REMOVED)
|
||||
lda #90 ;
|
||||
sta temp
|
||||
lda #90
|
||||
sbc temp ;90-(Angle-165)
|
||||
;and we have rady angle here ... and we go LEFT!
|
||||
tax
|
||||
sta Angle
|
||||
|
||||
;
|
||||
mva #1 goleft
|
||||
; and now we contine as if nothing happened
|
||||
; (but we have goleft set to 1!!!)
|
||||
@@ -1580,7 +1583,7 @@ FlightRight
|
||||
dontzerogoleft
|
||||
|
||||
lda sintable,x ;sin(Angle)
|
||||
sta Multiplee ;sin(Angle)*Force
|
||||
sta Multiplee ;sin(Angle)*Force
|
||||
mwa Force Multiplier
|
||||
lda #$0
|
||||
sta Multiplier+2
|
||||
@@ -1605,10 +1608,19 @@ DoNotAdd
|
||||
rol Multiplier+2
|
||||
dex
|
||||
bne MultiplyLoop
|
||||
; here in vx there is a number xxxx.yyy = sin(Angle)*Force
|
||||
|
||||
mva #0 vx+3 ;vx=sin(Angle)*Force
|
||||
|
||||
|
||||
mva #0 vx+3
|
||||
; here in vx there is a number
|
||||
; xxxx.xx00 = sin(Angle)*Force
|
||||
; negate it if going left
|
||||
lda goleft
|
||||
beq @+
|
||||
.rept 4
|
||||
lda #$00
|
||||
sbc vx+#
|
||||
sta vx+#
|
||||
.endr
|
||||
@
|
||||
;======vy
|
||||
lda #0 ;cos(Angle)
|
||||
sta vy
|
||||
@@ -1646,7 +1658,8 @@ DoNotAddY
|
||||
rol Multiplier+2
|
||||
dex
|
||||
bne MultiplyLoopY
|
||||
; here in vy there is a number xxxx.yyy=cos(Angle)*Force
|
||||
; here in vy there is a number
|
||||
; yyyy.yy=cos(Angle)*Force
|
||||
|
||||
mva #0 vy+3 ;vy=cos(Angle)*Force
|
||||
|
||||
@@ -1682,8 +1695,7 @@ Loopi
|
||||
cmp #6 ; MIRV
|
||||
jeq MIRVdownLoop
|
||||
StillUp
|
||||
lda goleft
|
||||
bne FlightLeft
|
||||
|
||||
|
||||
clc ;xtraj=xtraj+vx (skipping least significant byte of vx)
|
||||
lda xtraj ;here of course Fight to right
|
||||
@@ -1695,66 +1707,13 @@ StillUp
|
||||
lda xtraj+2
|
||||
adc vx+3
|
||||
sta xtraj+2
|
||||
jmp @+ ;skipping substracting for Flight to left
|
||||
|
||||
FlightLeft
|
||||
sec ;xtraj=xtraj-vx (skipping least significant byte of vx)
|
||||
lda xtraj ;here of course Fight to left
|
||||
sbc vx+1
|
||||
sta xtraj
|
||||
lda xtraj+1
|
||||
sbc vx+2
|
||||
sta xtraj+1
|
||||
lda xtraj+2
|
||||
sbc vx+3
|
||||
sta xtraj+2
|
||||
|
||||
@
|
||||
;vx=vx-Wind (also without least significan byte of vx)
|
||||
lda goleft
|
||||
bne FlightsLeft ;blow on bullet flighting left
|
||||
lda WindOrientation
|
||||
bne LWindToRight
|
||||
beq LWindToLeft
|
||||
FlightsLeft
|
||||
lda WindOrientation
|
||||
beq LWindToRight
|
||||
|
||||
LWindToLeft
|
||||
; here Wind to right, bullet goes right as well, so vx=vx+Wind
|
||||
; here Wind to left, bullet goes left as well, so vx=vx+Wind
|
||||
clc
|
||||
lda vx
|
||||
adc Wind
|
||||
sta vx
|
||||
lda vx+1
|
||||
adc Wind+1
|
||||
sta vx+1
|
||||
lda vx+2
|
||||
adc #0
|
||||
sta vx+2
|
||||
lda vx+3
|
||||
adc #0
|
||||
sta vx+3
|
||||
jmp @+
|
||||
|
||||
LWindToRight
|
||||
;Wind to left, bullet right, so vx=vx-Wind
|
||||
;Wind to right, bullet left, so vx=vx-Wind
|
||||
sec
|
||||
lda vx
|
||||
sbc Wind
|
||||
sta vx
|
||||
lda vx+1
|
||||
sbc Wind+1
|
||||
sta vx+1
|
||||
lda vx+2
|
||||
sbc #0
|
||||
sta vx+2
|
||||
lda vx+3
|
||||
sbc #0
|
||||
sta vx+3
|
||||
@
|
||||
.rept 4
|
||||
lda vx+#
|
||||
adc Wind+#
|
||||
sta vx+#
|
||||
.endr
|
||||
mwa xtrajold+1 xdraw
|
||||
mwa ytrajold+1 ydraw
|
||||
mwa xtraj+1 xbyte
|
||||
@@ -2023,51 +1982,14 @@ mrFlightLeft
|
||||
|
||||
|
||||
mrskip07
|
||||
;vx=vx-Wind (also without least significan byte of vx)
|
||||
;vx=vx+Wind
|
||||
|
||||
lda goleft
|
||||
bne mrFlightsLeft ;blow on bullet flighting left
|
||||
lda WindOrientation
|
||||
bne mrWindToLeft
|
||||
beq mrLWindToLeft
|
||||
mrFlightsLeft
|
||||
lda WindOrientation
|
||||
beq mrLWindToRight
|
||||
mrLWindToLeft
|
||||
; here Wind to right, bullet goes right as well, so vx=vx+Wind
|
||||
; here Wind to left, bullet goes left as well, so vx=vx+Wind
|
||||
clc
|
||||
lda vx00,x
|
||||
adc Wind
|
||||
sta vx00,x
|
||||
lda vx01,x
|
||||
adc Wind+1
|
||||
sta vx01,x
|
||||
lda vx02,x
|
||||
adc #0
|
||||
sta vx02,x
|
||||
lda vx03,x
|
||||
adc #0
|
||||
sta vx03,x
|
||||
Jmp mrskip08
|
||||
mrWindToLeft
|
||||
mrLWindToRight
|
||||
;Wind to left, bullet right, so vx=vx-Wind
|
||||
;Wind to right, bullet left, so vx=vx-Wind
|
||||
sec
|
||||
lda vx00,x
|
||||
sbc Wind
|
||||
sta vx00,x
|
||||
lda vx01,x
|
||||
sbc Wind+1
|
||||
sta vx01,x
|
||||
lda vx02,x
|
||||
sbc #0
|
||||
sta vx02,x
|
||||
lda vx03,x
|
||||
sbc #0
|
||||
sta vx03,x
|
||||
mrskip08
|
||||
.rept 4
|
||||
lda vx+#
|
||||
adc Wind+#
|
||||
sta vx+#
|
||||
.endr
|
||||
|
||||
; rules for a falling MIRV bulets.
|
||||
; if Y is negative and any X (bullet over the screen) - continue flying
|
||||
|
||||
Reference in New Issue
Block a user