
dofile("script\\gamemenu.lua");
flags.firstlevel=true;
dofile("script\\lib.lua");


set_inpun_fun("gameinput");

function LevelComplete()
	if not flags.bag then
		AddTool();
	end;	
	delete_tree_leaf("Root","peak");	
	if not flags.glove_taken then
		flags.glove_taken = true;
		SetCurrentRM("menu");
		AddButtonToBook(100004,"7","glove_blue",nil,nil,nil,945,180,30,30,true,true,2); 
		SetCurrentRM("main");
	end;	
	PushButton(100004,false)


	if obj.sail.is_stored then
		UnStoreObj(obj.sail.id);
	end;
	if obj.ski1.is_stored then
		UnStoreObj(obj.ski1.id);
	end;
	if obj.ski2.is_stored then
		UnStoreObj(obj.ski2.id);
	end;
	if obj.prop.is_stored then
		UnStoreObj(obj.prop.id);
	end;

	flags = {};
	flags.glove_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;	
	obj={}
	NextLevel(1)
end;

flags.comics4=true;
flags.light1=true
flags.items_collected = false;
flags.glove_vkl=false;
flags.glove_vikl=false;
flags.ngv_vkl=false;
flags.ngv_vikl=false;
flags.rentgen_vkl=false;
flags.rentgen_vikl=false;
flags.animation=false;
flags.start_arrow  = false;
flags.start_arrow1 = false;
flags.start_arrow2 = false;
flags.start_arrow3 = false;
flags.start_arrow4 = false;
flags.start_arrow5 = false;
flags.ski = false;
flags.glo = false;
flags.rent = false;
flags.nvg = false;
flags.first = false;
flags.take = false;
flags.tutor = false;
flags.start_tutor = true;
flags["first_time_load"] = true;
flags["snow_anim_played"] = false;
flags["start_draw"] = true;
flags["bag"] = false;
flags["comics1"] = true;
flags["comics2"] = true;
flags["comics3"] = false;
flags["mini1"] = false;
flags["level_complete"] = false;
flags["collected"] = false;
flags["details_collected"] = false;
flags["itemlist"] = false;
flags["items1"] = 0;
flags["wind"] = true;
flags.start_mini=false;
flags["sani"] = false;
flags["sani1"] = false;
flags["sani2"] = false;
flags["sani3"] = false;
flags["sani4"] = false;
flags.start_podskazka=false;

flags["delta_taken"] = false;
flags["delta_deployed"] = false;
flags["krut"] = false;
flags.use_rent=false;
flags.reuse_rent=false;
flags.reuse_nvg=false;

flags.light1=true;
flags.light=false;
flags.nv_done=true;
flags.nvg_block=false;
if flags.rentgen_1 then
rentgen_is_usable=false
else
rentgen_is_usable=true;
end;


flags.nvg_1=false;
flags.rentgen_1=false;
flags.glove_1=false;
if flags.restore_sheet then
	LoadGame();	
end;
flags.restore_sheet = true;

if flags.bagstored then
	AddTool();
	
end;

AddTreeLeaf( "Root", "peak", 0, 0 );

AddTxt();

LoadLeafRes( 0, 0 );

-- scene logic
flags.start_draw = true;
if flags.delta_deployed then
	StartEmiter("Highlight");
	set_visible_object(obj.delta_broken.id,false);
	set_visible_object(obj.delta_established.id,true);
	set_visible_object(obj.ski3_set.id,true);
	set_visible_object(obj.sosul_fall.id,false);
	set_visible_object(obj.sosul2.id,true);
	if flags.sail == false then
		set_visible_object(obj.sail_packed.id, true);	end;
	if flags.prop == false then
		set_visible_object(obj.prop_installed.id, true);	end;
	if flags.ski1 == false then
		set_visible_object(obj.ski1_set.id, true);	end;
	if flags.ski2 == false then
		set_visible_object(obj.ski2_set.id, true);	end;
end;

if flags.collected and flags.sani then
	Set_Cursor(obj.sail_packed.id,4);
end;

if flags.details_collected then
	Set_Cursor(obj.delta_broken.id,4);
end;


if obj.coin4.is_collapsed then
	set_visible_object(obj.snow_fall.id,false);
	set_visible_object(obj.snow3.id,true);
end;


	
if flags.glove_1  then
	StartEmiter("Highlight");
	Set_Cursor(obj.delta_broken.id,4);
end;

if flags.bagstored then
	setcolor( obj.backpack.id, 0, 0, 0, 0.5, 1 );
	else
	setcolor( obj.backpack.id, 0.2, 0, 0.8, 1, 1 );
end;

if flags.take and not flags.glo then
	set_visible_object(obj.arrowforglove.id,true)
	StartAnimation(obj.arrowforglove.id);
end

if not flags.delta_deployed and not flags.tutor then
	StartEmiter("Highlight");
	Set_Cursor(obj.delta_broken.id,4);
end

c("ffff!!!!")
SetCurrentLeaf("peak",0,0);
--playfile(".\\sound\\110.ogg",true,true);
playeffect("110",true)

c("ffff1111111!!!!")




