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


location={}
location["gangster"] = true
location["gangster"] = {}
location["gangster"]["id"] = 7
location["gangster"]["sub_id"] = 0
location["tir"] = true
location["tir"] = {}
location["tir"]["id"] = 7
location["tir"]["sub_id"] = 1
location["billiard"] = true
location["billiard"] = {}
location["billiard"]["id"] = 7
location["billiard"]["sub_id"] = 2

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

function LevelComplete()   
	flags.levelcomplete=true;
	setcurentleaf("gangster",7,0);
		DeleteElement("gr",227);
		DeleteElement("gr",108);
		DeleteElement("gr",109);
		DeleteElement("gr",236);
		DeleteElement("gr",231);
		DeleteElement("gr",226);
		DeleteElement("gr",260);
	setcurentleaf("tir",7,1);	
		DeleteElement("gr",205);
		DeleteElement("gr",247);
		DeleteElement("gr",249);
		DeleteElement("gr",250);
		DeleteElement("gr",248);
		DeleteElement("gr",261);
	DarkScreen(true);
	ShowMenu(false);
end;

function StartLevel()
AddHints();
	setcurentleaf("gangster",7,0);
		AddParticleToObject(6,"ApOn",0,0);
		AddParticleToObject(55,"Black",0,0);
		AddParticleToObject(42,"Wkaf",0,0);
		AddParticleToObject(67,"BoxOn",0,0);	
		MoveEmiter("ApOn",55,451);
		MoveEmiter("Black",658,343);
		MoveEmiter("Wkaf",909,156);	
		MoveEmiter("BoxOn",232,604);	
		if not flags.handle then
			StartEmiter("ApOn");
		end;
		if flags.handle and not flags.minicomplete then
			AddParticleToObject(6,"Ap",139,559);
			StartEmiter("Ap");
			MoveEmiter("Ap",139,559);			
		end;
		if not flags.minicomplete2 then
			StartEmiter("Black");
			StartEmiter("Wkaf");
		end;
		if not flags.boxopen then
			StartEmiter("BoxOn");	
		end;
		if flags.boxopen and not flags.minicomplete3 then
			AddParticleToObject(33,"Box",246,624);
			StartEmiter("Box");
			MoveEmiter("Box",256,624);				
		end;
	setcurentleaf("tir",7,1);	
		AddParticleToObject(50,"Zamok",0,0);
		AddParticleToObject(4,"Handle",0,0);		
		MoveEmiter("Zamok",474,429);
		MoveEmiter("Handle",204,421);			
		if not flags.rolloff then
			StartEmiter("Zamok");
		end;
		if not flags.minicomplete4 then
			StartEmiter("Handle");	
		end;
		if flags.minicomplete4 and not flags.minicomplete5 then
			AddParticleToObject(69,"Tir",558,337);
			StartEmiter("Tir");
			MoveEmiter("Tir",600,277);	
		end;		
	setcurentleaf("billiard",7,2);
		AddParticleToObject(19,"Steam2",0,0);
		AddParticleToObject(38,"lamp1",0,0);
		AddParticleToObject(41,"lamp2",0,0);
		AddParticleToObject(42,"lamp3",0,0);
		StartEmiter("Steam2");			
		StartEmiter("lamp1");	
		StartEmiter("lamp2");	
		StartEmiter("lamp3");			
        if not flags.minicomplete6 then	
			AddParticleToObject(44,"Pool",0,0);
			StartEmiter("Pool");	
			MoveEmiter("Pool",535,282);
		end;	
end;


flags={};

flags["whole_darkness"]=false;
flags["loc1"]=false;
flags["loc2"]=false;
flags["loc3"]=false;
flags["firstloc2"]=true;
flags["firstloc3"]=true;
flags["lock"]=true;
flags["handle"]=false;
flags["handle1"]=false;
flags["whisky"]=false;
flags["boxopen"]=false;
flags["levelcomplete"]=false;
flags["rolletout"]=false;
flags["tickets"]=false;
flags["magazin"]=false;
flags["stvol"]=false;
flags["priklad"]=false;

flags["rolloff"]=false;
flags["handle1"]=false;

flags["minicomplete"]=false;
flags["minicomplete1"]=false;
flags["minicomplete2"]=false;
flags["minicomplete3"]=false;
flags["minicomplete4"]=false;
flags["minicomplete5"]=false;
flags["minicomplete6"]=false;

flags["minirun5"]=false;

flags["minitext1"]=false;
flags["minitext2"]=false;
flags["allobject1"]=false;
flags["allobject2"]=false;
flags["allobject3"]=false;

flags["passkey1"]=false;
flags["passkey2"]=false;
flags["forpasskey1"]=false;
flags["blank1"]=false;
flags["blank2"]=false;
flags["mould_in1"]=false;
flags["mould_in2"]=false;
flags["forpasskey2"]=false;

flags["gamecomplete"]=false;
flags["rollet"]=false;
flags["HintCount"]=5;
flags["readypasskey"]=false;
flags["comics"]=false

add_tree_leaf("Root","gangster",7,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");
ShowMenu(false);
loadresource("data\\photoaparat.png","photoaparat",112121212);
AddImgToBook("photoaparat",838,580);
AddHints()
dofile("./data/7/0/res.lua");


add_tree_leaf("Root","tir",7,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/7/1/res.lua");

add_tree_leaf("Root","billiard",7,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/7/2/res.lua");




setcurentleaf("gangster",7,0);
SwitchToSheet("re");

DarkScreen(true);
speciale_action(2,503,true);	
speciale_action(4,503)

playfile(".\\sound\\Music_1.ogg",true,true);