dofile("script\\gamemenu.lua");
dofile("script\\lib.lua");
set_inpun_fun("gameinput");
location={}
location["barton_vhod"] = true
location["barton_vhod"] = {}
location["barton_vhod"]["id"] = 15
location["barton_vhod"]["sub_id"] = 0
location["barton_zal"] = true
location["barton_zal"] = {}
location["barton_zal"]["id"] = 15
location["barton_zal"]["sub_id"] = 1
location["oranjereya"] = true
location["oranjereya"] = {}
location["oranjereya"]["id"] = 15
location["oranjereya"]["sub_id"] = 2
function LevelComplete()
  if not flags.card then
     flags.card =true
    setcurentleaf("barton_zal",15,1);
    AddElement("gr",109);
    MoveObjectToTree(109);
    flags.card=true;
  end;  
  if not flags.impression then
      flags.impression=true
    setcurentleaf("oranjereya",15,2);
    AddElement("gr",123);
    MoveObjectToTree(123);
    flags.impression=true;
  end;  
  if not flags.letter then
      setcurentleaf("barton_zal",15,1);
    flags.letter=true;
  end;  
  DeleteElement("gr",119);
  flags.levelcomplete=true;
    whole_darkness=false;
  DarkScreen(true);
  ShowMenu(false)
end;
function LoadingLevel(param)
if flags.levelcomplete then
  delete_tree_leaf("Root","barton_vhod");-- Добавляет лист в дерево 
  delete_tree_leaf("Root","barton_zal");-- Добавляет лист в дерево 
  delete_tree_leaf("Root","oranjereya");-- Добавляет лист в дерево 
  setnextlavel(16);
  loadlavel();
return; end;
SetAlfaValue(503,0);
     SLevel=param;
return;end;
function LoadNextLevel()
  delete_tree_leaf("Root","barton_vhod");-- Добавляет лист в дерево 
  delete_tree_leaf("Root","barton_zal");-- Добавляет лист в дерево 
  delete_tree_leaf("Root","oranjereya");-- Добавляет лист в дерево 
  setnextlavel(16);
  loadlavel();  
end;

flags={};
flags["comx"]=false;
flags["comx1"]=false;
flags["HintCount"]=5;
flags["proideno"]=false;
flags["loc1"] = false;
flags["loc2"] = false;
flags["loc3"] = false;
flags["minicomplete"]=false;
flags["minicomplete1"]=false;
flags["minicomplete2"]=false;
flags["minicomplete3"]=false;
flags["cat"]=true;
flags["enter"]=false;
flags["firstloc2"]=false;
flags["firstloc3"]=false;
flags["card"]=false;
flags["letter"]=false;
flags["impression"]=false;
flags["levelcomplete"]= false;
flags["first"]= false;
flags["first1"]= false;
flags["nohints"]=false;
flags["vowli"]=false;
skip= false;

add_tree_leaf("Root","barton_vhod",15,0);
  addstaticobjecttogame(877777777,"buttons",114,625,"",60,0,61,61);
  SetCurrentRM("menu");
  AddSheet(1002,"re","red_b",103,656,37,41,"",99,657,650,80,92,21,5,5,0,59,877777777,nil,"buttonsY");
  SetCurrentRM("main");
  ShowMenu(true);
loadresource("data\\photoaparat.png","photoaparat",2000029);
loadresource("data\\animationMENU3.png","menuAn",2000030);
AddImgToBook("photoaparat",821,637);
AddHints()
dofile("./data/15/0/res.lua");
 UpdateStack();
add_tree_leaf("Root","barton_zal",15,1);-- Добавляет лист в дерево 
  addstaticobjecttogame(877777777,"buttons",114,625,"",60,0,61,61);
  SetCurrentRM("menu");
  AddSheet(1002,"re","red_b",103,656,37,41,"",99,657,650,80,92,21,5,5,0,59,877777777,1,"buttonsY");
SetCurrentRM("main");
dofile("./data/15/1/res.lua");
 UpdateStack();
add_tree_leaf("Root","oranjereya",15,2);
  addstaticobjecttogame(877777777,"buttons",114,625,"",60,0,61,61);
  SetCurrentRM("menu");
  AddSheet(1002,"re","red_b",103,656,37,41,"",99,657,650,80,92,21,5,5,0,59,877777777,nil,"buttonsY");
SetCurrentRM("main");    
dofile("./data/15/2/res.lua");
 UpdateStack();
setcurentleaf("barton_vhod",15,0);
WaitRender()
flags.comx= true

    ShowMenu(false);
function StartLevel()
  DarkScreen(false);
    SetCurrentRM("menu");
    AddImgToBook("photoaparat",821,637);
    AddHints()
    SetCurrentRM("main");
    ShowMenu(true);
    
  setcurentleaf("barton_zal",15,1);
    AddParticleToObject(38,"zvezd",526,285);---zvon
    MoveEmiter("zvezd",526,285);
    if not flags.button then
    StartEmiter("zvezd"); 
    end;
if not flags.cat then
set_visible_object(56,true)
return; end;
  setcurentleaf("barton_zal",15,1);
  AddParticleToObject(12,"cat3",821,343);
  MoveEmiter("cat3",821,343);
  if flags.cat then
  StartEmiter("cat3"); 
  end;
  if flags.vowli then
    set_visible_object(66,true)
  end
  AddParticleToObject(126,"zapiska",201,351);
  MoveEmiter("zapiska",201,351);
  if (not flags.letter) then
  StartEmiter("zapiska"); 
  end;
  AddParticleToObject(56,"glob",824,387);
  MoveEmiter("glob",824,387);
  if (not flags.cat) and (not flags.gazeta) then
  StartEmiter("glob"); 
  end;  
  setcurentleaf("oranjereya",15,2);
    AddParticleToObject(12,"sak",826,636);
    MoveEmiter("sak",826,636);
  if not flags.minicomplete6 then
  StartEmiter("sak");
  return;end;
end
playfile(".\\sound\\game_theme2.ogg",true,true);