dofile("script\\gamemenu.lua");
dofile("script\\lib.lua");
set_inpun_fun("gameinput");


location={}
location["kab_direktor"] = true
location["kab_direktor"] = {}
location["kab_direktor"]["id"] = 3
location["kab_direktor"]["sub_id"] = 0
location["azart_room"] = true
location["azart_room"] = {}
location["azart_room"]["id"] = 3
location["azart_room"]["sub_id"] = 1
location["private_room"] = true
location["private_room"] = {}
location["private_room"]["id"] = 3
location["private_room"]["sub_id"] = 2
location["grimerka"] = true
location["grimerka"] = {}
location["grimerka"]["id"] = 3
location["grimerka"]["sub_id"] = 3
location["kulisi"] = true
location["kulisi"] = {}
location["kulisi"]["id"] = 3
location["kulisi"]["sub_id"] = 4


function LoadingLevel(param)
    SetAlfaValue(501,0)
	SetAlfaValue(503,0)
	SLevel=param;
return;end;

function LevelComplete()
	flags.levelcomplete=true;
	setcurentleaf("kab_direktor",3,0);
		DeleteElement("gr",100);
		DeleteElement("gr",110);
		DeleteElement("gr",111);
		DeleteElement("gr",112);
		DeleteElement("gr",113);
		DeleteElement("gr",102);
	setcurentleaf("azart_room",3,1);
		DeleteElement("gr",201);
		DeleteElement("gr",123);
		DeleteElement("gr",103);
	setcurentleaf("private_room",3,2);
		DeleteElement("gr",318);
		DeleteElement("gr",301);
		DeleteElement("gr",331);
		DeleteElement("gr",334);
	setcurentleaf("grimerka",3,3);	
		DeleteElement("gr",104);
	setcurentleaf("kulisi",3,4);	
		DeleteElement("gr",257);		
		DeleteElement("gr",191);	
	if g_sublevel==0 then
	   Set_Cursor(58,3);
	   Set_Cursor(49,3);
	   Set_Cursor(51,3);
	end;
	if g_sublevel==1 then
		Set_Cursor(46,3);
		Set_Cursor(50,3);
	end;
	if g_sublevel==2 then
		Set_Cursor(50,3);
		Set_Cursor(66,3);
		Set_Cursor(67,3);
	end;
	if g_sublevel==3 then
		Set_Cursor(90,3);
		Set_Cursor(87,3);
	end;
	if g_sublevel==4 then
		Set_Cursor(66,3);
		Set_Cursor(67,3);
	end;	
	DarkScreen(true);
	ShowMenu(false);
end;

function StartLevel()
	setcurentleaf("kab_direktor",3,0);	
		AddParticleToObject(4,"can",0,0);
		StartEmiter("can");
		AddParticleToObject(49,"Letter1",0,0);
		MoveEmiter("Letter1",390,230);			   
		AddParticleToObject(58,"Table",0,0);
		MoveEmiter("Table",587,403);	
		AddParticleToObject(45,"Letter",0,0);		
		MoveEmiter("Letter",380,311);
		if not flags.box then
			StartEmiter("Letter1");	
		end;
		if not flags.minicomplete then
			StartEmiter("Table");
		end;
		if not flags.minicomplete1 then
			StartEmiter("Letter");
		end;
	setcurentleaf("azart_room",3,1);	
		AddParticleToObject(43,"room",0,0);
		StartEmiter("room");
		if not flags.minicomplete3 then
			AddParticleToObject(46,"TableD",0,0);
			StartEmiter("TableD");
			MoveEmiter("TableD",415,587);
		end;	
		if not flags.minicomplete2 then
			AddParticleToObject(48,"Door",0,0);
			StartEmiter("Door");
			MoveEmiter("Door",974,362);		
		end;
		if 	flags.minicomplete2 and flags.light then
			Set_Cursor(33,4);
			AddParticleToObject(33,"Schit1",0,0);
			StartEmiter("Schit1");
			MoveEmiter("Schit1",898,102);	
		end;
		if 	not flags.minicomplete7 and flags.chair then
			Set_Cursor(32,2);
			AddParticleToObject(32,"Schit",883,146);
			StartEmiter("Schit");
			MoveEmiter("Schit",883,156);		
		end;	
	setcurentleaf("private_room",3,2);
		if not flags.light then
			AddParticleToObject(50,"LampOn",429,156);
			StartEmiter("LampOn");
			MoveEmiter("LampOn",432,200);
		end;
		if flags.firstloc5 then
			AddParticleToObject(167,"DoorOn",868,133);
			StartEmiter("DoorOn");
			MoveEmiter("DoorOn",868,133);	
		end;		
		if flags.minicomplete7 then
			Set_Cursor(33,4);
			Set_Cursor(71,4);
			Set_Cursor(47,4);
			if not flags.steppler then
				AddParticleToObject(47,"DictOn",0,0);
				StartEmiter("DictOn");
				MoveEmiter("DictOn",386,401);
			end;
			if flags.steppler and not flags.minicomplete6  then		
				AddParticleToObject(47,"Dict",429,156);
				StartEmiter("Dict");
				MoveEmiter("Dict",365,428);		
			end;
			if not flags.tumbon then
				AddParticleToObject(71,"TumbOn",0,0);
				StartEmiter("TumbOn");
				MoveEmiter("TumbOn",925,525);	
			end;
			if flags.tumbon and not flags.minicomplete4 then
				AddParticleToObject(40,"Tumb",870,552);
				StartEmiter("Tumb");
				MoveEmiter("Tumb",870,552);					
			end;
			if not flags.paton then
				AddParticleToObject(33,"PatOn",0,0);
				StartEmiter("PatOn");
				MoveEmiter("PatOn",915,471);
			end;			
			if flags.paton and not flags.minicomplete5 then
				AddParticleToObject(37,"Pat",0,0);
				StartEmiter("Pat");
				MoveEmiter("Pat",930,441);				
			end;
		end;
	setcurentleaf("grimerka",3,3);	
		if not flags.lamp then
			AddParticleToObject(90,"Mirror",0,0);
			StartEmiter("Mirror");
			MoveEmiter("Mirror",295,155);			
		end;
end;

flags={};

flags["s_StartLevel"]=false;
flags["keys"]=false;
flags["loc1"]=false;
flags["loc2"]=false;
flags["firstloc2"]=true;
flags["loc3"]=false;
flags["firstloc3"]=true;
flags["loc4"]=false;
flags["firstloc4"]=true;
flags["loc5"]=false;
flags["firstloc5"]=true;
flags["igla"]=false;
flags["plate"]=false;
flags["platein"]=false;
flags["ruchka"]=false;
flags["page"]=false;
flags["steppler"]=false;
flags["light"]=false;
flags["darkness"]=true;
flags["chair"]=false;
flags["lamp"]=false;
flags["lamp_in"]=false;
flags["box"]=false;
flags["elektropen"]=false
flags["foto1"]=false;
flags["foto2"]=false;
flags["foto3"]=false;
flags["foto4"]=false;
flags["foto5"]=false;
flags["rotate"]=false;
flags["slot1"]=false;
flags["slot2"]=false;
flags["slot3"]=false;
flags["slot4"]=false;
flags["tumbon"]=false;
flags["paton"]=false;
flags["minicomplete"]=false;
flags["minicomplete1"]=false;
flags["minicomplete2"]=false;
flags["minicomplete3"]=false;
flags["minicomplete4"]=false;
flags["minicomplete5"]=false;
flags["minicomplete6"]=false;
flags["minicomplete7"]=false;

flags["levelcomplete"]=false;

flags["minirun3"]=false;
flags["mini4run"]=false;
flags["minirun6"]=false;
flags["allobject1"]=false;
flags["allobject2"]=false;
flags["allobject3"]=false;
flags["allobject4"]=false;
flags["allobject5"]=false;
flags["whole_darkness"]=false;
flags["object2"]=false;
flags["dies"]=false;
flags["HintCount"]=5;
flags["comics"]=false
--flags["g_sublevel"]=0;

add_tree_leaf("Root","kab_direktor",3,0);
SetCurrentRM("menu");
        addstaticobjecttogame(877777777,"menubuttons",63,622,"",60,0,61,61);
		AddSheet(1002,"re","red_b",63,622,61,61,"",128,640,650,115,15,5,7,7,0,59,877777777);
SetCurrentRM("main");
loadresource("data\\photoaparat.png","photoaparat",112121212);
AddImgToBook("photoaparat",838,580);
AddHints()

	
dofile("./data/3/0/res.lua");

add_tree_leaf("Root","azart_room",3,1);
	
SetCurrentRM("menu");
addstaticobjecttogame(877777777,"menubuttons",63,622,"",60,0,61,61);
AddSheet(1002,"re","red_b",63,622,61,61,"",128,640,650,115,15,5,7,7,0,59,877777777);
SetCurrentRM("main");
dofile("./data/3/1/res.lua");

add_tree_leaf("Root","private_room",3,2);


SetCurrentRM("menu");		
addstaticobjecttogame(877777777,"menubuttons",63,622,"",60,0,61,61);		
AddSheet(1002,"re","red_b",63,622,61,61,"",128,640,650,115,15,5,7,7,0,59,877777777);
SetCurrentRM("main");
dofile("./data/3/2/res.lua");

add_tree_leaf("Root","kulisi",3,4);

SetCurrentRM("menu");
addstaticobjecttogame(877777777,"menubuttons",63,622,"",60,0,61,61);
AddSheet(1002,"re","red_b",63,622,61,61,"",128,640,650,115,15,5,7,7,0,59,877777777);
SetCurrentRM("main");
dofile("./data/3/4/res.lua");

add_tree_leaf("Root","grimerka",3,3);
SetCurrentRM("menu");
	addstaticobjecttogame(877777777,"menubuttons",63,622,"",60,0,61,61);
AddSheet(1002,"re","red_b",63,622,61,61,"",128,640,650,115,15,5,7,7,0,59,877777777);
SetCurrentRM("main");
dofile("./data/3/3/res.lua");


setcurentleaf("kab_direktor",3,0);
-- setcurentleaf("azart_room",3,1);
SwitchToSheet("re");
ShowMenu(false);
DarkScreen(true);
speciale_action(2,503,true);	
speciale_action(4,503)
playfile(".\\sound\\Music_1.ogg",true,true);