Showing coordinates in stats menu (F12/showstat); removed "showpos" cheat
Issue #277 Conflicts: src/object/cheat.cpp src/object/robotmain.cpp src/object/robotmain.hdev-mp
parent
7af762329b
commit
d91569e165
|
@ -515,6 +515,11 @@ int CEngine::GetStatisticTriangle()
|
|||
return m_statisticTriangle;
|
||||
}
|
||||
|
||||
void CEngine::SetStatisticPos(Math::Vector pos)
|
||||
{
|
||||
m_statisticPos = pos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************
|
||||
|
@ -4335,7 +4340,7 @@ void CEngine::DrawStats()
|
|||
float height = m_text->GetAscent(FONT_COLOBOT, 12.0f);
|
||||
float width = 0.2f;
|
||||
|
||||
Math::Point pos(0.04f, 0.04f + 17 * height);
|
||||
Math::Point pos(0.04f, 0.04f + 20 * height);
|
||||
|
||||
SetState(ENG_RSTATE_OPAQUE_COLOR);
|
||||
|
||||
|
@ -4343,9 +4348,9 @@ void CEngine::DrawStats()
|
|||
|
||||
VertexCol vertex[4] =
|
||||
{
|
||||
VertexCol(Math::Vector(pos.x , pos.y - 17 * height, 0.0f), black),
|
||||
VertexCol(Math::Vector(pos.x , pos.y - 20 * height, 0.0f), black),
|
||||
VertexCol(Math::Vector(pos.x , pos.y + height, 0.0f), black),
|
||||
VertexCol(Math::Vector(pos.x + width, pos.y - 17 * height, 0.0f), black),
|
||||
VertexCol(Math::Vector(pos.x + width, pos.y - 20 * height, 0.0f), black),
|
||||
VertexCol(Math::Vector(pos.x + width, pos.y + height, 0.0f), black)
|
||||
};
|
||||
|
||||
|
@ -4458,6 +4463,20 @@ void CEngine::DrawStats()
|
|||
pos.y -= height;
|
||||
|
||||
m_text->DrawText(m_fpsText, FONT_COLOBOT, 12.0f, pos, 1.0f, TEXT_ALIGN_LEFT, 0, Color(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
|
||||
pos.y -= height;
|
||||
pos.y -= height;
|
||||
|
||||
str.str("");
|
||||
str << "Position x: " << std::fixed << std::setprecision(2) << m_statisticPos.x/g_unit;
|
||||
m_text->DrawText(str.str(), FONT_COLOBOT, 12.0f, pos, 1.0f, TEXT_ALIGN_LEFT, 0, Color(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
pos.y -= height;
|
||||
|
||||
str.str("");
|
||||
str << "Position y: " << std::fixed << std::setprecision(2) << m_statisticPos.z/g_unit;
|
||||
m_text->DrawText(str.str(), FONT_COLOBOT, 12.0f, pos, 1.0f, TEXT_ALIGN_LEFT, 0, Color(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -777,6 +777,9 @@ public:
|
|||
void AddStatisticTriangle(int nb);
|
||||
//! Returns the number of triangles in current frame
|
||||
int GetStatisticTriangle();
|
||||
|
||||
//! Sets the coordinates to display in stats window
|
||||
void SetStatisticPos(Math::Vector pos);
|
||||
|
||||
|
||||
/* *************** Object management *************** */
|
||||
|
@ -1348,6 +1351,7 @@ protected:
|
|||
float m_fogStart[2];
|
||||
Color m_waterAddColor;
|
||||
int m_statisticTriangle;
|
||||
Math::Vector m_statisticPos;
|
||||
bool m_updateGeometry;
|
||||
bool m_updateStaticBuffers;
|
||||
int m_alphaMode;
|
||||
|
|
|
@ -673,7 +673,6 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
|
|||
m_editFull = false;
|
||||
m_hilite = false;
|
||||
m_freePhoto = false;
|
||||
m_showPos = false;
|
||||
m_selectInsect = false;
|
||||
m_showSoluce = false;
|
||||
|
||||
|
@ -2080,12 +2079,6 @@ void CRobotMain::ExecuteCmd(char *cmd)
|
|||
return;
|
||||
}
|
||||
|
||||
if (strcmp(cmd, "showpos") == 0)
|
||||
{
|
||||
m_showPos = !m_showPos;
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(cmd, "selectinsect") == 0)
|
||||
{
|
||||
m_selectInsect = !m_selectInsect;
|
||||
|
@ -3369,16 +3362,11 @@ void CRobotMain::AbortMovie()
|
|||
//! Updates the text information
|
||||
void CRobotMain::UpdateInfoText()
|
||||
{
|
||||
if (m_showPos)
|
||||
CObject* obj = GetSelect();
|
||||
if (obj != nullptr)
|
||||
{
|
||||
CObject* obj = GetSelect();
|
||||
if (obj != nullptr)
|
||||
{
|
||||
Math::Vector pos = obj->GetPosition(0);
|
||||
char info[100];
|
||||
sprintf(info, "Pos = %.2f ; %.2f", pos.x/g_unit, pos.z/g_unit);
|
||||
//TODO: m_engine->SetInfoText(4, info);
|
||||
}
|
||||
Math::Vector pos = obj->GetPosition(0);
|
||||
m_engine->SetStatisticPos(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -479,7 +479,6 @@ protected:
|
|||
Gfx::Color m_color;
|
||||
bool m_freePhoto;
|
||||
bool m_cmdEdit;
|
||||
bool m_showPos;
|
||||
bool m_selectInsect;
|
||||
bool m_showSoluce;
|
||||
bool m_showAll;
|
||||
|
|
Loading…
Reference in New Issue