[colobot] branch debian/sid updated (107e52b - 700b651)
This is an automated email from the git hooks/post-receive script. odyx pushed a change to branch debian/sid in repository colobot. from 107e52b colobot 0.1.5-1 Debian release new 0a63e96 Install the OpenGL 2.1 and 3.3 shaders in colobot-common new 700b651 colobot 0.1.5-2 Debian release The 2 revisions listed above as new are entirely new to this repository and will be described in separate emails. The revisions listed as adds were already present in the repository and have only been added to this reference. Summary of changes: debian/changelog | 6 ++ debian/colobot-common.install | 1 + 2 files changed, 7 insertions(+) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] annotated tag debian/0.1.5-2 created (now f9b05aa)
This is an automated email from the git hooks/post-receive script. odyx pushed a change to annotated tag debian/0.1.5-2 in repository colobot. at f9b05aa (tag) tagging 700b6512cf1110c586064a14504929a726ef92be (commit) replaces debian/0.1.5-1 tagged by Didier Raboud on Wed Jun 17 09:52:17 2015 +0200 - Log - colobot 0.1.5-2 Debian release -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQGcBAABCAAGBQJVgT41AAoJEIvPpx7KFjRVtMUL/2KkBofsMsgICrW7JdJRahow NYJdHlYnDmNuATGUUJjjwzjATfFqFMRO2XgxfEMGDUBcgevNwXBA090EgLbQLd7b kmyPYa3Dw9+mGRJivvj+nx6Pu2xgFddfOcw/ajATJP9ATjzHUyFAHBSttbf5d8JX elj5k8hb13IJRHZLCbAQMUpGmgM4ysDAz6wFfpfgf4Zm0eNcHFnyZcNhHDycuIbY z82dq9SzUg0ZtSgCeDxuj/rwz/yaTBZsno9t2gzXR5ulcgnidKKdC+Ayf0b9rOgn TFzdUBPyufgdapKXCkP5G4glGpKEubt0jR8V3I+r5zMbdQ3TmnpveDKwkcGo8VHz 48dbYmfakNokzvDEhO7QtY1fedfO9Ycs5tJnFoZYDKkpRK2OWKg6imaFj59zvrB3 dBNNvd54QhW+/fknb3CiC7GCes8olhbXXBzN0ibYJ5Ef3lY4aKnb2Tt0S3ELvsFF 2WFPCB/J/jGoom82UdmweatRZAnt2FdDlic4WKKbjA== =tL6f -END PGP SIGNATURE- Didier Raboud (2): Install the OpenGL 2.1 and 3.3 shaders in colobot-common colobot 0.1.5-2 Debian release --- This annotated tag includes the following new commits: new 0a63e96 Install the OpenGL 2.1 and 3.3 shaders in colobot-common new 700b651 colobot 0.1.5-2 Debian release The 2 revisions listed above as new are entirely new to this repository and will be described in separate emails. The revisions listed as adds were already present in the repository and have only been added to this reference. -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 01/02: Install the OpenGL 2.1 and 3.3 shaders in colobot-common
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch debian/sid in repository colobot. commit 0a63e964c9c0610ef17325ce099a0f93ca9297b2 Author: Didier Raboud o...@debian.org Date: Wed Jun 17 09:52:07 2015 +0200 Install the OpenGL 2.1 and 3.3 shaders in colobot-common --- debian/colobot-common.install | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/colobot-common.install b/debian/colobot-common.install index 0d05865..ac0faa9 100644 --- a/debian/colobot-common.install +++ b/debian/colobot-common.install @@ -3,3 +3,4 @@ usr/share/games/colobot/help usr/share/games/colobot/icons usr/share/games/colobot/levels usr/share/games/colobot/models +usr/share/games/colobot/shaders -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 02/02: colobot 0.1.5-2 Debian release
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch debian/sid in repository colobot. commit 700b6512cf1110c586064a14504929a726ef92be Author: Didier Raboud o...@debian.org Date: Wed Jun 17 09:52:17 2015 +0200 colobot 0.1.5-2 Debian release --- debian/changelog | 6 ++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index b662e64..42b668b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +colobot (0.1.5-2) unstable; urgency=medium + + * Install the OpenGL 2.1 and 3.3 shaders in colobot-common + + -- Didier Raboud o...@debian.org Wed, 17 Jun 2015 09:52:17 +0200 + colobot (0.1.5-1) unstable; urgency=low * New 0.1.5 upstream release -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 39/390: Auto-update from Pootle 2014-08-05
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 73d6d945119561c227b2d6eab810b1db78752cbf Author: krzys-h krzy...@interia.pl Date: Tue Aug 5 04:33:13 2014 +0200 Auto-update from Pootle 2014-08-05 This commit was automatically generated from http://translations.colobot.info/ --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index 29947d2..ea18354 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 29947d2c372713e9dd499c2d75a5f34793aab975 +Subproject commit ea1835405d8b33ecc9d9f53848abb724eaf59a22 -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 41/390: Removed some unused code
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit a56e69883fe74618db71b18b1748f15c06eafc29 Author: krzys-h krzy...@interia.pl Date: Wed Aug 6 16:57:59 2014 +0200 Removed some unused code --- src/CBot/ClassFILE.cpp | 426 --- src/object/robotmain.cpp | 193 - src/object/robotmain.h | 1 - 3 files changed, 620 deletions(-) diff --git a/src/CBot/ClassFILE.cpp b/src/CBot/ClassFILE.cpp deleted file mode 100644 index 6906bd4..000 --- a/src/CBot/ClassFILE.cpp +++ /dev/null @@ -1,426 +0,0 @@ -// * 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/. - -// definition of methods for class FILE - - - -// Static variables - -static CBotClass* m_pClassFILE; -static CBotProgram* m_pFuncFile; -static int m_CompteurFileOpen = 0; - - - -// Prepares a file name. - -void PrepareFilename(CBotString filename) //DD! -{ -int pos; - -pos = filename.ReverseFind('\\'); -if ( pos 0 ) -{ -filename = filename.Mid(pos+1); // remove the records (files)?? -} - -pos = filename.ReverseFind('/'); -if ( pos 0 ) -{ -filename = filename.Mid(pos+1); // also those with / -} - -pos = filename.ReverseFind(':'); -if ( pos 0 ) -{ -filename = filename.Mid(pos+1); // also removes the drive letter C: -} - -filename = CBotString(files\\) + filename; -} - - -// constructor of the class -// gets the filename as a parameter - -// execution -bool rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int Exception) -{ -CBotString mode; - -// accepts no parameters -if ( pVar == NULL ) return true; - -// must be a string -if ( pVar-GetType() != CBotTypString ) { Exception = CBotErrBadString; return false; } - -CBotString filename = pVar-GetValString(); -PrepareFilename(filename); //DR - -// there may be a second parameter -pVar = pVar-GetNext(); -if ( pVar != NULL ) -{ -// recovers the mode -mode = pVar-GetValString(); -if ( mode != r mode != w ) { Exception = CBotErrBadParam; return false; } - -// no third parameter, only two or one possible -if ( pVar-GetNext() != NULL ) { Exception = CBotErrOverParam; return false; } -} - -// save the file name -pVar = pThis-GetItem(filename); -pVar-SetValString(filename); - -if ( ! mode.IsEmpty() ) -{ -// open the called file -FILE* pFile = fopen( filename, mode ); -if ( pFile == NULL ) { Exception = CBotErrFileOpen; return false; } - -m_CompteurFileOpen ++; - -// save the handle of file -pVar = pThis-GetItem(handle); -pVar-SetValInt((long)pFile); -} - -return true; -} - -// compilation -CBotTypResult cfconstruct (CBotVar* pThis, CBotVar* pVar) -{ -// accepts no parameters -if ( pVar == NULL ) return CBotTypResult( 0 ); - -// must be a string -if ( pVar-GetType() != CBotTypString ) -return CBotTypResult( CBotErrBadString ); - -// there may be a second parameter -pVar = pVar-GetNext(); -if ( pVar != NULL ) -{ -// must be a string -if ( pVar-GetType() != CBotTypString ) -return CBotTypResult( CBotErrBadString ); -// no third parameter -if ( pVar-GetNext() != NULL ) return CBotTypResult( CBotErrOverParam ); -} - -// le r�sultat est de type void (constructeur) -return CBotTypResult( 0 ); -} - - -// destructor of the class - -// execution -bool rfdestruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int Exception) -{ -// retrieves the element handle -pVar = pThis-GetItem(handle); - -// not open? no problem -if ( pVar-GetInit() != IS_DEF) return true; - -FILE* pFile= (FILE*)pVar-GetValInt(); -fclose(pFile); -m_CompteurFileOpen --; - -pVar-SetInit(IS_NAN); - -return true; -} - - -// FILE :: open method -// get the r / w mode as a parameter - -// execution -bool rfopen (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int Exception) -{ -// there must
[colobot] 40/390: Restored -datadir and -langdir arguments, added -savedir
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 0b2f25a6e3fda014b0f5a4282283fb90b0958d42 Author: krzys-h krzy...@interia.pl Date: Wed Aug 6 12:27:17 2014 +0200 Restored -datadir and -langdir arguments, added -savedir Also, fixed some crashes when unable to open file --- src/app/app.cpp | 68 +++- src/app/app.h| 9 + src/app/main.cpp | 5 --- src/app/system.cpp | 10 + src/app/system.h | 6 +++ src/app/system_macosx.cpp| 11 +- src/app/system_macosx.h | 2 + src/common/resources/resourcemanager.cpp | 6 --- src/common/resources/resourcemanager.h | 1 - src/common/resources/sndfile.cpp | 11 +++--- src/graphics/engine/text.cpp | 8 +++- 11 files changed, 99 insertions(+), 38 deletions(-) diff --git a/src/app/app.cpp b/src/app/app.cpp index cf509f9..429a9d4 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -146,6 +146,10 @@ CApplication::CApplication() m_kmodState = 0; m_mouseButtonsState = 0; m_trackedKeys = 0; + +m_dataPath = GetSystemUtils()-GetDataPath(); +m_langPath = GetSystemUtils()-GetLangPath(); +m_savePath = GetSystemUtils()-GetSaveDir(); m_runSceneName = ; m_runSceneRank = 0; @@ -208,8 +212,10 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) OPT_LOGLEVEL, OPT_LANGUAGE, OPT_LANGDIR, -OPT_VBO, -OPT_MOD +OPT_DATADIR, +OPT_SAVEDIR, +OPT_MOD, +OPT_VBO }; option options[] = @@ -221,8 +227,10 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) { loglevel, required_argument, nullptr, OPT_LOGLEVEL }, { language, required_argument, nullptr, OPT_LANGUAGE }, { langdir, required_argument, nullptr, OPT_LANGDIR }, -{ vbo, required_argument, nullptr, OPT_VBO }, +{ datadir, required_argument, nullptr, OPT_DATADIR }, +{ savedir, required_argument, nullptr, OPT_SAVEDIR }, { mod, required_argument, nullptr, OPT_MOD }, +{ vbo, required_argument, nullptr, OPT_VBO }, { nullptr, 0, nullptr, 0} }; @@ -260,8 +268,10 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) GetLogger()-Message( -loglevel level set log level to level (one of: trace, debug, info, warn, error, none)\n); GetLogger()-Message( -language lang set language (one of: en, de, fr, pl, ru)\n); GetLogger()-Message( -langdir path set custom language directory path\n); -GetLogger()-Message( -vbo mode set OpenGL VBO mode (one of: auto, enable, disable)\n); +GetLogger()-Message( -datadir path set custom data directory path\n); +GetLogger()-Message( -savedir path set custom save directory path (must be writable)\n); GetLogger()-Message( -mod path load datadir mod from given path\n); +GetLogger()-Message( -vbo mode set OpenGL VBO mode (one of: auto, enable, disable)\n); return PARSE_ARGS_HELP; } case OPT_DEBUG: @@ -341,11 +351,28 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) break; } +case OPT_DATADIR: +{ +m_dataPath = optarg; +GetLogger()-Info(Using data dir: '%s'\n, optarg); +break; +} +case OPT_LANGDIR: +{ +m_langPath = optarg; +GetLogger()-Info(Using language dir: '%s'\n, optarg); +break; +} +case OPT_SAVEDIR: +{ +m_savePath = optarg; +GetLogger()-Info(Using save dir: '%s'\n, optarg); +break; +} case OPT_MOD: { -GetLogger()-Info(Loading mod from \%s\\n, optarg); +GetLogger()-Info(Loading mod: '%s'\n, optarg); CResourceManager::AddLocation(optarg, true); - break; } default: @@ -362,23 +389,28 @@ bool CApplication::Create() bool defaultValues = false; GetLogger()-Info(Creating CApplication\n); - -if (!GetProfile().InitCurrentDirectory()) -{ -GetLogger()-Warn(Config not found. Default values will be used!\n); -defaultValues = true; -} - -boost::filesystem::path dataPath(COLOBOT_DEFAULT_DATADIR); + +boost::filesystem::path dataPath(m_dataPath); if (! (boost::filesystem::exists(dataPath)
[colobot] 36/390: Auto-update from Pootle 2014-07-26
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 5860684e782092031480a0e424ad35485609b04e Author: krzys-h krzy...@interia.pl Date: Sat Jul 26 04:33:05 2014 +0200 Auto-update from Pootle 2014-07-26 This commit was automatically generated from http://translations.colobot.info/ --- data | 2 +- po/de.po | 9 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/data b/data index 9ee3b6b..b00b9cd 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 9ee3b6b3b8944253d5dd2611980529d40eff13d4 +Subproject commit b00b9cd26e445dcef52d29b3a3db3253dd4c3137 diff --git a/po/de.po b/po/de.po index ab932d3..34ae436 100644 --- a/po/de.po +++ b/po/de.po @@ -7,8 +7,8 @@ msgstr Project-Id-Version: PACKAGE VERSION\n Report-Msgid-Bugs-To: \n POT-Creation-Date: 2014-07-10 16:50+0200\n -PO-Revision-Date: 2014-07-22 20:26+0200\n -Last-Translator: GermanBot timgoettlic...@yahoo.de\n +PO-Revision-Date: 2014-07-25 20:39+0200\n +Last-Translator: krzys_h krzy...@interia.pl\n Language-Team: LANGUAGE l...@li.org\n Language: de\n MIME-Version: 1.0\n @@ -18,7 +18,7 @@ msgstr X-Generator: Pootle 2.5.1.1\n X-Language: de_DE\n X-Source-Language: en_US\n -X-POOTLE-MTIME: 1406057163.00\n +X-POOTLE-MTIME: 1406317182.00\n msgid Colobot rules! msgstr Colobot ist wunderbar! @@ -178,7 +178,7 @@ msgid Cancel msgstr Abbrechen msgid LOADING -msgstr Laden +msgstr LOADING msgid Keyword help(\\key cbot;) msgstr Hilfe über den Begriff (\\key cbot;) @@ -1690,6 +1690,7 @@ msgstr Diese Klasse gibt es schon msgid \ ] \ missing msgstr Es fehlt eine geschlossene eckige Klammer \ ] \ +#, fuzzy msgid Reserved keyword of CBOT language msgstr Dieses Wort ist reserviert -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 42/390: Fixed #314
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 4a202a086fd5ca0f2d84bdb3bf7d1e6f7deb84c0 Author: krzys-h krzy...@interia.pl Date: Wed Aug 6 17:18:52 2014 +0200 Fixed #314 --- src/graphics/engine/engine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index d0b37a5..e4bf068 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -1965,10 +1965,10 @@ bool CEngine::IsWithinLODLimit(float distance, LODLevel lodLevel) } min *= m_size.x / 640.0f; -min *= m_objectDetail*2.0f; +min *= 1.0f+m_objectDetail*2.0f; max *= m_size.x / 640.0f; -max *= m_objectDetail*2.0f; +max *= 1.0f+m_objectDetail*2.0f; } return distance = min distance max; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 46/390: Fixed #315
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit ea0615ee05b0812f2bb5d7d8b970b3f83999a319 Author: krzys-h krzy...@interia.pl Date: Fri Aug 8 14:03:43 2014 +0200 Fixed #315 --- src/ui/edit.cpp | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index e2df62b..24d02e9 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -373,23 +373,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; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 45/390: Updated submodule
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 17fe2b3d61ea14a083a6e077b827d3e41361a8f8 Author: krzys-h krzy...@interia.pl Date: Fri Aug 8 13:41:31 2014 +0200 Updated submodule --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index bbc351c..a521070 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit bbc351c29b739b3031922aef06493fd4a404bbbf +Subproject commit a521070bb17737e1d3990ba09d09d036749635ab -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 48/390: Remove some more delete checks (#318)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 9de086390bc925b6eb8cbfe332c1985e4b715d61 Author: Piotr Dziwinski piot...@gmail.com Date: Sun Aug 10 17:51:47 2014 +0200 Remove some more delete checks (#318) --- src/app/app.cpp | 21 ++--- src/ui/edit.cpp | 17 + src/ui/list.cpp | 6 ++ src/ui/window.cpp | 53 +++-- 4 files changed, 28 insertions(+), 69 deletions(-) diff --git a/src/app/app.cpp b/src/app/app.cpp index 8b310c9..83a520a 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -598,23 +598,14 @@ void CApplication::Destroy() { m_joystickEnabled = false; -if (m_robotMain != nullptr) -{ -delete m_robotMain; -m_robotMain = nullptr; -} +delete m_robotMain; +m_robotMain = nullptr; -if (m_sound != nullptr) -{ -delete m_sound; -m_sound = nullptr; -} +delete m_sound; +m_sound = nullptr; -if (m_modelManager != nullptr) -{ -delete m_modelManager; -m_modelManager = nullptr; -} +delete m_modelManager; +m_modelManager = nullptr; if (m_engine != nullptr) { diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index 24d02e9..4132896 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -115,21 +115,16 @@ CEdit::CEdit () : CControl () CEdit::~CEdit() { -int i; - FreeImage(); -for ( i=0 ; iEDITUNDOMAX ; 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; @@ -1479,8 +1474,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); @@ -1958,8 +1952,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/list.cpp b/src/ui/list.cpp index f6c3ed9..b3e55e1 100644 --- a/src/ui/list.cpp +++ b/src/ui/list.cpp @@ -61,12 +61,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; } diff --git a/src/ui/window.cpp b/src/ui/window.cpp index 98e1e6c..21e2b30 100644 --- a/src/ui/window.cpp +++ b/src/ui/window.cpp @@ -64,34 +64,20 @@ CWindow::~CWindow() void CWindow::Flush() { -int i; - -for ( i=0 ; iMAXWINDOW ; 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 +569,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; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 34/390: Saving colobot.ini through physfs
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 9a3cd67c3bb2f7d0d4b83f6a5ac8bbcfedf4207b Author: krzys-h krzy...@interia.pl Date: Thu Jul 24 23:38:13 2014 +0200 Saving colobot.ini through physfs --- src/app/main.cpp| 4 src/app/system.cpp | 4 ++-- src/app/system.h| 4 ++-- src/app/system_linux.cpp| 24 +++ src/app/system_linux.h | 2 +- src/app/system_macosx.cpp | 11 ++- src/app/system_macosx.h | 2 +- src/app/system_windows.cpp | 16 +++ src/app/system_windows.h| 2 +- src/common/profile.cpp | 30 +++-- src/common/resources/outputstreambuffer.cpp | 1 + src/common/resources/resourcemanager.cpp| 23 +++--- 12 files changed, 70 insertions(+), 53 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 6ba8da2..294b306 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -102,6 +102,9 @@ int SDL_MAIN_FUNC(int argc, char *argv[]) { return app-GetExitCode(); } + +manager.SetSaveLocation(systemUtils-GetSaveDir()); +manager.AddLocation(systemUtils-GetSaveDir(), true); int code = 0; @@ -121,6 +124,7 @@ int SDL_MAIN_FUNC(int argc, char *argv[]) delete app; delete systemUtils; +//delete manager; logger.Info(Exiting with code %d\n, code); return code; diff --git a/src/app/system.cpp b/src/app/system.cpp index b2e6b47..66d08e5 100644 --- a/src/app/system.cpp +++ b/src/app/system.cpp @@ -192,7 +192,7 @@ float CSystemUtils::TimeStampDiff(SystemTimeStamp *before, SystemTimeStamp *afte return result; } -std::string CSystemUtils::GetProfileFileLocation() +std::string CSystemUtils::GetSaveDir() { -return std::string(colobot.ini); +return std::string(save); } diff --git a/src/app/system.h b/src/app/system.h index 01f2672..6d2fe58 100644 --- a/src/app/system.h +++ b/src/app/system.h @@ -130,8 +130,8 @@ public: /** The difference is \a after - \a before. */ virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) = 0; -//! Returns the profile (colobot.ini) file location -virtual std::string GetProfileFileLocation(); +//! Returns the save dir location +virtual std::string GetSaveDir(); }; //! Global function to get CSystemUtils instance diff --git a/src/app/system_linux.cpp b/src/app/system_linux.cpp index e584cd1..485d7c2 100644 --- a/src/app/system_linux.cpp +++ b/src/app/system_linux.cpp @@ -95,29 +95,29 @@ long long CSystemUtilsLinux::TimeStampExactDiff(SystemTimeStamp *before, SystemT (after-clockTime.tv_sec - before-clockTime.tv_sec) * 10ll; } -std::string CSystemUtilsLinux::GetProfileFileLocation() +std::string CSystemUtilsLinux::GetSaveDir() { -std::string profileFile; - -// Determine profileFile according to XDG Base Directory Specification -char* envXDG_CONFIG_HOME = getenv(XDG_CONFIG_HOME); -if (envXDG_CONFIG_HOME == NULL) +std::string savegameDir; + +// Determine savegame dir according to XDG Base Directory Specification +char *envXDG_DATA_HOME = getenv(XDG_CONFIG_DATA); +if (envXDG_DATA_HOME == NULL) { char *envHOME = getenv(HOME); if (envHOME == NULL) { -profileFile = colobot.ini; +savegameDir = /tmp/colobot-save; } else { -profileFile = std::string(envHOME) + /.config/colobot.ini; +savegameDir = std::string(envHOME) + /.local/share/colobot; } } else { -profileFile = std::string(envXDG_CONFIG_HOME) + /colobot.ini; +savegameDir = std::string(envXDG_DATA_HOME) + /colobot; } -GetLogger()-Trace(Profile configuration is %s\n, profileFile.c_str()); - -return profileFile; +GetLogger()-Trace(Saved game files are going to %s\n, savegameDir.c_str()); + +return savegameDir; } diff --git a/src/app/system_linux.h b/src/app/system_linux.h index ad26454..f9cce05 100644 --- a/src/app/system_linux.h +++ b/src/app/system_linux.h @@ -46,7 +46,7 @@ public: virtual long long GetTimeStampExactResolution() override; virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override; -virtual std::string GetProfileFileLocation() override; +virtual std::string GetSaveDir() override; private: bool m_zenityAvailable; diff --git a/src/app/system_macosx.cpp b/src/app/system_macosx.cpp index 38885eb..473a10c 100644 --- a/src/app/system_macosx.cpp +++ b/src/app/system_macosx.cpp @@ -87,10 +87,11 @@ void CSystemUtilsMacOSX::Init() m_dataPath += /Contents/Resources; }
[colobot] 25/390: Auto-update from Pootle 2014-07-16
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 6fd5caeee9c3ec684d748977f501520bc32bff98 Author: krzys-h krzy...@interia.pl Date: Wed Jul 16 04:33:09 2014 +0200 Auto-update from Pootle 2014-07-16 This commit was automatically generated from http://translations.colobot.info/ --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index 14137c0..d775bf9 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 14137c0761f13d8395f43dca28cad813b6ad5c9b +Subproject commit d775bf97639bb272425e7c3f8be85c813fce4271 -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 43/390: Auto-update from Pootle 2014-08-07
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 78f69f61663d5005debd0fbfc40f686bb61322f1 Author: krzys-h krzy...@interia.pl Date: Thu Aug 7 04:32:58 2014 +0200 Auto-update from Pootle 2014-08-07 This commit was automatically generated from http://translations.colobot.info/ --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index ea18354..6a8c1ff 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit ea1835405d8b33ecc9d9f53848abb724eaf59a22 +Subproject commit 6a8c1ffefe3a14377b9786f6ac72f8516b62f67f -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 35/390: Auto-update from Pootle 2014-07-25
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit d5859fc70e3f8f24f57ca4881a06f69009ebef96 Author: krzys-h krzy...@interia.pl Date: Fri Jul 25 04:32:56 2014 +0200 Auto-update from Pootle 2014-07-25 This commit was automatically generated from http://translations.colobot.info/ --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index 55b1a1c..9ee3b6b 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 55b1a1c201c9a8104d9f46bf6e68bde6960b7bc5 +Subproject commit 9ee3b6b3b8944253d5dd2611980529d40eff13d4 -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 31/390: Pootle broke stuff, I've fixed stuff
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 86683c06ade41db9a3fe8390a697b702966d3047 Author: krzys-h krzy...@interia.pl Date: Thu Jul 24 11:44:51 2014 +0200 Pootle broke stuff, I've fixed stuff --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index 0e40e07..55b1a1c 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 0e40e07941e0b932413570999db7e27dc964fc6d +Subproject commit 55b1a1c201c9a8104d9f46bf6e68bde6960b7bc5 -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 38/390: Auto-update from Pootle 2014-07-29
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit a74f601ec18b5b6e155aab4c47c9115602e03a25 Author: krzys-h krzy...@interia.pl Date: Tue Jul 29 04:32:53 2014 +0200 Auto-update from Pootle 2014-07-29 This commit was automatically generated from http://translations.colobot.info/ --- po/de.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/po/de.po b/po/de.po index 34ae436..7f99374 100644 --- a/po/de.po +++ b/po/de.po @@ -7,7 +7,7 @@ msgstr Project-Id-Version: PACKAGE VERSION\n Report-Msgid-Bugs-To: \n POT-Creation-Date: 2014-07-10 16:50+0200\n -PO-Revision-Date: 2014-07-25 20:39+0200\n +PO-Revision-Date: 2014-07-28 09:27+0200\n Last-Translator: krzys_h krzy...@interia.pl\n Language-Team: LANGUAGE l...@li.org\n Language: de\n @@ -18,7 +18,7 @@ msgstr X-Generator: Pootle 2.5.1.1\n X-Language: de_DE\n X-Source-Language: en_US\n -X-POOTLE-MTIME: 1406317182.00\n +X-POOTLE-MTIME: 1406536037.00\n msgid Colobot rules! msgstr Colobot ist wunderbar! @@ -178,7 +178,7 @@ msgid Cancel msgstr Abbrechen msgid LOADING -msgstr LOADING +msgstr LADEN msgid Keyword help(\\key cbot;) msgstr Hilfe über den Begriff (\\key cbot;) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 24/390: Auto-update from Pootle 2014-07-15
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 878d37a593f02fe0b1ff9f9d34b3b35a8c152c40 Author: krzys-h krzy...@interia.pl Date: Tue Jul 15 04:33:12 2014 +0200 Auto-update from Pootle 2014-07-15 This commit was automatically generated from http://translations.colobot.info/ --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index b4c9190..14137c0 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit b4c9190a85ef8bda3a1b7992dada1f8fcecc37c2 +Subproject commit 14137c0761f13d8395f43dca28cad813b6ad5c9b -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 37/390: Auto-update from Pootle 2014-07-28
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit f2f9bd3c9e2e630b16fb5a265d0529517be98098 Author: krzys-h krzy...@interia.pl Date: Mon Jul 28 04:32:47 2014 +0200 Auto-update from Pootle 2014-07-28 This commit was automatically generated from http://translations.colobot.info/ --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index b00b9cd..29947d2 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit b00b9cd26e445dcef52d29b3a3db3253dd4c3137 +Subproject commit 29947d2c372713e9dd499c2d75a5f34793aab975 -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 30/390: Auto-update from Pootle 2014-07-24
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit f290b6c4e73afaaa5326ee3919b0c95cd877a45c Author: krzys-h krzy...@interia.pl Date: Thu Jul 24 04:32:39 2014 +0200 Auto-update from Pootle 2014-07-24 This commit was automatically generated from http://translations.colobot.info/ --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index b8d5e71..0e40e07 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit b8d5e712c64a1d426522f09272a45e229979e591 +Subproject commit 0e40e07941e0b932413570999db7e27dc964fc6d -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 116/390: Fixed #340 again
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit ef1edba3073d219125ede64ec2a88ca5ed77b93b Author: krzys-h krzy...@interia.pl Date: Sat Oct 25 17:09:14 2014 +0200 Fixed #340 again --- src/ui/maindialog.cpp | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index e46d613..3dce5a0 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -4497,8 +4497,13 @@ void CMainDialog::UpdateSceneList(int chap, int sel) for ( j=0 ; j99 ; j++ ) { CLevelParser* level = new CLevelParser(m_sceneName, chap+1, j+1); -if(!level-Exists()) +if(!level-Exists()) { +readAll = true; break; +} else { +if(!readAll) +break; +} try { level-Load(); sprintf(line, %d: %s, j+1, level-Get(Title)-GetParam(text)-AsString().c_str()); @@ -4515,9 +4520,7 @@ void CMainDialog::UpdateSceneList(int chap, int sel) if ( m_phase == PHASE_MISSION !m_main-GetShowAll() !bPassed ) { -j ++; readAll = false; -break; } } @@ -4529,6 +4532,7 @@ void CMainDialog::UpdateSceneList(int chap, int sel) { m_maxList = j+1; // this is not the last! } +CLogger::GetInstancePointer()-Debug(m_maxList = %d\n, m_maxList); if ( sel j-1 ) sel = j-1; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 122/390: Nothing else works, so restart the game on resolution change
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 26376c652d59de271147027bb5c365b22c2765c2 Author: krzys-h krzy...@interia.pl Date: Sat Oct 25 18:34:29 2014 +0200 Nothing else works, so restart the game on resolution change Fixes #339 for now, but we'll need alternative solution later --- src/app/app.cpp | 12 ++ src/app/app.h | 7 ++ src/app/main.cpp | 62 +++ src/ui/maindialog.cpp | 7 ++ 4 files changed, 59 insertions(+), 29 deletions(-) diff --git a/src/app/app.cpp b/src/app/app.cpp index 1b53a28..ea54cf1 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -113,6 +113,7 @@ CApplication::CApplication() m_exitCode = 0; m_active= false; m_debugModes = 0; +m_restart = false; m_windowTitle = COLOBOT: Gold Edition; @@ -675,6 +676,17 @@ void CApplication::Destroy() SDL_Quit(); } +void CApplication::Restart() +{ +m_restart = true; +m_eventQueue-AddEvent(Event(EVENT_SYS_QUIT)); +} + +bool CApplication::IsRestarting() +{ +return m_restart; +} + bool CApplication::ChangeVideoConfig(const Gfx::GLDeviceConfig newConfig) { static bool restore = false; diff --git a/src/app/app.h b/src/app/app.h index c73cb53..500cb2f 100644 --- a/src/app/app.h +++ b/src/app/app.h @@ -227,6 +227,11 @@ public: //! Cleans up before exit voidDestroy(); + +//! Restart +voidRestart(); +//! Should we restart after app quits? +boolIsRestarting(); //! Returns a list of possible video modes VideoQueryResult GetVideoResolutionList(std::vectorMath::IntPoint resolutions, @@ -413,6 +418,8 @@ protected: boolm_active; //! Bit array of active debug modes longm_debugModes; +//! If we are restarting the app +boolm_restart; //! Message to be displayed as error to the user std::string m_errorMessage; diff --git a/src/app/main.cpp b/src/app/main.cpp index e30a83d..88a7a73 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -86,42 +86,46 @@ int SDL_MAIN_FUNC(int argc, char *argv[]) InitializeRestext(); InitializeEventTypeTexts(); -CSystemUtils* systemUtils = CSystemUtils::Create(); // platform-specific utils -systemUtils-Init(); - logger.Info(Colobot starting\n); - -CApplication* app = new CApplication(); // single instance of the application - -ParseArgsStatus status = app-ParseArguments(argc, argv); -if (status == PARSE_ARGS_FAIL) -{ -systemUtils-SystemDialog(SDT_ERROR, COLOBOT - Fatal Error, Invalid commandline arguments!\n); -return app-GetExitCode(); -} -else if (status == PARSE_ARGS_HELP) -{ -return app-GetExitCode(); -} - + int code = 0; +while(true) { +CSystemUtils* systemUtils = CSystemUtils::Create(); // platform-specific utils +systemUtils-Init(); + +CApplication* app = new CApplication(); // single instance of the application + +ParseArgsStatus status = app-ParseArguments(argc, argv); +if (status == PARSE_ARGS_FAIL) +{ +systemUtils-SystemDialog(SDT_ERROR, COLOBOT - Fatal Error, Invalid commandline arguments!\n); +return app-GetExitCode(); +} +else if (status == PARSE_ARGS_HELP) +{ +return app-GetExitCode(); +} -if (! app-Create()) -{ -app-Destroy(); // ensure a clean exit -code = app-GetExitCode(); -if ( code != 0 !app-GetErrorMessage().empty() ) + +if (! app-Create()) { -systemUtils-SystemDialog(SDT_ERROR, COLOBOT - Fatal Error, app-GetErrorMessage()); +app-Destroy(); // ensure a clean exit +code = app-GetExitCode(); +if ( code != 0 !app-GetErrorMessage().empty() ) +{ +systemUtils-SystemDialog(SDT_ERROR, COLOBOT - Fatal Error, app-GetErrorMessage()); +} +logger.Info(Didn't run main loop. Exiting with code %d\n, code); +return code; } -logger.Info(Didn't run main loop. Exiting with code %d\n, code); -return code; -} -code = app-Run(); +code = app-Run(); +bool restarting = app-IsRestarting(); -delete app; -delete systemUtils; +delete app; +delete systemUtils; +if(!restarting) break; +} logger.Info(Exiting with code %d\n, code); return code; diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 0ab9085..ede7453 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -4677,7 +4677,13 @@ void CMainDialog::ChangeDisplay() bFull = pc-TestState(STATE_CHECK); m_setupFull = bFull; +SetupMemorize(); +#if
[colobot] 119/390: But do 182d5206a8dcdbf112e5e2099a71c8dc82b9ffa1 only on Windows, since it works correctly on Linux
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit fdbc4080c7c2ad838392f9b3228b4b44a9bb66af Author: krzys-h krzy...@interia.pl Date: Sat Oct 25 17:28:30 2014 +0200 But do 182d5206a8dcdbf112e5e2099a71c8dc82b9ffa1 only on Windows, since it works correctly on Linux --- src/ui/maindialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index e553d69..0ab9085 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -968,7 +968,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); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 120/390: Possible fix for #339 (?)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 9d68868f8ed1c3116b68c99c249de20cb64f2385 Author: krzys-h krzy...@interia.pl Date: Sat Oct 25 18:00:39 2014 +0200 Possible fix for #339 (?) --- src/graphics/engine/engine.cpp | 5 + 1 file changed, 5 insertions(+) diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index db702b7..ae6f238 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -295,6 +295,9 @@ bool CEngine::Create() void CEngine::Destroy() { m_text-Destroy(); + +delete m_pause; +m_pause = nullptr; delete m_lightMan; m_lightMan = nullptr; @@ -325,6 +328,8 @@ void CEngine::ResetAfterDeviceChanged() m_text-FlushCache(); FlushTextureCache(); + +LoadAllTextures(); } bool CEngine::ProcessEvent(const Event event) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 99/390: Updated README with new dependencies
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 02d23f8a7ff6ba45eed155a5b9697b467ae17638 Author: krzys-h krzy...@interia.pl Date: Sun Oct 19 16:26:16 2014 +0200 Updated README with new dependencies --- INSTALL-MXE.md | 1 + INSTALL.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/INSTALL-MXE.md b/INSTALL-MXE.md index 89bec0e..d4b0bff 100644 --- a/INSTALL-MXE.md +++ b/INSTALL-MXE.md @@ -44,6 +44,7 @@ To cross-compile Colobot using MXE: * mingwrt * ogg * openal +* physfs * portaudio * sdl * sdl_image diff --git a/INSTALL.md b/INSTALL.md index ec7b152..fbf4ece 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -115,11 +115,12 @@ You will need: * libvorbis = 1.3.2 * libogg = 1.3.0 * OpenAL (OpenAL-Soft) = 1.13 + * PhysFS * po4a = 0.45 (to generate translated data files) On Ubuntu (and probably any other Debian-based system), you can use the following command to install all required packages: ``` - $ apt-get install build-essential cmake libsdl1.2debian libsdl1.2-dev libsdl-image1.2 libsdl-image1.2-dev libsdl-ttf2.0-0 libsdl-ttf2.0-dev libsdl-mixer1.2 libsdl-mixer1.2-dev libsndfile1-dev libvorbis-dev libogg-dev libpng12-dev libglew-dev libopenal-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev gettext git po4a + $ apt-get install build-essential cmake libsdl1.2debian libsdl1.2-dev libsdl-image1.2 libsdl-image1.2-dev libsdl-ttf2.0-0 libsdl-ttf2.0-dev libsdl-mixer1.2 libsdl-mixer1.2-dev libsndfile1-dev libvorbis-dev libogg-dev libpng12-dev libglew-dev libopenal-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev libphysfs-dev gettext git po4a ``` Make sure you install the packages along with header files (often distributed in separate *-dev packages). If you miss any requirements, -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 118/390: Disable resolution settings in simulation
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 182d5206a8dcdbf112e5e2099a71c8dc82b9ffa1 Author: krzys-h krzy...@interia.pl Date: Sat Oct 25 17:23:09 2014 +0200 Disable resolution settings in simulation --- src/ui/maindialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 3dce5a0..e553d69 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -968,6 +968,7 @@ 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)); +pb-SetState(STATE_ENABLE, !m_bSimulSetup); pos.x += ddim.x+0.01f; pb = pw-CreateButton(pos, ddim, -1, EVENT_INTERFACE_SETUPg); @@ -4532,7 +4533,6 @@ void CMainDialog::UpdateSceneList(int chap, int sel) { m_maxList = j+1; // this is not the last! } -CLogger::GetInstancePointer()-Debug(m_maxList = %d\n, m_maxList); if ( sel j-1 ) sel = j-1; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 117/390: Fixed NewScript (#341)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit c12ebb1c7bd3a65c02f6383a8b450e0947d01980 Author: krzys-h krzy...@interia.pl Date: Sat Oct 25 17:16:39 2014 +0200 Fixed NewScript (#341) --- src/object/robotmain.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index f13ef8b..aa52791 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -4675,9 +4675,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (line-GetCommand() == NewScript !resetObject) { -char name[200]; -strcpy(name, line-GetParam(name)-AsPath().c_str()); //TODO: don't make this relative to ai/ - AddNewScriptName(line-GetParam(type)-AsObjectType(OBJECT_NULL), name); + AddNewScriptName(line-GetParam(type)-AsObjectType(OBJECT_NULL), const_castchar*(line-GetParam(name)-AsPath(ai).c_str())); continue; } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 115/390: Fixed linking convert_model (#332)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 81062e5e87bc2f34e295e39a95afb1da57d260cf Author: krzys-h krzy...@interia.pl Date: Sat Oct 25 12:44:52 2014 +0200 Fixed linking convert_model (#332) --- src/CMakeLists.txt| 4 ++-- src/graphics/engine/modelfile.cpp | 38 +++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 869f0cb..a8914e1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -215,7 +215,7 @@ set(LIBS ${LIBSNDFILE_LIBRARY} ${OPTIONAL_LIBS} ${PLATFORM_LIBS} -${PHYSFS_LIBRARY} +${PHYSFS_LIBRARY} ) set(COLOBOT_LIBS ${LIBS} PARENT_SCOPE) @@ -239,7 +239,7 @@ set(SYSTEM_INCLUDES ${LOCALENAME_INCLUDE_DIR} ${OPTIONAL_INCLUDE_DIRS} ${CLIPBOARD_INCLUDE_DIR} -${PHYSFS_INCLUDE_PATH} +${PHYSFS_INCLUDE_PATH} ) set(COLOBOT_LOCAL_INCLUDES ${LOCAL_INCLUDES} PARENT_SCOPE) diff --git a/src/graphics/engine/modelfile.cpp b/src/graphics/engine/modelfile.cpp index 09c7bbd..c422f18 100644 --- a/src/graphics/engine/modelfile.cpp +++ b/src/graphics/engine/modelfile.cpp @@ -24,7 +24,9 @@ #include common/logger.h #include common/stringutils.h +#ifndef MODELFILE_NO_ENGINE #include common/resources/inputstream.h +#endif #include graphics/engine/engine.h @@ -436,13 +438,23 @@ bool CModelFile::ReadModel(const std::string fileName) { m_triangles.clear(); +#ifndef MODELFILE_NO_ENGINE CInputStream stream; -stream.open(fileName.c_str()); +stream.open(fileName); if (!stream.is_open()) { GetLogger()-Error(Could not open file '%s'\n, fileName.c_str()); return false; } +#else +std::ifstream stream; +stream.open(fileName); +if (!stream.good()) +{ +GetLogger()-Error(Could not open file '%s'\n, fileName.c_str()); +return false; +} +#endif return ReadModel(stream); } @@ -827,13 +839,23 @@ struct NewModelTriangle1 bool CModelFile::ReadTextModel(const std::string fileName) { +#ifndef MODELFILE_NO_ENGINE CInputStream stream; -stream.open(fileName.c_str()); +stream.open(fileName); if (!stream.is_open()) { GetLogger()-Error(Could not open file '%s'\n, fileName.c_str()); return false; } +#else +std::ifstream stream; +stream.open(fileName); +if (!stream.good()) +{ +GetLogger()-Error(Could not open file '%s'\n, fileName.c_str()); +return false; +} +#endif return ReadTextModel(stream); } @@ -1024,13 +1046,23 @@ bool CModelFile::WriteTextModel(std::ostream stream) bool CModelFile::ReadBinaryModel(const std::string fileName) { +#ifndef MODELFILE_NO_ENGINE CInputStream stream; -stream.open(fileName.c_str()); +stream.open(fileName); if (!stream.is_open()) { GetLogger()-Error(Could not open file '%s'\n, fileName.c_str()); return false; } +#else +std::ifstream stream; +stream.open(fileName); +if (!stream.good()) +{ +GetLogger()-Error(Could not open file '%s'\n, fileName.c_str()); +return false; +} +#endif return ReadBinaryModel(stream); } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 126/390: Updated data submodule
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 6b517d4b2145abcfd8a2e0b1edb1b002a25f5e12 Author: krzys-h krzy...@interia.pl Date: Sat Oct 25 19:51:56 2014 +0200 Updated data submodule --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index 3cf9c16..574385b 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 3cf9c16bf15ff4c5e655898fb82c9bcf9292b4f6 +Subproject commit 574385b729e894a9d5d02999cc84991e1d56740a -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 128/390: Updated submodule
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 8837a96e814185444ec9aa5903ad8e9e33aaf257 Author: krzys-h krzy...@interia.pl Date: Sat Oct 25 21:35:52 2014 +0200 Updated submodule --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index 070912c..42fc8ad 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 070912c9d18217c2f90d0f528d16b413adf4d875 +Subproject commit 42fc8add845bb0001d2497090ca27e592e87f035 -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 123/390: Added warning about restarting game in order to apply changes
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 0d873ad43a62f7e54f59ea6b70f91089b0831981 Author: krzys-h krzy...@interia.pl Date: Sat Oct 25 18:43:02 2014 +0200 Added warning about restarting game in order to apply changes issue #339 --- src/ui/maindialog.cpp | 8 1 file changed, 8 insertions(+) diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index ede7453..26bfbbc 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -1053,6 +1053,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; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 291/390: Updated translations after bf55691e444ec6b6cda8ff7d69d418fd50befaa6
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit d5705ae2c352bf1c427daf3697eef6fe6394ae93 Author: krzys-h krzy...@interia.pl Date: Sun Mar 22 14:59:48 2015 +0100 Updated translations after bf55691e444ec6b6cda8ff7d69d418fd50befaa6 --- po/colobot.pot | 3 +++ po/de.po | 4 po/fr.po | 4 po/pl.po | 3 +++ po/ru.po | 4 5 files changed, 18 insertions(+) diff --git a/po/colobot.pot b/po/colobot.pot index 5ae7368..1426eca 100644 --- a/po/colobot.pot +++ b/po/colobot.pot @@ -842,6 +842,9 @@ msgstr msgid Shield radius msgstr +msgid Delete mark +msgstr + msgid Execute the selected program msgstr diff --git a/po/de.po b/po/de.po index d79c66e..32dbe92 100644 --- a/po/de.po +++ b/po/de.po @@ -453,6 +453,10 @@ msgstr Geschützturm msgid Delete msgstr Zerstören +#, fuzzy +msgid Delete mark +msgstr Zerstören + msgid Delete player\\Deletes the player from the list msgstr Spieler löschen\\Löscht den Spieler aus der Liste diff --git a/po/fr.po b/po/fr.po index a538e61..285e450 100644 --- a/po/fr.po +++ b/po/fr.po @@ -448,6 +448,10 @@ msgstr Tour de défense msgid Delete msgstr Détruire +#, fuzzy +msgid Delete mark +msgstr Détruire + msgid Delete player\\Deletes the player from the list msgstr Supprimer le joueur\\Supprimer le joueur de la liste diff --git a/po/pl.po b/po/pl.po index a2f08ae..73992e7 100644 --- a/po/pl.po +++ b/po/pl.po @@ -457,6 +457,9 @@ msgstr Wieża obronna msgid Delete msgstr Usuń +msgid Delete mark +msgstr Usuń znacznik + msgid Delete player\\Deletes the player from the list msgstr Usuń gracza\\Usuwa gracza z listy diff --git a/po/ru.po b/po/ru.po index 5a4ad9d..79804b7 100644 --- a/po/ru.po +++ b/po/ru.po @@ -447,6 +447,10 @@ msgstr Защитная башня msgid Delete msgstr Удалить +#, fuzzy +msgid Delete mark +msgstr Удалить + msgid Delete player\\Deletes the player from the list msgstr Удалить игрока\\Удаление игрока из списка -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 293/390: Implemented shortcuts for starting programs (#391)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 23c734c3c15752cc9da5d2e768a98a7fff452e8e Author: krzys-h krzy...@interia.pl Date: Sun Mar 22 15:49:33 2015 +0100 Implemented shortcuts for starting programs (#391) --- src/object/brain.cpp | 65 src/object/brain.h | 1 + src/ui/studio.cpp| 11 - 3 files changed, 66 insertions(+), 11 deletions(-) diff --git a/src/object/brain.cpp b/src/object/brain.cpp index 169e3c5..31cbee2 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -247,6 +247,54 @@ bool CBrain::EventProcess(const Event event) action = event.type; } +if(event.type == EVENT_KEY_DOWN m_object-GetSelect()) +{ +bool bControl = (event.kmodState KEY_MOD(CTRL)) != 0; +bool bAlt = (event.kmodState KEY_MOD(ALT)) != 0; +CEventQueue* queue = CApplication::GetInstancePointer()-GetEventQueue(); + +if(event.key.slot == INPUT_SLOT_ACTION bControl) +{ +Event newEvent = event; +newEvent.type = (m_studio == nullptr ? EVENT_OBJECT_PROGEDIT : EVENT_STUDIO_OK); +queue-AddEvent(newEvent); +return false; +} + +if(event.key.slot == INPUT_SLOT_ACTION bAlt) +{ +Event newEvent = event; +newEvent.type = EVENT_OBJECT_PROGRUN; +queue-AddEvent(newEvent); +return false; +} + +if(bAlt) +{ +int index = GetSelScript(); +if(event.key.slot == INPUT_SLOT_UP) +index--; +else if(event.key.slot == INPUT_SLOT_DOWN) +index++; +else if(event.key.key = KEY(1) event.key.key = KEY(9)) +index = event.key.key-KEY(1); +else if(event.key.key == KEY(0)) +index = 9; +if(index 0) index = 9; +if(index 9) index = 0; + +if(GetSelScript() != index) +{ +SetSelScript(index); + +Event newEvent = event; +newEvent.type = EVENT_OBJECT_PROGLIST; +queue-AddEvent(newEvent); +return false; +} +} +} + if ( action == EVENT_NULL ) return true; if ( action == EVENT_UPDINTERFACE ) @@ -2463,6 +2511,23 @@ int CBrain::GetSelScript() return pl-GetSelect(); } +// Changes selected script + +void CBrain::SetSelScript(int index) +{ +Ui::CWindow*pw; +Ui::CList* pl; + +pw = static_cast Ui::CWindow* (m_interface-SearchControl(EVENT_WINDOW0)); +if ( pw == 0 ) return; + +pl = static_cast Ui::CList* (pw-SearchControl(EVENT_OBJECT_PROGLIST)); +if ( pl == 0 ) return; + +pl-SetSelect(index); +pl-ShowSelect(true); +} + // Blinks the running program. void CBrain::BlinkScript(bool bEnable) diff --git a/src/object/brain.h b/src/object/brain.h index a67a1ef..b62f826 100644 --- a/src/object/brain.h +++ b/src/object/brain.h @@ -159,6 +159,7 @@ protected: voidUpdateScript(Ui::CWindow *pw); int GetSelScript(); +voidSetSelScript(int index); voidBlinkScript(bool bEnable); voidCheckInterface(Ui::CWindow *pw, EventType event, bool bState); diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index 11fb62f..c1c4971 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -125,17 +125,6 @@ bool CStudio::EventProcess(const Event event) newEvent.type = EVENT_STUDIO_OK; m_event-AddEvent(newEvent); } - -if ( event.type == EVENT_KEY_DOWN ) -{ -if ( event.key.slot == INPUT_SLOT_ACTION - (event.kmodState KEY_MOD(CTRL)) != 0 ) -{ -Event newEvent = event; -newEvent.type = EVENT_STUDIO_OK; -m_event-AddEvent(newEvent); -} -} if ( event.type == EVENT_STUDIO_EDIT ) // text modifief? { -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 283/390: Use std::wstring in boost::filesystem calls on Windows, fixes #414
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 47ed73247bed29f31720ef795141328b5d810d0e Author: krzys-h krzy...@interia.pl Date: Sun Mar 22 13:34:17 2015 +0100 Use std::wstring in boost::filesystem calls on Windows, fixes #414 --- src/common/pathman.cpp | 25 + src/common/resources/resourcemanager.cpp | 19 +-- src/script/scriptfunc.cpp| 9 + 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/common/pathman.cpp b/src/common/pathman.cpp index ccf61ab..51e7e7d 100644 --- a/src/common/pathman.cpp +++ b/src/common/pathman.cpp @@ -35,6 +35,10 @@ #include boost/algorithm/string.hpp #include boost/filesystem.hpp +#ifdef PLATFORM_WINDOWS +#include app/system_windows.h +#endif + template CPathManager* CSingletonCPathManager::m_instance = nullptr; CPathManager::CPathManager() @@ -96,7 +100,11 @@ const std::string CPathManager::GetSavePath() std::string CPathManager::VerifyPaths() { +#if PLATFORM_WINDOWS +boost::filesystem::path dataPath(CSystemUtilsWindows::UTF8_Decode(m_dataPath)); +#else boost::filesystem::path dataPath(m_dataPath); +#endif if (! (boost::filesystem::exists(dataPath) boost::filesystem::is_directory(dataPath)) ) { CLogger::GetInstancePointer()-Error(Data directory '%s' doesn't exist or is not a directory\n, m_dataPath.c_str()); @@ -105,14 +113,23 @@ std::string CPathManager::VerifyPaths() std::string(Please check your installation, or supply a valid data directory by -datadir option.); } +#if PLATFORM_WINDOWS +boost::filesystem::path langPath(CSystemUtilsWindows::UTF8_Decode(m_langPath)); +#else boost::filesystem::path langPath(m_langPath); +#endif if (! (boost::filesystem::exists(langPath) boost::filesystem::is_directory(langPath)) ) { CLogger::GetInstancePointer()-Warn(Language path '%s' is invalid, assuming translation files not installed\n, m_langPath.c_str()); } +#if PLATFORM_WINDOWS + boost::filesystem::create_directories(CSystemUtilsWindows::UTF8_Decode(m_savePath)); + boost::filesystem::create_directories(CSystemUtilsWindows::UTF8_Decode(m_savePath+/mods)); +#else boost::filesystem::create_directories(m_savePath); boost::filesystem::create_directories(m_savePath+/mods); +#endif return ; } @@ -132,10 +149,18 @@ void CPathManager::InitPaths() void CPathManager::LoadModsFromDir(const std::string dir) { try { +#if PLATFORM_WINDOWS +boost::filesystem::directory_iterator iterator(CSystemUtilsWindows::UTF8_Decode(dir)); +#else boost::filesystem::directory_iterator iterator(dir); +#endif for(; iterator != boost::filesystem::directory_iterator(); ++iterator) { +#if PLATFORM_WINDOWS + AddMod(CSystemUtilsWindows::UTF8_Encode(iterator-path().wstring())); +#else AddMod(iterator-path().string()); +#endif } } catch(std::exception e) diff --git a/src/common/resources/resourcemanager.cpp b/src/common/resources/resourcemanager.cpp index 64cb4ee..6f9ae24 100644 --- a/src/common/resources/resourcemanager.cpp +++ b/src/common/resources/resourcemanager.cpp @@ -28,6 +28,10 @@ #include boost/filesystem.hpp #include boost/regex.hpp +#if PLATFORM_WINDOWS +#include app/system_windows.h +#endif + namespace fs = boost::filesystem; namespace @@ -183,7 +187,12 @@ bool CResourceManager::RemoveDirectory(const std::string directory) std::string writeDir = PHYSFS_getWriteDir(); try { -fs::remove_all(writeDir + / + CleanPath(directory)); +std::string path = writeDir + / + CleanPath(directory); +#ifdef PLATFORM_WINDOWS +fs::remove_all(CSystemUtilsWindows::UTF8_Decode(path)); +#else +fs::remove_all(path); +#endif } catch (std::exception e) { @@ -267,7 +276,13 @@ bool CResourceManager::Move(const std::string from, const std::string to) std::string writeDir = PHYSFS_getWriteDir(); try { -fs::rename(writeDir + / + CleanPath(from), writeDir + / + CleanPath(to)); +std::string path_from = writeDir + / + CleanPath(from); +std::string path_to = writeDir + / + CleanPath(to); +#ifdef PLATFORM_WINDOWS +fs::rename(CSystemUtilsWindows::UTF8_Decode(path_from), CSystemUtilsWindows::UTF8_Decode(path_to)); +#else +fs::rename(path_from, path_to); +#endif } catch (std::exception e) { diff --git a/src/script/scriptfunc.cpp b/src/script/scriptfunc.cpp index 3fd3add..3416343 100644 --- a/src/script/scriptfunc.cpp +++
[colobot] 288/390: Issue #399 : Sniffer can delete mark and probe ground
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit bf55691e444ec6b6cda8ff7d69d418fd50befaa6 Author: Piotr Walkusz piotrwalku...@wp.pl Date: Sun Nov 16 23:10:01 2014 +0100 Issue #399 : Sniffer can delete mark and probe ground --- data | 2 +- src/CMakeLists.txt | 1 + src/common/event.h | 3 +- src/common/restext.cpp | 1 + src/object/brain.cpp | 28 +- src/object/brain.h | 1 + src/object/task/taskdeletemark.cpp | 110 + src/object/task/taskdeletemark.h | 45 +++ src/object/task/taskmanager.cpp| 10 src/object/task/taskmanager.h | 1 + 10 files changed, 199 insertions(+), 3 deletions(-) diff --git a/data b/data index b29aa97..1aa4009 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit b29aa975122f8165f1683c5d143ed37b8c872ab4 +Subproject commit 1aa40099ac6898775f990884908bb840ae2f94d6 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9c1a0dd..6039266 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -147,6 +147,7 @@ set(BASE_SOURCES object/task/task.cpp object/task/taskadvance.cpp object/task/taskbuild.cpp +object/task/taskdeletemark.cpp object/task/taskfire.cpp object/task/taskfireant.cpp object/task/taskflag.cpp diff --git a/src/common/event.h b/src/common/event.h index 8c0ce52..0c5b2f5 100644 --- a/src/common/event.h +++ b/src/common/event.h @@ -160,7 +160,7 @@ enum EventType EVENT_LIST0 = 110, EVENT_LIST1 = 111, -EVENT_LIST2 = 112, +EVENT_LIST2 = 112, // list of resolutions EVENT_LIST3 = 113, EVENT_LIST4 = 114, EVENT_LIST5 = 115, @@ -453,6 +453,7 @@ enum EventType EVENT_OBJECT_RESET = 1233, EVENT_OBJECT_DIMSHIELD = 1234, EVENT_OBJECT_TARGET = 1235, +EVENT_OBJECT_DELSEARCH = 1236, // delete mark on ground EVENT_OBJECT_PROGLIST = 1310, EVENT_OBJECT_PROGRUN= 1311, EVENT_OBJECT_PROGEDIT = 1312, diff --git a/src/common/restext.cpp b/src/common/restext.cpp index e52a26e..1802707 100644 --- a/src/common/restext.cpp +++ b/src/common/restext.cpp @@ -369,6 +369,7 @@ void InitializeRestext() stringsEvent[EVENT_OBJECT_BEGSHIELD]= TR(Extend shield (\\key action;)); stringsEvent[EVENT_OBJECT_ENDSHIELD]= TR(Withdraw shield (\\key action;)); stringsEvent[EVENT_OBJECT_DIMSHIELD]= TR(Shield radius); +stringsEvent[EVENT_OBJECT_DELSEARCH]= TR(Delete mark); stringsEvent[EVENT_OBJECT_PROGRUN] = TR(Execute the selected program); stringsEvent[EVENT_OBJECT_PROGEDIT] = TR(Edit the selected program); stringsEvent[EVENT_OBJECT_INFOOK] = TR(\\SatCom on standby); diff --git a/src/object/brain.cpp b/src/object/brain.cpp index 2e0c2cd..d045a00 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -565,6 +565,11 @@ bool CBrain::EventProcess(const Event event) { err = StartTaskSearch(); } + +if ( action == EVENT_OBJECT_DELSEARCH ) + { + err = StartTaskDeleteMark(); + } if ( action == EVENT_OBJECT_TERRAFORM ) { @@ -980,6 +985,19 @@ Error CBrain::StartTaskSearch() return err; } +// Delete mark on ground + +Error CBrain::StartTaskDeleteMark() +{ +StopTask(); + +m_primaryTask = new CTaskManager(m_object); +Error err = m_primaryTask-StartTaskDeleteMark(); +UpdateInterface(); +return err; +} + + // Terraformed the ground. Error CBrain::StartTaskTerraform() @@ -1163,7 +1181,6 @@ void CBrain::ColorFlag(int color) UpdateInterface(); } - // Creates all the interface when the object is selected. bool CBrain::CreateInterface(bool bSelect) @@ -1474,6 +1491,14 @@ bool CBrain::CreateInterface(bool bSelect) pos.y = oy+sy*0.5f; pw-CreateButton(pos, dim, 40, EVENT_OBJECT_SEARCH); DefaultEnter(pw, EVENT_OBJECT_SEARCH); + + pos.x = ox+sx*9.0f; +pos.y = oy+sy*0.5f; +pw-CreateButton(pos, dim, 111, EVENT_OBJECT_GFLAT); + + pos.x = ox+sx*10.1f; +pos.y = oy+sy*0.5f; +pw-CreateButton(pos, dim, 11, EVENT_OBJECT_DELSEARCH); } if ( type == OBJECT_MOBILErt // Terraformer? @@ -2118,6 +2143,7 @@ void CBrain::UpdateInterface() EnableInterface(pw, EVENT_OBJECT_FCREATE, bEnable); EnableInterface(pw, EVENT_OBJECT_FDELETE, bEnable); EnableInterface(pw, EVENT_OBJECT_SEARCH, bEnable); +EnableInterface(pw, EVENT_OBJECT_DELSEARCH, bEnable); EnableInterface(pw, EVENT_OBJECT_TERRAFORM, bEnable); EnableInterface(pw, EVENT_OBJECT_RECOVER, bEnable); EnableInterface(pw, EVENT_OBJECT_FIRE,bEnable);
[colobot] 299/390: Don't count transported items by default (#412)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 14068ce54b3cc04cc136a64616c58c58442836bb Author: krzys-h krzy...@interia.pl Date: Sat Mar 28 12:19:40 2015 +0100 Don't count transported items by default (#412) --- src/object/robotmain.cpp | 6 ++ src/object/robotmain.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 67119c7..13aec23 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -3842,6 +3842,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) m_endTake[i].drive= line-GetParam(drive)-AsDriveType(DRIVE_OTHER); m_endTake[i].lost = line-GetParam(lost)-AsInt(-1); m_endTake[i].immediat = line-GetParam(immediat)-AsBool(false); +m_endTake[i].countTransported = line-GetParam(countTransported)-AsBool(false); strcpy(m_endTake[i].message, line-GetParam(message)-AsString().c_str()); //TODO: Really, ending mission on message()? Is this used anywhere? Do we need that? m_endTakeTotal ++; } @@ -5525,6 +5526,11 @@ Error CRobotMain::CheckEndMission(bool frame) if (obj-GetRuin()) continue; if (!obj-GetEnable()) continue; +if(!m_endTake[t].countTransported) +{ +if(obj-GetTruck() != nullptr) continue; +} + ObjectType type = obj-GetType(); if (type == OBJECT_SCRAP2 || type == OBJECT_SCRAP3 || diff --git a/src/object/robotmain.h b/src/object/robotmain.h index 22955e3..78940d2 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -113,6 +113,7 @@ struct EndTake ToolType tool; DriveType drive; bool immediat; +bool countTransported; char message[100]; }; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 309/390: Marked programs from SatCom with a star
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 1a8bb9c0fb847d4ba6d2718d79386c736ec7c7c2 Author: krzys-h krzy...@interia.pl Date: Mon Apr 6 16:21:19 2015 +0200 Marked programs from SatCom with a star --- src/common/event.cpp | 2 +- src/object/brain.cpp | 9 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/common/event.cpp b/src/common/event.cpp index 415a900..d0ecfb4 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -428,7 +428,7 @@ void InitializeEventTypeTexts() EVENT_TYPE_TEXT[EVENT_OBJECT_PROGSTART] = EVENT_OBJECT_PROGSTART; EVENT_TYPE_TEXT[EVENT_OBJECT_PROGSTOP] = EVENT_OBJECT_PROGSTOP; EVENT_TYPE_TEXT[EVENT_OBJECT_PROGADD]= EVENT_OBJECT_PROGADD; -EVENT_TYPE_TEXT[EVENT_OBJECT_PROGCLONE] = EVENT_OBJECT_PROGCLONE; +EVENT_TYPE_TEXT[EVENT_OBJECT_PROGCLONE] = EVENT_OBJECT_PROGCLONE; EVENT_TYPE_TEXT[EVENT_OBJECT_PROGREMOVE] = EVENT_OBJECT_PROGREMOVE; EVENT_TYPE_TEXT[EVENT_OBJECT_PROGMOVEUP] = EVENT_OBJECT_PROGMOVEUP; EVENT_TYPE_TEXT[EVENT_OBJECT_PROGMOVEDOWN] = EVENT_OBJECT_PROGMOVEDOWN; diff --git a/src/object/brain.cpp b/src/object/brain.cpp index d505e8d..1f75dfa 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -2615,7 +2615,14 @@ void CBrain::UpdateScript(Ui::CWindow *pw) m_program[i]-script-GetTitle(title); if ( title[0] != 0 ) { -sprintf(name, %d: %s, i+1, title); +if(!m_program[i]-readOnly) +{ +sprintf(name, %d: %s, i+1, title); +} +else +{ +sprintf(name, *%d: %s, i+1, title); +} } pl-SetItemName(i, name); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 308/390: Made programs from SatCom read-only; added program cloning
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 58016c6c69e966b1079c6f08112c694e46c661e7 Author: krzys-h krzy...@interia.pl Date: Mon Apr 6 16:07:49 2015 +0200 Made programs from SatCom read-only; added program cloning --- data | 2 +- po/colobot.pot | 12 + po/de.po | 14 ++ po/fr.po | 14 ++ po/pl.po | 14 +- po/ru.po | 14 ++ src/common/event.cpp | 2 ++ src/common/event.h | 6 +++-- src/common/restext.cpp | 5 src/common/restext.h | 3 +++ src/object/brain.cpp | 70 +++- src/object/brain.h | 2 ++ src/object/robotmain.cpp | 3 +++ src/ui/studio.cpp| 50 ++ src/ui/studio.h | 3 ++- 15 files changed, 197 insertions(+), 17 deletions(-) diff --git a/data b/data index d5ff8d5..3195fa5 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit d5ff8d51a37ba4d66a99778914f4d3751c23006b +Subproject commit 3195fa5d55daa308404529f06030e3d643945291 diff --git a/po/colobot.pot b/po/colobot.pot index 3992e70..6036509 100644 --- a/po/colobot.pot +++ b/po/colobot.pot @@ -180,6 +180,12 @@ msgstr msgid Program finished msgstr +msgid Program cloned +msgstr + +msgid This program is read-only, clone it to edit +msgstr + msgid \\b;List of objects\n msgstr @@ -857,6 +863,9 @@ msgstr msgid Remove selected program msgstr +msgid Clone selected program +msgstr + msgid Move selected program up msgstr @@ -1016,6 +1025,9 @@ msgstr msgid Cancel\\Cancel all changes msgstr +msgid Clone program +msgstr + msgid Open (Ctrl+o) msgstr diff --git a/po/de.po b/po/de.po index 533ddd6..7f9cd72 100644 --- a/po/de.po +++ b/po/de.po @@ -395,6 +395,13 @@ msgstr Checkpoint erreicht msgid Climb\\Increases the power of the jet msgstr Steigen\\Leistung des Triebwerks steigern +msgid Clone program +msgstr + +#, fuzzy +msgid Clone selected program +msgstr Gewähltes Programm bearbeiten + msgid Close msgstr Schließen @@ -1129,6 +1136,10 @@ msgstr Geschütztes Element (private) msgid Private\\Private folder msgstr Privat\\Privater Ordner +#, fuzzy +msgid Program cloned +msgstr Programm beendet + msgid Program editor msgstr Programmeditor @@ -1487,6 +1498,9 @@ msgstr Dieses Label existiert nicht msgid This object is not a member of a class msgstr Das Objekt ist nicht eine Instanz einer Klasse +msgid This program is read-only, clone it to edit +msgstr + msgid Thump (\\key action;) msgstr Stampfen (\\key action;) diff --git a/po/fr.po b/po/fr.po index 2a38eca..c2bf87f 100644 --- a/po/fr.po +++ b/po/fr.po @@ -390,6 +390,13 @@ msgstr Indicateur atteint msgid Climb\\Increases the power of the jet msgstr Monter\\Augmenter la puissance du réacteur +msgid Clone program +msgstr + +#, fuzzy +msgid Clone selected program +msgstr Édite le programme sélectionné + msgid Close msgstr Fermer @@ -1125,6 +1132,10 @@ msgstr Elément protégé msgid Private\\Private folder msgstr Privé\\Dossier privé +#, fuzzy +msgid Program cloned +msgstr Programme terminé + msgid Program editor msgstr Edition du programme @@ -1482,6 +1493,9 @@ msgstr Cette étiquette n'existe pas msgid This object is not a member of a class msgstr L'objet n'est pas une instance d'une classe +msgid This program is read-only, clone it to edit +msgstr + msgid Thump (\\key action;) msgstr Secoue (\\key action;) diff --git a/po/pl.po b/po/pl.po index 0bb0084..7676f72 100644 --- a/po/pl.po +++ b/po/pl.po @@ -400,6 +400,12 @@ msgstr Przekroczono punkt kontrolny msgid Climb\\Increases the power of the jet msgstr W górę\\Zwiększa moc silnika +msgid Clone program +msgstr Skopiuj program + +msgid Clone selected program +msgstr Skopiuj zaznaczony program + msgid Close msgstr Zamknij @@ -1048,7 +1054,7 @@ msgid Pause/continue msgstr Pauza/Kontynuuj msgid Pause\\Pause the game without opening menu -msgstr +msgstr Pauza\\Zatrzymaj grę bez otwierania menu msgid Phazer shooter msgstr Działo fazowe @@ -1132,6 +1138,9 @@ msgstr Element prywatny msgid Private\\Private folder msgstr Prywatny\\Folder prywatny +msgid Program cloned +msgstr Program skopiowany + msgid Program editor msgstr Edytor programu @@ -1487,6 +1496,9 @@ msgstr Taka etykieta nie istnieje msgid This object is not a member of a class msgstr Ten obiekt nie jest członkiem klasy +msgid This program is read-only, clone it to edit +msgstr Ten program jest tylko do odczytu, skopiuj go, aby edytować + msgid Thump (\\key action;) msgstr Uderz (\\key action;) diff --git a/po/ru.po b/po/ru.po index 6be55cb..b039602 100644 --- a/po/ru.po +++ b/po/ru.po @@ -390,6 +390,13 @@ msgstr Вы прошли контрольную точку msgid Climb\\Increases the power of the jet msgstr Взлет и подъем\\Увеличивает
[colobot] 315/390: Implemented button rendering in SatCom (#232)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit efe04be1c210c5d609df0d00bb784268033170b9 Author: krzys-h krzy...@interia.pl Date: Tue Apr 7 12:06:43 2015 +0200 Implemented button rendering in SatCom (#232) Finally! --- src/graphics/engine/text.cpp | 140 +++ src/ui/edit.cpp | 2 - 2 files changed, 102 insertions(+), 40 deletions(-) diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp index bebf30c..b383a6b 100644 --- a/src/graphics/engine/text.cpp +++ b/src/graphics/engine/text.cpp @@ -621,9 +621,6 @@ void CText::DrawString(const std::string text, std::vectorFontMetaChar::itera if (format + fmtIndex != end) font = static_castFontType(*(format + fmtIndex) FONT_MASK_FONT); -// TODO: if (font == FONT_BUTTON) -if (font == FONT_BUTTON) continue; - UTF8Char ch = *it; float offset = pos.x - start; @@ -786,57 +783,124 @@ void CText::DrawHighlight(FontHighlight hl, Math::Point pos, Math::Point size) void CText::DrawCharAndAdjustPos(UTF8Char ch, FontType font, float size, Math::Point pos, Color color) { -// TODO: if (font == FONT_BUTTON) -if (font == FONT_BUTTON) return; +if(font == FONT_BUTTON) +{ +Math::IntPoint windowSize = m_engine-GetWindowSize(); +float height = GetHeight(FONT_COLOBOT, size); +float width = height*(static_castfloat(windowSize.y)/windowSize.x); -CachedFont* cf = GetOrOpenFont(font, size); +Math::Point p1(pos.x, pos.y); +Math::Point p2(pos.x + width, pos.y + height); -if (cf == nullptr) -return; +Math::Vector n(0.0f, 0.0f, -1.0f); // normal -int width = 1; -if (ch.c1 0 ch.c1 32) -{ -if (ch.c1 == '\t') -width = m_tabSize; +// For whatever reason ch.c1 is a SIGNED char, we need to fix that +unsigned int icon = static_castunsigned char(ch.c1); +if ( icon = 192 ) +{ +icon -= 192; +m_engine-SetTexture(textures/interface/text.png); +m_engine-SetState(ENG_RSTATE_TTEXTURE_WHITE); +} +else if ( icon = 128 ) +{ +icon -= 128; +m_engine-SetTexture(textures/interface/button3.png); +m_engine-SetState(ENG_RSTATE_TTEXTURE_WHITE); +} +else if ( icon = 64 ) +{ +icon -= 64; +m_engine-SetTexture(textures/interface/button2.png); +m_engine-SetState(ENG_RSTATE_TTEXTURE_WHITE); +} +else +{ +m_engine-SetTexture(textures/interface/button1.png); +m_engine-SetState(ENG_RSTATE_TTEXTURE_WHITE); +} -ch = TranslateSpecialChar(ch.c1); -} +Math::Point uv1, uv2; +uv1.x = (32.0f / 256.0f) * (icon%8); +uv1.y = (32.0f / 256.0f) * (icon/8); +uv2.x = (32.0f / 256.0f) + uv1.x; +uv2.y = (32.0f / 256.0f) + uv1.y; -auto it = cf-cache.find(ch); -CharTexture tex; -if (it != cf-cache.end()) -{ -tex = (*it).second; +float dp = 0.5f / 256.0f; +uv1.x += dp; +uv1.y += dp; +uv2.x -= dp; +uv2.y -= dp; + +Vertex quad[4] = +{ +Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x, uv2.y)), +Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(uv1.x, uv1.y)), +Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(uv2.x, uv2.y)), +Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv2.x, uv1.y)) +}; + +m_device-DrawPrimitive(PRIMITIVE_TRIANGLE_STRIP, quad, 4, color); +m_engine-AddStatisticTriangle(2); + +// Don't ask my why but using height instead of width makes the buttons align perfectly with text without icons in category list in SatCom +// It's magic! +pos.x += height; + +// Don't forget to restore the state! +m_engine-SetState(ENG_RSTATE_TEXT); } else { -tex = CreateCharTexture(ch, cf); +CachedFont* cf = GetOrOpenFont(font, size); -if (tex.id == 0) // invalid +if (cf == nullptr) return; -cf-cache[ch] = tex; -} +int width = 1; +if (ch.c1 0 ch.c1 32) +{ +if (ch.c1 == '\t') +width = m_tabSize; -Math::Point p1(pos.x, pos.y + tex.charSize.y - tex.texSize.y); -Math::Point p2(pos.x + tex.texSize.x, pos.y + tex.charSize.y); +ch = TranslateSpecialChar(ch.c1); +} -Math::Vector n(0.0f, 0.0f, -1.0f); // normal +auto it = cf-cache.find(ch); +CharTexture tex; +if (it != cf-cache.end()) +{ +tex = (*it).second; +} +else +{ +tex =
[colobot] 310/390: Fixed NewScript
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 66ea5fd92becc469ae9a54cb785519eb3fd81f29 Author: krzys-h krzy...@interia.pl Date: Mon Apr 6 16:41:05 2015 +0200 Fixed NewScript --- src/object/auto/autofactory.cpp | 19 +++ src/object/brain.cpp| 22 ++ src/object/robotmain.cpp| 2 +- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/object/auto/autofactory.cpp b/src/object/auto/autofactory.cpp index bd3ab83..720513a 100644 --- a/src/object/auto/autofactory.cpp +++ b/src/object/auto/autofactory.cpp @@ -644,6 +644,7 @@ bool CAutoFactory::CreateVehicle() CPhysics* physics; Math::Vectorpos; float angle; +char* name; angle = m_object-GetAngleY(0); @@ -678,16 +679,18 @@ bool CAutoFactory::CreateVehicle() physics-SetFreeze(true); // it doesn't move } -/* ??? -char* name; -int i; -for ( i=0 ; i10 ; i++ ) +CBrain* brain = vehicle-GetBrain(); +if(brain != nullptr) { -name = m_main-GetNewScriptName(m_type, i); -if ( name == 0 ) break; -vehicle-ReadProgram(i, name); +for ( int i=0 ; ; i++ ) +{ +name = m_main-GetNewScriptName(m_type, i); +if ( name == nullptr ) break; +Program* prog = brain-GetOrAddProgram(i); +vehicle-ReadProgram(prog, name); +prog-readOnly = true; +} } -*/ return true; } diff --git a/src/object/brain.cpp b/src/object/brain.cpp index 1f75dfa..e645dfa 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -3133,11 +3133,14 @@ bool CBrain::AddProgram(Program* program) m_program.push_back(program); -UpdateInterface(); -Ui::CWindow* pw = static_cast Ui::CWindow* (m_interface-SearchControl(EVENT_WINDOW0)); -if ( pw != 0 ) +if(m_object-GetSelect()) { -UpdateScript(pw); +UpdateInterface(); +Ui::CWindow* pw = static_cast Ui::CWindow* (m_interface-SearchControl(EVENT_WINDOW0)); +if ( pw != 0 ) +{ +UpdateScript(pw); +} } return true; } @@ -3153,11 +3156,14 @@ void CBrain::RemoveProgram(Program* program) program-script = nullptr; delete program; -UpdateInterface(); -Ui::CWindow* pw = static_cast Ui::CWindow* (m_interface-SearchControl(EVENT_WINDOW0)); -if ( pw != 0 ) +if(m_object-GetSelect()) { -UpdateScript(pw); +UpdateInterface(); +Ui::CWindow* pw = static_cast Ui::CWindow* (m_interface-SearchControl(EVENT_WINDOW0)); +if ( pw != 0 ) +{ +UpdateScript(pw); +} } } diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index d5cc377..c0e3721 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -4831,7 +4831,7 @@ char* CRobotMain::GetNewScriptName(ObjectType type, int rank) } } -return 0; +return nullptr; } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 303/390: Changed default of countTransported to true
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 1b18b145cc4f773d6a42b12fefdc3494c26e5d1e Author: krzys-h krzy...@interia.pl Date: Sun Mar 29 15:38:48 2015 +0200 Changed default of countTransported to true This causes failure conditions to trigger in some exercises #412 --- src/object/robotmain.cpp | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 9797e3c..2efd262 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -1933,8 +1933,11 @@ void CRobotMain::DeleteAllObjects() { CObject* obj = it.second; -obj-DeleteObject(true); // destroys rapidly -delete obj; +if(obj != nullptr) +{ +obj-DeleteObject(true); // destroys rapidly +delete obj; +} } } @@ -3844,7 +3847,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) m_endTake[i].drive= line-GetParam(drive)-AsDriveType(DRIVE_OTHER); m_endTake[i].lost = line-GetParam(lost)-AsInt(-1); m_endTake[i].immediat = line-GetParam(immediat)-AsBool(false); -m_endTake[i].countTransported = line-GetParam(countTransported)-AsBool(false); +m_endTake[i].countTransported = line-GetParam(countTransported)-AsBool(true); strcpy(m_endTake[i].message, line-GetParam(message)-AsString().c_str()); //TODO: Really, ending mission on message()? Is this used anywhere? Do we need that? m_endTakeTotal ++; } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 306/390: Updated data submodule
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit e78ecc8813f69d330c8f4e7e6d296ac91ab50844 Author: krzys-h krzy...@interia.pl Date: Sun Mar 29 21:19:11 2015 +0200 Updated data submodule --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index f2b8c3a..d5ff8d5 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit f2b8c3a66f2c0230e5a6bcd260bafc1fd504c76a +Subproject commit d5ff8d51a37ba4d66a99778914f4d3751c23006b -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 304/390: Fixed occasional crash in CRobotMain::DeleteAllObjects
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 6844b2170fe7c948cd5545ff79be539c13eb4084 Author: krzys-h krzy...@interia.pl Date: Sun Mar 29 15:50:47 2015 +0200 Fixed occasional crash in CRobotMain::DeleteAllObjects --- src/object/robotmain.cpp | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 2efd262..088abd3 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -1929,15 +1929,12 @@ void CRobotMain::DeleteAllObjects() for (int i = 0; i MAXSHOWLIMIT; i++) FlushShowLimit(i); -for(auto it : CObjectManager::GetInstancePointer()-GetAllObjects()) +while(CObjectManager::GetInstancePointer()-GetAllObjects().size() 0) { -CObject* obj = it.second; +CObject* obj = CObjectManager::GetInstancePointer()-GetAllObjects().begin()-second; -if(obj != nullptr) -{ -obj-DeleteObject(true); // destroys rapidly -delete obj; -} +obj-DeleteObject(true); // destroys rapidly +delete obj; } } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 305/390: ovf's OCD
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 0ce72bdce06eb0694ccd821b1b4f268a6c65e2b0 Author: krzys-h krzy...@interia.pl Date: Sun Mar 29 20:30:29 2015 +0200 ovf's OCD ovf: krzys_h: i'm sorry, your last commit triggered a random ocd fit. http://vpaste.net/S6u62 ovf: (you don't need to apply this, i already feel better now) --- src/object/robotmain.cpp | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 088abd3..4b5304f 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -2125,17 +2125,12 @@ CObject* CRobotMain::DetectObject(Math::Point pos) { target = obj; } -else if ((type == OBJECT_POWER || - type == OBJECT_ATOMIC) - obj-GetTruck() != nullptr) // battery used? -{ -target = obj-GetTruck(); -} -else if (type == OBJECT_POWER || - type == OBJECT_ATOMIC) -{ -target = obj; -} + + else if (type == OBJECT_POWER || type == OBJECT_ATOMIC) + { + target = obj-GetTruck(); // battery connected + if (!target) target = obj; // standalone battery + } for (int j = 0; j OBJECTMAXPART; j++) { -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 318/390: Fixed saving readonly attribute (#454)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 9bc7c47d77f2fc6b419c81d2a98b88a17eb36bc9 Author: krzys-h krzy...@interia.pl Date: Tue Apr 7 13:27:11 2015 +0200 Fixed saving readonly attribute (#454) --- src/object/robotmain.cpp | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 08e4c96..65a7d29 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -4911,6 +4911,15 @@ void CRobotMain::IOWriteObject(CLevelParserLine* line, CObject* obj) { line-AddParam(run, new CLevelParserParam(run+1)); } + +auto programs = brain-GetPrograms(); +for(unsigned int i = 0; i programs.size(); i++) +{ +if(programs[i]-readOnly) +{ + line-AddParam(scriptReadOnly+boost::lexical_caststd::string(i+1), new CLevelParserParam(true)); +} +} } } @@ -5092,13 +5101,25 @@ CObject* CRobotMain::IOReadObject(CLevelParserLine *line, const char* filename, CAuto* automat = obj-GetAuto(); if (automat != nullptr) automat-Start(run); // starts the film +} -CBrain* brain = obj-GetBrain(); -if (brain != nullptr) +CBrain* brain = obj-GetBrain(); +if (brain != nullptr) +{ +if(run != -1) { Program* program = brain-GetOrAddProgram(run-1); brain-SetScriptRun(program); // marks the program to be started } + +for(unsigned int i = 0; i = 999; i++) +{ + if(line-GetParam(scriptReadOnly+boost::lexical_caststd::string(i+1))-AsBool(false)) +{ +Program* prog = brain-GetOrAddProgram(i); +prog-readOnly = true; +} +} } return obj; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 316/390: Fixed buttons eating other characters in SatCom
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit ed0850ddb63bfa9544d8662f1f85567904f92c8e Author: krzys-h krzy...@interia.pl Date: Tue Apr 7 12:26:44 2015 +0200 Fixed buttons eating other characters in SatCom --- src/graphics/engine/text.cpp | 52 ++-- src/graphics/engine/text.h | 1 + 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp index b383a6b..9ee190a 100644 --- a/src/graphics/engine/text.cpp +++ b/src/graphics/engine/text.cpp @@ -350,8 +350,12 @@ float CText::GetStringWidth(std::string text, FontType font, float size) float CText::GetCharWidth(UTF8Char ch, FontType font, float size, float offset) { -// TODO: if (font == FONT_BUTTON) -if (font == FONT_BUTTON) return 0.0f; +if (font == FONT_BUTTON) { +Math::IntPoint windowSize = m_engine-GetWindowSize(); +float height = GetHeight(FONT_COLOBOT, size); +float width = height*(static_castfloat(windowSize.y)/windowSize.x); +return width; +} int width = 1; if (ch.c1 32 ch.c1 = 0) @@ -614,7 +618,7 @@ void CText::DrawString(const std::string text, std::vectorFontMetaChar::itera unsigned int fmtIndex = 0; std::vectorUTF8Char chars; -StringToUTFCharList(text, chars); +StringToUTFCharList(text, chars, format, end); for (auto it = chars.begin(); it != chars.end(); ++it) { FontType font = FONT_COLOBOT; @@ -686,6 +690,42 @@ void CText::StringToUTFCharList(const std::string text, std::vectorUTF8Char } } +void CText::StringToUTFCharList(const std::string text, std::vectorUTF8Char chars, std::vectorFontMetaChar::iterator format, std::vectorFontMetaChar::iterator end) +{ +unsigned int index = 0; +unsigned int totalLength = text.length(); +while (index totalLength) +{ +UTF8Char ch; + +FontType font = FONT_COLOBOT; +if(format + index != end) +font = static_castFontType(*(format + index) FONT_MASK_FONT); + +int len; + +if(font == FONT_BUTTON) +{ +len = 1; +} +else +{ +len = StrUtils::Utf8CharSizeAt(text, index); +} + +if (len = 1) +ch.c1 = text[index]; +if (len = 2) +ch.c2 = text[index+1]; +if (len = 3) +ch.c3 = text[index+2]; + +index += len; + +chars.push_back(ch); +} +} + void CText::DrawString(const std::string text, FontType font, float size, Math::Point pos, float width, int eol, Color color) { @@ -795,7 +835,7 @@ void CText::DrawCharAndAdjustPos(UTF8Char ch, FontType font, float size, Math::P Math::Vector n(0.0f, 0.0f, -1.0f); // normal // For whatever reason ch.c1 is a SIGNED char, we need to fix that -unsigned int icon = static_castunsigned char(ch.c1); +unsigned char icon = static_castunsigned char(ch.c1); if ( icon = 192 ) { icon -= 192; @@ -843,9 +883,7 @@ void CText::DrawCharAndAdjustPos(UTF8Char ch, FontType font, float size, Math::P m_device-DrawPrimitive(PRIMITIVE_TRIANGLE_STRIP, quad, 4, color); m_engine-AddStatisticTriangle(2); -// Don't ask my why but using height instead of width makes the buttons align perfectly with text without icons in category list in SatCom -// It's magic! -pos.x += height; +pos.x += width; // Don't forget to restore the state! m_engine-SetState(ENG_RSTATE_TEXT); diff --git a/src/graphics/engine/text.h b/src/graphics/engine/text.h index 0551dcd..11f13c9 100644 --- a/src/graphics/engine/text.h +++ b/src/graphics/engine/text.h @@ -326,6 +326,7 @@ protected: voidDrawHighlight(FontHighlight hl, Math::Point pos, Math::Point size); voidDrawCharAndAdjustPos(UTF8Char ch, FontType font, float size, Math::Point pos, Color color); voidStringToUTFCharList(const std::string text, std::vectorUTF8Char chars); +voidStringToUTFCharList(const std::string text, std::vectorUTF8Char chars, std::vectorFontMetaChar::iterator format, std::vectorFontMetaChar::iterator end); protected: CEngine* m_engine; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 302/390: Fixed program selection shortcuts
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 30f7075f4ecfeb65ec8cc8ca469ad91bf68ff363 Author: krzys-h krzy...@interia.pl Date: Sun Mar 29 14:31:43 2015 +0200 Fixed program selection shortcuts --- src/object/brain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/object/brain.cpp b/src/object/brain.cpp index f4227e1..94a4178 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -278,8 +278,8 @@ bool CBrain::EventProcess(const Event event) index = event.key.key-KEY(1); else if(event.key.key == KEY(0)) index = 9; -if(index 0) index = 9; -if(index 9) index = 0; +if(index 0) index = m_program.size()-1; +if(index static_castint(m_program.size())-1) index = 0; if(GetSelScript() != index) { -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 307/390: Updated build bot link in INSTALL.md
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit c7f10c9e7322a7b198ecbdb13475fa3ccc18ffc6 Author: krzys_h krzy...@interia.pl Date: Sun Mar 29 21:26:03 2015 +0200 Updated build bot link in INSTALL.md --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 98ea094..4ec97b7 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -28,7 +28,7 @@ any of the missions. ### Compiling on Windows The recommended way of compiling for Windows is using Linux in a cross-compilation environment called MXE. -This is the way our build bot service (http://colobot.info/files/compiled.php) prepares the release packages. +This is the way our build bot service (http://compiled.colobot.info/) prepares the release packages. You can also compile directly on Windows with MSYS2/MinGW-w64 but this is a bit more difficult to set up. Cross-compiling using MXE -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 361/390: Implemented graceful degradation of shadow quality when not enough texture units are available
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit d210dcf70edca4907fc5e957f95ea7c6df26f5e2 Author: Tomasz Kapuściński tomaszka...@gmail.com Date: Fri May 15 10:12:35 2015 +0200 Implemented graceful degradation of shadow quality when not enough texture units are available --- src/graphics/engine/engine.cpp | 177 ++- src/graphics/opengl/gldevice.cpp | 1 + 2 files changed, 100 insertions(+), 78 deletions(-) diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index 4b571aa..38196b1 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -3192,11 +3192,13 @@ void CEngine::Render() // Begin the scene m_device-BeginScene(); -if (m_shadowMapping) -RenderShadowMap(); - if (m_drawWorld) +{ +if (m_shadowMapping) +RenderShadowMap(); + Draw3DScene(); +} m_app-StartPerformanceCounter(PCNT_RENDER_INTERFACE); DrawInterface(); @@ -3242,85 +3244,94 @@ void CEngine::Draw3DScene() { if (m_qualityShadows) { -// Texture Unit 2 -m_device-SetTextureEnabled(2, true); -m_device-SetTexture(2, m_shadowMap); -m_device-SetTextureMatrix(2, m_shadowTextureMat); - -Math::Matrix identity; -identity.LoadIdentity(); -m_device-SetTransform(TRANSFORM_WORLD, identity); - -float shadowBias = 0.6f; -float shadowUnbias = 1.0f - shadowBias; - -TextureStageParams params; -params.colorOperation = TEX_MIX_OPER_MODULATE; -params.colorArg1 = TEX_MIX_ARG_TEXTURE; -params.colorArg2 = TEX_MIX_ARG_FACTOR; -params.colorOperation = TEX_MIX_OPER_DEFAULT; -params.factor = Color(shadowBias, shadowBias, shadowBias, 1.0f); -params.wrapS = TEX_WRAP_CLAMP_TO_BORDER; -params.wrapT = TEX_WRAP_CLAMP_TO_BORDER; - -m_device-SetTextureStageParams(2, params); - -TextureGenerationParams genParams; - -for (int i = 0; i 4; i++) +if (m_device-GetMaxTextureStageCount() 6) { -genParams.coords[i].mode = TEX_GEN_EYE_LINEAR; - -for (int j = 0; j 4; j++) -{ -genParams.coords[i].plane[j] = (i == j ? 1.0f : 0.0f); -} +m_qualityShadows = false; +GetLogger()-Error(Cannot use quality shadow maps, not enough texture units\n); +GetLogger()-Error(Attempting to use lower quality shadow maps\n); } +else +{ +// Texture Unit 2 +m_device-SetTextureEnabled(2, true); +m_device-SetTexture(2, m_shadowMap); +m_device-SetTextureMatrix(2, m_shadowTextureMat); -m_device-SetTextureCoordGeneration(2, genParams); - -// Texture Unit 3 -m_device-SetTextureEnabled(3, true); -m_device-SetTexture(3, m_shadowMap); - -params.LoadDefault(); -params.colorOperation = TEX_MIX_OPER_ADD; -params.colorArg1 = TEX_MIX_ARG_COMPUTED_COLOR; -params.colorArg2 = TEX_MIX_ARG_FACTOR; -params.alphaOperation = TEX_MIX_OPER_DEFAULT; -params.factor = Color(shadowUnbias, shadowUnbias, shadowUnbias, 0.0f); -params.wrapS = TEX_WRAP_CLAMP_TO_BORDER; -params.wrapT = TEX_WRAP_CLAMP_TO_BORDER; +Math::Matrix identity; +identity.LoadIdentity(); +m_device-SetTransform(TRANSFORM_WORLD, identity); -m_device-SetTextureStageParams(3, params); +float shadowBias = 0.6f; +float shadowUnbias = 1.0f - shadowBias; -// Texture Unit 4 -m_device-SetTextureEnabled(4, true); -m_device-SetTexture(4, m_shadowMap); +TextureStageParams params; +params.colorOperation = TEX_MIX_OPER_MODULATE; +params.colorArg1 = TEX_MIX_ARG_TEXTURE; +params.colorArg2 = TEX_MIX_ARG_FACTOR; +params.colorOperation = TEX_MIX_OPER_DEFAULT; +params.factor = Color(shadowBias, shadowBias, shadowBias, 1.0f); +params.wrapS = TEX_WRAP_CLAMP_TO_BORDER; +params.wrapT = TEX_WRAP_CLAMP_TO_BORDER; -params.LoadDefault(); -params.colorOperation = TEX_MIX_OPER_MODULATE; -params.colorArg1 = TEX_MIX_ARG_COMPUTED_COLOR; -params.colorArg2 = TEX_MIX_ARG_SRC_COLOR; -params.alphaOperation = TEX_MIX_OPER_DEFAULT; -params.wrapS = TEX_WRAP_CLAMP_TO_BORDER; -params.wrapT = TEX_WRAP_CLAMP_TO_BORDER; +
[colobot] 345/390: Added CBot functions for rounding: floor(), ceil(), round(), and trunc()
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit c28e1f6150c36d478d8415852a7e23a86128d743 Author: Tomasz Kapuściński tomaszka...@gmail.com Date: Wed May 6 23:29:55 2015 +0200 Added CBot functions for rounding: floor(), ceil(), round(), and trunc() --- src/script/cbottoken.cpp | 12 src/script/scriptfunc.cpp | 48 +++ src/script/scriptfunc.h | 4 3 files changed, 64 insertions(+) diff --git a/src/script/cbottoken.cpp b/src/script/cbottoken.cpp index 81c7187..004c2b4 100644 --- a/src/script/cbottoken.cpp +++ b/src/script/cbottoken.cpp @@ -253,6 +253,10 @@ std::string GetHelpFilename(const char *token) if ( strcmp(token, pow ) == 0 ) return std::string(help/) + CApplication::GetInstancePointer()-GetLanguageChar() + std::string(/cbot/expr.txt); if ( strcmp(token, rand ) == 0 ) return std::string(help/) + CApplication::GetInstancePointer()-GetLanguageChar() + std::string(/cbot/expr.txt); if ( strcmp(token, abs ) == 0 ) return std::string(help/) + CApplication::GetInstancePointer()-GetLanguageChar() + std::string(/cbot/expr.txt); +if ( strcmp(token, floor ) == 0 ) return std::string(help/) + CApplication::GetInstancePointer()-GetLanguageChar() + std::string(/cbot/expr.txt); +if ( strcmp(token, ceil ) == 0 ) return std::string(help/) + CApplication::GetInstancePointer()-GetLanguageChar() + std::string(/cbot/expr.txt); +if ( strcmp(token, round ) == 0 ) return std::string(help/) + CApplication::GetInstancePointer()-GetLanguageChar() + std::string(/cbot/expr.txt); +if ( strcmp(token, trunc ) == 0 ) return std::string(help/) + CApplication::GetInstancePointer()-GetLanguageChar() + std::string(/cbot/expr.txt); if ( strcmp(token, getbuild ) == 0 ) return std::string(help/) + CApplication::GetInstancePointer()-GetLanguageChar() + std::string(/cbot/getbuild.txt); if ( strcmp(token, getresearchenable ) == 0 ) return std::string(help/) + CApplication::GetInstancePointer()-GetLanguageChar() + std::string(/cbot/getresen.txt); if ( strcmp(token, getresearchdone ) == 0 ) return std::string(help/) + CApplication::GetInstancePointer()-GetLanguageChar() + std::string(/cbot/getresdo.txt); @@ -383,6 +387,10 @@ bool IsFunction(const char *token) if ( strcmp(token, pow ) == 0 ) return true; if ( strcmp(token, rand ) == 0 ) return true; if ( strcmp(token, abs ) == 0 ) return true; +if ( strcmp(token, floor) == 0 ) return true; +if ( strcmp(token, ceil ) == 0 ) return true; +if ( strcmp(token, round) == 0 ) return true; +if ( strcmp(token, trunc) == 0 ) return true; if ( strcmp(token, getbuild ) == 0 ) return true; if ( strcmp(token, getresearchenable ) == 0 ) return true; if ( strcmp(token, getresearchdone ) == 0 ) return true; @@ -479,6 +487,10 @@ const char* GetHelpText(const char *token) if ( strcmp(token, pow ) == 0 ) return pow ( x, y );; if ( strcmp(token, rand ) == 0 ) return rand ( );; if ( strcmp(token, abs ) == 0 ) return abs ( value );; +if ( strcmp(token, floor ) == 0 ) return floor ( value );; +if ( strcmp(token, ceil ) == 0 ) return ceil ( value );; +if ( strcmp(token, round ) == 0 ) return round ( value );; +if ( strcmp(token, trunc ) == 0 ) return trunc ( value );; if ( strcmp(token, getbuild ) == 0 ) return getbuild ( );; if ( strcmp(token, getresearchenable ) == 0 ) return getresearchenable ( );; if ( strcmp(token, getresearchdone ) == 0 ) return getresearchdone ( );; diff --git a/src/script/scriptfunc.cpp b/src/script/scriptfunc.cpp index cd05061..8ffa6a0 100644 --- a/src/script/scriptfunc.cpp +++ b/src/script/scriptfunc.cpp @@ -346,6 +346,50 @@ bool CScriptFunctions::rAbs(CBotVar* var, CBotVar* result, int exception, void* return true; } +// Instruction floor() + +bool CScriptFunctions::rFloor(CBotVar* var, CBotVar* result, int exception, void* user) +{ +float value; + +value = var-GetValFloat(); +result-SetValFloat(floor(value)); +return true; +} + +// Instruction ceil() + +bool CScriptFunctions::rCeil(CBotVar* var, CBotVar* result, int exception, void* user) +{ +float value; + +value = var-GetValFloat(); +result-SetValFloat(ceil(value)); +return true; +} + +// Instruction round() + +bool CScriptFunctions::rRound(CBotVar* var, CBotVar* result, int exception, void* user) +{ +float value; + +value = var-GetValFloat(); +result-SetValFloat(round(value)); +return true; +} + +// Instruction trunc() + +bool CScriptFunctions::rTrunc(CBotVar* var, CBotVar* result, int exception, void* user) +{ +float value; + +value =
[colobot] 359/390: Aligned unit tests to compile under MSVC
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit fd182e55154a170004a53a124c76a3d2015b3224 Author: Piotr Dziwinski piot...@gmail.com Date: Wed May 13 20:58:07 2015 +0200 Aligned unit tests to compile under MSVC --- test/unit/app/system_windows_test.cpp | 21 ++-- test/unit/math/matrix_test.cpp| 194 +++--- 2 files changed, 97 insertions(+), 118 deletions(-) diff --git a/test/unit/app/system_windows_test.cpp b/test/unit/app/system_windows_test.cpp index 265ef48..f18f1c3 100644 --- a/test/unit/app/system_windows_test.cpp +++ b/test/unit/app/system_windows_test.cpp @@ -21,24 +21,23 @@ #include gtest/gtest.h +class CSystemUtilsWindowsWrapper : public CSystemUtilsWindows +{ +public: +void SetFrequency(long long frequency) +{ +m_counterFrequency = frequency; +} +}; + class SystemUtilsWindowsUT : public testing::Test { protected: static const long long SEC = 10; -CSystemUtilsWindows m_systemUtils; +CSystemUtilsWindowsWrapper m_systemUtils; }; - -TEST_F(SystemUtilsWindowsUT, TimerResolution) -{ -m_systemUtils.SetFrequency(SEC); -EXPECT_EQ(1u, m_systemUtils.GetTimeStampExactResolution()); - -m_systemUtils.SetFrequency(SEC/3); -EXPECT_EQ(3u, m_systemUtils.GetTimeStampExactResolution()); -} - TEST_F(SystemUtilsWindowsUT, TimeStampDiff) { m_systemUtils.SetFrequency(SEC); diff --git a/test/unit/math/matrix_test.cpp b/test/unit/math/matrix_test.cpp index 3b67d69..568f622 100644 --- a/test/unit/math/matrix_test.cpp +++ b/test/unit/math/matrix_test.cpp @@ -29,28 +29,26 @@ #include gtest/gtest.h -const float TEST_TOLERANCE = 1e-6; +const float TEST_TOLERANCE = 1e-6f; TEST(MatrixTest, TransposeTest) { const Math::Matrix mat( -(float[4][4]) { -{ -0.07011674491203920, 1.26145596067429810, 2.09476603598066902, 0.35560176915570696 }, -{ -1.34075615966224704, 1.17988499016709314, 0.00601713429241016, -0.75213676977972566 }, -{ 0.59186722295223981, 0.88089224074765293, 0.70994467464257294, 0.36730385425340212 }, -{ -0.95649396555068111, 0.75912182022565566, 1.34883305778387186, -1.34957997578168754 } +{ -0.07011674491203920f, 1.26145596067429810f, 2.09476603598066902f, 0.35560176915570696f }, +{ -1.34075615966224704f, 1.17988499016709314f, 0.00601713429241016f, -0.75213676977972566f }, +{ 0.59186722295223981f, 0.88089224074765293f, 0.70994467464257294f, 0.36730385425340212f }, +{ -0.95649396555068111f, 0.75912182022565566f, 1.34883305778387186f, -1.34957997578168754f } } ); const Math::Matrix expectedTranspose( -(float[4][4]) { -{ -0.07011674491203920, -1.34075615966224704, 0.59186722295223981, -0.95649396555068111 }, -{ 1.26145596067429810, 1.17988499016709314, 0.88089224074765293, 0.75912182022565566 }, -{ 2.09476603598066902, 0.00601713429241016, 0.70994467464257294, 1.34883305778387186 }, -{ 0.35560176915570696, -0.75213676977972566, 0.36730385425340212, -1.34957997578168754 } +{ -0.07011674491203920f, -1.34075615966224704f, 0.59186722295223981f, -0.95649396555068111f }, +{ 1.26145596067429810f, 1.17988499016709314f, 0.88089224074765293f, 0.75912182022565566f }, +{ 2.09476603598066902f, 0.00601713429241016f, 0.70994467464257294f, 1.34883305778387186f }, +{ 0.35560176915570696f, -0.75213676977972566f, 0.36730385425340212f, -1.34957997578168754f } } ); @@ -62,22 +60,20 @@ TEST(MatrixTest, TransposeTest) TEST(MatrixTest, CofactorTest) { const Math::Matrix mat1( -(float[4][4]) { -{ 0.610630320796245, 1.059932357918312, -1.581674311378210, 1.782214448453331 }, -{ 0.191028848211526, -0.813898708757524, 1.516114203870644, 0.395202639476002 }, -{ 0.335142750345279, -0.346586619596529, 0.545382042472336, -0.879268918923072 }, -{ 1.417588151657198, 1.450841789070141, 0.219080104196171, 0.378724047481655 } +{ 0.610630320796245f, 1.059932357918312f, -1.581674311378210f, 1.782214448453331f }, +{ 0.191028848211526f, -0.813898708757524f, 1.516114203870644f, 0.395202639476002f }, +{ 0.335142750345279f, -0.346586619596529f, 0.545382042472336f, -0.879268918923072f }, +{ 1.417588151657198f, 1.450841789070141f, 0.219080104196171f, 0.378724047481655f } } ); const Math::Matrix expectedCofactors1( -(float[4][4]) { -{ -2.402679369186782, 2.282452509293019, 1.722732204057644, -0.746939701104385 }, -{ -0.687677756877654, 1.168949180331164, -0.985354966837796, -1.33407592705 }, -
[colobot] 350/390: Added experimental support for dynamic shadows (shadow mapping)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 0b2f00530bc05cf918665223c4dde07dc506cf09 Author: Tomasz Kapuściński tomaszka...@gmail.com Date: Mon May 11 15:21:17 2015 +0200 Added experimental support for dynamic shadows (shadow mapping) --- src/app/app.h| 1 + src/graphics/core/device.h | 25 +++- src/graphics/core/nulldevice.cpp | 29 - src/graphics/core/nulldevice.h | 11 +- src/graphics/core/texture.h | 49 src/graphics/engine/engine.cpp | 239 ++- src/graphics/engine/engine.h | 23 src/graphics/opengl/gldevice.cpp | 228 + src/graphics/opengl/gldevice.h | 27 - 9 files changed, 594 insertions(+), 38 deletions(-) diff --git a/src/app/app.h b/src/app/app.h index d8a1e1d..651e3be 100644 --- a/src/app/app.h +++ b/src/app/app.h @@ -123,6 +123,7 @@ enum PerformanceCounter PCNT_RENDER_TERRAIN,//! rendering the terrain PCNT_RENDER_OBJECTS,//! rendering the 3D objects PCNT_RENDER_INTERFACE, //! rendering 2D interface +PCNT_RENDER_SHADOW_MAP, //! rendering shadow map PCNT_ALL, //! all counters together diff --git a/src/graphics/core/device.h b/src/graphics/core/device.h index f790c24..16b32b3 100644 --- a/src/graphics/core/device.h +++ b/src/graphics/core/device.h @@ -91,8 +91,7 @@ enum TransformType { TRANSFORM_WORLD, TRANSFORM_VIEW, -TRANSFORM_PROJECTION, -TRANSFORM_TEXTURE +TRANSFORM_PROJECTION }; /** @@ -107,7 +106,8 @@ enum RenderState RENDER_STATE_DEPTH_TEST, RENDER_STATE_DEPTH_WRITE, RENDER_STATE_ALPHA_TEST, -RENDER_STATE_CULLING +RENDER_STATE_CULLING, +RENDER_STATE_DEPTH_BIAS }; /** @@ -276,6 +276,8 @@ public: virtual Texture CreateTexture(CImage *image, const TextureCreateParams params) = 0; //! Creates a texture from raw image data; image data can be freed after that virtual Texture CreateTexture(ImageData *data, const TextureCreateParams params) = 0; +//! Creates a depth texture with specific dimensions and depth +virtual Texture CreateDepthTexture(int width, int height, int depth) = 0; //! Deletes a given texture, freeing it from video memory virtual void DestroyTexture(const Texture texture) = 0; //! Deletes all textures created so far @@ -296,6 +298,12 @@ public: //! Sets only the texture wrap modes (for faster than thru stage params) virtual void SetTextureStageWrap(int index, TexWrapMode wrapS, TexWrapMode wrapT) = 0; +//! Sets the texture coordinate generation mode for given texture unit +virtual void SetTextureCoordGeneration(int index, TextureGenerationParams params) = 0; + +//! Sets texture coordinate transform matrix +virtual void SetTextureMatrix(int index, Math::Matrix matrix) = 0; + //! Renders primitive composed of vertices with single texture virtual void DrawPrimitive(PrimitiveType type, const Vertex *vertices, int vertexCount, Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) = 0; @@ -333,14 +341,20 @@ public: //! Returns a mask of frustum planes for which the test is positive virtual int ComputeSphereVisibility(const Math::Vector center, float radius) = 0; +//! Changes rendering viewport +virtual void SetViewport(int x, int y, int width, int height) = 0; + //! Enables/disables the given render state virtual void SetRenderState(RenderState state, bool enabled) = 0; +//! Sets the color mask +virtual void SetColorMask(bool red, bool green, bool blue, bool alpha) = 0; + //! Sets the function of depth test virtual void SetDepthTestFunc(CompFunc func) = 0; //! Sets the depth bias (constant value added to Z-coords) -virtual void SetDepthBias(float factor) = 0; +virtual void SetDepthBias(float factor, float units) = 0; //! Sets the alpha test function and reference value virtual void SetAlphaTestFunc(CompFunc func, float refValue) = 0; @@ -366,6 +380,9 @@ public: //! Sets the current fill mode virtual void SetFillMode(FillMode mode) = 0; +//! Copies content of framebuffer to texture +virtual void CopyFramebufferToTexture(Texture texture, int xOffset, int yOffset, int x, int y, int width, int height) = 0; + //! Returns the pixels of the entire screen virtual void* GetFrameBufferPixels() const = 0; }; diff --git a/src/graphics/core/nulldevice.cpp b/src/graphics/core/nulldevice.cpp index f5e426d..869bb89 100644 --- a/src/graphics/core/nulldevice.cpp +++ b/src/graphics/core/nulldevice.cpp @@ -128,6 +128,13 @@ Texture CNullDevice::CreateTexture(ImageData *data, const TextureCreateParams p return tex; } +Texture CNullDevice::CreateDepthTexture(int width, int height, int depth) +{ +
[colobot] 352/390: Added support for offscreen rendering and high resolution shadow maps
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 2665847c413b289dfb230d3ba97accb749fc52f2 Author: Tomasz Kapuściński tomaszka...@gmail.com Date: Tue May 12 13:09:31 2015 +0200 Added support for offscreen rendering and high resolution shadow maps --- src/graphics/core/device.h | 6 ++- src/graphics/core/nulldevice.cpp | 4 ++ src/graphics/core/nulldevice.h | 2 + src/graphics/core/texture.h | 8 src/graphics/engine/engine.cpp | 51 - src/graphics/engine/engine.h | 4 +- src/graphics/opengl/gldevice.cpp | 96 src/graphics/opengl/gldevice.h | 15 +++ 8 files changed, 171 insertions(+), 15 deletions(-) diff --git a/src/graphics/core/device.h b/src/graphics/core/device.h index 16b32b3..ba8db6d 100644 --- a/src/graphics/core/device.h +++ b/src/graphics/core/device.h @@ -107,7 +107,8 @@ enum RenderState RENDER_STATE_DEPTH_WRITE, RENDER_STATE_ALPHA_TEST, RENDER_STATE_CULLING, -RENDER_STATE_DEPTH_BIAS +RENDER_STATE_DEPTH_BIAS, +RENDER_STATE_OFFSCREEN_RENDERING }; /** @@ -380,6 +381,9 @@ public: //! Sets the current fill mode virtual void SetFillMode(FillMode mode) = 0; +//! Initializes offscreen buffer +virtual void InitOffscreenBuffer(int width, int height) = 0; + //! Copies content of framebuffer to texture virtual void CopyFramebufferToTexture(Texture texture, int xOffset, int yOffset, int x, int y, int width, int height) = 0; diff --git a/src/graphics/core/nulldevice.cpp b/src/graphics/core/nulldevice.cpp index 869bb89..4ab69d1 100644 --- a/src/graphics/core/nulldevice.cpp +++ b/src/graphics/core/nulldevice.cpp @@ -355,6 +355,10 @@ FillMode CNullDevice::GetFillMode() return FILL_POINT; } +void CNullDevice::InitOffscreenBuffer(int width, int height) +{ +} + void CNullDevice::CopyFramebufferToTexture(Texture texture, int xOffset, int yOffset, int x, int y, int width, int height) { } diff --git a/src/graphics/core/nulldevice.h b/src/graphics/core/nulldevice.h index a80c5fa..9dea04a 100644 --- a/src/graphics/core/nulldevice.h +++ b/src/graphics/core/nulldevice.h @@ -139,6 +139,8 @@ public: virtual void SetFillMode(FillMode mode) ; virtual FillMode GetFillMode(); +virtual void InitOffscreenBuffer(int width, int height); + virtual void CopyFramebufferToTexture(Texture texture, int xOffset, int yOffset, int x, int y, int width, int height); virtual void* GetFrameBufferPixels() const; diff --git a/src/graphics/core/texture.h b/src/graphics/core/texture.h index 70fc845..49d3610 100644 --- a/src/graphics/core/texture.h +++ b/src/graphics/core/texture.h @@ -128,6 +128,14 @@ enum TexMixArgument { //! Color from current texture TEX_MIX_ARG_TEXTURE, +//! Color from texture unit 0 +TEX_MIX_ARG_TEXTURE_0, +//! Color from texture unit 1 +TEX_MIX_ARG_TEXTURE_1, +//! Color from texture unit 2 +TEX_MIX_ARG_TEXTURE_2, +//! Color from texture unit 3 +TEX_MIX_ARG_TEXTURE_3, //! Color computed by previous texture unit (current in DirectX; previous in OpenGL) TEX_MIX_ARG_COMPUTED_COLOR, //! (Source) color of textured fragment (diffuse in DirectX; primary color in OpenGL) diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index 5009254..b0c8f6d 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -117,7 +117,7 @@ CEngine::CEngine(CApplication *app) m_textureMipmapLevel = 1; m_textureAnisotropy = 1; m_shadowMapping = false; -m_npotShadowMap = false; +m_offscreenShadowRendering = false; m_totoMode = true; m_lensMode = true; m_waterMode = true; @@ -186,7 +186,7 @@ CEngine::CEngine(CApplication *app) if (CProfile::GetInstance().GetIntProperty(Setup, ShadowMapping, value)) { m_shadowMapping = (value 0); -m_npotShadowMap = (value 1); +m_offscreenShadowRendering = (value 1); } m_defaultTexParams.format = TEX_IMG_AUTO; @@ -3336,6 +3336,9 @@ void CEngine::Draw3DScene() params.coords[i].mode = TEX_GEN_NONE; m_device-SetTextureCoordGeneration(2, params); + +m_device-SetTexture(3, 0); +m_device-SetTextureEnabled(3, false); } // Draws the shadows , if shadows enabled @@ -3515,8 +3518,6 @@ void CEngine::RenderShadowMap() m_app-StartPerformanceCounter(PCNT_RENDER_SHADOW_MAP); -m_device-Clear(); - // If no shadow map texture exists, create it if (m_shadowMap.id == 0) { @@ -3524,9 +3525,18 @@ void CEngine::RenderShadowMap() int depth = m_app-GetInstance().GetVideoConfig().depthSize; -if (m_npotShadowMap) +if (m_offscreenShadowRendering) { -width = height = Math::Min(m_size.x, m_size.y); +int size; + +
[colobot] 355/390: Updated data subdirectory
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 0c75ca6c24bfda8b856915a41b7b714f00956fb9 Author: Piotr Dziwinski piot...@gmail.com Date: Tue May 12 21:51:32 2015 +0200 Updated data subdirectory --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index f11f9c7..68fd619 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit f11f9c7bc72f769585a8ba699124f4bf89787010 +Subproject commit 68fd619311d8c00402e150df71d861c300f8d957 -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 358/390: Remove unused system utils functions
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 0ddfdebab311d264234981007cda2ab254f51bf9 Author: Piotr Dziwinski piot...@gmail.com Date: Wed May 13 20:52:19 2015 +0200 Remove unused system utils functions --- src/app/system.cpp | 16 src/app/system.h | 6 -- src/app/system_linux.cpp | 5 - src/app/system_linux.h | 1 - src/app/system_other.cpp | 5 - src/app/system_other.h | 1 - src/app/system_windows.cpp | 5 - src/app/system_windows.h | 1 - 8 files changed, 40 deletions(-) diff --git a/src/app/system.cpp b/src/app/system.cpp index 6b18f63..6546131 100644 --- a/src/app/system.cpp +++ b/src/app/system.cpp @@ -157,22 +157,6 @@ void CSystemUtils::CopyTimeStamp(SystemTimeStamp *dst, SystemTimeStamp *src) *dst = *src; } -float CSystemUtils::GetTimeStampResolution(SystemTimeUnit unit) -{ -unsigned long long exact = GetTimeStampExactResolution(); -float result = 0.0f; -if (unit == STU_SEC) -result = exact * 1e-9; -else if (unit == STU_MSEC) -result = exact * 1e-6; -else if (unit == STU_USEC) -result = exact * 1e-3; -else -assert(false); - -return result; -} - float CSystemUtils::TimeStampDiff(SystemTimeStamp *before, SystemTimeStamp *after, SystemTimeUnit unit) { long long exact = TimeStampExactDiff(before, after); diff --git a/src/app/system.h b/src/app/system.h index ab25801..74702de 100644 --- a/src/app/system.h +++ b/src/app/system.h @@ -115,12 +115,6 @@ public: //! Returns a time stamp associated with current time virtual void GetCurrentTimeStamp(SystemTimeStamp *stamp) = 0; -//! Returns the platform's expected time stamp resolution -TEST_VIRTUAL float GetTimeStampResolution(SystemTimeUnit unit = STU_SEC); - -//! Returns the platform's exact (in nanosecond units) expected time stamp resolution -virtual long long GetTimeStampExactResolution() = 0; - //! Returns a difference between two timestamps in given time unit /** The difference is \a after - \a before. */ TEST_VIRTUAL float TimeStampDiff(SystemTimeStamp *before, SystemTimeStamp *after, SystemTimeUnit unit = STU_SEC); diff --git a/src/app/system_linux.cpp b/src/app/system_linux.cpp index 1a1b76d..2427b09 100644 --- a/src/app/system_linux.cpp +++ b/src/app/system_linux.cpp @@ -87,11 +87,6 @@ void CSystemUtilsLinux::GetCurrentTimeStamp(SystemTimeStamp *stamp) clock_gettime(CLOCK_MONOTONIC_RAW, stamp-clockTime); } -long long CSystemUtilsLinux::GetTimeStampExactResolution() -{ -return 1ll; -} - long long CSystemUtilsLinux::TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) { return (after-clockTime.tv_nsec - before-clockTime.tv_nsec) + diff --git a/src/app/system_linux.h b/src/app/system_linux.h index b60954e..64501c4 100644 --- a/src/app/system_linux.h +++ b/src/app/system_linux.h @@ -45,7 +45,6 @@ public: virtual SystemDialogResult SystemDialog(SystemDialogType type, const std::string title, const std::string message) OVERRIDE; virtual void GetCurrentTimeStamp(SystemTimeStamp *stamp) OVERRIDE; -virtual long long GetTimeStampExactResolution() OVERRIDE; virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) OVERRIDE; virtual std::string GetSaveDir() OVERRIDE; diff --git a/src/app/system_other.cpp b/src/app/system_other.cpp index bedeb23..c156cb3 100644 --- a/src/app/system_other.cpp +++ b/src/app/system_other.cpp @@ -30,11 +30,6 @@ void CSystemUtilsOther::GetCurrentTimeStamp(SystemTimeStamp* stamp) stamp-sdlTicks = SDL_GetTicks(); } -long long int CSystemUtilsOther::GetTimeStampExactResolution() -{ -return 100ll; -} - long long int CSystemUtilsOther::TimeStampExactDiff(SystemTimeStamp* before, SystemTimeStamp* after) { return (after-sdlTicks - before-sdlTicks) * 100ll; diff --git a/src/app/system_other.h b/src/app/system_other.h index 862f63e..586a53d 100644 --- a/src/app/system_other.h +++ b/src/app/system_other.h @@ -46,7 +46,6 @@ public: virtual SystemDialogResult SystemDialog(SystemDialogType type, const std::string title, const std::string message) OVERRIDE; virtual void GetCurrentTimeStamp(SystemTimeStamp *stamp) OVERRIDE; -virtual long long int GetTimeStampExactResolution() OVERRIDE; virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) OVERRIDE; virtual void Usleep(int usec) OVERRIDE; diff --git a/src/app/system_windows.cpp b/src/app/system_windows.cpp index e16b65a..7acb790 100644 --- a/src/app/system_windows.cpp +++ b/src/app/system_windows.cpp @@ -83,11 +83,6 @@ void CSystemUtilsWindows::GetCurrentTimeStamp(SystemTimeStamp* stamp) stamp-counterValue = value.QuadPart; } -long long int CSystemUtilsWindows::GetTimeStampExactResolution() -{ -return
[colobot] 335/390: Provide usleep() in CSystemUtils interface
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit d003247120e43853eacd5a6c32ed4bd80993a2f8 Author: Piotr Dziwinski piot...@gmail.com Date: Mon Apr 27 18:35:41 2015 +0200 Provide usleep() in CSystemUtils interface --- src/app/app.cpp | 11 +-- src/app/system.h| 3 +++ src/app/system_linux.cpp| 6 ++ src/app/system_linux.h | 2 ++ src/app/system_macosx.cpp | 6 ++ src/app/system_macosx.h | 3 +++ src/app/system_other.cpp| 4 src/app/system_other.h | 2 ++ src/app/system_windows.cpp | 11 +++ src/app/system_windows.h| 2 ++ test/unit/app/system_mock.h | 1 + 11 files changed, 45 insertions(+), 6 deletions(-) diff --git a/src/app/app.cpp b/src/app/app.cpp index b642cc0..5f98b4c 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -52,7 +52,6 @@ #include stdlib.h #include libintl.h -#include unistd.h #include getopt.h #include localename.h @@ -169,7 +168,7 @@ CApplication::~CApplication() { delete m_private; m_private = nullptr; - + delete m_input; m_input = nullptr; @@ -394,7 +393,7 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) std::string w, h; std::getline(resolution, w, 'x'); std::getline(resolution, h, 'x'); - + m_deviceConfig.size.x = atoi(w.c_str()); m_deviceConfig.size.y = atoi(h.c_str()); m_resolutionOverride = true; @@ -539,7 +538,7 @@ bool CApplication::Create() m_exitCode = 4; return false; } - + SDL_WM_SetCaption(m_windowTitle.c_str(), m_windowTitle.c_str()); } @@ -1009,7 +1008,7 @@ int CApplication::Run() if (m_lowCPU) { -usleep(2); // should still give plenty of fps +GetSystemUtils()-Usleep(2); // should still give plenty of fps } } } @@ -1134,7 +1133,7 @@ Event CApplication::ProcessSystemEvent() event.active.gain = m_private-currentEvent.active.gain == 1; } - + m_input-EventProcess(event); return event; diff --git a/src/app/system.h b/src/app/system.h index d52020b..327f60d 100644 --- a/src/app/system.h +++ b/src/app/system.h @@ -140,6 +140,9 @@ public: //! Returns the save dir location virtual std::string GetSaveDir(); + +//! Sleep for given amount of microseconds +virtual void Usleep(int usecs) = 0; }; //! Global function to get CSystemUtils instance diff --git a/src/app/system_linux.cpp b/src/app/system_linux.cpp index 6fbfb05..1a1b76d 100644 --- a/src/app/system_linux.cpp +++ b/src/app/system_linux.cpp @@ -22,6 +22,7 @@ #include common/logger.h #include stdlib.h +#include unistd.h void CSystemUtilsLinux::Init() @@ -123,3 +124,8 @@ std::string CSystemUtilsLinux::GetSaveDir() return savegameDir; } + +void CSystemUtilsLinux::Usleep(int usec) +{ +usleep(usec); +} diff --git a/src/app/system_linux.h b/src/app/system_linux.h index d8654f9..b60954e 100644 --- a/src/app/system_linux.h +++ b/src/app/system_linux.h @@ -50,6 +50,8 @@ public: virtual std::string GetSaveDir() OVERRIDE; +virtual void Usleep(int usec) OVERRIDE; + private: bool m_zenityAvailable; }; diff --git a/src/app/system_macosx.cpp b/src/app/system_macosx.cpp index 208b4a7..ebd1846 100644 --- a/src/app/system_macosx.cpp +++ b/src/app/system_macosx.cpp @@ -22,6 +22,7 @@ #include common/logger.h #include stdlib.h +#include unistd.h // MacOS-specific headers #include CoreFoundation/CFBundle.h @@ -106,3 +107,8 @@ std::string CSystemUtilsMacOSX::GetSaveDir() return savegameDir; } + +void CSystemUtilsMacOSX::Usleep(int usec) +{ +usleep(usec); +} diff --git a/src/app/system_macosx.h b/src/app/system_macosx.h index f3d8734..a853ae4 100644 --- a/src/app/system_macosx.h +++ b/src/app/system_macosx.h @@ -33,6 +33,9 @@ public: virtual std::string GetDataPath() OVERRIDE; virtual std::string GetLangPath() OVERRIDE; virtual std::string GetSaveDir() OVERRIDE; + +virtual void Usleep(int usec) OVERRIDE; + private: std::string m_ASPath; std::string m_dataPath; diff --git a/src/app/system_other.cpp b/src/app/system_other.cpp index c21314c..bedeb23 100644 --- a/src/app/system_other.cpp +++ b/src/app/system_other.cpp @@ -40,3 +40,7 @@ long long int CSystemUtilsOther::TimeStampExactDiff(SystemTimeStamp* before, Sys return (after-sdlTicks - before-sdlTicks) * 100ll; } +void CSystemUtilsOther::Usleep(int usec) +{ +SDL_Delay(usec / 1000); // close enough +} diff --git a/src/app/system_other.h b/src/app/system_other.h index db2d0f3..862f63e 100644 --- a/src/app/system_other.h +++ b/src/app/system_other.h @@ -48,5 +48,7 @@ public: virtual void
[colobot] 329/390: Fixed monospace CBot editor font (closes #464)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit d23170aaf1e35381410cf3b564be56b75c68f38d Author: krzys-h krzy...@interia.pl Date: Thu Apr 23 21:01:04 2015 +0200 Fixed monospace CBot editor font (closes #464) --- src/ui/edit.cpp | 6 +++--- src/ui/studio.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index 3ebc281..8c5853e 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -1483,7 +1483,7 @@ bool CEdit::ReadText(std::string filename, int addSize) m_format.reserve(m_maxChar+1); for (i = 0; i = m_maxChar+1; i++) { -m_format.push_back(0); +m_format.push_back(m_fontType); } stream.close(); @@ -1924,7 +1924,7 @@ void CEdit::SetMaxChar(int max) m_format.reserve(m_maxChar+1); for (int i = 0; i = m_maxChar+1; i++) { -m_format.push_back(0); +m_format.push_back(m_fontType); } m_len = 0; @@ -2120,7 +2120,7 @@ void CEdit::SetMultiFont(bool bMulti) m_format.reserve(m_maxChar+1); for (int i = 0; i = m_maxChar+1; i++) { -m_format.push_back(0); +m_format.push_back(m_fontType); } } } diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index 659d0c3..f4d131b 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -595,7 +595,7 @@ void CStudio::StartEditScript(CScript *script, std::string name, Program* progra //? if ( m_bRunning ) edit-SetEdit(false); edit-SetMaxChar(EDITSTUDIOMAX); edit-SetFontType(Gfx::FONT_COURIER); -edit-SetFontStretch(0.7f); +edit-SetFontStretch(1.0f); edit-SetDisplaySpec(true); edit-SetAutoIndent(m_engine-GetEditIndentMode()); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 356/390: Updated data subdirectory
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit d18650c477febcbf318666aa01a867805d50dd2e Author: Piotr Dziwinski piot...@gmail.com Date: Tue May 12 22:06:55 2015 +0200 Updated data subdirectory --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index 68fd619..f86c10b 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 68fd619311d8c00402e150df71d861c300f8d957 +Subproject commit f86c10bbd4d8966acfa2ed10d1fffe3d90553bdc -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 354/390: Updated data subdirectory
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 09ad10c57ce6d6bb36fa2350a0adb5dcfb878372 Author: Piotr Dziwinski piot...@gmail.com Date: Tue May 12 21:37:41 2015 +0200 Updated data subdirectory --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index 85baaaf..f11f9c7 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 85baaaf19d74080bca6331112dcd98804dea6c03 +Subproject commit f11f9c7bc72f769585a8ba699124f4bf89787010 -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 346/390: Changed terrain UV mapping (fixes #306 for OpenGL engine, will cause similar problem on Direct3D)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 3164e7256e6702aa4a53c62f0a6eec143ef30e87 Author: Tomasz Kapuściński tomaszka...@gmail.com Date: Thu May 7 12:58:05 2015 +0200 Changed terrain UV mapping (fixes #306 for OpenGL engine, will cause similar problem on Direct3D) --- src/graphics/engine/terrain.cpp | 16 ++-- src/graphics/opengl/gldevice.cpp | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/graphics/engine/terrain.cpp b/src/graphics/engine/terrain.cpp index b58685b..a97b840 100644 --- a/src/graphics/engine/terrain.cpp +++ b/src/graphics/engine/terrain.cpp @@ -637,21 +637,25 @@ bool CTerrain::CreateMosaic(int ox, int oy, int step, int objRank, p1.coord.x -= o.coord.x; p1.coord.z -= o.coord.z; p2.coord.x -= o.coord.x; p2.coord.z -= o.coord.z; +// TODO: Find portable solution +//float offset = 0.5f / 256.0f; // Direct3D +float offset = 0.0f; // OpenGL + if (x == 0) { -p1.texCoord.x = 0.0f+(0.5f/256.0f); -p2.texCoord.x = 0.0f+(0.5f/256.0f); +p1.texCoord.x = 0.0f + offset; +p2.texCoord.x = 0.0f + offset; } if (x == brick) { -p1.texCoord.x = 1.0f-(0.5f/256.0f); -p2.texCoord.x = 1.0f-(0.5f/256.0f); +p1.texCoord.x = 1.0f - offset; +p2.texCoord.x = 1.0f - offset; } if (y == 0) -p1.texCoord.y = 1.0f-(0.5f/256.0f); +p1.texCoord.y = 1.0f - offset; if (y == brick - step) -p2.texCoord.y = 0.0f+(0.5f/256.0f); +p2.texCoord.y = 0.0f - offset; if (m_useMaterials) { diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp index 582ed26..8809fd2 100644 --- a/src/graphics/opengl/gldevice.cpp +++ b/src/graphics/opengl/gldevice.cpp @@ -550,7 +550,7 @@ Texture CGLDevice::CreateTexture(ImageData *data, const TextureCreateParams par glBindTexture(GL_TEXTURE_2D, result.id); // Set texture parameters -GLint minF = 0, magF = 0; +GLint minF = GL_NEAREST, magF = GL_NEAREST; int mipmapLevel = 1; switch (params.filter) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 343/390: Changed CBot file handling, potentially solved problems with 64-bit executables
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 1db9d8bdca98989b38fd91efffa00c44daf269dc Author: Tomasz Kapuściński tomaszka...@gmail.com Date: Wed May 6 20:39:09 2015 +0200 Changed CBot file handling, potentially solved problems with 64-bit executables --- src/script/scriptfunc.cpp | 49 ++- src/script/scriptfunc.h | 4 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/src/script/scriptfunc.cpp b/src/script/scriptfunc.cpp index 281a216..cd05061 100644 --- a/src/script/scriptfunc.cpp +++ b/src/script/scriptfunc.cpp @@ -56,7 +56,6 @@ #endif - // Compiling a procedure without any parameters. CBotTypResult CScriptFunctions::cNull(CBotVar* var, void* user) @@ -3249,8 +3248,10 @@ bool CScriptFunctions::rCameraFocus(CBotVar* var, CBotVar* result, int exceptio // Static variables -int CScriptFunctions::m_CompteurFileOpen = 0; -std::string CScriptFunctions::m_filesDir; +int CScriptFunctions::m_CompteurFileOpen = 0; +std::string CScriptFunctions::m_filesDir; +std::unordered_mapint, FILE* CScriptFunctions::m_files; +int CScriptFunctions::m_nextFile = 1; @@ -3320,10 +3321,14 @@ bool CScriptFunctions::rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pRes if ( pFile == NULL ) { Exception = CBotErrFileOpen; return false; } m_CompteurFileOpen ++; + +int fileHandle = m_nextFile++; + +m_files[fileHandle] = pFile; // save the file handle pVar = pThis-GetItem(handle); -pVar-SetValInt(reinterpret_castlong(pFile)); +pVar-SetValInt(fileHandle); } return true; @@ -3365,12 +3370,16 @@ bool CScriptFunctions::rfdestruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResu // don't open? no problem :) if ( pVar-GetInit() != IS_DEF) return true; + +int fileHandle = pVar-GetValInt(); -FILE* pFile= reinterpret_castFILE*(pVar-GetValInt()); +FILE* pFile = m_files[fileHandle]; fclose(pFile); -m_CompteurFileOpen --; +m_CompteurFileOpen--; pVar-SetInit(IS_NAN); + +m_files.erase(fileHandle); return true; } @@ -3432,8 +3441,12 @@ bool CScriptFunctions::rfopen (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, m_CompteurFileOpen ++; // save file handle +int fileHandle = m_nextFile++; + +m_files[fileHandle] = pFile; + pVar = pThis-GetItem(handle); -pVar-SetValInt(reinterpret_castlong(pFile)); +pVar-SetValInt(fileHandle); pResult-SetValInt(true); return true; @@ -3472,18 +3485,22 @@ CBotTypResult CScriptFunctions::cfopen (CBotVar* pThis, CBotVar* pVar) bool CScriptFunctions::rfclose (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int Exception) { // it shouldn't be any parameters -if ( pVar != NULL ) return CBotErrOverParam; +if (pVar != NULL) { Exception = CBotErrOverParam; return false; } // retrieve the item handle pVar = pThis-GetItem(handle); if ( pVar-GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } -FILE* pFile= reinterpret_castFILE*(pVar-GetValInt()); +int fileHandle = pVar-GetValInt(); + +FILE* pFile = m_files[fileHandle]; fclose(pFile); -m_CompteurFileOpen --; +m_CompteurFileOpen--; pVar-SetInit(IS_NAN); + +m_files.erase(fileHandle); return true; } @@ -3516,7 +3533,9 @@ bool CScriptFunctions::rfwrite (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, if ( pVar-GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } -FILE* pFile= reinterpret_castFILE*(pVar-GetValInt()); +int fileHandle = pVar-GetValInt(); + +FILE* pFile = m_files[fileHandle]; int res = fputs(param+CBotString(\n), pFile); @@ -3555,7 +3574,9 @@ bool CScriptFunctions::rfread (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, if ( pVar-GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } -FILE* pFile= reinterpret_castFILE*(pVar-GetValInt()); +int fileHandle = pVar-GetValInt(); + +FILE* pFile = m_files[fileHandle]; charchaine[2000]; int i; @@ -3596,7 +3617,9 @@ bool CScriptFunctions::rfeof (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, i if ( pVar-GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } -FILE* pFile= reinterpret_castFILE*(pVar-GetValInt()); +int fileHandle = pVar-GetValInt(); + +FILE* pFile = m_files[fileHandle]; pResult-SetValInt( feof( pFile ) ); diff --git a/src/script/scriptfunc.h b/src/script/scriptfunc.h index 365e5e7..08c2be2 100644 --- a/src/script/scriptfunc.h +++ b/src/script/scriptfunc.h @@ -29,6 +29,7 @@ #include
[colobot] 101/390: Fixed save directories in things not yet refactored to use PHYSFS
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit c0ac60e4facfc9d7a588dd2a23fe548b7212975b Author: krzys-h krzy...@interia.pl Date: Mon Oct 20 21:15:39 2014 +0200 Fixed save directories in things not yet refactored to use PHYSFS --- src/common/resources/resourcemanager.cpp | 8 ++ src/common/resources/resourcemanager.h | 1 + src/object/robotmain.cpp | 10 ++-- src/object/robotmain.h | 1 + src/ui/maindialog.cpp| 42 ++-- src/ui/maindialog.h | 3 ++- src/ui/studio.cpp| 2 +- 7 files changed, 45 insertions(+), 22 deletions(-) diff --git a/src/common/resources/resourcemanager.cpp b/src/common/resources/resourcemanager.cpp index 21aceec..42f9634 100644 --- a/src/common/resources/resourcemanager.cpp +++ b/src/common/resources/resourcemanager.cpp @@ -97,6 +97,14 @@ bool CResourceManager::SetSaveLocation(const std::string location) return false; } +std::string CResourceManager::GetSaveLocation() +{ +if(PHYSFS_isInit()) { +return PHYSFS_getWriteDir(); +} +return ; +} + SDL_RWops* CResourceManager::GetSDLFileHandler(const std::string filename) { diff --git a/src/common/resources/resourcemanager.h b/src/common/resources/resourcemanager.h index e949746..730cf3e 100644 --- a/src/common/resources/resourcemanager.h +++ b/src/common/resources/resourcemanager.h @@ -35,6 +35,7 @@ public: static bool RemoveLocation(const std::string location); static bool SetSaveLocation(const std::string location); +static std::string GetSaveLocation(); static SDL_RWops* GetSDLFileHandler(const std::string filename); static CSNDFile* GetSNDFileHandler(const std::string filename); diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 91e2d61..6ca1da1 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -5427,7 +5427,7 @@ void CRobotMain::LoadOneScript(CObject *obj, int nbError) char filename[MAX_FNAME]; sprintf(filename, %s/%s/%c%.3d%.3d%.1d.txt, -GetSavegameDir(), m_gamerName.c_str(), name[0], rank, objRank, i); +GetPHYSFSSavegameDir(), m_gamerName.c_str(), name[0], rank, objRank, i); brain-ReadProgram(i, filename); if (!brain-GetCompile(i)) nbError++; } @@ -5497,7 +5497,7 @@ void CRobotMain::SaveOneScript(CObject *obj) { char filename[MAX_FNAME]; sprintf(filename, %s/%s/%c%.3d%.3d%.1d.txt, -GetSavegameDir(), m_gamerName.c_str(), name[0], rank, objRank, i); +GetPHYSFSSavegameDir(), m_gamerName.c_str(), name[0], rank, objRank, i); brain-WriteProgram(i, filename); } } @@ -6623,6 +6623,12 @@ bool CRobotMain::GetRadar() return false; } +//TODO: Use PHYSFS everywhere +const char* CRobotMain::GetPHYSFSSavegameDir() +{ +return m_dialog-GetPHYSFSSavegameDir().c_str(); +} + const char* CRobotMain::GetSavegameDir() { return m_dialog-GetSavegameDir().c_str(); diff --git a/src/object/robotmain.h b/src/object/robotmain.h index 882265c..a55318d 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -329,6 +329,7 @@ public: boolGetSceneSoluce(); boolGetShowAll(); boolGetRadar(); +const char* GetPHYSFSSavegameDir(); const char* GetSavegameDir(); const char* GetPublicDir(); const char* GetFilesDir(); diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index dec4586..3857d2e 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -182,8 +182,8 @@ CMainDialog::CMainDialog() } m_savegameDir = savegame; -m_publicDir = program; -m_filesDir = m_savegameDir; +m_publicDir = CResourceManager::GetSaveLocation()+/program; //TODO: Refactor to use PHYSFS +m_filesDir = CResourceManager::GetSaveLocation()+/files; //TODO: Refactor to use PHYSFS m_setupFull = m_app-GetVideoConfig().fullScreen; @@ -3311,13 +3311,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) { @@ -3563,15 +3563,15 @@ void CMainDialog::NameCreate() } -if(!CResourceManager::DirectoryExists(m_savegameDir)) -CResourceManager::CreateDirectory(m_savegameDir); +if(!CResourceManager::DirectoryExists(GetPHYSFSSavegameDir())) +
[colobot] 100/390: Possibly fixed goto() by changing safety margin
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit cf7be276dcfac10891422773cee79da9a5e09d6c Author: krzys-h krzy...@interia.pl Date: Mon Oct 20 20:44:57 2014 +0200 Possibly fixed goto() by changing safety margin TODO: More testing Closes #326 --- src/object/task/taskgoto.cpp | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/object/task/taskgoto.cpp b/src/object/task/taskgoto.cpp index 2ddb92e..46629e0 100644 --- a/src/object/task/taskgoto.cpp +++ b/src/object/task/taskgoto.cpp @@ -37,7 +37,12 @@ const float FLY_DIST_GROUND = 80.0f;// minimum distance to remain on the ground const float FLY_DEF_HEIGHT = 50.0f;// default flying height -const float BM_DIM_STEP = 5.0f; + +// Settings that define goto() accuracy: +const float BM_DIM_STEP = 5.0f; // Size of one pixel on the bitmap. Setting 5 means that 5x5 square (in game units) will be represented by 1 px on the bitmap. Decreasing this value will make a bigger bitmap, and may increase accuracy. TODO: Check how it actually impacts goto() accuracy +const float BEAM_ACCURACY = 5.0f;// higher value = more accurate, but slower +const float SAFETY_MARGIN = 0.5f; // Smallest distance between two objects. Smaller = less no route to destination, but higher probability of collisions between objects. +// Changing SAFETY_MARGIN (old value was 4.0f) seems to have fixed many issues with goto(). TODO: maybe we could make it even smaller? Did changing it introduce any new bugs? @@ -1739,7 +1744,7 @@ Error CTaskGoto::BeamSearch(const Math::Vector start, const Math::Vector goal, m_bmStep ++; len = Math::DistanceProjected(start, goal); -step = len/5.0f; +step = len/BEAM_ACCURACY; if ( step BM_DIM_STEP*2.1f ) step = BM_DIM_STEP*2.1f; if ( step 20.0f) step = 20.0f; nbIter = 200; // in order not to lower the framerate @@ -1969,7 +1974,7 @@ void CTaskGoto::BitmapObject() } if ( type == OBJECT_PARA ) oRadius -= 2.0f; -BitmapSetCircle(oPos, oRadius+iRadius+4.0f); +BitmapSetCircle(oPos, oRadius+iRadius+SAFETY_MARGIN); } } } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 97/390: Merge branch 'dev-physfs' into dev
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 0245fdc6c328edf65b4fd9f45be4f440ef92b6eb Merge: d7ef0a1 83abb8c Author: krzys-h krzy...@interia.pl Date: Sun Oct 19 16:18:36 2014 +0200 Merge branch 'dev-physfs' into dev Conflicts: src/app/app.cpp .gitignore |2 + .travis.yml|2 +- CMakeLists.txt |1 + cmake/FindPhysFS.cmake | 36 + data |2 +- desktop/.gitignore |3 + lib/localename/.gitignore |1 + src/CMakeLists.txt | 13 +- src/app/app.cpp| 120 +- src/app/app.h | 16 +- src/app/gamedata.cpp | 139 -- src/app/gamedata.h | 69 - src/app/main.cpp |2 + src/app/pausemanager.cpp | 18 +- src/app/system.cpp | 10 +- src/app/system.h |7 +- src/app/system_linux.cpp | 34 +- src/app/system_linux.h |3 +- src/app/system_macosx.cpp | 14 +- src/app/system_macosx.h|3 +- src/app/system_windows.cpp | 25 +- src/app/system_windows.h |3 +- src/common/image.cpp | 14 +- src/common/profile.cpp | 58 +- src/common/profile.h |3 - .../resources/inputstream.cpp} | 56 +- .../resources/inputstream.h} | 28 +- src/common/resources/inputstreambuffer.cpp | 132 ++ .../resources/inputstreambuffer.h} | 40 +- .../resources/outputstream.cpp}| 50 +- .../resources/outputstream.h} | 27 +- src/common/resources/outputstreambuffer.cpp| 89 ++ .../resources/outputstreambuffer.h}| 35 +- src/common/resources/resourcemanager.cpp | 280 src/common/resources/resourcemanager.h | 63 + src/common/resources/sndfile.cpp | 133 ++ .../system_macosx.h = common/resources/sndfile.h} | 38 +- src/graphics/engine/cloud.cpp |6 +- src/graphics/engine/engine.cpp | 49 +- src/graphics/engine/lightning.cpp |2 +- src/graphics/engine/modelfile.cpp | 20 +- src/graphics/engine/modelmanager.cpp |7 +- src/graphics/engine/particle.cpp |8 +- src/graphics/engine/planet.cpp |4 +- src/graphics/engine/pyro.cpp |4 +- src/graphics/engine/terrain.cpp| 19 +- src/graphics/engine/text.cpp | 22 +- src/graphics/engine/water.cpp |6 +- src/object/auto/autobase.cpp |4 +- src/object/level/parser.cpp| 244 src/object/level/parser.h | 69 + src/object/level/parserexceptions.cpp | 45 + .../level/parserexceptions.h} | 46 +- src/object/level/parserline.cpp| 90 ++ src/object/level/parserline.h | 62 + src/object/level/parserparam.cpp | 940 ++ src/object/level/parserparam.h | 137 ++ src/object/robotmain.cpp | 1371 +--- src/object/robotmain.h | 12 +- src/script/cmdtoken.cpp|2 + src/script/script.cpp | 52 +- src/sound/oalsound/alsound.cpp | 23 +- src/sound/oalsound/alsound.h | 67 +- src/sound/oalsound/buffer.cpp | 33 +- src/sound/sound.cpp|2 +- src/ui/button.cpp |2 +- src/ui/check.cpp |2 +- src/ui/color.cpp |2 +- src/ui/compass.cpp |2 +- src/ui/control.cpp | 14 +- src/ui/displayinfo.cpp | 282 src/ui/displayinfo.h |1 - src/ui/edit.cpp| 83 +- src/ui/gauge.cpp |2 +- src/ui/group.cpp
[colobot] 75/390: On development builds store savegame data in current directory
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit c2b878745360b302dab2a14624a55c6990ad4510 Author: krzys-h krzy...@interia.pl Date: Mon Sep 29 21:39:21 2014 +0200 On development builds store savegame data in current directory --- src/app/app.cpp | 4 1 file changed, 4 insertions(+) diff --git a/src/app/app.cpp b/src/app/app.cpp index 80f178b..b07c3e8 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -149,7 +149,11 @@ CApplication::CApplication() m_dataPath = GetSystemUtils()-GetDataPath(); m_langPath = GetSystemUtils()-GetLangPath(); +#if DEV_BUILD +m_savePath = saves; +#else m_savePath = GetSystemUtils()-GetSaveDir(); +#endif m_runSceneName = ; m_runSceneRank = 0; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 87/390: Merge branch 'dev' into dev-physfs
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit f65b00089ac537f9e37d0d4b7f44881fed4a09f1 Merge: eab300c 9fd6cf5 Author: krzys-h krzy...@interia.pl Date: Tue Oct 14 15:42:19 2014 +0200 Merge branch 'dev' into dev-physfs Conflicts: data LICENSE-HEADER.txt | 18 + README.md| 30 +- data |2 +- po/CMakeLists.txt|5 +- po/colobot.pot | 83 +- po/de.po | 2646 +++-- po/fr.po | 2644 +++-- po/pl.po | 2664 +++--- po/ru.po | 2400 +++ src/CBot/CBot.cpp| 33 +- src/CBot/CBot.h | 33 +- src/CBot/CBotAddExpr.cpp | 33 +- src/CBot/CBotClass.cpp | 33 +- src/CBot/CBotCompExpr.cpp| 33 +- src/CBot/CBotDll.h | 33 +- src/CBot/CBotFunction.cpp| 33 +- src/CBot/CBotIf.cpp | 33 +- src/CBot/CBotProgram.cpp | 33 +- src/CBot/CBotStack.cpp | 38 +- src/CBot/CBotString.cpp | 33 +- src/CBot/CBotToken.cpp | 33 +- src/CBot/CBotToken.h | 33 +- src/CBot/CBotTwoOpExpr.cpp | 33 +- src/CBot/CBotVar.cpp | 33 +- src/CBot/CBotWhile.cpp | 33 +- src/CBot/StringFunctions.cpp | 33 +- src/CBot/resource.h | 33 +- src/app/app.cpp | 34 +- src/app/app.h| 34 +- src/app/main.cpp | 34 +- src/app/pausemanager.cpp | 34 +- src/app/pausemanager.h | 34 +- src/app/system.cpp | 34 +- src/app/system.h | 34 +- src/app/system_linux.cpp | 34 +- src/app/system_linux.h | 34 +- src/app/system_macosx.cpp| 34 +- src/app/system_macosx.h | 34 +- src/app/system_other.cpp | 34 +- src/app/system_other.h | 34 +- src/app/system_windows.cpp | 34 +- src/app/system_windows.h | 34 +- src/common/event.cpp | 33 +- src/common/event.h | 33 +- src/common/global.h | 33 +- src/common/image.cpp | 33 +- src/common/image.h | 33 +- src/common/iman.cpp | 33 +- src/common/iman.h| 33 +- src/common/ioutils.h | 33 +- src/common/key.h | 33 +- src/common/logger.cpp| 33 +- src/common/logger.h | 33 +- src/common/misc.cpp | 33 +- src/common/misc.h| 33 +- src/common/profile.cpp | 33 +- src/common/profile.h | 33 +- src/common/restext.cpp | 1396 +++--- src/common/restext.h | 33 +- src/common/singleton.h | 33 +- src/common/stringutils.cpp | 33 +- src/common/stringutils.h | 33 +- src/graphics/core/color.cpp | 33 +- src/graphics/core/color.h| 33 +- src/graphics/core/device.h | 34 +- src/graphics/core/light.h| 34 +- src/graphics/core/material.h | 33 +- src/graphics/core/texture.h | 33 +- src/graphics/core/vertex.h | 33 +- src/graphics/engine/camera.cpp | 34 +- src/graphics/engine/camera.h | 34 +- src/graphics/engine/cloud.cpp| 34 +- src/graphics/engine/cloud.h | 34 +- src/graphics/engine/engine.cpp | 34 +- src/graphics/engine/engine.h | 34 +- src/graphics/engine/lightman.cpp | 34 +- src/graphics/engine/lightman.h | 34 +- src/graphics/engine/lightning.cpp| 34 +- src/graphics/engine/lightning.h | 34 +- src/graphics/engine/modelfile.cpp| 34 +- src/graphics/engine/modelfile.h | 34 +-
[colobot] 85/390: Updated license from PPC to TerranovaTeam
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit ca18d01630a70147e69de235e8f5c2c3e4e0a44b Author: krzys-h krzy...@interia.pl Date: Tue Oct 14 15:07:44 2014 +0200 Updated license from PPC to TerranovaTeam Polish Portal of Colobot (PPC) changed name to International Colobot Community (ICC). The part of the community actively working on the game is known as TerranovaTeam. --- LICENSE-HEADER.txt | 18 ++ README.md | 30 +++--- tools/update-license.sh | 12 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/LICENSE-HEADER.txt b/LICENSE-HEADER.txt new file mode 100644 index 000..bd65abe --- /dev/null +++ b/LICENSE-HEADER.txt @@ -0,0 +1,18 @@ +/* + * 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/README.md b/README.md index 7961e90..7987b7e 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # English -Welcome to the Colobot project code repository +Welcome to the Colobot: Gold Edition project code repository -This is official repository for the open-source Colobot project developed by Polish Portal of Colobot (PPC; in Polish: Polski Portal Colobota) with the official site at: [colobot.info](http://colobot.info/joomla). +This is official repository for the open-source Colobot: Gold Edition project developed by TerranovaTeam, part of International Colobot Community (ICC, previously known as Polish Portal of Colobot/PPC) with the official site at: [colobot.info](http://colobot.info/). -The source code contained here was released by Epsitec -- the original creator of the game -- on open source (GPLv3) license. The code was given and the rights granted specifically to PPC community in March 2012. Since then, we have been developing the game further. +The source code contained here was released by Epsitec -- the original creator of the game -- on open source (GPLv3) license. The code was given and the rights granted specifically to ICC community in March 2012. Since then, we have been developing the game further. -More information for developers (in English) can be found on the [developer wiki](http://colobot.info/wiki/Dev:Main_Page) or (in Polish) [our forum](http://colobot.info/forum/). However, the freshest source of information is our IRC channels (see below). +More information for developers (in English) can be found on the [developer wiki](http://colobot.info/wiki/dev/) or [our forum](http://colobot.info/forum/). However, the freshest source of information is our IRC channels (see below). This repository contains only the source code of the project. The game requires also data files which are now provided as git submodule and are hosted in [separate repository](https://github.com/colobot/colobot-data). @@ -24,7 +24,7 @@ In the future, we will begin development on a new installment in the Colobot ser ## Download packages -We provide compiled packages of most recent versions using an [automated build bot service](http://colobot.info/files/compiled.php). Available versions include packages for Windows and Linux in both Release and Debug configurations. +We provide compiled packages of most recent versions using an [automated build bot service](http://compiled.colobot.info/). Available versions include packages for Windows and Linux in both Release and Debug configurations. On some Linux distributions there are also distribution packages available: * Debian Sid (unstable): http://packages.debian.org/sid/colobot @@ -38,7 +38,7 @@ If you want to compile colobot yourself, see [INSTALL.md](https://github.com/col ## Contact -If you want to help in the project, please contact us on our IRC channels or [our forum](http://colobot.info/forum/) (Polish, though there is an English board as well). +If you want to help in the project, please contact us on our IRC channels or [our forum](http://colobot.info/forum/). ### IRC channels @@ -48,15 +48,15 @@ If you want to help in the project, please contact us on our IRC channels or [ou # Polski
[colobot] 81/390: Fixed CBot debugger (#325)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 72b4228abe583cd953491575cf42bae17ff5e9d2 Author: krzys-h krzy...@interia.pl Date: Tue Oct 7 22:28:32 2014 +0200 Fixed CBot debugger (#325) --- src/CBot/CBotStack.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CBot/CBotStack.cpp b/src/CBot/CBotStack.cpp index 1679e5e..84472ac 100644 --- a/src/CBot/CBotStack.cpp +++ b/src/CBot/CBotStack.cpp @@ -787,8 +787,9 @@ void CBotStack::GetRunPos(const char* FunctionName, int start, int end) while (p-m_next != NULL) { + if ( p-m_instr != NULL ) instr = p-m_instr; -if ( p-m_bFunc == 1 ) funct = p-m_instr; +if ( p-m_bFunc == 1 p-m_instr != NULL ) funct = p-m_instr; if ( p-m_next-m_prog != prog ) break ; if (p-m_next2 p-m_next2-m_state != 0) p = p-m_next2 ; @@ -807,7 +808,7 @@ void CBotStack::GetRunPos(const char* FunctionName, int start, int end) t = instr-GetToken(); start = t-GetStart(); -end = t-GetEnd(); +end = t-GetEnd(); } CBotVar* CBotStack::GetStackVars(const char* FunctionName, int level) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 82/390: GCC 4.6 compilation fixes
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 342210b0628d417a32f375efbfbd91f5537ab148 Author: Piotr Dziwinski piot...@gmail.com Date: Tue Oct 7 23:25:37 2014 +0200 GCC 4.6 compilation fixes --- src/common/resources/sndfile.cpp| 9 ++--- src/common/resources/sndfile.h | 9 + src/object/level/parserexceptions.h | 5 - 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/common/resources/sndfile.cpp b/src/common/resources/sndfile.cpp index b71f06a..d9d4ccb 100644 --- a/src/common/resources/sndfile.cpp +++ b/src/common/resources/sndfile.cpp @@ -20,9 +20,12 @@ CSNDFile::CSNDFile(const std::string filename) +: m_file_info{} +, m_snd_file{nullptr} +, m_file{nullptr} +, m_last_error{} +, m_snd_callbacks{SNDLength, SNDSeek, SNDRead, SNDWrite, SNDTell} { -memset(m_file_info, 0, sizeof(SF_INFO)); - if (PHYSFS_isInit()) { m_file = PHYSFS_openRead(filename.c_str()); @@ -33,7 +36,7 @@ CSNDFile::CSNDFile(const std::string filename) } if (m_file) { -m_snd_file = sf_open_virtual(snd_callbacks, SFM_READ, m_file_info, m_file); +m_snd_file = sf_open_virtual(m_snd_callbacks, SFM_READ, m_file_info, m_file); if (!m_snd_file) { m_last_error = Could not load file; diff --git a/src/common/resources/sndfile.h b/src/common/resources/sndfile.h index 5fc00f4..7d6d589 100644 --- a/src/common/resources/sndfile.h +++ b/src/common/resources/sndfile.h @@ -42,12 +42,5 @@ private: SNDFILE *m_snd_file; PHYSFS_File *m_file; std::string m_last_error; - -SF_VIRTUAL_IO snd_callbacks = { -SNDLength, -SNDSeek, -SNDRead, -SNDWrite, -SNDTell -}; +SF_VIRTUAL_IO m_snd_callbacks; }; diff --git a/src/object/level/parserexceptions.h b/src/object/level/parserexceptions.h index 813467f..ca87ce1 100644 --- a/src/object/level/parserexceptions.h +++ b/src/object/level/parserexceptions.h @@ -30,8 +30,9 @@ class CLevelParserException : public std::exception { public: CLevelParserException(std::string message) noexcept; +virtual ~CLevelParserException() noexcept {} const char* what() const noexcept; - + protected: std::string m_message; }; @@ -40,10 +41,12 @@ class CLevelParserExceptionMissingParam : public CLevelParserException { public: CLevelParserExceptionMissingParam(CLevelParserParam* thisParam) noexcept; +virtual ~CLevelParserExceptionMissingParam() noexcept {} }; class CLevelParserExceptionBadParam : public CLevelParserException { public: CLevelParserExceptionBadParam(CLevelParserParam* thisParam, std::string requestedType) noexcept; +virtual ~CLevelParserExceptionBadParam() noexcept {} }; \ No newline at end of file -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 77/390: Fixed issue #324
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 2770ee8927cb91419b1918f46228435026790cf6 Author: krzys-h krzy...@interia.pl Date: Tue Oct 7 21:40:51 2014 +0200 Fixed issue #324 --- data | 2 +- src/object/brain.cpp | 16 ++-- src/object/brain.h | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/data b/data index a521070..559797f 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit a521070bb17737e1d3990ba09d09d036749635ab +Subproject commit 559797f35b88a2d5e882119034923b2ab75817e2 diff --git a/src/object/brain.cpp b/src/object/brain.cpp index ca578ba..01f20f9 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -820,6 +820,18 @@ void CBrain::StopTask() } } +// Stops the current secondary task. + +void CBrain::StopSecondaryTask() +{ +if (m_secondaryTask != nullptr) +{ +m_secondaryTask-Abort(); +delete m_secondaryTask; // stops the current secondary task +m_secondaryTask = nullptr; +} +} + // Introduces a virus into a program. // Returns true if it was inserted. @@ -1000,7 +1012,7 @@ Error CBrain::StartTaskRecover() Error CBrain::StartTaskShield(TaskShieldMode mode) { -StopTask(); +StopSecondaryTask(); m_secondaryTask = new CTaskManager(m_object); Error err = m_secondaryTask-StartTaskShield(mode, 1000.0f); @@ -1048,7 +1060,7 @@ Error CBrain::StartTaskFireAnt(Math::Vector impact) Error CBrain::StartTaskGunGoal(float dirV, float dirH) { -StopTask(); +StopSecondaryTask(); m_secondaryTask = new CTaskManager(m_object); Error err = m_secondaryTask-StartTaskGunGoal(dirV, dirH); diff --git a/src/object/brain.h b/src/object/brain.h index 8a6b13e..6b0d790 100644 --- a/src/object/brain.h +++ b/src/object/brain.h @@ -102,6 +102,7 @@ public: int GetProgram(); voidStopProgram(); voidStopTask(); +voidStopSecondaryTask(); boolIntroduceVirus(); voidSetActiveVirus(bool bActive); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 70/390: Updated level check script
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit fd68ac923acb14550c5eb2c8d07ef6c9ed87714c Author: krzys-h krzy...@interia.pl Date: Sat Sep 27 18:27:45 2014 +0200 Updated level check script --- tools/check-levels.sh | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/check-levels.sh b/tools/check-levels.sh index 22544fb..127375f 100755 --- a/tools/check-levels.sh +++ b/tools/check-levels.sh @@ -2,8 +2,18 @@ # Runs every level in scenetest mode -levels=`ls /usr/local/share/games/colobot/levels | cut -d . -f 1` -for level in $levels; do - echo $level - colobot -runscene $level -scenetest -loglevel warn +categories=`ls /usr/local/share/games/colobot/levels` +for category in $categories; do + if [ $category = other ]; then continue; fi + chapters=`ls /usr/local/share/games/colobot/levels/$category` + for chapter in $chapters; do + chapter=`echo -n $chapter | tail -c 1` + levels=`ls /usr/local/share/games/colobot/levels/$category/chapter00$chapter` + for level in $levels; do + if [ ! -d /usr/local/share/games/colobot/levels/$category/chapter00$chapter/$level ]; then continue; fi + level=`echo -n $level | cut -d . -f 1 | tail -c 3` + echo $category$chapter$level + colobot -runscene $category$chapter$level -scenetest -loglevel warn + done + done done -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 95/390: Small fix to 72b4228abe583cd953491575cf42bae17ff5e9d2
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit c001c46cb53b3aedc7cbb0670f1c475679cf3d3d Author: krzys-h krzy...@interia.pl Date: Sun Oct 19 15:27:00 2014 +0200 Small fix to 72b4228abe583cd953491575cf42bae17ff5e9d2 --- src/CBot/CBotStack.cpp | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/CBot/CBotStack.cpp b/src/CBot/CBotStack.cpp index 6e5e7d8..42d5617 100644 --- a/src/CBot/CBotStack.cpp +++ b/src/CBot/CBotStack.cpp @@ -790,7 +790,6 @@ void CBotStack::GetRunPos(const char* FunctionName, int start, int end) while (p-m_next != NULL) { - if ( p-m_instr != NULL ) instr = p-m_instr; if ( p-m_bFunc == 1 p-m_instr != NULL ) funct = p-m_instr; if ( p-m_next-m_prog != prog ) break ; @@ -800,7 +799,7 @@ void CBotStack::GetRunPos(const char* FunctionName, int start, int end) } if ( p-m_instr != NULL ) instr = p-m_instr; -if ( p-m_bFunc == 1 ) funct = p-m_instr; +if ( p-m_bFunc == 1 p-m_instr != NULL ) funct = p-m_instr; if ( funct == NULL ) return; @@ -829,16 +828,19 @@ CBotVar* CBotStack::GetStackVars(const char* FunctionName, int level) if (p-m_next2 p-m_next2-m_state != 0) p = p-m_next2 ; elsep = p-m_next; } +// Now p is the highest element on the stack // descends upon the elements of block while ( p != NULL !p-m_bBlock )p = p-m_prev; +// Now p is on the beggining of the top block (with local variables) while ( p != NULL level++ 0 ) { p = p-m_prev; while ( p != NULL !p-m_bBlock )p = p-m_prev; } +// Now p is on the block level if ( p == NULL ) return NULL; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 295/390: Alt+tab minimize to taskbar (#391, fixes #329)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 78795c4b44fc56a145e79e79a607950156372639 Author: krzys-h krzy...@interia.pl Date: Sun Mar 22 16:10:32 2015 +0100 Alt+tab minimize to taskbar (#391, fixes #329) --- src/app/app.cpp | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/app/app.cpp b/src/app/app.cpp index b7c1a32..b642cc0 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -1065,6 +1065,13 @@ Event CApplication::ProcessSystemEvent() // See issue #427 for details if(event.key.key == KEY(KP_ENTER)) event.key.key = KEY(RETURN); + +if(event.key.key == KEY(TAB) ((event.kmodState KEY_MOD(ALT)) != 0)) +{ +GetLogger()-Debug(Minimize to taskbar\n); +SDL_WM_IconifyWindow(); +event.type = EVENT_NULL; +} } else if ( (m_private-currentEvent.type == SDL_MOUSEBUTTONDOWN) || (m_private-currentEvent.type == SDL_MOUSEBUTTONUP) ) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 292/390: Fixed submodule
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit f3dd6ec55e10050abde3ec1d634e609158ec3c58 Author: krzys-h krzy...@interia.pl Date: Sun Mar 22 15:07:24 2015 +0100 Fixed submodule --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index 1aa4009..f2b8c3a 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 1aa40099ac6898775f990884908bb840ae2f94d6 +Subproject commit f2b8c3a66f2c0230e5a6bcd260bafc1fd504c76a -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 282/390: Added workaround for argv encoding on Windows
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 83599238d16cecfd159a593bed5107beb70d4c38 Author: krzys-h krzy...@interia.pl Date: Sun Mar 22 13:10:38 2015 +0100 Added workaround for argv encoding on Windows First part of fixing #414 --- src/app/main.cpp | 34 -- src/app/system_windows.h | 6 +++--- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 03bd507..0d1e289 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -29,6 +29,12 @@ #include common/logger.h #include common/misc.h #include common/restext.h +#include common/resources/resourcemanager.h + +#if PLATFORM_WINDOWS +#include windows.h +#include app/system_windows.h +#endif /* Doxygen main page */ @@ -71,8 +77,6 @@ The current layout is the following: - src/script - link with the CBot library */ -#include common/resources/resourcemanager.h - //! Entry point to the program extern C { @@ -80,6 +84,26 @@ extern C int SDL_MAIN_FUNC(int argc, char *argv[]) { CLogger logger; // single istance of logger + +// Workaround for character encoding in argv on Windows +#if PLATFORM_WINDOWS +int wargc; +wchar_t** wargv = CommandLineToArgvW(GetCommandLineW(), wargc); +if(wargv == nullptr) +{ +logger.Error(CommandLineToArgvW failed\n); +return 1; +} +argv = new char*[wargc]; +for(int i = 0; i wargc; i++) { +std::wstring warg = wargv[i]; +std::string arg = CSystemUtilsWindows::UTF8_Encode(warg); +argv[i] = new char[arg.length()+1]; +strcpy(argv[i], arg.c_str()); +} +LocalFree(wargv); +#endif + CResourceManager manager(argv[0]); // Initialize static string arrays @@ -128,6 +152,12 @@ int SDL_MAIN_FUNC(int argc, char *argv[]) } logger.Info(Exiting with code %d\n, code); + +#if PLATFORM_WINDOWS +// See the workaround above +delete[] argv; +#endif + return code; } diff --git a/src/app/system_windows.h b/src/app/system_windows.h index 9175a44..572eb99 100644 --- a/src/app/system_windows.h +++ b/src/app/system_windows.h @@ -48,9 +48,9 @@ public: virtual std::string GetSaveDir() override; -private: -std::string UTF8_Encode(const std::wstring wstr); -std::wstring UTF8_Decode(const std::string str); +public: +static std::string UTF8_Encode(const std::wstring wstr); +static std::wstring UTF8_Decode(const std::string str); protected: long long m_counterFrequency; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 290/390: Made sniffer flatground button available only with EnableBuild
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 7e3e1c00d23706f7442105977075cfe6eeafda6d Author: krzys-h krzy...@interia.pl Date: Sun Mar 22 14:56:35 2015 +0100 Made sniffer flatground button available only with EnableBuild --- src/object/brain.cpp | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/object/brain.cpp b/src/object/brain.cpp index d045a00..169e3c5 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -1492,11 +1492,14 @@ bool CBrain::CreateInterface(bool bSelect) pw-CreateButton(pos, dim, 40, EVENT_OBJECT_SEARCH); DefaultEnter(pw, EVENT_OBJECT_SEARCH); - pos.x = ox+sx*9.0f; -pos.y = oy+sy*0.5f; -pw-CreateButton(pos, dim, 111, EVENT_OBJECT_GFLAT); +if ( g_buildBUILD_GFLAT ) +{ +pos.x = ox+sx*9.0f; +pos.y = oy+sy*0.5f; +pw-CreateButton(pos, dim, 111, EVENT_OBJECT_GFLAT); +} - pos.x = ox+sx*10.1f; +pos.x = ox+sx*10.1f; pos.y = oy+sy*0.5f; pw-CreateButton(pos, dim, 11, EVENT_OBJECT_DELSEARCH); } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 289/390: Made bf55691e444ec6b6cda8ff7d69d418fd50befaa6 work with new CObjectManager
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 7578f3c118b4db74a070e7a7d6f9d670e878efd3 Author: krzys-h krzy...@interia.pl Date: Sun Mar 22 14:50:54 2015 +0100 Made bf55691e444ec6b6cda8ff7d69d418fd50befaa6 work with new CObjectManager --- src/object/task/taskdeletemark.cpp | 57 +- 1 file changed, 19 insertions(+), 38 deletions(-) diff --git a/src/object/task/taskdeletemark.cpp b/src/object/task/taskdeletemark.cpp index 733555f..98f062b 100644 --- a/src/object/task/taskdeletemark.cpp +++ b/src/object/task/taskdeletemark.cpp @@ -20,17 +20,17 @@ #include object/task/taskdeletemark.h -#include common/iman.h #include graphics/engine/particle.h #include graphics/engine/terrain.h +#include object/objman.h +#include object/robotmain.h + #include math/geometry.h #include physics/physics.h -#include object/robotmain.h - CTaskDeleteMark::CTaskDeleteMark(CObject* object) : CTask(object) { @@ -41,12 +41,10 @@ CTaskDeleteMark::~CTaskDeleteMark() { } - // Management of an event. - bool CTaskDeleteMark::EventProcess(const Event event) { - +return true; } Error CTaskDeleteMark::Start() @@ -59,17 +57,15 @@ Error CTaskDeleteMark::Start() } // Indicates whether the action is finished. - Error CTaskDeleteMark::IsEnded() { if ( m_bExecuted ) - return ERR_STOP; +return ERR_STOP; else - return ERR_CONTINUE; +return ERR_CONTINUE; } // Suddenly ends the current action. - bool CTaskDeleteMark::Abort() { return true; @@ -77,34 +73,19 @@ bool CTaskDeleteMark::Abort() void CTaskDeleteMark::DeleteMark() { -ObjectType type; -CObject*pObj; -Math::VectoroPos=m_object-GetPosition(0); -int i; - -CInstanceManager* iMan = CInstanceManager::GetInstancePointer(); - -for ( i=0 ; i100 ; i++ ) +CObject* pObj = CObjectManager::GetInstancePointer()-FindNearest(m_object, { +OBJECT_MARKPOWER, +OBJECT_MARKSTONE, +OBJECT_MARKURANIUM, +OBJECT_MARKKEYa, +OBJECT_MARKKEYb, +OBJECT_MARKKEYc, +OBJECT_MARKKEYd +}, 8.0f/g_unit); + +if(pObj != nullptr) { -pObj = static_castCObject*(iMan-SearchInstance(CLASS_OBJECT, i)); -if ( pObj == 0 ) break; - - type = pObj-GetType(); - -if ( type == OBJECT_MARKPOWER || -type == OBJECT_MARKSTONE || -type == OBJECT_MARKURANIUM || -type == OBJECT_MARKKEYa || -type == OBJECT_MARKKEYb || -type == OBJECT_MARKKEYc || -type == OBJECT_MARKKEYd ) -{ - if ( Math::Distance(oPos, pObj-GetPosition(0)) 8.0f ) - { - pObj-DeleteObject(); // removes the mark - delete pObj; - break; - } -} +pObj-DeleteObject(); // removes the mark +delete pObj; } } \ No newline at end of file -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 281/390: Fixed updating C locale after exception in C++ locale, should finish fixing #445
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit bb16c6d97c3d76028066c870844c99ededcc3251 Author: krzys-h krzy...@interia.pl Date: Sat Mar 21 20:13:58 2015 +0100 Fixed updating C locale after exception in C++ locale, should finish fixing #445 --- src/app/app.cpp | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/app.cpp b/src/app/app.cpp index 7941d69..b7c1a32 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -1683,10 +1683,11 @@ void CApplication::SetLanguage(Language language) GetLogger()-Trace(SetLanguage: Set LANGUAGE=%s in environment\n, locale.c_str()); } -setlocale(LC_ALL, ); // Load system locale +char* defaultLocale = setlocale(LC_ALL, ); // Load system locale setlocale(LC_NUMERIC, C); // Force numeric locale to C (fixes decimal point problems) char* systemLocale = setlocale(LC_ALL, nullptr); // Get current locale configuration -GetLogger()-Debug(System locale: %s\n, systemLocale); +GetLogger()-Debug(Default system locale: %s\n, defaultLocale); +GetLogger()-Debug(Setting locale: %s\n, systemLocale); // Update C++ locale try { @@ -1698,12 +1699,15 @@ void CApplication::SetLanguage(Language language) try { std::locale::global(std::locale::classic()); -setlocale(LC_ALL, systemLocale); // C locale might still work correctly } catch(...) { -GetLogger()-Warn(Failed to set classic locale. Something is really messed up in your system configuration. Translations probably won't work.\n); +GetLogger()-Warn(Failed to set classic locale. Something is really messed up in your system configuration. Translations might not work.\n); } + +// C locale might still work correctly +setlocale(LC_ALL, ); +setlocale(LC_NUMERIC, C); } bindtextdomain(colobot, m_pathManager-GetLangPath().c_str()); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 284/390: Implemented %cat%
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit d2d0886b769d4561628ed009caa056bb8234a0ba Author: krzys-h krzy...@interia.pl Date: Sun Mar 22 13:51:14 2015 +0100 Implemented %cat% and renamed BuildSceneName to BuildScenePath --- src/common/pathman.cpp | 8 src/object/level/parser.cpp | 25 +++-- src/object/level/parser.h | 4 +++- src/object/robotmain.cpp| 4 ++-- src/object/robotmain.h | 2 +- src/ui/maindialog.cpp | 6 +++--- src/ui/maindialog.h | 2 +- 7 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/common/pathman.cpp b/src/common/pathman.cpp index 51e7e7d..2fbb35f 100644 --- a/src/common/pathman.cpp +++ b/src/common/pathman.cpp @@ -172,16 +172,16 @@ void CPathManager::LoadModsFromDir(const std::string dir) std::string CPathManager::InjectLevelDir(std::string path, const std::string defaultDir) { std::string newPath = path; -std::string lvlDir = CLevelParser::BuildSceneName(CRobotMain::GetInstancePointer()-GetSceneName(), CRobotMain::GetInstancePointer()-GetSceneRank()/100, CRobotMain::GetInstancePointer()-GetSceneRank()%100, false); +std::string lvlDir = CLevelParser::BuildScenePath(CRobotMain::GetInstancePointer()-GetSceneName(), CRobotMain::GetInstancePointer()-GetSceneRank()/100, CRobotMain::GetInstancePointer()-GetSceneRank()%100, false); boost::replace_all(newPath, %lvl%, lvlDir); -std::string chapDir = CLevelParser::BuildSceneName(CRobotMain::GetInstancePointer()-GetSceneName(), CRobotMain::GetInstancePointer()-GetSceneRank()/100, 0, false); +std::string chapDir = CLevelParser::BuildScenePath(CRobotMain::GetInstancePointer()-GetSceneName(), CRobotMain::GetInstancePointer()-GetSceneRank()/100, 0, false); boost::replace_all(newPath, %chap%, chapDir); +std::string catDir = CLevelParser::BuildCategoryPath(CRobotMain::GetInstancePointer()-GetSceneName()); +boost::replace_all(newPath, %cat%, catDir); if(newPath == path !path.empty()) { newPath = defaultDir + (!defaultDir.empty() ? / : ) + newPath; } - -//TODO: %cat% std::string langPath = newPath; std::string langStr(1, CApplication::GetInstancePointer()-GetLanguageChar()); diff --git a/src/object/level/parser.cpp b/src/object/level/parser.cpp index 7c612af..5b36f46 100644 --- a/src/object/level/parser.cpp +++ b/src/object/level/parser.cpp @@ -51,7 +51,7 @@ CLevelParser::CLevelParser(std::string filename) CLevelParser::CLevelParser(std::string category, int chapter, int rank) { -m_filename = BuildSceneName(category, chapter, rank); +m_filename = BuildScenePath(category, chapter, rank); } CLevelParser::~CLevelParser() @@ -62,12 +62,27 @@ CLevelParser::~CLevelParser() } } -std::string CLevelParser::BuildSceneName(std::string category, int chapter, int rank, bool sceneFile) +std::string CLevelParser::BuildCategoryPath(std::string category) { std::ostringstream outstream; +outstream levels/; +if(category == perso || category == win || category == lost) +{ +outstream other/; +} +else +{ +outstream category /; +} +return outstream.str(); +} + +std::string CLevelParser::BuildScenePath(std::string category, int chapter, int rank, bool sceneFile) +{ +std::ostringstream outstream; +outstream BuildCategoryPath(category); if(category == custom) { -outstream levels/custom/; outstream CRobotMain::GetInstancePointer()-GetUserLevelName(chapter); if(rank == 000) { @@ -87,16 +102,14 @@ std::string CLevelParser::BuildSceneName(std::string category, int chapter, int } else if(category == perso) { -outstream levels/other/perso.txt; +outstream perso.txt; } else if(category == win || category == lost) { -outstream levels/other/; outstream category std::setfill('0') std::setw(3) chapter*100+rank .txt; } else { -outstream levels/ category /; outstream chapter std::setfill('0') std::setw(3) chapter; if(rank == 000) { diff --git a/src/object/level/parser.h b/src/object/level/parser.h index e0458b5..fc3b99f 100644 --- a/src/object/level/parser.h +++ b/src/object/level/parser.h @@ -43,8 +43,10 @@ public: ~CLevelParser(); +//! Build category path +static std::string BuildCategoryPath(std::string category); //! Build level filename -static std::string BuildSceneName(std::string category, int chapter, int rank, bool sceneFile = true); +static std::string BuildScenePath(std::string category, int chapter, int rank, bool sceneFile = true); //! Check if level file exists bool Exists(); diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index caee647..2ff278c
[colobot] 294/390: Added bots/buildings switch shortcut (#391)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 56d66b3417a1fc6ec3e85c7fc6f1ca317ce98d00 Author: krzys-h krzy...@interia.pl Date: Sun Mar 22 16:02:05 2015 +0100 Added bots/buildings switch shortcut (#391) --- src/object/robotmain.cpp | 5 + 1 file changed, 5 insertions(+) diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index d5927d0..f932e93 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -842,6 +842,11 @@ bool CRobotMain::ProcessEvent(Event event) { SelectHuman(); } +if (event.key.slot == INPUT_SLOT_NEXT ((event.kmodState KEY_MOD(CTRL)) != 0)) +{ +m_short-SelectShortcut(EVENT_OBJECT_SHORTCUT00); // switch bots - buildings +return false; +} if (event.key.slot == INPUT_SLOT_NEXT) { if (m_shortCut) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 286/390: Removed unused CRobotMain::BuildScenePath
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 33fcdbbef50dbb0eacd2fd19298f34af043ffee1 Author: krzys-h krzy...@interia.pl Date: Sun Mar 22 14:12:41 2015 +0100 Removed unused CRobotMain::BuildScenePath --- src/object/robotmain.cpp | 5 - src/object/robotmain.h | 1 - 2 files changed, 6 deletions(-) diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 2ff278c..d5927d0 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -5850,11 +5850,6 @@ int CRobotMain::GetSceneRank() return m_dialog-GetSceneRank(); } -void CRobotMain::BuildScenePath(std::string filename, char *base, int rank, bool sceneFile) -{ -m_dialog-BuildScenePath(filename, base, rank, sceneFile); -} - //! Changes on the pause mode void CRobotMain::ChangePause(PauseType pause) diff --git a/src/object/robotmain.h b/src/object/robotmain.h index e1be529..b8cc3f7 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -293,7 +293,6 @@ public: float GetPersoAngle(); char* GetSceneName(); int GetSceneRank(); -voidBuildScenePath(std::string filename, char *base, int rank, bool sceneFile = true); voidStartMusic(); voidStartPauseMusic(PauseType pause); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 287/390: Added CLevelParser in one more place
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 8cc74002cfbf3ecd8f36b2ffe117a3945bd51779 Author: krzys-h krzy...@interia.pl Date: Sun Mar 22 14:29:03 2015 +0100 Added CLevelParser in one more place Not sure how I missed that earlier --- src/ui/maindialog.cpp | 54 ++- 1 file changed, 15 insertions(+), 39 deletions(-) diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 75cfe48..be66d15 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -64,6 +64,7 @@ #include sstream #include iomanip #include vector +#include boost/lexical_cast.hpp //TODO Get rid of all sprintf's @@ -3967,59 +3968,34 @@ void CMainDialog::IOReadName() { CWindow*pw; CEdit* pe; -std::string filename; -charop[100]; -charop_i18n[100]; -charline[500]; -charresume[100]; +std::string resume; +charline[100]; charname[100]; time_t now; -int i; pw = static_castCWindow*(m_interface-SearchControl(EVENT_WINDOW5)); if ( pw == nullptr ) return; pe = static_castCEdit*(pw-SearchControl(EVENT_INTERFACE_IONAME)); if ( pe == nullptr ) return; -//TODO: CLevelParser -sprintf(resume, %s %d, m_sceneName, m_chap[m_index]+1); -BuildScenePath(filename, m_sceneName, (m_chap[m_index]+1)*100); -sprintf(op, Title.E); -sprintf(op_i18n, Title.%c, m_app-GetLanguageChar() ); +resume = std::string(m_sceneName) + + boost::lexical_caststd::string(m_chap[m_index]+1); -CInputStream stream; -stream.open(filename); - -if (stream.is_open()) +CLevelParser* level = new CLevelParser(m_sceneName, m_chap[m_index]+1, 0); +try { -while (stream.getline(line, 500)) -{ -for ( i=0 ; i500 ; 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, resume, resume); -} -if ( Cmd(line, op_i18n) ) -{ -OpString(line, resume, resume); -break; -} -} -stream.close(); +level-Load(); +resume = level-Get(Title)-GetParam(resume)-AsString(); +} +catch(CLevelParserException e) +{ +CLogger::GetInstancePointer()-Warn(%s\n, e.what()); } time(now); TimeToAsciiClean(now, line); -sprintf(name, %s - %s %d, line, resume, m_sel[m_index]+1); +sprintf(name, %s - %s %d, line, resume.c_str(), m_sel[m_index]+1); +delete level; + pe-SetText(name); pe-SetCursor(strlen(name), 0); pe-SetFocus(true); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 273/390: Don't crash when there are too many images in SatCom
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit f0d32125e9b7ecaa9d0f313686d94edec5fa12f2 Author: krzys-h krzy...@interia.pl Date: Wed Mar 18 21:39:35 2015 +0100 Don't crash when there are too many images in SatCom This limit will be removed during UI refactoring in the future. Also, I've increased the limit to 100 lines. issue #411 --- src/ui/edit.cpp | 4 src/ui/edit.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index 6ac60a3..676b80e 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -1636,6 +1636,10 @@ bool CEdit::ReadText(std::string filename, int addSize) // A part of image per line of text. for ( iCount=0 ; iCountiLines ; iCount++ ) { +if(iIndex = EDITIMAGEMAX) { +CLogger::GetInstancePointer()-Warn(Too many images, current limit is %d image lines. This limit will be removed in the future.\n, EDITIMAGEMAX); +break; +} m_image[iIndex].name = iName; m_image[iIndex].offset = static_castfloat(iCount/iLines); m_image[iIndex].height = 1.0f/iLines; diff --git a/src/ui/edit.h b/src/ui/edit.h index cbad394..385ee2b 100644 --- a/src/ui/edit.h +++ b/src/ui/edit.h @@ -55,7 +55,7 @@ const int EDITSTUDIOMAX = 2; //! maximum total number of lines const int EDITLINEMAX = 1000; //! maximum total number of lines with images -const int EDITIMAGEMAX = 50; +const int EDITIMAGEMAX = 100; //! maximum number of links const int EDITLINKMAX = 100; //! max number of levels preserves -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 296/390: Copying info about selected object to clipboard (#391)
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit a0097a0e5390a99c604aa459b6913469530e0836 Author: krzys-h krzy...@interia.pl Date: Sun Mar 22 16:32:21 2015 +0100 Copying info about selected object to clipboard (#391) --- src/object/robotmain.cpp | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index f932e93..36b9182 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -26,6 +26,8 @@ #include app/controller.h #include app/input.h +#include clipboard/clipboard.h + #include common/event.h #include common/global.h #include common/iman.h @@ -888,6 +890,15 @@ bool CRobotMain::ProcessEvent(Event event) { SetSpeed(4.0f); } +if (event.key.key == KEY(c) ((event.kmodState KEY_MOD(CTRL)) != 0) m_engine-GetShowStats()) +{ +std::ostringstream ss; +CObject* obj = GetSelect(); +if(obj != nullptr) { +ss CreateObject type= GetTypeObject(obj-GetType()) pos= std::fixed std::setprecision(3) obj-GetPosition(0).x/g_unit ; obj-GetPosition(0).z/g_unit dir= (obj-GetAngleZ(0)/(Math::PI/180.0f)); +} +widgetSetClipboardText(ss.str().c_str()); +} break; case EVENT_KEY_UP: -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 277/390: Modified locale setting code
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 87cf056158c9cb208b6fb2701118c82a2f29e660 Author: krzys-h krzy...@interia.pl Date: Sat Mar 21 13:09:05 2015 +0100 Modified locale setting code I'm doing my best to fix #445. At least shouldn't crash anymore. Needs more testing. --- src/app/app.cpp | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/app/app.cpp b/src/app/app.cpp index d0e783d..72adb0f 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -1682,8 +1682,29 @@ void CApplication::SetLanguage(Language language) putenv(S_LANGUAGE); GetLogger()-Trace(SetLanguage: Set LANGUAGE=%s in environment\n, locale.c_str()); } - -std::locale::global(std::locale(std::locale(), C, std::locale::numeric)); + +std::setlocale(LC_ALL, ); // Load system locale +std::setlocale(LC_NUMERIC, C); // Force numeric locale to C (fixes decimal point problems) +char* systemLocale = std::setlocale(LC_ALL, nullptr); // Get current locale configuration +GetLogger()-Debug(System locale: %s\n, systemLocale); +// Update C++ locale +try +{ +std::locale::global(std::locale(systemLocale)); +} +catch(...) +{ +GetLogger()-Warn(Failed to update locale, possibly incorect system configuration. Will fallback to classic locale.\n); +try +{ +std::locale::global(std::locale::classic()); +std::setlocale(LC_ALL, systemLocale); // C locale might still work correctly +} +catch(...) +{ +GetLogger()-Warn(Failed to set classic locale. Something is really messed up in your system configuration. Translations probably won't work.\n); +} +} bindtextdomain(colobot, m_pathManager-GetLangPath().c_str()); bind_textdomain_codeset(colobot, UTF-8); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 280/390: Fixed MXE builds after 87cf056158c9cb208b6fb2701118c82a2f29e660
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 9c20f275a015536e95446162a4509191809b5fe7 Author: krzys-h krzy...@interia.pl Date: Sat Mar 21 17:34:18 2015 +0100 Fixed MXE builds after 87cf056158c9cb208b6fb2701118c82a2f29e660 On MXE, setlocale is a macro... --- src/app/app.cpp | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/app.cpp b/src/app/app.cpp index 72adb0f..7941d69 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -1683,9 +1683,9 @@ void CApplication::SetLanguage(Language language) GetLogger()-Trace(SetLanguage: Set LANGUAGE=%s in environment\n, locale.c_str()); } -std::setlocale(LC_ALL, ); // Load system locale -std::setlocale(LC_NUMERIC, C); // Force numeric locale to C (fixes decimal point problems) -char* systemLocale = std::setlocale(LC_ALL, nullptr); // Get current locale configuration +setlocale(LC_ALL, ); // Load system locale +setlocale(LC_NUMERIC, C); // Force numeric locale to C (fixes decimal point problems) +char* systemLocale = setlocale(LC_ALL, nullptr); // Get current locale configuration GetLogger()-Debug(System locale: %s\n, systemLocale); // Update C++ locale try @@ -1698,7 +1698,7 @@ void CApplication::SetLanguage(Language language) try { std::locale::global(std::locale::classic()); -std::setlocale(LC_ALL, systemLocale); // C locale might still work correctly +setlocale(LC_ALL, systemLocale); // C locale might still work correctly } catch(...) { -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 360/390: Increased quality of dynamic shadows
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit e74744331279e0ae9e6e36fec0a26e469b98b06d Author: Tomasz Kapuściński tomaszka...@gmail.com Date: Thu May 14 15:31:57 2015 +0200 Increased quality of dynamic shadows --- src/graphics/engine/engine.cpp | 142 ++--- src/graphics/engine/engine.h | 2 + 2 files changed, 120 insertions(+), 24 deletions(-) diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index b0c8f6d..4b571aa 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -118,6 +118,7 @@ CEngine::CEngine(CApplication *app) m_textureAnisotropy = 1; m_shadowMapping = false; m_offscreenShadowRendering = false; +m_qualityShadows = false; m_totoMode = true; m_lensMode = true; m_waterMode = true; @@ -187,6 +188,7 @@ CEngine::CEngine(CApplication *app) { m_shadowMapping = (value 0); m_offscreenShadowRendering = (value 1); +m_qualityShadows = (value 2); } m_defaultTexParams.format = TEX_IMG_AUTO; @@ -3238,33 +3240,119 @@ void CEngine::Draw3DScene() // Enable shadow mapping if (m_shadowMapping) { -m_device-SetTextureEnabled(2, true); -m_device-SetTexture(2, m_shadowMap); -m_device-SetTextureMatrix(2, m_shadowTextureMat); +if (m_qualityShadows) +{ +// Texture Unit 2 +m_device-SetTextureEnabled(2, true); +m_device-SetTexture(2, m_shadowMap); +m_device-SetTextureMatrix(2, m_shadowTextureMat); -Math::Matrix identity; -identity.LoadIdentity(); -m_device-SetTransform(TRANSFORM_WORLD, identity); - -TextureStageParams params; -params.colorOperation = TEX_MIX_OPER_MODULATE; -params.wrapS = TEX_WRAP_CLAMP_TO_BORDER; -params.wrapT = TEX_WRAP_CLAMP_TO_BORDER; -m_device-SetTextureStageParams(2, params); +Math::Matrix identity; +identity.LoadIdentity(); +m_device-SetTransform(TRANSFORM_WORLD, identity); -TextureGenerationParams genParams; +float shadowBias = 0.6f; +float shadowUnbias = 1.0f - shadowBias; -for (int i = 0; i 4; i++) -{ -genParams.coords[i].mode = TEX_GEN_EYE_LINEAR; +TextureStageParams params; +params.colorOperation = TEX_MIX_OPER_MODULATE; +params.colorArg1 = TEX_MIX_ARG_TEXTURE; +params.colorArg2 = TEX_MIX_ARG_FACTOR; +params.colorOperation = TEX_MIX_OPER_DEFAULT; +params.factor = Color(shadowBias, shadowBias, shadowBias, 1.0f); +params.wrapS = TEX_WRAP_CLAMP_TO_BORDER; +params.wrapT = TEX_WRAP_CLAMP_TO_BORDER; -for (int j = 0; j 4; j++) +m_device-SetTextureStageParams(2, params); + +TextureGenerationParams genParams; + +for (int i = 0; i 4; i++) { -genParams.coords[i].plane[j] = (i == j ? 1.0f : 0.0f); +genParams.coords[i].mode = TEX_GEN_EYE_LINEAR; + +for (int j = 0; j 4; j++) +{ +genParams.coords[i].plane[j] = (i == j ? 1.0f : 0.0f); +} } + +m_device-SetTextureCoordGeneration(2, genParams); + +// Texture Unit 3 +m_device-SetTextureEnabled(3, true); +m_device-SetTexture(3, m_shadowMap); + +params.LoadDefault(); +params.colorOperation = TEX_MIX_OPER_ADD; +params.colorArg1 = TEX_MIX_ARG_COMPUTED_COLOR; +params.colorArg2 = TEX_MIX_ARG_FACTOR; +params.alphaOperation = TEX_MIX_OPER_DEFAULT; +params.factor = Color(shadowUnbias, shadowUnbias, shadowUnbias, 0.0f); +params.wrapS = TEX_WRAP_CLAMP_TO_BORDER; +params.wrapT = TEX_WRAP_CLAMP_TO_BORDER; + +m_device-SetTextureStageParams(3, params); + +// Texture Unit 4 +m_device-SetTextureEnabled(4, true); +m_device-SetTexture(4, m_shadowMap); + +params.LoadDefault(); +params.colorOperation = TEX_MIX_OPER_MODULATE; +params.colorArg1 = TEX_MIX_ARG_COMPUTED_COLOR; +params.colorArg2 = TEX_MIX_ARG_SRC_COLOR; +params.alphaOperation = TEX_MIX_OPER_DEFAULT; +params.wrapS = TEX_WRAP_CLAMP_TO_BORDER; +params.wrapT = TEX_WRAP_CLAMP_TO_BORDER; + +m_device-SetTextureStageParams(4, params); + +// Texture Unit 5 +m_device-SetTextureEnabled(5, true); +m_device-SetTexture(5, m_shadowMap); + +params.LoadDefault(); +params.colorOperation = TEX_MIX_OPER_MODULATE; +params.colorArg1 = TEX_MIX_ARG_COMPUTED_COLOR; +
[colobot] 367/390: Fix gcc warning
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 35ce6c228a082449cd862afe467b612c7be315f8 Author: Piotr Dziwinski piot...@gmail.com Date: Tue May 19 23:03:17 2015 +0200 Fix gcc warning --- src/common/resources/inputstreambuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/resources/inputstreambuffer.cpp b/src/common/resources/inputstreambuffer.cpp index 9ac1fec..88defef 100644 --- a/src/common/resources/inputstreambuffer.cpp +++ b/src/common/resources/inputstreambuffer.cpp @@ -102,7 +102,7 @@ std::streampos CInputStreamBuffer::seekoff(std::streamoff off, std::ios_base::se * egtpr - end of block off argument is relative to way */ -std::streamoff new_position; +std::streamoff new_position{}; switch (way) { -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 353/390: Corrected assertion error when changing offscreen rendering
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 03244ecdfd6b444b88ea08d35175d96da33542ed Author: Tomasz Kapuściński tomaszka...@gmail.com Date: Tue May 12 20:20:57 2015 +0200 Corrected assertion error when changing offscreen rendering --- src/graphics/opengl/gldevice.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp index 541bfd4..99dafa1 100644 --- a/src/graphics/opengl/gldevice.cpp +++ b/src/graphics/opengl/gldevice.cpp @@ -1787,6 +1787,8 @@ void CGLDevice::SetRenderState(RenderState state, bool enabled) GLuint toBind = (enabled ? m_framebuffer : 0); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, toBind); + +return; } GLenum flag = 0; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 362/390: Updated data submodule
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit b2e781b1e92bcdafe5d2fd6837805069f8015a06 Author: Piotr Dziwinski piot...@gmail.com Date: Sun May 17 10:35:39 2015 +0200 Updated data submodule --- data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data b/data index f86c10b..2cbfc1b 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit f86c10bbd4d8966acfa2ed10d1fffe3d90553bdc +Subproject commit 2cbfc1baf2086d1a2ab28bfcfaccce73c1dbb2d4 -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 366/390: Another fix to warning
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 361a8c4ddd5c80e3ee5bdad0a7c20969fb4c3668 Author: Tomasz Kapuściński tomaszka...@gmail.com Date: Tue May 19 17:24:07 2015 +0200 Another fix to warning --- src/script/scriptfunc.cpp | 27 ++- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/script/scriptfunc.cpp b/src/script/scriptfunc.cpp index 945839c..b1e8992 100644 --- a/src/script/scriptfunc.cpp +++ b/src/script/scriptfunc.cpp @@ -3608,28 +3608,29 @@ CBotTypResult CScriptFunctions::cfwrite (CBotVar* pThis, CBotVar* pVar) // process FILE :: readln // execution -bool CScriptFunctions::rfread (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int Exception) +bool CScriptFunctions::rfread(CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int Exception) { // it shouldn't be any parameters -if ( pVar != NULL ) { Exception = CBotErrOverParam; return false; } - +if (pVar != NULL) { Exception = CBotErrOverParam; return false; } + // retrieve the item handle pVar = pThis-GetItem(handle); - -if ( pVar-GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } - + +if (pVar-GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } + int fileHandle = pVar-GetValInt(); FILE* pFile = m_files[fileHandle]; - + charchaine[2000]; int i; -for ( i = 0 ; i 2000 ; i++ ) chaine[i] = 0; - -(void) fgets(chaine, 1999, pFile); - -for ( i = 0 ; i 2000 ; i++ ) if (chaine[i] == '\n') chaine[i] = 0; - +for (i = 0; i 2000; i++) chaine[i] = 0; + +if (fgets(chaine, 1999, pFile) != nullptr) +{ +for (i = 0; i 2000; i++) if (chaine[i] == '\n') chaine[i] = 0; +} + // if an error occurs generate an exception if ( ferror(pFile) ) { Exception = CBotErrRead; return false; } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 373/390: Implemented per-vertex lighting and set it as default in OpenGL 3.3 engine
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit fa67e815b8056ad34281dce48113eb82e1e63b69 Author: Tomasz Kapuściński tomaszka...@gmail.com Date: Fri May 22 18:53:51 2015 +0200 Implemented per-vertex lighting and set it as default in OpenGL 3.3 engine --- src/graphics/opengl/gl33device.cpp | 186 + src/graphics/opengl/gl33device.h | 2 + ...er_33.glsl = fragment_shader_33_perpixel.glsl} | 11 +- .../shaders/fragment_shader_33_pervertex.glsl | 83 + ...ader_33.glsl = vertex_shader_33_perpixel.glsl} | 8 +- ...der_33.glsl = vertex_shader_33_pervertex.glsl} | 91 -- 6 files changed, 240 insertions(+), 141 deletions(-) diff --git a/src/graphics/opengl/gl33device.cpp b/src/graphics/opengl/gl33device.cpp index 0401edc..8930423 100644 --- a/src/graphics/opengl/gl33device.cpp +++ b/src/graphics/opengl/gl33device.cpp @@ -23,6 +23,7 @@ #include common/config.h #include common/image.h #include common/logger.h +#include common/profile.h #include math/geometry.h @@ -50,6 +51,8 @@ CGL33Device::CGL33Device(const GLDeviceConfig config) m_colorBuffer = 0; m_depthBuffer = 0; m_offscreenRenderingEnabled = false; + +m_perPixelLighting = false; } @@ -243,15 +246,33 @@ bool CGL33Device::Create() GetLogger()-Info(CDevice created successfully\n); +int value; +if (CProfile::GetInstance().GetIntProperty(Setup, PerPixelLighting, value)) +{ +m_perPixelLighting = value 0; +} + +if (m_perPixelLighting) +CLogger::GetInstance().Info(Using per-pixel lighting\n); +else +CLogger::GetInstance().Info(Using per-vertex lighting\n); + // Create shader program GLchar source[65536]; const GLchar *sources[] = { source }; -PHYSFS_file *file = PHYSFS_openRead(shaders/vertex_shader_33.glsl); +char filename[64]; + +if (m_perPixelLighting) +sprintf(filename, shaders/vertex_shader_33_perpixel.glsl); +else +sprintf(filename, shaders/vertex_shader_33_pervertex.glsl); + +PHYSFS_file *file = PHYSFS_openRead(filename); if (file == nullptr) { CLogger::GetInstance().Error(Cannot read vertex shader code file!\n); -assert(false); +return false; } int length = PHYSFS_read(file, source, 1, 65536); @@ -277,14 +298,19 @@ bool CGL33Device::Create() GetLogger()-Error(Vertex shader compilation error occured!\n%s\n, message); delete[] message; -assert(false); +return false; } -file = PHYSFS_openRead(shaders/fragment_shader_33.glsl); +if (m_perPixelLighting) +sprintf(filename, shaders/fragment_shader_33_perpixel.glsl); +else +sprintf(filename, shaders/fragment_shader_33_pervertex.glsl); + +file = PHYSFS_openRead(filename); if (file == nullptr) { CLogger::GetInstance().Error(Cannot read fragment shader code file!\n); -assert(false); +return false; } length = PHYSFS_read(file, source, 1, 65536); @@ -309,7 +335,7 @@ bool CGL33Device::Create() GetLogger()-Error(Fragment shader compilation error occured!\n%s\n, message); delete[] message; -assert(false); +return false; } m_shaderProgram = glCreateProgram(); @@ -334,7 +360,7 @@ bool CGL33Device::Create() GetLogger()-Error(Shader program linking error occured!\n%s\n, message); delete[] message; -assert(false); +return false; } glDeleteShader(vertexShader); @@ -1218,7 +1244,7 @@ void CGL33Device::DrawPrimitive(PrimitiveType type, const Vertex *vertices, int } else { -glBufferData(GL_ARRAY_BUFFER, size, vs, GL_DYNAMIC_DRAW); +glBufferData(GL_ARRAY_BUFFER, size, vs, GL_STREAM_DRAW); info.size = size; // Vertex coordinate @@ -1269,7 +1295,7 @@ void CGL33Device::DrawPrimitive(PrimitiveType type, const VertexTex2 *vertices, } else { -glBufferData(GL_ARRAY_BUFFER, size, vs, GL_DYNAMIC_DRAW); +glBufferData(GL_ARRAY_BUFFER, size, vs, GL_STREAM_DRAW); info.size = size; // Vertex coordinate @@ -1320,7 +1346,7 @@ void CGL33Device::DrawPrimitive(PrimitiveType type, const VertexCol *vertices, i } else { -glBufferData(GL_ARRAY_BUFFER, size, vs, GL_DYNAMIC_DRAW); +glBufferData(GL_ARRAY_BUFFER, size, vs, GL_STREAM_DRAW); info.size = size; // Vertex coordinate @@ -1498,16 +1524,17 @@ void CGL33Device::UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primit return; VertexBufferInfo info = (*it).second; + +unsigned int size = vertexCount * sizeof(Vertex); + +bool changed = (info.vertexType != VERTEX_TYPE_NORMAL) || (size info.size); + info.primitiveType =
[colobot] 379/390: Shader and buffer optimizations
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit a0c56f54cb3bc1c3d29b37daa8fdbeda6e52bbaa Author: Tomasz Kapuściński tomaszka...@gmail.com Date: Mon Jun 1 17:21:10 2015 +0200 Shader and buffer optimizations --- src/graphics/opengl/gl21device.cpp | 189 +++--- src/graphics/opengl/gl21device.h | 9 +- src/graphics/opengl/gl33device.cpp | 202 ++--- src/graphics/opengl/gl33device.h | 9 ++ src/graphics/opengl/glutil.cpp | 78 ++ src/graphics/opengl/glutil.h | 4 + 6 files changed, 211 insertions(+), 280 deletions(-) diff --git a/src/graphics/opengl/gl21device.cpp b/src/graphics/opengl/gl21device.cpp index c4a6067..528d781 100644 --- a/src/graphics/opengl/gl21device.cpp +++ b/src/graphics/opengl/gl21device.cpp @@ -261,10 +261,9 @@ bool CGL21Device::Create() else CLogger::GetInstance().Info(Using per-vertex lighting\n); -// Create shader program -GLchar source[65536]; -const GLchar *sources[] = { source }; +// Create normal shader program +GLint shaders[2]; char filename[128]; if (m_perPixelLighting) @@ -272,147 +271,65 @@ bool CGL21Device::Create() else sprintf(filename, shaders/vertex_shader_21_pervertex.glsl); -PHYSFS_file *file = PHYSFS_openRead(filename); -if (file == nullptr) -{ -CLogger::GetInstance().Error(Cannot read vertex shader code file!\n); -CLogger::GetInstance().Error(Missing file \%s\\n, filename); -return false; -} - -int length = PHYSFS_read(file, source, 1, 65536); -source[length] = '\0'; - -PHYSFS_close(file); - -GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER); -glShaderSource(vertexShader, 1, sources, nullptr); -glCompileShader(vertexShader); - -GLint status; -glGetShaderiv(vertexShader, GL_COMPILE_STATUS, status); - -if (status != GL_TRUE) -{ -GLint len; -glGetShaderiv(vertexShader, GL_INFO_LOG_LENGTH, len); - -GLchar *message = new GLchar[len + 1]; -glGetShaderInfoLog(vertexShader, len + 1, nullptr, message); - -GetLogger()-Error(Vertex shader compilation error occured!\n%s\n, message); - -delete[] message; -return false; -} +shaders[0] = LoadShader(GL_VERTEX_SHADER, filename); +if (shaders[0] == 0) return false; if (m_perPixelLighting) sprintf(filename, shaders/fragment_shader_21_perpixel.glsl); else sprintf(filename, shaders/fragment_shader_21_pervertex.glsl); -file = PHYSFS_openRead(filename); -if (file == nullptr) -{ -CLogger::GetInstance().Error(Cannot read fragment shader code file!\n); -CLogger::GetInstance().Error(Missing file \%s\\n, filename); -return false; -} - -length = PHYSFS_read(file, source, 1, 65536); -source[length] = '\0'; - -PHYSFS_close(file); - -GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); -glShaderSource(fragmentShader, 1, sources, nullptr); -glCompileShader(fragmentShader); - -glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, status); - -if (status != GL_TRUE) -{ -GLint len; -glGetShaderiv(fragmentShader, GL_INFO_LOG_LENGTH, len); - -GLchar *message = new GLchar[len + 1]; -glGetShaderInfoLog(fragmentShader, len + 1, nullptr, message); - -GetLogger()-Error(Fragment shader compilation error occured!\n%s\n, message); - -delete[] message; -return false; -} - -m_shaderProgram = glCreateProgram(); -glAttachShader(m_shaderProgram, vertexShader); -glAttachShader(m_shaderProgram, fragmentShader); +shaders[1] = LoadShader(GL_FRAGMENT_SHADER, filename); +if (shaders[1] == 0) return false; -glLinkProgram(m_shaderProgram); +m_program = LinkProgram(2, shaders); +if (m_program == 0) return false; -glDetachShader(m_shaderProgram, vertexShader); -glDetachShader(m_shaderProgram, fragmentShader); +glDeleteShader(shaders[0]); +glDeleteShader(shaders[1]); -glGetProgramiv(m_shaderProgram, GL_LINK_STATUS, status); - -if (status != GL_TRUE) -{ -GLint len; -glGetProgramiv(m_shaderProgram, GL_INFO_LOG_LENGTH, len); - -GLchar *message = new GLchar[len + 1]; -glGetProgramInfoLog(m_shaderProgram, len + 1, nullptr, message); - -GetLogger()-Error(Shader program linking error occured!\n%s\n, message); - -delete[] message; -return false; -} - -glDeleteShader(vertexShader); -glDeleteShader(fragmentShader); - -glUseProgram(m_shaderProgram); // Obtain uniform locations -uni_ProjectionMatrix = glGetUniformLocation(m_shaderProgram, uni_ProjectionMatrix); -uni_ViewMatrix = glGetUniformLocation(m_shaderProgram, uni_ViewMatrix); -uni_ModelMatrix =
[colobot] 232/390: Issue #396
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit f8fe681dc52224073b89826aa687b4e3577a29cc Author: Piotr Walkusz piotrwalku...@wp.pl Date: Tue Nov 18 20:07:00 2014 +0100 Issue #396 --- src/ui/maindialog.cpp | 9 + 1 file changed, 9 insertions(+) diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 7278805..4ffb29f 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -4084,6 +4084,15 @@ void CMainDialog::IOReadList() pl-SetSelect(m_saveList.size()); pl-ShowSelect(false); // shows the selected columns + +int i; +std::string screenName; + +for ( i=0; i m_saveList.size(); i++ ) +{ + screenName = textures/../ + m_saveList.at(i) + /screen.png; + m_engine-DeleteTexture(screenName); +} } // Updates the buttons according to the selected part in the list. -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 370/390: Added shadow ambient support
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit a045bf3830464aaa1affad39f6855d31d2fc4d20 Author: Tomasz Kapuściński tomaszka...@gmail.com Date: Thu May 21 16:47:24 2015 +0200 Added shadow ambient support --- src/graphics/opengl/gldevice.cpp | 10 ++ src/graphics/opengl/gldevice.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp index 2537756..f8fc2fa 100644 --- a/src/graphics/opengl/gldevice.cpp +++ b/src/graphics/opengl/gldevice.cpp @@ -49,6 +49,7 @@ CGLDevice::CGLDevice(const GLDeviceConfig config) m_glMajor = 1; m_glMinor = 1; m_shadowMappingSupport = SMS_NONE; +m_shadowAmbientSupported = false; m_framebuffer = 0; m_colorBuffer = 0; @@ -221,6 +222,10 @@ bool CGLDevice::Create() GetLogger()-Info(Shadow mapping not available\n); } +m_shadowAmbientSupported = glewIsSupported(GL_ARB_shadow_ambient); +if (m_shadowAmbientSupported) +GetLogger()-Info(Shadow ambient supported\n); + // Detect support of anisotropic filtering m_anisotropyAvailable = glewIsSupported(GL_EXT_texture_filter_anisotropic); if(m_anisotropyAvailable) @@ -791,6 +796,11 @@ Texture CGLDevice::CreateDepthTexture(int width, int height, int depth) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); } +if (m_shadowAmbientSupported) +{ +glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB, 0.35f); +} + float color[] = { 1.0f, 1.0f, 1.0f, 1.0f }; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); diff --git a/src/graphics/opengl/gldevice.h b/src/graphics/opengl/gldevice.h index b754edc..d1f085a 100644 --- a/src/graphics/opengl/gldevice.h +++ b/src/graphics/opengl/gldevice.h @@ -225,6 +225,8 @@ private: int m_glMajor, m_glMinor; //! Depth texture support ShadowMappingSupport m_shadowMappingSupport; +//! Shadow ambient support +bool m_shadowAmbientSupported; //! Whether to use multitexturing bool m_multitextureAvailable; //! Whether to use VBOs or display lists -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git ___ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits
[colobot] 378/390: Added warnings and information what shader files are not available
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit d33ddae15a8f3d5d8e33cb0f4428b6a4632a2b5d Author: Tomasz Kapuściński tomaszka...@gmail.com Date: Fri May 29 12:39:14 2015 +0200 Added warnings and information what shader files are not available --- src/graphics/opengl/gl21device.cpp | 41 +++--- src/graphics/opengl/gl33device.cpp | 11 -- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/graphics/opengl/gl21device.cpp b/src/graphics/opengl/gl21device.cpp index 555fede..c4a6067 100644 --- a/src/graphics/opengl/gl21device.cpp +++ b/src/graphics/opengl/gl21device.cpp @@ -190,6 +190,13 @@ bool CGL21Device::Create() // Extract OpenGL version const char *version = reinterpret_castconst char*(glGetString(GL_VERSION)); sscanf(version, %d.%d, m_glMajor, m_glMinor); + +if (m_glMajor 2) +{ +GetLogger()-Error(Your hardware does not support OpenGL 2.0 or 2.1.); +return false; +} + GetLogger()-Info(OpenGL %d.%d\n, m_glMajor, m_glMinor); m_framebufferObject = glewIsSupported(GL_EXT_framebuffer_object); @@ -236,15 +243,13 @@ bool CGL21Device::Create() m_lightsEnabled = std::vectorbool (numLights, false); int maxTextures = 0; -glGetIntegerv(GL_MAX_TEXTURE_UNITS, maxTextures); -GetLogger()-Info(Maximum texture units: %d\n, maxTextures); +glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, maxTextures); +GetLogger()-Info(Maximum texture image units: %d\n, maxTextures); m_currentTextures= std::vectorTexture (maxTextures, Texture()); m_texturesEnabled= std::vectorbool (maxTextures, false); m_textureStageParams = std::vectorTextureStageParams(maxTextures, TextureStageParams()); -/* -// Will be enabled when proper shaders are written int value; if (CProfile::GetInstance().GetIntProperty(Setup, PerPixelLighting, value)) { @@ -255,18 +260,23 @@ bool CGL21Device::Create() CLogger::GetInstance().Info(Using per-pixel lighting\n); else CLogger::GetInstance().Info(Using per-vertex lighting\n); -// */ - -CLogger::GetInstance().Info(Using per-vertex lighting\n); // Create shader program GLchar source[65536]; const GLchar *sources[] = { source }; -PHYSFS_file *file = PHYSFS_openRead(shaders/vertex_shader_21_pervertex.glsl); +char filename[128]; + +if (m_perPixelLighting) +sprintf(filename, shaders/vertex_shader_21_perpixel.glsl); +else +sprintf(filename, shaders/vertex_shader_21_pervertex.glsl); + +PHYSFS_file *file = PHYSFS_openRead(filename); if (file == nullptr) { CLogger::GetInstance().Error(Cannot read vertex shader code file!\n); +CLogger::GetInstance().Error(Missing file \%s\\n, filename); return false; } @@ -296,10 +306,16 @@ bool CGL21Device::Create() return false; } -file = PHYSFS_openRead(shaders/fragment_shader_21_pervertex.glsl); +if (m_perPixelLighting) +sprintf(filename, shaders/fragment_shader_21_perpixel.glsl); +else +sprintf(filename, shaders/fragment_shader_21_pervertex.glsl); + +file = PHYSFS_openRead(filename); if (file == nullptr) { CLogger::GetInstance().Error(Cannot read fragment shader code file!\n); +CLogger::GetInstance().Error(Missing file \%s\\n, filename); return false; } @@ -1608,13 +1624,6 @@ void CGL21Device::SetRenderState(RenderState state, bool enabled) glUniform1i(uni_LightingEnabled, enabled ? 1 : 0); -/* -if (enabled) -glEnable(GL_LIGHTING); -else -glDisable(GL_LIGHTING); -// */ - if (enabled) { for (int index = 0; index static_castint( m_lights.size() ); ++index) diff --git a/src/graphics/opengl/gl33device.cpp b/src/graphics/opengl/gl33device.cpp index da05c0b..a4f31b6 100644 --- a/src/graphics/opengl/gl33device.cpp +++ b/src/graphics/opengl/gl33device.cpp @@ -191,9 +191,14 @@ bool CGL33Device::Create() sscanf(version, %d.%d, m_glMajor, m_glMinor); int glVersion = 10 * m_glMajor + m_glMinor; -if (glVersion 33) +if (glVersion 30) { -GetLogger()-Error(OpenGL 3.3 unavailable. Game might not work at all.\n); +GetLogger()-Error(Your hardware does not support OpenGL 3.0+. Exiting.\n); +return false; +} +else if (glVersion 33) +{ +GetLogger()-Warn(Full OpenGL 3.3 unavailable. Graphics might be bugged.\n); } else { @@ -272,6 +277,7 @@ bool CGL33Device::Create() if (file == nullptr) { CLogger::GetInstance().Error(Cannot read vertex shader code file!\n); +
[colobot] 369/390: Move OpenGL 3.3 shaders to main repository
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit b1e83414750831a8759221d075b8bc248e8dd74b Author: Piotr Dziwinski piot...@gmail.com Date: Wed May 20 23:29:41 2015 +0200 Move OpenGL 3.3 shaders to main repository --- data | 2 +- src/CMakeLists.txt | 2 + src/graphics/opengl/shaders/CMakeLists.txt | 2 + .../opengl/shaders/fragment_shader_33.glsl | 155 + src/graphics/opengl/shaders/vertex_shader_33.glsl | 63 + 5 files changed, 223 insertions(+), 1 deletion(-) diff --git a/data b/data index 2cbfc1b..7696ffe 16 --- a/data +++ b/data @@ -1 +1 @@ -Subproject commit 2cbfc1baf2086d1a2ab28bfcfaccce73c1dbb2d4 +Subproject commit 7696ffe209feea809f10598d97b7c1a34e511875 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 12de291..b10b63b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,6 +12,8 @@ if(TOOLS) add_subdirectory(tools) endif() +add_subdirectory(graphics/opengl/shaders) + # Optional libraries set(OPTIONAL_LIBS ) diff --git a/src/graphics/opengl/shaders/CMakeLists.txt b/src/graphics/opengl/shaders/CMakeLists.txt new file mode 100644 index 000..a32d6a9 --- /dev/null +++ b/src/graphics/opengl/shaders/CMakeLists.txt @@ -0,0 +1,2 @@ +file(GLOB shaders *.glsl) +install(FILES ${shaders} DESTINATION ${COLOBOT_INSTALL_DATA_DIR}/shaders) diff --git a/src/graphics/opengl/shaders/fragment_shader_33.glsl b/src/graphics/opengl/shaders/fragment_shader_33.glsl new file mode 100644 index 000..a2ef596 --- /dev/null +++ b/src/graphics/opengl/shaders/fragment_shader_33.glsl @@ -0,0 +1,155 @@ +/* + * 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 + */ + +// FRAGMENT SHADER +#version 330 + +struct LightParams +{ +bool Enabled; +vec4 Position; +vec4 Ambient; +vec4 Diffuse; +vec4 Specular; +float Shininess; +vec3 Attenuation; +}; + +uniform sampler2D uni_PrimaryTexture; +uniform sampler2D uni_SecondaryTexture; +uniform sampler2DShadow uni_ShadowTexture; + +uniform bool uni_PrimaryTextureEnabled; +uniform bool uni_SecondaryTextureEnabled; +uniform bool uni_ShadowTextureEnabled; + +uniform bool uni_FogEnabled; +uniform vec2 uni_FogRange; +uniform vec4 uni_FogColor; + +uniform bool uni_AlphaTestEnabled; +uniform float uni_AlphaReference; + +uniform vec4 uni_AmbientColor; +uniform vec4 uni_DiffuseColor; +uniform vec4 uni_SpecularColor; + +uniform bool uni_LightingEnabled; +uniform LightParams uni_Light[8]; + +uniform bool uni_SmoothShading; + +in VertexData +{ +vec3 NormalSmooth; +flat vec3 NormalFlat; +vec4 Color; +vec2 TexCoord0; +vec2 TexCoord1; +vec4 ShadowCoord; +vec4 Position; +float Distance; +} data; + +out vec4 out_FragColor; + +void main() +{ +vec4 color = data.Color; + +if (uni_LightingEnabled) +{ +vec4 ambient = vec4(0.0f); +vec4 diffuse = vec4(0.0f); +vec4 specular = vec4(0.0f); + +for(int i=0; i8; i++) +{ +if(uni_Light[i].Enabled) +{ +ambient += uni_Light[i].Ambient; + +vec3 normal = (uni_SmoothShading ? data.NormalSmooth : data.NormalFlat); +normal = (gl_FrontFacing ? normal : -normal); + +vec3 lightDirection = vec3(0.0f); +float atten; + +// Directional light +if(uni_Light[i].Position[3] == 0.0f) +{ +lightDirection = uni_Light[i].Position.xyz; +atten = 1.0f; +} +// Point light +else +{ +vec3 lightDirection = normalize(uni_Light[i].Position.xyz - data.Position.xyz); +float dist = distance(uni_Light[i].Position.xyz, data.Position.xyz); + +atten = 1.0f / (uni_Light[i].Attenuation.x ++ uni_Light[i].Attenuation.y * dist +
[colobot] 249/390: Refactored CObjectManager to std::map
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit c5b6faea05a3507fe3e08ad6110cd1473e1483cf Author: krzys-h krzy...@interia.pl Date: Sat Dec 20 19:09:53 2014 +0100 Refactored CObjectManager to std::map --- src/object/object.cpp | 4 ++-- src/object/objman.cpp | 47 --- src/object/objman.h | 27 +++ src/script/scriptfunc.cpp | 16 4 files changed, 49 insertions(+), 45 deletions(-) diff --git a/src/object/object.cpp b/src/object/object.cpp index 7d4c92d..7bdb60c 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -350,7 +350,7 @@ CObject::CObject() m_botVar-SetUserPtr(this); m_botVar-SetIdent(m_id); -CObjectManager::GetInstancePointer()-AddInstance(this); +CObjectManager::GetInstancePointer()-AddObject(this); } // Object's destructor. @@ -374,7 +374,7 @@ CObject::~CObject() m_auto = nullptr; CInstanceManager::GetInstancePointer()-DeleteInstance(CLASS_OBJECT, this); -CObjectManager::GetInstancePointer()-DeleteInstance(this); +CObjectManager::GetInstancePointer()-DeleteObject(this); m_app = nullptr; } diff --git a/src/object/objman.cpp b/src/object/objman.cpp index 25f907a..040b4fb 100644 --- a/src/object/objman.cpp +++ b/src/object/objman.cpp @@ -29,43 +29,45 @@ template CObjectManager* CSingletonCObjectManager::m_instance = nullptr; CObjectManager::CObjectManager() { -for (int i = 0; i MAX_OBJECTS; i++) -{ -m_table[i] = nullptr; -} -m_usedCount = 0; } CObjectManager::~CObjectManager() { } -bool CObjectManager::AddInstance(CObject* instance) +bool CObjectManager::AddObject(CObject* instance) { -if (m_usedCount = MAX_OBJECTS) return false; - +assert(instance != nullptr); +assert(m_table[instance-GetID()] == nullptr); m_table[instance-GetID()] = instance; -m_usedCount++; return true; } -bool CObjectManager::DeleteInstance(CObject* instance) +bool CObjectManager::DeleteObject(CObject* instance) { -for (int i = 0; i m_usedCount; i++) +assert(instance != nullptr); +for(auto it = m_table.begin(); it != m_table.end(); ++it) { -if (m_table[i] == instance) -m_table[i] = nullptr; +if(it-second == instance) +{ +m_table.erase(it); +return true; +} } -return true; +return false; } -CObject* CObjectManager::SearchInstance(int id) +CObject* CObjectManager::GetObjectById(int id) { -if (id = MAX_OBJECTS) return nullptr; return m_table[id]; } +void CObjectManager::Flush() +{ +m_table.clear(); +} + CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, ObjectType type, float power, float zoom, float height, bool trainer, bool toy, int option) @@ -361,11 +363,10 @@ CObject* CObjectManager::CreateObject(Math::Vector pos, float angle, ObjectType return object; } -void CObjectManager::Flush() +bool CObjectManager::DestroyObject(int id) { -for (int i = 0; i MAX_OBJECTS; i++) -{ -m_table[i] = nullptr; -} -m_usedCount = 0; -} +CObject* obj = GetObjectById(id); +if(obj == nullptr) return false; +delete obj; // Destructor calls CObjectManager::DeleteObject +return true; +} \ No newline at end of file diff --git a/src/object/objman.h b/src/object/objman.h index 137cbc8..0197c9b 100644 --- a/src/object/objman.h +++ b/src/object/objman.h @@ -19,7 +19,7 @@ /** * \file object/objman.h - * \brief Instance manager for objects + * \brief Object manager */ #pragma once @@ -28,11 +28,11 @@ #include common/singleton.h -const int MAX_OBJECTS = 500; +#include map /** * \class ObjectManager - * \brief Manager for objects + * \brief Manages CObject instances */ class CObjectManager : public CSingletonCObjectManager { @@ -41,18 +41,21 @@ public: virtual ~CObjectManager(); //! Registers new object -bool AddInstance(CObject* instance); -//! Deletes the registered object -bool DeleteInstance(CObject* instance); -//! Seeks for an object -CObject* SearchInstance(int id); -//! Creates an object -CObject* CreateObject(Math::Vector pos, float angle, ObjectType type, float power = -1.f, float zoom = 1.f, float height = 0.f, bool trainer = false, bool toy = false, int option = 0); +bool AddObject(CObject* instance); +//! Unregisters the object +bool DeleteObject(CObject* instance); +//! Finds object by id +CObject* GetObjectById(int id); //! Removes all objects void Flush(); + + +//! Creates an object +CObject* CreateObject(Math::Vector pos, float angle, ObjectType type, float power = -1.f, float zoom = 1.f, float height = 0.f,
[colobot] 248/390: Removed unused script/dd.cpp
This is an automated email from the git hooks/post-receive script. odyx pushed a commit to branch upstream/latest in repository colobot. commit 58bc01c82c705665d88bb521295ed34e4d10582b Author: krzys-h krzy...@interia.pl Date: Sat Dec 20 18:48:44 2014 +0100 Removed unused script/dd.cpp --- src/script/dd.cpp | 179 -- 1 file changed, 179 deletions(-) diff --git a/src/script/dd.cpp b/src/script/dd.cpp deleted file mode 100644 index 6c6eab2..000 --- a/src/script/dd.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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 - */ - -// Compilation of a procedure with a dot. - -int cPoint(CBotVar* var, CBotString retClass, void* user) -{ -if ( var == 0 ) return CBotErrLowParam; - -if ( var-GivType() = CBotTypDouble ) -{ -var = var-GivNext(); -if ( var == 0 ) return CBotErrLowParam; -if ( var-GivType() CBotTypDouble ) return CBotErrBadNum; -var = var-GivNext(); -if ( var == 0 ) return CBotErrLowParam; -if ( var-GivType() CBotTypDouble ) return CBotErrBadNum; -var = var-GivNext(); -return 0; -} - -if ( var-GivType() == CBotTypClass ) -{ -if ( !var-IsElemOfClass(point) ) return CBotErrBadParam; -var = var-GivNext(); -return 0; -} - -return CBotErrBadParam; -} - -// Gives a parameter of type point. - -bool GetPoint(CBotVar* var, int exception, Math::Vector pos) -{ -CBotVar *pX, *pY, *pZ; - -if ( var-GivType() = CBotTypDouble ) -{ -pos.x = var-GivValFloat()*UNIT; -var = var-GivNext(); - -pos.z = var-GivValFloat()*UNIT; -var = var-GivNext(); - -pos.y = var-GivValFloat()*UNIT; -var = var-GivNext(); -} -else -{ -pX = var-GivItem(x); -if ( pX == NULL ) -{ -exception = CBotErrUndefItem; return true; -} -pos.x = pX-GivValFloat()*UNIT; - -pY = var-GivItem(y); -if ( pY == NULL ) -{ -exception = CBotErrUndefItem; return true; -} -pos.z = pY-GivValFloat()*UNIT; // attention y - z ! - -pZ = var-GivItem(z); -if ( pZ == NULL ) -{ -exception = CBotErrUndefItem; return true; -} -pos.y = pZ-GivValFloat()*UNIT; // attention z - y ! - -var = var-GivNext(); -} -return true; -} - - - -// Compilation of the instruction space(center, rMin, rMax, dist). - -int cSpace(CBotVar* var, CBotString retClass, void* user) -{ -int ret; - -retClass = point; - -if ( var == 0 ) return CBotTypIntrinsic; -ret = cPoint(var, retClass, user); -if ( ret != 0 ) return ret; - -if ( var == 0 ) return CBotTypIntrinsic; -if ( var-GivType() CBotTypDouble ) return CBotErrBadNum; -var = var-GivNext(); - -if ( var == 0 ) return CBotTypIntrinsic; -if ( var-GivType() CBotTypDouble ) return CBotErrBadNum; -var = var-GivNext(); - -if ( var == 0 ) return CBotTypIntrinsic; -if ( var-GivType() CBotTypDouble ) return CBotErrBadNum; -var = var-GivNext(); - -if ( var != 0 ) return CBotErrOverParam; -return CBotTypIntrinsic; -} - -// Instruction space(center, rMin, rMax, dist). - -bool rSpace(CBotVar* var, CBotVar* result, int exception, void* user) -{ -CScript*script = ((CObject*)user)-RetRunScript(); -CObject*pThis = (CObject*)user; -CBotVar*pSub; -Math::Vectorcenter; -float rMin, rMax, dist; - -rMin = 5.0f*UNIT; -rMax = 50.0f*UNIT; -dist = 4.0f*UNIT; - -if ( var == 0 ) -{ -center = pThis-RetPosition(0); -} -else -{ -if ( !GetPoint(var, exception, center) ) return true; - -if ( var != 0 ) -{ -rMin = var-GivValFloat()*UNIT; -var = var-GivNext(); - -if ( var != 0 ) -{ -rMax = var-GivValFloat()*UNIT; -var = var-GivNext(); - -if ( var != 0 ) -{ -dist = var-GivValFloat()*UNIT; -var =