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

He = 1004;
She = 1003;
BHe = 1008;
BShe = 1009;
SPEED = 2;

function LevelComplete()
	-- setstatemenu();	
  
	if obj.manuscript44.is_stored then
		UnStoreObj(obj.manuscript44.id);
	else
		obj.manuscript44.is_stored = true;
	end;
	
	delete_tree_leaf("Root","inside");

	flags = {};
	
	flags.glove_taken = true;	
	flags.rentgen_taken = true;
	flags.nvg_taken = true;
	flags.restore_sheet = false;
	
	SaveGame1();
	if gloveselect then	RotateToPos(2);		end;
	if nvgselect then	RotateToPos(3);			end;
	if rentgenselect then	RotateToPos(1);			end;
	if scanerselect then	RotateToPos(0);			end;
	ShowMenu(false);
	obj={}
	NextLevel(5);
end;
	flags.glove_taken = true;	
	flags.rentgen_taken = true;
	flags.nvg_taken = true;
flags["first_time_load"]=true;
flags["finish"]=false;
flags.wait_mini = false;
flags["start_draw"] = true;
flags["comics"]=true;
flags["comics1"]=false;
flags["comics2"]=false;
flags.items = 0;

flags["tap31"] = false;
flags["tap32"] = false;
flags["tap27"] = false;
flags["tap30"] = false;
flags["tap26"] = false;
flags["tap28"] = false;
flags["tap25"] = false;
flags["tap29"] = false;
flags["taps"] = 0;
flags.tutor=false;
flags.mini=false;
flags.mini_complete=false;
flags.start_mini=false;

if flags.restore_sheet then
	LoadGame();
	AddTool();
end;
flags.restore_sheet = true;
Fontan=true
AddTreeLeaf("Root","inside",4,0);

AddTxt();

LoadLeafRes( 4, 0 );


-- scene logic

flags.start_draw = true;

if flags.wait_mini then
	StartEmiter("HighlightFountain");
	Set_Cursor(36,2)
	Set_Cursor(38,2)
	Set_Cursor(39,2)
	Set_Cursor(40,2)
	Set_Cursor(41,2)
end;

if flags.mini then
	flags["tap31"] = false;
	flags["tap32"] = false;
	flags["tap27"] = false;
	flags["tap30"] = false;
	flags["tap26"] = false;
	flags["tap28"] = false;
	flags["tap25"] = false;
	flags["tap29"] = false;
	flags["taps"] = 0;
	-- MiniCreate()
end;

if flags.mini_complete  then
id1 = 333
id0 = 336
now_attached = nil;
last_id = 0;
	StartTimer(1333,0.2);
	set_visible_object( obj.mini_border.id,false);
	set_visible_object( obj.mini_skip.id,false);
	set_visible_object( obj.mini_help.id,false);
	set_visible_object( obj.mini_skip_loading.id,false);
	set_visible_object( obj.mini_menu.id,false);
	flags.mini = false;
	-- setcolor( obj.amfora44.id, 0, 0, 0, 1, 1 );
	flags.mini_complete = true;
	if not flags.comics1 then
		MoveByVector( 40, 519, 230, 3, 100 );
		MoveByVector( 39, 359, 230, 3, 100 );
		MoveObjectY( 36, 436, 500, 4 );
		playeffect("049")
		-- RotateObject( 41, 20, 0, 3 );
		-- StartTimer(432,2,"plashkakuvshin")
		StartEmiter("kuvshin");
	else
		SetObjectPosition(40,519,230);
		SetObjectPosition(39,359,230);
		SetObjectPosition(36,460,500);
		RotateObject( 41, 20, 0, 0.1 );
		set_visible_object(37,false)
		set_visible_object(34,true)
		set_visible_object(obj.manuscript44.id,true)
	end
	SetObjectPosition(obj.a31.id,386,121);
	SetObjectPosition(obj.a32.id,412,121);
	SetObjectPosition(obj.a27.id,434,121);
	SetObjectPosition(obj.a30.id,456,121);
	SetObjectPosition(obj.a26.id,542,121);
	SetObjectPosition(obj.a28.id,563,121);
	SetObjectPosition(obj.a25.id,586,121);
	SetObjectPosition(obj.a29.id,612,121);
	for i=obj.a25.id, obj.a32.id do
		setcolor(i,0.5,0.5,0.5,1);
	end
		StartEmiter("WaterDrops1");
	StartEmiter("WaterDrops2");
	StartEmiter("WaterDrops3");
	StartEmiter("WaterDrops4");
	StartEmiter("WaterDrops5");
	StartEmiter("WaterDrops6");
	StartEmiter("WaterDrops7");
	StartEmiter("WaterDrops8");
	
	set_visible_object(301,true)
	set_visible_object(302,true)
	set_visible_object(303,true)
	set_visible_object(304,true)
	set_visible_object(305,true)
	set_visible_object(306,true)
	set_visible_object(307,true)
	set_visible_object(308,true)
end;
-- end scene logic

if not obj.manuscript44.is_collapsed   then
set_visible_object(obj.manuscript44.id,true);
StartEmiter("manuskript")
end

SetCurrentLeaf("inside",4,0);
StartAnimation( 5555555555,5,5 );
ShowMenu(false);
-- playfile(".\\sound\\038.ogg",true,true);
playeffect("038",true)
c("4 lvl")