---------------------------------------------------------------------------------------------------
--  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 yoffset = 0;
local trianglex = 91;
local triangley = 56;
local trianglew = 79;
local triangleh = 79;
local trianglegap = 50;
		
dialogs =
{
	tangram_dialog_intro =
	{
		name = "tangram_dialog_intro";
		image = "autumn_thoughtful";
		sound = "autumn_this_puzzle_together_lock";
		text = "autumn_this_puzzle_together_lock";
	};
	
	tangram_dialog_oncomplete =
	{
		name = "tangram_dialog_oncomplete";
		image = "autumn_amused";
		sound = "autumn_another_scrap_few_more_to_go";
		text = "autumn_another_scrap_few_more_to_go";
	};
};

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

MakeDialog
{
	SetStyle( MinigameJigsawStyle );
	
	MinigameTangram
	{
		name = "tangram";
		lockcorrectpieces = false;
		lockinitialpieces = false;
		returnpiecesonmiss = true;
		timetoholdpiece = 350;
		skippiecedelay = 50;
		
		windowsprite =
		{
			sprite = "minigames/tangram/background";
			xcenter = 400;
			ycenter = 300 - yoffset;
		};
		
		playfield = {};
		
		playfieldtriangle =
		{
			ax = trianglex + ( trianglew * 4 );
			ay = triangley + ( triangleh * 0 ) + yoffset - trianglegap;
			bx = trianglex + ( trianglew * 0 ) - trianglegap;
			by = triangley + ( triangleh * 4 ) + yoffset + trianglegap;
			cx = trianglex + ( trianglew * 8 ) + trianglegap;
			cy = triangley + ( triangleh * 4 ) + yoffset + trianglegap;
		};
		
		maintriangle =
		{
			ax = 4;
			ay = 0;
			bx = 0;
			by = 4;
			cx = 8;
			cy = 4;
		};

		pieces =
		{
			-- Trapezoid
			piece00 = 
			{ 
				x = 703; 
				y = 160 + yoffset; 
				index = 0; 
				
				triangles = 
				{ 
					triangle00 = { ax=0; ay=0; bx=0; by=1; cx=1; cy=1; }; 
					triangle01 = { ax=0; ay=1; bx=1; by=1; cx=0; cy=2; }; 
					triangle02 = { ax=0; ay=2; bx=1; by=2; cx=1; cy=1; }; 
					triangle03 = { ax=0; ay=2; bx=1; by=2; cx=1; cy=3; }; 
				}; 
			};
			
			-- Diamond
			piece01 = 
			{ 
				x = 415; 
				y = 310 + yoffset; 
				index = 1; 
				
				triangles = 
				{ 
					triangle00 = { ax=0; ay=0; bx=0; by=1; cx=1; cy=1; }; 
					triangle01 = { ax=0; ay=1; bx=0; by=1; cx=-1;cy=1; }; 
					triangle02 = { ax=-1;ay=1; bx=0; by=1; cx=0; cy=2; }; 
					triangle03 = { ax=1; ay=1; bx=0; by=1; cx=0; cy=2; }; 
				}; 
			};
			
			-- Triangle Down
			piece02 = 
			{ 
				x = 565; 
				y = 385 + yoffset; 
				index = 2; 
				
				triangles = 
				{ 
					triangle00 = { ax=0; ay=0; bx=1; by=1; cx=1; cy=0; }; 
					triangle01 = { ax=1; ay=0; bx=1; by=1; cx=2; cy=0; }; 
				}; 
			};
			
			-- Triangle Right
			piece03 = 
			{ 
				x = 55; 
				y = 195 + yoffset; 
				index = 3; 
				
				triangles = 
				{ 
					triangle00 = { ax=0; ay=0; bx=0; by=1; cx=1; cy=1; }; 
					triangle01 = { ax=1; ay=1; bx=0; by=1; cx=0; cy=2; }; 
				}; 
			};
			
			-- Big Triangle
			piece04 = 
			{ 
				x = 160; 
				y = 0 + yoffset; 
				index = 4; 
				
				triangles = 
				{ 
					triangle00 = { ax=0; ay=0; bx=1; by=1; cx=0; cy=1; }; 
					triangle01 = { ax=0; ay=0; bx=-1;by=1; cx=0; cy=1; }; 
					triangle02 = { ax=-2;ay=2; bx=-1;by=2; cx=-1;cy=1; }; 
					triangle03 = { ax=-1;ay=1; bx=-1;by=2; cx=0; cy=2; }; 
					triangle04 = { ax=-1;ay=1; bx=0; by=1; cx=0; cy=2; }; 
					triangle05 = { ax=0; ay=1; bx=0; by=2; cx=1; cy=1; }; 
					triangle06 = { ax=0; ay=2; bx=1; by=1; cx=1; cy=2; }; 
					triangle07 = { ax=1; ay=1; bx=1; by=2; cx=2; cy=2; };  
				}; 
			};
			
			-- Big Triangle
			piece05 = 
			{ 
				x = 640; 
				y = 0 + yoffset; 
				index = 5; 
				
				triangles = 
				{ 
					triangle00 = { ax=0; ay=0; bx=1; by=1; cx=0; cy=1; }; 
					triangle01 = { ax=0; ay=0; bx=-1;by=1; cx=0; cy=1; }; 
					triangle02 = { ax=-2;ay=2; bx=-1;by=2; cx=-1;cy=1; }; 
					triangle03 = { ax=-1;ay=1; bx=-1;by=2; cx=0; cy=2; }; 
					triangle04 = { ax=-1;ay=1; bx=0; by=1; cx=0; cy=2; }; 
					triangle05 = { ax=0; ay=1; bx=0; by=2; cx=1; cy=1; }; 
					triangle06 = { ax=0; ay=2; bx=1; by=1; cx=1; cy=2; }; 
					triangle07 = { ax=1; ay=1; bx=1; by=2; cx=2; cy=2; }; 
				}; 
			};
			
			-- Triangle Down-Right
			piece06 = 
			{ 
				x = 260; 
				y = 300 + yoffset; 
				index = 6; 
				
				triangles = 
				{ 
					triangle00 = { ax=-1;ay=1; bx=0; by=1; cx=0; cy=2; }; 
					triangle01 = { ax=0; ay=0; bx=-1;by=1; cx=0; cy=1; }; 
					triangle02 = { ax=-2;ay=2; bx=-1;by=2; cx=-1;cy=1; }; 
					triangle03 = { ax=-1;ay=1; bx=-1;by=2; cx=0; cy=2; }; 
				}; 
			};
		};
		
		slots =
		{
			slot00 = { x = trianglex + ( trianglew * 4 ); y = triangley + ( triangleh * 0 ) + yoffset; index = {0;6;}; startindex = -1; trianglepoint = { x=4;y=0; } };
			slot01 = { x = trianglex + ( trianglew * 3 ); y = triangley + ( triangleh * 1 ) + yoffset; index = {-1}; startindex = -1; trianglepoint = { x=3;y=1; } };
			slot02 = { x = trianglex + ( trianglew * 5 ); y = triangley + ( triangleh * 1 ) + yoffset; index = {3;}; startindex = -1; trianglepoint = { x=5;y=1; } };
			slot03 = { x = trianglex + ( trianglew * 2 ); y = triangley + ( triangleh * 2 ) + yoffset; index = {2;4;}; startindex = -1; trianglepoint = { x=2;y=2; } };
			slot04 = { x = trianglex + ( trianglew * 4 ); y = triangley + ( triangleh * 2 ) + yoffset; index = {1;}; startindex = -1; trianglepoint = { x=4;y=2; } };
			slot05 = { x = trianglex + ( trianglew * 6 ); y = triangley + ( triangleh * 2 ) + yoffset; index = {5;}; startindex = -1; trianglepoint = { x=6;y=2; } };
			slot06 = { x = trianglex + ( trianglew * 1 ); y = triangley + ( triangleh * 3 ) + yoffset; index = {-1}; startindex = -1; trianglepoint = { x=1;y=3; } };
			slot07 = { x = trianglex + ( trianglew * 3 ); y = triangley + ( triangleh * 3 ) + yoffset; index = {-1}; startindex = -1; trianglepoint = { x=3;y=3; } };
			slot08 = { x = trianglex + ( trianglew * 5 ); y = triangley + ( triangleh * 3 ) + yoffset; index = {-1}; startindex = -1; trianglepoint = { x=5;y=3; } };
			slot09 = { x = trianglex + ( trianglew * 7 ); y = triangley + ( triangleh * 3 ) + yoffset; index = {-1}; startindex = -1; trianglepoint = { x=7;y=3; } };
		};
		
		pieceinfo =
		{
			movetime = 200;
			maxalphahilight = 0.3;
			minalphahilight = 0.1;
			timehilight = 400;
			hidewheninslot = false;
			image = "minigames/tangram/pieces";
			indexpreoffset = 0;
		};
		
		slotinfo =
		{
			validdistance = 40;
			rejectincorrectpieces = false;
			allowmultiplepieces = true;
		};
		
		MinigameButtons();
		AddMinigameTutorial( 400, 300, "tangramtutorial", "tutorial", -1 );
	};
};

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