Browse Source

Merge default into minor

--HG--
branch : minor
Bart van Strien 9 years ago
parent
commit
516c0cc21d
3 changed files with 10 additions and 3 deletions
  1. 2 0
      changes.txt
  2. 3 3
      src/modules/graphics/ParticleSystem.cpp
  3. 5 0
      src/modules/graphics/opengl/Font.cpp

+ 2 - 0
changes.txt

@@ -42,6 +42,8 @@ Released: N/A
   * Fixed love.window.setMode crashing when called with a Canvas active.
   * Fixed gamma correction of ImageFonts and BMFonts with colored images.
   * Fixed the default shader improperly applying gamma correction to per-vertex colors when gamma correction is requested but not supported on OpenGL ES.
+  * Fixed text coloring breaking because of an empty string.
+  * Fixed large burst of particles when dramatically increasing the emission rate of a ParticleSystem.
 
   * Improved performance of Channel methods by roughly 2x in many cases.
   

+ 3 - 3
src/modules/graphics/ParticleSystem.cpp

@@ -437,6 +437,9 @@ void ParticleSystem::setEmissionRate(float rate)
 	if (rate < 0.0f)
 		throw love::Exception("Invalid emission rate");
 	emissionRate = rate;
+
+	// Prevent an explosion when dramatically increasing the rate
+	emitCounter = std::min(emitCounter, 1.0f/rate);
 }
 
 float ParticleSystem::getEmissionRate() const
@@ -912,9 +915,6 @@ void ParticleSystem::update(float dt)
 			addParticle(1.0f - (emitCounter - rate) / total);
 			emitCounter -= rate;
 		}
-		/*int particles = (int)(emissionRate * dt);
-		 for (int i = 0; i != particles; i++)
-		 add();*/
 
 		life -= dt;
 		if (lifetime != -1 && life < 0)

+ 5 - 0
src/modules/graphics/opengl/Font.cpp

@@ -387,6 +387,11 @@ void Font::getCodepointsFromString(const std::vector<ColoredString> &strs, Color
 
 	for (const ColoredString &cstr : strs)
 	{
+		// No need to add the color if the string is empty anyway, and the code
+		// further on assumes no two colors share the same starting position.
+		if (cstr.str.size() == 0)
+			continue;
+
 		IndexedColor c = {cstr.color, (int) codepoints.cps.size()};
 		codepoints.colors.push_back(c);