Merge with dev
commit
5274acd624
|
@ -295,43 +295,6 @@ endif()
|
|||
# Targets
|
||||
##
|
||||
|
||||
if(TESTS)
|
||||
# Google Test library
|
||||
find_path(GTEST_SRC_DIR NAMES src/gtest.cc src/gtest-all.cc PATHS /usr/src PATH_SUFFIXES gtest)
|
||||
find_path(GTEST_INCLUDE_DIR gtest/gtest.h PATHS /usr/include)
|
||||
if(NOT(FORCE_BUNDLED_GTEST) AND GTEST_SRC_DIR AND GTEST_INCLUDE_DIR)
|
||||
message(STATUS "Using system gtest library in ${GTEST_SRC_DIR}")
|
||||
else()
|
||||
message(STATUS "Using bundled gtest library")
|
||||
set(GTEST_SRC_DIR ${colobot_SOURCE_DIR}/lib/gtest)
|
||||
set(GTEST_INCLUDE_DIR ${colobot_SOURCE_DIR}/lib/gtest/include)
|
||||
endif()
|
||||
|
||||
add_subdirectory(${GTEST_SRC_DIR} lib/gtest)
|
||||
|
||||
# Google Mock library
|
||||
find_path(GMOCK_SRC_DIR NAMES src/gmock.cc src/gmock-all.cc PATHS /usr/src PATH_SUFFIXES gmock)
|
||||
find_path(GMOCK_INCLUDE_DIR gmock/gmock.h PATHS /usr/include)
|
||||
if(NOT(FORCE_BUNDLED_GMOCK) AND GMOCK_SRC_DIR AND GMOCK_INCLUDE_DIR)
|
||||
message(STATUS "Using system gmock library in ${GMOCK_SRC_DIR}")
|
||||
|
||||
include_directories(${GMOCK_SRC_DIR})
|
||||
# gmock-all.cc includes all other sources
|
||||
add_library(gmock STATIC ${GMOCK_SRC_DIR}/src/gmock-all.cc)
|
||||
else()
|
||||
message(STATUS "Using bundled gmock library")
|
||||
set(GMOCK_SRC_DIR ${colobot_SOURCE_DIR}/lib/gmock)
|
||||
set(GMOCK_INCLUDE_DIR ${colobot_SOURCE_DIR}/lib/gmock/include)
|
||||
add_subdirectory(${GMOCK_SRC_DIR} lib/gmock)
|
||||
endif()
|
||||
|
||||
|
||||
# Tests targets
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
|
||||
endif()
|
||||
|
||||
# Installation paths defined before compiling sources
|
||||
if(PLATFORM_WINDOWS)
|
||||
if(MXE)
|
||||
|
@ -371,6 +334,43 @@ if(DESKTOP)
|
|||
add_subdirectory(desktop)
|
||||
endif()
|
||||
|
||||
if(TESTS)
|
||||
# Google Test library
|
||||
find_path(GTEST_SRC_DIR NAMES src/gtest.cc src/gtest-all.cc PATHS /usr/src PATH_SUFFIXES gtest)
|
||||
find_path(GTEST_INCLUDE_DIR gtest/gtest.h PATHS /usr/include)
|
||||
if(NOT(FORCE_BUNDLED_GTEST) AND GTEST_SRC_DIR AND GTEST_INCLUDE_DIR)
|
||||
message(STATUS "Using system gtest library in ${GTEST_SRC_DIR}")
|
||||
else()
|
||||
message(STATUS "Using bundled gtest library")
|
||||
set(GTEST_SRC_DIR ${colobot_SOURCE_DIR}/lib/gtest)
|
||||
set(GTEST_INCLUDE_DIR ${colobot_SOURCE_DIR}/lib/gtest/include)
|
||||
endif()
|
||||
|
||||
add_subdirectory(${GTEST_SRC_DIR} lib/gtest)
|
||||
|
||||
# Google Mock library
|
||||
find_path(GMOCK_SRC_DIR NAMES src/gmock.cc src/gmock-all.cc PATHS /usr/src PATH_SUFFIXES gmock)
|
||||
find_path(GMOCK_INCLUDE_DIR gmock/gmock.h PATHS /usr/include)
|
||||
if(NOT(FORCE_BUNDLED_GMOCK) AND GMOCK_SRC_DIR AND GMOCK_INCLUDE_DIR)
|
||||
message(STATUS "Using system gmock library in ${GMOCK_SRC_DIR}")
|
||||
|
||||
include_directories(${GMOCK_SRC_DIR})
|
||||
# gmock-all.cc includes all other sources
|
||||
add_library(gmock STATIC ${GMOCK_SRC_DIR}/src/gmock-all.cc)
|
||||
else()
|
||||
message(STATUS "Using bundled gmock library")
|
||||
set(GMOCK_SRC_DIR ${colobot_SOURCE_DIR}/lib/gmock)
|
||||
set(GMOCK_INCLUDE_DIR ${colobot_SOURCE_DIR}/lib/gmock/include)
|
||||
add_subdirectory(${GMOCK_SRC_DIR} lib/gmock)
|
||||
endif()
|
||||
|
||||
|
||||
# Tests targets
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
##
|
||||
# Installation
|
||||
|
|
|
@ -119,7 +119,7 @@ You will need:
|
|||
|
||||
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 git
|
||||
$ 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
|
||||
```
|
||||
|
||||
Make sure you install the packages along with header files (often distributed in separate *-dev packages). If you miss any requirements,
|
||||
|
|
27
po/de.po
27
po/de.po
|
@ -7,17 +7,18 @@ 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: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"PO-Revision-Date: 2014-07-28 09:27+0200\n"
|
||||
"Last-Translator: krzys_h <krzys_h@interia.pl>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: de\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Translate Toolkit 1.11.0\n"
|
||||
"X-Generator: Pootle 2.5.1.1\n"
|
||||
"X-Language: de_DE\n"
|
||||
"X-Source-Language: en_US\n"
|
||||
"X-POOTLE-MTIME: 1406536037.000000\n"
|
||||
|
||||
msgid "Colobot rules!"
|
||||
msgstr "Colobot ist wunderbar!"
|
||||
|
@ -177,7 +178,7 @@ msgid "Cancel"
|
|||
msgstr "Abbrechen"
|
||||
|
||||
msgid "LOADING"
|
||||
msgstr "Laden"
|
||||
msgstr "LADEN"
|
||||
|
||||
msgid "Keyword help(\\key cbot;)"
|
||||
msgstr "Hilfe über den Begriff (\\key cbot;)"
|
||||
|
@ -645,7 +646,7 @@ msgid "Take off to finish the mission"
|
|||
msgstr "Abheben nach vollbrachter Mission"
|
||||
|
||||
msgid "Destroy"
|
||||
msgstr ""
|
||||
msgstr "Zerstören"
|
||||
|
||||
msgid "Build a derrick"
|
||||
msgstr "Baut einen Bohrturm"
|
||||
|
@ -687,7 +688,7 @@ msgid "Build a exchange post"
|
|||
msgstr "Baut einen Infoserver"
|
||||
|
||||
msgid "Build a destroyer"
|
||||
msgstr ""
|
||||
msgstr "Baue einen Zerstörer"
|
||||
|
||||
msgid "Show if the ground is flat"
|
||||
msgstr "Zeigt ob der Boden eben ist"
|
||||
|
@ -819,7 +820,7 @@ msgid "Shoot (\\key action;)"
|
|||
msgstr "Feuer (\\key action;)"
|
||||
|
||||
msgid "Explode (\\key action;)"
|
||||
msgstr ""
|
||||
msgstr "Explodieren (\\key action;)"
|
||||
|
||||
msgid "Recycle (\\key action;)"
|
||||
msgstr "Recyceln (\\key action;)"
|
||||
|
@ -1293,7 +1294,7 @@ msgid "Lunar Roving Vehicle"
|
|||
msgstr "Lunar Roving Vehicle"
|
||||
|
||||
msgid "Internal error - tell the developers"
|
||||
msgstr ""
|
||||
msgstr "Interner Fehler - Benachrichtige die Entwickler"
|
||||
|
||||
msgid "Unknown command"
|
||||
msgstr "Befehl unbekannt"
|
||||
|
@ -1356,10 +1357,10 @@ msgid "Too close to a building"
|
|||
msgstr "Zu nahe an einem Gebäude"
|
||||
|
||||
msgid "Can not produce this object in this mission"
|
||||
msgstr ""
|
||||
msgstr "Das Objekt kann in dieser Mission nicht produziert werden"
|
||||
|
||||
msgid "Can not produce not researched object"
|
||||
msgstr ""
|
||||
msgstr "Das erforschte Objekt kann nicht produziert werden"
|
||||
|
||||
msgid "Ground inappropriate"
|
||||
msgstr "Boden ungeeignet"
|
||||
|
@ -1467,10 +1468,11 @@ msgid "No flag nearby"
|
|||
msgstr "Keine Fahne in Reichweite"
|
||||
|
||||
msgid "Not found anything to destroy"
|
||||
msgstr ""
|
||||
msgstr "Nichts zum Zerstampfen gefunden"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Inappropriate object"
|
||||
msgstr ""
|
||||
msgstr "Roboter ungeeignet"
|
||||
|
||||
msgid ""
|
||||
"The mission is not accomplished yet (press \\key help; for more details)"
|
||||
|
@ -1688,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"
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ void CBotToken::Free()
|
|||
|
||||
const CBotToken& CBotToken::operator=(const CBotToken& src)
|
||||
{
|
||||
if (m_next != NULL) delete(m_next);
|
||||
delete m_next;
|
||||
m_next = NULL;
|
||||
m_prev = 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 be a parameter
|
||||
if ( pVar == NULL ) { Exception = CBotErrLowParam; return false; }
|
||||
|
||||
// must be a string
|
||||
if ( pVar->GetType() != CBotTypString ) { Exception = CBotErrBadString; return false; }
|
||||
|
||||
// there may be a second parameter
|
||||
if ( pVar->GetNext() != NULL )
|
||||
{
|
||||
// in this case the first parameter is the file name
|
||||
CBotString filename = pVar->GetValString();
|
||||
PrepareFilename(filename); //DR
|
||||
|
||||
// saves the file name
|
||||
CBotVar* pVar2 = pThis->GetItem("filename");
|
||||
pVar2->SetValString(filename);
|
||||
|
||||
// next parameter is the mode
|
||||
pVar = pVar -> GetNext();
|
||||
}
|
||||
|
||||
CBotString mode = pVar->GetValString();
|
||||
if ( mode != "r" && mode != "w" ) { Exception = CBotErrBadParam; return false; }
|
||||
|
||||
// No third parameter
|
||||
if ( pVar->GetNext() != NULL ) { Exception = CBotErrOverParam; return false; }
|
||||
|
||||
// retrieves the element "handle"
|
||||
pVar = pThis->GetItem("handle");
|
||||
|
||||
// which must not be initialized
|
||||
if ( pVar->GetInit() == IS_DEF) { Exception = CBotErrFileOpen; return false; }
|
||||
|
||||
// contains filename
|
||||
pVar = pThis->GetItem("filename");
|
||||
CBotString filename = pVar->GetValString();
|
||||
|
||||
PrepareFilename(filename); //DD! (if the name was assigned by h.filename = "...";
|
||||
|
||||
// open requsted file
|
||||
FILE* pFile = fopen( filename, mode );
|
||||
if ( pFile == NULL ) //DR
|
||||
{
|
||||
pResult->SetValInt(false); //DR
|
||||
return true; //DR
|
||||
}
|
||||
|
||||
m_CompteurFileOpen ++;
|
||||
|
||||
// saves the handle of file
|
||||
pVar = pThis->GetItem("handle");
|
||||
pVar->SetValInt((long)pFile);
|
||||
|
||||
pResult->SetValInt(true); //DR
|
||||
return true;
|
||||
}
|
||||
|
||||
// compilation
|
||||
CBotTypResult cfopen (CBotVar* pThis, CBotVar* &pVar)
|
||||
{
|
||||
// there must be a parameter
|
||||
if ( pVar == NULL ) return CBotTypResult( CBotErrLowParam );
|
||||
|
||||
// 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 );
|
||||
}
|
||||
|
||||
// the result is of type bool
|
||||
return CBotTypResult(CBotTypBoolean); //DR
|
||||
}
|
||||
|
||||
|
||||
// FILE :: close method
|
||||
|
||||
// execution
|
||||
bool rfclose (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
|
||||
{
|
||||
// it should not be any parameter
|
||||
if ( pVar != NULL ) return CBotErrOverParam;
|
||||
|
||||
// retrieves the element "handle"
|
||||
pVar = pThis->GetItem("handle");
|
||||
|
||||
if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; }
|
||||
|
||||
FILE* pFile= (FILE*)pVar->GetValInt();
|
||||
fclose(pFile);
|
||||
m_CompteurFileOpen --;
|
||||
|
||||
pVar->SetInit(IS_NAN);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// compilation
|
||||
CBotTypResult cfclose (CBotVar* pThis, CBotVar* &pVar)
|
||||
{
|
||||
// it should not be any parameter
|
||||
if ( pVar != NULL ) return CBotTypResult( CBotErrOverParam );
|
||||
|
||||
// function returns a result "void"
|
||||
return CBotTypResult( 0 );
|
||||
}
|
||||
|
||||
// FILE :: writeln method
|
||||
|
||||
// execution
|
||||
bool rfwrite (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
|
||||
{
|
||||
// there must be a parameter
|
||||
if ( pVar == NULL ) { Exception = CBotErrLowParam; return false; }
|
||||
|
||||
// must be a string
|
||||
if ( pVar->GetType() != CBotTypString ) { Exception = CBotErrBadString; return false; }
|
||||
|
||||
CBotString param = pVar->GetValString();
|
||||
|
||||
//retrieves the element "handle"
|
||||
pVar = pThis->GetItem("handle");
|
||||
|
||||
if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; }
|
||||
|
||||
FILE* pFile= (FILE*)pVar->GetValInt();
|
||||
|
||||
int res = fputs(param+CBotString("\n"), pFile);
|
||||
|
||||
// on error throws an exception
|
||||
if ( res < 0 ) { Exception = CBotErrWrite; return false; }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// compilation
|
||||
CBotTypResult cfwrite (CBotVar* pThis, CBotVar* &pVar)
|
||||
{
|
||||
// there must be a parameter
|
||||
if ( pVar == NULL ) return CBotTypResult( CBotErrLowParam );
|
||||
|
||||
// must be a string
|
||||
if ( pVar->GetType() != CBotTypString ) return CBotTypResult( CBotErrBadString );
|
||||
|
||||
// no other parameter
|
||||
if ( pVar->GetNext() != NULL ) return CBotTypResult( CBotErrOverParam );
|
||||
|
||||
// function returns "void" result
|
||||
return CBotTypResult( 0 );
|
||||
}
|
||||
|
||||
// FILE :: readln method
|
||||
|
||||
// execution
|
||||
bool rfread (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
|
||||
{
|
||||
// there shouldn't be any parameter
|
||||
if ( pVar != NULL ) { Exception = CBotErrOverParam; return false; }
|
||||
|
||||
//retrieves the element "handle"
|
||||
pVar = pThis->GetItem("handle");
|
||||
|
||||
if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; }
|
||||
|
||||
FILE* pFile= (FILE*)pVar->GetValInt();
|
||||
|
||||
char chaine[2000];
|
||||
int i;
|
||||
for ( i = 0 ; i < 2000 ; i++ ) chaine[i] = 0;
|
||||
|
||||
fgets(chaine, 1999, pFile);
|
||||
|
||||
for ( i = 0 ; i < 2000 ; i++ ) if (chaine[i] == '\n') chaine[i] = 0;
|
||||
|
||||
// on error throws an exception
|
||||
if ( ferror(pFile) ) { Exception = CBotErrRead; return false; }
|
||||
|
||||
pResult->SetValString( chaine );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// compilation
|
||||
CBotTypResult cfread (CBotVar* pThis, CBotVar* &pVar)
|
||||
{
|
||||
// there shouldn't be any parameter
|
||||
if ( pVar != NULL ) return CBotTypResult( CBotErrOverParam );
|
||||
|
||||
// function return "string" result
|
||||
return CBotTypResult( CBotTypString );
|
||||
}
|
||||
// FILE :: readln method
|
||||
|
||||
|
||||
// execution
|
||||
bool rfeof (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
|
||||
{
|
||||
// there shouldn't be any parameter
|
||||
if ( pVar != NULL ) { Exception = CBotErrOverParam; return false; }
|
||||
|
||||
// retrieves the element "handle"
|
||||
pVar = pThis->GetItem("handle");
|
||||
|
||||
if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; }
|
||||
|
||||
FILE* pFile= (FILE*)pVar->GetValInt();
|
||||
|
||||
pResult->SetValInt( feof( pFile ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// compilation
|
||||
CBotTypResult cfeof (CBotVar* pThis, CBotVar* &pVar)
|
||||
{
|
||||
// there shouldn't be any parameter
|
||||
if ( pVar != NULL ) return CBotTypResult( CBotErrOverParam );
|
||||
|
||||
// function return boolean result
|
||||
return CBotTypResult( CBotTypBoolean );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void InitClassFILE()
|
||||
{
|
||||
// creates a class for file management
|
||||
// the usage is as follows:
|
||||
// file canal( "NomFichier.txt" )
|
||||
// canal.open( "r" ); // open reading
|
||||
// s = canal.readln( ); // reads a line
|
||||
// canal.close(); // closes the file
|
||||
|
||||
// create class FILE
|
||||
m_pClassFILE = new CBotClass("file", NULL);
|
||||
// add the component ".filename"
|
||||
m_pClassFILE->AddItem("filename", CBotTypString);
|
||||
// add the component ".handle"
|
||||
m_pClassFILE->AddItem("handle", CBotTypInt, PR_PRIVATE);
|
||||
|
||||
// define a constructor and destructor
|
||||
m_pClassFILE->AddFunction("file", rfconstruct, cfconstruct );
|
||||
m_pClassFILE->AddFunction("~file", rfdestruct, NULL );
|
||||
|
||||
// defined associated methods
|
||||
m_pClassFILE->AddFunction("open", rfopen, cfopen );
|
||||
m_pClassFILE->AddFunction("close", rfclose, cfclose );
|
||||
m_pClassFILE->AddFunction("writeln", rfwrite, cfwrite );
|
||||
m_pClassFILE->AddFunction("readln", rfread, cfread );
|
||||
m_pClassFILE->AddFunction("eof", rfeof, cfeof );
|
||||
|
||||
m_pFuncFile = new CBotProgram( );
|
||||
CBotStringArray ListFonctions;
|
||||
m_pFuncFile->Compile( "public file openfile(string name, string mode) {return new file(name, mode);}", ListFonctions);
|
||||
m_pFuncFile->SetIdent(-2); // restoreState as a special identifier for this function
|
||||
}
|
||||
|
|
@ -59,189 +59,208 @@ if(PLATFORM_WINDOWS)
|
|||
endif()
|
||||
|
||||
# Source files
|
||||
set(SOURCES
|
||||
app/app.cpp
|
||||
app/main.cpp
|
||||
app/pausemanager.cpp
|
||||
app/system.cpp
|
||||
app/${SYSTEM_CPP_MODULE}
|
||||
app/system_other.cpp
|
||||
common/event.cpp
|
||||
common/image.cpp
|
||||
common/iman.cpp
|
||||
common/logger.cpp
|
||||
common/misc.cpp
|
||||
common/profile.cpp
|
||||
common/restext.cpp
|
||||
common/stringutils.cpp
|
||||
common/resources/resourcemanager.cpp
|
||||
common/resources/inputstreambuffer.cpp
|
||||
common/resources/outputstreambuffer.cpp
|
||||
common/resources/inputstream.cpp
|
||||
common/resources/outputstream.cpp
|
||||
common/resources/sndfile.cpp
|
||||
graphics/core/color.cpp
|
||||
graphics/engine/camera.cpp
|
||||
graphics/engine/cloud.cpp
|
||||
graphics/engine/engine.cpp
|
||||
graphics/engine/lightman.cpp
|
||||
graphics/engine/lightning.cpp
|
||||
graphics/engine/modelfile.cpp
|
||||
graphics/engine/modelmanager.cpp
|
||||
graphics/engine/particle.cpp
|
||||
graphics/engine/planet.cpp
|
||||
graphics/engine/pyro.cpp
|
||||
graphics/engine/terrain.cpp
|
||||
graphics/engine/text.cpp
|
||||
graphics/engine/water.cpp
|
||||
graphics/opengl/gldevice.cpp
|
||||
object/auto/auto.cpp
|
||||
object/auto/autobase.cpp
|
||||
object/auto/autoconvert.cpp
|
||||
object/auto/autoderrick.cpp
|
||||
object/auto/autodestroyer.cpp
|
||||
object/auto/autoegg.cpp
|
||||
object/auto/autoenergy.cpp
|
||||
object/auto/autofactory.cpp
|
||||
object/auto/autoflag.cpp
|
||||
object/auto/autohuston.cpp
|
||||
object/auto/autoinfo.cpp
|
||||
object/auto/autojostle.cpp
|
||||
object/auto/autokid.cpp
|
||||
object/auto/autolabo.cpp
|
||||
object/auto/automush.cpp
|
||||
object/auto/autonest.cpp
|
||||
object/auto/autonuclear.cpp
|
||||
object/auto/autopara.cpp
|
||||
object/auto/autoportico.cpp
|
||||
object/auto/autoradar.cpp
|
||||
object/auto/autorepair.cpp
|
||||
object/auto/autoresearch.cpp
|
||||
object/auto/autoroot.cpp
|
||||
object/auto/autosafe.cpp
|
||||
object/auto/autostation.cpp
|
||||
object/auto/autotower.cpp
|
||||
object/brain.cpp
|
||||
object/level/parser.cpp
|
||||
object/level/parserline.cpp
|
||||
object/level/parserparam.cpp
|
||||
object/level/parserexceptions.cpp
|
||||
object/mainmovie.cpp
|
||||
object/motion/motion.cpp
|
||||
object/motion/motionant.cpp
|
||||
object/motion/motionbee.cpp
|
||||
object/motion/motiondummy.cpp
|
||||
object/motion/motionhuman.cpp
|
||||
object/motion/motionmother.cpp
|
||||
object/motion/motionspider.cpp
|
||||
object/motion/motiontoto.cpp
|
||||
object/motion/motionvehicle.cpp
|
||||
object/motion/motionworm.cpp
|
||||
object/object.cpp
|
||||
object/robotmain.cpp
|
||||
object/objman.cpp
|
||||
object/task/task.cpp
|
||||
object/task/taskadvance.cpp
|
||||
object/task/taskbuild.cpp
|
||||
object/task/taskfire.cpp
|
||||
object/task/taskfireant.cpp
|
||||
object/task/taskflag.cpp
|
||||
object/task/taskgoto.cpp
|
||||
object/task/taskgungoal.cpp
|
||||
object/task/taskinfo.cpp
|
||||
object/task/taskmanager.cpp
|
||||
object/task/taskmanip.cpp
|
||||
object/task/taskpen.cpp
|
||||
object/task/taskrecover.cpp
|
||||
object/task/taskreset.cpp
|
||||
object/task/tasksearch.cpp
|
||||
object/task/taskshield.cpp
|
||||
object/task/taskspiderexplo.cpp
|
||||
object/task/tasktake.cpp
|
||||
object/task/taskterraform.cpp
|
||||
object/task/taskturn.cpp
|
||||
object/task/taskwait.cpp
|
||||
physics/physics.cpp
|
||||
script/cbottoken.cpp
|
||||
script/cmdtoken.cpp
|
||||
script/script.cpp
|
||||
sound/sound.cpp
|
||||
ui/button.cpp
|
||||
ui/check.cpp
|
||||
ui/color.cpp
|
||||
ui/compass.cpp
|
||||
ui/control.cpp
|
||||
ui/displayinfo.cpp
|
||||
ui/displaytext.cpp
|
||||
ui/edit.cpp
|
||||
ui/editvalue.cpp
|
||||
ui/gauge.cpp
|
||||
ui/group.cpp
|
||||
ui/image.cpp
|
||||
ui/interface.cpp
|
||||
ui/key.cpp
|
||||
ui/label.cpp
|
||||
ui/list.cpp
|
||||
ui/maindialog.cpp
|
||||
ui/mainmap.cpp
|
||||
ui/mainshort.cpp
|
||||
ui/map.cpp
|
||||
ui/scroll.cpp
|
||||
ui/shortcut.cpp
|
||||
ui/slider.cpp
|
||||
ui/studio.cpp
|
||||
ui/target.cpp
|
||||
ui/window.cpp
|
||||
${OPENAL_SRC}
|
||||
${RES_FILES}
|
||||
set(BASE_SOURCES
|
||||
app/app.cpp
|
||||
app/pausemanager.cpp
|
||||
app/system.cpp
|
||||
app/${SYSTEM_CPP_MODULE}
|
||||
app/system_other.cpp
|
||||
common/event.cpp
|
||||
common/image.cpp
|
||||
common/iman.cpp
|
||||
common/logger.cpp
|
||||
common/misc.cpp
|
||||
common/profile.cpp
|
||||
common/restext.cpp
|
||||
common/stringutils.cpp
|
||||
common/resources/resourcemanager.cpp
|
||||
common/resources/inputstreambuffer.cpp
|
||||
common/resources/outputstreambuffer.cpp
|
||||
common/resources/inputstream.cpp
|
||||
common/resources/outputstream.cpp
|
||||
common/resources/sndfile.cpp
|
||||
graphics/core/color.cpp
|
||||
graphics/engine/camera.cpp
|
||||
graphics/engine/cloud.cpp
|
||||
graphics/engine/engine.cpp
|
||||
graphics/engine/lightman.cpp
|
||||
graphics/engine/lightning.cpp
|
||||
graphics/engine/modelfile.cpp
|
||||
graphics/engine/modelmanager.cpp
|
||||
graphics/engine/particle.cpp
|
||||
graphics/engine/planet.cpp
|
||||
graphics/engine/pyro.cpp
|
||||
graphics/engine/terrain.cpp
|
||||
graphics/engine/text.cpp
|
||||
graphics/engine/water.cpp
|
||||
graphics/opengl/gldevice.cpp
|
||||
object/auto/auto.cpp
|
||||
object/auto/autobase.cpp
|
||||
object/auto/autoconvert.cpp
|
||||
object/auto/autoderrick.cpp
|
||||
object/auto/autodestroyer.cpp
|
||||
object/auto/autoegg.cpp
|
||||
object/auto/autoenergy.cpp
|
||||
object/auto/autofactory.cpp
|
||||
object/auto/autoflag.cpp
|
||||
object/auto/autohuston.cpp
|
||||
object/auto/autoinfo.cpp
|
||||
object/auto/autojostle.cpp
|
||||
object/auto/autokid.cpp
|
||||
object/auto/autolabo.cpp
|
||||
object/auto/automush.cpp
|
||||
object/auto/autonest.cpp
|
||||
object/auto/autonuclear.cpp
|
||||
object/auto/autopara.cpp
|
||||
object/auto/autoportico.cpp
|
||||
object/auto/autoradar.cpp
|
||||
object/auto/autorepair.cpp
|
||||
object/auto/autoresearch.cpp
|
||||
object/auto/autoroot.cpp
|
||||
object/auto/autosafe.cpp
|
||||
object/auto/autostation.cpp
|
||||
object/auto/autotower.cpp
|
||||
object/brain.cpp
|
||||
object/level/parser.cpp
|
||||
object/level/parserline.cpp
|
||||
object/level/parserparam.cpp
|
||||
object/level/parserexceptions.cpp
|
||||
object/mainmovie.cpp
|
||||
object/motion/motion.cpp
|
||||
object/motion/motionant.cpp
|
||||
object/motion/motionbee.cpp
|
||||
object/motion/motiondummy.cpp
|
||||
object/motion/motionhuman.cpp
|
||||
object/motion/motionmother.cpp
|
||||
object/motion/motionspider.cpp
|
||||
object/motion/motiontoto.cpp
|
||||
object/motion/motionvehicle.cpp
|
||||
object/motion/motionworm.cpp
|
||||
object/object.cpp
|
||||
object/robotmain.cpp
|
||||
object/objman.cpp
|
||||
object/task/task.cpp
|
||||
object/task/taskadvance.cpp
|
||||
object/task/taskbuild.cpp
|
||||
object/task/taskfire.cpp
|
||||
object/task/taskfireant.cpp
|
||||
object/task/taskflag.cpp
|
||||
object/task/taskgoto.cpp
|
||||
object/task/taskgungoal.cpp
|
||||
object/task/taskinfo.cpp
|
||||
object/task/taskmanager.cpp
|
||||
object/task/taskmanip.cpp
|
||||
object/task/taskpen.cpp
|
||||
object/task/taskrecover.cpp
|
||||
object/task/taskreset.cpp
|
||||
object/task/tasksearch.cpp
|
||||
object/task/taskshield.cpp
|
||||
object/task/taskspiderexplo.cpp
|
||||
object/task/tasktake.cpp
|
||||
object/task/taskterraform.cpp
|
||||
object/task/taskturn.cpp
|
||||
object/task/taskwait.cpp
|
||||
physics/physics.cpp
|
||||
script/cbottoken.cpp
|
||||
script/cmdtoken.cpp
|
||||
script/script.cpp
|
||||
sound/sound.cpp
|
||||
ui/button.cpp
|
||||
ui/check.cpp
|
||||
ui/color.cpp
|
||||
ui/compass.cpp
|
||||
ui/control.cpp
|
||||
ui/displayinfo.cpp
|
||||
ui/displaytext.cpp
|
||||
ui/edit.cpp
|
||||
ui/editvalue.cpp
|
||||
ui/gauge.cpp
|
||||
ui/group.cpp
|
||||
ui/image.cpp
|
||||
ui/interface.cpp
|
||||
ui/key.cpp
|
||||
ui/label.cpp
|
||||
ui/list.cpp
|
||||
ui/maindialog.cpp
|
||||
ui/mainmap.cpp
|
||||
ui/mainshort.cpp
|
||||
ui/map.cpp
|
||||
ui/scroll.cpp
|
||||
ui/shortcut.cpp
|
||||
ui/slider.cpp
|
||||
ui/studio.cpp
|
||||
ui/target.cpp
|
||||
ui/window.cpp
|
||||
${OPENAL_SRC}
|
||||
${RES_FILES}
|
||||
)
|
||||
|
||||
set(MAIN_SOURCES
|
||||
app/main.cpp
|
||||
)
|
||||
|
||||
|
||||
# Libraries
|
||||
set(LIBS
|
||||
CBot
|
||||
clipboard
|
||||
localename
|
||||
${SDL_LIBRARY}
|
||||
${SDLIMAGE_LIBRARY}
|
||||
${SDLTTF_LIBRARY}
|
||||
${OPENGL_LIBRARY}
|
||||
${PNG_LIBRARIES}
|
||||
${GLEW_LIBRARY}
|
||||
${Boost_LIBRARIES}
|
||||
${LIBSNDFILE_LIBRARY}
|
||||
${OPTIONAL_LIBS}
|
||||
${PLATFORM_LIBS}
|
||||
CBot
|
||||
clipboard
|
||||
localename
|
||||
${SDL_LIBRARY}
|
||||
${SDLIMAGE_LIBRARY}
|
||||
${SDLTTF_LIBRARY}
|
||||
${OPENGL_LIBRARY}
|
||||
${PNG_LIBRARIES}
|
||||
${GLEW_LIBRARY}
|
||||
${Boost_LIBRARIES}
|
||||
${LIBSNDFILE_LIBRARY}
|
||||
${OPTIONAL_LIBS}
|
||||
${PLATFORM_LIBS}
|
||||
${PHYSFS_LIBRARY}
|
||||
)
|
||||
|
||||
# Local
|
||||
include_directories(
|
||||
.
|
||||
..
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
set(COLOBOT_LIBS ${LIBS} PARENT_SCOPE)
|
||||
|
||||
|
||||
# Includes
|
||||
set(LOCAL_INCLUDES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
# System
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${SDL_INCLUDE_DIR}
|
||||
${SDLIMAGE_INCLUDE_DIR}
|
||||
${SDLTTF_INCLUDE_DIR}
|
||||
${PNG_INCLUDE_DIRS}
|
||||
${GLEW_INCLUDE_PATH}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${LIBSNDFILE_INCLUDE_DIR}
|
||||
${LOCALENAME_INCLUDE_DIR}
|
||||
${OPTIONAL_INCLUDE_DIRS}
|
||||
${CLIPBOARD_INCLUDE_DIR}
|
||||
set(SYSTEM_INCLUDES
|
||||
${SDL_INCLUDE_DIR}
|
||||
${SDLIMAGE_INCLUDE_DIR}
|
||||
${SDLTTF_INCLUDE_DIR}
|
||||
${PNG_INCLUDE_DIRS}
|
||||
${GLEW_INCLUDE_PATH}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${LIBSNDFILE_INCLUDE_DIR}
|
||||
${LOCALENAME_INCLUDE_DIR}
|
||||
${OPTIONAL_INCLUDE_DIRS}
|
||||
${CLIPBOARD_INCLUDE_DIR}
|
||||
${PHYSFS_INCLUDE_PATH}
|
||||
)
|
||||
|
||||
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/CBot)
|
||||
set(COLOBOT_LOCAL_INCLUDES ${LOCAL_INCLUDES} PARENT_SCOPE)
|
||||
set(COLOBOT_SYSTEM_INCLUDES ${SYSTEM_INCLUDES} PARENT_SCOPE)
|
||||
|
||||
add_executable(colobot ${SOURCES})
|
||||
include_directories(${LOCAL_INCLUDES})
|
||||
include_directories(SYSTEM ${SYSTEM_INCLUDES})
|
||||
|
||||
target_link_libraries(colobot ${LIBS})
|
||||
|
||||
# Link directories
|
||||
link_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CBot
|
||||
)
|
||||
|
||||
|
||||
# Targets
|
||||
|
||||
add_library(colobotbase STATIC ${BASE_SOURCES})
|
||||
|
||||
add_executable(colobot ${MAIN_SOURCES})
|
||||
target_link_libraries(colobot colobotbase ${LIBS})
|
||||
|
||||
install(TARGETS colobot RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR})
|
||||
if(NOT CBOT_STATIC)
|
||||
|
|
|
@ -415,13 +415,13 @@ bool CApplication::Create()
|
|||
CResourceManager::SetSaveLocation(m_savePath);
|
||||
CResourceManager::AddLocation(m_savePath, true);
|
||||
|
||||
if (!GetProfile().InitCurrentDirectory())
|
||||
if (!GetProfile().Init())
|
||||
{
|
||||
GetLogger()->Warn("Config not found. Default values will be used!\n");
|
||||
defaultValues = true;
|
||||
}
|
||||
|
||||
if (GetProfile().GetLocalProfileString("Language", "Lang", path)) {
|
||||
if (GetProfile().GetStringProperty("Language", "Lang", path)) {
|
||||
Language language;
|
||||
if (ParseLanguage(path, language)) {
|
||||
m_language = language;
|
||||
|
@ -482,7 +482,7 @@ bool CApplication::Create()
|
|||
|
||||
// load settings from profile
|
||||
int iValue;
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "Resolution", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "Resolution", iValue) )
|
||||
{
|
||||
std::vector<Math::IntPoint> modes;
|
||||
GetVideoResolutionList(modes, true, true);
|
||||
|
@ -490,7 +490,7 @@ bool CApplication::Create()
|
|||
m_deviceConfig.size = modes.at(iValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "Fullscreen", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "Fullscreen", iValue) )
|
||||
{
|
||||
m_deviceConfig.fullScreen = (iValue == 1);
|
||||
}
|
||||
|
@ -625,23 +625,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)
|
||||
{
|
||||
|
|
|
@ -42,9 +42,7 @@ void CInstanceManager::Flush()
|
|||
{
|
||||
for (int i = 0; i < CLASS_MAX; i++)
|
||||
{
|
||||
if (m_table[i].instances != nullptr)
|
||||
delete[] m_table[i].instances;
|
||||
|
||||
delete[] m_table[i].instances;
|
||||
m_table[i].instances = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
#include "common/profile.h"
|
||||
|
||||
#include "common/logger.h"
|
||||
#include "common/resources/inputstream.h"
|
||||
#include "common/resources/outputstream.h"
|
||||
|
||||
#include "app/system.h"
|
||||
|
||||
#include "common/logger.h"
|
||||
|
||||
#include <utility>
|
||||
#include <cstring>
|
||||
#include <boost/property_tree/ini_parser.hpp>
|
||||
|
@ -33,19 +33,24 @@ template<> CProfile* CSingleton<CProfile>::m_instance = nullptr;
|
|||
|
||||
namespace bp = boost::property_tree;
|
||||
|
||||
CProfile::CProfile() :
|
||||
m_profileNeedSave(false)
|
||||
CProfile::CProfile()
|
||||
: m_profileNeedSave(false)
|
||||
, m_useCurrentDirectory(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CProfile::~CProfile()
|
||||
{
|
||||
SaveCurrentDirectory();
|
||||
Save();
|
||||
}
|
||||
|
||||
void CProfile::SetUseCurrentDirectory(bool useCurrentDirectory)
|
||||
{
|
||||
m_useCurrentDirectory = useCurrentDirectory;
|
||||
}
|
||||
|
||||
bool CProfile::InitCurrentDirectory()
|
||||
bool CProfile::Init()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -67,7 +72,7 @@ bool CProfile::InitCurrentDirectory()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CProfile::SaveCurrentDirectory()
|
||||
bool CProfile::Save()
|
||||
{
|
||||
if (m_profileNeedSave)
|
||||
{
|
||||
|
@ -92,7 +97,7 @@ bool CProfile::SaveCurrentDirectory()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CProfile::SetLocalProfileString(std::string section, std::string key, std::string value)
|
||||
bool CProfile::SetStringProperty(std::string section, std::string key, std::string value)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -108,7 +113,7 @@ bool CProfile::SetLocalProfileString(std::string section, std::string key, std::
|
|||
}
|
||||
|
||||
|
||||
bool CProfile::GetLocalProfileString(std::string section, std::string key, std::string &buffer)
|
||||
bool CProfile::GetStringProperty(std::string section, std::string key, std::string &buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -123,7 +128,7 @@ bool CProfile::GetLocalProfileString(std::string section, std::string key, std::
|
|||
}
|
||||
|
||||
|
||||
bool CProfile::SetLocalProfileInt(std::string section, std::string key, int value)
|
||||
bool CProfile::SetIntProperty(std::string section, std::string key, int value)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -139,7 +144,7 @@ bool CProfile::SetLocalProfileInt(std::string section, std::string key, int valu
|
|||
}
|
||||
|
||||
|
||||
bool CProfile::GetLocalProfileInt(std::string section, std::string key, int &value)
|
||||
bool CProfile::GetIntProperty(std::string section, std::string key, int &value)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -154,7 +159,7 @@ bool CProfile::GetLocalProfileInt(std::string section, std::string key, int &val
|
|||
}
|
||||
|
||||
|
||||
bool CProfile::SetLocalProfileFloat(std::string section, std::string key, float value)
|
||||
bool CProfile::SetFloatProperty(std::string section, std::string key, float value)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -170,7 +175,7 @@ bool CProfile::SetLocalProfileFloat(std::string section, std::string key, float
|
|||
}
|
||||
|
||||
|
||||
bool CProfile::GetLocalProfileFloat(std::string section, std::string key, float &value)
|
||||
bool CProfile::GetFloatProperty(std::string section, std::string key, float &value)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -185,7 +190,7 @@ bool CProfile::GetLocalProfileFloat(std::string section, std::string key, float
|
|||
}
|
||||
|
||||
|
||||
std::vector< std::string > CProfile::GetLocalProfileSection(std::string section, std::string key)
|
||||
std::vector< std::string > CProfile::GetSection(std::string section, std::string key)
|
||||
{
|
||||
std::vector< std::string > ret_list;
|
||||
boost::regex re(key + "[0-9]*"); //we want to match all key followed by any number
|
||||
|
@ -215,13 +220,13 @@ void CProfile::SetUserDir(std::string dir)
|
|||
}
|
||||
|
||||
|
||||
std::string CProfile::GetUserBasedPath(std::string dir, std::string default_dir)
|
||||
std::string CProfile::GetUserBasedPath(std::string dir, std::string defaultDir)
|
||||
{
|
||||
std::string path = dir;
|
||||
boost::replace_all(path, "\\", "/");
|
||||
if (dir.find("/") == std::string::npos)
|
||||
{
|
||||
path = default_dir + "/" + dir;
|
||||
path = defaultDir + "/" + dir;
|
||||
}
|
||||
|
||||
if (m_userDirectory.length() > 0)
|
||||
|
@ -230,7 +235,7 @@ std::string CProfile::GetUserBasedPath(std::string dir, std::string default_dir)
|
|||
}
|
||||
else
|
||||
{
|
||||
boost::replace_all(path, "%user%", default_dir);
|
||||
boost::replace_all(path, "%user%", defaultDir);
|
||||
}
|
||||
|
||||
return fs::path(path).make_preferred().string();
|
||||
|
|
|
@ -45,94 +45,98 @@ public:
|
|||
CProfile();
|
||||
virtual ~CProfile();
|
||||
|
||||
/** Set flag to force using ini file from current directory */
|
||||
void SetUseCurrentDirectory(bool useCurrentDirectory);
|
||||
|
||||
/** Loads colobot.ini from current directory
|
||||
* \return return true on success
|
||||
*/
|
||||
bool InitCurrentDirectory();
|
||||
* \return return true on success
|
||||
*/
|
||||
bool Init();
|
||||
|
||||
/** Saves colobot.ini to current directory
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SaveCurrentDirectory();
|
||||
* \return return true on success
|
||||
*/
|
||||
bool Save();
|
||||
|
||||
/** Sets string value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SetLocalProfileString(std::string section, std::string key, std::string value);
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SetStringProperty(std::string section, std::string key, std::string value);
|
||||
|
||||
/** Gets string value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param buffer
|
||||
* \return return true on success
|
||||
*/
|
||||
bool GetLocalProfileString(std::string section, std::string key, std::string& buffer);
|
||||
* \param section
|
||||
* \param key
|
||||
* \param buffer
|
||||
* \return return true on success
|
||||
*/
|
||||
bool GetStringProperty(std::string section, std::string key, std::string& buffer);
|
||||
|
||||
/** Sets int value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SetLocalProfileInt(std::string section, std::string key, int value);
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SetIntProperty(std::string section, std::string key, int value);
|
||||
|
||||
/** Gets int value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool GetLocalProfileInt(std::string section, std::string key, int &value);
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool GetIntProperty(std::string section, std::string key, int &value);
|
||||
|
||||
/** Sets float value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SetLocalProfileFloat(std::string section, std::string key, float value);
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool SetFloatProperty(std::string section, std::string key, float value);
|
||||
|
||||
/** Gets float value in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool GetLocalProfileFloat(std::string section, std::string key, float &value);
|
||||
* \param section
|
||||
* \param key
|
||||
* \param value
|
||||
* \return return true on success
|
||||
*/
|
||||
bool GetFloatProperty(std::string section, std::string key, float &value);
|
||||
|
||||
/** Gets all values in section under specified key
|
||||
* \param section
|
||||
* \param key
|
||||
* \return vector of values
|
||||
*/
|
||||
std::vector< std::string > GetLocalProfileSection(std::string section, std::string key);
|
||||
* \param section
|
||||
* \param key
|
||||
* \return vector of values
|
||||
*/
|
||||
std::vector< std::string > GetSection(std::string section, std::string key);
|
||||
|
||||
/** Sets current user directory
|
||||
* \param dir
|
||||
*/
|
||||
* \param dir
|
||||
*/
|
||||
void SetUserDir(std::string dir);
|
||||
|
||||
/** Returns path based on current user. Replaces %user% in path with current user dir or
|
||||
* uses default_dir param if no user dir is specified
|
||||
* \param dir
|
||||
* \param default_dir
|
||||
* \return path
|
||||
*/
|
||||
std::string GetUserBasedPath(std::string dir, std::string default_dir);
|
||||
* uses default_dir param if no user dir is specified
|
||||
* \param dir
|
||||
* \param default_dir
|
||||
* \return path
|
||||
*/
|
||||
std::string GetUserBasedPath(std::string dir, std::string defaultDir);
|
||||
|
||||
/** opy a file into the temporary folder.
|
||||
* \param filename
|
||||
* \return true on success
|
||||
*/
|
||||
/** Copy a file into the temporary folder.
|
||||
* \param filename
|
||||
* \return true on success
|
||||
*/
|
||||
bool CopyFileToTemp(std::string filename);
|
||||
|
||||
private:
|
||||
boost::property_tree::ptree m_propertyTree;
|
||||
bool m_profileNeedSave;
|
||||
std::string m_userDirectory;
|
||||
bool m_useCurrentDirectory;
|
||||
};
|
||||
|
||||
//! Global function to get profile instance
|
||||
|
|
|
@ -62,10 +62,7 @@ public:
|
|||
static void ReplaceInstance(T* newInstance)
|
||||
{
|
||||
assert(newInstance != nullptr);
|
||||
|
||||
if (m_instance != nullptr)
|
||||
delete m_instance;
|
||||
|
||||
delete m_instance;
|
||||
m_instance = newInstance;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -258,26 +258,16 @@ public:
|
|||
|
||||
//! Sets the transform matrix of given type
|
||||
virtual void SetTransform(TransformType type, const Math::Matrix &matrix) = 0;
|
||||
//! Returns the current transform matrix of given type
|
||||
virtual const Math::Matrix& GetTransform(TransformType type) = 0;
|
||||
//! Multiplies the current transform matrix of given type by given matrix
|
||||
virtual void MultiplyTransform(TransformType type, const Math::Matrix &matrix) = 0;
|
||||
|
||||
//! Sets the current material
|
||||
virtual void SetMaterial(const Material &material) = 0;
|
||||
//! Returns the current material
|
||||
virtual const Material& GetMaterial() = 0;
|
||||
|
||||
//! Returns the maximum number of lights available
|
||||
virtual int GetMaxLightCount() = 0;
|
||||
//! Sets the light at given index
|
||||
virtual void SetLight(int index, const Light &light) = 0;
|
||||
//! Returns the current light at given index
|
||||
virtual const Light& GetLight(int index) = 0;
|
||||
//! Enables/disables the light at given index
|
||||
virtual void SetLightEnabled(int index, bool enabled) = 0;
|
||||
//! Returns the current enable state of light at given index
|
||||
virtual bool GetLightEnabled(int index) = 0;
|
||||
|
||||
//! Creates a texture from image; the image can be safely removed after that
|
||||
virtual Texture CreateTexture(CImage *image, const TextureCreateParams ¶ms) = 0;
|
||||
|
@ -294,17 +284,11 @@ public:
|
|||
virtual void SetTexture(int index, const Texture &texture) = 0;
|
||||
//! Sets the texture image by ID at given texture stage
|
||||
virtual void SetTexture(int index, unsigned int textureId) = 0;
|
||||
//! Returns the (multi)texture at given index
|
||||
virtual Texture GetTexture(int index) = 0;
|
||||
//! Enables/disables the given texture stage
|
||||
virtual void SetTextureEnabled(int index, bool enabled) = 0;
|
||||
//! Returns the current enable state of given texture stage
|
||||
virtual bool GetTextureEnabled(int index) = 0;
|
||||
|
||||
//! Sets the params for texture stage with given index
|
||||
virtual void SetTextureStageParams(int index, const TextureStageParams ¶ms) = 0;
|
||||
//! Returns the current params of texture stage with given index
|
||||
virtual TextureStageParams GetTextureStageParams(int index) = 0;
|
||||
|
||||
//! Sets only the texture wrap modes (for faster than thru stage params)
|
||||
virtual void SetTextureStageWrap(int index, TexWrapMode wrapS, TexWrapMode wrapT) = 0;
|
||||
|
@ -348,61 +332,39 @@ public:
|
|||
|
||||
//! Enables/disables the given render state
|
||||
virtual void SetRenderState(RenderState state, bool enabled) = 0;
|
||||
//! Returns the current setting of given render state
|
||||
virtual bool GetRenderState(RenderState state) = 0;
|
||||
|
||||
//! Sets the function of depth test
|
||||
virtual void SetDepthTestFunc(CompFunc func) = 0;
|
||||
//! Returns the current function of depth test
|
||||
virtual CompFunc GetDepthTestFunc() = 0;
|
||||
|
||||
//! Sets the depth bias (constant value added to Z-coords)
|
||||
virtual void SetDepthBias(float factor) = 0;
|
||||
//! Returns the current depth bias
|
||||
virtual float GetDepthBias() = 0;
|
||||
|
||||
//! Sets the alpha test function and reference value
|
||||
virtual void SetAlphaTestFunc(CompFunc func, float refValue) = 0;
|
||||
//! Returns the current alpha test function and reference value
|
||||
virtual void GetAlphaTestFunc(CompFunc &func, float &refValue) = 0;
|
||||
|
||||
//! Sets the blending functions for source and destination operations
|
||||
virtual void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend) = 0;
|
||||
//! Returns the current blending functions for source and destination operations
|
||||
virtual void GetBlendFunc(BlendFunc &srcBlend, BlendFunc &dstBlend) = 0;
|
||||
|
||||
//! Sets the clear color
|
||||
virtual void SetClearColor(const Color &color) = 0;
|
||||
//! Returns the current clear color
|
||||
virtual Color GetClearColor() = 0;
|
||||
|
||||
//! Sets the global ambient color
|
||||
virtual void SetGlobalAmbient(const Color &color) = 0;
|
||||
//! Returns the global ambient color
|
||||
virtual Color GetGlobalAmbient() = 0;
|
||||
|
||||
//! Sets the fog parameters: mode, color, start distance, end distance and density (for exp models)
|
||||
virtual void SetFogParams(FogMode mode, const Color &color, float start, float end, float density) = 0;
|
||||
//! Returns the current fog parameters: mode, color, start distance, end distance and density (for exp models)
|
||||
virtual void GetFogParams(FogMode &mode, Color &color, float &start, float &end, float &density) = 0;
|
||||
|
||||
//! Sets the current cull mode
|
||||
virtual void SetCullMode(CullMode mode) = 0;
|
||||
//! Returns the current cull mode
|
||||
virtual CullMode GetCullMode() = 0;
|
||||
|
||||
//! Sets the shade model
|
||||
virtual void SetShadeModel(ShadeModel model) = 0;
|
||||
//! Returns the current shade model
|
||||
virtual ShadeModel GetShadeModel() = 0;
|
||||
|
||||
//! Sets the current fill mode
|
||||
virtual void SetFillMode(FillMode mode) = 0;
|
||||
//! Returns the current fill mode
|
||||
virtual FillMode GetFillMode() = 0;
|
||||
|
||||
//! Returns the pixels of the entire screen
|
||||
virtual void* GetFrameBufferPixels()const = 0;
|
||||
virtual void* GetFrameBufferPixels() const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1964,10 +1964,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;
|
||||
|
@ -3123,68 +3123,68 @@ void CEngine::Draw3DScene()
|
|||
|
||||
m_app->StartPerformanceCounter(PCNT_RENDER_TERRAIN);
|
||||
|
||||
// Draw terrain with shadows, if shadows enabled
|
||||
if (m_shadowVisible)
|
||||
// Draw terrain
|
||||
|
||||
m_lightMan->UpdateDeviceLights(ENG_OBJTYPE_TERRAIN);
|
||||
|
||||
for (int objRank = 0; objRank < static_cast<int>(m_objects.size()); objRank++)
|
||||
{
|
||||
m_lightMan->UpdateDeviceLights(ENG_OBJTYPE_TERRAIN);
|
||||
if (! m_objects[objRank].used)
|
||||
continue;
|
||||
|
||||
for (int objRank = 0; objRank < static_cast<int>(m_objects.size()); objRank++)
|
||||
if (m_objects[objRank].type != ENG_OBJTYPE_TERRAIN)
|
||||
continue;
|
||||
|
||||
if (! m_objects[objRank].drawWorld)
|
||||
continue;
|
||||
|
||||
m_device->SetTransform(TRANSFORM_WORLD, m_objects[objRank].transform);
|
||||
|
||||
if (! IsVisible(objRank))
|
||||
continue;
|
||||
|
||||
int baseObjRank = m_objects[objRank].baseObjRank;
|
||||
if (baseObjRank == -1)
|
||||
continue;
|
||||
|
||||
assert(baseObjRank >= 0 && baseObjRank < static_cast<int>( m_baseObjects.size() ));
|
||||
|
||||
EngineBaseObject& p1 = m_baseObjects[baseObjRank];
|
||||
if (! p1.used)
|
||||
continue;
|
||||
|
||||
for (int l2 = 0; l2 < static_cast<int>( p1.next.size() ); l2++)
|
||||
{
|
||||
if (! m_objects[objRank].used)
|
||||
continue;
|
||||
EngineBaseObjTexTier& p2 = p1.next[l2];
|
||||
|
||||
if (m_objects[objRank].type != ENG_OBJTYPE_TERRAIN)
|
||||
continue;
|
||||
SetTexture(p2.tex1, 0);
|
||||
SetTexture(p2.tex2, 1);
|
||||
|
||||
if (! m_objects[objRank].drawWorld)
|
||||
continue;
|
||||
|
||||
m_device->SetTransform(TRANSFORM_WORLD, m_objects[objRank].transform);
|
||||
|
||||
if (! IsVisible(objRank))
|
||||
continue;
|
||||
|
||||
int baseObjRank = m_objects[objRank].baseObjRank;
|
||||
if (baseObjRank == -1)
|
||||
continue;
|
||||
|
||||
assert(baseObjRank >= 0 && baseObjRank < static_cast<int>( m_baseObjects.size() ));
|
||||
|
||||
EngineBaseObject& p1 = m_baseObjects[baseObjRank];
|
||||
if (! p1.used)
|
||||
continue;
|
||||
|
||||
for (int l2 = 0; l2 < static_cast<int>( p1.next.size() ); l2++)
|
||||
for (int l3 = 0; l3 < static_cast<int>( p2.next.size() ); l3++)
|
||||
{
|
||||
EngineBaseObjTexTier& p2 = p1.next[l2];
|
||||
EngineBaseObjLODTier& p3 = p2.next[l3];
|
||||
|
||||
SetTexture(p2.tex1, 0);
|
||||
SetTexture(p2.tex2, 1);
|
||||
if (! IsWithinLODLimit(m_objects[objRank].distance, p3.lodLevel))
|
||||
continue;
|
||||
|
||||
for (int l3 = 0; l3 < static_cast<int>( p2.next.size() ); l3++)
|
||||
for (int l4 = 0; l4 < static_cast<int>( p3.next.size() ); l4++)
|
||||
{
|
||||
EngineBaseObjLODTier& p3 = p2.next[l3];
|
||||
EngineBaseObjDataTier& p4 = p3.next[l4];
|
||||
|
||||
if (! IsWithinLODLimit(m_objects[objRank].distance, p3.lodLevel))
|
||||
continue;
|
||||
SetMaterial(p4.material);
|
||||
SetState(p4.state);
|
||||
|
||||
for (int l4 = 0; l4 < static_cast<int>( p3.next.size() ); l4++)
|
||||
{
|
||||
EngineBaseObjDataTier& p4 = p3.next[l4];
|
||||
|
||||
SetMaterial(p4.material);
|
||||
SetState(p4.state);
|
||||
|
||||
DrawObject(p4);
|
||||
}
|
||||
DrawObject(p4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draws the shadows
|
||||
DrawShadow();
|
||||
}
|
||||
|
||||
// Draws the shadows , if shadows enabled
|
||||
if (m_shadowVisible)
|
||||
DrawShadow();
|
||||
|
||||
|
||||
m_app->StopPerformanceCounter(PCNT_RENDER_TERRAIN);
|
||||
|
||||
// Draw other objects (and if shadows disabled, also terrain)
|
||||
|
|
|
@ -290,11 +290,6 @@ void CGLDevice::SetUseVbo(bool vboAvailable)
|
|||
m_vboAvailable = vboAvailable;
|
||||
}
|
||||
|
||||
bool CGLDevice::GetUseVbo()
|
||||
{
|
||||
return m_vboAvailable;
|
||||
}
|
||||
|
||||
void CGLDevice::BeginScene()
|
||||
{
|
||||
Clear();
|
||||
|
@ -339,44 +334,6 @@ void CGLDevice::SetTransform(TransformType type, const Math::Matrix &matrix)
|
|||
}
|
||||
}
|
||||
|
||||
const Math::Matrix& CGLDevice::GetTransform(TransformType type)
|
||||
{
|
||||
if (type == TRANSFORM_WORLD)
|
||||
return m_worldMat;
|
||||
else if (type == TRANSFORM_VIEW)
|
||||
return m_viewMat;
|
||||
else if (type == TRANSFORM_PROJECTION)
|
||||
return m_projectionMat;
|
||||
else
|
||||
assert(false);
|
||||
|
||||
return m_worldMat; // to avoid warning
|
||||
}
|
||||
|
||||
void CGLDevice::MultiplyTransform(TransformType type, const Math::Matrix &matrix)
|
||||
{
|
||||
if (type == TRANSFORM_WORLD)
|
||||
{
|
||||
m_worldMat = Math::MultiplyMatrices(m_worldMat, matrix);
|
||||
UpdateModelviewMatrix();
|
||||
}
|
||||
else if (type == TRANSFORM_VIEW)
|
||||
{
|
||||
m_viewMat = Math::MultiplyMatrices(m_viewMat, matrix);
|
||||
UpdateModelviewMatrix();
|
||||
}
|
||||
else if (type == TRANSFORM_PROJECTION)
|
||||
{
|
||||
m_projectionMat = Math::MultiplyMatrices(m_projectionMat, matrix);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadMatrixf(m_projectionMat.Array());
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
void CGLDevice::UpdateModelviewMatrix()
|
||||
{
|
||||
m_modelviewMat = Math::MultiplyMatrices(m_viewMat, m_worldMat);
|
||||
|
@ -402,11 +359,6 @@ void CGLDevice::SetMaterial(const Material &material)
|
|||
glMaterialfv(GL_FRONT, GL_SPECULAR, m_material.specular.Array());
|
||||
}
|
||||
|
||||
const Material& CGLDevice::GetMaterial()
|
||||
{
|
||||
return m_material;
|
||||
}
|
||||
|
||||
int CGLDevice::GetMaxLightCount()
|
||||
{
|
||||
return m_lights.size();
|
||||
|
@ -482,14 +434,6 @@ void CGLDevice::UpdateLightPosition(int index)
|
|||
glPopMatrix();
|
||||
}
|
||||
|
||||
const Light& CGLDevice::GetLight(int index)
|
||||
{
|
||||
assert(index >= 0);
|
||||
assert(index < static_cast<int>( m_lights.size() ));
|
||||
|
||||
return m_lights[index];
|
||||
}
|
||||
|
||||
void CGLDevice::SetLightEnabled(int index, bool enabled)
|
||||
{
|
||||
assert(index >= 0);
|
||||
|
@ -503,14 +447,6 @@ void CGLDevice::SetLightEnabled(int index, bool enabled)
|
|||
glDisable(GL_LIGHT0 + index);
|
||||
}
|
||||
|
||||
bool CGLDevice::GetLightEnabled(int index)
|
||||
{
|
||||
assert(index >= 0);
|
||||
assert(index < static_cast<int>( m_lights.size() ));
|
||||
|
||||
return m_lightsEnabled[index];
|
||||
}
|
||||
|
||||
/** If image is invalid, returns invalid texture.
|
||||
Otherwise, returns pointer to new Texture struct.
|
||||
This struct must not be deleted in other way than through DeleteTexture() */
|
||||
|
@ -781,15 +717,6 @@ void CGLDevice::SetTexture(int index, unsigned int textureId)
|
|||
UpdateTextureParams(index);
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the previously assigned texture or invalid texture if the given stage is not enabled. */
|
||||
Texture CGLDevice::GetTexture(int index)
|
||||
{
|
||||
assert(index >= 0 && index < static_cast<int>( m_currentTextures.size() ));
|
||||
|
||||
return m_currentTextures[index];
|
||||
}
|
||||
|
||||
void CGLDevice::SetTextureEnabled(int index, bool enabled)
|
||||
{
|
||||
assert(index >= 0 && index < static_cast<int>( m_currentTextures.size() ));
|
||||
|
@ -813,13 +740,6 @@ void CGLDevice::SetTextureEnabled(int index, bool enabled)
|
|||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
bool CGLDevice::GetTextureEnabled(int index)
|
||||
{
|
||||
assert(index >= 0 && index < static_cast<int>( m_currentTextures.size() ));
|
||||
|
||||
return m_texturesEnabled[index];
|
||||
}
|
||||
|
||||
/**
|
||||
Sets the texture parameters for the given texture stage.
|
||||
If the given texture was not set (bound) yet, nothing happens.
|
||||
|
@ -1002,13 +922,6 @@ void CGLDevice::SetTextureStageWrap(int index, TexWrapMode wrapS, TexWrapMode wr
|
|||
else assert(false);
|
||||
}
|
||||
|
||||
TextureStageParams CGLDevice::GetTextureStageParams(int index)
|
||||
{
|
||||
assert(index >= 0 && index < static_cast<int>( m_currentTextures.size() ));
|
||||
|
||||
return m_textureStageParams[index];
|
||||
}
|
||||
|
||||
GLenum TranslateGfxPrimitive(PrimitiveType type)
|
||||
{
|
||||
GLenum flag = 0;
|
||||
|
@ -1529,30 +1442,6 @@ void CGLDevice::SetRenderState(RenderState state, bool enabled)
|
|||
glDisable(flag);
|
||||
}
|
||||
|
||||
bool CGLDevice::GetRenderState(RenderState state)
|
||||
{
|
||||
if (state == RENDER_STATE_LIGHTING)
|
||||
return m_lighting;
|
||||
|
||||
GLenum flag = 0;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case RENDER_STATE_DEPTH_WRITE: flag = GL_DEPTH_WRITEMASK; break;
|
||||
case RENDER_STATE_BLENDING: flag = GL_BLEND; break;
|
||||
case RENDER_STATE_FOG: flag = GL_FOG; break;
|
||||
case RENDER_STATE_DEPTH_TEST: flag = GL_DEPTH_TEST; break;
|
||||
case RENDER_STATE_ALPHA_TEST: flag = GL_ALPHA_TEST; break;
|
||||
case RENDER_STATE_CULLING: flag = GL_CULL_FACE; break;
|
||||
default: assert(false); break;
|
||||
}
|
||||
|
||||
GLboolean result = GL_FALSE;
|
||||
glGetBooleanv(flag, &result);
|
||||
|
||||
return result == GL_TRUE;
|
||||
}
|
||||
|
||||
CompFunc TranslateGLCompFunc(GLenum flag)
|
||||
{
|
||||
switch (flag)
|
||||
|
@ -1592,39 +1481,16 @@ void CGLDevice::SetDepthTestFunc(CompFunc func)
|
|||
glDepthFunc(TranslateGfxCompFunc(func));
|
||||
}
|
||||
|
||||
CompFunc CGLDevice::GetDepthTestFunc()
|
||||
{
|
||||
GLint flag = 0;
|
||||
glGetIntegerv(GL_DEPTH_FUNC, &flag);
|
||||
return TranslateGLCompFunc(static_cast<GLenum>(flag));
|
||||
}
|
||||
|
||||
void CGLDevice::SetDepthBias(float factor)
|
||||
{
|
||||
glPolygonOffset(factor, 0.0f);
|
||||
}
|
||||
|
||||
float CGLDevice::GetDepthBias()
|
||||
{
|
||||
GLfloat result = 0.0f;
|
||||
glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void CGLDevice::SetAlphaTestFunc(CompFunc func, float refValue)
|
||||
{
|
||||
glAlphaFunc(TranslateGfxCompFunc(func), refValue);
|
||||
}
|
||||
|
||||
void CGLDevice::GetAlphaTestFunc(CompFunc &func, float &refValue)
|
||||
{
|
||||
GLint flag = 0;
|
||||
glGetIntegerv(GL_ALPHA_TEST_FUNC, &flag);
|
||||
func = TranslateGLCompFunc(static_cast<GLenum>(flag));
|
||||
|
||||
glGetFloatv(GL_ALPHA_TEST_REF, static_cast<GLfloat*>(&refValue));
|
||||
}
|
||||
|
||||
BlendFunc TranslateGLBlendFunc(GLenum flag)
|
||||
{
|
||||
switch (flag)
|
||||
|
@ -1671,41 +1537,16 @@ void CGLDevice::SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend)
|
|||
glBlendFunc(TranslateGfxBlendFunc(srcBlend), TranslateGfxBlendFunc(dstBlend));
|
||||
}
|
||||
|
||||
void CGLDevice::GetBlendFunc(BlendFunc &srcBlend, BlendFunc &dstBlend)
|
||||
{
|
||||
GLint srcFlag = 0;
|
||||
glGetIntegerv(GL_ALPHA_TEST_FUNC, &srcFlag);
|
||||
srcBlend = TranslateGLBlendFunc(static_cast<GLenum>(srcFlag));
|
||||
|
||||
GLint dstFlag = 0;
|
||||
glGetIntegerv(GL_ALPHA_TEST_FUNC, &dstFlag);
|
||||
dstBlend = TranslateGLBlendFunc(static_cast<GLenum>(dstFlag));
|
||||
}
|
||||
|
||||
void CGLDevice::SetClearColor(const Color &color)
|
||||
{
|
||||
glClearColor(color.r, color.g, color.b, color.a);
|
||||
}
|
||||
|
||||
Color CGLDevice::GetClearColor()
|
||||
{
|
||||
GLfloat color[4] = { 0.0f };
|
||||
glGetFloatv(GL_COLOR_CLEAR_VALUE, color);
|
||||
return Color(color[0], color[1], color[2], color[3]);
|
||||
}
|
||||
|
||||
void CGLDevice::SetGlobalAmbient(const Color &color)
|
||||
{
|
||||
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, color.Array());
|
||||
}
|
||||
|
||||
Color CGLDevice::GetGlobalAmbient()
|
||||
{
|
||||
GLfloat color[4] = { 0.0f };
|
||||
glGetFloatv(GL_LIGHT_MODEL_AMBIENT, color);
|
||||
return Color(color[0], color[1], color[2], color[3]);
|
||||
}
|
||||
|
||||
void CGLDevice::SetFogParams(FogMode mode, const Color &color, float start, float end, float density)
|
||||
{
|
||||
if (mode == FOG_LINEAR) glFogi(GL_FOG_MODE, GL_LINEAR);
|
||||
|
@ -1719,23 +1560,6 @@ void CGLDevice::SetFogParams(FogMode mode, const Color &color, float start, floa
|
|||
glFogfv(GL_FOG_COLOR, color.Array());
|
||||
}
|
||||
|
||||
void CGLDevice::GetFogParams(FogMode &mode, Color &color, float &start, float &end, float &density)
|
||||
{
|
||||
GLint flag = 0;
|
||||
glGetIntegerv(GL_FOG_MODE, &flag);
|
||||
if (flag == GL_LINEAR) mode = FOG_LINEAR;
|
||||
else if (flag == GL_EXP) mode = FOG_EXP;
|
||||
else if (flag == GL_EXP2) mode = FOG_EXP2;
|
||||
else assert(false);
|
||||
|
||||
glGetFloatv(GL_FOG_START, static_cast<GLfloat*>(&start));
|
||||
glGetFloatv(GL_FOG_END, static_cast<GLfloat*>(&end));
|
||||
glGetFloatv(GL_FOG_DENSITY, static_cast<GLfloat*>(&density));
|
||||
GLfloat col[4] = { 0.0f };
|
||||
glGetFloatv(GL_FOG_COLOR, col);
|
||||
color = Color(col[0], col[1], col[2], col[3]);
|
||||
}
|
||||
|
||||
void CGLDevice::SetCullMode(CullMode mode)
|
||||
{
|
||||
// Cull clockwise back faces, so front face is the opposite
|
||||
|
@ -1745,16 +1569,6 @@ void CGLDevice::SetCullMode(CullMode mode)
|
|||
else assert(false);
|
||||
}
|
||||
|
||||
CullMode CGLDevice::GetCullMode()
|
||||
{
|
||||
GLint flag = 0;
|
||||
glGetIntegerv(GL_FRONT_FACE, &flag);
|
||||
if (flag == GL_CW) return CULL_CCW;
|
||||
else if (flag == GL_CCW) return CULL_CW;
|
||||
else assert(false);
|
||||
return CULL_CW;
|
||||
}
|
||||
|
||||
void CGLDevice::SetShadeModel(ShadeModel model)
|
||||
{
|
||||
if (model == SHADE_FLAT) glShadeModel(GL_FLAT);
|
||||
|
@ -1762,16 +1576,6 @@ void CGLDevice::SetShadeModel(ShadeModel model)
|
|||
else assert(false);
|
||||
}
|
||||
|
||||
ShadeModel CGLDevice::GetShadeModel()
|
||||
{
|
||||
GLint flag = 0;
|
||||
glGetIntegerv(GL_SHADE_MODEL, &flag);
|
||||
if (flag == GL_FLAT) return SHADE_FLAT;
|
||||
else if (flag == GL_SMOOTH) return SHADE_SMOOTH;
|
||||
else assert(false);
|
||||
return SHADE_FLAT;
|
||||
}
|
||||
|
||||
void CGLDevice::SetFillMode(FillMode mode)
|
||||
{
|
||||
if (mode == FILL_POINT) glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
|
||||
|
@ -1780,21 +1584,10 @@ void CGLDevice::SetFillMode(FillMode mode)
|
|||
else assert(false);
|
||||
}
|
||||
|
||||
FillMode CGLDevice::GetFillMode()
|
||||
{
|
||||
GLint flag = 0;
|
||||
glGetIntegerv(GL_POLYGON_MODE, &flag);
|
||||
if (flag == GL_POINT) return FILL_POINT;
|
||||
else if (flag == GL_LINE) return FILL_LINES;
|
||||
else if (flag == GL_FILL) return FILL_POLY;
|
||||
else assert(false);
|
||||
return FILL_POINT;
|
||||
}
|
||||
|
||||
void* CGLDevice::GetFrameBufferPixels()const{
|
||||
|
||||
GLubyte* pixels = new GLubyte [4 * m_config.size.x * m_config.size.y];
|
||||
|
||||
GLubyte* pixels = new GLubyte[4 * m_config.size.x * m_config.size.y];
|
||||
|
||||
glReadPixels(0, 0, m_config.size.x, m_config.size.y, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
unsigned int* p = static_cast<unsigned int*> ( static_cast<void*>(pixels) );
|
||||
|
|
|
@ -92,103 +92,83 @@ public:
|
|||
CGLDevice(const GLDeviceConfig &config);
|
||||
virtual ~CGLDevice();
|
||||
|
||||
virtual void DebugHook();
|
||||
virtual void DebugLights();
|
||||
virtual void DebugHook() override;
|
||||
virtual void DebugLights() override;
|
||||
|
||||
virtual bool Create();
|
||||
virtual void Destroy();
|
||||
virtual bool Create() override;
|
||||
virtual void Destroy() override;
|
||||
|
||||
void ConfigChanged(const GLDeviceConfig &newConfig);
|
||||
|
||||
void SetUseVbo(bool useVbo);
|
||||
bool GetUseVbo();
|
||||
|
||||
virtual void BeginScene();
|
||||
virtual void EndScene();
|
||||
virtual void BeginScene() override;
|
||||
virtual void EndScene() override;
|
||||
|
||||
virtual void Clear();
|
||||
virtual void Clear() override;
|
||||
|
||||
virtual void SetTransform(TransformType type, const Math::Matrix &matrix);
|
||||
virtual const Math::Matrix& GetTransform(TransformType type);
|
||||
virtual void MultiplyTransform(TransformType type, const Math::Matrix &matrix);
|
||||
virtual void SetTransform(TransformType type, const Math::Matrix &matrix) override;
|
||||
|
||||
virtual void SetMaterial(const Material &material);
|
||||
virtual const Material& GetMaterial();
|
||||
virtual void SetMaterial(const Material &material) override;
|
||||
|
||||
virtual int GetMaxLightCount();
|
||||
virtual void SetLight(int index, const Light &light);
|
||||
virtual const Light& GetLight(int index);
|
||||
virtual void SetLightEnabled(int index, bool enabled);
|
||||
virtual bool GetLightEnabled(int index);
|
||||
virtual int GetMaxLightCount() override;
|
||||
virtual void SetLight(int index, const Light &light) override;
|
||||
virtual void SetLightEnabled(int index, bool enabled) override;
|
||||
|
||||
virtual Texture CreateTexture(CImage *image, const TextureCreateParams ¶ms);
|
||||
virtual Texture CreateTexture(ImageData *data, const TextureCreateParams ¶ms);
|
||||
virtual void DestroyTexture(const Texture &texture);
|
||||
virtual void DestroyAllTextures();
|
||||
virtual Texture CreateTexture(CImage *image, const TextureCreateParams ¶ms) override;
|
||||
virtual Texture CreateTexture(ImageData *data, const TextureCreateParams ¶ms) override;
|
||||
virtual void DestroyTexture(const Texture &texture) override;
|
||||
virtual void DestroyAllTextures() override;
|
||||
|
||||
virtual int GetMaxTextureStageCount();
|
||||
virtual void SetTexture(int index, const Texture &texture);
|
||||
virtual void SetTexture(int index, unsigned int textureId);
|
||||
virtual Texture GetTexture(int index);
|
||||
virtual void SetTextureEnabled(int index, bool enabled);
|
||||
virtual bool GetTextureEnabled(int index);
|
||||
virtual int GetMaxTextureStageCount() override;
|
||||
virtual void SetTexture(int index, const Texture &texture) override;
|
||||
virtual void SetTexture(int index, unsigned int textureId) override;
|
||||
virtual void SetTextureEnabled(int index, bool enabled) override;
|
||||
|
||||
virtual void SetTextureStageParams(int index, const TextureStageParams ¶ms);
|
||||
virtual TextureStageParams GetTextureStageParams(int index);
|
||||
virtual void SetTextureStageParams(int index, const TextureStageParams ¶ms) override;
|
||||
|
||||
virtual void SetTextureStageWrap(int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT);
|
||||
virtual void SetTextureStageWrap(int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT) override;
|
||||
|
||||
virtual void DrawPrimitive(PrimitiveType type, const Vertex *vertices , int vertexCount,
|
||||
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||
virtual void DrawPrimitive(PrimitiveType type, const VertexTex2 *vertices, int vertexCount,
|
||||
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
virtual void DrawPrimitive(PrimitiveType type, const VertexCol *vertices , int vertexCount);
|
||||
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
|
||||
virtual void DrawPrimitive(PrimitiveType type, const VertexCol *vertices , int vertexCount) override;
|
||||
|
||||
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount);
|
||||
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount);
|
||||
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount);
|
||||
virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const Vertex* vertices, int vertexCount);
|
||||
virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount);
|
||||
virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount);
|
||||
virtual void DrawStaticBuffer(unsigned int bufferId);
|
||||
virtual void DestroyStaticBuffer(unsigned int bufferId);
|
||||
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) override;
|
||||
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) override;
|
||||
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount) override;
|
||||
virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) override;
|
||||
virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) override;
|
||||
virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount) override;
|
||||
virtual void DrawStaticBuffer(unsigned int bufferId) override;
|
||||
virtual void DestroyStaticBuffer(unsigned int bufferId) override;
|
||||
|
||||
virtual int ComputeSphereVisibility(const Math::Vector ¢er, float radius);
|
||||
virtual int ComputeSphereVisibility(const Math::Vector ¢er, float radius) override;
|
||||
|
||||
virtual void SetRenderState(RenderState state, bool enabled);
|
||||
virtual bool GetRenderState(RenderState state);
|
||||
virtual void SetRenderState(RenderState state, bool enabled) override;
|
||||
|
||||
virtual void SetDepthTestFunc(CompFunc func);
|
||||
virtual CompFunc GetDepthTestFunc();
|
||||
virtual void SetDepthTestFunc(CompFunc func) override;
|
||||
|
||||
virtual void SetDepthBias(float factor);
|
||||
virtual float GetDepthBias();
|
||||
virtual void SetDepthBias(float factor) override;
|
||||
|
||||
virtual void SetAlphaTestFunc(CompFunc func, float refValue);
|
||||
virtual void GetAlphaTestFunc(CompFunc &func, float &refValue);
|
||||
virtual void SetAlphaTestFunc(CompFunc func, float refValue) override;
|
||||
|
||||
virtual void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend);
|
||||
virtual void GetBlendFunc(BlendFunc &srcBlend, BlendFunc &dstBlend);
|
||||
virtual void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend) override;
|
||||
|
||||
virtual void SetClearColor(const Color &color);
|
||||
virtual Color GetClearColor();
|
||||
virtual void SetClearColor(const Color &color) override;
|
||||
|
||||
virtual void SetGlobalAmbient(const Color &color);
|
||||
virtual Color GetGlobalAmbient();
|
||||
virtual void SetGlobalAmbient(const Color &color) override;
|
||||
|
||||
virtual void SetFogParams(FogMode mode, const Color &color, float start, float end, float density);
|
||||
virtual void GetFogParams(FogMode &mode, Color &color, float &start, float &end, float &density);
|
||||
virtual void SetFogParams(FogMode mode, const Color &color, float start, float end, float density) override;
|
||||
|
||||
virtual void SetCullMode(CullMode mode);
|
||||
virtual CullMode GetCullMode();
|
||||
virtual void SetCullMode(CullMode mode) override;
|
||||
|
||||
virtual void SetShadeModel(ShadeModel model);
|
||||
virtual ShadeModel GetShadeModel();
|
||||
virtual void SetShadeModel(ShadeModel model) override;
|
||||
|
||||
virtual void SetFillMode(FillMode mode) ;
|
||||
virtual FillMode GetFillMode();
|
||||
virtual void SetFillMode(FillMode mode) override;
|
||||
|
||||
virtual void* GetFrameBufferPixels()const;
|
||||
virtual void* GetFrameBufferPixels() const override;
|
||||
|
||||
private:
|
||||
//! Updates internal modelview matrix
|
||||
|
|
|
@ -812,11 +812,23 @@ void CBrain::StopProgram()
|
|||
|
||||
void CBrain::StopTask()
|
||||
{
|
||||
if ( m_primaryTask != 0 )
|
||||
if (m_primaryTask != nullptr)
|
||||
{
|
||||
m_primaryTask->Abort();
|
||||
delete m_primaryTask; // stops the current task
|
||||
m_primaryTask = 0;
|
||||
m_primaryTask = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -900,16 +912,10 @@ void CBrain::StopEditScript(bool bCancel)
|
|||
|
||||
Error CBrain::StartTaskTake()
|
||||
{
|
||||
Error err;
|
||||
|
||||
if ( m_primaryTask != 0 )
|
||||
{
|
||||
delete m_primaryTask; // stops the current task
|
||||
m_primaryTask = 0;
|
||||
}
|
||||
StopTask();
|
||||
|
||||
m_primaryTask = new CTaskManager(m_object);
|
||||
err = m_primaryTask->StartTaskTake();
|
||||
Error err = m_primaryTask->StartTaskTake();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
@ -918,16 +924,10 @@ Error CBrain::StartTaskTake()
|
|||
|
||||
Error CBrain::StartTaskManip(TaskManipOrder order, TaskManipArm arm)
|
||||
{
|
||||
Error err;
|
||||
|
||||
if ( m_primaryTask != 0 )
|
||||
{
|
||||
delete m_primaryTask; // stops the current task
|
||||
m_primaryTask = 0;
|
||||
}
|
||||
StopTask();
|
||||
|
||||
m_primaryTask = new CTaskManager(m_object);
|
||||
err = m_primaryTask->StartTaskManip(order, arm);
|
||||
Error err = m_primaryTask->StartTaskManip(order, arm);
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
@ -936,16 +936,10 @@ Error CBrain::StartTaskManip(TaskManipOrder order, TaskManipArm arm)
|
|||
|
||||
Error CBrain::StartTaskFlag(TaskFlagOrder order, int rank)
|
||||
{
|
||||
Error err;
|
||||
|
||||
if ( m_primaryTask != 0 )
|
||||
{
|
||||
delete m_primaryTask; // stops the current task
|
||||
m_primaryTask = 0;
|
||||
}
|
||||
StopTask();
|
||||
|
||||
m_primaryTask = new CTaskManager(m_object);
|
||||
err = m_primaryTask->StartTaskFlag(order, rank);
|
||||
Error err = m_primaryTask->StartTaskFlag(order, rank);
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
@ -954,16 +948,10 @@ Error CBrain::StartTaskFlag(TaskFlagOrder order, int rank)
|
|||
|
||||
Error CBrain::StartTaskBuild(ObjectType type)
|
||||
{
|
||||
Error err;
|
||||
|
||||
if ( m_primaryTask != 0 )
|
||||
{
|
||||
delete m_primaryTask; // stops the current task
|
||||
m_primaryTask = 0;
|
||||
}
|
||||
StopTask();
|
||||
|
||||
m_primaryTask = new CTaskManager(m_object);
|
||||
err = m_primaryTask->StartTaskBuild(type);
|
||||
Error err = m_primaryTask->StartTaskBuild(type);
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
@ -972,16 +960,10 @@ Error CBrain::StartTaskBuild(ObjectType type)
|
|||
|
||||
Error CBrain::StartTaskSearch()
|
||||
{
|
||||
Error err;
|
||||
|
||||
if ( m_primaryTask != 0 )
|
||||
{
|
||||
delete m_primaryTask; // stops the current task
|
||||
m_primaryTask = 0;
|
||||
}
|
||||
StopTask();
|
||||
|
||||
m_primaryTask = new CTaskManager(m_object);
|
||||
err = m_primaryTask->StartTaskSearch();
|
||||
Error err = m_primaryTask->StartTaskSearch();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
@ -990,38 +972,26 @@ Error CBrain::StartTaskSearch()
|
|||
|
||||
Error CBrain::StartTaskTerraform()
|
||||
{
|
||||
Error err;
|
||||
|
||||
if ( m_primaryTask != 0 )
|
||||
{
|
||||
delete m_primaryTask; // stops the current task
|
||||
m_primaryTask = 0;
|
||||
}
|
||||
StopTask();
|
||||
|
||||
m_primaryTask = new CTaskManager(m_object);
|
||||
err = m_primaryTask->StartTaskTerraform();
|
||||
Error err = m_primaryTask->StartTaskTerraform();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
||||
// Change pencil.
|
||||
|
||||
Error CBrain::StartTaskPen(bool bDown, int color)
|
||||
Error CBrain::StartTaskPen(bool down, int color)
|
||||
{
|
||||
Error err;
|
||||
|
||||
m_physics->SetMotorSpeedX(0.0f);
|
||||
m_physics->SetMotorSpeedY(0.0f);
|
||||
m_physics->SetMotorSpeedZ(0.0f);
|
||||
|
||||
if ( m_primaryTask != 0 )
|
||||
{
|
||||
delete m_primaryTask; // stops the current task
|
||||
m_primaryTask = 0;
|
||||
}
|
||||
StopTask();
|
||||
|
||||
m_primaryTask = new CTaskManager(m_object);
|
||||
err = m_primaryTask->StartTaskPen(bDown, color);
|
||||
Error err = m_primaryTask->StartTaskPen(down, color);
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
@ -1030,16 +1000,10 @@ Error CBrain::StartTaskPen(bool bDown, int color)
|
|||
|
||||
Error CBrain::StartTaskRecover()
|
||||
{
|
||||
Error err;
|
||||
|
||||
if ( m_primaryTask != 0 )
|
||||
{
|
||||
delete m_primaryTask; // stops the current task
|
||||
m_primaryTask = 0;
|
||||
}
|
||||
StopTask();
|
||||
|
||||
m_primaryTask = new CTaskManager(m_object);
|
||||
err = m_primaryTask->StartTaskRecover();
|
||||
Error err = m_primaryTask->StartTaskRecover();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
@ -1048,16 +1012,10 @@ Error CBrain::StartTaskRecover()
|
|||
|
||||
Error CBrain::StartTaskShield(TaskShieldMode mode)
|
||||
{
|
||||
Error err;
|
||||
|
||||
if ( m_secondaryTask != 0 )
|
||||
{
|
||||
delete m_secondaryTask; // stops the current task
|
||||
m_secondaryTask = 0;
|
||||
}
|
||||
StopSecondaryTask();
|
||||
|
||||
m_secondaryTask = new CTaskManager(m_object);
|
||||
err = m_secondaryTask->StartTaskShield(mode, 1000.0f);
|
||||
Error err = m_secondaryTask->StartTaskShield(mode, 1000.0f);
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
@ -1066,16 +1024,10 @@ Error CBrain::StartTaskShield(TaskShieldMode mode)
|
|||
|
||||
Error CBrain::StartTaskFire(float delay)
|
||||
{
|
||||
Error err;
|
||||
|
||||
if ( m_primaryTask != 0 )
|
||||
{
|
||||
delete m_primaryTask; // stops the current task
|
||||
m_primaryTask = 0;
|
||||
}
|
||||
StopTask();
|
||||
|
||||
m_primaryTask = new CTaskManager(m_object);
|
||||
err = m_primaryTask->StartTaskFire(delay);
|
||||
Error err = m_primaryTask->StartTaskFire(delay);
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
@ -1084,16 +1036,10 @@ Error CBrain::StartTaskFire(float delay)
|
|||
|
||||
Error CBrain::StartTaskSpiderExplo()
|
||||
{
|
||||
Error err;
|
||||
|
||||
if ( m_primaryTask != 0 )
|
||||
{
|
||||
delete m_primaryTask; // stops the current task
|
||||
m_primaryTask = 0;
|
||||
}
|
||||
StopTask();
|
||||
|
||||
m_primaryTask = new CTaskManager(m_object);
|
||||
err = m_primaryTask->StartTaskSpiderExplo();
|
||||
Error err = m_primaryTask->StartTaskSpiderExplo();
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
@ -1102,16 +1048,10 @@ Error CBrain::StartTaskSpiderExplo()
|
|||
|
||||
Error CBrain::StartTaskFireAnt(Math::Vector impact)
|
||||
{
|
||||
Error err;
|
||||
|
||||
if ( m_primaryTask != 0 )
|
||||
{
|
||||
delete m_primaryTask; // stops the current task
|
||||
m_primaryTask = 0;
|
||||
}
|
||||
StopTask();
|
||||
|
||||
m_primaryTask = new CTaskManager(m_object);
|
||||
err = m_primaryTask->StartTaskFireAnt(impact);
|
||||
Error err = m_primaryTask->StartTaskFireAnt(impact);
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
@ -1120,16 +1060,10 @@ Error CBrain::StartTaskFireAnt(Math::Vector impact)
|
|||
|
||||
Error CBrain::StartTaskGunGoal(float dirV, float dirH)
|
||||
{
|
||||
Error err;
|
||||
|
||||
if ( m_secondaryTask != 0 )
|
||||
{
|
||||
delete m_secondaryTask; // stops the current task
|
||||
m_secondaryTask = 0;
|
||||
}
|
||||
StopSecondaryTask();
|
||||
|
||||
m_secondaryTask = new CTaskManager(m_object);
|
||||
err = m_secondaryTask->StartTaskGunGoal(dirV, dirH);
|
||||
Error err = m_secondaryTask->StartTaskGunGoal(dirV, dirH);
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
@ -1138,16 +1072,10 @@ Error CBrain::StartTaskGunGoal(float dirV, float dirH)
|
|||
|
||||
Error CBrain::StartTaskReset(Math::Vector goal, Math::Vector angle)
|
||||
{
|
||||
Error err;
|
||||
|
||||
if ( m_primaryTask != 0 )
|
||||
{
|
||||
delete m_primaryTask; // stops the current task
|
||||
m_primaryTask = 0;
|
||||
}
|
||||
StopTask();
|
||||
|
||||
m_primaryTask = new CTaskManager(m_object);
|
||||
err = m_primaryTask->StartTaskReset(goal, angle);
|
||||
Error err = m_primaryTask->StartTaskReset(goal, angle);
|
||||
UpdateInterface();
|
||||
return err;
|
||||
}
|
||||
|
@ -1156,30 +1084,29 @@ Error CBrain::StartTaskReset(Math::Vector goal, Math::Vector angle)
|
|||
|
||||
Error CBrain::EndedTask()
|
||||
{
|
||||
Error err;
|
||||
|
||||
if ( m_secondaryTask != 0 ) // current task?
|
||||
if (m_secondaryTask != nullptr) // current task?
|
||||
{
|
||||
err = m_secondaryTask->IsEnded();
|
||||
Error err = m_secondaryTask->IsEnded();
|
||||
if ( err != ERR_CONTINUE ) // job ended?
|
||||
{
|
||||
delete m_secondaryTask;
|
||||
m_secondaryTask = 0;
|
||||
m_secondaryTask = nullptr;
|
||||
UpdateInterface();
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_primaryTask != 0 ) // current task?
|
||||
if (m_primaryTask != nullptr) // current task?
|
||||
{
|
||||
err = m_primaryTask->IsEnded();
|
||||
Error err = m_primaryTask->IsEnded();
|
||||
if ( err != ERR_CONTINUE ) // job ended?
|
||||
{
|
||||
delete m_primaryTask;
|
||||
m_primaryTask = 0;
|
||||
m_primaryTask = nullptr;
|
||||
UpdateInterface();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
return ERR_STOP;
|
||||
}
|
||||
|
||||
|
|
|
@ -102,6 +102,7 @@ public:
|
|||
int GetProgram();
|
||||
void StopProgram();
|
||||
void StopTask();
|
||||
void StopSecondaryTask();
|
||||
|
||||
bool IntroduceVirus();
|
||||
void SetActiveVirus(bool bActive);
|
||||
|
@ -128,7 +129,7 @@ public:
|
|||
Error StartTaskBuild(ObjectType type);
|
||||
Error StartTaskSearch();
|
||||
Error StartTaskTerraform();
|
||||
Error StartTaskPen(bool bDown, int color);
|
||||
Error StartTaskPen(bool down, int color);
|
||||
Error StartTaskRecover();
|
||||
Error StartTaskShield(TaskShieldMode mode);
|
||||
Error StartTaskFire(float delay);
|
||||
|
|
|
@ -717,11 +717,11 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
|
|||
|
||||
if (loadProfile)
|
||||
{
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "FontSize", fValue)) m_fontSize = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "WindowPosX", fValue)) m_windowPos.x = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "WindowPosY", fValue)) m_windowPos.y = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "WindowDimX", fValue)) m_windowDim.x = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "WindowDimY", fValue)) m_windowDim.y = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "FontSize", fValue)) m_fontSize = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "WindowPosX", fValue)) m_windowPos.x = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "WindowPosY", fValue)) m_windowPos.y = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "WindowDimX", fValue)) m_windowDim.x = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "WindowDimY", fValue)) m_windowDim.y = fValue;
|
||||
}
|
||||
|
||||
m_IOPublic = false;
|
||||
|
@ -731,11 +731,11 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
|
|||
|
||||
if (loadProfile)
|
||||
{
|
||||
if (GetProfile().GetLocalProfileInt ("Edit", "IOPublic", iValue)) m_IOPublic = iValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "IOPosX", fValue)) m_IOPos.x = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "IOPosY", fValue)) m_IOPos.y = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "IODimX", fValue)) m_IODim.x = fValue;
|
||||
if (GetProfile().GetLocalProfileFloat("Edit", "IODimY", fValue)) m_IODim.y = fValue;
|
||||
if (GetProfile().GetIntProperty ("Edit", "IOPublic", iValue)) m_IOPublic = iValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "IOPosX", fValue)) m_IOPos.x = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "IOPosY", fValue)) m_IOPos.y = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "IODimX", fValue)) m_IODim.x = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "IODimY", fValue)) m_IODim.y = fValue;
|
||||
}
|
||||
|
||||
m_short->FlushShortcuts();
|
||||
|
@ -753,7 +753,7 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
|
|||
g_unit = UNIT;
|
||||
|
||||
m_gamerName = "";
|
||||
if (loadProfile) GetProfile().GetLocalProfileString("Gamer", "LastName", m_gamerName);
|
||||
if (loadProfile) GetProfile().GetStringProperty("Gamer", "LastName", m_gamerName);
|
||||
SetGlobalGamerName(m_gamerName);
|
||||
ReadFreeParam();
|
||||
if (loadProfile) m_dialog->SetupRecall();
|
||||
|
@ -962,18 +962,18 @@ void CRobotMain::CreateIni()
|
|||
{
|
||||
m_dialog->SetupMemorize();
|
||||
|
||||
GetProfile().SetLocalProfileFloat("Edit", "FontSize", m_fontSize);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "WindowPosX", m_windowPos.x);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "WindowPosY", m_windowPos.y);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "WindowDimX", m_windowDim.x);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "WindowDimY", m_windowDim.y);
|
||||
GetProfile().SetLocalProfileInt("Edit", "IOPublic", m_IOPublic);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "IOPosX", m_IOPos.x);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "IOPosY", m_IOPos.y);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "IODimX", m_IODim.x);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "IODimY", m_IODim.y);
|
||||
GetProfile().SetFloatProperty("Edit", "FontSize", m_fontSize);
|
||||
GetProfile().SetFloatProperty("Edit", "WindowPosX", m_windowPos.x);
|
||||
GetProfile().SetFloatProperty("Edit", "WindowPosY", m_windowPos.y);
|
||||
GetProfile().SetFloatProperty("Edit", "WindowDimX", m_windowDim.x);
|
||||
GetProfile().SetFloatProperty("Edit", "WindowDimY", m_windowDim.y);
|
||||
GetProfile().SetIntProperty("Edit", "IOPublic", m_IOPublic);
|
||||
GetProfile().SetFloatProperty("Edit", "IOPosX", m_IOPos.x);
|
||||
GetProfile().SetFloatProperty("Edit", "IOPosY", m_IOPos.y);
|
||||
GetProfile().SetFloatProperty("Edit", "IODimX", m_IODim.x);
|
||||
GetProfile().SetFloatProperty("Edit", "IODimY", m_IODim.y);
|
||||
|
||||
GetProfile().SaveCurrentDirectory();
|
||||
GetProfile().Save();
|
||||
}
|
||||
|
||||
void CRobotMain::SetDefaultInputBindings()
|
||||
|
@ -2279,7 +2279,7 @@ float CRobotMain::GetGameTime()
|
|||
void CRobotMain::SetFontSize(float size)
|
||||
{
|
||||
m_fontSize = size;
|
||||
GetProfile().SetLocalProfileFloat("Edit", "FontSize", m_fontSize);
|
||||
GetProfile().SetFloatProperty("Edit", "FontSize", m_fontSize);
|
||||
}
|
||||
|
||||
float CRobotMain::GetFontSize()
|
||||
|
@ -2291,8 +2291,8 @@ float CRobotMain::GetFontSize()
|
|||
void CRobotMain::SetWindowPos(Math::Point pos)
|
||||
{
|
||||
m_windowPos = pos;
|
||||
GetProfile().SetLocalProfileFloat("Edit", "WindowPosX", m_windowPos.x);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "WindowPosY", m_windowPos.y);
|
||||
GetProfile().SetFloatProperty("Edit", "WindowPosX", m_windowPos.x);
|
||||
GetProfile().SetFloatProperty("Edit", "WindowPosY", m_windowPos.y);
|
||||
}
|
||||
|
||||
Math::Point CRobotMain::GetWindowPos()
|
||||
|
@ -2303,8 +2303,8 @@ Math::Point CRobotMain::GetWindowPos()
|
|||
void CRobotMain::SetWindowDim(Math::Point dim)
|
||||
{
|
||||
m_windowDim = dim;
|
||||
GetProfile().SetLocalProfileFloat("Edit", "WindowDimX", m_windowDim.x);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "WindowDimY", m_windowDim.y);
|
||||
GetProfile().SetFloatProperty("Edit", "WindowDimX", m_windowDim.x);
|
||||
GetProfile().SetFloatProperty("Edit", "WindowDimY", m_windowDim.y);
|
||||
}
|
||||
|
||||
Math::Point CRobotMain::GetWindowDim()
|
||||
|
@ -2317,7 +2317,7 @@ Math::Point CRobotMain::GetWindowDim()
|
|||
void CRobotMain::SetIOPublic(bool mode)
|
||||
{
|
||||
m_IOPublic = mode;
|
||||
GetProfile().SetLocalProfileInt("Edit", "IOPublic", m_IOPublic);
|
||||
GetProfile().SetIntProperty("Edit", "IOPublic", m_IOPublic);
|
||||
}
|
||||
|
||||
bool CRobotMain::GetIOPublic()
|
||||
|
@ -2328,8 +2328,8 @@ bool CRobotMain::GetIOPublic()
|
|||
void CRobotMain::SetIOPos(Math::Point pos)
|
||||
{
|
||||
m_IOPos = pos;
|
||||
GetProfile().SetLocalProfileFloat("Edit", "IOPosX", m_IOPos.x);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "IOPosY", m_IOPos.y);
|
||||
GetProfile().SetFloatProperty("Edit", "IOPosX", m_IOPos.x);
|
||||
GetProfile().SetFloatProperty("Edit", "IOPosY", m_IOPos.y);
|
||||
}
|
||||
|
||||
Math::Point CRobotMain::GetIOPos()
|
||||
|
@ -2340,8 +2340,8 @@ Math::Point CRobotMain::GetIOPos()
|
|||
void CRobotMain::SetIODim(Math::Point dim)
|
||||
{
|
||||
m_IODim = dim;
|
||||
GetProfile().SetLocalProfileFloat("Edit", "IODimX", m_IODim.x);
|
||||
GetProfile().SetLocalProfileFloat("Edit", "IODimY", m_IODim.y);
|
||||
GetProfile().SetFloatProperty("Edit", "IODimX", m_IODim.x);
|
||||
GetProfile().SetFloatProperty("Edit", "IODimY", m_IODim.y);
|
||||
}
|
||||
|
||||
Math::Point CRobotMain::GetIODim()
|
||||
|
@ -3624,199 +3624,6 @@ char* SkipNum(char *p)
|
|||
return p;
|
||||
}
|
||||
|
||||
//! Conversion of units
|
||||
void CRobotMain::Convert()
|
||||
{
|
||||
char* base = m_dialog->GetSceneName();
|
||||
int rank = m_dialog->GetSceneRank();
|
||||
|
||||
//TODO change line to string
|
||||
char line[500];
|
||||
std::string tempLine;
|
||||
|
||||
m_dialog->BuildSceneName(tempLine, base, rank);
|
||||
strcpy(line, tempLine.c_str());
|
||||
FILE* file = fopen(line, "r");
|
||||
if (file == NULL) return;
|
||||
|
||||
strcpy(line+strlen(line)-4, ".new");
|
||||
FILE* fileNew = fopen(line, "w");
|
||||
if (fileNew == NULL) return;
|
||||
|
||||
char lineNew[500];
|
||||
char s[200];
|
||||
|
||||
while (fgets(line, 500, file) != NULL)
|
||||
{
|
||||
strcpy(lineNew, line);
|
||||
|
||||
if (Cmd(line, "DeepView"))
|
||||
{
|
||||
char* p = strstr(line, "air=");
|
||||
if (p != 0)
|
||||
{
|
||||
float value = OpFloat(line, "air", 500.0f);
|
||||
value /= g_unit;
|
||||
p[0] = 0;
|
||||
p = SkipNum(p+4);
|
||||
strcpy(lineNew, line);
|
||||
strcat(lineNew, "air=");
|
||||
sprintf(s, "%.2f", value);
|
||||
strcat(lineNew, s);
|
||||
strcat(lineNew, " ");
|
||||
strcat(lineNew, p);
|
||||
}
|
||||
strcpy(line, lineNew);
|
||||
|
||||
p = strstr(line, "water=");
|
||||
if (p != 0)
|
||||
{
|
||||
float value = OpFloat(line, "water", 100.0f);
|
||||
value /= g_unit;
|
||||
p[0] = 0;
|
||||
p = SkipNum(p+6);
|
||||
strcpy(lineNew, line);
|
||||
strcat(lineNew, "water=");
|
||||
sprintf(s, "%.2f", value);
|
||||
strcat(lineNew, s);
|
||||
strcat(lineNew, " ");
|
||||
strcat(lineNew, p);
|
||||
}
|
||||
strcpy(line, lineNew);
|
||||
}
|
||||
|
||||
if (Cmd(line, "TerrainGenerate"))
|
||||
{
|
||||
char* p = strstr(line, "vision=");
|
||||
if (p != 0)
|
||||
{
|
||||
float value = OpFloat(line, "vision", 500.0f);
|
||||
value /= g_unit;
|
||||
p[0] = 0;
|
||||
p = SkipNum(p+7);
|
||||
strcpy(lineNew, line);
|
||||
strcat(lineNew, "vision=");
|
||||
sprintf(s, "%.2f", value);
|
||||
strcat(lineNew, s);
|
||||
strcat(lineNew, " ");
|
||||
strcat(lineNew, p);
|
||||
}
|
||||
}
|
||||
|
||||
if (Cmd(line, "CreateObject") ||
|
||||
Cmd(line, "CreateSpot"))
|
||||
{
|
||||
char* p = strstr(line, "pos=");
|
||||
if (p != 0)
|
||||
{
|
||||
Math::Vector pos = OpPos(line, "pos");
|
||||
pos.x /= g_unit;
|
||||
pos.y /= g_unit;
|
||||
pos.z /= g_unit;
|
||||
p[0] = 0;
|
||||
p = SkipNum(p+4);
|
||||
p = SkipNum(p+1);
|
||||
strcpy(lineNew, line);
|
||||
strcat(lineNew, "pos=");
|
||||
sprintf(s, "%.2f", pos.x);
|
||||
strcat(lineNew, s);
|
||||
strcat(lineNew, ";");
|
||||
sprintf(s, "%.2f", pos.z);
|
||||
strcat(lineNew, s);
|
||||
strcat(lineNew, " ");
|
||||
strcat(lineNew, p);
|
||||
}
|
||||
}
|
||||
|
||||
if (Cmd(line, "EndMissionTake") || Cmd(line, "AudioChange"))
|
||||
{
|
||||
char* p = strstr(line, "pos=");
|
||||
if (p != 0)
|
||||
{
|
||||
Math::Vector pos = OpPos(line, "pos");
|
||||
pos.x /= g_unit;
|
||||
pos.y /= g_unit;
|
||||
pos.z /= g_unit;
|
||||
p[0] = 0;
|
||||
p = SkipNum(p+4);
|
||||
p = SkipNum(p+1);
|
||||
strcpy(lineNew, line);
|
||||
strcat(lineNew, "pos=");
|
||||
sprintf(s, "%.2f", pos.x);
|
||||
strcat(lineNew, s);
|
||||
strcat(lineNew, ";");
|
||||
sprintf(s, "%.2f", pos.z);
|
||||
strcat(lineNew, s);
|
||||
strcat(lineNew, " ");
|
||||
strcat(lineNew, p);
|
||||
}
|
||||
strcpy(line, lineNew);
|
||||
|
||||
p = strstr(line, "dist=");
|
||||
if (p != 0)
|
||||
{
|
||||
float value = OpFloat(line, "dist", 32.0f);
|
||||
value /= g_unit;
|
||||
p[0] = 0;
|
||||
p = SkipNum(p+5);
|
||||
strcpy(lineNew, line);
|
||||
strcat(lineNew, "dist=");
|
||||
sprintf(s, "%.2f", value);
|
||||
strcat(lineNew, s);
|
||||
strcat(lineNew, " ");
|
||||
strcat(lineNew, p);
|
||||
}
|
||||
strcpy(line, lineNew);
|
||||
}
|
||||
|
||||
if (Cmd(line, "Camera"))
|
||||
{
|
||||
char* p = strstr(line, "pos=");
|
||||
if (p != 0)
|
||||
{
|
||||
Math::Vector pos = OpPos(line, "pos");
|
||||
pos.x /= g_unit;
|
||||
pos.y /= g_unit;
|
||||
pos.z /= g_unit;
|
||||
p[0] = 0;
|
||||
p = SkipNum(p+4);
|
||||
p = SkipNum(p+1);
|
||||
strcpy(lineNew, line);
|
||||
strcat(lineNew, "pos=");
|
||||
sprintf(s, "%.2f", pos.x);
|
||||
strcat(lineNew, s);
|
||||
strcat(lineNew, ";");
|
||||
sprintf(s, "%.2f", pos.z);
|
||||
strcat(lineNew, s);
|
||||
strcat(lineNew, " ");
|
||||
strcat(lineNew, p);
|
||||
}
|
||||
strcpy(line, lineNew);
|
||||
|
||||
p = strstr(line, "h=");
|
||||
if (p != 0)
|
||||
{
|
||||
float value = OpFloat(line, "h", 32.0f);
|
||||
value /= g_unit;
|
||||
p[0] = 0;
|
||||
p = SkipNum(p+2);
|
||||
strcpy(lineNew, line);
|
||||
strcat(lineNew, "h=");
|
||||
sprintf(s, "%.2f", value);
|
||||
strcat(lineNew, s);
|
||||
strcat(lineNew, " ");
|
||||
strcat(lineNew, p);
|
||||
}
|
||||
strcpy(line, lineNew);
|
||||
}
|
||||
|
||||
fputs(lineNew, fileNew);
|
||||
}
|
||||
|
||||
fclose(fileNew);
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
//! Load the scene for the character
|
||||
void CRobotMain::ScenePerso()
|
||||
{
|
||||
|
|
|
@ -397,7 +397,6 @@ protected:
|
|||
bool EventObject(const Event &event);
|
||||
void InitEye();
|
||||
|
||||
void Convert();
|
||||
void CreateScene(bool soluce, bool fixScene, bool resetObject);
|
||||
|
||||
Math::Vector LookatPoint(Math::Vector eye, float angleH, float angleV, float length);
|
||||
|
|
|
@ -56,20 +56,14 @@ void ALSound::CleanUp()
|
|||
delete channel.second;
|
||||
}
|
||||
|
||||
if (m_currentMusic)
|
||||
{
|
||||
delete m_currentMusic;
|
||||
}
|
||||
|
||||
delete m_currentMusic;
|
||||
|
||||
for (auto item : m_oldMusic)
|
||||
{
|
||||
delete item.music;
|
||||
}
|
||||
|
||||
if (m_previousMusic.music)
|
||||
{
|
||||
delete m_previousMusic.music;
|
||||
}
|
||||
|
||||
delete m_previousMusic.music;
|
||||
|
||||
for (auto item : m_sounds)
|
||||
{
|
||||
|
|
|
@ -122,21 +122,16 @@ CEdit::CEdit () : CControl ()
|
|||
|
||||
CEdit::~CEdit()
|
||||
{
|
||||
int i;
|
||||
|
||||
FreeImage();
|
||||
|
||||
for ( i=0 ; i<EDITUNDOMAX ; i++ )
|
||||
for (int i = 0; i < EDITUNDOMAX; i++)
|
||||
{
|
||||
delete m_undo[i].text;
|
||||
m_undo[i].text = nullptr;
|
||||
}
|
||||
|
||||
if (m_text != nullptr)
|
||||
{
|
||||
delete[] m_text;
|
||||
m_text = nullptr;
|
||||
}
|
||||
delete[] m_text;
|
||||
m_text = nullptr;
|
||||
|
||||
delete m_scroll;
|
||||
m_scroll = nullptr;
|
||||
|
@ -380,23 +375,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;
|
||||
|
@ -1473,8 +1468,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);
|
||||
|
@ -1957,8 +1951,7 @@ void CEdit::SetMaxChar(int max)
|
|||
{
|
||||
FreeImage();
|
||||
|
||||
if (m_text != nullptr)
|
||||
delete[] m_text;
|
||||
delete[] m_text;
|
||||
|
||||
m_maxChar = max;
|
||||
|
||||
|
|
|
@ -49,11 +49,8 @@ void CInterface::Flush()
|
|||
{
|
||||
for (int i = 0; i < MAXCONTROL; i++)
|
||||
{
|
||||
if (m_table[i] != nullptr)
|
||||
{
|
||||
delete m_table[i];
|
||||
m_table[i] = nullptr;
|
||||
}
|
||||
delete m_table[i];
|
||||
m_table[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3510,7 +3510,7 @@ void CMainDialog::NameSelect()
|
|||
|
||||
GetGamerFace(m_main->GetGamerName());
|
||||
|
||||
GetProfile().SetLocalProfileString("Gamer", "LastName", m_main->GetGamerName());
|
||||
GetProfile().SetStringProperty("Gamer", "LastName", m_main->GetGamerName());
|
||||
}
|
||||
|
||||
// Creates a new player.
|
||||
|
@ -5074,44 +5074,44 @@ void CMainDialog::ChangeSetupButtons()
|
|||
|
||||
void CMainDialog::SetupMemorize()
|
||||
{
|
||||
GetProfile().SetLocalProfileString("Directory", "savegame", m_savegameDir);
|
||||
GetProfile().SetLocalProfileString("Directory", "public", m_publicDir);
|
||||
GetProfile().SetLocalProfileString("Directory", "files", m_filesDir);
|
||||
GetProfile().SetLocalProfileInt("Setup", "Tooltips", m_bTooltip);
|
||||
GetProfile().SetLocalProfileInt("Setup", "InterfaceGlint", m_bGlint);
|
||||
GetProfile().SetLocalProfileInt("Setup", "InterfaceGlint", m_bRain);
|
||||
GetProfile().SetLocalProfileInt("Setup", "Soluce4", m_bSoluce4);
|
||||
GetProfile().SetLocalProfileInt("Setup", "Movies", m_bMovies);
|
||||
GetProfile().SetLocalProfileInt("Setup", "NiceReset", m_bNiceReset);
|
||||
GetProfile().SetLocalProfileInt("Setup", "HimselfDamage", m_bHimselfDamage);
|
||||
GetProfile().SetLocalProfileInt("Setup", "CameraScroll", m_bCameraScroll);
|
||||
GetProfile().SetLocalProfileInt("Setup", "CameraInvertX", m_bCameraInvertX);
|
||||
GetProfile().SetLocalProfileInt("Setup", "CameraInvertY", m_bCameraInvertY);
|
||||
GetProfile().SetLocalProfileInt("Setup", "InterfaceEffect", m_bEffect);
|
||||
GetProfile().SetLocalProfileInt("Setup", "GroundShadow", m_engine->GetShadow());
|
||||
GetProfile().SetLocalProfileInt("Setup", "GroundSpot", m_engine->GetGroundSpot());
|
||||
GetProfile().SetLocalProfileInt("Setup", "ObjectDirty", m_engine->GetDirty());
|
||||
GetProfile().SetLocalProfileInt("Setup", "FogMode", m_engine->GetFog());
|
||||
GetProfile().SetLocalProfileInt("Setup", "LensMode", m_engine->GetLensMode());
|
||||
GetProfile().SetLocalProfileInt("Setup", "SkyMode", m_engine->GetSkyMode());
|
||||
GetProfile().SetLocalProfileInt("Setup", "PlanetMode", m_engine->GetPlanetMode());
|
||||
GetProfile().SetLocalProfileInt("Setup", "LightMode", m_engine->GetLightMode());
|
||||
GetProfile().SetLocalProfileFloat("Setup", "ParticleDensity", m_engine->GetParticleDensity());
|
||||
GetProfile().SetLocalProfileFloat("Setup", "ClippingDistance", m_engine->GetClippingDistance());
|
||||
GetProfile().SetLocalProfileFloat("Setup", "ObjectDetail", m_engine->GetObjectDetail());
|
||||
GetProfile().SetLocalProfileFloat("Setup", "GadgetQuantity", m_engine->GetGadgetQuantity());
|
||||
GetProfile().SetLocalProfileInt("Setup", "TextureQuality", m_engine->GetTextureQuality());
|
||||
GetProfile().SetLocalProfileInt("Setup", "TotoMode", m_engine->GetTotoMode());
|
||||
GetProfile().SetLocalProfileInt("Setup", "AudioVolume", m_sound->GetAudioVolume());
|
||||
GetProfile().SetLocalProfileInt("Setup", "MusicVolume", m_sound->GetMusicVolume());
|
||||
GetProfile().SetLocalProfileInt("Setup", "EditIndentMode", m_engine->GetEditIndentMode());
|
||||
GetProfile().SetLocalProfileInt("Setup", "EditIndentValue", m_engine->GetEditIndentValue());
|
||||
GetProfile().SetStringProperty("Directory", "savegame", m_savegameDir);
|
||||
GetProfile().SetStringProperty("Directory", "public", m_publicDir);
|
||||
GetProfile().SetStringProperty("Directory", "files", m_filesDir);
|
||||
GetProfile().SetIntProperty("Setup", "Tooltips", m_bTooltip);
|
||||
GetProfile().SetIntProperty("Setup", "InterfaceGlint", m_bGlint);
|
||||
GetProfile().SetIntProperty("Setup", "InterfaceGlint", m_bRain);
|
||||
GetProfile().SetIntProperty("Setup", "Soluce4", m_bSoluce4);
|
||||
GetProfile().SetIntProperty("Setup", "Movies", m_bMovies);
|
||||
GetProfile().SetIntProperty("Setup", "NiceReset", m_bNiceReset);
|
||||
GetProfile().SetIntProperty("Setup", "HimselfDamage", m_bHimselfDamage);
|
||||
GetProfile().SetIntProperty("Setup", "CameraScroll", m_bCameraScroll);
|
||||
GetProfile().SetIntProperty("Setup", "CameraInvertX", m_bCameraInvertX);
|
||||
GetProfile().SetIntProperty("Setup", "CameraInvertY", m_bCameraInvertY);
|
||||
GetProfile().SetIntProperty("Setup", "InterfaceEffect", m_bEffect);
|
||||
GetProfile().SetIntProperty("Setup", "GroundShadow", m_engine->GetShadow());
|
||||
GetProfile().SetIntProperty("Setup", "GroundSpot", m_engine->GetGroundSpot());
|
||||
GetProfile().SetIntProperty("Setup", "ObjectDirty", m_engine->GetDirty());
|
||||
GetProfile().SetIntProperty("Setup", "FogMode", m_engine->GetFog());
|
||||
GetProfile().SetIntProperty("Setup", "LensMode", m_engine->GetLensMode());
|
||||
GetProfile().SetIntProperty("Setup", "SkyMode", m_engine->GetSkyMode());
|
||||
GetProfile().SetIntProperty("Setup", "PlanetMode", m_engine->GetPlanetMode());
|
||||
GetProfile().SetIntProperty("Setup", "LightMode", m_engine->GetLightMode());
|
||||
GetProfile().SetFloatProperty("Setup", "ParticleDensity", m_engine->GetParticleDensity());
|
||||
GetProfile().SetFloatProperty("Setup", "ClippingDistance", m_engine->GetClippingDistance());
|
||||
GetProfile().SetFloatProperty("Setup", "ObjectDetail", m_engine->GetObjectDetail());
|
||||
GetProfile().SetFloatProperty("Setup", "GadgetQuantity", m_engine->GetGadgetQuantity());
|
||||
GetProfile().SetIntProperty("Setup", "TextureQuality", m_engine->GetTextureQuality());
|
||||
GetProfile().SetIntProperty("Setup", "TotoMode", m_engine->GetTotoMode());
|
||||
GetProfile().SetIntProperty("Setup", "AudioVolume", m_sound->GetAudioVolume());
|
||||
GetProfile().SetIntProperty("Setup", "MusicVolume", m_sound->GetMusicVolume());
|
||||
GetProfile().SetIntProperty("Setup", "EditIndentMode", m_engine->GetEditIndentMode());
|
||||
GetProfile().SetIntProperty("Setup", "EditIndentValue", m_engine->GetEditIndentValue());
|
||||
|
||||
/* screen setup */
|
||||
if (m_setupFull)
|
||||
GetProfile().SetLocalProfileInt("Setup", "Fullscreen", 1);
|
||||
GetProfile().SetIntProperty("Setup", "Fullscreen", 1);
|
||||
else
|
||||
GetProfile().SetLocalProfileInt("Setup", "Fullscreen", 0);
|
||||
GetProfile().SetIntProperty("Setup", "Fullscreen", 0);
|
||||
|
||||
CList *pl;
|
||||
CWindow *pw;
|
||||
|
@ -5121,7 +5121,7 @@ void CMainDialog::SetupMemorize()
|
|||
pl = static_cast<CList *>(pw->SearchControl(EVENT_LIST2));
|
||||
if ( pl != 0 )
|
||||
{
|
||||
GetProfile().SetLocalProfileInt("Setup", "Resolution", pl->GetSelect());
|
||||
GetProfile().SetIntProperty("Setup", "Resolution", pl->GetSelect());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -5138,9 +5138,9 @@ void CMainDialog::SetupMemorize()
|
|||
key << b.secondary << " ";
|
||||
}
|
||||
|
||||
GetProfile().SetLocalProfileString("Setup", "KeyMap", key.str());
|
||||
GetProfile().SetStringProperty("Setup", "KeyMap", key.str());
|
||||
|
||||
GetProfile().SetLocalProfileInt("Setup", "DeleteGamer", m_bDeleteGamer);
|
||||
GetProfile().SetIntProperty("Setup", "DeleteGamer", m_bDeleteGamer);
|
||||
}
|
||||
|
||||
// Remember all the settings.
|
||||
|
@ -5151,38 +5151,38 @@ void CMainDialog::SetupRecall()
|
|||
int iValue;
|
||||
std::string key;
|
||||
|
||||
if ( GetProfile().GetLocalProfileString("Directory", "savegame", key) )
|
||||
if ( GetProfile().GetStringProperty("Directory", "savegame", key) )
|
||||
{
|
||||
m_savegameDir = key;
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileString("Directory", "public", key) )
|
||||
if ( GetProfile().GetStringProperty("Directory", "public", key) )
|
||||
{
|
||||
m_publicDir = key;
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileString("Directory", "files", key) )
|
||||
if ( GetProfile().GetStringProperty("Directory", "files", key) )
|
||||
{
|
||||
m_filesDir = key;
|
||||
}
|
||||
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "TotoMode", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "TotoMode", iValue) )
|
||||
{
|
||||
m_engine->SetTotoMode(iValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "Tooltips", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "Tooltips", iValue) )
|
||||
{
|
||||
m_bTooltip = iValue;
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "InterfaceGlint", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "InterfaceGlint", iValue) )
|
||||
{
|
||||
m_bGlint = iValue;
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "InterfaceGlint", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "InterfaceGlint", iValue) )
|
||||
{
|
||||
m_bRain = iValue;
|
||||
}
|
||||
|
@ -5193,86 +5193,86 @@ void CMainDialog::SetupRecall()
|
|||
// m_engine->SetNiceMouse(iValue);
|
||||
// }
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "Soluce4", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "Soluce4", iValue) )
|
||||
{
|
||||
m_bSoluce4 = iValue;
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "Movies", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "Movies", iValue) )
|
||||
{
|
||||
m_bMovies = iValue;
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "NiceReset", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "NiceReset", iValue) )
|
||||
{
|
||||
m_bNiceReset = iValue;
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "HimselfDamage", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "HimselfDamage", iValue) )
|
||||
{
|
||||
m_bHimselfDamage = iValue;
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "CameraScroll", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "CameraScroll", iValue) )
|
||||
{
|
||||
m_bCameraScroll = iValue;
|
||||
m_camera->SetCameraScroll(m_bCameraScroll);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "CameraInvertX", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "CameraInvertX", iValue) )
|
||||
{
|
||||
m_bCameraInvertX = iValue;
|
||||
m_camera->SetCameraInvertX(m_bCameraInvertX);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "CameraInvertY", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "CameraInvertY", iValue) )
|
||||
{
|
||||
m_bCameraInvertY = iValue;
|
||||
m_camera->SetCameraInvertY(m_bCameraInvertY);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "InterfaceEffect", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "InterfaceEffect", iValue) )
|
||||
{
|
||||
m_bEffect = iValue;
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "GroundShadow", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "GroundShadow", iValue) )
|
||||
{
|
||||
m_engine->SetShadow(iValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "GroundSpot", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "GroundSpot", iValue) )
|
||||
{
|
||||
m_engine->SetGroundSpot(iValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "ObjectDirty", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "ObjectDirty", iValue) )
|
||||
{
|
||||
m_engine->SetDirty(iValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "FogMode", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "FogMode", iValue) )
|
||||
{
|
||||
m_engine->SetFog(iValue);
|
||||
m_camera->SetOverBaseColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)); // TODO: color ok?
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "LensMode", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "LensMode", iValue) )
|
||||
{
|
||||
m_engine->SetLensMode(iValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "SkyMode", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "SkyMode", iValue) )
|
||||
{
|
||||
m_engine->SetSkyMode(iValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "PlanetMode", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "PlanetMode", iValue) )
|
||||
{
|
||||
m_engine->SetPlanetMode(iValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "LightMode", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "LightMode", iValue) )
|
||||
{
|
||||
m_engine->SetLightMode(iValue);
|
||||
}
|
||||
|
@ -5282,52 +5282,52 @@ void CMainDialog::SetupRecall()
|
|||
// m_engine->SetJoystick(iValue);
|
||||
// }
|
||||
|
||||
if ( GetProfile().GetLocalProfileFloat("Setup", "ParticleDensity", fValue) )
|
||||
if ( GetProfile().GetFloatProperty("Setup", "ParticleDensity", fValue) )
|
||||
{
|
||||
m_engine->SetParticleDensity(fValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileFloat("Setup", "ClippingDistance", fValue) )
|
||||
if ( GetProfile().GetFloatProperty("Setup", "ClippingDistance", fValue) )
|
||||
{
|
||||
m_engine->SetClippingDistance(fValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileFloat("Setup", "ObjectDetail", fValue) )
|
||||
if ( GetProfile().GetFloatProperty("Setup", "ObjectDetail", fValue) )
|
||||
{
|
||||
m_engine->SetObjectDetail(fValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileFloat("Setup", "GadgetQuantity", fValue) )
|
||||
if ( GetProfile().GetFloatProperty("Setup", "GadgetQuantity", fValue) )
|
||||
{
|
||||
m_engine->SetGadgetQuantity(fValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "TextureQuality", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "TextureQuality", iValue) )
|
||||
{
|
||||
m_engine->SetTextureQuality(iValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "AudioVolume", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "AudioVolume", iValue) )
|
||||
{
|
||||
m_sound->SetAudioVolume(iValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "MusicVolume", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "MusicVolume", iValue) )
|
||||
{
|
||||
m_sound->SetMusicVolume(iValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "EditIndentMode", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "EditIndentMode", iValue) )
|
||||
{
|
||||
m_engine->SetEditIndentMode(iValue);
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "EditIndentValue", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "EditIndentValue", iValue) )
|
||||
{
|
||||
m_engine->SetEditIndentValue(iValue);
|
||||
}
|
||||
|
||||
if (GetProfile().GetLocalProfileString("Setup", "KeyMap", key))
|
||||
if (GetProfile().GetStringProperty("Setup", "KeyMap", key))
|
||||
{
|
||||
std::stringstream skey;
|
||||
skey.str(key);
|
||||
|
@ -5340,17 +5340,17 @@ void CMainDialog::SetupRecall()
|
|||
}
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "DeleteGamer", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "DeleteGamer", iValue) )
|
||||
{
|
||||
m_bDeleteGamer = iValue;
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "Resolution", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "Resolution", iValue) )
|
||||
{
|
||||
m_setupSelMode = iValue;
|
||||
}
|
||||
|
||||
if ( GetProfile().GetLocalProfileInt("Setup", "Fullscreen", iValue) )
|
||||
if ( GetProfile().GetIntProperty("Setup", "Fullscreen", iValue) )
|
||||
{
|
||||
m_setupFull = (iValue == 1);
|
||||
}
|
||||
|
|
|
@ -64,34 +64,20 @@ CWindow::~CWindow()
|
|||
|
||||
void CWindow::Flush()
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0 ; i<MAXWINDOW ; i++ )
|
||||
for (int i = 0 ; i < MAXWINDOW; i++)
|
||||
{
|
||||
if ( m_table[i] != 0 )
|
||||
{
|
||||
delete m_table[i];
|
||||
m_table[i] = 0;
|
||||
}
|
||||
delete m_table[i];
|
||||
m_table[i] = nullptr;
|
||||
}
|
||||
|
||||
if ( m_buttonReduce != 0 )
|
||||
{
|
||||
delete m_buttonReduce;
|
||||
m_buttonReduce = 0;
|
||||
}
|
||||
delete m_buttonReduce;
|
||||
m_buttonReduce = nullptr;
|
||||
|
||||
if ( m_buttonFull != 0 )
|
||||
{
|
||||
delete m_buttonFull;
|
||||
m_buttonFull = 0;
|
||||
}
|
||||
delete m_buttonFull;
|
||||
m_buttonFull = nullptr;
|
||||
|
||||
if ( m_buttonClose != 0 )
|
||||
{
|
||||
delete m_buttonClose;
|
||||
m_buttonClose = 0;
|
||||
}
|
||||
delete m_buttonClose;
|
||||
m_buttonClose = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -583,23 +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;
|
||||
|
||||
|
|
|
@ -1,169 +1,3 @@
|
|||
set(SRC_DIR ${colobot_SOURCE_DIR}/src)
|
||||
|
||||
# Additional libraries per platform
|
||||
if(MXE) # MXE requires special treatment
|
||||
set(PLATFORM_LIBS ${MXE_LIBS})
|
||||
elseif(PLATFORM_WINDOWS)
|
||||
# because it isn't included in standard linking libraries
|
||||
set(PLATFORM_LIBS "-lintl")
|
||||
elseif(PLATFORM_GNU)
|
||||
set(PLATFORM_LIBS "-lX11")
|
||||
elseif(PLATFORM_LINUX)
|
||||
# for clock_gettime
|
||||
set(PLATFORM_LIBS "-lrt -lX11")
|
||||
elseif(PLATFORM_MACOSX)
|
||||
find_library(LIBINTL_LIBRARY NAMES intl libintl )
|
||||
set(PLATFORM_LIBS ${LIBINTL_LIBRARY} ${X11_X11_LIB})
|
||||
endif()
|
||||
|
||||
|
||||
# Configure file
|
||||
configure_file(${SRC_DIR}/common/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/common/config.h)
|
||||
|
||||
# Code sources
|
||||
set(COLOBOT_SOURCES
|
||||
${SRC_DIR}/app/app.cpp
|
||||
${SRC_DIR}/app/pausemanager.cpp
|
||||
${SRC_DIR}/app/system.cpp
|
||||
${SRC_DIR}/app/${SYSTEM_CPP_MODULE}
|
||||
${SRC_DIR}/app/system_other.cpp
|
||||
${SRC_DIR}/common/event.cpp
|
||||
${SRC_DIR}/common/image.cpp
|
||||
${SRC_DIR}/common/iman.cpp
|
||||
${SRC_DIR}/common/logger.cpp
|
||||
${SRC_DIR}/common/misc.cpp
|
||||
${SRC_DIR}/common/profile.cpp
|
||||
${SRC_DIR}/common/restext.cpp
|
||||
${SRC_DIR}/common/stringutils.cpp
|
||||
${SRC_DIR}/graphics/core/color.cpp
|
||||
${SRC_DIR}/graphics/engine/camera.cpp
|
||||
${SRC_DIR}/graphics/engine/cloud.cpp
|
||||
${SRC_DIR}/graphics/engine/engine.cpp
|
||||
${SRC_DIR}/graphics/engine/lightman.cpp
|
||||
${SRC_DIR}/graphics/engine/lightning.cpp
|
||||
${SRC_DIR}/graphics/engine/modelfile.cpp
|
||||
${SRC_DIR}/graphics/engine/modelmanager.cpp
|
||||
${SRC_DIR}/graphics/engine/particle.cpp
|
||||
${SRC_DIR}/graphics/engine/planet.cpp
|
||||
${SRC_DIR}/graphics/engine/pyro.cpp
|
||||
${SRC_DIR}/graphics/engine/terrain.cpp
|
||||
${SRC_DIR}/graphics/engine/text.cpp
|
||||
${SRC_DIR}/graphics/engine/water.cpp
|
||||
${SRC_DIR}/graphics/opengl/gldevice.cpp
|
||||
${SRC_DIR}/object/auto/auto.cpp
|
||||
${SRC_DIR}/object/auto/autobase.cpp
|
||||
${SRC_DIR}/object/auto/autoconvert.cpp
|
||||
${SRC_DIR}/object/auto/autoderrick.cpp
|
||||
${SRC_DIR}/object/auto/autodestroyer.cpp
|
||||
${SRC_DIR}/object/auto/autoegg.cpp
|
||||
${SRC_DIR}/object/auto/autoenergy.cpp
|
||||
${SRC_DIR}/object/auto/autofactory.cpp
|
||||
${SRC_DIR}/object/auto/autoflag.cpp
|
||||
${SRC_DIR}/object/auto/autohuston.cpp
|
||||
${SRC_DIR}/object/auto/autoinfo.cpp
|
||||
${SRC_DIR}/object/auto/autojostle.cpp
|
||||
${SRC_DIR}/object/auto/autokid.cpp
|
||||
${SRC_DIR}/object/auto/autolabo.cpp
|
||||
${SRC_DIR}/object/auto/automush.cpp
|
||||
${SRC_DIR}/object/auto/autonest.cpp
|
||||
${SRC_DIR}/object/auto/autonuclear.cpp
|
||||
${SRC_DIR}/object/auto/autopara.cpp
|
||||
${SRC_DIR}/object/auto/autoportico.cpp
|
||||
${SRC_DIR}/object/auto/autoradar.cpp
|
||||
${SRC_DIR}/object/auto/autorepair.cpp
|
||||
${SRC_DIR}/object/auto/autoresearch.cpp
|
||||
${SRC_DIR}/object/auto/autoroot.cpp
|
||||
${SRC_DIR}/object/auto/autosafe.cpp
|
||||
${SRC_DIR}/object/auto/autostation.cpp
|
||||
${SRC_DIR}/object/auto/autotower.cpp
|
||||
${SRC_DIR}/object/brain.cpp
|
||||
${SRC_DIR}/object/mainmovie.cpp
|
||||
${SRC_DIR}/object/motion/motion.cpp
|
||||
${SRC_DIR}/object/motion/motionant.cpp
|
||||
${SRC_DIR}/object/motion/motionbee.cpp
|
||||
${SRC_DIR}/object/motion/motionhuman.cpp
|
||||
${SRC_DIR}/object/motion/motionmother.cpp
|
||||
${SRC_DIR}/object/motion/motionspider.cpp
|
||||
${SRC_DIR}/object/motion/motiontoto.cpp
|
||||
${SRC_DIR}/object/motion/motionvehicle.cpp
|
||||
${SRC_DIR}/object/motion/motionworm.cpp
|
||||
${SRC_DIR}/object/motion/motiondummy.cpp
|
||||
${SRC_DIR}/object/object.cpp
|
||||
${SRC_DIR}/object/objman.cpp
|
||||
${SRC_DIR}/object/robotmain.cpp
|
||||
${SRC_DIR}/object/task/task.cpp
|
||||
${SRC_DIR}/object/task/taskadvance.cpp
|
||||
${SRC_DIR}/object/task/taskbuild.cpp
|
||||
${SRC_DIR}/object/task/taskfire.cpp
|
||||
${SRC_DIR}/object/task/taskfireant.cpp
|
||||
${SRC_DIR}/object/task/taskflag.cpp
|
||||
${SRC_DIR}/object/task/taskgoto.cpp
|
||||
${SRC_DIR}/object/task/taskgungoal.cpp
|
||||
${SRC_DIR}/object/task/taskinfo.cpp
|
||||
${SRC_DIR}/object/task/taskmanager.cpp
|
||||
${SRC_DIR}/object/task/taskmanip.cpp
|
||||
${SRC_DIR}/object/task/taskpen.cpp
|
||||
${SRC_DIR}/object/task/taskrecover.cpp
|
||||
${SRC_DIR}/object/task/taskreset.cpp
|
||||
${SRC_DIR}/object/task/tasksearch.cpp
|
||||
${SRC_DIR}/object/task/taskshield.cpp
|
||||
${SRC_DIR}/object/task/taskspiderexplo.cpp
|
||||
${SRC_DIR}/object/task/tasktake.cpp
|
||||
${SRC_DIR}/object/task/taskterraform.cpp
|
||||
${SRC_DIR}/object/task/taskturn.cpp
|
||||
${SRC_DIR}/object/task/taskwait.cpp
|
||||
${SRC_DIR}/physics/physics.cpp
|
||||
${SRC_DIR}/script/cbottoken.cpp
|
||||
${SRC_DIR}/script/cmdtoken.cpp
|
||||
${SRC_DIR}/script/script.cpp
|
||||
${SRC_DIR}/sound/sound.cpp
|
||||
${SRC_DIR}/ui/button.cpp
|
||||
${SRC_DIR}/ui/check.cpp
|
||||
${SRC_DIR}/ui/color.cpp
|
||||
${SRC_DIR}/ui/compass.cpp
|
||||
${SRC_DIR}/ui/control.cpp
|
||||
${SRC_DIR}/ui/displayinfo.cpp
|
||||
${SRC_DIR}/ui/displaytext.cpp
|
||||
${SRC_DIR}/ui/edit.cpp
|
||||
${SRC_DIR}/ui/editvalue.cpp
|
||||
${SRC_DIR}/ui/gauge.cpp
|
||||
${SRC_DIR}/ui/group.cpp
|
||||
${SRC_DIR}/ui/image.cpp
|
||||
${SRC_DIR}/ui/interface.cpp
|
||||
${SRC_DIR}/ui/key.cpp
|
||||
${SRC_DIR}/ui/label.cpp
|
||||
${SRC_DIR}/ui/list.cpp
|
||||
${SRC_DIR}/ui/maindialog.cpp
|
||||
${SRC_DIR}/ui/mainmap.cpp
|
||||
${SRC_DIR}/ui/mainshort.cpp
|
||||
${SRC_DIR}/ui/map.cpp
|
||||
${SRC_DIR}/ui/scroll.cpp
|
||||
${SRC_DIR}/ui/shortcut.cpp
|
||||
${SRC_DIR}/ui/slider.cpp
|
||||
${SRC_DIR}/ui/studio.cpp
|
||||
${SRC_DIR}/ui/target.cpp
|
||||
${SRC_DIR}/ui/window.cpp
|
||||
)
|
||||
|
||||
set(OPENAL_SOURCES "")
|
||||
|
||||
if(OPENAL_SOUND)
|
||||
set(OPENAL_SOURCES
|
||||
${SRC_DIR}/sound/oalsound/alsound.cpp
|
||||
${SRC_DIR}/sound/oalsound/buffer.cpp
|
||||
${SRC_DIR}/sound/oalsound/channel.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
# Optional libraries
|
||||
set(OPTIONAL_LIBS "")
|
||||
|
||||
if(OPENAL_SOUND)
|
||||
set(OPTIONAL_LIBS ${OPENAL_LIBRARY})
|
||||
set(OPTIONAL_INCLUDES ${OPENAL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
|
||||
# Platform-dependent tests
|
||||
if(PLATFORM_WINDOWS)
|
||||
set(PLATFORM_TESTS app/system_windows_test.cpp)
|
||||
|
@ -171,67 +5,58 @@ elseif(PLATFORM_LINUX)
|
|||
set(PLATFORM_TESTS app/system_linux_test.cpp)
|
||||
endif()
|
||||
|
||||
# Tests
|
||||
# Sources
|
||||
set(UT_SOURCES
|
||||
main.cpp
|
||||
app/app_test.cpp
|
||||
graphics/engine/lightman_test.cpp
|
||||
math/func_test.cpp
|
||||
math/geometry_test.cpp
|
||||
math/matrix_test.cpp
|
||||
math/vector_test.cpp
|
||||
${PLATFORM_TESTS}
|
||||
main.cpp
|
||||
app/app_test.cpp
|
||||
common/profile_test.cpp
|
||||
graphics/engine/lightman_test.cpp
|
||||
math/func_test.cpp
|
||||
math/geometry_test.cpp
|
||||
math/matrix_test.cpp
|
||||
math/vector_test.cpp
|
||||
${PLATFORM_TESTS}
|
||||
)
|
||||
|
||||
# Local
|
||||
# Includes
|
||||
include_directories(
|
||||
.
|
||||
common
|
||||
math
|
||||
${SRC_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
common
|
||||
math
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${COLOBOT_LOCAL_INCLUDES}
|
||||
)
|
||||
|
||||
# System
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${GTEST_INCLUDE_DIR}
|
||||
${GMOCK_INCLUDE_DIR}
|
||||
${SDL_INCLUDE_DIR}
|
||||
${SDLIMAGE_INCLUDE_DIR}
|
||||
${SDLTTF_INCLUDE_DIR}
|
||||
${PNG_INCLUDE_DIRS}
|
||||
${GLEW_INCLUDE_PATH}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${OPTIONAL_INCLUDE_DIRS}
|
||||
${LIBSNDFILE_INCLUDE_DIR}
|
||||
${CLIPBOARD_INCLUDE_DIR}
|
||||
${LOCALENAME_INCLUDE_DIR}
|
||||
SYSTEM
|
||||
${GTEST_INCLUDE_DIR}
|
||||
${GMOCK_INCLUDE_DIR}
|
||||
${COLOBOT_SYSTEM_INCLUDES}
|
||||
)
|
||||
|
||||
# Libraries
|
||||
set(LIBS
|
||||
gtest
|
||||
gmock
|
||||
CBot
|
||||
clipboard
|
||||
localename
|
||||
${SDL_LIBRARY}
|
||||
${SDLIMAGE_LIBRARY}
|
||||
${SDLTTF_LIBRARY}
|
||||
${OPENGL_LIBRARY}
|
||||
${PNG_LIBRARIES}
|
||||
${GLEW_LIBRARY}
|
||||
${Boost_LIBRARIES}
|
||||
${OPTIONAL_LIBS}
|
||||
${PLATFORM_LIBS}
|
||||
${LIBSNDFILE_LIBRARY}
|
||||
gtest
|
||||
gmock
|
||||
colobotbase
|
||||
${COLOBOT_LIBS}
|
||||
)
|
||||
|
||||
add_executable(colobot_ut ${COLOBOT_SOURCES} ${UT_SOURCES} ${OPENAL_SOURCES})
|
||||
# Test files
|
||||
|
||||
set(TEST_FILES
|
||||
common/colobot.ini
|
||||
)
|
||||
|
||||
file(COPY ${TEST_FILES} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
|
||||
# Targets
|
||||
|
||||
add_executable(colobot_ut ${UT_SOURCES})
|
||||
target_link_libraries(colobot_ut ${LIBS})
|
||||
|
||||
add_test(colobot_ut ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/colobot_ut)
|
||||
|
||||
# TODO: change the unit cases to independent automated tests to be included in colobot_ut
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(ui)
|
||||
add_test(
|
||||
NAME colobot_ut
|
||||
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/colobot_ut
|
||||
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||
)
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
set(SRC_DIR ${colobot_SOURCE_DIR}/src)
|
||||
|
||||
include_directories(
|
||||
${SRC_DIR}
|
||||
${GTEST_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
add_executable(image_test ${SRC_DIR}/common/image.cpp image_test.cpp)
|
||||
target_link_libraries(image_test ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY} ${PNG_LIBRARIES})
|
||||
add_test(NAME image_test
|
||||
COMMAND ${CMAKE_BINARY_DIR}/image_test ${CMAKE_SOURCE_DIR}/test/envs/opengl/tex1.png ${CMAKE_BINARY_DIR}/tex1_test.png)
|
||||
|
||||
file(COPY colobot.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(profile_test ${SRC_DIR}/common/profile.cpp ${SRC_DIR}/common/logger.cpp profile_test.cpp)
|
||||
set_target_properties(profile_test PROPERTIES COMPILE_DEFINITIONS "DEV_BUILD=1")
|
||||
target_link_libraries(profile_test gtest ${Boost_LIBRARIES})
|
||||
|
||||
add_test(NAME profile_test
|
||||
COMMAND ${CMAKE_BINARY_DIR}/profile_test
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
@ -1,57 +0,0 @@
|
|||
#include "common/image.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* For now, just a simple test: loading a file from image
|
||||
* and saving it to another in PNG. */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3)
|
||||
{
|
||||
printf("Usage: %s in_image out_image\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CImage image;
|
||||
|
||||
if (! image.Load(argv[1]))
|
||||
{
|
||||
std::string err = image.GetError();
|
||||
printf("Error loading '%s': %s\n", argv[1], err.c_str());
|
||||
return 1;
|
||||
}
|
||||
Gfx::Color color;
|
||||
std::string str;
|
||||
|
||||
color = image.GetPixel(Math::IntPoint(0, 0));
|
||||
str = color.ToString();
|
||||
printf("pixel @ (0,0): %s\n", str.c_str());
|
||||
|
||||
color = image.GetPixel(Math::IntPoint(0, 1));
|
||||
str = color.ToString();
|
||||
printf("pixel @ (0,1): %s\n", str.c_str());
|
||||
|
||||
color = image.GetPixel(Math::IntPoint(1, 0));
|
||||
str = color.ToString();
|
||||
printf("pixel @ (1,0): %s\n", str.c_str());
|
||||
|
||||
color = image.GetPixel(Math::IntPoint(1, 1));
|
||||
str = color.ToString();
|
||||
printf("pixel @ (1,1): %s\n", str.c_str());
|
||||
|
||||
image.SetPixel(Math::IntPoint(0, 0), Gfx::Color(0.1f, 0.2f, 0.3f, 0.0f));
|
||||
image.SetPixel(Math::IntPoint(1, 0), Gfx::Color(0.3f, 0.2f, 0.1f, 1.0f));
|
||||
image.SetPixel(Math::IntPoint(0, 1), Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
image.SetPixel(Math::IntPoint(1, 1), Gfx::Color(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
|
||||
if (! image.SavePNG(argv[2]))
|
||||
{
|
||||
std::string err = image.GetError();
|
||||
printf("Error saving PNG '%s': %s\n", argv[2], err.c_str());
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -11,34 +11,29 @@
|
|||
class CProfileTest : public testing::Test
|
||||
{
|
||||
protected:
|
||||
CLogger m_logger;
|
||||
CProfile m_profile;
|
||||
|
||||
};
|
||||
|
||||
TEST_F(CProfileTest, ReadTest)
|
||||
{
|
||||
ASSERT_TRUE(m_profile.InitCurrentDirectory()); // load colobot.ini file
|
||||
m_profile.SetUseCurrentDirectory(true);
|
||||
|
||||
ASSERT_TRUE(m_profile.Init()); // load colobot.ini file
|
||||
|
||||
std::string result;
|
||||
ASSERT_TRUE(m_profile.GetLocalProfileString("test_string", "string_value", result));
|
||||
ASSERT_TRUE(m_profile.GetStringProperty("test_string", "string_value", result));
|
||||
ASSERT_STREQ("Hello world", result.c_str());
|
||||
|
||||
int int_value;
|
||||
ASSERT_TRUE(m_profile.GetLocalProfileInt("test_int", "int_value", int_value));
|
||||
ASSERT_TRUE(m_profile.GetIntProperty("test_int", "int_value", int_value));
|
||||
ASSERT_EQ(42, int_value);
|
||||
|
||||
float float_value;
|
||||
ASSERT_TRUE(m_profile.GetLocalProfileFloat("test_float", "float_value", float_value));
|
||||
ASSERT_TRUE(m_profile.GetFloatProperty("test_float", "float_value", float_value));
|
||||
ASSERT_FLOAT_EQ(1.5, float_value);
|
||||
|
||||
std::vector<std::string> list;
|
||||
list = m_profile.GetLocalProfileSection("test_multi", "entry");
|
||||
list = m_profile.GetSection("test_multi", "entry");
|
||||
ASSERT_EQ(5u, list.size());
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
|
|
@ -21,11 +21,8 @@ public:
|
|||
MOCK_METHOD0(Clear, void());
|
||||
|
||||
MOCK_METHOD2(SetTransform, void(Gfx::TransformType type, const Math::Matrix &matrix));
|
||||
MOCK_METHOD1(GetTransform, const Math::Matrix& (Gfx::TransformType type));
|
||||
MOCK_METHOD2(MultiplyTransform, void(Gfx::TransformType type, const Math::Matrix &matrix));
|
||||
|
||||
MOCK_METHOD1(SetMaterial, void(const Gfx::Material &material));
|
||||
MOCK_METHOD0(GetMaterial, const Gfx::Material&());
|
||||
|
||||
MOCK_METHOD0(GetMaxLightCount, int());
|
||||
|
||||
|
@ -33,7 +30,6 @@ public:
|
|||
MOCK_METHOD1(GetLight, const Gfx::Light&(int index));
|
||||
|
||||
MOCK_METHOD2(SetLightEnabled, void(int index, bool enabled));
|
||||
MOCK_METHOD1(GetLightEnabled, bool(int index));
|
||||
|
||||
MOCK_METHOD2(CreateTexture, Gfx::Texture(CImage *image, const Gfx::TextureCreateParams ¶ms));
|
||||
MOCK_METHOD2(CreateTexture, Gfx::Texture(ImageData *data, const Gfx::TextureCreateParams ¶ms));
|
||||
|
@ -45,13 +41,10 @@ public:
|
|||
|
||||
MOCK_METHOD2(SetTexture, void(int index, const Gfx::Texture &texture));
|
||||
MOCK_METHOD2(SetTexture, void(int index, unsigned int textureId));
|
||||
MOCK_METHOD1(GetTexture, Gfx::Texture(int index));
|
||||
|
||||
MOCK_METHOD2(SetTextureEnabled, void(int index, bool enabled));
|
||||
MOCK_METHOD1(GetTextureEnabled, bool(int index));
|
||||
|
||||
MOCK_METHOD2(SetTextureStageParams, void(int index, const Gfx::TextureStageParams ¶ms));
|
||||
MOCK_METHOD1(GetTextureStageParams, Gfx::TextureStageParams(int index));
|
||||
|
||||
MOCK_METHOD3(SetTextureStageWrap, void(int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT));
|
||||
|
||||
|
@ -77,34 +70,24 @@ public:
|
|||
MOCK_METHOD1(GetRenderState, bool(Gfx::RenderState state));
|
||||
|
||||
MOCK_METHOD1(SetDepthTestFunc, void(Gfx::CompFunc func));
|
||||
MOCK_METHOD0(GetDepthTestFunc, Gfx::CompFunc());
|
||||
|
||||
MOCK_METHOD1(SetDepthBias, void(float factor));
|
||||
MOCK_METHOD0(GetDepthBias, float());
|
||||
|
||||
MOCK_METHOD2(SetAlphaTestFunc, void(Gfx::CompFunc func, float refValue));
|
||||
MOCK_METHOD2(GetAlphaTestFunc, void(Gfx::CompFunc &func, float &refValue));
|
||||
|
||||
MOCK_METHOD2(SetBlendFunc, void(Gfx::BlendFunc srcBlend, Gfx::BlendFunc dstBlend));
|
||||
MOCK_METHOD2(GetBlendFunc, void(Gfx::BlendFunc &srcBlend, Gfx::BlendFunc &dstBlend));
|
||||
|
||||
MOCK_METHOD1(SetClearColor, void(const Gfx::Color &color));
|
||||
MOCK_METHOD0(GetClearColor, Gfx::Color());
|
||||
|
||||
MOCK_METHOD1(SetGlobalAmbient, void(const Gfx::Color &color));
|
||||
MOCK_METHOD0(GetGlobalAmbient, Gfx::Color());
|
||||
|
||||
MOCK_METHOD5(SetFogParams, void(Gfx::FogMode mode, const Gfx::Color &color, float start, float end, float density));
|
||||
MOCK_METHOD5(GetFogParams, void(Gfx::FogMode &mode, Gfx::Color &color, float &start, float &end, float &density));
|
||||
|
||||
MOCK_METHOD1(SetCullMode, void(Gfx::CullMode mode));
|
||||
MOCK_METHOD0(GetCullMode, Gfx::CullMode());
|
||||
|
||||
MOCK_METHOD1(SetShadeModel, void(Gfx::ShadeModel model));
|
||||
MOCK_METHOD0(GetShadeModel, Gfx::ShadeModel());
|
||||
|
||||
MOCK_METHOD1(SetFillMode, void(Gfx::FillMode mode));
|
||||
MOCK_METHOD0(GetFillMode, Gfx::FillMode());
|
||||
|
||||
MOCK_CONST_METHOD0(GetFrameBufferPixels, void*());
|
||||
};
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
set(SRC_DIR ${colobot_SOURCE_DIR}/src)
|
||||
|
||||
include_directories(
|
||||
.
|
||||
${SRC_DIR}
|
||||
${GTEST_INCLUDE_DIR}
|
||||
${GMOCK_INCLUDE_DIR}
|
||||
${CLIPBOARD_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
# Platform-dependent implementation of CSystemUtils
|
||||
if(PLATFORM_WINDOWS)
|
||||
elseif(PLATFORM_MACOSX)
|
||||
set(ADDITIONAL_LIB "${X11_X11_LIB}")
|
||||
else()
|
||||
set(ADDITIONAL_LIB "-lX11")
|
||||
endif()
|
||||
|
||||
add_executable(edit_test
|
||||
${SRC_DIR}/app/system.cpp
|
||||
${SRC_DIR}/app/${SYSTEM_CPP_MODULE}
|
||||
${SRC_DIR}/app/system_other.cpp
|
||||
${SRC_DIR}/common/event.cpp
|
||||
${SRC_DIR}/common/logger.cpp
|
||||
${SRC_DIR}/common/misc.cpp
|
||||
${SRC_DIR}/common/profile.cpp
|
||||
${SRC_DIR}/common/iman.cpp
|
||||
${SRC_DIR}/common/stringutils.cpp
|
||||
${SRC_DIR}/graphics/engine/text.cpp
|
||||
${SRC_DIR}/ui/button.cpp
|
||||
${SRC_DIR}/ui/control.cpp
|
||||
${SRC_DIR}/ui/edit.cpp
|
||||
${SRC_DIR}/ui/scroll.cpp
|
||||
stubs/app_stub.cpp
|
||||
stubs/engine_stub.cpp
|
||||
stubs/particle_stub.cpp
|
||||
stubs/restext_stub.cpp
|
||||
stubs/robotmain_stub.cpp
|
||||
edit_test.cpp)
|
||||
|
||||
target_link_libraries(edit_test gtest gmock clipboard ${SDL_LIBRARY} ${SDLTTF_LIBRARY} ${Boost_LIBRARIES} ${ADDITIONAL_LIB})
|
||||
|
||||
|
||||
|
||||
add_test(edit_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/edit_test)
|
|
@ -1,90 +0,0 @@
|
|||
#include "app/app.h"
|
||||
#include "app/gamedata.h"
|
||||
|
||||
#include "ui/edit.h"
|
||||
|
||||
#include "mocks/text_mock.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
class CEditTest : public testing::Test
|
||||
{
|
||||
public:
|
||||
CEditTest()
|
||||
: m_robotMain(nullptr)
|
||||
, m_gameData(nullptr)
|
||||
, m_engine(nullptr)
|
||||
, m_edit(nullptr)
|
||||
{}
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
m_robotMain = new CRobotMain(&m_app, false);
|
||||
|
||||
m_gameData = new CGameData();
|
||||
|
||||
m_engine = new Gfx::CEngine(nullptr);
|
||||
|
||||
m_edit = new Ui::CEdit;
|
||||
}
|
||||
|
||||
virtual void TearDown()
|
||||
{
|
||||
delete m_edit;
|
||||
m_edit = nullptr;
|
||||
delete m_engine;
|
||||
m_engine = nullptr;
|
||||
delete m_gameData;
|
||||
m_gameData = nullptr;
|
||||
delete m_robotMain;
|
||||
m_robotMain = nullptr;
|
||||
}
|
||||
virtual ~CEditTest()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
protected:
|
||||
CApplication m_app;
|
||||
CRobotMain* m_robotMain;
|
||||
CGameData * m_gameData;
|
||||
Gfx::CEngine * m_engine;
|
||||
Ui::CEdit * m_edit;
|
||||
CLogger m_logger;
|
||||
};
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::An;
|
||||
using ::testing::Return;
|
||||
|
||||
TEST_F(CEditTest, WriteTest)
|
||||
{
|
||||
ASSERT_TRUE(true);
|
||||
CTextMock * text = dynamic_cast<CTextMock *>(m_engine->GetText());
|
||||
EXPECT_CALL(*text, GetCharWidth(_, _, _, _)).WillRepeatedly(Return(1.0f));
|
||||
EXPECT_CALL(*text, GetStringWidth(An<const std::string&>(), _, _, _)).WillOnce(Return(1.0f));
|
||||
std::string filename = "test.file";
|
||||
m_edit->SetMaxChar(Ui::EDITSTUDIOMAX);
|
||||
m_edit->SetAutoIndent(true);
|
||||
std::string inputScript = "{\ntext1\ntext2\n\ntext3\n{\ntext4\n}\n}";
|
||||
std::string expectedScript = "{\r\n\ttext1\r\n\ttext2\r\n\t\r\n\ttext3\r\n\t{\r\n\t\ttext4\r\n\t}\r\n}";
|
||||
m_edit->SetText(inputScript.c_str(), true);
|
||||
GetLogger()->Info("Writing text \n");
|
||||
m_edit->WriteText("script.txt");
|
||||
|
||||
std::fstream scriptFile;
|
||||
|
||||
scriptFile.open("script.txt", std::ios_base::binary | std::ios_base::in);
|
||||
std::string outputScript((std::istreambuf_iterator<char>(scriptFile)), std::istreambuf_iterator<char>());
|
||||
ASSERT_STREQ(expectedScript.c_str(), outputScript.c_str());
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#include "common/logger.h"
|
||||
|
||||
#include "graphics/engine/text.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
class CTextMock : public Gfx::CText
|
||||
{
|
||||
public:
|
||||
CTextMock(Gfx::CEngine* engine) : CText(engine)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~CTextMock()
|
||||
{
|
||||
};
|
||||
|
||||
MOCK_METHOD4(GetCharWidth, float(Gfx::UTF8Char ch,
|
||||
Gfx::FontType type,
|
||||
float size,
|
||||
float offset));
|
||||
MOCK_METHOD4(GetStringWidth, float(const std::string &text,
|
||||
std::vector<Gfx::FontMetaChar>::iterator format,
|
||||
std::vector<Gfx::FontMetaChar>::iterator end,
|
||||
float size));
|
||||
MOCK_METHOD3(GetStringWidth, float(std::string text,
|
||||
Gfx::FontType font,
|
||||
float size));
|
||||
MOCK_METHOD4(GetStringWidth, float(Gfx::UTF8Char ch,
|
||||
Gfx::FontType font,
|
||||
float size,
|
||||
float offset));
|
||||
|
||||
};
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
#include "app/app.h"
|
||||
|
||||
#include "graphics/opengl/gldevice.h"
|
||||
|
||||
template<> CApplication* CSingleton<CApplication>::m_instance = nullptr;
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
GLDeviceConfig::GLDeviceConfig()
|
||||
{
|
||||
}
|
||||
|
||||
} /* Gfx */
|
||||
|
||||
|
||||
CApplication::CApplication()
|
||||
{
|
||||
}
|
||||
|
||||
CApplication::~CApplication()
|
||||
{
|
||||
}
|
||||
|
||||
CSoundInterface* CApplication::GetSound()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CEventQueue* CApplication::GetEventQueue()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Event CApplication::CreateUpdateEvent()
|
||||
{
|
||||
return Event(EVENT_NULL);
|
||||
}
|
||||
|
||||
char CApplication::GetLanguageChar() const
|
||||
{
|
||||
return 'E';
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
#include "graphics/engine/engine.h"
|
||||
#include "graphics/engine/text.h"
|
||||
|
||||
#include "mocks/text_mock.h"
|
||||
|
||||
template<> Gfx::CEngine* CSingleton<Gfx::CEngine>::m_instance = nullptr;
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
CEngine::CEngine(CApplication* app) :
|
||||
m_app(app)
|
||||
{
|
||||
m_text = new CTextMock(this);
|
||||
m_text->Create();
|
||||
}
|
||||
|
||||
CEngine::~CEngine()
|
||||
{
|
||||
delete m_text;
|
||||
m_text = nullptr;
|
||||
}
|
||||
|
||||
CParticle* CEngine::GetParticle()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Math::Point CEngine::WindowToInterfaceSize(Math::IntPoint size)
|
||||
{
|
||||
return Math::Point(size.x, size.y);
|
||||
}
|
||||
|
||||
void CEngine::SetState(int state, const Color& color)
|
||||
{
|
||||
if (state == m_lastState && color == m_lastColor)
|
||||
return;
|
||||
|
||||
m_lastState = state;
|
||||
m_lastColor = color;
|
||||
}
|
||||
|
||||
Math::IntPoint CEngine::GetWindowSize()
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
void CEngine::AddStatisticTriangle(int count)
|
||||
{
|
||||
m_statisticTriangle += count;
|
||||
}
|
||||
|
||||
void CEngine::SetMouseType(EngineMouseType type)
|
||||
{
|
||||
m_mouseType = type;
|
||||
}
|
||||
|
||||
bool CEngine::SetTexture(const std::string& /* name */, int /* stage */)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
CText* CEngine::GetText()
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
CDevice* CEngine::GetDevice()
|
||||
{
|
||||
return m_device;
|
||||
}
|
||||
|
||||
int CEngine::GetEditIndentValue()
|
||||
{
|
||||
return m_editIndentValue;
|
||||
}
|
||||
|
||||
void CEngine::DeleteTexture(const std::string& /* texName */)
|
||||
{
|
||||
}
|
||||
|
||||
Texture CEngine::LoadTexture(const std::string& /* name */)
|
||||
{
|
||||
Texture texture;
|
||||
return texture;
|
||||
}
|
||||
|
||||
Math::Vector CEngine::GetEyePt()
|
||||
{
|
||||
return Math::Vector();
|
||||
}
|
||||
|
||||
Math::Vector CEngine::GetLookatPt()
|
||||
{
|
||||
return Math::Vector();
|
||||
}
|
||||
|
||||
bool CEngine::GetPause()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
} /* Gfx */
|
||||
|
|
@ -1,205 +0,0 @@
|
|||
#include "graphics/engine/particle.h"
|
||||
|
||||
#include "common/logger.h"
|
||||
|
||||
|
||||
// Graphics module namespace
|
||||
namespace Gfx {
|
||||
|
||||
|
||||
CParticle::CParticle(CEngine* /*engine*/)
|
||||
{
|
||||
}
|
||||
|
||||
CParticle::~CParticle()
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::SetDevice(CDevice* /*device*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::FlushParticle()
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::FlushParticle(int /*sheet*/)
|
||||
{
|
||||
}
|
||||
|
||||
int CParticle::CreateParticle(Math::Vector /*pos*/, Math::Vector /*speed*/, Math::Point /*dim*/,
|
||||
ParticleType /*type*/, float /*duration*/, float /*mass*/,
|
||||
float /*windSensitivity*/, int /*sheet*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CParticle::CreateFrag(Math::Vector /*pos*/, Math::Vector /*speed*/, EngineTriangle */*triangle*/,
|
||||
ParticleType /*type*/, float /*duration*/, float /*mass*/,
|
||||
float /*windSensitivity*/, int /*sheet*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CParticle::CreatePart(Math::Vector /*pos*/, Math::Vector /*speed*/, ParticleType /*type*/,
|
||||
float /*duration*/, float /*mass*/, float /*weight*/,
|
||||
float /*windSensitivity*/, int /*sheet*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CParticle::CreateRay(Math::Vector /*pos*/, Math::Vector /*goal*/, ParticleType /*type*/, Math::Point /*dim*/,
|
||||
float /*duration*/, int /*sheet*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CParticle::CreateTrack(Math::Vector /*pos*/, Math::Vector /*speed*/, Math::Point /*dim*/, ParticleType /*type*/,
|
||||
float /*duration*/, float /*mass*/, float /*length*/, float /*width*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CParticle::CreateWheelTrace(const Math::Vector &/*p1*/, const Math::Vector &/*p2*/, const Math::Vector &/*p3*/,
|
||||
const Math::Vector &/*p4*/, ParticleType /*type*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::DeleteParticle(ParticleType /*type*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::DeleteParticle(int /*channel*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::SetObjectLink(int /*channel*/, CObject */*object*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::SetObjectFather(int /*channel*/, CObject */*object*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::SetPosition(int /*channel*/, Math::Vector /*pos*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::SetDimension(int /*channel*/, Math::Point /*dim*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::SetZoom(int /*channel*/, float /*zoom*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::SetAngle(int /*channel*/, float /*angle*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::SetIntensity(int /*channel*/, float /*intensity*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::SetParam(int /*channel*/, Math::Vector /*pos*/, Math::Point /*dim*/, float /*zoom*/, float /*angle*/, float /*intensity*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::SetPhase(int /*channel*/, ParticlePhase /*phase*/, float /*duration*/)
|
||||
{
|
||||
}
|
||||
|
||||
bool CParticle::GetPosition(int /*channel*/, Math::Vector &/*pos*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Color CParticle::GetFogColor(Math::Vector /*pos*/)
|
||||
{
|
||||
return Color();
|
||||
}
|
||||
|
||||
void CParticle::SetFrameUpdate(int /*sheet*/, bool /*update*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::FrameParticle(float /*rTime*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::DrawParticle(int /*sheet*/)
|
||||
{
|
||||
}
|
||||
|
||||
bool CParticle::WriteWheelTrace(const char */*filename*/, int /*width*/, int /*height*/, Math::Vector /*dl*/, Math::Vector /*ur*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void CParticle::DeleteRank(int /*rank*/)
|
||||
{
|
||||
}
|
||||
|
||||
bool CParticle::CheckChannel(int &/*channel*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void CParticle::DrawParticleTriangle(int /*i*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::DrawParticleNorm(int /*i*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::DrawParticleFlat(int /*i*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::DrawParticleFog(int /*i*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::DrawParticleRay(int /*i*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::DrawParticleSphere(int /*i*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::DrawParticleCylinder(int /*i*/)
|
||||
{
|
||||
}
|
||||
|
||||
void CParticle::DrawParticleWheel(int /*i*/)
|
||||
{
|
||||
}
|
||||
|
||||
CObject* CParticle::SearchObjectGun(Math::Vector /*old*/, Math::Vector /*pos*/, ParticleType /*type*/, CObject */*father*/)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CObject* CParticle::SearchObjectRay(Math::Vector /*pos*/, Math::Vector /*goal*/, ParticleType /*type*/, CObject */*father*/)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CParticle::Play(Sound /*sound*/, Math::Vector /*pos*/, float /*amplitude*/)
|
||||
{
|
||||
}
|
||||
|
||||
bool CParticle::TrackMove(int /*i*/, Math::Vector /*pos*/, float /*progress*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void CParticle::TrackDraw(int /*i*/, ParticleType /*type*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
} // namespace Gfx
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#include "common/restext.h"
|
||||
|
||||
bool GetResource(ResType /* type */, int /* num */, std::string& /* text */)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SearchKey(const char * /* cmd */, InputSlot & /* key */)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#include "object/robotmain.h"
|
||||
|
||||
|
||||
template<> CRobotMain* CSingleton<CRobotMain>::m_instance = nullptr;
|
||||
|
||||
CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
|
||||
{
|
||||
}
|
||||
|
||||
CRobotMain::~CRobotMain()
|
||||
{
|
||||
}
|
||||
|
||||
bool CRobotMain::GetGlint()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const InputBinding& CRobotMain::GetInputBinding(InputSlot slot)
|
||||
{
|
||||
unsigned int index = static_cast<unsigned int>(slot);
|
||||
assert(index >= 0 && index < INPUT_SLOT_MAX);
|
||||
return m_inputBindings[index];
|
||||
}
|
||||
|
Loading…
Reference in New Issue