almost done #74

This commit is contained in:
2022-06-05 02:40:07 -04:00
parent 1eadc7f63e
commit 853a597daf
6 changed files with 187 additions and 124 deletions
+11 -19
View File
@@ -23,7 +23,6 @@ RoundsTable .by 10,20,30,40,50
flyDelayTable .by 255,150,75,35,1
seppukuTable .by 255, 45,25,15,9
;------------------------------------------------
LevelNameBeginL ; begins of level names
.by <NamesOfLevels,<(NamesOfLevels+10),<(NamesOfLevels+20)
.by <(NamesOfLevels+32),<(NamesOfLevels+42),<(NamesOfLevels+52)
@@ -37,31 +36,25 @@ TanksWeaponsTableL
.by <TanksWeapon1,<TanksWeapon2,<TanksWeapon3,<TanksWeapon4,<TanksWeapon5,<TanksWeapon6
TanksWeaponsTableH
.by >TanksWeapon1,>TanksWeapon2,>TanksWeapon3,>TanksWeapon4,>TanksWeapon5,>TanksWeapon6
;-----4x4 texts-----
;-----4x4 texts-----
LineTop
dta d"(%%%%%%%%%%%%)"
.byte $ff
dta d"(%%%%%%%%%%%%)", $ff
;# - vertical, () * +, % - horizontal
LineBottom
dta d"*%%%%%%%%%%%%+"
.byte $ff
dta d"*%%%%%%%%%%%%+", $ff
LineEmpty
dta d"# #"
.byte $ff
dta d"# #", $ff
LineHeader2
dta d"# RESULTS #"
.byte $ff
dta d"# RESULTS #", $ff
LineGameOver
dta d"# GAME OVER #"
.byte $ff
dta d"# GAME OVER #", $ff
seppukuText
dta d"# SEPPUKU! #"
.byte $ff
dta d"# SEPPUKU! #", $ff
areYouSureText
dta d"# SURE? Y/N #", $ff
lineClear
dta d" "
.byte $ff
dta d" ", $ff
;-----------
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,7
.by 7,7,7,7,7,7,7,7,7,7,7
;-------------------------------------------------
;-------------------------------------------------
TanksNamesDefault
dta d"1st.Tank"
dta d"2nd.Tank"
@@ -551,7 +544,6 @@ TanksNamesDefault
dta d"5th.Tank"
dta d"6th.Tank"
WeaponPriceH ; weapons prices (tables with prices of weapons)
.by >price_Baby_Missile___
.by >price_Missile________
+44 -46
View File
@@ -98,6 +98,7 @@
icl 'lib/atari.hea'
icl 'lib/macro.hea'
;splash screen and musix
icl 'artwork/HIMARS14.asm'
;Game loading address
ORG $3000
@@ -117,13 +118,14 @@ START
; Startup sequence
jsr Initialize
jsr Options ;startup screen
lda escFlag
bne START
jsr EnterPlayerNames
lda escFlag
bne START
jsr RandomizeSequence
; for the round #1 shooting sequence is random
@@ -144,6 +146,9 @@ MainGameLoop
jsr RoundInit
jsr MainRoundLoop
lda escFlag
bne START
mva #0 TankNr ;
jsr SortSequence
@@ -248,51 +253,46 @@ skipzeroing
; the shooting angle is randomized
; of course gains an looses are zeroed
;jsr StatusDisplay
lda #0
tax
@
sta singleRoundVars,x
inx
cpx #(singleRoundVarsEnd-singleRoundVars)
@ sta singleRoundVars,x
inx
cpx #(singleRoundVarsEnd-singleRoundVars)
bne @-
ldx #(MaxPlayers-1)
SettingEnergies
lda #$00
sta gainL,x
sta gainH,x
sta looseL,x
sta looseH,x
lda #99
sta Energy,x
sta eXistenZ,x
sta LASTeXistenZ,x
; anything in eXistenZ table means that this tank exist
; in the given round
lda #<1000
sta MaxForceTableL,x
lda #>1000
sta MaxForceTableH,x
lda #<350
sta ForceTableL,x
lda #>350
sta ForceTableH,x
lda #$00
sta gainL,x
sta gainH,x
sta looseL,x
sta looseH,x
lda #99
sta Energy,x
sta eXistenZ,x
sta LASTeXistenZ,x
; anything in eXistenZ table means that this tank exist
; in the given round
lda #<1000
sta MaxForceTableL,x
lda #>1000
sta MaxForceTableH,x
lda #<350
sta ForceTableL,x
lda #>350
sta ForceTableH,x
;lda #(255-45)
;it does not look good when all tanks have
;barrels pointing the same direction
;so it would be nice to have more or less random
;angles
jsr RandomizeAngle
sta AngleTable,x
;lda #(255-45)
;it does not look good when all tanks have
;barrels pointing the same direction
;so it would be nice to have more or less random
;angles
jsr RandomizeAngle
sta AngleTable,x
dex
dex
bpl SettingEnergies
mva #0 CurrentResult
;generating the new landscape
jsr PMoutofScreen ;let P/M disappear
jsr clearscreen ;let the screen be clean
@@ -344,8 +344,7 @@ WhichTankWonLoop
bne ThisOneWon
dex
bpl WhichTankWonLoop
;error here!!!
;stop
;error was here!!!
; somehow I believed program will be never here
; but it was a bad assumption
; god knows when there is such a situation
@@ -409,6 +408,8 @@ ManualShooting
jsr WaitForKeyRelease
jsr BeforeFire
lda escFlag
seq:rts
AfterManualShooting
inc noDeathCounter
@@ -768,16 +769,12 @@ PMoutofScreen .proc
;--------------------------------------------------
.proc Initialize
;Initialization sequence
;uses: temp, ...
;--------------------------------------------------
deletePtr = temp
lda #0
sta Erase
sta tracerflag
sta GameIsOver
sta escFlag
; clean variables
lda #0
tay
mwa #variablesStart deletePtr
@ tya
@@ -1185,7 +1182,8 @@ nextishigher
.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
@
BIN
View File
Binary file not shown.
+65 -1
View File
@@ -218,6 +218,8 @@ OptionsYLoop
ManualPurchase
jsr Purchase
ldx escFlag
seq:rts
AfterManualPurchase
inc:lda TankNr
@@ -556,6 +558,8 @@ ChoosingItemForPurchase
;--------------------------------------------------
jsr PutLitteChar ; Places pointer at the right position
jsr getkey
ldx escFlag
seq:rts
cmp #$2c ; Tab
jeq ListChange
cmp #$0c ; Return
@@ -838,7 +842,7 @@ NoArrowDown
sta colpf2s ; set color of player name line
jsr EnterPlayerName
lda escFlag
jne START
seq:rts
inc TankNr
lda TankNr
cmp NumberOfPlayers
@@ -1366,6 +1370,66 @@ EndOfTypeLine4x4
.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
mwa #LineTop LineAddress4x4
mwa #((ScreenWidth/2)-(8*4)) LineXdraw ; centering
mva ResultY LineYdraw
jsr TypeLine4x4
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
mwa #LineBottom LineAddress4x4
mwa #((ScreenWidth/2)-(8*4)) LineXdraw ; centering
mva ResultY LineYdraw
jsr TypeLine4x4
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
;using 4x4 font
+48 -46
View File
@@ -8,35 +8,30 @@
; compilation to e.g. cartridge
; zero page variables are declared in program.s65 module
;=====================================================
;--------------------------------------------------
;Variables
;--------------
TanksNames ; DO NOT ZERO - ticket #24
:6 dta d" "
;----------------------------
;----------------------------------------------------
;Options DO NOT ZERO - ticket #27
OptionsTable .by 0,0,2,2,0,1,3
RoundsInTheGame .by 10 ;how many rounds in the current game
seppukuVal .by 75
;--------------------------------------------------
;----------------------------------------------------
skilltable ; computer controlled players' skills (1-8), 0 - human (no cleaning, ticket #30)
.DS [MaxPlayers]
;-----------------------------------
;----------------------------------------------------
; 4x4 text buffer
ResultLineBuffer
dta d" "
.byte $ff
dta d" ", $ff
LineHeader1
dta d"# ROUND: "
RoundNrDisplay
dta d" #"
.byte $ff
dta d" #", $ff
;=====================================================
variablesStart ; zeroing starts here
;=====================================================
drawFunction .ds 1 ; 0 - plot, %10000000 - LineLength (N), %01000000 - DrawCheck (V)
;--------------
escFlag .ds 1
;--------------
sfx_effect .ds 1
;--------------
noDeathCounter .ds 1
@@ -47,28 +42,28 @@ flyDelay .ds 1
NumberOfPlayers .DS 1 ;current number of players (counted from 1)
TankSequence .DS [MaxPlayers] ;sequence of shooting during the Round
GameIsOver .DS 1 ; 1 means it was the last round in the game
;-----------------------------------
;----------------------------------------------------
moneyH ;we place zero at the end of prices and money
;and have range from 0 to 99990 (not too much)
;money players have (maybe one more byte is needed?)
.DS [MaxPlayers]
moneyL
.DS [MaxPlayers]
;-----------------------------------
;----------------------------------------------------
gainH ;how much money player gets after the round
;it is gathered during the round basing on energy
;opponents loose after player's shoots
.DS [MaxPlayers]
gainL
.DS [MaxPlayers]
;-----------------------------------
;----------------------------------------------------
looseH ;how much player looses after the round
;calculated from REAL energy loss
;(not only to zero energy)
.DS [MaxPlayers]
looseL
.DS [MaxPlayers]
;-----------------------------------
;----------------------------------------------------
Energy
.DS [MaxPlayers]
EnergyDecrease .DS 1
@@ -81,9 +76,7 @@ ResultsTable ;the results in the gameeeeee
.DS [MaxPlayers]
TempResults
.DS [MaxPlayers]
CurrentResult
.DS 1
;-----------------------------------
;----------------------------------------------------
ForceTableL ;shooting Force of the tank during the round
.DS [MaxPlayers]
ForceTableH
@@ -93,36 +86,36 @@ MaxForceTableL ;Energy of the tank during the round
.DS [MaxPlayers] ;1000 is the default
MaxForceTableH
.DS [MaxPlayers]
;-----------------------------------
;----------------------------------------------------
AngleTable ;Angle of the barrel of each tank during the round
.DS [MaxPlayers]
NewAngle .DS 1
;-----------------------------------
;----------------------------------------------------
ActiveWeapon ;number of the selected weapon
.DS [MaxPlayers]
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
; 20203.5 => 128 : <20203 : >20203
;-----------------------------------
;----------------------------------------------------
L1 .DS 1 ; variable used in multiplications (by 10:)
gravity .DS 1 ;only the decimal part (1/10 = 25)
;-----------------------------------
;----------------------------------------------------
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)
;-----------------------------------
;----------------------------------------------------
Counter .DS 1 ;temporary Counter for outside loops
HitFlag .DS 1 ;1 when missile hit anything
;-----------------------------------
;----------------------------------------------------
xtankstableL ;X positions of tanks (lower left point)
.DS [MaxPlayers]
xtankstableH
@@ -131,17 +124,17 @@ ytankstable ;Y positions of tanks (lower left point)
.DS [MaxPlayers]
LowResDistances ; coarse tank positions divided by 4 (to be in just one byte)
.DS [MaxPlayers]
;-----------------------------------
;----------------------------------------------------
Erase .DS 1 ; if 1 only mask of the character is printed
; on the graphics screen. if 0 character is printed normally
;-----------------------------------
;----------------------------------------------------
RangeLeft .DS 2 ;range of the soil to be fallen down
RangeRight .DS 2 ;it is being set by all Explosions
;-----------------------------------
;----------------------------------------------------
WeaponRangeLeft .DS 2 ;Range of the Explosion of the given weapon
WeaponRangeRight .DS 2
;--------------------------------------------------
;----------------------------------------------------
;xroller
HowMuchToFall .ds 1
HeightRol .DS 1
@@ -181,7 +174,7 @@ IfFallDown .DS 1
PreviousFall .DS 1
EndOfTheFallFlag .DS 1 ; in case of the infinite fall
Parachute .DS 1 ; are you insured with parachute?
; -------------------------------------------------
;----------------------------------------------------
;Flight
;variables for 5 missiles (used for mirv)
xtraj00 .DS [5] ; 3 bytes of xtraj times 5. Lowest byte
@@ -196,7 +189,7 @@ MirvMissileCounter .DS 1 ; missile Counter (mainly for X)
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
vx .ds 4 ; 0,0,0,0 ;two decimal bytes, two whole bytes (DC.BA)
vy .ds 4 ;0,0,0,0
@@ -209,10 +202,10 @@ Force .ds 3 ; 0,0,0
Multiplier .ds 3 ; 0,0,0
Multiplee .ds 2 ; 0,0
goleft .DS 1 ;if 1 then flights left
;--------------------------------------------------
;----------------------------------------------------
;SoilDown2
IsEndOfTheFallFlag .DS 1
; -------------------------------------------------
;----------------------------------------------------
;unPlot
WhichUnPlot .DS 1
; max 5 concurrent unPlots
@@ -226,7 +219,7 @@ xtrajfb .DS 2
ytrajfb .DS 2
;
tracerflag .DS 1
; -------------------------------------------------
;----------------------------------------------------
;TypeChar
mask1 .DS [8]
mask2 .DS [8]
@@ -244,7 +237,7 @@ UpNdown .DS 1
temptankX .DS 2
temptankNr .DS 1
; -------------------------------------------------
;----------------------------------------------------
;Variables from textproc.s65
; tables with numbers of weapons on the right lists
; to be honest - I do not know at the moment what the above
@@ -254,7 +247,7 @@ NubersOfWeaponsL1
.ds 8*5 ; :(8*5) .by $ff
NubersOfWeaponsL2
.ds 8*2 ; :(8*2) .by $ff
; -------------------------------------------------
;----------------------------------------------------
; variables storing amount of weapons on the first and second
; list and pointer position
@@ -277,14 +270,14 @@ WhichList ; list currently on the screen
OffsetDL1 ; offset of the list screen (how many lines)....
.DS 1
; -------------------------------------------------
;----------------------------------------------------
;mark the level
PositionInName ; cursor position in name of the player when name input
.DS 1
DifficultyLevel ; Difficulty Level (human/cpu)
.DS 1
;-------------------------------------------------
;----------------------------------------------------
;displaydecimal
decimal .DS 2
decimalresult .DS 4
@@ -299,7 +292,7 @@ FallDown2 .DS 1
LeapFrogAngle .DS 1
;laser
LaserCoordinate .DS 8 ; 2,2,2,2
; -------------------------------------------------
;----------------------------------------------------
; Here go tables with weapons possesed by a given tank
; Index in the table means weapon type
; number entered means ammo for given weapon possessed (max 99)
@@ -326,7 +319,7 @@ mountaintable2 ;table of mountains (size=screenwidth)
.DS [screenwidth]
.DS 1 ; additional byte for fallout (sometimes 1 pixel)
MountaintableEnd ;good for table clearing
;----------------------------------------------
;----------------------------------------------------
TextPositionX .DS 2
TextPositionY .DS 1
TextAddress .DS 2
@@ -335,8 +328,16 @@ TextNumberOff .DS 1
;--------------
TankTempY
.DS 1
;----------------------------------------------------
;-------------- single round variables --------------
;----------------------------------------------------
singleRoundVars
;--------------
escFlag .ds 1
;--------------
CurrentResult
.DS 1
;--------------
previousAngle
.DS [MaxPlayers]
previousEnergyL
@@ -354,9 +355,9 @@ RandBoundaryHigh
AngleTablePointer
.DS 1
singleRoundVarsEnd
;----------------------------------------------
;----------------------------------------------------
; 4x4 texts
;----------------------------------------------
;----------------------------------------------------
LineAddress4x4
.DS 2
LineCharNr
@@ -374,8 +375,9 @@ ResultY
ResultOfTankNr
.DS 1
;----------------------------
;----------------------------------------------------
;PutChar4x4
;----------------------------------------------------
LoopCounter4x4 .DS 1
y4x4 .DS 1
StoreA4x4 .DS 1
@@ -387,6 +389,6 @@ plot4x4color .DS 1 ;1-white, 0-background
variablesEnd
;----------------------------
;----------------------------------------------------
.endif
+17 -10
View File
@@ -1016,7 +1016,17 @@ notpressed
beq checkJoy
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
jeq CTRLPressedUp
cmp #$8f
@@ -1104,9 +1114,9 @@ pressedDown
dec ForceTableH,x
bpl @+
ForceGoesZero
lda #0
sta ForceTableH,x
sta ForceTableL,x
lda #0
sta ForceTableH,x
sta ForceTableL,x
@
jmp BeforeFire
@@ -1571,17 +1581,14 @@ RepeatIfSmokeTracer
tax
sta Angle
;
mva #1 goleft
; and now we contine as if nothing happened
; (but we have goleft set to 1!!!)
bne dontzerogoleft
mva #1 goleft
bne @+
FlightRight
mva #0 goleft
dontzerogoleft
@
lda sintable,x ;sin(Angle)
sta Multiplee ;sin(Angle)*Force
mwa Force Multiplier