---------------------------------------------------------------------------------------------------
--  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 tileX = 109;
local tileWidth = 116;
local tileY = -54;
local tileHeight = 117;
local kYOffset = 0;

local tileLeft = 80;
local tileRight = 720;
local tileSideY = 119;
local index0 = {0;6;11;13};
local index1 = {1;7;10;12;};
local index2 = {2;4;9;15;};
local index3 = {3;5;8;14;};

dialogs =
{
	sudoku_dialog_intro =
	{
		name = "sudoku_dialog_intro";
		image = "autumn_thoughtful";
		sound = "autumn_reminds_sudoku_game";
		text = "autumn_reminds_sudoku_game";
	};
	
	sudoku_dialog_oncomplete =
	{
		name = "sudoku_dialog_oncomplete";
		image = "autumn_amused";
		sound = "autumn_that_wasnt_so_tough";
		text = "autumn_that_wasnt_so_tough";
	};
};

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

MakeDialog
{
	SetStyle( MinigameJigsawStyle );
	
	MinigameJigsaw
	{
		name = "sudoku";
		lockcorrectpieces = false;
		lockinitialpieces = true;
		returnpiecesonmiss = true;
		timetoholdpiece = 350;
		skippiecedelay = 50;
		
		windowsprite =
		{
			sprite = "minigames/sudoku/background";
			xcenter = 400;
			ycenter = 300 - kYOffset;
		};
		
		playfield =
		{
			field1 =
			{
				x = 162;
				y = kYOffset;
				w = 476;
				h = 538;
			};
		};
		
		pieces =
		{
			piece00 = { x = 0; y = kYOffset; index = 0; };
			piece01 = { x = 0; y = kYOffset; index = 1; };
			piece02 = { x = 0; y = kYOffset; index = 2; };
			piece03 = { x = tileLeft; y = kYOffset + tileSideY + ( tileHeight * 0 ); index = 3; };
			piece04 = { x = tileRight; y = kYOffset + tileSideY + ( tileHeight * 1 ); index = 4; };
			piece05 = { x = tileRight; y = kYOffset + tileSideY + ( tileHeight * 2 ); index = 5; };
			piece06 = { x = 0; y = kYOffset; index = 6; };
			piece07 = { x = 0; y = kYOffset; index = 7; };
			piece08 = { x = 0; y = kYOffset; index = 8; };
			piece09 = { x = 0; y = kYOffset; index = 9; };
			piece10 = { x = 0; y = kYOffset; index = 10; };
			piece11 = { x = tileLeft; y = kYOffset + tileSideY + ( tileHeight * 2 ); index = 11; };
			piece12 = { x = 0; y = kYOffset; index = 12; };
			piece13 = { x = 0; y = kYOffset; index = 13; };
			piece14 = { x = tileRight; y = kYOffset + tileSideY + ( tileHeight * 0 ); index = 14; };
			piece15 = { x = tileLeft; y = kYOffset + tileSideY + ( tileHeight * 1 ); index = 15; };
		};
		
		slots =
		{
			slot00 = { x = tileX + ( tileWidth * 1 ); y = kYOffset + tileY + ( tileHeight * 1 ); index = index0; startindex = 0; };
			slot01 = { x = tileX + ( tileWidth * 2 ); y = kYOffset + tileY + ( tileHeight * 1 ); index = index1; startindex = 1; };
			slot02 = { x = tileX + ( tileWidth * 3 ); y = kYOffset + tileY + ( tileHeight * 1 ); index = index2; startindex = 2; };
			slot03 = { x = tileX + ( tileWidth * 4 ); y = kYOffset + tileY + ( tileHeight * 1 ); index = index3; startindex = -1; };
			slot04 = { x = tileX + ( tileWidth * 1 ); y = kYOffset + tileY + ( tileHeight * 2 ); index = index2; startindex = -1; };
			slot05 = { x = tileX + ( tileWidth * 2 ); y = kYOffset + tileY + ( tileHeight * 2 ); index = index3; startindex = -1; };
			slot06 = { x = tileX + ( tileWidth * 3 ); y = kYOffset + tileY + ( tileHeight * 2 ); index = index0; startindex = 6; };
			slot07 = { x = tileX + ( tileWidth * 4 ); y = kYOffset + tileY + ( tileHeight * 2 ); index = index1; startindex = 7; };
			slot08 = { x = tileX + ( tileWidth * 1 ); y = kYOffset + tileY + ( tileHeight * 3 ); index = index3; startindex = 8; };
			slot09 = { x = tileX + ( tileWidth * 2 ); y = kYOffset + tileY + ( tileHeight * 3 ); index = index2; startindex = 9; };
			slot10 = { x = tileX + ( tileWidth * 3 ); y = kYOffset + tileY + ( tileHeight * 3 ); index = index1; startindex = 10; };
			slot11 = { x = tileX + ( tileWidth * 4 ); y = kYOffset + tileY + ( tileHeight * 3 ); index = index0; startindex = -1; };
			slot12 = { x = tileX + ( tileWidth * 1 ); y = kYOffset + tileY + ( tileHeight * 4 ); index = index1; startindex = 12; };
			slot13 = { x = tileX + ( tileWidth * 2 ); y = kYOffset + tileY + ( tileHeight * 4 ); index = index0; startindex = 13; };
			slot14 = { x = tileX + ( tileWidth * 3 ); y = kYOffset + tileY + ( tileHeight * 4 ); index = index3; startindex = -1; };
			slot15 = { x = tileX + ( tileWidth * 4 ); y = kYOffset + tileY + ( tileHeight * 4 ); index = index2; startindex = -1; };
		};
		
		pieceinfo =
		{
			movetime = 200;
			maxalphahilight = 0.3;
			minalphahilight = 0.1;
			timehilight = 400;
			hidewheninslot = false;
			image = "minigames/sudoku/tiles";
		};
		
		MinigameButtons();
		AddMinigameTutorial( 400, 300, "sudokututorial", "tutorial", -1 );
	};
};

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