type Vec2
{
	f32 X
	f32 Y
}

type Vec3
{
	f32 X
	f32 Y
	f32 Z
}

type Vec4
{
	f32 X
	f32 Y
	f32 Z
	f32 W
}

type Mat3
{
	f32 M Arr(9) Default("{
	1.0f, 0.0f, 0.0f,
	0.0f, 1.0f, 0.0f,
	0.0f, 0.0f, 1.0f
	}")
}

type Mat4
{
	f32 M Arr(16) Default("{
	1.0f, 0.0f, 0.0f, 0.0f,
	0.0f, 1.0f, 0.0f, 0.0f,
	0.0f, 0.0f, 1.0f, 0.0f,
	0.0f, 0.0f, 0.0f, 1.0f
	}")
}

type AssetHandle
{
	u32 Idx Default("UINT32_MAX")
}

type ModelHandle
{
	u16 ModelIdx Default("UINT16_MAX")
	AssetHandle Asset
}

type TextureHandle
{
	u16 TextureIdx Default("UINT16_MAX")
	AssetHandle Asset
}

type PuzPos
{
	i8 X
	i8 Y
}

enum PuzzleElementType(u8)
{
	None           GameName("Empty")              ShortName("  ")
	WaterIn        GameName("Water Source")       ShortName("~+")
	WaterGoal      GameName("Water Goal")         ShortName("~!")
	WaterChannel   GameName("Water Channel")      ShortName("~")
	ElectricIn     GameName("Electricity Source") ShortName("e+")
	ElectricGoal   GameName("Electricity Goal")   ShortName("e!")
	Blocked        GameName("Blocked")            ShortName("B")
	Bridge         GameName("Bridge")             ShortName("#")
}

type StaticPuzzleCard
{
	PuzzleElementType Elements     Arr(4)
	ModelHandle       ModelHandle
	TextureHandle     BoardTextureHandle
}

type StaticPuzzleCardHandle
{
	u16 Idx Default("UINT16_MAX")
}

type StaticPuzzleData
{
	StaticPuzzleCard Cards Arr(64)
}

type PuzzleCardStack
{
	StaticPuzzleCardHandle RefCard
	u8                     MaxAvailableCount
	u8                     UsedCount
}

type PlacedPuzzleCard
{
	StaticPuzzleCardHandle RefCard
	PuzPos                 Position
	u8                     Rotation
	b                      IsLocked
}

type PuzzleData
{
	u16               ID
	str               PuzzleName          Arr(64)
	u8                WidthTiles
	u8                HeightTiles
	u32               AvailableCardCount
	PuzzleCardStack   AvailableCards      Arr(16)
	PlacedPuzzleCard  PlacedCards         Arr(256)
	PuzzleElementType BackgroundTiles     Arr(1024)
	u32               GoalPositionCount
	PuzPos            GoalPositions       Arr(16)
}
