| 1 | using System; | 
 
 
 
 
 | 2 | using System.Collections.Generic; | 
 
 
 
 
 | 3 |  | 
 
 
 
 
 | 4 | namespace Oni.Metadata | 
 
 
 
 
 | 5 | { | 
 
 
 
 
 | 6 | internal class BinaryMetadata | 
 
 
 
 
 | 7 | { | 
 
 
 
 
 | 8 | private static MetaStruct bobj = new MetaStruct("ObjectHeader", | 
 
 
 
 
 | 9 | new Field(MetaType.Int32, "ObjectId"), | 
 
 
 
 
 | 10 | new Field(MetaType.Int32, "ObjectFlags"), | 
 
 
 
 
 | 11 | new Field(MetaType.Vector3, "Position"), | 
 
 
 
 
 | 12 | new Field(MetaType.Vector3, "Rotation") | 
 
 
 
 
 | 13 | ); | 
 
 
 
 
 | 14 |  | 
 
 
 
 
 | 15 | private static MetaStruct cons = new MetaStruct("Console", bobj, | 
 
 
 
 
 | 16 | new Field(MetaType.String(63), "ClassName"), | 
 
 
 
 
 | 17 | new Field(MetaType.Int16, "DoorId"), | 
 
 
 
 
 | 18 | new Field(MetaType.Int16, "Flags"), | 
 
 
 
 
 | 19 | new Field(MetaType.String(63), "DisabledTexture"), | 
 
 
 
 
 | 20 | new Field(MetaType.String(63), "EnabledTexture"), | 
 
 
 
 
 | 21 | new Field(MetaType.String(63), "UsedTexture"), | 
 
 
 
 
 | 22 | new Field(MetaType.ShortVarArray(new MetaStruct("ConsoleAction", | 
 
 
 
 
 | 23 | new Field(MetaType.Int16, "ActionType"), | 
 
 
 
 
 | 24 | new Field(MetaType.Int16, "TargetId"),                  // if actionType != 1 | 
 
 
 
 
 | 25 | new Field(MetaType.String32, "ScriptFunction")          // if actionType == 1 | 
 
 
 
 
 | 26 | )), "Actions") | 
 
 
 
 
 | 27 | ); | 
 
 
 
 
 | 28 |  | 
 
 
 
 
 | 29 | private static MetaStruct door = new MetaStruct("Door", bobj, | 
 
 
 
 
 | 30 | new Field(MetaType.String(63), "ClassName"), | 
 
 
 
 
 | 31 | new Field(MetaType.Int16, "DoorId"), | 
 
 
 
 
 | 32 | new Field(MetaType.Int16, ""), | 
 
 
 
 
 | 33 | new Field(MetaType.Int16, "Flags"), | 
 
 
 
 
 | 34 | new Field(MetaType.Vector3, "Center"), | 
 
 
 
 
 | 35 | new Field(MetaType.Float, "ActivationRadius"), | 
 
 
 
 
 | 36 | new Field(MetaType.String(63), "Texture1"), | 
 
 
 
 
 | 37 | new Field(MetaType.String(63), "Texture2"), | 
 
 
 
 
 | 38 | new Field(MetaType.Padding(5)) | 
 
 
 
 
 | 39 | ); | 
 
 
 
 
 | 40 |  | 
 
 
 
 
 | 41 | private static MetaStruct flag = new MetaStruct("Flag", bobj, | 
 
 
 
 
 | 42 | new Field(MetaType.Color, "Color"), | 
 
 
 
 
 | 43 | new Field(MetaType.Int16, "Prefix"), | 
 
 
 
 
 | 44 | new Field(MetaType.Int16, "FlagId"), | 
 
 
 
 
 | 45 | new Field(MetaType.String128, "Notes") | 
 
 
 
 
 | 46 | ); | 
 
 
 
 
 | 47 |  | 
 
 
 
 
 | 48 | private static MetaStruct furn = new MetaStruct("Furniture", bobj, | 
 
 
 
 
 | 49 | new Field(MetaType.String32, "ClassName"), | 
 
 
 
 
 | 50 | new Field(MetaType.String48, "Particle") | 
 
 
 
 
 | 51 | ); | 
 
 
 
 
 | 52 |  | 
 
 
 
 
 | 53 | private static MetaStruct part = new MetaStruct("Particle", bobj, | 
 
 
 
 
 | 54 | new Field(MetaType.String64, "ClassName"), | 
 
 
 
 
 | 55 | new Field(MetaType.String48, "Name"), | 
 
 
 
 
 | 56 | new Field(MetaType.Int16, "Flags"), | 
 
 
 
 
 | 57 | new Field(MetaType.Float, "DecalXScale"), | 
 
 
 
 
 | 58 | new Field(MetaType.Float, "DecalYScale"), | 
 
 
 
 
 | 59 | new Field(MetaType.Int16, "DecalRotation") | 
 
 
 
 
 | 60 | ); | 
 
 
 
 
 | 61 |  | 
 
 
 
 
 | 62 | private static MetaStruct pwru = new MetaStruct("Powerup", bobj, | 
 
 
 
 
 | 63 | new Field(MetaType.Int32, "Type") | 
 
 
 
 
 | 64 | ); | 
 
 
 
 
 | 65 |  | 
 
 
 
 
 | 66 | private static MetaStruct sndg = new MetaStruct("Sound", bobj, | 
 
 
 
 
 | 67 | new Field(MetaType.String32, "ClassName"), | 
 
 
 
 
 | 68 | new Field(MetaType.Int32, "GeometryType"), | 
 
 
 
 
 | 69 | new Field(MetaType.BoundingBox, "BoundingBox"),     // if geometry == VLME | 
 
 
 
 
 | 70 | new Field(MetaType.Float, "MinVolumeRadius"),       // if geometry == SPHR | 
 
 
 
 
 | 71 | new Field(MetaType.Float, "MaxVolumeRadius"),       // if geometry == SPHR | 
 
 
 
 
 | 72 | new Field(MetaType.Float, "Volume"), | 
 
 
 
 
 | 73 | new Field(MetaType.Float, "Pitch") | 
 
 
 
 
 | 74 | ); | 
 
 
 
 
 | 75 |  | 
 
 
 
 
 | 76 | private static MetaStruct trge = new MetaStruct("Trigger", bobj, | 
 
 
 
 
 | 77 | new Field(MetaType.String(63), "ClassName"), | 
 
 
 
 
 | 78 | new Field(MetaType.Int16, "TriggerId"), | 
 
 
 
 
 | 79 | new Field(MetaType.Int16, "Flags"), | 
 
 
 
 
 | 80 | new Field(MetaType.Color, "Color"), | 
 
 
 
 
 | 81 | new Field(MetaType.Float, "StartPosition"), | 
 
 
 
 
 | 82 | new Field(MetaType.Float, "Speed"), | 
 
 
 
 
 | 83 | new Field(MetaType.Int32, "Count"), | 
 
 
 
 
 | 84 | new Field(MetaType.Int16, ""), | 
 
 
 
 
 | 85 | new Field(MetaType.ShortVarArray(new MetaStruct("TriggerAction", | 
 
 
 
 
 | 86 | new Field(MetaType.Int16, "ActionType"), | 
 
 
 
 
 | 87 | new Field(MetaType.Int16, "TurretId"),                  // if actionType != 1 | 
 
 
 
 
 | 88 | new Field(MetaType.String(34), "ScriptFunction")    // if actionType == 1 | 
 
 
 
 
 | 89 | )), "Actions"), | 
 
 
 
 
 | 90 | new Field(MetaType.Byte, "") | 
 
 
 
 
 | 91 | ); | 
 
 
 
 
 | 92 |  | 
 
 
 
 
 | 93 | private static MetaStruct turr = new MetaStruct("Turret", bobj, | 
 
 
 
 
 | 94 | new Field(MetaType.String(63), "ClassName"), | 
 
 
 
 
 | 95 | new Field(MetaType.Int16, "TurretId"), | 
 
 
 
 
 | 96 | new Field(MetaType.Int16, "Flags"), | 
 
 
 
 
 | 97 | new Field(MetaType.Padding(36)), | 
 
 
 
 
 | 98 | new Field(MetaType.Int32, "TargetedTeams"), | 
 
 
 
 
 | 99 | new Field(MetaType.Padding(1)) | 
 
 
 
 
 | 100 | ); | 
 
 
 
 
 | 101 |  | 
 
 
 
 
 | 102 | private static MetaStruct weap = new MetaStruct("Weapon", bobj, | 
 
 
 
 
 | 103 | new Field(MetaType.String32, "ClassName") | 
 
 
 
 
 | 104 | ); | 
 
 
 
 
 | 105 |  | 
 
 
 
 
 | 106 | private static MetaType osbdAmbient = new MetaStruct("OSBDAmbient", | 
 
 
 
 
 | 107 | new Field(MetaType.Int32, "Version"), | 
 
 
 
 
 | 108 | new Field(MetaType.Int32, "Priority"), | 
 
 
 
 
 | 109 | new Field(MetaType.Int32, "Flags"), | 
 
 
 
 
 | 110 | new Field(MetaType.Float, "Unknown1"), | 
 
 
 
 
 | 111 | new Field(MetaType.Float, "MinElapsedTime"), | 
 
 
 
 
 | 112 | new Field(MetaType.Float, "MaxElapsedTime"), | 
 
 
 
 
 | 113 | new Field(MetaType.Float, "MinVolumeDistance"), | 
 
 
 
 
 | 114 | new Field(MetaType.Float, "MaxVolumeDistance"), | 
 
 
 
 
 | 115 | new Field(MetaType.String32, "DetailGroup"), | 
 
 
 
 
 | 116 | new Field(MetaType.String32, "Track1Group"), | 
 
 
 
 
 | 117 | new Field(MetaType.String32, "Track2Group"), | 
 
 
 
 
 | 118 | new Field(MetaType.String32, "InGroup"), | 
 
 
 
 
 | 119 | new Field(MetaType.String32, "OutGroup"), | 
 
 
 
 
 | 120 | new Field(MetaType.Int32, "Unknown2"),              // v >= 5 | 
 
 
 
 
 | 121 | new Field(MetaType.Float, "Unknown3")               // v >= 6 | 
 
 
 
 
 | 122 | ); | 
 
 
 
 
 | 123 |  | 
 
 
 
 
 | 124 | private static MetaType osbdImpulse = new MetaStruct("OSBDImpulse", | 
 
 
 
 
 | 125 | new Field(MetaType.Int32, "Version"), | 
 
 
 
 
 | 126 | new Field(MetaType.String32, "Group"), | 
 
 
 
 
 | 127 | new Field(MetaType.Int32, "Priority"), | 
 
 
 
 
 | 128 | new Field(MetaType.Float, "MinVolumeDistance"), | 
 
 
 
 
 | 129 | new Field(MetaType.Float, "MaxVolumeDistance"), | 
 
 
 
 
 | 130 | new Field(MetaType.Float, "MinVolumeAngle"), | 
 
 
 
 
 | 131 | new Field(MetaType.Float, "MaxVolumeAngle"), | 
 
 
 
 
 | 132 | new Field(MetaType.Int32, "Unknown1"), | 
 
 
 
 
 | 133 | new Field(MetaType.Int32, "Unknown2"),              // v >= 4 | 
 
 
 
 
 | 134 | new Field(MetaType.String32, "AlternateImpulse"),   // v >= 4 | 
 
 
 
 
 | 135 | new Field(MetaType.Int32, "Unknown3"),              // v >= 5 | 
 
 
 
 
 | 136 | new Field(MetaType.Int32, "Unknown4")               // v >= 6 | 
 
 
 
 
 | 137 | ); | 
 
 
 
 
 | 138 |  | 
 
 
 
 
 | 139 | private static MetaType osbdGroup = new MetaStruct("OSBDGroup", | 
 
 
 
 
 | 140 | new Field(MetaType.Int32, "Version"), | 
 
 
 
 
 | 141 | new Field(MetaType.Float, "Volume"),                // v >= 2 | 
 
 
 
 
 | 142 | new Field(MetaType.Float, "Pitch"),                 // v >= 3 | 
 
 
 
 
 | 143 | new Field(MetaType.Int16, "PreventRepeat"),         // v >= 6 | 
 
 
 
 
 | 144 | new Field(MetaType.Int16, "PreviousPermutation"),   // v >= 6 | 
 
 
 
 
 | 145 | new Field(MetaType.Int32, "ChannelCount"), | 
 
 
 
 
 | 146 | new Field(MetaType.VarArray(new MetaStruct("OSBDGroupPermutation", | 
 
 
 
 
 | 147 | new Field(MetaType.Int32, "Weight"), | 
 
 
 
 
 | 148 | new Field(MetaType.Float, "MinVolume"), | 
 
 
 
 
 | 149 | new Field(MetaType.Float, "MaxVolume"), | 
 
 
 
 
 | 150 | new Field(MetaType.Float, "MinPitch"), | 
 
 
 
 
 | 151 | new Field(MetaType.Float, "MaxPitch"), | 
 
 
 
 
 | 152 | new Field(MetaType.String32, "Sound") | 
 
 
 
 
 | 153 | )), "Permutations") | 
 
 
 
 
 | 154 | ); | 
 
 
 
 
 | 155 | } | 
 
 
 
 
 | 156 | } |