Преглед изворни кода

Small fixes (tried to compile with Visual Studio)

Thomas Buck пре 9 година
родитељ
комит
a0efd8352e
8 измењених фајлова са 30 додато и 14 уклоњено
  1. 1
    6
      include/Script.h
  2. 5
    2
      include/global.h
  3. 8
    0
      src/CMakeLists.txt
  4. 7
    0
      src/Script.cpp
  5. 2
    0
      src/SoundManager.cpp
  6. 2
    1
      src/loader/LoaderTR2.cpp
  7. 3
    3
      src/system/Shader.cpp
  8. 2
    2
      src/utils/filesystem.cpp

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

@@ -144,12 +144,7 @@ class Script {
144 144
     void readStringPackage(BinaryFile& f, std::vector<std::string>& v, unsigned int n);
145 145
     void readScriptPackage(BinaryFile& f, std::vector<std::vector<uint16_t>>& v, unsigned int n);
146 146
 
147
-    const bool opcodeHasOperand[OP_UNKNOWN] {
148
-        true, true, true, true, true, true,
149
-        false, true, true, false, true, false,
150
-        true, false, false, false, true, true,
151
-        true, true, true, false, false
152
-    };
147
+    const static bool opcodeHasOperand[OP_UNKNOWN];
153 148
 
154 149
     // Header
155 150
     uint32_t version; // Always 3, for TR2/3 on PC and PSX

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

@@ -81,11 +81,14 @@ typedef enum {
81 81
 #include <OpenGL/gl3.h>
82 82
 #else // __APPLE__
83 83
 #ifdef _WIN32
84
-#include <windows.h>
85
-#endif // _WIN32
84
+#include <GL/glew.h>
85
+#include <GL/wglew.h>
86
+#pragma comment(lib, "glew32.lib")
87
+#else // _WIN32
86 88
 //! \todo gl3 header?
87 89
 #include <GL/gl.h>
88 90
 #include <GL/glext.h>
91
+#endif // _WIN32
89 92
 #endif // __APPLE__
90 93
 
91 94
 /*! \todo Is there a better way to handle this?

+ 8
- 0
src/CMakeLists.txt Прегледај датотеку

@@ -45,6 +45,14 @@ if (GLM_FOUND)
45 45
     include_directories (SYSTEM  ${GLM_INCLUDE_DIRS})
46 46
 endif (GLM_FOUND)
47 47
 
48
+if (WIN32)
49
+    find_package (GLEW REQUIRED)
50
+    if (GLEW_FOUND)
51
+        include_directories (SYSTEM ${GLEW_INCLUDE_DIRS})
52
+        set (LIBS ${LIBS} ${GLEW_LIBRARIES})
53
+    endif (GLEW_FOUND)
54
+endif (WIN32)
55
+
48 56
 #################################################################
49 57
 
50 58
 # Set Source files

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

@@ -8,6 +8,13 @@
8 8
 #include "global.h"
9 9
 #include "Script.h"
10 10
 
11
+const bool Script::opcodeHasOperand[OP_UNKNOWN] {
12
+    true, true, true, true, true, true,
13
+    false, true, true, false, true, false,
14
+    true, false, false, false, true, true,
15
+    true, true, true, false, false
16
+};
17
+
11 18
 Script::Script() : puzzles(4), pickups(2), keys(4) {
12 19
     version = 0;
13 20
     firstOption = 0;

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

@@ -45,6 +45,8 @@ int SoundManager::prepareSources() {
45 45
             assertGreaterThanEqual(ret, 0);
46 46
         }
47 47
     }
48
+
49
+    return 0;
48 50
 }
49 51
 
50 52
 void SoundManager::addSoundSource(float x, float y, float z, int id, int flags) {

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

@@ -1113,12 +1113,13 @@ void LoaderTR2::loadExternalSoundFile(std::string f) {
1113 1113
         // riffSize is (fileLength - 8)
1114 1114
         uint32_t riffSize = sfx.readU32();
1115 1115
 
1116
-        unsigned char buff[riffSize + 8];
1116
+        unsigned char* buff = new unsigned char[riffSize + 8];
1117 1117
         sfx.seek(sfx.tell() - 8);
1118 1118
         for (int i = 0; i < (riffSize + 8); i++)
1119 1119
             buff[i] = sfx.readU8();
1120 1120
 
1121 1121
         int ret = Sound::loadBuffer(buff, riffSize + 8);
1122
+        delete [] buff;
1122 1123
         assertGreaterThanEqual(ret, 0);
1123 1124
 
1124 1125
         riffCount++;

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

@@ -241,7 +241,7 @@ void Shader::drawGL(ShaderBuffer& vertices, ShaderBuffer& uvs, glm::vec4 color,
241 241
                     Shader& shader) {
242 242
     assert(vertices.getSize() == uvs.getSize());
243 243
     if (mode == GL_TRIANGLES) {
244
-        assert((vertices.getSize() % 3) == 0)
244
+        assert((vertices.getSize() % 3) == 0);
245 245
     }
246 246
 
247 247
     shader.use();
@@ -295,7 +295,7 @@ void Shader::drawGL(ShaderBuffer& vertices, ShaderBuffer& colors, glm::mat4 MVP,
295 295
                     unsigned int mode, Shader& shader) {
296 296
     assert(vertices.getSize() == colors.getSize());
297 297
     if (mode == GL_TRIANGLES) {
298
-        assert((vertices.getSize() % 3) == 0)
298
+        assert((vertices.getSize() % 3) == 0);
299 299
     }
300 300
 
301 301
     shader.use();
@@ -311,7 +311,7 @@ void Shader::drawGL(ShaderBuffer& vertices, ShaderBuffer& colors, ShaderBuffer&
311 311
                     glm::mat4 MVP, unsigned int mode, Shader& shader) {
312 312
     assert(vertices.getSize() == colors.getSize());
313 313
     if (mode == GL_TRIANGLES) {
314
-        assert((indices.getSize() % 3) == 0)
314
+        assert((indices.getSize() % 3) == 0);
315 315
     }
316 316
 
317 317
     shader.use();

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

@@ -49,8 +49,8 @@ std::string getHomeDirectory() {
49 49
     assertEqual(SHGetFolderPath(nullptr, CSIDL_PROFILE, nullptr, 0, path), S_OK);
50 50
     size_t lenPath = strlen(path);
51 51
     for (unsigned int i = 0; i < lenPath; i++)
52
-        if (dir[i] == '\\')
53
-            dir[i] = '/';
52
+        if (path[i] == '\\')
53
+            path[i] = '/';
54 54
     return std::string(path);
55 55
 
56 56
 #else

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