require( "scripts/style.lua" );

kButtonSpacing = 50;
kButtonY = 50;

Paused(1)
MetricsMode(3);

by = 220
bh = 50

SetSoundMuteForPause(1);

MakeDialog
{
	Bitmap
	{
		name="pausebackground",
		image="backgrounds/dialog",
		x=kCenter,
		y=kCenter,
		
		Text
		{
			font = DialogTitleFont,
			name = "yesnobody",
			x=0,y=by-bh*1.25-3,
			w=kMax,h=kMax,
			flags = kHAlignCenter,
			label = "pausemenutitle",
		},
		
		Button
		{
			x=kCenter,
			y=by,
			font = StandardButtonFont,
			graphics = StandardButtonGraphics,
			name="resume",
			label="resume",
			type = kPush,
			command=
				function()
					SetSoundMuteForPause(0);
					Paused(0);
					CloseWindow(nil);
				end
		},
		
		Button
		{
			x=kCenter,
			y=by+(bh*1),
			font = StandardButtonFont,
			graphics = StandardButtonGraphics,
			name="options",
			label="options",
			type = kPush,
			command=
				function()
					DoModal("scripts/options.lua");
					SetSoundMuteForPause(1);
					MetricsMode(3);
				end
		},
		
		Button
		{
			x=kCenter,
			y=by+(bh*2),
			font = StandardButtonFont,
			graphics = StandardButtonGraphics,
			name="help",
			label="help",
			type = kPush,
			command=
				function()
					DoModal("scripts/Instructions.lua");
					MetricsMode(3);
				end
		},
		
		Button
		{
			x=kCenter,
			y=by+(bh*3),
			font = StandardButtonFont,
			graphics = StandardButtonGraphics,
			name="quit",
			label="quit",
			type = kPush,
			command=
				function()
				
					if (StoryMode()) then
					
						-- Story Mode : Save Progress ?
						result = DisplayDialog { 
							"scripts/yesno.lua", 
							body ="quitsaveconfirm",
							title = "quitsavetitle" 
						};
						if (result=='yes') then
							QuitGame();
							PopModal(); -- take off pause menu
							SwapToModal("scripts/mainmenu.lua");
						end	
							
					else
						-- Arcade Mode : Save Progress ?
						result = DisplayDialog { 
							"scripts/yesno.lua", 
							body ="arcadequitsaveconfirm",
							title = "arcadequitsavetitle" 
						};
						if (result=='yes') then						
							QuitGame();
							PopModal(); -- take off pause menu
							SwapToModal("scripts/mainmenu.lua");
						end
						return
						
					end
					
				end
		},
	},
}