-
Notifications
You must be signed in to change notification settings - Fork 2
/
Full New AFD.h
1448 lines (1269 loc) · 43.9 KB
/
Full New AFD.h
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
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
///////////////////////////////////////////////////////////
// 56 bytes initial header
///////////////////////////////////////////////////////////
typedef struct _tag_facdata_hdr
{
WORD wStamp; // 0 0x0201
WORD nUnk1; // 2 unknown 0x1992 (maybe FS2004 version number)
WORD size; // 4 0x0038
WORD wResvd1; // 6 reserved (0x0000)
BYTE szCrc[6]; // 8 48-bits CRC or what ???
BYTE szUnk1[2]; // 14 always 0xC301
int nMagic; // 16 magic number ? - 13451555
DWORD nObjects; // 20 number of object groups within file
int nLatMax; // 24 latitude max ???
int nLatMin; // 28 latitude min ???
int nLonMax; // 32 longitude max ???
int nLonMin; // 36 longitude min ???
int nUnk2; // 40 unknown integer 2
int nUnk3; // 44 unknown integer 3
BYTE lpResvd[8]; // 48 reserved, always 0x0 ?
} NBGLHDR;
typedef struct _tag_objs
{ DWORD unk;
int chunkctr;
DWORD chunkoff;
DWORD chunksize;
} NOBJ;
// Objects IDs
#define OBJTYPE_AIRPORT_MSFS 0x0056
#define OBJTYPE_AIRPORT 0x0003
#define OBJTYPE_RUNWAY 0x0004
#define OBJTYPE_VOR 0x0013
#define OBJTYPE_DME 0x0016
#define OBJTYPE_NDB 0x0017
#define OBJTYPE_MKB 0x0018
#define OBJTYPE_BOUNDARY 0x0020
#define OBJTYPE_WPT 0x0022
#define OBJTYPE_GEOPOL 0x0023
#define OBJTYPE_SCNOBJ 0x0025
#define OBJTYPE_REGIONINF 0x0027
#define OBJTYPE_MDLDATA 0x002B
#define OBJTYPE_EXCREC 0x002E
/*
* at offset 56 dec we find the object groups table
* array of 20 bytes size structures
* number of groups is defined by nObjects field
* of BGL header structure
*/
typedef struct tag_obj_table_group
{
DWORD nObjType; // 0 object type, see constansts above
DWORD nUnk1; // 4 unknown integer 1
DWORD nGroupsCount; // 8 number of object groups
DWORD nGroupOffset; // 12 absolute pointer to groups info table
DWORD nTableSize; // 16 size of info table array pointed by nGroupOffset
} NSECTS;
#define MAXSOUTH 536870912
#define MAXEAST 805306368
#define NDB_MAXSOUTH MAXSOUTH
#define NDB_MAXEAST MAXEAST
#define VOR_MAXSOUTH NDB_MAXSOUTH
#define VOR_MAXEAST NDB_MAXEAST
// the following structure appears as a header before each navaids
// description
typedef struct tag_chr_hdr_t
{
WORD wId; // always 0x0019
int nStrLen; // length of name string
} name_hdr_t;
// NDB info
#define NDB_COMPASS_POINT 0x0000
#define NDB_MH 0x0001
#define NDB_H 0x0002
#define NDB_HH 0x0003
typedef struct tag_ndb_t
{
WORD wType; // navaid type - 0x17 for ndb
DWORD nLen; // length of record in bytes
WORD wNdbType; // ndb type, compass_point, h, etc.
int nFreq; // navaid frequency * 1000
int nLon; // packed longitude
int nLat; // packed latitude
int nAlt; // navaid altitude, meters * 1000
float fRange; // navaid range
float fMagVar; // magnetic deviation
char szId[4]; // encrypted navaid ID
char szRegion[4]; // encrypted navaid Region
name_hdr_t lpNameInfo; // name info header
} ndb_t;
// VOR info
#define VOR_TERMINAL 0x01
#define VOR_LOW 0x02
#define VOR_HIGH 0x03
#define VOR_ILS 0x04
#define VOR_VOT 0x05
typedef struct tag_vor_t
{
WORD wType; // 0 navaid type - 0x13 for vor
DWORD nLen; // 2 length of record in bytes
BYTE bType; // 6 type
BYTE bFlags; // 7 various flags - default 0x10, BIT_DME_ONLY or'ed
int nLon; // 8 packed longitude
int nLat; // 12 packed latitude
int nAlt; // 16 altitude, meters * 1000
int nFreq; // 20 navaid frequency * 1000
float fRange; // 24 vor range
float fMagVar; // 28 magnetic deviation
char szId[4]; // 32 encrypted navaid ID
char szRegion[4]; // 36 encrypted navaid Region
WORD wDmeType; // 40 navaid type - 0x1600 for DME
int nDmeLen; // 42 length of record in bytes
WORD wUnk1; // 46 unknown word 1 - maybe used for 32 bits padding
int nDmeLon; // 48 packed DME longitude
int nDmeLat; // 52 packed DME latitude
int nDmeAlt; // 56 DME altitude * 1000
float fDmeRange; // 60 DME Range
name_hdr_t lpNameInfo; // 64 name info header
} NVOR;
// marker info
#define MKB_INNER 0x00
#define MKB_MIDDLE 0x01
#define MKB_OUTER 0x02
#define MKB_BACKCOURSE 0x03
typedef struct tag_mkb_t
{
WORD wType; // navaid type - 0x18 for marker
WORD wLen; // length of record in bytes
BYTE bReserved; // reserved - always 0x0
WORD wHeading; // heading in pseudo degrees
BYTE bMkbType; // marker type, inner, outer, etc.
int nLon; // packed longitude
int nLat; // packed latitude
int nAlt; // altitude, meters * 1000
int nId; // encrypted navaid ID
int nRegion; // encrypted navaid Region
} mkb_t;
// waypoint info
#define WPT_NAMED 0x01
#define WPT_UNNAMED 0x02
#define WPT_VOR 0x03
#define WPT_NDB 0x04
#define WPT_OFFROUTE 0x05
#define WPT_IAF 0x06
#define WPT_FAF 0x07
typedef struct tag_wpt_t
{
WORD wType; // navaid type - 0x22 for waypoint
DWORD nLen; // length of record in bytes
BYTE bWptKind; // waypoint type, NAMED, UNNAMED, etc.
BYTE bHasRoute; // waypoint has nested route (0x0 or 0x1)
int nLon; // packed longitude
int nLat; // packed latitude
float fMagVar; // magvar (courtesy of Marco Sinchetto)
int nId; // encrypted navaid ID
int nRegion; // encrypted navaid Region
} wpt_t;
// routes are nested immediately after waypoints
#define RTE_VICTOR 0x01
#define RTE_JET 0x02
#define RTE_BOTH 0x03
typedef struct tag_route_t
{
BYTE bType; // route type
char szName[8]; // route name
int nPrevId; // next wayp. encrypted ID
int nPrevRegion; // next wayp. encrypted Region
float fPrevAltitude; // next wayp. altitude in meters
int nNextId; // next wayp. encrypted ID
int nNextRegion; // next wayp. encrypted Region
float fNextAltitude; // next wayp. altitude in meters
BYTE bReserved[3]; // padded with 0x0
} route_t;
// boundary info
#define BOUNDARY_NONE 0x00
#define BOUNDARY_CENTER 0x01
#define BOUNDARY_CLASS_A 0x02
#define BOUNDARY_CLASS_B 0x03
#define BOUNDARY_CLASS_C 0x04
#define BOUNDARY_CLASS_D 0x05
#define BOUNDARY_CLASS_E 0x06
#define BOUNDARY_CLASS_F 0x07
#define BOUNDARY_CLASS_G 0x08
#define BOUNDARY_TOWER 0x09
#define BOUNDARY_CLEARANCE 0x0A
#define BOUNDARY_GROUND 0x0B
#define BOUNDARY_DEPARTURE 0x0C
#define BOUNDARY_APPROACH 0x0D
#define BOUNDARY_MOA 0x0E
#define BOUNDARY_RESTRICTED 0x0F
#define BOUNDARY_PROHIBITED 0x10
#define BOUNDARY_WARNING 0x11
#define BOUNDARY_ALERT 0x12
#define BOUNDARY_DANGER 0x13
#define BOUNDARY_NATIONAL_PARK 0x14
#define BOUNDARY_MODEC 0x15
#define BOUNDARY_RADAR 0x16
#define BOUNDARY_TRAINING 0x17
#define BOUNDARY_ALT_UNKNOWN 0x01
#define BOUNDARY_ALT_MSL 0x01
#define BOUNDARY_ALT_AGL 0x02
#define BOUNDARY_ALT_UNLIMITED 0x03
// boundary (0x20)
typedef struct tag_boundary_t
{
WORD wType; // navaid type - 0x20 for boundary
DWORD nLen; // length of record in bytes
BYTE bBoundaryKind; // boundary type, ALERT, APPROACH, etc.
BYTE bAltKind; // low part stores min_alt kind, high part stores max
int nMinLon; // packed longitude
int nMinLat; // packed latitude
int nMinAlt; // altitude * 1000
int nMaxLon; // packed longitude
int nMaxLat; // packed latitude
int nMaxAlt; // altitude * 1000
WORD wNameId; // name id, 0x19
DWORD nNameLen; // name length + 2 ?
} boundary_t;
// origin (0x21)
typedef struct tag_origin_t
{
WORD wType; // 0000 - navaid type (0x21)
DWORD nLen; // 0002 - length of record in bytes
WORD wCount; // 0006 - count of origin entries
WORD wUnk1; // 0008 - unknown word 1;
} origin_t;
// after this, follows an array of (lat/lon/terminator) whose size is
// defined by the wCount field. This differs from other entries
// for lat comes first, lon comes second. terminator is a 16 bits integer
#pragma pack(push, 1)
// color structure
typedef struct tag_rgba_t
{
BYTE b;
BYTE g;
BYTE r;
BYTE a;
} rgba_t;
// scenery complexity
#define COMPLEXITY_VERY_SPARSE 0x00000000
#define COMPLEXITY_SPARSE 0x00000001
#define COMPLEXITY_NORMAL 0x00000002
#define COMPLEXITY_DENSE 0x00000003
#define COMPLEXITY_VERY_DENSE 0x00000004
#define COMPLEXITY_EXTREMELY_DENSE 0x00000005
// scenery object IDs
#define SCNOBJ_BUILDING 0x0001
#define SCNOBJ_LIBRARY_OBJ 0x0002
#define SCNOBJ_WINDSOCK 0x0003
#define SCNOBJ_EFFECT 0x0004
#define SCNOBJ_TRIGGER 0x0007
// object header, common to all objects
typedef struct tag_objheader_t
{
WORD wId; // object ID
WORD wRecLen; // record length in bytes
int nLon; // packed longitude
int nLat; // packed latitude
int nAlt; // altitude * 1000
WORD bAltIsAgl; // altitude is AGL
WORD wPitch; // pitch in pseudo-degrees
WORD wBank; // bank in pseudo-degrees
WORD wHeading; // heading in pseudo-degrees
int nComplexity; // image complexity
} objheader_t;
// library object structure - 20 bytes
typedef struct tag_libobj_t
{
DWORD lpGuid[4]; // object 128-bit GUID
float fScale; // object scale
} libobj_t;
// windsock structure - 18 bytes
typedef struct tag_windsock_t
{
float fPoleHeight; // pole height
float fSockLength; // sock length
rgba_t lpPoleColor; // pole color RGB
rgba_t lpSockColor; // sock color RGB
WORD wLighted; // windsock lighted, true or false
} windsock_t;
typedef struct tag_effect_t
{
char szName[80]; // effect name
char *pszParam; // effect parameters (dynamically alloc'ed)
} effect_t;
#define TRIGGER_REFUEL_REPAIR 0x0000
#define TRIGGER_WEATHER 0x0001
#define TWEATHER_RIDGE_LIFT 0x0001
#define TWEATHER_NONDIRECTIONAL_TURBULENCE 0x0002
#define TWEATHER_DIRECTIONAL_TURBULENCE 0x0003
#define TWEATHER_THERMAL 0x0004
typedef struct tag_trigger_weather_t
{
WORD wId; // trigger ID (0x0001)
float fHeight; // trigger height
WORD wWeatherType; // weather type, THERMAL, etc.
float fDataHdg; // weather data heading
float fDataScalar; // weather data scalar
int nVertexCount; // number of vertex
} trigger_weather_t;
// after the above, an array of X,Z points in single point format
// follows - size of array is stored in the nVertexCount field
typedef struct tag_trigger_vertex_t
{
float fBiasX;
float fBiasZ;
} trigger_vertex_t;
typedef struct tag_trigger_refuel_t
{
WORD wId; // trigger ID (0x0000)
float fHeight; // trigger height
DWORD nAvailability; // fuel kind and availability
BYTE bFiller[10]; // 10 bytes data filler
} trigger_refuel_t;
// building structures
#define BLDG_FLAT_ROOF 0x0004
#define BLDG_RIDGE_ROOF 0x0006
#define BLDG_PEAKED_ROOF 0x0007
#define BLDG_SLANT_ROOF 0x0008
#define BLDG_PYRAMIDAL 0x0009
#define BLDG_MULTISIDED 0x000A
// the building header
typedef struct tag_building_hdr_t
{
float fScale; // scale of building
WORD wUnk1; // unknown WORD - offset to end of chunk ?
WORD wChunkLen; // length of building chunk
WORD wId; // building ID
} building_hdr_t;
// the rectangular building with flat roof
typedef struct tag_rect_bldgfr_t
{
WORD wSizeX; // size X
WORD wSizeZ; // size Z
WORD wBottomTexture; // bottom texture
WORD wSizeBottomY; // Size Bottom Y
WORD wTextIdxBottomX; // texture index bottom X
WORD wTextIdxBottomZ; // texture index bottom Z
WORD wWindowTexture; // window texture
WORD wSizeWindowY; // size window Y
WORD wTextIdxWindowX; // texture index Window X
WORD wTextIdxWindowY; // texture index Window Y
WORD wTextIdxWindowZ; // texture index Window Z
WORD wTopTexture; // top texture
WORD wSizeTopY; // size top Y
WORD wTextIdxTopX; // texture index top X
WORD wTextIdxTopZ; // texture index top Z
WORD wRoofTexture; // roof texture
WORD wTextIdxRoofX; // texture index top X
WORD wTextIdxRoofZ; // texture index top Z
WORD wUnk5; // unknown word 4 - 0x22
} rect_bldgfr_t;
// the rectangular building with peaked roof
typedef struct tag_rect_bldgpr_t
{
WORD wSizeX; // size X
WORD wSizeZ; // size Z
WORD wBottomTexture; // bottom texture
WORD wSizeBottomY; // size bottom Y
WORD wTextIdxBottomX; // texture index bottom X
WORD wTextIdxBottomZ; // texture index bottom Z
WORD wWindowTexture; // window texture
WORD wSizeWindowY; // size window Y
WORD wTextIdxWindowX; // texture index Window X
WORD wTextIdxWindowY; // texture index Window Y
WORD wTextIdxWindowZ; // texture index Window Z
WORD wTopTexture; // unknown word 3 - 0x44
WORD wSizeTopY; // size top Y
WORD wTextIdxTopX; // texture index top X
WORD wTextIdxTopZ; // texture index top Z
WORD wRoofTexture; // unknown word 4 - 0x19
WORD wTextIdxRoofX; // texture index roof X
WORD wTextIdxRoofZ; // texture index roof Z
WORD wSizeRoofY; // size roof Y
WORD wTextIdxRoofY; // texture index roof Y
WORD wUnk5; // unknown word 5 - 0x22
} rect_bldgpr_t;
// the rectangular building with ridge roof
typedef struct tag_rect_bldgrr_t
{
WORD wSizeX; // size X
WORD wSizeZ; // size Z
WORD wBottomTexture; // bottom texture
WORD wSizeBottomY; // Size Bottom Y
WORD wTextIdxBottomX; // texture index bottom X
WORD wTextIdxBottomZ; // texture index bottom Z
WORD wWindowTexture; // window texture
WORD wSizeWindowY; // Size Window Y
WORD wTextIdxWindowX; // texture index Window X
WORD wTextIdxWindowY; // texture index Window Y
WORD wTextIdxWindowZ; // texture index Window Z
WORD wTopTexture; // top texture
WORD wSizeTopY; // size top Y
WORD wTextIdxTopX; // texture index top X
WORD wTextIdxTopZ; // texture index top Z
WORD wRoofTexture; // roof texture
WORD wTextIdxRoofX; // texture index roof X
WORD wTextIdxRoofZ; // texture index roof Z
WORD wSizeRoofY; // size roof Y
WORD wTextIdxGableY; // gable texture index Y
WORD wGableTexture; // gable texture
WORD wTextIdxGableZ; // gable texture index Z
WORD wUnk5; // unknown word 5 - 0x22
} rect_bldgrr_t;
// the rectangular building with slant roof
typedef struct tag_rect_bldgsr_t
{
WORD wSizeX; // size X
WORD wSizeZ; // size Z
WORD wBottomTexture; // bottom texture
WORD wSizeBottomY; // size bottom Y
WORD wTextIdxBottomX; // texture index bottom X
WORD wTextIdxBottomZ; // texture index bottom Z
WORD wWindowTexture; // window texture
WORD wSizeWindowY; // size window Y
WORD wTextIdxWindowX; // texture index Window X
WORD wTextIdxWindowY; // texture index Window Y
WORD wTextIdxWindowZ; // texture index Window Z
WORD wTopTexture; // unknown word 3 - 0x44
WORD wSizeTopY; // size top Y
WORD wTextIdxTopX; // texture index top X
WORD wTextIdxTopZ; // texture index top Z
WORD wRoofTexture; // unknown word 4 - 0x19
WORD wTextIdxRoofX; // texture index roof X
WORD wTextIdxRoofZ; // texture index roof Z
WORD wSizeRoofY; // size roof Y
WORD wTextIdxGableY; // gable texture index Y
WORD wGableTexture; // gable texture
WORD wTextIdxGableZ; // gable texture index Z
WORD wFaceTexture; // face texture
WORD wTextIdxFaceX; // texture index face X
WORD wTextIdxFaceY; // texture index face Y
WORD wUnk5; // unknown word 5 - 0x22
} rect_bldgsr_t;
// the pyramidal building
typedef struct tag_pyram_bldg_t
{
WORD wSizeX; // size X
WORD wSizeZ; // size Z
WORD wSizeTopX; // size top X
WORD wSizeTopZ; // size top Z
WORD wBottomTexture; // bottom texture
WORD wSizeBottomY; // size bottom Y
WORD wTextIdxBottomX; // texture index bottom X
WORD wTextIdxBottomZ; // texture index bottom Z
WORD wWindowTexture; // unknown word 2 - 0x29
WORD wSizeWindowY; // Size Window Y
WORD wTextIdxWindowX; // texture index Window X
WORD wTextIdxWindowY; // texture index Window Y
WORD wTextIdxWindowZ; // texture index Window Z
WORD wTopTexture; // unknown word 3 - 0x44
WORD wSizeTopY; // size top Y
WORD wTextIdxTopX; // texture index top X
WORD wTextIdxTopZ; // texture index top Z
WORD wRoofTexture; // unknown word 4 - 0x19
WORD wTextIdxRoofX; // texture index roof X
WORD wTextIdxRoofZ; // texture index roof Z
WORD wUnk5; // unknown word 5 - 0x22
} pyram_bldg_t;
// the multisided building
typedef struct tag_ms_bldg_t
{
WORD wSidesCount; // # of sides
WORD wSizeX; // size X
WORD wSizeZ; // size Z
WORD wBottomTexture; // bottom texture ?
WORD wSizeBottomY; // Size Bottom Y
WORD wTextIdxBottomX; // texture index bottom X
WORD wWindowTexture; // window texture
WORD wSizeWindowY; // size window Y
WORD wTextIdxWindowX; // texture index Window X
WORD wTextIdxWindowY; // texture index Window Y
WORD wTopTexture; // top texture
WORD wSizeTopY; // size top Y
WORD wTextIdxTopX; // texture index top X
WORD wRoofTexture; // roof texture
WORD wSizeRoofY; // size roof Y
WORD wTextIdxRoofX; // texture index roof X
WORD wTextIdxRoofZ; // texture index roof Z
WORD wUnk5; // unknown word 5 - 0x22
} ms_bldg_t;
#pragma pack(pop)
// exclusion rectangle structure
#define BIT_EXCLUDE_ALL 0x08
#define BIT_EXCLUDE_BEACON 0x10
#define BIT_EXCLUDE_EFFECT 0x20
#define BIT_EXCLUDE_BUILDING 0x40
#define BIT_EXCLUDE_LIBOBJ 0x80
#define BIT_EXCLUDE_TAXIWAY 0x01
#define BIT_EXCLUDE_TRIGGER 0x02
#define BIT_EXCLUDE_WINDSOCK 0x04
typedef struct tag_excrec_t
{
WORD wFlags; // exclusion flags, see above
// low byte stores beacon to libobj
// high byte stores taxiway to windsock
WORD wFiller; // filler
int nLonMin; // minimum longitude, packed format
int nLatMax; // maximum latitude, packed format
int nLonMax; // maximum longitude, packed format
int nLatMin; // minimum latitude, packed format
} excrec_t;
// airport structure
typedef struct tag_airport_t
{
WORD wId; // 0 record ID (0x3)
DWORD nLen; // 2 length of record (32 bits)
BYTE lpUnk[6]; // 6 filled with 0 ???
int nLon; // 12 longitude, packed format
int nLat; // 16 latitude, packed format
int nAlt; // 20 altitude * 1000
int nTowerLon; // 24 tower longitude, courtesy of Marco Sinchetto
int nTowerLat; // 28 tower latitude
int nTowerAlt; // 32 tower altitude meters * 1000
float fMagVar; // 36 magnetic deviation
DWORD nId; // 40 packed ICAO ID (0 = 65)
int nUnk4; // 44 unknown integer 4
DWORD nServices; // 48 services, if any, otherwise 0x0
} NAPT;
// string-z airport name follows
// airport sub-entries
#define APTENTRY_COMM 0x0012
#define APTENTRY_RUNWAY 0x0004
#define APTENTRY_HELIPAD 0x0026
#define APTENTRY_DELAPT 0x0033
#define SURFACE_CEMENT 0x0000
#define SURFACE_CONCRETE 0x0000
#define SURFACE_GRASS 0x0001
#define SURFACE_WATER 0x0002
#define SURFACE_ASPHALT 0x0004
#define SURFACE_CLAY 0x0007
#define SURFACE_SNOW 0x0008
#define SURFACE_ICE 0x0009
#define SURFACE_DIRT 0x000C
#define SURFACE_CORAL 0x000D
#define SURFACE_GRAVEL 0x000E
#define SURFACE_OIL_TREATED 0x000F
#define SURFACE_STEEL_MATS 0x0010
#define SURFACE_BITUMINOUS 0x0011
#define SURFACE_BRICK 0x0012
#define SURFACE_MACADAM 0x0013
#define SURFACE_PLANKS 0x0014
#define SURFACE_SAND 0x0015
#define SURFACE_SHALE 0x0016
#define SURFACE_TARMAC 0x0017
#define SURFACE_UNKNOWN 0x00FE
#define DESIGNATOR_NONE 0x00
#define DESIGNATOR_LEFT 0x01
#define DESIGNATOR_RIGHT 0x02
#define DESIGNATOR_CENTER 0x03
#define DESIGNATOR_WATER 0x04
#define PATTERN_NO_PRIM_TAKEOFF 0x01
#define PATTERN_NO_PRIM_LANDING 0x02
#define PATTERN_PRIMARY_RIGHT 0x04
#define PATTERN_NO_SEC_TAKEOFF 0x08
#define PATTERN_NO_SEC_LANDING 0x10
#define PATTERN_SECONDARY_RIGHT 0x20
#define MARKING_EDGE 0x0001
#define MARKING_THRESHOLD 0x0002
#define MARKING_FIXED 0x0004
#define MARKING_TOUCHDOWN 0x0008
#define MARKING_DASHES 0x0010
#define MARKING_IDENT 0x0020
#define MARKING_PRECISION 0x0040
#define MARKING_EDGE_PAVEMENT 0x0080
#define MARKING_SINGLE_END 0x0100
#define MARKING_PRIMARY_CLOSED 0x0200
#define MARKING_SECONDARY_CLOSED 0x0400
#define MARKING_PRIMARY_STOL 0x0800
#define MARKING_SECONDARY_STOL 0x1000
#define LIGHTS_EDGE_LOW 0x01
#define LIGHTS_EDGE_MEDIUM 0x02
#define LIGHTS_EDGE_HIGH 0x03
#define LIGHTS_CENTER_LOW 0x04
#define LIGHTS_CENTER_MEDIUM 0x08
#define LIGHTS_CENTER_HIGH 0x0C
#define LIGHTS_CENTERED 0x10
// runway structure
// NOTE: BGLCOMP fails if Markings are included
// when Lights, Vasi or other stuff are included before!!
// in poor words: put Markings as the very first entry under
// runways
typedef struct tag_runway_t
{
WORD wId; // 0 record ID (0x4)
DWORD nLen; // 2 length of record
BYTE wSurface; // 6 runway surface
BYTE bSpare;
BYTE bStartNumber; // 8 runway start number, 0-36
BYTE bStartDesignator; // 9 runway start designator
BYTE bEndNumber; // 10 runway end number, 0-36
BYTE bEndDesignator; // 11 runway end designator
DWORD nPrimaryIlsId; // 12 primary ILS id in packed format
DWORD nSecondaryIlsId; // 16 secondary ILS id in packed format
int nLon; // 20 longitude in packed format
int nLat; // 24 latitude in packed format
int nAlt; // 28 altitude, meters * 1000
float fLength; // 32 length in meters
float fWidth; // 36 width in meters
float fHeading; // 40 approach heading
float fPatternAlt; // 44 pattern altitude in meters
WORD wMarkings; // 48 marking flags, see above
BYTE bLights; // 50 lights flags, see above
BYTE bPatternFlags; // 51 pattern flags, see above
} NRWY;
typedef struct tag_offset_threshold_t
{
WORD wId; // record ID
// 0x5 = primary end threshold
// 0x6 = secondary end threshold
// 0x7 = primary end blastpad
// 0x8 = secondary end blastpad
// 0x9 = primary end overrun
// 0xA = secondary end overrun
DWORD nLen; // length of record
WORD wSurface; // threshold surface
float fLength; // threshold length
float fWidth; // threshold width
} offset_threshold_t, blastpad_t, overrun_t;
#define ILS_PRIMARY_END 0x01 // disregard this
#define ILS_BACKCOURSE 0x04
#define ILS_DME 0x10
#define ILS_GS 0x0C
// ILS entry:
// composed by (in order):
// ils_t
// ilsgs_t (optional)
// ilsdme_t (optional)
// and closing ILS name, with initial name_hdr_t structure
// ils structure
typedef struct tag_ils_t
{
WORD wId; // 0 record ID (0x13 - same as VOR !!!)
DWORD nLen; // 2 length of record in bytes
BYTE bType; // 6 type - ILS is 0x4
BYTE bFlags; // 7 ils flags
int nLon; // 8 longitude in packed format
int nLat; // 12 latitude in packed format
int nAlt; // 16 altitude, meters * 1000
int nFreq; // 20 frequency * 1000000
float fRange; // 24 range in meters
float fMagVar; // 28 magnetic deviation
int nId; // 32 packed ICAO ID - base 0x42
int nRegion; // 36 packed region ???
int nUnk1; // 40 unknown integer 1
WORD wUnk1; // 44 unknown word 1
BYTE bEnd; // 46 runway end stored in the high part and:
// 0x0 is primary, 0x1 is secondary
BYTE bUnk1; // 47 unknown byte 1
float fHeading; // 48 heading approach
float fWidth; // 52 ILS width ???
} NILS;
// ils GS structure
typedef struct ilsgs_t
{
WORD wId; // record ID (0x15)
DWORD nLen; // length of record in bytes
WORD wFiller; // filler
int nLon; // longitude in packed format
int nLat; // latitude in packed format
int nAlt; // altitude, meters * 1000
float fRange; // range in meters
float fPitch; // GS pitch
} ilsgs_t;
// ils dme structure
typedef struct ilsdme_t
{
WORD wId; // record ID (0x16)
DWORD nLen; // length of record in bytes
WORD wFiller; // filler
int nLon; // longitude in packed format
int nLat; // latitude in packed format
int nAlt; // altitude, meters * 1000
float fRange; // range in meters
} ilsdme_t;
#define COMM_ATIS 0x0001
#define COMM_MULTICOM 0x0002
#define COMM_UNICOM 0x0003
#define COMM_CTAF 0x0004
#define COMM_GROUND 0x0005
#define COMM_TOWER 0x0006
#define COMM_CLEARANCE 0x0007
#define COMM_APPROACH 0x0008
#define COMM_DEPARTURE 0x0009
#define COMM_CENTER 0x000A
#define COMM_FSS 0x000B
#define COMM_AWOS 0x000C
#define COMM_ASOS 0x000D
// airport COM structure
typedef struct tag_aptcomm_t
{
WORD wId; // record ID (0x12)
DWORD nLen; // length of record in bytes
BYTE bCommType; // comm type, see above
BYTE bUnknown;
int nFreq; // frequency * 1000000
} aptcomm_t; // comm name string-z follows
#define HELITYPE_NONE 0x00
#define HELITYPE_H 0x01
#define HELITYPE_SQUARE 0x02
#define HELITYPE_CIRCLE 0x03
#define HELITYPE_MEDICAL 0x04
#define HELI_TRANSPARENT 0x10
#define HELI_CLOSED 0x20
// helipad structure
// NOTE: BGLCOMP fails when red, green, blue tokens are
// included !!!
typedef struct tag_helipad_t
{
WORD wId; // record ID (0x26)
DWORD nLen; // record length
BYTE bSurface; // helipad surface (same as runway)
BYTE bFlags; // helipad flags, see constants above
BYTE r; // rgb
BYTE g; // rgb
BYTE b; // rgb
BYTE a; // alpha
int nLon; // longitude in packed format
int nLat; // latitude in packed format
int nAlt; // altitude, meters * 1000
float fLength; // helipad length in meters
float fWidth; // helipad width in meters
float fHeading; // helipad heading
} helipad_t;
// delete airport flags
// NOTE: BGLCOMP fails when deleteAllApronlights is
// included !!!
#define BIT_DELETE_ALL_APPROACHES 0x01
#define BIT_DELETE_ALL_APRONS 0x04
#define BIT_DELETE_ALL_FREQUENCIES 0x08
#define BIT_DELETE_ALL_HELIPADS 0x10
#define BIT_DELETE_ALL_RUNWAYS 0x20
#define BIT_DELETE_ALL_STARTS 0x40
#define BIT_DELETE_ALL_TAXIWAYS 0x80
// delete airport structure
// this entry is nested inside an airport and is not a
// subentry like runways, helipad, etc. its position is
// (when available) just before airport name header
// note: other delete structures (e.g. deleterunway etc)
// are not included in compilation when their bit is set
// e.g. you have a deleterunway and delete_all_runways
// bit is set, then delete runway is not compiled by
// bglcomp
typedef struct tag_delete_airport_t
{
WORD wId; // record ID (0x26)
DWORD nLen; // record length
WORD wFlags; // delete flags, see above
BYTE bDelRwyCount; // number of deleterunway records
BYTE bDelStartCount; // number of deletestart records
BYTE bDelFreqCount; // number of deletefrequency records
BYTE bPad; // padder
} delete_airport_t;
// delete runway structure
typedef struct tag_delete_runway_t
{
BYTE bSurface; // runway surface
BYTE bStartNumber; // runway start number
BYTE bEndNumber; // runway end number
BYTE bDesignator; // designator (high part stores start, low part end)
} delete_runway_t;
#define RWYSTART_RUNWAY 0x01
#define RWYSTART_WATER 0x02
#define RWYSTART_HELIPAD 0x03
// delete start structure
typedef struct tag_delete_start_t
{
BYTE bNumber; // number
BYTE bDesignator; // runway start designator (left, right, etc.)
BYTE bType; // type of runway (runway, helipad, water)
BYTE bPad; // pad (0x0)
} delete_start_t;
// delete frequency structure
typedef struct tag_delete_freq_t
{
int nPacked; // packed frequency number and comm type
} delete_freq_t;
// approach lights flags
// NOTE: bglcomp fails when system is SSALSF or SSALSR !!!
#define AP_SYSTEM_NONE 0x00
#define AP_SYSTEM_ODALS 0x01
#define AP_SYSTEM_MALSF 0x02
#define AP_SYSTEM_MALSR 0x03
#define AP_SYSTEM_SSALF 0x04
#define AP_SYSTEM_SSALR 0x05
#define AP_SYSTEM_ALSF1 0x06
#define AP_SYSTEM_ALSF2 0x07
#define AP_SYSTEM_RAIL 0x08
#define AP_SYSTEM_CALVERT 0x09
#define AP_SYSTEM_CALVERT2 0x0A
#define AP_SYSTEM_SALS 0x0C
#define AP_ENDLIGHTS 0x20
#define AP_REIL 0x40
#define AP_TOUCHDOWN 0x80
// approach lights structure
typedef struct tag_approachlights_t
{
WORD wId; // record ID (0x26)
DWORD nLen; // record length
BYTE bFlags; // approach flags, see above
BYTE bStrobes; // number of sequenced strobes
} approachlights_t;
#define VASI_VASI21 0x0001
#define VASI_VASI31 0x0002
#define VASI_VASI22 0x0003
#define VASI_VASI32 0x0004
#define VASI_VASI23 0x0005
#define VASI_VASI33 0x0006
#define VASI_PAPI2 0x0007
#define VASI_PAPI4 0x0008
#define VASI_TRICOLOR 0x0009
#define VASI_PVASI 0x000A
#define VASI_TVASI 0x000B
#define VASI_BALL 0x000C
#define VASI_APAP 0x000D
#define VASI_PANELS 0x000D
// vasi structure
typedef struct tag_vasi_t
{
WORD wId; // record ID, where:
// (0xB = primary VASI on left side)
// (0xC = primary VASI on right side)
// (0xD = secondary VASI on left side)
// (0xE = secondary VASI on right side)
DWORD nLen; // record length
WORD wType; // vasi type, see constants above
float fBiasX; // vasi bias along x side, in meters
float fBiasZ; // vasi bias along z side, in meters
float fSpacing; // vasi spacing, in meters
float fPitch; // vasi pitch in degrees
} vasi_t;
typedef union
{
BYTE bEnd; // runway end stored in the high part and:
// 0x0 is primary, 0x1 is secondary
BYTE bNumber; // runway number, 0-36
} un1;
typedef union
{
BYTE bType; // runway type stored in the high part and:
// 0x1 is runway, 0x2 is water 0x3 is helipad
BYTE bFlags; // runway type stored in the high part and:
// 0x1 is runway, 0x2 is water 0x3 is helipad
// low part stores the designator:
// 0x0: none 0x1: left: 0x2: right 0x3: center
// 0x4: water
} un2;
// runway start structure
typedef struct tag_rwystart_t
{
WORD wId; // 0 record ID (0x11)
DWORD nLen; // 2 record length
BYTE num; // 6 was un1 lpUn1; // see above
BYTE des; // 7 un2 lpUn2; // see above ??????? flags
int nLon; // 8 longitude in packed format
int nLat; // 12 latitude in packed format
int nAlt; // 16 altitude, meters * 1000
float fHeading; // 20 heading in degrees
} NSTART;
// NOTE: BGLCOMP fails if name type EPARKING
// (in bglcomp doc) coz is not valid,
// use E_PARKING instead
//
// taxiway parking constants
#define PARKING_NAME_NONE 0x00
#define PARKING_NAME_PARKING 0x01
#define PARKING_NAME_N_PARKING 0x02
#define PARKING_NAME_NE_PARKING 0x03
#define PARKING_NAME_E_PARKING 0x04
#define PARKING_NAME_SE_PARKING 0x05
#define PARKING_NAME_S_PARKING 0x06
#define PARKING_NAME_SW_PARKING 0x07