---------------------------------------------------------------------------------------------------
--  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 postsprite = { image = "minigames/gears/bolt"; x = 7; y = 7; };
local yoffset = 0;
local kPieceMoveTime = 200;

dialogs =
{
	gears_dialog_intro =
	{
		name = "gears_dialog_intro";
		image = "autumn_thoughtful";
		sound = "autumn_find_a_way_gears_in_open_door";
		text = "autumn_find_a_way_gears_in_open_door";
	};

	gears_dialog_oncomplete =
	{
		name = "gears_dialog_oncomplete";
		image = "autumn_amused";
		sound = "autumn_alright_figured_open_sesame";
		text = "autumn_alright_figured_open_sesame";
	};
};	

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

MakeDialog
{
	SetStyle( MinigameJigsawStyle );
	
	MinigameGears
	{
		name = "gears";
		lockcorrectpieces = false;
		lockinitialpieces = true;
		returnpiecesonmiss = true;
		timetoholdpiece = 350;
		barfinalemovex = 300;
		barfinalemovey = 0;
		skipdelaytime = kPieceMoveTime;
		skippiecedelay = 50;
		
		layers =
		{
			leftbar =
			{
				image = "minigames/gears/leftbar";
				x = 9;
				y = 393 + yoffset;
			};
			
			rightbar =
			{
				image = "minigames/gears/rightbar";
				x = 516;
				y = 393 + yoffset;
			};
			
			overlay =
			{
				image = "minigames/gears/overlay";
				x = 68;
				y = 9 + yoffset;
			};
		};
		
		slotallows =
		{
			slot00 = { 9; };
			slot01 = { };
			slot02 = { 6; 7; 8; };
			slot03 = { };
			slot04 = { 8; };
			slot05 = { 6; 7; 8; };
			slot06 = { 6; };
			slot07 = { 5; };
		};
		
		pieceallows =
		{
			piece06 =
			{
				slot02 =
				{
					slot04 = { 8; };
				};
				
				slot05 =
				{
					slot01 = { 7; };
				};
				
				slot06 =
				{
					slot04 = { 8; };
					slot02 = { 7; };
				};
			};
			
			piece07 =
			{
				slot02 =
				{
					slot04 = { 8; };
					slot06 = { 6; };
				};
				
				slot05 =
				{
					
				};
			};
			
			piece08 =
			{
				slot02 =
				{
					slot04 = { 6; };
				};
				
				slot04 =
				{
					slot02 = { 6; 7; };
					slot06 = { 6; };
				};
				
				slot05 =
				{
					slot01 = { 6; };
					slot03 = { 6; 7; };
				};
			};
		};
		
		windowsprite =
		{
			sprite = "minigames/gears/background";
			xcenter = 400;
			ycenter = 300 - yoffset;
		};
		
		playfield =
		{
			field =
			{
				x = 155;
				y = 46 + yoffset;
				w = 493;
				h = 285;
			};
		};

		soundgearsturning =
		{
			name = "complete";
			loop = false;
			initialdelay = 0;
			delay = 0;
			sounds = gs_soundMetalGearsTurning;
		};
		
		pieces =
		{
			piece00 = { x = 0;		y = 0 + yoffset;	index = 5; };
			piece01 = { x = 70;		y = 75 + yoffset;	index = 6; };
			piece02 = { x = 70;		y = 260 + yoffset;	index = 7; };
			piece03 = { x = 730;	y = 200 + yoffset;	index = 8; };
			piece04 = { x = 0;		y = 0 + yoffset;	index = 9; };
		};
		
		slots =
		{
			slot00 = { x = 171; y = 168 + yoffset; postsprite = postsprite; index = {9;}; startindex = 9; };
			slot01 = { x = 290; y = 149 + yoffset; postsprite = postsprite; index = {-1}; startindex = -1; };
			slot02 = { x = 398; y = 149 + yoffset; postsprite = postsprite; index = {7;}; startindex = -1; };
			slot03 = { x = 502; y = 149 + yoffset; postsprite = postsprite; index = {-1}; startindex = -1; };
			slot04 = { x = 290; y = 234 + yoffset; postsprite = postsprite; index = {8;}; startindex = -1; };
			slot05 = { x = 398; y = 234 + yoffset; postsprite = postsprite; index = {-1}; startindex = -1; };
			slot06 = { x = 502; y = 234 + yoffset; postsprite = postsprite; index = {6;}; startindex = -1; };
			slot07 = { x = 632; y = 185 + yoffset; postsprite = postsprite; index = {5;}; startindex = 5; };
		};
			
		pieceinfo =
		{
			movetime = kPieceMoveTime;
			maxalphahilight = 0.3;
			minalphahilight = 0.1;
			timehilight = 400;
			hidewheninslot = false;
			image = "minigames/gears/gears";
			indexpreoffset = -5;
		};
		
		MinigameButtons();
		AddMinigameTutorial( 400, 300, "gearstutorial", "tutorial", -1 );
	};
};

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