nextlevel=-1;

AddTreeLeaf( "Root", "menu45445", -1, -1 );
dofile("script\\core.lua");

dofile("script\\plushes.lua");
 CWX = 200;
 CWY = -20
 backpackinmenu=true;
LoadGame(); 					-- gamedata is updated

SetCurrentRM("menu");
	loadresource("data\\ingame\\menubtn1.png","menu_button1",1000027);
	loadresource("data\\ingame\\menubtn2.png","menu_button2",1000026);
	loadresource("data\\ingame\\menubtn3.png","menu_button3",1000025);
	loadresource("data\\ingame\\green.png","green");
	-- loadresource("data\\ingame\\red_b.png","red_b");
	-- loadresource("data\\ingame\\rentgen.png","rentgen");
	loadresource("data\\ingame\\rentgen_active.png","rentgen_active");
	-- loadresource("data\\ingame\\nvg.png","nvg");
	loadresource("data\\ingame\\nvg_active.png","nvg_active");
	-- loadresource("data\\ingame\\glove.png","glove");
	loadresource("data\\ingame\\glove_active.png","glove_active");
	loadresource("data\\ingame\\pointer.png","pointer");
	loadresource("data\\ingame\\pointer_active.png","pointer_active");
	--loadresource("data\\ingame\\scaner.png","scaner");
	loadresource("data\\ingame\\scaner_active.png","scaner_active");
	loadresource("data\\ingame\\menu.png","menu1",1000002);
	loadresource("data\\ingame\\menu_copy.png","menu_copy");
	loadresource("data\\ingame\\menu_copy2.png","menu_copy2");
	loadresource("data\\images\\scroll_l.png","scroll_l",101);
	loadresource("data\\images\\scroll_r.png","scroll_r",102);
	
	
	loadresource("data\\ingame\\helper.png","helper");
	loadresource("data\\ingame\\dragonfly_anim.png","dragonfly_anim");
	loadresource("data\\ingame\\gloves1.png","gloves");
	
	loadresource("data\\ingame\\nvg_blue.png","nvg_blue");
	loadresource("data\\ingame\\scaner_blue.png","scaner_blue");
	loadresource("data\\ingame\\glove_blue.png","glove_blue");
	loadresource("data\\ingame\\rentgen_blue.png","rentgen_blue");
	
	

	
	loadresource("data\\0\\0\\arrow_anim1.png","arrow11");
	
	
	function arrow1()
	playeffect("018")
	end
	
	-- CreateConsole()
	
	
	

	
	local CWX = 200;
	local CWY = 250;
	dragonfly_is_usable = true;
	
	function EndTutor()		
		if flags.tutor and not flags.take and not flags.endofhint then
			 BlockCursor(false)			
			set_text(5654547,"72")
			isTimes=false
			 flags.endofhint=true
			 set_visible_object(obj.arrow5.id,false);
		end;
	end;
	
	function EndDragonflyAnim()	
		flags.animation=false;
		dragonfly_is_usable = true;	
		
	end;

	add_animation(5555555555);
	add_animation_frame(5555555555,"dragonfly_anim",0,650,431,62,141,62,0.0);
	add_animation_frame(5555555555,"dragonfly_anim",0,661,0,0,141,62,2.5);
		AddFrameFunc(5555555555, "EndTutor")
	add_animation_frame(5555555555,"dragonfly_anim",0,650,0,62,141,62,2.5);
	add_animation_frame(5555555555,"dragonfly_anim",0,650,144,62,141,62,2.5);
	add_animation_frame(5555555555,"dragonfly_anim",0,650,288,62,141,62,2.4);
	add_animation_frame(5555555555,"dragonfly_anim",0,650,431,62,141,62,0.1);
	AddFrameFunc(5555555555, "EndDragonflyAnim");
	
	
	 add_animation(333);
	 add_animation_frame(333,"gloves",503,180,0,0,34,41,0.25);	
	 add_animation_frame(333,"gloves",503,180,63,0,39,45,0.25);	
	 
	-- add_animation_frame(333,"gloves",500,180,100,0,0,0,0.5);
	-- AddBook("menu2",883,535);
	
	add_animation(5555);
	add_animation_frame(5555,"arrow11",845,570,0,60,60,60,0.1);
	-- AddFrameFunc(5555,"arrow1")
	add_animation_frame(5555,"arrow11",845,570,63,60,60,60,0.1);
	add_animation_frame(5555,"arrow11",845,570,126,60,60,60,0.1);
	add_animation_frame(5555,"arrow11",845,570,63,60,60,60,0.1);	
	
	
	add_animation(5556);
	add_animation_frame(5556,"arrow11",845,570,0,60,60,60,0.1);
	-- AddFrameFunc(5556,"arrow1")
	add_animation_frame(5556,"arrow11",845,570,63,60,60,60,0.1);
	add_animation_frame(5556,"arrow11",845,570,126,60,60,60,0.1);
	add_animation_frame(5556,"arrow11",845,570,63,60,60,60,0.1);
	
	add_animation(5557);
	add_animation_frame(5557,"arrow11",845,570,0,60,60,60,0.1);
	-- AddFrameFunc(5557,"arrow1")
	add_animation_frame(5557,"arrow11",845,570,63,60,60,60,0.1);
	add_animation_frame(5557,"arrow11",845,570,126,60,60,60,0.1);
	add_animation_frame(5557,"arrow11",845,570,63,60,60,60,0.1);
	
	add_animation(5558);
	add_animation_frame(5558,"arrow11",845,570,0,60,60,60,0.1);
	-- AddFrameFunc(5558,"arrow1")
	add_animation_frame(5558,"arrow11",845,570,63,60,60,60,0.1);
	add_animation_frame(5558,"arrow11",845,570,126,60,60,60,0.1);
	add_animation_frame(5558,"arrow11",845,570,63,60,60,60,0.1);
	
	
	add_animation(5559);
	add_animation_frame(5559,"arrow11",845,570,0,60,60,60,0.1);
	-- AddFrameFunc(5559,"arrow1")
	add_animation_frame(5559,"arrow11",845,570,63,60,60,60,0.1);
	add_animation_frame(5559,"arrow11",845,570,126,60,60,60,0.1);
	add_animation_frame(5559,"arrow11",845,570,63,60,60,60,0.1);
	
	add_animation(5560);
	add_animation_frame(5560,"arrow11",845,570,0,60,60,60,0.1);
	-- AddFrameFunc(5560,"arrow1")
	add_animation_frame(5560,"arrow11",845,570,63,60,60,60,0.1);
	add_animation_frame(5560,"arrow11",845,570,126,60,60,60,0.1);
	add_animation_frame(5560,"arrow11",845,570,63,60,60,60,0.1);
	
	add_animation(5561);
	add_animation_frame(5561,"arrow11",845,570,0,60,60,60,0.1);
	-- AddFrameFunc(5561,"arrow1")
	add_animation_frame(5561,"arrow11",845,570,63,60,60,60,0.1);
	add_animation_frame(5561,"arrow11",845,570,126,60,60,60,0.1);
	add_animation_frame(5561,"arrow11",845,570,63,60,60,60,0.1);
	
	
	-- StartAnimation(5555,4,4);
	AddBook("menu1",0,545);
	
	AddImgToBook( "", 0, 666 ); -- 644
	AddAnimeToWnd1(5555555555, 0, -3, 0, 0, true);	
	
	
    AddAnimeToWnd1(333,945, 49, 0, 0, true);
	set_visible_object(333,false);
	
	AddAnimeToWnd1(5555,894, -10, 0, 0, true);  --стрелка для тутора в локации 0
	AddAnimeToWnd1(5556,850, -12, 0, 0, true); -- стрелка для тутора в локации 1
	AddAnimeToWnd1(5557,920, -27, 0, 0, true); -- стрелка для тутора в локации 2
	AddAnimeToWnd1(5558,846, -39, 0, 0, true); -- стрелка для тутора в локации 5
	AddAnimeToWnd1(5559,850, -12, 0, 0, true); -- стрелка для тутора в локации 0
	AddAnimeToWnd1(5560,894, -10, 0, 0, true);-- стрелка для тутора в локации 1
	AddAnimeToWnd1(5561,846, -39, 0, 0, true);
	set_visible_object(5555,false);
	set_visible_object(5556,false);
	set_visible_object(5557,false);
	set_visible_object(5558,false);
	set_visible_object(5559,false);
	set_visible_object(5560,false);
	set_visible_object(5561,false);
	AddButtonToWnd1("helper_button","helper",0,0,141,44);
	-- AddButtonToWnd1("helper_button","helper",0,0,141,44);

	-- AddButtonToWnd1("menu2","menu2",883,335,141,234);
	
	AddButtonToBook(1000027,nil,"menu_button1","menu_button2","menu_button3",nil,2,188,116,42,true);
	
knopki = {926,95,963,131,945,170,902,168,888,122}	
PrepareRotation(5,knopki);
AddButtonToBook(4000002,nil,"menu_copy",nil,nil,nil,875,92,139,139,false,false);

	if flags.rentgen_taken then
		AddButtonToBook(100001,"8","rentgen_blue",nil,nil,nil,902,168,40,40,true,true,3);
	end;
	if flags.nvg_taken then
		AddButtonToBook(100002,"5","nvg_blue",nil,nil,nil,    963,131,40,40,true,true,1);
	end;
	
	if flags.glove_taken then
		AddButtonToBook(100004,"7","glove_blue",nil,nil,nil,  945,170,40,40,true,true,2); 
		
	end;
	
		AddButtonToBook(100003,"4","pointer_active",nil,nil,nil, 926,95,40,40,true,true,0);  
	
	if flags.scaner_taken then
		AddButtonToBook(100005,"6","scaner_blue",nil,nil,nil, 888,120,40,40,true,true,4);
	end;
	
	--AddButtonToBook(4000003,nil,"menu_copy2",nil,nil,nil,875,103-11,1,1,false,true);
	
	AddButtonToWnd1("treug","menu_copy2",880,-35,1,1);	
	SetHotPoint(4000002,70,70);
	
SetCurrentRM("main");

NextLevel( gamedata.curr_level );	-- setting starting level and loading it

WriteToConsole("gamedata.curr_level"..gamedata.curr_level.."\n")
