#include "..\global\game.scr"


---Èìÿ ñöåíû---
[if not_WAS_YELLOW]
	[print_on_imgbox $SCENE_NAME,title YELLOW 16,40,10,40]
	[add_path_dot YELLOW 0 30,-70]
	[add_path_dot YELLOW 100 30,-70]
	[add_path_dot YELLOW 120 30,0]
	[add_path_dot YELLOW 130 30,10]
	[add_path_dot YELLOW 140 30,0]
	[start_path YELLOW]
	[note WAS_YELLOW]
	[timer YELLOW 750]
[endif]

[if YELLOW_time_out]
	[add_path_dot YELLOW 0 30,0]
	[add_path_dot YELLOW 5 30,10]
	[add_path_dot YELLOW 25 30,-70]
	[start_path YELLOW]
[endif]



[once timer after_start 200]

[if after_start_time_out]
	[if not_task_05_02_played]
		[once play_scene dialog_05a]
		[once lock]
	[endif]
[endif]

[if dialog_dialog_05a_done]
		[once unlock]
		[once task $task01]
[endif]



Ïóñòûøêè äëÿ òåêñòà:

[if n_switch_is_clicked and not_LIGHT_05]
	[start_ps_emit a_ps_motes]
	[move obj_switch 550 318 50]
	[rescale door_light_glow 1 1]
	[fade_in door_light 10]
	[to_front obj_key]
	[put obj_flashlight over door_light]
	[put obj_mousetrap over door_light]
	[note LIGHT_05]
	[dont_highlight n_switch]
	[to_front n_switch][add_ps n_switch "psystem/ispy_c.ps" center] [set_ps_play_time n_switch 100][fast_stretch n_switch off][play_sound switcher][play_sound Ispy][play_ps n_switch]
	[once lock][once timer after_lights 40]
	[highlight obj_flashlight]
														[do_hint_matrix task_01 1]
	[highlight n_electro]		
	[ highlight n_wrench]		
	[ highlight n_sign]		
	[highlight n_keys]		
	[ highlight n_valve]		
	[highlight n_mousetrap]	
	[highlight n_hole]		
	[ highlight n_pipes]
	[hide n_dark_say_01][hide n_dark_say_02][hide n_dark_say_03][hide n_dark_say_04]
[endif]

[if after_lights_time_out]
	[once play_scene dialog_05c]
[endif]

[if dialog_dialog_05c_done]
	[once timer after_dialog_05c 50]
[endif]

[if after_dialog_05c_time_out]
	[if not_task_05_04_played]
		[once task $task02]
		[save task_05_03_played]
	[endif]
	[once unlock]
[endif]


[if obj_flashlight_is_clicked]
	[pause_fading fx_flashlight]
	[hide fx_flashlight]
	[pause_fading blink]
	[hide blink]
	[fade_out obj_flashlight 10]
	[note FLASHLIGHT_TAKEN]
	[hide n_dark_say_01][hide n_dark_say_02][hide n_dark_say_03][hide n_dark_say_04]
[endif]


[if not_LIGHT_05]
	[if n_dark_say_01_is_clicked or n_dark_say_02_is_clicked or n_dark_say_03_is_clicked or n_dark_say_04_is_clicked]
		[say $say13]
	[endif]
[endif]

[if LIGHT_05]
	[once start_ps_emit a_ps_motes]
	[once put obj_water over door_light]
	[once highlight n_sign]
	[once put obj_mousetrap over door_light]

	[once to_front_real bullet03] 
	[once to_front_real bullet02]                          
	[once to_front_real bullet05] 

	[if n_pipes_is_clicked]
		[say $say03]
	[endif]

	[if n_sign_is_clicked]
		[say $say04]
	[endif]

	[if n_valve_is_clicked and ELECTRO_DONE]
		[if VALVE_FREE]
			[pick_up obj_valve as inv_valve]
			[dont_highlight n_valve]
			[do_hint_matrix task_04 3]
			[goto @VALVE_FREE]
		[endif]
		[say $say05]
		[@VALVE_FREE]
	[endif]

	[if n_keys_is_clicked and not_MOUSE_GO]
		[once move obj_key 479, 390 25]
		[once timer before_mouse_t 40]
		[dont_highlight n_keys]
		[do_hint_matrix task_03 1][play_sound key]
	[endif]

	[if before_mouse_t_time_out]
		[fade_in obj_mouse 0.1]
		[move obj_mouse 478, 400 30]
		[note MOUSE_GO]
	[endif]

	[check obj_mouse is_moving][check obj_mouse2 is_moving][

	[if not_obj_mouse2_is_moving and MOUSE_GO_GO]
		[fade_out obj_mouse2 10]
	[endif]

	[if not_obj_mouse_is_moving and MOUSE_GO and not_MOUSE_GO_GO]
		[once say $say06]
		[fade_out obj_mouse 10]
		[fade_in obj_mouse2 10]
		[hide obj_key]

		[move obj_mouse2 578, 390 30][play_sound mouse]
		[note MOUSE_GO_GO]
		[delay 50 show obj_eyes]
		[delay 50 play_anim obj_eyes 250 looped]
	[endif]



	[if n_electro_is_clicked]
		[say $say07]
	[endif]

	[ if n_hamburger_is_clicked]
		[ say $say08]
		[ pick_up n_hamburger as inv_hamburger]
															[ do_hint_matrix task_03 3]
	[ endif]

	[if n_hole_is_clicked]
		[if MOUSE_GO_GO]
				[if MOUSETRAP_SET and not_CHEEZE_TAKEN]
					[once lock]
					[once play_scene dialog_05b]
					[goto @MOUSE]
				[endif]
			[say $say10]
			[goto @MOUSE]
		[endif]
		[say $say09]
		[@MOUSE]
	[endif]


	///////////////ÏÅÐÅÕÎÄ ÍÀ ÀÉÑÏÀÉ ÏÎÈÑÊÈ ÑÛÐÀ///////////////////////

	[if dialog_dialog_05b_done]
		[once unlock]
		[switch images\Scene_05_ISPY\]
	[endif]

	[if LEVEL_05_ISPY_DONE and not_ELECTRO_DONE and not_ELECTRODAN]
		[once]
		[pick_up n_hamburger as inv_hamburger]
		[hide n_mousetrap]
		[note CHEEZE_TAKEN]				[do_hint_matrix task_03 3]
		[hint HINT1 any 300 100]
		[if not_WATER_DONE][task $task02][endif]
		[endo]
	[endif]


	[if n_wrench_is_clicked and ELECTRO_DONE]
		[pick_up obj_wrench as inv_wrench]
		[rescale n_wrench 0 0]
		[do_hint_matrix task_04 1]
	[endif]

	[if n_mousetrap_is_clicked]
		[pick_up obj_mousetrap as inv_mousetrap]
		[hide n_mousetrap]
		[do_hint_matrix task_03 2]
	[endif]

	[if inv_mousetrap_on_n_hole]
                [add_ps n_hole "psystem/ispy_s.ps" center] [set_ps_play_time n_hole 100][fast_stretch n_hole off][play_sound win_small][play_ps n_hole][ps_to_front n_hole]
		[fade_in obj_mousetrap2 10]
		[drop inv_mousetrap][deinvent inv_mousetrap][fade_out inv_mousetrap 0.2]
		[note MOUSETRAP_SET]											[do_hint_matrix task_03 3]
	[endif]

	[if inv_hamburger_on_n_hole]
		[drop inv_hamburger][deinvent inv_hamburger][fade_out inv_hamburger 10][play_sound dmouse]
		[once timer before_key_t 40]										[do_hint_matrix task_03 4]
	[endif]

	[if inv_mousetrap_on_inv_hamburger or inv_hamburger_on_inv_mousetrap]
		[deinvent inv_mousetrap][fade_out inv_mousetrap 10]
		[deinvent inv_hamburger][fade_out inv_hamburger 10]
		[fade_in inv_mousetrap_hamburger 10][invent inv_mousetrap_hamburger]
	[endif]

	[if inv_mousetrap_hamburger_on_n_hole]
		[fade_out inv_mousetrap_hamburger 10][play_sound dmouse]
		[once timer before_key_t 40][do_hint_matrix task_03 4]
	[endif]

	///////////////ÏÅÐÅÕÎÄ ÍÀ ÌÈÍÈÈÃÐÓ ÝËÅÊÒÐÎÑÕÅÌÀ///////////////////////
	[if inv_key_on_n_electro]
		[drop inv_key][deinvent inv_key][fade_out inv_key 0.2][play_sound safe]
		[do_hint_matrix task_03 5]
		[switch images\scene_05_MG\]
	[endif]

		[if  ELECTRODAN]
			[lock]
			[delay 200 play_scene dialog_05e]
			[if not_task_05_05_played]
				[ once task $task03]
				[once save task_05_04_played]
			[endif]
			[hint HINT1 any 300 100]
			[fade_out n_electro 5]
			[add_ps n_electro "psystem/ispy_s.ps" center] [set_ps_play_time n_electro 100][fast_stretch n_electro off][play_sound win_small][play_ps n_electro]
			[save ELECTRO_DONE]
			[forget ELECTRODAN]
			[move_spliter 0 50]
		[endif]

	[if dialog_dialog_05e_done]
		[once unlock]
		[once task $task03]
	[endif]


	[if before_key_t_time_out]
		[pick_up n_hole as inv_key]
		[add_ps obj_eyes "psystem/ispy_s.ps" center] [set_ps_play_time obj_eyes 100][fast_stretch obj_eyes off][play_sound win_small][play_ps obj_eyes]
		[fade_out obj_eyes 10]
	[endif]

	[if inv_valve_on_n_pipes]
		[fade_in obj_valve2 0.1]
		[add_ps obj_valve2 "psystem/ispy_s.ps" center] [set_ps_play_time obj_valve2 100][fast_stretch obj_valve2 off][play_sound valve][play_sound win_small][play_ps obj_valve2]
		[drop inv_valve][deinvent inv_valve][fade_out inv_valve 0.2]
		[rescale n_pipes 0 0]
		[note WATER_DONE]
		[do_hint_matrix task_04 4]
	[endif]




	[if WATER_DONE and ELECTRO_DONE] 
		[once lock]
		[once delay 100 play_scene dialog_05d]
	[endif]

	[if dialog_dialog_05d_done]
		[once unlock]
		[once happy_end]
	[endif]

	[if inv_wrench_on_n_valve]
		[fade_out obj_valve_nut 0.1]
		[add_ps obj_valve_nut "psystem/ispy_kree.ps" center] [set_ps_play_time obj_valve_nut 100][fast_stretch obj_valve_nut off][ps_to_front it][play_sound valve][play_ps obj_valve_nut]
		[drop inv_wrench][deinvent inv_wrench][fade_out inv_wrench 0.2]
		[note VALVE_FREE]
		[do_hint_matrix task_04 2]
	[endif]

[endif]

[if FLASHLIGHT_TAKEN]
	[tport dark {mouse_x-dark_w/2} {mouse_y-dark_h/2}]
[endif]

///loading\\\

[if LEVEL_05_ISPY_DONE and not_ELECTRODAN]
	[once]
	[note FLASHLIGHT_TAKEN]
	[hide obj_key]
	[hide obj_flashlight]
	[hide obj_mousetrap]
	[show obj_mousetrap2]
	[show door_light]

	[show door_light_glow][rescale it 1 1][resume_fading it]

	[hide fx_flashlight][pause_fading it]
	[hide blink][tport it 800,800]

	[show obj_eyes][play_anim obj_eyes 250 looped]

	[highlight n_electro]				
	[highlight n_mousetrap]	
	[highlight n_hole]		

	
	[endo]
[endif]

[if ELECTRO_DONE]
	[once]
	[note FLASHLIGHT_TAKEN]
	[hide obj_key]
	[hide obj_flashlight]
	[hide obj_mousetrap]
	[show obj_mousetrap2]
	[hide n_mousetrap]
	[hide n_electro]
	[hide n_keys]

	[show door_light]

	[show door_light_glow][rescale it 1 1][resume_fading it]

	[hide fx_flashlight][pause_fading it]
	[hide blink][tport it 800,800]

	[hide obj_eyes]

	[dont_highlight n_switch]
	[highlight n_wrench]		
	[highlight n_sign]		
	[highlight n_valve]		
	[highlight n_pipes]
	[endo]
[endif]

