Merge pull request #90 from pkali/develop

build 143
This commit is contained in:
2022-06-06 00:23:46 -04:00
committed by GitHub
9 changed files with 573 additions and 515 deletions
+10
View File
@@ -47,6 +47,16 @@ With the advent of fujinet (https://fujinet.online/) we are thinking about makin
## Changes: ## Changes:
###### Build 143
2022-06-05
Rewrite build. We redone several important parts of the game to allow for bug fixes and requested features. Generally it was a great success, but some new bugs appeared. This build is nice for the eye, but beware, no mercy for testers again :)
Only visible changes listed, because you are possibly not as excited as we are for the new Flight routine and ground collisions by @Pecusx.
- https://github.com/pkali/scorch_src/issues/84, https://github.com/pkali/scorch_src/issues/63 - tanks now say good bye properly!
- https://github.com/pkali/scorch_src/issues/74 - Press [ESC] to quit the game at any point, with a confirmation when the round has already started. Please note the keyboard is not checked all the time, so press it for a while, especially when AI tanks are ru(i/n)ning the show.
- https://github.com/pkali/scorch_src/issues/56 - there should be no occurrences of frivolous weapon purchases. Please report all tanks getting their munitions from uncertified sources!
- https://github.com/pkali/scorch_src/issues/47 - It seems that the bad sequence of turns has been ameliorated. Fix is trivial, finding the culprit - far from it. Please pay special attention to fairness of shooting in case the fix is still longing for the fjords.
- ATTRACT mode works how it should - screensaver saves screen only when HUMAN should input something.
###### Build 142 ###### Build 142
2022-05-30 2022-05-30
Late build. The bugs we tried to squelch turned out to be more difficult than usual. Some progress has been made though even if it is not yet visible. Late build. The bugs we tried to squelch turned out to be more difficult than usual. Some progress has been made though even if it is not yet visible.
+11 -19
View File
@@ -23,7 +23,6 @@ RoundsTable .by 10,20,30,40,50
flyDelayTable .by 255,150,75,35,1 flyDelayTable .by 255,150,75,35,1
seppukuTable .by 255, 45,25,15,9 seppukuTable .by 255, 45,25,15,9
;------------------------------------------------ ;------------------------------------------------
LevelNameBeginL ; begins of level names LevelNameBeginL ; begins of level names
.by <NamesOfLevels,<(NamesOfLevels+10),<(NamesOfLevels+20) .by <NamesOfLevels,<(NamesOfLevels+10),<(NamesOfLevels+20)
.by <(NamesOfLevels+32),<(NamesOfLevels+42),<(NamesOfLevels+52) .by <(NamesOfLevels+32),<(NamesOfLevels+42),<(NamesOfLevels+52)
@@ -37,31 +36,25 @@ TanksWeaponsTableL
.by <TanksWeapon1,<TanksWeapon2,<TanksWeapon3,<TanksWeapon4,<TanksWeapon5,<TanksWeapon6 .by <TanksWeapon1,<TanksWeapon2,<TanksWeapon3,<TanksWeapon4,<TanksWeapon5,<TanksWeapon6
TanksWeaponsTableH TanksWeaponsTableH
.by >TanksWeapon1,>TanksWeapon2,>TanksWeapon3,>TanksWeapon4,>TanksWeapon5,>TanksWeapon6 .by >TanksWeapon1,>TanksWeapon2,>TanksWeapon3,>TanksWeapon4,>TanksWeapon5,>TanksWeapon6
;-----4x4 texts-----
;-----4x4 texts-----
LineTop LineTop
dta d"(%%%%%%%%%%%%)" dta d"(%%%%%%%%%%%%)", $ff
.byte $ff
;# - vertical, () * +, % - horizontal ;# - vertical, () * +, % - horizontal
LineBottom LineBottom
dta d"*%%%%%%%%%%%%+" dta d"*%%%%%%%%%%%%+", $ff
.byte $ff
LineEmpty LineEmpty
dta d"# #" dta d"# #", $ff
.byte $ff
LineHeader2 LineHeader2
dta d"# RESULTS #" dta d"# RESULTS #", $ff
.byte $ff
LineGameOver LineGameOver
dta d"# GAME OVER #" dta d"# GAME OVER #", $ff
.byte $ff
seppukuText seppukuText
dta d"# SEPPUKU! #" dta d"# SEPPUKU! #", $ff
.byte $ff areYouSureText
dta d"# SURE? Y/N #", $ff
lineClear lineClear
dta d" " dta d" ", $ff
.byte $ff
;----------- ;-----------
pmtableL ; addressess of the P/M memory for 5 tanks (6th is without P/M background) pmtableL ; addressess of the P/M memory for 5 tanks (6th is without P/M background)
@@ -541,8 +534,8 @@ EndOfTheBarrelY
.by 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
.by 7,7,7,7,7,7,7,7,7,7,7 .by 7,7,7,7,7,7,7,7,7,7,7
;-------------------------------------------------
;-------------------------------------------------
TanksNamesDefault TanksNamesDefault
dta d"1st.Tank" dta d"1st.Tank"
dta d"2nd.Tank" dta d"2nd.Tank"
@@ -551,7 +544,6 @@ TanksNamesDefault
dta d"5th.Tank" dta d"5th.Tank"
dta d"6th.Tank" dta d"6th.Tank"
WeaponPriceH ; weapons prices (tables with prices of weapons) WeaponPriceH ; weapons prices (tables with prices of weapons)
.by >price_Baby_Missile___ .by >price_Baby_Missile___
.by >price_Missile________ .by >price_Missile________
+64 -16
View File
@@ -4,7 +4,7 @@
;-------------------------------------------------- ;--------------------------------------------------
draw .proc ;;fuxxing good draw :) .proc draw ;;fuxxing good draw :)
;-------------------------------------------------- ;--------------------------------------------------
;creditz to Dr Jankowski / MIM U.W. ;creditz to Dr Jankowski / MIM U.W.
; (xi,yi)-----(xk,yk) ; (xi,yi)-----(xk,yk)
@@ -43,9 +43,9 @@ draw .proc ;;fuxxing good draw :)
;cpw ybyte #screenheight ;cpw ybyte #screenheight
;bcc DrawOnTheScreen ;bcc DrawOnTheScreen
lda ydraw+1 lda ydraw+1
bne DrawOutOfTheScreen bmi DrawOutOfTheScreen
lda ybyte+1 lda ybyte+1
beq DrawOnTheScreen bpl DrawOnTheScreen
DrawOutOfTheScreen DrawOutOfTheScreen
;jsr DrawJumpPad ;jsr DrawJumpPad
rts rts
@@ -230,20 +230,26 @@ yestrace
jsr plot jsr plot
notrace notrace
;aftertrace ;aftertrace
;key
lda HitFlag lda HitFlag
bne StopHitChecking bne StopHitChecking
CheckCollisionDraw CheckCollisionDraw
; checking collision! ; checking collision!
lda ydraw+1 lda ydraw+1
bne StopHitChecking bmi StopHitChecking
jsr CheckCollisionWithTank jsr CheckCollisionWithTank
lda HitFlag lda HitFlag
bne StopHitChecking bne StopHitChecking
mwa xdraw temp clc
adw temp #mountaintable lda xdraw
adc #<mountaintable
sta temp
lda xdraw+1
adc #>mountaintable
sta temp+1
ldy #0 ldy #0
lda ydraw lda ydraw
@@ -255,7 +261,7 @@ CheckCollisionDraw
sec sec
sbc #1 sbc #1
sta YHit sta YHit
mva #0 YHit+1 sty YHit+1
;mwa ydraw YHit ;mwa ydraw YHit
mva #1 HitFlag mva #1 HitFlag
StopHitChecking StopHitChecking
@@ -272,7 +278,7 @@ ContinueDraw
EndOfDraw EndOfDraw
mwa xtempDRAW xdraw mwa xtempDRAW xdraw
mva ytempDRAW ydraw mwa ytempDRAW ydraw
rts rts
.endp .endp
@@ -298,7 +304,7 @@ EndOfDraw
; splot8 ; splot8
mwa xdraw xcircle mwa xdraw xcircle
mva ydraw ycircle mwa ydraw ycircle
mwa #0 xc mwa #0 xc
mva radius yc mva radius yc
@@ -354,7 +360,7 @@ endcircleloop
jsr splot8 jsr splot8
mwa xcircle xdraw mwa xcircle xdraw
mva ycircle ydraw mwa ycircle ydraw
rts rts
.endp .endp
;---- ;----
@@ -381,12 +387,19 @@ splot8 .proc
adc YC adc YC
sta ydraw sta ydraw
sta tempcir sta tempcir
lda ycircle+1
adc #$00
sta ydraw+1
sta tempcir+1
jsr plot jsr plot
sec sec
lda ycircle lda ycircle
sbc YC sbc YC
sta ydraw sta ydraw
lda ycircle+1
sbc #$00
sta ydraw+1
jsr plot jsr plot
sec sec
@@ -400,6 +413,8 @@ splot8 .proc
lda tempcir lda tempcir
sta ydraw sta ydraw
lda tempcir+1
sta ydraw+1
jsr plot jsr plot
;--- ;---
clc clc
@@ -414,12 +429,19 @@ splot8 .proc
adc xC adc xC
sta ydraw sta ydraw
sta tempcir sta tempcir
lda ycircle+1
adc #$00
sta ydraw+1
sta tempcir+1
jsr plot jsr plot
sec sec
lda ycircle lda ycircle
sbc xC sbc xC
sta ydraw sta ydraw
lda ycircle+1
sbc #$00
sta ydraw+1
jsr plot jsr plot
sec sec
@@ -433,6 +455,8 @@ splot8 .proc
lda tempcir lda tempcir
sta ydraw sta ydraw
lda tempcir+1
sta ydraw+1
jsr plot jsr plot
RTS RTS
@@ -583,7 +607,7 @@ DrawNextTank
.endp .endp
;--------- ;---------
.proc DrawTankNr .proc DrawTankNr
ldx tanknr ldx tankNr
; let's check the energy ; let's check the energy
lda eXistenZ,x lda eXistenZ,x
bne SkipRemovigPM ; if energy=0 then no tank bne SkipRemovigPM ; if energy=0 then no tank
@@ -672,6 +696,28 @@ DoNotDrawTankNr
rts rts
.endp .endp
; -------------------------------------
.proc FlashTank
; -------------------------------------
; number of blinking tank in TankNr
mva #18 fs ; temp, how many times flash the tank
tankflash_loop
lda CONSOL ; turbo mode
cmp #6 ; START
sne:mva #1 fs ; finish it
mva #1 Erase
ldx TankNr
jsr DrawTankNr.SkipRemovigPM ; it's necessary becouse DrawTankNr skips tanks with no energy !
PAUSE 2
mva #0 Erase
ldx TankNr
jsr DrawTankNr.SkipRemovigPM
PAUSE 2
dec fs
jne tankflash_loop
rts
.endp
;-------------------------------------------------- ;--------------------------------------------------
.proc drawmountains .proc drawmountains
;-------------------------------------------------- ;--------------------------------------------------
@@ -685,6 +731,7 @@ drawmountainsloop
cmp #screenheight cmp #screenheight
beq NoMountain beq NoMountain
sta ydraw sta ydraw
sty ydraw+1
jsr DrawLine jsr DrawLine
NoMountain NoMountain
inw modify inw modify
@@ -703,6 +750,7 @@ drawmountainspixelloop
ldy #0 ldy #0
lda (modify),y lda (modify),y
sta ydraw sta ydraw
sty ydraw+1
jsr plot jsr plot
inw modify inw modify
inw xdraw inw xdraw
@@ -749,7 +797,7 @@ drawmountainspixelloop
adw RangeLeft #mountaintable2 tempor2 adw RangeLeft #mountaintable2 tempor2
NextColumn1 NextColumn1
mva #0 ydraw mwa #0 ydraw
NextPoint1 NextPoint1
jsr point jsr point
beq StillNothing beq StillNothing
@@ -1260,9 +1308,9 @@ MakeMask00
lsr mask1+# lsr mask1+#
ror mask2+# ror mask2+#
.endr .endr
.rept 8
sec sec
ror char1+# .rept 8
ror char1+# ; in second (and next) lines we have C=1 - one SEC enough
ror char2+# ror char2+#
.endr .endr
dex dex
@@ -1383,9 +1431,9 @@ MakeMask01
lsr mask1+# lsr mask1+#
ror mask2+# ror mask2+#
.endr .endr
.rept 4
sec sec
ror char1+# .rept 4
ror char1+# ; in second (and next) lines we have C=1 - one SEC enough
ror char2+# ror char2+#
.endr .endr
dex dex
+1
View File
@@ -147,6 +147,7 @@ NMIST = $D40F ; rejestr statusu przerwa NMI
;------------------------------------- ;-------------------------------------
;additional system variables ;additional system variables
;------------------------------------- ;-------------------------------------
ATRACT = $004D
COLPM0S = $02C0 ;- - shadow register COLPM0 COLPM0S = $02C0 ;- - shadow register COLPM0
COLPM1S = $02C1 ;- - shadow register COLPM1 COLPM1S = $02C1 ;- - shadow register COLPM1
COLPM2S = $02C2 ;- - shadow register COLPM2 COLPM2S = $02C2 ;- - shadow register COLPM2
+117 -105
View File
@@ -36,7 +36,7 @@
;we decided it must go in 'English' to let other people work on it ;we decided it must go in 'English' to let other people work on it
.macro build .macro build
dta d"142" ; number of this build (3 bytes) dta d"143" ; number of this build (3 bytes)
.endm .endm
icl 'definitions.asm' icl 'definitions.asm'
@@ -98,6 +98,7 @@
icl 'lib/atari.hea' icl 'lib/atari.hea'
icl 'lib/macro.hea' icl 'lib/macro.hea'
;splash screen and musix
icl 'artwork/HIMARS14.asm' icl 'artwork/HIMARS14.asm'
;Game loading address ;Game loading address
ORG $3000 ORG $3000
@@ -117,13 +118,14 @@ START
; Startup sequence ; Startup sequence
jsr Initialize jsr Initialize
jsr Options ;startup screen jsr Options ;startup screen
lda escFlag lda escFlag
bne START bne START
jsr EnterPlayerNames jsr EnterPlayerNames
lda escFlag
bne START
jsr RandomizeSequence jsr RandomizeSequence
; for the round #1 shooting sequence is random ; for the round #1 shooting sequence is random
@@ -144,6 +146,9 @@ MainGameLoop
jsr RoundInit jsr RoundInit
jsr MainRoundLoop jsr MainRoundLoop
lda escFlag
bne START
mva #0 TankNr ; mva #0 TankNr ;
jsr SortSequence jsr SortSequence
@@ -248,51 +253,46 @@ skipzeroing
; the shooting angle is randomized ; the shooting angle is randomized
; of course gains an looses are zeroed ; of course gains an looses are zeroed
;jsr StatusDisplay
lda #0 lda #0
tax tax
@ @ sta singleRoundVars,x
sta singleRoundVars,x inx
inx cpx #(singleRoundVarsEnd-singleRoundVars)
cpx #(singleRoundVarsEnd-singleRoundVars)
bne @- bne @-
ldx #(MaxPlayers-1) ldx #(MaxPlayers-1)
SettingEnergies SettingEnergies
lda #$00 lda #$00
sta gainL,x sta gainL,x
sta gainH,x sta gainH,x
sta looseL,x sta looseL,x
sta looseH,x sta looseH,x
lda #99 lda #99
sta Energy,x sta Energy,x
sta eXistenZ,x sta eXistenZ,x
sta LASTeXistenZ,x sta LASTeXistenZ,x
; anything in eXistenZ table means that this tank exist ; anything in eXistenZ table means that this tank exist
; in the given round ; in the given round
lda #<1000 lda #<1000
sta MaxForceTableL,x sta MaxForceTableL,x
lda #>1000 lda #>1000
sta MaxForceTableH,x sta MaxForceTableH,x
lda #<350 lda #<350
sta ForceTableL,x sta ForceTableL,x
lda #>350 lda #>350
sta ForceTableH,x sta ForceTableH,x
;lda #(255-45) ;lda #(255-45)
;it does not look good when all tanks have ;it does not look good when all tanks have
;barrels pointing the same direction ;barrels pointing the same direction
;so it would be nice to have more or less random ;so it would be nice to have more or less random
;angles ;angles
jsr RandomizeAngle jsr RandomizeAngle
sta AngleTable,x sta AngleTable,x
dex
dex
bpl SettingEnergies bpl SettingEnergies
mva #0 CurrentResult
;generating the new landscape ;generating the new landscape
jsr PMoutofScreen ;let P/M disappear jsr PMoutofScreen ;let P/M disappear
jsr clearscreen ;let the screen be clean jsr clearscreen ;let the screen be clean
@@ -322,6 +322,7 @@ SettingEnergies
; tank with energy greater than 0 left ; tank with energy greater than 0 left
ldy #0 ; in Y - number of tanks with energy greater than zero ldy #0 ; in Y - number of tanks with energy greater than zero
sty ATRACT ; reset atract mode
ldx NumberOfPlayers ldx NumberOfPlayers
dex dex
CheckingIfRoundIsFinished CheckingIfRoundIsFinished
@@ -343,8 +344,7 @@ WhichTankWonLoop
bne ThisOneWon bne ThisOneWon
dex dex
bpl WhichTankWonLoop bpl WhichTankWonLoop
;error here!!! ;error was here!!!
;stop
; somehow I believed program will be never here ; somehow I believed program will be never here
; but it was a bad assumption ; but it was a bad assumption
; god knows when there is such a situation ; god knows when there is such a situation
@@ -354,7 +354,6 @@ WhichTankWonLoop
; second tank explodes and kills the first one. ; second tank explodes and kills the first one.
; and code lands here... ; and code lands here...
; looks like no one won! ; looks like no one won!
rts rts
ThisOneWon ThisOneWon
@@ -376,7 +375,6 @@ DoNotFinishTheRound
jsr DisplaySeppuku jsr DisplaySeppuku
jmp Seppuku jmp Seppuku
;ldx TankNr
@ @
ldx TankSequencePointer ldx TankSequencePointer
lda TankSequence,x lda TankSequence,x
@@ -398,8 +396,16 @@ RoboTanks
; robotanks shoot here ; robotanks shoot here
jsr ArtificialIntelligence jsr ArtificialIntelligence
jsr MoveBarrelToNewPosition jsr MoveBarrelToNewPosition
jsr StatusDisplay ;all digital values like force, angle, wind, etc. jsr DisplayStatus ;all digital values like force, angle, wind, etc.
jsr PutTankNameOnScreen jsr PutTankNameOnScreen
lda kbcode
cmp #28 ; ESC
bne @+
jsr AreYouSure
lda escFlag
seq:rts
@
; let's move the tank's barrel so it points the right ; let's move the tank's barrel so it points the right
; direction ; direction
jmp AfterManualShooting jmp AfterManualShooting
@@ -408,12 +414,14 @@ ManualShooting
jsr WaitForKeyRelease jsr WaitForKeyRelease
jsr BeforeFire jsr BeforeFire
lda escFlag
seq:rts
AfterManualShooting AfterManualShooting
inc noDeathCounter inc noDeathCounter
jsr DecreaseWeaponBeforeShoot jsr DecreaseWeaponBeforeShoot
jsr StatusDisplay jsr DisplayStatus
ldx TankNr ldx TankNr
dec Energy,x ; lower energy to eventually let tanks commit suicide dec Energy,x ; lower energy to eventually let tanks commit suicide
@@ -437,6 +445,7 @@ continueMainRoundLoopAfterSeppuku
AfterExplode AfterExplode
; TODO: IS IT OK??? possibly a fix here needed for #56
ldy WeaponDepleted ldy WeaponDepleted
bne @+ bne @+
ldx TankNr ldx TankNr
@@ -474,11 +483,8 @@ missed
jsr DisplayOffensiveTextNr jsr DisplayOffensiveTextNr
NextPlayerShoots NextPlayerShoots
;mva #1 Erase ;before it shoots, the eXistenZ table must be updated
;jsr drawtanks ;accordingly to actual energy (was forgotten, sorry to ourselves)
;before it shoots, the eXistenZ table must be
;updated accordingly to actual energy (was forgotten, sorry to ourselves)
ldx #(MaxPlayers-1) ldx #(MaxPlayers-1)
SeteXistenZ SeteXistenZ
@@ -489,7 +495,7 @@ SeteXistenZ
;DATA L1,L2 ;DATA L1,L2
;Multiplication 8bit*8bit, ;Multiplication 8bit*8bit,
;result 16bit ;result 16bit
;this algiorithm is a little longer than in Ruszczyc 6502 book ;this algiorithm is a little longer than one in Ruszczyc 6502 book
;but it is faster ;but it is faster
LDy #8 LDy #8
@@ -514,13 +520,6 @@ B0 DEY
;was setup of maximum energy for players ;was setup of maximum energy for players
;mva #0 Erase
;jsr drawtanks
inc:lda TankSequencePointer
cmp NumberOfPlayers
bne PlayersAgain
mva #0 TankSequencePointer
PlayersAgain PlayersAgain
@@ -552,27 +551,14 @@ NoPlayerNoDeath
dex dex
bpl CheckingPlayersDeath bpl CheckingPlayersDeath
; if processor is here it means there are no more explosions ; if processor is here it means there are no more explosions
inc:lda TankSequencePointer
cmp NumberOfPlayers
sne:mva #0 TankSequencePointer
jmp MainRoundLoop jmp MainRoundLoop
.endp .endp
;---------------------------------
.proc Seppuku
lda #0
sta FallDown1
sta FallDown2
sta ydraw+1
; get position of the tank
ldx TankNr
lda xtankstableL,x
sta xdraw
lda xtankstableH,x
sta xdraw+1
lda yTanksTable,x
sta ydraw
lda #1 ; Missile
jsr ExplosionDirect
jmp MainRoundLoop.continueMainRoundLoopAfterSeppuku
.endp
;--------------------------------- ;---------------------------------
.proc PlayerXdeath .proc PlayerXdeath
@@ -605,8 +591,13 @@ NoPlayerNoDeath
ldy TankTempY ldy TankTempY
mva #1 plot4x4color mva #1 plot4x4color
jsr DisplayOffensiveTextNr jsr DisplayOffensiveTextNr
; tank flash
ldy TankTempY
mva TankNr temp2 ; not elegant, and probably unnecessary
sty TankNr
jsr FlashTank ; blinking and pausing (like PAUSE 72 - 18x(2+2) )
mva temp2 TankNr
PAUSE 75
;Deffensive text cleanup ;Deffensive text cleanup
;here we clear Deffensive text (after a shoot) ;here we clear Deffensive text (after a shoot)
ldy TankTempY ldy TankTempY
@@ -627,7 +618,7 @@ NoPlayerNoDeath
sbc #4 sbc #4
sta ydraw sta ydraw
lda #0 lda #0
sta ydraw+1 ; there is 0 left in A, so... TODO: bad code above. revisit when transitioning ydraw to byte sta ydraw+1 ; there is 0 left in A, so... TODO: bad code above. revisit
;cleanup of the soil fall down ranges (left and right) ;cleanup of the soil fall down ranges (left and right)
sta RangeRight sta RangeRight
@@ -636,12 +627,9 @@ NoPlayerNoDeath
sta FallDown2 sta FallDown2
mwa #screenwidth RangeLeft mwa #screenwidth RangeLeft
; We are randomizing the weapon now. ; We are randomizing the weapon now.
; jumping into the middle of the explosion ; jumping into the middle of the explosion
; routine ; routine
MetodOfDeath MetodOfDeath
lda random lda random
and #%00011111 ; range 0-31 and #%00011111 ; range 0-31
@@ -652,13 +640,10 @@ MetodOfDeath
jsr ExplosionDirect jsr ExplosionDirect
mva #sfx_silencer sfx_effect mva #sfx_silencer sfx_effect
; jump to after explosion routines (soil fallout, etc.) ; jump to after explosion routines (soil fallout, etc.)
; After going through these routines we are back ; After going through these routines we are back
; to checking if a tank exploded and maybe we have ; to checking if a tank exploded and maybe we have
; a deadly shot here again. ; a deadly shot here again.
jmp MainRoundLoop.AfterExplode jmp MainRoundLoop.AfterExplode
.endp .endp
@@ -702,20 +687,52 @@ NotNegativeEnergy
rts rts
.endp .endp
;---------------------------------
.proc Seppuku
lda #0
sta FallDown1
sta FallDown2
sta ydraw+1
; get position of the tank
ldx TankNr
lda xtankstableL,x
sta xdraw
lda xtankstableH,x
sta xdraw+1
lda yTanksTable,x
sta ydraw
lda #1 ; Missile
jsr ExplosionDirect
jmp MainRoundLoop.continueMainRoundLoopAfterSeppuku
.endp
;-------------------------------------------------- ;--------------------------------------------------
GetRandomWind .proc GetRandomWind .proc
;in: MaxWind (byte)
;out: Wind (word)
;uses: _
;-------------------------------------------------- ;--------------------------------------------------
lda random lda random
cmp MaxWind cmp MaxWind
bcs GetRandomWind ; if more than MaxWind then randomize again bcs GetRandomWind ; if more than MaxWind then randomize again
sta Wind sta Wind
mva #$00 Wind+1 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 :4 aslw Wind
; decide the direction
lda random lda random
and #$01 and #$01
sta WindOrientation beq @+
rts sec ; Wind = -Wind
.rept 4
lda #$00
sbc Wind+#
sta Wind+#
.endr
@ rts
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
@@ -733,34 +750,28 @@ PMoutofScreen .proc
;-------------------------------------------------- ;--------------------------------------------------
ldx #$3f ldx #$3f
lda #$0 lda #$0
loop05 @
sta TanksWeapon1,x sta TanksWeapon1,x
sta TanksWeapon2,x sta TanksWeapon2,x
sta TanksWeapon3,x sta TanksWeapon3,x
sta TanksWeapon4,x sta TanksWeapon4,x
sta TanksWeapon5,x sta TanksWeapon5,x
sta TanksWeapon6,x sta TanksWeapon6,x
dex dex
bne @+ sne:lda #99
lda #99 bpl @-
bne loop05
@ bpl loop05
rts rts
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
.proc Initialize .proc Initialize
;Initialization sequence ;Initialization sequence
;uses: temp, ...
;-------------------------------------------------- ;--------------------------------------------------
deletePtr = temp deletePtr = temp
lda #0
sta Erase
sta tracerflag
sta GameIsOver
sta escFlag
; clean variables ; clean variables
lda #0
tay tay
mwa #variablesStart deletePtr mwa #variablesStart deletePtr
@ tya @ tya
@@ -1168,7 +1179,8 @@ nextishigher
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
.proc getkey ; waits for pressing a key and returns pressed value in A .proc GetKey ; waits for pressing a key and returns pressed value in A
; when [ESC] is pressed, escFlag is set to 1
;-------------------------------------------------- ;--------------------------------------------------
jsr WaitForKeyRelease jsr WaitForKeyRelease
@ @
BIN
View File
Binary file not shown.
+107 -58
View File
@@ -218,6 +218,8 @@ OptionsYLoop
ManualPurchase ManualPurchase
jsr Purchase jsr Purchase
ldx escFlag
seq:rts
AfterManualPurchase AfterManualPurchase
inc:lda TankNr inc:lda TankNr
@@ -556,6 +558,8 @@ ChoosingItemForPurchase
;-------------------------------------------------- ;--------------------------------------------------
jsr PutLitteChar ; Places pointer at the right position jsr PutLitteChar ; Places pointer at the right position
jsr getkey jsr getkey
ldx escFlag
seq:rts
cmp #$2c ; Tab cmp #$2c ; Tab
jeq ListChange jeq ListChange
cmp #$0c ; Return cmp #$0c ; Return
@@ -838,7 +842,7 @@ NoArrowDown
sta colpf2s ; set color of player name line sta colpf2s ; set color of player name line
jsr EnterPlayerName jsr EnterPlayerName
lda escFlag lda escFlag
jne START seq:rts
inc TankNr inc TankNr
lda TankNr lda TankNr
cmp NumberOfPlayers cmp NumberOfPlayers
@@ -1342,11 +1346,9 @@ DOTNcharloop
ldy #0 ldy #0
sty LineCharNr sty LineCharNr
TypeLine4x4Loop TypeLine4x4Loop
ldy LineCharNr ldy LineCharNr
mwa LineAddress4x4 temp mwa LineAddress4x4 temp
lda (temp),y lda (temp),y
cmp #$ff cmp #$ff
@@ -1366,6 +1368,63 @@ EndOfTypeLine4x4
.endp .endp
;--------------------------------
.proc AreYouSure
;using 4x4 font
;save vars (messed in TypeLine4x4)
mwa Xdraw xk
mva Ydraw yc
mva #4 ResultY ; where seppuku text starts Y-wise on the screen
;top frame
mva ResultY LineYdraw
jsr TL4x4_top
adb ResultY #4 ;next line
;seppuku
mwa #areYouSureText LineAddress4x4
mwa #((ScreenWidth/2)-(8*4)) LineXdraw ; centering
mva ResultY LineYdraw
jsr TypeLine4x4
adb ResultY #4 ;next line
;bottom frame
mva ResultY LineYdraw
jsr TL4x4_bottom
jsr GetKey
cmp #$2b ; "Y"
bne @+
mva #1 escFlag
bne skip01
@ mva #0 escFlag
jsr WaitForKeyRelease
skip01
;clean
mva #3 dx
mva #4 ResultY
@
mva #1 plot4x4color
mwa #lineClear LineAddress4x4
mwa #((ScreenWidth/2)-(8*4)) LineXdraw ; centering
mva ResultY LineYdraw
jsr TypeLine4x4
adb ResultY #4 ;next line
dec dx
bne @-
quit_areyousure
;restore vars
mva yc Ydraw
mwa xk Xdraw
rts
.endp
;-------------------------------- ;--------------------------------
.proc DisplaySeppuku .proc DisplaySeppuku
;using 4x4 font ;using 4x4 font
@@ -1383,10 +1442,8 @@ seppuku_loop
mva #4 ResultY ; where seppuku text starts Y-wise on the screen mva #4 ResultY ; where seppuku text starts Y-wise on the screen
;top frame ;top frame
mwa #LineTop LineAddress4x4
mwa #((ScreenWidth/2)-(8*4)) LineXdraw ; centering
mva ResultY LineYdraw mva ResultY LineYdraw
jsr TypeLine4x4 jsr TL4x4_top
adb ResultY #4 ;next line adb ResultY #4 ;next line
;seppuku ;seppuku
@@ -1397,17 +1454,14 @@ seppuku_loop
adb ResultY #4 ;next line adb ResultY #4 ;next line
;bottom frame ;bottom frame
mwa #LineBottom LineAddress4x4
mwa #((ScreenWidth/2)-(8*4)) LineXdraw ; centering
mva ResultY LineYdraw mva ResultY LineYdraw
jsr TypeLine4x4 jsr TL4x4_bottom ; just go
;clean seppuku ;clean seppuku
mva #3 dx mva #3 dx
mva #4 ResultY mva #4 ResultY
@ @
mva #1 plot4x4color
mwa #lineClear LineAddress4x4 mwa #lineClear LineAddress4x4
mwa #((ScreenWidth/2)-(8*4)) LineXdraw ; centering mwa #((ScreenWidth/2)-(8*4)) LineXdraw ; centering
mva ResultY LineYdraw mva ResultY LineYdraw
@@ -1432,18 +1486,15 @@ quit_seppuku
;using 4x4 font ;using 4x4 font
mva #sfx_smoke_cloud sfx_effect mva #sfx_smoke_cloud sfx_effect
mva #1 plot4x4color
;centering the result screen ;centering the result screen
mwa #((ScreenWidth/2)-(8*4)) ResultX
mva #((ScreenHeight/2)-(8*4)) ResultY mva #((ScreenHeight/2)-(8*4)) ResultY
;upper frame ;upper frame
mwa #LineTop LineAddress4x4
mwa ResultX LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color jsr TL4x4_top
jsr TypeLine4x4
adb ResultY #4 ;next line adb ResultY #4 ;next line
@@ -1458,17 +1509,15 @@ quit_seppuku
jsr displaybyte ;decimal (byte), displayposition (word) jsr displaybyte ;decimal (byte), displayposition (word)
mwa #LineHeader1 LineAddress4x4 mwa #LineHeader1 LineAddress4x4
mwa ResultX LineXdraw mwa #((ScreenWidth/2)-(8*4)) LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color
jsr TypeLine4x4 jsr TypeLine4x4
beq @+ ;unconditional jump, because TypeLine4x4 ends with beq beq @+ ;unconditional jump, because TypeLine4x4 ends with beq
GameOver4x4 GameOver4x4
mwa #LineGameOver LineAddress4x4 mwa #LineGameOver LineAddress4x4
mwa ResultX LineXdraw mwa #((ScreenWidth/2)-(8*4)) LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color
jsr TypeLine4x4 jsr TypeLine4x4
mva #1 GameIsOver mva #1 GameIsOver
@@ -1476,30 +1525,23 @@ GameOver4x4
adb ResultY #4 ;next line adb ResultY #4 ;next line
;Empty line ;Empty line
mwa #LineEmpty LineAddress4x4
mwa ResultX LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color jsr TL4x4_empty
jsr TypeLine4x4
adb ResultY #2 ;next line adb ResultY #2 ;next line
;Header2 ;Header2
mwa #LineHeader2 LineAddress4x4 mwa #LineHeader2 LineAddress4x4
mwa ResultX LineXdraw mwa #((ScreenWidth/2)-(8*4)) LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color
jsr TypeLine4x4 jsr TypeLine4x4
adb ResultY #4 ;next line adb ResultY #4 ;next line
;Empty line ;Empty line
mwa #LineEmpty LineAddress4x4
mwa ResultX LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color jsr TL4x4_empty
jsr TypeLine4x4
sbb ResultY #2 ;next line (was empty) sbb ResultY #2 ;next line (was empty)
@@ -1564,24 +1606,17 @@ TankNameCopyLoop
;result line display ;result line display
mwa #ResultLineBuffer LineAddress4x4 mwa #ResultLineBuffer LineAddress4x4
mwa ResultX LineXdraw mwa #((ScreenWidth/2)-(8*4)) LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color
jsr TypeLine4x4 jsr TypeLine4x4
adb ResultY #4 ;next line adb ResultY #4 ;next line
;Empty line ;Empty line
mwa #LineEmpty LineAddress4x4
mwa ResultX LineXdraw
mva ResultY LineYdraw mva ResultY LineYdraw
mva #1 plot4x4color jsr TL4x4_empty
jsr TypeLine4x4
dec ResultOfTankNr dec ResultOfTankNr
bmi FinishResultDisplay bmi FinishResultDisplay
sbb ResultY #2 ;distance between lines is smaller sbb ResultY #2 ;distance between lines is smaller
@@ -1589,25 +1624,35 @@ TankNameCopyLoop
jmp ResultOfTheNextPlayer jmp ResultOfTheNextPlayer
FinishResultDisplay FinishResultDisplay
mva ResultY LineYdraw
;jmp TL4x4_bottom ; just go
.endp
.proc TL4x4_bottom
;bottom of the frame ;bottom of the frame
mwa #LineBottom LineAddress4x4 mwa #LineBottom LineAddress4x4
mwa ResultX LineXdraw mwa #((ScreenWidth/2)-(8*4)) LineXdraw
mva ResultY LineYdraw jmp TypeLine4x4 ; jsr:rts
mva #1 plot4x4color .endp
jsr TypeLine4x4
rts .proc TL4x4_top
;bottom of the frame
mwa #LineTop LineAddress4x4
mwa #((ScreenWidth/2)-(8*4)) LineXdraw
jmp TypeLine4x4 ; jsr:rts
.endp
.proc TL4x4_empty
;empty frame
mwa #LineEmpty LineAddress4x4
mwa #((ScreenWidth/2)-(8*4)) LineXdraw
jmp TypeLine4x4 ; jsr:rts
.endp .endp
;------------------------------------------------- ;-------------------------------------------------
.proc StatusDisplay .proc DisplayStatus
;------------------------------------------------- ;-------------------------------------------------
;lda noDeathCounter
;sta decimal
;mwa #textbuffer+80+37 displayposition
;jsr displaybyte
;--------------------- ;---------------------
;displaying symbol of the weapon ;displaying symbol of the weapon
;--------------------- ;---------------------
@@ -1711,35 +1756,39 @@ AngleDisplay
mwa #textbuffer+40+21 displayposition mwa #textbuffer+40+21 displayposition
jsr displaybyte jsr displaybyte
;========================= ;=========================
;display Wind ;display Wind
;========================= ;=========================
lda WindOrientation mwa Wind temp
bne DisplayLeftWind lda Wind+3 ; highest byte of 4 byte wind
bmi DisplayLeftWind
lda #$7f ; (tab) char lda #$7f ; (tab) char
sta textbuffer+80+28 sta textbuffer+80+28
lda #0 ;space lda #0 ;space
sta textbuffer+80+25 sta textbuffer+80+25
beq DisplayWindValue beq DisplayWindValue
DisplayLeftWind DisplayLeftWind
sec ; Wind = -Wind
lda #$00
sbc temp
sta temp
lda #$00
sbc temp+1
sta temp+1
lda #$7e ;(del) char lda #$7e ;(del) char
sta textbuffer+80+25 sta textbuffer+80+25
lda #0 ;space lda #0 ;space
sta textbuffer+80+28 sta textbuffer+80+28
DisplayWindValue DisplayWindValue
mwa Wind temp :4 lsrw temp ;divide by 16 to have a nice value on a screen
lsrw temp ;divide by 16 to have
lsrw temp ;a nice view on a screen
lsrw temp
lsrw temp
lda temp lda temp
sta decimal sta decimal
mwa #textbuffer+80+26 displayposition mwa #textbuffer+80+26 displayposition
jsr displaybyte jsr displaybyte
;=========================
;display round number ;display round number
;=========================
lda CurrentRoundNr lda CurrentRoundNr
sta decimal sta decimal
mwa #textbuffer+80+14 displayposition mwa #textbuffer+80+14 displayposition
+54 -50
View File
@@ -8,35 +8,30 @@
; compilation to e.g. cartridge ; compilation to e.g. cartridge
; zero page variables are declared in program.s65 module ; zero page variables are declared in program.s65 module
;===================================================== ;=====================================================
;--------------------------------------------------
;Variables
;--------------
TanksNames ; DO NOT ZERO - ticket #24 TanksNames ; DO NOT ZERO - ticket #24
:6 dta d" " :6 dta d" "
;---------------------------- ;----------------------------------------------------
;Options DO NOT ZERO - ticket #27 ;Options DO NOT ZERO - ticket #27
OptionsTable .by 0,0,2,2,0,1,3 OptionsTable .by 0,0,2,2,0,1,3
RoundsInTheGame .by 10 ;how many rounds in the current game RoundsInTheGame .by 10 ;how many rounds in the current game
seppukuVal .by 75 seppukuVal .by 75
;-------------------------------------------------- ;----------------------------------------------------
skilltable ; computer controlled players' skills (1-8), 0 - human (no cleaning, ticket #30) skilltable ; computer controlled players' skills (1-8), 0 - human (no cleaning, ticket #30)
.DS [MaxPlayers] .DS [MaxPlayers]
;----------------------------------- ;----------------------------------------------------
; 4x4 text buffer ; 4x4 text buffer
ResultLineBuffer ResultLineBuffer
dta d" " dta d" ", $ff
.byte $ff
LineHeader1 LineHeader1
dta d"# ROUND: " dta d"# ROUND: "
RoundNrDisplay RoundNrDisplay
dta d" #" dta d" #", $ff
.byte $ff
;=====================================================
variablesStart ; zeroing starts here variablesStart ; zeroing starts here
;=====================================================
drawFunction .ds 1 ; 0 - plot, %10000000 - LineLength (N), %01000000 - DrawCheck (V) drawFunction .ds 1 ; 0 - plot, %10000000 - LineLength (N), %01000000 - DrawCheck (V)
;-------------- ;--------------
escFlag .ds 1
;--------------
sfx_effect .ds 1 sfx_effect .ds 1
;-------------- ;--------------
noDeathCounter .ds 1 noDeathCounter .ds 1
@@ -47,28 +42,28 @@ flyDelay .ds 1
NumberOfPlayers .DS 1 ;current number of players (counted from 1) NumberOfPlayers .DS 1 ;current number of players (counted from 1)
TankSequence .DS [MaxPlayers] ;sequence of shooting during the Round TankSequence .DS [MaxPlayers] ;sequence of shooting during the Round
GameIsOver .DS 1 ; 1 means it was the last round in the game GameIsOver .DS 1 ; 1 means it was the last round in the game
;----------------------------------- ;----------------------------------------------------
moneyH ;we place zero at the end of prices and money moneyH ;we place zero at the end of prices and money
;and have range from 0 to 99990 (not too much) ;and have range from 0 to 99990 (not too much)
;money players have (maybe one more byte is needed?) ;money players have (maybe one more byte is needed?)
.DS [MaxPlayers] .DS [MaxPlayers]
moneyL moneyL
.DS [MaxPlayers] .DS [MaxPlayers]
;----------------------------------- ;----------------------------------------------------
gainH ;how much money player gets after the round gainH ;how much money player gets after the round
;it is gathered during the round basing on energy ;it is gathered during the round basing on energy
;opponents loose after player's shoots ;opponents loose after player's shoots
.DS [MaxPlayers] .DS [MaxPlayers]
gainL gainL
.DS [MaxPlayers] .DS [MaxPlayers]
;----------------------------------- ;----------------------------------------------------
looseH ;how much player looses after the round looseH ;how much player looses after the round
;calculated from REAL energy loss ;calculated from REAL energy loss
;(not only to zero energy) ;(not only to zero energy)
.DS [MaxPlayers] .DS [MaxPlayers]
looseL looseL
.DS [MaxPlayers] .DS [MaxPlayers]
;----------------------------------- ;----------------------------------------------------
Energy Energy
.DS [MaxPlayers] .DS [MaxPlayers]
EnergyDecrease .DS 1 EnergyDecrease .DS 1
@@ -81,9 +76,7 @@ ResultsTable ;the results in the gameeeeee
.DS [MaxPlayers] .DS [MaxPlayers]
TempResults TempResults
.DS [MaxPlayers] .DS [MaxPlayers]
CurrentResult ;----------------------------------------------------
.DS 1
;-----------------------------------
ForceTableL ;shooting Force of the tank during the round ForceTableL ;shooting Force of the tank during the round
.DS [MaxPlayers] .DS [MaxPlayers]
ForceTableH ForceTableH
@@ -93,35 +86,36 @@ MaxForceTableL ;Energy of the tank during the round
.DS [MaxPlayers] ;1000 is the default .DS [MaxPlayers] ;1000 is the default
MaxForceTableH MaxForceTableH
.DS [MaxPlayers] .DS [MaxPlayers]
;----------------------------------- ;----------------------------------------------------
AngleTable ;Angle of the barrel of each tank during the round AngleTable ;Angle of the barrel of each tank during the round
.DS [MaxPlayers] .DS [MaxPlayers]
NewAngle .DS 1 NewAngle .DS 1
;----------------------------------- ;----------------------------------------------------
ActiveWeapon ;number of the selected weapon ActiveWeapon ;number of the selected weapon
.DS [MaxPlayers] .DS [MaxPlayers]
WeaponDepleted .DS 1 ; if 0 deactivate the weapon and switch to Baby Missile WeaponDepleted .DS 1 ; if 0 deactivate the weapon and switch to Baby Missile
;----------------------------------- ;----------------------------------------------------
;format of the 3-byte static point number used in the game ;format of the 3-byte static point number used in the game
; 20203.5 => 128 : <20203 : >20203 ; 20203.5 => 128 : <20203 : >20203
;----------------------------------- ;----------------------------------------------------
L1 .DS 1 ; variable used in multiplications (by 10:) L1 .DS 1 ; variable used in multiplications (by 10:)
gravity .DS 1 ;only the decimal part (1/10 = 25) gravity .DS 1 ;only the decimal part (1/10 = 25)
;----------------------------------- ;----------------------------------------------------
Wind .ds 2 ;walue displayed on the screen Wind .ds 4 ;format: 0000.hhll
;multiplied by 16 (decimal part only) ;walue displayed on the screen is
;----------------------------------- ;decimal portion divided by 16 (>>4)
;----------------------------------------------------
MaxWind .ds 1 ; MaxWind .ds 1 ;
WindOrientation .DS 1 ;(0-right,1-left) WindOrientation .DS 1 ;(0-right,1-left)
;----------------------------------- ;----------------------------------------------------
Counter .DS 1 ;temporary Counter for outside loops Counter .DS 1 ;temporary Counter for outside loops
HitFlag .DS 1 ;1 when missile hit anything HitFlag .DS 1 ;1 when missile hit anything
;----------------------------------- ;----------------------------------------------------
xtankstableL ;X positions of tanks (lower left point) xtankstableL ;X positions of tanks (lower left point)
.DS [MaxPlayers] .DS [MaxPlayers]
xtankstableH xtankstableH
@@ -130,17 +124,17 @@ ytankstable ;Y positions of tanks (lower left point)
.DS [MaxPlayers] .DS [MaxPlayers]
LowResDistances ; coarse tank positions divided by 4 (to be in just one byte) LowResDistances ; coarse tank positions divided by 4 (to be in just one byte)
.DS [MaxPlayers] .DS [MaxPlayers]
;----------------------------------- ;----------------------------------------------------
Erase .DS 1 ; if 1 only mask of the character is printed Erase .DS 1 ; if 1 only mask of the character is printed
; on the graphics screen. if 0 character is printed normally ; on the graphics screen. if 0 character is printed normally
;----------------------------------- ;----------------------------------------------------
RangeLeft .DS 2 ;range of the soil to be fallen down RangeLeft .DS 2 ;range of the soil to be fallen down
RangeRight .DS 2 ;it is being set by all Explosions RangeRight .DS 2 ;it is being set by all Explosions
;----------------------------------- ;----------------------------------------------------
WeaponRangeLeft .DS 2 ;Range of the Explosion of the given weapon WeaponRangeLeft .DS 2 ;Range of the Explosion of the given weapon
WeaponRangeRight .DS 2 WeaponRangeRight .DS 2
;-------------------------------------------------- ;----------------------------------------------------
;xroller ;xroller
HowMuchToFall .ds 1 HowMuchToFall .ds 1
HeightRol .DS 1 HeightRol .DS 1
@@ -173,14 +167,14 @@ LineLength .DS 2
;circle ;circle
radius .DS 1 radius .DS 1
xcircle .DS 2 xcircle .DS 2
ycircle .DS 1 ycircle .DS 2
tempcir .DS 2 tempcir .DS 2
;TankFalls ;TankFalls
IfFallDown .DS 1 IfFallDown .DS 1
PreviousFall .DS 1 PreviousFall .DS 1
EndOfTheFallFlag .DS 1 ; in case of the infinite fall EndOfTheFallFlag .DS 1 ; in case of the infinite fall
Parachute .DS 1 ; are you insured with parachute? Parachute .DS 1 ; are you insured with parachute?
; ------------------------------------------------- ;----------------------------------------------------
;Flight ;Flight
;variables for 5 missiles (used for mirv) ;variables for 5 missiles (used for mirv)
xtraj00 .DS [5] ; 3 bytes of xtraj times 5. Lowest byte xtraj00 .DS [5] ; 3 bytes of xtraj times 5. Lowest byte
@@ -193,7 +187,9 @@ vx03 .DS [5]
MirvDown .DS [5] ; is given missile down? MirvDown .DS [5] ; is given missile down?
MirvMissileCounter .DS 1 ; missile Counter (mainly for X) MirvMissileCounter .DS 1 ; missile Counter (mainly for X)
SmokeTracerFlag .DS 1 ; if Smoketracer SmokeTracerFlag .DS 1 ; if Smoketracer
; ------------------------------------------------- XposFlag .DS 1 ; bullet positon X (0 - on screen , %1000000 - off-screen)
YposFlag .DS 1 ; bullet positon Y (0 - on screen , %1000000 - over the screen , %0100000 - under the screen)
;----------------------------------------------------
;CheckCollisionWithTank ;CheckCollisionWithTank
vx .ds 4 ; 0,0,0,0 ;two decimal bytes, two whole bytes (DC.BA) vx .ds 4 ; 0,0,0,0 ;two decimal bytes, two whole bytes (DC.BA)
vy .ds 4 ;0,0,0,0 vy .ds 4 ;0,0,0,0
@@ -205,12 +201,11 @@ Angle .DS 1
Force .ds 3 ; 0,0,0 Force .ds 3 ; 0,0,0
Multiplier .ds 3 ; 0,0,0 Multiplier .ds 3 ; 0,0,0
Multiplee .ds 2 ; 0,0 Multiplee .ds 2 ; 0,0
Result .ds 3 ; 0,0,0
goleft .DS 1 ;if 1 then flights left goleft .DS 1 ;if 1 then flights left
;-------------------------------------------------- ;----------------------------------------------------
;SoilDown2 ;SoilDown2
IsEndOfTheFallFlag .DS 1 IsEndOfTheFallFlag .DS 1
; ------------------------------------------------- ;----------------------------------------------------
;unPlot ;unPlot
WhichUnPlot .DS 1 WhichUnPlot .DS 1
; max 5 concurrent unPlots ; max 5 concurrent unPlots
@@ -224,7 +219,7 @@ xtrajfb .DS 2
ytrajfb .DS 2 ytrajfb .DS 2
; ;
tracerflag .DS 1 tracerflag .DS 1
; ------------------------------------------------- ;----------------------------------------------------
;TypeChar ;TypeChar
mask1 .DS [8] mask1 .DS [8]
mask2 .DS [8] mask2 .DS [8]
@@ -242,7 +237,7 @@ UpNdown .DS 1
temptankX .DS 2 temptankX .DS 2
temptankNr .DS 1 temptankNr .DS 1
; ------------------------------------------------- ;----------------------------------------------------
;Variables from textproc.s65 ;Variables from textproc.s65
; tables with numbers of weapons on the right lists ; tables with numbers of weapons on the right lists
; to be honest - I do not know at the moment what the above ; to be honest - I do not know at the moment what the above
@@ -252,7 +247,7 @@ NubersOfWeaponsL1
.ds 8*5 ; :(8*5) .by $ff .ds 8*5 ; :(8*5) .by $ff
NubersOfWeaponsL2 NubersOfWeaponsL2
.ds 8*2 ; :(8*2) .by $ff .ds 8*2 ; :(8*2) .by $ff
; ------------------------------------------------- ;----------------------------------------------------
; variables storing amount of weapons on the first and second ; variables storing amount of weapons on the first and second
; list and pointer position ; list and pointer position
@@ -275,14 +270,14 @@ WhichList ; list currently on the screen
OffsetDL1 ; offset of the list screen (how many lines).... OffsetDL1 ; offset of the list screen (how many lines)....
.DS 1 .DS 1
; ------------------------------------------------- ;----------------------------------------------------
;mark the level ;mark the level
PositionInName ; cursor position in name of the player when name input PositionInName ; cursor position in name of the player when name input
.DS 1 .DS 1
DifficultyLevel ; Difficulty Level (human/cpu) DifficultyLevel ; Difficulty Level (human/cpu)
.DS 1 .DS 1
;------------------------------------------------- ;----------------------------------------------------
;displaydecimal ;displaydecimal
decimal .DS 2 decimal .DS 2
decimalresult .DS 4 decimalresult .DS 4
@@ -297,7 +292,7 @@ FallDown2 .DS 1
LeapFrogAngle .DS 1 LeapFrogAngle .DS 1
;laser ;laser
LaserCoordinate .DS 8 ; 2,2,2,2 LaserCoordinate .DS 8 ; 2,2,2,2
; ------------------------------------------------- ;----------------------------------------------------
; Here go tables with weapons possesed by a given tank ; Here go tables with weapons possesed by a given tank
; Index in the table means weapon type ; Index in the table means weapon type
; number entered means ammo for given weapon possessed (max 99) ; number entered means ammo for given weapon possessed (max 99)
@@ -324,7 +319,7 @@ mountaintable2 ;table of mountains (size=screenwidth)
.DS [screenwidth] .DS [screenwidth]
.DS 1 ; additional byte for fallout (sometimes 1 pixel) .DS 1 ; additional byte for fallout (sometimes 1 pixel)
MountaintableEnd ;good for table clearing MountaintableEnd ;good for table clearing
;---------------------------------------------- ;----------------------------------------------------
TextPositionX .DS 2 TextPositionX .DS 2
TextPositionY .DS 1 TextPositionY .DS 1
TextAddress .DS 2 TextAddress .DS 2
@@ -333,8 +328,16 @@ TextNumberOff .DS 1
;-------------- ;--------------
TankTempY TankTempY
.DS 1 .DS 1
;----------------------------------------------------
;-------------- single round variables -------------- ;-------------- single round variables --------------
;----------------------------------------------------
singleRoundVars singleRoundVars
;--------------
escFlag .ds 1
;--------------
CurrentResult
.DS 1
;--------------
previousAngle previousAngle
.DS [MaxPlayers] .DS [MaxPlayers]
previousEnergyL previousEnergyL
@@ -352,9 +355,9 @@ RandBoundaryHigh
AngleTablePointer AngleTablePointer
.DS 1 .DS 1
singleRoundVarsEnd singleRoundVarsEnd
;---------------------------------------------- ;----------------------------------------------------
; 4x4 texts ; 4x4 texts
;---------------------------------------------- ;----------------------------------------------------
LineAddress4x4 LineAddress4x4
.DS 2 .DS 2
LineCharNr LineCharNr
@@ -372,8 +375,9 @@ ResultY
ResultOfTankNr ResultOfTankNr
.DS 1 .DS 1
;---------------------------- ;----------------------------------------------------
;PutChar4x4 ;PutChar4x4
;----------------------------------------------------
LoopCounter4x4 .DS 1 LoopCounter4x4 .DS 1
y4x4 .DS 1 y4x4 .DS 1
StoreA4x4 .DS 1 StoreA4x4 .DS 1
@@ -385,6 +389,6 @@ plot4x4color .DS 1 ;1-white, 0-background
variablesEnd variablesEnd
;---------------------------- ;----------------------------------------------------
.endif .endif
+202 -260
View File
@@ -262,7 +262,7 @@ NoExplosionInFunkyBomb
mva #sfx_nuke sfx_effect mva #sfx_nuke sfx_effect
jsr xmissile jsr xmissile
NoUpperCircle NoUpperCircle
adb ydraw #70 adw ydraw #70
;jsr CalculateExplosionRange ;jsr CalculateExplosionRange
cpw ydraw #screenHeight cpw ydraw #screenHeight
bcs NoLowerCircle bcs NoLowerCircle
@@ -529,21 +529,25 @@ DiggerCharacter
.endp .endp
; ------------------------ ; ------------------------
.proc laser .proc laser
; but where are xdraw and ydraw ???? !!!!
; ------------------------
ldx TankNr ldx TankNr
lda AngleTable,x lda AngleTable,x
tay tay
clc clc
lda xtankstableL,x lda xtankstableL,x
adc EndOfTheBarrelX,y ; correction of the end of the barrel point adc EndOfTheBarrelX,y ; correction of the end of the barrel point (X)
sta xbyte sta xbyte
lda xtankstableH,x lda xtankstableH,x
adc #0 adc #0
sta xbyte+1 sta xbyte+1
sec sec
lda ytankstable,x lda ytankstable,x
sbc EndOfTheBarrelY,y sbc EndOfTheBarrelY,y ; correction of the end of the barrel point (Y)
sta ybyte sta ybyte
mva #0 ybyte+1 lda #$00
sbc #$00
sta ybyte+1
mva #0 drawFunction mva #0 drawFunction
mwa xdraw LaserCoordinate mwa xdraw LaserCoordinate
mwa ydraw LaserCoordinate+2 mwa ydraw LaserCoordinate+2
@@ -677,9 +681,9 @@ EndOfDistanceCheckLoop
sta color sta color
dirtLoop dirtLoop
jsr circle jsr circle
inc ydraw inw ydraw
jsr circle jsr circle
dec ydraw .nowarn dew ydraw
inc radius inc radius
lda radius lda radius
cmp ExplosionRadius cmp ExplosionRadius
@@ -725,6 +729,7 @@ RollinContinues
ldy #0 ldy #0
lda (tempXROLLER),y lda (tempXROLLER),y
sta ydraw sta ydraw
sty ydraw+1
beq ExplodeNow beq ExplodeNow
cmp HeightRol cmp HeightRol
beq UpNotYet beq UpNotYet
@@ -737,8 +742,6 @@ UpNotYet
;check tank collision prior to PLOT ;check tank collision prior to PLOT
sty HitFlag sty HitFlag
mwa xdraw xtraj+1
mwa ydraw ytraj+1
jsr CheckCollisionWithTank jsr CheckCollisionWithTank
lda HitFlag lda HitFlag
@@ -760,12 +763,12 @@ HowMuchToFallRight2
jne RollinContinues jne RollinContinues
ExplodeNow ExplodeNow
mwa xdraw xcircle ; we must store somewhere (BAD) mwa xdraw xcircle ; we must store somewhere (BAD)
mva ydraw ycircle ; xdraw and ydraw (BAD) mwa ydraw ycircle ; xdraw and ydraw (BAD)
mwa #0 xdraw mwa #0 xdraw
mva #screenheight-1 ydraw mwa #screenheight-1 ydraw
jsr unPlot jsr unPlot
mwa xcircle xdraw ;(bad) mwa xcircle xdraw ;(bad)
mva ycircle ydraw ;(bad) mwa ycircle ydraw ;(bad)
; finally a little explosion ; finally a little explosion
jsr CalculateExplosionRange jsr CalculateExplosionRange
@@ -782,6 +785,7 @@ ExplodeNow
adw tempXROLLER xdraw adw tempXROLLER xdraw
lda (tempXROLLER),y lda (tempXROLLER),y
sta ydraw sta ydraw
sty ydraw+1
lda vx+3 lda vx+3
; if horizontal velocity is negative then change the direction ; if horizontal velocity is negative then change the direction
@@ -852,7 +856,7 @@ DirectionChecked
mva #1 color mva #1 color
NoColor ; jump here with color=0 to clean dirt NoColor ; jump here with color=0 to clean dirt
mwa xdraw xcircle mwa xdraw xcircle
mva ydraw ycircle mwa ydraw ycircle
lda #1 lda #1
; current dirt width ; current dirt width
sta magic sta magic
@@ -890,14 +894,14 @@ DoNotPlot
bne NextRow bne NextRow
EndOfTheDirt EndOfTheDirt
mwa xcircle xdraw mwa xcircle xdraw
mva ycircle ydraw mwa ycircle ydraw
rts rts
.endp .endp
; ---------------- ; ----------------
.proc xliquiddirt ; .proc xliquiddirt ;
mva xdraw TempXfill mwa xdraw TempXfill
RepeatFill RepeatFill
mva TempXfill xdraw mwa TempXfill xdraw
jsr checkRollDirection jsr checkRollDirection
; HowMuchToFall - direction ; HowMuchToFall - direction
; $FF - we are in a hole (flying in missile direction) ; $FF - we are in a hole (flying in missile direction)
@@ -987,7 +991,7 @@ ContinueToCheckMaxForce2
lda MaxForceTableL,x lda MaxForceTableL,x
sta ForceTableL,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 PutTankNameOnScreen
jsr DrawTankNr jsr DrawTankNr
@@ -1012,7 +1016,17 @@ notpressed
beq checkJoy beq checkJoy
lda kbcode lda kbcode
and #$Bf and #%10111111 ; SHIFT elimination
cmp #28 ; ESC
bne @+
jsr AreYouSure
lda escFlag
beq notpressed
;---esc pressed-quit game---
rts
@
cmp #$8e cmp #$8e
jeq CTRLPressedUp jeq CTRLPressedUp
cmp #$8f cmp #$8f
@@ -1100,9 +1114,9 @@ pressedDown
dec ForceTableH,x dec ForceTableH,x
bpl @+ bpl @+
ForceGoesZero ForceGoesZero
lda #0 lda #0
sta ForceTableH,x sta ForceTableH,x
sta ForceTableL,x sta ForceTableL,x
@ @
jmp BeforeFire jmp BeforeFire
@@ -1235,33 +1249,24 @@ AfterStrongShoot
mva #sfx_shoot sfx_effect mva #sfx_shoot sfx_effect
; Shoots tank nr X !!! :) ; Shoots tank nr X !!! :)
;ldx TankNr ; set the starting coordinates of bullet with correction
lda xtankstableL,x
sta xtraj+1
lda xtankstableH,x
sta xtraj+2
lda ytankstable,x
sta ytraj+1
lda #$00
sta ytraj+2
; correction of the starting coordinates of bullet
; to start where the tank's barrel ends ; to start where the tank's barrel ends
; (without it bullet would go from the left lower corner of the tank) ; (without it bullet would go from the left lower corner of the tank)
ldy Angle ;ldx TankNr
clc ldy Angle
lda xtraj+1 clc
adc EndOfTheBarrelX,y ; correction of X lda xtankstableL,x
adc EndOfTheBarrelX,y ; correction of X
sta xtraj+1 sta xtraj+1
lda xtraj+2 lda xtankstableH,x
adc #0 adc #$00
sta xtraj+2 sta xtraj+2
sec sec
lda ytraj+1 lda ytankstable,x
sbc EndOfTheBarrelY,y ; correction of Y sbc EndOfTheBarrelY,y ; correction of Y
sta ytraj+1 sta ytraj+1
lda ytraj+2 lda #$00
sbc #0 sbc #$00
sta ytraj+2 sta ytraj+2
jsr Flight jsr Flight
@@ -1506,7 +1511,8 @@ ThereWasNoParachute
.endp .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 ;g=-0.1
;vx=Force*sin(Angle) ;vx=Force*sin(Angle)
@@ -1536,9 +1542,9 @@ RepeatIfSmokeTracer
mva #%01000000 drawFunction mva #%01000000 drawFunction
lda #0 lda #0
sta Result sta vx
sta Result+1 sta vx+1
sta Result+2 sta vx+2
sta HitFlag sta HitFlag
sta xdraw sta xdraw
sta xdraw+1 sta xdraw+1
@@ -1568,24 +1574,23 @@ RepeatIfSmokeTracer
sec sec
txa txa
sbc #165 ;(Angle-165) sbc #165 ;(Angle-165)
sta temp ;dirty trick with selfmodifying code (REMOVED) sta temp
lda #90 ; lda #90
sbc temp ;90-(Angle-165) sbc temp ;90-(Angle-165)
;and we have rady angle here ... and we go LEFT! ;and we have rady angle here ... and we go LEFT!
tax tax
sta Angle sta Angle
mva #1 goleft
; and now we contine as if nothing happened ; and now we contine as if nothing happened
; (but we have goleft set to 1!!!) ; (but we have goleft set to 1!!!)
bne dontzerogoleft mva #1 goleft
bne @+
FlightRight FlightRight
mva #0 goleft mva #0 goleft
@
dontzerogoleft
lda sintable,x ;sin(Angle) lda sintable,x ;sin(Angle)
sta Multiplee ;sin(Angle)*Force sta Multiplee ;sin(Angle)*Force
mwa Force Multiplier mwa Force Multiplier
lda #$0 lda #$0
sta Multiplier+2 sta Multiplier+2
@@ -1595,14 +1600,14 @@ MultiplyLoop
bcc DoNotAdd bcc DoNotAdd
clc clc
lda Multiplier lda Multiplier
adc Result adc vx
sta Result sta vx
lda Multiplier+1 lda Multiplier+1
adc Result+1 adc vx+1
sta Result+1 sta vx+1
lda Multiplier+2 lda Multiplier+2
adc Result+2 adc vx+2
sta Result+2 sta vx+2
DoNotAdd DoNotAdd
;clc ;carry always cleared here (anyway we hope so :) ;clc ;carry always cleared here (anyway we hope so :)
rol Multiplier rol Multiplier
@@ -1610,21 +1615,24 @@ DoNotAdd
rol Multiplier+2 rol Multiplier+2
dex dex
bne MultiplyLoop bne MultiplyLoop
; here in Result there is a number xxxx.yyy = sin(Angle)*Force
lda Result ;vx=sin(Angle)*Force
sta vx
lda Result+1
sta vx+1
lda Result+2
sta vx+2
mva #0 vx+3 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 ;======vy
lda #0 ;cos(Angle) lda #0 ;cos(Angle)
sta Result sta vy
sta Result+1 sta vy+1
sta Result+2 sta vy+2
;-- ;--
lda #90 lda #90
sec sec
@@ -1642,14 +1650,14 @@ MultiplyLoopY
bcc DoNotAddY bcc DoNotAddY
clc clc
lda Multiplier lda Multiplier
adc Result adc vy
sta Result sta vy
lda Multiplier+1 lda Multiplier+1
adc Result+1 adc vy+1
sta Result+1 sta vy+1
lda Multiplier+2 lda Multiplier+2
adc Result+2 adc vy+2
sta Result+2 sta vy+2
DoNotAddY DoNotAddY
;clc ;carry always cleared here (anyway we hope so :) ;clc ;carry always cleared here (anyway we hope so :)
rol Multiplier rol Multiplier
@@ -1657,15 +1665,10 @@ DoNotAddY
rol Multiplier+2 rol Multiplier+2
dex dex
bne MultiplyLoopY bne MultiplyLoopY
; here in Result there is a number xxxx.yyy=cos(Angle)*Force ; here in vy there is a number
; yyyy.yy=cos(Angle)*Force
lda Result ;vy=cos(Angle)*Force mva #0 vy+3 ;vy=cos(Angle)*Force
sta vy
lda Result+1
sta vy+1
lda Result+2
sta vy+2
mva #0 vy+3
Loopi Loopi
;ytraj=ytraj-vy (skipping least significant byte of vy) ;ytraj=ytraj-vy (skipping least significant byte of vy)
@@ -1699,8 +1702,7 @@ Loopi
cmp #6 ; MIRV cmp #6 ; MIRV
jeq MIRVdownLoop jeq MIRVdownLoop
StillUp StillUp
lda goleft
bne FlightLeft
clc ;xtraj=xtraj+vx (skipping least significant byte of vx) clc ;xtraj=xtraj+vx (skipping least significant byte of vx)
lda xtraj ;here of course Fight to right lda xtraj ;here of course Fight to right
@@ -1712,66 +1714,13 @@ StillUp
lda xtraj+2 lda xtraj+2
adc vx+3 adc vx+3
sta xtraj+2 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 clc
lda vx .rept 4
adc Wind lda vx+#
sta vx adc Wind+#
lda vx+1 sta vx+#
adc Wind+1 .endr
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
@
mwa xtrajold+1 xdraw mwa xtrajold+1 xdraw
mwa ytrajold+1 ydraw mwa ytrajold+1 ydraw
mwa xtraj+1 xbyte mwa xtraj+1 xbyte
@@ -1792,7 +1741,7 @@ nowait
lda HitFlag lda HitFlag
bne Hit bne Hit
cpw ytraj+1 #screenheight cpw ytraj+1 #screenheight+1
bcc YTrayLowerThanScreenHeight bcc YTrayLowerThanScreenHeight
lda ytraj+2 lda ytraj+2
bpl EndOfFlight bpl EndOfFlight
@@ -1820,12 +1769,12 @@ Hit
jsr unPlot jsr unPlot
EndOfFlight EndOfFlight
mwa xdraw xcircle ; we must store for a little while mwa xdraw xcircle ; we must store for a little while
mva ydraw ycircle ; xdraw and ydraw .... but this values are in YHit and XHit !!! mwa ydraw ycircle ; xdraw and ydraw .... but this values are in YHit and XHit !!!
mwa #0 xdraw mwa #0 xdraw
mva #screenheight-1 ydraw mwa #screenheight-1 ydraw
jsr unPlot jsr unPlot
mwa xcircle xdraw mwa xcircle xdraw
mva ycircle ydraw mwa ycircle ydraw
; mwa XHit xdraw ; mwa XHit xdraw
; mva YHit ydraw ; mva YHit ydraw
@@ -1839,7 +1788,7 @@ EndOfFlight2
rts rts
.endp .endp
SecondFlight .proc .proc SecondFlight
; ---------------- copied code fragment from before firing. not too elegant. ; ---------------- copied code fragment from before firing. not too elegant.
; ---------------- get fire parameters again ; ---------------- get fire parameters again
ldx TankNr ldx TankNr
@@ -1890,7 +1839,7 @@ SecondFlight .proc
.endp .endp
; ------------------------------------------------- ; -------------------------------------------------
MIRVdownLoop .proc .proc MIRVdownLoop
; MIRV loop - here mirv bullets fall down ; MIRV loop - here mirv bullets fall down
; ------------------------------------------------- ; -------------------------------------------------
; copy Flight parameters to the table ; copy Flight parameters to the table
@@ -2011,8 +1960,6 @@ MIRVdoNotChangeY
lda MirvDown,x ; if bullet is already down we go with the next one lda MirvDown,x ; if bullet is already down we go with the next one
jne MIRVnextBullet jne MIRVnextBullet
lda goleft
bne mrFlightLeft
clc ;xtraj=xtraj+vx (skipping the least significant byte of vx) clc ;xtraj=xtraj+vx (skipping the least significant byte of vx)
lda xtraj00,x ;and here of course Flight to the right lda xtraj00,x ;and here of course Flight to the right
@@ -2024,104 +1971,90 @@ MIRVdoNotChangeY
lda xtraj02,x lda xtraj02,x
adc vx03,x adc vx03,x
sta xtraj02,x sta xtraj02,x
jmp mrskip07 ;skip substracting for Flight to the left
mrFlightLeft ;vx=vx+Wind
sec ;xtraj=xtraj-vx (skipping the least significant byte of vx)
lda xtraj00,x ;here of course Flight to the left
sbc vx01,x
sta xtraj00,x
lda xtraj01,x
sbc vx02,x
sta xtraj01,x
lda xtraj02,x
sbc vx03,x
sta xtraj02,x
mrskip07
;vx=vx-Wind (also without least significan byte of vx)
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 clc
lda vx00,x .rept 4
adc Wind lda vx+#
sta vx00,x adc Wind+#
lda vx01,x sta vx+#
adc Wind+1 .endr
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
; isn't it over the screen???? ; rules for a falling MIRV bulets.
lda ytraj+2 ;attention! this checks getting out of the screen through bottom ; if Y is negative and any X (bullet over the screen) - continue flying
bmi MIRVcheckX ;but not that accurately.... ; if (Y>=0 and Y<=screenhight) and X>screenwidth (bullet off-screen on the left or right side) - continue flying
lda ytraj+1 ; if (Y>=0 and Y<=screenhight) and X<=screenwidth (bullet on the screen) - check collision
cmp #screenheight ; if Y>screenhight and X>screenwidth (bullet under the screen on the left or right side) - stop flying without hit
jcs mrEndOfFlight ; if smaller than screenheight then continue (and it will always fall down...) ; if Y>screenhight and X<=screenwidth (bullet under the screen) - check collision (allways hit)
MIRVcheckX
lda xtraj02,x ; check bullet position and set flags:
; XposFlag - bullet positon X (0 - on screen , %1000000 - off-screen)
; YposFlag - bullet positon Y (0 - on screen , %1000000 - over the screen , %0100000 - under the screen)
lda #$00
sta XposFlag
sta YposFlag
lda ytraj+2 ; Y high byte
bpl @+
mva #%10000000 YposFlag ; bullet over the screen (Y)
bmi MIRVsetXflag
@
lda ytraj+1 ; Y low byte
cmp #screenheight
bcc MIRVsetXflag ; bullet on screen (Y)
mva #%01000000 YposFlag ; bullet under the screen (Y)
MIRVsetXflag
lda xtraj02,x ; X high byte
cmp #>screenwidth cmp #>screenwidth
beq MIRVcheckLowerX bne @+
bcc MIRVcheckCollision lda xtraj01,x ; X low byte
; it's over the screen horizontally (to the left or right)
mwa #0 xdraw
mva #screenheight-1 ydraw
jsr unPlot.unPlotAfterX
jmp mrLoopi
MIRVcheckLowerX
lda xtraj01,x
cmp #<screenwidth cmp #<screenwidth
bcc MIRVcheckCollision @
; it's over the screen horizontally (to the left or right) bcc MIRVXonscreen
mva #%10000000 XposFlag ; bullet off-screen (X)
MIRVXonscreen
; X and Y position flags sets
; then realize rules
lda YposFlag
jmi MIRVcontinueFly ; Y over the screen
bne MIRVYunderscreen ; Y under the screen
; Y on screen
bit XposFlag
jmi MIRVcontinueFly ; Y on screen and X off-screen
jpl MIRVcheckCollision ; X and Y on screen
MIRVYunderscreen
bit XposFlag
jpl MIRVcheckCollision ; X on screen and Y under screen
; Y under screen and X off-screen
; stop flying
jmi mrEndOfFlight
MIRVcontinueFly
mwa #0 xdraw mwa #0 xdraw
mva #screenheight-1 ydraw mwa #screenheight-1 ydraw
bit XposFlag
bmi @+ ; no pixels to plot
; plot bullets over the screen
mwa #0 ydraw
;mwa xtraj01 xdraw
lda xtraj01,x
sta xdraw
lda xtraj02,x
sta xdraw+1
@
jsr unPlot.unPlotAfterX jsr unPlot.unPlotAfterX
jmp mrLoopi jmp mrLoopi
MIRVcheckCollision MIRVcheckCollision
; checking the collision!
lda ytraj+2
bne mrSkipCollisionCheck
; checking works only with xtraj so copy there all we need ; checking works only with xdraw and ydraw so copy there all we need
lda xtraj01,x lda xtraj01,x
sta xtraj+1 sta xdraw
lda xtraj02,x lda xtraj02,x
sta xtraj+2 sta xdraw+1
mwa ytraj+1 ydraw
mva #0 HitFlag mva #0 HitFlag
jsr CheckCollisionWithTank jsr CheckCollisionWithTank
ldx MirvMissileCounter ldx MirvMissileCounter
@@ -2139,13 +2072,10 @@ MIRVcheckCollision
ldy #0 ldy #0
lda ytraj+1 lda ytraj+1
cmp (temp),y cmp (temp),y ; check collision witch mountains
bcs mrHit bcs mrHit
mrSkipCollisionCheck mrSkipCollisionCheck
;mwa xtraj01 xdraw ;mwa xtraj01 xdraw
lda xtraj01,x lda xtraj01,x
sta xdraw sta xdraw
@@ -2183,10 +2113,11 @@ mrHit
sta ydraw sta ydraw
sty ydraw+1 ;we know that y=0 sty ydraw+1 ;we know that y=0
jsr missile ; explode .... jsr missile ; explode ....
mrEndOfFlight mrEndOfFlight
ldx MirvMissileCounter ldx MirvMissileCounter
mwa #0 xdraw mwa #0 xdraw
mva #screenheight-1 ydraw mwa #screenheight-1 ydraw
jsr unPlot.unPlotAfterX jsr unPlot.unPlotAfterX
ldx MirvMissileCounter ldx MirvMissileCounter
lda #1 lda #1
@@ -2204,13 +2135,13 @@ MIRVstillNotAll
jmp mrLoopi jmp mrLoopi
MIRValreadyAll MIRValreadyAll
mwa xdraw xcircle ; we must store them (for a while) mwa xdraw xcircle ; we must store them (for a while)
mva ydraw ycircle ; xdraw and ydraw mwa ydraw ycircle ; xdraw and ydraw
mwa #0 xdraw mwa #0 xdraw
mva #screenheight-1 ydraw mwa #screenheight-1 ydraw
ldx MirvMissileCounter ldx MirvMissileCounter
jsr unPlot.unPlotAfterX jsr unPlot.unPlotAfterX
mwa xcircle xdraw mwa xcircle xdraw
mva ycircle ydraw mwa ycircle ydraw
; we must do it manually because of the VOID pointer ; we must do it manually because of the VOID pointer
@@ -2232,16 +2163,24 @@ MIRValreadyAll
.endp .endp
; ------------------------------------------------- ; -------------------------------------------------
CheckCollisionWithTank .proc .proc CheckCollisionWithTank
; ------------------------------------------------- ; -------------------------------------------------
; Check collision with Tank :)
; xdraw , ydraw - coordinates of the checked point
; results:
; HitFlag - 1 - hit, 0 - no hit
; XHit , YHit - coordinates of hit
; X - index of the hit tank
ldx #0 ldx #0
CheckCollisionWithTankLoop CheckCollisionWithTankLoop
lda eXistenZ,x
beq DeadTank
lda xtankstableH,x lda xtankstableH,x
cmp xtraj+2 cmp xdraw+1
bne Condition01 bne Condition01
lda xtankstableL,x lda xtankstableL,x
cmp xtraj+1 cmp xdraw
Condition01 Condition01
bcs LeftFromTheTank ;add 8 double byte bcs LeftFromTheTank ;add 8 double byte
clc clc
@@ -2249,26 +2188,27 @@ Condition01
tay tay
lda xtankstableH,x lda xtankstableH,x
adc #0 adc #0
cmp xtraj+2 cmp xdraw+1
bne Condition02 bne Condition02
cpy xtraj+1 cpy xdraw
Condition02 Condition02
bcc RightFromTheTank bcc RightFromTheTank
lda ytankstable,x lda ytankstable,x
cmp ytraj+1 ; check range cmp ydraw ; check range
bcc BelowTheTank ;(ytankstable,ytankstable+3) bcc BelowTheTank ;(ytankstable,ytankstable+3)
sbc #4 sbc #4
cmp ytraj+1 cmp ydraw
bcs OverTheTank bcs OverTheTank
mva #1 HitFlag mva #1 HitFlag
mwa xtraj+1 XHit mwa xdraw XHit
mwa ytraj+1 YHit mwa ydraw YHit
rts ; in X there is an index of the hit tank rts ; in X there is an index of the hit tank
RightFromTheTank RightFromTheTank
LeftFromTheTank LeftFromTheTank
OverTheTank OverTheTank
BelowTheTank BelowTheTank
DeadTank
inx inx
cpx NumberOfPlayers cpx NumberOfPlayers
bne CheckCollisionWithTankLoop bne CheckCollisionWithTankLoop
@@ -2320,7 +2260,7 @@ RangesChecked
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
DecreaseWeaponBeforeShoot .proc .proc DecreaseWeaponBeforeShoot
;-------------------------------------------------- ;--------------------------------------------------
ldx TankNr ldx TankNr
lda ActiveWeapon,x lda ActiveWeapon,x
@@ -2342,26 +2282,28 @@ DecreaseWeaponBeforeShoot .proc
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
DecreaseWeapon .proc .proc DecreaseWeapon
; in: A: Weapon number, TankNr ; in: A: Weapon number, TankNr
; out: A: number of shells left, Y: weapon number ; out: A: number of shells left, Y: weapon number
; decreases 1 bullet from a weapon(A) of tank(TankNr) ; decreases 1 bullet from a weapon(A) of tank(TankNr)
;-------------------------------------------------- ;--------------------------------------------------
jsr HowManyBullets jsr HowManyBullets
beq noBullets ; no bullets - no decreasing (additional check)
cpy #0 cpy #0
beq defaultWeapon ; no decreasing Baby Missile beq defaultWeapon ; no decreasing Baby Missile
sec sec
sbc #1 sbc #1
sta (weaponPointer),y ; we have good values after HowManyBullets sta (weaponPointer),y ; we have good values after HowManyBullets
defaultWeapon defaultWeapon
noBullets
rts rts
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
HowManyBullets .proc .proc HowManyBullets
; in: A <-- Weapon number, TankNr ; in: A <-- Weapon number, TankNr
; out: A <-- How many bullets in the weapon, Y: weapon number ; out: A <-- How many bullets in the weapon, Y: weapon number
; how many bullets weapon of tank(TankNr) has, Result w A ; how many bullets weapon of tank(TankNr) has, Result in A
;-------------------------------------------------- ;--------------------------------------------------
tay tay
ldx TankNr ldx TankNr
@@ -2375,7 +2317,7 @@ HowManyBullets .proc
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
ShellDelay .proc .proc ShellDelay
lda CONSOL lda CONSOL
cmp #6 cmp #6
beq noShellDelay beq noShellDelay