summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--src/CBot/CBotStack.cpp6
-rw-r--r--src/app/app.cpp16
-rw-r--r--src/common/config.h.cmake2
-rw-r--r--src/object/robotmain.cpp2
-rw-r--r--src/sound/oalsound/alsound.cpp1
-rw-r--r--src/ui/displayinfo.cpp18
-rw-r--r--src/ui/maindialog.cpp72
-rw-r--r--src/ui/maindialog.h2
-rw-r--r--src/ui/studio.cpp4
10 files changed, 46 insertions, 80 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bce9271..b69586e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -156,6 +156,9 @@ option(ASSERTS "Enable assert()s" ON)
# Development build can be enabled/disabled regardless of build type
option(DEV_BUILD "Enable development build (enables some debugging tools, local setting paths, etc.)" OFF)
+# Portable build - load all data from current directory
+option(PORTABLE "Portable build" OFF)
+
# Building tests can be enabled/disabled
option(TESTS "Build tests" OFF)
diff --git a/src/CBot/CBotStack.cpp b/src/CBot/CBotStack.cpp
index 6e5e7d8..42d5617 100644
--- a/src/CBot/CBotStack.cpp
+++ b/src/CBot/CBotStack.cpp
@@ -790,7 +790,6 @@ void CBotStack::GetRunPos(const char* &FunctionName, int &start, int &end)
while (p->m_next != NULL)
{
-
if ( p->m_instr != NULL ) instr = p->m_instr;
if ( p->m_bFunc == 1 && p->m_instr != NULL ) funct = p->m_instr;
if ( p->m_next->m_prog != prog ) break ;
@@ -800,7 +799,7 @@ void CBotStack::GetRunPos(const char* &FunctionName, int &start, int &end)
}
if ( p->m_instr != NULL ) instr = p->m_instr;
- if ( p->m_bFunc == 1 ) funct = p->m_instr;
+ if ( p->m_bFunc == 1 && p->m_instr != NULL ) funct = p->m_instr;
if ( funct == NULL ) return;
@@ -829,16 +828,19 @@ CBotVar* CBotStack::GetStackVars(const char* &FunctionName, int level)
if (p->m_next2 && p->m_next2->m_state != 0) p = p->m_next2 ;
else p = p->m_next;
}
+ // Now p is the highest element on the stack
// descends upon the elements of block
while ( p != NULL && !p->m_bBlock ) p = p->m_prev;
+ // Now p is on the beggining of the top block (with local variables)
while ( p != NULL && level++ < 0 )
{
p = p->m_prev;
while ( p != NULL && !p->m_bBlock ) p = p->m_prev;
}
+ // Now p is on the block "level"
if ( p == NULL ) return NULL;
diff --git a/src/app/app.cpp b/src/app/app.cpp
index 150fb87..06e3f01 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -114,7 +114,7 @@ CApplication::CApplication()
m_active = false;
m_debugModes = 0;
- m_windowTitle = "COLOBOT GOLD";
+ m_windowTitle = "COLOBOT: Gold Edition";
m_simulationSuspended = false;
@@ -149,10 +149,16 @@ CApplication::CApplication()
m_mouseButtonsState = 0;
m_trackedKeys = 0;
+ #ifdef PORTABLE
+ m_dataPath = "./data";
+ m_langPath = "./lang";
+ #else
m_dataPath = GetSystemUtils()->GetDataPath();
m_langPath = GetSystemUtils()->GetLangPath();
- #if DEV_BUILD
- m_savePath = "saves";
+ #endif
+
+ #ifdef DEV_BUILD
+ m_savePath = "./saves";
#else
m_savePath = GetSystemUtils()->GetSaveDir();
#endif
@@ -694,7 +700,7 @@ bool CApplication::ChangeVideoConfig(const Gfx::GLDeviceConfig &newConfig)
std::string(SDL_GetError()) + std::string("\n") +
std::string("Previous mode will be restored");
GetLogger()->Error(error.c_str());
- GetSystemUtils()->SystemDialog( SDT_ERROR, "COLOBT - Error", error);
+ GetSystemUtils()->SystemDialog( SDT_ERROR, "COLOBOT - Error", error);
restore = true;
ChangeVideoConfig(m_lastDeviceConfig);
@@ -707,7 +713,7 @@ bool CApplication::ChangeVideoConfig(const Gfx::GLDeviceConfig &newConfig)
std::string error = std::string("SDL error while restoring previous video mode:\n") +
std::string(SDL_GetError());
GetLogger()->Error(error.c_str());
- GetSystemUtils()->SystemDialog( SDT_ERROR, "COLOBT - Fatal Error", error);
+ GetSystemUtils()->SystemDialog( SDT_ERROR, "COLOBOT - Fatal Error", error);
// Fatal error, so post the quit event
diff --git a/src/common/config.h.cmake b/src/common/config.h.cmake
index 98ccefe..44c1085 100644
--- a/src/common/config.h.cmake
+++ b/src/common/config.h.cmake
@@ -24,6 +24,8 @@
#define SDL_MAIN_FUNC main
#endif
+#cmakedefine PORTABLE @PORTABLE@
+
#define COLOBOT_VERSION "@COLOBOT_VERSION_FULL@"
#define COLOBOT_CODENAME "@COLOBOT_VERSION_CODENAME@"
#define COLOBOT_FULLNAME "Colobot @COLOBOT_VERSION_CODENAME@"
diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp
index 442d5cd..91e2d61 100644
--- a/src/object/robotmain.cpp
+++ b/src/object/robotmain.cpp
@@ -711,7 +711,7 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
FlushDisplayInfo();
- m_fontSize = 9.0f;
+ m_fontSize = 19.0f;
m_windowPos = Math::Point(0.15f, 0.17f);
m_windowDim = Math::Point(0.70f, 0.66f);
diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp
index 566e102..0d8fe74 100644
--- a/src/sound/oalsound/alsound.cpp
+++ b/src/sound/oalsound/alsound.cpp
@@ -295,6 +295,7 @@ bool ALSound::SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded)
}
delete chn;
GetLogger()->Debug("Could not open additional channel to play sound!\n");
+ break;
}
}
}
diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp
index ab61a99..aceb5b0 100644
--- a/src/ui/displayinfo.cpp
+++ b/src/ui/displayinfo.cpp
@@ -158,28 +158,28 @@ bool CDisplayInfo::EventProcess(const Event &event)
{
m_main->SetFontSize(9.0f);
slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
- if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/12.0f);
+ if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f);
ViewDisplayInfo();
}
if ( event.type == EVENT_HYPER_SIZE2 ) // size 2?
{
- m_main->SetFontSize(10.0f);
+ m_main->SetFontSize(14.0f);
slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
- if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/12.0f);
+ if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f);
ViewDisplayInfo();
}
if ( event.type == EVENT_HYPER_SIZE3 ) // size 3?
{
- m_main->SetFontSize(12.0f);
+ m_main->SetFontSize(19.0f);
slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
- if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/12.0f);
+ if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f);
ViewDisplayInfo();
}
if ( event.type == EVENT_HYPER_SIZE4 ) // size 4?
{
- m_main->SetFontSize(15.0f);
+ m_main->SetFontSize(24.0f);
slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
- if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/12.0f);
+ if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f);
ViewDisplayInfo();
}
@@ -187,7 +187,7 @@ bool CDisplayInfo::EventProcess(const Event &event)
{
slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider == 0 ) return false;
- m_main->SetFontSize(9.0f+slider->GetVisibleValue()*12.0f);
+ m_main->SetFontSize(9.0f+slider->GetVisibleValue()*15.0f);
ViewDisplayInfo();
}
@@ -420,7 +420,7 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc
button->SetState(STATE_SHADOW);
slider = pw->CreateSlider(pos, dim, 0, EVENT_STUDIO_SIZE);
slider->SetState(STATE_SHADOW);
- slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
+ slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f);
button = pw->CreateButton(pos, dim, 61, EVENT_HYPER_COPY);
button->SetState(STATE_SHADOW);
HyperUpdate();
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index 7d1da0a..dec4586 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -2303,7 +2303,6 @@ bool CMainDialog::EventProcess(const Event &event)
{
switch( event.type )
{
- case EVENT_LIST1:
case EVENT_LIST2:
UpdateApply();
break;
@@ -2335,8 +2334,7 @@ bool CMainDialog::EventProcess(const Event &event)
if ( pb == 0 ) break;
pb->ClearState(STATE_PRESS);
pb->ClearState(STATE_HILIGHT);
- // TODO: uncomment when changing display is implemented
- //ChangeDisplay();
+ ChangeDisplay();
UpdateApply();
break;
@@ -4658,43 +4656,6 @@ void CMainDialog::UpdateSceneResume(int rank)
}
}
-// Updates the list of devices.
-
-void CMainDialog::UpdateDisplayDevice()
-{
- CWindow* pw;
- CList* pl;
- char bufDevices[1000];
- //char bufModes[5000];
- int i, j;
-
- pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
- if ( pw == 0 ) return;
- pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST1));
- if ( pl == 0 ) return;
- pl->Flush();
-
- //bufModes[0] = 0;
- /* TODO: remove device choice
- m_engine->EnumDevices(bufDevices, 1000,
- bufModes, 5000,
- totalDevices, selectDevices,
- totalModes, selectModes);*/
-
- i = 0;
- j = 0;
- while ( bufDevices[i] != 0 )
- {
- pl->SetItemName(j++, bufDevices+i);
- while ( bufDevices[i++] != 0 );
- }
-
- pl->SetSelect(0);
- pl->ShowSelect(false);
-
- m_setupSelDevice = 0;
-}
-
// Updates the list of modes.
void CMainDialog::UpdateDisplayMode()
@@ -4730,31 +4691,30 @@ void CMainDialog::ChangeDisplay()
CWindow* pw;
CList* pl;
CCheck* pc;
- //char* device;
- //char* mode;
bool bFull;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) return;
- pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST1));
- if ( pl == 0 ) return;
- m_setupSelDevice = pl->GetSelect();
- //device = pl->GetItemName(m_setupSelDevice);
-
pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST2));
if ( pl == 0 ) return;
m_setupSelMode = pl->GetSelect();
- //mode = pl->GetItemName(m_setupSelMode);
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FULL));
if ( pc == 0 ) return;
bFull = pc->TestState(STATE_CHECK);
m_setupFull = bFull;
+
+
+ std::vector<Math::IntPoint> modes;
+ m_app->GetVideoResolutionList(modes, true, true);
+
+ Gfx::GLDeviceConfig config = m_app->GetVideoConfig();
+ config.size = modes[m_setupSelMode];
+ config.fullScreen = bFull;
+ m_app->ChangeVideoConfig(config);
- // TODO: remove device choice
- // m_engine->ChangeDevice(device, mode, bFull);
-
+
if ( m_bSimulSetup )
{
m_main->ChangeColor();
@@ -4772,18 +4732,13 @@ void CMainDialog::UpdateApply()
CButton* pb;
CList* pl;
CCheck* pc;
- int sel1, sel2;
+ int sel2;
bool bFull;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) return;
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_APPLY));
- if ( pb == 0 ) return;
-
- pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST1));
- if ( pl == 0 ) return;
- sel1 = pl->GetSelect();
pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST2));
if ( pl == 0 ) return;
@@ -4792,8 +4747,7 @@ void CMainDialog::UpdateApply()
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FULL));
bFull = pc->TestState(STATE_CHECK);
- if ( sel1 == m_setupSelDevice &&
- sel2 == m_setupSelMode &&
+ if ( sel2 == m_setupSelMode &&
bFull == m_setupFull )
{
pb->ClearState(STATE_ENABLE);
diff --git a/src/ui/maindialog.h b/src/ui/maindialog.h
index 1609fe7..390aa31 100644
--- a/src/ui/maindialog.h
+++ b/src/ui/maindialog.h
@@ -173,7 +173,6 @@ protected:
void UpdateSceneChap(int &chap);
void UpdateSceneList(int chap, int &sel);
void UpdateSceneResume(int rank);
- void UpdateDisplayDevice();
void UpdateDisplayMode();
void ChangeDisplay();
void UpdateApply();
@@ -231,7 +230,6 @@ protected:
int m_shotDelay; // number of frames before copy
std::string m_shotName; // generate a file name
- int m_setupSelDevice;
int m_setupSelMode;
bool m_setupFull;
diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp
index 98fc821..abe4e5c 100644
--- a/src/ui/studio.cpp
+++ b/src/ui/studio.cpp
@@ -169,7 +169,7 @@ bool CStudio::EventProcess(const Event &event)
{
slider = static_cast< CSlider* >(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider == nullptr ) return false;
- m_main->SetFontSize(9.0f+slider->GetVisibleValue()*12.0f);
+ m_main->SetFontSize(9.0f+slider->GetVisibleValue()*15.0f);
ViewEditScript();
}
@@ -636,7 +636,7 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank)
button->SetState(STATE_SHADOW);
slider = pw->CreateSlider(pos, dim, 0, EVENT_STUDIO_SIZE);
slider->SetState(STATE_SHADOW);
- slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
+ slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f);
pw->CreateGroup(pos, dim, 19, EVENT_LABEL1); // SatCom logo
button = pw->CreateButton(pos, dim, 128+57, EVENT_STUDIO_TOOL);
button->SetState(STATE_SHADOW);