Cleaned up "textures/"+something, fixed more possible occurences of #531

master
krzys-h 2015-08-03 20:55:33 +02:00
parent 1e38edcec7
commit 5e4a423bf0
10 changed files with 39 additions and 49 deletions

View File

@ -129,8 +129,8 @@ void CCloud::Draw()
material.ambient = m_ambient;
m_engine->SetMaterial(material);
m_engine->SetTexture("textures/"+m_fileName, 0);
m_engine->SetTexture("textures/"+m_fileName, 1);
m_engine->SetTexture(m_fileName, 0);
m_engine->SetTexture(m_fileName, 1);
m_engine->SetState(ENG_RSTATE_TTEXTURE_BLACK | ENG_RSTATE_FOG | ENG_RSTATE_WRAP);
@ -222,7 +222,7 @@ void CCloud::Create(const std::string& fileName,
m_fileName = fileName;
if (! m_fileName.empty())
m_engine->LoadTexture("textures/"+m_fileName);
m_engine->LoadTexture(m_fileName);
if (m_terrain == nullptr)
m_terrain = CRobotMain::GetInstancePointer()->GetTerrain();
@ -274,4 +274,3 @@ bool CCloud::GetEnabled()
} // namespace Gfx

View File

@ -1119,10 +1119,10 @@ void CEngine::ChangeSecondTexture(int objRank, const std::string& tex2Name)
newP2.next.insert(newP2.next.end(), p1.next[l2].next.begin(), p1.next[l2].next.end());
p1.next[l2].next.clear();
if (!newP2.tex1.Valid())
if (!newP2.tex1.Valid() && !newP2.tex1Name.empty())
newP2.tex1 = LoadTexture("textures/"+newP2.tex1Name);
if (!newP2.tex2.Valid())
if (!newP2.tex2.Valid() && !newP2.tex2Name.empty())
newP2.tex2 = LoadTexture("textures/"+newP2.tex2Name);
}
}
@ -2238,13 +2238,13 @@ bool CEngine::LoadAllTextures()
{
TextureCreateParams params = m_defaultTexParams;
params.padToNearestPowerOfTwo = true;
m_backgroundTex = LoadTexture("textures/"+m_backgroundName, params);
m_backgroundTex = LoadTexture(m_backgroundName, params);
}
else
m_backgroundTex.SetInvalid();
if (! m_foregroundName.empty())
m_foregroundTex = LoadTexture("textures/"+m_foregroundName);
m_foregroundTex = LoadTexture(m_foregroundName);
else
m_foregroundTex.SetInvalid();
@ -2738,7 +2738,7 @@ void CEngine::SetBackground(const std::string& name, Color up, Color down,
{
TextureCreateParams params = m_defaultTexParams;
params.padToNearestPowerOfTwo = true;
m_backgroundTex = LoadTexture("textures/"+m_backgroundName, params);
m_backgroundTex = LoadTexture(m_backgroundName, params);
}
}
@ -2765,7 +2765,7 @@ void CEngine::SetForegroundName(const std::string& name)
m_foregroundName = name;
if (! m_foregroundName.empty())
m_foregroundTex = LoadTexture("textures/"+m_foregroundName);
m_foregroundTex = LoadTexture(m_foregroundName);
}
void CEngine::SetOverFront(bool front)

View File

@ -3532,7 +3532,7 @@ void CParticle::DrawParticle(int sheet)
if (m_particle[i].sheet != sheet) continue;
if (m_particle[i].type == PARTIPART) continue;
m_engine->SetTexture("textures/"+m_triangle[i].tex1Name);
m_engine->SetTexture(!m_triangle[i].tex1Name.empty() ? "textures/"+m_triangle[i].tex1Name : "");
m_engine->SetMaterial(m_triangle[i].material);
m_engine->SetState(m_triangle[i].state);
DrawParticleTriangle(i);

View File

@ -90,7 +90,7 @@ void CPlanet::LoadTexture()
{
for (int i = 0; i < static_cast<int>( m_planet[j].size() ); i++)
{
m_engine->LoadTexture("textures/"+m_planet[j][i].name);
m_engine->LoadTexture(m_planet[j][i].name);
}
}
}
@ -106,7 +106,7 @@ void CPlanet::Draw()
for (int i = 0; i < static_cast<int>( m_planet[m_mode].size() ); i++)
{
m_engine->SetTexture("textures/"+m_planet[m_mode][i].name);
m_engine->SetTexture(m_planet[m_mode][i].name);
if (m_planet[m_mode][i].transparent)
m_engine->SetState(ENG_RSTATE_WRAP | ENG_RSTATE_ALPHA);
@ -189,4 +189,3 @@ int CPlanet::GetMode()
} // namespace Gfx

View File

@ -351,8 +351,8 @@ void CWater::DrawSurf()
material.ambient = m_ambient;
m_engine->SetMaterial(material);
m_engine->SetTexture("textures/"+m_fileName, 0);
m_engine->SetTexture("textures/"+m_fileName, 1);
m_engine->SetTexture(m_fileName, 0);
m_engine->SetTexture(m_fileName, 1);
if (m_type[rankview] == WATER_TT)
m_engine->SetState(ENG_RSTATE_TTEXTURE_BLACK | ENG_RSTATE_DUAL_WHITE | ENG_RSTATE_WRAP, m_color);
@ -495,7 +495,7 @@ void CWater::Create(WaterType type1, WaterType type2, const std::string& fileNam
VaporFlush();
if (! m_fileName.empty())
m_engine->LoadTexture("textures/"+m_fileName);
m_engine->LoadTexture(m_fileName);
if (m_terrain == nullptr)
m_terrain = CRobotMain::GetInstancePointer()->GetTerrain();
@ -631,4 +631,3 @@ void CWater::AdjustEye(Math::Vector &eye)
} // namespace Gfx

View File

@ -1320,15 +1320,15 @@ void CAutoBase::BeginTransit()
{
if ( m_param == PARAM_TRANSIT2 )
{
m_bgBack = "back01.png"; // clouds orange / blue
m_bgBack = "textures/back01.png"; // clouds orange / blue
}
else if ( m_param == PARAM_TRANSIT3 )
{
m_bgBack = "back22.png"; // blueberries clouds
m_bgBack = "textures/back22.png"; // blueberries clouds
}
else
{
m_bgBack = "back46.png"; // paintings
m_bgBack = "textures/back46.png"; // paintings
}
m_engine->SetFogStart(0.9f); // hardly any fog
@ -1418,4 +1418,3 @@ Error CAutoBase::TakeOff(bool printMsg)
m_speed = 1.0f/BASE_DOOR_TIME2;
return ERR_OK;
}

View File

@ -3205,7 +3205,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
{
std::string path = "";
if (line->GetParam("image")->IsDefined())
path = "../" + line->GetParam("image")->AsPath("textures");
path = line->GetParam("image")->AsPath("textures");
m_engine->SetBackground(path.c_str(),
line->GetParam("up")->AsColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)),
line->GetParam("down")->AsColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)),
@ -3227,7 +3227,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
line->GetParam("dim")->AsFloat(0.2f),
line->GetParam("speed")->AsFloat(0.0f),
line->GetParam("dir")->AsFloat(0.0f),
"../" + line->GetParam("image")->AsPath("textures"),
line->GetParam("image")->AsPath("textures"),
Math::Point(uv1.x, uv1.z),
Math::Point(uv2.x, uv2.z),
line->GetParam("image")->AsPath("textures").find("planet") != std::string::npos // TODO: add transparent op or modify textures
@ -3237,7 +3237,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
if (line->GetCommand() == "ForegroundName" && !resetObject)
{
m_engine->SetForegroundName("../" + line->GetParam("image")->AsPath("textures"));
m_engine->SetForegroundName(line->GetParam("image")->AsPath("textures"));
continue;
}
@ -3299,7 +3299,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
pos.z = pos.x;
m_water->Create(line->GetParam("air")->AsWaterType(Gfx::WATER_TT),
line->GetParam("water")->AsWaterType(Gfx::WATER_TT),
"../" + line->GetParam("image")->AsPath("textures"),
line->GetParam("image")->AsPath("textures"),
line->GetParam("diffuse")->AsColor(Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)),
line->GetParam("ambient")->AsColor(Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)),
line->GetParam("level")->AsFloat(100.0f)*g_unit,
@ -3320,7 +3320,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
{
std::string path = "";
if (line->GetParam("image")->IsDefined())
path = "../" + line->GetParam("image")->AsPath("textures");
path = line->GetParam("image")->AsPath("textures");
m_cloud->Create(path,
line->GetParam("diffuse")->AsColor(Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)),
line->GetParam("ambient")->AsColor(Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)),
@ -3779,7 +3779,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
if (m_mapImage)
{
Math::Vector offset;
strcpy(m_mapFilename, ("../" + line->GetParam("filename")->AsPath("textures")).c_str());
strcpy(m_mapFilename, line->GetParam("filename")->AsPath("textures").c_str());
offset = line->GetParam("offset")->AsPoint(Math::Vector(0.0f, 0.0f, 0.0f));
m_map->SetFixParam(line->GetParam("zoom")->AsFloat(1.0f),
offset.x, offset.z,

View File

@ -130,10 +130,8 @@ void CImage::Draw()
if ( m_filename[0] != 0 ) // displays an image?
{
std::string texFilename = m_filename;
texFilename = "textures/"+texFilename;
m_engine->LoadTexture(texFilename.c_str());
m_engine->SetTexture(texFilename);
m_engine->LoadTexture(m_filename);
m_engine->SetTexture(m_filename);
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
pos = m_pos;
dim = m_dim;
@ -151,4 +149,3 @@ void CImage::Draw()
}

View File

@ -362,7 +362,7 @@ void CMainDialog::ChangePhase(Phase phase)
pl->SetFontType(Gfx::FONT_COURIER);
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
m_engine->SetBackground("interface/interface.png",
m_engine->SetBackground("textures/interface/interface.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
@ -467,7 +467,7 @@ void CMainDialog::ChangePhase(Phase phase)
UpdateNameList();
UpdateNameControl();
m_engine->SetBackground("interface/interface.png",
m_engine->SetBackground("textures/interface/interface.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
@ -883,7 +883,7 @@ void CMainDialog::ChangePhase(Phase phase)
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_BACK);
pb->SetState(STATE_SHADOW);
m_engine->SetBackground("interface/interface.png",
m_engine->SetBackground("textures/interface/interface.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
@ -1011,7 +1011,7 @@ void CMainDialog::ChangePhase(Phase phase)
if ( !m_bSimulSetup )
{
m_engine->SetBackground("interface/interface.png",
m_engine->SetBackground("textures/interface/interface.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
@ -1625,7 +1625,7 @@ void CMainDialog::ChangePhase(Phase phase)
if ( m_phase == PHASE_READ )
{
m_engine->SetBackground("interface/interface.png",
m_engine->SetBackground("textures/interface/interface.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
@ -1672,7 +1672,7 @@ void CMainDialog::ChangePhase(Phase phase)
pl->SetFontSize(12.0f);
pl->SetTextAlign(Gfx::TEXT_ALIGN_CENTER);
m_engine->SetBackground("interface/interface.png",
m_engine->SetBackground("textures/interface/interface.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
@ -1694,7 +1694,7 @@ void CMainDialog::ChangePhase(Phase phase)
m_engine->SetOverColor(Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f), Gfx::ENG_RSTATE_TCOLOR_BLACK); // TODO: color ok?
m_engine->SetOverFront(true);
m_engine->SetBackground("interface/intro1.png",
m_engine->SetBackground("textures/interface/intro1.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
@ -1713,7 +1713,7 @@ void CMainDialog::ChangePhase(Phase phase)
m_engine->SetOverColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::ENG_RSTATE_TCOLOR_WHITE); // TODO: color ok?
m_engine->SetOverFront(true);
m_engine->SetBackground("interface/intro2.png",
m_engine->SetBackground("textures/interface/intro2.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
@ -1732,7 +1732,7 @@ void CMainDialog::ChangePhase(Phase phase)
m_engine->SetOverColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::ENG_RSTATE_TCOLOR_WHITE); // TODO: color ok?
m_engine->SetOverFront(true);
m_engine->SetBackground("interface/intro3.png",
m_engine->SetBackground("textures/interface/intro3.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
@ -1798,7 +1798,7 @@ void CMainDialog::ChangePhase(Phase phase)
pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT);
pb->SetState(STATE_SHADOW);
m_engine->SetBackground("interface/generico.png",
m_engine->SetBackground("textures/interface/generico.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
@ -4057,7 +4057,7 @@ void CMainDialog::IOUpdateList()
if (m_saveList.size() <= static_cast<unsigned int>(sel))
return;
std::string filename = "../"+m_saveList.at(sel) + "/screen.png";
std::string filename = m_saveList.at(sel) + "/screen.png";
if ( m_phase == PHASE_WRITE || m_phase == PHASE_WRITEs )
{
if ( sel < max-1 )

View File

@ -347,10 +347,8 @@ void CMap::Draw()
}
else // still image?
{
std::string texFilename = m_fixImage;
texFilename = "textures/"+texFilename;
m_engine->LoadTexture(texFilename.c_str());
m_engine->SetTexture(texFilename.c_str());
m_engine->LoadTexture(m_fixImage);
m_engine->SetTexture(m_fixImage);
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f;
uv1.y = 0.0f;
@ -1314,4 +1312,3 @@ void CMap::UpdateObject(CObject* pObj)
}
}