-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtrproject.htm
More file actions
3642 lines (2441 loc) · 211 KB
/
trproject.htm
File metadata and controls
3642 lines (2441 loc) · 211 KB
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
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Overall Project Layout</title>
<meta name="author" content="Steve Greenwood">
<style>
.Normal
{margin:0.0pt;
margin-top:0.0pt;
margin-bottom:0.0pt;
margin-left:0.0pt;
margin-right:0.0pt;
text-indent:0.0pt;
font-family:"Times New Roman";
font-size:12.0pt;
color:Black;
font-weight:normal;
}
H1
{margin:0.0pt;
margin-top:0.0pt;
margin-bottom:0.0pt;
margin-left:0.0pt;
margin-right:0.0pt;
text-indent:0.0pt;
font-family:"Times New Roman";
font-size:12.0pt;
color:Black;
font-weight:bold;
}
H2
{margin:0.0pt;
margin-top:0.0pt;
margin-bottom:0.0pt;
margin-left:0.0pt;
margin-right:0.0pt;
text-indent:0.0pt;
font-family:"Times New Roman";
font-size:12.0pt;
color:Black;
font-weight:normal;
}
.Header
{margin:0.0pt;
margin-top:0.0pt;
margin-bottom:0.0pt;
margin-left:0.0pt;
margin-right:0.0pt;
text-indent:0.0pt;
font-family:"Times New Roman";
font-size:12.0pt;
color:Black;
font-weight:normal;
}
.Footer
{margin:0.0pt;
margin-top:0.0pt;
margin-bottom:0.0pt;
margin-left:0.0pt;
margin-right:0.0pt;
text-indent:0.0pt;
font-family:"Times New Roman";
font-size:12.0pt;
color:Black;
font-weight:normal;
}
.Caption
{margin:0.0pt;
margin-top:0.0pt;
margin-bottom:0.0pt;
margin-left:0.0pt;
margin-right:0.0pt;
text-indent:0.0pt;
font-family:"Times New Roman";
font-size:12.0pt;
color:Black;
font-weight:normal;
}
</style>
</head>
<body link="blue" alink="Red" vlink="Purple">
<h1><b><u>Overall Project Layout</u></b></h1>
<p class=Normal>Signature</p>
<p class=Normal>Room Array</p>
<p class=Normal>Unused Slot Tables</p>
<p class=Normal>TGA/Texture Information</p>
<p class=Normal>WAS/Slot Information</p>
<p class=Normal>Tile Specific Information</p>
<p class=Normal> </p>
<p class=Normal>Each of these sections (except the Signature) has a lot of information. A lot of the information is variable length, making parsing very difficult. It limits you to a sequential load and verification of the
data. It is hard to detect bad data and successfully skip it, since there are few checkpoints in the file to let you synchronize.</p>
<p class=Normal> </p>
<p class=Normal>OK, first some common terminology and conventions I use.</p>
<p class=Normal> </p>
<p class=Normal>First, all structures are given in C/C++ format.</p>
<p class=Normal style='text-indent:36.0pt;'>Any fields named filler or dummy probably aren’t used.</p>
<p class=Normal style='text-indent:36.0pt;'>Any fields named unknown or what are fields I haven’t figured out yet.</p>
<p class=Normal style='text-indent:36.0pt;'>Fields with a comment of // = … will ALWAYS have the indicated value.</p>
<p class=Normal>Besides standard C/C++ data types, I use the following types defined in Microsoft headers.</p>
<p class=Normal>CHAR<span style='font-size:10.0pt;'> signed
char</span></p>
<p class=Normal>BYTE<span style='font-size:10.0pt;'> unsigned
char</span></p>
<p class=Normal>WORD<span style='font-size:10.0pt;'> unsigned short (16 bits)</span></p>
<p class=Normal>DWORD<span style='font-size:10.0pt;'> unsigned long (32 bits)</span></p>
<p class=Normal>The above types preceded by P are pointers to the indicated data type (PCHAR, PBYTE, PWORD, and PDWORD).</p>
<p class=Normal> </p>
<p class=Normal> What I call a block is called a sector by some. Technically its use does make it a sector. But since they are square, and we use them like building blocks, that is what I call them.</p>
<p class=Normal> A slot is an entry in an array. They are normally numbered sequentially starting at ZERO. I use the term slot mostly in conjunction with WAD objects and sound effects.</p>
<p class=Normal> A Thing is any thing you can add to the map. It includes Doors, Triggers, Wad Objects, any type of Cameras, any type of Lights, Sinks, Sounds, and Fog Bulbs. I had to pick a different name than Object,
since that word is already overused.</p>
<p class=Normal> A Light thing is any type of Lights, Any type of Cameras, Sinks, Sounds, and Fog Bulbs. Basically, any Effect (from the menu) and any Light.</p>
<p class=Normal> I also use Light generically to mean any type of light. This means Light, Shadow, Sun, Effect (light), and Spot.</p>
<p class=Normal> Most people are familiar with graphs that have an X and Y coordinate. In 3D there is also a Z coordinate. In TR, the X coordinate starts at ZERO on the left and gets positive as you go to the right.
The Y coordinate measures altitude in the map. When you first draw rooms, they are placed at ZERO floor altitude. The Y coordinate gets positive as you go DOWN, and negative as you go UP. The Z coordinate is ZERO at the top
of the 2D display. It gets positive as you move out of the screen, and negative as you move into the screen.</p>
<p class=Normal> </p>
<h1><b><u>Signature</u></b></h1>
<p class=Normal> The signature is the first 12 bytes of the file. It is a C-style string containing “PROJFILE1”. The last 3 bytes are all zero.</p>
<p class=Normal> After the signature is a DWORD containing the number of room slots in the project. This is the total slots available, including Empty rooms. It is ALWAYS a multiple of 100 because of the way the Level
Editor adds rooms to a project.</p>
<p class=Normal> </p>
<h1><b><u> </u></b></h1>
<h1><b><u>Room Array</u></b></h1>
<p class=Normal> This section contains all of the room definitions. They are variable length for several reasons. Because of the variable length, and optional presence of data, if the data is corrupt parsing the rooms
can be very difficult. Sometimes you just have to delete an entire room, and even that can result in losing more rooms.</p>
<p class=Normal> </p>
<p class=Normal><span style='font-size:10.0pt;'> </span><u><span
style='font-size:10.0pt;'>Room Head</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> This structure defines the beginning of the room, and its basic characteristics.</span></u></p>
<p class=Normal> </p>
<p class=Normal>typedef struct PRJ_ROOMHEAD_S</p>
<p class=Normal><u><span style='font-size:10.0pt;'> {</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> WORD wId; //
type of object</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> char cName[80]; //
name of room</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> DWORD dwZPixelWorld; //
North Z pixel in world grid</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> DWORD unknown1;</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> DWORD dwXPixelWorld; //
West X pixel in world grid</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> DWORD unknown2;</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> WORD what1; //
= 0</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> WORD wXDisplayOffset;</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> WORD wZDisplayOffset;</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> short sXBlocks; //
# blocks in X (3-20)</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> short sZBlocks; //
# blocks in Z (3-20)</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> short sXBlockWorld; //
block X in world grid (0-99)</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> short sZBlockWorld; //
block Z in world grid (0-99)</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> WORD wLink;</span></u></p>
<p class=Normal><u><span style='font-size:10.0pt;'> } prj_roomh_t, *pprj_roomh_t;</span></u></p>
<p class=Normal> </p>
<p class=Normal style='margin-left:-5.0pt;'><u><span style='font-size:10.0pt;'></span></u>
<table width="590" cellspacing="0" border="1">
<tr height="203">
<td valign="top" width="127" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wId</p>
</td>
<td valign="top" width="463" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is an id describing the type of room. There are only 2 types used.</p>
<p class=Normal>TYPE_ROOM_DEFINED<u><span style='font-size:10.0pt;'> 0x0000</span></u></p>
<p class=Normal> This is a room that actually exists.</p>
<p class=Normal>TYPE_ROOM_UNDEFINED<u><span style='font-size:10.0pt;'> 0x0001</span></u></p>
<p class=Normal> This is an Empty room.</p>
<p class=Normal> </p>
<p class=Normal style='margin-left:36.0pt;text-indent:36.0pt;'>If the room is Empty, the rest of the room information is missing. Even the rest of the header is not there. You see why it can be hard to parse a project?</p>
<p class=Normal> </p>
</td>
</tr>
<tr height="129">
<td valign="top" width="127" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>cName</p>
</td>
<td valign="top" width="463" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is the name of the room. It can be up to 79 characters long, leaving one character for the null delimiter.</p>
<p class=Normal>If you don’t use too many characters, the LE adds a string that looks like “(n:x)” where n is the room’s actual slot number, and x is the logical position not counting empty slots. For instance, (10:8)
would mean that this is the 10<sup>th</sup> room, but only the 8<sup>th</sup> non-empty room out of those 10. This means that before this are 2 empty room slots.</p>
</td>
</tr>
<tr height="56">
<td valign="top" width="127" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>dwZPixelWorld</p>
</td>
<td valign="top" width="463" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The absolute PIXEL coordinate of the room on the Z axis. This refers to the North edge of the room (gray square). If the room is in the top-left corner of the 2D view, the coordinate will be zero.</p>
</td>
</tr>
<tr height="56">
<td valign="top" width="127" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>dwXPixelWorld</p>
</td>
<td valign="top" width="463" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The absolute PIXEL coordinate of the room on the X axis. This refers to the West edge of the room (gray square). If the room is in the top-left corner of the 2D view, the coordinate will be zero.</p>
</td>
</tr>
<tr height="74">
<td valign="top" width="127" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wXDisplayOffset</p>
</td>
<td valign="top" width="463" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is how many blocks to indent the room from the left side of the room grid. It is how the room is always displayed centered in the grid. It is only used in WinRoomEdit.</p>
<p class=Normal>(20 – sXBlocks) / 2.</p>
</td>
</tr>
<tr height="74">
<td valign="top" width="127" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wZDisplayOffset</p>
</td>
<td valign="top" width="463" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is how many blocks to indent the room from the top of the room grid. It is how the room is always displayed centered in the grid. It is only used in WinRoomEdit.</p>
<p class=Normal>(20 – sZBlocks) / 2.</p>
</td>
</tr>
<tr height="74">
<td valign="top" width="127" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sXBlocks</p>
</td>
<td valign="top" width="463" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The number of blocks in the room on the X axis. This is the number of blocks plus 2 for the gray blocks around the room. It MUST be in the range 3 – 20 since you can’t have a room smaller than 1x1 or
larger than 18x18.</p>
</td>
</tr>
<tr height="74">
<td valign="top" width="127" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sZBlocks</p>
</td>
<td valign="top" width="463" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The number of blocks in the room on the Z axis. This is the number of blocks plus 2 for the gray blocks around the room. It MUST be in the range 3 – 20 since you can’t have a room smaller than 1x1 or
larger than 18x18.</p>
</td>
</tr>
<tr height="37">
<td valign="top" width="127" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sXBlockWorld</p>
</td>
<td valign="top" width="463" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The BLOCK position of the room on the X axis within the world grid. It refers to the Northwest corner gray block. Value 0-99.</p>
</td>
</tr>
<tr height="37">
<td valign="top" width="127" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>SZBlockWorld</p>
</td>
<td valign="top" width="463" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The BLOCK position of the room on the Z axis within the world grid. It refers to the Northwest corner gray block. Value 0-99.</p>
</td>
</tr>
<tr height="442">
<td valign="top" width="127" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wLink</p>
</td>
<td valign="top" width="463" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is simple, yet complicated to explain. When you have rooms connected by doors, and you move one of the rooms on the 2D display, all of the other connected rooms move with it. The LE uses this field to
know which rooms to move as a single unit.</p>
<p class=Normal>I won’t try to explain how the LE determines the value to put here. It is kind of complicated, because it can change at any time, depending on how you build your level.</p>
<p class=Normal>This is a room number of a room that is connected to this room. This field forms a linked list of sorts, pointing to another room, not necessarily the next one (what order would you use, since a room can
have multiple doors). When you move a room on the 2D display, the LE also moves the room pointed to by this field. Then it looks at that room, and move the room it links to. And so on, until it finds a link that points back
to the first room, then it stops. So the values in this field must form a circular list of room numbers. If the links are not circular, the LE will lockup.</p>
<p class=Normal>You can have different sections of rooms that are not connected, in which case each set of rooms will have its own circular link list. Title levels provided by Core are the only ones I know about that do
this. Normal, playable levels generally have all rooms linked together by a door at some point in the map.</p>
<p class=Normal>I hope this explanation is enough. Just be warned – if this field is not set correctly in a circular link, the LE will lockup when you try to move a room.</p>
</td>
</tr>
</table></p>
<p class=Normal> </p>
<h2><u>Door Array</u></h2>
<p class=Normal> After the room head is the array of doors in the room. This is variable length data, and depends on the number of doors.</p>
<p class=Normal> There is always a</p>
<p class=Normal style='text-indent:36.0pt;'>WORD wnDoors</p>
<p class=Normal>containing the number of doors. If this is zero, there is no more door information, so skip to the Object Array.</p>
<p class=Normal> If the number of doors is greater than zero, then the very next thing is an array of Thing Index values for the doors.</p>
<p class=Normal> WORD wThingIndex[wnDoors]</p>
<p class=Normal>There is one word for each door in the room. The word contains the index within the 2000-entry Thing table where the door belongs. This index number is IMPORTANT, since it is used by other things to refer to
the door. As an example, a door in one room MUST have a matching door in another room. Each of the 2 doors will point to the other door by its Thing Index.</p>
<p class=Normal> After this array are the actual door structures for each door. These door structures MUST come in the same order as their index appears in the array. This is the only way the door can be matched to
its Thing Index, by the order in which they appear.</p>
<p class=Normal> </p>
<p class=Normal>typedef struct PRJ_DOOR_S</p>
<p class=Normal> {</p>
<p class=Normal> WORD wId;</p>
<p class=Normal> short sXBlockRoom;</p>
<p class=Normal> short sZBlockRoom;</p>
<p class=Normal> short sXBlocks;
// also for wall panels</p>
<p class=Normal> short sZBlocks;
// not for wall panels</p>
<p class=Normal> WORD wYClickAboveFloor; //
= 0</p>
<p class=Normal> WORD wRoom;
// room # where this door is</p>
<p class=Normal> WORD wSlot;
// thing index of other door</p>
<p class=Normal> WORD filler[13];
// = 0</p>
<p class=Normal> } prj_door_t, *pprj_door_t;</p>
<p class=Normal> </p>
<p class=Normal style='margin-left:-5.0pt;'>
<table width="590" cellspacing="0" border="1">
<tr height="74">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>WId</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>Like the room id, this value tells what type of door this is.</p>
<p class=Normal>TYPE_DOOR_WEST 0x0001</p>
<p class=Normal> This door is on the West wall of the room.</p>
<p class=Normal>TYPE_DOOR_NORTH 0x0002</p>
<p class=Normal> This door is on the North wall of the room.</p>
<p class=Normal>TYPE_DOOR_FLOOR 0x0004</p>
<p class=Normal> This door is on the Floor of the room.</p>
<p class=Normal>TYPE_DOOR_EAST 0xfffe</p>
<p class=Normal> This door is on the East wall of the room.</p>
<p class=Normal>TYPE_DOOR_SOUTH 0xfffd</p>
<p class=Normal> This door is on the South wall of the room.</p>
<p class=Normal>TYPE_DOOR_CEILING 0xfffb</p>
<p class=Normal> This door is on the Ceiling of the room.</p>
<p class=Normal> </p>
<p class=Normal>Unless you are a programmer, you probably won’t notice that the values for 2 doors that will face each other are one’s complements of each other. This does make it fairly easy to detect if 2 doors are
actually capable of facing each other.</p>
</td>
</tr>
<tr height="37">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sXBlockRoom</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is the BLOCK position of the door in the X axis RELATIVE to the West side of the room. If it is on the West wall, this is zero.</p>
</td>
</tr>
<tr height="56">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sZBlockRoom</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is the BLOCK position of the door in the Z axis RELATIVE to the North side of the room. If it is on the North wall, this is zero.</p>
</td>
</tr>
<tr height="37">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>SXBlocks</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is how many blocks are in the door along the X axis. If this door is on the West or East wall, this is always 1.</p>
</td>
</tr>
<tr height="37">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>SZBlocks</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is how many blocks are in the door along the Z axis. If this door is on the North or South wall, this is always 1.</p>
</td>
</tr>
<tr height="37">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wYClickAboveFloor</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>NOT USED</p>
</td>
</tr>
<tr height="19">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>WRoom</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The room number where this door is.</p>
</td>
</tr>
<tr height="19">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>WSlot</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The Thing Index of the matching door in the other room.</p>
</td>
</tr>
</table></p>
<p class=Normal> </p>
<p class=Normal><u>Object Array</u></p>
<p class=Normal> </p>
<p class=Normal>IMPORTANT: This section describes objects from the Wad file AND Triggers. Both types of things are stored here. They have different structure lengths, which makes parsing corrupted data even harder.</p>
<p class=Normal> </p>
<p class=Normal> After the Door Array is the array of objects in the room. This is variable length data, and depends on the number of objects.</p>
<p class=Normal> There is always a</p>
<p class=Normal style='text-indent:36.0pt;'>WORD wnObjects</p>
<p class=Normal>containing the number of objects. If this is zero, there is no more object information, so skip to the Light Array.</p>
<p class=Normal> If the number of objects is greater than zero, then the very next thing is an array of Thing Index values for the objects.</p>
<p class=Normal><u> WORD wThingIndex[wnObjects]</u></p>
<p class=Normal>There is one word for each object in the room. The word contains the index within the 2000-entry Thing table where the object belongs. This index number is IMPORTANT, since it is used by other things to refer
to the object. As an example, a trigger for a baddy will contain the Thing Index of the baddy it triggers.</p>
<p class=Normal> After this array are the actual object and trigger structures. These structures MUST come in the same order as their index appears in the array. This is the only way the object or trigger can be matched
to its Thing Index, by the order in which they appear.</p>
<p class=Normal> </p>
<p class=Normal> First, let’s look at the object structure.</p>
<p class=Normal> </p>
<p class=Normal>typedef struct PRJ_OBJECT_S</p>
<p class=Normal><u> {</u></p>
<p class=Normal><u> WORD wId;</u></p>
<p class=Normal><u> short sXBlockRoom;</u></p>
<p class=Normal><u> short sZBlockRoom;</u></p>
<p class=Normal><u> short sXBlocks; //
= 1</u></p>
<p class=Normal><u> short sZBlocks; //
= 1</u></p>
<p class=Normal><u> WORD wYClickAboveFloor;</u></p>
<p class=Normal><u> WORD wRoom;</u></p>
<p class=Normal><u> WORD wSlot;</u></p>
<p class=Normal><u> WORD wOcb;</u></p>
<p class=Normal><u> WORD wOrientation;</u></p>
<p class=Normal><u> long lZPixelRoom;</u></p>
<p class=Normal><u> long lYPixelWorld;</u></p>
<p class=Normal><u> long lXPixelRoom;</u></p>
<p class=Normal><u> WORD what5; //
= 0</u></p>
<p class=Normal><u> WORD wFacing;</u></p>
<p class=Normal><u> short sRoll; //
= 0</u></p>
<p class=Normal><u> WORD wTint;</u></p>
<p class=Normal><u> short sTimer;</u></p>
<p class=Normal><u> } prj_object_t, *pprj_object_t;</u></p>
<p class=Normal> </p>
<p class=Normal> </p>
<p class=Normal style='margin-left:-5.0pt;'><u></u>
<table width="590" cellspacing="0" border="1">
<tr height="56">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wId</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>Like the room id, this value tells what type of door this is.</p>
<p class=Normal>TYPE_OBJECT<u> 0x0008</u></p>
<p class=Normal> This is the value that says this is an object from the Wad.</p>
</td>
</tr>
<tr height="37">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sXBlockRoom</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is the BLOCK position of the object in the X axis RELATIVE to the West side of the room. 1-18.</p>
</td>
</tr>
<tr height="37">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sZBlockRoom</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is the BLOCK position of the object in the Z axis RELATIVE to the North side of the room. 1-18.</p>
</td>
</tr>
<tr height="19">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sXBlocks</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is always 1 for objects.</p>
</td>
</tr>
<tr height="19">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sZBlocks</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is always 1 for objects.</p>
</td>
</tr>
<tr height="74">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wYClickAboveFloor</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is how many clicks above the floor that the object was placed. If you raise or lower the floor block, the object keeps the same relative position to the floor. Objects can be positioned in ½ click increments
(128 pixels).</p>
</td>
</tr>
<tr height="19">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wRoom</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The room number where this door is.</p>
</td>
</tr>
<tr height="19">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wSlot</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is the WAD slot number identifying which object this is.</p>
</td>
</tr>
<tr height="148">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wOcb</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is the OCB setting for this object. They are self-explanatory.</p>
<p class=Normal>OBJECT_OCB_SW1<u> 0x0002</u></p>
<p class=Normal>OBJECT_OCB_SW2<u> 0x0004</u></p>
<p class=Normal>OBJECT_OCB_SW3<u> 0x0008</u></p>
<p class=Normal>OBJECT_OCB_SW4<u> 0x0010</u></p>
<p class=Normal>OBJECT_OCB_SW5<u> 0x0020</u></p>
<p class=Normal>OBJECT_OCB_INVISIBLE<u> 0x0001</u></p>
<p class=Normal>OBJECT_OCB_CLEAR_BODY<u> 0x0080</u></p>
</td>
</tr>
<tr height="258">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wOrientation</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The orientation of the object. This is when you right click on it and it moves from the center of the block to one of 4 positions around the outside edge. It is actually placed ½ click in from the edge of
the block.</p>
<p class=Normal>ORIENTATION_CENTER<u> 0x0000</u></p>
<p class=Normal> The object is in the center of the block.</p>
<p class=Normal>ORIENTATION_WEST<u> 0x0010</u></p>
<p class=Normal> The object is on the West edge of the block.</p>
<p class=Normal>ORIENTATION_NORTH<u> 0x0020</u></p>
<p class=Normal> The object is on the North edge of the block.</p>
<p class=Normal>ORIENTATION_EAST<u> 0x0030</u></p>
<p class=Normal> The object is on the East edge of the block.</p>
<p class=Normal>ORIENTATION_SOUTH<u> 0x0040</u></p>
<p class=Normal> The object is on the South edge of the block.</p>
</td>
</tr>
<tr height="74">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>lZPixelRoom</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The pixel coordinate of the object on the Z axis, relative to the North side of the room. It is equal to sZBlockRoom * 1024, with adjustment made for the orientation. WAD object orientation is always center.</p>
</td>
</tr>
<tr height="37">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>lYPixelWorld</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The pixel coordinate of the object on the Y axis. This is within the entire world space of 256 clicks. This is negative going UP.</p>
</td>
</tr>
<tr height="37">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>lXPixelRoom</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The pixel coordinate of the object on the X axis, relative to the West side of the room. It is equal to sXBlockRoom * 1024, with adjustment made for the orientation. WAD object orientation is always center.</p>
</td>
</tr>
<tr height="240">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wFacing</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The angle the object is facing. You can rotate the object in 8 different angles. Values are below. This does not refer to the direction an object is LOOKING. When first placed in the map, the object is considered
facing North, no matter which way it is looking.</p>
<p class=Normal>OBJECT_FACING_N<u> 0x0000</u></p>
<p class=Normal>OBJECT_FACING_NE<u> 0x2000</u></p>
<p class=Normal>OBJECT_FACING_E<u> 0x4000</u></p>
<p class=Normal>OBJECT_FACING_SE<u> 0x6000</u></p>
<p class=Normal>OBJECT_FACING_S<u> 0x8000</u></p>
<p class=Normal>OBJECT_FACING_SW<u> 0xa000</u></p>
<p class=Normal>OBJECT_FACING_W<u> 0xc000</u></p>
<p class=Normal>OBJECT_FACING_NW<u> 0xe000</u></p>
</td>
</tr>
<tr height="19">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sRoll</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>NOT USED</p>
</td>
</tr>
<tr height="74">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wTint</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The tint of the object.</p>
<p class=Normal>OBJECT_TINT_RED<u> 0x001f</u></p>
<p class=Normal>OBJECT_TINT_GREEN<u> 0x03e0</u></p>
<p class=Normal>OBJECT_TINT_BLUE<u> 0x7c00</u></p>
</td>
</tr>
<tr height="19">
<td valign="top" width="150" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sTimer</p>
</td>
<td valign="top" width="441" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>NOT USED</p>
</td>
</tr>
</table></p>
<p class=Normal> </p>
<p class=Normal>Now let’s look at the trigger structure.</p>
<p class=Normal> </p>
<p class=Normal>typedef struct PRJ_TRIGGER_S</p>
<p class=Normal><u> {</u></p>
<p class=Normal><u> WORD wId;</u></p>
<p class=Normal><u> short sXBlockRoom;</u></p>
<p class=Normal><u> short sZBlockRoom;</u></p>
<p class=Normal><u> short sXBlocks;</u></p>
<p class=Normal><u> short sZBlocks;</u></p>
<p class=Normal><u> WORD wYClickAboveFloor; //
= 0</u></p>
<p class=Normal><u> WORD wRoom;</u></p>
<p class=Normal><u> WORD wSlot;</u></p>
<p class=Normal><u> WORD sTimer; //
= 0</u></p>
<p class=Normal><u> WORD wOrientation;
// = 0</u></p>
<p class=Normal><u> long lZPixelRoom;</u></p>
<p class=Normal><u> long lYPixelWorld;
// = 0</u></p>
<p class=Normal><u> long lXPixelRoom;</u></p>
<p class=Normal><u> WORD what5; //
= 0</u></p>
<p class=Normal><u> WORD wFacing; //
= 0</u></p>
<p class=Normal><u> short sRoll; //
= 0</u></p>
<p class=Normal><u> WORD wSpeed; //
= 0</u></p>
<p class=Normal><u> WORD wOcb; //
= 0</u></p>
<p class=Normal><u> WORD wType;</u></p>
<p class=Normal><u> WORD wObject; //
obj index, flip #, sound slot, etc</u></p>
<p class=Normal><u> short sTTimer;</u></p>
<p class=Normal><u> WORD wSwitches;</u></p>
<p class=Normal><u> WORD wTrigger;</u></p>
<p class=Normal><u> } prj_trigger_t, *pprj_trigger_t;</u></p>
<p class=Normal> </p>
<p class=Normal>This structure is a little bigger than the object structure. It has extra fields at the end that are only used by triggers.</p>
<p class=Normal> </p>
<p class=Normal>NOTE: I have found triggers that have negative sXBlockRoom and sZBlockRoom. This happens when a trigger is in one room, and the object it triggers is in a different room. The trigger is moved to the same room
as the object (at least the way it is stored in the project) and the coordinates are made negative. I am still investigating this. Until I figure it out, my fix program just doesn’t do anything with any thing that has negative
coordinates.</p>
<p class=Normal> </p>
<p class=Normal style='margin-left:-5.0pt;'><u></u>
<table width="590" cellspacing="0" border="1">
<tr height="56">
<td valign="top" width="110" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wId</p>
</td>
<td valign="top" width="481" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>Like the room id, this value tells what type of thing this is.</p>
<p class=Normal>TYPE_TRIGGER<u> 0x0010</u></p>
<p class=Normal> This is the value that says this is a trigger.</p>
</td>
</tr>
<tr height="56">
<td valign="top" width="110" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sXBlockRoom</p>
</td>
<td valign="top" width="481" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is the BLOCK position of the trigger in the X axis RELATIVE to the West side of the room. The trigger can be recorded in another room, where the triggered object it, so this can be negative.</p>
</td>
</tr>
<tr height="56">
<td valign="top" width="110" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sZBlockRoom</p>
</td>
<td valign="top" width="481" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>This is the BLOCK position of the trigger in the Z axis RELATIVE to the North side of the room. The trigger can be recorded in another room, where the triggered object it, so this can be negative.</p>
</td>
</tr>
<tr height="19">
<td valign="top" width="110" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sXBlocks</p>
</td>
<td valign="top" width="481" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The number of blocks along the X axis that are included in the trigger.</p>
</td>
</tr>
<tr height="19">
<td valign="top" width="110" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>sZBlocks</p>
</td>
<td valign="top" width="481" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The number of blocks along the Z axis that are included in the trigger.</p>
</td>
</tr>
<tr height="19">
<td valign="top" width="110" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>wRoom</p>
</td>
<td valign="top" width="481" style='border:solid Black 0.5pt;padding:0.0pt 0.0pt 5.5pt 5.5pt ;'>
<p class=Normal>The room number where this trigger is.</p>