--============================================================================
--  map.lua
--  Copyright (c) 2009, Bamtang Games. All Rights Reserved.
------------------------------------------------------------------------------
require( "scripts/style.lua" );

SetState(kPause, true);

graphBmpRoom1 = gLocalizedPath.."images/map/room1Btn0";
graphBmpRoom2 = gLocalizedPath.."images/map/room2Btn0";
graphBmpRoom3 = gLocalizedPath.."images/map/room3Btn0";

graphRoom1 = Room1ButtonGraphics;
graphRoom2 = Room2ButtonGraphics;
graphRoom3 = Room3ButtonGraphics;

if gMapLevel == 1 then
	graphBmpRoom1 = "";
	graphBmpRoom2 = "";
	graphBmpRoom3 = "";
	
	graphRoom1 = LivingButtonGraphics;
	graphRoom2 = KitchenButtonGraphics;
	graphRoom3 = BedButtonGraphics;
end
if gMapLevel == 2 then
	graphBmpRoom1 = "";
	graphBmpRoom2 = "";
	graphBmpRoom3 = "";
	
	graphRoom1 = Living2ButtonGraphics;
	graphRoom2 = DinningButtonGraphics;
	graphRoom3 = Bed2ButtonGraphics;
end
if gMapLevel == 3 then
	graphBmpRoom1 = "";
	graphBmpRoom2 = "";
	graphBmpRoom3 = "";
	
	graphRoom1 = PavillonButtonGraphics;
	graphRoom2 = GrandButtonGraphics;
	graphRoom3 = ParkingButtonGraphics;
end
if gMapLevel == 4 then
	graphBmpRoom1 = "";
	graphBmpRoom2 = "";
	graphBmpRoom3 = "";
	
	graphRoom1 = LandButtonGraphics;
	graphRoom2 = CovertisoButtonGraphics;
	graphRoom3 = MotorButtonGraphics;
end
if gMapLevel == 5 then
	graphBmpRoom1 = "";
	graphBmpRoom2 = "";
	graphBmpRoom3 = "";
	
	graphRoom1 = CamaroteButtonGraphics;
	graphRoom2 = CubiertaButtonGraphics;
	graphRoom3 = ShipButtonGraphics;
end
if gMapLevel == 6 then
	graphBmpRoom1 = "";
	graphBmpRoom2 = "";
	graphBmpRoom3 = "";
	
	graphRoom1 = HangarButtonGraphics;
	graphRoom2 = PistaButtonGraphics;
	graphRoom3 = CabineButtonGraphics;
end
if gMapLevel == 7 then
	graphBmpRoom1 = "";
	graphBmpRoom2 = "";
	graphBmpRoom3 = "";
	
	graphRoom1 = BeachButtonGraphics;
	graphRoom2 = ForestButtonGraphics;
	graphRoom3 = CampButtonGraphics;
end

if gMapLevel == 8 then
	graphBmpRoom1 = "";
	graphBmpRoom2 = "";
	graphBmpRoom3 = "";
	
	graphRoom1 = AirsterButtonGraphics;
	graphRoom2 = RedplaneButtonGraphics;
	graphRoom3 = EntranceButtonGraphics;
end


function roomButtonPressed(sceneId)
    PopModal("themap");
    SetState(kPause, false);
    changeLevelScene(sceneId);
end


MakeDialog
{
	-- Name the modal dialog
	name = "themap",
	Bitmap
	{
		name = "backgroundimage",
		image = "images/gui/differences/ae_gui_differences_background",

		MapWindow {
			x = 0,
			y = 0,
			w = 800, 
			h = 600,

			level = gMapLevel;
			locked1 = gLocked1;
			locked2 = gLocked2;
			locked3 = gLocked3;
			done1 = gRoomComplete1;
			done2 = gRoomComplete2;
			done3 = gRoomComplete3;
			complete1 = gRoomAllPuzzlesComplete1;
			complete2 = gRoomAllPuzzlesComplete2;
			complete3 = gRoomAllPuzzlesComplete3;
			currentScene = gScene;
			
			SetStyle(ButtonStyle),
			Bitmap {
			   name = "bmpRoom1",
			   image = graphBmpRoom1;
			   x = 100,
			   y = 100,
			},
			Button {
				x = 100,
				y = 100,
				name = "btnRoom1",
				graphics = graphRoom1,
				command =
					function()
                        roomButtonPressed(0);
					end
			},
			Bitmap {
			   name = "bmpRoom2",
			   image = graphBmpRoom2;
			   x = 300,
			   y = 100,
			},
			Button {
				x = 300,
				y = 100,
				name = "btnRoom2",	
				graphics = graphRoom2,
				command =
					function()
                        roomButtonPressed(1);
					end
			},
			Bitmap {
			   name = "bmpRoom3",
			   image = graphBmpRoom3;
			   x = 500,
			   y = 100,
			},
			Button {
				x = 500,
				y = 100,
				name = "btnRoom3",
				graphics = graphRoom3,
				command =
					function()
                        roomButtonPressed(2);
					end
			},
			
			Button {
				x = 601,
				y = 545,
				name = "btnPause",
				graphics = MenuButtonGraphics,
				cancel = true,
				command =
					function()
						DoModal("scripts/pause.lua");
					end
			},
			Button {
				x = 10,
				y = 545,
				name = "btnSkip",
				graphics = BackButtonGraphics,
				command =
					function()
						PopModal("themap");
                        SetState(kPause, false);
					end
			},
		},
			
		Text {
			name = "txtCoordinatesTitle",
			label = "#MAP";
			font = StandardButtonFont,
			x = 300, y = 525,
			w = 200, h = 30,
			flags = kHAlignCenter,
		},
	},
}
