[colobot] 198/390: Custom path to SecondTexture, closes #370

Didier Raboud odyx at moszumanska.debian.org
Fri Jun 12 14:21:45 UTC 2015


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

odyx pushed a commit to branch upstream/latest
in repository colobot.

commit ef35a3a2efae91bb1579e063080fa240d115d9d9
Author: krzys-h <krzys_h at interia.pl>
Date:   Mon Nov 10 20:46:39 2014 +0100

    Custom path to SecondTexture, closes #370
---
 src/graphics/engine/engine.cpp       | 10 +++++-----
 src/graphics/engine/engine.h         |  6 +++---
 src/graphics/engine/modelmanager.cpp | 10 ++++------
 src/object/robotmain.cpp             |  8 +++++++-
 4 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp
index 3c642ae..6e1da09 100644
--- a/src/graphics/engine/engine.cpp
+++ b/src/graphics/engine/engine.cpp
@@ -89,7 +89,7 @@ CEngine::CEngine(CApplication *app)
     m_groundSpotVisible = true;
     m_dirty             = true;
     m_fog               = true;
-    m_secondTexNum      = 0;
+    m_secondTex         = "";
     m_eyeDirH           = 0.0f;
     m_eyeDirV           = 0.0f;
     m_backgroundName    = "";  // no background image
@@ -2675,14 +2675,14 @@ bool CEngine::GetFog()
     return m_fog;
 }
 
-void CEngine::SetSecondTexture(int texNum)
+void CEngine::SetSecondTexture(const std::string& texNum)
 {
-    m_secondTexNum = texNum;
+    m_secondTex = texNum;
 }
 
-int CEngine::GetSecondTexture()
+const std::string& CEngine::GetSecondTexture()
 {
-    return m_secondTexNum;
+    return m_secondTex;
 }
 
 void CEngine::SetRankView(int rank)
diff --git a/src/graphics/engine/engine.h b/src/graphics/engine/engine.h
index 6ca7d1b..a6d1921 100644
--- a/src/graphics/engine/engine.h
+++ b/src/graphics/engine/engine.h
@@ -1015,8 +1015,8 @@ public:
 
     //@{
     //! Management of the global mode of secondary texturing
-    void            SetSecondTexture(int texNum);
-    int             GetSecondTexture();
+    void            SetSecondTexture(const std::string& texNum);
+    const std::string& GetSecondTexture();
     //@}
 
     //@{
@@ -1365,7 +1365,7 @@ protected:
     bool            m_dirty;
     bool            m_fog;
     bool            m_firstGroundSpot;
-    int             m_secondTexNum;
+    std::string     m_secondTex;
     bool            m_backgroundFull;
     std::string     m_backgroundName;
     Texture         m_backgroundTex;
diff --git a/src/graphics/engine/modelmanager.cpp b/src/graphics/engine/modelmanager.cpp
index ec104d0..218edd9 100644
--- a/src/graphics/engine/modelmanager.cpp
+++ b/src/graphics/engine/modelmanager.cpp
@@ -74,17 +74,15 @@ bool CModelManager::LoadModel(const std::string& fileName, bool mirrored)
 
         if (modelInfo.triangles[i].variableTex2)
         {
-            int texNum = m_engine->GetSecondTexture();
+            state |= ENG_RSTATE_DUAL_BLACK;
 
+            /*TODO: This seems to be not used by Colobot
             if (texNum >= 1 && texNum <= 10)
                 state |= ENG_RSTATE_DUAL_BLACK;
 
             if (texNum >= 11 && texNum <= 20)
-                state |= ENG_RSTATE_DUAL_WHITE;
-
-            char name[20] = { 0 };
-            sprintf(name, "dirty%.2d.png", texNum);
-            tex2Name = name;
+                state |= ENG_RSTATE_DUAL_WHITE;*/
+            tex2Name = m_engine->GetSecondTexture();
         }
 
         vs[0] = modelInfo.triangles[i].p1;
diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp
index 75b1e5f..d14c7e5 100644
--- a/src/object/robotmain.cpp
+++ b/src/object/robotmain.cpp
@@ -3993,7 +3993,13 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
         
         if (line->GetCommand() == "SecondTexture" && !resetObject)
         {
-            m_engine->SetSecondTexture(line->GetParam("rank")->AsInt());
+            if(line->GetParam("rank")->IsDefined()) {
+                char tex[20] = { 0 };
+                sprintf(tex, "dirty%.2d.png", line->GetParam("rank")->AsInt());
+                m_engine->SetSecondTexture(tex);
+            } else {
+                m_engine->SetSecondTexture("../"+line->GetParam("texture")->AsPath("textures"));
+            }
             continue;
         }
         

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



More information about the Pkg-games-commits mailing list