
sladescript : lua
{
	name = "SLADE Script";
	case_sensitive = true;

	properties =
	{
		// Namespaces
		App, Archives, Game, Graphics, UI
	}

	constants =
	{
		// Graphics namespace
		BLEND_NORMAL, BLEND_ADD, BLEND_SUBTRACT, BLEND_REVERSESUBTRACT, BLEND_MODULATE,

		// UI namespace
		MB_ICON_INFO, MB_ICON_QUESTION, MB_ICON_WARNING, MB_ICON_ERROR,

		// CTPatchEx type
		TYPE_PATCH, TYPE_GRAPHIC, BLENDTYPE_NONE, BLENDTYPE_TRANSLATION, BLENDTYPE_BLEND, BLENDTYPE_TINT,

		// TextureXList type
		FORMAT_NORMAL, FORMAT_STRIFE11, FORMAT_NAMELESS, FORMAT_TEXTURES, FORMAT_JAGUAR,

		// Colour type
		FORMAT_RGB, FORMAT_RGBA, FORMAT_HEX, FORMAT_ZDOOM,

		// TransRange type
		TYPE_PALETTE, TYPE_COLOUR, TYPE_DESAT, TYPE_BLEND, TYPE_TINT, TYPE_SPECIAL,

		// Image type
		PIXELFORMAT_INDEXED, PIXELFORMAT_RGBA, PIXELFORMAT_ALPHA, SOURCE_BRIGHTNESS, SOURCE_ALPHA,

		// ImageConvertOptions type
		MASK_NONE, MASK_COLOUR, MASK_ALPHA, MASK_BRIGHTNESS,

		// ImageFormat type
		WRITABLE_NO, WRITABLE_YES, WRITABLE_NEEDS_CONVERSION,

		// Palette type
		FORMAT_RAW, FORMAT_IMAGE, FORMAT_CSV, FORMAT_JASC, FORMAT_GIMP, MATCH_DEFAULT, MATCH_OLD,
		MATCH_RGB, MATCH_HSL, MATCH_C76, MATCH_C94, MATCH_C2K,

		// MapEditor type
		MODE_VERTICES, MODE_LINES, MODE_SECTORS, MODE_THINGS, MODE_VISUAL, SECTORMODE_BOTH, SECTORMODE_FLOOR, SECTORMODE_CEILING,

		// MapObject type
		TYPE_OBJECT, TYPE_VERTEX, TYPE_LINE, TYPE_SIDE, TYPE_SECTOR, TYPE_THING,
	}

	types =
	{
		Archive, ArchiveDir, ArchiveEntry, ArchiveFormat, ArchiveSearchOptions, EntryType,
		CTexture, CTPatch, CTPatchEx, PatchTable, TextureXList,
		ThingType,
		Image, ImageConvertOptions, ImageDrawOptions, ImageFormat, Palette,
		Map, MapEditor, MapLine, MapObject, MapSector, MapSide, MapThing, MapVertex,
		Translation, TransRange, TransRangeBlend, TransRangeColour, TransRangeDesat, TransRangePalette, TransRangeSpecial, TransRangeTint,
		Colour, Plane, DataBlock, Point
	}

	functions
	{
		// App namespace
						App.LogMessage = "string message";
						App.LogWarning = "string message";
						App.LogError = "string message";
		Archive			App.CurrentArchive;
		ArchiveEntry	App.CurrentEntry;
		ArchiveEntry[]	App.CurrentEntrySelection;
		Palette			App.CurrentPalette = "[ArchiveEntry entryFor]";
						App.ShowArchive = "Archive archive";
						App.ShowEntry = "ArchiveEntry entry";
		MapEditor		App.MapEditor;

		// Archives namespace
		Archive[]			Archives.All;
		"Archive, string"	Archives.Create = "string format_id";
		"Archive, string"	Archives.OpenFile = "string path";
		boolean				Archives.Close = "Archive archive", "integer index";
							Archives.CloseAll;
		string				Archives.FileExtensionsString;
		Archive				Archives.BaseResource;
		string[]			Archives.BaseResourcePaths;
		boolean				Archives.OpenBaseResource = "integer index";
		Archive				Archives.ProgramResource;
		string[]			Archives.RecentFiles;
		ArchiveEntry[]		Archives.Bookmarks;
							Archives.AddBookmark = "ArchiveEntry entry";
		boolean				Archives.RemoveBookmark = "ArchiveEntry entry";
		EntryType			Archives.EntryType = "string id";

		// Game namespace
		ThingType	Game.ThingType = "integer doomednum";

		// Graphics namespace
		ImageFormat		Graphics.ImageFormat = "string formatId";
		ImageFormat[]	Graphics.AllImageFormats;
		ImageFormat		Graphics.DetectImageFormat = "DataBlock data";

		// UI namespace
							UI.MessageBox = "string title, string message, [integer icon]";
							UI.MessageBoxExt = "string title, string message, string detail";
		string				UI.PromptString = "string title, string message, string default_value";
		integer				UI.PromptNumber = "string title, string message, integer default_value, integer min, integer max";
		boolean				UI.PromptYesNo = "string title, string message";
		string				UI.PromptOpenFile = "string title, string extensions, string filename";
		string[]			UI.PromptOpenFiles = "string title, string extensions";
		string				UI.PromptSaveFile = "string title, string extensions, [string defaultFilename]";
		"string, string"	UI.PromptSaveFiles = "string title, string extensions";
							UI.ShowSplash = "string message, [boolean progress]";
							UI.HideSplash;
							UI.UpdateSplash;
		float				UI.SplashProgress;
							UI.SetSplashMessage = "string message";
							UI.SetSplashProgressMessage = "string message";
							UI.SetSplashProgress = "float progress";

		// Archive type
		ArchiveDir		Archive.DirAtPath = "string path";
		ArchiveEntry	Archive.EntryAtPath = "string path";
		string			Archive.FilenameNoPath;
		ArchiveDir		Archive.CreateDir = "string path";
		ArchiveEntry	Archive.CreateEntry = "string fullPath, integer index";
		ArchiveEntry	Archive.CreateEntryInNamespace = "string name, string namespace";
		boolean			Archive.RemoveEntry = "ArchiveEntry entry";
		boolean			Archive.RenameEntry = "ArchiveEntry entry, string name";
		boolean			Archive.Save = "[string path]";
		ArchiveEntry	Archive.FindFirst = "ArchiveSearchOptions options";
		ArchiveEntry	Archive.FindLast = "ArchiveSearchOptions options";
		ArchiveEntry[]	Archive.FindAll = "ArchiveSearchOptions options";

		// ArchiveEntry type
		string				ArchiveEntry.FormattedName = "[boolean includePath], [boolean includeExtension], [boolean upperCase]";
		string				ArchiveEntry.FormattedSize;
							ArchiveEntry.Rename = "string newName";
		"boolean, string"	ArchiveEntry.ImportFile = "string path";
		"boolean, string"	ArchiveEntry.ImportEntry = "ArchiveEntry entry";
		"boolean, string"	ArchiveEntry.ImportData = "string dataString", "DataBlock data";
		"boolean, string"	ArchiveEntry.ExportFile = "string path";

		// MapEditor type
		MapVertex[]	MapEditor.SelectedVertices = "[boolean tryHighlight]";
		MapLine[]	MapEditor.SelectedLines = "[boolean tryHighlight]";
		MapSector[]	MapEditor.SelectedSectors = "[boolean tryHighlight]";
		MapThing[]	MapEditor.SelectedThings = "[boolean tryHighlight]";
					MapEditor.ClearSelection;
					MapEditor.Select = "MapObject object, [boolean add]";
					MapEditor.SetEditMode = "integer mode, [integer sectorMode]";

		// MapLine type
		boolean	MapLine.Flag = "string flagName";
				MapLine.Flip = "[boolean swapSides]";
		table	MapLine.VisibleTextures;

		// MapObject type
		boolean	MapObject.HasProperty = "string name";
		boolean	MapObject.BoolProperty = "string name";
		integer	MapObject.IntProperty = "string name";
		float	MapObject.FloatProperty = "string name";
		string	MapObject.StringProperty = "string name";
				MapObject.SetBoolProperty = "string name, boolean value";
				MapObject.SetIntProperty = "string name, integer value";
				MapObject.SetFloatProperty = "string name, float value";
				MapObject.SetStringProperty = "string name, string value";

		// MapSector type
		boolean	MapSector.ContainsPoint = "Point position";

		// MapThing type
		boolean	MapThing.Flag = "string flagName";
				MapThing.SetAnglePoint = "Point position";

		// Plane type
		float	Plane.HeightAt = "Point position";

		// CTexture type
		string	CTexture.AsText;
				CTexture.Clear;
				CTexture.ConvertExtended;
				CTexture.ConvertRegular;
				CTexture.CopyTexture = "CTexture other, [boolean keepFormat]";
				CTexture.AddPatch = "string patch, [integer x], [integer y], [integer index]";
				CTexture.DuplicatePatch = "integer index, [integer offsetX], [integer offsetY]";
		boolean	CTexture.RemovePatch = "integer index";
		boolean CTexture.ReplacePatch = "integer index, string newPatch";
		boolean CTexture.SwapPatches = "integer index1, integer index2";

		// CTPatch type
		ArchiveEntry	CTPatch.PatchEntry = "Archive parent";
		CTPatchEx		CTPatch.AsExtended;

		// CTPatchEx type
		string	CTPatchEx.AsText;

		// PatchTable type
		string			PatchTable.Patch = "integer index";
		ArchiveEntry	PatchTable.PatchEntry = "integer index", "string name";
		boolean			PatchTable.RemovePatch = "integer index";
		boolean			PatchTable.ReplacePatch = "integer index, string name";
		boolean			PatchTable.AddPatch = "string name, boolean allowDuplicate";
		boolean			PatchTable.LoadPNAMES = "ArchiveEntry pnames";
		boolean			PatchTable.WritePNAMES = "ArchiveEntry pnames";

		// TextureXList type
		CTexture	TextureXList.Texture = "string name";
		integer		TextureXList.TextureIndex = "string name";
		boolean		TextureXList.ConvertToTEXTURES;
		boolean		TextureXList.FindErrors;
		CTexture	TextureXList.AddTexture = "string name, [boolean extended], [integer index]";
					TextureXList.RemoveTexture = "integer index";
					TextureXList.SwapTextures = "integer index1, integer index2";
					TextureXList.Clear;
					TextureXList.RemovePatch = "string patch";
		boolean		TextureXList.ReadTEXTUREXData = "ArchiveEntry entry, PatchTable patchTable, boolean additive";
		boolean		TextureXList.WriteTEXTUREXData = "ArchiveEntry entry, PatchTable patchTable";
		boolean		TextureXList.ReadTEXTURESData = "ArchiveEntry entry";
		boolean		TextureXList.WriteTEXTURESData = "ArchiveEntry entry";

		// Palette type
		Colour	Palette.Colour = "integer index";
				Palette.CopyColours = "Palette other";
		integer	Palette.CountUniqueColours;
		integer	Palette.FindColour = "Colour colour";
		integer	Palette.NearestColour = "Colour colour, [integer matchMode]";
		boolean	Palette.LoadData = "string data, [integer format]";
		boolean Palette.LoadFile = "string path, [integer format]";
		boolean Palette.SaveFile = "string path, [integer format]";
				Palette.SetColour = "integer index, Colour colour";
				Palette.SetColourR = "integer index, integer r";
				Palette.SetColourG = "integer index, integer g";
				Palette.SetColourB = "integer index, integer b";
				Palette.SetColourA = "integer index, integer a";
				Palette.ApplyTranslation = "Translation translation";
				Palette.Colourise = "Colour colour, integer firstIndex, integer lastIndex";
				Palette.Tint = "Colour colour, float amount, integer firstIndex, integer lastIndex";
				Palette.Saturate = "float amount, integer firstIndex, integer lastIndex";
				Palette.Illuminate = "float amount, integer firstIndex, integer lastIndex";
				Palette.Shift = "float amount, integer firstIndex, integer lastIndex";
				Palette.Invert = "integer firstIndex, integer lastIndex";
				Palette.Gradient = "Colour startColour, Colour endColour, integer firstIndex, integer lastIndex";

		// Translation type
		string				Translation.AsText;
							Translation.Clear;
							Translation.Copy = "Translation other";
		boolean				Translation.IsEmpty;
							Translation.Parse = "string definition";
		Colour				Translation.Translate = "Colour colour, [Palette palette]";
		TransRange			Translation.Range = "integer index";
		TransRange			Translation.AddRange = "string definition";
		TransRangePalette	Translation.AddPaletteRange = "integer rangeStart, integer rangeEnd";
		TransRangeColour	Translation.AddColourRange = "integer rangeStart, integer rangeEnd";
		TransRangeDesat		Translation.AddDesatRange = "integer rangeStart, integer rangeEnd";
		TransRangeBlend		Translation.AddBlendRange = "integer rangeStart, integer rangeEnd";
		TransRangeTint		Translation.AddTintRange = "integer rangeStart, integer rangeEnd";
		TransRangeSpecial	Translation.AddSpecialRange = "integer rangeStart, integer rangeEnd";
							Translation.ReadTable = "string data";
							Translation.RemoveRange = "integer index";
							Translation.SwapRanges = "integer index1, integer index2";

		// TransRange type
		string				TransRange.AsText;
		TransRangePalette	TransRange.AsPaletteRange;
		TransRangeColour	TransRange.AsColourRange;
		TransRangeDesat		TransRange.AsDesatRange;
		TransRangeBlend		TransRange.AsBlendRange;
		TransRangeTint		TransRange.AsTintRange;
		TransRangeSpecial	TransRange.AsSpecialRange;

		// TransRangeDesat type
		TransRangeDesat.SetStartRGB = "float r, float g, float b";
		TransRangeDesat.SetEndRGB = "float r, float g, float b";

		// Image type
							Image.Clear;
							Image.Copy = "Image other";
							Image.Create = "integer width, integer height, integer type, [Palette palette]";
		integer				Image.CountUniqueColours;
		integer				Image.FindUnusedColour;
		boolean				Image.IsValid;
		Colour				Image.PixelAt = "integer x, integer y, [Palette palette]";
		integer				Image.PixelIndexAt = "integer x, integer y";
		boolean				Image.LoadData = "DataBlock data, [integer index], [string typeHint]";
		"boolean, string"	Image.LoadEntry = "ArchiveEntry entry, [integer index]";
		boolean				Image.WriteIndexedData = "DataBlock block";
		boolean				Image.WriteRGBData = "DataBlock block, [Palette palette]";
		boolean				Image.WriteRGBAData = "DataBlock block, [Palette palette]";
		boolean				Image.ConvertAlphaMap = "integer alphaSource, [Palette palette]";
		boolean				Image.ConvertIndexed = "Palette newPalette, [Palette currentPalette]";
		boolean				Image.ConvertRGBA = "[Palette palette]";
		boolean				Image.Crop = "integer left, integer top, integer right, integer bottom";
		boolean				Image.MirrorHorizontal;
		boolean				Image.MirrorVertical;
		boolean				Image.Resize = "integer newWidth, integer newHeight";
		boolean				Image.Rotate = "integer angle";
							Image.Trim;
		boolean				Image.ApplyTranslation = "Translation translation, [Palette palette], [boolean trueColour]";
		boolean				Image.Colourise = "Colour colour, [Palette palette]";
		boolean				Image.SetPixelColour = "integer x, integer y, Colour colour, [Palette palette]";
		boolean				Image.SetPixelIndex = "integer x, integer y, integer index, [integer alpha]";
		boolean				Image.Tint = "Colour colour, float amount, [Palette palette]";
							Image.FillAlpha = "integer alpha";
		boolean				Image.MaskFromBrightness = "[Palette palette]";
		boolean				Image.MaskFromColour = "Colour colour, [Palette palette]";
		boolean				Image.DrawImage = "integer x, integer y, Image srcImage, ImageDrawOptions drawOptions, [Palette srcPalette], [Palette destPalette]";
		boolean				Image.DrawPixel = "integer x, integer y, Colour colour, ImageDrawOptions drawOptions, [Palette palette]";

		// ImageFormat type
		boolean	ImageFormat.IsThisFormat = "DataBlock data";
		boolean	ImageFormat.LoadImage = "Image image, DataBlock data, [integer index]";
		boolean	ImageFormat.SaveImage = "Image image, DataBlock dataOut, [Palette palette], [integer index]";
		integer	ImageFormat.CanWrite = "Image image";
		boolean	ImageFormat.CanWritePixelFormat = "integer pixelFormat";
		boolean	ImageFormat.ConvertWritable = "Image image, ImageConvertOptions convertOptions";

		// Colour type
		"float, float, float"	Colour.AsHSL;
		"float, float, float"	Colour.AsLAB;
		string					Colour.AsString = "integer format";
								Colour.FromHSL = "float hue, float saturation, float lightness";

		// DataBlock type
		string	DataBlock.AsString;
				DataBlock.SetData = "string data";
				DataBlock.Clear;
		boolean	DataBlock.Resize = "integer newSize, boolean preserveData";
		boolean DataBlock.Copy = "DataBlock other";
		boolean	DataBlock.CopyTo = "DataBlock other, [integer offset], [integer length]";
		boolean DataBlock.ImportFile = "string path, [integer offset], [integer length]";
		boolean DataBlock.ExportFile = "string path, [integer offset], [integer length]";
		boolean DataBlock.FillData = "integer value";
		integer	DataBlock.ReadInt8 = "integer offset";
		integer	DataBlock.ReadUInt8 = "integer offset";
		integer	DataBlock.ReadInt16 = "integer offset";
		integer	DataBlock.ReadUInt16 = "integer offset";
		integer	DataBlock.ReadInt32 = "integer offset";
		integer	DataBlock.ReadUInt32 = "integer offset";
		integer	DataBlock.ReadInt64 = "integer offset";
		integer	DataBlock.ReadUInt64 = "integer offset";
		string	DataBlock.ReadString = "integer offset, integer length, [boolean nullTerminated]";
		boolean	DataBlock.WriteInt8 = "integer offset, integer value, boolean allowExpand";
		boolean	DataBlock.WriteUInt8 = "integer offset, integer value, boolean allowExpand";
		boolean	DataBlock.WriteInt16 = "integer offset, integer value, boolean allowExpand";
		boolean	DataBlock.WriteUInt16 = "integer offset, integer value, boolean allowExpand";
		boolean	DataBlock.WriteInt32 = "integer offset, integer value, boolean allowExpand";
		boolean	DataBlock.WriteUInt32 = "integer offset, integer value, boolean allowExpand";
		boolean	DataBlock.WriteInt64 = "integer offset, integer value, boolean allowExpand";
		boolean	DataBlock.WriteUInt64 = "integer offset, integer value, boolean allowExpand";
		boolean	DataBlock.WriteString = "integer offset, string value, boolean allowExpand";

		// Plane type
		float	Plane.HeightAt = "Point position";
	}
}
