Browse Source

Added (blank) binary file reading utils

Thomas Buck 9 years ago
parent
commit
d8d2fce36b
8 changed files with 101 additions and 20 deletions
  1. 0
    3
      CMakeLists.txt
  2. 8
    8
      README.md
  3. 1
    6
      TODO.md
  4. 30
    0
      include/utils/binary.h
  5. 1
    1
      src/Menu.cpp
  6. 2
    2
      src/TombRaider.cpp
  7. 1
    0
      src/utils/CMakeLists.txt
  8. 58
    0
      src/utils/binary.cpp

+ 0
- 3
CMakeLists.txt View File

@@ -36,9 +36,6 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
36 36
     set (WARNINGS "${WARNINGS} -Wno-padded -Wno-packed")
37 37
     set (WARNINGS "${WARNINGS} -Wno-global-constructors -Wno-exit-time-destructors")
38 38
     set (WARNINGS "${WARNINGS} -Wno-documentation-unknown-command -Wno-c++98-compat-pedantic")
39
-
40
-    set (WARNINGS "${WARNINGS} -Wno-sign-conversion")
41
-
42 39
     set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -std=c++11")
43 40
     set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -g -O0 -ftrapv")
44 41
     set (OpenRaider_CXX_FLAGS_RELEASE "${OpenRaider_CXX_FLAGS_RELEASE} -O2 -fomit-frame-pointer")

+ 8
- 8
README.md View File

@@ -1,5 +1,7 @@
1 1
 # OpenRaider
2 2
 
3
+[![Build Status](https://travis-ci.org/xythobuz/OpenRaider.svg?branch=master)](https://travis-ci.org/xythobuz/OpenRaider)
4
+
3 5
 This is a fork of the [OpenRaider](http://openraider.sourceforge.net) Open Source implementation of the classic Tomb Raider Game Engine. The original project was abandoned in 2003.
4 6
 
5 7
 This fork aims to get OpenRaider in a more usable state, maybe one day even being able to play the old Tomb Raider games flawlessly...
@@ -8,8 +10,6 @@ If you just want to see OpenRaider doing something on your Mac, without installi
8 10
 
9 11
 It seems as if OpenRaider will currently only work on Little-Endian platforms. This is not nice and will hopefully be fixed in the future!
10 12
 
11
-[![Build Status](https://travis-ci.org/xythobuz/OpenRaider.svg?branch=master)](https://travis-ci.org/xythobuz/OpenRaider)
12
-
13 13
 [![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=xythobuz&url=https://github.com/xythobuz/OpenRaider&title=OpenRaider&language=&tags=github&category=software)
14 14
 
15 15
 ## Configuration
@@ -30,14 +30,14 @@ A more or less recent [Doxygen documentation](http://xythobuz.github.io/OpenRaid
30 30
 
31 31
 Basically, OpenRaider depends on the following:
32 32
 
33
+* C++11 compiler
34
+* cmake
33 35
 * OpenGL
36
+* zlib
34 37
 * SDL2
35 38
 * SDL2-TTF (optional, needed if you want to use TTF fonts)
36
-* OpenAL & ALUT
37
-* zlib
38
-* cmake as build system
39
+* OpenAL & ALUT (optional, needed for sound output)
39 40
 * libpng (optional)
40
-* C++11 compiler
41 41
 
42 42
 On Mac OS X 10.9 with [XCode](https://developer.apple.com/xcode/) and [MacPorts](http://www.macports.org) installed, the following should be enough to get all dependencies that are available as port:
43 43
 
@@ -57,7 +57,7 @@ Get, compile and install freealut like this:
57 57
 
58 58
 Linux Distributions will probably provide an ALUT library ready to install with their package manager, so you won't need to compile freealut.
59 59
 
60
-Sound support is optional now, however. If cmake can’t find OpenAL and ALUT, Audio will be deactivated. If you want to explicitly deactivate it, call cmake with `-DENABLE_AUDIO=NO`.
60
+Sound support is optional, however. If cmake can’t find OpenAL and ALUT, Audio will be deactivated. If you want to explicitly deactivate it, call cmake with `-DENABLE_AUDIO=NO`.
61 61
 
62 62
 ## Building
63 63
 
@@ -142,7 +142,7 @@ I’ve made [a small writeup on my website](http://xythobuz.de/2014_06_14_trle_f
142 142
 
143 143
 ## License
144 144
 
145
-OpenRaider is based on code, specs, and alogrithms from:
145
+OpenRaider is based on code, specs, and algorithms from:
146 146
 
147 147
 * GooseEgg/Freyja 3d Modelers by Mongoose
148 148
 * TR Rosetta Stone spec sheet by Anonymous

+ 1
- 6
TODO.md View File

@@ -2,21 +2,16 @@
2 2
 
3 3
 ## General
4 4
 
5
+* Move to newer OpenGL (GLES or 3.x or 4.x?)
5 6
 * Endian dependence ugly, shouldn't dereference to different types?
6 7
     * TombRaider.h/cpp structs aren't aligned... unportable to some big endian & other archs?!
7 8
     * Maybe replace loader with [VT](http://icculus.org/vt/), also used by OpenTomb.
8
-* Use more asserts
9 9
 * Don't use C-Style code, try to replace with C++ lib
10 10
     * Use std::strings
11 11
     * Rewrite Console and use operator << to write to the console?
12
-* SDL_TTF 2.0.12+ [can do line breaks](http://stackoverflow.com/questions/17847818/how-to-do-line-breaks-and-line-wrapping-with-sdl-ttf/18418688#18418688), use it
13 12
 * Mesh has 2 different approaches of storing the same data (eg. mColors and mColorArray), but half of ‘em isn’t implemented. Unify this, probably even combining Mesh and StaticMesh...
14 13
 * Don’t use float everywhere just because (eg. float colors)
15 14
 
16
-## Changes
17
-
18
-* Using std::vector with [] is not bound checked. Segfaults were caused because the upper bound of the argument was never checked and garbage was returned... Do consistent checks, or use .at() as it throws an exception
19
-
20 15
 ## Cmake
21 16
 
22 17
 * Support SSE with other compilers than Clang (src/CMakeLists.txt)

+ 30
- 0
include/utils/binary.h View File

@@ -0,0 +1,30 @@
1
+/*!
2
+ * \file include/utils/binary.h
3
+ * \brief Binary file reading utilities
4
+ *
5
+ * \author xythobuz
6
+ */
7
+
8
+#ifndef _UTILS_BINARY_H_
9
+#define _UTILS_BINARY_H_
10
+
11
+void binOpen(const char *file);
12
+void binClose();
13
+
14
+unsigned long binTell();
15
+void binSeek(unsigned long pos);
16
+
17
+int8_t binRead8();
18
+uint8_t binReadU8();
19
+
20
+int16_t binRead16();
21
+uint16_t binReadU16();
22
+
23
+int32_t binRead32();
24
+uint32_t binReadU32();
25
+
26
+int64_t binRead64();
27
+uint64_t binReadU64();
28
+
29
+#endif
30
+

+ 1
- 1
src/Menu.cpp View File

@@ -31,7 +31,7 @@ Menu::Menu() {
31 31
     mCursor = 0;
32 32
     mMin = 0;
33 33
 
34
-    mainText.text = bufferString(VERSION);
34
+    mainText.text = bufferString("%s", VERSION);
35 35
     mainText.color[0] = BLUE[0];
36 36
     mainText.color[1] = BLUE[1];
37 37
     mainText.color[2] = BLUE[2];

+ 2
- 2
src/TombRaider.cpp View File

@@ -3334,7 +3334,7 @@ void TombRaider::getRoomTriangle(unsigned int roomIndex,
3334 3334
                 {
3335 3335
                     k = triangleIndex - count;
3336 3336
 
3337
-                    *texture = *flags = 0; // FIXME
3337
+                    *texture = *flags = 0; //! \fixme
3338 3338
 
3339 3339
                     // Setup per vertex
3340 3340
                     for (j = 0; j < 3; ++j)
@@ -3342,7 +3342,7 @@ void TombRaider::getRoomTriangle(unsigned int roomIndex,
3342 3342
                         // Get vertex index {(0, a), (1, b), (2, c) }
3343 3343
                         indices[j] = mRoomsTR5[roomIndex].faces[i].tris[k].vertices[j];
3344 3344
 
3345
-                        // FIXME
3345
+                        //! \fixme
3346 3346
                         //tIndex = mRoomsTR5[roomIndex].faces[i].vertices[j].texture & 0xff;
3347 3347
                         //computeUV(objectTexturesTR5[tIndex].vertices + i,
3348 3348
                         //          texCoords+i*2, texCoords+i*2+1);

+ 1
- 0
src/utils/CMakeLists.txt View File

@@ -1,4 +1,5 @@
1 1
 # Source files
2
+set (UTIL_SRCS ${UTIL_SRCS} "binary.cpp")
2 3
 set (UTIL_SRCS ${UTIL_SRCS} "pcx.cpp")
3 4
 set (UTIL_SRCS ${UTIL_SRCS} "pixel.cpp")
4 5
 set (UTIL_SRCS ${UTIL_SRCS} "strings.cpp")

+ 58
- 0
src/utils/binary.cpp View File

@@ -0,0 +1,58 @@
1
+/*!
2
+ * \file src/utils/binary.cpp
3
+ * \brief Binary file reading utilities
4
+ *
5
+ * \author xythobuz
6
+ */
7
+
8
+#include "global.h"
9
+#include "utils/binary.h"
10
+
11
+void binOpen(const char *file) {
12
+
13
+}
14
+
15
+void binClose() {
16
+
17
+}
18
+
19
+unsigned long binTell() {
20
+    return 0;
21
+}
22
+
23
+void binSeek(unsigned long pos) {
24
+
25
+}
26
+
27
+int8_t binRead8() {
28
+    return 0;
29
+}
30
+
31
+uint8_t binReadU8() {
32
+    return 0;
33
+}
34
+
35
+int16_t binRead16() {
36
+    return 0;
37
+}
38
+
39
+uint16_t binReadU16() {
40
+    return 0;
41
+}
42
+
43
+int32_t binRead32() {
44
+    return 0;
45
+}
46
+
47
+uint32_t binReadU32() {
48
+    return 0;
49
+}
50
+
51
+int64_t binRead64() {
52
+    return 0;
53
+}
54
+
55
+uint64_t binReadU64() {
56
+    return 0;
57
+}
58
+

Loading…
Cancel
Save