add MapWindow.cs; don't show resources in levels menu
[weland.git] / Polygon.cs
blob6a3c23aab7006b1a03ad6859d9aedd0659790a55
1 using System.IO;
3 namespace Weland {
4 public class Polygon {
5 public const uint Tag = 0x504f4c59; // POLY
6 public const int Size = 128;
7 public const int MaxVertexCount = 8;
9 public short Type;
10 public ushort Flags;
11 public short Permutation;
12 public ushort VertexCount;
13 public short[] EndpointIndexes = new short[MaxVertexCount];
14 public short[] LineIndexes = new short[MaxVertexCount];
16 public short FloorTexture;
17 public short CeilingTexture;
18 public short FloorHeight;
19 public short CeilingHeight;
20 public short FloorLight;
21 public short CeilingLight;
23 public short FirstObjectIndex;
25 public short FloorTransferMode;
26 public short CeilingTransferMode;
28 public short[] AdjacentPolygonIndexes = new short[MaxVertexCount];
30 public short FirstNeighborIndex;
31 public short NeighborCount;
33 public short[] SideIndexes = new short[MaxVertexCount];
34 public Point FloorOrigin;
35 public Point CeilingOrigin;
37 public short MediaIndex;
38 public short MediaLight;
40 public short AmbientSound;
41 public short RandomSound;
43 public void Load(BinaryReaderBE reader) {
44 Type = reader.ReadInt16();
45 Flags = reader.ReadUInt16();
46 Permutation = reader.ReadInt16();
47 VertexCount = reader.ReadUInt16();
48 for (int i = 0; i < EndpointIndexes.Length; ++i) {
49 EndpointIndexes[i] = reader.ReadInt16();
52 for (int i = 0; i < LineIndexes.Length; ++i) {
53 LineIndexes[i] = reader.ReadInt16();
56 FloorTexture = reader.ReadInt16();
57 CeilingTexture = reader.ReadInt16();
58 FloorHeight = reader.ReadInt16();
59 CeilingHeight = reader.ReadInt16();
60 FloorLight = reader.ReadInt16();
61 CeilingLight = reader.ReadInt16();
63 reader.ReadInt32(); // area
64 FirstObjectIndex = reader.ReadInt16();
66 reader.ReadInt16(); // first_exclusion_zone_index
67 reader.ReadInt16(); // line_exclusion_zone_count
68 reader.ReadInt16(); // point_exclusion_zone_count
69 FloorTransferMode = reader.ReadInt16();
70 CeilingTransferMode = reader.ReadInt16();
72 for (int i = 0; i < AdjacentPolygonIndexes.Length; ++i) {
73 AdjacentPolygonIndexes[i] = reader.ReadInt16();
76 reader.ReadInt16(); // first_neighbor_index
77 reader.ReadInt16(); // neighbor_count
79 reader.ReadInt16(); // center.x
80 reader.ReadInt16(); // center.y
82 for (int i = 0; i < SideIndexes.Length; ++i) {
83 SideIndexes[i] = reader.ReadInt16();
86 FloorOrigin.Load(reader);
87 CeilingOrigin.Load(reader);
89 MediaIndex = reader.ReadInt16();
90 MediaLight = reader.ReadInt16();
92 reader.ReadInt16(); // sound_source_indexes
94 AmbientSound = reader.ReadInt16();
95 RandomSound = reader.ReadInt16();
97 reader.BaseStream.Seek(2, SeekOrigin.Current);