// Merged version of game_sounds_weapon_portalgun and game_sounds_player_portal2,
// using ported P1 sounds instead.
// We have to remove the original script from the manifest to use a custom one, 
// so this includes both.
// Portal 2 has most of the original sounds, but they aren't used.

"Weapon_Portalgun.fire_blue"
{
	"channel"       "CHAN_STATIC"
	"volume"        "0.7"
	"soundlevel"    "SNDLVL_GUNFIRE"
	"pitch"         "95,105"
	"wave"			"weapons/portalgun/portalgun_shoot_blue1.wav"

	"soundentry_version" "2"

	"operator_stacks"
	{
		"start_stack"
		{
			"import_stack" 	"P2_portalgun_start"

			"stop_gun"
			{
				"match_entry" "Portalgun.fire"
				"input_max_entries" "1.000000"
			}
		}
	}
}

"Weapon_Portalgun.fire_blue_npc"
{
	"channel"		"CHAN_STATIC"
	"volume"		"0.7"
	"soundlevel"    "SNDLVL_GUNFIRE"
	"pitch"			"95,105"
	"wave"			"^weapons/portalgun/portalgun_shoot_blue1.wav"

	"soundentry_version" "2"

	"operator_stacks"
	{
		"start_stack"
		{
			"import_stack" 	"P2_portalgun_start"

			"stop_gun"
			{
				"match_entry" "Portalgun.fire"
				"input_max_entries" "1.000000"
			}
		}
	}
}

"Weapon_Portalgun.fire_red"
{
	"channel"		"CHAN_STATIC"
	"volume"		"0.7"
	"soundlevel"		"SNDLVL_GUNFIRE"
	"pitch"			"95,105"
	"wave"			"weapons/portalgun/portalgun_shoot_red1.wav"

	"soundentry_version" "2"

	"operator_stacks"
	{
		"start_stack"
		{
			"import_stack" 	"P2_portalgun_start"

			"stop_gun"
			{
				"match_entry" "Portalgun.fire"
				"input_max_entries" "1.000000"
			}
		}
	}
}

"Weapon_Portalgun.fire_red_npc"
{
	"channel"		"CHAN_STATIC"
	"volume"		"0.7"
	"soundlevel"		"SNDLVL_GUNFIRE"
	"pitch"			"95,105"
	"wave"			"^weapons/portalgun/portalgun_shoot_red1.wav"

	"soundentry_version" "2"

	"operator_stacks"
	{
		"start_stack"
		{
			"import_stack" 	"P2_portalgun_start"

			"stop_gun"
			{
				"match_entry" "Portalgun.fire"
				"input_max_entries" "1.000000"
			}
		}
	}
}

"Weapon_Portalgun.powerup"
{
	"channel"		"CHAN_WEAPON"
	"volume"		"0.7"
	"soundlevel"		"SNDLVL_90db"
	"pitch"			"95,105"
	// Same as P1 sound
	"wave"			"weapon_ambient/wpn_portalgun_activation_01.wav"

	"soundentry_version" "2"

	"operator_stacks"
	{
		"start_stack"
		{
			"import_stack"	"P2_null_player_start"
			
			"play_entry"
			{
				"entry_name" "Portal.PortalgunActivate" //Replace with the sound you want to play.
			}
		}
	}
}

"Weapon_Portalgun.HoldSound"
{
	"channel"		"CHAN_STATIC"
	"volume"		"1.0"
	"soundlevel"		"SNDLVL_50db"
	"pitch"			"50"
	"wave"			"player/hold_loop.wav"
}


// Portal sounds

"Portal.open_red"
{
	"channel"		"CHAN_ITEM"
	"volume"		"0.6"
	"soundlevel"		"SNDLVL_80db"
	"pitch"			"95,105"
	"rndwave"
	{
		"wave"			"weapons/portalgun/portal_open2.wav"
		"wave"			"weapons/portalgun/portal_open3.wav"
	}
	
	"soundentry_version" "2"

	"operator_stacks"
	{
		"start_stack"
		{
			"import_stack" 	"P2_exclusion_time_and_poly_limiting_start"

			"limit_sound"
			{
				"match_entry" "Portal.open"
				"input_max_entries" "1.000000"
				"match_substring" "true"
			}
				
			"block_entries"
			{
				
				"match_entry" "Portal.open_red" //The sound entry to use
				"input_duration" "0.1" //in seconds
			}
		}
	}
}

// Disable this sound!
"Portal.red_rock"
{
	"wave"	"common/null.wav"
	"soundentry_version" "2"

	"operator_stacks"
	{
		"start_stack"
		{
			"import_stack" "P2_null_start"
			"get_random_null"
			{
				"input_execute" "0.0"	
			}
			
			"percent_null"
			{
				"input1" "0.60" // This is the percentage chance to play a null
			}

			"block_start"
			{	
				"input_execute" "1.0"
			}
		}
	}
}

"Portal.open_blue"
{
	"channel"		"CHAN_ITEM"
	"volume"		"0.6"
	"soundlevel"		"SNDLVL_80db"
	"pitch"			"95,105"

	"wave"			"weapons/portalgun/portal_open1.wav"

	"soundentry_version" "2"

	"operator_stacks"
	{
		"start_stack"
		{
			"import_stack" 	"P2_exclusion_time_and_poly_limiting_start"

			"limit_sound"
			{
				"match_entry" "Portal.open"
				"input_max_entries" "1.000000"
				"match_substring" "true"
			}
				
			"block_entries"
			{
				
				"match_entry" "Portal.open_blue" //The sound entry to use
				"input_duration" "0.1" //in seconds
			}
		}
	}
}

"Portal.close_red"
{
	"channel"		"CHAN_BODY"
	"volume"		"0.6"
	"soundlevel"		"SNDLVL_80db"
	"pitch"			"95,105"
	"wave"			"weapons/portalgun/portal_close2.wav"

}

"Portal.close_blue"
{
	"channel"		"CHAN_BODY"
	"volume"		"0.6"
	"soundlevel"		"SNDLVL_80db"
	"pitch"			"95,105"

	"wave"			"weapons/portalgun/portal_close1.wav"
}

"Portal.ambient_loop"
{
	"channel"		"CHAN_STATIC"
	"volume"		"0.4" // This is very loud..
	"soundlevel"	"SNDLVL_70db"
	"pitch"			"100"
	"wave"			"BEE2/p1/pgun/ambient.wav"
}

"Portal.fizzle_moved"
{
	"channel"		"CHAN_ITEM"
	"volume"		"0.45"
	"soundlevel"		"SNDLVL_105db"
	"pitch"			"95,105"
	"wave" "weapons/portalgun/portal_fizzle2.wav"
}

"Portal.InvalidSurfaceSwt"
{
	"channel"		"CHAN_STATIC"
	"volume"		"0.6"
	"soundlevel"		"SNDLVL_115db"
	"pitch"			"95,105"
	"rndwave"
	{
		"wave"			"weapon_ambient/portal_invalid_surface_swt_01.wav"
	}
}

"Portal.fizzle_invalid_surface"
{
	"channel"		"CHAN_ITEM"
	"volume"		"0.5"
	"soundlevel"		"SNDLVL_90db"
	"pitch"			"95,105"
	"wave"			"weapons/portalgun/portal_invalid_surface3.wav"

	"soundentry_version" "2"

	"operator_stacks"
	{
		"start_stack"
		{
			"import_stack" 	"P2_exclusion_time_and_poly_limiting_start"

			"limit_sound"
			{
				"match_entry" "Portal.fizzle_invalid_surface"
				"input_max_entries" "1.000000"
				"match_substring" "true"
			}
				
			"block_entries"
			{
				"match_entry" "Portal.fizzle_invalid_surface" //The sound entry to use
				"input_duration" "0.1" //in seconds
			}
		}	
	}
}

"PortalPlayer.EnterPortal"
{
	"channel"		"CHAN_STATIC"
	"volume"		"0.8"
	"soundlevel"		"SNDLVL_70db"
	"pitch"			"95,105"
	"rndwave"
	{
		"wave" "BEE2/p1/pgun/portal_enter1.wav"
		"wave" "BEE2/p1/pgun/portal_enter2.wav"
	}
	"soundentry_version" "2"

	"operator_stacks"
	{
		"update_stack"
		{
			"import_stack" "p2_update_default"

			"source_info"
			{
				// "source"   "entity"
				"source"   "emitter"
			}
		}
	}

}

"PortalPlayer.ExitPortal"
{
	"channel"		"CHAN_STATIC"
	"volume"		"0.8"
	"soundlevel"		"SNDLVL_70db"
	"pitch"			"95,105"
	"rndwave"
	{
		"wave" "BEE2/p1/pgun/portal_exit1.wav"
		"wave" "BEE2/p1/pgun/portal_exit2.wav"
	}
	"soundentry_version" "2"

	"operator_stacks"
	{
		"update_stack"
		{
			"import_stack" "p2_update_default"

			"source_info"
			{
				// "source"   "entity"
				"source"   "emitter"
			}
		}
	}
}

"Portal.FizzlerShimmy"
{
	"channel"		"CHAN_STATIC"
	"volume"		"0.8"
	"soundlevel"		"SNDLVL_90db"
	"pitch"			"95,105"
	"rndwave"
	{
		"wave"			"weapons/portalgun/portal_fizzle2.wav"
	}
}

"Portal.PortalgunActivate"
{
	"channel"		"CHAN_STATIC"
	"volume"		"0.9"
	"soundlevel"		"SNDLVL_90db"
	"pitch"			"95,105"
	"rndwave"
	{
		"wave"			"weapon_ambient/wpn_portalgun_activation_01.wav"
	}

	"soundentry_version" "2"

	"operator_stacks"
	{
		"start_stack"
		{
			"import_stack"	"P2_exclusion_time_blocker_start"
			
			"block_entries" 
			{
				"input_duration" "0.5"
				"match_entry" "Portal.PortalgunActivate" //The sound entry to use
				"match_entity" "true"
			}
		}
		
		"update_stack"
		{
			"import_stack"	"p2_offset_start_update"
		
			"time_elapsed_trigger"
			{
				"input2" "0.25" //Elapsed time in seconds goes here.
			}
		
			"play_entry"
			{
				"entry_name" "World.RobotMetalPillShortQuiet"	
			}
		}
	}
}

////////////////////////////////////
// PORTAL 1 PLAYER PORTAL
////////////////////////////////////
"PortalPlayer.BonkYelp"
{
	"channel"		"CHAN_VOICE"
	"volume"		"0.4,0.6"
	"pitch"			"95,105"

	"soundlevel"	"SNDLVL_IDLE"

	"rndwave"
	{
		"wave"	"common/null.wav"
	}

	"soundentry_version" "2"

	"operator_stacks"
	{
		"start_stack"
		{
			"import_stack" "P2_null_start" //replaces null.wav
	
			"get_random_null"
			{
				"input_execute" "0.0"	
			}
			
			"percent_null"
			{
				"input1" "0.60" // This is the percentage chance to play a null
			}

			"block_start"
			{	
				"input_execute" "1.0"
			}
		}
	}
}

"PortalPlayer.PainYelp"
{
	"channel"		"CHAN_VOICE"
	"volume"		"0.4,0.6"
	"pitch"			"95,105"

	"soundlevel"	"SNDLVL_IDLE"

	"rndwave"
	{
		"wave"	"common/null.wav"
	}

	"soundentry_version" "2"

	"operator_stacks"
	{
		"start_stack"
		{
			"import_stack" "P2_null_start" //replaces null.wav
	
			"get_random_null"
			{
				"input_execute" "0.0"	
			}
			
			"percent_null"
			{
				"input1" "0.60" // This is the percentage chance to play a null
			}

			"block_start"
			{	
				"input_execute" "1.0"
			}
		}
	}
}

"PortalPlayer.Woosh"
{
	"channel"		"CHAN_STATIC"
	"volume"		"1.00"
	"soundlevel"		"SNDLVL_85dB"
	"pitch"			"100"
	// P1 sound..
	"wave"			"player/fling_whoosh.wav"
}

"PortalPlayer.WooshWooshyWoosh"
{
	"channel"		"CHAN_STATIC"
	"volume"		"1.00"
	"soundlevel"		"SNDLVL_85dB"
	"pitch"			"100"
	"wave"			"player/fling_whoosh.wav"

	"soundentry_version" "2"

	"operator_stacks"
	{
		"update_stack"
		{
			"import_stack" "p2_update_default"         
			
			"volume_apply_occlusion"
			{
				"input2" "1.0"
			}
			
			"volume_apply_falloff"
			{
				"input2" "1.0"
			}
		}
	}
}

"PortalPlayer.FallRecover"
{
	"channel"	"CHAN_STATIC"
	"volume"	"1.0"
	"pitch"		"95,105"
	"soundlevel"	"SNDLVL_NORM"

	"rndwave"
	{
		// "wave"		"player/footsteps/longfall_land_01.wav"
		// "wave"		"player/footsteps/longfall_land_02.wav"
		// "wave"		"player/footsteps/longfall_land_03.wav"
		"wave"		"player/futureshoes1.wav"
		"wave"		"player/futureshoes2.wav"
	}
}

"Player.Coop_Ping"
{
	"channel"		"CHAN_STATIC"
	"volume"		"0.4"
	"pitch"			"PITCH_NORM"

	"soundlevel"	"SNDLVL_NONE"

	"wave"	"npc/roller/mine/rmine_chirp_quest1.wav"
}

// There isn't a stop-use sound in P1.
"PortalPlayer.ObjectUseStop"
{
	"channel"		"CHAN_ITEM"
	"soundlevel"  "SNDLVL_75dB"
	"volume"		"0.5"
	"rndwave"
	{
		"wave"	"common/null.wav"
	}

	"soundentry_version" "2"

	"operator_stacks"
	{
		"start_stack"
		{
			"import_stack" "P2_null_start" //replaces null.wav
	
			"get_random_null"
			{
				"input_execute" "0.0"	
			}
			
			"percent_null"
			{
				"input1" "0.60" // This is the percentage chance to play a null
			}

			"block_start"
			{	
				"input_execute" "1.0"
			}
		}
	}
}

"PortalPlayer.ObjectUse"
{
	"channel"		"CHAN_ITEM"
	"soundlevel"  "SNDLVL_75dB"
	"volume"		"1"
	"wave"		"player/hold_loop.wav"

	"soundentry_version" "2"

	"operator_stacks"
	{
		"update_stack"
		{
			"import_stack"	"p2_update_default_pitch_ramp"

			"volume_fade_in"
			{
				"input_max" "0.15" //fade in time
			}			
			
			"volume_fade_out"
			{
				"input_max" "0.7" //fade out time
			}
			
			"pitch_fade_in"
			{
				"input_map_min" "0.7" //pitch to fade in from
				"input_map_max" "1.0" //pitch to fade in to
				"default_to_max" "false"	
			}
			
			"save_restore_output"
			{
				"operator" "sys_output"
				"execute_once" "true"
				"input_float" "1.0"
				"output" "save_restore"
			}
		}
		// No cancelling sound!
	}
}


"PortalPlayer.UseDeny"
{
	"channel"	"CHAN_ITEM"
	"volume"	"0.3"
	"soundlevel"  "SNDLVL_75dB"

	"wave"	"common/wpn_denyselect.wav"
}

"PortalPlayer.ObjectUseNoGun"
{
	"channel"		"CHAN_ITEM"
	"soundlevel"  "SNDLVL_75dB"
	"volume"		"0.00"
	"wave"		"common/wpn_select.wav"
}

"PortalPlayer.UseDenyNoGun"
{
	"channel"	"CHAN_ITEM"
	"volume"	"0.15"
	"soundlevel"  "SNDLVL_75dB"

	"wave"	"common/wpn_denyselect.wav"
}
