---------------------------------------------------------------------------------------------------
--  Copyright © 2009 PoBros, Incorporated. All Rights Reserved.
--
--  This source code is the proprietary confidential property of PoBros Incorporated.
--  Modification, reproduction, publication, or distribution in any form to any party 
--  other than the licensee is strictly prohibited.
--
--  FOR USE BY AUTHORIZED PERSONS ONLY
---------------------------------------------------------------------------------------------------

require( "scripts/style.lua" );

local kBodyToHeaderHeight = 20;
local kBodyToBodyHeight = 0;
local kButtonXOffset = 15;
local kAmpersandGap = 50;
local kBitmapHorzGap = 30;

local kImageAutumn =
{
	x = kBitmapHorzGap;
	image = "credits/autumn";
	flags = kHAlignLeft + kVAlignCenter;
};

local kImageAmber =
{
	x = -kBitmapHorzGap;
	image = "credits/amber";
	flags = kHAlignRight + kVAlignCenter;
};

local kImagePAS =
{
	image = "credits/pas";
	x = 400;
	flags = kHAlignCenter + kVAlignTop;
};

local kImagePoBros =
{
	image = "credits/pobros";
	x = 400;
	flags = kHAlignCenter + kVAlignTop;
};

---------------------------------------------------------------------------------------------------

function CreditsContinue()
	FadeOut( "SwapToModal( 'scripts/mainmenu.lua' );" );
end

---------------------------------------------------------------------------------------------------

MakeDialog
{
	SetStyle( CreditsRollStyle );
	
	TextScroll
	{
		music = gs_musicMainMenu;
		scrollspeed = 50;	-- pixels per second
		completestring = "CreditsContinue();";
		textstring = "text%02d";
		
		objects =
		{
			{ type = "main";	text = "creditsroll1";		yoffset = 50; };
			{ type = "main";	text = "creditsroll2";		yoffset = kBodyToHeaderHeight; };
			{ type = "main";	text = "creditsroll3";		yoffset = kBodyToHeaderHeight; };
			{ type = "image";	bitmap = kImagePAS;			yoffset = kBodyToHeaderHeight + 50; };
			{ type = "header";	text = "creditsheader1";	yoffset = kBodyToHeaderHeight; };
			{ type = "body";	text = "creditsnames1";		yoffset = kBodyToBodyHeight; };
			{ type = "header";	text = "creditsheader2";	yoffset = kBodyToHeaderHeight; };
			{ type = "body";	text = "creditsnames2";		yoffset = kBodyToBodyHeight; };
			{ type = "header";	text = "creditsheader3";	yoffset = kBodyToHeaderHeight; };
			{ type = "body";	text = "creditsnames3";		yoffset = kBodyToBodyHeight; };
			{ type = "header";	text = "creditsheader4";	yoffset = kBodyToHeaderHeight; };
			{ type = "body";	text = "creditsnames4";		yoffset = kBodyToBodyHeight; };
			{ type = "header";	text = "creditsheader5";	yoffset = kBodyToHeaderHeight; };
			{ type = "body";	text = "creditsnames5";		yoffset = kBodyToBodyHeight; };
			{ type = "header";	text = "creditsheader6";	yoffset = kBodyToHeaderHeight; };
			{ type = "body";	text = "creditsnames6";		yoffset = kBodyToBodyHeight; };
			{ type = "header";	text = "creditsheader7";	yoffset = kBodyToHeaderHeight; };
			{ type = "body";	text = "creditsnames7";		yoffset = kBodyToBodyHeight; };
			{ type = "image";	bitmap = kImagePoBros;		yoffset = kBodyToHeaderHeight; };
		};
		
		texttypes =
		{
			header =
			{
				x = 400;
				y = 0;
				w = 400;
				h = 400;
				flags = kHAlignCenter + kVAlignTop;
				font = CreditsRollHeaderFont;
			};
			
			body =
			{
				x = 400;
				y = 0;
				w = 400;
				h = 400;
				flags = kHAlignCenter + kVAlignTop;
				font = CreditsRollBodyFont;
			};
			
			main =
			{
				x = 400;
				y = 0;
				w = 400;
				h = 400;
				flags = kHAlignCenter + kVAlignTop;
				font = CreditsRollMainFont;
			};
		};
		
		SetStyle( ButtonStyle );
		
		Button
		{
			x = kMax - 150 - kButtonXOffset;
			y = kMax - 50;
			name = "skip";
			text = "skip";
			
			command =
				function()
					PauseTextScroll();
					CreditsContinue();
				end
		};

		Button
		{
			x = kButtonXOffset;
			y = kMax - 50;
			name = "menu";
			text = "menu";
			
			command =
				function()
					PauseTextScroll();
					value = DoModal( "scripts/pause.lua" );
					
					if( value == "mainmenu" ) then
						FadeOut( "SwapToModal( 'scripts/mainmenu.lua' );" );
					else
						ResumeTextScroll();
					end
				end
		};
	};
};

---------------------------------------------------------------------------------------------------
