---------------------------------------------------------------------------------------------------
--  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 buttonInventoryY = 63;
local kHudY = 453;

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

MakeDialog
{
	name = "gameplay";
	SetStyle( GameWindowStyle );
	
	Gameplay
	{
		x = 0;
		y = 0;
		w = 800;
		h = 600;
		completionbonus = 120000;
		scrim = false;
		fade = true;
		portraitdir = "portraits/";
		music = "";
		particlehinttodestination = "scripts/particles/hinttodestination.lua";
		particlehintshowdestination = "scripts/particles/hintshowdestination.lua";
		particlehintshowdestinationmini = "scripts/particles/hintshowdestinationmini.lua";
		hinttooltipwait = "hinttooltipwait";
		hinttooltipcharged = "hinttooltipcharged";
		hinttooltipnoitem = "hinttooltipnoitem";
		journaltooltip = "journaltooltip";
		progressbarleveltooltip = "progressbarleveltooltip";
		cursordefault = gs_cursorDefault;
		cursorrollover = gs_cursorHandOpen;
		cursorpickup = gs_cursorHandClosed;
		cursorinfo = gs_cursorMagnifyingGlass;
		cursorhint = gs_cursorMagicWand;
		cursorxcenter = 400;
		cursorycenter = 425;
		hinttooltipx = 274;
		hinttooltipy = 460;
		cracyclickamount = 3;
		crazyclicktime = 2000;
		crazyclickduration = 3000;
		crazyclickpath = "paths/fastclick.txt";
		crazyclick = gs_cursorDefaultTable;
		timeplaylistdialogfade = 250;
		volumeplaylistdialogfade = 0.6;
		hintpenalty = gs_hintPenalty;
		inventoryhoverpositionx = 550;
		inventoryhoverpositiony = 200;
		soundeffectsgroupid = gs_sfxIngameGroupID;
		
		minigamedialogs = {};		-- NOTE: This is read by Gameplay when it creates each Minigame.  It will be overwritten by each of the minigame's scripts.
		
		tutorials =
		{
			-- NOTE: Index 7 is reserved for Minigame Skip Tutorial.
			info =
			{
				dialog = "dialogs/tutorial";
				font = TutorialFont;
				arrowimage = "game_main/tutorial_arrow";
				arrowcenterx = 67;
				arrowcentery = 30;
				arrowdist = -75;
				arrowtime = 600;
				fadetime = 250;
				bounds =
				{
					x = 0;
					y = 0;
					w = 240;
					h = 193;
				};
			};
			
			tutorial00 =
			{
				index = 0;
				name = "tutorial_item";
				dialogx = 600;
				dialogy = 235;
				arrowx = 391;
				arrowy = 400;
				arrowrotation = 0;
			};
			
			tutorial01 =
			{
				index = 1;
				name = "tutorial_portal";
				dialogx = 600;
				dialogy = 235;
				arrowx = 240;
				arrowy = 150;
				arrowrotation = 0.5;
			};
			
			tutorial02 =
			{
				index = 2;
				name = "tutorial_inventory";
				dialogx = 400;
				dialogy = 235;
				arrowx = 50;
				arrowy = 50;
				arrowrotation = 0.35;
			};
			
			tutorial03 =
			{
				index = 3;
				name = "tutorial_itemonarea";
				dialogx = 600;
				dialogy = 300;
				arrowx = 50;
				arrowy = 50;
				arrowrotation = 0.875;
			};
			
			tutorial04 =
			{
				index = 4;	-- Used in Gameplay::ShowHint()
				name = "tutorial_hintjewel";
				dialogx = 400;
				dialogy = 235;
				arrowx = 50;
				arrowy = 50;
				arrowrotation = 0.125;
			};
			
			tutorial05 =
			{
				index = 5;	-- Used in Gameplay::ShowJournalDialog()
				name = "tutorial_journal";
				dialogx = 350;
				dialogy = 235;
				arrowx = 50;
				arrowy = 50;
				arrowrotation = 0.125;
			};
			
			tutorial06 =
			{
				index = 6;
				name = "tutorial_hintselect";
				dialogx = 600;
				dialogy = 235;
				arrowx = 290;
				arrowy = 530;
				arrowrotation = 0.25;
			};
		};
		
		cursors =
		{
			handclosed =
			{
				name = gs_cursorHandClosed;
				image = "cursor/handclosed";
				xcenter = 20;
				ycenter = 22;
				xoffset = 0;
				yoffset = 0;
			};
			
			handopen =
			{
				name = gs_cursorHandOpen;
				image = "cursor/handopen";
				xcenter = 20;
				ycenter = 22;
				xoffset = 0;
				yoffset = 0;
			};
			
			magnifyingglass =
			{
				name = gs_cursorMagnifyingGlass;
				image = "cursor/magnifying_glass";
				xcenter = 13;
				ycenter = 3;
				xoffset = 0;
				yoffset = 0;
			};
			
			magicwand =
			{
				name = gs_cursorMagicWand;
				image = "cursor/magic_wand";
				xcenter = 10;
				ycenter = 10;
				xoffset = 0;
				yoffset = 0;
			};
		};
		
		animatedcursorinfo =
		{
			timeanimation = 1250;
			startalpha = 1;
			endalpha = 0;
			model =
			{
				model='mesh/arrow.mesh';
				texture='mesh/arrowtexture';
				nearplane=0.100000;
				farplane=100.000000;
				fov=0.628318;
				aspect=0.000000;
				localmatrix={0,-0.590000,85.173687};
				rotation={0,-0,0};
				material=
				{
					diffuse={0.8549,0.8313,0.6705,1};
					ambient={0.3,0.3,0.3,0.3};
					specular={1.000000,1.000000,1.000000,1.000000};
					emit={0.000000,0.000000,0.000000,0.750000};
					reflectance=150;
				};
				light=
				{
					type=1;
					diffuse={1.000000,1.000000,1.000000,1.000000};
					specular={1.000000,1.000000,1.000000,1.000000};
					ambient={0.100000,0.100000,0.100000,1.000000};
					position={0.000000,10.000000,22.000000};
					direction={0.000000,0.000000,1.000000};
					range=100.000000;
					attenuation={0.100000,0.00000,0.000000};
					theta=3.140000;
					phi=3.140000;
					lightFollows=false;
				};
			};
		};
		
		dialogs = gs_characterDialogs;
		
		tooltip =
		{
			font = GameToolTipFont;
			backgroundcolor = gs_toolTipColor;
			w = 300;
			h = 300;
			minx = 0;
			miny = 0;
			maxx = 800;
			maxy = 600;
			position = kHAlignLeft + kVAlignTop;
			alphascrimmax = 0.83;
			borderwidth = 5;
			borderheight = 5;
			timeinitialwait = 500;
			timevisible = 2500;
			timefade = 200;
			imageabovetext = true;
			spritescale = 0.75;
		};
		
		inventorytooltip =
		{
			font = GameToolTipFont;
			backgroundcolor = gs_toolTipColor;
			textmask = GetString( "inventorytooltip" );
			w = 800;
			h = 100;
			x = 400;
			y = 460;
			itemdropshadowcolor = Color( 0, 0, 0, 128 );
			itemdropshadowoffsetx = 4;
			itemdropshadowoffsety = 4;
			borderwidth = 5;
			borderheight = 5;
			timeinitialwait = 500;
			timeintro = 500;
			timeoutro = 500;
			timevisible = 0;
			distancebetweenitems = 20;
			minimumwidth = 200;
			widthperline = 50;
			sound = gs_soundButtonMouseEnter;
		};
		
		hinttooltip =
		{
			font = GameToolTipFont;
			backgroundcolor = gs_toolTipColor;
			w = 500;
			h = 300;
			minx = 0;
			miny = 0;
			maxx = 800;
			maxy = 475;
			position = kHAlignCenter + kVAlignTop;
			alphascrimmax = 0.83;
			borderwidth = 5;
			borderheight = 5;
			timeinitialwait = 0;
			timevisible = 2500;
			timefade = 200;
		};
		
		audio =
		{
			hint = gs_soundHint;
		
			itemmiss = gs_soundItemMiss;
			itemappear = gs_soundItemAppear;
			itemhover = gs_soundItemHover;
			itemdrop = gs_soundItemDrop;
			areaclick = gs_soundInteractiveAreaClick;
			areahilight = gs_soundInteractiveAreaHilight;
			areacomplete = gs_soundInteractiveAreaSolved;
			crazyclick = gs_soundCrazyClick;
			journalclick = gs_soundJournalClick;
			
			itemclick =
			{
				name = "item_click";
				loop = false;
				initialdelay = 0;
				delay = 0;
				sounds = GetItemClickSounds( GetCurrentLocation( false ) );
			};
			
			hintclick =
			{
				name = "hint_click";
				loop = false;
				initialdelay = 0;
				delay = 0;
				sounds = GetHintClickSounds( GetCurrentLocation( false ) );
			};
		};
		
		playlistinfo =
		{
			timefadeout = 1000;
			timecrossfade = 3000;
			groupid =
			{
				gs_musicIngameMusicGroupID;
				gs_musicIngameAmbientGroupID;
			};
		};
		
		playlist = gs_locationPlaylist;

		modifiers =
		{
			scenetransition = 150;
			distancehinttoinventoryarc = 200;
			distancehinttoitemarc = 100;
			timehinttodestination = 750;
			timehintshowdestination = 1000;
			timehintminishow = 30000;
			timehinttutorialshow = 0;
			timecursorportalscale = 250;
			scalecursorportalmin = 0.6;
		};
		
		iteminfo =
		{
			particles = "scripts/particles/item.lua";
			particlesplash = "scripts/particles/itemfound.lua";
			imagemask = "mask";
			timefound = 400;
			rotatefound = 1;
			distancearc = 75;
			timevisible = 3500;
			timetoinventory = 500;
			timefadeaway = 200;
		};
		
		areainfo =
		{
			particlecomplete1 = "scripts/particles/areacomplete1.lua";
			particlecomplete2 = "scripts/particles/areacomplete2.lua";
			hilightparticles = "scripts/particles/areahilight.lua";
			imagemask = "mask";
			timehilightfade = 450;
			timehilightfadefast = 100;
			alphahilightmin = 0.5;
			timevisible = 2000;
			timecompletefade = 2000;
		};
		
		inventoryinfo = 
		{
			particles = "scripts/particles/inventory.lua";
			imagemask = "mask";
			timetouse = 1000;
			rotatetouse = -3;
			timeunequip = 250;
			timeequip = 100;
			scaleequip = 0.5;
			timevisible = 2000;
			timefadepart = 200;
			yoffset = 32;
			timetojournal = 750;
			scaletojournal = 1;
			timetomove = 200;
			silhouettealpha = 0.8;
			timerolloveroffset = 100;
			timerolloverglow = 500;
			offsetrolloverx = -5;
			offsetrollovery = -5;
			offsetrolloverstartx = -2;
			offsetrolloverstarty = -2;
			offsetalpha = 0.5;
			bary = 32;
			barwidth = 50;
			barfilly = 2;
			frameleft = "progressbar/frameleftcap";
			framecenter = "progressbar/framecenterbody";
			frameright = "progressbar/framerightcap";
			fillleft = "progressbar/fillleftcap";
			fillcenter = "progressbar/fillcenterbody";
			fillright = "progressbar/fillrightcap";
			filltime = 250;
			progressbaritemtooltip = "progressbaritemtooltip";
			progressbaralpha = 1;
			timehover = 1000;
			timetohoverposition = 500;
			distancehover = 30;
			particlejournal = "scripts/particles/inventorytojournal.lua";
			minwidth = 62;
			
			inventory_grampsjournal =
			{
				scaletojournal = 0.71;
			};
		};
		
		layerinfo =
		{
			fadetime = 2000;
		};
		
		sceneinfo =
		{
			showareadelay = 250;
			showareapredelay = 500;
			groupid = gs_sfxIngameGroupID;
		};

		GameplayHud
		{
			x = 0;
			y = kHudY;
			w = 800;
			h = 600 - kHudY;
			name = "hud";
			hintbackgroundtimepulse = 500;
			hintbackgroundalphapulse = 0.1;
			progressbarcollisionextension = 8;
			hintbackgroundfadetime = 250;
			inventorybounds = { x = 63; y = kHudY + 30; w = 440; h = 100; };
			inventoryminhorzgap = 20;
			inventoryvertplacement = 534;
			inventoryhidedelay = 100;
			background = {		x = 170;	y = 38;		image = "game_main/hud"; };
			foreground = {		x = 0;		y = 0;		image = "game_main/hud_overlay"; };
			progressbar = {		x = 574;	y = 29;		image = "game_main/completionbar"; };
			hintbackground = {	x = 14;		y = 21;		image = "game_main/hudhintmode"; };
			
			background =
			{
				image = "game_main/hud";
				x = 14;
				y = 21;
			};
			
			overlay =
			{
				image = "game_main/hud_overlay";
				x = 0;
				y = 0;
			};
			
			journal =
			{
				x = 713;
				y = kHudY + 84;
				image = "game_main/journal";
				timehilight = 500;
				timeactivate = 150;
				timeopen = 350;
				timeclose = 750;
				scaleopen = 4;
				maxalpha = 0.8;
				soundhover = gs_soundJournalHover;
				soundscaleup = gs_soundJournalScaleUp;
				soundscaledown = gs_soundJournalScaleDown;
			};
			
			hint =
			{	
				image = "game_main/hint";
				x = 636;
				y = kHudY + 81;
				timetocharge = 90000; --60000 + ( ( GetCurrentLocation( false ) - 1 ) * ( 60000 / 9 ) );
				timetodrain = 1500;
				timepulse = 500;
				timehilight = 500;
				timedecrease = 10000;
				timebonus = 750;
				alphaminpulse = 0.6;
				particlescript = "scripts/particles/hintbonus.lua";

				bounds =
				{
					x = 17;
					y = 23;
					w = 55;
					h = 55;
				};
				
				sourcerect =
				{
					x = 0;
					y = 18;
					w = 80;
					h = 46;
				};
			};
			
			SetStyle( ButtonHudPauseStyle );
		
			Button
			{
				x = 630;
				y = 122;
				name = "pause";
				text = "menu";
				
				command = 
					function()
						GameplayPause();
						value = DoModal( "scripts/pause.lua" );
						
						if( value == "mainmenu" ) then
							FadeOut( "SwapToModal( 'scripts/mainmenu.lua' );" );
						else
							GameplayResume();
						end
					end
			};
			
			SetStyle( ButtonHudLeftStyle );
			
			Button
			{
				x = 15;
				y = buttonInventoryY;
				name = "inventoryleft";
				
				command =
					function()
						HudLeftClick();
					end
			};
			
			SetStyle( ButtonHudRightStyle );
			
			Button
			{
				x = 510;
				y = buttonInventoryY;
				name = "inventoryright";
				
				command =
					function()
						HudRightClick();
					end
			};
		};
	};
};

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