import api_game as api_game
import game_1 as quest_game

str_path_img="data\\img\\"
str_img_menu=str_path_img+"menu\\game\\object_select.jpg"

music_location="data\\sound\\lost-night-sea.ogg"

def on_create():
	global music_location
	api_game.load_stream(music_location,1)
	api_game.fade_music(music_location,0,3)

	str_path_icon=str_path_img+"lev\\"+__name__+"\\objects_icon\\"
	str_path_m_icon=str_path_img+"lev\\"+__name__+"\\items\\"
	quest_game.set_path_small_icon(str_path_img+"lev\\"+__name__+"\\icons\\")
	
	api_game.load_stream("data\\sound\\quest\\q_night_les.ogg",0)
	api_game.set_local_vol("data\\sound\\quest\\q_night_les.ogg",0.5)
	api_game.play_sound("data\\sound\\quest\\q_night_les.ogg",1)

	api_game.load_stream("data\\sound\\quest\\amb_fakel.ogg",0)
	api_game.set_local_vol("data\\sound\\quest\\amb_fakel.ogg",1)
	api_game.play_sound("data\\sound\\quest\\amb_fakel.ogg",1)

	api_game.enable_visibility(0,"vkl_1", 0)
	api_game.enable_update(0,"vkl_1", 0)
	api_game.enable_visibility(0,"second_object", 0)
	api_game.enable_visibility(0,"fifth_object_full", 0)

	str_icons_menu=[str_path_icon+"item2_1.gif",str_path_icon+"item2_2.gif",str_path_icon+"item2_3.gif",str_path_icon+"item2_4.gif",str_path_icon+"item2_5.gif","","",""]
	str_icon_mouse=[str_path_m_icon+"item2_1m.gif",str_path_m_icon+"item2_2m.gif",str_path_m_icon+"item2_3m.gif",str_path_m_icon+"item2_4m.gif",str_path_m_icon+"item2_5m.gif","","",""]
	str_objects_on_loc=["item2_1","item2_2","item2_3","item2_4","item2_5","","",""]
	quest_game.add_of("second_object_open", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc, 3.14,-15,-5)

	str_icons_menu=[str_path_icon+"item5_1.gif",str_path_icon+"item5_1.gif",str_path_icon+"item5_1.gif",str_path_icon+"item5_1.gif",str_path_icon+"item5_1.gif",str_path_icon+"item5_1.gif",str_path_icon+"item5_1.gif",str_path_icon+"item5_1.gif"]
	str_icon_mouse=[str_path_m_icon+"item5_1m.gif",str_path_m_icon+"item5_1m.gif",str_path_m_icon+"item5_1m.gif",str_path_m_icon+"item5_1m.gif",str_path_m_icon+"item5_1m.gif",str_path_m_icon+"item5_1m.gif",str_path_m_icon+"item5_1m.gif",str_path_m_icon+"item5_1m.gif"]
	str_objects_on_loc=["item5_1","item5_2","item5_3","item5_4","item5_5","item5_6","item5_7","item5_8"]
	quest_game.add_of("fifth_object", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc,0,0,0)

	str_icons_menu=[str_path_icon+"item3_1.gif",str_path_icon+"item3_2.gif",str_path_icon+"item3_3.gif",str_path_icon+"item3_4.gif",str_path_icon+"item3_5.gif",str_path_icon+"bag_icon.gif",str_path_icon+"sack_icon.gif",""]
	str_icon_mouse=[str_path_m_icon+"item3_1m.gif",str_path_m_icon+"item3_2m.gif",str_path_m_icon+"item3_3m.gif",str_path_m_icon+"item3_4m.gif",str_path_m_icon+"item3_5m.gif",str_path_m_icon+"docbag_big.jpg",str_path_m_icon+"sack_big.jpg",""]
	str_objects_on_loc=["item3_1","item3_2","item3_3","item3_4","item3_5","second_object","fifth_object_full",""]
	quest_game.add_of("three_object_open", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc, 0,0,0)

	str_icons_menu=[str_path_icon+"item1_1.gif",str_path_icon+"item1_2.gif",str_path_icon+"item1_3.gif",str_path_icon+"item1_4.gif",str_path_icon+"item1_5.gif","","",""]
	str_icon_mouse=[str_path_m_icon+"item1_1m.gif",str_path_m_icon+"item1_2m.gif",str_path_m_icon+"item1_3m.gif",str_path_m_icon+"item1_4m.gif",str_path_m_icon+"item1_5m.gif","","",""]
	str_objects_on_loc=["item1_1","item1_2","item1_3","item1_4","item1_5","","",""]
	quest_game.add_of("first_object", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc, 0,0,0)

	str_icons_menu=[str_path_icon+"item4_1.gif",str_path_icon+"item4_2.gif",str_path_icon+"item4_3.gif",str_path_icon+"item4_4.gif",str_path_icon+"item4_5.gif","","",""]
	str_icon_mouse=[str_path_m_icon+"item4_1m.gif",str_path_m_icon+"item4_2m.gif",str_path_m_icon+"item4_3m.gif",str_path_m_icon+"item4_4m.gif",str_path_m_icon+"item4_5m.gif","","",""]
	str_objects_on_loc=["item4_1","item4_2","item4_3","item4_4","item4_5","","",""]
	quest_game.add_of("fourth_object", str_img_menu, str_icons_menu, str_icon_mouse, str_objects_on_loc,0,0,0)

	quest_game.set_state_of("second_object_open", 2)
	
	quest_game.add_oc("secret_1", "data\\img\\lev\\loc_15_1\\mini\\secret_1.gif", "vkl_1")

	api_game.set_goal("goal_15_1")

def on_mouse_down_of(object_name, p_object, state):
	if object_name == "first_object" and state == 3:		
		api_game.set_goal("goal_15_2")
		quest_game.set_state_of("fourth_object", 2)
	elif object_name == "second_object_open" and state == 3:
		api_game.set_goal("goal_15_3")
		api_game.play_anim(0,"second_object_open","quest_anim",0.5,1)
		api_game.play_anim(0,"second_object","quest_anim",0.5,0)
		quest_game.set_state_of("fifth_object", 2)		
	elif object_name == "three_object_open" and state == 3:
		api_game.set_goal("goal_15_4")
		api_game.play_anim(0,"three_object_open","quest_anim",0.5,1)
		quest_game.set_state_of("first_object", 2)		
	elif object_name == "fourth_object" and state == 3:		
		api_game.play_anim(0,"fourth_object","quest_anim",0.5,1)
	elif object_name == "fifth_object" and state == 3:
		quest_game.set_state_of("three_object_open", 2)
		api_game.set_goal("goal_15_6")
		api_game.play_anim(0,"fifth_object","quest_anim",0.5,1)
		api_game.play_anim(0,"fifth_object_full","quest_anim",0.5,0)
		
				 
def on_stop_anim(object_name, anim_name, p_object, i_track):	
	if object_name == "fourth_object":
		api_game.game_win()
