summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/button.cpp36
-rw-r--r--src/ui/button.h34
-rw-r--r--src/ui/check.cpp36
-rw-r--r--src/ui/check.h34
-rw-r--r--src/ui/color.cpp36
-rw-r--r--src/ui/color.h34
-rw-r--r--src/ui/compass.cpp36
-rw-r--r--src/ui/compass.h34
-rw-r--r--src/ui/control.cpp48
-rw-r--r--src/ui/control.h34
-rw-r--r--src/ui/displayinfo.cpp334
-rw-r--r--src/ui/displayinfo.h35
-rw-r--r--src/ui/displaytext.cpp34
-rw-r--r--src/ui/displaytext.h34
-rw-r--r--src/ui/edit.cpp142
-rw-r--r--src/ui/edit.h34
-rw-r--r--src/ui/editvalue.cpp34
-rw-r--r--src/ui/editvalue.h34
-rw-r--r--src/ui/gauge.cpp36
-rw-r--r--src/ui/gauge.h34
-rw-r--r--src/ui/group.cpp93
-rw-r--r--src/ui/group.h33
-rw-r--r--src/ui/image.cpp42
-rw-r--r--src/ui/image.h34
-rw-r--r--src/ui/interface.cpp41
-rw-r--r--src/ui/interface.h34
-rw-r--r--src/ui/key.cpp36
-rw-r--r--src/ui/key.h34
-rw-r--r--src/ui/label.cpp34
-rw-r--r--src/ui/label.h34
-rw-r--r--src/ui/list.cpp50
-rw-r--r--src/ui/list.h34
-rw-r--r--src/ui/maindialog.cpp747
-rw-r--r--src/ui/maindialog.h46
-rw-r--r--src/ui/mainmap.cpp34
-rw-r--r--src/ui/mainmap.h34
-rw-r--r--src/ui/mainshort.cpp34
-rw-r--r--src/ui/mainshort.h34
-rw-r--r--src/ui/map.cpp68
-rw-r--r--src/ui/map.h34
-rw-r--r--src/ui/scroll.cpp42
-rw-r--r--src/ui/scroll.h34
-rw-r--r--src/ui/shortcut.cpp40
-rw-r--r--src/ui/shortcut.h34
-rw-r--r--src/ui/slider.cpp40
-rw-r--r--src/ui/slider.h34
-rw-r--r--src/ui/studio.cpp75
-rw-r--r--src/ui/studio.h36
-rw-r--r--src/ui/target.cpp33
-rw-r--r--src/ui/target.h33
-rw-r--r--src/ui/window.cpp125
-rw-r--r--src/ui/window.h34
52 files changed, 1415 insertions, 1788 deletions
diff --git a/src/ui/button.cpp b/src/ui/button.cpp
index 810d365..0a10379 100644
--- a/src/ui/button.cpp
+++ b/src/ui/button.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/button.h"
@@ -176,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/button.h b/src/ui/button.h
index b71ef4a..2c66468 100644
--- a/src/ui/button.h
+++ b/src/ui/button.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// button.h
diff --git a/src/ui/check.cpp b/src/ui/check.cpp
index 6a92554..e590309 100644
--- a/src/ui/check.cpp
+++ b/src/ui/check.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/check.h"
@@ -102,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/check.h b/src/ui/check.h
index 65bc367..cdb5134 100644
--- a/src/ui/check.h
+++ b/src/ui/check.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// check.h
diff --git a/src/ui/color.cpp b/src/ui/color.cpp
index d1dc746..ddf7629 100644
--- a/src/ui/color.cpp
+++ b/src/ui/color.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/color.h"
@@ -138,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/color.h b/src/ui/color.h
index fe96b87..06b259e 100644
--- a/src/ui/color.h
+++ b/src/ui/color.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// color.h
diff --git a/src/ui/compass.cpp b/src/ui/compass.cpp
index d0fe96f..45977c5 100644
--- a/src/ui/compass.cpp
+++ b/src/ui/compass.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/compass.h"
@@ -88,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/compass.h b/src/ui/compass.h
index 956631a..510d9e8 100644
--- a/src/ui/compass.h
+++ b/src/ui/compass.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// compass.h
diff --git a/src/ui/control.cpp b/src/ui/control.cpp
index 4e64ee9..a4cdbfc 100644
--- a/src/ui/control.cpp
+++ b/src/ui/control.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-//
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/control.h"
@@ -437,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;
@@ -491,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
}
@@ -506,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
@@ -751,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;
@@ -795,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/control.h b/src/ui/control.h
index 1ca07cf..5306641 100644
--- a/src/ui/control.h
+++ b/src/ui/control.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code;
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// control.h
diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp
index e7748ae..aceb5b0 100644
--- a/src/ui/displayinfo.cpp
+++ b/src/ui/displayinfo.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/displayinfo.h"
@@ -156,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();
}
@@ -185,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();
}
@@ -342,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?
{
@@ -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();
@@ -935,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 891551b..f820cd6 100644
--- a/src/ui/displayinfo.h
+++ b/src/ui/displayinfo.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// displayinfo.h
@@ -66,7 +68,6 @@ protected:
void UpdateCopyButton();
void ViewDisplayInfo();
CObject* SearchToto();
- void CreateObjectsFile();
protected:
Gfx::CEngine* m_engine;
diff --git a/src/ui/displaytext.cpp b/src/ui/displaytext.cpp
index 5b3144d..8e944de 100644
--- a/src/ui/displaytext.cpp
+++ b/src/ui/displaytext.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/displaytext.h"
diff --git a/src/ui/displaytext.h b/src/ui/displaytext.h
index 94572a8..3815407 100644
--- a/src/ui/displaytext.h
+++ b/src/ui/displaytext.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// displaytext.h
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index e2df62b..b6e6bbf 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -1,29 +1,38 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#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 {
@@ -115,21 +124,16 @@ CEdit::CEdit () : CControl ()
CEdit::~CEdit()
{
- int i;
-
FreeImage();
- for ( i=0 ; i<EDITUNDOMAX ; i++ )
+ for (int i = 0; i < EDITUNDOMAX; i++)
{
delete m_undo[i].text;
m_undo[i].text = nullptr;
}
- if (m_text != nullptr)
- {
- delete[] m_text;
- m_text = nullptr;
- }
+ delete[] m_text;
+ m_text = nullptr;
delete m_scroll;
m_scroll = nullptr;
@@ -373,23 +377,23 @@ bool CEdit::EventProcess(const Event &event)
MoveChar(1, bControl, bShift);
return true;
}
- if ( event.key.key == KEY(UP) )
+ if ( event.key.key == KEY(UP) && m_bMulti )
{
MoveLine(-1, bControl, bShift);
return true;
}
- if ( event.key.key == KEY(DOWN) )
+ if ( event.key.key == KEY(DOWN) && m_bMulti )
{
MoveLine(1, bControl, bShift);
return true;
}
- if ( event.key.key == KEY(PAGEUP) ) // PageUp ?
+ if ( event.key.key == KEY(PAGEUP) && m_bMulti ) // PageUp ?
{
MoveLine(-(m_lineVisible-1), bControl, bShift);
return true;
}
- if ( event.key.key == KEY(PAGEDOWN) ) // PageDown ?
+ if ( event.key.key == KEY(PAGEDOWN) && m_bMulti ) // PageDown ?
{
MoveLine(m_lineVisible-1, bControl, bShift);
return true;
@@ -782,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) )
{
@@ -1145,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);
@@ -1175,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 )
@@ -1225,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);
@@ -1423,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);
}
}
@@ -1433,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);
}
@@ -1441,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];
@@ -1450,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;
@@ -1479,8 +1470,7 @@ bool CEdit::ReadText(std::string filename, int addSize)
FreeImage();
- if (m_text != nullptr)
- delete[] m_text;
+ delete[] m_text;
m_text = new char[m_maxChar+1];
memset(m_text, 0, m_maxChar+1);
@@ -1488,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);
@@ -1497,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;
@@ -1891,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 )
{
@@ -1929,7 +1924,7 @@ bool CEdit::WriteText(std::string filename)
if ( j >= 1000-1 )
{
- fwrite(buffer, 1, j, file);
+ stream.write(buffer, j);
j = 0;
}
@@ -1937,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 )
{
@@ -1958,8 +1953,7 @@ void CEdit::SetMaxChar(int max)
{
FreeImage();
- if (m_text != nullptr)
- delete[] m_text;
+ delete[] m_text;
m_maxChar = max;
diff --git a/src/ui/edit.h b/src/ui/edit.h
index 9484fc8..cbad394 100644
--- a/src/ui/edit.h
+++ b/src/ui/edit.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
/**
diff --git a/src/ui/editvalue.cpp b/src/ui/editvalue.cpp
index 3fb9b79..676f2a6 100644
--- a/src/ui/editvalue.cpp
+++ b/src/ui/editvalue.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/editvalue.h"
diff --git a/src/ui/editvalue.h b/src/ui/editvalue.h
index 2734847..3011d55 100644
--- a/src/ui/editvalue.h
+++ b/src/ui/editvalue.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// editvalue.h
diff --git a/src/ui/gauge.cpp b/src/ui/gauge.cpp
index a8ee41c..92f4d7c 100644
--- a/src/ui/gauge.cpp
+++ b/src/ui/gauge.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/gauge.h"
@@ -75,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/gauge.h b/src/ui/gauge.h
index 3dbeef8..798171f 100644
--- a/src/ui/gauge.h
+++ b/src/ui/gauge.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// gauge.h
diff --git a/src/ui/group.cpp b/src/ui/group.cpp
index 64495e0..e924ea6 100644
--- a/src/ui/group.cpp
+++ b/src/ui/group.cpp
@@ -1,18 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/group.h"
@@ -87,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
@@ -103,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;
@@ -117,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;
@@ -131,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;
@@ -145,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;
@@ -159,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;
@@ -173,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;
@@ -189,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;
@@ -203,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;
@@ -217,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;
@@ -231,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;
@@ -245,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;
@@ -262,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;
@@ -301,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;
@@ -322,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;
@@ -343,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;
@@ -364,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;
@@ -385,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;
@@ -401,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;
@@ -415,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;
@@ -429,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;
@@ -443,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;
@@ -457,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;
@@ -474,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;
@@ -490,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;
@@ -506,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;
@@ -522,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;
@@ -538,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;
@@ -556,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;
@@ -568,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/group.h b/src/ui/group.h
index 89996cc..e12bf78 100644
--- a/src/ui/group.h
+++ b/src/ui/group.h
@@ -1,18 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// group.h
diff --git a/src/ui/image.cpp b/src/ui/image.cpp
index 8f9b5ca..89e1fd2 100644
--- a/src/ui/image.cpp
+++ b/src/ui/image.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/image.h"
@@ -110,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
@@ -127,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/image.h b/src/ui/image.h
index fd71e33..cff43a8 100644
--- a/src/ui/image.h
+++ b/src/ui/image.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// image.h
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index ab2c01b..bd25bee 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/interface.h"
@@ -49,11 +51,8 @@ void CInterface::Flush()
{
for (int i = 0; i < MAXCONTROL; i++)
{
- if (m_table[i] != nullptr)
- {
- delete m_table[i];
- m_table[i] = nullptr;
- }
+ delete m_table[i];
+ m_table[i] = nullptr;
}
}
diff --git a/src/ui/interface.h b/src/ui/interface.h
index d5734f0..f3e81bb 100644
--- a/src/ui/interface.h
+++ b/src/ui/interface.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// interface.h
diff --git a/src/ui/key.cpp b/src/ui/key.cpp
index aacc8d8..fd9a77f 100644
--- a/src/ui/key.cpp
+++ b/src/ui/key.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/key.h"
@@ -136,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/key.h b/src/ui/key.h
index d8e935c..0cc8a4c 100644
--- a/src/ui/key.h
+++ b/src/ui/key.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
/**
* \file ui/key.h
diff --git a/src/ui/label.cpp b/src/ui/label.cpp
index 76a95f2..f4d0119 100644
--- a/src/ui/label.cpp
+++ b/src/ui/label.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/label.h"
diff --git a/src/ui/label.h b/src/ui/label.h
index 305aca2..36b6da1 100644
--- a/src/ui/label.h
+++ b/src/ui/label.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// label.h
diff --git a/src/ui/list.cpp b/src/ui/list.cpp
index f6c3ed9..9611533 100644
--- a/src/ui/list.cpp
+++ b/src/ui/list.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/list.h"
@@ -61,12 +63,10 @@ CList::~CList()
{
for (int i = 0; i < LISTMAXDISPLAY; i++)
{
- if (m_button[i] != nullptr)
- delete m_button[i];
+ delete m_button[i];
}
- if (m_scroll != nullptr)
- delete m_scroll;
+ delete m_scroll;
}
@@ -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/list.h b/src/ui/list.h
index a2e033f..4632f76 100644
--- a/src/ui/list.h
+++ b/src/ui/list.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// list.h
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index 11f8f4a..0bb1e36 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -1,24 +1,26 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/maindialog.h"
#include "app/app.h"
-#include "app/gamedata.h"
#include "app/system.h"
#include "common/config.h"
@@ -30,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"
@@ -162,6 +170,7 @@ CMainDialog::CMainDialog()
m_bCameraInvertX = false;
m_bCameraInvertY = false;
m_bEffect = true;
+ m_bBlood = true;
m_shotDelay = 0;
m_glintMouse = Math::Point(0.0f, 0.0f);
@@ -173,18 +182,10 @@ 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_publicDir = CResourceManager::GetSaveLocation()+"/program"; //TODO: Refactor to use PHYSFS
+ m_filesDir = CResourceManager::GetSaveLocation()+"/files"; //TODO: Refactor to use PHYSFS
+ CLogger::GetInstancePointer()->Trace("Savegame path: normal=%s, physfs=%s\n", GetSavegameDir().c_str(), GetPHYSFSSavegameDir().c_str());
m_setupFull = m_app->GetVideoConfig().fullScreen;
@@ -315,7 +316,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;
@@ -323,8 +323,22 @@ void CMainDialog::ChangePhase(Phase phase)
ddim.x = 0.09f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_USER);
pb->SetState(STATE_SHADOW);
+
+ try {
+ CLevelParser* level = new CLevelParser("levels/custom/config.txt");
+ if(level->Exists()) {
+ level->Load();
+ CLevelParserLine* line = level->Get("Button");
+ if(line->GetParam("name")->IsDefined())
+ pb->SetName(line->GetParam("name")->AsString());
+ if(line->GetParam("tooltip")->IsDefined())
+ pb->SetTooltip(line->GetParam("tooltip")->AsString());
+ }
+ }
+ catch(CLevelParserException& e) {
+ CLogger::GetInstancePointer()->Error("Failed loading userlevel button name: %s\n", e.what());
+ }
}
- #endif
/*pos.x = 139.0f/640.0f;
pos.y = 313.0f/480.0f;
@@ -339,11 +353,11 @@ void CMainDialog::ChangePhase(Phase phase)
pg = pw->CreateGroup(pos, ddim, 1, EVENT_LABEL1);
pg->SetState(STATE_SHADOW);
pos.y -= 5.0f/480.0f;
- pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, "PPC Team");
+ pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, "TerranovaTeam");
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),
@@ -450,7 +464,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),
@@ -693,7 +707,7 @@ void CMainDialog::ChangePhase(Phase phase)
m_phase != PHASE_SETUPcs &&
m_phase != PHASE_SETUPss )
{
- if (!m_sound->IsPlayingMusic())
+ if (!m_sound->IsPlayingMusic() && m_sound->IsCachedMusic("Intro1.ogg"))
{
m_sound->PlayMusic("Intro1.ogg", false);
}
@@ -703,7 +717,6 @@ void CMainDialog::ChangePhase(Phase phase)
m_phase == PHASE_DEFI ||
m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE ||
- m_phase == PHASE_TEEN ||
m_phase == PHASE_USER )
{
if ( m_phase == PHASE_TRAINER ) m_index = 0;
@@ -711,21 +724,19 @@ void CMainDialog::ChangePhase(Phase phase)
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_TEEN ) m_index = 6;
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_TEEN ) strcpy(m_sceneName, "teen");
- 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();
@@ -739,7 +750,6 @@ void CMainDialog::ChangePhase(Phase phase)
if ( m_phase == PHASE_DEFI ) res = RT_TITLE_DEFI;
if ( m_phase == PHASE_MISSION ) res = RT_TITLE_MISSION;
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;
GetResource(RES_TEXT, res, name);
pw->SetName(name);
@@ -764,7 +774,6 @@ void CMainDialog::ChangePhase(Phase phase)
if ( m_phase == PHASE_DEFI ) res = RT_PLAY_CHAPd;
if ( m_phase == PHASE_MISSION ) res = RT_PLAY_CHAPm;
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;
GetResource(RES_TEXT, res, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL11, name);
@@ -787,7 +796,6 @@ void CMainDialog::ChangePhase(Phase phase)
if ( m_phase == PHASE_DEFI ) res = RT_PLAY_LISTd;
if ( m_phase == PHASE_MISSION ) res = RT_PLAY_LISTm;
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;
GetResource(RES_TEXT, res, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL12, name);
@@ -824,8 +832,7 @@ void CMainDialog::ChangePhase(Phase phase)
// Button displays the "soluce":
if ( m_phase != PHASE_TRAINER &&
- m_phase != PHASE_FREE &&
- m_phase != PHASE_TEEN )
+ m_phase != PHASE_FREE )
{
pos.x = ox+sx*9.5f;
pos.y = oy+sy*5.8f;
@@ -882,7 +889,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),
@@ -962,6 +969,9 @@ void CMainDialog::ChangePhase(Phase phase)
pb->SetState(STATE_SHADOW);
pb->SetState(STATE_CARD);
pb->SetState(STATE_CHECK, (m_phase == PHASE_SETUPd || m_phase == PHASE_SETUPds));
+ #if PLATFORM_WINDOWS
+ pb->SetState(STATE_ENABLE, !m_bSimulSetup);
+ #endif
pos.x += ddim.x+0.01f;
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_SETUPg);
@@ -1007,7 +1017,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),
@@ -1044,6 +1054,14 @@ void CMainDialog::ChangePhase(Phase phase)
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_FULL);
pc->SetState(STATE_SHADOW);
pc->SetState(STATE_CHECK, m_setupFull);
+
+ #if !PLATFORM_LINUX
+ ddim.x = 0.9f;
+ ddim.y = 0.1f;
+ pos.x = 0.05f;
+ pos.y = 0.20f;
+ pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, "The game will be restarted in order to apply changes. All unsaved progress will be lost.");
+ #endif
ddim.x = dim.x*6;
ddim.y = dim.y*1;
@@ -1223,6 +1241,9 @@ void CMainDialog::ChangePhase(Phase phase)
pos.y -= 0.048f;
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_EFFECT);
pc->SetState(STATE_SHADOW);
+ pos.y -= 0.048f;
+ pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_BLOOD);
+ pc->SetState(STATE_SHADOW);
//? pos.y -= 0.048f;
//? pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_NICERST);
//? pc->SetState(STATE_SHADOW);
@@ -1496,7 +1517,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),
@@ -1543,7 +1564,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),
@@ -1565,7 +1586,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/intro1.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),
@@ -1584,7 +1605,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/intro2.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),
@@ -1603,7 +1624,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/intro3.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),
@@ -1669,7 +1690,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),
@@ -1684,7 +1705,6 @@ void CMainDialog::ChangePhase(Phase phase)
m_phase == PHASE_DEFI ||
m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE ||
- m_phase == PHASE_TEEN ||
m_phase == PHASE_USER ||
m_phase == PHASE_SETUPd ||
m_phase == PHASE_SETUPg ||
@@ -1740,7 +1760,7 @@ bool CMainDialog::EventProcess(const Event &event)
m_phase != PHASE_SETUPcs &&
m_phase != PHASE_SETUPss )
{
- if (!m_sound->IsPlayingMusic())
+ if (!m_sound->IsPlayingMusic() && m_sound->IsCachedMusic("Intro2.ogg"))
{
m_sound->PlayMusic("Intro2.ogg", true);
}
@@ -1880,6 +1900,9 @@ bool CMainDialog::EventProcess(const Event &event)
{
StopDialog();
StartSuspend();
+ #if PLATFORM_WINDOWS
+ if ( m_phaseSetup == PHASE_SETUPd ) m_phaseSetup = PHASE_SETUPg;
+ #endif
if ( m_phaseSetup == PHASE_SETUPd ) ChangePhase(PHASE_SETUPds);
if ( m_phaseSetup == PHASE_SETUPg ) ChangePhase(PHASE_SETUPgs);
if ( m_phaseSetup == PHASE_SETUPp ) ChangePhase(PHASE_SETUPps);
@@ -1948,10 +1971,6 @@ bool CMainDialog::EventProcess(const Event &event)
m_main->ChangePhase(PHASE_FREE);
break;
- case EVENT_INTERFACE_TEEN:
- m_main->ChangePhase(PHASE_TEEN);
- break;
-
case EVENT_INTERFACE_USER:
m_main->ChangePhase(PHASE_USER);
break;
@@ -2158,7 +2177,6 @@ bool CMainDialog::EventProcess(const Event &event)
m_phase == PHASE_DEFI ||
m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE ||
- m_phase == PHASE_TEEN ||
m_phase == PHASE_USER )
{
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
@@ -2177,7 +2195,6 @@ bool CMainDialog::EventProcess(const Event &event)
m_phase == PHASE_DEFI ||
m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE ||
- m_phase == PHASE_TEEN ||
m_phase == PHASE_USER )
{
switch( event.type )
@@ -2320,7 +2337,6 @@ bool CMainDialog::EventProcess(const Event &event)
{
switch( event.type )
{
- case EVENT_LIST1:
case EVENT_LIST2:
UpdateApply();
break;
@@ -2352,8 +2368,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;
@@ -2554,6 +2569,13 @@ bool CMainDialog::EventProcess(const Event &event)
UpdateSetupButtons();
break;
+ case EVENT_INTERFACE_BLOOD:
+ m_bBlood = !m_bBlood;
+ m_camera->SetBlood(m_bBlood);
+ ChangeSetupButtons();
+ UpdateSetupButtons();
+ break;
+
default:
break;
}
@@ -2820,7 +2842,6 @@ void CMainDialog::GlintMove()
m_phase == PHASE_TRAINER ||
m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE ||
- m_phase == PHASE_TEEN ||
m_phase == PHASE_USER )
{
pg = static_cast<CGroup*>(pw->SearchControl(EVENT_INTERFACE_GLINTl));
@@ -3045,7 +3066,6 @@ void CMainDialog::FrameParticle(float rTime)
m_phase == PHASE_DEFI ||
m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE ||
- m_phase == PHASE_TEEN ||
m_phase == PHASE_USER ||
m_phase == PHASE_SETUPd ||
m_phase == PHASE_SETUPg ||
@@ -3286,40 +3306,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.
@@ -3357,13 +3352,13 @@ void CMainDialog::ReadNameList()
try
{
- if (! fs::exists(m_savegameDir) && fs::is_directory(m_savegameDir))
+ if (! fs::exists(GetSavegameDir()) && fs::is_directory(GetSavegameDir()))
{
GetLogger()->Error("Savegame dir does not exist %s\n",dir);
}
else
{
- fs::directory_iterator dirIt(m_savegameDir), dirEndIt;
+ fs::directory_iterator dirIt(GetSavegameDir()), dirEndIt;
for (; dirIt != dirEndIt; ++dirIt)
{
@@ -3557,7 +3552,7 @@ void CMainDialog::NameSelect()
GetGamerFace(m_main->GetGamerName());
- GetProfile().SetLocalProfileString("Gamer", "LastName", m_main->GetGamerName());
+ GetProfile().SetStringProperty("Gamer", "LastName", m_main->GetGamerName());
}
// Creates a new player.
@@ -3571,7 +3566,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));
@@ -3608,13 +3603,16 @@ void CMainDialog::NameCreate()
return;
}
- // TODO: _mkdir(m_savegameDir); // if does not exist yet!
-
- dir = m_savegameDir + "/" + name;
+ if(!CResourceManager::DirectoryExists(GetPHYSFSSavegameDir()))
+ CResourceManager::CreateDirectory(GetPHYSFSSavegameDir());
+
+ dir = GetSavegameDir() + "/" + name;
if (!fs::exists(dir))
{
fs::create_directories(dir);
+ if(!CResourceManager::DirectoryExists(GetPHYSFSSavegameDir()+"/"+name))
+ CResourceManager::CreateDirectory(GetPHYSFSSavegameDir()+"/"+name);
}
else
{
@@ -3681,7 +3679,7 @@ void CMainDialog::NameDelete()
gamer = pl->GetItemName(sel);
// Deletes all the contents of the file.
- sprintf(dir, "%s/%s", m_savegameDir.c_str(), gamer);
+ sprintf(dir, "%s/%s", GetSavegameDir().c_str(), gamer);
if ( !RemoveDir(dir) )
{
m_sound->Play(SOUND_TZOING);
@@ -3994,7 +3992,7 @@ bool CMainDialog::IsIOReadScene()
{
fs::directory_iterator end_iter;
- fs::path saveDir(m_savegameDir + "/" + m_main->GetGamerName());
+ fs::path saveDir(GetSavegameDir() + "/" + m_main->GetGamerName());
if (fs::exists(saveDir) && fs::is_directory(saveDir))
{
for( fs::directory_iterator dir_iter(saveDir) ; dir_iter != end_iter ; ++dir_iter)
@@ -4013,7 +4011,6 @@ bool CMainDialog::IsIOReadScene()
void CMainDialog::IOReadName()
{
- FILE* file;
CWindow* pw;
CEdit* pe;
std::string filename;
@@ -4035,10 +4032,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++ )
{
@@ -4060,7 +4059,7 @@ void CMainDialog::IOReadName()
break;
}
}
- fclose(file);
+ stream.close();
}
time(&now);
@@ -4090,7 +4089,7 @@ void CMainDialog::IOReadList()
pl->Flush();
- fs::path saveDir(m_savegameDir + "/" + m_main->GetGamerName());
+ fs::path saveDir(GetSavegameDir() + "/" + m_main->GetGamerName());
m_saveList.clear();
if (fs::exists(saveDir) && fs::is_directory(saveDir))
@@ -4167,6 +4166,11 @@ void CMainDialog::IOUpdateList()
return;
std::string filename = (m_saveList.at(sel) / "screen.png").make_preferred().string();
+ std::string savedir = CResourceManager::GetSaveLocation()+"/";
+ boost::replace_all(filename, "\\", "/");
+ boost::replace_all(savedir, "\\", "/");
+ boost::replace_all(filename, savedir, ""); //TODO: Refactor everything to PHYSFS, see issue #334
+ filename = "../"+filename;
if ( m_phase == PHASE_WRITE || m_phase == PHASE_WRITEs )
{
if ( sel < max-1 )
@@ -4267,7 +4271,7 @@ bool CMainDialog::IOWriteScene()
pe->GetText(info, 100);
if (static_cast<unsigned int>(sel) >= m_saveList.size())
{
- dir = fs::path(m_savegameDir) / m_main->GetGamerName() / ("save" + clearName(info));
+ dir = fs::path(GetSavegameDir()) / m_main->GetGamerName() / ("save" + clearName(info));
}
else
{
@@ -4394,7 +4398,6 @@ void CMainDialog::AllMissionUpdate()
m_phase == PHASE_DEFI ||
m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE ||
- m_phase == PHASE_TEEN ||
m_phase == PHASE_USER )
{
UpdateSceneChap(m_chap[m_index]);
@@ -4406,22 +4409,15 @@ 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];
char line[500];
- char name[100];
- int i, j;
+ int j;
bool bPassed;
- memset(op, 0, 100);
- memset(op_i18n, 0, 100);
memset(line, 0, 500);
- memset(name, 0, 100);
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) return;
@@ -4433,100 +4429,44 @@ 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
{
for ( j=0 ; j<9 ; j++ )
{
- BuildSceneName(fileName, m_sceneName, (j+1)*100);
- file = fopen(fileName.c_str(), "r");
- if ( file == NULL ) 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 )
- {
- 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;
- }
+ CLevelParser* level = new CLevelParser(m_sceneName, j+1, 0);
+ if(!level->Exists())
+ break;
+ try {
+ level->Load();
+ sprintf(line, "%d: %s", j+1, level->Get("Title")->GetParam("text")->AsString().c_str());
+ }
+ catch(CLevelParserException& e) {
+ sprintf(line, "%s", (std::string("[ERROR]: ")+e.what()).c_str());
}
- fclose(file);
+ delete level;
bPassed = GetGamerInfoPassed((j+1)*100);
- sprintf(line, "%d: %s", j+1, name);
pl->SetItemName(j, line);
pl->SetCheck(j, bPassed);
pl->SetEnable(j, true);
@@ -4555,21 +4495,14 @@ void CMainDialog::UpdateSceneChap(int &chap)
void CMainDialog::UpdateSceneList(int chap, int &sel)
{
- FILE* file = NULL;
CWindow* pw;
CList* pl;
std::string fileName;
- char op[100];
- char op_i18n[100];
char line[500];
- char name[100];
- int i, j;
+ int j;
bool bPassed;
- memset(op, 0, 100);
- memset(op_i18n, 0, 100);
memset(line, 0, 500);
- memset(name, 0, 100);
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == 0 ) return;
@@ -4577,64 +4510,47 @@ void CMainDialog::UpdateSceneList(int chap, int &sel)
if ( pl == 0 ) return;
pl->Flush();
+
+ if(chap < 0) return;
+ bool readAll = true;
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;
-
- 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);
+ CLevelParser* level = new CLevelParser(m_sceneName, chap+1, j+1);
+ if(!level->Exists()) {
+ readAll = true;
+ break;
+ } else {
+ if(!readAll)
break;
- }
}
- fclose(file);
+ try {
+ level->Load();
+ sprintf(line, "%d: %s", j+1, level->Get("Title")->GetParam("text")->AsString().c_str());
+ }
+ catch(CLevelParserException& e) {
+ sprintf(line, "%s", (std::string("[ERROR]: ")+e.what()).c_str());
+ }
+ delete level;
bPassed = GetGamerInfoPassed((chap+1)*100+(j+1));
- sprintf(line, "%d: %s", j+1, name);
pl->SetItemName(j, line);
pl->SetCheck(j, bPassed);
pl->SetEnable(j, true);
if ( m_phase == PHASE_MISSION && !m_main->GetShowAll() && !bPassed )
{
- j ++;
- break;
+ readAll = false;
}
}
- BuildSceneName(fileName, m_sceneName, (chap+1)*100+(j+1));
- file = fopen(fileName.c_str(), "r");
- if ( file == NULL )
+ if(readAll)
{
m_maxList = j;
}
else
{
m_maxList = j+1; // this is not the last!
- fclose(file);
}
if ( sel > j-1 ) sel = j-1;
@@ -4655,7 +4571,6 @@ void CMainDialog::ShowSoluceUpdate()
m_phase == PHASE_DEFI ||
m_phase == PHASE_MISSION ||
m_phase == PHASE_FREE ||
- m_phase == PHASE_TEEN ||
m_phase == PHASE_USER )
{
m_bSceneSoluce = false;
@@ -4686,16 +4601,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));
@@ -4721,80 +4631,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 )
- {
- 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;
- }
+
+ 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());
}
- fclose(file);
-
- pe->SetText(name);
-}
-
-// 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 )
+ catch(CLevelParserException& e)
{
- pl->SetItemName(j++, bufDevices+i);
- while ( bufDevices[i++] != 0 );
+ pe->SetText((std::string("[ERROR]: ")+e.what()).c_str());
}
-
- pl->SetSelect(0);
- pl->ShowSelect(false);
-
- m_setupSelDevice = 0;
}
// Updates the list of modes.
@@ -4832,36 +4680,35 @@ 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;
-
- // TODO: remove device choice
- // m_engine->ChangeDevice(device, mode, bFull);
-
- if ( m_bSimulSetup )
- {
- m_main->ChangeColor();
- m_main->UpdateMap();
- }
+
+ SetupMemorize();
+
+ #if !PLATFORM_LINUX
+ // Windows causes problems, so we'll restart the game
+ // Mac OS was not tested so let's restart just to be sure
+ m_app->Restart();
+ #else
+ 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);
+ #endif
}
@@ -4874,18 +4721,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;
@@ -4894,8 +4736,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);
@@ -5011,6 +4852,12 @@ void CMainDialog::UpdateSetupButtons()
pc->SetState(STATE_CHECK, m_bEffect);
}
+ pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_BLOOD));
+ if ( pc != 0 )
+ {
+ pc->SetState(STATE_CHECK, m_bBlood);
+ }
+
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SHADOW));
if ( pc != 0 )
{
@@ -5182,46 +5029,45 @@ void CMainDialog::ChangeSetupButtons()
void CMainDialog::SetupMemorize()
{
- GetProfile().SetLocalProfileString("Directory", "scene", m_sceneDir);
- GetProfile().SetLocalProfileString("Directory", "savegame", m_savegameDir);
- GetProfile().SetLocalProfileString("Directory", "public", m_publicDir);
- GetProfile().SetLocalProfileString("Directory", "user", m_userDir);
- GetProfile().SetLocalProfileString("Directory", "files", m_filesDir);
- GetProfile().SetLocalProfileInt("Setup", "Tooltips", m_bTooltip);
- GetProfile().SetLocalProfileInt("Setup", "InterfaceGlint", m_bGlint);
- GetProfile().SetLocalProfileInt("Setup", "InterfaceGlint", m_bRain);
- GetProfile().SetLocalProfileInt("Setup", "Soluce4", m_bSoluce4);
- GetProfile().SetLocalProfileInt("Setup", "Movies", m_bMovies);
- GetProfile().SetLocalProfileInt("Setup", "NiceReset", m_bNiceReset);
- GetProfile().SetLocalProfileInt("Setup", "HimselfDamage", m_bHimselfDamage);
- GetProfile().SetLocalProfileInt("Setup", "CameraScroll", m_bCameraScroll);
- GetProfile().SetLocalProfileInt("Setup", "CameraInvertX", m_bCameraInvertX);
- GetProfile().SetLocalProfileInt("Setup", "CameraInvertY", m_bCameraInvertY);
- GetProfile().SetLocalProfileInt("Setup", "InterfaceEffect", m_bEffect);
- GetProfile().SetLocalProfileInt("Setup", "GroundShadow", m_engine->GetShadow());
- GetProfile().SetLocalProfileInt("Setup", "GroundSpot", m_engine->GetGroundSpot());
- GetProfile().SetLocalProfileInt("Setup", "ObjectDirty", m_engine->GetDirty());
- GetProfile().SetLocalProfileInt("Setup", "FogMode", m_engine->GetFog());
- GetProfile().SetLocalProfileInt("Setup", "LensMode", m_engine->GetLensMode());
- GetProfile().SetLocalProfileInt("Setup", "SkyMode", m_engine->GetSkyMode());
- GetProfile().SetLocalProfileInt("Setup", "PlanetMode", m_engine->GetPlanetMode());
- GetProfile().SetLocalProfileInt("Setup", "LightMode", m_engine->GetLightMode());
- GetProfile().SetLocalProfileFloat("Setup", "ParticleDensity", m_engine->GetParticleDensity());
- GetProfile().SetLocalProfileFloat("Setup", "ClippingDistance", m_engine->GetClippingDistance());
- GetProfile().SetLocalProfileFloat("Setup", "ObjectDetail", m_engine->GetObjectDetail());
- GetProfile().SetLocalProfileFloat("Setup", "GadgetQuantity", m_engine->GetGadgetQuantity());
- GetProfile().SetLocalProfileInt("Setup", "TextureQuality", m_engine->GetTextureQuality());
- GetProfile().SetLocalProfileInt("Setup", "TotoMode", m_engine->GetTotoMode());
- GetProfile().SetLocalProfileInt("Setup", "AudioVolume", m_sound->GetAudioVolume());
- GetProfile().SetLocalProfileInt("Setup", "MusicVolume", m_sound->GetMusicVolume());
- GetProfile().SetLocalProfileInt("Setup", "EditIndentMode", m_engine->GetEditIndentMode());
- GetProfile().SetLocalProfileInt("Setup", "EditIndentValue", m_engine->GetEditIndentValue());
+ GetProfile().SetStringProperty("Directory", "savegame", m_savegameDir);
+ GetProfile().SetStringProperty("Directory", "public", m_publicDir);
+ GetProfile().SetStringProperty("Directory", "files", m_filesDir);
+ GetProfile().SetIntProperty("Setup", "Tooltips", m_bTooltip);
+ GetProfile().SetIntProperty("Setup", "InterfaceGlint", m_bGlint);
+ GetProfile().SetIntProperty("Setup", "InterfaceGlint", m_bRain);
+ GetProfile().SetIntProperty("Setup", "Soluce4", m_bSoluce4);
+ GetProfile().SetIntProperty("Setup", "Movies", m_bMovies);
+ GetProfile().SetIntProperty("Setup", "NiceReset", m_bNiceReset);
+ GetProfile().SetIntProperty("Setup", "HimselfDamage", m_bHimselfDamage);
+ GetProfile().SetIntProperty("Setup", "CameraScroll", m_bCameraScroll);
+ GetProfile().SetIntProperty("Setup", "CameraInvertX", m_bCameraInvertX);
+ GetProfile().SetIntProperty("Setup", "CameraInvertY", m_bCameraInvertY);
+ GetProfile().SetIntProperty("Setup", "InterfaceEffect", m_bEffect);
+ GetProfile().SetIntProperty("Setup", "Blood", m_bBlood);
+ GetProfile().SetIntProperty("Setup", "GroundShadow", m_engine->GetShadow());
+ GetProfile().SetIntProperty("Setup", "GroundSpot", m_engine->GetGroundSpot());
+ GetProfile().SetIntProperty("Setup", "ObjectDirty", m_engine->GetDirty());
+ GetProfile().SetIntProperty("Setup", "FogMode", m_engine->GetFog());
+ GetProfile().SetIntProperty("Setup", "LensMode", m_engine->GetLensMode());
+ GetProfile().SetIntProperty("Setup", "SkyMode", m_engine->GetSkyMode());
+ GetProfile().SetIntProperty("Setup", "PlanetMode", m_engine->GetPlanetMode());
+ GetProfile().SetIntProperty("Setup", "LightMode", m_engine->GetLightMode());
+ GetProfile().SetFloatProperty("Setup", "ParticleDensity", m_engine->GetParticleDensity());
+ GetProfile().SetFloatProperty("Setup", "ClippingDistance", m_engine->GetClippingDistance());
+ GetProfile().SetFloatProperty("Setup", "ObjectDetail", m_engine->GetObjectDetail());
+ GetProfile().SetFloatProperty("Setup", "GadgetQuantity", m_engine->GetGadgetQuantity());
+ GetProfile().SetIntProperty("Setup", "TextureQuality", m_engine->GetTextureQuality());
+ GetProfile().SetIntProperty("Setup", "TotoMode", m_engine->GetTotoMode());
+ GetProfile().SetIntProperty("Setup", "AudioVolume", m_sound->GetAudioVolume());
+ GetProfile().SetIntProperty("Setup", "MusicVolume", m_sound->GetMusicVolume());
+ GetProfile().SetIntProperty("Setup", "EditIndentMode", m_engine->GetEditIndentMode());
+ GetProfile().SetIntProperty("Setup", "EditIndentValue", m_engine->GetEditIndentValue());
/* screen setup */
if (m_setupFull)
- GetProfile().SetLocalProfileInt("Setup", "Fullscreen", 1);
+ GetProfile().SetIntProperty("Setup", "Fullscreen", 1);
else
- GetProfile().SetLocalProfileInt("Setup", "Fullscreen", 0);
+ GetProfile().SetIntProperty("Setup", "Fullscreen", 0);
CList *pl;
CWindow *pw;
@@ -5231,7 +5077,7 @@ void CMainDialog::SetupMemorize()
pl = static_cast<CList *>(pw->SearchControl(EVENT_LIST2));
if ( pl != 0 )
{
- GetProfile().SetLocalProfileInt("Setup", "Resolution", pl->GetSelect());
+ GetProfile().SetIntProperty("Setup", "Resolution", pl->GetSelect());
}
}
else
@@ -5248,9 +5094,9 @@ void CMainDialog::SetupMemorize()
key << b.secondary << " ";
}
- GetProfile().SetLocalProfileString("Setup", "KeyMap", key.str());
+ GetProfile().SetStringProperty("Setup", "KeyMap", key.str());
- GetProfile().SetLocalProfileInt("Setup", "DeleteGamer", m_bDeleteGamer);
+ GetProfile().SetIntProperty("Setup", "DeleteGamer", m_bDeleteGamer);
}
// Remember all the settings.
@@ -5261,48 +5107,38 @@ void CMainDialog::SetupRecall()
int iValue;
std::string key;
- if ( GetProfile().GetLocalProfileString("Directory", "scene", key) )
- {
- m_sceneDir = key;
- }
-
- if ( GetProfile().GetLocalProfileString("Directory", "savegame", key) )
+ if ( GetProfile().GetStringProperty("Directory", "savegame", key) )
{
m_savegameDir = key;
}
- if ( GetProfile().GetLocalProfileString("Directory", "public", key) )
+ if ( GetProfile().GetStringProperty("Directory", "public", key) )
{
m_publicDir = key;
}
- if ( GetProfile().GetLocalProfileString("Directory", "user", key) )
- {
- m_userDir = key;
- }
-
- if ( GetProfile().GetLocalProfileString("Directory", "files", key) )
+ if ( GetProfile().GetStringProperty("Directory", "files", key) )
{
m_filesDir = key;
}
- if ( GetProfile().GetLocalProfileInt("Setup", "TotoMode", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "TotoMode", iValue) )
{
m_engine->SetTotoMode(iValue);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "Tooltips", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "Tooltips", iValue) )
{
m_bTooltip = iValue;
}
- if ( GetProfile().GetLocalProfileInt("Setup", "InterfaceGlint", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "InterfaceGlint", iValue) )
{
m_bGlint = iValue;
}
- if ( GetProfile().GetLocalProfileInt("Setup", "InterfaceGlint", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "InterfaceGlint", iValue) )
{
m_bRain = iValue;
}
@@ -5313,86 +5149,91 @@ void CMainDialog::SetupRecall()
// m_engine->SetNiceMouse(iValue);
// }
- if ( GetProfile().GetLocalProfileInt("Setup", "Soluce4", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "Soluce4", iValue) )
{
m_bSoluce4 = iValue;
}
- if ( GetProfile().GetLocalProfileInt("Setup", "Movies", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "Movies", iValue) )
{
m_bMovies = iValue;
}
- if ( GetProfile().GetLocalProfileInt("Setup", "NiceReset", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "NiceReset", iValue) )
{
m_bNiceReset = iValue;
}
- if ( GetProfile().GetLocalProfileInt("Setup", "HimselfDamage", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "HimselfDamage", iValue) )
{
m_bHimselfDamage = iValue;
}
- if ( GetProfile().GetLocalProfileInt("Setup", "CameraScroll", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "CameraScroll", iValue) )
{
m_bCameraScroll = iValue;
m_camera->SetCameraScroll(m_bCameraScroll);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "CameraInvertX", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "CameraInvertX", iValue) )
{
m_bCameraInvertX = iValue;
m_camera->SetCameraInvertX(m_bCameraInvertX);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "CameraInvertY", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "CameraInvertY", iValue) )
{
m_bCameraInvertY = iValue;
m_camera->SetCameraInvertY(m_bCameraInvertY);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "InterfaceEffect", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "InterfaceEffect", iValue) )
{
m_bEffect = iValue;
}
- if ( GetProfile().GetLocalProfileInt("Setup", "GroundShadow", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "Blood", iValue) )
+ {
+ m_bBlood = iValue;
+ }
+
+ if ( GetProfile().GetIntProperty("Setup", "GroundShadow", iValue) )
{
m_engine->SetShadow(iValue);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "GroundSpot", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "GroundSpot", iValue) )
{
m_engine->SetGroundSpot(iValue);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "ObjectDirty", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "ObjectDirty", iValue) )
{
m_engine->SetDirty(iValue);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "FogMode", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "FogMode", iValue) )
{
m_engine->SetFog(iValue);
m_camera->SetOverBaseColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)); // TODO: color ok?
}
- if ( GetProfile().GetLocalProfileInt("Setup", "LensMode", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "LensMode", iValue) )
{
m_engine->SetLensMode(iValue);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "SkyMode", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "SkyMode", iValue) )
{
m_engine->SetSkyMode(iValue);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "PlanetMode", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "PlanetMode", iValue) )
{
m_engine->SetPlanetMode(iValue);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "LightMode", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "LightMode", iValue) )
{
m_engine->SetLightMode(iValue);
}
@@ -5402,52 +5243,52 @@ void CMainDialog::SetupRecall()
// m_engine->SetJoystick(iValue);
// }
- if ( GetProfile().GetLocalProfileFloat("Setup", "ParticleDensity", fValue) )
+ if ( GetProfile().GetFloatProperty("Setup", "ParticleDensity", fValue) )
{
m_engine->SetParticleDensity(fValue);
}
- if ( GetProfile().GetLocalProfileFloat("Setup", "ClippingDistance", fValue) )
+ if ( GetProfile().GetFloatProperty("Setup", "ClippingDistance", fValue) )
{
m_engine->SetClippingDistance(fValue);
}
- if ( GetProfile().GetLocalProfileFloat("Setup", "ObjectDetail", fValue) )
+ if ( GetProfile().GetFloatProperty("Setup", "ObjectDetail", fValue) )
{
m_engine->SetObjectDetail(fValue);
}
- if ( GetProfile().GetLocalProfileFloat("Setup", "GadgetQuantity", fValue) )
+ if ( GetProfile().GetFloatProperty("Setup", "GadgetQuantity", fValue) )
{
m_engine->SetGadgetQuantity(fValue);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "TextureQuality", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "TextureQuality", iValue) )
{
m_engine->SetTextureQuality(iValue);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "AudioVolume", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "AudioVolume", iValue) )
{
m_sound->SetAudioVolume(iValue);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "MusicVolume", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "MusicVolume", iValue) )
{
m_sound->SetMusicVolume(iValue);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "EditIndentMode", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "EditIndentMode", iValue) )
{
m_engine->SetEditIndentMode(iValue);
}
- if ( GetProfile().GetLocalProfileInt("Setup", "EditIndentValue", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "EditIndentValue", iValue) )
{
m_engine->SetEditIndentValue(iValue);
}
- if (GetProfile().GetLocalProfileString("Setup", "KeyMap", key))
+ if (GetProfile().GetStringProperty("Setup", "KeyMap", key))
{
std::stringstream skey;
skey.str(key);
@@ -5460,17 +5301,17 @@ void CMainDialog::SetupRecall()
}
}
- if ( GetProfile().GetLocalProfileInt("Setup", "DeleteGamer", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "DeleteGamer", iValue) )
{
m_bDeleteGamer = iValue;
}
- if ( GetProfile().GetLocalProfileInt("Setup", "Resolution", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "Resolution", iValue) )
{
m_setupSelMode = iValue;
}
- if ( GetProfile().GetLocalProfileInt("Setup", "Fullscreen", iValue) )
+ if ( GetProfile().GetIntProperty("Setup", "Fullscreen", iValue) )
{
m_setupFull = (iValue == 1);
}
@@ -5852,12 +5693,6 @@ void CMainDialog::StartDialog(Math::Point dim, bool bFire, bool bOK, bool bCance
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW8));
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
- pb = static_cast<CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT));
- if ( pb != 0 )
- {
- pb->ClearState(STATE_VISIBLE);
- }
-
m_bDialogFire = bFire;
std::string name;
@@ -6011,7 +5846,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);
@@ -6040,12 +5874,6 @@ void CMainDialog::StopDialog()
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW8));
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
- pb = static_cast<CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT));
- if ( pb != 0 )
- {
- pb->SetState(STATE_VISIBLE);
- }
-
StopSuspend();
m_interface->DeleteControl(EVENT_WINDOW9);
m_bDialog = false;
@@ -6174,7 +6002,13 @@ bool CMainDialog::GetSceneSoluce()
// Returns the name of the folder to save.
-std::string & CMainDialog::GetSavegameDir()
+std::string CMainDialog::GetSavegameDir()
+{
+ return CResourceManager::GetSaveLocation()+"/"+m_savegameDir;
+}
+
+//TODO: Use PHYSFS everywhere
+std::string & CMainDialog::GetPHYSFSSavegameDir()
{
return m_savegameDir;
}
@@ -6232,7 +6066,7 @@ void CMainDialog::WriteGamerPerso(char *gamer)
char filename[100];
char line[100];
- sprintf(filename, "%s/%s/face.gam", m_savegameDir.c_str(), gamer);
+ sprintf(filename, "%s/%s/face.gam", GetSavegameDir().c_str(), gamer);
file = fopen(filename, "w");
if ( file == NULL ) return;
@@ -6265,7 +6099,7 @@ void CMainDialog::ReadGamerPerso(char *gamer)
m_perso.face = 0;
DefPerso();
- sprintf(filename, "%s/%s/face.gam", m_savegameDir.c_str(), gamer);
+ sprintf(filename, "%s/%s/face.gam", GetSavegameDir().c_str(), gamer);
file = fopen(filename, "r");
if ( file == NULL ) return;
@@ -6374,7 +6208,7 @@ bool CMainDialog::ReadGamerInfo()
m_sceneInfo[i].bPassed = false;
}
- sprintf(line, "%s/%s/%s.gam", m_savegameDir.c_str(), m_main->GetGamerName(), m_sceneName);
+ sprintf(line, "%s/%s/%s.gam", GetSavegameDir().c_str(), m_main->GetGamerName(), m_sceneName);
file = fopen(line, "r");
if ( file == NULL ) return false;
@@ -6410,7 +6244,7 @@ bool CMainDialog::WriteGamerInfo()
char line[100];
int i;
- sprintf(line, "%s/%s/%s.gam", m_savegameDir.c_str(), m_main->GetGamerName(), m_sceneName);
+ sprintf(line, "%s/%s/%s.gam", GetSavegameDir().c_str(), m_main->GetGamerName(), m_sceneName);
file = fopen(line, "w");
if ( file == NULL ) return false;
@@ -6420,7 +6254,7 @@ bool CMainDialog::WriteGamerInfo()
for ( i=0 ; i<MAXSCENE ; i++ )
{
- if ( m_sceneInfo[i].numTry == 0 ) continue;
+ if ( m_sceneInfo[i].numTry == 0 && !m_sceneInfo[i].bPassed ) continue;
sprintf(line, "Chapter %d: Scene %d: numTry=%d passed=%d\n",
i/100, i%100, m_sceneInfo[i].numTry, m_sceneInfo[i].bPassed);
@@ -6487,6 +6321,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 444a568..355b18e 100644
--- a/src/ui/maindialog.h
+++ b/src/ui/maindialog.h
@@ -1,18 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// maindialog.h
@@ -88,7 +91,8 @@ public:
int GetSceneRank();
const char* GetSceneDir();
bool GetSceneSoluce();
- std::string & GetSavegameDir();
+ std::string GetSavegameDir();
+ std::string & GetPHYSFSSavegameDir();
std::string & GetPublicDir();
bool GetTooltip();
@@ -98,8 +102,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();
@@ -140,6 +143,8 @@ public:
void AllMissionUpdate();
void ShowSoluceUpdate();
+
+ std::string& GetUserLevelName(int id);
protected:
void GlintMove();
@@ -169,7 +174,6 @@ protected:
void UpdateSceneChap(int &chap);
void UpdateSceneList(int chap, int &sel);
void UpdateSceneResume(int rank);
- void UpdateDisplayDevice();
void UpdateDisplayMode();
void ChangeDisplay();
void UpdateApply();
@@ -200,10 +204,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
@@ -229,7 +231,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;
@@ -244,6 +245,7 @@ protected:
bool m_bCameraInvertX; // for CCamera
bool m_bCameraInvertY; // for CCamera
bool m_bEffect; // for CCamera
+ bool m_bBlood; // for CCamera
Math::Point m_glintMouse;
float m_glintTime;
diff --git a/src/ui/mainmap.cpp b/src/ui/mainmap.cpp
index 8c81160..11b2517 100644
--- a/src/ui/mainmap.cpp
+++ b/src/ui/mainmap.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/mainmap.h"
diff --git a/src/ui/mainmap.h b/src/ui/mainmap.h
index 9b20548..0cc7959 100644
--- a/src/ui/mainmap.h
+++ b/src/ui/mainmap.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// mainmap.h
diff --git a/src/ui/mainshort.cpp b/src/ui/mainshort.cpp
index f6dce4b..76fd569 100644
--- a/src/ui/mainshort.cpp
+++ b/src/ui/mainshort.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/mainshort.h"
diff --git a/src/ui/mainshort.h b/src/ui/mainshort.h
index b185aed..1d0a327 100644
--- a/src/ui/mainshort.h
+++ b/src/ui/mainshort.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// mainshort.h
diff --git a/src/ui/map.cpp b/src/ui/map.cpp
index c5f0062..f3f569a 100644
--- a/src/ui/map.cpp
+++ b/src/ui/map.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/map.h"
@@ -322,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);
@@ -330,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;
@@ -469,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;
@@ -529,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 )
{
@@ -672,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 )
{
@@ -698,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;
@@ -718,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;
@@ -728,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;
@@ -738,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;
@@ -748,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;
@@ -758,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;
@@ -779,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 )
{
@@ -894,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;
@@ -1052,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/map.h b/src/ui/map.h
index 4ebe688..e1ad1a2 100644
--- a/src/ui/map.h
+++ b/src/ui/map.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// map.h
diff --git a/src/ui/scroll.cpp b/src/ui/scroll.cpp
index b3422ec..32c5818 100644
--- a/src/ui/scroll.cpp
+++ b/src/ui/scroll.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/scroll.h"
@@ -379,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;
@@ -389,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;
@@ -399,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;
@@ -409,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/scroll.h b/src/ui/scroll.h
index c115aa4..505af09 100644
--- a/src/ui/scroll.h
+++ b/src/ui/scroll.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// scroll.h
diff --git a/src/ui/shortcut.cpp b/src/ui/shortcut.cpp
index a01864a..81495a7 100644
--- a/src/ui/shortcut.cpp
+++ b/src/ui/shortcut.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/shortcut.h"
@@ -114,7 +116,7 @@ void CShortcut::Draw()
zoom = 1.0f;
}
- m_engine->SetTexture("button3.png");
+ m_engine->SetTexture("textures/interface/button3.png");
if ( icon != -1 )
{
@@ -130,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;
@@ -170,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/shortcut.h b/src/ui/shortcut.h
index 6495ba0..9f3a339 100644
--- a/src/ui/shortcut.h
+++ b/src/ui/shortcut.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// shortcut.h
diff --git a/src/ui/slider.cpp b/src/ui/slider.cpp
index 33293d1..58fcc26 100644
--- a/src/ui/slider.cpp
+++ b/src/ui/slider.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/slider.h"
@@ -498,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;
@@ -510,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;
@@ -522,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/slider.h b/src/ui/slider.h
index bc38aec..c55d64b 100644
--- a/src/ui/slider.h
+++ b/src/ui/slider.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// slider.h
diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp
index f83704e..efdbbbc 100644
--- a/src/ui/studio.cpp
+++ b/src/ui/studio.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/studio.h"
@@ -22,6 +24,8 @@
#include "app/app.h"
+#include "common/resources/resourcemanager.h"
+
#include "common/event.h"
#include "common/misc.h"
@@ -167,7 +171,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();
}
@@ -573,10 +577,6 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank)
m_bRealTime = m_bRunning;
m_script->SetStepMode(!m_bRealTime);
- button = static_cast< CButton* >(m_interface->SearchControl(EVENT_BUTTON_QUIT));
- 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);
@@ -638,7 +638,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);
@@ -854,7 +854,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;
@@ -877,12 +876,6 @@ bool CStudio::StopEditScript(bool bCancel)
m_interface->DeleteControl(EVENT_WINDOW3);
- button = static_cast< CButton* >(m_interface->SearchControl(EVENT_BUTTON_QUIT));
- if ( button != 0 )
- {
- button->SetState(STATE_VISIBLE);
- }
-
m_pause->SetPause(m_bInitPause);
m_sound->MuteAll(false);
m_main->SetEditLock(false, true);
@@ -1532,8 +1525,8 @@ void CStudio::UpdateDialogList()
// Constructs the name of the folder or open/save.
// If the folder does not exist, it will be created.
-
-std::string CStudio::SearchDirectory(bool bCreate)
+//TODO: Refactor to PHYSFS
+std::string CStudio::SearchDirectory(bool bCreate, bool physfsReady)
{
char dir[MAX_FNAME];
if ( m_main->GetIOPublic() )
@@ -1545,14 +1538,20 @@ std::string CStudio::SearchDirectory(bool bCreate)
sprintf(dir, "%s/%s/Program/", m_main->GetSavegameDir(), m_main->GetGamerName());
}
- fs::path path = fs::path(dir);
-
if ( bCreate )
{
- fs::create_directory(path);
+ fs::path path = fs::path(dir);
+ fs::create_directories(path);
}
- return path.make_preferred().string();
+ std::string dir2 = dir;
+ if(physfsReady) {
+ std::string savedir = CResourceManager::GetSaveLocation()+"/";
+ boost::replace_all(dir2, "\\", "/");
+ boost::replace_all(savedir, "\\", "/");
+ boost::replace_all(dir2, savedir, "");
+ }
+ return dir2;
}
// Reads a new program.
@@ -1578,7 +1577,7 @@ bool CStudio::ReadProgram()
{
strcat(filename, ".txt");
}
- strcpy(dir, SearchDirectory(true).c_str());
+ strcpy(dir, SearchDirectory(true, true).c_str());
strcat(dir, filename);
pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3));
@@ -1616,14 +1615,14 @@ bool CStudio::WriteProgram()
{
strcat(filename, ".txt");
}
- strcpy(dir, SearchDirectory(true).c_str());
+ strcpy(dir, SearchDirectory(true, true).c_str());
strcat(dir, filename);
pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3));
if ( pw == nullptr ) return false;
pe = static_cast< CEdit* >(pw->SearchControl(EVENT_STUDIO_EDIT));
if ( pe == nullptr ) return false;
-
+
if ( !pe->WriteText(std::string(dir)) ) return false;
m_script->SetFilename(filename);
diff --git a/src/ui/studio.h b/src/ui/studio.h
index d1c6a51..dda1368 100644
--- a/src/ui/studio.h
+++ b/src/ui/studio.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// studio.h
@@ -86,7 +88,7 @@ protected:
void UpdateDialogAction();
void UpdateDialogPublic();
void UpdateDialogList();
- std::string SearchDirectory(bool bCreate);
+ std::string SearchDirectory(bool bCreate, bool physfsReady=false);
bool ReadProgram();
bool WriteProgram();
diff --git a/src/ui/target.cpp b/src/ui/target.cpp
index 455c530..a406820 100644
--- a/src/ui/target.cpp
+++ b/src/ui/target.cpp
@@ -1,18 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/target.h"
diff --git a/src/ui/target.h b/src/ui/target.h
index 2344e59..4f95b6c 100644
--- a/src/ui/target.h
+++ b/src/ui/target.h
@@ -1,18 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// target.h
diff --git a/src/ui/window.cpp b/src/ui/window.cpp
index 98e1e6c..7b57a2f 100644
--- a/src/ui/window.cpp
+++ b/src/ui/window.cpp
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
#include "ui/window.h"
@@ -64,34 +66,20 @@ CWindow::~CWindow()
void CWindow::Flush()
{
- int i;
-
- for ( i=0 ; i<MAXWINDOW ; i++ )
+ for (int i = 0 ; i < MAXWINDOW; i++)
{
- if ( m_table[i] != 0 )
- {
- delete m_table[i];
- m_table[i] = 0;
- }
+ delete m_table[i];
+ m_table[i] = nullptr;
}
- if ( m_buttonReduce != 0 )
- {
- delete m_buttonReduce;
- m_buttonReduce = 0;
- }
+ delete m_buttonReduce;
+ m_buttonReduce = nullptr;
- if ( m_buttonFull != 0 )
- {
- delete m_buttonFull;
- m_buttonFull = 0;
- }
+ delete m_buttonFull;
+ m_buttonFull = nullptr;
- if ( m_buttonClose != 0 )
- {
- delete m_buttonClose;
- m_buttonClose = 0;
- }
+ delete m_buttonClose;
+ m_buttonClose = nullptr;
}
@@ -583,23 +571,14 @@ void CWindow::SetName(std::string name, bool tooltip)
CControl::SetName(name, tooltip);
- if ( m_buttonReduce != 0 )
- {
- delete m_buttonReduce;
- m_buttonReduce = 0;
- }
+ delete m_buttonReduce;
+ m_buttonReduce = nullptr;
- if ( m_buttonFull != 0 )
- {
- delete m_buttonFull;
- m_buttonFull = 0;
- }
+ delete m_buttonFull;
+ m_buttonFull = nullptr;
- if ( m_buttonClose != 0 )
- {
- delete m_buttonClose;
- m_buttonClose = 0;
- }
+ delete m_buttonClose;
+ m_buttonClose = nullptr;
bAdjust = false;
@@ -1174,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;
@@ -1190,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;
@@ -1204,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;
@@ -1218,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;
@@ -1237,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;
@@ -1254,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;
@@ -1273,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;
@@ -1309,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;
@@ -1320,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;
@@ -1392,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;
@@ -1406,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;
@@ -1420,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;
@@ -1434,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;
@@ -1450,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;
@@ -1470,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;
@@ -1484,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;
@@ -1500,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;
@@ -1516,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;
@@ -1542,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;
diff --git a/src/ui/window.h b/src/ui/window.h
index 87805e2..701407e 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -1,19 +1,21 @@
-// * This file is part of the COLOBOT source code
-// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
-// *
-// * This program is free software: you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation, either version 3 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://gnu.org/licenses
+ */
// window.h