Index: /trunk/nv.lua
===================================================================
--- /trunk/nv.lua	(revision 322)
+++ /trunk/nv.lua	(revision 323)
@@ -5,5 +5,4 @@
 	includedirs { "." }
 	files { "nv/core/**.hh", "nv/interface/**.hh", "nv/detail/**.inc", "src/core/**.cc" }
-	targetname "nv-core"
 
 project "nv-lib"
@@ -14,5 +13,4 @@
 	files { "nv/lib/**.hh", "nv/lib/**.inl", "nv/lib/**.inc", "src/lib/**.cc" }
 	links { "nv-core" }
-	targetname "nv-lib"
 
 project "nv-curses"
@@ -23,5 +21,4 @@
 	files { "nv/curses/**.hh",  "src/curses/**.cc" }
 	links { "nv-core", "nv-lib" }
-	targetname "nv-curses"
 
 project "nv-fmod"
@@ -32,5 +29,4 @@
 	files { "nv/fmod/**.hh",    "src/fmod/**.cc" }
 	links { "nv-core", "nv-lib" }
-	targetname "nv-fmod"
 
 project "nv-sdl"
@@ -41,5 +37,4 @@
 	files { "nv/sdl/**.hh",     "src/sdl/**.cc" }
 	links { "nv-core", "nv-lib" }
-	targetname "nv-sdl"
 
 project "nv-gl"
@@ -50,5 +45,4 @@
 	files { "nv/gl/**.hh",     "src/gl/**.cc" }
 	links { "nv-core", "nv-lib" }
-	targetname "nv-gl"
 
 project "nv-lua"
@@ -59,5 +53,4 @@
 	files { "nv/lua/**.hh",     "src/lua/**.cc" }
 	links { "nv-core", "nv-lib" }
-	targetname "nv-lua"
 
 project "nv-rogue"
@@ -68,5 +61,4 @@
 	files { "nv/rogue/**.hh",     "src/rogue/**.cc" }
 	links { "nv-core" }
-	targetname "nv-rogue"
 
 project "nv-io"
@@ -77,5 +69,4 @@
 	files { "nv/io/**.hh",     "src/io/**.cc" }
 	links { "nv-core" }
-	targetname "nv-io"
 
 project "nv-gfx"
@@ -86,5 +77,4 @@
 	files { "nv/gfx/**.hh",  "src/gfx/**.cc" }
 	links { "nv-core" }
-	targetname "nv-gfx"
 
 project "nv-engine"
@@ -94,6 +84,5 @@
 	includedirs { "." }
 	files { "nv/engine/**.hh",  "src/engine/**.cc" }
-	links { "nv-core", "nv-lua" }
-	targetname "nv-engine"
+	links { "nv-core", "nv-lib", "nv-lua" }
 
 project "nv-formats"
@@ -104,5 +93,4 @@
 	files { "nv/formats/**.hh", "src/formats/**.cc" }
 	links { "nv-core", "nv-lib", "nv-io", "nv-gfx" }
-	targetname "nv-formats"
 
 project "nv-gui"
@@ -112,14 +100,5 @@
 	includedirs { "." }
 	files { "nv/gui/**.hh",     "src/gui/**.cc" }
-	links { "nv-core", "nv-io", "nv-gfx", "nv-lua" }
-	targetname "nv-gui"
-
-project "nv"
-	location (_ACTION)
-	language "C++"
-	kind "StaticLib"
-	includedirs { "." }
-	links { "nv-core", "nv-lib", "nv-curses", "nv-sdl", "nv-fmod", "nv-lua", "nv-gl", "nv-rogue", "nv-io", "nv-gfx", "nv-engine", "nv-formats", "nv-gui" }
-	targetname "nv"
+	links { "nv-core", "nv-lib", "nv-io", "nv-gfx", "nv-lua" }
 
 -- injection!
@@ -151,5 +130,7 @@
 				-- no reasonable way to fix this with abstract 
 				-- interfaces.
-				"-Wno-weak-vtables"
+				"-Wno-weak-vtables",
+				-- this can be reenabled if I find a nice solution
+				"-Wno-cast-align",
 			}
 			--buildoptions { 
@@ -159,4 +140,6 @@
 			buildoptions { "-std=c++0x" }
 		end
+	configuration { "windows", "gmake" }
+		linkoptions { "-mwindows" }
 
 	configuration "linux"
Index: /trunk/nv/core/array.hh
===================================================================
--- /trunk/nv/core/array.hh	(revision 322)
+++ /trunk/nv/core/array.hh	(revision 323)
@@ -16,34 +16,27 @@
 #include <nv/core/common.hh>
 #include <vector>
+#include <algorithm>
 #include <array>
 
 namespace nv
 {
-	namespace detail
-	{
-		template < typename T >
-		class array_base
-		{
-		public:
-			typedef T              value_type;
-			typedef T*             iterator;
-			typedef const T*       const_iterator;
-			typedef T&             reference;
-			typedef const T&       const_reference;
-			typedef std::size_t    size_type;
-			typedef std::ptrdiff_t difference_type;
-
-			typedef std::reverse_iterator<iterator>       reverse_iterator;
-			typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-		};
-	}
-
 	using std::vector;
 	using std::array;
 
 	template< class T, std::size_t N >
-	class static_array : public detail::array_base<T>
+	class static_array
 	{
 	public:
+		typedef T              value_type;
+		typedef T*             iterator;
+		typedef const T*       const_iterator;
+		typedef T&             reference;
+		typedef const T&       const_reference;
+		typedef std::size_t    size_type;
+		typedef std::ptrdiff_t difference_type;
+
+		typedef std::reverse_iterator<iterator>       reverse_iterator;
+		typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
 		iterator        begin()        { return m_data; }
 		const_iterator  begin()  const { return m_data; }
@@ -99,7 +92,18 @@
 
 	template< class T >
-	class dynamic_array : public detail::array_base<T>
+	class dynamic_array
 	{
 	public:
+		typedef T              value_type;
+		typedef T*             iterator;
+		typedef const T*       const_iterator;
+		typedef T&             reference;
+		typedef const T&       const_reference;
+		typedef std::size_t    size_type;
+		typedef std::ptrdiff_t difference_type;
+
+		typedef std::reverse_iterator<iterator>       reverse_iterator;
+		typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
 		dynamic_array() 
 			: m_data( nullptr ), m_size(0) {}
Index: /trunk/nv/core/array2d.hh
===================================================================
--- /trunk/nv/core/array2d.hh	(revision 322)
+++ /trunk/nv/core/array2d.hh	(revision 323)
@@ -337,5 +337,5 @@
 				// The end position is either the size limit or the end of either array, whichever is smaller.
 				// Destination start is the beginning of the current destination row (which is dest_start_y + i), offset by dest_start_x.
-				std:copy( source.m_data + ( source_start_y + i ) * source.m_size.x + source_start_x,  // Source Start
+				std::copy( source.m_data + ( source_start_y + i ) * source.m_size.x + source_start_x,  // Source Start
 						  source.m_data + ( source_start_y + i ) * source.m_size.x + min( source.m_size.x, min( source_start_x + size_x, source_start_x + m_size.x - dest_start_x ) ), // Source End
 						  m_data + (dest_start_y + i) * m_size.x + dest_start_x ); // Destination Start
Index: /trunk/nv/core/handle.hh
===================================================================
--- /trunk/nv/core/handle.hh	(revision 322)
+++ /trunk/nv/core/handle.hh	(revision 323)
@@ -42,5 +42,5 @@
 		bool is_valid() const { return !is_nil(); }
 		T index() const { return m_index; }
-		size_t hash() const { return std::hash<T>()( m_counter << IBITS | m_index ); }
+		size_t hash() const { return std::hash<T>()( T( m_counter << IBITS | m_index ) ); }
 	protected:
 		T m_index   : IBITS;
@@ -81,5 +81,5 @@
 				return;
 			}
-			m_entries[ m_last_free ].next_free = h.m_index;
+			m_entries[ (unsigned)m_last_free ].next_free = h.m_index;
 			m_last_free = h.m_index;
 		}
@@ -145,6 +145,6 @@
 		T* insert( handle h )
 		{
-			resize_indexes_to( h.index() );
-			m_indexes[ h.index() ] = m_data.size();
+			resize_indexes_to( (index_type) h.index() );
+			m_indexes[ h.index() ] = (index_type) m_data.size();
 			m_handles.push_back( h );
 			m_data.emplace_back();
@@ -162,5 +162,5 @@
 			if ( h.is_nil() || h.index() >= m_indexes.size() ) return nullptr;
 			index_type i = m_indexes[ h.index() ];
-			return i >= 0 ? &(m_data[ i ]) : nullptr;
+			return i >= 0 ? &(m_data[ (unsigned)i ]) : nullptr;
 		}
 
@@ -171,7 +171,7 @@
 			if ( dead_eindex != (sint32)m_data.size()-1 )
 			{
-				m_data[ dead_eindex ]            = m_data.back();
-				m_handles[ dead_eindex ]         = swap_handle;
-				m_indexes[ swap_handle.index() ] = dead_eindex;
+				m_data[ (unsigned)dead_eindex ]    = m_data.back();
+				m_handles[ (unsigned)dead_eindex ] = swap_handle;
+				m_indexes[ swap_handle.index() ]   = dead_eindex;
 			}
 			m_data.pop_back();
@@ -207,5 +207,5 @@
 				if ( size == 0 ) size = 1;
 				while ( i >= size ) size = size * 2;
-				m_indexes.resize( size, -1 );
+				m_indexes.resize( (size_t)size, -1 );
 			}
 		}
@@ -249,5 +249,5 @@
 			if ( h.is_nil() ) return nullptr;
 			sint32 eindex = m_indexes.get_index( h );
-			return eindex >= 0 ? &(m_data[ eindex ]) : nullptr;
+			return eindex >= 0 ? &(m_data[ (unsigned)eindex ]) : nullptr;
 		}
 
@@ -256,5 +256,5 @@
 			if ( h.is_nil() ) return nullptr;
 			sint32 eindex = m_indexes.get_index( h );
-			return eindex >= 0 ? &(m_data[ eindex ]) : nullptr;
+			return eindex >= 0 ? &(m_data[ (unsigned)eindex ]) : nullptr;
 		}
 
@@ -265,6 +265,6 @@
 			if ( dead_eindex != (sint32)m_data.size()-1 )
 			{
-				m_data[ dead_eindex ]    = m_data.back();
-				m_handles[ dead_eindex ] = m_handles.back();
+				m_data[ (unsigned)dead_eindex ]    = m_data.back();
+				m_handles[ (unsigned)dead_eindex ] = m_handles.back();
 			}
 			m_data.pop_back();
@@ -274,7 +274,7 @@
 		}
 
-		handle get_handle( index_type i ) const { return m_handles[i]; }
-		const value_type& operator[] ( index_type i ) const { return m_data[i]; }
-		value_type& operator[] ( index_type i ) { return m_data[i]; }
+		handle get_handle( index_type i ) const { return m_handles[(unsigned)i]; }
+		const value_type& operator[] ( index_type i ) const { return m_data[(unsigned)i]; }
+		value_type& operator[] ( index_type i ) { return m_data[(unsigned)i]; }
 		size_t size() const { return m_data.size(); }
 
Index: /trunk/nv/core/range.hh
===================================================================
--- /trunk/nv/core/range.hh	(revision 322)
+++ /trunk/nv/core/range.hh	(revision 323)
@@ -47,8 +47,10 @@
 		{
 		public:
-			range_iterator_base( T value ) : forward_iterator_base( value ) {}
+			typedef forward_iterator_base< T > base_class;
+
+			range_iterator_base( T value ) : forward_iterator_base<T>( value ) {}
 			range_iterator_base& operator++ () 
 			{
-				++m_value; 
+				++base_class::m_value; 
 				return *this; 
 			}
@@ -66,13 +68,15 @@
 		{
 		public:
+			typedef forward_iterator_base< glm::detail::tvec2<T> > base_class;
+
 			range2d_iterator_base( glm::detail::tvec2<T> value, T min, T max ) 
-				: forward_iterator_base( value ), m_min(min), m_max(max) {}
+				: forward_iterator_base< glm::detail::tvec2<T> >( value ), m_min(min), m_max(max) {}
 			range2d_iterator_base& operator++ () 
 			{
-				++m_value.x;
-				if ( m_value.x > m_max ) 
+				++base_class::m_value.x;
+				if ( base_class::m_value.x > m_max ) 
 				{
-					++m_value.y;
-					m_value.x = m_min;
+					++base_class::m_value.y;
+					base_class::m_value.x = m_min;
 				}
 				return *this; 
@@ -94,7 +98,9 @@
 		public:
 			typedef typename base_underlying_type<T>::type base_type;
+			typedef forward_iterator_base< T > base_class;
+
 			static const T invalid = T( 0 );
 
-			bits_iterator_base( T value, T current ) : forward_iterator_base( current ), m_full( value )
+			bits_iterator_base( T value, T current ) : forward_iterator_base<T>( current ), m_full( value )
 			{
 				if( !( (base_type)value & (base_type)current ) )
@@ -117,7 +123,7 @@
 				do
 				{
-					if ( m_value == invalid || m_full <= m_value ) { m_value = invalid; m_full = invalid; break; }
-					m_value = T((base_type)m_value << 1);
-				} while ( !( (base_type)m_full & (base_type)m_value ) );
+					if ( base_class::m_value == invalid || m_full <= base_class::m_value ) { base_class::m_value = invalid; m_full = invalid; break; }
+					base_class::m_value = T((base_type)base_class::m_value << 1);
+				} while ( !( (base_type)m_full & (base_type)base_class::m_value ) );
 			}
 
@@ -213,5 +219,5 @@
 	auto index( const C& c ) -> range_iterator_provider<decltype( c.size() )>
 	{
-		return range_iterator_provider( 0, c.size() );
+		return range_iterator_provider<decltype( c.size() )>( 0, c.size() );
 	}
 
Index: /trunk/nv/core/time.hh
===================================================================
--- /trunk/nv/core/time.hh	(revision 322)
+++ /trunk/nv/core/time.hh	(revision 323)
@@ -115,27 +115,27 @@
 		typedef typename Timer::value_type value_type;
 
-		fps_counter_class() : frames(1), last(0) {}
+		fps_counter_class() : m_frames(1), m_last(0), m_value(0.0f) {}
 		bool tick()
 		{
 			value_type now = Timer()();
-			if ( now - last >= Timer::second )
+			if ( now - m_last >= Timer::second )
 			{
-				value = (static_cast<float>(frames) /
-					static_cast<float>(now - last))*Timer::second;
-				frames = 1;
-				last = now;
+				m_value = (static_cast<float>(m_frames) /
+					static_cast<float>(now - m_last))*Timer::second;
+				m_frames = 1;
+				m_last = now;
 				return true;
 			}
-			frames++;
+			m_frames++;
 			return false;
 		}
 		f32 fps() const
 		{
-			return value;
+			return m_value;
 		}
 	private:
-		value_type last;
-		uint32     frames;
-		f32        value;
+		uint32     m_frames;
+		value_type m_last;
+		f32        m_value;
 	};
 
Index: /trunk/nv/core/uid.hh
===================================================================
--- /trunk/nv/core/uid.hh	(revision 322)
+++ /trunk/nv/core/uid.hh	(revision 323)
@@ -84,5 +84,5 @@
 	public:
 		T* get( uid auid ) const      { return static_cast<T*>( m_store.get( auid ) ); }
-		bool remove( uid auid )       { m_store.remove( auid ); }
+		bool remove( uid auid )       { return m_store.remove( auid ); }
 		void insert( T* o, uid auid ) { m_store.insert( o, auid ); }
 		uid insert( T* o )            { return m_store.insert( o ); }
@@ -92,5 +92,5 @@
 		 * Retrieves an object and casts it to the specified type.
 		 *
-		 * @tparam T The type to cast to.
+		 * @tparam U The type to cast to.
 		 * @param auid The ID the object is stored under.
 		 * @returns An object of the indicated type that was stored at the indicated ID.
Index: /trunk/nv/curses/curses_terminal.hh
===================================================================
--- /trunk/nv/curses/curses_terminal.hh	(revision 322)
+++ /trunk/nv/curses/curses_terminal.hh	(revision 323)
@@ -71,5 +71,5 @@
 		 * Virtual destructor
 		 */
-		virtual ~curses_terminal();;
+		virtual ~curses_terminal();
 
 	protected:
Index: /trunk/nv/engine/particle_engine.hh
===================================================================
--- /trunk/nv/engine/particle_engine.hh	(revision 322)
+++ /trunk/nv/engine/particle_engine.hh	(revision 323)
@@ -19,6 +19,6 @@
 namespace nv
 {
-	static const int MAX_PARTICLE_EMMITERS  = 8;
-	static const int MAX_PARTICLE_AFFECTORS = 8;
+	static const unsigned MAX_PARTICLE_EMMITERS  = 8;
+	static const unsigned MAX_PARTICLE_AFFECTORS = 8;
 
 	struct particle_emmiter_data;
Index: /trunk/nv/engine/resource_system.hh
===================================================================
--- /trunk/nv/engine/resource_system.hh	(revision 322)
+++ /trunk/nv/engine/resource_system.hh	(revision 323)
@@ -37,4 +37,5 @@
 		void load_all();
 		resource_id load_resource( const std::string& id );
+		virtual ~resource_manager_base() {}
 	protected:
 		virtual resource_id load_resource( lua::table_guard& table ) = 0;
Index: /trunk/nv/formats/md5_loader.hh
===================================================================
--- /trunk/nv/formats/md5_loader.hh	(revision 322)
+++ /trunk/nv/formats/md5_loader.hh	(revision 323)
@@ -52,5 +52,5 @@
 		enum file_type { UNKNOWN, MESH, ANIMATION };
 
-		md5_loader() : m_nodes( nullptr ), m_type( UNKNOWN ) {}
+		md5_loader() : m_type( UNKNOWN ), m_nodes( nullptr ) {}
 		virtual ~md5_loader();
 		virtual bool load( stream& source );
Index: /trunk/nv/gfx/animation.hh
===================================================================
--- /trunk/nv/gfx/animation.hh	(revision 322)
+++ /trunk/nv/gfx/animation.hh	(revision 323)
@@ -86,12 +86,12 @@
 					return keyfresult;
 				}
-				for ( int i = 1 ; i < (int)count ; i++ )
+				for ( unsigned i = 1 ; i < count ; i++ )
 				{
-					if ( time < fdata[ i * keyfsize ] ) { index0 = i - 1; break; }
+					if ( time < fdata[ i * keyfsize ] ) { index0 = (int)i - 1; break; }
 				}
 				NV_ASSERT( index0 >= 0, "animation time fail!");
 				index1 = index0 + 1;
-				float time0  = fdata[ index0 * keyfsize ];
-				float time1  = fdata[ index1 * keyfsize ];
+				float time0  = fdata[ index0 * (int)keyfsize ];
+				float time1  = fdata[ index1 * (int)keyfsize ];
 				float delta  = time1 - time0;
 				factor = glm::clamp( (time - time0) / delta, 0.0f, 1.0f );
@@ -104,5 +104,5 @@
 					return keyfresult;
 				}
-				index0 = glm::clamp<int>( int( time ), 0, count - 2 );
+				index0 = glm::clamp<int>( (int) time, 0, (int)count - 2 );
 				index1 = index0 + 1;
 				factor = glm::clamp<float> ( time - index0, 0.0f, 1.0f );
@@ -113,6 +113,6 @@
 				ret += nv::interpolate_raw( 
 					desc.slots[slot], factor, 
-					fdata + index0 * keyfsize + desc.slots[slot].offset / 4,
-					fdata + index1 * keyfsize + desc.slots[slot].offset / 4,
+					fdata + index0 * (int)keyfsize + desc.slots[slot].offset / 4,
+					fdata + index1 * (int)keyfsize + desc.slots[slot].offset / 4,
 					result + ret );
 			}
@@ -154,5 +154,5 @@
 			}
 			return extract_matrix_raw( m_final_key, key );
-		};
+		}
 
 		transform get_raw_transform( uint32 index ) const 
@@ -165,5 +165,5 @@
 			}
 			return extract_transform_raw( m_final_key, key );
-		};
+		}
 
 		mat4 get_matrix( float time ) const
@@ -176,5 +176,5 @@
 			}
 			return extract_matrix_raw( m_final_key, key );
-		};
+		}
 
 		transform get_transform( float time ) const
@@ -187,5 +187,5 @@
 			}
 			return extract_transform_raw( m_final_key, key );
-		};
+		}
 
 		size_t get_channel_count() const { return m_channels.size(); }
Index: /trunk/nv/gfx/keyframed_mesh.hh
===================================================================
--- /trunk/nv/gfx/keyframed_mesh.hh	(revision 322)
+++ /trunk/nv/gfx/keyframed_mesh.hh	(revision 323)
@@ -48,9 +48,10 @@
 		};
 
+		context*     m_context;
+
 		const mesh_data*        m_mesh_data;
 		const mesh_nodes_data*  m_tag_map;
 		const mesh_raw_channel* m_vchannel;
 
-		context*     m_context;
 		buffer       m_pbuffer;
 		vertex_array m_va;
Index: /trunk/nv/gfx/skeletal_mesh.hh
===================================================================
--- /trunk/nv/gfx/skeletal_mesh.hh	(revision 322)
+++ /trunk/nv/gfx/skeletal_mesh.hh	(revision 323)
@@ -58,5 +58,5 @@
 		dynamic_array< transform >   m_pos_offset;
 		dynamic_array< transform >   m_bone_offset;
-;
+
 		const mesh_data*             m_data;
 		const md5_vtx_pntiw*         m_vtx_data;
Index: /trunk/nv/gfx/sliced_buffer.hh
===================================================================
--- /trunk/nv/gfx/sliced_buffer.hh	(revision 322)
+++ /trunk/nv/gfx/sliced_buffer.hh	(revision 323)
@@ -205,6 +205,6 @@
 		context*    m_context;
 		buffer      m_buffer;
+		buffer_type m_type;
 		buffer_hint m_hint;
-		buffer_type m_type;
 		bool        m_full_update;
 		vector      m_data;
Index: /trunk/nv/interface/animation_key.hh
===================================================================
--- /trunk/nv/interface/animation_key.hh	(revision 322)
+++ /trunk/nv/interface/animation_key.hh	(revision 323)
@@ -47,5 +47,5 @@
 			template<typename C> static char (&test(...))[2]; 
 		public:
-			static bool const value = sizeof(test<derived>(0)) == 2;;
+			static bool const value = sizeof(test<derived>(0)) == 2;
 		};
 
@@ -60,5 +60,5 @@
 			template<typename C> static char (&test(...))[2]; 
 		public:
-			static bool const value = sizeof(test<derived>(0)) == 2;;
+			static bool const value = sizeof(test<derived>(0)) == 2;
 		};
 
@@ -73,5 +73,5 @@
 			template<typename C> static char (&test(...))[2]; 
 		public:
-			static bool const value = sizeof(test<derived>(0)) == 2;;
+			static bool const value = sizeof(test<derived>(0)) == 2;
 		};
 
@@ -86,5 +86,5 @@
 			template<typename C> static char (&test(...))[2]; 
 		public:
-			static bool const value = sizeof(test<derived>(0)) == 2;;
+			static bool const value = sizeof(test<derived>(0)) == 2;
 		};
 
@@ -99,5 +99,5 @@
 			template<typename C> static char (&test(...))[2]; 
 		public:
-			static bool const value = sizeof(test<derived>(0)) == 2;;
+			static bool const value = sizeof(test<derived>(0)) == 2;
 		};
 
@@ -193,5 +193,5 @@
 	struct key_descriptor
 	{
-		key_descriptor_slot slots[ animation_slot::SLOT_MAX_STORE ];
+		key_descriptor_slot slots[ (uint16)animation_slot::SLOT_MAX_STORE ];
 		uint32              count;
 		uint32              size;
Index: /trunk/nv/interface/context.hh
===================================================================
--- /trunk/nv/interface/context.hh	(revision 322)
+++ /trunk/nv/interface/context.hh	(revision 323)
@@ -116,5 +116,5 @@
 			typedef vertex_slot_info< VTX, SLOT > vinfo;
 			typedef datatype_traits< typename vinfo::value_type > dt_traits;
-			add_vertex_buffer( va, SLOT, vb, type_to_enum< dt_traits::base_type >::type, dt_traits::size, vinfo::offset, sizeof( VTX ), false );
+			add_vertex_buffer( va, SLOT, vb, type_to_enum< typename dt_traits::base_type >::type, dt_traits::size, vinfo::offset, sizeof( VTX ), false );
 		}
 
@@ -168,5 +168,5 @@
 			vertex_array va = create_vertex_array( v, vcount, hint );
 			buffer       ib = create_buffer( INDEX_BUFFER, hint, icount * sizeof( IDX ), i );
-			va->set_index_buffer( ib, type_to_enum< IDX >::type, true );
+			set_index_buffer( va, ib, type_to_enum< IDX >::type, true );
 			return va;
 		}
@@ -247,5 +247,5 @@
 			if ( info )
 			{
-				NV_ASSERT( info->count < vertex_array_info::MAX_ATTRIBUTES, "MAX_ATTRIBUTES reached!" );
+				NV_ASSERT( info->count < (uint16)vertex_array_info::MAX_ATTRIBUTES, "MAX_ATTRIBUTES reached!" );
 				vertex_buffer_attribute& p = info->attr[ info->count ];
 				p.vbuffer    = buf;
Index: /trunk/nv/interface/device.hh
===================================================================
--- /trunk/nv/interface/device.hh	(revision 322)
+++ /trunk/nv/interface/device.hh	(revision 323)
@@ -101,5 +101,5 @@
 		ivec2        size;
 		image_format format;
-		sampler      sampler;
+		sampler      tsampler;
 	};
 
@@ -173,10 +173,4 @@
 
 		template < typename T >
-		void set_uniform_array( const string& name, const std::vector<T>& value )
-		{
-			set_uniform_array( program p, name, (const T*)value.data(), value.size() );
-		}
-
-		template < typename T >
 		void set_opt_uniform_array( program p, const string& name, const T* value, uint32 count )
 		{
Index: /trunk/nv/interface/interpolation_template.hh
===================================================================
--- /trunk/nv/interface/interpolation_template.hh	(revision 322)
+++ /trunk/nv/interface/interpolation_template.hh	(revision 323)
@@ -41,10 +41,10 @@
 	{
 		template < typename T >
-		mat4 extract_matrix_slot( const T& ) { static_assert( false, "extract_matrix_slot" ); }
+		mat4 extract_matrix_slot( const T& ) { static_assert( sizeof( T ) == 0, "extract_matrix_slot" ); return mat4(); }
 		template <> inline mat4 extract_matrix_slot( const mat4& m ) { return m; }
 		template <> inline mat4 extract_matrix_slot( const transform& m ) { return m.extract(); }
 
 		template < typename T >
-		transform extract_transfrom_slot( const T& ) { static_assert( false, "extract_matrix_slot" ); }
+		transform extract_transfrom_slot( const T& ) { static_assert( sizeof( T ) == 0, "extract_matrix_slot" ); return transform(); }
 		template <> inline transform extract_transfrom_slot( const mat4& m ) { return transform(m); }
 		template <> inline transform extract_transfrom_slot( const transform& m ) { return m; }
@@ -85,5 +85,5 @@
 
 		template < typename KEY >
-		mat4 extract_matrix_prs( const KEY& k, const std::false_type&, const std::false_type&, const std::false_type& )
+		mat4 extract_matrix_prs( const KEY&, const std::false_type&, const std::false_type&, const std::false_type& )
 		{ return mat4(); }
 		template < typename KEY >
@@ -111,5 +111,5 @@
 
 		template < typename KEY >
-		transform extract_transform_pr_impl( const KEY& k, const std::false_type&, const std::false_type& ) { return transform(); }
+		transform extract_transform_pr_impl( const KEY&, const std::false_type&, const std::false_type& ) { return transform(); }
 		template < typename KEY >
 		transform extract_transform_pr_impl( const KEY& k, const std::true_type&, const std::true_type& ) { return transform( k.position, k.rotation ); }
Index: /trunk/nv/interface/map_area.hh
===================================================================
--- /trunk/nv/interface/map_area.hh	(revision 322)
+++ /trunk/nv/interface/map_area.hh	(revision 323)
@@ -35,6 +35,6 @@
 		virtual bool is_visible( const position& ) const { return true; }
 		virtual bool is_explored( const position& ) const { return true; }
-		virtual void set_visible( const position&, bool ) {};
-		virtual bool is_transparent( const position& ) const { return true; };
+		virtual void set_visible( const position&, bool ) {}
+		virtual bool is_transparent( const position& ) const { return true; }
 		virtual ~map_area(){}
 	};
Index: /trunk/nv/interface/mesh_data.hh
===================================================================
--- /trunk/nv/interface/mesh_data.hh	(revision 322)
+++ /trunk/nv/interface/mesh_data.hh	(revision 323)
@@ -137,5 +137,5 @@
 					if ( ch->desc.slots[i].vslot == s )
 					{
-						return c;
+						return (int)c;
 					}
 			}
Index: /trunk/nv/interface/terminal.hh
===================================================================
--- /trunk/nv/interface/terminal.hh	(revision 322)
+++ /trunk/nv/interface/terminal.hh	(revision 323)
@@ -25,5 +25,5 @@
 		 * Constructor
 		 */
-		terminal( dimension size ) : m_size( size ), m_cursor(1,1) {}
+		terminal( dimension size ) : m_cursor(1,1), m_size( size ) {}
 
         /**
@@ -85,5 +85,5 @@
 		 * Virtual destructor
 		 */
-		virtual ~terminal() {};
+		virtual ~terminal() {}
 
 	protected:
Index: /trunk/nv/interface/vertex.hh
===================================================================
--- /trunk/nv/interface/vertex.hh	(revision 322)
+++ /trunk/nv/interface/vertex.hh	(revision 323)
@@ -65,5 +65,5 @@
 			template<typename C> static char (&test(...))[2]; 
 		public:
-			static bool const value = sizeof(test<derived>(0)) == 2;;
+			static bool const value = sizeof(test<derived>(0)) == 2;
 		};
 
@@ -238,5 +238,5 @@
 	struct vertex_descriptor
 	{
-		vertex_descriptor_slot slots[ slot::SLOT_MAX_STORE ];
+		vertex_descriptor_slot slots[ (uint16)slot::SLOT_MAX_STORE ];
 		uint32                 count;
 		uint32                 size;
Index: /trunk/nv/io/string_table.hh
===================================================================
--- /trunk/nv/io/string_table.hh	(revision 322)
+++ /trunk/nv/io/string_table.hh	(revision 323)
@@ -27,5 +27,5 @@
 
 		string_table( char* data, uint32 size, offset* offsets, index count )
-			: m_count( count ), m_size( size ), m_data( data ), m_offsets( offsets )
+			: m_data( data ), m_size( size ), m_offsets( offsets ), m_count( count )
 		{
 
Index: /trunk/nv/lib/detail/curses_types.inc
===================================================================
--- /trunk/nv/lib/detail/curses_types.inc	(revision 322)
+++ /trunk/nv/lib/detail/curses_types.inc	(revision 323)
@@ -25,6 +25,10 @@
 
 #ifdef CURSES_CHTYPE_LONG
+# ifdef _LP64
 # if _LP64
 typedef unsigned int chtype;
+# else
+typedef unsigned long chtype;  /* 16-bit attr + 16-bit char */
+# endif
 # else
 typedef unsigned long chtype;  /* 16-bit attr + 16-bit char */
Index: /trunk/nv/lib/wx.hh
===================================================================
--- /trunk/nv/lib/wx.hh	(revision 322)
+++ /trunk/nv/lib/wx.hh	(revision 323)
@@ -59,5 +59,5 @@
 		nv::context* m_context;
 		nv::window*  m_window;
-		wxTimer*     m_update_timer;
+		//wxTimer*     m_update_timer;
 		bool         m_render;
 		wxDECLARE_EVENT_TABLE();
Index: /trunk/nv/rogue/fov.hh
===================================================================
--- /trunk/nv/rogue/fov.hh	(revision 322)
+++ /trunk/nv/rogue/fov.hh	(revision 323)
@@ -25,5 +25,5 @@
 			virtual void initialize( map_area*, const dimension& size ) = 0;
 			virtual void run( const position& p, uint16 radius ) = 0;
-
+			virtual ~fov_algorithm() {}
 		};
 
Index: /trunk/src/curses/curses_terminal.cc
===================================================================
--- /trunk/src/curses/curses_terminal.cc	(revision 322)
+++ /trunk/src/curses/curses_terminal.cc	(revision 323)
@@ -58,5 +58,5 @@
 	if ( color > 7 )
 	{
-		attrset((static_cast<uint32>(color-7) << 24)  & 0xff000000ul | 0x00800000ul);
+		attrset((static_cast<uint32>(color-7) << 24)  & ( 0xff000000ul | 0x00800000ul ) );
 	}
 	else
Index: /trunk/src/engine/particle_engine.cc
===================================================================
--- /trunk/src/engine/particle_engine.cc	(revision 322)
+++ /trunk/src/engine/particle_engine.cc	(revision 323)
@@ -577,5 +577,5 @@
 	case particle_origin::CENTER        : break;
 	case particle_origin::TOP_LEFT      : lb = vec2(0.f,-1.f); rt = vec2(1.f,0.f);  break;
-	case particle_origin::TOP_CENTER    : lb.y = -1.f; rt.y = 0.f; break;  break;
+	case particle_origin::TOP_CENTER    : lb.y = -1.f; rt.y = 0.f; break;
 	case particle_origin::TOP_RIGHT     : lb = vec2(-1.f,-1.f); rt = vec2(); break;
 	case particle_origin::CENTER_LEFT   : lb.x = 0.f; rt.x = 1.f; break;
@@ -663,5 +663,5 @@
 {
 	if ( info->count > 0 )
-		for ( sint32 i = info->count-1; i >= 0; --i )
+		for ( sint32 i = (sint32)info->count-1; i >= 0; --i )
 		{
 			particle& pinfo = info->particles[i];
@@ -723,5 +723,5 @@
 					{
 						float emission_angle = glm::radians( edata.angle );
-						float cos_theta = r.frange( cos( emission_angle ), 1.0f );
+						float cos_theta = r.frange( glm::cos( emission_angle ), 1.0f );
 						float sin_theta = glm::sqrt(1.0f - cos_theta * cos_theta );
 						float phi       = r.frange( 0.0f, 2*glm::pi<float>() );
Index: /trunk/src/engine/program_manager.cc
===================================================================
--- /trunk/src/engine/program_manager.cc	(revision 322)
+++ /trunk/src/engine/program_manager.cc	(revision 323)
@@ -57,5 +57,5 @@
 		for ( uint32 i = 1; i <= count; ++i )
 		{
-			std::string include( inctable.get<std::string,int>(i) );
+			std::string include( inctable.get<std::string,uint32>(i) );
 			if ( i == count ) out += "#line 1\n";
 			out += nv::slurp( include );
Index: /trunk/src/engine/resource_system.cc
===================================================================
--- /trunk/src/engine/resource_system.cc	(revision 322)
+++ /trunk/src/engine/resource_system.cc	(revision 323)
@@ -29,5 +29,5 @@
 	clear();
 	lua::table_guard table( m_lua, get_storage_name() );
-	uint32 count = table.get_integer( "__counter" );
+	uint32 count = table.get_unsigned( "__counter" );
 	for ( auto i : range( count ) )
 	{
Index: /trunk/src/formats/assimp_loader.cc
===================================================================
--- /trunk/src/formats/assimp_loader.cc	(revision 322)
+++ /trunk/src/formats/assimp_loader.cc	(revision 323)
@@ -14,5 +14,5 @@
 using namespace nv;
 
-const int MAX_BONES = 64;
+const unsigned MAX_BONES = 64;
 
 struct assimp_plain_vtx 
@@ -90,5 +90,5 @@
 	m_mesh_count = 0;
 	NV_LOG( nv::LOG_NOTICE, "AssImp loading file..." );
-	int size = (int)source.size();
+	size_t size = source.size();
 	char* data  = new char[ size ];
 	source.read( data, size, 1 );
@@ -159,5 +159,5 @@
 					if ( v.boneweight[i] <= 0.0f ) 
 					{
-						v.boneindex[i] = m;
+						v.boneindex[i]  = (int)m;
 						v.boneweight[i] = bone->mWeights[w].mWeight;
 						found = true;
@@ -289,5 +289,5 @@
 	for ( unsigned int m = 0; m < m_mesh_count; ++m )
 	{
-		sint16 translate[MAX_BONES];
+		uint16 translate[MAX_BONES];
 		std::vector< mesh_node_data > bones;
 		const aiMesh*  mesh  = scene->mMeshes[ m ];
@@ -304,5 +304,5 @@
 				{
 					NV_ASSERT( final_bones.size() < MAX_BONES, "Too many bones to merge!" );
-					sint16 index = (sint16)final_bones.size();
+					uint16 index = (uint16)final_bones.size();
 					final_bones.push_back( bone );
 					names[ bone.name ] = index;
@@ -311,5 +311,5 @@
 				else
 				{
-					translate[b] = (sint16)iname->second;
+					translate[b] = iname->second;
 				}
 			}
@@ -326,5 +326,5 @@
 						if ( vertex.boneweight[i] > 0.0f ) 
 						{
-							vertex.boneindex[i] = translate[vertex.boneindex[i]];
+							vertex.boneindex[i] = (int)translate[vertex.boneindex[i]];
 						}
 					}
Index: /trunk/src/formats/md3_loader.cc
===================================================================
--- /trunk/src/formats/md3_loader.cc	(revision 322)
+++ /trunk/src/formats/md3_loader.cc	(revision 323)
@@ -234,5 +234,5 @@
 
 md3_loader::md3_loader( bool merge_all )
-	: m_md3( nullptr ), m_merge_all( merge_all )
+	: m_merge_all( merge_all ), m_md3( nullptr )
 {
 	if ( !s_normal_ready )
@@ -286,5 +286,5 @@
 {
 	md3_t* md3 = (md3_t*)m_md3;
-	key_raw_channel* result = key_raw_channel::create<md3_key>( md3->header.num_frames );
+	key_raw_channel* result = key_raw_channel::create<md3_key>( (uint32)md3->header.num_frames );
 	// TODO: is this brain damaged in efficiency (loop nest order) or what?
 	for ( sint32 f = 0; f < md3->header.num_frames; ++f )
@@ -322,5 +322,5 @@
 {
 	mesh_data* data = new mesh_data;
-	release_mesh_frame( data, -1, index );
+	release_mesh_frame( data, -1, (sint32)index );
 	return data;
 }
@@ -329,22 +329,22 @@
 {
 	md3_t* md3 = (md3_t*)m_md3;
-	sint32 num_surfaces  = md3->header.num_surfaces;
-	sint32 num_verts     = 0;
-	sint32 current_frame = ( frame == -1 ? 0 : frame );
-	sint32 frame_count   = ( frame == -1 ? md3->header.num_frames : 1 );
-	sint32 current_surf  = ( surface == -1 ? 0 : surface );
-	sint32 surf_count    = ( surface == -1 ? md3->header.num_surfaces : 1 );
-	sint32 index_count   = 0;
+	uint32 num_surfaces  = (uint32)md3->header.num_surfaces;
+	uint32 num_verts     = 0;
+	uint32 current_frame = ( frame == -1 ? 0 : (uint32)frame );
+	uint32 frame_count   = ( frame == -1 ? (uint32)md3->header.num_frames : 1 );
+	uint32 current_surf  = ( surface == -1 ? 0 : (uint32)surface );
+	uint32 surf_count    = ( surface == -1 ? (uint32)md3->header.num_surfaces : 1 );
+	uint32 index_count   = 0;
 
 	if ( surface >= 0 )
 	{
-		index_count = md3->surfaces[surface].header.num_triangles * 3;
-		num_verts   = md3->surfaces[surface].header.num_verts;
+		index_count = (uint32)md3->surfaces[(uint32)surface].header.num_triangles * 3;
+		num_verts   = (uint32)md3->surfaces[(uint32)surface].header.num_verts;
 	}
 	else
-		for ( sint32 i = 0; i < num_surfaces; ++i )
-		{
-			index_count += md3->surfaces[i].header.num_triangles * 3;
-			num_verts   += md3->surfaces[i].header.num_verts;
+		for ( uint32 i = 0; i < num_surfaces; ++i )
+		{
+			index_count += (uint32)md3->surfaces[i].header.num_triangles * 3;
+			num_verts   += (uint32)md3->surfaces[i].header.num_verts;
 		}
 
@@ -362,21 +362,21 @@
 	while ( surf_count > 0 )
 	{
-		const md3_surface_t& surface = md3->surfaces[ current_surf ];
-		const uint32         vcount  = static_cast< uint32 >( surface.header.num_verts );
-		const uint32         tcount  = static_cast< uint32 >( surface.header.num_triangles );
+		const md3_surface_t& sface  = md3->surfaces[ current_surf ];
+		const uint32         vcount = static_cast< uint32 >( sface.header.num_verts );
+		const uint32         tcount = static_cast< uint32 >( sface.header.num_triangles );
 
 		for (uint32 j = 0; j < vcount; ++j )
 		{
-			vtx_t[index++].texcoord = md3_texcoord( surface.st[j] );
+			vtx_t[index++].texcoord = md3_texcoord( sface.st[j] );
 		}
 
 		for (size_t j = 0; j < tcount; ++j )
 		{
-			const md3_triangle_t& t = surface.triangles[j];
+			const md3_triangle_t& t = sface.triangles[j];
 			icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[0] );
 			icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[1] );
 			icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[2] );
 		}
-		index_base += surface.header.num_verts;
+		index_base += sface.header.num_verts;
 		++current_surf;
 		--surf_count;
@@ -386,16 +386,16 @@
 	while ( frame_count > 0 )
 	{
-		current_surf  = ( surface == -1 ? 0 : surface );
-		surf_count    = ( surface == -1 ? md3->header.num_surfaces : 1 );
+		current_surf  = ( surface == -1 ? 0 : (uint32)surface );
+		surf_count    = ( surface == -1 ? (uint32)md3->header.num_surfaces : 1 );
 
 		while ( surf_count > 0 )
 		{
-			md3_surface_t& surface = md3->surfaces[current_surf];
-			sint32         vcount  = surface.header.num_verts;
-			sint32         offset  = vcount * current_frame;
-			sint32         limit   = vcount + offset;
-			for (sint32 j = offset; j < limit; ++j )
+			md3_surface_t& sface  = md3->surfaces[current_surf];
+			uint32         vcount = (uint32)sface.header.num_verts;
+			uint32         offset = vcount * current_frame;
+			uint32         limit  = vcount + offset;
+			for (uint32 j = offset; j < limit; ++j )
 			{
-				md3_vertex_t& v = surface.vertices[j];
+				md3_vertex_t& v = sface.vertices[j];
 				vtx_pn[index].position = vec3( v.x * MD3_XYZ_SCALE, v.z * MD3_XYZ_SCALE, v.y * MD3_XYZ_SCALE );
 				vtx_pn[index].normal   = s_normal_cache[ v.normal ];
@@ -418,5 +418,5 @@
 {
 	md3_t* md3 = (md3_t*)m_md3;
-	uint32 node_count = md3->header.num_tags;
+	uint32 node_count = (uint32)md3->header.num_tags;
 	if ( node_count == 0 ) return nullptr;;
 	mesh_node_data* nodes = new mesh_node_data[ node_count ];
@@ -451,9 +451,9 @@
 	else
 	{
-		count = md3->header.num_surfaces;
+		count = (uint32)md3->header.num_surfaces;
 		data = new mesh_data[ count ];
 		for ( uint32 i = 0; i < count; ++i )
 		{
-			release_mesh_frame( &data[i], -1, i );
+			release_mesh_frame( &data[i], -1, (sint32)i );
 			data[i].set_name( (char*)md3->surfaces[i].header.name );
 		}
Index: /trunk/src/formats/md5_loader.cc
===================================================================
--- /trunk/src/formats/md5_loader.cc	(revision 322)
+++ /trunk/src/formats/md5_loader.cc	(revision 323)
@@ -135,7 +135,7 @@
 			mesh_data* mesh = new mesh_data("md5_mesh");
 
-			int num_verts   = 0;
-			int num_tris    = 0;
-			int num_weights = 0;
+			uint32 num_verts   = 0;
+			uint32 num_tris    = 0;
+			uint32 num_weights = 0;
 
 			discard( sstream, "{" );
@@ -170,5 +170,5 @@
 					next_line( sstream );
 					std::string line;
-					for ( int i = 0; i < num_verts; ++i )
+					for ( uint32 i = 0; i < num_verts; ++i )
 					{
 						size_t weight_count;
@@ -194,5 +194,5 @@
 					next_line( sstream );
 					std::string line;
-					for ( int i = 0; i < num_tris; ++i )
+					for ( uint32 i = 0; i < num_tris; ++i )
 					{
 						size_t ti0;
@@ -214,5 +214,5 @@
 					next_line( sstream );
 					std::string line;
-					for ( int i = 0; i < num_weights; ++i )
+					for ( uint32 i = 0; i < num_weights; ++i )
 					{
 						md5_weight weight;
@@ -368,5 +368,5 @@
 			if ( j < weight_count )
 			{
-				vdata.boneindex[j]  = weights[start_weight + j].joint_id;
+				vdata.boneindex[j]  = (int)weights[start_weight + j].joint_id;
 				vdata.boneweight[j] = weights[start_weight + j].bias;
 			}
Index: /trunk/src/formats/nmd_loader.cc
===================================================================
--- /trunk/src/formats/nmd_loader.cc	(revision 322)
+++ /trunk/src/formats/nmd_loader.cc	(revision 323)
@@ -242,5 +242,5 @@
 
 		nmd_node_header nheader;
-		nheader.parent_id = (uint16)node->parent_id;
+		nheader.parent_id = node->parent_id;
 		nheader.transform = node->transform;
 		stream_out.write( &nheader, sizeof( nheader ), 1 );
Index: /trunk/src/gfx/image.cc
===================================================================
--- /trunk/src/gfx/image.cc	(revision 322)
+++ /trunk/src/gfx/image.cc	(revision 323)
@@ -89,18 +89,20 @@
 	fill( r, 255 );
 
-	sint32 bpos       = (r.pos.y*m_size.x + r.pos.x ) * static_cast<sint32>( m_depth );
-	sint32 bline      = m_size.x*static_cast<sint32>( m_depth );
+	uint32 bpos       = static_cast< uint32 >( r.pos.y*m_size.x + r.pos.x ) * m_depth;
+	uint32 bline      = static_cast< uint32 >( m_size.x ) * m_depth;
 
+	uint32 rsizex     = static_cast< uint32 >( r.size.x );
+	uint32 rsizey     = static_cast< uint32 >( r.size.y );
 	const uint8* data = idata->get_data();
-	sint32 depth      = idata->get_depth();
-	sint32 dstride    = r.size.x * static_cast<sint32>( depth );
+	size_t depth      = idata->get_depth();
+	uint32 dstride    = rsizex * depth;
 
-	for( int y = 0; y < r.size.y; ++y )
+	for( uint32 y = 0; y < rsizey; ++y )
 	{
-		sint32 pos = bpos + bline * y;
-		for( int x = 0; x < r.size.x; ++x )
+		uint32 pos = bpos + bline * y;
+		for( uint32 x = 0; x < rsizex; ++x )
 		{
-			sint32 xy = pos + x * m_depth;
-			for( int e = 0; e < depth; ++e )
+			uint32 xy = pos + x * m_depth;
+			for( size_t e = 0; e < depth; ++e )
 			{
 				m_data[ xy + e ] = data[ y*dstride + x * depth + e ];
Index: /trunk/src/gfx/mesh_creator.cc
===================================================================
--- /trunk/src/gfx/mesh_creator.cc	(revision 322)
+++ /trunk/src/gfx/mesh_creator.cc	(revision 323)
@@ -128,5 +128,5 @@
 		const vertex_descriptor& desc   = channel->desc;
 		uint8* raw_data = channel->data;
-		int vtx_size = desc.size;
+		uint32 vtx_size = desc.size;
 		int p_offset = -1;
 		int n_offset = -1;
@@ -135,7 +135,7 @@
 			switch ( desc.slots[i].vslot )
 			{
-				case slot::POSITION : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) p_offset = desc.slots[i].offset; break;
-				case slot::NORMAL   : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) n_offset = desc.slots[i].offset; break;
-				case slot::TANGENT  : if ( desc.slots[i].etype == FLOAT_VECTOR_4 ) t_offset = desc.slots[i].offset; break;
+				case slot::POSITION : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) p_offset = (int)desc.slots[i].offset; break;
+				case slot::NORMAL   : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) n_offset = (int)desc.slots[i].offset; break;
+				case slot::TANGENT  : if ( desc.slots[i].etype == FLOAT_VECTOR_4 ) t_offset = (int)desc.slots[i].offset; break;
 				default             : break;
 			}
@@ -173,5 +173,5 @@
 	size_t n_offset = 0;
 	if ( ch_n == -1 ) return;
-	mesh_raw_channel* channel = m_data->m_channels[ch_n];
+	mesh_raw_channel* channel = m_data->m_channels[ (unsigned) ch_n ];
 	for ( uint32 i = 0; i < channel->desc.count; ++i )
 		if ( channel->desc.slots[i].vslot == slot::NORMAL )
@@ -211,5 +211,5 @@
 				if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) 
 				{
-					p_offset  = desc.slots[i].offset; 
+					p_offset  = (int)desc.slots[i].offset; 
 					p_channel = channel;
 				}
@@ -217,5 +217,5 @@
 			case slot::NORMAL   : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) 
 				{
-					n_offset  = desc.slots[i].offset; 
+					n_offset  = (int)desc.slots[i].offset; 
 					n_channel = m_data->m_channels[ c ];
 					n_channel_index = c;
@@ -224,5 +224,5 @@
 			case slot::TEXCOORD : if ( desc.slots[i].etype == FLOAT_VECTOR_2 ) 
 				{
-					t_offset  = desc.slots[i].offset; 
+					t_offset  = (int)desc.slots[i].offset; 
 					t_channel = channel;
 				}
@@ -420,8 +420,8 @@
 	int och_ti = other->get_channel_index( slot::TEXCOORD );
 	if ( ch_pi == -1 || ch_ti == -1 ) return;
-	size_t size   = m_data->m_channels[ ch_ti ]->count;
-	size_t osize  =  other->m_channels[ och_ti ]->count;
-	size_t count  = m_data->m_channels[ ch_pi ]->count;
-	size_t ocount =  other->m_channels[ och_pi ]->count;
+	size_t size   = m_data->m_channels[ (unsigned)ch_ti ]->count;
+	size_t osize  =  other->m_channels[ (unsigned)och_ti ]->count;
+	size_t count  = m_data->m_channels[ (unsigned)ch_pi ]->count;
+	size_t ocount =  other->m_channels[ (unsigned)och_pi ]->count;
 	if ( count % size != 0 || ocount % osize != 0 ) return;
 	if ( count / size != ocount / osize ) return;
Index: /trunk/src/gfx/skeletal_mesh.cc
===================================================================
--- /trunk/src/gfx/skeletal_mesh.cc	(revision 322)
+++ /trunk/src/gfx/skeletal_mesh.cc	(revision 323)
@@ -53,6 +53,6 @@
 				for ( size_t j = 0; j < 4; ++j )
 				{
-					int   index  = vert.boneindex[j];
-					float weight = vert.boneweight[j];
+					unsigned index = (unsigned)vert.boneindex[j];
+					float weight   = vert.boneweight[j];
 					const quat& orient      = m_transform[index].get_orientation();
 					const transform& offset = m_pos_offset[index];
@@ -152,5 +152,5 @@
 		if ( bi != bone_names.end() )
 		{
-			bone_id = bi->second;
+			bone_id = (sint16)bi->second;
 		}
 		m_bone_ids[n] = bone_id;
Index: /trunk/src/gl/gl_device.cc
===================================================================
--- /trunk/src/gl/gl_device.cc	(revision 322)
+++ /trunk/src/gl/gl_device.cc	(revision 323)
@@ -132,8 +132,8 @@
 	texture result = m_textures.create();
 	gl_texture_info* info = m_textures.get( result );
-	info->format  = aformat;
-	info->sampler = asampler;
-	info->size    = size;
-	info->glid    = glid;
+	info->format   = aformat;
+	info->tsampler = asampler;
+	info->size     = size;
+	info->glid     = glid;
 	return result;
 }
Index: /trunk/src/gl/gl_enum.cc
===================================================================
--- /trunk/src/gl/gl_enum.cc	(revision 322)
+++ /trunk/src/gl/gl_enum.cc	(revision 323)
@@ -232,5 +232,5 @@
 	case BYTE_VECTOR_3  : return GL_INT_VEC3;
 	case BYTE_VECTOR_4  : return GL_INT_VEC4;
-	NV_RETURN_COVERED_DEFAULT( 0 );
+	default : return 0; // TODO: throw!
 	}
 }
Index: /trunk/src/gl/gl_window.cc
===================================================================
--- /trunk/src/gl/gl_window.cc	(revision 322)
+++ /trunk/src/gl/gl_window.cc	(revision 323)
@@ -19,7 +19,7 @@
 
 #if NV_SDL_VERSION == NV_SDL_20
-	uint32 ucode = ke.keysym.sym;
-#else
-	uint32 ucode = ke.keysym.unicode;
+	uint32 ucode = (uint32)ke.keysym.sym;
+#else
+	uint32 ucode = (uint32)ke.keysym.unicode;
 #endif
 
@@ -34,5 +34,5 @@
 			int capslock = !!(ke.keysym.mod & KMOD_CAPS);
 			if ((shifted ^ capslock) != 0) {
-				kevent.key.ascii = (char8)SDL_toupper(ucode);
+				kevent.key.ascii = (char8)SDL_toupper((int)ucode);
 			}
 		}
Index: /trunk/src/lib/gl.cc
===================================================================
--- /trunk/src/lib/gl.cc	(revision 322)
+++ /trunk/src/lib/gl.cc	(revision 323)
@@ -19,14 +19,9 @@
 // for wgl support
 #if NV_PLATFORM == NV_WINDOWS
-#    ifndef WIN32_LEAN_AND_MEAN
-#      define WIN32_LEAN_AND_MEAN 1
-#    endif
 #include <windows.h>
-#    undef WIN32_LEAN_AND_MEAN
-#endif
-
-// extern added for wgl needs only!
-#define NV_GL_FUN( rtype, fname, fparams ) extern "C" rtype (NV_GL_APIENTRY *fname) fparams = nullptr;
-#define NV_GL_FUN_REN( rtype, fname, rname, fparams ) extern "C" rtype (NV_GL_APIENTRY *rname) fparams = nullptr;
+#endif
+
+#define NV_GL_FUN( rtype, fname, fparams ) rtype (NV_GL_APIENTRY *fname) fparams = nullptr;
+#define NV_GL_FUN_REN( rtype, fname, rname, fparams ) rtype (NV_GL_APIENTRY *rname) fparams = nullptr;
 #define NV_GL_FUN_EXT NV_GL_FUN
 #include <nv/lib/detail/gl_functions.inc>
@@ -41,5 +36,5 @@
 static nv::library gl_library;
 static nv::gl_extensions gl_loaded_extensions = nv::gl_extensions(0);
-extern "C" void* (NV_GL_APIENTRY *gl_ext_loader) ( const char* ) = nullptr;
+static void* (NV_GL_APIENTRY *gl_ext_loader) ( const char* ) = nullptr;
 static bool gl_library_loaded = false;
 static bool wgl_library_loaded = false;
@@ -52,10 +47,10 @@
 };
 
-static const char *gl_extension_ids[] = {
-	"UNKNOWN",
-#define NV_GL_EXTENSION( count, id, name ) #id,
-#include <nv/lib/detail/gl_ext/gl_ext_info.inc>
-#undef NV_GL_EXTENSION
-};
+// static const char *gl_extension_ids[] = {
+// 	"UNKNOWN",
+// #define NV_GL_EXTENSION( count, id, name ) #id,
+// #include <nv/lib/detail/gl_ext/gl_ext_info.inc>
+// #undef NV_GL_EXTENSION
+// };
 
 
@@ -184,7 +179,7 @@
 	wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
 
-	DWORD err = GetLastError();
+	/*DWORD err = */GetLastError();
 	RegisterClass(&wndClass);
-	err = GetLastError();
+	/*err = */GetLastError();
 
 
@@ -235,5 +230,4 @@
 }
 
-
 bool nv::load_gl_extension( gl_extensions extension )
 {
Index: /trunk/src/lua/lua_map_tile.cc
===================================================================
--- /trunk/src/lua/lua_map_tile.cc	(revision 322)
+++ /trunk/src/lua/lua_map_tile.cc	(revision 323)
@@ -27,20 +27,20 @@
 
 
-bool nlua_is_map_tile( lua_State* L, int index )
-{
-	return luaL_testudata( L, index, NLUA_MAP_TILE_METATABLE ) != 0;
-}
-
-map_tile nlua_to_map_tile( lua_State* L, int index )
-{
-	return *(map_tile*)luaL_checkudata( L, index, NLUA_MAP_TILE_METATABLE );
-}
-
-map_tile* nlua_to_pmap_tile( lua_State* L, int index )
+// static bool nlua_is_map_tile( lua_State* L, int index )
+// {
+// 	return luaL_testudata( L, index, NLUA_MAP_TILE_METATABLE ) != 0;
+// }
+// 
+// static map_tile nlua_to_map_tile( lua_State* L, int index )
+// {
+// 	return *(map_tile*)luaL_checkudata( L, index, NLUA_MAP_TILE_METATABLE );
+// }
+
+static map_tile* nlua_to_pmap_tile( lua_State* L, int index )
 {
 	return (map_tile*)luaL_checkudata( L, index, NLUA_MAP_TILE_METATABLE );
 }
 
-void nlua_push_map_tile( lua_State* L, const map_tile& tile )
+static void nlua_push_map_tile( lua_State* L, const map_tile& tile )
 {
 	map_tile* result = (map_tile*)lua_newuserdata( L, sizeof(map_tile) );
@@ -79,5 +79,5 @@
 			if ( lua_isstring( L, -2 ) && lua_objlen( L, -2 ) == 1 )
 			{
-				translation[ lua_tostring( L, -2 )[0] ] = nv::uint8( map_area->string_to_id( lua_tostring( L, -1 ) ) );
+				translation[ (nv::uint8)( lua_tostring( L, -2 )[0] ) ] = nv::uint8( map_area->string_to_id( lua_tostring( L, -1 ) ) );
 			}
 			// removes 'value'; keeps 'key' for next iteration */
@@ -86,8 +86,8 @@
 	}
 
-	for ( int line = 0; line < tile.size_x; line++ )
-		for ( int row = 0; row < tile.size_y; row++ )
-		{
-			nv::char8 gylph = code[ row * ( tile.size_x + 1 ) + line ];
+	for ( nv::uint16 line = 0; line < tile.size_x; line++ )
+		for ( nv::uint16 row = 0; row < tile.size_y; row++ )
+		{
+			nv::char8 gylph = (nv::char8)code[ row * ( tile.size_x + 1 ) + line ];
 			// TODO: check for errors
 			tile.data[ row * tile.size_x + line ] = translation[ gylph ];
@@ -203,7 +203,7 @@
 	switch ( nv::random::get().urand( 4 ) )
 	{
-	case 1 : nlua_map_tile_flip_x( L );
-	case 2 : nlua_map_tile_flip_y( L );
-	case 3 : nlua_map_tile_flip_xy( L );
+	case 1 : nlua_map_tile_flip_x( L ); break;
+	case 2 : nlua_map_tile_flip_y( L ); break;
+	case 3 : nlua_map_tile_flip_xy( L ); break;
 	default:
 		break;
Index: /trunk/src/lua/lua_nova.cc
===================================================================
--- /trunk/src/lua/lua_nova.cc	(revision 322)
+++ /trunk/src/lua/lua_nova.cc	(revision 323)
@@ -9,6 +9,6 @@
 #include "nv/lua/lua_raw.hh"
 
-const char* NV_STATE      = "NV_STATE";
-const char* NV_BLUEPRINTS = "NV_BLUEPRINTS";
+static const char* NV_STATE      = "NV_STATE";
+static const char* NV_BLUEPRINTS = "NV_BLUEPRINTS";
 
 // static nv::lua::state* nova_get_state( lua_State * L )
@@ -73,4 +73,5 @@
 			return true;
 		}
+		break;
 	case LUA_TSTRING :
 		if ( lua_type( L, ivalue ) != LUA_TTABLE )
@@ -86,4 +87,5 @@
 		lua_concat( L, 3 );
 		lua_call( L, 3, 0 );
+		break;
 	case LUA_TNUMBER :
 		if (lua_tointeger( L, itype ) != lua_type( L, ivalue ) && lua_tointeger( L, itype ) > 0)
@@ -91,5 +93,6 @@
 			luaL_error( L, "lua.nova - \"%s.%s\" - type mismatch, %s expected, %s found!", lua_tolstring( L, iid, 0 ), lua_tolstring( L, ifield, 0 ), lua_typename( L, lua_tointeger( L, itype ) ), lua_typename( L, lua_type( L, ivalue ) ) );
 		}
-
+		break;
+	default : return false;
 	}
 	return false;
@@ -784,5 +787,5 @@
 
 
-int luaopen_nova( lua_State * L )
+static int luaopen_nova( lua_State * L )
 {
 	lua_createtable( L, 0, 0 );
