瀏覽代碼

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
     void readStringPackage(BinaryFile& f, std::vector<std::string>& v, unsigned int n);
144
     void readStringPackage(BinaryFile& f, std::vector<std::string>& v, unsigned int n);
145
     void readScriptPackage(BinaryFile& f, std::vector<std::vector<uint16_t>>& v, unsigned int n);
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
     // Header
149
     // Header
155
     uint32_t version; // Always 3, for TR2/3 on PC and PSX
150
     uint32_t version; // Always 3, for TR2/3 on PC and PSX

+ 5
- 2
include/global.h 查看文件

81
 #include <OpenGL/gl3.h>
81
 #include <OpenGL/gl3.h>
82
 #else // __APPLE__
82
 #else // __APPLE__
83
 #ifdef _WIN32
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
 //! \todo gl3 header?
88
 //! \todo gl3 header?
87
 #include <GL/gl.h>
89
 #include <GL/gl.h>
88
 #include <GL/glext.h>
90
 #include <GL/glext.h>
91
+#endif // _WIN32
89
 #endif // __APPLE__
92
 #endif // __APPLE__
90
 
93
 
91
 /*! \todo Is there a better way to handle this?
94
 /*! \todo Is there a better way to handle this?

+ 8
- 0
src/CMakeLists.txt 查看文件

45
     include_directories (SYSTEM  ${GLM_INCLUDE_DIRS})
45
     include_directories (SYSTEM  ${GLM_INCLUDE_DIRS})
46
 endif (GLM_FOUND)
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
 # Set Source files
58
 # Set Source files

+ 7
- 0
src/Script.cpp 查看文件

8
 #include "global.h"
8
 #include "global.h"
9
 #include "Script.h"
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
 Script::Script() : puzzles(4), pickups(2), keys(4) {
18
 Script::Script() : puzzles(4), pickups(2), keys(4) {
12
     version = 0;
19
     version = 0;
13
     firstOption = 0;
20
     firstOption = 0;

+ 2
- 0
src/SoundManager.cpp 查看文件

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

+ 2
- 1
src/loader/LoaderTR2.cpp 查看文件

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

+ 3
- 3
src/system/Shader.cpp 查看文件

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

+ 2
- 2
src/utils/filesystem.cpp 查看文件

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

Loading…
取消
儲存