// ================
// BATTLEZONE SHELL
// ================

//
// CREATE SHELL LOGIN PAGE
//

// ========================
// BATTLEZONE MAIN SHELL SCREEN
// ========================

// create page variable
ConfigureVarSys()
{
	CreateInteger("shell.page", 0);
	SetIntegerRange("shell.page", 0, 6);
}

// load escape screen pages
Exec("bzshell_init.cfg");
Exec("bzshell_single.cfg");
Exec("bzshell_multi.cfg");
Exec("bzshell_instant.cfg");
Exec("bzshell_login.cfg");
Exec("bzshell_load.cfg");
Exec("bzshell_option.cfg");
Exec("bzshell_single_debrief.cfg");
Exec("bzshell_credits.cfg");
Exec("bzshell_login_warn_dupfiles.cfg");
Exec("bzshell_cpcred.cfg");
//Exec("bzshell_error.cfg");

//Command to turn on console logging
Cmd("console.log 1");

//
// CREATE THE MAIN SHELL PANEL
//
CreateControl("ShellMain", "WINDOW")
{
	Geom("PARENTWIDTH", "PARENTHEIGHT");
	Style("TRANSPARENT", "INERT");
	

	//
	// create the quit button
	//
	CreateControl("Quit", "BUTTON")
	{
		ColorGroup("MAGENTA");
		Geometry("LEFT", "TOP");
		Position(40, 26);
		Size(55, 00);
		BorderSize(9);
		BevelSize(4);
		Style("ROLLOVER", "OUTLINE");
		Text("Logout");
		Font("SMALL");
		Cursor("Highlight");
		NotifyParent("Button::Press", "Quit");
	}

	//
	// create the load options button
	//
	CreateControl("Options", "BUTTON")
	{
		ColorGroup("MAGENTA");
		Position(289, 460);
		Size(65, 0);
		BorderSize(9);
		BevelSize(4);
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Text("Options");
		Font("MEDIUM");
		Cursor("Highlight");
		NotifyParent("Button::Select", "Options");
		UseVar("shell.page");
		Value(4);
	}

	//
	// create the play options button
	//
	CreateControl("Single", "BUTTON")
	{
		ColorGroup("MAGENTA");
		Position(167, 26);
		Size(55, 0);
		BorderSize(9);
		BevelSize(4);
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Text("Single");
		Font("SMALL");
		Cursor("Highlight");
		NotifyParent("Button::Select", "Single");
		UseVar("shell.page");
		Value(0);
	}

	//
	// create the graphic options button
	//
	CreateControl("Instant", "BUTTON")
	{
		ColorGroup("MAGENTA");
		Position(294, 26);
		Size(55, 0);
		BorderSize(9);
		BevelSize(4);
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Text("Instant");
		Font("SMALL");
		Cursor("Highlight");
		NotifyParent("Button::Select", "Instant");
		UseVar("shell.page");
		Value(1);
	}

	//
	// create the sound options button
	//
	CreateControl("Multi", "BUTTON")
	{
		ColorGroup("MAGENTA");
		Position(422, 26);
		Size(55, 0);
		BorderSize(9);
		BevelSize(4);
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Text("Multi");
		Font("SMALL");
		Cursor("Highlight");
		NotifyParent("Button::Select", "Multi");
		UseVar("shell.page");
		Value(2);
	}
	
	//
	// create the fp credits button
	//
	CreateControl("Cpcred", "BUTTON")
	{
		ColorGroup("MAGENTA");
		Geometry("HCENTRE", "VCENTRE");
		Position(0, 120);
		Size(75, 0);
		BorderSize(9);
		BevelSize(4);
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Text("FECredits");
		Font("SMALL");
		Cursor("Highlight");
		NotifyParent("Button::Select", "Cpcred");
		UseVar("shell.page");
		Value(-1);
	}


	CreateControl("HostsVersTitle", "STATIC")
		{
		ColorGroup("MAGENTA");
		Geometry("HCENTRE", "VCENTRE");
		Position(0, 150);
		Size(56, 0);
		BorderSize(9);
		BevelSize(4);
		Font("tiny");
		UseVar("network.session.svar22");
	//	Text(" ");
		JustifyText("CENTER");
		Style("TRANSPARENT");
		}

	
	//
	// create the input options button
	//
	CreateControl("Load", "BUTTON")
	{
		ColorGroup("MAGENTA");
		Position(549, 26);
		Size(55, 0);
		BorderSize(9);
		BevelSize(4);
		Style("ROLLOVER", "RADIO", "OUTLINE");
		Text("File");
		Font("SMALL");
		Cursor("Highlight");
		NotifyParent("Button::Select", "Load");
		UseVar("shell.page");
		Value(3);
	}

	//
	// show credits
	//

	CreateControl("Credits", "BUTTON")
	{
		ColorGroup("MAGENTA");
		Geometry("RIGHT", "BOTTOM");
		Position(-150, -20);
		Size(65, 0);
		BorderSize(9);
		BevelSize(4);
		Style("ROLLOVER", "OUTLINE");
		Text("Credits");
		Font("MEDIUM");
		Cursor("Highlight");
		NotifyParent("Button::Press", "Credits");
	}

	OnEvent("Credits")
	{
		cmd("shell.stopSound mire22_2.wav");
		cmd("shell.credits");
		cmd("shell.backgroundSound mire22_2.wav");
	}

	//
	// replay the intro
	//
	CreateControl("Replay", "BUTTON")
	{
		ColorGroup("MAGENTA");
		Geometry("LEFT", "BOTTOM");
		Position(150, -20);
		Size(65, 0);
		BorderSize(9);
		BevelSize(4);
		Style("ROLLOVER", "OUTLINE");
		Text("Movie");
		Font("MEDIUM");
		Cursor("Highlight");
		NotifyParent("Button::Press", "Replay");
	}
	
	OnEvent("Replay")
	{
		cmd("shell.stopSound mire22_2.wav");
		cmd("shell.introMovie");
		cmd("shell.backgroundSound mire22_2.wav");
	}

	CreateControl("Movie", "STATIC")
	{
		ColorGroup("BACKGROUND");
		Geometry("HCENTRE", "VCENTRE");
		Position(4, 0);
		Size(240, 180);
	}

	OnEvent("Control::Activate")
	{
		cmd("shell.background main.tga");
		Activate("|ShellMain");
		Cmd("shell.page 5");
		cmd("shell.movie");
		cmd("shell.backgroundSound mire22_2.wav");	
	}
	
	OnEvent("Control::Deactivate")
	{
		cmd("shell.stopSound mire22_2.wav");
	}

	OnEvent("Single")
	{
		FadeOut("|ShellLogin");
		FadeOut("|ShellMulti");
		FadeOut("|ShellInstant");
//		FadeOut("|EscapePanel");
		FadeOut("|EscapeLoad");
		FadeOut("|ShellMain");
		FadeIn("|ShellSingle");
		Cmd("shell.single.enter");
	}

	OnEvent("Instant")
	{
		FadeOut("|ShellLogin");
		FadeOut("|ShellMulti");
		FadeOut("|ShellSingle");
//		FadeOut("|EscapePanel");
		FadeOut("|EscapeLoad");
		FadeOut("|ShellMain");
		FadeIn("|ShellInstant");
	}
	
	OnEvent("Cpcred")
	{
		FadeOut("|ShellMain");
		FadeIn("|FeCredits");
	}

	OnEvent("Multi")
	{
		FadeOut("|ShellLogin");
		FadeOut("|ShellInstant");
		FadeOut("|ShellSingle");
//		FadeOut("|EscapePanel");
		FadeOut("|EscapeLoad");
		FadeOut("|ShellMain");
		Cmd("shell.multi.enter");
		FadeIn("|ShellMulti");
	}

	OnEvent("Load")
	{
		FadeOut("|ShellLogin");
		FadeOut("|ShellInstant");
		FadeOut("|ShellSingle");
//		FadeOut("|EscapePanel");
		FadeOut("|ShellMulti");
		FadeOut("|ShellMain");
		FadeIn("|ShellLoad");
	}

	OnEvent("Options")
	{
		FadeOut("|ShellLogin");
		FadeOut("|ShellInstant");
		FadeOut("|ShellSingle");
		FadeOut("|EscapeLoad");
		FadeOut("|ShellMulti");
		FadeOut("|ShellMain");
		FadeIn("|OptionPanel");
	}

	OnEvent("Quit")
	{
		FadeOut("|ShellMain");
		FadeIn("|ShellLogin");
		//Cmd("sys.runcode quit");	
	}

}
