require( "scripts/style.lua" );

Paused(0)
		
MetricsMode(1);
		
MakeDialog
{
	GameWindow
	{ 
		x=0,
		y=0,
		w=800,
		h=600,

		Button
		{
			x=-200,
			y=-200,
			font = StandardButtonFont,
			graphics = StandardButtonGraphics,
			name="tipcontinue",
			label="continue",
			type = kPush,
			command=
				function()
					TipContinue();
				end
		},

		Button{
			graphics = CheckboxButtonGraphics,
			name="hideinsbutton",
			type = kToggle,
			x=-200,
			y=-200,
			w=160,
			Text
			{
				font = StandardButtonFont,
				name = "hidetips",
				x=50,
				y=18,
				w=kMax,
				h=kMax,
				flags = kHAlignLeft + kVAlignTop,
				label="hidetips",
			};
			command=
			function()
				ToggleHideIns();
			end
		};		
					
		Bitmap
		{
			name="panel",
			image="backgrounds/panel",
			x=0,
			y=500,
			w = 800,
			h = 100,	
			
		},
		
		Button
		{
			x=660,
			y=30,
			font = StandardButtonFont,
			graphics = StandardButtonGraphics,
			name="pause",
			label="pause",
			type = kPush,
			command=
				function()
					if (AllowedToPause()) then
						DoModal("scripts/pause.lua");
						MetricsMode(1);
					end
				end
		},
			
		GamePanel
		{ 
			x=0,
			y=0,
			w=800,
			h=600,	
		},			
	}
}

function StopGame ( reason )

	if (reason == 1) then
		-- possible start or middle comics
		if (ComicAvailable(0) == 1) then
			DoModal("scripts/comic.lua");								
		end
		--PopModal();		
		SwapToModal("scripts/storymap.lua");
		return 1
	end
	if (reason == 2) then
		-- ending
		if (ComicAvailable(1) == 1) then
			DoModal("scripts/comic.lua");								
		end	
		--StartNewGame()
		DoModal("scripts/hiscore.lua");
		--PopModal();			
		SwapToModal("scripts/mainmenu.lua");
		return 1
	end
	if (reason == 3) then
		--PopModal();
		SwapToModal("scripts/storymap.lua");
		return 1
	end	
	if (reason == 4) then
		--PopModal();
		SwapToModal("scripts/arcademap.lua");
		return 1
	end		
	return 0
end

function Complete ( )
	DoModal("scripts/Complete.lua");
	MetricsMode(1);	
end

function BackToPause ( )
	DoModal("scripts/pause.lua");
end

function PauseGame()
	if (AllowedToPause()) then
		DoModal("scripts/pause.lua");
	end
end


function ArcadeOver()
	DoModal("scripts/hiscore.lua");
	SwapToModal("scripts/mainmenu.lua");
end