/*type 1 - collisions * type 2 - spawns * type 3 - respawns * type 4 - camera bounds * type 5 - death boundaries * type 6 - enemy generator * type 7 - ITEMPT_transform * type 8 - ??? * type 9 - ITEMPT * type 10 - fsAreaCam (and other fsArea's ? ) * type 11 - fsCamLimit * type 12 - damageShapes (damage sphere and damage capsule are the only ones I've seen, type 2 and 3 respectively) * type 13 - item spawners * type 14 - general shapes (general rect, general path, etc.) * type 15 - general points * type 16 - ??? * type 17 - FsStartPoint * type 18 - ??? * type 19 - ???*/ public override void Read(string filename) { FileData f = new FileData(filename); f.skip(0xA);//It's magic f.skip(1); int collisionCount = f.readInt(); for (int i = 0; i < collisionCount; i++) { Collision temp = new Collision(); temp.read(f); collisions.Add(temp); } f.skip(1); int spawnCount = f.readInt(); for (int i = 0; i < spawnCount; i++) { Spawn temp = new Spawn(); temp.read(f); spawns.Add(temp); } f.skip(1); int respawnCount = f.readInt(); for (int i = 0; i < respawnCount; i++) { Spawn temp = new Spawn(); temp.read(f); respawns.Add(temp); } f.skip(1); int cameraCount = f.readInt(); for (int i = 0; i < cameraCount; i++) { Bounds temp = new Bounds(); temp.read(f); cameraBounds.Add(temp); } f.skip(1); int blastzoneCount = f.readInt(); for (int i = 0; i < blastzoneCount; i++) { Bounds temp = new Bounds(); temp.read(f); blastzones.Add(temp); } f.skip(1); int enemyGeneratorCount = f.readInt(); for (int i = 0; i < enemyGeneratorCount; i++) { EnemyGenerator temp = new EnemyGenerator(); temp.read(f); enemySpawns.Add(temp); } f.skip(1); if (f.readInt() != 0) //7 { return; } f.skip(1); if (f.readInt() != 0) //8 { return; } f.skip(1); if (f.readInt() != 0) //9 { return; } f.skip(1); int fsAreaCamCount = f.readInt(); if (fsAreaCamCount != 0) { return; } f.skip(1); int fsCamLimitCount = f.readInt(); if (fsCamLimitCount != 0) { return; } f.skip(1); int damageShapeCount = f.readInt(); for (int i = 0; i < damageShapeCount; i++) { DamageShape temp = new DamageShape(); temp.read(f); damageShapes.Add(temp); } f.skip(1); int itemCount = f.readInt(); for (int i = 0; i < itemCount; i++) { ItemSpawner temp = new ItemSpawner(); temp.read(f); itemSpawns.Add(temp); } f.skip(1); int generalShapeCount = f.readInt(); for (int i = 0; i < generalShapeCount; i++) { GeneralShape temp = new GeneralShape(); temp.read(f); generalShapes.Add(temp); } f.skip(1); int generalPointCount = f.readInt(); for (int i = 0; i < generalPointCount; i++) { GeneralPoint temp = new GeneralPoint(); temp.read(f); generalPoints.Add(temp); } f.skip(1); if (f.readInt() != 0) //16 { return; //no clue how to be consistent in reading these so... } f.skip(1); if (f.readInt() != 0) //17 { return; //no clue how to be consistent in reading these so... } f.skip(1); if (f.readInt() != 0) //18 { return; //no clue how to be consistent in reading these so... } f.skip(1); if (f.readInt() != 0) //19 { return; //no clue how to be consistent in reading these so... } //LVD doesn't end here and neither does my confusion, will update this part later }
public void open(Object obj, TreeNode entryTree) { collisionGroup.Visible = false; pointGroup.Visible = false; boundGroup.Visible = false; itemSpawnerGroup.Visible = false; generalPointShapeBox.Visible = false; rectangleGroup.Visible = false; pathGroup.Visible = false; meleeCollisionGroup.Visible = false; if (obj is LVDEntry) { LVDEntry entry = (LVDEntry)obj; currentTreeNode = entryTree; currentEntry = entry; //These need implementation in the gui for all objects, not just collisions name.Text = currentEntry.name; subname.Text = currentEntry.subname; xStart.Value = (decimal)currentEntry.startPos[0]; yStart.Value = (decimal)currentEntry.startPos[1]; zStart.Value = (decimal)currentEntry.startPos[2]; flag1.Checked = currentEntry.useStartPos; string boneNameRigging = currentEntry.BoneName; if (boneNameRigging.Length == 0) { boneNameRigging = "None"; } button3.Text = boneNameRigging; if (entry is Collision) { Collision col = (Collision)entry; collisionGroup.Visible = true; flag2.Checked = col.flag2; flag3.Checked = col.flag3; flag4.Checked = col.flag4; vertices.Nodes.Clear(); for (int i = 0; i < col.verts.Count; i++) { vertices.Nodes.Add(new TreeNode($"Vertex {i + 1} ({col.verts[i].x},{col.verts[i].y})") { Tag = col.verts[i] }); } lines.Nodes.Clear(); for (int i = 0; i < col.normals.Count; i++) { object[] temp = { col.normals[i], col.materials[i] }; lines.Nodes.Add(new TreeNode($"Line {i + 1}") { Tag = temp }); } } else if (entry is Spawn) { pointGroup.Visible = true; currentPoint = (Spawn)entry; xPoint.Value = (decimal)((Spawn)entry).x; yPoint.Value = (decimal)((Spawn)entry).y; } else if (entry is Bounds) { boundGroup.Visible = true; currentBounds = (Bounds)entry; topVal.Value = (decimal)currentBounds.top; rightVal.Value = (decimal)currentBounds.right; leftVal.Value = (decimal)currentBounds.left; bottomVal.Value = (decimal)currentBounds.bottom; } else if (entry is ItemSpawner) { itemSpawnerGroup.Visible = true; ItemSpawner spawner = (ItemSpawner)entry; treeView1.Nodes.Clear(); int i = 1; foreach (Section section in spawner.sections) { treeView1.Nodes.Add(new TreeNode($"Section {i++}") { Tag = section }); } } else if (entry is GeneralPoint) { generalPointShapeBox.Visible = true; GeneralPoint p = (GeneralPoint)entry; currentGeneralPoint = p; pointShapeX.Value = (Decimal)p.x; pointShapeY.Value = (Decimal)p.y; } else if (entry is GeneralShape) { GeneralShape s = (GeneralShape)entry; if (s.type == 3) { rectangleGroup.Visible = true; currentGeneralRect = s; rectUpperX.Value = (Decimal)s.x2; rectUpperY.Value = (Decimal)s.y2; rectLowerX.Value = (Decimal)s.x1; rectLowerY.Value = (Decimal)s.y1; } else if (s.type == 4) { pathGroup.Visible = true; currentGeneralPath = s; treeViewPath.Nodes.Clear(); int j = 0; foreach (Vector2D v in s.points) { treeViewPath.Nodes.Add(new TreeNode($"Point {++j} ({v.x},{v.y})") { Tag = v }); } } } else if (entry is DAT.COLL_DATA) { meleeCollisionGroup.Visible = true; meleeVerts.Nodes.Clear(); meleeLinks.Nodes.Clear(); meleePolygons.Nodes.Clear(); int i = 0; foreach (Vector2D vert in ((DAT.COLL_DATA)entry).vertices) { meleeVerts.Nodes.Add(new TreeNode($"Vertex {i++}") { Tag = vert }); } i = 0; foreach (DAT.COLL_DATA.Link link in ((DAT.COLL_DATA)entry).links) { meleeLinks.Nodes.Add(new TreeNode($"Link {i++}") { Tag = link }); } i = 0; foreach (DAT.COLL_DATA.AreaTableEntry ate in ((DAT.COLL_DATA)entry).areaTable) { meleePolygons.Nodes.Add(new TreeNode($"Polygon {i++}") { Tag = ate }); } } } else if (obj is DAT.JOBJ) { DAT.JOBJ jobj = (DAT.JOBJ)obj; currentJobj = jobj; jobjX.Value = (Decimal)jobj.pos.X; jobjY.Value = (Decimal)jobj.pos.Y; jobjZ.Value = (Decimal)jobj.pos.Z; } }
public static void DrawSpawn(Spawn s, bool isRespawn) { GL.LineWidth(2); Vector3 pos = s.useStartPos ? s.startPos : new Vector3(s.x, s.y, 0); float x = pos[0], y = pos[1], z = pos[2]; //Draw quad float width = 3.0f; float height = 10.0f; GL.Color4(Color.FromArgb(100, Color.Blue)); GL.Begin(PrimitiveType.QuadStrip); GL.Vertex3(x - width, y, z); GL.Vertex3(x + width, y, z); GL.Vertex3(x - width, y + height, z); GL.Vertex3(x + width, y + height, z); GL.End(); //Respawn platform if (isRespawn) { float scale = 5.0f; //Draw arrow GL.Color4(Color.FromArgb(200, Color.Gray)); GL.Begin(PrimitiveType.Triangles); GL.Vertex3(x - scale, y, z); GL.Vertex3(x + scale, y, z); GL.Vertex3(x, y, z + scale); GL.Vertex3(x - scale, y, z); GL.Vertex3(x + scale, y, z); GL.Vertex3(x, y, z - scale); GL.Vertex3(x - scale, y, z); GL.Vertex3(x, y - scale, z); GL.Vertex3(x, y, z + scale); GL.Vertex3(x + scale, y, z); GL.Vertex3(x, y - scale, z); GL.Vertex3(x, y, z - scale); GL.Vertex3(x + scale, y, z); GL.Vertex3(x, y - scale, z); GL.Vertex3(x, y, z + scale); GL.Vertex3(x - scale, y, z); GL.Vertex3(x, y - scale, z); GL.Vertex3(x, y, z - scale); GL.End(); //Draw wireframe GL.Color4(Color.FromArgb(200, Color.Black)); GL.Begin(PrimitiveType.Lines); GL.Vertex3(x - scale, y, z); GL.Vertex3(x, y - scale, z); GL.Vertex3(x + scale, y, z); GL.Vertex3(x, y - scale, z); GL.Vertex3(x, y, z - scale); GL.Vertex3(x, y - scale, z); GL.Vertex3(x, y, z + scale); GL.Vertex3(x, y - scale, z); GL.Vertex3(x, y, z - scale); GL.Vertex3(x + scale, y, z); GL.Vertex3(x, y, z - scale); GL.Vertex3(x - scale, y, z); GL.Vertex3(x, y, z + scale); GL.Vertex3(x + scale, y, z); GL.Vertex3(x, y, z + scale); GL.Vertex3(x - scale, y, z); GL.End(); } }