summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2014-10-19 16:18:36 +0200
committerkrzys-h <krzys_h@interia.pl>2014-10-19 16:18:36 +0200
commit0245fdc6c328edf65b4fd9f45be4f440ef92b6eb (patch)
treed8237bdeacdee273c2eabaefc14f21637c1f489a /src/ui
parentd7ef0a1a5f7cee44eb8faaafefb7bb78e69be1f6 (diff)
parent83abb8ca8e74176d64944e9681d74aa11ef6cdf9 (diff)
downloadcolobot-0245fdc6c328edf65b4fd9f45be4f440ef92b6eb.tar.gz
colobot-0245fdc6c328edf65b4fd9f45be4f440ef92b6eb.tar.bz2
colobot-0245fdc6c328edf65b4fd9f45be4f440ef92b6eb.zip
Merge branch 'dev-physfs' into dev
Conflicts: src/app/app.cpp
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/button.cpp2
-rw-r--r--src/ui/check.cpp2
-rw-r--r--src/ui/color.cpp2
-rw-r--r--src/ui/compass.cpp2
-rw-r--r--src/ui/control.cpp14
-rw-r--r--src/ui/displayinfo.cpp282
-rw-r--r--src/ui/displayinfo.h1
-rw-r--r--src/ui/edit.cpp83
-rw-r--r--src/ui/gauge.cpp2
-rw-r--r--src/ui/group.cpp60
-rw-r--r--src/ui/image.cpp8
-rw-r--r--src/ui/key.cpp2
-rw-r--r--src/ui/list.cpp10
-rw-r--r--src/ui/maindialog.cpp265
-rw-r--r--src/ui/maindialog.h7
-rw-r--r--src/ui/map.cpp34
-rw-r--r--src/ui/scroll.cpp8
-rw-r--r--src/ui/shortcut.cpp6
-rw-r--r--src/ui/slider.cpp6
-rw-r--r--src/ui/studio.cpp1
-rw-r--r--src/ui/window.cpp38
21 files changed, 229 insertions, 606 deletions
diff --git a/src/ui/button.cpp b/src/ui/button.cpp
index 3cb7d25..0a10379 100644
--- a/src/ui/button.cpp
+++ b/src/ui/button.cpp
@@ -178,7 +178,7 @@ void CButton::Draw()
(m_state & STATE_CARD ) == 0 &&
(m_state & STATE_SIMPLY) == 0 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
dp = 0.5f / 256.0f;
diff --git a/src/ui/check.cpp b/src/ui/check.cpp
index 2e6f8ff..e590309 100644
--- a/src/ui/check.cpp
+++ b/src/ui/check.cpp
@@ -104,7 +104,7 @@ void CCheck::Draw()
DrawShadow(m_pos, m_dim);
}
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
zoomExt = 1.00f;
diff --git a/src/ui/color.cpp b/src/ui/color.cpp
index 0ffdc72..ddf7629 100644
--- a/src/ui/color.cpp
+++ b/src/ui/color.cpp
@@ -140,7 +140,7 @@ void CColor::Draw()
DrawShadow(m_pos, m_dim);
}
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
CControl::Draw();
diff --git a/src/ui/compass.cpp b/src/ui/compass.cpp
index e49302a..45977c5 100644
--- a/src/ui/compass.cpp
+++ b/src/ui/compass.cpp
@@ -90,7 +90,7 @@ void CCompass::Draw()
device = m_engine->GetDevice();
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
p1.x = m_pos.x;
diff --git a/src/ui/control.cpp b/src/ui/control.cpp
index 22f863b..a4cdbfc 100644
--- a/src/ui/control.cpp
+++ b/src/ui/control.cpp
@@ -439,7 +439,7 @@ void CControl::Draw()
if ( (m_state & STATE_VISIBLE) == 0 ) return;
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
zoomExt = 1.00f;
@@ -493,7 +493,7 @@ void CControl::Draw()
if ( m_state & STATE_OKAY )
{
- m_engine->SetTexture("button3.png");
+ m_engine->SetTexture("textures/interface/button3.png");
icon = 3; // yellow with green point pressed
}
@@ -508,19 +508,19 @@ void CControl::Draw()
if ( icon >= 192 )
{
icon -= 192;
- m_engine->SetTexture("text.png");
+ m_engine->SetTexture("textures/interface/text.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
}
else if ( icon >= 128 )
{
icon -= 128;
- m_engine->SetTexture("button3.png");
+ m_engine->SetTexture("textures/interface/button3.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
}
else if ( icon >= 64 )
{
icon -= 64;
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
}
else
@@ -753,7 +753,7 @@ void CControl::DrawWarning(Math::Point pos, Math::Point dim)
dp = 0.5f / 256.0f;
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f / 256.0f;
@@ -797,7 +797,7 @@ void CControl::DrawShadow(Math::Point pos, Math::Point dim, float deep)
dp = 0.5f/256.0f;
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState( Gfx::ENG_RSTATE_TTEXTURE_WHITE);
pos.x += deep * 0.010f * 0.75f;
diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp
index 891c1ab..aceb5b0 100644
--- a/src/ui/displayinfo.cpp
+++ b/src/ui/displayinfo.cpp
@@ -344,8 +344,6 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc
m_index = index;
m_bSoluce = bSoluce;
-//? CreateObjectsFile();
-
m_bEditLock = m_main->GetEditLock();
if ( m_bEditLock ) // edition running program?
{
@@ -937,284 +935,4 @@ CObject* CDisplayInfo::SearchToto()
return 0;
}
-
-// Creating the list of objects.
-
-struct ObjectList
-{
- int total;
- ObjectType type;
-};
-
-void ObjectAdd(ObjectList list[], ObjectType type)
-{
- int i;
-
- for ( i=0 ; i<200 ; i++ )
- {
- if ( list[i].total == 0 )
- {
- list[i].total ++;
- list[i].type = type;
- list[i+1].total = 0;
- return;
- }
- if ( list[i].type == type )
- {
- list[i].total ++;
- return;
- }
- }
-}
-
-void ObjectWrite(FILE* file, ObjectList list[], int i)
-{
- std::string line;
-
- if ( list[i].total < 10 )
- {
- line = StrUtils::Format("\\c; %dx \\n;\\l;", list[i].total);
- }
- else
- {
- line = StrUtils::Format("\\c;%dx \\n;\\l;", list[i].total);
- }
-
- std::string res;
- GetResource(RES_OBJECT, list[i].type, res);
- 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.
-
-void CDisplayInfo::CreateObjectsFile()
-{
- FILE* file;
- CObject* pObj;
- ObjectType type;
- ObjectList list[200];
- std::string line;
- int i;
- bool bRadar, bAtLeast;
-
- CInstanceManager* iMan = CInstanceManager::GetInstancePointer();
-
- file = fopen((std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + std::string("objects.txt")).c_str(), "w");
- if ( file == 0 ) return;
-
- list[0].total = 0; // empty list
- bRadar = false;
- for ( i=0 ; i<1000000 ; i++ )
- {
- pObj = static_cast<CObject*>(iMan->SearchInstance(CLASS_OBJECT, i));
- if ( pObj == 0 ) break;
-
- if ( !pObj->GetActif() ) continue;
- if ( !pObj->GetSelectable() ) continue;
- if ( pObj->GetProxyActivate() ) continue;
-
- type = pObj->GetType();
- if ( type == OBJECT_NULL ) continue;
- if ( type == OBJECT_FIX ) continue;
-
- ObjectAdd(list, type);
-
- if ( type == OBJECT_RADAR ) bRadar = true;
- }
-
- if ( bRadar )
- {
- GetResource(RES_TEXT, RT_SATCOM_LIST, line);
- fputs(line.c_str(), file);
- bAtLeast = false;
- for ( i=0 ; i<200 ; i++ )
- {
- if ( list[i].total == 0 ) break; // end of the list?
-
- if ( list[i].type == OBJECT_BASE ||
- list[i].type == OBJECT_HUMAN )
- {
- ObjectWrite(file, list, i);
- bAtLeast = true;
- }
- }
- if ( !bAtLeast )
- {
- GetResource(RES_TEXT, RT_SATCOM_NULL, line);
- fputs(line.c_str(), file);
- }
-
- fputs("\n", file);
- GetResource(RES_TEXT, RT_SATCOM_BOT, line);
- fputs(line.c_str(), file);
- bAtLeast = false;
- for ( i=0 ; i<200 ; i++ )
- {
- if ( list[i].total == 0 ) break; // end of the list?
-
- if ( list[i].type == OBJECT_MOBILEwt ||
- list[i].type == OBJECT_MOBILEtt ||
- list[i].type == OBJECT_MOBILEft ||
- list[i].type == OBJECT_MOBILEit ||
- list[i].type == OBJECT_MOBILEwa ||
- list[i].type == OBJECT_MOBILEta ||
- list[i].type == OBJECT_MOBILEfa ||
- list[i].type == OBJECT_MOBILEia ||
- list[i].type == OBJECT_MOBILEwc ||
- list[i].type == OBJECT_MOBILEtc ||
- list[i].type == OBJECT_MOBILEfc ||
- list[i].type == OBJECT_MOBILEic ||
- list[i].type == OBJECT_MOBILEwi ||
- list[i].type == OBJECT_MOBILEti ||
- list[i].type == OBJECT_MOBILEfi ||
- list[i].type == OBJECT_MOBILEii ||
- list[i].type == OBJECT_MOBILEws ||
- list[i].type == OBJECT_MOBILEts ||
- list[i].type == OBJECT_MOBILEfs ||
- list[i].type == OBJECT_MOBILEis ||
- list[i].type == OBJECT_MOBILErt ||
- list[i].type == OBJECT_MOBILErc ||
- list[i].type == OBJECT_MOBILErr ||
- list[i].type == OBJECT_MOBILErs ||
- list[i].type == OBJECT_MOBILEsa ||
- list[i].type == OBJECT_MOBILEtg ||
- list[i].type == OBJECT_MOBILEdr )
- {
- ObjectWrite(file, list, i);
- bAtLeast = true;
- }
- }
- if ( !bAtLeast )
- {
- GetResource(RES_TEXT, RT_SATCOM_NULL, line);
- fputs(line.c_str(), file);
- }
-
- fputs("\n", file);
- GetResource(RES_TEXT, RT_SATCOM_BUILDING, line);
- fputs(line.c_str(), file);
- bAtLeast = false;
- for ( i=0 ; i<200 ; i++ )
- {
- if ( list[i].total == 0 ) break; // end of the list?
-
- if ( list[i].type == OBJECT_DERRICK ||
- list[i].type == OBJECT_FACTORY ||
- list[i].type == OBJECT_STATION ||
- list[i].type == OBJECT_CONVERT ||
- list[i].type == OBJECT_REPAIR ||
- list[i].type == OBJECT_DESTROYER||
- list[i].type == OBJECT_TOWER ||
- list[i].type == OBJECT_NEST ||
- list[i].type == OBJECT_RESEARCH ||
- list[i].type == OBJECT_RADAR ||
- list[i].type == OBJECT_ENERGY ||
- list[i].type == OBJECT_LABO ||
- list[i].type == OBJECT_NUCLEAR ||
- list[i].type == OBJECT_START ||
- list[i].type == OBJECT_END ||
- list[i].type == OBJECT_INFO ||
- list[i].type == OBJECT_PARA ||
- list[i].type == OBJECT_TARGET1 ||
- list[i].type == OBJECT_TARGET2 ||
- list[i].type == OBJECT_SAFE ||
- list[i].type == OBJECT_HUSTON )
- {
- ObjectWrite(file, list, i);
- bAtLeast = true;
- }
- }
- if ( !bAtLeast )
- {
- GetResource(RES_TEXT, RT_SATCOM_NULL, line);
- fputs(line.c_str(), file);
- }
-
- fputs("\n", file);
- GetResource(RES_TEXT, RT_SATCOM_FRET, line);
- fputs(line.c_str(), file);
- bAtLeast = false;
- for ( i=0 ; i<200 ; i++ )
- {
- if ( list[i].total == 0 ) break; // end of the list?
-
- if ( list[i].type == OBJECT_STONE ||
- list[i].type == OBJECT_URANIUM ||
- list[i].type == OBJECT_METAL ||
- list[i].type == OBJECT_POWER ||
- list[i].type == OBJECT_ATOMIC ||
- list[i].type == OBJECT_BULLET ||
- list[i].type == OBJECT_BBOX ||
- list[i].type == OBJECT_TNT )
- {
- ObjectWrite(file, list, i);
- bAtLeast = true;
- }
- }
- if ( !bAtLeast )
- {
- GetResource(RES_TEXT, RT_SATCOM_NULL, line);
- fputs(line.c_str(), file);
- }
-
- fputs("\n", file);
- GetResource(RES_TEXT, RT_SATCOM_ALIEN, line);
- fputs(line.c_str(), file);
- bAtLeast = false;
- for ( i=0 ; i<200 ; i++ )
- {
- if ( list[i].total == 0 ) break; // end of the list?
-
- if ( list[i].type == OBJECT_MOTHER ||
- list[i].type == OBJECT_ANT ||
- list[i].type == OBJECT_BEE ||
- list[i].type == OBJECT_WORM ||
- list[i].type == OBJECT_SPIDER )
- {
- ObjectWrite(file, list, i);
- bAtLeast = true;
- }
- }
- if ( !bAtLeast )
- {
- GetResource(RES_TEXT, RT_SATCOM_NULL, line);
- fputs(line.c_str(), file);
- }
- }
- else
- {
- GetResource(RES_TEXT, RT_SATCOM_ERROR1, line);
- fputs(line.c_str(), file);
- GetResource(RES_TEXT, RT_SATCOM_ERROR2, line);
- fputs(line.c_str(), file);
- }
-
- fputs("\n", file);
-
- fclose(file);
-}
-
-
}
-
diff --git a/src/ui/displayinfo.h b/src/ui/displayinfo.h
index 47bdec9..f820cd6 100644
--- a/src/ui/displayinfo.h
+++ b/src/ui/displayinfo.h
@@ -68,7 +68,6 @@ protected:
void UpdateCopyButton();
void ViewDisplayInfo();
CObject* SearchToto();
- void CreateObjectsFile();
protected:
Gfx::CEngine* m_engine;
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index 36bfd5a..b6e6bbf 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -21,11 +21,18 @@
#include "ui/edit.h"
#include "app/app.h"
-#include "app/gamedata.h"
#include "clipboard/clipboard.h"
+#include "object/robotmain.h"
+
+#include "object/level/parserparam.h"
+
+#include "common/resources/inputstream.h"
+#include "common/resources/outputstream.h"
+
#include <string.h>
+#include <boost/algorithm/string.hpp>
namespace Ui {
@@ -779,16 +786,9 @@ void CEdit::HyperJump(std::string name, std::string marker)
sMarker = marker;
-//? sprintf(filename, "help\\%s.txt", name);
-
- if ( name[0] == '%' )
- {
- filename = GetProfile().GetUserBasedPath(name, "") + ".txt";
- }
- else
- {
- filename = std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + "/" + name + std::string(".txt");
- }
+ filename = name + std::string(".txt");
+ filename = CLevelParserParam::InjectLevelDir(filename, "help/%lng%");
+ boost::replace_all(filename, "\\", "/"); //TODO: Fix this in files
if ( ReadText(filename) )
{
@@ -1142,7 +1142,9 @@ void CEdit::DrawImage(Math::Point pos, std::string name, float width,
float dp;
std::string filename;
- filename = GetProfile().GetUserBasedPath(name, "../icons") + ".png";
+ filename = name + ".png";
+ filename = CLevelParserParam::InjectLevelDir(filename, "icons");
+ boost::replace_all(filename, "\\", "/"); //TODO: Fix this in files
m_engine->SetTexture(filename);
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
@@ -1172,7 +1174,7 @@ void CEdit::DrawBack(Math::Point pos, Math::Point dim)
if ( m_bGeneric ) return;
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
if ( m_bMulti )
@@ -1222,7 +1224,7 @@ void CEdit::DrawPart(Math::Point pos, Math::Point dim, int icon)
Math::Point uv1, uv2;
float dp;
- m_engine->SetTexture("text.png");
+ m_engine->SetTexture("textures/interface/text.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = (16.0f/256.0f)*(icon%16);
@@ -1420,7 +1422,7 @@ void CEdit::FreeImage()
for (int i = 0 ; i < m_imageTotal; i++ )
{
- filename = GetProfile().GetUserBasedPath(m_image[i].name, "../icons") + ".png";
+ filename = m_image[i].name + ".png";
m_engine->DeleteTexture(filename);
}
}
@@ -1430,7 +1432,9 @@ void CEdit::FreeImage()
void CEdit::LoadImage(std::string name)
{
std::string filename;
- filename = GetProfile().GetUserBasedPath(name, "../icons") + ".png";
+ filename = name + ".png";
+ filename = CLevelParserParam::InjectLevelDir(filename, "icons");
+ boost::replace_all(filename, "\\", "/"); //TODO: Fix this in files
m_engine->LoadTexture(filename);
}
@@ -1438,7 +1442,6 @@ void CEdit::LoadImage(std::string name)
bool CEdit::ReadText(std::string filename, int addSize)
{
- FILE *file = NULL;
char *buffer;
int len, i, j, n, font, iIndex, iLines, iCount, iLink, res;
char iName[50];
@@ -1447,27 +1450,18 @@ bool CEdit::ReadText(std::string filename, int addSize)
InputSlot slot;
bool bInSoluce, bBOL;
- if ( filename[0] == 0 ) return false;
-
- boost::replace_all(filename, "\\", "/");
-
- /* This is ugly but doesn't require many changes in code. If file doesn't
- exists it's posible filename is absolute not full path */
- std::string path = filename;
- if (!fs::exists(path))
+ if ( filename == "" ) return false;
+
+ CInputStream stream;
+ stream.open(filename);
+
+ if (!stream.is_open())
{
- path = CGameData::GetInstancePointer()->GetDataPath(filename);
- }
-
- file = fopen(fs::path(path).make_preferred().string().c_str(), "rb");
- if ( file == NULL ) {
- CLogger::GetInstancePointer()->Error("Unable to read text from file \"%s\"\n", path.c_str());
+ CLogger::GetInstancePointer()->Error("Failed to load text file %s\n", filename.c_str());
return false;
}
- fseek(file, 0, SEEK_END);
- len = ftell(file);
- fseek(file, 0, SEEK_SET);
+ len = stream.size();
m_maxChar = len+addSize+100;
m_len = len;
@@ -1484,7 +1478,7 @@ bool CEdit::ReadText(std::string filename, int addSize)
buffer = new char[m_maxChar+1];
memset(buffer, 0, m_maxChar+1);
- fread(buffer, 1, len, file);
+ stream.read(buffer, len);
m_format.clear();
m_format.reserve(m_maxChar+1);
@@ -1493,7 +1487,7 @@ bool CEdit::ReadText(std::string filename, int addSize)
m_format.push_back(0);
}
- fclose(file);
+ stream.close();
bInSoluce = false;
font = m_fontType;
@@ -1887,14 +1881,19 @@ bool CEdit::ReadText(std::string filename, int addSize)
bool CEdit::WriteText(std::string filename)
{
- FILE* file;
char buffer[1000+20];
int i, j, k, n;
float iDim = 0.0f;
if ( filename[0] == 0 ) return false;
- file = fopen(filename.c_str(), "wb");
- if ( file == NULL ) return false;
+
+ COutputStream stream;
+ stream.open(filename);
+
+ if (!stream.is_open())
+ {
+ return false;
+ }
if ( m_bAutoIndent )
{
@@ -1925,7 +1924,7 @@ bool CEdit::WriteText(std::string filename)
if ( j >= 1000-1 )
{
- fwrite(buffer, 1, j, file);
+ stream.write(buffer, j);
j = 0;
}
@@ -1933,10 +1932,10 @@ bool CEdit::WriteText(std::string filename)
}
if ( j > 0 )
{
- fwrite(buffer, 1, j, file);
+ stream.write(buffer, j);
}
- fclose(file);
+ stream.close();
if ( m_bAutoIndent )
{
diff --git a/src/ui/gauge.cpp b/src/ui/gauge.cpp
index 4bc9d7d..92f4d7c 100644
--- a/src/ui/gauge.cpp
+++ b/src/ui/gauge.cpp
@@ -77,7 +77,7 @@ void CGauge::Draw()
if ( (m_state & STATE_VISIBLE) == 0 ) return;
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
dp = 0.5f/256.0f;
diff --git a/src/ui/group.cpp b/src/ui/group.cpp
index 6ca6067..e924ea6 100644
--- a/src/ui/group.cpp
+++ b/src/ui/group.cpp
@@ -90,7 +90,7 @@ void CGroup::Draw()
if ( m_icon == 0 ) // hollow frame?
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 160.0f / 256.0f;
uv1.y = 192.0f / 256.0f; // u-v texture
@@ -106,7 +106,7 @@ void CGroup::Draw()
}
if ( m_icon == 1 ) // orange solid opaque?
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 104.0f / 256.0f;
uv1.y = 48.0f / 256.0f;
@@ -120,7 +120,7 @@ void CGroup::Draw()
}
if ( m_icon == 2 ) // orange degrade -> transparent?
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 112.0f / 256.0f;
uv1.y = 48.0f / 256.0f;
@@ -134,7 +134,7 @@ void CGroup::Draw()
}
if ( m_icon == 3 ) // transparent gradient -> gray?
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 120.0f / 256.0f;
uv1.y = 48.0f / 256.0f;
@@ -148,7 +148,7 @@ void CGroup::Draw()
}
if ( m_icon == 4 ) // degrade blue corner?
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 192.0f / 256.0f;
uv1.y = 128.0f / 256.0f;
@@ -162,7 +162,7 @@ void CGroup::Draw()
}
if ( m_icon == 5 ) // degrade orange corner?
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 224.0f / 256.0f;
uv1.y = 128.0f / 256.0f;
@@ -176,7 +176,7 @@ void CGroup::Draw()
}
if ( m_icon == 6 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 0.0f / 256.0f; // brown transparent
uv1.y = 75.0f / 256.0f;
@@ -192,7 +192,7 @@ void CGroup::Draw()
}
if ( m_icon == 7 )
{
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f / 256.0f;
uv1.y = 0.0f / 256.0f;
@@ -206,7 +206,7 @@ void CGroup::Draw()
}
if ( m_icon == 8 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f / 256.0f; // green transparent
uv1.y = 160.0f / 256.0f;
@@ -220,7 +220,7 @@ void CGroup::Draw()
}
if ( m_icon == 9 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f / 256.0f; // red transparent
uv1.y = 176.0f/256.0f;
@@ -234,7 +234,7 @@ void CGroup::Draw()
}
if ( m_icon == 10 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f / 256.0f; // blue transparent
uv1.y = 192.0f / 256.0f;
@@ -248,7 +248,7 @@ void CGroup::Draw()
}
if ( m_icon == 11 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f / 256.0f; // yellow transparent
uv1.y = 224.0f / 256.0f;
@@ -265,7 +265,7 @@ void CGroup::Draw()
dim.x = m_dim.x / 2.0f;
dim.y = m_dim.y / 2.0f;
- m_engine->SetTexture("mouse.png");
+ m_engine->SetTexture("textures/interface/mouse.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/300.0f;
pos.y = m_pos.y+m_dim.y/300.0f+dim.y;
@@ -304,7 +304,7 @@ void CGroup::Draw()
}
if ( m_icon == 13 ) // corner upper / left?
{
- m_engine->SetTexture("mouse.png");
+ m_engine->SetTexture("textures/interface/mouse.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/150.0f;
pos.y = m_pos.y+m_dim.y/150.0f;
@@ -325,7 +325,7 @@ void CGroup::Draw()
}
if ( m_icon == 14 ) // corner upper / right?
{
- m_engine->SetTexture("mouse.png");
+ m_engine->SetTexture("textures/interface/mouse.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/150.0f;
pos.y = m_pos.y+m_dim.y/150.0f;
@@ -346,7 +346,7 @@ void CGroup::Draw()
}
if ( m_icon == 15 ) // corner lower / left?
{
- m_engine->SetTexture("mouse.png");
+ m_engine->SetTexture("textures/interface/mouse.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/150.0f;
pos.y = m_pos.y+m_dim.y/150.0f;
@@ -367,7 +367,7 @@ void CGroup::Draw()
}
if ( m_icon == 16 ) // corner lower / left?
{
- m_engine->SetTexture("mouse.png");
+ m_engine->SetTexture("textures/interface/mouse.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/150.0f;
pos.y = m_pos.y+m_dim.y/150.0f;
@@ -388,7 +388,7 @@ void CGroup::Draw()
}
if ( m_icon == 17 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f / 256.0f; // blue frame
uv1.y = 75.0f / 256.0f;
@@ -404,7 +404,7 @@ void CGroup::Draw()
}
if ( m_icon == 18 ) // arrow> for SatCom?
{
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 0.0f / 256.0f; // >
uv1.y = 192.0f / 256.0f;
@@ -418,7 +418,7 @@ void CGroup::Draw()
}
if ( m_icon == 19 ) // SatCom symbol?
{
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 224.0f / 256.0f; // SatCom symbol
uv1.y = 224.0f / 256.0f;
@@ -432,7 +432,7 @@ void CGroup::Draw()
}
if ( m_icon == 20 ) // solid blue background?
{
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 224.0f / 256.0f;
uv1.y = 32.0f / 256.0f;
@@ -446,7 +446,7 @@ void CGroup::Draw()
}
if ( m_icon == 21 ) // stand-by symbol?
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 160.0f / 256.0f;
uv1.y = 32.0f / 256.0f;
@@ -460,7 +460,7 @@ void CGroup::Draw()
}
if ( m_icon == 22 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f / 256.0f; // opaque yellow
uv1.y = 224.0f / 256.0f;
@@ -477,7 +477,7 @@ void CGroup::Draw()
if ( m_icon == 23 )
{
- m_engine->SetTexture("button3.png");
+ m_engine->SetTexture("textures/interface/button3.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f / 256.0f; // yellow
uv1.y = 192.0f / 256.0f;
@@ -493,7 +493,7 @@ void CGroup::Draw()
}
if ( m_icon == 24 )
{
- m_engine->SetTexture("button3.png");
+ m_engine->SetTexture("textures/interface/button3.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 80.0f / 256.0f; // orange
uv1.y = 192.0f / 256.0f;
@@ -509,7 +509,7 @@ void CGroup::Draw()
}
if ( m_icon == 25 )
{
- m_engine->SetTexture("button3.png");
+ m_engine->SetTexture("textures/interface/button3.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f / 256.0f; // orange
uv1.y = 208.0f / 256.0f;
@@ -525,7 +525,7 @@ void CGroup::Draw()
}
if ( m_icon == 26 )
{
- m_engine->SetTexture("button3.png");
+ m_engine->SetTexture("textures/interface/button3.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 80.0f / 256.0f; // red
uv1.y = 208.0f / 256.0f;
@@ -541,7 +541,7 @@ void CGroup::Draw()
}
if ( m_icon == 27 )
{
- m_engine->SetTexture("button3.png");
+ m_engine->SetTexture("textures/interface/button3.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 32.0f / 256.0f;
uv1.y = 0.0f / 256.0f;
@@ -559,7 +559,7 @@ void CGroup::Draw()
pos = m_pos;
dim = m_dim;
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 32.0f / 256.0f;
uv1.y = 32.0f / 256.0f;
@@ -571,7 +571,7 @@ void CGroup::Draw()
uv2.y -= dp;
DrawIcon(pos, dim, uv1, uv2);
- m_engine->SetTexture("button3.png");
+ m_engine->SetTexture("textures/interface/button3.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
pos.x += 8.0f / 640.0f;
pos.y += 8.0f / 480.0f;
diff --git a/src/ui/image.cpp b/src/ui/image.cpp
index b4c19f8..89e1fd2 100644
--- a/src/ui/image.cpp
+++ b/src/ui/image.cpp
@@ -112,7 +112,7 @@ void CImage::Draw()
if ( m_icon == 0 ) // hollow frame?
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 160.0f / 256.0f;
uv1.y = 192.0f / 256.0f; // u-v texture
@@ -129,8 +129,10 @@ void CImage::Draw()
if ( m_filename[0] != 0 ) // displays an image?
{
- m_engine->LoadTexture(m_filename);
- m_engine->SetTexture(m_filename);
+ std::string texFilename = m_filename;
+ texFilename = "textures/"+texFilename;
+ m_engine->LoadTexture(texFilename.c_str());
+ m_engine->SetTexture(texFilename);
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
pos = m_pos;
dim = m_dim;
diff --git a/src/ui/key.cpp b/src/ui/key.cpp
index ecc000c..fd9a77f 100644
--- a/src/ui/key.cpp
+++ b/src/ui/key.cpp
@@ -138,7 +138,7 @@ void CKey::Draw()
DrawShadow(m_pos, m_dim);
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); // was D3DSTATENORMAL
float zoomExt = 1.00f;
diff --git a/src/ui/list.cpp b/src/ui/list.cpp
index 16f0457..9611533 100644
--- a/src/ui/list.cpp
+++ b/src/ui/list.cpp
@@ -388,7 +388,7 @@ void CList::Draw()
if (m_icon == 0)
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f / 256.0f;
@@ -398,7 +398,7 @@ void CList::Draw()
}
else
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 132.0f / 256.0f;
@@ -434,7 +434,7 @@ void CList::Draw()
dim.y *= 0.4f;
pos.y -= dim.y;
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); // was D3DSTATETTw
uv1.x = 120.0f / 256.0f;
uv1.y = 64.0f / 256.0f;
@@ -509,7 +509,7 @@ void CList::Draw()
if ( m_check[i + m_firstLine] )
{
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f / 256.0f;
uv1.y = 0.0f / 256.0f;
@@ -534,7 +534,7 @@ void CList::Draw()
}
else
{
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); // was D3DSTATETTw
if ( i + m_firstLine == m_selectLine )
{
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index c0656a6..dec4586 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -21,7 +21,6 @@
#include "ui/maindialog.h"
#include "app/app.h"
-#include "app/gamedata.h"
#include "app/system.h"
#include "common/config.h"
@@ -33,6 +32,12 @@
#include "common/restext.h"
#include "common/stringutils.h"
+#include "common/resources/resourcemanager.h"
+#include "common/resources/inputstream.h"
+#include "common/resources/outputstream.h"
+
+#include "object/level/parser.h"
+
#include "object/robotmain.h"
#include "script/cmdtoken.h"
@@ -176,17 +181,8 @@ CMainDialog::CMainDialog()
m_partiTime[i] = 0.0f;
}
-
- m_sceneDir = "levels";
-
- #if DEV_BUILD
m_savegameDir = "savegame";
- #else
- m_savegameDir = GetSystemUtils()->GetSavegameDirectoryLocation();
- #endif
-
m_publicDir = "program";
- m_userDir = "user";
m_filesDir = m_savegameDir;
m_setupFull = m_app->GetVideoConfig().fullScreen;
@@ -318,7 +314,6 @@ void CMainDialog::ChangePhase(Phase phase)
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_QUIT);
pb->SetState(STATE_SHADOW);
- #if DEV_BUILD
if ( m_accessEnable && m_accessUser )
{
pos.x = 447.0f/640.0f;
@@ -327,7 +322,6 @@ void CMainDialog::ChangePhase(Phase phase)
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_USER);
pb->SetState(STATE_SHADOW);
}
- #endif
/*pos.x = 139.0f/640.0f;
pos.y = 313.0f/480.0f;
@@ -346,7 +340,7 @@ void CMainDialog::ChangePhase(Phase phase)
pl->SetFontType(Gfx::FONT_COURIER);
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
- m_engine->SetBackground("interface.png",
+ m_engine->SetBackground("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),
@@ -453,7 +447,7 @@ void CMainDialog::ChangePhase(Phase phase)
UpdateNameControl();
UpdateNameFace();
- m_engine->SetBackground("interface.png",
+ m_engine->SetBackground("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),
@@ -716,16 +710,16 @@ void CMainDialog::ChangePhase(Phase phase)
if ( m_phase == PHASE_FREE )
{
- strcpy(m_sceneName, "scene");
+ strcpy(m_sceneName, "missions");
ReadGamerInfo();
m_accessChap = GetChapPassed();
}
- if ( m_phase == PHASE_TRAINER ) strcpy(m_sceneName, "train");
- if ( m_phase == PHASE_DEFI ) strcpy(m_sceneName, "defi" );
- if ( m_phase == PHASE_MISSION ) strcpy(m_sceneName, "scene");
- if ( m_phase == PHASE_FREE ) strcpy(m_sceneName, "free");
- if ( m_phase == PHASE_USER ) strcpy(m_sceneName, "user");
+ if ( m_phase == PHASE_TRAINER ) strcpy(m_sceneName, "exercises");
+ if ( m_phase == PHASE_DEFI ) strcpy(m_sceneName, "challenges" );
+ if ( m_phase == PHASE_MISSION ) strcpy(m_sceneName, "missions");
+ if ( m_phase == PHASE_FREE ) strcpy(m_sceneName, "freemissions");
+ if ( m_phase == PHASE_USER ) strcpy(m_sceneName, "custom");
ReadGamerInfo();
@@ -878,7 +872,7 @@ void CMainDialog::ChangePhase(Phase phase)
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_BACK);
pb->SetState(STATE_SHADOW);
- m_engine->SetBackground("interface.png",
+ m_engine->SetBackground("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),
@@ -1003,7 +997,7 @@ void CMainDialog::ChangePhase(Phase phase)
if ( !m_bSimulSetup )
{
- m_engine->SetBackground("interface.png",
+ m_engine->SetBackground("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),
@@ -1492,7 +1486,7 @@ void CMainDialog::ChangePhase(Phase phase)
if ( m_phase == PHASE_READ )
{
- m_engine->SetBackground("interface.png",
+ m_engine->SetBackground("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),
@@ -1539,7 +1533,7 @@ void CMainDialog::ChangePhase(Phase phase)
pl->SetFontSize(12.0f);
pl->SetTextAlign(Gfx::TEXT_ALIGN_CENTER);
- m_engine->SetBackground("interface.png",
+ m_engine->SetBackground("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),
@@ -1561,7 +1555,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("ppc.png",
+ m_engine->SetBackground("interface/ppc.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),
@@ -1580,7 +1574,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("colobot.png",
+ m_engine->SetBackground("interface/colobot.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),
@@ -1599,7 +1593,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("epsitec.png",
+ m_engine->SetBackground("interface/epsitec.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),
@@ -1665,7 +1659,7 @@ void CMainDialog::ChangePhase(Phase phase)
pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT);
pb->SetState(STATE_SHADOW);
- m_engine->SetBackground("generico.png",
+ m_engine->SetBackground("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),
@@ -3271,40 +3265,15 @@ void CMainDialog::NiceParticle(Math::Point mouse, bool bPress)
-// Specifies the special user folder if needed.
-
-void CMainDialog::SetUserDir(char *base, int rank)
-{
- std::string dir;
-
- if ( strcmp(base, "user") == 0 && rank >= 100 )
- {
- dir = m_userDir + "/" + m_userList.at(rank/100-1);
- GetProfile().SetUserDir(dir);
- }
- else
- {
- GetProfile().SetUserDir("");
- }
-}
-
// Builds the file name of a mission.
-void CMainDialog::BuildSceneName(std::string &filename, char *base, int rank)
+void CMainDialog::BuildSceneName(std::string &filename, char *base, int rank, bool sceneFile)
{
- std::ostringstream rankStream;
- if ( strcmp(base, "user") == 0 )
- {
- //TODO: Change this to point user dir according to operating system
- rankStream << std::setfill('0') << std::setw(2) << rank%100;
- filename = m_userDir + "/" + m_userList[rank/100-1] + "/" + rankStream.str() + ".txt";
- }
- else
- {
- rankStream << std::setfill('0') << std::setw(3) << rank;
- filename = base + rankStream.str() + ".txt";
- filename = CGameData::GetInstancePointer()->GetFilePath(DIR_LEVEL, filename);
- }
+ //TODO: Support for more than 9 chapters
+ int chapter = rank/100;
+ int new_rank = rank%100;
+
+ filename = CLevelParser::BuildSceneName(std::string(base), chapter, new_rank, sceneFile);
}
// Built the default descriptive name of a mission.
@@ -3556,7 +3525,7 @@ void CMainDialog::NameCreate()
char c;
int len, i, j;
- GetLogger()->Debug("Creating new player\n");
+ GetLogger()->Info("Creating new player\n");
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) return;
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
@@ -3593,13 +3562,16 @@ void CMainDialog::NameCreate()
return;
}
- // TODO: _mkdir(m_savegameDir); // if does not exist yet!
-
+ if(!CResourceManager::DirectoryExists(m_savegameDir))
+ CResourceManager::CreateDirectory(m_savegameDir);
+
dir = m_savegameDir + "/" + name;
if (!fs::exists(dir))
{
fs::create_directories(dir);
+ if(!CResourceManager::DirectoryExists(dir))
+ CResourceManager::CreateDirectory(dir);
}
else
{
@@ -3998,7 +3970,6 @@ bool CMainDialog::IsIOReadScene()
void CMainDialog::IOReadName()
{
- FILE* file;
CWindow* pw;
CEdit* pe;
std::string filename;
@@ -4020,10 +3991,12 @@ void CMainDialog::IOReadName()
sprintf(op, "Title.E");
sprintf(op_i18n, "Title.%c", m_app->GetLanguageChar() );
- file = fopen(filename.c_str(), "r");
- if ( file != NULL )
+ CInputStream stream;
+ stream.open(filename);
+
+ if (stream.is_open())
{
- while ( fgets(line, 500, file) != NULL )
+ while (stream.getline(line, 500))
{
for ( i=0 ; i<500 ; i++ )
{
@@ -4045,7 +4018,7 @@ void CMainDialog::IOReadName()
break;
}
}
- fclose(file);
+ stream.close();
}
time(&now);
@@ -4390,10 +4363,9 @@ void CMainDialog::AllMissionUpdate()
void CMainDialog::UpdateSceneChap(int &chap)
{
- FILE* file = NULL;
CWindow* pw;
CList* pl;
- //struct _finddata_t fileBuffer;
+
std::string fileName;
char op[100];
char op_i18n[100];
@@ -4417,60 +4389,25 @@ void CMainDialog::UpdateSceneChap(int &chap)
if ( m_phase == PHASE_USER )
{
j = 0;
- fs::directory_iterator dirIt(m_savegameDir), dirEndIt;
- m_userList.clear();
-
- for (; dirIt != dirEndIt; ++dirIt)
- {
- const fs::path& p = *dirIt;
- if (fs::is_directory(p))
- {
- m_userList.push_back(p.leaf().string());
- }
- }
+ auto userLevelDirs = CResourceManager::ListDirectories("levels/custom/");
+ std::sort(userLevelDirs.begin(), userLevelDirs.end());
+ m_userList = userLevelDirs;
m_userTotal = m_userList.size();
for ( j=0 ; j<m_userTotal ; j++ )
{
- BuildSceneName(fileName, m_sceneName, (j+1)*100);
- file = fopen(fileName.c_str(), "r");
- if ( file == NULL )
- {
- strcpy(name, m_userList[j].c_str());
+ try {
+ CLevelParser* level = new CLevelParser("custom", j+1, 0);
+ level->Load();
+ pl->SetItemName(j, level->Get("Title")->GetParam("text")->AsString().c_str());
+ pl->SetEnable(j, true);
+ delete level;
}
- else
+ catch(CLevelParserException& e)
{
- BuildResumeName(name, m_sceneName, j+1); // default name
- sprintf(op, "Title.E");
- sprintf(op_i18n, "Title.%c", m_app->GetLanguageChar());
-
- while ( fgets(line, 500, file) != NULL )
- {
- for ( i=0 ; i<500 ; i++ )
- {
- if ( line[i] == '\t' ) line[i] = ' '; // replaces tab by space
- if ( line[i] == '/' && line[i+1] == '/' )
- {
- line[i] = 0;
- break;
- }
- }
-
- if ( Cmd(line, op) )
- {
- OpString(line, "text", name);
- }
- if ( Cmd(line, op_i18n) )
- {
- OpString(line, "text", name);
- break;
- }
- }
- fclose(file);
+ pl->SetItemName(j, (std::string("[ERROR]: ")+e.what()).c_str());
+ pl->SetEnable(j, false);
}
-
- pl->SetItemName(j, name);
- pl->SetEnable(j, true);
}
}
else
@@ -4478,14 +4415,15 @@ void CMainDialog::UpdateSceneChap(int &chap)
for ( j=0 ; j<9 ; j++ )
{
BuildSceneName(fileName, m_sceneName, (j+1)*100);
- file = fopen(fileName.c_str(), "r");
- if ( file == NULL ) break;
+ CInputStream stream;
+ stream.open(fileName);
+ if (!stream.is_open()) break;
BuildResumeName(name, m_sceneName, j+1); // default name
sprintf(op, "Title.E");
sprintf(op_i18n, "Title.%c", m_app->GetLanguageChar());
- while ( fgets(line, 500, file) != NULL )
+ while (stream.getline(line, 500))
{
for ( i=0 ; i<500 ; i++ )
{
@@ -4507,7 +4445,7 @@ void CMainDialog::UpdateSceneChap(int &chap)
break;
}
}
- fclose(file);
+ stream.close();
bPassed = GetGamerInfoPassed((j+1)*100);
sprintf(line, "%d: %s", j+1, name);
@@ -4539,7 +4477,6 @@ void CMainDialog::UpdateSceneChap(int &chap)
void CMainDialog::UpdateSceneList(int chap, int &sel)
{
- FILE* file = NULL;
CWindow* pw;
CList* pl;
std::string fileName;
@@ -4561,18 +4498,22 @@ void CMainDialog::UpdateSceneList(int chap, int &sel)
if ( pl == 0 ) return;
pl->Flush();
+
+ if(chap < 0) return;
for ( j=0 ; j<99 ; j++ )
{
BuildSceneName(fileName, m_sceneName, (chap+1)*100+(j+1));
- file = fopen(fileName.c_str(), "r");
- if ( file == NULL ) break;
+
+ CInputStream stream;
+ stream.open(fileName);
+ if (!stream.is_open()) break;
BuildResumeName(name, m_sceneName, j+1); // default name
sprintf(op, "Title.E");
sprintf(op_i18n, "Title.%c", m_app->GetLanguageChar());
- while ( fgets(line, 500, file) != NULL )
+ while (stream.getline(line, 500))
{
for ( i=0 ; i<500 ; i++ )
{
@@ -4594,7 +4535,7 @@ void CMainDialog::UpdateSceneList(int chap, int &sel)
break;
}
}
- fclose(file);
+ stream.close();
bPassed = GetGamerInfoPassed((chap+1)*100+(j+1));
sprintf(line, "%d: %s", j+1, name);
@@ -4609,6 +4550,7 @@ void CMainDialog::UpdateSceneList(int chap, int &sel)
}
}
+ /* TODO: ?????
BuildSceneName(fileName, m_sceneName, (chap+1)*100+(j+1));
file = fopen(fileName.c_str(), "r");
if ( file == NULL )
@@ -4619,7 +4561,8 @@ void CMainDialog::UpdateSceneList(int chap, int &sel)
{
m_maxList = j+1; // this is not the last!
fclose(file);
- }
+ }*/
+ m_maxList = j;
if ( sel > j-1 ) sel = j-1;
@@ -4669,16 +4612,11 @@ void CMainDialog::ShowSoluceUpdate()
void CMainDialog::UpdateSceneResume(int rank)
{
- FILE* file = NULL;
CWindow* pw;
CEdit* pe;
CCheck* pc;
std::string fileName;
- char op[100];
- char op_i18n[100];
- char line[500];
- char name[500];
- int i, numTry;
+ int numTry;
bool bPassed, bVisible;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
@@ -4704,43 +4642,18 @@ void CMainDialog::UpdateSceneResume(int rank)
m_bSceneSoluce = false;
}
}
-
- BuildSceneName(fileName, m_sceneName, rank);
- sprintf(op, "Resume.E");
- sprintf(op_i18n, "Resume.%c", m_app->GetLanguageChar());
-
- file = fopen(fileName.c_str(), "r");
- if ( file == NULL ) return;
-
- name[0] = 0;
- while ( fgets(line, 500, file) != NULL )
+
+ if(rank<100) return;
+
+ try {
+ CLevelParser* level = new CLevelParser(m_sceneName, rank/100, rank%100);
+ level->Load();
+ pe->SetText(level->Get("Resume")->GetParam("text")->AsString().c_str());
+ }
+ catch(CLevelParserException& e)
{
- for ( i=0 ; i<500 ; i++ )
- {
- if (line[i] == 0)
- break;
-
- if ( line[i] == '\t' ) line[i] = ' '; // replaces tab by space
- if ( line[i] == '/' && line[i+1] == '/' )
- {
- line[i] = 0;
- break;
- }
- }
-
- if ( Cmd(line, op) )
- {
- OpString(line, "text", name);
- }
- if ( Cmd(line, op_i18n) )
- {
- OpString(line, "text", name);
- break;
- }
+ pe->SetText((std::string("[ERROR]: ")+e.what()).c_str());
}
- fclose(file);
-
- pe->SetText(name);
}
// Updates the list of modes.
@@ -5121,10 +5034,8 @@ void CMainDialog::ChangeSetupButtons()
void CMainDialog::SetupMemorize()
{
- GetProfile().SetStringProperty("Directory", "scene", m_sceneDir);
GetProfile().SetStringProperty("Directory", "savegame", m_savegameDir);
GetProfile().SetStringProperty("Directory", "public", m_publicDir);
- GetProfile().SetStringProperty("Directory", "user", m_userDir);
GetProfile().SetStringProperty("Directory", "files", m_filesDir);
GetProfile().SetIntProperty("Setup", "Tooltips", m_bTooltip);
GetProfile().SetIntProperty("Setup", "InterfaceGlint", m_bGlint);
@@ -5200,11 +5111,6 @@ void CMainDialog::SetupRecall()
int iValue;
std::string key;
- if ( GetProfile().GetStringProperty("Directory", "scene", key) )
- {
- m_sceneDir = key;
- }
-
if ( GetProfile().GetStringProperty("Directory", "savegame", key) )
{
m_savegameDir = key;
@@ -5215,11 +5121,6 @@ void CMainDialog::SetupRecall()
m_publicDir = key;
}
- if ( GetProfile().GetStringProperty("Directory", "user", key) )
- {
- m_userDir = key;
- }
-
if ( GetProfile().GetStringProperty("Directory", "files", key) )
{
m_filesDir = key;
@@ -5944,7 +5845,6 @@ void CMainDialog::FrameDialog(float rTime)
void CMainDialog::StopDialog()
{
CWindow* pw;
- CButton* pb;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
@@ -6414,6 +6314,11 @@ bool CMainDialog::NextMission()
return true;
}
+std::string& CMainDialog::GetUserLevelName(int id)
+{
+ return m_userList[id-1];
+}
+
} // namespace Ui
diff --git a/src/ui/maindialog.h b/src/ui/maindialog.h
index 0cf8db4..390aa31 100644
--- a/src/ui/maindialog.h
+++ b/src/ui/maindialog.h
@@ -101,8 +101,7 @@ public:
bool GetNiceReset();
bool GetHimselfDamage();
- void SetUserDir(char *base, int rank);
- void BuildSceneName(std::string &filename, char *base, int rank);
+ void BuildSceneName(std::string &filename, char *base, int rank, bool sceneFile = true);
void BuildResumeName(char *filename, char *base, int rank);
std::string & GetFilesDir();
@@ -143,6 +142,8 @@ public:
void AllMissionUpdate();
void ShowSoluceUpdate();
+
+ std::string& GetUserLevelName(int id);
protected:
void GlintMove();
@@ -202,10 +203,8 @@ protected:
int m_persoTab; // perso: tab selected
float m_persoAngle; // perso: angle of presentation
- std::string m_sceneDir; // scene folder
std::string m_savegameDir; // savegame folder
std::string m_publicDir; // program folder
- std::string m_userDir; // user folder
std::string m_filesDir; // case files
int m_index; // 0..4
diff --git a/src/ui/map.cpp b/src/ui/map.cpp
index 89c3397..f3f569a 100644
--- a/src/ui/map.cpp
+++ b/src/ui/map.cpp
@@ -324,7 +324,7 @@ void CMap::Draw()
m_offset = AdjustOffset(m_map[MAPMAXOBJECT - 1].pos);
if ( m_fixImage[0] == 0 ) { // drawing of the relief?
- m_engine->SetTexture("map.png");
+ m_engine->SetTexture("textures/interface/map.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.5f + (m_offset.x - (m_half / m_zoom)) / (m_half * 2.0f);
uv1.y = 0.5f - (m_offset.y + (m_half / m_zoom)) / (m_half * 2.0f);
@@ -332,8 +332,10 @@ void CMap::Draw()
uv2.y = 0.5f - (m_offset.y - (m_half / m_zoom)) / (m_half * 2.0f);
DrawVertex(uv1, uv2, 0.97f); // drawing the map
} else { // still image?
- m_engine->LoadTexture(m_fixImage);
- m_engine->SetTexture(m_fixImage);
+ std::string texFilename = m_fixImage;
+ texFilename = "textures/"+texFilename;
+ m_engine->LoadTexture(texFilename.c_str());
+ m_engine->SetTexture(texFilename.c_str());
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f;
uv1.y = 0.0f;
@@ -471,7 +473,7 @@ void CMap::DrawFocus(Math::Point pos, float dir, ObjectType type, MapColor color
uv2.x = 126.0f/256.0f;
uv2.y = 255.0f/256.0f;
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
bEnding = false;
@@ -531,7 +533,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
return; // flashes
}
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
if ( bUp )
{
@@ -674,7 +676,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
{
if ( bSelect )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
if ( m_bToy )
{
@@ -700,7 +702,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
{
if ( m_bRadar )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 64.5f/256.0f; // blue triangle
uv1.y = 240.5f/256.0f;
@@ -720,7 +722,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
if ( color == MAPCOLOR_WAYPOINTb )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 192.5f/256.0f; // blue cross
uv1.y = 240.5f/256.0f;
@@ -730,7 +732,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
}
if ( color == MAPCOLOR_WAYPOINTr )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 208.5f/256.0f; // red cross
uv1.y = 240.5f/256.0f;
@@ -740,7 +742,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
}
if ( color == MAPCOLOR_WAYPOINTg )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 224.5f/256.0f; // green cross
uv1.y = 240.5f/256.0f;
@@ -750,7 +752,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
}
if ( color == MAPCOLOR_WAYPOINTy )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 240.5f/256.0f; // yellow cross
uv1.y = 240.5f/256.0f;
@@ -760,7 +762,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
}
if ( color == MAPCOLOR_WAYPOINTv )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 192.5f/256.0f; // violet cross
uv1.y = 224.5f/256.0f;
@@ -781,7 +783,7 @@ void CMap::DrawObjectIcon(Math::Point pos, Math::Point dim, MapColor color,
dp = 0.5f/256.0f;
- m_engine->SetTexture("button3.png");
+ m_engine->SetTexture("textures/interface/button3.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
if ( color == MAPCOLOR_MOVE )
{
@@ -896,7 +898,7 @@ void CMap::DrawHighlight(Math::Point pos)
dim.x *= 2.0f+cosf(m_time*8.0f)*0.5f;
dim.y *= 2.0f+cosf(m_time*8.0f)*0.5f;
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 160.5f/256.0f; // hilite
uv1.y = 224.5f/256.0f;
@@ -1054,8 +1056,8 @@ void CMap::UpdateTerrain()
}
}
- m_engine->DeleteTexture("map.png");
- m_engine->LoadTexture("map.png", &img);
+ m_engine->DeleteTexture("interface/map.png");
+ m_engine->LoadTexture("textures/interface/map.png", &img);
}
// Updates the field in the map.
diff --git a/src/ui/scroll.cpp b/src/ui/scroll.cpp
index de2f26b..32c5818 100644
--- a/src/ui/scroll.cpp
+++ b/src/ui/scroll.cpp
@@ -381,7 +381,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon)
if ( icon == 0 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f/256.0f; // yellow rectangle
uv1.y = 32.0f/256.0f;
@@ -391,7 +391,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 1 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f/256.0f; // gray rectangle
uv1.y = 32.0f/256.0f;
@@ -401,7 +401,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 2 )
{
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f/256.0f; // blue rectangle
uv1.y = 0.0f/256.0f;
@@ -411,7 +411,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 104.0f/256.0f; // blue line -
uv1.y = 32.0f/256.0f;
diff --git a/src/ui/shortcut.cpp b/src/ui/shortcut.cpp
index 5164a10..81495a7 100644
--- a/src/ui/shortcut.cpp
+++ b/src/ui/shortcut.cpp
@@ -116,7 +116,7 @@ void CShortcut::Draw()
zoom = 1.0f;
}
- m_engine->SetTexture("button3.png");
+ m_engine->SetTexture("textures/interface/button3.png");
if ( icon != -1 )
{
@@ -132,7 +132,7 @@ void CShortcut::Draw()
Math::Point p1, p2, c, uv1, uv2;
float dp;
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
zoom = 0.9f+sinf(m_time*8.0f)*0.1f;
@@ -172,7 +172,7 @@ void CShortcut::Draw()
Math::Point uv1, uv2;
float dp;
- m_engine->SetTexture("button3.png");
+ m_engine->SetTexture("textures/interface/button3.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 160.0f/256.0f;
diff --git a/src/ui/slider.cpp b/src/ui/slider.cpp
index 7752441..58fcc26 100644
--- a/src/ui/slider.cpp
+++ b/src/ui/slider.cpp
@@ -500,7 +500,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon)
if ( icon == 0 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f/256.0f; // yellow rectangle
uv1.y = 32.0f/256.0f;
@@ -512,7 +512,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 1 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f/256.0f; // gray rectangle
uv1.y = 32.0f/256.0f;
@@ -524,7 +524,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 224.0f/256.0f; // cursor
uv1.y = 32.0f/256.0f;
diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp
index 5400265..abe4e5c 100644
--- a/src/ui/studio.cpp
+++ b/src/ui/studio.cpp
@@ -852,7 +852,6 @@ bool CStudio::StopEditScript(bool bCancel)
{
CWindow* pw;
CEdit* edit;
- CButton* button;
pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3));
if ( pw == nullptr ) return false;
diff --git a/src/ui/window.cpp b/src/ui/window.cpp
index 20a9e69..7b57a2f 100644
--- a/src/ui/window.cpp
+++ b/src/ui/window.cpp
@@ -1153,7 +1153,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
if ( icon == 0 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 64.0f/256.0f; // dark blue transparent
uv1.y = 64.0f/256.0f;
@@ -1169,7 +1169,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 1 )
{
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f/256.0f; // white tooltip
uv1.y = 0.0f/256.0f;
@@ -1183,7 +1183,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 2 )
{
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f/256.0f; // yellow
uv1.y = 16.0f/256.0f;
@@ -1197,7 +1197,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 3 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 0.0f/256.0f; // transparent blue bar with yellow upper
uv1.y = 64.0f/256.0f;
@@ -1216,7 +1216,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
dim.x += 100.0f/640.0f;
dim.y += 60.0f/480.0f;
- m_engine->SetTexture("human.png");
+ m_engine->SetTexture("textures/human.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 140.0f/256.0f;
uv1.y = 32.0f/256.0f;
@@ -1233,7 +1233,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
dim.x -= 20.0f/640.0f;
dim.y += 0.0f/480.0f;
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 192.0f/256.0f;
uv1.y = 32.0f/256.0f;
@@ -1252,7 +1252,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
dim.x -= 20.0f/640.0f;
dim.y -= 20.0f/480.0f;
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f/256.0f;
uv1.y = 0.0f/256.0f;
@@ -1288,7 +1288,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
dim.x -= 20.0f/640.0f;
dim.y -= 20.0f/480.0f;
- m_engine->SetTexture("button3.png");
+ m_engine->SetTexture("textures/interface/button3.png");
uv1.x = 0.0f/256.0f;
uv1.y = 224.0f/256.0f;
uv2.x = 32.0f/256.0f;
@@ -1299,7 +1299,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
uv2.y -= dp;
DrawIcon(pos, dim, uv1, uv2); // dark blue background
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
uv1.x = 224.0f/256.0f;
uv1.y = 224.0f/256.0f;
uv2.x = 249.0f/256.0f;
@@ -1371,7 +1371,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 5 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f/256.0f; // transparent green
uv1.y = 160.0f/256.0f;
@@ -1385,7 +1385,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 6 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f/256.0f; // transparent red
uv1.y = 176.0f/256.0f;
@@ -1399,7 +1399,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 7 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f/256.0f; // transparent blue
uv1.y = 192.0f/256.0f;
@@ -1413,7 +1413,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 8 )
{
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f/256.0f; // opaque orange
uv1.y = 0.0f/256.0f;
@@ -1429,7 +1429,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 9 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 32.0f/256.0f; // opaque gray
uv1.y = 32.0f/256.0f;
@@ -1449,7 +1449,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 11 )
{
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f/256.0f; // transparent yellow
uv1.y = 224.0f/256.0f;
@@ -1463,7 +1463,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 12 )
{
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f/256.0f; // dirty opaque gray
uv1.y = 128.0f/256.0f;
@@ -1479,7 +1479,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 13 )
{
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 192.0f/256.0f; // dirty opaque blue
uv1.y = 128.0f/256.0f;
@@ -1495,7 +1495,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
}
else if ( icon == 14 )
{
- m_engine->SetTexture("button1.png");
+ m_engine->SetTexture("textures/interface/button1.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 160.0f/256.0f; // dirty opaque red
uv1.y = 128.0f/256.0f;
@@ -1521,7 +1521,7 @@ void CWindow::DrawHach(Math::Point pos, Math::Point dim)
dp = 0.5f/256.0f;
- m_engine->SetTexture("button2.png");
+ m_engine->SetTexture("textures/interface/button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f/256.0f; // hatching
uv1.y = 208.0f/256.0f;