---------------------------------------------------------------------------------------------------
--  Copyright © 2008 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 currentLocation = "0" .. GetCurrentLocation();

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

function SetPieces()
	t = { BeginGroup() );
	
	if( currentLocation == "01" )
		table.insert( t, piece00 = { x = 0; y = 0; index = 0; } );
	elseif( currentLocation == "02" )
		table.insert( t, piece00 = { x = 0; y = 0; index = 0; } );
	elseif( currentLocation == "03" )
		table.insert( t, piece00 = { x = 0; y = 0; index = 0; } );
	elseif( currentLocation == "04" )
		table.insert( t, piece00 = { x = 0; y = 0; index = 0; } );
	elseif( currentLocation == "05" )
		table.insert( t, piece00 = { x = 0; y = 0; index = 0; } );
	end
	
	return Group( t );
end

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

function SetSlots()
	t = { BeginGroup() );
	
	if( currentLocation == "01" )
		table.insert( t, slot00 = { x = 0; y = 0; index = { 0; }; startindex = 01; } );
	elseif( currentLocation == "02" )
		table.insert( t, slot00 = { x = 0; y = 0; index = { 0; }; startindex = 01; } );
	elseif( currentLocation == "03" )
		table.insert( t, slot00 = { x = 0; y = 0; index = { 0; }; startindex = 01; } );
	elseif( currentLocation == "04" )
		table.insert( t, slot00 = { x = 0; y = 0; index = { 0; }; startindex = 01; } );
	elseif( currentLocation == "05" )
		table.insert( t, slot00 = { x = 0; y = 0; index = { 0; }; startindex = 01; } );
	end
	
	return Group( t );
end

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

MakeDialog
{
	SetStyle( MinigameStyle );
	
	MinigameJigsaw
	{
		name = "journaljigsaw";
		lockcorrectpieces = true;
		lockinitialpieces = true;
		returnpieceonmiss = false;
		timetoholdpiece = 350;
		
		dialogs =
		{
			dialog_help =
			{
				name = "dialog_help";
				image = "amelie_minigame";
				sound = "audio/voice_overs/location" .. currentLocation .. "_minigame01.ogg";
				text = "location" .. currentLocation .. "_minigame01";
			};
			
			dialog_oncomplete =
			{
				name = "dialog_oncomplete";
				image = "amelie_minigame";
				sound = "audio/voice_overs/location" .. currentLocation .. "_minigame02.ogg";
				text = "location" .. currentLocation .. "_minigame02";
			};
		};
		
		windowsprite =
		{
			sprite = "minigames/journaljigsaw" .. currentLocation .. "/background";
			xcenter = 400;
			ycenter = 300;
		};
		
		playfield =
		{
			x = 400;
			y = 100;
			w = 300;
			h = 400;
		};
		
		pieces = SetPieces();
		slots = SetSlots();
		
		pieceinfo =
		{
			movetime = 200;
			image = "minigames/journaljigsaw" .. currentLocation .. "/pieces";
			hidewheninslot = false;
		};
		
		slotinfo =
		{
			validdistance = 30;
			rejectincorrectpieces = true;
		};
	};
};

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