View Issue Details

IDProjectCategoryView StatusLast Update
0003859The Dark ModScript/Defpublic22.12.2018 09:42
Reportertels Assigned To 
PrioritynormalSeveritynormalReproducibilityalways
Status suspendedResolutionsuspended 
Summary0003859: Location settings script object always manipulates the ambient light
DescriptionThe script object attached to the "atdm:location_settings" entity will always modify the main ambient light, even when this is not nec. (f.i. when there are no dynamic parts and a script wants to control the ambient light in a location).
TagsNo tags attached.
Attached Files
ambient_fade_test.pk4 (31,122 bytes)
tels_patch_i_ambient_fade_2014-09-22.txt (13,347 bytes)   
--- /home/te/games/tdm/def/misc.def.org	2014-04-25 21:06:08.000000000 +0200
+++ /home/te/games/tdm/def/misc.def	2014-09-22 11:42:24.000000000 +0200
@@ -137,6 +137,8 @@
 	"editor_float ambient_light_fade_time"	"Time in seconds to fade the ambient light to the new color."
 	"editor_float fade_time"				"Time in seconds to fade the ambient music/sound to the new sound."
 	"editor_vector ambient_light_dynamic_cap"	"Cap the dynamic part of the ambient light at these values.  Default is 0.1 0.1 0.1, but other settings can be useful - for instance 0.2 0.05 0.05 in a reddish cave, etc."
+	"editor_vector ambient_light_dynamic"	"The factor to multiply light sources in the current PVS to compute the dynamic part of the ambient light.  Default is 0.1 0.1 0.1, but other settings can be useful - for instance 0.2 0.05 0.05 in a reddish cave, etc. See also 'ambient_light_dynamic_cap'."
+	"editor_bool no_ambient_light_fade"	"If set to 1, the main ambient light will not be modified. Can be overriden in each location with 'no_ambient_light_fade' '0' and defaults to 0."
 
 	"editor_float ambient_light_falloff"		"Selects the falloff adjustment for the lights in the current area based on their distance.  Possible values: 0 = no falloff with distance, 0.5 = sqrt(distance), 1 = linear falloff, 2 = squared falloff.  1 looks best.  This setting can be overriden for each location on the 'info_location' entity.  See also 'ambient_light_dist_scale'."
 	"editor_float ambient_light_dist_scale"		"An adjustment factor for the distance-based falloffs (if 'ambient_light_falloff' is > 0).  Values around 1.0 look best.  Can be overriden for each location on the 'info_location' entity."
@@ -146,6 +148,7 @@
 
 	"editor_setkeyValue ambient_light_falloff"	"0"
 	"editor_setkeyValue ambient_light_dist_scale"	"1.0"
+	"editor_setkeyValue no_ambient_light_fade"	"0"
 
 	"ambient_light_dynamic_cap"	"0.1 0.1 0.1"
 	"editor_setkeyValue ambient_light_dynamic_cap"	"0.1 0.1 0.1"
@@ -203,13 +206,16 @@
 	"editor_var call_once_on_exit"			"Name of global script function to be called exactly once when the player exits this zone."
 	"editor_var call_once_on_entry"			"Name of global script function to be called exactly once when the player enters this zone."
 
-	"editor_var ambient_light_dynamic"		"Factor to multiply the sum of all light sources in this location by before adding them to the 'ambient_light'.  Set to '0 0 0' to disable dynamic ambient light for this location.  Defaults to '0.01 0.01 0.01'."
+	"editor_vector ambient_light_dynamic"		"Factor to multiply the sum of all light sources in this location by before adding them to the 'ambient_light'.  Set to '0 0 0' to disable dynamic ambient light for this location.  Defaults to '0.01 0.01 0.01'."
 
 	"editor_float ambient_light_falloff"		"Selects the falloff adjustment for the lights in the current area based on their distance.  Possible values: -1 = use setting from your atdm:location_settings entity, 0 = no falloff with distance, 0.5 = sqrt(distance), 1 = linear falloff, 2 = squared falloff.  1 looks best.  See also 'ambient_light_dist_scale'."
 	"editor_float ambient_light_dist_scale"		"An adjustment factor for the distance-based falloffs (if 'ambient_light_falloff' is > 0).  Values around 1.0 look best.  A value of -1 uses the value from your atdm:location_settings entity."
 
 	"editor_vector ambient_light_dynamic_cap"	"Cap the dynamic part of the ambient light at these values.  Default is 0.1 0.1 0.1, but other settings can be useful, for instance 0.2 0.05 0.05 in a reddish cave, etc."
 
+	"editor_bool no_ambient_light_fade"	"If set to 1, the main ambient light will not be modified when inside this location. If set to '-1', use setting from your atdm:location_settings entity."
+	"editor_setkeyValue no_ambient_light_fade"	"-1"
+
 	"ambient_light_falloff"		"-1"		// use atdm:location settings
 	"ambient_light_dist_scale"	"-1"		// use atdm:location settings
 
--- /home/te/games/tdm/script/tdm_location_settings.script.org	2013-12-06 18:23:58.000000000 +0100
+++ /home/te/games/tdm/script/tdm_location_settings.script	2014-09-22 12:43:07.000000000 +0200
@@ -60,6 +60,7 @@
 	float music_volume;
 
 	/* Tels: Additional members for the ambient light changing: */
+	boolean m_al_no_fade;	
 	float   m_al_fade_time;	
 	float   m_al_fade_time_default;
 
@@ -129,7 +130,13 @@
 	music_volume = (sys.strToFloat( sys.getcvar("tdm_music_volume") ) + 40) / 40;
 
 	/* Tels: Init the ambient light part: */
-
+	m_al_no_fade = false;
+	if (getBoolKey( "no_ambient_light_fade" ))
+	{
+		m_al_no_fade = true;
+		sys.println ("Global no_ambient_light_fade = true, will not fade the main ambient light.");
+		// but continue, because the current location might want to fade the light again
+	}
 	// the default time
 	m_al_fade_time_default = getFloatKey( "ambient_light_fade_time" );
 	// set a default
@@ -232,7 +239,7 @@
 // player entered new location, so update ambient base color and fade time/delay
 void speaker_zone_ambient::updateAmbientLight( entity locEnt )
 {
-	// sys.print( "Setting ambient in location " + locEnt.getName() );
+	// sys.println( "Setting ambient in location " + locEnt.getName() );
 	//sys.print( "Setting old base to '" + m_al_base + "'\n");
 
 	// store the current base and add the old dynamic so we don't experience a sudden drop/raise (bug #2326)
@@ -241,11 +248,10 @@
 	// fade to the new location's color
 	m_al_base_target = locEnt.getVectorKey("ambient_light");
 
-	// tels: can this be done simpler? == "0,0,0" doesn't work, tho
-	if (m_al_base_target_x == 0 && m_al_base_target_y == 0 && m_al_base_target_z == 0)
+	if (m_al_base_target == '0 0 0')
 	{
 		// no value found, use the default
-		// sys.print( "No new target, using default color '" + m_al_default_color + "'\n");
+		// sys.println( "No new target, using default color '" + m_al_default_color + "'");
 		m_al_base_target = m_al_default_color;
 	}
 
@@ -270,6 +276,46 @@
 	}
     // time that has elapsed going from base_old to base_target
 	m_al_fade_start = sys.getTime();
+
+	// See if we need to start or stop fading in this location
+	boolean no_fade = false;
+	string fade_key = locEnt.getKey("no_ambient_light_fade");
+	if (fade_key == "" || fade_key == "-" || fade_key == "-1")
+	{
+		// not defined, use the global setting
+		if (getBoolKey("no_ambient_light_fade"))
+		{
+			no_fade = true;
+		}
+	}
+	else
+	{
+		if (fade_key != "0")
+		{
+			no_fade = true;
+		}
+	}
+
+	// setting changed in this location?
+	if (no_fade && !m_al_no_fade)
+	{
+		sys.println ("speaker_zone_ambient: no_ambient_light_fade = true, stop fading ambient light.");
+		m_al_no_fade = true;
+		// If we stop fading the ambient light, at least set the ambient for the new zone, so we
+		// are not stuck with the old values. After this initial set here, the ambient light will be
+		// left alone and can be controlled by scripts:
+		m_al_fade_start = 0; 	// avoid a ambient_fade_time > 0 preventing this setting here
+		fadeAmbientLight();
+	}
+	else
+	{
+		if (!no_fade && m_al_no_fade)
+		{
+			sys.println ("speaker_zone_ambient: no_ambient_light_fade = false, start fading ambient light again.");
+			m_al_no_fade = false;
+		}
+	}
+
 }
 
 // compute the current base ambient light based on: old color, target color, elapsed time
@@ -376,68 +422,72 @@
 
 		// sys.println( "Ambient script check, music_volume " + music_volume + " in location " + locEnt.getName() );
 
-		// Tels: query here the ambient_light_dynamic factor:
-		vector dyn = locEnt.getVectorKey("ambient_light_dynamic");
-
-		if (dyn_x != 0 || dyn_y != 0 || dyn_z != 0)
+		// now fade the ambient light until the next update
+		if (!m_al_no_fade)
 		{
-			// save the old dynamic value for a smoother fade (bug #2327)
-			m_al_dynamic_old = m_al_dynamic;
+			// Tels: query here the ambient_light_dynamic factor:
+			vector dyn = locEnt.getVectorKey("ambient_light_dynamic");
 
-			// parameters: falloff, distance_scaling:
-			//  falloff == 0: no falloff with distance
-			//  falloff == 0.5: sqrt(linear) falloff	(dist 100 => 1/10)
-			//  falloff == 1: linear falloff			(dist 100 => 1/100)
-			//  falloff == 2: square falloff			(dist 100 => 1/10000)
-			//  distance scaling: factor to scale the distance, can be used to lower/raise distance factor
-			//   after the linear or square scaling has been used.
-			float falloff;
-		   	falloff	= locEnt.getFloatKey("ambient_light_falloff");		// default is 1
-			if (falloff == -1)
-			{
-				falloff = m_al_falloff_default;
-			}
-			float dynScale;
-			dynScale = locEnt.getFloatKey("ambient_light_dist_scale");
-			if (dynScale == -1)
-			{
-				dynScale = m_al_dist_scale_default;
-			}
-			// adjust the scaling so the mapper can always put 1.0 for every falloff
-			//  good looking: approx: sqrt(linear): 0.01, linear: 0.1, square 1.0
-			if (falloff == 0.5)
+			if (dyn != '0 0 0')
 			{
-				dynScale /= 100;	// 1.0 => 0.01
+				// save the old dynamic value for a smoother fade (bug #2327)
+				m_al_dynamic_old = m_al_dynamic;
+
+				// parameters: falloff, distance_scaling:
+				//  falloff == 0: no falloff with distance
+				//  falloff == 0.5: sqrt(linear) falloff	(dist 100 => 1/10)
+				//  falloff == 1: linear falloff			(dist 100 => 1/100)
+				//  falloff == 2: square falloff			(dist 100 => 1/10000)
+				//  distance scaling: factor to scale the distance, can be used to lower/raise distance factor
+				//   after the linear or square scaling has been used.
+				float falloff;
+			   	falloff	= locEnt.getFloatKey("ambient_light_falloff");		// default is 1
+				if (falloff == -1)
+				{
+					falloff = m_al_falloff_default;
+				}
+				float dynScale;
+				dynScale = locEnt.getFloatKey("ambient_light_dist_scale");
+				if (dynScale == -1)
+				{
+					dynScale = m_al_dist_scale_default;
+				}
+				// adjust the scaling so the mapper can always put 1.0 for every falloff
+				//  good looking: approx: sqrt(linear): 0.01, linear: 0.1, square 1.0
+				if (falloff == 0.5)
+				{
+					dynScale /= 100;	// 1.0 => 0.01
+				}
+				else if (falloff == 1)
+				{
+					dynScale /= 10;		// 1.0 => 0.1
+				}
+				vector light_in_pvs = $player1.getLightInPVS( falloff, dynScale );
+				m_al_dynamic_x = light_in_pvs_x * dyn_x; 
+				m_al_dynamic_y = light_in_pvs_y * dyn_y; 
+				m_al_dynamic_z = light_in_pvs_z * dyn_z;
+
+				// cap the value?
+				vector cap = locEnt.getVectorKey("ambient_light_dynamic_cap");
+				if (cap_x > 0 && m_al_dynamic_x > cap_x ) { m_al_dynamic_x = cap_x; }
+				if (cap_y > 0 && m_al_dynamic_y > cap_y ) { m_al_dynamic_y = cap_y; }
+				if (cap_z > 0 && m_al_dynamic_z > cap_z ) { m_al_dynamic_z = cap_z; }
+
+				//sys.print( " New dynamic ambient light cap is: '" + cap + "'. \n" );
+				// sys.print( " New dynamic ambient light is: '" + m_al_dynamic + "'. \n" );
+				//sys.print( " Old dynamic ambient light: '" + m_al_dynamic_old + "'. \n" );
 			}
-			else if (falloff == 1)
+			else // we entered a zone where the dynamic part is zero? avoid getting *stuck* at the old value
 			{
-				dynScale /= 10;		// 1.0 => 0.1
+				// save the old dynamic value for a smoother fade (bug #2327)
+				m_al_dynamic_old = m_al_dynamic;
+				// fade it to half the value, over time this will result in 0:
+				m_al_dynamic_x = m_al_dynamic_old_x / 2;
+				m_al_dynamic_y = m_al_dynamic_old_y / 2;
+				m_al_dynamic_z = m_al_dynamic_old_z / 2;
+				// sys.print( " dyn = 0 0 0, New dynamic ambient light is: '" + m_al_dynamic + "'. \n" );
 			}
-			vector light_in_pvs = $player1.getLightInPVS( falloff, dynScale );
-			m_al_dynamic_x = light_in_pvs_x * dyn_x; 
-			m_al_dynamic_y = light_in_pvs_y * dyn_y; 
-			m_al_dynamic_z = light_in_pvs_z * dyn_z;
-
-			// cap the value?
-			vector cap = locEnt.getVectorKey("ambient_light_dynamic_cap");
-			if (cap_x > 0 && m_al_dynamic_x > cap_x ) { m_al_dynamic_x = cap_x; }
-			if (cap_y > 0 && m_al_dynamic_y > cap_y ) { m_al_dynamic_y = cap_y; }
-			if (cap_z > 0 && m_al_dynamic_z > cap_z ) { m_al_dynamic_z = cap_z; }
-
-			//sys.print( " New dynamic ambient light cap is: '" + cap + "'. \n" );
-			// sys.print( " New dynamic ambient light is: '" + m_al_dynamic + "'. \n" );
-			//sys.print( " Old dynamic ambient light: '" + m_al_dynamic_old + "'. \n" );
-		}
-		else // we entered a zone where the dynamic part is zero? avoid getting *stuck* at the old value
-		{
-			// save the old dynamic value for a smoother fade (bug #2327)
-			m_al_dynamic_old = m_al_dynamic;
-			// fade it to half the value, over time this will result in 0:
-			m_al_dynamic_x = m_al_dynamic_old_x / 2;
-			m_al_dynamic_y = m_al_dynamic_old_y / 2;
-			m_al_dynamic_z = m_al_dynamic_old_z / 2;
-			// sys.print( " dyn = 0 0 0, New dynamic ambient light is: '" + m_al_dynamic + "'. \n" );
-		}
+		} // end no_ambient_light_fade
 
 		if( locEnt.getName() != m_prevLocation )
 		{
@@ -487,7 +537,7 @@
 				callGlobalFunction( call, m_prevLocationEnt );
 				}
 
-			/* Tels: Update the new ambient base color and fade times/delays */
+			/* Tels: Update the new ambient base color and fade times/delays, as well as m_al_no_fade */
 			updateAmbientLight( locEnt );
 
 			/* Ambient speaker code starts here: */
@@ -665,7 +715,10 @@
 		}
 
 		// now fade the ambient light until the next update
-		fadeAmbientLight();
+		if (!m_al_no_fade)
+	   	{
+			fadeAmbientLight();
+		}
 
 		wait( m_updatePeriod );
 	}
tels_patch_j_ambient_fade_2014-09-22.txt (8,154 bytes)   
--- /home/te/games/tdm/script/tdm_location_settings.script.ol2	2014-09-22 12:43:07.000000000 +0200
+++ /home/te/games/tdm/script/tdm_location_settings.script	2014-09-22 14:15:14.000000000 +0200
@@ -55,12 +55,14 @@
 	boolean speaker_on; 	// checks the turning on/off of channels so that channel-1 only gets turned off once when needed, first time after a transition (not every round)
 	float volumeFactor;		// A placeholder variable for the decibel-decimal conversion math
 	float db_factor;		// Pre-computes the conversion factor from ln to log2 for decibel conversion.
+	
+	boolean	m_invalid_zone;	// to run some actions only the first time we enter an invalid location
 
 	// Tels: save the old value of the tdm_music_volume CVAR so we can track when it changes in a location
 	float music_volume;
 
 	/* Tels: Additional members for the ambient light changing: */
-	boolean m_al_no_fade;	
+	boolean m_al_no_fade;
 	float   m_al_fade_time;	
 	float   m_al_fade_time_default;
 
@@ -98,14 +100,17 @@
 	void		RestoreScriptObject();
 	float		getCurrentVolume(entity locEnt);		// compute volume of current playing ambient from "volume" spawnarg and menu cvar
 	void		updateLoop();
-	void		updateAmbientLight( entity locEnt );
-	void		fadeAmbientLight();
+	void		updateAmbientLight( entity locEnt );						// update the settings on location change
+	void		fadeAmbientLight();											// compute new light color based on location and time
+	void		fadeAmbientLightColor(vector targetColor, float fadeTime);	// fade straight to the new color
 };
 
 void speaker_zone_ambient::init() 
 {
 	sys.println ("speaker_zone_ambient::init() called");
 
+	m_invalid_zone = false;
+
 	m_updatePeriod = getFloatKey( "update_period" );
 	// if == 0?
     if (m_updatePeriod < 0.001)
@@ -131,9 +136,11 @@
 
 	/* Tels: Init the ambient light part: */
 	m_al_no_fade = false;
+	boolean global_no_fade = false;
 	if (getBoolKey( "no_ambient_light_fade" ))
 	{
 		m_al_no_fade = true;
+		global_no_fade = true;
 		sys.println ("Global no_ambient_light_fade = true, will not fade the main ambient light.");
 		// but continue, because the current location might want to fade the light again
 	}
@@ -147,7 +154,6 @@
 
 	// grayman #3132 - the main ambient light doesn't have to be named 'ambient_world',
 	// so ask which one has been assigned the job, if any
-
 	entity ambientWorld = sys.getMainAmbientLight();
 	if ( ambientWorld != $null_entity )
 	{
@@ -168,7 +174,23 @@
 	m_al_dynamic_z = 0;
 	m_al_dynamic_old = m_al_dynamic;
 
-	updateAmbientLight( $player1.getLocation() );
+	entity curLoc = $player1.getLocation();
+	// skip if we start in an invalid zone
+	if (curLoc != $null_entity)
+	{
+		updateAmbientLight( curLoc );
+		if (global_no_fade && m_al_no_fade)
+		{
+			// we started in a location that has "no_ambient_light_fade", so set the value at least once
+			sys.println("Starting location has no_ambient_light_fade true, setting ambient light once to " + m_al_base_target);
+			vector al_def = curLoc.getVectorKey("ambient_light");
+			fadeAmbientLightColor( al_def, 0 );
+		}
+	}
+	else
+	{
+		m_invalid_zone = true;
+	}
 
 	// now run in a loop:
 	updateLoop();	
@@ -299,13 +321,15 @@
 	// setting changed in this location?
 	if (no_fade && !m_al_no_fade)
 	{
-		sys.println ("speaker_zone_ambient: no_ambient_light_fade = true, stop fading ambient light.");
+		sys.println ("speaker_zone_ambient: no_ambient_light_fade = true, stopping fading ambient light.");
 		m_al_no_fade = true;
 		// If we stop fading the ambient light, at least set the ambient for the new zone, so we
 		// are not stuck with the old values. After this initial set here, the ambient light will be
 		// left alone and can be controlled by scripts:
-		m_al_fade_start = 0; 	// avoid a ambient_fade_time > 0 preventing this setting here
-		fadeAmbientLight();
+		m_al_base = m_al_base_target;
+		// avoid getting stuck at the old dynamic value
+		m_al_dynamic = '0 0 0';
+		fadeAmbientLightColor( m_al_base, m_updatePeriod * 2 );	// avoid too abrupt changes
 	}
 	else
 	{
@@ -317,6 +341,33 @@
 	}
 
 }
+	
+// fade the ambient light to the new color (or set it for "fast ambient")
+void speaker_zone_ambient::fadeAmbientLightColor(vector targetColor, float fadeTime)
+{
+	if ( sys.getcvar("tdm_ambient_method") == "0")
+	{
+		// grayman #3132 - retrieve the main ambient light
+		entity ambientWorld = sys.getMainAmbientLight();
+		if ( ambientWorld != $null_entity )
+		{
+			ambientWorld.fadeToLight( targetColor, fadeTime );
+		}
+	}
+    // Tels: if the "fast ambient" method is used, do not fade the light, or
+    // 		 it would be turned on and interfere:
+    else
+	{
+		// C++ code has this:
+		// gameLocal.globalShaderParms[2] = ambient_color.x * 1.5f;
+		// gameLocal.globalShaderParms[3] = ambient_color.y * 1.5f;
+		// gameLocal.globalShaderParms[4] = ambient_color.z * 1.5f;
+		// so do the same here:
+		sys.setShaderParm( 2, targetColor_x * 1.5 );
+		sys.setShaderParm( 3, targetColor_y * 1.5 );
+		sys.setShaderParm( 4, targetColor_z * 1.5 );
+	}
+}
 
 // compute the current base ambient light based on: old color, target color, elapsed time
 void speaker_zone_ambient::fadeAmbientLight( )
@@ -359,41 +410,16 @@
 		}
 	}
 
-    // Tels: if the "fast ambient" method is used, do not fade the light, or
-    // 		 it would be turned on and interfere:
-	if ( sys.getcvar("tdm_ambient_method") == "0")
-	{
-		// this call will do nothing if the light is already at the right color
-		// fade the light until we update it next:
-		// bug #2326: if m_al_fade_time is shorter than m_updatePeriod, use it instead
-		float f_time = m_updatePeriod;
-		if (m_al_fade_time < f_time)
-		{
-			f_time = m_al_fade_time;
-		}
-		//sys.print( "Fading light to '" + m_al_base);
-		//sys.print( "' plus '" + m_al_dynamic );
-		//sys.print( "' in '" + f_time + "' seconds.\n");
-
-		// grayman #3132 - retrieve the main ambient light
-		entity ambientWorld = sys.getMainAmbientLight();
-		if ( ambientWorld != $null_entity )
-		{
-			ambientWorld.fadeToLight( m_al_base + m_al_dynamic, f_time );
-		}
-	}
-    else
-	{
-		// C++ code has this:
-		// gameLocal.globalShaderParms[2] = ambient_color.x * 1.5f;
-		// gameLocal.globalShaderParms[3] = ambient_color.y * 1.5f;
-		// gameLocal.globalShaderParms[4] = ambient_color.z * 1.5f;
-		// so do the same here:
-		vector al_combined = m_al_base + m_al_dynamic;
-		sys.setShaderParm( 2, al_combined_x * 1.5 );
-		sys.setShaderParm( 3, al_combined_y * 1.5 );
-		sys.setShaderParm( 4, al_combined_z * 1.5 );
-	}
+	// bug #2326: if m_al_fade_time is shorter than m_updatePeriod, use it instead
+	float f_time = m_updatePeriod;
+	if (m_al_fade_time < f_time)
+	{
+		f_time = m_al_fade_time;
+	}
+	//sys.print( "Fading light to '" + m_al_base);
+	//sys.print( "' plus '" + m_al_dynamic );
+	//sys.print( "' in '" + f_time + "' seconds.\n");
+	fadeAmbientLightColor( m_al_base + m_al_dynamic, f_time );
 /*
 	sys.print( "Old ambient light is: '" + m_al_base_old + "'. \n" );
 	sys.print( "New target ambient light is: '" + m_al_base_target + "'. \n" );
@@ -415,11 +441,30 @@
 		// bug #2326
 		if (locEnt == $null_entity)
 		{
+		 	if (!m_invalid_zone)
+		   	{
+				// Tels: #3694: when first entering an invalid zone, fade the ambient light back to the default value
+				sys.println("Entered invalid zone - missing no info_location entity!\n Setting ambient light:" + m_al_default_color);
+			 	m_invalid_zone = true;
+				m_al_dynamic = '0 0 0';
+				m_al_dynamic_old = '0 0 0';
+				m_al_base =	m_al_default_color;
+				m_al_base_target = m_al_default_color;
+				fadeAmbientLightColor( m_al_default_color, m_updatePeriod * 2 );	// avoid too abrupt changes
+				// TODO: fade out music?
+			}
 			// invalid zone, wait and try again
 			wait( m_updatePeriod );
 			continue;
 		}
 
+		if (m_invalid_zone)
+		{
+			sys.println("Left invalid zone, entered " + locEnt.getName());
+			// TODO: fade music in again if we faded it out?
+			m_invalid_zone = false;
+		}
+		
 		// sys.println( "Ambient script check, music_volume " + music_volume + " in location " + locEnt.getName() );
 
 		// now fade the ambient light until the next update

Relationships

related to 0002901 new player lantern is too strong in dynamic ambient lighting 
related to 0003694 confirmed Problem with info_location ambient lighting? 

Activities

tels

tels

22.09.2014 11:03

reporter   ~0007027

The attached patch implements a "no_ambient_light_fade" spawnarg on both the location settings and the info_location entities. The attached map demos the new feature.

Here is more info:

http://forums.thedarkmod.com/topic/16511-my-patches-and-contribution/page__view__findpost__p__354894
tels

tels

22.09.2014 12:25

reporter   ~0007030

Attached is another patch (_j_) which fixes the issue with starting in a location with "no_ambient_light_fade".

It also fixes 3694 (entering an invalid zone) and also breaks out the actual "light update" into its own routine, so it an be re-used.

The attched tdm_location_settings.script is the version with both patches applied.

The new testmap is at bug 3694 - the only difference to this map is the invalid zone in the red area to the far right (from the player start).

user81

28.03.2018 09:28

  ~0010193

Work around is to manually set "ambient_light_dynamic" to 0 0 0 on all info_location entities in the map.
nbohr1more

nbohr1more

25.04.2018 05:24

developer   ~0010397

Still has latern fixes that might be useful...

Suspended.

Issue History

Date Modified Username Field Change
22.09.2014 11:01 tels New Issue
22.09.2014 11:02 tels File Added: ambient_fade_test.pk4
22.09.2014 11:02 tels File Added: tels_patch_i_ambient_fade_2014-09-22.txt
22.09.2014 11:03 tels Note Added: 0007027
22.09.2014 11:04 tels Relationship added related to 0002901
22.09.2014 12:21 tels Relationship added related to 0003694
22.09.2014 12:22 tels File Added: tels_patch_j_ambient_fade_2014-09-22.txt
22.09.2014 12:23 tels File Added: tdm_location_settings.script
22.09.2014 12:25 tels Note Added: 0007030
28.03.2018 09:28 user81 Note Added: 0010193
28.03.2018 09:29 user81 Status new => closed
28.03.2018 09:29 user81 Assigned To => user81
28.03.2018 09:29 user81 Resolution open => fixed
28.03.2018 09:29 user81 Fixed in Version => TDM 2.06
25.04.2018 05:23 nbohr1more Status closed => suspended
25.04.2018 05:23 nbohr1more Resolution fixed => suspended
25.04.2018 05:23 nbohr1more Fixed in Version TDM 2.06 =>
25.04.2018 05:24 nbohr1more Note Added: 0010397
22.12.2018 09:42 user81 Assigned To user81 =>