cwe plugin enhancements and additional functionality
This commit is contained in:
parent
43ffee8673
commit
87a626b153
@ -0,0 +1,173 @@
|
||||
//
|
||||
// ChaosWorksSceneEditor.cs -
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2022 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using MBS.Framework.UserInterface;
|
||||
using MBS.Framework.UserInterface.Layouts;
|
||||
using UniversalEditor.Accessors;
|
||||
using UniversalEditor.DataFormats.FileSystem.ChaosWorks;
|
||||
using UniversalEditor.ObjectModels.FileSystem;
|
||||
using UniversalEditor.ObjectModels.Multimedia.Picture.Collection;
|
||||
using UniversalEditor.Plugins.ChaosWorks.DataFormats.Multimedia.PictureCollection;
|
||||
using UniversalEditor.Plugins.ChaosWorks.ObjectModels.ChaosWorksScene;
|
||||
using UniversalEditor.UserInterface;
|
||||
|
||||
namespace UniversalEditor.Plugins.ChaosWorks.UserInterface.Editors.ChaosWorksScene
|
||||
{
|
||||
public class ChaosWorksSceneEditor : Editor
|
||||
{
|
||||
private LevelRenderer levelRenderer = null;
|
||||
public ChaosWorksSceneEditor()
|
||||
{
|
||||
Layout = new BoxLayout(Orientation.Vertical);
|
||||
levelRenderer = new LevelRenderer(this);
|
||||
Controls.Add(levelRenderer, new BoxLayout.Constraints(true, true));
|
||||
}
|
||||
|
||||
private static ChaosWorksVOLDataFormat voldf = new ChaosWorksVOLDataFormat();
|
||||
private System.Collections.Generic.Dictionary<string, PictureCollectionObjectModel> _sprites = new System.Collections.Generic.Dictionary<string, PictureCollectionObjectModel>();
|
||||
private void InitializeSprites()
|
||||
{
|
||||
_sprites.Clear();
|
||||
|
||||
FileSystemObjectModel fsom = new FileSystemObjectModel();
|
||||
string path = MBS.Framework.Application.Instance.GetSetting<string>(new Guid("{25e4e8be-bee2-47ed-bc4c-5d3bb3d5aeae}"));
|
||||
string[] volfiles = System.IO.Directory.GetFiles(path, "*.vol");
|
||||
foreach (string volfile in volfiles)
|
||||
{
|
||||
FileSystemObjectModel fsom1 = new FileSystemObjectModel();
|
||||
Document.Load(fsom1, voldf, new FileAccessor(volfile));
|
||||
|
||||
fsom1.CopyTo(fsom);
|
||||
// ff84f01a-3269-4038-88d8-f9680c8b1b98
|
||||
}
|
||||
|
||||
ChaosWorksSceneObjectModel scene = (ObjectModel as ChaosWorksSceneObjectModel);
|
||||
string groupName = "BROWN";
|
||||
for (int i = 0; i < scene.Sprites.Count; i++)
|
||||
{
|
||||
File f = fsom.GetFileByLabel(String.Format("{0}/{1}/HIRES", groupName.ToUpper(), scene.Sprites[i].SpriteName.ToUpper()));
|
||||
if (f != null)
|
||||
{
|
||||
PictureCollectionObjectModel coll = new PictureCollectionObjectModel();
|
||||
Document.Load(coll, spldf, new EmbeddedFileAccessor(f));
|
||||
_sprites[scene.Sprites[i].SpriteName] = coll;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static CWESpriteDataFormat spldf = new CWESpriteDataFormat();
|
||||
public PictureCollectionObjectModel LoadFFSprite(string name)
|
||||
{
|
||||
if (_sprites.ContainsKey(name))
|
||||
{
|
||||
return _sprites[name];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private string GetDefaultProjectPath()
|
||||
{
|
||||
return MBS.Framework.Application.Instance.GetSetting<string>(new Guid("{25e4e8be-bee2-47ed-bc4c-5d3bb3d5aeae}"));
|
||||
}
|
||||
|
||||
public override void UpdateSelections()
|
||||
{
|
||||
}
|
||||
|
||||
protected override Selection CreateSelectionInternal(object content)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
EditorReference _er = null;
|
||||
public override EditorReference MakeReference()
|
||||
{
|
||||
if (_er == null)
|
||||
{
|
||||
_er = new EditorReference(GetType());
|
||||
_er.SupportedObjectModels.Add(typeof(ChaosWorksSceneObjectModel));
|
||||
}
|
||||
return _er;
|
||||
}
|
||||
|
||||
protected override void OnCreated(EventArgs e)
|
||||
{
|
||||
base.OnCreated(e);
|
||||
|
||||
string searchPath = GetDefaultProjectPath();
|
||||
if (searchPath == null)
|
||||
{
|
||||
MBS.Framework.UserInterface.Dialogs.MessageDialog.ShowDialog("Please specify default project path in settings", "Error", MBS.Framework.UserInterface.Dialogs.MessageDialogButtons.OK, MBS.Framework.UserInterface.Dialogs.MessageDialogIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnObjectModelChanged(EventArgs e)
|
||||
{
|
||||
base.OnObjectModelChanged(e);
|
||||
|
||||
ChaosWorksSceneObjectModel scene = (ObjectModel as ChaosWorksSceneObjectModel);
|
||||
if (scene == null)
|
||||
return;
|
||||
|
||||
InitializeSprites();
|
||||
|
||||
EditorDocumentExplorerNode nodeTypes = new EditorDocumentExplorerNode("Types");
|
||||
for (int i = 0; i < scene.Types.Count; i++)
|
||||
{
|
||||
EditorDocumentExplorerNode node = new EditorDocumentExplorerNode(String.Format("{0} : {1} {2} {3}", scene.Types[i].Name, scene.Types[i].Flags1, scene.Types[i].Flags2, scene.Types[i].Flags3));
|
||||
node.SetExtraData<ChaosWorksSceneType>("type", scene.Types[i]);
|
||||
nodeTypes.Nodes.Add(node);
|
||||
}
|
||||
DocumentExplorer.Nodes.Add(nodeTypes);
|
||||
|
||||
EditorDocumentExplorerNode nodeSprites = new EditorDocumentExplorerNode("Sprites");
|
||||
for (int i = 0; i < scene.Sprites.Count; i++)
|
||||
{
|
||||
EditorDocumentExplorerNode node = new EditorDocumentExplorerNode(String.Format("{0} : {1}", scene.Sprites[i].SpriteName, scene.Sprites[i].TypeName));
|
||||
node.SetExtraData<ChaosWorksSceneSprite>("sprite", scene.Sprites[i]);
|
||||
nodeSprites.Nodes.Add(node);
|
||||
}
|
||||
DocumentExplorer.Nodes.Add(nodeSprites);
|
||||
|
||||
EditorDocumentExplorerNode nodeLevels = new EditorDocumentExplorerNode("Levels");
|
||||
for (int i = 0; i < scene.Levels.Count; i++)
|
||||
{
|
||||
EditorDocumentExplorerNode node = new EditorDocumentExplorerNode(String.Format("Level {0}", i + 1));
|
||||
node.SetExtraData<ChaosWorksSceneLevel>("level", scene.Levels[i]);
|
||||
nodeLevels.Nodes.Add(node);
|
||||
}
|
||||
DocumentExplorer.Nodes.Add(nodeLevels);
|
||||
}
|
||||
|
||||
protected override void OnDocumentExplorerSelectionChanged(EditorDocumentExplorerSelectionChangedEventArgs e)
|
||||
{
|
||||
base.OnDocumentExplorerSelectionChanged(e);
|
||||
|
||||
if (e.Node != null)
|
||||
{
|
||||
ChaosWorksSceneLevel level = e.Node.GetExtraData<ChaosWorksSceneLevel>("level");
|
||||
if (level != null)
|
||||
{
|
||||
levelRenderer.Level = level;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
//
|
||||
// LevelRenderer.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2022 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using MBS.Framework.UserInterface;
|
||||
using MBS.Framework.UserInterface.Drawing;
|
||||
using UniversalEditor.ObjectModels.Multimedia.Picture;
|
||||
using UniversalEditor.ObjectModels.Multimedia.Picture.Collection;
|
||||
using UniversalEditor.Plugins.ChaosWorks.ObjectModels.ChaosWorksScene;
|
||||
using UniversalEditor.Plugins.Multimedia.UserInterface;
|
||||
|
||||
namespace UniversalEditor.Plugins.ChaosWorks.UserInterface.Editors.ChaosWorksScene
|
||||
{
|
||||
public class LevelRenderer : MBS.Framework.UserInterface.CustomControl
|
||||
{
|
||||
private ChaosWorksSceneLevel _Level = null;
|
||||
public ChaosWorksSceneLevel Level { get { return _Level; } set { _Level = value; InitPicx(); Refresh(); } }
|
||||
|
||||
public ChaosWorksSceneEditor ParentEditor { get; private set; } = null;
|
||||
public LevelRenderer(ChaosWorksSceneEditor parentEditor)
|
||||
{
|
||||
ParentEditor = parentEditor;
|
||||
}
|
||||
|
||||
private System.Collections.Generic.Dictionary<int, Image> _picx = new System.Collections.Generic.Dictionary<int, Image>();
|
||||
private void InitPicx()
|
||||
{
|
||||
_picx.Clear();
|
||||
|
||||
double minScrollX = 0, minScrollY = 0, maxScrollX = 0, maxScrollY = 0;
|
||||
|
||||
if (Level != null)
|
||||
{
|
||||
for (int i = 0; i < Level.Planes.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < Level.Planes[i].Objects.Count; j++)
|
||||
{
|
||||
if (Level.Planes[i].Objects[j].Position.X < minScrollX)
|
||||
{
|
||||
minScrollX = Level.Planes[i].Objects[j].Position.X;
|
||||
}
|
||||
if (Level.Planes[i].Objects[j].Position.Y < minScrollY)
|
||||
{
|
||||
minScrollY = Level.Planes[i].Objects[j].Position.Y;
|
||||
}
|
||||
if (Level.Planes[i].Objects[j].Position.X > maxScrollX)
|
||||
{
|
||||
maxScrollX = Level.Planes[i].Objects[j].Position.X;
|
||||
}
|
||||
if (Level.Planes[i].Objects[j].Position.Y > maxScrollY)
|
||||
{
|
||||
maxScrollY = Level.Planes[i].Objects[j].Position.Y;
|
||||
}
|
||||
|
||||
PictureCollectionObjectModel piccoll = ParentEditor.LoadFFSprite(Level.Planes[i].Objects[j].SpriteName);
|
||||
PictureObjectModel pic = piccoll.Pictures[Level.Planes[i].Objects[j].Phase];
|
||||
_picx[j] = pic.ToImage();
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBounds = new MBS.Framework.Drawing.Dimension2D(maxScrollX, maxScrollY);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
if (Level != null)
|
||||
{
|
||||
for (int i = 0; i < Level.Planes.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < Level.Planes[i].Objects.Count; j++)
|
||||
{
|
||||
e.Graphics.DrawImage(_picx[j], Level.Planes[i].Position.X * (Level.Planes[i].Objects[j].Position.X - Level.CenterPosition.X - HorizontalAdjustment.Value), Level.Planes[i].Position.Y * (Level.Planes[i].Objects[j].Position.Y - Level.CenterPosition.Y - VerticalAdjustment.Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnScrolled(ScrolledEventArgs e)
|
||||
{
|
||||
base.OnScrolled(e);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
//
|
||||
// AssemblyInfo.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2022 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("UniversalEditor.Plugins.ChaosWorks.UserInterface")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Mike Becker's Software")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("Mike Becker's Software")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
@ -0,0 +1,15 @@
|
||||
<ApplicationFramework>
|
||||
<SettingsProviders>
|
||||
<SettingsProvider ID="{c66122b4-6dcf-4191-8fbb-4a868992b9f9}">
|
||||
<SettingsGroup ID="{d7d999f5-27ad-4aff-a7ad-3904811e8d44}">
|
||||
<Path>
|
||||
<Part>Editors</Part>
|
||||
<Part>Chaos Works</Part>
|
||||
</Path>
|
||||
<Settings>
|
||||
<TextSetting ID="{25e4e8be-bee2-47ed-bc4c-5d3bb3d5aeae}" Name="DefaultProjectSearchPath" Title="Default project search path" />
|
||||
</Settings>
|
||||
</SettingsGroup>
|
||||
</SettingsProvider>
|
||||
</SettingsProviders>
|
||||
</ApplicationFramework>
|
||||
@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{17A0F754-C902-49EB-A21D-93A4EE75059B}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>UniversalEditor.Plugins.ChaosWorks.UserInterface</RootNamespace>
|
||||
<AssemblyName>UniversalEditor.Plugins.ChaosWorks.UserInterface</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<ReleaseVersion>4.0.2019.12</ReleaseVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Output\Debug\Plugins</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Output\Release\Plugins</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Editors\ChaosWorksScene\ChaosWorksSceneEditor.cs" />
|
||||
<Compile Include="Editors\ChaosWorksScene\LevelRenderer.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Editors\" />
|
||||
<Folder Include="Editors\ChaosWorksScene\" />
|
||||
<Folder Include="SettingsProviders\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
|
||||
<Project>{2D4737E6-6D95-408A-90DB-8DFF38147E85}</Project>
|
||||
<Name>UniversalEditor.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Essential\UniversalEditor.Essential.csproj">
|
||||
<Project>{30467E5C-05BC-4856-AADC-13906EF4CADD}</Project>
|
||||
<Name>UniversalEditor.Essential</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Plugins\UniversalEditor.Plugins.ChaosWorks\UniversalEditor.Plugins.ChaosWorks.csproj">
|
||||
<Project>{30A2F772-8EC1-425A-8D5D-36A0BE4D6B66}</Project>
|
||||
<Name>UniversalEditor.Plugins.ChaosWorks</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.UserInterface\UniversalEditor.UserInterface.csproj">
|
||||
<Project>{8622EBC4-8E20-476E-B284-33D472081F5C}</Project>
|
||||
<Name>UniversalEditor.UserInterface</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MBS.Framework\MBS.Framework\MBS.Framework.csproj">
|
||||
<Project>{00266B21-35C9-4A7F-A6BA-D54D7FDCC25C}</Project>
|
||||
<Name>MBS.Framework</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MBS.Framework.UserInterface\Libraries\MBS.Framework.UserInterface\MBS.Framework.UserInterface.csproj">
|
||||
<Project>{29E1C1BB-3EA5-4062-B62F-85EEC703FE07}</Project>
|
||||
<Name>MBS.Framework.UserInterface</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Plugins\UniversalEditor.Plugins.Multimedia\UniversalEditor.Plugins.Multimedia.csproj">
|
||||
<Project>{BE4D0BA3-0888-42A5-9C09-FC308A4509D2}</Project>
|
||||
<Name>UniversalEditor.Plugins.Multimedia</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\UniversalEditor.Plugins.Multimedia.UserInterface\UniversalEditor.Plugins.Multimedia.UserInterface.csproj">
|
||||
<Project>{D9D5AC3B-9AC0-4D4E-B295-2134FDCF166C}</Project>
|
||||
<Name>UniversalEditor.Plugins.Multimedia.UserInterface</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="SettingsProviders\DefaultSettingsProvider.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UniversalEditor Version="4.0">
|
||||
<Associations>
|
||||
<Association>
|
||||
<Filters>
|
||||
<Filter Title="Chaos Works Engine scene" ContentType="application/x-cwe-def" HintComparison="FilterOnly">
|
||||
<FileNameFilters>
|
||||
<FileNameFilter>*.def</FileNameFilter>
|
||||
</FileNameFilters>
|
||||
</Filter>
|
||||
</Filters>
|
||||
<ObjectModels>
|
||||
<ObjectModel TypeName="UniversalEditor.Plugins.ChaosWorks.ObjectModels.ChaosWorksScene.ChaosWorksSceneObjectModel" />
|
||||
</ObjectModels>
|
||||
<DataFormats>
|
||||
<DataFormat TypeName="UniversalEditor.Plugins.ChaosWorks.DataFormats.ChaosWorksScene.DEFDataFormat" />
|
||||
</DataFormats>
|
||||
</Association>
|
||||
</Associations>
|
||||
</UniversalEditor>
|
||||
@ -0,0 +1,327 @@
|
||||
//
|
||||
// DEFDataFormat.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2022 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using UniversalEditor.IO;
|
||||
using UniversalEditor.Plugins.ChaosWorks.ObjectModels.ChaosWorksScene;
|
||||
|
||||
namespace UniversalEditor.Plugins.ChaosWorks.DataFormats.ChaosWorksScene
|
||||
{
|
||||
public class DEFDataFormat : DataFormat
|
||||
{
|
||||
protected override void LoadInternal(ref ObjectModel objectModel)
|
||||
{
|
||||
ChaosWorksSceneObjectModel scene = (objectModel as ChaosWorksSceneObjectModel);
|
||||
if (scene == null)
|
||||
throw new ObjectModelNotSupportedException();
|
||||
|
||||
IO.Reader reader = Accessor.Reader;
|
||||
string groupName = null;
|
||||
int levelIndex = -1;
|
||||
int planeIndex = -1;
|
||||
int currentLevelIndex = -1;
|
||||
int currentPlaneIndex = 0;
|
||||
string previousGroupName = null;
|
||||
|
||||
while (!reader.EndOfStream)
|
||||
{
|
||||
string line = reader.ReadLine();
|
||||
line = StripComment(line);
|
||||
line = line.Trim();
|
||||
|
||||
if (String.IsNullOrEmpty(line))
|
||||
continue;
|
||||
|
||||
if (line.EndsWith(":"))
|
||||
{
|
||||
// group start
|
||||
groupName = line.Substring(0, line.Length - 1);
|
||||
}
|
||||
else if (line.Contains("="))
|
||||
{
|
||||
// property set
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] parms = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (groupName == "types")
|
||||
{
|
||||
previousGroupName = groupName;
|
||||
if (parms.Length >= 4)
|
||||
{
|
||||
ChaosWorksSceneType type = new ChaosWorksSceneType();
|
||||
type.Flags1 = Int16.Parse(parms[0]);
|
||||
type.Flags2 = Int16.Parse(parms[1]);
|
||||
type.Flags3 = Int16.Parse(parms[2]);
|
||||
type.Name = parms[3];
|
||||
scene.Types.Add(type);
|
||||
}
|
||||
}
|
||||
else if (groupName == "sprites")
|
||||
{
|
||||
previousGroupName = groupName;
|
||||
if (parms.Length >= 2)
|
||||
{
|
||||
ChaosWorksSceneSprite sprite = new ChaosWorksSceneSprite();
|
||||
if (parms[0] == "*")
|
||||
{
|
||||
// idk
|
||||
sprite.SpriteName = parms[1];
|
||||
sprite.TypeName = parms[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite.SpriteName = parms[0];
|
||||
sprite.TypeName = parms[1];
|
||||
}
|
||||
scene.Sprites.Add(sprite);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (groupName != previousGroupName)
|
||||
{
|
||||
levelIndex = -1;
|
||||
planeIndex = -1;
|
||||
previousGroupName = groupName;
|
||||
}
|
||||
|
||||
if (levelIndex == -1 && planeIndex == -1)
|
||||
{
|
||||
if (groupName.StartsWith("level"))
|
||||
{
|
||||
if (groupName.Contains("_plane"))
|
||||
{
|
||||
int indexOfPlane = groupName.IndexOf("_plane");
|
||||
int levelLength = indexOfPlane - "level".Length;
|
||||
|
||||
string szLevelIndex = groupName.Substring("level".Length, levelLength);
|
||||
string szPlaneIndex = groupName.Substring("_plane".Length + indexOfPlane);
|
||||
levelIndex = Int32.Parse(szLevelIndex);
|
||||
planeIndex = Int32.Parse(szPlaneIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
levelIndex = Int32.Parse(groupName.Substring("level".Length));
|
||||
if (levelIndex != currentLevelIndex)
|
||||
{
|
||||
currentLevelIndex = levelIndex;
|
||||
currentPlaneIndex = 0;
|
||||
if (parms.Length == 3)
|
||||
{
|
||||
ChaosWorksSceneLevel currentLevel = new ChaosWorksSceneLevel();
|
||||
currentLevel.ActivePlaneIndex = Int32.Parse(parms[0]);
|
||||
currentLevel.CenterPosition = new PositionVector2(Double.Parse(parms[1]), Double.Parse(parms[2]));
|
||||
scene.Levels.Add(currentLevel);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (planeIndex == -1)
|
||||
{
|
||||
// reading level information
|
||||
ChaosWorksSceneLevelPlane plane = new ChaosWorksSceneLevelPlane();
|
||||
plane.Position = new PositionVector2(Double.Parse(parms[0]), Double.Parse(parms[1]));
|
||||
plane.u1 = Int32.Parse(parms[2]);
|
||||
plane.u2 = Int32.Parse(parms[3]);
|
||||
plane.u3 = Int32.Parse(parms[4]);
|
||||
scene.Levels[levelIndex - 1].Planes.Add(plane);
|
||||
currentPlaneIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// reading plane information
|
||||
if (parms.Length >= 9)
|
||||
{
|
||||
ChaosWorksSceneObject obj = new ChaosWorksSceneObject();
|
||||
obj.SpriteName = parms[0];
|
||||
obj.Phase = Int32.Parse(parms[1]);
|
||||
obj.Mirror = Int32.Parse(parms[2]);
|
||||
obj.Position = new PositionVector2(Double.Parse(parms[3]), Double.Parse(parms[4]));
|
||||
obj.Link = Int32.Parse(parms[5]);
|
||||
obj.LPos = Int32.Parse(parms[6]);
|
||||
obj.S = Int32.Parse(parms[7]);
|
||||
obj.TypeName = parms[8];
|
||||
scene.Levels[levelIndex - 1].Planes[planeIndex - 1].Objects.Add(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string StripComment(string line)
|
||||
{
|
||||
int index = line.IndexOf(';');
|
||||
if (index == -1)
|
||||
return line;
|
||||
|
||||
return line.Substring(0, index);
|
||||
}
|
||||
|
||||
protected override void SaveInternal(ObjectModel objectModel)
|
||||
{
|
||||
ChaosWorksSceneObjectModel scene = (objectModel as ChaosWorksSceneObjectModel);
|
||||
if (scene == null)
|
||||
throw new ObjectModelNotSupportedException();
|
||||
|
||||
int availableLevels = 9, availableTypes = 1024, availableSprites = 1024, availableObjects = 65534;
|
||||
int usedLevels = scene.Levels.Count, usedTypes = scene.Types.Count, usedSprites = scene.Sprites.Count, usedObjects = 0;
|
||||
System.Collections.Generic.Dictionary<string, int> usage = new System.Collections.Generic.Dictionary<string, int>();
|
||||
|
||||
for (int h = 0; h < scene.Levels.Count; h++)
|
||||
{
|
||||
for (int i = 0; i < scene.Levels[h].Planes.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < scene.Levels[h].Planes[i].Objects.Count; j++)
|
||||
{
|
||||
usedObjects++;
|
||||
if (usage.ContainsKey(scene.Levels[h].Planes[i].Objects[j].TypeName))
|
||||
{
|
||||
usage[scene.Levels[h].Planes[i].Objects[j].TypeName] = usage[scene.Levels[h].Planes[i].Objects[j].TypeName] + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
usage[scene.Levels[h].Planes[i].Objects[j].TypeName] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IO.Writer writer = Accessor.Writer;
|
||||
writer.WriteLine(";");
|
||||
writer.WriteLine("; used avail free");
|
||||
writer.WriteLine("; ------------------------------------");
|
||||
|
||||
PrintComment(writer, "levels", usedLevels, availableLevels);
|
||||
PrintComment(writer, "types", usedTypes, availableTypes);
|
||||
PrintComment(writer, "sprites", usedSprites, availableSprites);
|
||||
PrintComment(writer, "objects", usedObjects, availableObjects);
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("; --- type definitions ------------------------------------------------------");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("types:");
|
||||
writer.WriteLine();
|
||||
for (int i = 0; i < scene.Types.Count; i++)
|
||||
{
|
||||
writer.Write(String.Format(" {0} {1} {2} {3}", scene.Types[i].Flags1.ToString().PadLeft(4, '0'), scene.Types[i].Flags2.ToString().PadLeft(4, '0'), scene.Types[i].Flags3.ToString().PadLeft(4, '0'), scene.Types[i].Name.PadRight(25, ' ')));
|
||||
|
||||
int nUsageTimes = 0;
|
||||
if (usage.ContainsKey(scene.Types[i].Name))
|
||||
{
|
||||
nUsageTimes = usage[scene.Types[i].Name];
|
||||
}
|
||||
string usageTimes = null;
|
||||
if (nUsageTimes == 0)
|
||||
{
|
||||
usageTimes = "*** NOT USED ***";
|
||||
}
|
||||
else if (nUsageTimes == 1)
|
||||
{
|
||||
usageTimes = "used once";
|
||||
}
|
||||
else
|
||||
{
|
||||
usageTimes = String.Format("used {0} times", nUsageTimes);
|
||||
}
|
||||
writer.WriteLine(String.Format("; {0}", usageTimes));
|
||||
}
|
||||
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("; --- sprites and default types ---------------------------------------------");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("sprites: ; TOT L1 L2 L3 L4 L5 L6 L7 L8 L9 (kB)");
|
||||
writer.WriteLine(" ; ------------------------------------");
|
||||
writer.WriteLine();
|
||||
for (int i = 0; i < scene.Sprites.Count; i++)
|
||||
{
|
||||
writer.Write(String.Format(" {0} {1}", scene.Sprites[i].SpriteName, scene.Sprites[i].TypeName).PadRight(54, ' '));
|
||||
writer.WriteLine("; 10 3 1 0 2 2 2 0 0 0 4");
|
||||
}
|
||||
|
||||
writer.WriteLine();
|
||||
|
||||
writer.WriteLine("; ---available levels------------------------------------------------------");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine(String.Format("main_level = {0}", scene.Levels.IndexOf(scene.MainLevel)));
|
||||
writer.WriteLine();
|
||||
|
||||
for (int i = 0; i < scene.Levels.Count; i++)
|
||||
{
|
||||
ChaosWorksSceneLevel level = scene.Levels[i];
|
||||
WriteLevel(writer, i, level);
|
||||
}
|
||||
for (int i = 0; i < scene.Levels.Count; i++)
|
||||
{
|
||||
ChaosWorksSceneLevel level = scene.Levels[i];
|
||||
WriteLevelData(writer, i, level);
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteLevelData(Writer writer, int index, ChaosWorksSceneLevel level)
|
||||
{
|
||||
for (int i = 0; i < level.Planes.Count; i++)
|
||||
{
|
||||
if (level.Planes[i].Objects.Count == 0)
|
||||
continue;
|
||||
|
||||
writer.WriteLine(String.Format("level{0}_plane{1}: ;-------------------------------------------------------------", index + 1, i + 1));
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("; sprite phas mirr x y link lpos s type");
|
||||
writer.WriteLine();
|
||||
for (int j = 0; j < level.Planes[i].Objects.Count; j++)
|
||||
{
|
||||
writer.WriteLine(String.Format(" {0} {1} {2} {3} {4} {5} {6} {7} {8}",
|
||||
level.Planes[i].Objects[j].SpriteName.PadRight(24, ' '),
|
||||
level.Planes[i].Objects[j].Phase.ToString().PadLeft(3, '0'),
|
||||
level.Planes[i].Objects[j].Mirror.ToString(),
|
||||
level.Planes[i].Objects[j].Position.X.ToString().PadLeft(5, ' '),
|
||||
level.Planes[i].Objects[j].Position.Y.ToString().PadRight(8, ' '),
|
||||
level.Planes[i].Objects[j].Link.ToString(),
|
||||
level.Planes[i].Objects[j].LPos.ToString().PadRight(4, ' '),
|
||||
level.Planes[i].Objects[j].S.ToString(),
|
||||
level.Planes[i].Objects[j].TypeName));
|
||||
}
|
||||
writer.WriteLine();
|
||||
}
|
||||
}
|
||||
private void WriteLevel(Writer writer, int index, ChaosWorksSceneLevel level)
|
||||
{
|
||||
writer.WriteLine(String.Format("level{0}:", index + 1));
|
||||
writer.WriteLine();
|
||||
writer.Write(String.Format(" {0} {1} {2}", level.ActivePlaneIndex, level.CenterPosition.X.ToString(), level.CenterPosition.Y.ToString()).PadRight(23, ' '));
|
||||
writer.WriteLine("; active plane and center position");
|
||||
for (int i = 0; i < level.Planes.Count; i++)
|
||||
{
|
||||
int planeSize = 0;
|
||||
writer.Write(String.Format(" {0} {1} {2} {3} {4}", level.Planes[i].Position.X.ToString("F3"), level.Planes[i].Position.Y.ToString("F3"), level.Planes[i].u1, level.Planes[i].u2, level.Planes[i].u3).PadRight(25, ' '));
|
||||
writer.WriteLine(String.Format("; plane #{0}, size {1}", (i + 1), planeSize));
|
||||
}
|
||||
writer.WriteLine();
|
||||
}
|
||||
|
||||
private void PrintComment(Writer writer, string title, int nUsed, int nAvailable)
|
||||
{
|
||||
writer.WriteLine(String.Format("; {3}{0}{1}{2}", nUsed.ToString().PadRight(8, ' '), nAvailable.ToString().PadRight(8, ' '), (nAvailable - nUsed).ToString().PadRight(8, ' '), title.PadRight(13, ' ')));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -151,7 +151,7 @@ namespace UniversalEditor.DataFormats.FileSystem.ChaosWorks
|
||||
}
|
||||
|
||||
short CHUNKSIZE = br.ReadInt16();
|
||||
Console.WriteLine("cwe-vol: reading chunk size {0}", CHUNKSIZE);
|
||||
// Console.WriteLine("cwe-vol: reading chunk size {0}", CHUNKSIZE);
|
||||
|
||||
byte[] compressed = br.ReadBytes(CHUNKSIZE);
|
||||
byte[] decompressed = lzrw1.Decompress(compressed);
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
//
|
||||
// FileSystemObjectModelExtensions.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2022 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using UniversalEditor.ObjectModels.FileSystem;
|
||||
|
||||
namespace UniversalEditor.DataFormats.FileSystem.ChaosWorks
|
||||
{
|
||||
public static class FileSystemObjectModelExtensions
|
||||
{
|
||||
public static File GetFileByLabel(this FileSystemObjectModel fsom, string label)
|
||||
{
|
||||
File[] files = fsom.GetAllFiles();
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
{
|
||||
if ((label?.Equals(files[i].GetAdditionalDetail("ChaosWorks.VOL.Label"))).GetValueOrDefault(false))
|
||||
return files[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
//
|
||||
// ChaosWorksSceneLevel.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2022 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
namespace UniversalEditor.Plugins.ChaosWorks.ObjectModels.ChaosWorksScene
|
||||
{
|
||||
public class ChaosWorksSceneLevel
|
||||
{
|
||||
public class ChaosWorksSceneLevelCollection
|
||||
: System.Collections.ObjectModel.Collection<ChaosWorksSceneLevel>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the index of the active plane (usually 5).
|
||||
/// </summary>
|
||||
/// <value>The index of the active plane.</value>
|
||||
public int ActivePlaneIndex { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the center position.
|
||||
/// </summary>
|
||||
/// <value>The center position.</value>
|
||||
public PositionVector2 CenterPosition { get; set; } = PositionVector2.Empty;
|
||||
|
||||
public ChaosWorksSceneLevelPlane.ChaosWorksSceneLevelPlaneCollection Planes { get; } = new ChaosWorksSceneLevelPlane.ChaosWorksSceneLevelPlaneCollection();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
//
|
||||
// ChaosWorksSceneLevelPlane.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2022 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
namespace UniversalEditor.Plugins.ChaosWorks.ObjectModels.ChaosWorksScene
|
||||
{
|
||||
public class ChaosWorksSceneLevelPlane
|
||||
{
|
||||
public class ChaosWorksSceneLevelPlaneCollection
|
||||
: System.Collections.ObjectModel.Collection<ChaosWorksSceneLevelPlane>
|
||||
{
|
||||
}
|
||||
|
||||
public PositionVector2 Position { get; set; } = PositionVector2.Empty;
|
||||
public int u1 { get; set; } = 0;
|
||||
public int u2 { get; set; } = 0;
|
||||
public int u3 { get; set; } = 0;
|
||||
|
||||
public ChaosWorksSceneObject.ChaosWorksSceneObjectCollection Objects { get; } = new ChaosWorksSceneObject.ChaosWorksSceneObjectCollection();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
//
|
||||
// ChaosWorksSceneObject.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2022 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
namespace UniversalEditor.Plugins.ChaosWorks.ObjectModels.ChaosWorksScene
|
||||
{
|
||||
public class ChaosWorksSceneObject
|
||||
{
|
||||
public class ChaosWorksSceneObjectCollection
|
||||
: System.Collections.ObjectModel.Collection<ChaosWorksSceneObject>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string SpriteName { get; set; }
|
||||
public int Phase { get; set; }
|
||||
public int Mirror { get; set; }
|
||||
public PositionVector2 Position { get; set; }
|
||||
public int Link { get; set; }
|
||||
public int LPos { get; set; }
|
||||
public int S { get; set; }
|
||||
public string TypeName { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
//
|
||||
// ChaosWorkSceneObjectModel.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2022 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
namespace UniversalEditor.Plugins.ChaosWorks.ObjectModels.ChaosWorksScene
|
||||
{
|
||||
public class ChaosWorksSceneObjectModel : ObjectModel
|
||||
{
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
|
||||
public override void CopyTo(ObjectModel where)
|
||||
{
|
||||
}
|
||||
|
||||
private static ObjectModelReference _omr = null;
|
||||
protected override ObjectModelReference MakeReferenceInternal()
|
||||
{
|
||||
if (_omr == null)
|
||||
{
|
||||
_omr = base.MakeReferenceInternal();
|
||||
_omr.Path = new string[] { "Game Development", "Chaos Works", "Chaos Works Scene" };
|
||||
}
|
||||
return _omr;
|
||||
}
|
||||
|
||||
public ChaosWorksSceneType.ChaosWorksSceneTypeCollection Types { get; } = new ChaosWorksSceneType.ChaosWorksSceneTypeCollection();
|
||||
public ChaosWorksSceneSprite.ChaosWorksSceneSpriteCollection Sprites { get; } = new ChaosWorksSceneSprite.ChaosWorksSceneSpriteCollection();
|
||||
public ChaosWorksSceneLevel.ChaosWorksSceneLevelCollection Levels { get; } = new ChaosWorksSceneLevel.ChaosWorksSceneLevelCollection();
|
||||
|
||||
public ChaosWorksSceneLevel MainLevel { get; set; } = null;
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
//
|
||||
// ChaosWorksSceneSprite.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2022 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
namespace UniversalEditor.Plugins.ChaosWorks.ObjectModels.ChaosWorksScene
|
||||
{
|
||||
public class ChaosWorksSceneSprite
|
||||
{
|
||||
public class ChaosWorksSceneSpriteCollection
|
||||
: System.Collections.ObjectModel.Collection<ChaosWorksSceneSprite>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string SpriteName { get; set; } = null;
|
||||
public string TypeName { get; set; } = null;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{0} {1}", SpriteName, TypeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
//
|
||||
// ChaosWorksSceneType.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2022 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
namespace UniversalEditor.Plugins.ChaosWorks.ObjectModels.ChaosWorksScene
|
||||
{
|
||||
public class ChaosWorksSceneType
|
||||
{
|
||||
public class ChaosWorksSceneTypeCollection
|
||||
: System.Collections.ObjectModel.Collection<ChaosWorksSceneType>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public short Flags1 { get; set; } = 0;
|
||||
public short Flags2 { get; set; } = 0;
|
||||
public short Flags3 { get; set; } = 0;
|
||||
public string Name { get; set; } = String.Empty;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{0}: {1} {2} {3}", Name, Flags1, Flags2, Flags3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -43,6 +43,14 @@
|
||||
<Compile Include="DataFormats\FileSystem\ChaosWorks\Internal\ChaosWorksVOLV2ChunkInfo.cs" />
|
||||
<Compile Include="DataFormats\Multimedia\Palette\SPPDataFormat.cs" />
|
||||
<Compile Include="DataFormats\Multimedia\PictureCollection\CWESpriteDataFormat.cs" />
|
||||
<Compile Include="ObjectModels\ChaosWorksScene\ChaosWorksSceneObjectModel.cs" />
|
||||
<Compile Include="ObjectModels\ChaosWorksScene\ChaosWorksSceneType.cs" />
|
||||
<Compile Include="ObjectModels\ChaosWorksScene\ChaosWorksSceneLevel.cs" />
|
||||
<Compile Include="ObjectModels\ChaosWorksScene\ChaosWorksSceneLevelPlane.cs" />
|
||||
<Compile Include="ObjectModels\ChaosWorksScene\ChaosWorksSceneSprite.cs" />
|
||||
<Compile Include="DataFormats\ChaosWorksScene\DEFDataFormat.cs" />
|
||||
<Compile Include="ObjectModels\ChaosWorksScene\ChaosWorksSceneObject.cs" />
|
||||
<Compile Include="DataFormats\FileSystem\ChaosWorks\FileSystemObjectModelExtensions.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Compression\UniversalEditor.Compression.csproj">
|
||||
@ -72,11 +80,16 @@
|
||||
<Folder Include="DataFormats\Multimedia\Palette\" />
|
||||
<Folder Include="DataFormats\Multimedia\PictureCollection\" />
|
||||
<Folder Include="Associations\" />
|
||||
<Folder Include="Associations\ChaosWorksScene\" />
|
||||
<Folder Include="ObjectModels\" />
|
||||
<Folder Include="ObjectModels\ChaosWorksScene\" />
|
||||
<Folder Include="DataFormats\ChaosWorksScene\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Associations\FileSystem\ChaosWorksEngine.uexml" />
|
||||
<EmbeddedResource Include="Associations\Multimedia\Palette\SPPDataFormat.uexml" />
|
||||
<EmbeddedResource Include="Associations\Multimedia\PictureCollection\SPXDataFormat.uexml" />
|
||||
<EmbeddedResource Include="Associations\ChaosWorksScene\ChaosWorksScene.uexml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@ -221,6 +221,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Swa
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Dweep", "Plugins\UniversalEditor.Plugins.Dweep\UniversalEditor.Plugins.Dweep.csproj", "{9496A94E-F386-4787-818F-FFB04A8EA892}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.ChaosWorks.UserInterface", "Plugins.UserInterface\UniversalEditor.Plugins.ChaosWorks.UserInterface\UniversalEditor.Plugins.ChaosWorks.UserInterface.csproj", "{17A0F754-C902-49EB-A21D-93A4EE75059B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -641,6 +643,10 @@ Global
|
||||
{9496A94E-F386-4787-818F-FFB04A8EA892}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9496A94E-F386-4787-818F-FFB04A8EA892}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9496A94E-F386-4787-818F-FFB04A8EA892}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{17A0F754-C902-49EB-A21D-93A4EE75059B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{17A0F754-C902-49EB-A21D-93A4EE75059B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{17A0F754-C902-49EB-A21D-93A4EE75059B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{17A0F754-C902-49EB-A21D-93A4EE75059B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{6F0AB1AF-E1A1-4D19-B19C-05BBB15C94B2} = {05D15661-E684-4EC9-8FBD-C014BA433CC5}
|
||||
@ -746,6 +752,7 @@ Global
|
||||
{5763E226-26B9-4FAA-8305-4F48E61357E9} = {2ED32D16-6C06-4450-909A-40D32DA67FB4}
|
||||
{A3D15C91-8D55-4F02-87DC-A1C5E63B8C56} = {2ED32D16-6C06-4450-909A-40D32DA67FB4}
|
||||
{9496A94E-F386-4787-818F-FFB04A8EA892} = {2ED32D16-6C06-4450-909A-40D32DA67FB4}
|
||||
{17A0F754-C902-49EB-A21D-93A4EE75059B} = {7B535D74-5496-4802-B809-89ED88274A91}
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
Policies = $0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user