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


location={}
location["albert_house"] = true
location["albert_house"] = {}
location["albert_house"]["id"] = 17
location["albert_house"]["sub_id"] = 0
location["albert_kab"] = true
location["albert_kab"] = {}
location["albert_kab"]["id"] = 17
location["albert_kab"]["sub_id"] = 1
location["anna_room"] = true
location["anna_room"] = {}
location["anna_room"]["id"] = 17
location["anna_room"]["sub_id"] = 2


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

function LevelComplete()
	flags.levelcomplete=true;
	setcurentleaf("albert_house",17,0);
		DeleteElement("gr",160);
		DeleteElement("gr",113);
		DeleteElement("gr",57);
		DeleteElement("gr",58);
		DeleteElement("gr",59);
		DeleteElement("gr",112);
		DeleteElement("gr",172);
	setcurentleaf("albert_kab",17,1);	
		DeleteElement("gr",114);
		DeleteElement("gr",213);
		DeleteElement("gr",234);
		DeleteElement("gr",242);
	setcurentleaf("anna_room",17,2);	
		DeleteElement("gr",335);
		DeleteElement("gr",328);
	frame=-1;
	ShowMenu(false);
DarkScreen(true)
end;

function StartLevel()
	setcurentleaf("albert_house",17,0);	
		if not flags.minicomplete then
			AddParticleToObject(40,"Chess",0,0);
			StartEmiter("Chess");
			MoveEmiter("Chess",721,489);
		end;
		if not flags.minicomplete3 then		
			AddParticleToObject(69,"Plitka",0,0);
			StartEmiter("Plitka");
			MoveEmiter("Plitka",402,562)	
		end;
		if not flags.minicomplete2 then		
			AddParticleToObject(63,"Pict",0,0);
			StartEmiter("Pict");
			MoveEmiter("Pict",903,336)	
		end;	
		if not flags.minicomplete1 and flags.minicomplete2 then
			AddParticleToObject(56,"Flower",0,0);
			StartEmiter("Flower");
			MoveEmiter("Flower",124,295);			
		end;
		if not flags.wardrobe then
			AddParticleToObject(1,"Door",0,0);
			StartEmiter("Door");
			MoveEmiter("Door",660,345)			
		end;
		if flags.wardrobe and not flags.wardrobeopen then
			AddParticleToObject(1,"Door",0,0);
			StartEmiter("Door");
			MoveEmiter("Door",688,265)	
		end;
	setcurentleaf("albert_kab",17,1);
     	if not flags.minicomplete4 then
			AddParticleToObject(68,"Shelf",0,0);
			StartEmiter("Shelf");
			MoveEmiter("Shelf",715,345);
		end;
		if not flags.stepladder then
			AddParticleToObject(60,"SL",0,0);
			StartEmiter("SL");
			MoveEmiter("SL",780,495)	
		end;
        if not flags.minicomplete6 then		
			AddParticleToObject(61,"Map",0,0);
			StartEmiter("Map");
			MoveEmiter("Map",340,334)	
		end;	
		if  flags.minicomplete6 and not flags.will then
			AddParticleToObject(2,"Block",0,0);
			StartEmiter("Block");
			MoveEmiter("Block",384,162);			
		end;
		if flags.minicomplete4 and  not flags.minicomplete5 then
			AddParticleToObject(41,"Safe",0,0);
			StartEmiter("Safe");
			MoveEmiter("Safe",237,490)	
		end;
		if not flags.minicomplete7 then		
			AddParticleToObject(16,"Kanc",0,0);
			StartEmiter("Kanc");
			MoveEmiter("Kanc",340,496)	
		end;	
	setcurentleaf("anna_room",17,2);	
		if not flags.minicomplete8 then
			AddParticleToObject(42,"Mirror",0,0);
			StartEmiter("Mirror");
			MoveEmiter("Mirror",903,405);	
		end;
		if not flags.pianoopen then
			AddParticleToObject(40,"ForKey",0,0);
			StartEmiter("ForKey");
			MoveEmiter("ForKey",162,510)	
		end;
		if flags.pianoopen and not flags.minicomplete9 then
			AddParticleToObject(41,"Piano",0,0);
			StartEmiter("Piano");
			MoveEmiter("Piano",127,558)			
		end;
		if flags.minicomplete9 and not flags.mirror then
			AddParticleToObject(39,"Diary",0,0);
			StartEmiter("Diary");
			MoveEmiter("Diary",111,504)				
		end;
end;

frame=0;

flags={};
flags["whole_darkness"]=false;
flags["loc1"]=false;
flags["loc2"]=false;
flags["loc3"]=false;
flags["firstloc2"]=true;
flags["firstloc3"]=true;
flags["allobject1"]=false;
flags["allobject2"]=false;
flags["allobject3"]=false;
flags["levelcomplete"]=false;

flags["cloth1"]=false;
flags["cloth2"]=false;
flags["cloth3"]=false;

flags["curtout"]=false;
flags["boxout"]=false;
flags["mapout"]=false;
flags["diaryout"]=false;
flags["stepladder"]=false;
flags["pianoopen"]=false;
flags["wardrobe"]=false;
flags["wardrobeopen"]=false;
flags["will"]=false;
flags["wheel"]=false;
flags["mirror"]=false;
flags["forwill"]=false;
flags["pianoopen"]=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["minicomplete8"]=false;
flags["minicomplete9"]=false;
flags["minicomplete10"]=false;

flags["minirun5"]=false;
flags["minirun9"]=false;
flags["minitext"]=false;
flags["skip"]=false;
flags["HintCount"]=5;
flags["comics"]=false

add_tree_leaf("Root","albert_house",17,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/17/0/res.lua");

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

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

setcurentleaf("albert_house",17,0);
DarkScreen(true);
SwitchToSheet("re");
speciale_action(2,503,true);
speciale_action(4,503);

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