Develop and Download Open Source Software

Browse CVS Repository

Contents of /autocoast/src/macros/TDFMacros.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Wed Nov 17 10:50:03 2004 UTC (19 years, 4 months ago) by tmurakam
Branch: MAIN
CVS Tags: v0_3, v0_2, HEAD
Changes since 1.1: +132 -32 lines
updated

1 ; TDFMacros.inc BGLC includes for Terrain Data File Masks, Polygons, and Lines inclusive of CFS2, FS2002 and FS9
2 ; Validated 12/17/2003
3
4 ; --------------------------------------------------------------------------------
5 ; --------------------------------------------------------------------------------
6
7 VTPFileHeader Macro Version, IndexHeader, Textures, End
8
9 LOCAL start
10 start LABEL word
11
12 DWORD 20 ; // Size of this header ( 20 bytes )
13 DWORD Version ; // Version ( must be 0x0100 )
14 SDWORD ( OFFSET IndexHeader ) - ( OFFSET start ) ; // Relative offset to index
15 SDWORD ( OFFSET Textures ) - ( OFFSET start ) ; // Relative offset of the Texture List Header
16 SDWORD ( OFFSET End ) - ( OFFSET start ) ; // Size of all data plus VTP headers
17
18 EndM
19
20 ; --------------------------------------------------------------------------------
21
22
23 VTPIndexHeader Macro NumberIndexEntries, Index, Data
24
25 LOCAL start
26 start Label word
27
28 DWORD 16 ; // Size of this header ( must be 16 )
29 DWORD NumberIndexEntries ; // Number of entries in the index
30 SDWORD ( OFFSET Index ) - ( OFFSET start ) ; // Relative offset to the index list
31 SDWORD ( OFFSET Data ) - ( OFFSET start ) ; // Relative offset to the data
32
33 EndM
34
35
36
37 ; --------------------------------------------------------------------------------
38
39 VTPIndexEntry Macro VTPCellID, start, Data, End
40
41 VTPCellID ; // ID for cell
42 SDWORD ( OFFSET Data ) - ( OFFSET start ) ; // Offset of data cell from VTPIndexHeader.lDataOffset
43 SDWORD ( OFFSET End ) - ( OFFSET Data ) ; // Size of data cell
44
45 EndM
46
47 ; --------------------------------------------------------------------------------
48
49 VTPCellID Macro Padding, U, V
50
51 ; DWORD m_dwPadding:12; // Reserved, must be zero
52 ; DWORD m_dwU:10; // The column ( from 0 to 767 ) in the 768x512 world grid
53 ; DWORD m_dwV:10; // The row ( from 0 to 511 )
54
55
56 DWORD ( V * 400000h ) + ( U * 1000h ) + Padding
57
58 EndM
59
60 ; --------------------------------------------------------------------------------
61
62 VTPTextureListHeader Macro NumberTextureEntries, Index, Data, End
63
64 LOCAL start
65 start LABEL WORD
66
67 DWORD 20 ; // Size of this header ( must be 20 )
68 DWORD NumberTextureEntries ; // Number of entries in the index, ( 0 to 127 )
69 SDWORD ( OFFSET Index ) - ( OFFSET start ) ; // Relative offset to the index list
70 SDWORD ( OFFSET Data ) - ( OFFSET start ) ; // Relative offset to the texture names
71 DWORD ( OFFSET End ) - ( OFFSET Data ) ; // Total size of all the texture names
72
73 EndM
74
75 ; --------------------------------------------------------------------------------
76
77 VTPTextureListEntry Macro Start, Data, End
78
79 DWORD ( OFFSET Data ) - ( OFFSET Start ) ; // Offset from the beginning of the name data
80 DWORD ( OFFSET End ) - ( OFFSET Data ) ; // Length of the filename in bytes including the terminating zero
81
82 EndM
83
84
85 ; --------------------------------------------------------------------------------
86
87 VTPTextureName Macro Name
88
89 BYTE Name
90 BYTE 0
91
92 EndM
93
94
95 ; --------------------------------------------------------------------------------
96
97 VTPTextureType Macro Type, HasEffect, Reserved, Size
98
99 ; UINT8 uType:4 ; // Type of formatting used in the texture file
100 ; UINT8 fHasEffect:1 ; // Flag for determining if an effect will be used.
101 ; UINT8 uReserved :3 ; // Unused, must be 0.
102 ; UINT8 uSize ; // Meters per pixel of source texture.
103
104 BYTE ( Reserved * 20h ) + ( HasEffect * 10h ) + Type
105 BYTE Size
106
107 EndM
108
109
110
111 ; --------------------------------------------------------------------------------
112
113 VTPTextureEffectName Macro EffectName
114
115
116 BYTE EffectName
117 BYTE 0
118
119 EndM
120
121
122
123 ; --------------------------------------------------------------------------------
124
125 VTPDataArea Macro LayerCount, AutoCalc, ZoneX, ZoneY
126
127 ; enum{ MaxLayerCount = 31 };
128 ; WORD wLayerCount:5; // The number of layers in this area up to 31
129 ; WORD wAutoCalc:1; // 0 = Method 1, 1 = Method 2
130 ; WORD wZoneX:5; // LOD8 position as 1/32nd of an LOD3 numbered 0-31 ( if VTP1, then LOD13 position as 1/32nd of LOD8 )
131 ; WORD wZoneY:5; // LOD8 position as 1/32nd of an LOD3 numbered 0-31 ( if VTP1, then LOD13 position as 1/32nd of LOD8 )
132
133 WORD ( ZoneY * 800h ) + ( ZoneX * 40h ) + ( AutoCalc * 20h ) + LayerCount
134
135 EndM
136
137
138 ; --------------------------------------------------------------------------------
139
140 VTPLayer Macro Layer, Replace
141
142 ; enum{ MaxLayer = 63 };
143 ; UINT8 bLayer:7; // The layer ID, from 0 to 63.
144 ; UINT8 bReplace:1; // 0 Coexist with existing data in the same layer // 1 Replace all previous data in the same layer
145
146 BYTE ( Replace * 80h ) + Layer
147
148 EndM
149
150
151 ; --------------------------------------------------------------------------------
152
153 VTPNumTexturesInLayer Macro TextureCount, Reserved
154
155 ; enum{ MaxNumTextures = 127 };
156 ; UINT8 bTextureCount:7; // From 0 to 127
157 ; UINT8 bReserved:1; // Reserved, must be 0
158
159 BYTE ( Reserved * 80h ) + TextureCount
160
161 EndM
162
163
164 ; --------------------------------------------------------------------------------
165
166 VTPTextureId Macro TextureID, Reserved
167
168 ; enum{ MaxTextureId = 127 };
169 ; UINT8 bTextureId:7; // From 0 to 127.
170 ; UINT8 bReserved:1; // Reserved, must be 0
171
172 BYTE ( Reserved * 80h ) + TextureID
173
174
175 EndM
176
177 ; --------------------------------------------------------------------------------
178
179 VTPPolyCount Macro Count, Extra
180
181 ; enum{ MaxCount = 127 };
182 ; UINT8 bCount:7; // From 0 to 127
183 ; UINT8 bReserved:1; // Extra... if set, VTPPolyCountEx must follow
184 BYTE ( Extra * 80h ) + Count
185
186 EndM
187
188 ; --------------------------------------------------------------------------------
189
190 VTPPolyCountEx Macro ExPointMult
191
192 BYTE ExPointMult; // extra multiples of 128 for the total vtp poly count
193
194 EndM
195
196 ; --------------------------------------------------------------------------------
197
198 VTPPolyMethod1 Macro PointCount, IsStrip, IsUVExplicit
199
200 ; enum{ MaxNumPoints = 62, PolyEx = MaxNumPoints+1 };
201 ; UINT8 bPointCount:6; // Up to 62 points, 63 means that this is an
202 ; extended poly
203 ; UINT8 bIsStrip:1; // 0 = Fan, 1 = Strip
204 ; UINT8 bIsUVExplicit:1; // MUST BE 1 = Points contain XYUV
205
206
207 BYTE ( IsUVExplicit * 80h ) + ( IsStrip * 40h ) + PointCount
208
209 EndM
210
211 ; --------------------------------------------------------------------------------
212
213
214
215
216 VTPPolyMethod1Ex Macro ExPointCount
217
218 ; enum{ MaxNumPointsEx = 63 + 127 };
219 ; UINT8 bExPointCount; // The number of points = 63 + bExPointCount
220
221
222 ; BYTE ExPointCount
223 WORD ExPointCount
224
225 EndM
226
227
228
229 ; --------------------------------------------------------------------------------
230
231
232 VTPPolyMethod2 Macro PointCount, IsLine, Reserved
233
234 ; enum{ MaxNumPoints = 30, PolyEx2 = MaxNumPoints+1 };
235 ; UINT8 bPointCount:5; // Up to 30 points, 31 means that this is an extended poly
236 ; UINT8 bIsLine:1; // 0 = Fan, 1 = Line
237 ; UINT8 bReserved:2; // reserved, must be 0
238
239 BYTE ( Reserved * 40h ) + ( IsLine * 20h ) + PointCount
240
241 EndM
242
243 ; --------------------------------------------------------------------------------
244
245 VTPPolyMethod2Ex Macro ExPointCount
246
247 ; enum{ MaxNumPointsEx = 31 + 127 };
248 ; UINT8 bExPointCount; // The number of points = 31 + bExPointCount
249
250 ; BYTE ExPointCount
251
252 WORD ExPointCount
253
254 EndM
255
256 ; --------------------------------------------------------------------------------
257
258 VTPPointXYUV Macro X, Y, U, V
259
260 BYTE X ; // The column offset in the area
261 BYTE Y ; // The row offset in the area
262 BYTE U ; // The column offset into the texture
263 BYTE V ; // The row offset into the texture
264
265
266 EndM
267
268
269 ; --------------------------------------------------------------------------------
270
271 VTPPointXY2 Macro X, Y
272
273 WORD X ; // The column offset in the area
274 WORD Y ; // The row offset in the area
275
276 EndM
277
278
279 ; --------------------------------------------------------------------------------
280
281 VTPWidePoint Macro X, UseWidth, Y, Reserved
282
283 ; DWORD uX:14; // The column offset in the area
284 ; DWORD uUseWidth:1; // determines if a new width should be used with this point
285 ; DWORD uY:14; // The row offset in the area
286 ; DWORD uReserved:3; // this is reserved and must be set to 0
287
288 DWORD ( Reserved * 20000000h ) + ( Y * 8000h ) + ( UseWidth * 4000h ) + X
289
290 EndM
291
292 ; --------------------------------------------------------------------------------
293
294 VTPChildPoint Macro X, Reserved, Y, UseWidth
295
296 BYTE ( ( X AND 07Fh ) * 2 ) + UseWidth
297 BYTE ( ( X AND 0780h ) / 80h ) + ( Reserved * 10h ) + ( ( Y AND 07h ) * 20h )
298 BYTE ( ( Y AND 07F8h ) / 08h )
299
300 EndM
301
302 ; --------------------------------------------------------------------------------
303
304 VTPWidePointWidth Macro Width
305
306 BYTE Width ; // the width to use when rebuilding the vector data
307
308 EndM
309
310
311 ; --------------------------------------------------------------------------------
312
313 LWMFileHeader Macro Version, IndexHeader, Data, End
314
315 LOCAL start
316 start LABEL word
317
318 DWORD 20 ; // Size of this header ( 20 bytes )
319 DWORD Version ; // Version ( 100h is CFS2 201h is FS2002 300h is FS9 )
320 SDWORD ( OFFSET IndexHeader ) - ( OFFSET start ) ; // Relative offset to index
321 SDWORD ( OFFSET Data ) - ( OFFSET start ) ; // Relative offset to data
322 SDWORD ( OFFSET End ) - ( OFFSET start ) ; // Size of all data plus headers
323
324 ENDM
325
326 ; --------------------------------------------------------------------------------
327
328
329 LWMIndexHeader Macro NumberIndexEntries, Index
330
331 LOCAL start
332 start Label word
333
334 DWORD 12 ; // Size of this header ( 12 bytes )
335 DWORD NumberIndexEntries ; // Number of entries in the index
336 SDWORD ( OFFSET Index ) - ( OFFSET start ) ; // Relative offset to the index data
337
338 ENDM
339 ; --------------------------------------------------------------------------------
340
341
342 LWMIndexEntry Macro LWMCellID, start, Data, End
343
344 LWMCellID ; // Location and default attributes or the cell
345 SDWORD ( OFFSET Data ) - ( OFFSET start ) ; // Offset from the beginning of the data block
346 SDWORD ( OFFSET End ) - ( OFFSET Data ) ; // Size of data block
347
348 EndM
349
350 ; --------------------------------------------------------------------------------
351
352
353 LWMCellID Macro RunCount, IndexRun, Attrib, U, V
354
355 ; DWORD dwRunCount:9 ; // Number of identical indices
356 ; DWORD dwIndexRun:1 ; // If this 0 = single index, 1 = a series of indices
357 ; DWORD dwAttrib:2 ; // The fill attribute 0 = water, 1 = land,
358 ; ; // 2 = flatten only, 3 = transparent
359 ; DWORD dwU:10 ; // The column ( from 0 to 767 ) in the 768x512 world grid
360 ; DWORD dwV:10 ; // The row ( from 0 to 511 )
361
362 DWORD ( V * 400000h ) + ( U * 1000h ) + ( Attrib * 400h ) + ( IndexRun * 200h ) + RunCount
363
364 EndM
365
366 ; --------------------------------------------------------------------------------
367
368
369 LWMDataAreaFill1x1 Macro Reserved, Attrib, Flag, Col, Row
370
371 ; WORD wReserved:3; // Must be 0
372 ; WORD wAttrib:2; // 0 = water, 1 = land, 2 = flatten
373 ; WORD wFlag:1; // Must be 1
374 ; WORD wCol:5; // Column ( 0-31 )
375 ; WORD wRow:5; // Row ( 0-31 )
376
377 WORD ( Row * 800h ) + ( Col * 40h ) + ( Flag * 20h ) + ( Attrib * 8h ) + Reserved
378
379 EndM
380
381 ; --------------------------------------------------------------------------------
382
383
384 LWMDataAreaFill2x2 Macro Reserved, Attrib, ZeroPad1, Flag, Col, ZeroPad2, Row
385
386 ; WORD wReserved:3; // Must be 0
387 ; WORD wAttrib:2; // 0 = water, 1 = land, 2 = flatten
388 ; WORD wZeroPad1:1; // Must be 0
389 ; WORD wFlag:1; // Must be 1
390 ; WORD wCol:4; // Column ( 0-15 )
391 ; WORD wZeroPad2:1; // Must be 0
392 ; WORD wRow:4; // Row ( 0-15 )
393
394 WORD ( Row * 1000h ) + ( ZeroPad2 * 800h ) + ( Col * 80h ) + ( Flag * 40h ) + ( ZeroPad1 * 20h ) + ( Attrib * 8h ) + Reserved
395 EndM
396
397 ; --------------------------------------------------------------------------------
398
399
400 LWMDataAreaFill4x4 Macro Reserved, Attrib, ZeroPad1, Flag, Col, ZeroPad2, Row
401
402 ; WORD wReserved:3; // Must be 0
403 ; WORD wAttrib:2; // 0 = water, 1 = land, 2 = flatten
404 ; WORD wZeroPad1:2; // Must be 0
405 ; WORD wFlag:1; // Must be 1
406 ; WORD wCol:3; // Column ( 0-7 )
407 ; WORD wZeroPad2:2; // Must be 0
408 ; WORD wRow:3; // Row ( 0-7 )
409
410 WORD ( Row * 2000h ) + ( ZeroPad2 * 800h ) + ( Col * 100h ) + ( Flag * 80h ) + ( ZeroPad1 * 20h ) + ( Attrib * 8h ) + Reserved
411 EndM
412
413 ; --------------------------------------------------------------------------------
414
415
416 LWMDataAreaFill8x8 Macro Reserved, Attrib, ZeroPad1, Flag, Col, ZeroPad2, Row
417
418 ; WORD wReserved:3; // Must be 0
419 ; WORD wAttrib:2; // 0 = water, 1 = land, 2 = flatten
420 ; WORD wZeroPad1:3; // Must be 0
421 ; WORD wFlag:1; // Must be 1
422 ; WORD wCol:2; // Column ( 0-3 )
423 ; WORD wZeroPad2:3; // Must be 0
424 ; WORD wRow:2; // Row ( 0-3 )
425
426 WORD ( Row * 4000h ) + ( ZeroPad2 * 800h ) + ( Col * 200h ) + ( Flag * 100h ) + ( ZeroPad1 * 20h ) + ( Attrib * 8h ) + Reserved
427
428 EndM
429
430 ; --------------------------------------------------------------------------------
431
432
433 LWMDataAreaFill16x16 Macro Reserved, Attrib, ZeroPad1, Flag, Col, ZeroPad2, Row
434
435 ; WORD wReserved:3; // Must be 0
436 ; WORD wAttrib:2; // 0 = water, 1 = land, 2 = flatten
437 ; WORD wZeroPad1:4; // Must be 0
438 ; WORD wFlag:1; // Must be 1
439 ; WORD wCol:1; // Column ( 0-1 )
440 ; WORD wZeroPad2:4; // Must be 0
441 ; WORD wRow:1; // Row ( 0-1 )
442
443 WORD ( Row * 8000h ) + ( ZeroPad2 * 800h ) + ( Col * 400h ) + ( Flag * 200h ) + ( ZeroPad1 * 20h ) + ( Attrib * 8h ) + Reserved
444
445 EndM
446
447 ; --------------------------------------------------------------------------------
448
449
450 LWMDataAreaHeight Macro Height, Fraction
451
452 SWORD Height ; // integer height in meters -9999 is no height data!
453 BYTE Fraction ; // number of 1/128 meter fractions to add to Height Zero if no height data!
454
455 EndM
456
457 ; --------------------------------------------------------------------------------
458
459
460 LWMDataAreaDrawPolygons Macro PolyCount, Attrib, Flag, Col, Row
461
462 ; WORD wPolyCount:3 ; // The number of polygons up to 6. For 7 or more, use LWMDataAreaDrawPolygonsEx
463 ; WORD wAttrib:2 ; // Must be 3
464 ; WORD wFlag:1 ; // Must be 1!
465 ; WORD wCol:5 ; // Column, 0 to 31
466 ; WORD wRow:5 ; // Row, 0 to 31
467
468 WORD ( Row * 800h ) + ( Col * 40h ) + ( Flag * 20h ) + ( Attrib * 8h ) + PolyCount
469
470 EndM
471
472 ; --------------------------------------------------------------------------------
473
474
475 LWMDataAreaDrawPolygonsEx Macro PolyExFlag, Attrib, Flag, Col, Row, ExPolyCount
476
477 ; WORD wPolyExFlag:3 ; // Must be 7.
478 ; WORD wAttrib:2 ; // Must be 3 ( transparent )
479 ; WORD wFlag:1 ; // Must be 1!
480 ; WORD wCol:5 ; // Column, 0 to 31.
481 ; WORD wRow:5 ; // Row, 0 to 31.
482
483 WORD ( Row * 800h ) + ( Col * 40h ) + ( Flag * 20h ) + ( Attrib * 8h ) + PolyExFlag
484 BYTE ExPolyCount ; // The number of polygons = 7 + ExPolyCount
485
486 EndM
487
488 ; --------------------------------------------------------------------------------
489
490
491 LWMPoly3 Macro PointCount, Reserved, Attrib, HeightBottom, FractionBottom, HeightTop, FractionTop
492
493 ; Used in version 300h for FS9
494 ; BYTE bPointCount:6 ; // Up to 62 points
495 ; BYTE bReserved:1 ; // Must be 0
496 ; BYTE bAttrib:1 ; // Polygon fill attribute, 0 = water, 1 = land
497
498 BYTE ( Attrib * 80h ) + ( Reserved * 40h ) + PointCount
499
500 SWORD HeightBottom ; // Whole elevation value in meters
501 BYTE FractionBottom ; // Fractional elevation value in 1/128 meters
502 SWORD HeightTop ; // Whole elevation value in meters
503 BYTE FractionTop ; // Fractional elevation value in 1/128 meters
504
505
506 EndM
507
508 ; --------------------------------------------------------------------------------
509
510
511 LWMPoly3Ex Macro PointCount, Reserved, Attrib, HeightBottom, FractionBottom, HeightTop, FractionTop, ExPointCount
512
513 ; BYTE bPointCount:6 ; // Must be 63
514 ; BYTE bReserved:1 ; // Must be 0
515 ; BYTE bAttrib:1 ; // Polygon fill attribute, 0 = water, 1 = land
516
517 BYTE ( Attrib * 80h ) + ( Reserved * 40h ) + PointCount
518
519 SWORD HeightBottom ; // Whole elevation value in meters
520 BYTE FractionBottom ; // Fractional elevation value in 1/128 meters
521 SWORD HeightTop ; // Whole elevation value in meters
522 BYTE FractionTop ; // Fractional elevation value in 1/128 meters
523
524 BYTE ExPointCount ; // Number of polygon points = 63 + bExPointCount
525
526 EndM
527
528 ; --------------------------------------------------------------------------------
529
530
531 LWMPoint3 Macro x, y, z
532
533 BYTE x ;
534 BYTE y ;
535 BYTE z ; 0-255 fraction of difference between HeightBottom and HeightTop of LWMPoly3
536
537 EndM
538
539 ; --------------------------------------------------------------------------------
540
541
542 LWMPoly2 Macro PointCount, Reserved, Attrib, Height, Fraction
543
544 ; Used in version 201h for FS2002
545 ; BYTE bPointCount:6 ; // Up to 62 points
546 ; BYTE bReserved:1 ; // Must be 0
547 ; BYTE bAttrib:1 ; // Polygon fill attribute, 0 = water, 1 = land
548
549 BYTE ( Attrib * 80h ) + ( Reserved * 40h ) + PointCount
550
551 SWORD Height ; // Whole elevation value in meters
552 BYTE Fraction ; // Fractional elevation value in 1/128 meters
553
554 EndM
555
556 ; --------------------------------------------------------------------------------
557
558
559 LWMPoly2Ex Macro PointCount, Reserved, Attrib, Height, Fraction, ExPointCount
560
561 ; BYTE bPointCount:6 ; // Must be 63
562 ; BYTE bReserved:1 ; // Must be 0
563 ; BYTE bAttrib:1 ; // Polygon fill attribute, 0 = water, 1 = land
564
565 BYTE ( Attrib * 80h ) + ( Reserved * 40h ) + PointCount
566
567 SWORD Height
568 BYTE Fraction ;
569 BYTE ExPointCount ; // Number of polygon points = 63 + bExPointCount
570
571 EndM
572
573 ; --------------------------------------------------------------------------------
574
575
576 LWMPoint Macro x, y
577
578 BYTE x ;
579 BYTE y ;
580
581 EndM
582
583 ; --------------------------------------------------------------------------------
584
585
586 LWMPoly1 Macro PointCount, Reserved, Attrib
587
588 ; Used in version 100h for CFS2
589 ; BYTE bPointCount:6 ; // Up to 62 points
590 ; BYTE bReserved:1 ; // Must be 0
591 ; BYTE bAttrib:1 ; // Polygon fill attribute, 0 = water, 1 = land
592
593 BYTE ( Attrib * 80h ) + ( Reserved * 40h ) + PointCount
594
595 EndM
596
597 ; --------------------------------------------------------------------------------
598
599
600
601 LWMPoly1Ex Macro PointCount, Reserved, Attrib, ExPointCount
602
603 ; BYTE bPointCount:6; // Must be 63
604 ; BYTE bReserved:1; // Must be 0
605 ; BYTE bAttrib:1; // Poly Fill attribute 0 = water, 1 = land
606 ; BYTE bExPointCount; // The number of points = 63 + bExPointCount
607
608
609
610 BYTE ( Attrib * 80h ) + ( Reserved * 40h ) + PointCount
611 BYTE ExPointCount ; // Number of polygon points = 63 + bExPointCount
612
613 EndM
614
615 ; --------------------------------------------------------------------------------

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26