-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvariables.asm
460 lines (439 loc) · 14.2 KB
/
variables.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
; @com.wudsn.ide.asm.mainsourcefile=scorch.asm
.IF *>0 ;this is a trick that prevents compiling this file alone
;=====================================================
; most important non-zero page variables
; used by the given subroutines
; moved to one place for easier
; compilation to e.g. cartridge
; zero page variables are declared in program.s65 module
;=====================================================
OneTimeZeroVariables
OneTimeZeroVariablesCount = variablesToInitialize-OneTimeZeroVariables ; MAX 128 bytes !
.if OneTimeZeroVariablesCount > 127
.error "OneTimeZeroVariablesCount too large, ",OneTimeZeroVariablesCount
.endif
noMusic .ds 1 ;.by 0 ; 0 - play music, $ff - do not play music
noSfx .ds 1 ;.by 0 ; 0 - play SFX, $ff - do not play SFX
;----------------------------------------------------
; Color table for Game Over Screen (created in a gameover routine)
.ds 1 ;.by $00 ; labels line color
GameOverColoursTable .ds MaxPlayers; .BYTE $80,$40,$c4,$20,$c0,$e4
;----------------------------------------------------
TanksNames ; DO NOT ZERO ON GAME RESTART - ticket #24
;:6 dta d" "
.ds MaxPlayers*8
;----------------------------------------------------
skilltable ; computer controlled players' skills (1-8), 0 - human (no cleaning, ticket #30)
.DS MaxPlayers
;----------------------------------------------------
JoyNumber ; Joystick port number (from 0 to 3)
.DS MaxPlayers
;----------------------------------------------------
variablesToInitialize
;Options DO NOT ZERO ON RESTART GAME - ticket #27
OptionsTable .ds maxOptions ;.by 0,1,2,2,0,1,3,2,0
RoundsInTheGame .ds 1 ;.by 10 ;how many rounds in the current game
seppukuVal .ds 1 ;.by 75
mountainDeltaH .ds 1 ;.by 3
mountainDeltaL .ds 1 ;.by $ff
;----------------------------------------------------
LineHeader1
.ds 9 ;dta d"# ROUND: "
RoundNrDisplay
.ds 5 ;dta d" #", $ff
; 4x4 text buffer
ResultLineBuffer
.ds 14 ;dta d" ", $ff
linetableL ; = PMGraph + $0300 - (screenHeight+1)*2
.ds (screenHeight+1)
linetableH ; = PMGraph + $0300 - (screenHeight+1)
.ds (screenHeight+1)
DisplayCopyPurchase
.ds (DisplayCopyPurchaseEnd - DisplayCopyPurchaseStart +1)
StatusBufferCopy
.ds screenBytes*3
;=====================================================
variablesStart ; zeroing starts here
;=====================================================
;isInventory .ds 1 ; 0 - purchase, $ff - inventory
;--------------
drawFunction .ds 1 ; 0 - plot, %10000000 - LineLength (N), %01000000 - DrawCheck (V)
;--------------
noDeathCounter .ds 1
;--------------
OptionsY .ds 1 ;vertical position of cursor on Options screen
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 lose after player's shoots
.DS MaxPlayers
gainL
.DS MaxPlayers
;----------------------------------------------------
loseH ;how much player looses after the round
;calculated from REAL energy loss
;(not only to zero energy)
.DS MaxPlayers
loseL
.DS MaxPlayers
;----------------------------------------------------
Energy
.DS MaxPlayers
ShieldEnergy
.DS MaxPlayers
EnergyDecrease .DS 1
eXistenZ
.DS MaxPlayers
LASTeXistenZ ; eXistenZ before shoot
.DS MaxPlayers
ResultsTable ;the results in the gameeeeee
.DS MaxPlayers
DirectHits
.DS MaxPlayers
EarnedMoneyH
.DS MaxPlayers
EarnedMoneyL
.DS MaxPlayers
;----------------------------------------------------
ForceTableL ;shooting Force of the tank during the round
.DS MaxPlayers
ForceTableH
.DS MaxPlayers ;maxplayers=6
MaxForceTableL ;Energy of the tank during the round
;(limes superior force of the Shoot)
.DS MaxPlayers ;1000 is the default
MaxForceTableH
.DS MaxPlayers
;----------------------------------------------------
BarrelLength ;length of the tank barrel - dont forget to set it to 6 at round start!
.DS MaxPlayers
ActiveWeapon ;number of the selected weapon
.DS MaxPlayers
ActiveDefenceWeapon ;number of the activated defence weapon - 0
.DS MaxPlayers
AutoDefenseFlag ; 0 - not activated, >$7f - activated
.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 ;$ff when missile hit ground, $00 when no hit, $01-$06 tank index+1 when hit tank
WallsType .ds 1 ; bits 6 and 7: 00 - none, 01 - bump, 10 - wrap, 11 - boxy
;----------------------------------------------------
xtankstableL ;X positions of tanks (lower left point)
.DS MaxPlayers
xtankstableH
.DS MaxPlayers
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
;----------------------------------------------------
TargetTankNr ; Target tank index (for AI routines)
.DS 1
FirstTargetTankNr ; Target tank index (for AI routines)
.DS 1
SecondTryFlag ; For precise AI aiming
.DS 1
;----------------------------------------------------
;Erase .DS 1 ; if 1 only mask of the character is printed
; on the graphics screen. if 0 character is printed normally
TankShape ; Tank shape number (from 0 to 2)
.DS MaxPlayers
;----------------------------------------------------
;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
;digger
;digstartx .DS 2
;digstarty .DS 2
diggery .DS 1
DigLong .DS 1
digtabxL .DS [8]
digtabxH .DS [8]
digtabyL .DS [8]
digtabyH .DS [8]
; liquiddirt
TempXfill .ds 2
FillCounter .ds 2
;sandhog
sandhogflag .DS 1 ; (0 digger, 8 sandhog)
;ofdirt
;magic .DS 2 ; was tempor2, but it was not compiling!!! (bug in OMC65)
;draw
;HowToDraw .DS 1
; bits here mean
; 0 - negative X (go up)
; 1 - negative Y (left)
; 2 - directional value > 1 (more than 45 degrees)
; if all 0 then standart routine
;XHit .DS 2
YHit .DS 2
;LineLength .DS 2
;circle
;radius .DS 1
;xcircle .DS 2
;ycircle .DS 2
;tempcir .DS 2
;TankFalls
FallingSoundBit .DS 1
PreviousFall .DS 1
EndOfTheFallFlag .DS 1 ; in case of the infinite fall
;Parachute .DS 1 ; are you insured with parachute?
;FloatingAlt .DS 1 ; floating tank altitude
FunkyWallFlag = FloatingAlt ; reuse this variable in different weapon (Funky Bomb)!
PreferHumansFlag = FloatingAlt ; second reuse in AI Aim proc
;PreferHumansFlag .DS 1
;----------------------------------------------------
;Flight
;variables for 5 missiles (used for mirv)
xtraj00 .DS [5] ; 3 bytes of xtraj times 5. Lowest byte
xtraj01 .DS [5] ; middle byte
xtraj02 .DS [5] ; high byte
;vx00 .DS [5] ; looks like it is not really used anywhere
vx01 .DS [5]
vx02 .DS [5]
vx03 .DS [5]
MirvDown .DS [5] ; is given missile down?
MirvMissileCounter .DS 1 ; missile Counter (mainly for X)
SmokeTracerFlag .DS 1 ; if Smoketracer
LaserFlag .DS 1 ; $ff if Laser
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
;xtraj .ds 3 ; 0,0,0
;ytraj .ds 3 ; 0,0,0
xtrajold .ds 3 ; 0,0,0
ytrajold .ds 3 ; 0,0,0
;Angle .DS 1
;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
;----------------------------------------------------
;unPlot
WhichUnPlot .DS 1
; max 5 concurrent unPlots
oldplotH .DS [5]
oldplotL .DS [5]
oldora .DS [5]
oldply .DS [5]
OldOraTemp .DS 1
xtrajfb .DS 2
ytrajfb .DS 2
;
;tracerflag .DS 1
;----------------------------------------------------
;TypeChar
mask1 .DS [8]
mask2 .DS [8]
char1 .DS [8]
char2 .DS [8]
;color .DS 1
ybit .DS 1
;delta .DS 2
yfloat .DS 2
deltaX .DS 1
UpNdown .DS 1
temptankX .DS 2
temptankNr .DS 1
AfterBFGflag .DS 1
;----------------------------------------------------
;Variables from textproc.s65
; tables with indexes of weapons on the right lists
; OK (2022) so, L1 is list of offensive weapons, L2 - defensive
IndexesOfWeaponsL1
.ds (number_of_offensives)
IndexesOfWeaponsL2
.ds (number_of_defensives)
;----------------------------------------------------
; variables storing amount of weapons on the first and second
; list and pointer position
HowManyOnTheListOff
.DS 1
HowManyOnTheListDef
.DS 1
;PositionOnTheList ; pointer position on the list being displayed
; .DS 1
LastWeapon
; number of the last previously purchased weapon
; it is necessary when after purchase some weapon
; is removed from the list (because too expensive)
; and the cursor must be placed elsewhere
.DS 1
WhichList ; list currently on the screen
; (0-offensive, %10000000 - defensive (check with bit:bmi for defensives)
.DS 1
;OffsetDL1 .DS 1 ; offset of the list screen (how many lines)....
;----------------------------------------------------
;mark the level
PositionInName ; cursor position in name of the player when name input
.DS 1
;DifficultyLevel .DS 1 ; Difficulty Level (human/cpu)
;----------------------------------------------------
;displaydecimal
;decimal .DS 2
decimalresult .DS 5
;xmissile
;ExplosionRadius .DS 2 ;because when adding in xdraw it is double byte
;round
CurrentRoundNr .DS 1
;FallDown2 .DS 1
;leapfrog
LeapFrogAngle .DS 1
;laser
LaserCoordinate .DS 4 ; 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)
; Let 0 be "baby missile"
; from $30 the defensive weapons begin
TanksWeapons
.REPT MaxPlayers, #+1
TanksWeapon:1
.DS number_of_weapons
.ENDR
mountaintable ;table of mountains (size=screenwidth)
.DS [screenwidth]
.DS 1 ; additional byte for fallout (sometimes 1 pixel)
mountaintable2 ;table of mountains (size=screenwidth)
.DS [screenwidth]
.DS 1 ; additional byte for fallout (sometimes 1 pixel)
MountaintableEnd ;good for table clearing
;----------------------------------------------------
TextNumberOff .DS 1
;--------------
TankTempY
.DS 1
;----------------------------------------------------
;-------------- single round variables --------------
;----------------------------------------------------
singleRoundVars
;--------------
;escFlag .ds 1 ; 0 - Esc or O not pressed, $80 - Esc pressed, $40 - O pressed
;--------------
CurrentResult
.DS 1
;--------------
AngleTable ;Angle of the barrel of each tank during the round
.DS MaxPlayers
EndOfTheBarrelX
.ds 2
EndOfTheBarrelY
.ds 1
;----------------------------------------------------
previousAngle
.DS MaxPlayers
previousEnergyL
.DS MaxPlayers
previousEnergyH
.DS MaxPlayers
RandBoundaryLow
.ds 2
RandBoundaryHigh
.ds 2
AngleTablePointer
.DS 1
singleRoundVarsEnd
;----------------------------------------------------
; 4x4 texts
;----------------------------------------------------
;LineAddress4x4 .DS 2
LineCharNr .DS 1
;LineXdraw .DS 2
;LineYdraw .DS 1
;-----------
ResultOfTankNr
.DS 1
;----------------------------------------------------
;PutChar4x4
;----------------------------------------------------
nibbler4x4 .DS 1
CharCode4x4 .DS 1
;plot4x4color .DS 1 ;1-white, 0-background
; This is moved from display.asm to be easier to relocate
ListOfWeapons
; 01234567890123456789012345678901
.ds number_of_offensives*32
ListOfWeapons1End
ListOfDefensiveWeapons
.ds number_of_defensives*32
ListOfDefensiveWeaponsEnd ;constant useful when clearing
track_variables
trackn_db .ds TRACKS
trackn_hb .ds TRACKS
trackn_idx .ds TRACKS
trackn_pause .ds TRACKS
trackn_note .ds TRACKS
trackn_volume .ds TRACKS
trackn_distor .ds TRACKS
trackn_shiftfrq .ds TRACKS
trackn_instrx2 .ds TRACKS
trackn_instrdb .ds TRACKS
trackn_instrhb .ds TRACKS
trackn_instridx .ds TRACKS
trackn_instrlen .ds TRACKS
trackn_instrlop .ds TRACKS
trackn_instrreachend .ds TRACKS
trackn_volumeslidedepth .ds TRACKS
trackn_volumeslidevalue .ds TRACKS
trackn_effdelay .ds TRACKS
trackn_effvibratoa .ds TRACKS
trackn_effshift .ds TRACKS
trackn_tabletypespeed .ds TRACKS
trackn_tablenote .ds TRACKS
trackn_tablea .ds TRACKS
trackn_tableend .ds TRACKS
trackn_tablelop .ds TRACKS
trackn_tablespeeda .ds TRACKS
trackn_command .ds TRACKS
trackn_filter .ds TRACKS
trackn_audf .ds TRACKS
trackn_audc .ds TRACKS
trackn_audctl .ds TRACKS
v_aspeed .ds 1
track_endvariables
ClearedvariablesEnd
; These tebles are at the beginning of memory pages becouse ....
bittable1_long
.ds $100
bittable2_long
.ds $100
; .... variablesEnd is aligned to PMGraph + $0300 in scorch.asm (before include this file)
variablesEnd
;----------------------------------------------------
.endif