summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/button.cpp7
-rw-r--r--src/ui/check.cpp7
-rw-r--r--src/ui/color.cpp41
-rw-r--r--src/ui/control.cpp30
-rw-r--r--src/ui/control.h2
-rw-r--r--src/ui/displayinfo.cpp101
-rw-r--r--src/ui/displayinfo.h19
-rw-r--r--src/ui/displaytext.cpp8
-rw-r--r--src/ui/edit.cpp26
-rw-r--r--src/ui/group.cpp7
-rw-r--r--src/ui/image.cpp7
-rw-r--r--src/ui/key.cpp28
-rw-r--r--src/ui/maindialog.cpp511
-rw-r--r--src/ui/maindialog.h33
-rw-r--r--src/ui/mainshort.cpp8
-rw-r--r--src/ui/studio.cpp67
-rw-r--r--src/ui/studio.h13
-rw-r--r--src/ui/window.cpp15
18 files changed, 256 insertions, 674 deletions
diff --git a/src/ui/button.cpp b/src/ui/button.cpp
index 348382d..810d365 100644
--- a/src/ui/button.cpp
+++ b/src/ui/button.cpp
@@ -60,12 +60,7 @@ bool CButton::Create(Math::Point pos, Math::Point dim, int icon, EventType event
if ( icon == -1 )
{
- char name[100];
- char* p;
-
- GetResource(RES_EVENT, eventType, name);
- p = strchr(name, '\\');
- if ( p != 0 ) *p = 0;
+ std::string name = GetResourceName(eventType);
SetName(name);
}
diff --git a/src/ui/check.cpp b/src/ui/check.cpp
index 362c930..6a92554 100644
--- a/src/ui/check.cpp
+++ b/src/ui/check.cpp
@@ -47,16 +47,11 @@ CCheck::~CCheck()
bool CCheck::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- char name[100];
- char* p;
-
if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
CControl::Create(pos, dim, icon, eventType);
- GetResource(RES_EVENT, eventType, name);
- p = strchr(name, '\\');
- if ( p != 0 ) *p = 0;
+ std::string name = GetResourceName(eventType);
SetName(name);
return true;
diff --git a/src/ui/color.cpp b/src/ui/color.cpp
index 623ff89..d1dc746 100644
--- a/src/ui/color.cpp
+++ b/src/ui/color.cpp
@@ -64,12 +64,7 @@ bool CColor::Create(Math::Point pos, Math::Point dim, int icon, EventType eventT
if ( icon == -1 )
{
- char name[100];
- char* p;
-
- GetResource(RES_EVENT, eventType, name);
- p = strchr(name, '\\');
- if ( p != 0 ) *p = 0;
+ std::string name = GetResourceName(eventType);
SetName(name);
}
@@ -146,38 +141,7 @@ void CColor::Draw()
m_engine->SetTexture("button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
CControl::Draw();
-
-#if _TEEN
-// color = GetColor(m_color);
- color = GetColor();
-
- m_engine->SetTexture(""); // no texture
- m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
-
- device = m_engine->GetDevice();
-
- p1.x = m_pos.x + (4.0f / 640.0f);
- p1.y = m_pos.y + (4.0f / 480.0f);
- p2.x = m_pos.x + m_dim.x - (4.0f / 640.0f);
- p2.y = m_pos.y + m_dim.y - (4.0f / 480.0f);
- vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
- vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
- vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
- vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
- device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
-
- p1.x = m_pos.x + (5.0f / 640.0f);
- p1.y = m_pos.y + (5.0f / 480.0f);
- p2.x = m_pos.x + m_dim.x - (5.0f / 640.0f);
- p2.y = m_pos.y + m_dim.y - (5.0f / 480.0f);
- vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
- vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
- vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
- vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
- device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
-
- m_engine->AddStatisticTriangle(4);
-#else
+
p1.x = m_pos.x + (3.0f / 640.0f);
p1.y = m_pos.y + (3.0f / 480.0f);
p2.x = m_pos.x + m_dim.x - (3.0f / 640.0f);
@@ -196,7 +160,6 @@ void CColor::Draw()
device = m_engine->GetDevice();
device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2);
-#endif
}
diff --git a/src/ui/control.cpp b/src/ui/control.cpp
index bed84dd..4e64ee9 100644
--- a/src/ui/control.cpp
+++ b/src/ui/control.cpp
@@ -57,9 +57,6 @@ CControl::~CControl()
bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- char text[200];
- std::string str_text;
-
if ( eventType == EVENT_NULL )
eventType = GetUniqueEventType();
@@ -72,17 +69,17 @@ bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventType even
pos.y = m_pos.y + m_dim.y;
GlintCreate(pos);
+ std::string text;
GetResource(RES_EVENT, m_eventType, text);
- str_text = std::string(text);
- auto p = str_text.find("\\");
- if ( p == std::string::npos )
+ auto p = text.find("\\");
+ if (p == std::string::npos)
{
if ( icon != -1 )
- m_tooltip = str_text;
+ m_tooltip = text;
}
else
{
- m_tooltip = str_text.substr(p + 1);
+ m_tooltip = text.substr(p + 1);
}
return true;
@@ -509,11 +506,7 @@ void CControl::Draw()
if ( icon >= 192 )
{
icon -= 192;
-#if _POLISH
- m_engine->SetTexture("textp.png");
-#else
m_engine->SetTexture("text.png");
-#endif
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
}
else if ( icon >= 128 )
@@ -837,5 +830,18 @@ bool CControl::Detect(Math::Point pos)
pos.y <= m_pos.y + m_dim.y );
}
+std::string CControl::GetResourceName(EventType eventType)
+{
+ std::string name;
+ GetResource(RES_EVENT, eventType, name);
+ auto index = name.find('\\');
+ if (index != std::string::npos)
+ {
+ name = name.substr(0, index);
+ }
+ return name;
+}
+
+
}
diff --git a/src/ui/control.h b/src/ui/control.h
index aee7d1c..1ca07cf 100644
--- a/src/ui/control.h
+++ b/src/ui/control.h
@@ -112,6 +112,8 @@ protected:
void DrawShadow(Math::Point pos, Math::Point dim, float deep=1.0f);
virtual bool Detect(Math::Point pos);
+ std::string GetResourceName(EventType eventType);
+
protected:
Gfx::CEngine* m_engine;
Gfx::CParticle* m_particle;
diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp
index 3aa3d73..e7748ae 100644
--- a/src/ui/displayinfo.cpp
+++ b/src/ui/displayinfo.cpp
@@ -23,6 +23,7 @@
#include "common/iman.h"
#include "common/misc.h"
#include "common/restext.h"
+#include "common/stringutils.h"
#include "graphics/core/light.h"
#include "graphics/engine/engine.h"
@@ -58,6 +59,7 @@ CDisplayInfo::CDisplayInfo()
m_main = CRobotMain::GetInstancePointer();
m_interface = m_main->GetInterface();
m_camera = m_main->GetCamera();
+ m_pause = CPauseManager::GetInstancePointer();
m_bInfoMaximized = true;
m_bInfoMinimized = false;
@@ -329,13 +331,13 @@ void CDisplayInfo::HyperUpdate()
void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluce)
{
- Gfx::Light light;
+ Gfx::Light light;
Math::Point pos, dim;
Ui::CWindow* pw;
Ui::CEdit* edit;
Ui::CButton* button;
Ui::CSlider* slider;
- CMotionToto* toto;
+ CMotionToto* toto;
m_index = index;
m_bSoluce = bSoluce;
@@ -354,8 +356,8 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc
m_main->SetEditLock(true, false);
m_main->SetEditFull(false);
- m_bInitPause = m_engine->GetPause();
- m_engine->SetPause(true);
+ m_bInitPause = m_pause->GetPauseType();
+ m_pause->SetPause(PAUSE_SATCOM);
m_infoCamera = m_camera->GetType();
m_camera->SetType(Gfx::CAM_TYPE_INFO);
@@ -388,13 +390,7 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc
button = pw->CreateButton(pos, dim, 128+57, EVENT_SATCOM_HUSTON);
button->SetState(STATE_SHADOW);
-#if _TEEN
-#if !_ENGLISH
- button = pw->CreateButton(pos, dim, 46, EVENT_SATCOM_SAT);
-#endif
-#else
button = pw->CreateButton(pos, dim, 128+58, EVENT_SATCOM_SAT);
-#endif
button->SetState(STATE_SHADOW);
//? button = pw->CreateButton(pos, dim, 128+59, EVENT_SATCOM_OBJECT);
//? button->SetState(STATE_SHADOW);
@@ -838,7 +834,7 @@ void CDisplayInfo::StopDisplayInfo()
}
else
{
- if ( !m_bInitPause ) m_engine->SetPause(false);
+ m_pause->SetPause(m_bInitPause);
m_main->SetEditLock(false, false);
}
m_camera->SetType(m_infoCamera);
@@ -971,31 +967,41 @@ void ObjectAdd(ObjectList list[], ObjectType type)
void ObjectWrite(FILE* file, ObjectList list[], int i)
{
- char line[100];
- char res[100];
- char* p;
+ std::string line;
if ( list[i].total < 10 )
{
- sprintf(line, "\\c; %dx \\n;\\l;", list[i].total);
+ line = StrUtils::Format("\\c; %dx \\n;\\l;", list[i].total);
}
else
{
- sprintf(line, "\\c;%dx \\n;\\l;", list[i].total);
+ line = StrUtils::Format("\\c;%dx \\n;\\l;", list[i].total);
}
+ std::string res;
GetResource(RES_OBJECT, list[i].type, res);
- if ( res[0] == 0 ) return;
- strcat(line, res);
-
- strcat(line, "\\u ");
- p = const_cast<char*>(GetHelpFilename(list[i].type).c_str());
- if ( p[0] == 0 ) return;
- strcat(line, p+7); // skip "help\?\"
- p = strstr(line, ".txt");
- if ( p != 0 ) *p = 0;
- strcat(line, ";\n");
- fputs(line, file);
+ if (res.empty())
+ return;
+
+ line += res;
+
+ line += "\\u ";
+
+ std::string helpFilename = GetHelpFilename(list[i].type);
+ if (helpFilename.empty())
+ return;
+
+ line += helpFilename.substr(7); // skip "help\?\"
+
+ auto pos = line.find(".txt");
+ if (pos != std::string::npos)
+ {
+ line = line.substr(0, pos);
+ }
+
+ line += ";\n";
+
+ fputs(line.c_str(), file);
}
// Creates the file containing the list of objects.
@@ -1006,7 +1012,7 @@ void CDisplayInfo::CreateObjectsFile()
CObject* pObj;
ObjectType type;
ObjectList list[200];
- char line[100];
+ std::string line;
int i;
bool bRadar, bAtLeast;
@@ -1038,7 +1044,7 @@ void CDisplayInfo::CreateObjectsFile()
if ( bRadar )
{
GetResource(RES_TEXT, RT_SATCOM_LIST, line);
- fputs(line, file);
+ fputs(line.c_str(), file);
bAtLeast = false;
for ( i=0 ; i<200 ; i++ )
{
@@ -1054,13 +1060,12 @@ void CDisplayInfo::CreateObjectsFile()
if ( !bAtLeast )
{
GetResource(RES_TEXT, RT_SATCOM_NULL, line);
- fputs(line, file);
+ fputs(line.c_str(), file);
}
- strcpy(line, "\n");
- fputs(line, file);
+ fputs("\n", file);
GetResource(RES_TEXT, RT_SATCOM_BOT, line);
- fputs(line, file);
+ fputs(line.c_str(), file);
bAtLeast = false;
for ( i=0 ; i<200 ; i++ )
{
@@ -1101,13 +1106,12 @@ void CDisplayInfo::CreateObjectsFile()
if ( !bAtLeast )
{
GetResource(RES_TEXT, RT_SATCOM_NULL, line);
- fputs(line, file);
+ fputs(line.c_str(), file);
}
- strcpy(line, "\n");
- fputs(line, file);
+ fputs("\n", file);
GetResource(RES_TEXT, RT_SATCOM_BUILDING, line);
- fputs(line, file);
+ fputs(line.c_str(), file);
bAtLeast = false;
for ( i=0 ; i<200 ; i++ )
{
@@ -1142,13 +1146,12 @@ void CDisplayInfo::CreateObjectsFile()
if ( !bAtLeast )
{
GetResource(RES_TEXT, RT_SATCOM_NULL, line);
- fputs(line, file);
+ fputs(line.c_str(), file);
}
- strcpy(line, "\n");
- fputs(line, file);
+ fputs("\n", file);
GetResource(RES_TEXT, RT_SATCOM_FRET, line);
- fputs(line, file);
+ fputs(line.c_str(), file);
bAtLeast = false;
for ( i=0 ; i<200 ; i++ )
{
@@ -1170,13 +1173,12 @@ void CDisplayInfo::CreateObjectsFile()
if ( !bAtLeast )
{
GetResource(RES_TEXT, RT_SATCOM_NULL, line);
- fputs(line, file);
+ fputs(line.c_str(), file);
}
- strcpy(line, "\n");
- fputs(line, file);
+ fputs("\n", file);
GetResource(RES_TEXT, RT_SATCOM_ALIEN, line);
- fputs(line, file);
+ fputs(line.c_str(), file);
bAtLeast = false;
for ( i=0 ; i<200 ; i++ )
{
@@ -1195,19 +1197,18 @@ void CDisplayInfo::CreateObjectsFile()
if ( !bAtLeast )
{
GetResource(RES_TEXT, RT_SATCOM_NULL, line);
- fputs(line, file);
+ fputs(line.c_str(), file);
}
}
else
{
GetResource(RES_TEXT, RT_SATCOM_ERROR1, line);
- fputs(line, file);
+ fputs(line.c_str(), file);
GetResource(RES_TEXT, RT_SATCOM_ERROR2, line);
- fputs(line, file);
+ fputs(line.c_str(), file);
}
- strcpy(line, "\n");
- fputs(line, file);
+ fputs("\n", file);
fclose(file);
}
diff --git a/src/ui/displayinfo.h b/src/ui/displayinfo.h
index eea50b7..891551b 100644
--- a/src/ui/displayinfo.h
+++ b/src/ui/displayinfo.h
@@ -25,6 +25,8 @@
#include "graphics/engine/camera.h"
+#include "app/pausemanager.h"
+
class CRobotMain;
class CObject;
class CEventQueue;
@@ -67,13 +69,14 @@ protected:
void CreateObjectsFile();
protected:
- Gfx::CEngine* m_engine;
- CEventQueue* m_event;
- CRobotMain* m_main;
- Gfx::CCamera* m_camera;
- CInterface* m_interface;
- Gfx::CParticle* m_particle;
- Gfx::CLightManager* m_light;
+ Gfx::CEngine* m_engine;
+ CEventQueue* m_event;
+ CRobotMain* m_main;
+ Gfx::CCamera* m_camera;
+ CInterface* m_interface;
+ Gfx::CParticle* m_particle;
+ Gfx::CLightManager* m_light;
+ CPauseManager* m_pause;
bool m_bInfoMaximized;
bool m_bInfoMinimized;
@@ -88,7 +91,7 @@ protected:
Math::Point m_infoFinalDim;
int m_lightSuppl;
bool m_bEditLock;
- bool m_bInitPause;
+ PauseType m_bInitPause;
bool m_bSoluce;
CObject* m_toto;
};
diff --git a/src/ui/displaytext.cpp b/src/ui/displaytext.cpp
index d88674a..5b3144d 100644
--- a/src/ui/displaytext.cpp
+++ b/src/ui/displaytext.cpp
@@ -127,9 +127,6 @@ void CDisplayText::DisplayError(Error err, CObject* pObj, float time)
void CDisplayText::DisplayError(Error err, Math::Vector goal, float height,
float dist, float time)
{
- TextType type;
- char text[100];
-
if ( err == ERR_OK ) return;
#if 0
@@ -148,7 +145,7 @@ void CDisplayText::DisplayError(Error err, Math::Vector goal, float height,
type = TT_WARNING;
}
#else
- type = TT_WARNING;
+ TextType type = TT_WARNING;
if ( err >= INFO_FIRST )
{
type = TT_INFO;
@@ -164,8 +161,9 @@ void CDisplayText::DisplayError(Error err, Math::Vector goal, float height,
}
#endif
+ std::string text;
GetResource(RES_ERR, err, text);
- DisplayText(text, goal, height, dist, time, type);
+ DisplayText(text.c_str(), goal, height, dist, time, type);
}
// Displays text.
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index a187688..e2df62b 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -19,6 +19,7 @@
#include "ui/edit.h"
#include "app/app.h"
+#include "app/gamedata.h"
#include "clipboard/clipboard.h"
@@ -1224,11 +1225,7 @@ void CEdit::DrawPart(Math::Point pos, Math::Point dim, int icon)
Math::Point uv1, uv2;
float dp;
-#if _POLISH
- m_engine->SetTexture("textp.png");
-#else
m_engine->SetTexture("text.png");
-#endif
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = (16.0f/256.0f)*(icon%16);
@@ -1462,11 +1459,14 @@ bool CEdit::ReadText(std::string filename, int addSize)
std::string path = filename;
if (!fs::exists(path))
{
- path = CApplication::GetInstancePointer()->GetDataDirPath() + "/" + filename;
+ path = CGameData::GetInstancePointer()->GetDataPath(filename);
}
file = fopen(fs::path(path).make_preferred().string().c_str(), "rb");
- if ( file == NULL ) return false;
+ if ( file == NULL ) {
+ CLogger::GetInstancePointer()->Error("Unable to read text from file \"%s\"\n", path.c_str());
+ return false;
+ }
fseek(file, 0, SEEK_END);
len = ftell(file);
@@ -1669,12 +1669,14 @@ bool CEdit::ReadText(std::string filename, int addSize)
buffer[i+6] == 'n' &&
buffer[i+7] == ' ' )
{
+ /* TODO: \button X; isn't working. Issue #232
if ( m_bSoluce || !bInSoluce )
{
m_text[j] = GetValueParam(buffer+i+8, 0);
m_format[j] = font|Gfx::FONT_BUTTON;
j ++;
}
+ */
i += strchr(buffer+i, ';')-(buffer+i)+1;
}
else if ( //m_format.size() > 0 &&
@@ -1798,8 +1800,10 @@ bool CEdit::ReadText(std::string filename, int addSize)
res = main->GetInputBinding(slot).primary;
if ( res != 0 )
{
- if ( GetResource(RES_KEY, res, iName) )
+ std::string iNameStr;
+ if ( GetResource(RES_KEY, res, iNameStr) )
{
+ strcpy(iName, iNameStr.c_str());
m_text[j] = ' ';
m_format[j] = font;
j ++;
@@ -1817,9 +1821,13 @@ bool CEdit::ReadText(std::string filename, int addSize)
res = main->GetInputBinding(slot).secondary;
if ( res != 0 )
{
- if ( GetResource(RES_KEY, res, iName) )
+ if ( GetResource(RES_KEY, res, iNameStr) )
{
- GetResource(RES_TEXT, RT_KEY_OR, text);
+ strcpy(iName, iNameStr.c_str());
+
+ std::string textStr;
+ GetResource(RES_TEXT, RT_KEY_OR, textStr);
+ strcpy(text, textStr.c_str());
n = 0;
while ( text[n] != 0 )
{
diff --git a/src/ui/group.cpp b/src/ui/group.cpp
index 908ac19..64495e0 100644
--- a/src/ui/group.cpp
+++ b/src/ui/group.cpp
@@ -52,12 +52,7 @@ bool CGroup::Create(Math::Point pos, Math::Point dim, int icon, EventType eventT
if ( icon == -1 )
{
- char name[100];
- char* p;
-
- GetResource(RES_EVENT, eventType, name);
- p = strchr(name, '\\');
- if ( p != 0 ) *p = 0;
+ std::string name = GetResourceName(eventType);
SetName(name);
}
diff --git a/src/ui/image.cpp b/src/ui/image.cpp
index 9a14789..8f9b5ca 100644
--- a/src/ui/image.cpp
+++ b/src/ui/image.cpp
@@ -58,12 +58,7 @@ bool CImage::Create(Math::Point pos, Math::Point dim, int icon, EventType eventT
if ( icon == -1 )
{
- char name[100];
- char* p;
-
- GetResource(RES_EVENT, eventType, name);
- p = strchr(name, '\\');
- if ( p != 0 ) *p = 0;
+ std::string name = GetResourceName(eventType);
SetName(name);
}
diff --git a/src/ui/key.cpp b/src/ui/key.cpp
index 1f8cff5..aacc8d8 100644
--- a/src/ui/key.cpp
+++ b/src/ui/key.cpp
@@ -19,16 +19,19 @@
#include "ui/key.h"
#include "common/global.h"
+#include "common/stringutils.h"
#include <cstring>
namespace Ui {
-void GetKeyName(char* name, unsigned int key)
+static void GetKeyName(std::string& name, unsigned int key)
{
if (!GetResource(RES_KEY, key, name))
- sprintf(name, "Code %d", key);
+ {
+ name = StrUtils::Format("Code %d", key);
+ }
}
@@ -51,9 +54,9 @@ bool CKey::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg
CControl::Create(pos, dim, icon, eventMsg);
- char name[100];
+ std::string name;
GetResource(RES_EVENT, eventMsg, name);
- SetName(std::string(name));
+ SetName(name);
return true;
}
@@ -176,19 +179,24 @@ void CKey::Draw()
float h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize) / 2.0f;
- char text[100];
- GetKeyName(text, m_binding.primary);
+ std::string keyName;
+ GetKeyName(keyName, m_binding.primary);
if (m_binding.secondary != KEY_INVALID)
{
- GetResource(RES_TEXT, RT_KEY_OR, text+strlen(text));
- GetKeyName(text+strlen(text), m_binding.secondary);
+ std::string orText;
+ GetResource(RES_TEXT, RT_KEY_OR, orText);
+ keyName.append(orText);
+
+ std::string secondaryKeyName;
+ GetKeyName(secondaryKeyName, m_binding.secondary);
+ keyName.append(secondaryKeyName);
}
Math::Point pos;
pos.x = m_pos.x + m_dim.x * 0.5f;
pos.y = m_pos.y + m_dim.y * 0.5f;
pos.y -= h;
- m_engine->GetText()->DrawText(std::string(text), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_CENTER, 0);
+ m_engine->GetText()->DrawText(keyName, m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_CENTER, 0);
m_dim = iDim;
@@ -199,7 +207,7 @@ void CKey::Draw()
pos.x = m_pos.x + (214.0f / 640.0f);
pos.y = m_pos.y + m_dim.y * 0.5f;
pos.y -= h;
- m_engine->GetText()->DrawText(std::string(m_name), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_LEFT, 0);
+ m_engine->GetText()->DrawText(m_name, m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_LEFT, 0);
}
void CKey::SetBinding(InputBinding b)
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index 407f8da..11f8f4a 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -18,15 +18,17 @@
#include "ui/maindialog.h"
#include "app/app.h"
+#include "app/gamedata.h"
#include "app/system.h"
+#include "common/config.h"
#include "common/global.h"
#include "common/event.h"
#include "common/logger.h"
#include "common/misc.h"
#include "common/profile.h"
#include "common/restext.h"
-#include "common/logger.h"
+#include "common/stringutils.h"
#include "object/robotmain.h"
@@ -52,6 +54,7 @@
#include <string.h>
#include <sstream>
#include <iomanip>
+#include <vector>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
@@ -118,6 +121,7 @@ CMainDialog::CMainDialog()
m_camera = m_main->GetCamera();
m_engine = Gfx::CEngine::GetInstancePointer();
m_particle = m_engine->GetParticle();
+ m_pause = CPauseManager::GetInstancePointer();
m_phase = PHASE_NAME;
m_phaseSetup = PHASE_SETUPg;
@@ -153,9 +157,6 @@ CMainDialog::CMainDialog()
m_bMovies = true;
m_bNiceReset = true;
m_bHimselfDamage = true;
-/* TODO: #if _TEEN
- m_bCameraScroll = false;
-#else*/
m_bCameraScroll = true;
m_bCameraInvertX = false;
@@ -215,7 +216,7 @@ void CMainDialog::ChangePhase(Phase phase)
CImage* pi;
Math::Point pos, dim, ddim;
float ox, oy, sx, sy;
- char name[100];
+ std::string name;
char* gamer;
int res, i, j;
@@ -243,9 +244,6 @@ void CMainDialog::ChangePhase(Phase phase)
pos.y = 0.10f;
ddim.x = 0.30f;
ddim.y = 0.80f;
- /* TODO: #if _TEEN
- pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
-#else*/
pw = m_interface->CreateWindows(pos, ddim, 10, EVENT_WINDOW5);
GetResource(RES_TEXT, RT_TITLE_INIT, name);
@@ -261,22 +259,7 @@ void CMainDialog::ChangePhase(Phase phase)
ddim.x = 0.30f;
ddim.y = 0.30f;
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
-
- /* TODO: #if _SCHOOL
- ddim.x = 0.20f;
- ddim.y = dim.y*2.4f;
- pos.x = 0.40f;
- pos.y = oy+sy*7.9f;
- pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // orange
- pg->SetState(STATE_SHADOW);
- pos.y = oy+sy*3.9f;
- pg = pw->CreateGroup(pos, ddim, 25, EVENT_LABEL1); // orange
- pg->SetState(STATE_SHADOW);
- ddim.y = dim.y*1.2f;
- pos.y = oy+sy*1.9f;
- pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // red
- pg->SetState(STATE_SHADOW);
-#else */
+
ddim.x = 0.20f;
ddim.y = dim.y*2.4f;
pos.x = 0.40f;
@@ -296,26 +279,7 @@ void CMainDialog::ChangePhase(Phase phase)
pos.y = oy+sy*1.9f;
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // red
pg->SetState(STATE_SHADOW);
-
- /* TODO: #if _SCHOOL
- ddim.x = 0.18f;
- ddim.y = dim.y*1;
- pos.x = 0.41f;
- pos.y = oy+sy*9.1f;
- pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_TRAINER);
- pb->SetState(STATE_SHADOW);
-
- pos.y = oy+sy*8.0f;
-#if _TEEN
-pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_TEEN);
-#else
-pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_DEFI);
-#endif
-#if _CEEBOTDEMO
-pb->ClearState(STATE_ENABLE);
-#endif
-pb->SetState(STATE_SHADOW);
-#else */
+
ddim.x = 0.18f;
ddim.y = dim.y*1;
pos.x = 0.41f;
@@ -351,30 +315,22 @@ pb->SetState(STATE_SHADOW);
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_QUIT);
pb->SetState(STATE_SHADOW);
- // TODO: #if !_DEMO & !_SCHOOL
+ #if DEV_BUILD
if ( m_accessEnable && m_accessUser )
{
pos.x = 447.0f/640.0f;
pos.y = 313.0f/480.0f;
ddim.x = 0.09f;
- /*#if _POLISH
- pos.x -= 5.0f/640.0f;
- ddim.x += 10.0f/640.0f;
-#endif*/
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_USER);
pb->SetState(STATE_SHADOW);
}
- // #endif
+ #endif
- // TODO: remove?
- if (m_app->GetProtoMode())
- {
- pos.x = 139.0f/640.0f;
- pos.y = 313.0f/480.0f;
- ddim.x = 0.09f;
- pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PROTO);
- pb->SetState(STATE_SHADOW);
- }
+ /*pos.x = 139.0f/640.0f;
+ pos.y = 313.0f/480.0f;
+ ddim.x = 0.09f;
+ pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PROTO);
+ pb->SetState(STATE_SHADOW);*/
pos.x = 0.40f;
ddim.x = 0.20f;
@@ -406,19 +362,6 @@ pb->SetState(STATE_SHADOW);
GetResource(RES_TEXT, RT_TITLE_NAME, name);
pw->SetName(name);
- /* TODO: #if _NEWLOOK
- pos.x = 80.0f/640.0f;
- pos.y = 93.0f/480.0f;
- ddim.x = 285.0f/640.0f;
- ddim.y = 266.0f/480.0f;
- pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
- pg->SetState(STATE_SHADOW);
- pos.x = 372.0f/640.0f;
- ddim.x = 188.0f/640.0f;
- pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
- pg->SetState(STATE_SHADOW);
-#endif*/
-
pos.x = 0.10f;
pos.y = 0.40f;
ddim.x = 0.50f;
@@ -458,10 +401,10 @@ pb->SetState(STATE_SHADOW);
}
else
{
- strcpy(name, gamer);
+ name = gamer;
}
- pe->SetText(name);
- pe->SetCursor(strlen(name), 0);
+ pe->SetText(name.c_str());
+ pe->SetCursor(name.length(), 0);
pe->SetFocus(true);
pos.x = 380.0f/640.0f;
@@ -526,15 +469,6 @@ pb->SetState(STATE_SHADOW);
GetResource(RES_TEXT, RT_TITLE_PERSO, name);
pw->SetName(name);
- /* TODO: #if _NEWLOOK
- pos.x = 95.0f/640.0f;
- pos.y = 66.0f/480.0f;
- ddim.x = 443.0f/640.0f;
- ddim.y = 42.0f/480.0f;
- pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
- pg->SetState(STATE_SHADOW);
-#endif*/
-
pos.x = 0.10f;
pos.y = 0.40f;
ddim.x = 0.50f;
@@ -770,15 +704,13 @@ pb->SetState(STATE_SHADOW);
m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN ||
- m_phase == PHASE_USER ||
- m_phase == PHASE_PROTO )
+ m_phase == PHASE_USER )
{
if ( m_phase == PHASE_TRAINER ) m_index = 0;
if ( m_phase == PHASE_DEFI ) m_index = 1;
if ( m_phase == PHASE_MISSION ) m_index = 2;
if ( m_phase == PHASE_FREE ) m_index = 3;
if ( m_phase == PHASE_USER ) m_index = 4;
- if ( m_phase == PHASE_PROTO ) m_index = 5;
if ( m_phase == PHASE_TEEN ) m_index = 6;
if ( m_phase == PHASE_FREE )
@@ -794,7 +726,6 @@ pb->SetState(STATE_SHADOW);
if ( m_phase == PHASE_FREE ) strcpy(m_sceneName, "free");
if ( m_phase == PHASE_TEEN ) strcpy(m_sceneName, "teen");
if ( m_phase == PHASE_USER ) strcpy(m_sceneName, "user");
- if ( m_phase == PHASE_PROTO ) strcpy(m_sceneName, "proto");
ReadGamerInfo();
@@ -810,33 +741,9 @@ pb->SetState(STATE_SHADOW);
if ( m_phase == PHASE_FREE ) res = RT_TITLE_FREE;
if ( m_phase == PHASE_TEEN ) res = RT_TITLE_TEEN;
if ( m_phase == PHASE_USER ) res = RT_TITLE_USER;
- if ( m_phase == PHASE_PROTO ) res = RT_TITLE_PROTO;
GetResource(RES_TEXT, res, name);
pw->SetName(name);
- /* TODO: #if _NEWLOOK
- pos.x = 100.0f/640.0f;
- pos.y = 226.0f/480.0f;
- ddim.x = 216.0f/640.0f;
- ddim.y = 160.0f/480.0f;
- pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
- pg->SetState(STATE_SHADOW);
- pos.x = 322.0f/640.0f;
- pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
- pg->SetState(STATE_SHADOW);
-
- pos.x = 100.0f/640.0f;
- pos.y = 122.0f/480.0f;
- ddim.x = 438.0f/640.0f;
- ddim.y = 98.0f/480.0f;
- pg = pw->CreateGroup(pos, ddim, 25, EVENT_LABEL1); // green
- pg->SetState(STATE_SHADOW);
- pos.y = 66.0f/480.0f;
- ddim.y = 42.0f/480.0f;
- pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
- pg->SetState(STATE_SHADOW);
-#endif */
-
pos.x = 0.10f;
pos.y = 0.40f;
ddim.x = 0.50f;
@@ -859,7 +766,6 @@ pb->SetState(STATE_SHADOW);
if ( m_phase == PHASE_FREE ) res = RT_PLAY_CHAPf;
if ( m_phase == PHASE_TEEN ) res = RT_PLAY_CHAPte;
if ( m_phase == PHASE_USER ) res = RT_PLAY_CHAPu;
- if ( m_phase == PHASE_PROTO ) res = RT_PLAY_CHAPp;
GetResource(RES_TEXT, res, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL11, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
@@ -883,7 +789,6 @@ pb->SetState(STATE_SHADOW);
if ( m_phase == PHASE_FREE ) res = RT_PLAY_LISTf;
if ( m_phase == PHASE_TEEN ) res = RT_PLAY_LISTk;
if ( m_phase == PHASE_USER ) res = RT_PLAY_LISTu;
- if ( m_phase == PHASE_PROTO ) res = RT_PLAY_LISTp;
GetResource(RES_TEXT, res, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL12, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
@@ -1049,80 +954,6 @@ pb->SetState(STATE_SHADOW);
ddim.y = 0.05f;
pw->CreateGroup(pos, ddim, 3, EVENT_NULL); // transparent -> gray
- /* TODO: #if _NEWLOOK
- if ( m_phase == PHASE_SETUPd || // setup/display ?
- m_phase == PHASE_SETUPds )
- {
- pos.x = 100.0f/640.0f;
- pos.y = 130.0f/480.0f;
- ddim.x = 216.0f/640.0f;
- ddim.y = 212.0f/480.0f;
- pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
- pg->SetState(STATE_SHADOW);
- pos.x = 324.0f/640.0f;
- pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
- pg->SetState(STATE_SHADOW);
- }
- if ( m_phase == PHASE_SETUPg || // setup/graphic ?
- m_phase == PHASE_SETUPgs )
- {
- pos.x = 100.0f/640.0f;
- pos.y = 130.0f/480.0f;
- ddim.x = 174.0f/640.0f;
- ddim.y = 212.0f/480.0f;
- pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
- pg->SetState(STATE_SHADOW);
- pos.x = 282.0f/640.0f;
- ddim.x = 258.0f/640.0f;
- pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
- pg->SetState(STATE_SHADOW);
- }
- if ( m_phase == PHASE_SETUPp || // setup/game ?
- m_phase == PHASE_SETUPps )
- {
- pos.x = 100.0f/640.0f;
- pos.y = 130.0f/480.0f;
- ddim.x = 226.0f/640.0f;
- ddim.y = 212.0f/480.0f;
- pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
- pg->SetState(STATE_SHADOW);
- pos.x = 334.0f/640.0f;
- ddim.x = 206.0f/640.0f;
- pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
- pg->SetState(STATE_SHADOW);
- }
- if ( m_phase == PHASE_SETUPc || // setup/command ?
- m_phase == PHASE_SETUPcs )
- {
- pos.x = 100.0f/640.0f;
- pos.y = 125.0f/480.0f;
- ddim.x = 440.0f/640.0f;
- ddim.y = 222.0f/480.0f;
- pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
- pg->SetState(STATE_SHADOW);
- }
- if ( m_phase == PHASE_SETUPs || // setup/sound ?
- m_phase == PHASE_SETUPss )
- {
- pos.x = 100.0f/640.0f;
- pos.y = 130.0f/480.0f;
- ddim.x = 216.0f/640.0f;
- ddim.y = 212.0f/480.0f;
- pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
- pg->SetState(STATE_SHADOW);
- pos.x = 324.0f/640.0f;
- pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
- pg->SetState(STATE_SHADOW);
- }
-
- pos.x = 100.0f/640.0f;
- pos.y = 66.0f/480.0f;
- ddim.x = 440.0f/640.0f;
- ddim.y = 42.0f/480.0f;
- pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
- pg->SetState(STATE_SHADOW);
-#endif */
-
ddim.x = 0.78f/5-0.01f;
ddim.y = 0.06f;
pos.x = 0.115f;
@@ -1353,10 +1184,7 @@ pb->SetState(STATE_SHADOW);
ddim.y = dim.y*1;
pos.x = ox+sx*10;
pos.y = oy+sy*2;
- /* TODO: #if _POLISH
- ddim.x += 20.0f/640.0f;
- pos.x -= 20.0f/640.0f*3.0f;
-#endif*/
+
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_MIN);
pb->SetState(STATE_SHADOW);
pos.x += ddim.x;
@@ -1379,13 +1207,7 @@ pb->SetState(STATE_SHADOW);
//? pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_TOTO);
//? pc->SetState(STATE_SHADOW);
//? pos.y -= 0.048f;
- /*TODO: #if _SCHOOL
-#if _EDU
-pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SOLUCE4);
-pc->SetState(STATE_SHADOW);
-pos.y -= 0.048f;
-#endif
-#else*/
+
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_MOVIES);
pc->SetState(STATE_SHADOW);
pos.y -= 0.048f;
@@ -1507,7 +1329,6 @@ pos.y -= 0.048f;
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
- // TODO: #if (_FULL | _NET) & _SOUNDTRACKS
pos.x = ox+sx*3;
pos.y = 0.40f;
ddim.x = dim.x*4.0f;
@@ -1520,14 +1341,6 @@ pos.y -= 0.048f;
GetResource(RES_EVENT, EVENT_INTERFACE_VOLMUSIC, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
- // #endif
-
- ddim.x = dim.x*6;
- ddim.y = dim.y*0.5f;
- pos.x = ox+sx*10;
- pos.y = 0.55f;
- pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SOUND3D);
- pc->SetState(STATE_SHADOW);
ddim.x = dim.x*3;
ddim.y = dim.y*1;
@@ -1565,15 +1378,6 @@ pos.y -= 0.048f;
ddim.y = 0.50f;
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
- /* TODO: #if _NEWLOOK
- pos.x = 100.0f/640.0f;
- pos.y = 66.0f/480.0f;
- ddim.x = 438.0f/640.0f;
- ddim.y = 42.0f/480.0f;
- pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
- pg->SetState(STATE_SHADOW);
-#endif */
-
pos.x = 290.0f/640.0f;
ddim.x = 245.0f/640.0f;
@@ -1649,15 +1453,6 @@ pos.y -= 0.048f;
ddim.y = 0.50f;
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
- /* TODO: #if _NEWLOOK
- pos.x = 100.0f/640.0f;
- pos.y = 66.0f/480.0f;
- ddim.x = 438.0f/640.0f;
- ddim.y = 42.0f/480.0f;
- pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
- pg->SetState(STATE_SHADOW);
-#endif*/
-
pos.x = 290.0f/640.0f;
ddim.x = 245.0f/640.0f;
@@ -1717,9 +1512,6 @@ pos.y -= 0.048f;
pos.y = 0.10f;
ddim.x = 0.30f;
ddim.y = 0.80f;
- /*TODO: #if _TEEN
- pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
-#else*/
pw = m_interface->CreateWindows(pos, ddim, 10, EVENT_WINDOW5);
pw->SetName(" ");
@@ -1828,7 +1620,6 @@ pos.y -= 0.048f;
ddim.y = 0.0f;
pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5);
- // TODO: #if _FULL | _NET
pos.x = 80.0f/640.0f;
pos.y = 240.0f/480.0f;
ddim.x = 490.0f/640.0f;
@@ -1841,54 +1632,6 @@ pos.y -= 0.048f;
pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
pe->ReadText(std::string("help/") + m_app->GetLanguageChar() + std::string("/authors.txt"));
- // #endif
- /* TODO: #if _SCHOOL
- #if _CEEBOTDEMO
- pos.x = 80.0f/640.0f;
- pos.y = 210.0f/480.0f;
- ddim.x = 490.0f/640.0f;
- ddim.y = 150.0f/480.0f;
- #else
- pos.x = 80.0f/640.0f;
- pos.y = 200.0f/480.0f;
- ddim.x = 490.0f/640.0f;
- ddim.y = 150.0f/480.0f;
- #endif
- pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
- pe->SetGenericMode(true);
- pe->SetEditCap(false);
- pe->SetHighlightCap(false);
- pe->SetFontType(Gfx::FONT_COURIER);
- pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
- pe->ReadText("help/authors.txt");*/
-
- /* #if _DEMO
- //? pos.x = 80.0f/640.0f;
- //? pos.y = 240.0f/480.0f;
- //? ddim.x = 490.0f/640.0f;
- //? ddim.y = 110.0f/480.0f;
- //? pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
- //? pe->SetGenericMode(true);
- //? pe->SetEditCap(false);
- //? pe->SetHiliteCap(false);
- //? pe->SetFontType(Gfx::FONT_COURIER);
- //? pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
- //? pe->ReadText("help/demo.txt");
-
- //? pos.x = 80.0f/640.0f;
- //? pos.y = 140.0f/480.0f;
- //? ddim.x = 490.0f/640.0f;
- //? ddim.y = 100.0f/480.0f;
- //? pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT2);
- //? pe->SetGenericMode(true);
- //? pe->SetEditCap(false);
- //? pe->SetHiliteCap(false);
- //? pe->SetFontType(Gfx::FONT_COURIER);
- //? pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
- //? pe->ReadText("help/authors.txt");
-#endif */
-
- // TODO: #if !_DEMO
pos.x = 40.0f/640.0f;
pos.y = 83.0f/480.0f;
ddim.x = 246.0f/640.0f;
@@ -1918,23 +1661,13 @@ pos.y -= 0.048f;
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL4, name);
pl->SetFontType(Gfx::FONT_COURIER);
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
- // #endif
-
- /* TODO: #if _DEMO
- pos.x = 481.0f/640.0f;
- pos.y = 51.0f/480.0f;
- ddim.x = 30.0f/640.0f;
- ddim.y = 30.0f/480.0f;
- pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT);
- pb->SetState(STATE_SHADOW);
-#else */
+
pos.x = 306.0f/640.0f;
pos.y = 17.0f/480.0f;
ddim.x = 30.0f/640.0f;
ddim.y = 30.0f/480.0f;
pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT);
pb->SetState(STATE_SHADOW);
- // #endif
m_engine->SetBackground("generico.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
@@ -1953,7 +1686,6 @@ pos.y -= 0.048f;
m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN ||
m_phase == PHASE_USER ||
- m_phase == PHASE_PROTO ||
m_phase == PHASE_SETUPd ||
m_phase == PHASE_SETUPg ||
m_phase == PHASE_SETUPp ||
@@ -1962,26 +1694,12 @@ pos.y -= 0.048f;
m_phase == PHASE_READ ||
m_phase == PHASE_LOADING )
{
- /*TODO: #if _SCHOOL
-#if _TEEN
-pos.x = 50.0f/640.0f;
-pos.y = 430.0f/480.0f;
-ddim.x = 200.0f/640.0f;
-ddim.y = 10.0f/480.0f;
-#else
-pos.x = 450.0f/640.0f;
-pos.y = 0.0f/480.0f;
-ddim.x = 170.0f/640.0f;
-ddim.y = 9.0f/480.0f;
-#endif
-#else */
pos.x = 540.0f/640.0f;
pos.y = 9.0f/480.0f;
ddim.x = 90.0f/640.0f;
ddim.y = 10.0f/480.0f;
- //#endif
//GetResource(RES_TEXT, RT_VERSION_ID, name);
- pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, __DATE__);
+ pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, COLOBOT_VERSION_DISPLAY);
pl->SetFontType(Gfx::FONT_COURIER);
pl->SetFontSize(9.0f);
}
@@ -2087,9 +1805,10 @@ bool CMainDialog::EventProcess(const Event &event)
{
m_shotDelay --;
if ( m_shotDelay == 0 )
- {
- m_engine->WriteScreenShot(m_shotName, 320, 240);
- //? m_engine->WriteScreenShot(m_shotName, 160, 120);
+ {
+ Math::IntPoint windowSize = m_engine->GetWindowSize();
+
+ m_engine->WriteScreenShot(m_shotName, windowSize.x, windowSize.y);
}
}
@@ -2237,10 +1956,6 @@ bool CMainDialog::EventProcess(const Event &event)
m_main->ChangePhase(PHASE_USER);
break;
- case EVENT_INTERFACE_PROTO:
- m_main->ChangePhase(PHASE_PROTO);
- break;
-
case EVENT_INTERFACE_SETUP:
m_main->ChangePhase(m_phaseSetup);
break;
@@ -2444,8 +2159,7 @@ bool CMainDialog::EventProcess(const Event &event)
m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN ||
- m_phase == PHASE_USER ||
- m_phase == PHASE_PROTO )
+ m_phase == PHASE_USER )
{
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) return false;
@@ -2464,8 +2178,7 @@ bool CMainDialog::EventProcess(const Event &event)
m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN ||
- m_phase == PHASE_USER ||
- m_phase == PHASE_PROTO )
+ m_phase == PHASE_USER )
{
switch( event.type )
{
@@ -2492,11 +2205,6 @@ bool CMainDialog::EventProcess(const Event &event)
break;
case EVENT_INTERFACE_PLAY:
- if ( m_phase == PHASE_PROTO && m_chap[m_index] == 0 && m_sel[m_index] == 0 )
- {
- m_main->ChangePhase(PHASE_MODEL);
- break;
- }
m_sceneRank = (m_chap[m_index]+1)*100+(m_sel[m_index]+1);
m_phaseTerm = m_phase;
m_main->ChangePhase(PHASE_LOADING);
@@ -2888,7 +2596,7 @@ bool CMainDialog::EventProcess(const Event &event)
break;
case EVENT_INTERFACE_KDEF:
- m_app->ResetKeyStates();
+ m_main->SetDefaultInputBindings();
UpdateKey();
break;
@@ -2913,12 +2621,6 @@ bool CMainDialog::EventProcess(const Event &event)
ChangeSetupButtons();
break;
- case EVENT_INTERFACE_SOUND3D:
- m_sound->SetSound3D(!m_sound->GetSound3D());
- ChangeSetupButtons();
- UpdateSetupButtons();
- break;
-
case EVENT_INTERFACE_SILENT:
m_sound->SetAudioVolume(0);
m_sound->SetMusicVolume(0);
@@ -3119,8 +2821,7 @@ void CMainDialog::GlintMove()
m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN ||
- m_phase == PHASE_USER ||
- m_phase == PHASE_PROTO )
+ m_phase == PHASE_USER )
{
pg = static_cast<CGroup*>(pw->SearchControl(EVENT_INTERFACE_GLINTl));
if ( pg != 0 )
@@ -3256,8 +2957,6 @@ Math::Vector SoundRand()
void CMainDialog::FrameParticle(float rTime)
{
- /* TODO: #if _NEWLOOK
-#else */
Math::Vector pos, speed;
Math::Point dim;
float *pParti, *pGlint;
@@ -3348,7 +3047,6 @@ void CMainDialog::FrameParticle(float rTime)
m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN ||
m_phase == PHASE_USER ||
- m_phase == PHASE_PROTO ||
m_phase == PHASE_SETUPd ||
m_phase == PHASE_SETUPg ||
m_phase == PHASE_SETUPp ||
@@ -3620,7 +3318,7 @@ void CMainDialog::BuildSceneName(std::string &filename, char *base, int rank)
{
rankStream << std::setfill('0') << std::setw(3) << rank;
filename = base + rankStream.str() + ".txt";
- filename = CApplication::GetInstance().GetDataFilePath(DIR_LEVEL, filename);
+ filename = CGameData::GetInstancePointer()->GetFilePath(DIR_LEVEL, filename);
}
}
@@ -4019,7 +3717,7 @@ void CMainDialog::UpdatePerso()
CColor* pc;
CSlider* ps;
Gfx::Color color;
- char name[100];
+ std::string name;
int i;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
@@ -4366,8 +4064,8 @@ void CMainDialog::IOReadName()
}
time(&now);
- TimeToAscii(now, line);
- sprintf(name, "%s %d - %s", resume, m_sel[m_index]+1, line);
+ TimeToAsciiClean(now, line);
+ sprintf(name, "%s - %s %d", line, resume, m_sel[m_index]+1);
pe->SetText(name);
pe->SetCursor(strlen(name), 0);
pe->SetFocus(true);
@@ -4383,7 +4081,7 @@ void CMainDialog::IOReadList()
char line[500];
char name[100];
int i;
- fs::directory_iterator end_iter;
+ std::vector<fs::path> v;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) return;
@@ -4397,12 +4095,14 @@ void CMainDialog::IOReadList()
if (fs::exists(saveDir) && fs::is_directory(saveDir))
{
- for( fs::directory_iterator dir_iter(saveDir) ; dir_iter != end_iter ; ++dir_iter)
+ copy(fs::directory_iterator(saveDir), fs::directory_iterator(), back_inserter(v));
+ std::sort(v.begin(), v.end());
+ for( std::vector<fs::path>::iterator iter = v.begin(); iter != v.end(); ++iter)
{
- if ( fs::is_directory(dir_iter->status()) && fs::exists(dir_iter->path() / "data.sav") )
+ if ( fs::is_directory(*iter) && fs::exists(*iter / "data.sav") )
{
- file = fopen((dir_iter->path() / "data.sav").make_preferred().string().c_str(), "r");
+ file = fopen((*iter / "data.sav").make_preferred().string().c_str(), "r");
if ( file == NULL ) continue;
while ( fgets(line, 500, file) != NULL )
@@ -4426,7 +4126,7 @@ void CMainDialog::IOReadList()
fclose(file);
pl->SetItemName(m_saveList.size(), name);
- m_saveList.push_back(dir_iter->path());
+ m_saveList.push_back(*iter);
}
}
}
@@ -4434,8 +4134,9 @@ void CMainDialog::IOReadList()
// invalid index
if ( m_phase == PHASE_WRITE || m_phase == PHASE_WRITEs )
{
- GetResource(RES_TEXT, RT_IO_NEW, name);
- pl->SetItemName(m_saveList.size(), name);
+ std::string nameStr;
+ GetResource(RES_TEXT, RT_IO_NEW, nameStr);
+ pl->SetItemName(m_saveList.size(), nameStr.c_str());
}
pl->SetSelect(m_saveList.size());
@@ -4694,8 +4395,7 @@ void CMainDialog::AllMissionUpdate()
m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN ||
- m_phase == PHASE_USER ||
- m_phase == PHASE_PROTO )
+ m_phase == PHASE_USER )
{
UpdateSceneChap(m_chap[m_index]);
UpdateSceneList(m_chap[m_index], m_sel[m_index]);
@@ -4793,17 +4493,6 @@ void CMainDialog::UpdateSceneChap(int &chap)
{
for ( j=0 ; j<9 ; j++ )
{
-/* TODO: #if _SCHOOL
- if ( m_phase == PHASE_MISSION ) break;
- if ( m_phase == PHASE_FREE ) break;
-#if _CEEBOTDEMO
- if ( m_phase == PHASE_TRAINER && j >= 2 ) break;
-#endif
-#endif
-#if _DEMO
- if ( m_phase == PHASE_MISSION && j >= 4 ) break;
- if ( m_phase == PHASE_TRAINER && j >= 1 ) break;
-#endif */
BuildSceneName(fileName, m_sceneName, (j+1)*100);
file = fopen(fileName.c_str(), "r");
if ( file == NULL ) break;
@@ -4848,14 +4537,6 @@ void CMainDialog::UpdateSceneChap(int &chap)
break;
}
-/* TODO: #if _TEEN
- if ( m_phase == PHASE_TRAINER && !m_main->GetShowAll() && !bPassed )
- {
- j ++;
- break;
- }
-#endif*/
-
if ( m_phase == PHASE_FREE && j == m_accessChap )
{
j ++;
@@ -4899,21 +4580,6 @@ void CMainDialog::UpdateSceneList(int chap, int &sel)
for ( j=0 ; j<99 ; j++ )
{
-/* TODO: #if _SCHOOL
- if ( m_phase == PHASE_MISSION ) break;
- if ( m_phase == PHASE_FREE ) break;
-#if _CEEBOTDEMO
-#if _TEEN
- if ( m_phase == PHASE_TRAINER && j >= 5 ) break;
-#else
- if ( m_phase == PHASE_TRAINER && j >= 3 ) break;
-#endif
-#endif
-#endif
-#if _DEMO
- if ( m_phase == PHASE_MISSION && j >= 3 ) break;
- if ( m_phase == PHASE_TRAINER && j >= 5 ) break;
-#endif */
BuildSceneName(fileName, m_sceneName, (chap+1)*100+(j+1));
file = fopen(fileName.c_str(), "r");
if ( file == NULL ) break;
@@ -4957,14 +4623,6 @@ void CMainDialog::UpdateSceneList(int chap, int &sel)
j ++;
break;
}
-
-/* TODO: #if _TEEN
- if ( m_phase == PHASE_TRAINER && !m_main->GetShowAll() && !bPassed )
- {
- j ++;
- break;
- }
-#endif*/
}
BuildSceneName(fileName, m_sceneName, (chap+1)*100+(j+1));
@@ -4998,8 +4656,7 @@ void CMainDialog::ShowSoluceUpdate()
m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE ||
m_phase == PHASE_TEEN ||
- m_phase == PHASE_USER ||
- m_phase == PHASE_PROTO )
+ m_phase == PHASE_USER )
{
m_bSceneSoluce = false;
@@ -5456,13 +5113,6 @@ void CMainDialog::UpdateSetupButtons()
value = static_cast<float>(m_sound->GetMusicVolume());
ps->SetVisibleValue(value);
}
-
- pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SOUND3D));
- if ( pc != 0 )
- {
- pc->SetState(STATE_CHECK, m_sound->GetSound3D());
- pc->SetState(STATE_ENABLE, m_sound->GetSound3DCap());
- }
}
// Updates the engine function of the buttons after the setup phase.
@@ -5564,7 +5214,6 @@ void CMainDialog::SetupMemorize()
GetProfile().SetLocalProfileInt("Setup", "TotoMode", m_engine->GetTotoMode());
GetProfile().SetLocalProfileInt("Setup", "AudioVolume", m_sound->GetAudioVolume());
GetProfile().SetLocalProfileInt("Setup", "MusicVolume", m_sound->GetMusicVolume());
- GetProfile().SetLocalProfileInt("Setup", "Sound3D", m_sound->GetSound3D());
GetProfile().SetLocalProfileInt("Setup", "EditIndentMode", m_engine->GetEditIndentMode());
GetProfile().SetLocalProfileInt("Setup", "EditIndentValue", m_engine->GetEditIndentValue());
@@ -5601,21 +5250,7 @@ void CMainDialog::SetupMemorize()
GetProfile().SetLocalProfileString("Setup", "KeyMap", key.str());
-#if _NET
- if ( m_accessEnable )
- {
- iValue = m_accessMission;
- SetLocalProfileInt("Setup", "AccessMission", iValue);
-
- iValue = m_accessUser;
- SetLocalProfileInt("Setup", "AccessUser", iValue);
- }
-#endif
-
GetProfile().SetLocalProfileInt("Setup", "DeleteGamer", m_bDeleteGamer);
-
- // TODO: write graphic engine profile
- //m_engine->WriteProfile();
}
// Remember all the settings.
@@ -5802,11 +5437,6 @@ void CMainDialog::SetupRecall()
m_sound->SetMusicVolume(iValue);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "Sound3D", iValue) )
- {
- m_sound->SetSound3D(iValue == 1);
- }
-
if ( GetProfile().GetLocalProfileInt("Setup", "EditIndentMode", iValue) )
{
m_engine->SetEditIndentMode(iValue);
@@ -5830,21 +5460,6 @@ void CMainDialog::SetupRecall()
}
}
-#if _NET
- if ( m_accessEnable )
- {
- if ( GetProfile().GetLocalProfileInt("Setup", "AccessMission", iValue) )
- {
- m_accessMission = iValue;
- }
-
- if ( GetProfile().GetLocalProfileInt("Setup", "AccessUser", iValue) )
- {
- m_accessUser = iValue;
- }
- }
-#endif
-
if ( GetProfile().GetLocalProfileInt("Setup", "DeleteGamer", iValue) )
{
m_bDeleteGamer = iValue;
@@ -6026,7 +5641,7 @@ void CMainDialog::StartAbort()
CWindow* pw;
CButton* pb;
Math::Point pos, dim;
- char name[100];
+ std::string name;
StartDialog(Math::Point(0.3f, 0.8f), true, false, false);
m_bDialogDelete = false;
@@ -6047,10 +5662,6 @@ void CMainDialog::StartAbort()
pos.x = 0.40f;
dim.x = 0.20f;
-/* TODO: #if _POLISH
- pos.x -= 7.0f/640.0f;
- dim.x += 14.0f/640.0f;
-#endif*/
dim.y = 32.0f/480.0f;
pos.y = 0.74f;
@@ -6105,7 +5716,7 @@ void CMainDialog::StartDeleteObject()
CWindow* pw;
CButton* pb;
Math::Point pos, dim;
- char name[100];
+ std::string name;
StartDialog(Math::Point(0.7f, 0.3f), false, true, true);
m_bDialogDelete = true;
@@ -6139,21 +5750,22 @@ void CMainDialog::StartDeleteGame(char *gamer)
CWindow* pw;
CButton* pb;
Math::Point pos, dim;
- char name[100];
- char text[100];
StartDialog(Math::Point(0.7f, 0.3f), false, true, true);
m_bDialogDelete = true;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW9));
- if ( pw == 0 ) return;
+ if (pw == nullptr)
+ return;
+
+ std::string name;
pos.x = 0.00f;
pos.y = 0.50f;
dim.x = 1.00f;
dim.y = 0.05f;
GetResource(RES_TEXT, RT_DIALOG_DELGAME, name);
- sprintf(text, name, gamer);
+ std::string text = StrUtils::Format(name.c_str(), gamer);
pw->CreateLabel(pos, dim, -1, EVENT_DIALOG_LABEL, text);
pb = static_cast<CButton*>(pw->SearchControl(EVENT_DIALOG_OK));
@@ -6175,12 +5787,14 @@ void CMainDialog::StartQuit()
CWindow* pw;
CButton* pb;
Math::Point pos, dim;
- char name[100];
StartDialog(Math::Point(0.6f, 0.3f), false, true, true);
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW9));
- if ( pw == 0 ) return;
+ if (pw == nullptr)
+ return;
+
+ std::string name;
pos.x = 0.00f;
pos.y = 0.50f;
@@ -6208,7 +5822,6 @@ void CMainDialog::StartDialog(Math::Point dim, bool bFire, bool bOK, bool bCance
CWindow* pw;
CButton* pb;
Math::Point pos, ddim;
- char name[100];
StartSuspend();
@@ -6247,6 +5860,8 @@ void CMainDialog::StartDialog(Math::Point dim, bool bFire, bool bOK, bool bCance
m_bDialogFire = bFire;
+ std::string name;
+
pos.x = (1.0f-dim.x)/2.0f;
pos.y = (1.0f-dim.y)/2.0f;
pw = m_interface->CreateWindows(pos, dim, bFire?12:8, EVENT_WINDOW9);
@@ -6442,8 +6057,8 @@ void CMainDialog::StartSuspend()
{
m_sound->MuteAll(true);
m_main->ClearInterface();
- m_bInitPause = m_engine->GetPause();
- m_engine->SetPause(true);
+ m_bInitPause = m_pause->GetPauseType();
+ m_pause->SetPause(PAUSE_DIALOG);
m_engine->SetOverFront(false); // over flat behind
m_main->CreateShortcuts();
m_main->StartSuspend();
@@ -6457,7 +6072,7 @@ void CMainDialog::StopSuspend()
{
m_sound->MuteAll(false);
m_main->ClearInterface();
- if ( !m_bInitPause ) m_engine->SetPause(false);
+ m_pause->SetPause(m_bInitPause);
m_engine->SetOverFront(true); // over flat front
m_main->CreateShortcuts();
m_main->StopSuspend();
diff --git a/src/ui/maindialog.h b/src/ui/maindialog.h
index 96aff2a..444a568 100644
--- a/src/ui/maindialog.h
+++ b/src/ui/maindialog.h
@@ -23,6 +23,8 @@
#include "object/robotmain.h"
+#include "app/pausemanager.h"
+
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
@@ -186,6 +188,7 @@ protected:
Gfx::CParticle* m_particle;
Gfx::CCamera* m_camera;
CSoundInterface* m_sound;
+ CPauseManager* m_pause;
Phase m_phase; // copy of CRobotMain
Phase m_phaseSetup; // tab selected
@@ -242,26 +245,26 @@ protected:
bool m_bCameraInvertY; // for CCamera
bool m_bEffect; // for CCamera
- Math::Point m_glintMouse;
- float m_glintTime;
+ Math::Point m_glintMouse;
+ float m_glintTime;
- int m_loadingCounter;
+ int m_loadingCounter;
- bool m_bDialog; // this dialogue?
- bool m_bDialogFire; // setting on fire?
- bool m_bDialogDelete;
- Math::Point m_dialogPos;
- Math::Point m_dialogDim;
- float m_dialogParti;
- float m_dialogTime;
- bool m_bInitPause;
+ bool m_bDialog; // this dialogue?
+ bool m_bDialogFire; // setting on fire?
+ bool m_bDialogDelete;
+ Math::Point m_dialogPos;
+ Math::Point m_dialogDim;
+ float m_dialogParti;
+ float m_dialogTime;
+ PauseType m_bInitPause;
Gfx::CameraType m_initCamera;
- int m_partiPhase[10];
- float m_partiTime[10];
- Math::Point m_partiPos[10];
+ int m_partiPhase[10];
+ float m_partiTime[10];
+ Math::Point m_partiPos[10];
- SceneInfo m_sceneInfo[MAXSCENE];
+ SceneInfo m_sceneInfo[MAXSCENE];
std::vector<fs::path> m_saveList;
};
diff --git a/src/ui/mainshort.cpp b/src/ui/mainshort.cpp
index d33482c..f6dce4b 100644
--- a/src/ui/mainshort.cpp
+++ b/src/ui/mainshort.cpp
@@ -97,7 +97,6 @@ bool CMainShort::CreateShortcuts()
ObjectType type;
Math::Point pos, dim;
int i, rank, icon;
- char name[100];
if ( m_main->GetFixScene() ) return false;
@@ -208,10 +207,11 @@ bool CMainShort::CreateShortcuts()
m_shortcuts[rank] = pObj;
pc = m_interface->SearchControl(table_sc_em[rank]);
- if ( pc != 0 )
+ if ( pc != nullptr )
{
- pObj->GetTooltipName(name);
- pc->SetTooltip(name);
+ std::string tooltipName;
+ pObj->GetTooltipName(tooltipName);
+ pc->SetTooltip(tooltipName);
}
rank ++;
diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp
index e44a465..f83704e 100644
--- a/src/ui/studio.cpp
+++ b/src/ui/studio.cpp
@@ -71,6 +71,7 @@ CStudio::CStudio()
m_main = CRobotMain::GetInstancePointer();
m_interface = m_main->GetInterface();
m_camera = m_main->GetCamera();
+ m_pause = CPauseManager::GetInstancePointer();
m_bEditMaximized = false;
m_bEditMinimized = false;
@@ -97,7 +98,6 @@ bool CStudio::EventProcess(const Event &event)
CWindow* pw;
CEdit* edit;
CSlider* slider;
- char res[100];
if ( m_dialog != SD_NULL ) // dialogue exists?
{
@@ -184,17 +184,17 @@ bool CStudio::EventProcess(const Event &event)
if ( event.type == EVENT_STUDIO_COMPILE ) // compile?
{
- char buffer[100];
-
if ( m_script->GetScript(edit) ) // compile
{
+ std::string res;
GetResource(RES_TEXT, RT_STUDIO_COMPOK, res);
SetInfoText(res, false);
}
else
{
- m_script->GetError(buffer);
- SetInfoText(buffer, false);
+ std::string error;
+ m_script->GetError(error);
+ SetInfoText(error, false);
}
}
@@ -218,9 +218,9 @@ bool CStudio::EventProcess(const Event &event)
}
else
{
- char buffer[100];
- m_script->GetError(buffer);
- SetInfoText(buffer, false);
+ std::string error;
+ m_script->GetError(error);
+ SetInfoText(error, false);
}
}
}
@@ -344,7 +344,6 @@ bool CStudio::EventFrame(const Event &event)
CList* list;
float time;
int cursor1, cursor2, iCursor1, iCursor2;
- char res[100];
m_time += event.rTime;
m_fixInfoTextTime -= event.rTime;
@@ -363,6 +362,7 @@ bool CStudio::EventFrame(const Event &event)
m_bRunning = false;
UpdateFlux(); // stop
AdjustEditScript();
+ std::string res;
GetResource(RES_TEXT, RT_STUDIO_PROGSTOP, res);
SetInfoText(res, false);
@@ -558,14 +558,13 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank)
CButton* button;
CSlider* slider;
CList* list;
- char res[100];
m_script = script;
m_rank = rank;
m_main->SetEditLock(true, true);
m_main->SetEditFull(false);
- m_bInitPause = m_engine->GetPause();
+ m_bInitPause = m_pause->GetPauseType();
m_main->SetSpeed(1.0f);
m_editCamera = m_camera->GetType();
m_camera->SetType(Gfx::CAM_TYPE_EDIT);
@@ -575,28 +574,33 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank)
m_script->SetStepMode(!m_bRealTime);
button = static_cast< CButton* >(m_interface->SearchControl(EVENT_BUTTON_QUIT));
- if ( button != 0 )
- {
+ if (button != nullptr)
button->ClearState(STATE_VISIBLE);
- }
pos = m_editFinalPos = m_editActualPos = m_main->GetWindowPos();
dim = m_editFinalDim = m_editActualDim = m_main->GetWindowDim();
pw = m_interface->CreateWindows(pos, dim, 8, EVENT_WINDOW3);
- if ( pw == nullptr ) return;
+ if (pw == nullptr)
+ return;
+
pw->SetState(STATE_SHADOW);
pw->SetRedim(true); // before SetName!
pw->SetMovable(true);
pw->SetClosable(true);
+
+ std::string res;
GetResource(RES_TEXT, RT_STUDIO_TITLE, res);
pw->SetName(res);
+
pw->SetMinDim(Math::Point(0.49f, 0.50f));
pw->SetMaximized(m_bEditMaximized);
pw->SetMinimized(m_bEditMinimized);
m_main->SetEditFull(m_bEditMaximized);
edit = pw->CreateEdit(pos, dim, 0, EVENT_STUDIO_EDIT);
- if ( edit == 0 ) return;
+ if (edit == nullptr)
+ return;
+
edit->SetState(STATE_SHADOW);
edit->SetInsideScroll(false);
//? if ( m_bRunning ) edit->SetEdit(false);
@@ -851,7 +855,6 @@ bool CStudio::StopEditScript(bool bCancel)
CWindow* pw;
CEdit* edit;
CButton* button;
- char buffer[100];
pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3));
if ( pw == nullptr ) return false;
@@ -863,8 +866,9 @@ bool CStudio::StopEditScript(bool bCancel)
{
if ( !m_script->GetScript(edit) ) // compile
{
- m_script->GetError(buffer);
- SetInfoText(buffer, false);
+ std::string error;
+ m_script->GetError(error);
+ SetInfoText(error, false);
return false;
}
}
@@ -879,7 +883,7 @@ bool CStudio::StopEditScript(bool bCancel)
button->SetState(STATE_VISIBLE);
}
- if ( !m_bInitPause ) m_engine->SetPause(false);
+ m_pause->SetPause(m_bInitPause);
m_sound->MuteAll(false);
m_main->SetEditLock(false, true);
m_camera->SetType(m_editCamera);
@@ -892,8 +896,6 @@ bool CStudio::StopEditScript(bool bCancel)
void CStudio::SetInfoText(std::string text, bool bClickable)
{
- char res[100];
-
if ( bClickable && m_fixInfoTextTime > 0.0f ) return;
if ( !bClickable ) m_fixInfoTextTime = 8.0f;
@@ -911,6 +913,7 @@ void CStudio::SetInfoText(std::string text, bool bClickable)
if ( bClickable )
{
+ std::string res;
GetResource(RES_TEXT, RT_STUDIO_LISTTT, res);
list->SetTooltip(res);
list->SetState(STATE_ENABLE);
@@ -952,22 +955,22 @@ void CStudio::UpdateFlux()
#if 1
if ( m_bRealTime ) // run?
{
- m_engine->SetPause(false);
+ m_pause->ClearPause();
m_sound->MuteAll(false);
}
else // step by step?
{
- m_engine->SetPause(true);
+ m_pause->SetPause(PAUSE_EDITOR);
m_sound->MuteAll(true);
}
#else
- m_engine->SetPause(false);
+ m_pause->ClearPause();
m_sound->MuteAll(false);
#endif
}
else // stop?
{
- m_engine->SetPause(true);
+ m_pause->SetPause(PAUSE_EDITOR);
m_sound->MuteAll(true);
}
}
@@ -1029,7 +1032,7 @@ void CStudio::StartDialog(StudioDialog type)
CList* pli;
CEdit* pe;
Math::Point pos, dim;
- char name[100];
+ std::string name;
m_dialog = type;
@@ -1108,17 +1111,11 @@ void CStudio::StartDialog(StudioDialog type)
GetResource(RES_TEXT, RT_IO_PRIVATE, name);
pc->SetName(name);
pc->SetState(STATE_SHADOW);
-#if _POLISH
- pc->SetFontSize(8.0f);
-#endif
pc = pw->CreateCheck(pos, dim, 0, EVENT_DIALOG_CHECK2);
GetResource(RES_TEXT, RT_IO_PUBLIC, name);
pc->SetName(name);
pc->SetState(STATE_SHADOW);
-#if _POLISH
- pc->SetFontSize(8.0f);
-#endif
pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_OK);
pb->SetState(STATE_SHADOW);
@@ -1476,8 +1473,6 @@ void CStudio::UpdateDialogPublic()
CWindow* pw;
CCheck* pc;
CLabel* pl;
- char name[100];
- //char text[MAX_FNAME+100];
pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW9));
if ( pw == nullptr ) return;
@@ -1497,7 +1492,7 @@ void CStudio::UpdateDialogPublic()
pl = static_cast< CLabel* >(pw->SearchControl(EVENT_DIALOG_LABEL1));
if ( pl != 0 )
{
- GetResource(RES_TEXT, RT_IO_LIST, name);
+ // GetResource(RES_TEXT, RT_IO_LIST, name); // TODO: unused?
pl->SetName(SearchDirectory(false).c_str(), false);
}
}
diff --git a/src/ui/studio.h b/src/ui/studio.h
index 1c14124..d1c6a51 100644
--- a/src/ui/studio.h
+++ b/src/ui/studio.h
@@ -22,6 +22,8 @@
#include "graphics/engine/camera.h"
+#include "app/pausemanager.h"
+
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
@@ -96,6 +98,7 @@ protected:
CSoundInterface* m_sound;
CInterface* m_interface;
CApplication* m_app;
+ CPauseManager* m_pause;
int m_rank;
CScript* m_script;
@@ -109,11 +112,11 @@ protected:
Math::Point m_editFinalPos;
Math::Point m_editFinalDim;
- float m_time;
- float m_fixInfoTextTime;
- bool m_bRunning;
- bool m_bRealTime;
- bool m_bInitPause;
+ float m_time;
+ float m_fixInfoTextTime;
+ bool m_bRunning;
+ bool m_bRealTime;
+ PauseType m_bInitPause;
std::string m_helpFilename;
StudioDialog m_dialog;
diff --git a/src/ui/window.cpp b/src/ui/window.cpp
index 6e082e6..98e1e6c 100644
--- a/src/ui/window.cpp
+++ b/src/ui/window.cpp
@@ -788,7 +788,7 @@ bool CWindow::GetFixed()
void CWindow::AdjustButtons()
{
- char res[100];
+ std::string res;
if ( m_buttonFull != 0 )
{
@@ -796,13 +796,13 @@ void CWindow::AdjustButtons()
{
m_buttonFull->SetIcon(54);
GetResource(RES_TEXT, RT_WINDOW_STANDARD, res);
- m_buttonFull->SetTooltip(std::string(res));
+ m_buttonFull->SetTooltip(res);
}
else
{
m_buttonFull->SetIcon(52);
GetResource(RES_TEXT, RT_WINDOW_MAXIMIZED, res);
- m_buttonFull->SetTooltip(std::string(res));
+ m_buttonFull->SetTooltip(res);
}
}
@@ -812,13 +812,13 @@ void CWindow::AdjustButtons()
{
m_buttonReduce->SetIcon(54);
GetResource(RES_TEXT, RT_WINDOW_STANDARD, res);
- m_buttonReduce->SetTooltip(std::string(res));
+ m_buttonReduce->SetTooltip(res);
}
else
{
m_buttonReduce->SetIcon(51);
GetResource(RES_TEXT, RT_WINDOW_MINIMIZED, res);
- m_buttonReduce->SetTooltip(std::string(res));
+ m_buttonReduce->SetTooltip(res);
}
}
@@ -826,7 +826,7 @@ void CWindow::AdjustButtons()
{
m_buttonClose->SetIcon(11); // x
GetResource(RES_TEXT, RT_WINDOW_CLOSE, res);
- m_buttonClose->SetTooltip(std::string(res));
+ m_buttonClose->SetTooltip(res);
}
}
@@ -1536,8 +1536,6 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
void CWindow::DrawHach(Math::Point pos, Math::Point dim)
{
-#if _NEWLOOK
-#else
Math::Point ppos, ddim, uv1, uv2;
float dp, max, ndim;
bool bStop;
@@ -1575,7 +1573,6 @@ void CWindow::DrawHach(Math::Point pos, Math::Point dim)
ppos.x += ddim.x;
}
while ( !bStop );
-#endif
}
}