wip map importer stuff
This commit is contained in:
15
Assets/Maps/cube.map
Normal file
15
Assets/Maps/cube.map
Normal file
@@ -0,0 +1,15 @@
|
||||
// Game: Goake
|
||||
// Format: Quake3
|
||||
// entity 0
|
||||
{
|
||||
"classname" "worldspawn"
|
||||
// brush 0
|
||||
{
|
||||
( -64 -64 -16 ) ( -64 -63 -16 ) ( -64 -64 -15 ) __TB_empty 0 0 0 0.0625 0.0625 0 0 0
|
||||
( -64 -64 -16 ) ( -64 -64 -15 ) ( -63 -64 -16 ) __TB_empty 0 0 0 0.0625 0.0625 0 0 0
|
||||
( -64 -64 -16 ) ( -63 -64 -16 ) ( -64 -63 -16 ) __TB_empty 0 0 0 0.0625 0.0625 0 0 0
|
||||
( 64 64 16 ) ( 64 65 16 ) ( 65 64 16 ) __TB_empty 0 0 0 0.0625 0.0625 0 0 0
|
||||
( 64 64 16 ) ( 65 64 16 ) ( 64 64 17 ) __TB_empty 0 0 0 0.0625 0.0625 0 0 0
|
||||
( 64 64 16 ) ( 64 64 17 ) ( 64 65 16 ) __TB_empty 0 0 0 0.0625 0.0625 0 0 0
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"ID": "3c7bc3854d42f9b1b0fea9ba0d7fa8e9",
|
||||
"TypeName": "FlaxEditor.Content.Settings.GameSettings",
|
||||
"EngineBuild": 6219,
|
||||
"EngineBuild": 6221,
|
||||
"Data": {
|
||||
"ProductName": "Goake",
|
||||
"CompanyName": "GoaLitiuM",
|
||||
"FirstScene": "a0165b834429c74b9d547c88fb3a0de0",
|
||||
"FirstScene": "194e05f445ece24ec5448d886e1334df",
|
||||
"NoSplashScreen": true,
|
||||
"Time": "a55dc3c04da4ea3744b7f1994565beac",
|
||||
"Audio": "492a33824049ba25a8bdcdb148179e67",
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
Content/SceneData/Scene 0/CSG_Collision.flax
Normal file
BIN
Content/SceneData/Scene 0/CSG_Collision.flax
Normal file
Binary file not shown.
BIN
Content/SceneData/Scene 0/CSG_Data.flax
Normal file
BIN
Content/SceneData/Scene 0/CSG_Data.flax
Normal file
Binary file not shown.
BIN
Content/SceneData/Scene 0/CSG_Mesh.flax
Normal file
BIN
Content/SceneData/Scene 0/CSG_Mesh.flax
Normal file
Binary file not shown.
386
Content/Scenes/Scene 0.scene
Normal file
386
Content/Scenes/Scene 0.scene
Normal file
@@ -0,0 +1,386 @@
|
||||
{
|
||||
"ID": "194e05f445ece24ec5448d886e1334df",
|
||||
"TypeName": "FlaxEngine.SceneAsset",
|
||||
"EngineBuild": 6221,
|
||||
"Data": [
|
||||
{
|
||||
"ID": "194e05f445ece24ec5448d886e1334df",
|
||||
"TypeName": "FlaxEngine.Scene",
|
||||
"LightmapSettings": {
|
||||
"IndirectLightingIntensity": 1.0,
|
||||
"GlobalObjectsScale": 1.0,
|
||||
"ChartsPadding": 3,
|
||||
"AtlasSize": 1024,
|
||||
"BounceCount": 1,
|
||||
"CompressLightmaps": true,
|
||||
"UseGeometryWithNoMaterials": true,
|
||||
"Quality": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "c95a3dab492c1b2046ce2191daa2b111",
|
||||
"TypeName": "Game.Q3MapImporter",
|
||||
"ParentID": "194e05f445ece24ec5448d886e1334df",
|
||||
"V": {
|
||||
"material": "076df2f449a475bd96087ebb03e0cfc6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "19bf0c4f41c16717c90e05a0bdc62e44",
|
||||
"TypeName": "FlaxEngine.RigidBody",
|
||||
"ParentID": "194e05f445ece24ec5448d886e1334df",
|
||||
"Name": "PlayerPrefab 0",
|
||||
"Transform": {
|
||||
"Translation": {
|
||||
"X": -32.320621490478519,
|
||||
"Y": 7.693744659423828,
|
||||
"Z": -187.24435424804688
|
||||
}
|
||||
},
|
||||
"OverrideMass": true,
|
||||
"Mass": 10.0,
|
||||
"LinearDamping": 0.0,
|
||||
"AngularDamping": 0.0,
|
||||
"Constraints": 56,
|
||||
"IsKinematic": true,
|
||||
"EnableGravity": false
|
||||
},
|
||||
{
|
||||
"ID": "cd7b08774b33983314862eae1a7e6567",
|
||||
"TypeName": "Game.CameraMovement",
|
||||
"ParentID": "19bf0c4f41c16717c90e05a0bdc62e44",
|
||||
"V": {}
|
||||
},
|
||||
{
|
||||
"ID": "39992ccc4fac12dab97aa4bfb52f0041",
|
||||
"TypeName": "FlaxEngine.EmptyActor",
|
||||
"ParentID": "19bf0c4f41c16717c90e05a0bdc62e44",
|
||||
"Name": "RootActor"
|
||||
},
|
||||
{
|
||||
"ID": "f54fa132472299e63c8f1aa4f587c179",
|
||||
"TypeName": "FlaxEngine.Camera",
|
||||
"ParentID": "39992ccc4fac12dab97aa4bfb52f0041",
|
||||
"Name": "Camera",
|
||||
"Transform": {
|
||||
"Translation": {
|
||||
"X": 0.0,
|
||||
"Y": 28.7337646484375,
|
||||
"Z": 0.0
|
||||
}
|
||||
},
|
||||
"Near": 1.0
|
||||
},
|
||||
{
|
||||
"ID": "a42bade1470cd988c7c76685802b0156",
|
||||
"TypeName": "FlaxEngine.AudioListener",
|
||||
"ParentID": "39992ccc4fac12dab97aa4bfb52f0041",
|
||||
"Name": "AudioListener"
|
||||
},
|
||||
{
|
||||
"ID": "89ff5a9540fdffc5f3ef52b3f38bf491",
|
||||
"TypeName": "FlaxEngine.CapsuleCollider",
|
||||
"ParentID": "19bf0c4f41c16717c90e05a0bdc62e44",
|
||||
"IsActive": false,
|
||||
"Name": "CapsuleCollider",
|
||||
"Transform": {
|
||||
"Orientation": {
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.7071068286895752,
|
||||
"W": 0.7071068286895752
|
||||
}
|
||||
},
|
||||
"ContactOffset": 0.0,
|
||||
"Material": "d99b8b6f40198beea4703dadd642150e",
|
||||
"Radius": 16.0,
|
||||
"Height": 52.0
|
||||
},
|
||||
{
|
||||
"ID": "5a747ea94050dc31c24017a01556aecd",
|
||||
"TypeName": "FlaxEngine.BoxCollider",
|
||||
"ParentID": "19bf0c4f41c16717c90e05a0bdc62e44",
|
||||
"Name": "BoxCollider",
|
||||
"ContactOffset": 0.0,
|
||||
"Material": "ffe0e84c49607480f67a3994a7fe11a8",
|
||||
"Size": {
|
||||
"X": 32.0,
|
||||
"Y": 84.0,
|
||||
"Z": 32.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "bfc9d0ee45a71ce96838aea25a540f9c",
|
||||
"TypeName": "FlaxEngine.MeshCollider",
|
||||
"ParentID": "19bf0c4f41c16717c90e05a0bdc62e44",
|
||||
"IsActive": false,
|
||||
"Name": "CylinderCollider",
|
||||
"Transform": {
|
||||
"Scale": {
|
||||
"X": 0.3199999928474426,
|
||||
"Y": 0.8399999737739563,
|
||||
"Z": 0.3199999928474426
|
||||
}
|
||||
},
|
||||
"CollisionData": "593d92914c4bd54679ddec9e539bba80"
|
||||
},
|
||||
{
|
||||
"ID": "ff6b6db54b5aa08e7286ef86246149ef",
|
||||
"TypeName": "FlaxEngine.UICanvas",
|
||||
"ParentID": "194e05f445ece24ec5448d886e1334df",
|
||||
"Name": "DefaultHudPrefab 0",
|
||||
"Transform": {
|
||||
"Orientation": {
|
||||
"X": 1.0,
|
||||
"Y": 4.371138828673793e-8,
|
||||
"Z": 4.371138828673793e-8,
|
||||
"W": 1.910685465164705e-15
|
||||
}
|
||||
},
|
||||
"V": {}
|
||||
},
|
||||
{
|
||||
"ID": "791756db4da9af04d7513f9f305e4652",
|
||||
"TypeName": "Cabrito.FpsScript",
|
||||
"ParentID": "ff6b6db54b5aa08e7286ef86246149ef",
|
||||
"V": {
|
||||
"control": "d15fa816476f9d66ebdfc7ae25c3c6ea"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "b20f2b0a486762a15e6a7caf72ae66c2",
|
||||
"TypeName": "Cabrito.ConsoleScript",
|
||||
"ParentID": "ff6b6db54b5aa08e7286ef86246149ef",
|
||||
"V": {
|
||||
"ConsoleFont": "43f32bec443158643f53699f07b2e09c",
|
||||
"BackgroundColor": {
|
||||
"R": 0.0,
|
||||
"G": 0.0,
|
||||
"B": 0.0,
|
||||
"A": 1.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "d15fa816476f9d66ebdfc7ae25c3c6ea",
|
||||
"TypeName": "FlaxEngine.UIControl",
|
||||
"ParentID": "ff6b6db54b5aa08e7286ef86246149ef",
|
||||
"Name": "FPSUIControl",
|
||||
"Transform": {
|
||||
"Translation": {
|
||||
"X": 0.0,
|
||||
"Y": 506.0,
|
||||
"Z": 0.0
|
||||
}
|
||||
},
|
||||
"Control": "FlaxEngine.GUI.Label",
|
||||
"Data": {
|
||||
"Text": "eFPS: 120\nuFPS: 120\nrFPS: 120\npFPS: 30\nCon: NaNms\nDirectX11\nGC memory: 8.026576MB",
|
||||
"TextColor": {
|
||||
"R": 1.0,
|
||||
"G": 1.0,
|
||||
"B": 1.0,
|
||||
"A": 1.0
|
||||
},
|
||||
"TextColorHighlighted": {
|
||||
"R": 1.0,
|
||||
"G": 1.0,
|
||||
"B": 1.0,
|
||||
"A": 1.0
|
||||
},
|
||||
"HorizontalAlignment": 0,
|
||||
"VerticalAlignment": 0,
|
||||
"Wrapping": 0,
|
||||
"Font": {
|
||||
"Font": "4508d98f4aa1f0bd59362b81d47e38f4",
|
||||
"Size": 10
|
||||
},
|
||||
"Margin": {
|
||||
"Left": 0.0,
|
||||
"Right": 0.0,
|
||||
"Top": 0.0,
|
||||
"Bottom": 0.0
|
||||
},
|
||||
"ClipText": false,
|
||||
"AutoWidth": true,
|
||||
"AutoHeight": true,
|
||||
"AutoFitText": false,
|
||||
"AutoFitTextRange": {
|
||||
"X": 0.1,
|
||||
"Y": 100.0
|
||||
},
|
||||
"ClipChildren": true,
|
||||
"CullChildren": true,
|
||||
"AnchorMin": {
|
||||
"X": 0.0,
|
||||
"Y": 1.0
|
||||
},
|
||||
"AnchorMax": {
|
||||
"X": 0.0,
|
||||
"Y": 1.0
|
||||
},
|
||||
"Offsets": {
|
||||
"Left": 0.0,
|
||||
"Right": 143.0,
|
||||
"Top": -80.0,
|
||||
"Bottom": 112.0
|
||||
},
|
||||
"Scale": {
|
||||
"X": 1.0,
|
||||
"Y": 1.0
|
||||
},
|
||||
"Pivot": {
|
||||
"X": 0.5,
|
||||
"Y": 0.5
|
||||
},
|
||||
"Shear": {
|
||||
"X": 0.0,
|
||||
"Y": 0.0
|
||||
},
|
||||
"Rotation": 0.0,
|
||||
"BackgroundColor": {
|
||||
"R": 0.0,
|
||||
"G": 0.0,
|
||||
"B": 0.0,
|
||||
"A": 0.0
|
||||
},
|
||||
"Enabled": true,
|
||||
"Visible": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "7261228a42b41682cf48e89d910ddcff",
|
||||
"TypeName": "FlaxEngine.UIControl",
|
||||
"ParentID": "ff6b6db54b5aa08e7286ef86246149ef",
|
||||
"Name": "UIControl"
|
||||
},
|
||||
{
|
||||
"ID": "bd1e2ea8425a68342d01f4975e4cdf3e",
|
||||
"TypeName": "FlaxEngine.UIControl",
|
||||
"ParentID": "ff6b6db54b5aa08e7286ef86246149ef",
|
||||
"Name": "ContainerControl 0",
|
||||
"Transform": {
|
||||
"Translation": {
|
||||
"X": 45279.0,
|
||||
"Y": -113.0,
|
||||
"Z": 0.0
|
||||
}
|
||||
},
|
||||
"Control": "FlaxEngine.GUI.ContainerControl",
|
||||
"Data": {
|
||||
"ClipChildren": true,
|
||||
"CullChildren": true,
|
||||
"AnchorMin": {
|
||||
"X": 1.0,
|
||||
"Y": 0.5
|
||||
},
|
||||
"AnchorMax": {
|
||||
"X": 1.0,
|
||||
"Y": 0.5
|
||||
},
|
||||
"Offsets": {
|
||||
"Left": 44188.0,
|
||||
"Right": 100.0,
|
||||
"Top": -406.0,
|
||||
"Bottom": 30.0
|
||||
},
|
||||
"Scale": {
|
||||
"X": 1.0,
|
||||
"Y": 1.0
|
||||
},
|
||||
"Pivot": {
|
||||
"X": 0.5,
|
||||
"Y": 0.5
|
||||
},
|
||||
"Shear": {
|
||||
"X": 0.0,
|
||||
"Y": 0.0
|
||||
},
|
||||
"Rotation": 0.0,
|
||||
"BackgroundColor": {
|
||||
"R": 0.0,
|
||||
"G": 0.0,
|
||||
"B": 0.0,
|
||||
"A": 0.0
|
||||
},
|
||||
"Enabled": true,
|
||||
"Visible": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "9b0c532d4247061970c809a0af58c82a",
|
||||
"TypeName": "FlaxEngine.PostFxVolume",
|
||||
"ParentID": "194e05f445ece24ec5448d886e1334df",
|
||||
"Name": "PostFxVolume 0",
|
||||
"Size": {
|
||||
"X": 10.0,
|
||||
"Y": 10.0,
|
||||
"Z": 10.0
|
||||
},
|
||||
"IsBounded": false,
|
||||
"Settings": {
|
||||
"AO": {
|
||||
"OverrideFlags": 1,
|
||||
"Enabled": false
|
||||
},
|
||||
"Bloom": {
|
||||
"OverrideFlags": 1,
|
||||
"Enabled": false
|
||||
},
|
||||
"ToneMapping": {
|
||||
"OverrideFlags": 4,
|
||||
"Mode": 0
|
||||
},
|
||||
"ColorGrading": {},
|
||||
"EyeAdaptation": {
|
||||
"OverrideFlags": 1,
|
||||
"Mode": 0
|
||||
},
|
||||
"CameraArtifacts": {
|
||||
"OverrideFlags": 1,
|
||||
"VignetteIntensity": 0.0,
|
||||
"GrainAmount": 0.0
|
||||
},
|
||||
"LensFlares": {},
|
||||
"DepthOfField": {},
|
||||
"MotionBlur": {
|
||||
"OverrideFlags": 1,
|
||||
"Enabled": false
|
||||
},
|
||||
"SSR": {
|
||||
"OverrideFlags": 1,
|
||||
"Intensity": 0.0
|
||||
},
|
||||
"AA": {
|
||||
"OverrideFlags": 1,
|
||||
"Mode": 0
|
||||
},
|
||||
"PostFxMaterials": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "d5ffa50f41e7f68e73b8c98bb98c84e6",
|
||||
"TypeName": "FlaxEngine.StaticModel",
|
||||
"ParentID": "194e05f445ece24ec5448d886e1334df",
|
||||
"Name": "Capsule",
|
||||
"Transform": {
|
||||
"Translation": {
|
||||
"X": -42.142974853515628,
|
||||
"Y": 1.731597900390625,
|
||||
"Z": 261.0594482421875
|
||||
}
|
||||
},
|
||||
"Model": "3f82e57744f57c28285150b646ad2198",
|
||||
"Buffer": {
|
||||
"Entries": [
|
||||
{
|
||||
"Material": "076df2f449a475bd96087ebb03e0cfc6",
|
||||
"ShadowsMode": 3,
|
||||
"Visible": true,
|
||||
"ReceiveDecals": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,17 +1,18 @@
|
||||
{
|
||||
"ID": "4a5eec97484253fed72934860ae62c40",
|
||||
"TypeName": "FlaxEditor.Content.Settings.WindowsPlatformSettings",
|
||||
"EngineBuild": 6216,
|
||||
"EngineBuild": 6221,
|
||||
"Data": {
|
||||
"WindowMode": 0,
|
||||
"ScreenWidth": 1280,
|
||||
"ScreenHeight": 720,
|
||||
"ResizableWindow": false,
|
||||
"RunInBackground": false,
|
||||
"ResizableWindow": true,
|
||||
"RunInBackground": true,
|
||||
"ForceSingleInstance": false,
|
||||
"SupportDX12": true,
|
||||
"OverrideIcon": "00000000-0000-0000-0000-000000000000",
|
||||
"SupportDX12": false,
|
||||
"SupportDX11": true,
|
||||
"SupportDX10": true,
|
||||
"SupportVulkan": true
|
||||
"SupportDX10": false,
|
||||
"SupportVulkan": false
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -22,7 +22,15 @@ namespace Cabrito
|
||||
|
||||
protected TextLayoutOptions _layout;
|
||||
|
||||
public FontReference Font;
|
||||
private FontReference Font;
|
||||
|
||||
public int FontHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return Font.GetFont().Height;
|
||||
}
|
||||
}
|
||||
|
||||
public float LineSpacing = 1.0f;
|
||||
|
||||
@@ -65,12 +73,14 @@ namespace Cabrito
|
||||
{
|
||||
}
|
||||
|
||||
public ConsoleContentTextBox(ConsoleInputTextBox inputBox, float x, float y, float width, float height) : base(
|
||||
public ConsoleContentTextBox(FontReference font, ConsoleInputTextBox inputBox, float x, float y, float width, float height) : base(
|
||||
x, y, width, height)
|
||||
{
|
||||
this.inputBox = inputBox;
|
||||
Height = height;
|
||||
|
||||
Font = font;
|
||||
|
||||
_layout = TextLayoutOptions.Default;
|
||||
_layout.VerticalAlignment = TextAlignment.Near;
|
||||
_layout.TextWrapping = TextWrapping.WrapChars;
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.Assertions;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
namespace Cabrito
|
||||
@@ -85,13 +86,12 @@ namespace Cabrito
|
||||
if (consoleBox == null)
|
||||
{
|
||||
//consoleBox = new ConsoleContentTextBox(null, 0, 0, consoleSize.X, consoleSize.Y - fontHeight);
|
||||
consoleBox = new ConsoleContentTextBox(null, 0, 0, 0, 0);
|
||||
consoleBox = new ConsoleContentTextBox(fontReference, null, 0, 0, 0, 0);
|
||||
|
||||
|
||||
consoleBox.SetAnchorPreset(AnchorPresets.HorizontalStretchTop, true);
|
||||
//consoleBox.AnchorMax = new Vector2(1.0f, ConsoleHeight);
|
||||
//consoleBox.Height = consoleSize.Y - fontHeight;
|
||||
consoleBox.Font = fontReference;
|
||||
|
||||
//consoleBox.HorizontalAlignment = TextAlignment.Near;
|
||||
//consoleBox.VerticalAlignment = TextAlignment.Near;
|
||||
@@ -113,14 +113,12 @@ namespace Cabrito
|
||||
if (consoleNotifyBox == null)
|
||||
{
|
||||
//consoleBox = new ConsoleContentTextBox(null, 0, 0, consoleSize.X, consoleSize.Y - fontHeight);
|
||||
consoleNotifyBox = new ConsoleContentTextBox(null, 0, 0, 0, 0);
|
||||
consoleNotifyBox = new ConsoleContentTextBox(fontReference, null, 0, 0, 0, 0);
|
||||
consoleNotifyBox.HeightMultiplier = 0;
|
||||
consoleNotifyBox.Height = ConsoleNotifyLines * fontHeight;
|
||||
consoleNotifyBox.SetAnchorPreset(AnchorPresets.HorizontalStretchTop, true);
|
||||
//consoleBox.AnchorMax = new Vector2(1.0f, ConsoleHeight);
|
||||
|
||||
consoleNotifyBox.Font = fontReference;
|
||||
|
||||
//consoleBox.HorizontalAlignment = TextAlignment.Near;
|
||||
//consoleBox.VerticalAlignment = TextAlignment.Near;
|
||||
//consoleNotifyBox.HeightMultiplier = ConsoleHeight;
|
||||
@@ -263,11 +261,23 @@ namespace Cabrito
|
||||
|
||||
private void OnSendExceptionLog(Exception exception, FlaxEngine.Object obj)
|
||||
{
|
||||
Console.Print("[EXCEP] " + exception.Message);
|
||||
AssertionException assert = exception as AssertionException;
|
||||
if (assert != null)
|
||||
{
|
||||
var assertLines = assert.Message.Split('\n');
|
||||
if (assertLines.Length > 2)
|
||||
Console.Print("Assert Failure: " + assertLines[2]);
|
||||
else
|
||||
Console.Print("Assert Failure: " + assert.Message);
|
||||
}
|
||||
else
|
||||
Console.Print("[EXCEP] " + exception.Message);
|
||||
}
|
||||
|
||||
public override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
|
||||
//consoleInputEvent.Triggered -= OnConsoleInputEvent;
|
||||
consoleInputEvent?.Dispose();
|
||||
consoleBox?.Dispose();
|
||||
@@ -325,7 +335,6 @@ namespace Cabrito
|
||||
|
||||
public void OnConsoleClose()
|
||||
{
|
||||
Console.Print("closed console");
|
||||
Screen.CursorVisible = false;
|
||||
Screen.CursorLock = CursorLockMode.Locked;
|
||||
|
||||
@@ -383,7 +392,7 @@ namespace Cabrito
|
||||
}
|
||||
else if (!Console.IsOpen)
|
||||
{
|
||||
int fontHeight = (int) (consoleNotifyBox.Font.GetFont().Height / Platform.DpiScale);
|
||||
int fontHeight = (int) (consoleNotifyBox.FontHeight / Platform.DpiScale);
|
||||
if (location.Y < (-conHeight * ConsoleHeight) + fontHeight)
|
||||
{
|
||||
consoleNotifyBox.Visible = true;
|
||||
@@ -395,7 +404,7 @@ namespace Cabrito
|
||||
|
||||
public void OnPrint(string text)
|
||||
{
|
||||
int fontHeight = (int) (consoleNotifyBox.Font.GetFont().Height / Platform.DpiScale);
|
||||
int fontHeight = (int) (consoleNotifyBox.FontHeight / Platform.DpiScale);
|
||||
consoleNotifyBox.Height = Math.Min(ConsoleNotifyLines, Console.Lines.Count) * fontHeight;
|
||||
}
|
||||
|
||||
|
||||
497
Source/Game/MapParser/MapParser.cs
Normal file
497
Source/Game/MapParser/MapParser.cs
Normal file
@@ -0,0 +1,497 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using FlaxEngine;
|
||||
|
||||
// https://web.archive.org/web/20160316213335/http://forums.ubergames.net/topic/2658-understanding-the-quake-3-map-format/
|
||||
// https://web.archive.org/web/20210228125854/https://forums.thedarkmod.com/index.php?/topic/15668-plugin-request-save-map-in-quake-3-format/
|
||||
|
||||
namespace Game
|
||||
{
|
||||
public struct MapFacePlane
|
||||
{
|
||||
public Vector3 v1, v2, v3;
|
||||
public string texture;
|
||||
public Vector2 offset;
|
||||
public float rotation;
|
||||
public Vector2 scale;
|
||||
public int contentFlags, surfaceFlags, surfaceValue;
|
||||
}
|
||||
|
||||
public class MapBrush
|
||||
{
|
||||
public MapFacePlane[] planes;
|
||||
}
|
||||
|
||||
public class MapPatch
|
||||
{
|
||||
public string name;
|
||||
}
|
||||
|
||||
public struct PatchVertex
|
||||
{
|
||||
public Vector3 v;
|
||||
public Vector2 uv;
|
||||
}
|
||||
|
||||
public class MapEntity
|
||||
{
|
||||
public Dictionary<string, string> properties = new Dictionary<string, string>();
|
||||
public List<MapEntity> entities = new List<MapEntity>();
|
||||
public List<MapBrush> brushes = new List<MapBrush>();
|
||||
public List<MapPatch> patches = new List<MapPatch>();
|
||||
}
|
||||
|
||||
public static class MapParser
|
||||
{
|
||||
static public MapEntity Parse(byte[] data)
|
||||
{
|
||||
if (data.Length == 0)
|
||||
return null;
|
||||
|
||||
MapEntity rootEntity = new MapEntity();
|
||||
MapEntity currentEntity = rootEntity;
|
||||
|
||||
int level = 0;
|
||||
int index = 0;
|
||||
//for (int i=0; i<data.Length; i++)
|
||||
do
|
||||
{
|
||||
char c = (char) data[index];
|
||||
char c1 = (index + 1 < data.Length) ? (char) data[index + 1] : (char) 0;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
case '\r':
|
||||
break;
|
||||
case '/':
|
||||
if (c1 == '/')
|
||||
ParseComment(data, ref index);
|
||||
else
|
||||
throw new Exception("unexpected character: '" + c + "'");
|
||||
break;
|
||||
case '{':
|
||||
{
|
||||
currentEntity = new MapEntity();
|
||||
rootEntity.entities.Add(currentEntity);
|
||||
|
||||
level++;
|
||||
|
||||
for (; index < data.Length; index++)
|
||||
{
|
||||
if (data[index] == '\n')
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
|
||||
ParseEntity(currentEntity, data, ref index);
|
||||
break;
|
||||
}
|
||||
case '}':
|
||||
{
|
||||
//currentEntity = rootEntity;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new Exception("unsupported character: '" + c + "'");
|
||||
}
|
||||
|
||||
//if (level < 0 || level > 2)
|
||||
// throw new Exception("Failed to parse .map file: unexpected entity found at line " + lineNumber.ToString());
|
||||
} while (++index < data.Length);
|
||||
|
||||
return rootEntity;
|
||||
}
|
||||
|
||||
static void ParseComment(byte[] data, ref int index)
|
||||
{
|
||||
for (; index < data.Length; index++)
|
||||
{
|
||||
if (data[index] == '\n')
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void ParseEntity(MapEntity currentEntity, byte[] data, ref int index)
|
||||
{
|
||||
bool entityParsed = false;
|
||||
do
|
||||
{
|
||||
char c = (char) data[index];
|
||||
char c1 = (index + 1 < data.Length) ? (char) data[index + 1] : (char) 0;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
case '\r':
|
||||
break;
|
||||
|
||||
case '/':
|
||||
if (c1 == '/')
|
||||
ParseComment(data, ref index);
|
||||
else
|
||||
throw new Exception("unexpected character: '" + c + "'");
|
||||
break;
|
||||
|
||||
// "name" "value"
|
||||
case '"':
|
||||
{
|
||||
string propName = ParseQuotedString(data, ref index);
|
||||
string propValue = ParseQuotedString(data, ref index);
|
||||
|
||||
if (currentEntity.properties.ContainsKey(propName))
|
||||
throw new Exception("Failed to parse .map file: multiple properties defined for " +
|
||||
propName +
|
||||
" at line ?");// + lineNumber.ToString());
|
||||
currentEntity.properties.Add(propName, propValue);
|
||||
break;
|
||||
}
|
||||
|
||||
// brush
|
||||
case '{':
|
||||
{
|
||||
index++;
|
||||
for (; index < data.Length; index++)
|
||||
{
|
||||
if (data[index] != ' ' && data[index] != '\r' && data[index] != '\n')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
if (index >= data.Length)
|
||||
break;
|
||||
|
||||
if (data[index] == '(')
|
||||
currentEntity.brushes.Add(ParseBrush(data, ref index));
|
||||
else if (char.IsLetter((char)data[index]) || char.IsNumber((char)data[index]))
|
||||
currentEntity.patches.Add(ParsePatch(data, ref index));
|
||||
break;
|
||||
}
|
||||
case '}':
|
||||
{
|
||||
entityParsed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new Exception("unsupported character: '" + c + "'");
|
||||
}
|
||||
} while (index++ < data.Length && !entityParsed);
|
||||
}
|
||||
|
||||
static string ParseQuotedString(byte[] data, ref int index)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
index++;
|
||||
|
||||
for (; index < data.Length; index++)
|
||||
{
|
||||
if (data[index] == '"')
|
||||
break;
|
||||
sb.Append((char)data[index]);
|
||||
}
|
||||
index++;
|
||||
|
||||
while (index < data.Length)
|
||||
{
|
||||
if (data[index] != ' ')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
static string ParseString(byte[] data, ref int index)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (; index < data.Length; index++)
|
||||
{
|
||||
if (data[index] == ' ' || data[index] == '\r' || data[index] == '\n')
|
||||
break;
|
||||
sb.Append((char)data[index]);
|
||||
}
|
||||
index++;
|
||||
|
||||
while (index < data.Length)
|
||||
{
|
||||
if (data[index] != ' ')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
static float ParseFloat(byte[] data, ref int index)
|
||||
{
|
||||
string fs = ParseString(data, ref index);
|
||||
|
||||
if (float.TryParse(fs, NumberStyles.Float, CultureInfo.InvariantCulture, out float value))
|
||||
return value;
|
||||
//else if (float.TryParse(fs, CultureInfo.InvariantCulture, out intValue))
|
||||
// return intValue;
|
||||
else
|
||||
throw new Exception("failed to ParseFloat: " + fs);
|
||||
}
|
||||
|
||||
static int ParseInt(byte[] data, ref int index)
|
||||
{
|
||||
string fs = ParseString(data, ref index);
|
||||
|
||||
if (int.TryParse(fs, out int value))
|
||||
return value;
|
||||
else
|
||||
throw new Exception("failed to ParseInt: " + fs);
|
||||
}
|
||||
|
||||
static Vector3 ParseVector3(byte[] data, ref int index)
|
||||
{
|
||||
return new Vector3(
|
||||
ParseFloat(data, ref index),
|
||||
ParseFloat(data, ref index),
|
||||
ParseFloat(data, ref index)
|
||||
);
|
||||
}
|
||||
|
||||
static Vector2 ParseVector2(byte[] data, ref int index)
|
||||
{
|
||||
return new Vector2(
|
||||
ParseFloat(data, ref index),
|
||||
ParseFloat(data, ref index)
|
||||
);
|
||||
}
|
||||
|
||||
static Vector3 ParsePlaneVector3(byte[] data, ref int index)
|
||||
{
|
||||
index++;
|
||||
while (index < data.Length)
|
||||
{
|
||||
if (data[index] != ' ')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
|
||||
Vector3 vector = ParseVector3(data, ref index);
|
||||
|
||||
while (index < data.Length)
|
||||
{
|
||||
if (data[index] == ')')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
|
||||
index++;
|
||||
while (index < data.Length)
|
||||
{
|
||||
if (data[index] != ' ')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
|
||||
return vector;
|
||||
}
|
||||
|
||||
static MapBrush ParseBrush(byte[] data, ref int index)
|
||||
{
|
||||
MapBrush brush = new MapBrush();
|
||||
|
||||
List<MapFacePlane> planes = new List<MapFacePlane>(6);
|
||||
|
||||
bool brushParsed = false;
|
||||
do
|
||||
{
|
||||
char c = (char) data[index];
|
||||
//char c1 = (index + 1 < data.Length) ? (char) data[index + 1] : (char) 0;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\r':
|
||||
case '\n':
|
||||
break;
|
||||
|
||||
// brush face
|
||||
// ( <v1> ) ( <v2> ) ( <v3> ) <shader> <x_shift> <y_shift> <rotation> <x_scale> <y_scale> <content_flags> <surface_flags> <value>
|
||||
case '(':
|
||||
{
|
||||
MapFacePlane plane;
|
||||
plane.v1 = ParsePlaneVector3(data, ref index);
|
||||
plane.v2 = ParsePlaneVector3(data, ref index);
|
||||
plane.v3 = ParsePlaneVector3(data, ref index);
|
||||
plane.texture = ParseString(data, ref index);
|
||||
plane.offset = ParseVector2(data, ref index);
|
||||
plane.rotation = ParseFloat(data, ref index);
|
||||
plane.scale = ParseVector2(data, ref index);
|
||||
plane.contentFlags = ParseInt(data, ref index);
|
||||
plane.surfaceFlags = ParseInt(data, ref index);
|
||||
plane.surfaceValue = ParseInt(data, ref index);
|
||||
|
||||
planes.Add(plane);
|
||||
break;
|
||||
}
|
||||
|
||||
case '}':
|
||||
{
|
||||
brushParsed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
if (char.IsLetter(c) || char.IsNumber(c))
|
||||
{
|
||||
// patch name
|
||||
|
||||
}
|
||||
throw new Exception("unsupported character: '" + c + "'");
|
||||
}
|
||||
} while (index++ < data.Length && !brushParsed);
|
||||
|
||||
brush.planes = planes.ToArray();
|
||||
|
||||
return brush;
|
||||
}
|
||||
|
||||
static MapPatch ParsePatch(byte[] data, ref int index)
|
||||
{
|
||||
MapPatch patch = new MapPatch();
|
||||
|
||||
patch.name = ParseString(data, ref index);
|
||||
|
||||
bool patchParsed = false;
|
||||
do
|
||||
{
|
||||
char c = (char) data[index];
|
||||
//char c1 = (index + 1 < data.Length) ? (char) data[index + 1] : (char) 0;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\r':
|
||||
case '\n':
|
||||
break;
|
||||
|
||||
case '{':
|
||||
{
|
||||
index++;
|
||||
ParsePatchInner(patch, data, ref index);
|
||||
break;
|
||||
}
|
||||
|
||||
case '}':
|
||||
{
|
||||
patchParsed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new Exception("unsupported character: '" + c + "'");
|
||||
}
|
||||
} while (index++ < data.Length && !patchParsed);
|
||||
|
||||
return patch;
|
||||
}
|
||||
|
||||
// unfinished and untested
|
||||
static void ParsePatchInner(MapPatch patch, byte[] data, ref int index)
|
||||
{
|
||||
string shaderName = ParseString(data, ref index);
|
||||
|
||||
while (index < data.Length)
|
||||
{
|
||||
if (data[index] == '(')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
index++;
|
||||
|
||||
int width = ParseInt(data, ref index);
|
||||
int height = ParseInt(data, ref index);
|
||||
int dummy1 = ParseInt(data, ref index);
|
||||
int dummy2 = ParseInt(data, ref index);
|
||||
int dummy3 = ParseInt(data, ref index);
|
||||
|
||||
while (index < data.Length)
|
||||
{
|
||||
if (data[index] == ')')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
index++;
|
||||
|
||||
while (index < data.Length)
|
||||
{
|
||||
if (data[index] == '(')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
index++;
|
||||
|
||||
PatchVertex[] vertices = new PatchVertex[width * height];
|
||||
|
||||
bool verticesParsed = false;
|
||||
int vertexIndex = 0;
|
||||
do
|
||||
{
|
||||
char c = (char) data[index];
|
||||
//char c1 = (index + 1 < data.Length) ? (char) data[index + 1] : (char) 0;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\r':
|
||||
case '\n':
|
||||
break;
|
||||
|
||||
case '(':
|
||||
{
|
||||
index++;
|
||||
|
||||
for (int iw = 0; iw < width; iw++)
|
||||
{
|
||||
while (index < data.Length)
|
||||
{
|
||||
if (data[index] == '(')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
while (index < data.Length)
|
||||
{
|
||||
if (data[index] != ' ')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
|
||||
vertices[vertexIndex].v = ParseVector3(data, ref index);
|
||||
vertices[vertexIndex].uv = new Vector2(ParseFloat(data, ref index), ParseFloat(data, ref index));
|
||||
vertexIndex++;
|
||||
|
||||
while (index < data.Length)
|
||||
{
|
||||
if (data[index] == ')')
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case '}':
|
||||
{
|
||||
verticesParsed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new Exception("unsupported character: '" + c + "'");
|
||||
}
|
||||
} while (index++ < data.Length && !verticesParsed);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,8 @@ public class GameTarget : GameProjectTarget
|
||||
{
|
||||
base.Init();
|
||||
|
||||
//OutputName = "Goake";
|
||||
|
||||
// Reference the modules for game
|
||||
Modules.Add("Game");
|
||||
//Modules.Add("Cabrito");
|
||||
|
||||
4
copydll.bat
Normal file
4
copydll.bat
Normal file
@@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
echo copying
|
||||
copy C:\dev\GoakeFlax\Binaries\GameTarget\Windows\x64\Development\Game.CSharp.* C:\dev\GoakeFlax\Output\WindowsDevelopment\ /Y
|
||||
echo copied?
|
||||
4
launchbg.bat
Normal file
4
launchbg.bat
Normal file
@@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
echo launching
|
||||
start /B %*
|
||||
echo launched?
|
||||
Reference in New Issue
Block a user