This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository colobot.

commit 417301ff061e4ed6b74e4c360f6878e6d0d5cb39
Author: MatiRg <[email protected]>
Date:   Tue May 23 18:57:41 2017 +0200

    Fix rendering glasses in FPP camera, closes #775 (#959)
---
 src/object/motion/motionhuman.cpp | 21 +++++++++++++++++----
 src/object/motion/motionhuman.h   |  1 +
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/object/motion/motionhuman.cpp 
b/src/object/motion/motionhuman.cpp
index cd70d45..99469a9 100644
--- a/src/object/motion/motionhuman.cpp
+++ b/src/object/motion/motionhuman.cpp
@@ -71,6 +71,7 @@ CMotionHuman::CMotionHuman(COldObject* object)
     m_time = 0.0f;
     m_tired = 0.0f;
     m_bDisplayPerso = false;
+    m_glassesRank = -1;
 }
 
 // Object's constructor.
@@ -198,12 +199,12 @@ void CMotionHuman::Create(Math::Vector pos, float angle, 
ObjectType type,
     glasses = m_main->GetGamerGlasses();
     if ( glasses != 0 && type == OBJECT_HUMAN )
     {
-        rank = m_engine->CreateObject();
-        m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
-        m_object->SetObjectRank(15, rank);
+        m_glassesRank = m_engine->CreateObject();
+        m_engine->SetObjectType(m_glassesRank, Gfx::ENG_OBJTYPE_DESCENDANT);
+        m_object->SetObjectRank(15, m_glassesRank);
         m_object->SetObjectParent(15, 1);
         sprintf(filename, "human2g%d.mod", glasses);
-        modelManager->AddModelReference(filename, false, rank);
+        modelManager->AddModelReference(filename, false, m_glassesRank);
     }
 
     // Creates the right arm.
@@ -652,6 +653,18 @@ bool CMotionHuman::EventFrame(const Event &event)
         m_object->SetCirVibration(Math::Vector(0.0f, 
m_main->GetPersoAngle()+0.2f, 0.0f));
     }
 
+    if ( m_glassesRank != -1 )
+    {
+        if ( m_camera->GetType() == Gfx::CAM_TYPE_ONBOARD )
+        {
+            m_engine->SetObjectDrawWorld(m_glassesRank, false);
+        }
+        else
+        {
+            m_engine->SetObjectDrawWorld(m_glassesRank, true);
+        }
+    }
+
     bSwim = m_physics->GetSwim();
 
     rot = m_physics->GetCirMotionY(MO_MOTSPEED);
diff --git a/src/object/motion/motionhuman.h b/src/object/motion/motionhuman.h
index e0bb981..9449ed2 100644
--- a/src/object/motion/motionhuman.h
+++ b/src/object/motion/motionhuman.h
@@ -91,4 +91,5 @@ protected:
     float       m_time;
     float       m_tired;
     bool        m_bDisplayPerso;
+    int         m_glassesRank;
 };

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-games/colobot.git

_______________________________________________
Pkg-games-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

Reply via email to