Browse Source

Added some more commands

Thomas Buck 10 years ago
parent
commit
e54e18e7e6

+ 6
- 0
ChangeLog.md View File

@@ -2,6 +2,12 @@
2 2
 
3 3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
4 4
 
5
+    [ 20140829 ]
6
+    * Moved key/action/string comparison functions into CommandBind
7
+    * Added Renderflag command to toggle all flags in Render
8
+    * Reimplemented pigtail and ponypos commands. Now all commands
9
+      that were commented-out are back.
10
+
5 11
     [ 20140827 ]
6 12
     * Rewrote command system. Each command is now a unique class.
7 13
 

+ 11
- 1
include/commands/CommandBind.h View File

@@ -10,7 +10,17 @@
10 10
 
11 11
 #include "commands/Command.h"
12 12
 
13
-DECLARE_SIMPLE_CMD(CommandBind);
13
+class CommandBind : public Command {
14
+public:
15
+    virtual std::string name();
16
+    virtual std::string brief();
17
+    virtual void printHelp();
18
+    virtual int execute(std::istream& args);
19
+
20
+private:
21
+    ActionEvents stringToActionEvent(std::string action);
22
+    KeyboardButton stringToKeyboardButton(std::string key);
23
+};
14 24
 
15 25
 #endif
16 26
 

+ 4
- 0
include/commands/CommandGame.h View File

@@ -14,5 +14,9 @@ DECLARE_SIMPLE_CMD_NO_HELP(CommandPos);
14 14
 
15 15
 DECLARE_SIMPLE_CMD_NO_HELP(CommandViewmodel);
16 16
 
17
+DECLARE_SIMPLE_CMD_NO_HELP(CommandPigtail);
18
+
19
+DECLARE_SIMPLE_CMD_NO_HELP(CommandPonypos);
20
+
17 21
 #endif
18 22
 

+ 9
- 2
include/commands/CommandRender.h View File

@@ -12,9 +12,16 @@
12 12
 
13 13
 DECLARE_SIMPLE_CMD(CommandMode);
14 14
 
15
-DECLARE_SIMPLE_CMD_NO_HELP(CommandFog);
15
+class CommandRenderflag : public Command {
16
+public:
17
+    virtual std::string name();
18
+    virtual std::string brief();
19
+    virtual void printHelp();
20
+    virtual int execute(std::istream& args);
16 21
 
17
-DECLARE_SIMPLE_CMD_NO_HELP(CommandLight);
22
+private:
23
+    int stringToFlag(std::string flag);
24
+};
18 25
 
19 26
 #endif
20 27
 

+ 0
- 4
include/global.h View File

@@ -80,10 +80,6 @@ typedef enum {
80 80
     unknownKey // Should always be at the end
81 81
 } KeyboardButton;
82 82
 
83
-ActionEvents stringToActionEvent(const char *action);
84
-
85
-KeyboardButton stringToKeyboardButton(const char *key);
86
-
87 83
 // Visual C++ does not understand __attribute__
88 84
 #ifdef _MSC_VER
89 85
 #define __attribute__(x)

+ 3
- 2
src/OpenRaider.cpp View File

@@ -51,11 +51,12 @@ OpenRaider::OpenRaider() {
51 51
     commands.push_back(std::shared_ptr<Command>(new CommandAnimate()));
52 52
     commands.push_back(std::shared_ptr<Command>(new CommandMove()));
53 53
     commands.push_back(std::shared_ptr<Command>(new CommandMode()));
54
-    commands.push_back(std::shared_ptr<Command>(new CommandFog()));
55
-    commands.push_back(std::shared_ptr<Command>(new CommandLight()));
54
+    commands.push_back(std::shared_ptr<Command>(new CommandRenderflag()));
56 55
     commands.push_back(std::shared_ptr<Command>(new CommandSound()));
57 56
     commands.push_back(std::shared_ptr<Command>(new CommandPos()));
58 57
     commands.push_back(std::shared_ptr<Command>(new CommandViewmodel()));
58
+    commands.push_back(std::shared_ptr<Command>(new CommandPigtail()));
59
+    commands.push_back(std::shared_ptr<Command>(new CommandPonypos()));
59 60
     commands.push_back(std::shared_ptr<Command>(new CommandQuit()));
60 61
 }
61 62
 

+ 155
- 0
src/commands/CommandBind.cpp View File

@@ -61,3 +61,158 @@ int CommandBind::execute(std::istream& args) {
61 61
     }
62 62
 }
63 63
 
64
+ActionEvents CommandBind::stringToActionEvent(std::string action) {
65
+    if (action == "menu") {
66
+        return menuAction;
67
+    } else if (action == "console") {
68
+        return consoleAction;
69
+    } else if (action == "forward") {
70
+        return forwardAction;
71
+    } else if (action == "backward") {
72
+        return backwardAction;
73
+    } else if (action == "left") {
74
+        return leftAction;
75
+    } else if (action == "right") {
76
+        return rightAction;
77
+    } else if (action == "jump") {
78
+        return jumpAction;
79
+    } else if (action == "crouch") {
80
+        return crouchAction;
81
+    } else if (action == "use") {
82
+        return useAction;
83
+    } else if (action == "holster") {
84
+        return holsterAction;
85
+    } else if (action == "walk") {
86
+        return walkAction;
87
+    } else {
88
+        return ActionEventCount;
89
+    }
90
+}
91
+
92
+KeyboardButton CommandBind::stringToKeyboardButton(std::string key) {
93
+    if ((key.length() == 3) && (key[0] == '\'') && (key[2] == '\'')) {
94
+        // Literal character like w, a, s, d, 0, 1...
95
+        char c = key[1];
96
+        if (((c >= '0') && (c <= '9'))
97
+            || ((c >= 'a') && (c <= 'z')))
98
+            return (KeyboardButton)c;
99
+    } else if ((key.length() >= 3) && (key[0] == '\"') && (key[key.length() - 1] == '\"')) {
100
+        // Special characters like tilde, esc, quote...
101
+        key.erase(key.length() - 1); // Delete " at end
102
+        key.erase(0, 1); // Delete " at beginning
103
+        if (key == "quote") {
104
+            return quoteKey;
105
+        } else if (key == "backslash") {
106
+            return backslashKey;
107
+        } else if (key == "backspace") {
108
+            return backspaceKey;
109
+        } else if (key == "capslock") {
110
+            return capslockKey;
111
+        } else if (key == "comma") {
112
+            return commaKey;
113
+        } else if (key == "del") {
114
+            return delKey;
115
+        } else if (key == "up") {
116
+            return upKey;
117
+        } else if (key == "down") {
118
+            return downKey;
119
+        } else if (key == "left") {
120
+            return leftKey;
121
+        } else if (key == "right") {
122
+            return rightKey;
123
+        } else if (key == "end") {
124
+            return endKey;
125
+        } else if (key == "equals") {
126
+            return equalsKey;
127
+        } else if (key == "escape") {
128
+            return escapeKey;
129
+        } else if (key == "f1") {
130
+            return f1Key;
131
+        } else if (key == "f2") {
132
+            return f2Key;
133
+        } else if (key == "f3") {
134
+            return f3Key;
135
+        } else if (key == "f4") {
136
+            return f4Key;
137
+        } else if (key == "f5") {
138
+            return f5Key;
139
+        } else if (key == "f6") {
140
+            return f6Key;
141
+        } else if (key == "f7") {
142
+            return f7Key;
143
+        } else if (key == "f8") {
144
+            return f8Key;
145
+        } else if (key == "f9") {
146
+            return f9Key;
147
+        } else if (key == "f10") {
148
+            return f10Key;
149
+        } else if (key == "f11") {
150
+            return f11Key;
151
+        } else if (key == "f12") {
152
+            return f12Key;
153
+        } else if (key == "backquote") {
154
+            return backquoteKey;
155
+        } else if (key == "home") {
156
+            return homeKey;
157
+        } else if (key == "insert") {
158
+            return insertKey;
159
+        } else if (key == "leftalt") {
160
+            return leftaltKey;
161
+        } else if (key == "leftctrl") {
162
+            return leftctrlKey;
163
+        } else if (key == "leftbracket") {
164
+            return leftbracketKey;
165
+        } else if (key == "leftgui") {
166
+            return leftguiKey;
167
+        } else if (key == "leftshift") {
168
+            return leftshiftKey;
169
+        } else if (key == "minus") {
170
+            return minusKey;
171
+        } else if (key == "numlock") {
172
+            return numlockKey;
173
+        } else if (key == "pagedown") {
174
+            return pagedownKey;
175
+        } else if (key == "pageup") {
176
+            return pageupKey;
177
+        } else if (key == "pause") {
178
+            return pauseKey;
179
+        } else if (key == "dot") {
180
+            return dotKey;
181
+        } else if (key == "rightalt") {
182
+            return rightaltKey;
183
+        } else if (key == "rightctrl") {
184
+            return rightctrlKey;
185
+        } else if (key == "enter") {
186
+            return enterKey;
187
+        } else if (key == "rightgui") {
188
+            return rightguiKey;
189
+        } else if (key == "rightbracket") {
190
+            return rightbracketKey;
191
+        } else if (key == "rightshift") {
192
+            return rightshiftKey;
193
+        } else if (key == "scrolllock") {
194
+            return scrolllockKey;
195
+        } else if (key == "semicolon") {
196
+            return semicolonKey;
197
+        } else if (key == "slash") {
198
+            return slashKey;
199
+        } else if (key == "space") {
200
+            return spaceKey;
201
+        } else if (key == "tab") {
202
+            return tabKey;
203
+        } else if (key == "leftmouse") {
204
+            return leftmouseKey;
205
+        } else if (key == "middlemouse") {
206
+            return middlemouseKey;
207
+        } else if (key == "rightmouse") {
208
+            return rightmouseKey;
209
+        } else if (key == "fourthmouse") {
210
+            return fourthmouseKey;
211
+        } else if (key == "fifthmouse") {
212
+            return fifthmouseKey;
213
+        }
214
+    }
215
+
216
+    return unknownKey;
217
+}
218
+

+ 55
- 0
src/commands/CommandGame.cpp View File

@@ -61,3 +61,58 @@ int CommandViewmodel::execute(std::istream& args) {
61 61
     }
62 62
 }
63 63
 
64
+// --------------------------------------
65
+
66
+std::string CommandPigtail::name() {
67
+    return "pigtail";
68
+}
69
+
70
+std::string CommandPigtail::brief() {
71
+    return "BOOL";
72
+}
73
+
74
+int CommandPigtail::execute(std::istream& args) {
75
+    if ((!getOpenRaider().mRunning) || (!getGame().isLoaded())) {
76
+        getConsole() << "Use pigtail command interactively!" << Console::endl;
77
+        return -1;
78
+    }
79
+
80
+    bool b;
81
+    args >> b;
82
+    if (!args) {
83
+        getConsole() << "Pass BOOL to pigtail command!" << Console::endl;
84
+        return -2;
85
+    }
86
+
87
+    getGame().getLara().getModel().setPigTail(b);
88
+    getConsole() << "Pigtail is now " << (b ? "on" : "off") << Console::endl;
89
+    return 0;
90
+}
91
+
92
+// --------------------------------------
93
+
94
+std::string CommandPonypos::name() {
95
+    return "ponypos";
96
+}
97
+
98
+std::string CommandPonypos::brief() {
99
+    return "FLOAT FLOAT FLOAT FLOAT - x y z angle";
100
+}
101
+
102
+int CommandPonypos::execute(std::istream& args) {
103
+    if ((!getOpenRaider().mRunning) || (!getGame().isLoaded())) {
104
+        getConsole() << "Use ponypos command interactively!" << Console::endl;
105
+        return -1;
106
+    }
107
+
108
+    float a, b, c, d;
109
+    args >> a >> b >> c >> d;
110
+    if (!args) {
111
+        getConsole() << "Pass four FLOATs to ponypos command!" << Console::endl;
112
+        return -2;
113
+    }
114
+
115
+    getGame().getLara().getModel().setPonyPos(a, b, c, d);
116
+    return 0;
117
+}
118
+

+ 49
- 36
src/commands/CommandRender.cpp View File

@@ -8,6 +8,7 @@
8 8
 #include "global.h"
9 9
 #include "Console.h"
10 10
 #include "Game.h"
11
+#include "OpenRaider.h"
11 12
 #include "Render.h"
12 13
 #include "commands/CommandRender.h"
13 14
 
@@ -65,55 +66,67 @@ int CommandMode::execute(std::istream& args) {
65 66
 
66 67
 // --------------------------------------
67 68
 
68
-std::string CommandFog::name() {
69
-    return "fog";
69
+std::string CommandRenderflag::name() {
70
+    return "renderflag";
70 71
 }
71 72
 
72
-std::string CommandFog::brief() {
73
-    return "BOOL - GL Fog";
73
+std::string CommandRenderflag::brief() {
74
+    return "STRING BOOL - Toggle Render flag";
74 75
 }
75 76
 
76
-int CommandFog::execute(std::istream& args) {
77
-    bool b;
78
-    args >> b;
79
-    if (!args) {
80
-        getConsole() << "Pass BOOL to fog command!" << Console::endl;
77
+void CommandRenderflag::printHelp() {
78
+    getConsole() << "renderflag-Command Usage:" << Console::endl;
79
+    getConsole() << "  renderflag STRING BOOL" << Console::endl;
80
+    getConsole() << "Where STRING is one of the following:" << Console::endl;
81
+    getConsole() << "  ralpha" << Console::endl;
82
+    getConsole() << "  entmodel" << Console::endl;
83
+    getConsole() << "  fog" << Console::endl;
84
+    getConsole() << "  light" << Console::endl;
85
+    getConsole() << "  ponytail" << Console::endl;
86
+}
87
+
88
+int CommandRenderflag::execute(std::istream& args) {
89
+    if (!getOpenRaider().mRunning) {
90
+        getConsole() << "Use renderflag-Command interactively!" << Console::endl;
81 91
         return -1;
82 92
     }
83 93
 
84
-    if (b)
85
-        getRender().setFlags(Render::fFog);
86
-    else
87
-        getRender().clearFlags(Render::fFog);
88
-
89
-    getConsole() << "Fog is now " << (b ? "on" : "off") << Console::endl;
90
-    return 0;
91
-}
94
+    std::string flag;
95
+    bool b;
96
+    args >> flag >> b;
97
+    if (!args) {
98
+        getConsole() << "Pass STRING and BOOL to renderflag command!" << Console::endl;
99
+        return -2;
100
+    }
92 101
 
93
-// --------------------------------------
102
+    int f = stringToFlag(flag);
103
+    if (f == -1) {
104
+        getConsole() << "Unknown flag \"" << flag << "\"!" << Console::endl;
105
+        return -3;
106
+    }
94 107
 
95
-std::string CommandLight::name() {
96
-    return "light";
97
-}
108
+    if (b) {
109
+        getRender().setFlags((unsigned int)f);
110
+    } else {
111
+        getRender().clearFlags((unsigned int)f);
112
+    }
98 113
 
99
-std::string CommandLight::brief() {
100
-    return "BOOL - GL Lights";
114
+    return 0;
101 115
 }
102 116
 
103
-int CommandLight::execute(std::istream& args) {
104
-    bool b;
105
-    args >> b;
106
-    if (!args) {
107
-        getConsole() << "Pass BOOL to light command!" << Console::endl;
117
+int CommandRenderflag::stringToFlag(std::string flag) {
118
+    if (flag == "ralpha") {
119
+        return Render::fRoomAlpha;
120
+    } else if (flag == "entmodel") {
121
+        return Render::fEntityModels;
122
+    } else if (flag == "fog") {
123
+        return Render::fFog;
124
+    } else if (flag == "light") {
125
+        return Render::fGL_Lights;
126
+    } else if (flag == "ponytail") {
127
+        return Render::fRenderPonytail;
128
+    } else {
108 129
         return -1;
109 130
     }
110
-
111
-    if (b)
112
-        getRender().setFlags(Render::fGL_Lights);
113
-    else
114
-        getRender().clearFlags(Render::fGL_Lights);
115
-
116
-    getConsole() << "GL-Lights are now " << (b ? "on" : "off") << Console::endl;
117
-    return 0;
118 131
 }
119 132
 

+ 0
- 161
src/commands/OldCommands.cpp View File

@@ -1,161 +0,0 @@
1
-/*!
2
- * \file src/Command.cpp
3
- * \brief OpenRaider command implementation
4
- *
5
- * \author xythobuz
6
- */
7
-
8
-#include <fstream>
9
-#include <sstream>
10
-
11
-#include "global.h"
12
-#include "Camera.h"
13
-#include "Console.h"
14
-#include "Entity.h"
15
-#include "Font.h"
16
-#include "Game.h"
17
-#include "math/math.h"
18
-#include "Menu.h"
19
-#include "Render.h"
20
-#include "Sound.h"
21
-#include "TombRaider.h"
22
-#include "Window.h"
23
-#include "World.h"
24
-#include "utils/strings.h"
25
-#include "utils/time.h"
26
-#include "OpenRaider.h"
27
-
28
-int OpenRaider::command(std::string c) {
29
-    // Remove comment, if any
30
-    size_t comment = c.find_first_of('#');
31
-    if (comment != std::string::npos)
32
-        c.erase(comment);
33
-
34
-    // Execute command
35
-    std::stringstream command(c);
36
-    std::string cmd;
37
-    command >> cmd;
38
-    command >> std::boolalpha >> std::ws;
39
-
40
-    if (cmd.length() == 0)
41
-        return 0;
42
-
43
-    if (cmd.compare("help") == 0) {
44
-        std::string tmp;
45
-        if (!(command >> tmp)) {
46
-/*
47
-            getConsole() << "  ralpha    - BOOL - Room Alpha" << Console::endl;
48
-            getConsole() << "  upf       - BOOL - Update Room List Per Frame" << Console::endl;
49
-            getConsole() << "  entmodel  - BOOL" << Console::endl;
50
-            getConsole() << "  ponytail  - BOOL" << Console::endl;
51
-            getConsole() << "  pigtail   - BOOL" << Console::endl;
52
-            getConsole() << "  ponypos   - FLOAT FLOAT FLOAT FLOAT - x y z angle" << Console::endl;
53
-*/
54
-        } else {
55
-            return help(tmp);
56
-        }
57
-/*
58
-    } else if (cmd.compare("ralpha") == 0) {
59
-        if (args->size() > 0) {
60
-            bool b;
61
-            if (readBool(args->at(0), &b) < 0) {
62
-                getConsole().print("Pass BOOL to ralpha command!");
63
-                return -24;
64
-            }
65
-            if (b)
66
-                getRender().setFlags(Render::fRoomAlpha);
67
-            else
68
-                getRender().clearFlags(Render::fRoomAlpha);
69
-            getConsole().print("Room Alpha is now %s", b ? "on" : "off");
70
-        } else {
71
-            getConsole().print("Invalid use of ralpha-command!");
72
-            return -25;
73
-        }
74
-    } else if (cmd.compare("upf") == 0) {
75
-        if (args->size() > 0) {
76
-            bool b;
77
-            if (readBool(args->at(0), &b) < 0) {
78
-                getConsole().print("Pass BOOL to upf command!");
79
-                return -30;
80
-            }
81
-            if (b)
82
-                getRender().setFlags(Render::fUpdateRoomListPerFrame);
83
-            else
84
-                getRender().clearFlags(Render::fUpdateRoomListPerFrame);
85
-            getConsole().print("URLPF is now %s", b ? "on" : "off");
86
-        } else {
87
-            getConsole().print("Invalid use of upf-command!");
88
-            return -31;
89
-        }
90
-    } else if (cmd.compare("entmodel") == 0) {
91
-        if (args->size() > 0) {
92
-            bool b;
93
-            if (readBool(args->at(0), &b) < 0) {
94
-                getConsole().print("Pass BOOL to entmodel command!");
95
-                return -38;
96
-            }
97
-            if (b)
98
-                getRender().setFlags(Render::fEntityModels);
99
-            else
100
-                getRender().clearFlags(Render::fEntityModels);
101
-            getConsole().print("Entmodels are now %s", b ? "on" : "off");
102
-        } else {
103
-            getConsole().print("Invalid use of entmodel-command!");
104
-            return -39;
105
-        }
106
-    } else if (cmd.compare("ponytail") == 0) {
107
-        if (args->size() > 0) {
108
-            bool b;
109
-            if (readBool(args->at(0), &b) < 0) {
110
-                getConsole().print("Pass BOOL to ponytail command!");
111
-                return -44;
112
-            }
113
-            if (b)
114
-                getRender().setFlags(Render::fRenderPonytail);
115
-            else
116
-                getRender().clearFlags(Render::fRenderPonytail);
117
-            getConsole().print("Ponytail is now %s", b ? "on" : "off");
118
-        } else {
119
-            getConsole().print("Invalid use of ponytail-command!");
120
-            return -45;
121
-        }
122
-    } else if (cmd.compare("pigtail") == 0) {
123
-        if ((!mRunning) || (!getGame().isLoaded())) {
124
-            getConsole().print("Use pigtail command interactively!");
125
-            return -999;
126
-        }
127
-        if (args->size() > 0) {
128
-            bool b;
129
-            if (readBool(args->at(0), &b) < 0) {
130
-                getConsole().print("Pass BOOL to pigtail command!");
131
-                return -46;
132
-            }
133
-            SkeletalModel &tmp = getGame().getLara().getModel();
134
-            tmp.setPigTail(b);
135
-            getConsole().print("Pigtail is now %s", b ? "on" : "off");
136
-        } else {
137
-            getConsole().print("Invalid use of pigtail-command!");
138
-            return -47;
139
-        }
140
-    } else if (cmd.compare("ponypos") == 0) {
141
-        if ((!mRunning) || (!getGame().isLoaded())) {
142
-            getConsole().print("Use ponypos command interactively!");
143
-            return -999;
144
-        }
145
-        if (args->size() > 3) {
146
-            SkeletalModel &tmp = getGame().getLara().getModel();
147
-            tmp.setPonyPos((float)atof(args->at(0)), (float)atof(args->at(1)),
148
-                    (float)atof(args->at(2)), (float)atof(args->at(3)));
149
-        } else {
150
-            getConsole().print("Invalid use of ponypos-command!");
151
-            return -48;
152
-        }
153
-*/
154
-    } else {
155
-        getConsole() << "Unknown command: " << cmd.c_str() << Console::endl;
156
-        return -50;
157
-    }
158
-
159
-    return 0;
160
-}
161
-

+ 0
- 211
src/main.cpp View File

@@ -152,217 +152,6 @@ int main(int argc, char *argv[]) {
152 152
     return 0;
153 153
 }
154 154
 
155
-ActionEvents stringToActionEvent(const char *action) {
156
-    if (strcmp(action, "menu") == 0) {
157
-        return menuAction;
158
-    } else if (strcmp(action, "console") == 0) {
159
-        return consoleAction;
160
-    } else if (strcmp(action, "forward") == 0) {
161
-        return forwardAction;
162
-    } else if (strcmp(action, "backward") == 0) {
163
-        return backwardAction;
164
-    } else if (strcmp(action, "left") == 0) {
165
-        return leftAction;
166
-    } else if (strcmp(action, "right") == 0) {
167
-        return rightAction;
168
-    } else if (strcmp(action, "jump") == 0) {
169
-        return jumpAction;
170
-    } else if (strcmp(action, "crouch") == 0) {
171
-        return crouchAction;
172
-    } else if (strcmp(action, "use") == 0) {
173
-        return useAction;
174
-    } else if (strcmp(action, "holster") == 0) {
175
-        return holsterAction;
176
-    } else if (strcmp(action, "walk") == 0) {
177
-        return walkAction;
178
-    } else {
179
-        return ActionEventCount;
180
-    }
181
-}
182
-
183
-KeyboardButton stringToKeyboardButton(const char *key) {
184
-    size_t length = strlen(key);
185
-    if ((key[0] == '\'') && (key[length - 1] == '\'') && (length == 3)) {
186
-        // Literal character like w, a, s, d, 0, 1...
187
-        char c = key[1];
188
-        if (((c >= '0') && (c <= '9'))
189
-            || ((c >= 'a') && (c <= 'z')))
190
-            return (KeyboardButton)c;
191
-    } else if ((key[0] == '\"') && (key[length - 1] == '\"')) {
192
-        // Special characters like tilde, esc, quote...
193
-        char *tmp = stringRemoveQuotes(key);
194
-        if (strcmp(tmp, "quote") == 0) {
195
-            delete [] tmp;
196
-            return quoteKey;
197
-        } else if (strcmp(tmp, "backslash") == 0) {
198
-            delete [] tmp;
199
-            return backslashKey;
200
-        } else if (strcmp(tmp, "backspace") == 0) {
201
-            delete [] tmp;
202
-            return backspaceKey;
203
-        } else if (strcmp(tmp, "capslock") == 0) {
204
-            delete [] tmp;
205
-            return capslockKey;
206
-        } else if (strcmp(tmp, "comma") == 0) {
207
-            delete [] tmp;
208
-            return commaKey;
209
-        } else if (strcmp(tmp, "del") == 0) {
210
-            delete [] tmp;
211
-            return delKey;
212
-        } else if (strcmp(tmp, "up") == 0) {
213
-            delete [] tmp;
214
-            return upKey;
215
-        } else if (strcmp(tmp, "down") == 0) {
216
-            delete [] tmp;
217
-            return downKey;
218
-        } else if (strcmp(tmp, "left") == 0) {
219
-            delete [] tmp;
220
-            return leftKey;
221
-        } else if (strcmp(tmp, "right") == 0) {
222
-            delete [] tmp;
223
-            return rightKey;
224
-        } else if (strcmp(tmp, "end") == 0) {
225
-            delete [] tmp;
226
-            return endKey;
227
-        } else if (strcmp(tmp, "equals") == 0) {
228
-            delete [] tmp;
229
-            return equalsKey;
230
-        } else if (strcmp(tmp, "escape") == 0) {
231
-            delete [] tmp;
232
-            return escapeKey;
233
-        } else if (strcmp(tmp, "f1") == 0) {
234
-            delete [] tmp;
235
-            return f1Key;
236
-        } else if (strcmp(tmp, "f2") == 0) {
237
-            delete [] tmp;
238
-            return f2Key;
239
-        } else if (strcmp(tmp, "f3") == 0) {
240
-            delete [] tmp;
241
-            return f3Key;
242
-        } else if (strcmp(tmp, "f4") == 0) {
243
-            delete [] tmp;
244
-            return f4Key;
245
-        } else if (strcmp(tmp, "f5") == 0) {
246
-            delete [] tmp;
247
-            return f5Key;
248
-        } else if (strcmp(tmp, "f6") == 0) {
249
-            delete [] tmp;
250
-            return f6Key;
251
-        } else if (strcmp(tmp, "f7") == 0) {
252
-            delete [] tmp;
253
-            return f7Key;
254
-        } else if (strcmp(tmp, "f8") == 0) {
255
-            delete [] tmp;
256
-            return f8Key;
257
-        } else if (strcmp(tmp, "f9") == 0) {
258
-            delete [] tmp;
259
-            return f9Key;
260
-        } else if (strcmp(tmp, "f10") == 0) {
261
-            delete [] tmp;
262
-            return f10Key;
263
-        } else if (strcmp(tmp, "f11") == 0) {
264
-            delete [] tmp;
265
-            return f11Key;
266
-        } else if (strcmp(tmp, "f12") == 0) {
267
-            delete [] tmp;
268
-            return f12Key;
269
-        } else if (strcmp(tmp, "backquote") == 0) {
270
-            delete [] tmp;
271
-            return backquoteKey;
272
-        } else if (strcmp(tmp, "home") == 0) {
273
-            delete [] tmp;
274
-            return homeKey;
275
-        } else if (strcmp(tmp, "insert") == 0) {
276
-            delete [] tmp;
277
-            return insertKey;
278
-        } else if (strcmp(tmp, "leftalt") == 0) {
279
-            delete [] tmp;
280
-            return leftaltKey;
281
-        } else if (strcmp(tmp, "leftctrl") == 0) {
282
-            delete [] tmp;
283
-            return leftctrlKey;
284
-        } else if (strcmp(tmp, "leftbracket") == 0) {
285
-            delete [] tmp;
286
-            return leftbracketKey;
287
-        } else if (strcmp(tmp, "leftgui") == 0) {
288
-            delete [] tmp;
289
-            return leftguiKey;
290
-        } else if (strcmp(tmp, "leftshift") == 0) {
291
-            delete [] tmp;
292
-            return leftshiftKey;
293
-        } else if (strcmp(tmp, "minus") == 0) {
294
-            delete [] tmp;
295
-            return minusKey;
296
-        } else if (strcmp(tmp, "numlock") == 0) {
297
-            delete [] tmp;
298
-            return numlockKey;
299
-        } else if (strcmp(tmp, "pagedown") == 0) {
300
-            delete [] tmp;
301
-            return pagedownKey;
302
-        } else if (strcmp(tmp, "pageup") == 0) {
303
-            delete [] tmp;
304
-            return pageupKey;
305
-        } else if (strcmp(tmp, "pause") == 0) {
306
-            delete [] tmp;
307
-            return pauseKey;
308
-        } else if (strcmp(tmp, "dot") == 0) {
309
-            delete [] tmp;
310
-            return dotKey;
311
-        } else if (strcmp(tmp, "rightalt") == 0) {
312
-            delete [] tmp;
313
-            return rightaltKey;
314
-        } else if (strcmp(tmp, "rightctrl") == 0) {
315
-            delete [] tmp;
316
-            return rightctrlKey;
317
-        } else if (strcmp(tmp, "enter") == 0) {
318
-            delete [] tmp;
319
-            return enterKey;
320
-        } else if (strcmp(tmp, "rightgui") == 0) {
321
-            delete [] tmp;
322
-            return rightguiKey;
323
-        } else if (strcmp(tmp, "rightbracket") == 0) {
324
-            delete [] tmp;
325
-            return rightbracketKey;
326
-        } else if (strcmp(tmp, "rightshift") == 0) {
327
-            delete [] tmp;
328
-            return rightshiftKey;
329
-        } else if (strcmp(tmp, "scrolllock") == 0) {
330
-            delete [] tmp;
331
-            return scrolllockKey;
332
-        } else if (strcmp(tmp, "semicolon") == 0) {
333
-            delete [] tmp;
334
-            return semicolonKey;
335
-        } else if (strcmp(tmp, "slash") == 0) {
336
-            delete [] tmp;
337
-            return slashKey;
338
-        } else if (strcmp(tmp, "space") == 0) {
339
-            delete [] tmp;
340
-            return spaceKey;
341
-        } else if (strcmp(tmp, "tab") == 0) {
342
-            delete [] tmp;
343
-            return tabKey;
344
-        } else if (strcmp(tmp, "leftmouse") == 0) {
345
-            delete [] tmp;
346
-            return leftmouseKey;
347
-        } else if (strcmp(tmp, "middlemouse") == 0) {
348
-            delete [] tmp;
349
-            return middlemouseKey;
350
-        } else if (strcmp(tmp, "rightmouse") == 0) {
351
-            delete [] tmp;
352
-            return rightmouseKey;
353
-        } else if (strcmp(tmp, "fourthmouse") == 0) {
354
-            delete [] tmp;
355
-            return fourthmouseKey;
356
-        } else if (strcmp(tmp, "fifthmouse") == 0) {
357
-            delete [] tmp;
358
-            return fifthmouseKey;
359
-        }
360
-        delete [] tmp;
361
-    }
362
-
363
-    return unknownKey;
364
-}
365
-
366 155
 #endif // UNIT_TEST
367 156
 
368 157
 #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS)

Loading…
Cancel
Save