Index: trunk/src/core/random.cc
===================================================================
--- trunk/src/core/random.cc	(revision 470)
+++ trunk/src/core/random.cc	(revision 471)
@@ -21,5 +21,5 @@
 void random::mt_init( uint32 seed )
 {
-	m_state[0] = static_cast<uint32_t>( seed & mt_full_mask );
+	m_state[0] = static_cast<uint32>( seed & mt_full_mask );
 	for ( int i = 1; i < mersenne_n; i++ )
 	{
@@ -111,5 +111,5 @@
 {
 	f32 angle = frand( math::pi<f32>() * 2.f );
-	return vec2( math::cos( angle ), math::sin( angle ) );
+	return vec2( cos( angle ), sin( angle ) );
 }
 
@@ -117,9 +117,9 @@
 {
 	f32 cos_theta = frange( -1.0f, 1.0f );
-	f32 sin_theta = math::sqrt( 1.0f - cos_theta * cos_theta );
+	f32 sin_theta = sqrt( 1.0f - cos_theta * cos_theta );
 	f32 phi       = frand( 2 * math::pi<f32>() );
 	return vec3( 
-		sin_theta * math::sin(phi),
-		sin_theta * math::cos(phi),
+		sin_theta * sin(phi),
+		sin_theta * cos(phi),
 		cos_theta
 		);
@@ -132,12 +132,12 @@
 	if ( r1 > r2 ) swap( r1, r2 );
 	f32 rf = 2* math::pi<f32>()*(r1/r2);
-	return vec2( r2*math::cos( rf ), r2*math::sin( rf ) );
+	return vec2( r2*cos( rf ), r2*sin( rf ) );
 }
 
 nv::vec2 nv::random::precise_disk_point()
 {
-	f32 r = math::sqrt( frand() );
+	f32 r = sqrt( frand() );
 	f32 rangle = frand( math::pi<f32>() );
-	return vec2( r*math::cos( rangle ), r*math::sin( rangle ) );
+	return vec2( r*cos( rangle ), r*sin( rangle ) );
 }
 
@@ -146,11 +146,11 @@
 	f32 rad     = frand();
 	f32 pi      = math::pi<f32>();
-	f32 phi     = math::asin( frange( -1.0f, 1.0f ) ) + pi*.5f;
+	f32 phi     = asin( frange( -1.0f, 1.0f ) ) + pi*.5f;
 	f32 theta   = frange( 0.0f, 2 * math::pi<f32>() );
-	f32 sin_phi = math::sin( phi );
+	f32 sin_phi = sin( phi );
 	return vec3( 
-		rad * math::cos(theta) * sin_phi,
-		rad * math::sin(theta) * sin_phi,
-		rad * math::cos(phi)
+		rad * cos(theta) * sin_phi,
+		rad * sin(theta) * sin_phi,
+		rad * cos(phi)
 	);
 }
@@ -158,11 +158,11 @@
 nv::vec3 nv::random::precise_sphere_point()
 {
-	f32 radius = math::pow( frand(), 1.f/3.f );
+	f32 radius = pow( frand(), 1.f/3.f );
 	f32 cos_theta = frange( -1.0f, 1.0f );
-	f32 sin_theta = math::sqrt( 1.0f - cos_theta * cos_theta );
+	f32 sin_theta = sqrt( 1.0f - cos_theta * cos_theta );
 	f32 phi       = frange( 0.0f, 2 * math::pi<f32>() );
 	return vec3( 
-		radius * sin_theta * math::sin(phi),
-		radius * sin_theta * math::cos(phi),
+		radius * sin_theta * sin(phi),
+		radius * sin_theta * cos(phi),
 		radius * cos_theta
 		);
@@ -203,5 +203,5 @@
 	f32 idist2 = iradius * iradius;
 	f32 odist2 = oradius * oradius;
-	f32 rdist  = math::sqrt( frange( idist2, odist2 ) );
+	f32 rdist  = sqrt( frange( idist2, odist2 ) );
 	return rdist * precise_unit_vec2();
 }
@@ -216,5 +216,5 @@
 	f32 idist3 = iradius * iradius * iradius;
 	f32 odist3 = oradius * oradius * oradius;
-	f32 rdist  = math::pow( frange( idist3, odist3 ), 1.f/3.f );
+	f32 rdist  = pow( frange( idist3, odist3 ), 1.f/3.f );
 	return rdist * precise_unit_vec3();
 }
@@ -237,5 +237,5 @@
 	f32 idist2 = ((iradii2.x * iradii2.y) / low ) * odist2;
 
-	f32 rdist     = math::sqrt( frange( idist2, odist2 ) );
+	f32 rdist     = sqrt( frange( idist2, odist2 ) );
 	return odir * rdist;	
 }
@@ -260,8 +260,8 @@
 	f32 idist2 = ((iradii2.x * iradii2.y * iradii2.z) / low ) * odist2;
 
-	f32 odist3 = odist2 * math::sqrt( odist2 );
-	f32 idist3 = idist2 * math::sqrt( idist2 );
-
-	f32 rdist     = math::pow( frange( idist3, odist3 ), 1.f/3.f );
+	f32 odist3 = odist2 * sqrt( odist2 );
+	f32 idist3 = idist2 * sqrt( idist2 );
+
+	f32 rdist     = pow( frange( idist3, odist3 ), 1.f/3.f );
 	return odir * rdist;	
 }
Index: trunk/src/engine/particle_engine.cc
===================================================================
--- trunk/src/engine/particle_engine.cc	(revision 470)
+++ trunk/src/engine/particle_engine.cc	(revision 471)
@@ -231,5 +231,5 @@
 	datap->plane_normal = normalize_safe( datap->plane_normal, vec3(0.0f,1.0f,0.0f) );
 	datap->bounce       = table->get<float>("bounce", 0.0f );
-	datap->distance     = -math::dot( datap->plane_normal, datap->plane_point ) / math::sqrt( math::dot( datap->plane_normal, datap->plane_normal ) );
+	datap->distance     = -math::dot( datap->plane_normal, datap->plane_point ) / sqrt( math::dot( datap->plane_normal, datap->plane_normal ) );
 	return true;
 }
@@ -751,10 +751,10 @@
 					{
 						float emission_angle = math::radians( edata.angle );
-						float cos_theta = r.frange( math::cos( emission_angle ), 1.0f );
-						float sin_theta = math::sqrt(1.0f - cos_theta * cos_theta );
+						float cos_theta = r.frange( cos( emission_angle ), 1.0f );
+						float sin_theta = sqrt(1.0f - cos_theta * cos_theta );
 						float phi       = r.frange( 0.0f, 2* math::pi<float>() );
 						pinfo.velocity  = orient * 
-							( edata.odir * ( math::cos(phi) * sin_theta ) +
-							edata.cdir * ( math::sin(phi)*sin_theta ) +
+							( edata.odir * ( cos(phi) * sin_theta ) +
+							edata.cdir * ( sin(phi)*sin_theta ) +
 							edata.dir  * cos_theta );
 					}
Index: trunk/src/formats/assimp_loader.cc
===================================================================
--- trunk/src/formats/assimp_loader.cc	(revision 470)
+++ trunk/src/formats/assimp_loader.cc	(revision 471)
@@ -350,5 +350,4 @@
 
 	uint16 frame_rate     = static_cast<uint16>( anim->mTicksPerSecond );
-	int check_this;
 	uint16 duration       = static_cast<uint16>( anim->mDuration );
 	bool   flat           = false;
Index: trunk/src/formats/md3_loader.cc
===================================================================
--- trunk/src/formats/md3_loader.cc	(revision 470)
+++ trunk/src/formats/md3_loader.cc	(revision 471)
@@ -246,11 +246,11 @@
 		{
 			float flat    = lat * convert;
-			float sin_lat = math::sin( flat );
-			float cos_lat = math::cos( flat );
+			float sin_lat = nv::sin( flat );
+			float cos_lat = nv::cos( flat );
 			for ( int lng = 0; lng < 256; ++lng, ++n )
 			{
 				float flng    = lng * convert;
-				float sin_lng = math::sin( flng );
-				float cos_lng = math::cos( flng );
+				float sin_lng = nv::sin( flng );
+				float cos_lng = nv::cos( flng );
 				s_normal_cache[n].x = cos_lat * sin_lng;
 //				s_normal_cache[n].y = sin_lat * sin_lng;
Index: trunk/src/gfx/mesh_creator.cc
===================================================================
--- trunk/src/gfx/mesh_creator.cc	(revision 470)
+++ trunk/src/gfx/mesh_creator.cc	(revision 471)
@@ -17,5 +17,5 @@
 	if ( m_data->m_flat ) return;
 	merge_keys();
-	uint32 max_frames = 0;
+	uint16 max_frames = 0;
 
 	nv::vector< sint16 > ids;
@@ -65,5 +65,5 @@
 		size_t count     = ( keys ? keys->get_channel_size(0) : 0 );
 		size_t pcount    = ( pkeys ? pkeys->get_channel_size(0) : 0 );
-		max_frames = nv::max<uint32>( count, max_frames );
+		max_frames = nv::max<uint16>( uint16( count ), max_frames );
 		if ( pkeys && pkeys->size() > 0 && keys && keys->size() > 0 )
 		{
Index: trunk/src/gfx/skeletal_mesh.cc
===================================================================
--- trunk/src/gfx/skeletal_mesh.cc	(revision 470)
+++ trunk/src/gfx/skeletal_mesh.cc	(revision 471)
@@ -48,5 +48,5 @@
 {
 	float  fframe   = ( a_ms_time * 0.001f ) * m_fps;
-	uint32 frame    = math::floor( fframe );
+	uint32 frame    = uint32( math::floor( fframe ) );
 	float  reminder = fframe - static_cast<float>( frame );
 	uint32 duration = get_frame_count();
Index: trunk/src/gfx/texture_atlas.cc
===================================================================
--- trunk/src/gfx/texture_atlas.cc	(revision 470)
+++ trunk/src/gfx/texture_atlas.cc	(revision 471)
@@ -22,7 +22,7 @@
 	region r ( ivec2(0,0), size );
 
-	int best_height = INT_MAX;
+	int best_height = nv::limits::si_max;
 	int best_index  = -1;
-	int best_width  = INT_MAX;
+	int best_width  = nv::limits::si_max;
 
 	for( size_t i=0; i < m_nodes.size(); ++i )
Index: trunk/src/gfx/texture_font.cc
===================================================================
--- trunk/src/gfx/texture_font.cc	(revision 470)
+++ trunk/src/gfx/texture_font.cc	(revision 471)
@@ -172,5 +172,5 @@
 		FT_Load_Glyph( face, glyph_index, FT_LOAD_RENDER | FT_LOAD_NO_HINTING);
 		slot = face->glyph;
-		g->advance = ivec2( slot->advance.x/64.0f, slot->advance.y/64.0f );
+		g->advance = vec2( slot->advance.x/64.0f, slot->advance.y/64.0f );
 	}
 	generate_kerning();
Index: trunk/src/gl/gl_device.cc
===================================================================
--- trunk/src/gl/gl_device.cc	(revision 470)
+++ trunk/src/gl/gl_device.cc	(revision 471)
@@ -76,5 +76,5 @@
 	}
 	// TODO: BGR vs RGB, single channel
-	assert( image->format->BytesPerPixel > 2 );
+	NV_ASSERT( image->format->BytesPerPixel > 2, "bytes per pixel > 2!" );
 	image_format format( image->format->BytesPerPixel == 3 ? RGB : RGBA, UBYTE );
 	image_data* idata = new image_data( format, ivec2( image->w, image->h ), static_cast<nv::uint8*>( image->pixels ) );
Index: trunk/src/gui/gui_gfx_renderer.cc
===================================================================
--- trunk/src/gui/gui_gfx_renderer.cc	(revision 470)
+++ trunk/src/gui/gui_gfx_renderer.cc	(revision 471)
@@ -215,5 +215,5 @@
 	image_data* data = m_window->get_device()->create_image_data( filename );
 	// TODO: Repitching
-	assert( data->get_depth() == 4 );
+	NV_ASSERT( data->get_depth() == 4, "depth != 4" );
 	region r = m_atlas.get_region( data->get_size() );
 	m_atlas.set_region( r, data->get_data() );
@@ -327,5 +327,5 @@
 						position p2 = p + g->size + gp;
 						qvec.emplace_back( p + gp, p2, color, g->tl, g->br );
-						p += g->advance;
+						p += ivec2( g->advance );
 					}
 				}
Index: trunk/src/lua/lua_math.cc
===================================================================
--- trunk/src/lua/lua_math.cc	(revision 470)
+++ trunk/src/lua/lua_math.cc	(revision 471)
@@ -214,9 +214,9 @@
 {
 	T v = to_vec<T>( L, 1 );
-	for ( int i = 0; i < v.length(); ++i )
+	for ( size_t i = 0; i < v.size(); ++i )
 	{
 		lua_pushnumber( L, v[i] );
 	}
-	return v.length();
+	return v.size();
 }
 
@@ -226,7 +226,7 @@
 	T* v = to_pvec<T>( L, 1 );
 	size_t len  = 0;
-	int vlen = v->length();
+	size_t vlen = v->size();
 	const unsigned char * key = reinterpret_cast<const unsigned char *>( lua_tolstring( L, 2, &len ) );
-	int idx = 255;
+	size_t idx = 255;
 
 	if ( len == 1 )
@@ -264,7 +264,7 @@
 	T* v = to_pvec<T>( L, 1 );
 	size_t len  = 0;
-	int vlen = v->length();
+	size_t vlen = v->size();
 	const unsigned char * key = reinterpret_cast<const unsigned char *>( lua_tolstring( L, 2, &len ) );
-	int idx = 255;
+	size_t idx = 255;
 	if( len == 1 )
 	{
@@ -293,5 +293,5 @@
 	T v = to_vec<T>( L, 1 );
 	bool fl = nv::is_floating_point<typename T::value_type>::value;
-	switch ( v.length() )
+	switch ( v.size() )
 	{
 	case 1: lua_pushfstring( L, ( fl ? "(%f)"          : "(%d)" ),          v[0] ); break;
