Thomas Buck пре 10 година
родитељ
комит
5032172fee
13 измењених фајлова са 229 додато и 221 уклоњено
  1. 1
    1
      include/Config.h.in
  2. 10
    0
      include/Window.h
  3. 21
    39
      include/global.h
  4. 4
    4
      src/Console.cpp
  5. 2
    0
      src/Game.cpp
  6. 8
    8
      src/Menu.cpp
  7. 72
    69
      src/OpenRaider.cpp
  8. 2
    2
      src/Render.cpp
  9. 0
    1
      src/Texture.cpp
  10. 7
    0
      src/TombRaider.cpp
  11. 90
    90
      src/WindowSDL.cpp
  12. 9
    4
      src/main.cpp
  13. 3
    3
      src/utils/strings.cpp

+ 1
- 1
include/Config.h.in Прегледај датотеку

1
 #define VERSION "OpenRaider-@OpenRaider_VERSION_MAJOR@.@OpenRaider_VERSION_MINOR@.@OpenRaider_VERSION_MICRO@@OpenRaider_VERSION_RELEASE@ (@CMAKE_BUILD_TYPE@)"
1
 #define VERSION "OpenRaider-@OpenRaider_VERSION_MAJOR@.@OpenRaider_VERSION_MINOR@.@OpenRaider_VERSION_MICRO@@OpenRaider_VERSION_RELEASE@ (@CMAKE_BUILD_TYPE@)"
2
 #define BUILD_HOST "@OpenRaider_BUILD_HOST@ @OpenRaider_HOSTNAME@"
2
 #define BUILD_HOST "@OpenRaider_BUILD_HOST@ @OpenRaider_HOSTNAME@"
3
 
3
 
4
-#define DEFAULT_CONFIG_PATH "~/.OpenRaider/"
4
+#define DEFAULT_CONFIG_PATH "~/.OpenRaider"
5
 #define DEFAULT_CONFIG_FILE "OpenRaider.ini"
5
 #define DEFAULT_CONFIG_FILE "OpenRaider.ini"
6
 #define DEFAULT_WIDTH 640
6
 #define DEFAULT_WIDTH 640
7
 #define DEFAULT_HEIGHT 480
7
 #define DEFAULT_HEIGHT 480

+ 10
- 0
include/Window.h Прегледај датотеку

12
 
12
 
13
 #include "global.h"
13
 #include "global.h"
14
 
14
 
15
+typedef struct {
16
+    char *text;
17
+    unsigned int x;
18
+    unsigned int y;
19
+    int w;
20
+    int h;
21
+    float scale;
22
+    float color[4];
23
+} WindowString;
24
+
15
 /*!
25
 /*!
16
  * \brief Windowing interface
26
  * \brief Windowing interface
17
  */
27
  */

+ 21
- 39
include/global.h Прегледај датотеку

34
 } ActionEvents;
34
 } ActionEvents;
35
 
35
 
36
 typedef enum {
36
 typedef enum {
37
-    zero = '0', one = '1',
38
-    two = '2', three = '3',
39
-    four = '4', five = '5',
40
-    six = '6', seven = '7',
41
-    eight = '8', nine = '9',
42
-    a = 'a', b = 'b',
43
-    c = 'c', d = 'd',
44
-    e = 'e', f = 'f',
45
-    g = 'g', h = 'h',
46
-    i = 'i', j = 'j',
47
-    k = 'k', l = 'l',
48
-    m = 'm', n = 'n',
49
-    o = 'o', p = 'p',
50
-    q = 'q', r = 'r',
51
-    s = 's', t = 't',
52
-    u = 'u', v = 'v',
53
-    w = 'w', x = 'x',
54
-    y = 'y', z = 'z',
55
-    quote, backslash, backspace, capslock,
56
-    comma, del, up, down, left, right,
57
-    end, equals, escape, f1, f2, f3, f4, f5,
58
-    f6, f7, f8, f9, f10, f11, f12, backquote,
59
-    home, insert, leftalt, leftctrl, leftbracket,
60
-    leftgui, leftshift, minus, numlock, pagedown,
61
-    pageup, pause, dot, rightalt, rightctrl, enter,
62
-    rightgui, rightbracket, rightshift, scrolllock,
63
-    semicolon, slash, space, tab,
64
-    leftmouse, middlemouse, rightmouse,
65
-    unknown
37
+    zeroKey = '0', oneKey = '1', twoKey = '2',
38
+    threeKey = '3', fourKey = '4', fiveKey = '5',
39
+    sixKey = '6', sevenKey = '7', eightKey = '8',
40
+    nineKey = '9', aKey = 'a', bKey = 'b',
41
+    cKey = 'c', dKey = 'd', eKey = 'e', fKey = 'f',
42
+    gKey = 'g', hKey = 'h', iKey = 'i', jKey = 'j',
43
+    kKey = 'k', lKey = 'l', mKey = 'm', nKey = 'n',
44
+    oKey = 'o', pKey = 'p', qKey = 'q', rKey = 'r',
45
+    sKey = 's', tKey = 't', uKey = 'u', vKey = 'v',
46
+    wKey = 'w', xKey = 'x', yKey = 'y', zKey = 'z',
47
+    quoteKey, backslashKey, backspaceKey, capslockKey,
48
+    commaKey, delKey, upKey, downKey, leftKey, rightKey,
49
+    endKey, equalsKey, escapeKey, f1Key, f2Key, f3Key, f4Key, f5Key,
50
+    f6Key, f7Key, f8Key, f9Key, f10Key, f11Key, f12Key, backquoteKey,
51
+    homeKey, insertKey, leftaltKey, leftctrlKey, leftbracketKey,
52
+    leftguiKey, leftshiftKey, minusKey, numlockKey, pagedownKey,
53
+    pageupKey, pauseKey, dotKey, rightaltKey, rightctrlKey, enterKey,
54
+    rightguiKey, rightbracketKey, rightshiftKey, scrolllockKey,
55
+    semicolonKey, slashKey, spaceKey, tabKey,
56
+    leftmouseKey, middlemouseKey, rightmouseKey,
57
+    unknownKey
66
 } KeyboardButton;
58
 } KeyboardButton;
67
 
59
 
68
-typedef struct {
69
-    char *text;
70
-    unsigned int x;
71
-    unsigned int y;
72
-    int w;
73
-    int h;
74
-    float scale;
75
-    float color[4];
76
-} WindowString;
77
-
78
 #endif
60
 #endif
79
 
61
 

+ 4
- 4
src/Console.cpp Прегледај датотеку

138
 }
138
 }
139
 
139
 
140
 void Console::handleKeyboard(KeyboardButton key, bool pressed) {
140
 void Console::handleKeyboard(KeyboardButton key, bool pressed) {
141
-    if (pressed && (key == enter)) {
141
+    if (pressed && (key == enterKey)) {
142
         // Execute entered command
142
         // Execute entered command
143
         if ((mInputBufferPointer > 0) && (mInputBuffer[0] != '\0')) {
143
         if ((mInputBufferPointer > 0) && (mInputBuffer[0] != '\0')) {
144
             print("> %s", mInputBuffer);
144
             print("> %s", mInputBuffer);
163
     }
163
     }
164
 
164
 
165
     //! \fixme only deleting the last byte is not valid for non-ASCII UTF-8 strings
165
     //! \fixme only deleting the last byte is not valid for non-ASCII UTF-8 strings
166
-    if (pressed && (key == backspace)) {
166
+    if (pressed && (key == backspaceKey)) {
167
         if (mInputBufferPointer > 0) {
167
         if (mInputBufferPointer > 0) {
168
             mInputBufferPointer--;
168
             mInputBufferPointer--;
169
             mInputBuffer[mInputBufferPointer] = '\0';
169
             mInputBuffer[mInputBufferPointer] = '\0';
170
         }
170
         }
171
     }
171
     }
172
 
172
 
173
-    if (pressed && ((key == up) || (key == down))) {
174
-        moveInHistory(key == up);
173
+    if (pressed && ((key == upKey) || (key == downKey))) {
174
+        moveInHistory(key == upKey);
175
     }
175
     }
176
 }
176
 }
177
 
177
 

+ 2
- 0
src/Game.cpp Прегледај датотеку

623
     if (a < 0)
623
     if (a < 0)
624
     {
624
     {
625
         //continue;
625
         //continue;
626
+        getConsole().print("Invalid animation data for model %d", index);
627
+        delete r_model;
626
         return;
628
         return;
627
     }
629
     }
628
 
630
 

+ 8
- 8
src/Menu.cpp Прегледај датотеку

116
     if (!pressed)
116
     if (!pressed)
117
         return;
117
         return;
118
 
118
 
119
-    if (key == up) {
119
+    if (key == upKey) {
120
         if (mCursor > 0)
120
         if (mCursor > 0)
121
             mCursor--;
121
             mCursor--;
122
         else
122
         else
123
             mCursor = getOpenRaider().mMapList.size() - 1;
123
             mCursor = getOpenRaider().mMapList.size() - 1;
124
-    } else if (key == down) {
124
+    } else if (key == downKey) {
125
         if (mCursor < (getOpenRaider().mMapList.size() - 1))
125
         if (mCursor < (getOpenRaider().mMapList.size() - 1))
126
             mCursor++;
126
             mCursor++;
127
         else
127
         else
128
             mCursor = 0;
128
             mCursor = 0;
129
-    } else if (key == right) {
129
+    } else if (key == rightKey) {
130
         int i = 10;
130
         int i = 10;
131
         if (mCursor > (getOpenRaider().mMapList.size() - 11))
131
         if (mCursor > (getOpenRaider().mMapList.size() - 11))
132
             i = getOpenRaider().mMapList.size() - 1 - mCursor;
132
             i = getOpenRaider().mMapList.size() - 1 - mCursor;
133
         while (i-- > 0)
133
         while (i-- > 0)
134
-            handleKeyboard(down, true);
135
-    } else if (key == left) {
134
+            handleKeyboard(downKey, true);
135
+    } else if (key == leftKey) {
136
         int i = 10;
136
         int i = 10;
137
         if (mCursor < 10)
137
         if (mCursor < 10)
138
             i = mCursor;
138
             i = mCursor;
139
         while (i-- > 0)
139
         while (i-- > 0)
140
-            handleKeyboard(up, true);
141
-    } else if (key == enter) {
140
+            handleKeyboard(upKey, true);
141
+    } else if (key == enterKey) {
142
         char *tmp = bufferString("load %s", getOpenRaider().mMapList[mCursor]);
142
         char *tmp = bufferString("load %s", getOpenRaider().mMapList[mCursor]);
143
         if (getOpenRaider().command(tmp) == 0) {
143
         if (getOpenRaider().command(tmp) == 0) {
144
             setVisible(false);
144
             setVisible(false);
152
 void Menu::handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released) {
152
 void Menu::handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released) {
153
     int items = (getWindow().mHeight - 110) / 25;
153
     int items = (getWindow().mHeight - 110) / 25;
154
 
154
 
155
-    if ((!released) || (button != leftmouse))
155
+    if ((!released) || (button != leftmouseKey))
156
         return;
156
         return;
157
 
157
 
158
     if ((y >= 100) && (y <= (unsigned int)(100 + (25 * items)))) {
158
     if ((y >= 100) && (y <= (unsigned int)(100 + (25 * items)))) {

+ 72
- 69
src/OpenRaider.cpp Прегледај датотеку

34
     mMapListFilled = false;
34
     mMapListFilled = false;
35
 
35
 
36
     for (int i = 0; i < ActionEventCount; i++)
36
     for (int i = 0; i < ActionEventCount; i++)
37
-        keyBindings[i] = unknown;
37
+        keyBindings[i] = unknownKey;
38
 }
38
 }
39
 
39
 
40
 OpenRaider::~OpenRaider() {
40
 OpenRaider::~OpenRaider() {
98
         }
98
         }
99
     }
99
     }
100
 
100
 
101
-    char *token = strtok(cmd, " \t");
101
+    char *strtokState;
102
+    char *token = strtok_r(cmd, " \t", &strtokState);
102
     if (token != NULL) {
103
     if (token != NULL) {
103
         // token is the command to execute
104
         // token is the command to execute
104
         // get arguments
105
         // get arguments
105
         std::vector<char *> args;
106
         std::vector<char *> args;
106
         char *next;
107
         char *next;
107
-        while ((next = strtok(NULL, " \t")) != NULL) {
108
+        while ((next = strtok_r(NULL, " \t", &strtokState)) != NULL) {
108
             args.push_back(next);
109
             args.push_back(next);
109
         }
110
         }
110
 
111
 
725
 }
726
 }
726
 
727
 
727
 char *OpenRaider::expandDirectoryNames(const char *s) {
728
 char *OpenRaider::expandDirectoryNames(const char *s) {
728
-    const char *base = "$(basedir)";
729
-    const char *pak = "$(pakdir)";
730
-    const char *audio = "$(audiodir)";
731
-    const char *data = "$(datadir)";
732
-
733
     assert(s != NULL);
729
     assert(s != NULL);
734
     assert(s[0] != '\0');
730
     assert(s[0] != '\0');
735
 
731
 
736
     if (mBaseDir != NULL) {
732
     if (mBaseDir != NULL) {
733
+        const char *base = "$(basedir)";
737
         if (strstr(s, base) != NULL) {
734
         if (strstr(s, base) != NULL) {
738
             return stringReplace(s, base, mBaseDir);
735
             return stringReplace(s, base, mBaseDir);
739
         }
736
         }
740
     }
737
     }
741
 
738
 
742
     if (mPakDir != NULL) {
739
     if (mPakDir != NULL) {
740
+        const char *pak = "$(pakdir)";
743
         if (strstr(s, pak) != NULL) {
741
         if (strstr(s, pak) != NULL) {
744
             return stringReplace(s, pak, mPakDir);
742
             return stringReplace(s, pak, mPakDir);
745
         }
743
         }
746
     }
744
     }
747
 
745
 
748
     if (mAudioDir != NULL) {
746
     if (mAudioDir != NULL) {
747
+        const char *audio = "$(audiodir)";
749
         if (strstr(s, audio) != NULL) {
748
         if (strstr(s, audio) != NULL) {
750
             return stringReplace(s, audio, mAudioDir);
749
             return stringReplace(s, audio, mAudioDir);
751
         }
750
         }
752
     }
751
     }
753
 
752
 
754
     if (mDataDir != NULL) {
753
     if (mDataDir != NULL) {
754
+        const char *data = "$(datadir)";
755
         if (strstr(s, data) != NULL) {
755
         if (strstr(s, data) != NULL) {
756
             return stringReplace(s, data, mDataDir);
756
             return stringReplace(s, data, mDataDir);
757
         }
757
         }
781
     if (strcmp(var, "size") == 0) {
781
     if (strcmp(var, "size") == 0) {
782
         // value has format like "\"1024x768\""
782
         // value has format like "\"1024x768\""
783
         unsigned int w = DEFAULT_WIDTH, h = DEFAULT_HEIGHT;
783
         unsigned int w = DEFAULT_WIDTH, h = DEFAULT_HEIGHT;
784
-        if (sscanf(value, "\"%dx%d\"", &w, &h) != 2) {
784
+        if (sscanf(value, "\"%5dx%5d\"", &w, &h) != 2) {
785
             getConsole().print("set-size-Error: Invalid value (%s)", value);
785
             getConsole().print("set-size-Error: Invalid value (%s)", value);
786
             return -2;
786
             return -2;
787
         }
787
         }
804
         getSound().setEnabled(audio);
804
         getSound().setEnabled(audio);
805
     } else if (strcmp(var, "volume") == 0) {
805
     } else if (strcmp(var, "volume") == 0) {
806
         float vol = 1.0f;
806
         float vol = 1.0f;
807
-        if (sscanf(value, "%f", &vol) != 1) {
807
+        if (sscanf(value, "%5f", &vol) != 1) {
808
             getConsole().print("set-volume-Error: Invalid value (%s)", value);
808
             getConsole().print("set-volume-Error: Invalid value (%s)", value);
809
             return -5;
809
             return -5;
810
         }
810
         }
811
         getSound().setVolume(vol);
811
         getSound().setVolume(vol);
812
     } else if (strcmp(var, "mouse_x") == 0) {
812
     } else if (strcmp(var, "mouse_x") == 0) {
813
         float sense = 1.0f;
813
         float sense = 1.0f;
814
-        if (sscanf(value, "%f", &sense) != 1) {
814
+        if (sscanf(value, "%5f", &sense) != 1) {
815
             getConsole().print("set-mouse_x-Error: Invalid value (%s)", value);
815
             getConsole().print("set-mouse_x-Error: Invalid value (%s)", value);
816
             return -6;
816
             return -6;
817
         }
817
         }
818
         getCamera().setSensitivityX(OR_DEG_TO_RAD(sense));
818
         getCamera().setSensitivityX(OR_DEG_TO_RAD(sense));
819
     } else if (strcmp(var, "mouse_y") == 0) {
819
     } else if (strcmp(var, "mouse_y") == 0) {
820
         float sense = 1.0f;
820
         float sense = 1.0f;
821
-        if (sscanf(value, "%f", &sense) != 1) {
821
+        if (sscanf(value, "%5f", &sense) != 1) {
822
             getConsole().print("set-mouse_y-Error: Invalid value (%s)", value);
822
             getConsole().print("set-mouse_y-Error: Invalid value (%s)", value);
823
             return -7;
823
             return -7;
824
         }
824
         }
912
         // Special characters like tilde, esc, quote...
912
         // Special characters like tilde, esc, quote...
913
         char *tmp = stringRemoveQuotes(key);
913
         char *tmp = stringRemoveQuotes(key);
914
         if (strcmp(tmp, "quote") == 0) {
914
         if (strcmp(tmp, "quote") == 0) {
915
-            keyBindings[action] = quote;
915
+            keyBindings[action] = quoteKey;
916
         } else if (strcmp(tmp, "backslash") == 0) {
916
         } else if (strcmp(tmp, "backslash") == 0) {
917
-            keyBindings[action] = quote;
917
+            keyBindings[action] = backslashKey;
918
         } else if (strcmp(tmp, "backspace") == 0) {
918
         } else if (strcmp(tmp, "backspace") == 0) {
919
-            keyBindings[action] = backspace;
919
+            keyBindings[action] = backspaceKey;
920
         } else if (strcmp(tmp, "capslock") == 0) {
920
         } else if (strcmp(tmp, "capslock") == 0) {
921
-            keyBindings[action] = capslock;
921
+            keyBindings[action] = capslockKey;
922
         } else if (strcmp(tmp, "comma") == 0) {
922
         } else if (strcmp(tmp, "comma") == 0) {
923
-            keyBindings[action] = comma;
923
+            keyBindings[action] = commaKey;
924
         } else if (strcmp(tmp, "del") == 0) {
924
         } else if (strcmp(tmp, "del") == 0) {
925
-            keyBindings[action] = del;
925
+            keyBindings[action] = delKey;
926
         } else if (strcmp(tmp, "up") == 0) {
926
         } else if (strcmp(tmp, "up") == 0) {
927
-            keyBindings[action] = up;
927
+            keyBindings[action] = upKey;
928
         } else if (strcmp(tmp, "down") == 0) {
928
         } else if (strcmp(tmp, "down") == 0) {
929
-            keyBindings[action] = down;
929
+            keyBindings[action] = downKey;
930
         } else if (strcmp(tmp, "left") == 0) {
930
         } else if (strcmp(tmp, "left") == 0) {
931
-            keyBindings[action] = left;
931
+            keyBindings[action] = leftKey;
932
         } else if (strcmp(tmp, "right") == 0) {
932
         } else if (strcmp(tmp, "right") == 0) {
933
-            keyBindings[action] = right;
933
+            keyBindings[action] = rightKey;
934
         } else if (strcmp(tmp, "end") == 0) {
934
         } else if (strcmp(tmp, "end") == 0) {
935
-            keyBindings[action] = end;
935
+            keyBindings[action] = endKey;
936
         } else if (strcmp(tmp, "equals") == 0) {
936
         } else if (strcmp(tmp, "equals") == 0) {
937
-            keyBindings[action] = equals;
937
+            keyBindings[action] = equalsKey;
938
         } else if (strcmp(tmp, "escape") == 0) {
938
         } else if (strcmp(tmp, "escape") == 0) {
939
-            keyBindings[action] = escape;
939
+            keyBindings[action] = escapeKey;
940
         } else if (strcmp(tmp, "f1") == 0) {
940
         } else if (strcmp(tmp, "f1") == 0) {
941
-            keyBindings[action] = f1;
941
+            keyBindings[action] = f1Key;
942
         } else if (strcmp(tmp, "f2") == 0) {
942
         } else if (strcmp(tmp, "f2") == 0) {
943
-            keyBindings[action] = f2;
943
+            keyBindings[action] = f2Key;
944
         } else if (strcmp(tmp, "f3") == 0) {
944
         } else if (strcmp(tmp, "f3") == 0) {
945
-            keyBindings[action] = f3;
945
+            keyBindings[action] = f3Key;
946
         } else if (strcmp(tmp, "f4") == 0) {
946
         } else if (strcmp(tmp, "f4") == 0) {
947
-            keyBindings[action] = f4;
947
+            keyBindings[action] = f4Key;
948
         } else if (strcmp(tmp, "f5") == 0) {
948
         } else if (strcmp(tmp, "f5") == 0) {
949
-            keyBindings[action] = f5;
949
+            keyBindings[action] = f5Key;
950
         } else if (strcmp(tmp, "f6") == 0) {
950
         } else if (strcmp(tmp, "f6") == 0) {
951
-            keyBindings[action] = f6;
951
+            keyBindings[action] = f6Key;
952
         } else if (strcmp(tmp, "f7") == 0) {
952
         } else if (strcmp(tmp, "f7") == 0) {
953
-            keyBindings[action] = f7;
953
+            keyBindings[action] = f7Key;
954
         } else if (strcmp(tmp, "f8") == 0) {
954
         } else if (strcmp(tmp, "f8") == 0) {
955
-            keyBindings[action] = f8;
955
+            keyBindings[action] = f8Key;
956
         } else if (strcmp(tmp, "f9") == 0) {
956
         } else if (strcmp(tmp, "f9") == 0) {
957
-            keyBindings[action] = f9;
957
+            keyBindings[action] = f9Key;
958
         } else if (strcmp(tmp, "f10") == 0) {
958
         } else if (strcmp(tmp, "f10") == 0) {
959
-            keyBindings[action] = f10;
959
+            keyBindings[action] = f10Key;
960
         } else if (strcmp(tmp, "f11") == 0) {
960
         } else if (strcmp(tmp, "f11") == 0) {
961
-            keyBindings[action] = f11;
961
+            keyBindings[action] = f11Key;
962
         } else if (strcmp(tmp, "f12") == 0) {
962
         } else if (strcmp(tmp, "f12") == 0) {
963
-            keyBindings[action] = f12;
963
+            keyBindings[action] = f12Key;
964
         } else if (strcmp(tmp, "backquote") == 0) {
964
         } else if (strcmp(tmp, "backquote") == 0) {
965
-            keyBindings[action] = backquote;
965
+            keyBindings[action] = backquoteKey;
966
         } else if (strcmp(tmp, "home") == 0) {
966
         } else if (strcmp(tmp, "home") == 0) {
967
-            keyBindings[action] = home;
967
+            keyBindings[action] = homeKey;
968
         } else if (strcmp(tmp, "insert") == 0) {
968
         } else if (strcmp(tmp, "insert") == 0) {
969
-            keyBindings[action] = insert;
969
+            keyBindings[action] = insertKey;
970
         } else if (strcmp(tmp, "leftalt") == 0) {
970
         } else if (strcmp(tmp, "leftalt") == 0) {
971
-            keyBindings[action] = leftalt;
971
+            keyBindings[action] = leftaltKey;
972
         } else if (strcmp(tmp, "leftctrl") == 0) {
972
         } else if (strcmp(tmp, "leftctrl") == 0) {
973
-            keyBindings[action] = leftctrl;
973
+            keyBindings[action] = leftctrlKey;
974
         } else if (strcmp(tmp, "leftbracket") == 0) {
974
         } else if (strcmp(tmp, "leftbracket") == 0) {
975
-            keyBindings[action] = leftbracket;
975
+            keyBindings[action] = leftbracketKey;
976
         } else if (strcmp(tmp, "leftgui") == 0) {
976
         } else if (strcmp(tmp, "leftgui") == 0) {
977
-            keyBindings[action] = leftgui;
977
+            keyBindings[action] = leftguiKey;
978
         } else if (strcmp(tmp, "leftshift") == 0) {
978
         } else if (strcmp(tmp, "leftshift") == 0) {
979
-            keyBindings[action] = leftshift;
979
+            keyBindings[action] = leftshiftKey;
980
         } else if (strcmp(tmp, "minus") == 0) {
980
         } else if (strcmp(tmp, "minus") == 0) {
981
-            keyBindings[action] = minus;
981
+            keyBindings[action] = minusKey;
982
         } else if (strcmp(tmp, "numlock") == 0) {
982
         } else if (strcmp(tmp, "numlock") == 0) {
983
-            keyBindings[action] = numlock;
983
+            keyBindings[action] = numlockKey;
984
         } else if (strcmp(tmp, "pagedown") == 0) {
984
         } else if (strcmp(tmp, "pagedown") == 0) {
985
-            keyBindings[action] = pagedown;
985
+            keyBindings[action] = pagedownKey;
986
         } else if (strcmp(tmp, "pageup") == 0) {
986
         } else if (strcmp(tmp, "pageup") == 0) {
987
-            keyBindings[action] = pageup;
987
+            keyBindings[action] = pageupKey;
988
         } else if (strcmp(tmp, "pause") == 0) {
988
         } else if (strcmp(tmp, "pause") == 0) {
989
-            keyBindings[action] = pause;
989
+            keyBindings[action] = pauseKey;
990
         } else if (strcmp(tmp, "dot") == 0) {
990
         } else if (strcmp(tmp, "dot") == 0) {
991
-            keyBindings[action] = dot;
991
+            keyBindings[action] = dotKey;
992
         } else if (strcmp(tmp, "rightalt") == 0) {
992
         } else if (strcmp(tmp, "rightalt") == 0) {
993
-            keyBindings[action] = rightalt;
993
+            keyBindings[action] = rightaltKey;
994
         } else if (strcmp(tmp, "rightctrl") == 0) {
994
         } else if (strcmp(tmp, "rightctrl") == 0) {
995
-            keyBindings[action] = rightctrl;
995
+            keyBindings[action] = rightctrlKey;
996
         } else if (strcmp(tmp, "enter") == 0) {
996
         } else if (strcmp(tmp, "enter") == 0) {
997
-            keyBindings[action] = enter;
997
+            keyBindings[action] = enterKey;
998
         } else if (strcmp(tmp, "rightgui") == 0) {
998
         } else if (strcmp(tmp, "rightgui") == 0) {
999
-            keyBindings[action] = rightgui;
999
+            keyBindings[action] = rightguiKey;
1000
         } else if (strcmp(tmp, "rightbracket") == 0) {
1000
         } else if (strcmp(tmp, "rightbracket") == 0) {
1001
-            keyBindings[action] = rightbracket;
1001
+            keyBindings[action] = rightbracketKey;
1002
         } else if (strcmp(tmp, "rightshift") == 0) {
1002
         } else if (strcmp(tmp, "rightshift") == 0) {
1003
-            keyBindings[action] = rightshift;
1003
+            keyBindings[action] = rightshiftKey;
1004
         } else if (strcmp(tmp, "scrolllock") == 0) {
1004
         } else if (strcmp(tmp, "scrolllock") == 0) {
1005
-            keyBindings[action] = scrolllock;
1005
+            keyBindings[action] = scrolllockKey;
1006
         } else if (strcmp(tmp, "semicolon") == 0) {
1006
         } else if (strcmp(tmp, "semicolon") == 0) {
1007
-            keyBindings[action] = semicolon;
1007
+            keyBindings[action] = semicolonKey;
1008
         } else if (strcmp(tmp, "slash") == 0) {
1008
         } else if (strcmp(tmp, "slash") == 0) {
1009
-            keyBindings[action] = slash;
1009
+            keyBindings[action] = slashKey;
1010
         } else if (strcmp(tmp, "space") == 0) {
1010
         } else if (strcmp(tmp, "space") == 0) {
1011
-            keyBindings[action] = space;
1011
+            keyBindings[action] = spaceKey;
1012
         } else if (strcmp(tmp, "tab") == 0) {
1012
         } else if (strcmp(tmp, "tab") == 0) {
1013
-            keyBindings[action] = tab;
1013
+            keyBindings[action] = tabKey;
1014
         } else if (strcmp(tmp, "leftmouse") == 0) {
1014
         } else if (strcmp(tmp, "leftmouse") == 0) {
1015
-            keyBindings[action] = leftmouse;
1015
+            keyBindings[action] = leftmouseKey;
1016
         } else if (strcmp(tmp, "middlemouse") == 0) {
1016
         } else if (strcmp(tmp, "middlemouse") == 0) {
1017
-            keyBindings[action] = middlemouse;
1017
+            keyBindings[action] = middlemouseKey;
1018
         } else if (strcmp(tmp, "rightmouse") == 0) {
1018
         } else if (strcmp(tmp, "rightmouse") == 0) {
1019
-            keyBindings[action] = rightmouse;
1019
+            keyBindings[action] = rightmouseKey;
1020
         } else {
1020
         } else {
1021
             getConsole().print("bind-\"\"-Error: Unknown key (%s)", key);
1021
             getConsole().print("bind-\"\"-Error: Unknown key (%s)", key);
1022
             delete [] tmp;
1022
             delete [] tmp;
1031
 }
1031
 }
1032
 
1032
 
1033
 void OpenRaider::loadPakFolderRecursive(const char *dir) {
1033
 void OpenRaider::loadPakFolderRecursive(const char *dir) {
1034
-    struct dirent *ep;
1034
+    struct dirent entry;
1035
+    struct dirent *ep = NULL;
1035
     DIR *pakDir;
1036
     DIR *pakDir;
1036
 
1037
 
1037
     assert(dir != NULL);
1038
     assert(dir != NULL);
1040
 
1041
 
1041
     pakDir = opendir(dir);
1042
     pakDir = opendir(dir);
1042
     if (pakDir != NULL) {
1043
     if (pakDir != NULL) {
1043
-        while ((ep = readdir(pakDir)) != NULL) {
1044
+        readdir_r(pakDir, &entry, &ep);
1045
+        while (ep != NULL) {
1044
             if (ep->d_type == DT_DIR) {
1046
             if (ep->d_type == DT_DIR) {
1045
                 if ((strcmp(".", ep->d_name) != 0)
1047
                 if ((strcmp(".", ep->d_name) != 0)
1046
                  && (strcmp("..", ep->d_name) != 0)) {
1048
                  && (strcmp("..", ep->d_name) != 0)) {
1074
                 delete [] lowerPath;
1076
                 delete [] lowerPath;
1075
                 delete [] fullPathMap;
1077
                 delete [] fullPathMap;
1076
             }
1078
             }
1079
+            readdir_r(pakDir, &entry, &ep);
1077
         }
1080
         }
1078
         closedir(pakDir);
1081
         closedir(pakDir);
1079
     } else {
1082
     } else {
1147
 }
1150
 }
1148
 
1151
 
1149
 void OpenRaider::handleKeyboard(KeyboardButton key, bool pressed) {
1152
 void OpenRaider::handleKeyboard(KeyboardButton key, bool pressed) {
1150
-    assert(key < unknown);
1153
+    assert(key < unknownKey);
1151
     assert(mRunning == true);
1154
     assert(mRunning == true);
1152
 
1155
 
1153
     if ((keyBindings[menuAction] == key) && pressed) {
1156
     if ((keyBindings[menuAction] == key) && pressed) {
1182
 }
1185
 }
1183
 
1186
 
1184
 void OpenRaider::handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released) {
1187
 void OpenRaider::handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released) {
1185
-    assert(button < unknown);
1188
+    assert(button < unknownKey);
1186
     assert(mRunning == true);
1189
     assert(mRunning == true);
1187
 
1190
 
1188
     if (getMenu().isVisible()) {
1191
     if (getMenu().isVisible()) {

+ 2
- 2
src/Render.cpp Прегледај датотеку

677
     glTranslatef(0.0f, 0.0f, -2000.0f);
677
     glTranslatef(0.0f, 0.0f, -2000.0f);
678
     glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
678
     glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
679
 
679
 
680
-    glBindTexture(GL_TEXTURE_2D, 3); //! \fixme store texture id somewhere
680
+    mTexture.bindTextureId(1); //! \fixme store texture id somewhere
681
 
681
 
682
     glBegin(GL_TRIANGLE_STRIP);
682
     glBegin(GL_TRIANGLE_STRIP);
683
     glTexCoord2f(1.0, 1.0);
683
     glTexCoord2f(1.0, 1.0);
1290
     glPushMatrix();
1290
     glPushMatrix();
1291
     //LightingSetup();
1291
     //LightingSetup();
1292
 
1292
 
1293
-    glBindTexture(GL_TEXTURE_2D, 1);  // WHITE texture
1293
+    mTexture.bindTextureId(0); // WHITE texture
1294
 
1294
 
1295
     if (!draw_alpha &&
1295
     if (!draw_alpha &&
1296
             (mFlags & Render::fPortals || mMode == Render::modeWireframe))
1296
             (mFlags & Render::fPortals || mMode == Render::modeWireframe))

+ 0
- 1
src/Texture.cpp Прегледај датотеку

273
 
273
 
274
 void Texture::bindTextureId(unsigned int n) {
274
 void Texture::bindTextureId(unsigned int n) {
275
     assert(mTextureIds != NULL);
275
     assert(mTextureIds != NULL);
276
-    assert((int)n != mTextureId);
277
     assert(n <= mTextureCount);
276
     assert(n <= mTextureCount);
278
 
277
 
279
     mTextureId = n;
278
     mTextureId = n;

+ 7
- 0
src/TombRaider.cpp Прегледај датотеку

74
     mTexelScale = 256.0f;
74
     mTexelScale = 256.0f;
75
     mRiffDataSz = 0;
75
     mRiffDataSz = 0;
76
 
76
 
77
+    for (int i = 0; i < 256; i++) {
78
+        _palette8[i].r = 0;
79
+        _palette8[i].g = 0;
80
+        _palette8[i].b = 0;
81
+        _palette16[i] = 0;
82
+    }
83
+
77
     reset();
84
     reset();
78
 }
85
 }
79
 
86
 

+ 90
- 90
src/WindowSDL.cpp Прегледај датотеку

189
             case SDL_MOUSEBUTTONUP:
189
             case SDL_MOUSEBUTTONUP:
190
                 KeyboardButton button;
190
                 KeyboardButton button;
191
                 if (event.button.button == SDL_BUTTON_LEFT)
191
                 if (event.button.button == SDL_BUTTON_LEFT)
192
-                    button = leftmouse;
192
+                    button = leftmouseKey;
193
                 else if (event.button.button == SDL_BUTTON_RIGHT)
193
                 else if (event.button.button == SDL_BUTTON_RIGHT)
194
-                    button = rightmouse;
194
+                    button = rightmouseKey;
195
                 else
195
                 else
196
-                    button = middlemouse;
196
+                    button = middlemouseKey;
197
                 getOpenRaider().handleMouseClick(event.button.x, event.button.y, button, (event.type == SDL_MOUSEBUTTONUP));
197
                 getOpenRaider().handleMouseClick(event.button.x, event.button.y, button, (event.type == SDL_MOUSEBUTTONUP));
198
                 break;
198
                 break;
199
 
199
 
211
                 KeyboardButton key;
211
                 KeyboardButton key;
212
                 switch (event.key.keysym.sym) {
212
                 switch (event.key.keysym.sym) {
213
                     case SDLK_0:
213
                     case SDLK_0:
214
-                        key = zero;
214
+                        key = zeroKey;
215
                         break;
215
                         break;
216
                     case SDLK_1:
216
                     case SDLK_1:
217
-                        key = one;
217
+                        key = oneKey;
218
                         break;
218
                         break;
219
                     case SDLK_2:
219
                     case SDLK_2:
220
-                        key = two;
220
+                        key = twoKey;
221
                         break;
221
                         break;
222
                     case SDLK_3:
222
                     case SDLK_3:
223
-                        key = three;
223
+                        key = threeKey;
224
                         break;
224
                         break;
225
                     case SDLK_4:
225
                     case SDLK_4:
226
-                        key = four;
226
+                        key = fourKey;
227
                         break;
227
                         break;
228
                     case SDLK_5:
228
                     case SDLK_5:
229
-                        key = five;
229
+                        key = fiveKey;
230
                         break;
230
                         break;
231
                     case SDLK_6:
231
                     case SDLK_6:
232
-                        key = six;
232
+                        key = sixKey;
233
                         break;
233
                         break;
234
                     case SDLK_7:
234
                     case SDLK_7:
235
-                        key = seven;
235
+                        key = sevenKey;
236
                         break;
236
                         break;
237
                     case SDLK_8:
237
                     case SDLK_8:
238
-                        key = eight;
238
+                        key = eightKey;
239
                         break;
239
                         break;
240
                     case SDLK_9:
240
                     case SDLK_9:
241
-                        key = nine;
241
+                        key = nineKey;
242
                         break;
242
                         break;
243
                     case SDLK_a:
243
                     case SDLK_a:
244
-                        key = a;
244
+                        key = aKey;
245
                         break;
245
                         break;
246
                     case SDLK_b:
246
                     case SDLK_b:
247
-                        key = b;
247
+                        key = bKey;
248
                         break;
248
                         break;
249
                     case SDLK_c:
249
                     case SDLK_c:
250
-                        key = c;
250
+                        key = cKey;
251
                         break;
251
                         break;
252
                     case SDLK_d:
252
                     case SDLK_d:
253
-                        key = d;
253
+                        key = dKey;
254
                         break;
254
                         break;
255
                     case SDLK_e:
255
                     case SDLK_e:
256
-                        key = e;
256
+                        key = eKey;
257
                         break;
257
                         break;
258
                     case SDLK_f:
258
                     case SDLK_f:
259
-                        key = f;
259
+                        key = fKey;
260
                         break;
260
                         break;
261
                     case SDLK_g:
261
                     case SDLK_g:
262
-                        key = g;
262
+                        key = gKey;
263
                         break;
263
                         break;
264
                     case SDLK_h:
264
                     case SDLK_h:
265
-                        key = h;
265
+                        key = hKey;
266
                         break;
266
                         break;
267
                     case SDLK_i:
267
                     case SDLK_i:
268
-                        key = i;
268
+                        key = iKey;
269
                         break;
269
                         break;
270
                     case SDLK_j:
270
                     case SDLK_j:
271
-                        key = j;
271
+                        key = jKey;
272
                         break;
272
                         break;
273
                     case SDLK_k:
273
                     case SDLK_k:
274
-                        key = k;
274
+                        key = kKey;
275
                         break;
275
                         break;
276
                     case SDLK_l:
276
                     case SDLK_l:
277
-                        key = l;
277
+                        key = lKey;
278
                         break;
278
                         break;
279
                     case SDLK_m:
279
                     case SDLK_m:
280
-                        key = m;
280
+                        key = mKey;
281
                         break;
281
                         break;
282
                     case SDLK_n:
282
                     case SDLK_n:
283
-                        key = n;
283
+                        key = nKey;
284
                         break;
284
                         break;
285
                     case SDLK_o:
285
                     case SDLK_o:
286
-                        key = o;
286
+                        key = oKey;
287
                         break;
287
                         break;
288
                     case SDLK_p:
288
                     case SDLK_p:
289
-                        key = p;
289
+                        key = pKey;
290
                         break;
290
                         break;
291
                     case SDLK_q:
291
                     case SDLK_q:
292
-                        key = q;
292
+                        key = qKey;
293
                         break;
293
                         break;
294
                     case SDLK_r:
294
                     case SDLK_r:
295
-                        key = r;
295
+                        key = rKey;
296
                         break;
296
                         break;
297
                     case SDLK_s:
297
                     case SDLK_s:
298
-                        key = s;
298
+                        key = sKey;
299
                         break;
299
                         break;
300
                     case SDLK_t:
300
                     case SDLK_t:
301
-                        key = t;
301
+                        key = tKey;
302
                         break;
302
                         break;
303
                     case SDLK_u:
303
                     case SDLK_u:
304
-                        key = u;
304
+                        key = uKey;
305
                         break;
305
                         break;
306
                     case SDLK_v:
306
                     case SDLK_v:
307
-                        key = v;
307
+                        key = vKey;
308
                         break;
308
                         break;
309
                     case SDLK_w:
309
                     case SDLK_w:
310
-                        key = w;
310
+                        key = wKey;
311
                         break;
311
                         break;
312
                     case SDLK_x:
312
                     case SDLK_x:
313
-                        key = x;
313
+                        key = xKey;
314
                         break;
314
                         break;
315
                     case SDLK_y:
315
                     case SDLK_y:
316
-                        key = y;
316
+                        key = yKey;
317
                         break;
317
                         break;
318
                     case SDLK_z:
318
                     case SDLK_z:
319
-                        key = z;
319
+                        key = zKey;
320
                         break;
320
                         break;
321
                     case SDLK_QUOTE:
321
                     case SDLK_QUOTE:
322
-                        key = quote;
322
+                        key = quoteKey;
323
                         break;
323
                         break;
324
                     case SDLK_BACKSLASH:
324
                     case SDLK_BACKSLASH:
325
-                        key = backslash;
325
+                        key = backslashKey;
326
                         break;
326
                         break;
327
                     case SDLK_BACKSPACE:
327
                     case SDLK_BACKSPACE:
328
-                        key = backspace;
328
+                        key = backspaceKey;
329
                         break;
329
                         break;
330
                     case SDLK_CAPSLOCK:
330
                     case SDLK_CAPSLOCK:
331
-                        key = capslock;
331
+                        key = capslockKey;
332
                         break;
332
                         break;
333
                     case SDLK_COMMA:
333
                     case SDLK_COMMA:
334
-                        key = comma;
334
+                        key = commaKey;
335
                         break;
335
                         break;
336
                     case SDLK_DELETE:
336
                     case SDLK_DELETE:
337
-                        key = del;
337
+                        key = delKey;
338
                         break;
338
                         break;
339
                     case SDLK_UP:
339
                     case SDLK_UP:
340
-                        key = up;
340
+                        key = upKey;
341
                         break;
341
                         break;
342
                     case SDLK_DOWN:
342
                     case SDLK_DOWN:
343
-                        key = down;
343
+                        key = downKey;
344
                         break;
344
                         break;
345
                     case SDLK_LEFT:
345
                     case SDLK_LEFT:
346
-                        key = left;
346
+                        key = leftKey;
347
                         break;
347
                         break;
348
                     case SDLK_RIGHT:
348
                     case SDLK_RIGHT:
349
-                        key = right;
349
+                        key = rightKey;
350
                         break;
350
                         break;
351
                     case SDLK_END:
351
                     case SDLK_END:
352
-                        key = end;
352
+                        key = endKey;
353
                         break;
353
                         break;
354
                     case SDLK_EQUALS:
354
                     case SDLK_EQUALS:
355
-                        key = equals;
355
+                        key = equalsKey;
356
                         break;
356
                         break;
357
                     case SDLK_ESCAPE:
357
                     case SDLK_ESCAPE:
358
-                        key = escape;
358
+                        key = escapeKey;
359
                         break;
359
                         break;
360
                     case SDLK_F1:
360
                     case SDLK_F1:
361
-                        key = f1;
361
+                        key = f1Key;
362
                         break;
362
                         break;
363
                     case SDLK_F2:
363
                     case SDLK_F2:
364
-                        key = f2;
364
+                        key = f2Key;
365
                         break;
365
                         break;
366
                     case SDLK_F3:
366
                     case SDLK_F3:
367
-                        key = f3;
367
+                        key = f3Key;
368
                         break;
368
                         break;
369
                     case SDLK_F4:
369
                     case SDLK_F4:
370
-                        key = f4;
370
+                        key = f4Key;
371
                         break;
371
                         break;
372
                     case SDLK_F5:
372
                     case SDLK_F5:
373
-                        key = f5;
373
+                        key = f5Key;
374
                         break;
374
                         break;
375
                     case SDLK_F6:
375
                     case SDLK_F6:
376
-                        key = f6;
376
+                        key = f6Key;
377
                         break;
377
                         break;
378
                     case SDLK_F7:
378
                     case SDLK_F7:
379
-                        key = f7;
379
+                        key = f7Key;
380
                         break;
380
                         break;
381
                     case SDLK_F8:
381
                     case SDLK_F8:
382
-                        key = f8;
382
+                        key = f8Key;
383
                         break;
383
                         break;
384
                     case SDLK_F9:
384
                     case SDLK_F9:
385
-                        key = f9;
385
+                        key = f9Key;
386
                         break;
386
                         break;
387
                     case SDLK_F10:
387
                     case SDLK_F10:
388
-                        key = f10;
388
+                        key = f10Key;
389
                         break;
389
                         break;
390
                     case SDLK_F11:
390
                     case SDLK_F11:
391
-                        key = f11;
391
+                        key = f11Key;
392
                         break;
392
                         break;
393
                     case SDLK_F12:
393
                     case SDLK_F12:
394
-                        key = f12;
394
+                        key = f12Key;
395
                         break;
395
                         break;
396
                     case SDLK_BACKQUOTE:
396
                     case SDLK_BACKQUOTE:
397
-                        key = backquote;
397
+                        key = backquoteKey;
398
                         break;
398
                         break;
399
                     case SDLK_HOME:
399
                     case SDLK_HOME:
400
-                        key = home;
400
+                        key = homeKey;
401
                         break;
401
                         break;
402
                     case SDLK_INSERT:
402
                     case SDLK_INSERT:
403
-                        key = insert;
403
+                        key = insertKey;
404
                         break;
404
                         break;
405
                     case SDLK_LALT:
405
                     case SDLK_LALT:
406
-                        key = leftalt;
406
+                        key = leftaltKey;
407
                         break;
407
                         break;
408
                     case SDLK_LCTRL:
408
                     case SDLK_LCTRL:
409
-                        key = leftctrl;
409
+                        key = leftctrlKey;
410
                         break;
410
                         break;
411
                     case SDLK_LEFTBRACKET:
411
                     case SDLK_LEFTBRACKET:
412
-                        key = leftbracket;
412
+                        key = leftbracketKey;
413
                         break;
413
                         break;
414
                     case SDLK_LGUI:
414
                     case SDLK_LGUI:
415
-                        key = leftgui;
415
+                        key = leftguiKey;
416
                         break;
416
                         break;
417
                     case SDLK_LSHIFT:
417
                     case SDLK_LSHIFT:
418
-                        key = leftshift;
418
+                        key = leftshiftKey;
419
                         break;
419
                         break;
420
                     case SDLK_MINUS:
420
                     case SDLK_MINUS:
421
-                        key = minus;
421
+                        key = minusKey;
422
                         break;
422
                         break;
423
                     case SDLK_NUMLOCKCLEAR:
423
                     case SDLK_NUMLOCKCLEAR:
424
-                        key = numlock;
424
+                        key = numlockKey;
425
                         break;
425
                         break;
426
                     case SDLK_PAGEDOWN:
426
                     case SDLK_PAGEDOWN:
427
-                        key = pagedown;
427
+                        key = pagedownKey;
428
                         break;
428
                         break;
429
                     case SDLK_PAGEUP:
429
                     case SDLK_PAGEUP:
430
-                        key = pageup;
430
+                        key = pageupKey;
431
                         break;
431
                         break;
432
                     case SDLK_PAUSE:
432
                     case SDLK_PAUSE:
433
-                        key = pause;
433
+                        key = pauseKey;
434
                         break;
434
                         break;
435
                     case SDLK_PERIOD:
435
                     case SDLK_PERIOD:
436
-                        key = dot;
436
+                        key = dotKey;
437
                         break;
437
                         break;
438
                     case SDLK_RALT:
438
                     case SDLK_RALT:
439
-                        key = rightalt;
439
+                        key = rightaltKey;
440
                         break;
440
                         break;
441
                     case SDLK_RCTRL:
441
                     case SDLK_RCTRL:
442
-                        key = rightctrl;
442
+                        key = rightctrlKey;
443
                         break;
443
                         break;
444
                     case SDLK_RETURN:
444
                     case SDLK_RETURN:
445
                     case SDLK_RETURN2:
445
                     case SDLK_RETURN2:
446
-                        key = enter;
446
+                        key = enterKey;
447
                         break;
447
                         break;
448
                     case SDLK_RGUI:
448
                     case SDLK_RGUI:
449
-                        key = rightgui;
449
+                        key = rightguiKey;
450
                         break;
450
                         break;
451
                     case SDLK_RIGHTBRACKET:
451
                     case SDLK_RIGHTBRACKET:
452
-                        key = rightbracket;
452
+                        key = rightbracketKey;
453
                         break;
453
                         break;
454
                     case SDLK_RSHIFT:
454
                     case SDLK_RSHIFT:
455
-                        key = rightshift;
455
+                        key = rightshiftKey;
456
                         break;
456
                         break;
457
                     case SDLK_SCROLLLOCK:
457
                     case SDLK_SCROLLLOCK:
458
-                        key = scrolllock;
458
+                        key = scrolllockKey;
459
                         break;
459
                         break;
460
                     case SDLK_SEMICOLON:
460
                     case SDLK_SEMICOLON:
461
-                        key = semicolon;
461
+                        key = semicolonKey;
462
                         break;
462
                         break;
463
                     case SDLK_SLASH:
463
                     case SDLK_SLASH:
464
-                        key = slash;
464
+                        key = slashKey;
465
                         break;
465
                         break;
466
                     case SDLK_SPACE:
466
                     case SDLK_SPACE:
467
-                        key = space;
467
+                        key = spaceKey;
468
                         break;
468
                         break;
469
                     case SDLK_TAB:
469
                     case SDLK_TAB:
470
-                        key = tab;
470
+                        key = tabKey;
471
                         break;
471
                         break;
472
                     default:
472
                     default:
473
-                        key = unknown;
473
+                        key = unknownKey;
474
                         break;
474
                         break;
475
 
475
 
476
                 }
476
                 }

+ 9
- 4
src/main.cpp Прегледај датотеку

100
     if (gWindow)
100
     if (gWindow)
101
         delete gWindow;
101
         delete gWindow;
102
 
102
 
103
+#ifdef DEBUG
103
     printf("\nThanks for testing %s\n", VERSION);
104
     printf("\nThanks for testing %s\n", VERSION);
104
     printf("Build date: %s @ %s\n", __DATE__, __TIME__);
105
     printf("Build date: %s @ %s\n", __DATE__, __TIME__);
105
     printf("Build host: %s\n", BUILD_HOST);
106
     printf("Build host: %s\n", BUILD_HOST);
106
     printf("Web site  : http://github.com/xythobuz/OpenRaider\n");
107
     printf("Web site  : http://github.com/xythobuz/OpenRaider\n");
107
     printf("Contact   : xythobuz@xythobuz.de\n");
108
     printf("Contact   : xythobuz@xythobuz.de\n");
109
+#endif
108
 }
110
 }
109
 
111
 
110
 int main(int argc, char *argv[]) {
112
 int main(int argc, char *argv[]) {
113
     // Handle arguments
115
     // Handle arguments
114
     if (argc == 1) {
116
     if (argc == 1) {
115
         // Use default rc file path
117
         // Use default rc file path
116
-        config = DEFAULT_CONFIG_PATH DEFAULT_CONFIG_FILE;
118
+        config = DEFAULT_CONFIG_PATH "/" DEFAULT_CONFIG_FILE;
117
     } else if (argc == 2) {
119
     } else if (argc == 2) {
118
         // Check for command line switches
120
         // Check for command line switches
119
         if ((strcmp("-h", argv[1]) == 0)
121
         if ((strcmp("-h", argv[1]) == 0)
124
                     "\t--help\n\t-h\tDisplay this help text\n"
126
                     "\t--help\n\t-h\tDisplay this help text\n"
125
                     "\t--version\n\t-v\tDisplay version information\n"
127
                     "\t--version\n\t-v\tDisplay version information\n"
126
                     "If no options are given, the default config will be loaded from:\n"
128
                     "If no options are given, the default config will be loaded from:\n"
127
-                    "\t" DEFAULT_CONFIG_PATH DEFAULT_CONFIG_FILE "\n", argv[0]);
129
+                    "\t" DEFAULT_CONFIG_PATH "/" DEFAULT_CONFIG_FILE "\n", argv[0]);
128
             return 0;
130
             return 0;
129
         } else if ((strcmp("-v", argv[1]) == 0)
131
         } else if ((strcmp("-v", argv[1]) == 0)
130
                 || (strcmp("--version", argv[1]) == 0)) {
132
                 || (strcmp("--version", argv[1]) == 0)) {
140
         return 1;
142
         return 1;
141
     }
143
     }
142
 
144
 
143
-    // Create globals
145
+#ifdef DEBUG
144
     printf("Initializing %s\n", VERSION);
146
     printf("Initializing %s\n", VERSION);
147
+#endif
148
+
149
+    // Create globals
145
     atexit(cleanupHandler);
150
     atexit(cleanupHandler);
146
     gOpenRaider = new OpenRaider();
151
     gOpenRaider = new OpenRaider();
147
     gWindow = new WindowSDL();
152
     gWindow = new WindowSDL();
155
 
160
 
156
     // Try to load a configuration
161
     // Try to load a configuration
157
     if (gOpenRaider->loadConfig(config) != 0) {
162
     if (gOpenRaider->loadConfig(config) != 0) {
158
-        if (gOpenRaider->loadConfig(DEFAULT_CONFIG_PATH DEFAULT_CONFIG_FILE) != 0) {
163
+        if (gOpenRaider->loadConfig(DEFAULT_CONFIG_PATH "/" DEFAULT_CONFIG_FILE) != 0) {
159
             if (gOpenRaider->loadConfig(DEFAULT_CONFIG_FILE) != 0) {
164
             if (gOpenRaider->loadConfig(DEFAULT_CONFIG_FILE) != 0) {
160
                 printf("Could not find a config file. Aborting...\n");
165
                 printf("Could not find a config file. Aborting...\n");
161
                 return 2;
166
                 return 2;

+ 3
- 3
src/utils/strings.cpp Прегледај датотеку

106
         delete [] text;
106
         delete [] text;
107
         text = new char[sz + 1];
107
         text = new char[sz + 1];
108
         va_copy(tmp, args);
108
         va_copy(tmp, args);
109
-        n = vsnprintf(text, sz, string, tmp);
109
+        vsnprintf(text, sz, string, tmp);
110
         va_end(tmp);
110
         va_end(tmp);
111
     }
111
     }
112
 
112
 
122
 }
122
 }
123
 
123
 
124
 char *fullPath(const char *path, char end) {
124
 char *fullPath(const char *path, char end) {
125
-    unsigned int lenPath, offset;
125
+    unsigned int lenPath;
126
     wordexp_t word;
126
     wordexp_t word;
127
     char *dir;
127
     char *dir;
128
 
128
 
160
         dir = new char[lenPath + 2]; // space for end char
160
         dir = new char[lenPath + 2]; // space for end char
161
 
161
 
162
         // Copy segments into new string
162
         // Copy segments into new string
163
-        offset = 0;
163
+        unsigned int offset = 0;
164
         for (unsigned int i = 0; i < word.we_wordc; i++) {
164
         for (unsigned int i = 0; i < word.we_wordc; i++) {
165
             unsigned int len = strlen(word.we_wordv[i]);
165
             unsigned int len = strlen(word.we_wordv[i]);
166
             strncpy(dir + offset, word.we_wordv[i], len);
166
             strncpy(dir + offset, word.we_wordv[i], len);

Loading…
Откажи
Сачувај