summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZaba999 <zaba.marcin@gmail.com>2012-09-10 23:29:38 +0200
committerZaba999 <zaba.marcin@gmail.com>2012-09-10 23:29:38 +0200
commit479a67a731be5a5e8035ea7acce0344c7c605814 (patch)
treefc0448b4095ce03aeca2a1be98418aae78751d84
parentcf2295d08d0b2d0ba63e316f5e5e3615c5c978ac (diff)
downloadcolobot-479a67a731be5a5e8035ea7acce0344c7c605814.tar.gz
colobot-479a67a731be5a5e8035ea7acce0344c7c605814.tar.bz2
colobot-479a67a731be5a5e8035ea7acce0344c7c605814.zip
Merge with changes from Zaba999 fork.
-rw-r--r--src/CMakeLists.txt11
-rw-r--r--src/common/key.h1
-rw-r--r--src/common/misc.cpp276
-rw-r--r--src/common/misc.h10
-rw-r--r--src/common/restext.cpp3576
-rw-r--r--src/common/restext.h145
-rw-r--r--src/graphics/engine/camera.cpp61
-rw-r--r--src/object/brain.cpp211
-rw-r--r--src/object/brain.h156
-rw-r--r--src/object/mainmovie.h30
-rw-r--r--src/object/motion/motion.cpp26
-rw-r--r--src/object/motion/motion.h10
-rw-r--r--src/object/motion/motionvehicle.h6
-rw-r--r--src/object/object.cpp1412
-rw-r--r--src/object/object.h132
-rw-r--r--src/object/robotmain.cpp52
-rw-r--r--src/object/robotmain.h147
-rw-r--r--src/object/task/task.cpp26
-rw-r--r--src/object/task/task.h50
-rw-r--r--src/object/task/taskmanager.cpp2
-rw-r--r--src/object/task/taskmanager.h2
-rw-r--r--src/physics/physics.cpp825
-rw-r--r--src/physics/physics.h57
-rw-r--r--src/script/cbottoken.cpp32
-rw-r--r--src/script/cbottoken.h10
-rw-r--r--src/script/cmdtoken.cpp147
-rw-r--r--src/script/cmdtoken.h46
-rw-r--r--src/script/script.cpp1218
-rw-r--r--src/script/script.h174
-rw-r--r--src/ui/button.cpp88
-rw-r--r--src/ui/button.h19
-rw-r--r--src/ui/check.cpp52
-rw-r--r--src/ui/check.h14
-rw-r--r--src/ui/color.cpp129
-rw-r--r--src/ui/color.h38
-rw-r--r--src/ui/compass.cpp104
-rw-r--r--src/ui/compass.h17
-rw-r--r--src/ui/control.cpp384
-rw-r--r--src/ui/control.h138
-rw-r--r--src/ui/displayinfo.cpp413
-rw-r--r--src/ui/displayinfo.h35
-rw-r--r--src/ui/displaytext.cpp178
-rw-r--r--src/ui/displaytext.h38
-rw-r--r--src/ui/edit.cpp470
-rw-r--r--src/ui/edit.h123
-rw-r--r--src/ui/editvalue.cpp94
-rw-r--r--src/ui/editvalue.h31
-rw-r--r--src/ui/gauge.cpp70
-rw-r--r--src/ui/gauge.h16
-rw-r--r--src/ui/group.cpp427
-rw-r--r--src/ui/group.h13
-rw-r--r--src/ui/image.cpp56
-rw-r--r--src/ui/image.h15
-rw-r--r--src/ui/interface.cpp550
-rw-r--r--src/ui/interface.h125
-rw-r--r--src/ui/key.cpp188
-rw-r--r--src/ui/key.h41
-rw-r--r--src/ui/label.cpp47
-rw-r--r--src/ui/label.h27
-rw-r--r--src/ui/list.cpp647
-rw-r--r--src/ui/list.h126
-rw-r--r--src/ui/map.h34
-rw-r--r--src/ui/scroll.cpp82
-rw-r--r--src/ui/scroll.h73
-rw-r--r--src/ui/shortcut.h27
-rw-r--r--src/ui/slider.cpp85
-rw-r--r--src/ui/slider.h78
-rw-r--r--src/ui/studio.cpp2
-rw-r--r--src/ui/target.cpp68
-rw-r--r--src/ui/target.h29
-rw-r--r--src/ui/window.cpp257
-rw-r--r--src/ui/window.h97
72 files changed, 8865 insertions, 5531 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index dc003b9..4025f78 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -124,7 +124,7 @@ graphics/opengl/gldevice.cpp
# object/motion/motiontoto.cpp
# object/motion/motionvehicle.cpp
# object/motion/motionworm.cpp
-# object/object.cpp
+object/object.cpp
# object/robotmain.cpp
# object/task/task.cpp
# object/task/taskadvance.cpp
@@ -147,10 +147,10 @@ graphics/opengl/gldevice.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
+physics/physics.cpp
+script/cbottoken.cpp
+script/cmdtoken.cpp
+script/script.cpp
# sound/sound.cpp
# ui/button.cpp
# ui/check.cpp
@@ -197,6 +197,7 @@ ${SDL_IMAGE_INCLUDE_DIR}
${SDLTTF_INCLUDE_DIR}
${PNG_INCLUDE_DIRS}
${OPTIONAL_INCLUDE_DIRS}
+..
)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/CBot)
diff --git a/src/common/key.h b/src/common/key.h
index de31c09..1d03a47 100644
--- a/src/common/key.h
+++ b/src/common/key.h
@@ -29,6 +29,7 @@
// If need arises, it can be changed to custom function or anything else
#define KEY(x) SDLK_ ## x
+
// Key modifier defined as concatenation to KMOD_...
// If need arises, it can be changed to custom function or anything else
#define KEY_MOD(x) KMOD_ ## x
diff --git a/src/common/misc.cpp b/src/common/misc.cpp
index 2427356..a678f58 100644
--- a/src/common/misc.cpp
+++ b/src/common/misc.cpp
@@ -21,14 +21,16 @@
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
-#include <direct.h>
+//#include <direct.h>
#include <time.h>
-#include <d3d.h>
+//#include <d3d.h>
#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
-#include "old/d3dutil.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
+//#include "old/d3dmath.h"
+//#include "math/math.h"
+//#include "old/d3dutil.h"
#include "common/language.h"
#include "common/event.h"
#include "common/misc.h"
@@ -37,7 +39,7 @@
CMetaFile g_metafile;
-static EventMsg g_uniqueEventMsg = EVENT_USER;
+static EventType g_uniqueEventType = EVENT_USER;
static bool g_bUserDir = false;
static char g_userDir[100] = "";
@@ -45,84 +47,84 @@ static char g_userDir[100] = "";
// Gives a single user event.
-EventMsg GetUniqueEventMsg()
+EventType GetUniqueEventType()
{
int i;
- i = (int)g_uniqueEventMsg+1;
- g_uniqueEventMsg = (EventMsg)i;
- return g_uniqueEventMsg;
+ i = static_cast <int> (g_uniqueEventType+1);
+ g_uniqueEventType = static_cast<EventType>(i);
+ return g_uniqueEventType;
}
// Returns a non-accented letter.
-char RetNoAccent(char letter)
+char GetNoAccent(char letter)
{
if ( letter < 0 )
{
- if ( letter == 'á' ||
- letter == 'à' ||
- letter == 'â' ||
- letter == 'ä' ||
- letter == 'ã' ) return 'a';
-
- if ( letter == 'é' ||
- letter == 'è' ||
- letter == 'ê' ||
- letter == 'ë' ) return 'e';
-
- if ( letter == 'í' ||
- letter == 'ì' ||
- letter == 'î' ||
- letter == 'ï' ) return 'i';
-
- if ( letter == 'ó' ||
- letter == 'ò' ||
- letter == 'ô' ||
- letter == 'ö' ||
- letter == 'õ' ) return 'o';
-
- if ( letter == 'ú' ||
- letter == 'ù' ||
- letter == 'û' ||
- letter == 'ü' ) return 'u';
-
- if ( letter == 'ç' ) return 'c';
-
- if ( letter == 'ñ' ) return 'n';
-
- if ( letter == 'Á' ||
- letter == 'À' ||
- letter == 'Â' ||
- letter == 'Ä' ||
- letter == 'Ã' ) return 'A';
-
- if ( letter == 'É' ||
- letter == 'È' ||
- letter == 'Ê' ||
- letter == 'Ë' ) return 'E';
-
- if ( letter == 'Í' ||
- letter == 'Ì' ||
- letter == 'Î' ||
- letter == 'Ï' ) return 'I';
-
- if ( letter == 'Ó' ||
- letter == 'Ò' ||
- letter == 'Ô' ||
- letter == 'Ö' ||
- letter == 'Õ' ) return 'O';
-
- if ( letter == 'Ú' ||
- letter == 'Ù' ||
- letter == 'Û' ||
- letter == 'Ü' ) return 'U';
-
- if ( letter == 'Ç' ) return 'C';
-
- if ( letter == 'Ñ' ) return 'N';
+ if ( letter == '�' ||
+ letter == '�' ||
+ letter == '�' ||
+ letter == '�' ||
+ letter == '�' ) return 'a';
+
+ if ( letter == '�' ||
+ letter == '�' ||
+ letter == '�' ||
+ letter == '�' ) return 'e';
+
+ if ( letter == '�' ||
+ letter == '�' ||
+ letter == '�' ||
+ letter == '�' ) return 'i';
+
+ if ( letter == '�' ||
+ letter == '�' ||
+ letter == '�' ||
+ letter == '�' ||
+ letter == '�' ) return 'o';
+
+ if ( letter == '�' ||
+ letter == '�' ||
+ letter == '�' ||
+ letter == '�' ) return 'u';
+
+ if ( letter == '�' ) return 'c';
+
+ if ( letter == '�' ) return 'n';
+
+ if ( letter == '�' ||
+ letter == '�' ||
+ letter == '�' ||
+ letter == '�' ||
+ letter == '�' ) return 'A';
+
+ if ( letter == '�' ||
+ letter == '�' ||
+ letter == '�' ||
+ letter == '�' ) return 'E';
+
+ if ( letter == '�' ||
+ letter == '�' ||
+ letter == '�' ||
+ letter == '�' ) return 'I';
+
+ if ( letter == '�' ||
+ letter == '�' ||
+ letter == '�' ||
+ letter == '�' ||
+ letter == '�' ) return 'O';
+
+ if ( letter == '�' ||
+ letter == '�' ||
+ letter == '�' ||
+ letter == '�' ) return 'U';
+
+ if ( letter == '�' ) return 'C';
+
+ if ( letter == '�' ) return 'N';
}
return letter;
@@ -130,40 +132,40 @@ char RetNoAccent(char letter)
// Returns an uppercase letter.
-char RetToUpper(char letter)
+char GetToUpper(char letter)
{
if ( letter < 0 )
{
- if ( letter == 'á' ) return 'Á';
- if ( letter == 'à' ) return 'À';
- if ( letter == 'â' ) return 'Â';
- if ( letter == 'ä' ) return 'Ä';
- if ( letter == 'ã' ) return 'Ã';
-
- if ( letter == 'é' ) return 'É';
- if ( letter == 'è' ) return 'È';
- if ( letter == 'ê' ) return 'Ê';
- if ( letter == 'ë' ) return 'Ë';
-
- if ( letter == 'í' ) return 'Í';
- if ( letter == 'ì' ) return 'Ì';
- if ( letter == 'î' ) return 'Î';
- if ( letter == 'ï' ) return 'Ï';
-
- if ( letter == 'ó' ) return 'Ó';
- if ( letter == 'ò' ) return 'Ò';
- if ( letter == 'ô' ) return 'Ô';
- if ( letter == 'ö' ) return 'Ö';
- if ( letter == 'õ' ) return 'Õ';
-
- if ( letter == 'ú' ) return 'Ú';
- if ( letter == 'ù' ) return 'Ù';
- if ( letter == 'û' ) return 'Û';
- if ( letter == 'ü' ) return 'Ü';
-
- if ( letter == 'ç' ) return 'Ç';
-
- if ( letter == 'ñ' ) return 'Ñ';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+
+ if ( letter == '�' ) return '�';
+
+ if ( letter == '�' ) return '�';
}
return toupper(letter);
@@ -171,40 +173,40 @@ char RetToUpper(char letter)
// Returns a lowercase letter.
-char RetToLower(char letter)
+char GetToLower(char letter)
{
if ( letter < 0 )
{
- if ( letter == 'Á' ) return 'á';
- if ( letter == 'À' ) return 'à';
- if ( letter == 'Â' ) return 'â';
- if ( letter == 'Ä' ) return 'ä';
- if ( letter == 'Ã' ) return 'ã';
-
- if ( letter == 'É' ) return 'é';
- if ( letter == 'È' ) return 'è';
- if ( letter == 'Ê' ) return 'ê';
- if ( letter == 'Ë' ) return 'ë';
-
- if ( letter == 'Í' ) return 'í';
- if ( letter == 'Ì' ) return 'ì';
- if ( letter == 'Î' ) return 'î';
- if ( letter == 'Ï' ) return 'ï';
-
- if ( letter == 'Ó' ) return 'ó';
- if ( letter == 'Ò' ) return 'ò';
- if ( letter == 'Ô' ) return 'ô';
- if ( letter == 'Ö' ) return 'ö';
- if ( letter == 'Õ' ) return 'õ';
-
- if ( letter == 'Ú' ) return 'ú';
- if ( letter == 'Ù' ) return 'ù';
- if ( letter == 'Û' ) return 'û';
- if ( letter == 'Ü' ) return 'ü';
-
- if ( letter == 'Ç' ) return 'ç';
-
- if ( letter == 'Ñ' ) return 'ñ';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+ if ( letter == '�' ) return '�';
+
+ if ( letter == '�' ) return '�';
+
+ if ( letter == '�' ) return '�';
}
return tolower(letter);
@@ -213,7 +215,7 @@ char RetToLower(char letter)
// Converting time to string.
-void TimeToAscii(time_t time, char *buffer)
+void GimeToAscii(time_t time, char *buffer)
{
struct tm when;
int year;
@@ -311,7 +313,7 @@ bool CopyFileToTemp(char* filename)
UserDir(dst, filename, "textures");
strcpy(g_userDir, save);
- _mkdir("temp");
+// _mkdir("temp"); TODO
if ( !Xfer(src, dst) ) return false;
strcpy(filename, dst);
@@ -379,7 +381,7 @@ void UserDir(bool bUser, char* dir)
// def = "abc\"
// out: buffer = "abc\toto.txt"
-void UserDir(char* buffer, char* dir, char* def)
+void UserDir(char* buffer, char* dir, const char* def)
{
char ddir[100];
char* add;
diff --git a/src/common/misc.h b/src/common/misc.h
index dca801f..fa478bd 100644
--- a/src/common/misc.h
+++ b/src/common/misc.h
@@ -89,9 +89,9 @@ const int KS_NUMMINUS = (1<<15);
extern EventType GetUniqueEventType();
-extern char RetNoAccent(char letter);
-extern char RetToUpper(char letter);
-extern char RetToLower(char letter);
+extern char GetNoAccent(char letter);
+extern char GetToUpper(char letter);
+extern char GetToLower(char letter);
extern void TimeToAscii(time_t time, char *buffer);
@@ -99,8 +99,8 @@ extern bool CopyFileToTemp(char* filename);
extern bool CopyFileListToTemp(char* filename, int* list, int total);
extern void AddExt(char* filename, char* ext);
extern void UserDir(bool bUser, char* dir);
-extern void UserDir(char* buffer, char* dir, char* def);
+extern void UserDir(char* buffer, char* dir, const char* def);
-extern char RetLanguageLetter();
+extern char GetLanguageLetter();
diff --git a/src/common/restext.cpp b/src/common/restext.cpp
index 487d1a6..ee5d961 100644
--- a/src/common/restext.cpp
+++ b/src/common/restext.cpp
@@ -14,9 +14,10 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.// restext.cpp
-#include <libintl.h>
-#include <SDL/SDL_keyboard.h>
-#include "common/struct.h"
+#include <stdio.h>
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
#include "common/language.h"
#include "common/misc.h"
#include "common/event.h"
@@ -25,12 +26,14 @@
#include "common/restext.h"
-// Gives the pointer to the engine.
-static CD3DEngine* g_engine;
-static char g_gamerName[100];
+//** -> text to translate!
+
+
-void SetEngine(CD3DEngine *engine)
+// Gives the pointer to the engine.
+
+void SetEngine(Gfx::CEngine *engine)
{
g_engine = engine;
}
@@ -78,7 +81,7 @@ static KeyDesc keyTable[22] =
// Seeks a key.
-bool SearchKey(const char *cmd, KeyRank &key)
+bool SearchKey(char *cmd, KeyRank &key)
{
int i;
@@ -95,7 +98,7 @@ bool SearchKey(const char *cmd, KeyRank &key)
// Replaces the commands "\key name;" in a text.
-static void PutKeyName(char* dst, const char* src)
+void PutKeyName(char* dst, char* src)
{
KeyRank key;
char name[50];
@@ -112,8 +115,7 @@ static void PutKeyName(char* dst, const char* src)
{
if ( SearchKey(src+s+5, key) )
{
- // FIXME: res = g_engine->RetKey(key, 0);
- res = 0;
+ // res = g_engine->GetKey(key, 0); TODO
if ( res != 0 )
{
if ( GetResource(RES_KEY, res, name) )
@@ -135,60 +137,3524 @@ static void PutKeyName(char* dst, const char* src)
dst[d++] = 0;
}
-// Returns the translated text of a resource that needs key substitution
-
-static const char* GetResourceBase(ResType type, int num)
-{
- const char *str = NULL;
-
- assert(num >= 0);
-
- switch (type)
- {
- case RES_TEXT:
- assert(num < strings_text_len);
- str = strings_text[num];
- break;
- case RES_EVENT:
- assert(num < strings_event_len);
- str = strings_event[num];
- break;
- case RES_OBJECT:
- assert(num < strings_object_len);
- if (num == OBJECT_HUMAN)
- return g_gamerName;
- str = strings_object[num];
- break;
- case RES_ERR:
- assert(num < strings_err_len);
- str = strings_err[num];
- break;
- case RES_CBOT:
- assert(num < strings_cbot_len);
- str = strings_cbot[num];
- break;
- case RES_KEY:
- assert(num < SDLK_LAST);
- str = SDL_GetKeyName(static_cast<SDLKey>(num));
- break;
- default:
- assert(false);
- }
- return gettext(str);
-}
// Returns the text of a resource.
bool GetResource(ResType type, int num, char* text)
{
- const char *tmpl = GetResourceBase(type, num);
+ char buffer[100];
- if (!tmpl)
+ if ( !GetResourceBase(type, num, buffer) )
{
text[0] = 0;
return false;
}
- PutKeyName(text, tmpl);
+ PutKeyName(text, buffer);
return true;
}
+
+
+// Returns the text of a resource.
+
+bool GetResourceBase(ResType type, int num, char* text)
+{
+ text[0] = 0;
+
+#if _ENGLISH
+ if ( type == RES_TEXT )
+ {
+ #if _FULL
+ if ( num == RT_VERSION_ID ) strcpy(text, "1.18 /e");
+ #endif
+ #if _NET
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A 1.18");
+ #endif
+ #if _SCHOOL & _EDU
+ #if _TEEN
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-Teen EDU 1.18");
+ #else
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A EDU 1.18");
+ #endif
+ #endif
+ #if _SCHOOL & _PERSO
+ #if _TEEN
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-Teen PERSO 1.18");
+ #else
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A PERSO 1.18");
+ #endif
+ #endif
+ #if _SCHOOL & _CEEBOTDEMO
+ #if _TEEN
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-Teen DEMO 1.18");
+ #else
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A DEMO 1.18");
+ #endif
+ #endif
+ #if _DEMO
+ if ( num == RT_VERSION_ID ) strcpy(text, "Demo 1.18 /e");
+ #endif
+ if ( num == RT_DISINFO_TITLE ) strcpy(text, "SatCom");
+ if ( num == RT_WINDOW_MAXIMIZED ) strcpy(text, "Maximize");
+ if ( num == RT_WINDOW_MINIMIZED ) strcpy(text, "Minimize");
+ if ( num == RT_WINDOW_STANDARD ) strcpy(text, "Normal size");
+ if ( num == RT_WINDOW_CLOSE ) strcpy(text, "Close");
+
+ if ( num == RT_STUDIO_TITLE ) strcpy(text, "Program editor");
+ if ( num == RT_SCRIPT_NEW ) strcpy(text, "New");
+ if ( num == RT_NAME_DEFAULT ) strcpy(text, "Player");
+ if ( num == RT_IO_NEW ) strcpy(text, "New ...");
+ if ( num == RT_KEY_OR ) strcpy(text, " or ");
+
+#if _NEWLOOK
+ if ( num == RT_TITLE_BASE ) strcpy(text, "CeeBot");
+ if ( num == RT_TITLE_INIT ) strcpy(text, "CeeBot");
+#else
+ if ( num == RT_TITLE_BASE ) strcpy(text, "COLOBOT");
+ if ( num == RT_TITLE_INIT ) strcpy(text, "COLOBOT");
+#endif
+ if ( num == RT_TITLE_TRAINER ) strcpy(text, "Programming exercises");
+ if ( num == RT_TITLE_DEFI ) strcpy(text, "Challenges");
+ if ( num == RT_TITLE_MISSION ) strcpy(text, "Missions");
+ if ( num == RT_TITLE_FREE ) strcpy(text, "Free game");
+ if ( num == RT_TITLE_TEEN ) strcpy(text, "Free game");
+ if ( num == RT_TITLE_USER ) strcpy(text, "User levels");
+ if ( num == RT_TITLE_PROTO ) strcpy(text, "Prototypes");
+ if ( num == RT_TITLE_SETUP ) strcpy(text, "Options");
+ if ( num == RT_TITLE_NAME ) strcpy(text, "Player's name");
+ if ( num == RT_TITLE_PERSO ) strcpy(text, "Customize your appearance");
+ if ( num == RT_TITLE_WRITE ) strcpy(text, "Save the current mission");
+ if ( num == RT_TITLE_READ ) strcpy(text, "Load a saved mission");
+
+ if ( num == RT_PLAY_CHAPt ) strcpy(text, " Chapters:");
+ if ( num == RT_PLAY_CHAPd ) strcpy(text, " Chapters:");
+ if ( num == RT_PLAY_CHAPm ) strcpy(text, " Planets:");
+ if ( num == RT_PLAY_CHAPf ) strcpy(text, " Planets:");
+ if ( num == RT_PLAY_CHAPu ) strcpy(text, " User levels:");
+ if ( num == RT_PLAY_CHAPp ) strcpy(text, " Planets:");
+ if ( num == RT_PLAY_CHAPte ) strcpy(text, " Chapters:");
+ if ( num == RT_PLAY_LISTt ) strcpy(text, " Exercises in the chapter:");
+ if ( num == RT_PLAY_LISTd ) strcpy(text, " Challenges in the chapter:");
+ if ( num == RT_PLAY_LISTm ) strcpy(text, " Missions on this planet:");
+ if ( num == RT_PLAY_LISTf ) strcpy(text, " Free game on this planet:");
+ if ( num == RT_PLAY_LISTu ) strcpy(text, " Missions on this level:");
+ if ( num == RT_PLAY_LISTp ) strcpy(text, " Prototypes on this planet:");
+ if ( num == RT_PLAY_LISTk ) strcpy(text, " Free game on this chapter:");
+ if ( num == RT_PLAY_RESUME ) strcpy(text, " Summary:");
+
+ if ( num == RT_SETUP_DEVICE ) strcpy(text, " Drivers:");
+ if ( num == RT_SETUP_MODE ) strcpy(text, " Resolution:");
+ if ( num == RT_SETUP_KEY1 ) strcpy(text, "1) First click on the key you want to redefine.");
+ if ( num == RT_SETUP_KEY2 ) strcpy(text, "2) Then press the key you want to use instead.");
+
+ if ( num == RT_PERSO_FACE ) strcpy(text, "Face type:");
+ if ( num == RT_PERSO_GLASSES ) strcpy(text, "Eyeglasses:");
+ if ( num == RT_PERSO_HAIR ) strcpy(text, "Hair color:");
+ if ( num == RT_PERSO_COMBI ) strcpy(text, "Suit color:");
+ if ( num == RT_PERSO_BAND ) strcpy(text, "Strip color:");
+
+#if _NEWLOOK
+ if ( num == RT_DIALOG_QUIT ) strcpy(text, "Do you want to quit CeeBot ?");
+ if ( num == RT_DIALOG_TITLE ) strcpy(text, "CeeBot");
+ if ( num == RT_DIALOG_YESQUIT ) strcpy(text, "Quit\\Quit CeeBot");
+#else
+ if ( num == RT_DIALOG_QUIT ) strcpy(text, "Do you want to quit COLOBOT ?");
+ if ( num == RT_DIALOG_TITLE ) strcpy(text, "COLOBOT");
+ if ( num == RT_DIALOG_YESQUIT ) strcpy(text, "Quit\\Quit COLOBOT");
+#endif
+ if ( num == RT_DIALOG_ABORT ) strcpy(text, "Quit the mission?");
+ if ( num == RT_DIALOG_YES ) strcpy(text, "Abort\\Abort the current mission");
+ if ( num == RT_DIALOG_NO ) strcpy(text, "Continue\\Continue the current mission");
+ if ( num == RT_DIALOG_NOQUIT ) strcpy(text, "Continue\\Continue the game");
+ if ( num == RT_DIALOG_DELOBJ ) strcpy(text, "Do you really want to destroy the selected building?");
+ if ( num == RT_DIALOG_DELGAME ) strcpy(text, "Do you want to delete %s's saved games? ");
+ if ( num == RT_DIALOG_YESDEL ) strcpy(text, "Delete");
+ if ( num == RT_DIALOG_NODEL ) strcpy(text, "Cancel");
+ if ( num == RT_DIALOG_LOADING ) strcpy(text, "LOADING");
+
+ if ( num == RT_STUDIO_LISTTT ) strcpy(text, "Keyword help(\\key cbot;)");
+ if ( num == RT_STUDIO_COMPOK ) strcpy(text, "Compilation ok (0 errors)");
+ if ( num == RT_STUDIO_PROGSTOP ) strcpy(text, "Program finished");
+
+ if ( num == RT_SATCOM_LIST ) strcpy(text, "\\b;List of objects\n");
+ if ( num == RT_SATCOM_BOT ) strcpy(text, "\\b;Robots\n");
+ if ( num == RT_SATCOM_BUILDING ) strcpy(text, "\\b;Buildings\n");
+ if ( num == RT_SATCOM_FRET ) strcpy(text, "\\b;Moveable objects\n");
+ if ( num == RT_SATCOM_ALIEN ) strcpy(text, "\\b;Aliens\n");
+ if ( num == RT_SATCOM_NULL ) strcpy(text, "\\c; (none)\\n;\n");
+ if ( num == RT_SATCOM_ERROR1 ) strcpy(text, "\\b;Error\n");
+ if ( num == RT_SATCOM_ERROR2 ) strcpy(text, "The list is only available if a \\l;radar station\\u object\\radar; is working.\n");
+
+ if ( num == RT_IO_OPEN ) strcpy(text, "Open");
+ if ( num == RT_IO_SAVE ) strcpy(text, "Save");
+ if ( num == RT_IO_LIST ) strcpy(text, "Folder: %s");
+ if ( num == RT_IO_NAME ) strcpy(text, "Name:");
+ if ( num == RT_IO_DIR ) strcpy(text, "Folder:");
+ if ( num == RT_IO_PRIVATE ) strcpy(text, "Private\\Private folder");
+ if ( num == RT_IO_PUBLIC ) strcpy(text, "Public\\Common folder");
+
+ if ( num == RT_GENERIC_DEV1 ) strcpy(text, "Developed by :");
+ if ( num == RT_GENERIC_DEV2 ) strcpy(text, "www.epsitec.com");
+//? if ( num == RT_GENERIC_EDIT1 ) strcpy(text, "English version published by:");
+//? if ( num == RT_GENERIC_EDIT2 ) strcpy(text, "www.?.com");
+ if ( num == RT_GENERIC_EDIT1 ) strcpy(text, " ");
+ if ( num == RT_GENERIC_EDIT2 ) strcpy(text, " ");
+
+ if ( num == RT_INTERFACE_REC ) strcpy(text, "Recorder");
+ }
+
+ if ( type == RES_EVENT )
+ {
+ if ( num == EVENT_BUTTON_OK ) strcpy(text, "OK");
+ if ( num == EVENT_BUTTON_CANCEL ) strcpy(text, "Cancel");
+ if ( num == EVENT_BUTTON_NEXT ) strcpy(text, "Next");
+ if ( num == EVENT_BUTTON_PREV ) strcpy(text, "Previous");
+ if ( num == EVENT_BUTTON_QUIT ) strcpy(text, "Menu (\\key quit;)");
+
+ if ( num == EVENT_DIALOG_OK ) strcpy(text, "OK");
+ if ( num == EVENT_DIALOG_CANCEL ) strcpy(text, "Cancel");
+
+ if ( num == EVENT_INTERFACE_TRAINER) strcpy(text, "Exercises\\Programming exercises");
+ if ( num == EVENT_INTERFACE_DEFI ) strcpy(text, "Challenges\\Programming challenges");
+ if ( num == EVENT_INTERFACE_MISSION) strcpy(text, "Missions\\Select mission");
+ if ( num == EVENT_INTERFACE_FREE ) strcpy(text, "Free game\\Free game without a specific goal");
+ if ( num == EVENT_INTERFACE_TEEN ) strcpy(text, "Free game\\Free game without a specific goal");
+ if ( num == EVENT_INTERFACE_USER ) strcpy(text, "User\\User levels");
+ if ( num == EVENT_INTERFACE_PROTO ) strcpy(text, "Proto\\Prototypes under development");
+ if ( num == EVENT_INTERFACE_NAME ) strcpy(text, "New player\\Choose player's name");
+ if ( num == EVENT_INTERFACE_SETUP ) strcpy(text, "Options\\Preferences");
+ if ( num == EVENT_INTERFACE_AGAIN ) strcpy(text, "Restart\\Restart the mission from the beginning");
+ if ( num == EVENT_INTERFACE_WRITE ) strcpy(text, "Save\\Save the current mission ");
+ if ( num == EVENT_INTERFACE_READ ) strcpy(text, "Load\\Load a saved mission");
+#if _NEWLOOK
+ if ( num == EVENT_INTERFACE_ABORT ) strcpy(text, "\\Return to CeeBot");
+ if ( num == EVENT_INTERFACE_QUIT ) strcpy(text, "Quit\\Quit CeeBot");
+#else
+ if ( num == EVENT_INTERFACE_ABORT ) strcpy(text, "\\Return to COLOBOT");
+ if ( num == EVENT_INTERFACE_QUIT ) strcpy(text, "Quit\\Quit COLOBOT");
+#endif
+ if ( num == EVENT_INTERFACE_BACK ) strcpy(text, "<< Back \\Back to the previous screen");
+ if ( num == EVENT_INTERFACE_PLAY ) strcpy(text, "Play\\Start mission!");
+ if ( num == EVENT_INTERFACE_SETUPd ) strcpy(text, "Device\\Driver and resolution settings");
+ if ( num == EVENT_INTERFACE_SETUPg ) strcpy(text, "Graphics\\Graphics settings");
+ if ( num == EVENT_INTERFACE_SETUPp ) strcpy(text, "Game\\Game settings");
+ if ( num == EVENT_INTERFACE_SETUPc ) strcpy(text, "Controls\\Keyboard, joystick and mouse settings");
+ if ( num == EVENT_INTERFACE_SETUPs ) strcpy(text, "Sound\\Music and game sound volume");
+ if ( num == EVENT_INTERFACE_DEVICE ) strcpy(text, "Unit");
+ if ( num == EVENT_INTERFACE_RESOL ) strcpy(text, "Resolution");
+ if ( num == EVENT_INTERFACE_FULL ) strcpy(text, "Full screen\\Full screen or window mode");
+ if ( num == EVENT_INTERFACE_APPLY ) strcpy(text, "Apply changes\\Activates the changed settings");
+
+ if ( num == EVENT_INTERFACE_TOTO ) strcpy(text, "Robbie\\Your assistant");
+ if ( num == EVENT_INTERFACE_SHADOW ) strcpy(text, "Shadows\\Shadows on the ground");
+ if ( num == EVENT_INTERFACE_GROUND ) strcpy(text, "Marks on the ground\\Marks on the ground");
+ if ( num == EVENT_INTERFACE_DIRTY ) strcpy(text, "Dust\\Dust and dirt on bots and buildings");
+ if ( num == EVENT_INTERFACE_FOG ) strcpy(text, "Fog\\Fog");
+ if ( num == EVENT_INTERFACE_LENS ) strcpy(text, "Sunbeams\\Sunbeams in the sky");
+ if ( num == EVENT_INTERFACE_SKY ) strcpy(text, "Sky\\Clouds and nebulae");
+ if ( num == EVENT_INTERFACE_PLANET ) strcpy(text, "Planets and stars\\Astronomical objects in the sky");
+ if ( num == EVENT_INTERFACE_LIGHT ) strcpy(text, "Dynamic lighting\\Mobile light sources");
+ if ( num == EVENT_INTERFACE_PARTI ) strcpy(text, "Number of particles\\Explosions, dust, reflections, etc.");
+ if ( num == EVENT_INTERFACE_CLIP ) strcpy(text, "Depth of field\\Maximum visibility");
+ if ( num == EVENT_INTERFACE_DETAIL ) strcpy(text, "Details\\Visual quality of 3D objects");
+ if ( num == EVENT_INTERFACE_TEXTURE) strcpy(text, "Textures\\Quality of textures ");
+ if ( num == EVENT_INTERFACE_GADGET ) strcpy(text, "Num of decorative objects\\Number of purely ornamental objects");
+ if ( num == EVENT_INTERFACE_RAIN ) strcpy(text, "Particles in the interface\\Steam clouds and sparks in the interface");
+ if ( num == EVENT_INTERFACE_GLINT ) strcpy(text, "Reflections on the buttons \\Shiny buttons");
+ if ( num == EVENT_INTERFACE_TOOLTIP) strcpy(text, "Help balloons\\Explain the function of the buttons");
+ if ( num == EVENT_INTERFACE_MOVIES ) strcpy(text, "Film sequences\\Films before and after the missions");
+ if ( num == EVENT_INTERFACE_NICERST) strcpy(text, "Exit film\\Film at the exit of exercises");
+ if ( num == EVENT_INTERFACE_HIMSELF) strcpy(text, "Friendly fire\\Your shooting can damage your own objects ");
+ if ( num == EVENT_INTERFACE_SCROLL ) strcpy(text, "Scrolling\\Scrolling when the mouse touches right or left border");
+ if ( num == EVENT_INTERFACE_INVERTX) strcpy(text, "Mouse inversion X\\Inversion of the scrolling direction on the X axis");
+ if ( num == EVENT_INTERFACE_INVERTY) strcpy(text, "Mouse inversion Y\\Inversion of the scrolling direction on the Y axis");
+ if ( num == EVENT_INTERFACE_EFFECT ) strcpy(text, "Quake at explosions\\The screen shakes at explosions");
+ if ( num == EVENT_INTERFACE_MOUSE ) strcpy(text, "Mouse shadow\\Gives the mouse a shadow");
+ if ( num == EVENT_INTERFACE_EDITMODE) strcpy(text, "Automatic indent\\When program editing");
+ if ( num == EVENT_INTERFACE_EDITVALUE)strcpy(text, "Big indent\\Indent 2 or 4 spaces per level defined by braces");
+ if ( num == EVENT_INTERFACE_SOLUCE4) strcpy(text, "Access to solutions\\Show program \"4: Solution\" in the exercises"); //**
+
+ if ( num == EVENT_INTERFACE_KDEF ) strcpy(text, "Standard controls\\Standard key functions");
+ if ( num == EVENT_INTERFACE_KLEFT ) strcpy(text, "Turn left\\turns the bot to the left");
+ if ( num == EVENT_INTERFACE_KRIGHT ) strcpy(text, "Turn right\\turns the bot to the right");
+ if ( num == EVENT_INTERFACE_KUP ) strcpy(text, "Forward\\Moves forward");
+ if ( num == EVENT_INTERFACE_KDOWN ) strcpy(text, "Backward\\Moves backward");
+ if ( num == EVENT_INTERFACE_KGUP ) strcpy(text, "Climb\\Increases the power of the jet");
+ if ( num == EVENT_INTERFACE_KGDOWN ) strcpy(text, "Descend\\Reduces the power of the jet");
+ if ( num == EVENT_INTERFACE_KCAMERA) strcpy(text, "Change camera\\Switches between onboard camera and following camera");
+ if ( num == EVENT_INTERFACE_KDESEL ) strcpy(text, "Previous object\\Selects the previous object");
+ if ( num == EVENT_INTERFACE_KACTION) strcpy(text, "Standard action\\Standard action of the bot (take/grab, shoot, sniff, etc)");
+ if ( num == EVENT_INTERFACE_KNEAR ) strcpy(text, "Camera closer\\Moves the camera forward");
+ if ( num == EVENT_INTERFACE_KAWAY ) strcpy(text, "Camera back\\Moves the camera backward");
+ if ( num == EVENT_INTERFACE_KNEXT ) strcpy(text, "Next object\\Selects the next object");
+ if ( num == EVENT_INTERFACE_KHUMAN ) strcpy(text, "Select the astronaut\\Selects the astronaut");
+ if ( num == EVENT_INTERFACE_KQUIT ) strcpy(text, "Quit\\Quit the current mission or exercise");
+ if ( num == EVENT_INTERFACE_KHELP ) strcpy(text, "Instructions\\Shows the instructions for the current mission");
+ if ( num == EVENT_INTERFACE_KPROG ) strcpy(text, "Programming help\\Gives more detailed help with programming");
+ if ( num == EVENT_INTERFACE_KCBOT ) strcpy(text, "Key word help\\More detailed help about key words");
+ if ( num == EVENT_INTERFACE_KVISIT ) strcpy(text, "Origin of last message\\Shows where the last message was sent from");
+ if ( num == EVENT_INTERFACE_KSPEED10) strcpy(text, "Speed 1.0x\\Normal speed");
+ if ( num == EVENT_INTERFACE_KSPEED15) strcpy(text, "Speed 1.5x\\1.5 times faster");
+ if ( num == EVENT_INTERFACE_KSPEED20) strcpy(text, "Speed 2.0x\\Double speed");
+ if ( num == EVENT_INTERFACE_KSPEED30) strcpy(text, "Speed 3.0x\\Three times faster");
+
+ if ( num == EVENT_INTERFACE_VOLSOUND) strcpy(text, "Sound effects:\\Volume of engines, voice, shooting, etc.");
+ if ( num == EVENT_INTERFACE_VOLMUSIC) strcpy(text, "Background sound :\\Volume of audio tracks on the CD");
+ if ( num == EVENT_INTERFACE_SOUND3D) strcpy(text, "3D sound\\3D positioning of the sound");
+
+ if ( num == EVENT_INTERFACE_MIN ) strcpy(text, "Lowest\\Minimum graphic quality (highest frame rate)");
+ if ( num == EVENT_INTERFACE_NORM ) strcpy(text, "Normal\\Normal graphic quality");
+ if ( num == EVENT_INTERFACE_MAX ) strcpy(text, "Highest\\Highest graphic quality (lowest frame rate)");
+
+ if ( num == EVENT_INTERFACE_SILENT ) strcpy(text, "Mute\\No sound");
+ if ( num == EVENT_INTERFACE_NOISY ) strcpy(text, "Normal\\Normal sound volume");
+
+ if ( num == EVENT_INTERFACE_JOYSTICK) strcpy(text, "Use a joystick\\Joystick or keyboard");
+ if ( num == EVENT_INTERFACE_SOLUCE ) strcpy(text, "Access to solution\\Shows the solution (detailed instructions for missions)");
+
+ if ( num == EVENT_INTERFACE_NEDIT ) strcpy(text, "\\New player name");
+ if ( num == EVENT_INTERFACE_NOK ) strcpy(text, "OK\\Choose the selected player");
+ if ( num == EVENT_INTERFACE_NCANCEL) strcpy(text, "Cancel\\Keep current player name");
+ if ( num == EVENT_INTERFACE_NDELETE) strcpy(text, "Delete player\\Deletes the player from the list");
+ if ( num == EVENT_INTERFACE_NLABEL ) strcpy(text, "Player name");
+
+ if ( num == EVENT_INTERFACE_IOWRITE) strcpy(text, "Save\\Saves the current mission");
+ if ( num == EVENT_INTERFACE_IOREAD ) strcpy(text, "Load\\Loads the selected mission");
+ if ( num == EVENT_INTERFACE_IOLIST ) strcpy(text, "List of saved missions");
+ if ( num == EVENT_INTERFACE_IOLABEL) strcpy(text, "Filename:");
+ if ( num == EVENT_INTERFACE_IONAME ) strcpy(text, "Mission name");
+ if ( num == EVENT_INTERFACE_IOIMAGE) strcpy(text, "Photography");
+ if ( num == EVENT_INTERFACE_IODELETE) strcpy(text, "Delete\\Deletes the selected file");
+
+ if ( num == EVENT_INTERFACE_PERSO ) strcpy(text, "Appearance\\Choose your appearance");
+ if ( num == EVENT_INTERFACE_POK ) strcpy(text, "OK");
+ if ( num == EVENT_INTERFACE_PCANCEL) strcpy(text, "Cancel");
+ if ( num == EVENT_INTERFACE_PDEF ) strcpy(text, "Standard\\Standard appearance settings");
+ if ( num == EVENT_INTERFACE_PHEAD ) strcpy(text, "Head\\Face and hair");
+ if ( num == EVENT_INTERFACE_PBODY ) strcpy(text, "Suit\\Astronaut suit");
+ if ( num == EVENT_INTERFACE_PLROT ) strcpy(text, "\\Turn left");
+ if ( num == EVENT_INTERFACE_PRROT ) strcpy(text, "\\Turn right");
+ if ( num == EVENT_INTERFACE_PCRa ) strcpy(text, "Red");
+ if ( num == EVENT_INTERFACE_PCGa ) strcpy(text, "Green");
+ if ( num == EVENT_INTERFACE_PCBa ) strcpy(text, "Blue");
+ if ( num == EVENT_INTERFACE_PCRb ) strcpy(text, "Red");
+ if ( num == EVENT_INTERFACE_PCGb ) strcpy(text, "Green");
+ if ( num == EVENT_INTERFACE_PCBb ) strcpy(text, "Blue");
+ if ( num == EVENT_INTERFACE_PFACE1 ) strcpy(text, "\\Face 1");
+ if ( num == EVENT_INTERFACE_PFACE2 ) strcpy(text, "\\Face 4");
+ if ( num == EVENT_INTERFACE_PFACE3 ) strcpy(text, "\\Face 3");
+ if ( num == EVENT_INTERFACE_PFACE4 ) strcpy(text, "\\Face 2");
+ if ( num == EVENT_INTERFACE_PGLASS0) strcpy(text, "\\No eyeglasses");
+ if ( num == EVENT_INTERFACE_PGLASS1) strcpy(text, "\\Eyeglasses 1");
+ if ( num == EVENT_INTERFACE_PGLASS2) strcpy(text, "\\Eyeglasses 2");
+ if ( num == EVENT_INTERFACE_PGLASS3) strcpy(text, "\\Eyeglasses 3");
+ if ( num == EVENT_INTERFACE_PGLASS4) strcpy(text, "\\Eyeglasses 4");
+ if ( num == EVENT_INTERFACE_PGLASS5) strcpy(text, "\\Eyeglasses 5");
+
+ if ( num == EVENT_OBJECT_DESELECT ) strcpy(text, "Previous selection (\\key desel;)");
+ if ( num == EVENT_OBJECT_LEFT ) strcpy(text, "Turn left (\\key left;)");
+ if ( num == EVENT_OBJECT_RIGHT ) strcpy(text, "Turn right (\\key right;)");
+ if ( num == EVENT_OBJECT_UP ) strcpy(text, "Forward (\\key up;)");
+ if ( num == EVENT_OBJECT_DOWN ) strcpy(text, "Backward (\\key down;)");
+ if ( num == EVENT_OBJECT_GASUP ) strcpy(text, "Up (\\key gup;)");
+ if ( num == EVENT_OBJECT_GASDOWN ) strcpy(text, "Down (\\key gdown;)");
+ if ( num == EVENT_OBJECT_HTAKE ) strcpy(text, "Grab or drop (\\key action;)");
+ if ( num == EVENT_OBJECT_MTAKE ) strcpy(text, "Grab or drop (\\key action;)");
+ if ( num == EVENT_OBJECT_MFRONT ) strcpy(text, "..in front");
+ if ( num == EVENT_OBJECT_MBACK ) strcpy(text, "..behind");
+ if ( num == EVENT_OBJECT_MPOWER ) strcpy(text, "..power cell");
+ if ( num == EVENT_OBJECT_BHELP ) strcpy(text, "Instructions for the mission (\\key help;)");
+ if ( num == EVENT_OBJECT_BTAKEOFF ) strcpy(text, "Take off to finish the mission");
+ if ( num == EVENT_OBJECT_BDERRICK ) strcpy(text, "Build a derrick");
+ if ( num == EVENT_OBJECT_BSTATION ) strcpy(text, "Build a power station");
+ if ( num == EVENT_OBJECT_BFACTORY ) strcpy(text, "Build a bot factory");
+ if ( num == EVENT_OBJECT_BREPAIR ) strcpy(text, "Build a repair center");
+ if ( num == EVENT_OBJECT_BCONVERT ) strcpy(text, "Build a converter");
+ if ( num == EVENT_OBJECT_BTOWER ) strcpy(text, "Build a defense tower");
+ if ( num == EVENT_OBJECT_BRESEARCH ) strcpy(text, "Build a research center");
+ if ( num == EVENT_OBJECT_BRADAR ) strcpy(text, "Build a radar station");
+ if ( num == EVENT_OBJECT_BENERGY ) strcpy(text, "Build a power cell factory");
+ if ( num == EVENT_OBJECT_BLABO ) strcpy(text, "Build an autolab");
+ if ( num == EVENT_OBJECT_BNUCLEAR ) strcpy(text, "Build a nuclear power plant");
+ if ( num == EVENT_OBJECT_BPARA ) strcpy(text, "Build a lightning conductor");
+ if ( num == EVENT_OBJECT_BINFO ) strcpy(text, "Build a exchange post");
+ if ( num == EVENT_OBJECT_GFLAT ) strcpy(text, "Show if the ground is flat");
+ if ( num == EVENT_OBJECT_FCREATE ) strcpy(text, "Plant a flag");
+ if ( num == EVENT_OBJECT_FDELETE ) strcpy(text, "Remove a flag");
+ if ( num == EVENT_OBJECT_FCOLORb ) strcpy(text, "\\Blue flags");
+ if ( num == EVENT_OBJECT_FCOLORr ) strcpy(text, "\\Red flags");
+ if ( num == EVENT_OBJECT_FCOLORg ) strcpy(text, "\\Green flags");
+ if ( num == EVENT_OBJECT_FCOLORy ) strcpy(text, "\\Yellow flags");
+ if ( num == EVENT_OBJECT_FCOLORv ) strcpy(text, "\\Violet flags");
+ if ( num == EVENT_OBJECT_FACTORYfa ) strcpy(text, "Build a winged grabber");
+ if ( num == EVENT_OBJECT_FACTORYta ) strcpy(text, "Build a tracked grabber");
+ if ( num == EVENT_OBJECT_FACTORYwa ) strcpy(text, "Build a wheeled grabber");
+ if ( num == EVENT_OBJECT_FACTORYia ) strcpy(text, "Build a legged grabber");
+ if ( num == EVENT_OBJECT_FACTORYfc ) strcpy(text, "Build a winged shooter");
+ if ( num == EVENT_OBJECT_FACTORYtc ) strcpy(text, "Build a tracked shooter");
+ if ( num == EVENT_OBJECT_FACTORYwc ) strcpy(text, "Build a wheeled shooter");
+ if ( num == EVENT_OBJECT_FACTORYic ) strcpy(text, "Build a legged shooter");
+ if ( num == EVENT_OBJECT_FACTORYfi ) strcpy(text, "Build a winged orga shooter");
+ if ( num == EVENT_OBJECT_FACTORYti ) strcpy(text, "Build a tracked orga shooter");
+ if ( num == EVENT_OBJECT_FACTORYwi ) strcpy(text, "Build a wheeled orga shooter");
+ if ( num == EVENT_OBJECT_FACTORYii ) strcpy(text, "Build a legged orga shooter");
+ if ( num == EVENT_OBJECT_FACTORYfs ) strcpy(text, "Build a winged sniffer");
+ if ( num == EVENT_OBJECT_FACTORYts ) strcpy(text, "Build a tracked sniffer");
+ if ( num == EVENT_OBJECT_FACTORYws ) strcpy(text, "Build a wheeled sniffer");
+ if ( num == EVENT_OBJECT_FACTORYis ) strcpy(text, "Build a legged sniffer");
+ if ( num == EVENT_OBJECT_FACTORYrt ) strcpy(text, "Build a thumper");
+ if ( num == EVENT_OBJECT_FACTORYrc ) strcpy(text, "Build a phazer shooter");
+ if ( num == EVENT_OBJECT_FACTORYrr ) strcpy(text, "Build a recycler");
+ if ( num == EVENT_OBJECT_FACTORYrs ) strcpy(text, "Build a shielder");
+ if ( num == EVENT_OBJECT_FACTORYsa ) strcpy(text, "Build a subber");
+ if ( num == EVENT_OBJECT_RTANK ) strcpy(text, "Run research program for tracked bots");
+ if ( num == EVENT_OBJECT_RFLY ) strcpy(text, "Run research program for winged bots");
+ if ( num == EVENT_OBJECT_RTHUMP ) strcpy(text, "Run research program for thumper");
+ if ( num == EVENT_OBJECT_RCANON ) strcpy(text, "Run research program for shooter");
+ if ( num == EVENT_OBJECT_RTOWER ) strcpy(text, "Run research program for defense tower");
+ if ( num == EVENT_OBJECT_RPHAZER ) strcpy(text, "Run research program for phazer shooter");
+ if ( num == EVENT_OBJECT_RSHIELD ) strcpy(text, "Run research program for shielder");
+ if ( num == EVENT_OBJECT_RATOMIC ) strcpy(text, "Run research program for nuclear power");
+ if ( num == EVENT_OBJECT_RiPAW ) strcpy(text, "Run research program for legged bots");
+ if ( num == EVENT_OBJECT_RiGUN ) strcpy(text, "Run research program for orga shooter");
+ if ( num == EVENT_OBJECT_RESET ) strcpy(text, "Return to start");
+ if ( num == EVENT_OBJECT_SEARCH ) strcpy(text, "Sniff (\\key action;)");
+ if ( num == EVENT_OBJECT_TERRAFORM ) strcpy(text, "Thump (\\key action;)");
+ if ( num == EVENT_OBJECT_FIRE ) strcpy(text, "Shoot (\\key action;)");
+ if ( num == EVENT_OBJECT_RECOVER ) strcpy(text, "Recycle (\\key action;)");
+ if ( num == EVENT_OBJECT_BEGSHIELD ) strcpy(text, "Extend shield (\\key action;)");
+ if ( num == EVENT_OBJECT_ENDSHIELD ) strcpy(text, "Withdraw shield (\\key action;)");
+ if ( num == EVENT_OBJECT_DIMSHIELD ) strcpy(text, "Shield radius");
+ if ( num == EVENT_OBJECT_PROGRUN ) strcpy(text, "Execute the selected program");
+ if ( num == EVENT_OBJECT_PROGEDIT ) strcpy(text, "Edit the selected program");
+ if ( num == EVENT_OBJECT_INFOOK ) strcpy(text, "\\SatCom on standby");
+ if ( num == EVENT_OBJECT_DELETE ) strcpy(text, "Destroy the building");
+ if ( num == EVENT_OBJECT_GENERGY ) strcpy(text, "Energy level");
+ if ( num == EVENT_OBJECT_GSHIELD ) strcpy(text, "Shield level");
+ if ( num == EVENT_OBJECT_GRANGE ) strcpy(text, "Jet temperature");
+ if ( num == EVENT_OBJECT_GPROGRESS ) strcpy(text, "Still working ...");
+ if ( num == EVENT_OBJECT_GRADAR ) strcpy(text, "Number of insects detected");
+ if ( num == EVENT_OBJECT_GINFO ) strcpy(text, "Transmitted information");
+ if ( num == EVENT_OBJECT_COMPASS ) strcpy(text, "Compass");
+//? if ( num == EVENT_OBJECT_MAP ) strcpy(text, "Mini-map");
+ if ( num == EVENT_OBJECT_MAPZOOM ) strcpy(text, "Zoom mini-map");
+ if ( num == EVENT_OBJECT_CAMERA ) strcpy(text, "Camera (\\key camera;)");
+ if ( num == EVENT_OBJECT_CAMERAleft) strcpy(text, "Camera to left");
+ if ( num == EVENT_OBJECT_CAMERAright) strcpy(text, "Camera to right");
+ if ( num == EVENT_OBJECT_CAMERAnear) strcpy(text, "Camera nearest");
+ if ( num == EVENT_OBJECT_CAMERAaway) strcpy(text, "Camera awayest");
+ if ( num == EVENT_OBJECT_HELP ) strcpy(text, "Help about selected object");
+ if ( num == EVENT_OBJECT_SOLUCE ) strcpy(text, "Show the solution");
+ if ( num == EVENT_OBJECT_SHORTCUT00) strcpy(text, "Switch bots <-> buildings");
+ if ( num == EVENT_OBJECT_LIMIT ) strcpy(text, "Show the range");
+ if ( num == EVENT_OBJECT_PEN0 ) strcpy(text, "\\Raise the pencil");
+ if ( num == EVENT_OBJECT_PEN1 ) strcpy(text, "\\Use the black pencil");
+ if ( num == EVENT_OBJECT_PEN2 ) strcpy(text, "\\Use the yellow pencil");
+ if ( num == EVENT_OBJECT_PEN3 ) strcpy(text, "\\Use the orange pencil");
+ if ( num == EVENT_OBJECT_PEN4 ) strcpy(text, "\\Use the red pencil");
+ if ( num == EVENT_OBJECT_PEN5 ) strcpy(text, "\\Use the purple pencil");
+ if ( num == EVENT_OBJECT_PEN6 ) strcpy(text, "\\Use the blue pencil");
+ if ( num == EVENT_OBJECT_PEN7 ) strcpy(text, "\\Use the green pencil");
+ if ( num == EVENT_OBJECT_PEN8 ) strcpy(text, "\\Use the brown pencil");
+ if ( num == EVENT_OBJECT_REC ) strcpy(text, "\\Start recording");
+ if ( num == EVENT_OBJECT_STOP ) strcpy(text, "\\Stop recording");
+ if ( num == EVENT_DT_VISIT0 ||
+ num == EVENT_DT_VISIT1 ||
+ num == EVENT_DT_VISIT2 ||
+ num == EVENT_DT_VISIT3 ||
+ num == EVENT_DT_VISIT4 ) strcpy(text, "Show the place");
+ if ( num == EVENT_DT_END ) strcpy(text, "Continue");
+ if ( num == EVENT_CMD ) strcpy(text, "Command line");
+ if ( num == EVENT_SPEED ) strcpy(text, "Game speed");
+
+ if ( num == EVENT_HYPER_PREV ) strcpy(text, "Back");
+ if ( num == EVENT_HYPER_NEXT ) strcpy(text, "Forward");
+ if ( num == EVENT_HYPER_HOME ) strcpy(text, "Home");
+ if ( num == EVENT_HYPER_COPY ) strcpy(text, "Copy");
+ if ( num == EVENT_HYPER_SIZE1 ) strcpy(text, "Size 1");
+ if ( num == EVENT_HYPER_SIZE2 ) strcpy(text, "Size 2");
+ if ( num == EVENT_HYPER_SIZE3 ) strcpy(text, "Size 3");
+ if ( num == EVENT_HYPER_SIZE4 ) strcpy(text, "Size 4");
+ if ( num == EVENT_HYPER_SIZE5 ) strcpy(text, "Size 5");
+ if ( num == EVENT_SATCOM_HUSTON ) strcpy(text, "Instructions from Houston");
+#if _TEEN
+ if ( num == EVENT_SATCOM_SAT ) strcpy(text, "Dictionnary");
+#else
+ if ( num == EVENT_SATCOM_SAT ) strcpy(text, "Satellite report");
+#endif
+ if ( num == EVENT_SATCOM_LOADING ) strcpy(text, "Programs dispatched by Houston");
+ if ( num == EVENT_SATCOM_OBJECT ) strcpy(text, "List of objects");
+ if ( num == EVENT_SATCOM_PROG ) strcpy(text, "Programming help");
+ if ( num == EVENT_SATCOM_SOLUCE ) strcpy(text, "Solution");
+
+ if ( num == EVENT_STUDIO_OK ) strcpy(text, "OK\\Close program editor and return to game");
+ if ( num == EVENT_STUDIO_CANCEL ) strcpy(text, "Cancel\\Cancel all changes");
+ if ( num == EVENT_STUDIO_NEW ) strcpy(text, "New");
+ if ( num == EVENT_STUDIO_OPEN ) strcpy(text, "Open (Ctrl+o)");
+ if ( num == EVENT_STUDIO_SAVE ) strcpy(text, "Save (Ctrl+s)");
+ if ( num == EVENT_STUDIO_UNDO ) strcpy(text, "Undo (Ctrl+z)");
+ if ( num == EVENT_STUDIO_CUT ) strcpy(text, "Cut (Ctrl+x)");
+ if ( num == EVENT_STUDIO_COPY ) strcpy(text, "Copy (Ctrl+c)");
+ if ( num == EVENT_STUDIO_PASTE ) strcpy(text, "Paste (Ctrl+v)");
+ if ( num == EVENT_STUDIO_SIZE ) strcpy(text, "Font size");
+ if ( num == EVENT_STUDIO_TOOL ) strcpy(text, "Instructions (\\key help;)");
+ if ( num == EVENT_STUDIO_HELP ) strcpy(text, "Programming help (\\key prog;)");
+ if ( num == EVENT_STUDIO_COMPILE ) strcpy(text, "Compile");
+ if ( num == EVENT_STUDIO_RUN ) strcpy(text, "Execute/stop");
+ if ( num == EVENT_STUDIO_REALTIME ) strcpy(text, "Pause/continue");
+ if ( num == EVENT_STUDIO_STEP ) strcpy(text, "One step");
+ }
+
+ if ( type == RES_OBJECT )
+ {
+ if ( num == OBJECT_PORTICO ) strcpy(text, "Gantry crane");
+ if ( num == OBJECT_BASE ) strcpy(text, "Spaceship");
+ if ( num == OBJECT_DERRICK ) strcpy(text, "Derrick");
+ if ( num == OBJECT_FACTORY ) strcpy(text, "Bot factory");
+ if ( num == OBJECT_REPAIR ) strcpy(text, "Repair center");
+ if ( num == OBJECT_DESTROYER ) strcpy(text, "Destroyer");
+ if ( num == OBJECT_STATION ) strcpy(text, "Power station");
+ if ( num == OBJECT_CONVERT ) strcpy(text, "Converts ore to titanium");
+ if ( num == OBJECT_TOWER ) strcpy(text, "Defense tower");
+ if ( num == OBJECT_NEST ) strcpy(text, "Nest");
+ if ( num == OBJECT_RESEARCH ) strcpy(text, "Research center");
+ if ( num == OBJECT_RADAR ) strcpy(text, "Radar station");
+ if ( num == OBJECT_INFO ) strcpy(text, "Information exchange post");
+#if _TEEN
+ if ( num == OBJECT_ENERGY ) strcpy(text, "Power cell factory");
+#else
+ if ( num == OBJECT_ENERGY ) strcpy(text, "Power cell factory");
+#endif
+ if ( num == OBJECT_LABO ) strcpy(text, "Autolab");
+ if ( num == OBJECT_NUCLEAR ) strcpy(text, "Nuclear power station");
+ if ( num == OBJECT_PARA ) strcpy(text, "Lightning conductor");
+ if ( num == OBJECT_SAFE ) strcpy(text, "Vault");
+ if ( num == OBJECT_HUSTON ) strcpy(text, "Houston Mission Control");
+ if ( num == OBJECT_TARGET1 ) strcpy(text, "Target");
+ if ( num == OBJECT_TARGET2 ) strcpy(text, "Target");
+ if ( num == OBJECT_START ) strcpy(text, "Start");
+ if ( num == OBJECT_END ) strcpy(text, "Finish");
+ if ( num == OBJECT_STONE ) strcpy(text, "Titanium ore");
+ if ( num == OBJECT_URANIUM ) strcpy(text, "Uranium ore");
+ if ( num == OBJECT_BULLET ) strcpy(text, "Organic matter");
+ if ( num == OBJECT_METAL ) strcpy(text, "Titanium");
+ if ( num == OBJECT_POWER ) strcpy(text, "Power cell");
+ if ( num == OBJECT_ATOMIC ) strcpy(text, "Nuclear power cell");
+ if ( num == OBJECT_BBOX ) strcpy(text, "Black box");
+ if ( num == OBJECT_KEYa ) strcpy(text, "Key A");
+ if ( num == OBJECT_KEYb ) strcpy(text, "Key B");
+ if ( num == OBJECT_KEYc ) strcpy(text, "Key C");
+ if ( num == OBJECT_KEYd ) strcpy(text, "Key D");
+ if ( num == OBJECT_TNT ) strcpy(text, "Explosive");
+ if ( num == OBJECT_BOMB ) strcpy(text, "Fixed mine");
+ if ( num == OBJECT_BAG ) strcpy(text, "Survival kit");
+ if ( num == OBJECT_WAYPOINT ) strcpy(text, "Checkpoint");
+ if ( num == OBJECT_FLAGb ) strcpy(text, "Blue flag");
+ if ( num == OBJECT_FLAGr ) strcpy(text, "Red flag");
+ if ( num == OBJECT_FLAGg ) strcpy(text, "Green flag");
+ if ( num == OBJECT_FLAGy ) strcpy(text, "Yellow flag");
+ if ( num == OBJECT_FLAGv ) strcpy(text, "Violet flag");
+ if ( num == OBJECT_MARKPOWER ) strcpy(text, "Energy deposit (site for power station)");
+ if ( num == OBJECT_MARKURANIUM ) strcpy(text, "Uranium deposit (site for derrick)");
+ if ( num == OBJECT_MARKKEYa ) strcpy(text, "Found key A (site for derrick)");
+ if ( num == OBJECT_MARKKEYb ) strcpy(text, "Found key B (site for derrick)");
+ if ( num == OBJECT_MARKKEYc ) strcpy(text, "Found key C (site for derrick)");
+ if ( num == OBJECT_MARKKEYd ) strcpy(text, "Found key D (site for derrick)");
+ if ( num == OBJECT_MARKSTONE ) strcpy(text, "Titanium deposit (site for derrick)");
+ if ( num == OBJECT_MOBILEft ) strcpy(text, "Practice bot");
+ if ( num == OBJECT_MOBILEtt ) strcpy(text, "Practice bot");
+ if ( num == OBJECT_MOBILEwt ) strcpy(text, "Practice bot");
+ if ( num == OBJECT_MOBILEit ) strcpy(text, "Practice bot");
+ if ( num == OBJECT_MOBILEfa ) strcpy(text, "Winged grabber");
+ if ( num == OBJECT_MOBILEta ) strcpy(text, "Tracked grabber");
+ if ( num == OBJECT_MOBILEwa ) strcpy(text, "Wheeled grabber");
+ if ( num == OBJECT_MOBILEia ) strcpy(text, "Legged grabber");
+ if ( num == OBJECT_MOBILEfc ) strcpy(text, "Winged shooter");
+ if ( num == OBJECT_MOBILEtc ) strcpy(text, "Tracked shooter");
+ if ( num == OBJECT_MOBILEwc ) strcpy(text, "Wheeled shooter");
+ if ( num == OBJECT_MOBILEic ) strcpy(text, "Legged shooter");
+ if ( num == OBJECT_MOBILEfi ) strcpy(text, "Winged orga shooter");
+ if ( num == OBJECT_MOBILEti ) strcpy(text, "Tracked orga shooter");
+ if ( num == OBJECT_MOBILEwi ) strcpy(text, "Wheeled orga shooter");
+ if ( num == OBJECT_MOBILEii ) strcpy(text, "Legged orga shooter");
+ if ( num == OBJECT_MOBILEfs ) strcpy(text, "Winged sniffer");
+ if ( num == OBJECT_MOBILEts ) strcpy(text, "Tracked sniffer");
+ if ( num == OBJECT_MOBILEws ) strcpy(text, "Wheeled sniffer");
+ if ( num == OBJECT_MOBILEis ) strcpy(text, "Legged sniffer");
+ if ( num == OBJECT_MOBILErt ) strcpy(text, "Thumper");
+ if ( num == OBJECT_MOBILErc ) strcpy(text, "Phazer shooter");
+ if ( num == OBJECT_MOBILErr ) strcpy(text, "Recycler");
+ if ( num == OBJECT_MOBILErs ) strcpy(text, "Shielder");
+ if ( num == OBJECT_MOBILEsa ) strcpy(text, "Subber");
+ if ( num == OBJECT_MOBILEtg ) strcpy(text, "Target bot");
+ if ( num == OBJECT_MOBILEdr ) strcpy(text, "Drawer bot");
+ if ( num == OBJECT_HUMAN ) strcpy(text, g_gamerName);
+ if ( num == OBJECT_TECH ) strcpy(text, "Engineer");
+ if ( num == OBJECT_TOTO ) strcpy(text, "Robbie");
+ if ( num == OBJECT_MOTHER ) strcpy(text, "Alien Queen");
+ if ( num == OBJECT_ANT ) strcpy(text, "Ant");
+ if ( num == OBJECT_SPIDER ) strcpy(text, "Spider");
+ if ( num == OBJECT_BEE ) strcpy(text, "Wasp");
+ if ( num == OBJECT_WORM ) strcpy(text, "Worm");
+ if ( num == OBJECT_EGG ) strcpy(text, "Egg");
+ if ( num == OBJECT_RUINmobilew1 ) strcpy(text, "Wreckage");
+ if ( num == OBJECT_RUINmobilew2 ) strcpy(text, "Wreckage");
+ if ( num == OBJECT_RUINmobilet1 ) strcpy(text, "Wreckage");
+ if ( num == OBJECT_RUINmobilet2 ) strcpy(text, "Wreckage");
+ if ( num == OBJECT_RUINmobiler1 ) strcpy(text, "Wreckage");
+ if ( num == OBJECT_RUINmobiler2 ) strcpy(text, "Wreckage");
+ if ( num == OBJECT_RUINfactory ) strcpy(text, "Ruin");
+ if ( num == OBJECT_RUINdoor ) strcpy(text, "Ruin");
+ if ( num == OBJECT_RUINsupport ) strcpy(text, "Waste");
+ if ( num == OBJECT_RUINradar ) strcpy(text, "Ruin");
+ if ( num == OBJECT_RUINconvert ) strcpy(text, "Ruin");
+ if ( num == OBJECT_RUINbase ) strcpy(text, "Spaceship ruin");
+ if ( num == OBJECT_RUINhead ) strcpy(text, "Spaceship ruin");
+ if ( num == OBJECT_APOLLO1 ||
+ num == OBJECT_APOLLO3 ||
+ num == OBJECT_APOLLO4 ||
+ num == OBJECT_APOLLO5 ) strcpy(text, "Remains of Apollo mission");
+ if ( num == OBJECT_APOLLO2 ) strcpy(text, "Lunar Roving Vehicle");
+ }
+
+ if ( type == RES_ERR )
+ {
+ strcpy(text, "Error");
+ if ( num == ERR_CMD ) strcpy(text, "Unknown command");
+#if _NEWLOOK
+ if ( num == ERR_INSTALL ) strcpy(text, "CeeBot not installed.");
+ if ( num == ERR_NOCD ) strcpy(text, "Please insert the CeeBot CD\nand re-run the game.");
+#else
+ if ( num == ERR_INSTALL ) strcpy(text, "COLOBOT not installed.");
+ if ( num == ERR_NOCD ) strcpy(text, "Please insert the COLOBOT CD\nand re-run the game.");
+#endif
+ if ( num == ERR_MANIP_VEH ) strcpy(text, "Inappropriate bot");
+ if ( num == ERR_MANIP_FLY ) strcpy(text, "Impossible when flying");
+ if ( num == ERR_MANIP_BUSY ) strcpy(text, "Already carrying something");
+ if ( num == ERR_MANIP_NIL ) strcpy(text, "Nothing to grab");
+ if ( num == ERR_MANIP_MOTOR ) strcpy(text, "Impossible when moving");
+ if ( num == ERR_MANIP_OCC ) strcpy(text, "Place occupied");
+ if ( num == ERR_MANIP_FRIEND ) strcpy(text, "No other robot");
+ if ( num == ERR_MANIP_RADIO ) strcpy(text, "You can not carry a radioactive object");
+ if ( num == ERR_MANIP_WATER ) strcpy(text, "You can not carry an object under water");
+ if ( num == ERR_MANIP_EMPTY ) strcpy(text, "Nothing to drop");
+ if ( num == ERR_BUILD_FLY ) strcpy(text, "Impossible when flying");
+ if ( num == ERR_BUILD_WATER ) strcpy(text, "Impossible under water");
+ if ( num == ERR_BUILD_ENERGY ) strcpy(text, "Not enough energy");
+ if ( num == ERR_BUILD_METALAWAY ) strcpy(text, "Titanium too far away");
+ if ( num == ERR_BUILD_METALNEAR ) strcpy(text, "Titanium too close");
+ if ( num == ERR_BUILD_METALINEX ) strcpy(text, "No titanium around");
+ if ( num == ERR_BUILD_FLAT ) strcpy(text, "Ground not flat enough");
+ if ( num == ERR_BUILD_FLATLIT ) strcpy(text, "Flat ground not large enough");
+ if ( num == ERR_BUILD_BUSY ) strcpy(text, "Place occupied");
+ if ( num == ERR_BUILD_BASE ) strcpy(text, "Too close to space ship");
+ if ( num == ERR_BUILD_NARROW ) strcpy(text, "Too close to a building");
+ if ( num == ERR_BUILD_MOTOR ) strcpy(text, "Impossible when moving");
+ if ( num == ERR_SEARCH_FLY ) strcpy(text, "Impossible when flying");
+ if ( num == ERR_SEARCH_VEH ) strcpy(text, "Inappropriate bot");
+ if ( num == ERR_SEARCH_MOTOR ) strcpy(text, "Impossible when moving");
+ if ( num == ERR_TERRA_VEH ) strcpy(text, "Inappropriate bot");
+ if ( num == ERR_TERRA_ENERGY ) strcpy(text, "Not enough energy");
+ if ( num == ERR_TERRA_FLOOR ) strcpy(text, "Ground inappropriate");
+ if ( num == ERR_TERRA_BUILDING ) strcpy(text, "Building too close");
+ if ( num == ERR_TERRA_OBJECT ) strcpy(text, "Object too close");
+ if ( num == ERR_RECOVER_VEH ) strcpy(text, "Inappropriate bot");
+ if ( num == ERR_RECOVER_ENERGY ) strcpy(text, "Not enough energy");
+ if ( num == ERR_RECOVER_NULL ) strcpy(text, "Nothing to recycle");
+ if ( num == ERR_SHIELD_VEH ) strcpy(text, "Inappropriate bot");
+ if ( num == ERR_SHIELD_ENERGY ) strcpy(text, "No more energy");
+ if ( num == ERR_MOVE_IMPOSSIBLE ) strcpy(text, "Error in instruction move");
+ if ( num == ERR_FIND_IMPOSSIBLE ) strcpy(text, "Object not found");
+ if ( num == ERR_GOTO_IMPOSSIBLE ) strcpy(text, "Goto: inaccessible destination");
+ if ( num == ERR_GOTO_ITER ) strcpy(text, "Goto: inaccessible destination");
+ if ( num == ERR_GOTO_BUSY ) strcpy(text, "Goto: destination occupied");
+ if ( num == ERR_FIRE_VEH ) strcpy(text, "Inappropriate bot");
+ if ( num == ERR_FIRE_ENERGY ) strcpy(text, "Not enough energy");
+ if ( num == ERR_FIRE_FLY ) strcpy(text, "Impossible when flying");
+ if ( num == ERR_CONVERT_EMPTY ) strcpy(text, "No titanium ore to convert");
+ if ( num == ERR_DERRICK_NULL ) strcpy(text, "No ore in the subsoil");
+ if ( num == ERR_STATION_NULL ) strcpy(text, "No energy in the subsoil");
+ if ( num == ERR_TOWER_POWER ) strcpy(text, "No power cell");
+ if ( num == ERR_TOWER_ENERGY ) strcpy(text, "No more energy");
+ if ( num == ERR_RESEARCH_POWER ) strcpy(text, "No power cell");
+ if ( num == ERR_RESEARCH_ENERGY ) strcpy(text, "Not enough energy");
+ if ( num == ERR_RESEARCH_TYPE ) strcpy(text, "Inappropriate cell type");
+ if ( num == ERR_RESEARCH_ALREADY) strcpy(text, "Research program already performed");
+ if ( num == ERR_ENERGY_NULL ) strcpy(text, "No energy in the subsoil");
+ if ( num == ERR_ENERGY_LOW ) strcpy(text, "Not enough energy yet");
+ if ( num == ERR_ENERGY_EMPTY ) strcpy(text, "No titanium to transform");
+ if ( num == ERR_ENERGY_BAD ) strcpy(text, "Transforms only titanium");
+ if ( num == ERR_BASE_DLOCK ) strcpy(text, "Doors blocked by a robot or another object ");
+ if ( num == ERR_BASE_DHUMAN ) strcpy(text, "You must get on the spaceship to take off ");
+ if ( num == ERR_LABO_NULL ) strcpy(text, "Nothing to analyze");
+ if ( num == ERR_LABO_BAD ) strcpy(text, "Analyzes only organic matter");
+ if ( num == ERR_LABO_ALREADY ) strcpy(text, "Analysis already performed");
+ if ( num == ERR_NUCLEAR_NULL ) strcpy(text, "No energy in the subsoil");
+ if ( num == ERR_NUCLEAR_LOW ) strcpy(text, "Not yet enough energy");
+ if ( num == ERR_NUCLEAR_EMPTY ) strcpy(text, "No uranium to transform");
+ if ( num == ERR_NUCLEAR_BAD ) strcpy(text, "Transforms only uranium");
+ if ( num == ERR_FACTORY_NULL ) strcpy(text, "No titanium");
+ if ( num == ERR_FACTORY_NEAR ) strcpy(text, "Object too close");
+ if ( num == ERR_RESET_NEAR ) strcpy(text, "Place occupied");
+ if ( num == ERR_INFO_NULL ) strcpy(text, "No information exchange post within range");
+ if ( num == ERR_VEH_VIRUS ) strcpy(text, "Program infected by a virus");
+ if ( num == ERR_BAT_VIRUS ) strcpy(text, "Infected by a virus, temporarily out of order");
+ if ( num == ERR_VEH_POWER ) strcpy(text, "No power cell");
+ if ( num == ERR_VEH_ENERGY ) strcpy(text, "No more energy");
+ if ( num == ERR_FLAG_FLY ) strcpy(text, "Impossible when flying");
+ if ( num == ERR_FLAG_WATER ) strcpy(text, "Impossible when swimming");
+ if ( num == ERR_FLAG_MOTOR ) strcpy(text, "Impossible when moving");
+ if ( num == ERR_FLAG_BUSY ) strcpy(text, "Impossible when carrying an object");
+ if ( num == ERR_FLAG_CREATE ) strcpy(text, "Too many flags of this color (maximum 5)");
+ if ( num == ERR_FLAG_PROXY ) strcpy(text, "Too close to an existing flag");
+ if ( num == ERR_FLAG_DELETE ) strcpy(text, "No flag nearby");
+ if ( num == ERR_MISSION_NOTERM ) strcpy(text, "The mission is not accomplished yet (press \\key help; for more details)");
+ if ( num == ERR_DELETEMOBILE ) strcpy(text, "Bot destroyed");
+ if ( num == ERR_DELETEBUILDING ) strcpy(text, "Building destroyed");
+ if ( num == ERR_TOOMANY ) strcpy(text, "Can not create this, there are too many objects");
+ if ( num == ERR_OBLIGATORYTOKEN ) strcpy(text, "\"%s\" missing in this exercise"); //**
+ if ( num == ERR_PROHIBITEDTOKEN ) strcpy(text, "Do not use in this exercise"); //**
+
+ if ( num == INFO_BUILD ) strcpy(text, "Building completed");
+ if ( num == INFO_CONVERT ) strcpy(text, "Titanium available");
+ if ( num == INFO_RESEARCH ) strcpy(text, "Research program completed");
+ if ( num == INFO_RESEARCHTANK ) strcpy(text, "Plans for tracked robots available ");
+ if ( num == INFO_RESEARCHFLY ) strcpy(text, "You can fly with the keys (\\key gup;) and (\\key gdown;)");
+ if ( num == INFO_RESEARCHTHUMP ) strcpy(text, "Plans for thumper available");
+ if ( num == INFO_RESEARCHCANON ) strcpy(text, "Plans for shooter available");
+ if ( num == INFO_RESEARCHTOWER ) strcpy(text, "Plans for defense tower available");
+ if ( num == INFO_RESEARCHPHAZER ) strcpy(text, "Plans for phazer shooter available");
+ if ( num == INFO_RESEARCHSHIELD ) strcpy(text, "Plans for shielder available");
+ if ( num == INFO_RESEARCHATOMIC ) strcpy(text, "Plans for nuclear power plant available");
+ if ( num == INFO_FACTORY ) strcpy(text, "New bot available");
+ if ( num == INFO_LABO ) strcpy(text, "Analysis performed");
+ if ( num == INFO_ENERGY ) strcpy(text, "Power cell available");
+ if ( num == INFO_NUCLEAR ) strcpy(text, "Nuclear power cell available");
+ if ( num == INFO_FINDING ) strcpy(text, "You found a usable object");
+ if ( num == INFO_MARKPOWER ) strcpy(text, "Found a site for power station");
+ if ( num == INFO_MARKURANIUM ) strcpy(text, "Found a site for a derrick");
+ if ( num == INFO_MARKSTONE ) strcpy(text, "Found a site for a derrick");
+ if ( num == INFO_MARKKEYa ) strcpy(text, "Found a site for a derrick");
+ if ( num == INFO_MARKKEYb ) strcpy(text, "Found a site for a derrick");
+ if ( num == INFO_MARKKEYc ) strcpy(text, "Found a site for a derrick");
+ if ( num == INFO_MARKKEYd ) strcpy(text, "Found a site for a derrick");
+ if ( num == INFO_WIN ) strcpy(text, "<<< Well done, mission accomplished >>>");
+ if ( num == INFO_LOST ) strcpy(text, "<<< Sorry, mission failed >>>");
+ if ( num == INFO_LOSTq ) strcpy(text, "<<< Sorry, mission failed >>>");
+ if ( num == INFO_WRITEOK ) strcpy(text, "Current mission saved");
+ if ( num == INFO_DELETEPATH ) strcpy(text, "Checkpoint crossed");
+ if ( num == INFO_DELETEMOTHER ) strcpy(text, "Alien Queen killed");
+ if ( num == INFO_DELETEANT ) strcpy(text, "Ant fatally wounded");
+ if ( num == INFO_DELETEBEE ) strcpy(text, "Wasp fatally wounded");
+ if ( num == INFO_DELETEWORM ) strcpy(text, "Worm fatally wounded");
+ if ( num == INFO_DELETESPIDER ) strcpy(text, "Spider fatally wounded");
+ if ( num == INFO_BEGINSATCOM ) strcpy(text, "Press \\key help; to read instructions on your SatCom");
+ }
+
+ if ( type == RES_CBOT )
+ {
+ strcpy(text, "Error");
+ if ( num == TX_OPENPAR ) strcpy(text, "Opening bracket missing");
+ if ( num == TX_CLOSEPAR ) strcpy(text, "Closing bracket missing ");
+ if ( num == TX_NOTBOOL ) strcpy(text, "The expression must return a boolean value");
+ if ( num == TX_UNDEFVAR ) strcpy(text, "Variable not declared");
+ if ( num == TX_BADLEFT ) strcpy(text, "Assignment impossible");
+ if ( num == TX_ENDOF ) strcpy(text, "Semicolon terminator missing");
+ if ( num == TX_OUTCASE ) strcpy(text, "Instruction ""case"" outside a block ""switch""");
+ if ( num == TX_NOTERM ) strcpy(text, "Instructions after the final closing brace");
+ if ( num == TX_CLOSEBLK ) strcpy(text, "End of block missing");
+ if ( num == TX_ELSEWITHOUTIF ) strcpy(text, "Instruction ""else"" without corresponding ""if"" ");
+ if ( num == TX_OPENBLK ) strcpy(text, "Opening brace missing ");//d�but d'un bloc attendu?
+ if ( num == TX_BADTYPE ) strcpy(text, "Wrong type for the assignment");
+ if ( num == TX_REDEFVAR ) strcpy(text, "A variable can not be declared twice");
+ if ( num == TX_BAD2TYPE ) strcpy(text, "The types of the two operands are incompatible ");
+ if ( num == TX_UNDEFCALL ) strcpy(text, "Unknown function");
+ if ( num == TX_MISDOTS ) strcpy(text, "Sign "" : "" missing");
+ if ( num == TX_WHILE ) strcpy(text, "Keyword ""while"" missing");
+ if ( num == TX_BREAK ) strcpy(text, "Instruction ""break"" outside a loop");
+ if ( num == TX_LABEL ) strcpy(text, "A label must be followed by ""for"", ""while"", ""do"" or ""switch""");
+ if ( num == TX_NOLABEL ) strcpy(text, "This label does not exist");// Cette �tiquette n'existe pas
+ if ( num == TX_NOCASE ) strcpy(text, "Instruction ""case"" missing");
+ if ( num == TX_BADNUM ) strcpy(text, "Number missing");
+ if ( num == TX_VOID ) strcpy(text, "Void parameter");
+ if ( num == TX_NOTYP ) strcpy(text, "Type declaration missing");
+ if ( num == TX_NOVAR ) strcpy(text, "Variable name missing");
+ if ( num == TX_NOFONC ) strcpy(text, "Function name missing");
+ if ( num == TX_OVERPARAM ) strcpy(text, "Too many parameters");
+ if ( num == TX_REDEF ) strcpy(text, "Function already exists");
+ if ( num == TX_LOWPARAM ) strcpy(text, "Parameters missing ");
+ if ( num == TX_BADPARAM ) strcpy(text, "No function with this name accepts this kind of parameter");
+ if ( num == TX_NUMPARAM ) strcpy(text, "No function with this name accepts this number of parameters");
+ if ( num == TX_NOITEM ) strcpy(text, "This is not a member of this class");
+ if ( num == TX_DOT ) strcpy(text, "This object is not a member of a class");
+ if ( num == TX_NOCONST ) strcpy(text, "Appropriate constructor missing");
+ if ( num == TX_REDEFCLASS ) strcpy(text, "This class already exists");
+ if ( num == TX_CLBRK ) strcpy(text, """ ] "" missing");
+ if ( num == TX_RESERVED ) strcpy(text, "Reserved keyword of CBOT language");
+ if ( num == TX_BADNEW ) strcpy(text, "Bad argument for ""new""");
+ if ( num == TX_OPBRK ) strcpy(text, """ [ "" expected");
+ if ( num == TX_BADSTRING ) strcpy(text, "String missing");
+ if ( num == TX_BADINDEX ) strcpy(text, "Incorrect index type");
+ if ( num == TX_PRIVATE ) strcpy(text, "Private element");
+ if ( num == TX_NOPUBLIC ) strcpy(text, "Public required");
+ if ( num == TX_DIVZERO ) strcpy(text, "Dividing by zero");
+ if ( num == TX_NOTINIT ) strcpy(text, "Variable not initialized");
+ if ( num == TX_BADTHROW ) strcpy(text, "Negative value rejected by ""throw""");//C'est quoi, �a?
+ if ( num == TX_NORETVAL ) strcpy(text, "The function returned no value ");
+ if ( num == TX_NORUN ) strcpy(text, "No function running");
+ if ( num == TX_NOCALL ) strcpy(text, "Calling an unknown function");
+ if ( num == TX_NOCLASS ) strcpy(text, "This class does not exist");
+ if ( num == TX_NULLPT ) strcpy(text, "Unknown Object");
+ if ( num == TX_OPNAN ) strcpy(text, "Operation impossible with value ""nan""");
+ if ( num == TX_OUTARRAY ) strcpy(text, "Access beyond array limit");
+ if ( num == TX_STACKOVER ) strcpy(text, "Stack overflow");
+ if ( num == TX_DELETEDPT ) strcpy(text, "Illegal object");
+ if ( num == TX_FILEOPEN ) strcpy(text, "Can't open file");
+ if ( num == TX_NOTOPEN ) strcpy(text, "File not open");
+ if ( num == TX_ERRREAD ) strcpy(text, "Read error");
+ if ( num == TX_ERRWRITE ) strcpy(text, "Write error");
+ }
+// \TODO
+ if ( type == RES_KEY )
+ {
+ if ( num == 0 ) strcpy(text, "< none >");
+ if ( num == SDLK_LEFT ) strcpy(text, "Arrow left");
+ if ( num == SDLK_RIGHT ) strcpy(text, "Arrow right");
+ if ( num == SDLK_UP ) strcpy(text, "Arrow up");
+ if ( num == SDLK_DOWN ) strcpy(text, "Arrow down");
+// if ( num == SDLK_CANCEL ) strcpy(text, "Control-break");
+// if ( num == SDLK_BACK ) strcpy(text, "<--");
+ if ( num == SDLK_TAB ) strcpy(text, "Tab");
+ if ( num == SDLK_CLEAR ) strcpy(text, "Clear");
+ if ( num == SDLK_RETURN ) strcpy(text, "Enter");
+// if ( num == SDLK_SHIFT ) strcpy(text, "Shift");
+// if ( num == SDLK_CONTROL ) strcpy(text, "Ctrl");
+ if ( num == SDLK_MENU ) strcpy(text, "Alt");
+ if ( num == SDLK_PAUSE ) strcpy(text, "Pause");
+// if ( num == SDLK_CAPITAL ) strcpy(text, "Caps Lock");
+ if ( num == SDLK_ESCAPE ) strcpy(text, "Esc");
+ if ( num == SDLK_SPACE ) strcpy(text, "Space");
+// if ( num == SDLK_PRIOR ) strcpy(text, "Page Up");
+// if ( num == SDLK_NEXT ) strcpy(text, "Page Down");
+ if ( num == SDLK_END ) strcpy(text, "End");
+ if ( num == SDLK_HOME ) strcpy(text, "Home");
+// if ( num == SDLK_SELECT ) strcpy(text, "Select");
+// if ( num == SDLK_EXECUTE ) strcpy(text, "Execute");
+// if ( num == SDLK_SNAPSHOT ) strcpy(text, "Print Scrn");
+ if ( num == SDLK_INSERT ) strcpy(text, "Insert");
+ if ( num == SDLK_DELETE ) strcpy(text, "Delete");
+ if ( num == SDLK_HELP ) strcpy(text, "Help");
+// if ( num == SDLK_LWIN ) strcpy(text, "Left Windows");
+// if ( num == SDLK_RWIN ) strcpy(text, "Right Windows");
+// if ( num == SDLK_APPS ) strcpy(text, "Application key");
+// if ( num == SDLK_NUMPAD0 ) strcpy(text, "NumPad 0");
+// if ( num == SDLK_NUMPAD1 ) strcpy(text, "NumPad 1");
+// if ( num == SDLK_NUMPAD2 ) strcpy(text, "NumPad 2");
+// if ( num == SDLK_NUMPAD3 ) strcpy(text, "NumPad 3");
+// if ( num == SDLK_NUMPAD4 ) strcpy(text, "NumPad 4");
+// if ( num == SDLK_NUMPAD5 ) strcpy(text, "NumPad 5");
+// if ( num == SDLK_NUMPAD6 ) strcpy(text, "NumPad 6");
+// if ( num == SDLK_NUMPAD7 ) strcpy(text, "NumPad 7");
+// if ( num == SDLK_NUMPAD8 ) strcpy(text, "NumPad 8");
+// if ( num == SDLK_NUMPAD9 ) strcpy(text, "NumPad 9");
+// if ( num == SDLK_MULTIPLY ) strcpy(text, "NumPad *");
+// if ( num == SDLK_ADD ) strcpy(text, "NumPad +");
+// if ( num == SDLK_SEPARATOR ) strcpy(text, "NumPad sep");
+// if ( num == SDLK_SUBTRACT ) strcpy(text, "NumPad -");
+// if ( num == SDLK_DECIMAL ) strcpy(text, "NumPad .");
+// if ( num == SDLK_DIVIDE ) strcpy(text, "NumPad /");
+ if ( num == SDLK_F1 ) strcpy(text, "F1");
+ if ( num == SDLK_F2 ) strcpy(text, "F2");
+ if ( num == SDLK_F3 ) strcpy(text, "F3");
+ if ( num == SDLK_F4 ) strcpy(text, "F4");
+ if ( num == SDLK_F5 ) strcpy(text, "F5");
+ if ( num == SDLK_F6 ) strcpy(text, "F6");
+ if ( num == SDLK_F7 ) strcpy(text, "F7");
+ if ( num == SDLK_F8 ) strcpy(text, "F8");
+ if ( num == SDLK_F9 ) strcpy(text, "F9");
+ if ( num == SDLK_F10 ) strcpy(text, "F10");
+ if ( num == SDLK_F11 ) strcpy(text, "F11");
+ if ( num == SDLK_F12 ) strcpy(text, "F12");
+ if ( num == SDLK_F13 ) strcpy(text, "F13");
+ if ( num == SDLK_F14 ) strcpy(text, "F14");
+ if ( num == SDLK_F15 ) strcpy(text, "F15");
+// if ( num == SDLK_F16 ) strcpy(text, "F16");
+// if ( num == SDLK_F17 ) strcpy(text, "F17");
+// if ( num == SDLK_F18 ) strcpy(text, "F18");
+// if ( num == SDLK_F19 ) strcpy(text, "F19");
+// if ( num == SDLK_F20 ) strcpy(text, "F20");
+ if ( num == SDLK_NUMLOCK ) strcpy(text, "Num Lock");
+// if ( num == SDLK_SCROLL ) strcpy(text, "Scroll");
+// if ( num == SDLK_ATTN ) strcpy(text, "Attn");
+// if ( num == SDLK_CRSEL ) strcpy(text, "CrSel");
+// if ( num == SDLK_EXSEL ) strcpy(text, "ExSel");
+// if ( num == SDLK_EREOF ) strcpy(text, "Erase EOF");
+// if ( num == SDLK_PLAY ) strcpy(text, "Play");
+// if ( num == SDLK_ZOOM ) strcpy(text, "Zoom");
+// if ( num == SDLK_PA1 ) strcpy(text, "PA1");
+// if ( num == SDLK_OEM_CLEAR ) strcpy(text, "Clear");
+// if ( num == SDLK_BUTTON1 ) strcpy(text, "Button 1");
+// if ( num == SDLK_BUTTON2 ) strcpy(text, "Button 2");
+// if ( num == SDLK_BUTTON3 ) strcpy(text, "Button 3");
+// if ( num == SDLK_BUTTON4 ) strcpy(text, "Button 4");
+// if ( num == SDLK_BUTTON5 ) strcpy(text, "Button 5");
+// if ( num == SDLK_BUTTON6 ) strcpy(text, "Button 6");
+// if ( num == SDLK_BUTTON7 ) strcpy(text, "Button 7");
+// if ( num == SDLK_BUTTON8 ) strcpy(text, "Button 8");
+// if ( num == SDLK_BUTTON9 ) strcpy(text, "Button 9");
+// if ( num == SDLK_BUTTON10 ) strcpy(text, "Button 10");
+// if ( num == SDLK_BUTTON11 ) strcpy(text, "Button 11");
+// if ( num == SDLK_BUTTON12 ) strcpy(text, "Button 12");
+// if ( num == SDLK_BUTTON13 ) strcpy(text, "Button 13");
+// if ( num == SDLK_BUTTON14 ) strcpy(text, "Button 14");
+// if ( num == SDLK_BUTTON15 ) strcpy(text, "Button 15");
+// if ( num == SDLK_BUTTON16 ) strcpy(text, "Button 16");
+// if ( num == SDLK_BUTTON17 ) strcpy(text, "Button 17");
+// if ( num == SDLK_BUTTON18 ) strcpy(text, "Button 18");
+// if ( num == SDLK_BUTTON19 ) strcpy(text, "Button 19");
+// if ( num == SDLK_BUTTON20 ) strcpy(text, "Button 20");
+// if ( num == SDLK_BUTTON21 ) strcpy(text, "Button 21");
+// if ( num == SDLK_BUTTON22 ) strcpy(text, "Button 22");
+// if ( num == SDLK_BUTTON23 ) strcpy(text, "Button 23");
+// if ( num == SDLK_BUTTON24 ) strcpy(text, "Button 24");
+// if ( num == SDLK_BUTTON25 ) strcpy(text, "Button 25");
+// if ( num == SDLK_BUTTON26 ) strcpy(text, "Button 26");
+// if ( num == SDLK_BUTTON27 ) strcpy(text, "Button 27");
+// if ( num == SDLK_BUTTON28 ) strcpy(text, "Button 28");
+// if ( num == SDLK_BUTTON29 ) strcpy(text, "Button 29");
+// if ( num == SDLK_BUTTON30 ) strcpy(text, "Button 30");
+// if ( num == SDLK_BUTTON31 ) strcpy(text, "Button 31");
+// if ( num == SDLK_BUTTON32 ) strcpy(text, "Button 32");
+// if ( num == SDLK_WHEELUP ) strcpy(text, "Wheel up");
+// if ( num == SDLK_WHEELDOWN ) strcpy(text, "Wheel down");
+ }
+#endif
+
+#if _FRENCH
+ if ( type == RES_TEXT )
+ {
+ #if _FULL
+ if ( num == RT_VERSION_ID ) strcpy(text, "1.18 /f");
+ #endif
+ #if _NET
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A 1.18");
+ #endif
+ #if _SCHOOL & _EDU
+ #if _TEEN
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-Teen EDU 1.18");
+ #else
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A EDU 1.18");
+ #endif
+ #endif
+ #if _SCHOOL & _PERSO
+ #if _TEEN
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-Teen PERSO 1.18");
+ #else
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A PERSO 1.18");
+ #endif
+ #endif
+ #if _SCHOOL & _CEEBOTDEMO
+ #if _TEEN
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-Teen DEMO 1.18");
+ #else
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A DEMO 1.18");
+ #endif
+ #endif
+ #if _DEMO
+ if ( num == RT_VERSION_ID ) strcpy(text, "Demo 1.18 /f");
+ #endif
+ if ( num == RT_DISINFO_TITLE ) strcpy(text, "SatCom");
+ if ( num == RT_WINDOW_MAXIMIZED ) strcpy(text, "Taille maximale");
+ if ( num == RT_WINDOW_MINIMIZED ) strcpy(text, "Taille r�duite");
+ if ( num == RT_WINDOW_STANDARD ) strcpy(text, "Taille normale");
+ if ( num == RT_WINDOW_CLOSE ) strcpy(text, "Fermer");
+
+ if ( num == RT_STUDIO_TITLE ) strcpy(text, "Edition du programme");
+ if ( num == RT_SCRIPT_NEW ) strcpy(text, "Nouveau");
+ if ( num == RT_NAME_DEFAULT ) strcpy(text, "Joueur");
+ if ( num == RT_IO_NEW ) strcpy(text, "Nouveau ...");
+ if ( num == RT_KEY_OR ) strcpy(text, " ou ");
+
+#if _NEWLOOK
+ if ( num == RT_TITLE_BASE ) strcpy(text, "CeeBot");
+ if ( num == RT_TITLE_INIT ) strcpy(text, "CeeBot");
+#else
+ if ( num == RT_TITLE_BASE ) strcpy(text, "COLOBOT");
+ if ( num == RT_TITLE_INIT ) strcpy(text, "COLOBOT");
+#endif
+ if ( num == RT_TITLE_TRAINER ) strcpy(text, "Programmation");
+ if ( num == RT_TITLE_DEFI ) strcpy(text, "D�fis");
+ if ( num == RT_TITLE_MISSION ) strcpy(text, "Missions");
+ if ( num == RT_TITLE_FREE ) strcpy(text, "Jeu libre");
+ if ( num == RT_TITLE_TEEN ) strcpy(text, "Jeu libre");
+ if ( num == RT_TITLE_USER ) strcpy(text, "Niveaux suppl�mentaires");
+ if ( num == RT_TITLE_PROTO ) strcpy(text, "Prototypes");
+ if ( num == RT_TITLE_SETUP ) strcpy(text, "Options");
+ if ( num == RT_TITLE_NAME ) strcpy(text, "Nom du joueur");
+ if ( num == RT_TITLE_PERSO ) strcpy(text, "Personnalisation de votre apparence");
+ if ( num == RT_TITLE_WRITE ) strcpy(text, "Enregistrement de la mission en cours");
+ if ( num == RT_TITLE_READ ) strcpy(text, "Chargement d'une mission enregistr�e");
+
+ if ( num == RT_PLAY_CHAPt ) strcpy(text, " Liste des chapitres :");
+ if ( num == RT_PLAY_CHAPd ) strcpy(text, " Liste des chapitres :");
+ if ( num == RT_PLAY_CHAPm ) strcpy(text, " Liste des plan�tes :");
+ if ( num == RT_PLAY_CHAPf ) strcpy(text, " Liste des plan�tes :");
+ if ( num == RT_PLAY_CHAPu ) strcpy(text, " Niveaux suppl�mentaires :");
+ if ( num == RT_PLAY_CHAPp ) strcpy(text, " Liste des plan�tes :");
+ if ( num == RT_PLAY_CHAPte ) strcpy(text, " Liste des chapitres :");
+ if ( num == RT_PLAY_LISTt ) strcpy(text, " Liste des exercices du chapitre :");
+ if ( num == RT_PLAY_LISTd ) strcpy(text, " Liste des d�fis du chapitre :");
+ if ( num == RT_PLAY_LISTm ) strcpy(text, " Liste des missions du chapitre :");
+ if ( num == RT_PLAY_LISTf ) strcpy(text, " Liste des jeux libres du chapitre :");
+ if ( num == RT_PLAY_LISTu ) strcpy(text, " Missions du niveau :");
+ if ( num == RT_PLAY_LISTp ) strcpy(text, " Liste des prototypes du chapitre :");
+ if ( num == RT_PLAY_LISTk ) strcpy(text, " Liste des jeux libres du chapitre :");
+ if ( num == RT_PLAY_RESUME ) strcpy(text, " R�sum� :");
+
+ if ( num == RT_SETUP_DEVICE ) strcpy(text, " Pilotes :");
+ if ( num == RT_SETUP_MODE ) strcpy(text, " R�solutions :");
+ if ( num == RT_SETUP_KEY1 ) strcpy(text, "1) Cliquez d'abord sur la touche � red�finir.");
+ if ( num == RT_SETUP_KEY2 ) strcpy(text, "2) Appuyez ensuite sur la nouvelle touche souhait�e.");
+
+ if ( num == RT_PERSO_FACE ) strcpy(text, "Type de visage :");
+ if ( num == RT_PERSO_GLASSES ) strcpy(text, "Lunettes :");
+ if ( num == RT_PERSO_HAIR ) strcpy(text, "Couleur des cheveux :");
+ if ( num == RT_PERSO_COMBI ) strcpy(text, "Couleur de la combinaison :");
+ if ( num == RT_PERSO_BAND ) strcpy(text, "Couleur des bandes :");
+
+#if _NEWLOOK
+ if ( num == RT_DIALOG_TITLE ) strcpy(text, "CeeBot");
+ if ( num == RT_DIALOG_QUIT ) strcpy(text, "Voulez-vous quitter CeeBot ?");
+ if ( num == RT_DIALOG_YESQUIT ) strcpy(text, "Quitter\\Quitter CeeBot");
+#else
+ if ( num == RT_DIALOG_TITLE ) strcpy(text, "COLOBOT");
+ if ( num == RT_DIALOG_QUIT ) strcpy(text, "Voulez-vous quitter COLOBOT ?");
+ if ( num == RT_DIALOG_YESQUIT ) strcpy(text, "Quitter\\Quitter COLOBOT");
+#endif
+ if ( num == RT_DIALOG_ABORT ) strcpy(text, "Quitter la mission ?");
+ if ( num == RT_DIALOG_YES ) strcpy(text, "Abandonner\\Abandonner la mission en cours");
+ if ( num == RT_DIALOG_NO ) strcpy(text, "Continuer\\Continuer la mission en cours");
+ if ( num == RT_DIALOG_NOQUIT ) strcpy(text, "Continuer\\Continuer de jouer");
+ if ( num == RT_DIALOG_DELOBJ ) strcpy(text, "Voulez-vous vraiment d�truire le b�timent s�lectionn� ?");
+ if ( num == RT_DIALOG_DELGAME ) strcpy(text, "Voulez-vous d�truire les sauvegardes de %s ?");
+ if ( num == RT_DIALOG_YESDEL ) strcpy(text, "D�truire");
+ if ( num == RT_DIALOG_NODEL ) strcpy(text, "Annuler");
+ if ( num == RT_DIALOG_LOADING ) strcpy(text, "CHARGEMENT");
+
+ if ( num == RT_STUDIO_LISTTT ) strcpy(text, "Aide sur le mot-cl� (\\key cbot;)");
+ if ( num == RT_STUDIO_COMPOK ) strcpy(text, "Compilation ok (0 erreur)");
+ if ( num == RT_STUDIO_PROGSTOP ) strcpy(text, "Programme termin�");
+
+ if ( num == RT_SATCOM_LIST ) strcpy(text, "\\b;Listes des objets\n");
+ if ( num == RT_SATCOM_BOT ) strcpy(text, "\\b;Listes des robots\n");
+ if ( num == RT_SATCOM_BUILDING ) strcpy(text, "\\b;Listes des b�timents\n");
+ if ( num == RT_SATCOM_FRET ) strcpy(text, "\\b;Listes des objets transportables\n");
+ if ( num == RT_SATCOM_ALIEN ) strcpy(text, "\\b;Listes des ennemis\n");
+ if ( num == RT_SATCOM_NULL ) strcpy(text, "\\c; (aucun)\\n;\n");
+ if ( num == RT_SATCOM_ERROR1 ) strcpy(text, "\\b;Erreur\n");
+ if ( num == RT_SATCOM_ERROR2 ) strcpy(text, "Liste non disponible sans \\l;radar\\u object\\radar; !\n");
+
+ if ( num == RT_IO_OPEN ) strcpy(text, "Ouvrir");
+ if ( num == RT_IO_SAVE ) strcpy(text, "Enregistrer");
+ if ( num == RT_IO_LIST ) strcpy(text, "Dossier: %s");
+ if ( num == RT_IO_NAME ) strcpy(text, "Nom:");
+ if ( num == RT_IO_DIR ) strcpy(text, "Dans:");
+ if ( num == RT_IO_PRIVATE ) strcpy(text, "Priv�\\Dossier priv�");
+ if ( num == RT_IO_PUBLIC ) strcpy(text, "Public\\Dossier commun � tous les joueurs");
+
+ if ( num == RT_GENERIC_DEV1 ) strcpy(text, "D�velopp� par :");
+ if ( num == RT_GENERIC_DEV2 ) strcpy(text, "www.epsitec.com");
+#if _SCHOOL
+ if ( num == RT_GENERIC_EDIT1 ) strcpy(text, " ");
+ if ( num == RT_GENERIC_EDIT2 ) strcpy(text, " ");
+#else
+ //?if ( num == RT_GENERIC_EDIT1 ) strcpy(text, "Version fran�aise �dit�e par :");
+ //?if ( num == RT_GENERIC_EDIT2 ) strcpy(text, "www.alsyd.com");
+ if ( num == RT_GENERIC_EDIT1 ) strcpy(text, " ");
+ if ( num == RT_GENERIC_EDIT2 ) strcpy(text, " ");
+#endif
+
+ if ( num == RT_INTERFACE_REC ) strcpy(text, "Enregistreur");
+ }
+
+ if ( type == RES_EVENT )
+ {
+ if ( num == EVENT_BUTTON_OK ) strcpy(text, "D'accord");
+ if ( num == EVENT_BUTTON_CANCEL ) strcpy(text, "Annuler");
+ if ( num == EVENT_BUTTON_NEXT ) strcpy(text, "Suivant");
+ if ( num == EVENT_BUTTON_PREV ) strcpy(text, "Pr�c�dent");
+ if ( num == EVENT_BUTTON_QUIT ) strcpy(text, "Menu (\\key quit;)");
+
+ if ( num == EVENT_DIALOG_OK ) strcpy(text, "D'accord");
+ if ( num == EVENT_DIALOG_CANCEL ) strcpy(text, "Annuler");
+
+ if ( num == EVENT_INTERFACE_TRAINER) strcpy(text, "Programmation\\Exercices de programmation");
+ if ( num == EVENT_INTERFACE_DEFI ) strcpy(text, "D�fis\\D�fis de programmation");
+ if ( num == EVENT_INTERFACE_MISSION) strcpy(text, "Missions\\La grande aventure");
+ if ( num == EVENT_INTERFACE_FREE ) strcpy(text, "Jeu libre\\Jeu libre sans but pr�cis");
+ if ( num == EVENT_INTERFACE_TEEN ) strcpy(text, "Jeu libre\\Jeu libre sans but pr�cis");
+ if ( num == EVENT_INTERFACE_USER ) strcpy(text, "Suppl.\\Niveaux suppl�mentaires");
+ if ( num == EVENT_INTERFACE_PROTO ) strcpy(text, "Proto\\Prototypes en cours d'�laboration");
+ if ( num == EVENT_INTERFACE_NAME ) strcpy(text, "Autre joueur\\Choix du nom du joueur");
+ if ( num == EVENT_INTERFACE_SETUP ) strcpy(text, "Options\\R�glages");
+ if ( num == EVENT_INTERFACE_AGAIN ) strcpy(text, "Recommencer\\Recommencer la mission au d�but");
+ if ( num == EVENT_INTERFACE_WRITE ) strcpy(text, "Enregistrer\\Enregistrer la mission en cours");
+ if ( num == EVENT_INTERFACE_READ ) strcpy(text, "Charger\\Charger une mission enregistr�e");
+#if _NEWLOOK
+ if ( num == EVENT_INTERFACE_ABORT ) strcpy(text, "\\Retourner dans CeeBot");
+ if ( num == EVENT_INTERFACE_QUIT ) strcpy(text, "Quitter\\Quitter CeeBot");
+#else
+ if ( num == EVENT_INTERFACE_ABORT ) strcpy(text, "\\Retourner dans COLOBOT");
+ if ( num == EVENT_INTERFACE_QUIT ) strcpy(text, "Quitter\\Quitter COLOBOT");
+#endif
+ if ( num == EVENT_INTERFACE_BACK ) strcpy(text, "<< Retour \\Retour au niveau pr�c�dent");
+ if ( num == EVENT_INTERFACE_PLAY ) strcpy(text, "Jouer ...\\D�marrer l'action");
+ if ( num == EVENT_INTERFACE_SETUPd ) strcpy(text, "Affichage\\Pilote et r�solution d'affichage");
+ if ( num == EVENT_INTERFACE_SETUPg ) strcpy(text, "Graphique\\Options graphiques");
+ if ( num == EVENT_INTERFACE_SETUPp ) strcpy(text, "Jeu\\Options de jouabilit�");
+ if ( num == EVENT_INTERFACE_SETUPc ) strcpy(text, "Commandes\\Touches du clavier");
+ if ( num == EVENT_INTERFACE_SETUPs ) strcpy(text, "Son\\Volumes bruitages & musiques");
+ if ( num == EVENT_INTERFACE_DEVICE ) strcpy(text, "Unit�");
+ if ( num == EVENT_INTERFACE_RESOL ) strcpy(text, "R�solution");
+ if ( num == EVENT_INTERFACE_FULL ) strcpy(text, "Plein �cran\\Plein �cran ou fen�tr�");
+ if ( num == EVENT_INTERFACE_APPLY ) strcpy(text, "Appliquer les changements\\Active les changements effectu�s");
+
+ if ( num == EVENT_INTERFACE_TOTO ) strcpy(text, "Robbie\\Votre assistant");
+ if ( num == EVENT_INTERFACE_SHADOW ) strcpy(text, "Ombres\\Ombres projet�es au sol");
+ if ( num == EVENT_INTERFACE_GROUND ) strcpy(text, "Marques sur le sol\\Marques dessin�es sur le sol");
+ if ( num == EVENT_INTERFACE_DIRTY ) strcpy(text, "Salissures\\Salissures des robots et b�timents");
+ if ( num == EVENT_INTERFACE_FOG ) strcpy(text, "Brouillard\\Nappes de brouillard");
+ if ( num == EVENT_INTERFACE_LENS ) strcpy(text, "Rayons du soleil\\Rayons selon l'orientation");
+ if ( num == EVENT_INTERFACE_SKY ) strcpy(text, "Ciel\\Ciel et nuages");
+ if ( num == EVENT_INTERFACE_PLANET ) strcpy(text, "Plan�tes et �toiles\\Motifs mobiles dans le ciel");
+ if ( num == EVENT_INTERFACE_LIGHT ) strcpy(text, "Lumi�res dynamiques\\Eclairages mobiles");
+ if ( num == EVENT_INTERFACE_PARTI ) strcpy(text, "Quantit� de particules\\Explosions, poussi�res, reflets, etc.");
+ if ( num == EVENT_INTERFACE_CLIP ) strcpy(text, "Profondeur de champ\\Distance de vue maximale");
+ if ( num == EVENT_INTERFACE_DETAIL ) strcpy(text, "D�tails des objets\\Qualit� des objets en 3D");
+ if ( num == EVENT_INTERFACE_TEXTURE) strcpy(text, "Qualit� des textures\\Qualit� des images");
+ if ( num == EVENT_INTERFACE_GADGET ) strcpy(text, "Nb d'objets d�coratifs\\Qualit� d'objets non indispensables");
+ if ( num == EVENT_INTERFACE_RAIN ) strcpy(text, "Particules dans l'interface\\Pluie de particules");
+ if ( num == EVENT_INTERFACE_GLINT ) strcpy(text, "Reflets sur les boutons\\Boutons brillants");
+ if ( num == EVENT_INTERFACE_TOOLTIP) strcpy(text, "Bulles d'aide\\Bulles explicatives");
+ if ( num == EVENT_INTERFACE_MOVIES ) strcpy(text, "S�quences cin�matiques\\Films avant ou apr�s une mission");
+ if ( num == EVENT_INTERFACE_NICERST) strcpy(text, "Retour anim�\\Retour anim� dans les exercices");
+ if ( num == EVENT_INTERFACE_HIMSELF) strcpy(text, "D�g�ts � soi-m�me\\Vos tirs infligent des dommages � vos unit�s");
+ if ( num == EVENT_INTERFACE_SCROLL ) strcpy(text, "D�filement dans les bords\\D�filement lorsque la souris touches les bords gauche ou droite");
+ if ( num == EVENT_INTERFACE_INVERTX) strcpy(text, "Inversion souris X\\Inversion de la rotation lorsque la souris touche un bord");
+ if ( num == EVENT_INTERFACE_INVERTY) strcpy(text, "Inversion souris Y\\Inversion de la rotation lorsque la souris touche un bord");
+ if ( num == EVENT_INTERFACE_EFFECT ) strcpy(text, "Secousses lors d'explosions\\L'�cran vibre lors d'une explosion");
+ if ( num == EVENT_INTERFACE_MOUSE ) strcpy(text, "Souris ombr�e\\Jolie souris avec une ombre");
+ if ( num == EVENT_INTERFACE_EDITMODE) strcpy(text, "Indentation automatique\\Pendant l'�dition d'un programme");
+ if ( num == EVENT_INTERFACE_EDITVALUE)strcpy(text, "Grande indentation\\Indente avec 2 ou 4 espaces");
+ if ( num == EVENT_INTERFACE_SOLUCE4) strcpy(text, "Acc�s aux solutions\\Programme \"4: Solution\" dans les exercices");
+
+ if ( num == EVENT_INTERFACE_KDEF ) strcpy(text, "Tout r�initialiser\\Remet toutes les touches standards");
+ if ( num == EVENT_INTERFACE_KLEFT ) strcpy(text, "Tourner � gauche\\Moteur � gauche");
+ if ( num == EVENT_INTERFACE_KRIGHT ) strcpy(text, "Tourner � droite\\Moteur � droite");
+ if ( num == EVENT_INTERFACE_KUP ) strcpy(text, "Avancer\\Moteur en avant");
+ if ( num == EVENT_INTERFACE_KDOWN ) strcpy(text, "Reculer\\Moteur en arri�re");
+ if ( num == EVENT_INTERFACE_KGUP ) strcpy(text, "Monter\\Augmenter la puissance du r�acteur");
+ if ( num == EVENT_INTERFACE_KGDOWN ) strcpy(text, "Descendre\\Diminuer la puissance du r�acteur");
+ if ( num == EVENT_INTERFACE_KCAMERA) strcpy(text, "Changement de cam�ra\\Autre de point de vue");
+ if ( num == EVENT_INTERFACE_KDESEL ) strcpy(text, "S�lection pr�c�dente\\S�lectionne l'objet pr�c�dent");
+ if ( num == EVENT_INTERFACE_KACTION) strcpy(text, "Action standard\\Action du bouton avec le cadre rouge");
+ if ( num == EVENT_INTERFACE_KNEAR ) strcpy(text, "Cam�ra plus proche\\Avance la cam�ra");
+ if ( num == EVENT_INTERFACE_KAWAY ) strcpy(text, "Cam�ra plus loin\\Recule la cam�ra");
+ if ( num == EVENT_INTERFACE_KNEXT ) strcpy(text, "S�lectionner l'objet suivant\\S�lectionner l'objet suivant");
+ if ( num == EVENT_INTERFACE_KHUMAN ) strcpy(text, "S�lectionner le cosmonaute\\S�lectionner le cosmonaute");
+ if ( num == EVENT_INTERFACE_KQUIT ) strcpy(text, "Quitter la mission en cours\\Terminer un exercice ou une mssion");
+ if ( num == EVENT_INTERFACE_KHELP ) strcpy(text, "Instructions mission\\Marche � suivre");
+ if ( num == EVENT_INTERFACE_KPROG ) strcpy(text, "Instructions programmation\\Explication sur la programmation");
+ if ( num == EVENT_INTERFACE_KCBOT ) strcpy(text, "Instructions mot-cl�\\Explication sur le mot-cl�");
+ if ( num == EVENT_INTERFACE_KVISIT ) strcpy(text, "Montrer le lieu d'un message\\Montrer le lieu du dernier message");
+ if ( num == EVENT_INTERFACE_KSPEED10) strcpy(text, "Vitesse 1.0x\\Vitesse normale");
+ if ( num == EVENT_INTERFACE_KSPEED15) strcpy(text, "Vitesse 1.5x\\Une fois et demi plus rapide");
+ if ( num == EVENT_INTERFACE_KSPEED20) strcpy(text, "Vitesse 2.0x\\Deux fois plus rapide");
+ if ( num == EVENT_INTERFACE_KSPEED30) strcpy(text, "Vitesse 3.0x\\Trois fois plus rapide");
+
+ if ( num == EVENT_INTERFACE_VOLSOUND) strcpy(text, "Bruitages :\\Volume des moteurs, voix, etc.");
+ if ( num == EVENT_INTERFACE_VOLMUSIC) strcpy(text, "Fond sonore :\\Volume des pistes audio du CD");
+ if ( num == EVENT_INTERFACE_SOUND3D) strcpy(text, "Bruitages 3D\\Positionnement sonore dans l'espace");
+
+ if ( num == EVENT_INTERFACE_MIN ) strcpy(text, "Mini\\Qualit� minimale (+ rapide)");
+ if ( num == EVENT_INTERFACE_NORM ) strcpy(text, "Normal\\Qualit� standard");
+ if ( num == EVENT_INTERFACE_MAX ) strcpy(text, "Maxi\\Haute qualit� (+ lent)");
+
+ if ( num == EVENT_INTERFACE_SILENT ) strcpy(text, "Silencieux\\Totalement silencieux");
+ if ( num == EVENT_INTERFACE_NOISY ) strcpy(text, "Normal\\Niveaux normaux");
+
+ if ( num == EVENT_INTERFACE_JOYSTICK) strcpy(text, "Utilise un joystick\\Joystick ou clavier");
+ if ( num == EVENT_INTERFACE_SOLUCE ) strcpy(text, "Acc�s � la solution\\Donne la solution");
+
+ if ( num == EVENT_INTERFACE_NEDIT ) strcpy(text, "\\Nom du joueur � cr�er");
+ if ( num == EVENT_INTERFACE_NOK ) strcpy(text, "D'accord\\Choisir le joueur");
+ if ( num == EVENT_INTERFACE_NCANCEL) strcpy(text, "Annuler\\Conserver le joueur actuel");
+ if ( num == EVENT_INTERFACE_NDELETE) strcpy(text, "Supprimer le joueur\\Supprimer le joueur de la liste");
+ if ( num == EVENT_INTERFACE_NLABEL ) strcpy(text, "Nom du joueur");
+
+ if ( num == EVENT_INTERFACE_IOWRITE) strcpy(text, "Enregistrer\\Enregistrer la mission en cours");
+ if ( num == EVENT_INTERFACE_IOREAD ) strcpy(text, "Charger\\Charger la mission s�lectionn�e");
+ if ( num == EVENT_INTERFACE_IOLIST ) strcpy(text, "Liste des missions enregistr�es");
+ if ( num == EVENT_INTERFACE_IOLABEL) strcpy(text, "Nom du fichier :");
+ if ( num == EVENT_INTERFACE_IONAME ) strcpy(text, "Nom de la mission");
+ if ( num == EVENT_INTERFACE_IOIMAGE) strcpy(text, "Vue de la mission");
+ if ( num == EVENT_INTERFACE_IODELETE) strcpy(text, "Supprimer\\Supprime l'enregistrement s�lectionn�");
+
+ if ( num == EVENT_INTERFACE_PERSO ) strcpy(text, "Aspect\\Choisir votre aspect");
+ if ( num == EVENT_INTERFACE_POK ) strcpy(text, "D'accord");
+ if ( num == EVENT_INTERFACE_PCANCEL) strcpy(text, "Annuler");
+ if ( num == EVENT_INTERFACE_PDEF ) strcpy(text, "Standard\\Remet les couleurs standards");
+ if ( num == EVENT_INTERFACE_PHEAD ) strcpy(text, "T�te\\Visage et cheveux");
+ if ( num == EVENT_INTERFACE_PBODY ) strcpy(text, "Corps\\Combinaison");
+ if ( num == EVENT_INTERFACE_PLROT ) strcpy(text, "\\Rotation � gauche");
+ if ( num == EVENT_INTERFACE_PRROT ) strcpy(text, "\\Rotation � droite");
+ if ( num == EVENT_INTERFACE_PCRa ) strcpy(text, "Rouge");
+ if ( num == EVENT_INTERFACE_PCGa ) strcpy(text, "Vert");
+ if ( num == EVENT_INTERFACE_PCBa ) strcpy(text, "Bleu");
+ if ( num == EVENT_INTERFACE_PCRb ) strcpy(text, "Rouge");
+ if ( num == EVENT_INTERFACE_PCGb ) strcpy(text, "Vert");
+ if ( num == EVENT_INTERFACE_PCBb ) strcpy(text, "Bleu");
+ if ( num == EVENT_INTERFACE_PFACE1 ) strcpy(text, "\\Visage 1");
+ if ( num == EVENT_INTERFACE_PFACE2 ) strcpy(text, "\\Visage 4");
+ if ( num == EVENT_INTERFACE_PFACE3 ) strcpy(text, "\\Visage 3");
+ if ( num == EVENT_INTERFACE_PFACE4 ) strcpy(text, "\\Visage 2");
+ if ( num == EVENT_INTERFACE_PGLASS0) strcpy(text, "\\Pas de lunettes");
+ if ( num == EVENT_INTERFACE_PGLASS1) strcpy(text, "\\Lunettes 1");
+ if ( num == EVENT_INTERFACE_PGLASS2) strcpy(text, "\\Lunettes 2");
+ if ( num == EVENT_INTERFACE_PGLASS3) strcpy(text, "\\Lunettes 3");
+ if ( num == EVENT_INTERFACE_PGLASS4) strcpy(text, "\\Lunettes 4");
+ if ( num == EVENT_INTERFACE_PGLASS5) strcpy(text, "\\Lunettes 5");
+
+ if ( num == EVENT_OBJECT_DESELECT ) strcpy(text, "S�lection pr�c�dente (\\key desel;)");
+ if ( num == EVENT_OBJECT_LEFT ) strcpy(text, "Tourne � gauche (\\key left;)");
+ if ( num == EVENT_OBJECT_RIGHT ) strcpy(text, "Tourne � droite (\\key right;)");
+ if ( num == EVENT_OBJECT_UP ) strcpy(text, "Avance (\\key up;)");
+ if ( num == EVENT_OBJECT_DOWN ) strcpy(text, "Recule (\\key down;)");
+ if ( num == EVENT_OBJECT_GASUP ) strcpy(text, "Monte (\\key gup;)");
+ if ( num == EVENT_OBJECT_GASDOWN ) strcpy(text, "Descend (\\key gdown;)");
+ if ( num == EVENT_OBJECT_HTAKE ) strcpy(text, "Prend ou d�pose (\\key action;)");
+ if ( num == EVENT_OBJECT_MTAKE ) strcpy(text, "Prend ou d�pose (\\key action;)");
+ if ( num == EVENT_OBJECT_MFRONT ) strcpy(text, "..devant");
+ if ( num == EVENT_OBJECT_MBACK ) strcpy(text, "..derri�re");
+ if ( num == EVENT_OBJECT_MPOWER ) strcpy(text, "..pile");
+ if ( num == EVENT_OBJECT_BHELP ) strcpy(text, "Instructions sur la mission (\\key help;)");
+ if ( num == EVENT_OBJECT_BTAKEOFF ) strcpy(text, "D�colle pour terminer la mission");
+ if ( num == EVENT_OBJECT_BDERRICK ) strcpy(text, "Construit un derrick");
+ if ( num == EVENT_OBJECT_BSTATION ) strcpy(text, "Construit une station");
+ if ( num == EVENT_OBJECT_BFACTORY ) strcpy(text, "Construit une fabrique de robots");
+ if ( num == EVENT_OBJECT_BREPAIR ) strcpy(text, "Construit un centre de r�paration");
+ if ( num == EVENT_OBJECT_BCONVERT ) strcpy(text, "Construit un convertisseur");
+ if ( num == EVENT_OBJECT_BTOWER ) strcpy(text, "Construit une tour");
+ if ( num == EVENT_OBJECT_BRESEARCH ) strcpy(text, "Construit un centre de recherches");
+ if ( num == EVENT_OBJECT_BRADAR ) strcpy(text, "Construit un radar");
+ if ( num == EVENT_OBJECT_BENERGY ) strcpy(text, "Construit une fabrique de piles");
+ if ( num == EVENT_OBJECT_BLABO ) strcpy(text, "Construit un laboratoire");
+ if ( num == EVENT_OBJECT_BNUCLEAR ) strcpy(text, "Construit une centrale nucl�aire");
+ if ( num == EVENT_OBJECT_BPARA ) strcpy(text, "Construit un paratonnerre");
+ if ( num == EVENT_OBJECT_BINFO ) strcpy(text, "Construit une borne d'information");
+ if ( num == EVENT_OBJECT_GFLAT ) strcpy(text, "Montre si le sol est plat");
+ if ( num == EVENT_OBJECT_FCREATE ) strcpy(text, "Pose un drapeau de couleur");
+ if ( num == EVENT_OBJECT_FDELETE ) strcpy(text, "Enl�ve un drapeau");
+ if ( num == EVENT_OBJECT_FCOLORb ) strcpy(text, "\\Drapeaux bleus");
+ if ( num == EVENT_OBJECT_FCOLORr ) strcpy(text, "\\Drapeaux rouges");
+ if ( num == EVENT_OBJECT_FCOLORg ) strcpy(text, "\\Drapeaux verts");
+ if ( num == EVENT_OBJECT_FCOLORy ) strcpy(text, "\\Drapeaux jaunes");
+ if ( num == EVENT_OBJECT_FCOLORv ) strcpy(text, "\\Drapeaux violets");
+ if ( num == EVENT_OBJECT_FACTORYfa ) strcpy(text, "Fabrique un d�m�nageur volant");
+ if ( num == EVENT_OBJECT_FACTORYta ) strcpy(text, "Fabrique un d�m�nageur � chenilles");
+ if ( num == EVENT_OBJECT_FACTORYwa ) strcpy(text, "Fabrique un d�m�nageur � roues");
+ if ( num == EVENT_OBJECT_FACTORYia ) strcpy(text, "Fabrique un d�m�nageur � pattes");
+ if ( num == EVENT_OBJECT_FACTORYfc ) strcpy(text, "Fabrique un shooter volant");
+ if ( num == EVENT_OBJECT_FACTORYtc ) strcpy(text, "Fabrique un shooter � chenilles");
+ if ( num == EVENT_OBJECT_FACTORYwc ) strcpy(text, "Fabrique un shooter � roues");
+ if ( num == EVENT_OBJECT_FACTORYic ) strcpy(text, "Fabrique un shooter � pattes");
+ if ( num == EVENT_OBJECT_FACTORYfi ) strcpy(text, "Fabrique un orgaShooter volant");
+ if ( num == EVENT_OBJECT_FACTORYti ) strcpy(text, "Fabrique un orgaShooter � chenilles");
+ if ( num == EVENT_OBJECT_FACTORYwi ) strcpy(text, "Fabrique un orgaShooter � roues");
+ if ( num == EVENT_OBJECT_FACTORYii ) strcpy(text, "Fabrique un orgaShooter � pattes");
+ if ( num == EVENT_OBJECT_FACTORYfs ) strcpy(text, "Fabrique un renifleur volant");
+ if ( num == EVENT_OBJECT_FACTORYts ) strcpy(text, "Fabrique un renifleur � chenilles");
+ if ( num == EVENT_OBJECT_FACTORYws ) strcpy(text, "Fabrique un renifleur � roues");
+ if ( num == EVENT_OBJECT_FACTORYis ) strcpy(text, "Fabrique un renifleur � pattes");
+ if ( num == EVENT_OBJECT_FACTORYrt ) strcpy(text, "Fabrique un robot secoueur");
+ if ( num == EVENT_OBJECT_FACTORYrc ) strcpy(text, "Fabrique un robot phazer");
+ if ( num == EVENT_OBJECT_FACTORYrr ) strcpy(text, "Fabrique un robot recycleur");
+ if ( num == EVENT_OBJECT_FACTORYrs ) strcpy(text, "Fabrique un robot bouclier");
+ if ( num == EVENT_OBJECT_FACTORYsa ) strcpy(text, "Fabrique un robot sous-marin");
+ if ( num == EVENT_OBJECT_RTANK ) strcpy(text, "Recherche les chenilles");
+ if ( num == EVENT_OBJECT_RFLY ) strcpy(text, "Recherche les robots volants");
+ if ( num == EVENT_OBJECT_RTHUMP ) strcpy(text, "Recherche le secoueur");
+ if ( num == EVENT_OBJECT_RCANON ) strcpy(text, "Recherche le canon shooter");
+ if ( num == EVENT_OBJECT_RTOWER ) strcpy(text, "Recherche la tour de d�fense");
+ if ( num == EVENT_OBJECT_RPHAZER ) strcpy(text, "Recherche le canon phazer");
+ if ( num == EVENT_OBJECT_RSHIELD ) strcpy(text, "Recherche le bouclier");
+ if ( num == EVENT_OBJECT_RATOMIC ) strcpy(text, "Recherche le nucl�aire");
+ if ( num == EVENT_OBJECT_RiPAW ) strcpy(text, "Recherche les pattes");
+ if ( num == EVENT_OBJECT_RiGUN ) strcpy(text, "Recherche le canon orgaShooter");
+ if ( num == EVENT_OBJECT_RESET ) strcpy(text, "Remet au d�part");
+ if ( num == EVENT_OBJECT_SEARCH ) strcpy(text, "Cherche (\\key action;)");
+ if ( num == EVENT_OBJECT_TERRAFORM ) strcpy(text, "Secoue (\\key action;)");
+ if ( num == EVENT_OBJECT_FIRE ) strcpy(text, "Tir (\\key action;)");
+ if ( num == EVENT_OBJECT_RECOVER ) strcpy(text, "Recycle (\\key action;)");
+ if ( num == EVENT_OBJECT_BEGSHIELD ) strcpy(text, "D�ploie le bouclier (\\key action;)");
+ if ( num == EVENT_OBJECT_ENDSHIELD ) strcpy(text, "Stoppe le bouclier (\\key action;)");
+ if ( num == EVENT_OBJECT_DIMSHIELD ) strcpy(text, "Rayon du bouclier");
+ if ( num == EVENT_OBJECT_PROGRUN ) strcpy(text, "Ex�cute le programme s�lectionn�");
+ if ( num == EVENT_OBJECT_PROGEDIT ) strcpy(text, "Edite le programme s�lectionn�");
+ if ( num == EVENT_OBJECT_INFOOK ) strcpy(text, "\\Mettre le SatCom en veille");
+ if ( num == EVENT_OBJECT_DELETE ) strcpy(text, "D�molit le b�timent");
+ if ( num == EVENT_OBJECT_GENERGY ) strcpy(text, "Niveau d'�nergie");
+ if ( num == EVENT_OBJECT_GSHIELD ) strcpy(text, "Niveau du bouclier");
+ if ( num == EVENT_OBJECT_GRANGE ) strcpy(text, "Temp�rature du r�acteur");
+ if ( num == EVENT_OBJECT_GPROGRESS ) strcpy(text, "Travail en cours ...");
+ if ( num == EVENT_OBJECT_GRADAR ) strcpy(text, "Nombre d'insectes d�tect�s");
+ if ( num == EVENT_OBJECT_GINFO ) strcpy(text, "Informations diffus�es");
+ if ( num == EVENT_OBJECT_COMPASS ) strcpy(text, "Boussole");
+//? if ( num == EVENT_OBJECT_MAP ) strcpy(text, "Mini-carte");
+ if ( num == EVENT_OBJECT_MAPZOOM ) strcpy(text, "Zoom mini-carte");
+ if ( num == EVENT_OBJECT_CAMERA ) strcpy(text, "Cam�ra (\\key camera;)");
+ if ( num == EVENT_OBJECT_CAMERAleft) strcpy(text, "Cam�ra � gauche");
+ if ( num == EVENT_OBJECT_CAMERAright) strcpy(text, "Cam�ra � droite");
+ if ( num == EVENT_OBJECT_CAMERAnear) strcpy(text, "Cam�ra plus proche");
+ if ( num == EVENT_OBJECT_CAMERAaway) strcpy(text, "Cam�ra plus loin");
+ if ( num == EVENT_OBJECT_HELP ) strcpy(text, "Instructions sur la s�lection");
+ if ( num == EVENT_OBJECT_SOLUCE ) strcpy(text, "Donne la solution");
+ if ( num == EVENT_OBJECT_SHORTCUT00) strcpy(text, "Permute robots <-> b�timents");
+ if ( num == EVENT_OBJECT_LIMIT ) strcpy(text, "Montre le rayon d'action");
+ if ( num == EVENT_OBJECT_PEN0 ) strcpy(text, "\\Rel�ve le crayon");
+ if ( num == EVENT_OBJECT_PEN1 ) strcpy(text, "\\Abaisse le crayon noir");
+ if ( num == EVENT_OBJECT_PEN2 ) strcpy(text, "\\Abaisse le crayon jaune");
+ if ( num == EVENT_OBJECT_PEN3 ) strcpy(text, "\\Abaisse le crayon orange");
+ if ( num == EVENT_OBJECT_PEN4 ) strcpy(text, "\\Abaisse le crayon rouge");
+ if ( num == EVENT_OBJECT_PEN5 ) strcpy(text, "\\Abaisse le crayon violet");
+ if ( num == EVENT_OBJECT_PEN6 ) strcpy(text, "\\Abaisse le crayon bleu");
+ if ( num == EVENT_OBJECT_PEN7 ) strcpy(text, "\\Abaisse le crayon vert");
+ if ( num == EVENT_OBJECT_PEN8 ) strcpy(text, "\\Abaisse le crayon brun");
+ if ( num == EVENT_OBJECT_REC ) strcpy(text, "\\D�marre l'enregistrement");
+ if ( num == EVENT_OBJECT_STOP ) strcpy(text, "\\Stoppe l'enregistrement");
+ if ( num == EVENT_DT_VISIT0 ||
+ num == EVENT_DT_VISIT1 ||
+ num == EVENT_DT_VISIT2 ||
+ num == EVENT_DT_VISIT3 ||
+ num == EVENT_DT_VISIT4 ) strcpy(text, "Montre l'endroit");
+ if ( num == EVENT_DT_END ) strcpy(text, "Continuer");
+ if ( num == EVENT_CMD ) strcpy(text, "Console de commande");
+ if ( num == EVENT_SPEED ) strcpy(text, "Vitesse du jeu");
+
+ if ( num == EVENT_HYPER_PREV ) strcpy(text, "Page pr�c�dente");
+ if ( num == EVENT_HYPER_NEXT ) strcpy(text, "Page suivante");
+ if ( num == EVENT_HYPER_HOME ) strcpy(text, "Page initiale");
+ if ( num == EVENT_HYPER_COPY ) strcpy(text, "Copier");
+ if ( num == EVENT_HYPER_SIZE1 ) strcpy(text, "Taille 1");
+ if ( num == EVENT_HYPER_SIZE2 ) strcpy(text, "Taille 2");
+ if ( num == EVENT_HYPER_SIZE3 ) strcpy(text, "Taille 3");
+ if ( num == EVENT_HYPER_SIZE4 ) strcpy(text, "Taille 4");
+ if ( num == EVENT_HYPER_SIZE5 ) strcpy(text, "Taille 5");
+ if ( num == EVENT_SATCOM_HUSTON ) strcpy(text, "Instructions de Houston");
+#if _TEEN
+ if ( num == EVENT_SATCOM_SAT ) strcpy(text, "Dictionnaire anglais-fran�ais");
+#else
+ if ( num == EVENT_SATCOM_SAT ) strcpy(text, "Rapport du satellite");
+#endif
+ if ( num == EVENT_SATCOM_LOADING ) strcpy(text, "Programmes envoy�s par Houston");
+ if ( num == EVENT_SATCOM_OBJECT ) strcpy(text, "Liste des objets");
+ if ( num == EVENT_SATCOM_PROG ) strcpy(text, "Aide � la programmation");
+ if ( num == EVENT_SATCOM_SOLUCE ) strcpy(text, "Solution");
+
+ if ( num == EVENT_STUDIO_OK ) strcpy(text, "D'accord\\Compiler le programme");
+ if ( num == EVENT_STUDIO_CANCEL ) strcpy(text, "Annuler\\Annuler toutes les modifications");
+ if ( num == EVENT_STUDIO_NEW ) strcpy(text, "Nouveau");
+ if ( num == EVENT_STUDIO_OPEN ) strcpy(text, "Ouvrir (Ctrl+o)");
+ if ( num == EVENT_STUDIO_SAVE ) strcpy(text, "Enregistrer (Ctrl+s)");
+ if ( num == EVENT_STUDIO_UNDO ) strcpy(text, "Annuler (Ctrl+z)");
+ if ( num == EVENT_STUDIO_CUT ) strcpy(text, "Couper (Ctrl+x)");
+ if ( num == EVENT_STUDIO_COPY ) strcpy(text, "Copier (Ctrl+c)");
+ if ( num == EVENT_STUDIO_PASTE ) strcpy(text, "Coller (Ctrl+v)");
+ if ( num == EVENT_STUDIO_SIZE ) strcpy(text, "Taille des caract�res");
+ if ( num == EVENT_STUDIO_TOOL ) strcpy(text, "Instructions (\\key help;)");
+ if ( num == EVENT_STUDIO_HELP ) strcpy(text, "Aide � la programmation (\\key prog;)");
+ if ( num == EVENT_STUDIO_COMPILE ) strcpy(text, "Compiler");
+ if ( num == EVENT_STUDIO_RUN ) strcpy(text, "D�marrer/stopper");
+ if ( num == EVENT_STUDIO_REALTIME ) strcpy(text, "Pause/continuer");
+ if ( num == EVENT_STUDIO_STEP ) strcpy(text, "Un pas");
+ }
+
+ if ( type == RES_OBJECT )
+ {
+ if ( num == OBJECT_PORTICO ) strcpy(text, "Portique");
+ if ( num == OBJECT_BASE ) strcpy(text, "Vaisseau spatial");
+ if ( num == OBJECT_DERRICK ) strcpy(text, "Derrick");
+ if ( num == OBJECT_FACTORY ) strcpy(text, "Fabrique de robots");
+ if ( num == OBJECT_REPAIR ) strcpy(text, "Centre de r�paration");
+ if ( num == OBJECT_DESTROYER ) strcpy(text, "Destructeur");
+ if ( num == OBJECT_STATION ) strcpy(text, "Station de recharge");
+ if ( num == OBJECT_CONVERT ) strcpy(text, "Conversion minerai en titanium");
+ if ( num == OBJECT_TOWER ) strcpy(text, "Tour de d�fense");
+ if ( num == OBJECT_NEST ) strcpy(text, "Nid");
+ if ( num == OBJECT_RESEARCH ) strcpy(text, "Centre de recherches");
+ if ( num == OBJECT_RADAR ) strcpy(text, "Radar");
+ if ( num == OBJECT_INFO ) strcpy(text, "Borne d'information");
+#if _TEEN
+ if ( num == OBJECT_ENERGY ) strcpy(text, "D�sint�grateur");
+#else
+ if ( num == OBJECT_ENERGY ) strcpy(text, "Fabrique de piles");
+#endif
+ if ( num == OBJECT_LABO ) strcpy(text, "Laboratoire de mati�res organiques");
+ if ( num == OBJECT_NUCLEAR ) strcpy(text, "Centrale nucl�aire");
+ if ( num == OBJECT_PARA ) strcpy(text, "Paratonnerre");
+ if ( num == OBJECT_SAFE ) strcpy(text, "Coffre-fort");
+ if ( num == OBJECT_HUSTON ) strcpy(text, "Centre de contr�le");
+ if ( num == OBJECT_TARGET1 ) strcpy(text, "Cible");
+ if ( num == OBJECT_TARGET2 ) strcpy(text, "Cible");
+ if ( num == OBJECT_START ) strcpy(text, "D�part");
+ if ( num == OBJECT_END ) strcpy(text, "But");
+ if ( num == OBJECT_STONE ) strcpy(text, "Minerai de titanium");
+ if ( num == OBJECT_URANIUM ) strcpy(text, "Minerai d'uranium");
+ if ( num == OBJECT_BULLET ) strcpy(text, "Mati�re organique");
+ if ( num == OBJECT_METAL ) strcpy(text, "Titanium");
+ if ( num == OBJECT_POWER ) strcpy(text, "Pile normale");
+ if ( num == OBJECT_ATOMIC ) strcpy(text, "Pile nucl�aire");
+ if ( num == OBJECT_BBOX ) strcpy(text, "Bo�te noire");
+ if ( num == OBJECT_KEYa ) strcpy(text, "Cl� A");
+ if ( num == OBJECT_KEYb ) strcpy(text, "Cl� B");
+ if ( num == OBJECT_KEYc ) strcpy(text, "Cl� C");
+ if ( num == OBJECT_KEYd ) strcpy(text, "Cl� D");
+ if ( num == OBJECT_TNT ) strcpy(text, "Explosif");
+ if ( num == OBJECT_BOMB ) strcpy(text, "Mine fixe");
+ if ( num == OBJECT_BAG ) strcpy(text, "Sac de survie");
+ if ( num == OBJECT_WAYPOINT ) strcpy(text, "Indicateur");
+ if ( num == OBJECT_FLAGb ) strcpy(text, "Drapeau bleu");
+ if ( num == OBJECT_FLAGr ) strcpy(text, "Drapeau rouge");
+ if ( num == OBJECT_FLAGg ) strcpy(text, "Drapeau vert");
+ if ( num == OBJECT_FLAGy ) strcpy(text, "Drapeau jaune");
+ if ( num == OBJECT_FLAGv ) strcpy(text, "Drapeau violet");
+ if ( num == OBJECT_MARKPOWER ) strcpy(text, "Emplacement pour station");
+ if ( num == OBJECT_MARKURANIUM ) strcpy(text, "Emplacement pour derrick (uranium)");
+ if ( num == OBJECT_MARKKEYa ) strcpy(text, "Emplacement pour derrick (cl� A)");
+ if ( num == OBJECT_MARKKEYb ) strcpy(text, "Emplacement pour derrick (cl� B)");
+ if ( num == OBJECT_MARKKEYc ) strcpy(text, "Emplacement pour derrick (cl� C)");
+ if ( num == OBJECT_MARKKEYd ) strcpy(text, "Emplacement pour derrick (cl� D)");
+ if ( num == OBJECT_MARKSTONE ) strcpy(text, "Emplacement pour derrick (titanium)");
+ if ( num == OBJECT_MOBILEft ) strcpy(text, "Robot d'entra�nement");
+ if ( num == OBJECT_MOBILEtt ) strcpy(text, "Robot d'entra�nement");
+ if ( num == OBJECT_MOBILEwt ) strcpy(text, "Robot d'entra�nement");
+ if ( num == OBJECT_MOBILEit ) strcpy(text, "Robot d'entra�nement");
+ if ( num == OBJECT_MOBILEfa ) strcpy(text, "Robot d�m�nageur");
+ if ( num == OBJECT_MOBILEta ) strcpy(text, "Robot d�m�nageur");
+ if ( num == OBJECT_MOBILEwa ) strcpy(text, "Robot d�m�nageur");
+ if ( num == OBJECT_MOBILEia ) strcpy(text, "Robot d�m�nageur");
+ if ( num == OBJECT_MOBILEfc ) strcpy(text, "Robot shooter");
+ if ( num == OBJECT_MOBILEtc ) strcpy(text, "Robot shooter");
+ if ( num == OBJECT_MOBILEwc ) strcpy(text, "Robot shooter");
+ if ( num == OBJECT_MOBILEic ) strcpy(text, "Robot shooter");
+ if ( num == OBJECT_MOBILEfi ) strcpy(text, "Robot orgaShooter");
+ if ( num == OBJECT_MOBILEti ) strcpy(text, "Robot orgaShooter");
+ if ( num == OBJECT_MOBILEwi ) strcpy(text, "Robot orgaShooter");
+ if ( num == OBJECT_MOBILEii ) strcpy(text, "Robot orgaShooter");
+ if ( num == OBJECT_MOBILEfs ) strcpy(text, "Robot renifleur");
+ if ( num == OBJECT_MOBILEts ) strcpy(text, "Robot renifleur");
+ if ( num == OBJECT_MOBILEws ) strcpy(text, "Robot renifleur");
+ if ( num == OBJECT_MOBILEis ) strcpy(text, "Robot renifleur");
+ if ( num == OBJECT_MOBILErt ) strcpy(text, "Robot secoueur");
+ if ( num == OBJECT_MOBILErc ) strcpy(text, "Robot phazer");
+ if ( num == OBJECT_MOBILErr ) strcpy(text, "Robot recycleur");
+ if ( num == OBJECT_MOBILErs ) strcpy(text, "Robot bouclier");
+ if ( num == OBJECT_MOBILEsa ) strcpy(text, "Robot sous-marin");
+ if ( num == OBJECT_MOBILEtg ) strcpy(text, "Cible d'entra�nement");
+ if ( num == OBJECT_MOBILEdr ) strcpy(text, "Robot dessinateur");
+ if ( num == OBJECT_HUMAN ) strcpy(text, g_gamerName);
+ if ( num == OBJECT_TECH ) strcpy(text, "Technicien");
+ if ( num == OBJECT_TOTO ) strcpy(text, "Robbie");
+ if ( num == OBJECT_MOTHER ) strcpy(text, "Pondeuse");
+ if ( num == OBJECT_ANT ) strcpy(text, "Fourmi");
+ if ( num == OBJECT_SPIDER ) strcpy(text, "Araign�e");
+ if ( num == OBJECT_BEE ) strcpy(text, "Gu�pe");
+ if ( num == OBJECT_WORM ) strcpy(text, "Ver");
+ if ( num == OBJECT_EGG ) strcpy(text, "Oeuf");
+ if ( num == OBJECT_RUINmobilew1 ) strcpy(text, "Epave de robot");
+ if ( num == OBJECT_RUINmobilew2 ) strcpy(text, "Epave de robot");
+ if ( num == OBJECT_RUINmobilet1 ) strcpy(text, "Epave de robot");
+ if ( num == OBJECT_RUINmobilet2 ) strcpy(text, "Epave de robot");
+ if ( num == OBJECT_RUINmobiler1 ) strcpy(text, "Epave de robot");
+ if ( num == OBJECT_RUINmobiler2 ) strcpy(text, "Epave de robot");
+ if ( num == OBJECT_RUINfactory ) strcpy(text, "B�timent en ruine");
+ if ( num == OBJECT_RUINdoor ) strcpy(text, "B�timent en ruine");
+ if ( num == OBJECT_RUINsupport ) strcpy(text, "D�chet");
+ if ( num == OBJECT_RUINradar ) strcpy(text, "B�timent en ruine");
+ if ( num == OBJECT_RUINconvert ) strcpy(text, "B�timent en ruine");
+ if ( num == OBJECT_RUINbase ) strcpy(text, "Epave de vaisseau spatial");
+ if ( num == OBJECT_RUINhead ) strcpy(text, "Epave de vaisseau spatial");
+ if ( num == OBJECT_APOLLO1 ||
+ num == OBJECT_APOLLO3 ||
+ num == OBJECT_APOLLO4 ||
+ num == OBJECT_APOLLO5 ) strcpy(text, "Vestige d'une mission Apollo");
+ if ( num == OBJECT_APOLLO2 ) strcpy(text, "Lunar Roving Vehicle");
+ }
+
+ if ( type == RES_ERR )
+ {
+ strcpy(text, "Erreur");
+ if ( num == ERR_CMD ) strcpy(text, "Commande inconnue");
+#if _NEWLOOK
+ if ( num == ERR_INSTALL ) strcpy(text, "CeeBot n'est pas install�.");
+ if ( num == ERR_NOCD ) strcpy(text, "Veuillez mettre le CD de CeeBot\net relancer le jeu.");
+#else
+ if ( num == ERR_INSTALL ) strcpy(text, "COLOBOT n'est pas install�.");
+ if ( num == ERR_NOCD ) strcpy(text, "Veuillez mettre le CD de COLOBOT\net relancer le jeu.");
+#endif
+ if ( num == ERR_MANIP_VEH ) strcpy(text, "Robot inadapt�");
+ if ( num == ERR_MANIP_FLY ) strcpy(text, "Impossible en vol");
+ if ( num == ERR_MANIP_BUSY ) strcpy(text, "Porte d�j� quelque chose");
+ if ( num == ERR_MANIP_NIL ) strcpy(text, "Rien � prendre");
+ if ( num == ERR_MANIP_MOTOR ) strcpy(text, "Impossible en mouvement");
+ if ( num == ERR_MANIP_OCC ) strcpy(text, "Emplacement occup�");
+ if ( num == ERR_MANIP_FRIEND ) strcpy(text, "Pas d'autre robot");
+ if ( num == ERR_MANIP_RADIO ) strcpy(text, "Vous ne pouvez pas transporter un objet radioactif");
+ if ( num == ERR_MANIP_WATER ) strcpy(text, "Vous ne pouvez pas transporter un objet sous l'eau");
+ if ( num == ERR_MANIP_EMPTY ) strcpy(text, "Rien � d�poser");
+ if ( num == ERR_BUILD_FLY ) strcpy(text, "Impossible en vol");
+ if ( num == ERR_BUILD_WATER ) strcpy(text, "Impossible sous l'eau");
+ if ( num == ERR_BUILD_ENERGY ) strcpy(text, "Pas assez d'�nergie");
+ if ( num == ERR_BUILD_METALAWAY ) strcpy(text, "Titanium trop loin");
+ if ( num == ERR_BUILD_METALNEAR ) strcpy(text, "Titanium trop proche");
+ if ( num == ERR_BUILD_METALINEX ) strcpy(text, "Titanium inexistant");
+ if ( num == ERR_BUILD_FLAT ) strcpy(text, "Sol pas assez plat");
+ if ( num == ERR_BUILD_FLATLIT ) strcpy(text, "Sol plat pas assez grand");
+ if ( num == ERR_BUILD_BUSY ) strcpy(text, "Emplacement occup�");
+ if ( num == ERR_BUILD_BASE ) strcpy(text, "Trop proche du vaisseau spatial");
+ if ( num == ERR_BUILD_NARROW ) strcpy(text, "Trop proche d'un b�timent");
+ if ( num == ERR_BUILD_MOTOR ) strcpy(text, "Impossible en mouvement");
+ if ( num == ERR_SEARCH_FLY ) strcpy(text, "Impossible en vol");
+ if ( num == ERR_SEARCH_VEH ) strcpy(text, "Robot inadapt�");
+ if ( num == ERR_SEARCH_MOTOR ) strcpy(text, "Impossible en mouvement");
+ if ( num == ERR_TERRA_VEH ) strcpy(text, "Robot inadapt�");
+ if ( num == ERR_TERRA_ENERGY ) strcpy(text, "Pas assez d'�nergie");
+ if ( num == ERR_TERRA_FLOOR ) strcpy(text, "Terrain inadapt�");
+ if ( num == ERR_TERRA_BUILDING ) strcpy(text, "B�timent trop proche");
+ if ( num == ERR_TERRA_OBJECT ) strcpy(text, "Objet trop proche");
+ if ( num == ERR_RECOVER_VEH ) strcpy(text, "Robot inadapt�");
+ if ( num == ERR_RECOVER_ENERGY ) strcpy(text, "Pas assez d'�nergie");
+ if ( num == ERR_RECOVER_NULL ) strcpy(text, "Rien � recycler");
+ if ( num == ERR_SHIELD_VEH ) strcpy(text, "Robot inadapt�");
+ if ( num == ERR_SHIELD_ENERGY ) strcpy(text, "Plus d'�nergie");
+ if ( num == ERR_MOVE_IMPOSSIBLE ) strcpy(text, "D�placement impossible");
+ if ( num == ERR_FIND_IMPOSSIBLE ) strcpy(text, "Objet n'existe pas");
+ if ( num == ERR_GOTO_IMPOSSIBLE ) strcpy(text, "Chemin introuvable");
+ if ( num == ERR_GOTO_ITER ) strcpy(text, "Position inaccessible");
+ if ( num == ERR_GOTO_BUSY ) strcpy(text, "Destination occup�e");
+ if ( num == ERR_FIRE_VEH ) strcpy(text, "Robot inadapt�");
+ if ( num == ERR_FIRE_ENERGY ) strcpy(text, "Pas assez d'�nergie");
+ if ( num == ERR_FIRE_FLY ) strcpy(text, "Impossible en vol");
+ if ( num == ERR_CONVERT_EMPTY ) strcpy(text, "Pas de minerai de titanium � convertir");
+ if ( num == ERR_DERRICK_NULL ) strcpy(text, "Pas de minerai en sous-sol");
+ if ( num == ERR_STATION_NULL ) strcpy(text, "Pas d'�nergie en sous-sol");
+ if ( num == ERR_TOWER_POWER ) strcpy(text, "Pas de pile");
+ if ( num == ERR_TOWER_ENERGY ) strcpy(text, "Plus d'�nergie");
+ if ( num == ERR_RESEARCH_POWER ) strcpy(text, "Pas de pile");
+ if ( num == ERR_RESEARCH_ENERGY ) strcpy(text, "Plus assez d'�nergie");
+ if ( num == ERR_RESEARCH_TYPE ) strcpy(text, "Pas le bon type de pile");
+ if ( num == ERR_RESEARCH_ALREADY) strcpy(text, "Recherche d�j� effectu�e");
+ if ( num == ERR_ENERGY_NULL ) strcpy(text, "Pas d'�nergie en sous-sol");
+ if ( num == ERR_ENERGY_LOW ) strcpy(text, "Pas encore assez d'�nergie");
+ if ( num == ERR_ENERGY_EMPTY ) strcpy(text, "Pas de titanium � transformer");
+ if ( num == ERR_ENERGY_BAD ) strcpy(text, "Ne transforme que le titanium");
+ if ( num == ERR_BASE_DLOCK ) strcpy(text, "Portes bloqu�es par un robot ou un objet");
+ if ( num == ERR_BASE_DHUMAN ) strcpy(text, "Vous devez embarquer pour pouvoir d�coller");
+ if ( num == ERR_LABO_NULL ) strcpy(text, "Rien � analyser");
+ if ( num == ERR_LABO_BAD ) strcpy(text, "N'analyse que la mati�re organique");
+ if ( num == ERR_LABO_ALREADY ) strcpy(text, "Analyse d�j� effectu�e");
+ if ( num == ERR_NUCLEAR_NULL ) strcpy(text, "Pas d'�nergie en sous-sol");
+ if ( num == ERR_NUCLEAR_LOW ) strcpy(text, "Pas encore assez d'�nergie");
+ if ( num == ERR_NUCLEAR_EMPTY ) strcpy(text, "Pas d'uranium � transformer");
+ if ( num == ERR_NUCLEAR_BAD ) strcpy(text, "Ne transforme que l'uranium");
+ if ( num == ERR_FACTORY_NULL ) strcpy(text, "Pas de titanium");
+ if ( num == ERR_FACTORY_NEAR ) strcpy(text, "Quelque chose est trop proche");
+ if ( num == ERR_RESET_NEAR ) strcpy(text, "Emplacement occup�");
+ if ( num == ERR_INFO_NULL ) strcpy(text, "Pas trouv� de borne d'information");
+ if ( num == ERR_VEH_VIRUS ) strcpy(text, "Un programme est infect� par un virus");
+ if ( num == ERR_BAT_VIRUS ) strcpy(text, "Infect� par un virus, ne fonctionne plus temporairement");
+ if ( num == ERR_VEH_POWER ) strcpy(text, "Pas de pile");
+ if ( num == ERR_VEH_ENERGY ) strcpy(text, "Plus d'�nergie");
+ if ( num == ERR_FLAG_FLY ) strcpy(text, "Impossible en vol");
+ if ( num == ERR_FLAG_WATER ) strcpy(text, "Impossible en nageant");
+ if ( num == ERR_FLAG_MOTOR ) strcpy(text, "Impossible en mouvement");
+ if ( num == ERR_FLAG_BUSY ) strcpy(text, "Impossible en portant un objet");
+ if ( num == ERR_FLAG_CREATE ) strcpy(text, "Trop de drapeaux de cette couleur (maximum 5)");
+ if ( num == ERR_FLAG_PROXY ) strcpy(text, "Trop proche d'un drapeau existant");
+ if ( num == ERR_FLAG_DELETE ) strcpy(text, "Aucun drapeau � proximit�");
+ if ( num == ERR_MISSION_NOTERM ) strcpy(text, "La misssion n'est pas termin�e (appuyez sur \\key help; pour plus de d�tails)");
+ if ( num == ERR_DELETEMOBILE ) strcpy(text, "Robot d�truit");
+ if ( num == ERR_DELETEBUILDING ) strcpy(text, "B�timent d�truit");
+ if ( num == ERR_TOOMANY ) strcpy(text, "Cr�ation impossible, il y a trop d'objets");
+ if ( num == ERR_OBLIGATORYTOKEN ) strcpy(text, "Il manque \"%s\" dans le programme");
+ if ( num == ERR_PROHIBITEDTOKEN ) strcpy(text, "Interdit dans cet exercice");
+
+ if ( num == INFO_BUILD ) strcpy(text, "B�timent termin�");
+ if ( num == INFO_CONVERT ) strcpy(text, "Titanium disponible");
+ if ( num == INFO_RESEARCH ) strcpy(text, "Recherche termin�e");
+ if ( num == INFO_RESEARCHTANK ) strcpy(text, "Fabrication d'un robot � chenilles possible");
+ if ( num == INFO_RESEARCHFLY ) strcpy(text, "Il est possible de voler avec les touches (\\key gup;) et (\\key gdown;)");
+ if ( num == INFO_RESEARCHTHUMP ) strcpy(text, "Fabrication d'un robot secoueur possible");
+ if ( num == INFO_RESEARCHCANON ) strcpy(text, "Fabrication de robots shooter possible");
+ if ( num == INFO_RESEARCHTOWER ) strcpy(text, "Construction d'une tour de d�fense possible");
+ if ( num == INFO_RESEARCHPHAZER ) strcpy(text, "Fabrication d'un robot phazer possible");
+ if ( num == INFO_RESEARCHSHIELD ) strcpy(text, "Fabrication d'un robot bouclier possible");
+ if ( num == INFO_RESEARCHATOMIC ) strcpy(text, "Construction d'une centrale nucl�aire possible");
+ if ( num == INFO_FACTORY ) strcpy(text, "Nouveau robot disponible");
+ if ( num == INFO_LABO ) strcpy(text, "Analyse termin�e");
+ if ( num == INFO_ENERGY ) strcpy(text, "Pile disponible");
+ if ( num == INFO_NUCLEAR ) strcpy(text, "Pile nucl�aire disponible");
+ if ( num == INFO_FINDING ) strcpy(text, "Vous avez trouv� un objet utilisable");
+ if ( num == INFO_MARKPOWER ) strcpy(text, "Emplacement pour station trouv�");
+ if ( num == INFO_MARKURANIUM ) strcpy(text, "Emplacement pour derrick trouv�");
+ if ( num == INFO_MARKSTONE ) strcpy(text, "Emplacement pour derrick trouv�");
+ if ( num == INFO_MARKKEYa ) strcpy(text, "Emplacement pour derrick trouv�");
+ if ( num == INFO_MARKKEYb ) strcpy(text, "Emplacement pour derrick trouv�");
+ if ( num == INFO_MARKKEYc ) strcpy(text, "Emplacement pour derrick trouv�");
+ if ( num == INFO_MARKKEYd ) strcpy(text, "Emplacement pour derrick trouv�");
+ if ( num == INFO_WIN ) strcpy(text, "<<< Bravo, mission termin�e >>>");
+ if ( num == INFO_LOST ) strcpy(text, "<<< D�sol�, mission �chou�e >>>");
+ if ( num == INFO_LOSTq ) strcpy(text, "<<< D�sol�, mission �chou�e >>>");
+ if ( num == INFO_WRITEOK ) strcpy(text, "Enregistrement effectu�");
+ if ( num == INFO_DELETEPATH ) strcpy(text, "Indicateur atteint");
+ if ( num == INFO_DELETEMOTHER ) strcpy(text, "Pondeuse mortellement touch�e");
+ if ( num == INFO_DELETEANT ) strcpy(text, "Fourmi mortellement touch�e");
+ if ( num == INFO_DELETEBEE ) strcpy(text, "Gu�pe mortellement touch�e");
+ if ( num == INFO_DELETEWORM ) strcpy(text, "Ver mortellement touch�");
+ if ( num == INFO_DELETESPIDER ) strcpy(text, "Araign�e mortellement touch�e");
+ if ( num == INFO_BEGINSATCOM ) strcpy(text, "Consultez votre SatCom en appuyant sur \\key help;");
+ }
+
+ if ( type == RES_CBOT )
+ {
+ strcpy(text, "Erreur");
+ if ( num == TX_OPENPAR ) strcpy(text, "Il manque une parenth�se ouvrante");
+ if ( num == TX_CLOSEPAR ) strcpy(text, "Il manque une parenth�se fermante");
+ if ( num == TX_NOTBOOL ) strcpy(text, "L'expression doit �tre un boolean");
+ if ( num == TX_UNDEFVAR ) strcpy(text, "Variable non d�clar�e");
+ if ( num == TX_BADLEFT ) strcpy(text, "Assignation impossible");
+ if ( num == TX_ENDOF ) strcpy(text, "Terminateur point-virgule non trouv�");
+ if ( num == TX_OUTCASE ) strcpy(text, "Instruction ""case"" hors d'un bloc ""switch""");
+ if ( num == TX_NOTERM ) strcpy(text, "Instructions apr�s la fin");
+ if ( num == TX_CLOSEBLK ) strcpy(text, "Il manque la fin du bloc");
+ if ( num == TX_ELSEWITHOUTIF ) strcpy(text, "Instruction ""else"" sans ""if"" correspondant");
+ if ( num == TX_OPENBLK ) strcpy(text, "D�but d'un bloc attendu");
+ if ( num == TX_BADTYPE ) strcpy(text, "Mauvais type de r�sultat pour l'assignation");
+ if ( num == TX_REDEFVAR ) strcpy(text, "Red�finition d'une variable");
+ if ( num == TX_BAD2TYPE ) strcpy(text, "Les deux op�randes ne sont pas de types compatibles");
+ if ( num == TX_UNDEFCALL ) strcpy(text, "Routine inconnue");
+ if ( num == TX_MISDOTS ) strcpy(text, "S�parateur "" : "" attendu");
+ if ( num == TX_WHILE ) strcpy(text, "Manque le mot ""while""");
+ if ( num == TX_BREAK ) strcpy(text, "Instruction ""break"" en dehors d'une boucle");
+ if ( num == TX_LABEL ) strcpy(text, "Un label ne peut se placer que devant un ""for"", un ""while"", un ""do"" ou un ""switch""");
+ if ( num == TX_NOLABEL ) strcpy(text, "Cette �tiquette n'existe pas");
+ if ( num == TX_NOCASE ) strcpy(text, "Manque une instruction ""case""");
+ if ( num == TX_BADNUM ) strcpy(text, "Un nombre est attendu");
+ if ( num == TX_VOID ) strcpy(text, "Param�tre void");
+ if ( num == TX_NOTYP ) strcpy(text, "D�claration de type attendu");
+ if ( num == TX_NOVAR ) strcpy(text, "Nom d'une variable attendu");
+ if ( num == TX_NOFONC ) strcpy(text, "Nom de la fonction attendu");
+ if ( num == TX_OVERPARAM ) strcpy(text, "Trop de param�tres");
+ if ( num == TX_REDEF ) strcpy(text, "Cette fonction existe d�j�");
+ if ( num == TX_LOWPARAM ) strcpy(text, "Pas assez de param�tres");
+ if ( num == TX_BADPARAM ) strcpy(text, "Aucune fonction de ce nom n'accepte ce(s) type(s) de param�tre(s)");
+ if ( num == TX_NUMPARAM ) strcpy(text, "Aucune fonction de ce nom n'accepte ce nombre de param�tres");
+ if ( num == TX_NOITEM ) strcpy(text, "Cet �l�ment n'existe pas dans cette classe");
+ if ( num == TX_DOT ) strcpy(text, "L'objet n'est pas une instance d'une classe");
+ if ( num == TX_NOCONST ) strcpy(text, "Il n'y a pas de constructeur appropri�");
+ if ( num == TX_REDEFCLASS ) strcpy(text, "Cette classe existe d�j�");
+ if ( num == TX_CLBRK ) strcpy(text, """ ] "" attendu");
+ if ( num == TX_RESERVED ) strcpy(text, "Ce mot est r�serv�");
+ if ( num == TX_BADNEW ) strcpy(text, "Mauvais argument pour ""new""");
+ if ( num == TX_OPBRK ) strcpy(text, """ [ "" attendu");
+ if ( num == TX_BADSTRING ) strcpy(text, "Une cha�ne de caract�re est attendue");
+ if ( num == TX_BADINDEX ) strcpy(text, "Mauvais type d'index");
+ if ( num == TX_PRIVATE ) strcpy(text, "El�ment prot�g�");
+ if ( num == TX_NOPUBLIC ) strcpy(text, "Public requis");
+ if ( num == TX_DIVZERO ) strcpy(text, "Division par z�ro");
+ if ( num == TX_NOTINIT ) strcpy(text, "Variable non initialis�e");
+ if ( num == TX_BADTHROW ) strcpy(text, "Valeur n�gative refus�e pour ""throw""");
+ if ( num == TX_NORETVAL ) strcpy(text, "La fonction n'a pas retourn� de r�sultat");
+ if ( num == TX_NORUN ) strcpy(text, "Pas de fonction en ex�cution");
+ if ( num == TX_NOCALL ) strcpy(text, "Appel d'une fonction inexistante");
+ if ( num == TX_NOCLASS ) strcpy(text, "Cette classe n'existe pas");
+ if ( num == TX_NULLPT ) strcpy(text, "Objet n'existe pas");
+ if ( num == TX_OPNAN ) strcpy(text, "Op�ration sur un ""nan""");
+ if ( num == TX_OUTARRAY ) strcpy(text, "Acc�s hors du tableau");
+ if ( num == TX_STACKOVER ) strcpy(text, "D�bordement de la pile");
+ if ( num == TX_DELETEDPT ) strcpy(text, "Objet inaccessible");
+ if ( num == TX_FILEOPEN ) strcpy(text, "Ouverture du fichier impossible");
+ if ( num == TX_NOTOPEN ) strcpy(text, "Le fichier n'est pas ouvert");
+ if ( num == TX_ERRREAD ) strcpy(text, "Erreur � la lecture");
+ if ( num == TX_ERRWRITE ) strcpy(text, "Erreur � l'�criture");
+ }
+
+ if ( type == RES_KEY )
+ {
+ if ( num == 0 ) strcpy(text, "< aucune >");
+ if ( num == SDLK_LEFT ) strcpy(text, "Fl�che Gauche");
+ if ( num == SDLK_RIGHT ) strcpy(text, "Fl�che Droite");
+ if ( num == SDLK_UP ) strcpy(text, "Fl�che Haut");
+ if ( num == SDLK_DOWN ) strcpy(text, "Fl�che Bas");
+ if ( num == SDLK_CANCEL ) strcpy(text, "Control-break");
+ if ( num == SDLK_BACK ) strcpy(text, "<--");
+ if ( num == SDLK_TAB ) strcpy(text, "Tab");
+ if ( num == SDLK_CLEAR ) strcpy(text, "Clear");
+ if ( num == SDLK_RETURN ) strcpy(text, "Entr�e");
+ if ( num == SDLK_SHIFT ) strcpy(text, "Shift");
+ if ( num == SDLK_CONTROL ) strcpy(text, "Ctrl");
+ if ( num == SDLK_MENU ) strcpy(text, "Alt");
+ if ( num == SDLK_PAUSE ) strcpy(text, "Pause");
+ if ( num == SDLK_CAPITAL ) strcpy(text, "Caps Lock");
+ if ( num == SDLK_ESCAPE ) strcpy(text, "Esc");
+ if ( num == SDLK_SPACE ) strcpy(text, "Espace");
+ if ( num == SDLK_PRIOR ) strcpy(text, "Page Up");
+ if ( num == SDLK_NEXT ) strcpy(text, "Page Down");
+ if ( num == SDLK_END ) strcpy(text, "End");
+ if ( num == SDLK_HOME ) strcpy(text, "Home");
+ if ( num == SDLK_SELECT ) strcpy(text, "Select");
+ if ( num == SDLK_EXECUTE ) strcpy(text, "Execute");
+ if ( num == SDLK_SNAPSHOT ) strcpy(text, "Print Scrn");
+ if ( num == SDLK_INSERT ) strcpy(text, "Insert");
+ if ( num == SDLK_DELETE ) strcpy(text, "Delete");
+ if ( num == SDLK_HELP ) strcpy(text, "Help");
+ if ( num == SDLK_LWIN ) strcpy(text, "Left Windows");
+ if ( num == SDLK_RWIN ) strcpy(text, "Right Windows");
+ if ( num == SDLK_APPS ) strcpy(text, "Application key");
+ if ( num == SDLK_NUMPAD0 ) strcpy(text, "NumPad 0");
+ if ( num == SDLK_NUMPAD1 ) strcpy(text, "NumPad 1");
+ if ( num == SDLK_NUMPAD2 ) strcpy(text, "NumPad 2");
+ if ( num == SDLK_NUMPAD3 ) strcpy(text, "NumPad 3");
+ if ( num == SDLK_NUMPAD4 ) strcpy(text, "NumPad 4");
+ if ( num == SDLK_NUMPAD5 ) strcpy(text, "NumPad 5");
+ if ( num == SDLK_NUMPAD6 ) strcpy(text, "NumPad 6");
+ if ( num == SDLK_NUMPAD7 ) strcpy(text, "NumPad 7");
+ if ( num == SDLK_NUMPAD8 ) strcpy(text, "NumPad 8");
+ if ( num == SDLK_NUMPAD9 ) strcpy(text, "NumPad 9");
+ if ( num == SDLK_MULTIPLY ) strcpy(text, "NumPad *");
+ if ( num == SDLK_ADD ) strcpy(text, "NumPad +");
+ if ( num == SDLK_SEPARATOR ) strcpy(text, "NumPad sep");
+ if ( num == SDLK_SUBTRACT ) strcpy(text, "NumPad -");
+ if ( num == SDLK_DECIMAL ) strcpy(text, "NumPad .");
+ if ( num == SDLK_DIVIDE ) strcpy(text, "NumPad /");
+ if ( num == SDLK_F1 ) strcpy(text, "F1");
+ if ( num == SDLK_F2 ) strcpy(text, "F2");
+ if ( num == SDLK_F3 ) strcpy(text, "F3");
+ if ( num == SDLK_F4 ) strcpy(text, "F4");
+ if ( num == SDLK_F5 ) strcpy(text, "F5");
+ if ( num == SDLK_F6 ) strcpy(text, "F6");
+ if ( num == SDLK_F7 ) strcpy(text, "F7");
+ if ( num == SDLK_F8 ) strcpy(text, "F8");
+ if ( num == SDLK_F9 ) strcpy(text, "F9");
+ if ( num == SDLK_F10 ) strcpy(text, "F10");
+ if ( num == SDLK_F11 ) strcpy(text, "F11");
+ if ( num == SDLK_F12 ) strcpy(text, "F12");
+ if ( num == SDLK_F13 ) strcpy(text, "F13");
+ if ( num == SDLK_F14 ) strcpy(text, "F14");
+ if ( num == SDLK_F15 ) strcpy(text, "F15");
+ if ( num == SDLK_F16 ) strcpy(text, "F16");
+ if ( num == SDLK_F17 ) strcpy(text, "F17");
+ if ( num == SDLK_F18 ) strcpy(text, "F18");
+ if ( num == SDLK_F19 ) strcpy(text, "F19");
+ if ( num == SDLK_F20 ) strcpy(text, "F20");
+ if ( num == SDLK_NUMLOCK ) strcpy(text, "Num Lock");
+ if ( num == SDLK_SCROLL ) strcpy(text, "Scroll");
+ if ( num == SDLK_ATTN ) strcpy(text, "Attn");
+ if ( num == SDLK_CRSEL ) strcpy(text, "CrSel");
+ if ( num == SDLK_EXSEL ) strcpy(text, "ExSel");
+ if ( num == SDLK_EREOF ) strcpy(text, "Erase EOF");
+ if ( num == SDLK_PLAY ) strcpy(text, "Play");
+ if ( num == SDLK_ZOOM ) strcpy(text, "Zoom");
+ if ( num == SDLK_PA1 ) strcpy(text, "PA1");
+ if ( num == SDLK_OEM_CLEAR ) strcpy(text, "Clear");
+ if ( num == SDLK_BUTTON1 ) strcpy(text, "Bouton 1");
+ if ( num == SDLK_BUTTON2 ) strcpy(text, "Bouton 2");
+ if ( num == SDLK_BUTTON3 ) strcpy(text, "Bouton 3");
+ if ( num == SDLK_BUTTON4 ) strcpy(text, "Bouton 4");
+ if ( num == SDLK_BUTTON5 ) strcpy(text, "Bouton 5");
+ if ( num == SDLK_BUTTON6 ) strcpy(text, "Bouton 6");
+ if ( num == SDLK_BUTTON7 ) strcpy(text, "Bouton 7");
+ if ( num == SDLK_BUTTON8 ) strcpy(text, "Bouton 8");
+ if ( num == SDLK_BUTTON9 ) strcpy(text, "Bouton 9");
+ if ( num == SDLK_BUTTON10 ) strcpy(text, "Bouton 10");
+ if ( num == SDLK_BUTTON11 ) strcpy(text, "Bouton 11");
+ if ( num == SDLK_BUTTON12 ) strcpy(text, "Bouton 12");
+ if ( num == SDLK_BUTTON13 ) strcpy(text, "Bouton 13");
+ if ( num == SDLK_BUTTON14 ) strcpy(text, "Bouton 14");
+ if ( num == SDLK_BUTTON15 ) strcpy(text, "Bouton 15");
+ if ( num == SDLK_BUTTON16 ) strcpy(text, "Bouton 16");
+ if ( num == SDLK_BUTTON17 ) strcpy(text, "Bouton 17");
+ if ( num == SDLK_BUTTON18 ) strcpy(text, "Bouton 18");
+ if ( num == SDLK_BUTTON19 ) strcpy(text, "Bouton 19");
+ if ( num == SDLK_BUTTON20 ) strcpy(text, "Bouton 20");
+ if ( num == SDLK_BUTTON21 ) strcpy(text, "Bouton 21");
+ if ( num == SDLK_BUTTON22 ) strcpy(text, "Bouton 22");
+ if ( num == SDLK_BUTTON23 ) strcpy(text, "Bouton 23");
+ if ( num == SDLK_BUTTON24 ) strcpy(text, "Bouton 24");
+ if ( num == SDLK_BUTTON25 ) strcpy(text, "Bouton 25");
+ if ( num == SDLK_BUTTON26 ) strcpy(text, "Bouton 26");
+ if ( num == SDLK_BUTTON27 ) strcpy(text, "Bouton 27");
+ if ( num == SDLK_BUTTON28 ) strcpy(text, "Bouton 28");
+ if ( num == SDLK_BUTTON29 ) strcpy(text, "Bouton 29");
+ if ( num == SDLK_BUTTON30 ) strcpy(text, "Bouton 30");
+ if ( num == SDLK_BUTTON31 ) strcpy(text, "Bouton 31");
+ if ( num == SDLK_BUTTON32 ) strcpy(text, "Bouton 32");
+ if ( num == SDLK_WHEELUP ) strcpy(text, "Molette haut");
+ if ( num == SDLK_WHEELDOWN ) strcpy(text, "Molette bas");
+ }
+#endif
+
+#if _GERMAN | _WG
+ if ( type == RES_TEXT )
+ {
+ #if _FULL
+ if ( num == RT_VERSION_ID ) strcpy(text, "1.18 /d");
+ #endif
+ #if _NET
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A 1.18");
+ #endif
+ #if _SCHOOL & _EDU
+ #if _TEEN
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-Teen EDU 1.18");
+ #else
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A EDU 1.18");
+ #endif
+ #endif
+ #if _SCHOOL & _PERSO
+ #if _TEEN
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-Teen PERSO 1.18");
+ #else
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A PERSO 1.18");
+ #endif
+ #endif
+ #if _SCHOOL & _CEEBOTDEMO
+ #if _TEEN
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-Teen DEMO 1.18");
+ #else
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A DEMO 1.18");
+ #endif
+ #endif
+ #if _DEMO
+ if ( num == RT_VERSION_ID ) strcpy(text, "Demo 1.18 /d");
+ #endif
+ if ( num == RT_DISINFO_TITLE ) strcpy(text, "SatCom");
+ if ( num == RT_WINDOW_MAXIMIZED ) strcpy(text, "Gro�es Fenster");
+ if ( num == RT_WINDOW_MINIMIZED ) strcpy(text, "Reduzieren");
+ if ( num == RT_WINDOW_STANDARD ) strcpy(text, "Normale Gr��e");
+ if ( num == RT_WINDOW_CLOSE ) strcpy(text, "Schlie�en");
+
+ if ( num == RT_STUDIO_TITLE ) strcpy(text, "Programmeditor");
+ if ( num == RT_SCRIPT_NEW ) strcpy(text, "Neu");
+ if ( num == RT_NAME_DEFAULT ) strcpy(text, "Spieler");
+ if ( num == RT_IO_NEW ) strcpy(text, "Neu ...");
+ if ( num == RT_KEY_OR ) strcpy(text, " oder ");
+
+#if _NEWLOOK
+ if ( num == RT_TITLE_BASE ) strcpy(text, "CeeBot");
+ if ( num == RT_TITLE_INIT ) strcpy(text, "CeeBot");
+#else
+ if ( num == RT_TITLE_BASE ) strcpy(text, "COLOBOT");
+ if ( num == RT_TITLE_INIT ) strcpy(text, "COLOBOT");
+#endif
+#if _SCHOOL
+ if ( num == RT_TITLE_TRAINER ) strcpy(text, "�bungen");
+#else
+ if ( num == RT_TITLE_TRAINER ) strcpy(text, "Programmieren");
+#endif
+ if ( num == RT_TITLE_DEFI ) strcpy(text, "Challenges");
+ if ( num == RT_TITLE_MISSION ) strcpy(text, "Missionen");
+ if ( num == RT_TITLE_FREE ) strcpy(text, "Freestyle");
+ if ( num == RT_TITLE_TEEN ) strcpy(text, "Freestyle");
+ if ( num == RT_TITLE_USER ) strcpy(text, "Userlevels");
+ if ( num == RT_TITLE_PROTO ) strcpy(text, "Prototypen");
+ if ( num == RT_TITLE_SETUP ) strcpy(text, "Einstellungen");
+ if ( num == RT_TITLE_NAME ) strcpy(text, "Name ");
+ if ( num == RT_TITLE_PERSO ) strcpy(text, "Aussehen einstellen");
+ if ( num == RT_TITLE_WRITE ) strcpy(text, "Aktuelle Mission speichern");
+ if ( num == RT_TITLE_READ ) strcpy(text, "Gespeicherte Mission laden");
+
+ if ( num == RT_PLAY_CHAPt ) strcpy(text, " Liste der Kapitel:");
+ if ( num == RT_PLAY_CHAPd ) strcpy(text, " Liste der Kapitel:");
+ if ( num == RT_PLAY_CHAPm ) strcpy(text, " Liste der Planeten:");
+ if ( num == RT_PLAY_CHAPf ) strcpy(text, " Liste der Planeten:");
+ if ( num == RT_PLAY_CHAPu ) strcpy(text, " Userlevels:");
+ if ( num == RT_PLAY_CHAPp ) strcpy(text, " Liste der Planeten:");
+ if ( num == RT_PLAY_CHAPte ) strcpy(text, " Liste der Kapitel:");
+ if ( num == RT_PLAY_LISTt ) strcpy(text, " Liste der �bungen des Kapitels:");
+ if ( num == RT_PLAY_LISTd ) strcpy(text, " Liste der Challenges des Kapitels:");
+ if ( num == RT_PLAY_LISTm ) strcpy(text, " Liste der Missionen des Planeten:");
+ if ( num == RT_PLAY_LISTf ) strcpy(text, " Liste der freien Levels des Planeten:");
+ if ( num == RT_PLAY_LISTu ) strcpy(text, " Missionen des Userlevels:");
+ if ( num == RT_PLAY_LISTp ) strcpy(text, " Liste der Prototypen des Planeten:");
+ if ( num == RT_PLAY_LISTk ) strcpy(text, " Liste der freien Levels des Kapitel:");
+ if ( num == RT_PLAY_RESUME ) strcpy(text, " Zusammenfassung:");
+
+ if ( num == RT_SETUP_DEVICE ) strcpy(text, " Driver:");
+ if ( num == RT_SETUP_MODE ) strcpy(text, " Aufl�sung:");
+ if ( num == RT_SETUP_KEY1 ) strcpy(text, "1) Klicken Sie auf die neu zu definierende Taste.");
+ if ( num == RT_SETUP_KEY2 ) strcpy(text, "2) Dr�cken Sie auf die neue Taste.");
+
+ if ( num == RT_PERSO_FACE ) strcpy(text, "Kopf:");
+ if ( num == RT_PERSO_GLASSES ) strcpy(text, "Brille:");
+ if ( num == RT_PERSO_HAIR ) strcpy(text, "Haarfarbe:");
+ if ( num == RT_PERSO_COMBI ) strcpy(text, "Farbe des Anzugs:");
+ if ( num == RT_PERSO_BAND ) strcpy(text, "Farbe der Streifen:");
+
+#if _NEWLOOK
+ if ( num == RT_DIALOG_TITLE ) strcpy(text, "CeeBot");
+ if ( num == RT_DIALOG_QUIT ) strcpy(text, "Wollen Sie CeeBot schlie�en ?");
+ if ( num == RT_DIALOG_YESQUIT ) strcpy(text, "Schlie�en\\CeeBot schlie�en");
+#else
+ if ( num == RT_DIALOG_TITLE ) strcpy(text, "COLOBOT");
+ if ( num == RT_DIALOG_QUIT ) strcpy(text, "Wollen Sie COLOBOT schlie�en ?");
+ if ( num == RT_DIALOG_YESQUIT ) strcpy(text, "Schlie�en\\COLOBOT schlie�en");
+#endif
+ if ( num == RT_DIALOG_ABORT ) strcpy(text, "Mission abbrechen ?");
+ if ( num == RT_DIALOG_YES ) strcpy(text, "Abbrechen\\Mission abbrechen");
+ if ( num == RT_DIALOG_NO ) strcpy(text, "Weitermachen\\Mission weitermachen");
+ if ( num == RT_DIALOG_NOQUIT ) strcpy(text, "Weitermachen\\Weitermachen");
+ if ( num == RT_DIALOG_DELOBJ ) strcpy(text, "Wollen Sie das angew�hlte Geb�ude wirklich zerst�ren ?");
+ if ( num == RT_DIALOG_DELGAME ) strcpy(text, "Wollen Sie die gespeicherten Missionen von %s l�schen ?");
+ if ( num == RT_DIALOG_YESDEL ) strcpy(text, "Zerst�ren");
+ if ( num == RT_DIALOG_NODEL ) strcpy(text, "Abbrechen");
+ if ( num == RT_DIALOG_LOADING ) strcpy(text, "Laden");
+
+ if ( num == RT_STUDIO_LISTTT ) strcpy(text, "Hilfe �ber den Begriff (\\key cbot;)");
+ if ( num == RT_STUDIO_COMPOK ) strcpy(text, "Kompilieren OK (0 Fehler)");
+ if ( num == RT_STUDIO_PROGSTOP ) strcpy(text, "Programm beendet");
+
+ if ( num == RT_SATCOM_LIST ) strcpy(text, "\\b;Liste der Objekte\n");
+ if ( num == RT_SATCOM_BOT ) strcpy(text, "\\b;Liste der Roboter\n");
+ if ( num == RT_SATCOM_BUILDING ) strcpy(text, "\\b;Listes der Geb�ude\n");
+ if ( num == RT_SATCOM_FRET ) strcpy(text, "\\b;Listes der tragbaren Gegenst�nde\n");
+ if ( num == RT_SATCOM_ALIEN ) strcpy(text, "\\b;Listes der Feinde\n");
+ if ( num == RT_SATCOM_NULL ) strcpy(text, "\\c; (keine)\\n;\n");
+ if ( num == RT_SATCOM_ERROR1 ) strcpy(text, "\\b;Fehler\n");
+ if ( num == RT_SATCOM_ERROR2 ) strcpy(text, "Die Liste ist ohne \\l;Radar\\u object\\radar; nicht verf�gbar !\n");
+
+ if ( num == RT_IO_OPEN ) strcpy(text, "�ffnen");
+ if ( num == RT_IO_SAVE ) strcpy(text, "Speichern");
+ if ( num == RT_IO_LIST ) strcpy(text, "Ordner: %s");
+ if ( num == RT_IO_NAME ) strcpy(text, "Name:");
+ if ( num == RT_IO_DIR ) strcpy(text, "In:");
+ if ( num == RT_IO_PRIVATE ) strcpy(text, "Privat\\Privater Ordner");
+ if ( num == RT_IO_PUBLIC ) strcpy(text, "�ffentlich\\Gemeinsamer Ordner f�r alle Spieler");
+
+ if ( num == RT_GENERIC_DEV1 ) strcpy(text, "Entwickelt von:");
+ if ( num == RT_GENERIC_DEV2 ) strcpy(text, "www.epsitec.com");
+#if _WG
+ if ( num == RT_GENERIC_EDIT1 ) strcpy(text, "Herausgegeben von:");
+ if ( num == RT_GENERIC_EDIT2 ) strcpy(text, "www.wg-verlag.ch");
+#else
+ if ( num == RT_GENERIC_EDIT1 ) strcpy(text, " ");
+ if ( num == RT_GENERIC_EDIT2 ) strcpy(text, " ");
+#endif
+
+ if ( num == RT_INTERFACE_REC ) strcpy(text, "Recorder");
+ }
+
+ if ( type == RES_EVENT )
+ {
+ if ( num == EVENT_BUTTON_OK ) strcpy(text, "OK");
+ if ( num == EVENT_BUTTON_CANCEL ) strcpy(text, "Abbrechen");
+ if ( num == EVENT_BUTTON_NEXT ) strcpy(text, "N�chster");
+ if ( num == EVENT_BUTTON_PREV ) strcpy(text, "Vorherg.");
+ if ( num == EVENT_BUTTON_QUIT ) strcpy(text, "Men� (\\key quit;)");
+
+ if ( num == EVENT_DIALOG_OK ) strcpy(text, "OK");
+ if ( num == EVENT_DIALOG_CANCEL ) strcpy(text, "Abbrechen");
+
+#if _SCHOOL
+ if ( num == EVENT_INTERFACE_TRAINER) strcpy(text, "�bungen\\Programmier�bungen");
+#else
+ if ( num == EVENT_INTERFACE_TRAINER) strcpy(text, "Programmieren\\Programmier�bungen");
+#endif
+ if ( num == EVENT_INTERFACE_DEFI ) strcpy(text, "Challenges\\Herausforderungen");
+ if ( num == EVENT_INTERFACE_MISSION) strcpy(text, "Missionen\\Aufbruch ins Weltall");
+ if ( num == EVENT_INTERFACE_FREE ) strcpy(text, "Freestyle\\Freies Spielen ohne vorgegebenes Ziel");
+ if ( num == EVENT_INTERFACE_TEEN ) strcpy(text, "Freestyle\\Freies Spielen ohne vorgegebenes Ziel");
+ if ( num == EVENT_INTERFACE_USER ) strcpy(text, "User\\Userlevels");
+ if ( num == EVENT_INTERFACE_PROTO ) strcpy(text, "Proto\\In Entwicklung befindliche Prototypen");
+ if ( num == EVENT_INTERFACE_NAME ) strcpy(text, "Anderer Spieler\\Spielername �ndern");
+ if ( num == EVENT_INTERFACE_SETUP ) strcpy(text, "Einstellungen\\Einstellungen");
+ if ( num == EVENT_INTERFACE_AGAIN ) strcpy(text, "Neu anfangen\\Die Mission von vorne anfangen");
+ if ( num == EVENT_INTERFACE_WRITE ) strcpy(text, "Speichern\\Aktuelle Mission speichern");
+ if ( num == EVENT_INTERFACE_READ ) strcpy(text, "Laden\\Eine gespeicherte Mission �ffnen");
+#if _NEWLOOK
+ if ( num == EVENT_INTERFACE_ABORT ) strcpy(text, "\\Zur�ck zu CeeBot");
+ if ( num == EVENT_INTERFACE_QUIT ) strcpy(text, "Schlie�en\\CeeBot schlie�en");
+#else
+ if ( num == EVENT_INTERFACE_ABORT ) strcpy(text, "\\Zur�ck zu COLOBOT");
+ if ( num == EVENT_INTERFACE_QUIT ) strcpy(text, "Schlie�en\\COLOBOT schlie�en");
+#endif
+ if ( num == EVENT_INTERFACE_BACK ) strcpy(text, "<< Zur�ck \\Zur�ck zum Hauptmen�");
+ if ( num == EVENT_INTERFACE_PLAY ) strcpy(text, "Spielen ...\\Los geht's");
+ if ( num == EVENT_INTERFACE_SETUPd ) strcpy(text, "Bildschirm\\Driver und Bildschirmaufl�sung");
+ if ( num == EVENT_INTERFACE_SETUPg ) strcpy(text, "Grafik\\Grafische Einstellungen");
+ if ( num == EVENT_INTERFACE_SETUPp ) strcpy(text, "Spiel\\Gameplay Einstellungen");
+ if ( num == EVENT_INTERFACE_SETUPc ) strcpy(text, "Steuerung\\Auswahl der Tasten");
+ if ( num == EVENT_INTERFACE_SETUPs ) strcpy(text, "Ger�usche\\Lautst�rke Ger�usche und Musik");
+ if ( num == EVENT_INTERFACE_DEVICE ) strcpy(text, "Einheit");
+ if ( num == EVENT_INTERFACE_RESOL ) strcpy(text, "Aufl�sung");
+ if ( num == EVENT_INTERFACE_FULL ) strcpy(text, "Vollbildschirm\\Vollbildschirm oder Fenster");
+ if ( num == EVENT_INTERFACE_APPLY ) strcpy(text, "�nderungen ausf�hren\\Get�tigte Einstellungen ausf�hren");
+
+ if ( num == EVENT_INTERFACE_TOTO ) strcpy(text, "Robby\\Ihr Assistent");
+ if ( num == EVENT_INTERFACE_SHADOW ) strcpy(text, "Schatten\\Schlagschatten auf dem Boden");
+ if ( num == EVENT_INTERFACE_GROUND ) strcpy(text, "Markierungen\\Markierungen auf dem Boden");
+ if ( num == EVENT_INTERFACE_DIRTY ) strcpy(text, "Schmutz\\Schmutz auf Robotern und Bauten");
+ if ( num == EVENT_INTERFACE_FOG ) strcpy(text, "Nebel\\Nebelschwaden");
+ if ( num == EVENT_INTERFACE_LENS ) strcpy(text, "Sonnenstrahlen\\Sonnenstrahlen");
+ if ( num == EVENT_INTERFACE_SKY ) strcpy(text, "Himmel\\Himmel und Wolken");
+ if ( num == EVENT_INTERFACE_PLANET ) strcpy(text, "Planeten und Sterne\\Kreisende Planeten und Sterne");
+ if ( num == EVENT_INTERFACE_LIGHT ) strcpy(text, "Dynamische Beleuchtung\\Dynamische Beleuchtung");
+ if ( num == EVENT_INTERFACE_PARTI ) strcpy(text, "Anzahl Partikel\\Explosionen, Staub, usw.");
+ if ( num == EVENT_INTERFACE_CLIP ) strcpy(text, "Sichtweite\\Maximale Sichtweite");
+ if ( num == EVENT_INTERFACE_DETAIL ) strcpy(text, "Details\\Detailliertheit der Objekte in 3D");
+ if ( num == EVENT_INTERFACE_TEXTURE) strcpy(text, "Qualit�t der Texturen\\Qualit�t der Anzeige");
+ if ( num == EVENT_INTERFACE_GADGET ) strcpy(text, "Anzahl Ziergegenst�nde\\Anzahl Gegenst�nde ohne Funktion");
+ if ( num == EVENT_INTERFACE_RAIN ) strcpy(text, "Partikel in den Men�s\\Funken und Sterne in den Men�s");
+ if ( num == EVENT_INTERFACE_GLINT ) strcpy(text, "Gl�nzende Tasten\\Gl�nzende Tasten in den Men�s");
+ if ( num == EVENT_INTERFACE_TOOLTIP) strcpy(text, "Hilfsblasen\\Hilfsblasen");
+ if ( num == EVENT_INTERFACE_MOVIES ) strcpy(text, "Filme\\Filme vor und nach den Missionen");
+ if ( num == EVENT_INTERFACE_NICERST) strcpy(text, "Zur�cksetzen \\Kleine Show beim Zur�cksetzen in den �bungen");
+ if ( num == EVENT_INTERFACE_HIMSELF) strcpy(text, "Eigenbeschuss\\Ihre Einheiten werden von Ihren Waffen besch�digt.");
+ if ( num == EVENT_INTERFACE_SCROLL ) strcpy(text, "Kameradrehung mit der Maus\\Die Kamera dreht wenn die Maus den Rand erreicht");
+ if ( num == EVENT_INTERFACE_INVERTX) strcpy(text, "Umkehr X\\Umkehr der Kameradrehung X-Achse");
+ if ( num == EVENT_INTERFACE_INVERTY) strcpy(text, "Umkehr Y\\Umkehr der Kameradrehung Y-Achse");
+ if ( num == EVENT_INTERFACE_EFFECT ) strcpy(text, "Beben bei Explosionen\\Die Kamera bebt bei Explosionen");
+ if ( num == EVENT_INTERFACE_MOUSE ) strcpy(text, "Schatten unter der Maus\\Ein Schatten erscheint unter der Maus");
+ if ( num == EVENT_INTERFACE_EDITMODE) strcpy(text, "Automatisches Einr�cken\\Beim Bearbeiten der Programme");
+ if ( num == EVENT_INTERFACE_EDITVALUE)strcpy(text, "Einr�cken mit 4 Leerstellen\\Einr�cken mit 2 oder 4 Leerstellen");
+ if ( num == EVENT_INTERFACE_SOLUCE4) strcpy(text, "L�sung zug�nglich\\Die L�sung ist im Programmslot \"4: L�sung\" zug�nglich");
+
+ if ( num == EVENT_INTERFACE_KDEF ) strcpy(text, "Alles zur�cksetzen\\Standarddefinition aller Tasten");
+ if ( num == EVENT_INTERFACE_KLEFT ) strcpy(text, "Drehung nach links\\Steuer links");
+ if ( num == EVENT_INTERFACE_KRIGHT ) strcpy(text, "Drehung nach rechts\\Steuer rechts");
+ if ( num == EVENT_INTERFACE_KUP ) strcpy(text, "Vorw�rts\\Bewegung nach vorne");
+ if ( num == EVENT_INTERFACE_KDOWN ) strcpy(text, "R�ckw�rts\\Bewegung nach hinten");
+ if ( num == EVENT_INTERFACE_KGUP ) strcpy(text, "Steigen\\Leistung des Triebwerks steigern");
+ if ( num == EVENT_INTERFACE_KGDOWN ) strcpy(text, "Sinken\\Leistung des Triebwerks drosseln");
+ if ( num == EVENT_INTERFACE_KCAMERA) strcpy(text, "Andere Kamera\\Sichtpunkt einstellen");
+ if ( num == EVENT_INTERFACE_KDESEL ) strcpy(text, "Vorherg. Auswahl\\Das vorhergehende Objekt ausw�hlen");
+ if ( num == EVENT_INTERFACE_KACTION) strcpy(text, "Standardhandlung\\F�hrt die Standardhandlung des Roboters aus.");
+ if ( num == EVENT_INTERFACE_KNEAR ) strcpy(text, "Kamera n�her\\Bewegung der Kamera vorw�rts");
+ if ( num == EVENT_INTERFACE_KAWAY ) strcpy(text, "Kamera weiter\\Bewegung der Kamera r�ckw�rts");
+ if ( num == EVENT_INTERFACE_KNEXT ) strcpy(text, "N�chstes ausw�hlen\\N�chstes Objekt ausw�hlen");
+ if ( num == EVENT_INTERFACE_KHUMAN ) strcpy(text, "Astronauten ausw�hlen\\Astronauten ausw�hlen");
+ if ( num == EVENT_INTERFACE_KQUIT ) strcpy(text, "Mission verlassen\\Eine Mission oder �bung verlassen");
+ if ( num == EVENT_INTERFACE_KHELP ) strcpy(text, "Anweisungen\\Anweisungen f�r die Mission oder �bung");
+ if ( num == EVENT_INTERFACE_KPROG ) strcpy(text, "Hilfe CBOT-Sprache\\Hilfe �ber die Programmiersprache CBOT");
+ if ( num == EVENT_INTERFACE_KCBOT ) strcpy(text, "Hilfe �ber Begriff\\Hilfe �ber einen Begriff");
+ if ( num == EVENT_INTERFACE_KVISIT ) strcpy(text, "Ort der Meldung\\Zeigt den Ort, von dem die letzte Meldung stammt");
+ if ( num == EVENT_INTERFACE_KSPEED10) strcpy(text, "Geschwindigkeit 1.0x\\Normale Spielgeschwindigkeit");
+ if ( num == EVENT_INTERFACE_KSPEED15) strcpy(text, "Geschwindigkeit 1.5x\\Spielgeschwindigkeit anderthalb Mal schneller");
+ if ( num == EVENT_INTERFACE_KSPEED20) strcpy(text, "Geschwindigkeit 2.0x\\Spielgeschwindigkeit doppelt so schnell");
+ if ( num == EVENT_INTERFACE_KSPEED30) strcpy(text, "Geschwindigkeit 3.0x\\Spielgeschwindigkeit drei Mal schneller");
+
+ if ( num == EVENT_INTERFACE_VOLSOUND) strcpy(text, "Ger�usche:\\Lautst�rke Motoren, Stimmen, usw.");
+ if ( num == EVENT_INTERFACE_VOLMUSIC) strcpy(text, "Ger�uschkulisse:\\Lautst�rke der Soundtracks der CD");
+ if ( num == EVENT_INTERFACE_SOUND3D) strcpy(text, "3D-Ger�usche\\Orten der Ger�usche im Raum");
+
+ if ( num == EVENT_INTERFACE_MIN ) strcpy(text, "Min.\\Minimale Qualit�t (gro�es Framerate)");
+ if ( num == EVENT_INTERFACE_NORM ) strcpy(text, "Normal\\Standardqualit�t");
+ if ( num == EVENT_INTERFACE_MAX ) strcpy(text, "Max.\\Beste Qualit�t (niedriges Framerate)");
+
+ if ( num == EVENT_INTERFACE_SILENT ) strcpy(text, "Kein Ton\\Keine Ger�usche und Ger�uschkulisse");
+ if ( num == EVENT_INTERFACE_NOISY ) strcpy(text, "Normal\\Normale Lautst�rke");
+
+ if ( num == EVENT_INTERFACE_JOYSTICK) strcpy(text, "Joystick\\Joystick oder Tastatur");
+ if ( num == EVENT_INTERFACE_SOLUCE ) strcpy(text, "Zeigt die L�sung\\Zeigt nach 3mal Scheitern die L�sung");
+
+ if ( num == EVENT_INTERFACE_NEDIT ) strcpy(text, "\\Name des Spielers");
+ if ( num == EVENT_INTERFACE_NOK ) strcpy(text, "OK\\Spieler ausw�hlen");
+ if ( num == EVENT_INTERFACE_NCANCEL) strcpy(text, "Abbrechen\\Beh�lt den bisherigen Spieler bei");
+ if ( num == EVENT_INTERFACE_NDELETE) strcpy(text, "Spieler l�schen\\L�scht den Spieler aus der Liste");
+ if ( num == EVENT_INTERFACE_NLABEL ) strcpy(text, "Name ");
+
+ if ( num == EVENT_INTERFACE_IOWRITE) strcpy(text, "Speichern\\Speichert die Mission");
+ if ( num == EVENT_INTERFACE_IOREAD ) strcpy(text, "Laden\\�ffnet eine gespeicherte Mission");
+ if ( num == EVENT_INTERFACE_IOLIST ) strcpy(text, "Liste der gespeicherten Missionen");
+ if ( num == EVENT_INTERFACE_IOLABEL) strcpy(text, "Dateiname:");
+ if ( num == EVENT_INTERFACE_IONAME ) strcpy(text, "Name der Mission");
+ if ( num == EVENT_INTERFACE_IOIMAGE) strcpy(text, "Ansicht der Mission");
+ if ( num == EVENT_INTERFACE_IODELETE) strcpy(text, "L�schen\\L�scht die gespeicherte Mission");
+
+ if ( num == EVENT_INTERFACE_PERSO ) strcpy(text, "Aussehen\\Erscheinungsbild des Astronauten einstellen");
+ if ( num == EVENT_INTERFACE_POK ) strcpy(text, "OK");
+ if ( num == EVENT_INTERFACE_PCANCEL) strcpy(text, "Abbrechen");
+ if ( num == EVENT_INTERFACE_PDEF ) strcpy(text, "Standard\\Standardfarben einsetzen");
+ if ( num == EVENT_INTERFACE_PHEAD ) strcpy(text, "Kopf\\Gesicht und Haare");
+ if ( num == EVENT_INTERFACE_PBODY ) strcpy(text, "Anzug\\Raumfahrtanzug");
+ if ( num == EVENT_INTERFACE_PLROT ) strcpy(text, "\\Drehung links");
+ if ( num == EVENT_INTERFACE_PRROT ) strcpy(text, "\\Drehung rechts");
+ if ( num == EVENT_INTERFACE_PCRa ) strcpy(text, "Rot");
+ if ( num == EVENT_INTERFACE_PCGa ) strcpy(text, "Gr�n");
+ if ( num == EVENT_INTERFACE_PCBa ) strcpy(text, "Blau");
+ if ( num == EVENT_INTERFACE_PCRb ) strcpy(text, "Rot");
+ if ( num == EVENT_INTERFACE_PCGb ) strcpy(text, "Gr�n");
+ if ( num == EVENT_INTERFACE_PCBb ) strcpy(text, "Blau");
+ if ( num == EVENT_INTERFACE_PFACE1 ) strcpy(text, "\\Kopf 1");
+ if ( num == EVENT_INTERFACE_PFACE2 ) strcpy(text, "\\Kopf 4");
+ if ( num == EVENT_INTERFACE_PFACE3 ) strcpy(text, "\\Kopf 3");
+ if ( num == EVENT_INTERFACE_PFACE4 ) strcpy(text, "\\Kopf 2");
+ if ( num == EVENT_INTERFACE_PGLASS0) strcpy(text, "\\Keine Brille");
+ if ( num == EVENT_INTERFACE_PGLASS1) strcpy(text, "\\Brille 1");
+ if ( num == EVENT_INTERFACE_PGLASS2) strcpy(text, "\\Brille 2");
+ if ( num == EVENT_INTERFACE_PGLASS3) strcpy(text, "\\Brille 3");
+ if ( num == EVENT_INTERFACE_PGLASS4) strcpy(text, "\\Brille 4");
+ if ( num == EVENT_INTERFACE_PGLASS5) strcpy(text, "\\Brille 5");
+
+ if ( num == EVENT_OBJECT_DESELECT ) strcpy(text, "Vorherg. Auwahl (\\key desel;)");
+ if ( num == EVENT_OBJECT_LEFT ) strcpy(text, "Drehung links (\\key left;)");
+ if ( num == EVENT_OBJECT_RIGHT ) strcpy(text, "Drehung rechts (\\key right;)");
+ if ( num == EVENT_OBJECT_UP ) strcpy(text, "Vorw�rts (\\key up;)");
+ if ( num == EVENT_OBJECT_DOWN ) strcpy(text, "R�ckw�rts (\\key down;)");
+ if ( num == EVENT_OBJECT_GASUP ) strcpy(text, "Steigt (\\key gup;)");
+ if ( num == EVENT_OBJECT_GASDOWN ) strcpy(text, "Sinkt (\\key gdown;)");
+ if ( num == EVENT_OBJECT_HTAKE ) strcpy(text, "Nehmen oder hinlegen (\\key action;)");
+ if ( num == EVENT_OBJECT_MTAKE ) strcpy(text, "Nehmen oder hinlegen (\\key action;)");
+ if ( num == EVENT_OBJECT_MFRONT ) strcpy(text, "..vorne");
+ if ( num == EVENT_OBJECT_MBACK ) strcpy(text, "..hinten");
+ if ( num == EVENT_OBJECT_MPOWER ) strcpy(text, "..Batterie");
+ if ( num == EVENT_OBJECT_BHELP ) strcpy(text, "Anweisungen �ber die Mission(\\key help;)");
+ if ( num == EVENT_OBJECT_BTAKEOFF ) strcpy(text, "Abheben nach vollbrachter Mission");
+ if ( num == EVENT_OBJECT_BDERRICK ) strcpy(text, "Baut einen Bohrturm");
+ if ( num == EVENT_OBJECT_BSTATION ) strcpy(text, "Baut ein Kraftwerk");
+ if ( num == EVENT_OBJECT_BFACTORY ) strcpy(text, "Baut eine Roboterfabrik");
+ if ( num == EVENT_OBJECT_BREPAIR ) strcpy(text, "Baut ein Reparaturzentrum");
+ if ( num == EVENT_OBJECT_BCONVERT ) strcpy(text, "Baut einen Konverter");
+ if ( num == EVENT_OBJECT_BTOWER ) strcpy(text, "Baut einen Gesch�tzturm");
+ if ( num == EVENT_OBJECT_BRESEARCH ) strcpy(text, "Baut ein Forschungszentrum");
+ if ( num == EVENT_OBJECT_BRADAR ) strcpy(text, "Baut ein Radar");
+ if ( num == EVENT_OBJECT_BENERGY ) strcpy(text, "Baut eine Batteriefabrik");
+ if ( num == EVENT_OBJECT_BLABO ) strcpy(text, "Baut ein automatisches Labor");
+ if ( num == EVENT_OBJECT_BNUCLEAR ) strcpy(text, "Baut eine Brennstoffzellenfabrik");
+ if ( num == EVENT_OBJECT_BPARA ) strcpy(text, "Baut einen Blitzableiter");
+ if ( num == EVENT_OBJECT_BINFO ) strcpy(text, "Baut einen Infoserver");
+ if ( num == EVENT_OBJECT_GFLAT ) strcpy(text, "Zeigt ob der Boden eben ist");
+ if ( num == EVENT_OBJECT_FCREATE ) strcpy(text, "Setzt eine Fahne");
+ if ( num == EVENT_OBJECT_FDELETE ) strcpy(text, "Sammelt die Fahne ein");
+ if ( num == EVENT_OBJECT_FCOLORb ) strcpy(text, "\\Blaue Fahne");
+ if ( num == EVENT_OBJECT_FCOLORr ) strcpy(text, "\\Rote Fahne");
+ if ( num == EVENT_OBJECT_FCOLORg ) strcpy(text, "\\Gr�ne Fahne");
+ if ( num == EVENT_OBJECT_FCOLORy ) strcpy(text, "\\Gelbe Fahne");
+ if ( num == EVENT_OBJECT_FCOLORv ) strcpy(text, "\\Violette Fahne");
+ if ( num == EVENT_OBJECT_FACTORYfa ) strcpy(text, "Baut einen Jettransporter");
+ if ( num == EVENT_OBJECT_FACTORYta ) strcpy(text, "Baut einen Kettentransporter");
+ if ( num == EVENT_OBJECT_FACTORYwa ) strcpy(text, "Baut einen Radtransporter");
+ if ( num == EVENT_OBJECT_FACTORYia ) strcpy(text, "Baut einen Krabbeltransporter");
+ if ( num == EVENT_OBJECT_FACTORYfc ) strcpy(text, "Baut einen Jetshooter");
+ if ( num == EVENT_OBJECT_FACTORYtc ) strcpy(text, "Baut einen Kettenshooter");
+ if ( num == EVENT_OBJECT_FACTORYwc ) strcpy(text, "Baut einen Radshooter");
+ if ( num == EVENT_OBJECT_FACTORYic ) strcpy(text, "Baut einen Krabbelshooter");
+ if ( num == EVENT_OBJECT_FACTORYfi ) strcpy(text, "Baut einen Jetorgashooter");
+ if ( num == EVENT_OBJECT_FACTORYti ) strcpy(text, "Baut einen Kettenorgashooter");
+ if ( num == EVENT_OBJECT_FACTORYwi ) strcpy(text, "Baut einen Radorgashooter");
+ if ( num == EVENT_OBJECT_FACTORYii ) strcpy(text, "Baut einen Krabbelorgashooter");
+ if ( num == EVENT_OBJECT_FACTORYfs ) strcpy(text, "Baut einen Jetschn�ffler");
+ if ( num == EVENT_OBJECT_FACTORYts ) strcpy(text, "Baut einen Kettenschn�ffler");
+ if ( num == EVENT_OBJECT_FACTORYws ) strcpy(text, "Baut einen Radschn�ffler");
+ if ( num == EVENT_OBJECT_FACTORYis ) strcpy(text, "Baut einen Krabbelschn�ffler");
+ if ( num == EVENT_OBJECT_FACTORYrt ) strcpy(text, "Baut einen Stampfer");
+ if ( num == EVENT_OBJECT_FACTORYrc ) strcpy(text, "Baut einen Phazershooter");
+ if ( num == EVENT_OBJECT_FACTORYrr ) strcpy(text, "Baut einen Recycler");
+ if ( num == EVENT_OBJECT_FACTORYrs ) strcpy(text, "Baut einen Schutzschild");
+ if ( num == EVENT_OBJECT_FACTORYsa ) strcpy(text, "Baut einen Kettentaucher");
+ if ( num == EVENT_OBJECT_RTANK ) strcpy(text, "Forschungsprogramm Kettenantrieb");
+ if ( num == EVENT_OBJECT_RFLY ) strcpy(text, "Forschungsprogramm Jetantrieb");
+ if ( num == EVENT_OBJECT_RTHUMP ) strcpy(text, "Forschungsprogramm Stampfer");
+ if ( num == EVENT_OBJECT_RCANON ) strcpy(text, "Forschungsprogramm Shooterkanone");
+ if ( num == EVENT_OBJECT_RTOWER ) strcpy(text, "Forschungsprogramm Gesch�tzturm");
+ if ( num == EVENT_OBJECT_RPHAZER ) strcpy(text, "Forschungsprogramm Phazerkanone");
+ if ( num == EVENT_OBJECT_RSHIELD ) strcpy(text, "Forschungsprogramm Schutzschild");
+ if ( num == EVENT_OBJECT_RATOMIC ) strcpy(text, "Forschungsprogramm Brennstoffzelle");
+ if ( num == EVENT_OBJECT_RiPAW ) strcpy(text, "Forschungsprogramm Krabbelantrieb");
+ if ( num == EVENT_OBJECT_RiGUN ) strcpy(text, "Forschungsprogramm Orgashooterkanone");
+ if ( num == EVENT_OBJECT_RESET ) strcpy(text, "Alles zur�cksetzen");
+ if ( num == EVENT_OBJECT_SEARCH ) strcpy(text, "Schn�ffeln (\\key action;)");
+ if ( num == EVENT_OBJECT_TERRAFORM ) strcpy(text, "Stampfen (\\key action;)");
+ if ( num == EVENT_OBJECT_FIRE ) strcpy(text, "Feuer (\\key action;)");
+ if ( num == EVENT_OBJECT_RECOVER ) strcpy(text, "Recyceln (\\key action;)");
+ if ( num == EVENT_OBJECT_BEGSHIELD ) strcpy(text, "Schutzschild ausfahren (\\key action;)");
+ if ( num == EVENT_OBJECT_ENDSHIELD ) strcpy(text, "Schutzschild einholen (\\key action;)");
+ if ( num == EVENT_OBJECT_DIMSHIELD ) strcpy(text, "Reichweite Schutzschild");
+ if ( num == EVENT_OBJECT_PROGRUN ) strcpy(text, "Gew�hltes Programm ausf�hren");
+ if ( num == EVENT_OBJECT_PROGEDIT ) strcpy(text, "Gew�hltes Programm bearbeiten");
+ if ( num == EVENT_OBJECT_INFOOK ) strcpy(text, "\\SatCom in Standby");
+ if ( num == EVENT_OBJECT_DELETE ) strcpy(text, "Geb�ude sprengen");
+ if ( num == EVENT_OBJECT_GENERGY ) strcpy(text, "Energievorrat");
+ if ( num == EVENT_OBJECT_GSHIELD ) strcpy(text, "Sch�den");
+ if ( num == EVENT_OBJECT_GRANGE ) strcpy(text, "Triebwerktemperatur");
+ if ( num == EVENT_OBJECT_GPROGRESS ) strcpy(text, "Prozess im Gang ...");
+ if ( num == EVENT_OBJECT_GRADAR ) strcpy(text, "Anzahl erfasster Insekten");
+ if ( num == EVENT_OBJECT_GINFO ) strcpy(text, "Gesendete Informationen");
+ if ( num == EVENT_OBJECT_COMPASS ) strcpy(text, "Kompass");
+//? if ( num == EVENT_OBJECT_MAP ) strcpy(text, "Minikarte");
+ if ( num == EVENT_OBJECT_MAPZOOM ) strcpy(text, "Zoom Minikarte");
+ if ( num == EVENT_OBJECT_CAMERA ) strcpy(text, "Kamera (\\key camera;)");
+ if ( num == EVENT_OBJECT_CAMERAleft) strcpy(text, "Kamera links");
+ if ( num == EVENT_OBJECT_CAMERAright) strcpy(text, "Kamera rechts");
+ if ( num == EVENT_OBJECT_CAMERAnear) strcpy(text, "Kamera n�her");
+ if ( num == EVENT_OBJECT_CAMERAaway) strcpy(text, "Kamera weiter weg");
+ if ( num == EVENT_OBJECT_HELP ) strcpy(text, "Anweisungen �ber das ausgew�hlte Objekt");
+ if ( num == EVENT_OBJECT_SOLUCE ) strcpy(text, "Zeigt die L�sung");
+ if ( num == EVENT_OBJECT_SHORTCUT00) strcpy(text, "Anzeige Roboter <-> Bauten");
+ if ( num == EVENT_OBJECT_LIMIT ) strcpy(text, "Zeigt die Reichweite");
+ if ( num == EVENT_OBJECT_PEN0 ) strcpy(text, "\\Bleistift abheben");
+ if ( num == EVENT_OBJECT_PEN1 ) strcpy(text, "\\Schwarzen Bleistift hinunterlassen");
+ if ( num == EVENT_OBJECT_PEN2 ) strcpy(text, "\\Gelben Bleistift hinunterlassen");
+ if ( num == EVENT_OBJECT_PEN3 ) strcpy(text, "\\Orangefarbenen Bleistift hinunterlassen");
+ if ( num == EVENT_OBJECT_PEN4 ) strcpy(text, "\\Roten Bleistift hinunterlassen");
+ if ( num == EVENT_OBJECT_PEN5 ) strcpy(text, "\\Violetten Bleistift hinunterlassen");
+ if ( num == EVENT_OBJECT_PEN6 ) strcpy(text, "\\Blauen Bleistift hinunterlassen");
+ if ( num == EVENT_OBJECT_PEN7 ) strcpy(text, "\\Gr�nen Bleistift hinunterlassen");
+ if ( num == EVENT_OBJECT_PEN8 ) strcpy(text, "\\Braunen Bleistift hinunterlassen");
+ if ( num == EVENT_OBJECT_REC ) strcpy(text, "\\Aufnahme starten");
+ if ( num == EVENT_OBJECT_STOP ) strcpy(text, "\\Aufnahme stoppen");
+ if ( num == EVENT_DT_VISIT0 ||
+ num == EVENT_DT_VISIT1 ||
+ num == EVENT_DT_VISIT2 ||
+ num == EVENT_DT_VISIT3 ||
+ num == EVENT_DT_VISIT4 ) strcpy(text, "Zeigt den Ort");
+ if ( num == EVENT_DT_END ) strcpy(text, "Weitermachen");
+ if ( num == EVENT_CMD ) strcpy(text, "Befehleingabe");
+ if ( num == EVENT_SPEED ) strcpy(text, "Spielgeschwindigkeit");
+
+ if ( num == EVENT_HYPER_PREV ) strcpy(text, "Vorherg. Seite");
+ if ( num == EVENT_HYPER_NEXT ) strcpy(text, "N�chste Seite");
+ if ( num == EVENT_HYPER_HOME ) strcpy(text, "Home");
+ if ( num == EVENT_HYPER_COPY ) strcpy(text, "Kopieren");
+ if ( num == EVENT_HYPER_SIZE1 ) strcpy(text, "Gr��e 1");
+ if ( num == EVENT_HYPER_SIZE2 ) strcpy(text, "Gr��e 2");
+ if ( num == EVENT_HYPER_SIZE3 ) strcpy(text, "Gr��e 3");
+ if ( num == EVENT_HYPER_SIZE4 ) strcpy(text, "Gr��e 4");
+ if ( num == EVENT_HYPER_SIZE5 ) strcpy(text, "Gr��e 5");
+ if ( num == EVENT_SATCOM_HUSTON ) strcpy(text, "Anweisungen von Houston");
+#if _TEEN
+ if ( num == EVENT_SATCOM_SAT ) strcpy(text, "W�rterbuch Englisch-Deutsch");
+#else
+ if ( num == EVENT_SATCOM_SAT ) strcpy(text, "Satellitenbericht");
+#endif
+ if ( num == EVENT_SATCOM_LOADING ) strcpy(text, "Von Houston �bermittelte Programme");
+ if ( num == EVENT_SATCOM_OBJECT ) strcpy(text, "Liste der Objekte");
+ if ( num == EVENT_SATCOM_PROG ) strcpy(text, "Hilfe �ber Programmieren");
+ if ( num == EVENT_SATCOM_SOLUCE ) strcpy(text, "L�sung");
+
+ if ( num == EVENT_STUDIO_OK ) strcpy(text, "OK\\Programm kompilieren");
+ if ( num == EVENT_STUDIO_CANCEL ) strcpy(text, "Abbrechen\\Editor schlie�en");
+ if ( num == EVENT_STUDIO_NEW ) strcpy(text, "Neu");
+ if ( num == EVENT_STUDIO_OPEN ) strcpy(text, "�ffnen (Ctrl+o)");
+ if ( num == EVENT_STUDIO_SAVE ) strcpy(text, "Speichern (Ctrl+s)");
+ if ( num == EVENT_STUDIO_UNDO ) strcpy(text, "Widerrufen (Ctrl+z)");
+ if ( num == EVENT_STUDIO_CUT ) strcpy(text, "Ausschneiden (Ctrl+x)");
+ if ( num == EVENT_STUDIO_COPY ) strcpy(text, "Kopieren (Ctrl+c)");
+ if ( num == EVENT_STUDIO_PASTE ) strcpy(text, "Einf�gen (Ctrl+v)");
+ if ( num == EVENT_STUDIO_SIZE ) strcpy(text, "Zeichengr��e");
+ if ( num == EVENT_STUDIO_TOOL ) strcpy(text, "Anweisungen (\\key help;)");
+ if ( num == EVENT_STUDIO_HELP ) strcpy(text, "Hilfe �ber Programmieren (\\key prog;)");
+ if ( num == EVENT_STUDIO_COMPILE ) strcpy(text, "Kompilieren");
+ if ( num == EVENT_STUDIO_RUN ) strcpy(text, "Start/Stop");
+ if ( num == EVENT_STUDIO_REALTIME ) strcpy(text, "Pause/Weitermachen");
+ if ( num == EVENT_STUDIO_STEP ) strcpy(text, "Ein Schritt");
+ }
+
+ if ( type == RES_OBJECT )
+ {
+ if ( num == OBJECT_PORTICO ) strcpy(text, "Tr�ger");
+ if ( num == OBJECT_BASE ) strcpy(text, "Raumschiff");
+ if ( num == OBJECT_DERRICK ) strcpy(text, "Bohrturm");
+ if ( num == OBJECT_FACTORY ) strcpy(text, "Roboterfabrik");
+ if ( num == OBJECT_REPAIR ) strcpy(text, "Reparaturzentrum");
+ if ( num == OBJECT_DESTROYER ) strcpy(text, "Einstampfer");
+ if ( num == OBJECT_STATION ) strcpy(text, "Kraftwerk");
+ if ( num == OBJECT_CONVERT ) strcpy(text, "Konverter Erz-Titan");
+ if ( num == OBJECT_TOWER ) strcpy(text, "Gesch�tzturm");
+ if ( num == OBJECT_NEST ) strcpy(text, "Orgastoffquelle");
+ if ( num == OBJECT_RESEARCH ) strcpy(text, "Forschungszentrum");
+ if ( num == OBJECT_RADAR ) strcpy(text, "Radar");
+ if ( num == OBJECT_INFO ) strcpy(text, "Infoserver");
+#if _TEEN
+ if ( num == OBJECT_ENERGY ) strcpy(text, "Aufl�ser");
+#else
+ if ( num == OBJECT_ENERGY ) strcpy(text, "Batteriefabrik");
+#endif
+ if ( num == OBJECT_LABO ) strcpy(text, "Automatisches Labor");
+ if ( num == OBJECT_NUCLEAR ) strcpy(text, "Brennstoffzellenfabrik");
+ if ( num == OBJECT_PARA ) strcpy(text, "Blitzableiter");
+ if ( num == OBJECT_SAFE ) strcpy(text, "Bunker");
+ if ( num == OBJECT_HUSTON ) strcpy(text, "Kontrollzentrum");
+ if ( num == OBJECT_TARGET1 ) strcpy(text, "Zielscheibe");
+ if ( num == OBJECT_TARGET2 ) strcpy(text, "Zielscheibe");
+ if ( num == OBJECT_START ) strcpy(text, "Startfl�che");
+ if ( num == OBJECT_END ) strcpy(text, "Zielfl�che");
+ if ( num == OBJECT_STONE ) strcpy(text, "Titanerz");
+ if ( num == OBJECT_URANIUM ) strcpy(text, "Platinerz");
+ if ( num == OBJECT_BULLET ) strcpy(text, "Orgastoff");
+ if ( num == OBJECT_METAL ) strcpy(text, "Titan");
+ if ( num == OBJECT_POWER ) strcpy(text, "Elektrolytische Batterie");
+ if ( num == OBJECT_ATOMIC ) strcpy(text, "Brennstoffzelle");
+ if ( num == OBJECT_BBOX ) strcpy(text, "Flugschreiber");
+ if ( num == OBJECT_KEYa ) strcpy(text, "Schl�ssel A");
+ if ( num == OBJECT_KEYb ) strcpy(text, "Schl�ssel B");
+ if ( num == OBJECT_KEYc ) strcpy(text, "Schl�ssel C");
+ if ( num == OBJECT_KEYd ) strcpy(text, "Schl�ssel D");
+ if ( num == OBJECT_TNT ) strcpy(text, "Sprengstoff");
+ if ( num == OBJECT_BOMB ) strcpy(text, "Landmine");
+ if ( num == OBJECT_BAG ) strcpy(text, "�berlebenskit");
+ if ( num == OBJECT_WAYPOINT ) strcpy(text, "Checkpoint");
+ if ( num == OBJECT_FLAGb ) strcpy(text, "Blaue Fahne");
+ if ( num == OBJECT_FLAGr ) strcpy(text, "Rote Fahne");
+ if ( num == OBJECT_FLAGg ) strcpy(text, "Gr�ne Fahne");
+ if ( num == OBJECT_FLAGy ) strcpy(text, "Gelbe Fahne");
+ if ( num == OBJECT_FLAGv ) strcpy(text, "Violette Fahne");
+ if ( num == OBJECT_MARKPOWER ) strcpy(text, "Markierung f�r unterirdische Energiequelle");
+ if ( num == OBJECT_MARKURANIUM ) strcpy(text, "Markierung f�r unterirdisches Platinvorkommen");
+ if ( num == OBJECT_MARKKEYa ) strcpy(text, "Markierung f�r vergrabenen Schl�ssel A");
+ if ( num == OBJECT_MARKKEYb ) strcpy(text, "Markierung f�r vergrabenen Schl�ssel B");
+ if ( num == OBJECT_MARKKEYc ) strcpy(text, "Markierung f�r vergrabenen Schl�ssel C");
+ if ( num == OBJECT_MARKKEYd ) strcpy(text, "Markierung f�r vergrabenen Schl�ssel D");
+ if ( num == OBJECT_MARKSTONE ) strcpy(text, "Markierung f�r unterirdisches Titanvorkommen");
+ if ( num == OBJECT_MOBILEft ) strcpy(text, "�bungsroboter");
+ if ( num == OBJECT_MOBILEtt ) strcpy(text, "�bungsroboter");
+ if ( num == OBJECT_MOBILEwt ) strcpy(text, "�bungsroboter");
+ if ( num == OBJECT_MOBILEit ) strcpy(text, "�bungsroboter");
+ if ( num == OBJECT_MOBILEfa ) strcpy(text, "Transporter");
+ if ( num == OBJECT_MOBILEta ) strcpy(text, "Transporter");
+ if ( num == OBJECT_MOBILEwa ) strcpy(text, "Transporter");
+ if ( num == OBJECT_MOBILEia ) strcpy(text, "Transporter");
+ if ( num == OBJECT_MOBILEfc ) strcpy(text, "Shooter");
+ if ( num == OBJECT_MOBILEtc ) strcpy(text, "Shooter");
+ if ( num == OBJECT_MOBILEwc ) strcpy(text, "Shooter");
+ if ( num == OBJECT_MOBILEic ) strcpy(text, "Shooter");
+ if ( num == OBJECT_MOBILEfi ) strcpy(text, "OrgaShooter");
+ if ( num == OBJECT_MOBILEti ) strcpy(text, "OrgaShooter");
+ if ( num == OBJECT_MOBILEwi ) strcpy(text, "OrgaShooter");
+ if ( num == OBJECT_MOBILEii ) strcpy(text, "OrgaShooter");
+ if ( num == OBJECT_MOBILEfs ) strcpy(text, "Schn�ffler");
+ if ( num == OBJECT_MOBILEts ) strcpy(text, "Schn�ffler");
+ if ( num == OBJECT_MOBILEws ) strcpy(text, "Schn�ffler");
+ if ( num == OBJECT_MOBILEis ) strcpy(text, "Schn�ffler");
+ if ( num == OBJECT_MOBILErt ) strcpy(text, "Stampfer");
+ if ( num == OBJECT_MOBILErc ) strcpy(text, "Phazershooter");
+ if ( num == OBJECT_MOBILErr ) strcpy(text, "Recycler");
+ if ( num == OBJECT_MOBILErs ) strcpy(text, "Schutzschild");
+ if ( num == OBJECT_MOBILEsa ) strcpy(text, "Kettentaucher");
+ if ( num == OBJECT_MOBILEtg ) strcpy(text, "Mobile Zielscheibe");
+ if ( num == OBJECT_MOBILEdr ) strcpy(text, "Zeichner");
+ if ( num == OBJECT_HUMAN ) strcpy(text, g_gamerName);
+ if ( num == OBJECT_TECH ) strcpy(text, "Techniker");
+ if ( num == OBJECT_TOTO ) strcpy(text, "Robby");
+ if ( num == OBJECT_MOTHER ) strcpy(text, "Insektenk�nigin");
+ if ( num == OBJECT_ANT ) strcpy(text, "Ameise");
+ if ( num == OBJECT_SPIDER ) strcpy(text, "Spinne");
+ if ( num == OBJECT_BEE ) strcpy(text, "Wespe");
+ if ( num == OBJECT_WORM ) strcpy(text, "Wurm");
+ if ( num == OBJECT_EGG ) strcpy(text, "Ei");
+ if ( num == OBJECT_RUINmobilew1 ) strcpy(text, "Roboterwrack");
+ if ( num == OBJECT_RUINmobilew2 ) strcpy(text, "Roboterwrack");
+ if ( num == OBJECT_RUINmobilet1 ) strcpy(text, "Roboterwrack");
+ if ( num == OBJECT_RUINmobilet2 ) strcpy(text, "Roboterwrack");
+ if ( num == OBJECT_RUINmobiler1 ) strcpy(text, "Roboterwrack");
+ if ( num == OBJECT_RUINmobiler2 ) strcpy(text, "Roboterwrack");
+ if ( num == OBJECT_RUINfactory ) strcpy(text, "Geb�uderuine");
+ if ( num == OBJECT_RUINdoor ) strcpy(text, "Geb�uderuine");
+ if ( num == OBJECT_RUINsupport ) strcpy(text, "Abfall");
+ if ( num == OBJECT_RUINradar ) strcpy(text, "Geb�uderuine");
+ if ( num == OBJECT_RUINconvert ) strcpy(text, "Geb�uderuine");
+ if ( num == OBJECT_RUINbase ) strcpy(text, "Raumschiffruine");
+ if ( num == OBJECT_RUINhead ) strcpy(text, "Raumschiffruine");
+ if ( num == OBJECT_APOLLO1 ||
+ num == OBJECT_APOLLO3 ||
+ num == OBJECT_APOLLO4 ||
+ num == OBJECT_APOLLO5 ) strcpy(text, "�berreste einer Apollo-Mission");
+ if ( num == OBJECT_APOLLO2 ) strcpy(text, "Lunar Roving Vehicle");
+ }
+
+ if ( type == RES_ERR )
+ {
+ strcpy(text, "Fehler");
+ if ( num == ERR_CMD ) strcpy(text, "Befehl unbekannt");
+#if _NEWLOOK
+ if ( num == ERR_INSTALL ) strcpy(text, "CeeBot wurde nicht installiert.");
+ if ( num == ERR_NOCD ) strcpy(text, "Legen Sie die CeeBot-CD ein\nund starten Sie das Spiel neu.");
+#else
+ if ( num == ERR_INSTALL ) strcpy(text, "COLOBOT wurde nicht installiert.");
+ if ( num == ERR_NOCD ) strcpy(text, "Legen Sie die COLOBOT-CD ein\nund starten Sie das Spiel neu.");
+#endif
+ if ( num == ERR_MANIP_VEH ) strcpy(text, "Roboter ungeeignet");
+ if ( num == ERR_MANIP_FLY ) strcpy(text, "Im Flug unm�glich");
+ if ( num == ERR_MANIP_BUSY ) strcpy(text, "Tr�gt schon etwas");
+ if ( num == ERR_MANIP_NIL ) strcpy(text, "Nichts zu ergreifen");
+ if ( num == ERR_MANIP_MOTOR ) strcpy(text, "In Fahrt unm�glich");
+ if ( num == ERR_MANIP_OCC ) strcpy(text, "Stelle schon besetzt");
+ if ( num == ERR_MANIP_FRIEND ) strcpy(text, "Kein anderer Roboter");
+ if ( num == ERR_MANIP_RADIO ) strcpy(text, "Sie k�nnen keinen radioaktiven Gegenstand tragen");
+ if ( num == ERR_MANIP_WATER ) strcpy(text, "Sie k�nnen unter Wasser nichts tragen");
+ if ( num == ERR_MANIP_EMPTY ) strcpy(text, "Nichts abzulegen");
+ if ( num == ERR_BUILD_FLY ) strcpy(text, "Im Flug unm�glich");
+ if ( num == ERR_BUILD_WATER ) strcpy(text, "Unter Wasser unm�glich");
+ if ( num == ERR_BUILD_ENERGY ) strcpy(text, "Nicht genug Energie");
+ if ( num == ERR_BUILD_METALAWAY ) strcpy(text, "Titan zu weit weg");
+ if ( num == ERR_BUILD_METALNEAR ) strcpy(text, "Titan zu nahe");
+ if ( num == ERR_BUILD_METALINEX ) strcpy(text, "Kein Titan vorhanden");
+ if ( num == ERR_BUILD_FLAT ) strcpy(text, "Boden nicht eben genug");
+ if ( num == ERR_BUILD_FLATLIT ) strcpy(text, "Ebener Boden nicht gro� genug");
+ if ( num == ERR_BUILD_BUSY ) strcpy(text, "Stelle schon besetzt");
+ if ( num == ERR_BUILD_BASE ) strcpy(text, "Zu nahe am Raumschiff");
+ if ( num == ERR_BUILD_NARROW ) strcpy(text, "Zu nahe an einem Geb�ude");
+ if ( num == ERR_BUILD_MOTOR ) strcpy(text, "In Fahrt unm�glich");
+ if ( num == ERR_SEARCH_FLY ) strcpy(text, "Im Flug unm�glich");
+ if ( num == ERR_SEARCH_VEH ) strcpy(text, "Roboter ungeeignet");
+ if ( num == ERR_SEARCH_MOTOR ) strcpy(text, "In Fahrt unm�glich");
+ if ( num == ERR_TERRA_VEH ) strcpy(text, "Roboter ungeeignet");
+ if ( num == ERR_TERRA_ENERGY ) strcpy(text, "Nicht genug Energie");
+ if ( num == ERR_TERRA_FLOOR ) strcpy(text, "Boden ungeeignet");
+ if ( num == ERR_TERRA_BUILDING ) strcpy(text, "Geb�ude zu nahe");
+ if ( num == ERR_TERRA_OBJECT ) strcpy(text, "Gegenstand zu nahe");
+ if ( num == ERR_RECOVER_VEH ) strcpy(text, "Roboter ungeeignet");
+ if ( num == ERR_RECOVER_ENERGY ) strcpy(text, "Nicht genug Energie");
+ if ( num == ERR_RECOVER_NULL ) strcpy(text, "Nichts zu recyceln");
+ if ( num == ERR_SHIELD_VEH ) strcpy(text, "Roboter ungeeignet");
+ if ( num == ERR_SHIELD_ENERGY ) strcpy(text, "Keine Energie mehr");
+//? if ( num == ERR_COM ) strcpy(text, "Kommunikationsproblem mit dem Roboter");
+ if ( num == ERR_MOVE_IMPOSSIBLE ) strcpy(text, "Ziel kann nicht erreicht werden");
+ if ( num == ERR_FIND_IMPOSSIBLE ) strcpy(text, "Das Objekt existiert nicht");
+ if ( num == ERR_GOTO_IMPOSSIBLE ) strcpy(text, "Ziel kann nicht erreicht werden");
+ if ( num == ERR_GOTO_ITER ) strcpy(text, "Ziel kann nicht erreicht werden");
+ if ( num == ERR_GOTO_BUSY ) strcpy(text, "Ziel ist schon besetzt");
+ if ( num == ERR_FIRE_VEH ) strcpy(text, "Roboter ungeeignet");
+ if ( num == ERR_FIRE_ENERGY ) strcpy(text, "Nicht genug Energie");
+ if ( num == ERR_FIRE_FLY ) strcpy(text, "Im Flug unm�glich");
+ if ( num == ERR_CONVERT_EMPTY ) strcpy(text, "Kein konvertierbares Titanerz vorhanden");
+ if ( num == ERR_DERRICK_NULL ) strcpy(text, "Keine unterirdische Erzlagerst�tte");
+ if ( num == ERR_STATION_NULL ) strcpy(text, "Kein unterirdisches Energievorkommen");
+ if ( num == ERR_TOWER_POWER ) strcpy(text, "Keine Batterie");
+ if ( num == ERR_TOWER_ENERGY ) strcpy(text, "Keine Energie mehr");
+ if ( num == ERR_RESEARCH_POWER ) strcpy(text, "Keine Batterie");
+ if ( num == ERR_RESEARCH_ENERGY ) strcpy(text, "Nicht mehr genug Energie");
+ if ( num == ERR_RESEARCH_TYPE ) strcpy(text, "Falscher Batterietyp");
+ if ( num == ERR_RESEARCH_ALREADY) strcpy(text, "Forschungsprogramm schon ausgef�hrt");
+ if ( num == ERR_ENERGY_NULL ) strcpy(text, "Kein unterirdisches Energievorkommen");
+ if ( num == ERR_ENERGY_LOW ) strcpy(text, "Noch nicht genug Energie");
+ if ( num == ERR_ENERGY_EMPTY ) strcpy(text, "Kein konvertierbares Titanerz vorhanden");
+ if ( num == ERR_ENERGY_BAD ) strcpy(text, "Wandelt nur Titanerz um");
+ if ( num == ERR_BASE_DLOCK ) strcpy(text, "Die T�ren werden von einem Gegenstand blockiert");
+ if ( num == ERR_BASE_DHUMAN ) strcpy(text, "Gehen Sie an Bord, bevor Sie abheben");
+ if ( num == ERR_LABO_NULL ) strcpy(text, "Nichts zu analysieren");
+ if ( num == ERR_LABO_BAD ) strcpy(text, "Analysiert nur Orgastoff");
+ if ( num == ERR_LABO_ALREADY ) strcpy(text, "Analyse schon durchgef�hrt");
+ if ( num == ERR_NUCLEAR_NULL ) strcpy(text, "Kein unterirdisches Energievorkommen");
+ if ( num == ERR_NUCLEAR_LOW ) strcpy(text, "Noch nicht genug Energie");
+ if ( num == ERR_NUCLEAR_EMPTY ) strcpy(text, "Kein konvertierbares Platin");
+ if ( num == ERR_NUCLEAR_BAD ) strcpy(text, "Wandelt nur Platin um");
+ if ( num == ERR_FACTORY_NULL ) strcpy(text, "Kein Titan vorhanden");
+ if ( num == ERR_FACTORY_NEAR ) strcpy(text, "Ein Gegenstand ist zu nahe");
+ if ( num == ERR_RESET_NEAR ) strcpy(text, "Stelle schon besetzt");
+ if ( num == ERR_INFO_NULL ) strcpy(text, "Kein Infoserver in Reichweite");
+ if ( num == ERR_VEH_VIRUS ) strcpy(text, "Ein Programm wurde von einem Virus infiziert");
+ if ( num == ERR_BAT_VIRUS ) strcpy(text, "Von Virus infiziert, zeitweise au�er Betrieb");
+ if ( num == ERR_VEH_POWER ) strcpy(text, "Keine Batterie");
+ if ( num == ERR_VEH_ENERGY ) strcpy(text, "Keine Energie mehr");
+ if ( num == ERR_FLAG_FLY ) strcpy(text, "Im Flug unm�glich");
+ if ( num == ERR_FLAG_WATER ) strcpy(text, "Im Wasser unm�glich");
+ if ( num == ERR_FLAG_MOTOR ) strcpy(text, "Beim Gehen unm�glich");
+ if ( num == ERR_FLAG_BUSY ) strcpy(text, "Unm�glich wenn Sie etwas tragen");
+ if ( num == ERR_FLAG_CREATE ) strcpy(text, "Zu viele Fahnen dieser Farbe (Maximum 5)");
+ if ( num == ERR_FLAG_PROXY ) strcpy(text, "Zu nahe an einer anderen Fahne");
+ if ( num == ERR_FLAG_DELETE ) strcpy(text, "Keine Fahne in Reichweite");
+ if ( num == ERR_MISSION_NOTERM ) strcpy(text, "Mission noch nicht beendet (Dr�cken Sie auf \\key help; f�r weitere Informationen)");
+ if ( num == ERR_DELETEMOBILE ) strcpy(text, "Roboter zerst�rt");
+ if ( num == ERR_DELETEBUILDING ) strcpy(text, "Geb�ude zerst�rt");
+ if ( num == ERR_TOOMANY ) strcpy(text, "Kein neues Objekt kann erstellt werden (zu viele vorhanden)");
+ if ( num == ERR_OBLIGATORYTOKEN ) strcpy(text, "Es fehlt \"%s\" in Ihrem Programm");
+ if ( num == ERR_PROHIBITEDTOKEN ) strcpy(text, "In dieser �bung verboten");
+
+ if ( num == INFO_BUILD ) strcpy(text, "Geb�ude fertiggestellt");
+ if ( num == INFO_CONVERT ) strcpy(text, "Titan verf�gbar");
+ if ( num == INFO_RESEARCH ) strcpy(text, "Forschungsprogramm abgeschlossen");
+ if ( num == INFO_RESEARCHTANK ) strcpy(text, "Herstellung eines Roboters mit Kettenantrieb m�glich");
+ if ( num == INFO_RESEARCHFLY ) strcpy(text, "Sie k�nnen jetzt mit den Tasten \\key gup; und \\key gdown; fliegen");
+ if ( num == INFO_RESEARCHTHUMP ) strcpy(text, "Herstellung eines Stampfers m�glich");
+ if ( num == INFO_RESEARCHCANON ) strcpy(text, "Herstellung eines Shooters m�glich");
+ if ( num == INFO_RESEARCHTOWER ) strcpy(text, "Errichtung eines Gesch�tzturms m�glich");
+ if ( num == INFO_RESEARCHPHAZER ) strcpy(text, "Herstellung eines Phazershooters m�glich");
+ if ( num == INFO_RESEARCHSHIELD ) strcpy(text, "Herstellung eines Schutzschildes m�glich");
+ if ( num == INFO_RESEARCHATOMIC ) strcpy(text, "Errichtung einer Brennstoffzellenfabrik m�glich");
+ if ( num == INFO_FACTORY ) strcpy(text, "Neuer Roboter verf�gbar");
+ if ( num == INFO_LABO ) strcpy(text, "Analyse vollendet");
+ if ( num == INFO_ENERGY ) strcpy(text, "Batterie verf�gbar");
+ if ( num == INFO_NUCLEAR ) strcpy(text, "Brennstoffzelle verf�gbar");
+ if ( num == INFO_FINDING ) strcpy(text, "Sie haben ein brauchbares Objekt gefunden");
+ if ( num == INFO_MARKPOWER ) strcpy(text, "Geeignete Stelle f�r Kraftwerk gefunden");
+ if ( num == INFO_MARKURANIUM ) strcpy(text, "Geeignete Stelle f�r Bohrturm gefunden");
+ if ( num == INFO_MARKSTONE ) strcpy(text, "Geeignete Stelle f�r Bohrturm gefunden");
+ if ( num == INFO_MARKKEYa ) strcpy(text, "Geeignete Stelle f�r Bohrturm gefunden");
+ if ( num == INFO_MARKKEYb ) strcpy(text, "Geeignete Stelle f�r Bohrturm gefunden");
+ if ( num == INFO_MARKKEYc ) strcpy(text, "Geeignete Stelle f�r Bohrturm gefunden");
+ if ( num == INFO_MARKKEYd ) strcpy(text, "Geeignete Stelle f�r Bohrturm gefunden");
+ if ( num == INFO_WIN ) strcpy(text, "<<< Bravo, Mission vollendet >>>");
+ if ( num == INFO_LOST ) strcpy(text, "<<< Mission gescheitert >>>");
+ if ( num == INFO_LOSTq ) strcpy(text, "<<< Mission gescheitert >>>");
+ if ( num == INFO_WRITEOK ) strcpy(text, "Mission gespeichert");
+ if ( num == INFO_DELETEPATH ) strcpy(text, "Checkpoint erreicht");
+ if ( num == INFO_DELETEMOTHER ) strcpy(text, "Insektenk�nigin t�dlich verwundet");
+ if ( num == INFO_DELETEANT ) strcpy(text, "Ameise t�dlich verwundet");
+ if ( num == INFO_DELETEBEE ) strcpy(text, "Wespe t�dlich verwundet");
+ if ( num == INFO_DELETEWORM ) strcpy(text, "Wurm t�dlich verwundet");
+ if ( num == INFO_DELETESPIDER ) strcpy(text, "Spinne t�dlich verwundet");
+ if ( num == INFO_BEGINSATCOM ) strcpy(text, "Beziehen Sie sich auf Ihren SatCom, indem Sie auf \\key help; dr�cken");
+ }
+
+ if ( type == RES_CBOT )
+ {
+ strcpy(text, "Fehler");
+ if ( num == TX_OPENPAR ) strcpy(text, "Es fehlt eine offene Klammer ""(""");
+ if ( num == TX_CLOSEPAR ) strcpy(text, "Es fehlt eine geschlossene Klammer "")""");
+ if ( num == TX_NOTBOOL ) strcpy(text, "Der Ausdruck muss einen boolschen Wert ergeben");
+ if ( num == TX_UNDEFVAR ) strcpy(text, "Variable nicht deklariert");
+ if ( num == TX_BADLEFT ) strcpy(text, "Zuweisung unm�glich");
+ if ( num == TX_ENDOF ) strcpy(text, "Es fehlt ein Strichpunkt "";"" am Ende der Anweisung");
+ if ( num == TX_OUTCASE ) strcpy(text, "Anweisung ""case"" ohne vorhergehende Anweisung ""switch""");
+ if ( num == TX_NOTERM ) strcpy(text, "Hier ist eine Anweisung nach dem Ende des Programms");
+ if ( num == TX_CLOSEBLK ) strcpy(text, "Es fehlt eine geschlossene geschweifte Klammer ""}"" (Ende des Blocks)");
+ if ( num == TX_ELSEWITHOUTIF ) strcpy(text, "Anweisung ""else"" ohne vorhergehende Anweisung ""if""");
+ if ( num == TX_OPENBLK ) strcpy(text, "Es fehlt eine offene geschweifte Klammer""{""");
+ if ( num == TX_BADTYPE ) strcpy(text, "Der Ausdruck ergibt einen falschen Typ f�r die Zuweisung");
+ if ( num == TX_REDEFVAR ) strcpy(text, "Eine Variable wird zum zweiten Mal deklariert");
+ if ( num == TX_BAD2TYPE ) strcpy(text, "Die zwei Operanden sind nicht kompatibel");
+ if ( num == TX_UNDEFCALL ) strcpy(text, "Unbekannte Funktion");
+ if ( num == TX_MISDOTS ) strcpy(text, "Es fehlt ein Doppelpunkt "" : """);
+ if ( num == TX_WHILE ) strcpy(text, "Es fehlt das Wort ""while""");
+ if ( num == TX_BREAK ) strcpy(text, "Anweisung ""break"" au�erhalb einer Schleife");
+ if ( num == TX_LABEL ) strcpy(text, "Ein Label kann nur vor den Anweisungen ""for"", ""while"", ""do"" oder ""switch"" vorkommen");
+ if ( num == TX_NOLABEL ) strcpy(text, "Dieses Label existiert nicht");
+ if ( num == TX_NOCASE ) strcpy(text, "Es fehlt eine Anweisung ""case""");
+ if ( num == TX_BADNUM ) strcpy(text, "Es fehlt eine Zahl");
+ if ( num == TX_VOID ) strcpy(text, "Parameter void");
+ if ( num == TX_NOTYP ) strcpy(text, "Hier muss ein Variablentyp stehen");
+ if ( num == TX_NOVAR ) strcpy(text, "Es fehlt der Name einer Variable");
+ if ( num == TX_NOFONC ) strcpy(text, "Hier muss der Name der Funktion stehen");
+ if ( num == TX_OVERPARAM ) strcpy(text, "Zu viele Parameter");
+ if ( num == TX_REDEF ) strcpy(text, "Diese Funktion gibt es schon");
+ if ( num == TX_LOWPARAM ) strcpy(text, "Nicht genug Parameter");
+ if ( num == TX_BADPARAM ) strcpy(text, "Keine Funktion mit diesem Namen vertr�gt Parameter diesen Typs");
+ if ( num == TX_NUMPARAM ) strcpy(text, "Keine Funktion mit diesem Namen vertr�gt diese Anzahl Parameter");
+ if ( num == TX_NOITEM ) strcpy(text, "Dieses Element gibt es nicht in dieser Klasse");
+ if ( num == TX_DOT ) strcpy(text, "Das Objekt ist nicht eine Instanz einer Klasse");
+ if ( num == TX_NOCONST ) strcpy(text, "Es gibt keinen geeigneten Konstruktor");
+ if ( num == TX_REDEFCLASS ) strcpy(text, "Diese Klasse gibt es schon");
+ if ( num == TX_CLBRK ) strcpy(text, "Es fehlt eine geschlossene eckige Klammer "" ] """);
+ if ( num == TX_RESERVED ) strcpy(text, "Dieses Wort ist reserviert");
+ if ( num == TX_BADNEW ) strcpy(text, "Falsche Argumente f�r ""new""");
+ if ( num == TX_OPBRK ) strcpy(text, "Es fehlt eine offene eckige Klammer "" [ """);
+ if ( num == TX_BADSTRING ) strcpy(text, "Hier wird eine Zeichenkette erwartet");
+ if ( num == TX_BADINDEX ) strcpy(text, "Falscher Typ f�r einen Index");
+ if ( num == TX_PRIVATE ) strcpy(text, "Gesch�tztes Element (private)");
+ if ( num == TX_NOPUBLIC ) strcpy(text, "Hier muss das Wort ""public"" stehen");
+ if ( num == TX_DIVZERO ) strcpy(text, "Teilung durch Null");
+ if ( num == TX_NOTINIT ) strcpy(text, "Der Wert dieser Variable wurde nicht definiert");
+ if ( num == TX_BADTHROW ) strcpy(text, "Negativer Wert ungeeignet f�r Anweisung ""throw""");
+ if ( num == TX_NORETVAL ) strcpy(text, "Die Funktion hat kein Ergebnis zur�ckgegeben");
+ if ( num == TX_NORUN ) strcpy(text, "Keine Funktion wird ausgef�hrt");
+ if ( num == TX_NOCALL ) strcpy(text, "Die aufgerufene Funktion existiert nicht");
+ if ( num == TX_NOCLASS ) strcpy(text, "Diese Klasse existiert nicht");
+ if ( num == TX_NULLPT ) strcpy(text, "Das Objekt existiert nicht");
+ if ( num == TX_OPNAN ) strcpy(text, "Operation mit dem Wert ""nan""");
+ if ( num == TX_OUTARRAY ) strcpy(text, "Zugriff im Array au�erhalb der Grenzen");
+ if ( num == TX_STACKOVER ) strcpy(text, "Stack overflow");
+ if ( num == TX_DELETEDPT ) strcpy(text, "Objekt nicht verf�gbar");
+ if ( num == TX_FILEOPEN ) strcpy(text, "Die Datei kann nicht ge�ffnet werden");
+ if ( num == TX_NOTOPEN ) strcpy(text, "Die Datei wurde nicht ge�ffnet");
+ if ( num == TX_ERRREAD ) strcpy(text, "Fehler beim Lesezugriff");
+ if ( num == TX_ERRWRITE ) strcpy(text, "Fehler beim Schreibzugriff");
+ }
+
+ if ( type == RES_KEY )
+ {
+ if ( num == 0 ) strcpy(text, "< keine >");
+ if ( num == SDLK_LEFT ) strcpy(text, "Pfeiltaste links");
+ if ( num == SDLK_RIGHT ) strcpy(text, "Pfeiltaste rechts");
+ if ( num == SDLK_UP ) strcpy(text, "Pfeil nach oben");
+ if ( num == SDLK_DOWN ) strcpy(text, "Pfeil nach unten");
+ if ( num == SDLK_CANCEL ) strcpy(text, "Ctrl-Break");
+ if ( num == SDLK_BACK ) strcpy(text, "<--");
+ if ( num == SDLK_TAB ) strcpy(text, "Tab");
+ if ( num == SDLK_CLEAR ) strcpy(text, "Clear");
+ if ( num == SDLK_RETURN ) strcpy(text, "Eingabe");
+ if ( num == SDLK_SHIFT ) strcpy(text, "Shift");
+ if ( num == SDLK_CONTROL ) strcpy(text, "Ctrl");
+ if ( num == SDLK_MENU ) strcpy(text, "Alt");
+ if ( num == SDLK_PAUSE ) strcpy(text, "Pause");
+ if ( num == SDLK_CAPITAL ) strcpy(text, "Caps Lock");
+ if ( num == SDLK_ESCAPE ) strcpy(text, "Esc");
+ if ( num == SDLK_SPACE ) strcpy(text, "Leertaste");
+ if ( num == SDLK_PRIOR ) strcpy(text, "Page Up");
+ if ( num == SDLK_NEXT ) strcpy(text, "Page Down");
+ if ( num == SDLK_END ) strcpy(text, "End");
+ if ( num == SDLK_HOME ) strcpy(text, "Home");
+ if ( num == SDLK_SELECT ) strcpy(text, "Select");
+ if ( num == SDLK_EXECUTE ) strcpy(text, "Execute");
+ if ( num == SDLK_SNAPSHOT ) strcpy(text, "Print Scrn");
+ if ( num == SDLK_INSERT ) strcpy(text, "Insert");
+ if ( num == SDLK_DELETE ) strcpy(text, "Delete");
+ if ( num == SDLK_HELP ) strcpy(text, "Help");
+ if ( num == SDLK_LWIN ) strcpy(text, "Left Windows");
+ if ( num == SDLK_RWIN ) strcpy(text, "Right Windows");
+ if ( num == SDLK_APPS ) strcpy(text, "Application key");
+ if ( num == SDLK_NUMPAD0 ) strcpy(text, "NumPad 0");
+ if ( num == SDLK_NUMPAD1 ) strcpy(text, "NumPad 1");
+ if ( num == SDLK_NUMPAD2 ) strcpy(text, "NumPad 2");
+ if ( num == SDLK_NUMPAD3 ) strcpy(text, "NumPad 3");
+ if ( num == SDLK_NUMPAD4 ) strcpy(text, "NumPad 4");
+ if ( num == SDLK_NUMPAD5 ) strcpy(text, "NumPad 5");
+ if ( num == SDLK_NUMPAD6 ) strcpy(text, "NumPad 6");
+ if ( num == SDLK_NUMPAD7 ) strcpy(text, "NumPad 7");
+ if ( num == SDLK_NUMPAD8 ) strcpy(text, "NumPad 8");
+ if ( num == SDLK_NUMPAD9 ) strcpy(text, "NumPad 9");
+ if ( num == SDLK_MULTIPLY ) strcpy(text, "NumPad *");
+ if ( num == SDLK_ADD ) strcpy(text, "NumPad +");
+ if ( num == SDLK_SEPARATOR ) strcpy(text, "NumPad sep");
+ if ( num == SDLK_SUBTRACT ) strcpy(text, "NumPad -");
+ if ( num == SDLK_DECIMAL ) strcpy(text, "NumPad .");
+ if ( num == SDLK_DIVIDE ) strcpy(text, "NumPad /");
+ if ( num == SDLK_F1 ) strcpy(text, "F1");
+ if ( num == SDLK_F2 ) strcpy(text, "F2");
+ if ( num == SDLK_F3 ) strcpy(text, "F3");
+ if ( num == SDLK_F4 ) strcpy(text, "F4");
+ if ( num == SDLK_F5 ) strcpy(text, "F5");
+ if ( num == SDLK_F6 ) strcpy(text, "F6");
+ if ( num == SDLK_F7 ) strcpy(text, "F7");
+ if ( num == SDLK_F8 ) strcpy(text, "F8");
+ if ( num == SDLK_F9 ) strcpy(text, "F9");
+ if ( num == SDLK_F10 ) strcpy(text, "F10");
+ if ( num == SDLK_F11 ) strcpy(text, "F11");
+ if ( num == SDLK_F12 ) strcpy(text, "F12");
+ if ( num == SDLK_F13 ) strcpy(text, "F13");
+ if ( num == SDLK_F14 ) strcpy(text, "F14");
+ if ( num == SDLK_F15 ) strcpy(text, "F15");
+ if ( num == SDLK_F16 ) strcpy(text, "F16");
+ if ( num == SDLK_F17 ) strcpy(text, "F17");
+ if ( num == SDLK_F18 ) strcpy(text, "F18");
+ if ( num == SDLK_F19 ) strcpy(text, "F19");
+ if ( num == SDLK_F20 ) strcpy(text, "F20");
+ if ( num == SDLK_NUMLOCK ) strcpy(text, "Num Lock");
+ if ( num == SDLK_SCROLL ) strcpy(text, "Scroll");
+ if ( num == SDLK_ATTN ) strcpy(text, "Attn");
+ if ( num == SDLK_CRSEL ) strcpy(text, "CrSel");
+ if ( num == SDLK_EXSEL ) strcpy(text, "ExSel");
+ if ( num == SDLK_EREOF ) strcpy(text, "Erase EOF");
+ if ( num == SDLK_PLAY ) strcpy(text, "Play");
+ if ( num == SDLK_ZOOM ) strcpy(text, "Zoom");
+ if ( num == SDLK_PA1 ) strcpy(text, "PA1");
+ if ( num == SDLK_OEM_CLEAR ) strcpy(text, "Clear");
+ if ( num == SDLK_BUTTON1 ) strcpy(text, "Knopf 1");
+ if ( num == SDLK_BUTTON2 ) strcpy(text, "Knopf 2");
+ if ( num == SDLK_BUTTON3 ) strcpy(text, "Knopf 3");
+ if ( num == SDLK_BUTTON4 ) strcpy(text, "Knopf 4");
+ if ( num == SDLK_BUTTON5 ) strcpy(text, "Knopf 5");
+ if ( num == SDLK_BUTTON6 ) strcpy(text, "Knopf 6");
+ if ( num == SDLK_BUTTON7 ) strcpy(text, "Knopf 7");
+ if ( num == SDLK_BUTTON8 ) strcpy(text, "Knopf 8");
+ if ( num == SDLK_BUTTON9 ) strcpy(text, "Knopf 9");
+ if ( num == SDLK_BUTTON10 ) strcpy(text, "Knopf 10");
+ if ( num == SDLK_BUTTON11 ) strcpy(text, "Knopf 11");
+ if ( num == SDLK_BUTTON12 ) strcpy(text, "Knopf 12");
+ if ( num == SDLK_BUTTON13 ) strcpy(text, "Knopf 13");
+ if ( num == SDLK_BUTTON14 ) strcpy(text, "Knopf 14");
+ if ( num == SDLK_BUTTON15 ) strcpy(text, "Knopf 15");
+ if ( num == SDLK_BUTTON16 ) strcpy(text, "Knopf 16");
+ if ( num == SDLK_BUTTON17 ) strcpy(text, "Knopf 17");
+ if ( num == SDLK_BUTTON18 ) strcpy(text, "Knopf 18");
+ if ( num == SDLK_BUTTON19 ) strcpy(text, "Knopf 19");
+ if ( num == SDLK_BUTTON20 ) strcpy(text, "Knopf 20");
+ if ( num == SDLK_BUTTON21 ) strcpy(text, "Knopf 21");
+ if ( num == SDLK_BUTTON22 ) strcpy(text, "Knopf 22");
+ if ( num == SDLK_BUTTON23 ) strcpy(text, "Knopf 23");
+ if ( num == SDLK_BUTTON24 ) strcpy(text, "Knopf 24");
+ if ( num == SDLK_BUTTON25 ) strcpy(text, "Knopf 25");
+ if ( num == SDLK_BUTTON26 ) strcpy(text, "Knopf 26");
+ if ( num == SDLK_BUTTON27 ) strcpy(text, "Knopf 27");
+ if ( num == SDLK_BUTTON28 ) strcpy(text, "Knopf 28");
+ if ( num == SDLK_BUTTON29 ) strcpy(text, "Knopf 29");
+ if ( num == SDLK_BUTTON30 ) strcpy(text, "Knopf 30");
+ if ( num == SDLK_BUTTON31 ) strcpy(text, "Knopf 31");
+ if ( num == SDLK_BUTTON32 ) strcpy(text, "Knopf 32");
+ if ( num == SDLK_WHEELUP ) strcpy(text, "Mausrad nach vorne");
+ if ( num == SDLK_WHEELDOWN ) strcpy(text, "Mausrad zur�ck");
+ }
+#endif
+
+#if _POLISH
+ if ( type == RES_TEXT )
+ {
+ #if _FULL
+ if ( num == RT_VERSION_ID ) strcpy(text, "Wersja 1.18 /pl");
+ #endif
+ #if _NET
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A 1.18");
+ #endif
+ #if _SCHOOL & _EDU
+ #if _TEEN
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-Teen EDU 1.18");
+ #else
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A EDU 1.18");
+ #endif
+ #endif
+ #if _SCHOOL & _PERSO
+ #if _TEEN
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-Teen PERSO 1.18");
+ #else
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A PERSO 1.18");
+ #endif
+ #endif
+ #if _SCHOOL & _CEEBOTDEMO
+ #if _TEEN
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-Teen DEMO 1.18");
+ #else
+ if ( num == RT_VERSION_ID ) strcpy(text, "CeeBot-A DEMO 1.18");
+ #endif
+ #endif
+ #if _DEMO
+ if ( num == RT_VERSION_ID ) strcpy(text, "Demo 1.18 /pl");
+ #endif
+ if ( num == RT_DISINFO_TITLE ) strcpy(text, "SatCom");
+ if ( num == RT_WINDOW_MAXIMIZED ) strcpy(text, "Powi�ksz");
+ if ( num == RT_WINDOW_MINIMIZED ) strcpy(text, "Pomniejsz");
+ if ( num == RT_WINDOW_STANDARD ) strcpy(text, "Normalna wielko��");
+ if ( num == RT_WINDOW_CLOSE ) strcpy(text, "Zamknij");
+
+ if ( num == RT_STUDIO_TITLE ) strcpy(text, "Edytor programu");
+ if ( num == RT_SCRIPT_NEW ) strcpy(text, "Nowy");
+ if ( num == RT_NAME_DEFAULT ) strcpy(text, "Gracz");
+ if ( num == RT_IO_NEW ) strcpy(text, "Nowy ...");
+ if ( num == RT_KEY_OR ) strcpy(text, " lub ");
+
+#if _NEWLOOK
+ if ( num == RT_TITLE_BASE ) strcpy(text, "CeeBot");
+ if ( num == RT_TITLE_INIT ) strcpy(text, "CeeBot");
+#else
+ if ( num == RT_TITLE_BASE ) strcpy(text, "COLOBOT");
+ if ( num == RT_TITLE_INIT ) strcpy(text, "COLOBOT");
+#endif
+ if ( num == RT_TITLE_TRAINER ) strcpy(text, "�wiczenia programistyczne");
+ if ( num == RT_TITLE_DEFI ) strcpy(text, "Wyzwania");
+ if ( num == RT_TITLE_MISSION ) strcpy(text, "Misje");
+ if ( num == RT_TITLE_FREE ) strcpy(text, "Swobodna gra");
+ if ( num == RT_TITLE_TEEN ) strcpy(text, "Swobodna gra");
+ if ( num == RT_TITLE_USER ) strcpy(text, "Poziomy u�ytkownika");
+ if ( num == RT_TITLE_PROTO ) strcpy(text, "Prototypy");
+ if ( num == RT_TITLE_SETUP ) strcpy(text, "Opcje");
+ if ( num == RT_TITLE_NAME ) strcpy(text, "Imi� gracza");
+ if ( num == RT_TITLE_PERSO ) strcpy(text, "Dostosuj wygl�d");
+ if ( num == RT_TITLE_WRITE ) strcpy(text, "Zapisz bie��c� misj�");
+ if ( num == RT_TITLE_READ ) strcpy(text, "Wczytaj zapisan� misj�");
+
+ if ( num == RT_PLAY_CHAPt ) strcpy(text, " Rozdzia�y:");
+ if ( num == RT_PLAY_CHAPd ) strcpy(text, " Rozdzia�y:");
+ if ( num == RT_PLAY_CHAPm ) strcpy(text, " Planety:");
+ if ( num == RT_PLAY_CHAPf ) strcpy(text, " Planety:");
+ if ( num == RT_PLAY_CHAPu ) strcpy(text, " Poziomy u�ytkownika:");
+ if ( num == RT_PLAY_CHAPp ) strcpy(text, " Planety:");
+ if ( num == RT_PLAY_CHAPte ) strcpy(text, " Planety:");
+ if ( num == RT_PLAY_LISTt ) strcpy(text, " �wiczenia w tym rozdziale:");
+ if ( num == RT_PLAY_LISTd ) strcpy(text, " Wyzwania w tym rozdziale:");
+ if ( num == RT_PLAY_LISTm ) strcpy(text, " Misje na tej planecie:");
+ if ( num == RT_PLAY_LISTf ) strcpy(text, " Swobodna gra na tej planecie:");
+ if ( num == RT_PLAY_LISTu ) strcpy(text, " Misje na tym poziomie:");
+ if ( num == RT_PLAY_LISTp ) strcpy(text, " Prototypy na tej planecie:");
+ if ( num == RT_PLAY_LISTk ) strcpy(text, " Prototypy na tej planecie:");
+ if ( num == RT_PLAY_RESUME ) strcpy(text, " Streszczenie:");
+
+ if ( num == RT_SETUP_DEVICE ) strcpy(text, " Sterowniki:");
+ if ( num == RT_SETUP_MODE ) strcpy(text, " Rozdzielczo��:");
+ if ( num == RT_SETUP_KEY1 ) strcpy(text, "1) Najpierw kliknij klawisz, kt�ry chcesz przedefiniowa�.");
+ if ( num == RT_SETUP_KEY2 ) strcpy(text, "2) Nast�pnie naci�nij klawisz, kt�rego chcesz u�ywa�.");
+
+ if ( num == RT_PERSO_FACE ) strcpy(text, "Rodzaj twarzy:");
+ if ( num == RT_PERSO_GLASSES ) strcpy(text, "Okulary:");
+ if ( num == RT_PERSO_HAIR ) strcpy(text, "Kolor w�os�w:");
+ if ( num == RT_PERSO_COMBI ) strcpy(text, "Kolor skafandra:");
+ if ( num == RT_PERSO_BAND ) strcpy(text, "Kolor pask�w:");
+
+#if _NEWLOOK
+ if ( num == RT_DIALOG_TITLE ) strcpy(text, "CeeBot");
+ if ( num == RT_DIALOG_QUIT ) strcpy(text, "Czy na pewno chcesz opu�ci� gr� CeeBot?");
+ if ( num == RT_DIALOG_YESQUIT ) strcpy(text, "Zako�cz\\Ko�czy gr� CeeBot");
+#else
+ if ( num == RT_DIALOG_TITLE ) strcpy(text, "COLOBOT");
+ if ( num == RT_DIALOG_QUIT ) strcpy(text, "Czy na pewno chcesz opu�ci� gr� COLOBOT?");
+ if ( num == RT_DIALOG_YESQUIT ) strcpy(text, "Zako�cz\\Ko�czy gr� COLOBOT");
+#endif
+ if ( num == RT_DIALOG_ABORT ) strcpy(text, "Opu�ci� misj�?");
+ if ( num == RT_DIALOG_YES ) strcpy(text, "Przerwij\\Przerywa bie��c� misj�");
+ if ( num == RT_DIALOG_NO ) strcpy(text, "Kontynuuj\\Kontynuuje bie��c� misj�");
+ if ( num == RT_DIALOG_NOQUIT ) strcpy(text, "Kontynuuj\\Kontynuuje gr�");
+ if ( num == RT_DIALOG_DELOBJ ) strcpy(text, "Czy na pewno chcesz zniszczy� zaznaczony budynek?");
+ if ( num == RT_DIALOG_DELGAME ) strcpy(text, "Czy na pewno chcesz skasowa� zapisane gry gracza %s? ");
+ if ( num == RT_DIALOG_YESDEL ) strcpy(text, "Usu�");
+ if ( num == RT_DIALOG_NODEL ) strcpy(text, "Anuluj");
+ if ( num == RT_DIALOG_LOADING ) strcpy(text, "WCZYTYWANIE");
+
+ if ( num == RT_STUDIO_LISTTT ) strcpy(text, "Skr�ty klawiszowe (\\key cbot;)");
+ if ( num == RT_STUDIO_COMPOK ) strcpy(text, "Program skompilowany (0 b��d�w)");
+ if ( num == RT_STUDIO_PROGSTOP ) strcpy(text, "Program zako�czony");
+
+ if ( num == RT_SATCOM_LIST ) strcpy(text, "\\b;Lista obiekt�w\n");
+ if ( num == RT_SATCOM_BOT ) strcpy(text, "\\b;Roboty\n");
+ if ( num == RT_SATCOM_BUILDING ) strcpy(text, "\\b;Budynki\n");
+ if ( num == RT_SATCOM_FRET ) strcpy(text, "\\b;Obiekty ruchome\n");
+ if ( num == RT_SATCOM_ALIEN ) strcpy(text, "\\b;Obcy\n");
+ if ( num == RT_SATCOM_NULL ) strcpy(text, "\\c; (brak)\\n;\n");
+ if ( num == RT_SATCOM_ERROR1 ) strcpy(text, "\\b;B��d\n");
+ if ( num == RT_SATCOM_ERROR2 ) strcpy(text, "Lista jest dost�pna jedynie gdy dzia�a \\l;stacja radarowa\\u object\\radar;.\n");
+
+ if ( num == RT_IO_OPEN ) strcpy(text, "Otw�rz");
+ if ( num == RT_IO_SAVE ) strcpy(text, "Zapisz");
+ if ( num == RT_IO_LIST ) strcpy(text, "Folder: %s");
+ if ( num == RT_IO_NAME ) strcpy(text, "Nazwa:");
+ if ( num == RT_IO_DIR ) strcpy(text, "Folder:");
+ if ( num == RT_IO_PRIVATE ) strcpy(text, "Prywatny\\Folder prywatny");
+ if ( num == RT_IO_PUBLIC ) strcpy(text, "Publiczny\\Folder og�lnodost�pny");
+
+ if ( num == RT_GENERIC_DEV1 ) strcpy(text, "Tw�rcy:");
+ if ( num == RT_GENERIC_DEV2 ) strcpy(text, "www.epsitec.com");
+ if ( num == RT_GENERIC_EDIT1 ) strcpy(text, "Wersja polska wydana przez:");
+ if ( num == RT_GENERIC_EDIT2 ) strcpy(text, "www.manta.com.pl");
+ if ( num == RT_GENERIC_EDIT1 ) strcpy(text, " ");
+ if ( num == RT_GENERIC_EDIT2 ) strcpy(text, " ");
+
+ if ( num == RT_INTERFACE_REC ) strcpy(text, "Recorder");
+ }
+
+ if ( type == RES_EVENT )
+ {
+ if ( num == EVENT_BUTTON_OK ) strcpy(text, "OK");
+ if ( num == EVENT_BUTTON_CANCEL ) strcpy(text, "Anuluj");
+ if ( num == EVENT_BUTTON_NEXT ) strcpy(text, "Nast�pny");
+ if ( num == EVENT_BUTTON_PREV ) strcpy(text, "Poprzedni");
+ if ( num == EVENT_BUTTON_QUIT ) strcpy(text, "Menu (\\key quit;)");
+
+ if ( num == EVENT_DIALOG_OK ) strcpy(text, "OK");
+ if ( num == EVENT_DIALOG_CANCEL ) strcpy(text, "Anuluj");
+
+ if ( num == EVENT_INTERFACE_TRAINER) strcpy(text, "�wiczenia\\�wiczenia programistyczne");
+ if ( num == EVENT_INTERFACE_DEFI ) strcpy(text, "Wyzwania\\Wyzwania programistyczne");
+ if ( num == EVENT_INTERFACE_MISSION) strcpy(text, "Misje\\Wybierz misj�");
+ if ( num == EVENT_INTERFACE_FREE ) strcpy(text, "Swobodna gra\\Swobodna gra bez konkretnych cel�w");
+ if ( num == EVENT_INTERFACE_TEEN ) strcpy(text, "Swobodna gra\\Swobodna gra bez konkretnych cel�w");
+ if ( num == EVENT_INTERFACE_USER ) strcpy(text, "Poziomy\\Poziomy u�ytkownika");
+ if ( num == EVENT_INTERFACE_PROTO ) strcpy(text, "Prototypy\\Prototypy w trakcie rozwijania");
+ if ( num == EVENT_INTERFACE_NAME ) strcpy(text, "Nowy gracz\\Wybierz imi� gracza");
+ if ( num == EVENT_INTERFACE_SETUP ) strcpy(text, "Opcje\\Preferencje");
+ if ( num == EVENT_INTERFACE_AGAIN ) strcpy(text, "Uruchom ponownie\\Uruchamia ponownie misj� od pocz�tku");
+ if ( num == EVENT_INTERFACE_WRITE ) strcpy(text, "Zapisz\\Zapisuje bie��c� misj�");
+ if ( num == EVENT_INTERFACE_READ ) strcpy(text, "Wczytaj\\Wczytuje zapisan� misj�");
+#if _NEWLOOK
+ if ( num == EVENT_INTERFACE_ABORT ) strcpy(text, "\\Powr�� do gry CeeBot");
+ if ( num == EVENT_INTERFACE_QUIT ) strcpy(text, "Zako�cz\\Ko�czy gr� CeeBot");
+#else
+ if ( num == EVENT_INTERFACE_ABORT ) strcpy(text, "\\Powr�� do gry COLOBOT");
+ if ( num == EVENT_INTERFACE_QUIT ) strcpy(text, "Zako�cz\\Ko�czy gr� COLOBOT");
+#endif
+ if ( num == EVENT_INTERFACE_BACK ) strcpy(text, "<< Wstecz \\Wraca do poprzedniego ekranu");
+ if ( num == EVENT_INTERFACE_PLAY ) strcpy(text, "Graj\\Rozpoczyna misj�!");
+ if ( num == EVENT_INTERFACE_SETUPd ) strcpy(text, "Urz�dzenie\\Ustawienia sterownika i rozdzielczo�ci");
+ if ( num == EVENT_INTERFACE_SETUPg ) strcpy(text, "Grafika\\Ustawienia grafiki");
+ if ( num == EVENT_INTERFACE_SETUPp ) strcpy(text, "Gra\\Ustawienia gry");
+ if ( num == EVENT_INTERFACE_SETUPc ) strcpy(text, "Sterowanie\\Ustawienia klawiatury, joysticka i myszy");
+ if ( num == EVENT_INTERFACE_SETUPs ) strcpy(text, "D�wi�k\\G�o�no�� muzyki i d�wi�k�w gry");
+ if ( num == EVENT_INTERFACE_DEVICE ) strcpy(text, "Jednostka");
+ if ( num == EVENT_INTERFACE_RESOL ) strcpy(text, "Rozdzielczo��");
+ if ( num == EVENT_INTERFACE_FULL ) strcpy(text, "Pe�ny ekran\\Pe�ny ekran lub tryb okna");
+ if ( num == EVENT_INTERFACE_APPLY ) strcpy(text, "Zastosuj zmiany\\Aktywuje zmienione ustawienia");
+
+ if ( num == EVENT_INTERFACE_TOTO ) strcpy(text, "Robbie\\Tw�j asystent");
+ if ( num == EVENT_INTERFACE_SHADOW ) strcpy(text, "Cienie\\Cienie na ziemi");
+ if ( num == EVENT_INTERFACE_GROUND ) strcpy(text, "Znaki na ziemi\\Znaki na ziemi");
+ if ( num == EVENT_INTERFACE_DIRTY ) strcpy(text, "Kurz\\Kurz i br�d na robotach i budynkach");
+ if ( num == EVENT_INTERFACE_FOG ) strcpy(text, "Mg�a\\Mg�a");
+ if ( num == EVENT_INTERFACE_LENS ) strcpy(text, "Promienie s�oneczne\\Promienie s�oneczne na niebie");
+ if ( num == EVENT_INTERFACE_SKY ) strcpy(text, "Niebo\\Chmury i mg�awice");
+ if ( num == EVENT_INTERFACE_PLANET ) strcpy(text, "Planety i gwiazdy\\Obiekty astronomiczne na niebie");
+ if ( num == EVENT_INTERFACE_LIGHT ) strcpy(text, "Dynamiczne o�wietlenie\\Ruchome �r�d�a �wiat�a");
+ if ( num == EVENT_INTERFACE_PARTI ) strcpy(text, "Liczba cz�stek\\Wybuchy, kurz, odbicia, itp.");
+ if ( num == EVENT_INTERFACE_CLIP ) strcpy(text, "G��boko�� pola\\Maksymalna widoczno��");
+ if ( num == EVENT_INTERFACE_DETAIL ) strcpy(text, "Szczeg�y\\Jako�� wizualna obiekt�w 3D");
+ if ( num == EVENT_INTERFACE_TEXTURE) strcpy(text, "Tekstury\\Jako�� tekstur ");
+ if ( num == EVENT_INTERFACE_GADGET ) strcpy(text, "Ilo�� element�w dekoracyjnych \\Ilo�� element�w czysto dekoracyjnych");
+ if ( num == EVENT_INTERFACE_RAIN ) strcpy(text, "Cz�stki w interfejsie\\Para i iskry z silnik�w w interfejsie");
+ if ( num == EVENT_INTERFACE_GLINT ) strcpy(text, "Odbicia na przyciskach \\�wiec�ce przyciski");
+ if ( num == EVENT_INTERFACE_TOOLTIP) strcpy(text, "Dymki pomocy\\Wyja�nia funkcje przycisk�w");
+ if ( num == EVENT_INTERFACE_MOVIES ) strcpy(text, "Sekwencje filmowe\\Filmy przed rozpocz�ciem i na zako�czenie misji");
+ if ( num == EVENT_INTERFACE_NICERST) strcpy(text, "Ko�cowy film\\Film na zako�czenie �wicze�");
+ if ( num == EVENT_INTERFACE_HIMSELF) strcpy(text, "Przyjacielski ogie�\\W�asne strza�y uszkadzaj� Twoje obiekty");
+ if ( num == EVENT_INTERFACE_SCROLL ) strcpy(text, "Przewijanie\\Ekran jest przewijany gdy mysz dotknie prawej lub lewej jego kraw�dzi");
+ if ( num == EVENT_INTERFACE_INVERTX) strcpy(text, "Odwr�cenie myszy X\\Odwr�cenie kierunk�w przewijania w poziomie");
+ if ( num == EVENT_INTERFACE_INVERTY) strcpy(text, "Odwr�cenie myszy Y\\Odwr�cenie kierunk�w przewijania w pionie");
+ if ( num == EVENT_INTERFACE_EFFECT ) strcpy(text, "Wstrz�sy przy wybuchach\\Ekran trz�sie si� podczas wybuch�w");
+ if ( num == EVENT_INTERFACE_MOUSE ) strcpy(text, "Cie� kursora myszy\\Dodaje cie� kursorowi myszy");
+ if ( num == EVENT_INTERFACE_EDITMODE) strcpy(text, "Automatyczne wci�cia\\Automatyczne wci�cia podczas edycji programu");
+ if ( num == EVENT_INTERFACE_EDITVALUE)strcpy(text, "Du�e wci�cie\\2 lub 4 spacje wci�cia na ka�dy poziom zdefiniowany przez klamry");
+ if ( num == EVENT_INTERFACE_SOLUCE4) strcpy(text, "Acc�s aux solutions\\Programme \"4: Solution\" dans les exercices");
+
+ if ( num == EVENT_INTERFACE_KDEF ) strcpy(text, "Standardowa kontrola\\Standardowe klawisze funkcyjne");
+ if ( num == EVENT_INTERFACE_KLEFT ) strcpy(text, "Skr�� w lewo\\Obraca robota w lewo");
+ if ( num == EVENT_INTERFACE_KRIGHT ) strcpy(text, "Obr�� w prawo\\Obraca robota w prawo");
+ if ( num == EVENT_INTERFACE_KUP ) strcpy(text, "Naprz�d\\Porusza do przodu");
+ if ( num == EVENT_INTERFACE_KDOWN ) strcpy(text, "Wstecz\\Porusza do ty�u");
+ if ( num == EVENT_INTERFACE_KGUP ) strcpy(text, "W g�r�\\Zwi�ksza moc silnika");
+ if ( num == EVENT_INTERFACE_KGDOWN ) strcpy(text, "W d�\\Zmniejsza moc silnika");
+ if ( num == EVENT_INTERFACE_KCAMERA) strcpy(text, "Zmie� kamer�\\Prze��cza pomi�dzy kamer� pok�adow� i �ledz�c�");
+ if ( num == EVENT_INTERFACE_KDESEL ) strcpy(text, "Poprzedni obiekt\\Zaznacz poprzedni obiekt");
+ if ( num == EVENT_INTERFACE_KACTION) strcpy(text, "Standardowa akcja\\Standardowa akcja robota (podnie�/upu��, strzelaj, szukaj, itp.)");
+ if ( num == EVENT_INTERFACE_KNEAR ) strcpy(text, "Kamera bli�ej\\Przybli�a kamer�");
+ if ( num == EVENT_INTERFACE_KAWAY ) strcpy(text, "Kamera dalej\\Oddala kamer�");
+ if ( num == EVENT_INTERFACE_KNEXT ) strcpy(text, "Nast�pny obiekt\\Zaznacza nast�pny obiekt");
+ if ( num == EVENT_INTERFACE_KHUMAN ) strcpy(text, "Zaznacz astronaut�\\Zaznacza astronaut�");
+ if ( num == EVENT_INTERFACE_KQUIT ) strcpy(text, "Zako�cz\\Ko�czy bie��c� misj� lub �wiczenie");
+ if ( num == EVENT_INTERFACE_KHELP ) strcpy(text, "Rozkazy\\Pokazuje rozkazy dotycz�ce bie��cej misji");
+ if ( num == EVENT_INTERFACE_KPROG ) strcpy(text, "Podr�cznik programowania\\Dostarcza szczeg�ow� pomoc w programowaniu");
+ if ( num == EVENT_INTERFACE_KCBOT ) strcpy(text, "Pomoc dot. s��w kluczowych\\Dok�adniejsza pomoc na temat s��w kluczowych");
+ if ( num == EVENT_INTERFACE_KVISIT ) strcpy(text, "Miejsce nadania wiadomo�ci\\Pokazuje sk�d zosta�a wys�ana ostatnia wiadomo��");
+ if ( num == EVENT_INTERFACE_KSPEED10) strcpy(text, "Pr�dko�� 1,0x\\Pr�dko�� normalna");
+ if ( num == EVENT_INTERFACE_KSPEED15) strcpy(text, "Pr�dko�� 1,5x\\1,5 raza szybciej");
+ if ( num == EVENT_INTERFACE_KSPEED20) strcpy(text, "Pr�dko�� 2,0x\\Dwa razy szybciej");
+ if ( num == EVENT_INTERFACE_KSPEED30) strcpy(text, "Pr�dko�� 3,0x\\Trzy razy szybciej");
+
+ if ( num == EVENT_INTERFACE_VOLSOUND) strcpy(text, "Efekty d�wi�kowe:\\G�o�no�� silnik�w, g�os�w, strza��w, itp.");
+ if ( num == EVENT_INTERFACE_VOLMUSIC) strcpy(text, "Muzyka w tle :\\G�o�no�� �cie�ek d�wi�kowych z p�yty CD");
+ if ( num == EVENT_INTERFACE_SOUND3D) strcpy(text, "D�wi�k 3D\\Przestrzenne pozycjonowanie d�wi�k�w");
+
+ if ( num == EVENT_INTERFACE_MIN ) strcpy(text, "Najni�sza\\Minimalna jako�� grafiki (najwy�sza cz�stotliwo�� od�wie�ania)");
+ if ( num == EVENT_INTERFACE_NORM ) strcpy(text, "Normalna\\Normalna jako�� grafiki");
+ if ( num == EVENT_INTERFACE_MAX ) strcpy(text, "Najwy�sza\\Maksymalna jako�� grafiki (najni�sza cz�stotliwo�� od�wie�ania)");
+
+ if ( num == EVENT_INTERFACE_SILENT ) strcpy(text, "Cisza\\Brak d�wi�k�w");
+ if ( num == EVENT_INTERFACE_NOISY ) strcpy(text, "Normalne\\Normalna g�o�no�� d�wi�k�w");
+
+ if ( num == EVENT_INTERFACE_JOYSTICK) strcpy(text, "U�ywaj joysticka\\Joystick lub klawiatura");
+ if ( num == EVENT_INTERFACE_SOLUCE ) strcpy(text, "Dost�p do rozwi�zania\\Pokazuje rozwi�zanie (szczeg�owe instrukcje dotycz�ce misji)");
+
+ if ( num == EVENT_INTERFACE_NEDIT ) strcpy(text, "\\Nowe imi� gracza");
+ if ( num == EVENT_INTERFACE_NOK ) strcpy(text, "OK\\Wybiera zaznaczonego gracza");
+ if ( num == EVENT_INTERFACE_NCANCEL) strcpy(text, "Anuluj\\Zachowuje bie��ce imi� gracza");
+ if ( num == EVENT_INTERFACE_NDELETE) strcpy(text, "Usu� gracza\\Usuwa gracza z listy");
+ if ( num == EVENT_INTERFACE_NLABEL ) strcpy(text, "Imi� gracza");
+
+ if ( num == EVENT_INTERFACE_IOWRITE) strcpy(text, "Zapisz\\Zapisuje bie��c� misj�");
+ if ( num == EVENT_INTERFACE_IOREAD ) strcpy(text, "Wczytaj\\Wczytuje zaznaczon� misj�");
+ if ( num == EVENT_INTERFACE_IOLIST ) strcpy(text, "Lista zapisanych misji");
+ if ( num == EVENT_INTERFACE_IOLABEL) strcpy(text, "Nazwa pliku:");
+ if ( num == EVENT_INTERFACE_IONAME ) strcpy(text, "Nazwa misji");
+ if ( num == EVENT_INTERFACE_IOIMAGE) strcpy(text, "Fotografia");
+ if ( num == EVENT_INTERFACE_IODELETE) strcpy(text, "Usu�\\Usuwa zaznaczony plik");
+
+ if ( num == EVENT_INTERFACE_PERSO ) strcpy(text, "Wygl�d\\Wybierz swoj� posta�");
+ if ( num == EVENT_INTERFACE_POK ) strcpy(text, "OK");
+ if ( num == EVENT_INTERFACE_PCANCEL) strcpy(text, "Anuluj");
+ if ( num == EVENT_INTERFACE_PDEF ) strcpy(text, "Standardowe\\Standardowe ustawienia wygl�du");
+ if ( num == EVENT_INTERFACE_PHEAD ) strcpy(text, "G�owa\\Twarz i w�osy");
+ if ( num == EVENT_INTERFACE_PBODY ) strcpy(text, "Skafander\\Skafander astronauty");
+ if ( num == EVENT_INTERFACE_PLROT ) strcpy(text, "\\Obr�� w lewo");
+ if ( num == EVENT_INTERFACE_PRROT ) strcpy(text, "\\Obr�� w prawo");
+ if ( num == EVENT_INTERFACE_PCRa ) strcpy(text, "Czerwony");
+ if ( num == EVENT_INTERFACE_PCGa ) strcpy(text, "Zielony");
+ if ( num == EVENT_INTERFACE_PCBa ) strcpy(text, "Niebieski");
+ if ( num == EVENT_INTERFACE_PCRb ) strcpy(text, "Czerwony");
+ if ( num == EVENT_INTERFACE_PCGb ) strcpy(text, "Zielony");
+ if ( num == EVENT_INTERFACE_PCBb ) strcpy(text, "Niebieski");
+ if ( num == EVENT_INTERFACE_PFACE1 ) strcpy(text, "\\Twarz 1");
+ if ( num == EVENT_INTERFACE_PFACE2 ) strcpy(text, "\\Twarz 4");
+ if ( num == EVENT_INTERFACE_PFACE3 ) strcpy(text, "\\Twarz 3");
+ if ( num == EVENT_INTERFACE_PFACE4 ) strcpy(text, "\\Twarz 2");
+ if ( num == EVENT_INTERFACE_PGLASS0) strcpy(text, "\\Bez okular�w");
+ if ( num == EVENT_INTERFACE_PGLASS1) strcpy(text, "\\Okulary 1");
+ if ( num == EVENT_INTERFACE_PGLASS2) strcpy(text, "\\Okulary 2");
+ if ( num == EVENT_INTERFACE_PGLASS3) strcpy(text, "\\Okulary 3");
+ if ( num == EVENT_INTERFACE_PGLASS4) strcpy(text, "\\Okulary 4");
+ if ( num == EVENT_INTERFACE_PGLASS5) strcpy(text, "\\Okulary 5");
+
+ if ( num == EVENT_OBJECT_DESELECT ) strcpy(text, "Poprzednie zaznaczenie (\\key desel;)");
+ if ( num == EVENT_OBJECT_LEFT ) strcpy(text, "Skr�� w lewo (\\key left;)");
+ if ( num == EVENT_OBJECT_RIGHT ) strcpy(text, "Skr�� w prawo (\\key right;)");
+ if ( num == EVENT_OBJECT_UP ) strcpy(text, "Naprz�d (\\key up;)");
+ if ( num == EVENT_OBJECT_DOWN ) strcpy(text, "Cofnij (\\key down;)");
+ if ( num == EVENT_OBJECT_GASUP ) strcpy(text, "G�ra (\\key gup;)");
+ if ( num == EVENT_OBJECT_GASDOWN ) strcpy(text, "D� (\\key gdown;)");
+ if ( num == EVENT_OBJECT_HTAKE ) strcpy(text, "Podnie� lub upu�� (\\key action;)");
+ if ( num == EVENT_OBJECT_MTAKE ) strcpy(text, "Podnie� lub upu�� (\\key action;)");
+ if ( num == EVENT_OBJECT_MFRONT ) strcpy(text, "..przed");
+ if ( num == EVENT_OBJECT_MBACK ) strcpy(text, "..za");
+ if ( num == EVENT_OBJECT_MPOWER ) strcpy(text, "..ogniwo elektryczne");
+ if ( num == EVENT_OBJECT_BHELP ) strcpy(text, "Rozkazy dotycz�ce misji (\\key help;)");
+ if ( num == EVENT_OBJECT_BTAKEOFF ) strcpy(text, "Odle�, aby zako�czy� misj�");
+ if ( num == EVENT_OBJECT_BDERRICK ) strcpy(text, "Zbuduj kopalni�");
+ if ( num == EVENT_OBJECT_BSTATION ) strcpy(text, "Zbuduj elektrowni�");
+ if ( num == EVENT_OBJECT_BFACTORY ) strcpy(text, "Zbuduj fabryk� robot�w");
+ if ( num == EVENT_OBJECT_BREPAIR ) strcpy(text, "Zbuduj warsztat");
+ if ( num == EVENT_OBJECT_BCONVERT ) strcpy(text, "Zbuduj hut�");
+ if ( num == EVENT_OBJECT_BTOWER ) strcpy(text, "Zbuduj wie�� obronn�");
+ if ( num == EVENT_OBJECT_BRESEARCH ) strcpy(text, "Zbuduj centrum badawcze");
+ if ( num == EVENT_OBJECT_BRADAR ) strcpy(text, "Zbuduj stacj� radarow�");
+ if ( num == EVENT_OBJECT_BENERGY ) strcpy(text, "Zbuduj fabryk� ogniw elektrycznych");
+ if ( num == EVENT_OBJECT_BLABO ) strcpy(text, "Zbuduj laboratorium");
+ if ( num == EVENT_OBJECT_BNUCLEAR ) strcpy(text, "Zbuduj elektrowni� atomow�");
+ if ( num == EVENT_OBJECT_BPARA ) strcpy(text, "Zbuduj odgromnik");
+ if ( num == EVENT_OBJECT_BINFO ) strcpy(text, "Zbuduj stacj� przeka�nikow�");
+ if ( num == EVENT_OBJECT_GFLAT ) strcpy(text, "Poka� czy teren jest p�aski");
+ if ( num == EVENT_OBJECT_FCREATE ) strcpy(text, "Postaw flag�");
+ if ( num == EVENT_OBJECT_FDELETE ) strcpy(text, "Usu� flag�");
+ if ( num == EVENT_OBJECT_FCOLORb ) strcpy(text, "\\Niebieskie flagi");
+ if ( num == EVENT_OBJECT_FCOLORr ) strcpy(text, "\\Czerwone flagi");
+ if ( num == EVENT_OBJECT_FCOLORg ) strcpy(text, "\\Zielone flagi");
+ if ( num == EVENT_OBJECT_FCOLORy ) strcpy(text, "\\��te flagi");
+ if ( num == EVENT_OBJECT_FCOLORv ) strcpy(text, "\\Fioletowe flagi");
+ if ( num == EVENT_OBJECT_FACTORYfa ) strcpy(text, "Zbuduj transporter lataj�cy");
+ if ( num == EVENT_OBJECT_FACTORYta ) strcpy(text, "Zbuduj transporter na g�sienicach");
+ if ( num == EVENT_OBJECT_FACTORYwa ) strcpy(text, "Zbuduj transporter na ko�ach");
+ if ( num == EVENT_OBJECT_FACTORYia ) strcpy(text, "Zbuduj transporter na nogach");
+ if ( num == EVENT_OBJECT_FACTORYfc ) strcpy(text, "Zbuduj dzia�o lataj�ce");
+ if ( num == EVENT_OBJECT_FACTORYtc ) strcpy(text, "Zbuduj dzia�o na g�sienicach");
+ if ( num == EVENT_OBJECT_FACTORYwc ) strcpy(text, "Zbuduj dzia�o na ko�ach");
+ if ( num == EVENT_OBJECT_FACTORYic ) strcpy(text, "Zbuduj dzia�o na nogach");
+ if ( num == EVENT_OBJECT_FACTORYfi ) strcpy(text, "Zbuduj lataj�ce dzia�o organiczne");
+ if ( num == EVENT_OBJECT_FACTORYti ) strcpy(text, "Zbuduj dzia�o organiczne na g�sienicach");
+ if ( num == EVENT_OBJECT_FACTORYwi ) strcpy(text, "Zbuduj dzia�o organiczne na ko�ach");
+ if ( num == EVENT_OBJECT_FACTORYii ) strcpy(text, "Zbuduj dzia�o organiczne na nogach");
+ if ( num == EVENT_OBJECT_FACTORYfs ) strcpy(text, "Zbuduj szperacz lataj�cy");
+ if ( num == EVENT_OBJECT_FACTORYts ) strcpy(text, "Zbuduj szperacz na g�sienicach");
+ if ( num == EVENT_OBJECT_FACTORYws ) strcpy(text, "Zbuduj szperacz na ko�ach");
+ if ( num == EVENT_OBJECT_FACTORYis ) strcpy(text, "Zbuduj szperacz na nogach");
+ if ( num == EVENT_OBJECT_FACTORYrt ) strcpy(text, "Zbuduj robota uderzacza");
+ if ( num == EVENT_OBJECT_FACTORYrc ) strcpy(text, "Zbuduj dzia�o fazowe");
+ if ( num == EVENT_OBJECT_FACTORYrr ) strcpy(text, "Zbuduj robota recyklera");
+ if ( num == EVENT_OBJECT_FACTORYrs ) strcpy(text, "Zbuduj robota os�aniajacza");
+ if ( num == EVENT_OBJECT_FACTORYsa ) strcpy(text, "Zbuduj robota nurka");
+ if ( num == EVENT_OBJECT_RTANK ) strcpy(text, "Rozpocznij prace badawcze nad transporterem na g�sienicach");
+ if ( num == EVENT_OBJECT_RFLY ) strcpy(text, "Rozpocznij prace badawcze nad transporterem lataj�cym");
+ if ( num == EVENT_OBJECT_RTHUMP ) strcpy(text, "Rozpocznij prace badawcze nad robotem uderzaczem");
+ if ( num == EVENT_OBJECT_RCANON ) strcpy(text, "Rozpocznij prace badawcze nad dzia�em");
+ if ( num == EVENT_OBJECT_RTOWER ) strcpy(text, "Rozpocznij prace badawcze nad wie�� obronn�");
+ if ( num == EVENT_OBJECT_RPHAZER ) strcpy(text, "Rozpocznij prace badawcze nad dzia�em fazowym");
+ if ( num == EVENT_OBJECT_RSHIELD ) strcpy(text, "Rozpocznij prace badawcze nad robotem os�aniaczem");
+ if ( num == EVENT_OBJECT_RATOMIC ) strcpy(text, "Rozpocznij prace badawcze nad energi� atomow�");
+ if ( num == EVENT_OBJECT_RiPAW ) strcpy(text, "Rozpocznij prace badawcze nad transporterem na nogach");
+ if ( num == EVENT_OBJECT_RiGUN ) strcpy(text, "Rozpocznij prace badawcze nad dzia�em organicznym");
+ if ( num == EVENT_OBJECT_RESET ) strcpy(text, "Powr�t do pocz�tku");
+ if ( num == EVENT_OBJECT_SEARCH ) strcpy(text, "Szukaj (\\key action;)");
+ if ( num == EVENT_OBJECT_TERRAFORM ) strcpy(text, "Uderz (\\key action;)");
+ if ( num == EVENT_OBJECT_FIRE ) strcpy(text, "Strzelaj (\\key action;)");
+ if ( num == EVENT_OBJECT_RECOVER ) strcpy(text, "Odzyskaj (\\key action;)");
+ if ( num == EVENT_OBJECT_BEGSHIELD ) strcpy(text, "Rozszerz os�on� (\\key action;)");
+ if ( num == EVENT_OBJECT_ENDSHIELD ) strcpy(text, "Wy��cz os�on� (\\key action;)");
+ if ( num == EVENT_OBJECT_DIMSHIELD ) strcpy(text, "Zasi�g os�ony");
+ if ( num == EVENT_OBJECT_PROGRUN ) strcpy(text, "Wykonaj zaznaczony program");
+ if ( num == EVENT_OBJECT_PROGEDIT ) strcpy(text, "Edytuj zaznaczony program");
+ if ( num == EVENT_OBJECT_INFOOK ) strcpy(text, "\\Prze��cz przeka�nik SatCom w stan gotowo�ci");
+ if ( num == EVENT_OBJECT_DELETE ) strcpy(text, "Zniszcz budynek");
+ if ( num == EVENT_OBJECT_GENERGY ) strcpy(text, "Poziom energii");
+ if ( num == EVENT_OBJECT_GSHIELD ) strcpy(text, "Poziom os�ony");
+ if ( num == EVENT_OBJECT_GRANGE ) strcpy(text, "Temperatura silnika");
+ if ( num == EVENT_OBJECT_GPROGRESS ) strcpy(text, "Wci�� pracuje...");
+ if ( num == EVENT_OBJECT_GRADAR ) strcpy(text, "Liczba wykrytych insekt�w");
+ if ( num == EVENT_OBJECT_GINFO ) strcpy(text, "Przes�ane informacje");
+ if ( num == EVENT_OBJECT_COMPASS ) strcpy(text, "Kompas");
+//? if ( num == EVENT_OBJECT_MAP ) strcpy(text, "Mapka");
+ if ( num == EVENT_OBJECT_MAPZOOM ) strcpy(text, "Powi�kszenie mapki");
+ if ( num == EVENT_OBJECT_CAMERA ) strcpy(text, "Kamera (\\key camera;)");
+ if ( num == EVENT_OBJECT_CAMERAleft) strcpy(text, "Camera to left");
+ if ( num == EVENT_OBJECT_CAMERAright) strcpy(text, "Camera to right");
+ if ( num == EVENT_OBJECT_CAMERAnear) strcpy(text, "Camera nearest");
+ if ( num == EVENT_OBJECT_CAMERAaway) strcpy(text, "Camera awayest");
+ if ( num == EVENT_OBJECT_HELP ) strcpy(text, "Pomoc na temat zaznaczonego obiektu");
+ if ( num == EVENT_OBJECT_SOLUCE ) strcpy(text, "Poka� rozwi�zanie");
+ if ( num == EVENT_OBJECT_SHORTCUT00) strcpy(text, "Prze��cz roboty <-> budynki");
+ if ( num == EVENT_OBJECT_LIMIT ) strcpy(text, "Poka� zasi�g");
+ if ( num == EVENT_OBJECT_PEN0 ) strcpy(text, "\\Rel�ve le crayon");
+ if ( num == EVENT_OBJECT_PEN1 ) strcpy(text, "\\Abaisse le crayon noir");
+ if ( num == EVENT_OBJECT_PEN2 ) strcpy(text, "\\Abaisse le crayon jaune");
+ if ( num == EVENT_OBJECT_PEN3 ) strcpy(text, "\\Abaisse le crayon orange");
+ if ( num == EVENT_OBJECT_PEN4 ) strcpy(text, "\\Abaisse le crayon rouge");
+ if ( num == EVENT_OBJECT_PEN5 ) strcpy(text, "\\Abaisse le crayon violet");
+ if ( num == EVENT_OBJECT_PEN6 ) strcpy(text, "\\Abaisse le crayon bleu");
+ if ( num == EVENT_OBJECT_PEN7 ) strcpy(text, "\\Abaisse le crayon vert");
+ if ( num == EVENT_OBJECT_PEN8 ) strcpy(text, "\\Abaisse le crayon brun");
+ if ( num == EVENT_OBJECT_REC ) strcpy(text, "\\D�marre l'enregistrement");
+ if ( num == EVENT_OBJECT_STOP ) strcpy(text, "\\Stoppe l'enregistrement");
+ if ( num == EVENT_DT_VISIT0 ||
+ num == EVENT_DT_VISIT1 ||
+ num == EVENT_DT_VISIT2 ||
+ num == EVENT_DT_VISIT3 ||
+ num == EVENT_DT_VISIT4 ) strcpy(text, "Poka� miejsce");
+ if ( num == EVENT_DT_END ) strcpy(text, "Kontynuuj");
+ if ( num == EVENT_CMD ) strcpy(text, "Linia polecenia");
+ if ( num == EVENT_SPEED ) strcpy(text, "Pr�dko�� gry");
+
+ if ( num == EVENT_HYPER_PREV ) strcpy(text, "Wstecz");
+ if ( num == EVENT_HYPER_NEXT ) strcpy(text, "Naprz�d");
+ if ( num == EVENT_HYPER_HOME ) strcpy(text, "Pocz�tek");
+ if ( num == EVENT_HYPER_COPY ) strcpy(text, "Kopiuj");
+ if ( num == EVENT_HYPER_SIZE1 ) strcpy(text, "Wielko�� 1");
+ if ( num == EVENT_HYPER_SIZE2 ) strcpy(text, "Wielko�� 2");
+ if ( num == EVENT_HYPER_SIZE3 ) strcpy(text, "Wielko�� 3");
+ if ( num == EVENT_HYPER_SIZE4 ) strcpy(text, "Wielko�� 4");
+ if ( num == EVENT_HYPER_SIZE5 ) strcpy(text, "Wielko�� 5");
+ if ( num == EVENT_SATCOM_HUSTON ) strcpy(text, "Rozkazy z Houston");
+#if _TEEN
+ if ( num == EVENT_SATCOM_SAT ) strcpy(text, "Raport z satelity");
+#else
+ if ( num == EVENT_SATCOM_SAT ) strcpy(text, "Raport z satelity");
+#endif
+ if ( num == EVENT_SATCOM_LOADING ) strcpy(text, "Program dostarczony z Houston");
+ if ( num == EVENT_SATCOM_OBJECT ) strcpy(text, "Lista obiekt�w");
+ if ( num == EVENT_SATCOM_PROG ) strcpy(text, "Podr�cznik programowania");
+ if ( num == EVENT_SATCOM_SOLUCE ) strcpy(text, "Rozwi�zanie");
+
+ if ( num == EVENT_STUDIO_OK ) strcpy(text, "OK\\Zamyka edytor programu i powraca do gry");
+ if ( num == EVENT_STUDIO_CANCEL ) strcpy(text, "Anuluj\\Pomija wszystkie zmiany");
+ if ( num == EVENT_STUDIO_NEW ) strcpy(text, "Nowy");
+ if ( num == EVENT_STUDIO_OPEN ) strcpy(text, "Otw�rz (Ctrl+O)");
+ if ( num == EVENT_STUDIO_SAVE ) strcpy(text, "Zapisz (Ctrl+S)");
+ if ( num == EVENT_STUDIO_UNDO ) strcpy(text, "Cofnij (Ctrl+Z)");
+ if ( num == EVENT_STUDIO_CUT ) strcpy(text, "Wytnij (Ctrl+X)");
+ if ( num == EVENT_STUDIO_COPY ) strcpy(text, "Kopiuj (Ctrl+C)");
+ if ( num == EVENT_STUDIO_PASTE ) strcpy(text, "Wklej (Ctrl+V)");
+ if ( num == EVENT_STUDIO_SIZE ) strcpy(text, "Wielko�� czcionki");
+ if ( num == EVENT_STUDIO_TOOL ) strcpy(text, "Rozkazy (\\key help;)");
+ if ( num == EVENT_STUDIO_HELP ) strcpy(text, "Podr�cznik programowania (\\key prog;)");
+ if ( num == EVENT_STUDIO_COMPILE ) strcpy(text, "Kompiluj");
+ if ( num == EVENT_STUDIO_RUN ) strcpy(text, "Wykonaj/Zatrzymaj");
+ if ( num == EVENT_STUDIO_REALTIME ) strcpy(text, "Pauza/Kontynuuj");
+ if ( num == EVENT_STUDIO_STEP ) strcpy(text, "Jeden krok");
+ }
+
+ if ( type == RES_OBJECT )
+ {
+ if ( num == OBJECT_PORTICO ) strcpy(text, "�uraw przesuwalny");
+ if ( num == OBJECT_BASE ) strcpy(text, "Statek kosmiczny");
+ if ( num == OBJECT_DERRICK ) strcpy(text, "Kopalnia");
+ if ( num == OBJECT_FACTORY ) strcpy(text, "Fabryka robot�w");
+ if ( num == OBJECT_REPAIR ) strcpy(text, "Warsztat");
+ if ( num == OBJECT_DESTROYER ) strcpy(text, "Destroyer");
+ if ( num == OBJECT_STATION ) strcpy(text, "Stacja energetyczna");
+ if ( num == OBJECT_CONVERT ) strcpy(text, "Przetop rud� na tytan");
+ if ( num == OBJECT_TOWER ) strcpy(text, "Wie�a obronna");
+ if ( num == OBJECT_NEST ) strcpy(text, "Gniazdo");
+ if ( num == OBJECT_RESEARCH ) strcpy(text, "Centrum badawcze");
+ if ( num == OBJECT_RADAR ) strcpy(text, "Stacja radarowa");
+ if ( num == OBJECT_INFO ) strcpy(text, "Stacja przeka�nikowa informacji");
+#if _TEEN
+ if ( num == OBJECT_ENERGY ) strcpy(text, "Fabryka ogniw elektrycznych");
+#else
+ if ( num == OBJECT_ENERGY ) strcpy(text, "Fabryka ogniw elektrycznych");
+#endif
+ if ( num == OBJECT_LABO ) strcpy(text, "Laboratorium");
+ if ( num == OBJECT_NUCLEAR ) strcpy(text, "Elektrownia atomowa");
+ if ( num == OBJECT_PARA ) strcpy(text, "Odgromnik");
+ if ( num == OBJECT_SAFE ) strcpy(text, "Skrytka");
+ if ( num == OBJECT_HUSTON ) strcpy(text, "Centrum Kontroli Misji w Houston");
+ if ( num == OBJECT_TARGET1 ) strcpy(text, "Cel");
+ if ( num == OBJECT_TARGET2 ) strcpy(text, "Cel");
+ if ( num == OBJECT_START ) strcpy(text, "Pocz�tek");
+ if ( num == OBJECT_END ) strcpy(text, "Koniec");
+ if ( num == OBJECT_STONE ) strcpy(text, "Ruda tytanu");
+ if ( num == OBJECT_URANIUM ) strcpy(text, "Ruda uranu");
+ if ( num == OBJECT_BULLET ) strcpy(text, "Materia organiczna");
+ if ( num == OBJECT_METAL ) strcpy(text, "Tytan");
+ if ( num == OBJECT_POWER ) strcpy(text, "Ogniwo elektryczne");
+ if ( num == OBJECT_ATOMIC ) strcpy(text, "Atomowe ogniwa elektryczne");
+ if ( num == OBJECT_BBOX ) strcpy(text, "Czarna skrzynka");
+ if ( num == OBJECT_KEYa ) strcpy(text, "Klucz A");
+ if ( num == OBJECT_KEYb ) strcpy(text, "Klucz B");
+ if ( num == OBJECT_KEYc ) strcpy(text, "Klucz C");
+ if ( num == OBJECT_KEYd ) strcpy(text, "Klucz D");
+ if ( num == OBJECT_TNT ) strcpy(text, "Materia�y wybuchowe");
+ if ( num == OBJECT_BOMB ) strcpy(text, "Mina");
+ if ( num == OBJECT_BAG ) strcpy(text, "Zestaw przetrwania");
+ if ( num == OBJECT_WAYPOINT ) strcpy(text, "Punkt kontrolny");
+ if ( num == OBJECT_FLAGb ) strcpy(text, "Niebieska flaga");
+ if ( num == OBJECT_FLAGr ) strcpy(text, "Czerwona flaga");
+ if ( num == OBJECT_FLAGg ) strcpy(text, "Zielona flaga");
+ if ( num == OBJECT_FLAGy ) strcpy(text, "��ta flaga");
+ if ( num == OBJECT_FLAGv ) strcpy(text, "Fioletowa flaga");
+ if ( num == OBJECT_MARKPOWER ) strcpy(text, "�r�d�o energii (miejsce na elektrowni�)");
+ if ( num == OBJECT_MARKURANIUM ) strcpy(text, "Z�o�e uranu (miejsce na kopalni�)");
+ if ( num == OBJECT_MARKKEYa ) strcpy(text, "Znaleziono klucz A (miejsce na kopalni�)");
+ if ( num == OBJECT_MARKKEYb ) strcpy(text, "Znaleziono klucz B (miejsce na kopalni�)");
+ if ( num == OBJECT_MARKKEYc ) strcpy(text, "Znaleziono klucz C (miejsce na kopalni�)");
+ if ( num == OBJECT_MARKKEYd ) strcpy(text, "Znaleziono klucz D (miejsce na kopalni�)");
+ if ( num == OBJECT_MARKSTONE ) strcpy(text, "Z�o�e tytanu (miejsce na kopalni�)");
+ if ( num == OBJECT_MOBILEft ) strcpy(text, "Robot treningowy");
+ if ( num == OBJECT_MOBILEtt ) strcpy(text, "Robot treningowy");
+ if ( num == OBJECT_MOBILEwt ) strcpy(text, "Robot treningowy");
+ if ( num == OBJECT_MOBILEit ) strcpy(text, "Robot treningowy");
+ if ( num == OBJECT_MOBILEfa ) strcpy(text, "Transporter lataj�cy");
+ if ( num == OBJECT_MOBILEta ) strcpy(text, "Transporter na g�sienicach");
+ if ( num == OBJECT_MOBILEwa ) strcpy(text, "Transporter na ko�ach");
+ if ( num == OBJECT_MOBILEia ) strcpy(text, "Transporter na nogach");
+ if ( num == OBJECT_MOBILEfc ) strcpy(text, "Dzia�o lataj�ce");
+ if ( num == OBJECT_MOBILEtc ) strcpy(text, "Dzia�o na g�sienicach");
+ if ( num == OBJECT_MOBILEwc ) strcpy(text, "Dzia�o na ko�ach");
+ if ( num == OBJECT_MOBILEic ) strcpy(text, "Dzia�o na nogach");
+ if ( num == OBJECT_MOBILEfi ) strcpy(text, "Lataj�ce dzia�o organiczne");
+ if ( num == OBJECT_MOBILEti ) strcpy(text, "Dzia�o organiczne na g�sienicach");
+ if ( num == OBJECT_MOBILEwi ) strcpy(text, "Dzia�o organiczne na ko�ach");
+ if ( num == OBJECT_MOBILEii ) strcpy(text, "Dzia�o organiczne na nogach");
+ if ( num == OBJECT_MOBILEfs ) strcpy(text, "Szperacz lataj�cy");
+ if ( num == OBJECT_MOBILEts ) strcpy(text, "Szperacz na g�sienicach");
+ if ( num == OBJECT_MOBILEws ) strcpy(text, "Szperacz na ko�ach");
+ if ( num == OBJECT_MOBILEis ) strcpy(text, "Szperacz na nogach");
+ if ( num == OBJECT_MOBILErt ) strcpy(text, "Uderzacz");
+ if ( num == OBJECT_MOBILErc ) strcpy(text, "Dzia�o fazowe");
+ if ( num == OBJECT_MOBILErr ) strcpy(text, "Recykler");
+ if ( num == OBJECT_MOBILErs ) strcpy(text, "Os�aniacz");
+ if ( num == OBJECT_MOBILEsa ) strcpy(text, "Robot nurek");
+ if ( num == OBJECT_MOBILEtg ) strcpy(text, "Robot cel");
+ if ( num == OBJECT_MOBILEdr ) strcpy(text, "Drawer bot");
+ if ( num == OBJECT_HUMAN ) strcpy(text, g_gamerName);
+ if ( num == OBJECT_TECH ) strcpy(text, "In�ynier");
+ if ( num == OBJECT_TOTO ) strcpy(text, "Robbie");
+ if ( num == OBJECT_MOTHER ) strcpy(text, "Kr�lowa Obcych");
+ if ( num == OBJECT_ANT ) strcpy(text, "Mr�wka");
+ if ( num == OBJECT_SPIDER ) strcpy(text, "Paj�k");
+ if ( num == OBJECT_BEE ) strcpy(text, "Osa");
+ if ( num == OBJECT_WORM ) strcpy(text, "Robal");
+ if ( num == OBJECT_EGG ) strcpy(text, "Jajo");
+ if ( num == OBJECT_RUINmobilew1 ) strcpy(text, "Wrak");
+ if ( num == OBJECT_RUINmobilew2 ) strcpy(text, "Wrak");
+ if ( num == OBJECT_RUINmobilet1 ) strcpy(text, "Wrak");
+ if ( num == OBJECT_RUINmobilet2 ) strcpy(text, "Wrak");
+ if ( num == OBJECT_RUINmobiler1 ) strcpy(text, "Wrak");
+ if ( num == OBJECT_RUINmobiler2 ) strcpy(text, "Wrak");
+ if ( num == OBJECT_RUINfactory ) strcpy(text, "Ruiny");
+ if ( num == OBJECT_RUINdoor ) strcpy(text, "Ruiny");
+ if ( num == OBJECT_RUINsupport ) strcpy(text, "Odpady");
+ if ( num == OBJECT_RUINradar ) strcpy(text, "Ruiny");
+ if ( num == OBJECT_RUINconvert ) strcpy(text, "Ruiny");
+ if ( num == OBJECT_RUINbase ) strcpy(text, "Ruiny statku kosmicznego");
+ if ( num == OBJECT_RUINhead ) strcpy(text, "Ruiny statku kosmicznego");
+ if ( num == OBJECT_APOLLO1 ||
+ num == OBJECT_APOLLO3 ||
+ num == OBJECT_APOLLO4 ||
+ num == OBJECT_APOLLO5 ) strcpy(text, "Pozosta�o�ci z misji Apollo");
+ if ( num == OBJECT_APOLLO2 ) strcpy(text, "Pojazd Ksi�ycowy");
+ }
+
+ if ( type == RES_ERR )
+ {
+ strcpy(text, "B��d");
+ if ( num == ERR_CMD ) strcpy(text, "Nieznane polecenie");
+#if _NEWLOOK
+ if ( num == ERR_INSTALL ) strcpy(text, "Gra CeeBot nie jest zainstalowana.");
+ if ( num == ERR_NOCD ) strcpy(text, "W�� dysk CD z gr� CeeBot\ni uruchom gr� jeszcze raz.");
+#else
+ if ( num == ERR_INSTALL ) strcpy(text, "Gra COLOBOT nie jest zainstalowana.");
+ if ( num == ERR_NOCD ) strcpy(text, "W�� dysk CD z gr� COLOBOT\ni uruchom gr� jeszcze raz.");
+#endif
+ if ( num == ERR_MANIP_VEH ) strcpy(text, "Nieodpowiedni robot");
+ if ( num == ERR_MANIP_FLY ) strcpy(text, "Niemo�liwe podczas lotu");
+ if ( num == ERR_MANIP_BUSY ) strcpy(text, "Nie mo�na nie�� wi�cej przedmiot�w");
+ if ( num == ERR_MANIP_NIL ) strcpy(text, "Nie ma nic do podniesienia");
+ if ( num == ERR_MANIP_MOTOR ) strcpy(text, "Niemo�liwe podczas ruchu");
+ if ( num == ERR_MANIP_OCC ) strcpy(text, "Miejsce zaj�te");
+ if ( num == ERR_MANIP_FRIEND ) strcpy(text, "Brak innego robota");
+ if ( num == ERR_MANIP_RADIO ) strcpy(text, "Nie mo�esz przenosi� przedmiot�w radioaktywnych");
+ if ( num == ERR_MANIP_WATER ) strcpy(text, "Nie mo�esz przenosi� przedmiot�w pod wod�");
+ if ( num == ERR_MANIP_EMPTY ) strcpy(text, "Nie ma nic do upuszczenia");
+ if ( num == ERR_BUILD_FLY ) strcpy(text, "Niemo�liwe podczas lotu");
+ if ( num == ERR_BUILD_WATER ) strcpy(text, "Niemo�liwe pod wod�");
+ if ( num == ERR_BUILD_ENERGY ) strcpy(text, "Za ma�o energii");
+ if ( num == ERR_BUILD_METALAWAY ) strcpy(text, "Tytan za daleko");
+ if ( num == ERR_BUILD_METALNEAR ) strcpy(text, "Tytan za blisko");
+ if ( num == ERR_BUILD_METALINEX ) strcpy(text, "Brak tytanu w pobli�u");
+ if ( num == ERR_BUILD_FLAT ) strcpy(text, "Powierzchnia nie jest wystarczaj�co p�aska");
+ if ( num == ERR_BUILD_FLATLIT ) strcpy(text, "Za ma�o p�askiego terenu");
+ if ( num == ERR_BUILD_BUSY ) strcpy(text, "Miejsce zaj�te");
+ if ( num == ERR_BUILD_BASE ) strcpy(text, "Za blisko statku kosmicznego");
+ if ( num == ERR_BUILD_NARROW ) strcpy(text, "Za blisko budynku");
+ if ( num == ERR_BUILD_MOTOR ) strcpy(text, "Niemo�liwe podczas ruchu");
+ if ( num == ERR_SEARCH_FLY ) strcpy(text, "Niemo�liwe podczas lotu");
+ if ( num == ERR_SEARCH_VEH ) strcpy(text, "Nieodpowiedni robot");
+ if ( num == ERR_SEARCH_MOTOR ) strcpy(text, "Niemo�liwe podczas ruchu");
+ if ( num == ERR_TERRA_VEH ) strcpy(text, "Nieodpowiedni robot");
+ if ( num == ERR_TERRA_ENERGY ) strcpy(text, "Za ma�o energii");
+ if ( num == ERR_TERRA_FLOOR ) strcpy(text, "Nieodpowiedni teren");
+ if ( num == ERR_TERRA_BUILDING ) strcpy(text, "Budynek za blisko");
+ if ( num == ERR_TERRA_OBJECT ) strcpy(text, "Obiekt za blisko");
+ if ( num == ERR_RECOVER_VEH ) strcpy(text, "Nieodpowiedni robot");
+ if ( num == ERR_RECOVER_ENERGY ) strcpy(text, "Za ma�o energii");
+ if ( num == ERR_RECOVER_NULL ) strcpy(text, "Nie ma niczego do odzysku");
+ if ( num == ERR_SHIELD_VEH ) strcpy(text, "Nieodpowiedni robot");
+ if ( num == ERR_SHIELD_ENERGY ) strcpy(text, "Nie ma wi�cej energii");
+ if ( num == ERR_MOVE_IMPOSSIBLE ) strcpy(text, "B��d w poleceniu ruchu");
+ if ( num == ERR_FIND_IMPOSSIBLE ) strcpy(text, "Obiekt nieznany");
+ if ( num == ERR_GOTO_IMPOSSIBLE ) strcpy(text, "Goto: miejsce docelowe niedost�pne");
+ if ( num == ERR_GOTO_ITER ) strcpy(text, "Goto: miejsce docelowe niedost�pne");
+ if ( num == ERR_GOTO_BUSY ) strcpy(text, "Goto: miejsce docelowe zaj�te");
+ if ( num == ERR_FIRE_VEH ) strcpy(text, "Nieodpowiedni robot");
+ if ( num == ERR_FIRE_ENERGY ) strcpy(text, "Za ma�o energii");
+ if ( num == ERR_FIRE_FLY ) strcpy(text, "Niemo�liwe podczas lotu");
+ if ( num == ERR_CONVERT_EMPTY ) strcpy(text, "Brak rudy tytanu do przetopienia");
+ if ( num == ERR_DERRICK_NULL ) strcpy(text, "W ziemi nie ma �adnej rudy");
+ if ( num == ERR_STATION_NULL ) strcpy(text, "Brak energii w ziemi");
+ if ( num == ERR_TOWER_POWER ) strcpy(text, "Brak ogniwa elektrycznego");
+ if ( num == ERR_TOWER_ENERGY ) strcpy(text, "Nie ma wi�cej energii");
+ if ( num == ERR_RESEARCH_POWER ) strcpy(text, "Brak ogniwa elektrycznego");
+ if ( num == ERR_RESEARCH_ENERGY ) strcpy(text, "Za ma�o energii");
+ if ( num == ERR_RESEARCH_TYPE ) strcpy(text, "Nieodpowiedni rodzaj ogniw");
+ if ( num == ERR_RESEARCH_ALREADY) strcpy(text, "Program badawczy zosta� ju� wykonany");
+ if ( num == ERR_ENERGY_NULL ) strcpy(text, "Brak energii w ziemi");
+ if ( num == ERR_ENERGY_LOW ) strcpy(text, "Wci�� za ma�o energii");
+ if ( num == ERR_ENERGY_EMPTY ) strcpy(text, "Brak tytanu do przetworzenia");
+ if ( num == ERR_ENERGY_BAD ) strcpy(text, "Przetwarza jedynie tytan");
+ if ( num == ERR_BASE_DLOCK ) strcpy(text, "Drzwi zablokowane przez robota lub inny obiekt ");
+ if ( num == ERR_BASE_DHUMAN ) strcpy(text, "Musisz by� na statku kosmicznym aby nim odlecie�");
+ if ( num == ERR_LABO_NULL ) strcpy(text, "Nie ma niczego do zanalizowania");
+ if ( num == ERR_LABO_BAD ) strcpy(text, "Analizuje jedynie materi� organiczn�");
+ if ( num == ERR_LABO_ALREADY ) strcpy(text, "Analiza zosta�a ju� wykonana");
+ if ( num == ERR_NUCLEAR_NULL ) strcpy(text, "Brak energii w ziemi");
+ if ( num == ERR_NUCLEAR_LOW ) strcpy(text, "Wci�� za ma�o energii");
+ if ( num == ERR_NUCLEAR_EMPTY ) strcpy(text, "Brak uranu do przetworzenia");
+ if ( num == ERR_NUCLEAR_BAD ) strcpy(text, "Przetwarza jedynie uran");
+ if ( num == ERR_FACTORY_NULL ) strcpy(text, "Brak tytanu");
+ if ( num == ERR_FACTORY_NEAR ) strcpy(text, "Obiekt za blisko");
+ if ( num == ERR_RESET_NEAR ) strcpy(text, "Miejsce zaj�te");
+ if ( num == ERR_INFO_NULL ) strcpy(text, "Nie ma �adnej stacji przeka�nikowej w zasi�gu");
+ if ( num == ERR_VEH_VIRUS ) strcpy(text, "Program zawirusowany");
+ if ( num == ERR_BAT_VIRUS ) strcpy(text, "Zainfekowane wirusem, chwilowo niesprawne");
+ if ( num == ERR_VEH_POWER ) strcpy(text, "Brak ogniwa elektrycznego");
+ if ( num == ERR_VEH_ENERGY ) strcpy(text, "Nie ma wi�cej energii");
+ if ( num == ERR_FLAG_FLY ) strcpy(text, "Niemo�liwe podczas lotu");
+ if ( num == ERR_FLAG_WATER ) strcpy(text, "Niemo�liwe podczas p�ywania");
+ if ( num == ERR_FLAG_MOTOR ) strcpy(text, "Niemo�liwe podczas ruchu");
+ if ( num == ERR_FLAG_BUSY ) strcpy(text, "Niemo�liwe podczas przenoszenia przedmiotu");
+ if ( num == ERR_FLAG_CREATE ) strcpy(text, "Za du�o flag w tym kolorze (maksymalnie 5)");
+ if ( num == ERR_FLAG_PROXY ) strcpy(text, "Za blisko istniej�cej flagi");
+ if ( num == ERR_FLAG_DELETE ) strcpy(text, "Nie ma flagi w pobli�u");
+ if ( num == ERR_MISSION_NOTERM ) strcpy(text, "Misja nie jest wype�niona (naci�nij \\key help; aby uzyska� szczeg�y)");
+ if ( num == ERR_DELETEMOBILE ) strcpy(text, "Robot zniszczony");
+ if ( num == ERR_DELETEBUILDING ) strcpy(text, "Budynek zniszczony");
+ if ( num == ERR_TOOMANY ) strcpy(text, "Nie mo�na tego utworzy�, za du�o obiekt�w");
+ if ( num == ERR_OBLIGATORYTOKEN ) strcpy(text, "It misses \"%s\" in this exercise");
+ if ( num == ERR_PROHIBITEDTOKEN ) strcpy(text, "Do not use in this exercise");
+
+ if ( num == INFO_BUILD ) strcpy(text, "Budowa zako�czona");
+ if ( num == INFO_CONVERT ) strcpy(text, "Tytan dost�pny");
+ if ( num == INFO_RESEARCH ) strcpy(text, "Program badawczy zako�czony");
+ if ( num == INFO_RESEARCHTANK ) strcpy(text, "Dost�pne plany tranporter�w na g�sienicach");
+ if ( num == INFO_RESEARCHFLY ) strcpy(text, "Mo�esz lata� u�ywaj�c klawiszy (\\key gup;) oraz (\\key gdown;)");
+ if ( num == INFO_RESEARCHTHUMP ) strcpy(text, "Dost�pne plany robota uderzacza");
+ if ( num == INFO_RESEARCHCANON ) strcpy(text, "Dost�pne plany dzia�a");
+ if ( num == INFO_RESEARCHTOWER ) strcpy(text, "Dost�pne plany wie�y obronnej");
+ if ( num == INFO_RESEARCHPHAZER ) strcpy(text, "Dost�pne plany dzia�a fazowego");
+ if ( num == INFO_RESEARCHSHIELD ) strcpy(text, "Dost�pne plany robota os�aniacza");
+ if ( num == INFO_RESEARCHATOMIC ) strcpy(text, "Dost�pne plany elektrowni atomowej");
+ if ( num == INFO_FACTORY ) strcpy(text, "Dost�pny nowy robot");
+ if ( num == INFO_LABO ) strcpy(text, "Analiza wykonana");
+ if ( num == INFO_ENERGY ) strcpy(text, "Wytworzono ogniwo elektryczne");
+ if ( num == INFO_NUCLEAR ) strcpy(text, "Wytworzono atomowe ogniwo elektryczne");
+ if ( num == INFO_FINDING ) strcpy(text, "Znaleziono u�yteczny przedmiot");
+ if ( num == INFO_MARKPOWER ) strcpy(text, "Znaleziono miejsce na elektrowni�");
+ if ( num == INFO_MARKURANIUM ) strcpy(text, "Znaleziono miejsce na kopalni�");
+ if ( num == INFO_MARKSTONE ) strcpy(text, "Znaleziono miejsce na kopalni�");
+ if ( num == INFO_MARKKEYa ) strcpy(text, "Znaleziono miejsce na kopalni�");
+ if ( num == INFO_MARKKEYb ) strcpy(text, "Znaleziono miejsce na kopalni�");
+ if ( num == INFO_MARKKEYc ) strcpy(text, "Znaleziono miejsce na kopalni�");
+ if ( num == INFO_MARKKEYd ) strcpy(text, "Znaleziono miejsce na kopalni�");
+ if ( num == INFO_WIN ) strcpy(text, "<<< Dobra robota, misja wype�niona >>>");
+ if ( num == INFO_LOST ) strcpy(text, "<<< Niestety, misja nie powiod�a si� >>>");
+ if ( num == INFO_LOSTq ) strcpy(text, "<<< Niestety, misja nie powiod�a si� >>>");
+ if ( num == INFO_WRITEOK ) strcpy(text, "Bie��ca misja zapisana");
+ if ( num == INFO_DELETEPATH ) strcpy(text, "Przekroczono punkt kontrolny");
+ if ( num == INFO_DELETEMOTHER ) strcpy(text, "Kr�lowa Obcych zosta�a zabita");
+ if ( num == INFO_DELETEANT ) strcpy(text, "Mr�wka �miertelnie raniona");
+ if ( num == INFO_DELETEBEE ) strcpy(text, "Osa �miertelnie raniona");
+ if ( num == INFO_DELETEWORM ) strcpy(text, "Robal �miertelnie raniony");
+ if ( num == INFO_DELETESPIDER ) strcpy(text, "Paj�k �miertelnie raniony");
+ if ( num == INFO_BEGINSATCOM ) strcpy(text, "Naci�nij klawisz \\key help; aby wy�wietli� rozkazy na przeka�niku SatCom");
+ }
+
+ if ( type == RES_CBOT )
+ {
+ strcpy(text, "B��d");
+ if ( num == TX_OPENPAR ) strcpy(text, "Brak nawiasu otwieraj�cego");
+ if ( num == TX_CLOSEPAR ) strcpy(text, "Brak nawiasu zamykaj�cego");
+ if ( num == TX_NOTBOOL ) strcpy(text, "Wyra�enie musi zwr�ci� warto�� logiczn�");
+ if ( num == TX_UNDEFVAR ) strcpy(text, "Zmienna nie zosta�a zadeklarowana");
+ if ( num == TX_BADLEFT ) strcpy(text, "Przypisanie niemo�liwe");
+ if ( num == TX_ENDOF ) strcpy(text, "Brak �rednika na ko�cu wiersza");
+ if ( num == TX_OUTCASE ) strcpy(text, "Polecenie ""case"" na zewn�trz bloku ""switch""");
+ if ( num == TX_NOTERM ) strcpy(text, "Polecenie po ko�cowej klamrze zamykaj�cej");
+ if ( num == TX_CLOSEBLK ) strcpy(text, "Brak ko�ca bloku");
+ if ( num == TX_ELSEWITHOUTIF ) strcpy(text, "Polecenie ""else"" bez wyst�pienia ""if"" ");
+ if ( num == TX_OPENBLK ) strcpy(text, "Brak klamry otwieraj�cej");//d�but d'un bloc attendu?
+ if ( num == TX_BADTYPE ) strcpy(text, "Z�y typ dla przypisania");
+ if ( num == TX_REDEFVAR ) strcpy(text, "Zmienna nie mo�e by� zadeklarowana dwukrotnie");
+ if ( num == TX_BAD2TYPE ) strcpy(text, "Niezgodne typy operator�w");
+ if ( num == TX_UNDEFCALL ) strcpy(text, "Funkcja nieznana");
+ if ( num == TX_MISDOTS ) strcpy(text, "Brak znaku "" : ");
+ if ( num == TX_WHILE ) strcpy(text, "Brak kluczowego s�owa ""while");
+ if ( num == TX_BREAK ) strcpy(text, "Polecenie ""break"" na zewn�trz p�tli");
+ if ( num == TX_LABEL ) strcpy(text, "Po etykiecie musi wyst�pi� ""for"", ""while"", ""do"" lub ""switch""");
+ if ( num == TX_NOLABEL ) strcpy(text, "Taka etykieta nie istnieje");// Cette �tiquette n'existe pas
+ if ( num == TX_NOCASE ) strcpy(text, "Brak polecenia ""case");
+ if ( num == TX_BADNUM ) strcpy(text, "Brak liczby");
+ if ( num == TX_VOID ) strcpy(text, "Pusty parametr");
+ if ( num == TX_NOTYP ) strcpy(text, "Brak deklaracji typu");
+ if ( num == TX_NOVAR ) strcpy(text, "Brak nazwy zmiennej");
+ if ( num == TX_NOFONC ) strcpy(text, "Brakuj�ca nazwa funkcji");
+ if ( num == TX_OVERPARAM ) strcpy(text, "Za du�o parametr�w");
+ if ( num == TX_REDEF ) strcpy(text, "Funkcja ju� istnieje");
+ if ( num == TX_LOWPARAM ) strcpy(text, "Brak wymaganego parametru");
+ if ( num == TX_BADPARAM ) strcpy(text, "Funkcja o tej nazwie nie akceptuje parametr�w tego typu");
+ if ( num == TX_NUMPARAM ) strcpy(text, "Funkcja o tej nazwie nie akceptuje takiej liczby parametr�w");
+ if ( num == TX_NOITEM ) strcpy(text, "To nie jest obiekt tej klasy");
+ if ( num == TX_DOT ) strcpy(text, "Ten obiekt nie jest cz�onkiem klasy");
+ if ( num == TX_NOCONST ) strcpy(text, "Brak odpowiedniego konstruktora");
+ if ( num == TX_REDEFCLASS ) strcpy(text, "Taka klasa ju� istnieje");
+ if ( num == TX_CLBRK ) strcpy(text, "Brak "" ] """);
+ if ( num == TX_RESERVED ) strcpy(text, "S�owo zarezerwowane j�zyka CBOT");
+ if ( num == TX_BADNEW ) strcpy(text, "Z�y argument dla funkcji ""new""");
+ if ( num == TX_OPBRK ) strcpy(text, "Oczekiwane "" [ """);
+ if ( num == TX_BADSTRING ) strcpy(text, "Brak �a�cucha");
+ if ( num == TX_BADINDEX ) strcpy(text, "Nieprawid�owy typ indeksu");
+ if ( num == TX_PRIVATE ) strcpy(text, "Element prywatny");
+ if ( num == TX_NOPUBLIC ) strcpy(text, "Wymagany publiczny");
+ if ( num == TX_DIVZERO ) strcpy(text, "Dzielenie przez zero");
+ if ( num == TX_NOTINIT ) strcpy(text, "Zmienna nie zosta�a zainicjalizowana");
+ if ( num == TX_BADTHROW ) strcpy(text, "Warto�� ujemna odrzucona przez ""throw""");//C'est quoi, �a?
+ if ( num == TX_NORETVAL ) strcpy(text, "Funkcja nie zwr�ci�a �adnej warto�ci ");
+ if ( num == TX_NORUN ) strcpy(text, "�adna funkcja nie dzia�a");
+ if ( num == TX_NOCALL ) strcpy(text, "Odwo�anie do nieznanej funkcji");
+ if ( num == TX_NOCLASS ) strcpy(text, "Taka klasa nie istnieje");
+ if ( num == TX_NULLPT ) strcpy(text, "Obiekt nieznany");
+ if ( num == TX_OPNAN ) strcpy(text, "Dzia�anie niemo�liwe z warto�ci� ""nan""");
+ if ( num == TX_OUTARRAY ) strcpy(text, "Dost�p poza tablic�");
+ if ( num == TX_STACKOVER ) strcpy(text, "Przepe�nienie stosu");
+ if ( num == TX_DELETEDPT ) strcpy(text, "Nieprawid�owy obiekt");
+ if ( num == TX_FILEOPEN ) strcpy(text, "Nie mo�na otworzy� pliku");
+ if ( num == TX_NOTOPEN ) strcpy(text, "Plik nie jest otwarty");
+ if ( num == TX_ERRREAD ) strcpy(text, "B��d odczytu");
+ if ( num == TX_ERRWRITE ) strcpy(text, "B��d zapisu");
+ }
+
+ if ( type == RES_KEY )
+ {
+ if ( num == 0 ) strcpy(text, "< brak >");
+ if ( num == SDLK_LEFT ) strcpy(text, "Strza�ka w lewo");
+ if ( num == SDLK_RIGHT ) strcpy(text, "Strza�ka w prawo");
+ if ( num == SDLK_UP ) strcpy(text, "Strza�ka w g�r�");
+ if ( num == SDLK_DOWN ) strcpy(text, "Strza�ka w d�");
+ if ( num == SDLK_CANCEL ) strcpy(text, "Ctrl-break");
+ if ( num == SDLK_BACK ) strcpy(text, "<--");
+ if ( num == SDLK_TAB ) strcpy(text, "Tab");
+ if ( num == SDLK_CLEAR ) strcpy(text, "Delete");
+ if ( num == SDLK_RETURN ) strcpy(text, "Enter");
+ if ( num == SDLK_SHIFT ) strcpy(text, "Shift");
+ if ( num == SDLK_CONTROL ) strcpy(text, "Ctrl");
+ if ( num == SDLK_MENU ) strcpy(text, "Alt");
+ if ( num == SDLK_PAUSE ) strcpy(text, "Pause");
+ if ( num == SDLK_CAPITAL ) strcpy(text, "Caps Lock");
+ if ( num == SDLK_ESCAPE ) strcpy(text, "Esc");
+ if ( num == SDLK_SPACE ) strcpy(text, "Spacja");
+ if ( num == SDLK_PRIOR ) strcpy(text, "Page Up");
+ if ( num == SDLK_NEXT ) strcpy(text, "Page Down");
+ if ( num == SDLK_END ) strcpy(text, "End");
+ if ( num == SDLK_HOME ) strcpy(text, "Home");
+ if ( num == SDLK_SELECT ) strcpy(text, "Zaznacz");
+ if ( num == SDLK_EXECUTE ) strcpy(text, "Wykonaj");
+ if ( num == SDLK_SNAPSHOT ) strcpy(text, "Print Scrn");
+ if ( num == SDLK_INSERT ) strcpy(text, "Insert");
+ if ( num == SDLK_DELETE ) strcpy(text, "Delete");
+ if ( num == SDLK_HELP ) strcpy(text, "Pomoc");
+ if ( num == SDLK_LWIN ) strcpy(text, "Lewy klawisz Windows");
+ if ( num == SDLK_RWIN ) strcpy(text, "Prawy klawisz Windows");
+ if ( num == SDLK_APPS ) strcpy(text, "Klawisz menu kontekstowego");
+ if ( num == SDLK_NUMPAD0 ) strcpy(text, "Klaw. Num. 0");
+ if ( num == SDLK_NUMPAD1 ) strcpy(text, "Klaw. Num. 1");
+ if ( num == SDLK_NUMPAD2 ) strcpy(text, "Klaw. Num. 2");
+ if ( num == SDLK_NUMPAD3 ) strcpy(text, "Klaw. Num. 3");
+ if ( num == SDLK_NUMPAD4 ) strcpy(text, "Klaw. Num. 4");
+ if ( num == SDLK_NUMPAD5 ) strcpy(text, "Klaw. Num. 5");
+ if ( num == SDLK_NUMPAD6 ) strcpy(text, "Klaw. Num. 6");
+ if ( num == SDLK_NUMPAD7 ) strcpy(text, "Klaw. Num. 7");
+ if ( num == SDLK_NUMPAD8 ) strcpy(text, "Klaw. Num. 8");
+ if ( num == SDLK_NUMPAD9 ) strcpy(text, "Klaw. Num. 9");
+ if ( num == SDLK_MULTIPLY ) strcpy(text, "Klaw. Num. *");
+ if ( num == SDLK_ADD ) strcpy(text, "Klaw. Num. +");
+ if ( num == SDLK_SEPARATOR ) strcpy(text, "Klaw. Num. separator");
+ if ( num == SDLK_SUBTRACT ) strcpy(text, "Klaw. Num. -");
+ if ( num == SDLK_DECIMAL ) strcpy(text, "Klaw. Num. .");
+ if ( num == SDLK_DIVIDE ) strcpy(text, "Klaw. Num. /");
+ if ( num == SDLK_F1 ) strcpy(text, "F1");
+ if ( num == SDLK_F2 ) strcpy(text, "F2");
+ if ( num == SDLK_F3 ) strcpy(text, "F3");
+ if ( num == SDLK_F4 ) strcpy(text, "F4");
+ if ( num == SDLK_F5 ) strcpy(text, "F5");
+ if ( num == SDLK_F6 ) strcpy(text, "F6");
+ if ( num == SDLK_F7 ) strcpy(text, "F7");
+ if ( num == SDLK_F8 ) strcpy(text, "F8");
+ if ( num == SDLK_F9 ) strcpy(text, "F9");
+ if ( num == SDLK_F10 ) strcpy(text, "F10");
+ if ( num == SDLK_F11 ) strcpy(text, "F11");
+ if ( num == SDLK_F12 ) strcpy(text, "F12");
+ if ( num == SDLK_F13 ) strcpy(text, "F13");
+ if ( num == SDLK_F14 ) strcpy(text, "F14");
+ if ( num == SDLK_F15 ) strcpy(text, "F15");
+ if ( num == SDLK_F16 ) strcpy(text, "F16");
+ if ( num == SDLK_F17 ) strcpy(text, "F17");
+ if ( num == SDLK_F18 ) strcpy(text, "F18");
+ if ( num == SDLK_F19 ) strcpy(text, "F19");
+ if ( num == SDLK_F20 ) strcpy(text, "F20");
+ if ( num == SDLK_NUMLOCK ) strcpy(text, "Num Lock");
+ if ( num == SDLK_SCROLL ) strcpy(text, "Scroll Lock");
+ if ( num == SDLK_ATTN ) strcpy(text, "Attn");
+ if ( num == SDLK_CRSEL ) strcpy(text, "CrSel");
+ if ( num == SDLK_EXSEL ) strcpy(text, "ExSel");
+ if ( num == SDLK_EREOF ) strcpy(text, "Erase EOF");
+ if ( num == SDLK_PLAY ) strcpy(text, "Graj");
+ if ( num == SDLK_ZOOM ) strcpy(text, "Powi�kszenie");
+ if ( num == SDLK_PA1 ) strcpy(text, "PA1");
+ if ( num == SDLK_OEM_CLEAR ) strcpy(text, "Wyczy��");
+ if ( num == SDLK_BUTTON1 ) strcpy(text, "Przycisk 1");
+ if ( num == SDLK_BUTTON2 ) strcpy(text, "Przycisk 2");
+ if ( num == SDLK_BUTTON3 ) strcpy(text, "Przycisk 3");
+ if ( num == SDLK_BUTTON4 ) strcpy(text, "Przycisk 4");
+ if ( num == SDLK_BUTTON5 ) strcpy(text, "Przycisk 5");
+ if ( num == SDLK_BUTTON6 ) strcpy(text, "Przycisk 6");
+ if ( num == SDLK_BUTTON7 ) strcpy(text, "Przycisk 7");
+ if ( num == SDLK_BUTTON8 ) strcpy(text, "Przycisk 8");
+ if ( num == SDLK_BUTTON9 ) strcpy(text, "Przycisk 9");
+ if ( num == SDLK_BUTTON10 ) strcpy(text, "Przycisk 10");
+ if ( num == SDLK_BUTTON11 ) strcpy(text, "Przycisk 11");
+ if ( num == SDLK_BUTTON12 ) strcpy(text, "Przycisk 12");
+ if ( num == SDLK_BUTTON13 ) strcpy(text, "Przycisk 13");
+ if ( num == SDLK_BUTTON14 ) strcpy(text, "Przycisk 14");
+ if ( num == SDLK_BUTTON15 ) strcpy(text, "Przycisk 15");
+ if ( num == SDLK_BUTTON16 ) strcpy(text, "Przycisk 16");
+ if ( num == SDLK_BUTTON17 ) strcpy(text, "Przycisk 17");
+ if ( num == SDLK_BUTTON18 ) strcpy(text, "Przycisk 18");
+ if ( num == SDLK_BUTTON19 ) strcpy(text, "Przycisk 19");
+ if ( num == SDLK_BUTTON20 ) strcpy(text, "Przycisk 20");
+ if ( num == SDLK_BUTTON21 ) strcpy(text, "Przycisk 21");
+ if ( num == SDLK_BUTTON22 ) strcpy(text, "Przycisk 22");
+ if ( num == SDLK_BUTTON23 ) strcpy(text, "Przycisk 23");
+ if ( num == SDLK_BUTTON24 ) strcpy(text, "Przycisk 24");
+ if ( num == SDLK_BUTTON25 ) strcpy(text, "Przycisk 25");
+ if ( num == SDLK_BUTTON26 ) strcpy(text, "Przycisk 26");
+ if ( num == SDLK_BUTTON27 ) strcpy(text, "Przycisk 27");
+ if ( num == SDLK_BUTTON28 ) strcpy(text, "Przycisk 28");
+ if ( num == SDLK_BUTTON29 ) strcpy(text, "Przycisk 29");
+ if ( num == SDLK_BUTTON30 ) strcpy(text, "Przycisk 30");
+ if ( num == SDLK_BUTTON31 ) strcpy(text, "Przycisk 31");
+ if ( num == SDLK_BUTTON32 ) strcpy(text, "Przycisk 32");
+ if ( num == SDLK_WHEELUP ) strcpy(text, "K�ko w g�r�");
+ if ( num == SDLK_WHEELDOWN ) strcpy(text, "K�ko w d�");
+ }
+#endif
+
+ return ( text[0] != 0 );
+}
+
+
diff --git a/src/common/restext.h b/src/common/restext.h
index 624803b..44bc6b4 100644
--- a/src/common/restext.h
+++ b/src/common/restext.h
@@ -18,38 +18,143 @@
#pragma once
-#include "common/restext_ids.h"
+//#include "graphics/engine/engine.h"
+#include "common/event.h"
+
+namespace Gfx
+{
+ class CEngine;
+}
-class CD3DEngine;
// Possible types of the text resources.
enum ResType
{
- RES_TEXT = 0, // RT_*
- RES_EVENT = 1, // EVENT_* (EventMsg)
- RES_OBJECT = 2, // OBJECT_* (ObjectType)
- RES_ERR = 3, // ERR_* (Error)
- RES_KEY = 4, // VK_* (keys)
- RES_CBOT = 5, // TX_* (cbot.dll)
+ RES_TEXT = 0, // RT_*
+ RES_EVENT = 1, // EVENT_* (EventType)
+ RES_OBJECT = 2, // OBJECT_* (ObjectType)
+ RES_ERR = 3, // ERR_* (Error)
+ RES_KEY = 4, // VK_* (keys)
+ RES_CBOT = 5, // TX_* (cbot.dll)
};
-extern void SetEngine(CD3DEngine *engine);
+// Resources of type RES_TEXT.
+
+enum ResTextType
+{
+ RT_VERSION_ID = 1,
+ RT_DISINFO_TITLE = 2,
+ RT_WINDOW_MAXIMIZED = 3,
+ RT_WINDOW_MINIMIZED = 4,
+ RT_WINDOW_STANDARD = 5,
+ RT_WINDOW_CLOSE = 6,
+
+ RT_STUDIO_TITLE = 10,
+ RT_SCRIPT_NEW = 20,
+ RT_NAME_DEFAULT = 21,
+ RT_IO_NEW = 22,
+ RT_KEY_OR = 23,
+
+ RT_TITLE_BASE = 40,
+ RT_TITLE_INIT = 41,
+ RT_TITLE_TRAINER = 42,
+ RT_TITLE_DEFI = 43,
+ RT_TITLE_MISSION = 44,
+ RT_TITLE_FREE = 45,
+ RT_TITLE_PROTO = 46,
+ RT_TITLE_SETUP = 47,
+ RT_TITLE_NAME = 48,
+ RT_TITLE_PERSO = 49,
+ RT_TITLE_WRITE = 50,
+ RT_TITLE_READ = 51,
+ RT_TITLE_USER = 52,
+ RT_TITLE_TEEN = 53,
+
+ RT_PLAY_CHAPt = 60,
+ RT_PLAY_CHAPd = 61,
+ RT_PLAY_CHAPm = 62,
+ RT_PLAY_CHAPf = 63,
+ RT_PLAY_CHAPp = 64,
+ RT_PLAY_LISTt = 65,
+ RT_PLAY_LISTd = 66,
+ RT_PLAY_LISTm = 67,
+ RT_PLAY_LISTf = 68,
+ RT_PLAY_LISTp = 69,
+ RT_PLAY_RESUME = 70,
+ RT_PLAY_CHAPu = 71,
+ RT_PLAY_LISTu = 72,
+ RT_PLAY_CHAPte = 73,
+ RT_PLAY_LISTk = 74,
+
+ RT_SETUP_DEVICE = 80,
+ RT_SETUP_MODE = 81,
+ RT_SETUP_KEY1 = 82,
+ RT_SETUP_KEY2 = 83,
+
+ RT_PERSO_FACE = 90,
+ RT_PERSO_GLASSES = 91,
+ RT_PERSO_HAIR = 92,
+ RT_PERSO_COMBI = 93,
+ RT_PERSO_BAND = 94,
+
+ RT_DIALOG_TITLE = 100,
+ RT_DIALOG_ABORT = 101,
+ RT_DIALOG_QUIT = 102,
+ RT_DIALOG_YES = 103,
+ RT_DIALOG_NO = 104,
+ RT_DIALOG_DELOBJ = 105,
+ RT_DIALOG_DELGAME = 106,
+ RT_DIALOG_YESDEL = 107,
+ RT_DIALOG_NODEL = 108,
+ RT_DIALOG_LOADING = 109,
+ RT_DIALOG_YESQUIT = 110,
+ RT_DIALOG_NOQUIT = 111,
+
+ RT_STUDIO_LISTTT = 120,
+ RT_STUDIO_COMPOK = 121,
+ RT_STUDIO_PROGSTOP = 122,
+
+ RT_SATCOM_LIST = 140,
+ RT_SATCOM_BOT = 141,
+ RT_SATCOM_BUILDING = 142,
+ RT_SATCOM_FRET = 143,
+ RT_SATCOM_ALIEN = 144,
+ RT_SATCOM_NULL = 145,
+ RT_SATCOM_ERROR1 = 146,
+ RT_SATCOM_ERROR2 = 147,
+
+ RT_IO_OPEN = 150,
+ RT_IO_SAVE = 151,
+ RT_IO_LIST = 152,
+ RT_IO_NAME = 153,
+ RT_IO_DIR = 154,
+ RT_IO_PRIVATE = 155,
+ RT_IO_PUBLIC = 156,
+
+ RT_GENERIC_DEV1 = 170,
+ RT_GENERIC_DEV2 = 171,
+ RT_GENERIC_EDIT1 = 172,
+ RT_GENERIC_EDIT2 = 173,
+
+ RT_INTERFACE_REC = 180,
+
+ RT_MESSAGE_WIN = 200,
+ RT_MESSAGE_LOST = 201,
+};
+
+
+static Gfx::CEngine* g_engine = 0;
+static char g_gamerName[100];
+
+extern void SetEngine(Gfx::CEngine *engine);
extern void SetGlobalGamerName(char *name);
extern bool SearchKey(char *cmd, KeyRank &key);
+extern void PutKeyName(char* dst, char* src);
extern bool GetResource(ResType type, int num, char* text);
+extern bool GetResourceBase(ResType type, int num, char* text);
+
-extern const char * const strings_text[];
-extern const char * const strings_event[];
-extern const char * const strings_object[];
-extern const char * const strings_err[];
-extern const char * const strings_cbot[];
-
-extern const int strings_text_len;
-extern const int strings_event_len;
-extern const int strings_object_len;
-extern const int strings_err_len;
-extern const int strings_cbot_len;
diff --git a/src/graphics/engine/camera.cpp b/src/graphics/engine/camera.cpp
index f077fff..78ab808 100644
--- a/src/graphics/engine/camera.cpp
+++ b/src/graphics/engine/camera.cpp
@@ -28,67 +28,6 @@
#include "object/object.h"
#include "physics/physics.h"
-
-// TODO temporary stubs for CObject and CPhysics
-
-void CObject::SetTransparency(float)
-{
-}
-
-CObject* CObject::GetFret()
-{
- return nullptr;
-}
-
-CObject* CObject::GetPower()
-{
- return nullptr;
-}
-
-CObject* CObject::GetTruck()
-{
- return nullptr;
-}
-
-ObjectType CObject::GetType()
-{
- return OBJECT_NULL;
-}
-
-void CObject::SetGunGoalH(float)
-{
-}
-
-void CObject::GetGlobalSphere(Math::Vector &pos, float &radius)
-{
-}
-
-float CObject::GetAngleY(int)
-{
- return 0.0f;
-}
-
-Math::Vector CObject::GetPosition(int)
-{
- return Math::Vector();
-}
-
-void CObject::SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV,
- Math::Vector &lookat, Math::Vector &upVec,
- Gfx::CameraType type)
-{
-}
-
-CPhysics* CObject::GetPhysics()
-{
- return nullptr;
-}
-
-bool CPhysics::GetLand()
-{
- return false;
-}
-
//! Changes the level of transparency of an object and objects transported (battery & cargo)
void SetTransparency(CObject* obj, float value)
{
diff --git a/src/object/brain.cpp b/src/object/brain.cpp
index ef55e73..e322a3d 100644
--- a/src/object/brain.cpp
+++ b/src/object/brain.cpp
@@ -15,55 +15,55 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
+// #include <stdio.h>
+//
#include "object/brain.h"
-
-#include "CBot/CBotDll.h"
-#include "common/struct.h"
-#include "math/geometry.h"
-#include "math/const.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
-#include "common/language.h"
-#include "common/global.h"
-#include "common/event.h"
+//
+// #include "CBot/CBotDll.h"
+// #include "common/struct.h"
+// #include "math/geometry.h"
+// #include "math/const.h"
+// #include "old/d3dengine.h"
+// #include "old/d3dmath.h"
+// #include "common/language.h"
+// #include "common/global.h"
+// #include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
-#include "common/restext.h"
-#include "old/math3d.h"
-#include "object/robotmain.h"
-#include "old/terrain.h"
-#include "old/water.h"
-#include "old/camera.h"
-#include "object/object.h"
-#include "physics/physics.h"
-#include "object/motion/motion.h"
-#include "object/motion/motionspider.h"
-#include "old/pyro.h"
+// #include "common/restext.h"
+// #include "old/math3d.h"
+// #include "object/robotmain.h"
+// #include "old/terrain.h"
+// #include "old/water.h"
+// #include "old/camera.h"
+// #include "object/object.h"
+// #include "physics/physics.h"
+// #include "object/motion/motion.h"
+// #include "object/motion/motionspider.h"
+// #include "old/pyro.h"
#include "object/task/taskmanager.h"
-#include "object/task/task.h"
-#include "object/task/taskmanip.h"
-#include "object/task/taskflag.h"
-#include "object/task/taskshield.h"
+// #include "object/task/task.h"
+// #include "object/task/taskmanip.h"
+// #include "object/task/taskflag.h"
+// #include "object/task/taskshield.h"
#include "script/script.h"
-#include "ui/studio.h"
-#include "ui/interface.h"
-#include "ui/button.h"
-#include "ui/color.h"
-#include "ui/edit.h"
-#include "ui/list.h"
-#include "ui/label.h"
-#include "ui/group.h"
-#include "ui/gauge.h"
+// #include "ui/studio.h"
+// #include "ui/interface.h"
+// #include "ui/button.h"
+// #include "ui/color.h"
+// #include "ui/edit.h"
+// #include "ui/list.h"
+// #include "ui/label.h"
+// #include "ui/group.h"
+// #include "ui/gauge.h"
#include "ui/slider.h"
-#include "ui/compass.h"
-#include "ui/target.h"
+// #include "ui/compass.h"
+// #include "ui/target.h"
#include "ui/window.h"
-#include "ui/displaytext.h"
-#include "old/text.h"
-#include "old/sound.h"
-#include "old/particule.h"
+// #include "ui/displaytext.h"
+// #include "old/text.h"
+#include "sound/sound.h"
+// #include "old/particule.h"
#include "script/cmdtoken.h"
@@ -82,20 +82,21 @@ CBrain::CBrain(CInstanceManager* iMan, CObject* object)
m_iMan->AddInstance(CLASS_BRAIN, this, 100);
m_object = object;
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN);
- m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
- m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
- m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE);
- m_displayText = (CDisplayText*)m_iMan->SearchInstance(CLASS_DISPLAYTEXT);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
- m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
+ m_engine = static_cast<Gfx::CEngine*>(m_iMan->SearchInstance(CLASS_ENGINE));
+ m_terrain = static_cast<Gfx::CTerrain*>(m_iMan->SearchInstance(CLASS_TERRAIN));
+ m_water = static_cast<Gfx::CWater*>(m_iMan->SearchInstance(CLASS_WATER));
+ m_camera = static_cast<Gfx::CCamera*>(m_iMan->SearchInstance(CLASS_CAMERA));
+ m_interface = static_cast<CInterface*>(m_iMan->SearchInstance(CLASS_INTERFACE));
+ m_displayText = static_cast<CDisplayText*>(m_iMan->SearchInstance(CLASS_DISPLAYTEXT));
+ m_main = static_cast<CRobotMain*>(m_iMan->SearchInstance(CLASS_MAIN));
+ m_sound = static_cast<CSoundInterface*>(m_iMan->SearchInstance(CLASS_SOUND));
+ m_particle = static_cast<CParticle*>(m_iMan->SearchInstance(CLASS_PARTICULE));
m_physics = 0;
m_motion = 0;
m_primaryTask = 0;
m_secondaryTask = 0;
- m_studio = 0;
+ // TODO uncoment when ui/studio will be implemented.
+ // m_studio = 0;
m_program = -1;
m_bActivity = true;
@@ -142,7 +143,8 @@ CBrain::~CBrain()
delete m_primaryTask;
delete m_secondaryTask;
- delete m_studio;
+ // TODO uncoment when ui/studio will be implemented.
+ // delete m_studio;
delete m_traceRecordBuffer;
m_iMan->DeleteInstance(CLASS_BRAIN, this);
}
@@ -169,7 +171,8 @@ void CBrain::DeleteObject(bool bAll)
}
}
- if ( m_studio != 0 ) // current edition?
+ // TODO uncoment when ui/studio will be implemented.
+ // if ( m_studio != 0 ) // current edition?
{
StopEditScript(true);
}
@@ -213,13 +216,13 @@ bool CBrain::Read(char *line)
bool CBrain::EventProcess(const Event &event)
{
- CWindow* pw;
- CControl* pc;
- CSlider* ps;
- EventMsg action;
- ObjectType type;
- Error err;
- float axeX, axeY, axeZ, factor;
+ Ui::CWindow* pw;
+ Ui::CControl* pc;
+ Ui::CSlider* ps;
+ Event action;
+ ObjectType type;
+ Error err;
+ float axeX, axeY, axeZ, factor;
type = m_object->RetType();
@@ -240,7 +243,7 @@ bool CBrain::EventProcess(const Event &event)
event.param == m_engine->RetKey(KEYRANK_ACTION, 1) ) &&
!m_main->RetEditLock() )
{
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = (Ui::CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
if ( pw != 0 )
{
pc = pw->SearchControl(m_defaultEnter);
@@ -270,10 +273,11 @@ bool CBrain::EventProcess(const Event &event)
EventFrame(event);
}
+ // TODO uncoment when ui/studio will be implemented.
if ( m_object->RetSelect() && // robot selected?
- m_studio != 0 ) // current issue?
+ /* m_studio != 0 */ ) // current issue?
{
- m_studio->EventProcess(event);
+ // m_studio->EventProcess(event);
if ( action == EVENT_OBJECT_PROGRUN )
{
@@ -591,10 +595,10 @@ bool CBrain::EventProcess(const Event &event)
if ( action == EVENT_OBJECT_DIMSHIELD )
{
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = (Ui::CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
if ( pw != 0 )
{
- ps = (CSlider*)pw->SearchControl(EVENT_OBJECT_DIMSHIELD);
+ ps = (Ui::CSlider*)pw->SearchControl(EVENT_OBJECT_DIMSHIELD);
if ( ps != 0 )
{
m_object->SetParam((ps->RetVisibleValue()-(RADIUS_SHIELD_MIN/g_unit))/((RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)/g_unit));
@@ -687,7 +691,7 @@ bool CBrain::EventProcess(const Event &event)
TraceRecordStart();
}
UpdateInterface();
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = (Ui::CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
if ( pw != 0 )
{
UpdateScript(pw);
@@ -701,7 +705,7 @@ bool CBrain::EventProcess(const Event &event)
TraceRecordStop();
}
UpdateInterface();
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = (Ui::CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
if ( pw != 0 )
{
UpdateScript(pw);
@@ -765,10 +769,11 @@ bool CBrain::EventFrame(const Event &event)
m_sound->Position(m_soundChannelAlarm, m_object->RetPosition(0));
}
- if ( m_studio != 0 ) // �urrent edition?
- {
- m_studio->EventProcess(event);
- }
+ // TODO uncoment when ui/studio will be implemented.
+ // if ( m_studio != 0 ) // current edition?
+ // {
+ // m_studio->EventProcess(event);
+ // }
UpdateInterface(event.rTime);
@@ -891,8 +896,9 @@ void CBrain::StartEditScript(int rank, char* name)
m_script[rank] = new CScript(m_iMan, m_object, &m_secondaryTask);
}
- m_studio = new CStudio(m_iMan);
- m_studio->StartEditScript(m_script[rank], name, rank);
+ // TODO uncoment when ui/studio will be implemented.
+ // m_studio = new CStudio(m_iMan);
+ // m_studio->StartEditScript(m_script[rank], name, rank);
}
// End of editing a program.
@@ -901,10 +907,11 @@ void CBrain::StopEditScript(bool bCancel)
{
if ( !bCancel ) SetActiveVirus(false);
- if ( !m_studio->StopEditScript(bCancel) ) return;
+ // TODO uncoment when ui/studio will be implemented.
+ // if ( !m_studio->StopEditScript(bCancel) ) return;
- delete m_studio;
- m_studio = 0;
+ // delete m_studio;
+ // m_studio = 0;
CreateInterface(true); // puts the control buttons
}
@@ -1209,7 +1216,7 @@ void CBrain::GroundFlat()
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 40.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGFLAT, 1.0f);
+ m_particle->CreateParticle(pos, speed, dim, PARTIGFLAT, 1.0f);
}
@@ -1227,17 +1234,17 @@ void CBrain::ColorFlag(int color)
bool CBrain::CreateInterface(bool bSelect)
{
ObjectType type;
- CWindow* pw;
+ Ui::CWindow* pw;
CButton* pb;
CColor* pc;
- CSlider* ps;
+ Ui::CSlider* ps;
CTarget* pt;
CLabel* pl;
Math::Point pos, dim, ddim;
float ox, oy, sx, sy;
char name[100];
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = (Ui::CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
if ( pw != 0 )
{
pw->Flush(); // destroys the window buttons
@@ -1253,7 +1260,7 @@ bool CBrain::CreateInterface(bool bSelect)
if ( !m_main->RetShowMap() ) dim.x = 640.0f/640.0f;
dim.y = 86.0f/480.0f;
m_interface->CreateWindows(pos, dim, 3, EVENT_WINDOW0);
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = (Ui::CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
if ( pw == 0 ) return false;
m_object->GetTooltipName(name);
@@ -1926,7 +1933,7 @@ bool CBrain::CreateInterface(bool bSelect)
void CBrain::UpdateInterface(float rTime)
{
- CWindow* pw;
+ Ui::CWindow* pw;
#if _TEEN
CButton* pb;
#endif
@@ -1956,7 +1963,7 @@ void CBrain::UpdateInterface(float rTime)
return;
}
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = (Ui::CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
if ( pw == 0 ) return;
pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GENERGY);
@@ -2130,9 +2137,9 @@ void CBrain::UpdateInterface(float rTime)
void CBrain::UpdateInterface()
{
ObjectType type;
- CWindow* pw;
+ Ui::CWindow* pw;
CButton* pb;
- CSlider* ps;
+ Ui::CSlider* ps;
#if _TEEN
CColor* pc;
int color;
@@ -2142,7 +2149,7 @@ void CBrain::UpdateInterface()
if ( !m_object->RetSelect() ) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = (Ui::CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
if ( pw == 0 ) return;
type = m_object->RetType();
@@ -2235,7 +2242,7 @@ void CBrain::UpdateInterface()
DefaultEnter (pw, EVENT_OBJECT_ENDSHIELD, false);
}
- ps = (CSlider*)pw->SearchControl(EVENT_OBJECT_DIMSHIELD);
+ ps = (Ui::CSlider*)pw->SearchControl(EVENT_OBJECT_DIMSHIELD);
if ( ps != 0 )
{
ps->SetVisibleValue((RADIUS_SHIELD_MIN/g_unit)+m_object->RetParam()*((RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)/g_unit));
@@ -2438,7 +2445,7 @@ void CBrain::UpdateInterface()
// Updates the list of programs.
-void CBrain::UpdateScript(CWindow *pw)
+void CBrain::UpdateScript(Ui::CWindow *pw)
{
CList* pl;
char name[100];
@@ -2488,10 +2495,10 @@ void CBrain::UpdateScript(CWindow *pw)
int CBrain::RetSelScript()
{
- CWindow* pw;
+ Ui::CWindow* pw;
CList* pl;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = (Ui::CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
if ( pw == 0 ) return -1;
pl = (CList*)pw->SearchControl(EVENT_OBJECT_PROGLIST);
@@ -2504,12 +2511,12 @@ int CBrain::RetSelScript()
void CBrain::BlinkScript(bool bEnable)
{
- CWindow* pw;
+ Ui::CWindow* pw;
CList* pl;
if ( !m_object->RetSelect() ) return; // robot not selected?
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = (Ui::CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
if ( pw == 0 ) return;
pl = (CList*)pw->SearchControl(EVENT_OBJECT_PROGLIST);
@@ -2520,9 +2527,9 @@ void CBrain::BlinkScript(bool bEnable)
// Check the status of a button interface.
-void CBrain::CheckInterface(CWindow *pw, EventMsg event, bool bState)
+void CBrain::CheckInterface(Ui::CWindow *pw, EventMsg event, bool bState)
{
- CControl* control;
+ Ui::CControl* control;
control = pw->SearchControl(event);
if ( control == 0 ) return;
@@ -2532,9 +2539,9 @@ void CBrain::CheckInterface(CWindow *pw, EventMsg event, bool bState)
// Changes the state of a button interface.
-void CBrain::EnableInterface(CWindow *pw, EventMsg event, bool bState)
+void CBrain::EnableInterface(Ui::CWindow *pw, EventMsg event, bool bState)
{
- CControl* control;
+ Ui::CControl* control;
control = pw->SearchControl(event);
if ( control == 0 ) return;
@@ -2544,9 +2551,9 @@ void CBrain::EnableInterface(CWindow *pw, EventMsg event, bool bState)
// Changes the state of a button on the interface.
-void CBrain::DeadInterface(CWindow *pw, EventMsg event, bool bState)
+void CBrain::DeadInterface(Ui::CWindow *pw, EventMsg event, bool bState)
{
- CControl* control;
+ Ui::CControl* control;
control = pw->SearchControl(event);
if ( control == 0 ) return;
@@ -2556,9 +2563,9 @@ void CBrain::DeadInterface(CWindow *pw, EventMsg event, bool bState)
// Change the default input state of a button interface.
-void CBrain::DefaultEnter(CWindow *pw, EventMsg event, bool bState)
+void CBrain::DefaultEnter(Ui::CWindow *pw, EventMsg event, bool bState)
{
- CControl* control;
+ Ui::CControl* control;
control = pw->SearchControl(event);
if ( control == 0 ) return;
@@ -2708,7 +2715,7 @@ bool CBrain::ReadSoluce(char* filename)
// Load a script with a text file.
-bool CBrain::ReadProgram(int rank, char* filename)
+bool CBrain::ReadProgram(int rank, const char* filename)
{
if ( m_script[rank] == 0 )
{
diff --git a/src/object/brain.h b/src/object/brain.h
index 0220ffc..b1ef9bc 100644
--- a/src/object/brain.h
+++ b/src/object/brain.h
@@ -19,7 +19,7 @@
#pragma once
-#include <stdio.h>
+// #include <stdio.h>
#include "common/misc.h"
#include "common/event.h"
@@ -30,10 +30,6 @@
class CInstanceManager;
-class CD3DEngine;
-class CTerrain;
-class CWater;
-class CCamera;
class CObject;
class CPhysics;
class CMotion;
@@ -44,8 +40,18 @@ class CDisplayText;
class CScript;
class CRobotMain;
class CStudio;
-class CSound;
-class CParticule;
+class CSoundInterface;
+class CParticle;
+
+namespace Gfx
+{
+
+class CEngine;
+class CTerrain;
+class CWater;
+class CCamera;
+
+} /* Gfx */
const int BRAINMAXSCRIPT = 10;
@@ -88,29 +94,29 @@ public:
bool IsBusy();
void SetActivity(bool bMode);
- bool RetActivity();
+ bool GetActivity();
bool IsProgram();
bool ProgramExist(int rank);
void RunProgram(int rank);
int FreeProgram();
- int RetProgram();
+ int GetProgram();
void StopProgram();
void StopTask();
bool IntroduceVirus();
void SetActiveVirus(bool bActive);
- bool RetActiveVirus();
+ bool GetActiveVirus();
void SetScriptRun(int rank);
- int RetScriptRun();
+ int GetScriptRun();
void SetScriptName(int rank, char *name);
- char* RetScriptName(int rank);
+ char* GetScriptName(int rank);
void SetSoluceName(char *name);
- char* RetSoluceName();
+ char* GetSoluceName();
bool ReadSoluce(char* filename);
- bool ReadProgram(int rank, char* filename);
- bool RetCompile(int rank);
+ bool ReadProgram(int rank, const char* filename);
+ bool GetCompile(int rank);
bool WriteProgram(int rank, char* filename);
bool ReadStack(FILE *file);
bool WriteStack(FILE *file);
@@ -144,13 +150,13 @@ protected:
void ColorFlag(int color);
void UpdateScript(CWindow *pw);
- int RetSelScript();
+ int GetSelScript();
void BlinkScript(bool bEnable);
- void CheckInterface(CWindow *pw, EventMsg event, bool bState);
- void EnableInterface(CWindow *pw, EventMsg event, bool bState);
- void DeadInterface(CWindow *pw, EventMsg event, bool bState);
- void DefaultEnter(CWindow *pw, EventMsg event, bool bState=true);
+ void CheckInterface(CWindow *pw, EventType event, bool bState);
+ void EnableInterface(CWindow *pw, EventType event, bool bState);
+ void DeadInterface(CWindow *pw, EventType event, bool bState);
+ void DefaultEnter(CWindow *pw, EventType event, bool bState=true);
void TraceRecordStart();
void TraceRecordFrame();
@@ -159,60 +165,60 @@ protected:
bool TraceRecordPut(char *buffer, int max, TraceOper oper, float param);
protected:
- CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CTerrain* m_terrain;
- CWater* m_water;
- CCamera* m_camera;
- CObject* m_object;
- CPhysics* m_physics;
- CMotion* m_motion;
- CInterface* m_interface;
- CDisplayText* m_displayText;
- CRobotMain* m_main;
- CStudio* m_studio;
- CSound* m_sound;
- CParticule* m_particule;
- CTaskManager* m_primaryTask;
- CTaskManager* m_secondaryTask;
-
- CScript* m_script[BRAINMAXSCRIPT];
- int m_selScript; // rank of the selected script
- int m_program; // rank of the executed program / ​​-1
- bool m_bActivity;
- bool m_bBurn;
- bool m_bActiveVirus;
-
- int m_scriptRun;
- char m_scriptName[BRAINMAXSCRIPT][50];
- char m_soluceName[50];
-
- EventMsg m_buttonAxe;
- EventMsg m_manipStyle;
- EventMsg m_defaultEnter;
- EventMsg m_interfaceEvent[100];
-
- CObject* m_antTarget;
- CObject* m_beeBullet;
- float m_beeBulletSpeed;
- Math::Vector m_startPos;
- float m_time;
- float m_burnTime;
- float m_lastUpdateTime;
- float m_lastHumanTime;
- float m_lastSpiderTime;
- float m_lastWormTime;
- float m_lastBulletTime;
- float m_lastAlarmTime;
- int m_soundChannelAlarm;
- int m_flagColor;
-
- bool m_bTraceRecord;
- TraceOper m_traceOper;
- Math::Vector m_tracePos;
- float m_traceAngle;
- int m_traceColor;
- int m_traceRecordIndex;
- TraceRecord* m_traceRecordBuffer;
+ CInstanceManager* m_iMan;
+ Gfx::CEngine* m_engine;
+ Gfx::CTerrain* m_terrain;
+ Gfx::CWater* m_water;
+ Gfx::CCamera* m_camera;
+ CObject* m_object;
+ CPhysics* m_physics;
+ CMotion* m_motion;
+ CInterface* m_interface;
+ CDisplayText* m_displayText;
+ CRobotMain* m_main;
+ CStudio* m_studio;
+ CSoundInterface* m_sound;
+ CParticle* m_particle;
+ CTaskManager* m_primaryTask;
+ CTaskManager* m_secondaryTask;
+
+ CScript* m_script[BRAINMAXSCRIPT];
+ int m_selScript; // rank of the selected script
+ int m_program; // rank of the executed program / ​​-1
+ bool m_bActivity;
+ bool m_bBurn;
+ bool m_bActiveVirus;
+
+ int m_scriptRun;
+ char m_scriptName[BRAINMAXSCRIPT][50];
+ char m_soluceName[50];
+
+ EventType m_buttonAxe;
+ EventType m_manipStyle;
+ EventType m_defaultEnter;
+ EventType m_interfaceEvent[100];
+
+ CObject* m_antTarget;
+ CObject* m_beeBullet;
+ float m_beeBulletSpeed;
+ Math::Vector m_startPos;
+ float m_time;
+ float m_burnTime;
+ float m_lastUpdateTime;
+ float m_lastHumanTime;
+ float m_lastSpiderTime;
+ float m_lastWormTime;
+ float m_lastBulletTime;
+ float m_lastAlarmTime;
+ int m_soundChannelAlarm;
+ int m_flagColor;
+
+ bool m_bTraceRecord;
+ TraceOper m_traceOper;
+ Math::Vector m_tracePos;
+ float m_traceAngle;
+ int m_traceColor;
+ int m_traceRecordIndex;
+ TraceRecord* m_traceRecordBuffer;
};
diff --git a/src/object/mainmovie.h b/src/object/mainmovie.h
index 23721fb..0c8d51c 100644
--- a/src/object/mainmovie.h
+++ b/src/object/mainmovie.h
@@ -25,13 +25,15 @@
class CInstanceManager;
class CEvent;
-class CD3DEngine;
class CInterface;
class CRobotMain;
class CCamera;
-class CSound;
-
+class CSoundInterface;
+namespace Gfx
+{
+ class CEngine;
+} /* Gfx */
enum MainMovieType
@@ -61,17 +63,17 @@ protected:
protected:
CInstanceManager* m_iMan;
- CEvent* m_event;
- CD3DEngine* m_engine;
- CInterface* m_interface;
- CRobotMain* m_main;
- CCamera* m_camera;
- CSound* m_sound;
-
- MainMovieType m_type;
- MainMovieType m_stopType;
- float m_speed;
- float m_progress;
+ CEvent* m_event;
+ Gfx::CEngine* m_engine;
+ CInterface* m_interface;
+ CRobotMain* m_main;
+ CCamera* m_camera;
+ CSoundInterface* m_sound;
+
+ MainMovieType m_type;
+ MainMovieType m_stopType;
+ float m_speed;
+ float m_progress;
Math::Vector m_initialEye;
Math::Vector m_initialLookat;
Math::Vector m_finalEye[2];
diff --git a/src/object/motion/motion.cpp b/src/object/motion/motion.cpp
index 6278627..6b22471 100644
--- a/src/object/motion/motion.cpp
+++ b/src/object/motion/motion.cpp
@@ -95,16 +95,16 @@ bool CMotion::EventProcess(const Event &event)
Math::Vector pos, dir;
float time;
- if ( m_object->RetType() != OBJECT_TOTO &&
- m_engine->RetPause() ) return true;
+ if ( m_object->GetType() != OBJECT_TOTO &&
+ m_engine->GetPause() ) return true;
if ( event.event != EVENT_FRAME ) return true;
m_progress += event.rTime*m_actionTime;
if ( m_progress > 1.0f ) m_progress = 1.0f; // (*)
- pos = m_object->RetPosition(0);
- if ( pos.y < m_water->RetLevel(m_object) ) // underwater?
+ pos = m_object->GetPosition(0);
+ if ( pos.y < m_water->GetLevel(m_object) ) // underwater?
{
time = event.rTime*3.0f; // everything is slower
}
@@ -113,19 +113,19 @@ bool CMotion::EventProcess(const Event &event)
time = event.rTime*10.0f;
}
- dir = m_object->RetLinVibration();
+ dir = m_object->GetLinVibration();
dir.x = Math::Smooth(dir.x, m_linVibration.x, time);
dir.y = Math::Smooth(dir.y, m_linVibration.y, time);
dir.z = Math::Smooth(dir.z, m_linVibration.z, time);
m_object->SetLinVibration(dir);
- dir = m_object->RetCirVibration();
+ dir = m_object->GetCirVibration();
dir.x = Math::Smooth(dir.x, m_cirVibration.x, time);
dir.y = Math::Smooth(dir.y, m_cirVibration.y, time);
dir.z = Math::Smooth(dir.z, m_cirVibration.z, time);
m_object->SetCirVibration(dir);
- dir = m_object->RetInclinaison();
+ dir = m_object->GetInclinaison();
dir.x = Math::Smooth(dir.x, m_inclinaison.x, time);
dir.y = Math::Smooth(dir.y, m_inclinaison.y, time);
dir.z = Math::Smooth(dir.z, m_inclinaison.z, time);
@@ -148,9 +148,9 @@ Error CMotion::SetAction(int action, float time)
return ERR_OK;
}
-// Returns the current action.
+// Geturns the current action.
-int CMotion::RetAction()
+int CMotion::GetAction()
{
return m_actionType;
}
@@ -163,7 +163,7 @@ bool CMotion::SetParam(int rank, float value)
return false;
}
-float CMotion::RetParam(int rank)
+float CMotion::GetParam(int rank)
{
return 0.0f;
}
@@ -208,7 +208,7 @@ void CMotion::SetLinVibration(Math::Vector dir)
m_linVibration = dir;
}
-Math::Vector CMotion::RetLinVibration()
+Math::Vector CMotion::GetLinVibration()
{
return m_linVibration;
}
@@ -220,7 +220,7 @@ void CMotion::SetCirVibration(Math::Vector dir)
m_cirVibration = dir;
}
-Math::Vector CMotion::RetCirVibration()
+Math::Vector CMotion::GetCirVibration()
{
return m_cirVibration;
}
@@ -232,7 +232,7 @@ void CMotion::SetInclinaison(Math::Vector dir)
m_inclinaison = dir;
}
-Math::Vector CMotion::RetInclinaison()
+Math::Vector CMotion::GetInclinaison()
{
return m_inclinaison;
}
diff --git a/src/object/motion/motion.h b/src/object/motion/motion.h
index 9828283..2ec5c5d 100644
--- a/src/object/motion/motion.h
+++ b/src/object/motion/motion.h
@@ -51,20 +51,20 @@ public:
virtual bool Create(Math::Vector pos, float angle, ObjectType type, float power);
virtual bool EventProcess(const Event &event);
virtual Error SetAction(int action, float time=0.2f);
- virtual int RetAction();
+ virtual int GetAction();
virtual bool SetParam(int rank, float value);
- virtual float RetParam(int rank);
+ virtual float GetParam(int rank);
virtual bool Write(char *line);
virtual bool Read(char *line);
virtual void SetLinVibration(Math::Vector dir);
- virtual Math::Vector RetLinVibration();
+ virtual Math::Vector GetLinVibration();
virtual void SetCirVibration(Math::Vector dir);
- virtual Math::Vector RetCirVibration();
+ virtual Math::Vector GetCirVibration();
virtual void SetInclinaison(Math::Vector dir);
- virtual Math::Vector RetInclinaison();
+ virtual Math::Vector GetInclinaison();
protected:
diff --git a/src/object/motion/motionvehicle.h b/src/object/motion/motionvehicle.h
index 5ca97cd..ca60c1e 100644
--- a/src/object/motion/motionvehicle.h
+++ b/src/object/motion/motionvehicle.h
@@ -33,11 +33,11 @@ public:
bool Create(Math::Vector pos, float angle, ObjectType type, float power);
bool EventProcess(const Event &event);
- bool RetTraceDown();
+ bool GetTraceDown();
void SetTraceDown(bool bDown);
- int RetTraceColor();
+ int GetTraceColor();
void SetTraceColor(int color);
- float RetTraceWidth();
+ float GetTraceWidth();
void SetTraceWidth(float width);
protected:
diff --git a/src/object/object.cpp b/src/object/object.cpp
index e2e52e5..c29e59b 100644
--- a/src/object/object.cpp
+++ b/src/object/object.cpp
@@ -17,76 +17,74 @@
// object.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
+//---------CBot
#include "CBot/CBotDll.h"
-#include "common/struct.h"
-#include "math/const.h"
-#include "math/geometry.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
-#include "old/d3dutil.h"
+
+//---------Common
#include "common/global.h"
-#include "common/event.h"
-#include "common/misc.h"
#include "common/iman.h"
#include "common/restext.h"
-#include "old/math3d.h"
-#include "object/mainmovie.h"
-#include "object/robotmain.h"
-#include "old/light.h"
-#include "old/terrain.h"
-#include "old/water.h"
-#include "old/blitz.h"
-#include "old/camera.h"
-#include "old/particule.h"
-#include "physics/physics.h"
-#include "object/brain.h"
-#include "object/motion/motion.h"
-#include "object/motion/motionhuman.h"
-#include "object/motion/motiontoto.h"
-#include "object/motion/motionvehicle.h"
-#include "object/motion/motionmother.h"
-#include "object/motion/motionant.h"
-#include "object/motion/motionspider.h"
-#include "object/motion/motionbee.h"
-#include "object/motion/motionworm.h"
-#include "old/modfile.h"
+
+//---------Graphic
+#include "graphics/engine/lightman.h"
+#include "graphics/engine/lightning.h"
+#include "graphics/engine/modelfile.h"
+#include "graphics/engine/particle.h"
+#include "graphics/engine/pyro.h"
+#include "graphics/engine/terrain.h"
+
+//---------Math
+#include "math/geometry.h"
+
+//---------Object
#include "object/auto/auto.h"
#include "object/auto/autobase.h"
-#include "object/auto/autoportico.h"
+#include "object/auto/autoconvert.h"
#include "object/auto/autoderrick.h"
-#include "object/auto/autofactory.h"
-#include "object/auto/autorepair.h"
#include "object/auto/autodestroyer.h"
-#include "object/auto/autostation.h"
-#include "object/auto/autoenergy.h"
-#include "object/auto/autoconvert.h"
-#include "object/auto/autotower.h"
-#include "object/auto/autoresearch.h"
-#include "object/auto/autolabo.h"
-#include "object/auto/autonuclear.h"
-#include "object/auto/autoradar.h"
#include "object/auto/autoegg.h"
-#include "object/auto/autonest.h"
-#include "object/auto/autoroot.h"
+#include "object/auto/autoenergy.h"
+#include "object/auto/autofactory.h"
#include "object/auto/autoflag.h"
+#include "object/auto/autohuston.h"
#include "object/auto/autoinfo.h"
#include "object/auto/autojostle.h"
+#include "object/auto/autokid.h"
+#include "object/auto/autolabo.h"
+#include "object/auto/automush.h"
+#include "object/auto/autonest.h"
+#include "object/auto/autonuclear.h"
#include "object/auto/autopara.h"
+#include "object/auto/autoportico.h"
+#include "object/auto/autoradar.h"
+#include "object/auto/autorepair.h"
+#include "object/auto/autoresearch.h"
+#include "object/auto/autoroot.h"
#include "object/auto/autosafe.h"
-#include "object/auto/autohuston.h"
-#include "object/auto/automush.h"
-#include "object/auto/autokid.h"
-#include "object/task/task.h"
-#include "old/pyro.h"
-#include "ui/displaytext.h"
-#include "script/cmdtoken.h"
-#include "script/cbottoken.h"
-#include "old/sound.h"
+#include "object/auto/autostation.h"
+#include "object/auto/autotower.h"
+#include "object/brain.h"
+#include "object/motion/motion.h"
+#include "object/motion/motionant.h"
+#include "object/motion/motionbee.h"
+#include "object/motion/motionhuman.h"
+#include "object/motion/motionmother.h"
+#include "object/motion/motionspider.h"
+#include "object/motion/motiontoto.h"
+#include "object/motion/motionvehicle.h"
+#include "object/motion/motionworm.h"
#include "object/object.h"
+#include "object/robotmain.h"
+
+//---------Physics
+#include "physics/physics.h"
+
+//---------Script
+#include "script/cbottoken.h"
+#include "script/cmdtoken.h"
+
+//---------Ui
+#include "ui/displaytext.h"
@@ -116,7 +114,7 @@ static float debug_arm3 = 0.0f;
void uObject(CBotVar* botThis, void* user)
{
- CObject* object = (CObject*)user;
+ CObject* object = static_cast<CObject*>(user);
CObject* power;
CObject* fret;
CPhysics* physics;
@@ -128,19 +126,19 @@ void uObject(CBotVar* botThis, void* user)
if ( object == 0 ) return;
- physics = object->RetPhysics();
+ physics = object->GetPhysics();
// Updates the object's type.
pVar = botThis->GetItemList(); // "category"
- type = object->RetType();
- pVar->SetValInt(type, object->RetName());
+ type = object->GetType();
+ pVar->SetValInt(type, object->GetName());
// Updates the position of the object.
pVar = pVar->GetNext(); // "position"
- if ( object->RetTruck() == 0 )
+ if ( object->GetTruck() == 0 )
{
- pos = object->RetPosition(0);
- pos.y -= object->RetWaterLevel(); // relative to sea level!
+ pos = object->GetPosition(0);
+ pos.y -= object->GetWaterLevel(); // relative to sea level!
pSub = pVar->GetItemList(); // "x"
pSub->SetValFloat(pos.x/g_unit);
pSub = pSub->GetNext(); // "y"
@@ -159,8 +157,8 @@ void uObject(CBotVar* botThis, void* user)
}
// Updates the angle.
- pos = object->RetAngle(0);
- pos += object->RetInclinaison();
+ pos = object->GetAngle(0);
+ pos += object->GetInclinaison();
pVar = pVar->GetNext(); // "orientation"
pVar->SetValFloat(360.0f-Math::Mod(pos.y*180.0f/Math::PI, 360.0f));
pVar = pVar->GetNext(); // "pitch"
@@ -170,47 +168,47 @@ void uObject(CBotVar* botThis, void* user)
// Updates the energy level of the object.
pVar = pVar->GetNext(); // "energyLevel"
- value = object->RetEnergy();
+ value = object->GetEnergy();
pVar->SetValFloat(value);
// Updates the shield level of the object.
pVar = pVar->GetNext(); // "shieldLevel"
- value = object->RetShield();
+ value = object->GetShield();
pVar->SetValFloat(value);
// Updates the temperature of the reactor.
pVar = pVar->GetNext(); // "temperature"
if ( physics == 0 ) value = 0.0f;
- else value = 1.0f-physics->RetReactorRange();
+ else value = 1.0f-physics->GetReactorRange();
pVar->SetValFloat(value);
// Updates the height above the ground.
pVar = pVar->GetNext(); // "altitude"
if ( physics == 0 ) value = 0.0f;
- else value = physics->RetFloorHeight();
+ else value = physics->GetFloorHeight();
pVar->SetValFloat(value/g_unit);
// Updates the lifetime of the object.
pVar = pVar->GetNext(); // "lifeTime"
- value = object->RetAbsTime();
+ value = object->GetAbsTime();
pVar->SetValFloat(value);
// Updates the material of the object.
pVar = pVar->GetNext(); // "material"
- iValue = object->RetMaterial();
+ iValue = object->GetMaterial();
pVar->SetValInt(iValue);
// Updates the type of battery.
pVar = pVar->GetNext(); // "energyCell"
- power = object->RetPower();
+ power = object->GetPower();
if ( power == 0 ) pVar->SetPointer(0);
- else pVar->SetPointer(power->RetBotVar());
+ else pVar->SetPointer(power->GetBotVar());
// Updates the transported object's type.
pVar = pVar->GetNext(); // "load"
- fret = object->RetFret();
+ fret = object->GetFret();
if ( fret == 0 ) pVar->SetPointer(0);
- else pVar->SetPointer(fret->RetBotVar());
+ else pVar->SetPointer(fret->GetBotVar());
}
@@ -225,15 +223,15 @@ CObject::CObject(CInstanceManager* iMan)
m_iMan = iMan;
m_iMan->AddInstance(CLASS_OBJECT, this, 500);
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_light = (CLight*)m_iMan->SearchInstance(CLASS_LIGHT);
- m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN);
- m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
- m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
- m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
- m_displayText = (CDisplayText*)m_iMan->SearchInstance(CLASS_DISPLAYTEXT);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
+ m_engine = static_cast<Gfx::CEngine*>(m_iMan->SearchInstance(CLASS_ENGINE));
+ m_lightMan = static_cast<Gfx::CLightManager*>(m_iMan->SearchInstance(CLASS_LIGHT));
+ m_terrain = static_cast<Gfx::CTerrain*>(m_iMan->SearchInstance(CLASS_TERRAIN));
+ m_water = static_cast<Gfx::CWater*>(m_iMan->SearchInstance(CLASS_WATER));
+ m_particle = static_cast<Gfx::CParticle*>(m_iMan->SearchInstance(CLASS_PARTICULE));
+ m_camera = static_cast<Gfx::CCamera*>(m_iMan->SearchInstance(CLASS_CAMERA));
+ m_displayText = static_cast<Ui::CDisplayText*>(m_iMan->SearchInstance(CLASS_DISPLAYTEXT));
+ m_main = static_cast<CRobotMain*>(m_iMan->SearchInstance(CLASS_MAIN));
+ m_sound = static_cast<CSoundInterface*>(m_iMan->SearchInstance(CLASS_SOUND));
m_physics = 0;
m_brain = 0;
m_motion = 0;
@@ -250,7 +248,7 @@ CObject::CObject(CInstanceManager* iMan)
m_linVibration = Math::Vector(0.0f, 0.0f, 0.0f);
m_cirVibration = Math::Vector(0.0f, 0.0f, 0.0f);
m_inclinaison = Math::Vector(0.0f, 0.0f, 0.0f);
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_power = 0;
m_fret = 0;
@@ -281,7 +279,7 @@ CObject::CObject(CInstanceManager* iMan)
m_shotTime = 0.0f;
m_bVirusMode = false;
m_virusTime = 0.0f;
- m_lastVirusParticule = 0.0f;
+ m_lastVirusParticle = 0.0f;
m_totalDesectList = 0;
m_bLock = false;
m_bExplo = false;
@@ -297,7 +295,7 @@ CObject::CObject(CInstanceManager* iMan)
m_proxyDistance = 60.0f;
m_param = 0.0f;
- ZeroMemory(&m_character, sizeof(Character));
+ memset(&m_character, 0, sizeof(m_character));
m_character.wheelFront = 1.0f;
m_character.wheelBack = 1.0f;
m_character.wheelLeft = 1.0f;
@@ -309,7 +307,7 @@ CObject::CObject(CInstanceManager* iMan)
m_resetAngle = Math::Vector(0.0f, 0.0f, 0.0f);
m_resetRun = -1;
- m_cameraType = CAMERA_BACK;
+ m_cameraType = Gfx::CAM_TYPE_BACK;
m_cameraDist = 50.0f;
m_bCameraLock = false;
@@ -376,7 +374,7 @@ CObject::~CObject()
void CObject::DeleteObject(bool bAll)
{
CObject* pObj;
- CPyro* pPyro;
+ Gfx::CPyro* pPyro;
int i;
if ( m_botVar != 0 )
@@ -384,14 +382,14 @@ void CObject::DeleteObject(bool bAll)
m_botVar->SetUserPtr(OBJECTDELETED);
}
- if ( m_camera->RetObject() == this )
+ if ( m_camera->GetObject() == this )
{
m_camera->SetObject(0);
}
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
pObj->DeleteDeselList(this);
@@ -400,29 +398,29 @@ void CObject::DeleteObject(bool bAll)
if ( !bAll )
{
#if 0
- type = m_camera->RetType();
- if ( (type == CAMERA_BACK ||
- type == CAMERA_FIX ||
- type == CAMERA_EXPLO ||
- type == CAMERA_ONBOARD) &&
- m_camera->RetObject() == this )
+ type = m_camera->GetType();
+ if ( (type == Gfx::CAM_TYPE_BACK ||
+ type == Gfx::CAM_TYPE_FIX ||
+ type == Gfx::CAM_TYPE_EXPLO ||
+ type == Gfx::CAM_TYPE_ONBOARD) &&
+ m_camera->GetObject() == this )
{
- pObj = m_main->SearchNearest(RetPosition(0), this);
+ pObj = m_main->SearchNearest(GetPosition(0), this);
if ( pObj == 0 )
{
m_camera->SetObject(0);
- m_camera->SetType(CAMERA_FREE);
+ m_camera->SetType(Gfx::CAM_TYPE_FREE);
}
else
{
m_camera->SetObject(pObj);
- m_camera->SetType(CAMERA_BACK);
+ m_camera->SetType(Gfx::CAM_TYPE_BACK);
}
}
#endif
for ( i=0 ; i<1000000 ; i++ )
{
- pPyro = (CPyro*)m_iMan->SearchInstance(CLASS_PYRO, i);
+ pPyro = static_cast<Gfx::CPyro*>(m_iMan->SearchInstance(CLASS_PYRO, i));
if ( pPyro == 0 ) break;
pPyro->CutObjectLink(this); // the object no longer exists
@@ -453,7 +451,7 @@ void CObject::DeleteObject(bool bAll)
m_type == OBJECT_START ||
m_type == OBJECT_END ) // building?
{
- m_terrain->DeleteBuildingLevel(RetPosition(0)); // flattens the field
+ m_terrain->DeleteBuildingLevel(GetPosition(0)); // flattens the field
}
}
@@ -461,19 +459,19 @@ void CObject::DeleteObject(bool bAll)
if ( m_partiReactor != -1 )
{
- m_particule->DeleteParticule(m_partiReactor);
+ m_particle->DeleteParticle(m_partiReactor);
m_partiReactor = -1;
}
if ( m_shadowLight != -1 )
{
- m_light->DeleteLight(m_shadowLight);
+ m_lightMan->DeleteLight(m_shadowLight);
m_shadowLight = -1;
}
if ( m_effectLight != -1 )
{
- m_light->DeleteLight(m_effectLight);
+ m_lightMan->DeleteLight(m_effectLight);
m_effectLight = -1;
}
@@ -506,7 +504,7 @@ void CObject::DeleteObject(bool bAll)
if ( m_objectPart[i].masterParti != -1 )
{
- m_particule->DeleteParticule(m_objectPart[i].masterParti);
+ m_particle->DeleteParticle(m_objectPart[i].masterParti);
m_objectPart[i].masterParti = -1;
}
}
@@ -569,8 +567,8 @@ void CObject::Simplify()
bool CObject::ExploObject(ExploType type, float force, float decay)
{
- PyroType pyroType;
- CPyro* pyro;
+ Gfx::PyroType pyroType;
+ Gfx::CPyro* pyro;
float loss, shield;
if ( type == EXPLO_BURN )
@@ -627,7 +625,7 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
loss *= decay;
// Decreases the power of the shield.
- shield = RetShield();
+ shield = GetShield();
shield -= loss;
if ( shield < 0.0f ) shield = 0.0f;
SetShield(shield);
@@ -638,26 +636,26 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
{
if ( m_type == OBJECT_HUMAN )
{
- pyroType = PT_SHOTH;
+ pyroType = Gfx::PT_SHOTH;
}
else
{
- pyroType = PT_SHOTW;
+ pyroType = Gfx::PT_SHOTW;
}
}
else
{
if ( m_type == OBJECT_HUMAN )
{
- pyroType = PT_SHOTH;
+ pyroType = Gfx::PT_SHOTH;
}
else if ( m_type == OBJECT_MOTHER )
{
- pyroType = PT_SHOTM;
+ pyroType = Gfx::PT_SHOTM;
}
else
{
- pyroType = PT_SHOTT;
+ pyroType = Gfx::PT_SHOTT;
}
}
}
@@ -672,16 +670,16 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
m_type == OBJECT_WORM ||
m_type == OBJECT_BULLET )
{
- pyroType = PT_BURNO;
+ pyroType = Gfx::PT_BURNO;
SetBurn(true);
}
else if ( m_type == OBJECT_HUMAN )
{
- pyroType = PT_DEADG;
+ pyroType = Gfx::PT_DEADG;
}
else
{
- pyroType = PT_BURNT;
+ pyroType = Gfx::PT_BURNT;
SetBurn(true);
}
SetVirusMode(false);
@@ -690,11 +688,11 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
{
if ( m_type == OBJECT_HUMAN )
{
- pyroType = PT_DEADW;
+ pyroType = Gfx::PT_DEADW;
}
else
{
- pyroType = PT_FRAGW;
+ pyroType = Gfx::PT_FRAGW;
}
}
else // explosion?
@@ -704,17 +702,17 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
m_type == OBJECT_BEE ||
m_type == OBJECT_WORM )
{
- pyroType = PT_EXPLOO;
+ pyroType = Gfx::PT_EXPLOO;
}
else if ( m_type == OBJECT_MOTHER ||
m_type == OBJECT_NEST ||
m_type == OBJECT_BULLET )
{
- pyroType = PT_FRAGO;
+ pyroType = Gfx::PT_FRAGO;
}
else if ( m_type == OBJECT_HUMAN )
{
- pyroType = PT_DEADG;
+ pyroType = Gfx::PT_DEADG;
}
else if ( m_type == OBJECT_BASE ||
m_type == OBJECT_DERRICK ||
@@ -737,24 +735,24 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
m_type == OBJECT_START ||
m_type == OBJECT_END ) // building?
{
- pyroType = PT_FRAGT;
+ pyroType = Gfx::PT_FRAGT;
}
else if ( m_type == OBJECT_MOBILEtg ||
m_type == OBJECT_TEEN28 || // cylinder?
m_type == OBJECT_TEEN31 ) // basket?
{
- pyroType = PT_FRAGT;
+ pyroType = Gfx::PT_FRAGT;
}
else
{
- pyroType = PT_EXPLOT;
+ pyroType = Gfx::PT_EXPLOT;
}
}
loss = 1.0f;
}
- pyro = new CPyro(m_iMan);
+ pyro = new Gfx::CPyro(m_iMan);
pyro->Create(pyroType, this, loss);
if ( shield == 0.0f ) // dead?
@@ -768,10 +766,10 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
if ( shield > 0.0f ) return false; // not dead yet
- if ( RetSelect() )
+ if ( GetSelect() )
{
SetSelect(false); // deselects the object
- m_camera->SetType(CAMERA_EXPLO);
+ m_camera->SetType(Gfx::CAM_TYPE_EXPLO);
m_main->DeselectAll();
}
DeleteDeselList(this);
@@ -830,7 +828,7 @@ void CObject::InitPart(int part)
}
// Creates a new part, and returns its number.
-// Returns -1 on error.
+// Geturns -1 on error.
int CObject::CreatePart()
{
@@ -855,7 +853,7 @@ void CObject::DeletePart(int part)
if ( m_objectPart[part].masterParti != -1 )
{
- m_particule->DeleteParticule(m_objectPart[part].masterParti);
+ m_particle->DeleteParticle(m_objectPart[part].masterParti);
m_objectPart[part].masterParti = -1;
}
@@ -891,9 +889,9 @@ void CObject::SetObjectRank(int part, int objRank)
m_objectPart[part].object = objRank;
}
-// Returns the number of part.
+// Geturns the number of part.
-int CObject::RetObjectRank(int part)
+int CObject::GetObjectRank(int part)
{
if ( !m_objectPart[part].bUsed ) return -1;
return m_objectPart[part].object;
@@ -914,7 +912,7 @@ void CObject::SetObjectParent(int part, int parent)
void CObject::SetType(ObjectType type)
{
m_type = type;
- strcpy(m_name, RetObjectName(m_type));
+ strcpy(m_name, GetObjectName(m_type));
if ( m_type == OBJECT_MOBILErs )
{
@@ -940,16 +938,16 @@ void CObject::SetType(ObjectType type)
m_type == OBJECT_MOBILEii ||
m_type == OBJECT_MOBILErc ) // cannon vehicle?
{
- m_cameraType = CAMERA_ONBOARD;
+ m_cameraType = Gfx::CAM_TYPE_ONBOARD;
}
}
-ObjectType CObject::RetType()
+ObjectType CObject::GetType()
{
return m_type;
}
-char* CObject::RetName()
+char* CObject::GetName()
{
return m_name;
}
@@ -962,7 +960,7 @@ void CObject::SetOption(int option)
m_option = option;
}
-int CObject::RetOption()
+int CObject::GetOption()
{
return m_option;
}
@@ -980,7 +978,7 @@ void CObject::SetID(int id)
}
}
-int CObject::RetID()
+int CObject::GetID()
{
return m_id;
}
@@ -996,115 +994,115 @@ bool CObject::Write(char *line)
float value;
int i;
- sprintf(name, " camera=%s", GetCamera(RetCameraType()));
+ sprintf(name, " camera=%s", GetCamera(GetCameraType()));
strcat(line, name);
- if ( RetCameraLock() != 0 )
+ if ( GetCameraLock() != 0 )
{
- sprintf(name, " cameraLock=%d", RetCameraLock());
+ sprintf(name, " cameraLock=%d", GetCameraLock());
strcat(line, name);
}
- if ( RetEnergy() != 0.0f )
+ if ( GetEnergy() != 0.0f )
{
- sprintf(name, " energy=%.2f", RetEnergy());
+ sprintf(name, " energy=%.2f", GetEnergy());
strcat(line, name);
}
- if ( RetCapacity() != 1.0f )
+ if ( GetCapacity() != 1.0f )
{
- sprintf(name, " capacity=%.2f", RetCapacity());
+ sprintf(name, " capacity=%.2f", GetCapacity());
strcat(line, name);
}
- if ( RetShield() != 1.0f )
+ if ( GetShield() != 1.0f )
{
- sprintf(name, " shield=%.2f", RetShield());
+ sprintf(name, " shield=%.2f", GetShield());
strcat(line, name);
}
- if ( RetRange() != 1.0f )
+ if ( GetRange() != 1.0f )
{
- sprintf(name, " range=%.2f", RetRange());
+ sprintf(name, " range=%.2f", GetRange());
strcat(line, name);
}
- if ( RetSelectable() != 1 )
+ if ( GetSelectable() != 1 )
{
- sprintf(name, " selectable=%d", RetSelectable());
+ sprintf(name, " selectable=%d", GetSelectable());
strcat(line, name);
}
- if ( RetEnable() != 1 )
+ if ( GetEnable() != 1 )
{
- sprintf(name, " enable=%d", RetEnable());
+ sprintf(name, " enable=%d", GetEnable());
strcat(line, name);
}
- if ( RetFixed() != 0 )
+ if ( GetFixed() != 0 )
{
- sprintf(name, " fixed=%d", RetFixed());
+ sprintf(name, " fixed=%d", GetFixed());
strcat(line, name);
}
- if ( RetClip() != 1 )
+ if ( GetClip() != 1 )
{
- sprintf(name, " clip=%d", RetClip());
+ sprintf(name, " clip=%d", GetClip());
strcat(line, name);
}
- if ( RetLock() != 0 )
+ if ( GetLock() != 0 )
{
- sprintf(name, " lock=%d", RetLock());
+ sprintf(name, " lock=%d", GetLock());
strcat(line, name);
}
- if ( RetProxyActivate() != 0 )
+ if ( GetProxyActivate() != 0 )
{
- sprintf(name, " proxyActivate=%d", RetProxyActivate());
+ sprintf(name, " proxyActivate=%d", GetProxyActivate());
strcat(line, name);
- sprintf(name, " proxyDistance=%.2f", RetProxyDistance()/g_unit);
+ sprintf(name, " proxyDistance=%.2f", GetProxyDistance()/g_unit);
strcat(line, name);
}
- if ( RetMagnifyDamage() != 1.0f )
+ if ( GetMagnifyDamage() != 1.0f )
{
- sprintf(name, " magnifyDamage=%.2f", RetMagnifyDamage());
+ sprintf(name, " magnifyDamage=%.2f", GetMagnifyDamage());
strcat(line, name);
}
- if ( RetGunGoalV() != 0.0f )
+ if ( GetGunGoalV() != 0.0f )
{
- sprintf(name, " aimV=%.2f", RetGunGoalV());
+ sprintf(name, " aimV=%.2f", GetGunGoalV());
strcat(line, name);
}
- if ( RetGunGoalH() != 0.0f )
+ if ( GetGunGoalH() != 0.0f )
{
- sprintf(name, " aimH=%.2f", RetGunGoalH());
+ sprintf(name, " aimH=%.2f", GetGunGoalH());
strcat(line, name);
}
- if ( RetParam() != 0.0f )
+ if ( GetParam() != 0.0f )
{
- sprintf(name, " param=%.2f", RetParam());
+ sprintf(name, " param=%.2f", GetParam());
strcat(line, name);
}
- if ( RetResetCap() != 0 )
+ if ( GetResetCap() != 0 )
{
- sprintf(name, " resetCap=%d", RetResetCap());
+ sprintf(name, " resetCap=%d", GetResetCap());
strcat(line, name);
- pos = RetResetPosition()/g_unit;
+ pos = GetResetPosition()/g_unit;
sprintf(name, " resetPos=%.2f;%.2f;%.2f", pos.x, pos.y, pos.z);
strcat(line, name);
- pos = RetResetAngle()/(Math::PI/180.0f);
+ pos = GetResetAngle()/(Math::PI/180.0f);
sprintf(name, " resetAngle=%.2f;%.2f;%.2f", pos.x, pos.y, pos.z);
strcat(line, name);
- sprintf(name, " resetRun=%d", RetResetRun());
+ sprintf(name, " resetRun=%d", GetResetRun());
strcat(line, name);
}
@@ -1123,7 +1121,7 @@ bool CObject::Write(char *line)
// Puts information in terminal (OBJECT_INFO).
for ( i=0 ; i<m_infoTotal ; i++ )
{
- info = RetInfo(i);
+ info = GetInfo(i);
if ( info.name[0] == 0 ) break;
sprintf(name, " info%d=\"%s=%.2f\"", i+1, info.name, info.value);
@@ -1133,7 +1131,7 @@ bool CObject::Write(char *line)
// Sets the parameters of the command line.
for ( i=0 ; i<OBJECTMAXCMDLINE ; i++ )
{
- value = RetCmdLine(i);
+ value = GetCmdLine(i);
if ( value == NAN ) break;
if ( i == 0 ) sprintf(name, " cmdline=%.2f", value);
@@ -1164,21 +1162,21 @@ bool CObject::Write(char *line)
return true;
}
-// Returns all parameters of the object.
+// Geturns all parameters of the object.
bool CObject::Read(char *line)
{
Math::Vector pos, dir;
- Info info;
- CameraType cType;
- char op[20];
- char text[100];
- char* p;
- float value;
- int i;
+ Info info;
+ Gfx::CameraType cType;
+ char op[20];
+ char text[100];
+ char* p;
+ float value;
+ int i;
cType = OpCamera(line, "camera");
- if ( cType != CAMERA_NULL )
+ if ( cType != Gfx::CAM_TYPE_NULL )
{
SetCameraType(cType);
}
@@ -1200,7 +1198,7 @@ bool CObject::Read(char *line)
SetGunGoalV(OpFloat(line, "aimV", 0.0f));
SetGunGoalH(OpFloat(line, "aimH", 0.0f));
SetParam(OpFloat(line, "param", 0.0f));
- SetResetCap((ResetCap)OpInt(line, "resetCap", 0));
+ SetResetCap(static_cast<ResetCap>(OpInt(line, "resetCap", 0)));
SetResetPosition(OpDir(line, "resetPos")*g_unit);
SetResetAngle(OpDir(line, "resetAngle")*(Math::PI/180.0f));
SetResetRun(OpInt(line, "resetRun", 0));
@@ -1291,7 +1289,7 @@ int CObject::CreateCrashSphere(Math::Vector pos, float radius, Sound sound,
if ( m_crashSphereUsed >= MAXCRASHSPHERE ) return -1;
- zoom = RetZoomX(0);
+ zoom = GetZoomX(0);
m_crashSpherePos[m_crashSphereUsed] = pos;
m_crashSphereRadius[m_crashSphereUsed] = radius*zoom;
m_crashSphereHardness[m_crashSphereUsed] = hardness;
@@ -1299,14 +1297,14 @@ int CObject::CreateCrashSphere(Math::Vector pos, float radius, Sound sound,
return m_crashSphereUsed++;
}
-// Returns the number of spheres.
+// Geturns the number of spheres.
-int CObject::RetCrashSphereTotal()
+int CObject::GetCrashSphereTotal()
{
return m_crashSphereUsed;
}
-// Returns a sphere for collisions.
+// Geturns a sphere for collisions.
// The position is absolute in the world.
bool CObject::GetCrashSphere(int rank, Math::Vector &pos, float &radius)
@@ -1318,7 +1316,7 @@ bool CObject::GetCrashSphere(int rank, Math::Vector &pos, float &radius)
return false;
}
- // Returns to the sphere collisions,
+ // Geturns to the sphere collisions,
// which ignores the inclination of the vehicle.
// This is necessary to collisions with vehicles,
// so as not to reflect SetInclinaison, for example.
@@ -1342,16 +1340,16 @@ bool CObject::GetCrashSphere(int rank, Math::Vector &pos, float &radius)
return true;
}
-// Returns the hardness of a sphere.
+// Geturns the hardness of a sphere.
-Sound CObject::RetCrashSphereSound(int rank)
+Sound CObject::GetCrashSphereSound(int rank)
{
return m_crashSphereSound[rank];
}
-// Returns the hardness of a sphere.
+// Geturns the hardness of a sphere.
-float CObject::RetCrashSphereHardness(int rank)
+float CObject::GetCrashSphereHardness(int rank)
{
return m_crashSphereHardness[rank];
}
@@ -1378,12 +1376,12 @@ void CObject::SetGlobalSphere(Math::Vector pos, float radius)
{
float zoom;
- zoom = RetZoomX(0);
+ zoom = GetZoomX(0);
m_globalSpherePos = pos;
m_globalSphereRadius = radius*zoom;
}
-// Returns the global sphere, in the world.
+// Geturns the global sphere, in the world.
void CObject::GetGlobalSphere(Math::Vector &pos, float &radius)
{
@@ -1416,9 +1414,9 @@ void CObject::SetShieldRadius(float radius)
m_shieldRadius = radius;
}
-// Returns the radius of the shield.
+// Geturns the radius of the shield.
-float CObject::RetShieldRadius()
+float CObject::GetShieldRadius()
{
return m_shieldRadius;
}
@@ -1431,7 +1429,7 @@ void CObject::SetFloorHeight(float height)
Math::Vector pos;
pos = m_objectPart[0].position;
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
if ( m_physics != 0 )
{
@@ -1451,7 +1449,7 @@ void CObject::FloorAdjust()
Math::Point nn;
float a;
- pos = RetPosition(0);
+ pos = GetPosition(0);
if ( m_terrain->GetNormal(n, pos) )
{
#if 0
@@ -1459,7 +1457,7 @@ void CObject::FloorAdjust()
SetAngleZ(0, -sinf(n.x));
SetAngleY(0, 0.0f);
#else
- a = RetAngleY(0);
+ a = GetAngleY(0);
nn = Math::RotatePoint(-a, Math::Point(n.z, n.x));
SetAngleX(0, sinf(nn.x));
SetAngleZ(0, -sinf(nn.y));
@@ -1481,7 +1479,7 @@ void CObject::SetLinVibration(Math::Vector dir)
}
}
-Math::Vector CObject::RetLinVibration()
+Math::Vector CObject::GetLinVibration()
{
return m_linVibration;
}
@@ -1499,7 +1497,7 @@ void CObject::SetCirVibration(Math::Vector dir)
}
}
-Math::Vector CObject::RetCirVibration()
+Math::Vector CObject::GetCirVibration()
{
return m_cirVibration;
}
@@ -1517,7 +1515,7 @@ void CObject::SetInclinaison(Math::Vector dir)
}
}
-Math::Vector CObject::RetInclinaison()
+Math::Vector CObject::GetInclinaison()
{
return m_inclinaison;
}
@@ -1539,10 +1537,10 @@ void CObject::SetPosition(int part, const Math::Vector &pos)
rank = m_objectPart[0].object;
shPos = pos;
- m_terrain->MoveOnFloor(shPos, true);
+ m_terrain->AdjustToFloor(shPos, true);
m_engine->SetObjectShadowPos(rank, shPos);
- if ( m_physics != 0 && m_physics->RetType() == TYPE_FLYING )
+ if ( m_physics != 0 && m_physics->GetType() == TYPE_FLYING )
{
height = pos.y-shPos.y;
}
@@ -1554,7 +1552,7 @@ void CObject::SetPosition(int part, const Math::Vector &pos)
// Calculating the normal to the ground in nine strategic locations,
// then perform a weighted average (the dots in the center are more important).
- radius = m_engine->RetObjectShadowRadius(rank);
+ radius = m_engine->GetObjectShadowRadius(rank);
i = 0;
m_terrain->GetNormal(norm, pos);
@@ -1619,7 +1617,7 @@ void CObject::SetPosition(int part, const Math::Vector &pos)
{
norm += n[j];
}
- norm /= (float)i; // average vector
+ norm /= static_cast<float>(i); // average vector
m_engine->SetObjectShadowNormal(rank, norm);
@@ -1627,14 +1625,14 @@ void CObject::SetPosition(int part, const Math::Vector &pos)
{
shPos = pos;
shPos.y += m_shadowHeight;
- m_light->SetLightPos(m_shadowLight, shPos);
+ m_lightMan->SetLightPos(m_shadowLight, shPos);
}
if ( m_effectLight != -1 )
{
shPos = pos;
shPos.y += m_effectHeight;
- m_light->SetLightPos(m_effectLight, shPos);
+ m_lightMan->SetLightPos(m_effectLight, shPos);
}
if ( m_bShowLimit )
@@ -1644,7 +1642,7 @@ void CObject::SetPosition(int part, const Math::Vector &pos)
}
}
-Math::Vector CObject::RetPosition(int part)
+Math::Vector CObject::GetPosition(int part)
{
return m_objectPart[part].position;
}
@@ -1662,7 +1660,7 @@ void CObject::SetAngle(int part, const Math::Vector &angle)
}
}
-Math::Vector CObject::RetAngle(int part)
+Math::Vector CObject::GetAngle(int part)
{
return m_objectPart[part].angle;
}
@@ -1696,17 +1694,17 @@ void CObject::SetAngleZ(int part, float angle)
m_objectPart[part].bRotate = true; //it will recalculate the matrices
}
-float CObject::RetAngleY(int part)
+float CObject::GetAngleY(int part)
{
return m_objectPart[part].angle.y;
}
-float CObject::RetAngleX(int part)
+float CObject::GetAngleX(int part)
{
return m_objectPart[part].angle.x;
}
-float CObject::RetAngleZ(int part)
+float CObject::GetAngleZ(int part)
{
return m_objectPart[part].angle.z;
}
@@ -1736,7 +1734,7 @@ void CObject::SetZoom(int part, Math::Vector zoom)
m_objectPart[part].zoom.z != 1.0f );
}
-Math::Vector CObject::RetZoom(int part)
+Math::Vector CObject::GetZoom(int part)
{
return m_objectPart[part].zoom;
}
@@ -1771,27 +1769,27 @@ void CObject::SetZoomZ(int part, float zoom)
m_objectPart[part].zoom.z != 1.0f );
}
-float CObject::RetZoomX(int part)
+float CObject::GetZoomX(int part)
{
return m_objectPart[part].zoom.x;
}
-float CObject::RetZoomY(int part)
+float CObject::GetZoomY(int part)
{
return m_objectPart[part].zoom.y;
}
-float CObject::RetZoomZ(int part)
+float CObject::GetZoomZ(int part)
{
return m_objectPart[part].zoom.z;
}
-// Returns the water level.
+// Geturns the water level.
-float CObject::RetWaterLevel()
+float CObject::GetWaterLevel()
{
- return m_water->RetLevel();
+ return m_water->GetLevel();
}
@@ -1801,11 +1799,11 @@ void CObject::SetTrainer(bool bEnable)
if ( m_bTrainer ) // training?
{
- m_cameraType = CAMERA_FIX;
+ m_cameraType = Gfx::CAM_TYPE_FIX;
}
}
-bool CObject::RetTrainer()
+bool CObject::GetTrainer()
{
return m_bTrainer;
}
@@ -1815,7 +1813,7 @@ void CObject::SetToy(bool bEnable)
m_bToy = bEnable;
}
-bool CObject::RetToy()
+bool CObject::GetToy()
{
return m_bToy;
}
@@ -1825,7 +1823,7 @@ void CObject::SetManual(bool bManual)
m_bManual = bManual;
}
-bool CObject::RetManual()
+bool CObject::GetManual()
{
return m_bManual;
}
@@ -1835,7 +1833,7 @@ void CObject::SetResetCap(ResetCap cap)
m_resetCap = cap;
}
-ResetCap CObject::RetResetCap()
+ResetCap CObject::GetResetCap()
{
return m_resetCap;
}
@@ -1845,7 +1843,7 @@ void CObject::SetResetBusy(bool bBusy)
m_bResetBusy = bBusy;
}
-bool CObject::RetResetBusy()
+bool CObject::GetResetBusy()
{
return m_bResetBusy;
}
@@ -1855,7 +1853,7 @@ void CObject::SetResetPosition(const Math::Vector &pos)
m_resetPosition = pos;
}
-Math::Vector CObject::RetResetPosition()
+Math::Vector CObject::GetResetPosition()
{
return m_resetPosition;
}
@@ -1865,12 +1863,12 @@ void CObject::SetResetAngle(const Math::Vector &angle)
m_resetAngle = angle;
}
-Math::Vector CObject::RetResetAngle()
+Math::Vector CObject::GetResetAngle()
{
return m_resetAngle;
}
-int CObject::RetResetRun()
+int CObject::GetResetRun()
{
return m_resetRun;
}
@@ -1883,12 +1881,12 @@ void CObject::SetResetRun(int run)
// Management of the particle master.
-void CObject::SetMasterParticule(int part, int parti)
+void CObject::SetMasterParticle(int part, int parti)
{
m_objectPart[part].masterParti = parti;
}
-int CObject::RetMasterParticule(int part)
+int CObject::GetMasterParticle(int part)
{
return m_objectPart[part].masterParti;
}
@@ -1901,7 +1899,7 @@ void CObject::SetPower(CObject* power)
m_power = power;
}
-CObject* CObject::RetPower()
+CObject* CObject::GetPower()
{
return m_power;
}
@@ -1913,7 +1911,7 @@ void CObject::SetFret(CObject* fret)
m_fret = fret;
}
-CObject* CObject::RetFret()
+CObject* CObject::GetFret()
{
return m_fret;
}
@@ -1928,7 +1926,7 @@ void CObject::SetTruck(CObject* truck)
m_engine->SetObjectShadowHide(m_objectPart[0].object, (m_truck != 0));
}
-CObject* CObject::RetTruck()
+CObject* CObject::GetTruck()
{
return m_truck;
}
@@ -1940,7 +1938,7 @@ void CObject::SetTruckPart(int part)
m_truckLink = part;
}
-int CObject::RetTruckPart()
+int CObject::GetTruckPart()
{
return m_truckLink;
}
@@ -1977,13 +1975,13 @@ void CObject::SetInfo(int rank, Info info)
m_bInfoUpdate = true;
}
-Info CObject::RetInfo(int rank)
+Info CObject::GetInfo(int rank)
{
if ( rank < 0 || rank >= OBJECTMAXINFO ) rank = 0;
return m_info[rank];
}
-int CObject::RetInfoTotal()
+int CObject::GetInfoTotal()
{
return m_infoTotal;
}
@@ -1993,7 +1991,7 @@ void CObject::SetInfoReturn(float value)
m_infoReturn = value;
}
-float CObject::RetInfoReturn()
+float CObject::GetInfoReturn()
{
return m_infoReturn;
}
@@ -2003,7 +2001,7 @@ void CObject::SetInfoUpdate(bool bUpdate)
m_bInfoUpdate = bUpdate;
}
-bool CObject::RetInfoUpdate()
+bool CObject::GetInfoUpdate()
{
return m_bInfoUpdate;
}
@@ -2016,31 +2014,31 @@ bool CObject::SetCmdLine(int rank, float value)
return true;
}
-float CObject::RetCmdLine(int rank)
+float CObject::GetCmdLine(int rank)
{
if ( rank < 0 || rank >= OBJECTMAXCMDLINE ) return 0.0f;
return m_cmdLine[rank];
}
-// Returns matrices of an object portion.
+// Geturns matrices of an object portion.
-Math::Matrix* CObject::RetRotateMatrix(int part)
+Math::Matrix* CObject::GetRotateMatrix(int part)
{
return &m_objectPart[part].matRotate;
}
-Math::Matrix* CObject::RetTranslateMatrix(int part)
+Math::Matrix* CObject::GetTranslateMatrix(int part)
{
return &m_objectPart[part].matTranslate;
}
-Math::Matrix* CObject::RetTransformMatrix(int part)
+Math::Matrix* CObject::GetTransformMatrix(int part)
{
return &m_objectPart[part].matTransform;
}
-Math::Matrix* CObject::RetWorldMatrix(int part)
+Math::Matrix* CObject::GetWorldMatrix(int part)
{
if ( m_objectPart[0].bTranslate ||
m_objectPart[0].bRotate )
@@ -2062,7 +2060,7 @@ void CObject::SetDrawWorld(bool bDraw)
{
if ( m_objectPart[i].bUsed )
{
- m_engine->SetDrawWorld(m_objectPart[i].object, bDraw);
+ m_engine->SetObjectDrawWorld(m_objectPart[i].object, bDraw);
}
}
}
@@ -2077,7 +2075,7 @@ void CObject::SetDrawFront(bool bDraw)
{
if ( m_objectPart[i].bUsed )
{
- m_engine->SetDrawFront(m_objectPart[i].object, bDraw);
+ m_engine->SetObjectDrawFront(m_objectPart[i].object, bDraw);
}
}
}
@@ -2242,94 +2240,93 @@ bool CObject::CreateInsect(Math::Vector pos, float angle, ObjectType type)
// Creates shade under a vehicle as a negative light.
-bool CObject::CreateShadowLight(float height, D3DCOLORVALUE color)
+bool CObject::CreateShadowLight(float height, Gfx::Color color)
{
- D3DLIGHT7 light;
+ Gfx::Light light;
Math::Vector pos;
- if ( !m_engine->RetLightMode() ) return true;
+ if ( !m_engine->GetLightMode() ) return true;
- pos = RetPosition(0);
+ pos = GetPosition(0);
m_shadowHeight = height;
- ZeroMemory( &light, sizeof(light) );
- light.dltType = D3DLIGHT_SPOT;
- light.dcvDiffuse.r = color.r;
- light.dcvDiffuse.g = color.g;
- light.dcvDiffuse.b = color.b;
- light.dvPosition.x = pos.x;
- light.dvPosition.y = pos.y+height;
- light.dvPosition.z = pos.z;
- light.dvDirection.x = 0.0f;
- light.dvDirection.y = -1.0f; // against the bottom
- light.dvDirection.z = 0.0f;
- light.dvRange = D3DLIGHT_RANGE_MAX;
- light.dvFalloff = 1.0f;
- light.dvAttenuation0 = 1.0f;
- light.dvAttenuation1 = 0.0f;
- light.dvAttenuation2 = 0.0f;
- light.dvTheta = 0.0f;
- light.dvPhi = Math::PI/4.0f;
-
- m_shadowLight = m_light->CreateLight();
+ light.type = Gfx::LIGHT_SPOT;
+ light.diffuse.r = color.r;
+ light.diffuse.g = color.g;
+ light.diffuse.b = color.b;
+ light.position.x = pos.x;
+ light.position.y = pos.y+height;
+ light.position.z = pos.z;
+ light.direction.x = 0.0f;
+ light.direction.y = -1.0f; // against the bottom
+ light.direction.z = 0.0f;
+ //TODO Is this value correct
+ light.spotIntensity = 128;
+ light.attenuation0 = 1.0f;
+ light.attenuation1 = 0.0f;
+ light.attenuation2 = 0.0f;
+ //TODO Is this value correct
+ light.spotAngle = 90;
+
+ m_shadowLight = m_lightMan->CreateLight();
if ( m_shadowLight == -1 ) return false;
- m_light->SetLight(m_shadowLight, light);
+ m_lightMan->SetLight(m_shadowLight, light);
// Only illuminates the objects on the ground.
- m_light->SetLightIncluType(m_shadowLight, TYPETERRAIN);
+ m_lightMan->SetLightIncludeType(m_shadowLight, Gfx::ENG_OBJTYPE_TERRAIN);
return true;
}
-// Returns the number of negative light shade.
+// Geturns the number of negative light shade.
-int CObject::RetShadowLight()
+int CObject::GetShadowLight()
{
return m_shadowLight;
}
// Creates light for the effects of a vehicle.
-bool CObject::CreateEffectLight(float height, D3DCOLORVALUE color)
+bool CObject::CreateEffectLight(float height, Gfx::Color color)
{
- D3DLIGHT7 light;
+ Gfx::Light light;
- if ( !m_engine->RetLightMode() ) return true;
+ if ( !m_engine->GetLightMode() ) return true;
m_effectHeight = height;
- ZeroMemory( &light, sizeof(light) );
- light.dltType = D3DLIGHT_SPOT;
- light.dcvDiffuse.r = color.r;
- light.dcvDiffuse.g = color.g;
- light.dcvDiffuse.b = color.b;
- light.dvPosition.x = 0.0f;
- light.dvPosition.y = 0.0f+height;
- light.dvPosition.z = 0.0f;
- light.dvDirection.x = 0.0f;
- light.dvDirection.y = -1.0f; // against the bottom
- light.dvDirection.z = 0.0f;
- light.dvRange = D3DLIGHT_RANGE_MAX;
- light.dvFalloff = 1.0f;
- light.dvAttenuation0 = 1.0f;
- light.dvAttenuation1 = 0.0f;
- light.dvAttenuation2 = 0.0f;
- light.dvTheta = 0.0f;
- light.dvPhi = Math::PI/4.0f;
-
- m_effectLight = m_light->CreateLight();
+ memset( &light, 0, sizeof(light) );
+ light.type = Gfx::LIGHT_SPOT;
+ light.diffuse.r = color.r;
+ light.diffuse.g = color.g;
+ light.diffuse.b = color.b;
+ light.position.x = 0.0f;
+ light.position.y = 0.0f+height;
+ light.position.z = 0.0f;
+ light.direction.x = 0.0f;
+ light.direction.y = -1.0f; // against the bottom
+ light.direction.z = 0.0f;
+ //TODO Is this value correct
+ light.spotIntensity = 1.0f;
+ light.attenuation0 = 1.0f;
+ light.attenuation1 = 0.0f;
+ light.attenuation2 = 0.0f;
+ //TODO Is this value correct
+ light.spotAngle = 90;
+
+ m_effectLight = m_lightMan->CreateLight();
if ( m_effectLight == -1 ) return false;
- m_light->SetLight(m_effectLight, light);
- m_light->SetLightIntensity(m_effectLight, 0.0f);
+ m_lightMan->SetLight(m_effectLight, light);
+ m_lightMan->SetLightIntensity(m_effectLight, 0.0f);
return true;
}
-// Returns the number of light effects.
+// Geturns the number of light effects.
-int CObject::RetEffectLight()
+int CObject::GetEffectLight()
{
return m_effectLight;
}
@@ -2337,15 +2334,15 @@ int CObject::RetEffectLight()
// Creates the circular shadow underneath a vehicle.
bool CObject::CreateShadowCircle(float radius, float intensity,
- D3DShadowType type)
+ Gfx::EngineShadowType type)
{
float zoom;
if ( intensity == 0.0f ) return true;
- zoom = RetZoomX(0);
+ zoom = GetZoomX(0);
- m_engine->ShadowCreate(m_objectPart[0].object);
+ m_engine->CreateShadow(m_objectPart[0].object);
m_engine->SetObjectShadowRadius(m_objectPart[0].object, radius*zoom);
m_engine->SetObjectShadowIntensity(m_objectPart[0].object, intensity);
@@ -2361,18 +2358,16 @@ bool CObject::CreateShadowCircle(float radius, float intensity,
bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
ObjectType type, float power)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
Math::Point p;
int rank, i;
- if ( m_engine->RetRestCreate() < 20 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
if ( m_type == OBJECT_PORTICO )
@@ -2384,7 +2379,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\portico2.mod");
@@ -2392,7 +2387,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(1, Math::Vector(0.0f, 67.0f, 0.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 1);
pModFile->ReadModel("objects\\portico3.mod");
@@ -2401,7 +2396,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(2, 45.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(3, rank);
SetObjectParent(3, 2);
pModFile->ReadModel("objects\\portico4.mod");
@@ -2410,7 +2405,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(3, -60.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(4, rank);
SetObjectParent(4, 3);
pModFile->ReadModel("objects\\portico5.mod");
@@ -2419,7 +2414,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(4, -55.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(5, rank);
SetObjectParent(5, 1);
pModFile->ReadModel("objects\\portico3.mod");
@@ -2428,7 +2423,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(5, -45.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(6, rank);
SetObjectParent(6, 5);
pModFile->ReadModel("objects\\portico4.mod");
@@ -2437,7 +2432,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(6, 60.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(7, rank);
SetObjectParent(7, 6);
pModFile->ReadModel("objects\\portico5.mod");
@@ -2446,7 +2441,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(7, 55.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(8, rank);
SetObjectParent(8, 0);
pModFile->ReadModel("objects\\portico6.mod");
@@ -2456,7 +2451,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetZoom(8, 2.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(9, rank);
SetObjectParent(9, 8);
pModFile->ReadModel("objects\\portico7.mod");
@@ -2464,7 +2459,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(9, Math::Vector(0.0f, 4.5f, 1.9f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(10, rank);
SetObjectParent(10, 0);
pModFile->ReadModel("objects\\portico6.mod");
@@ -2474,7 +2469,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetZoom(10, 2.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(11, rank);
SetObjectParent(11, 10);
pModFile->ReadModel("objects\\portico7.mod");
@@ -2508,7 +2503,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
for ( i=0 ; i<8 ; i++ )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1+i, rank);
SetObjectParent(1+i, 0);
pModFile->ReadModel("objects\\base2.mod");
@@ -2519,7 +2514,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleZ(1+i, Math::PI/2.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(10+i, rank);
SetObjectParent(10+i, 1+i);
pModFile->ReadModel("objects\\base4.mod");
@@ -2527,7 +2522,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(10+i, Math::Vector(23.5f, 0.0f, 7.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(18+i, rank);
SetObjectParent(18+i, 1+i);
pModFile->ReadModel("objects\\base4.mod");
@@ -2537,7 +2532,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
}
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(9, rank);
SetObjectParent(9, 0);
pModFile->ReadModel("objects\\base3.mod"); // central pillar
@@ -2578,7 +2573,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\derrick2.mod");
@@ -2603,7 +2598,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\search2.mod");
@@ -2611,7 +2606,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(1, Math::Vector(0.0f, 13.0f, 0.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 1);
pModFile->ReadModel("objects\\search3.mod");
@@ -2638,7 +2633,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\radar2.mod");
@@ -2646,7 +2641,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(1, Math::Vector(0.0f, 5.0f, 0.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 0);
pModFile->ReadModel("objects\\radar3.mod");
@@ -2655,7 +2650,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(2, -Math::PI/2.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(3, rank);
SetObjectParent(3, 2);
pModFile->ReadModel("objects\\radar4.mod");
@@ -2678,7 +2673,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\info2.mod");
@@ -2688,7 +2683,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
for ( i=0 ; i<3 ; i++ )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2+i*2, rank);
SetObjectParent(2+i*2, 1);
pModFile->ReadModel("objects\\info3.mod");
@@ -2696,7 +2691,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(2+i*2, Math::Vector(0.0f, 4.5f, 0.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(3+i*2, rank);
SetObjectParent(3+i*2, 2+i*2);
pModFile->ReadModel("objects\\radar4.mod");
@@ -2741,7 +2736,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\labo2.mod");
@@ -2750,7 +2745,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleZ(1, Math::PI/2.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 1);
pModFile->ReadModel("objects\\labo3.mod");
@@ -2758,7 +2753,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(2, Math::Vector(9.0f, -1.0f, 0.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(3, rank);
SetObjectParent(3, 2);
pModFile->ReadModel("objects\\labo4.mod");
@@ -2767,7 +2762,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleZ(3, 80.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(4, rank);
SetObjectParent(4, 2);
pModFile->ReadModel("objects\\labo4.mod");
@@ -2777,7 +2772,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(4, Math::PI*2.0f/3.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(5, rank);
SetObjectParent(5, 2);
pModFile->ReadModel("objects\\labo4.mod");
@@ -2809,7 +2804,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
for ( i=0 ; i<9 ; i++ )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1+i, rank);
SetObjectParent(1+i, 0);
pModFile->ReadModel("objects\\factory2.mod");
@@ -2819,7 +2814,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetZoomZ(1+i, 0.30f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(10+i, rank);
SetObjectParent(10+i, 0);
pModFile->ReadModel("objects\\factory2.mod");
@@ -2832,7 +2827,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
for ( i=0 ; i<2 ; i++ )
{
- float s = (float)(i*2-1);
+ float s = static_cast<float>(i*2-1);
CreateCrashSphere(Math::Vector(-10.0f, 2.0f, 11.0f*s), 4.0f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector( -3.0f, 2.0f, 11.0f*s), 4.0f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector( 3.0f, 2.0f, 11.0f*s), 4.0f, SOUND_BOUMm, 0.45f);
@@ -2867,7 +2862,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\repair2.mod");
@@ -2893,7 +2888,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\destroy2.mod");
@@ -2936,7 +2931,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\convert2.mod");
@@ -2944,7 +2939,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(1, Math::Vector(0.0f, 14.0f, 0.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 0);
pModFile->ReadModel("objects\\convert3.mod");
@@ -2953,7 +2948,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleX(2, -Math::PI*0.35f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(3, rank);
SetObjectParent(3, 0);
pModFile->ReadModel("objects\\convert3.mod");
@@ -2980,7 +2975,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\roller2c.mod");
@@ -2989,7 +2984,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleZ(1, Math::PI/2.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 1);
pModFile->ReadModel("objects\\roller3c.mod");
@@ -3006,7 +3001,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
m_character.posPower = Math::Vector(5.0f, 3.0f, 0.0f);
CreateShadowCircle(6.0f, 1.0f);
- m_showLimitRadius = BLITZPARA;
+ m_showLimitRadius = Gfx::BLITZPARA;
}
if ( m_type == OBJECT_NUCLEAR )
@@ -3018,7 +3013,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\nuclear2.mod");
@@ -3059,7 +3054,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetGlobalSphere(Math::Vector(0.0f, 10.0f, 0.0f), 20.0f);
CreateShadowCircle(21.0f, 1.0f);
- m_showLimitRadius = BLITZPARA;
+ m_showLimitRadius = Gfx::BLITZPARA;
}
if ( m_type == OBJECT_SAFE )
@@ -3071,7 +3066,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\safe2.mod");
@@ -3079,7 +3074,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetZoom(1, 1.05f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 0);
pModFile->ReadModel("objects\\safe3.mod");
@@ -3103,7 +3098,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\huston2.mod");
@@ -3113,7 +3108,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetZoom(1, 3.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 1);
pModFile->ReadModel("objects\\huston3.mod");
@@ -3223,14 +3218,14 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
pPower->SetType(power<=1.0f?OBJECT_POWER:OBJECT_ATOMIC);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
pPower->SetObjectRank(0, rank);
if ( power <= 1.0f ) pModFile->ReadModel("objects\\power.mod");
else pModFile->ReadModel("objects\\atomic.mod");
pModFile->CreateEngineObject(rank);
- pPower->SetPosition(0, RetCharacter()->posPower);
+ pPower->SetPosition(0, GetCharacter()->posPower);
pPower->CreateCrashSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
pPower->SetGlobalSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.5f);
@@ -3242,12 +3237,12 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
}
#endif
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos); // to display the shadows immediately
CreateOtherObject(type);
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
delete pModFile;
return true;
@@ -3258,22 +3253,17 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
bool CObject::CreateResource(Math::Vector pos, float angle, ObjectType type,
float power)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
char name[50];
int rank;
float radius, height;
- if ( type != OBJECT_SHOW )
- {
- if ( m_engine->RetRestCreate() < 1 ) return false;
- }
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
SetEnergy(power);
@@ -3363,10 +3353,10 @@ bool CObject::CreateResource(Math::Vector pos, float angle, ObjectType type,
SetFloorHeight(0.0f);
CreateOtherObject(type);
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
FloorAdjust();
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos); // to display the shadows immediately
@@ -3378,13 +3368,11 @@ bool CObject::CreateResource(Math::Vector pos, float angle, ObjectType type,
bool CObject::CreateFlag(Math::Vector pos, float angle, ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
char name[50];
int rank, i;
- if ( m_engine->RetRestCreate() < 1+4 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
@@ -3396,7 +3384,7 @@ bool CObject::CreateFlag(Math::Vector pos, float angle, ObjectType type)
if ( type == OBJECT_FLAGv ) strcpy(name, "objects\\flag1v.mod");
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
pModFile->ReadModel(name);
pModFile->CreateEngineObject(rank);
@@ -3413,7 +3401,7 @@ bool CObject::CreateFlag(Math::Vector pos, float angle, ObjectType type)
for ( i=0 ; i<4 ; i++ )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1+i, rank);
SetObjectParent(1+i, i);
pModFile->ReadModel(name);
@@ -3427,10 +3415,10 @@ bool CObject::CreateFlag(Math::Vector pos, float angle, ObjectType type)
SetFloorHeight(0.0f);
CreateOtherObject(type);
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
FloorAdjust();
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
delete pModFile;
@@ -3442,19 +3430,17 @@ bool CObject::CreateFlag(Math::Vector pos, float angle, ObjectType type)
bool CObject::CreateBarrier(Math::Vector pos, float angle, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank;
- if ( m_engine->RetRestCreate() < 1 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
if ( type == OBJECT_BARRIER0 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\barrier0.mod");
pModFile->CreateEngineObject(rank);
@@ -3465,13 +3451,13 @@ bool CObject::CreateBarrier(Math::Vector pos, float angle, float height,
CreateCrashSphere(Math::Vector( 0.0f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector(-3.5f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(6.0f, 0.5f, D3DSHADOWWORM);
+ CreateShadowCircle(6.0f, 0.5f, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_BARRIER1 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\barrier1.mod");
pModFile->CreateEngineObject(rank);
@@ -3484,13 +3470,13 @@ bool CObject::CreateBarrier(Math::Vector pos, float angle, float height,
CreateCrashSphere(Math::Vector(-3.5f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector(-8.5f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(12.0f, 0.5f, D3DSHADOWWORM);
+ CreateShadowCircle(12.0f, 0.5f, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_BARRIER2 ) // cardboard?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\barrier2.mod");
pModFile->CreateEngineObject(rank);
@@ -3503,13 +3489,13 @@ bool CObject::CreateBarrier(Math::Vector pos, float angle, float height,
CreateCrashSphere(Math::Vector(-3.5f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector(-8.5f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(12.0f, 0.8f, D3DSHADOWWORM);
+ CreateShadowCircle(12.0f, 0.8f, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_BARRIER3 ) // match + straw?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\barrier3.mod");
pModFile->CreateEngineObject(rank);
@@ -3522,17 +3508,17 @@ bool CObject::CreateBarrier(Math::Vector pos, float angle, float height,
CreateCrashSphere(Math::Vector(-3.5f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector(-8.5f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(10.0f, 0.5f, D3DSHADOWWORM);
+ CreateShadowCircle(10.0f, 0.5f, Gfx::ENG_SHADOW_WORM);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
SetFloorHeight(0.0f);
CreateOtherObject(type);
FloorAdjust();
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos);
@@ -3545,12 +3531,10 @@ bool CObject::CreateBarrier(Math::Vector pos, float angle, float height,
bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank;
- if ( m_engine->RetRestCreate() < 1 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
@@ -3561,7 +3545,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
type == OBJECT_PLANT4 ) // standard?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
if ( type == OBJECT_PLANT0 ) pModFile->ReadModel("objects\\plant0.mod");
if ( type == OBJECT_PLANT1 ) pModFile->ReadModel("objects\\plant1.mod");
@@ -3586,7 +3570,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
type == OBJECT_PLANT7 ) // clover?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
if ( type == OBJECT_PLANT5 ) pModFile->ReadModel("objects\\plant5.mod");
if ( type == OBJECT_PLANT6 ) pModFile->ReadModel("objects\\plant6.mod");
@@ -3605,7 +3589,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
type == OBJECT_PLANT9 ) // squash?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
if ( type == OBJECT_PLANT8 ) pModFile->ReadModel("objects\\plant8.mod");
if ( type == OBJECT_PLANT9 ) pModFile->ReadModel("objects\\plant9.mod");
@@ -3626,7 +3610,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
type == OBJECT_PLANT14 ) // succulent?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
if ( type == OBJECT_PLANT10 ) pModFile->ReadModel("objects\\plant10.mod");
if ( type == OBJECT_PLANT11 ) pModFile->ReadModel("objects\\plant11.mod");
@@ -3651,7 +3635,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
type == OBJECT_PLANT19 ) // fern?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
if ( type == OBJECT_PLANT15 ) pModFile->ReadModel("objects\\plant15.mod");
if ( type == OBJECT_PLANT16 ) pModFile->ReadModel("objects\\plant16.mod");
@@ -3675,7 +3659,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
if ( type == OBJECT_TREE0 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\tree0.mod");
pModFile->CreateEngineObject(rank);
@@ -3693,7 +3677,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
if ( type == OBJECT_TREE1 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\tree1.mod");
pModFile->CreateEngineObject(rank);
@@ -3712,7 +3696,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
if ( type == OBJECT_TREE2 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\tree2.mod");
pModFile->CreateEngineObject(rank);
@@ -3731,7 +3715,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
if ( type == OBJECT_TREE3 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\tree3.mod");
pModFile->CreateEngineObject(rank);
@@ -3749,7 +3733,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
if ( type == OBJECT_TREE4 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\tree4.mod");
pModFile->CreateEngineObject(rank);
@@ -3766,7 +3750,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
if ( type == OBJECT_TREE5 ) // giant tree (for the world "teen")
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\tree5.mod");
pModFile->CreateEngineObject(rank);
@@ -3780,13 +3764,13 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
CreateShadowCircle(50.0f, 0.5f);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
SetFloorHeight(0.0f);
CreateOtherObject(type);
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos);
@@ -3799,19 +3783,17 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
bool CObject::CreateMushroom(Math::Vector pos, float angle, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank;
- if ( m_engine->RetRestCreate() < 1 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
if ( type == OBJECT_MUSHROOM1 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\mush1.mod");
pModFile->CreateEngineObject(rank);
@@ -3828,7 +3810,7 @@ bool CObject::CreateMushroom(Math::Vector pos, float angle, float height,
if ( type == OBJECT_MUSHROOM2 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\mush2.mod");
pModFile->CreateEngineObject(rank);
@@ -3842,13 +3824,13 @@ bool CObject::CreateMushroom(Math::Vector pos, float angle, float height,
CreateShadowCircle(5.0f, 0.5f);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
SetFloorHeight(0.0f);
CreateOtherObject(type);
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos);
@@ -3861,16 +3843,14 @@ bool CObject::CreateMushroom(Math::Vector pos, float angle, float height,
bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
Math::Matrix* mat;
- D3DCOLORVALUE color;
- int rank;
- float fShadow;
- bool bFloorAdjust = true;
-
- if ( m_engine->RetRestCreate() < 1 ) return false;
+ Gfx::Color color;
+ int rank;
+ float fShadow;
+ bool bFloorAdjust = true;
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
@@ -3879,7 +3859,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN0 ) // orange pencil lg=10
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen0.mod");
pModFile->CreateEngineObject(rank);
@@ -3893,13 +3873,13 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateCrashSphere(Math::Vector(-2.5f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector(-5.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(5.0f, 0.8f*fShadow, D3DSHADOWWORM);
+ CreateShadowCircle(5.0f, 0.8f*fShadow, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_TEEN1 ) // blue pencil lg=14
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen1.mod");
pModFile->CreateEngineObject(rank);
@@ -3915,13 +3895,13 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateCrashSphere(Math::Vector(-4.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector(-6.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(6.0f, 0.8f*fShadow, D3DSHADOWWORM);
+ CreateShadowCircle(6.0f, 0.8f*fShadow, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_TEEN2 ) // red pencil lg=16
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen2.mod");
pModFile->CreateEngineObject(rank);
@@ -3937,14 +3917,14 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateCrashSphere(Math::Vector(-4.7f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector(-7.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(6.0f, 0.8f*fShadow, D3DSHADOWWORM);
+ CreateShadowCircle(6.0f, 0.8f*fShadow, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_TEEN3 ) // jar with pencils
{
rank = m_engine->CreateObject();
-//? m_engine->SetObjectType(rank, TYPEFIX);
- m_engine->SetObjectType(rank, TYPEMETAL);
+//? m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_METAL);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen3.mod");
pModFile->CreateEngineObject(rank);
@@ -3960,7 +3940,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN4 ) // scissors
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen4.mod");
pModFile->CreateEngineObject(rank);
@@ -3976,13 +3956,13 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateCrashSphere(Math::Vector( 8.0f, 1.0f, 2.2f), 2.3f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector( 9.4f, 1.0f,-2.0f), 2.0f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(10.0f, 0.5f*fShadow, D3DSHADOWWORM);
+ CreateShadowCircle(10.0f, 0.5f*fShadow, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_TEEN5 ) // CD
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen5.mod");
pModFile->CreateEngineObject(rank);
@@ -3999,7 +3979,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN6 ) // book 1
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen6.mod");
pModFile->CreateEngineObject(rank);
@@ -4020,7 +4000,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN7 ) // book 2
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen7.mod");
pModFile->CreateEngineObject(rank);
@@ -4041,7 +4021,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN8 ) // a stack of books 1
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen8.mod");
pModFile->CreateEngineObject(rank);
@@ -4063,7 +4043,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN9 ) // a stack of books 2
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen9.mod");
pModFile->CreateEngineObject(rank);
@@ -4085,7 +4065,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN10 ) // bookcase
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen10.mod");
pModFile->CreateEngineObject(rank);
@@ -4111,7 +4091,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN11 ) // lamp
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen11.mod");
pModFile->CreateEngineObject(rank);
@@ -4120,9 +4100,9 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
SetFloorHeight(0.0f);
SetZoom(0, zoom);
- mat = RetWorldMatrix(0);
+ mat = GetWorldMatrix(0);
pos = Math::Transform(*mat, Math::Vector(-56.0f, 22.0f, 0.0f));
- m_particule->CreateParticule(pos, Math::Vector(0.0f, 0.0f, 0.0f), Math::Point(20.0f, 20.0f), PARTISELY, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), Math::Point(20.0f, 20.0f), Gfx::PARTISELY, 1.0f, 0.0f, 0.0f);
pos = Math::Transform(*mat, Math::Vector(-65.0f, 40.0f, 0.0f));
color.r = 4.0f;
@@ -4135,8 +4115,8 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN12 ) // coke
{
rank = m_engine->CreateObject();
-//? m_engine->SetObjectType(rank, TYPEFIX);
- m_engine->SetObjectType(rank, TYPEMETAL);
+//? m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_METAL);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen12.mod");
pModFile->CreateEngineObject(rank);
@@ -4152,7 +4132,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN13 ) // cardboard farm
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen13.mod");
pModFile->CreateEngineObject(rank);
@@ -4177,7 +4157,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN14 ) // open box
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen14.mod");
pModFile->CreateEngineObject(rank);
@@ -4202,7 +4182,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN15 ) // stack of cartons
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen15.mod");
pModFile->CreateEngineObject(rank);
@@ -4227,7 +4207,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN16 ) // watering can
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen16.mod");
pModFile->CreateEngineObject(rank);
@@ -4245,7 +4225,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN17 ) // wheel |
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen17.mod");
pModFile->CreateEngineObject(rank);
@@ -4261,7 +4241,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN18 ) // wheel /
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen18.mod");
pModFile->CreateEngineObject(rank);
@@ -4277,7 +4257,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN19 ) // wheel =
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen19.mod");
pModFile->CreateEngineObject(rank);
@@ -4293,7 +4273,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN20 ) // wall with shelf
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen20.mod");
pModFile->CreateEngineObject(rank);
@@ -4314,7 +4294,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN21 ) // wall with window
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen21.mod");
pModFile->CreateEngineObject(rank);
@@ -4326,7 +4306,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN22 ) // wall with door and shelf
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen22.mod");
pModFile->CreateEngineObject(rank);
@@ -4343,7 +4323,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN23 ) // skateboard on wheels
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen23.mod");
pModFile->CreateEngineObject(rank);
@@ -4364,13 +4344,13 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateCrashSphere(Math::Vector( 23.0f, 2.0f, 0.0f), 3.0f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector( 23.0f, 2.0f,-7.0f), 3.0f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(35.0f, 0.8f*fShadow, D3DSHADOWWORM);
+ CreateShadowCircle(35.0f, 0.8f*fShadow, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_TEEN24 ) // skate /
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen24.mod");
pModFile->CreateEngineObject(rank);
@@ -4386,7 +4366,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN25 ) // skate /
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen25.mod");
pModFile->CreateEngineObject(rank);
@@ -4402,7 +4382,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN26 ) // ceiling lamp
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen26.mod");
pModFile->CreateEngineObject(rank);
@@ -4411,9 +4391,9 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
SetZoom(0, zoom);
SetFloorHeight(0.0f);
- mat = RetWorldMatrix(0);
+ mat = GetWorldMatrix(0);
pos = Math::Transform(*mat, Math::Vector(0.0f, 50.0f, 0.0f));
- m_particule->CreateParticule(pos, Math::Vector(0.0f, 0.0f, 0.0f), Math::Point(100.0f, 100.0f), PARTISELY, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), Math::Point(100.0f, 100.0f), Gfx::PARTISELY, 1.0f, 0.0f, 0.0f);
pos = Math::Transform(*mat, Math::Vector(0.0f, 50.0f, 0.0f));
color.r = 4.0f;
@@ -4426,7 +4406,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN27 ) // large plant?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen27.mod");
pModFile->CreateEngineObject(rank);
@@ -4441,8 +4421,8 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN28 ) // bottle?
{
rank = m_engine->CreateObject();
-//? m_engine->SetObjectType(rank, TYPEFIX);
- m_engine->SetObjectType(rank, TYPEMETAL);
+//? m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_METAL);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen28.mod");
pModFile->CreateEngineObject(rank);
@@ -4457,7 +4437,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN29 ) // bridge?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen29.mod");
pModFile->CreateEngineObject(rank);
@@ -4470,7 +4450,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN30 ) // jump?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen30.mod");
pModFile->CreateEngineObject(rank);
@@ -4486,7 +4466,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN31 ) // basket?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen31.mod");
pModFile->CreateEngineObject(rank);
@@ -4505,7 +4485,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN32 ) // chair?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen32.mod");
pModFile->CreateEngineObject(rank);
@@ -4524,7 +4504,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN33 ) // panel?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen33.mod");
pModFile->CreateEngineObject(rank);
@@ -4539,7 +4519,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN34 ) // stone?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen34.mod");
pModFile->CreateEngineObject(rank);
@@ -4554,7 +4534,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN35 ) // pipe?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen35.mod");
pModFile->CreateEngineObject(rank);
@@ -4567,13 +4547,13 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateCrashSphere(Math::Vector( 0.0f, 5.0f, 0.0f), 10.0f, SOUND_BOUM, 0.10f);
CreateCrashSphere(Math::Vector( 20.0f, 5.0f, 0.0f), 10.0f, SOUND_BOUM, 0.10f);
CreateCrashSphere(Math::Vector( 40.0f, 5.0f, 0.0f), 10.0f, SOUND_BOUM, 0.10f);
- CreateShadowCircle(40.0f, 0.8f*fShadow, D3DSHADOWWORM);
+ CreateShadowCircle(40.0f, 0.8f*fShadow, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_TEEN36 ) // trunk?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen36.mod");
pModFile->CreateEngineObject(rank);
@@ -4586,7 +4566,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN37 ) // boat?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen37.mod");
pModFile->CreateEngineObject(rank);
@@ -4599,7 +4579,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN38 ) // fan?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen38a.mod");
pModFile->CreateEngineObject(rank);
@@ -4608,7 +4588,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
SetZoom(0, zoom);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\teen38b.mod"); // engine
@@ -4616,7 +4596,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
SetPosition(1, Math::Vector(0.0f, 30.0f, 0.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 1);
pModFile->ReadModel("objects\\teen38c.mod"); // propeller
@@ -4631,7 +4611,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN39 ) // potted plant?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen39.mod");
pModFile->CreateEngineObject(rank);
@@ -4647,7 +4627,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN40 ) // balloon?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen40.mod");
pModFile->CreateEngineObject(rank);
@@ -4663,7 +4643,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN41 ) // fence?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen41.mod");
pModFile->CreateEngineObject(rank);
@@ -4675,7 +4655,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN42 ) // clover?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen42.mod");
pModFile->CreateEngineObject(rank);
@@ -4690,7 +4670,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN43 ) // clover?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen43.mod");
pModFile->CreateEngineObject(rank);
@@ -4705,7 +4685,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN44 ) // car?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen44.mod");
pModFile->CreateEngineObject(rank);
@@ -4718,7 +4698,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateShadowCircle(55.0f, 1.0f*fShadow);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
if ( bFloorAdjust )
@@ -4729,7 +4709,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateOtherObject(type);
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos);
@@ -4742,20 +4722,18 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
bool CObject::CreateQuartz(Math::Vector pos, float angle, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
float radius;
int rank;
- if ( m_engine->RetRestCreate() < 1 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
if ( type == OBJECT_QUARTZ0 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEQUARTZ);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_QUARTZ);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\quartz0.mod");
pModFile->CreateEngineObject(rank);
@@ -4770,7 +4748,7 @@ bool CObject::CreateQuartz(Math::Vector pos, float angle, float height,
if ( type == OBJECT_QUARTZ1 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEQUARTZ);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_QUARTZ);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\quartz1.mod");
pModFile->CreateEngineObject(rank);
@@ -4785,7 +4763,7 @@ bool CObject::CreateQuartz(Math::Vector pos, float angle, float height,
if ( type == OBJECT_QUARTZ2 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEQUARTZ);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_QUARTZ);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\quartz2.mod");
pModFile->CreateEngineObject(rank);
@@ -4800,7 +4778,7 @@ bool CObject::CreateQuartz(Math::Vector pos, float angle, float height,
if ( type == OBJECT_QUARTZ3 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEQUARTZ);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_QUARTZ);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\quartz3.mod");
pModFile->CreateEngineObject(rank);
@@ -4813,13 +4791,13 @@ bool CObject::CreateQuartz(Math::Vector pos, float angle, float height,
CreateShadowCircle(10.0f, 0.5f);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
SetFloorHeight(0.0f);
CreateOtherObject(type);
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos);
@@ -4843,8 +4821,8 @@ bool CObject::CreateQuartz(Math::Vector pos, float angle, float height,
pos.y += 16.0f;
radius = 8.0f;
}
- m_particule->CreateParticule(pos, pos, Math::Point(2.0f, 2.0f), PARTIQUARTZ, 0.7f+Math::Rand()*0.7f, radius, 0.0f);
- m_particule->CreateParticule(pos, pos, Math::Point(2.0f, 2.0f), PARTIQUARTZ, 0.7f+Math::Rand()*0.7f, radius, 0.0f);
+ m_particle->CreateParticle(pos, pos, Math::Point(2.0f, 2.0f), Gfx::PARTIQUARTZ, 0.7f+Math::Rand()*0.7f, radius, 0.0f);
+ m_particle->CreateParticle(pos, pos, Math::Point(2.0f, 2.0f), Gfx::PARTIQUARTZ, 0.7f+Math::Rand()*0.7f, radius, 0.0f);
delete pModFile;
return true;
@@ -4855,19 +4833,17 @@ bool CObject::CreateQuartz(Math::Vector pos, float angle, float height,
bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank;
- if ( m_engine->RetRestCreate() < 1 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
if ( type == OBJECT_ROOT0 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\root0.mod");
pModFile->CreateEngineObject(rank);
@@ -4889,7 +4865,7 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
if ( type == OBJECT_ROOT1 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\root1.mod");
pModFile->CreateEngineObject(rank);
@@ -4911,7 +4887,7 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
if ( type == OBJECT_ROOT2 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\root2.mod");
pModFile->CreateEngineObject(rank);
@@ -4932,7 +4908,7 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
if ( type == OBJECT_ROOT3 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\root3.mod");
pModFile->CreateEngineObject(rank);
@@ -4955,7 +4931,7 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
if ( type == OBJECT_ROOT4 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\root4.mod");
pModFile->CreateEngineObject(rank);
@@ -4980,7 +4956,7 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
if ( type == OBJECT_ROOT5 ) // gravity root ?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\root4.mod");
pModFile->CreateEngineObject(rank);
@@ -4989,7 +4965,7 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
SetZoom(0, 2.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\root5.mod");
@@ -5013,13 +4989,13 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
CreateShadowCircle(30.0f, 0.5f);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
SetFloorHeight(0.0f);
CreateOtherObject(type);
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos);
@@ -5032,19 +5008,17 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
bool CObject::CreateHome(Math::Vector pos, float angle, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank;
- if ( m_engine->RetRestCreate() < 1 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
if ( type == OBJECT_HOME1 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\home1.mod");
pModFile->CreateEngineObject(rank);
@@ -5057,13 +5031,13 @@ bool CObject::CreateHome(Math::Vector pos, float angle, float height,
CreateShadowCircle(16.0f, 0.5f);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
SetFloorHeight(0.0f);
CreateOtherObject(type);
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos);
@@ -5076,18 +5050,16 @@ bool CObject::CreateHome(Math::Vector pos, float angle, float height,
bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
char name[50];
int rank;
- if ( m_engine->RetRestCreate() < 1+4 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
name[0] = 0;
@@ -5115,7 +5087,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
{
// Creates the right-back wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(6, rank);
SetObjectParent(6, 0);
@@ -5127,7 +5099,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
// Creates the left-back wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(7, rank);
SetObjectParent(7, 0);
@@ -5140,7 +5112,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
// Creates the right-front wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(8, rank);
SetObjectParent(8, 0);
@@ -5152,7 +5124,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
// Creates the left-front wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(9, rank);
SetObjectParent(9, 0);
@@ -5173,7 +5145,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
{
// Creates the left-back wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(7, rank);
SetObjectParent(7, 0);
@@ -5186,7 +5158,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
// Creates the left-front wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(9, rank);
SetObjectParent(9, 0);
@@ -5207,7 +5179,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
{
// Creates the cannon.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
@@ -5339,7 +5311,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
CreateShadowCircle(30.0f, 1.0f);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); //to display the shadows immediately
SetFloorHeight(0.0f);
@@ -5352,145 +5324,145 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
FloorAdjust();
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos); //to display the shadows immediately
if ( type == OBJECT_RUINmobilew1 )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 0.5f;
SetPosition(0, pos);
- angle = RetAngleX(0)-0.1f;
+ angle = GetAngleX(0)-0.1f;
SetAngleX(0, angle);
}
if ( type == OBJECT_RUINmobilew2 )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 1.5f;
SetPosition(0, pos);
- angle = RetAngleX(0)-0.9f;
+ angle = GetAngleX(0)-0.9f;
SetAngleX(0, angle);
- angle = RetAngleZ(0)-0.1f;
+ angle = GetAngleZ(0)-0.1f;
SetAngleZ(0, angle);
}
if ( type == OBJECT_RUINmobilet1 )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 0.9f;
SetPosition(0, pos);
- angle = RetAngleX(0)-0.3f;
+ angle = GetAngleX(0)-0.3f;
SetAngleX(0, angle);
}
if ( type == OBJECT_RUINmobilet2 )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 1.5f;
SetPosition(0, pos);
- angle = RetAngleX(0)-0.3f;
+ angle = GetAngleX(0)-0.3f;
SetAngleX(0, angle);
- angle = RetAngleZ(0)+0.8f;
+ angle = GetAngleZ(0)+0.8f;
SetAngleZ(0, angle);
}
if ( type == OBJECT_RUINmobiler1 )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += 4.0f;
SetPosition(0, pos);
- angle = RetAngleX(0)-Math::PI*0.6f;
+ angle = GetAngleX(0)-Math::PI*0.6f;
SetAngleX(0, angle);
- angle = RetAngleZ(0)-0.2f;
+ angle = GetAngleZ(0)-0.2f;
SetAngleZ(0, angle);
}
if ( type == OBJECT_RUINmobiler2 )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += 2.0f;
SetPosition(0, pos);
- angle = RetAngleX(0)-0.1f;
+ angle = GetAngleX(0)-0.1f;
SetAngleX(0, angle);
- angle = RetAngleZ(0)-0.3f;
+ angle = GetAngleZ(0)-0.3f;
SetAngleZ(0, angle);
}
if ( type == OBJECT_RUINdoor )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 0.5f;
SetPosition(0, pos);
- angle = RetAngleZ(0)-0.1f;
+ angle = GetAngleZ(0)-0.1f;
SetAngleZ(0, angle);
}
if ( type == OBJECT_RUINsupport )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += 0.5f;
SetPosition(0, pos);
-//? angle = RetAngleY(0)+0.1f;
+//? angle = GetAngleY(0)+0.1f;
//? SetAngleY(0, angle);
- angle = RetAngleX(0)+0.1f;
+ angle = GetAngleX(0)+0.1f;
SetAngleX(0, angle);
- angle = RetAngleZ(0)+0.1f;
+ angle = GetAngleZ(0)+0.1f;
SetAngleZ(0, angle);
}
if ( type == OBJECT_RUINradar )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 0.5f;
SetPosition(0, pos);
- angle = RetAngleX(0)+0.15f;
+ angle = GetAngleX(0)+0.15f;
SetAngleX(0, angle);
- angle = RetAngleZ(0)+0.1f;
+ angle = GetAngleZ(0)+0.1f;
SetAngleZ(0, angle);
}
if ( type == OBJECT_RUINconvert )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 1.0f;
SetPosition(0, pos);
}
if ( type == OBJECT_RUINbase )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 1.0f;
SetPosition(0, pos);
- angle = RetAngleX(0)+0.15f;
+ angle = GetAngleX(0)+0.15f;
SetAngleX(0, angle);
}
if ( type == OBJECT_RUINhead )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += 8.0f;
SetPosition(0, pos);
- angle = RetAngleX(0)+Math::PI*0.4f;
+ angle = GetAngleX(0)+Math::PI*0.4f;
SetAngleX(0, angle);
}
@@ -5502,19 +5474,17 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank, i;
- if ( m_engine->RetRestCreate() < 6 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
if ( type == OBJECT_APOLLO1 ) // LEM ?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\apollol1.mod");
pModFile->CreateEngineObject(rank);
@@ -5526,7 +5496,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
for ( i=0 ; i<4 ; i++ ) // creates feet
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(i+1, rank);
SetObjectParent(i+1, 0);
pModFile->ReadModel("objects\\apollol2.mod");
@@ -5535,7 +5505,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
}
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(5, rank);
SetObjectParent(5, 0);
pModFile->ReadModel("objects\\apollol3.mod"); // ladder
@@ -5557,7 +5527,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
if ( type == OBJECT_APOLLO2 ) // jeep
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); //it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); //it is a stationary object
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\apolloj1.mod");
pModFile->CreateEngineObject(rank);
@@ -5567,7 +5537,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
// Wheels.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\apolloj4.mod"); // wheel
@@ -5575,7 +5545,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
SetPosition(1, Math::Vector(-5.75f, 1.65f, -5.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 0);
pModFile->ReadModel("objects\\apolloj4.mod"); // wheel
@@ -5583,7 +5553,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
SetPosition(2, Math::Vector(-5.75f, 1.65f, 5.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(3, rank);
SetObjectParent(3, 0);
pModFile->ReadModel("objects\\apolloj4.mod"); // wheel
@@ -5591,7 +5561,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
SetPosition(3, Math::Vector(5.75f, 1.65f, -5.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(4, rank);
SetObjectParent(4, 0);
pModFile->ReadModel("objects\\apolloj4.mod"); // wheel
@@ -5600,7 +5570,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
// Accessories:
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(5, rank);
SetObjectParent(5, 0);
pModFile->ReadModel("objects\\apolloj2.mod"); // antenna
@@ -5610,7 +5580,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
SetAngleZ(5, 45.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(6, rank);
SetObjectParent(6, 0);
pModFile->ReadModel("objects\\apolloj3.mod"); // camera
@@ -5630,7 +5600,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
if ( type == OBJECT_APOLLO3 ) // flag?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\apollof.mod");
pModFile->CreateEngineObject(rank);
@@ -5645,7 +5615,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
if ( type == OBJECT_APOLLO4 ) // module?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\apollom.mod");
pModFile->CreateEngineObject(rank);
@@ -5662,7 +5632,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
if ( type == OBJECT_APOLLO5 ) // antenna?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\apolloa.mod");
pModFile->CreateEngineObject(rank);
@@ -5671,7 +5641,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\apolloj2.mod"); // antenna
@@ -5686,7 +5656,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
CreateOtherObject(type);
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
delete pModFile;
@@ -5804,7 +5774,7 @@ void CObject::CreateOtherObject(ObjectType type)
// Reads a program.
-bool CObject::ReadProgram(int rank, char* filename)
+bool CObject::ReadProgram(int rank, const char* filename)
{
if ( m_brain != 0 )
{
@@ -5845,7 +5815,7 @@ bool CObject::RunProgram(int rank)
// Calculates the matrix for transforming the object.
-// Returns true if the matrix has changed.
+// Geturns true if the matrix has changed.
// The rotations occur in the order Y, Z and X.
bool CObject::UpdateTransformObject(int part, bool bForceUpdate)
@@ -5916,7 +5886,7 @@ bool CObject::UpdateTransformObject(int part, bool bForceUpdate)
if ( part == 0 && m_truck != 0 ) // transported by a truck?
{
Math::Matrix* matWorldTruck;
- matWorldTruck = m_truck->RetWorldMatrix(m_truckLink);
+ matWorldTruck = m_truck->GetWorldMatrix(m_truckLink);
m_objectPart[part].matWorld = Math::MultiplyMatrices(*matWorldTruck,
m_objectPart[part].matTransform);
}
@@ -6043,7 +6013,7 @@ void CObject::FlatParent()
void CObject::UpdateEnergyMapping()
{
- D3DMATERIAL7 mat;
+ Gfx::Material mat;
float a, b, i, s, au, bu;
float limit[6];
int j;
@@ -6051,7 +6021,7 @@ void CObject::UpdateEnergyMapping()
if ( fabs(m_energy-m_lastEnergy) < 0.01f ) return;
m_lastEnergy = m_energy;
- ZeroMemory( &mat, sizeof(D3DMATERIAL7) );
+ memset(&mat, 0, sizeof(mat));
mat.diffuse.r = 1.0f;
mat.diffuse.g = 1.0f;
mat.diffuse.b = 1.0f; // white
@@ -6083,17 +6053,17 @@ void CObject::UpdateEnergyMapping()
bu = s-b*(s-i)/(b-a);
limit[0] = 0.0f;
- limit[1] = m_engine->RetLimitLOD(0);
+ limit[1] = m_engine->GetLimitLOD(0);
limit[2] = limit[1];
- limit[3] = m_engine->RetLimitLOD(1);
+ limit[3] = m_engine->GetLimitLOD(1);
limit[4] = limit[3];
limit[5] = 1000000.0f;
for ( j=0 ; j<3 ; j++ )
{
m_engine->ChangeTextureMapping(m_objectPart[0].object,
- mat, D3DSTATEPART3, "lemt.tga", "",
- limit[j*2+0], limit[j*2+1], D3DMAPPING1Y,
+ mat, Gfx::ENG_RSTATE_PART3, "lemt.tga", "",
+ limit[j*2+0], limit[j*2+1], Gfx::ENG_TEX_MAPPING_1Y,
au, bu, 1.0f, 0.0f);
}
}
@@ -6103,7 +6073,7 @@ void CObject::UpdateEnergyMapping()
bool CObject::EventProcess(const Event &event)
{
- if ( event.event == EVENT_KEYDOWN )
+ if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ONBOARD
if ( m_bSelect )
@@ -6147,12 +6117,12 @@ bool CObject::EventProcess(const Event &event)
{
if ( !m_physics->EventProcess(event) ) // object destroyed?
{
- if ( RetSelect() &&
+ if ( GetSelect() &&
m_type != OBJECT_ANT &&
m_type != OBJECT_SPIDER &&
m_type != OBJECT_BEE )
{
- if ( !m_bDead ) m_camera->SetType(CAMERA_EXPLO);
+ if ( !m_bDead ) m_camera->SetType(Gfx::CAM_TYPE_EXPLO);
m_main->DeselectAll();
}
return false;
@@ -6163,7 +6133,7 @@ bool CObject::EventProcess(const Event &event)
{
m_auto->EventProcess(event);
- if ( event.event == EVENT_FRAME &&
+ if ( event.type == EVENT_FRAME &&
m_auto->IsEnded() != ERR_CONTINUE )
{
m_auto->DeleteObject();
@@ -6177,7 +6147,7 @@ bool CObject::EventProcess(const Event &event)
m_motion->EventProcess(event);
}
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
@@ -6190,13 +6160,13 @@ bool CObject::EventProcess(const Event &event)
bool CObject::EventFrame(const Event &event)
{
- if ( m_type == OBJECT_HUMAN && m_main->RetMainMovie() == MM_SATCOMopen )
+ if ( m_type == OBJECT_HUMAN && m_main->GetMainMovie() == MM_SATCOMopen )
{
UpdateTransformObject();
return true;
}
- if ( m_type != OBJECT_SHOW && m_engine->RetPause() ) return true;
+ if ( m_type != OBJECT_SHOW && m_engine->GetPause() ) return true;
m_aTime += event.rTime;
m_shotTime += event.rTime;
@@ -6206,23 +6176,23 @@ bool CObject::EventFrame(const Event &event)
UpdateMapping();
UpdateTransformObject();
- UpdateSelectParticule();
+ UpdateSelectParticle();
if ( m_bProxyActivate ) // active if it is near?
{
- CPyro* pyro;
+ Gfx::CPyro* pyro;
Math::Vector eye;
float dist;
- eye = m_engine->RetLookatPt();
- dist = Math::Distance(eye, RetPosition(0));
+ eye = m_engine->GetLookatPt();
+ dist = Math::Distance(eye, GetPosition(0));
if ( dist < m_proxyDistance )
{
m_bProxyActivate = false;
m_main->CreateShortcuts();
m_sound->Play(SOUND_FINDING);
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_FINDING, this, 0.0f);
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_FINDING, this, 0.0f);
m_displayText->DisplayError(INFO_FINDING, this);
}
}
@@ -6248,10 +6218,10 @@ void CObject::UpdateMapping()
void CObject::VirusFrame(float rTime)
{
- ParticuleType type;
+ Gfx::ParticleType type;
Math::Vector pos, speed;
Math::Point dim;
- int r;
+ int r;
if ( !m_bVirusMode ) return; // healthy object?
@@ -6261,23 +6231,23 @@ void CObject::VirusFrame(float rTime)
m_bVirusMode = false; // the virus is no longer active
}
- if ( m_lastVirusParticule+m_engine->ParticuleAdapt(0.2f) <= m_aTime )
+ if ( m_lastVirusParticle+m_engine->ParticleAdapt(0.2f) <= m_aTime )
{
- m_lastVirusParticule = m_aTime;
+ m_lastVirusParticle = m_aTime;
r = rand()%10;
- if ( r == 0 ) type = PARTIVIRUS1;
- if ( r == 1 ) type = PARTIVIRUS2;
- if ( r == 2 ) type = PARTIVIRUS3;
- if ( r == 3 ) type = PARTIVIRUS4;
- if ( r == 4 ) type = PARTIVIRUS5;
- if ( r == 5 ) type = PARTIVIRUS6;
- if ( r == 6 ) type = PARTIVIRUS7;
- if ( r == 7 ) type = PARTIVIRUS8;
- if ( r == 8 ) type = PARTIVIRUS9;
- if ( r == 9 ) type = PARTIVIRUS10;
-
- pos = RetPosition(0);
+ if ( r == 0 ) type = Gfx::PARTIVIRUS1;
+ if ( r == 1 ) type = Gfx::PARTIVIRUS2;
+ if ( r == 2 ) type = Gfx::PARTIVIRUS3;
+ if ( r == 3 ) type = Gfx::PARTIVIRUS4;
+ if ( r == 4 ) type = Gfx::PARTIVIRUS5;
+ if ( r == 5 ) type = Gfx::PARTIVIRUS6;
+ if ( r == 6 ) type = Gfx::PARTIVIRUS7;
+ if ( r == 7 ) type = Gfx::PARTIVIRUS8;
+ if ( r == 8 ) type = Gfx::PARTIVIRUS9;
+ if ( r == 9 ) type = Gfx::PARTIVIRUS10;
+
+ pos = GetPosition(0);
pos.x += (Math::Rand()-0.5f)*10.0f;
pos.z += (Math::Rand()-0.5f)*10.0f;
speed.x = (Math::Rand()-0.5f)*2.0f;
@@ -6286,7 +6256,7 @@ void CObject::VirusFrame(float rTime)
dim.x = Math::Rand()*0.3f+0.3f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, type, 3.0f);
+ m_particle->CreateParticle(pos, speed, dim, type, 3.0f);
}
}
@@ -6304,7 +6274,7 @@ void CObject::PartiFrame(float rTime)
channel = m_objectPart[i].masterParti;
if ( channel == -1 ) continue;
- if ( !m_particule->GetPosition(channel, pos) )
+ if ( !m_particle->GetPosition(channel, pos) )
{
m_objectPart[i].masterParti = -1; // particle no longer exists!
continue;
@@ -6322,7 +6292,7 @@ void CObject::PartiFrame(float rTime)
case 4: factor = Math::Vector( 0.4f, 0.1f,-0.7f); break;
}
- angle = RetAngle(i);
+ angle = GetAngle(i);
angle += rTime*Math::PI*factor;
SetAngle(i, angle);
}
@@ -6334,7 +6304,7 @@ void CObject::PartiFrame(float rTime)
void CObject::SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV,
Math::Vector &lookat, Math::Vector &upVec,
- CameraType type)
+ Gfx::CameraType type)
{
float speed;
int part;
@@ -6429,7 +6399,7 @@ void CObject::SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV,
m_engine->SetInfoText(4, s);
#endif
- if ( type == CAMERA_BACK )
+ if ( type == Gfx::CAM_TYPE_BACK )
{
eye.x -= 20.0f;
eye.y += 1.0f;
@@ -6446,20 +6416,20 @@ void CObject::SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV,
upVec = Math::Vector(0.0f, 1.0f, 0.0f);
if ( m_physics != 0 )
{
- if ( m_physics->RetLand() ) // on ground?
+ if ( m_physics->GetLand() ) // on ground?
{
- speed = m_physics->RetLinMotionX(MO_REASPEED);
+ speed = m_physics->GetLinMotionX(MO_REASPEED);
lookat.y -= speed*0.002f;
- speed = m_physics->RetCirMotionY(MO_REASPEED);
+ speed = m_physics->GetCirMotionY(MO_REASPEED);
upVec.z -= speed*0.04f;
}
else // in flight?
{
- speed = m_physics->RetLinMotionX(MO_REASPEED);
+ speed = m_physics->GetLinMotionX(MO_REASPEED);
lookat.y += speed*0.002f;
- speed = m_physics->RetCirMotionY(MO_REASPEED);
+ speed = m_physics->GetCirMotionY(MO_REASPEED);
upVec.z += speed*0.08f;
}
}
@@ -6475,23 +6445,23 @@ void CObject::SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV,
void CObject::SetCharacter(Character* character)
{
- CopyMemory(&m_character, character, sizeof(Character));
+ memcpy(&m_character, character, sizeof(m_character));
}
void CObject::GetCharacter(Character* character)
{
- CopyMemory(character, &m_character, sizeof(Character));
+ memcpy(character, &m_character, sizeof(character));
}
-Character* CObject::RetCharacter()
+Character* CObject::GetCharacter()
{
return &m_character;
}
-// Returns the absolute time.
+// Geturns the absolute time.
-float CObject::RetAbsTime()
+float CObject::GetAbsTime()
{
return m_aTime;
}
@@ -6507,7 +6477,7 @@ void CObject::SetEnergy(float level)
m_energy = level;
}
-float CObject::RetEnergy()
+float CObject::GetEnergy()
{
if ( m_type != OBJECT_POWER &&
m_type != OBJECT_ATOMIC &&
@@ -6526,7 +6496,7 @@ void CObject::SetCapacity(float capacity)
m_capacity = capacity;
}
-float CObject::RetCapacity()
+float CObject::GetCapacity()
{
return m_capacity;
}
@@ -6539,7 +6509,7 @@ void CObject::SetShield(float level)
m_shield = level;
}
-float CObject::RetShield()
+float CObject::GetShield()
{
if ( m_type == OBJECT_FRET ||
m_type == OBJECT_STONE ||
@@ -6582,7 +6552,7 @@ void CObject::SetRange(float delay)
m_range = delay;
}
-float CObject::RetRange()
+float CObject::GetRange()
{
return m_range;
}
@@ -6610,7 +6580,7 @@ void CObject::SetTransparency(float value)
}
}
-float CObject::RetTransparency()
+float CObject::GetTransparency()
{
return m_transparency;
}
@@ -6618,7 +6588,7 @@ float CObject::RetTransparency()
// Management of the object matter.
-ObjectMaterial CObject::RetMaterial()
+ObjectMaterial CObject::GetMaterial()
{
if ( m_type == OBJECT_HUMAN )
{
@@ -6642,7 +6612,7 @@ void CObject::SetGadget(bool bMode)
m_bGadget = bMode;
}
-bool CObject::RetGadget()
+bool CObject::GetGadget()
{
return m_bGadget;
}
@@ -6655,7 +6625,7 @@ void CObject::SetFixed(bool bFixed)
m_bFixed = bFixed;
}
-bool CObject::RetFixed()
+bool CObject::GetFixed()
{
return m_bFixed;
}
@@ -6668,7 +6638,7 @@ void CObject::SetClip(bool bClip)
m_bClip = bClip;
}
-bool CObject::RetClip()
+bool CObject::GetClip()
{
return m_bClip;
}
@@ -6696,7 +6666,7 @@ bool CObject::JostleObject(float force)
if ( m_auto != 0 ) return false;
m_auto = new CAutoJostle(m_iMan, this);
- pa = (CAutoJostle*)m_auto;
+ pa = static_cast<CAutoJostle*>(m_auto);
pa->Start(0, force);
}
@@ -6712,7 +6682,7 @@ void CObject::StartDetectEffect(CObject *target, bool bFound)
Math::Vector pos, goal;
Math::Point dim;
- mat = RetWorldMatrix(0);
+ mat = GetWorldMatrix(0);
pos = Math::Transform(*mat, Math::Vector(2.0f, 3.0f, 0.0f));
if ( target == 0 )
@@ -6721,24 +6691,24 @@ void CObject::StartDetectEffect(CObject *target, bool bFound)
}
else
{
- goal = target->RetPosition(0);
+ goal = target->GetPosition(0);
goal.y += 3.0f;
goal = Math::SegmentPoint(pos, goal, Math::Distance(pos, goal)-3.0f);
}
dim.x = 3.0f;
dim.y = dim.x;
- m_particule->CreateRay(pos, goal, PARTIRAY2, dim, 0.2f);
+ m_particle->CreateRay(pos, goal, Gfx::PARTIRAY2, dim, 0.2f);
if ( target != 0 )
{
- goal = target->RetPosition(0);
+ goal = target->GetPosition(0);
goal.y += 3.0f;
goal = Math::SegmentPoint(pos, goal, Math::Distance(pos, goal)-1.0f);
dim.x = 6.0f;
dim.y = dim.x;
- m_particule->CreateParticule(goal, Math::Vector(0.0f, 0.0f, 0.0f), dim,
- bFound?PARTIGLINT:PARTIGLINTr, 0.5f);
+ m_particle->CreateParticle(goal, Math::Vector(0.0f, 0.0f, 0.0f), dim,
+ bFound?Gfx::PARTIGLINT:Gfx::PARTIGLINTr, 0.5f);
}
m_sound->Play(bFound?SOUND_BUILD:SOUND_RECOVER);
@@ -6761,12 +6731,12 @@ void CObject::SetVirusMode(bool bEnable)
}
}
-bool CObject::RetVirusMode()
+bool CObject::GetVirusMode()
{
return m_bVirusMode;
}
-float CObject::RetVirusTime()
+float CObject::GetVirusTime()
{
return m_virusTime;
}
@@ -6774,12 +6744,12 @@ float CObject::RetVirusTime()
// Management mode of the camera.
-void CObject::SetCameraType(CameraType type)
+void CObject::SetCameraType(Gfx::CameraType type)
{
m_cameraType = type;
}
-CameraType CObject::RetCameraType()
+Gfx::CameraType CObject::GetCameraType()
{
return m_cameraType;
}
@@ -6789,7 +6759,7 @@ void CObject::SetCameraDist(float dist)
m_cameraDist = dist;
}
-float CObject::RetCameraDist()
+float CObject::GetCameraDist()
{
return m_cameraDist;
}
@@ -6799,7 +6769,7 @@ void CObject::SetCameraLock(bool bLock)
m_bCameraLock = bLock;
}
-bool CObject::RetCameraLock()
+bool CObject::GetCameraLock()
{
return m_bCameraLock;
}
@@ -6827,11 +6797,11 @@ void CObject::SetHilite(bool bMode)
}
list[j] = -1; // terminate
- m_engine->SetHiliteRank(list); // gives the list of selected parts
+ m_engine->SetHighlightRank(list); // gives the list of selected parts
}
}
-bool CObject::RetHilite()
+bool CObject::GetHilite()
{
return m_bHilite;
}
@@ -6855,7 +6825,7 @@ void CObject::SetSelect(bool bMode, bool bDisplayError)
m_auto->CreateInterface(m_bSelect);
}
- CreateSelectParticule(); // creates / removes particles
+ CreateSelectParticle(); // creates / removes particles
if ( !m_bSelect )
{
@@ -6866,11 +6836,11 @@ void CObject::SetSelect(bool bMode, bool bDisplayError)
err = ERR_OK;
if ( m_physics != 0 )
{
- err = m_physics->RetError();
+ err = m_physics->GetError();
}
if ( m_auto != 0 )
{
- err = m_auto->RetError();
+ err = m_auto->GetError();
}
if ( err != ERR_OK && bDisplayError )
{
@@ -6880,9 +6850,9 @@ void CObject::SetSelect(bool bMode, bool bDisplayError)
// Indicates whether the object is selected or not.
-bool CObject::RetSelect(bool bReal)
+bool CObject::GetSelect(bool bReal)
{
- if ( !bReal && m_main->RetFixScene() ) return false;
+ if ( !bReal && m_main->GetFixScene() ) return false;
return m_bSelect;
}
@@ -6896,7 +6866,7 @@ void CObject::SetSelectable(bool bMode)
// Indicates whether the object is selecionnable or not.
-bool CObject::RetSelectable()
+bool CObject::GetSelectable()
{
return m_bSelectable;
}
@@ -6912,11 +6882,11 @@ void CObject::SetActivity(bool bMode)
}
}
-bool CObject::RetActivity()
+bool CObject::GetActivity()
{
if ( m_brain != 0 )
{
- return m_brain->RetActivity();
+ return m_brain->GetActivity();
}
return false;
}
@@ -6931,7 +6901,7 @@ void CObject::SetCheckToken(bool bMode)
// Indicates if necessary to check the tokens of the object.
-bool CObject::RetCheckToken()
+bool CObject::GetCheckToken()
{
return m_bCheckToken;
}
@@ -6946,7 +6916,7 @@ void CObject::SetVisible(bool bVisible)
m_bVisible = bVisible;
}
-bool CObject::RetVisible()
+bool CObject::GetVisible()
{
return m_bVisible;
}
@@ -6962,7 +6932,7 @@ void CObject::SetEnable(bool bEnable)
m_bEnable = bEnable;
}
-bool CObject::RetEnable()
+bool CObject::GetEnable()
{
return m_bEnable;
}
@@ -6975,7 +6945,7 @@ void CObject::SetProxyActivate(bool bActivate)
m_bProxyActivate = bActivate;
}
-bool CObject::RetProxyActivate()
+bool CObject::GetProxyActivate()
{
return m_bProxyActivate;
}
@@ -6985,7 +6955,7 @@ void CObject::SetProxyDistance(float distance)
m_proxyDistance = distance;
}
-float CObject::RetProxyDistance()
+float CObject::GetProxyDistance()
{
return m_proxyDistance;
}
@@ -6998,7 +6968,7 @@ void CObject::SetMagnifyDamage(float factor)
m_magnifyDamage = factor;
}
-float CObject::RetMagnifyDamage()
+float CObject::GetMagnifyDamage()
{
return m_magnifyDamage;
}
@@ -7011,7 +6981,7 @@ void CObject::SetParam(float value)
m_param = value;
}
-float CObject::RetParam()
+float CObject::GetParam()
{
return m_param;
}
@@ -7026,7 +6996,7 @@ void CObject::SetLock(bool bLock)
m_bLock = bLock;
}
-bool CObject::RetLock()
+bool CObject::GetLock()
{
return m_bLock;
}
@@ -7039,7 +7009,7 @@ void CObject::SetExplo(bool bExplo)
m_bExplo = bExplo;
}
-bool CObject::RetExplo()
+bool CObject::GetExplo()
{
return m_bExplo;
}
@@ -7052,7 +7022,7 @@ void CObject::SetCargo(bool bCargo)
m_bCargo = bCargo;
}
-bool CObject::RetCargo()
+bool CObject::GetCargo()
{
return m_bCargo;
}
@@ -7071,7 +7041,7 @@ void CObject::SetBurn(bool bBurn)
//? }
}
-bool CObject::RetBurn()
+bool CObject::GetBurn()
{
return m_bBurn;
}
@@ -7092,17 +7062,17 @@ void CObject::SetDead(bool bDead)
//? }
}
-bool CObject::RetDead()
+bool CObject::GetDead()
{
return m_bDead;
}
-bool CObject::RetRuin()
+bool CObject::GetRuin()
{
return m_bBurn|m_bFlat;
}
-bool CObject::RetActif()
+bool CObject::GetActif()
{
return !m_bLock && !m_bBurn && !m_bFlat && m_bVisible && m_bEnable;
}
@@ -7178,12 +7148,12 @@ void CObject::SetGunGoalH(float gunGoal)
m_gunGoalH = gunGoal;
}
-float CObject::RetGunGoalV()
+float CObject::GetGunGoalV()
{
return m_gunGoalV;
}
-float CObject::RetGunGoalH()
+float CObject::GetGunGoalH()
{
return m_gunGoalH;
}
@@ -7196,7 +7166,7 @@ bool CObject::StartShowLimit()
{
if ( m_showLimitRadius == 0.0f ) return false;
- m_main->SetShowLimit(0, PARTILIMIT1, this, RetPosition(0), m_showLimitRadius);
+ m_main->SetShowLimit(0, Gfx::PARTILIMIT1, this, GetPosition(0), m_showLimitRadius);
m_bShowLimit = true;
return true;
}
@@ -7219,7 +7189,7 @@ bool CObject::IsProgram()
// Creates or removes particles associated to the object.
-void CObject::CreateSelectParticule()
+void CObject::CreateSelectParticle()
{
Math::Vector pos, speed;
Math::Point dim;
@@ -7230,7 +7200,7 @@ void CObject::CreateSelectParticule()
{
if ( m_partiSel[i] != -1 )
{
- m_particule->DeleteParticule(m_partiSel[i]);
+ m_particle->DeleteParticle(m_partiSel[i]);
m_partiSel[i] = -1;
}
}
@@ -7270,18 +7240,18 @@ void CObject::CreateSelectParticule()
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 0.0f;
dim.y = 0.0f;
- m_partiSel[0] = m_particule->CreateParticule(pos, speed, dim, PARTISELY, 1.0f, 0.0f, 0.0f);
- m_partiSel[1] = m_particule->CreateParticule(pos, speed, dim, PARTISELY, 1.0f, 0.0f, 0.0f);
- m_partiSel[2] = m_particule->CreateParticule(pos, speed, dim, PARTISELR, 1.0f, 0.0f, 0.0f);
- m_partiSel[3] = m_particule->CreateParticule(pos, speed, dim, PARTISELR, 1.0f, 0.0f, 0.0f);
- UpdateSelectParticule();
+ m_partiSel[0] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISELY, 1.0f, 0.0f, 0.0f);
+ m_partiSel[1] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISELY, 1.0f, 0.0f, 0.0f);
+ m_partiSel[2] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISELR, 1.0f, 0.0f, 0.0f);
+ m_partiSel[3] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISELR, 1.0f, 0.0f, 0.0f);
+ UpdateSelectParticle();
}
}
}
// Updates the particles associated to the object.
-void CObject::UpdateSelectParticule()
+void CObject::UpdateSelectParticle()
{
Math::Vector pos[4];
Math::Point dim[4];
@@ -7405,7 +7375,7 @@ void CObject::UpdateSelectParticule()
pos[3] = Math::Vector(-5.3f, 2.7f, -1.8f);
}
- angle = RetAngleY(0)/Math::PI;
+ angle = GetAngleY(0)/Math::PI;
zoom[0] = 1.0f;
zoom[1] = 1.0f;
@@ -7426,7 +7396,7 @@ void CObject::UpdateSelectParticule()
{
pos[i] = Math::Transform(m_objectPart[0].matWorld, pos[i]);
dim[i].y = dim[i].x;
- m_particule->SetParam(m_partiSel[i], pos[i], dim[i], zoom[i], angle, 1.0f);
+ m_particle->SetParam(m_partiSel[i], pos[i], dim[i], zoom[i], angle, 1.0f);
}
}
@@ -7438,42 +7408,42 @@ void CObject::SetRunScript(CScript* script)
m_runScript = script;
}
-CScript* CObject::RetRunScript()
+CScript* CObject::GetRunScript()
{
return m_runScript;
}
-// Returns the variables of "this" for CBOT.
+// Geturns the variables of "this" for CBOT.
-CBotVar* CObject::RetBotVar()
+CBotVar* CObject::GetBotVar()
{
return m_botVar;
}
-// Returns the physics associated to the object.
+// Geturns the physics associated to the object.
-CPhysics* CObject::RetPhysics()
+CPhysics* CObject::GetPhysics()
{
return m_physics;
}
-// Returns the brain associated to the object.
+// Geturns the brain associated to the object.
-CBrain* CObject::RetBrain()
+CBrain* CObject::GetBrain()
{
return m_brain;
}
-// Returns the movement associated to the object.
+// Geturns the movement associated to the object.
-CMotion* CObject::RetMotion()
+CMotion* CObject::GetMotion()
{
return m_motion;
}
-// Returns the controller associated to the object.
+// Geturns the controller associated to the object.
-CAuto* CObject::RetAuto()
+CAuto* CObject::GetAuto()
{
return m_auto;
}
@@ -7492,7 +7462,7 @@ void CObject::SetDefRank(int rank)
m_defRank = rank;
}
-int CObject::RetDefRank()
+int CObject::GetDefRank()
{
return m_defRank;
}
@@ -7555,51 +7525,51 @@ void CObject::DeleteDeselList(CObject* pObj)
// Management of the state of the pencil drawing robot.
-bool CObject::RetTraceDown()
+bool CObject::GetTraceDown()
{
CMotionVehicle* mv;
if ( m_motion == 0 ) return false;
- mv = (CMotionVehicle*)m_motion;
- return mv->RetTraceDown();
+ mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ return mv->GetTraceDown();
}
void CObject::SetTraceDown(bool bDown)
{
CMotionVehicle* mv;
if ( m_motion == 0 ) return;
- mv = (CMotionVehicle*)m_motion;
+ mv = dynamic_cast<CMotionVehicle*>(m_motion);
mv->SetTraceDown(bDown);
}
-int CObject::RetTraceColor()
+int CObject::GetTraceColor()
{
CMotionVehicle* mv;
if ( m_motion == 0 ) return 0;
- mv = (CMotionVehicle*)m_motion;
- return mv->RetTraceColor();
+ mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ return mv->GetTraceColor();
}
void CObject::SetTraceColor(int color)
{
CMotionVehicle* mv;
if ( m_motion == 0 ) return;
- mv = (CMotionVehicle*)m_motion;
+ mv = dynamic_cast<CMotionVehicle*>(m_motion);
mv->SetTraceColor(color);
}
-float CObject::RetTraceWidth()
+float CObject::GetTraceWidth()
{
CMotionVehicle* mv;
if ( m_motion == 0 ) return 0.0f;
- mv = (CMotionVehicle*)m_motion;
- return mv->RetTraceWidth();
+ mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ return mv->GetTraceWidth();
}
void CObject::SetTraceWidth(float width)
{
CMotionVehicle* mv;
if ( m_motion == 0 ) return;
- mv = (CMotionVehicle*)m_motion;
+ mv = dynamic_cast<CMotionVehicle*>(m_motion);
mv->SetTraceWidth(width);
}
diff --git a/src/object/object.h b/src/object/object.h
index 88ae486..1301768 100644
--- a/src/object/object.h
+++ b/src/object/object.h
@@ -35,7 +35,10 @@ class CRobotMain;
class CBotVar;
class CScript;
-
+namespace Ui
+{
+class CDisplayText;
+}
// The father of all parts must always be the part number zero!
@@ -46,69 +49,70 @@ const int OBJECTMAXDESELLIST = 10;
const int OBJECTMAXINFO = 10;
const int OBJECTMAXCMDLINE = 20;
+
enum ObjectMaterial
{
- OM_METAL = 0, // metal
- OM_PLASTIC = 1, // plastic
- OM_HUMAN = 2, // cosmonaut
- OM_ANIMAL = 3, // insect
- OM_VEGETAL = 4, // plant
- OM_MINERAL = 5, // stone
+ OM_METAL = 0, // metal
+ OM_PLASTIC = 1, // plastic
+ OM_HUMAN = 2, // cosmonaut
+ OM_ANIMAL = 3, // insect
+ OM_VEGETAL = 4, // plant
+ OM_MINERAL = 5, // stone
};
struct ObjectPart
{
- char bUsed;
- int object; // number of the object in CEngine
- int parentPart; // number of father part
- int masterParti; // master canal of the particle
- Math::Vector position;
- Math::Vector angle;
- Math::Vector zoom;
- char bTranslate;
- char bRotate;
- char bZoom;
- Math::Matrix matTranslate;
- Math::Matrix matRotate;
- Math::Matrix matTransform;
- Math::Matrix matWorld;
+ char bUsed;
+ int object; // number of the object in CEngine
+ int parentPart; // number of father part
+ int masterParti; // master canal of the particle
+ Math::Vector position;
+ Math::Vector angle;
+ Math::Vector zoom;
+ char bTranslate;
+ char bRotate;
+ char bZoom;
+ Math::Matrix matTranslate;
+ Math::Matrix matRotate;
+ Math::Matrix matTransform;
+ Math::Matrix matWorld;
};
struct Character
{
- float wheelFront; // position X of the front wheels
- float wheelBack; // position X of the back wheels
- float wheelLeft; // position Z of the left wheels
- float wheelRight; // position Z of the right wheels
- float height; // normal height on top of ground
- Math::Vector posPower; // position of the battery
+ float wheelFront; // position X of the front wheels
+ float wheelBack; // position X of the back wheels
+ float wheelLeft; // position Z of the left wheels
+ float wheelRight; // position Z of the right wheels
+ float height; // normal height on top of ground
+ Math::Vector posPower; // position of the battery
};
struct Info
{
- char name[20]; // name of the information
- float value; // value of the information
+ char name[20]; // name of the information
+ float value; // value of the information
};
enum ExploType
{
- EXPLO_BOUM = 1,
- EXPLO_BURN = 2,
- EXPLO_WATER = 3,
+ EXPLO_BOUM = 1,
+ EXPLO_BURN = 2,
+ EXPLO_WATER = 3,
};
enum ResetCap
{
- RESET_NONE = 0,
- RESET_MOVE = 1,
- RESET_DELETE = 2,
+ RESET_NONE = 0,
+ RESET_MOVE = 1,
+ RESET_DELETE = 2,
};
enum RadarFilter
{
- FILTER_NONE = 0,
- FILTER_ONLYLANDING = 1,
- FILTER_ONLYFLYING = 2,
+ FILTER_NONE = 0,
+ FILTER_ONLYLANDING = 1,
+ FILTER_ONLYFLYING = 2,
};
@@ -162,7 +166,7 @@ public:
bool CreateRuin(Math::Vector pos, float angle, float height, ObjectType type);
bool CreateApollo(Math::Vector pos, float angle, ObjectType type);
- bool ReadProgram(int rank, char* filename);
+ bool ReadProgram(int rank, const char* filename);
bool WriteProgram(int rank, char* filename);
bool RunProgram(int rank);
@@ -235,8 +239,8 @@ public:
void SetResetRun(int run);
int GetResetRun();
- void SetMasterParticule(int part, int parti);
- int GetMasterParticule(int part);
+ void SetMasterParticle(int part, int parti);
+ int GetMasterParticle(int part);
void SetPower(CObject* power);
CObject* GetPower();
@@ -252,8 +256,8 @@ public:
void SetInfo(int rank, Info info);
Info GetInfo(int rank);
int GetInfoTotal();
- void SetInfoGeturn(float value);
- float GetInfoGeturn();
+ void SetInfoReturn(float value);
+ float GetInfoReturn();
void SetInfoUpdate(bool bUpdate);
bool GetInfoUpdate();
@@ -370,7 +374,7 @@ public:
void StopShowLimit();
bool IsProgram();
- void CreateSelectParticule();
+ void CreateSelectParticle();
void SetRunScript(CScript* script);
CScript* GetRunScript();
@@ -414,25 +418,25 @@ protected:
void UpdateEnergyMapping();
bool UpdateTransformObject(int part, bool bForceUpdate);
bool UpdateTransformObject();
- void UpdateSelectParticule();
+ void UpdateSelectParticle();
protected:
- CInstanceManager* m_iMan;
- Gfx::CEngine* m_engine;
- Gfx::CLightManager* m_lightMan;
- Gfx::CTerrain* m_terrain;
- Gfx::CWater* m_water;
- Gfx::CCamera* m_camera;
- Gfx::CParticle* m_particle;
- CPhysics* m_physics;
- CBrain* m_brain;
- CMotion* m_motion;
- CAuto* m_auto;
- CDisplayText* m_displayText;
- CRobotMain* m_main;
- CSoundInterface* m_sound;
- CBotVar* m_botVar;
- CScript* m_runScript;
+ CInstanceManager* m_iMan;
+ Gfx::CEngine* m_engine;
+ Gfx::CLightManager* m_lightMan;
+ Gfx::CTerrain* m_terrain;
+ Gfx::CWater* m_water;
+ Gfx::CCamera* m_camera;
+ Gfx::CParticle* m_particle;
+ CPhysics* m_physics;
+ CBrain* m_brain;
+ CMotion* m_motion;
+ CAuto* m_auto;
+ Ui::CDisplayText* m_displayText;
+ CRobotMain* m_main;
+ CSoundInterface* m_sound;
+ CBotVar* m_botVar;
+ CScript* m_runScript;
ObjectType m_type; // OBJECT_*
int m_id; // unique identifier
@@ -462,8 +466,8 @@ protected:
float m_shotTime; // time since last shot
bool m_bVirusMode; // virus activated/triggered
float m_virusTime; // lifetime of the virus
- float m_lastVirusParticule;
- float m_lastParticule;
+ float m_lastVirusParticle;
+ float m_lastParticle;
bool m_bHilite;
bool m_bSelect; // object selected
bool m_bSelectable; // selectable object
@@ -522,7 +526,7 @@ protected:
int m_infoTotal;
Info m_info[OBJECTMAXINFO];
- float m_infoGeturn;
+ float m_infoReturn;
bool m_bInfoUpdate;
float m_cmdLine[OBJECTMAXCMDLINE];
diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp
index 83eca52..1f2f261 100644
--- a/src/object/robotmain.cpp
+++ b/src/object/robotmain.cpp
@@ -615,7 +615,7 @@ CRobotMain::CRobotMain(CInstanceManager* iMan)
m_event = (CEvent*)m_iMan->SearchInstance(CLASS_EVENT);
m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
m_light = (CLight*)m_iMan->SearchInstance(CLASS_LIGHT);
- m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
+ m_particle = (CParticle*)m_iMan->SearchInstance(CLASS_PARTICULE);
m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
m_cloud = (CCloud*)m_iMan->SearchInstance(CLASS_CLOUD);
m_blitz = (CBlitz*)m_iMan->SearchInstance(CLASS_BLITZ);
@@ -740,7 +740,7 @@ CRobotMain::CRobotMain(CInstanceManager* iMan)
for ( i=0 ; i<OBJECT_MAX ; i++ )
{
type = (ObjectType)i;
- token = RetObjectName(type);
+ token = GetObjectName(type);
if ( token[0] != 0 )
{
CBotProgram::DefineNum(token, type);
@@ -913,7 +913,7 @@ void CRobotMain::ChangePhase(Phase phase)
m_terrain->FlushBuildingLevel();
m_terrain->FlushFlyingLimit();
m_light->FlushLight();
- m_particule->FlushParticule();
+ m_particle->FlushParticule();
m_water->Flush();
m_cloud->Flush();
m_blitz->Flush();
@@ -1323,7 +1323,7 @@ bool CRobotMain::EventProcess(const Event &event)
HiliteClear();
if ( event.param == VK_F11 )
{
- m_particule->WriteWheelTrace("Savegame\\t.bmp", 256, 256, Math::Vector(16.0f, 0.0f, -368.0f), Math::Vector(140.0f, 0.0f, -248.0f));
+ m_particle->WriteWheelTrace("Savegame\\t.bmp", 256, 256, Math::Vector(16.0f, 0.0f, -368.0f), Math::Vector(140.0f, 0.0f, -248.0f));
return false;
}
if ( m_bEditLock ) // current edition?
@@ -2374,7 +2374,7 @@ void CRobotMain::StartDisplayVisit(EventMsg event)
m_visitTime = 0.0;
m_visitParticule = 0.0f;
- m_particule->DeleteParticule(PARTISHOW);
+ m_particle->DeleteParticule(PARTISHOW);
m_camera->StartVisit(m_displayText->RetVisitGoal(event),
m_displayText->RetVisitDist(event));
@@ -2412,7 +2412,7 @@ void CRobotMain::FrameVisit(float rTime)
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 30.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISHOW, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, PARTISHOW, 2.0f);
}
}
@@ -2434,7 +2434,7 @@ void CRobotMain::StopDisplayVisit()
}
// Removes particles "arrows".
- m_particule->DeleteParticule(PARTISHOW);
+ m_particle->DeleteParticule(PARTISHOW);
m_camera->StopVisit();
m_displayText->ClearVisit();
@@ -3517,7 +3517,7 @@ bool CRobotMain::EventFrame(const Event &event)
if ( m_engine->RetFog() )
{
- m_camera->SetOverBaseColor(m_particule->RetFogColor(m_engine->RetEyePt()));
+ m_camera->SetOverBaseColor(m_particle->RetFogColor(m_engine->RetEyePt()));
}
}
if ( m_phase == PHASE_PERSO ||
@@ -3932,7 +3932,7 @@ void CRobotMain::ScenePerso()
m_terrain->FlushBuildingLevel();
m_terrain->FlushFlyingLimit();
m_light->FlushLight();
- m_particule->FlushParticule();
+ m_particle->FlushParticule();
m_iMan->Flush(CLASS_OBJECT);
m_iMan->Flush(CLASS_PHYSICS);
m_iMan->Flush(CLASS_BRAIN);
@@ -4615,7 +4615,7 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
pos.y += height;
dim.x = ddim;
dim.y = dim.x;
- m_particule->CreateParticule(pos, Math::Vector(0.0f, 0.0f, 0.0f), dim, type, delay, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), dim, type, delay, 0.0f, 0.0f);
}
if ( Cmd(line, "CreateLight") && !bResetObject )
@@ -5767,7 +5767,7 @@ void CRobotMain::FlushShowLimit(int i)
{
if ( m_showLimit[i].parti[j] == 0 ) continue;
- m_particule->DeleteParticule(m_showLimit[i].parti[j]);
+ m_particle->DeleteParticule(m_showLimit[i].parti[j]);
m_showLimit[i].parti[j] = 0;
}
@@ -5811,7 +5811,7 @@ void CRobotMain::SetShowLimit(int i, ParticuleType parti, CObject *pObj,
for ( j=0 ; j<m_showLimit[i].total ; j++ )
{
- m_showLimit[i].parti[j] = m_particule->CreateParticule(pos, Math::Vector(0.0f, 0.0f, 0.0f), dim, parti, duration);
+ m_showLimit[i].parti[j] = m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), dim, parti, duration);
}
}
@@ -5890,8 +5890,8 @@ void CRobotMain::FrameShowLimit(float rTime)
m_terrain->MoveOnFloor(pos, true);
if ( m_showLimit[i].radius <= 50.0f ) pos.y += 0.5f;
else pos.y += 2.0f;
- m_particule->SetPosition(m_showLimit[i].parti[j], pos);
-//? m_particule->SetAngle(m_showLimit[i].parti[j], angle-Math::PI/2.0f);
+ m_particle->SetPosition(m_showLimit[i].parti[j], pos);
+//? m_particle->SetAngle(m_showLimit[i].parti[j], angle-Math::PI/2.0f);
angle += (2.0f*Math::PI)/m_showLimit[i].total;
}
@@ -6787,10 +6787,10 @@ void CRobotMain::ResetObject()
}
// Removes all bullets in progress.
- m_particule->DeleteParticule(PARTIGUN1);
- m_particule->DeleteParticule(PARTIGUN2);
- m_particule->DeleteParticule(PARTIGUN3);
- m_particule->DeleteParticule(PARTIGUN4);
+ m_particle->DeleteParticule(PARTIGUN1);
+ m_particle->DeleteParticule(PARTIGUN2);
+ m_particle->DeleteParticule(PARTIGUN3);
+ m_particle->DeleteParticule(PARTIGUN4);
for ( i=0 ; i<1000000 ; i++ )
{
@@ -6869,15 +6869,15 @@ void CRobotMain::ResetCreate()
SaveAllScript();
// Removes all bullets in progress.
- m_particule->DeleteParticule(PARTIGUN1);
- m_particule->DeleteParticule(PARTIGUN2);
- m_particule->DeleteParticule(PARTIGUN3);
- m_particule->DeleteParticule(PARTIGUN4);
+ m_particle->DeleteParticule(PARTIGUN1);
+ m_particle->DeleteParticule(PARTIGUN2);
+ m_particle->DeleteParticule(PARTIGUN3);
+ m_particle->DeleteParticule(PARTIGUN4);
DeselectAll(); // removes the control buttons
DeleteAllObjects(); // removes all the current 3D Scene
- m_particule->FlushParticule();
+ m_particle->FlushParticule();
m_terrain->FlushBuildingLevel();
m_iMan->Flush(CLASS_OBJECT);
m_iMan->Flush(CLASS_PHYSICS);
@@ -7028,7 +7028,7 @@ Error CRobotMain::CheckEndMission(bool bFrame)
// Checks if the mission is finished after displaying a message.
-void CRobotMain::CheckEndMessage(char *message)
+void CRobotMain::CheckEndMessage(const char *message)
{
int t;
@@ -7062,7 +7062,7 @@ char* CRobotMain::RetObligatoryToken(int i)
// Checks if an instruction is part of the obligatory list.
-int CRobotMain::IsObligatoryToken(char *token)
+int CRobotMain::IsObligatoryToken(const char *token)
{
int i;
@@ -7078,7 +7078,7 @@ int CRobotMain::IsObligatoryToken(char *token)
// Checks if an instruction is not part of the banned list.
-bool CRobotMain::IsProhibitedToken(char *token)
+bool CRobotMain::IsProhibitedToken(const char *token)
{
int i;
diff --git a/src/object/robotmain.h b/src/object/robotmain.h
index 559453b..1370cd6 100644
--- a/src/object/robotmain.h
+++ b/src/object/robotmain.h
@@ -22,12 +22,11 @@
#include <stdio.h>
#include "common/misc.h"
-#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
#include "object/object.h"
#include "object/mainmovie.h"
-#include "old/camera.h"
-#include "old/particule.h"
-
+#include "graphics/engine/camera.h"
+#include "graphics/engine/particle.h"
enum Phase
{
@@ -86,7 +85,7 @@ class CWindow;
class CControl;
class CDisplayText;
class CDisplayInfo;
-class CSound;
+class CSoundInterface;
struct EndTake
@@ -154,25 +153,25 @@ public:
void ScenePerso();
void SetMovieLock(bool bLock);
- bool RetMovieLock();
- bool RetInfoLock();
+ bool GetMovieLock();
+ bool GetInfoLock();
void SetSatComLock(bool bLock);
- bool RetSatComLock();
+ bool GetSatComLock();
void SetEditLock(bool bLock, bool bEdit);
- bool RetEditLock();
+ bool GetEditLock();
void SetEditFull(bool bFull);
- bool RetEditFull();
- bool RetFreePhoto();
+ bool GetEditFull();
+ bool GetFreePhoto();
void SetFriendAim(bool bFriend);
- bool RetFriendAim();
+ bool GetFriendAim();
void SetTracePrecision(float factor);
- float RetTracePrecision();
+ float GetTracePrecision();
void ChangePause(bool bPause);
void SetSpeed(float speed);
- float RetSpeed();
+ float GetSpeed();
void UpdateShortcuts();
void SelectHuman();
@@ -180,75 +179,75 @@ public:
CObject* SearchToto();
CObject* SearchNearest(Math::Vector pos, CObject* pExclu);
bool SelectObject(CObject* pObj, bool bDisplayError=true);
- CObject* RetSelectObject();
+ CObject* GetSelectObject();
CObject* DeselectAll();
bool DeleteObject();
void ResetObject();
void ResetCreate();
Error CheckEndMission(bool bFrame);
- void CheckEndMessage(char *message);
- int RetObligatoryToken();
- char* RetObligatoryToken(int i);
- int IsObligatoryToken(char *token);
- bool IsProhibitedToken(char *token);
+ void CheckEndMessage(const char *message);
+ int GetObligatoryToken();
+ char* GetObligatoryToken(int i);
+ int IsObligatoryToken(const char *token);
+ bool IsProhibitedToken(const char *token);
void UpdateMap();
- bool RetShowMap();
+ bool GetShowMap();
- MainMovieType RetMainMovie();
+ MainMovieType GetMainMovie();
void FlushDisplayInfo();
void StartDisplayInfo(int index, bool bMovie);
void StartDisplayInfo(char *filename, int index);
void StopDisplayInfo();
- char* RetDisplayInfoName(int index);
- int RetDisplayInfoPosition(int index);
+ char* GetDisplayInfoName(int index);
+ int GetDisplayInfoPosition(int index);
void SetDisplayInfoPosition(int index, int pos);
void StartSuspend();
void StopSuspend();
- float RetGameTime();
+ float GetGameTime();
void SetFontSize(float size);
- float RetFontSize();
+ float GetFontSize();
void SetWindowPos(Math::Point pos);
- Math::Point RetWindowPos();
+ Math::Point GetWindowPos();
void SetWindowDim(Math::Point dim);
- Math::Point RetWindowDim();
+ Math::Point GetWindowDim();
void SetIOPublic(bool bMode);
- bool RetIOPublic();
+ bool GetIOPublic();
void SetIOPos(Math::Point pos);
- Math::Point RetIOPos();
+ Math::Point GetIOPos();
void SetIODim(Math::Point dim);
- Math::Point RetIODim();
-
- char* RetTitle();
- char* RetResume();
- char* RetScriptName();
- char* RetScriptFile();
- bool RetTrainerPilot();
- bool RetFixScene();
- bool RetGlint();
- bool RetSoluce4();
- bool RetMovies();
- bool RetNiceReset();
- bool RetHimselfDamage();
- bool RetShowSoluce();
- bool RetSceneSoluce();
- bool RetShowAll();
- bool RetCheatRadar();
- char* RetSavegameDir();
- char* RetPublicDir();
- char* RetFilesDir();
+ Math::Point GetIODim();
+
+ char* GetTitle();
+ char* GetResume();
+ char* GetScriptName();
+ char* GetScriptFile();
+ bool GetTrainerPilot();
+ bool GetFixScene();
+ bool GetGlint();
+ bool GetSoluce4();
+ bool GetMovies();
+ bool GetNiceReset();
+ bool GetHimselfDamage();
+ bool GetShowSoluce();
+ bool GetSceneSoluce();
+ bool GetShowAll();
+ bool GetCheatRadar();
+ char* GetSavegameDir();
+ char* GetPublicDir();
+ char* GetFilesDir();
void SetGamerName(char *name);
- char* RetGamerName();
- int RetGamerFace();
- int RetGamerGlasses();
- bool RetGamerOnlyHead();
- float RetPersoAngle();
+ char* GetGamerName();
+ int GetGamerFace();
+ int GetGamerGlasses();
+ bool GetGamerOnlyHead();
+ float GetPersoAngle();
void StartMusic();
void ClearInterface();
@@ -256,11 +255,11 @@ public:
float SearchNearestObject(Math::Vector center, CObject *exclu);
bool FreeSpace(Math::Vector &center, float minRadius, float maxRadius, float space, CObject *exclu);
- float RetFlatZoneRadius(Math::Vector center, float maxRadius, CObject *exclu);
+ float GetFlatZoneRadius(Math::Vector center, float maxRadius, CObject *exclu);
void HideDropZone(CObject* metal);
void ShowDropZone(CObject* metal, CObject* truck);
void FlushShowLimit(int i);
- void SetShowLimit(int i, ParticuleType parti, CObject *pObj, Math::Vector pos, float radius, float duration=SHOWLIMITTIME);
+ void SetShowLimit(int i, Gfx::ParticleType parti, CObject *pObj, Math::Vector pos, float radius, float duration=SHOWLIMITTIME);
void AdjustShowLimit(int i, Math::Vector pos);
void StartShowLimit();
void FrameShowLimit(float rTime);
@@ -276,7 +275,7 @@ public:
bool FlushNewScriptName();
bool AddNewScriptName(ObjectType type, char *name);
- char* RetNewScriptName(ObjectType type, int rank);
+ char* GetNewScriptName(ObjectType type, int rank);
void WriteFreeParam();
void ReadFreeParam();
@@ -287,7 +286,7 @@ public:
void IOWriteObject(FILE *file, CObject* pObj, char *cmd);
CObject* IOReadObject(char *line, char* filename, int objRank);
- int CreateSpot(Math::Vector pos, D3DCOLORVALUE color);
+ int CreateSpot(Math::Vector pos, Gfx::Color color);
protected:
bool EventFrame(const Event &event);
@@ -300,7 +299,7 @@ protected:
void CreateModel();
Math::Vector LookatPoint( Math::Vector eye, float angleH, float angleV, float length );
CObject* CreateObject(Math::Vector pos, float angle, float zoom, float height, ObjectType type, float power=1.0f, bool bTrainer=false, bool bToy=false, int option=0);
- int CreateLight(Math::Vector direction, D3DCOLORVALUE color);
+ int CreateLight(Math::Vector direction, Gfx::Color color);
void HiliteClear();
void HiliteObject(Math::Point pos);
void HiliteFrame(float rTime);
@@ -309,7 +308,7 @@ protected:
CObject* DetectObject(Math::Point pos);
void ChangeCamera();
void RemoteCamera(float pan, float zoom, float rTime);
- void KeyCamera(EventMsg event, long param);
+ void KeyCamera(EventType event, long param);
void AbortMovie();
bool IsSelectable(CObject* pObj);
void SelectOneObject(CObject* pObj, bool bDisplayError=true);
@@ -318,8 +317,8 @@ protected:
void DeleteAllObjects();
void UpdateInfoText();
CObject* SearchObject(ObjectType type);
- CObject* RetSelect();
- void StartDisplayVisit(EventMsg event);
+ CObject* GetSelect();
+ void StartDisplayVisit(EventType event);
void FrameVisit(float rTime);
void StopDisplayVisit();
void ExecuteCmd(char *cmd);
@@ -333,7 +332,7 @@ protected:
CMainMap* m_map;
CEvent* m_event;
CD3DEngine* m_engine;
- CParticule* m_particule;
+ Gfx::CParticle* m_particle;
CWater* m_water;
CCloud* m_cloud;
CBlitz* m_blitz;
@@ -359,7 +358,7 @@ protected:
Phase m_phase;
int m_cameraRank;
- D3DCOLORVALUE m_color;
+ Gfx::Color m_color;
bool m_bFreePhoto;
bool m_bCmdEdit;
bool m_bShowPos;
@@ -420,7 +419,7 @@ protected:
float m_cameraPan;
float m_cameraZoom;
- EventMsg m_visitLast;
+ EventType m_visitLast;
CObject* m_visitObject;
CObject* m_visitArrow;
float m_visitTime;
@@ -446,14 +445,14 @@ protected:
ShowLimit m_showLimit[MAXSHOWLIMIT];
- D3DCOLORVALUE m_colorRefBot;
- D3DCOLORVALUE m_colorNewBot;
- D3DCOLORVALUE m_colorRefAlien;
- D3DCOLORVALUE m_colorNewAlien;
- D3DCOLORVALUE m_colorRefGreen;
- D3DCOLORVALUE m_colorNewGreen;
- D3DCOLORVALUE m_colorRefWater;
- D3DCOLORVALUE m_colorNewWater;
+ Gfx::Color m_colorRefBot;
+ Gfx::Color m_colorNewBot;
+ Gfx::Color m_colorRefAlien;
+ Gfx::Color m_colorNewAlien;
+ Gfx::Color m_colorRefGreen;
+ Gfx::Color m_colorNewGreen;
+ Gfx::Color m_colorRefWater;
+ Gfx::Color m_colorNewWater;
float m_colorShiftWater;
};
diff --git a/src/object/task/task.cpp b/src/object/task/task.cpp
index f910ea2..b310fd5 100644
--- a/src/object/task/task.cpp
+++ b/src/object/task/task.cpp
@@ -17,7 +17,7 @@
// task.cpp
-#include <stdio.h>
+// #include <stdio.h>
#include "object/task/task.h"
@@ -32,20 +32,20 @@ CTask::CTask(CInstanceManager* iMan, CObject* object)
{
m_iMan = iMan;
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_light = (CLight*)m_iMan->SearchInstance(CLASS_LIGHT);
- m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
- m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN);
- m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
- m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_displayText = (CDisplayText*)m_iMan->SearchInstance(CLASS_DISPLAYTEXT);
- m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
+ m_engine = static_cast<Gfx::CEngine*>(m_iMan->SearchInstance(CLASS_ENGINE));
+ m_lightMan = static_cast<Gfx::CLightManager*>(m_iMan->SearchInstance(CLASS_LIGHT));
+ m_terrain = static_cast<Gfx::CTerrain*>(m_iMan->SearchInstance(CLASS_TERRAIN));
+ m_water = static_cast<Gfx::CWater*>(m_iMan->SearchInstance(CLASS_WATER));
+ m_particle = static_cast<Gfx::CParticle*>(m_iMan->SearchInstance(CLASS_PARTICULE));
+ m_camera = static_cast<Gfx::CCamera*>(m_iMan->SearchInstance(CLASS_CAMERA));
+ m_displayText = static_cast<Ui::CDisplayText*>(m_iMan->SearchInstance(CLASS_DISPLAYTEXT));
+ m_main = static_cast<CRobotMain*>(m_iMan->SearchInstance(CLASS_MAIN));
+ m_sound = static_cast<CSoundInterface*>(m_iMan->SearchInstance(CLASS_SOUND));
m_object = object;
- m_physics = m_object->RetPhysics();
- m_brain = m_object->RetBrain();
- m_motion = m_object->RetMotion();
+ m_physics = m_object->GetPhysics();
+ m_brain = m_object->GetBrain();
+ m_motion = m_object->GetMotion();
}
// Object's destructor.
diff --git a/src/object/task/task.h b/src/object/task/task.h
index a3ec62c..a0da9d2 100644
--- a/src/object/task/task.h
+++ b/src/object/task/task.h
@@ -24,19 +24,25 @@
class CInstanceManager;
-class CD3DEngine;
-class CLight;
-class CParticule;
-class CTerrain;
-class CWater;
-class CCamera;
class CBrain;
class CPhysics;
class CMotion;
class CObject;
class CRobotMain;
+class CSoundInterface;
+
+namespace Ui {
class CDisplayText;
-class CSound;
+} /* Ui */
+
+namespace Gfx {
+class CEngine;
+class CLightManager;
+class CParticle;
+class CTerrain;
+class CWater;
+class CCamera;
+} /* Gfx */
const float TAKE_DIST = 6.0f; // distance to an object to pick it
@@ -66,21 +72,19 @@ public:
virtual bool Abort();
protected:
-
-protected:
- CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CLight* m_light;
- CParticule* m_particule;
- CTerrain* m_terrain;
- CWater* m_water;
- CCamera* m_camera;
- CMotion* m_motion;
- CBrain* m_brain;
- CPhysics* m_physics;
- CObject* m_object;
- CRobotMain* m_main;
- CDisplayText* m_displayText;
- CSound* m_sound;
+ CInstanceManager* m_iMan;
+ Gfx::CEngine* m_engine;
+ Gfx::CLightManager* m_lightMan;
+ Gfx::CParticle* m_particle;
+ Gfx::CTerrain* m_terrain;
+ Gfx::CWater* m_water;
+ Gfx::CCamera* m_camera;
+ CMotion* m_motion;
+ CBrain* m_brain;
+ CPhysics* m_physics;
+ CObject* m_object;
+ CRobotMain* m_main;
+ Ui::CDisplayText* m_displayText;
+ CSoundInterface* m_sound;
};
diff --git a/src/object/task/taskmanager.cpp b/src/object/task/taskmanager.cpp
index d81fb5b..171be1d 100644
--- a/src/object/task/taskmanager.cpp
+++ b/src/object/task/taskmanager.cpp
@@ -136,7 +136,7 @@ Error CTaskManager::StartTaskSearch()
// Reads an information terminal.
-Error CTaskManager::StartTaskInfo(char *name, float value, float power, bool bSend)
+Error CTaskManager::StartTaskInfo(const char *name, float value, float power, bool bSend)
{
m_task = new CTaskInfo(m_iMan, m_object);
return ((CTaskInfo*)m_task)->Start(name, value, power, bSend);
diff --git a/src/object/task/taskmanager.h b/src/object/task/taskmanager.h
index 14fc276..6ce023a 100644
--- a/src/object/task/taskmanager.h
+++ b/src/object/task/taskmanager.h
@@ -43,7 +43,7 @@ public:
Error StartTaskFlag(TaskFlagOrder order, int rank);
Error StartTaskBuild(ObjectType type);
Error StartTaskSearch();
- Error StartTaskInfo(char *name, float value, float power, bool bSend);
+ Error StartTaskInfo(const char *name, float value, float power, bool bSend);
Error StartTaskTerraform();
Error StartTaskPen(bool bDown, int color);
Error StartTaskRecover();
diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp
index 873979f..fb9fd44 100644
--- a/src/physics/physics.cpp
+++ b/src/physics/physics.cpp
@@ -17,35 +17,24 @@
// physics.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+#include <cstring>
-#include "common/struct.h"
-#include "math/const.h"
#include "math/geometry.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
-#include "common/language.h"
+#include "graphics/engine/engine.h"
#include "common/global.h"
#include "common/event.h"
-#include "common/misc.h"
#include "common/iman.h"
-#include "old/math3d.h"
-#include "old/light.h"
-#include "old/particule.h"
-#include "old/terrain.h"
-#include "old/water.h"
-#include "old/camera.h"
-#include "object/object.h"
-#include "old/pyro.h"
+#include "graphics/engine/lightman.h"
+#include "graphics/engine/terrain.h"
+#include "graphics/engine/water.h"
+#include "graphics/engine/camera.h"
+#include "graphics/engine/pyro.h"
+#include "script/cmdtoken.h"
+#include "physics/physics.h"
#include "object/brain.h"
#include "object/motion/motion.h"
#include "object/motion/motionhuman.h"
-#include "old/sound.h"
#include "object/task/task.h"
-#include "script/cmdtoken.h"
-#include "physics/physics.h"
@@ -64,13 +53,13 @@ CPhysics::CPhysics(CInstanceManager* iMan, CObject* object)
m_iMan->AddInstance(CLASS_PHYSICS, this, 100);
m_object = object;
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_light = (CLight*)m_iMan->SearchInstance(CLASS_LIGHT);
- m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
- m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN);
- m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
- m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
- m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
+ m_engine = static_cast<Gfx::CEngine*>(m_iMan->SearchInstance(CLASS_ENGINE));
+ m_lightMan = static_cast<Gfx::CLightManager*>(m_iMan->SearchInstance(CLASS_LIGHT));
+ m_particle = static_cast<Gfx::CParticle*>(m_iMan->SearchInstance(CLASS_PARTICULE));
+ m_terrain = static_cast<Gfx::CTerrain*>(m_iMan->SearchInstance(CLASS_TERRAIN));
+ m_water = static_cast<Gfx::CWater*>(m_iMan->SearchInstance(CLASS_WATER));
+ m_camera = static_cast<Gfx::CCamera*>(m_iMan->SearchInstance(CLASS_CAMERA));
+ m_sound = static_cast<CSoundInterface*>(m_iMan->SearchInstance(CLASS_SOUND));
m_brain = 0;
m_motion = 0;
@@ -88,14 +77,14 @@ CPhysics::CPhysics(CInstanceManager* iMan, CObject* object)
m_linVibrationFactor = 1.0f;
m_cirVibrationFactor = 1.0f;
m_inclinaisonFactor = 1.0f;
- m_lastPowerParticule = 0.0f;
- m_lastSlideParticule = 0.0f;
- m_lastMotorParticule = 0.0f;
- m_lastWaterParticule = 0.0f;
- m_lastUnderParticule = 0.0f;
- m_lastPloufParticule = 0.0f;
- m_lastFlameParticule = 0.0f;
- m_bWheelParticuleBrake = false;
+ m_lastPowerParticle = 0.0f;
+ m_lastSlideParticle = 0.0f;
+ m_lastMotorParticle = 0.0f;
+ m_lastWaterParticle = 0.0f;
+ m_lastUnderParticle = 0.0f;
+ m_lastPloufParticle = 0.0f;
+ m_lastFlameParticle = 0.0f;
+ m_bWheelParticleBrake = false;
m_absorbWater = 0.0f;
m_reactorTemperature = 0.0f;
m_reactorRange = 1.0f;
@@ -103,7 +92,7 @@ CPhysics::CPhysics(CInstanceManager* iMan, CObject* object)
m_lastEnergy = 0.0f;
m_lastSoundWater = 0.0f;
m_lastSoundInsect = 0.0f;
- m_restBreakParticule = 0.0f;
+ m_restBreakParticle = 0.0f;
m_floorHeight = 0.0f;
m_soundChannel = -1;
m_soundChannelSlide = -1;
@@ -115,8 +104,8 @@ CPhysics::CPhysics(CInstanceManager* iMan, CObject* object)
m_bForceUpdate = true;
m_bLowLevel = false;
- ZeroMemory(&m_linMotion, sizeof(Motion));
- ZeroMemory(&m_cirMotion, sizeof(Motion));
+ memset(&m_linMotion, 0, sizeof(Motion));
+ memset(&m_cirMotion, 0,sizeof(Motion));
}
// Object's destructor.
@@ -164,7 +153,7 @@ void CPhysics::SetType(PhysicsType type)
m_type = type;
}
-PhysicsType CPhysics::RetType()
+PhysicsType CPhysics::GetType()
{
return m_type;
}
@@ -182,10 +171,10 @@ bool CPhysics::Write(char *line)
if ( m_type == TYPE_FLYING )
{
- sprintf(name, " reactorRange=%.2f", RetReactorRange());
+ sprintf(name, " reactorRange=%.2f", GetReactorRange());
strcat(line, name);
- sprintf(name, " land=%d", RetLand());
+ sprintf(name, " land=%d", GetLand());
strcat(line, name);
}
@@ -216,7 +205,7 @@ void CPhysics::SetGravity(float value)
m_gravity = value;
}
-float CPhysics::RetGravity()
+float CPhysics::GetGravity()
{
return m_gravity;
}
@@ -224,7 +213,7 @@ float CPhysics::RetGravity()
// Returns the height above the ground.
-float CPhysics::RetFloorHeight()
+float CPhysics::GetFloorHeight()
{
return m_floorHeight;
}
@@ -238,15 +227,15 @@ void CPhysics::SetMotor(bool bState)
m_bMotor = bState;
- light = m_object->RetShadowLight();
+ light = m_object->GetShadowLight();
if ( light != -1 )
{
- m_light->SetLightIntensity(light, m_bMotor?1.0f:0.0f);
- m_light->SetLightIntensitySpeed(light, 3.0f);
+ m_lightMan->SetLightIntensity(light, m_bMotor?1.0f:0.0f);
+ m_lightMan->SetLightIntensitySpeed(light, 3.0f);
}
}
-bool CPhysics::RetMotor()
+bool CPhysics::GetMotor()
{
return m_bMotor;
}
@@ -260,7 +249,7 @@ void CPhysics::SetLand(bool bState)
SetMotor(!bState); // lights if you leave the reactor in flight
}
-bool CPhysics::RetLand()
+bool CPhysics::GetLand()
{
return m_bLand;
}
@@ -277,7 +266,7 @@ void CPhysics::SetSwim(bool bState)
m_bSwim = bState;
}
-bool CPhysics::RetSwim()
+bool CPhysics::GetSwim()
{
return m_bSwim;
}
@@ -290,7 +279,7 @@ void CPhysics::SetCollision(bool bCollision)
m_bCollision = bCollision;
}
-bool CPhysics::RetCollision()
+bool CPhysics::GetCollision()
{
return m_bCollision;
}
@@ -303,7 +292,7 @@ void CPhysics::SetFreeze(bool bFreeze)
m_bFreeze = bFreeze;
}
-bool CPhysics::RetFreeze()
+bool CPhysics::GetFreeze()
{
return m_bFreeze;
}
@@ -316,7 +305,7 @@ void CPhysics::SetReactorRange(float range)
m_reactorRange = range;
}
-float CPhysics::RetReactorRange()
+float CPhysics::GetReactorRange()
{
return m_reactorRange;
}
@@ -359,22 +348,22 @@ void CPhysics::SetMotorSpeedZ(float speed)
m_motorSpeed.z = speed;
}
-Math::Vector CPhysics::RetMotorSpeed()
+Math::Vector CPhysics::GetMotorSpeed()
{
return m_motorSpeed;
}
-float CPhysics::RetMotorSpeedX()
+float CPhysics::GetMotorSpeedX()
{
return m_motorSpeed.x;
}
-float CPhysics::RetMotorSpeedY()
+float CPhysics::GetMotorSpeedY()
{
return m_motorSpeed.y;
}
-float CPhysics::RetMotorSpeedZ()
+float CPhysics::GetMotorSpeedZ()
{
return m_motorSpeed.z;
}
@@ -399,7 +388,7 @@ void CPhysics::SetLinMotion(PhysicsMode mode, Math::Vector value)
if ( mode == MO_REASPEED ) m_linMotion.realSpeed = value;
}
-Math::Vector CPhysics::RetLinMotion(PhysicsMode mode)
+Math::Vector CPhysics::GetLinMotion(PhysicsMode mode)
{
if ( mode == MO_ADVACCEL ) return m_linMotion.advanceAccel;
if ( mode == MO_RECACCEL ) return m_linMotion.recedeAccel;
@@ -432,7 +421,7 @@ void CPhysics::SetLinMotionX(PhysicsMode mode, float value)
if ( mode == MO_REASPEED ) m_linMotion.realSpeed.x = value;
}
-float CPhysics::RetLinMotionX(PhysicsMode mode)
+float CPhysics::GetLinMotionX(PhysicsMode mode)
{
if ( mode == MO_ADVACCEL ) return m_linMotion.advanceAccel.x;
if ( mode == MO_RECACCEL ) return m_linMotion.recedeAccel.x;
@@ -467,7 +456,7 @@ void CPhysics::SetLinMotionY(PhysicsMode mode, float value)
if ( mode == MO_REASPEED ) m_linMotion.realSpeed.y = value;
}
-float CPhysics::RetLinMotionY(PhysicsMode mode)
+float CPhysics::GetLinMotionY(PhysicsMode mode)
{
if ( mode == MO_ADVACCEL ) return m_linMotion.advanceAccel.y;
if ( mode == MO_RECACCEL ) return m_linMotion.recedeAccel.y;
@@ -502,7 +491,7 @@ void CPhysics::SetLinMotionZ(PhysicsMode mode, float value)
if ( mode == MO_REASPEED ) m_linMotion.realSpeed.z = value;
}
-float CPhysics::RetLinMotionZ(PhysicsMode mode)
+float CPhysics::GetLinMotionZ(PhysicsMode mode)
{
if ( mode == MO_ADVACCEL ) return m_linMotion.advanceAccel.z;
if ( mode == MO_RECACCEL ) return m_linMotion.recedeAccel.z;
@@ -537,7 +526,7 @@ void CPhysics::SetCirMotion(PhysicsMode mode, Math::Vector value)
if ( mode == MO_REASPEED ) m_cirMotion.realSpeed = value;
}
-Math::Vector CPhysics::RetCirMotion(PhysicsMode mode)
+Math::Vector CPhysics::GetCirMotion(PhysicsMode mode)
{
if ( mode == MO_ADVACCEL ) return m_cirMotion.advanceAccel;
if ( mode == MO_RECACCEL ) return m_cirMotion.recedeAccel;
@@ -570,7 +559,7 @@ void CPhysics::SetCirMotionX(PhysicsMode mode, float value)
if ( mode == MO_REASPEED ) m_cirMotion.realSpeed.x = value;
}
-float CPhysics::RetCirMotionX(PhysicsMode mode)
+float CPhysics::GetCirMotionX(PhysicsMode mode)
{
if ( mode == MO_ADVACCEL ) return m_cirMotion.advanceAccel.x;
if ( mode == MO_RECACCEL ) return m_cirMotion.recedeAccel.x;
@@ -605,7 +594,7 @@ void CPhysics::SetCirMotionY(PhysicsMode mode, float value)
if ( mode == MO_REASPEED ) m_cirMotion.realSpeed.y = value;
}
-float CPhysics::RetCirMotionY(PhysicsMode mode)
+float CPhysics::GetCirMotionY(PhysicsMode mode)
{
if ( mode == MO_ADVACCEL ) return m_cirMotion.advanceAccel.y;
if ( mode == MO_RECACCEL ) return m_cirMotion.recedeAccel.y;
@@ -640,7 +629,7 @@ void CPhysics::SetCirMotionZ(PhysicsMode mode, float value)
if ( mode == MO_REASPEED ) m_cirMotion.realSpeed.z = value;
}
-float CPhysics::RetCirMotionZ(PhysicsMode mode)
+float CPhysics::GetCirMotionZ(PhysicsMode mode)
{
if ( mode == MO_ADVACCEL ) return m_cirMotion.advanceAccel.z;
if ( mode == MO_RECACCEL ) return m_cirMotion.recedeAccel.z;
@@ -664,12 +653,12 @@ float CPhysics::RetCirMotionZ(PhysicsMode mode)
// d = -----
// 2a
-float CPhysics::RetLinStopLength(PhysicsMode sMode, PhysicsMode aMode)
+float CPhysics::GetLinStopLength(PhysicsMode sMode, PhysicsMode aMode)
{
float speed, accel;
- speed = RetLinMotionX(sMode); // MO_ADVSPEED/MO_RECSPEED
- accel = RetLinMotionX(aMode); // MO_ADVACCEL/MO_RECACCEL/MO_STOACCEL
+ speed = GetLinMotionX(sMode); // MO_ADVSPEED/MO_RECSPEED
+ accel = GetLinMotionX(aMode); // MO_ADVACCEL/MO_RECACCEL/MO_STOACCEL
if ( m_type == TYPE_FLYING && m_bLand ) // flying on the ground?
{
@@ -682,7 +671,7 @@ float CPhysics::RetLinStopLength(PhysicsMode sMode, PhysicsMode aMode)
// Returns the angle of circular braking.
-float CPhysics::RetCirStopLength()
+float CPhysics::GetCirStopLength()
{
return m_cirMotion.advanceSpeed.y * m_cirMotion.advanceSpeed.y /
m_cirMotion.stopAccel.y / 2.0f;
@@ -690,7 +679,7 @@ float CPhysics::RetCirStopLength()
// Returns the length advanced into a second, on the ground, maximum speed.
-float CPhysics::RetLinMaxLength(float dir)
+float CPhysics::GetLinMaxLength(float dir)
{
float dist;
@@ -707,36 +696,36 @@ float CPhysics::RetLinMaxLength(float dir)
// Returns the time needed to travel some distance.
-float CPhysics::RetLinTimeLength(float dist, float dir)
+float CPhysics::GetLinTimeLength(float dist, float dir)
{
float accel, decel, dps;
if ( dir > 0.0f )
{
- accel = RetLinStopLength(MO_ADVSPEED, MO_ADVACCEL);
- decel = RetLinStopLength(MO_ADVSPEED, MO_STOACCEL);
+ accel = GetLinStopLength(MO_ADVSPEED, MO_ADVACCEL);
+ decel = GetLinStopLength(MO_ADVSPEED, MO_STOACCEL);
}
else
{
- accel = RetLinStopLength(MO_RECSPEED, MO_RECACCEL);
- decel = RetLinStopLength(MO_RECSPEED, MO_STOACCEL);
+ accel = GetLinStopLength(MO_RECSPEED, MO_RECACCEL);
+ decel = GetLinStopLength(MO_RECSPEED, MO_STOACCEL);
}
- dps = RetLinMaxLength(dir);
+ dps = GetLinMaxLength(dir);
return (dist+accel+decel)/dps;
}
// Returns the length for a forward travel some distance, taking into account the accelerations / decelerations.
-float CPhysics::RetLinLength(float dist)
+float CPhysics::GetLinLength(float dist)
{
float accDist, desDist;
if ( dist > 0.0f )
{
- accDist = RetLinStopLength(MO_ADVSPEED, MO_ADVACCEL);
- desDist = RetLinStopLength(MO_ADVSPEED, MO_STOACCEL);
+ accDist = GetLinStopLength(MO_ADVSPEED, MO_ADVACCEL);
+ desDist = GetLinStopLength(MO_ADVSPEED, MO_STOACCEL);
if ( dist > accDist+desDist )
{
@@ -749,8 +738,8 @@ float CPhysics::RetLinLength(float dist)
else
{
dist = -dist;
- accDist = RetLinStopLength(MO_RECSPEED, MO_RECACCEL);
- desDist = RetLinStopLength(MO_RECSPEED, MO_STOACCEL);
+ accDist = GetLinStopLength(MO_RECSPEED, MO_RECACCEL);
+ desDist = GetLinStopLength(MO_RECSPEED, MO_STOACCEL);
if ( dist > accDist+desDist )
{
@@ -768,14 +757,14 @@ float CPhysics::RetLinLength(float dist)
bool CPhysics::EventProcess(const Event &event)
{
- if ( !m_object->RetEnable() ) return true;
+ if ( !m_object->GetEnable() ) return true;
if ( m_brain != 0 )
{
m_brain->EventProcess(event);
}
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
@@ -792,7 +781,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
Math::Vector pos, motorSpeed;
float energy, speed, factor, h;
- type = m_object->RetType();
+ type = m_object->GetType();
motorSpeed = m_motorSpeed;
@@ -810,8 +799,8 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
type == OBJECT_TECH )
{
power = 0;
- if ( m_object->RetFret() != 0 && // carries something?
- !m_object->RetCargo() )
+ if ( m_object->GetFret() != 0 && // carries something?
+ !m_object->GetCargo() )
{
motorSpeed.x *= 0.7f; // forward more slowly
motorSpeed.z *= 0.5f;
@@ -825,7 +814,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
motorSpeed.z *= 0.5f;
motorSpeed.y *= 0.5f;
- if ( m_object->RetFret() != 0 ) // carries something?
+ if ( m_object->GetFret() != 0 ) // carries something?
{
motorSpeed.x *= 0.2f;
motorSpeed.z *= 0.9f;
@@ -842,8 +831,8 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
}
else
{
- power = m_object->RetPower(); // searches for the object battery uses
- if ( power == 0 || power->RetEnergy() == 0.0f ) // no battery or flat?
+ power = m_object->GetPower(); // searches for the object battery uses
+ if ( power == 0 || power->GetEnergy() == 0.0f ) // no battery or flat?
{
motorSpeed.x = 0.0f;
motorSpeed.z = 0.0f;
@@ -859,11 +848,11 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
}
}
- if ( m_object->RetDead() ) // dead man?
+ if ( m_object->GetDead() ) // dead man?
{
motorSpeed.x = 0.0f;
motorSpeed.z = 0.0f;
- if ( m_motion->RetAction() == MHS_DEADw ) // drowned?
+ if ( m_motion->GetAction() == MHS_DEADw ) // drowned?
{
motorSpeed.y = 0.0f; // this is MHS_DEADw going back
}
@@ -876,9 +865,9 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
if ( m_type == TYPE_FLYING && !m_bLand && motorSpeed.y > 0.0f )
{
- pos = m_object->RetPosition(0);
- h = m_terrain->RetFlyingLimit(pos, type==OBJECT_BEE);
- h += m_object->RetCharacter()->height;
+ pos = m_object->GetPosition(0);
+ h = m_terrain->GetFlyingLimit(pos, type==OBJECT_BEE);
+ h += m_object->GetCharacter()->height;
if ( pos.y > h-40.0f ) // almost at the top?
{
factor = 1.0f-(pos.y-(h-40.0f))/40.0f;
@@ -889,7 +878,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
}
if ( type != OBJECT_BEE &&
- m_object->RetRange() > 0.0f ) // limited flight range?
+ m_object->GetRange() > 0.0f ) // limited flight range?
{
if ( m_bLand || m_bSwim || m_bObstacle ) // on the ground or in the water?
{
@@ -900,9 +889,9 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
if ( m_reactorRange > 1.0f )
{
m_reactorRange = 1.0f;
- if ( m_bLowLevel && m_object->RetSelect() ) // beep cool?
+ if ( m_bLowLevel && m_object->GetSelect() ) // beep cool?
{
- m_sound->Play(SOUND_INFO, m_object->RetPosition(0), 1.0f, 2.0f);
+ m_sound->Play(SOUND_INFO, m_object->GetPosition(0), 1.0f, 2.0f);
m_bLowLevel = false;
}
}
@@ -910,7 +899,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
}
else // in flight?
{
- m_reactorRange -= rTime*(1.0f/m_object->RetRange());
+ m_reactorRange -= rTime*(1.0f/m_object->GetRange());
if ( m_reactorRange < 0.0f ) m_reactorRange = 0.0f;
if ( m_reactorRange < 0.5f ) m_bLowLevel = true;
}
@@ -921,7 +910,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
}
}
-//? MotorParticule(aTime);
+//? MotorParticle(aTime);
// Forward/backward.
if ( motorSpeed.x > 0.0f )
@@ -991,9 +980,9 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
m_linMotion.motorAccel.x = m_linMotion.stopAccel.x*factor;
m_cirMotion.motorAccel.y = m_cirMotion.stopAccel.y*factor;
- pos = m_object->RetPosition(0);
- h = m_terrain->RetFlyingLimit(pos, type==OBJECT_BEE);
- h += m_object->RetCharacter()->height;
+ pos = m_object->GetPosition(0);
+ h = m_terrain->GetFlyingLimit(pos, type==OBJECT_BEE);
+ h += m_object->GetCharacter()->height;
if ( motorSpeed.y > 0.0f && m_reactorRange > 0.1f && pos.y < h )
{
m_bLand = false; // take off
@@ -1024,9 +1013,9 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
type == OBJECT_MOBILEic ||
type == OBJECT_MOBILEii ) factor = 0.5f;
- factor /= power->RetCapacity();
+ factor /= power->GetCapacity();
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
energy -= fabs(motorSpeed.x)*rTime*factor*0.005f;
energy -= fabs(motorSpeed.z)*rTime*factor*0.005f;
@@ -1050,21 +1039,21 @@ void CPhysics::EffectUpdate(float aTime, float rTime)
ObjectType type;
bool bOnBoard;
- if ( !m_engine->IsVisiblePoint(m_object->RetPosition(0)) ) return;
+ if ( !m_engine->IsVisiblePoint(m_object->GetPosition(0)) ) return;
- type = m_object->RetType();
- character = m_object->RetCharacter();
+ type = m_object->GetType();
+ character = m_object->GetCharacter();
bOnBoard = false;
- if ( m_object->RetSelect() &&
- m_camera->RetType() == CAMERA_ONBOARD )
+ if ( m_object->GetSelect() &&
+ m_camera->GetType() == Gfx::CAM_TYPE_ONBOARD )
{
bOnBoard = true;
}
- vibLin = m_motion->RetLinVibration();
- vibCir = m_motion->RetCirVibration();
- incl = m_motion->RetInclinaison();
+ vibLin = m_motion->GetLinVibration();
+ vibCir = m_motion->GetCirVibration();
+ incl = m_motion->GetInclinaison();
if ( type == OBJECT_HUMAN || // human?
type == OBJECT_TECH )
@@ -1175,6 +1164,7 @@ void CPhysics::EffectUpdate(float aTime, float rTime)
else
{
m_motion->SetLinVibration(Math::Vector(0.0f, 0.0f, 0.0f));
+
//? m_motion->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f));
//? m_motion->SetInclinaison(Math::Vector(0.0f, 0.0f, 0.0f));
}
@@ -1475,24 +1465,24 @@ bool CPhysics::EventFrame(const Event &event)
float h, w;
int i;
- if ( m_engine->RetPause() ) return true;
+ if ( m_engine->GetPause() ) return true;
m_time += event.rTime;
m_timeUnderWater += event.rTime;
m_soundTimeJostle += event.rTime;
- type = m_object->RetType();
+ type = m_object->GetType();
- FrameParticule(m_time, event.rTime);
+ FrameParticle(m_time, event.rTime);
MotorUpdate(m_time, event.rTime);
EffectUpdate(m_time, event.rTime);
WaterFrame(m_time, event.rTime);
- iPos = pos = m_object->RetPosition(0);
- iAngle = angle = m_object->RetAngle(0);
+ iPos = pos = m_object->GetPosition(0);
+ iAngle = angle = m_object->GetAngle(0);
// Accelerate is the descent, brake is the ascent.
- if ( m_bFreeze || m_object->RetDead() )
+ if ( m_bFreeze || m_object->GetDead() )
{
m_linMotion.terrainSpeed.x = 0.0f;
m_linMotion.terrainSpeed.z = 0.0f;
@@ -1501,7 +1491,7 @@ bool CPhysics::EventFrame(const Event &event)
else
{
tAngle = angle;
- h = m_terrain->RetBuildingFactor(pos);
+ h = m_terrain->GetBuildingFactor(pos);
if ( type == OBJECT_HUMAN ||
type == OBJECT_TECH )
{
@@ -1512,7 +1502,7 @@ bool CPhysics::EventFrame(const Event &event)
FloorAngle(pos, tAngle); // calculates the angle with the ground
}
#if 1
- if ( pos.y < m_water->RetLevel(m_object) ) // underwater?
+ if ( pos.y < m_water->GetLevel(m_object) ) // underwater?
{
h *= 0.5f;
}
@@ -1535,7 +1525,7 @@ bool CPhysics::EventFrame(const Event &event)
if ( type == OBJECT_BEE && !m_bLand )
{
h = m_floorLevel; // ground level
- w = m_water->RetLevel(m_object);
+ w = m_water->GetLevel(m_object);
if ( h < w ) h = w;
h = pos.y-h-10.0f; // maximum height (*)
if ( h < 0.0f ) h = 0.0f;
@@ -1554,12 +1544,12 @@ bool CPhysics::EventFrame(const Event &event)
newpos = Transform(matRotate, newpos);
newpos += pos;
- m_terrain->LimitPos(newpos);
+ m_terrain->AdjustToStandardBounds(newpos);
if ( m_type == TYPE_FLYING && !m_bLand )
{
- h = m_terrain->RetFlyingLimit(newpos, type==OBJECT_BEE);
- h += m_object->RetCharacter()->height;
+ h = m_terrain->GetFlyingLimit(newpos, type==OBJECT_BEE);
+ h += m_object->GetCharacter()->height;
if ( newpos.y > h ) newpos.y = h;
}
@@ -1604,7 +1594,7 @@ bool CPhysics::EventFrame(const Event &event)
m_object->SetPosition(0, newpos);
}
- MotorParticule(m_time, event.rTime);
+ MotorParticle(m_time, event.rTime);
SoundMotor(event.rTime);
m_bForceUpdate = false;
@@ -1621,33 +1611,33 @@ void CPhysics::SoundMotor(float rTime)
float energy;
m_lastSoundInsect -= rTime;
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type == OBJECT_MOTHER )
{
- if ( m_lastSoundInsect <= 0.0f && m_object->RetActif() )
+ if ( m_lastSoundInsect <= 0.0f && m_object->GetActif() )
{
- m_sound->Play(SOUND_INSECTm, m_object->RetPosition(0));
+ m_sound->Play(SOUND_INSECTm, m_object->GetPosition(0));
if ( m_bMotor ) m_lastSoundInsect = 0.4f+Math::Rand()*2.5f;
else m_lastSoundInsect = 1.5f+Math::Rand()*4.0f;
}
}
else if ( type == OBJECT_ANT )
{
- if ( m_object->RetBurn() ||
- m_object->RetFixed() )
+ if ( m_object->GetBurn() ||
+ m_object->GetFixed() )
{
if ( m_lastSoundInsect <= 0.0f )
{
- m_sound->Play(SOUND_INSECTa, m_object->RetPosition(0), 1.0f, 1.5f+Math::Rand()*0.5f);
+ m_sound->Play(SOUND_INSECTa, m_object->GetPosition(0), 1.0f, 1.5f+Math::Rand()*0.5f);
m_lastSoundInsect = 0.4f+Math::Rand()*0.6f;
}
}
- else if ( m_object->RetActif() )
+ else if ( m_object->GetActif() )
{
if ( m_lastSoundInsect <= 0.0f )
{
- m_sound->Play(SOUND_INSECTa, m_object->RetPosition(0));
+ m_sound->Play(SOUND_INSECTa, m_object->GetPosition(0));
if ( m_bMotor ) m_lastSoundInsect = 0.4f+Math::Rand()*2.5f;
else m_lastSoundInsect = 1.5f+Math::Rand()*4.0f;
}
@@ -1655,60 +1645,60 @@ void CPhysics::SoundMotor(float rTime)
}
else if ( type == OBJECT_BEE )
{
- if ( m_object->RetActif() )
+ if ( m_object->GetActif() )
{
if ( m_lastSoundInsect <= 0.0f )
{
- m_sound->Play(SOUND_INSECTb, m_object->RetPosition(0));
+ m_sound->Play(SOUND_INSECTb, m_object->GetPosition(0));
if ( m_bMotor ) m_lastSoundInsect = 0.4f+Math::Rand()*2.5f;
else m_lastSoundInsect = 1.5f+Math::Rand()*4.0f;
}
}
- else if ( m_object->RetBurn() )
+ else if ( m_object->GetBurn() )
{
if ( m_lastSoundInsect <= 0.0f )
{
- m_sound->Play(SOUND_INSECTb, m_object->RetPosition(0), 1.0f, 1.5f+Math::Rand()*0.5f);
+ m_sound->Play(SOUND_INSECTb, m_object->GetPosition(0), 1.0f, 1.5f+Math::Rand()*0.5f);
m_lastSoundInsect = 0.3f+Math::Rand()*0.5f;
}
}
}
else if ( type == OBJECT_WORM )
{
- if ( m_object->RetActif() )
+ if ( m_object->GetActif() )
{
if ( m_lastSoundInsect <= 0.0f )
{
- m_sound->Play(SOUND_INSECTw, m_object->RetPosition(0));
+ m_sound->Play(SOUND_INSECTw, m_object->GetPosition(0));
if ( m_bMotor ) m_lastSoundInsect = 0.4f+Math::Rand()*2.5f;
else m_lastSoundInsect = 1.5f+Math::Rand()*4.0f;
}
}
- else if ( m_object->RetBurn() )
+ else if ( m_object->GetBurn() )
{
if ( m_lastSoundInsect <= 0.0f )
{
- m_sound->Play(SOUND_INSECTw, m_object->RetPosition(0), 1.0f, 1.5f+Math::Rand()*0.5f);
+ m_sound->Play(SOUND_INSECTw, m_object->GetPosition(0), 1.0f, 1.5f+Math::Rand()*0.5f);
m_lastSoundInsect = 0.2f+Math::Rand()*0.2f;
}
}
}
else if ( type == OBJECT_SPIDER )
{
- if ( m_object->RetBurn() ||
- m_object->RetFixed() )
+ if ( m_object->GetBurn() ||
+ m_object->GetFixed() )
{
if ( m_lastSoundInsect <= 0.0f )
{
- m_sound->Play(SOUND_INSECTs, m_object->RetPosition(0), 1.0f, 1.5f+Math::Rand()*0.5f);
+ m_sound->Play(SOUND_INSECTs, m_object->GetPosition(0), 1.0f, 1.5f+Math::Rand()*0.5f);
m_lastSoundInsect = 0.4f+Math::Rand()*0.6f;
}
}
- else if ( m_object->RetActif() )
+ else if ( m_object->GetActif() )
{
if ( m_lastSoundInsect <= 0.0f )
{
- m_sound->Play(SOUND_INSECTs, m_object->RetPosition(0));
+ m_sound->Play(SOUND_INSECTs, m_object->GetPosition(0));
if ( m_bMotor ) m_lastSoundInsect = 0.4f+Math::Rand()*2.5f;
else m_lastSoundInsect = 1.5f+Math::Rand()*4.0f;
}
@@ -1718,20 +1708,20 @@ void CPhysics::SoundMotor(float rTime)
{
if ( m_type == TYPE_ROLLING )
{
- if ( m_bMotor && m_object->RetActif() )
+ if ( m_bMotor && m_object->GetActif() )
{
SoundMotorFull(rTime, type); // full diet
}
else
{
energy = 0.0f;
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
}
- if ( m_object->RetSelect() &&
+ if ( m_object->GetSelect() &&
energy != 0.0f )
{
SoundMotorSlow(rTime, type); // in slow motion
@@ -1746,7 +1736,7 @@ void CPhysics::SoundMotor(float rTime)
if ( m_type == TYPE_FLYING )
{
if ( m_bMotor && !m_bSwim &&
- m_object->RetActif() && !m_object->RetDead() )
+ m_object->GetActif() && !m_object->GetDead() )
{
SoundReactorFull(rTime, type); // full diet
}
@@ -1767,20 +1757,20 @@ void CPhysics::WaterFrame(float aTime, float rTime)
Math::Point dim;
float level;
- level = m_water->RetLevel();
+ level = m_water->GetLevel();
if ( level == 0.0f ) return; // no water?
- if ( m_object->RetTruck() != 0 ) return; // object transported?
+ if ( m_object->GetTruck() != 0 ) return; // object transported?
// Management of flames into the lava.
- pos = m_object->RetPosition(0);
- if ( m_water->RetLava() &&
- pos.y-m_object->RetCharacter()->height <= level )
+ pos = m_object->GetPosition(0);
+ if ( m_water->GetLava() &&
+ pos.y-m_object->GetCharacter()->height <= level )
{
- if ( m_lastFlameParticule+m_engine->ParticuleAdapt(0.05f) <= aTime )
+ if ( m_lastFlameParticle+m_engine->ParticleAdapt(0.05f) <= aTime )
{
- m_lastFlameParticule = aTime;
+ m_lastFlameParticle = aTime;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*3.0f;
pos.z += (Math::Rand()-0.5f)*3.0f;
speed.x = 0.0f;
@@ -1788,9 +1778,9 @@ void CPhysics::WaterFrame(float aTime, float rTime)
speed.y = Math::Rand()*5.0f+3.0f;
dim.x = Math::Rand()*2.0f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIFLAME, 2.0f, 0.0f, 0.2f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFLAME, 2.0f, 0.0f, 0.2f);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y -= 2.0f;
pos.x += (Math::Rand()-0.5f)*5.0f;
pos.z += (Math::Rand()-0.5f)*5.0f;
@@ -1799,23 +1789,23 @@ void CPhysics::WaterFrame(float aTime, float rTime)
speed.y = 6.0f+Math::Rand()*6.0f+6.0f;
dim.x = Math::Rand()*1.5f+1.0f+3.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f);
}
}
- pos = m_object->RetPosition(0);
- if ( pos.y >= m_water->RetLevel(m_object) ) return; // out of water?
+ pos = m_object->GetPosition(0);
+ if ( pos.y >= m_water->GetLevel(m_object) ) return; // out of water?
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type == OBJECT_TOTO ) return;
if ( type == OBJECT_NULL ) return;
- if ( !m_object->RetActif() ) return;
- if ( m_object->RetResetBusy() ) return; // reset in progress?
+ if ( !m_object->GetActif() ) return;
+ if ( m_object->GetResetBusy() ) return; // reset in progress?
- if ( m_water->RetLava() ||
+ if ( m_water->GetLava() ||
(type == OBJECT_HUMAN &&
- m_object->RetOption() != 0 ) || // human without a helmet?
+ m_object->GetOption() != 0 ) || // human without a helmet?
type == OBJECT_MOBILEfa ||
type == OBJECT_MOBILEta ||
type == OBJECT_MOBILEwa ||
@@ -1861,13 +1851,13 @@ void CPhysics::SoundMotorFull(float rTime, ObjectType type)
{
if ( m_soundChannel == -1 )
{
- m_soundChannel = m_sound->Play(SOUND_MOTORi, m_object->RetPosition(0), 0.0f, 1.0f, true);
+ m_soundChannel = m_sound->Play(SOUND_MOTORi, m_object->GetPosition(0), 0.0f, 1.0f, true);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 1.0f, 0.2f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 1.0f, 1.0f, SOPER_LOOP);
}
else
{
- m_sound->Position(m_soundChannel, m_object->RetPosition(0));
+ m_sound->Position(m_soundChannel, m_object->GetPosition(0));
}
freq = 1.0f+m_linMotion.terrainSpeed.x/50.0f;
@@ -1921,7 +1911,7 @@ void CPhysics::SoundMotorFull(float rTime, ObjectType type)
time = 0.3f;
}
- if ( m_object->RetToy() )
+ if ( m_object->GetToy() )
{
sound = SOUND_MOTORd;
amplitude = 1.0f;
@@ -1930,17 +1920,17 @@ void CPhysics::SoundMotorFull(float rTime, ObjectType type)
freq = 0.75f+(fabs(m_motorSpeed.x)+fabs(m_motorSpeed.z))*0.25f;
if ( freq > 1.0f ) freq = 1.0f;
- if ( m_object->RetToy() ) freq = 1.0f;
+ if ( m_object->GetToy() ) freq = 1.0f;
if ( m_soundChannel == -1 )
{
- m_soundChannel = m_sound->Play(sound, m_object->RetPosition(0), 0.0f, 0.5f, true);
+ m_soundChannel = m_sound->Play(sound, m_object->GetPosition(0), 0.0f, 0.5f, true);
m_sound->AddEnvelope(m_soundChannel, amplitude, freq, time, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, amplitude, freq, 1.0f, SOPER_LOOP);
}
else
{
- m_sound->Position(m_soundChannel, m_object->RetPosition(0));
+ m_sound->Position(m_soundChannel, m_object->GetPosition(0));
if ( m_bSoundSlow ) // in slow motion?
{
@@ -2020,7 +2010,7 @@ void CPhysics::SoundMotorSlow(float rTime, ObjectType type)
amplitude = 0.3f;
}
- if ( m_object->RetToy() )
+ if ( m_object->GetToy() )
{
sound = SOUND_MOTORd;
amplitude = 0.0f;
@@ -2028,13 +2018,13 @@ void CPhysics::SoundMotorSlow(float rTime, ObjectType type)
if ( m_soundChannel == -1 )
{
- m_soundChannel = m_sound->Play(sound, m_object->RetPosition(0), 0.0f, 0.25f, true);
+ m_soundChannel = m_sound->Play(sound, m_object->GetPosition(0), 0.0f, 0.25f, true);
m_sound->AddEnvelope(m_soundChannel, amplitude, 0.5f, 0.2f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, amplitude, 0.5f, 1.0f, SOPER_LOOP);
}
else
{
- m_sound->Position(m_soundChannel, m_object->RetPosition(0));
+ m_sound->Position(m_soundChannel, m_object->GetPosition(0));
if ( !m_bSoundSlow ) // full power?
{
@@ -2056,12 +2046,12 @@ void CPhysics::SoundMotorSlow(float rTime, ObjectType type)
{
amplitude = 0.5f-m_soundTimePshhh*0.08f;
if ( amplitude > 1.0f ) amplitude = 1.0f;
-//? m_sound->Play(SOUND_PSHHH, m_object->RetPosition(0), amplitude);
- m_sound->Play(SOUND_PSHHH, m_object->RetPosition(0), 1.0f);
+//? m_sound->Play(SOUND_PSHHH, m_object->GetPosition(0), amplitude);
+ m_sound->Play(SOUND_PSHHH, m_object->GetPosition(0), 1.0f);
m_soundTimePshhh = 4.0f+4.0f*Math::Rand();
- max = (int)(10.0f*m_engine->RetParticuleDensity());
+ max = static_cast<int>(10.0f*m_engine->GetParticleDensity());
for ( i=0 ; i<max ; i++ )
{
pos = Math::Vector(-5.0f, 2.0f, 0.0f);
@@ -2073,14 +2063,14 @@ void CPhysics::SoundMotorSlow(float rTime, ObjectType type)
speed.y -= Math::Rand()*3.0f;
speed.z += (Math::Rand()-0.5f)*6.0f;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, pos);
speed = Transform(*mat, speed)-pos;
dim.x = Math::Rand()*1.0f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIMOTOR, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIMOTOR, 2.0f);
}
}
}
@@ -2146,13 +2136,13 @@ void CPhysics::SoundReactorFull(float rTime, ObjectType type)
sound = SOUND_FLY;
}
- m_soundChannel = m_sound->Play(sound, m_object->RetPosition(0), 0.0f, 1.0f, true);
+ m_soundChannel = m_sound->Play(sound, m_object->GetPosition(0), 0.0f, 1.0f, true);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 1.0f, 0.6f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 1.0f, 1.0f, SOPER_LOOP);
}
else
{
- m_sound->Position(m_soundChannel, m_object->RetPosition(0));
+ m_sound->Position(m_soundChannel, m_object->GetPosition(0));
}
freq = 1.0f + m_linMotion.realSpeed.y/100.0f;
@@ -2171,13 +2161,13 @@ void CPhysics::SoundReactorFull(float rTime, ObjectType type)
if ( m_timeReactorFail <= m_time )
{
freq = 1.0f+Math::Rand()*0.5f;
- m_sound->Play(SOUND_FLYf, m_object->RetPosition(0), 1.0f, freq);
- m_camera->StartEffect(CE_PET, m_object->RetPosition(0), 1.0f);
+ m_sound->Play(SOUND_FLYf, m_object->GetPosition(0), 1.0f, freq);
+ m_camera->StartEffect(Gfx::CAM_EFFECT_PET, m_object->GetPosition(0), 1.0f);
for ( i=0 ; i<5 ; i++ )
{
- if ( m_object->RetType() == OBJECT_HUMAN ||
- m_object->RetType() == OBJECT_TECH )
+ if ( m_object->GetType() == OBJECT_HUMAN ||
+ m_object->GetType() == OBJECT_TECH )
{
pos = Math::Vector(-1.6f, -0.5f, 0.0f);
}
@@ -2187,22 +2177,22 @@ void CPhysics::SoundReactorFull(float rTime, ObjectType type)
}
pos.x += (Math::Rand()-0.5f)*2.0f;
pos.z += (Math::Rand()-0.5f)*2.0f;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, pos);
speed.x = (Math::Rand()-0.5f)*5.0f;
speed.z = (Math::Rand()-0.5f)*5.0f;
speed.y = -(4.0f+Math::Rand()*4.0f);
dim.x = (2.0f+Math::Rand()*1.0f);
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE1, 2.0f, 0.0f, 0.1f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE1, 2.0f, 0.0f, 0.1f);
}
m_timeReactorFail = m_time+0.10f+Math::Rand()*0.30f;
}
else
{
- if ( m_object->RetType() == OBJECT_HUMAN ||
- m_object->RetType() == OBJECT_TECH )
+ if ( m_object->GetType() == OBJECT_HUMAN ||
+ m_object->GetType() == OBJECT_TECH )
{
pos = Math::Vector(-1.6f, -0.5f, 0.0f);
}
@@ -2212,14 +2202,14 @@ void CPhysics::SoundReactorFull(float rTime, ObjectType type)
}
pos.x += (Math::Rand()-0.5f)*1.0f;
pos.z += (Math::Rand()-0.5f)*1.0f;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, pos);
speed.x = (Math::Rand()-0.5f)*2.0f;
speed.z = (Math::Rand()-0.5f)*2.0f;
speed.y = -(4.0f+Math::Rand()*4.0f);
dim.x = (0.7f+Math::Rand()*0.4f);
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE1, 2.0f, 0.0f, 0.1f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE1, 2.0f, 0.0f, 0.1f);
}
}
@@ -2233,10 +2223,10 @@ void CPhysics::SoundReactorStop(float rTime, ObjectType type)
float energy;
energy = 0.0f;
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
}
if ( m_soundChannel != -1 ) // engine is running?
@@ -2264,11 +2254,11 @@ void CPhysics::SoundReactorStop(float rTime, ObjectType type)
{
if ( m_soundChannelSlide == -1 )
{
- m_soundChannelSlide = m_sound->Play(SOUND_SLIDE, m_object->RetPosition(0), 0.0f, 1.0f, true);
+ m_soundChannelSlide = m_sound->Play(SOUND_SLIDE, m_object->GetPosition(0), 0.0f, 1.0f, true);
m_sound->AddEnvelope(m_soundChannelSlide, 0.5f, 1.0f, 0.3f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannelSlide, 0.5f, 1.0f, 1.0f, SOPER_LOOP);
}
- m_sound->Position(m_soundChannelSlide, m_object->RetPosition(0));
+ m_sound->Position(m_soundChannelSlide, m_object->GetPosition(0));
}
else
{
@@ -2293,21 +2283,20 @@ void CPhysics::FloorAdapt(float aTime, float rTime,
Math::Vector norm;
Math::Matrix matRotate;
float level, h, f, a1, volume, freq, force;
- bool bOldSwim, bSlopingTerrain;
+ bool bSlopingTerrain;
- type = m_object->RetType();
- character = m_object->RetCharacter();
+ type = m_object->GetType();
+ character = m_object->GetCharacter();
- level = m_water->RetLevel(m_object);
- bOldSwim = m_bSwim;
+ level = m_water->GetLevel(m_object);
SetSwim( pos.y < level );
- m_floorLevel = m_terrain->RetFloorLevel(pos); // height above the ground
+ m_floorLevel = m_terrain->GetFloorLevel(pos); // height above the ground
h = pos.y-m_floorLevel;
h -= character->height;
m_floorHeight = h;
- WaterParticule(aTime, pos, type, m_floorLevel,
+ WaterParticle(aTime, pos, type, m_floorLevel,
fabs(m_linMotion.realSpeed.x),
fabs(m_cirMotion.realSpeed.y*15.0f));
@@ -2342,13 +2331,13 @@ void CPhysics::FloorAdapt(float aTime, float rTime,
{
volume = fabs(m_linMotion.realSpeed.x*0.02f)+
fabs(m_linMotion.realSpeed.y*0.02f);
- freq = 0.5f+m_terrain->RetHardness(pos)*2.5f;
+ freq = 0.5f+m_terrain->GetHardness(pos)*2.5f;
m_sound->Play(SOUND_BOUM, pos, volume, freq);
m_soundTimeBoum = aTime;
}
-//? pos = m_object->RetPosition(0); // gives position before collision
+//? pos = m_object->GetPosition(0); // gives position before collision
}
}
}
@@ -2358,7 +2347,7 @@ void CPhysics::FloorAdapt(float aTime, float rTime,
if ( !m_bLand ) // in flight?
{
volume = fabs(m_linMotion.realSpeed.y*0.02f);
- freq = 0.5f+m_terrain->RetHardness(pos)*2.5f;
+ freq = 0.5f+m_terrain->GetHardness(pos)*2.5f;
m_sound->Play(SOUND_BOUM, pos, volume, freq);
}
@@ -2370,7 +2359,7 @@ void CPhysics::FloorAdapt(float aTime, float rTime,
if ( h < 0.0f )
{
f = fabs(m_linMotion.currentSpeed.y/m_linMotion.advanceSpeed.y);
- CrashParticule(f);
+ CrashParticle(f);
}
m_linMotion.currentSpeed.y = 0.0f;
m_inclinaisonFactor = 1.0f/LANDING_SPEED; // slips a little to the ground
@@ -2422,13 +2411,13 @@ void CPhysics::FloorAdapt(float aTime, float rTime,
if ( m_floorHeight == 0.0f ) // ground plate?
{
- if ( m_object->RetTraceDown() )
+ if ( m_object->GetTraceDown() )
{
- WheelParticule(m_object->RetTraceColor(), m_object->RetTraceWidth()*g_unit);
+ WheelParticle(m_object->GetTraceColor(), m_object->GetTraceWidth()*g_unit);
}
else
{
- WheelParticule(-1, 0.0f);
+ WheelParticle(-1, 0.0f);
}
}
@@ -2463,29 +2452,29 @@ void CPhysics::FloorAngle(const Math::Vector &pos, Math::Vector &angle)
Math::Vector pw, norm;
float a1, a2;
- character = m_object->RetCharacter();
+ character = m_object->GetCharacter();
pw.x = pos.x+character->wheelFront*cosf(angle.y+Math::PI*0.0f);
pw.y = pos.y;
pw.z = pos.z-character->wheelFront*sinf(angle.y+Math::PI*0.0f);
- a1 = atanf(m_terrain->RetFloorHeight(pw)/character->wheelFront);
+ a1 = atanf(m_terrain->GetHeightToFloor(pw)/character->wheelFront);
pw.x = pos.x+character->wheelBack*cosf(angle.y+Math::PI*1.0f);
pw.y = pos.y;
pw.z = pos.z-character->wheelBack*sinf(angle.y+Math::PI*1.0f);
- a2 = atanf(m_terrain->RetFloorHeight(pw)/character->wheelBack);
+ a2 = atanf(m_terrain->GetHeightToFloor(pw)/character->wheelBack);
angle.z = (a2-a1)/2.0f;
pw.x = pos.x+character->wheelLeft*cosf(angle.y+Math::PI*0.5f)*cosf(angle.z);
pw.y = pos.y;
pw.z = pos.z-character->wheelLeft*sinf(angle.y+Math::PI*0.5f)*cosf(angle.z);
- a1 = atanf(m_terrain->RetFloorHeight(pw)/character->wheelLeft);
+ a1 = atanf(m_terrain->GetHeightToFloor(pw)/character->wheelLeft);
pw.x = pos.x+character->wheelRight*cosf(angle.y+Math::PI*1.5f)*cosf(angle.z);
pw.y = pos.y;
pw.z = pos.z-character->wheelRight*sinf(angle.y+Math::PI*1.5f)*cosf(angle.z);
- a2 = atanf(m_terrain->RetFloorHeight(pw)/character->wheelRight);
+ a2 = atanf(m_terrain->GetHeightToFloor(pw)/character->wheelRight);
angle.x = (a2-a1)/2.0f;
}
@@ -2498,37 +2487,37 @@ void CPhysics::FloorAngle(const Math::Vector &pos, Math::Vector &angle)
int CPhysics::ObjectAdapt(const Math::Vector &pos, const Math::Vector &angle)
{
- CObject* pObj;
- CPyro* pyro;
- CPhysics* ph;
+ CObject* pObj;
+ Gfx::CPyro* pyro;
+ CPhysics* ph;
Math::Matrix matRotate;
Math::Vector iPos, oPos, iiPos, oAngle, oSpeed;
- Sound sound;
- float iRad, oRad, distance, force, volume;
- int i, j, colType;
- ObjectType iType, oType;
+ Sound sound;
+ float iRad, oRad, distance, force, volume;
+ int i, j, colType;
+ ObjectType iType, oType;
- if ( m_object->RetRuin() ) return 0; // is burning or exploding?
- if ( !m_object->RetClip() ) return 0;
+ if ( m_object->GetRuin() ) return 0; // is burning or exploding?
+ if ( !m_object->GetClip() ) return 0;
// iiPos = sphere center is the old position.
// iPos = sphere center has the new position.
m_object->GetCrashSphere(0, iiPos, iRad);
- iPos = iiPos + (pos - m_object->RetPosition(0));
- iType = m_object->RetType();
+ iPos = iiPos + (pos - m_object->GetPosition(0));
+ iType = m_object->GetType();
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == m_object ) continue; // yourself?
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
- if ( !pObj->RetEnable() ) continue; // inactive?
- if ( pObj->RetRuin() ) continue; // is burning or exploding?
- if ( pObj->RetDead() ) continue; // dead man?
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetEnable() ) continue; // inactive?
+ if ( pObj->GetRuin() ) continue; // is burning or exploding?
+ if ( pObj->GetDead() ) continue; // dead man?
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType == OBJECT_NULL ) continue;
if ( oType == OBJECT_TOTO ) continue;
//? if ( iType == OBJECT_BEE && oType == OBJECT_BEE ) continue;
@@ -2571,34 +2560,34 @@ int CPhysics::ObjectAdapt(const Math::Vector &pos, const Math::Vector &angle)
#if _TEEN
if ( oType == OBJECT_WAYPOINT &&
- pObj->RetEnable() &&
- !m_object->RetResetBusy() ) // driving vehicle?
+ pObj->GetEnable() &&
+ !m_object->GetResetBusy() ) // driving vehicle?
#else
if ( oType == OBJECT_WAYPOINT &&
- pObj->RetEnable() &&
- !m_object->RetResetBusy() &&
- m_object->RetTrainer() ) // driving vehicle?
+ pObj->GetEnable() &&
+ !m_object->GetResetBusy() &&
+ m_object->GetTrainer() ) // driving vehicle?
#endif
{
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
distance = Math::DistanceProjected(oPos, iPos);
if ( distance < 4.0f )
{
- m_sound->Play(SOUND_WAYPOINT, m_object->RetPosition(0));
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_WPCHECK, pObj);
+ m_sound->Play(SOUND_WAYPOINT, m_object->GetPosition(0));
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_WPCHECK, pObj);
}
}
if ( oType == OBJECT_TARGET2 )
{
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
distance = Math::Distance(oPos, iPos);
if ( distance < 10.0f*1.5f )
{
- m_sound->Play(SOUND_WAYPOINT, m_object->RetPosition(0));
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_WPCHECK, pObj);
+ m_sound->Play(SOUND_WAYPOINT, m_object->GetPosition(0));
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_WPCHECK, pObj);
}
}
@@ -2620,11 +2609,11 @@ int CPhysics::ObjectAdapt(const Math::Vector &pos, const Math::Vector &angle)
m_bCollision = true;
m_bObstacle = true;
- sound = pObj->RetCrashSphereSound(j-1);
+ sound = pObj->GetCrashSphereSound(j-1);
if ( sound != SOUND_CLICK )
{
force = fabs(m_linMotion.realSpeed.x);
- force *= pObj->RetCrashSphereHardness(j-1)*2.0f;
+ force *= pObj->GetCrashSphereHardness(j-1)*2.0f;
if ( ExploOther(iType, pObj, oType, force) ) continue;
colType = ExploHimself(iType, oType, force);
if ( colType == 2 ) return 2; // destroyed?
@@ -2632,16 +2621,16 @@ int CPhysics::ObjectAdapt(const Math::Vector &pos, const Math::Vector &angle)
}
force = m_linMotion.realSpeed.Length();
- force *= pObj->RetCrashSphereHardness(j-1);
+ force *= pObj->GetCrashSphereHardness(j-1);
volume = fabs(force*0.05f);
if ( volume > 1.0f ) volume = 1.0f;
if ( sound != SOUND_CLICK )
{
- m_sound->Play(sound, m_object->RetPosition(0), volume);
+ m_sound->Play(sound, m_object->GetPosition(0), volume);
}
if ( iType == OBJECT_HUMAN && volume > 0.5f )
{
- m_sound->Play(SOUND_AIE, m_object->RetPosition(0), volume);
+ m_sound->Play(SOUND_AIE, m_object->GetPosition(0), volume);
}
if ( m_repeatCollision > 0 )
@@ -2663,14 +2652,14 @@ int CPhysics::ObjectAdapt(const Math::Vector &pos, const Math::Vector &angle)
m_linMotion.currentSpeed.y = 0.0f;
}
- ph = pObj->RetPhysics();
+ ph = pObj->GetPhysics();
if ( ph != 0 )
{
- oAngle = pObj->RetAngle(0);
+ oAngle = pObj->GetAngle(0);
oSpeed = Normalize(oPos-iPos)*force;
Math::LoadRotationXZYMatrix(matRotate, -oAngle);
oSpeed = Transform(matRotate, oSpeed);
- if ( ph->RetType() == TYPE_ROLLING )
+ if ( ph->GetType() == TYPE_ROLLING )
{
oSpeed.y = 0.0f;
}
@@ -2737,7 +2726,7 @@ bool CPhysics::JostleObject(CObject* pObj, float force)
if ( m_soundTimeJostle >= 0.20f )
{
m_soundTimeJostle = 0.0f;
- m_sound->Play(SOUND_JOSTLE, pObj->RetPosition(0), force);
+ m_sound->Play(SOUND_JOSTLE, pObj->GetPosition(0), force);
}
return pObj->JostleObject(force);
@@ -2749,9 +2738,9 @@ bool CPhysics::JostleObject(CObject* pObj, float force)
bool CPhysics::ExploOther(ObjectType iType,
CObject *pObj, ObjectType oType, float force)
{
- CPyro* pyro;
+ Gfx::CPyro* pyro;
- if ( !pObj->RetEnable() ) return true;
+ if ( !pObj->GetEnable() ) return true;
JostleObject(pObj, 1.0f); // shakes the object
@@ -2759,24 +2748,24 @@ bool CPhysics::ExploOther(ObjectType iType,
(oType == OBJECT_FRET ||
oType == OBJECT_METAL ) )
{
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_EXPLOT, pObj); // total destruction
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_EXPLOT, pObj); // total destruction
}
if ( force > 50.0f &&
(oType == OBJECT_POWER ||
oType == OBJECT_ATOMIC ) )
{
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_FRAGT, pObj); // total destruction
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_FRAGT, pObj); // total destruction
}
if ( force > 25.0f &&
(oType == OBJECT_STONE ||
oType == OBJECT_URANIUM ) )
{
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_FRAGT, pObj); // total destruction
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_FRAGT, pObj); // total destruction
}
if ( force > 25.0f &&
@@ -2836,15 +2825,15 @@ bool CPhysics::ExploOther(ObjectType iType,
(oType == OBJECT_MOBILEtg ||
oType == OBJECT_TNT ) )
{
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_FRAGT, pObj); // total destruction
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_FRAGT, pObj); // total destruction
}
if ( force > 0.0f &&
oType == OBJECT_BOMB )
{
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_FRAGT, pObj); // total destruction
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_FRAGT, pObj); // total destruction
}
return false;
@@ -2857,16 +2846,16 @@ bool CPhysics::ExploOther(ObjectType iType,
int CPhysics::ExploHimself(ObjectType iType, ObjectType oType, float force)
{
- PyroType type;
- CPyro* pyro;
+ Gfx::PyroType type;
+ Gfx::CPyro* pyro;
if ( force > 10.0f &&
(oType == OBJECT_TNT ||
oType == OBJECT_MOBILEtg ) )
{
- if ( iType == OBJECT_HUMAN ) type = PT_DEADG;
- else type = PT_EXPLOT;
- pyro = new CPyro(m_iMan);
+ if ( iType == OBJECT_HUMAN ) type = Gfx::PT_DEADG;
+ else type = Gfx::PT_EXPLOT;
+ pyro = new Gfx::CPyro(m_iMan);
pyro->Create(type, m_object); // total destruction
return 2;
}
@@ -2876,19 +2865,19 @@ int CPhysics::ExploHimself(ObjectType iType, ObjectType oType, float force)
{
if ( iType == OBJECT_HUMAN )
{
- type = PT_DEADG;
+ type = Gfx::PT_DEADG;
}
else if ( iType == OBJECT_ANT ||
iType == OBJECT_SPIDER ||
iType == OBJECT_BEE )
{
- type = PT_EXPLOO;
+ type = Gfx::PT_EXPLOO;
}
else
{
- type = PT_EXPLOT;
+ type = Gfx::PT_EXPLOT;
}
- pyro = new CPyro(m_iMan);
+ pyro = new Gfx::CPyro(m_iMan);
pyro->Create(type, m_object); // total destruction
return 2;
}
@@ -2980,7 +2969,7 @@ int CPhysics::ExploHimself(ObjectType iType, ObjectType oType, float force)
// Makes the particles evolve.
-void CPhysics::FrameParticule(float aTime, float rTime)
+void CPhysics::FrameParticle(float aTime, float rTime)
{
Math::Vector pos;
CObject* power;
@@ -2988,61 +2977,61 @@ void CPhysics::FrameParticule(float aTime, float rTime)
int effectLight;
bool bFlash;
- m_restBreakParticule -= rTime;
- if ( aTime-m_lastPowerParticule < m_engine->ParticuleAdapt(0.05f) ) return;
- m_lastPowerParticule = aTime;
+ m_restBreakParticle -= rTime;
+ if ( aTime-m_lastPowerParticle < m_engine->ParticleAdapt(0.05f) ) return;
+ m_lastPowerParticle = aTime;
bFlash = false;
energy = 0.0f;
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
}
if ( energy != m_lastEnergy ) // change the energy level?
{
if ( energy > m_lastEnergy ) // recharge?
{
- PowerParticule(1.0f, false);
+ PowerParticle(1.0f, false);
bFlash = true;
}
if ( energy == 0.0f || m_lastEnergy == 0.0f )
{
- m_restBreakParticule = 2.5f; // particles for 2.5s
+ m_restBreakParticle = 2.5f; // particles for 2.5s
}
m_lastEnergy = energy;
}
- if ( m_restBreakParticule > 0.0f )
+ if ( m_restBreakParticle > 0.0f )
{
- PowerParticule(m_restBreakParticule/2.5f, (energy == 0));
+ PowerParticle(m_restBreakParticle/2.5f, (energy == 0));
bFlash = true;
}
- effectLight = m_object->RetEffectLight();
+ effectLight = m_object->GetEffectLight();
if ( effectLight != -1 )
{
if ( bFlash )
{
intensity = 0.0f;
if ( Math::Rand() < 0.5f ) intensity = 1.0f;
- m_light->SetLightIntensity(effectLight, intensity);
- m_light->SetLightIntensitySpeed(effectLight, 10000.0f);
+ m_lightMan->SetLightIntensity(effectLight, intensity);
+ m_lightMan->SetLightIntensitySpeed(effectLight, 10000.0f);
}
else
{
- m_light->SetLightIntensity(effectLight, 0.0f);
+ m_lightMan->SetLightIntensity(effectLight, 0.0f);
}
}
}
// Generates some particles after a recharge.
-void CPhysics::PowerParticule(float factor, bool bBreak)
+void CPhysics::PowerParticle(float factor, bool bBreak)
{
Character* character;
CObject* fret;
@@ -3052,15 +3041,15 @@ void CPhysics::PowerParticule(float factor, bool bBreak)
bool bCarryPower;
bCarryPower = false;
- fret = m_object->RetFret();
- if ( fret != 0 && fret->RetType() == OBJECT_POWER &&
- m_object->RetAngleZ(1) == ARM_STOCK_ANGLE1 )
+ fret = m_object->GetFret();
+ if ( fret != 0 && fret->GetType() == OBJECT_POWER &&
+ m_object->GetAngleZ(1) == ARM_STOCK_ANGLE1 )
{
bCarryPower = true; // carries a battery
}
- mat = m_object->RetWorldMatrix(0);
- character = m_object->RetCharacter();
+ mat = m_object->GetWorldMatrix(0);
+ character = m_object->GetCharacter();
pos = character->posPower;
pos.x -= 0.3f;
@@ -3078,7 +3067,7 @@ void CPhysics::PowerParticule(float factor, bool bBreak)
dim.x = 1.0f*factor;
dim.y = 1.0f*factor;
- m_particule->CreateParticule(ppos, speed, dim, PARTIBLITZ, 0.5f, 0.0f, 0.0f);
+ m_particle->CreateParticle(ppos, speed, dim, Gfx::PARTIBLITZ, 0.5f, 0.0f, 0.0f);
if ( bCarryPower ) // carry a battery?
{
@@ -3096,27 +3085,27 @@ void CPhysics::PowerParticule(float factor, bool bBreak)
dim.x = 1.0f*factor;
dim.y = 1.0f*factor;
- m_particule->CreateParticule(ppos, speed, dim, PARTIBLITZ, 0.5f, 0.0f, 0.0f);
+ m_particle->CreateParticle(ppos, speed, dim, Gfx::PARTIBLITZ, 0.5f, 0.0f, 0.0f);
}
}
// Generates some particles after a fall.
// crash: 0=super soft, 1=big crash
-void CPhysics::CrashParticule(float crash)
+void CPhysics::CrashParticle(float crash)
{
Math::Vector pos, ppos, speed;
Math::Point dim;
- float len;
- int i, max;
+ float len;
+ int i, max;
if ( crash < 0.2f ) return;
- pos = m_object->RetPosition(0);
- m_camera->StartEffect(CE_CRASH, pos, crash);
+ pos = m_object->GetPosition(0);
+ m_camera->StartEffect(Gfx::CAM_EFFECT_CRASH, pos, crash);
//? max = (int)(crash*50.0f);
- max = (int)(crash*10.0f*m_engine->RetParticuleDensity());
+ max = static_cast<int>(crash*10.0f*m_engine->GetParticleDensity());
for ( i=0 ; i<max ; i++ )
{
@@ -3130,13 +3119,13 @@ void CPhysics::CrashParticule(float crash)
speed.y = -2.0f;
dim.x = 2.0f+crash*5.0f*len;
dim.y = dim.x;
- m_particule->CreateParticule(ppos, speed, dim, PARTICRASH, 2.0f);
+ m_particle->CreateParticle(ppos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
}
// Generates some exhaust gas particle.
-void CPhysics::MotorParticule(float aTime, float rTime)
+void CPhysics::MotorParticle(float aTime, float rTime)
{
Math::Matrix* mat;
Math::Vector pos, speed;
@@ -3146,9 +3135,9 @@ void CPhysics::MotorParticule(float aTime, float rTime)
float h, a, delay, level;
int r, i, nb;
- if ( m_object->RetToy() ) return;
+ if ( m_object->GetToy() ) return;
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type == OBJECT_MOBILEia ||
type == OBJECT_MOBILEic ||
@@ -3166,14 +3155,14 @@ void CPhysics::MotorParticule(float aTime, float rTime)
else delay = 8.0f;
if ( m_bSwim && m_timeUnderWater < delay ) // bubbles when entering water?
{
- if ( aTime-m_lastUnderParticule >= m_engine->ParticuleAdapt(0.05f) )
+ if ( aTime-m_lastUnderParticle >= m_engine->ParticleAdapt(0.05f) )
{
- m_lastUnderParticule = aTime;
+ m_lastUnderParticle = aTime;
- nb = (int)(20.0f-(20.0f/delay)*m_timeUnderWater);
+ nb = static_cast<int>(20.0f-(20.0f/delay)*m_timeUnderWater);
for ( i=0 ; i<nb ; i++ )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*4.0f;
pos.y += (Math::Rand()-0.5f)*4.0f;
pos.z += (Math::Rand()-0.5f)*4.0f;
@@ -3182,13 +3171,13 @@ void CPhysics::MotorParticule(float aTime, float rTime)
speed.z = (Math::Rand()-0.5f)*0.2f;
dim.x = 0.06f+Math::Rand()*0.10f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIBUBBLE, 3.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBUBBLE, 3.0f, 0.0f, 0.0f);
}
}
}
- level = m_water->RetLevel();
- pos = m_object->RetPosition(0);
+ level = m_water->GetLevel();
+ pos = m_object->GetPosition(0);
if ( type == OBJECT_HUMAN ) pos.y -= 2.0f;
if ( pos.y < level ) // underwater?
{
@@ -3203,16 +3192,16 @@ void CPhysics::MotorParticule(float aTime, float rTime)
if ( pos.y >= level &&
m_absorbWater > 0.0f &&
- !m_water->RetLava() ) // drops on leaving the water?
+ !m_water->GetLava() ) // drops on leaving the water?
{
- if ( aTime-m_lastUnderParticule >= m_engine->ParticuleAdapt(0.05f) )
+ if ( aTime-m_lastUnderParticle >= m_engine->ParticleAdapt(0.05f) )
{
- m_lastUnderParticule = aTime;
+ m_lastUnderParticle = aTime;
- nb = (int)(8.0f*m_absorbWater);
+ nb = static_cast<int>(8.0f*m_absorbWater);
for ( i=0 ; i<nb ; i++ )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
if ( type == OBJECT_HUMAN ) pos.y -= Math::Rand()*2.0f;
else pos.y += Math::Rand()*2.0f;
pos.x += (Math::Rand()-0.5f)*2.0f;
@@ -3222,7 +3211,7 @@ void CPhysics::MotorParticule(float aTime, float rTime)
speed.z = 0.0f;
dim.x = 0.2f;
dim.y = 0.2f;
- m_particule->CreateParticule(pos, speed, dim, PARTIWATER, 2.0f, 0.0f, 1.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIWATER, 2.0f, 0.0f, 1.0f);
}
}
}
@@ -3231,18 +3220,18 @@ void CPhysics::MotorParticule(float aTime, float rTime)
type == OBJECT_TECH )
{
if ( m_bLand &&
- aTime-m_lastSlideParticule >= m_engine->ParticuleAdapt(0.05f) )
+ aTime-m_lastSlideParticle >= m_engine->ParticleAdapt(0.05f) )
{
h = Math::Max(fabs(m_linMotion.terrainSpeed.x),
fabs(m_linMotion.terrainSpeed.z));
if ( h > m_linMotion.terrainSlide.x+0.5f &&
m_linMotion.motorSpeed.x == 0.0f ) // slides a stop?
{
- m_lastSlideParticule = aTime;
+ m_lastSlideParticle = aTime;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos.x = (Math::Rand()-0.5f)*1.0f;
- pos.y = -m_object->RetCharacter()->height;
+ pos.y = -m_object->GetCharacter()->height;
pos.z = Math::Rand()*0.4f+1.0f;
if ( rand()%2 == 0 ) pos.z = -pos.z;
pos = Transform(*mat, pos);
@@ -3250,7 +3239,7 @@ void CPhysics::MotorParticule(float aTime, float rTime)
dim.x = Math::Rand()*(h-5.0f)/2.0f+1.0f;
if ( dim.x > 2.5f ) dim.x = 2.5f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f, 0.0f, 0.2f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f, 0.0f, 0.2f);
}
}
}
@@ -3260,14 +3249,14 @@ void CPhysics::MotorParticule(float aTime, float rTime)
type == OBJECT_MOBILEti ||
type == OBJECT_MOBILEts ) // caterpillars?
{
- if ( aTime-m_lastSlideParticule >= m_engine->ParticuleAdapt(0.05f) )
+ if ( aTime-m_lastSlideParticle >= m_engine->ParticleAdapt(0.05f) )
{
h = fabs(m_linMotion.motorSpeed.x-m_linMotion.realSpeed.x);
if ( h > 5.0f )
{
- m_lastSlideParticule = aTime;
+ m_lastSlideParticle = aTime;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos.x = (Math::Rand()-0.5f)*8.0f;
pos.y = 0.0f;
pos.z = Math::Rand()*2.0f+3.0f;
@@ -3277,7 +3266,7 @@ void CPhysics::MotorParticule(float aTime, float rTime)
dim.x = Math::Rand()*(h-5.0f)/2.0f+1.0f;
if ( dim.x > 3.0f ) dim.x = 3.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f, 0.0f, 0.2f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f, 0.0f, 0.2f);
}
}
}
@@ -3287,14 +3276,14 @@ void CPhysics::MotorParticule(float aTime, float rTime)
type == OBJECT_MOBILErr ||
type == OBJECT_MOBILErs ) // large caterpillars?
{
- if ( aTime-m_lastSlideParticule >= m_engine->ParticuleAdapt(0.05f) )
+ if ( aTime-m_lastSlideParticle >= m_engine->ParticleAdapt(0.05f) )
{
h = fabs(m_linMotion.motorSpeed.x-m_linMotion.realSpeed.x);
if ( h > 5.0f )
{
- m_lastSlideParticule = aTime;
+ m_lastSlideParticle = aTime;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos.x = (Math::Rand()-0.5f)*9.0f;
pos.y = 0.0f;
pos.z = Math::Rand()*3.0f+3.0f;
@@ -3304,7 +3293,7 @@ void CPhysics::MotorParticule(float aTime, float rTime)
dim.x = Math::Rand()*(h-5.0f)/2.0f+1.0f;
if ( dim.x > 3.0f ) dim.x = 3.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f, 0.0f, 0.2f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f, 0.0f, 0.2f);
}
}
}
@@ -3323,11 +3312,11 @@ void CPhysics::MotorParticule(float aTime, float rTime)
}
if ( m_reactorTemperature == 0.0f ||
- aTime-m_lastMotorParticule < m_engine->ParticuleAdapt(0.05f) ) return;
- m_lastMotorParticule = aTime;
+ aTime-m_lastMotorParticle < m_engine->ParticleAdapt(0.05f) ) return;
+ m_lastMotorParticle = aTime;
pos = Math::Vector(-1.6f, -0.5f, 0.0f);
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, pos);
speed.x = (Math::Rand()-0.5f)*0.6f;
@@ -3337,7 +3326,7 @@ void CPhysics::MotorParticule(float aTime, float rTime)
dim.x = (1.0f+Math::Rand()*0.5f)*(0.2f+m_reactorTemperature*0.8f);
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE2, 3.0f, 0.0f, 0.1f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE2, 3.0f, 0.0f, 0.1f);
}
else // in flight?
{
@@ -3352,14 +3341,14 @@ void CPhysics::MotorParticule(float aTime, float rTime)
}
}
- if ( aTime-m_lastMotorParticule < m_engine->ParticuleAdapt(0.02f) ) return;
- m_lastMotorParticule = aTime;
+ if ( aTime-m_lastMotorParticle < m_engine->ParticleAdapt(0.02f) ) return;
+ m_lastMotorParticle = aTime;
pos = Math::Vector(-1.6f, -1.0f, 0.0f);
pos.x += (Math::Rand()-0.5f)*3.0f;
pos.y += (Math::Rand()-0.5f)*1.5f;
pos.z += (Math::Rand()-0.5f)*3.0f;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, pos);
h = m_floorHeight;
@@ -3377,7 +3366,7 @@ void CPhysics::MotorParticule(float aTime, float rTime)
dim.x = 0.12f;
dim.y = 0.12f;
- m_particule->CreateParticule(pos, speed, dim, PARTISCRAPS, 2.0f, 10.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISCRAPS, 2.0f, 10.0f);
#if 1
pos = Math::Vector(-1.6f, -0.5f, 0.0f);
@@ -3396,7 +3385,7 @@ void CPhysics::MotorParticule(float aTime, float rTime)
{
speed.y += m_linMotion.realSpeed.y*1.2f;
}
- a = m_object->RetAngleY(0);
+ a = m_object->GetAngleY(0);
p.x = speed.x;
p.y = speed.z;
p = Math::RotatePoint(-a, p);
@@ -3406,7 +3395,7 @@ void CPhysics::MotorParticule(float aTime, float rTime)
dim.x = 0.4f+Math::Rand()*0.2f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIEJECT, 0.3f, 10.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIEJECT, 0.3f, 10.0f);
#endif
}
}
@@ -3431,8 +3420,8 @@ void CPhysics::MotorParticule(float aTime, float rTime)
if ( h < 3.0f ) return;
- if ( aTime-m_lastMotorParticule < m_engine->ParticuleAdapt(0.2f) ) return;
- m_lastMotorParticule = aTime;
+ if ( aTime-m_lastMotorParticle < m_engine->ParticleAdapt(0.2f) ) return;
+ m_lastMotorParticle = aTime;
r = rand()%3;
if ( r == 0 ) pos = Math::Vector(-3.0f, 0.0f, -4.0f);
@@ -3441,20 +3430,20 @@ void CPhysics::MotorParticule(float aTime, float rTime)
pos.x += (Math::Rand()-0.5f)*2.0f;
pos.z += (Math::Rand()-0.5f)*2.0f;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, pos);
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = Math::Rand()*h/5.0f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
else // glide with small reactors in skates?
{
if ( m_linMotion.realSpeed.x == 0.0f &&
m_cirMotion.realSpeed.y == 0.0f ) return;
- if ( aTime-m_lastMotorParticule < m_engine->ParticuleAdapt(0.02f) ) return;
- m_lastMotorParticule = aTime;
+ if ( aTime-m_lastMotorParticle < m_engine->ParticleAdapt(0.02f) ) return;
+ m_lastMotorParticle = aTime;
r = rand()%3;
if ( r == 0 ) pos = Math::Vector(-3.0f, 0.0f, -4.0f);
@@ -3463,26 +3452,26 @@ void CPhysics::MotorParticule(float aTime, float rTime)
pos.x += (Math::Rand()-0.5f)*1.0f;
pos.z += (Math::Rand()-0.5f)*1.0f;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, pos);
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIEJECT);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIEJECT);
}
}
else // in flight?
{
if ( !m_bMotor || m_reactorRange == 0.0f ) return;
- if ( aTime-m_lastMotorParticule < m_engine->ParticuleAdapt(0.02f) ) return;
- m_lastMotorParticule = aTime;
+ if ( aTime-m_lastMotorParticle < m_engine->ParticleAdapt(0.02f) ) return;
+ m_lastMotorParticle = aTime;
pos = Math::Vector(0.0f, -1.0f, 0.0f);
pos.x += (Math::Rand()-0.5f)*6.0f;
pos.y += (Math::Rand()-0.5f)*3.0f;
pos.z += (Math::Rand()-0.5f)*6.0f;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, pos);
h = m_floorHeight;
@@ -3500,7 +3489,7 @@ void CPhysics::MotorParticule(float aTime, float rTime)
dim.x = 0.2f;
dim.y = 0.2f;
- m_particule->CreateParticule(pos, speed, dim, PARTISCRAPS, 2.0f, 10.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISCRAPS, 2.0f, 10.0f);
#if 1
pos = Math::Vector(0.0f, 1.0f, 0.0f);
@@ -3519,7 +3508,7 @@ void CPhysics::MotorParticule(float aTime, float rTime)
{
speed.y += m_linMotion.realSpeed.y*1.2f;
}
- a = m_object->RetAngleY(0);
+ a = m_object->GetAngleY(0);
p.x = speed.x;
p.y = speed.z;
p = Math::RotatePoint(-a, p);
@@ -3529,23 +3518,23 @@ void CPhysics::MotorParticule(float aTime, float rTime)
dim.x = 0.7f+Math::Rand()*0.6f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIEJECT, 0.5f, 10.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIEJECT, 0.5f, 10.0f);
#endif
}
}
if ( (type == OBJECT_HUMAN || type == OBJECT_TECH) && m_bSwim )
{
- if ( !m_object->RetDead() )
+ if ( !m_object->GetDead() )
{
h = Math::Mod(aTime, 5.0f);
if ( h < 3.5f && ( h < 1.5f || h > 1.6f ) ) return;
}
- if ( aTime-m_lastMotorParticule < m_engine->ParticuleAdapt(0.06f) ) return;
- m_lastMotorParticule = aTime;
+ if ( aTime-m_lastMotorParticle < m_engine->ParticleAdapt(0.06f) ) return;
+ m_lastMotorParticle = aTime;
pos = Math::Vector(0.0f, 3.0f, 0.0f);
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, pos);
pos.x += (Math::Rand()-0.5f)*1.0f;
pos.z += (Math::Rand()-0.5f)*1.0f;
@@ -3554,12 +3543,12 @@ void CPhysics::MotorParticule(float aTime, float rTime)
speed.z = (Math::Rand()-0.5f)*0.2f;
dim.x = 0.2f;
dim.y = 0.2f;
- m_particule->CreateParticule(pos, speed, dim, PARTIBUBBLE, 3.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBUBBLE, 3.0f, 0.0f, 0.0f);
if ( aTime-m_lastSoundWater > 1.5f )
{
m_lastSoundWater = aTime;
- m_sound->Play(SOUND_BLUP, m_object->RetPosition(0), 0.5f+Math::Rand()*0.5f);
+ m_sound->Play(SOUND_BLUP, m_object->GetPosition(0), 0.5f+Math::Rand()*0.5f);
}
}
@@ -3567,11 +3556,11 @@ void CPhysics::MotorParticule(float aTime, float rTime)
{
h = Math::Mod(aTime, 3.0f);
if ( h < 1.5f && ( h < 0.5f || h > 0.9f ) ) return;
- if ( aTime-m_lastMotorParticule < m_engine->ParticuleAdapt(0.06f) ) return;
- m_lastMotorParticule = aTime;
+ if ( aTime-m_lastMotorParticle < m_engine->ParticleAdapt(0.06f) ) return;
+ m_lastMotorParticle = aTime;
pos = Math::Vector(0.0f, 3.0f, 0.0f);
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, pos);
pos.x += (Math::Rand()-0.5f)*1.0f;
pos.z += (Math::Rand()-0.5f)*1.0f;
@@ -3580,12 +3569,12 @@ void CPhysics::MotorParticule(float aTime, float rTime)
speed.z = (Math::Rand()-0.5f)*0.2f;
dim.x = 0.2f;
dim.y = 0.2f;
- m_particule->CreateParticule(pos, speed, dim, PARTIBUBBLE, 3.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBUBBLE, 3.0f, 0.0f, 0.0f);
if ( aTime-m_lastSoundWater > 1.5f )
{
m_lastSoundWater = aTime;
- m_sound->Play(SOUND_BLUP, m_object->RetPosition(0), 0.5f+Math::Rand()*0.5f);
+ m_sound->Play(SOUND_BLUP, m_object->GetPosition(0), 0.5f+Math::Rand()*0.5f);
}
}
@@ -3600,13 +3589,13 @@ void CPhysics::MotorParticule(float aTime, float rTime)
{
if ( !m_bMotor ) return;
- if ( aTime-m_lastMotorParticule < m_engine->ParticuleAdapt(0.1f) ) return;
- m_lastMotorParticule = aTime;
+ if ( aTime-m_lastMotorParticle < m_engine->ParticleAdapt(0.1f) ) return;
+ m_lastMotorParticle = aTime;
pos = Math::Vector(-2.5f, 10.3f, -1.3f);
pos.x += (Math::Rand()-0.5f)*1.0f;
pos.z += (Math::Rand()-0.5f)*1.0f;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, pos);
speed.x = (Math::Rand()-0.5f)*2.0f;
@@ -3616,14 +3605,14 @@ void CPhysics::MotorParticule(float aTime, float rTime)
dim.x = Math::Rand()*0.6f+0.4f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIMOTOR, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIMOTOR, 2.0f);
}
else
{
if ( !m_bMotor ) return;
- if ( aTime-m_lastMotorParticule < m_engine->ParticuleAdapt(0.05f) ) return;
- m_lastMotorParticule = aTime;
+ if ( aTime-m_lastMotorParticle < m_engine->ParticleAdapt(0.05f) ) return;
+ m_lastMotorParticle = aTime;
pos = Math::Vector(-3.4f, 1.8f, 0.5f);
@@ -3643,21 +3632,21 @@ void CPhysics::MotorParticule(float aTime, float rTime)
speed.y -= 0.5f+Math::Rand()*2.0f;
speed.z += (Math::Rand()-0.5f)*3.0f;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, pos);
speed = Transform(*mat, speed)-pos;
dim.x = Math::Rand()*0.4f+0.3f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIMOTOR, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIMOTOR, 2.0f);
}
}
}
// Generates some particles after falling into the water.
-void CPhysics::WaterParticule(float aTime, Math::Vector pos, ObjectType type,
+void CPhysics::WaterParticle(float aTime, Math::Vector pos, ObjectType type,
float floor, float advance, float turn)
{
Math::Vector ppos, speed;
@@ -3665,7 +3654,7 @@ void CPhysics::WaterParticule(float aTime, Math::Vector pos, ObjectType type,
float delay, level, min, max, force, volume, diam;
int i, nb;
- level = m_water->RetLevel();
+ level = m_water->GetLevel();
if ( floor >= level ) return;
if ( type == OBJECT_HUMAN ||
@@ -3684,9 +3673,9 @@ void CPhysics::WaterParticule(float aTime, Math::Vector pos, ObjectType type,
// Management of the particle "splash".
if ( m_linMotion.realSpeed.y < -10.0f &&
- aTime-m_lastPloufParticule >= 1.0f )
+ aTime-m_lastPloufParticle >= 1.0f )
{
- m_lastPloufParticule = aTime;
+ m_lastPloufParticle = aTime;
force = -m_linMotion.realSpeed.y/20.0f; // power according to speed drops
if ( type == OBJECT_HUMAN ||
@@ -3700,14 +3689,14 @@ void CPhysics::WaterParticule(float aTime, Math::Vector pos, ObjectType type,
force *= 1.3f; // a robot is heavier
}
- pos = m_object->RetPosition(0);
- pos.y = m_water->RetLevel()-1.0f;
+ pos = m_object->GetPosition(0);
+ pos.y = m_water->GetLevel()-1.0f;
dim.x = 2.0f*force; // height
dim.y = diam; // diameter
- m_particule->CreateParticule(pos, Math::Vector(0.0f, 0.0f, 0.0f), dim, PARTIPLOUF0, 1.4f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), dim, Gfx::PARTIPLOUF0, 1.4f, 0.0f, 0.0f);
force = (0.5f+force*0.5f);
- nb = (int)(force*50.0f*m_engine->RetParticuleDensity());
+ nb = static_cast<int>(force*50.0f*m_engine->GetParticleDensity());
for ( i=0 ; i<nb ; i++ )
{
ppos = pos;
@@ -3719,7 +3708,7 @@ void CPhysics::WaterParticule(float aTime, Math::Vector pos, ObjectType type,
speed.y = 6.0f+Math::Rand()*6.0f*force;
dim.x = 0.5f;
dim.y = dim.x;
- m_particule->CreateParticule(ppos, speed, dim, PARTIDROP, 2.0f, 20.0f, 0.2f);
+ m_particle->CreateParticle(ppos, speed, dim, Gfx::PARTIDROP, 2.0f, 20.0f, 0.2f);
}
volume = fabs(m_linMotion.realSpeed.y*0.02f);
@@ -3728,7 +3717,7 @@ void CPhysics::WaterParticule(float aTime, Math::Vector pos, ObjectType type,
}
// Management particles "cop".
- if ( m_water->RetLava() ) return;
+ if ( m_water->GetLava() ) return;
if ( advance == 0.0f && turn == 0.0f )
{
@@ -3743,15 +3732,15 @@ void CPhysics::WaterParticule(float aTime, Math::Vector pos, ObjectType type,
{
delay = 0.06f;
}
- m_engine->ParticuleAdapt(delay);
+ m_engine->ParticleAdapt(delay);
- if ( aTime-m_lastWaterParticule < delay ) return;
- m_lastWaterParticule = aTime;
+ if ( aTime-m_lastWaterParticle < delay ) return;
+ m_lastWaterParticle = aTime;
force = (advance+turn)*0.16f;
if ( force < 0.001f ) return;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y = level+0.1f;
if ( advance == 0 )
{
@@ -3768,29 +3757,27 @@ void CPhysics::WaterParticule(float aTime, Math::Vector pos, ObjectType type,
speed.z = 0.0f;
dim.x = Math::Min(Math::Rand()*force+force+1.0f, 10.0f);
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIFLIC, 3.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFLIC, 3.0f, 0.0f, 0.0f);
}
// Creates the trace under the robot.
-void CPhysics::WheelParticule(int color, float width)
+void CPhysics::WheelParticle(int color, float width)
{
- Character* character;
Math::Matrix* mat;
Math::Vector goal1, goal2, wheel1, wheel2;
- ParticuleType parti;
- float dist1, dist2, step;
+ Gfx::ParticleType parti;
+ float dist1, dist2, step;
- character = m_object->RetCharacter();
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
// Draw a trace on the ground.
if ( color >= 0 && color <= 17 )
{
- parti = (ParticuleType)(PARTITRACE0+color);
+ parti = static_cast<Gfx::ParticleType>(Gfx::PARTITRACE0+color);
step = 2.0f;
if ( color >= 16 ) step = 4.0f; // arrow?
- step /= m_engine->RetTracePrecision();
+ step /= m_engine->GetTracePrecision();
goal1.x = step/2.0f;
goal1.y = 0.0f;
@@ -3802,36 +3789,36 @@ void CPhysics::WheelParticule(int color, float width)
goal2.z = width/2.0f;
goal2 = Transform(*mat, goal2);
- if ( !m_bWheelParticuleBrake )
+ if ( !m_bWheelParticleBrake )
{
- m_wheelParticulePos[0] = goal1;
- m_wheelParticulePos[1] = goal2;
+ m_wheelParticlePos[0] = goal1;
+ m_wheelParticlePos[1] = goal2;
}
while ( true )
{
- dist1 = Math::Distance(m_wheelParticulePos[0], goal1);
+ dist1 = Math::Distance(m_wheelParticlePos[0], goal1);
if ( dist1 < step ) break;
- dist2 = Math::Distance(m_wheelParticulePos[1], goal2);
- wheel1 = Math::SegmentPoint(m_wheelParticulePos[0], goal1, step);
- wheel2 = Math::SegmentPoint(m_wheelParticulePos[1], goal2, step*dist2/dist1);
+ dist2 = Math::Distance(m_wheelParticlePos[1], goal2);
+ wheel1 = Math::SegmentPoint(m_wheelParticlePos[0], goal1, step);
+ wheel2 = Math::SegmentPoint(m_wheelParticlePos[1], goal2, step*dist2/dist1);
if ( m_linMotion.realSpeed.x >= 0.0f )
{
- m_particule->CreateWheelTrace(m_wheelParticulePos[0], m_wheelParticulePos[1], wheel1, wheel2, parti);
+ m_particle->CreateWheelTrace(m_wheelParticlePos[0], m_wheelParticlePos[1], wheel1, wheel2, parti);
}
else
{
- m_particule->CreateWheelTrace(m_wheelParticulePos[1], m_wheelParticulePos[0], wheel2, wheel1, parti);
+ m_particle->CreateWheelTrace(m_wheelParticlePos[1], m_wheelParticlePos[0], wheel2, wheel1, parti);
}
- m_wheelParticulePos[0] = wheel1;
- m_wheelParticulePos[1] = wheel2;
+ m_wheelParticlePos[0] = wheel1;
+ m_wheelParticlePos[1] = wheel2;
}
- m_bWheelParticuleBrake = true;
+ m_bWheelParticleBrake = true;
}
else
{
- m_bWheelParticuleBrake = false;
+ m_bWheelParticleBrake = false;
}
}
@@ -3849,12 +3836,12 @@ void CPhysics::CreateInterface(bool bSelect)
// Returns an error related to the general state.
-Error CPhysics::RetError()
+Error CPhysics::GetError()
{
ObjectType type;
CObject* power;
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type == OBJECT_HUMAN ||
type == OBJECT_TECH ||
type == OBJECT_MOTHER ||
@@ -3865,19 +3852,19 @@ Error CPhysics::RetError()
type == OBJECT_APOLLO2 ||
type == OBJECT_MOBILEdr ) return ERR_OK;
- if ( m_brain != 0 && m_brain->RetActiveVirus() )
+ if ( m_brain != 0 && m_brain->GetActiveVirus() )
{
return ERR_VEH_VIRUS;
}
- power = m_object->RetPower(); // searches for the object battery used
+ power = m_object->GetPower(); // searches for the object battery used
if ( power == 0 )
{
return ERR_VEH_POWER;
}
else
{
- if ( power->RetEnergy() == 0.0f ) return ERR_VEH_ENERGY;
+ if ( power->GetEnergy() == 0.0f ) return ERR_VEH_ENERGY;
}
return ERR_OK;
diff --git a/src/physics/physics.h b/src/physics/physics.h
index 2e1f5eb..79d28e4 100644
--- a/src/physics/physics.h
+++ b/src/physics/physics.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -14,10 +15,14 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
-// physics.h
-
#pragma once
+/**
+ * \file physics/physics.h
+ * \brief Responsible for physics "and more" in game
+ */
+
+
#include "common/misc.h"
#include "object/object.h"
@@ -25,17 +30,17 @@
class CInstanceManager;
-class CCamera;
class CObject;
class CBrain;
class CMotion;
-class CSound;
+class CSoundInterface;
namespace Gfx
{
+class CCamera;
class CEngine;
class CLight;
-class CParticule;
+class CParticle;
class CTerrain;
class CWater;
};
@@ -170,7 +175,7 @@ protected:
void SoundMotorStop(float rTime, ObjectType type);
void SoundReactorFull(float rTime, ObjectType type);
void SoundReactorStop(float rTime, ObjectType type);
- void FrameParticule(float aTime, float rTime);
+ void FrameParticle(float aTime, float rTime);
void MotorUpdate(float aTime, float rTime);
void EffectUpdate(float aTime, float rTime);
void UpdateMotionStruct(float rTime, Motion &motion);
@@ -182,24 +187,24 @@ protected:
bool ExploOther(ObjectType iType, CObject *pObj, ObjectType oType, float force);
int ExploHimself(ObjectType iType, ObjectType oType, float force);
- void PowerParticule(float factor, bool bBreak);
- void CrashParticule(float crash);
- void MotorParticule(float aTime, float rTime);
- void WaterParticule(float aTime, Math::Vector pos, ObjectType type, float floor, float advance, float turn);
- void WheelParticule(int color, float width);
+ void PowerParticle(float factor, bool bBreak);
+ void CrashParticle(float crash);
+ void MotorParticle(float aTime, float rTime);
+ void WaterParticle(float aTime, Math::Vector pos, ObjectType type, float floor, float advance, float turn);
+ void WheelParticle(int color, float width);
protected:
- CInstanceManager* m_iMan;
+ CInstanceManager* m_iMan;
Gfx::CEngine* m_engine;
Gfx::CLightManager* m_lightMan;
Gfx::CParticle* m_particle;
Gfx::CTerrain* m_terrain;
Gfx::CWater* m_water;
Gfx::CCamera* m_camera;
- CObject* m_object;
- CBrain* m_brain;
- CMotion* m_motion;
- CSound* m_sound;
+ CObject* m_object;
+ CBrain* m_brain;
+ CMotion* m_motion;
+ CSoundInterface* m_sound;
PhysicsType m_type; // TYPE_*
float m_gravity; // force of gravity
@@ -217,15 +222,15 @@ protected:
float m_linVibrationFactor;
float m_cirVibrationFactor;
float m_inclinaisonFactor;
- float m_lastPowerParticule;
- float m_lastSlideParticule;
- float m_lastMotorParticule;
- float m_lastWaterParticule;
- float m_lastUnderParticule;
- float m_lastPloufParticule;
- float m_lastFlameParticule;
- bool m_bWheelParticuleBrake;
- Math::Vector m_wheelParticulePos[2];
+ float m_lastPowerParticle;
+ float m_lastSlideParticle;
+ float m_lastMotorParticle;
+ float m_lastWaterParticle;
+ float m_lastUnderParticle;
+ float m_lastPloufParticle;
+ float m_lastFlameParticle;
+ bool m_bWheelParticleBrake;
+ Math::Vector m_wheelParticlePos[2];
float m_absorbWater;
float m_reactorTemperature;
float m_reactorRange;
@@ -234,7 +239,7 @@ protected:
float m_lastEnergy;
float m_lastSoundWater;
float m_lastSoundInsect;
- float m_restBreakParticule;
+ float m_restBreakParticle;
float m_floorLevel; // ground level
float m_floorHeight; // height above the ground
int m_soundChannel;
diff --git a/src/script/cbottoken.cpp b/src/script/cbottoken.cpp
index 223da4d..b0bf67b 100644
--- a/src/script/cbottoken.cpp
+++ b/src/script/cbottoken.cpp
@@ -15,25 +15,25 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
-#include "common/language.h"
-#include "common/global.h"
-#include "common/event.h"
+// #include <windows.h>
+// #include <stdio.h>
+// #include <d3d.h>
+//
+// #include "common/struct.h"
+// #include "old/d3dengine.h"
+// #include "old/d3dmath.h"
+// #include "common/language.h"
+// #include "common/global.h"
+// #include "common/event.h"
#include "object/object.h"
-#include "script/cbottoken.h"
+// #include "script/cbottoken.h"
// Seeking the name of an object.
-char* RetObjectName(ObjectType type)
+const char* GetObjectName(ObjectType type)
{
if ( type == OBJECT_PORTICO ) return "Portico";
if ( type == OBJECT_BASE ) return "SpaceShip";
@@ -126,7 +126,7 @@ char* RetObjectName(ObjectType type)
// Seeking the name of a secondary object.
// (because Otto thinks that Germans do not like nuclear power)
-char* RetObjectAlias(ObjectType type)
+const char* GetObjectAlias(ObjectType type)
{
if ( type == OBJECT_NUCLEAR ) return "FuelCellPlant";
if ( type == OBJECT_URANIUM ) return "PlatinumOre";
@@ -139,7 +139,7 @@ char* RetObjectAlias(ObjectType type)
// Returns the help file to use for the object.
-char* RetHelpFilename(ObjectType type)
+const char* GetHelpFilename(ObjectType type)
{
if ( type == OBJECT_BASE ) return "help\\object\\base.txt";
if ( type == OBJECT_DERRICK ) return "help\\object\\derrick.txt";
@@ -224,7 +224,7 @@ char* RetHelpFilename(ObjectType type)
// Returns the help file to use for instruction.
-char* RetHelpFilename(const char *token)
+const char* GetHelpFilename(const char *token)
{
if ( strcmp(token, "if" ) == 0 ) return "help\\cbot\\if.txt";
if ( strcmp(token, "else" ) == 0 ) return "help\\cbot\\if.txt";
@@ -436,7 +436,7 @@ bool IsFunction(const char *token)
// Returns using a compact instruction.
-char* RetHelpText(const char *token)
+const char* GetHelpText(const char *token)
{
if ( strcmp(token, "if" ) == 0 ) return "if ( condition ) { bloc }";
if ( strcmp(token, "else" ) == 0 ) return "else { bloc }";
diff --git a/src/script/cbottoken.h b/src/script/cbottoken.h
index c1a6a65..a4d69ea 100644
--- a/src/script/cbottoken.h
+++ b/src/script/cbottoken.h
@@ -25,12 +25,12 @@
// Procedures.
-extern char* RetObjectName(ObjectType type);
-extern char* RetObjectAlias(ObjectType type);
-extern char* RetHelpFilename(ObjectType type);
-extern char* RetHelpFilename(const char *token);
+extern const char* GetObjectName(ObjectType type);
+extern const char* GetObjectAlias(ObjectType type);
+extern const char* GetHelpFilename(ObjectType type);
+extern const char* GetHelpFilename(const char *token);
extern bool IsType(const char *token);
extern bool IsFunction(const char *token);
-extern char* RetHelpText(const char *token);
+extern char* GetHelpText(const char *token);
diff --git a/src/script/cmdtoken.cpp b/src/script/cmdtoken.cpp
index 256b580..0b441a4 100644
--- a/src/script/cmdtoken.cpp
+++ b/src/script/cmdtoken.cpp
@@ -15,20 +15,7 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
-#include "common/language.h"
#include "common/global.h"
-#include "common/event.h"
-#include "old/water.h"
-#include "old/pyro.h"
-#include "old/camera.h"
-#include "object/object.h"
#include "script/cmdtoken.h"
@@ -48,7 +35,7 @@ char* SkipSpace(char *line)
// Checks if a line contains a command.
-bool Cmd(char *line, char *token)
+bool Cmd(char *line, const char *token)
{
char* p;
@@ -59,7 +46,7 @@ bool Cmd(char *line, char *token)
// Seeking an operator.
-char* SearchOp(char *line, char *op)
+char* SearchOp(char *line, const char *op)
{
char opeq[50];
char* p;
@@ -418,7 +405,7 @@ ObjectType GetTypeObject(char *line, int rank, ObjectType def)
// Returns the name of an object type.
-char* GetTypeObject(ObjectType type)
+const char* GetTypeObject(ObjectType type)
{
if ( type == OBJECT_PORTICO ) return "Portico";
if ( type == OBJECT_BASE ) return "SpaceShip";
@@ -663,35 +650,35 @@ char* GetTypeObject(ObjectType type)
// Returns the type of water.
-WaterType GetTypeWater(char *line, int rank, WaterType def)
+Gfx::WaterType GetTypeWater(char *line, int rank, Gfx::WaterType def)
{
char* p;
p = SearchArg(line, rank);
if ( *p == 0 ) return def;
- if ( Cmd(p, "NULL" ) ) return WATER_NULL;
- if ( Cmd(p, "TT" ) ) return WATER_TT;
- if ( Cmd(p, "TO" ) ) return WATER_TO;
- if ( Cmd(p, "CT" ) ) return WATER_CT;
- if ( Cmd(p, "CO" ) ) return WATER_CO;
+ if ( Cmd(p, "NULL" ) ) return Gfx::WATER_NULL;
+ if ( Cmd(p, "TT" ) ) return Gfx::WATER_TT;
+ if ( Cmd(p, "TO" ) ) return Gfx::WATER_TO;
+ if ( Cmd(p, "CT" ) ) return Gfx::WATER_CT;
+ if ( Cmd(p, "CO" ) ) return Gfx::WATER_CO;
return def;
}
// Returns the type of terrain.
-D3DTypeObj GetTypeTerrain(char *line, int rank, D3DTypeObj def)
+Gfx::EngineObjectType GetTypeTerrain(char *line, int rank, Gfx::EngineObjectType def)
{
char* p;
p = SearchArg(line, rank);
if ( *p == 0 ) return def;
- if ( Cmd(p, "Terrain" ) ) return TYPETERRAIN;
- if ( Cmd(p, "Object" ) ) return TYPEFIX;
- if ( Cmd(p, "Quartz" ) ) return TYPEQUARTZ;
- if ( Cmd(p, "Metal" ) ) return TYPEMETAL;
+ if ( Cmd(p, "Terrain" ) ) return Gfx::ENG_OBJTYPE_TERRAIN;
+ if ( Cmd(p, "Object" ) ) return Gfx::ENG_OBJTYPE_FIX;
+ if ( Cmd(p, "Quartz" ) ) return Gfx::ENG_OBJTYPE_QUARTZ;
+ if ( Cmd(p, "Metal" ) ) return Gfx::ENG_OBJTYPE_METAL;
return def;
}
@@ -753,64 +740,64 @@ int GetResearch(char *line, int rank)
// Returns the type of pyrotechnic effect.
-PyroType GetPyro(char *line, int rank)
+Gfx::PyroType GetPyro(char *line, int rank)
{
char* p;
p = SearchArg(line, rank);
- if ( *p == 0 ) return PT_NULL;
-
- if ( Cmd(p, "FRAGt" ) ) return PT_FRAGT;
- if ( Cmd(p, "FRAGo" ) ) return PT_FRAGO;
- if ( Cmd(p, "FRAGw" ) ) return PT_FRAGW;
- if ( Cmd(p, "EXPLOt" ) ) return PT_EXPLOT;
- if ( Cmd(p, "EXPLOo" ) ) return PT_EXPLOO;
- if ( Cmd(p, "EXPLOw" ) ) return PT_EXPLOW;
- if ( Cmd(p, "SHOTt" ) ) return PT_SHOTT;
- if ( Cmd(p, "SHOTh" ) ) return PT_SHOTH;
- if ( Cmd(p, "SHOTm" ) ) return PT_SHOTM;
- if ( Cmd(p, "SHOTw" ) ) return PT_SHOTW;
- if ( Cmd(p, "EGG" ) ) return PT_EGG;
- if ( Cmd(p, "BURNt" ) ) return PT_BURNT;
- if ( Cmd(p, "BURNo" ) ) return PT_BURNO;
- if ( Cmd(p, "SPIDER" ) ) return PT_SPIDER;
- if ( Cmd(p, "FALL" ) ) return PT_FALL;
- if ( Cmd(p, "RESET" ) ) return PT_RESET;
- if ( Cmd(p, "WIN" ) ) return PT_WIN;
- if ( Cmd(p, "LOST" ) ) return PT_LOST;
-
- return PT_NULL;
+ if ( *p == 0 ) return Gfx::PT_NULL;
+
+ if ( Cmd(p, "FRAGt" ) ) return Gfx::PT_FRAGT;
+ if ( Cmd(p, "FRAGo" ) ) return Gfx::PT_FRAGO;
+ if ( Cmd(p, "FRAGw" ) ) return Gfx::PT_FRAGW;
+ if ( Cmd(p, "EXPLOt" ) ) return Gfx::PT_EXPLOT;
+ if ( Cmd(p, "EXPLOo" ) ) return Gfx::PT_EXPLOO;
+ if ( Cmd(p, "EXPLOw" ) ) return Gfx::PT_EXPLOW;
+ if ( Cmd(p, "SHOTt" ) ) return Gfx::PT_SHOTT;
+ if ( Cmd(p, "SHOTh" ) ) return Gfx::PT_SHOTH;
+ if ( Cmd(p, "SHOTm" ) ) return Gfx::PT_SHOTM;
+ if ( Cmd(p, "SHOTw" ) ) return Gfx::PT_SHOTW;
+ if ( Cmd(p, "EGG" ) ) return Gfx::PT_EGG;
+ if ( Cmd(p, "BURNt" ) ) return Gfx::PT_BURNT;
+ if ( Cmd(p, "BURNo" ) ) return Gfx::PT_BURNO;
+ if ( Cmd(p, "SPIDER" ) ) return Gfx::PT_SPIDER;
+ if ( Cmd(p, "FALL" ) ) return Gfx::PT_FALL;
+ if ( Cmd(p, "RESET" ) ) return Gfx::PT_RESET;
+ if ( Cmd(p, "WIN" ) ) return Gfx::PT_WIN;
+ if ( Cmd(p, "LOST" ) ) return Gfx::PT_LOST;
+
+ return Gfx::PT_NULL;
}
// Returns the type of camera.
-CameraType GetCamera(char *line, int rank)
+Gfx::CameraType GetCamera(char *line, int rank)
{
char* p;
p = SearchArg(line, rank);
- if ( *p == 0 ) return CAMERA_NULL;
+ if ( *p == 0 ) return Gfx::CAM_TYPE_NULL;
- if ( Cmd(p, "BACK" ) ) return CAMERA_BACK;
- if ( Cmd(p, "PLANE" ) ) return CAMERA_PLANE;
- if ( Cmd(p, "ONBOARD" ) ) return CAMERA_ONBOARD;
- if ( Cmd(p, "FIX" ) ) return CAMERA_FIX;
+ if ( Cmd(p, "BACK" ) ) return Gfx::CAM_TYPE_BACK;
+ if ( Cmd(p, "PLANE" ) ) return Gfx::CAM_TYPE_PLANE;
+ if ( Cmd(p, "ONBOARD" ) ) return Gfx::CAM_TYPE_ONBOARD;
+ if ( Cmd(p, "FIX" ) ) return Gfx::CAM_TYPE_FIX;
- return CAMERA_NULL;
+ return Gfx::CAM_TYPE_NULL;
}
// Returns the name of a camera.
-char* GetCamera(CameraType type)
+const char* GetCamera(Gfx::CameraType type)
{
- if ( type == CAMERA_ONBOARD ) return "ONBOARD";
- if ( type == CAMERA_FIX ) return "FIX";
+ if ( type == Gfx::CAM_TYPE_ONBOARD ) return "ONBOARD";
+ if ( type == Gfx::CAM_TYPE_FIX ) return "FIX";
return "BACK";
}
// Returns an integer.
-int OpInt(char *line, char *op, int def)
+int OpInt(char *line, const char *op, int def)
{
line = SearchOp(line, op);
if ( *line == 0 ) return def;
@@ -819,7 +806,7 @@ int OpInt(char *line, char *op, int def)
// Returns a float number.
-float OpFloat(char *line, char *op, float def)
+float OpFloat(char *line, const char *op, float def)
{
line = SearchOp(line, op);
if ( *line == 0 ) return def;
@@ -852,7 +839,7 @@ ObjectType OpTypeObject(char *line, char *op, ObjectType def)
// Returns the type of a water.
-WaterType OpTypeWater(char *line, char *op, WaterType def)
+Gfx::WaterType OpTypeWater(char *line, char *op, Gfx::WaterType def)
{
line = SearchOp(line, op);
if ( *line == 0 ) return def;
@@ -861,7 +848,7 @@ WaterType OpTypeWater(char *line, char *op, WaterType def)
// Returns the type of a terrain.
-D3DTypeObj OpTypeTerrain(char *line, char *op, D3DTypeObj def)
+Gfx::EngineObjectType OpTypeTerrain(char *line, char *op, Gfx::EngineObjectType def)
{
line = SearchOp(line, op);
if ( *line == 0 ) return def;
@@ -879,19 +866,19 @@ int OpResearch(char *line, char *op)
// Returns the type of pyrotechnic effect.
-PyroType OpPyro(char *line, char *op)
+Gfx::PyroType OpPyro(char *line, char *op)
{
line = SearchOp(line, op);
- if ( *line == 0 ) return PT_NULL;
+ if ( *line == 0 ) return Gfx::PT_NULL;
return GetPyro(line, 0);
}
// Returns the type of camera.
-CameraType OpCamera(char *line, char *op)
+Gfx::CameraType OpCamera(char *line, const char *op)
{
line = SearchOp(line, op);
- if ( *line == 0 ) return CAMERA_NULL;
+ if ( *line == 0 ) return Gfx::CAM_TYPE_NULL;
return GetCamera(line, 0);
}
@@ -924,7 +911,7 @@ Math::Vector OpPos(char *line, char *op)
// Returns a direction.
-Math::Vector OpDir(char *line, char *op)
+Math::Vector OpDir(char *line, const char *op)
{
Math::Vector dir;
@@ -940,28 +927,10 @@ Math::Vector OpDir(char *line, char *op)
return dir;
}
-// Reads a color (0 .. 255).
-
-D3DCOLOR OpColor(char *line, char *op, D3DCOLOR def)
-{
- D3DCOLOR color;
-
- line = SearchOp(line, op);
- if ( *line == 0 ) return def;
-
- color = 0;
- color |= (GetInt(line, 0, 0)&0xff)<<16; // r
- color |= (GetInt(line, 1, 0)&0xff)<<8; // g
- color |= (GetInt(line, 2, 0)&0xff)<<0; // b
- color |= (GetInt(line, 3, 0)&0xff)<<24; // a
- return color;
-}
-
// Reads a color (-1 .. 1).
-
-D3DCOLORVALUE OpColorValue(char *line, char *op, D3DCOLORVALUE def)
+Gfx::Color OpColor(char *line, char *op, Gfx::Color def)
{
- D3DCOLORVALUE color;
+ Gfx::Color color;
line = SearchOp(line, op);
if ( *line == 0 ) return def;
diff --git a/src/script/cmdtoken.h b/src/script/cmdtoken.h
index 05ff758..911bd55 100644
--- a/src/script/cmdtoken.h
+++ b/src/script/cmdtoken.h
@@ -19,46 +19,44 @@
#pragma once
-#include "old/d3denum.h"
-#include "old/d3dengine.h"
-#include "object/object.h"
-#include "old/water.h"
-#include "old/pyro.h"
-#include "old/camera.h"
+// #include "old/d3denum.h"
+// #include "old/d3dengine.h"
+// #include "object/object.h"
+#include "graphics/engine/water.h"
+#include "graphics/engine/engine.h"
+#include "graphics/engine/pyro.h"
// Procedures.
-extern bool Cmd(char *line, char *token);
-extern char* SearchOp(char *line, char *op);
+extern bool Cmd(char *line, const char *token);
+extern char* SearchOp(char *line, const char *op);
extern int GetInt(char *line, int rank, int def);
extern float GetFloat(char *line, int rank, float def);
extern void GetString(char *line, int rank, char *buffer);
extern ObjectType GetTypeObject(char *line, int rank, ObjectType def);
-extern char* GetTypeObject(ObjectType type);
-extern WaterType GetTypeWater(char *line, int rank, WaterType def);
-extern D3DTypeObj GetTypeTerrain(char *line, int rank, D3DTypeObj def);
+extern const char* GetTypeObject(ObjectType type);
+extern Gfx::WaterType GetTypeWater(char *line, int rank, Gfx::WaterType def);
+extern Gfx::EngineObjectType GetTypeTerrain(char *line, int rank, Gfx::EngineObjectType def);
extern int GetBuild(char *line, int rank);
extern int GetResearch(char *line, int rank);
-extern PyroType GetPyro(char *line, int rank);
-extern CameraType GetCamera(char *line, int rank);
-extern char* GetCamera(CameraType type);
+extern Gfx::PyroType GetPyro(char *line, int rank);
+extern Gfx::CameraType GetCamera(char *line, int rank);
+extern const char* GetCamera(Gfx::CameraType type);
-extern int OpInt(char *line, char *op, int def);
-extern float OpFloat(char *line, char *op, float def);
+extern int OpInt(char *line, const char *op, int def);
+extern float OpFloat(char *line, const char *op, float def);
extern void OpString(char *line, char *op, char *buffer);
extern ObjectType OpTypeObject(char *line, char *op, ObjectType def);
-extern WaterType OpTypeWater(char *line, char *op, WaterType def);
-extern D3DTypeObj OpTypeTerrain(char *line, char *op, D3DTypeObj def);
+extern Gfx::WaterType OpTypeWater(char *line, char *op, Gfx::WaterType def);
+extern Gfx::EngineObjectType OpTypeTerrain(char *line, char *op, Gfx::EngineObjectType def);
extern int OpResearch(char *line, char *op);
-extern PyroType OpPyro(char *line, char *op);
-extern CameraType OpCamera(char *line, char *op);
+extern Gfx::PyroType OpPyro(char *line, char *op);
+extern Gfx::CameraType OpCamera(char *line, const char *op);
extern int OpBuild(char *line, char *op);
extern Math::Vector OpPos(char *line, char *op);
-extern Math::Vector OpDir(char *line, char *op);
-extern D3DCOLOR OpColor(char *line, char *op, D3DCOLOR def);
-extern D3DCOLORVALUE OpColorValue(char *line, char *op, D3DCOLORVALUE def);
-
+extern Math::Vector OpDir(char *line, const char *op);
+extern Gfx::Color OpColor(char *line, char *op, Gfx::Color def);
diff --git a/src/script/script.cpp b/src/script/script.cpp
index d9d6444..cbdbbf4 100644
--- a/src/script/script.cpp
+++ b/src/script/script.cpp
@@ -17,38 +17,38 @@
// script.cpp
-#include <windows.h>
+#include "script/script.h"
+// #include <windows.h>
#include <stdio.h>
-#include <d3d.h>
-
-#include "CBot/CBotDll.h"
-#include "common/struct.h"
+// #include <d3d.h>
+//
+#include "math/vector.h"
+// #include "common/struct.h"
#include "math/geometry.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
+// #include "old/d3dengine.h"
+// #include "old/d3dmath.h"
#include "common/global.h"
-#include "common/event.h"
-#include "common/misc.h"
+// #include "common/event.h"
+// #include "common/misc.h"
#include "common/iman.h"
#include "common/restext.h"
-#include "old/math3d.h"
+// #include "old/math3d.h"
#include "object/robotmain.h"
-#include "old/terrain.h"
-#include "old/water.h"
+#include "graphics/engine/terrain.h"
+#include "graphics/engine/water.h"
+#include "graphics/engine/text.h"
#include "object/object.h"
#include "physics/physics.h"
#include "ui/interface.h"
#include "ui/edit.h"
#include "ui/list.h"
-#include "old/text.h"
#include "ui/displaytext.h"
#include "object/task/taskmanager.h"
-#include "object/task/task.h"
-#include "object/task/taskmanip.h"
-#include "object/task/taskgoto.h"
-#include "object/task/taskshield.h"
+// #include "object/task/task.h"
+// #include "object/task/taskmanip.h"
+// #include "object/task/taskgoto.h"
+// #include "object/task/taskshield.h"
#include "script/cbottoken.h"
-#include "script/script.h"
@@ -62,7 +62,7 @@ const int ERM_STOP = 1; // if error -> stop
// Compiling a procedure without any parameters.
-CBotTypResult cNull(CBotVar* &var, void* user)
+CBotTypResult CScript::cNull(CBotVar* &var, void* user)
{
if ( var != 0 ) return CBotErrOverParam;
return CBotTypResult(CBotTypFloat);
@@ -70,26 +70,26 @@ CBotTypResult cNull(CBotVar* &var, void* user)
// Compiling a procedure with a single real number.
-CBotTypResult cOneFloat(CBotVar* &var, void* user)
+CBotTypResult CScript::cOneFloat(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
}
// Compiling a procedure with two real numbers.
-CBotTypResult cTwoFloat(CBotVar* &var, void* user)
+CBotTypResult CScript::cTwoFloat(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
@@ -97,26 +97,26 @@ CBotTypResult cTwoFloat(CBotVar* &var, void* user)
// Compiling a procedure with a "dot".
-CBotTypResult cPoint(CBotVar* &var, void* user)
+CBotTypResult CScript::cPoint(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() <= CBotTypDouble )
+ if ( var->GetType() <= CBotTypDouble )
{
- var = var->GivNext();
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
//? if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
-//? if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
-//? var = var->GivNext();
+//? if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+//? var = var->GetNext();
return CBotTypResult(0);
}
- if ( var->GivType() == CBotTypClass )
+ if ( var->GetType() == CBotTypClass )
{
if ( !var->IsElemOfClass("point") ) return CBotTypResult(CBotErrBadParam);
- var = var->GivNext();
+ var = var->GetNext();
return CBotTypResult(0);
}
@@ -125,12 +125,12 @@ CBotTypResult cPoint(CBotVar* &var, void* user)
// Compiling a procedure with a single "point".
-CBotTypResult cOnePoint(CBotVar* &var, void* user)
+CBotTypResult CScript::cOnePoint(CBotVar* &var, void* user)
{
CBotTypResult ret;
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
@@ -138,12 +138,12 @@ CBotTypResult cOnePoint(CBotVar* &var, void* user)
// Compiling a procedure with a single string.
-CBotTypResult cString(CBotVar* &var, void* user)
+CBotTypResult CScript::cString(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() != CBotTypString &&
- var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() != CBotTypString &&
+ var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
}
@@ -155,8 +155,8 @@ bool FindList(CBotVar* array, int type)
{
while ( array != 0 )
{
- if ( type == array->GivValInt() ) return true;
- array = array->GivNext();
+ if ( type == array->GetValInt() ) return true;
+ array = array->GetNext();
}
return false;
}
@@ -168,40 +168,40 @@ bool GetPoint(CBotVar* &var, int& exception, Math::Vector& pos)
{
CBotVar *pX, *pY, *pZ;
- if ( var->GivType() <= CBotTypDouble )
+ if ( var->GetType() <= CBotTypDouble )
{
- pos.x = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ pos.x = var->GetValFloat()*g_unit;
+ var = var->GetNext();
- pos.z = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ pos.z = var->GetValFloat()*g_unit;
+ var = var->GetNext();
pos.y = 0.0f;
}
else
{
- pX = var->GivItem("x");
+ pX = var->GetItem("x");
if ( pX == NULL )
{
exception = CBotErrUndefItem; return true;
}
- pos.x = pX->GivValFloat()*g_unit;
+ pos.x = pX->GetValFloat()*g_unit;
- pY = var->GivItem("y");
+ pY = var->GetItem("y");
if ( pY == NULL )
{
exception = CBotErrUndefItem; return true;
}
- pos.z = pY->GivValFloat()*g_unit; // attention y -> z !
+ pos.z = pY->GetValFloat()*g_unit; // attention y -> z !
- pZ = var->GivItem("z");
+ pZ = var->GetItem("z");
if ( pZ == NULL )
{
exception = CBotErrUndefItem; return true;
}
- pos.y = pZ->GivValFloat()*g_unit; // attention z -> y !
+ pos.y = pZ->GetValFloat()*g_unit; // attention z -> y !
- var = var->GivNext();
+ var = var->GetNext();
}
return true;
}
@@ -209,33 +209,33 @@ bool GetPoint(CBotVar* &var, int& exception, Math::Vector& pos)
// Instruction "sin(degrees)".
-bool rSin(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rSin(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(sinf(value*Math::PI/180.0f));
return true;
}
// Instruction "cos(degrees)".
-bool rCos(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rCos(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(cosf(value*Math::PI/180.0f));
return true;
}
// Instruction "tan(degrees)".
-bool rTan(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rTan(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(tanf(value*Math::PI/180.0f));
return true;
}
@@ -246,7 +246,7 @@ bool raSin(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(asinf(value)*180.0f/Math::PI);
return true;
}
@@ -257,7 +257,7 @@ bool raCos(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(acosf(value)*180.0f/Math::PI);
return true;
}
@@ -268,38 +268,38 @@ bool raTan(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(atanf(value)*180.0f/Math::PI);
return true;
}
// Instruction "sqrt(value)".
-bool rSqrt(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rSqrt(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(sqrtf(value));
return true;
}
// Instruction "pow(x, y)".
-bool rPow(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rPow(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float x, y;
- x = var->GivValFloat();
- var = var->GivNext();
- y = var->GivValFloat();
+ x = var->GetValFloat();
+ var = var->GetNext();
+ y = var->GetValFloat();
result->SetValFloat(powf(x, y));
return true;
}
// Instruction "rand()".
-bool rRand(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rRand(CBotVar* var, CBotVar* result, int& exception, void* user)
{
result->SetValFloat(Math::Rand());
return true;
@@ -307,11 +307,11 @@ bool rRand(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "abs()".
-bool rAbs(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rAbs(CBotVar* var, CBotVar* result, int& exception, void* user)
{
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
result->SetValFloat(fabs(value));
return true;
}
@@ -319,11 +319,11 @@ bool rAbs(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "retobject(rank)".
-CBotTypResult cRetObject(CBotVar* &var, void* user)
+CBotTypResult CScript::cGetObject(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypPointer, "object");
@@ -331,22 +331,22 @@ CBotTypResult cRetObject(CBotVar* &var, void* user)
// Instruction "retobject(rank)".
-bool rRetObject(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rGetObject(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject*>(user))->GetRunScript();
CObject* pObj;
int rank;
- rank = var->GivValInt();
+ rank = var->GetValInt();
- pObj = (CObject*)script->m_iMan->SearchInstance(CLASS_OBJECT, rank);
+ pObj = static_cast<CObject*>(script->m_iMan->SearchInstance(CLASS_OBJECT, rank));
if ( pObj == 0 )
{
result->SetPointer(0);
}
else
{
- result->SetPointer(pObj->RetBotVar());
+ result->SetPointer(pObj->GetBotVar());
}
return true;
}
@@ -354,24 +354,24 @@ bool rRetObject(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "search(type, pos)".
-CBotTypResult cSearch(CBotVar* &var, void* user)
+CBotTypResult CScript::cSearch(CBotVar* &var, void* user)
{
CBotVar* array;
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() == CBotTypArrayPointer )
+ if ( var->GetType() == CBotTypArrayPointer )
{
- array = var->GivItemList();
+ array = var->GetItemList();
if ( array == 0 ) return CBotTypResult(CBotTypPointer);
- if ( array->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ if ( array->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
}
- else if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ else if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 )
{
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
}
@@ -380,9 +380,9 @@ CBotTypResult cSearch(CBotVar* &var, void* user)
// Instruction "search(type, pos)".
-bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rSearch(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
CObject *pObj, *pBest;
CBotVar* array;
Math::Vector pos, oPos;
@@ -391,17 +391,17 @@ bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user)
float min, dist;
int type, oType, i;
- if ( var->GivType() == CBotTypArrayPointer )
+ if ( var->GetType() == CBotTypArrayPointer )
{
- array = var->GivItemList();
+ array = var->GetItemList();
bArray = true;
}
else
{
- type = var->GivValInt();
+ type = var->GetValInt();
bArray = false;
}
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
if ( !GetPoint(var, exception, pos) ) return true;
@@ -412,13 +412,13 @@ bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user)
pBest = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)script->m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(script->m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
- if ( !pObj->RetActif() ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType == OBJECT_TOTO ) continue;
if ( oType == OBJECT_RUINmobilew2 ||
@@ -455,7 +455,7 @@ bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( bNearest )
{
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::DistanceProjected(pos, oPos);
if ( dist < min )
{
@@ -476,7 +476,7 @@ bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user)
}
else
{
- result->SetPointer(pBest->RetBotVar());
+ result->SetPointer(pBest->GetBotVar());
}
return true;
}
@@ -484,47 +484,47 @@ bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of instruction "radar(type, angle, focus, min, max, sens)".
-CBotTypResult cRadar(CBotVar* &var, void* user)
+CBotTypResult CScript::cRadar(CBotVar* &var, void* user)
{
CBotVar* array;
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( var->GivType() == CBotTypArrayPointer )
+ if ( var->GetType() == CBotTypArrayPointer )
{
- array = var->GivItemList();
+ array = var->GetItemList();
if ( array == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( array->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // type
+ if ( array->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // type
}
- else if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // type
- var = var->GivNext();
+ else if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // type
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // angle
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // angle
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // focus
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // focus
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // min
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // min
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // max
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // max
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // sense
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // sense
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // filter
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum); // filter
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypPointer, "object");
return CBotTypResult(CBotErrOverParam);
}
// Instruction "radar(type, angle, focus, min, max, sens, filter)".
-bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
CObject *pObj, *pBest;
CPhysics* physics;
CBotVar* array;
@@ -544,46 +544,46 @@ bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( var != 0 )
{
- if ( var->GivType() == CBotTypArrayPointer )
+ if ( var->GetType() == CBotTypArrayPointer )
{
- array = var->GivItemList();
+ array = var->GetItemList();
bArray = true;
}
else
{
- type = var->GivValInt();
+ type = var->GetValInt();
bArray = false;
}
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- angle = -var->GivValFloat()*Math::PI/180.0f;
+ angle = -var->GetValFloat()*Math::PI/180.0f;
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- focus = var->GivValFloat()*Math::PI/180.0f;
+ focus = var->GetValFloat()*Math::PI/180.0f;
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- minDist = var->GivValFloat()*g_unit;
+ minDist = var->GetValFloat()*g_unit;
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- maxDist = var->GivValFloat()*g_unit;
+ maxDist = var->GetValFloat()*g_unit;
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- sens = var->GivValFloat();
+ sens = var->GetValFloat();
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- filter = (RadarFilter)var->GivValInt();
+ filter = static_cast<RadarFilter>(var->GetValInt());
}
}
}
@@ -592,8 +592,8 @@ bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
}
}
- iPos = pThis->RetPosition(0);
- iAngle = pThis->RetAngleY(0)+angle;
+ iPos = pThis->GetPosition(0);
+ iAngle = pThis->GetAngleY(0)+angle;
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
if ( sens >= 0.0f ) best = 100000.0f;
@@ -601,15 +601,15 @@ bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
pBest = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)script->m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(script->m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == pThis ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
- if ( !pObj->RetActif() ) continue;
- if ( pObj->RetProxyActivate() ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue;
+ if ( pObj->GetProxyActivate() ) continue;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType == OBJECT_TOTO ) continue;
if ( oType == OBJECT_RUINmobilew2 ||
@@ -637,13 +637,13 @@ bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( filter == FILTER_ONLYLANDING )
{
- physics = pObj->RetPhysics();
- if ( physics != 0 && !physics->RetLand() ) continue;
+ physics = pObj->GetPhysics();
+ if ( physics != 0 && !physics->GetLand() ) continue;
}
if ( filter == FILTER_ONLYFLYING )
{
- physics = pObj->RetPhysics();
- if ( physics != 0 && physics->RetLand() ) continue;
+ physics = pObj->GetPhysics();
+ if ( physics != 0 && physics->GetLand() ) continue;
}
if ( bArray )
@@ -655,7 +655,7 @@ bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( type != oType && type != OBJECT_NULL ) continue;
}
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
d = Math::DistanceProjected(iPos, oPos);
if ( d < minDist || d > maxDist ) continue; // too close or too far?
@@ -688,7 +688,7 @@ bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
}
else
{
- result->SetPointer(pBest->RetBotVar());
+ result->SetPointer(pBest->GetBotVar());
}
return true;
}
@@ -696,7 +696,7 @@ bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user)
// Monitoring a task.
-bool Process(CScript* script, CBotVar* result, int &exception)
+bool CScript::Process(CScript* script, CBotVar* result, int &exception)
{
Error err;
@@ -726,21 +726,21 @@ bool Process(CScript* script, CBotVar* result, int &exception)
// Compilation of the instruction "detect(type)".
-CBotTypResult cDetect(CBotVar* &var, void* user)
+CBotTypResult CScript::cDetect(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypBoolean);
}
// Instruction "detect(type)".
-bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rDetect(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
CObject *pObj, *pGoal, *pBest;
CPhysics* physics;
CBotVar* array;
@@ -765,20 +765,20 @@ bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( var != 0 )
{
- if ( var->GivType() == CBotTypArrayPointer )
+ if ( var->GetType() == CBotTypArrayPointer )
{
- array = var->GivItemList();
+ array = var->GetItemList();
bArray = true;
}
else
{
- type = var->GivValInt();
+ type = var->GetValInt();
bArray = false;
}
}
- iPos = pThis->RetPosition(0);
- iAngle = pThis->RetAngleY(0)+angle;
+ iPos = pThis->GetPosition(0);
+ iAngle = pThis->GetAngleY(0)+angle;
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
bGoal = 100000.0f;
@@ -788,15 +788,15 @@ bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user)
pBest = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)script->m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(script->m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == pThis ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
- if ( !pObj->RetActif() ) continue;
- if ( pObj->RetProxyActivate() ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue;
+ if ( pObj->GetProxyActivate() ) continue;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType == OBJECT_TOTO ) continue;
if ( oType == OBJECT_RUINmobilew2 ||
@@ -824,13 +824,13 @@ bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( filter == FILTER_ONLYLANDING )
{
- physics = pObj->RetPhysics();
- if ( physics != 0 && !physics->RetLand() ) continue;
+ physics = pObj->GetPhysics();
+ if ( physics != 0 && !physics->GetLand() ) continue;
}
if ( filter == FILTER_ONLYFLYING )
{
- physics = pObj->RetPhysics();
- if ( physics != 0 && physics->RetLand() ) continue;
+ physics = pObj->GetPhysics();
+ if ( physics != 0 && physics->GetLand() ) continue;
}
if ( bArray )
@@ -842,7 +842,7 @@ bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( type != oType && type != OBJECT_NULL ) continue;
}
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
d = Math::DistanceProjected(iPos, oPos);
a = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
@@ -911,13 +911,13 @@ bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "direction(pos)".
-CBotTypResult cDirection(CBotVar* &var, void* user)
+CBotTypResult CScript::cDirection(CBotVar* &var, void* user)
{
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
@@ -925,18 +925,17 @@ CBotTypResult cDirection(CBotVar* &var, void* user)
// Instruction "direction(pos)".
-bool rDirection(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rDirection(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CObject* pThis = static_cast<CObject *>(user);
Math::Vector iPos, oPos;
- float a, g;
+ float a, g;
if ( !GetPoint(var, exception, oPos) ) return true;
- iPos = pThis->RetPosition(0);
+ iPos = pThis->GetPosition(0);
- a = pThis->RetAngleY(0);
+ a = pThis->GetAngleY(0);
g = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
result->SetValFloat(-Math::Direction(a, g)*180.0f/Math::PI);
@@ -946,25 +945,25 @@ bool rDirection(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "produce(pos, angle, type, scriptName)".
-CBotTypResult cProduce(CBotVar* &var, void* user)
+CBotTypResult CScript::cProduce(CBotVar* &var, void* user)
{
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
- var = var->GivNext();
+ if ( var->GetType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
@@ -973,9 +972,9 @@ CBotTypResult cProduce(CBotVar* &var, void* user)
// Instruction "produce(pos, angle, type, scriptName)".
-bool rProduce(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rProduce(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
CObject* object;
CBotString cbs;
const char* name;
@@ -985,13 +984,13 @@ bool rProduce(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( !GetPoint(var, exception, pos) ) return true;
- angle = var->GivValFloat()*Math::PI/180.0f;
- var = var->GivNext();
+ angle = var->GetValFloat()*Math::PI/180.0f;
+ var = var->GetNext();
- type = (ObjectType)var->GivValInt();
- var = var->GivNext();
+ type = static_cast<ObjectType>(var->GetValInt());
+ var = var->GetNext();
- cbs = var->GivValString();
+ cbs = var->GetValString();
name = cbs;
if ( type == OBJECT_FRET ||
@@ -1054,7 +1053,7 @@ bool rProduce(CBotVar* var, CBotVar* result, int& exception, void* user)
return true;
}
object->SetActivity(false);
- object->ReadProgram(0, (char*)name);
+ object->ReadProgram(0, static_cast<const char*>(name));
object->RunProgram(0);
result->SetValInt(0); // no error
@@ -1064,17 +1063,17 @@ bool rProduce(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "distance(p1, p2)".
-CBotTypResult cDistance(CBotVar* &var, void* user)
+CBotTypResult CScript::cDistance(CBotVar* &var, void* user)
{
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
@@ -1083,7 +1082,7 @@ CBotTypResult cDistance(CBotVar* &var, void* user)
// Instruction "distance(p1, p2)".
-bool rDistance(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rDistance(CBotVar* var, CBotVar* result, int& exception, void* user)
{
Math::Vector p1, p2;
float value;
@@ -1098,7 +1097,7 @@ bool rDistance(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "distance2d(p1, p2)".
-bool rDistance2d(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rDistance2d(CBotVar* var, CBotVar* result, int& exception, void* user)
{
Math::Vector p1, p2;
float value;
@@ -1114,25 +1113,25 @@ bool rDistance2d(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "space(center, rMin, rMax, dist)".
-CBotTypResult cSpace(CBotVar* &var, void* user)
+CBotTypResult CScript::cSpace(CBotVar* &var, void* user)
{
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotTypIntrinsic, "point");
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var == 0 ) return CBotTypResult(CBotTypIntrinsic, "point");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypIntrinsic, "point");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypIntrinsic, "point");
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypIntrinsic, "point");
@@ -1140,10 +1139,10 @@ CBotTypResult cSpace(CBotVar* &var, void* user)
// Instruction "space(center, rMin, rMax, dist)".
-bool rSpace(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rSpace(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
CBotVar* pSub;
Math::Vector center;
float rMin, rMax, dist;
@@ -1154,7 +1153,7 @@ bool rSpace(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( var == 0 )
{
- center = pThis->RetPosition(0);
+ center = pThis->GetPosition(0);
}
else
{
@@ -1162,18 +1161,18 @@ bool rSpace(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( var != 0 )
{
- rMin = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ rMin = var->GetValFloat()*g_unit;
+ var = var->GetNext();
if ( var != 0 )
{
- rMax = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ rMax = var->GetValFloat()*g_unit;
+ var = var->GetNext();
if ( var != 0 )
{
- dist = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ dist = var->GetValFloat()*g_unit;
+ var = var->GetNext();
}
}
}
@@ -1182,13 +1181,13 @@ bool rSpace(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( result != 0 )
{
- pSub = result->GivItemList();
+ pSub = result->GetItemList();
if ( pSub != 0 )
{
pSub->SetValFloat(center.x/g_unit);
- pSub = pSub->GivNext(); // "y"
+ pSub = pSub->GetNext(); // "y"
pSub->SetValFloat(center.z/g_unit);
- pSub = pSub->GivNext(); // "z"
+ pSub = pSub->GetNext(); // "z"
pSub->SetValFloat(center.y/g_unit);
}
}
@@ -1198,17 +1197,17 @@ bool rSpace(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "flatground(center, rMax)".
-CBotTypResult cFlatGround(CBotVar* &var, void* user)
+CBotTypResult CScript::cFlatGround(CBotVar* &var, void* user)
{
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
@@ -1217,18 +1216,18 @@ CBotTypResult cFlatGround(CBotVar* &var, void* user)
// Instruction "flatground(center, rMax)".
-bool rFlatGround(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rFlatGround(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
Math::Vector center;
float rMax, dist;
if ( !GetPoint(var, exception, center) ) return true;
- rMax = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ rMax = var->GetValFloat()*g_unit;
+ var = var->GetNext();
- dist = script->m_main->RetFlatZoneRadius(center, rMax, pThis);
+ dist = script->m_main->GetFlatZoneRadius(center, rMax, pThis);
result->SetValFloat(dist/g_unit);
return true;
@@ -1237,9 +1236,9 @@ bool rFlatGround(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "wait(t)".
-bool rWait(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rWait(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
float value;
Error err;
@@ -1248,7 +1247,7 @@ bool rWait(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( script->m_primaryTask == 0 ) // no task in progress?
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- value = var->GivValFloat();
+ value = var->GetValFloat();
err = script->m_primaryTask->StartTaskWait(value);
if ( err != ERR_OK )
{
@@ -1268,9 +1267,9 @@ bool rWait(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "move(dist)".
-bool rMove(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rMove(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
float value;
Error err;
@@ -1279,7 +1278,7 @@ bool rMove(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( script->m_primaryTask == 0 ) // no task in progress?
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- value = var->GivValFloat();
+ value = var->GetValFloat();
err = script->m_primaryTask->StartTaskAdvance(value*g_unit);
if ( err != ERR_OK )
{
@@ -1299,9 +1298,9 @@ bool rMove(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "turn(angle)".
-bool rTurn(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rTurn(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
float value;
Error err;
@@ -1310,7 +1309,7 @@ bool rTurn(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( script->m_primaryTask == 0 ) // no task in progress?
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- value = var->GivValFloat();
+ value = var->GetValFloat();
err = script->m_primaryTask->StartTaskTurn(-value*Math::PI/180.0f);
if ( err != ERR_OK )
{
@@ -1330,25 +1329,25 @@ bool rTurn(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "goto(pos, altitude, crash, goal)".
-CBotTypResult cGoto(CBotVar* &var, void* user)
+CBotTypResult CScript::cGoto(CBotVar* &var, void* user)
{
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ if ( ret.GetType() != 0 ) return ret;
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
return CBotTypResult(CBotErrOverParam);
@@ -1356,9 +1355,9 @@ CBotTypResult cGoto(CBotVar* &var, void* user)
// Instruction "goto(pos, altitude, mode)".
-bool rGoto(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rGoto(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
Math::Vector pos;
TaskGotoGoal goal;
TaskGotoCrash crash;
@@ -1378,17 +1377,17 @@ bool rGoto(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( var != 0 )
{
- altitude = var->GivValFloat()*g_unit;
+ altitude = var->GetValFloat()*g_unit;
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- goal = (TaskGotoGoal)var->GivValInt();
+ goal = static_cast<TaskGotoGoal>(var->GetValInt());
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- crash = (TaskGotoCrash)var->GivValInt();
+ crash = static_cast<TaskGotoCrash>(var->GetValInt());
}
}
}
@@ -1412,19 +1411,19 @@ bool rGoto(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "find(type)".
-bool rFind(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rFind(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
Math::Vector pos;
TaskGotoGoal goal;
TaskGotoCrash crash;
float altitude;
Error err;
- CObject* pThis = (CObject*)user;
+ CObject* pThis = static_cast<CObject *>(user);
CObject *pObj, *pBest;
CBotVar* array;
Math::Vector iPos, oPos;
- float best, minDist, maxDist, sens, iAngle, angle, focus, d, a;
+ float best, minDist, maxDist, iAngle, focus, d, a;
int type, oType, i;
bool bArray;
@@ -1433,20 +1432,18 @@ bool rFind(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( script->m_primaryTask == 0 ) // no task in progress?
{
type = OBJECT_NULL;
- angle = 0.0f;
focus = Math::PI*2.0f;
minDist = 0.0f*g_unit;
maxDist = 1000.0f*g_unit;
- sens = 1.0f;
- if ( var->GivType() == CBotTypArrayPointer )
+ if ( var->GetType() == CBotTypArrayPointer )
{
- array = var->GivItemList();
+ array = var->GetItemList();
bArray = true;
}
else
{
- type = var->GivValInt();
+ type = var->GetValInt();
bArray = false;
}
@@ -1454,15 +1451,15 @@ bool rFind(CBotVar* var, CBotVar* result, int& exception, void* user)
pBest = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)script->m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(script->m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == pThis ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
- if ( !pObj->RetActif() ) continue;
- if ( pObj->RetProxyActivate() ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue;
+ if ( pObj->GetProxyActivate() ) continue;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType == OBJECT_TOTO ) continue;
if ( oType == OBJECT_RUINmobilew2 ||
@@ -1497,7 +1494,7 @@ bool rFind(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( type != oType && type != OBJECT_NULL ) continue;
}
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
d = Math::DistanceProjected(iPos, oPos);
if ( d < minDist || d > maxDist ) continue; // too close or too far?
@@ -1528,7 +1525,7 @@ bool rFind(CBotVar* var, CBotVar* result, int& exception, void* user)
return false;
}
- pos = pBest->RetPosition(0);
+ pos = pBest->GetPosition(0);
goal = TGG_DEFAULT;
crash = TGC_DEFAULT;
altitude = 0.0f*g_unit;
@@ -1553,21 +1550,21 @@ bool rFind(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation "grab/drop(oper)".
-CBotTypResult cGrabDrop(CBotVar* &var, void* user)
+CBotTypResult CScript::cGrabDrop(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
}
// Instruction "grab(oper)".
-bool rGrab(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rGrab(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
ObjectType oType;
TaskManipArm type;
Error err;
@@ -1577,10 +1574,16 @@ bool rGrab(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( script->m_primaryTask == 0 ) // no task in progress?
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- if ( var == 0 ) type = TMA_FFRONT;
- else type = (TaskManipArm)var->GivValInt();
+ if ( var == 0 )
+ {
+ type = TMA_FFRONT;
+ }
+ else
+ {
+ type = static_cast<TaskManipArm>(var->GetValInt());
+ }
- oType = pThis->RetType();
+ oType = pThis->GetType();
if ( oType == OBJECT_HUMAN ||
oType == OBJECT_TECH )
{
@@ -1609,10 +1612,10 @@ bool rGrab(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "drop(oper)".
-bool rDrop(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rDrop(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
ObjectType oType;
TaskManipArm type;
Error err;
@@ -1623,9 +1626,9 @@ bool rDrop(CBotVar* var, CBotVar* result, int& exception, void* user)
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
if ( var == 0 ) type = TMA_FFRONT;
- else type = (TaskManipArm)var->GivValInt();
+ else type = static_cast<TaskManipArm>(var->GetValInt());
- oType = pThis->RetType();
+ oType = pThis->GetType();
if ( oType == OBJECT_HUMAN ||
oType == OBJECT_TECH )
{
@@ -1654,9 +1657,9 @@ bool rDrop(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "sniff()".
-bool rSniff(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rSniff(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
Error err;
exception = 0;
@@ -1683,15 +1686,15 @@ bool rSniff(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "receive(nom, power)".
-CBotTypResult cReceive(CBotVar* &var, void* user)
+CBotTypResult CScript::cReceive(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
- var = var->GivNext();
+ if ( var->GetType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
@@ -1699,10 +1702,10 @@ CBotTypResult cReceive(CBotVar* &var, void* user)
// Instruction "receive(nom, power)".
-bool rReceive(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rReceive(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
CBotString cbs;
Error err;
const char* p;
@@ -1714,18 +1717,18 @@ bool rReceive(CBotVar* var, CBotVar* result, int& exception, void* user)
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- cbs = var->GivValString();
+ cbs = var->GetValString();
p = cbs;
- var = var->GivNext();
+ var = var->GetNext();
power = 10.0f*g_unit;
if ( var != 0 )
{
- power = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ power = var->GetValFloat()*g_unit;
+ var = var->GetNext();
}
- err = script->m_primaryTask->StartTaskInfo((char*)p, 0.0f, power, false);
+ err = script->m_primaryTask->StartTaskInfo(static_cast<const char*>(p), 0.0f, power, false);
if ( err != ERR_OK )
{
delete script->m_primaryTask;
@@ -1736,7 +1739,7 @@ bool rReceive(CBotVar* var, CBotVar* result, int& exception, void* user)
}
if ( !Process(script, result, exception) ) return false; // not finished
- value = pThis->RetInfoReturn();
+ value = pThis->GetInfoReturn();
if ( value == NAN )
{
result->SetInit(IS_NAN);
@@ -1750,19 +1753,19 @@ bool rReceive(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "send(nom, value, power)".
-CBotTypResult cSend(CBotVar* &var, void* user)
+CBotTypResult CScript::cSend(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
- var = var->GivNext();
+ if ( var->GetType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
@@ -1770,10 +1773,9 @@ CBotTypResult cSend(CBotVar* &var, void* user)
// Instruction "send(nom, value, power)".
-bool rSend(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rSend(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
CBotString cbs;
Error err;
const char* p;
@@ -1785,21 +1787,21 @@ bool rSend(CBotVar* var, CBotVar* result, int& exception, void* user)
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- cbs = var->GivValString();
+ cbs = var->GetValString();
p = cbs;
- var = var->GivNext();
+ var = var->GetNext();
- value = var->GivValFloat();
- var = var->GivNext();
+ value = var->GetValFloat();
+ var = var->GetNext();
power = 10.0f*g_unit;
if ( var != 0 )
{
- power = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ power = var->GetValFloat()*g_unit;
+ var = var->GetNext();
}
- err = script->m_primaryTask->StartTaskInfo((char*)p, value, power, true);
+ err = script->m_primaryTask->StartTaskInfo(static_cast<const char*>(p), value, power, true);
if ( err != ERR_OK )
{
delete script->m_primaryTask;
@@ -1818,7 +1820,7 @@ bool rSend(CBotVar* var, CBotVar* result, int& exception, void* user)
// Seeks the nearest information terminal.
-CObject* SearchInfo(CScript* script, CObject* object, float power)
+CObject* CScript::SearchInfo(CScript* script, CObject* object, float power)
{
CObject *pObj, *pBest;
Math::Vector iPos, oPos;
@@ -1826,21 +1828,21 @@ CObject* SearchInfo(CScript* script, CObject* object, float power)
float dist, min;
int i;
- iPos = object->RetPosition(0);
+ iPos = object->GetPosition(0);
min = 100000.0f;
pBest = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)script->m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(script->m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_INFO ) continue;
- if ( !pObj->RetActif() ) continue;
+ if ( !pObj->GetActif() ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, iPos);
if ( dist > power ) continue; // too far?
if ( dist < min )
@@ -1855,15 +1857,15 @@ CObject* SearchInfo(CScript* script, CObject* object, float power)
// Compilation of the instruction "deleteinfo(nom, power)".
-CBotTypResult cDeleteInfo(CBotVar* &var, void* user)
+CBotTypResult CScript::cDeleteInfo(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
- var = var->GivNext();
+ if ( var->GetType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
@@ -1871,10 +1873,10 @@ CBotTypResult cDeleteInfo(CBotVar* &var, void* user)
// Instruction "deleteinfo(nom, power)".
-bool rDeleteInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rDeleteInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
CObject* pInfo;
CBotString cbs;
Info info;
@@ -1884,15 +1886,15 @@ bool rDeleteInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
exception = 0;
- cbs = var->GivValString();
+ cbs = var->GetValString();
p = cbs;
- var = var->GivNext();
+ var = var->GetNext();
power = 10.0f*g_unit;
if ( var != 0 )
{
- power = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ power = var->GetValFloat()*g_unit;
+ var = var->GetNext();
}
pInfo = SearchInfo(script, pThis, power);
@@ -1902,10 +1904,10 @@ bool rDeleteInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
return true;
}
- total = pInfo->RetInfoTotal();
+ total = pInfo->GetInfoTotal();
for ( i=0 ; i<total ; i++ )
{
- info = pInfo->RetInfo(i);
+ info = pInfo->GetInfo(i);
if ( strcmp(info.name, p) == 0 )
{
pInfo->DeleteInfo(i);
@@ -1919,15 +1921,15 @@ bool rDeleteInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "testinfo(nom, power)".
-CBotTypResult cTestInfo(CBotVar* &var, void* user)
+CBotTypResult CScript::cTestInfo(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
- var = var->GivNext();
+ if ( var->GetType() != CBotTypString ) return CBotTypResult(CBotErrBadString);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypBoolean);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypBoolean);
@@ -1935,10 +1937,10 @@ CBotTypResult cTestInfo(CBotVar* &var, void* user)
// Instruction "testinfo(nom, power)".
-bool rTestInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rTestInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
CObject* pInfo;
CBotString cbs;
Info info;
@@ -1948,15 +1950,15 @@ bool rTestInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
exception = 0;
- cbs = var->GivValString();
+ cbs = var->GetValString();
p = cbs;
- var = var->GivNext();
+ var = var->GetNext();
power = 10.0f*g_unit;
if ( var != 0 )
{
- power = var->GivValFloat()*g_unit;
- var = var->GivNext();
+ power = var->GetValFloat()*g_unit;
+ var = var->GetNext();
}
pInfo = SearchInfo(script, pThis, power);
@@ -1966,10 +1968,10 @@ bool rTestInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
return true;
}
- total = pInfo->RetInfoTotal();
+ total = pInfo->GetInfoTotal();
for ( i=0 ; i<total ; i++ )
{
- info = pInfo->RetInfo(i);
+ info = pInfo->GetInfo(i);
if ( strcmp(info.name, p) == 0 )
{
result->SetValInt(true);
@@ -1982,9 +1984,9 @@ bool rTestInfo(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "thump()".
-bool rThump(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rThump(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
Error err;
exception = 0;
@@ -2011,9 +2013,9 @@ bool rThump(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "recycle()".
-bool rRecycle(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rRecycle(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
Error err;
exception = 0;
@@ -2040,15 +2042,15 @@ bool rRecycle(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation "shield(oper, radius)".
-CBotTypResult cShield(CBotVar* &var, void* user)
+CBotTypResult CScript::cShield(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
@@ -2057,17 +2059,17 @@ CBotTypResult cShield(CBotVar* &var, void* user)
// Instruction "shield(oper, radius)".
-bool rShield(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rShield(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
float oper, radius;
Error err;
- oper = var->GivValFloat(); // 0=down, 1=up
- var = var->GivNext();
+ oper = var->GetValFloat(); // 0=down, 1=up
+ var = var->GetNext();
- radius = var->GivValFloat();
+ radius = var->GetValFloat();
if ( radius < 10.0f ) radius = 10.0f;
if ( radius > 25.0f ) radius = 25.0f;
radius = (radius-10.0f)/15.0f;
@@ -2111,13 +2113,13 @@ bool rShield(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation "fire(delay)".
-CBotTypResult cFire(CBotVar* &var, void* user)
+CBotTypResult CScript::cFire(CBotVar* &var, void* user)
{
#if 0
- CObject* pThis = (CObject*)user;
+ CObject* pThis = static_cast<CObject *>(user);
ObjectType type;
- type = pThis->RetType();
+ type = pThis->GetType();
if ( type == OBJECT_ANT )
{
@@ -2130,8 +2132,8 @@ CBotTypResult cFire(CBotVar* &var, void* user)
else
{
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
return CBotTypResult(CBotTypFloat);
}
@@ -2142,10 +2144,10 @@ CBotTypResult cFire(CBotVar* &var, void* user)
// Instruction "fire(delay)".
-bool rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
float delay;
Math::Vector impact;
Error err;
@@ -2157,12 +2159,12 @@ bool rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- type = pThis->RetType();
+ type = pThis->GetType();
if ( type == OBJECT_ANT )
{
if ( !GetPoint(var, exception, impact) ) return true;
- impact.y += pThis->RetWaterLevel();
+ impact.y += pThis->GetWaterLevel();
err = script->m_primaryTask->StartTaskFireAnt(impact);
}
else if ( type == OBJECT_SPIDER )
@@ -2172,7 +2174,7 @@ bool rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
else
{
if ( var == 0 ) delay = 0.0f;
- else delay = var->GivValFloat();
+ else delay = var->GetValFloat();
err = script->m_primaryTask->StartTaskFire(delay);
}
@@ -2189,9 +2191,9 @@ bool rFire(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "aim(dir)".
-bool rAim(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rAim(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
float value;
Error err;
@@ -2200,7 +2202,7 @@ bool rAim(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( script->m_primaryTask == 0 ) // no task in progress?
{
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- value = var->GivValFloat();
+ value = var->GetValFloat();
err = script->m_primaryTask->StartTaskGunGoal(value*Math::PI/180.0f, 0.0f);
if ( err != ERR_OK )
{
@@ -2215,15 +2217,15 @@ bool rAim(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "motor(left, right)".
-CBotTypResult cMotor(CBotVar* &var, void* user)
+CBotTypResult CScript::cMotor(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var != 0 ) return CBotTypResult(CBotErrOverParam);
@@ -2232,15 +2234,15 @@ CBotTypResult cMotor(CBotVar* &var, void* user)
// Instruction "motor(left, right)".
-bool rMotor(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rMotor(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CObject* pThis = (CObject*)user;
- CPhysics* physics = ((CObject*)user)->RetPhysics();
+ CObject* pThis = static_cast<CObject *>(user);
+ CPhysics* physics = (static_cast<CObject *>(user))->GetPhysics();
float left, right, speed, turn;
- left = var->GivValFloat();
- var = var->GivNext();
- right = var->GivValFloat();
+ left = var->GetValFloat();
+ var = var->GetNext();
+ right = var->GetValFloat();
speed = (left+right)/2.0f;
if ( speed < -1.0f ) speed = -1.0f;
@@ -2250,7 +2252,7 @@ bool rMotor(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( turn < -1.0f ) turn = -1.0f;
if ( turn > 1.0f ) turn = 1.0f;
- if ( pThis->RetFixed() ) // ant on the back?
+ if ( pThis->GetFixed() ) // ant on the back?
{
speed = 0.0f;
turn = 0.0f;
@@ -2264,12 +2266,12 @@ bool rMotor(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "jet(power)".
-bool rJet(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rJet(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CPhysics* physics = ((CObject*)user)->RetPhysics();
+ CPhysics* physics = (static_cast<CObject *>(user))->GetPhysics();
float value;
- value = var->GivValFloat();
+ value = var->GetValFloat();
physics->SetMotorSpeedY(value);
return true;
@@ -2277,13 +2279,13 @@ bool rJet(CBotVar* var, CBotVar* result, int& exception, void* user)
// Compilation of the instruction "topo(pos)".
-CBotTypResult cTopo(CBotVar* &var, void* user)
+CBotTypResult CScript::cTopo(CBotVar* &var, void* user)
{
CBotTypResult ret;
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- ret = cPoint(var, user);
- if ( ret.GivType() != 0 ) return ret;
+ ret = CScript::cPoint(var, user);
+ if ( ret.GetType() != 0 ) return ret;
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
return CBotTypResult(CBotErrOverParam);
@@ -2291,9 +2293,9 @@ CBotTypResult cTopo(CBotVar* &var, void* user)
// Instruction "topo(pos)".
-bool rTopo(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rTopo(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
Math::Vector pos;
float level;
@@ -2301,24 +2303,24 @@ bool rTopo(CBotVar* var, CBotVar* result, int& exception, void* user)
if ( !GetPoint(var, exception, pos) ) return true;
- level = script->m_terrain->RetFloorLevel(pos);
- level -= script->m_water->RetLevel();
+ level = script->m_terrain->GetFloorLevel(pos);
+ level -= script->m_water->GetLevel();
result->SetValFloat(level/g_unit);
return true;
}
// Compilation of the instruction "message(string, type)".
-CBotTypResult cMessage(CBotVar* &var, void* user)
+CBotTypResult CScript::cMessage(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotErrLowParam);
- if ( var->GivType() != CBotTypString &&
- var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() != CBotTypString &&
+ var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
return CBotTypResult(CBotErrOverParam);
@@ -2326,40 +2328,39 @@ CBotTypResult cMessage(CBotVar* &var, void* user)
// Instruction "message(string, type)".
-bool rMessage(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rMessage(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
CBotString cbs;
const char* p;
- TextType type;
+ Ui::TextType type;
- cbs = var->GivValString();
+ cbs = var->GetValString();
p = cbs;
- type = TT_MESSAGE;
- var = var->GivNext();
+ type = Ui::TT_MESSAGE;
+ var = var->GetNext();
if ( var != 0 )
{
- type = (TextType)var->GivValInt();
+ type = static_cast<Ui::TextType>(var->GetValInt());
}
- script->m_displayText->DisplayText((char*)p, script->m_object, 10.0f, type);
- script->m_main->CheckEndMessage((char*)p);
+ script->m_displayText->DisplayText(p, script->m_object, 10.0f, type);
+ script->m_main->CheckEndMessage(p);
return true;
}
// Instruction "cmdline(rank)".
-bool rCmdline(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rCmdline(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CObject* pThis = static_cast<CObject *>(user);
float value;
int rank;
- rank = var->GivValInt();
- value = pThis->RetCmdLine(rank);
+ rank = var->GetValInt();
+ value = pThis->GetCmdLine(rank);
result->SetValFloat(value);
return true;
@@ -2367,12 +2368,12 @@ bool rCmdline(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "ismovie()".
-bool rIsMovie(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rIsMovie(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
float value;
- value = script->m_main->RetMovieLock()?1.0f:0.0f;
+ value = script->m_main->GetMovieLock()?1.0f:0.0f;
result->SetValFloat(value);
return true;
@@ -2380,12 +2381,12 @@ bool rIsMovie(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "errmode(mode)".
-bool rErrMode(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rErrMode(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
int value;
- value = var->GivValInt();
+ value = var->GetValInt();
if ( value < 0 ) value = 0;
if ( value > 1 ) value = 1;
script->m_errMode = value;
@@ -2395,12 +2396,12 @@ bool rErrMode(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "ipf(num)".
-bool rIPF(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rIPF(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
int value;
- value = var->GivValInt();
+ value = var->GetValInt();
if ( value < 1 ) value = 1;
if ( value > 10000 ) value = 10000;
script->m_ipf = value;
@@ -2410,12 +2411,12 @@ bool rIPF(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "abstime()".
-bool rAbsTime(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rAbsTime(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
float value;
- value = script->m_main->RetGameTime();
+ value = script->m_main->GetGameTime();
result->SetValFloat(value);
return true;
}
@@ -2450,33 +2451,32 @@ void PrepareFilename(CBotString &filename, char *dir)
// Instruction "deletefile(filename)".
-bool rDeleteFile(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rDeleteFile(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
CBotString cbs;
- const char* p;
+ const char* filename;
char* dir;
- cbs = var->GivValString();
- dir = script->m_main->RetFilesDir();
+ cbs = var->GetValString();
+ dir = script->m_main->GetFilesDir();
PrepareFilename(cbs, dir);
- p = cbs;
- DeleteFile(p);
-
- return true;
+ filename = cbs;
+ //std function that removes file.
+ return (!remove(filename));
}
// Compilation of the instruction "pendown(color, width)".
-CBotTypResult cPenDown(CBotVar* &var, void* user)
+CBotTypResult CScript::cPenDown(CBotVar* &var, void* user)
{
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
- if ( var->GivType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
- var = var->GivNext();
+ if ( var->GetType() > CBotTypDouble ) return CBotTypResult(CBotErrBadNum);
+ var = var->GetNext();
if ( var == 0 ) return CBotTypResult(CBotTypFloat);
return CBotTypResult(CBotErrOverParam);
@@ -2484,15 +2484,15 @@ CBotTypResult cPenDown(CBotVar* &var, void* user)
// Instruction "pendown(color, width)".
-bool rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
int color;
float width;
Error err;
- if ( pThis->RetType() == OBJECT_MOBILEdr )
+ if ( pThis->GetType() == OBJECT_MOBILEdr )
{
exception = 0;
@@ -2500,15 +2500,15 @@ bool rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user)
{
if ( var != 0 )
{
- color = var->GivValInt();
+ color = var->GetValInt();
if ( color < 0 ) color = 0;
if ( color > 17 ) color = 17;
pThis->SetTraceColor(color);
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- width = var->GivValFloat();
+ width = var->GetValFloat();
if ( width < 0.1f ) width = 0.1f;
if ( width > 1.0f ) width = 1.0f;
pThis->SetTraceWidth(width);
@@ -2517,7 +2517,7 @@ bool rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user)
pThis->SetTraceDown(true);
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- err = script->m_primaryTask->StartTaskPen(pThis->RetTraceDown(), pThis->RetTraceColor());
+ err = script->m_primaryTask->StartTaskPen(pThis->GetTraceDown(), pThis->GetTraceColor());
if ( err != ERR_OK )
{
delete script->m_primaryTask;
@@ -2537,15 +2537,15 @@ bool rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user)
{
if ( var != 0 )
{
- color = var->GivValInt();
+ color = var->GetValInt();
if ( color < 0 ) color = 0;
if ( color > 17 ) color = 17;
pThis->SetTraceColor(color);
- var = var->GivNext();
+ var = var->GetNext();
if ( var != 0 )
{
- width = var->GivValFloat();
+ width = var->GetValFloat();
if ( width < 0.1f ) width = 0.1f;
if ( width > 1.0f ) width = 1.0f;
pThis->SetTraceWidth(width);
@@ -2559,13 +2559,13 @@ bool rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "penup()".
-bool rPenUp(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rPenUp(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
Error err;
- if ( pThis->RetType() == OBJECT_MOBILEdr )
+ if ( pThis->GetType() == OBJECT_MOBILEdr )
{
exception = 0;
@@ -2574,7 +2574,7 @@ bool rPenUp(CBotVar* var, CBotVar* result, int& exception, void* user)
pThis->SetTraceDown(false);
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- err = script->m_primaryTask->StartTaskPen(pThis->RetTraceDown(), pThis->RetTraceColor());
+ err = script->m_primaryTask->StartTaskPen(pThis->GetTraceDown(), pThis->GetTraceColor());
if ( err != ERR_OK )
{
delete script->m_primaryTask;
@@ -2599,27 +2599,26 @@ bool rPenUp(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "pencolor()".
-bool rPenColor(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rPenColor(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CScript* script = ((CObject*)user)->RetRunScript();
- CPhysics* physics = ((CObject*)user)->RetPhysics();
- CObject* pThis = (CObject*)user;
+ CScript* script = (static_cast<CObject *>(user))->GetRunScript();
+ CObject* pThis = static_cast<CObject *>(user);
int color;
Error err;
- if ( pThis->RetType() == OBJECT_MOBILEdr )
+ if ( pThis->GetType() == OBJECT_MOBILEdr )
{
exception = 0;
if ( script->m_primaryTask == 0 ) // no task in progress?
{
- color = var->GivValInt();
+ color = var->GetValInt();
if ( color < 0 ) color = 0;
if ( color > 17 ) color = 17;
pThis->SetTraceColor(color);
script->m_primaryTask = new CTaskManager(script->m_iMan, script->m_object);
- err = script->m_primaryTask->StartTaskPen(pThis->RetTraceDown(), pThis->RetTraceColor());
+ err = script->m_primaryTask->StartTaskPen(pThis->GetTraceDown(), pThis->GetTraceColor());
if ( err != ERR_OK )
{
delete script->m_primaryTask;
@@ -2637,7 +2636,7 @@ bool rPenColor(CBotVar* var, CBotVar* result, int& exception, void* user)
}
else
{
- color = var->GivValInt();
+ color = var->GetValInt();
if ( color < 0 ) color = 0;
if ( color > 17 ) color = 17;
pThis->SetTraceColor(color);
@@ -2648,12 +2647,12 @@ bool rPenColor(CBotVar* var, CBotVar* result, int& exception, void* user)
// Instruction "penwidth()".
-bool rPenWidth(CBotVar* var, CBotVar* result, int& exception, void* user)
+bool CScript::rPenWidth(CBotVar* var, CBotVar* result, int& exception, void* user)
{
- CObject* pThis = (CObject*)user;
+ CObject* pThis = static_cast<CObject *>(user);
float width;
- width = var->GivValFloat();
+ width = var->GetValFloat();
if ( width < 0.1f ) width = 0.1f;
if ( width > 1.0f ) width = 1.0f;
pThis->SetTraceWidth(width);
@@ -2669,15 +2668,13 @@ CScript::CScript(CInstanceManager* iMan, CObject* object, CTaskManager** seconda
m_iMan = iMan;
m_iMan->AddInstance(CLASS_SCRIPT, this, 100);
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE);
- m_displayText = (CDisplayText*)m_iMan->SearchInstance(CLASS_DISPLAYTEXT);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN);
- m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
- m_botProg = 0;
- m_object = object;
- m_primaryTask = 0;
+ m_engine = static_cast<Gfx::CEngine*>(m_iMan->SearchInstance(CLASS_ENGINE));
+ m_main = static_cast<CRobotMain*>(m_iMan->SearchInstance(CLASS_MAIN));
+ m_terrain = static_cast<Gfx::CTerrain*>(m_iMan->SearchInstance(CLASS_TERRAIN));
+ m_water = static_cast<Gfx::CWater*>(m_iMan->SearchInstance(CLASS_WATER));
+ m_botProg = 0;
+ m_object = object;
+ m_primaryTask = 0;
m_secondaryTask = secondaryTask;
m_ipf = CBOT_IPF;
@@ -2697,58 +2694,58 @@ CScript::CScript(CInstanceManager* iMan, CObject* object, CTaskManager** seconda
void CScript::InitFonctions()
{
- CBotProgram::AddFunction("sin", rSin, cOneFloat);
- CBotProgram::AddFunction("cos", rCos, cOneFloat);
- CBotProgram::AddFunction("tan", rTan, cOneFloat);
- CBotProgram::AddFunction("asin", raSin, cOneFloat);
- CBotProgram::AddFunction("acos", raCos, cOneFloat);
- CBotProgram::AddFunction("atan", raTan, cOneFloat);
- CBotProgram::AddFunction("sqrt", rSqrt, cOneFloat);
- CBotProgram::AddFunction("pow", rPow, cTwoFloat);
- CBotProgram::AddFunction("rand", rRand, cNull);
- CBotProgram::AddFunction("abs", rAbs, cOneFloat);
-
- CBotProgram::AddFunction("retobject", rRetObject, cRetObject);
- CBotProgram::AddFunction("search", rSearch, cSearch);
- CBotProgram::AddFunction("radar", rRadar, cRadar);
- CBotProgram::AddFunction("detect", rDetect, cDetect);
- CBotProgram::AddFunction("direction", rDirection, cDirection);
- CBotProgram::AddFunction("produce", rProduce, cProduce);
- CBotProgram::AddFunction("distance", rDistance, cDistance);
- CBotProgram::AddFunction("distance2d",rDistance2d,cDistance);
- CBotProgram::AddFunction("space", rSpace, cSpace);
- CBotProgram::AddFunction("flatground",rFlatGround,cFlatGround);
- CBotProgram::AddFunction("wait", rWait, cOneFloat);
- CBotProgram::AddFunction("move", rMove, cOneFloat);
- CBotProgram::AddFunction("turn", rTurn, cOneFloat);
- CBotProgram::AddFunction("goto", rGoto, cGoto);
- CBotProgram::AddFunction("find", rFind, cOneFloat);
- CBotProgram::AddFunction("grab", rGrab, cGrabDrop);
- CBotProgram::AddFunction("drop", rDrop, cGrabDrop);
- CBotProgram::AddFunction("sniff", rSniff, cNull);
- CBotProgram::AddFunction("receive", rReceive, cReceive);
- CBotProgram::AddFunction("send", rSend, cSend);
- CBotProgram::AddFunction("deleteinfo",rDeleteInfo,cDeleteInfo);
- CBotProgram::AddFunction("testinfo", rTestInfo, cTestInfo);
- CBotProgram::AddFunction("thump", rThump, cNull);
- CBotProgram::AddFunction("recycle", rRecycle, cNull);
- CBotProgram::AddFunction("shield", rShield, cShield);
- CBotProgram::AddFunction("fire", rFire, cFire);
- CBotProgram::AddFunction("aim", rAim, cOneFloat);
- CBotProgram::AddFunction("motor", rMotor, cMotor);
- CBotProgram::AddFunction("jet", rJet, cOneFloat);
- CBotProgram::AddFunction("topo", rTopo, cTopo);
- CBotProgram::AddFunction("message", rMessage, cMessage);
- CBotProgram::AddFunction("cmdline", rCmdline, cOneFloat);
- CBotProgram::AddFunction("ismovie", rIsMovie, cNull);
- CBotProgram::AddFunction("errmode", rErrMode, cOneFloat);
- CBotProgram::AddFunction("ipf", rIPF, cOneFloat);
- CBotProgram::AddFunction("abstime", rAbsTime, cNull);
- CBotProgram::AddFunction("deletefile",rDeleteFile,cString);
- CBotProgram::AddFunction("pendown", rPenDown, cPenDown);
- CBotProgram::AddFunction("penup", rPenUp, cNull);
- CBotProgram::AddFunction("pencolor", rPenColor, cOneFloat);
- CBotProgram::AddFunction("penwidth", rPenWidth, cOneFloat);
+ CBotProgram::AddFunction("sin", rSin, CScript::cOneFloat);
+ CBotProgram::AddFunction("cos", rCos, CScript::cOneFloat);
+ CBotProgram::AddFunction("tan", rTan, CScript::cOneFloat);
+ CBotProgram::AddFunction("asin", raSin, CScript::cOneFloat);
+ CBotProgram::AddFunction("acos", raCos, CScript::cOneFloat);
+ CBotProgram::AddFunction("atan", raTan, CScript::cOneFloat);
+ CBotProgram::AddFunction("sqrt", rSqrt, CScript::cOneFloat);
+ CBotProgram::AddFunction("pow", rPow, CScript::cTwoFloat);
+ CBotProgram::AddFunction("rand", rRand, CScript::cNull);
+ CBotProgram::AddFunction("abs", rAbs, CScript::cOneFloat);
+
+ CBotProgram::AddFunction("retobject", rGetObject, CScript::cGetObject);
+ CBotProgram::AddFunction("search", rSearch, CScript::cSearch);
+ CBotProgram::AddFunction("radar", rRadar, CScript::cRadar);
+ CBotProgram::AddFunction("detect", rDetect, CScript::cDetect);
+ CBotProgram::AddFunction("direction", rDirection, CScript::cDirection);
+ CBotProgram::AddFunction("produce", rProduce, CScript::cProduce);
+ CBotProgram::AddFunction("distance", rDistance, CScript::cDistance);
+ CBotProgram::AddFunction("distance2d",rDistance2d,CScript::cDistance);
+ CBotProgram::AddFunction("space", rSpace, CScript::cSpace);
+ CBotProgram::AddFunction("flatground",rFlatGround,CScript::cFlatGround);
+ CBotProgram::AddFunction("wait", rWait, CScript::cOneFloat);
+ CBotProgram::AddFunction("move", rMove, CScript::cOneFloat);
+ CBotProgram::AddFunction("turn", rTurn, CScript::cOneFloat);
+ CBotProgram::AddFunction("goto", rGoto, CScript::cGoto);
+ CBotProgram::AddFunction("find", rFind, CScript::cOneFloat);
+ CBotProgram::AddFunction("grab", rGrab, CScript::cGrabDrop);
+ CBotProgram::AddFunction("drop", rDrop, CScript::cGrabDrop);
+ CBotProgram::AddFunction("sniff", rSniff, CScript::cNull);
+ CBotProgram::AddFunction("receive", rReceive, CScript::cReceive);
+ CBotProgram::AddFunction("send", rSend, CScript::cSend);
+ CBotProgram::AddFunction("deleteinfo",rDeleteInfo,CScript::cDeleteInfo);
+ CBotProgram::AddFunction("testinfo", rTestInfo, CScript::cTestInfo);
+ CBotProgram::AddFunction("thump", rThump, CScript::cNull);
+ CBotProgram::AddFunction("recycle", rRecycle, CScript::cNull);
+ CBotProgram::AddFunction("shield", rShield, CScript::cShield);
+ CBotProgram::AddFunction("fire", rFire, CScript::cFire);
+ CBotProgram::AddFunction("aim", rAim, CScript::cOneFloat);
+ CBotProgram::AddFunction("motor", rMotor, CScript::cMotor);
+ CBotProgram::AddFunction("jet", rJet, CScript::cOneFloat);
+ CBotProgram::AddFunction("topo", rTopo, CScript::cTopo);
+ CBotProgram::AddFunction("message", rMessage, CScript::cMessage);
+ CBotProgram::AddFunction("cmdline", rCmdline, CScript::cOneFloat);
+ CBotProgram::AddFunction("ismovie", rIsMovie, CScript::cNull);
+ CBotProgram::AddFunction("errmode", rErrMode, CScript::cOneFloat);
+ CBotProgram::AddFunction("ipf", rIPF, CScript::cOneFloat);
+ CBotProgram::AddFunction("abstime", rAbsTime, CScript::cNull);
+ CBotProgram::AddFunction("deletefile",rDeleteFile,CScript::cString);
+ CBotProgram::AddFunction("pendown", rPenDown, CScript::cPenDown);
+ CBotProgram::AddFunction("penup", rPenUp, CScript::cNull);
+ CBotProgram::AddFunction("pencolor", rPenColor, CScript::cOneFloat);
+ CBotProgram::AddFunction("penwidth", rPenWidth, CScript::cOneFloat);
}
// Object's destructor.
@@ -2767,7 +2764,7 @@ CScript::~CScript()
// Gives the script editable block of text.
-void CScript::PutScript(CEdit* edit, char* name)
+void CScript::PutScript(Ui::CEdit* edit, char* name)
{
if ( m_script == 0 )
{
@@ -2784,15 +2781,15 @@ void CScript::PutScript(CEdit* edit, char* name)
// The script takes a paved text.
-bool CScript::GetScript(CEdit* edit)
+bool CScript::GetScript(Ui::CEdit* edit)
{
int len;
delete m_script;
m_script = 0;
- len = edit->RetTextLength();
- m_script = (char*)malloc(sizeof(char)*(len+1));
+ len = edit->GetTextLength();
+ m_script = static_cast<char*>(malloc(sizeof(char)*(len+1)));
edit->GetText(m_script, len+1);
edit->GetCursor(m_cursor2, m_cursor1);
@@ -2819,7 +2816,7 @@ bool CScript::GetScript(CEdit* edit)
// Indicates whether a program is compiled correctly.
-bool CScript::RetCompile()
+bool CScript::GetCompile()
{
return m_bCompile;
}
@@ -2846,17 +2843,17 @@ bool CScript::CheckToken()
CBotToken* bt;
CBotString bs;
const char* token;
- int error, type, cursor1, cursor2, i;
+ int error, cursor1, cursor2, i;
char used[100];
- if ( !m_object->RetCheckToken() ) return true;
+ if ( !m_object->GetCheckToken() ) return true;
m_error = 0;
m_title[0] = 0;
m_token[0] = 0;
m_bCompile = false;
- for ( i=0 ; i<m_main->RetObligatoryToken() ; i++ )
+ for ( i=0 ; i<m_main->GetObligatoryToken() ; i++ )
{
used[i] = 0; // token not used
}
@@ -2864,20 +2861,19 @@ bool CScript::CheckToken()
bt = CBotToken::CompileTokens(m_script, error);
while ( bt != 0 )
{
- bs = bt->GivString();
+ bs = bt->GetString();
token = bs;
- type = bt->GivType();
- cursor1 = bt->GivStart();
- cursor2 = bt->GivEnd();
+ cursor1 = bt->GetStart();
+ cursor2 = bt->GetEnd();
- i = m_main->IsObligatoryToken((char*)token);
+ i = m_main->IsObligatoryToken(token);
if ( i != -1 )
{
used[i] = 1; // token used
}
- if ( !m_main->IsProhibitedToken((char*)token) )
+ if ( !m_main->IsProhibitedToken(token) )
{
m_error = ERR_PROHIBITEDTOKEN;
m_cursor1 = cursor1;
@@ -2887,15 +2883,15 @@ bool CScript::CheckToken()
return false;
}
- bt = bt->GivNext();
+ bt = bt->GetNext();
}
// At least once every obligatory instruction?
- for ( i=0 ; i<m_main->RetObligatoryToken() ; i++ )
+ for ( i=0 ; i<m_main->GetObligatoryToken() ; i++ )
{
if ( used[i] == 0 ) // token not used?
{
- strcpy(m_token, m_main->RetObligatoryToken(i));
+ strcpy(m_token, m_main->GetObligatoryToken(i));
m_error = ERR_OBLIGATORYTOKEN;
strcpy(m_title, "<erreur>");
CBotToken::Delete(bt);
@@ -2930,12 +2926,12 @@ bool CScript::Compile()
if ( m_botProg == 0 )
{
- m_botProg = new CBotProgram(m_object->RetBotVar());
+ m_botProg = new CBotProgram(m_object->GetBotVar());
}
if ( m_botProg->Compile(m_script, liste, this) )
{
- if ( liste.GivSize() == 0 )
+ if ( liste.GetSize() == 0 )
{
strcpy(m_title, "<sans nom>");
}
@@ -3014,7 +3010,7 @@ bool CScript::Run()
if ( m_bStepMode ) // step by step mode?
{
Event newEvent;
- ZeroMemory(&newEvent, sizeof(Event));
+ memset(&newEvent, 0, sizeof(Event));
Step(newEvent);
}
@@ -3054,7 +3050,7 @@ bool CScript::Continue(const Event &event)
{
char s[100];
GetError(s);
- m_displayText->DisplayText(s, m_object, 10.0f, TT_ERROR);
+ m_displayText->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR);
}
m_engine->SetPause(true); // gives pause
return true;
@@ -3087,7 +3083,7 @@ bool CScript::Continue(const Event &event)
{
char s[100];
GetError(s);
- m_displayText->DisplayText(s, m_object, 10.0f, TT_ERROR);
+ m_displayText->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR);
}
return true;
}
@@ -3105,7 +3101,7 @@ bool CScript::Step(const Event &event)
if ( !m_bStepMode ) return false;
m_engine->SetPause(false);
- m_engine->StepSimul(0.01f); // advance of 10ms
+ m_engine->StepSimulation(0.01f); // advance of 10ms
m_engine->SetPause(true);
m_event = event;
@@ -3129,7 +3125,7 @@ bool CScript::Step(const Event &event)
{
char s[100];
GetError(s);
- m_displayText->DisplayText(s, m_object, 10.0f, TT_ERROR);
+ m_displayText->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR);
}
return true;
}
@@ -3201,7 +3197,7 @@ bool CScript::GetCursor(int &cursor1, int &cursor2)
// Put of the variables in a list.
-void PutList(char *baseName, bool bArray, CBotVar *var, CList *list, int &rankList)
+void PutList(const char *baseName, bool bArray, CBotVar *var, Ui::CList *list, int &rankList)
{
CBotString bs;
CBotVar *svar, *pStatic;
@@ -3221,13 +3217,13 @@ void PutList(char *baseName, bool bArray, CBotVar *var, CList *list, int &rankLi
while ( var != 0 )
{
var->Maj(NULL, false);
- pStatic = var->GivStaticVar(); // finds the static element
+ pStatic = var->GetStaticVar(); // finds the static element
- bs = pStatic->GivName(); // variable name
+ bs = pStatic->GetName(); // variable name
p = bs;
//? if ( strcmp(p, "this") == 0 )
//? {
-//? var = var->GivNext();
+//? var = var->GetNext();
//? continue;
//? }
@@ -3247,12 +3243,12 @@ void PutList(char *baseName, bool bArray, CBotVar *var, CList *list, int &rankLi
}
}
- type = pStatic->GivType();
+ type = pStatic->GetType();
if ( type < CBotTypBoolean )
{
CBotString value;
- value = pStatic->GivValString();
+ value = pStatic->GetValString();
p = value;
sprintf(buffer, "%s = %s;", varName, p);
list->SetName(rankList++, buffer);
@@ -3260,20 +3256,20 @@ void PutList(char *baseName, bool bArray, CBotVar *var, CList *list, int &rankLi
else if ( type == CBotTypString )
{
CBotString value;
- value = pStatic->GivValString();
+ value = pStatic->GetValString();
p = value;
sprintf(buffer, "%s = \"%s\";", varName, p);
list->SetName(rankList++, buffer);
}
else if ( type == CBotTypArrayPointer )
{
- svar = pStatic->GivItemList();
+ svar = pStatic->GetItemList();
PutList(varName, true, svar, list, rankList);
}
else if ( type == CBotTypClass ||
type == CBotTypPointer )
{
- svar = pStatic->GivItemList();
+ svar = pStatic->GetItemList();
PutList(varName, false, svar, list, rankList);
}
else
@@ -3283,13 +3279,13 @@ void PutList(char *baseName, bool bArray, CBotVar *var, CList *list, int &rankLi
}
index ++;
- var = var->GivNext();
+ var = var->GetNext();
}
}
// Fills a list with variables.
-void CScript::UpdateList(CList* list)
+void CScript::UpdateList(Ui::CList* list)
{
CBotVar *var;
const char *progName, *funcName;
@@ -3297,8 +3293,8 @@ void CScript::UpdateList(CList* list)
if( m_botProg == 0 ) return;
- total = list->RetTotal();
- select = list->RetSelect();
+ total = list->GetTotal();
+ select = list->GetSelect();
list->Flush(); // empty list
m_botProg->GetRunPos(progName, cursor1, cursor2);
@@ -3308,70 +3304,71 @@ void CScript::UpdateList(CList* list)
rank = 0;
while ( true )
{
- var = m_botProg->GivStackVars(funcName, level--);
+ var = m_botProg->GetStackVars(funcName, level--);
if ( funcName != progName ) break;
PutList("", false, var, list, rank);
}
- if ( total == list->RetTotal() ) // same total?
+ if ( total == list->GetTotal() ) // same total?
{
list->SetSelect(select);
}
list->SetTooltip("");
- list->SetState(STATE_ENABLE);
+ list->SetState(Ui::STATE_ENABLE);
}
// Colorize the text according to syntax.
-void CScript::ColorizeScript(CEdit* edit)
+void CScript::ColorizeScript(Ui::CEdit* edit)
{
CBotToken* bt;
CBotString bs;
const char* token;
- int error, type, cursor1, cursor2, color;
+ int error, type, cursor1, cursor2;
+ Gfx::FontHighlight color;
edit->ClearFormat();
- bt = CBotToken::CompileTokens(edit->RetText(), error);
+ bt = CBotToken::CompileTokens(edit->GetText(), error);
while ( bt != 0 )
{
- bs = bt->GivString();
+ bs = bt->GetString();
token = bs;
- type = bt->GivType();
+ type = bt->GetType();
- cursor1 = bt->GivStart();
- cursor2 = bt->GivEnd();
+ cursor1 = bt->GetStart();
+ cursor2 = bt->GetEnd();
- color = 0;
+ color = Gfx::FONT_HIGHLIGHT_NONE;
if ( type >= TokenKeyWord && type < TokenKeyWord+100 )
{
- color = COLOR_TOKEN;
+ color = Gfx::FONT_HIGHLIGHT_TOKEN;
}
if ( type >= TokenKeyDeclare && type < TokenKeyDeclare+100 )
{
- color = COLOR_TYPE;
+ color = Gfx::FONT_HIGHLIGHT_TYPE;
}
if ( type >= TokenKeyVal && type < TokenKeyVal+100 )
{
- color = COLOR_CONST;
+ color = Gfx::FONT_HIGHLIGHT_CONST;
}
if ( type == TokenTypVar )
{
if ( IsType(token) )
{
- color = COLOR_TYPE;
+ color = Gfx::FONT_HIGHLIGHT_TYPE;
}
else if ( IsFunction(token) )
{
- color = COLOR_TOKEN;
+ color = Gfx::FONT_HIGHLIGHT_TOKEN;
}
}
if ( type == TokenTypDef )
{
- color = COLOR_CONST;
+ color =Gfx::FONT_HIGHLIGHT_CONST;
}
if ( cursor1 < cursor2 && color != 0 )
@@ -3379,7 +3376,7 @@ void CScript::ColorizeScript(CEdit* edit)
edit->SetFormat(cursor1, cursor2, color);
}
- bt = bt->GivNext();
+ bt = bt->GetNext();
}
CBotToken::Delete(bt);
@@ -3389,7 +3386,8 @@ void CScript::ColorizeScript(CEdit* edit)
// Seeks a token at random in a script.
// Returns the index of the start of the token found, or -1.
-int SearchToken(char* script, char* token)
+
+int SearchToken(char* script, const char* token)
{
int lScript, lToken, i, iFound;
int found[100];
@@ -3425,7 +3423,7 @@ void DeleteToken(char* script, int pos, int len)
// Inserts a token in a script.
-void InsertToken(char* script, int pos, char* token)
+void InsertToken(char* script, int pos, const char* token)
{
int lScript, lToken, i;
@@ -3446,7 +3444,7 @@ bool CScript::IntroduceVirus()
int found[11*2];
char* newScript;
- char* names[11*2] =
+ const char* names[11*2] =
{
"==", "!=",
"!=", "==",
@@ -3477,7 +3475,7 @@ bool CScript::IntroduceVirus()
start = found[i+1];
i = found[i+0];
- newScript = (char*)malloc(sizeof(char)*(m_len+strlen(names[i+1])+1));
+ newScript = static_cast<char*>(malloc(sizeof(char)*(m_len+strlen(names[i+1])+1)));
strcpy(newScript, m_script);
delete m_script;
m_script = newScript;
@@ -3493,7 +3491,7 @@ bool CScript::IntroduceVirus()
// Returns the number of the error.
-int CScript::RetError()
+int CScript::GetError()
{
return m_error;
}
@@ -3528,7 +3526,7 @@ void CScript::GetError(char* buffer)
// New program.
-void CScript::New(CEdit* edit, char* name)
+void CScript::New(Ui::CEdit* edit, char* name)
{
FILE *file = NULL;
char res[100];
@@ -3553,7 +3551,7 @@ void CScript::New(CEdit* edit, char* name)
}
else
{
- if ( edit->RetAutoIndent() )
+ if ( edit->GetAutoIndent() )
{
cursor1 = 20+strlen(text)+6;
cursor2 = cursor1; // cursor in { }
@@ -3569,7 +3567,7 @@ void CScript::New(CEdit* edit, char* name)
edit->ShowSelect();
edit->SetFocus(true);
- sf = m_main->RetScriptFile();
+ sf = m_main->GetScriptFile();
if ( sf[0] != 0 ) // Load an empty program specific?
{
strcpy(filename, "script\\");
@@ -3599,7 +3597,7 @@ void CScript::New(CEdit* edit, char* name)
continue;
}
- if ( buffer[i] == '\t' && edit->RetAutoIndent() )
+ if ( buffer[i] == '\t' && edit->GetAutoIndent() )
{
i ++;
continue;
@@ -3642,7 +3640,7 @@ void CScript::New(CEdit* edit, char* name)
bool CScript::SendScript(char* text)
{
m_len = strlen(text);
- m_script = (char*)malloc(sizeof(char)*(m_len+1));
+ m_script = static_cast<char*>(malloc(sizeof(char)*(m_len+1)));
strcpy(m_script, text);
if ( !CheckToken() ) return false;
if ( !Compile() ) return false;
@@ -3655,7 +3653,7 @@ bool CScript::SendScript(char* text)
bool CScript::ReadScript(char* filename)
{
FILE* file;
- CEdit* edit;
+ Ui::CEdit* edit;
char name[100];
if ( strchr(filename, '\\') == 0 )
@@ -3677,8 +3675,8 @@ bool CScript::ReadScript(char* filename)
m_script = 0;
edit = m_interface->CreateEdit(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 0, EVENT_EDIT9);
- edit->SetMaxChar(EDITSTUDIOMAX);
- edit->SetAutoIndent(m_engine->RetEditIndentMode());
+ edit->SetMaxChar(Ui::EDITSTUDIOMAX);
+ edit->SetAutoIndent(m_engine->GetEditIndentMode());
edit->ReadText(name);
GetScript(edit);
m_interface->DeleteControl(EVENT_EDIT9);
@@ -3689,7 +3687,7 @@ bool CScript::ReadScript(char* filename)
bool CScript::WriteScript(char* filename)
{
- CEdit* edit;
+ Ui::CEdit* edit;
char name[100];
if ( strchr(filename, '\\') == 0 )
@@ -3709,8 +3707,8 @@ bool CScript::WriteScript(char* filename)
}
edit = m_interface->CreateEdit(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 0, EVENT_EDIT9);
- edit->SetMaxChar(EDITSTUDIOMAX);
- edit->SetAutoIndent(m_engine->RetEditIndentMode());
+ edit->SetMaxChar(Ui::EDITSTUDIOMAX);
+ edit->SetAutoIndent(m_engine->GetEditIndentMode());
edit->SetText(m_script);
edit->WriteText(name);
m_interface->DeleteControl(EVENT_EDIT9);
@@ -3769,7 +3767,7 @@ void CScript::SetFilename(char *filename)
strcpy(m_filename, filename);
}
-char* CScript::RetFilename()
+char* CScript::GetFilename()
{
return m_filename;
}
diff --git a/src/script/script.h b/src/script/script.h
index 8b2ae0b..3cb1a85 100644
--- a/src/script/script.h
+++ b/src/script/script.h
@@ -22,20 +22,26 @@
#include <stdio.h>
#include "common/event.h"
+#include "CBot/CBotDll.h"
class CInstanceManager;
-class CD3DEngine;
-class CInterface;
-class CDisplayText;
-class CEdit;
-class CList;
class CObject;
class CTaskManager;
-class CBotProgram;
class CRobotMain;
+
+namespace Ui{
+class CDisplayText;
+class CEdit;
+class CInterface;
+class CList;
+} /* Ui */
+
+namespace Gfx {
+class CEngine;
class CTerrain;
class CWater;
+} /* Gfx */
@@ -47,9 +53,9 @@ public:
static void InitFonctions();
- void PutScript(CEdit* edit, char* name);
- bool GetScript(CEdit* edit);
- bool RetCompile();
+ void PutScript(Ui::CEdit* edit, char* name);
+ bool GetScript(Ui::CEdit* edit);
+ bool GetCompile();
void GetTitle(char* buffer);
@@ -61,14 +67,14 @@ public:
bool IsRunning();
bool IsContinue();
bool GetCursor(int &cursor1, int &cursor2);
- void UpdateList(CList* list);
- void ColorizeScript(CEdit* edit);
+ void UpdateList(Ui::CList* list);
+ void ColorizeScript(Ui::CEdit* edit);
bool IntroduceVirus();
- int RetError();
+ int GetError();
void GetError(char* buffer);
- void New(CEdit* edit, char* name);
+ void New(Ui::CEdit* edit, char* name);
bool SendScript(char* text);
bool ReadScript(char* filename);
bool WriteScript(char* filename);
@@ -77,42 +83,124 @@ public:
bool Compare(CScript* other);
void SetFilename(char *filename);
- char* RetFilename();
+ char* GetFilename();
protected:
bool IsEmpty();
bool CheckToken();
bool Compile();
-public:
- CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CInterface* m_interface;
- CDisplayText* m_displayText;
- CBotProgram* m_botProg;
- CRobotMain* m_main;
- CTerrain* m_terrain;
- CWater* m_water;
- CTaskManager* m_primaryTask;
- CTaskManager** m_secondaryTask;
- CObject* m_object;
-
- int m_ipf; // number of instructions/second
- int m_errMode; // what to do in case of error
- int m_len; // length of the script (without <0>)
- char* m_script; // script ends with <0>
- bool m_bRun; // program during execution?
- bool m_bStepMode; // step by step
- bool m_bContinue; // external function to continue
- bool m_bCompile; // compilation ok?
- char m_title[50]; // script title
- char m_filename[50]; // file name
- char m_token[50]; // missing instruction
- int m_error; // error (0=ok)
- int m_cursor1;
- int m_cursor2;
- Event m_event;
- float m_returnValue;
+private:
+
+ static CBotTypResult cNull(CBotVar* &var, void* user);
+ static CBotTypResult cOneFloat(CBotVar* &var, void* user);
+ static CBotTypResult cTwoFloat(CBotVar* &var, void* user);
+ static CBotTypResult cString(CBotVar* &var, void* user);
+ static CBotTypResult cGetObject(CBotVar* &var, void* user);
+ static CBotTypResult cSearch(CBotVar* &var, void* user);
+ static CBotTypResult cRadar(CBotVar* &var, void* user);
+ static CBotTypResult cDetect(CBotVar* &var, void* user);
+ static CBotTypResult cDirection(CBotVar* &var, void* user);
+ static CBotTypResult cProduce(CBotVar* &var, void* user);
+ static CBotTypResult cDistance(CBotVar* &var, void* user);
+ static CBotTypResult cSpace(CBotVar* &var, void* user);
+ static CBotTypResult cFlatGround(CBotVar* &var, void* user);
+ static CBotTypResult cGoto(CBotVar* &var, void* user);
+ static CBotTypResult cGrabDrop(CBotVar* &var, void* user);
+ static CBotTypResult cReceive(CBotVar* &var, void* user);
+ static CBotTypResult cSend(CBotVar* &var, void* user);
+ static CBotTypResult cDeleteInfo(CBotVar* &var, void* user);
+ static CBotTypResult cTestInfo(CBotVar* &var, void* user);
+ static CBotTypResult cShield(CBotVar* &var, void* user);
+ static CBotTypResult cFire(CBotVar* &var, void* user);
+ static CBotTypResult cMotor(CBotVar* &var, void* user);
+ static CBotTypResult cTopo(CBotVar* &var, void* user);
+ static CBotTypResult cMessage(CBotVar* &var, void* user);
+ static CBotTypResult cPenDown(CBotVar* &var, void* user);
+ static CBotTypResult cOnePoint(CBotVar* &var, void* user);
+ static CBotTypResult cPoint(CBotVar* &var, void* user);
+
+
+ static bool rSin(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rCos(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rTan(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rSqrt(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rPow(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rRand(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rAbs(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rGetObject(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rSearch(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rRadar(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rDetect(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rDirection(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rProduce(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rDistance(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rDistance2d(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rSpace(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rFlatGround(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rWait(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rMove(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rTurn(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rGoto(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rFind(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rGrab(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rDrop(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rSniff(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rReceive(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rSend(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rDeleteInfo(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rTestInfo(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rThump(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rRecycle(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rShield(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rFire(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rAim(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rMotor(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rJet(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rTopo(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rMessage(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rCmdline(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rIsMovie(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rErrMode(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rIPF(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rAbsTime(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rDeleteFile(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rPenDown(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rPenUp(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rPenColor(CBotVar* var, CBotVar* result, int& exception, void* user);
+ static bool rPenWidth(CBotVar* var, CBotVar* result, int& exception, void* user);
+
+ static bool Process(CScript* script, CBotVar* result, int &exception);
+ static CObject* SearchInfo(CScript* script, CObject* object, float power);
+
+ CInstanceManager* m_iMan;
+ Gfx::CEngine* m_engine;
+ Ui::CInterface* m_interface;
+ Ui::CDisplayText* m_displayText;
+ CBotProgram* m_botProg;
+ CRobotMain* m_main;
+ Gfx::CTerrain* m_terrain;
+ Gfx::CWater* m_water;
+ CTaskManager* m_primaryTask;
+ CTaskManager** m_secondaryTask;
+ CObject* m_object;
+
+ int m_ipf; // number of instructions/second
+ int m_errMode; // what to do in case of error
+ int m_len; // length of the script (without <0>)
+ char* m_script; // script ends with <0>
+ bool m_bRun; // program during execution?
+ bool m_bStepMode; // step by step
+ bool m_bContinue; // external function to continue
+ bool m_bCompile; // compilation ok?
+ char m_title[50]; // script title
+ char m_filename[50]; // file name
+ char m_token[50]; // missing instruction
+ int m_error; // error (0=ok)
+ int m_cursor1;
+ int m_cursor2;
+ Event m_event;
+ float m_returnValue;
};
diff --git a/src/ui/button.cpp b/src/ui/button.cpp
index 0147f63..1f11a0c 100644
--- a/src/ui/button.cpp
+++ b/src/ui/button.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -15,14 +16,15 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "common/language.h"
-#include "old/math3d.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
+//#include "common/language.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
@@ -30,15 +32,15 @@
#include "ui/button.h"
+namespace Ui {
const float DELAY1 = 0.4f;
const float DELAY2 = 0.1f;
-
// Object's constructor.
-CButton::CButton(CInstanceManager* iMan) : CControl(iMan)
+CButton::CButton() : CControl()
{
m_bCapture = false;
m_bImmediat = false;
@@ -55,18 +57,18 @@ CButton::~CButton()
// Creates a new button.
-bool CButton::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CButton::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
- CControl::Create(pos, dim, icon, eventMsg);
+ CControl::Create(pos, dim, icon, eventType);
if ( icon == -1 )
{
char name[100];
char* p;
- GetResource(RES_EVENT, eventMsg, name);
+ GetResource(RES_EVENT, eventType, name);
p = strchr(name, '\\');
if ( p != 0 ) *p = 0;
SetName(name);
@@ -85,7 +87,7 @@ bool CButton::EventProcess(const Event &event)
CControl::EventProcess(event);
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
if ( m_bRepeat && m_repeat != 0.0f )
{
@@ -95,14 +97,15 @@ bool CButton::EventProcess(const Event &event)
m_repeat = DELAY2;
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
return false;
}
}
}
- if ( event.event == EVENT_LBUTTONDOWN &&
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1 &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
@@ -114,25 +117,27 @@ bool CButton::EventProcess(const Event &event)
if ( m_bImmediat || m_bRepeat )
{
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
return false;
}
}
- if ( event.event == EVENT_MOUSEMOVE && m_bCapture )
+ if ( event.type == EVENT_MOUSE_MOVE && m_bCapture )
{
}
- if ( event.event == EVENT_LBUTTONUP && m_bCapture )
+ if ( event.type == EVENT_MOUSE_BUTTON_UP && //left
+ event.mouseButton.button == 1 &&
+ m_bCapture )
{
if ( CControl::Detect(event.pos) )
{
if ( !m_bImmediat && !m_bRepeat )
{
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
}
@@ -158,10 +163,10 @@ void CButton::Draw()
if ( m_state & STATE_WARNING ) // shading yellow-black?
{
- pos.x = m_pos.x-( 8.0f/640.0f);
- pos.y = m_pos.y-( 4.0f/480.0f);
- dim.x = m_dim.x+(16.0f/640.0f);
- dim.y = m_dim.y+( 8.0f/480.0f);
+ pos.x = m_pos.x - ( 8.0f / 640.0f);
+ pos.y = m_pos.y - ( 4.0f / 480.0f);
+ dim.x = m_dim.x + (16.0f / 640.0f);
+ dim.y = m_dim.y + ( 8.0f / 480.0f);
if ( m_state & STATE_SHADOW )
{
DrawShadow(pos, dim);
@@ -182,19 +187,19 @@ void CButton::Draw()
(m_state & STATE_SIMPLY) == 0 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- dp = 0.5f/256.0f;
+ dp = 0.5f / 256.0f;
- uv1.x = 128.0f/256.0f;
- uv1.y = 96.0f/256.0f;
- uv2.x = 136.0f/256.0f;
- uv2.y = 128.0f/256.0f;
+ uv1.x = 128.0f / 256.0f;
+ uv1.y = 96.0f / 256.0f;
+ uv2.x = 136.0f / 256.0f;
+ uv2.y = 128.0f / 256.0f;
if ( (m_state & STATE_ENABLE) == 0 )
{
- uv1.x += 16.0f/256.0f;
- uv2.x += 16.0f/256.0f;
+ uv1.x += 16.0f / 256.0f;
+ uv2.x += 16.0f / 256.0f;
}
uv1.x += dp;
@@ -202,15 +207,15 @@ void CButton::Draw()
uv2.x -= dp;
uv2.y -= dp;
- pos.y = m_pos.y+5.0f/480.0f;
- dim.y = m_dim.y-10.0f/480.0f;
- pos.x = m_pos.x+5.0f/640.0f;
- dim.x = 3.0f/640.0f;
+ pos.y = m_pos.y + 5.0f / 480.0f;
+ dim.y = m_dim.y - 10.0f / 480.0f;
+ pos.x = m_pos.x + 5.0f / 640.0f;
+ dim.x = 3.0f / 640.0f;
DrawIcon(pos, dim, uv1, uv2, 0.0f);
- uv1.x += 8.0f/256.0f;
- uv2.x += 8.0f/256.0f;
- pos.x = m_pos.x+m_dim.x-5.0f/640.0f-3.0f/640.0f;
+ uv1.x += 8.0f / 256.0f;
+ uv2.x += 8.0f / 256.0f;
+ pos.x = m_pos.x + m_dim.x - 5.0f / 640.0f - 3.0f / 640.0f;
DrawIcon(pos, dim, uv1, uv2, 0.0f);
}
#endif
@@ -225,7 +230,7 @@ void CButton::SetImmediat(bool bImmediat)
m_bImmediat = bImmediat;
}
-bool CButton::RetImmediat()
+bool CButton::GetImmediat()
{
return m_bImmediat;
}
@@ -239,8 +244,9 @@ void CButton::SetRepeat(bool bRepeat)
m_bRepeat = bRepeat;
}
-bool CButton::RetRepeat()
+bool CButton::GetRepeat()
{
return m_bRepeat;
}
+}
diff --git a/src/ui/button.h b/src/ui/button.h
index 0a05b11..924a4d8 100644
--- a/src/ui/button.h
+++ b/src/ui/button.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -21,28 +22,28 @@
#include "ui/control.h"
+namespace Gfx{
+class CEngine;
+}
-class CD3DEngine;
-
-
-
+namespace Ui {
class CButton : public CControl
{
public:
- CButton(CInstanceManager* iMan);
+ CButton();
virtual ~CButton();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
bool EventProcess(const Event &event);
void Draw();
void SetImmediat(bool bRepeat);
- bool RetImmediat();
+ bool GetImmediat();
void SetRepeat(bool bRepeat);
- bool RetRepeat();
+ bool GetRepeat();
protected:
@@ -53,4 +54,4 @@ protected:
float m_repeat;
};
-
+}
diff --git a/src/ui/check.cpp b/src/ui/check.cpp
index 18c7633..b4ddf4a 100644
--- a/src/ui/check.cpp
+++ b/src/ui/check.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -15,26 +16,28 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
#include "common/restext.h"
-#include "old/text.h"
+//#include "old/text.h"
+#include "graphics/engine/text.h"
#include "ui/check.h"
-
+namespace Ui {
// Object's constructor.
-CCheck::CCheck(CInstanceManager* iMan) : CControl(iMan)
+CCheck::CCheck() : CControl()
{
}
@@ -47,16 +50,16 @@ CCheck::~CCheck()
// Creates a new button.
-bool CCheck::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CCheck::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
char name[100];
char* p;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
- CControl::Create(pos, dim, icon, eventMsg);
+ CControl::Create(pos, dim, icon, eventType);
- GetResource(RES_EVENT, eventMsg, name);
+ GetResource(RES_EVENT, eventType, name);
p = strchr(name, '\\');
if ( p != 0 ) *p = 0;
SetName(name);
@@ -73,14 +76,15 @@ bool CCheck::EventProcess(const Event &event)
CControl::EventProcess(event);
- if ( event.event == EVENT_LBUTTONDOWN &&
- (m_state & STATE_VISIBLE) &&
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1 &&
+ (m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
if ( CControl::Detect(event.pos) )
{
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
return false;
}
@@ -101,7 +105,7 @@ void CCheck::Draw()
if ( (m_state & STATE_VISIBLE) == 0 ) return;
iDim = m_dim;
- m_dim.x = m_dim.y*0.75f; // square
+ m_dim.x = m_dim.y * 0.75f; // square
if ( m_state & STATE_SHADOW )
{
@@ -109,7 +113,7 @@ void CCheck::Draw()
}
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
zoomExt = 1.00f;
zoomInt = 0.95f;
@@ -143,7 +147,7 @@ void CCheck::Draw()
if ( (m_state & STATE_DEAD) == 0 )
{
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
if ( m_state & STATE_CHECK )
{
@@ -157,10 +161,10 @@ void CCheck::Draw()
if ( m_state & STATE_DEAD ) return;
// Draw the name.
- pos.x = m_pos.x+m_dim.y/0.9f;
- pos.y = m_pos.y+m_dim.y*0.50f;
- pos.y -= m_engine->RetText()->RetHeight(m_fontSize, m_fontType)/2.0f;
- m_engine->RetText()->DrawText(m_name, pos, m_dim.x, 1, m_fontSize, m_fontStretch, m_fontType, 0);
+ pos.x = m_pos.x + m_dim.y / 0.9f;
+ pos.y = m_pos.y + m_dim.y * 0.50f;
+ pos.y -= m_engine->GetText()->GetHeight(m_fontType, m_fontSize)/2.0f;
+ m_engine->GetText()->DrawText(m_name, m_fontType, m_fontSize, pos, m_dim.x, m_textAlign, 0);
}
-
+}
diff --git a/src/ui/check.h b/src/ui/check.h
index 24c58f3..0b6a1f2 100644
--- a/src/ui/check.h
+++ b/src/ui/check.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -21,18 +22,18 @@
#include "ui/control.h"
+namespace Gfx{
+class CEngine;
+}
-class CD3DEngine;
-
-
-
+namespace Ui {
class CCheck : public CControl
{
public:
- CCheck(CInstanceManager* iMan);
+ CCheck();
virtual ~CCheck();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
bool EventProcess(const Event &event);
@@ -43,4 +44,5 @@ protected:
protected:
};
+}
diff --git a/src/ui/color.cpp b/src/ui/color.cpp
index 1038343..2d463b5 100644
--- a/src/ui/color.cpp
+++ b/src/ui/color.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -15,14 +16,16 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "common/language.h"
-#include "old/math3d.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
+#include "graphics/core/device.h"
+//#include "common/language.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
@@ -30,7 +33,7 @@
#include "ui/color.h"
-
+namespace Ui {
const float DELAY1 = 0.4f;
const float DELAY2 = 0.1f;
@@ -38,7 +41,8 @@ const float DELAY2 = 0.1f;
// Object's constructor.
-CColor::CColor(CInstanceManager* iMan) : CControl(iMan)
+//CColor::CColor(CInstanceManager* iMan) : CControl(iMan)
+CColor::CColor() : CControl()
{
m_bRepeat = false;
m_repeat = 0.0f;
@@ -58,18 +62,18 @@ CColor::~CColor()
// Creates a new button.
-bool CColor::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CColor::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
- CControl::Create(pos, dim, icon, eventMsg);
+ CControl::Create(pos, dim, icon, eventType);
if ( icon == -1 )
{
char name[100];
char* p;
- GetResource(RES_EVENT, eventMsg, name);
+ GetResource(RES_EVENT, eventType, name);
p = strchr(name, '\\');
if ( p != 0 ) *p = 0;
SetName(name);
@@ -87,7 +91,7 @@ bool CColor::EventProcess(const Event &event)
CControl::EventProcess(event);
- if ( event.event == EVENT_FRAME && m_bRepeat )
+ if ( event.type == EVENT_FRAME && m_bRepeat )
{
if ( m_repeat != 0.0f )
{
@@ -97,14 +101,15 @@ bool CColor::EventProcess(const Event &event)
m_repeat = DELAY2;
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
return false;
}
}
}
- if ( event.event == EVENT_LBUTTONDOWN &&
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1 &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
@@ -113,13 +118,13 @@ bool CColor::EventProcess(const Event &event)
m_repeat = DELAY1;
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
return false;
}
}
- if ( event.event == EVENT_LBUTTONUP )
+ if ( event.type == EVENT_MOUSE_BUTTON_UP && event.mouseButton.button == 1)
{
m_repeat = 0.0f;
}
@@ -132,9 +137,9 @@ bool CColor::EventProcess(const Event &event)
void CColor::Draw()
{
- LPDIRECT3DDEVICE7 device;
- D3DLVERTEX vertex[4]; // 2 triangles
- D3DCOLOR color;
+ Gfx::CDevice* device;
+ Gfx::VertexCol vertex[4]; // 2 triangles
+ Gfx::Color color;
Math::Point p1, p2;
if ( (m_state & STATE_VISIBLE) == 0 ) return;
@@ -145,56 +150,57 @@ void CColor::Draw()
}
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
CControl::Draw();
#if _TEEN
- color = ::RetColor(m_color);
+// color = GetColor(m_color);
+ color = GetColor();
m_engine->SetTexture("xxx.tga"); // no texture
- m_engine->SetState(D3DSTATENORMAL);
-
- device = m_engine->RetD3DDevice();
-
- p1.x = m_pos.x+(4.0f/640.0f);
- p1.y = m_pos.y+(4.0f/480.0f);
- p2.x = m_pos.x+m_dim.x-(4.0f/640.0f);
- p2.y = m_pos.y+m_dim.y-(4.0f/480.0f);
- vertex[0] = D3DLVERTEX(D3DVECTOR(p1.x, p1.y, 0.0f), 0x00000000,0x00000000, 0.0f,0.0f);
- vertex[1] = D3DLVERTEX(D3DVECTOR(p1.x, p2.y, 0.0f), 0x00000000,0x00000000, 0.0f,0.0f);
- vertex[2] = D3DLVERTEX(D3DVECTOR(p2.x, p1.y, 0.0f), 0x00000000,0x00000000, 0.0f,0.0f);
- vertex[3] = D3DLVERTEX(D3DVECTOR(p2.x, p2.y, 0.0f), 0x00000000,0x00000000, 0.0f,0.0f);
- device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_LVERTEX, vertex, 4, NULL);
-
- p1.x = m_pos.x+(5.0f/640.0f);
- p1.y = m_pos.y+(5.0f/480.0f);
- p2.x = m_pos.x+m_dim.x-(5.0f/640.0f);
- p2.y = m_pos.y+m_dim.y-(5.0f/480.0f);
- vertex[0] = D3DLVERTEX(D3DVECTOR(p1.x, p1.y, 0.0f), color,0x00000000, 0.0f,0.0f);
- vertex[1] = D3DLVERTEX(D3DVECTOR(p1.x, p2.y, 0.0f), color,0x00000000, 0.0f,0.0f);
- vertex[2] = D3DLVERTEX(D3DVECTOR(p2.x, p1.y, 0.0f), color,0x00000000, 0.0f,0.0f);
- vertex[3] = D3DLVERTEX(D3DVECTOR(p2.x, p2.y, 0.0f), color,0x00000000, 0.0f,0.0f);
- device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_LVERTEX, vertex, 4, NULL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+
+ device = m_engine->GetDevice();
+
+ p1.x = m_pos.x + (4.0f / 640.0f);
+ p1.y = m_pos.y + (4.0f / 480.0f);
+ p2.x = m_pos.x + m_dim.x - (4.0f / 640.0f);
+ p2.y = m_pos.y + m_dim.y - (4.0f / 480.0f);
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
+ vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
+ vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), 0x00000000,0x00000000, Math::Point( 0.0f, 0.0f));
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
+
+ p1.x = m_pos.x + (5.0f / 640.0f);
+ p1.y = m_pos.y + (5.0f / 480.0f);
+ p2.x = m_pos.x + m_dim.x - (5.0f / 640.0f);
+ p2.y = m_pos.y + m_dim.y - (5.0f / 480.0f);
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
+ vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
+ vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), color,0x00000000, Math::Point( 0.0f, 0.0f));
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(4);
#else
- p1.x = m_pos.x+(3.0f/640.0f);
- p1.y = m_pos.y+(3.0f/480.0f);
- p2.x = m_pos.x+m_dim.x-(3.0f/640.0f);
- p2.y = m_pos.y+m_dim.y-(3.0f/480.0f);
+ p1.x = m_pos.x + (3.0f / 640.0f);
+ p1.y = m_pos.y + (3.0f / 480.0f);
+ p2.x = m_pos.x + m_dim.x - (3.0f / 640.0f);
+ p2.y = m_pos.y + m_dim.y - (3.0f / 480.0f);
- color = ::RetColor(m_color);
+ color = GetColor();
m_engine->SetTexture("xxx.tga"); // no texture
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- vertex[0] = D3DLVERTEX(D3DVECTOR(p1.x, p1.y, 0.0f), color,0x00000000, 0.0f,0.0f);
- vertex[1] = D3DLVERTEX(D3DVECTOR(p1.x, p2.y, 0.0f), color,0x00000000, 0.0f,0.0f);
- vertex[2] = D3DLVERTEX(D3DVECTOR(p2.x, p1.y, 0.0f), color,0x00000000, 0.0f,0.0f);
- vertex[3] = D3DLVERTEX(D3DVECTOR(p2.x, p2.y, 0.0f), color,0x00000000, 0.0f,0.0f);
+ vertex[0] = Gfx::VertexCol(Math::Vector(p1.x, p1.y, 0.0f), color,0x00000000, Math::Point(0.0f, 0.0f));
+ vertex[1] = Gfx::VertexCol(Math::Vector(p1.x, p2.y, 0.0f), color,0x00000000, Math::Point(0.0f, 0.0f));
+ vertex[2] = Gfx::VertexCol(Math::Vector(p2.x, p1.y, 0.0f), color,0x00000000, Math::Point(0.0f, 0.0f));
+ vertex[3] = Gfx::VertexCol(Math::Vector(p2.x, p2.y, 0.0f), color,0x00000000, Math::Point(0.0f, 0.0f));
- device = m_engine->RetD3DDevice();
- device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_LVERTEX, vertex, 4, NULL);
+ device = m_engine->GetDevice();
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2);
#endif
}
@@ -205,20 +211,21 @@ void CColor::SetRepeat(bool bRepeat)
m_bRepeat = bRepeat;
}
-bool CColor::RetRepeat()
+bool CColor::GetRepeat()
{
return m_bRepeat;
}
-void CColor::SetColor(D3DCOLORVALUE color)
+void CColor::SetColor(Gfx::Color color)
{
m_color = color;
}
-D3DCOLORVALUE CColor::RetColor()
+Gfx::Color CColor::GetColor()
{
return m_color;
}
+}
diff --git a/src/ui/color.h b/src/ui/color.h
index 41052a7..2666f94 100644
--- a/src/ui/color.h
+++ b/src/ui/color.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -20,37 +21,40 @@
#include "ui/control.h"
-#include "old/d3dengine.h"
-
-
-class CD3DEngine;
-
+//#include "graphics/engine/engine.h"
+namespace Gfx{
+class CEngine;
+struct Color;
+}
+namespace Ui {
class CColor : public CControl
{
public:
- CColor(CInstanceManager* iMan);
- virtual ~CColor();
+// CColor(CInstanceManager* iMan);
+ CColor();
+ virtual ~CColor();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
- bool EventProcess(const Event &event);
+ bool EventProcess(const Event &event);
- void Draw();
+ void Draw();
- void SetRepeat(bool bRepeat);
- bool RetRepeat();
+ void SetRepeat(bool bRepeat);
+ bool GetRepeat();
- void SetColor(D3DCOLORVALUE color);
- D3DCOLORVALUE RetColor();
+ void SetColor(Gfx::Color color);
+ Gfx::Color GetColor();
protected:
protected:
- bool m_bRepeat;
- float m_repeat;
- D3DCOLORVALUE m_color;
+ bool m_bRepeat;
+ float m_repeat;
+ Gfx::Color m_color;
};
+}
diff --git a/src/ui/compass.cpp b/src/ui/compass.cpp
index 7ea6e9d..95e75b3 100644
--- a/src/ui/compass.cpp
+++ b/src/ui/compass.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -15,14 +16,16 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
+//#include "common/struct.h"
#include "math/geometry.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
+#include "graphics/core/device.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
@@ -30,10 +33,11 @@
-
+namespace Ui {
// Object's constructor.
-CCompass::CCompass(CInstanceManager* iMan) : CControl(iMan)
+//CCompass::CCompass(CInstanceManager* iMan) : CControl(iMan)
+CCompass::CCompass() : CControl()
{
m_dir = 0.0f;
}
@@ -47,11 +51,11 @@ CCompass::~CCompass()
// Creates a new button.
-bool CCompass::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CCompass::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
- CControl::Create(pos, dim, icon, eventMsg);
+ CControl::Create(pos, dim, icon, eventType);
return true;
}
@@ -62,12 +66,13 @@ bool CCompass::EventProcess(const Event &event)
{
CControl::EventProcess(event);
- if ( event.event == EVENT_LBUTTONDOWN )
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1)
{
if ( CControl::Detect(event.pos) )
{
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
return false;
}
@@ -81,33 +86,33 @@ bool CCompass::EventProcess(const Event &event)
void CCompass::Draw()
{
- LPDIRECT3DDEVICE7 device;
- D3DVERTEX2 vertex[4]; // 2 triangles
- Math::Point p1, p2, p3, c, uv1, uv2;
- Math::Vector n;
- float dp;
+ Gfx::CDevice* device;
+ Gfx::Vertex vertex[4]; // 2 triangles
+ Math::Point p1, p2, p3, c, uv1, uv2;
+ Math::Vector n;
+ float dp;
if ( (m_state & STATE_VISIBLE) == 0 ) return;
- device = m_engine->RetD3DDevice();
+ device = m_engine->GetDevice();
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
p1.x = m_pos.x;
p1.y = m_pos.y;
p2.x = m_pos.x + m_dim.x;
p2.y = m_pos.y + m_dim.y;
- c.x = (p1.x+p2.x)/2.0f;
- c.y = (p1.y+p2.y)/2.0f; // center
+ c.x = (p1.x + p2.x) / 2.0f;
+ c.y = (p1.y + p2.y) / 2.0f; // center
- uv1.x = 64.0f/256.0f;
- uv1.y = 32.0f/256.0f;
- uv2.x = 96.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ uv1.x = 64.0f / 256.0f;
+ uv1.y = 32.0f / 256.0f;
+ uv2.x = 96.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
- dp = 0.5f/256.0f;
+ dp = 0.5f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -115,46 +120,46 @@ void CCompass::Draw()
n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
- vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x,uv2.y);
- vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, uv1.x,uv1.y);
- vertex[2] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, uv2.x,uv2.y);
- vertex[3] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv2.x,uv1.y);
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x, uv2.y));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(uv1.x, uv1.y));
+ vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(uv2.x, uv2.y));
+ vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv2.x, uv1.y));
- device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 4, NULL);
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2);
if ( m_state & STATE_ENABLE )
{
p1.x = c.x;
- p1.y = c.y+m_dim.x*0.40f;
+ p1.y = c.y + m_dim.x * 0.40f;
p1 = Math::RotatePoint(c, m_dir, p1);
- p1.x = c.x+(p1.x-c.x)*(m_dim.x/m_dim.y);
+ p1.x = c.x + (p1.x - c.x) * (m_dim.x / m_dim.y);
- p2.x = c.x+m_dim.x*0.20f;
- p2.y = c.y-m_dim.x*0.40f;
+ p2.x = c.x + m_dim.x * 0.20f;
+ p2.y = c.y - m_dim.x * 0.40f;
p2 = Math::RotatePoint(c, m_dir, p2);
- p2.x = c.x+(p2.x-c.x)*(m_dim.x/m_dim.y);
+ p2.x = c.x + (p2.x - c.x) * (m_dim.x / m_dim.y);
- p3.x = c.x-m_dim.x*0.20f;
- p3.y = c.y-m_dim.x*0.40f;
+ p3.x = c.x - m_dim.x * 0.20f;
+ p3.y = c.y - m_dim.x * 0.40f;
p3 = Math::RotatePoint(c, m_dir, p3);
- p3.x = c.x+(p3.x-c.x)*(m_dim.x/m_dim.y);
+ p3.x = c.x + (p3.x - c.x) * (m_dim.x / m_dim.y);
- uv1.x = 96.0f/256.0f;
- uv1.y = 32.0f/256.0f;
- uv2.x = 104.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ uv1.x = 96.0f / 256.0f;
+ uv1.y = 32.0f / 256.0f;
+ uv2.x = 104.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x,uv1.y);
- vertex[1] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv1.x,uv2.y);
- vertex[2] = D3DVERTEX2(Math::Vector(p3.x, p3.y, 0.0f), n, uv2.x,uv2.y);
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x, uv1.y));
+ vertex[1] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv1.x, uv2.y));
+ vertex[2] = Gfx::Vertex(Math::Vector(p3.x, p3.y, 0.0f), n, Math::Point(uv2.x, uv2.y));
- device->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_VERTEX2, vertex, 3, NULL);
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLES, vertex, 3);
m_engine->AddStatisticTriangle(1);
}
}
@@ -167,9 +172,10 @@ void CCompass::SetDirection(float dir)
m_dir = dir;
}
-float CCompass::RetDirection()
+float CCompass::GetDirection()
{
return m_dir;
}
+}
diff --git a/src/ui/compass.h b/src/ui/compass.h
index 0014f3d..1d48907 100644
--- a/src/ui/compass.h
+++ b/src/ui/compass.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -21,25 +22,26 @@
#include "ui/control.h"
+namespace Gfx {
+class CEngine;
+}
-class CD3DEngine;
-
-
-
+namespace Ui {
class CCompass : public CControl
{
public:
- CCompass(CInstanceManager* iMan);
+// CCompass(CInstanceManager* iMan);
+ CCompass();
virtual ~CCompass();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
bool EventProcess(const Event &event);
void Draw();
void SetDirection(float dir);
- float RetDirection();
+ float GetDirection();
protected:
@@ -48,3 +50,4 @@ protected:
};
+}
diff --git a/src/ui/control.cpp b/src/ui/control.cpp
index 6ff7c2f..6adaac2 100644
--- a/src/ui/control.cpp
+++ b/src/ui/control.cpp
@@ -1,6 +1,7 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
-// *
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
+//
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
// * the Free Software Foundation, either version 3 of the License, or
@@ -15,45 +16,50 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <windows.h>
+//#include <windows.h>
#include <stdio.h>
-#include <d3d.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
+#include "graphics/core/device.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
#include "common/language.h"
#include "common/restext.h"
-#include "old/math3d.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "object/robotmain.h"
-#include "old/particule.h"
-#include "common/misc.h"
+//#include "old/particule.h"
+#include "graphics/engine/particle.h"
#include "common/iman.h"
-#include "old/text.h"
-#include "old/sound.h"
+//#include "old/text.h"
+#include "graphics/engine/text.h"
+//#include "old/sound.h"
+#include "sound/sound.h"
#include "ui/control.h"
-
+namespace Ui {
// Object's constructor.
-CControl::CControl(CInstanceManager* iMan)
+CControl::CControl()
{
- m_iMan = iMan;
+ m_iMan = CInstanceManager::GetInstancePointer();
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_event = (CEvent*)m_iMan->SearchInstance(CLASS_EVENT);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
- m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
- m_eventMsg = EVENT_NULL;
+ m_engine = static_cast< Gfx::CEngine* > ( m_iMan->SearchInstance(CLASS_ENGINE) );
+ m_event = static_cast< CEventQueue* > ( m_iMan->SearchInstance(CLASS_EVENT) );
+ m_main = static_cast< CRobotMain* > ( m_iMan->SearchInstance(CLASS_MAIN) );
+ m_particle = static_cast< Gfx::CParticle* > (m_iMan->SearchInstance(CLASS_PARTICULE));
+ m_sound = static_cast< CSoundInterface* > (m_iMan->SearchInstance(CLASS_SOUND));
+ m_eventType = EVENT_NULL;
m_state = STATE_ENABLE|STATE_VISIBLE|STATE_GLINT;
- m_fontSize = SMALLFONT;
- m_fontStretch = NORMSTRETCH;
- m_fontType = FONT_COLOBOT;
- m_justif = 0;
+ m_fontSize = Gfx::FONT_SIZE_SMALL;
+// m_fontStretch = Gfx::FONT_NORM_STRETCH; //there is font stretching no more master
+ m_fontType = Gfx::FONT_COLOBOT;
+ m_textAlign = Gfx::TEXT_ALIGN_CENTER; //instead m_justify
+// m_justif = 0;
m_name[0] = 0;
m_tooltip[0] = 0;
m_bFocus = false;
@@ -76,23 +82,23 @@ CControl::~CControl()
// Creates a new button.
// pos: [0..1]
-bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
char text[100];
char* p;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
m_pos = pos;
m_dim = dim;
m_icon = icon;
- m_eventMsg = eventMsg;
+ m_eventType = eventType;
pos.x = m_pos.x;
- pos.y = m_pos.y+m_dim.y;
+ pos.y = m_pos.y + m_dim.y;
GlintCreate(pos);
- GetResource(RES_EVENT, m_eventMsg, text);
+ GetResource(RES_EVENT, m_eventType, text);
p = strchr(text, '\\');
if ( p == 0 )
{
@@ -115,11 +121,11 @@ void CControl::SetPos(Math::Point pos)
m_pos = pos;
pos.x = m_pos.x;
- pos.y = m_pos.y+m_dim.y;
+ pos.y = m_pos.y + m_dim.y;
GlintCreate(pos);
}
-Math::Point CControl::RetPos()
+Math::Point CControl::GetPos()
{
return m_pos;
}
@@ -131,11 +137,11 @@ void CControl::SetDim(Math::Point dim)
m_dim = dim;
pos.x = m_pos.x;
- pos.y = m_pos.y+m_dim.y;
+ pos.y = m_pos.y + m_dim.y;
GlintCreate(pos);
}
-Math::Point CControl::RetDim()
+Math::Point CControl::GetDim()
{
return m_dim;
}
@@ -175,7 +181,7 @@ bool CControl::TestState(int state)
// Returns all attributes of state.
-int CControl::RetState()
+int CControl::GetState()
{
return m_state;
}
@@ -188,7 +194,7 @@ void CControl::SetIcon(int icon)
m_icon = icon;
}
-int CControl::RetIcon()
+int CControl::GetIcon()
{
return m_icon;
}
@@ -230,7 +236,7 @@ void CControl::SetName(char* name, bool bTooltip)
}
}
-char* CControl::RetName()
+char* CControl::GetName()
{
return m_name;
}
@@ -238,14 +244,16 @@ char* CControl::RetName()
// Management of the mode of justification (-1,0,1).
-void CControl::SetJustif(int mode)
+void CControl::SetTextAlign(Gfx::TextAlign mode)
{
- m_justif = mode;
+ m_textAlign = mode;
+// m_justif = mode;
}
-int CControl::RetJustif()
+int CControl::GetTextAlign()
{
- return m_justif;
+ return m_textAlign;
+// return m_justif;
}
@@ -256,7 +264,7 @@ void CControl::SetFontSize(float size)
m_fontSize = size;
}
-float CControl::RetFontSize()
+float CControl::GetFontSize()
{
return m_fontSize;
}
@@ -269,7 +277,7 @@ void CControl::SetFontStretch(float stretch)
m_fontStretch = stretch;
}
-float CControl::RetFontStretch()
+float CControl::GetFontStretch()
{
return m_fontStretch;
}
@@ -277,12 +285,12 @@ float CControl::RetFontStretch()
// Choice of the font.
-void CControl::SetFontType(FontType font)
+void CControl::SetFontType(Gfx::FontType font)
{
m_fontType = font;
}
-FontType CControl::RetFontType()
+Gfx::FontType CControl::GetFontType()
{
return m_fontType;
}
@@ -290,7 +298,7 @@ FontType CControl::RetFontType()
// Specifies the tooltip.
-bool CControl::SetTooltip(char* name)
+bool CControl::SetTooltip(const char* name)
{
strcpy(m_tooltip, name);
return true;
@@ -316,7 +324,7 @@ void CControl::SetFocus(bool bFocus)
m_bFocus = bFocus;
}
-bool CControl::RetFocus()
+bool CControl::GetFocus()
{
return m_bFocus;
}
@@ -324,9 +332,9 @@ bool CControl::RetFocus()
// Returns the event associated with the control.
-EventMsg CControl::RetEventMsg()
+EventType CControl::GetEventType()
{
- return m_eventMsg;
+ return m_eventType;
}
@@ -336,21 +344,21 @@ bool CControl::EventProcess(const Event &event)
{
if ( m_state & STATE_DEAD ) return true;
- if ( event.event == EVENT_FRAME && m_bGlint )
+ if ( event.type == EVENT_FRAME && m_bGlint )
{
GlintFrame(event);
}
- if ( event.event == EVENT_MOUSEMOVE )
+ if ( event.type == EVENT_MOUSE_MOVE )
{
- m_glintMouse = event.pos;
+ m_glintMouse = event.mouseMove.pos;
- if ( Detect(event.pos) )
+ if ( Detect(event.mouseMove.pos) )
{
if ( (m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE ) )
{
- m_engine->SetMouseType(D3DMOUSEHAND);
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_HAND);
}
SetState(STATE_HILIGHT);
}
@@ -360,7 +368,7 @@ bool CControl::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_LBUTTONDOWN )
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN && event.mouseButton.button == 1)
{
if ( Detect(event.pos) )
{
@@ -369,7 +377,7 @@ bool CControl::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_MOUSEMOVE && m_bCapture )
+ if ( event.type == EVENT_MOUSE_MOVE && m_bCapture )
{
if ( Detect(event.pos) )
{
@@ -381,7 +389,7 @@ bool CControl::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_LBUTTONUP && m_bCapture )
+ if ( event.type == EVENT_MOUSE_BUTTON_UP && m_bCapture && event.mouseButton.button == 1)
{
m_bCapture = false;
ClearState(STATE_PRESS);
@@ -404,8 +412,8 @@ void CControl::GlintCreate(Math::Point ref, bool bLeft, bool bUp)
{
float offset;
- offset = 8.0f/640.0f;
- if ( offset > m_dim.x/4.0f) offset = m_dim.x/4.0f;
+ offset = 8.0f / 640.0f;
+ if ( offset > m_dim.x / 4.0f) offset = m_dim.x / 4.0f;
if ( bLeft )
{
@@ -419,17 +427,17 @@ void CControl::GlintCreate(Math::Point ref, bool bLeft, bool bUp)
}
offset = 8.0f/480.0f;
- if ( offset > m_dim.y/4.0f) offset = m_dim.y/4.0f;
+ if ( offset > m_dim.y / 4.0f) offset = m_dim.y / 4.0f;
if ( bUp )
{
- m_glintCorner1.y = ref.y-offset;
+ m_glintCorner1.y = ref.y - offset;
m_glintCorner2.y = ref.y;
}
else
{
m_glintCorner1.y = ref.y;
- m_glintCorner2.y = ref.y+offset;
+ m_glintCorner2.y = ref.y + offset;
}
m_bGlint = true;
@@ -452,14 +460,14 @@ void CControl::GlintFrame(const Event &event)
if ( m_glintProgress >= 2.0f && Detect(m_glintMouse) )
{
- pos.x = m_glintCorner1.x + (m_glintCorner2.x-m_glintCorner1.x)*Math::Rand();
- pos.y = m_glintCorner1.y + (m_glintCorner2.y-m_glintCorner1.y)*Math::Rand();
+ pos.x = m_glintCorner1.x + (m_glintCorner2.x - m_glintCorner1.x) * Math::Rand();
+ pos.y = m_glintCorner1.y + (m_glintCorner2.y - m_glintCorner1.y) * Math::Rand();
pos.z = 0.0f;
speed = Math::Vector(0.0f, 0.0f, 0.0f);
- dim.x = ((15.0f+Math::Rand()*15.0f)/640.0f);
- dim.y = dim.x/0.75f;
- m_particule->CreateParticule(pos, speed, dim, PARTICONTROL,
- 1.0f, 0.0f, 0.0f, SH_INTERFACE);
+ dim.x = ((15.0f + Math::Rand() * 15.0f) / 640.0f);
+ dim.y = dim.x / 0.75f;
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICONTROL,
+ 1.0f, 0.0f, 0.0f, Gfx::SH_INTERFACE );
m_glintProgress = 0.0f;
}
@@ -477,7 +485,7 @@ void CControl::Draw()
if ( (m_state & STATE_VISIBLE) == 0 ) return;
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
zoomExt = 1.00f;
zoomInt = 0.95f;
@@ -537,7 +545,7 @@ void CControl::Draw()
if ( m_name[0] == 0 ) // button without name?
{
//? DrawPart(icon, zoomExt, 0.0f);
- DrawPart(icon, zoomExt, 8.0f/256.0f);
+ DrawPart(icon, zoomExt, 8.0f / 256.0f);
if ( m_state & STATE_DEAD ) return;
@@ -550,23 +558,23 @@ void CControl::Draw()
#else
m_engine->SetTexture("text.tga");
#endif
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
}
else if ( icon >= 128 )
{
icon -= 128;
m_engine->SetTexture("button3.tga");
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
}
else if ( icon >= 64 )
{
icon -= 64;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
}
else
{
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
}
if ( icon != -1 )
{
@@ -579,26 +587,28 @@ void CControl::Draw()
if ( m_state & STATE_DEAD ) return;
- if ( m_justif < 0 )
+// if ( m_justif < 0 )
+ if ( m_textAlign == Gfx::TEXT_ALIGN_LEFT )
{
- pos.x = m_pos.x+m_dim.x-m_dim.y*0.5f;
- pos.y = m_pos.y+m_dim.y*0.5f;
- pos.y -= m_engine->RetText()->RetHeight(m_fontSize, m_fontType)/2;
- m_engine->RetText()->DrawText(m_name, pos, m_dim.x, m_justif, m_fontSize, m_fontStretch, m_fontType, 0);
+ pos.x = m_pos.x + m_dim.x - m_dim.y * 0.5f;
+ pos.y = m_pos.y + m_dim.y * 0.5f;
+ pos.y -= m_engine->GetText()->GetHeight(m_fontType, m_fontSize)/2.0f;
+ m_engine->GetText()->DrawText(m_name, m_fontType, m_fontSize, pos, m_dim.x, m_textAlign, 0);
}
- else if ( m_justif > 0 )
+ else if ( m_textAlign == Gfx::TEXT_ALIGN_RIGHT )
+// else if ( m_justif > 0 )
{
- pos.x = m_pos.x+m_dim.y*0.5f;
- pos.y = m_pos.y+m_dim.y*0.5f;
- pos.y -= m_engine->RetText()->RetHeight(m_fontSize, m_fontType)/2.0f;
- m_engine->RetText()->DrawText(m_name, pos, m_dim.x, m_justif, m_fontSize, m_fontStretch, m_fontType, 0);
+ pos.x = m_pos.x + m_dim.y * 0.5f;
+ pos.y = m_pos.y + m_dim.y * 0.5f;
+ pos.y -= m_engine->GetText()->GetHeight(m_fontType, m_fontSize)/2.0f;
+ m_engine->GetText()->DrawText(m_name, m_fontType, m_fontSize, pos, m_dim.x, m_textAlign, 0);
}
else
{
- pos.x = m_pos.x+m_dim.x*0.5f;
- pos.y = m_pos.y+m_dim.y*0.5f;
- pos.y -= m_engine->RetText()->RetHeight(m_fontSize, m_fontType)/2.0f;
- m_engine->RetText()->DrawText(m_name, pos, m_dim.x, m_justif, m_fontSize, m_fontStretch, m_fontType, 0);
+ pos.x = m_pos.x + m_dim.x * 0.5f;
+ pos.y = m_pos.y + m_dim.y * 0.5f;
+ pos.y -= m_engine->GetText()->GetHeight( m_fontType, m_fontSize)/2.0f;
+ m_engine->GetText()->DrawText(m_name, m_fontType, m_fontSize, pos, m_dim.x, m_textAlign, 0);
}
}
}
@@ -618,26 +628,26 @@ void CControl::DrawPart(int icon, float zoom, float ex)
if ( (m_state & STATE_CARD ) &&
(m_state & STATE_CHECK) )
{
- p2.y += (2.0f/480.0f); // a bit above
+ p2.y += (2.0f / 480.0f); // a bit above
}
- c.x = (p1.x+p2.x)/2.0f;
- c.y = (p1.y+p2.y)/2.0f; // center
+ c.x = (p1.x + p2.x)/2.0f;
+ c.y = (p1.y + p2.y)/2.0f; // center
- p1.x = (p1.x-c.x)*zoom + c.x;
- p1.y = (p1.y-c.y)*zoom + c.y;
- p2.x = (p2.x-c.x)*zoom + c.x;
- p2.y = (p2.y-c.y)*zoom + c.y;
+ p1.x = (p1.x - c.x) * zoom + c.x;
+ p1.y = (p1.y - c.y) * zoom + c.y;
+ p2.x = (p2.x - c.x) * zoom + c.x;
+ p2.y = (p2.y - c.y) * zoom + c.y;
p2.x -= p1.x;
p2.y -= p1.y;
- uv1.x = (32.0f/256.0f)*(icon%8);
- uv1.y = (32.0f/256.0f)*(icon/8); // uv texture
- uv2.x = (32.0f/256.0f)+uv1.x;
- uv2.y = (32.0f/256.0f)+uv1.y;
+ uv1.x = (32.0f / 256.0f) * (icon%8);
+ uv1.y = (32.0f / 256.0f) * (icon/8); // uv texture
+ uv2.x = (32.0f / 256.0f) + uv1.x;
+ uv2.y = (32.0f / 256.0f) + uv1.y;
- dp = 0.5f/256.0f;
+ dp = 0.5f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -652,12 +662,12 @@ void CControl::DrawPart(int icon, float zoom, float ex)
void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math::Point uv2,
float ex)
{
- LPDIRECT3DDEVICE7 device;
- D3DVERTEX2 vertex[8]; // 6 triangles
+ Gfx::CDevice* device;
+ Gfx::Vertex vertex[8]; // 6 triangles
Math::Point p1, p2, p3, p4;
Math::Vector n;
- device = m_engine->RetD3DDevice();
+ device = m_engine->GetDevice();
p1.x = pos.x;
p1.y = pos.y;
@@ -668,48 +678,48 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math:
if ( ex == 0.0f ) // one piece?
{
- vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x,uv2.y);
- vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, uv1.x,uv1.y);
- vertex[2] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, uv2.x,uv2.y);
- vertex[3] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv2.x,uv1.y);
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x,uv2.y));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(uv1.x,uv1.y));
+ vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(uv2.x,uv2.y));
+ vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv2.x,uv1.y));
- device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 4, NULL);
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2);
}
else // 3 pieces?
{
if ( dim.x >= dim.y )
{
- p3.x = p1.x + ex*dim.y/(uv2.y-uv1.y);
- p4.x = p2.x - ex*dim.y/(uv2.y-uv1.y);
-
- vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x, uv2.y);
- vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, uv1.x, uv1.y);
- vertex[2] = D3DVERTEX2(Math::Vector(p3.x, p1.y, 0.0f), n, uv1.x+ex,uv2.y);
- vertex[3] = D3DVERTEX2(Math::Vector(p3.x, p2.y, 0.0f), n, uv1.x+ex,uv1.y);
- vertex[4] = D3DVERTEX2(Math::Vector(p4.x, p1.y, 0.0f), n, uv2.x-ex,uv2.y);
- vertex[5] = D3DVERTEX2(Math::Vector(p4.x, p2.y, 0.0f), n, uv2.x-ex,uv1.y);
- vertex[6] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, uv2.x, uv2.y);
- vertex[7] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv2.x, uv1.y);
-
- device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 8, NULL);
+ p3.x = p1.x + ex*dim.y / (uv2.y - uv1.y);
+ p4.x = p2.x - ex*dim.y / (uv2.y - uv1.y);
+
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x, uv2.y));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(uv1.x, uv1.y));
+ vertex[2] = Gfx::Vertex(Math::Vector(p3.x, p1.y, 0.0f), n, Math::Point(uv1.x+ex,uv2.y));
+ vertex[3] = Gfx::Vertex(Math::Vector(p3.x, p2.y, 0.0f), n, Math::Point(uv1.x+ex,uv1.y));
+ vertex[4] = Gfx::Vertex(Math::Vector(p4.x, p1.y, 0.0f), n, Math::Point(uv2.x-ex,uv2.y));
+ vertex[5] = Gfx::Vertex(Math::Vector(p4.x, p2.y, 0.0f), n, Math::Point(uv2.x-ex,uv1.y));
+ vertex[6] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(uv2.x, uv2.y));
+ vertex[7] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv2.x, uv1.y));
+
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 8);
m_engine->AddStatisticTriangle(6);
}
else
{
- p3.y = p1.y + ex*dim.x/(uv2.x-uv1.x);
- p4.y = p2.y - ex*dim.x/(uv2.x-uv1.x);
-
- vertex[0] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, uv2.x,uv2.y );
- vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x,uv2.y );
- vertex[2] = D3DVERTEX2(Math::Vector(p2.x, p3.y, 0.0f), n, uv2.x,uv2.y-ex);
- vertex[3] = D3DVERTEX2(Math::Vector(p1.x, p3.y, 0.0f), n, uv1.x,uv2.y-ex);
- vertex[4] = D3DVERTEX2(Math::Vector(p2.x, p4.y, 0.0f), n, uv2.x,uv1.y+ex);
- vertex[5] = D3DVERTEX2(Math::Vector(p1.x, p4.y, 0.0f), n, uv1.x,uv1.y+ex);
- vertex[6] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv2.x,uv1.y );
- vertex[7] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, uv1.x,uv1.y );
-
- device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 8, NULL);
+ p3.y = p1.y + ex*dim.x / (uv2.x - uv1.x);
+ p4.y = p2.y - ex*dim.x / (uv2.x - uv1.x);
+
+ vertex[0] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(uv2.x, uv2.y ));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x, uv2.y ));
+ vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p3.y, 0.0f), n, Math::Point(uv2.x, uv2.y - ex));
+ vertex[3] = Gfx::Vertex(Math::Vector(p1.x, p3.y, 0.0f), n, Math::Point(uv1.x, uv2.y - ex));
+ vertex[4] = Gfx::Vertex(Math::Vector(p2.x, p4.y, 0.0f), n, Math::Point(uv2.x, uv1.y + ex));
+ vertex[5] = Gfx::Vertex(Math::Vector(p1.x, p4.y, 0.0f), n, Math::Point(uv1.x, uv1.y + ex));
+ vertex[6] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv2.x, uv1.y ));
+ vertex[7] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(uv1.x, uv1.y ));
+
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 8);
m_engine->AddStatisticTriangle(6);
}
}
@@ -720,12 +730,12 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math:
void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math::Point uv2,
Math::Point corner, float ex)
{
- LPDIRECT3DDEVICE7 device;
- D3DVERTEX2 vertex[8]; // 6 triangles
+ Gfx::CDevice* device;
+ Gfx::Vertex vertex[8]; // 6 triangles
Math::Point p1, p2, p3, p4;
Math::Vector n;
- device = m_engine->RetD3DDevice();
+ device = m_engine->GetDevice();
p1.x = pos.x;
p1.y = pos.y;
@@ -734,8 +744,8 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math:
n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
- if ( corner.x > dim.x/2.0f ) corner.x = dim.x/2.0f;
- if ( corner.y > dim.y/2.0f ) corner.y = dim.y/2.0f;
+ if ( corner.x > dim.x / 2.0f ) corner.x = dim.x / 2.0f;
+ if ( corner.y > dim.y / 2.0f ) corner.y = dim.y / 2.0f;
p1.x = pos.x;
p1.y = pos.y;
@@ -747,39 +757,39 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math:
p4.y = p2.y - corner.y;
// Bottom horizontal band.
- vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x, uv2.y );
- vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p3.y, 0.0f), n, uv1.x, uv2.y-ex);
- vertex[2] = D3DVERTEX2(Math::Vector(p3.x, p1.y, 0.0f), n, uv1.x+ex,uv2.y );
- vertex[3] = D3DVERTEX2(Math::Vector(p3.x, p3.y, 0.0f), n, uv1.x+ex,uv2.y-ex);
- vertex[4] = D3DVERTEX2(Math::Vector(p4.x, p1.y, 0.0f), n, uv2.x-ex,uv2.y );
- vertex[5] = D3DVERTEX2(Math::Vector(p4.x, p3.y, 0.0f), n, uv2.x-ex,uv2.y-ex);
- vertex[6] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, uv2.x, uv2.y );
- vertex[7] = D3DVERTEX2(Math::Vector(p2.x, p3.y, 0.0f), n, uv2.x, uv2.y-ex);
- device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 8, NULL);
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x, uv2.y ));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p3.y, 0.0f), n, Math::Point(uv1.x, uv2.y - ex));
+ vertex[2] = Gfx::Vertex(Math::Vector(p3.x, p1.y, 0.0f), n, Math::Point(uv1.x + ex, uv2.y ));
+ vertex[3] = Gfx::Vertex(Math::Vector(p3.x, p3.y, 0.0f), n, Math::Point(uv1.x + ex, uv2.y - ex));
+ vertex[4] = Gfx::Vertex(Math::Vector(p4.x, p1.y, 0.0f), n, Math::Point(uv2.x - ex, uv2.y ));
+ vertex[5] = Gfx::Vertex(Math::Vector(p4.x, p3.y, 0.0f), n, Math::Point(uv2.x - ex, uv2.y - ex));
+ vertex[6] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(uv2.x, uv2.y ));
+ vertex[7] = Gfx::Vertex(Math::Vector(p2.x, p3.y, 0.0f), n, Math::Point(uv2.x, uv2.y - ex));
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 8);
m_engine->AddStatisticTriangle(6);
// Central horizontal band.
- vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p3.y, 0.0f), n, uv1.x, uv2.y-ex);
- vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p4.y, 0.0f), n, uv1.x, uv1.y+ex);
- vertex[2] = D3DVERTEX2(Math::Vector(p3.x, p3.y, 0.0f), n, uv1.x+ex,uv2.y-ex);
- vertex[3] = D3DVERTEX2(Math::Vector(p3.x, p4.y, 0.0f), n, uv1.x+ex,uv1.y+ex);
- vertex[4] = D3DVERTEX2(Math::Vector(p4.x, p3.y, 0.0f), n, uv2.x-ex,uv2.y-ex);
- vertex[5] = D3DVERTEX2(Math::Vector(p4.x, p4.y, 0.0f), n, uv2.x-ex,uv1.y+ex);
- vertex[6] = D3DVERTEX2(Math::Vector(p2.x, p3.y, 0.0f), n, uv2.x, uv2.y-ex);
- vertex[7] = D3DVERTEX2(Math::Vector(p2.x, p4.y, 0.0f), n, uv2.x, uv1.y+ex);
- device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 8, NULL);
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p3.y, 0.0f), n, Math::Point(uv1.x, uv2.y - ex));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p4.y, 0.0f), n, Math::Point(uv1.x, uv1.y + ex));
+ vertex[2] = Gfx::Vertex(Math::Vector(p3.x, p3.y, 0.0f), n, Math::Point(uv1.x + ex, uv2.y - ex));
+ vertex[3] = Gfx::Vertex(Math::Vector(p3.x, p4.y, 0.0f), n, Math::Point(uv1.x + ex, uv1.y + ex));
+ vertex[4] = Gfx::Vertex(Math::Vector(p4.x, p3.y, 0.0f), n, Math::Point(uv2.x - ex, uv2.y - ex));
+ vertex[5] = Gfx::Vertex(Math::Vector(p4.x, p4.y, 0.0f), n, Math::Point(uv2.x - ex, uv1.y + ex));
+ vertex[6] = Gfx::Vertex(Math::Vector(p2.x, p3.y, 0.0f), n, Math::Point(uv2.x, uv2.y - ex));
+ vertex[7] = Gfx::Vertex(Math::Vector(p2.x, p4.y, 0.0f), n, Math::Point(uv2.x, uv1.y + ex));
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 8);
m_engine->AddStatisticTriangle(6);
// Top horizontal band.
- vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p4.y, 0.0f), n, uv1.x, uv1.y+ex);
- vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, uv1.x, uv1.y );
- vertex[2] = D3DVERTEX2(Math::Vector(p3.x, p4.y, 0.0f), n, uv1.x+ex,uv1.y+ex);
- vertex[3] = D3DVERTEX2(Math::Vector(p3.x, p2.y, 0.0f), n, uv1.x+ex,uv1.y );
- vertex[4] = D3DVERTEX2(Math::Vector(p4.x, p4.y, 0.0f), n, uv2.x-ex,uv1.y+ex);
- vertex[5] = D3DVERTEX2(Math::Vector(p4.x, p2.y, 0.0f), n, uv2.x-ex,uv1.y );
- vertex[6] = D3DVERTEX2(Math::Vector(p2.x, p4.y, 0.0f), n, uv2.x, uv1.y+ex);
- vertex[7] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv2.x, uv1.y );
- device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 8, NULL);
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p4.y, 0.0f), n, Math::Point(uv1.x, uv1.y + ex));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(uv1.x, uv1.y ));
+ vertex[2] = Gfx::Vertex(Math::Vector(p3.x, p4.y, 0.0f), n, Math::Point(uv1.x + ex, uv1.y + ex));
+ vertex[3] = Gfx::Vertex(Math::Vector(p3.x, p2.y, 0.0f), n, Math::Point(uv1.x + ex, uv1.y ));
+ vertex[4] = Gfx::Vertex(Math::Vector(p4.x, p4.y, 0.0f), n, Math::Point(uv2.x - ex, uv1.y + ex));
+ vertex[5] = Gfx::Vertex(Math::Vector(p4.x, p2.y, 0.0f), n, Math::Point(uv2.x - ex, uv1.y ));
+ vertex[6] = Gfx::Vertex(Math::Vector(p2.x, p4.y, 0.0f), n, Math::Point(uv2.x, uv1.y + ex));
+ vertex[7] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv2.x, uv1.y ));
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 8);
m_engine->AddStatisticTriangle(6);
}
@@ -790,15 +800,15 @@ void CControl::DrawWarning(Math::Point pos, Math::Point dim)
Math::Point uv1, uv2;
float dp;
- dp = 0.5f/256.0f;
+ dp = 0.5f / 256.0f;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 64.0f/256.0f;
- uv1.y = 208.0f/256.0f;
- uv2.x = 160.0f/256.0f;
- uv2.y = 224.0f/256.0f;
+ uv1.x = 64.0f / 256.0f;
+ uv1.y = 208.0f / 256.0f;
+ uv2.x = 160.0f / 256.0f;
+ uv2.y = 224.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
@@ -837,27 +847,27 @@ void CControl::DrawShadow(Math::Point pos, Math::Point dim, float deep)
dp = 0.5f/256.0f;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState( Gfx::ENG_RSTATE_TTEXTURE_WHITE);
- pos.x += deep*0.010f*0.75f;
- pos.y -= deep*0.015f;
- dim.x += deep*0.005f*0.75f;
- dim.y += deep*0.005f;
+ pos.x += deep * 0.010f * 0.75f;
+ pos.y -= deep * 0.015f;
+ dim.x += deep * 0.005f * 0.75f;
+ dim.y += deep * 0.005f;
- uv1.x = 192.0f/256.0f;
- uv1.y = 32.0f/256.0f;
- uv2.x = 224.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ uv1.x = 192.0f / 256.0f;
+ uv1.y = 32.0f / 256.0f;
+ uv2.x = 224.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 10.0f/640.0f;
- corner.y = 10.0f/480.0f;
+ corner.x = 10.0f / 640.0f;
+ corner.y = 10.0f / 480.0f;
- DrawIcon(pos, dim, uv1, uv2, corner, 6.0f/256.0f);
+ DrawIcon(pos, dim, uv1, uv2, corner, 6.0f / 256.0f);
}
@@ -865,10 +875,10 @@ void CControl::DrawShadow(Math::Point pos, Math::Point dim, float deep)
bool CControl::Detect(Math::Point pos)
{
- return ( pos.x >= m_pos.x &&
- pos.x <= m_pos.x+m_dim.x &&
- pos.y >= m_pos.y &&
- pos.y <= m_pos.y+m_dim.y );
+ return ( pos.x >= m_pos.x &&
+ pos.x <= m_pos.x + m_dim.x &&
+ pos.y >= m_pos.y &&
+ pos.y <= m_pos.y + m_dim.y );
}
-
+}
diff --git a/src/ui/control.h b/src/ui/control.h
index 0a12ff1..c3a35f4 100644
--- a/src/ui/control.h
+++ b/src/ui/control.h
@@ -19,19 +19,24 @@
#pragma once
-#include "old/text.h"
-#include "common/struct.h"
+//#include "old/text.h"
+#include "graphics/engine/text.h"
+//#include "common/struct.h"
#include "common/event.h"
+namespace Gfx {
+class CEngine;
+class CParticle;
+};
class CInstanceManager;
class CEvent;
-class CD3DEngine;
+//class Gfx::CEngine;
class CRobotMain;
-class CParticule;
-class CSound;
-
+//class Gfx::CParticle;
+class CSoundInterface;
+namespace Ui {
enum ControlState
{
STATE_ENABLE = (1<<0), // active
@@ -58,42 +63,43 @@ enum ControlState
class CControl
{
public:
- CControl(CInstanceManager* iMan);
+// CControl(CInstanceManager* iMan);
+ CControl ();
virtual ~CControl();
- virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
-
- virtual bool EventProcess(const Event &event);
-
- virtual void SetPos(Math::Point pos);
- virtual Math::Point RetPos();
- virtual void SetDim(Math::Point dim);
- virtual Math::Point RetDim();
- virtual bool SetState(int state, bool bState);
- virtual bool SetState(int state);
- virtual bool ClearState(int state);
- virtual bool TestState(int state);
- virtual int RetState();
- virtual void SetIcon(int icon);
- virtual int RetIcon();
- virtual void SetName(char* name, bool bTooltip=true);
- virtual char* RetName();
- virtual void SetJustif(int mode);
- virtual int RetJustif();
- virtual void SetFontSize(float size);
- virtual float RetFontSize();
- virtual void SetFontStretch(float stretch);
- virtual float RetFontStretch();
- virtual void SetFontType(FontType font);
- virtual FontType RetFontType();
- virtual bool SetTooltip(char* name);
- virtual bool GetTooltip(Math::Point pos, char* name);
- virtual void SetFocus(bool bFocus);
- virtual bool RetFocus();
-
- virtual EventMsg RetEventMsg();
-
- virtual void Draw();
+ virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
+
+ virtual bool EventProcess(const Event &event);
+
+ virtual void SetPos(Math::Point pos);
+ virtual Math::Point GetPos();
+ virtual void SetDim(Math::Point dim);
+ virtual Math::Point GetDim();
+ virtual bool SetState(int state, bool bState);
+ virtual bool SetState(int state);
+ virtual bool ClearState(int state);
+ virtual bool TestState(int state);
+ virtual int GetState();
+ virtual void SetIcon(int icon);
+ virtual int GetIcon();
+ virtual void SetName(char* name, bool bTooltip=true);
+ virtual char* GetName();
+ virtual void SetTextAlign(Gfx::TextAlign mode);
+ virtual int GetTextAlign();
+ virtual void SetFontSize(float size);
+ virtual float GetFontSize();
+ virtual void SetFontStretch(float stretch);
+ virtual float GetFontStretch();
+ virtual void SetFontType(Gfx::FontType font);
+ virtual Gfx::FontType GetFontType();
+ virtual bool SetTooltip(const char* name);
+ virtual bool GetTooltip(Math::Point pos, char* name);
+ virtual void SetFocus(bool bFocus);
+ virtual bool GetFocus();
+
+ virtual EventType GetEventType();
+
+ virtual void Draw();
protected:
void GlintDelete();
@@ -108,31 +114,33 @@ protected:
protected:
CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CEvent* m_event;
- CRobotMain* m_main;
- CParticule* m_particule;
- CSound* m_sound;
-
- Math::Point m_pos; // corner upper / left
- Math::Point m_dim; // dimensions
- int m_icon;
- EventMsg m_eventMsg; // message to send when clicking
- int m_state; // states (STATE_ *)
- float m_fontSize; // size of the button name
- float m_fontStretch; // stretch of the font
- FontType m_fontType; // type of font
- int m_justif; // type of justification (-1,0,1)
- char m_name[100]; // name of the button
- char m_tooltip[100]; // name of tooltip
- bool m_bFocus;
- bool m_bCapture;
-
- bool m_bGlint;
- Math::Point m_glintCorner1;
- Math::Point m_glintCorner2;
- float m_glintProgress;
- Math::Point m_glintMouse;
+ Gfx::CEngine* m_engine;
+ CEventQueue* m_event;
+ CRobotMain* m_main;
+ Gfx::CParticle* m_particle;
+ CSoundInterface* m_sound;
+
+ Math::Point m_pos; // corner upper / left
+ Math::Point m_dim; // dimensions
+ int m_icon;
+ EventType m_eventType; // message to send when clicking
+ int m_state; // states (STATE_ *)
+ float m_fontSize; // size of the button name
+ float m_fontStretch; // stretch of the font
+ Gfx::FontType m_fontType; // type of font
+ Gfx::TextAlign m_textAlign; //type of alignment //comes in the place of m_justif
+// int m_justif; // type of justification (-1,0,1)
+ char m_name[100]; // name of the button
+ char m_tooltip[100]; // name of tooltip
+ bool m_bFocus;
+ bool m_bCapture;
+
+ bool m_bGlint;
+ Math::Point m_glintCorner1;
+ Math::Point m_glintCorner2;
+ float m_glintProgress;
+ Math::Point m_glintMouse;
};
+}
diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp
index 39a4a14..bbd3740 100644
--- a/src/ui/displayinfo.cpp
+++ b/src/ui/displayinfo.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,21 +18,22 @@
// displayinfo.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+//#include "old/d3dmath.h"
+#include "graphics/engine/engine.h"
#include "common/language.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
#include "common/restext.h"
-#include "old/math3d.h"
+//#include "old/math3d.h"
#include "object/robotmain.h"
-#include "old/camera.h"
+//#include "old/camera.h"
#include "object/object.h"
#include "object/motion/motion.h"
#include "object/motion/motiontoto.h"
@@ -41,29 +43,31 @@
#include "ui/edit.h"
#include "ui/group.h"
#include "ui/window.h"
-#include "old/particule.h"
-#include "old/light.h"
-#include "old/text.h"
+//#include "old/particule.h"
+#include "graphics/engine/particle.h"
+//#include "old/light.h"
+//#include "old/text.h"
#include "script/cbottoken.h"
#include "ui/displayinfo.h"
-
+namespace Ui {
// Object's constructor.
-CDisplayInfo::CDisplayInfo(CInstanceManager* iMan)
+//CDisplayInfo::CDisplayInfo(CInstanceManager* iMan)
+CDisplayInfo::CDisplayInfo()
{
- m_iMan = iMan;
+ m_iMan = CInstanceManager::GetInstancePointer();
m_iMan->AddInstance(CLASS_STUDIO, this);
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_event = (CEvent*)m_iMan->SearchInstance(CLASS_EVENT);
- m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
- m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
- m_light = (CLight*)m_iMan->SearchInstance(CLASS_LIGHT);
+ m_engine = static_cast <Gfx::CEngine*> (m_iMan->SearchInstance(CLASS_ENGINE));
+ m_event = static_cast <CEventQueue*> (m_iMan->SearchInstance(CLASS_EVENT));
+ m_interface = static_cast <CInterface*> (m_iMan->SearchInstance(CLASS_INTERFACE));
+ m_main = static_cast <CRobotMain*> (m_iMan->SearchInstance(CLASS_MAIN));
+ m_camera = static_cast <Gfx::CCamera*> (m_iMan->SearchInstance(CLASS_CAMERA));
+ m_particle = static_cast <Gfx::CParticle*> (m_iMan->SearchInstance(CLASS_PARTICULE));
+ m_light = static_cast <Gfx::CLight*> (m_iMan->SearchInstance(CLASS_LIGHT));
m_bInfoMaximized = true;
m_bInfoMinimized = false;
@@ -87,22 +91,22 @@ CDisplayInfo::~CDisplayInfo()
bool CDisplayInfo::EventProcess(const Event &event)
{
- CWindow* pw;
- CEdit* edit;
- CSlider* slider;
+ Ui::CWindow* pw;
+ Ui::CEdit* edit;
+ Ui::CSlider* slider;
CMotionToto* toto;
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
EventFrame(event);
HyperUpdate();
}
- if ( event.event == EVENT_MOUSEMOVE )
+ if ( event.type == EVENT_MOUSE_MOVE )
{
if ( m_toto != 0 )
{
- toto = (CMotionToto*)m_toto->RetMotion();
+ toto = static_cast<CMotionToto*>(m_toto->GetMotion());
if ( toto != 0 )
{
toto->SetMousePos(event.pos);
@@ -110,21 +114,21 @@ bool CDisplayInfo::EventProcess(const Event &event)
}
}
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw != 0 )
{
- if ( event.event == pw->RetEventMsgClose() )
+ if ( event.type == pw->GetEventTypeClose() )
{
Event newEvent = event;
- newEvent.event = EVENT_OBJECT_INFOOK;
+ newEvent.type = EVENT_OBJECT_INFOOK;
m_event->AddEvent(newEvent);
}
- if ( event.event == EVENT_SATCOM_HUSTON )
+ if ( event.type == EVENT_SATCOM_HUSTON )
{
ChangeIndexButton(SATCOM_HUSTON);
}
- if ( event.event == EVENT_SATCOM_SAT )
+ if ( event.type == EVENT_SATCOM_SAT )
{
ChangeIndexButton(SATCOM_SAT);
}
@@ -132,90 +136,90 @@ bool CDisplayInfo::EventProcess(const Event &event)
//? {
//? ChangeIndexButton(SATCOM_OBJECT);
//? }
- if ( event.event == EVENT_SATCOM_LOADING )
+ if ( event.type == EVENT_SATCOM_LOADING )
{
ChangeIndexButton(SATCOM_LOADING);
}
- if ( event.event == EVENT_SATCOM_PROG )
+ if ( event.type == EVENT_SATCOM_PROG )
{
ChangeIndexButton(SATCOM_PROG);
}
- if ( event.event == EVENT_SATCOM_SOLUCE )
+ if ( event.type == EVENT_SATCOM_SOLUCE )
{
ChangeIndexButton(SATCOM_SOLUCE);
}
- if ( event.event == EVENT_HYPER_HOME ||
- event.event == EVENT_HYPER_PREV ||
- event.event == EVENT_HYPER_NEXT )
+ if ( event.type == EVENT_HYPER_HOME ||
+ event.type == EVENT_HYPER_PREV ||
+ event.type == EVENT_HYPER_NEXT )
{
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 )
{
- edit->HyperGo(event.event);
+ edit->HyperGo(event.type);
HyperUpdate();
}
}
- if ( event.event == EVENT_HYPER_SIZE1 ) // size 1?
+ if ( event.type == EVENT_HYPER_SIZE1 ) // size 1?
{
m_main->SetFontSize(9.0f);
- slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE);
- if ( slider != 0 ) slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f);
+ slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
+ if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
ViewDisplayInfo();
}
- if ( event.event == EVENT_HYPER_SIZE2 ) // size 2?
+ if ( event.type == EVENT_HYPER_SIZE2 ) // size 2?
{
m_main->SetFontSize(10.0f);
- slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE);
- if ( slider != 0 ) slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f);
+ slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
+ if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
ViewDisplayInfo();
}
- if ( event.event == EVENT_HYPER_SIZE3 ) // size 3?
+ if ( event.type == EVENT_HYPER_SIZE3 ) // size 3?
{
m_main->SetFontSize(12.0f);
- slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE);
- if ( slider != 0 ) slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f);
+ slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
+ if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
ViewDisplayInfo();
}
- if ( event.event == EVENT_HYPER_SIZE4 ) // size 4?
+ if ( event.type == EVENT_HYPER_SIZE4 ) // size 4?
{
m_main->SetFontSize(15.0f);
- slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE);
- if ( slider != 0 ) slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f);
+ slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
+ if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
ViewDisplayInfo();
}
- if ( event.event == EVENT_STUDIO_SIZE ) // size?
+ if ( event.type == EVENT_STUDIO_SIZE ) // size?
{
- slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE);
+ slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider == 0 ) return false;
- m_main->SetFontSize(9.0f+slider->RetVisibleValue()*6.0f);
+ m_main->SetFontSize(9.0f+slider->GetVisibleValue()*6.0f);
ViewDisplayInfo();
}
- if ( event.event == EVENT_HYPER_COPY ) // copy ?
+ if ( event.type == EVENT_HYPER_COPY ) // copy ?
{
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 )
{
edit->Copy();
}
}
- if ( event.event == EVENT_LBUTTONDOWN ||
- event.event == EVENT_LBUTTONUP )
+ if ( ( event.type == EVENT_MOUSE_BUTTON_DOWN && event.mouseButton.button == 1 )||
+ ( event.type == EVENT_MOUSE_BUTTON_UP && event.mouseButton.button == 1 ))
{
UpdateCopyButton();
}
- if ( event.event == EVENT_WINDOW4 ) // window moved?
+ if ( event.type == EVENT_WINDOW4 ) // window moved?
{
- m_infoNormalPos = m_infoActualPos = m_infoFinalPos = pw->RetPos();
- m_infoNormalDim = m_infoActualDim = m_infoFinalDim = pw->RetDim();
+ m_infoNormalPos = m_infoActualPos = m_infoFinalPos = pw->GetPos();
+ m_infoNormalDim = m_infoActualDim = m_infoFinalDim = pw->GetDim();
AdjustDisplayInfo(m_infoActualPos, m_infoActualDim);
}
- if ( event.event == pw->RetEventMsgReduce() )
+ if ( event.type == pw->GetEventTypeReduce() )
{
if ( m_bInfoMinimized )
{
@@ -241,7 +245,7 @@ bool CDisplayInfo::EventProcess(const Event &event)
pw->SetMinimized(m_bInfoMinimized);
}
}
- if ( event.event == pw->RetEventMsgFull() )
+ if ( event.type == pw->GetEventTypeFull() )
{
if ( m_bInfoMaximized )
{
@@ -260,7 +264,7 @@ bool CDisplayInfo::EventProcess(const Event &event)
m_bInfoMaximized = true;
}
//? m_main->SetEditFull(m_bInfoMaximized);
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw != 0 )
{
pw->SetMaximized(m_bInfoMaximized);
@@ -299,31 +303,31 @@ bool CDisplayInfo::EventFrame(const Event &event)
void CDisplayInfo::HyperUpdate()
{
- CWindow* pw;
- CEdit* edit;
- CButton* button;
- bool bEnable;
+ Ui::CWindow* pw;
+ Ui::CEdit* edit;
+ Ui::CButton* button;
+ bool bEnable;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_HOME);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_HOME));
if ( button != 0 )
{
bEnable = edit->HyperTest(EVENT_HYPER_HOME);
button->SetState(STATE_ENABLE, bEnable);
}
- button = (CButton*)pw->SearchControl(EVENT_HYPER_PREV);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_PREV));
if ( button != 0 )
{
bEnable = edit->HyperTest(EVENT_HYPER_PREV);
button->SetState(STATE_ENABLE, bEnable);
}
- button = (CButton*)pw->SearchControl(EVENT_HYPER_NEXT);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_NEXT));
if ( button != 0 )
{
bEnable = edit->HyperTest(EVENT_HYPER_NEXT);
@@ -336,12 +340,12 @@ void CDisplayInfo::HyperUpdate()
void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
{
- D3DLIGHT7 light;
+ Gfx::CLight light;
Math::Point pos, dim;
- CWindow* pw;
- CEdit* edit;
- CButton* button;
- CSlider* slider;
+ Ui::CWindow* pw;
+ Ui::CEdit* edit;
+ Ui::CButton* button;
+ Ui::CSlider* slider;
CMotionToto* toto;
m_index = index;
@@ -349,10 +353,10 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
//? CreateObjectsFile();
- m_bEditLock = m_main->RetEditLock();
+ m_bEditLock = m_main->GetEditLock();
if ( m_bEditLock ) // edition running program?
{
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW3));
if ( pw != 0 )
{
pw->ClearState(STATE_ENABLE); // CStudio inactive
@@ -361,10 +365,10 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
m_main->SetEditLock(true, false);
m_main->SetEditFull(false);
- m_bInitPause = m_engine->RetPause();
+ m_bInitPause = m_engine->GetPause();
m_engine->SetPause(true);
- m_infoCamera = m_camera->RetType();
- m_camera->SetType(CAMERA_INFO);
+ m_infoCamera = m_camera->GetType();
+ m_camera->SetType(Gfx::CAM_TYPE_INFO);
pos = m_infoActualPos = m_infoFinalPos;
dim = m_infoActualDim = m_infoFinalDim;
@@ -383,7 +387,7 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
edit->SetState(STATE_SHADOW);
edit->SetMultiFont(true);
edit->SetMaxChar(10000);
- edit->SetFontType(FONT_COLOBOT);
+ edit->SetFontType(Gfx::FONT_COLOBOT);
edit->SetSoluceMode(bSoluce);
edit->ReadText(filename);
edit->HyperHome(filename);
@@ -447,20 +451,20 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
m_engine->SetDrawWorld(false); // doesn't draw anything in the interface
m_engine->SetDrawFront(true); // toto draws on the interface
- m_particule->SetFrameUpdate(SH_WORLD, false); // particles break into world
+ m_particle->SetFrameUpdate(Gfx::SH_WORLD, false); // particles break into world
m_toto = SearchToto();
if ( m_toto != 0 )
{
m_toto->SetDrawFront(true);
- toto = (CMotionToto*)m_toto->RetMotion();
+ toto = static_cast<CMotionToto*>(m_toto->GetMotion());
if ( toto != 0 )
{
toto->StartDisplayInfo();
}
}
-
+// TODO
ZeroMemory(&light, sizeof(light));
light.dltType = D3DLIGHT_DIRECTIONAL;
light.dcvDiffuse.r = 1.0f;
@@ -483,31 +487,31 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
CGroup* group;
Math::Point pos, dim;
- wpos.x = 50.0f/640.0f;
- wpos.y = 30.0f/480.0f;
- wdim.x = 540.0f/640.0f;
- wdim.y = 420.0f/480.0f;
+ wpos.x = 50.0f / 640.0f;
+ wpos.y = 30.0f / 480.0f;
+ wdim.x = 540.0f / 640.0f;
+ wdim.y = 420.0f / 480.0f;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw != 0 )
{
pw->SetPos(wpos);
pw->SetDim(wdim);
- wdim = pw->RetDim();
+ wdim = pw->GetDim();
}
- pos.x = (50.0f+10.0f)/640.0f;
- pos.y = (30.0f+10.0f+24.0f+10.0f+324.0f-48.0f)/480.0f;
- dim.x = 48.0f/640.0f;
- dim.y = 48.0f/480.0f;
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_HUSTON);
+ pos.x = (50.0f + 10.0f) / 640.0f;
+ pos.y = (30.0f + 10.0f + 24.0f + 10.0f + 324.0f - 48.0f) / 480.0f;
+ dim.x = 48.0f / 640.0f;
+ dim.y = 48.0f / 480.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_HUSTON));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.y -= (48.0f+4.0f)/480.0f;
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_SAT);
+ pos.y -= (48.0f + 4.0f) / 480.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_SAT));
if ( button != 0 )
{
button->SetPos(pos);
@@ -520,136 +524,136 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
//? button->SetPos(pos);
//? button->SetDim(dim);
//? }
- pos.y -= (48.0f+4.0f)/480.0f;
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_LOADING);
+ pos.y -= (48.0f + 4.0f) / 480.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_LOADING));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.y -= (48.0f+4.0f)/480.0f;
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_PROG);
+ pos.y -= (48.0f + 4.0f) / 480.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_PROG));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.y -= (48.0f+4.0f)/480.0f;
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_SOLUCE);
+ pos.y -= (48.0f + 4.0f) / 480.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_SOLUCE));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x = (50.0f+10.0f+5.0f)/640.0f;
- pos.y = (30.0f+10.0f+4.0f)/480.0f;
- dim.x = (48.0f-10.0f)/640.0f;
- dim.y = 24.0f/480.0f;
- button = (CButton*)pw->SearchControl(EVENT_OBJECT_INFOOK);
+ pos.x = (50.0f + 10.0f + 5.0f) / 640.0f;
+ pos.y = (30.0f + 10.0f + 4.0f) / 480.0f;
+ dim.x = (48.0f - 10.0f) / 640.0f;
+ dim.y = 24.0f / 480.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_OBJECT_INFOOK));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x = (50.0f+10.0f+48.0f+10.0f)/640.0f;
- pos.y = (30.0f+10.0f)/480.0f;
- dim.x = 462.0f/640.0f;
- dim.y = 358.0f/480.0f;
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ pos.x = (50.0f + 10.0f + 48.0f + 10.0f) / 640.0f;
+ pos.y = (30.0f + 10.0f) / 480.0f;
+ dim.x = 462.0f / 640.0f;
+ dim.y = 358.0f / 480.0f;
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 )
{
edit->SetPos(pos);
edit->SetDim(dim);
}
- pos.x = (50.0f+10.0f+48.0f+10.0f)/640.0f;
- pos.y = (30.0f+10.0f+358.0f+10.0f)/480.0f;
- dim.x = 32.0f/640.0f;
- dim.y = 32.0f/480.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_PREV);
+ pos.x = (50.0f + 10.0f + 48.0f + 10.0f) / 640.0f;
+ pos.y = (30.0f + 10.0f + 358.0f + 10.0f) / 480.0f;
+ dim.x = 32.0f / 640.0f;
+ dim.y = 32.0f / 480.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_PREV));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x += 35.0f/640.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_NEXT);
+ pos.x += 35.0f / 640.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_NEXT));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x += 35.0f/640.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_HOME);
+ pos.x += 35.0f / 640.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_HOME));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x += 50.0f/640.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_SIZE1);
+ pos.x += 50.0f / 640.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_SIZE1));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x += 35.0f/640.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_SIZE2);
+ pos.x += 35.0f / 640.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_SIZE2));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x += 35.0f/640.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_SIZE3);
+ pos.x += 35.0f / 640.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_SIZE3));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x += 35.0f/640.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_SIZE4);
+ pos.x += 35.0f / 640.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_SIZE4));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x += 35.0f/640.0f;
- dim.x = 18.0f/640.0f;
- slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE);
+ pos.x += 35.0f / 640.0f;
+ dim.x = 18.0f / 640.0f;
+ slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE));
if ( slider != 0 )
{
slider->SetPos(pos);
slider->SetDim(dim);
}
- pos.x += 50.0f/640.0f;
- dim.x = 32.0f/640.0f;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_COPY);
+ pos.x += 50.0f / 640.0f;
+ dim.x = 32.0f / 640.0f;
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_COPY));
if ( button != 0 )
{
button->SetPos(pos);
button->SetDim(dim);
}
- pos.x = (50.0f+10.0f)/640.0f;
- pos.y = (30.0f+10.0f+24.0f+10.0f+324.0f+6.0f)/480.0f;
- dim.x = 48.0f/640.0f;
- dim.y = 40.0f/480.0f;
- group = (CGroup*)pw->SearchControl(EVENT_LABEL2); // symbol SatCom
+ pos.x = (50.0f + 10.0f) / 640.0f;
+ pos.y = (30.0f + 10.0f + 24.0f + 10.0f + 324.0f + 6.0f) / 480.0f;
+ dim.x = 48.0f / 640.0f;
+ dim.y = 40.0f / 480.0f;
+ group = static_cast<Ui::CGroup*>(pw->SearchControl(EVENT_LABEL2)); // symbol SatCom
if ( group != 0 )
{
group->SetPos(pos);
group->SetDim(dim);
}
- pos.x = (50.0f+10.0f+14.0f)/640.0f;
- pos.y = (30.0f+10.0f+6.0f)/480.0f;
- dim.x = 20.0f/640.0f;
- dim.y = 20.0f/480.0f;
- group = (CGroup*)pw->SearchControl(EVENT_LABEL3); // symbol stand-by
+ pos.x = (50.0f + 10.0f + 14.0f) / 640.0f;
+ pos.y = (30.0f + 10.0f + 6.0f) / 480.0f;
+ dim.x = 20.0f / 640.0f;
+ dim.y = 20.0f / 480.0f;
+ group = static_cast<Ui::CGroup*>(pw->SearchControl(EVENT_LABEL3)); // symbol stand-by
if ( group != 0 )
{
group->SetPos(pos);
@@ -661,26 +665,26 @@ void CDisplayInfo::AdjustDisplayInfo(Math::Point wpos, Math::Point wdim)
void CDisplayInfo::ChangeIndexButton(int index)
{
- CWindow* pw;
- CEdit* edit;
+ Ui::CWindow* pw;
+ Ui::CEdit* edit;
char* filename;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
if ( m_index != -1 )
{
- m_main->SetDisplayInfoPosition(m_index, RetPosition());
+ m_main->SetDisplayInfoPosition(m_index, GetPosition());
}
m_index = index;
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 )
{
- filename = m_main->RetDisplayInfoName(m_index);
+ filename = m_main->GetDisplayInfoName(m_index);
edit->ReadText(filename);
edit->HyperHome(filename);
- SetPosition(m_main->RetDisplayInfoPosition(m_index));
+ SetPosition(m_main->GetDisplayInfoPosition(m_index));
}
UpdateIndexButton();
@@ -690,10 +694,10 @@ void CDisplayInfo::ChangeIndexButton(int index)
void CDisplayInfo::UpdateIndexButton()
{
- CWindow* pw;
- CButton* button;
- CGroup* group;
- CEdit* edit;
+ Ui::CWindow* pw;
+ Ui::CButton* button;
+ Ui::CGroup* group;
+ Ui::CEdit* edit;
Math::Point pos, dim;
char* filename;
char* loading;
@@ -708,10 +712,10 @@ void CDisplayInfo::UpdateIndexButton()
4, // SATCOM_SOLUCE
};
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_HUSTON);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_HUSTON));
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_HUSTON);
@@ -719,7 +723,7 @@ void CDisplayInfo::UpdateIndexButton()
button->SetState(STATE_VISIBLE, filename[0]!=0);
}
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_SAT);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_SAT));
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_SAT);
@@ -736,7 +740,7 @@ void CDisplayInfo::UpdateIndexButton()
//? }
loading = 0;
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_LOADING);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_LOADING));
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_LOADING);
@@ -744,7 +748,7 @@ void CDisplayInfo::UpdateIndexButton()
button->SetState(STATE_VISIBLE, loading[0]!=0);
}
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_PROG);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_PROG));
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_PROG);
@@ -752,7 +756,7 @@ void CDisplayInfo::UpdateIndexButton()
button->SetState(STATE_VISIBLE, filename[0]!=0 && (m_index==SATCOM_LOADING||m_index==SATCOM_PROG||(loading!=0&&loading[0]==0)));
}
- button = (CButton*)pw->SearchControl(EVENT_SATCOM_SOLUCE);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_SATCOM_SOLUCE));
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_SOLUCE);
@@ -760,7 +764,7 @@ void CDisplayInfo::UpdateIndexButton()
button->SetState(STATE_VISIBLE, filename[0]!=0 && m_bSoluce);
}
- group = (CGroup*)pw->SearchControl(EVENT_LABEL1);
+ group = static_cast<Ui::CGroup*>(pw->SearchControl(EVENT_LABEL1));
if ( group != 0 )
{
if ( m_index == -1 )
@@ -789,7 +793,7 @@ void CDisplayInfo::UpdateIndexButton()
}
#endif
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit != 0 )
{
//? edit->SetHiliteCap(m_index==SATCOM_LOADING);
@@ -803,20 +807,20 @@ void CDisplayInfo::UpdateIndexButton()
void CDisplayInfo::UpdateCopyButton()
{
- CWindow* pw;
- CButton* button;
- CEdit* edit;
+ Ui::CWindow* pw;
+ Ui::CButton* button;
+ Ui::CEdit* edit;
int c1, c2;
//? if ( m_index != SATCOM_LOADING ) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
- button = (CButton*)pw->SearchControl(EVENT_HYPER_COPY);
+ button = static_cast<Ui::CButton*>(pw->SearchControl(EVENT_HYPER_COPY));
if ( button == 0 ) return;
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return;
edit->GetCursor(c1, c2);
@@ -828,10 +832,10 @@ void CDisplayInfo::UpdateCopyButton()
void CDisplayInfo::StopDisplayInfo()
{
- CWindow* pw;
+ Ui::CWindow* pw;
CMotionToto* toto;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
m_interface->DeleteControl(EVENT_WINDOW4);
@@ -853,13 +857,13 @@ void CDisplayInfo::StopDisplayInfo()
m_engine->SetDrawWorld(true); // draws all on the interface
m_engine->SetDrawFront(false); // draws nothing on the interface
- m_particule->SetFrameUpdate(SH_WORLD, true);
- m_particule->FlushParticule(SH_FRONT);
- m_particule->FlushParticule(SH_INTERFACE);
+ m_particle->SetFrameUpdate(Gfx::SH_WORLD, true);
+ m_particle->FlushParticule(Gfx::SH_FRONT);
+ m_particle->FlushParticule(Gfx::SH_INTERFACE);
if ( m_toto != 0 )
{
- toto = (CMotionToto*)m_toto->RetMotion();
+ toto = (CMotionToto*)m_toto->GetMotion();
if ( toto != 0 )
{
toto->StopDisplayInfo();
@@ -875,13 +879,13 @@ void CDisplayInfo::StopDisplayInfo()
void CDisplayInfo::SetPosition(int pos)
{
- CWindow* pw;
- CEdit* edit;
+ Ui::CWindow* pw;
+ Ui::CEdit* edit;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return;
edit->SetFirstLine(pos);
@@ -889,18 +893,18 @@ void CDisplayInfo::SetPosition(int pos)
// Returns the position.
-int CDisplayInfo::RetPosition()
+int CDisplayInfo::GetPosition()
{
- CWindow* pw;
- CEdit* edit;
+ Ui::CWindow* pw;
+ Ui::CEdit* edit;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return 0;
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return 0;
- return edit->RetFirstLine();
+ return edit->GetFirstLine();
}
@@ -909,18 +913,18 @@ int CDisplayInfo::RetPosition()
void CDisplayInfo::ViewDisplayInfo()
{
- CWindow* pw;
- CEdit* edit;
- POINT dim;
+ Ui::CWindow* pw;
+ Ui::CEdit* edit;
+ Math::Point dim;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
- edit = (CEdit*)pw->SearchControl(EVENT_EDIT1);
+ edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return;
- dim = m_engine->RetDim();
- edit->SetFontSize(m_main->RetFontSize()/(dim.x/640.0f));
+ dim = m_engine->GetDim();
+ edit->SetFontSize(m_main->GetFontSize()/(dim.x / 640.0f));
}
// Returns the object human.
@@ -936,7 +940,7 @@ CObject* CDisplayInfo::SearchToto()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_TOTO )
{
return pObj;
@@ -995,7 +999,7 @@ void ObjectWrite(FILE* file, ObjectList list[], int i)
strcat(line, res);
strcat(line, "\\u ");
- p = RetHelpFilename(list[i].type);
+ p = GetHelpFilename(list[i].type);
if ( p[0] == 0 ) return;
strcat(line, p+5); // skip "help\"
p = strstr(line, ".txt");
@@ -1026,11 +1030,11 @@ void CDisplayInfo::CreateObjectsFile()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( !pObj->RetActif() ) continue;
- if ( !pObj->RetSelectable() ) continue;
- if ( pObj->RetProxyActivate() ) continue;
+ if ( !pObj->GetActif() ) continue;
+ if ( !pObj->GetSelectable() ) continue;
+ if ( pObj->GetProxyActivate() ) continue;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_NULL ) continue;
if ( type == OBJECT_FIX ) continue;
@@ -1217,3 +1221,4 @@ void CDisplayInfo::CreateObjectsFile()
}
+}
diff --git a/src/ui/displayinfo.h b/src/ui/displayinfo.h
index 29677d4..1eaa39b 100644
--- a/src/ui/displayinfo.h
+++ b/src/ui/displayinfo.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -24,20 +25,29 @@
class CInstanceManager;
-class CD3DEngine;
+//class CD3DEngine;
class CEvent;
class CRobotMain;
-class CCamera;
-class CInterface;
+//class CCamera;
+
class CObject;
-class CParticule;
+//class CLight;
+
+namespace Gfx {
+class CEngine;
+class Camera;
+class Particle;
class CLight;
+}
+namespace Ui {
+class CInterface;
class CDisplayInfo
{
public:
- CDisplayInfo(CInstanceManager* iMan);
+// CDisplayInfo(CInstanceManager* iMan);
+ CDisplayInfo();
~CDisplayInfo();
bool EventProcess(const Event &event);
@@ -46,7 +56,7 @@ public:
void StopDisplayInfo();
void SetPosition(int pos);
- int RetPosition();
+ int GetPosition();
protected:
bool EventFrame(const Event &event);
@@ -61,19 +71,19 @@ protected:
protected:
CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CEvent* m_event;
+ Gfx::CEngine* m_engine;
+ CEventQueue* m_event;
CRobotMain* m_main;
- CCamera* m_camera;
+ Gfx::CCamera* m_camera;
CInterface* m_interface;
- CParticule* m_particule;
- CLight* m_light;
+ Gfx::CParticle* m_particle;
+ Gfx::CLight* m_light;
bool m_bInfoMaximized;
bool m_bInfoMinimized;
int m_index;
- CameraType m_infoCamera;
+ Gfx::CameraType m_infoCamera;
Math::Point m_infoNormalPos;
Math::Point m_infoNormalDim;
Math::Point m_infoActualPos;
@@ -88,3 +98,4 @@ protected:
};
+}
diff --git a/src/ui/displaytext.cpp b/src/ui/displaytext.cpp
index 9be81f4..3fe8cdb 100644
--- a/src/ui/displaytext.cpp
+++ b/src/ui/displaytext.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,12 +18,13 @@
// displaytext.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/restext.h"
@@ -35,28 +37,31 @@
#include "ui/label.h"
#include "ui/window.h"
#include "ui/group.h"
-#include "old/text.h"
-#include "old/sound.h"
+//#include "old/text.h"
+//#include "old/sound.h"
+//#include "sound/sound.h"
#include "ui/displaytext.h"
-
+namespace Ui {
const float FONTSIZE = 12.0f;
// Object's constructor.
-CDisplayText::CDisplayText(CInstanceManager* iMan)
+//CDisplayText::CDisplayText(CInstanceManager* iMan)
+CDisplayText::CDisplayText()
{
int i;
- m_iMan = iMan;
+// m_iMan = iMan;
+ m_iMan = CInstanceManager::GetInstancePointer();
m_iMan->AddInstance(CLASS_DISPLAYTEXT, this);
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
+ m_engine = (Gfx::CEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE);
- m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
+ m_sound = (CSoundInterface*)m_iMan->SearchInstance(CLASS_SOUND);
for ( i=0 ; i<MAXDTLINE ; i++ )
{
@@ -94,9 +99,9 @@ bool CDisplayText::EventProcess(const Event &event)
{
int i;
- if ( m_engine->RetPause() ) return true;
+ if ( m_engine->GetPause() ) return true;
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
for ( i=0 ; i<MAXDTLINE ; i++ )
{
@@ -124,9 +129,9 @@ void CDisplayText::DisplayError(Error err, CObject* pObj, float time)
if ( pObj == 0 ) return;
- pos = pObj->RetPosition(0);
- h = RetIdealHeight(pObj);
- d = RetIdealDist(pObj);
+ pos = pObj->GetPosition(0);
+ h = GetIdealHeight(pObj);
+ d = GetIdealDist(pObj);
DisplayError(err, pos, h, d, time);
}
@@ -178,7 +183,7 @@ void CDisplayText::DisplayError(Error err, Math::Vector goal, float height,
// Displays text.
-void CDisplayText::DisplayText(char *text, CObject* pObj,
+void CDisplayText::DisplayText(const char *text, CObject* pObj,
float time, TextType type)
{
Math::Vector pos;
@@ -186,23 +191,23 @@ void CDisplayText::DisplayText(char *text, CObject* pObj,
if ( pObj == 0 ) return;
- pos = pObj->RetPosition(0);
- h = RetIdealHeight(pObj);
- d = RetIdealDist(pObj);
+ pos = pObj->GetPosition(0);
+ h = GetIdealHeight(pObj);
+ d = GetIdealDist(pObj);
DisplayText(text, pos, h, d, time, type);
}
// Displays text.
-void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
+void CDisplayText::DisplayText(const char *text, Math::Vector goal, float height,
float dist, float time, TextType type)
{
CObject* toto;
CMotion* motion;
- CWindow* pw;
- CButton* button;
- CGroup* group;
- CLabel* label;
+ Ui::CWindow* pw;
+ Ui::CButton* button;
+ Ui::CGroup* group;
+ Ui::CLabel* label;
Math::Point pos, ppos, dim;
Sound sound;
float hLine, hBox;
@@ -210,7 +215,7 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
if ( !m_bEnable ) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
+ pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 )
{
pos.x = 0.0f;
@@ -221,12 +226,12 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
}
hBox = 0.045f;
- hLine = m_engine->RetText()->RetHeight(FONTSIZE, FONT_COLOBOT);
+ hLine = m_engine->GetText()->GetHeight(Gfx::FONT_COLOBOT, FONTSIZE);
nLine = 0;
for ( i=0 ; i<MAXDTLINE ; i++ )
{
- group = (CGroup*)pw->SearchControl(EventMsg(EVENT_DT_GROUP0+i));
+ group = static_cast<CGroup*>(pw->SearchControl(EventType(EVENT_DT_GROUP0+i)));
if ( group == 0 ) break;
nLine ++;
}
@@ -247,13 +252,13 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
if ( type == TT_WARNING ) icon = 10; // blue
if ( type == TT_INFO ) icon = 8; // green
if ( type == TT_MESSAGE ) icon = 11; // yellow
- pw->CreateGroup(pos, dim, icon, EventMsg(EVENT_DT_GROUP0+nLine));
+ pw->CreateGroup(pos, dim, icon, EventType(EVENT_DT_GROUP0+nLine));
pw->SetTrashEvent(false);
ppos = pos;
ppos.y -= hLine/2.0f;
- label = pw->CreateLabel(ppos, dim, -1, EventMsg(EVENT_DT_LABEL0+nLine), text);
+ label = pw->CreateLabel(ppos, dim, -1, EventType(EVENT_DT_LABEL0+nLine), text);
if ( label != 0 )
{
label->SetFontSize(FONTSIZE);
@@ -261,7 +266,7 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
dim.x = dim.y*0.75f;
pos.x -= dim.x;
- button = pw->CreateButton(pos, dim, 14, EventMsg(EVENT_DT_VISIT0+nLine));
+ button = pw->CreateButton(pos, dim, 14, EventType(EVENT_DT_VISIT0+nLine));
if ( goal.x == 0.0f &&
goal.y == 0.0f &&
@@ -279,7 +284,7 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
toto = SearchToto();
if ( toto != 0 )
{
- motion = toto->RetMotion();
+ motion = toto->GetMotion();
if ( motion != 0 )
{
if ( type == TT_ERROR )
@@ -324,18 +329,18 @@ void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
void CDisplayText::ClearText()
{
- CWindow* pw;
+ Ui::CWindow* pw;
int i;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
for ( i=0 ; i<MAXDTLINE ; i++ )
{
if ( pw != 0 )
{
- pw->DeleteControl(EventMsg(EVENT_DT_GROUP0+i));
- pw->DeleteControl(EventMsg(EVENT_DT_LABEL0+i));
- pw->DeleteControl(EventMsg(EVENT_DT_VISIT0+i));
+ pw->DeleteControl(EventType(EVENT_DT_GROUP0+i));
+ pw->DeleteControl(EventType(EVENT_DT_LABEL0+i));
+ pw->DeleteControl(EventType(EVENT_DT_VISIT0+i));
}
m_bExist[i] = false;
m_visitGoal[i] = Math::Vector(0.0f, 0.0f, 0.0f);
@@ -349,32 +354,32 @@ void CDisplayText::ClearText()
void CDisplayText::HideText(bool bHide)
{
- CWindow* pw;
- CGroup* pg;
- CLabel* pl;
- CButton* pb;
+ Ui::CWindow* pw;
+ Ui::CGroup* pg;
+ Ui::CLabel* pl;
+ Ui::CButton* pb;
int i;
m_bHide = bHide;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 ) return;
for ( i=0 ; i<MAXDTLINE ; i++ )
{
- pg = (CGroup*)pw->SearchControl(EventMsg(EVENT_DT_GROUP0+i));
+ pg = static_cast<Ui::CGroup*>(pw->SearchControl(EventType(EVENT_DT_GROUP0+i)));
if ( pg != 0 )
{
pg->SetState(STATE_VISIBLE, !bHide);
}
- pl = (CLabel* )pw->SearchControl(EventMsg(EVENT_DT_LABEL0+i));
+ pl = static_cast<Ui::CLabel*>(pw->SearchControl(EventType(EVENT_DT_LABEL0+i)));
if ( pl != 0 )
{
pl->SetState(STATE_VISIBLE, !bHide);
}
- pb = (CButton*)pw->SearchControl(EventMsg(EVENT_DT_VISIT0+i));
+ pb = static_cast<CButton*>(pw->SearchControl(EventType(EVENT_DT_VISIT0+i)));
if ( pb != 0 )
{
pb->SetState(STATE_VISIBLE, !bHide);
@@ -386,20 +391,20 @@ void CDisplayText::HideText(bool bHide)
bool CDisplayText::ClearLastText()
{
- CWindow *pw;
- CButton *pb1, *pb2;
- CGroup *pg1, *pg2;
- CLabel *pl1, *pl2;
+ Ui::CWindow *pw;
+ Ui::CButton *pb1, *pb2;
+ Ui::CGroup *pg1, *pg2;
+ Ui::CLabel *pl1, *pl2;
int i;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
+ pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 ) return false;
- pb2 = (CButton*)pw->SearchControl(EVENT_DT_VISIT0);
+ pb2 = static_cast<CButton*>(pw->SearchControl(EVENT_DT_VISIT0));
if ( pb2 == 0 ) return false; // same not of first-line
- pg2 = (CGroup*)pw->SearchControl(EVENT_DT_GROUP0);
+ pg2 = static_cast<CGroup*>(pw->SearchControl(EVENT_DT_GROUP0));
if ( pg2 == 0 ) return false;
- pl2 = (CLabel*)pw->SearchControl(EVENT_DT_LABEL0);
+ pl2 = static_cast<CLabel*>(pw->SearchControl(EVENT_DT_LABEL0));
if ( pl2 == 0 ) return false;
for ( i=0 ; i<MAXDTLINE-1 ; i++ )
@@ -408,18 +413,18 @@ bool CDisplayText::ClearLastText()
pg1 = pg2;
pl1 = pl2;
- pb2 = (CButton*)pw->SearchControl(EventMsg(EVENT_DT_VISIT0+i+1));
+ pb2 = static_cast<CButton*>(pw->SearchControl(EventType(EVENT_DT_VISIT0+i+1)));
if ( pb2 == 0 ) break;
- pg2 = (CGroup*)pw->SearchControl(EventMsg(EVENT_DT_GROUP0+i+1));
+ pg2 = static_cast<CGroup*>(pw->SearchControl(EventType(EVENT_DT_GROUP0+i+1)));
if ( pg2 == 0 ) break;
- pl2 = (CLabel*)pw->SearchControl(EventMsg(EVENT_DT_LABEL0+i+1));
+ pl2 = static_cast<CLabel*>(pw->SearchControl(EventType(EVENT_DT_LABEL0+i+1)));
if ( pl2 == 0 ) break;
pb1->SetState(STATE_ENABLE, pb2->TestState(STATE_ENABLE));
- pg1->SetIcon(pg2->RetIcon());
- pl1->SetName(pl2->RetName());
+ pg1->SetIcon(pg2->GetIcon());
+ pl1->SetName(pl2->GetName());
m_time[i] = m_time[i+1];
m_visitGoal[i] = m_visitGoal[i+1];
@@ -427,9 +432,9 @@ bool CDisplayText::ClearLastText()
m_visitHeight[i] = m_visitHeight[i+1]; // shift
}
- pw->DeleteControl(EventMsg(EVENT_DT_VISIT0+i));
- pw->DeleteControl(EventMsg(EVENT_DT_GROUP0+i));
- pw->DeleteControl(EventMsg(EVENT_DT_LABEL0+i));
+ pw->DeleteControl(EventType(EVENT_DT_VISIT0+i));
+ pw->DeleteControl(EventType(EVENT_DT_GROUP0+i));
+ pw->DeleteControl(EventType(EVENT_DT_LABEL0+i));
m_bExist[i] = false;
return true;
}
@@ -453,7 +458,7 @@ void CDisplayText::SetEnable(bool bEnable)
// Returns the goal during a visit.
-Math::Vector CDisplayText::RetVisitGoal(EventMsg event)
+Math::Vector CDisplayText::GetVisitGoal(EventType event)
{
int i;
@@ -464,7 +469,7 @@ Math::Vector CDisplayText::RetVisitGoal(EventMsg event)
// Returns the distance during a visit.
-float CDisplayText::RetVisitDist(EventMsg event)
+float CDisplayText::GetVisitDist(EventType event)
{
int i;
@@ -475,7 +480,7 @@ float CDisplayText::RetVisitDist(EventMsg event)
// Returns the height on a visit.
-float CDisplayText::RetVisitHeight(EventMsg event)
+float CDisplayText::GetVisitHeight(EventType event)
{
int i;
@@ -487,13 +492,13 @@ float CDisplayText::RetVisitHeight(EventMsg event)
// Ranges from ideal visit for a given object.
-float CDisplayText::RetIdealDist(CObject* pObj)
+float CDisplayText::GetIdealDist(CObject* pObj)
{
ObjectType type;
if ( pObj == 0 ) return 40.0f;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_PORTICO ) return 200.0f;
if ( type == OBJECT_BASE ) return 200.0f;
if ( type == OBJECT_NUCLEAR ) return 100.0f;
@@ -506,13 +511,13 @@ float CDisplayText::RetIdealDist(CObject* pObj)
// Returns the height of ideal visit for a given object.
-float CDisplayText::RetIdealHeight(CObject* pObj)
+float CDisplayText::GetIdealHeight(CObject* pObj)
{
ObjectType type;
if ( pObj == 0 ) return 5.0f;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_DERRICK ) return 35.0f;
if ( type == OBJECT_FACTORY ) return 22.0f;
if ( type == OBJECT_REPAIR ) return 30.0f;
@@ -537,16 +542,16 @@ float CDisplayText::RetIdealHeight(CObject* pObj)
void CDisplayText::ClearVisit()
{
- CWindow* pw;
- CButton* pb;
+ Ui::CWindow* pw;
+ Ui::CButton* pb;
int i;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
+ pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 ) return;
for ( i=0 ; i<MAXDTLINE ; i++ )
{
- pb = (CButton*)pw->SearchControl(EventMsg(EVENT_DT_VISIT0+i));
+ pb = static_cast<CButton*>(pw->SearchControl(EventType(EVENT_DT_VISIT0+i)));
if ( pb == 0 ) break;
pb->SetIcon(14); // eyes
}
@@ -554,38 +559,38 @@ void CDisplayText::ClearVisit()
// Puts a button in "visit".
-void CDisplayText::SetVisit(EventMsg event)
+void CDisplayText::SetVisit(EventType event)
{
- CWindow* pw;
- CButton* pb;
+ Ui::CWindow* pw;
+ Ui::CButton* pb;
int i;
i = event-EVENT_DT_VISIT0;
if ( i < 0 || i >= MAXDTLINE ) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
+ pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 ) return;
- pb = (CButton*)pw->SearchControl(EventMsg(EVENT_DT_VISIT0+i));
+ pb = static_cast<CButton*>(pw->SearchControl(EventType(EVENT_DT_VISIT0+i)));
if ( pb == 0 ) return;
pb->SetIcon(48); // >
}
// Indicates whether a button is set to "visit".
-bool CDisplayText::IsVisit(EventMsg event)
+bool CDisplayText::IsVisit(EventType event)
{
- CWindow* pw;
- CButton* pb;
+ Ui::CWindow* pw;
+ Ui::CButton* pb;
int i;
i = event-EVENT_DT_VISIT0;
if ( i < 0 || i >= MAXDTLINE ) return false;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
+ pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
if ( pw == 0 ) return false;
- pb = (CButton*)pw->SearchControl(EventMsg(EVENT_DT_VISIT0+i));
+ pb = static_cast<CButton*>(pw->SearchControl(EventType(EVENT_DT_VISIT0+i)));
if ( pb == 0 ) return false;
- return (pb->RetIcon() == 48); // > ?
+ return (pb->GetIcon() == 48); // > ?
}
@@ -599,10 +604,10 @@ CObject* CDisplayText::SearchToto()
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_TOTO )
{
return pObj;
@@ -611,3 +616,4 @@ CObject* CDisplayText::SearchToto()
return 0;
}
+}
diff --git a/src/ui/displaytext.h b/src/ui/displaytext.h
index c2eea98..9268088 100644
--- a/src/ui/displaytext.h
+++ b/src/ui/displaytext.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -21,15 +22,18 @@
#include "common/event.h"
#include "common/misc.h"
-#include "old/d3dengine.h"
+#include "sound/sound.h"
+//#include "old/d3dengine.h"
class CInstanceManager;
-class CD3DEngine;
-class CInterface;
+//class CD3DEngine
class CObject;
class CSound;
+namespace Ui {;
+
+class CInterface;
enum TextType
{
@@ -45,7 +49,8 @@ const int MAXDTLINE = 4;
class CDisplayText
{
public:
- CDisplayText(CInstanceManager* iMan);
+// CDisplayText(CInstanceManager* iMan);
+ CDisplayText();
~CDisplayText();
void DeleteObject();
@@ -54,33 +59,33 @@ public:
void DisplayError(Error err, CObject* pObj, float time=10.0f);
void DisplayError(Error err, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f);
- void DisplayText(char *text, CObject* pObj, float time=10.0f, TextType type=TT_INFO);
- void DisplayText(char *text, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f, TextType type=TT_INFO);
+ void DisplayText(const char *text, CObject* pObj, float time=10.0f, TextType type=TT_INFO);
+ void DisplayText(const char *text, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f, TextType type=TT_INFO);
void HideText(bool bHide);
void ClearText();
bool ClearLastText();
void SetDelay(float factor);
void SetEnable(bool bEnable);
- Math::Vector RetVisitGoal(EventMsg event);
- float RetVisitDist(EventMsg event);
- float RetVisitHeight(EventMsg event);
+ Math::Vector GetVisitGoal(EventType event);
+ float GetVisitDist(EventType event);
+ float GetVisitHeight(EventType event);
- float RetIdealDist(CObject* pObj);
- float RetIdealHeight(CObject* pObj);
+ float GetIdealDist(CObject* pObj);
+ float GetIdealHeight(CObject* pObj);
void ClearVisit();
- void SetVisit(EventMsg event);
- bool IsVisit(EventMsg event);
+ void SetVisit(EventType event);
+ bool IsVisit(EventType event);
protected:
CObject* SearchToto();
protected:
CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CInterface* m_interface;
- CSound* m_sound;
+ Gfx::CEngine* m_engine;
+ Ui::CInterface* m_interface;
+ CSoundInterface* m_sound;
bool m_bExist[MAXDTLINE];
float m_time[MAXDTLINE];
@@ -94,3 +99,4 @@ protected:
};
+}
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index 58a8b7d..86f0011 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -20,34 +21,41 @@
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
-#include <windows.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
#include "common/language.h"
-#include "old/math3d.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
#include "common/restext.h"
#include "ui/scroll.h"
-#include "old/text.h"
+//#include "old/text.h"
+#include "graphics/engine/text.h"
+//#include "graphics/engine/color.h"
#include "ui/edit.h"
+namespace Ui {
const float MARGX = (5.0f/640.0f);
const float MARGY = (5.0f/480.0f);
const float MARGYS = (4.0f/480.0f);
const float MARGY1 = (1.0f/480.0f);
-const float DELAY_DBCLICK = 0.3f; // time limit for double-click
-const float DELAY_SCROLL = 0.1f; // time limit for scroll
-const float BIG_FONT = 1.6f; // expansion for \b;
+//! time limit for double-click
+const float DELAY_DBCLICK = 0.3f;
+//! time limit for scroll
+const float DELAY_SCROLL = 0.1f;
+//! expansion for \b;
+const float BIG_FONT = 1.6f;
-// Indicates whether a character is a space.
+//! Indicates whether a character is a space.
bool IsSpace(int character)
{
@@ -56,20 +64,20 @@ bool IsSpace(int character)
character == '\n' );
}
-// Indicates whether a character is part of a word.
+//! Indicates whether a character is part of a word.
bool IsWord(int character)
{
char c;
- c = tolower(RetNoAccent(character));
+ c = tolower(GetNoAccent(character));
return ( (c >= 'a' && c <= 'z') ||
(c >= '0' && c <= '9') ||
c == '_' );
}
-// Indicates whether a character is a word separator.
+//! Indicates whether a character is a word separator.
bool IsSep(int character)
{
@@ -79,19 +87,20 @@ bool IsSep(int character)
-// Object's constructor.
+//! Object's constructor.
-CEdit::CEdit(CInstanceManager* iMan) : CControl(iMan)
+//CEdit::CEdit(CInstanceManager* iMan) : CControl(iMan)
+CEdit::CEdit () : CControl ()
{
Math::Point pos;
int i;
m_maxChar = 100;
- m_text = (char*)malloc(sizeof(char)*(m_maxChar+1));
+ m_text = new char* [sizeof(char)*(m_maxChar+1)]; // TODO
m_format = 0;
m_len = 0;
- m_fontType = FONT_COURIER;
+ m_fontType = Gfx::FONT_COURIER;
m_scroll = 0;
m_bEdit = true;
m_bHilite = true;
@@ -137,13 +146,13 @@ CEdit::~CEdit()
// Creates a new editable line.
-bool CEdit::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CEdit::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
CScroll* pc;
Math::Point start, end;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
- CControl::Create(pos, dim, icon, eventMsg);
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
+ CControl::Create(pos, dim, icon, eventType);
m_len = 0;
m_lineFirst = 0;
@@ -162,8 +171,8 @@ bool CEdit::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg
{
m_bMulti = true;
MoveAdjust(); // readjusts multi-line mode
- m_scroll = new CScroll(m_iMan);
- pc = (CScroll*)m_scroll;
+ m_scroll = new Ui::CScroll();
+ pc = static_cast<CScroll*>(m_scroll);
pc->Create(pos, dim, -1, EVENT_NULL);
MoveAdjust();
}
@@ -189,25 +198,25 @@ void CEdit::MoveAdjust()
Math::Point pos, dim;
float height;
- m_lineDescent = m_engine->RetText()->RetDescent(m_fontSize, m_fontType);
- m_lineAscent = m_engine->RetText()->RetAscent(m_fontSize, m_fontType);
- m_lineHeight = m_engine->RetText()->RetHeight(m_fontSize, m_fontType);
+ m_lineDescent = m_engine->GetText()->GetDescent(m_fontType, m_fontSize);
+ m_lineAscent = m_engine->GetText()->GetAscent(m_fontType, m_fontSize);
+ m_lineHeight = m_engine->GetText()->GetHeight(m_fontType, m_fontSize);
height = m_dim.y-(m_bMulti?MARGY*2.0f:MARGY1);
- m_lineVisible = (int)(height/m_lineHeight);
+ m_lineVisible = static_cast<int>((height/m_lineHeight));
if ( m_scroll != 0 )
{
if ( m_bInsideScroll )
{
- pos.x = m_pos.x+m_dim.x-MARGX-SCROLL_WIDTH;
- pos.y = m_pos.y+MARGYS;
+ pos.x = m_pos.x + m_dim.x - MARGX-SCROLL_WIDTH;
+ pos.y = m_pos.y + MARGYS;
dim.x = SCROLL_WIDTH;
- dim.y = m_dim.y-MARGYS*2.0f;
+ dim.y = m_dim.y - MARGYS*2.0f;
}
else
{
- pos.x = m_pos.x+m_dim.x-SCROLL_WIDTH;
+ pos.x = m_pos.x + m_dim.x - SCROLL_WIDTH;
pos.y = m_pos.y;
dim.x = SCROLL_WIDTH;
dim.y = m_dim.y;
@@ -238,15 +247,15 @@ bool CEdit::EventProcess(const Event &event)
if ( (m_state & STATE_VISIBLE) == 0 ) return true;
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELUP &&
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 5 &&
Detect(event.pos) )
{
Scroll(m_lineFirst-3, true);
return true;
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELDOWN &&
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 4 && // TODO
Detect(event.pos) )
{
Scroll(m_lineFirst+3, true);
@@ -255,30 +264,30 @@ bool CEdit::EventProcess(const Event &event)
CControl::EventProcess(event);
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
m_time += event.rTime;
m_timeBlink += event.rTime;
}
- if ( event.event == EVENT_MOUSEMOVE )
+ if ( event.type == EVENT_MOUSE_MOVE )
{
if ( Detect(event.pos) &&
event.pos.x < m_pos.x+m_dim.x-(m_bMulti?MARGX+SCROLL_WIDTH:0.0f) )
{
if ( m_bEdit )
{
- m_engine->SetMouseType(D3DMOUSEEDIT);
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_EDIT);
}
else
{
if ( IsLinkPos(event.pos) )
{
- m_engine->SetMouseType(D3DMOUSEHAND);
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_HAND);
}
else
{
- m_engine->SetMouseType(D3DMOUSENORM);
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
}
}
}
@@ -288,32 +297,32 @@ bool CEdit::EventProcess(const Event &event)
{
m_scroll->EventProcess(event);
- if ( event.event == m_scroll->RetEventMsg() )
+ if ( event.type == m_scroll->GetEventType() )
{
Scroll();
return true;
}
}
- if ( event.event == EVENT_KEYDOWN && m_bFocus )
+ if ( event.type == EVENT_KEY_DOWN && m_bFocus )
{
bShift = (event.keyState&KS_SHIFT);
bControl = (event.keyState&KS_CONTROL);
if ( (event.param == 'X' && !bShift && bControl) ||
- (event.param == VK_DELETE && bShift && !bControl) )
+ (event.param == KEY(DELETE) && bShift && !bControl) )
{
Cut();
return true;
}
if ( (event.param == 'C' && !bShift && bControl) ||
- (event.param == VK_INSERT && !bShift && bControl) )
+ (event.param == KEY(INSERT) && !bShift && bControl) )
{
Copy();
return true;
}
if ( (event.param == 'V' && !bShift && bControl) ||
- (event.param == VK_INSERT && bShift && !bControl) )
+ (event.param == KEY(INSERT) && bShift && !bControl) )
{
Paste();
return true;
@@ -327,14 +336,14 @@ bool CEdit::EventProcess(const Event &event)
if ( event.param == 'O' && !bShift && bControl )
{
- Event newEvent;
- m_event->MakeEvent(newEvent, EVENT_STUDIO_OPEN);
+ Event newEvent(EVENT_STUDIO_OPEN);
+// m_event->NewEvent(newEvent, EVENT_STUDIO_OPEN);
m_event->AddEvent(newEvent);
}
if ( event.param == 'S' && !bShift && bControl )
{
- Event newEvent;
- m_event->MakeEvent(newEvent, EVENT_STUDIO_SAVE);
+ Event newEvent( EVENT_STUDIO_SAVE );
+// m_event->MakeEvent(newEvent, EVENT_STUDIO_SAVE);
m_event->AddEvent(newEvent);
}
@@ -353,44 +362,44 @@ bool CEdit::EventProcess(const Event &event)
if ( MinMaj(true) ) return true;
}
- if ( event.param == VK_TAB && !bShift && !bControl && !m_bAutoIndent )
+ if ( event.param == KEY(TAB) && !bShift && !bControl && !m_bAutoIndent )
{
if ( Shift(false) ) return true;
}
- if ( event.param == VK_TAB && bShift && !bControl && !m_bAutoIndent )
+ if ( event.param == KEY(TAB) && bShift && !bControl && !m_bAutoIndent )
{
if ( Shift(true) ) return true;
}
if ( m_bEdit )
{
- if ( event.param == VK_LEFT )
+ if ( event.param == KEY(LEFT) )
{
MoveChar(-1, bControl, bShift);
return true;
}
- if ( event.param == VK_RIGHT )
+ if ( event.param == KEY(RIGHT) )
{
MoveChar(1, bControl, bShift);
return true;
}
- if ( event.param == VK_UP )
+ if ( event.param == KEY(UP) )
{
MoveLine(-1, bControl, bShift);
return true;
}
- if ( event.param == VK_DOWN )
+ if ( event.param == KEY(DOWN) )
{
MoveLine(1, bControl, bShift);
return true;
}
- if ( event.param == VK_PRIOR ) // PageUp ?
+ if ( event.param == KEY(PAGEUP) ) // PageUp ?
{
MoveLine(-(m_lineVisible-1), bControl, bShift);
return true;
}
- if ( event.param == VK_NEXT ) // PageDown ?
+ if ( event.param == KEY(PAGEDOWN) ) // PageDown ?
{
MoveLine(m_lineVisible-1, bControl, bShift);
return true;
@@ -398,62 +407,62 @@ bool CEdit::EventProcess(const Event &event)
}
else
{
- if ( event.param == VK_LEFT ||
- event.param == VK_UP )
+ if ( event.param == KEY(LEFT) ||
+ event.param == KEY(UP) )
{
Scroll(m_lineFirst-1, true);
return true;
}
- if ( event.param == VK_RIGHT ||
- event.param == VK_DOWN )
+ if ( event.param == KEY(RIGHT) ||
+ event.param == KEY(DOWN) )
{
Scroll(m_lineFirst+1, true);
return true;
}
- if ( event.param == VK_PRIOR ) // PageUp ?
+ if ( event.param == KEY(PAGEUP) ) // PageUp ?
{
Scroll(m_lineFirst-(m_lineVisible-1), true);
return true;
}
- if ( event.param == VK_NEXT ) // PageDown ?
+ if ( event.param == KEY(PAGEDOWN) ) // PageDown ?
{
Scroll(m_lineFirst+(m_lineVisible-1), true);
return true;
}
}
- if ( event.param == VK_HOME )
+ if ( event.param == KEY(HOME) )
{
MoveHome(bControl, bShift);
return true;
}
- if ( event.param == VK_END )
+ if ( event.param == KEY(END) )
{
MoveEnd(bControl, bShift);
return true;
}
- if ( event.param == VK_BACK ) // backspace ( <- ) ?
+ if ( event.param == KEY(BACKSPACE) ) // backspace ( <- ) ?
{
Delete(-1);
SendModifEvent();
return true;
}
- if ( event.param == VK_DELETE )
+ if ( event.param == KEY(DELETE) )
{
Delete(1);
SendModifEvent();
return true;
}
- if ( event.param == VK_RETURN )
+ if ( event.param == KEY(RETURN) )
{
Insert('\n');
SendModifEvent();
return true;
}
- if ( event.param == VK_TAB )
+ if ( event.param == KEY(TAB) )
{
Insert('\t');
SendModifEvent();
@@ -461,7 +470,7 @@ bool CEdit::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_CHAR && m_bFocus )
+ if ( event.type == EVENT_ACTIVE && m_bFocus )
{
if ( event.param >= ' ' && event.param <= 255 )
{
@@ -471,9 +480,9 @@ bool CEdit::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_FOCUS )
+ if ( event.type == EVENT_ACTIVE )
{
- if ( event.param == m_eventMsg )
+ if ( event.param == m_eventType )
{
m_bFocus = true;
}
@@ -483,7 +492,8 @@ bool CEdit::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_LBUTTONDOWN )
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1)
{
m_mouseFirstPos = event.pos;
m_mouseLastPos = event.pos;
@@ -502,18 +512,19 @@ bool CEdit::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_MOUSEMOVE && m_bCapture )
+ if ( event.type == EVENT_MOUSE_MOVE && m_bCapture )
{
m_mouseLastPos = event.pos;
MouseMove(event.pos);
}
- if ( event.event == EVENT_FRAME && m_bCapture )
+ if ( event.type == EVENT_FRAME && m_bCapture )
{
MouseMove(m_mouseLastPos);
}
- if ( event.event == EVENT_LBUTTONUP )
+ if ( event.type == EVENT_MOUSE_BUTTON_UP &&
+ event.mouseButton.button == 1)
{
if ( Detect(event.pos) )
{
@@ -541,9 +552,9 @@ bool CEdit::EventProcess(const Event &event)
void CEdit::SendModifEvent()
{
- Event newEvent;
+ Event newEvent (m_eventType);
- m_event->MakeEvent(newEvent, m_eventMsg);
+// m_event->MakeEvent(newEvent, m_eventType);
m_event->AddEvent(newEvent);
}
@@ -560,7 +571,7 @@ bool CEdit::IsLinkPos(Math::Point pos)
if ( i == -1 ) return false;
if ( i >= m_len ) return false;
- if ( (m_format[i]&COLOR_MASK) == COLOR_LINK ) return true;
+ if ( (m_format[i]& Gfx::FONT_MASK_HIGHLIGHT) == Gfx::FONT_HIGHLIGHT_LINK) return true; // TODO
return false;
}
@@ -635,13 +646,13 @@ void CEdit::MouseRelease(Math::Point mouse)
if ( !m_bEdit )
{
if ( m_format != 0 && i < m_len && m_cursor1 == m_cursor2 &&
- (m_format[i]&COLOR_MASK) == COLOR_LINK )
+ (m_format[i]&Gfx::FONT_MASK_HIGHLIGHT) == Gfx::FONT_HIGHLIGHT_LINK) //TODO
{
rank = -1;
for ( j=0 ; j<=i ; j++ )
{
- if ( (j == 0 || (m_format[j-1]&COLOR_MASK) != COLOR_LINK) &&
- (m_format[j+0]&COLOR_MASK) == COLOR_LINK )
+ if ( (j == 0 || (m_format[j-1]&Gfx::FONT_MASK_HIGHLIGHT) != Gfx::FONT_HIGHLIGHT_LINK) && // TODO check if good
+ (m_format[j+0]&Gfx::FONT_MASK_HIGHLIGHT) == Gfx::FONT_HIGHLIGHT_LINK) // TODO
{
rank ++;
}
@@ -694,14 +705,14 @@ int CEdit::MouseDetect(Math::Point mouse)
if ( m_bAutoIndent )
{
- indentLength = m_engine->RetText()->RetCharWidth(' ', 0.0f, m_fontSize, m_fontStretch, m_fontType)
- * m_engine->RetEditIndentValue();
+ indentLength = m_engine->GetText()->GetCharWidth(static_cast<Gfx::UTF8Char>(' '), m_fontType, m_fontSize, 0.0f)
+ * m_engine->GetEditIndentValue();
}
pos.y = m_pos.y+m_dim.y-m_lineHeight-(m_bMulti?MARGY:MARGY1);
for ( i=m_lineFirst ; i<m_lineTotal ; i++ )
{
- bTitle = ( m_format != 0 && (m_format[m_lineOffset[i]]&TITLE_MASK) == TITLE_BIG );
+ bTitle = ( m_format != 0 && (m_format[m_lineOffset[i]]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_BIG );
if ( i >= m_lineFirst+m_lineVisible ) break;
@@ -720,19 +731,21 @@ int CEdit::MouseDetect(Math::Point mouse)
if ( m_format == 0 )
{
- c = m_engine->RetText()->Detect(m_text+m_lineOffset[i],
- len, offset, m_fontSize,
- m_fontStretch, m_fontType);
+// c = m_engine->GetText()->Detect(m_text+m_lineOffset[i],
+// len, offset, m_fontSize,
+// m_fontStretch, m_fontType);
+ c = m_engine->GetText()->Detect(m_text+m_lineOffset[i], m_fontType, m_fontSize, offset); // TODO check if good
}
else
{
size = m_fontSize;
- if ( bTitle ) size *= BIG_FONT;
+ if ( bTitle ) size *= Gfx::FONT_SIZE_BIG;
- c = m_engine->RetText()->Detect(m_text+m_lineOffset[i],
- m_format+m_lineOffset[i],
- len, offset, size,
- m_fontStretch);
+// c = m_engine->GetText()->Detect(m_text+m_lineOffset[i],
+// m_format+m_lineOffset[i],
+// len, offset, size,
+// m_fontStretch);
+ c = m_engine->GetText()->Detect(m_text+m_lineOffset[i],m_format+m_lineOffset[i], size, offset); // TODO check if good
}
return m_lineOffset[i]+c;
}
@@ -827,7 +840,7 @@ bool CEdit::HyperAdd(char *filename, int firstLine)
// Indicates whether a button EVENT_HYPER_ * is active or not.
-bool CEdit::HyperTest(EventMsg event)
+bool CEdit::HyperTest(EventType event)
{
if ( event == EVENT_HYPER_HOME )
{
@@ -849,7 +862,7 @@ bool CEdit::HyperTest(EventMsg event)
// Performs the action corresponding to a button EVENT_HYPER_ *.
-bool CEdit::HyperGo(EventMsg event)
+bool CEdit::HyperGo(EventType event)
{
if ( !HyperTest(event) ) return false;
@@ -911,8 +924,8 @@ void CEdit::Draw()
if ( m_bAutoIndent )
{
- indentLength = m_engine->RetText()->RetCharWidth(' ', 0.0f, m_fontSize, m_fontStretch, m_fontType)
- * m_engine->RetEditIndentValue();
+ indentLength = m_engine->GetText()->GetCharWidth(static_cast<Gfx::UTF8Char>(' '), m_fontType, m_fontSize, 0.0f)
+ * m_engine->GetEditIndentValue();
}
pos.y = m_pos.y+m_dim.y-m_lineHeight-(m_bMulti?MARGY:MARGY1);
@@ -933,7 +946,7 @@ void CEdit::Draw()
for ( j=0 ; j<m_lineIndent[i] ; j++ )
{
char s = '\t'; // line | dotted
- m_engine->RetText()->DrawText(&s, 1, pos, 1.0f, 1, m_fontSize, m_fontStretch, m_fontType, 0);
+ m_engine->GetText()->DrawText(&s, m_fontType, m_fontSize, pos, 1.0f, Gfx::TEXT_ALIGN_RIGHT, 0);
pos.x += indentLength;
}
}
@@ -946,7 +959,7 @@ void CEdit::Draw()
// Headline \b;?
if ( beg+len < m_len && m_format != 0 &&
- (m_format[beg]&TITLE_MASK) == TITLE_BIG )
+ (m_format[beg]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_BIG )
{
start.x = ppos.x-MARGX;
end.x = dim.x-MARGX*2.0f;
@@ -960,7 +973,7 @@ void CEdit::Draw()
// As \t;?
if ( beg+len < m_len && m_format != 0 &&
- (m_format[beg]&TITLE_MASK) == TITLE_NORM )
+ (m_format[beg]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_NORM )
{
start.x = ppos.x-MARGX;
end.x = dim.x-MARGX*2.0f;
@@ -971,7 +984,7 @@ void CEdit::Draw()
// Subtitle \s;?
if ( beg+len < m_len && m_format != 0 &&
- (m_format[beg]&TITLE_MASK) == TITLE_LITTLE )
+ (m_format[beg]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_LITTLE )
{
start.x = ppos.x-MARGX;
end.x = dim.x-MARGX*2.0f;
@@ -982,7 +995,7 @@ void CEdit::Draw()
// Table \tab;?
if ( beg+len < m_len && m_format != 0 &&
- (m_format[beg]&COLOR_MASK) == COLOR_TABLE )
+ (m_format[beg]&Gfx::FONT_MASK_HIGHLIGHT) == Gfx::FONT_HIGHLIGHT_TABLE )
{
start.x = ppos.x-MARGX;
end.x = dim.x-MARGX*2.0f;
@@ -993,21 +1006,21 @@ void CEdit::Draw()
// Image \image; ?
if ( beg+len < m_len && m_format != 0 &&
- (m_format[beg]&IMAGE_MASK) != 0 )
+ (m_format[beg]&Gfx::FONT_MASK_IMAGE) != 0 )
{
line = 1;
while ( true ) // includes the image slices
{
if ( i+line >= m_lineTotal ||
i+line >= m_lineFirst+m_lineVisible ||
- (m_format[beg+line]&IMAGE_MASK) == 0 ) break;
+ (m_format[beg+line]&Gfx::FONT_MASK_IMAGE) == 0 ) break;
line ++;
}
iIndex = m_text[beg]; // character = index in m_image
pos.y -= m_lineHeight*(line-1);
DrawImage(pos, m_image[iIndex].name,
- m_image[iIndex].width*(m_fontSize/SMALLFONT),
+ m_image[iIndex].width*(m_fontSize/Gfx::FONT_SIZE_SMALL),
m_image[iIndex].offset, m_image[iIndex].height*line, line);
pos.y -= m_lineHeight;
i += line-1;
@@ -1023,18 +1036,18 @@ void CEdit::Draw()
if ( m_format == 0 )
{
- start.x = ppos.x+m_engine->RetText()->RetStringWidth(m_text+beg, o1-beg, size, m_fontStretch, m_fontType);
- end.x = m_engine->RetText()->RetStringWidth(m_text+o1, o2-o1, size, m_fontStretch, m_fontType);
+ start.x = ppos.x+m_engine->GetText()->GetStringWidth(m_text+beg, m_fontType, size);
+ end.x = m_engine->GetText()->GetStringWidth(m_text+o1, m_fontType, size);
}
else
{
- start.x = ppos.x+m_engine->RetText()->RetStringWidth(m_text+beg, m_format+beg, o1-beg, size, m_fontStretch);
- end.x = m_engine->RetText()->RetStringWidth(m_text+o1, m_format+o1, o2-o1, size, m_fontStretch);
+ start.x = ppos.x+m_engine->GetText()->GetStringWidth(m_text+beg, m_format+beg, size);
+ end.x = m_engine->GetText()->GetStringWidth(m_text+o1, m_format+o1, size);
}
start.y = ppos.y-(m_bMulti?0.0f:MARGY1);
end.y = m_lineHeight;
- if ( m_format != 0 && (m_format[beg]&TITLE_MASK) == TITLE_BIG ) end.y *= BIG_FONT;
+ if ( m_format != 0 && (m_format[beg]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_BIG) end.y *= BIG_FONT;
DrawPart(start, end, 1); // plain yellow background
}
@@ -1051,11 +1064,11 @@ void CEdit::Draw()
if ( !m_bMulti || !m_bDisplaySpec ) eol = 0;
if ( m_format == 0 )
{
- m_engine->RetText()->DrawText(m_text+beg, len, ppos, m_dim.x, 1, size, m_fontStretch, m_fontType, eol);
+ m_engine->GetText()->DrawText(m_text+beg, m_fontType, size, ppos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, eol);
}
else
{
- m_engine->RetText()->DrawText(m_text+beg, m_format+beg, len, ppos, m_dim.x, 1, size, m_fontStretch, eol);
+ m_engine->GetText()->DrawText(m_text+beg, m_format+beg, size, ppos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, eol);
}
pos.y -= m_lineHeight;
@@ -1085,17 +1098,15 @@ void CEdit::Draw()
if ( m_format == 0 )
{
- m_engine->RetText()->DimText(m_text+m_lineOffset[i], len,
- pos, 1, size,
- m_fontStretch, m_fontType,
+ m_engine->GetText()->SizeText(m_text+m_lineOffset[i], m_fontType,
+ size, pos, Gfx::TEXT_ALIGN_RIGHT,
start, end);
}
else
{
- m_engine->RetText()->DimText(m_text+m_lineOffset[i],
+ m_engine->GetText()->SizeText(m_text+m_lineOffset[i],
m_format+m_lineOffset[i],
- len, pos, 1, size,
- m_fontStretch,
+ size, pos, Gfx::TEXT_ALIGN_RIGHT,
start, end);
}
@@ -1104,8 +1115,8 @@ void CEdit::Draw()
}
pos.y -= m_lineHeight;
}
- pos.x -= 1.0f/640.0f;
- dim.x = 2.0f/640.0f;
+ pos.x -= 1.0f / 640.0f;
+ dim.x = 2.0f / 640.0f;
dim.y = m_lineHeight;
DrawPart(pos, dim, 0); // red
}
@@ -1130,7 +1141,7 @@ void CEdit::DrawImage(Math::Point pos, char *name, float width,
strcat(filename, ".bmp");
m_engine->SetTexture(filename);
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f;
uv2.x = 1.0f;
@@ -1158,7 +1169,7 @@ void CEdit::DrawBack(Math::Point pos, Math::Point dim)
if ( m_bGeneric ) return;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
if ( m_bMulti )
{
@@ -1212,7 +1223,7 @@ void CEdit::DrawPart(Math::Point pos, Math::Point dim, int icon)
#else
m_engine->SetTexture("text.tga");
#endif
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = (16.0f/256.0f)*(icon%16);
uv1.y = (240.0f/256.0f);
@@ -1291,32 +1302,32 @@ void CEdit::SetText(char *text, bool bNew)
{
if ( text[i+1] == 'n' ) // normal ?
{
- font &= ~FONT_MASK;
- font |= FONT_COLOBOT;
+ font &= ~Gfx::FONT_MASK_FONT;
+ font |= Gfx::FONT_COLOBOT;
i += 2;
}
else if ( text[i+1] == 'c' ) // cbot ?
{
- font &= ~FONT_MASK;
- font |= FONT_COURIER;
+ font &= ~Gfx::FONT_MASK_FONT;
+ font |= Gfx::FONT_COURIER;
i += 2;
}
else if ( text[i+1] == 'b' ) // big title ?
{
- font &= ~TITLE_MASK;
- font |= TITLE_BIG;
+ font &= ~Gfx::FONT_MASK_TITLE;
+ font |= Gfx::FONT_TITLE_BIG;
i += 2;
}
else if ( text[i+1] == 't' ) // title ?
{
- font &= ~TITLE_MASK;
- font |= TITLE_NORM;
+ font &= ~Gfx::FONT_MASK_TITLE;
+ font |= Gfx::FONT_TITLE_NORM;
i += 2;
}
else if ( text[i+1] == 's' ) // subtitle ?
{
- font &= ~TITLE_MASK;
- font |= TITLE_LITTLE;
+ font &= ~Gfx::FONT_MASK_TITLE;
+ font |= Gfx::FONT_TITLE_LITTLE;
i += 2;
}
}
@@ -1326,7 +1337,7 @@ void CEdit::SetText(char *text, bool bNew)
m_format[j] = font;
j ++;
- font &= ~TITLE_MASK; // reset title
+ font &= ~Gfx::FONT_MASK_TITLE; // reset title
}
}
m_len = j;
@@ -1342,7 +1353,7 @@ void CEdit::SetText(char *text, bool bNew)
// Returns a pointer to the edited text.
-char* CEdit::RetText()
+char* CEdit::GetText()
{
m_text[m_len] = 0;
return m_text;
@@ -1361,7 +1372,7 @@ void CEdit::GetText(char *buffer, int max)
// Returns the length of the text.
-int CEdit::RetTextLength()
+int CEdit::GetTextLength()
{
return m_len;
}
@@ -1394,7 +1405,7 @@ void GetNameParam(char *cmd, int rank, char *buffer)
// Returns a number of a command.
// \x nom n1 n2;
-int RetValueParam(char *cmd, int rank)
+int GetValueParam(char *cmd, int rank)
{
int n, i;
@@ -1423,7 +1434,7 @@ void CEdit::FreeImage()
//? sprintf(filename, "diagram\\%s.bmp", m_image[i].name);
UserDir(filename, m_image[i].name, "diagram");
strcat(filename, ".bmp");
- m_engine->FreeTexture(filename);
+ m_engine->DeleteTexture(filename);
}
}
@@ -1467,14 +1478,14 @@ bool CEdit::ReadText(char *filename, int addSize)
FreeImage();
delete m_text;
- m_text = (char*)malloc(sizeof(char)*(m_maxChar+1));
- buffer = (char*)malloc(sizeof(char)*(m_maxChar+1));
+ m_text = new char[sizeof(char)*(m_maxChar+1)];
+ buffer = new char[sizeof(char)*(m_maxChar+1)];
fread(buffer, 1, len, file);
if ( m_format != 0 )
{
delete m_format;
- m_format = (char*)malloc(sizeof(char)*m_maxChar);
+ m_format = new char[sizeof(char)*m_maxChar];
}
fclose(file);
@@ -1515,8 +1526,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~FONT_MASK;
- font |= FONT_COLOBOT;
+ font &= ~Gfx::FONT_MASK_FONT;
+ font |= Gfx::FONT_COLOBOT;
}
i += 3;
}
@@ -1524,8 +1535,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~FONT_MASK;
- font |= FONT_COURIER;
+ font &= ~Gfx::FONT_MASK_FONT;
+ font |= Gfx::FONT_COURIER;
}
i += 3;
}
@@ -1533,8 +1544,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~TITLE_MASK;
- font |= TITLE_BIG;
+ font &= ~Gfx::FONT_MASK_TITLE;
+ font |= Gfx::FONT_TITLE_BIG;
}
i += 3;
}
@@ -1542,8 +1553,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~TITLE_MASK;
- font |= TITLE_NORM;
+ font &= ~Gfx::FONT_MASK_TITLE;
+ font |= Gfx::FONT_TITLE_NORM;
}
i += 3;
}
@@ -1551,8 +1562,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~TITLE_MASK;
- font |= TITLE_LITTLE;
+ font &= ~Gfx::FONT_MASK_TITLE;
+ font |= Gfx::FONT_TITLE_LITTLE;
}
i += 3;
}
@@ -1560,8 +1571,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~COLOR_MASK;
- font |= COLOR_LINK;
+ font &= ~Gfx::FONT_MASK_HIGHLIGHT;
+ font |= Gfx::FONT_HIGHLIGHT_LINK;
}
i += 3;
}
@@ -1583,7 +1594,7 @@ bool CEdit::ReadText(char *filename, int addSize)
GetNameParam(buffer+i+3, 1, m_link[iLink].marker);
iLink ++;
}
- font &= ~COLOR_MASK;
+ font &= ~Gfx::FONT_MASK_HIGHLIGHT;
}
i += strchr(buffer+i, ';')-(buffer+i)+1;
}
@@ -1620,9 +1631,9 @@ bool CEdit::ReadText(char *filename, int addSize)
GetNameParam(buffer+i+7, 0, iName);
#endif
//? iWidth = m_lineHeight*RetValueParam(buffer+i+7, 1);
- iWidth = (float)RetValueParam(buffer+i+7, 1);
- iWidth *= m_engine->RetText()->RetHeight(SMALLFONT, FONT_COLOBOT);
- iLines = RetValueParam(buffer+i+7, 2);
+ iWidth = static_cast<float>(GetValueParam(buffer+i+7, 1));
+ iWidth *= m_engine->GetText()->GetHeight(Gfx::FONT_COLOBOT, Gfx::FONT_SIZE_SMALL);
+ iLines = GetValueParam(buffer+i+7, 2);
LoadImage(iName);
// A part of image per line of text.
@@ -1634,7 +1645,7 @@ bool CEdit::ReadText(char *filename, int addSize)
m_image[iIndex].width = iWidth*0.75f;
m_text[j] = (char)(iIndex++); // as an index into m_image
- m_format[j] = (unsigned char)IMAGE_MASK;
+ m_format[j] = (unsigned char)Gfx::FONT_MASK_IMAGE;
j ++;
}
}
@@ -1652,8 +1663,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- m_text[j] = RetValueParam(buffer+i+8, 0);
- m_format[j] = font|FONT_BUTTON;
+ m_text[j] = GetValueParam(buffer+i+8, 0);
+ m_format[j] = font|Gfx::FONT_BUTTON;
j ++;
}
i += strchr(buffer+i, ';')-(buffer+i)+1;
@@ -1669,8 +1680,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~COLOR_MASK;
- font |= COLOR_TOKEN;
+ font &= ~Gfx::FONT_MASK_HIGHLIGHT;
+ font |= Gfx::FONT_HIGHLIGHT_TOKEN;
}
i += 7;
}
@@ -1684,8 +1695,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~COLOR_MASK;
- font |= COLOR_TYPE;
+ font &= ~Gfx::FONT_MASK_HIGHLIGHT;
+ font |= Gfx::FONT_HIGHLIGHT_TYPE;
}
i += 6;
}
@@ -1700,8 +1711,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~COLOR_MASK;
- font |= COLOR_CONST;
+ font &= ~Gfx::FONT_MASK_HIGHLIGHT;
+ font |= Gfx::FONT_HIGHLIGHT_CONST;
}
i += 7;
}
@@ -1714,8 +1725,8 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~COLOR_MASK;
- font |= COLOR_KEY;
+ font &= ~Gfx::FONT_MASK_HIGHLIGHT;
+ font |= Gfx::FONT_HIGHLIGHT_KEY;
}
i += 5;
}
@@ -1728,7 +1739,7 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font |= COLOR_TABLE;
+ font |= Gfx::FONT_HIGHLIGHT_TABLE;
}
i += 5;
}
@@ -1742,7 +1753,7 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( m_bSoluce || !bInSoluce )
{
- font &= ~COLOR_MASK;
+ font &= ~Gfx::FONT_MASK_HIGHLIGHT;
}
i += 6;
}
@@ -1775,7 +1786,7 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( SearchKey(buffer+i+5, key) )
{
- res = m_engine->RetKey(key, 0);
+ res = m_engine->GetKey(key, 0); // TODO
if ( res != 0 )
{
if ( GetResource(RES_KEY, res, iName) )
@@ -1794,7 +1805,7 @@ bool CEdit::ReadText(char *filename, int addSize)
m_format[j] = font;
j ++;
- res = m_engine->RetKey(key, 1);
+ res = m_engine->GetKey(key, 1); // TODO
if ( res != 0 )
{
if ( GetResource(RES_KEY, res, iName) )
@@ -1804,7 +1815,7 @@ bool CEdit::ReadText(char *filename, int addSize)
while ( text[n] != 0 )
{
m_text[j] = text[n++];
- m_format[j] = font&~COLOR_MASK;
+ m_format[j] = font&~Gfx::FONT_MASK_HIGHLIGHT;
j ++;
}
n = 0;
@@ -1840,11 +1851,11 @@ bool CEdit::ReadText(char *filename, int addSize)
}
i ++;
- font &= ~TITLE_MASK; // reset title
+ font &= ~Gfx::FONT_MASK_TITLE; // reset title
- if ( (font&COLOR_MASK) == COLOR_TABLE )
+ if ( (font&Gfx::FONT_MASK_HIGHLIGHT) == Gfx::FONT_HIGHLIGHT_TABLE )
{
- font &= ~COLOR_TABLE;
+ font &= ~Gfx::FONT_HIGHLIGHT_TABLE;
}
}
}
@@ -1945,7 +1956,7 @@ void CEdit::SetMaxChar(int max)
UndoFlush();
}
-int CEdit::RetMaxChar()
+int CEdit::GetMaxChar()
{
return m_maxChar;
}
@@ -1958,7 +1969,7 @@ void CEdit::SetEditCap(bool bMode)
m_bEdit = bMode;
}
-bool CEdit::RetEditCap()
+bool CEdit::GetEditCap()
{
return m_bEdit;
}
@@ -1970,7 +1981,7 @@ void CEdit::SetHiliteCap(bool bEnable)
m_bHilite = bEnable;
}
-bool CEdit::RetHiliteCap()
+bool CEdit::GetHiliteCap()
{
return m_bHilite;
}
@@ -1982,7 +1993,7 @@ void CEdit::SetInsideScroll(bool bInside)
m_bInsideScroll = bInside;
}
-bool CEdit::RetInsideScroll()
+bool CEdit::GetInsideScroll()
{
return m_bInsideScroll;
}
@@ -1994,7 +2005,7 @@ void CEdit::SetSoluceMode(bool bSoluce)
m_bSoluce = bSoluce;
}
-bool CEdit::RetSoluceMode()
+bool CEdit::GetSoluceMode()
{
return m_bSoluce;
}
@@ -2006,7 +2017,7 @@ void CEdit::SetGenericMode(bool bGeneric)
m_bGeneric = bGeneric;
}
-bool CEdit::RetGenericMode()
+bool CEdit::GetGenericMode()
{
return m_bGeneric;
}
@@ -2019,7 +2030,7 @@ void CEdit::SetAutoIndent(bool bMode)
m_bAutoIndent = bMode;
}
-bool CEdit::RetAutoIndent()
+bool CEdit::GetAutoIndent()
{
return m_bAutoIndent;
}
@@ -2057,7 +2068,7 @@ void CEdit::SetFirstLine(int rank)
// Returns the first displayed line.
-int CEdit::RetFirstLine()
+int CEdit::GetFirstLine()
{
if ( m_historyTotal > 0 )
{
@@ -2091,7 +2102,7 @@ void CEdit::ShowSelect()
cursor2 = m_cursor1;
}
- line = RetCursorLine(cursor2);
+ line = GetCursorLine(cursor2);
if ( line >= m_lineFirst+m_lineVisible )
{
line -= m_lineVisible-1;
@@ -2099,7 +2110,7 @@ void CEdit::ShowSelect()
Scroll(line, false);
}
- line = RetCursorLine(cursor1);
+ line = GetCursorLine(cursor1);
if ( line < m_lineFirst )
{
Scroll(line, false);
@@ -2114,7 +2125,7 @@ void CEdit::SetDisplaySpec(bool bDisplay)
m_bDisplaySpec = bDisplay;
}
-bool CEdit::RetDisplaySpec()
+bool CEdit::GetDisplaySpec()
{
return m_bDisplaySpec;
}
@@ -2137,7 +2148,7 @@ void CEdit::SetMultiFont(bool bMulti)
}
}
-bool CEdit::RetMultiFont()
+bool CEdit::GetMultiFont()
{
return ( m_format != 0 );
}
@@ -2161,7 +2172,7 @@ void CEdit::Scroll()
if ( m_scroll != 0 )
{
- value = m_scroll->RetVisibleValue();
+ value = m_scroll->GetVisibleValue();
value *= m_lineTotal-m_lineVisible;
Scroll((int)(value+0.5f), true);
}
@@ -2181,7 +2192,7 @@ void CEdit::Scroll(int pos, bool bAdjustCursor)
if ( max < 0 ) max = 0;
if ( m_lineFirst > max ) m_lineFirst = max;
- line = RetCursorLine(m_cursor1);
+ line = GetCursorLine(m_cursor1);
if ( bAdjustCursor && m_bEdit )
{
@@ -2418,29 +2429,28 @@ void CEdit::MoveLine(int move, bool bWord, bool bSelect)
}
}
- line = RetCursorLine(m_cursor1);
+ line = GetCursorLine(m_cursor1);
column = m_column;
if ( m_bAutoIndent )
{
- indentLength = m_engine->RetText()->RetCharWidth(' ', 0.0f, m_fontSize, m_fontStretch, m_fontType)
- * m_engine->RetEditIndentValue();
+ indentLength = m_engine->GetText()->GetCharWidth(static_cast<Gfx::UTF8Char>(' '), m_fontType, m_fontSize, 0.0f)
+ * m_engine->GetEditIndentValue();
column -= indentLength*m_lineIndent[line];
}
if ( m_format == 0 )
{
- c = m_engine->RetText()->Detect(m_text+m_lineOffset[line],
- m_lineOffset[line+1]-m_lineOffset[line],
- column, m_fontSize,
- m_fontStretch, m_fontType);
+ c = m_engine->GetText()->Detect(m_text+m_lineOffset[line],
+ m_fontType, m_fontSize,
+ m_lineOffset[line+1]-m_lineOffset[line]);
}
else
{
- c = m_engine->RetText()->Detect(m_text+m_lineOffset[line],
+ c = m_engine->GetText()->Detect(m_text+m_lineOffset[line],
m_format+m_lineOffset[line],
- m_lineOffset[line+1]-m_lineOffset[line],
- column, m_fontSize, m_fontStretch);
+ m_fontSize,
+ m_lineOffset[line+1]-m_lineOffset[line]);
}
m_cursor1 = m_lineOffset[line]+c;
@@ -2457,32 +2467,27 @@ void CEdit::ColumnFix()
float indentLength;
int line;
- line = RetCursorLine(m_cursor1);
+ line = GetCursorLine(m_cursor1);
if ( m_format == 0 )
{
- m_column = m_engine->RetText()->RetStringWidth
- (
+ m_column = m_engine->GetText()->GetStringWidth(
m_text+m_lineOffset[line],
- m_cursor1-m_lineOffset[line],
- m_fontSize, m_fontStretch, m_fontType
- );
+ m_fontType, m_fontSize);
}
else
{
- m_column = m_engine->RetText()->RetStringWidth
- (
+ m_column = m_engine->GetText()->GetStringWidth(
m_text+m_lineOffset[line],
m_format+m_lineOffset[line],
- m_cursor1-m_lineOffset[line],
- m_fontSize, m_fontStretch
+ m_fontSize
);
}
if ( m_bAutoIndent )
{
- indentLength = m_engine->RetText()->RetCharWidth(' ', 0.0f, m_fontSize, m_fontStretch, m_fontType)
- * m_engine->RetEditIndentValue();
+ indentLength = m_engine->GetText()->GetCharWidth(static_cast<Gfx::UTF8Char>(' '), m_fontType, m_fontSize, 0.0f)
+ * m_engine->GetEditIndentValue();
m_column += indentLength*m_lineIndent[line];
}
}
@@ -2490,7 +2495,7 @@ void CEdit::ColumnFix()
// Cut the selected characters or entire line.
-bool CEdit::Cut()
+bool CEdit::Cut() // TODO MS Windows allocations
{
HGLOBAL hg;
char* text;
@@ -2571,7 +2576,7 @@ bool CEdit::Cut()
// Copy the selected characters or entire line.
-bool CEdit::Copy()
+bool CEdit::Copy() // TODO
{
HGLOBAL hg;
char* text;
@@ -2643,7 +2648,7 @@ bool CEdit::Copy()
// Paste the contents of the notebook.
-bool CEdit::Paste()
+bool CEdit::Paste() // TODO
{
HANDLE h;
char c;
@@ -2777,7 +2782,7 @@ void CEdit::Insert(char character)
#endif
else if ( character == '\t' )
{
- for ( i=0 ; i<m_engine->RetEditIndentValue() ; i++ )
+ for ( i=0 ; i<m_engine->GetEditIndentValue() ; i++ )
{
InsertOne(' ');
}
@@ -3025,8 +3030,8 @@ bool CEdit::MinMaj(bool bMaj)
for ( i=c1 ; i<c2 ; i++ )
{
character = (unsigned char)m_text[i];
- if ( bMaj ) character = RetToUpper(character);
- else character = RetToLower(character);
+ if ( bMaj ) character = GetToUpper(character);
+ else character = GetToLower(character);
m_text[i] = character;
}
@@ -3053,8 +3058,8 @@ void CEdit::Justif()
if ( m_bAutoIndent )
{
- indentLength = m_engine->RetText()->RetCharWidth(' ', 0.0f, m_fontSize, m_fontStretch, m_fontType)
- * m_engine->RetEditIndentValue();
+ indentLength = m_engine->GetText()->GetCharWidth(static_cast<Gfx::UTF8Char>(' '), m_fontType, m_fontSize, 0.0f)
+ * m_engine->GetEditIndentValue();
}
bString = bRem = false;
@@ -3071,29 +3076,29 @@ void CEdit::Justif()
if ( m_format == 0 )
{
- i += m_engine->RetText()->Justif(m_text+i, m_len-i, width,
- m_fontSize, m_fontStretch,
- m_fontType);
+ // TODO check if good
+ i += m_engine->GetText()->Justify(m_text+i, m_fontType,
+ m_fontSize, width);
}
else
{
size = m_fontSize;
- if ( (m_format[i]&TITLE_MASK) == TITLE_BIG ) // headline?
+ if ( (m_format[i]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_BIG ) // headline?
{
size *= BIG_FONT;
bDual = true;
}
- if ( (m_format[i]&IMAGE_MASK) != 0 ) // image part?
+ if ( (m_format[i]&Gfx::FONT_MASK_IMAGE) != 0 ) // image part?
{
i ++; // jumps just a character (index in m_image)
}
else
{
- i += m_engine->RetText()->Justif(m_text+i, m_format+i,
- m_len-i, width,
- size, m_fontStretch);
+ // TODO check if good
+ i += m_engine->GetText()->Justify(m_text+i, m_format+i,
+ size, width);
}
}
@@ -3149,7 +3154,7 @@ void CEdit::Justif()
{
if ( m_bEdit )
{
- line = RetCursorLine(m_cursor1);
+ line = GetCursorLine(m_cursor1);
if ( line < m_lineFirst )
{
m_lineFirst = line;
@@ -3175,13 +3180,13 @@ void CEdit::Justif()
}
else
{
- value = (float)m_lineVisible/m_lineTotal;
+ value = static_cast<float>(m_lineVisible/m_lineTotal);
m_scroll->SetVisibleRatio(value);
- value = (float)m_lineFirst/(m_lineTotal-m_lineVisible);
+ value = static_cast<float>(m_lineFirst/(m_lineTotal-m_lineVisible));
m_scroll->SetVisibleValue(value);
- value = (float)1.0f/(m_lineTotal-m_lineVisible);
+ value = static_cast<float>(1.0f/(m_lineTotal-m_lineVisible));
m_scroll->SetArrowStep(value);
}
}
@@ -3191,7 +3196,7 @@ void CEdit::Justif()
// Returns the rank of the line where the cursor is located.
-int CEdit::RetCursorLine(int cursor)
+int CEdit::GetCursorLine(int cursor)
{
int line, i;
@@ -3314,3 +3319,4 @@ bool CEdit::SetFormat(int cursor1, int cursor2, int format)
}
+}
diff --git a/src/ui/edit.h b/src/ui/edit.h
index dbd94d1..99ec693 100644
--- a/src/ui/edit.h
+++ b/src/ui/edit.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -14,69 +15,99 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
-// edit.h
+
+/**
+ * \file ui/edit.h
+ * \brief CEdit class
+ */
#pragma once
-#include "common/struct.h"
+//#include "common/struct.h"
#include "ui/control.h"
+namespace Gfx{
+class CEngine;
+};
-class CD3DEngine;
+namespace Ui {
class CScroll;
+//! maximum number of characters in CBOT edit
+const int EDITSTUDIOMAX = 20000;
+//! maximum total number of lines
+const int EDITLINEMAX = 1000;
+//! maximum total number of lines with images
+const int EDITIMAGEMAX = 50;
+//! maximum number of links
+const int EDITLINKMAX = 100;
+//! max number of levels preserves
+const int EDITHISTORYMAX = 50;
-const int EDITSTUDIOMAX = 20000; // maximum number of characters in CBOT edit
-const int EDITLINEMAX = 1000; // maximum total number of lines
-const int EDITIMAGEMAX = 50; // maximum total number of lines with images
-const int EDITLINKMAX = 100; // maximum number of links
-const int EDITHISTORYMAX = 50; // max number of levels preserves
-
-const int EDITUNDOMAX = 20; // max number of successive undo
+//! max number of successive undo
+const int EDITUNDOMAX = 20;
struct EditUndo
{
- char* text; // original text
- int len; // length of the text
- int cursor1; // offset cursor
- int cursor2; // offset cursor
- int lineFirst; // the first line displayed.
+ //! original text
+ char* text;
+ //! length of the text
+ int len;
+ //! offset cursor
+ int cursor1;
+ //! offset cursor
+ int cursor2;
+ //! the first line displayed.
+ int lineFirst;
};
enum OperUndo
{
- OPERUNDO_SPEC = 0, // special operation
- OPERUNDO_INSERT = 1, // inserting characters
- OPERUNDO_DELETE = 2, // deleting characters
+ //! special operation
+ OPERUNDO_SPEC = 0,
+ //! inserting characters
+ OPERUNDO_INSERT = 1,
+ //! deleting characters
+ OPERUNDO_DELETE = 2,
};
struct ImageLine
{
- char name[40]; // name of the image (without diagram \)
- float offset; // vertical offset (v texture)
- float height; // height of the part (dv texture)
- float width; // width
+ //! name of the image (without diagram \)
+ char name[40];
+ //! vertical offset (v texture)
+ float offset;
+ //! height of the part (dv texture)
+ float height;
+ //! width
+ float width;
};
struct HyperLink
{
- char name[40]; // text file name (without help \)
- char marker[20]; // name of the marker
+ //! text file name (without help \)
+ char name[40];
+ //! name of the marker
+ char marker[20];
};
struct HyperMarker
{
- char name[20]; // name of the marker
- int pos; // position in the text
+ //! name of the marker
+ char name[20];
+ //! position in the text
+ int pos;
};
struct HyperHistory
{
- char filename[50]; // full file name text
- int firstLine; // rank of the first displayed line
+ //! full file name text
+ char filename[50];
+ //! rank of the first displayed line
+ int firstLine;
};
@@ -85,10 +116,11 @@ struct HyperHistory
class CEdit : public CControl
{
public:
- CEdit(CInstanceManager* iMan);
+// CEdit(CInstanceManager* iMan);
+ CEdit ();
virtual ~CEdit();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
void SetPos(Math::Point pos);
void SetDim(Math::Point dim);
@@ -98,45 +130,45 @@ public:
void SetText(char *text, bool bNew=true);
void GetText(char *buffer, int max);
- char* RetText();
- int RetTextLength();
+ char* GetText();
+ int GetTextLength();
bool ReadText(char *filename, int addSize=0);
bool WriteText(char *filename);
void SetMaxChar(int max);
- int RetMaxChar();
+ int GetMaxChar();
void SetEditCap(bool bMode);
- bool RetEditCap();
+ bool GetEditCap();
void SetHiliteCap(bool bEnable);
- bool RetHiliteCap();
+ bool GetHiliteCap();
void SetInsideScroll(bool bInside);
- bool RetInsideScroll();
+ bool GetInsideScroll();
void SetSoluceMode(bool bSoluce);
- bool RetSoluceMode();
+ bool GetSoluceMode();
void SetGenericMode(bool bGeneric);
- bool RetGenericMode();
+ bool GetGenericMode();
void SetAutoIndent(bool bMode);
- bool RetAutoIndent();
+ bool GetAutoIndent();
void SetCursor(int cursor1, int cursor2);
void GetCursor(int &cursor1, int &cursor2);
void SetFirstLine(int rank);
- int RetFirstLine();
+ int GetFirstLine();
void ShowSelect();
void SetDisplaySpec(bool bDisplay);
- bool RetDisplaySpec();
+ bool GetDisplaySpec();
void SetMultiFont(bool bMulti);
- bool RetMultiFont();
+ bool GetMultiFont();
bool Cut();
bool Copy();
@@ -145,8 +177,8 @@ public:
void HyperFlush();
void HyperHome(char *filename);
- bool HyperTest(EventMsg event);
- bool HyperGo(EventMsg event);
+ bool HyperTest(EventType event);
+ bool HyperGo(EventType event);
void SetFontSize(float size);
@@ -189,7 +221,7 @@ protected:
bool Shift(bool bLeft);
bool MinMaj(bool bMaj);
void Justif();
- int RetCursorLine(int cursor);
+ int GetCursorLine(int cursor);
void UndoFlush();
void UndoMemorize(OperUndo oper);
@@ -246,3 +278,4 @@ protected:
};
+}
diff --git a/src/ui/editvalue.cpp b/src/ui/editvalue.cpp
index 71e06f2..f747c94 100644
--- a/src/ui/editvalue.cpp
+++ b/src/ui/editvalue.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,13 +18,13 @@
// editvalue.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
@@ -33,10 +34,11 @@
-
+namespace Ui {
// Object's constructor.
-CEditValue::CEditValue(CInstanceManager* iMan) : CControl(iMan)
+//CEditValue::CEditValue(CInstanceManager* iMan) : CControl(iMan)
+CEditValue::CEditValue() : CControl ()
{
m_edit = 0;
m_buttonUp = 0;
@@ -60,28 +62,28 @@ CEditValue::~CEditValue()
// Creates a new button.
-bool CEditValue::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CEditValue::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- CEdit* pe;
- CButton* pc;
+ Ui::CEdit* pe;
+ Ui::CButton* pc;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
- CControl::Create(pos, dim, icon, eventMsg);
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
+ CControl::Create(pos, dim, icon, eventType);
GlintDelete();
- m_edit = new CEdit(m_iMan);
- pe = (CEdit*)m_edit;
+ m_edit = new Ui::CEdit();
+ pe = static_cast<Ui::CEdit*>(m_edit);
pe->Create(pos, dim, 0, EVENT_NULL);
pe->SetMaxChar(4);
- m_buttonUp = new CButton(m_iMan);
- pc = (CButton*)m_buttonUp;
+ m_buttonUp = new Ui::CButton();
+ pc = static_cast<Ui::CButton*>(m_buttonUp);
pc->Create(pos, dim, 49, EVENT_NULL); // ^
pc->SetRepeat(true);
- m_buttonDown = new CButton(m_iMan);
- pc = (CButton*)m_buttonDown;
+ m_buttonDown = new Ui::CButton();
+ pc = static_cast<Ui::CButton*>(m_buttonDown);
pc->Create(pos, dim, 50, EVENT_NULL); // v
pc->SetRepeat(true);
@@ -151,11 +153,11 @@ bool CEditValue::EventProcess(const Event &event)
if ( m_edit != 0 )
{
- if ( m_edit->RetFocus() &&
- event.event == EVENT_KEYDOWN &&
- event.param == VK_RETURN )
+ if ( m_edit->GetFocus() &&
+ event.type == EVENT_KEY_DOWN &&
+ event.param == KEY(RETURN) )
{
- value = RetValue();
+ value = GetValue();
if ( value > m_maxValue ) value = m_maxValue;
if ( value < m_minValue ) value = m_minValue;
SetValue(value, true);
@@ -163,19 +165,18 @@ bool CEditValue::EventProcess(const Event &event)
}
if ( !m_edit->EventProcess(event) ) return false;
- if ( event.event == m_edit->RetEventMsg() )
+ if ( event.type == m_edit->GetEventType() )
{
- Event newEvent;
- m_event->MakeEvent(newEvent, m_eventMsg);
+ Event newEvent(m_eventType);
m_event->AddEvent(newEvent);
}
}
if ( m_buttonUp != 0 )
{
- if ( event.event == m_buttonUp->RetEventMsg() )
+ if ( event.type == m_buttonUp->GetEventType() )
{
- value = RetValue()+m_stepValue;
+ value = GetValue()+m_stepValue;
if ( value > m_maxValue ) value = m_maxValue;
SetValue(value, true);
HiliteValue(event);
@@ -185,9 +186,9 @@ bool CEditValue::EventProcess(const Event &event)
if ( m_buttonDown != 0 )
{
- if ( event.event == m_buttonDown->RetEventMsg() )
+ if ( event.type == m_buttonDown->GetEventType() )
{
- value = RetValue()-m_stepValue;
+ value = GetValue()-m_stepValue;
if ( value < m_minValue ) value = m_minValue;
SetValue(value, true);
HiliteValue(event);
@@ -195,20 +196,20 @@ bool CEditValue::EventProcess(const Event &event)
if ( !m_buttonDown->EventProcess(event) ) return false;
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELUP &&
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 4 &&
Detect(event.pos) )
{
- value = RetValue()+m_stepValue;
+ value = GetValue()+m_stepValue;
if ( value > m_maxValue ) value = m_maxValue;
SetValue(value, true);
HiliteValue(event);
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELDOWN &&
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 5 &&
Detect(event.pos) )
{
- value = RetValue()-m_stepValue;
+ value = GetValue()-m_stepValue;
if ( value < m_minValue ) value = m_minValue;
SetValue(value, true);
HiliteValue(event);
@@ -226,7 +227,7 @@ void CEditValue::HiliteValue(const Event &event)
if ( m_edit == 0 ) return;
- pos = m_edit->RetTextLength();
+ pos = m_edit->GetTextLength();
if ( m_type == EVT_100 && pos > 0 )
{
pos --; // not only selects the "%"
@@ -236,8 +237,9 @@ void CEditValue::HiliteValue(const Event &event)
m_edit->SetFocus(true);
Event newEvent = event;
- newEvent.event = EVENT_FOCUS;
- newEvent.param = m_edit->RetEventMsg();
+ newEvent.type = EVENT_ACTIVE;
+ newEvent.active.gain = true; // TODO not much pretty sure about it
+ newEvent.param = m_edit->GetEventType();
m_event->AddEvent(newEvent); // defocus the other objects
}
@@ -275,7 +277,7 @@ void CEditValue::SetType(EditValueType type)
m_type = type;
}
-EditValueType CEditValue::RetType()
+EditValueType CEditValue::GetType()
{
return m_type;
}
@@ -310,15 +312,14 @@ void CEditValue::SetValue(float value, bool bSendMessage)
if ( bSendMessage )
{
- Event newEvent;
- m_event->MakeEvent(newEvent, m_eventMsg);
+ Event newEvent(m_eventType);
m_event->AddEvent(newEvent);
}
}
// Return the edited value.
-float CEditValue::RetValue()
+float CEditValue::GetValue()
{
char text[100];
float value;
@@ -345,7 +346,7 @@ void CEditValue::SetStepValue(float value)
m_stepValue = value;
}
-float CEditValue::RetStepValue()
+float CEditValue::GetStepValue()
{
return m_stepValue;
}
@@ -358,7 +359,7 @@ void CEditValue::SetMinValue(float value)
m_minValue = value;
}
-float CEditValue::RetMinValue()
+float CEditValue::GetMinValue()
{
return m_minValue;
}
@@ -371,8 +372,9 @@ void CEditValue::SetMaxValue(float value)
m_maxValue = value;
}
-float CEditValue::RetMaxValue()
+float CEditValue::GetMaxValue()
{
return m_maxValue;
}
+}
diff --git a/src/ui/editvalue.h b/src/ui/editvalue.h
index dbb7812..c5c857c 100644
--- a/src/ui/editvalue.h
+++ b/src/ui/editvalue.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -22,6 +23,12 @@
#include "ui/control.h"
+namespace Gfx{
+class CEngine;
+}
+
+namespace Ui {
+
enum EditValueType
{
EVT_INT = 1, // integer
@@ -29,8 +36,6 @@ enum EditValueType
EVT_100 = 3, // percent (0 .. 1)
};
-
-class CD3DEngine;
class CEdit;
class CButton;
@@ -39,10 +44,11 @@ class CButton;
class CEditValue : public CControl
{
public:
- CEditValue(CInstanceManager* iMan);
+// CEditValue(CInstanceManager* iMan);
+ CEditValue();
virtual ~CEditValue();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
void SetPos(Math::Point pos);
void SetDim(Math::Point dim);
@@ -51,28 +57,28 @@ public:
void Draw();
void SetType(EditValueType type);
- EditValueType RetType();
+ EditValueType GetType();
void SetValue(float value, bool bSendMessage=false);
- float RetValue();
+ float GetValue();
void SetStepValue(float value);
- float RetStepValue();
+ float GetStepValue();
void SetMinValue(float value);
- float RetMinValue();
+ float GetMinValue();
void SetMaxValue(float value);
- float RetMaxValue();
+ float GetMaxValue();
protected:
void MoveAdjust();
void HiliteValue(const Event &event);
protected:
- CEdit* m_edit;
- CButton* m_buttonUp;
- CButton* m_buttonDown;
+ Ui::CEdit* m_edit;
+ Ui::CButton* m_buttonUp;
+ Ui::CButton* m_buttonDown;
EditValueType m_type;
float m_stepValue;
@@ -81,3 +87,4 @@ protected:
};
+}
diff --git a/src/ui/gauge.cpp b/src/ui/gauge.cpp
index 13cd4f7..cc4eca0 100644
--- a/src/ui/gauge.cpp
+++ b/src/ui/gauge.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,13 +18,14 @@
// gauge.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
@@ -31,10 +33,11 @@
-
+namespace Ui {
// Object's constructor.
-CGauge::CGauge(CInstanceManager* iMan) : CControl(iMan)
+//CGauge::CGauge(CInstanceManager* iMan) : CControl(iMan)
+CGauge::CGauge() : CControl()
{
m_level = 0.0f;
}
@@ -48,11 +51,11 @@ CGauge::~CGauge()
// Creates a new button.
-bool CGauge::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CGauge::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
- CControl::Create(pos, dim, icon, eventMsg);
+ CControl::Create(pos, dim, icon, eventType);
return true;
}
@@ -63,12 +66,12 @@ bool CGauge::EventProcess(const Event &event)
{
CControl::EventProcess(event);
- if ( event.event == EVENT_LBUTTONDOWN )
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN )
{
if ( CControl::Detect(event.pos) )
{
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
return false;
}
@@ -88,47 +91,47 @@ void CGauge::Draw()
if ( (m_state & STATE_VISIBLE) == 0 ) return;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
dp = 0.5f/256.0f;
pos = m_pos;
dim = m_dim;
- uv1.x = 32.0f/256.0f;
- uv1.y = 32.0f/256.0f;
- uv2.x = 64.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ uv1.x = 32.0f / 256.0f;
+ uv1.y = 32.0f / 256.0f;
+ uv2.x = 64.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 10.0f/640.0f;
- corner.y = 10.0f/480.0f;
+ corner.x = 10.0f / 640.0f;
+ corner.y = 10.0f / 480.0f;
DrawIcon(pos, dim, uv1, uv2, corner, 8.0f/256.0f);
- pos.x += 3.0f/640.0f;
- pos.y += 3.0f/480.0f;
- dim.x -= 6.0f/640.0f;
- dim.y -= 6.0f/480.0f;
+ pos.x += 3.0f / 640.0f;
+ pos.y += 3.0f / 480.0f;
+ dim.x -= 6.0f / 640.0f;
+ dim.y -= 6.0f / 480.0f;
if ( m_dim.x < m_dim.y ) // vertical gauge?
{
- uv1.x = (0.0f+m_icon*16.0f)/256.0f;
- uv2.x = uv1.x+16.0f/256.0f;
- uv1.y = 128.0f/256.0f+m_level*(64.0f/256.0f);
- uv2.y = uv1.y+64.0f/256.0f;
+ uv1.x = (0.0f + m_icon * 16.0f) / 256.0f;
+ uv2.x = uv1.x + 16.0f / 256.0f;
+ uv1.y = 128.0f/256.0f + m_level * (64.0f/256.0f);
+ uv2.y = uv1.y + 64.0f/256.0f;
}
else // horizontal gauge?
{
- uv1.x = 64.0f/256.0f+(1.0f-m_level)*(64.0f/256.0f);
- uv2.x = uv1.x+64.0f/256.0f;
- uv1.y = (128.0f+m_icon*16.0f)/256.0f;
- uv2.y = uv1.y+16.0f/256.0f;
+ uv1.x = 64.0f/256.0f + (1.0f - m_level) * (64.0f/256.0f);
+ uv2.x = uv1.x + 64.0f/256.0f;
+ uv1.y = (128.0f + m_icon*16.0f) / 256.0f;
+ uv2.y = uv1.y + 16.0f/256.0f;
}
uv1.x += dp;
@@ -149,9 +152,10 @@ void CGauge::SetLevel(float level)
m_level = level;
}
-float CGauge::RetLevel()
+float CGauge::GetLevel()
{
return m_level;
}
+}
diff --git a/src/ui/gauge.h b/src/ui/gauge.h
index bdc85ff..b745834 100644
--- a/src/ui/gauge.h
+++ b/src/ui/gauge.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -21,25 +22,27 @@
#include "ui/control.h"
+namespace Gfx{
+class CEngine;
+};
-class CD3DEngine;
-
-
+namespace Ui {
class CGauge : public CControl
{
public:
- CGauge(CInstanceManager* iMan);
+// CGauge(CInstanceManager* iMan);
+ CGauge();
virtual ~CGauge();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
bool EventProcess(const Event &event);
void Draw();
void SetLevel(float level);
- float RetLevel();
+ float GetLevel();
protected:
@@ -48,3 +51,4 @@ protected:
};
+}
diff --git a/src/ui/group.cpp b/src/ui/group.cpp
index 06290e4..da0aa37 100644
--- a/src/ui/group.cpp
+++ b/src/ui/group.cpp
@@ -17,13 +17,14 @@
// group.cpp
-#include <windows.h>
+//#include <windows.h>
#include <stdio.h>
-#include <d3d.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
@@ -32,10 +33,11 @@
-
+namespace Ui {
// Object's constructor.
-CGroup::CGroup(CInstanceManager* iMan) : CControl(iMan)
+//CGroup::CGroup(CInstanceManager* iMan) : CControl(iMan)
+CGroup::CGroup() : CControl()
{
}
@@ -48,18 +50,18 @@ CGroup::~CGroup()
// Creates a new button.
-bool CGroup::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CGroup::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
- CControl::Create(pos, dim, icon, eventMsg);
+ CControl::Create(pos, dim, icon, eventType);
if ( icon == -1 )
{
char name[100];
char* p;
- GetResource(RES_EVENT, eventMsg, name);
+ GetResource(RES_EVENT, eventType, name);
p = strchr(name, '\\');
if ( p != 0 ) *p = 0;
SetName(name);
@@ -92,16 +94,16 @@ void CGroup::Draw()
DrawShadow(m_pos, m_dim);
}
- dp = 0.5f/256.0f;
+ dp = 0.5f / 256.0f;
if ( m_icon == 0 ) // hollow frame?
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 160.0f/256.0f;
- uv1.y = 192.0f/256.0f; // u-v texture
- uv2.x = 192.0f/256.0f;
- uv2.y = 224.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 160.0f / 256.0f;
+ uv1.y = 192.0f / 256.0f; // u-v texture
+ uv2.x = 192.0f / 256.0f;
+ uv2.y = 224.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -113,11 +115,11 @@ void CGroup::Draw()
if ( m_icon == 1 ) // orange solid opaque?
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 104.0f/256.0f;
- uv1.y = 48.0f/256.0f;
- uv2.x = 112.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 104.0f / 256.0f;
+ uv1.y = 48.0f / 256.0f;
+ uv2.x = 112.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -127,11 +129,11 @@ void CGroup::Draw()
if ( m_icon == 2 ) // orange degrade -> transparent?
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
- uv1.x = 112.0f/256.0f;
- uv1.y = 48.0f/256.0f;
- uv2.x = 120.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
+ uv1.x = 112.0f / 256.0f;
+ uv1.y = 48.0f / 256.0f;
+ uv2.x = 120.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -141,11 +143,11 @@ void CGroup::Draw()
if ( m_icon == 3 ) // transparent gradient -> gray?
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
- uv1.x = 120.0f/256.0f;
- uv1.y = 48.0f/256.0f;
- uv2.x = 128.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
+ uv1.x = 120.0f / 256.0f;
+ uv1.y = 48.0f / 256.0f;
+ uv2.x = 128.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -155,11 +157,11 @@ void CGroup::Draw()
if ( m_icon == 4 ) // degrade blue corner?
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
- uv1.x = 192.0f/256.0f;
- uv1.y = 128.0f/256.0f;
- uv2.x = 224.0f/256.0f;
- uv2.y = 160.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
+ uv1.x = 192.0f / 256.0f;
+ uv1.y = 128.0f / 256.0f;
+ uv2.x = 224.0f / 256.0f;
+ uv2.y = 160.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -169,11 +171,11 @@ void CGroup::Draw()
if ( m_icon == 5 ) // degrade orange corner?
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
- uv1.x = 224.0f/256.0f;
- uv1.y = 128.0f/256.0f;
- uv2.x = 256.0f/256.0f;
- uv2.y = 160.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
+ uv1.x = 224.0f / 256.0f;
+ uv1.y = 128.0f / 256.0f;
+ uv2.x = 256.0f / 256.0f;
+ uv2.y = 160.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -183,27 +185,27 @@ void CGroup::Draw()
if ( m_icon == 6 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
- uv1.x = 0.0f/256.0f; // brown transparent
- uv1.y = 75.0f/256.0f;
- uv2.x = 64.0f/256.0f;
- uv2.y = 128.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
+ uv1.x = 0.0f / 256.0f; // brown transparent
+ uv1.y = 75.0f / 256.0f;
+ uv2.x = 64.0f / 256.0f;
+ uv2.y = 128.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 4.0f/640.0f;
- corner.y = 4.0f/480.0f;
+ corner.x = 4.0f / 640.0f;
+ corner.y = 4.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 8.0f/256.0f);
}
if ( m_icon == 7 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 64.0f/256.0f;
- uv1.y = 0.0f/256.0f;
- uv2.x = 96.0f/256.0f;
- uv2.y = 32.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 64.0f / 256.0f;
+ uv1.y = 0.0f / 256.0f;
+ uv2.x = 96.0f / 256.0f;
+ uv2.y = 32.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -213,11 +215,11 @@ void CGroup::Draw()
if ( m_icon == 8 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
- uv1.x = 64.0f/256.0f; // green transparent
- uv1.y = 160.0f/256.0f;
- uv2.x = 160.0f/256.0f;
- uv2.y = 176.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
+ uv1.x = 64.0f / 256.0f; // green transparent
+ uv1.y = 160.0f / 256.0f;
+ uv2.x = 160.0f / 256.0f;
+ uv2.y = 176.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -227,8 +229,8 @@ void CGroup::Draw()
if ( m_icon == 9 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
- uv1.x = 64.0f/256.0f; // red transparent
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
+ uv1.x = 64.0f / 256.0f; // red transparent
uv1.y = 176.0f/256.0f;
uv2.x = 160.0f/256.0f;
uv2.y = 192.0f/256.0f;
@@ -241,11 +243,11 @@ void CGroup::Draw()
if ( m_icon == 10 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
- uv1.x = 64.0f/256.0f; // blue transparent
- uv1.y = 192.0f/256.0f;
- uv2.x = 160.0f/256.0f;
- uv2.y = 208.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
+ uv1.x = 64.0f / 256.0f; // blue transparent
+ uv1.y = 192.0f / 256.0f;
+ uv2.x = 160.0f / 256.0f;
+ uv2.y = 208.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -255,11 +257,11 @@ void CGroup::Draw()
if ( m_icon == 11 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
- uv1.x = 64.0f/256.0f; // yellow transparent
- uv1.y = 224.0f/256.0f;
- uv2.x = 160.0f/256.0f;
- uv2.y = 240.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
+ uv1.x = 64.0f / 256.0f; // yellow transparent
+ uv1.y = 224.0f / 256.0f;
+ uv2.x = 160.0f / 256.0f;
+ uv2.y = 240.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -268,17 +270,17 @@ void CGroup::Draw()
}
if ( m_icon == 12 ) // viewfinder cross?
{
- dim.x = m_dim.x/2.0f;
- dim.y = m_dim.y/2.0f;
+ dim.x = m_dim.x / 2.0f;
+ dim.y = m_dim.y / 2.0f;
m_engine->SetTexture("mouse.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/300.0f;
pos.y = m_pos.y+m_dim.y/300.0f+dim.y;
- uv1.x = 0.5f/256.0f;
- uv1.y = 192.5f/256.0f;
- uv2.x = 63.5f/256.0f;
- uv2.y = 255.5f/256.0f;
+ uv1.x = 0.5f / 256.0f;
+ uv1.y = 192.5f / 256.0f;
+ uv2.x = 63.5f / 256.0f;
+ uv2.y = 255.5f / 256.0f;
DrawIcon(pos, dim, uv1, uv2); // ul
pos.x += dim.x;
Math::Swap(uv1.x, uv2.x);
@@ -290,13 +292,13 @@ void CGroup::Draw()
Math::Swap(uv1.x, uv2.x);
DrawIcon(pos, dim, uv1, uv2); // dl
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
pos.x = m_pos.x+m_dim.x/300.0f;
pos.y = m_pos.y-m_dim.y/300.0f+dim.y;
- uv1.x = 64.5f/256.0f;
- uv1.y = 192.5f/256.0f;
- uv2.x = 127.5f/256.0f;
- uv2.y = 255.5f/256.0f;
+ uv1.x = 64.5f / 256.0f;
+ uv1.y = 192.5f / 256.0f;
+ uv2.x = 127.5f / 256.0f;
+ uv2.y = 255.5f / 256.0f;
DrawIcon(pos, dim, uv1, uv2); // ul
pos.x += dim.x;
Math::Swap(uv1.x, uv2.x);
@@ -311,111 +313,111 @@ void CGroup::Draw()
if ( m_icon == 13 ) // corner upper / left?
{
m_engine->SetTexture("mouse.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/150.0f;
pos.y = m_pos.y+m_dim.y/150.0f;
- uv1.x = 128.5f/256.0f;
- uv1.y = 192.5f/256.0f;
- uv2.x = 191.5f/256.0f;
- uv2.y = 255.5f/256.0f;
+ uv1.x = 128.5f / 256.0f;
+ uv1.y = 192.5f / 256.0f;
+ uv2.x = 191.5f / 256.0f;
+ uv2.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
pos.x = m_pos.x+m_dim.x/150.0f;
pos.y = m_pos.y-m_dim.y/150.0f;
- uv1.x = 192.5f/256.0f;
- uv1.y = 192.5f/256.0f;
- uv2.x = 255.5f/256.0f;
- uv2.y = 255.5f/256.0f;
+ uv1.x = 192.5f / 256.0f;
+ uv1.y = 192.5f / 256.0f;
+ uv2.x = 255.5f / 256.0f;
+ uv2.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
}
if ( m_icon == 14 ) // corner upper / right?
{
m_engine->SetTexture("mouse.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/150.0f;
pos.y = m_pos.y+m_dim.y/150.0f;
- uv2.x = 128.5f/256.0f;
- uv1.y = 192.5f/256.0f;
- uv1.x = 191.5f/256.0f;
- uv2.y = 255.5f/256.0f;
+ uv2.x = 128.5f / 256.0f;
+ uv1.y = 192.5f / 256.0f;
+ uv1.x = 191.5f / 256.0f;
+ uv2.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
pos.x = m_pos.x+m_dim.x/150.0f;
pos.y = m_pos.y-m_dim.y/150.0f;
- uv2.x = 192.5f/256.0f;
- uv1.y = 192.5f/256.0f;
- uv1.x = 255.5f/256.0f;
- uv2.y = 255.5f/256.0f;
+ uv2.x = 192.5f / 256.0f;
+ uv1.y = 192.5f / 256.0f;
+ uv1.x = 255.5f / 256.0f;
+ uv2.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
}
if ( m_icon == 15 ) // corner lower / left?
{
m_engine->SetTexture("mouse.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/150.0f;
pos.y = m_pos.y+m_dim.y/150.0f;
- uv1.x = 128.5f/256.0f;
- uv2.y = 192.5f/256.0f;
- uv2.x = 191.5f/256.0f;
- uv1.y = 255.5f/256.0f;
+ uv1.x = 128.5f / 256.0f;
+ uv2.y = 192.5f / 256.0f;
+ uv2.x = 191.5f / 256.0f;
+ uv1.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
pos.x = m_pos.x+m_dim.x/150.0f;
pos.y = m_pos.y-m_dim.y/150.0f;
- uv1.x = 192.5f/256.0f;
- uv2.y = 192.5f/256.0f;
- uv2.x = 255.5f/256.0f;
- uv1.y = 255.5f/256.0f;
+ uv1.x = 192.5f / 256.0f;
+ uv2.y = 192.5f / 256.0f;
+ uv2.x = 255.5f / 256.0f;
+ uv1.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
}
if ( m_icon == 16 ) // corner lower / left?
{
m_engine->SetTexture("mouse.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
pos.x = m_pos.x-m_dim.x/150.0f;
pos.y = m_pos.y+m_dim.y/150.0f;
- uv2.x = 128.5f/256.0f;
- uv2.y = 192.5f/256.0f;
- uv1.x = 191.5f/256.0f;
- uv1.y = 255.5f/256.0f;
+ uv2.x = 128.5f / 256.0f;
+ uv2.y = 192.5f / 256.0f;
+ uv1.x = 191.5f / 256.0f;
+ uv1.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
pos.x = m_pos.x+m_dim.x/150.0f;
pos.y = m_pos.y-m_dim.y/150.0f;
- uv2.x = 192.5f/256.0f;
- uv2.y = 192.5f/256.0f;
- uv1.x = 255.5f/256.0f;
- uv1.y = 255.5f/256.0f;
+ uv2.x = 192.5f / 256.0f;
+ uv2.y = 192.5f / 256.0f;
+ uv1.x = 255.5f / 256.0f;
+ uv1.y = 255.5f / 256.0f;
DrawIcon(pos, m_dim, uv1, uv2);
}
if ( m_icon == 17 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 0.0f/256.0f; // blue frame
- uv1.y = 75.0f/256.0f;
- uv2.x = 64.0f/256.0f;
- uv2.y = 128.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 0.0f / 256.0f; // blue frame
+ uv1.y = 75.0f / 256.0f;
+ uv2.x = 64.0f / 256.0f;
+ uv2.y = 128.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 6.0f/640.0f;
- corner.y = 6.0f/480.0f;
+ corner.x = 6.0f / 640.0f;
+ corner.y = 6.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 2.0f/256.0f);
}
if ( m_icon == 18 ) // arrow> for SatCom?
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATETTw);
- uv1.x = 0.0f/256.0f; // >
- uv1.y = 192.0f/256.0f;
- uv2.x = 32.0f/256.0f;
- uv2.y = 224.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
+ uv1.x = 0.0f / 256.0f; // >
+ uv1.y = 192.0f / 256.0f;
+ uv2.x = 32.0f / 256.0f;
+ uv2.y = 224.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -425,11 +427,11 @@ void CGroup::Draw()
if ( m_icon == 19 ) // SatCom symbol?
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATETTw);
- uv1.x = 224.0f/256.0f; // SatCom symbol
- uv1.y = 224.0f/256.0f;
- uv2.x = 256.0f/256.0f;
- uv2.y = 256.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
+ uv1.x = 224.0f / 256.0f; // SatCom symbol
+ uv1.y = 224.0f / 256.0f;
+ uv2.x = 256.0f / 256.0f;
+ uv2.y = 256.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -439,11 +441,11 @@ void CGroup::Draw()
if ( m_icon == 20 ) // solid blue background?
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATETTw);
- uv1.x = 224.0f/256.0f;
- uv1.y = 32.0f/256.0f;
- uv2.x = 256.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
+ uv1.x = 224.0f / 256.0f;
+ uv1.y = 32.0f / 256.0f;
+ uv2.x = 256.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -453,11 +455,11 @@ void CGroup::Draw()
if ( m_icon == 21 ) // stand-by symbol?
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
- uv1.x = 160.0f/256.0f;
- uv1.y = 32.0f/256.0f;
- uv2.x = 192.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
+ uv1.x = 160.0f / 256.0f;
+ uv1.y = 32.0f / 256.0f;
+ uv2.x = 192.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -467,92 +469,92 @@ void CGroup::Draw()
if ( m_icon == 22 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 64.0f/256.0f; // opaque yellow
- uv1.y = 224.0f/256.0f;
- uv2.x = 160.0f/256.0f;
- uv2.y = 240.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 64.0f / 256.0f; // opaque yellow
+ uv1.y = 224.0f / 256.0f;
+ uv2.x = 160.0f / 256.0f;
+ uv2.y = 240.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 5.0f/640.0f;
- corner.y = 5.0f/480.0f;
+ corner.x = 5.0f / 640.0f;
+ corner.y = 5.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 3.0f/256.0f);
}
if ( m_icon == 23 )
{
m_engine->SetTexture("button3.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 64.0f/256.0f; // yellow
- uv1.y = 192.0f/256.0f;
- uv2.x = 80.0f/256.0f;
- uv2.y = 208.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 64.0f / 256.0f; // yellow
+ uv1.y = 192.0f / 256.0f;
+ uv2.x = 80.0f / 256.0f;
+ uv2.y = 208.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 4.0f/640.0f;
- corner.y = 4.0f/480.0f;
+ corner.x = 4.0f / 640.0f;
+ corner.y = 4.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 2.0f/256.0f);
}
if ( m_icon == 24 )
{
m_engine->SetTexture("button3.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 80.0f/256.0f; // orange
- uv1.y = 192.0f/256.0f;
- uv2.x = 96.0f/256.0f;
- uv2.y = 208.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 80.0f / 256.0f; // orange
+ uv1.y = 192.0f / 256.0f;
+ uv2.x = 96.0f / 256.0f;
+ uv2.y = 208.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 4.0f/640.0f;
- corner.y = 4.0f/480.0f;
+ corner.x = 4.0f / 640.0f;
+ corner.y = 4.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 2.0f/256.0f);
}
if ( m_icon == 25 )
{
m_engine->SetTexture("button3.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 64.0f/256.0f; // orange
- uv1.y = 208.0f/256.0f;
- uv2.x = 80.0f/256.0f;
- uv2.y = 224.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 64.0f / 256.0f; // orange
+ uv1.y = 208.0f / 256.0f;
+ uv2.x = 80.0f / 256.0f;
+ uv2.y = 224.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 4.0f/640.0f;
- corner.y = 4.0f/480.0f;
+ corner.x = 4.0f / 640.0f;
+ corner.y = 4.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 2.0f/256.0f);
}
if ( m_icon == 26 )
{
m_engine->SetTexture("button3.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 80.0f/256.0f; // red
- uv1.y = 208.0f/256.0f;
- uv2.x = 96.0f/256.0f;
- uv2.y = 224.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 80.0f / 256.0f; // red
+ uv1.y = 208.0f / 256.0f;
+ uv2.x = 96.0f / 256.0f;
+ uv2.y = 224.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 4.0f/640.0f;
- corner.y = 4.0f/480.0f;
+ corner.x = 4.0f / 640.0f;
+ corner.y = 4.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 2.0f/256.0f);
}
if ( m_icon == 27 )
{
m_engine->SetTexture("button3.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 32.0f/256.0f;
- uv1.y = 0.0f/256.0f;
- uv2.x = 64.0f/256.0f;
- uv2.y = 32.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 32.0f / 256.0f;
+ uv1.y = 0.0f / 256.0f;
+ uv2.x = 64.0f / 256.0f;
+ uv2.y = 32.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
@@ -566,9 +568,9 @@ void CGroup::Draw()
dim = m_dim;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 32.0f/256.0f;
- uv1.y = 32.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 32.0f / 256.0f;
+ uv1.y = 32.0f / 256.0f;
uv2.x = uv1.x+32.0f/256.0f;
uv2.y = uv1.y+32.0f/256.0f;
uv1.x += dp;
@@ -578,13 +580,13 @@ void CGroup::Draw()
DrawIcon(pos, dim, uv1, uv2);
m_engine->SetTexture("button3.tga");
- m_engine->SetState(D3DSTATENORMAL);
- pos.x += 8.0f/640.0f;
- pos.y += 8.0f/480.0f;
- dim.x -= 16.0f/640.0f;
- dim.y -= 16.0f/480.0f;
- uv1.x = 32.0f/256.0f;
- uv1.y = 0.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ pos.x += 8.0f / 640.0f;
+ pos.y += 8.0f / 480.0f;
+ dim.x -= 16.0f / 640.0f;
+ dim.y -= 16.0f / 480.0f;
+ uv1.x = 32.0f / 256.0f;
+ uv1.y = 0.0f / 256.0f;
uv2.x = uv1.x+32.0f/256.0f;
uv2.y = uv1.y+32.0f/256.0f;
uv1.x += dp;
@@ -593,13 +595,13 @@ void CGroup::Draw()
uv2.y -= dp;
DrawIcon(pos, dim, uv1, uv2);
- m_engine->SetState(D3DSTATENORMAL);
- pos.x += 2.0f/640.0f;
- pos.y += 2.0f/480.0f;
- dim.x -= 4.0f/640.0f;
- dim.y -= 4.0f/480.0f;
- uv1.x = 0.0f/256.0f;
- uv1.y = 0.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ pos.x += 2.0f / 640.0f;
+ pos.y += 2.0f / 480.0f;
+ dim.x -= 4.0f / 640.0f;
+ dim.y -= 4.0f / 480.0f;
+ uv1.x = 0.0f / 256.0f;
+ uv1.y = 0.0f / 256.0f;
uv2.x = uv1.x+32.0f/256.0f;
uv2.y = uv1.y+32.0f/256.0f;
uv1.x += dp;
@@ -608,11 +610,11 @@ void CGroup::Draw()
uv2.y -= dp;
DrawIcon(pos, dim, uv1, uv2);
- m_engine->SetState(D3DSTATETTb);
- pos.x += 8.0f/640.0f;
- pos.y += 8.0f/480.0f;
- dim.x -= 16.0f/640.0f;
- dim.y -= 16.0f/480.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
+ pos.x += 8.0f / 640.0f;
+ pos.y += 8.0f / 480.0f;
+ dim.x -= 16.0f / 640.0f;
+ dim.y -= 16.0f / 480.0f;
if ( m_icon == 100 ) icon = 43; // base ?
if ( m_icon == 101 ) icon = 32; // factory ?
if ( m_icon == 102 ) icon = 35; // research ?
@@ -642,3 +644,4 @@ void CGroup::Draw()
}
+}
diff --git a/src/ui/group.h b/src/ui/group.h
index baf609f..bfeef74 100644
--- a/src/ui/group.h
+++ b/src/ui/group.h
@@ -21,18 +21,20 @@
#include "ui/control.h"
+namespace Gfx{
+class CEngine;
+};
-class CD3DEngine;
-
-
+namespace Ui {
class CGroup : public CControl
{
public:
- CGroup(CInstanceManager* iMan);
+// CGroup(CInstanceManager* iMan);
+ CGroup();
virtual ~CGroup();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
bool EventProcess(const Event &event);
@@ -44,3 +46,4 @@ protected:
};
+}
diff --git a/src/ui/image.cpp b/src/ui/image.cpp
index 8bf46fb..5bf6e45 100644
--- a/src/ui/image.cpp
+++ b/src/ui/image.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,13 +18,14 @@
// image.cpp
-#include <windows.h>
+//#include <windows.h>
#include <stdio.h>
-#include <d3d.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+#include "graphics/engine/engine.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
@@ -32,10 +34,11 @@
-
+namespace Ui {
// Object's constructor.
-CImage::CImage(CInstanceManager* iMan) : CControl(iMan)
+//CImage::CImage(CInstanceManager* iMan) : CControl(iMan)
+CImage::CImage() : CControl()
{
m_filename[0] = 0;
}
@@ -46,25 +49,25 @@ CImage::~CImage()
{
if ( m_filename[0] != 0 )
{
- m_engine->FreeTexture(m_filename);
+ m_engine->DeleteTexture(m_filename);
}
}
// Creates a new button.
-bool CImage::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CImage::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
- CControl::Create(pos, dim, icon, eventMsg);
+ CControl::Create(pos, dim, icon, eventType);
if ( icon == -1 )
{
char name[100];
char* p;
- GetResource(RES_EVENT, eventMsg, name);
+ GetResource(RES_EVENT, eventType, name);
p = strchr(name, '\\');
if ( p != 0 ) *p = 0;
SetName(name);
@@ -80,13 +83,13 @@ void CImage::SetFilenameImage(char *name)
{
if ( m_filename[0] != 0 )
{
- m_engine->FreeTexture(m_filename);
+ m_engine->DeleteTexture(m_filename);
}
strcpy(m_filename, name);
}
-char* CImage::RetFilenameImage()
+char* CImage::GetFilenameImage()
{
return m_filename;
}
@@ -119,17 +122,17 @@ void CImage::Draw()
if ( m_icon == 0 ) // hollow frame?
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 160.0f/256.0f;
- uv1.y = 192.0f/256.0f; // u-v texture
- uv2.x = 192.0f/256.0f;
- uv2.y = 224.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 160.0f / 256.0f;
+ uv1.y = 192.0f / 256.0f; // u-v texture
+ uv2.x = 192.0f / 256.0f;
+ uv2.y = 224.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 10.0f/640.0f;
- corner.y = 10.0f/480.0f;
+ corner.x = 10.0f / 640.0f;
+ corner.y = 10.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 8.0f/256.0f);
}
@@ -137,13 +140,13 @@ void CImage::Draw()
{
m_engine->LoadTexture(m_filename);
m_engine->SetTexture(m_filename);
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
pos = m_pos;
dim = m_dim;
- pos.x += 5.0f/640.0f;
- pos.y += 5.0f/480.0f;
- dim.x -= 10.0f/640.0f;
- dim.y -= 10.0f/480.0f;
+ pos.x += 5.0f / 640.0f;
+ pos.y += 5.0f / 480.0f;
+ dim.x -= 10.0f / 640.0f;
+ dim.y -= 10.0f / 480.0f;
uv1.x = 0.0f;
uv1.y = 0.0f;
uv2.x = 1.0f;
@@ -153,3 +156,4 @@ void CImage::Draw()
}
+}
diff --git a/src/ui/image.h b/src/ui/image.h
index 85c5962..f24684a 100644
--- a/src/ui/image.h
+++ b/src/ui/image.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -21,25 +22,28 @@
#include "ui/control.h"
-
-class CD3DEngine;
+namespace Gfx{
+class CEngine;
+};
+namespace Ui {
class CImage : public CControl
{
public:
- CImage(CInstanceManager* iMan);
+// CImage(CInstanceManager* iMan);
+ CImage ();
virtual ~CImage();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
bool EventProcess(const Event &event);
void Draw();
void SetFilenameImage(char *name);
- char* RetFilenameImage();
+ char* GetFilenameImage();
protected:
@@ -48,3 +52,4 @@ protected:
};
+}
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index 50d2352..6c96501 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,55 +18,21 @@
// interface.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "common/iman.h"
-#include "ui/control.h"
-#include "ui/button.h"
-#include "ui/color.h"
-#include "ui/check.h"
-#include "ui/key.h"
-#include "ui/group.h"
-#include "ui/image.h"
-#include "ui/label.h"
-#include "ui/edit.h"
-#include "ui/editvalue.h"
-#include "ui/scroll.h"
-#include "ui/slider.h"
-#include "ui/list.h"
-#include "ui/shortcut.h"
-#include "ui/compass.h"
-#include "ui/target.h"
-#include "ui/map.h"
-#include "ui/window.h"
-#include "old/camera.h"
-#include "ui/interface.h"
-
-
-
-
-// Object's constructor.
-
-CInterface::CInterface(CInstanceManager* iMan)
-{
- int i;
+#include <ui/interface.h>
- m_iMan = iMan;
- m_iMan->AddInstance(CLASS_INTERFACE, this);
+namespace Ui {
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_camera = 0;
- for ( i=0 ; i<MAXCONTROL ; i++ )
+CInterface::CInterface()
+{
+ m_iMan = CInstanceManager::GetInstancePointer();
+ m_iMan->AddInstance(CLASS_INTERFACE, this);
+ m_event = static_cast<CEventQueue *>( m_iMan->SearchInstance(CLASS_EVENT) );
+ m_engine = static_cast<Gfx::CEngine *>( m_iMan->SearchInstance(CLASS_ENGINE) );
+
+ for (int i = 0; i < MAXCONTROL; i++ )
{
- m_table[i] = 0;
+ m_table[i] = nullptr;
}
}
@@ -74,6 +41,7 @@ CInterface::CInterface(CInstanceManager* iMan)
CInterface::~CInterface()
{
Flush();
+ m_iMan->DeleteInstance(CLASS_INTERFACE, this);
}
@@ -81,424 +49,210 @@ CInterface::~CInterface()
void CInterface::Flush()
{
- int i;
-
- for ( i=0 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] != 0 )
- {
+ for (int i = 0; i < MAXCONTROL; i++ ) {
+ if ( m_table[i] != nullptr ) {
delete m_table[i];
- m_table[i] = 0;
+ m_table[i] = nullptr;
}
}
}
-// Creates a new button.
-
-CWindow* CInterface::CreateWindows(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+int CInterface::GetNextFreeControl()
{
- CWindow* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- if ( eventMsg == EVENT_WINDOW0 ) {i=0; goto create;}
- if ( eventMsg == EVENT_WINDOW1 ) {i=1; goto create;}
- if ( eventMsg == EVENT_WINDOW2 ) {i=2; goto create;}
- if ( eventMsg == EVENT_WINDOW3 ) {i=3; goto create;}
- if ( eventMsg == EVENT_WINDOW4 ) {i=4; goto create;}
- if ( eventMsg == EVENT_WINDOW5 ) {i=5; goto create;}
- if ( eventMsg == EVENT_WINDOW6 ) {i=6; goto create;}
- if ( eventMsg == EVENT_WINDOW7 ) {i=7; goto create;}
- if ( eventMsg == EVENT_WINDOW8 ) {i=8; goto create;}
- if ( eventMsg == EVENT_WINDOW9 ) {i=9; goto create;}
-
- if ( eventMsg == EVENT_TOOLTIP ) {i=MAXCONTROL-1; goto create;}
-
- for ( i=10 ; i<MAXCONTROL-1 ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- create:
- m_table[i] = new CWindow(m_iMan);
- pc = (CWindow*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
+ for (int i = 10; i < MAXCONTROL-1; i++) {
+ if (m_table[i] == nullptr)
+ return i;
}
- return 0;
+ return -1;
}
-// Creates a new button.
-CButton* CInterface::CreateButton(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+template <typename T> inline T* CInterface::CreateControl(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CButton* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CButton(m_iMan);
- pc = (CButton*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ T* pc;
+ int index;
+ if (eventMsg == EVENT_NULL)
+ eventMsg = GetUniqueEventType();
+
+ if ((index = GetNextFreeControl()) < 0)
+ return nullptr;
+
+ m_table[index] = new T();
+ pc = static_cast<T *>(m_table[index]);
+ pc->Create(pos, dim, icon, eventMsg);
+ return pc;
}
+
// Creates a new button.
-CColor* CInterface::CreateColor(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CWindow* CInterface::CreateWindows(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CColor* pc;
- int i;
+ CWindow* pc;
+ int index;
+ if (eventMsg == EVENT_NULL)
+ eventMsg = GetUniqueEventType();
+
+ switch (eventMsg) {
+ case EVENT_WINDOW0: index = 0; break;
+ case EVENT_WINDOW1: index = 1; break;
+ case EVENT_WINDOW2: index = 2; break;
+ case EVENT_WINDOW3: index = 3; break;
+ case EVENT_WINDOW4: index = 4; break;
+ case EVENT_WINDOW5: index = 5; break;
+ case EVENT_WINDOW6: index = 6; break;
+ case EVENT_WINDOW7: index = 7; break;
+ case EVENT_WINDOW8: index = 8; break;
+ case EVENT_WINDOW9: index = 9; break;
+ case EVENT_TOOLTIP: index = MAXCONTROL-1; break;
+ default: index = GetNextFreeControl(); break;
+ }
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if (index < 0)
+ return nullptr;
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CColor(m_iMan);
- pc = (CColor*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ m_table[index] = new CWindow();
+ pc = static_cast<CWindow *>(m_table[index]);
+ pc->Create(pos, dim, icon, eventMsg);
+ return pc;
}
// Creates a new button.
-CCheck* CInterface::CreateCheck(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CButton* CInterface::CreateButton(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CCheck* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CCheck(m_iMan);
- pc = (CCheck*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CButton>(pos, dim, icon, eventMsg);
}
// Creates a new button.
-CKey* CInterface::CreateKey(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CColor* CInterface::CreateColor(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CKey* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CKey(m_iMan);
- pc = (CKey*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CColor>(pos, dim, icon, eventMsg);
}
// Creates a new button.
-CGroup* CInterface::CreateGroup(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CCheck* CInterface::CreateCheck(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CGroup* pc;
- int i;
+ return CreateControl<CCheck>(pos, dim, icon, eventMsg);
+}
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+// Creates a new button.
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CGroup(m_iMan);
- pc = (CGroup*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+CKey* CInterface::CreateKey(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
+{
+ return CreateControl<CKey>(pos, dim, icon, eventMsg);
}
// Creates a new button.
-CImage* CInterface::CreateImage(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CGroup* CInterface::CreateGroup(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CImage* pc;
- int i;
+ return CreateControl<CGroup>(pos, dim, icon, eventMsg);
+}
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+// Creates a new button.
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CImage(m_iMan);
- pc = (CImage*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+CImage* CInterface::CreateImage(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
+{
+ return CreateControl<CImage>(pos, dim, icon, eventMsg);
}
// Creates a new label.
-CLabel* CInterface::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg,
- char *name)
+CLabel* CInterface::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, const char *name)
{
- CLabel* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CLabel(m_iMan);
- pc = (CLabel*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- pc->SetName(name);
- return pc;
- }
- }
- return 0;
+ CLabel* pc = CreateControl<CLabel>(pos, dim, icon, eventMsg);
+ if (pc != nullptr)
+ pc->SetName(name);
+ return pc;
}
// Creates a new pave editable.
-CEdit* CInterface::CreateEdit(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CEdit* CInterface::CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CEdit* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CEdit(m_iMan);
- pc = (CEdit*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CEdit>(pos, dim, icon, eventMsg);
}
// Creates a new pave editable.
-CEditValue* CInterface::CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CEditValue* CInterface::CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CEditValue* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CEditValue(m_iMan);
- pc = (CEditValue*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CEditValue>(pos, dim, icon, eventMsg);
}
// Creates a new lift.
-CScroll* CInterface::CreateScroll(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CScroll* CInterface::CreateScroll(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CScroll* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CScroll(m_iMan);
- pc = (CScroll*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CScroll>(pos, dim, icon, eventMsg);
}
// Creates a new cursor.
-CSlider* CInterface::CreateSlider(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CSlider* CInterface::CreateSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CSlider* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CSlider(m_iMan);
- pc = (CSlider*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CSlider>(pos, dim, icon, eventMsg);
}
// Creates a new list.
-CList* CInterface::CreateList(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg,
- float expand)
+CList* CInterface::CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand)
{
- CList* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CList(m_iMan);
- pc = (CList*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg, expand);
- return pc;
- }
- }
- return 0;
+ CList* pc;
+ int index;
+ if (eventMsg == EVENT_NULL)
+ eventMsg = GetUniqueEventType();
+
+ if ((index = GetNextFreeControl()) < 0)
+ return nullptr;
+
+ m_table[index] = new CList();
+ pc = static_cast<CList *>(m_table[index]);
+ pc->Create(pos, dim, icon, eventMsg, expand);
+ return pc;
}
// Creates a new shortcut.
-CShortcut* CInterface::CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CShortcut* CInterface::CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CShortcut* ps;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CShortcut(m_iMan);
- ps = (CShortcut*)m_table[i];
- ps->Create(pos, dim, icon, eventMsg);
- return ps;
- }
- }
- return 0;
+ return CreateControl<CShortcut>(pos, dim, icon, eventMsg);
}
// Creates a new compass.
-CCompass* CInterface::CreateCompass(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CCompass* CInterface::CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CCompass* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CCompass(m_iMan);
- pc = (CCompass*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CCompass>(pos, dim, icon, eventMsg);
}
// Creates a new target.
-CTarget* CInterface::CreateTarget(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CTarget* CInterface::CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CTarget* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CTarget(m_iMan);
- pc = (CTarget*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CTarget>(pos, dim, icon, eventMsg);
}
// Creates a new map.
-CMap* CInterface::CreateMap(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CMap* CInterface::CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CMap* pm;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CMap(m_iMan);
- pm = (CMap*)m_table[i];
- pm->Create(pos, dim, icon, eventMsg);
- return pm;
- }
- }
- return 0;
+ return CreateControl<CMap>(pos, dim, icon, eventMsg);
}
// Removes a control.
-bool CInterface::DeleteControl(EventMsg eventMsg)
+bool CInterface::DeleteControl(EventType eventMsg)
{
- int i;
-
- for ( i=0 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] != 0 )
- {
- if ( eventMsg == m_table[i]->RetEventMsg() )
- {
+ for (int i = 0; i < MAXCONTROL; i++) {
+ if ( m_table[i] != nullptr ) {
+ if (eventMsg == m_table[i]->GetEventType()) {
delete m_table[i];
- m_table[i] = 0;
+ m_table[i] = nullptr;
return true;
}
}
@@ -508,47 +262,32 @@ bool CInterface::DeleteControl(EventMsg eventMsg)
// Gives a control.
-CControl* CInterface::SearchControl(EventMsg eventMsg)
+CControl* CInterface::SearchControl(EventType eventMsg)
{
- int i;
-
- for ( i=0 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] != 0 )
- {
- if ( eventMsg == m_table[i]->RetEventMsg() )
- {
+ for (int i = 0; i < MAXCONTROL; i++) {
+ if (m_table[i] != nullptr) {
+ if (eventMsg == m_table[i]->GetEventType())
return m_table[i];
- }
}
}
- return 0;
+ return nullptr;
}
// Management of an event.
bool CInterface::EventProcess(const Event &event)
{
- int i;
-
- if ( event.event == EVENT_MOUSEMOVE )
- {
- if ( m_camera == 0 )
- {
- m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
+ if (event.type == EVENT_MOUSE_MOVE) {
+ if (m_camera == nullptr) {
+ m_camera = static_cast<Gfx::CCamera *>(m_iMan->SearchInstance(CLASS_CAMERA));
}
- m_engine->SetMouseType(m_camera->RetMouseDef(event.pos));
+ m_engine->SetMouseType(m_camera->GetMouseDef(event.pos));
}
- for ( i=MAXCONTROL-1 ; i>=0 ; i-- )
- {
- if ( m_table[i] != 0 &&
- m_table[i]->TestState(STATE_ENABLE) )
- {
+ for (int i = MAXCONTROL-1; i >= 0; i--) {
+ if (m_table[i] != nullptr && m_table[i]->TestState(STATE_ENABLE)) {
if ( !m_table[i]->EventProcess(event) )
- {
return false;
- }
}
}
@@ -558,18 +297,12 @@ bool CInterface::EventProcess(const Event &event)
// Gives the tooltip binding to the window.
-bool CInterface::GetTooltip(Math::Point pos, char* name)
+bool CInterface::GetTooltip(Math::Point pos, const char* name)
{
- int i;
-
- for ( i=MAXCONTROL-1 ; i>=0 ; i-- )
- {
- if ( m_table[i] != 0 )
- {
- if ( m_table[i]->GetTooltip(pos, name) )
- {
+ for (int i = MAXCONTROL-1; i >= 0; i--) {
+ if (m_table[i] != nullptr) {
+ if (m_table[i]->GetTooltip(pos, name))
return true;
- }
}
}
return false;
@@ -580,26 +313,19 @@ bool CInterface::GetTooltip(Math::Point pos, char* name)
void CInterface::Draw()
{
- D3DMATERIAL7 material;
- int i;
-
- ZeroMemory( &material, sizeof(D3DMATERIAL7) );
+ /*ZeroMemory( &material, sizeof(D3DMATERIAL7) );
material.diffuse.r = 1.0f;
material.diffuse.g = 1.0f;
material.diffuse.b = 1.0f;
material.ambient.r = 0.5f;
material.ambient.g = 0.5f;
material.ambient.b = 0.5f;
- m_engine->SetMaterial(material);
+ m_engine->SetMaterial(material);*/
- for ( i=0 ; i<MAXCONTROL ; i++ )
-//? for ( i=MAXCONTROL-1 ; i>=0 ; i-- )
- {
- if ( m_table[i] != 0 )
- {
+ for (int i = 0; i < MAXCONTROL; i++) {
+ if ( m_table[i] != nullptr )
m_table[i]->Draw();
- }
}
}
-
+}
diff --git a/src/ui/interface.h b/src/ui/interface.h
index 8aa7f44..02966ff 100644
--- a/src/ui/interface.h
+++ b/src/ui/interface.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -19,77 +20,85 @@
#pragma once
-#include "common/event.h"
-#include "math/point.h"
+#include <common/event.h>
+#include <common/struct.h>
+#include <common/misc.h>
+#include <common/iman.h>
+#include <math/point.h>
-class CInstanceManager;
-class CD3DEngine;
-class CControl;
-class CWindow;
+#include <graphics/engine/camera.h>
+#include <graphics/engine/engine.h>
+
+namespace Ui {
+
+const int MAXCONTROL = 100;
+
+//Forward declaration
class CButton;
-class CColor;
class CCheck;
-class CKey;
+class CColor;
+class CCompass;
+class CControl;
+class CEdit;
+class CEditValue;
class CGroup;
class CImage;
+class CKey;
class CLabel;
-class CEdit;
-class CEditValue;
-class CScroll;
-class CSlider;
class CList;
-class CShortcut;
class CMap;
-class CGauge;
-class CCompass;
+class CScroll;
+class CShortcut;
+class CSlider;
class CTarget;
-class CCamera;
-
-
-const int MAXCONTROL = 100;
-
+class CWindow;
class CInterface
{
-public:
- CInterface(CInstanceManager* iMan);
- ~CInterface();
-
- bool EventProcess(const Event &event);
- bool GetTooltip(Math::Point pos, char* name);
-
- void Flush();
- CWindow* CreateWindows(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CButton* CreateButton(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CColor* CreateColor(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CCheck* CreateCheck(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CKey* CreateKey(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CGroup* CreateGroup(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CImage* CreateImage(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg, char *name);
- CEdit* CreateEdit(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CEditValue* CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CScroll* CreateScroll(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CSlider* CreateSlider(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CList* CreateList(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg, float expand=1.2f);
- CShortcut* CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CCompass* CreateCompass(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CTarget* CreateTarget(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CMap* CreateMap(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- bool DeleteControl(EventMsg eventMsg);
- CControl* SearchControl(EventMsg eventMsg);
-
- void Draw();
-
-protected:
-
-protected:
- CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CCamera* m_camera;
-
- CControl* m_table[MAXCONTROL];
+ public:
+ CInterface();
+ ~CInterface();
+
+ bool EventProcess(const Event &event);
+ bool GetTooltip(Math::Point pos, const char* name);
+
+ void Flush();
+ CButton* CreateButton(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CColor* CreateColor(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CCheck* CreateCheck(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CKey* CreateKey(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CGroup* CreateGroup(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CImage* CreateImage(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CEdit* CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CEditValue* CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CScroll* CreateScroll(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CSlider* CreateSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CShortcut* CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CCompass* CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CTarget* CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CMap* CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+
+ CWindow* CreateWindows(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CList* CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand=1.2f);
+ CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, const char *name);
+
+ bool DeleteControl(EventType eventMsg);
+ CControl* SearchControl(EventType eventMsg);
+
+ void Draw();
+
+ protected:
+ int GetNextFreeControl();
+ template <typename T> inline T* CreateControl(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+
+ CInstanceManager* m_iMan;
+ CEventQueue* m_event;
+ Gfx::CEngine* m_engine;
+ Gfx::CCamera* m_camera;
+
+ CControl* m_table[MAXCONTROL];
};
+}
diff --git a/src/ui/key.cpp b/src/ui/key.cpp
index a1eebb3..0cf74bc 100644
--- a/src/ui/key.cpp
+++ b/src/ui/key.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,54 +18,33 @@
// key.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+#include <ui/key.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "common/iman.h"
-#include "common/restext.h"
-#include "old/sound.h"
-#include "old/text.h"
-#include "ui/key.h"
-
-
-
-
-// Constructs the name of a button.
+namespace Ui {
void GetKeyName(char *name, int key)
{
- if ( !GetResource(RES_KEY, key, name) )
- {
- if ( (key >= '0' && key <= '9') ||
- (key >= 'A' && key <= 'Z') ||
- (key >= 'a' && key <= 'z') )
- {
+ if ( !GetResource(RES_KEY, key, name) ) {
+ if (isalnum(key)) {
name[0] = key;
name[1] = 0;
}
- else
- {
+ else {
sprintf(name, "Code %d", key);
}
}
}
-
-
// Object's constructor.
-CKey::CKey(CInstanceManager* iMan) : CControl(iMan)
+CKey::CKey() : CControl()
{
m_key[0] = 0;
m_key[1] = 0;
m_bCatch = false;
+
+ m_app = CApplication::GetInstancePointer();
}
// Object's destructor.
@@ -76,18 +56,14 @@ CKey::~CKey()
// Creates a new button.
-bool CKey::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CKey::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- char name[100];
- char* p;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ char name[100];
+ if (eventMsg == EVENT_NULL)
+ eventMsg = GetUniqueEventType();
CControl::Create(pos, dim, icon, eventMsg);
-
GetResource(RES_EVENT, eventMsg, name);
- p = strchr(name, '\\');
- if ( p != 0 ) *p = 0;
SetName(name);
return true;
@@ -98,47 +74,33 @@ bool CKey::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
bool CKey::EventProcess(const Event &event)
{
- if ( m_state & STATE_DEAD ) return true;
+ if (m_state & STATE_DEAD)
+ return true;
CControl::EventProcess(event);
- if ( event.event == EVENT_LBUTTONDOWN )
- {
- if ( Detect(event.pos) )
- {
- m_bCatch = true;
- }
- else
- {
- m_bCatch = false;
- }
+ if (event.type == EVENT_MOUSE_BUTTON_DOWN) {
+ if (event.mouseButton.button == 1) // left
+ m_bCatch = Detect(event.pos);
}
- if ( event.event == EVENT_KEYDOWN && m_bCatch )
- {
+ if (event.type == EVENT_MOUSE_BUTTON_DOWN && m_bCatch) {
m_bCatch = false;
- if ( TestKey(event.param) ) // impossible ?
- {
+ if ( TestKey(event.param) ) { // impossible ?
m_sound->Play(SOUND_TZOING);
- }
- else
- {
- if ( event.param == m_key[0] ||
- event.param == m_key[1] )
- {
+ } else {
+ if ( event.param == m_key[0] || event.param == m_key[1] ) {
m_key[0] = event.param;
m_key[1] = 0;
- }
- else
- {
+ } else {
m_key[1] = m_key[0];
m_key[0] = event.param;
}
m_sound->Play(SOUND_CLICK);
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
return false;
@@ -152,25 +114,17 @@ bool CKey::EventProcess(const Event &event)
bool CKey::TestKey(int key)
{
- int i, j;
-
- if ( key == VK_PAUSE ||
- key == VK_SNAPSHOT ) return true; // blocked key
-
- for ( i=0 ; i<20 ; i++ )
- {
- for ( j=0 ; j<2 ; j++ )
- {
- if ( key == m_engine->RetKey(i, j) ) // key used?
- {
- m_engine->SetKey(i, j, 0); // nothing!
- }
+ if ( key == KEY(PAUSE) || key == KEY(PRINT) ) return true; // blocked key
+
+ for (int i = 0; i < 20; i++) {
+ for (int j = 0; j < 2; j++) {
+ if (key == m_app->GetKey(i, j) ) // key used?
+ m_app->SetKey(i, j, 0); // nothing!
}
- if ( m_engine->RetKey(i, 0) == 0 ) // first free option?
- {
- m_engine->SetKey(i, 0, m_engine->RetKey(i, 1)); // shift
- m_engine->SetKey(i, 1, 0);
+ if ( m_app->GetKey(i, 0) == 0 ) { // first free option?
+ m_app->SetKey(i, 0, m_app->GetKey(i, 1)); // shift
+ m_app->SetKey(i, 1, 0);
}
}
@@ -182,107 +136,99 @@ bool CKey::TestKey(int key)
void CKey::Draw()
{
- Math::Point iDim, pos;
- float zoomExt, zoomInt, h;
- int icon;
- char text[100];
+ Math::Point iDim, pos;
+ float zoomExt, zoomInt, h;
+ int icon;
+ char text[100];
- if ( (m_state & STATE_VISIBLE) == 0 ) return;
+ if ( (m_state & STATE_VISIBLE) == 0 )
+ return;
iDim = m_dim;
m_dim.x = 200.0f/640.0f;
if ( m_state & STATE_SHADOW )
- {
DrawShadow(m_pos, m_dim);
- }
+
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); // was D3DSTATENORMAL
zoomExt = 1.00f;
zoomInt = 0.95f;
icon = 2;
- if ( m_key[0] == 0 &&
- m_key[1] == 0 ) // no shortcut?
- {
+ if ( m_key[0] == 0 && m_key[1] == 0 ) // no shortcut?
icon = 3;
- }
- if ( m_state & STATE_DEFAULT )
- {
+
+ if ( m_state & STATE_DEFAULT ) {
DrawPart(23, 1.3f, 0.0f);
zoomExt *= 1.15f;
zoomInt *= 1.15f;
}
+
if ( m_state & STATE_HILIGHT )
- {
icon = 1;
- }
+
if ( m_state & STATE_CHECK )
- {
icon = 0;
- }
- if ( m_state & STATE_PRESS )
- {
+
+ if ( m_state & STATE_PRESS ) {
icon = 3;
zoomInt *= 0.9f;
}
+
if ( (m_state & STATE_ENABLE) == 0 )
- {
icon = 7;
- }
+
if ( m_state & STATE_DEAD )
- {
icon = 17;
- }
+
if ( m_bCatch )
- {
icon = 23;
- }
- DrawPart(icon, zoomExt, 8.0f/256.0f); // draws the button
- h = m_engine->RetText()->RetHeight(m_fontSize, m_fontType)/2.0f;
+ DrawPart(icon, zoomExt, 8.0f / 256.0f); // draws the button
+
+ h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize) / 2.0f;
GetKeyName(text, m_key[0]);
- if ( m_key[1] != 0 )
- {
+ if ( m_key[1] != 0 ) {
GetResource(RES_TEXT, RT_KEY_OR, text+strlen(text));
GetKeyName(text+strlen(text), m_key[1]);
}
- pos.x = m_pos.x+m_dim.x*0.5f;
- pos.y = m_pos.y+m_dim.y*0.5f;
+ pos.x = m_pos.x + m_dim.x * 0.5f;
+ pos.y = m_pos.y + m_dim.y * 0.5f;
pos.y -= h;
- m_engine->RetText()->DrawText(text, pos, m_dim.x, 0, m_fontSize, m_fontStretch, m_fontType, 0);
+ m_engine->GetText()->DrawText(std::string(text), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_CENTER, 0);
m_dim = iDim;
- if ( m_state & STATE_DEAD ) return;
+ if ( m_state & STATE_DEAD )
+ return;
// Draws the name.
- pos.x = m_pos.x+(214.0f/640.0f);
- pos.y = m_pos.y+m_dim.y*0.5f;
+ pos.x = m_pos.x + (214.0f / 640.0f);
+ pos.y = m_pos.y + m_dim.y * 0.5f;
pos.y -= h;
- m_engine->RetText()->DrawText(m_name, pos, m_dim.x, 1, m_fontSize, m_fontStretch, m_fontType, 0);
+ m_engine->GetText()->DrawText(std::string(m_name), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, 0);
}
void CKey::SetKey(int option, int key)
{
- if ( option < 0 ||
- option > 1 ) return;
+ if ( option < 0 || option > 1 ) return;
m_key[option] = key;
}
-int CKey::RetKey(int option)
+int CKey::GetKey(int option)
{
- if ( option < 0 ||
- option > 1 ) return 0;
+ if ( option < 0 || option > 1 ) return 0;
return m_key[option];
}
+}
diff --git a/src/ui/key.h b/src/ui/key.h
index 314f39b..5ca71b0 100644
--- a/src/ui/key.h
+++ b/src/ui/key.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -18,35 +19,43 @@
#pragma once
+#include <cctype>
+#include <string>
-#include "ui/control.h"
+#include <ui/control.h>
+#include <common/iman.h>
+#include <common/event.h>
+#include <common/restext.h>
+#include <common/key.h>
-class CD3DEngine;
-
+#include <app/app.h>
+namespace Ui {
class CKey : public CControl
{
-public:
- CKey(CInstanceManager* iMan);
- virtual ~CKey();
+ public:
+ CKey();
+ virtual ~CKey();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool EventProcess(const Event &event);
- bool EventProcess(const Event &event);
+ void Draw();
- void Draw();
+ void SetKey(int option, int key);
+ int GetKey(int option);
- void SetKey(int option, int key);
- int RetKey(int option);
+ protected:
+ bool TestKey(int key);
-protected:
- bool TestKey(int key);
+ int m_key[2];
+ bool m_bCatch;
-protected:
- int m_key[2];
- bool m_bCatch;
+ CApplication *m_app;
};
+}
+
diff --git a/src/ui/label.cpp b/src/ui/label.cpp
index cd96493..c5da211 100644
--- a/src/ui/label.cpp
+++ b/src/ui/label.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,25 +18,14 @@
// label.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "common/iman.h"
-#include "old/text.h"
-#include "ui/label.h"
-
+#include <ui/label.h>
+namespace Ui {
// Object's constructor.
-CLabel::CLabel(CInstanceManager* iMan) : CControl(iMan)
+CLabel::CLabel() : CControl()
{
}
@@ -48,9 +38,10 @@ CLabel::~CLabel()
// Creates a new button.
-bool CLabel::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CLabel::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if (eventMsg == EVENT_NULL)
+ eventMsg = GetUniqueEventType();
CControl::Create(pos, dim, icon, eventMsg);
return true;
@@ -72,22 +63,18 @@ void CLabel::Draw()
{
Math::Point pos;
- if ( (m_state & STATE_VISIBLE) == 0 ) return;
+ if ( (m_state & STATE_VISIBLE) == 0 )
+ return;
- pos.y = m_pos.y+m_dim.y/2.0f;
+ pos.y = m_pos.y + m_dim.y / 2.0f;
- if ( m_justif > 0 )
- {
- pos.x = m_pos.x;
- }
- if ( m_justif == 0 )
- {
- pos.x = m_pos.x+m_dim.x/2.0f;
+ switch (m_textAlign) {
+ case Gfx::TEXT_ALIGN_RIGHT: pos.x = m_pos.x; break;
+ case Gfx::TEXT_ALIGN_CENTER: pos.x = m_pos.x + m_dim.x / 2.0f; break;
+ case Gfx::TEXT_ALIGN_LEFT: pos.x = m_pos.x + m_dim.x; break;
}
- if ( m_justif < 0 )
- {
- pos.x = m_pos.x+m_dim.x;
- }
- m_engine->RetText()->DrawText(m_name, pos, m_dim.x, m_justif, m_fontSize, m_fontStretch, m_fontType, 0);
+
+ m_engine->GetText()->DrawText(std::string(m_name), m_fontType, m_fontSize, pos, m_dim.x, m_textAlign, 0);
}
+}
diff --git a/src/ui/label.h b/src/ui/label.h
index d3cb915..6fe2e31 100644
--- a/src/ui/label.h
+++ b/src/ui/label.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -19,28 +20,24 @@
#pragma once
-#include "ui/control.h"
-
-
-class CD3DEngine;
+#include <ui/control.h>
+#include <common/event.h>
+#include <common/misc.h>
+namespace Ui {
class CLabel : public CControl
{
-public:
- CLabel(CInstanceManager* iMan);
- virtual ~CLabel();
-
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
-
- bool EventProcess(const Event &event);
-
- void Draw();
+ public:
+ CLabel();
+ virtual ~CLabel();
-protected:
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool EventProcess(const Event &event);
-protected:
+ void Draw();
};
+}
diff --git a/src/ui/list.cpp b/src/ui/list.cpp
index 9fbc5d9..73a48e3 100644
--- a/src/ui/list.cpp
+++ b/src/ui/list.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,50 +18,31 @@
// list.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "common/iman.h"
-#include "ui/button.h"
-#include "ui/scroll.h"
-#include "old/text.h"
-#include "ui/list.h"
+#include <ui/list.h>
+namespace Ui {
const float MARGING = 4.0f;
-
// Object's constructor.
-CList::CList(CInstanceManager* iMan) : CControl(iMan)
+CList::CList() : CControl()
{
- int i;
-
- for ( i=0 ; i<LISTMAXDISPLAY ; i++ )
- {
- m_button[i] = 0;
- }
- m_scroll = 0;
+ for (int i = 0; i < LISTMAXDISPLAY; i++)
+ m_button[i] = nullptr;
- for ( i=0 ; i<LISTMAXTOTAL ; i++ )
- {
+ m_scroll = nullptr;
+ for (int i = 0; i < LISTMAXTOTAL; i++) {
m_text[i][0] = 0;
m_check[i] = false;
m_enable[i] = true;
}
- for ( i=0 ; i<10 ; i++ )
- {
+ for (int i = 0; i < 10; i++) {
m_tabs[i] = 0.0f;
- m_justifs[i] = 1;
+ m_justifs[i] = Gfx::TEXT_ALIGN_RIGHT;
}
m_totalLine = 0;
@@ -76,29 +58,30 @@ CList::CList(CInstanceManager* iMan) : CControl(iMan)
CList::~CList()
{
- int i;
-
- for ( i=0 ; i<LISTMAXDISPLAY ; i++ )
- {
- delete m_button[i];
+ for (int i = 0; i < LISTMAXDISPLAY; i++) {
+ if (m_button[i] != nullptr)
+ delete m_button[i];
}
- delete m_scroll;
+
+ if (m_scroll != nullptr)
+ delete m_scroll;
}
// Creates a new list.
-bool CList::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg,
- float expand)
+bool CList::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand)
{
m_expand = expand;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if (eventMsg == EVENT_NULL)
+ eventMsg = GetUniqueEventType();
+
CControl::Create(pos, dim, icon, eventMsg);
- m_scroll = new CScroll(m_iMan);
+ m_scroll = new CScroll();
m_scroll->Create(pos, dim, 0, EVENT_NULL);
- m_eventScroll = m_scroll->RetEventMsg();
+ m_eventScroll = m_scroll->GetEventType();
return MoveAdjust();
}
@@ -107,52 +90,54 @@ bool CList::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg
bool CList::MoveAdjust()
{
- Math::Point ipos, idim, ppos, ddim;
- float marging, h;
- int i;
+ Math::Point ipos, idim, ppos, ddim;
+ float marging, h;
- for ( i=0 ; i<LISTMAXDISPLAY ; i++ )
- {
- delete m_button[i];
- m_button[i] = 0;
+ for (int i = 0; i < LISTMAXDISPLAY; i++) {
+ if (m_button[i] != nullptr) {
+ delete m_button[i];
+ m_button[i] = nullptr;
+ }
}
- if ( m_icon == 0 ) marging = MARGING;
- else marging = 0.0f;
+ if (m_icon == 0)
+ marging = MARGING;
+ else
+ marging = 0.0f;
- ipos.x = m_pos.x+marging/640.f;
- ipos.y = m_pos.y+marging/480.f;
- idim.x = m_dim.x-marging*2.0f/640.f;
- idim.y = m_dim.y-marging*2.0f/480.f;
+ ipos.x = m_pos.x + marging / 640.f;
+ ipos.y = m_pos.y + marging / 480.f;
+ idim.x = m_dim.x - marging * 2.0f / 640.f;
+ idim.y = m_dim.y - marging * 2.0f / 480.f;
- h = m_engine->RetText()->RetHeight(m_fontSize, m_fontType)*m_expand;
+ h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize) * m_expand;
- m_displayLine = (int)(idim.y/h);
- if ( m_displayLine == 0 ) return false;
- if ( m_displayLine > LISTMAXDISPLAY ) m_displayLine = LISTMAXDISPLAY;
- idim.y = h*m_displayLine;
- m_dim.y = idim.y+marging*2.0f/480.f;
+ m_displayLine = static_cast<int>(idim.y / h);
+ if (m_displayLine == 0)
+ return false;
+ if (m_displayLine > LISTMAXDISPLAY)
+ m_displayLine = LISTMAXDISPLAY;
+ idim.y = h * m_displayLine;
+ m_dim.y = idim.y + marging * 2.0f / 480.f;
ppos.x = ipos.x;
- ppos.y = ipos.y+idim.y-h;
- ddim.x = idim.x-SCROLL_WIDTH;
+ ppos.y = ipos.y + idim.y - h;
+ ddim.x = idim.x - SCROLL_WIDTH;
ddim.y = h;
- for ( i=0 ; i<m_displayLine ; i++ )
- {
- m_button[i] = new CButton(m_iMan);
+ for (int i = 0; i < m_displayLine; i++) {
+ m_button[i] = new CButton();
m_button[i]->Create(ppos, ddim, -1, EVENT_NULL);
- m_button[i]->SetJustif(1);
+ m_button[i]->SetTextAlign(Gfx::TEXT_ALIGN_RIGHT);
m_button[i]->SetState(STATE_SIMPLY);
m_button[i]->SetFontType(m_fontType);
m_button[i]->SetFontSize(m_fontSize);
ppos.y -= h;
- m_eventButton[i] = m_button[i]->RetEventMsg();
+ m_eventButton[i] = m_button[i]->GetEventType();
}
- if ( m_scroll != 0 )
- {
- ppos.x = ipos.x+idim.x-SCROLL_WIDTH;
+ if ( m_scroll != nullptr ) {
+ ppos.x = ipos.x + idim.x - SCROLL_WIDTH;
ppos.y = ipos.y;
ddim.x = SCROLL_WIDTH;
ddim.y = idim.y;
@@ -168,19 +153,22 @@ bool CList::MoveAdjust()
// Returns the message of a button.
-EventMsg CList::RetEventMsgButton(int i)
+EventType CList::GetEventMsgButton(int i)
{
- if ( i < 0 || i >= m_displayLine ) return EVENT_NULL;
- if ( m_button[i] == 0 ) return EVENT_NULL;
- return m_button[i]->RetEventMsg();
+ if (i < 0 || i >= m_displayLine)
+ return EVENT_NULL;
+ if (m_button[i] == nullptr)
+ return EVENT_NULL;
+ return m_button[i]->GetEventType();
}
// Returns the message from the elevator.
-EventMsg CList::RetEventMsgScroll()
+EventType CList::GetEventMsgScroll()
{
- if ( m_scroll == 0 ) return EVENT_NULL;
- return m_scroll->RetEventMsg();
+ if (m_scroll == nullptr)
+ return EVENT_NULL;
+ return m_scroll->GetEventType();
}
@@ -189,6 +177,7 @@ void CList::SetPos(Math::Point pos)
CControl::SetPos(pos);
}
+
void CList::SetDim(Math::Point dim)
{
m_dim = dim;
@@ -199,47 +188,43 @@ void CList::SetDim(Math::Point dim)
bool CList::SetState(int state, bool bState)
{
- int i;
-
- if ( state & STATE_ENABLE )
- {
- for ( i=0 ; i<m_displayLine ; i++ )
- {
- if ( m_button[i] != 0 ) m_button[i]->SetState(state, bState);
+ if (state & STATE_ENABLE) {
+ for (int i = 0; i < m_displayLine; i++) {
+ if (m_button[i] != nullptr)
+ m_button[i]->SetState(state, bState);
}
- if ( m_scroll != 0 ) m_scroll->SetState(state, bState);
+ if (m_scroll != nullptr)
+ m_scroll->SetState(state, bState);
}
return CControl::SetState(state, bState);
}
+
bool CList::SetState(int state)
{
- int i;
-
- if ( state & STATE_ENABLE )
- {
- for ( i=0 ; i<m_displayLine ; i++ )
- {
- if ( m_button[i] != 0 ) m_button[i]->SetState(state);
+ if (state & STATE_ENABLE) {
+ for (int i = 0; i < m_displayLine; i++) {
+ if (m_button[i] != nullptr)
+ m_button[i]->SetState(state);
}
- if ( m_scroll != 0 ) m_scroll->SetState(state);
+ if (m_scroll != nullptr)
+ m_scroll->SetState(state);
}
return CControl::SetState(state);
}
+
bool CList::ClearState(int state)
{
- int i;
-
- if ( state & STATE_ENABLE )
- {
- for ( i=0 ; i<m_displayLine ; i++ )
- {
- if ( m_button[i] != 0 ) m_button[i]->ClearState(state);
+ if (state & STATE_ENABLE) {
+ for (int i = 0; i < m_displayLine; i++) {
+ if (m_button[i] != nullptr)
+ m_button[i]->ClearState(state);
}
- if ( m_scroll != 0 ) m_scroll->ClearState(state);
+ if (m_scroll != nullptr)
+ m_scroll->ClearState(state);
}
return CControl::ClearState(state);
@@ -250,47 +235,38 @@ bool CList::ClearState(int state)
bool CList::EventProcess(const Event &event)
{
- int i;
-
- if ( m_bBlink && // blinks?
- event.event == EVENT_FRAME )
- {
+ int i;
+ if (m_bBlink && event.type == EVENT_FRAME) {
i = m_selectLine-m_firstLine;
- if ( i >= 0 && i < 4 &&
- m_button[i] != 0 )
- {
+ if (i >= 0 && i < 4 && m_button[i] != nullptr) {
m_blinkTime += event.rTime;
- if ( Math::Mod(m_blinkTime, 0.7f) < 0.3f )
- {
+ if (Math::Mod(m_blinkTime, 0.7f) < 0.3f) {
m_button[i]->ClearState(STATE_ENABLE);
m_button[i]->ClearState(STATE_CHECK);
- }
- else
- {
+ } else {
m_button[i]->SetState(STATE_ENABLE);
m_button[i]->SetState(STATE_CHECK);
}
}
}
- if ( (m_state & STATE_VISIBLE) == 0 ) return true;
- if ( (m_state & STATE_ENABLE) == 0 ) return true;
+ if ((m_state & STATE_VISIBLE) == 0)
+ return true;
+ if ((m_state & STATE_ENABLE) == 0)
+ return true;
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELUP &&
- Detect(event.pos) )
- {
- if ( m_firstLine > 0 ) m_firstLine --;
+ if (event.type == EVENT_KEY_DOWN && event.mouseButton.button == 5 && Detect(event.pos)) {
+ if (m_firstLine > 0)
+ m_firstLine--;
UpdateScroll();
UpdateButton();
return true;
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELDOWN &&
- Detect(event.pos) )
- {
- if ( m_firstLine < m_totalLine-m_displayLine ) m_firstLine ++;
+
+ if (event.type == EVENT_KEY_DOWN && event.mouseButton.button == 4 && Detect(event.pos)) {
+ if (m_firstLine < m_totalLine - m_displayLine)
+ m_firstLine++;
UpdateScroll();
UpdateButton();
return true;
@@ -298,46 +274,41 @@ bool CList::EventProcess(const Event &event)
CControl::EventProcess(event);
- if ( event.event == EVENT_MOUSEMOVE && Detect(event.pos) )
- {
- m_engine->SetMouseType(D3DMOUSENORM);
- for ( i=0 ; i<m_displayLine ; i++ )
- {
- if ( i+m_firstLine >= m_totalLine ) break;
- if ( m_button[i] != 0 )
- {
+ if (event.type == EVENT_MOUSE_MOVE && Detect(event.pos)) {
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
+ for (i = 0; i < m_displayLine; i++) {
+ if (i + m_firstLine >= m_totalLine)
+ break;
+ if (m_button[i] != nullptr)
m_button[i]->EventProcess(event);
- }
}
}
- if ( m_bSelectCap )
- {
- for ( i=0 ; i<m_displayLine ; i++ )
- {
- if ( i+m_firstLine >= m_totalLine ) break;
- if ( m_button[i] != 0 )
- {
- if ( !m_button[i]->EventProcess(event) ) return false;
-
- if ( event.event == m_eventButton[i] )
- {
- SetSelect(m_firstLine+i);
+ if (m_bSelectCap) {
+ for (i = 0; i < m_displayLine; i++) {
+ if (i + m_firstLine >= m_totalLine)
+ break;
+
+ if (m_button[i] != nullptr) {
+ if (!m_button[i]->EventProcess(event))
+ return false;
+
+ if (event.type == m_eventButton[i]) {
+ SetSelect(m_firstLine + i);
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent); // selected line changes
}
}
}
}
- if ( m_scroll != 0 )
- {
- if ( !m_scroll->EventProcess(event) ) return false;
+ if (m_scroll != nullptr) {
+ if (!m_scroll->EventProcess(event))
+ return false;
- if ( event.event == m_eventScroll )
- {
+ if (event.type == m_eventScroll) {
MoveScroll();
UpdateButton();
}
@@ -353,46 +324,40 @@ void CList::Draw()
{
Math::Point uv1, uv2, corner, pos, dim, ppos, ddim;
float dp;
- int i, j;
+ int i;
char text[100];
char *pb, *pe;
- if ( (m_state & STATE_VISIBLE) == 0 ) return;
+ if ((m_state & STATE_VISIBLE) == 0)
+ return;
- if ( m_state & STATE_SHADOW )
- {
+ if (m_state & STATE_SHADOW)
DrawShadow(m_pos, m_dim);
- }
- dp = 0.5f/256.0f;
+ dp = 0.5f / 256.0f;
- if ( m_icon != -1 )
- {
+ if (m_icon != -1) {
dim = m_dim;
- if ( m_icon == 0 )
- {
+ if (m_icon == 0) {
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 128.0f/256.0f;
- uv1.y = 64.0f/256.0f; // u-v texture
- uv2.x = 160.0f/256.0f;
- uv2.y = 96.0f/256.0f;
- }
- else
- {
+ uv1.x = 128.0f / 256.0f;
+ uv1.y = 64.0f / 256.0f; // u-v texture
+ uv2.x = 160.0f / 256.0f;
+ uv2.y = 96.0f / 256.0f;
+ } else {
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
- uv1.x = 132.0f/256.0f;
- uv1.y = 68.0f/256.0f; // u-v texture
- uv2.x = 156.0f/256.0f;
- uv2.y = 92.0f/256.0f;
+ uv1.x = 132.0f / 256.0f;
+ uv1.y = 68.0f / 256.0f; // u-v texture
+ uv2.x = 156.0f / 256.0f;
+ uv2.y = 92.0f / 256.0f;
- if ( m_button[0] != 0 )
- {
- dim = m_button[0]->RetDim();
+ if (m_button[0] != nullptr) {
+ dim = m_button[0]->GetDim();
dim.y *= m_displayLine; // background sounds spot behind
}
}
@@ -402,28 +367,26 @@ void CList::Draw()
uv2.x -= dp;
uv2.y -= dp;
- corner.x = 10.0f/640.0f;
- corner.y = 10.0f/480.0f;
- DrawIcon(m_pos, dim, uv1, uv2, corner, 8.0f/256.0f);
+ corner.x = 10.0f / 640.0f;
+ corner.y = 10.0f / 480.0f;
+ DrawIcon(m_pos, dim, uv1, uv2, corner, 8.0f / 256.0f);
}
- if ( m_totalLine < m_displayLine ) // no buttons to the bottom?
- {
+ if ( m_totalLine < m_displayLine ) { // no buttons to the bottom?
i = m_totalLine;
- if ( m_button[i] != 0 )
- {
- pos = m_button[i]->RetPos();
- dim = m_button[i]->RetDim();
- pos.y += dim.y*1.1f;
+ if ( m_button[i] != 0 ) {
+ pos = m_button[i]->GetPos();
+ dim = m_button[i]->GetDim();
+ pos.y += dim.y * 1.1f;
dim.y *= 0.4f;
pos.y -= dim.y;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
- uv1.x = 120.0f/256.0f;
- uv1.y = 64.0f/256.0f;
- uv2.x = 128.0f/256.0f;
- uv2.y = 48.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); // was D3DSTATETTw
+ uv1.x = 120.0f / 256.0f;
+ uv1.y = 64.0f / 256.0f;
+ uv2.x = 128.0f / 256.0f;
+ uv2.y = 48.0f / 256.0f;
uv1.x += dp;
uv1.y -= dp;
uv2.x -= dp;
@@ -432,108 +395,93 @@ void CList::Draw()
}
}
- for ( i=0 ; i<m_displayLine ; i++ )
- {
- if ( i+m_firstLine >= m_totalLine ) break;
+ for (i = 0; i < m_displayLine; i++) {
+ if ( i + m_firstLine >= m_totalLine )
+ break;
- if ( m_button[i] != 0 )
- {
- if ( !m_bBlink && i+m_firstLine < m_totalLine )
- {
+ if ( m_button[i] != nullptr ) {
+ if ( !m_bBlink && i + m_firstLine < m_totalLine )
m_button[i]->SetState(STATE_ENABLE, m_enable[i+m_firstLine] && (m_state & STATE_ENABLE) );
- }
+
m_button[i]->Draw(); // draws a box without text
// draws text in the box
- pos = m_button[i]->RetPos();
- dim = m_button[i]->RetDim();
- if ( m_tabs[0] == 0.0f )
- {
- ppos.x = pos.x+dim.y*0.5f;
- ppos.y = pos.y+dim.y*0.5f;
- ppos.y -= m_engine->RetText()->RetHeight(m_fontSize, m_fontType)/2.0f;
+ pos = m_button[i]->GetPos();
+ dim = m_button[i]->GetDim();
+ if ( m_tabs[0] == 0.0f ) {
+ ppos.x = pos.x + dim.y * 0.5f;
+ ppos.y = pos.y + dim.y * 0.5f;
+ ppos.y -= m_engine->GetText()->GetHeight(m_fontType, m_fontSize) / 2.0f;
ddim.x = dim.x-dim.y;
- DrawCase(m_text[i+m_firstLine], ppos, ddim.x, 1);
- }
- else
- {
- ppos.x = pos.x+dim.y*0.5f;
- ppos.y = pos.y+dim.y*0.5f;
- ppos.y -= m_engine->RetText()->RetHeight(m_fontSize, m_fontType)/2.0f;
- pb = m_text[i+m_firstLine];
- for ( j=0 ; j<10 ; j++ )
- {
+ DrawCase(m_text[i + m_firstLine], ppos, ddim.x, Gfx::TEXT_ALIGN_RIGHT);
+ } else {
+ ppos.x = pos.x + dim.y * 0.5f;
+ ppos.y = pos.y + dim.y * 0.5f;
+ ppos.y -= m_engine->GetText()->GetHeight(m_fontType, m_fontSize) / 2.0f;
+ pb = m_text[i + m_firstLine];
+ for (int j = 0; j < 10; j++) {
pe = strchr(pb, '\t');
if ( pe == 0 )
- {
strcpy(text, pb);
- }
- else
- {
- strncpy(text, pb, pe-pb);
- text[pe-pb] = 0;
+ else {
+ strncpy(text, pb, pe - pb);
+ text[pe - pb] = 0;
}
DrawCase(text, ppos, m_tabs[j], m_justifs[j]);
- if ( pe == 0 ) break;
+ if ( pe == 0 )
+ break;
ppos.x += m_tabs[j];
- pb = pe+1;
+ pb = pe + 1;
}
}
- if ( (m_state & STATE_EXTEND) && i < m_totalLine )
- {
- pos = m_button[i]->RetPos();
- dim = m_button[i]->RetDim();
- pos.x += dim.x-dim.y*0.75f;
- dim.x = dim.y*0.75f;
- pos.x += 2.0f/640.0f;
- pos.y += 2.0f/480.0f;
- dim.x -= 4.0f/640.0f;
- dim.y -= 4.0f/480.0f;
-
- if ( m_check[i+m_firstLine] )
- {
+ if ( (m_state & STATE_EXTEND) && i < m_totalLine) {
+ pos = m_button[i]->GetPos();
+ dim = m_button[i]->GetDim();
+ pos.x += dim.x - dim.y * 0.75f;
+ dim.x = dim.y * 0.75f;
+ pos.x += 2.0f / 640.0f;
+ pos.y += 2.0f / 480.0f;
+ dim.x -= 4.0f / 640.0f;
+ dim.y -= 4.0f / 480.0f;
+
+ if ( m_check[i + m_firstLine] ) {
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 64.0f/256.0f;
- uv1.y = 0.0f/256.0f;
- uv2.x = 96.0f/256.0f;
- uv2.y = 32.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 64.0f / 256.0f;
+ uv1.y = 0.0f / 256.0f;
+ uv2.x = 96.0f / 256.0f;
+ uv2.y = 32.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
DrawIcon(pos, dim, uv1, uv2); // square shape
- m_engine->SetState(D3DSTATETTw);
- uv1.x = 0.0f/256.0f; // v
- uv1.y = 64.0f/256.0f;
- uv2.x = 32.0f/256.0f;
- uv2.y = 96.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); // was D3DSTATETTw
+ uv1.x = 0.0f / 256.0f; // v
+ uv1.y = 64.0f / 256.0f;
+ uv2.x = 32.0f / 256.0f;
+ uv2.y = 96.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
DrawIcon(pos, dim, uv1, uv2); // draws v
- }
- else
- {
+ } else {
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATETTw);
- if ( i+m_firstLine == m_selectLine )
- {
- uv1.x =224.0f/256.0f; // <
- uv1.y =192.0f/256.0f;
- uv2.x =256.0f/256.0f;
- uv2.y =224.0f/256.0f;
- }
- else
- {
- uv1.x = 96.0f/256.0f; // x
- uv1.y = 32.0f/256.0f;
- uv2.x =128.0f/256.0f;
- uv2.y = 64.0f/256.0f;
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); // was D3DSTATETTw
+ if ( i + m_firstLine == m_selectLine ) {
+ uv1.x =224.0f / 256.0f; // <
+ uv1.y =192.0f / 256.0f;
+ uv2.x =256.0f / 256.0f;
+ uv2.y =224.0f / 256.0f;
+ } else {
+ uv1.x = 96.0f / 256.0f; // x
+ uv1.y = 32.0f / 256.0f;
+ uv2.x =128.0f / 256.0f;
+ uv2.y = 64.0f / 256.0f;
}
uv1.x += dp;
uv1.y += dp;
@@ -546,29 +494,18 @@ void CList::Draw()
}
if ( m_scroll != 0 )
- {
m_scroll->Draw(); // draws the lift
- }
}
// Displays text in a box.
-void CList::DrawCase(char *text, Math::Point pos, float width, int justif)
+void CList::DrawCase(char *text, Math::Point pos, float width, Gfx::TextAlign justif)
{
- if ( justif == 1 )
- {
- m_engine->RetText()->DrawText(text, pos, width, 1, m_fontSize, m_fontStretch, m_fontType, 0);
- }
- else if ( justif == 0 )
- {
- pos.x += width/2.0f;
- m_engine->RetText()->DrawText(text, pos, width, 0, m_fontSize, m_fontStretch, m_fontType, 0);
- }
- else
- {
+ if (justif == Gfx::TEXT_ALIGN_CENTER)
+ pos.x += width / 2.0f;
+ else if (justif == Gfx::TEXT_ALIGN_LEFT)
pos.x += width;
- m_engine->RetText()->DrawText(text, pos, width, -1, m_fontSize, m_fontStretch, m_fontType, 0);
- }
+ m_engine->GetText()->DrawText(std::string(text), m_fontType, m_fontSize, pos, width, justif, 0);
}
@@ -593,7 +530,7 @@ void CList::SetTotal(int i)
// Returns the total number of lines.
-int CList::RetTotal()
+int CList::GetTotal()
{
return m_totalLine;
}
@@ -604,11 +541,8 @@ int CList::RetTotal()
void CList::SetSelect(int i)
{
if ( m_bSelectCap )
- {
m_selectLine = i;
- }
- else
- {
+ else {
m_firstLine = i;
UpdateScroll();
}
@@ -618,16 +552,12 @@ void CList::SetSelect(int i)
// Returns the selected line.
-int CList::RetSelect()
+int CList::GetSelect()
{
if ( m_bSelectCap )
- {
return m_selectLine;
- }
else
- {
return m_firstLine;
- }
}
@@ -638,7 +568,7 @@ void CList::SetSelectCap(bool bEnable)
m_bSelectCap = bEnable;
}
-bool CList::RetSelectCap()
+bool CList::GetSelectCap()
{
return m_bSelectCap;
}
@@ -648,25 +578,22 @@ bool CList::RetSelectCap()
void CList::SetBlink(bool bEnable)
{
- int i;
+ int i;
m_bBlink = bEnable;
m_blinkTime = 0.0f;
i = m_selectLine-m_firstLine;
- if ( i >= 0 && i < 4 &&
- m_button[i] != 0 )
- {
- if ( !bEnable )
- {
+ if (i >= 0 && i < 4 && m_button[i] != nullptr) {
+ if ( !bEnable ) {
m_button[i]->SetState(STATE_CHECK);
m_button[i]->ClearState(STATE_ENABLE);
}
}
}
-bool CList::RetBlink()
+bool CList::GetBlink()
{
return m_bBlink;
}
@@ -676,30 +603,27 @@ bool CList::RetBlink()
void CList::SetName(int i, char* name)
{
- if ( i < 0 || i >= LISTMAXTOTAL ) return;
+ if ( i < 0 || i >= LISTMAXTOTAL )
+ return;
if ( i >= m_totalLine )
- {
m_totalLine = i+1; // expands the list
- }
if ( name[0] == 0 )
- {
strcpy(m_text[i], " ");
- }
else
- {
strcpy(m_text[i], name);
- }
+
UpdateButton();
UpdateScroll();
}
// Returns the text of a line.
-char* CList::RetName(int i)
+char* CList::GetName(int i)
{
- if ( i < 0 || i >= m_totalLine ) return 0;
+ if ( i < 0 || i >= m_totalLine )
+ return 0;
return m_text[i];
}
@@ -709,16 +633,18 @@ char* CList::RetName(int i)
void CList::SetCheck(int i, bool bMode)
{
- if ( i < 0 || i >= m_totalLine ) return;
+ if ( i < 0 || i >= m_totalLine )
+ return;
m_check[i] = bMode;
}
// Returns the bit "check" for a box.
-bool CList::RetCheck(int i)
+bool CList::GetCheck(int i)
{
- if ( i < 0 || i >= m_totalLine ) return false;
+ if ( i < 0 || i >= m_totalLine )
+ return false;
return m_check[i];
}
@@ -728,16 +654,18 @@ bool CList::RetCheck(int i)
void CList::SetEnable(int i, bool bMode)
{
- if ( i < 0 || i >= m_totalLine ) return;
+ if ( i < 0 || i >= m_totalLine )
+ return;
m_enable[i] = bMode;
}
// Returns the bit "enable" for a box.
-bool CList::RetEnable(int i)
+bool CList::GetEnable(int i)
{
- if ( i < 0 || i >= m_totalLine ) return false;
+ if ( i < 0 || i >= m_totalLine )
+ return false;
return m_enable[i];
}
@@ -745,16 +673,18 @@ bool CList::RetEnable(int i)
// Management of the position of the tabs.
-void CList::SetTabs(int i, float pos, int justif)
+void CList::SetTabs(int i, float pos, Gfx::TextAlign justif)
{
- if ( i < 0 || i >= 10 ) return;
+ if ( i < 0 || i >= 10 )
+ return;
m_tabs[i] = pos;
m_justifs[i] = justif;
}
-float CList::RetTabs(int i)
+float CList::GetTabs(int i)
{
- if ( i < 0 || i >= 10 ) return 0.0f;
+ if ( i < 0 || i >= 10 )
+ return 0.0f;
return m_tabs[i];
}
@@ -765,19 +695,20 @@ void CList::ShowSelect(bool bFixed)
{
int sel;
- if ( bFixed &&
- m_selectLine >= m_firstLine &&
- m_selectLine < m_firstLine+m_displayLine ) return; // all good
+ if ( bFixed && m_selectLine >= m_firstLine && m_selectLine < m_firstLine+m_displayLine )
+ return; // all good
sel = m_selectLine;
// Down from 1/2 * h.
- sel += m_displayLine/2;
- if ( sel > m_totalLine-1 ) sel = m_totalLine-1;
+ sel += m_displayLine / 2;
+ if ( sel > m_totalLine - 1 )
+ sel = m_totalLine - 1;
// Back to h-1.
- sel -= m_displayLine-1;
- if ( sel < 0 ) sel = 0;
+ sel -= m_displayLine - 1;
+ if ( sel < 0 )
+ sel = 0;
m_firstLine = sel;
@@ -790,25 +721,22 @@ void CList::ShowSelect(bool bFixed)
void CList::UpdateButton()
{
- int state, i, j;
+ int state, i, j;
- state = CControl::RetState();
+ state = CControl::GetState();
j = m_firstLine;
- for ( i=0 ; i<m_displayLine ; i++ )
- {
- if ( m_button[i] == 0 ) continue;
+ for (i = 0; i < m_displayLine; i++) {
+ if (m_button[i] == nullptr)
+ continue;
m_button[i]->SetState(STATE_CHECK, (j == m_selectLine));
- if ( j < m_totalLine )
- {
+ if ( j < m_totalLine ) {
//? m_button[i]->SetName(m_text[j]);
m_button[i]->SetName(" "); // blank button
m_button[i]->SetState(STATE_ENABLE, (state & STATE_ENABLE));
- }
- else
- {
+ } else {
m_button[i]->SetName(" "); // blank button
m_button[i]->ClearState(STATE_ENABLE);
}
@@ -820,27 +748,28 @@ void CList::UpdateButton()
void CList::UpdateScroll()
{
- float ratio, value, step;
+ float ratio, value, step;
- if ( m_scroll == 0 ) return;
+ if (m_scroll == nullptr)
+ return;
- if ( m_totalLine <= m_displayLine )
- {
+ if (m_totalLine <= m_displayLine) {
ratio = 1.0f;
value = 0.0f;
step = 0.0f;
- }
- else
- {
- ratio = (float)m_displayLine/m_totalLine;
+ } else {
+ ratio = (float)m_displayLine / m_totalLine;
if ( ratio > 1.0f ) ratio = 1.0f;
- value = (float)m_firstLine/(m_totalLine-m_displayLine);
- if ( value < 0.0f ) value = 0.0f;
- if ( value > 1.0f ) value = 1.0f;
+ value = (float)m_firstLine / (m_totalLine - m_displayLine);
+ if ( value < 0.0f )
+ value = 0.0f;
+ if ( value > 1.0f )
+ value = 1.0f;
- step = (float)1.0f/(m_totalLine-m_displayLine);
- if ( step < 0.0f ) step = 0.0f;
+ step = (float)1.0f/ (m_totalLine - m_displayLine);
+ if ( step < 0.0f )
+ step = 0.0f;
}
m_scroll->SetVisibleRatio(ratio);
@@ -852,17 +781,21 @@ void CList::UpdateScroll()
void CList::MoveScroll()
{
- float pos;
- int n;
+ float pos;
+ int n;
- if ( m_scroll == 0 ) return;
+ if ( m_scroll == 0 )
+ return;
- n = m_totalLine-m_displayLine;
- pos = m_scroll->RetVisibleValue();
- pos += m_scroll->RetArrowStep()/2.0f; // it's magic!
- m_firstLine = (int)(pos*n);
- if ( m_firstLine < 0 ) m_firstLine = 0;
- if ( m_firstLine > n ) m_firstLine = n;
+ n = m_totalLine - m_displayLine;
+ pos = m_scroll->GetVisibleValue();
+ pos += m_scroll->GetArrowStep() / 2.0f; // it's magic!
+ m_firstLine = (int)(pos * n);
+ if ( m_firstLine < 0 )
+ m_firstLine = 0;
+ if ( m_firstLine > n )
+ m_firstLine = n;
}
+}
diff --git a/src/ui/list.h b/src/ui/list.h
index cc9e646..2fc5e4d 100644
--- a/src/ui/list.h
+++ b/src/ui/list.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -19,15 +20,18 @@
#pragma once
-#include "ui/control.h"
-#include "common/event.h"
+#include <ui/control.h>
+#include <ui/button.h>
+#include <ui/scroll.h>
+#include <common/event.h>
+#include <common/misc.h>
-class CD3DEngine;
-class CButton;
-class CScroll;
+#include <graphics/engine/text.h>
+namespace Ui {
+
const int LISTMAXDISPLAY = 20; // maximum number of visible lines
const int LISTMAXTOTAL = 100; // maximum total number of lines
@@ -35,81 +39,83 @@ const int LISTMAXTOTAL = 100; // maximum total number of lines
class CList : public CControl
{
-public:
- CList(CInstanceManager* iMan);
- ~CList();
+ public:
+ CList();
+ ~CList();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg, float expand);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand);
- void SetPos(Math::Point pos);
- void SetDim(Math::Point dim);
+ void SetPos(Math::Point pos);
+ void SetDim(Math::Point dim);
- bool SetState(int state, bool bState);
- bool SetState(int state);
- bool ClearState(int state);
+ bool SetState(int state, bool bState);
+ bool SetState(int state);
+ bool ClearState(int state);
- bool EventProcess(const Event &event);
- void Draw();
+ bool EventProcess(const Event &event);
+ void Draw();
- void Flush();
+ void Flush();
- void SetTotal(int i);
- int RetTotal();
+ void SetTotal(int i);
+ int GetTotal();
- void SetSelect(int i);
- int RetSelect();
+ void SetSelect(int i);
+ int GetSelect();
- void SetSelectCap(bool bEnable);
- bool RetSelectCap();
+ void SetSelectCap(bool bEnable);
+ bool GetSelectCap();
- void SetBlink(bool bEnable);
- bool RetBlink();
+ void SetBlink(bool bEnable);
+ bool GetBlink();
- void SetName(int i, char* name);
- char* RetName(int i);
+ void SetName(int i, char* name);
+ char* GetName(int i);
- void SetCheck(int i, bool bMode);
- bool RetCheck(int i);
+ void SetCheck(int i, bool bMode);
+ bool GetCheck(int i);
- void SetEnable(int i, bool bEnable);
- bool RetEnable(int i);
+ void SetEnable(int i, bool bEnable);
+ bool GetEnable(int i);
- void SetTabs(int i, float pos, int justif=1);
- float RetTabs(int i);
+ void SetTabs(int i, float pos, Gfx::TextAlign justif=Gfx::TEXT_ALIGN_CENTER);
+ float GetTabs(int i);
- void ShowSelect(bool bFixed);
+ void ShowSelect(bool bFixed);
- EventMsg RetEventMsgButton(int i);
- EventMsg RetEventMsgScroll();
+ EventType GetEventMsgButton(int i);
+ EventType GetEventMsgScroll();
-protected:
- bool MoveAdjust();
- void UpdateButton();
- void UpdateScroll();
- void MoveScroll();
- void DrawCase(char *text, Math::Point pos, float width, int justif);
+ protected:
+ bool MoveAdjust();
+ void UpdateButton();
+ void UpdateScroll();
+ void MoveScroll();
+ void DrawCase(char *text, Math::Point pos, float width, Gfx::TextAlign justif);
-protected:
- CButton* m_button[LISTMAXDISPLAY];
- CScroll* m_scroll;
+ protected:
+ CButton* m_button[LISTMAXDISPLAY];
+ CScroll* m_scroll;
- EventMsg m_eventButton[LISTMAXDISPLAY];
- EventMsg m_eventScroll;
+ EventType m_eventButton[LISTMAXDISPLAY];
+ EventType m_eventScroll;
- float m_expand;
- int m_totalLine; // total number of lines
- int m_displayLine; // number of visible lines
- int m_selectLine; // selected line
- int m_firstLine; // first visible line
- bool m_bBlink;
- bool m_bSelectCap;
- float m_blinkTime;
- float m_tabs[10];
- int m_justifs[10];
+ float m_expand;
+ int m_totalLine; // total number of lines
+ int m_displayLine; // number of visible lines
+ int m_selectLine; // selected line
+ int m_firstLine; // first visible line
+ bool m_bBlink;
+ bool m_bSelectCap;
+ float m_blinkTime;
+ float m_tabs[10];
+ Gfx::TextAlign m_justifs[10];
- char m_text[LISTMAXTOTAL][100];
- char m_check[LISTMAXTOTAL];
- char m_enable[LISTMAXTOTAL];
+ char m_text[LISTMAXTOTAL][100];
+ char m_check[LISTMAXTOTAL];
+ char m_enable[LISTMAXTOTAL];
};
+}
+
diff --git a/src/ui/map.h b/src/ui/map.h
index efdf54b..7e80e0a 100644
--- a/src/ui/map.h
+++ b/src/ui/map.h
@@ -19,16 +19,14 @@
#pragma once
-#include "ui/control.h"
-#include "object/object.h"
+#include <ui/control.h>
+#include <object/object.h>
+
+#include <common/event.h>
-class CD3DEngine;
class CTerrain;
class CWater;
-class CRobotMain;
-
-
const int MAPMAXOBJECT = 100;
@@ -53,7 +51,7 @@ struct MapObject
CObject* object;
MapColor color;
ObjectType type;
- Math::Point pos;
+ Math::Point pos;
float dir;
};
@@ -62,10 +60,10 @@ struct MapObject
class CMap : public CControl
{
public:
- CMap(CInstanceManager* iMan);
+ CMap();
~CMap();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
bool EventProcess(const Event &event);
void Draw();
@@ -87,8 +85,8 @@ public:
void SetEnable(bool bEnable);
bool RetEnable();
- void SetFloorColor(D3DCOLORVALUE color);
- void SetWaterColor(D3DCOLORVALUE color);
+ void SetFloorColor(Gfx::Color color);
+ void SetWaterColor(Gfx::Color color);
void FlushObject();
void UpdateObject(CObject* pObj);
@@ -97,9 +95,9 @@ public:
void SetHilite(CObject* pObj);
protected:
- Math::Point AdjustOffset(Math::Point offset);
+ Math::Point AdjustOffset(Math::Point offset);
void SelectObject(Math::Point pos);
- Math::Point MapInter(Math::Point pos, float dir);
+ Math::Point MapInter(Math::Point pos, float dir);
void DrawFocus(Math::Point pos, float dir, ObjectType type, MapColor color);
void DrawObject(Math::Point pos, float dir, ObjectType type, MapColor color, bool bSelect, bool bHilite);
void DrawObjectIcon(Math::Point pos, Math::Point dim, MapColor color, ObjectType type, bool bHilite);
@@ -117,16 +115,16 @@ protected:
float m_time;
float m_half;
float m_zoom;
- Math::Point m_offset;
+ Math::Point m_offset;
float m_angle;
- D3DCOLORVALUE m_floorColor;
- D3DCOLORVALUE m_waterColor;
+ Gfx::Color m_floorColor;
+ Gfx::Color m_waterColor;
MapObject m_map[MAPMAXOBJECT];
int m_totalFix;
int m_totalMove;
int m_hiliteRank;
- Math::Point m_mapPos;
- Math::Point m_mapDim;
+ Math::Point m_mapPos;
+ Math::Point m_mapDim;
bool m_bRadar;
char m_fixImage[100];
int m_mode;
diff --git a/src/ui/scroll.cpp b/src/ui/scroll.cpp
index 051de8d..b54c868 100644
--- a/src/ui/scroll.cpp
+++ b/src/ui/scroll.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,13 +18,14 @@
// scroll.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+//#include "old/math3d.h"
+#include "graphics/engine/engine.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
@@ -31,11 +33,11 @@
#include "ui/scroll.h"
-
+namespace Ui {
// Object's constructor.
-CScroll::CScroll(CInstanceManager* iMan) : CControl(iMan)
+CScroll::CScroll() : CControl()
{
m_buttonUp = 0;
m_buttonDown = 0;
@@ -61,9 +63,9 @@ CScroll::~CScroll()
// Creates a new button.
-bool CScroll::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CScroll::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
CControl::Create(pos, dim, icon, eventMsg);
MoveAdjust();
@@ -102,20 +104,20 @@ void CScroll::MoveAdjust()
{
if ( m_buttonUp == 0 )
{
- m_buttonUp = new CButton(m_iMan);
+ m_buttonUp = new CButton();
pc = (CButton*)m_buttonUp;
pc->Create(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 49, EVENT_NULL);
pc->SetRepeat(true);
- m_eventUp = pc->RetEventMsg();
+ m_eventUp = pc->GetEventType();
}
if ( m_buttonDown == 0 )
{
- m_buttonDown = new CButton(m_iMan);
+ m_buttonDown = new CButton();
pc = (CButton*)m_buttonDown;
pc->Create(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 50, EVENT_NULL);
pc->SetRepeat(true);
- m_eventDown = pc->RetEventMsg();
+ m_eventDown = pc->GetEventType();
}
}
@@ -213,31 +215,32 @@ bool CScroll::EventProcess(const Event &event)
if ( !m_buttonDown->EventProcess(event) ) return false;
}
- if ( event.event == m_eventUp && m_step > 0.0f )
+ if ( event.type == m_eventUp && m_step > 0.0f )
{
m_visibleValue -= m_step;
if ( m_visibleValue < 0.0f ) m_visibleValue = 0.0f;
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
- if ( event.event == m_eventDown && m_step > 0.0f )
+ if ( event.type == m_eventDown && m_step > 0.0f )
{
m_visibleValue += m_step;
if ( m_visibleValue > 1.0f ) m_visibleValue = 1.0f;
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
hButton = m_buttonUp?m_dim.x/0.75f:0.0f;
- if ( event.event == EVENT_LBUTTONDOWN &&
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1 &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
@@ -258,7 +261,7 @@ bool CScroll::EventProcess(const Event &event)
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
m_bCapture = true;
@@ -267,7 +270,7 @@ bool CScroll::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_MOUSEMOVE && m_bCapture )
+ if ( event.type == EVENT_MOUSE_MOVE && m_bCapture )
{
h = (m_dim.y-hButton*2.0f)*(1.0f-m_visibleRatio);
if ( h != 0 )
@@ -282,33 +285,35 @@ bool CScroll::EventProcess(const Event &event)
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
}
}
- if ( event.event == EVENT_LBUTTONUP && m_bCapture )
+ if ( event.type == EVENT_MOUSE_BUTTON_UP &&
+ event.mouseButton.button == 1 &&
+ m_bCapture )
{
m_bCapture = false;
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELUP &&
- Detect(event.pos) &&
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 4 &&
+ Detect(event.pos) &&
m_buttonUp != 0 )
{
Event newEvent = event;
- newEvent.event = m_buttonUp->RetEventMsg();
+ newEvent.type = m_buttonUp->GetEventType();
m_event->AddEvent(newEvent);
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELDOWN &&
- Detect(event.pos) &&
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 5 &&
+ Detect(event.pos) &&
m_buttonDown != 0 )
{
Event newEvent = event;
- newEvent.event = m_buttonDown->RetEventMsg();
+ newEvent.type = m_buttonDown->GetEventType();
m_event->AddEvent(newEvent);
}
@@ -381,7 +386,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon)
if ( icon == 0 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f/256.0f; // yellow rectangle
uv1.y = 32.0f/256.0f;
uv2.x = 32.0f/256.0f;
@@ -391,7 +396,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 1 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f/256.0f; // gray rectangle
uv1.y = 32.0f/256.0f;
uv2.x = 160.0f/256.0f;
@@ -401,7 +406,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 2 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f/256.0f; // blue rectangle
uv1.y = 0.0f/256.0f;
uv2.x = 96.0f/256.0f;
@@ -411,7 +416,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 104.0f/256.0f; // blue line -
uv1.y = 32.0f/256.0f;
uv2.x = 128.0f/256.0f;
@@ -437,7 +442,7 @@ void CScroll::SetVisibleValue(float value)
AdjustGlint();
}
-float CScroll::RetVisibleValue()
+float CScroll::GetVisibleValue()
{
return m_visibleValue;
}
@@ -451,7 +456,7 @@ void CScroll::SetVisibleRatio(float value)
AdjustGlint();
}
-float CScroll::RetVisibleRatio()
+float CScroll::GetVisibleRatio()
{
return m_visibleRatio;
}
@@ -462,8 +467,9 @@ void CScroll::SetArrowStep(float step)
m_step = step;
}
-float CScroll::RetArrowStep()
+float CScroll::GetArrowStep()
{
return m_step;
}
+}
diff --git a/src/ui/scroll.h b/src/ui/scroll.h
index 6854e61..9dbd8a4 100644
--- a/src/ui/scroll.h
+++ b/src/ui/scroll.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -19,12 +20,13 @@
#pragma once
-#include "ui/control.h"
+#include <ui/control.h>
+#include <common/event.h>
-class CD3DEngine;
-class CButton;
+namespace Ui {
+class CButton;
const float SCROLL_WIDTH = (15.0f/640.0f);
@@ -32,50 +34,51 @@ const float SCROLL_WIDTH = (15.0f/640.0f);
class CScroll : public CControl
{
-public:
- CScroll(CInstanceManager* iMan);
- ~CScroll();
+ public:
+ CScroll();
+ ~CScroll();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- void SetPos(Math::Point pos);
- void SetDim(Math::Point dim);
+ void SetPos(Math::Point pos);
+ void SetDim(Math::Point dim);
- bool SetState(int state, bool bState);
- bool SetState(int state);
- bool ClearState(int state);
+ bool SetState(int state, bool bState);
+ bool SetState(int state);
+ bool ClearState(int state);
- bool EventProcess(const Event &event);
- void Draw();
+ bool EventProcess(const Event &event);
+ void Draw();
- void SetVisibleValue(float value);
- float RetVisibleValue();
+ void SetVisibleValue(float value);
+ float GetVisibleValue();
- void SetVisibleRatio(float value);
- float RetVisibleRatio();
+ void SetVisibleRatio(float value);
+ float GetVisibleRatio();
- void SetArrowStep(float step);
- float RetArrowStep();
+ void SetArrowStep(float step);
+ float GetArrowStep();
-protected:
- void MoveAdjust();
- void AdjustGlint();
- void DrawVertex(Math::Point pos, Math::Point dim, int icon);
+ protected:
+ void MoveAdjust();
+ void AdjustGlint();
+ void DrawVertex(Math::Point pos, Math::Point dim, int icon);
-protected:
- CButton* m_buttonUp;
- CButton* m_buttonDown;
+ protected:
+ CButton* m_buttonUp;
+ CButton* m_buttonDown;
- float m_visibleValue;
- float m_visibleRatio;
- float m_step;
+ float m_visibleValue;
+ float m_visibleRatio;
+ float m_step;
- bool m_bCapture;
- Math::Point m_pressPos;
- float m_pressValue;
+ bool m_bCapture;
+ Math::Point m_pressPos;
+ float m_pressValue;
- EventMsg m_eventUp;
- EventMsg m_eventDown;
+ EventType m_eventUp;
+ EventType m_eventDown;
};
+}
diff --git a/src/ui/shortcut.h b/src/ui/shortcut.h
index b918ccc..d819bf2 100644
--- a/src/ui/shortcut.h
+++ b/src/ui/shortcut.h
@@ -18,31 +18,28 @@
#pragma once
+#include <ui/control.h>
-#include "ui/control.h"
-
-
-class CD3DEngine;
-
+#include <common/event.h>
class CShortcut : public CControl
{
-public:
- CShortcut(CInstanceManager* iMan);
- ~CShortcut();
+ public:
+ CShortcut();
+ ~CShortcut();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- bool EventProcess(const Event &event);
+ bool EventProcess(const Event &event);
- void Draw();
+ void Draw();
-protected:
- void DrawVertex(int icon, float zoom);
+ protected:
+ void DrawVertex(int icon, float zoom);
-protected:
- float m_time;
+ protected:
+ float m_time;
};
diff --git a/src/ui/slider.cpp b/src/ui/slider.cpp
index be8af18..27bcfbb 100644
--- a/src/ui/slider.cpp
+++ b/src/ui/slider.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,21 +18,24 @@
// slider.cpp
-#include <windows.h>
+//#include <windows.h>
#include <stdio.h>
-#include <d3d.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+//#include "old/math3d.h"
+#include "graphics/engine/engine.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
-#include "old/text.h"
+//#include "old/text.h"
+#include "graphics/engine/text.h"
#include "ui/button.h"
#include "ui/slider.h"
+namespace Ui {
const float CURSOR_WIDTH = (10.0f/640.0f);
const float HOLE_WIDTH = (5.0f/480.0f);
@@ -41,7 +45,7 @@ const float HOLE_WIDTH = (5.0f/480.0f);
// Object's constructor.
-CSlider::CSlider(CInstanceManager* iMan) : CControl(iMan)
+CSlider::CSlider() : CControl()
{
m_buttonLeft = 0;
m_buttonRight = 0;
@@ -71,10 +75,10 @@ CSlider::~CSlider()
// Creates a new button.
-bool CSlider::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CSlider::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
- CControl::Create(pos, dim, icon, eventMsg);
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
+ CControl::Create(pos, dim, icon, eventType);
MoveAdjust();
return true;
@@ -115,20 +119,20 @@ void CSlider::MoveAdjust()
#if 1
if ( m_buttonLeft == 0 )
{
- m_buttonLeft = new CButton(m_iMan);
+ m_buttonLeft = new CButton();
m_buttonLeft->Create(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), m_bHoriz?55:49, EVENT_NULL); // </^
m_buttonLeft->SetRepeat(true);
if ( m_state & STATE_SHADOW ) m_buttonLeft->SetState(STATE_SHADOW);
- m_eventUp = m_buttonLeft->RetEventMsg();
+ m_eventUp = m_buttonLeft->GetEventType();
}
if ( m_buttonRight == 0 )
{
- m_buttonRight = new CButton(m_iMan);
+ m_buttonRight = new CButton();
m_buttonRight->Create(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), m_bHoriz?48:50, EVENT_NULL); // >/v
m_buttonRight->SetRepeat(true);
if ( m_state & STATE_SHADOW ) m_buttonRight->SetState(STATE_SHADOW);
- m_eventDown = m_buttonRight->RetEventMsg();
+ m_eventDown = m_buttonRight->GetEventType();
}
m_marginButton = m_bHoriz?(m_dim.y*0.75f):(m_dim.x/0.75f);
@@ -261,7 +265,7 @@ bool CSlider::EventProcess(const Event &event)
if ( !m_buttonRight->EventProcess(event) ) return false;
}
- if ( event.event == m_eventUp && m_step > 0.0f )
+ if ( event.type == m_eventUp && m_step > 0.0f )
{
m_visibleValue -= m_bHoriz?m_step:-m_step;
if ( m_visibleValue < 0.0f ) m_visibleValue = 0.0f;
@@ -269,11 +273,11 @@ bool CSlider::EventProcess(const Event &event)
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
- if ( event.event == m_eventDown && m_step > 0.0f )
+ if ( event.type == m_eventDown && m_step > 0.0f )
{
m_visibleValue += m_bHoriz?m_step:-m_step;
if ( m_visibleValue < 0.0f ) m_visibleValue = 0.0f;
@@ -281,12 +285,13 @@ bool CSlider::EventProcess(const Event &event)
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
- if ( event.event == EVENT_LBUTTONDOWN &&
- (m_state & STATE_VISIBLE) &&
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ (event.mouseButton.button == 1 ) &&
+ (m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
if ( CControl::Detect(event.pos) )
@@ -311,7 +316,7 @@ bool CSlider::EventProcess(const Event &event)
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
m_bCapture = true;
@@ -320,7 +325,7 @@ bool CSlider::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_MOUSEMOVE && m_bCapture )
+ if ( event.type == EVENT_MOUSE_MOVE && m_bCapture )
{
if ( m_bHoriz )
{
@@ -345,32 +350,35 @@ bool CSlider::EventProcess(const Event &event)
AdjustGlint();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
}
- if ( event.event == EVENT_LBUTTONUP && m_bCapture )
+ if ( ( event.type == EVENT_MOUSE_BUTTON_UP ) &&
+ ( event.mouseButton.button == 1 ) &&
+ m_bCapture )
{
m_bCapture = false;
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELUP &&
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 4 &&
Detect(event.pos) &&
m_buttonLeft != 0 )
{
Event newEvent = event;
- newEvent.event = m_buttonLeft->RetEventMsg();
+ newEvent.type = m_buttonLeft->GetEventType();
m_event->AddEvent(newEvent);
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_WHEELDOWN &&
+
+ if ( event.type == EVENT_KEY_DOWN &&
+ event.mouseButton.button == 5 &&
Detect(event.pos) &&
m_buttonRight != 0 )
{
Event newEvent = event;
- newEvent.event = m_buttonRight->RetEventMsg();
+ newEvent.type = m_buttonRight->GetEventType();
m_event->AddEvent(newEvent);
}
@@ -466,10 +474,10 @@ void CSlider::Draw()
if ( m_bHoriz )
{
sprintf(text, "%d", (int)(m_min+m_visibleValue*(m_max-m_min)));
- h = m_engine->RetText()->RetHeight(m_fontSize, m_fontType);
+ h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize);
pos.x = m_pos.x+m_dim.x+(10.0f/640.0f);
pos.y = m_pos.y+(m_dim.y-h)/2.0f;
- m_engine->RetText()->DrawText(text, pos, m_dim.x, 1, m_fontSize, m_fontStretch, m_fontType, 0);
+ m_engine->GetText()->DrawText(text, m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, 0);
}
else
{
@@ -482,7 +490,7 @@ void CSlider::Draw()
dim.x = 50.0f/640.0f;
dim.y = 16.0f/480.0f;
sprintf(text, "%d", (int)(m_min+(m_visibleValue*(m_max-m_min))));
- m_engine->RetText()->DrawText(text, pos, dim.x, 1, m_fontSize, m_fontStretch, m_fontType, 0);
+ m_engine->GetText()->DrawText(text, m_fontType, m_fontSize, pos, dim.x, Gfx::TEXT_ALIGN_RIGHT, 0);
}
}
}
@@ -497,7 +505,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon)
if ( icon == 0 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f/256.0f; // yellow rectangle
uv1.y = 32.0f/256.0f;
uv2.x = 32.0f/256.0f;
@@ -509,7 +517,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 1 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f/256.0f; // gray rectangle
uv1.y = 32.0f/256.0f;
uv2.x = 160.0f/256.0f;
@@ -521,7 +529,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 224.0f/256.0f; // cursor
uv1.y = 32.0f/256.0f;
uv2.x = 256.0f/256.0f;
@@ -561,7 +569,7 @@ void CSlider::SetVisibleValue(float value)
AdjustGlint();
}
-float CSlider::RetVisibleValue()
+float CSlider::GetVisibleValue()
{
return m_min+m_visibleValue*(m_max-m_min);
}
@@ -572,9 +580,10 @@ void CSlider::SetArrowStep(float step)
m_step = step/(m_max-m_min);
}
-float CSlider::RetArrowStep()
+float CSlider::GetArrowStep()
{
return m_step*(m_max-m_min);
}
+}
diff --git a/src/ui/slider.h b/src/ui/slider.h
index 1ec9ea5..b0de011 100644
--- a/src/ui/slider.h
+++ b/src/ui/slider.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -19,63 +20,64 @@
#pragma once
-#include "ui/control.h"
+#include <ui/control.h>
+#include <common/event.h>
-class CD3DEngine;
-class CButton;
-
+namespace Ui {
+class CButton;
class CSlider : public CControl
{
-public:
- CSlider(CInstanceManager* iMan);
- ~CSlider();
+ public:
+ CSlider();
+ ~CSlider();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- void SetPos(Math::Point pos);
- void SetDim(Math::Point dim);
+ void SetPos(Math::Point pos);
+ void SetDim(Math::Point dim);
- bool SetState(int state, bool bState);
- bool SetState(int state);
- bool ClearState(int state);
+ bool SetState(int state, bool bState);
+ bool SetState(int state);
+ bool ClearState(int state);
- bool EventProcess(const Event &event);
- void Draw();
+ bool EventProcess(const Event &event);
+ void Draw();
- void SetLimit(float min, float max);
+ void SetLimit(float min, float max);
- void SetVisibleValue(float value);
- float RetVisibleValue();
+ void SetVisibleValue(float value);
+ float GetVisibleValue();
- void SetArrowStep(float step);
- float RetArrowStep();
+ void SetArrowStep(float step);
+ float GetArrowStep();
-protected:
- void MoveAdjust();
- void AdjustGlint();
- void DrawVertex(Math::Point pos, Math::Point dim, int icon);
+ protected:
+ void MoveAdjust();
+ void AdjustGlint();
+ void DrawVertex(Math::Point pos, Math::Point dim, int icon);
-protected:
- CButton* m_buttonLeft;
- CButton* m_buttonRight;
+ protected:
+ CButton* m_buttonLeft;
+ CButton* m_buttonRight;
- float m_min;
- float m_max;
- float m_visibleValue;
- float m_step;
+ float m_min;
+ float m_max;
+ float m_visibleValue;
+ float m_step;
- bool m_bHoriz;
- float m_marginButton;
+ bool m_bHoriz;
+ float m_marginButton;
- bool m_bCapture;
- Math::Point m_pressPos;
- float m_pressValue;
+ bool m_bCapture;
+ Math::Point m_pressPos;
+ float m_pressValue;
- EventMsg m_eventUp;
- EventMsg m_eventDown;
+ EventType m_eventUp;
+ EventType m_eventDown;
};
+}
diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp
index cba19d6..9de87cf 100644
--- a/src/ui/studio.cpp
+++ b/src/ui/studio.cpp
@@ -505,7 +505,7 @@ void CStudio::SearchToken(CEdit* edit)
for ( i=0 ; i<OBJECT_MAX ; i++ )
{
type = (ObjectType)i;
- text = RetObjectName(type);
+ text = GetObjectName(type);
if ( text[0] != 0 )
{
if ( strcmp(token, text) == 0 )
diff --git a/src/ui/target.cpp b/src/ui/target.cpp
index f94ae02..db478fe 100644
--- a/src/ui/target.cpp
+++ b/src/ui/target.cpp
@@ -17,13 +17,14 @@
// target.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
+
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+//#include "old/math3d.h"
+#include "graphics/engine/engine.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
@@ -34,10 +35,10 @@
-
+namespace Ui {
// Object's constructor.
-CTarget::CTarget(CInstanceManager* iMan) : CControl(iMan)
+CTarget::CTarget() : CControl()
{
}
@@ -50,11 +51,11 @@ CTarget::~CTarget()
// Creates a new button.
-bool CTarget::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CTarget::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
- CControl::Create(pos, dim, icon, eventMsg);
+ CControl::Create(pos, dim, icon, eventType);
return true;
}
@@ -70,26 +71,27 @@ bool CTarget::EventProcess(const Event &event)
CControl::EventProcess(event);
- if ( event.event == EVENT_MOUSEMOVE )
+ if ( event.type == EVENT_MOUSE_MOVE )
{
if ( CControl::Detect(event.pos) )
{
- m_engine->SetMouseType(D3DMOUSETARGET);
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_TARGET);
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
return false;
}
}
- if ( event.event == EVENT_LBUTTONDOWN &&
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1 &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
if ( CControl::Detect(event.pos) )
{
Event newEvent = event;
- newEvent.event = EVENT_OBJECT_FIRE;
+ newEvent.type = EVENT_OBJECT_FIRE;
m_event->AddEvent(newEvent);
return false;
}
@@ -104,7 +106,7 @@ bool CTarget::EventProcess(const Event &event)
CControl::EventProcess(event);
- if ( event.event == EVENT_MOUSEMOVE )
+ if ( event.type == EVENT_MOUSE_MOVE )
{
m_main->SetFriendAim(false);
@@ -113,22 +115,23 @@ bool CTarget::EventProcess(const Event &event)
pObj = DetectFriendObject(event.pos);
if ( pObj == 0 )
{
- m_engine->SetMouseType(D3DMOUSETARGET);
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_TARGET);
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
return false;
}
else
{
m_main->SetFriendAim(true);
- m_engine->SetMouseType(D3DMOUSENORM);
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
}
}
}
- if ( event.event == EVENT_LBUTTONDOWN &&
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1 &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
@@ -137,7 +140,7 @@ bool CTarget::EventProcess(const Event &event)
if ( !m_main->RetFriendAim() )
{
Event newEvent = event;
- newEvent.event = EVENT_OBJECT_FIRE;
+ newEvent.type = EVENT_OBJECT_FIRE;
m_event->AddEvent(newEvent);
return false;
}
@@ -202,15 +205,15 @@ CObject* CTarget::DetectFriendObject(Math::Point pos)
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( !pObj->RetActif() ) continue;
- if ( pObj->RetProxyActivate() ) continue;
- if ( pObj->RetSelect() ) continue;
+ if ( !pObj->GetActif() ) continue;
+ if ( pObj->GetProxyActivate() ) continue;
+ if ( pObj->GetSelect() ) continue;
pTarget = 0;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_DERRICK ||
type == OBJECT_FACTORY ||
type == OBJECT_REPAIR ||
@@ -261,10 +264,10 @@ CObject* CTarget::DetectFriendObject(Math::Point pos)
}
else if ( (type == OBJECT_POWER ||
type == OBJECT_ATOMIC ) &&
- pObj->RetTruck() != 0 ) // battery used?
+ pObj->GetTruck() != 0 ) // battery used?
{
- pTarget = pObj->RetTruck();
- if ( pTarget->RetType() == OBJECT_MOBILEtg )
+ pTarget = pObj->GetTruck();
+ if ( pTarget->GetType() == OBJECT_MOBILEtg )
{
pTarget = 0;
}
@@ -272,7 +275,7 @@ CObject* CTarget::DetectFriendObject(Math::Point pos)
for ( j=0 ; j<OBJECTMAXPART ; j++ )
{
- rank = pObj->RetObjectRank(j);
+ rank = pObj->GetObjectRank(j);
if ( rank == -1 ) continue;
if ( rank != objRank ) continue;
return pTarget;
@@ -281,3 +284,4 @@ CObject* CTarget::DetectFriendObject(Math::Point pos)
return 0;
}
+}
diff --git a/src/ui/target.h b/src/ui/target.h
index ae0c7af..0b5b67d 100644
--- a/src/ui/target.h
+++ b/src/ui/target.h
@@ -19,30 +19,27 @@
#pragma once
-#include "ui/control.h"
-
-
-class CD3DEngine;
-class CObject;
+#include <ui/control.h>
+#include <common/event.h>
+namespace Ui {
class CTarget : public CControl
{
-public:
- CTarget(CInstanceManager* iMan);
- ~CTarget();
-
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ public:
+ CTarget();
+ ~CTarget();
- bool EventProcess(const Event &event);
- void Draw();
- bool GetTooltip(Math::Point pos, char* name);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
-protected:
- CObject* DetectFriendObject(Math::Point pos);
+ bool EventProcess(const Event &event);
+ void Draw();
+ bool GetTooltip(Math::Point pos, char* name);
-protected:
+ protected:
+ CObject* DetectFriendObject(Math::Point pos);
};
+}
diff --git a/src/ui/window.cpp b/src/ui/window.cpp
index 8866643..fabd9c4 100644
--- a/src/ui/window.cpp
+++ b/src/ui/window.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,14 +18,14 @@
// window.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
#include "common/language.h"
-#include "old/math3d.h"
+//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/restext.h"
@@ -46,15 +47,17 @@
#include "ui/gauge.h"
#include "ui/compass.h"
#include "ui/target.h"
-#include "old/text.h"
+//#include "old/text.h"
+#include "graphics/engine/text.h"
#include "ui/window.h"
-
+namespace Ui {
// Object's constructor.
-CWindow::CWindow(CInstanceManager* iMan) : CControl(iMan)
+//CWindow::CWindow(CInstanceManager* iMan) : CControl(iMan)
+CWindow::CWindow() : CControl()
{
int i;
@@ -80,7 +83,7 @@ CWindow::CWindow(CInstanceManager* iMan) : CControl(iMan)
m_bClosable = false;
m_bCapture = false;
- m_fontStretch = NORMSTRETCH*1.2f;
+// m_fontStretch = NORMSTRETCH*1.2f;
}
// Object's destructor.
@@ -128,9 +131,9 @@ void CWindow::Flush()
// Creates a new window.
-bool CWindow::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CWindow::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
CControl::Create(pos, dim, icon, eventMsg);
return true;
@@ -139,18 +142,19 @@ bool CWindow::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventM
// Creates a new button.
-CButton* CWindow::CreateButton(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CButton* CWindow::CreateButton(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CButton* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CButton(m_iMan);
+// m_table[i] = new CButton(m_iMan);
+ m_table[i] = new CButton();
pc = (CButton*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -161,18 +165,19 @@ CButton* CWindow::CreateButton(Math::Point pos, Math::Point dim, int icon, Event
// Creates a new button.
-CColor* CWindow::CreateColor(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CColor* CWindow::CreateColor(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CColor* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CColor(m_iMan);
+// m_table[i] = new CColor(m_iMan);
+ m_table[i] = new CColor();
pc = (CColor*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -183,18 +188,19 @@ CColor* CWindow::CreateColor(Math::Point pos, Math::Point dim, int icon, EventMs
// Creates a new button.
-CCheck* CWindow::CreateCheck(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CCheck* CWindow::CreateCheck(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CCheck* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CCheck(m_iMan);
+// m_table[i] = new CCheck(m_iMan);
+ m_table[i] = new CCheck();
pc = (CCheck*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -205,18 +211,19 @@ CCheck* CWindow::CreateCheck(Math::Point pos, Math::Point dim, int icon, EventMs
// Creates a new button.
-CKey* CWindow::CreateKey(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CKey* CWindow::CreateKey(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CKey* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CKey(m_iMan);
+// m_table[i] = new CKey(m_iMan);
+ m_table[i] = new CKey();
pc = (CKey*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -227,18 +234,19 @@ CKey* CWindow::CreateKey(Math::Point pos, Math::Point dim, int icon, EventMsg ev
// Creates a new button.
-CGroup* CWindow::CreateGroup(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CGroup* CWindow::CreateGroup(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CGroup* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CGroup(m_iMan);
+// m_table[i] = new CGroup(m_iMan);
+ m_table[i] = new CGroup();
pc = (CGroup*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -249,18 +257,19 @@ CGroup* CWindow::CreateGroup(Math::Point pos, Math::Point dim, int icon, EventMs
// Creates a new button.
-CImage* CWindow::CreateImage(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CImage* CWindow::CreateImage(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CImage* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CImage(m_iMan);
+// m_table[i] = new CImage(m_iMan);
+ m_table[i] = new CImage();
pc = (CImage*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -271,20 +280,21 @@ CImage* CWindow::CreateImage(Math::Point pos, Math::Point dim, int icon, EventMs
// Creates a new label.
-CLabel* CWindow::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg,
+CLabel* CWindow::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg,
char *name)
{
CLabel* pc;
char* p;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CLabel(m_iMan);
+// m_table[i] = new CLabel(m_iMan);
+ m_table[i] = new CLabel();
pc = (CLabel*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
@@ -312,18 +322,19 @@ CLabel* CWindow::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventMs
// Creates a new editable pave.
-CEdit* CWindow::CreateEdit(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CEdit* CWindow::CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CEdit* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CEdit(m_iMan);
+// m_table[i] = new CEdit(m_iMan);
+ m_table[i] = new CEdit();
pc = (CEdit*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -334,18 +345,19 @@ CEdit* CWindow::CreateEdit(Math::Point pos, Math::Point dim, int icon, EventMsg
// Creates a new editable pave.
-CEditValue* CWindow::CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CEditValue* CWindow::CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CEditValue* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CEditValue(m_iMan);
+// m_table[i] = new CEditValue(m_iMan);
+ m_table[i] = new CEditValue();
pc = (CEditValue*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -356,18 +368,19 @@ CEditValue* CWindow::CreateEditValue(Math::Point pos, Math::Point dim, int icon,
// Creates a new elevator.
-CScroll* CWindow::CreateScroll(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CScroll* CWindow::CreateScroll(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CScroll* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CScroll(m_iMan);
+// m_table[i] = new CScroll(m_iMan);
+ m_table[i] = new CScroll();
pc = (CScroll*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -378,18 +391,19 @@ CScroll* CWindow::CreateScroll(Math::Point pos, Math::Point dim, int icon, Event
// Creates a new cursor.
-CSlider* CWindow::CreateSlider(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CSlider* CWindow::CreateSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CSlider* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CSlider(m_iMan);
+// m_table[i] = new CSlider(m_iMan);
+ m_table[i] = new CSlider();
pc = (CSlider*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -400,19 +414,20 @@ CSlider* CWindow::CreateSlider(Math::Point pos, Math::Point dim, int icon, Event
// Creates a new list.
-CList* CWindow::CreateList(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg,
+CList* CWindow::CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg,
float expand)
{
CList* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CList(m_iMan);
+// m_table[i] = new CList(m_iMan);
+ m_table[i] = new CList();
pc = (CList*)m_table[i];
pc->Create(pos, dim, icon, eventMsg, expand);
return pc;
@@ -423,18 +438,18 @@ CList* CWindow::CreateList(Math::Point pos, Math::Point dim, int icon, EventMsg
// Creates a new shortcut.
-CShortcut* CWindow::CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CShortcut* CWindow::CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CShortcut* ps;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CShortcut(m_iMan);
+ m_table[i] = new CShortcut();
ps = (CShortcut*)m_table[i];
ps->Create(pos, dim, icon, eventMsg);
return ps;
@@ -445,18 +460,18 @@ CShortcut* CWindow::CreateShortcut(Math::Point pos, Math::Point dim, int icon, E
// Creates a new card.
-CMap* CWindow::CreateMap(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CMap* CWindow::CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CMap* pm;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CMap(m_iMan);
+ m_table[i] = new CMap();
pm = (CMap*)m_table[i];
pm->Create(pos, dim, icon, eventMsg);
return pm;
@@ -467,18 +482,18 @@ CMap* CWindow::CreateMap(Math::Point pos, Math::Point dim, int icon, EventMsg ev
// Creates a new gauge.
-CGauge* CWindow::CreateGauge(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CGauge* CWindow::CreateGauge(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CGauge* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CGauge(m_iMan);
+ m_table[i] = new CGauge();
pc = (CGauge*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -489,18 +504,18 @@ CGauge* CWindow::CreateGauge(Math::Point pos, Math::Point dim, int icon, EventMs
// Creates a new compass.
-CCompass* CWindow::CreateCompass(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CCompass* CWindow::CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CCompass* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CCompass(m_iMan);
+ m_table[i] = new CCompass();
pc = (CCompass*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -511,18 +526,18 @@ CCompass* CWindow::CreateCompass(Math::Point pos, Math::Point dim, int icon, Eve
// Creates a new target.
-CTarget* CWindow::CreateTarget(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CTarget* CWindow::CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
CTarget* pc;
int i;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
for ( i=0 ; i<MAXWINDOW ; i++ )
{
if ( m_table[i] == 0 )
{
- m_table[i] = new CTarget(m_iMan);
+ m_table[i] = new CTarget();
pc = (CTarget*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
return pc;
@@ -533,7 +548,7 @@ CTarget* CWindow::CreateTarget(Math::Point pos, Math::Point dim, int icon, Event
// Removes a control.
-bool CWindow::DeleteControl(EventMsg eventMsg)
+bool CWindow::DeleteControl(EventType eventMsg)
{
int i;
@@ -541,7 +556,7 @@ bool CWindow::DeleteControl(EventMsg eventMsg)
{
if ( m_table[i] != 0 )
{
- if ( eventMsg == m_table[i]->RetEventMsg() )
+ if ( eventMsg == m_table[i]->GetEventType() )
{
delete m_table[i];
m_table[i] = 0;
@@ -554,7 +569,7 @@ bool CWindow::DeleteControl(EventMsg eventMsg)
// Gives a control.
-CControl* CWindow::SearchControl(EventMsg eventMsg)
+CControl* CWindow::SearchControl(EventType eventMsg)
{
int i;
@@ -562,7 +577,7 @@ CControl* CWindow::SearchControl(EventMsg eventMsg)
{
if ( m_table[i] != 0 )
{
- if ( eventMsg == m_table[i]->RetEventMsg() )
+ if ( eventMsg == m_table[i]->GetEventType() )
{
return m_table[i];
}
@@ -646,11 +661,11 @@ void CWindow::SetName(char* name)
if ( m_name[0] != 0 && m_bRedim ) // title bar exists?
{
- m_buttonReduce = new CButton(m_iMan);
+ m_buttonReduce = new CButton();
pc = (CButton*)m_buttonReduce;
pc->Create(m_pos, m_dim, 0, EVENT_NULL);
- m_buttonFull = new CButton(m_iMan);
+ m_buttonFull = new CButton();
pc = (CButton*)m_buttonFull;
pc->Create(m_pos, m_dim, 0, EVENT_NULL);
@@ -659,7 +674,7 @@ void CWindow::SetName(char* name)
if ( m_name[0] != 0 && m_bClosable ) // title bar exists?
{
- m_buttonClose = new CButton(m_iMan);
+ m_buttonClose = new CButton();
pc = (CButton*)m_buttonClose;
pc->Create(m_pos, m_dim, 0, EVENT_NULL);
@@ -697,7 +712,7 @@ void CWindow::MoveAdjust()
Math::Point pos, dim;
float h, offset;
- h = m_engine->RetText()->RetHeight(m_fontSize, m_fontType);
+ h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize);
dim.y = h*1.2f;
dim.x = dim.y*0.75f;
@@ -742,12 +757,12 @@ void CWindow::SetMaxDim(Math::Point dim)
m_maxDim = dim;
}
-Math::Point CWindow::RetMinDim()
+Math::Point CWindow::GetMinDim()
{
return m_minDim;
}
-Math::Point CWindow::RetMaxDim()
+Math::Point CWindow::GetMaxDim()
{
return m_maxDim;
}
@@ -760,7 +775,7 @@ void CWindow::SetMovable(bool bMode)
m_bMovable = bMode;
}
-bool CWindow::RetMovable()
+bool CWindow::GetMovable()
{
return m_bMovable;
}
@@ -773,7 +788,7 @@ void CWindow::SetRedim(bool bMode)
m_bRedim = bMode;
}
-bool CWindow::RetRedim()
+bool CWindow::GetRedim()
{
return m_bRedim;
}
@@ -786,7 +801,7 @@ void CWindow::SetClosable(bool bMode)
m_bClosable = bMode;
}
-bool CWindow::RetClosable()
+bool CWindow::GetClosable()
{
return m_bClosable;
}
@@ -798,7 +813,7 @@ void CWindow::SetMaximized(bool bMaxi)
AdjustButtons();
}
-bool CWindow::RetMaximized()
+bool CWindow::GetMaximized()
{
return m_bMaximized;
}
@@ -809,7 +824,7 @@ void CWindow::SetMinimized(bool bMini)
AdjustButtons();
}
-bool CWindow::RetMinimized()
+bool CWindow::GetMinimized()
{
return m_bMinimized;
}
@@ -819,7 +834,7 @@ void CWindow::SetFixed(bool bFix)
m_bFixed = bFix;
}
-bool CWindow::RetFixed()
+bool CWindow::GetFixed()
{
return m_bFixed;
}
@@ -877,7 +892,7 @@ void CWindow::SetTrashEvent(bool bTrash)
m_bTrashEvent = bTrash;
}
-bool CWindow::RetTrashEvent()
+bool CWindow::GetTrashEvent()
{
return m_bTrashEvent;
}
@@ -885,26 +900,26 @@ bool CWindow::RetTrashEvent()
// Returns the message from the button "reduce".
-EventMsg CWindow::RetEventMsgReduce()
+EventType CWindow::GetEventTypeReduce()
{
if ( m_buttonReduce == 0 ) return EVENT_NULL;
- return m_buttonReduce->RetEventMsg();
+ return m_buttonReduce->GetEventType();
}
// Returns the message from the button "full".
-EventMsg CWindow::RetEventMsgFull()
+EventType CWindow::GetEventTypeFull()
{
if ( m_buttonFull == 0 ) return EVENT_NULL;
- return m_buttonFull->RetEventMsg();
+ return m_buttonFull->GetEventType();
}
// Returns the message from the button "close".
-EventMsg CWindow::RetEventMsgClose()
+EventType CWindow::GetEventTypeClose()
{
if ( m_buttonClose == 0 ) return EVENT_NULL;
- return m_buttonClose->RetEventMsg();
+ return m_buttonClose->GetEventType();
}
@@ -947,7 +962,7 @@ int CWindow::BorderDetect(Math::Point pos)
if ( flags == 0 )
{
- h = m_engine->RetText()->RetHeight(m_fontSize, m_fontType);
+ h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize);
dim.y = h*1.2f;
dim.x = dim.y*0.75f;
if ( pos.x < m_pos.x+m_dim.x-0.01f-dim.x*3.0f &&
@@ -967,7 +982,7 @@ bool CWindow::EventProcess(const Event &event)
Math::Point pos;
int i, flags;
- if ( event.event == EVENT_MOUSEMOVE )
+ if ( event.type == EVENT_MOUSE_MOVE )
{
if ( m_bCapture )
{
@@ -975,7 +990,7 @@ bool CWindow::EventProcess(const Event &event)
}
else
{
- m_pressMouse = D3DMOUSENORM;
+ m_pressMouse = Gfx::ENG_MOUSE_NORM;
if ( m_name[0] != 0 && m_bMovable && // title bar?
Detect(event.pos) )
@@ -983,29 +998,29 @@ bool CWindow::EventProcess(const Event &event)
flags = BorderDetect(event.pos);
if ( flags == -1 )
{
- m_pressMouse = D3DMOUSEMOVE; // +
+ m_pressMouse = Gfx::ENG_MOUSE_MOVE; // +
}
else if ( ((flags & (1<<0)) && (flags & (1<<3))) ||
((flags & (1<<1)) && (flags & (1<<2))) )
{
- m_pressMouse = D3DMOUSEMOVEI; // \ //
+ m_pressMouse = Gfx::ENG_MOUSE_MOVEI; // \ //
}
else if ( ((flags & (1<<0)) && (flags & (1<<1))) ||
((flags & (1<<2)) && (flags & (1<<3))) )
{
- m_pressMouse = D3DMOUSEMOVED; // /
+ m_pressMouse = Gfx::ENG_MOUSE_MOVED; // /
}
else if ( (flags & (1<<0)) || (flags & (1<<2)) )
{
- m_pressMouse = D3DMOUSEMOVEH; // -
+ m_pressMouse = Gfx::ENG_MOUSE_MOVEH; // -
}
else if ( (flags & (1<<1)) || (flags & (1<<3)) )
{
- m_pressMouse = D3DMOUSEMOVEV; // |
+ m_pressMouse = Gfx::ENG_MOUSE_MOVEV; // |
}
}
- if ( m_pressMouse != D3DMOUSENORM )
+ if ( m_pressMouse != Gfx::ENG_MOUSE_NORM )
{
m_engine->SetMouseType(m_pressMouse);
}
@@ -1039,7 +1054,8 @@ bool CWindow::EventProcess(const Event &event)
}
}
- if ( m_bTrashEvent && event.event == EVENT_LBUTTONDOWN )
+ if ( m_bTrashEvent && event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1)
{
if ( Detect(event.pos) )
{
@@ -1056,7 +1072,7 @@ bool CWindow::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_MOUSEMOVE && m_bCapture )
+ if ( event.type == EVENT_MOUSE_MOVE && m_bCapture )
{
pos = event.pos;
if ( m_pressFlags == -1 ) // all moves?
@@ -1105,11 +1121,13 @@ bool CWindow::EventProcess(const Event &event)
AdjustButtons();
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
- if ( event.event == EVENT_LBUTTONUP && m_bCapture )
+ if ( event.type == EVENT_MOUSE_BUTTON_UP &&
+ event.mouseButton == 1 &&
+ m_bCapture )
{
m_bCapture = false;
}
@@ -1137,7 +1155,7 @@ void CWindow::Draw()
if ( m_name[0] != 0 ) // title bar?
{
- h = m_engine->RetText()->RetHeight(m_fontSize, m_fontType);
+ h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize);
// Draws the shadow under the title bar.
{
@@ -1160,7 +1178,7 @@ void CWindow::Draw()
dim.y = h*1.2f;
DrawVertex(pos, dim, (m_state&STATE_ENABLE)?2:9);
- sw = m_engine->RetText()->RetStringWidth(m_name, strlen(m_name), m_fontSize, m_fontStretch, m_fontType);
+ sw = m_engine->GetText()->GetStringWidth(m_name, m_fontType, m_fontSize);
if ( m_state&STATE_ENABLE )
{
@@ -1175,7 +1193,7 @@ void CWindow::Draw()
pos.x = m_pos.x+width/2.0f;
pos.y = m_pos.y+m_dim.y-0.01f-h*1.10f;
- m_engine->RetText()->DrawText(m_name, pos, width, 0, m_fontSize, m_fontStretch, m_fontType, 0);
+ m_engine->GetText()->DrawText(m_name, m_fontType, m_fontSize, pos, width, Gfx::TEXT_ALIGN_CENTER, 0);
if ( m_buttonReduce != 0 )
{
@@ -1215,7 +1233,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
if ( icon == 0 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 64.0f/256.0f; // dark blue transparent
uv1.y = 64.0f/256.0f;
uv2.x = 128.0f/256.0f;
@@ -1231,7 +1249,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 1 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 128.0f/256.0f; // yellow tooltip
uv1.y = 0.0f/256.0f;
uv2.x = 224.0f/256.0f;
@@ -1245,7 +1263,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 2 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f/256.0f; // yellow
uv1.y = 16.0f/256.0f;
uv2.x = 224.0f/256.0f;
@@ -1259,7 +1277,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 3 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 0.0f/256.0f; // transparent blue bar with yellow upper
uv1.y = 64.0f/256.0f;
uv2.x = 64.0f/256.0f;
@@ -1278,7 +1296,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
dim.y += 60.0f/480.0f;
m_engine->SetTexture("human.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 140.0f/256.0f;
uv1.y = 32.0f/256.0f;
uv2.x = 182.0f/256.0f;
@@ -1295,7 +1313,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
dim.y += 0.0f/480.0f;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 192.0f/256.0f;
uv1.y = 32.0f/256.0f;
uv2.x = 224.0f/256.0f;
@@ -1314,7 +1332,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
dim.y -= 20.0f/480.0f;
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f/256.0f;
uv1.y = 0.0f/256.0f;
uv2.x = 96.0f/256.0f;
@@ -1433,7 +1451,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 5 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f/256.0f; // transparent green
uv1.y = 160.0f/256.0f;
uv2.x = 160.0f/256.0f;
@@ -1447,7 +1465,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 6 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f/256.0f; // transparent red
uv1.y = 176.0f/256.0f;
uv2.x = 160.0f/256.0f;
@@ -1461,7 +1479,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 7 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f/256.0f; // transparent blue
uv1.y = 192.0f/256.0f;
uv2.x = 160.0f/256.0f;
@@ -1475,7 +1493,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 8 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f/256.0f; // opaque orange
uv1.y = 0.0f/256.0f;
uv2.x = 32.0f/256.0f;
@@ -1491,7 +1509,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 9 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 32.0f/256.0f; // opaque gray
uv1.y = 32.0f/256.0f;
uv2.x = 64.0f/256.0f;
@@ -1511,7 +1529,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 11 )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 64.0f/256.0f; // transparent yellow
uv1.y = 224.0f/256.0f;
uv2.x = 160.0f/256.0f;
@@ -1525,7 +1543,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 12 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 128.0f/256.0f; // dirty opaque gray
uv1.y = 128.0f/256.0f;
uv2.x = 160.0f/256.0f;
@@ -1541,7 +1559,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 13 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 192.0f/256.0f; // dirty opaque blue
uv1.y = 128.0f/256.0f;
uv2.x = 224.0f/256.0f;
@@ -1557,7 +1575,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon)
else if ( icon == 14 )
{
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 160.0f/256.0f; // dirty opaque red
uv1.y = 128.0f/256.0f;
uv2.x = 192.0f/256.0f;
@@ -1585,7 +1603,7 @@ void CWindow::DrawHach(Math::Point pos, Math::Point dim)
dp = 0.5f/256.0f;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 64.0f/256.0f; // hatching
uv1.y = 208.0f/256.0f;
uv2.x = 145.0f/256.0f;
@@ -1618,3 +1636,4 @@ void CWindow::DrawHach(Math::Point pos, Math::Point dim)
#endif
}
+}
diff --git a/src/ui/window.h b/src/ui/window.h
index 3acf3b4..92f7b50 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -19,92 +20,75 @@
#pragma once
-#include "ui/control.h"
-
-
-class CD3DEngine;
-class CButton;
-class CColor;
-class CCheck;
-class CKey;
-class CGroup;
-class CImage;
-class CLabel;
-class CEdit;
-class CEditValue;
-class CScroll;
-class CSlider;
-class CList;
-class CShortcut;
-class CMap;
-class CGauge;
-class CCompass;
-class CTarget;
+#include <ui/control.h>
+//#include <common/event.h>
+namespace Ui {
const int MAXWINDOW = 100;
+class CGauge;
class CWindow : public CControl
{
public:
- CWindow(CInstanceManager* iMan);
+ CWindow();
~CWindow();
void Flush();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CButton* CreateButton(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CColor* CreateColor(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CCheck* CreateCheck(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CKey* CreateKey(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CGroup* CreateGroup(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CImage* CreateImage(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg, char *name);
- CEdit* CreateEdit(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CEditValue* CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CScroll* CreateScroll(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CSlider* CreateSlider(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CList* CreateList(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg, float expand=1.2f);
- CShortcut* CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CMap* CreateMap(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CGauge* CreateGauge(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CCompass* CreateCompass(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CTarget* CreateTarget(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- bool DeleteControl(EventMsg eventMsg);
- CControl* SearchControl(EventMsg eventMsg);
-
- EventMsg RetEventMsgReduce();
- EventMsg RetEventMsgFull();
- EventMsg RetEventMsgClose();
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CButton* CreateButton(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CColor* CreateColor(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CCheck* CreateCheck(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CKey* CreateKey(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CGroup* CreateGroup(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CImage* CreateImage(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, char *name);
+ CEdit* CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CEditValue* CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CScroll* CreateScroll(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CSlider* CreateSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CList* CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand=1.2f);
+ CShortcut* CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CMap* CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CGauge* CreateGauge(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CCompass* CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CTarget* CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool DeleteControl(EventType eventMsg);
+ CControl* SearchControl(EventType eventMsg);
+
+ EventType GetEventTypeReduce();
+ EventType GetEventTypeFull();
+ EventType GetEventTypeClose();
void SetName(char* name);
void SetTrashEvent(bool bTrash);
- bool RetTrashEvent();
+ bool GetTrashEvent();
void SetPos(Math::Point pos);
void SetDim(Math::Point dim);
void SetMinDim(Math::Point dim);
void SetMaxDim(Math::Point dim);
- Math::Point RetMinDim();
- Math::Point RetMaxDim();
+ Math::Point GetMinDim();
+ Math::Point GetMaxDim();
void SetMovable(bool bMode);
- bool RetMovable();
+ bool GetMovable();
void SetRedim(bool bMode);
- bool RetRedim();
+ bool GetRedim();
void SetClosable(bool bMode);
- bool RetClosable();
+ bool GetClosable();
void SetMaximized(bool bMaxi);
- bool RetMaximized();
+ bool GetMaximized();
void SetMinimized(bool bMini);
- bool RetMinimized();
+ bool GetMinimized();
void SetFixed(bool bFix);
- bool RetFixed();
+ bool GetFixed();
bool GetTooltip(Math::Point pos, char* name);
@@ -140,7 +124,8 @@ protected:
bool m_bCapture;
Math::Point m_pressPos;
int m_pressFlags;
- D3DMouse m_pressMouse;
+ Gfx::EngineMouseType m_pressMouse;
};
+}