diff options
Diffstat (limited to 'src')
98 files changed, 2954 insertions, 2499 deletions
diff --git a/src/CBot/resource.h b/src/CBot/resource.h index 96a01ba..ed14240 100644 --- a/src/CBot/resource.h +++ b/src/CBot/resource.h @@ -15,8 +15,7 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. #pragma once -#ifndef _RESOURCE_H_ -#define _RESOURCE_H_ + enum EID { @@ -114,6 +113,9 @@ enum EID TX_NAN, ID_SUPER = 6000 }; + +// TODO: refactor & change to enum! + #define TX_OPENPAR 5000 #define TX_CLOSEPAR 5001 #define TX_NOTBOOL 5002 @@ -174,4 +176,4 @@ enum EID #define TX_ERRREAD 6014 #define TX_ERRWRITE 6015 -#endif //_RESOURCE_H_ +#define TX_MAX 6016 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f68a1d5..e836d95 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,6 +10,7 @@ add_subdirectory(po) if(${TESTS}) add_subdirectory(common/test) add_subdirectory(graphics/engine/test) + add_subdirectory(ui/test) add_subdirectory(math/test) endif() @@ -54,7 +55,6 @@ common/logger.cpp common/misc.cpp common/profile.cpp common/restext.cpp -common/restext_strings.c common/stringutils.cpp graphics/core/color.cpp graphics/engine/camera.cpp diff --git a/src/app/app.h b/src/app/app.h index e887a63..32f03f8 100644 --- a/src/app/app.h +++ b/src/app/app.h @@ -38,7 +38,7 @@ class CInstanceManager; -class CEvent; +class CEventQueue; class CRobotMain; class CSoundInterface; diff --git a/src/app/main.cpp b/src/app/main.cpp index 7cd98b9..e621065 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -22,6 +22,7 @@ #include "app/app.h" #include "app/system.h" + #include "common/logger.h" #include "common/misc.h" #include "common/restext.h" @@ -73,6 +74,8 @@ int main(int argc, char *argv[]) { CLogger logger; // Create the logger + InitializeRestext(); // Initialize translation strings + logger.Info("Colobot starting\n"); CApplication app; // single instance of the application diff --git a/src/app/system.cpp b/src/app/system.cpp index eb0321b..73614aa 100644 --- a/src/app/system.cpp +++ b/src/app/system.cpp @@ -15,7 +15,6 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// system.cpp #include "app/system.h" @@ -23,13 +22,13 @@ #if defined(PLATFORM_WINDOWS) -#include "system_windows.h" +#include "app/system_windows.h" #elif defined(PLATFORM_LINUX) -#include "system_linux.h" +#include "app/system_linux.h" #else -#include "system_other.h" +#include "app/system_other.h" #endif diff --git a/src/common/error_ids.h b/src/common/error_ids.h deleted file mode 100644 index fc1f7d6..0000000 --- a/src/common/error_ids.h +++ /dev/null @@ -1,151 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. - - -// TODO: move to global.h after restext rewrite - -#pragma once - -enum Error -{ - ERR_OK = 0, // ok - ERR_GENERIC = 1, // any error - ERR_CONTINUE = 2, // continues - ERR_STOP = 3, // stops - ERR_CMD = 4, // unknown command - ERR_MANIP_VEH = 100, // inappropriate vehicle - ERR_MANIP_FLY = 101, // impossible in flight - ERR_MANIP_BUSY = 102, // taking: hands already occupied - ERR_MANIP_NIL = 103, // taking: nothing has to take - ERR_MANIP_MOTOR = 105, // busy: impossible to move - ERR_MANIP_OCC = 106, // busy: location already occupied - ERR_MANIP_FRIEND = 107, // no other vehicle - ERR_MANIP_RADIO = 108, // impossible because radioactive - ERR_MANIP_WATER = 109, // not possible under water - ERR_MANIP_EMPTY = 110, // nothing to deposit - ERR_BUILD_FLY = 120, // not possible in flight - ERR_BUILD_WATER = 121, // not possible under water - ERR_BUILD_ENERGY = 122, // not enough energy - ERR_BUILD_METALAWAY = 123, // lack of metal (too far) - ERR_BUILD_METALNEAR = 124, // lack of metal (too close) - ERR_BUILD_METALINEX = 125, // lack of metal - ERR_BUILD_FLAT = 126, // not enough flat ground - ERR_BUILD_FLATLIT = 127, // not enough flat ground space - ERR_BUILD_BUSY = 128, // location occupied - ERR_BUILD_BASE = 129, // too close to the rocket - ERR_BUILD_NARROW = 130, // buildings too close - ERR_BUILD_MOTOR = 131, // built: not possible in movement - ERR_SEARCH_FLY = 140, // not possible in flight - ERR_SEARCH_VEH = 141, // inappropriate vehicle - ERR_SEARCH_MOTOR = 142, // impossible in movement - ERR_TERRA_VEH = 150, // inappropriate vehicle - ERR_TERRA_ENERGY = 151, // not enough energy - ERR_TERRA_FLOOR = 152, // inappropriate ground - ERR_TERRA_BUILDING = 153, // building too close - ERR_TERRA_OBJECT = 154, // object too close - ERR_FIRE_VEH = 160, // inappropriate vehicle - ERR_FIRE_ENERGY = 161, // not enough energy - ERR_FIRE_FLY = 162, // not possible in flight - ERR_RECOVER_VEH = 170, // inappropriate vehicle - ERR_RECOVER_ENERGY = 171, // not enough energy - ERR_RECOVER_NULL = 172, // lack of ruin - ERR_CONVERT_EMPTY = 180, // no stone was transformed - ERR_SHIELD_VEH = 190, // inappropriate vehicle - ERR_SHIELD_ENERGY = 191, // not enough energy - ERR_MOVE_IMPOSSIBLE = 200, // move impossible - ERR_FIND_IMPOSSIBLE = 201, // find impossible - ERR_GOTO_IMPOSSIBLE = 210, // goto impossible - ERR_GOTO_ITER = 211, // goto too complicated - ERR_GOTO_BUSY = 212, // goto destination occupied - ERR_DERRICK_NULL = 300, // no ore underground - ERR_STATION_NULL = 301, // no energy underground - ERR_TOWER_POWER = 310, // no battery - ERR_TOWER_ENERGY = 311, // more energy - ERR_RESEARCH_POWER = 320, // no battery - ERR_RESEARCH_ENERGY = 321, // more energy - ERR_RESEARCH_TYPE = 322, // the wrong type of battery - ERR_RESEARCH_ALREADY = 323, // research already done - ERR_ENERGY_NULL = 330, // no energy underground - ERR_ENERGY_LOW = 331, // not enough energy - ERR_ENERGY_EMPTY = 332, // lack of metal - ERR_ENERGY_BAD = 333, // transforms only the metal - ERR_BASE_DLOCK = 340, // doors locked - ERR_BASE_DHUMAN = 341, // you must be on spaceship - ERR_LABO_NULL = 350, // nothing to analyze - ERR_LABO_BAD = 351, // analyzes only organic ball - ERR_LABO_ALREADY = 352, // analysis already made - ERR_NUCLEAR_NULL = 360, // no energy underground - ERR_NUCLEAR_LOW = 361, // not enough energy - ERR_NUCLEAR_EMPTY = 362, // lack of uranium - ERR_NUCLEAR_BAD = 363, // transforms only uranium - ERR_FACTORY_NULL = 370, // no metal - ERR_FACTORY_NEAR = 371, // vehicle too close - ERR_RESET_NEAR = 380, // vehicle too close - ERR_INFO_NULL = 390, // no information terminal - ERR_VEH_VIRUS = 400, // vehicle infected by a virus - ERR_BAT_VIRUS = 401, // building infected by a virus - ERR_VEH_POWER = 500, // no battery - ERR_VEH_ENERGY = 501, // more energy - ERR_FLAG_FLY = 510, // impossible in flight - ERR_FLAG_WATER = 511, // impossible during swimming - ERR_FLAG_MOTOR = 512, // impossible in movement - ERR_FLAG_BUSY = 513, // taking: already creating flag - ERR_FLAG_CREATE = 514, // too many flags - ERR_FLAG_PROXY = 515, // too close - ERR_FLAG_DELETE = 516, // nothing to remove - ERR_MISSION_NOTERM = 600, // Mission not completed - ERR_DELETEMOBILE = 700, // vehicle destroyed - ERR_DELETEBUILDING = 701, // building destroyed - ERR_TOOMANY = 702, // too many objects - ERR_OBLIGATORYTOKEN = 800, // compulsory instruction missing - ERR_PROHIBITEDTOKEN = 801, // instruction prohibited - - INFO_FIRST = 10000, // first information - INFO_BUILD = 10001, // construction builded - INFO_CONVERT = 10002, // metal available - INFO_RESEARCH = 10003, // search ended - INFO_FACTORY = 10004, // vehicle manufactured - INFO_LABO = 10005, // analysis ended - INFO_ENERGY = 10006, // battery available - INFO_NUCLEAR = 10007, // nuclear battery available - INFO_FINDING = 10008, // nuclear battery available - INFO_MARKPOWER = 10020, // location for station found - INFO_MARKURANIUM = 10021, // location for derrick found - INFO_MARKSTONE = 10022, // location for derrick found - INFO_MARKKEYa = 10023, // location for derrick found - INFO_MARKKEYb = 10024, // location for derrick found - INFO_MARKKEYc = 10025, // location for derrick found - INFO_MARKKEYd = 10026, // location for derrick found - INFO_RESEARCHTANK = 10030, // research ended - INFO_RESEARCHFLY = 10031, // research ended - INFO_RESEARCHTHUMP = 10032, // research ended - INFO_RESEARCHCANON = 10033, // research ended - INFO_RESEARCHTOWER = 10034, // research ended - INFO_RESEARCHPHAZER = 10035, // research ended - INFO_RESEARCHSHIELD = 10036, // research ended - INFO_RESEARCHATOMIC = 10037, // research ended - INFO_WIN = 10040, // win - INFO_LOST = 10041, // lost - INFO_LOSTq = 10042, // lost immediately - INFO_WRITEOK = 10043, // record done - INFO_DELETEPATH = 10050, // way mark deleted - INFO_DELETEMOTHER = 10100, // insect killed - INFO_DELETEANT = 10101, // insect killed - INFO_DELETEBEE = 10102, // insect killed - INFO_DELETEWORM = 10103, // insect killed - INFO_DELETESPIDER = 10104, // insect killed - INFO_BEGINSATCOM = 10105, // use your SatCom -}; diff --git a/src/common/event.cpp b/src/common/event.cpp index 4e5ec1a..b078dc5 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -16,6 +16,7 @@ #include "common/event.h" + #include "common/iman.h" #include "common/logger.h" diff --git a/src/common/event.h b/src/common/event.h index ce2872a..169f0d0 100644 --- a/src/common/event.h +++ b/src/common/event.h @@ -23,7 +23,7 @@ #include "common/key.h" -#include "common/event_ids.h" + #include "math/point.h" #include "math/vector.h" @@ -31,6 +31,530 @@ class CInstanceManager; /** + \enum EventType + \brief Type of event message + */ +enum EventType +{ + +// TODO: document the meaning of each value + + //! Invalid event / no event + EVENT_NULL = 0, + + //! Event sent on user or system quit request + EVENT_QUIT = 1, + + //! Frame update event + EVENT_FRAME = 2, + + //! Event sent after pressing a mouse button + EVENT_MOUSE_BUTTON_DOWN = 3, + //! Event sent after releasing a mouse button + EVENT_MOUSE_BUTTON_UP = 4, + //! Event sent after moving mouse wheel up or down + EVENT_MOUSE_WHEEL = 5, + //! Event sent after moving the mouse + EVENT_MOUSE_MOVE = 7, + //! Event sent after pressing a key + EVENT_KEY_DOWN = 8, + //! Event sent after releasing a key + EVENT_KEY_UP = 9, + + //! Event sent when application window loses/gains focus + EVENT_ACTIVE = 10, + + //! Event sent after moving joystick axes + EVENT_JOY_AXIS = 12, + //! Event sent after pressing a joystick button + EVENT_JOY_BUTTON_DOWN = 13, + //! Event sent after releasing a joystick button + EVENT_JOY_BUTTON_UP = 14, + + + /* Events sent/received in game and user interface */ + + EVENT_UPDINTERFACE = 20, + EVENT_WIN = 30, + EVENT_LOST = 31, + + //! CEdit focus + EVENT_FOCUS = 35, + + EVENT_BUTTON_OK = 40, + EVENT_BUTTON_CANCEL = 41, + EVENT_BUTTON_NEXT = 42, + EVENT_BUTTON_PREV = 43, + EVENT_BUTTON_QUIT = 44, + + EVENT_BUTTON0 = 50, + EVENT_BUTTON1 = 51, + EVENT_BUTTON2 = 52, + EVENT_BUTTON3 = 53, + EVENT_BUTTON4 = 54, + EVENT_BUTTON5 = 55, + EVENT_BUTTON6 = 56, + EVENT_BUTTON7 = 57, + EVENT_BUTTON8 = 58, + EVENT_BUTTON9 = 59, + EVENT_BUTTON10 = 60, + EVENT_BUTTON11 = 61, + EVENT_BUTTON12 = 62, + EVENT_BUTTON13 = 63, + EVENT_BUTTON14 = 64, + EVENT_BUTTON15 = 65, + EVENT_BUTTON16 = 66, + EVENT_BUTTON17 = 67, + EVENT_BUTTON18 = 68, + EVENT_BUTTON19 = 69, + + EVENT_EDIT0 = 70, + EVENT_EDIT1 = 71, + EVENT_EDIT2 = 72, + EVENT_EDIT3 = 73, + EVENT_EDIT4 = 74, + EVENT_EDIT5 = 75, + EVENT_EDIT6 = 76, + EVENT_EDIT7 = 77, + EVENT_EDIT8 = 78, + EVENT_EDIT9 = 79, + + EVENT_WINDOW0 = 80, // the bottom panel + EVENT_WINDOW1 = 81, // map + EVENT_WINDOW2 = 82, // CDisplayText + EVENT_WINDOW3 = 83, // CStudio + EVENT_WINDOW4 = 84, // DisplayInfo + EVENT_WINDOW5 = 85, // setup + EVENT_WINDOW6 = 86, + EVENT_WINDOW7 = 87, + EVENT_WINDOW8 = 88, + EVENT_WINDOW9 = 89, // dialogue + + EVENT_LABEL0 = 90, + EVENT_LABEL1 = 91, + EVENT_LABEL2 = 92, + EVENT_LABEL3 = 93, + EVENT_LABEL4 = 94, + EVENT_LABEL5 = 95, + EVENT_LABEL6 = 96, + EVENT_LABEL7 = 97, + EVENT_LABEL8 = 98, + EVENT_LABEL9 = 99, + EVENT_LABEL10 = 100, + EVENT_LABEL11 = 101, + EVENT_LABEL12 = 102, + EVENT_LABEL13 = 103, + EVENT_LABEL14 = 104, + EVENT_LABEL15 = 105, + EVENT_LABEL16 = 106, + EVENT_LABEL17 = 107, + EVENT_LABEL18 = 108, + EVENT_LABEL19 = 109, + + EVENT_LIST0 = 110, + EVENT_LIST1 = 111, + EVENT_LIST2 = 112, + EVENT_LIST3 = 113, + EVENT_LIST4 = 114, + EVENT_LIST5 = 115, + EVENT_LIST6 = 116, + EVENT_LIST7 = 117, + EVENT_LIST8 = 118, + EVENT_LIST9 = 119, + + EVENT_TOOLTIP = 200, + + EVENT_DIALOG_OK = 300, + EVENT_DIALOG_CANCEL = 301, + EVENT_DIALOG_LABEL = 302, + EVENT_DIALOG_LABEL1 = 303, + EVENT_DIALOG_LABEL2 = 304, + EVENT_DIALOG_LABEL3 = 305, + EVENT_DIALOG_LIST = 306, + EVENT_DIALOG_EDIT = 307, + EVENT_DIALOG_CHECK1 = 308, + EVENT_DIALOG_CHECK2 = 309, + + EVENT_INTERFACE_TRAINER = 400, + EVENT_INTERFACE_DEFI = 401, + EVENT_INTERFACE_MISSION = 402, + EVENT_INTERFACE_FREE = 403, + EVENT_INTERFACE_PROTO = 404, + EVENT_INTERFACE_NAME = 405, + EVENT_INTERFACE_SETUP = 406, + EVENT_INTERFACE_QUIT = 407, + EVENT_INTERFACE_BACK = 408, + EVENT_INTERFACE_AGAIN = 409, + EVENT_INTERFACE_WRITE = 410, + EVENT_INTERFACE_READ = 411, + EVENT_INTERFACE_ABORT = 412, + EVENT_INTERFACE_USER = 413, + EVENT_INTERFACE_TEEN = 414, + + EVENT_INTERFACE_CHAP = 420, + EVENT_INTERFACE_LIST = 421, + EVENT_INTERFACE_RESUME = 422, + EVENT_INTERFACE_PLAY = 423, + + EVENT_INTERFACE_SETUPd = 430, + EVENT_INTERFACE_SETUPg = 431, + EVENT_INTERFACE_SETUPp = 432, + EVENT_INTERFACE_SETUPc = 433, + EVENT_INTERFACE_SETUPs = 434, + + EVENT_INTERFACE_DEVICE = 440, + EVENT_INTERFACE_RESOL = 441, + EVENT_INTERFACE_FULL = 442, + EVENT_INTERFACE_APPLY = 443, + + EVENT_INTERFACE_TOTO = 450, + EVENT_INTERFACE_SHADOW = 451, + EVENT_INTERFACE_DIRTY = 452, + EVENT_INTERFACE_LENS = 453, + EVENT_INTERFACE_SKY = 454, + EVENT_INTERFACE_PLANET = 456, + EVENT_INTERFACE_LIGHT = 457, + EVENT_INTERFACE_PARTI = 458, + EVENT_INTERFACE_CLIP = 459, + EVENT_INTERFACE_DETAIL = 460, + EVENT_INTERFACE_TEXTURE = 461, + EVENT_INTERFACE_RAIN = 462, + EVENT_INTERFACE_GLINT = 463, + EVENT_INTERFACE_TOOLTIP = 464, + EVENT_INTERFACE_MOVIES = 465, + EVENT_INTERFACE_NICERST = 466, + EVENT_INTERFACE_SCROLL = 467, + EVENT_INTERFACE_INVERTX = 468, + EVENT_INTERFACE_INVERTY = 469, + EVENT_INTERFACE_EFFECT = 470, + EVENT_INTERFACE_MOUSE = 471, + EVENT_INTERFACE_GROUND = 472, + EVENT_INTERFACE_GADGET = 473, + EVENT_INTERFACE_FOG = 474, + EVENT_INTERFACE_HIMSELF = 475, + EVENT_INTERFACE_EDITMODE= 476, + EVENT_INTERFACE_EDITVALUE= 477, + EVENT_INTERFACE_SOLUCE4 = 478, + + EVENT_INTERFACE_KINFO1 = 500, + EVENT_INTERFACE_KINFO2 = 501, + EVENT_INTERFACE_KGROUP = 502, + EVENT_INTERFACE_KSCROLL = 503, + EVENT_INTERFACE_KDEF = 504, + EVENT_INTERFACE_KLEFT = 505, + EVENT_INTERFACE_KRIGHT = 506, + EVENT_INTERFACE_KUP = 507, + EVENT_INTERFACE_KDOWN = 508, + EVENT_INTERFACE_KGUP = 509, + EVENT_INTERFACE_KGDOWN = 510, + EVENT_INTERFACE_KCAMERA = 511, + EVENT_INTERFACE_KDESEL = 512, + EVENT_INTERFACE_KACTION = 513, + EVENT_INTERFACE_KNEAR = 514, + EVENT_INTERFACE_KAWAY = 515, + EVENT_INTERFACE_KNEXT = 516, + EVENT_INTERFACE_KHUMAN = 517, + EVENT_INTERFACE_KQUIT = 518, + EVENT_INTERFACE_KHELP = 519, + EVENT_INTERFACE_KPROG = 520, + EVENT_INTERFACE_KCBOT = 521, + EVENT_INTERFACE_KVISIT = 522, + EVENT_INTERFACE_KSPEED10= 523, + EVENT_INTERFACE_KSPEED15= 524, + EVENT_INTERFACE_KSPEED20= 525, + EVENT_INTERFACE_KSPEED30= 526, + + EVENT_INTERFACE_VOLSOUND= 530, + EVENT_INTERFACE_VOLMUSIC= 531, + EVENT_INTERFACE_SOUND3D = 532, + + EVENT_INTERFACE_MIN = 540, + EVENT_INTERFACE_NORM = 541, + EVENT_INTERFACE_MAX = 542, + + EVENT_INTERFACE_SILENT = 550, + EVENT_INTERFACE_NOISY = 551, + + EVENT_INTERFACE_JOYSTICK= 560, + EVENT_INTERFACE_SOLUCE = 561, + + EVENT_INTERFACE_GLINTl = 570, + EVENT_INTERFACE_GLINTr = 571, + EVENT_INTERFACE_GLINTu = 572, + EVENT_INTERFACE_GLINTb = 573, + + EVENT_INTERFACE_NEDIT = 580, + EVENT_INTERFACE_NLIST = 581, + EVENT_INTERFACE_NOK = 582, + EVENT_INTERFACE_NCANCEL = 583, + EVENT_INTERFACE_NDELETE = 584, + EVENT_INTERFACE_NLABEL = 585, + + EVENT_INTERFACE_IOWRITE = 600, + EVENT_INTERFACE_IOREAD = 601, + EVENT_INTERFACE_IOLIST = 602, + EVENT_INTERFACE_IONAME = 603, + EVENT_INTERFACE_IOLABEL = 604, + EVENT_INTERFACE_IOIMAGE = 605, + EVENT_INTERFACE_IODELETE= 606, + + EVENT_INTERFACE_PERSO = 620, + EVENT_INTERFACE_POK = 621, + EVENT_INTERFACE_PCANCEL = 622, + EVENT_INTERFACE_PDEF = 623, + EVENT_INTERFACE_PHEAD = 624, + EVENT_INTERFACE_PBODY = 625, + EVENT_INTERFACE_PLROT = 626, + EVENT_INTERFACE_PRROT = 627, + EVENT_INTERFACE_PC0a = 640, + EVENT_INTERFACE_PC1a = 641, + EVENT_INTERFACE_PC2a = 642, + EVENT_INTERFACE_PC3a = 643, + EVENT_INTERFACE_PC4a = 644, + EVENT_INTERFACE_PC5a = 645, + EVENT_INTERFACE_PC6a = 646, + EVENT_INTERFACE_PC7a = 647, + EVENT_INTERFACE_PC8a = 648, + EVENT_INTERFACE_PC9a = 649, + EVENT_INTERFACE_PCRa = 650, + EVENT_INTERFACE_PCGa = 651, + EVENT_INTERFACE_PCBa = 652, + EVENT_INTERFACE_PC0b = 660, + EVENT_INTERFACE_PC1b = 661, + EVENT_INTERFACE_PC2b = 662, + EVENT_INTERFACE_PC3b = 663, + EVENT_INTERFACE_PC4b = 664, + EVENT_INTERFACE_PC5b = 665, + EVENT_INTERFACE_PC6b = 666, + EVENT_INTERFACE_PC7b = 667, + EVENT_INTERFACE_PC8b = 668, + EVENT_INTERFACE_PC9b = 669, + EVENT_INTERFACE_PCRb = 670, + EVENT_INTERFACE_PCGb = 671, + EVENT_INTERFACE_PCBb = 672, + EVENT_INTERFACE_PFACE1 = 680, + EVENT_INTERFACE_PFACE2 = 681, + EVENT_INTERFACE_PFACE3 = 682, + EVENT_INTERFACE_PFACE4 = 683, + EVENT_INTERFACE_PGLASS0 = 690, + EVENT_INTERFACE_PGLASS1 = 691, + EVENT_INTERFACE_PGLASS2 = 692, + EVENT_INTERFACE_PGLASS3 = 693, + EVENT_INTERFACE_PGLASS4 = 694, + EVENT_INTERFACE_PGLASS5 = 695, + EVENT_INTERFACE_PGLASS6 = 696, + EVENT_INTERFACE_PGLASS7 = 697, + EVENT_INTERFACE_PGLASS8 = 698, + EVENT_INTERFACE_PGLASS9 = 699, + + EVENT_DT_GROUP0 = 700, + EVENT_DT_GROUP1 = 701, + EVENT_DT_GROUP2 = 702, + EVENT_DT_GROUP3 = 703, + EVENT_DT_GROUP4 = 704, + EVENT_DT_LABEL0 = 710, + EVENT_DT_LABEL1 = 711, + EVENT_DT_LABEL2 = 712, + EVENT_DT_LABEL3 = 713, + EVENT_DT_LABEL4 = 714, + EVENT_DT_VISIT0 = 720, + EVENT_DT_VISIT1 = 721, + EVENT_DT_VISIT2 = 722, + EVENT_DT_VISIT3 = 723, + EVENT_DT_VISIT4 = 724, + EVENT_DT_END = 725, + + EVENT_CMD = 800, + EVENT_SPEED = 801, + + EVENT_HYPER_PREV = 900, + EVENT_HYPER_NEXT = 901, + EVENT_HYPER_HOME = 902, + EVENT_HYPER_COPY = 903, + EVENT_HYPER_SIZE1 = 904, + EVENT_HYPER_SIZE2 = 905, + EVENT_HYPER_SIZE3 = 906, + EVENT_HYPER_SIZE4 = 907, + EVENT_HYPER_SIZE5 = 908, + + EVENT_SATCOM_HUSTON = 920, + EVENT_SATCOM_SAT = 921, + EVENT_SATCOM_LOADING = 922, + EVENT_SATCOM_OBJECT = 923, + EVENT_SATCOM_PROG = 924, + EVENT_SATCOM_SOLUCE = 925, + + EVENT_OBJECT_DESELECT = 1000, + EVENT_OBJECT_LEFT = 1001, + EVENT_OBJECT_RIGHT = 1002, + EVENT_OBJECT_UP = 1003, + EVENT_OBJECT_DOWN = 1004, + EVENT_OBJECT_GASUP = 1005, + EVENT_OBJECT_GASDOWN = 1006, + EVENT_OBJECT_HTAKE = 1020, + EVENT_OBJECT_MTAKE = 1021, + EVENT_OBJECT_MFRONT = 1022, + EVENT_OBJECT_MBACK = 1023, + EVENT_OBJECT_MPOWER = 1024, + EVENT_OBJECT_BHELP = 1040, + EVENT_OBJECT_BTAKEOFF = 1041, + EVENT_OBJECT_BDERRICK = 1050, + EVENT_OBJECT_BSTATION = 1051, + EVENT_OBJECT_BFACTORY = 1052, + EVENT_OBJECT_BCONVERT = 1053, + EVENT_OBJECT_BTOWER = 1054, + EVENT_OBJECT_BREPAIR = 1055, + EVENT_OBJECT_BRESEARCH = 1056, + EVENT_OBJECT_BRADAR = 1057, + EVENT_OBJECT_BENERGY = 1058, + EVENT_OBJECT_BLABO = 1059, + EVENT_OBJECT_BNUCLEAR = 1060, + EVENT_OBJECT_BPARA = 1061, + EVENT_OBJECT_BINFO = 1062, + EVENT_OBJECT_BXXXX = 1063, + EVENT_OBJECT_GFLAT = 1070, + EVENT_OBJECT_FCREATE = 1071, + EVENT_OBJECT_FDELETE = 1072, + EVENT_OBJECT_FCOLORb = 1073, + EVENT_OBJECT_FCOLORr = 1074, + EVENT_OBJECT_FCOLORg = 1075, + EVENT_OBJECT_FCOLORy = 1076, + EVENT_OBJECT_FCOLORv = 1077, + EVENT_OBJECT_FACTORYwa = 1080, + EVENT_OBJECT_FACTORYta = 1081, + EVENT_OBJECT_FACTORYfa = 1082, + EVENT_OBJECT_FACTORYia = 1083, + EVENT_OBJECT_FACTORYwc = 1084, + EVENT_OBJECT_FACTORYtc = 1085, + EVENT_OBJECT_FACTORYfc = 1086, + EVENT_OBJECT_FACTORYic = 1087, + EVENT_OBJECT_FACTORYwi = 1088, + EVENT_OBJECT_FACTORYti = 1089, + EVENT_OBJECT_FACTORYfi = 1090, + EVENT_OBJECT_FACTORYii = 1091, + EVENT_OBJECT_FACTORYws = 1092, + EVENT_OBJECT_FACTORYts = 1093, + EVENT_OBJECT_FACTORYfs = 1094, + EVENT_OBJECT_FACTORYis = 1095, + EVENT_OBJECT_FACTORYrt = 1096, + EVENT_OBJECT_FACTORYrc = 1097, + EVENT_OBJECT_FACTORYrr = 1098, + EVENT_OBJECT_FACTORYrs = 1099, + EVENT_OBJECT_FACTORYsa = 1100, + EVENT_OBJECT_SEARCH = 1200, + EVENT_OBJECT_TERRAFORM = 1201, + EVENT_OBJECT_FIRE = 1202, + EVENT_OBJECT_FIREANT = 1203, + EVENT_OBJECT_RECOVER = 1220, + EVENT_OBJECT_BEGSHIELD = 1221, + EVENT_OBJECT_ENDSHIELD = 1222, + EVENT_OBJECT_RTANK = 1223, + EVENT_OBJECT_RFLY = 1224, + EVENT_OBJECT_RTHUMP = 1225, + EVENT_OBJECT_RCANON = 1226, + EVENT_OBJECT_RTOWER = 1227, + EVENT_OBJECT_RPHAZER = 1228, + EVENT_OBJECT_RSHIELD = 1229, + EVENT_OBJECT_RATOMIC = 1230, + EVENT_OBJECT_RiPAW = 1231, + EVENT_OBJECT_RiGUN = 1232, + EVENT_OBJECT_RESET = 1233, + EVENT_OBJECT_DIMSHIELD = 1234, + EVENT_OBJECT_TARGET = 1235, + EVENT_OBJECT_PROGLIST = 1310, + EVENT_OBJECT_PROGRUN = 1311, + EVENT_OBJECT_PROGEDIT = 1312, + EVENT_OBJECT_PROGSTART = 1313, + EVENT_OBJECT_PROGSTOP = 1314, + EVENT_OBJECT_INFOOK = 1340, + EVENT_OBJECT_DELETE = 1350, + EVENT_OBJECT_GENERGY = 1360, + EVENT_OBJECT_GSHIELD = 1361, + EVENT_OBJECT_GRANGE = 1362, + EVENT_OBJECT_COMPASS = 1363, + EVENT_OBJECT_MAP = 1364, + EVENT_OBJECT_MAPZOOM = 1365, + EVENT_OBJECT_GPROGRESS = 1366, + EVENT_OBJECT_GRADAR = 1367, + EVENT_OBJECT_GINFO = 1368, + EVENT_OBJECT_TYPE = 1369, + EVENT_OBJECT_CROSSHAIR = 1370, + EVENT_OBJECT_CORNERul = 1371, + EVENT_OBJECT_CORNERur = 1372, + EVENT_OBJECT_CORNERdl = 1373, + EVENT_OBJECT_CORNERdr = 1374, + EVENT_OBJECT_MAPi = 1375, + EVENT_OBJECT_MAPg = 1376, + EVENT_OBJECT_CAMERA = 1400, + EVENT_OBJECT_HELP = 1401, + EVENT_OBJECT_SOLUCE = 1402, + EVENT_OBJECT_CAMERAleft = 1403, + EVENT_OBJECT_CAMERAright= 1404, + EVENT_OBJECT_CAMERAnear = 1405, + EVENT_OBJECT_CAMERAaway = 1406, + EVENT_OBJECT_SHORTCUT00 = 1500, + EVENT_OBJECT_SHORTCUT01 = 1501, + EVENT_OBJECT_SHORTCUT02 = 1502, + EVENT_OBJECT_SHORTCUT03 = 1503, + EVENT_OBJECT_SHORTCUT04 = 1504, + EVENT_OBJECT_SHORTCUT05 = 1505, + EVENT_OBJECT_SHORTCUT06 = 1506, + EVENT_OBJECT_SHORTCUT07 = 1507, + EVENT_OBJECT_SHORTCUT08 = 1508, + EVENT_OBJECT_SHORTCUT09 = 1509, + EVENT_OBJECT_SHORTCUT10 = 1510, + EVENT_OBJECT_SHORTCUT11 = 1511, + EVENT_OBJECT_SHORTCUT12 = 1512, + EVENT_OBJECT_SHORTCUT13 = 1513, + EVENT_OBJECT_SHORTCUT14 = 1514, + EVENT_OBJECT_SHORTCUT15 = 1515, + EVENT_OBJECT_SHORTCUT16 = 1516, + EVENT_OBJECT_SHORTCUT17 = 1517, + EVENT_OBJECT_SHORTCUT18 = 1518, + EVENT_OBJECT_SHORTCUT19 = 1519, + EVENT_OBJECT_MOVIELOCK = 1550, + EVENT_OBJECT_EDITLOCK = 1551, + EVENT_OBJECT_LIMIT = 1560, + + EVENT_OBJECT_PEN0 = 1570, + EVENT_OBJECT_PEN1 = 1571, + EVENT_OBJECT_PEN2 = 1572, + EVENT_OBJECT_PEN3 = 1573, + EVENT_OBJECT_PEN4 = 1574, + EVENT_OBJECT_PEN5 = 1575, + EVENT_OBJECT_PEN6 = 1576, + EVENT_OBJECT_PEN7 = 1577, + EVENT_OBJECT_PEN8 = 1578, + EVENT_OBJECT_REC = 1580, + EVENT_OBJECT_STOP = 1581, + + EVENT_STUDIO_OK = 2000, + EVENT_STUDIO_CANCEL = 2001, + EVENT_STUDIO_EDIT = 2002, + EVENT_STUDIO_LIST = 2003, + EVENT_STUDIO_NEW = 2010, + EVENT_STUDIO_OPEN = 2011, + EVENT_STUDIO_SAVE = 2012, + EVENT_STUDIO_UNDO = 2013, + EVENT_STUDIO_CUT = 2014, + EVENT_STUDIO_COPY = 2015, + EVENT_STUDIO_PASTE = 2016, + EVENT_STUDIO_SIZE = 2017, + EVENT_STUDIO_TOOL = 2018, + EVENT_STUDIO_HELP = 2019, + EVENT_STUDIO_COMPILE = 2050, + EVENT_STUDIO_RUN = 2051, + EVENT_STUDIO_REALTIME = 2052, + EVENT_STUDIO_STEP = 2053, + + EVENT_STD_MAX, //! < maximum value of standard events + + EVENT_USER = 10000, + EVENT_FORCE_LONG = 0x7fffffff +}; + + +/** * \struct KeyEventData * \brief Additional data for keyboard event */ diff --git a/src/common/event_ids.h b/src/common/event_ids.h deleted file mode 100644 index b6c646c..0000000 --- a/src/common/event_ids.h +++ /dev/null @@ -1,541 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. - - -// TODO: move to event.h after restext rewrite - -#pragma once - -/** - \enum EventType - \brief Type of event message - */ -enum EventType -{ - -// TODO: document the meaning of each value - - //! Invalid event / no event - EVENT_NULL = 0, - - //! Event sent on user or system quit request - EVENT_QUIT = 1, - - //! Frame update event - EVENT_FRAME = 2, - - //! Event sent after pressing a mouse button - EVENT_MOUSE_BUTTON_DOWN = 3, - //! Event sent after releasing a mouse button - EVENT_MOUSE_BUTTON_UP = 4, - //! Event sent after moving mouse wheel up or down - EVENT_MOUSE_WHEEL = 5, - //! Event sent after moving the mouse - EVENT_MOUSE_MOVE = 7, - //! Event sent after pressing a key - EVENT_KEY_DOWN = 8, - //! Event sent after releasing a key - EVENT_KEY_UP = 9, - - //! Event sent when application window loses/gains focus - EVENT_ACTIVE = 10, - - //! Event sent after moving joystick axes - EVENT_JOY_AXIS = 12, - //! Event sent after pressing a joystick button - EVENT_JOY_BUTTON_DOWN = 13, - //! Event sent after releasing a joystick button - EVENT_JOY_BUTTON_UP = 14, - - - /* Events sent/received in game and user interface */ - - EVENT_UPDINTERFACE = 20, - EVENT_WIN = 30, - EVENT_LOST = 31, - - //! CEdit focus - EVENT_FOCUS = 35, - - EVENT_BUTTON_OK = 40, - EVENT_BUTTON_CANCEL = 41, - EVENT_BUTTON_NEXT = 42, - EVENT_BUTTON_PREV = 43, - EVENT_BUTTON_QUIT = 44, - - EVENT_BUTTON0 = 50, - EVENT_BUTTON1 = 51, - EVENT_BUTTON2 = 52, - EVENT_BUTTON3 = 53, - EVENT_BUTTON4 = 54, - EVENT_BUTTON5 = 55, - EVENT_BUTTON6 = 56, - EVENT_BUTTON7 = 57, - EVENT_BUTTON8 = 58, - EVENT_BUTTON9 = 59, - EVENT_BUTTON10 = 60, - EVENT_BUTTON11 = 61, - EVENT_BUTTON12 = 62, - EVENT_BUTTON13 = 63, - EVENT_BUTTON14 = 64, - EVENT_BUTTON15 = 65, - EVENT_BUTTON16 = 66, - EVENT_BUTTON17 = 67, - EVENT_BUTTON18 = 68, - EVENT_BUTTON19 = 69, - - EVENT_EDIT0 = 70, - EVENT_EDIT1 = 71, - EVENT_EDIT2 = 72, - EVENT_EDIT3 = 73, - EVENT_EDIT4 = 74, - EVENT_EDIT5 = 75, - EVENT_EDIT6 = 76, - EVENT_EDIT7 = 77, - EVENT_EDIT8 = 78, - EVENT_EDIT9 = 79, - - EVENT_WINDOW0 = 80, // the bottom panel - EVENT_WINDOW1 = 81, // map - EVENT_WINDOW2 = 82, // CDisplayText - EVENT_WINDOW3 = 83, // CStudio - EVENT_WINDOW4 = 84, // DisplayInfo - EVENT_WINDOW5 = 85, // setup - EVENT_WINDOW6 = 86, - EVENT_WINDOW7 = 87, - EVENT_WINDOW8 = 88, - EVENT_WINDOW9 = 89, // dialogue - - EVENT_LABEL0 = 90, - EVENT_LABEL1 = 91, - EVENT_LABEL2 = 92, - EVENT_LABEL3 = 93, - EVENT_LABEL4 = 94, - EVENT_LABEL5 = 95, - EVENT_LABEL6 = 96, - EVENT_LABEL7 = 97, - EVENT_LABEL8 = 98, - EVENT_LABEL9 = 99, - EVENT_LABEL10 = 100, - EVENT_LABEL11 = 101, - EVENT_LABEL12 = 102, - EVENT_LABEL13 = 103, - EVENT_LABEL14 = 104, - EVENT_LABEL15 = 105, - EVENT_LABEL16 = 106, - EVENT_LABEL17 = 107, - EVENT_LABEL18 = 108, - EVENT_LABEL19 = 109, - - EVENT_LIST0 = 110, - EVENT_LIST1 = 111, - EVENT_LIST2 = 112, - EVENT_LIST3 = 113, - EVENT_LIST4 = 114, - EVENT_LIST5 = 115, - EVENT_LIST6 = 116, - EVENT_LIST7 = 117, - EVENT_LIST8 = 118, - EVENT_LIST9 = 119, - - EVENT_TOOLTIP = 200, - - EVENT_DIALOG_OK = 300, - EVENT_DIALOG_CANCEL = 301, - EVENT_DIALOG_LABEL = 302, - EVENT_DIALOG_LABEL1 = 303, - EVENT_DIALOG_LABEL2 = 304, - EVENT_DIALOG_LABEL3 = 305, - EVENT_DIALOG_LIST = 306, - EVENT_DIALOG_EDIT = 307, - EVENT_DIALOG_CHECK1 = 308, - EVENT_DIALOG_CHECK2 = 309, - - EVENT_INTERFACE_TRAINER = 400, - EVENT_INTERFACE_DEFI = 401, - EVENT_INTERFACE_MISSION = 402, - EVENT_INTERFACE_FREE = 403, - EVENT_INTERFACE_PROTO = 404, - EVENT_INTERFACE_NAME = 405, - EVENT_INTERFACE_SETUP = 406, - EVENT_INTERFACE_QUIT = 407, - EVENT_INTERFACE_BACK = 408, - EVENT_INTERFACE_AGAIN = 409, - EVENT_INTERFACE_WRITE = 410, - EVENT_INTERFACE_READ = 411, - EVENT_INTERFACE_ABORT = 412, - EVENT_INTERFACE_USER = 413, - EVENT_INTERFACE_TEEN = 414, - - EVENT_INTERFACE_CHAP = 420, - EVENT_INTERFACE_LIST = 421, - EVENT_INTERFACE_RESUME = 422, - EVENT_INTERFACE_PLAY = 423, - - EVENT_INTERFACE_SETUPd = 430, - EVENT_INTERFACE_SETUPg = 431, - EVENT_INTERFACE_SETUPp = 432, - EVENT_INTERFACE_SETUPc = 433, - EVENT_INTERFACE_SETUPs = 434, - - EVENT_INTERFACE_DEVICE = 440, - EVENT_INTERFACE_RESOL = 441, - EVENT_INTERFACE_FULL = 442, - EVENT_INTERFACE_APPLY = 443, - - EVENT_INTERFACE_TOTO = 450, - EVENT_INTERFACE_SHADOW = 451, - EVENT_INTERFACE_DIRTY = 452, - EVENT_INTERFACE_LENS = 453, - EVENT_INTERFACE_SKY = 454, - EVENT_INTERFACE_PLANET = 456, - EVENT_INTERFACE_LIGHT = 457, - EVENT_INTERFACE_PARTI = 458, - EVENT_INTERFACE_CLIP = 459, - EVENT_INTERFACE_DETAIL = 460, - EVENT_INTERFACE_TEXTURE = 461, - EVENT_INTERFACE_RAIN = 462, - EVENT_INTERFACE_GLINT = 463, - EVENT_INTERFACE_TOOLTIP = 464, - EVENT_INTERFACE_MOVIES = 465, - EVENT_INTERFACE_NICERST = 466, - EVENT_INTERFACE_SCROLL = 467, - EVENT_INTERFACE_INVERTX = 468, - EVENT_INTERFACE_INVERTY = 469, - EVENT_INTERFACE_EFFECT = 470, - EVENT_INTERFACE_MOUSE = 471, - EVENT_INTERFACE_GROUND = 472, - EVENT_INTERFACE_GADGET = 473, - EVENT_INTERFACE_FOG = 474, - EVENT_INTERFACE_HIMSELF = 475, - EVENT_INTERFACE_EDITMODE= 476, - EVENT_INTERFACE_EDITVALUE= 477, - EVENT_INTERFACE_SOLUCE4 = 478, - - EVENT_INTERFACE_KINFO1 = 500, - EVENT_INTERFACE_KINFO2 = 501, - EVENT_INTERFACE_KGROUP = 502, - EVENT_INTERFACE_KSCROLL = 503, - EVENT_INTERFACE_KDEF = 504, - EVENT_INTERFACE_KLEFT = 505, - EVENT_INTERFACE_KRIGHT = 506, - EVENT_INTERFACE_KUP = 507, - EVENT_INTERFACE_KDOWN = 508, - EVENT_INTERFACE_KGUP = 509, - EVENT_INTERFACE_KGDOWN = 510, - EVENT_INTERFACE_KCAMERA = 511, - EVENT_INTERFACE_KDESEL = 512, - EVENT_INTERFACE_KACTION = 513, - EVENT_INTERFACE_KNEAR = 514, - EVENT_INTERFACE_KAWAY = 515, - EVENT_INTERFACE_KNEXT = 516, - EVENT_INTERFACE_KHUMAN = 517, - EVENT_INTERFACE_KQUIT = 518, - EVENT_INTERFACE_KHELP = 519, - EVENT_INTERFACE_KPROG = 520, - EVENT_INTERFACE_KCBOT = 521, - EVENT_INTERFACE_KVISIT = 522, - EVENT_INTERFACE_KSPEED10= 523, - EVENT_INTERFACE_KSPEED15= 524, - EVENT_INTERFACE_KSPEED20= 525, - EVENT_INTERFACE_KSPEED30= 526, - - EVENT_INTERFACE_VOLSOUND= 530, - EVENT_INTERFACE_VOLMUSIC= 531, - EVENT_INTERFACE_SOUND3D = 532, - - EVENT_INTERFACE_MIN = 540, - EVENT_INTERFACE_NORM = 541, - EVENT_INTERFACE_MAX = 542, - - EVENT_INTERFACE_SILENT = 550, - EVENT_INTERFACE_NOISY = 551, - - EVENT_INTERFACE_JOYSTICK= 560, - EVENT_INTERFACE_SOLUCE = 561, - - EVENT_INTERFACE_GLINTl = 570, - EVENT_INTERFACE_GLINTr = 571, - EVENT_INTERFACE_GLINTu = 572, - EVENT_INTERFACE_GLINTb = 573, - - EVENT_INTERFACE_NEDIT = 580, - EVENT_INTERFACE_NLIST = 581, - EVENT_INTERFACE_NOK = 582, - EVENT_INTERFACE_NCANCEL = 583, - EVENT_INTERFACE_NDELETE = 584, - EVENT_INTERFACE_NLABEL = 585, - - EVENT_INTERFACE_IOWRITE = 600, - EVENT_INTERFACE_IOREAD = 601, - EVENT_INTERFACE_IOLIST = 602, - EVENT_INTERFACE_IONAME = 603, - EVENT_INTERFACE_IOLABEL = 604, - EVENT_INTERFACE_IOIMAGE = 605, - EVENT_INTERFACE_IODELETE= 606, - - EVENT_INTERFACE_PERSO = 620, - EVENT_INTERFACE_POK = 621, - EVENT_INTERFACE_PCANCEL = 622, - EVENT_INTERFACE_PDEF = 623, - EVENT_INTERFACE_PHEAD = 624, - EVENT_INTERFACE_PBODY = 625, - EVENT_INTERFACE_PLROT = 626, - EVENT_INTERFACE_PRROT = 627, - EVENT_INTERFACE_PC0a = 640, - EVENT_INTERFACE_PC1a = 641, - EVENT_INTERFACE_PC2a = 642, - EVENT_INTERFACE_PC3a = 643, - EVENT_INTERFACE_PC4a = 644, - EVENT_INTERFACE_PC5a = 645, - EVENT_INTERFACE_PC6a = 646, - EVENT_INTERFACE_PC7a = 647, - EVENT_INTERFACE_PC8a = 648, - EVENT_INTERFACE_PC9a = 649, - EVENT_INTERFACE_PCRa = 650, - EVENT_INTERFACE_PCGa = 651, - EVENT_INTERFACE_PCBa = 652, - EVENT_INTERFACE_PC0b = 660, - EVENT_INTERFACE_PC1b = 661, - EVENT_INTERFACE_PC2b = 662, - EVENT_INTERFACE_PC3b = 663, - EVENT_INTERFACE_PC4b = 664, - EVENT_INTERFACE_PC5b = 665, - EVENT_INTERFACE_PC6b = 666, - EVENT_INTERFACE_PC7b = 667, - EVENT_INTERFACE_PC8b = 668, - EVENT_INTERFACE_PC9b = 669, - EVENT_INTERFACE_PCRb = 670, - EVENT_INTERFACE_PCGb = 671, - EVENT_INTERFACE_PCBb = 672, - EVENT_INTERFACE_PFACE1 = 680, - EVENT_INTERFACE_PFACE2 = 681, - EVENT_INTERFACE_PFACE3 = 682, - EVENT_INTERFACE_PFACE4 = 683, - EVENT_INTERFACE_PGLASS0 = 690, - EVENT_INTERFACE_PGLASS1 = 691, - EVENT_INTERFACE_PGLASS2 = 692, - EVENT_INTERFACE_PGLASS3 = 693, - EVENT_INTERFACE_PGLASS4 = 694, - EVENT_INTERFACE_PGLASS5 = 695, - EVENT_INTERFACE_PGLASS6 = 696, - EVENT_INTERFACE_PGLASS7 = 697, - EVENT_INTERFACE_PGLASS8 = 698, - EVENT_INTERFACE_PGLASS9 = 699, - - EVENT_DT_GROUP0 = 700, - EVENT_DT_GROUP1 = 701, - EVENT_DT_GROUP2 = 702, - EVENT_DT_GROUP3 = 703, - EVENT_DT_GROUP4 = 704, - EVENT_DT_LABEL0 = 710, - EVENT_DT_LABEL1 = 711, - EVENT_DT_LABEL2 = 712, - EVENT_DT_LABEL3 = 713, - EVENT_DT_LABEL4 = 714, - EVENT_DT_VISIT0 = 720, - EVENT_DT_VISIT1 = 721, - EVENT_DT_VISIT2 = 722, - EVENT_DT_VISIT3 = 723, - EVENT_DT_VISIT4 = 724, - EVENT_DT_END = 725, - - EVENT_CMD = 800, - EVENT_SPEED = 801, - - EVENT_HYPER_PREV = 900, - EVENT_HYPER_NEXT = 901, - EVENT_HYPER_HOME = 902, - EVENT_HYPER_COPY = 903, - EVENT_HYPER_SIZE1 = 904, - EVENT_HYPER_SIZE2 = 905, - EVENT_HYPER_SIZE3 = 906, - EVENT_HYPER_SIZE4 = 907, - EVENT_HYPER_SIZE5 = 908, - - EVENT_SATCOM_HUSTON = 920, - EVENT_SATCOM_SAT = 921, - EVENT_SATCOM_LOADING = 922, - EVENT_SATCOM_OBJECT = 923, - EVENT_SATCOM_PROG = 924, - EVENT_SATCOM_SOLUCE = 925, - - EVENT_OBJECT_DESELECT = 1000, - EVENT_OBJECT_LEFT = 1001, - EVENT_OBJECT_RIGHT = 1002, - EVENT_OBJECT_UP = 1003, - EVENT_OBJECT_DOWN = 1004, - EVENT_OBJECT_GASUP = 1005, - EVENT_OBJECT_GASDOWN = 1006, - EVENT_OBJECT_HTAKE = 1020, - EVENT_OBJECT_MTAKE = 1021, - EVENT_OBJECT_MFRONT = 1022, - EVENT_OBJECT_MBACK = 1023, - EVENT_OBJECT_MPOWER = 1024, - EVENT_OBJECT_BHELP = 1040, - EVENT_OBJECT_BTAKEOFF = 1041, - EVENT_OBJECT_BDERRICK = 1050, - EVENT_OBJECT_BSTATION = 1051, - EVENT_OBJECT_BFACTORY = 1052, - EVENT_OBJECT_BCONVERT = 1053, - EVENT_OBJECT_BTOWER = 1054, - EVENT_OBJECT_BREPAIR = 1055, - EVENT_OBJECT_BRESEARCH = 1056, - EVENT_OBJECT_BRADAR = 1057, - EVENT_OBJECT_BENERGY = 1058, - EVENT_OBJECT_BLABO = 1059, - EVENT_OBJECT_BNUCLEAR = 1060, - EVENT_OBJECT_BPARA = 1061, - EVENT_OBJECT_BINFO = 1062, - EVENT_OBJECT_BXXXX = 1063, - EVENT_OBJECT_GFLAT = 1070, - EVENT_OBJECT_FCREATE = 1071, - EVENT_OBJECT_FDELETE = 1072, - EVENT_OBJECT_FCOLORb = 1073, - EVENT_OBJECT_FCOLORr = 1074, - EVENT_OBJECT_FCOLORg = 1075, - EVENT_OBJECT_FCOLORy = 1076, - EVENT_OBJECT_FCOLORv = 1077, - EVENT_OBJECT_FACTORYwa = 1080, - EVENT_OBJECT_FACTORYta = 1081, - EVENT_OBJECT_FACTORYfa = 1082, - EVENT_OBJECT_FACTORYia = 1083, - EVENT_OBJECT_FACTORYwc = 1084, - EVENT_OBJECT_FACTORYtc = 1085, - EVENT_OBJECT_FACTORYfc = 1086, - EVENT_OBJECT_FACTORYic = 1087, - EVENT_OBJECT_FACTORYwi = 1088, - EVENT_OBJECT_FACTORYti = 1089, - EVENT_OBJECT_FACTORYfi = 1090, - EVENT_OBJECT_FACTORYii = 1091, - EVENT_OBJECT_FACTORYws = 1092, - EVENT_OBJECT_FACTORYts = 1093, - EVENT_OBJECT_FACTORYfs = 1094, - EVENT_OBJECT_FACTORYis = 1095, - EVENT_OBJECT_FACTORYrt = 1096, - EVENT_OBJECT_FACTORYrc = 1097, - EVENT_OBJECT_FACTORYrr = 1098, - EVENT_OBJECT_FACTORYrs = 1099, - EVENT_OBJECT_FACTORYsa = 1100, - EVENT_OBJECT_SEARCH = 1200, - EVENT_OBJECT_TERRAFORM = 1201, - EVENT_OBJECT_FIRE = 1202, - EVENT_OBJECT_FIREANT = 1203, - EVENT_OBJECT_RECOVER = 1220, - EVENT_OBJECT_BEGSHIELD = 1221, - EVENT_OBJECT_ENDSHIELD = 1222, - EVENT_OBJECT_RTANK = 1223, - EVENT_OBJECT_RFLY = 1224, - EVENT_OBJECT_RTHUMP = 1225, - EVENT_OBJECT_RCANON = 1226, - EVENT_OBJECT_RTOWER = 1227, - EVENT_OBJECT_RPHAZER = 1228, - EVENT_OBJECT_RSHIELD = 1229, - EVENT_OBJECT_RATOMIC = 1230, - EVENT_OBJECT_RiPAW = 1231, - EVENT_OBJECT_RiGUN = 1232, - EVENT_OBJECT_RESET = 1233, - EVENT_OBJECT_DIMSHIELD = 1234, - EVENT_OBJECT_TARGET = 1235, - EVENT_OBJECT_PROGLIST = 1310, - EVENT_OBJECT_PROGRUN = 1311, - EVENT_OBJECT_PROGEDIT = 1312, - EVENT_OBJECT_PROGSTART = 1313, - EVENT_OBJECT_PROGSTOP = 1314, - EVENT_OBJECT_INFOOK = 1340, - EVENT_OBJECT_DELETE = 1350, - EVENT_OBJECT_GENERGY = 1360, - EVENT_OBJECT_GSHIELD = 1361, - EVENT_OBJECT_GRANGE = 1362, - EVENT_OBJECT_COMPASS = 1363, - EVENT_OBJECT_MAP = 1364, - EVENT_OBJECT_MAPZOOM = 1365, - EVENT_OBJECT_GPROGRESS = 1366, - EVENT_OBJECT_GRADAR = 1367, - EVENT_OBJECT_GINFO = 1368, - EVENT_OBJECT_TYPE = 1369, - EVENT_OBJECT_CROSSHAIR = 1370, - EVENT_OBJECT_CORNERul = 1371, - EVENT_OBJECT_CORNERur = 1372, - EVENT_OBJECT_CORNERdl = 1373, - EVENT_OBJECT_CORNERdr = 1374, - EVENT_OBJECT_MAPi = 1375, - EVENT_OBJECT_MAPg = 1376, - EVENT_OBJECT_CAMERA = 1400, - EVENT_OBJECT_HELP = 1401, - EVENT_OBJECT_SOLUCE = 1402, - EVENT_OBJECT_CAMERAleft = 1403, - EVENT_OBJECT_CAMERAright= 1404, - EVENT_OBJECT_CAMERAnear = 1405, - EVENT_OBJECT_CAMERAaway = 1406, - EVENT_OBJECT_SHORTCUT00 = 1500, - EVENT_OBJECT_SHORTCUT01 = 1501, - EVENT_OBJECT_SHORTCUT02 = 1502, - EVENT_OBJECT_SHORTCUT03 = 1503, - EVENT_OBJECT_SHORTCUT04 = 1504, - EVENT_OBJECT_SHORTCUT05 = 1505, - EVENT_OBJECT_SHORTCUT06 = 1506, - EVENT_OBJECT_SHORTCUT07 = 1507, - EVENT_OBJECT_SHORTCUT08 = 1508, - EVENT_OBJECT_SHORTCUT09 = 1509, - EVENT_OBJECT_SHORTCUT10 = 1510, - EVENT_OBJECT_SHORTCUT11 = 1511, - EVENT_OBJECT_SHORTCUT12 = 1512, - EVENT_OBJECT_SHORTCUT13 = 1513, - EVENT_OBJECT_SHORTCUT14 = 1514, - EVENT_OBJECT_SHORTCUT15 = 1515, - EVENT_OBJECT_SHORTCUT16 = 1516, - EVENT_OBJECT_SHORTCUT17 = 1517, - EVENT_OBJECT_SHORTCUT18 = 1518, - EVENT_OBJECT_SHORTCUT19 = 1519, - EVENT_OBJECT_MOVIELOCK = 1550, - EVENT_OBJECT_EDITLOCK = 1551, - EVENT_OBJECT_LIMIT = 1560, - - EVENT_OBJECT_PEN0 = 1570, - EVENT_OBJECT_PEN1 = 1571, - EVENT_OBJECT_PEN2 = 1572, - EVENT_OBJECT_PEN3 = 1573, - EVENT_OBJECT_PEN4 = 1574, - EVENT_OBJECT_PEN5 = 1575, - EVENT_OBJECT_PEN6 = 1576, - EVENT_OBJECT_PEN7 = 1577, - EVENT_OBJECT_PEN8 = 1578, - EVENT_OBJECT_REC = 1580, - EVENT_OBJECT_STOP = 1581, - - EVENT_STUDIO_OK = 2000, - EVENT_STUDIO_CANCEL = 2001, - EVENT_STUDIO_EDIT = 2002, - EVENT_STUDIO_LIST = 2003, - EVENT_STUDIO_NEW = 2010, - EVENT_STUDIO_OPEN = 2011, - EVENT_STUDIO_SAVE = 2012, - EVENT_STUDIO_UNDO = 2013, - EVENT_STUDIO_CUT = 2014, - EVENT_STUDIO_COPY = 2015, - EVENT_STUDIO_PASTE = 2016, - EVENT_STUDIO_SIZE = 2017, - EVENT_STUDIO_TOOL = 2018, - EVENT_STUDIO_HELP = 2019, - EVENT_STUDIO_COMPILE = 2050, - EVENT_STUDIO_RUN = 2051, - EVENT_STUDIO_REALTIME = 2052, - EVENT_STUDIO_STEP = 2053, - - EVENT_USER = 10000, - EVENT_FORCE_LONG = 0x7fffffff -}; diff --git a/src/common/global.h b/src/common/global.h index 579db7d..2d57ee0 100644 --- a/src/common/global.h +++ b/src/common/global.h @@ -21,7 +21,143 @@ #pragma once -#include "error_ids.h" + +/** + * \enum Error + * \brief Type of error or info message + */ +enum Error +{ + ERR_OK = 0, //! < ok + ERR_GENERIC = 1, //! < any error + ERR_CONTINUE = 2, //! < continues + ERR_STOP = 3, //! < stops + ERR_CMD = 4, //! < unknown command + ERR_MANIP_VEH = 100, //! < inappropriate vehicle + ERR_MANIP_FLY = 101, //! < impossible in flight + ERR_MANIP_BUSY = 102, //! < taking: hands already occupied + ERR_MANIP_NIL = 103, //! < taking: nothing has to take + ERR_MANIP_MOTOR = 105, //! < busy: impossible to move + ERR_MANIP_OCC = 106, //! < busy: location already occupied + ERR_MANIP_FRIEND = 107, //! < no other vehicle + ERR_MANIP_RADIO = 108, //! < impossible because radioactive + ERR_MANIP_WATER = 109, //! < not possible under water + ERR_MANIP_EMPTY = 110, //! < nothing to deposit + ERR_BUILD_FLY = 120, //! < not possible in flight + ERR_BUILD_WATER = 121, //! < not possible under water + ERR_BUILD_ENERGY = 122, //! < not enough energy + ERR_BUILD_METALAWAY = 123, //! < lack of metal (too far) + ERR_BUILD_METALNEAR = 124, //! < lack of metal (too close) + ERR_BUILD_METALINEX = 125, //! < lack of metal + ERR_BUILD_FLAT = 126, //! < not enough flat ground + ERR_BUILD_FLATLIT = 127, //! < not enough flat ground space + ERR_BUILD_BUSY = 128, //! < location occupied + ERR_BUILD_BASE = 129, //! < too close to the rocket + ERR_BUILD_NARROW = 130, //! < buildings too close + ERR_BUILD_MOTOR = 131, //! < built: not possible in movement + ERR_SEARCH_FLY = 140, //! < not possible in flight + ERR_SEARCH_VEH = 141, //! < inappropriate vehicle + ERR_SEARCH_MOTOR = 142, //! < impossible in movement + ERR_TERRA_VEH = 150, //! < inappropriate vehicle + ERR_TERRA_ENERGY = 151, //! < not enough energy + ERR_TERRA_FLOOR = 152, //! < inappropriate ground + ERR_TERRA_BUILDING = 153, //! < building too close + ERR_TERRA_OBJECT = 154, //! < object too close + ERR_FIRE_VEH = 160, //! < inappropriate vehicle + ERR_FIRE_ENERGY = 161, //! < not enough energy + ERR_FIRE_FLY = 162, //! < not possible in flight + ERR_RECOVER_VEH = 170, //! < inappropriate vehicle + ERR_RECOVER_ENERGY = 171, //! < not enough energy + ERR_RECOVER_NULL = 172, //! < lack of ruin + ERR_CONVERT_EMPTY = 180, //! < no stone was transformed + ERR_SHIELD_VEH = 190, //! < inappropriate vehicle + ERR_SHIELD_ENERGY = 191, //! < not enough energy + ERR_MOVE_IMPOSSIBLE = 200, //! < move impossible + ERR_FIND_IMPOSSIBLE = 201, //! < find impossible + ERR_GOTO_IMPOSSIBLE = 210, //! < goto impossible + ERR_GOTO_ITER = 211, //! < goto too complicated + ERR_GOTO_BUSY = 212, //! < goto destination occupied + ERR_DERRICK_NULL = 300, //! < no ore underground + ERR_STATION_NULL = 301, //! < no energy underground + ERR_TOWER_POWER = 310, //! < no battery + ERR_TOWER_ENERGY = 311, //! < more energy + ERR_RESEARCH_POWER = 320, //! < no battery + ERR_RESEARCH_ENERGY = 321, //! < more energy + ERR_RESEARCH_TYPE = 322, //! < the wrong type of battery + ERR_RESEARCH_ALREADY = 323, //! < research already done + ERR_ENERGY_NULL = 330, //! < no energy underground + ERR_ENERGY_LOW = 331, //! < not enough energy + ERR_ENERGY_EMPTY = 332, //! < lack of metal + ERR_ENERGY_BAD = 333, //! < transforms only the metal + ERR_BASE_DLOCK = 340, //! < doors locked + ERR_BASE_DHUMAN = 341, //! < you must be on spaceship + ERR_LABO_NULL = 350, //! < nothing to analyze + ERR_LABO_BAD = 351, //! < analyzes only organic ball + ERR_LABO_ALREADY = 352, //! < analysis already made + ERR_NUCLEAR_NULL = 360, //! < no energy underground + ERR_NUCLEAR_LOW = 361, //! < not enough energy + ERR_NUCLEAR_EMPTY = 362, //! < lack of uranium + ERR_NUCLEAR_BAD = 363, //! < transforms only uranium + ERR_FACTORY_NULL = 370, //! < no metal + ERR_FACTORY_NEAR = 371, //! < vehicle too close + ERR_RESET_NEAR = 380, //! < vehicle too close + ERR_INFO_NULL = 390, //! < no information terminal + ERR_VEH_VIRUS = 400, //! < vehicle infected by a virus + ERR_BAT_VIRUS = 401, //! < building infected by a virus + ERR_VEH_POWER = 500, //! < no battery + ERR_VEH_ENERGY = 501, //! < more energy + ERR_FLAG_FLY = 510, //! < impossible in flight + ERR_FLAG_WATER = 511, //! < impossible during swimming + ERR_FLAG_MOTOR = 512, //! < impossible in movement + ERR_FLAG_BUSY = 513, //! < taking: already creating flag + ERR_FLAG_CREATE = 514, //! < too many flags + ERR_FLAG_PROXY = 515, //! < too close + ERR_FLAG_DELETE = 516, //! < nothing to remove + ERR_MISSION_NOTERM = 600, //! < Mission not completed + ERR_DELETEMOBILE = 700, //! < vehicle destroyed + ERR_DELETEBUILDING = 701, //! < building destroyed + ERR_TOOMANY = 702, //! < too many objects + ERR_OBLIGATORYTOKEN = 800, //! < compulsory instruction missing + ERR_PROHIBITEDTOKEN = 801, //! < instruction prohibited + + INFO_FIRST = 10000, //! < first information + INFO_BUILD = 10001, //! < construction builded + INFO_CONVERT = 10002, //! < metal available + INFO_RESEARCH = 10003, //! < search ended + INFO_FACTORY = 10004, //! < vehicle manufactured + INFO_LABO = 10005, //! < analysis ended + INFO_ENERGY = 10006, //! < battery available + INFO_NUCLEAR = 10007, //! < nuclear battery available + INFO_FINDING = 10008, //! < nuclear battery available + INFO_MARKPOWER = 10020, //! < location for station found + INFO_MARKURANIUM = 10021, //! < location for derrick found + INFO_MARKSTONE = 10022, //! < location for derrick found + INFO_MARKKEYa = 10023, //! < location for derrick found + INFO_MARKKEYb = 10024, //! < location for derrick found + INFO_MARKKEYc = 10025, //! < location for derrick found + INFO_MARKKEYd = 10026, //! < location for derrick found + INFO_RESEARCHTANK = 10030, //! < research ended + INFO_RESEARCHFLY = 10031, //! < research ended + INFO_RESEARCHTHUMP = 10032, //! < research ended + INFO_RESEARCHCANON = 10033, //! < research ended + INFO_RESEARCHTOWER = 10034, //! < research ended + INFO_RESEARCHPHAZER = 10035, //! < research ended + INFO_RESEARCHSHIELD = 10036, //! < research ended + INFO_RESEARCHATOMIC = 10037, //! < research ended + INFO_WIN = 10040, //! < win + INFO_LOST = 10041, //! < lost + INFO_LOSTq = 10042, //! < lost immediately + INFO_WRITEOK = 10043, //! < record done + INFO_DELETEPATH = 10050, //! < way mark deleted + INFO_DELETEMOTHER = 10100, //! < insect killed + INFO_DELETEANT = 10101, //! < insect killed + INFO_DELETEBEE = 10102, //! < insect killed + INFO_DELETEWORM = 10103, //! < insect killed + INFO_DELETESPIDER = 10104, //! < insect killed + INFO_BEGINSATCOM = 10105, //! < use your SatCom + + ERR_MAX //! < number of values +}; /** * \enum Language @@ -56,6 +192,7 @@ enum DataDir DIR_MAX //! < number of dirs }; + /** * \enum BuildType * \brief Construction actions (buildings, etc.) available to user diff --git a/src/common/image.cpp b/src/common/image.cpp index adb8ce7..f3cfa34 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -14,9 +14,8 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// image.cpp -#include "image.h" +#include "common/image.h" #include <stdlib.h> #include <stdio.h> diff --git a/src/common/image.h b/src/common/image.h index 54bbd3d..d23a6fa 100644 --- a/src/common/image.h +++ b/src/common/image.h @@ -21,7 +21,9 @@ #pragma once + #include "graphics/core/color.h" + #include "math/intpoint.h" #include <stddef.h> diff --git a/src/common/iman.cpp b/src/common/iman.cpp index e59afb1..6a0a9eb 100644 --- a/src/common/iman.cpp +++ b/src/common/iman.cpp @@ -14,7 +14,6 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// iman.cpp #include "common/iman.h" diff --git a/src/common/iman.h b/src/common/iman.h index 75655aa..53caed7 100644 --- a/src/common/iman.h +++ b/src/common/iman.h @@ -15,14 +15,14 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. /** - * \file iman.h + * \file common/iman.h * \brief Instance manager for managed classes */ #pragma once -#include <common/singleton.h> -#include <common/misc.h> + +#include "common/singleton.h" /** diff --git a/src/common/ioutils.h b/src/common/ioutils.h index e7668eb..9a94617 100644 --- a/src/common/ioutils.h +++ b/src/common/ioutils.h @@ -15,7 +15,7 @@ // * along with this program. If not, see http://www.gnu.org/licenses/. /** - * \file ioutils.h + * \file common/ioutils.h * \brief Functions for binary I/O */ diff --git a/src/common/key.h b/src/common/key.h index 11076a3..196f66d 100644 --- a/src/common/key.h +++ b/src/common/key.h @@ -14,7 +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/. -// key.h +/** + * \file common/key.h + * \brief Key-related macros and enums + */ #pragma once diff --git a/src/common/logger.cpp b/src/common/logger.cpp index ed8df8c..5a78433 100644 --- a/src/common/logger.cpp +++ b/src/common/logger.cpp @@ -14,9 +14,8 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// logger.cpp -#include <common/logger.h> +#include "common/logger.h" #include <stdio.h> diff --git a/src/common/logger.h b/src/common/logger.h index dfeeb98..198e5e5 100644 --- a/src/common/logger.h +++ b/src/common/logger.h @@ -19,9 +19,9 @@ * \brief Class for logging information to file or console */ - #pragma once + #include "common/singleton.h" #include <string> @@ -58,48 +58,48 @@ class CLogger : public CSingleton<CLogger> ~CLogger(); /** Write message to console or file - * @param str - message to write - * @param ... - additional arguments + * \param str - message to write + * \param ... - additional arguments */ void Message(const char *str, ...); /** Write message to console or file with LOG_TRACE level - * @param str - message to write - * @param ... - additional arguments + * \param str - message to write + * \param ... - additional arguments */ void Trace(const char *str, ...); /** Write message to console or file with LOG_DEBUG level - * @param str - message to write - * @param ... - additional arguments + * \param str - message to write + * \param ... - additional arguments */ void Debug(const char *str, ...); /** Write message to console or file with LOG_INFO level - * @param str - message to write - * @param ... - additional arguments + * \param str - message to write + * \param ... - additional arguments */ void Info(const char *str, ...); /** Write message to console or file with LOG_WARN level - * @param str - message to write - * @param ... - additional arguments + * \param str - message to write + * \param ... - additional arguments */ void Warn(const char *str, ...); /** Write message to console or file with LOG_ERROR level - * @param str - message to write - * @param ... - additional arguments + * \param str - message to write + * \param ... - additional arguments */ void Error(const char *str, ...); /** Set output file to write logs to - * @param filename - output file to write to + * \param filename - output file to write to */ void SetOutputFile(std::string filename); /** Set log level. Logs with level below will not be shown - * @param level - minimum log level to write + * \param level - minimum log level to write */ void SetLogLevel(LogType level); diff --git a/src/common/misc.cpp b/src/common/misc.cpp index 2ed6e2c..2bce3b8 100644 --- a/src/common/misc.cpp +++ b/src/common/misc.cpp @@ -14,8 +14,6 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// misc.cpp - #include "common/misc.h" diff --git a/src/common/misc.h b/src/common/misc.h index f6fd609..f210706 100644 --- a/src/common/misc.h +++ b/src/common/misc.h @@ -14,7 +14,6 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// misc.h #pragma once @@ -22,20 +21,6 @@ #include <time.h> -// TODO: to be removed (replaced by TrackedKey enum and mouse states in app.h) -const int KS_PAGEUP = (1<<4); -const int KS_PAGEDOWN = (1<<5); -const int KS_SHIFT = (1<<6); -const int KS_CONTROL = (1<<7); -const int KS_MLEFT = (1<<8); -const int KS_MRIGHT = (1<<9); -const int KS_NUMUP = (1<<10); -const int KS_NUMDOWN = (1<<11); -const int KS_NUMLEFT = (1<<12); -const int KS_NUMRIGHT = (1<<13); -const int KS_NUMPLUS = (1<<14); -const int KS_NUMMINUS = (1<<15); - // TODO: rewrite/refactor or remove extern char GetNoAccent(char letter); diff --git a/src/common/profile.cpp b/src/common/profile.cpp index 2c78f9f..5432489 100644 --- a/src/common/profile.cpp +++ b/src/common/profile.cpp @@ -14,10 +14,9 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// profile.cpp - #include "common/profile.h" + #include "common/logger.h" #include <utility> diff --git a/src/common/profile.h b/src/common/profile.h index facb414..9bc6c37 100644 --- a/src/common/profile.h +++ b/src/common/profile.h @@ -21,18 +21,19 @@ #pragma once -#include <boost/property_tree/ptree.hpp> #include "common/singleton.h" +#include <boost/property_tree/ptree.hpp> + #include <string> #include <vector> /** -* @class CProfile +* \class CProfile * -* @brief Class for loading profile (currently for loading ini config file) +* \brief Class for loading profile (currently for loading ini config file) * */ class CProfile : public CSingleton<CProfile> @@ -42,62 +43,62 @@ class CProfile : public CSingleton<CProfile> ~CProfile(); /** Loads colobot.ini from current directory - * @return return true on success + * \return return true on success */ bool InitCurrentDirectory(); /** Sets string value in section under specified key - * @param std::string section - * @param std::string key - * @param std::string value - * @return return true on success + * \param section + * \param key + * \param value + * \return return true on success */ bool SetLocalProfileString(std::string section, std::string key, std::string value); /** Gets string value in section under specified key - * @param std::string section - * @param std::string key - * @param std::string& buffer - * @return return true on success + * \param section + * \param key + * \param buffer + * \return return true on success */ bool GetLocalProfileString(std::string section, std::string key, std::string& buffer); /** Sets int value in section under specified key - * @param std::string section - * @param std::string key - * @param int value - * @return return true on success + * \param section + * \param key + * \param value + * \return return true on success */ bool SetLocalProfileInt(std::string section, std::string key, int value); /** Gets int value in section under specified key - * @param std::string section - * @param std::string key - * @param int& value - * @return return true on success + * \param section + * \param key + * \param value + * \return return true on success */ bool GetLocalProfileInt(std::string section, std::string key, int &value); /** Sets float value in section under specified key - * @param std::string section - * @param std::string key - * @param float value - * @return return true on success + * \param section + * \param key + * \param value + * \return return true on success */ bool SetLocalProfileFloat(std::string section, std::string key, float value); /** Gets float value in section under specified key - * @param std::string section - * @param std::string key - * @param float& value - * @return return true on success + * \param section + * \param key + * \param value + * \return return true on success */ bool GetLocalProfileFloat(std::string section, std::string key, float &value); /** Gets all values in section under specified key - * @param std::string section - * @param std::string key - * @return vector of values + * \param section + * \param key + * \return vector of values */ std::vector< std::string > GetLocalProfileSection(std::string section, std::string key); diff --git a/src/common/restext.cpp b/src/common/restext.cpp index 0f33f52..da06131 100644 --- a/src/common/restext.cpp +++ b/src/common/restext.cpp @@ -12,7 +12,8 @@ // * GNU General Public License for more details. // * // * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/.// restext.cpp +// * along with this program. If not, see http://www.gnu.org/licenses/. + #include "common/restext.h" @@ -20,13 +21,707 @@ #include "common/event.h" #include "common/logger.h" #include "common/stringutils.h" + #include "CBot/resource.h" + #include "object/object.h" #include "object/robotmain.h" #include <libintl.h> #include <SDL/SDL_keyboard.h> +const char* stringsText[RT_MAX] = { nullptr }; +const char* stringsEvent[EVENT_STD_MAX] = { nullptr }; +const char* stringsObject[OBJECT_MAX] = { nullptr }; +const char* stringsErr[ERR_MAX] = { nullptr }; +const char* stringsCbot[TX_MAX] = { nullptr }; + + +void InitializeRestext() +{ + stringsText[RT_VERSION_ID] = "Colobot Gold"; + + stringsText[RT_DISINFO_TITLE] = "SatCom"; + stringsText[RT_WINDOW_MAXIMIZED] = "Maximize"; + stringsText[RT_WINDOW_MINIMIZED] = "Minimize"; + stringsText[RT_WINDOW_STANDARD] = "Normal size"; + stringsText[RT_WINDOW_CLOSE] = "Close"; + + stringsText[RT_STUDIO_TITLE] = "Program editor"; + stringsText[RT_SCRIPT_NEW] = "New"; + stringsText[RT_NAME_DEFAULT] = "Player"; + stringsText[RT_IO_NEW] = "New ..."; + stringsText[RT_KEY_OR] = " or "; + + stringsText[RT_TITLE_BASE] = "COLOBOT"; + stringsText[RT_TITLE_INIT] = "COLOBOT"; + stringsText[RT_TITLE_TRAINER] = "Programming exercises"; + stringsText[RT_TITLE_DEFI] = "Challenges"; + stringsText[RT_TITLE_MISSION] = "Missions"; + stringsText[RT_TITLE_FREE] = "Free game"; + stringsText[RT_TITLE_TEEN] = "Free game"; + stringsText[RT_TITLE_USER] = "User levels"; + stringsText[RT_TITLE_PROTO] = "Prototypes"; + stringsText[RT_TITLE_SETUP] = "Options"; + stringsText[RT_TITLE_NAME] = "Player's name"; + stringsText[RT_TITLE_PERSO] = "Customize your appearance"; + stringsText[RT_TITLE_WRITE] = "Save the current mission"; + stringsText[RT_TITLE_READ] = "Load a saved mission"; + + stringsText[RT_PLAY_CHAPt] = " Chapters:"; + stringsText[RT_PLAY_CHAPd] = " Chapters:"; + stringsText[RT_PLAY_CHAPm] = " Planets:"; + stringsText[RT_PLAY_CHAPf] = " Planets:"; + stringsText[RT_PLAY_CHAPu] = " User levels:"; + stringsText[RT_PLAY_CHAPp] = " Planets:"; + stringsText[RT_PLAY_CHAPte] = " Chapters:"; + stringsText[RT_PLAY_LISTt] = " Exercises in the chapter:"; + stringsText[RT_PLAY_LISTd] = " Challenges in the chapter:"; + stringsText[RT_PLAY_LISTm] = " Missions on this planet:"; + stringsText[RT_PLAY_LISTf] = " Free game on this planet:"; + stringsText[RT_PLAY_LISTu] = " Missions on this level:"; + stringsText[RT_PLAY_LISTp] = " Prototypes on this planet:"; + stringsText[RT_PLAY_LISTk] = " Free game on this chapter:"; + stringsText[RT_PLAY_RESUME] = " Summary:"; + + stringsText[RT_SETUP_DEVICE] = " Drivers:"; + stringsText[RT_SETUP_MODE] = " Resolution:"; + stringsText[RT_SETUP_KEY1] = "1) First click on the key you want to redefine."; + stringsText[RT_SETUP_KEY2] = "2) Then press the key you want to use instead."; + + stringsText[RT_PERSO_FACE] = "Face type:"; + stringsText[RT_PERSO_GLASSES] = "Eyeglasses:"; + stringsText[RT_PERSO_HAIR] = "Hair color:"; + stringsText[RT_PERSO_COMBI] = "Suit color:"; + stringsText[RT_PERSO_BAND] = "Strip color:"; + + stringsText[RT_DIALOG_QUIT] = "Do you want to quit COLOBOT ?"; + stringsText[RT_DIALOG_TITLE] = "COLOBOT"; + stringsText[RT_DIALOG_YESQUIT] = "Quit\\Quit COLOBOT"; + stringsText[RT_DIALOG_ABORT] = "Quit the mission?"; + stringsText[RT_DIALOG_YES] = "Abort\\Abort the current mission"; + stringsText[RT_DIALOG_NO] = "Continue\\Continue the current mission"; + stringsText[RT_DIALOG_NOQUIT] = "Continue\\Continue the game"; + stringsText[RT_DIALOG_DELOBJ] = "Do you really want to destroy the selected building?"; + stringsText[RT_DIALOG_DELGAME] = "Do you want to delete %s's saved games? "; + stringsText[RT_DIALOG_YESDEL] = "Delete"; + stringsText[RT_DIALOG_NODEL] = "Cancel"; + stringsText[RT_DIALOG_LOADING] = "LOADING"; + + stringsText[RT_STUDIO_LISTTT] = "Keyword help(\\key cbot;)"; + stringsText[RT_STUDIO_COMPOK] = "Compilation ok (0 errors)"; + stringsText[RT_STUDIO_PROGSTOP] = "Program finished"; + + stringsText[RT_SATCOM_LIST] = "\\b;List of objects\n"; + stringsText[RT_SATCOM_BOT] = "\\b;Robots\n"; + stringsText[RT_SATCOM_BUILDING] = "\\b;Buildings\n"; + stringsText[RT_SATCOM_FRET] = "\\b;Moveable objects\n"; + stringsText[RT_SATCOM_ALIEN] = "\\b;Aliens\n"; + stringsText[RT_SATCOM_NULL] = "\\c; (none)\\n;\n"; + stringsText[RT_SATCOM_ERROR1] = "\\b;Error\n"; + stringsText[RT_SATCOM_ERROR2] = "The list is only available if a \\l;radar station\\u object\\radar; is working.\n"; + + stringsText[RT_IO_OPEN] = "Open"; + stringsText[RT_IO_SAVE] = "Save"; + stringsText[RT_IO_LIST] = "Folder: %s"; + stringsText[RT_IO_NAME] = "Name:"; + stringsText[RT_IO_DIR] = "Folder:"; + stringsText[RT_IO_PRIVATE] = "Private\\Private folder"; + stringsText[RT_IO_PUBLIC] = "Public\\Common folder"; + + stringsText[RT_GENERIC_DEV1] = "Developed by :"; + stringsText[RT_GENERIC_DEV2] = "www.epsitec.com"; + stringsText[RT_GENERIC_EDIT1] = " "; + stringsText[RT_GENERIC_EDIT2] = " "; + + stringsText[RT_INTERFACE_REC] = "Recorder"; + + + + stringsEvent[EVENT_BUTTON_OK] = "OK"; + stringsEvent[EVENT_BUTTON_CANCEL] = "Cancel"; + stringsEvent[EVENT_BUTTON_NEXT] = "Next"; + stringsEvent[EVENT_BUTTON_PREV] = "Previous"; + stringsEvent[EVENT_BUTTON_QUIT] = "Menu (\\key quit;)"; + + stringsEvent[EVENT_DIALOG_OK] = "OK"; + stringsEvent[EVENT_DIALOG_CANCEL] = "Cancel"; + + stringsEvent[EVENT_INTERFACE_TRAINER] = "Exercises\\Programming exercises"; + stringsEvent[EVENT_INTERFACE_DEFI] = "Challenges\\Programming challenges"; + stringsEvent[EVENT_INTERFACE_MISSION] = "Missions\\Select mission"; + stringsEvent[EVENT_INTERFACE_FREE] = "Free game\\Free game without a specific goal"; + stringsEvent[EVENT_INTERFACE_TEEN] = "Free game\\Free game without a specific goal"; + stringsEvent[EVENT_INTERFACE_USER] = "User\\User levels"; + stringsEvent[EVENT_INTERFACE_PROTO] = "Proto\\Prototypes under development"; + stringsEvent[EVENT_INTERFACE_NAME] = "New player\\Choose player's name"; + stringsEvent[EVENT_INTERFACE_SETUP] = "Options\\Preferences"; + stringsEvent[EVENT_INTERFACE_AGAIN] = "Restart\\Restart the mission from the beginning"; + stringsEvent[EVENT_INTERFACE_WRITE] = "Save\\Save the current mission "; + stringsEvent[EVENT_INTERFACE_READ] = "Load\\Load a saved mission"; + stringsEvent[EVENT_INTERFACE_ABORT] = "\\Return to COLOBOT"; + stringsEvent[EVENT_INTERFACE_QUIT] = "Quit\\Quit COLOBOT"; + stringsEvent[EVENT_INTERFACE_BACK] = "<< Back \\Back to the previous screen"; + stringsEvent[EVENT_INTERFACE_PLAY] = "Play\\Start mission!"; + stringsEvent[EVENT_INTERFACE_SETUPd] = "Device\\Driver and resolution settings"; + stringsEvent[EVENT_INTERFACE_SETUPg] = "Graphics\\Graphics settings"; + stringsEvent[EVENT_INTERFACE_SETUPp] = "Game\\Game settings"; + stringsEvent[EVENT_INTERFACE_SETUPc] = "Controls\\Keyboard, joystick and mouse settings"; + stringsEvent[EVENT_INTERFACE_SETUPs] = "Sound\\Music and game sound volume"; + stringsEvent[EVENT_INTERFACE_DEVICE] = "Unit"; + stringsEvent[EVENT_INTERFACE_RESOL] = "Resolution"; + stringsEvent[EVENT_INTERFACE_FULL] = "Full screen\\Full screen or window mode"; + stringsEvent[EVENT_INTERFACE_APPLY] = "Apply changes\\Activates the changed settings"; + + stringsEvent[EVENT_INTERFACE_TOTO] = "Robbie\\Your assistant"; + stringsEvent[EVENT_INTERFACE_SHADOW] = "Shadows\\Shadows on the ground"; + stringsEvent[EVENT_INTERFACE_GROUND] = "Marks on the ground\\Marks on the ground"; + stringsEvent[EVENT_INTERFACE_DIRTY] = "Dust\\Dust and dirt on bots and buildings"; + stringsEvent[EVENT_INTERFACE_FOG] = "Fog\\Fog"; + stringsEvent[EVENT_INTERFACE_LENS] = "Sunbeams\\Sunbeams in the sky"; + stringsEvent[EVENT_INTERFACE_SKY] = "Sky\\Clouds and nebulae"; + stringsEvent[EVENT_INTERFACE_PLANET] = "Planets and stars\\Astronomical objects in the sky"; + stringsEvent[EVENT_INTERFACE_LIGHT] = "Dynamic lighting\\Mobile light sources"; + stringsEvent[EVENT_INTERFACE_PARTI] = "Number of particles\\Explosions, dust, reflections, etc."; + stringsEvent[EVENT_INTERFACE_CLIP] = "Depth of field\\Maximum visibility"; + stringsEvent[EVENT_INTERFACE_DETAIL] = "Details\\Visual quality of 3D objects"; + stringsEvent[EVENT_INTERFACE_TEXTURE] = "Textures\\Quality of textures "; + stringsEvent[EVENT_INTERFACE_GADGET] = "Num of decorative objects\\Number of purely ornamental objects"; + stringsEvent[EVENT_INTERFACE_RAIN] = "Particles in the interface\\Steam clouds and sparks in the interface"; + stringsEvent[EVENT_INTERFACE_GLINT] = "Reflections on the buttons \\Shiny buttons"; + stringsEvent[EVENT_INTERFACE_TOOLTIP] = "Help balloons\\Explain the function of the buttons"; + stringsEvent[EVENT_INTERFACE_MOVIES] = "Film sequences\\Films before and after the missions"; + stringsEvent[EVENT_INTERFACE_NICERST] = "Exit film\\Film at the exit of exercises"; + stringsEvent[EVENT_INTERFACE_HIMSELF] = "Friendly fire\\Your shooting can damage your own objects "; + stringsEvent[EVENT_INTERFACE_SCROLL] = "Scrolling\\Scrolling when the mouse touches right or left border"; + stringsEvent[EVENT_INTERFACE_INVERTX] = "Mouse inversion X\\Inversion of the scrolling direction on the X axis"; + stringsEvent[EVENT_INTERFACE_INVERTY] = "Mouse inversion Y\\Inversion of the scrolling direction on the Y axis"; + stringsEvent[EVENT_INTERFACE_EFFECT] = "Quake at explosions\\The screen shakes at explosions"; + stringsEvent[EVENT_INTERFACE_MOUSE] = "Mouse shadow\\Gives the mouse a shadow"; + stringsEvent[EVENT_INTERFACE_EDITMODE] = "Automatic indent\\When program editing"; + stringsEvent[EVENT_INTERFACE_EDITVALUE] = "Big indent\\Indent 2 or 4 spaces per level defined by braces"; + stringsEvent[EVENT_INTERFACE_SOLUCE4] = "Access to solutions\\Show program \"4: Solution\" in the exercises"; + + stringsEvent[EVENT_INTERFACE_KDEF] = "Standard controls\\Standard key functions"; + stringsEvent[EVENT_INTERFACE_KLEFT] = "Turn left\\turns the bot to the left"; + stringsEvent[EVENT_INTERFACE_KRIGHT] = "Turn right\\turns the bot to the right"; + stringsEvent[EVENT_INTERFACE_KUP] = "Forward\\Moves forward"; + stringsEvent[EVENT_INTERFACE_KDOWN] = "Backward\\Moves backward"; + stringsEvent[EVENT_INTERFACE_KGUP] = "Climb\\Increases the power of the jet"; + stringsEvent[EVENT_INTERFACE_KGDOWN] = "Descend\\Reduces the power of the jet"; + stringsEvent[EVENT_INTERFACE_KCAMERA] = "Change camera\\Switches between onboard camera and following camera"; + stringsEvent[EVENT_INTERFACE_KDESEL] = "Previous object\\Selects the previous object"; + stringsEvent[EVENT_INTERFACE_KACTION] = "Standard action\\Standard action of the bot (take/grab, shoot, sniff, etc)"; + stringsEvent[EVENT_INTERFACE_KNEAR] = "Camera closer\\Moves the camera forward"; + stringsEvent[EVENT_INTERFACE_KAWAY] = "Camera back\\Moves the camera backward"; + stringsEvent[EVENT_INTERFACE_KNEXT] = "Next object\\Selects the next object"; + stringsEvent[EVENT_INTERFACE_KHUMAN] = "Select the astronaut\\Selects the astronaut"; + stringsEvent[EVENT_INTERFACE_KQUIT] = "Quit\\Quit the current mission or exercise"; + stringsEvent[EVENT_INTERFACE_KHELP] = "Instructions\\Shows the instructions for the current mission"; + stringsEvent[EVENT_INTERFACE_KPROG] = "Programming help\\Gives more detailed help with programming"; + stringsEvent[EVENT_INTERFACE_KCBOT] = "Key word help\\More detailed help about key words"; + stringsEvent[EVENT_INTERFACE_KVISIT] = "Origin of last message\\Shows where the last message was sent from"; + stringsEvent[EVENT_INTERFACE_KSPEED10] = "Speed 1.0x\\Normal speed"; + stringsEvent[EVENT_INTERFACE_KSPEED15] = "Speed 1.5x\\1.5 times faster"; + stringsEvent[EVENT_INTERFACE_KSPEED20] = "Speed 2.0x\\Double speed"; + stringsEvent[EVENT_INTERFACE_KSPEED30] = "Speed 3.0x\\Three times faster"; + + stringsEvent[EVENT_INTERFACE_VOLSOUND] = "Sound effects:\\Volume of engines, voice, shooting, etc."; + stringsEvent[EVENT_INTERFACE_VOLMUSIC] = "Background sound :\\Volume of audio tracks on the CD"; + stringsEvent[EVENT_INTERFACE_SOUND3D] = "3D sound\\3D positioning of the sound"; + + stringsEvent[EVENT_INTERFACE_MIN] = "Lowest\\Minimum graphic quality (highest frame rate)"; + stringsEvent[EVENT_INTERFACE_NORM] = "Normal\\Normal graphic quality"; + stringsEvent[EVENT_INTERFACE_MAX] = "Highest\\Highest graphic quality (lowest frame rate)"; + + stringsEvent[EVENT_INTERFACE_SILENT] = "Mute\\No sound"; + stringsEvent[EVENT_INTERFACE_NOISY] = "Normal\\Normal sound volume"; + + stringsEvent[EVENT_INTERFACE_JOYSTICK] = "Use a joystick\\Joystick or keyboard"; + stringsEvent[EVENT_INTERFACE_SOLUCE] = "Access to solution\\Shows the solution (detailed instructions for missions)"; + + stringsEvent[EVENT_INTERFACE_NEDIT] = "\\New player name"; + stringsEvent[EVENT_INTERFACE_NOK] = "OK\\Choose the selected player"; + stringsEvent[EVENT_INTERFACE_NCANCEL] = "Cancel\\Keep current player name"; + stringsEvent[EVENT_INTERFACE_NDELETE] = "Delete player\\Deletes the player from the list"; + stringsEvent[EVENT_INTERFACE_NLABEL] = "Player name"; + + stringsEvent[EVENT_INTERFACE_IOWRITE] = "Save\\Saves the current mission"; + stringsEvent[EVENT_INTERFACE_IOREAD] = "Load\\Loads the selected mission"; + stringsEvent[EVENT_INTERFACE_IOLIST] = "List of saved missions"; + stringsEvent[EVENT_INTERFACE_IOLABEL] = "Filename:"; + stringsEvent[EVENT_INTERFACE_IONAME] = "Mission name"; + stringsEvent[EVENT_INTERFACE_IOIMAGE] = "Photography"; + stringsEvent[EVENT_INTERFACE_IODELETE] = "Delete\\Deletes the selected file"; + + stringsEvent[EVENT_INTERFACE_PERSO] = "Appearance\\Choose your appearance"; + stringsEvent[EVENT_INTERFACE_POK] = "OK"; + stringsEvent[EVENT_INTERFACE_PCANCEL] = "Cancel"; + stringsEvent[EVENT_INTERFACE_PDEF] = "Standard\\Standard appearance settings"; + stringsEvent[EVENT_INTERFACE_PHEAD] = "Head\\Face and hair"; + stringsEvent[EVENT_INTERFACE_PBODY] = "Suit\\Astronaut suit"; + stringsEvent[EVENT_INTERFACE_PLROT] = "\\Turn left"; + stringsEvent[EVENT_INTERFACE_PRROT] = "\\Turn right"; + stringsEvent[EVENT_INTERFACE_PCRa] = "Red"; + stringsEvent[EVENT_INTERFACE_PCGa] = "Green"; + stringsEvent[EVENT_INTERFACE_PCBa] = "Blue"; + stringsEvent[EVENT_INTERFACE_PCRb] = "Red"; + stringsEvent[EVENT_INTERFACE_PCGb] = "Green"; + stringsEvent[EVENT_INTERFACE_PCBb] = "Blue"; + stringsEvent[EVENT_INTERFACE_PFACE1] = "\\Face 1"; + stringsEvent[EVENT_INTERFACE_PFACE2] = "\\Face 4"; + stringsEvent[EVENT_INTERFACE_PFACE3] = "\\Face 3"; + stringsEvent[EVENT_INTERFACE_PFACE4] = "\\Face 2"; + stringsEvent[EVENT_INTERFACE_PGLASS0] = "\\No eyeglasses"; + stringsEvent[EVENT_INTERFACE_PGLASS1] = "\\Eyeglasses 1"; + stringsEvent[EVENT_INTERFACE_PGLASS2] = "\\Eyeglasses 2"; + stringsEvent[EVENT_INTERFACE_PGLASS3] = "\\Eyeglasses 3"; + stringsEvent[EVENT_INTERFACE_PGLASS4] = "\\Eyeglasses 4"; + stringsEvent[EVENT_INTERFACE_PGLASS5] = "\\Eyeglasses 5"; + + stringsEvent[EVENT_OBJECT_DESELECT] = "Previous selection (\\key desel;)"; + stringsEvent[EVENT_OBJECT_LEFT] = "Turn left (\\key left;)"; + stringsEvent[EVENT_OBJECT_RIGHT] = "Turn right (\\key right;)"; + stringsEvent[EVENT_OBJECT_UP] = "Forward (\\key up;)"; + stringsEvent[EVENT_OBJECT_DOWN] = "Backward (\\key down;)"; + stringsEvent[EVENT_OBJECT_GASUP] = "Up (\\key gup;)"; + stringsEvent[EVENT_OBJECT_GASDOWN] = "Down (\\key gdown;)"; + stringsEvent[EVENT_OBJECT_HTAKE] = "Grab or drop (\\key action;)"; + stringsEvent[EVENT_OBJECT_MTAKE] = "Grab or drop (\\key action;)"; + stringsEvent[EVENT_OBJECT_MFRONT] = "..in front"; + stringsEvent[EVENT_OBJECT_MBACK] = "..behind"; + stringsEvent[EVENT_OBJECT_MPOWER] = "..power cell"; + stringsEvent[EVENT_OBJECT_BHELP] = "Instructions for the mission (\\key help;)"; + stringsEvent[EVENT_OBJECT_BTAKEOFF] = "Take off to finish the mission"; + stringsEvent[EVENT_OBJECT_BDERRICK] = "Build a derrick"; + stringsEvent[EVENT_OBJECT_BSTATION] = "Build a power station"; + stringsEvent[EVENT_OBJECT_BFACTORY] = "Build a bot factory"; + stringsEvent[EVENT_OBJECT_BREPAIR] = "Build a repair center"; + stringsEvent[EVENT_OBJECT_BCONVERT] = "Build a converter"; + stringsEvent[EVENT_OBJECT_BTOWER] = "Build a defense tower"; + stringsEvent[EVENT_OBJECT_BRESEARCH] = "Build a research center"; + stringsEvent[EVENT_OBJECT_BRADAR] = "Build a radar station"; + stringsEvent[EVENT_OBJECT_BENERGY] = "Build a power cell factory"; + stringsEvent[EVENT_OBJECT_BLABO] = "Build an autolab"; + stringsEvent[EVENT_OBJECT_BNUCLEAR] = "Build a nuclear power plant"; + stringsEvent[EVENT_OBJECT_BPARA] = "Build a lightning conductor"; + stringsEvent[EVENT_OBJECT_BINFO] = "Build a exchange post"; + stringsEvent[EVENT_OBJECT_GFLAT] = "Show if the ground is flat"; + stringsEvent[EVENT_OBJECT_FCREATE] = "Plant a flag"; + stringsEvent[EVENT_OBJECT_FDELETE] = "Remove a flag"; + stringsEvent[EVENT_OBJECT_FCOLORb] = "\\Blue flags"; + stringsEvent[EVENT_OBJECT_FCOLORr] = "\\Red flags"; + stringsEvent[EVENT_OBJECT_FCOLORg] = "\\Green flags"; + stringsEvent[EVENT_OBJECT_FCOLORy] = "\\Yellow flags"; + stringsEvent[EVENT_OBJECT_FCOLORv] = "\\Violet flags"; + stringsEvent[EVENT_OBJECT_FACTORYfa] = "Build a winged grabber"; + stringsEvent[EVENT_OBJECT_FACTORYta] = "Build a tracked grabber"; + stringsEvent[EVENT_OBJECT_FACTORYwa] = "Build a wheeled grabber"; + stringsEvent[EVENT_OBJECT_FACTORYia] = "Build a legged grabber"; + stringsEvent[EVENT_OBJECT_FACTORYfc] = "Build a winged shooter"; + stringsEvent[EVENT_OBJECT_FACTORYtc] = "Build a tracked shooter"; + stringsEvent[EVENT_OBJECT_FACTORYwc] = "Build a wheeled shooter"; + stringsEvent[EVENT_OBJECT_FACTORYic] = "Build a legged shooter"; + stringsEvent[EVENT_OBJECT_FACTORYfi] = "Build a winged orga shooter"; + stringsEvent[EVENT_OBJECT_FACTORYti] = "Build a tracked orga shooter"; + stringsEvent[EVENT_OBJECT_FACTORYwi] = "Build a wheeled orga shooter"; + stringsEvent[EVENT_OBJECT_FACTORYii] = "Build a legged orga shooter"; + stringsEvent[EVENT_OBJECT_FACTORYfs] = "Build a winged sniffer"; + stringsEvent[EVENT_OBJECT_FACTORYts] = "Build a tracked sniffer"; + stringsEvent[EVENT_OBJECT_FACTORYws] = "Build a wheeled sniffer"; + stringsEvent[EVENT_OBJECT_FACTORYis] = "Build a legged sniffer"; + stringsEvent[EVENT_OBJECT_FACTORYrt] = "Build a thumper"; + stringsEvent[EVENT_OBJECT_FACTORYrc] = "Build a phazer shooter"; + stringsEvent[EVENT_OBJECT_FACTORYrr] = "Build a recycler"; + stringsEvent[EVENT_OBJECT_FACTORYrs] = "Build a shielder"; + stringsEvent[EVENT_OBJECT_FACTORYsa] = "Build a subber"; + stringsEvent[EVENT_OBJECT_RTANK] = "Run research program for tracked bots"; + stringsEvent[EVENT_OBJECT_RFLY] = "Run research program for winged bots"; + stringsEvent[EVENT_OBJECT_RTHUMP] = "Run research program for thumper"; + stringsEvent[EVENT_OBJECT_RCANON] = "Run research program for shooter"; + stringsEvent[EVENT_OBJECT_RTOWER] = "Run research program for defense tower"; + stringsEvent[EVENT_OBJECT_RPHAZER] = "Run research program for phazer shooter"; + stringsEvent[EVENT_OBJECT_RSHIELD] = "Run research program for shielder"; + stringsEvent[EVENT_OBJECT_RATOMIC] = "Run research program for nuclear power"; + stringsEvent[EVENT_OBJECT_RiPAW] = "Run research program for legged bots"; + stringsEvent[EVENT_OBJECT_RiGUN] = "Run research program for orga shooter"; + stringsEvent[EVENT_OBJECT_RESET] = "Return to start"; + stringsEvent[EVENT_OBJECT_SEARCH] = "Sniff (\\key action;)"; + stringsEvent[EVENT_OBJECT_TERRAFORM] = "Thump (\\key action;)"; + stringsEvent[EVENT_OBJECT_FIRE] = "Shoot (\\key action;)"; + stringsEvent[EVENT_OBJECT_RECOVER] = "Recycle (\\key action;)"; + stringsEvent[EVENT_OBJECT_BEGSHIELD] = "Extend shield (\\key action;)"; + stringsEvent[EVENT_OBJECT_ENDSHIELD] = "Withdraw shield (\\key action;)"; + stringsEvent[EVENT_OBJECT_DIMSHIELD] = "Shield radius"; + stringsEvent[EVENT_OBJECT_PROGRUN] = "Execute the selected program"; + stringsEvent[EVENT_OBJECT_PROGEDIT] = "Edit the selected program"; + stringsEvent[EVENT_OBJECT_INFOOK] = "\\SatCom on standby"; + stringsEvent[EVENT_OBJECT_DELETE] = "Destroy the building"; + stringsEvent[EVENT_OBJECT_GENERGY] = "Energy level"; + stringsEvent[EVENT_OBJECT_GSHIELD] = "Shield level"; + stringsEvent[EVENT_OBJECT_GRANGE] = "Jet temperature"; + stringsEvent[EVENT_OBJECT_GPROGRESS] = "Still working ..."; + stringsEvent[EVENT_OBJECT_GRADAR] = "Number of insects detected"; + stringsEvent[EVENT_OBJECT_GINFO] = "Transmitted information"; + stringsEvent[EVENT_OBJECT_COMPASS] = "Compass"; + stringsEvent[EVENT_OBJECT_MAPZOOM] = "Zoom mini-map"; + stringsEvent[EVENT_OBJECT_CAMERA] = "Camera (\\key camera;)"; + stringsEvent[EVENT_OBJECT_CAMERAleft] = "Camera to left"; + stringsEvent[EVENT_OBJECT_CAMERAright] = "Camera to right"; + stringsEvent[EVENT_OBJECT_CAMERAnear] = "Camera nearest"; + stringsEvent[EVENT_OBJECT_CAMERAaway] = "Camera awayest"; + stringsEvent[EVENT_OBJECT_HELP] = "Help about selected object"; + stringsEvent[EVENT_OBJECT_SOLUCE] = "Show the solution"; + stringsEvent[EVENT_OBJECT_SHORTCUT00] = "Switch bots <-> buildings"; + stringsEvent[EVENT_OBJECT_LIMIT] = "Show the range"; + stringsEvent[EVENT_OBJECT_PEN0] = "\\Raise the pencil"; + stringsEvent[EVENT_OBJECT_PEN1] = "\\Use the black pencil"; + stringsEvent[EVENT_OBJECT_PEN2] = "\\Use the yellow pencil"; + stringsEvent[EVENT_OBJECT_PEN3] = "\\Use the orange pencil"; + stringsEvent[EVENT_OBJECT_PEN4] = "\\Use the red pencil"; + stringsEvent[EVENT_OBJECT_PEN5] = "\\Use the purple pencil"; + stringsEvent[EVENT_OBJECT_PEN6] = "\\Use the blue pencil"; + stringsEvent[EVENT_OBJECT_PEN7] = "\\Use the green pencil"; + stringsEvent[EVENT_OBJECT_PEN8] = "\\Use the brown pencil"; + stringsEvent[EVENT_OBJECT_REC] = "\\Start recording"; + stringsEvent[EVENT_OBJECT_STOP] = "\\Stop recording"; + stringsEvent[EVENT_DT_VISIT0] = "Show the place"; + stringsEvent[EVENT_DT_VISIT1] = "Show the place"; + stringsEvent[EVENT_DT_VISIT2] = "Show the place"; + stringsEvent[EVENT_DT_VISIT3] = "Show the place"; + stringsEvent[EVENT_DT_VISIT4] = "Show the place"; + stringsEvent[EVENT_DT_END] = "Continue"; + stringsEvent[EVENT_CMD] = "Command line"; + stringsEvent[EVENT_SPEED] = "Game speed"; + + stringsEvent[EVENT_HYPER_PREV] = "Back"; + stringsEvent[EVENT_HYPER_NEXT] = "Forward"; + stringsEvent[EVENT_HYPER_HOME] = "Home"; + stringsEvent[EVENT_HYPER_COPY] = "Copy"; + stringsEvent[EVENT_HYPER_SIZE1] = "Size 1"; + stringsEvent[EVENT_HYPER_SIZE2] = "Size 2"; + stringsEvent[EVENT_HYPER_SIZE3] = "Size 3"; + stringsEvent[EVENT_HYPER_SIZE4] = "Size 4"; + stringsEvent[EVENT_HYPER_SIZE5] = "Size 5"; + stringsEvent[EVENT_SATCOM_HUSTON] = "Instructions from Houston"; + stringsEvent[EVENT_SATCOM_SAT] = "Satellite report"; + stringsEvent[EVENT_SATCOM_LOADING] = "Programs dispatched by Houston"; + stringsEvent[EVENT_SATCOM_OBJECT] = "List of objects"; + stringsEvent[EVENT_SATCOM_PROG] = "Programming help"; + stringsEvent[EVENT_SATCOM_SOLUCE] = "Solution"; + + stringsEvent[EVENT_STUDIO_OK] = "OK\\Close program editor and return to game"; + stringsEvent[EVENT_STUDIO_CANCEL] = "Cancel\\Cancel all changes"; + stringsEvent[EVENT_STUDIO_NEW] = "New"; + stringsEvent[EVENT_STUDIO_OPEN] = "Open (Ctrl+o)"; + stringsEvent[EVENT_STUDIO_SAVE] = "Save (Ctrl+s)"; + stringsEvent[EVENT_STUDIO_UNDO] = "Undo (Ctrl+z)"; + stringsEvent[EVENT_STUDIO_CUT] = "Cut (Ctrl+x)"; + stringsEvent[EVENT_STUDIO_COPY] = "Copy (Ctrl+c)"; + stringsEvent[EVENT_STUDIO_PASTE] = "Paste (Ctrl+v)"; + stringsEvent[EVENT_STUDIO_SIZE] = "Font size"; + stringsEvent[EVENT_STUDIO_TOOL] = "Instructions (\\key help;)"; + stringsEvent[EVENT_STUDIO_HELP] = "Programming help (\\key prog;)"; + stringsEvent[EVENT_STUDIO_COMPILE] = "Compile"; + stringsEvent[EVENT_STUDIO_RUN] = "Execute/stop"; + stringsEvent[EVENT_STUDIO_REALTIME] = "Pause/continue"; + stringsEvent[EVENT_STUDIO_STEP] = "One step"; + + + + stringsObject[OBJECT_PORTICO] = "Gantry crane"; + stringsObject[OBJECT_BASE] = "Spaceship"; + stringsObject[OBJECT_DERRICK] = "Derrick"; + stringsObject[OBJECT_FACTORY] = "Bot factory"; + stringsObject[OBJECT_REPAIR] = "Repair center"; + stringsObject[OBJECT_DESTROYER] = "Destroyer"; + stringsObject[OBJECT_STATION] = "Power station"; + stringsObject[OBJECT_CONVERT] = "Converts ore to titanium"; + stringsObject[OBJECT_TOWER] = "Defense tower"; + stringsObject[OBJECT_NEST] = "Nest"; + stringsObject[OBJECT_RESEARCH] = "Research center"; + stringsObject[OBJECT_RADAR] = "Radar station"; + stringsObject[OBJECT_INFO] = "Information exchange post"; + stringsObject[OBJECT_ENERGY] = "Power cell factory"; + stringsObject[OBJECT_LABO] = "Autolab"; + stringsObject[OBJECT_NUCLEAR] = "Nuclear power station"; + stringsObject[OBJECT_PARA] = "Lightning conductor"; + stringsObject[OBJECT_SAFE] = "Vault"; + stringsObject[OBJECT_HUSTON] = "Houston Mission Control"; + stringsObject[OBJECT_TARGET1] = "Target"; + stringsObject[OBJECT_TARGET2] = "Target"; + stringsObject[OBJECT_START] = "Start"; + stringsObject[OBJECT_END] = "Finish"; + stringsObject[OBJECT_STONE] = "Titanium ore"; + stringsObject[OBJECT_URANIUM] = "Uranium ore"; + stringsObject[OBJECT_BULLET] = "Organic matter"; + stringsObject[OBJECT_METAL] = "Titanium"; + stringsObject[OBJECT_POWER] = "Power cell"; + stringsObject[OBJECT_ATOMIC] = "Nuclear power cell"; + stringsObject[OBJECT_BBOX] = "Black box"; + stringsObject[OBJECT_KEYa] = "Key A"; + stringsObject[OBJECT_KEYb] = "Key B"; + stringsObject[OBJECT_KEYc] = "Key C"; + stringsObject[OBJECT_KEYd] = "Key D"; + stringsObject[OBJECT_TNT] = "Explosive"; + stringsObject[OBJECT_BOMB] = "Fixed mine"; + stringsObject[OBJECT_BAG] = "Survival kit"; + stringsObject[OBJECT_WAYPOINT] = "Checkpoint"; + stringsObject[OBJECT_FLAGb] = "Blue flag"; + stringsObject[OBJECT_FLAGr] = "Red flag"; + stringsObject[OBJECT_FLAGg] = "Green flag"; + stringsObject[OBJECT_FLAGy] = "Yellow flag"; + stringsObject[OBJECT_FLAGv] = "Violet flag"; + stringsObject[OBJECT_MARKPOWER] = "Energy deposit (site for power station)"; + stringsObject[OBJECT_MARKURANIUM] = "Uranium deposit (site for derrick)"; + stringsObject[OBJECT_MARKKEYa] = "Found key A (site for derrick)"; + stringsObject[OBJECT_MARKKEYb] = "Found key B (site for derrick)"; + stringsObject[OBJECT_MARKKEYc] = "Found key C (site for derrick)"; + stringsObject[OBJECT_MARKKEYd] = "Found key D (site for derrick)"; + stringsObject[OBJECT_MARKSTONE] = "Titanium deposit (site for derrick)"; + stringsObject[OBJECT_MOBILEft] = "Practice bot"; + stringsObject[OBJECT_MOBILEtt] = "Practice bot"; + stringsObject[OBJECT_MOBILEwt] = "Practice bot"; + stringsObject[OBJECT_MOBILEit] = "Practice bot"; + stringsObject[OBJECT_MOBILEfa] = "Winged grabber"; + stringsObject[OBJECT_MOBILEta] = "Tracked grabber"; + stringsObject[OBJECT_MOBILEwa] = "Wheeled grabber"; + stringsObject[OBJECT_MOBILEia] = "Legged grabber"; + stringsObject[OBJECT_MOBILEfc] = "Winged shooter"; + stringsObject[OBJECT_MOBILEtc] = "Tracked shooter"; + stringsObject[OBJECT_MOBILEwc] = "Wheeled shooter"; + stringsObject[OBJECT_MOBILEic] = "Legged shooter"; + stringsObject[OBJECT_MOBILEfi] = "Winged orga shooter"; + stringsObject[OBJECT_MOBILEti] = "Tracked orga shooter"; + stringsObject[OBJECT_MOBILEwi] = "Wheeled orga shooter"; + stringsObject[OBJECT_MOBILEii] = "Legged orga shooter"; + stringsObject[OBJECT_MOBILEfs] = "Winged sniffer"; + stringsObject[OBJECT_MOBILEts] = "Tracked sniffer"; + stringsObject[OBJECT_MOBILEws] = "Wheeled sniffer"; + stringsObject[OBJECT_MOBILEis] = "Legged sniffer"; + stringsObject[OBJECT_MOBILErt] = "Thumper"; + stringsObject[OBJECT_MOBILErc] = "Phazer shooter"; + stringsObject[OBJECT_MOBILErr] = "Recycler"; + stringsObject[OBJECT_MOBILErs] = "Shielder"; + stringsObject[OBJECT_MOBILEsa] = "Subber"; + stringsObject[OBJECT_MOBILEtg] = "Target bot"; + stringsObject[OBJECT_MOBILEdr] = "Drawer bot"; + stringsObject[OBJECT_TECH] = "Engineer"; + stringsObject[OBJECT_TOTO] = "Robbie"; + stringsObject[OBJECT_MOTHER] = "Alien Queen"; + stringsObject[OBJECT_ANT] = "Ant"; + stringsObject[OBJECT_SPIDER] = "Spider"; + stringsObject[OBJECT_BEE] = "Wasp"; + stringsObject[OBJECT_WORM] = "Worm"; + stringsObject[OBJECT_EGG] = "Egg"; + stringsObject[OBJECT_RUINmobilew1] = "Wreckage"; + stringsObject[OBJECT_RUINmobilew2] = "Wreckage"; + stringsObject[OBJECT_RUINmobilet1] = "Wreckage"; + stringsObject[OBJECT_RUINmobilet2] = "Wreckage"; + stringsObject[OBJECT_RUINmobiler1] = "Wreckage"; + stringsObject[OBJECT_RUINmobiler2] = "Wreckage"; + stringsObject[OBJECT_RUINfactory] = "Ruin"; + stringsObject[OBJECT_RUINdoor] = "Ruin"; + stringsObject[OBJECT_RUINsupport] = "Waste"; + stringsObject[OBJECT_RUINradar] = "Ruin"; + stringsObject[OBJECT_RUINconvert] = "Ruin"; + stringsObject[OBJECT_RUINbase] = "Spaceship ruin"; + stringsObject[OBJECT_RUINhead] = "Spaceship ruin"; + stringsObject[OBJECT_APOLLO1] = "Remains of Apollo mission"; + stringsObject[OBJECT_APOLLO3] = "Remains of Apollo mission"; + stringsObject[OBJECT_APOLLO4] = "Remains of Apollo mission"; + stringsObject[OBJECT_APOLLO5] = "Remains of Apollo mission"; + stringsObject[OBJECT_APOLLO2] = "Lunar Roving Vehicle"; + + + + stringsErr[ERR_CMD] = "Unknown command"; + stringsErr[ERR_MANIP_VEH] = "Inappropriate bot"; + stringsErr[ERR_MANIP_FLY] = "Impossible when flying"; + stringsErr[ERR_MANIP_BUSY] = "Already carrying something"; + stringsErr[ERR_MANIP_NIL] = "Nothing to grab"; + stringsErr[ERR_MANIP_MOTOR] = "Impossible when moving"; + stringsErr[ERR_MANIP_OCC] = "Place occupied"; + stringsErr[ERR_MANIP_FRIEND] = "No other robot"; + stringsErr[ERR_MANIP_RADIO] = "You can not carry a radioactive object"; + stringsErr[ERR_MANIP_WATER] = "You can not carry an object under water"; + stringsErr[ERR_MANIP_EMPTY] = "Nothing to drop"; + stringsErr[ERR_BUILD_FLY] = "Impossible when flying"; + stringsErr[ERR_BUILD_WATER] = "Impossible under water"; + stringsErr[ERR_BUILD_ENERGY] = "Not enough energy"; + stringsErr[ERR_BUILD_METALAWAY] = "Titanium too far away"; + stringsErr[ERR_BUILD_METALNEAR] = "Titanium too close"; + stringsErr[ERR_BUILD_METALINEX] = "No titanium around"; + stringsErr[ERR_BUILD_FLAT] = "Ground not flat enough"; + stringsErr[ERR_BUILD_FLATLIT] = "Flat ground not large enough"; + stringsErr[ERR_BUILD_BUSY] = "Place occupied"; + stringsErr[ERR_BUILD_BASE] = "Too close to space ship"; + stringsErr[ERR_BUILD_NARROW] = "Too close to a building"; + stringsErr[ERR_BUILD_MOTOR] = "Impossible when moving"; + stringsErr[ERR_SEARCH_FLY] = "Impossible when flying"; + stringsErr[ERR_SEARCH_VEH] = "Inappropriate bot"; + stringsErr[ERR_SEARCH_MOTOR] = "Impossible when moving"; + stringsErr[ERR_TERRA_VEH] = "Inappropriate bot"; + stringsErr[ERR_TERRA_ENERGY] = "Not enough energy"; + stringsErr[ERR_TERRA_FLOOR] = "Ground inappropriate"; + stringsErr[ERR_TERRA_BUILDING] = "Building too close"; + stringsErr[ERR_TERRA_OBJECT] = "Object too close"; + stringsErr[ERR_RECOVER_VEH] = "Inappropriate bot"; + stringsErr[ERR_RECOVER_ENERGY] = "Not enough energy"; + stringsErr[ERR_RECOVER_NULL] = "Nothing to recycle"; + stringsErr[ERR_SHIELD_VEH] = "Inappropriate bot"; + stringsErr[ERR_SHIELD_ENERGY] = "No more energy"; + stringsErr[ERR_MOVE_IMPOSSIBLE] = "Error in instruction move"; + stringsErr[ERR_FIND_IMPOSSIBLE] = "Object not found"; + stringsErr[ERR_GOTO_IMPOSSIBLE] = "Goto: inaccessible destination"; + stringsErr[ERR_GOTO_ITER] = "Goto: inaccessible destination"; + stringsErr[ERR_GOTO_BUSY] = "Goto: destination occupied"; + stringsErr[ERR_FIRE_VEH] = "Inappropriate bot"; + stringsErr[ERR_FIRE_ENERGY] = "Not enough energy"; + stringsErr[ERR_FIRE_FLY] = "Impossible when flying"; + stringsErr[ERR_CONVERT_EMPTY] = "No titanium ore to convert"; + stringsErr[ERR_DERRICK_NULL] = "No ore in the subsoil"; + stringsErr[ERR_STATION_NULL] = "No energy in the subsoil"; + stringsErr[ERR_TOWER_POWER] = "No power cell"; + stringsErr[ERR_TOWER_ENERGY] = "No more energy"; + stringsErr[ERR_RESEARCH_POWER] = "No power cell"; + stringsErr[ERR_RESEARCH_ENERGY] = "Not enough energy"; + stringsErr[ERR_RESEARCH_TYPE] = "Inappropriate cell type"; + stringsErr[ERR_RESEARCH_ALREADY]= "Research program already performed"; + stringsErr[ERR_ENERGY_NULL] = "No energy in the subsoil"; + stringsErr[ERR_ENERGY_LOW] = "Not enough energy yet"; + stringsErr[ERR_ENERGY_EMPTY] = "No titanium to transform"; + stringsErr[ERR_ENERGY_BAD] = "Transforms only titanium"; + stringsErr[ERR_BASE_DLOCK] = "Doors blocked by a robot or another object "; + stringsErr[ERR_BASE_DHUMAN] = "You must get on the spaceship to take off "; + stringsErr[ERR_LABO_NULL] = "Nothing to analyze"; + stringsErr[ERR_LABO_BAD] = "Analyzes only organic matter"; + stringsErr[ERR_LABO_ALREADY] = "Analysis already performed"; + stringsErr[ERR_NUCLEAR_NULL] = "No energy in the subsoil"; + stringsErr[ERR_NUCLEAR_LOW] = "Not yet enough energy"; + stringsErr[ERR_NUCLEAR_EMPTY] = "No uranium to transform"; + stringsErr[ERR_NUCLEAR_BAD] = "Transforms only uranium"; + stringsErr[ERR_FACTORY_NULL] = "No titanium"; + stringsErr[ERR_FACTORY_NEAR] = "Object too close"; + stringsErr[ERR_RESET_NEAR] = "Place occupied"; + stringsErr[ERR_INFO_NULL] = "No information exchange post within range"; + stringsErr[ERR_VEH_VIRUS] = "Program infected by a virus"; + stringsErr[ERR_BAT_VIRUS] = "Infected by a virus; temporarily out of order"; + stringsErr[ERR_VEH_POWER] = "No power cell"; + stringsErr[ERR_VEH_ENERGY] = "No more energy"; + stringsErr[ERR_FLAG_FLY] = "Impossible when flying"; + stringsErr[ERR_FLAG_WATER] = "Impossible when swimming"; + stringsErr[ERR_FLAG_MOTOR] = "Impossible when moving"; + stringsErr[ERR_FLAG_BUSY] = "Impossible when carrying an object"; + stringsErr[ERR_FLAG_CREATE] = "Too many flags of this color (maximum 5)"; + stringsErr[ERR_FLAG_PROXY] = "Too close to an existing flag"; + stringsErr[ERR_FLAG_DELETE] = "No flag nearby"; + stringsErr[ERR_MISSION_NOTERM] = "The mission is not accomplished yet (press \\key help; for more details)"; + stringsErr[ERR_DELETEMOBILE] = "Bot destroyed"; + stringsErr[ERR_DELETEBUILDING] = "Building destroyed"; + stringsErr[ERR_TOOMANY] = "Can not create this; there are too many objects"; + stringsErr[ERR_OBLIGATORYTOKEN] = "\"%s\" missing in this exercise"; + stringsErr[ERR_PROHIBITEDTOKEN] = "Do not use in this exercise"; + + stringsErr[INFO_BUILD] = "Building completed"; + stringsErr[INFO_CONVERT] = "Titanium available"; + stringsErr[INFO_RESEARCH] = "Research program completed"; + stringsErr[INFO_RESEARCHTANK] = "Plans for tracked robots available "; + stringsErr[INFO_RESEARCHFLY] = "You can fly with the keys (\\key gup;) and (\\key gdown;)"; + stringsErr[INFO_RESEARCHTHUMP] = "Plans for thumper available"; + stringsErr[INFO_RESEARCHCANON] = "Plans for shooter available"; + stringsErr[INFO_RESEARCHTOWER] = "Plans for defense tower available"; + stringsErr[INFO_RESEARCHPHAZER] = "Plans for phazer shooter available"; + stringsErr[INFO_RESEARCHSHIELD] = "Plans for shielder available"; + stringsErr[INFO_RESEARCHATOMIC] = "Plans for nuclear power plant available"; + stringsErr[INFO_FACTORY] = "New bot available"; + stringsErr[INFO_LABO] = "Analysis performed"; + stringsErr[INFO_ENERGY] = "Power cell available"; + stringsErr[INFO_NUCLEAR] = "Nuclear power cell available"; + stringsErr[INFO_FINDING] = "You found a usable object"; + stringsErr[INFO_MARKPOWER] = "Found a site for power station"; + stringsErr[INFO_MARKURANIUM] = "Found a site for a derrick"; + stringsErr[INFO_MARKSTONE] = "Found a site for a derrick"; + stringsErr[INFO_MARKKEYa] = "Found a site for a derrick"; + stringsErr[INFO_MARKKEYb] = "Found a site for a derrick"; + stringsErr[INFO_MARKKEYc] = "Found a site for a derrick"; + stringsErr[INFO_MARKKEYd] = "Found a site for a derrick"; + stringsErr[INFO_WIN] = "<<< Well done; mission accomplished >>>"; + stringsErr[INFO_LOST] = "<<< Sorry; mission failed >>>"; + stringsErr[INFO_LOSTq] = "<<< Sorry; mission failed >>>"; + stringsErr[INFO_WRITEOK] = "Current mission saved"; + stringsErr[INFO_DELETEPATH] = "Checkpoint crossed"; + stringsErr[INFO_DELETEMOTHER] = "Alien Queen killed"; + stringsErr[INFO_DELETEANT] = "Ant fatally wounded"; + stringsErr[INFO_DELETEBEE] = "Wasp fatally wounded"; + stringsErr[INFO_DELETEWORM] = "Worm fatally wounded"; + stringsErr[INFO_DELETESPIDER] = "Spider fatally wounded"; + stringsErr[INFO_BEGINSATCOM] = "Press \\key help; to read instructions on your SatCom"; + + + + stringsCbot[TX_OPENPAR] = "Opening bracket missing"; + stringsCbot[TX_CLOSEPAR] = "Closing bracket missing "; + stringsCbot[TX_NOTBOOL] = "The expression must return a boolean value"; + stringsCbot[TX_UNDEFVAR] = "Variable not declared"; + stringsCbot[TX_BADLEFT] = "Assignment impossible"; + stringsCbot[TX_ENDOF] = "Semicolon terminator missing"; + stringsCbot[TX_OUTCASE] = "Instruction \"case\" outside a block \"switch\""; + stringsCbot[TX_NOTERM] = "Instructions after the final closing brace"; + stringsCbot[TX_CLOSEBLK] = "End of block missing"; + stringsCbot[TX_ELSEWITHOUTIF] = "Instruction \"else\" without corresponding \"if\" "; + stringsCbot[TX_OPENBLK] = "Opening brace missing "; + stringsCbot[TX_BADTYPE] = "Wrong type for the assignment"; + stringsCbot[TX_REDEFVAR] = "A variable can not be declared twice"; + stringsCbot[TX_BAD2TYPE] = "The types of the two operands are incompatible "; + stringsCbot[TX_UNDEFCALL] = "Unknown function"; + stringsCbot[TX_MISDOTS] = "Sign \" : \" missing"; + stringsCbot[TX_WHILE] = "Keyword \"while\" missing"; + stringsCbot[TX_BREAK] = "Instruction \"break\" outside a loop"; + stringsCbot[TX_LABEL] = "A label must be followed by \"for\"; \"while\"; \"do\" or \"switch\""; + stringsCbot[TX_NOLABEL] = "This label does not exist"; + stringsCbot[TX_NOCASE] = "Instruction \"case\" missing"; + stringsCbot[TX_BADNUM] = "Number missing"; + stringsCbot[TX_VOID] = "Void parameter"; + stringsCbot[TX_NOTYP] = "Type declaration missing"; + stringsCbot[TX_NOVAR] = "Variable name missing"; + stringsCbot[TX_NOFONC] = "Function name missing"; + stringsCbot[TX_OVERPARAM] = "Too many parameters"; + stringsCbot[TX_REDEF] = "Function already exists"; + stringsCbot[TX_LOWPARAM] = "Parameters missing "; + stringsCbot[TX_BADPARAM] = "No function with this name accepts this kind of parameter"; + stringsCbot[TX_NUMPARAM] = "No function with this name accepts this number of parameters"; + stringsCbot[TX_NOITEM] = "This is not a member of this class"; + stringsCbot[TX_DOT] = "This object is not a member of a class"; + stringsCbot[TX_NOCONST] = "Appropriate constructor missing"; + stringsCbot[TX_REDEFCLASS] = "This class already exists"; + stringsCbot[TX_CLBRK] = "\" ] \" missing"; + stringsCbot[TX_RESERVED] = "Reserved keyword of CBOT language"; + stringsCbot[TX_BADNEW] = "Bad argument for \"new\""; + stringsCbot[TX_OPBRK] = "\" [ \" expected"; + stringsCbot[TX_BADSTRING] = "String missing"; + stringsCbot[TX_BADINDEX] = "Incorrect index type"; + stringsCbot[TX_PRIVATE] = "Private element"; + stringsCbot[TX_NOPUBLIC] = "Public required"; + stringsCbot[TX_DIVZERO] = "Dividing by zero"; + stringsCbot[TX_NOTINIT] = "Variable not initialized"; + stringsCbot[TX_BADTHROW] = "Negative value rejected by \"throw\""; + stringsCbot[TX_NORETVAL] = "The function returned no value "; + stringsCbot[TX_NORUN] = "No function running"; + stringsCbot[TX_NOCALL] = "Calling an unknown function"; + stringsCbot[TX_NOCLASS] = "This class does not exist"; + stringsCbot[TX_NULLPT] = "Unknown Object"; + stringsCbot[TX_OPNAN] = "Operation impossible with value \"nan\""; + stringsCbot[TX_OUTARRAY] = "Access beyond array limit"; + stringsCbot[TX_STACKOVER] = "Stack overflow"; + stringsCbot[TX_DELETEDPT] = "Illegal object"; + stringsCbot[TX_FILEOPEN] = "Can't open file"; + stringsCbot[TX_NOTOPEN] = "File not open"; + stringsCbot[TX_ERRREAD] = "Read error"; + stringsCbot[TX_ERRWRITE] = "Write error"; +} + + static char g_gamerName[100]; @@ -36,7 +731,6 @@ void SetGlobalGamerName(char *name) } - struct KeyDesc { InputSlot key; @@ -105,7 +799,7 @@ static void PutKeyName(char* dst, const char* src) { if ( SearchKey(src+s+5, key) ) { - res = CRobotMain::GetInstancePointer()->GetInputBinding(key).key; + res = CRobotMain::GetInstancePointer()->GetInputBinding(key).primary; if (res != KEY_INVALID) { if ( GetResource(RES_KEY, res, name) ) @@ -138,41 +832,42 @@ static const char* GetResourceBase(ResType type, int num) switch (type) { case RES_TEXT: - assert(num < strings_text_len); - str = strings_text[num]; + assert(num < RT_MAX); + str = stringsText[num]; break; - case RES_EVENT: - // assert(num < strings_event_len); - if (num >= strings_event_len) + case RES_EVENT: + if (num >= EVENT_STD_MAX) { GetLogger()->Trace("GetResource event num out of range: %d\n", num); // TODO: fix later return ""; } - str = strings_event[num]; + str = stringsEvent[num]; break; case RES_OBJECT: - assert(num < strings_object_len); + assert(num < OBJECT_MAX); if (num == OBJECT_HUMAN) return g_gamerName; - str = strings_object[num]; + str = stringsObject[num]; break; case RES_ERR: - assert(num < strings_err_len); - str = strings_err[num]; + assert(num < ERR_MAX); + str = stringsErr[num]; break; case RES_CBOT: - assert(num < strings_cbot_len); - str = strings_cbot[num]; + assert(num < TX_MAX); + str = stringsCbot[num]; break; case RES_KEY: - if (num == VIRTUAL_KMOD_CTRL) + if (static_cast<unsigned int>(num) == KEY_INVALID) + return ""; + else if (num == VIRTUAL_KMOD_CTRL) return "Ctrl"; else if (num == VIRTUAL_KMOD_SHIFT) return "Shift"; @@ -185,7 +880,7 @@ static const char* GetResourceBase(ResType type, int num) // TODO: temporary fix static std::string sstr; sstr = gettext("Button %1"); - StrUtils::Replace(sstr, "%1", StrUtils::ToString<int>(1 + num - VIRTUAL_JOY(0))); + sstr = StrUtils::Replace(sstr, "%1", StrUtils::ToString<int>(1 + num - VIRTUAL_JOY(0))); return sstr.c_str(); } else diff --git a/src/common/restext.h b/src/common/restext.h index 6abb7f5..8199f9f 100644 --- a/src/common/restext.h +++ b/src/common/restext.h @@ -21,8 +21,8 @@ #pragma once + #include "common/global.h" -#include "common/restext_ids.h" /** @@ -39,21 +39,120 @@ enum ResType RES_CBOT = 5, //! < TX_* (CBot) }; +/** + * \enum ResTextType + * \brief Text resources available for translation + */ +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, + + + RT_MAX //! < number of values +}; + // TODO: move to CRobotMain -extern void SetGlobalGamerName(char *name); -extern bool SearchKey(const char *cmd, InputSlot& slot); -extern bool GetResource(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; +void InitializeRestext(); + +void SetGlobalGamerName(char *name); +bool SearchKey(const char *cmd, InputSlot& slot); +bool GetResource(ResType type, int num, char* text); diff --git a/src/common/restext_ids.h b/src/common/restext_ids.h deleted file mode 100644 index 4223a1c..0000000 --- a/src/common/restext_ids.h +++ /dev/null @@ -1,122 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. - - -// TODO: move to restext.h after restext rewrite - -#pragma once - -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, -}; diff --git a/src/common/restext_strings.c b/src/common/restext_strings.c deleted file mode 100644 index d041a28..0000000 --- a/src/common/restext_strings.c +++ /dev/null @@ -1,717 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. - -#include "common/restext_ids.h" -#include "common/event_ids.h" -#include "object/object_ids.h" -#include "common/error_ids.h" -#include "CBot/resource.h" - -const char * const strings_text[] = -{ - [RT_VERSION_ID] = "Colobot Gold", - - [RT_DISINFO_TITLE] = "SatCom", - [RT_WINDOW_MAXIMIZED] = "Maximize", - [RT_WINDOW_MINIMIZED] = "Minimize", - [RT_WINDOW_STANDARD] = "Normal size", - [RT_WINDOW_CLOSE] = "Close", - - [RT_STUDIO_TITLE] = "Program editor", - [RT_SCRIPT_NEW] = "New", - [RT_NAME_DEFAULT] = "Player", - [RT_IO_NEW] = "New ...", - [RT_KEY_OR] = " or ", - - [RT_TITLE_BASE] = "COLOBOT", - [RT_TITLE_INIT] = "COLOBOT", - [RT_TITLE_TRAINER] = "Programming exercises", - [RT_TITLE_DEFI] = "Challenges", - [RT_TITLE_MISSION] = "Missions", - [RT_TITLE_FREE] = "Free game", - [RT_TITLE_TEEN] = "Free game", - [RT_TITLE_USER] = "User levels", - [RT_TITLE_PROTO] = "Prototypes", - [RT_TITLE_SETUP] = "Options", - [RT_TITLE_NAME] = "Player's name", - [RT_TITLE_PERSO] = "Customize your appearance", - [RT_TITLE_WRITE] = "Save the current mission", - [RT_TITLE_READ] = "Load a saved mission", - - [RT_PLAY_CHAPt] = " Chapters:", - [RT_PLAY_CHAPd] = " Chapters:", - [RT_PLAY_CHAPm] = " Planets:", - [RT_PLAY_CHAPf] = " Planets:", - [RT_PLAY_CHAPu] = " User levels:", - [RT_PLAY_CHAPp] = " Planets:", - [RT_PLAY_CHAPte] = " Chapters:", - [RT_PLAY_LISTt] = " Exercises in the chapter:", - [RT_PLAY_LISTd] = " Challenges in the chapter:", - [RT_PLAY_LISTm] = " Missions on this planet:", - [RT_PLAY_LISTf] = " Free game on this planet:", - [RT_PLAY_LISTu] = " Missions on this level:", - [RT_PLAY_LISTp] = " Prototypes on this planet:", - [RT_PLAY_LISTk] = " Free game on this chapter:", - [RT_PLAY_RESUME] = " Summary:", - - [RT_SETUP_DEVICE] = " Drivers:", - [RT_SETUP_MODE] = " Resolution:", - [RT_SETUP_KEY1] = "1) First click on the key you want to redefine.", - [RT_SETUP_KEY2] = "2) Then press the key you want to use instead.", - - [RT_PERSO_FACE] = "Face type:", - [RT_PERSO_GLASSES] = "Eyeglasses:", - [RT_PERSO_HAIR] = "Hair color:", - [RT_PERSO_COMBI] = "Suit color:", - [RT_PERSO_BAND] = "Strip color:", - - [RT_DIALOG_QUIT] = "Do you want to quit COLOBOT ?", - [RT_DIALOG_TITLE] = "COLOBOT", - [RT_DIALOG_YESQUIT] = "Quit\\Quit COLOBOT", - [RT_DIALOG_ABORT] = "Quit the mission?", - [RT_DIALOG_YES] = "Abort\\Abort the current mission", - [RT_DIALOG_NO] = "Continue\\Continue the current mission", - [RT_DIALOG_NOQUIT] = "Continue\\Continue the game", - [RT_DIALOG_DELOBJ] = "Do you really want to destroy the selected building?", - [RT_DIALOG_DELGAME] = "Do you want to delete %s's saved games? ", - [RT_DIALOG_YESDEL] = "Delete", - [RT_DIALOG_NODEL] = "Cancel", - [RT_DIALOG_LOADING] = "LOADING", - - [RT_STUDIO_LISTTT] = "Keyword help(\\key cbot;)", - [RT_STUDIO_COMPOK] = "Compilation ok (0 errors)", - [RT_STUDIO_PROGSTOP] = "Program finished", - - [RT_SATCOM_LIST] = "\\b;List of objects\n", - [RT_SATCOM_BOT] = "\\b;Robots\n", - [RT_SATCOM_BUILDING] = "\\b;Buildings\n", - [RT_SATCOM_FRET] = "\\b;Moveable objects\n", - [RT_SATCOM_ALIEN] = "\\b;Aliens\n", - [RT_SATCOM_NULL] = "\\c; (none)\\n;\n", - [RT_SATCOM_ERROR1] = "\\b;Error\n", - [RT_SATCOM_ERROR2] = "The list is only available if a \\l;radar station\\u object\\radar; is working.\n", - - [RT_IO_OPEN] = "Open", - [RT_IO_SAVE] = "Save", - [RT_IO_LIST] = "Folder: %s", - [RT_IO_NAME] = "Name:", - [RT_IO_DIR] = "Folder:", - [RT_IO_PRIVATE] = "Private\\Private folder", - [RT_IO_PUBLIC] = "Public\\Common folder", - - [RT_GENERIC_DEV1] = "Developed by :", - [RT_GENERIC_DEV2] = "www.epsitec.com", - [RT_GENERIC_EDIT1] = " ", - [RT_GENERIC_EDIT2] = " ", - - [RT_INTERFACE_REC] = "Recorder" -}; - -const char * const strings_event[] = -{ - [EVENT_BUTTON_OK] = "OK", - [EVENT_BUTTON_CANCEL] = "Cancel", - [EVENT_BUTTON_NEXT] = "Next", - [EVENT_BUTTON_PREV] = "Previous", - [EVENT_BUTTON_QUIT] = "Menu (\\key quit;)", - - [EVENT_DIALOG_OK] = "OK", - [EVENT_DIALOG_CANCEL] = "Cancel", - - [EVENT_INTERFACE_TRAINER] = "Exercises\\Programming exercises", - [EVENT_INTERFACE_DEFI] = "Challenges\\Programming challenges", - [EVENT_INTERFACE_MISSION] = "Missions\\Select mission", - [EVENT_INTERFACE_FREE] = "Free game\\Free game without a specific goal", - [EVENT_INTERFACE_TEEN] = "Free game\\Free game without a specific goal", - [EVENT_INTERFACE_USER] = "User\\User levels", - [EVENT_INTERFACE_PROTO] = "Proto\\Prototypes under development", - [EVENT_INTERFACE_NAME] = "New player\\Choose player's name", - [EVENT_INTERFACE_SETUP] = "Options\\Preferences", - [EVENT_INTERFACE_AGAIN] = "Restart\\Restart the mission from the beginning", - [EVENT_INTERFACE_WRITE] = "Save\\Save the current mission ", - [EVENT_INTERFACE_READ] = "Load\\Load a saved mission", - [EVENT_INTERFACE_ABORT] = "\\Return to COLOBOT", - [EVENT_INTERFACE_QUIT] = "Quit\\Quit COLOBOT", - [EVENT_INTERFACE_BACK] = "<< Back \\Back to the previous screen", - [EVENT_INTERFACE_PLAY] = "Play\\Start mission!", - [EVENT_INTERFACE_SETUPd] = "Device\\Driver and resolution settings", - [EVENT_INTERFACE_SETUPg] = "Graphics\\Graphics settings", - [EVENT_INTERFACE_SETUPp] = "Game\\Game settings", - [EVENT_INTERFACE_SETUPc] = "Controls\\Keyboard, joystick and mouse settings", - [EVENT_INTERFACE_SETUPs] = "Sound\\Music and game sound volume", - [EVENT_INTERFACE_DEVICE] = "Unit", - [EVENT_INTERFACE_RESOL] = "Resolution", - [EVENT_INTERFACE_FULL] = "Full screen\\Full screen or window mode", - [EVENT_INTERFACE_APPLY] = "Apply changes\\Activates the changed settings", - - [EVENT_INTERFACE_TOTO] = "Robbie\\Your assistant", - [EVENT_INTERFACE_SHADOW] = "Shadows\\Shadows on the ground", - [EVENT_INTERFACE_GROUND] = "Marks on the ground\\Marks on the ground", - [EVENT_INTERFACE_DIRTY] = "Dust\\Dust and dirt on bots and buildings", - [EVENT_INTERFACE_FOG] = "Fog\\Fog", - [EVENT_INTERFACE_LENS] = "Sunbeams\\Sunbeams in the sky", - [EVENT_INTERFACE_SKY] = "Sky\\Clouds and nebulae", - [EVENT_INTERFACE_PLANET] = "Planets and stars\\Astronomical objects in the sky", - [EVENT_INTERFACE_LIGHT] = "Dynamic lighting\\Mobile light sources", - [EVENT_INTERFACE_PARTI] = "Number of particles\\Explosions, dust, reflections, etc.", - [EVENT_INTERFACE_CLIP] = "Depth of field\\Maximum visibility", - [EVENT_INTERFACE_DETAIL] = "Details\\Visual quality of 3D objects", - [EVENT_INTERFACE_TEXTURE] = "Textures\\Quality of textures ", - [EVENT_INTERFACE_GADGET] = "Num of decorative objects\\Number of purely ornamental objects", - [EVENT_INTERFACE_RAIN] = "Particles in the interface\\Steam clouds and sparks in the interface", - [EVENT_INTERFACE_GLINT] = "Reflections on the buttons \\Shiny buttons", - [EVENT_INTERFACE_TOOLTIP] = "Help balloons\\Explain the function of the buttons", - [EVENT_INTERFACE_MOVIES] = "Film sequences\\Films before and after the missions", - [EVENT_INTERFACE_NICERST] = "Exit film\\Film at the exit of exercises", - [EVENT_INTERFACE_HIMSELF] = "Friendly fire\\Your shooting can damage your own objects ", - [EVENT_INTERFACE_SCROLL] = "Scrolling\\Scrolling when the mouse touches right or left border", - [EVENT_INTERFACE_INVERTX] = "Mouse inversion X\\Inversion of the scrolling direction on the X axis", - [EVENT_INTERFACE_INVERTY] = "Mouse inversion Y\\Inversion of the scrolling direction on the Y axis", - [EVENT_INTERFACE_EFFECT] = "Quake at explosions\\The screen shakes at explosions", - [EVENT_INTERFACE_MOUSE] = "Mouse shadow\\Gives the mouse a shadow", - [EVENT_INTERFACE_EDITMODE] = "Automatic indent\\When program editing", - [EVENT_INTERFACE_EDITVALUE] = "Big indent\\Indent 2 or 4 spaces per level defined by braces", - [EVENT_INTERFACE_SOLUCE4] = "Access to solutions\\Show program \"4: Solution\" in the exercises", - - [EVENT_INTERFACE_KDEF] = "Standard controls\\Standard key functions", - [EVENT_INTERFACE_KLEFT] = "Turn left\\turns the bot to the left", - [EVENT_INTERFACE_KRIGHT] = "Turn right\\turns the bot to the right", - [EVENT_INTERFACE_KUP] = "Forward\\Moves forward", - [EVENT_INTERFACE_KDOWN] = "Backward\\Moves backward", - [EVENT_INTERFACE_KGUP] = "Climb\\Increases the power of the jet", - [EVENT_INTERFACE_KGDOWN] = "Descend\\Reduces the power of the jet", - [EVENT_INTERFACE_KCAMERA] = "Change camera\\Switches between onboard camera and following camera", - [EVENT_INTERFACE_KDESEL] = "Previous object\\Selects the previous object", - [EVENT_INTERFACE_KACTION] = "Standard action\\Standard action of the bot (take/grab, shoot, sniff, etc)", - [EVENT_INTERFACE_KNEAR] = "Camera closer\\Moves the camera forward", - [EVENT_INTERFACE_KAWAY] = "Camera back\\Moves the camera backward", - [EVENT_INTERFACE_KNEXT] = "Next object\\Selects the next object", - [EVENT_INTERFACE_KHUMAN] = "Select the astronaut\\Selects the astronaut", - [EVENT_INTERFACE_KQUIT] = "Quit\\Quit the current mission or exercise", - [EVENT_INTERFACE_KHELP] = "Instructions\\Shows the instructions for the current mission", - [EVENT_INTERFACE_KPROG] = "Programming help\\Gives more detailed help with programming", - [EVENT_INTERFACE_KCBOT] = "Key word help\\More detailed help about key words", - [EVENT_INTERFACE_KVISIT] = "Origin of last message\\Shows where the last message was sent from", - [EVENT_INTERFACE_KSPEED10] = "Speed 1.0x\\Normal speed", - [EVENT_INTERFACE_KSPEED15] = "Speed 1.5x\\1.5 times faster", - [EVENT_INTERFACE_KSPEED20] = "Speed 2.0x\\Double speed", - [EVENT_INTERFACE_KSPEED30] = "Speed 3.0x\\Three times faster", - - [EVENT_INTERFACE_VOLSOUND] = "Sound effects:\\Volume of engines, voice, shooting, etc.", - [EVENT_INTERFACE_VOLMUSIC] = "Background sound :\\Volume of audio tracks on the CD", - [EVENT_INTERFACE_SOUND3D] = "3D sound\\3D positioning of the sound", - - [EVENT_INTERFACE_MIN] = "Lowest\\Minimum graphic quality (highest frame rate)", - [EVENT_INTERFACE_NORM] = "Normal\\Normal graphic quality", - [EVENT_INTERFACE_MAX] = "Highest\\Highest graphic quality (lowest frame rate)", - - [EVENT_INTERFACE_SILENT] = "Mute\\No sound", - [EVENT_INTERFACE_NOISY] = "Normal\\Normal sound volume", - - [EVENT_INTERFACE_JOYSTICK] = "Use a joystick\\Joystick or keyboard", - [EVENT_INTERFACE_SOLUCE] = "Access to solution\\Shows the solution (detailed instructions for missions)", - - [EVENT_INTERFACE_NEDIT] = "\\New player name", - [EVENT_INTERFACE_NOK] = "OK\\Choose the selected player", - [EVENT_INTERFACE_NCANCEL] = "Cancel\\Keep current player name", - [EVENT_INTERFACE_NDELETE] = "Delete player\\Deletes the player from the list", - [EVENT_INTERFACE_NLABEL] = "Player name", - - [EVENT_INTERFACE_IOWRITE] = "Save\\Saves the current mission", - [EVENT_INTERFACE_IOREAD] = "Load\\Loads the selected mission", - [EVENT_INTERFACE_IOLIST] = "List of saved missions", - [EVENT_INTERFACE_IOLABEL] = "Filename:", - [EVENT_INTERFACE_IONAME] = "Mission name", - [EVENT_INTERFACE_IOIMAGE] = "Photography", - [EVENT_INTERFACE_IODELETE] = "Delete\\Deletes the selected file", - - [EVENT_INTERFACE_PERSO] = "Appearance\\Choose your appearance", - [EVENT_INTERFACE_POK] = "OK", - [EVENT_INTERFACE_PCANCEL] = "Cancel", - [EVENT_INTERFACE_PDEF] = "Standard\\Standard appearance settings", - [EVENT_INTERFACE_PHEAD] = "Head\\Face and hair", - [EVENT_INTERFACE_PBODY] = "Suit\\Astronaut suit", - [EVENT_INTERFACE_PLROT] = "\\Turn left", - [EVENT_INTERFACE_PRROT] = "\\Turn right", - [EVENT_INTERFACE_PCRa] = "Red", - [EVENT_INTERFACE_PCGa] = "Green", - [EVENT_INTERFACE_PCBa] = "Blue", - [EVENT_INTERFACE_PCRb] = "Red", - [EVENT_INTERFACE_PCGb] = "Green", - [EVENT_INTERFACE_PCBb] = "Blue", - [EVENT_INTERFACE_PFACE1] = "\\Face 1", - [EVENT_INTERFACE_PFACE2] = "\\Face 4", - [EVENT_INTERFACE_PFACE3] = "\\Face 3", - [EVENT_INTERFACE_PFACE4] = "\\Face 2", - [EVENT_INTERFACE_PGLASS0] = "\\No eyeglasses", - [EVENT_INTERFACE_PGLASS1] = "\\Eyeglasses 1", - [EVENT_INTERFACE_PGLASS2] = "\\Eyeglasses 2", - [EVENT_INTERFACE_PGLASS3] = "\\Eyeglasses 3", - [EVENT_INTERFACE_PGLASS4] = "\\Eyeglasses 4", - [EVENT_INTERFACE_PGLASS5] = "\\Eyeglasses 5", - - [EVENT_OBJECT_DESELECT] = "Previous selection (\\key desel;)", - [EVENT_OBJECT_LEFT] = "Turn left (\\key left;)", - [EVENT_OBJECT_RIGHT] = "Turn right (\\key right;)", - [EVENT_OBJECT_UP] = "Forward (\\key up;)", - [EVENT_OBJECT_DOWN] = "Backward (\\key down;)", - [EVENT_OBJECT_GASUP] = "Up (\\key gup;)", - [EVENT_OBJECT_GASDOWN] = "Down (\\key gdown;)", - [EVENT_OBJECT_HTAKE] = "Grab or drop (\\key action;)", - [EVENT_OBJECT_MTAKE] = "Grab or drop (\\key action;)", - [EVENT_OBJECT_MFRONT] = "..in front", - [EVENT_OBJECT_MBACK] = "..behind", - [EVENT_OBJECT_MPOWER] = "..power cell", - [EVENT_OBJECT_BHELP] = "Instructions for the mission (\\key help;)", - [EVENT_OBJECT_BTAKEOFF] = "Take off to finish the mission", - [EVENT_OBJECT_BDERRICK] = "Build a derrick", - [EVENT_OBJECT_BSTATION] = "Build a power station", - [EVENT_OBJECT_BFACTORY] = "Build a bot factory", - [EVENT_OBJECT_BREPAIR] = "Build a repair center", - [EVENT_OBJECT_BCONVERT] = "Build a converter", - [EVENT_OBJECT_BTOWER] = "Build a defense tower", - [EVENT_OBJECT_BRESEARCH] = "Build a research center", - [EVENT_OBJECT_BRADAR] = "Build a radar station", - [EVENT_OBJECT_BENERGY] = "Build a power cell factory", - [EVENT_OBJECT_BLABO] = "Build an autolab", - [EVENT_OBJECT_BNUCLEAR] = "Build a nuclear power plant", - [EVENT_OBJECT_BPARA] = "Build a lightning conductor", - [EVENT_OBJECT_BINFO] = "Build a exchange post", - [EVENT_OBJECT_GFLAT] = "Show if the ground is flat", - [EVENT_OBJECT_FCREATE] = "Plant a flag", - [EVENT_OBJECT_FDELETE] = "Remove a flag", - [EVENT_OBJECT_FCOLORb] = "\\Blue flags", - [EVENT_OBJECT_FCOLORr] = "\\Red flags", - [EVENT_OBJECT_FCOLORg] = "\\Green flags", - [EVENT_OBJECT_FCOLORy] = "\\Yellow flags", - [EVENT_OBJECT_FCOLORv] = "\\Violet flags", - [EVENT_OBJECT_FACTORYfa] = "Build a winged grabber", - [EVENT_OBJECT_FACTORYta] = "Build a tracked grabber", - [EVENT_OBJECT_FACTORYwa] = "Build a wheeled grabber", - [EVENT_OBJECT_FACTORYia] = "Build a legged grabber", - [EVENT_OBJECT_FACTORYfc] = "Build a winged shooter", - [EVENT_OBJECT_FACTORYtc] = "Build a tracked shooter", - [EVENT_OBJECT_FACTORYwc] = "Build a wheeled shooter", - [EVENT_OBJECT_FACTORYic] = "Build a legged shooter", - [EVENT_OBJECT_FACTORYfi] = "Build a winged orga shooter", - [EVENT_OBJECT_FACTORYti] = "Build a tracked orga shooter", - [EVENT_OBJECT_FACTORYwi] = "Build a wheeled orga shooter", - [EVENT_OBJECT_FACTORYii] = "Build a legged orga shooter", - [EVENT_OBJECT_FACTORYfs] = "Build a winged sniffer", - [EVENT_OBJECT_FACTORYts] = "Build a tracked sniffer", - [EVENT_OBJECT_FACTORYws] = "Build a wheeled sniffer", - [EVENT_OBJECT_FACTORYis] = "Build a legged sniffer", - [EVENT_OBJECT_FACTORYrt] = "Build a thumper", - [EVENT_OBJECT_FACTORYrc] = "Build a phazer shooter", - [EVENT_OBJECT_FACTORYrr] = "Build a recycler", - [EVENT_OBJECT_FACTORYrs] = "Build a shielder", - [EVENT_OBJECT_FACTORYsa] = "Build a subber", - [EVENT_OBJECT_RTANK] = "Run research program for tracked bots", - [EVENT_OBJECT_RFLY] = "Run research program for winged bots", - [EVENT_OBJECT_RTHUMP] = "Run research program for thumper", - [EVENT_OBJECT_RCANON] = "Run research program for shooter", - [EVENT_OBJECT_RTOWER] = "Run research program for defense tower", - [EVENT_OBJECT_RPHAZER] = "Run research program for phazer shooter", - [EVENT_OBJECT_RSHIELD] = "Run research program for shielder", - [EVENT_OBJECT_RATOMIC] = "Run research program for nuclear power", - [EVENT_OBJECT_RiPAW] = "Run research program for legged bots", - [EVENT_OBJECT_RiGUN] = "Run research program for orga shooter", - [EVENT_OBJECT_RESET] = "Return to start", - [EVENT_OBJECT_SEARCH] = "Sniff (\\key action;)", - [EVENT_OBJECT_TERRAFORM] = "Thump (\\key action;)", - [EVENT_OBJECT_FIRE] = "Shoot (\\key action;)", - [EVENT_OBJECT_RECOVER] = "Recycle (\\key action;)", - [EVENT_OBJECT_BEGSHIELD] = "Extend shield (\\key action;)", - [EVENT_OBJECT_ENDSHIELD] = "Withdraw shield (\\key action;)", - [EVENT_OBJECT_DIMSHIELD] = "Shield radius", - [EVENT_OBJECT_PROGRUN] = "Execute the selected program", - [EVENT_OBJECT_PROGEDIT] = "Edit the selected program", - [EVENT_OBJECT_INFOOK] = "\\SatCom on standby", - [EVENT_OBJECT_DELETE] = "Destroy the building", - [EVENT_OBJECT_GENERGY] = "Energy level", - [EVENT_OBJECT_GSHIELD] = "Shield level", - [EVENT_OBJECT_GRANGE] = "Jet temperature", - [EVENT_OBJECT_GPROGRESS] = "Still working ...", - [EVENT_OBJECT_GRADAR] = "Number of insects detected", - [EVENT_OBJECT_GINFO] = "Transmitted information", - [EVENT_OBJECT_COMPASS] = "Compass", - [EVENT_OBJECT_MAPZOOM] = "Zoom mini-map", - [EVENT_OBJECT_CAMERA] = "Camera (\\key camera;)", - [EVENT_OBJECT_CAMERAleft] = "Camera to left", - [EVENT_OBJECT_CAMERAright] = "Camera to right", - [EVENT_OBJECT_CAMERAnear] = "Camera nearest", - [EVENT_OBJECT_CAMERAaway] = "Camera awayest", - [EVENT_OBJECT_HELP] = "Help about selected object", - [EVENT_OBJECT_SOLUCE] = "Show the solution", - [EVENT_OBJECT_SHORTCUT00] = "Switch bots <-> buildings", - [EVENT_OBJECT_LIMIT] = "Show the range", - [EVENT_OBJECT_PEN0] = "\\Raise the pencil", - [EVENT_OBJECT_PEN1] = "\\Use the black pencil", - [EVENT_OBJECT_PEN2] = "\\Use the yellow pencil", - [EVENT_OBJECT_PEN3] = "\\Use the orange pencil", - [EVENT_OBJECT_PEN4] = "\\Use the red pencil", - [EVENT_OBJECT_PEN5] = "\\Use the purple pencil", - [EVENT_OBJECT_PEN6] = "\\Use the blue pencil", - [EVENT_OBJECT_PEN7] = "\\Use the green pencil", - [EVENT_OBJECT_PEN8] = "\\Use the brown pencil", - [EVENT_OBJECT_REC] = "\\Start recording", - [EVENT_OBJECT_STOP] = "\\Stop recording", - [EVENT_DT_VISIT0] = "Show the place", - [EVENT_DT_VISIT1] = "Show the place", - [EVENT_DT_VISIT2] = "Show the place", - [EVENT_DT_VISIT3] = "Show the place", - [EVENT_DT_VISIT4] = "Show the place", - [EVENT_DT_END] = "Continue", - [EVENT_CMD] = "Command line", - [EVENT_SPEED] = "Game speed", - - [EVENT_HYPER_PREV] = "Back", - [EVENT_HYPER_NEXT] = "Forward", - [EVENT_HYPER_HOME] = "Home", - [EVENT_HYPER_COPY] = "Copy", - [EVENT_HYPER_SIZE1] = "Size 1", - [EVENT_HYPER_SIZE2] = "Size 2", - [EVENT_HYPER_SIZE3] = "Size 3", - [EVENT_HYPER_SIZE4] = "Size 4", - [EVENT_HYPER_SIZE5] = "Size 5", - [EVENT_SATCOM_HUSTON] = "Instructions from Houston", - [EVENT_SATCOM_SAT] = "Satellite report", - [EVENT_SATCOM_LOADING] = "Programs dispatched by Houston", - [EVENT_SATCOM_OBJECT] = "List of objects", - [EVENT_SATCOM_PROG] = "Programming help", - [EVENT_SATCOM_SOLUCE] = "Solution", - - [EVENT_STUDIO_OK] = "OK\\Close program editor and return to game", - [EVENT_STUDIO_CANCEL] = "Cancel\\Cancel all changes", - [EVENT_STUDIO_NEW] = "New", - [EVENT_STUDIO_OPEN] = "Open (Ctrl+o)", - [EVENT_STUDIO_SAVE] = "Save (Ctrl+s)", - [EVENT_STUDIO_UNDO] = "Undo (Ctrl+z)", - [EVENT_STUDIO_CUT] = "Cut (Ctrl+x)", - [EVENT_STUDIO_COPY] = "Copy (Ctrl+c)", - [EVENT_STUDIO_PASTE] = "Paste (Ctrl+v)", - [EVENT_STUDIO_SIZE] = "Font size", - [EVENT_STUDIO_TOOL] = "Instructions (\\key help;)", - [EVENT_STUDIO_HELP] = "Programming help (\\key prog;)", - [EVENT_STUDIO_COMPILE] = "Compile", - [EVENT_STUDIO_RUN] = "Execute/stop", - [EVENT_STUDIO_REALTIME] = "Pause/continue", - [EVENT_STUDIO_STEP] = "One step" -}; - -const char * const strings_object[] = -{ - [OBJECT_PORTICO] = "Gantry crane", - [OBJECT_BASE] = "Spaceship", - [OBJECT_DERRICK] = "Derrick", - [OBJECT_FACTORY] = "Bot factory", - [OBJECT_REPAIR] = "Repair center", - [OBJECT_DESTROYER] = "Destroyer", - [OBJECT_STATION] = "Power station", - [OBJECT_CONVERT] = "Converts ore to titanium", - [OBJECT_TOWER] = "Defense tower", - [OBJECT_NEST] = "Nest", - [OBJECT_RESEARCH] = "Research center", - [OBJECT_RADAR] = "Radar station", - [OBJECT_INFO] = "Information exchange post", - [OBJECT_ENERGY] = "Power cell factory", - [OBJECT_LABO] = "Autolab", - [OBJECT_NUCLEAR] = "Nuclear power station", - [OBJECT_PARA] = "Lightning conductor", - [OBJECT_SAFE] = "Vault", - [OBJECT_HUSTON] = "Houston Mission Control", - [OBJECT_TARGET1] = "Target", - [OBJECT_TARGET2] = "Target", - [OBJECT_START] = "Start", - [OBJECT_END] = "Finish", - [OBJECT_STONE] = "Titanium ore", - [OBJECT_URANIUM] = "Uranium ore", - [OBJECT_BULLET] = "Organic matter", - [OBJECT_METAL] = "Titanium", - [OBJECT_POWER] = "Power cell", - [OBJECT_ATOMIC] = "Nuclear power cell", - [OBJECT_BBOX] = "Black box", - [OBJECT_KEYa] = "Key A", - [OBJECT_KEYb] = "Key B", - [OBJECT_KEYc] = "Key C", - [OBJECT_KEYd] = "Key D", - [OBJECT_TNT] = "Explosive", - [OBJECT_BOMB] = "Fixed mine", - [OBJECT_BAG] = "Survival kit", - [OBJECT_WAYPOINT] = "Checkpoint", - [OBJECT_FLAGb] = "Blue flag", - [OBJECT_FLAGr] = "Red flag", - [OBJECT_FLAGg] = "Green flag", - [OBJECT_FLAGy] = "Yellow flag", - [OBJECT_FLAGv] = "Violet flag", - [OBJECT_MARKPOWER] = "Energy deposit (site for power station)", - [OBJECT_MARKURANIUM] = "Uranium deposit (site for derrick)", - [OBJECT_MARKKEYa] = "Found key A (site for derrick)", - [OBJECT_MARKKEYb] = "Found key B (site for derrick)", - [OBJECT_MARKKEYc] = "Found key C (site for derrick)", - [OBJECT_MARKKEYd] = "Found key D (site for derrick)", - [OBJECT_MARKSTONE] = "Titanium deposit (site for derrick)", - [OBJECT_MOBILEft] = "Practice bot", - [OBJECT_MOBILEtt] = "Practice bot", - [OBJECT_MOBILEwt] = "Practice bot", - [OBJECT_MOBILEit] = "Practice bot", - [OBJECT_MOBILEfa] = "Winged grabber", - [OBJECT_MOBILEta] = "Tracked grabber", - [OBJECT_MOBILEwa] = "Wheeled grabber", - [OBJECT_MOBILEia] = "Legged grabber", - [OBJECT_MOBILEfc] = "Winged shooter", - [OBJECT_MOBILEtc] = "Tracked shooter", - [OBJECT_MOBILEwc] = "Wheeled shooter", - [OBJECT_MOBILEic] = "Legged shooter", - [OBJECT_MOBILEfi] = "Winged orga shooter", - [OBJECT_MOBILEti] = "Tracked orga shooter", - [OBJECT_MOBILEwi] = "Wheeled orga shooter", - [OBJECT_MOBILEii] = "Legged orga shooter", - [OBJECT_MOBILEfs] = "Winged sniffer", - [OBJECT_MOBILEts] = "Tracked sniffer", - [OBJECT_MOBILEws] = "Wheeled sniffer", - [OBJECT_MOBILEis] = "Legged sniffer", - [OBJECT_MOBILErt] = "Thumper", - [OBJECT_MOBILErc] = "Phazer shooter", - [OBJECT_MOBILErr] = "Recycler", - [OBJECT_MOBILErs] = "Shielder", - [OBJECT_MOBILEsa] = "Subber", - [OBJECT_MOBILEtg] = "Target bot", - [OBJECT_MOBILEdr] = "Drawer bot", - [OBJECT_TECH] = "Engineer", - [OBJECT_TOTO] = "Robbie", - [OBJECT_MOTHER] = "Alien Queen", - [OBJECT_ANT] = "Ant", - [OBJECT_SPIDER] = "Spider", - [OBJECT_BEE] = "Wasp", - [OBJECT_WORM] = "Worm", - [OBJECT_EGG] = "Egg", - [OBJECT_RUINmobilew1] = "Wreckage", - [OBJECT_RUINmobilew2] = "Wreckage", - [OBJECT_RUINmobilet1] = "Wreckage", - [OBJECT_RUINmobilet2] = "Wreckage", - [OBJECT_RUINmobiler1] = "Wreckage", - [OBJECT_RUINmobiler2] = "Wreckage", - [OBJECT_RUINfactory] = "Ruin", - [OBJECT_RUINdoor] = "Ruin", - [OBJECT_RUINsupport] = "Waste", - [OBJECT_RUINradar] = "Ruin", - [OBJECT_RUINconvert] = "Ruin", - [OBJECT_RUINbase] = "Spaceship ruin", - [OBJECT_RUINhead] = "Spaceship ruin", - [OBJECT_APOLLO1] = "Remains of Apollo mission", - [OBJECT_APOLLO3] = "Remains of Apollo mission", - [OBJECT_APOLLO4] = "Remains of Apollo mission", - [OBJECT_APOLLO5] = "Remains of Apollo mission", - [OBJECT_APOLLO2] = "Lunar Roving Vehicle" -}; - -const char * const strings_err[] = -{ - [ERR_CMD] = "Unknown command", - [ERR_MANIP_VEH] = "Inappropriate bot", - [ERR_MANIP_FLY] = "Impossible when flying", - [ERR_MANIP_BUSY] = "Already carrying something", - [ERR_MANIP_NIL] = "Nothing to grab", - [ERR_MANIP_MOTOR] = "Impossible when moving", - [ERR_MANIP_OCC] = "Place occupied", - [ERR_MANIP_FRIEND] = "No other robot", - [ERR_MANIP_RADIO] = "You can not carry a radioactive object", - [ERR_MANIP_WATER] = "You can not carry an object under water", - [ERR_MANIP_EMPTY] = "Nothing to drop", - [ERR_BUILD_FLY] = "Impossible when flying", - [ERR_BUILD_WATER] = "Impossible under water", - [ERR_BUILD_ENERGY] = "Not enough energy", - [ERR_BUILD_METALAWAY] = "Titanium too far away", - [ERR_BUILD_METALNEAR] = "Titanium too close", - [ERR_BUILD_METALINEX] = "No titanium around", - [ERR_BUILD_FLAT] = "Ground not flat enough", - [ERR_BUILD_FLATLIT] = "Flat ground not large enough", - [ERR_BUILD_BUSY] = "Place occupied", - [ERR_BUILD_BASE] = "Too close to space ship", - [ERR_BUILD_NARROW] = "Too close to a building", - [ERR_BUILD_MOTOR] = "Impossible when moving", - [ERR_SEARCH_FLY] = "Impossible when flying", - [ERR_SEARCH_VEH] = "Inappropriate bot", - [ERR_SEARCH_MOTOR] = "Impossible when moving", - [ERR_TERRA_VEH] = "Inappropriate bot", - [ERR_TERRA_ENERGY] = "Not enough energy", - [ERR_TERRA_FLOOR] = "Ground inappropriate", - [ERR_TERRA_BUILDING] = "Building too close", - [ERR_TERRA_OBJECT] = "Object too close", - [ERR_RECOVER_VEH] = "Inappropriate bot", - [ERR_RECOVER_ENERGY] = "Not enough energy", - [ERR_RECOVER_NULL] = "Nothing to recycle", - [ERR_SHIELD_VEH] = "Inappropriate bot", - [ERR_SHIELD_ENERGY] = "No more energy", - [ERR_MOVE_IMPOSSIBLE] = "Error in instruction move", - [ERR_FIND_IMPOSSIBLE] = "Object not found", - [ERR_GOTO_IMPOSSIBLE] = "Goto: inaccessible destination", - [ERR_GOTO_ITER] = "Goto: inaccessible destination", - [ERR_GOTO_BUSY] = "Goto: destination occupied", - [ERR_FIRE_VEH] = "Inappropriate bot", - [ERR_FIRE_ENERGY] = "Not enough energy", - [ERR_FIRE_FLY] = "Impossible when flying", - [ERR_CONVERT_EMPTY] = "No titanium ore to convert", - [ERR_DERRICK_NULL] = "No ore in the subsoil", - [ERR_STATION_NULL] = "No energy in the subsoil", - [ERR_TOWER_POWER] = "No power cell", - [ERR_TOWER_ENERGY] = "No more energy", - [ERR_RESEARCH_POWER] = "No power cell", - [ERR_RESEARCH_ENERGY] = "Not enough energy", - [ERR_RESEARCH_TYPE] = "Inappropriate cell type", - [ERR_RESEARCH_ALREADY]= "Research program already performed", - [ERR_ENERGY_NULL] = "No energy in the subsoil", - [ERR_ENERGY_LOW] = "Not enough energy yet", - [ERR_ENERGY_EMPTY] = "No titanium to transform", - [ERR_ENERGY_BAD] = "Transforms only titanium", - [ERR_BASE_DLOCK] = "Doors blocked by a robot or another object ", - [ERR_BASE_DHUMAN] = "You must get on the spaceship to take off ", - [ERR_LABO_NULL] = "Nothing to analyze", - [ERR_LABO_BAD] = "Analyzes only organic matter", - [ERR_LABO_ALREADY] = "Analysis already performed", - [ERR_NUCLEAR_NULL] = "No energy in the subsoil", - [ERR_NUCLEAR_LOW] = "Not yet enough energy", - [ERR_NUCLEAR_EMPTY] = "No uranium to transform", - [ERR_NUCLEAR_BAD] = "Transforms only uranium", - [ERR_FACTORY_NULL] = "No titanium", - [ERR_FACTORY_NEAR] = "Object too close", - [ERR_RESET_NEAR] = "Place occupied", - [ERR_INFO_NULL] = "No information exchange post within range", - [ERR_VEH_VIRUS] = "Program infected by a virus", - [ERR_BAT_VIRUS] = "Infected by a virus, temporarily out of order", - [ERR_VEH_POWER] = "No power cell", - [ERR_VEH_ENERGY] = "No more energy", - [ERR_FLAG_FLY] = "Impossible when flying", - [ERR_FLAG_WATER] = "Impossible when swimming", - [ERR_FLAG_MOTOR] = "Impossible when moving", - [ERR_FLAG_BUSY] = "Impossible when carrying an object", - [ERR_FLAG_CREATE] = "Too many flags of this color (maximum 5)", - [ERR_FLAG_PROXY] = "Too close to an existing flag", - [ERR_FLAG_DELETE] = "No flag nearby", - [ERR_MISSION_NOTERM] = "The mission is not accomplished yet (press \\key help; for more details)", - [ERR_DELETEMOBILE] = "Bot destroyed", - [ERR_DELETEBUILDING] = "Building destroyed", - [ERR_TOOMANY] = "Can not create this, there are too many objects", - [ERR_OBLIGATORYTOKEN] = "\"%s\" missing in this exercise", - [ERR_PROHIBITEDTOKEN] = "Do not use in this exercise", - - [INFO_BUILD] = "Building completed", - [INFO_CONVERT] = "Titanium available", - [INFO_RESEARCH] = "Research program completed", - [INFO_RESEARCHTANK] = "Plans for tracked robots available ", - [INFO_RESEARCHFLY] = "You can fly with the keys (\\key gup;) and (\\key gdown;)", - [INFO_RESEARCHTHUMP] = "Plans for thumper available", - [INFO_RESEARCHCANON] = "Plans for shooter available", - [INFO_RESEARCHTOWER] = "Plans for defense tower available", - [INFO_RESEARCHPHAZER] = "Plans for phazer shooter available", - [INFO_RESEARCHSHIELD] = "Plans for shielder available", - [INFO_RESEARCHATOMIC] = "Plans for nuclear power plant available", - [INFO_FACTORY] = "New bot available", - [INFO_LABO] = "Analysis performed", - [INFO_ENERGY] = "Power cell available", - [INFO_NUCLEAR] = "Nuclear power cell available", - [INFO_FINDING] = "You found a usable object", - [INFO_MARKPOWER] = "Found a site for power station", - [INFO_MARKURANIUM] = "Found a site for a derrick", - [INFO_MARKSTONE] = "Found a site for a derrick", - [INFO_MARKKEYa] = "Found a site for a derrick", - [INFO_MARKKEYb] = "Found a site for a derrick", - [INFO_MARKKEYc] = "Found a site for a derrick", - [INFO_MARKKEYd] = "Found a site for a derrick", - [INFO_WIN] = "<<< Well done, mission accomplished >>>", - [INFO_LOST] = "<<< Sorry, mission failed >>>", - [INFO_LOSTq] = "<<< Sorry, mission failed >>>", - [INFO_WRITEOK] = "Current mission saved", - [INFO_DELETEPATH] = "Checkpoint crossed", - [INFO_DELETEMOTHER] = "Alien Queen killed", - [INFO_DELETEANT] = "Ant fatally wounded", - [INFO_DELETEBEE] = "Wasp fatally wounded", - [INFO_DELETEWORM] = "Worm fatally wounded", - [INFO_DELETESPIDER] = "Spider fatally wounded", - [INFO_BEGINSATCOM] = "Press \\key help; to read instructions on your SatCom" -}; - -const char * const strings_cbot[] = -{ - [TX_OPENPAR] = "Opening bracket missing", - [TX_CLOSEPAR] = "Closing bracket missing ", - [TX_NOTBOOL] = "The expression must return a boolean value", - [TX_UNDEFVAR] = "Variable not declared", - [TX_BADLEFT] = "Assignment impossible", - [TX_ENDOF] = "Semicolon terminator missing", - [TX_OUTCASE] = "Instruction \"case\" outside a block \"switch\"", - [TX_NOTERM] = "Instructions after the final closing brace", - [TX_CLOSEBLK] = "End of block missing", - [TX_ELSEWITHOUTIF] = "Instruction \"else\" without corresponding \"if\" ", - [TX_OPENBLK] = "Opening brace missing ", - [TX_BADTYPE] = "Wrong type for the assignment", - [TX_REDEFVAR] = "A variable can not be declared twice", - [TX_BAD2TYPE] = "The types of the two operands are incompatible ", - [TX_UNDEFCALL] = "Unknown function", - [TX_MISDOTS] = "Sign \" : \" missing", - [TX_WHILE] = "Keyword \"while\" missing", - [TX_BREAK] = "Instruction \"break\" outside a loop", - [TX_LABEL] = "A label must be followed by \"for\", \"while\", \"do\" or \"switch\"", - [TX_NOLABEL] = "This label does not exist", - [TX_NOCASE] = "Instruction \"case\" missing", - [TX_BADNUM] = "Number missing", - [TX_VOID] = "Void parameter", - [TX_NOTYP] = "Type declaration missing", - [TX_NOVAR] = "Variable name missing", - [TX_NOFONC] = "Function name missing", - [TX_OVERPARAM] = "Too many parameters", - [TX_REDEF] = "Function already exists", - [TX_LOWPARAM] = "Parameters missing ", - [TX_BADPARAM] = "No function with this name accepts this kind of parameter", - [TX_NUMPARAM] = "No function with this name accepts this number of parameters", - [TX_NOITEM] = "This is not a member of this class", - [TX_DOT] = "This object is not a member of a class", - [TX_NOCONST] = "Appropriate constructor missing", - [TX_REDEFCLASS] = "This class already exists", - [TX_CLBRK] = "\" ] \" missing", - [TX_RESERVED] = "Reserved keyword of CBOT language", - [TX_BADNEW] = "Bad argument for \"new\"", - [TX_OPBRK] = "\" [ \" expected", - [TX_BADSTRING] = "String missing", - [TX_BADINDEX] = "Incorrect index type", - [TX_PRIVATE] = "Private element", - [TX_NOPUBLIC] = "Public required", - [TX_DIVZERO] = "Dividing by zero", - [TX_NOTINIT] = "Variable not initialized", - [TX_BADTHROW] = "Negative value rejected by \"throw\"", - [TX_NORETVAL] = "The function returned no value ", - [TX_NORUN] = "No function running", - [TX_NOCALL] = "Calling an unknown function", - [TX_NOCLASS] = "This class does not exist", - [TX_NULLPT] = "Unknown Object", - [TX_OPNAN] = "Operation impossible with value \"nan\"", - [TX_OUTARRAY] = "Access beyond array limit", - [TX_STACKOVER] = "Stack overflow", - [TX_DELETEDPT] = "Illegal object", - [TX_FILEOPEN] = "Can't open file", - [TX_NOTOPEN] = "File not open", - [TX_ERRREAD] = "Read error", - [TX_ERRWRITE] = "Write error" -}; - -#define N_ELTS(Array) (sizeof(Array) / sizeof(Array[0])) - -const int strings_text_len = N_ELTS(strings_text); -const int strings_event_len = N_ELTS(strings_event); -const int strings_object_len = N_ELTS(strings_object); -const int strings_err_len = N_ELTS(strings_err); -const int strings_cbot_len = N_ELTS(strings_cbot); diff --git a/src/common/singleton.h b/src/common/singleton.h index 7407504..c1b28d9 100644 --- a/src/common/singleton.h +++ b/src/common/singleton.h @@ -19,7 +19,6 @@ * \brief CSingleton base class for singletons */ - #pragma once #include <cassert> diff --git a/src/common/stringutils.cpp b/src/common/stringutils.cpp index 12a3179..db486f0 100644 --- a/src/common/stringutils.cpp +++ b/src/common/stringutils.cpp @@ -14,9 +14,8 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// stringutils.cpp -#include "stringutils.h" +#include "common/stringutils.h" std::string StrUtils::Replace(const std::string &str, const std::string &oldStr, const std::string &newStr) diff --git a/src/graphics/engine/lightning.cpp b/src/graphics/engine/lightning.cpp index 337d578..d256599 100644 --- a/src/graphics/engine/lightning.cpp +++ b/src/graphics/engine/lightning.cpp @@ -108,7 +108,7 @@ bool CLightning::EventFrame(const Event &event) } else if (type == OBJECT_PARA) { - CAutoPara* automat = dynamic_cast<CAutoPara*>(obj->GetAuto()); + CAutoPara* automat = static_cast<CAutoPara*>(obj->GetAuto()); if (automat != nullptr) automat->StartLightning(); diff --git a/src/graphics/engine/particle.h b/src/graphics/engine/particle.h index d03b3fc..90aec55 100644 --- a/src/graphics/engine/particle.h +++ b/src/graphics/engine/particle.h @@ -23,7 +23,7 @@ #pragma once -#include "engine.h" +#include "graphics/engine/engine.h" #include "sound/sound.h" diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp index 6355aed..66c73a9 100644 --- a/src/graphics/engine/text.cpp +++ b/src/graphics/engine/text.cpp @@ -407,10 +407,10 @@ int CText::Justify(const std::string &text, FontType font, float size, float wid if (len >= 3) ch.c3 = text[index+2]; - index += len; - if (ch.c1 == '\n') + { return index+1; + } if (ch.c1 == ' ' ) cut = index+1; @@ -421,6 +421,7 @@ int CText::Justify(const std::string &text, FontType font, float size, float wid if (cut == 0) return index; else return cut; } + index += len; } return index; diff --git a/src/graphics/engine/text.h b/src/graphics/engine/text.h index 4575c37..57fad43 100644 --- a/src/graphics/engine/text.h +++ b/src/graphics/engine/text.h @@ -227,7 +227,7 @@ class CText { public: CText(CInstanceManager *iMan, CEngine* engine); - ~CText(); + virtual ~CText(); //! Sets the device to be used void SetDevice(CDevice *device); @@ -269,12 +269,12 @@ public: float GetHeight(FontType font, float size); //! Returns width of string (multi-format) - float GetStringWidth(const std::string &text, + TEST_VIRTUAL float GetStringWidth(const std::string &text, std::map<unsigned int, FontMetaChar> &format, float size); //! Returns width of string (single font) - float GetStringWidth(const std::string &text, FontType font, float size); + TEST_VIRTUAL float GetStringWidth(const std::string &text, FontType font, float size); //! Returns width of single character - float GetCharWidth(UTF8Char ch, FontType font, float size, float offset); + TEST_VIRTUAL float GetCharWidth(UTF8Char ch, FontType font, float size, float offset); //! Justifies a line of text (multi-format) int Justify(const std::string &text, std::map<unsigned int, FontMetaChar> &format, diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp index 7bfd843..94b0dbc 100644 --- a/src/graphics/opengl/gldevice.cpp +++ b/src/graphics/opengl/gldevice.cpp @@ -48,6 +48,10 @@ // Graphics module namespace namespace Gfx { +GLDeviceConfig::GLDeviceConfig() +{ + LoadDefault(); +} void GLDeviceConfig::LoadDefault() { diff --git a/src/graphics/opengl/gldevice.h b/src/graphics/opengl/gldevice.h index cda7b02..87c1247 100644 --- a/src/graphics/opengl/gldevice.h +++ b/src/graphics/opengl/gldevice.h @@ -52,7 +52,7 @@ struct GLDeviceConfig : public DeviceConfig bool hardwareAccel; //! Constructor calls LoadDefaults() - GLDeviceConfig() { LoadDefault(); } + GLDeviceConfig(); //! Loads the default values void LoadDefault(); diff --git a/src/object/auto/auto.cpp b/src/object/auto/auto.cpp index 711497d..4003193 100644 --- a/src/object/auto/auto.cpp +++ b/src/object/auto/auto.cpp @@ -352,7 +352,7 @@ void CAuto::UpdateInterface(float rTime) } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAuto::GetError() { @@ -421,7 +421,7 @@ bool CAuto::Write(char *line) return false; } -// Geturn all settings to the controller. +// Return all settings to the controller. bool CAuto::Read(char *line) { diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp index d7b3ca1..8370517 100644 --- a/src/object/auto/autobase.cpp +++ b/src/object/auto/autobase.cpp @@ -1198,7 +1198,7 @@ bool CAutoBase::Abort() } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoBase::GetError() { diff --git a/src/object/auto/autoconvert.cpp b/src/object/auto/autoconvert.cpp index ec4392b..a550697 100644 --- a/src/object/auto/autoconvert.cpp +++ b/src/object/auto/autoconvert.cpp @@ -285,7 +285,7 @@ bool CAutoConvert::EventProcess(const Event &event) return true; } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoConvert::GetError() { diff --git a/src/object/auto/autodestroyer.cpp b/src/object/auto/autodestroyer.cpp index 740f600..ecf7c94 100644 --- a/src/object/auto/autodestroyer.cpp +++ b/src/object/auto/autodestroyer.cpp @@ -316,7 +316,7 @@ bool CAutoDestroyer::SearchVehicle() } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoDestroyer::GetError() { diff --git a/src/object/auto/autoegg.cpp b/src/object/auto/autoegg.cpp index 35a6add..5b90ef9 100644 --- a/src/object/auto/autoegg.cpp +++ b/src/object/auto/autoegg.cpp @@ -258,7 +258,7 @@ Error CAutoEgg::IsEnded() } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoEgg::GetError() { diff --git a/src/object/auto/autoenergy.cpp b/src/object/auto/autoenergy.cpp index 18a21ab..c63dede 100644 --- a/src/object/auto/autoenergy.cpp +++ b/src/object/auto/autoenergy.cpp @@ -508,7 +508,7 @@ CObject* CAutoEnergy::SearchPower() } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoEnergy::GetError() { diff --git a/src/object/auto/autoflag.cpp b/src/object/auto/autoflag.cpp index e88ee3a..c2dec5c 100644 --- a/src/object/auto/autoflag.cpp +++ b/src/object/auto/autoflag.cpp @@ -153,7 +153,7 @@ bool CAutoFlag::EventProcess(const Event &event) } -// Geturns an error due the state of the automation +// Returns an error due the state of the automation Error CAutoFlag::GetError() { diff --git a/src/object/auto/autohuston.cpp b/src/object/auto/autohuston.cpp index 1e81a65..1b6778d 100644 --- a/src/object/auto/autohuston.cpp +++ b/src/object/auto/autohuston.cpp @@ -286,7 +286,7 @@ bool CAutoHuston::CreateInterface(bool bSelect) } -// Geturns an error due to state of the automation. +// Returns an error due to state of the automation. Error CAutoHuston::GetError() { diff --git a/src/object/auto/autoinfo.cpp b/src/object/auto/autoinfo.cpp index 78cc249..1245034 100644 --- a/src/object/auto/autoinfo.cpp +++ b/src/object/auto/autoinfo.cpp @@ -339,7 +339,7 @@ bool CAutoInfo::EventProcess(const Event &event) } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoInfo::GetError() { diff --git a/src/object/auto/autokid.cpp b/src/object/auto/autokid.cpp index 7004e6b..64cd39a 100644 --- a/src/object/auto/autokid.cpp +++ b/src/object/auto/autokid.cpp @@ -191,7 +191,7 @@ bool CAutoKid::EventProcess(const Event &event) } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoKid::GetError() { diff --git a/src/object/auto/autolabo.cpp b/src/object/auto/autolabo.cpp index af780e0..70bcc5e 100644 --- a/src/object/auto/autolabo.cpp +++ b/src/object/auto/autolabo.cpp @@ -423,7 +423,7 @@ bool CAutoLabo::EventProcess(const Event &event) } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoLabo::GetError() { diff --git a/src/object/auto/automush.cpp b/src/object/auto/automush.cpp index d7aa98e..cb94590 100644 --- a/src/object/auto/automush.cpp +++ b/src/object/auto/automush.cpp @@ -289,7 +289,7 @@ bool CAutoMush::SearchTarget() } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoMush::GetError() { diff --git a/src/object/auto/autonest.cpp b/src/object/auto/autonest.cpp index 4a8132a..99927bd 100644 --- a/src/object/auto/autonest.cpp +++ b/src/object/auto/autonest.cpp @@ -219,7 +219,7 @@ CObject* CAutoNest::SearchFret() } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoNest::GetError() { diff --git a/src/object/auto/autonuclear.cpp b/src/object/auto/autonuclear.cpp index bb20dde..375acf0 100644 --- a/src/object/auto/autonuclear.cpp +++ b/src/object/auto/autonuclear.cpp @@ -410,7 +410,7 @@ void CAutoNuclear::CreatePower() } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoNuclear::GetError() { diff --git a/src/object/auto/autopara.cpp b/src/object/auto/autopara.cpp index b52344f..a3082f5 100644 --- a/src/object/auto/autopara.cpp +++ b/src/object/auto/autopara.cpp @@ -221,7 +221,7 @@ bool CAutoPara::CreateInterface(bool bSelect) } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoPara::GetError() { diff --git a/src/object/auto/autoportico.cpp b/src/object/auto/autoportico.cpp index 9d04982..3b3bf84 100644 --- a/src/object/auto/autoportico.cpp +++ b/src/object/auto/autoportico.cpp @@ -385,7 +385,7 @@ bool CAutoPortico::Abort() } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoPortico::GetError() { diff --git a/src/object/auto/autoradar.cpp b/src/object/auto/autoradar.cpp index b586521..4214d17 100644 --- a/src/object/auto/autoradar.cpp +++ b/src/object/auto/autoradar.cpp @@ -183,7 +183,7 @@ bool CAutoRadar::EventProcess(const Event &event) } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoRadar::GetError() { diff --git a/src/object/auto/autorepair.cpp b/src/object/auto/autorepair.cpp index 4662699..cf4f33e 100644 --- a/src/object/auto/autorepair.cpp +++ b/src/object/auto/autorepair.cpp @@ -283,7 +283,7 @@ CObject* CAutoRepair::SearchVehicle() } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoRepair::GetError() { diff --git a/src/object/auto/autoresearch.cpp b/src/object/auto/autoresearch.cpp index a3ce464..9f423ec 100644 --- a/src/object/auto/autoresearch.cpp +++ b/src/object/auto/autoresearch.cpp @@ -263,7 +263,7 @@ bool CAutoResearch::EventProcess(const Event &event) } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoResearch::GetError() { diff --git a/src/object/auto/autoroot.cpp b/src/object/auto/autoroot.cpp index 4413d56..196ed5d 100644 --- a/src/object/auto/autoroot.cpp +++ b/src/object/auto/autoroot.cpp @@ -108,7 +108,7 @@ bool CAutoRoot::EventProcess(const Event &event) } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoRoot::GetError() { diff --git a/src/object/auto/autosafe.cpp b/src/object/auto/autosafe.cpp index ea0c183..e89acea 100644 --- a/src/object/auto/autosafe.cpp +++ b/src/object/auto/autosafe.cpp @@ -334,7 +334,7 @@ bool CAutoSafe::CreateInterface(bool bSelect) } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoSafe::GetError() { diff --git a/src/object/auto/autostation.cpp b/src/object/auto/autostation.cpp index 1dbcf26..e99ae4b 100644 --- a/src/object/auto/autostation.cpp +++ b/src/object/auto/autostation.cpp @@ -288,7 +288,7 @@ CObject* CAutoStation::SearchVehicle() } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoStation::GetError() { diff --git a/src/object/auto/autotower.cpp b/src/object/auto/autotower.cpp index 7674794..84dcd85 100644 --- a/src/object/auto/autotower.cpp +++ b/src/object/auto/autotower.cpp @@ -313,7 +313,7 @@ CObject* CAutoTower::SearchTarget(Math::Vector &impact) } -// Geturns an error due the state of the automation. +// Returns an error due the state of the automation. Error CAutoTower::GetError() { diff --git a/src/object/brain.cpp b/src/object/brain.cpp index 7b580d7..4ce1bf8 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -19,14 +19,20 @@ #include "common/misc.h" #include "common/iman.h" + #include "graphics/core/color.h" #include "graphics/engine/terrain.h" + #include "object/motion/motion.h" #include "object/task/taskmanager.h" + #include "physics/physics.h" + #include "script/cmdtoken.h" #include "script/script.h" + #include "sound/sound.h" + #include "ui/displaytext.h" #include "ui/interface.h" #include "ui/slider.h" @@ -203,8 +209,8 @@ bool CBrain::EventProcess(const Event &event) action = EVENT_NULL; if ( event.type == EVENT_KEY_DOWN && - (event.key.key == m_main->GetInputBinding(INPUT_SLOT_ACTION).key || - event.key.key == m_main->GetInputBinding(INPUT_SLOT_ACTION).joy ) && + (event.key.key == m_main->GetInputBinding(INPUT_SLOT_ACTION).primary || + event.key.key == m_main->GetInputBinding(INPUT_SLOT_ACTION).secondary ) && !m_main->GetEditLock() ) { pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0)); @@ -803,7 +809,7 @@ void CBrain::StopTask() // Introduces a virus into a program. -// Geturns true if it was inserted. +// Returns true if it was inserted. bool CBrain::IntroduceVirus() { @@ -2450,7 +2456,7 @@ void CBrain::UpdateScript(Ui::CWindow *pw) pl->ShowSelect(true); } -// Geturns the rank of selected script. +// Returns the rank of selected script. int CBrain::GetSelScript() { @@ -2590,7 +2596,7 @@ void CBrain::RunProgram(int rank) } } -// Geturns the first free program. +// Returns the first free program. int CBrain::FreeProgram() { @@ -2604,7 +2610,7 @@ int CBrain::FreeProgram() } -// Geturns the current program. +// Returns the current program. int CBrain::GetProgram() { diff --git a/src/object/brain.h b/src/object/brain.h index 008fb67..ce7116e 100644 --- a/src/object/brain.h +++ b/src/object/brain.h @@ -14,10 +14,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/. -// brain.h +/** + * \file object/brain.h + * \brief CBrain - dispatches commands to objects + */ #pragma once + #include "common/event.h" #include "common/misc.h" diff --git a/src/object/mainmovie.cpp b/src/object/mainmovie.cpp index 346f370..9aaf345 100644 --- a/src/object/mainmovie.cpp +++ b/src/object/mainmovie.cpp @@ -14,20 +14,18 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// mainmovie.cpp - - -#include <stdio.h> - #include "object/mainmovie.h" -#include "math/geometry.h" #include "common/iman.h" + +#include "math/geometry.h" + #include "object/motion/motionhuman.h" #include "object/robotmain.h" +#include <stdio.h> // Constructor of the application card. @@ -219,14 +217,14 @@ bool CMainMovie::EventProcess(const Event &event) } -// Geturns the type of the current movie. +// Returns the type of the current movie. MainMovieType CMainMovie::GetType() { return m_type; } -// Geturns the type of movie stop. +// Returns the type of movie stop. MainMovieType CMainMovie::GetStopType() { diff --git a/src/object/mainmovie.h b/src/object/mainmovie.h index 27e4df3..eba21eb 100644 --- a/src/object/mainmovie.h +++ b/src/object/mainmovie.h @@ -14,7 +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/. -// mainmovie.h +/** + * \file object/mainmovie.h + * \brief CMainMovie - control over movie sequences + */ #pragma once diff --git a/src/object/motion/motion.cpp b/src/object/motion/motion.cpp index ff038ae..605091f 100644 --- a/src/object/motion/motion.cpp +++ b/src/object/motion/motion.cpp @@ -150,7 +150,7 @@ Error CMotion::SetAction(int action, float time) return ERR_OK; } -// Geturns the current action. +// Returns the current action. int CMotion::GetAction() { diff --git a/src/object/object.cpp b/src/object/object.cpp index 5a1631f..2eade93 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -17,7 +17,6 @@ #include "object/object.h" - #include "CBot/CBotDll.h" #include "app/app.h" @@ -830,7 +829,7 @@ void CObject::InitPart(int part) } // Creates a new part, and returns its number. -// Geturns -1 on error. +// Returns -1 on error. int CObject::CreatePart() { @@ -891,7 +890,7 @@ void CObject::SetObjectRank(int part, int objRank) m_objectPart[part].object = objRank; } -// Geturns the number of part. +// Returns the number of part. int CObject::GetObjectRank(int part) { @@ -1164,7 +1163,7 @@ bool CObject::Write(char *line) return true; } -// Geturns all parameters of the object. +// Returns all parameters of the object. bool CObject::Read(char *line) { @@ -1299,14 +1298,14 @@ int CObject::CreateCrashSphere(Math::Vector pos, float radius, Sound sound, return m_crashSphereUsed++; } -// Geturns the number of spheres. +// Returns the number of spheres. int CObject::GetCrashSphereTotal() { return m_crashSphereUsed; } -// Geturns a sphere for collisions. +// Returns a sphere for collisions. // The position is absolute in the world. bool CObject::GetCrashSphere(int rank, Math::Vector &pos, float &radius) @@ -1318,7 +1317,7 @@ bool CObject::GetCrashSphere(int rank, Math::Vector &pos, float &radius) return false; } - // Geturns to the sphere collisions, + // Returns 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,14 +1341,14 @@ bool CObject::GetCrashSphere(int rank, Math::Vector &pos, float &radius) return true; } -// Geturns the hardness of a sphere. +// Returns the hardness of a sphere. Sound CObject::GetCrashSphereSound(int rank) { return m_crashSphereSound[rank]; } -// Geturns the hardness of a sphere. +// Returns the hardness of a sphere. float CObject::GetCrashSphereHardness(int rank) { @@ -1383,7 +1382,7 @@ void CObject::SetGlobalSphere(Math::Vector pos, float radius) m_globalSphereRadius = radius*zoom; } -// Geturns the global sphere, in the world. +// Returns the global sphere, in the world. void CObject::GetGlobalSphere(Math::Vector &pos, float &radius) { @@ -1416,7 +1415,7 @@ void CObject::SetShieldRadius(float radius) m_shieldRadius = radius; } -// Geturns the radius of the shield. +// Returns the radius of the shield. float CObject::GetShieldRadius() { @@ -1787,7 +1786,7 @@ float CObject::GetZoomZ(int part) } -// Geturns the water level. +// Returns the water level. float CObject::GetWaterLevel() { @@ -2023,7 +2022,7 @@ float CObject::GetCmdLine(int rank) } -// Geturns matrices of an object portion. +// Returns matrices of an object portion. Math::Matrix* CObject::GetRotateMatrix(int part) { @@ -2277,7 +2276,7 @@ bool CObject::CreateShadowLight(float height, Gfx::Color color) return true; } -// Geturns the number of negative light shade. +// Returns the number of negative light shade. int CObject::GetShadowLight() { @@ -2318,7 +2317,7 @@ bool CObject::CreateEffectLight(float height, Gfx::Color color) return true; } -// Geturns the number of light effects. +// Returns the number of light effects. int CObject::GetEffectLight() { @@ -5808,7 +5807,7 @@ bool CObject::RunProgram(int rank) // Calculates the matrix for transforming the object. -// Geturns true if the matrix has changed. +// Returns true if the matrix has changed. // The rotations occur in the order Y, Z and X. bool CObject::UpdateTransformObject(int part, bool bForceUpdate) @@ -6452,7 +6451,7 @@ Character* CObject::GetCharacter() } -// Geturns the absolute time. +// Returns the absolute time. float CObject::GetAbsTime() { @@ -7406,35 +7405,35 @@ CScript* CObject::GetRunScript() return m_runScript; } -// Geturns the variables of "this" for CBOT. +// Returns the variables of "this" for CBOT. CBotVar* CObject::GetBotVar() { return m_botVar; } -// Geturns the physics associated to the object. +// Returns the physics associated to the object. CPhysics* CObject::GetPhysics() { return m_physics; } -// Geturns the brain associated to the object. +// Returns the brain associated to the object. CBrain* CObject::GetBrain() { return m_brain; } -// Geturns the movement associated to the object. +// Returns the movement associated to the object. CMotion* CObject::GetMotion() { return m_motion; } -// Geturns the controller associated to the object. +// Returns the controller associated to the object. CAuto* CObject::GetAuto() { diff --git a/src/object/object.h b/src/object/object.h index b555856..8d8baca 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -14,7 +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/. -// object.h +/** + * \file object/object.h + * \brief CObject - base class for all game objects + */ #pragma once @@ -22,8 +25,6 @@ #include "graphics/engine/engine.h" #include "graphics/engine/camera.h" -#include "object/object_ids.h" - #include "sound/sound.h" @@ -44,6 +45,258 @@ class CDisplayText; } +/** + * \enum ObjectType + * \brief Type of game object + */ +enum ObjectType +{ + OBJECT_NULL = 0, //! < object destroyed + OBJECT_FIX = 1, //! < stationary scenery + OBJECT_PORTICO = 2, //! < gantry + OBJECT_BASE = 3, //! < great main base + OBJECT_DERRICK = 4, //! < derrick set + OBJECT_FACTORY = 5, //! < factory set + OBJECT_STATION = 6, //! < recharging station + OBJECT_CONVERT = 7, //! < converter station + OBJECT_REPAIR = 8, //! < reparation + OBJECT_TOWER = 9, //! < defense tower + OBJECT_NEST = 10, //! < nest + OBJECT_RESEARCH = 11, //! < research center + OBJECT_RADAR = 12, //! < radar + OBJECT_ENERGY = 13, //! < energy factory + OBJECT_LABO = 14, //! < analytical laboratory for insect + OBJECT_NUCLEAR = 15, //! < nuclear power plant + OBJECT_START = 16, //! < starting + OBJECT_END = 17, //! < finish + OBJECT_INFO = 18, //! < information terminal + OBJECT_PARA = 19, //! < lightning conductor + OBJECT_TARGET1 = 20, //! < gate target + OBJECT_TARGET2 = 21, //! < center target + OBJECT_SAFE = 22, //! < safe + OBJECT_HUSTON = 23, //! < control centre + OBJECT_DESTROYER = 24, //! < destroyer + OBJECT_FRET = 30, //! < transportable + OBJECT_STONE = 31, //! < stone + OBJECT_URANIUM = 32, //! < uranium + OBJECT_METAL = 33, //! < metal + OBJECT_POWER = 34, //! < normal battery + OBJECT_ATOMIC = 35, //! < atomic battery + OBJECT_BULLET = 36, //! < bullet + OBJECT_BBOX = 37, //! < black-box + OBJECT_TNT = 38, //! < box of TNT + OBJECT_SCRAP1 = 40, //! < metal waste + OBJECT_SCRAP2 = 41, //! < metal waste + OBJECT_SCRAP3 = 42, //! < metal waste + OBJECT_SCRAP4 = 43, //! < plastic waste + OBJECT_SCRAP5 = 44, //! < plastic waste + OBJECT_MARKPOWER = 50, //! < mark underground energy source + OBJECT_MARKSTONE = 51, //! < mark underground ore + OBJECT_MARKURANIUM = 52, //! < mark underground uranium + OBJECT_MARKKEYa = 53, //! < mark underground key + OBJECT_MARKKEYb = 54, //! < mark underground key + OBJECT_MARKKEYc = 55, //! < mark underground key + OBJECT_MARKKEYd = 56, //! < mark underground key + OBJECT_BOMB = 60, //! < bomb + OBJECT_WINFIRE = 61, //! < fireworks + OBJECT_SHOW = 62, //! < shows a place + OBJECT_BAG = 63, //! < survival bag + OBJECT_PLANT0 = 70, //! < plant 0 + OBJECT_PLANT1 = 71, //! < plant 1 + OBJECT_PLANT2 = 72, //! < plant 2 + OBJECT_PLANT3 = 73, //! < plant 3 + OBJECT_PLANT4 = 74, //! < plant 4 + OBJECT_PLANT5 = 75, //! < plant 5 + OBJECT_PLANT6 = 76, //! < plant 6 + OBJECT_PLANT7 = 77, //! < plant 7 + OBJECT_PLANT8 = 78, //! < plant 8 + OBJECT_PLANT9 = 79, //! < plant 9 + OBJECT_PLANT10 = 80, //! < plant 10 + OBJECT_PLANT11 = 81, //! < plant 11 + OBJECT_PLANT12 = 82, //! < plant 12 + OBJECT_PLANT13 = 83, //! < plant 13 + OBJECT_PLANT14 = 84, //! < plant 14 + OBJECT_PLANT15 = 85, //! < plant 15 + OBJECT_PLANT16 = 86, //! < plant 16 + OBJECT_PLANT17 = 87, //! < plant 17 + OBJECT_PLANT18 = 88, //! < plant 18 + OBJECT_PLANT19 = 89, //! < plant 19 + OBJECT_TREE0 = 90, //! < tree 0 + OBJECT_TREE1 = 91, //! < tree 1 + OBJECT_TREE2 = 92, //! < tree 2 + OBJECT_TREE3 = 93, //! < tree 3 + OBJECT_TREE4 = 94, //! < tree 4 + OBJECT_TREE5 = 95, //! < tree 5 + OBJECT_TREE6 = 96, //! < tree 6 + OBJECT_TREE7 = 97, //! < tree 7 + OBJECT_TREE8 = 98, //! < tree 8 + OBJECT_TREE9 = 99, //! < tree 9 + OBJECT_MOBILEwt = 100, //! < wheel-trainer + OBJECT_MOBILEtt = 101, //! < track-trainer + OBJECT_MOBILEft = 102, //! < fly-trainer + OBJECT_MOBILEit = 103, //! < insect-trainer + OBJECT_MOBILEwa = 110, //! < wheel-arm + OBJECT_MOBILEta = 111, //! < track-arm + OBJECT_MOBILEfa = 112, //! < fly-arm + OBJECT_MOBILEia = 113, //! < insect-arm + OBJECT_MOBILEwc = 120, //! < wheel-cannon + OBJECT_MOBILEtc = 121, //! < track-cannon + OBJECT_MOBILEfc = 122, //! < fly-cannon + OBJECT_MOBILEic = 123, //! < insect-cannon + OBJECT_MOBILEwi = 130, //! < wheel-insect-cannon + OBJECT_MOBILEti = 131, //! < track-insect-cannon + OBJECT_MOBILEfi = 132, //! < fly-insect-cannon + OBJECT_MOBILEii = 133, //! < insect-insect-cannon + OBJECT_MOBILEws = 140, //! < wheel-search + OBJECT_MOBILEts = 141, //! < track-search + OBJECT_MOBILEfs = 142, //! < fly-search + OBJECT_MOBILEis = 143, //! < insect-search + OBJECT_MOBILErt = 200, //! < roller-terraform + OBJECT_MOBILErc = 201, //! < roller-canon + OBJECT_MOBILErr = 202, //! < roller-recover + OBJECT_MOBILErs = 203, //! < roller-shield + OBJECT_MOBILEsa = 210, //! < submarine + OBJECT_MOBILEtg = 211, //! < training target + OBJECT_MOBILEdr = 212, //! < robot drawing + OBJECT_WAYPOINT = 250, //! < waypoint + OBJECT_FLAGb = 260, //! < blue flag + OBJECT_FLAGr = 261, //! < red flag + OBJECT_FLAGg = 262, //! < green flag + OBJECT_FLAGy = 263, //! < yellow flag + OBJECT_FLAGv = 264, //! < violet flag + OBJECT_KEYa = 270, //! < key a + OBJECT_KEYb = 271, //! < key b + OBJECT_KEYc = 272, //! < key c + OBJECT_KEYd = 273, //! < key d + OBJECT_HUMAN = 300, //! < human + OBJECT_TOTO = 301, //! < toto + OBJECT_TECH = 302, //! < technician + OBJECT_BARRIER0 = 400, //! < barrier + OBJECT_BARRIER1 = 401, //! < barrier + OBJECT_BARRIER2 = 402, //! < barrier + OBJECT_BARRIER3 = 403, //! < barrier + OBJECT_BARRIER4 = 404, //! < barrier + OBJECT_MOTHER = 500, //! < insect queen + OBJECT_EGG = 501, //! < egg + OBJECT_ANT = 502, //! < ant + OBJECT_SPIDER = 503, //! < spider + OBJECT_BEE = 504, //! < bee + OBJECT_WORM = 505, //! < worm + OBJECT_RUINmobilew1 = 600, //! < ruin 1 + OBJECT_RUINmobilew2 = 601, //! < ruin 1 + OBJECT_RUINmobilet1 = 602, //! < ruin 2 + OBJECT_RUINmobilet2 = 603, //! < ruin 2 + OBJECT_RUINmobiler1 = 604, //! < ruin 3 + OBJECT_RUINmobiler2 = 605, //! < ruin 3 + OBJECT_RUINfactory = 606, //! < ruin 4 + OBJECT_RUINdoor = 607, //! < ruin 5 + OBJECT_RUINsupport = 608, //! < ruin 6 + OBJECT_RUINradar = 609, //! < ruin 7 + OBJECT_RUINconvert = 610, //! < ruin 8 + OBJECT_RUINbase = 611, //! < ruin 9 + OBJECT_RUINhead = 612, //! < ruin 10 + OBJECT_TEEN0 = 620, //! < toy + OBJECT_TEEN1 = 621, //! < toy + OBJECT_TEEN2 = 622, //! < toy + OBJECT_TEEN3 = 623, //! < toy + OBJECT_TEEN4 = 624, //! < toy + OBJECT_TEEN5 = 625, //! < toy + OBJECT_TEEN6 = 626, //! < toy + OBJECT_TEEN7 = 627, //! < toy + OBJECT_TEEN8 = 628, //! < toy + OBJECT_TEEN9 = 629, //! < toy + OBJECT_TEEN10 = 630, //! < toy + OBJECT_TEEN11 = 631, //! < toy + OBJECT_TEEN12 = 632, //! < toy + OBJECT_TEEN13 = 633, //! < toy + OBJECT_TEEN14 = 634, //! < toy + OBJECT_TEEN15 = 635, //! < toy + OBJECT_TEEN16 = 636, //! < toy + OBJECT_TEEN17 = 637, //! < toy + OBJECT_TEEN18 = 638, //! < toy + OBJECT_TEEN19 = 639, //! < toy + OBJECT_TEEN20 = 640, //! < toy + OBJECT_TEEN21 = 641, //! < toy + OBJECT_TEEN22 = 642, //! < toy + OBJECT_TEEN23 = 643, //! < toy + OBJECT_TEEN24 = 644, //! < toy + OBJECT_TEEN25 = 645, //! < toy + OBJECT_TEEN26 = 646, //! < toy + OBJECT_TEEN27 = 647, //! < toy + OBJECT_TEEN28 = 648, //! < toy + OBJECT_TEEN29 = 649, //! < toy + OBJECT_TEEN30 = 650, //! < toy + OBJECT_TEEN31 = 651, //! < toy + OBJECT_TEEN32 = 652, //! < toy + OBJECT_TEEN33 = 653, //! < toy + OBJECT_TEEN34 = 654, //! < toy + OBJECT_TEEN35 = 655, //! < toy + OBJECT_TEEN36 = 656, //! < toy + OBJECT_TEEN37 = 657, //! < toy + OBJECT_TEEN38 = 658, //! < toy + OBJECT_TEEN39 = 659, //! < toy + OBJECT_TEEN40 = 660, //! < toy + OBJECT_TEEN41 = 661, //! < toy + OBJECT_TEEN42 = 662, //! < toy + OBJECT_TEEN43 = 663, //! < toy + OBJECT_TEEN44 = 664, //! < toy + OBJECT_TEEN45 = 665, //! < toy + OBJECT_TEEN46 = 666, //! < toy + OBJECT_TEEN47 = 667, //! < toy + OBJECT_TEEN48 = 668, //! < toy + OBJECT_TEEN49 = 669, //! < toy + OBJECT_QUARTZ0 = 700, //! < crystal 0 + OBJECT_QUARTZ1 = 701, //! < crystal 1 + OBJECT_QUARTZ2 = 702, //! < crystal 2 + OBJECT_QUARTZ3 = 703, //! < crystal 3 + OBJECT_QUARTZ4 = 704, //! < crystal 4 + OBJECT_QUARTZ5 = 705, //! < crystal 5 + OBJECT_QUARTZ6 = 706, //! < crystal 6 + OBJECT_QUARTZ7 = 707, //! < crystal 7 + OBJECT_QUARTZ8 = 708, //! < crystal 8 + OBJECT_QUARTZ9 = 709, //! < crystal 9 + OBJECT_ROOT0 = 710, //! < root 0 + OBJECT_ROOT1 = 711, //! < root 1 + OBJECT_ROOT2 = 712, //! < root 2 + OBJECT_ROOT3 = 713, //! < root 3 + OBJECT_ROOT4 = 714, //! < root 4 + OBJECT_ROOT5 = 715, //! < root 5 + OBJECT_ROOT6 = 716, //! < root 6 + OBJECT_ROOT7 = 717, //! < root 7 + OBJECT_ROOT8 = 718, //! < root 8 + OBJECT_ROOT9 = 719, //! < root 9 + OBJECT_SEAWEED0 = 720, //! < seaweed 0 + OBJECT_SEAWEED1 = 721, //! < seaweed 1 + OBJECT_SEAWEED2 = 722, //! < seaweed 2 + OBJECT_SEAWEED3 = 723, //! < seaweed 3 + OBJECT_SEAWEED4 = 724, //! < seaweed 4 + OBJECT_SEAWEED5 = 725, //! < seaweed 5 + OBJECT_SEAWEED6 = 726, //! < seaweed 6 + OBJECT_SEAWEED7 = 727, //! < seaweed 7 + OBJECT_SEAWEED8 = 728, //! < seaweed 8 + OBJECT_SEAWEED9 = 729, //! < seaweed 9 + OBJECT_MUSHROOM0 = 730, //! < mushroom 0 + OBJECT_MUSHROOM1 = 731, //! < mushroom 1 + OBJECT_MUSHROOM2 = 732, //! < mushroom 2 + OBJECT_MUSHROOM3 = 733, //! < mushroom 3 + OBJECT_MUSHROOM4 = 734, //! < mushroom 4 + OBJECT_MUSHROOM5 = 735, //! < mushroom 5 + OBJECT_MUSHROOM6 = 736, //! < mushroom 6 + OBJECT_MUSHROOM7 = 737, //! < mushroom 7 + OBJECT_MUSHROOM8 = 738, //! < mushroom 8 + OBJECT_MUSHROOM9 = 739, //! < mushroom 9 + OBJECT_APOLLO1 = 900, //! < apollo lem + OBJECT_APOLLO2 = 901, //! < apollo jeep + OBJECT_APOLLO3 = 902, //! < apollo flag + OBJECT_APOLLO4 = 903, //! < apollo module + OBJECT_APOLLO5 = 904, //! < apollo antenna + OBJECT_HOME1 = 910, //! < home 1 + + OBJECT_MAX = 1000 //! < number of values +}; + + + // The father of all parts must always be the part number zero! const int OBJECTMAXPART = 40; diff --git a/src/object/object_ids.h b/src/object/object_ids.h deleted file mode 100644 index 2d9c1a8..0000000 --- a/src/object/object_ids.h +++ /dev/null @@ -1,262 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. - -#pragma once - -enum ObjectType -{ - OBJECT_NULL = 0, // object destroyed - OBJECT_FIX = 1, // stationary scenery - OBJECT_PORTICO = 2, // gantry - OBJECT_BASE = 3, // great main base - OBJECT_DERRICK = 4, // derrick set - OBJECT_FACTORY = 5, // factory set - OBJECT_STATION = 6, // recharging station - OBJECT_CONVERT = 7, // converter station - OBJECT_REPAIR = 8, // reparation - OBJECT_TOWER = 9, // defense tower - OBJECT_NEST = 10, // nest - OBJECT_RESEARCH = 11, // research center - OBJECT_RADAR = 12, // radar - OBJECT_ENERGY = 13, // energy factory - OBJECT_LABO = 14, // analytical laboratory for insect - OBJECT_NUCLEAR = 15, // nuclear power plant - OBJECT_START = 16, // starting - OBJECT_END = 17, // finish - OBJECT_INFO = 18, // information terminal - OBJECT_PARA = 19, // lightning conductor - OBJECT_TARGET1 = 20, // gate target - OBJECT_TARGET2 = 21, // center target - OBJECT_SAFE = 22, // safe - OBJECT_HUSTON = 23, // control centre - OBJECT_DESTROYER = 24, // destroyer - OBJECT_FRET = 30, // transportable - OBJECT_STONE = 31, // stone - OBJECT_URANIUM = 32, // uranium - OBJECT_METAL = 33, // metal - OBJECT_POWER = 34, // normal battery - OBJECT_ATOMIC = 35, // atomic battery - OBJECT_BULLET = 36, // bullet - OBJECT_BBOX = 37, // black-box - OBJECT_TNT = 38, // box of TNT - OBJECT_SCRAP1 = 40, // metal waste - OBJECT_SCRAP2 = 41, // metal waste - OBJECT_SCRAP3 = 42, // metal waste - OBJECT_SCRAP4 = 43, // plastic waste - OBJECT_SCRAP5 = 44, // plastic waste - OBJECT_MARKPOWER = 50, // mark underground energy source - OBJECT_MARKSTONE = 51, // mark underground ore - OBJECT_MARKURANIUM = 52, // mark underground uranium - OBJECT_MARKKEYa = 53, // mark underground key - OBJECT_MARKKEYb = 54, // mark underground key - OBJECT_MARKKEYc = 55, // mark underground key - OBJECT_MARKKEYd = 56, // mark underground key - OBJECT_BOMB = 60, // bomb - OBJECT_WINFIRE = 61, // fireworks - OBJECT_SHOW = 62, // shows a place - OBJECT_BAG = 63, // survival bag - OBJECT_PLANT0 = 70, // plant 0 - OBJECT_PLANT1 = 71, // plant 1 - OBJECT_PLANT2 = 72, // plant 2 - OBJECT_PLANT3 = 73, // plant 3 - OBJECT_PLANT4 = 74, // plant 4 - OBJECT_PLANT5 = 75, // plant 5 - OBJECT_PLANT6 = 76, // plant 6 - OBJECT_PLANT7 = 77, // plant 7 - OBJECT_PLANT8 = 78, // plant 8 - OBJECT_PLANT9 = 79, // plant 9 - OBJECT_PLANT10 = 80, // plant 10 - OBJECT_PLANT11 = 81, // plant 11 - OBJECT_PLANT12 = 82, // plant 12 - OBJECT_PLANT13 = 83, // plant 13 - OBJECT_PLANT14 = 84, // plant 14 - OBJECT_PLANT15 = 85, // plant 15 - OBJECT_PLANT16 = 86, // plant 16 - OBJECT_PLANT17 = 87, // plant 17 - OBJECT_PLANT18 = 88, // plant 18 - OBJECT_PLANT19 = 89, // plant 19 - OBJECT_TREE0 = 90, // tree 0 - OBJECT_TREE1 = 91, // tree 1 - OBJECT_TREE2 = 92, // tree 2 - OBJECT_TREE3 = 93, // tree 3 - OBJECT_TREE4 = 94, // tree 4 - OBJECT_TREE5 = 95, // tree 5 - OBJECT_TREE6 = 96, // tree 6 - OBJECT_TREE7 = 97, // tree 7 - OBJECT_TREE8 = 98, // tree 8 - OBJECT_TREE9 = 99, // tree 9 - OBJECT_MOBILEwt = 100, // wheel-trainer - OBJECT_MOBILEtt = 101, // track-trainer - OBJECT_MOBILEft = 102, // fly-trainer - OBJECT_MOBILEit = 103, // insect-trainer - OBJECT_MOBILEwa = 110, // wheel-arm - OBJECT_MOBILEta = 111, // track-arm - OBJECT_MOBILEfa = 112, // fly-arm - OBJECT_MOBILEia = 113, // insect-arm - OBJECT_MOBILEwc = 120, // wheel-cannon - OBJECT_MOBILEtc = 121, // track-cannon - OBJECT_MOBILEfc = 122, // fly-cannon - OBJECT_MOBILEic = 123, // insect-cannon - OBJECT_MOBILEwi = 130, // wheel-insect-cannon - OBJECT_MOBILEti = 131, // track-insect-cannon - OBJECT_MOBILEfi = 132, // fly-insect-cannon - OBJECT_MOBILEii = 133, // insect-insect-cannon - OBJECT_MOBILEws = 140, // wheel-search - OBJECT_MOBILEts = 141, // track-search - OBJECT_MOBILEfs = 142, // fly-search - OBJECT_MOBILEis = 143, // insect-search - OBJECT_MOBILErt = 200, // roller-terraform - OBJECT_MOBILErc = 201, // roller-canon - OBJECT_MOBILErr = 202, // roller-recover - OBJECT_MOBILErs = 203, // roller-shield - OBJECT_MOBILEsa = 210, // submarine - OBJECT_MOBILEtg = 211, // training target - OBJECT_MOBILEdr = 212, // robot drawing - OBJECT_WAYPOINT = 250, // waypoint - OBJECT_FLAGb = 260, // blue flag - OBJECT_FLAGr = 261, // red flag - OBJECT_FLAGg = 262, // green flag - OBJECT_FLAGy = 263, // yellow flag - OBJECT_FLAGv = 264, // violet flag - OBJECT_KEYa = 270, // key a - OBJECT_KEYb = 271, // key b - OBJECT_KEYc = 272, // key c - OBJECT_KEYd = 273, // key d - OBJECT_HUMAN = 300, // human - OBJECT_TOTO = 301, // toto - OBJECT_TECH = 302, // technician - OBJECT_BARRIER0 = 400, // barrier - OBJECT_BARRIER1 = 401, // barrier - OBJECT_BARRIER2 = 402, // barrier - OBJECT_BARRIER3 = 403, // barrier - OBJECT_BARRIER4 = 404, // barrier - OBJECT_MOTHER = 500, // insect queen - OBJECT_EGG = 501, // egg - OBJECT_ANT = 502, // ant - OBJECT_SPIDER = 503, // spider - OBJECT_BEE = 504, // bee - OBJECT_WORM = 505, // worm - OBJECT_RUINmobilew1 = 600, // ruin 1 - OBJECT_RUINmobilew2 = 601, // ruin 1 - OBJECT_RUINmobilet1 = 602, // ruin 2 - OBJECT_RUINmobilet2 = 603, // ruin 2 - OBJECT_RUINmobiler1 = 604, // ruin 3 - OBJECT_RUINmobiler2 = 605, // ruin 3 - OBJECT_RUINfactory = 606, // ruin 4 - OBJECT_RUINdoor = 607, // ruin 5 - OBJECT_RUINsupport = 608, // ruin 6 - OBJECT_RUINradar = 609, // ruin 7 - OBJECT_RUINconvert = 610, // ruin 8 - OBJECT_RUINbase = 611, // ruin 9 - OBJECT_RUINhead = 612, // ruin 10 - OBJECT_TEEN0 = 620, // toy - OBJECT_TEEN1 = 621, // toy - OBJECT_TEEN2 = 622, // toy - OBJECT_TEEN3 = 623, // toy - OBJECT_TEEN4 = 624, // toy - OBJECT_TEEN5 = 625, // toy - OBJECT_TEEN6 = 626, // toy - OBJECT_TEEN7 = 627, // toy - OBJECT_TEEN8 = 628, // toy - OBJECT_TEEN9 = 629, // toy - OBJECT_TEEN10 = 630, // toy - OBJECT_TEEN11 = 631, // toy - OBJECT_TEEN12 = 632, // toy - OBJECT_TEEN13 = 633, // toy - OBJECT_TEEN14 = 634, // toy - OBJECT_TEEN15 = 635, // toy - OBJECT_TEEN16 = 636, // toy - OBJECT_TEEN17 = 637, // toy - OBJECT_TEEN18 = 638, // toy - OBJECT_TEEN19 = 639, // toy - OBJECT_TEEN20 = 640, // toy - OBJECT_TEEN21 = 641, // toy - OBJECT_TEEN22 = 642, // toy - OBJECT_TEEN23 = 643, // toy - OBJECT_TEEN24 = 644, // toy - OBJECT_TEEN25 = 645, // toy - OBJECT_TEEN26 = 646, // toy - OBJECT_TEEN27 = 647, // toy - OBJECT_TEEN28 = 648, // toy - OBJECT_TEEN29 = 649, // toy - OBJECT_TEEN30 = 650, // toy - OBJECT_TEEN31 = 651, // toy - OBJECT_TEEN32 = 652, // toy - OBJECT_TEEN33 = 653, // toy - OBJECT_TEEN34 = 654, // toy - OBJECT_TEEN35 = 655, // toy - OBJECT_TEEN36 = 656, // toy - OBJECT_TEEN37 = 657, // toy - OBJECT_TEEN38 = 658, // toy - OBJECT_TEEN39 = 659, // toy - OBJECT_TEEN40 = 660, // toy - OBJECT_TEEN41 = 661, // toy - OBJECT_TEEN42 = 662, // toy - OBJECT_TEEN43 = 663, // toy - OBJECT_TEEN44 = 664, // toy - OBJECT_TEEN45 = 665, // toy - OBJECT_TEEN46 = 666, // toy - OBJECT_TEEN47 = 667, // toy - OBJECT_TEEN48 = 668, // toy - OBJECT_TEEN49 = 669, // toy - OBJECT_QUARTZ0 = 700, // crystal 0 - OBJECT_QUARTZ1 = 701, // crystal 1 - OBJECT_QUARTZ2 = 702, // crystal 2 - OBJECT_QUARTZ3 = 703, // crystal 3 - OBJECT_QUARTZ4 = 704, // crystal 4 - OBJECT_QUARTZ5 = 705, // crystal 5 - OBJECT_QUARTZ6 = 706, // crystal 6 - OBJECT_QUARTZ7 = 707, // crystal 7 - OBJECT_QUARTZ8 = 708, // crystal 8 - OBJECT_QUARTZ9 = 709, // crystal 9 - OBJECT_ROOT0 = 710, // root 0 - OBJECT_ROOT1 = 711, // root 1 - OBJECT_ROOT2 = 712, // root 2 - OBJECT_ROOT3 = 713, // root 3 - OBJECT_ROOT4 = 714, // root 4 - OBJECT_ROOT5 = 715, // root 5 - OBJECT_ROOT6 = 716, // root 6 - OBJECT_ROOT7 = 717, // root 7 - OBJECT_ROOT8 = 718, // root 8 - OBJECT_ROOT9 = 719, // root 9 - OBJECT_SEAWEED0 = 720, // seaweed 0 - OBJECT_SEAWEED1 = 721, // seaweed 1 - OBJECT_SEAWEED2 = 722, // seaweed 2 - OBJECT_SEAWEED3 = 723, // seaweed 3 - OBJECT_SEAWEED4 = 724, // seaweed 4 - OBJECT_SEAWEED5 = 725, // seaweed 5 - OBJECT_SEAWEED6 = 726, // seaweed 6 - OBJECT_SEAWEED7 = 727, // seaweed 7 - OBJECT_SEAWEED8 = 728, // seaweed 8 - OBJECT_SEAWEED9 = 729, // seaweed 9 - OBJECT_MUSHROOM0 = 730, // mushroom 0 - OBJECT_MUSHROOM1 = 731, // mushroom 1 - OBJECT_MUSHROOM2 = 732, // mushroom 2 - OBJECT_MUSHROOM3 = 733, // mushroom 3 - OBJECT_MUSHROOM4 = 734, // mushroom 4 - OBJECT_MUSHROOM5 = 735, // mushroom 5 - OBJECT_MUSHROOM6 = 736, // mushroom 6 - OBJECT_MUSHROOM7 = 737, // mushroom 7 - OBJECT_MUSHROOM8 = 738, // mushroom 8 - OBJECT_MUSHROOM9 = 739, // mushroom 9 - OBJECT_APOLLO1 = 900, // apollo lem - OBJECT_APOLLO2 = 901, // apollo jeep - OBJECT_APOLLO3 = 902, // apollo flag - OBJECT_APOLLO4 = 903, // apollo module - OBJECT_APOLLO5 = 904, // apollo antenna - OBJECT_HOME1 = 910, // home 1 - OBJECT_MAX = 1000, -}; diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 82eac2b..1da4587 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -14,8 +14,6 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// robotmain.cpp - #include "object/robotmain.h" @@ -878,7 +876,7 @@ void CRobotMain::SetDefaultInputBindings() { for (int i = 0; i < INPUT_SLOT_MAX; i++) { - m_inputBindings[i].key = m_inputBindings[i].joy = KEY_INVALID; + m_inputBindings[i].primary = m_inputBindings[i].secondary = KEY_INVALID; } for (int i = 0; i < JOY_AXIS_SLOT_MAX; i++) @@ -887,34 +885,34 @@ void CRobotMain::SetDefaultInputBindings() m_joyAxisBindings[i].invert = false; } - m_inputBindings[INPUT_SLOT_LEFT ].key = KEY(LEFT); - m_inputBindings[INPUT_SLOT_RIGHT ].key = KEY(RIGHT); - m_inputBindings[INPUT_SLOT_UP ].key = KEY(UP); - m_inputBindings[INPUT_SLOT_DOWN ].key = KEY(DOWN); - m_inputBindings[INPUT_SLOT_GUP ].key = VIRTUAL_KMOD(SHIFT); - m_inputBindings[INPUT_SLOT_GDOWN ].key = VIRTUAL_KMOD(CTRL); - m_inputBindings[INPUT_SLOT_CAMERA ].key = KEY(SPACE); - m_inputBindings[INPUT_SLOT_CAMERA ].joy = VIRTUAL_JOY(2); - m_inputBindings[INPUT_SLOT_DESEL ].key = KEY(KP0); - m_inputBindings[INPUT_SLOT_DESEL ].joy = VIRTUAL_JOY(6); - m_inputBindings[INPUT_SLOT_ACTION ].key = KEY(RETURN); - m_inputBindings[INPUT_SLOT_ACTION ].joy = VIRTUAL_JOY(1); - m_inputBindings[INPUT_SLOT_NEAR ].key = KEY(KP_PLUS); - m_inputBindings[INPUT_SLOT_NEAR ].joy = VIRTUAL_JOY(5); - m_inputBindings[INPUT_SLOT_AWAY ].key = KEY(KP_MINUS); - m_inputBindings[INPUT_SLOT_AWAY ].joy = VIRTUAL_JOY(4); - m_inputBindings[INPUT_SLOT_NEXT ].key = KEY(TAB); - m_inputBindings[INPUT_SLOT_NEXT ].joy = VIRTUAL_JOY(3); - m_inputBindings[INPUT_SLOT_HUMAN ].key = KEY(HOME); - m_inputBindings[INPUT_SLOT_HUMAN ].joy = VIRTUAL_JOY(7); - m_inputBindings[INPUT_SLOT_QUIT ].key = KEY(ESCAPE); - m_inputBindings[INPUT_SLOT_HELP ].key = KEY(F1); - m_inputBindings[INPUT_SLOT_PROG ].key = KEY(F2); - m_inputBindings[INPUT_SLOT_CBOT ].key = KEY(F3); - m_inputBindings[INPUT_SLOT_VISIT ].key = KEY(KP_PERIOD); - m_inputBindings[INPUT_SLOT_SPEED10].key = KEY(F4); - m_inputBindings[INPUT_SLOT_SPEED15].key = KEY(F5); - m_inputBindings[INPUT_SLOT_SPEED20].key = KEY(F6); + m_inputBindings[INPUT_SLOT_LEFT ].primary = KEY(LEFT); + m_inputBindings[INPUT_SLOT_RIGHT ].primary = KEY(RIGHT); + m_inputBindings[INPUT_SLOT_UP ].primary = KEY(UP); + m_inputBindings[INPUT_SLOT_DOWN ].primary = KEY(DOWN); + m_inputBindings[INPUT_SLOT_GUP ].primary = VIRTUAL_KMOD(SHIFT); + m_inputBindings[INPUT_SLOT_GDOWN ].primary = VIRTUAL_KMOD(CTRL); + m_inputBindings[INPUT_SLOT_CAMERA ].primary = KEY(SPACE); + m_inputBindings[INPUT_SLOT_CAMERA ].secondary = VIRTUAL_JOY(2); + m_inputBindings[INPUT_SLOT_DESEL ].primary = KEY(KP0); + m_inputBindings[INPUT_SLOT_DESEL ].secondary = VIRTUAL_JOY(6); + m_inputBindings[INPUT_SLOT_ACTION ].primary = KEY(RETURN); + m_inputBindings[INPUT_SLOT_ACTION ].secondary = VIRTUAL_JOY(1); + m_inputBindings[INPUT_SLOT_NEAR ].primary = KEY(KP_PLUS); + m_inputBindings[INPUT_SLOT_NEAR ].secondary = VIRTUAL_JOY(5); + m_inputBindings[INPUT_SLOT_AWAY ].primary = KEY(KP_MINUS); + m_inputBindings[INPUT_SLOT_AWAY ].secondary = VIRTUAL_JOY(4); + m_inputBindings[INPUT_SLOT_NEXT ].primary = KEY(TAB); + m_inputBindings[INPUT_SLOT_NEXT ].secondary = VIRTUAL_JOY(3); + m_inputBindings[INPUT_SLOT_HUMAN ].primary = KEY(HOME); + m_inputBindings[INPUT_SLOT_HUMAN ].secondary = VIRTUAL_JOY(7); + m_inputBindings[INPUT_SLOT_QUIT ].primary = KEY(ESCAPE); + m_inputBindings[INPUT_SLOT_HELP ].primary = KEY(F1); + m_inputBindings[INPUT_SLOT_PROG ].primary = KEY(F2); + m_inputBindings[INPUT_SLOT_CBOT ].primary = KEY(F3); + m_inputBindings[INPUT_SLOT_VISIT ].primary = KEY(KP_PERIOD); + m_inputBindings[INPUT_SLOT_SPEED10].primary = KEY(F4); + m_inputBindings[INPUT_SLOT_SPEED15].primary = KEY(F5); + m_inputBindings[INPUT_SLOT_SPEED20].primary = KEY(F6); m_joyAxisBindings[JOY_AXIS_SLOT_X].axis = 0; m_joyAxisBindings[JOY_AXIS_SLOT_Y].axis = 1; @@ -1051,7 +1049,7 @@ void CRobotMain::ChangePhase(Phase phase) dim.y = 18.0f/480.0f; pos.x = 50.0f/640.0f; pos.y = 452.0f/480.0f; - Ui::CEdit* pe = dynamic_cast<Ui::CEdit*>(m_interface->CreateEdit(pos, dim, 0, EVENT_CMD)); + Ui::CEdit* pe = static_cast<Ui::CEdit*>(m_interface->CreateEdit(pos, dim, 0, EVENT_CMD)); if (pe == nullptr) return; pe->ClearState(Ui::STATE_VISIBLE); m_cmdEdit = false; // hidden for now @@ -1214,33 +1212,33 @@ bool CRobotMain::EventProcess(Event &event) if (event.type == EVENT_KEY_DOWN) { - if (event.key.key == GetInputBinding(INPUT_SLOT_UP ).key) m_keyMotion.y = 1.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_UP ).joy) m_keyMotion.y = 1.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_DOWN ).key) m_keyMotion.y = -1.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_DOWN ).joy) m_keyMotion.y = -1.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_LEFT ).key) m_keyMotion.x = -1.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_LEFT ).joy) m_keyMotion.x = -1.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_RIGHT).key) m_keyMotion.x = 1.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_RIGHT).joy) m_keyMotion.x = 1.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_GUP ).key) m_keyMotion.z = 1.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_GUP ).joy) m_keyMotion.z = 1.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_GDOWN).key) m_keyMotion.z = -1.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_GDOWN).joy) m_keyMotion.z = -1.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_UP ).primary) m_keyMotion.y = 1.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_UP ).secondary) m_keyMotion.y = 1.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_DOWN ).primary) m_keyMotion.y = -1.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_DOWN ).secondary) m_keyMotion.y = -1.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_LEFT ).primary) m_keyMotion.x = -1.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_LEFT ).secondary) m_keyMotion.x = -1.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_RIGHT).primary) m_keyMotion.x = 1.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_RIGHT).secondary) m_keyMotion.x = 1.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_GUP ).primary) m_keyMotion.z = 1.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_GUP ).secondary) m_keyMotion.z = 1.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_GDOWN).primary) m_keyMotion.z = -1.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_GDOWN).secondary) m_keyMotion.z = -1.0f; } else if (event.type == EVENT_KEY_UP) { - if (event.key.key == GetInputBinding(INPUT_SLOT_UP ).key) m_keyMotion.y = 0.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_UP ).joy) m_keyMotion.y = 0.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_DOWN ).key) m_keyMotion.y = 0.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_DOWN ).joy) m_keyMotion.y = 0.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_LEFT ).key) m_keyMotion.x = 0.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_LEFT ).joy) m_keyMotion.x = 0.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_RIGHT).key) m_keyMotion.x = 0.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_RIGHT).joy) m_keyMotion.x = 0.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_GUP ).key) m_keyMotion.z = 0.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_GUP ).joy) m_keyMotion.z = 0.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_GDOWN).key) m_keyMotion.z = 0.0f; - if (event.key.key == GetInputBinding(INPUT_SLOT_GDOWN).joy) m_keyMotion.z = 0.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_UP ).primary) m_keyMotion.y = 0.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_UP ).secondary) m_keyMotion.y = 0.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_DOWN ).primary) m_keyMotion.y = 0.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_DOWN ).secondary) m_keyMotion.y = 0.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_LEFT ).primary) m_keyMotion.x = 0.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_LEFT ).secondary) m_keyMotion.x = 0.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_RIGHT).primary) m_keyMotion.x = 0.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_RIGHT).secondary) m_keyMotion.x = 0.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_GUP ).primary) m_keyMotion.z = 0.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_GUP ).secondary) m_keyMotion.z = 0.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_GDOWN).primary) m_keyMotion.z = 0.0f; + if (event.key.key == GetInputBinding(INPUT_SLOT_GDOWN).secondary) m_keyMotion.z = 0.0f; } else if (event.type == EVENT_JOY_AXIS) { @@ -1304,7 +1302,7 @@ bool CRobotMain::EventProcess(Event &event) event.type == EVENT_KEY_DOWN && event.key.key == KEY(PAUSE)) // Pause ? { - Ui::CEdit* pe = dynamic_cast<Ui::CEdit*>(m_interface->SearchControl(EVENT_CMD)); + Ui::CEdit* pe = static_cast<Ui::CEdit*>(m_interface->SearchControl(EVENT_CMD)); if (pe == nullptr) return false; pe->SetState(Ui::STATE_VISIBLE); pe->SetFocus(true); @@ -1316,7 +1314,7 @@ bool CRobotMain::EventProcess(Event &event) event.key.key == KEY(RETURN) && m_cmdEdit) { char cmd[50]; - Ui::CEdit* pe = dynamic_cast<Ui::CEdit*>(m_interface->SearchControl(EVENT_CMD)); + Ui::CEdit* pe = static_cast<Ui::CEdit*>(m_interface->SearchControl(EVENT_CMD)); if (pe == nullptr) return false; pe->GetText(cmd, 50); pe->SetText(""); @@ -1356,10 +1354,10 @@ bool CRobotMain::EventProcess(Event &event) if (event.type == EVENT_KEY_DOWN) { - if (event.key.key == GetInputBinding(INPUT_SLOT_HELP).key || - event.key.key == GetInputBinding(INPUT_SLOT_HELP).joy || - event.key.key == GetInputBinding(INPUT_SLOT_PROG).key || - event.key.key == GetInputBinding(INPUT_SLOT_PROG).joy || + if (event.key.key == GetInputBinding(INPUT_SLOT_HELP).primary || + event.key.key == GetInputBinding(INPUT_SLOT_HELP).secondary || + event.key.key == GetInputBinding(INPUT_SLOT_PROG).primary || + event.key.key == GetInputBinding(INPUT_SLOT_PROG).secondary || event.key.key == KEY(ESCAPE)) { StopDisplayInfo(); @@ -1394,14 +1392,14 @@ bool CRobotMain::EventProcess(Event &event) } if (m_editLock) // current edition? { - if (event.key.key == GetInputBinding(INPUT_SLOT_HELP).key || - event.key.key == GetInputBinding(INPUT_SLOT_HELP).joy) + if (event.key.key == GetInputBinding(INPUT_SLOT_HELP).primary || + event.key.key == GetInputBinding(INPUT_SLOT_HELP).secondary) { StartDisplayInfo(SATCOM_HUSTON, false); return false; } - if (event.key.key == GetInputBinding(INPUT_SLOT_PROG).key || - event.key.key == GetInputBinding(INPUT_SLOT_PROG).joy) + if (event.key.key == GetInputBinding(INPUT_SLOT_PROG).primary || + event.key.key == GetInputBinding(INPUT_SLOT_PROG).secondary) { StartDisplayInfo(SATCOM_PROG, false); return false; @@ -1410,8 +1408,8 @@ bool CRobotMain::EventProcess(Event &event) } if (m_movieLock) // current movie? { - if (event.key.key == GetInputBinding(INPUT_SLOT_QUIT).key || - event.key.key == GetInputBinding(INPUT_SLOT_QUIT).joy || + if (event.key.key == GetInputBinding(INPUT_SLOT_QUIT).primary || + event.key.key == GetInputBinding(INPUT_SLOT_QUIT).secondary || event.key.key == KEY(ESCAPE)) { AbortMovie(); @@ -1420,21 +1418,21 @@ bool CRobotMain::EventProcess(Event &event) } if (m_camera->GetType() == Gfx::CAM_TYPE_VISIT) { - if (event.key.key == GetInputBinding(INPUT_SLOT_VISIT).key || - event.key.key == GetInputBinding(INPUT_SLOT_VISIT).joy) + if (event.key.key == GetInputBinding(INPUT_SLOT_VISIT).primary || + event.key.key == GetInputBinding(INPUT_SLOT_VISIT).secondary) { StartDisplayVisit(EVENT_NULL); } - if (event.key.key == GetInputBinding(INPUT_SLOT_QUIT).key || - event.key.key == GetInputBinding(INPUT_SLOT_QUIT).joy || + if (event.key.key == GetInputBinding(INPUT_SLOT_QUIT).primary || + event.key.key == GetInputBinding(INPUT_SLOT_QUIT).secondary || event.key.key == KEY(ESCAPE)) { StopDisplayVisit(); } return false; } - if (event.key.key == GetInputBinding(INPUT_SLOT_QUIT).key || - event.key.key == GetInputBinding(INPUT_SLOT_QUIT).joy) + if (event.key.key == GetInputBinding(INPUT_SLOT_QUIT).primary || + event.key.key == GetInputBinding(INPUT_SLOT_QUIT).secondary) { if (m_movie->IsExist()) StartDisplayInfo(SATCOM_HUSTON, false); @@ -1454,55 +1452,55 @@ bool CRobotMain::EventProcess(Event &event) ChangePause(!m_engine->GetPause()); } } - if (event.key.key == GetInputBinding(INPUT_SLOT_CAMERA).key || - event.key.key == GetInputBinding(INPUT_SLOT_CAMERA).joy) + if (event.key.key == GetInputBinding(INPUT_SLOT_CAMERA).primary || + event.key.key == GetInputBinding(INPUT_SLOT_CAMERA).secondary) { ChangeCamera(); } - if (event.key.key == GetInputBinding(INPUT_SLOT_DESEL).key || - event.key.key == GetInputBinding(INPUT_SLOT_DESEL).joy) + if (event.key.key == GetInputBinding(INPUT_SLOT_DESEL).primary || + event.key.key == GetInputBinding(INPUT_SLOT_DESEL).secondary) { if (m_shortCut) DeselectObject(); } - if (event.key.key == GetInputBinding(INPUT_SLOT_HUMAN).key || - event.key.key == GetInputBinding(INPUT_SLOT_HUMAN).joy) + if (event.key.key == GetInputBinding(INPUT_SLOT_HUMAN).primary || + event.key.key == GetInputBinding(INPUT_SLOT_HUMAN).secondary) { SelectHuman(); } - if (event.key.key == GetInputBinding(INPUT_SLOT_NEXT).key || - event.key.key == GetInputBinding(INPUT_SLOT_NEXT).joy) + if (event.key.key == GetInputBinding(INPUT_SLOT_NEXT).primary || + event.key.key == GetInputBinding(INPUT_SLOT_NEXT).secondary) { if (m_shortCut) m_short->SelectNext(); } - if (event.key.key == GetInputBinding(INPUT_SLOT_HELP).key || - event.key.key == GetInputBinding(INPUT_SLOT_HELP).joy) + if (event.key.key == GetInputBinding(INPUT_SLOT_HELP).primary || + event.key.key == GetInputBinding(INPUT_SLOT_HELP).secondary) { StartDisplayInfo(SATCOM_HUSTON, true); } - if (event.key.key == GetInputBinding(INPUT_SLOT_PROG).key || - event.key.key == GetInputBinding(INPUT_SLOT_PROG).joy) + if (event.key.key == GetInputBinding(INPUT_SLOT_PROG).primary || + event.key.key == GetInputBinding(INPUT_SLOT_PROG).secondary) { StartDisplayInfo(SATCOM_PROG, true); } - if (event.key.key == GetInputBinding(INPUT_SLOT_VISIT).key || - event.key.key == GetInputBinding(INPUT_SLOT_VISIT).joy) + if (event.key.key == GetInputBinding(INPUT_SLOT_VISIT).primary || + event.key.key == GetInputBinding(INPUT_SLOT_VISIT).secondary) { StartDisplayVisit(EVENT_NULL); } - if (event.key.key == GetInputBinding(INPUT_SLOT_SPEED10).key || - event.key.key == GetInputBinding(INPUT_SLOT_SPEED10).joy) + if (event.key.key == GetInputBinding(INPUT_SLOT_SPEED10).primary || + event.key.key == GetInputBinding(INPUT_SLOT_SPEED10).secondary) { SetSpeed(1.0f); } - if (event.key.key == GetInputBinding(INPUT_SLOT_SPEED15).key || - event.key.key == GetInputBinding(INPUT_SLOT_SPEED15).joy) + if (event.key.key == GetInputBinding(INPUT_SLOT_SPEED15).primary || + event.key.key == GetInputBinding(INPUT_SLOT_SPEED15).secondary) { SetSpeed(1.5f); } - if (event.key.key == GetInputBinding(INPUT_SLOT_SPEED20).key || - event.key.key == GetInputBinding(INPUT_SLOT_SPEED20).joy) + if (event.key.key == GetInputBinding(INPUT_SLOT_SPEED20).primary || + event.key.key == GetInputBinding(INPUT_SLOT_SPEED20).secondary) { SetSpeed(2.0f); } @@ -1956,6 +1954,17 @@ void CRobotMain::ExecuteCmd(char *cmd) return; } + if (strcmp(cmd, "speed4") == 0) { + SetSpeed(4.0f); + UpdateSpeedLabel(); + return; + } + if (strcmp(cmd, "speed8") == 0) { + SetSpeed(8.0f); + UpdateSpeedLabel(); + return; + } + if (m_phase == PHASE_SIMUL) m_displayText->DisplayError(ERR_CMD, Math::Vector(0.0f,0.0f,0.0f)); } @@ -2030,7 +2039,7 @@ void CRobotMain::StartDisplayInfo(const char *filename, int index) m_sound->MuteAll(true); } - Ui::CButton* pb = dynamic_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT)); + Ui::CButton* pb = static_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT)); if (pb != nullptr) { pb->ClearState(Ui::STATE_VISIBLE); @@ -2062,7 +2071,7 @@ void CRobotMain::StopDisplayInfo() if (!m_editLock) { - Ui::CButton* pb = dynamic_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT)); + Ui::CButton* pb = static_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT)); if (pb != nullptr) pb->SetState(Ui::STATE_VISIBLE); @@ -2103,7 +2112,7 @@ void CRobotMain::StartSuspend() m_infoObject = DeselectAll(); // removes the control buttons m_displayText->HideText(true); - Ui::CButton* pb = dynamic_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT)); + Ui::CButton* pb = static_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT)); if (pb != nullptr) pb->ClearState(Ui::STATE_VISIBLE); @@ -2113,7 +2122,7 @@ void CRobotMain::StartSuspend() //! End of dialogue during the game void CRobotMain::StopSuspend() { - Ui::CButton* pb = dynamic_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT)); + Ui::CButton* pb = static_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT)); if (pb != nullptr) pb->SetState(Ui::STATE_VISIBLE); @@ -2220,7 +2229,7 @@ void CRobotMain::StartDisplayVisit(EventType event) { if (m_editLock) return; - Ui::CWindow* pw = dynamic_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW2)); + Ui::CWindow* pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW2)); if (pw == nullptr) return; if (event == EVENT_NULL) // visit by keyboard shortcut? @@ -2237,10 +2246,10 @@ void CRobotMain::StartDisplayVisit(EventType event) i --; if (i < 0) i = Ui::MAXDTLINE-1; - Ui::CButton* button = dynamic_cast<Ui::CButton*>(pw->SearchControl(static_cast<EventType>(EVENT_DT_VISIT0+i))); + Ui::CButton* button = static_cast<Ui::CButton*>(pw->SearchControl(static_cast<EventType>(EVENT_DT_VISIT0+i))); if (button == nullptr || !button->TestState(Ui::STATE_ENABLE)) continue; - Ui::CGroup* group = dynamic_cast<Ui::CGroup*>(pw->SearchControl(static_cast<EventType>(EVENT_DT_GROUP0+i))); + Ui::CGroup* group = static_cast<Ui::CGroup*>(pw->SearchControl(static_cast<EventType>(EVENT_DT_GROUP0+i))); if (group != nullptr) { event = static_cast<EventType>(EVENT_DT_VISIT0+i); @@ -2442,7 +2451,7 @@ void CRobotMain::SelectOneObject(CObject* obj, bool displayError) CObject* toto = SearchToto(); if (toto != nullptr) { - CMotionToto* mt = dynamic_cast<CMotionToto*>(toto->GetMotion()); + CMotionToto* mt = static_cast<CMotionToto*>(toto->GetMotion()); if (mt != nullptr) mt->SetLinkType(type); } @@ -2992,7 +3001,7 @@ void CRobotMain::CreateTooltip(Math::Point pos, const char* text) m_interface->CreateWindows(pos, dim, 1, EVENT_TOOLTIP); - Ui::CWindow* pw = dynamic_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_TOOLTIP)); + Ui::CWindow* pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_TOOLTIP)); if (pw != nullptr) { pw->SetState(Ui::STATE_SHADOW); @@ -3098,26 +3107,26 @@ void CRobotMain::KeyCamera(EventType type, unsigned int key) if (type == EVENT_KEY_UP) { - if (key == GetInputBinding(INPUT_SLOT_LEFT).key || - key == GetInputBinding(INPUT_SLOT_LEFT).joy) + if (key == GetInputBinding(INPUT_SLOT_LEFT).primary || + key == GetInputBinding(INPUT_SLOT_LEFT).secondary) { m_cameraPan = 0.0f; } - if (key == GetInputBinding(INPUT_SLOT_RIGHT).key || - key == GetInputBinding(INPUT_SLOT_RIGHT).joy) + if (key == GetInputBinding(INPUT_SLOT_RIGHT).primary || + key == GetInputBinding(INPUT_SLOT_RIGHT).secondary) { m_cameraPan = 0.0f; } - if (key == GetInputBinding(INPUT_SLOT_UP).key || - key == GetInputBinding(INPUT_SLOT_UP).joy) + if (key == GetInputBinding(INPUT_SLOT_UP).primary || + key == GetInputBinding(INPUT_SLOT_UP).secondary) { m_cameraZoom = 0.0f; } - if (key == GetInputBinding(INPUT_SLOT_DOWN).key || - key == GetInputBinding(INPUT_SLOT_DOWN).joy) + if (key == GetInputBinding(INPUT_SLOT_DOWN).primary || + key == GetInputBinding(INPUT_SLOT_DOWN).secondary) { m_cameraZoom = 0.0f; } @@ -3133,26 +3142,26 @@ void CRobotMain::KeyCamera(EventType type, unsigned int key) if (type == EVENT_KEY_DOWN) { - if (key == GetInputBinding(INPUT_SLOT_LEFT).key || - key == GetInputBinding(INPUT_SLOT_LEFT).joy) + if (key == GetInputBinding(INPUT_SLOT_LEFT).primary || + key == GetInputBinding(INPUT_SLOT_LEFT).secondary) { m_cameraPan = -1.0f; } - if (key == GetInputBinding(INPUT_SLOT_RIGHT).key || - key == GetInputBinding(INPUT_SLOT_RIGHT).joy) + if (key == GetInputBinding(INPUT_SLOT_RIGHT).primary || + key == GetInputBinding(INPUT_SLOT_RIGHT).secondary) { m_cameraPan = 1.0f; } - if (key == GetInputBinding(INPUT_SLOT_UP).key || - key == GetInputBinding(INPUT_SLOT_UP).joy) + if (key == GetInputBinding(INPUT_SLOT_UP).primary || + key == GetInputBinding(INPUT_SLOT_UP).secondary) { m_cameraZoom = -1.0f; } - if (key == GetInputBinding(INPUT_SLOT_DOWN).key || - key == GetInputBinding(INPUT_SLOT_DOWN).joy) + if (key == GetInputBinding(INPUT_SLOT_DOWN).primary || + key == GetInputBinding(INPUT_SLOT_DOWN).secondary) { m_cameraZoom = 1.0f; } @@ -3241,14 +3250,14 @@ bool CRobotMain::EventFrame(const Event &event) m_planet->EventProcess(event); Ui::CMap* pm = nullptr; - Ui::CWindow* pw = dynamic_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW1)); + Ui::CWindow* pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW1)); if (pw == nullptr) { pm = nullptr; } else { - pm = dynamic_cast<Ui::CMap*>(pw->SearchControl(EVENT_OBJECT_MAP)); + pm = static_cast<Ui::CMap*>(pw->SearchControl(EVENT_OBJECT_MAP)); if (pm != nullptr) pm->FlushObject(); } @@ -5406,7 +5415,7 @@ void CRobotMain::FrameShowLimit(float rTime) -//! Returns a pointer to the last backslash in a filename. +//! Returns a pointer to the last slash in a filename. char* SearchLastDir(char *filename) { char* p = filename; @@ -6615,9 +6624,20 @@ void CRobotMain::ChangePause(bool pause) //! Changes game speed void CRobotMain::SetSpeed(float speed) { - // TODO: m_app->SetSimulationSpeed(speed); + m_app->SetSimulationSpeed(speed); + UpdateSpeedLabel(); +} + +float CRobotMain::GetSpeed() +{ + return m_app->GetSimulationSpeed(); +} + +void CRobotMain::UpdateSpeedLabel() +{ + Ui::CButton* pb = static_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_SPEED)); + float speed = m_app->GetSimulationSpeed(); - Ui::CButton* pb = dynamic_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_SPEED)); if (pb != nullptr) { if (speed == 1.0f) @@ -6632,11 +6652,7 @@ void CRobotMain::SetSpeed(float speed) pb->SetState(Ui::STATE_VISIBLE); } } -} -float CRobotMain::GetSpeed() -{ - return m_app->GetSimulationSpeed(); } diff --git a/src/object/robotmain.h b/src/object/robotmain.h index 70fbc8d..cb0cd7f 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -14,10 +14,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/. -// robotmain.h +/** + * \file object/robotmain.h + * \brief CRobotMain - main class of Colobot game engine + */ #pragma once + #include "common/global.h" #include "common/singleton.h" @@ -148,12 +152,12 @@ const int SATCOM_MAX = 6; */ struct InputBinding { - //! Keyboard binding code (can be regular or virtual) - unsigned int key; - //! Joystick binding code (virtual) - unsigned int joy; + //! Primary and secondary bindings + //! Can be regular key, virtual key or virtual joystick button + unsigned int primary, secondary; - InputBinding() : key(KEY_INVALID), joy(KEY_INVALID) {} + InputBinding(unsigned int p = KEY_INVALID, unsigned int s = KEY_INVALID) + : primary(p), secondary(s) {} }; /** @@ -383,6 +387,7 @@ protected: void StopDisplayVisit(); void ExecuteCmd(char *cmd); bool TestGadgetQuantity(int rank); + void UpdateSpeedLabel(); protected: CInstanceManager* m_iMan; diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp index a3c680b..f56f81d 100644 --- a/src/physics/physics.cpp +++ b/src/physics/physics.cpp @@ -14,29 +14,32 @@ // * 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.cpp +#include "physics/physics.h" -#include <cstring> -#include <cstdio> - -#include "math/geometry.h" -#include "graphics/engine/engine.h" -#include "common/global.h" #include "common/event.h" +#include "common/global.h" #include "common/iman.h" + +#include "graphics/engine/camera.h" +#include "graphics/engine/engine.h" #include "graphics/engine/lightman.h" +#include "graphics/engine/pyro.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 "math/geometry.h" + #include "object/brain.h" #include "object/motion/motion.h" #include "object/motion/motionhuman.h" #include "object/task/task.h" +#include "script/cmdtoken.h" + +#include <cstring> +#include <cstdio> + const float LANDING_SPEED = 3.0f; diff --git a/src/physics/physics.h b/src/physics/physics.h index e8a1f84..db88e8c 100644 --- a/src/physics/physics.h +++ b/src/physics/physics.h @@ -15,17 +15,18 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -#pragma once - /** * \file physics/physics.h * \brief Responsible for physics "and more" in game */ +#pragma once #include "common/global.h" + #include "object/object.h" + #include "math/vector.h" diff --git a/src/plugins/plugininterface.h b/src/plugins/plugininterface.h index 6554b44..838dbfd 100644 --- a/src/plugins/plugininterface.h +++ b/src/plugins/plugininterface.h @@ -14,17 +14,17 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// plugininterface.h - /** - * @file plugin/plugininterface.h - * @brief Generic plugin interface + * \file plugins/plugininterface.h + * \brief Generic plugin interface */ #pragma once + #include <string> + #define PLUGIN_INTERFACE(class_type) \ static class_type* Plugin##class_type; \ extern "C" void InstallPluginEntry() { Plugin##class_type = new class_type(); Plugin##class_type->InstallPlugin(); } \ @@ -37,29 +37,29 @@ /** -* @class CPluginInterface -* -* @brief Generic plugin interface. All plugins that will be managed by plugin manager have to derive from this class. -* -*/ + * \class CPluginInterface + * + * \brief Generic plugin interface. All plugins that will be managed by plugin manager have to derive from this class. + * + */ class CPluginInterface { public: /** Function to get plugin name or description - * @return returns plugin name + * \return returns plugin name */ - inline virtual std::string PluginName() { return "abc"; }; + inline virtual std::string PluginName() { return "abc"; } /** Function to get plugin version. 1 means version 0.01, 2 means 0.02 etc. - * @return number indicating plugin version + * \return number indicating plugin version */ - inline virtual int PluginVersion() { return 0; }; + inline virtual int PluginVersion() { return 0; } /** Function to initialize plugin */ - inline virtual void InstallPlugin() {}; + inline virtual void InstallPlugin() {} /** Function called before removing plugin */ - inline virtual bool UninstallPlugin(std::string &) { return true; }; + inline virtual bool UninstallPlugin(std::string &) { return true; } }; diff --git a/src/plugins/pluginloader.cpp b/src/plugins/pluginloader.cpp index fd8ce74..bd0c8be 100644 --- a/src/plugins/pluginloader.cpp +++ b/src/plugins/pluginloader.cpp @@ -14,10 +14,8 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// pluginloader.cpp - -#include "pluginloader.h" +#include "plugins/pluginloader.h" CPluginLoader::CPluginLoader(std::string filename) @@ -57,7 +55,7 @@ bool CPluginLoader::UnloadPlugin() return true; } - bool (*uninstall)(std::string &) = (bool (*)(std::string &)) lt_dlsym(mHandle, "UninstallPluginEntry"); + bool (*uninstall)(std::string &) = reinterpret_cast<bool (*)(std::string &)>( lt_dlsym(mHandle, "UninstallPluginEntry") ); if (!uninstall) { GetLogger()->Error("Error getting UninstallPluginEntry for plugin %s: %s\n", mFilename.c_str(), lt_dlerror()); return false; @@ -88,13 +86,13 @@ bool CPluginLoader::LoadPlugin() return false; } - void (*install)() = (void (*)()) lt_dlsym(mHandle, "InstallPluginEntry"); + void (*install)() = reinterpret_cast<void (*)()>( lt_dlsym(mHandle, "InstallPluginEntry") ); if (!install) { GetLogger()->Error("Error getting InstallPluginEntry for plugin %s: %s\n", mFilename.c_str(), lt_dlerror()); return false; } - CPluginInterface* (*getInterface)() = (CPluginInterface* (*)()) lt_dlsym(mHandle, "GetPluginInterfaceEntry"); + CPluginInterface* (*getInterface)() = reinterpret_cast<CPluginInterface* (*)()>( lt_dlsym(mHandle, "GetPluginInterfaceEntry") ); if (!getInterface) { GetLogger()->Error("Error getting GetPluginInterfaceEntry for plugin %s: %s\n", mFilename.c_str(), lt_dlerror()); diff --git a/src/plugins/pluginloader.h b/src/plugins/pluginloader.h index 3dfa20b..e8c2c73 100644 --- a/src/plugins/pluginloader.h +++ b/src/plugins/pluginloader.h @@ -14,68 +14,67 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// pluginloader.h - /** - * @file plugin/pluginloader.h - * @brief Plugin loader interface + * \file plugins/pluginloader.h + * \brief Plugin loader interface */ #pragma once -#include <ltdl.h> -#include <string> #include "common/logger.h" -#include "plugininterface.h" +#include "plugins/plugininterface.h" + +#include <ltdl.h> +#include <string> /** -* @class CPluginLoader -* -* @brief Plugin loader interface. Plugin manager uses this class to load plugins. -* -*/ + * \class CPluginLoader + * + * \brief Plugin loader interface. Plugin manager uses this class to load plugins. + * + */ class CPluginLoader { public: /** Class contructor - * @param std::string plugin filename + * \param filename plugin filename */ - CPluginLoader(std::string); + CPluginLoader(std::string filename); /** Function to get plugin name or description - * @return returns plugin name + * \return returns plugin name */ std::string GetName(); /** Function to get plugin version - * @return returns plugin version + * \return returns plugin version */ int GetVersion(); /** Function to unload plugin - * @return returns true on success + * \return returns true on success */ bool UnloadPlugin(); /** Function to load plugin - * @return returns true on success + * \return returns true on success */ bool LoadPlugin(); /** Function to check if plugin is loaded - * @return returns true if plugin is loaded + * \return returns true if plugin is loaded */ bool IsLoaded(); /** Function to set plugin filename - * @return returns true on success. Action can fail if plugin was loaded and cannot be unloaded + * \return returns true on success. Action can fail if plugin was loaded and cannot be unloaded */ bool SetFilename(std::string); /** Function to get plugin filename - * @return returns plugin filename + * \return returns plugin filename */ std::string GetFilename(); diff --git a/src/plugins/pluginmanager.cpp b/src/plugins/pluginmanager.cpp index 39d1d17..f4dbcdb 100644 --- a/src/plugins/pluginmanager.cpp +++ b/src/plugins/pluginmanager.cpp @@ -14,10 +14,8 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// pluginmanager.cpp - -#include "pluginmanager.h" +#include "plugins/pluginmanager.h" template<> CPluginManager* CSingleton<CPluginManager>::mInstance = nullptr; diff --git a/src/plugins/pluginmanager.h b/src/plugins/pluginmanager.h index 7a69820..2798483 100644 --- a/src/plugins/pluginmanager.h +++ b/src/plugins/pluginmanager.h @@ -14,33 +14,32 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// pluginmanager.h - /** - * @file plugin/pluginmanager.h - * @brief Plugin manager class. + * \file plugins/pluginmanager.h + * \brief Plugin manager class. */ #pragma once -#include <string> -#include <set> -#include <vector> #include "common/logger.h" #include "common/profile.h" #include "common/singleton.h" -#include "pluginloader.h" +#include "plugins/pluginloader.h" + +#include <string> +#include <set> +#include <vector> /** -* @class CPluginManager -* -* @brief Plugin manager class. Plugin manager can load plugins from colobot.ini or manually specified files. -* -*/ + * \class CPluginManager + * + * \brief Plugin manager class. Plugin manager can load plugins from colobot.ini or manually specified files. + * + */ class CPluginManager : public CSingleton<CPluginManager> { public: CPluginManager(); @@ -51,31 +50,31 @@ class CPluginManager : public CSingleton<CPluginManager> { void LoadFromProfile(); /** Function loads specified plugin - * @param std::string plugin filename - * @return returns true on success + * \param filename plugin filename + * \return returns true on success */ - bool LoadPlugin(std::string); + bool LoadPlugin(std::string filename); /** Function unloads specified plugin - * @param std::string plugin filename - * @return returns true on success + * \param filename plugin filename + * \return returns true on success */ - bool UnloadPlugin(std::string); + bool UnloadPlugin(std::string filename); /** Function adds path to be checked when searching for plugin file. If path was already added it will be ignored - * @param std::string plugin search path - * @return returns true on success + * \param dir plugin search path + * \return returns true on success */ - bool AddSearchDirectory(std::string); + bool AddSearchDirectory(std::string dir); /** Function removes path from list - * @param std::string plugin search path - * @return returns true on success + * \param dir plugin search path + * \return returns true on success */ - bool RemoveSearchDirectory(std::string); + bool RemoveSearchDirectory(std::string dir); /** Function tries to unload all plugins - * @return returns true on success + * \return returns true on success */ bool UnloadAllPlugins(); diff --git a/src/script/cbottoken.h b/src/script/cbottoken.h index 1f2d6e7..f5b7b70 100644 --- a/src/script/cbottoken.h +++ b/src/script/cbottoken.h @@ -14,7 +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/. -// cbottoken.h +/** + * \file script/cbottoken.h + * \brief Functions to parse some CBot-related tokens + */ #pragma once diff --git a/src/script/cmdtoken.h b/src/script/cmdtoken.h index 812cec7..fe831f1 100644 --- a/src/script/cmdtoken.h +++ b/src/script/cmdtoken.h @@ -14,10 +14,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/. -// cmdtoken.h +/** + * \file script/cmdtoken.h + * \brief Functions to parse commands from level files + */ #pragma once + #include "graphics/engine/water.h" #include "graphics/engine/engine.h" #include "graphics/engine/pyro.h" diff --git a/src/script/script.cpp b/src/script/script.cpp index 2d76ad3..8471df5 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -14,24 +14,30 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// script.cpp - #include "script/script.h" +#include "app/app.h" + #include "common/global.h" #include "common/iman.h" #include "common/restext.h" + #include "graphics/engine/terrain.h" #include "graphics/engine/water.h" #include "graphics/engine/text.h" + #include "math/geometry.h" #include "math/vector.h" + #include "object/object.h" #include "object/robotmain.h" #include "object/task/taskmanager.h" + #include "physics/physics.h" + #include "script/cbottoken.h" + #include "ui/interface.h" #include "ui/edit.h" #include "ui/list.h" @@ -3646,20 +3652,18 @@ bool CScript::ReadScript(const char* filename) { FILE* file; Ui::CEdit* edit; + std::string name; - // TODO: local user dir - std::string name = CApplication::GetInstancePointer()->GetDataFilePath(DIR_AI, filename); - - /*if ( strchr(filename, '\\') == 0 ) + if ( strchr(filename, '/') == 0 ) //we're reading non user script { - strcpy(name, "script\\"); - strcat(name, filename); + name = CApplication::GetInstancePointer()->GetDataFilePath(DIR_AI, filename); } else { -//? strcpy(name, filename); - UserDir(name, filename, ""); - }*/ + name = filename; + //TODO: is this needed? + // UserDir(name, filename, ""); + } file = fopen(name.c_str(), "rb"); if ( file == NULL ) return false; @@ -3682,22 +3686,20 @@ bool CScript::ReadScript(const char* filename) bool CScript::WriteScript(const char* filename) { Ui::CEdit* edit; + std::string name; - std::string name = CApplication::GetInstancePointer()->GetDataFilePath(DIR_AI, filename); - // TODO: local user dir - /*if ( strchr(filename, '\\') == 0 ) + if ( strchr(filename, '/') == 0 ) //we're writing non user script { - strcpy(name, "script\\"); - strcat(name, filename); + name = CApplication::GetInstancePointer()->GetDataFilePath(DIR_AI, filename); } else { - strcpy(name, filename); - }*/ + name = filename; + } if ( m_script == 0 ) { - // TODO: ? remove(filename); + remove(filename); return false; } diff --git a/src/script/script.h b/src/script/script.h index 5c1118f..dbd66a2 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -14,16 +14,20 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// script.h +/** + * \file script/script.h + * \brief CBot script runner + */ #pragma once -#include <stdio.h> - #include "common/event.h" + #include "CBot/CBotDll.h" +#include <stdio.h> + class CInstanceManager; class CObject; diff --git a/src/sound/sound.h b/src/sound/sound.h index 1f3fea9..c2b890f 100644 --- a/src/sound/sound.h +++ b/src/sound/sound.h @@ -15,15 +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/. -// sound.h - /** - * @file sound/sound.h - * @brief Sound plugin interface + * \file sound/sound.h + * \brief Sound plugin interface */ #pragma once + #include "math/vector.h" #include "common/iman.h" @@ -136,8 +135,7 @@ enum Sound /** - * \public - * \enum SoundNext sound/sound.h + * \enum SoundNext * \brief Enum representing operation that will be performend on a sound at given time **/ enum SoundNext @@ -149,9 +147,9 @@ enum SoundNext /** -* @class CSoundInterface +* \class CSoundInterface * -* @brief Sound plugin interface +* \brief Sound plugin interface * */ class CSoundInterface : public CPluginInterface @@ -164,7 +162,7 @@ class CSoundInterface : public CPluginInterface inline virtual ~CSoundInterface() {}; /** Function to initialize sound device - * @param bool b3D - enable support for 3D sound + * \param b3D - enable support for 3D sound */ inline virtual bool Create(bool b3D) { return true; }; @@ -182,133 +180,133 @@ class CSoundInterface : public CPluginInterface /** Function called to cache sound effect file. * This function is called by plugin interface for each file. - * @param Sound bSound - id of a file, will be used to identify sound files - * @param std::string bFile - file to load - * @return return true on success + * \param bSound - id of a file, will be used to identify sound files + * \param bFile - file to load + * \return return true on success */ inline virtual bool Cache(Sound bSound, std::string bFile) { return true; }; - /** Geturn if plugin is enabled - * @return return true if plugin is enabled + /** Return if plugin is enabled + * \return return true if plugin is enabled */ inline virtual bool GetEnable() {return true;}; /** Change sound mode to 2D/3D - * @param bool bMode - true to enable 3D sound + * \param bMode - true to enable 3D sound */ inline virtual void SetSound3D(bool bMode) {}; - /** Geturn if we use 3D sound - * @return true if we have 3D sound enabled + /** Return if we use 3D sound + * \return true if we have 3D sound enabled */ inline virtual bool GetSound3D() {return true;}; - /** Geturn if we have 3D sound capable card - * @return true for 3D sound support + /** Return if we have 3D sound capable card + * \return true for 3D sound support */ inline virtual bool GetSound3DCap() {return true;}; /** Change global sound volume - * @param int volume - range from 0 to MAXVOLUME + * \param volume - range from 0 to MAXVOLUME */ inline virtual void SetAudioVolume(int volume) {}; - /** Geturn global sound volume - * @return global volume as int in range from 0 to MAXVOLUME + /** Return global sound volume + * \return global volume as int in range from 0 to MAXVOLUME */ inline virtual int GetAudioVolume() {return 0;}; /** Set music volume - * @param int volume - range from 0 to MAXVOLUME + * \param volume - range from 0 to MAXVOLUME */ inline virtual void SetMusicVolume(int volume) {}; - /** Geturn music volume - * @return music volume as int in range from 0 to MAXVOLUME + /** Return music volume + * \return music volume as int in range from 0 to MAXVOLUME */ inline virtual int GetMusicVolume() {return 0;}; /** Set listener position - * @param Math::Vector eye - position of listener - * @param Math::Vector lookat - direction listener is looking at + * \param eye - position of listener + * \param lookat - direction listener is looking at */ inline virtual void SetListener(Math::Vector eye, Math::Vector lookat) {}; /** Update data each frame - * @param float rTime - time since last update + * \param rTime - time since last update */ inline virtual void FrameMove(float rTime) {}; /** Play specific sound - * @param Sound sound - sound to play - * @param float amplitude - change amplitude of sound before playing - * @param float frequency - change sound frequency before playing (0.5 octave down, 2.0 octave up) - * @param bool bLoop - loop sound - * @return identifier of channel that sound will be played on + * \param sound - sound to play + * \param amplitude - change amplitude of sound before playing + * \param frequency - change sound frequency before playing (0.5 octave down, 2.0 octave up) + * \param bLoop - loop sound + * \return identifier of channel that sound will be played on */ inline virtual int Play(Sound sound, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false) {return 0;}; /** Play specific sound - * @param Sound sound - sound to play - * @param Math:Vector pos - position of sound in space - * @param float amplitude - change amplitude of sound before playing - * @param float frequency - change sound frequency before playing (0.5 octave down, 2.0 octave up) - * @param bool bLoop - loop sound - * @return identifier of channel that sound will be played on + * \param sound - sound to play + * \param pos - position of sound in space + * \param amplitude - change amplitude of sound before playing + * \param frequency - change sound frequency before playing (0.5 octave down, 2.0 octave up) + * \param bLoop - loop sound + * \return identifier of channel that sound will be played on */ inline virtual int Play(Sound sound, Math::Vector pos, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false) {return 0;}; /** Remove all operations that would be made on sound in channel. - * @param int channel - channel to work on - * @return return true on success + * \param channel - channel to work on + * \return return true on success */ inline virtual bool FlushEnvelope(int channel) {return true;}; /** Add envelope to sound. Envelope is a operatino that will be performend on sound in future like changing frequency - * @param int channel - channel to work on - * @param float amplitude - change amplitude - * @param float frequency - change frequency - * @param float time - when to change (sample time) - * @param SoundNext oper - operation to perform - * @return return true on success + * \param channel - channel to work on + * \param amplitude - change amplitude + * \param frequency - change frequency + * \param time - when to change (sample time) + * \param oper - operation to perform + * \return return true on success */ inline virtual bool AddEnvelope(int channel, float amplitude, float frequency, float time, SoundNext oper) {return true;}; /** Set sound position in space - * @param int channel - channel to work on - * @param Math::Vector pos - new positino of a sound - * @return return true on success + * \param channel - channel to work on + * \param pos - new positino of a sound + * \return return true on success */ inline virtual bool Position(int channel, Math::Vector pos) {return true;}; /** Set sound frequency - * @param int channel - channel to work on - * @param float frequency - change sound frequency - * @return return true on success + * \param channel - channel to work on + * \param frequency - change sound frequency + * \return return true on success */ inline virtual bool Frequency(int channel, float frequency) {return true;}; /** Stop playing sound - * @param int channel - channel to work on - * @return return true on success + * \param channel - channel to work on + * \return return true on success */ inline virtual bool Stop(int channel) {return true;}; /** Stop playing all sounds - * @return return true on success + * \return return true on success */ inline virtual bool StopAll() {return true;}; /** Mute/unmute all sounds - * @param bool bMute - * @return return true on success + * \param bMute + * \return return true on success */ inline virtual bool MuteAll(bool bMute) {return true;}; /** Start playing music - * @param int rank - track number - * @param bool bRepeat - repeat playing - * @return return true on success + * \param rank - track number + * \param bRepeat - repeat playing + * \return return true on success */ inline virtual bool PlayMusic(int rank, bool bRepeat) {return true;}; @@ -318,17 +316,17 @@ class CSoundInterface : public CPluginInterface inline virtual bool RestartMusic() {return true;}; /** Susspend paying music - * @return return true on success + * \return return true on success */ inline virtual void SuspendMusic() {}; /** Stop playing music - * @return return true on success + * \return return true on success */ inline virtual void StopMusic() {}; /** Check if music if playing - * @return return true if music is playing + * \return return true if music is playing */ inline virtual bool IsPlayingMusic() {return true;}; }; diff --git a/src/ui/control.cpp b/src/ui/control.cpp index 16769d1..718ad3b 100644 --- a/src/ui/control.cpp +++ b/src/ui/control.cpp @@ -21,7 +21,6 @@ namespace Ui { // Object's constructor. - CControl::CControl() { m_iMan = CInstanceManager::GetInstancePointer(); diff --git a/src/ui/control.h b/src/ui/control.h index e08c34d..635ae12 100644 --- a/src/ui/control.h +++ b/src/ui/control.h @@ -1,4 +1,4 @@ -// * This file is part of the COLOBOT source code +// * 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) // * @@ -65,8 +65,7 @@ namespace Ui { class CControl { public: - // CControl(CInstanceManager* iMan); - CControl (); + CControl(); virtual ~CControl(); virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); @@ -117,9 +116,9 @@ namespace Ui { protected: CInstanceManager* m_iMan; Gfx::CEngine* m_engine; + Gfx::CParticle* m_particle; CEventQueue* m_event; CRobotMain* m_main; - Gfx::CParticle* m_particle; CSoundInterface* m_sound; Math::Point m_pos; // corner upper / left diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp index 9b49f68..29499bd 100644 --- a/src/ui/displayinfo.cpp +++ b/src/ui/displayinfo.cpp @@ -232,7 +232,7 @@ bool CDisplayInfo::EventProcess(const Event &event) m_bInfoMaximized = false; } //? m_main->SetEditFull(m_bInfoMaximized); - pw = dynamic_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW4)); + pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW4)); if ( pw != 0 ) { pw->SetMaximized(m_bInfoMaximized); @@ -834,7 +834,7 @@ void CDisplayInfo::StopDisplayInfo() if ( m_bEditLock ) // editing running program? { - pw = dynamic_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW3)); + pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW3)); if ( pw != 0 ) { pw->SetState(STATE_ENABLE); // CStudio operating diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index ca53a7a..e14b19d 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -71,8 +71,6 @@ bool IsSep(int character) //! Object's constructor. - -//CEdit::CEdit(CInstanceManager* iMan) : CControl(iMan) CEdit::CEdit () : CControl () { Math::Point pos; @@ -1796,7 +1794,7 @@ bool CEdit::ReadText(const char *filename, int addSize) if ( SearchKey(buffer+i+5, slot) ) { CRobotMain* main = CRobotMain::GetInstancePointer(); - res = main->GetInputBinding(slot).key; + res = main->GetInputBinding(slot).primary; if ( res != 0 ) { if ( GetResource(RES_KEY, res, iName) ) @@ -1815,7 +1813,7 @@ bool CEdit::ReadText(const char *filename, int addSize) m_format[j] = font; j ++; - res = main->GetInputBinding(slot).joy; + res = main->GetInputBinding(slot).secondary; if ( res != 0 ) { if ( GetResource(RES_KEY, res, iName) ) @@ -3081,7 +3079,7 @@ void CEdit::Justif() if ( m_format.size() == 0 ) { // TODO check if good - + i += m_engine->GetText()->Justify(m_text+i, m_fontType, m_fontSize, width); } @@ -3137,6 +3135,7 @@ void CEdit::Justif() } if ( m_lineTotal >= EDITLINEMAX-2 ) break; } + if ( m_len > 0 && m_text[m_len-1] == '\n' ) { m_lineOffset[m_lineTotal] = m_len; diff --git a/src/ui/edit.h b/src/ui/edit.h index 7414372..35d8b2c 100644 --- a/src/ui/edit.h +++ b/src/ui/edit.h @@ -124,8 +124,8 @@ struct HyperHistory class CEdit : public CControl { public: -// CEdit(CInstanceManager* iMan); CEdit (); + virtual ~CEdit(); bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); diff --git a/src/ui/key.cpp b/src/ui/key.cpp index 26d99ac..9a76127 100644 --- a/src/ui/key.cpp +++ b/src/ui/key.cpp @@ -15,65 +15,48 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// key.cpp - - #include "ui/key.h" -#include <string.h> +#include "common/global.h" + +#include <cstring> namespace Ui { -void GetKeyName(char *name, int key) + +void GetKeyName(char* name, unsigned int key) { - if ( !GetResource(RES_KEY, key, name) ) { - if (isalnum(key)) { - name[0] = key; - name[1] = 0; - } - else { - sprintf(name, "Code %d", key); - } - } + if (!GetResource(RES_KEY, key, name)) + sprintf(name, "Code %d", key); } -// Object's constructor. - CKey::CKey() : CControl() { - m_key[0] = 0; - m_key[1] = 0; - m_bCatch = false; + m_catch = false; - m_app = CApplication::GetInstancePointer(); + m_robotMain = CRobotMain::GetInstancePointer(); } -// Object's destructor. - CKey::~CKey() { + m_robotMain = nullptr; } - -// Creates a new button. - bool CKey::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) { - char name[100]; if (eventMsg == EVENT_NULL) eventMsg = GetUniqueEventType(); CControl::Create(pos, dim, icon, eventMsg); + + char name[100]; GetResource(RES_EVENT, eventMsg, name); SetName(std::string(name)); return true; } - -// Management of an event. - bool CKey::EventProcess(const Event &event) { if (m_state & STATE_DEAD) @@ -81,24 +64,31 @@ bool CKey::EventProcess(const Event &event) CControl::EventProcess(event); - if (event.type == EVENT_MOUSE_BUTTON_DOWN) { + if (event.type == EVENT_MOUSE_BUTTON_DOWN) + { if (event.mouseButton.button == MOUSE_BUTTON_LEFT) // left - m_bCatch = Detect(event.mousePos); + m_catch = Detect(event.mousePos); } - if (event.type == EVENT_KEY_DOWN && m_bCatch) { - m_bCatch = false; + if (event.type == EVENT_KEY_DOWN && m_catch) + { + m_catch = false; - if ( TestKey(event.key.key) ) { // impossible ? + if (TestKey(event.key.key)) // impossible ? + { m_sound->Play(SOUND_TZOING); - } else { - // TODO: test for virtual, joystick, etc. - if ( event.key.key == m_key[0] || event.key.key == m_key[1] ) { - m_key[0] = event.key.key; - m_key[1] = 0; - } else { - m_key[1] = m_key[0]; - m_key[0] = event.key.key; + } + else + { + if (event.key.key == m_binding.primary || event.key.key == m_binding.secondary) + { + m_binding.secondary = KEY_INVALID; + m_binding.primary = event.key.key; + } + else + { + m_binding.secondary = m_binding.primary; + m_binding.primary = event.key.key; } m_sound->Play(SOUND_CLICK); @@ -112,96 +102,88 @@ bool CKey::EventProcess(const Event &event) return true; } - -// Seeks when a key is already used. - -bool CKey::TestKey(int key) +bool CKey::TestKey(unsigned int key) { - if ( key == KEY(PAUSE) || key == KEY(PRINT) ) return true; // blocked key + if (key == KEY(PAUSE) || key == KEY(PRINT)) return true; // blocked key - /* TODO: input bindings - 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! - } + for (int i = 0; i < INPUT_SLOT_MAX; i++) + { + InputSlot slot = static_cast<InputSlot>(i); + InputBinding b = m_robotMain->GetInputBinding(slot); + if (key == b.primary || key == b.secondary) + m_robotMain->SetInputBinding(slot, InputBinding()); // nothing! - 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); - } - } */ + if (b.primary == KEY_INVALID) // first free option? + m_robotMain->SetInputBinding(slot, InputBinding(b.secondary, b.primary)); // shift + } return false; // not used } - -// Draws button. - void CKey::Draw() { - Math::Point iDim, pos; - float zoomExt, zoomInt, h; - int icon; - char text[100]; - - if ( (m_state & STATE_VISIBLE) == 0 ) + if ((m_state & STATE_VISIBLE) == 0) return; - iDim = m_dim; + Math::Point iDim = m_dim; m_dim.x = 200.0f/640.0f; - if ( m_state & STATE_SHADOW ) + if (m_state & STATE_SHADOW) DrawShadow(m_pos, m_dim); m_engine->SetTexture("button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); // was D3DSTATENORMAL - zoomExt = 1.00f; - zoomInt = 0.95f; + float zoomExt = 1.00f; + float zoomInt = 0.95f; - icon = 2; - if ( m_key[0] == 0 && m_key[1] == 0 ) // no shortcut? + int icon = 2; + if (m_binding.primary == KEY_INVALID && m_binding.secondary == KEY_INVALID) // 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 ) + if (m_state & STATE_HILIGHT) icon = 1; - if ( m_state & STATE_CHECK ) + 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 ) + if ((m_state & STATE_ENABLE) == 0) icon = 7; - if ( m_state & STATE_DEAD ) + if (m_state & STATE_DEAD) icon = 17; - if ( m_bCatch ) + if (m_catch) icon = 23; DrawPart(icon, zoomExt, 8.0f / 256.0f); // draws the button - h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize) / 2.0f; + float h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize) / 2.0f; - GetKeyName(text, m_key[0]); - if ( m_key[1] != 0 ) { + char text[100]; + GetKeyName(text, m_binding.primary); + if (m_binding.secondary != KEY_INVALID) + { GetResource(RES_TEXT, RT_KEY_OR, text+strlen(text)); - GetKeyName(text+strlen(text), m_key[1]); + GetKeyName(text+strlen(text), m_binding.secondary); } + Math::Point pos; pos.x = m_pos.x + m_dim.x * 0.5f; pos.y = m_pos.y + m_dim.y * 0.5f; pos.y -= h; @@ -209,7 +191,7 @@ void CKey::Draw() m_dim = iDim; - if ( m_state & STATE_DEAD ) + if (m_state & STATE_DEAD) return; // Draws the name. @@ -219,20 +201,15 @@ void CKey::Draw() m_engine->GetText()->DrawText(std::string(m_name), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_LEFT, 0); } - - -void CKey::SetKey(int option, int key) +void CKey::SetBinding(InputBinding b) { - if ( option < 0 || option > 1 ) return; - - m_key[option] = key; + m_binding = b; } -int CKey::GetKey(int option) +InputBinding CKey::GetBinding() { - if ( option < 0 || option > 1 ) return 0; - - return m_key[option]; + return m_binding; } -} + +} // namespace Ui diff --git a/src/ui/key.h b/src/ui/key.h index 1943f61..2332c9b 100644 --- a/src/ui/key.h +++ b/src/ui/key.h @@ -15,13 +15,13 @@ // * You should have received a copy of the GNU General Public License // * along with this program. If not, see http://www.gnu.org/licenses/. -// key.h +/** + * \file ui/key.h + * \brief Key slot control + */ #pragma once -#include <cctype> -#include <string> - #include "ui/control.h" #include "common/iman.h" @@ -29,33 +29,40 @@ #include "common/restext.h" #include "common/key.h" -#include "app/app.h" namespace Ui { class CKey : public CControl { - public: - CKey(); - virtual ~CKey(); +public: + CKey(); + virtual ~CKey(); - bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); - bool EventProcess(const Event &event); + //! Creates a new key slot button + bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg); + //! Management of an event + bool EventProcess(const Event &event); - void Draw(); + //! Draws button + void Draw(); - void SetKey(int option, int key); - int GetKey(int option); + //! Management of binding + //@{ + void SetBinding(InputBinding b); + InputBinding GetBinding(); + //@} - protected: - bool TestKey(int key); +protected: + //! Checks if a key is already used + bool TestKey(unsigned int key); - unsigned int m_key[2]; - bool m_bCatch; +protected: + CRobotMain* m_robotMain; - CApplication *m_app; + InputBinding m_binding; + bool m_catch; }; -} +} // namespace Ui diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index d7295eb..5136a41 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -8,7 +8,7 @@ // * // * This program is distributed in the hope that it will be useful, // * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A Gfx::PARTICULAR PURPOSE. See the +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // * GNU General Public License for more details. // * // * You should have received a copy of the GNU General Public License @@ -5476,7 +5476,6 @@ void CMainDialog::SetupMemorize() { float fValue; int iValue, i, j; - char key[500]; char num[10]; GetProfile().SetLocalProfileString("Directory", "scene", m_sceneDir); @@ -5518,21 +5517,16 @@ void CMainDialog::SetupMemorize() // GetProfile()->SetLocalProfileInt("Setup", "UseJoystick", m_engine->GetJoystick()); // GetProfile()->SetLocalProfileInt("Setup", "MidiVolume", m_sound->GetMidiVolume()); - // key[0] = 0; - // for ( i=0 ; i<100 ; i++ ) - // { - // if ( m_engine->GetKey(i, 0) == 0 ) break; - - // for ( j=0 ; j<2 ; j++ ) - // { - // iValue = m_engine->GetKey(i, j); - // sprintf(num, "%d%c", iValue, j==0?'+':' '); - // strcat(key, num); - // } - // } + std::stringstream key; + for (int i = 0; i < INPUT_SLOT_MAX; i++) + { + InputBinding b = m_main->GetInputBinding(static_cast<InputSlot>(i)); - /* TODO: profile - SetLocalProfileString("Setup", "KeyMap", key); */ + key << b.primary << " "; + key << b.secondary << " "; + } + + GetProfile().SetLocalProfileString("Setup", "KeyMap", key.str()); #if _NET if ( m_accessEnable ) @@ -5556,9 +5550,8 @@ void CMainDialog::SetupMemorize() void CMainDialog::SetupRecall() { float fValue; - int iValue, i, j; + int iValue; std::string key; - char* p; if ( GetProfile().GetLocalProfileString("Directory", "scene", key) ) { @@ -5747,22 +5740,18 @@ void CMainDialog::SetupRecall() m_engine->SetEditIndentValue(iValue); } - // if ( GetLocalProfileString("Setup", "KeyMap", key, 500) ) - // { - // p = key; - // for ( i=0 ; i<100 ; i++ ) - // { - // if ( p[0] == 0 ) break; - - // for ( j=0 ; j<2 ; j++ ) - // { - // sscanf(p, "%d", &iValue); - // m_engine->SetKey(i, j, iValue); - // while ( *p >= '0' && *p <= '9' ) p++; - // while ( *p == ' ' || *p == '+' ) p++; - // } - // } - // } + if (GetProfile().GetLocalProfileString("Setup", "KeyMap", key)) + { + std::stringstream skey; + skey.str(key); + for (int i = 0; i < INPUT_SLOT_MAX; i++) + { + InputBinding b; + skey >> b.primary; + skey >> b.secondary; + m_main->SetInputBinding(static_cast<InputSlot>(i), b); + } + } #if _NET if ( m_accessEnable ) @@ -5837,7 +5826,7 @@ void CMainDialog::ChangeSetupQuality(int quality) // Redefinable keys: -static int key_table[KEY_TOTAL] = +static InputSlot key_table[KEY_TOTAL] = { INPUT_SLOT_LEFT, INPUT_SLOT_RIGHT, @@ -5891,37 +5880,30 @@ static EventType key_event[KEY_TOTAL] = void CMainDialog::UpdateKey() { - CWindow* pw; - CScroll* ps; - CKey* pk; - Math::Point pos, dim; - int first, i; + CWindow* pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); + if (pw == nullptr) return; - pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); - if ( pw == 0 ) return; - - ps = static_cast<CScroll*>(pw->SearchControl(EVENT_INTERFACE_KSCROLL)); - if ( ps == 0 ) return; + CScroll* ps = static_cast<CScroll*>(pw->SearchControl(EVENT_INTERFACE_KSCROLL)); + if (ps == nullptr) return; - first = static_cast<int>(ps->GetVisibleValue()*(KEY_TOTAL-KEY_VISIBLE)); + int first = static_cast<int>(ps->GetVisibleValue()*(KEY_TOTAL-KEY_VISIBLE)); - for ( i=0 ; i<KEY_TOTAL ; i++ ) - { + for (int i = 0; i < KEY_TOTAL; i++) pw->DeleteControl(key_event[i]); - } + Math::Point dim; dim.x = 400.0f/640.0f; dim.y = 20.0f/480.0f; + Math::Point pos; pos.x = 110.0f/640.0f; pos.y = 168.0f/480.0f + dim.y*(KEY_VISIBLE-1); - for ( i=0 ; i<KEY_VISIBLE ; i++ ) + for (int i = 0; i < KEY_VISIBLE; i++) { pw->CreateKey(pos, dim, -1, key_event[first+i]); - pk = static_cast<CKey*>(pw->SearchControl(key_event[first+i])); - if ( pk == 0 ) break; - /* TODO: set input bindings - pk->SetKey(0, m_engine->GetKey(key_table[first+i], 0)); - pk->SetKey(1, m_engine->GetKey(key_table[first+i], 1)); */ + CKey* pk = static_cast<CKey*>(pw->SearchControl(key_event[first+i])); + if (pk == nullptr) break; + + pk->SetBinding(m_main->GetInputBinding(key_table[first+i])); pos.y -= dim.y; } } @@ -5930,26 +5912,20 @@ void CMainDialog::UpdateKey() void CMainDialog::ChangeKey(EventType event) { - CWindow* pw; - CScroll* ps; - CKey* pk; - int i; - - pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); - if ( pw == 0 ) return; + CWindow* pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); + if (pw == nullptr) return; - ps = static_cast<CScroll*>(pw->SearchControl(EVENT_INTERFACE_KSCROLL)); - if ( ps == 0 ) return; + CScroll* ps = static_cast<CScroll*>(pw->SearchControl(EVENT_INTERFACE_KSCROLL)); + if (ps == nullptr) return; - for ( i=0 ; i<KEY_TOTAL ; i++ ) + for (int i = 0; i < KEY_TOTAL; i++) { if ( key_event[i] == event ) { - pk = static_cast<CKey*>(pw->SearchControl(key_event[i])); - if ( pk == 0 ) break; - /* TODO: set key binding - m_engine->SetKey(key_table[i], 0, pk->GetKey(0)); - m_engine->SetKey(key_table[i], 1, pk->GetKey(1)); */ + CKey* pk = static_cast<CKey*>(pw->SearchControl(key_event[i])); + if (pk == nullptr) break; + + m_main->SetInputBinding(key_table[i], pk->GetBinding()); } } } @@ -6803,4 +6779,3 @@ bool CMainDialog::NextMission() } // namespace Ui - diff --git a/src/ui/mainshort.cpp b/src/ui/mainshort.cpp index ac6d7fc..55b9612 100644 --- a/src/ui/mainshort.cpp +++ b/src/ui/mainshort.cpp @@ -30,7 +30,7 @@ CMainShort::CMainShort() m_iMan->AddInstance(CLASS_SHORT, this); m_interface = static_cast<CInterface*>(m_iMan->SearchInstance(CLASS_INTERFACE)); - m_event = static_cast<CEvent*>(m_iMan->SearchInstance(CLASS_EVENT)); + m_event = static_cast<CEventQueue*>(m_iMan->SearchInstance(CLASS_EVENT)); m_engine = static_cast<Gfx::CEngine*>(m_iMan->SearchInstance(CLASS_ENGINE)); m_main = static_cast<CRobotMain*>(m_iMan->SearchInstance(CLASS_MAIN)); diff --git a/src/ui/mainshort.h b/src/ui/mainshort.h index e97bdcc..0912e68 100644 --- a/src/ui/mainshort.h +++ b/src/ui/mainshort.h @@ -47,7 +47,7 @@ class CMainShort protected: CInstanceManager* m_iMan; - CEvent* m_event; + CEventQueue* m_event; Gfx::CEngine* m_engine; CInterface* m_interface; CRobotMain* m_main; diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index a581baa..2f58c95 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -241,8 +241,8 @@ bool CStudio::EventProcess(const Event &event) if ( event.type == EVENT_KEY_DOWN ) { - if ( event.key.key == m_main->GetInputBinding(INPUT_SLOT_CBOT).key || - event.key.key == m_main->GetInputBinding(INPUT_SLOT_CBOT).joy ) + if ( event.key.key == m_main->GetInputBinding(INPUT_SLOT_CBOT).primary || + event.key.key == m_main->GetInputBinding(INPUT_SLOT_CBOT).secondary ) { if ( m_helpFilename.length() > 0 ) { diff --git a/src/ui/test/CMakeLists.txt b/src/ui/test/CMakeLists.txt new file mode 100644 index 0000000..9e11e14 --- /dev/null +++ b/src/ui/test/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 2.8) + +set(CMAKE_BUILD_TYPE debug) +set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x") + +include_directories( +. +../.. +../../.. +${GTEST_DIR}/include +) + + +add_executable(edit_test + ../../common/event.cpp + ../../common/logger.cpp + ../../common/misc.cpp + ../../common/iman.cpp + ../../common/stringutils.cpp + ../../graphics/engine/text.cpp + ../button.cpp + ../control.cpp + ../edit.cpp + ../scroll.cpp + stubs/app_stub.cpp + stubs/engine_stub.cpp + stubs/particle_stub.cpp + stubs/restext_stub.cpp + stubs/robotmain_stub.cpp + edit_test.cpp) +target_link_libraries(edit_test gtest gmock ${SDL_LIBRARY} ${SDLTTF_LIBRARY}) + +add_test(edit_test ./edit_test) diff --git a/src/ui/test/edit_test.cpp b/src/ui/test/edit_test.cpp new file mode 100644 index 0000000..489b873 --- /dev/null +++ b/src/ui/test/edit_test.cpp @@ -0,0 +1,73 @@ +#include "../edit.h" +#include "../../app/app.h" +#include "mocks/text_mock.h" +#include <gtest/gtest.h> +#include <gmock/gmock.h> +#include <fstream> + +class CEditTest : public testing::Test +{ +public: + CEditTest(){}; + + virtual void SetUp() + { + m_engine = new Gfx::CEngine(&m_iMan, NULL); + + m_iMan.AddInstance(CLASS_ENGINE, m_engine); + m_edit = new Ui::CEdit; + } + + virtual void TearDown() + { + m_iMan.DeleteInstance(CLASS_ENGINE, m_engine); + delete m_engine; + m_engine = NULL; + delete m_edit; + m_edit = NULL; + + } + virtual ~CEditTest() + { + + }; + +protected: + CInstanceManager m_iMan; + CApplication m_app; + Gfx::CEngine * m_engine; + Ui::CEdit * m_edit; + CLogger m_logger; +}; + +using ::testing::_; +using ::testing::Return; + +TEST_F(CEditTest, WriteTest) +{ + ASSERT_TRUE(true); + CTextMock * text = dynamic_cast<CTextMock *>(m_engine->GetText()); + EXPECT_CALL(*text, GetCharWidth(_, _, _, _)).WillRepeatedly(Return(1.0f)); + EXPECT_CALL(*text, GetStringWidth(_, _, _)).WillOnce(Return(1.0f)); + std::string filename = "test.file"; + m_edit->SetMaxChar(Ui::EDITSTUDIOMAX); + m_edit->SetAutoIndent(true); + std::string inputScript = "{\ntext1\ntext2\n\ntext3\n{\ntext4\n}\n}"; + std::string expectedScript = "{\r\n\ttext1\r\n\ttext2\r\n\t\r\n\ttext3\r\n\t{\r\n\t\ttext4\r\n\t}\r\n}"; + m_edit->SetText(inputScript.c_str(), true); + GetLogger()->Info("Writing text \n"); + m_edit->WriteText("script.txt"); + + std::fstream scriptFile; + + scriptFile.open("script.txt", std::ios_base::binary | std::ios_base::in); + std::string outputScript((std::istreambuf_iterator<char>(scriptFile)), std::istreambuf_iterator<char>()); + ASSERT_STREQ(expectedScript.c_str(), outputScript.c_str()); +} + +int main(int argc, char *argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + diff --git a/src/ui/test/mocks/text_mock.h b/src/ui/test/mocks/text_mock.h new file mode 100644 index 0000000..59a6c48 --- /dev/null +++ b/src/ui/test/mocks/text_mock.h @@ -0,0 +1,21 @@ +#include "../../graphics/engine/text.h" +#include <gmock/gmock.h> +#include "../../common/logger.h" + + +class CTextMock : public Gfx::CText +{ +public: + CTextMock(CInstanceManager *iMan, Gfx::CEngine* engine) : CText(iMan, engine) + { + } + + virtual ~CTextMock() + { + }; + + MOCK_METHOD4(GetCharWidth, float(Gfx::UTF8Char, Gfx::FontType, float, float)); + MOCK_METHOD3(GetStringWidth, float(const std::string &, Gfx::FontType, float)); + +}; + diff --git a/src/ui/test/stubs/app_stub.cpp b/src/ui/test/stubs/app_stub.cpp new file mode 100644 index 0000000..5dd79e4 --- /dev/null +++ b/src/ui/test/stubs/app_stub.cpp @@ -0,0 +1,26 @@ +#include "../../app/app.h" +#include "../../graphics/opengl/gldevice.h" + +template<> CApplication* CSingleton<CApplication>::mInstance = nullptr; + +namespace Gfx { + +GLDeviceConfig::GLDeviceConfig() +{ +} + +} /* Gfx */ +CApplication::CApplication() +{ +} + +CApplication::~CApplication() +{ +} + +std::string CApplication::GetDataFilePath(DataDir /* dataDir */, const std::string& subpath) +{ + return subpath; +} + + diff --git a/src/ui/test/stubs/engine_stub.cpp b/src/ui/test/stubs/engine_stub.cpp new file mode 100644 index 0000000..6ec6006 --- /dev/null +++ b/src/ui/test/stubs/engine_stub.cpp @@ -0,0 +1,79 @@ +#include "../../graphics/engine/engine.h" +#include "../../graphics/engine/text.h" +#include "../mocks/text_mock.h" + +namespace Gfx { + +CEngine::CEngine(CInstanceManager* iMan, CApplication* app) : + m_iMan(iMan), m_app(app) +{ + m_text = new CTextMock(m_iMan, this); + m_text->Create(); +} + +CEngine::~CEngine() +{ + delete m_text; + m_text = NULL; +} + +Math::Point CEngine::WindowToInterfaceSize(Math::IntPoint size) +{ + return Math::Point(size.x, size.y); +} + +void CEngine::SetState(int state, const Color& color) +{ + if (state == m_lastState && color == m_lastColor) + return; + + m_lastState = state; + m_lastColor = color; +} + +Math::IntPoint CEngine::GetWindowSize() +{ + return m_size; +} + +void CEngine::AddStatisticTriangle(int count) +{ + m_statisticTriangle += count; +} + +void CEngine::SetMouseType(EngineMouseType type) +{ + m_mouseType = type; +} + +bool CEngine::SetTexture(const std::string& /* name */, int /* stage */) +{ + return true; +} + +CText* CEngine::GetText() +{ + return m_text; +} + +CDevice* CEngine::GetDevice() +{ + return m_device; +} + +int CEngine::GetEditIndentValue() +{ + return m_editIndentValue; +} + +void CEngine::DeleteTexture(const std::string& /* texName */) +{ +} +Texture CEngine::LoadTexture(const std::string& /* name */) +{ + Texture texture; + return texture; +} + +} /* Gfx */ + diff --git a/src/ui/test/stubs/particle_stub.cpp b/src/ui/test/stubs/particle_stub.cpp new file mode 100644 index 0000000..41f07cc --- /dev/null +++ b/src/ui/test/stubs/particle_stub.cpp @@ -0,0 +1,291 @@ +#include "graphics/engine/particle.h" + +#include "common/logger.h" + + +// Graphics module namespace +namespace Gfx { + + +CParticle::CParticle(CInstanceManager* iMan, CEngine* engine) +{ + GetLogger()->Trace("CParticle::CParticle() stub!\n"); + // TODO! +} + +CParticle::~CParticle() +{ + GetLogger()->Trace("CParticle::~CParticle() stub!\n"); + // TODO! +} + +void CParticle::SetDevice(CDevice* device) +{ + GetLogger()->Trace("CParticle::SetDevice() stub!\n"); + // TODO! +} + +void CParticle::FlushParticle() +{ + GetLogger()->Trace("CParticle::FlushParticle() stub!\n"); + // TODO! +} + +void CParticle::FlushParticle(int sheet) +{ + GetLogger()->Trace("CParticle::FlushParticle() stub!\n"); + // TODO! +} + +int CParticle::CreateParticle(Math::Vector pos, Math::Vector speed, Math::Point dim, + ParticleType type, float duration, float mass, + float windSensitivity, int sheet) +{ + GetLogger()->Trace("CParticle::CreateParticle() stub!\n"); + // TODO! + return 0; +} + +int CParticle::CreateFrag(Math::Vector pos, Math::Vector speed, EngineTriangle *triangle, + ParticleType type, float duration, float mass, + float windSensitivity, int sheet) +{ + GetLogger()->Trace("CParticle::CreateFrag() stub!\n"); + // TODO! + return 0; +} + +int CParticle::CreatePart(Math::Vector pos, Math::Vector speed, ParticleType type, + float duration, float mass, float weight, + float windSensitivity, int sheet) +{ + GetLogger()->Trace("CParticle::CreatePart() stub!\n"); + // TODO! + return 0; +} + +int CParticle::CreateRay(Math::Vector pos, Math::Vector goal, ParticleType type, Math::Point dim, + float duration, int sheet) +{ + GetLogger()->Trace("CParticle::CreateRay() stub!\n"); + // TODO! + return 0; +} + +int CParticle::CreateTrack(Math::Vector pos, Math::Vector speed, Math::Point dim, ParticleType type, + float duration, float mass, float length, float width) +{ + GetLogger()->Trace("CParticle::CreateTrack() stub!\n"); + // TODO! + return 0; +} + +void CParticle::CreateWheelTrace(const Math::Vector &p1, const Math::Vector &p2, const Math::Vector &p3, + const Math::Vector &p4, ParticleType type) +{ + GetLogger()->Trace("CParticle::CreateWheelTrace() stub!\n"); + // TODO! +} + +void CParticle::DeleteParticle(ParticleType type) +{ + GetLogger()->Trace("CParticle::DeleteParticle() stub!\n"); + // TODO! +} + +void CParticle::DeleteParticle(int channel) +{ + GetLogger()->Trace("CParticle::DeleteParticle() stub!\n"); + // TODO! +} + +void CParticle::SetObjectLink(int channel, CObject *object) +{ + GetLogger()->Trace("CParticle::SetObjectLink() stub!\n"); + // TODO! +} + +void CParticle::SetObjectFather(int channel, CObject *object) +{ + GetLogger()->Trace("CParticle::SetObjectFather() stub!\n"); + // TODO! +} + +void CParticle::SetPosition(int channel, Math::Vector pos) +{ + GetLogger()->Trace("CParticle::SetPosition() stub!\n"); + // TODO! +} + +void CParticle::SetDimension(int channel, Math::Point dim) +{ + GetLogger()->Trace("CParticle::SetDimension() stub!\n"); + // TODO! +} + +void CParticle::SetZoom(int channel, float zoom) +{ + GetLogger()->Trace("CParticle::SetZoom() stub!\n"); + // TODO! +} + +void CParticle::SetAngle(int channel, float angle) +{ + GetLogger()->Trace("CParticle::SetAngle() stub!\n"); + // TODO! +} + +void CParticle::SetIntensity(int channel, float intensity) +{ + GetLogger()->Trace("CParticle::SetIntensity() stub!\n"); + // TODO! +} + +void CParticle::SetParam(int channel, Math::Vector pos, Math::Point dim, float zoom, float angle, float intensity) +{ + GetLogger()->Trace("CParticle::SetParam() stub!\n"); + // TODO! +} + +void CParticle::SetPhase(int channel, ParticlePhase phase, float duration) +{ + GetLogger()->Trace("CParticle::SetPhase() stub!\n"); + // TODO! +} + +bool CParticle::GetPosition(int channel, Math::Vector &pos) +{ + GetLogger()->Trace("CParticle::GetPosition() stub!\n"); + // TODO! + return true; +} + +Color CParticle::GetFogColor(Math::Vector pos) +{ + GetLogger()->Trace("CParticle::GetFogColor() stub!\n"); + // TODO! + return Color(); +} + +void CParticle::SetFrameUpdate(int sheet, bool update) +{ + GetLogger()->Trace("CParticle::SetFrameUpdate() stub!\n"); + // TODO! +} + +void CParticle::FrameParticle(float rTime) +{ + GetLogger()->Trace("CParticle::FrameParticle() stub!\n"); + // TODO! +} + +void CParticle::DrawParticle(int sheet) +{ + GetLogger()->Trace("CParticle::DrawParticle() stub!\n"); + // TODO! +} + +bool CParticle::WriteWheelTrace(const char *filename, int width, int height, Math::Vector dl, Math::Vector ur) +{ + GetLogger()->Trace("CParticle::WriteWheelTrace() stub!\n"); + // TODO! + return true; +} + +void CParticle::DeleteRank(int rank) +{ + GetLogger()->Trace("CParticle::DeleteRank() stub!\n"); + // TODO! +} + +bool CParticle::CheckChannel(int &channel) +{ + GetLogger()->Trace("CParticle::CheckChannel() stub!\n"); + // TODO! + return true; +} + +void CParticle::DrawParticleTriangle(int i) +{ + GetLogger()->Trace("CParticle::DrawParticleTriangle() stub!\n"); + // TODO! +} + +void CParticle::DrawParticleNorm(int i) +{ + GetLogger()->Trace("CParticle::DrawParticleNorm() stub!\n"); + // TODO! +} + +void CParticle::DrawParticleFlat(int i) +{ + GetLogger()->Trace("CParticle::DrawParticleFlat() stub!\n"); + // TODO! +} + +void CParticle::DrawParticleFog(int i) +{ + GetLogger()->Trace("CParticle::DrawParticleFog() stub!\n"); + // TODO! +} + +void CParticle::DrawParticleRay(int i) +{ + GetLogger()->Trace("CParticle::DrawParticleRay() stub!\n"); + // TODO! +} + +void CParticle::DrawParticleSphere(int i) +{ + GetLogger()->Trace("CParticle::DrawParticleSphere() stub!\n"); + // TODO! +} + +void CParticle::DrawParticleCylinder(int i) +{ + GetLogger()->Trace("CParticle::DrawParticleCylinder() stub!\n"); + // TODO! +} + +void CParticle::DrawParticleWheel(int i) +{ + GetLogger()->Trace("CParticle::DrawParticleWheel() stub!\n"); + // TODO! +} + +CObject* CParticle::SearchObjectGun(Math::Vector old, Math::Vector pos, ParticleType type, CObject *father) +{ + GetLogger()->Trace("CParticle::SearchObjectGun() stub!\n"); + // TODO! + return nullptr; +} + +CObject* CParticle::SearchObjectRay(Math::Vector pos, Math::Vector goal, ParticleType type, CObject *father) +{ + GetLogger()->Trace("CParticle::SearchObjectRay() stub!\n"); + // TODO! + return nullptr; +} + +void CParticle::Play(Sound sound, Math::Vector pos, float amplitude) +{ + GetLogger()->Trace("CParticle::Play() stub!\n"); + // TODO! +} + +bool CParticle::TrackMove(int i, Math::Vector pos, float progress) +{ + GetLogger()->Trace("CParticle::TrackMove() stub!\n"); + // TODO! + return true; +} + +void CParticle::TrackDraw(int i, ParticleType type) +{ + GetLogger()->Trace("CParticle::TrackDraw() stub!\n"); + // TODO! +} + + +} // namespace Gfx + diff --git a/src/ui/test/stubs/restext_stub.cpp b/src/ui/test/stubs/restext_stub.cpp new file mode 100644 index 0000000..c1986ca --- /dev/null +++ b/src/ui/test/stubs/restext_stub.cpp @@ -0,0 +1,11 @@ +#include "../../common/restext.h" +bool GetResource(ResType /* type */, int /* num */, char* /* text */) +{ + return true; +} + +bool SearchKey(const char * /* cmd */, InputSlot & /* key */) +{ + return true; +} + diff --git a/src/ui/test/stubs/robotmain_stub.cpp b/src/ui/test/stubs/robotmain_stub.cpp new file mode 100644 index 0000000..93e0e82 --- /dev/null +++ b/src/ui/test/stubs/robotmain_stub.cpp @@ -0,0 +1,17 @@ +#include "../../object/robotmain.h" + + +template<> CRobotMain* CSingleton<CRobotMain>::mInstance = nullptr; + +bool CRobotMain::GetGlint() +{ + return false; +} + +const InputBinding& CRobotMain::GetInputBinding(InputSlot slot) +{ + unsigned int index = static_cast<unsigned int>(slot); + assert(index >= 0 && index < INPUT_SLOT_MAX); + return m_inputBindings[index]; +} + |