// =================
// BATTLEZONE EDITOR
// =================

Exec("bzeditor_camera_x2_5.cfg");
Exec("bzeditor_stars_x2_5.cfg");
Exec("bzeditor_sky_x2_5.cfg");
Exec("bzeditor_rain_x2_5.cfg");
Exec("bzeditor_object_x2_5.cfg");
Exec("bzeditor_fog_x2_5.cfg");

//cmd("game.cheat bzbody");
//cmd("game.cheat bztnt");
//cmd("game.cheat bzfree");
//cmd("game.cheat bzradar");

ConfigureVarSys()
{
	CreateInteger("editor.shell.page", 0);
	SetIntegerRange("editor.shell.page", 0, 8);

	CreateInteger("editor.sky.range", 0);
	SetIntegerRange("editor.sky.range", 0, 10);

	CreateInteger("editor.shell.savebutton", 0);
	SetIntegerRange("editor.shell.savebutton", 0, 5);

	CreateInteger("editor.shell.save", 0);
	SetIntegerRange("editor.shell.save", 0, 3);
}

//
// CREATE EDITOR MENU BAR
//
CreateControl("EditMenu", "WINDOW")
{
	Pos(263, 0);
	Size(1338, 125);

	ColorGroup("BACKGROUND");

	//
	// create the height editor button
	//
	CreateControl("Height", "BUTTON")
	{
		Pos(25, 25);
		Size(138, 25);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Height");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(0);
		UseVar("editor.page");

		NotifyParent("Button::Select", "Height");
	}

	//
	// create the color editor button
	//
	CreateControl("Color", "BUTTON")
	{
		Pos(213, 25);
		Size(138, 25);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Color");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(1);
		UseVar("editor.page");

		NotifyParent("Button::Select", "Color");
	}

	//
	// create the texture editor button
	//
	CreateControl("Texture", "BUTTON")
	{
		Pos(400, 25);
		Size(138, 25);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Texture");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(2);
		UseVar("editor.page");

		NotifyParent("Button::Select", "Texture");
	}

	//
	// create the water editor button
	//
	CreateControl("Water", "BUTTON")
	{
		Pos(588, 25);
		Size(138, 25);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Water");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(3);
		UseVar("editor.page");

		NotifyParent("Button::Select", "Water");
	}

	//
	// create the environment editor button
	//
	CreateControl("Environ", "BUTTON")
	{
		Pos(775, 25);
		Size(138, 25);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Environ");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(4);
		UseVar("editor.page");

		NotifyParent("Button::Select", "Environ");
	}

	//
	// create the object editor button
	//
	CreateControl("Object", "BUTTON")
	{
		Pos(963, 25);
		Size(138, 25);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Object");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(5);
		UseVar("editor.page");

		NotifyParent("Button::Select", "Object");
	}

	//
	// create the path editor button
	//
	CreateControl("Path", "BUTTON")
	{
		Pos(1150, 25);
		Size(138, 25);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Path");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(6);
		UseVar("editor.page");

		NotifyParent("Button::Select", "Path");
	}

	CreateControl("Fog", "BUTTON")
	{
		Pos(25, 83);
		Size(138, 25);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Fog");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(7);
		UseVar("editor.page");

		NotifyParent("Button::Select", "Fog");
	}
	CreateControl("Sky", "BUTTON")
	{
		Pos(213, 83);
		Size(138, 25);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Sky");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(8);
		UseVar("editor.page");

		NotifyParent("Button::Select", "Sky");
	}

	CreateControl("Rain", "BUTTON")
	{
		Pos(400, 83);
		Size(138, 25);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Rain");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(9);
		UseVar("editor.page");

		NotifyParent("Button::Select", "Rain");
	}

	CreateControl("Stars", "BUTTON")
	{
		Pos(588, 83);
		Size(138, 25);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Stars");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(10);
		UseVar("editor.page");

		NotifyParent("Button::Select", "Stars");
	}

	CreateControl("load", "BUTTON")
	{
		Pos(775, 83);
		Size(88, 20);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Load");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(1);
		UseVar("editor.shell.page");

		NotifyParent("Button::Select", "load");
	}

	// handle the "load" event
	OnEvent("load")
	{
		Cmd("game.load");
		Cmd("editor.shell.page 0");
	}

	CreateControl("save", "BUTTON")
	{
		Pos(913, 83);
		Size(88, 20);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Save");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(2);
		UseVar("editor.shell.page");

		NotifyParent("Button::Select", "save");
	}
	// handle the "save" event
	OnEvent("save")
	{
		//Cmd("game.save");
		Activate("|EditSaveGame");
		Cmd("editor.shell.page 0");
		Cmd("editor.shell.savebutton 0");
	}

	CreateControl("undo", "BUTTON")
	{
		Pos(1050, 83);
		Size(88, 20);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Undo");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(3);
		UseVar("editor.shell.page");

		NotifyParent("Button::Select", "undo");
	}
	// handle the "undo" event
	OnEvent("undo")
	{
		Cmd("editor.undo");
		Cmd("editor.shell.page 0");
		Deactivate("|EditGameTip");
		Deactivate("|EditSaveGame");
	}

	CreateControl("redo", "BUTTON")
	{
		Pos(1188, 83);
		Size(88, 20);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Redo");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(4);
		UseVar("editor.shell.page");

		NotifyParent("Button::Select", "redo");
	}
	// handle the "redo" event
	OnEvent("redo")
	{
		Cmd("editor.redo");
		Cmd("editor.shell.page 0");
		Deactivate("|EditGameTip");
		Deactivate("|EditSaveGame");
	}

	// handle activation event
	OnEvent("Control::Activate")
	{
		Cmd("editor.page 5");
		Activate("|EditObject");
//		Cmd("options.graphics.sky 2");
//		Activate("|EditHeight");
		Activate("|EditCamera");
		Activate("|EditVisRange");
	}

	// handle deactivation event
	OnEvent("Control::Deactivate")
	{
		Deactivate("|EditGameTip");
		Deactivate("|EditSaveGame");
		Deactivate("|EditVisRange");
		Deactivate("|EditCamera");
		Deactivate("|EditHeight");
		Deactivate("|EditColor");
		Deactivate("|EditTexture");
		Deactivate("|EditWater");
		Deactivate("|EditEnviron");
		Deactivate("|EditObject");
		Deactivate("|EditPath");
		Deactivate("|EditFog");
		Deactivate("|EditSky");
		Deactivate("|EditStars");
		Deactivate("|EditRain");
		
	}

	// handle the "height" event
	OnEvent("Height")
	{
		Deactivate("|EditGameTip");
		Deactivate("|EditSaveGame");
		Deactivate("|EditColor");
		Deactivate("|EditTexture");
		Deactivate("|EditWater");
		Deactivate("|EditEnviron");
		Deactivate("|EditObject");
		Deactivate("|EditPath");
		Deactivate("|EditFog");
		Deactivate("|EditSky");
		Deactivate("|EditStars");
		Deactivate("|EditRain");
		Activate("|EditHeight");
	}

	// handle the "color" event
	OnEvent("Color")
	{
		Deactivate("|EditGameTip");
		Deactivate("|EditSaveGame");
		Deactivate("|EditHeight");
		Deactivate("|EditTexture");
		Deactivate("|EditWater");
		Deactivate("|EditEnviron");
		Deactivate("|EditObject");
		Deactivate("|EditPath");
		Deactivate("|EditFog");
		Deactivate("|EditSky");
		Deactivate("|EditStars");
		Deactivate("|EditRain");
		
		Cmd("editor.color.mode.value 0");
		Activate("|EditColor");
	}

	// handle the "texture" event
	OnEvent("Texture")
	{
		Deactivate("|EditGameTip");
		Deactivate("|EditSaveGame");
		Deactivate("|EditHeight");
		Deactivate("|EditColor");
		Deactivate("|EditWater");
		Deactivate("|EditEnviron");
		Deactivate("|EditObject");
		Deactivate("|EditPath");
		Deactivate("|EditFog");
		Deactivate("|EditSky");
		Deactivate("|EditStars");
		Deactivate("|EditRain");

		Activate("|EditTexture");
		
	}

	// handle the "water" event
	OnEvent("Water")
	{
		Deactivate("|EditGameTip");
		Deactivate("|EditSaveGame");		
		Cmd("editor.water.page 0");
		Deactivate("|EditHeight");
		Deactivate("|EditColor");
		Deactivate("|EditTexture");
		Deactivate("|EditEnviron");
		Deactivate("|EditObject");
		Deactivate("|EditPath");
		Deactivate("|EditFog");
		Deactivate("|EditSky");
		Deactivate("|EditStars");
		Deactivate("|EditRain");

		Activate("|EditWater");
	}

	// handle the "environ" event
	OnEvent("Environ")
	{
		Deactivate("|EditGameTip");
		Deactivate("|EditSaveGame");
		Deactivate("|EditHeight");
		Deactivate("|EditColor");
		Deactivate("|EditTexture");
		Deactivate("|EditWater");
		Deactivate("|EditObject");
		Deactivate("|EditPath");
		Deactivate("|EditFog");
		Deactivate("|EditSky");
		Deactivate("|EditStars");
		Deactivate("|EditRain");

		Activate("|EditEnviron");
	}

	// handle the "object" event
	OnEvent("Object")
	{
		Deactivate("|EditGameTip");
		Deactivate("|EditSaveGame");
		Deactivate("|EditHeight");
		Deactivate("|EditColor");
		Deactivate("|EditTexture");
		Deactivate("|EditWater");
		Deactivate("|EditEnviron");
		Deactivate("|EditPath");
		Deactivate("|EditFog");
		Deactivate("|EditSky");
		Deactivate("|EditStars");
		Deactivate("|EditRain");

		Activate("|EditObject");		
	}

	// handle the "path" event
	OnEvent("Path")
	{
		Deactivate("|EditGameTip");
		Deactivate("|EditSaveGame");
		Deactivate("|EditHeight");
		Deactivate("|EditColor");
		Deactivate("|EditTexture");
		Deactivate("|EditWater");
		Deactivate("|EditEnviron");
		Deactivate("|EditObject");
		Deactivate("|EditPath");
		Deactivate("|EditFog");
		Deactivate("|EditSky");
		Deactivate("|EditStars");
		Deactivate("|EditRain");


		Activate("|Editpath");
	}
	// handle the "Fog" event
	OnEvent("Fog")
	{
		Deactivate("|EditGameTip");
		Deactivate("|EditSaveGame");
		Deactivate("|EditHeight");
		Deactivate("|EditColor");
		Deactivate("|EditTexture");
		Deactivate("|EditWater");
		Deactivate("|EditEnviron");
		Deactivate("|EditObject");
		Deactivate("|EditPath");
		Deactivate("|EditSky");
		Deactivate("|EditStars");
		Deactivate("|EditRain");

		Activate("|EditFog");
	}

	// handle the "Sky" event
	OnEvent("Sky")
	{
		Deactivate("|EditGameTip");
		Deactivate("|EditSaveGame");
		Deactivate("|EditHeight");
		Deactivate("|EditColor");
		Deactivate("|EditTexture");
		Deactivate("|EditWater");
		Deactivate("|EditEnviron");
		Deactivate("|EditObject");
		Deactivate("|EditPath");
		Deactivate("|EditFog");
		Deactivate("|EditStars");
		Deactivate("|EditRain");

		Activate("|EditSky");

	}

	// handle the "Stars" event
	OnEvent("Stars")
	{
		Deactivate("|EditGameTip");
		Deactivate("|EditSaveGame");
		Deactivate("|EditHeight");
		Deactivate("|EditColor");
		Deactivate("|EditTexture");
		Deactivate("|EditWater");
		Deactivate("|EditEnviron");
		Deactivate("|EditObject");
		Deactivate("|EditPath");
		Deactivate("|EditFog");
		Deactivate("|EditSky");
		Deactivate("|EditStars");
		Deactivate("|EditRain");


		Activate("|EditStars");
	}

	// handle the "Rain" event
	OnEvent("Rain")
	{
		Deactivate("|EditGameTip");
		Deactivate("|EditSaveGame");
		Deactivate("|EditHeight");
		Deactivate("|EditColor");
		Deactivate("|EditTexture");
		Deactivate("|EditWater");
		Deactivate("|EditEnviron");
		Deactivate("|EditObject");
		Deactivate("|EditPath");
		Deactivate("|EditFog");
		Deactivate("|EditSky");
		Deactivate("|EditStars");

		Activate("|EditRain");
	}
}

CreateControl("EditVisRange", "WINDOW")
{
	Pos(263, 125);
	Size(963, 38);

	ColorGroup("BACKGROUND");

	CreateControl("RangeTitle", "STATIC")
		{

		Pos(0, 8);
		Size(188, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("Visibility Range");
		Style("INERT", "TRANSPARENT");
		}

	CreateControl("Range1", "BUTTON")
		{

		Pos(180, 8);
		Size(75, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("250");
		Style("ROLLOVER", "RADIO");
		Value(1);
		UseVar("editor.sky.range");
		NotifyParent("Button::Select", "Range1");
		}
	OnEvent("Range1")
		{
		Cmd("sky.visibilityrange 250");
		Cmd("sky.fogrange 125 250");
		}

	CreateControl("Range2", "BUTTON")
		{

		Pos(280, 8);
		Size(75, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("300");
		Style("ROLLOVER", "RADIO");
		Value(2);
		UseVar("editor.sky.range");
		NotifyParent("Button::Select", "Range2");
		}
	OnEvent("Range2")
		{
		Cmd("sky.visibilityrange 300");
		Cmd("sky.fogrange 150 300");
		}

	CreateControl("Range3", "BUTTON")
		{

		Pos(380, 8);
		Size(75, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("350");
		Style("ROLLOVER", "RADIO");
		Value(3);
		UseVar("editor.sky.range");
		NotifyParent("Button::Select", "Range3");
		}
	OnEvent("Range3")
		{
		Cmd("sky.visibilityrange 350");
		Cmd("sky.fogrange 175 350");
		}

	CreateControl("Range4", "BUTTON")
		{

		Pos(480, 8);
		Size(75, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("400");
		Style("ROLLOVER", "RADIO");
		Value(4);
		UseVar("editor.sky.range");
		NotifyParent("Button::Select", "Range4");
		}
	OnEvent("Range4")
		{
		Cmd("sky.visibilityrange 400");
		Cmd("sky.fogrange 200 400");
		}

	CreateControl("Range5", "BUTTON")
		{
	
		Pos(580, 8);
		Size(75, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("450");
		Style("ROLLOVER", "RADIO");
		Value(5);
		UseVar("editor.sky.range");
		NotifyParent("Button::Select", "Range5");
		}
	OnEvent("Range5")
		{
		Cmd("sky.visibilityrange 450");
		Cmd("sky.fogrange 225 450");
		}

	CreateControl("Range6", "BUTTON")
		{

		Pos(680, 8);
		Size(75, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("600");
		Style("ROLLOVER", "RADIO");
		Value(6);
		UseVar("editor.sky.range");
		NotifyParent("Button::Select", "Range6");
		}
	OnEvent("Range6")
		{
		Cmd("sky.visibilityrange 600");
		Cmd("sky.fogrange 600 600");
		}

	CreateControl("Range7", "BUTTON")
		{

		Pos(780, 8);
		Size(75, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("800");
		Style("ROLLOVER", "RADIO");
		Value(7);
		UseVar("editor.sky.range");
		NotifyParent("Button::Select", "Range7");
		}
	OnEvent("Range7")
		{
		Cmd("sky.visibilityrange 800");
		Cmd("sky.fogrange 800 800");
		}

	CreateControl("Range8", "BUTTON")
		{

		Pos(880, 8);
		Size(75, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("1000");
		Style("ROLLOVER", "RADIO");
		Value(8);
		UseVar("editor.sky.range");
		NotifyParent("Button::Select", "Range8");
		}
	OnEvent("Range8")
		{
		Cmd("sky.visibilityrange 1000");
		Cmd("sky.fogrange 1000 1000");
		}
	}
CreateControl("EditSaveGame", "WINDOW")
	{
		ColorGroup("BackGround");

		Geom("HCENTRE", "VCENTRE");
		Pos(0, 0);
		Size(388, 250);
		BorderSize(25);
		BevelSize(13);
		TabSize(313, 25);
		Title("Save Game Options");
		TitleFont("SMALL");
		Style("LEFTTAB", "OUTLINE");

	CreateControl("BznFormatTitle", "STATIC")
		{

		Pos(20, 20);
		Size(350, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("Choose Bzn Format");
		Style("INERT", "TRANSPARENT");
	}

	CreateControl("ascii", "BUTTON")
	{
		Position(45, 80);
		Size(113, 20);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Ascii");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(1);
		UseVar("editor.shell.save");

		NotifyParent("Button::Select", "SaveOption1");

	}

	CreateControl("binary", "BUTTON")
	{
		Position(225, 80);
		Size(113, 20);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Binary");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Value(2);
		UseVar("editor.shell.save");

		NotifyParent("Button::Select", "SaveOption2");
	}

	CreateControl("save", "BUTTON")
	{
		Position(45, 143);
		Size(300, 20);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Save");
		Value(1);
		UseVar("editor.shell.savebutton");
		Cursor("Highlight");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		
		NotifyParent("Button::Select", "save2");
	 }


   CreateControl("ToolTip", "BUTTON")

	{   
		ColorGroup("MAGENTA");
		Position(343, 0);
		Size(45, 15);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Tip");
		Value(2);
		UseVar("editor.shell.savebutton");
		Cursor("Highlight");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		NotifyParent("Button::Select", "ToolTip");

	}

   CreateControl("Close", "BUTTON")

	{   
		Position(45, 213);
		Size(300, 20);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Cancel");
		Value(3);
		UseVar("editor.shell.savebutton");
		Cursor("Highlight");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		NotifyParent("Button::Select", "SaveGameClose");

	}
	// handle the "SaveOption1" event
	OnEvent("SaveOption1")
	{
		Cmd("game.asciisave");
	}
	// handle the "SaveOption2" event
	OnEvent("SaveOption2")
	{
		Cmd("game.binsave");
	}
	// handle the "ToolTip" event
	OnEvent("ToolTip")
	{
		Activate("|EditGameTip");
		Deactivate("|EditSaveGame"); 
		Cmd("editor.shell.savebutton 0");
	}

	// handle the "save2" event
	OnEvent("save2")
	{
		Deactivate("|EditSaveGame");
		Cmd("game.save");
		Cmd("editor.shell.page 0"); 
		Cmd("editor.shell.savebutton 0");
	}
	OnEvent("SaveGameClose")
	{
		Deactivate("|EditSaveGame");
		Cmd("editor.shell.page 0"); 
		Cmd("editor.shell.savebutton 0");

		}
	}

CreateControl("EditGameTip", "WINDOW")
	{

		ColorGroup("BackGround");

		Geom("HCENTRE", "VCENTRE");
		Pos(0, 0);
		Size(388, 250);
		BorderSize(25);
		BevelSize(13);
		TabSize(313, 25);
		Title("Save Game Tips");
		TitleFont("SMALL");
		Style("LEFTTAB", "OUTLINE");

	CreateControl("TipLine1", "STATIC")
		{

		Pos(-37, 20);
		Size(450, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("Use ASCII format if no preplaced");
		Style("INERT", "TRANSPARENT");
	}

	CreateControl("TipLine2", "STATIC")
		{

		Pos(-37, 45);
		Size(450, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("objects contain any space in their name.");
		Style("INERT", "TRANSPARENT");
	}

	CreateControl("TipLine3", "STATIC")
		{

		Pos(-37, 70);
		Size(450, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("Other wise use Binary Format Option to");
		Style("INERT", "TRANSPARENT");
	}

	CreateControl("TipLine4", "STATIC")
		{

		Pos(-37, 95);
		Size(450, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("prevent the names from being cutoff.");
		Style("INERT", "TRANSPARENT");
	}

	CreateControl("TipLine5", "STATIC")
		{

		Pos(-37, 145);
		Size(450, 20);
		BorderSize(3);
		BevelSize(5);
		Font("TINY");
		Text("Editor defaults to ascii-saves");
		Style("INERT", "TRANSPARENT");
	}

   CreateControl("Close", "BUTTON")

	{   
		Position(38, 213);
		Size(300, 20);
		BorderSize(13);
		BevelSize(13);
		Font("TINY");
		Text("Back");
		Value(1);
		UseVar("editor.shell.savebutton");
		Cursor("Highlight");
		Style("ROLLOVER", "RADIO", "OUTLINE");
		NotifyParent("Button::Select", "BackUp");
	}
	// handle the "BackUp" event
	OnEvent("BackUp")
	{
		Activate("|EditSaveGame");
		Deactivate("|EditGameTip"); 
		Cmd("editor.shell.savebutton 0");
		}
	}

