Browse Source

Made some float/int/unsigned char conversions explicit, fixed ParticleSystem:getColors, fixed love.mouse.isDown with x1 and x2 buttons

Alex Szpakowski 12 years ago
parent
commit
bcee9a222b

+ 1 - 1
src/common/runtime.cpp

@@ -168,7 +168,7 @@ int luax_intflag(lua_State *L, int table_index, const char *key, int defaultValu
 	if (!lua_isnumber(L, -1))
 		retval = defaultValue;
 	else
-		retval = lua_tonumber(L, -1);
+		retval = (int) lua_tointeger(L, -1);
 
 	lua_pop(L, 1);
 	return retval;

+ 1 - 1
src/modules/graphics/opengl/Canvas.cpp

@@ -619,7 +619,7 @@ void Canvas::drawg(love::graphics::Geometry *geom, float x, float y, float angle
 	for (size_t i = 0; i < vcount; ++i)
 	{
 		v[i] = w[i];
-		v[i].t = 1. - v[i].t;
+		v[i].t = 1.f - v[i].t;
 	}
 
 	// use colors stored in geometry (horrible, horrible hack)

+ 1 - 1
src/modules/graphics/opengl/Font.cpp

@@ -551,7 +551,7 @@ int Font::getDescent() const
 float Font::getBaseline() const
 {
 	// 1.25 is magic line height for true type fonts
-	return (type == FONT_TRUETYPE) ? floor(getHeight() / 1.25f + 0.5f) : 0.0f;
+	return (type == FONT_TRUETYPE) ? floorf(getHeight() / 1.25f + 0.5f) : 0.0f;
 }
 
 bool Font::hasGlyph(uint32 glyph) const

+ 8 - 8
src/modules/graphics/opengl/Graphics.cpp

@@ -741,7 +741,7 @@ void Graphics::printf(const std::string &str, float x, float y, float wrap, Alig
 	glPushMatrix();
 
 	static Matrix t;
-	t.setTransformation(ceil(x), ceil(y), angle, sx, sy, ox, oy, kx, ky);
+	t.setTransformation(ceilf(x), ceilf(y), angle, sx, sy, ox, oy, kx, ky);
 	glMultMatrixf((const GLfloat *)t.getElements());
 
 	x = y = 0.0f;
@@ -760,10 +760,10 @@ void Graphics::printf(const std::string &str, float x, float y, float wrap, Alig
 			switch (align)
 			{
 			case ALIGN_RIGHT:
-				currentFont->print(*line_iter, ceil(x + (wrap - width)), ceil(y), 0.0f);
+				currentFont->print(*line_iter, ceilf(x + (wrap - width)), ceilf(y), 0.0f);
 				break;
 			case ALIGN_CENTER:
-				currentFont->print(*line_iter, ceil(x + (wrap - width) / 2), ceil(y), 0.0f);
+				currentFont->print(*line_iter, ceilf(x + (wrap - width) / 2), ceilf(y), 0.0f);
 				break;
 			case ALIGN_JUSTIFY:
 				num_spaces = std::count(line_iter->begin(), line_iter->end(), ' ');
@@ -771,11 +771,11 @@ void Graphics::printf(const std::string &str, float x, float y, float wrap, Alig
 					extra_spacing = (wrap - width) / float(num_spaces);
 				else
 					extra_spacing = 0.0f;
-				currentFont->print(*line_iter, ceil(x), ceil(y), extra_spacing);
+				currentFont->print(*line_iter, ceilf(x), ceilf(y), extra_spacing);
 				break;
 			case ALIGN_LEFT:
 			default:
-				currentFont->print(*line_iter, ceil(x), ceil(y), 0.0f);
+				currentFont->print(*line_iter, ceilf(x), ceilf(y), 0.0f);
 				break;
 			}
 			y += currentFont->getHeight() * currentFont->getLineHeight();
@@ -808,19 +808,19 @@ void Graphics::polyline(const float *coords, size_t count)
 	if (lineJoin == LINE_JOIN_NONE)
 	{
 			NoneJoinPolyline line;
-			line.render(coords, count, lineWidth * .5f, pixel_size_stack.back(), lineStyle == LINE_SMOOTH);
+			line.render(coords, count, lineWidth * .5f, float(pixel_size_stack.back()), lineStyle == LINE_SMOOTH);
 			line.draw();
 	}
 	else if (lineJoin == LINE_JOIN_BEVEL)
 	{
 		BevelJoinPolyline line;
-		line.render(coords, count, lineWidth * .5f, pixel_size_stack.back(), lineStyle == LINE_SMOOTH);
+		line.render(coords, count, lineWidth * .5f, float(pixel_size_stack.back()), lineStyle == LINE_SMOOTH);
 		line.draw();
 	}
 	else // LINE_JOIN_MITER
 	{
 		MiterJoinPolyline line;
-		line.render(coords, count, lineWidth * .5f, pixel_size_stack.back(), lineStyle == LINE_SMOOTH);
+		line.render(coords, count, lineWidth * .5f, float(pixel_size_stack.back()), lineStyle == LINE_SMOOTH);
 		line.draw();
 	}
 }

+ 12 - 7
src/modules/graphics/opengl/ParticleSystem.cpp

@@ -233,7 +233,7 @@ void ParticleSystem::initParticle(particle *p)
 	min = speedMin;
 	max = speedMax;
 	float speed = (float) rng.random(min, max);
-	p->speed = love::Vector(cos(p->direction), sin(p->direction));
+	p->speed = love::Vector(cosf(p->direction), sinf(p->direction));
 	p->speed *= speed;
 
 	p->linearAcceleration.x = (float) rng.random(linearAccelerationMin.x, linearAccelerationMax.x);
@@ -652,11 +652,16 @@ void ParticleSystem::setColor(const std::vector<Color> &newColors)
 
 std::vector<Color> ParticleSystem::getColor() const
 {
-	// We store colors as floats...
+	// The particle system stores colors as floats...
 	std::vector<Color> ncolors(colors.size());
 
 	for (size_t i = 0; i < colors.size(); ++i)
-		ncolors[i] = Color(colors[i].r, colors[i].g, colors[i].b, colors[i].a);
+	{
+		ncolors[i].r = (unsigned char) (colors[i].r * 255);
+		ncolors[i].g = (unsigned char) (colors[i].g * 255);
+		ncolors[i].b = (unsigned char) (colors[i].b * 255);
+		ncolors[i].a = (unsigned char) (colors[i].a * 255);
+	}
 
 	return ncolors;
 }
@@ -764,10 +769,10 @@ void ParticleSystem::draw(float x, float y, float angle, float sx, float sy, flo
 			pVerts[v].t = imageVerts[v].t;
 
 			// particle colors are stored as floats (0-1) but vertex colors are stored as unsigned bytes (0-255)
-			pVerts[v].r = p->color.r*255;
-			pVerts[v].g = p->color.g*255;
-			pVerts[v].b = p->color.b*255;
-			pVerts[v].a = p->color.a*255;
+			pVerts[v].r = (unsigned char) (p->color.r*255);
+			pVerts[v].g = (unsigned char) (p->color.g*255);
+			pVerts[v].b = (unsigned char) (p->color.b*255);
+			pVerts[v].a = (unsigned char) (p->color.a*255);
 		}
 
 		pVerts += 4;

+ 1 - 1
src/modules/graphics/opengl/Polyline.cpp

@@ -27,7 +27,7 @@
 #include "OpenGL.h"
 
 // treat adjacent segments with angles between their directions <5 degree as straight
-static const float LINES_PARALLEL_EPS = 0.05;
+static const float LINES_PARALLEL_EPS = 0.05f;
 
 namespace love
 {

+ 18 - 18
src/modules/graphics/opengl/wrap_Geometry.cpp

@@ -73,27 +73,27 @@ int w_Geometry_setVertex(lua_State *L)
 		for (int i = 1; i <= 8; i++)
 			lua_rawgeti(L, 3, i);
 
-		v.x = luaL_checknumber(L, -8);
-		v.y = luaL_checknumber(L, -7);
-		v.s = luaL_checknumber(L, -6);
-		v.t = luaL_checknumber(L, -5);
-		v.r = luaL_optinteger(L, -4, 255);
-		v.g = luaL_optinteger(L, -3, 255);
-		v.b = luaL_optinteger(L, -2, 255);
-		v.a = luaL_optinteger(L, -1, 255);
+		v.x = (float) luaL_checknumber(L, -8);
+		v.y = (float) luaL_checknumber(L, -7);
+		v.s = (float) luaL_checknumber(L, -6);
+		v.t = (float) luaL_checknumber(L, -5);
+		v.r = (unsigned char) luaL_optinteger(L, -4, 255);
+		v.g = (unsigned char) luaL_optinteger(L, -3, 255);
+		v.b = (unsigned char) luaL_optinteger(L, -2, 255);
+		v.a = (unsigned char) luaL_optinteger(L, -1, 255);
 
 		lua_pop(L, 8);
 	}
 	else
 	{
-		v.x = luaL_checknumber(L, 3);
-		v.y = luaL_checknumber(L, 4);
-		v.s = luaL_checknumber(L, 5);
-		v.t = luaL_checknumber(L, 6);
-		v.r = luaL_optinteger(L,  7, 255);
-		v.g = luaL_optinteger(L,  8, 255);
-		v.b = luaL_optinteger(L,  9, 255);
-		v.a = luaL_optinteger(L, 10, 255);
+		v.x = (float) luaL_checknumber(L, 3);
+		v.y = (float) luaL_checknumber(L, 4);
+		v.s = (float) luaL_checknumber(L, 5);
+		v.t = (float) luaL_checknumber(L, 6);
+		v.r = (unsigned char) luaL_optinteger(L,  7, 255);
+		v.g = (unsigned char) luaL_optinteger(L,  8, 255);
+		v.b = (unsigned char) luaL_optinteger(L,  9, 255);
+		v.a = (unsigned char) luaL_optinteger(L, 10, 255);
 	}
 
 	EXCEPT_GUARD(geom->setVertex(i-1, v);)
@@ -180,11 +180,11 @@ int w_Geometry_setVertexMap(lua_State *L)
 		if (is_table)
 		{
 			lua_rawgeti(L, 2, i + 1);
-			vertexmap.push_back(luaL_checkinteger(L, -1) - 1);
+			vertexmap.push_back(uint16(luaL_checkinteger(L, -1) - 1));
 			lua_pop(L, 1);
 		}
 		else
-			vertexmap.push_back(luaL_checkinteger(L, i + 2) - 1);
+			vertexmap.push_back(uint16(luaL_checkinteger(L, i + 2) - 1));
 	}
 
 	EXCEPT_GUARD(g->setElementArray(&vertexmap[0], vertexmap.size());)

+ 11 - 11
src/modules/graphics/opengl/wrap_Graphics.cpp

@@ -253,7 +253,7 @@ int w_newGeometry(lua_State *L)
 			if (!lua_isnumber(L, -1))
 				return luaL_argerror(L, tableidx + 1, "vertex index expected");
 
-			vertexmap.push_back(lua_tointeger(L, -1) - 1);
+			vertexmap.push_back(uint16(lua_tointeger(L, -1) - 1));
 			lua_pop(L, 1);
 		}
 
@@ -293,16 +293,16 @@ int w_newGeometry(lua_State *L)
 		for (int j = 1; j <= 8; j++)
 			lua_rawgeti(L, -j, j);
 
-		v.x = luaL_checknumber(L, -8);
-		v.y = luaL_checknumber(L, -7);
+		v.x = (float) luaL_checknumber(L, -8);
+		v.y = (float) luaL_checknumber(L, -7);
 
-		v.s = luaL_checknumber(L, -6);
-		v.t = luaL_checknumber(L, -5);
+		v.s = (float) luaL_checknumber(L, -6);
+		v.t = (float) luaL_checknumber(L, -5);
 
-		v.r = luaL_optinteger(L, -4, 255);
-		v.g = luaL_optinteger(L, -3, 255);
-		v.b = luaL_optinteger(L, -2, 255);
-		v.a = luaL_optinteger(L, -1, 255);
+		v.r = (unsigned char) luaL_optinteger(L, -4, 255);
+		v.g = (unsigned char) luaL_optinteger(L, -3, 255);
+		v.b = (unsigned char) luaL_optinteger(L, -2, 255);
+		v.a = (unsigned char) luaL_optinteger(L, -1, 255);
 
 		lua_pop(L, 9);
 
@@ -441,7 +441,7 @@ int w_newParticleSystem(lua_State *L)
 	if (size < 1.0 || size > ParticleSystem::MAX_PARTICLES)
 		return luaL_error(L, "Invalid ParticleSystem size");	
 
-	EXCEPT_GUARD(t = instance->newParticleSystem(image, size);)
+	EXCEPT_GUARD(t = instance->newParticleSystem(image, int(size));)
 
 	luax_pushtype(L, "ParticleSystem", GRAPHICS_PARTICLE_SYSTEM_T, t);
 	return 1;
@@ -765,7 +765,7 @@ int w_setDefaultMipmapFilter(lua_State *L)
 			return luaL_error(L, "Invalid filter mode: %s", str);
 	}
 
-	float sharpness = luaL_optnumber(L, 2, 0);
+	float sharpness = (float) luaL_optnumber(L, 2, 0);
 
 	instance->setDefaultMipmapFilter(filter, sharpness);
 

+ 1 - 1
src/modules/graphics/opengl/wrap_Image.cpp

@@ -104,7 +104,7 @@ int w_Image_setMipmapFilter(lua_State *L)
 
 	EXCEPT_GUARD(t->setFilter(f);)
 
-	float sharpness = luaL_optnumber(L, 3, 0);
+	float sharpness = (float) luaL_optnumber(L, 3, 0);
 	t->setMipmapSharpness(sharpness);
 
 	return 0;

+ 12 - 12
src/modules/graphics/opengl/wrap_ParticleSystem.cpp

@@ -457,10 +457,10 @@ int w_ParticleSystem_setColors(lua_State *L)
 				// push args[i+2][j+1] onto the stack
 				lua_rawgeti(L, i + 2, j + 1);
 
-			int r = luaL_checkint(L, -4);
-			int g = luaL_checkint(L, -3);
-			int b = luaL_checkint(L, -2);
-			int a = luaL_optint(L, -1, 255);
+			unsigned char r = (unsigned char) luaL_checkinteger(L, -4);
+			unsigned char g = (unsigned char) luaL_checkinteger(L, -3);
+			unsigned char b = (unsigned char) luaL_checkinteger(L, -2);
+			unsigned char a = (unsigned char) luaL_optinteger(L, -1, 255);
 
 			// pop the color components from the stack
 			lua_pop(L, 4);
@@ -483,10 +483,10 @@ int w_ParticleSystem_setColors(lua_State *L)
 
 		if (nColors == 1)
 		{
-			int r = luaL_checkint(L, 2);
-			int g = luaL_checkint(L, 3);
-			int b = luaL_checkint(L, 4);
-			int a = luaL_optint(L, 5, 255);
+			unsigned char r = (unsigned char) luaL_checkinteger(L, 2);
+			unsigned char g = (unsigned char) luaL_checkinteger(L, 3);
+			unsigned char b = (unsigned char) luaL_checkinteger(L, 4);
+			unsigned char a = (unsigned char) luaL_optinteger(L, 5, 255);
 			t->setColor(Color(r,g,b,a));
 		}
 		else
@@ -494,10 +494,10 @@ int w_ParticleSystem_setColors(lua_State *L)
 			std::vector<Color> colors(nColors);
 			for (size_t i = 0; i < nColors; ++i)
 			{
-				int r = luaL_checkint(L, 1 + i*4 + 1);
-				int g = luaL_checkint(L, 1 + i*4 + 2);
-				int b = luaL_checkint(L, 1 + i*4 + 3);
-				int a = luaL_checkint(L, 1 + i*4 + 4);
+				unsigned char r = (unsigned char) luaL_checkinteger(L, 1 + i*4 + 1);
+				unsigned char g = (unsigned char) luaL_checkinteger(L, 1 + i*4 + 2);
+				unsigned char b = (unsigned char) luaL_checkinteger(L, 1 + i*4 + 3);
+				unsigned char a = (unsigned char) luaL_checkinteger(L, 1 + i*4 + 4);
 				colors[i] = Color(r,g,b,a);
 			}
 			t->setColor(colors);

+ 8 - 8
src/modules/graphics/opengl/wrap_SpriteBatch.cpp

@@ -154,19 +154,19 @@ int w_SpriteBatch_setColor(lua_State *L)
 		for (int i = 1; i <= 4; i++)
 			lua_rawgeti(L, 2, i);
 
-		c.r = (unsigned char) luaL_checkint(L, -4);
-		c.g = (unsigned char) luaL_checkint(L, -3);
-		c.b = (unsigned char) luaL_checkint(L, -2);
-		c.a = (unsigned char) luaL_optint(L, -1, 255);
+		c.r = (unsigned char) luaL_checkinteger(L, -4);
+		c.g = (unsigned char) luaL_checkinteger(L, -3);
+		c.b = (unsigned char) luaL_checkinteger(L, -2);
+		c.a = (unsigned char) luaL_optinteger(L, -1, 255);
 
 		lua_pop(L, 4);
 	}
 	else
 	{
-		c.r = (unsigned char)luaL_checkint(L, 2);
-		c.g = (unsigned char)luaL_checkint(L, 3);
-		c.b = (unsigned char)luaL_checkint(L, 4);
-		c.a = (unsigned char)luaL_optint(L, 5, 255);
+		c.r = (unsigned char)luaL_checkinteger(L, 2);
+		c.g = (unsigned char)luaL_checkinteger(L, 3);
+		c.b = (unsigned char)luaL_checkinteger(L, 4);
+		c.a = (unsigned char)luaL_optinteger(L, 5, 255);
 	}
 
 	t->setColor(c);

+ 10 - 10
src/modules/math/wrap_BezierCurve.cpp

@@ -69,8 +69,8 @@ int w_BezierCurve_setControlPoint(lua_State *L)
 {
 	BezierCurve *curve = luax_checkbeziercurve(L, 1);
 	int idx = luaL_checkinteger(L, 2);
-	double vx = luaL_checknumber(L, 3);
-	double vy = luaL_checknumber(L, 4);
+	float vx = (float) luaL_checknumber(L, 3);
+	float vy = (float) luaL_checknumber(L, 4);
 
 	if (idx > 0) // 1-indexing
 		idx--;
@@ -82,8 +82,8 @@ int w_BezierCurve_setControlPoint(lua_State *L)
 int w_BezierCurve_insertControlPoint(lua_State *L)
 {
 	BezierCurve *curve = luax_checkbeziercurve(L, 1);
-	double vx = luaL_checknumber(L, 2);
-	double vy = luaL_checknumber(L, 3);
+	float vx = (float) luaL_checknumber(L, 2);
+	float vy = (float) luaL_checknumber(L, 3);
 	int idx = luaL_optinteger(L, 4, -1);
 
 	if (idx > 0) // 1-indexing
@@ -96,8 +96,8 @@ int w_BezierCurve_insertControlPoint(lua_State *L)
 int w_BezierCurve_translate(lua_State *L)
 {
 	BezierCurve *curve = luax_checkbeziercurve(L, 1);
-	double dx = luaL_checknumber(L, 2);
-	double dy = luaL_checknumber(L, 3);
+	float dx = (float) luaL_checknumber(L, 2);
+	float dy = (float) luaL_checknumber(L, 3);
 	curve->translate(Vector(dx,dy));
 	return 0;
 }
@@ -106,8 +106,8 @@ int w_BezierCurve_rotate(lua_State *L)
 {
 	BezierCurve *curve = luax_checkbeziercurve(L, 1);
 	double phi = luaL_checknumber(L, 2);
-	double ox = luaL_optnumber(L, 3, 0);
-	double oy = luaL_optnumber(L, 4, 0);
+	float ox = (float) luaL_optnumber(L, 3, 0);
+	float oy = (float) luaL_optnumber(L, 4, 0);
 	curve->rotate(phi, Vector(ox,oy));
 	return 0;
 }
@@ -116,8 +116,8 @@ int w_BezierCurve_scale(lua_State *L)
 {
 	BezierCurve *curve = luax_checkbeziercurve(L, 1);
 	double s = luaL_checknumber(L, 2);
-	double ox = luaL_optnumber(L, 3, 0);
-	double oy = luaL_optnumber(L, 4, 0);
+	float ox = (float) luaL_optnumber(L, 3, 0);
+	float oy = (float) luaL_optnumber(L, 4, 0);
 	curve->scale(s, Vector(ox,oy));
 	return 0;
 }

+ 22 - 22
src/modules/math/wrap_Math.cpp

@@ -106,8 +106,8 @@ int w_newBezierCurve(lua_State *L)
 			lua_rawgeti(L, 1, i+1);
 
 			Vector v;
-			v.x = luaL_checknumber(L, -2);
-			v.y = luaL_checknumber(L, -1);
+			v.x = (float) luaL_checknumber(L, -2);
+			v.y = (float) luaL_checknumber(L, -1);
 			points.push_back(v);
 
 			lua_pop(L, 2);
@@ -120,8 +120,8 @@ int w_newBezierCurve(lua_State *L)
 		for (size_t i = 1; i <= top; i += 2)
 		{
 			Vector v;
-			v.x = luaL_checknumber(L, i);
-			v.y = luaL_checknumber(L, i+1);
+			v.x = (float) luaL_checknumber(L, i);
+			v.y = (float) luaL_checknumber(L, i+1);
 			points.push_back(v);
 		}
 	}
@@ -144,8 +144,8 @@ int w_triangulate(lua_State *L)
 			lua_rawgeti(L, 1, i+1);
 
 			Vertex v;
-			v.x = luaL_checknumber(L, -2);
-			v.y = luaL_checknumber(L, -1);
+			v.x = (float) luaL_checknumber(L, -2);
+			v.y = (float) luaL_checknumber(L, -1);
 			vertices.push_back(v);
 
 			lua_pop(L, 2);
@@ -158,8 +158,8 @@ int w_triangulate(lua_State *L)
 		for (size_t i = 1; i <= top; i += 2)
 		{
 			Vertex v;
-			v.x = luaL_checknumber(L, i);
-			v.y = luaL_checknumber(L, i+1);
+			v.x = (float) luaL_checknumber(L, i);
+			v.y = (float) luaL_checknumber(L, i+1);
 			vertices.push_back(v);
 		}
 	}
@@ -214,8 +214,8 @@ int w_isConvex(lua_State *L)
 			lua_rawgeti(L, 1, i+1);
 
 			Vertex v;
-			v.x = luaL_checknumber(L, -2);
-			v.y = luaL_checknumber(L, -1);
+			v.x = (float) luaL_checknumber(L, -2);
+			v.y = (float) luaL_checknumber(L, -1);
 			vertices.push_back(v);
 
 			lua_pop(L, 2);
@@ -228,8 +228,8 @@ int w_isConvex(lua_State *L)
 		for (size_t i = 1; i <= top; i += 2)
 		{
 			Vertex v;
-			v.x = luaL_checknumber(L, i);
-			v.y = luaL_checknumber(L, i+1);
+			v.x = (float) luaL_checknumber(L, i);
+			v.y = (float) luaL_checknumber(L, i+1);
 			vertices.push_back(v);
 		}
 	}
@@ -246,26 +246,26 @@ int w_noise(lua_State *L)
 	switch (lua_gettop(L))
 	{
 	case 1:
-		x = luaL_checknumber(L, 1);
+		x = (float) luaL_checknumber(L, 1);
 		val = Math::instance.noise(x);
 		break;
 	case 2:
-		x = luaL_checknumber(L, 1);
-		y = luaL_checknumber(L, 2);
+		x = (float) luaL_checknumber(L, 1);
+		y = (float) luaL_checknumber(L, 2);
 		val = Math::instance.noise(x, y);
 		break;
 	case 3:
-		x = luaL_checknumber(L, 1);
-		y = luaL_checknumber(L, 2);
-		z = luaL_checknumber(L, 3);
+		x = (float) luaL_checknumber(L, 1);
+		y = (float) luaL_checknumber(L, 2);
+		z = (float) luaL_checknumber(L, 3);
 		val = Math::instance.noise(x, y, z);
 		break;
 	case 4:
 	default:
-		x = luaL_checknumber(L, 1);
-		y = luaL_checknumber(L, 2);
-		z = luaL_checknumber(L, 3);
-		w = luaL_checknumber(L, 4);
+		x = (float) luaL_checknumber(L, 1);
+		y = (float) luaL_checknumber(L, 2);
+		z = (float) luaL_checknumber(L, 3);
+		w = (float) luaL_checknumber(L, 4);
 		val = Math::instance.noise(x, y, z, w);
 		break;
 	}

+ 2 - 2
src/modules/mouse/Mouse.h

@@ -42,10 +42,10 @@ public:
 		BUTTON_LEFT,
 		BUTTON_MIDDLE,
 		BUTTON_RIGHT,
-		BUTTON_WHEELUP,
-		BUTTON_WHEELDOWN,
 		BUTTON_X1,
 		BUTTON_X2,
+		BUTTON_WHEELUP,
+		BUTTON_WHEELDOWN,
 		BUTTON_MAX_ENUM
 	};
 

+ 1 - 1
src/modules/mouse/sdl/Mouse.cpp

@@ -130,7 +130,7 @@ void Mouse::setVisible(bool visible)
 
 bool Mouse::isDown(Button *buttonlist) const
 {
-	Uint8 buttonstate = SDL_GetMouseState(0, 0);
+	Uint32 buttonstate = SDL_GetMouseState(0, 0);
 
 	for (Button button = *buttonlist; button != BUTTON_MAX_ENUM; button = *(++buttonlist))
 	{

+ 6 - 6
src/modules/physics/box2d/Fixture.cpp

@@ -140,18 +140,18 @@ bool Fixture::isValid() const
 void Fixture::setFilterData(int *v)
 {
 	b2Filter f;
-	f.categoryBits = (unsigned short)v[0];
-	f.maskBits = (unsigned short)v[1];
-	f.groupIndex = v[2];
+	f.categoryBits = (uint16) v[0];
+	f.maskBits = (uint16) v[1];
+	f.groupIndex = (int16) v[2];
 	fixture->SetFilterData(f);
 }
 
 void Fixture::getFilterData(int *v)
 {
 	b2Filter f = fixture->GetFilterData();
-	v[0] = (int)f.categoryBits;
-	v[1] = (int)f.maskBits;
-	v[2] = f.groupIndex;
+	v[0] = (int) f.categoryBits;
+	v[1] = (int) f.maskBits;
+	v[2] = (int) f.groupIndex;
 }
 
 int Fixture::setCategory(lua_State *L)