c("ffff!!!!")
loadresource("data\\menu\\mini_buttons.png","mini_button");
 -- CreateConsole()
dofile("script\\CreateSounds.lua");

loadresource("data\\menu\\end_game.png","end_game");
-- loadresource("data\\images\\tochka.jpg","tochka",666999);------------------------------------------
setfocusfunc("StartPause")
loadresource("data\\ingame\\glove_active.png","glove");
loadresource("data\\ingame\\pointer_active.png","pointer");
loadresource("data\\ingame\\scaner_active.png","scaner");
loadresource("data\\ingame\\menu.png","menu",1000002);
loadresource("data\\menu\\ingame_bg.png","ingame_bg",1000004);
loadresource("data\\ingame\\dragonfly.png","dragonfly");
loadresource("data\\ingame\\nvg_mode.png","nvg_mode");
loadresource("data\\ingame\\nvg_daymode.png","nvg_daymode");
loadresource("data\\menu\\options.png","options");
loadresource("data\\menu\\menu_buttons.png","buttons");
loadresource("data\\images\\developers.jpg","developers",14);

loadresource("data\\ingame\\window.png","window");
loadresource("data\\ingame\\mini_border.png","mini_border");
-- loadresource("data\\ingame\\mini_skip.png","mini_skip");
loadresource("data\\ingame\\mini_skip_loading.png","mini_skip_loading");
loadresource("data\\images\\spause.png","spause",73);

loadresource("data\\images\\plush.jpg","plush");
loadresource("data\\images\\skip.png","skip");
loadresource("data\\images\\plushka.png","plushka");

loadresource("data\\images\\goodman.png","goodman");
loadresource("data\\images\\badman.png","badman");
loadresource("data\\images\\goodgirl.png","goodgirl");
loadresource("data\\images\\badgirl.png","badgirl");
loadresource("data\\images\\prof.png","prof");


	
	-- loadresource("data\\tochka.jpg","tochka1");	
	-- loadresource("data\\tochka1.jpg","tochka2");
	-- loadresource("data\\tochka2.jpg","tochka3");
	-- loadresource("data\\tochka3.jpg","tochka4");
	-- loadresource("data\\tochka4.jpg","tochka5");






addglobalobjecttogame( 11111,"spause",0,0,"",0,0,1024,768);--надпись пауза
addglobalobjecttogame( -100002,"nvg_mode",0,0,"",0,0,1024,768);
addglobalobjecttogame( -100022,"nvg_daymode",0,0,"",0,0,1024,768);
set_visible_object(11111,false);
set_visible_object(-100002,false);
set_visible_object(-100022,false);

------Окошко Настройки----------------------------------------------------------------------------------
OptionsWnd={}
OptionsWnd["img"]="options";
OptionsWnd["posX"]   =216.0;
OptionsWnd["posY"]   =155.0;
OptionsWnd["posXimg"]=0.0;
OptionsWnd["posYimg"]=0.0;
OptionsWnd["width"]  =593.0;
OptionsWnd["height"] =458.0;
-------Слайдер---------------------------------------------------------------------------------
EffectSlider={}
EffectSlider["posX"]   		=494.0;
EffectSlider["posY"]   		=356.0;
EffectSlider["maxshift"]   	=216.0;
EffectSlider["posXimg"]		=533.0;
EffectSlider["posYimg"]		=301.0;
EffectSlider["width"]  		=53.0;
EffectSlider["height"] 		=35.0;
EffectSlider["offsetx"]  	=0.0;
EffectSlider["offsety"] 	=0.0;
EffectSlider["func"] 		="effect";
-- addSlidertomenupage(2,2,366,300,247,0,129,40,53,0,0);--шарик "Звуковые эффекты"
-- addSlidertomenupage(2,3,366,397,247,0,129,40,53,0,0);--шарик "Громкость Музыки"
-------Слайдер---------------------------------------------------------------------------------
MusicSlider={}
MusicSlider["posX"]   		=494.0;
MusicSlider["posY"]   		=438.0;
MusicSlider["maxshift"]   	=216.0;
MusicSlider["posXimg"]		=533.0;  
MusicSlider["posYimg"]		=301.0;
MusicSlider["width"]  		=53.0; 
MusicSlider["height"] 		=35.0;
MusicSlider["offsetx"]  	=0.0;  
MusicSlider["offsety"] 		=0.0;  
MusicSlider["func"] 		="musuk";
--------Кнопка перехода в полноэкранный режим--------------------------------------------------------------------------------       
FullScrean={}
FullScrean["posX"]   		=597.0;
FullScrean["posY"]   		=268.0;
FullScrean["posXimg"]	=456.0;
FullScrean["posYimg"]	=301.0;
FullScrean["width"]  		=36.0;
FullScrean["height"] 		=37.0;
FullScrean["offsetx"]  	=0.0;
FullScrean["offsety"] 		=35.0;
FullScrean["func"] 			="tofullscrean";
--------Кнопка Ок--------------------------------------------------------------------------------   
OptionsOK={}
OptionsOK["posX"]   		=460.0;
OptionsOK["posY"]   		=510.0;
OptionsOK["posXimg"]	=608.0;
OptionsOK["posYimg"]	=86.0;
OptionsOK["width"]  		=116.0;
OptionsOK["height"] 		=42.0;
OptionsOK["offsetx"]  	=0.0;
OptionsOK["offsety"] 		=0.0;
--OptionsOK["func"] 			="tofullscrean";
-------Выделение кнопки ок---------------------------------------------------------------------------------   
OptionsOKSelect={}
OptionsOKSelect["img"]			="buttons";
OptionsOKSelect["posX"]   		=460.0
OptionsOKSelect["posY"]   		=510.0
OptionsOKSelect["posXimg"]	=608.0
OptionsOKSelect["posYimg"]	=129.0;
OptionsOKSelect["width"]  		=116.0
OptionsOKSelect["height"] 		=42.0;
OptionsOKSelect["func"] 		="close_options";
---------Внутри игровое меню-------------------------------------------------------------------------------   
IngameBG={}
IngameBG["img"]			="ingame_bg";
IngameBG["posX"]   		=318.0;
IngameBG["posY"]   		=184.0;
IngameBG["posXimg"]		=0.0;
IngameBG["posYimg"]		=0.0;
IngameBG["width"]  		=348.0;
IngameBG["height"] 		=359.0;
---------Вернутся в игру-------------------------------------------------------------------------------   
BackToGame={}
BackToGame["posX"]   		=377.0;
BackToGame["posY"]   		=305.0;
BackToGame["posXimg"]	=0.0;
BackToGame["posYimg"]	=394.0;
BackToGame["width"]  		=233.0;
BackToGame["height"] 		=42.0;
BackToGame["offsetx"]  	=0.0;
BackToGame["offsety"] 		=0.0;
----------Вернутся в игру выделение------------------------------------------------------------------------------ 
BackToGameSelect={}
BackToGameSelect["img"]			="buttons";
BackToGameSelect["posX"]   		=377.0;
BackToGameSelect["posY"]   		=305.0;
BackToGameSelect["posXimg"]	=0.0;
BackToGameSelect["posYimg"]	=437.0;
BackToGameSelect["width"]  		=233.0;
BackToGameSelect["height"] 		=42.0;
BackToGameSelect["func"] 		="back";
----------Переход в опции------------------------------------------------------------------------------ 
ToOptions={}
ToOptions["posX"]   		=377.0;
ToOptions["posY"]   		=365.0;
ToOptions["posXimg"]	=234.0;
ToOptions["posYimg"]		=394.0;
ToOptions["width"]  		=233.0;
ToOptions["height"] 		=42.0;
ToOptions["offsetx"]  		=0.0;
ToOptions["offsety"] 		=0.0;
----------Переход в опции выделение------------------------------------------------------------------------------ 
ToOptionsSelect={}
ToOptionsSelect["img"]			="buttons";
ToOptionsSelect["posX"]   		=377.0;
ToOptionsSelect["posY"]   		=365.0;
ToOptionsSelect["posXimg"]	=234.0;
ToOptionsSelect["posYimg"]	=437.0;
ToOptionsSelect["width"]  		=233.0;
ToOptionsSelect["height"] 		=42.0;
ToOptionsSelect["func"] 		="options";
----------Сохранить и выйти------------------------------------------------------------------------------ 
SaveAndExit={}
SaveAndExit["posX"]   		=377.0;
SaveAndExit["posY"]   		=425.0;
SaveAndExit["posXimg"]		=468.0;
SaveAndExit["posYimg"]		=394.0;
SaveAndExit["width"]  		=233.0;
SaveAndExit["height"] 		=42.0;
SaveAndExit["offsetx"]  		=0.0;
SaveAndExit["offsety"] 		=0.0;
-----------Сохранить и выйти выделение----------------------------------------------------------------------------- 
SaveAndExitSelect={}
SaveAndExitSelect["img"]			="buttons";
SaveAndExitSelect["posX"]   		=377.0;
SaveAndExitSelect["posY"]   		=425.0;
SaveAndExitSelect["posXimg"]	=468.0;
SaveAndExitSelect["posYimg"]	=437.0;
SaveAndExitSelect["width"]  		=233.0;
SaveAndExitSelect["height"] 		=42.0;
SaveAndExitSelect["func"] 			="save_exit";
----------------Кнопка разработчики----------------------------------------------------------------------
ToDevWnd={}
ToDevWnd["posX"]   		=-100.0;
ToDevWnd["posY"]   		=-100.0;
ToDevWnd["posXimg"]	=470.0;
ToDevWnd["posYimg"]	=365.0;
ToDevWnd["width"]  		=0.0;
ToDevWnd["height"] 		=0.0;
ToDevWnd["offsetx"]  	=0.0;
ToDevWnd["offsety"] 		=0.0;
----------------Выделение кнопки разработчики----------------------------------------------------------------------
ToDevWndSelect={}
ToDevWndSelect["img"]			="buttons";
ToDevWndSelect["posX"]   		=-100.0;
ToDevWndSelect["posY"]   		=-100.0;
ToDevWndSelect["posXimg"]	=470.0;
ToDevWndSelect["posYimg"]	=365.0;
ToDevWndSelect["width"]  		=0.0;
ToDevWndSelect["height"] 		=0.0;
ToDevWndSelect["func"] 		="todevelopers";
---------------Окошко Разработчики---------------------------------------------!!!
DevelopersWND={}
DevelopersWND["img"]			="developers";
DevelopersWND["posX"]   		=0.0;
DevelopersWND["posY"]   		=0.0;
DevelopersWND["posXimg"]		=0.0;
DevelopersWND["posYimg"]		=0.0;
DevelopersWND["width"]  		=1024.0;
DevelopersWND["height"] 		=768.0;
-------------Кнопка Ок---------------------------------------------------------------------------!!!
DevelopersWNDOk={}
DevelopersWNDOk["img"]			="buttons";
DevelopersWNDOk["posX"]   		=715.0;
DevelopersWNDOk["posY"]   		=687.0;
DevelopersWNDOk["posXimg"]		=482.0;
DevelopersWNDOk["posYimg"]		=191.0;
DevelopersWNDOk["width"]  		=95.0;
DevelopersWNDOk["height"] 		=70.0;
-------------Выделение для кнопки Ок---------------------------------------------------------------------------!!!
DevelopersWNDOkSelect={}
DevelopersWNDOkSelect["img"]			="buttons";
DevelopersWNDOkSelect["posX"]   		=715.0;
DevelopersWNDOkSelect["posY"]   		=687.0;
DevelopersWNDOkSelect["posXimg"]		=482.0;
DevelopersWNDOkSelect["posYimg"]		=260.0;
DevelopersWNDOkSelect["width"]  		=95.0;
DevelopersWNDOkSelect["height"] 		=70.0;
DevelopersWNDOkSelect["func"] 			="backtooptions";
-------------Выделение для кнопки Ок---------------------------------------------------------------------------!!!

ExitMenuBG={}
ExitMenuBG["img"]			="end_game";
ExitMenuBG["posX"]   		=216.0;
ExitMenuBG["posY"]   		=260.0
ExitMenuBG["posXimg"]		=0.0;
ExitMenuBG["posYimg"]		=0.0;
ExitMenuBG["width"]  		=593.0;
ExitMenuBG["height"] 		=330.0;

ExitMenuOk={}
ExitMenuOk["posX"]   		=522.0;
ExitMenuOk["posY"]   		=490.0;
ExitMenuOk["posXimg"]		=608.0;
ExitMenuOk["posYimg"]		=86.0;
ExitMenuOk["width"]  			=116.0;
ExitMenuOk["height"] 		=42.0;
ExitMenuOk["offsetx"]  		=0.0;
ExitMenuOk["offsety"] 		=0.0;

ExitMenuOkSelect={}
ExitMenuOkSelect["img"]			="buttons";
ExitMenuOkSelect["posX"]   		=522.0;
ExitMenuOkSelect["posY"]   		=490.0;
ExitMenuOkSelect["posXimg"]		=608.0;
ExitMenuOkSelect["posYimg"]		=129.0;
ExitMenuOkSelect["width"]  		=116.0;
ExitMenuOkSelect["height"] 		=42.0;
ExitMenuOkSelect["func"] 			="gameexit";

ExitMenuToMenu={}
ExitMenuToMenu["posX"]   		=386.0;
ExitMenuToMenu["posY"]   		=490.0;
ExitMenuToMenu["posXimg"]	=608.0;
ExitMenuToMenu["posYimg"]	=258.0;
ExitMenuToMenu["width"]  		=116.0;
ExitMenuToMenu["height"] 		=42.0;
ExitMenuToMenu["offsetx"]  	=0.0;
ExitMenuToMenu["offsety"] 	=0.0;

ExitMenuToMenuSelect={}
ExitMenuToMenuSelect["img"]			="buttons";
ExitMenuToMenuSelect["posX"]   	=386.0;
ExitMenuToMenuSelect["posY"]   		=490.0;
ExitMenuToMenuSelect["posXimg"]	=608.0;
ExitMenuToMenuSelect["posYimg"]	=301.0;
ExitMenuToMenuSelect["width"]  		=116.0;
ExitMenuToMenuSelect["height"] 		=42.0;
ExitMenuToMenuSelect["func"] 		="back";

HintTime={}
HintTime["time"] = 0;

AddOptions();
AddIngameMemu();
--------------------------------------------------Меню игры-------------------------------------------------------------------------------
local showhelp=false;
local ug_ot=0;
local ug_do=72;


local ug_do_glove=126;
local ug_ot_glove=54;


 ug_do_nvg=54;
 ug_ot_nvg=-18;


local ug_do_rentgen=198;
local ug_ot_rentgen=126;

local ug_do_scaner=270;  
local ug_ot_scaner=198;  

local ug_do_pointer= -18
local ug_ot_pointer=-90

local click=0;
local helpload=false;

local n = 0;
canmenu=false;
canusegadjets=false
backpage=-1;
ingame_options=false;
complete=false;
gamepause = false;
tutor=false;
glove_on = false;
nvg_on = false;
nvg_daymode = true;
scaner_on = false;
rentgen_on = false;
rentgen_is_usable = false;
pointer_on = false;
fucking_third_level = false;
nice_27_level = false;
rotate=true;
choose=0;
letrotate=false;
userent=false;
oslep=false;

gloveselect=false;
nvgselect=false;
rentgenselect=false;
scanerselect=false;
colorcollapse=false;
showoptions=true;
switched=false;

nazvlevela=false;

loc27=false;
white=false;
flags.light1=true
glove_rotate=false;
nvg_rotate=false;
rentgen_rotate=false;
flags.comics4=true;
declineGadjet=false;
imageid=-1;
start_anima=false
mininame="";
mininum1=-1;
mininum2=-1;
mininame2="";
minigg=false;
levelnext=-1;
use_rent_1_loc=false
cangotothenextlevel=false;
takeobjecttohand=false
mini2lvl=false
mini2lvl5=false
mini2lvl6=false
mini1lvl10=false
mini2lvl10=false
mini1lvl16=false		
function RotateToPosGad(c1,c2,c3,c4,c5,t)
		StartTravel(100001,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,c1*0.0175, ug_ot_rentgen*0.0175,      t,false})		
		StartTravel(100002,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,c2*0.0175, ug_ot_nvg    *0.0175,      t,false})		
		StartTravel(100004,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,c3*0.0175, ug_ot_glove  *0.0175,      t,false})
		StartTravel(100005,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,c4*0.0175, ug_ot_scaner *0.0175,      t,false})
        StartTravel(100003,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,c5*0.0175, ug_ot_pointer*0.0175,      t,false})			
end
function StartPause()

set_visible_object(11111,true);
speciale_action(4,11111);
pause_state=true;
end;

if declineGadjet then
declineGadjet=false;
end
function vasea()

-- plashechkiGameInput1()
end
-- CreateConsole()
function MessageFromMenu(nCount,Param1)

if takeobjecttohand then return;end

	if Param1 == 1000029 then
	
	StartTimer(254326236,1,"vasea")
	if showoptions then	
		showoptons(false);	
	end	

	
	return; end;

if canmenu==true then return;end;
if canusegadjets==true then return;end;

	
	if Param1 == 100004 then	
	c1(use_rent_1_loc)
	if flags.use_rent_1_loc then CreatePlashechka(34323242,"218","goodgirl") return;end;
	if flags.useNVG then CreatePlashechka(34323242,"218","goodgirl") return;end;
	if flags.declineNVG then CreatePlashechka(34323242,"68","goodgirl") return;end;
	if flags.lvl27flag then return;end;
	
		if not flags.comics4 then		
			CreatePlashechka(3442,"20002","goodgirl")
		return;end
		
		if not flags.light1 then
				CreatePlashechka(3442,"20002","goodgirl")		
		return;end;
		
		if rentgenselect then gameinput(100001,-1,-1);glove_on = true; canusegadjets=true rentgenselect=false;RotateWheel(342,198,270,414,126,1,1,0); gloveselect=true;return;end
		if nvgselect     then nvgselect=false; glove_on = true;canusegadjets=true set_visible_object(-100022, false); RotateWheel(342,198+360,270+360,414,126+360,3,4,3);gloveselect=true;return;end;
		if scanerselect  then scanerselect=false; glove_on = true;canusegadjets=true FreeCustomCursor();scaner_on=false; ug_ot_pointer=-18;RotateWheel(342,198,270,414,126,1.5,2,1);	gloveselect=true; return;end;
		
		 if	declineGadjet then
			
				
		 return;end
			
	
		RotateWheel(342,198,270,414,126,1.7,3,2);		
		gloveselect=true;
		set_visible_object(5555,false);		
		
	end;
	
	if Param1 == 100002  then
		if flags.declineNVG then CreatePlashechka(34323242,"68","goodgirl") return;end;
		-- if not flags.tutor2lvl then return;end
		if not flags.comics4 then
		CreatePlashechka(3442,"20002","goodgirl")
		return;end
		
		if flags.nvg_block then
			CreatePlashechka(3442,"10002","goodgirl")
		return; end;
		
		if not flags.light1 then
				CreatePlashechka(3442,"20002","goodgirl")				
		return;end;
	
		if rentgenselect then rentgenselect=false; canusegadjets=true gameinput(100001,-1,-1); RotateWheel(414,270,342,487,198,1.5,2,1); nvgselect=true;return;end
		if gloveselect then gloveselect=false;glove_on = false; FreeCustomCursor();canusegadjets=true RotateWheel(414,270,342,126,198,1,1,0);	 nvgselect=true; return;end
		if scanerselect  then scanerselect=false; scaner_on=false; FreeCustomCursor();ug_ot_pointer=-18;canusegadjets=true RotateWheel(414,270,342,487,198,2,3,2);	nvgselect=true; return;end;
		
		 if	declineGadjet then
	
		
		 return;end
	
	
		RotateWheel(414,270,342,487,198,2,4,3);
		nvgselect=true;
		set_visible_object(5557,false)
		
	end;
	
	
	
	if Param1 == 100001  then
		if flags.declineNVG then CreatePlashechka(34323242,"68","goodgirl") return;end;
		if flags.lvl27flag then return;end;
		if not flags.comics4 then
		
		CreatePlashechka(3442,"20002","goodgirl")
		return;end
		if not rentgen_is_usable then
			CreatePlashechka(3442,"10001","goodgirl")
		return; end;	
		if not flags.light1 then
				CreatePlashechka(3442,"20002","goodgirl")				
		return;end;
		
		if gloveselect then gloveselect=false; glove_on = false; FreeCustomCursor(); canusegadjets=true RotateWheel(270+360,126+360,198+360,342,54+360,3,4,3); rentgenselect=true; return;end
		if nvgselect     then nvgselect=false; set_visible_object(-100022, false);canusegadjets=true RotateWheel(270,126+360,198+360,342,54+360,2,3,2);rentgenselect=true;return;end;
		if scanerselect  then scanerselect=false;scaner_on=false;  FreeCustomCursor();canusegadjets=true ug_ot_pointer=-18 RotateWheel(270,126,198,342,54,1,1,0);  	rentgenselect=true; return;end;
		
		 if	declineGadjet  then					
		 return;end
		
		
		
		RotateWheel(270,126,198,342,54,1.5,2,1);
		rentgenselect=true;
		set_visible_object(5556,false)
	end;

	if Param1 == 100003 then	
	
	if	declineGadjet and gloveselect then
		if flags.tutorforglove then
			flags.tutorforglove=false;
			-- CreateWindow(CWX,CWY,"208",9,nil,100,230);
			-- StartEmiter("Highlight");
			Set_Cursor(obj.delta_broken.id,2);	
			flags.start_podskazka	= true;
			set_visible_object(5559,false);		
			flags.tutor=false
		set_visible_object(obj.plashechka.id,false)
		set_visible_object(obj.goodgirl.id,false)
		del_object_from_game(5654547)	
		 f=false;
		end
			
			declineGadjet=false;
			gloveselect=false;
			glove_on = false;
			FreeCustomCursor();
			RotateWheelBack(342,198,270,414,126,1.7,3,2);   	
				
	return;end	
	
	if	declineGadjet and nvgselect then
	if not flags.comics4 then
		CreatePlashechka(3442,"20002","goodgirl")
		return;end
		
		if flags.nvg_block then
			CreatePlashechka(3442,"10002","goodgirl")
		return; end;
		
		if not flags.light1 then
				CreatePlashechka(3442,"20002","goodgirl")				
		return;end;
		
	
			declineGadjet=false;
			nvgselect=false;
			 set_visible_object(-100022, false); 
			 gameinput(1000022, -1, -1);
			RotateWheelBack(414,270,342,487,198,3,4,3);	  
		set_visible_object(5561,false);		
		return;end
		
		
		if	declineGadjet and rentgenselect then		
			declineGadjet=false;				
			rentgenselect=false;
			gameinput(100001,-1,-1)
			RotateWheelBack(270,126,198,342,54,1.5,2,1); 	
			set_visible_object(5560,false);
			rentgen_is_usable=false;
		return;end
		
			if	declineGadjet and scanerselect then
			declineGadjet=false;
			scanerselect=false;
			scaner_on = false;
			FreeCustomCursor();
			RotateWheelBack(198,54,126,270,-18,1,1,0); 			
		return;end
			

	end;
	
	
	if Param1 == 100005  then	
	if flags.lvl27flag then return;end;
	if not flags.comics4 then
		CreatePlashechka(3442,"20002","goodgirl")
	return;end
		
		if rentgenselect then gameinput(100001,-1,-1); rentgenselect=false;canusegadjets=true RotateWheel(198+360,54+360,126+360,270+360,-18+360,3,4,3); scanerselect=true;return;end
		if nvgselect     then nvgselect=false; set_visible_object(-100022, false);canusegadjets=true RotateWheel(198,54+360,126+360,270,-18+360,1.5,2,1);scanerselect=true;return;end;
		if gloveselect then gloveselect=false; glove_on=false; FreeCustomCursor(); canusegadjets=true RotateWheel(198+360,54+360,126+360,270,-18+360,2,3,2);	 scanerselect=true; return;end
		
		 if	declineGadjet then
					
		 return;end
			
		RotateWheel(198,54,126,270,-18,1,1,0);
		scanerselect=true;
		set_visible_object(5558,false);
	end;
	
	
	
return;end;

function MessageProc(event,id,selectedid)

if canmenu then return;end

if onmenu then onmenu=false return end

		-- if not isTimes then
		-- AlternateTimer("plashechkiGameInput1",3000)			
		-- end
--/////////////////////////////////Обробатываем нажатие на ескейп/////////////////////////////////////////////
if event==2 then

if showoptions then
if canmenu then return;end
showoptons();	
end
if id==2000028 then
	if not ingame_options then	 
	  showoptons();		 
	return;end
return;end;	
if id==2000029 then
	messagebox("help_mini")
return;end;	

return; end;
--////////////////////////////////////////////////////////////////////////////////////////////////////////////	

function SelectObject()


 if takeobjecttohand then  return;end
-- if canmenu==true then return;end;
	StartBigTravel(obj.dragonfly.id, selectedid, 0, 1,0.7, 1, 3);
end;	

if event==3 then


 if takeobjecttohand then return;end

	flags.animation=true;
if flags.nohints then return; end;
if flags.tutor then
	set_visible_object(obj.arrow5.id,false);
	Set_Cursor(2,obj.delta_broken.id)
	flags.starthint=false	
 end;
	if dragonfly_is_usable then
	playeffect("013")----------------------------------------------полет стрекозы
		dragonfly_is_usable = false;
		
		if selectedid~=0 then
			SelectObject(selectedid);
			c("VASEAAA!!!!!\n")
		else 			
			SelectRandom();
			c("HER!!!!!\n")
		end;
		StartAnimation( 5555555555, 0, 1 );
		
	end;

return;end;
--////////////////////////////////////////////////////////////////////////////////////////////////////////////		
end;

function showoptons(param)	
	ingame_options = not ingame_options;
	show_ingame_menu(ingame_options);
end;
--////////////////////////////////////////////////////////////////////////////////////////////////////////////
function close_options()
	options_menu(false);
end
function back()
	showoptons(false);

end
function help()
	
end
function options()
	options_menu(true);
end
function setpouse(value)

end

-------------------------------------------------------------------------------------- 
-- CreateConsole()

--------------------------------------------------------------------------------------------------------- 
function save_exit()
FreeCustomCursor()
startlevel4=false
startlevel3=false
	if canmenu then return;end
	SaveGame1();	
	
	
	if mini_start then
		canmenu=false
		takeobjecttohand=false
		pushexit=true
		finish_mini_game(false)
		clear_satelite_leaf(nazvlevela)	
	else
		setstatemenu()	
		
		StopAllEffects()
		StopMusic()
	end	
canmenu=false
takeobjecttohand=false
	
end

function gameexit(value)
startlevel3=false
startlevel4=false
	SaveGame1()
	canmenu=false
	takeobjecttohand=false
	if canmenu then return;end
	exitgame()	
end

function backgame(value)
startlevel3=false
startlevel4=false
if canmenu then return;end
	SaveGame1();
	canmenu=false
takeobjecttohand=false
	-- setstatemenu();	
end
---------------------------------------------------------------------------------------------------------

function RotateToPos(rotateval)

	for k=0,rotateval do	
	RotateButtonsInBook(false);		   
	end  

end;



function RotateWheel(c1,c2,c3,c4,c5,t,count,rotateval)
canusegadjets=true;	
local ug_ot=0;
local ug_do=72;

	playeffect("012")
	for i=0,rotateval do
RotateButtonsInBook(true)	
	end  
	
		
		RotateObject( 4000002, ug_ot, ug_do*count,t,false)		
		StartTravel(100001,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,ug_ot_rentgen*0.0175, c1*0.0175,      t,false})		
		StartTravel(100002,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,ug_ot_nvg    *0.0175, c2*0.0175,      t,false})		
		StartTravel(100004,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,ug_ot_glove  *0.0175, c3*0.0175,      t,false})
		StartTravel(100005,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,ug_ot_scaner *0.0175, c4*0.0175,      t,false})
        StartTravel(100003,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,ug_ot_pointer*0.0175, c5*0.0175,      t,false},"f11111")			
		
		ug_ot=ug_do
		ug_do=ug_do+72	

		if c1>360 then c1=c1-360;	end
		if c2>360 then c2=c2-360;	end
		if c3>360 then c3=c3-360;	end
		if c4>360 then c4=c4-360;	end
		if c5>360 then c5=c5-360;	end
		
		ug_ot_rentgen=c1;
		ug_ot_nvg=c2;
		ug_ot_glove=c3;
		ug_ot_scaner=c4;
		ug_ot_pointer=c5;
	
	
	

end;

function RotateWheelBack(c1,c2,c3,c4,c5,t,count,rotateval)
playeffect("012")
canusegadjets=true;
 ug_ot_glove=59.5;
 ug_ot_rentgen=126;
 ug_ot_scaner=198; 
 ug_ot_pointer=-90
 ug_ot_nvg=-18;
local ug_ot=0;
local ug_do=72;
	for k=0,rotateval do	
	RotateButtonsInBook(false);		   
	end  
	 
 
 
		RotateObject( 4000002, ug_do*count,ug_ot ,t,false)		
		StartTravel(100001,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,c1*0.0175, ug_ot_rentgen*0.0175,      t,false})		
		StartTravel(100002,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,c2*0.0175, ug_ot_nvg    *0.0175,      t,false})		
		StartTravel(100004,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,c3*0.0175, ug_ot_glove  *0.0175,      t,false})
		StartTravel(100005,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,c4*0.0175, ug_ot_scaner *0.0175,      t,false})
        StartTravel(100003,1,nil,nil,{"InstantiationOfCircleR",3,925,683,926,643,c5*0.0175, ug_ot_pointer*0.0175,      t,false},"f1111")			
	ug_ot=ug_do
	ug_do=ug_do+72		

end;



function RotateHandler(object)
if not isTimes then
-- AlternateTimer("plashechkiGameInput1",1000)
end
	if  object==100004 and gloveselect then	
		SetCustomCursor(obj.glove.id);
		glove_on = true;
		gameinput(100004,-1,-1)		
		declineGadjet=true;
	end;

	if object ==100002 and nvgselect then
		set_visible_object(-100022, true);
		gameinput(100002, -1, -1);
		declineGadjet=true;
	end;



	if object ==100001 and rentgenselect then	
			gameinput(100001,-1,-1)
			declineGadjet=true;		
				
	end;





	if object ==100005 and scanerselect then		
		SetCustomCursor(obj.scaner.id);
		scaner_on = true;
		declineGadjet=true;
	end

	
-- canmenu=false;


end


function f1111(nCount,Param)
canusegadjets=false;
canmenu=false
rentgenselect=false
declineGadjet=false;
end

function f11111(nCount,Param)
canusegadjets=false;
canmenu=false
end


function computation ( MyId)

                x,y=GetObjectPosition(MyId);
				x1,y1=GetObjectPosition(obj.dragonfly.id);
				width,height = GetObjectSize(MyId)
				a= (x-x1); b= (y-y1);  dist= math.sqrt (a^2+b^2);				
		        t=dist/400;		
                r = (math.sqrt(width^2+height^2)*0.5);		
				
					if r<50 then	r=75;	radius=4;	end  -- при радиусе меньше 50 определяем время кружения и радиус стрекозы
				
					if r>50 and r <100 then	r=87 radius=2.5;  end  --при радиусе больше 50 и меньше 100
				
					if r>100 then 	r=100 	radius=0.75;  end  -- при радиусе больше 100
				
				StartBigTravel(obj.dragonfly.id, MyId, 0, t, r/90, t, 2 ,radius);
dist=-1;
a=-1;
b=-1;
v=100;
t=-1;
diag=-1;
width = -1;
height = -1;
radius=1.2;

end
