فهرست منبع

Fix all LVL3 msvc compiler warnings, still a couple of link warnings

Paul 11 سال پیش
والد
کامیت
ef4e1c55a4

+ 16 - 16
QGearsMain/src/core/Background2D.cpp

@@ -191,10 +191,10 @@ Background2D::UpdateDebug()
     {
         DEBUG_DRAW.SetTextAlignment( DEBUG_DRAW.LEFT );
         DEBUG_DRAW.SetScreenSpace( true );
-        DEBUG_DRAW.SetColour( Ogre::ColourValue( 0.0, 0.8, 0.8, 1 ) );
+        DEBUG_DRAW.SetColour( Ogre::ColourValue( 0.0f, 0.8f, 0.8f, 1.0f ) );
         for( unsigned int i = 0; i < m_AnimationPlayed.size(); ++i )
         {
-            DEBUG_DRAW.Text( 150, 34 + i * 12, "Background 2D animation: " + m_AnimationPlayed[ i ].name );
+            DEBUG_DRAW.Text( 150.0f, static_cast<float>(34 + i * 12), "Background 2D animation: " + m_AnimationPlayed[ i ].name );
         }
     }
 }
@@ -204,8 +204,8 @@ void
 Background2D::calculateScreenScale( void )
 {
     Ogre::Viewport *viewport( CameraManager::getSingleton().getViewport() );
-    Ogre::Real scale_width( viewport->getActualWidth() );
-    Ogre::Real scale_height( viewport->getActualHeight() );
+    Ogre::Real scale_width = static_cast<Ogre::Real>(viewport->getActualWidth());
+    Ogre::Real scale_height = static_cast<Ogre::Real>(viewport->getActualHeight());
 
     scale_width /= m_virtual_screen_size.x;
     scale_height /= m_virtual_screen_size.y;
@@ -224,10 +224,10 @@ Background2D::OnResize()
     for( unsigned int i = 0; i < m_Tiles.size(); ++i )
     {
         Tile &tile( m_Tiles[ i ] );
-        Ogre::Vector2   top_left ( tile.x, -tile.y );
-        Ogre::Vector2   top_right( tile.x + tile.width, top_left.y );
-        Ogre::Vector2   bottom_right( top_right.x, -( tile.y + tile.height ) );
-        Ogre::Vector2   bottom_left( top_left.x, bottom_right.y );
+        Ogre::Vector2   top_left(static_cast<Ogre::Real>(tile.x), static_cast<Ogre::Real>(- tile.y));
+        Ogre::Vector2   top_right(static_cast<Ogre::Real>(tile.x + tile.width), static_cast<Ogre::Real>(top_left.y));
+        Ogre::Vector2   bottom_right(static_cast<Ogre::Real>(top_right.x), static_cast<Ogre::Real>(-(tile.y + tile.height)));
+        Ogre::Vector2   bottom_left(static_cast<Ogre::Real>(top_left.x), static_cast<Ogre::Real>(bottom_right.y));
 
         virtualScreenToWorldSpace( top_left );
         virtualScreenToWorldSpace( top_right );
@@ -527,7 +527,7 @@ Background2D::AddTile(  const QGears::Tile& tile )
 {
     // TODO: move depth calculation to flevelBackgroundLoader maybe? and let Backgorund2D only handle 0 <= depth <= 1 or so?
     // maybe just move the < 4095 part to flevel background loader?
-    Ogre::Real depth( 0.0001 );
+    Ogre::Real depth( 0.0001f );
     if( tile.depth >= 1 )
     {
         if( tile.depth < 4095 )
@@ -540,7 +540,7 @@ Background2D::AddTile(  const QGears::Tile& tile )
         }
         else
         {
-            depth = 0.9999;
+            depth = 0.9999f;
         }
     }
     AddTile( tile.destination, tile.width, tile.height, depth, tile.uv, tile.blending );
@@ -550,7 +550,7 @@ Background2D::AddTile(  const QGears::Tile& tile )
 void
 Background2D::AddTile( const Ogre::Vector2& destination, const int width, const int height, const float depth, const Ogre::Vector4& uv, const Blending blending )
 {
-    AddTile( destination.x, destination.y, width, height, depth, uv.x, uv.y, uv.z, uv.w, blending );
+    AddTile( static_cast<int>(destination.x), static_cast<int>(destination.y), width, height, depth, uv.x, uv.y, uv.z, uv.w, blending );
 }
 
 //------------------------------------------------------------------------------
@@ -606,9 +606,9 @@ Background2D::AddTile( const int x, const int y, const int width, const int heig
     size_t index( m_Tiles.size() );
     m_Tiles.push_back( tile );
 
-    Ogre::Vector2   top_left ( x, -y );
-    Ogre::Vector2   top_right( x + width, top_left.y );
-    Ogre::Vector2   bottom_right( top_right.x, -( y + height ) );
+    Ogre::Vector2   top_left(static_cast<Ogre::Real>(x), static_cast<Ogre::Real>(-y));
+    Ogre::Vector2   top_right(static_cast<Ogre::Real>(x + width), static_cast<Ogre::Real>(top_left.y));
+    Ogre::Vector2   bottom_right(static_cast<Ogre::Real>(top_right.x), static_cast<Ogre::Real>(-(y + height)));
     Ogre::Vector2   bottom_left( top_left.x, bottom_right.y );
 
     virtualScreenToWorldSpace( top_left );
@@ -835,8 +835,8 @@ Background2D::renderQueueEnded( Ogre::uint8 queueGroupId, const Ogre::String& in
         m_RenderSystem->_setProjectionMatrix( Ogre::Matrix4::IDENTITY );
 
         Ogre::Viewport *viewport( CameraManager::getSingleton().getViewport() );
-        float width = viewport->getActualWidth();
-        float height = viewport->getActualHeight();
+        float width = static_cast<float>(viewport->getActualWidth());
+        float height = static_cast<float>(viewport->getActualHeight());
         Ogre::Matrix4 view;
         view.makeTrans( Ogre::Vector3( m_PositionReal.x * 2 / width, -m_PositionReal.y * 2 / height, 0 ) );
         m_RenderSystem->_setViewMatrix( view );

+ 7 - 7
QGearsMain/src/core/CameraManager.cpp

@@ -89,8 +89,8 @@ CameraManager::Input(const QGears::Event& event, Ogre::Real timeSinceLastFrame)
         }
         else if (event.type == QGears::ET_MOUSE_MOVE && m_CameraFreeRotate == true)
         {
-            m_Camera->rotate( Ogre::Vector3::UNIT_Z, Ogre::Radian( Ogre::Degree( -event.param1 * 0.13 ) ) );
-            m_Camera->pitch( Ogre::Degree( -event.param2 * 0.13 ) );
+            m_Camera->rotate( Ogre::Vector3::UNIT_Z, Ogre::Radian( Ogre::Degree( -event.param1 * 0.13f ) ) );
+            m_Camera->pitch( Ogre::Degree( -event.param2 * 0.13f ) );
         }
     }
 }
@@ -120,7 +120,7 @@ CameraManager::SetCameraFree( const bool enable )
     if( m_CameraFree == true )
     {
         m_Camera->resetFrustumExtents();
-        CameraManager::getSingleton().GetCurrentCamera()->setFOVy( Ogre::Radian( Ogre::Math::PI / 4.0 ) );
+        CameraManager::getSingleton().GetCurrentCamera()->setFOVy( Ogre::Radian( Ogre::Math::PI / 4.0f ) );
     }
     else
     {
@@ -157,8 +157,8 @@ CameraManager::Set2DScroll( const Ogre::Vector2& position )
         return;
     }
 
-    float width = m_Viewport->getActualWidth();
-    float height = m_Viewport->getActualHeight();
+    float width = static_cast<float>(m_Viewport->getActualWidth());
+    float height = static_cast<float>(m_Viewport->getActualHeight());
     float left, right, top, bottom;
     m_Camera->resetFrustumExtents();
     m_Camera->getFrustumExtents( left, right, top, bottom );
@@ -185,8 +185,8 @@ CameraManager::ProjectPointToScreen( const Ogre::Vector3& point )
     view = m_Camera->getProjectionMatrix() * view;
     view.z = z;
 
-    float width = m_Viewport->getActualWidth() / 2;
-    float height = m_Viewport->getActualHeight() / 2;
+    float width = static_cast<float>(m_Viewport->getActualWidth() / 2);
+    float height = static_cast<float>(m_Viewport->getActualHeight() / 2);
 
     view.x = width + view.x * width;
     view.y = height - view.y * height;

+ 14 - 14
QGearsMain/src/core/Console.cpp

@@ -41,7 +41,7 @@ Console::Console():
     Ogre::FontPtr font = Ogre::FontManager::getSingleton().getByName( "CourierNew" );
     if( font.isNull() == false )
     {
-        m_LetterWidth = font->getGlyphAspectRatio( '_' ) * 16;
+        m_LetterWidth = static_cast<int>(font->getGlyphAspectRatio( '_' ) * 16);
     }
     else
     {
@@ -51,7 +51,7 @@ Console::Console():
     // calculate width and height of console depending on size of application
     Ogre::RenderTarget *render_target( QGears::Application::getSingleton().getRenderWindow() );
     m_ConsoleWidth = render_target->getWidth();
-    m_ConsoleHeight = render_target->getHeight() / 2.5f;
+    m_ConsoleHeight = static_cast<int>(render_target->getHeight() / 2.5f);
     m_LineWidth = ( m_ConsoleWidth - 20 ) / 8;
 
     LOG_TRIVIAL( "Created console width " + Ogre::StringConverter::toString( m_ConsoleWidth ) + ", height " + Ogre::StringConverter::toString( m_ConsoleHeight ) );
@@ -266,7 +266,7 @@ Console::Input(const QGears::Event& event)
     else if ((event.type == QGears::ET_KEY_PRESS || event.type == QGears::ET_KEY_REPEAT) && m_InputLine.size() < m_LineWidth)
     {
         char legalchars[] = "ABCDEFGHIJKLMNOPQRSTUVWXUZabcdefghijklmnopqrstuvwxyz1234567890~!@#$%^&*()-_=+?{[]}|\\;:'\"<>,./? ";
-        char txt = event.param2;
+        char txt = static_cast<char>(event.param2);
         for( unsigned int c = 0; c < sizeof( legalchars ) - 1; ++c )
         {
             if( legalchars[ c ] == txt )
@@ -294,7 +294,7 @@ Console::Update()
 
         if( m_Height >= m_ConsoleHeight )
         {
-            m_Height = m_ConsoleHeight;
+            m_Height = static_cast<float>(m_ConsoleHeight);
         }
     }
     else if( m_ToVisible == false && m_Height > 0 )
@@ -329,14 +329,14 @@ Console::UpdateDraw()
     DEBUG_DRAW.SetScreenSpace( true );
     DEBUG_DRAW.SetColour( Ogre::ColourValue( 0.05f, 0.06f, 0.2f, 0.95f ) );
     DEBUG_DRAW.SetZ( -0.5f );
-    DEBUG_DRAW.Quad( 0, 0, m_ConsoleWidth, 0, m_ConsoleWidth, m_Height, 0, m_Height );
+    DEBUG_DRAW.Quad( 0.0f, 0.0f, static_cast<float>(m_ConsoleWidth), 0.0f, static_cast<float>(m_ConsoleWidth), m_Height, 0.0f, m_Height );
     DEBUG_DRAW.SetColour( Ogre::ColourValue(  0.18f, 0.22f, 0.74f, 0.95f ) );
     DEBUG_DRAW.SetZ( -0.6f );
-    DEBUG_DRAW.Line( 0, m_Height, m_ConsoleWidth, m_Height );
+    DEBUG_DRAW.Line( 0.0f, m_Height, static_cast<float>(m_ConsoleWidth), m_Height );
 
     int row = 1;
     int rows = ( m_ConsoleHeight - 30 ) / 16;
-    int y = -m_ConsoleHeight + m_Height;
+    int y = static_cast<int>(-m_ConsoleHeight + m_Height);
     int empty = rows - m_DisplayLine;
     if( empty > 0 )
     {
@@ -350,7 +350,7 @@ Console::UpdateDraw()
         {
 
             DEBUG_DRAW.SetColour( ( *i ).colour );
-            DEBUG_DRAW.Text( 5, y, ( *i ).text );
+            DEBUG_DRAW.Text( 5.0f, static_cast<float>(y), ( *i ).text );
             y += 16;
         }
     }
@@ -361,8 +361,8 @@ Console::UpdateDraw()
         {
             temp += "^";
         }
-        DEBUG_DRAW.SetColour( Ogre::ColourValue( 1, 0, 0, 1 ) );
-        DEBUG_DRAW.Text( 5, y, temp );
+        DEBUG_DRAW.SetColour( Ogre::ColourValue( 1.0f, 0.0f, 0.0f, 1.0f ) );
+        DEBUG_DRAW.Text( 5.0f, static_cast<float>(y), temp );
     }
 
 
@@ -371,7 +371,7 @@ Console::UpdateDraw()
     if( ( ( ( int )( m_CursorBlinkTime * 1000 ) ) >> 8 ) & 1 )
     {
         DEBUG_DRAW.SetColour( Ogre::ColourValue( 0.88f, 0.88f, 0.88f, 1 ) );
-        DEBUG_DRAW.Text( 12 + m_CursorPosition * m_LetterWidth, -19 + m_Height, "_" );
+        DEBUG_DRAW.Text( static_cast<float>(12 + m_CursorPosition * m_LetterWidth), static_cast<float>(-19 + m_Height), "_" );
     }
 
 
@@ -380,7 +380,7 @@ Console::UpdateDraw()
         DEBUG_DRAW.SetColour( Ogre::ColourValue( 1, 1, 1, 1 ) );
         DEBUG_DRAW.Text( 12, -20 + m_Height, m_InputLine);
         DEBUG_DRAW.SetColour( Ogre::ColourValue( 0, 1, 0, 1 ) );
-        DEBUG_DRAW.Text( 12 + ( m_InputLine.size() * m_LetterWidth ), -20 + m_Height, m_AutoCompletition[ m_AutoCompletitionLine ] );
+        DEBUG_DRAW.Text( static_cast<float>(12 + ( m_InputLine.size() * m_LetterWidth )), static_cast<float>(-20 + m_Height), m_AutoCompletition[ m_AutoCompletitionLine ] );
     }
     else
     {
@@ -413,7 +413,7 @@ Console::UpdateNotification()
             Ogre::ColourValue colour = ( *i ).colour;
             colour.a = ( max_time - time ) / max_time;
             DEBUG_DRAW.SetColour( colour );
-            DEBUG_DRAW.Text( 5, y, ( *i ).text );
+            DEBUG_DRAW.Text( 5.0f, static_cast<float>(y), ( *i ).text );
             y -= 16;
             ++line;
         }
@@ -428,7 +428,7 @@ Console::OnResize()
     // calculate width and height of console depending on size of application
     Ogre::RenderTarget *render_target( QGears::Application::getSingleton().getRenderWindow() );
     m_ConsoleWidth = render_target->getWidth();
-    m_ConsoleHeight = render_target->getHeight() / 2.5f;
+    m_ConsoleHeight = static_cast<int>(render_target->getHeight() / 2.5f);
     m_LineWidth = ( m_ConsoleWidth - 20 ) / 8;
 
     LOG_TRIVIAL( "Resized console width to " + Ogre::StringConverter::toString( m_ConsoleWidth ) + ", height to " + Ogre::StringConverter::toString( m_ConsoleHeight ) );

+ 10 - 10
QGearsMain/src/core/Entity.cpp

@@ -16,9 +16,9 @@ Entity::Entity( const Ogre::String& name, Ogre::SceneNode* node ):
     m_Name( name ),
     m_SceneNode( node ),
 
-    m_Height( 1 ),
+    m_Height( 1.0f ),
 
-    m_SolidRadius( 0.24 ),
+    m_SolidRadius( 0.24f ),
     m_Solid( false ),
 
     m_TalkRadius( 0.45f ),
@@ -31,7 +31,7 @@ Entity::Entity( const Ogre::String& name, Ogre::SceneNode* node ):
     m_MoveRunSpeed( 0.8f ),
     m_MovePosition( Ogre::Vector3( 0, 0, 0 ) ),
     m_MoveEntity( NULL ),
-    m_MoveStopDistance( 0 ),
+    m_MoveStopDistance( 0.0f ),
     m_MoveTriangleId( -1 ),
     m_MoveAutoRotation( true ),
     m_MoveAutoAnimation( true ),
@@ -44,24 +44,24 @@ Entity::Entity( const Ogre::String& name, Ogre::SceneNode* node ):
 
     m_JumpStart( 0.0f, 0.0f, 0.0f ),
     m_JumpEnd( 0.0f, 0.0f, 0.0f ),
-    m_JumpSeconds( 0 ),
-    m_JumpCurrentSeconds( 0 ),
+    m_JumpSeconds( 0.0f ),
+    m_JumpCurrentSeconds( 0.0f ),
 
     m_OffsetPositionStart( 0.0f, 0.0f, 0.0f ),
     m_OffsetPositionEnd( 0.0f, 0.0f, 0.0f ),
     m_OffsetType( AT_NONE ),
-    m_OffsetSeconds( 0 ),
-    m_OffsetCurrentSeconds( 0 ),
+    m_OffsetSeconds( 0.0f ),
+    m_OffsetCurrentSeconds( 0.0f ),
 
     m_TurnDirection( TD_CLOSEST ),
     m_TurnDirectionStart( 0 ),
     m_TurnDirectionEnd( 0 ),
     m_TurnEntity( NULL ),
     m_TurnType( AT_NONE ),
-    m_TurnSeconds( 0 ),
-    m_TurnCurrentSeconds( 0 ),
+    m_TurnSeconds( 0.0f ),
+    m_TurnCurrentSeconds( 0.0f ),
 
-    m_AnimationSpeed( 1 ),
+    m_AnimationSpeed( 1.0f ),
     m_AnimationDefault( "Idle" ),
     m_AnimationCurrentName( "" ),
     m_AnimationAutoPlay( true )

+ 1 - 1
QGearsMain/src/core/EntityTrigger.cpp

@@ -57,7 +57,7 @@ EntityTrigger::UpdateDebug()
         DEBUG_DRAW.SetColour( Ogre::ColourValue( 0.04f, 0.9f, 0.5f ) );
         for( unsigned int i = 0; i < m_Activators.size(); ++i )
         {
-            DEBUG_DRAW.Text( center, 0, ( i + 1 ) * 16, m_Activators[ i ]->GetName() );
+            DEBUG_DRAW.Text( center, 0.0f, static_cast<float>(( i + 1 ) * 16), m_Activators[ i ]->GetName() );
         }
     }
 }

+ 6 - 6
QGearsMain/src/core/InputManager.cpp

@@ -48,7 +48,7 @@ InputManager::ButtonPressed( int button, char text, bool down )
         m_ButtonState[ button ] = down;
         m_ButtonText[ button ] = text;
 
-        m_EventQueue.push_back(QGears::Event((down == true) ? QGears::ET_KEY_PRESS : QGears::ET_KEY_RELEASE, button, text));
+        m_EventQueue.push_back(QGears::Event((down == true) ? QGears::ET_KEY_PRESS : QGears::ET_KEY_RELEASE, static_cast<float>(button), static_cast<float>(text)));
 
         m_RepeatFirstWait = true;
         m_RepeatTimer = 0;
@@ -65,7 +65,7 @@ InputManager::ButtonPressed( int button, char text, bool down )
 void
 InputManager::MousePressed( int button, bool down )
 {
-    m_EventQueue.push_back(QGears::Event((down == true) ? QGears::ET_MOUSE_PRESS : QGears::ET_MOUSE_RELEASE, button, 0));
+    m_EventQueue.push_back(QGears::Event((down == true) ? QGears::ET_MOUSE_PRESS : QGears::ET_MOUSE_RELEASE, static_cast<float>(button), 0.0f));
 }
 
 
@@ -73,7 +73,7 @@ InputManager::MousePressed( int button, bool down )
 void
 InputManager::MouseMoved( int x, int y )
 {
-    m_EventQueue.push_back(QGears::Event(QGears::ET_MOUSE_MOVE, x, y));
+    m_EventQueue.push_back(QGears::Event(QGears::ET_MOUSE_MOVE, static_cast<float>(x), static_cast<float>(y)));
 }
 
 
@@ -81,7 +81,7 @@ InputManager::MouseMoved( int x, int y )
 void
 InputManager::MouseScrolled( int value )
 {
-    m_EventQueue.push_back(QGears::Event(QGears::ET_MOUSE_SCROLL, value, 0));
+    m_EventQueue.push_back(QGears::Event(QGears::ET_MOUSE_SCROLL, static_cast<float>(value), 0.0f));
 }
 
 
@@ -97,7 +97,7 @@ InputManager::Update()
         {
             if( m_ButtonState[ button ] == true )
             {
-                m_EventQueue.push_back(QGears::Event(QGears::ET_KEY_REPEAT, button, m_ButtonText[button]));
+                m_EventQueue.push_back(QGears::Event(QGears::ET_KEY_REPEAT, static_cast<float>(button), static_cast<float>(m_ButtonText[button])));
             }
         }
 
@@ -110,7 +110,7 @@ InputManager::Update()
     {
         if( m_ButtonState[ button ] == true )
         {
-            m_EventQueue.push_back(QGears::Event(QGears::ET_KEY_IMPULSE, button, m_ButtonText[button]));
+            m_EventQueue.push_back(QGears::Event(QGears::ET_KEY_IMPULSE, static_cast<float>(button), static_cast<float>(m_ButtonText[button])));
         }
     }
 }

+ 5 - 5
QGearsMain/src/core/ScriptManager.cpp

@@ -127,8 +127,8 @@ ScriptManager::Update( const ScriptManager::Type type )
         {
             if( ( debug & ( 1 << i ) ) != 0 )
             {
-                DEBUG_DRAW.SetColour( Ogre::ColourValue( 0.8, 0.8, 0, 1 ) );
-                DEBUG_DRAW.Text( 10, y, "Script \"" + script_entity_type[ i ] + "\" entity:" );
+                DEBUG_DRAW.SetColour( Ogre::ColourValue( 0.8f, 0.8f, 0.0f, 1.0f ) );
+                DEBUG_DRAW.Text( 10.0f, static_cast<float>(y), "Script \"" + script_entity_type[ i ] + "\" entity:" );
                 y += 16;
 
                 for( unsigned int j = 0; j < m_ScriptEntity.size(); ++j )
@@ -141,7 +141,7 @@ ScriptManager::Update( const ScriptManager::Type type )
                         if( queue_size > 0 )
                         {
                             text += ": ";
-                            DEBUG_DRAW.SetColour( Ogre::ColourValue( 0.8, 0.8, 0, 1 ) );
+                            DEBUG_DRAW.SetColour( Ogre::ColourValue( 0.8f, 0.8f, 0.0f, 1.0f ) );
                         }
                         else
                         {
@@ -164,7 +164,7 @@ ScriptManager::Update( const ScriptManager::Type type )
                             }
                         }
 
-                        DEBUG_DRAW.Text( 20, y, text );
+                        DEBUG_DRAW.Text( 20.0f, static_cast<float>(y), text );
                         y += 16;
                     }
                 }
@@ -207,7 +207,7 @@ ScriptManager::Update( const ScriptManager::Type type )
                             {
                                 ret = luabind::resume_function< int >( table[ m_CurrentScriptId.function ], table, m_ScriptEntity[ i ].queue[ 0 ].argument1.c_str(), m_ScriptEntity[ i ].queue[ 0 ].argument2.c_str() );
                             }
-                            catch( luabind::error& e )
+                            catch( luabind::error& /*e*/ )
                             {
                                 LOG_ERROR( Ogre::String( lua_tostring( m_ScriptEntity[ i ].queue[ 0 ].state , -1 ) ) );
                             }

+ 16 - 16
QGearsMain/src/core/UiSprite.cpp

@@ -149,25 +149,25 @@ UiSprite::UpdateGeometry()
         float cos = Ogre::Math::Cos( Ogre::Radian( Ogre::Degree( m_FinalRotation ) ) );
         float sin = Ogre::Math::Sin( Ogre::Radian( Ogre::Degree( m_FinalRotation ) ) );
 
-        x1 = local_x1 * cos - local_y1 * sin + x;
-        y1 = local_x1 * sin + local_y1 * cos + y;
-        x2 = local_x2 * cos - local_y1 * sin + x;
-        y2 = local_x2 * sin + local_y1 * cos + y;
-        x3 = local_x2 * cos - local_y2 * sin + x;
-        y3 = local_x2 * sin + local_y2 * cos + y;
-        x4 = local_x1 * cos - local_y2 * sin + x;
-        y4 = local_x1 * sin + local_y2 * cos + y;
+        x1 = static_cast<int>(local_x1 * cos - local_y1 * sin + x);
+        y1 = static_cast<int>(local_x1 * sin + local_y1 * cos + y);
+        x2 = static_cast<int>(local_x2 * cos - local_y1 * sin + x);
+        y2 = static_cast<int>(local_x2 * sin + local_y1 * cos + y);
+        x3 = static_cast<int>(local_x2 * cos - local_y2 * sin + x);
+        y3 = static_cast<int>(local_x2 * sin + local_y2 * cos + y);
+        x4 = static_cast<int>(local_x1 * cos - local_y2 * sin + x);
+        y4 = static_cast<int>(local_x1 * sin + local_y2 * cos + y);
     }
     else
     {
-        x1 = local_x1 + x;
-        y1 = local_y1 + y;
-        x2 = local_x2 + x;
-        y2 = local_y1 + y;
-        x3 = local_x2 + x;
-        y3 = local_y2 + y;
-        x4 = local_x1 + x;
-        y4 = local_y2 + y;
+        x1 = static_cast<int>(local_x1 + x);
+        y1 = static_cast<int>(local_y1 + y);
+        x2 = static_cast<int>(local_x2 + x);
+        y2 = static_cast<int>(local_y1 + y);
+        x3 = static_cast<int>(local_x2 + x);
+        y3 = static_cast<int>(local_y2 + y);
+        x4 = static_cast<int>(local_x1 + x);
+        y4 = static_cast<int>(local_y2 + y);
     }
 
     //LOG_ERROR( "x1 = " + Ogre::StringConverter::toString( x1 ) + ", y1 = " + Ogre::StringConverter::toString( y1 ) );

+ 18 - 18
QGearsMain/src/core/UiTextArea.cpp

@@ -320,25 +320,25 @@ UiTextArea::SetTextGeometry( const Ogre::UTFString& text, TextBlockData& data, c
             float cos = Ogre::Math::Cos( Ogre::Radian( Ogre::Degree( m_FinalRotation ) ) );
             float sin = Ogre::Math::Sin( Ogre::Radian( Ogre::Degree( m_FinalRotation ) ) );
 
-            x1 = local_x1 * cos - local_y1 * sin + x;
-            y1 = local_x1 * sin + local_y1 * cos + y;
-            x2 = local_x2 * cos - local_y1 * sin + x;
-            y2 = local_x2 * sin + local_y1 * cos + y;
-            x3 = local_x2 * cos - local_y2 * sin + x;
-            y3 = local_x2 * sin + local_y2 * cos + y;
-            x4 = local_x1 * cos - local_y2 * sin + x;
-            y4 = local_x1 * sin + local_y2 * cos + y;
+            x1 = static_cast<int>(local_x1 * cos - local_y1 * sin + x);
+            y1 = static_cast<int>(local_x1 * sin + local_y1 * cos + y);
+            x2 = static_cast<int>(local_x2 * cos - local_y1 * sin + x);
+            y2 = static_cast<int>(local_x2 * sin + local_y1 * cos + y);
+            x3 = static_cast<int>(local_x2 * cos - local_y2 * sin + x);
+            y3 = static_cast<int>(local_x2 * sin + local_y2 * cos + y);
+            x4 = static_cast<int>(local_x1 * cos - local_y2 * sin + x);
+            y4 = static_cast<int>(local_x1 * sin + local_y2 * cos + y);
         }
         else
         {
-            x1 = local_x1 + x;
-            y1 = local_y1 + y;
-            x2 = local_x2 + x;
-            y2 = local_y1 + y;
-            x3 = local_x2 + x;
-            y3 = local_y2 + y;
-            x4 = local_x1 + x;
-            y4 = local_y2 + y;
+            x1 = static_cast<int>(local_x1 + x);
+            y1 = static_cast<int>(local_y1 + y);
+            x2 = static_cast<int>(local_x2 + x);
+            y2 = static_cast<int>(local_y1 + y);
+            x3 = static_cast<int>(local_x2 + x);
+            y3 = static_cast<int>(local_y2 + y);
+            x4 = static_cast<int>(local_x1 + x);
+            y4 = static_cast<int>(local_y2 + y);
         }
 
         //LOG_ERROR( "x1 = " + Ogre::StringConverter::toString( x1 ) + ", y1 = " + Ogre::StringConverter::toString( y1 ) );
@@ -357,8 +357,8 @@ UiTextArea::SetTextGeometry( const Ogre::UTFString& text, TextBlockData& data, c
 
         local_x1 += ( char_data.width + char_data.post ) * m_FinalScale.x * m_ScreenHeight / 720.0f;
 
-        float width = m_Font->GetImageWidth();
-        float height = m_Font->GetImageHeight();
+        float width = static_cast<float>(m_Font->GetImageWidth());
+        float height = static_cast<float>(m_Font->GetImageHeight());
         float left = ( float )char_data.x / width;
         float right = ( float )( char_data.x + char_data.width ) / width;
         float top = ( float )char_data.y / height;

+ 47 - 47
QGearsMain/src/core/UiWidget.cpp

@@ -54,8 +54,8 @@ void
 UiWidget::Initialise()
 {
     Ogre::Viewport *viewport( CameraManager::getSingleton().getViewport() );
-    m_ScreenWidth = viewport->getActualWidth();
-    m_ScreenHeight = viewport->getActualHeight();
+    m_ScreenWidth = static_cast<float>(viewport->getActualWidth());
+    m_ScreenHeight = static_cast<float>(viewport->getActualHeight());
 
     m_Visible = false;
 
@@ -89,9 +89,9 @@ UiWidget::Initialise()
 
     m_Scissor = false;
     m_ScissorTop = 0;
-    m_ScissorBottom = m_ScreenHeight;
+    m_ScissorBottom = static_cast<int>(m_ScreenHeight);
     m_ScissorLeft = 0;
-    m_ScissorRight = m_ScreenWidth;
+    m_ScissorRight = static_cast<int>(m_ScreenWidth);
 
     m_AnimationCurrent = NULL;
     m_AnimationDefault = "";
@@ -186,32 +186,32 @@ UiWidget::Update()
             float cos = Ogre::Math::Cos( Ogre::Radian( Ogre::Degree( m_FinalRotation ) ) );
             float sin = Ogre::Math::Sin( Ogre::Radian( Ogre::Degree( m_FinalRotation ) ) );
 
-            x1 = local_x1 * cos - local_y1 * sin + x;
-            y1 = local_x1 * sin + local_y1 * cos + y;
-            x2 = local_x2 * cos - local_y1 * sin + x;
-            y2 = local_x2 * sin + local_y1 * cos + y;
-            x3 = local_x2 * cos - local_y2 * sin + x;
-            y3 = local_x2 * sin + local_y2 * cos + y;
-            x4 = local_x1 * cos - local_y2 * sin + x;
-            y4 = local_x1 * sin + local_y2 * cos + y;
+            x1 = static_cast<int>(local_x1 * cos - local_y1 * sin + x);
+            y1 = static_cast<int>(local_x1 * sin + local_y1 * cos + y);
+            x2 = static_cast<int>(local_x2 * cos - local_y1 * sin + x);
+            y2 = static_cast<int>(local_x2 * sin + local_y1 * cos + y);
+            x3 = static_cast<int>(local_x2 * cos - local_y2 * sin + x);
+            y3 = static_cast<int>(local_x2 * sin + local_y2 * cos + y);
+            x4 = static_cast<int>(local_x1 * cos - local_y2 * sin + x);
+            y4 = static_cast<int>(local_x1 * sin + local_y2 * cos + y);
         }
         else
         {
-            x1 = local_x1 + x;
-            y1 = local_y1 + y;
-            x2 = local_x2 + x;
-            y2 = local_y1 + y;
-            x3 = local_x2 + x;
-            y3 = local_y2 + y;
-            x4 = local_x1 + x;
-            y4 = local_y2 + y;
+            x1 = static_cast<int>(local_x1 + x);
+            y1 = static_cast<int>(local_y1 + y);
+            x2 = static_cast<int>(local_x2 + x);
+            y2 = static_cast<int>(local_y1 + y);
+            x3 = static_cast<int>(local_x2 + x);
+            y3 = static_cast<int>(local_y2 + y);
+            x4 = static_cast<int>(local_x1 + x);
+            y4 = static_cast<int>(local_y2 + y);
         }
 
         // slightly modify to let show things that are on board of screen
-        DEBUG_DRAW.Line( x1, y1 + 1, x2, y2 + 1 );
-        DEBUG_DRAW.Line( x2 - 1, y2, x3 - 1, y3 );
-        DEBUG_DRAW.Line( x3, y3, x4, y4 );
-        DEBUG_DRAW.Line( x4, y4, x1, y1 );
+        DEBUG_DRAW.Line(static_cast<float>(x1), static_cast<float>(y1 + 1), static_cast<float>(x2), static_cast<float>(y2 + 1));
+        DEBUG_DRAW.Line(static_cast<float>(x2 - 1), static_cast<float>(y2), static_cast<float>(x3 - 1), static_cast<float>(y3));
+        DEBUG_DRAW.Line(static_cast<float>(x3), static_cast<float>(y3), static_cast<float>(x4), static_cast<float>(y4));
+        DEBUG_DRAW.Line(static_cast<float>(x4), static_cast<float>(y4), static_cast<float>(x1), static_cast<float>(y1));
 
         // draw translation
         DEBUG_DRAW.SetColour( Ogre::ColourValue( 0, 1, 0, 1 ) );
@@ -225,13 +225,13 @@ UiWidget::Update()
         {
             DEBUG_DRAW.SetColour( Ogre::ColourValue::White );
             DEBUG_DRAW.SetTextAlignment( DEBUG_DRAW.LEFT );
-            DEBUG_DRAW.Text( x1 + 3, y1, m_PathName );
-            DEBUG_DRAW.Text( x1 + 3, y1 + 12, GetCurrentAnimationName() );
+            DEBUG_DRAW.Text(static_cast<float>(x1 + 3), static_cast<float>(y1), m_PathName);
+            DEBUG_DRAW.Text(static_cast<float>(x1 + 3), static_cast<float>(y1 + 12), GetCurrentAnimationName());
         }
 
         // draw origin
         DEBUG_DRAW.SetColour( Ogre::ColourValue( 1, 0, 0, 1 ) );
-        DEBUG_DRAW.Line( x, y, x1, y1 + 1 );
+        DEBUG_DRAW.Line( x, y, static_cast<float>(x1), static_cast<float>(y1 + 1) );
     }
 }
 
@@ -241,8 +241,8 @@ void
 UiWidget::OnResize()
 {
     Ogre::Viewport *viewport( CameraManager::getSingleton().getViewport() );
-    m_ScreenWidth = viewport->getActualWidth();
-    m_ScreenHeight = viewport->getActualHeight();
+    m_ScreenWidth = static_cast<float>(viewport->getActualWidth());
+    m_ScreenHeight = static_cast<float>(viewport->getActualHeight());
 
     for( size_t i = 0; i < m_Children.size(); ++i )
     {
@@ -487,9 +487,9 @@ UiWidget::UpdateTransformation()
 
     // scissor update
     m_ScissorTop = ( m_Parent != NULL ) ? m_Parent->GetScissorTop() : 0;
-    m_ScissorBottom = ( m_Parent != NULL ) ? m_Parent->GetScissorBottom() : m_ScreenHeight;
+    m_ScissorBottom = ( m_Parent != NULL ) ? m_Parent->GetScissorBottom() : static_cast<int>(m_ScreenHeight);
     m_ScissorLeft = ( m_Parent != NULL ) ? m_Parent->GetScissorLeft() : 0;
-    m_ScissorRight = ( m_Parent != NULL ) ? m_Parent->GetScissorRight() : m_ScreenWidth;
+    m_ScissorRight = (m_Parent != NULL) ? m_Parent->GetScissorRight() : static_cast<int>(m_ScreenWidth);
 
     if( m_Scissor == true )
     {
@@ -507,25 +507,25 @@ UiWidget::UpdateTransformation()
             float cos = Ogre::Math::Cos( Ogre::Radian( Ogre::Degree( m_FinalRotation ) ) );
             float sin = Ogre::Math::Sin( Ogre::Radian( Ogre::Degree( m_FinalRotation ) ) );
 
-            x1 = local_x1 * cos - local_y1 * sin + x;
-            y1 = local_x1 * sin + local_y1 * cos + y;
-            x2 = local_x2 * cos - local_y1 * sin + x;
-            y2 = local_x2 * sin + local_y1 * cos + y;
-            x3 = local_x2 * cos - local_y2 * sin + x;
-            y3 = local_x2 * sin + local_y2 * cos + y;
-            x4 = local_x1 * cos - local_y2 * sin + x;
-            y4 = local_x1 * sin + local_y2 * cos + y;
+            x1 = static_cast<int>(local_x1 * cos - local_y1 * sin + x);
+            y1 = static_cast<int>(local_x1 * sin + local_y1 * cos + y);
+            x2 = static_cast<int>(local_x2 * cos - local_y1 * sin + x);
+            y2 = static_cast<int>(local_x2 * sin + local_y1 * cos + y);
+            x3 = static_cast<int>(local_x2 * cos - local_y2 * sin + x);
+            y3 = static_cast<int>(local_x2 * sin + local_y2 * cos + y);
+            x4 = static_cast<int>(local_x1 * cos - local_y2 * sin + x);
+            y4 = static_cast<int>(local_x1 * sin + local_y2 * cos + y);
         }
         else
         {
-            x1 = local_x1 + x;
-            y1 = local_y1 + y;
-            x2 = local_x2 + x;
-            y2 = local_y1 + y;
-            x3 = local_x2 + x;
-            y3 = local_y2 + y;
-            x4 = local_x1 + x;
-            y4 = local_y2 + y;
+            x1 = static_cast<int>(local_x1 + x);
+            y1 = static_cast<int>(local_y1 + y);
+            x2 = static_cast<int>(local_x2 + x);
+            y2 = static_cast<int>(local_y1 + y);
+            x3 = static_cast<int>(local_x2 + x);
+            y3 = static_cast<int>(local_y2 + y);
+            x4 = static_cast<int>(local_x1 + x);
+            y4 = static_cast<int>(local_y2 + y);
         }
 
         m_ScissorTop = std::max( m_ScissorTop, std::min( std::min( y1 , y2 ), std::min( y3 , y4 ) ) );

+ 1 - 1
QGearsMain/src/core/XmlBackground2DFile.cpp

@@ -68,7 +68,7 @@ XmlBackground2DFile::Load()
                 Ogre::Vector4 distance = Ogre::Vector4( 0, 0, -depth, 1 );
                 Ogre::Vector4 res = CameraManager::getSingleton().GetCurrentCamera()->getProjectionMatrixWithRSDepth() * distance;
                 res = res / res.w;
-                background->AddTile( destination.x, destination.y, width, height, res.z, uv.x, uv.y, uv.z, uv.w, blending );
+                background->AddTile( static_cast<int>(destination.x), static_cast<int>(destination.y), width, height, res.z, uv.x, uv.y, uv.z, uv.w, blending );
 
                 TiXmlNode* node2 = node->FirstChild();
                 while( node2 != NULL )

+ 1 - 1
QGearsMain/src/data/QGearsAFile.cpp

@@ -24,7 +24,7 @@ GNU General Public License for more details.
 namespace QGears
 {
    //-------------------------------------------------------------------------
-   const Ogre::Real AFile::FRAME_DURATION( 1.0 / 30.0 );
+   const Ogre::Real AFile::FRAME_DURATION( 1.0f / 30.0f );
    const String     AFile::RESOURCE_TYPE( "QGearsAFile" );
 
    //-------------------------------------------------------------------------

+ 1 - 1
QGearsMain/src/data/QGearsCameraMatrixFileSerializer.cpp

@@ -59,7 +59,7 @@ namespace QGears
             position[i] = Ogre::Real(pos[i]);
             for( size_t j(0); j < CAMERA_MATRIX_COL_COUNT; ++j )
             {
-                camera_matrix[j][i] = matrix_sint16[i][j] / 4096.0;
+                camera_matrix[j][i] = matrix_sint16[i][j] / 4096.0f;
             }
         }
         position = camera_matrix * position;

+ 1 - 1
QGearsMain/src/data/QGearsFLevelFileSerializer.cpp

@@ -224,7 +224,7 @@ namespace QGears
         WalkmeshFile::TriangleList& triangles( walkmesh->getTriangles() );
         WalkmeshFile::TriangleList::iterator it( triangles.begin() );
         WalkmeshFile::TriangleList::const_iterator it_end( triangles.end() );
-        Ogre::Real scale( pDest->getCameraMatrix()->getCount() );
+        Ogre::Real scale = static_cast<Ogre::Real>(pDest->getCameraMatrix()->getCount() );
         scale *= FF7::FIELD_POSITION_SCALE;
         while( it != it_end )
         {

+ 5 - 5
QGearsMain/src/data/QGearsPaletteFileSerializer.cpp

@@ -70,14 +70,14 @@ namespace QGears
         readShort( stream, colour );
         //convertColour( colour );
         //Ogre::PixelUtil::unpackColour( &pDest, PIXEL_FORMAT, &colour );
-        pDest.r =   colour & BIT_MASK_RED;
-        pDest.g = ( colour & BIT_MASK_GREEN ) >>  5;
-        pDest.b = ( colour & BIT_MASK_BLUE  ) >> 10;
+        pDest.r = static_cast<float>(colour & BIT_MASK_RED);
+        pDest.g = static_cast<float>(( colour & BIT_MASK_GREEN ) >>  5);
+        pDest.b = static_cast<float>(( colour & BIT_MASK_BLUE  ) >> 10);
         pDest /= BIT_SIZE;
-        pDest.a = 0;
+        pDest.a = 0.0f;
         if ( colour & BIT_MASK_ALPHA )
         {
-            pDest.a = 1;
+            pDest.a = 1.0f;
         }
     }