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

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

location={}
location["grim"] = true
location["grim"] = {}
location["grim"]["id"] = 1
location["grim"]["sub_id"] = 0
location["kulisi"] = true
location["kulisi"] = {}
location["kulisi"]["id"] = 1
location["kulisi"]["sub_id"] = 1


function LevelComplete()
	flags.levelcomplete=true;
	setcurentleaf("kulisi",1,1);
	DeleteElement("gr",221);
	DeleteElement("gr",216);
	DeleteElement("gr",245);
	DeleteElement("gr",151);
	DeleteElement("gr",115);

	DarkScreen(true)
	ShowMenu(false);
end;

function StartLevel()

	setcurentleaf("kulisi",1,1);	
		Set_Cursor(67,1);
		AddParticleToObject(30,"Svet3",815,583);
		AddParticleToObject(7,"Svet4",173,604);
		AddParticleToObject(33,"Svet5",596,583);
		AddParticleToObject(100,"Svet6",596,583);
		AddParticleToObject(70,"Svet7",299,330);
		MoveEmiter("Svet3",815,503);
		MoveEmiter("Svet4",173,554);
		MoveEmiter("Svet5",212,356);
		MoveEmiter("Svet6",45,543);	
		MoveEmiter("Svet7",299,330);	
		if not flags.minicomplete3 then
--			Set_Cursor(30,2);
			StartEmiter("Svet3");
		end;
		if not flags.minicomplete4 then
--			Set_Cursor(7,2);
		   StartEmiter("Svet4");
		end;
		if not flags.hat then
--			Set_Cursor(33,4);
			StartEmiter("Svet5");
		end;
		if not flags.oillamp then
			StartEmiter("Svet6");
			Set_Cursor(100,4);
		end;
		if not flags.curtain then
			StartEmiter("Svet7");
			Set_Cursor(70,3);
		end;	
		if flags.curtain then
		   MoveObjectY(34,-700,-700,0.0001);
		end;		
	setcurentleaf("grim",1,0);	
		Set_Cursor(87,1);
		AddParticleToObject(6,"Svet1",122,450);
		AddParticleToObject(62,"Svet",215,590);
		AddParticleToObject(14,"Svet2",380,250);		
		MoveEmiter("Svet1",122,450);
		MoveEmiter("Svet",215,590);
		MoveEmiter("Svet2",380,250);
		if not flags.minicomplete then	
			StartEmiter("Svet");
	--		Set_Cursor(62,2);
		end;
		if not flags.minicomplete2 then
	--		Set_Cursor(6,2);
			StartEmiter("Svet1");
		end;
		if not flags.minicomplete1 then
			StartEmiter("Svet2");
	--		Set_Cursor(14,2);
		end;

		AddParticleToObject(8,"stakan",215,590);
		StartEmiter("stakan");
		MoveEmiter("stakan",705,529);
		AddParticleToObject(70,"pil",0,0,0,0);
end;


frame=-1;
flags={};
flags["whole_darkness"]=false;
flags["firstrun"]=true;
flags["loc1"]=false;
flags["firstloc1"]=true;
flags["loc2"]=false;
flags["curtain"]=false;
flags["fourkilo"]=false;
flags["sevenkilo"]=false;
flags["die"]=false;
flags["minicomplete"]=false;
flags["minirun"]=false;
flags["minicomplete1"]=false;
flags["mini1run"]=false;
flags["minicomplete2"]=false;
flags["mini2run"]=false;
flags["minicomplete3"]=false;
flags["mini3run"]=false;
flags["minicomplete4"]=false;
flags["mini4run"]=false;
flags["levelcomplete"]=false;
flags["brush"]=false;
flags["pict"]=false;
flags["glass"]=false;
flags["oillamp"]=false;
flags["skip"]=false;
flags["minitext1"]=false;
flags["minitext2"]=false;
flags["minitext3"]=false;
flags["hat"]=false;
flags["allobject1"]=false;
flags["allobject2"]=false;
flags["HintCount"]=5;
flags["comics"]=false

add_tree_leaf("Root","grim",1,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/1/0/res.lua");
	add_tree_leaf("Root","kulisi",1,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);
		--AddSheet(1003,"bl","blue_b",460,607,222,43,"blue",0,650,800,115,15,10,15,10);	
	SetCurrentRM("main");
dofile("./data/1/1/res.lua");

setcurentleaf("grim",1,0);	
SwitchToSheet("re");
DarkScreen(true);
speciale_action(2,503,true);
speciale_action(4,503);	