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


location={}
location["arend_room"] = true
location["arend_room"] = {}
location["arend_room"]["id"] = 19
location["arend_room"]["sub_id"] = 0
location["wash_room"] = true
location["wash_room"] = {}
location["wash_room"]["id"] = 19
location["wash_room"]["sub_id"] = 1


function LoadingLevel(param)
    SetAlfaValue(501,0)
	SetAlfaValue(503,0)
	SLevel=param;
return;end;
function LevelComplete()
	flags.levelcomplete=true;
	setcurentleaf("arend_room",19,0);
		DeleteElement("gr",233);
	setcurentleaf("wash_room",19,1);	
		DeleteElement("gr",115);
		DeleteElement("gr",302);
		DeleteElement("gr",325);
	DarkScreen(true);
	ShowMenu(false);
end;
function StartLevel()
	AddHints();
    setcurentleaf("arend_room",19,0);
		if not flags.board1 then
			AddParticleToObject(43,"Plank1",0,0);
			StartEmiter("Plank1");
			MoveEmiter("Plank1",925,126);	
		end;
		if not flags.board2 then
			AddParticleToObject(42,"Plank2",0,0);
			StartEmiter("Plank2");
			MoveEmiter("Plank2",923,334);
		end;
		if not flags.board3 then
			AddParticleToObject(41,"Plank3",0,0);
			StartEmiter("Plank3");
			MoveEmiter("Plank3",924,492);
		end;		
		if not flags.minicomplete then
		    SetAlfaValue(160,0.0001)
			AddParticleToObject(16,"Env",0,0);
			StartEmiter("Env");
			MoveEmiter("Env",639,423)	
		end;
		if not flags.wardrobe then
			AddParticleToObject(46,"Wkaf1",0,0);
			StartEmiter("Wkaf1");
			MoveEmiter("Wkaf1",870,130)	
		end;
		if flags.wardrobe and not flags.minicomplete1 then
			AddParticleToObject(44,"Wkaf",879,503);
			StartEmiter("Wkaf");
			MoveEmiter("Wkaf",879,503)			
		end;
	setcurentleaf("wash_room",19,1);	
	AddParticleToObject(60,"Bath1",0,0);
	StartEmiter("Bath1");
	MoveEmiter("Bath1",211,378);		
    	if not flags.minicomplete2 then
			AddParticleToObject(160,"Bath",0,0);
			StartEmiter("Bath");
			MoveEmiter("Bath",241,396);	
		end;
		if not flags.isopen then	
			AddParticleToObject(39,"Bak",0,0);
			StartEmiter("Bak");
			MoveEmiter("Bak",48,331);
		end;
		if flags.isopen and not flags.bottle then
			AddParticleToObject(1,"OpenBak",0,0);
			StartEmiter("OpenBak");
			MoveEmiter("OpenBak",40,354)		
		end;
		if not flags.box then
			AddParticleToObject(35,"Box",0,0);
			StartEmiter("Box");
			MoveEmiter("Box",903,109);	
		end;	
end;


flags={};
flags["whole_darkness"]=false;
flags["minicomplete"]=false;
flags["minicomplete1"]=false;
flags["minicomplete2"]=false;
flags["comics"]=false
flags["minipart"]=false;

flags["all"]=false;
flags["box"]=false;
flags["handle"]=false;
flags["loc1"]=false;
flags["loc2"]=false;
flags["allobject1"]=false;
flags["loc2"]=false;
flags["firstloc2"]=true;
flags["allobject2"]=false
flags["part"]=1

flags["isopen"]=false;
flags["bottle"]=false;

flags["board1"]=false;
flags["board2"]=false;
flags["board3"]=false;
flags["wardrobe"]=false;

flags["minitext1"]=false;
flags["minitext2"]=false;

flags["levelcomplete"]=false;
flags["HintCount"]=5;


add_tree_leaf("Root","arend_room",19,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()
ShowMenu(false);


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

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

setcurentleaf("arend_room",19,0);
-- setcurentleaf("wash_room",19,1);
SwitchToSheet("re");
DarkScreen(true);
speciale_action(2,503,true);
speciale_action(4,503)

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