Custom path to SecondTexture, closes #370

dev-mp
krzys-h 2014-11-10 20:46:39 +01:00
parent 643d1ec46a
commit ef35a3a2ef
4 changed files with 19 additions and 15 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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;
}