[colobot] 12/145: Changed reference colors using when recoloring textures to constants
Didier Raboud
odyx at moszumanska.debian.org
Mon Jul 11 12:56:12 UTC 2016
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository colobot.
commit d2ac1afcf04f28fced52799fe42892ef1bfd6ebd
Author: krzys-h <krzys_h at interia.pl>
Date: Sun Mar 27 13:34:26 2016 +0200
Changed reference colors using when recoloring textures to constants
---
src/level/robotmain.cpp | 65 ++++++++++++++++++++-----------------------------
src/level/robotmain.h | 4 ---
2 files changed, 26 insertions(+), 43 deletions(-)
diff --git a/src/level/robotmain.cpp b/src/level/robotmain.cpp
index ed520ba..1234224 100644
--- a/src/level/robotmain.cpp
+++ b/src/level/robotmain.cpp
@@ -116,6 +116,12 @@
const float UNIT = 4.0f; // default for g_unit
float g_unit; // conversion factor
+// Reference colors used when recoloring textures, see ChangeColor()
+const Gfx::Color COLOR_REF_BOT = Gfx::Color( 10.0f/256.0f, 166.0f/256.0f, 254.0f/256.0f); // blue
+const Gfx::Color COLOR_REF_ALIEN = Gfx::Color(135.0f/256.0f, 170.0f/256.0f, 13.0f/256.0f); // green
+const Gfx::Color COLOR_REF_GREEN = Gfx::Color(135.0f/256.0f, 170.0f/256.0f, 13.0f/256.0f); // green
+const Gfx::Color COLOR_REF_WATER = Gfx::Color( 25.0f/256.0f, 255.0f/256.0f, 240.0f/256.0f); // cyan
+
template<> CRobotMain* CSingleton<CRobotMain>::m_instance = nullptr;
@@ -2823,30 +2829,11 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
m_controller = nullptr;
- m_colorRefBot.r = 10.0f/256.0f;
- m_colorRefBot.g = 166.0f/256.0f;
- m_colorRefBot.b = 254.0f/256.0f; // blue
- m_colorRefBot.a = 0.0f;
m_colorNewBot.clear();
- m_colorNewBot[0] = m_colorRefBot;
-
- m_colorRefAlien.r = 135.0f/256.0f;
- m_colorRefAlien.g = 170.0f/256.0f;
- m_colorRefAlien.b = 13.0f/256.0f; // green
- m_colorRefAlien.a = 0.0f;
- m_colorNewAlien = m_colorRefAlien;
-
- m_colorRefGreen.r = 135.0f/256.0f;
- m_colorRefGreen.g = 170.0f/256.0f;
- m_colorRefGreen.b = 13.0f/256.0f; // green
- m_colorRefGreen.a = 0.0f;
- m_colorNewGreen = m_colorRefGreen;
-
- m_colorRefWater.r = 25.0f/256.0f;
- m_colorRefWater.g = 255.0f/256.0f;
- m_colorRefWater.b = 240.0f/256.0f; // cyan
- m_colorRefWater.a = 0.0f;
- m_colorNewWater = m_colorRefWater;
+ m_colorNewBot[0] = COLOR_REF_BOT;
+ m_colorNewAlien = COLOR_REF_ALIEN;
+ m_colorNewGreen = COLOR_REF_GREEN;
+ m_colorNewWater = COLOR_REF_WATER;
m_engine->SetAmbientColor(Gfx::Color(0.5f, 0.5f, 0.5f, 0.5f), 0);
m_engine->SetAmbientColor(Gfx::Color(0.5f, 0.5f, 0.5f, 0.5f), 1);
@@ -3249,7 +3236,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
line->GetParam("level")->AsFloat(100.0f)*g_unit,
line->GetParam("glint")->AsFloat(1.0f),
pos);
- m_colorNewWater = line->GetParam("color")->AsColor(m_colorRefWater);
+ m_colorNewWater = line->GetParam("color")->AsColor(COLOR_REF_WATER);
m_colorShiftWater = line->GetParam("brightness")->AsFloat(0.0f);
continue;
}
@@ -3951,26 +3938,26 @@ void CRobotMain::ChangeColor()
// VehicleColor
- for(auto it : m_colorNewBot)
+ for (auto it : m_colorNewBot)
{
int team = it.first;
Gfx::Color newColor = it.second;
std::string teamStr = StrUtils::ToString<int>(team);
if(team == 0) teamStr = "";
- m_engine->ChangeTextureColor("textures/objects/base1.png"+teamStr, "textures/objects/base1.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true);
- m_engine->ChangeTextureColor("textures/objects/convert.png"+teamStr, "textures/objects/convert.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true);
- m_engine->ChangeTextureColor("textures/objects/derrick.png"+teamStr, "textures/objects/derrick.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true);
- m_engine->ChangeTextureColor("textures/objects/factory.png"+teamStr, "textures/objects/factory.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true);
- m_engine->ChangeTextureColor("textures/objects/lemt.png"+teamStr, "textures/objects/lemt.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true);
- m_engine->ChangeTextureColor("textures/objects/roller.png"+teamStr, "textures/objects/roller.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true);
- m_engine->ChangeTextureColor("textures/objects/search.png"+teamStr, "textures/objects/search.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true);
+ m_engine->ChangeTextureColor("textures/objects/base1.png"+teamStr, "textures/objects/base1.png", COLOR_REF_BOT, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true);
+ m_engine->ChangeTextureColor("textures/objects/convert.png"+teamStr, "textures/objects/convert.png", COLOR_REF_BOT, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true);
+ m_engine->ChangeTextureColor("textures/objects/derrick.png"+teamStr, "textures/objects/derrick.png", COLOR_REF_BOT, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true);
+ m_engine->ChangeTextureColor("textures/objects/factory.png"+teamStr, "textures/objects/factory.png", COLOR_REF_BOT, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true);
+ m_engine->ChangeTextureColor("textures/objects/lemt.png"+teamStr, "textures/objects/lemt.png", COLOR_REF_BOT, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true);
+ m_engine->ChangeTextureColor("textures/objects/roller.png"+teamStr, "textures/objects/roller.png", COLOR_REF_BOT, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true);
+ m_engine->ChangeTextureColor("textures/objects/search.png"+teamStr, "textures/objects/search.png", COLOR_REF_BOT, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, nullptr, 0, true);
exclu[0] = Math::Point( 0.0f/256.0f, 160.0f/256.0f);
exclu[1] = Math::Point(256.0f/256.0f, 256.0f/256.0f); // pencils
exclu[2] = Math::Point(0.0f, 0.0f);
exclu[3] = Math::Point(0.0f, 0.0f); // terminator
- m_engine->ChangeTextureColor("textures/objects/drawer.png"+teamStr, "textures/objects/drawer.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true);
+ m_engine->ChangeTextureColor("textures/objects/drawer.png"+teamStr, "textures/objects/drawer.png", COLOR_REF_BOT, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true);
exclu[0] = Math::Point(237.0f/256.0f, 176.0f/256.0f);
exclu[1] = Math::Point(256.0f/256.0f, 220.0f/256.0f); // blue canister
@@ -3978,7 +3965,7 @@ void CRobotMain::ChangeColor()
exclu[3] = Math::Point(130.0f/256.0f, 214.0f/256.0f); // safe location
exclu[4] = Math::Point(0.0f, 0.0f);
exclu[5] = Math::Point(0.0f, 0.0f); // terminator
- m_engine->ChangeTextureColor("textures/objects/subm.png"+teamStr, "textures/objects/subm.png", m_colorRefBot, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true);
+ m_engine->ChangeTextureColor("textures/objects/subm.png"+teamStr, "textures/objects/subm.png", COLOR_REF_BOT, newColor, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true);
}
// AlienColor
@@ -3987,23 +3974,23 @@ void CRobotMain::ChangeColor()
exclu[1] = Math::Point(256.0f/256.0f, 256.0f/256.0f); // SatCom
exclu[2] = Math::Point(0.0f, 0.0f);
exclu[3] = Math::Point(0.0f, 0.0f); // terminator
- m_engine->ChangeTextureColor("textures/objects/ant.png", m_colorRefAlien, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti, exclu);
- m_engine->ChangeTextureColor("textures/objects/mother.png", m_colorRefAlien, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti);
+ m_engine->ChangeTextureColor("textures/objects/ant.png", COLOR_REF_ALIEN, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti, exclu);
+ m_engine->ChangeTextureColor("textures/objects/mother.png", COLOR_REF_ALIEN, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti);
// GreeneryColor
- m_engine->ChangeTextureColor("textures/objects/plant.png", m_colorRefGreen, m_colorNewGreen, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti);
+ m_engine->ChangeTextureColor("textures/objects/plant.png", COLOR_REF_GREEN, m_colorNewGreen, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti);
// water color
// PARTIPLOUF0 and PARTIDROP :
ts = Math::Point(0.500f, 0.500f);
ti = Math::Point(0.875f, 0.750f);
- m_engine->ChangeTextureColor("textures/effect00.png", m_colorRefWater, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, nullptr, m_colorShiftWater, true);
+ m_engine->ChangeTextureColor("textures/effect00.png", COLOR_REF_WATER, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, nullptr, m_colorShiftWater, true);
// PARTIFLIC :
ts = Math::Point(0.00f, 0.75f);
ti = Math::Point(0.25f, 1.00f);
- m_engine->ChangeTextureColor("textures/effect02.png", m_colorRefWater, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, nullptr, m_colorShiftWater, true);
+ m_engine->ChangeTextureColor("textures/effect02.png", COLOR_REF_WATER, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, nullptr, m_colorShiftWater, true);
}
//! Calculates the distance to the nearest object
diff --git a/src/level/robotmain.h b/src/level/robotmain.h
index 0ed3e0b..079add3 100644
--- a/src/level/robotmain.h
+++ b/src/level/robotmain.h
@@ -559,13 +559,9 @@ protected:
ShowLimit m_showLimit[MAXSHOWLIMIT];
- Gfx::Color m_colorRefBot;
std::map<int, Gfx::Color> m_colorNewBot;
- Gfx::Color m_colorRefAlien;
Gfx::Color m_colorNewAlien;
- Gfx::Color m_colorRefGreen;
Gfx::Color m_colorNewGreen;
- Gfx::Color m_colorRefWater;
Gfx::Color m_colorNewWater;
float m_colorShiftWater = 0.0f;
--
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