Przeglądaj źródła

Auto code indentation [skip ci]

Thomas Buck 10 lat temu
rodzic
commit
e83305bc8e
100 zmienionych plików z 2215 dodań i 2783 usunięć
  1. 11
    0
      CMakeLists.txt
  2. 3
    0
      ChangeLog.md
  3. 3
    3
      include/Camera.h
  4. 2
    2
      include/Console.h
  5. 6
    6
      include/Entity.h
  6. 4
    4
      include/Exception.h
  7. 5
    5
      include/Font.h
  8. 3
    3
      include/FontImGui.h
  9. 5
    5
      include/FontSDL.h
  10. 5
    5
      include/FontTRLE.h
  11. 5
    5
      include/Game.h
  12. 3
    3
      include/Log.h
  13. 6
    6
      include/Menu.h
  14. 5
    5
      include/MenuFolder.h
  15. 31
    31
      include/Mesh.h
  16. 8
    8
      include/Render.h
  17. 20
    20
      include/Room.h
  18. 19
    19
      include/RoomData.h
  19. 3
    3
      include/RunTime.h
  20. 5
    5
      include/Script.h
  21. 20
    18
      include/SkeletalModel.h
  22. 5
    4
      include/Sound.h
  23. 5
    4
      include/SoundAL.h
  24. 5
    4
      include/SoundNull.h
  25. 9
    9
      include/Sprite.h
  26. 10
    10
      include/StaticMesh.h
  27. 14
    14
      include/TextureManager.h
  28. 127
    126
      include/TombRaider.h
  29. 115
    114
      include/TombRaiderData.h
  30. 3
    3
      include/UI.h
  31. 2
    2
      include/ViewVolume.h
  32. 5
    5
      include/Window.h
  33. 2
    2
      include/WindowGLUT.h
  34. 3
    3
      include/WindowSDL.h
  35. 13
    13
      include/World.h
  36. 2
    2
      include/commands/Command.h
  37. 1
    1
      include/commands/CommandAnimate.h
  38. 2
    2
      include/commands/CommandBind.h
  39. 3
    3
      include/commands/CommandEngine.h
  40. 4
    4
      include/commands/CommandGame.h
  41. 1
    1
      include/commands/CommandMove.h
  42. 3
    3
      include/commands/CommandRender.h
  43. 1
    1
      include/commands/CommandSet.h
  44. 1
    1
      include/commands/CommandSound.h
  45. 1
    1
      include/games/TombRaider1.h
  46. 8
    6
      include/global.h
  47. 2
    2
      include/loader/Loader.h
  48. 2
    2
      include/loader/LoaderTR1.h
  49. 2
    2
      include/loader/LoaderTR2.h
  50. 2
    2
      include/loader/LoaderTR3.h
  51. 8
    8
      include/math/Matrix.h
  52. 7
    7
      include/math/Quaternion.h
  53. 11
    11
      include/math/Vector3d.h
  54. 4
    4
      include/utils/File.h
  55. 10
    10
      include/utils/Folder.h
  56. 3
    3
      include/utils/binary.h
  57. 3
    3
      include/utils/pcx.h
  58. 7
    6
      include/utils/pixel.h
  59. 5
    5
      include/utils/png.h
  60. 5
    5
      include/utils/tga.h
  61. 1
    1
      src/Console.cpp
  62. 15
    15
      src/Entity.cpp
  63. 2
    2
      src/Exception.cpp
  64. 3
    3
      src/Font.cpp
  65. 6
    4
      src/FontImGui.cpp
  66. 9
    7
      src/FontSDL.cpp
  67. 5
    5
      src/FontTRLE.cpp
  68. 22
    29
      src/Game.cpp
  69. 7
    7
      src/Menu.cpp
  70. 12
    11
      src/MenuFolder.cpp
  71. 82
    142
      src/Mesh.cpp
  72. 50
    85
      src/Render.cpp
  73. 87
    128
      src/Room.cpp
  74. 15
    16
      src/RoomData.cpp
  75. 9
    8
      src/Script.cpp
  76. 30
    28
      src/SkeletalModel.cpp
  77. 7
    6
      src/SoundAL.cpp
  78. 3
    2
      src/SoundNull.cpp
  79. 17
    17
      src/Sprite.cpp
  80. 30
    29
      src/StaticMesh.cpp
  81. 20
    20
      src/TextureManager.cpp
  82. 916
    1384
      src/TombRaider.cpp
  83. 14
    14
      src/UI.cpp
  84. 32
    32
      src/ViewVolume.cpp
  85. 9
    9
      src/Window.cpp
  86. 2
    2
      src/WindowGLUT.cpp
  87. 2
    2
      src/WindowSDL.cpp
  88. 12
    13
      src/World.cpp
  89. 3
    3
      src/commands/Command.cpp
  90. 6
    7
      src/commands/CommandAnimate.cpp
  91. 2
    2
      src/commands/CommandSet.cpp
  92. 3
    3
      src/loader/LoaderTR2.cpp
  93. 13
    13
      src/main.cpp
  94. 109
    100
      src/math/Matrix.cpp
  95. 28
    28
      src/math/Quaternion.cpp
  96. 26
    26
      src/math/Vector3d.cpp
  97. 1
    1
      src/math/math.cpp
  98. 2
    2
      src/utils/File.cpp
  99. 15
    13
      src/utils/Folder.cpp
  100. 0
    0
      src/utils/FolderRecursive.cpp

+ 11
- 0
CMakeLists.txt Wyświetl plik

@@ -160,5 +160,16 @@ if (${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
160 160
         # Clean doc files
161 161
         set_directory_properties (PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "doc")
162 162
     endif (DOXYGEN_FOUND)
163
+
164
+    #################################################################
165
+
166
+    # Auto-format code
167
+    add_custom_target (format
168
+        COMMAND astyle -A14s4pHUk1OocxC100z2SKNLm1Qxynr "include/*.h"
169
+        COMMAND astyle -A14s4pHUk1OocxC100z2SKNLm1Qxynr "src/*.cpp" --exclude=src/deps
170
+        COMMAND astyle -A14s4pHUk1OocxC100z2SKNLm1Qxynr "test/*.cpp" "test/*.h"
171
+        WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
172
+        COMMENT "Auto-Formatting code..." VERBATIM
173
+    )
163 174
 endif (${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
164 175
 

+ 3
- 0
ChangeLog.md Wyświetl plik

@@ -2,6 +2,9 @@
2 2
 
3 3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
4 4
 
5
+    [ 20141018 ]
6
+    * Added target to auto-indent code using astyle and used it.
7
+
5 8
     [ 20141016 ]
6 9
     * ImGuis Font can now be used if no other is available
7 10
     * Added [Binspector](https://github.com/binspector/binspector) binary file format template

+ 3
- 3
include/Camera.h Wyświetl plik

@@ -25,7 +25,7 @@ enum camera_command {
25 25
  * \brief Camera class
26 26
  */
27 27
 class Camera {
28
-public:
28
+  public:
29 29
     /*!
30 30
      * \brief Constructs an object of Camera
31 31
      */
@@ -70,7 +70,7 @@ public:
70 70
      */
71 71
     void command(enum camera_command cmd);
72 72
 
73
-private:
73
+  private:
74 74
 
75 75
     void rotate(float angle, float x, float y, float z);
76 76
 
@@ -84,6 +84,6 @@ private:
84 84
     float mRotationDeltaY; //!< Vertical mouse sensitivity
85 85
 };
86 86
 
87
-Camera &getCamera();
87
+Camera& getCamera();
88 88
 
89 89
 #endif

+ 2
- 2
include/Console.h Wyświetl plik

@@ -12,10 +12,10 @@
12 12
 #include <vector>
13 13
 
14 14
 class Console {
15
-public:
15
+  public:
16 16
     static void display();
17 17
 
18
-private:
18
+  private:
19 19
     const static int bufferLength = 256;
20 20
     static char buffer[bufferLength + 1];
21 21
     static bool scrollToBottom;

+ 6
- 6
include/Entity.h Wyświetl plik

@@ -12,7 +12,7 @@
12 12
 #include "TombRaider.h"
13 13
 
14 14
 class Entity {
15
-public:
15
+  public:
16 16
     typedef enum {
17 17
         MoveTypeWalkNoSwim = -1,
18 18
         MoveTypeWalk       = 0,
@@ -21,15 +21,15 @@ public:
21 21
         MoveTypeSwim       = 3
22 22
     } MoveType;
23 23
 
24
-    Entity(TombRaider &tr, unsigned int index, unsigned int i, unsigned int model);
24
+    Entity(TombRaider& tr, unsigned int index, unsigned int i, unsigned int model);
25 25
 
26
-    bool operator<(Entity &o);
27
-    static bool compare(Entity *a, Entity *b);
26
+    bool operator<(Entity& o);
27
+    static bool compare(Entity* a, Entity* b);
28 28
     void display();
29 29
     void move(char movement);
30 30
     void print();
31 31
 
32
-    SkeletalModel &getModel();
32
+    SkeletalModel& getModel();
33 33
     void setSkeletalModel(unsigned int model);
34 34
     MoveType getMoveType();
35 35
     void setMoveType(MoveType m);
@@ -47,7 +47,7 @@ public:
47 47
     unsigned long getIdleAnimation();
48 48
     void setIdleAnimation(unsigned long index);
49 49
 
50
-private:
50
+  private:
51 51
     float pos[3];
52 52
     float angles[3];
53 53
     long room;

+ 4
- 4
include/Exception.h Wyświetl plik

@@ -13,13 +13,13 @@
13 13
 #include <string>
14 14
 
15 15
 class Exception : std::runtime_error {
16
-public:
17
-    Exception(const char *what);
18
-    Exception(const std::string &what);
16
+  public:
17
+    Exception(const char* what);
18
+    Exception(const std::string& what);
19 19
 
20 20
     static std::string getLastException();
21 21
 
22
-private:
22
+  private:
23 23
     static std::string lastException;
24 24
 
25 25
     virtual void foo(); //!< We don't want to emit a vtable in every translation unit

+ 5
- 5
include/Font.h Wyświetl plik

@@ -14,7 +14,7 @@
14 14
  * \brief Font interface
15 15
  */
16 16
 class Font {
17
-public:
17
+  public:
18 18
     static void shutdown();
19 19
 
20 20
     static int initialize(std::string font = "");
@@ -24,15 +24,15 @@ public:
24 24
     static unsigned int heightText(float scale, unsigned int maxWidth, std::string s);
25 25
 
26 26
     static void drawText(unsigned int x, unsigned int y, float scale,
27
-            const unsigned char color[4], std::string s);
27
+                         const unsigned char color[4], std::string s);
28 28
 
29 29
     static void drawTextWrapped(unsigned int x, unsigned int y, float scale,
30
-            const unsigned char color[4], unsigned int maxWidth, std::string s);
30
+                                const unsigned char color[4], unsigned int maxWidth, std::string s);
31 31
 
32 32
     static void drawTextCentered(unsigned int x, unsigned int y, float scale,
33
-            const unsigned char color[4], unsigned int width, std::string s);
33
+                                 const unsigned char color[4], unsigned int width, std::string s);
34 34
 
35
-private:
35
+  private:
36 36
     static bool isInit;
37 37
     static std::string fontName;
38 38
 };

+ 3
- 3
include/FontImGui.h Wyświetl plik

@@ -12,16 +12,16 @@
12 12
  * \brief Default Font implementation
13 13
  */
14 14
 class FontImGui {
15
-public:
15
+  public:
16 16
     static unsigned int widthText(float scale, std::string s);
17 17
 
18 18
     static unsigned int heightText(float scale, unsigned int maxWidth, std::string s);
19 19
 
20 20
     static void drawText(unsigned int x, unsigned int y, float scale,
21
-            const unsigned char color[4], std::string s);
21
+                         const unsigned char color[4], std::string s);
22 22
 
23 23
     static void drawTextWrapped(unsigned int x, unsigned int y, float scale,
24
-            const unsigned char color[4], unsigned int maxWidth, std::string s);
24
+                                const unsigned char color[4], unsigned int maxWidth, std::string s);
25 25
 };
26 26
 
27 27
 #endif

+ 5
- 5
include/FontSDL.h Wyświetl plik

@@ -14,7 +14,7 @@
14 14
  * \brief SDL Font implementation
15 15
  */
16 16
 class FontSDL {
17
-public:
17
+  public:
18 18
     static void shutdown();
19 19
 
20 20
     static int initialize(std::string font);
@@ -24,14 +24,14 @@ public:
24 24
     static unsigned int heightText(float scale, unsigned int maxWidth, std::string s);
25 25
 
26 26
     static void drawText(unsigned int x, unsigned int y, float scale,
27
-            const unsigned char color[4], std::string s);
27
+                         const unsigned char color[4], std::string s);
28 28
 
29 29
     static void drawTextWrapped(unsigned int x, unsigned int y, float scale,
30
-            const unsigned char color[4], unsigned int maxWidth, std::string s);
30
+                                const unsigned char color[4], unsigned int maxWidth, std::string s);
31 31
 
32
-private:
32
+  private:
33 33
     static bool mFontInit;
34
-    static TTF_Font *mFont;
34
+    static TTF_Font* mFont;
35 35
     static unsigned int mFontTexture;
36 36
 };
37 37
 

+ 5
- 5
include/FontTRLE.h Wyświetl plik

@@ -12,7 +12,7 @@
12 12
  * \brief Tomb Raider Level Editor Font loader
13 13
  */
14 14
 class FontTRLE {
15
-public:
15
+  public:
16 16
     static void shutdown();
17 17
 
18 18
     static int initialize(std::string font);
@@ -22,16 +22,16 @@ public:
22 22
     static unsigned int heightText(float scale, unsigned int maxWidth, std::string s);
23 23
 
24 24
     static void drawText(unsigned int x, unsigned int y, float scale,
25
-            const unsigned char color[4], std::string s);
25
+                         const unsigned char color[4], std::string s);
26 26
 
27 27
     static void drawTextWrapped(unsigned int x, unsigned int y, float scale,
28
-            const unsigned char color[4], unsigned int maxWidth, std::string s);
28
+                                const unsigned char color[4], unsigned int maxWidth, std::string s);
29 29
 
30
-private:
30
+  private:
31 31
     static void setDefaultOffsets();
32 32
     static void loadLPS(std::string f);
33 33
     static void writeChar(unsigned int index, unsigned int xDraw, unsigned int yDraw,
34
-            float scale, const unsigned char color[4]);
34
+                          float scale, const unsigned char color[4]);
35 35
 
36 36
     static bool mFontInit;
37 37
     static unsigned int mFontTexture;

+ 5
- 5
include/Game.h Wyświetl plik

@@ -15,7 +15,7 @@
15 15
 #include "TombRaider.h"
16 16
 
17 17
 class Game {
18
-public:
18
+  public:
19 19
 
20 20
     Game();
21 21
     ~Game();
@@ -24,7 +24,7 @@ public:
24 24
 
25 25
     bool isLoaded();
26 26
 
27
-    int loadLevel(const char *level);
27
+    int loadLevel(const char* level);
28 28
 
29 29
     void destroy();
30 30
 
@@ -35,9 +35,9 @@ public:
35 35
     unsigned int getTextureStart();
36 36
     unsigned int getTextureOffset();
37 37
 
38
-    Entity &getLara();
38
+    Entity& getLara();
39 39
 
40
-private:
40
+  private:
41 41
 
42 42
     void processPakSounds();
43 43
     void processTextures();
@@ -58,6 +58,6 @@ private:
58 58
     long mLara;
59 59
 };
60 60
 
61
-Game &getGame();
61
+Game& getGame();
62 62
 
63 63
 #endif

+ 3
- 3
include/Log.h Wyświetl plik

@@ -13,7 +13,7 @@
13 13
 #include <vector>
14 14
 
15 15
 class Log {
16
-public:
16
+  public:
17 17
 
18 18
     const static char endl = '\n';
19 19
 
@@ -35,12 +35,12 @@ public:
35 35
         return (*this);
36 36
     }
37 37
 
38
-private:
38
+  private:
39 39
     std::vector<std::string> mHistory;
40 40
     std::ostringstream printBuffer;
41 41
 };
42 42
 
43
-Log &getLog();
43
+Log& getLog();
44 44
 
45 45
 #endif
46 46
 

+ 6
- 6
include/Menu.h Wyświetl plik

@@ -11,7 +11,7 @@
11 11
 #include <functional>
12 12
 
13 13
 class Menu {
14
-public:
14
+  public:
15 15
 
16 16
     virtual ~Menu() { }
17 17
 
@@ -22,7 +22,7 @@ public:
22 22
     virtual void handleKeyboard(KeyboardButton key, bool pressed) = 0;
23 23
 
24 24
     virtual void handleMouseClick(unsigned int x, unsigned int y,
25
-            KeyboardButton button, bool released) = 0;
25
+                                  KeyboardButton button, bool released) = 0;
26 26
 
27 27
     virtual void handleMouseScroll(int xrel, int yrel) = 0;
28 28
 
@@ -30,17 +30,17 @@ public:
30 30
 
31 31
     void setVisible(bool v) { visible = v; }
32 32
 
33
-protected:
33
+  protected:
34 34
 
35 35
     virtual void showDialog(std::string msg, std::string btn1, std::string btn2,
36
-            std::function<int (bool state)> callback = std::function<int (bool)>());
36
+                            std::function<int (bool state)> callback = std::function<int (bool)>());
37 37
 
38 38
     virtual void ackDialog();
39 39
 
40 40
     virtual bool handleKeyboardDialog(KeyboardButton key, bool pressed);
41 41
 
42 42
     virtual bool handleMouseClickDialog(unsigned int x, unsigned int y,
43
-            KeyboardButton button, bool released);
43
+                                        KeyboardButton button, bool released);
44 44
 
45 45
     virtual bool handleMouseScrollDialog(int xrel, int yrel);
46 46
 
@@ -55,7 +55,7 @@ protected:
55 55
     bool visible;
56 56
 };
57 57
 
58
-Menu &getMenu();
58
+Menu& getMenu();
59 59
 
60 60
 #endif
61 61
 

+ 5
- 5
include/MenuFolder.h Wyświetl plik

@@ -15,7 +15,7 @@
15 15
  * \brief Menu 'overlay'
16 16
  */
17 17
 class MenuFolder : public Menu {
18
-public:
18
+  public:
19 19
 
20 20
     /*!
21 21
      * \brief Constructs an object of MenuFolder
@@ -32,19 +32,19 @@ public:
32 32
     virtual void display();
33 33
     virtual void handleKeyboard(KeyboardButton key, bool pressed);
34 34
     virtual void handleMouseClick(unsigned int x, unsigned int y,
35
-            KeyboardButton button, bool released);
35
+                                  KeyboardButton button, bool released);
36 36
     virtual void handleMouseScroll(int xrel, int yrel);
37 37
 
38
-private:
38
+  private:
39 39
 
40 40
     int init(std::string s);
41
-    int init(Folder *folder, bool filter = true);
41
+    int init(Folder* folder, bool filter = true);
42 42
     virtual void loadOrOpen();
43 43
 
44 44
     long mCursor;
45 45
     long mMin;
46 46
 
47
-    Folder *mapFolder;
47
+    Folder* mapFolder;
48 48
     bool hiddenState;
49 49
 };
50 50
 

+ 31
- 31
include/Mesh.h Wyświetl plik

@@ -14,7 +14,7 @@
14 14
  * \brief OpenGL Mesh
15 15
  */
16 16
 class Mesh {
17
-public:
17
+  public:
18 18
 
19 19
     typedef enum {
20 20
         MeshModeSolid,
@@ -37,18 +37,18 @@ public:
37 37
         unsigned int cnum_alpha_triangles;
38 38
 
39 39
         unsigned int num_texcoors;
40
-        float **texcoors; // 2D
40
+        float** texcoors; // 2D
41 41
 
42 42
         unsigned int num_texcoors2;
43
-        float **texcoors2; // 2D
43
+        float** texcoors2; // 2D
44 44
 
45 45
         //! Arrays of triangle indices sorted by texture
46 46
         unsigned int num_triangles;
47
-        unsigned int *triangles; //!< ABCABCABC...
47
+        unsigned int* triangles; //!< ABCABCABC...
48 48
 
49 49
         //! Arrays of alpha triangle indices sorted by texture
50 50
         unsigned int num_alpha_triangles;
51
-        unsigned int *alpha_triangles; //!< ABCABCABC...
51
+        unsigned int* alpha_triangles; //!< ABCABCABC...
52 52
     } tris_t;
53 53
 
54 54
     typedef struct {
@@ -62,18 +62,18 @@ public:
62 62
         unsigned int cnum_alpha_quads;
63 63
 
64 64
         unsigned int num_texcoors;
65
-        float **texcoors; // 2D
65
+        float** texcoors; // 2D
66 66
 
67 67
         unsigned int num_texcoors2;
68
-        float **texcoors2; // 2D
68
+        float** texcoors2; // 2D
69 69
 
70 70
         //! Arrays of rectangle indices sorted by texture
71 71
         unsigned int num_quads;
72
-        unsigned int *quads; //!< ABCDABCDABCD...
72
+        unsigned int* quads; //!< ABCDABCDABCD...
73 73
 
74 74
         //! Arrays of alpha rectangle indices sorted by texture
75 75
         unsigned int num_alpha_quads;
76
-        unsigned int *alpha_quads; //!< ABCDABCDABCD...
76
+        unsigned int* alpha_quads; //!< ABCDABCDABCD...
77 77
 
78 78
     } rect_t;
79 79
 
@@ -101,15 +101,15 @@ public:
101 101
 
102 102
     void allocateVertices(unsigned int n);
103 103
 
104
-    void bufferColorArray(unsigned int colorCount, float *colors);
104
+    void bufferColorArray(unsigned int colorCount, float* colors);
105 105
 
106
-    void bufferNormalArray(unsigned int normalCount, float *normals);
106
+    void bufferNormalArray(unsigned int normalCount, float* normals);
107 107
 
108 108
     void bufferTriangles(unsigned int count,
109
-                            unsigned int *indices, float *texCoords,
110
-                            int *textures, unsigned int *flags);
109
+                         unsigned int* indices, float* texCoords,
110
+                         int* textures, unsigned int* flags);
111 111
 
112
-    void bufferVertexArray(unsigned int vertexCount, float *vertices);
112
+    void bufferVertexArray(unsigned int vertexCount, float* vertices);
113 113
 
114 114
     void setColor(unsigned int index, float r, float g, float b, float a);
115 115
 
@@ -123,13 +123,13 @@ public:
123 123
     void sortFacesByTexture();
124 124
 
125 125
     void addFace(int textureIndex, int textureIndexB, unsigned int flags,
126
-                    unsigned int vertexIndexCount, float *vertexIndices);
126
+                 unsigned int vertexIndexCount, float* vertexIndices);
127 127
 
128 128
     void addTexTiledFace(int textureIndex, int textureIndexB,
129
-                            unsigned int flags, unsigned int indexCount,
130
-                            float *vertexIndices, float *texcoords);
129
+                         unsigned int flags, unsigned int indexCount,
130
+                         float* vertexIndices, float* texcoords);
131 131
 
132
-    void bufferTexcoords(unsigned int texcoordCount, float *texcoords);
132
+    void bufferTexcoords(unsigned int texcoordCount, float* texcoords);
133 133
 
134 134
     void duplicateArraysForTexTiledTexcoords();
135 135
 #endif
@@ -139,29 +139,29 @@ public:
139 139
     MeshMode mMode;
140 140
 
141 141
     unsigned int mNumVertices;
142
-    float **mVertices; //!< XYZ
142
+    float** mVertices; //!< XYZ
143 143
 
144 144
     unsigned int mNumNormals;
145
-    float **mNormals; //!< IJK
145
+    float** mNormals; //!< IJK
146 146
 
147 147
     unsigned int mNumColors;
148
-    float **mColors; //!< RGBA
148
+    float** mColors; //!< RGBA
149 149
 
150 150
     unsigned int mNumTris;
151
-    tris_t *mTris;
151
+    tris_t* mTris;
152 152
 
153 153
     unsigned int mNumQuads;
154
-    rect_t *mQuads;
154
+    rect_t* mQuads;
155 155
 
156 156
     unsigned int mTriangleCount;
157
-    int *mTriangleTextures;
158
-    unsigned int *mTriangleIndices;
159
-    unsigned int *mTriangleFlags;
160
-    float *mTriangleTexCoordArray;
161
-
162
-    float *mVertexArray;
163
-    float *mNormalArray;
164
-    float *mColorArray;
157
+    int* mTriangleTextures;
158
+    unsigned int* mTriangleIndices;
159
+    unsigned int* mTriangleFlags;
160
+    float* mTriangleTexCoordArray;
161
+
162
+    float* mVertexArray;
163
+    float* mNormalArray;
164
+    float* mColorArray;
165 165
 };
166 166
 
167 167
 #endif

+ 8
- 8
include/Render.h Wyświetl plik

@@ -18,7 +18,7 @@
18 18
  * \brief OpenRaider Renderer class
19 19
  */
20 20
 class Render {
21
-public:
21
+  public:
22 22
 
23 23
     typedef enum {
24 24
         modeDisabled,
@@ -53,7 +53,7 @@ public:
53 53
      * \brief Makes a screenshot, writes to disk
54 54
      * \param filenameBase basename of file to be written
55 55
      */
56
-    void screenShot(const char *filenameBase);
56
+    void screenShot(const char* filenameBase);
57 57
 
58 58
     /*!
59 59
      * \brief Gets current rendering mode
@@ -111,14 +111,14 @@ public:
111 111
      */
112 112
     bool isVisible(float x, float y, float z, float radius);
113 113
 
114
-    bool isVisible(BoundingBox &box);
114
+    bool isVisible(BoundingBox& box);
115 115
 
116 116
     //! \fixme should be private
117 117
     ViewVolume mViewVolume; //!< View Volume for frustum culling
118 118
 
119
-private:
119
+  private:
120 120
 
121
-    static void lightRoom(Room &room);
121
+    static void lightRoom(Room& room);
122 122
 
123 123
     void drawLoadScreen();
124 124
 
@@ -133,7 +133,7 @@ private:
133 133
      * only considers its linked rooms and their linked rooms.
134 134
      * \param room First room in list
135 135
      */
136
-    void buildRoomRenderList(Room &room);
136
+    void buildRoomRenderList(Room& room);
137 137
 
138 138
     /*!
139 139
      * \brief Renders Sky domes/boxes/etc by scaling factor.
@@ -148,7 +148,7 @@ private:
148 148
      */
149 149
     void updateViewVolume();
150 150
 
151
-    std::vector<Room *> mRoomRenderList;
151
+    std::vector<Room*> mRoomRenderList;
152 152
 
153 153
     unsigned int mFlags;                  //!< Rendering flags
154 154
     unsigned int mMode;                   //!< Rendering mode
@@ -157,6 +157,6 @@ private:
157 157
     bool mSkyMeshRotation;                //!< Should Skymesh be rotated?
158 158
 };
159 159
 
160
-Render &getRender();
160
+Render& getRender();
161 161
 
162 162
 #endif

+ 20
- 20
include/Room.h Wyświetl plik

@@ -19,20 +19,20 @@ typedef enum {
19 19
 } RoomFlags;
20 20
 
21 21
 class Room {
22
-public:
23
-    Room(TombRaider &tr, unsigned int index);
22
+  public:
23
+    Room(TombRaider& tr, unsigned int index);
24 24
     ~Room();
25 25
 
26
-    BoundingBox &getBoundingBox();
27
-    Mesh &getMesh();
26
+    BoundingBox& getBoundingBox();
27
+    Mesh& getMesh();
28 28
     void display(bool alpha);
29 29
 
30 30
     bool isWall(unsigned long sector);
31
-    long getSector(float x, float z, float *floor, float *ceiling);
31
+    long getSector(float x, float z, float* floor, float* ceiling);
32 32
     long getSector(float x, float z);
33
-    void getHeightAtPosition(float x, float *y, float z);
33
+    void getHeightAtPosition(float x, float* y, float z);
34 34
     int getAdjoiningRoom(float x, float y, float z,
35
-        float x2, float y2, float z2);
35
+                         float x2, float y2, float z2);
36 36
 
37 37
     unsigned int getNumXSectors();
38 38
     unsigned int getNumZSectors();
@@ -45,24 +45,24 @@ public:
45 45
     long getAdjacentRoom(unsigned long index);
46 46
 
47 47
     unsigned long sizePortals();
48
-    Portal &getPortal(unsigned long index);
48
+    Portal& getPortal(unsigned long index);
49 49
 
50 50
     unsigned long sizeSectors();
51
-    Sector &getSector(unsigned long index);
51
+    Sector& getSector(unsigned long index);
52 52
 
53 53
     unsigned long sizeBox();
54
-    Box &getBox(unsigned long index);
54
+    Box& getBox(unsigned long index);
55 55
 
56 56
     unsigned long sizeModels();
57
-    StaticModel &getModel(unsigned long index);
57
+    StaticModel& getModel(unsigned long index);
58 58
 
59 59
     unsigned long sizeLights();
60
-    Light &getLight(unsigned long index);
60
+    Light& getLight(unsigned long index);
61 61
 
62 62
     unsigned long sizeSprites();
63
-    Sprite &getSprite(unsigned long index);
63
+    Sprite& getSprite(unsigned long index);
64 64
 
65
-private:
65
+  private:
66 66
     void sortModels();
67 67
 
68 68
     unsigned int flags;
@@ -74,12 +74,12 @@ private:
74 74
     Mesh mesh;
75 75
 
76 76
     std::vector<long> adjacentRooms;
77
-    std::vector<Sprite *> sprites;
78
-    std::vector<StaticModel *> models;
79
-    std::vector<Portal *> portals;
80
-    std::vector<Box *> boxes;
81
-    std::vector<Sector *> sectors;
82
-    std::vector<Light *> lights;
77
+    std::vector<Sprite*> sprites;
78
+    std::vector<StaticModel*> models;
79
+    std::vector<Portal*> portals;
80
+    std::vector<Box*> boxes;
81
+    std::vector<Sector*> sectors;
82
+    std::vector<Light*> lights;
83 83
 
84 84
     // Was used for "depth sorting" render list, but never assigned...?!
85 85
     //float dist; // Distance to near plane, move to room?

+ 19
- 19
include/RoomData.h Wyświetl plik

@@ -14,7 +14,7 @@
14 14
 #include "TombRaider.h"
15 15
 
16 16
 class BoundingBox {
17
-public:
17
+  public:
18 18
     BoundingBox();
19 19
     void getBoundingBox(float box[2][3]);
20 20
     void setBoundingBox(float min[3], float max[3]);
@@ -22,12 +22,12 @@ public:
22 22
     bool inBox(float x, float y, float z);
23 23
     bool inBoxPlane(float x, float z);
24 24
 
25
-private:
25
+  private:
26 26
     float a[3], b[3];
27 27
 };
28 28
 
29 29
 class Light {
30
-public:
30
+  public:
31 31
     /*!
32 32
      * \brief Type a light can be of
33 33
      */
@@ -37,7 +37,7 @@ public:
37 37
         typeDirectional = 3  //!< Directional light
38 38
     } LightType;
39 39
 
40
-    Light(TombRaider &tr, unsigned int room, unsigned int index);
40
+    Light(TombRaider& tr, unsigned int room, unsigned int index);
41 41
 
42 42
     void getPos(float p[4]);
43 43
     void getDir(float d[3]);
@@ -46,7 +46,7 @@ public:
46 46
     float getCutoff();
47 47
     LightType getType();
48 48
 
49
-private:
49
+  private:
50 50
     float pos[4]; //! Light position in 3 space
51 51
     float dir[3]; //! Light direction
52 52
     float att;
@@ -56,15 +56,15 @@ private:
56 56
 };
57 57
 
58 58
 class StaticModel {
59
-public:
60
-    StaticModel(TombRaider &tr, unsigned int room, unsigned int i);
59
+  public:
60
+    StaticModel(TombRaider& tr, unsigned int room, unsigned int i);
61 61
     void display();
62 62
 
63 63
     // Compares distance to ViewVolume for depth sorting
64
-    bool operator<(const StaticModel &other);
65
-    static bool compare(StaticModel *a, StaticModel *b);
64
+    bool operator<(const StaticModel& other);
65
+    static bool compare(StaticModel* a, StaticModel* b);
66 66
 
67
-private:
67
+  private:
68 68
     int index;
69 69
     float yaw;
70 70
     float pos[3];
@@ -74,34 +74,34 @@ private:
74 74
 };
75 75
 
76 76
 class Portal {
77
-public:
78
-    Portal(TombRaider &tr, unsigned int room, unsigned int index, Matrix &transform);
77
+  public:
78
+    Portal(TombRaider& tr, unsigned int room, unsigned int index, Matrix& transform);
79 79
 
80 80
     void getVertices(float vert[4][3]);
81 81
     int getAdjoiningRoom();
82 82
 
83
-private:
83
+  private:
84 84
     float vertices[4][3];
85 85
     float normal[3];
86 86
     int adjoiningRoom;
87 87
 };
88 88
 
89 89
 class Box {
90
-public:
91
-    Box(TombRaider &tr, unsigned int room, unsigned int index);
90
+  public:
91
+    Box(TombRaider& tr, unsigned int room, unsigned int index);
92 92
 
93
-private:
93
+  private:
94 94
     float a[3], b[3], c[3], d[3];
95 95
 };
96 96
 
97 97
 class Sector {
98
-public:
99
-    Sector(TombRaider &tr, unsigned int room, unsigned int index);
98
+  public:
99
+    Sector(TombRaider& tr, unsigned int room, unsigned int index);
100 100
     float getFloor();
101 101
     float getCeiling();
102 102
     bool isWall();
103 103
 
104
-private:
104
+  private:
105 105
     float floor;
106 106
     float ceiling;
107 107
     bool wall;

+ 3
- 3
include/RunTime.h Wyświetl plik

@@ -14,7 +14,7 @@
14 14
  * \brief Main Game Singleton
15 15
  */
16 16
 class RunTime {
17
-public:
17
+  public:
18 18
 
19 19
     RunTime();
20 20
 
@@ -36,7 +36,7 @@ public:
36 36
     bool getFPS();
37 37
     void setFPS(bool fps);
38 38
 
39
-private:
39
+  private:
40 40
     std::string baseDir;
41 41
     std::string pakDir;
42 42
     std::string audioDir;
@@ -47,7 +47,7 @@ private:
47 47
     bool showFPS;
48 48
 };
49 49
 
50
-RunTime &getRunTime();
50
+RunTime& getRunTime();
51 51
 
52 52
 #endif
53 53
 

+ 5
- 5
include/Script.h Wyświetl plik

@@ -19,7 +19,7 @@
19 19
  * \brief Game script loader
20 20
  */
21 21
 class Script {
22
-public:
22
+  public:
23 23
 
24 24
     typedef enum {
25 25
         S_English  = 0,
@@ -93,7 +93,7 @@ public:
93 93
     Script();
94 94
     ~Script();
95 95
 
96
-    int load(const char *file);
96
+    int load(const char* file);
97 97
 
98 98
     unsigned int levelCount();
99 99
     std::string getLevelName(unsigned int i);
@@ -124,7 +124,7 @@ public:
124 124
     void registerScriptHandler(ScriptOpCode op, std::function<int (bool, uint16_t)> func);
125 125
     int runScript(unsigned int level);
126 126
 
127
-private:
127
+  private:
128 128
 
129 129
     typedef enum {
130 130
         S_DemoVersion            = (1 << 0),  //!< Don't load a MAIN.SFX
@@ -141,8 +141,8 @@ private:
141 141
         S_EnableCheatCode        = (1 << 11)  //!< No known effect
142 142
     } ScriptFlag;
143 143
 
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);
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);
146 146
 
147 147
     const bool opcodeHasOperand[OP_UNKNOWN] {
148 148
         true, true, true, true, true, true,

+ 20
- 18
include/SkeletalModel.h Wyświetl plik

@@ -14,15 +14,16 @@
14 14
 #include "TombRaider.h"
15 15
 
16 16
 class BoneTag {
17
-public:
18
-    BoneTag(TombRaider &tr, unsigned int index, unsigned int j, unsigned int *l, unsigned int frame_offset);
17
+  public:
18
+    BoneTag(TombRaider& tr, unsigned int index, unsigned int j, unsigned int* l,
19
+            unsigned int frame_offset);
19 20
     void display();
20 21
 
21 22
     void getOffset(float o[3]);
22 23
     void getRotation(float r[3]);
23 24
     char getFlag();
24 25
 
25
-private:
26
+  private:
26 27
     int mesh;
27 28
     float off[3];
28 29
     float rot[3];
@@ -30,36 +31,37 @@ private:
30 31
 };
31 32
 
32 33
 class BoneFrame {
33
-public:
34
-    BoneFrame(TombRaider &tr, unsigned int index, unsigned int frame_offset);
34
+  public:
35
+    BoneFrame(TombRaider& tr, unsigned int index, unsigned int frame_offset);
35 36
     ~BoneFrame();
36 37
 
37 38
     void getPosition(float p[3]);
38 39
 
39 40
     unsigned long size();
40
-    BoneTag &get(unsigned long i);
41
+    BoneTag& get(unsigned long i);
41 42
 
42
-private:
43
+  private:
43 44
     float pos[3];
44
-    std::vector<BoneTag *> tag;
45
+    std::vector<BoneTag*> tag;
45 46
 };
46 47
 
47 48
 class AnimationFrame {
48
-public:
49
-    AnimationFrame(TombRaider &tr, unsigned int index, int a, unsigned int *frame_offset, int frame_step);
49
+  public:
50
+    AnimationFrame(TombRaider& tr, unsigned int index, int a, unsigned int* frame_offset,
51
+                   int frame_step);
50 52
     ~AnimationFrame();
51 53
 
52 54
     unsigned long size();
53
-    BoneFrame &get(unsigned long i);
55
+    BoneFrame& get(unsigned long i);
54 56
 
55
-private:
57
+  private:
56 58
     char rate;
57
-    std::vector<BoneFrame *> frame;
59
+    std::vector<BoneFrame*> frame;
58 60
 };
59 61
 
60 62
 class SkeletalModel {
61
-public:
62
-    SkeletalModel(TombRaider &tr, unsigned int index, int objectId);
63
+  public:
64
+    SkeletalModel(TombRaider& tr, unsigned int index, int objectId);
63 65
     ~SkeletalModel();
64 66
     void display(unsigned long aframe, unsigned long bframe);
65 67
 
@@ -68,9 +70,9 @@ public:
68 70
     void setPonyPos(float x, float y, float z, float angle);
69 71
 
70 72
     unsigned long size();
71
-    AnimationFrame &get(unsigned long i);
73
+    AnimationFrame& get(unsigned long i);
72 74
 
73
-private:
75
+  private:
74 76
     int id;
75 77
     bool tr4Overlay;
76 78
     bool pigtails;
@@ -81,7 +83,7 @@ private:
81 83
     float ponytailAngle;
82 84
     float ponyOff;
83 85
     float ponyOff2;
84
-    std::vector<AnimationFrame *> animation;
86
+    std::vector<AnimationFrame*> animation;
85 87
 };
86 88
 
87 89
 #endif

+ 5
- 4
include/Sound.h Wyświetl plik

@@ -13,7 +13,7 @@
13 13
  * \brief This is the audio manager for OpenRaider
14 14
  */
15 15
 class Sound {
16
-public:
16
+  public:
17 17
 
18 18
     typedef enum {
19 19
         SoundFlagsNone = 0,       //!< No effect
@@ -71,7 +71,7 @@ public:
71 71
      * \param flags set options. Use SoundFlags enum bitwise OR-ed
72 72
      * \returns 0 for no error or < 0 error flag
73 73
      */
74
-    virtual int addFile(const char *filename, unsigned long *source, unsigned int flags) = 0;
74
+    virtual int addFile(const char* filename, unsigned long* source, unsigned int flags) = 0;
75 75
 
76 76
     /*!
77 77
      * \brief Load wav file from buffer
@@ -81,7 +81,8 @@ public:
81 81
      * \param flags set options. Use SoundFlags enum bitwise OR-ed
82 82
      * \returns 0 for no error or < 0 error flag
83 83
      */
84
-    virtual int addWave(unsigned char *wav, unsigned int length, unsigned long *source, unsigned int flags) = 0;
84
+    virtual int addWave(unsigned char* wav, unsigned int length, unsigned long* source,
85
+                        unsigned int flags) = 0;
85 86
 
86 87
     /*!
87 88
      * \brief Play sound source
@@ -96,7 +97,7 @@ public:
96 97
     virtual void stop(unsigned long source) = 0;
97 98
 };
98 99
 
99
-Sound &getSound();
100
+Sound& getSound();
100 101
 
101 102
 #endif
102 103
 

+ 5
- 4
include/SoundAL.h Wyświetl plik

@@ -17,7 +17,7 @@
17 17
  * \brief This is the OpenAL audio manager
18 18
  */
19 19
 class SoundAL : public Sound {
20
-public:
20
+  public:
21 21
 
22 22
     /*!
23 23
      * \brief Constructs an object of SoundAL
@@ -75,7 +75,7 @@ public:
75 75
      * \param flags set options. Use SoundFlags enum bitwise OR-ed
76 76
      * \returns 0 for no error or < 0 error flag
77 77
      */
78
-    virtual int addFile(const char *filename, unsigned long *source, unsigned int flags);
78
+    virtual int addFile(const char* filename, unsigned long* source, unsigned int flags);
79 79
 
80 80
     /*!
81 81
      * \brief Load wav file from buffer
@@ -85,7 +85,8 @@ public:
85 85
      * \param flags set options. Use SoundFlags enum bitwise OR-ed
86 86
      * \returns 0 for no error or < 0 error flag
87 87
      */
88
-    virtual int addWave(unsigned char *wav, unsigned int length, unsigned long *source, unsigned int flags);
88
+    virtual int addWave(unsigned char* wav, unsigned int length, unsigned long* source,
89
+                        unsigned int flags);
89 90
 
90 91
     /*!
91 92
      * \brief Play sound source
@@ -99,7 +100,7 @@ public:
99 100
      */
100 101
     virtual void stop(unsigned long source);
101 102
 
102
-private:
103
+  private:
103 104
 
104 105
     bool mEnabled;
105 106
     bool mInit;                         //!< Guard to ensure ausio system is active

+ 5
- 4
include/SoundNull.h Wyświetl plik

@@ -14,7 +14,7 @@
14 14
  * \brief This is the null audio manager
15 15
  */
16 16
 class SoundNull : public Sound {
17
-public:
17
+  public:
18 18
 
19 19
     /*!
20 20
      * \brief Constructs an object of SoundNull
@@ -72,7 +72,7 @@ public:
72 72
      * \param flags set options. Use SoundFlags enum bitwise OR-ed
73 73
      * \returns 0 for no error or < 0 error flag
74 74
      */
75
-    virtual int addFile(const char *filename, unsigned long *source, unsigned int flags);
75
+    virtual int addFile(const char* filename, unsigned long* source, unsigned int flags);
76 76
 
77 77
     /*!
78 78
      * \brief Load wav file from buffer
@@ -82,7 +82,8 @@ public:
82 82
      * \param flags set options. Use SoundFlags enum bitwise OR-ed
83 83
      * \returns 0 for no error or < 0 error flag
84 84
      */
85
-    virtual int addWave(unsigned char *wav, unsigned int length, unsigned long *source, unsigned int flags);
85
+    virtual int addWave(unsigned char* wav, unsigned int length, unsigned long* source,
86
+                        unsigned int flags);
86 87
 
87 88
     /*!
88 89
      * \brief Play sound source
@@ -96,7 +97,7 @@ public:
96 97
      */
97 98
     virtual void stop(unsigned long source);
98 99
 
99
-private:
100
+  private:
100 101
     unsigned long sources;
101 102
 };
102 103
 

+ 9
- 9
include/Sprite.h Wyświetl plik

@@ -11,12 +11,12 @@
11 11
 #include "TombRaider.h"
12 12
 
13 13
 class Sprite {
14
-public:
15
-    Sprite(TombRaider &tr, unsigned int room, unsigned int index);
16
-    Sprite(TombRaider &tr, unsigned int item, unsigned int sequence, unsigned int index);
14
+  public:
15
+    Sprite(TombRaider& tr, unsigned int room, unsigned int index);
16
+    Sprite(TombRaider& tr, unsigned int item, unsigned int sequence, unsigned int index);
17 17
     void display();
18 18
 
19
-private:
19
+  private:
20 20
     float vertex[4][3];
21 21
     float texel[4][2];
22 22
     float pos[3];
@@ -25,15 +25,15 @@ private:
25 25
 };
26 26
 
27 27
 class SpriteSequence {
28
-public:
29
-    SpriteSequence(TombRaider &tr, unsigned int item, unsigned int sequence);
28
+  public:
29
+    SpriteSequence(TombRaider& tr, unsigned int item, unsigned int sequence);
30 30
     ~SpriteSequence();
31 31
 
32 32
     unsigned long size();
33
-    Sprite &get(unsigned long index);
33
+    Sprite& get(unsigned long index);
34 34
 
35
-private:
36
-    std::vector<Sprite *> sprites;
35
+  private:
36
+    std::vector<Sprite*> sprites;
37 37
 };
38 38
 
39 39
 #endif

+ 10
- 10
include/StaticMesh.h Wyświetl plik

@@ -12,11 +12,11 @@
12 12
 #include "TombRaider.h"
13 13
 
14 14
 class TexturedTriangle {
15
-public:
15
+  public:
16 16
     TexturedTriangle(int i[3], float s[6], int tex, unsigned short trans);
17
-    void display(float *vertices, float *colors, float *normals);
17
+    void display(float* vertices, float* colors, float* normals);
18 18
 
19
-private:
19
+  private:
20 20
     int index[3];
21 21
     float st[6];
22 22
     int texture;
@@ -24,13 +24,13 @@ private:
24 24
 };
25 25
 
26 26
 class StaticMesh {
27
-public:
28
-    StaticMesh(TombRaider &tr, unsigned int index);
27
+  public:
28
+    StaticMesh(TombRaider& tr, unsigned int index);
29 29
     ~StaticMesh();
30 30
     void display();
31 31
     float getRadius();
32 32
 
33
-private:
33
+  private:
34 34
     bool dontshow;
35 35
     float center[3];
36 36
     float radius;
@@ -39,11 +39,11 @@ private:
39 39
     unsigned int colorCount;
40 40
     unsigned int normalCount;
41 41
 
42
-    float *vertices;
43
-    float *colors;
44
-    float *normals;
42
+    float* vertices;
43
+    float* colors;
44
+    float* normals;
45 45
 
46
-    std::vector<TexturedTriangle *> triangles;
46
+    std::vector<TexturedTriangle*> triangles;
47 47
 };
48 48
 
49 49
 #endif

+ 14
- 14
include/TextureManager.h Wyświetl plik

@@ -15,7 +15,7 @@
15 15
  * \brief Texture registry
16 16
  */
17 17
 class TextureManager {
18
-public:
18
+  public:
19 19
 
20 20
     enum TextureFlag {
21 21
         fUseMultiTexture = (1 << 0),
@@ -26,9 +26,9 @@ public:
26 26
     */
27 27
     TextureManager();
28 28
 
29
-   /*!
30
-    * \brief Deconstructs an object of Texture
31
-    */
29
+    /*!
30
+     * \brief Deconstructs an object of Texture
31
+     */
32 32
     ~TextureManager();
33 33
 
34 34
     /*!
@@ -76,12 +76,12 @@ public:
76 76
      * \param filter if the texture should be mipmap filtered
77 77
      * \returns texture ID or < 0 on error
78 78
      */
79
-    int loadBufferSlot(unsigned char *image,
80
-                        unsigned int width, unsigned int height,
81
-                        ColorMode mode, unsigned int bpp,
82
-                        unsigned int slot, bool filter = true);
79
+    int loadBufferSlot(unsigned char* image,
80
+                       unsigned int width, unsigned int height,
81
+                       ColorMode mode, unsigned int bpp,
82
+                       unsigned int slot, bool filter = true);
83 83
 
84
-    int loadImage(const char *filename);
84
+    int loadImage(const char* filename);
85 85
 
86 86
     /*!
87 87
      * \brief Sets an option flag
@@ -91,16 +91,16 @@ public:
91 91
 
92 92
     void useMultiTexture(float aU, float aV, float bU, float bV);
93 93
 
94
-private:
95
-    int loadTGA(const char *filename);
96
-    int loadPCX(const char *filename);
97
-    int loadPNG(const char *filename);
94
+  private:
95
+    int loadTGA(const char* filename);
96
+    int loadPCX(const char* filename);
97
+    int loadPNG(const char* filename);
98 98
 
99 99
     std::vector<unsigned int> mTextureIds;
100 100
     unsigned int mFlags;
101 101
 };
102 102
 
103
-TextureManager &getTextureManager();
103
+TextureManager& getTextureManager();
104 104
 
105 105
 #endif
106 106
 

+ 127
- 126
include/TombRaider.h Wyświetl plik

@@ -18,7 +18,7 @@
18 18
  * \brief Loads maps, meshes, textures...
19 19
  */
20 20
 class TombRaider {
21
-public:
21
+  public:
22 22
 
23 23
     /*!
24 24
      * \brief Constructs an object of TombRaider
@@ -60,13 +60,13 @@ public:
60 60
 
61 61
     tr2_version_type Engine();
62 62
 
63
-    unsigned short *Frame();
63
+    unsigned short* Frame();
64 64
 
65
-    tr2_animation_t *Animation();
65
+    tr2_animation_t* Animation();
66 66
 
67
-    tr2_item_t *Item();
67
+    tr2_item_t* Item();
68 68
 
69
-    tr2_object_texture_t *ObjectTextures();
69
+    tr2_object_texture_t* ObjectTextures();
70 70
 
71 71
     /*!
72 72
      * \brief Get number of boxes
@@ -74,9 +74,9 @@ public:
74 74
      */
75 75
     unsigned int getNumBoxes();
76 76
 
77
-    tr2_box_t *Box();
77
+    tr2_box_t* Box();
78 78
 
79
-    tr2_mesh_t *Mesh();
79
+    tr2_mesh_t* Mesh();
80 80
 
81 81
     /*!
82 82
      * \brief Get number of animations for a moveable
@@ -85,26 +85,26 @@ public:
85 85
      */
86 86
     int getNumAnimsForMoveable(int moveable_index);
87 87
 
88
-    tr2_staticmesh_t *StaticMesh();
88
+    tr2_staticmesh_t* StaticMesh();
89 89
 
90
-    tr2_moveable_t *Moveable();
90
+    tr2_moveable_t* Moveable();
91 91
 
92
-    tr2_meshtree_t *MeshTree();
92
+    tr2_meshtree_t* MeshTree();
93 93
 
94 94
     /*!
95 95
      * \brief Get the sprites
96 96
      * \returns the sprite array
97 97
      */
98
-    tr2_sprite_texture_t *Sprite();
98
+    tr2_sprite_texture_t* Sprite();
99 99
 
100
-    tr2_sprite_sequence_t *SpriteSequence();
100
+    tr2_sprite_sequence_t* SpriteSequence();
101 101
 
102 102
     /*!
103 103
      * \brief Makes a 32bit RGBA image from a stexture/bmap
104 104
      * \param texture valid index into tex_special list
105 105
      * \returns 32bit RGBA image or NULL on error
106 106
      */
107
-    unsigned char *SpecialTexTile(int texture);
107
+    unsigned char* SpecialTexTile(int texture);
108 108
 
109 109
     /*!
110 110
      * \brief Get copies of texture and it's bumpmap
@@ -112,20 +112,20 @@ public:
112 112
      * \param image will be set to texture if found, or NULL
113 113
      * \param bumpmap will be set to bumpmap if found, or NULL
114 114
      */
115
-    void Texture(int texture, unsigned char **image, unsigned char **bumpmap);
115
+    void Texture(int texture, unsigned char** image, unsigned char** bumpmap);
116 116
 
117
-    unsigned int *Palette16();
117
+    unsigned int* Palette16();
118 118
 
119
-    unsigned char *Palette8();
119
+    unsigned char* Palette8();
120 120
 
121
-    tr2_room_t *Room();
121
+    tr2_room_t* Room();
122 122
 
123 123
     /*!
124 124
      * \brief Check if a file is a TombRaider pak
125 125
      * \param filename file to check
126 126
      * \returns 0 if it is a TombRaider pak
127 127
      */
128
-    static int checkMime(const char *filename);
128
+    static int checkMime(const char* filename);
129 129
 
130 130
     /*!
131 131
      * \brief Loads TombRaider 1-5 pak into memory
@@ -134,7 +134,7 @@ public:
134 134
      * \returns 0 on success, < 0 on error
135 135
      * \sa TombRaider::loadTR5()
136 136
      */
137
-    int Load(const char *filename);
137
+    int Load(const char* filename);
138 138
 
139 139
     /*!
140 140
      * \brief Makes a clamped 0.0 to 1.0 texel from coord pair
@@ -153,10 +153,10 @@ public:
153 153
      * \param y will be set to computed angle
154 154
      * \param z will be set to computed angle
155 155
      */
156
-    void computeRotationAngles(unsigned short **frame,
157
-                                unsigned int *frame_offset,
158
-                                unsigned int *angle_offset,
159
-                                float *x, float *y, float *z);
156
+    void computeRotationAngles(unsigned short** frame,
157
+                               unsigned int* frame_offset,
158
+                               unsigned int* angle_offset,
159
+                               float* x, float* y, float* z);
160 160
 
161 161
     /*!
162 162
      * \brief Returns computed UV in u and v
@@ -164,7 +164,7 @@ public:
164 164
      * \param u will contain calculated x value
165 165
      * \param v will contain calculated y value
166 166
      */
167
-    void computeUV(tr2_object_texture_vert_t *st, float *u, float *v);
167
+    void computeUV(tr2_object_texture_vert_t* st, float* u, float* v);
168 168
 
169 169
     /*!
170 170
      * \brief Get number of bump maps in loaded pak
@@ -183,7 +183,7 @@ public:
183 183
      * \param radius will be filled with radius, not NULL
184 184
      */
185 185
     void getMeshCollisionInfo(unsigned int meshIndex,
186
-                                float center[3], float *radius);
186
+                              float center[3], float* radius);
187 187
 
188 188
     /*!
189 189
      * \brief Get SIGNED mesh count (TR encoded < 0 errors)
@@ -204,8 +204,8 @@ public:
204 204
      * \fixme This method interface may change later
205 205
      */
206 206
     void getMeshColoredRectangle(unsigned int meshIndex,
207
-                                    unsigned int faceIndex,
208
-                                    int index[6], float color[4]);
207
+                                 unsigned int faceIndex,
208
+                                 int index[6], float color[4]);
209 209
 
210 210
     /*!
211 211
      * \brief This method is made to let you fill arrays or
@@ -236,9 +236,9 @@ public:
236 236
      * \fixme This method interface may change later
237 237
      */
238 238
     void getMeshTexturedRectangle(unsigned int meshIndex,
239
-                                    unsigned int faceIndex,
240
-                                    int index[6], float st[12], int *texture,
241
-                                    unsigned short *transparency);
239
+                                  unsigned int faceIndex,
240
+                                  int index[6], float st[12], int* texture,
241
+                                  unsigned short* transparency);
242 242
 
243 243
     /*!
244 244
      * \brief This method is made to let you fill arrays or
@@ -253,9 +253,9 @@ public:
253 253
      * \fixme This method interface may change later
254 254
      */
255 255
     void getMeshTexturedTriangle(unsigned int meshIndex,
256
-                                    unsigned int faceIndex,
257
-                                    int index[3], float st[6], int *texture,
258
-                                    unsigned short *transparency);
256
+                                 unsigned int faceIndex,
257
+                                 int index[3], float st[6], int* texture,
258
+                                 unsigned short* transparency);
259 259
 
260 260
     /*!
261 261
      * \brief Get face counts for a given mesh.
@@ -297,9 +297,9 @@ public:
297 297
      * \param colors will be set to allocated color array (I)
298 298
      */
299 299
     void getMeshVertexArrays(unsigned int meshIndex,
300
-                                unsigned int *vertexCount, float **verts,
301
-                                unsigned int *normalCount, float **norms,
302
-                                unsigned int *colorCount, float **colors);
300
+                             unsigned int* vertexCount, float** verts,
301
+                             unsigned int* normalCount, float** norms,
302
+                             unsigned int* colorCount, float** colors);
303 303
 
304 304
     /*!
305 305
      * \brief Get a single collision box from room (unified)
@@ -312,7 +312,7 @@ public:
312 312
      * \returns 0 on success, < 0 on error
313 313
      */
314 314
     int getRoomBox(unsigned int roomIndex, unsigned int index,
315
-                    float *xyzA, float *xyzB, float *xyzC, float *xyzD);
315
+                   float* xyzA, float* xyzB, float* xyzC, float* xyzD);
316 316
 
317 317
     /*!
318 318
      * \brief Get number of collision boxes in room (unified)
@@ -322,8 +322,8 @@ public:
322 322
     unsigned int getRoomBoxCount(unsigned int roomIndex);
323 323
 
324 324
     void getRoomInfo(unsigned int index,
325
-                        unsigned int *flags, float pos[3],
326
-                        float bboxMin[3], float bboxMax[3]);
325
+                     unsigned int* flags, float pos[3],
326
+                     float bboxMin[3], float bboxMax[3]);
327 327
 
328 328
     /*!
329 329
      * \brief Get a single light from a room (unified)
@@ -339,9 +339,9 @@ public:
339 339
      * \returns 0 on success, < 0 on error
340 340
      */
341 341
     int getRoomLight(unsigned int roomIndex, unsigned int index,
342
-                        float pos[4], float color[4], float dir[3],
343
-                        float *attenuation, float *cutoffAngle,
344
-                        unsigned int *type, unsigned int *flags);
342
+                     float pos[4], float color[4], float dir[3],
343
+                     float* attenuation, float* cutoffAngle,
344
+                     unsigned int* type, unsigned int* flags);
345 345
 
346 346
     /*!
347 347
      * \brief Get number of lights in room (unified)
@@ -360,7 +360,7 @@ public:
360 360
      * \returns 0 on success, < 0 on error
361 361
      */
362 362
     int getRoomModel(unsigned int roomIndex, unsigned int index,
363
-                        int *modelIndex, float pos[3], float *yaw);
363
+                     int* modelIndex, float pos[3], float* yaw);
364 364
 
365 365
     /*!
366 366
      * \brief Get number of room models in room (unified)
@@ -379,7 +379,7 @@ public:
379 379
      * \returns 0 on success, < 0 on error
380 380
      */
381 381
     int getRoomPortal(unsigned int roomIndex, unsigned int index,
382
-                        int *adjoiningRoom, float normal[3], float vertices[12]);
382
+                      int* adjoiningRoom, float normal[3], float vertices[12]);
383 383
 
384 384
     /*!
385 385
      * \brief Get number of portals from room (unified)
@@ -399,8 +399,8 @@ public:
399 399
      * \param flags will contain flags
400 400
      */
401 401
     void getRoomRectangle(unsigned int roomIndex, unsigned int rectangleIndex,
402
-                            unsigned int *indices, float *texCoords, int *texture,
403
-                            unsigned int *flags);
402
+                          unsigned int* indices, float* texCoords, int* texture,
403
+                          unsigned int* flags);
404 404
 
405 405
     /*!
406 406
      * \brief Get number of rectangles from room (unified)
@@ -423,9 +423,9 @@ public:
423 423
      * \return 0 on success, < 0 on error
424 424
      */
425 425
     int getRoomSector(unsigned int roomIndex, unsigned int index,
426
-                        unsigned int *flags, float *ceiling, float *floor,
427
-                        int *floorDataIndex, int *boxIndex,
428
-                        int *roomBelow, int *roomAbove);
426
+                      unsigned int* flags, float* ceiling, float* floor,
427
+                      int* floorDataIndex, int* boxIndex,
428
+                      int* roomBelow, int* roomAbove);
429 429
 
430 430
     /*!
431 431
      * \brief Get number of sectors in room (unified)
@@ -435,12 +435,12 @@ public:
435 435
      * \returns number of sectors in room
436 436
      */
437 437
     unsigned int getRoomSectorCount(unsigned int roomIndex,
438
-                                    unsigned int *zSectorsCount,
439
-                                    unsigned int *xSectorsCount);
438
+                                    unsigned int* zSectorsCount,
439
+                                    unsigned int* xSectorsCount);
440 440
 
441 441
     void getRoomSprite(unsigned int roomIndex, unsigned int index,
442
-                        float scale, int *texture,
443
-                        float *pos, float *vertices, float *texcoords);
442
+                       float scale, int* texture,
443
+                       float* pos, float* vertices, float* texcoords);
444 444
 
445 445
     /*!
446 446
      * \brief Get number of sprites in room (unified)
@@ -460,8 +460,8 @@ public:
460 460
      * \param flags will contain flags
461 461
      */
462 462
     void getRoomTriangle(unsigned int roomIndex, unsigned int triangleIndex,
463
-                            unsigned int *indices, float *texCoords, int *texture,
464
-                            unsigned int *flags);
463
+                         unsigned int* indices, float* texCoords, int* texture,
464
+                         unsigned int* flags);
465 465
 
466 466
     /*!
467 467
      * \brief Gets triangle data with texCoords for non-matching
@@ -479,9 +479,9 @@ public:
479 479
      * \param flags will contain flags
480 480
      */
481 481
     void getRoomTriangles(unsigned int index, int textureOffset,
482
-                            unsigned int *count, unsigned int **indices,
483
-                            float **texCoords, int **textures,
484
-                            unsigned int **flags);
482
+                          unsigned int* count, unsigned int** indices,
483
+                          float** texCoords, int** textures,
484
+                          unsigned int** flags);
485 485
 
486 486
     /*!
487 487
      * \brief Gets triangle data with duplicated vertex/color/normal
@@ -500,10 +500,10 @@ public:
500 500
      * \param flags will contain flags
501 501
      */
502 502
     void getRoomTriangles(unsigned int roomIndex, int textureOffset,
503
-                            unsigned int *count,
504
-                            unsigned int **indices, float **vertices,
505
-                            float **texCoords, float **colors,
506
-                            int **textures, unsigned int **flags);
503
+                          unsigned int* count,
504
+                          unsigned int** indices, float** vertices,
505
+                          float** texCoords, float** colors,
506
+                          int** textures, unsigned int** flags);
507 507
 
508 508
     /*!
509 509
      * \brief Get number of triangles from room (unified)
@@ -520,7 +520,7 @@ public:
520 520
      * \param rgba will contain vertex color, has to be allocated
521 521
      */
522 522
     void getRoomVertex(unsigned int roomIndex, unsigned int vertexIndex,
523
-                        float *xyz, float *rgba);
523
+                       float* xyz, float* rgba);
524 524
 
525 525
     /*!
526 526
      * \brief Get allocated vertex and color arrays and their element counts (unified)
@@ -533,9 +533,9 @@ public:
533 533
      * \param colors will contain color array
534 534
      */
535 535
     void getRoomVertexArrays(unsigned int roomIndex,
536
-                                unsigned int *vertexCount, float **vertices,
537
-                                unsigned int *normalCount, float **normals,
538
-                                unsigned int *colorCount, float **colors);
536
+                             unsigned int* vertexCount, float** vertices,
537
+                             unsigned int* normalCount, float** normals,
538
+                             unsigned int* colorCount, float** colors);
539 539
 
540 540
     /*!
541 541
      * \brief Get number of lights in room (unified)
@@ -559,7 +559,7 @@ public:
559 559
      * \param data will contain sound sample
560 560
      */
561 561
     void getSoundSample(unsigned int index,
562
-                        unsigned int *bytes, unsigned char **data);
562
+                        unsigned int* bytes, unsigned char** data);
563 563
 
564 564
     /*!
565 565
      * \brief Get number of loaded sound samples
@@ -586,7 +586,7 @@ public:
586 586
      * \param filename pak to load
587 587
      * \returns < 0 on error
588 588
      */
589
-    int loadSFX(const char *filename);
589
+    int loadSFX(const char* filename);
590 590
 
591 591
     void reset();
592 592
 
@@ -604,20 +604,20 @@ public:
604 604
      */
605 605
     void setTexelScalingFactor(float f);
606 606
 
607
-private:
607
+  private:
608 608
 
609
-    void extractMeshes(unsigned char *mesh_data,
610
-                        unsigned int num_mesh_pointers,
611
-                        unsigned int *mesh_pointers);
609
+    void extractMeshes(unsigned char* mesh_data,
610
+                       unsigned int num_mesh_pointers,
611
+                       unsigned int* mesh_pointers);
612 612
 
613
-    int Fread(void *buffer, size_t size, size_t count, FILE *f);
613
+    int Fread(void* buffer, size_t size, size_t count, FILE* f);
614 614
 
615 615
     /*!
616 616
      * \brief Get a copy of the sound samples
617 617
      * \param bytes will contain size of sound samples
618 618
      * \param data will contain sound samples themselves
619 619
      */
620
-    void getRiffData(unsigned int *bytes, unsigned char **data);
620
+    void getRiffData(unsigned int* bytes, unsigned char** data);
621 621
 
622 622
     /*!
623 623
      * \brief Get a copy of a TR4 sound sample
@@ -626,7 +626,7 @@ private:
626 626
      * \param data will contain sound sample itself
627 627
      */
628 628
     void getRiffDataTR4(unsigned int index,
629
-                        unsigned int *bytes, unsigned char **data);
629
+                        unsigned int* bytes, unsigned char** data);
630 630
 
631 631
     /*!
632 632
      * \brief Get an array of offsets for a contiguous RIFF data stream in chunks.
@@ -640,8 +640,8 @@ private:
640 640
      * \param numOffsets known number
641 641
      * \returns number of RIFFs found
642 642
      */
643
-    int getRiffOffsets(unsigned char *riffData, unsigned int riffDataBytes,
644
-                        unsigned int **offsets, unsigned int numOffsets);
643
+    int getRiffOffsets(unsigned char* riffData, unsigned int riffDataBytes,
644
+                       unsigned int** offsets, unsigned int numOffsets);
645 645
 
646 646
     /*!
647 647
      * \brief Makes a 32bit RGBA image from a textile.
@@ -651,18 +651,18 @@ private:
651 651
      * \param texture valid index into textile list
652 652
      * \returns 32bit RGBA image or NULL on error
653 653
      */
654
-    unsigned char *getTexTile(int texture);
654
+    unsigned char* getTexTile(int texture);
655 655
 
656 656
     /*!
657 657
      * \brief Loads a TR5 pak into memory.
658 658
      * \param f valid FILE
659 659
      * \returns 0 on success, < 0 on error
660 660
      */
661
-    int loadTR5(FILE *f);
661
+    int loadTR5(FILE* f);
662 662
 
663
-    static void print(const char *methodName, const char *s, ...) __attribute__((format(printf, 2, 3)));
663
+    static void print(const char* methodName, const char* s, ...) __attribute__((format(printf, 2, 3)));
664 664
 
665
-    void printDebug(const char *methodName, const char *s, ...) __attribute__((format(printf, 3, 4)));
665
+    void printDebug(const char* methodName, const char* s, ...) __attribute__((format(printf, 3, 4)));
666 666
 
667 667
     bool mDebug;                           //!< Debug output toggle
668 668
     unsigned int mPakVersion;              //!< TombRaider pak file header version
@@ -673,106 +673,107 @@ private:
673 673
     unsigned short  _num_room_textures;    //!< Num textures only for room use?
674 674
     unsigned short _num_misc_textures;     //!< Num of textures for misc use?
675 675
     unsigned short _num_bump_map_textures; //!< Num of textures that are bump map, texture pairs
676
-    tr2_textile8_t *_textile8;             //!< 8-bit (palettised) textiles
677
-    tr2_textile16_t *_textile16;           //!< 16-bit (ARGB) textiles
678
-    tr2_textile32_t *_textile32;           //!< 32-bit (BGRA) textiles
676
+    tr2_textile8_t* _textile8;             //!< 8-bit (palettised) textiles
677
+    tr2_textile16_t* _textile16;           //!< 16-bit (ARGB) textiles
678
+    tr2_textile32_t* _textile32;           //!< 32-bit (BGRA) textiles
679 679
     unsigned int _num_tex_special;         //!< Special textures and bump maps count
680
-    unsigned char *_tex_special;           //!< Special textures and bump maps
680
+    unsigned char* _tex_special;           //!< Special textures and bump maps
681 681
     unsigned int _unknown_t;               //!< 32-bit unknown (always 0 in real TR2 levels)
682 682
     unsigned short _num_rooms;             //!< Number of rooms in this level
683
-    tr2_room_t *_rooms;                    //!< List of rooms (TR1,TR2,TR3,TR4)
684
-    tr5_room_t *mRoomsTR5;                 //!< Rooms ( TR5 / TRC ) Only
683
+    tr2_room_t* _rooms;                    //!< List of rooms (TR1,TR2,TR3,TR4)
684
+    tr5_room_t* mRoomsTR5;                 //!< Rooms ( TR5 / TRC ) Only
685 685
     unsigned int _num_floor_data;          //!< Num of words of floor data this level
686
-    unsigned short *_floor_data;           //!< Floor data
686
+    unsigned short* _floor_data;           //!< Floor data
687 687
     int mMeshCount;                        //!< Number of meshes this level
688
-    tr2_mesh_t *mMeshes;                   //!< list of meshes
688
+    tr2_mesh_t* mMeshes;                   //!< list of meshes
689 689
     unsigned int _num_animations;          //!< number of animations this level
690
-    tr2_animation_t *_animations;          //!< list of animations
690
+    tr2_animation_t* _animations;          //!< list of animations
691 691
     unsigned int _num_state_changes;       //!< number of structures(?) this level
692
-    tr2_state_change_t *_state_changes;    //!< list of structures
692
+    tr2_state_change_t* _state_changes;    //!< list of structures
693 693
     unsigned int _num_anim_dispatches;     //!< number of ranges(?) this level
694
-    tr2_anim_dispatch_t *_anim_dispatches; //!< list of ranges
694
+    tr2_anim_dispatch_t* _anim_dispatches; //!< list of ranges
695 695
     unsigned int _num_anim_commands;       //!< number of Bone1s this level
696
-    tr2_anim_command_t *_anim_commands;    //!< list of Bone1s
696
+    tr2_anim_command_t* _anim_commands;    //!< list of Bone1s
697 697
     unsigned int _num_mesh_trees;          //!< number of Bone2s this level
698
-    tr2_meshtree_t *_mesh_trees;           //!< list of Bone2s
698
+    tr2_meshtree_t* _mesh_trees;           //!< list of Bone2s
699 699
     unsigned int _num_frames;              //!< num of words of frame data this level
700
-    unsigned short *_frames;               //!< frame data
700
+    unsigned short* _frames;               //!< frame data
701 701
     unsigned int _num_moveables;           //!< number of moveables this level
702
-    tr2_moveable_t *_moveables;            //!< list of moveables
702
+    tr2_moveable_t* _moveables;            //!< list of moveables
703 703
 
704 704
     uint32_t numMoveablesTR5;
705
-    tr5_moveable_t *moveablesTR5;
705
+    tr5_moveable_t* moveablesTR5;
706 706
 
707 707
     uint32_t numAnimationsTR5;
708
-    tr5_animation_t *animationsTR5;
708
+    tr5_animation_t* animationsTR5;
709 709
 
710 710
     uint32_t numObjectTexturesTR5;
711
-    tr5_object_texture_t *objectTexturesTR5;
711
+    tr5_object_texture_t* objectTexturesTR5;
712 712
 
713 713
     uint32_t numCinematicFramesTR5;
714
-    tr5_cinematic_frame_t *cinematicFramesTR5;
714
+    tr5_cinematic_frame_t* cinematicFramesTR5;
715 715
 
716 716
     uint32_t numFlyByCamerasTR5;
717
-    tr5_flyby_camera_t *flyByCamerasTR5;
717
+    tr5_flyby_camera_t* flyByCamerasTR5;
718 718
 
719 719
     unsigned int _num_static_meshes;        //!< number of static meshes this level
720
-    tr2_staticmesh_t *_static_meshes;       //!< static meshes
720
+    tr2_staticmesh_t* _static_meshes;       //!< static meshes
721 721
     unsigned int _num_object_textures;      //!< number of object textures this level
722
-    tr2_object_texture_t *_object_textures; //!< list of object textures
722
+    tr2_object_texture_t* _object_textures; //!< list of object textures
723 723
 
724 724
     unsigned int _num_sprite_textures;        //!< num of sprite textures this level
725
-    tr2_sprite_texture_t *_sprite_textures;   //!< list of sprite textures
725
+    tr2_sprite_texture_t* _sprite_textures;   //!< list of sprite textures
726 726
     unsigned int _num_sprite_sequences;       //!< num of sprite sequences this level
727
-    tr2_sprite_sequence_t *_sprite_sequences; //!< sprite sequence data
727
+    tr2_sprite_sequence_t* _sprite_sequences; //!< sprite sequence data
728 728
     int  _num_cameras;                        //!< Number of Cameras
729
-    tr2_camera_t  *_cameras;                  //!< cameras
729
+    tr2_camera_t*  _cameras;                  //!< cameras
730 730
     int  _num_sound_sources;                  //!< Number of Sounds
731
-    tr2_sound_source_t *_sound_sources;       //!< sounds
731
+    tr2_sound_source_t* _sound_sources;       //!< sounds
732 732
     int  _num_boxes;                          //!< Number of Boxes
733
-    tr2_box_t *_boxes;                        /*!< boxes - looks like
733
+    tr2_box_t* _boxes;                        /*!< boxes - looks like
734 734
                                                * struct { unsigned short value[4]; }
735 735
                                                * - value[0..2] might be a vector;
736 736
                                                * value[3] seems to be index into
737 737
                                                * Overlaps[] */
738 738
     int  _num_overlaps;                       //!< Number of Overlaps
739
-    short  *_overlaps;                        /*!< Overlaps -
739
+    short*  _overlaps;                        /*!< Overlaps -
740 740
                                                * looks like ushort; 0x8000 is flag
741 741
                                                * of some sort appears to be an
742 742
                                                * offset into Boxes[] and/or
743 743
                                                * Boxes2[] */
744
-    short  *_zones;                           //!< Boxes2
744
+    short*  _zones;                           //!< Boxes2
745 745
     int  _num_animated_textures;              //!< Number of AnimTextures
746
-    short  *_animated_textures;               //!< Animtextures
746
+    short*  _animated_textures;               //!< Animtextures
747 747
     int  _num_items;                          //!< Number of Items
748
-    tr2_item_t *_items;                       //!< Items
749
-    unsigned char  *_light_map;               //!< Colour-light maps
748
+    tr2_item_t* _items;                       //!< Items
749
+    unsigned char*  _light_map;               //!< Colour-light maps
750 750
     unsigned int _num_cinematic_frames;       //!< Number of cut-scene frames
751
-    tr2_cinematic_frame_t *_cinematic_frames; //!< Cut-scene frames
751
+    tr2_cinematic_frame_t* _cinematic_frames; //!< Cut-scene frames
752 752
     short  _num_demo_data;                    //!< Number of Demo Data
753
-    unsigned char  *_demo_data;               //!< Demo data
753
+    unsigned char*  _demo_data;               //!< Demo data
754 754
     float mRoomVertexLightingFactor;
755 755
     float mTexelScale;
756 756
 
757 757
     // Sound data
758
-    short  *mSoundMap;                   //!< Sound map
758
+    short*  mSoundMap;                   //!< Sound map
759 759
     int  mNumSoundDetails;               //!< Number of SampleModifiers
760
-    tr2_sound_details_t *mSoundDetails;  //!< Sample modifiers
760
+    tr2_sound_details_t* mSoundDetails;  //!< Sample modifiers
761 761
     int  mNumSampleIndices;              //!< Number of Sample Indices
762
-    int  *mSampleIndices;                //!< Sample indices
763
-    unsigned int *mSampleIndicesTR5;
762
+    int*  mSampleIndices;                //!< Sample indices
763
+    unsigned int* mSampleIndicesTR5;
764 764
     bool mRiffAlternateLoaded;           //!< Is a TR2,TR3 SFX loaded?
765
-    unsigned int *mRiffAlternateOffsets; //!< After parsing this will
766
-                                         //!< hold byte offsets for TR2,TR3
767
-                                         //!< RIFFs in the buffered SFX
765
+    unsigned int* mRiffAlternateOffsets; //!< After parsing this will
766
+    //!< hold byte offsets for TR2,TR3
767
+    //!< RIFFs in the buffered SFX
768 768
     int mRiffDataSz;                     //!< Byte size of a loaded SFX
769
-    unsigned char *mRiffData;            //!< SFX RIFF data in chunks
769
+    unsigned char* mRiffData;            //!< SFX RIFF data in chunks
770 770
     unsigned int mNumTR4Samples;
771
-    unsigned char **mTR4Samples;
772
-    unsigned int *mTR4SamplesSz;
771
+    unsigned char** mTR4Samples;
772
+    unsigned int* mTR4SamplesSz;
773 773
 
774 774
     // For packed Fread emu/wrapper
775
-    unsigned char *mCompressedLevelData;     //!< Buffer used to emulate fread with uncompressed libz data
775
+    unsigned char*
776
+    mCompressedLevelData;     //!< Buffer used to emulate fread with uncompressed libz data
776 777
     unsigned int mCompressedLevelDataOffset; //!< Offset into buffer
777 778
     unsigned int mCompressedLevelSize;       //!< Size of buffer
778 779
     tr_fread_mode_t mFreadMode;              //!< Fread mode file|buffer

+ 115
- 114
include/TombRaiderData.h Wyświetl plik

@@ -102,7 +102,7 @@ typedef struct {
102 102
     unsigned char r; //!< Red part
103 103
     unsigned char g; //!< Green part
104 104
     unsigned char b; //!< Blue part
105
-} __attribute__ ((packed)) tr2_colour_t;
105
+} __attribute__((packed)) tr2_colour_t;
106 106
 
107 107
 /*!
108 108
  * \brief Basic vertex structure.
@@ -115,7 +115,7 @@ typedef struct {
115 115
     short x;
116 116
     short y;
117 117
     short z;
118
-} __attribute__ ((packed)) tr2_vertex_t;
118
+} __attribute__((packed)) tr2_vertex_t;
119 119
 
120 120
 /*!
121 121
  * \brief A rectangular (quad) face definition.
@@ -131,7 +131,7 @@ typedef struct {
131 131
 typedef struct {
132 132
     unsigned short vertices[4];
133 133
     unsigned short texture;
134
-} __attribute__ ((packed)) tr2_quad_t; // was tr2_face4
134
+} __attribute__((packed)) tr2_quad_t;  // was tr2_face4
135 135
 
136 136
 typedef struct {
137 137
     unsigned short vertices[4]; //!< The 4 vertices of a quad
@@ -146,7 +146,7 @@ typedef struct {
146 146
      * the strength of this effect:
147 147
      * the more bigger the value is, the more visible is the effect.
148 148
      */
149
-} __attribute__ ((packed)) tr4_quad_t;
149
+} __attribute__((packed)) tr4_quad_t;
150 150
 
151 151
 /*!
152 152
  * \brief A triangular face definition.
@@ -162,13 +162,13 @@ typedef struct {
162 162
 typedef struct {
163 163
     unsigned short vertices[3];
164 164
     unsigned short texture;
165
-} __attribute__ ((packed)) tr2_tri_t; // was tr2_face3
165
+} __attribute__((packed)) tr2_tri_t;  // was tr2_face3
166 166
 
167 167
 typedef struct {
168 168
     unsigned short vertices[3]; //!< The 3 vertices of a tri
169 169
     unsigned short texture;     //!< Object-texture index
170 170
     unsigned short lighting;    //!< Transparency flag & strength of the highlight
171
-} __attribute__ ((packed)) tr4_tri_t;
171
+} __attribute__((packed)) tr4_tri_t;
172 172
 
173 173
 /*!
174 174
  * \brief An 8-bit texture tile (65536 bytes).
@@ -178,7 +178,7 @@ typedef struct {
178 178
  */
179 179
 typedef struct {
180 180
     unsigned char tile[256 * 256];
181
-} __attribute__ ((packed)) tr2_textile8_t;
181
+} __attribute__((packed)) tr2_textile8_t;
182 182
 
183 183
 /*!
184 184
  * \brief A 16-bit texture tile (131072 bytes).
@@ -193,7 +193,7 @@ typedef struct {
193 193
  */
194 194
 typedef struct {
195 195
     unsigned short tile[256 * 256];
196
-} __attribute__ ((packed)) tr2_textile16_t;
196
+} __attribute__((packed)) tr2_textile16_t;
197 197
 
198 198
 /*!
199 199
  * \brief A 32-bit texture tile (262144 bytes).
@@ -202,7 +202,7 @@ typedef struct {
202 202
  */
203 203
 typedef struct {
204 204
     unsigned int tile[256 * 256];
205
-} __attribute__ ((packed)) tr2_textile32_t;
205
+} __attribute__((packed)) tr2_textile32_t;
206 206
 
207 207
 /*!
208 208
  * \brief The "header" of a room.
@@ -221,7 +221,7 @@ typedef struct {
221 221
     int z;        //!< Z-offset of room (world coordinates)
222 222
     int y_bottom; //!< Y-offset of lowest point in room (world coordinates, actually highest value)
223 223
     int y_top;    //!< Y-offset of highest point in room (world coordinates, actually lowest value)
224
-} __attribute__ ((packed)) tr2_room_info_t;
224
+} __attribute__((packed)) tr2_room_info_t;
225 225
 
226 226
 /*!
227 227
  * \brief Portal structure.
@@ -237,7 +237,7 @@ typedef struct {
237 237
     unsigned short adjoining_room; //!< Which room this "door" leads to
238 238
     tr2_vertex_t normal;           //!< Which way the "door" faces
239 239
     tr2_vertex_t vertices[4];      //!< The corners of the "door"
240
-} __attribute__ ((packed)) tr2_room_portal_t;
240
+} __attribute__((packed)) tr2_room_portal_t;
241 241
 
242 242
 /*!
243 243
  * \brief Room sector structure.
@@ -277,7 +277,7 @@ typedef struct {
277 277
     char floor;                //!< Absolute height of floor (Multiply by 256 for world coordinates)
278 278
     unsigned char  room_above; //!< The number of the room above this one (-1 or 255 if none)
279 279
     char ceiling;              //!< Absolute height of ceiling (multiply by 256 for world coordinates)
280
-} __attribute__ ((packed)) tr2_room_sector_t;
280
+} __attribute__((packed)) tr2_room_sector_t;
281 281
 
282 282
 /*!
283 283
  * \brief Room lighting structure.
@@ -294,7 +294,7 @@ typedef struct {
294 294
     unsigned short intensity2;
295 295
     unsigned int fade1;
296 296
     unsigned int fade2;
297
-} __attribute__ ((packed)) tr2_room_light_t;
297
+} __attribute__((packed)) tr2_room_light_t;
298 298
 
299 299
 typedef struct {
300 300
     int xPosition;           //!< World coords
@@ -309,7 +309,7 @@ typedef struct {
309 309
     float length;
310 310
     float cutoff;
311 311
     float xDir, yDir, zDir;  //!< Direction?
312
-} __attribute__ ((packed)) tr4_room_light_t;
312
+} __attribute__((packed)) tr4_room_light_t;
313 313
 
314 314
 /*!
315 315
  * \brief Room vertex structure.
@@ -319,8 +319,8 @@ typedef struct {
319 319
 typedef struct {
320 320
     tr2_vertex_t vertex;
321 321
     short lighting1;           //!< Values range from 0 to 32767 in TR3, 0=dark.
322
-                               /*!< I think the values ranged from 0 to 8192
323
-                                * in TR1/2, 0=bright.  */
322
+    /*!< I think the values ranged from 0 to 8192
323
+     * in TR1/2, 0=bright.  */
324 324
     unsigned short attributes; /*!<
325 325
                                 * * 0x8000 Something to do with water surface
326 326
                                 * * 0x4000 Under water lighting modulation
@@ -332,7 +332,7 @@ typedef struct {
332 332
                                 */
333 333
 
334 334
     short lighting2;           //!< Seems to be the same as lighting1
335
-} __attribute__ ((packed)) tr2_vertex_room_t;
335
+} __attribute__((packed)) tr2_vertex_room_t;
336 336
 
337 337
 /*!
338 338
  * \brief Sprite structure
@@ -340,7 +340,7 @@ typedef struct {
340 340
 typedef struct {
341 341
     short vertex;  //!< Offset into vertex list
342 342
     short texture; //!< Offset into texture list
343
-} __attribute__ ((packed)) tr2_room_sprite_t;
343
+} __attribute__((packed)) tr2_room_sprite_t;
344 344
 
345 345
 /*!
346 346
  * \brief Room mesh structure.
@@ -352,14 +352,14 @@ typedef struct {
352 352
  */
353 353
 typedef struct tr2_room_data_s {
354 354
     short num_vertices;          //!< Number of vertices in the following list
355
-    tr2_vertex_room_t *vertices; //!< List of vertices (relative coordinates)
355
+    tr2_vertex_room_t* vertices; //!< List of vertices (relative coordinates)
356 356
     short num_rectangles;        //!< Number of textured rectangles
357
-    tr2_quad_t *rectangles;      //!< List of textured rectangles
357
+    tr2_quad_t* rectangles;      //!< List of textured rectangles
358 358
     short num_triangles;         //!< Number of textured triangles
359
-    tr2_tri_t *triangles;        //!< List of textured triangles
359
+    tr2_tri_t* triangles;        //!< List of textured triangles
360 360
     short num_sprites;           //!< Number of sprites
361
-    tr2_room_sprite_t *sprites;  //!< List of sprites
362
-} __attribute__ ((packed)) tr2_room_data_t;
361
+    tr2_room_sprite_t* sprites;  //!< List of sprites
362
+} __attribute__((packed)) tr2_room_data_t;
363 363
 
364 364
 /*!
365 365
  * \brief Room static mesh data.
@@ -375,7 +375,7 @@ typedef struct {
375 375
     unsigned short intensity1;
376 376
     unsigned short intensity2;
377 377
     unsigned short object_id;  //!< Which StaticMesh item to draw
378
-} __attribute__ ((packed)) tr2_room_staticmesh_t;
378
+} __attribute__((packed)) tr2_room_staticmesh_t;
379 379
 
380 380
 
381 381
 /*!
@@ -386,26 +386,26 @@ typedef struct {
386 386
 typedef struct {
387 387
     tr2_room_info_t info;                 //!< where the room exists, in world coordinates
388 388
     unsigned int num_data_words;          //!< number of data words (bitu16)
389
-    unsigned char *data;                  //!< the raw data from which the rest of this is derived
389
+    unsigned char* data;                  //!< the raw data from which the rest of this is derived
390 390
     tr2_room_data_t room_data;            //!< the room mesh
391 391
     unsigned short num_portals;           //!< number of visibility portals that leave this room
392
-    tr2_room_portal_t *portals;           //!< list of visibility portals
392
+    tr2_room_portal_t* portals;           //!< list of visibility portals
393 393
     unsigned short num_zsectors;          //!< width of sector list
394 394
     unsigned short num_xsectors;          //!< height of sector list
395
-    tr2_room_sector_t *sector_list;       //!< list of sectors in this room
395
+    tr2_room_sector_t* sector_list;       //!< list of sectors in this room
396 396
     short intensity1;
397 397
     short intensity2;
398 398
     short light_mode;
399 399
     unsigned short num_lights;            //!< number of lights in this room
400
-    tr2_room_light_t *lights;             //!< list of lights
400
+    tr2_room_light_t* lights;             //!< list of lights
401 401
     unsigned short num_static_meshes;     //!< number of static meshes
402
-    tr2_room_staticmesh_t *static_meshes; //!< static meshes
402
+    tr2_room_staticmesh_t* static_meshes; //!< static meshes
403 403
     short  alternate_room;
404 404
     short  flags;                         /*!< * 0x0001 - room is filled with water
405 405
                                            *   * 0x0020 - Lara's ponytail gets blown by the wind */
406 406
     tr2_colour_t room_light_colour;       //!< TR3 ONLY!
407
-    tr4_room_light_t *tr4Lights;          //!< TR4 ONLY!
408
-} __attribute__ ((packed)) tr2_room_t;
407
+    tr4_room_light_t* tr4Lights;          //!< TR4 ONLY!
408
+} __attribute__((packed)) tr2_room_t;
409 409
 
410 410
 /*!
411 411
  * \brief Animation structure up to TR3.
@@ -420,14 +420,15 @@ typedef struct {
420 420
     short unknown3;
421 421
     short unknown4;
422 422
     unsigned short frame_start;         //!< first frame in this animation
423
-    unsigned short frame_end;           //!< last frame in this animation (numframes = (End - Start) + 1)
423
+    unsigned short
424
+    frame_end;           //!< last frame in this animation (numframes = (End - Start) + 1)
424 425
     unsigned short next_animation;
425 426
     unsigned short next_frame;
426 427
     unsigned short num_state_changes;
427 428
     unsigned short state_change_offset; //!< offset into StateChanges[]
428 429
     unsigned short num_anim_commands;
429 430
     unsigned short anim_command;        //!< offset into AnimCommands[]
430
-} __attribute__ ((packed)) tr2_animation_t;
431
+} __attribute__((packed)) tr2_animation_t;
431 432
 
432 433
 /*!
433 434
  * \brief Data for an animation structure (40 bytes in TR4 vice 32 in TR1/2/3)
@@ -450,7 +451,7 @@ typedef struct {
450 451
     unsigned short state_change_offset; //!< same meaning as in TR3
451 452
     unsigned short num_anim_commands;   //!< same meaning as in TR3
452 453
     unsigned short anim_command;        //!< same meaning as in TR3
453
-} __attribute__ ((packed)) tr4_animation_t;
454
+} __attribute__((packed)) tr4_animation_t;
454 455
 
455 456
 /*!
456 457
  * \brief State Change structure
@@ -459,7 +460,7 @@ typedef struct {
459 460
     unsigned short state_id;
460 461
     unsigned short num_anim_dispatches; //!< Number of dispatches (seems to always be 1..5)
461 462
     unsigned short anim_dispatch;       //!< Offset into AnimDispatches[]
462
-} __attribute__ ((packed)) tr2_state_change_t;
463
+} __attribute__((packed)) tr2_state_change_t;
463 464
 
464 465
 /*!
465 466
  * \brief Animation Dispatch structure
@@ -469,14 +470,14 @@ typedef struct {
469 470
     short high;
470 471
     short next_animation;
471 472
     short next_frame;
472
-} __attribute__ ((packed)) tr2_anim_dispatch_t;
473
+} __attribute__((packed)) tr2_anim_dispatch_t;
473 474
 
474 475
 /*!
475 476
  * \brief AnimCommand structure
476 477
  */
477 478
 typedef struct {
478 479
     short value;
479
-} __attribute__ ((packed)) tr2_anim_command_t;
480
+} __attribute__((packed)) tr2_anim_command_t;
480 481
 
481 482
 /*!
482 483
  * \brief MeshTree structure.
@@ -492,7 +493,7 @@ typedef struct {
492 493
     int x;
493 494
     int y;
494 495
     int z;
495
-} __attribute__ ((packed)) tr2_meshtree_t;
496
+} __attribute__((packed)) tr2_meshtree_t;
496 497
 
497 498
 /*!
498 499
  * \brief Moveable structure.
@@ -513,7 +514,7 @@ typedef struct {
513 514
     unsigned int mesh_tree;       //!< offset into MeshTree[]
514 515
     unsigned int frame_offset;    //!< byte offset into Frames[] (divide by 2 for Frames[i])
515 516
     unsigned short animation;     //!< offset into Animations[]
516
-} __attribute__ ((packed)) tr2_moveable_t;
517
+} __attribute__((packed)) tr2_moveable_t;
517 518
 
518 519
 /*!
519 520
  * \brief StaticMesh structure.
@@ -526,7 +527,7 @@ typedef struct {
526 527
     unsigned short starting_mesh;    //!< first mesh
527 528
     tr2_vertex_t bounding_box[2][2];
528 529
     unsigned short flags;
529
-} __attribute__ ((packed)) tr2_staticmesh_t;
530
+} __attribute__((packed)) tr2_staticmesh_t;
530 531
 
531 532
 /*!
532 533
  * \brief Object texture vertex structure.
@@ -538,7 +539,7 @@ typedef struct {
538 539
     unsigned char xpixel;
539 540
     unsigned char ycoordinate;
540 541
     unsigned char ypixel;
541
-} __attribute__ ((packed)) tr2_object_texture_vert_t;
542
+} __attribute__((packed)) tr2_object_texture_vert_t;
542 543
 
543 544
 /*!
544 545
  * \brief Object texture structure.
@@ -551,7 +552,7 @@ typedef struct {
551 552
                                             */
552 553
     unsigned short tile;                   //!< index into textile list
553 554
     tr2_object_texture_vert_t vertices[4]; //!< the four corners of the texture
554
-} __attribute__ ((packed)) tr2_object_texture_t;
555
+} __attribute__((packed)) tr2_object_texture_t;
555 556
 
556 557
 /*!
557 558
  * \brief Sprite texture structure.
@@ -566,7 +567,7 @@ typedef struct {
566 567
     short top_side;
567 568
     short right_side;
568 569
     short bottom_side;
569
-} __attribute__ ((packed)) tr2_sprite_texture_t;
570
+} __attribute__((packed)) tr2_sprite_texture_t;
570 571
 
571 572
 /*!
572 573
  * \brief Sprite Sequence structure
@@ -575,7 +576,7 @@ typedef struct {
575 576
     int object_id;         //!< Item identifier (same numbering as in tr2_moveable)
576 577
     short negative_length; //!< Negative of "how many sprites are in this sequence"
577 578
     short offset;          //!< Where (in sprite texture list) this sequence starts
578
-} __attribute__ ((packed)) tr2_sprite_sequence_t;
579
+} __attribute__((packed)) tr2_sprite_sequence_t;
579 580
 
580 581
 /*!
581 582
  * \brief Mesh structure.
@@ -595,19 +596,19 @@ typedef struct {
595 596
                                       * (relative coordinates, just like the vertices) */
596 597
     int collision_size;              //!< radius of collisional sphere
597 598
     short num_vertices;              //!< number of vertices in this mesh
598
-    tr2_vertex_t *vertices;          //!< list of vertices (relative coordinates)
599
+    tr2_vertex_t* vertices;          //!< list of vertices (relative coordinates)
599 600
     short num_normals;               //!< number of normals in this mesh (should always equal NumVertices)
600
-    tr2_vertex_t *normals;           //!< list of normals (NULL if NumNormals < 0)
601
-    short *mesh_lights;              //!< if NumNormals < 0
601
+    tr2_vertex_t* normals;           //!< list of normals (NULL if NumNormals < 0)
602
+    short* mesh_lights;              //!< if NumNormals < 0
602 603
     short num_textured_rectangles;   //!< number of textured rectangles
603
-    tr2_quad_t *textured_rectangles; //!< list of textured rectangles
604
+    tr2_quad_t* textured_rectangles; //!< list of textured rectangles
604 605
     short num_textured_triangles;    //!< number of textured triangles in this mesh
605
-    tr2_tri_t *textured_triangles;   //!< list of textured triangles
606
+    tr2_tri_t* textured_triangles;   //!< list of textured triangles
606 607
     short num_coloured_rectangles;   //!< number of coloured rectangles
607
-    tr2_quad_t *coloured_rectangles; //!< list of coloured rectangles
608
+    tr2_quad_t* coloured_rectangles; //!< list of coloured rectangles
608 609
     short num_coloured_triangles;    //!< number of coloured triangles in this mesh
609
-    tr2_tri_t *coloured_triangles;   //!< list of coloured triangles
610
-} __attribute__ ((packed)) tr2_mesh_t;
610
+    tr2_tri_t* coloured_triangles;   //!< list of coloured triangles
611
+} __attribute__((packed)) tr2_mesh_t;
611 612
 
612 613
 /*!
613 614
  * \brief Frame structure.
@@ -649,8 +650,8 @@ typedef struct {
649 650
 typedef struct {
650 651
     tr2_vertex_t vector[3];
651 652
     int num_words;
652
-    unsigned short *words;
653
-} __attribute__ ((packed)) tr2_frame_t;
653
+    unsigned short* words;
654
+} __attribute__((packed)) tr2_frame_t;
654 655
 
655 656
 /*!
656 657
  * \brief Item structure
@@ -665,7 +666,7 @@ typedef struct {
665 666
     short intensity1;
666 667
     short intensity2;
667 668
     short flags;      //!< 0x0100 indicates "inactive" or "invisible"
668
-} __attribute__ ((packed)) tr2_item_t;
669
+} __attribute__((packed)) tr2_item_t;
669 670
 
670 671
 /*!
671 672
  * \brief SoundSource structure
@@ -676,7 +677,7 @@ typedef struct {
676 677
     int z;
677 678
     unsigned short sound_id; //!< internal sound index
678 679
     unsigned short flags;    //!< 0x40, 0x80, or 0xc0
679
-} __attribute__ ((packed)) tr2_sound_source_t;
680
+} __attribute__((packed)) tr2_sound_source_t;
680 681
 
681 682
 /*!
682 683
  * \brief Boxes structure
@@ -688,7 +689,7 @@ typedef struct {
688 689
     unsigned char xmax;
689 690
     short true_floor;    //!< Y value (no scaling)
690 691
     short overlap_index; //!< index into Overlaps[]
691
-} __attribute__ ((packed)) tr2_box_t;
692
+} __attribute__((packed)) tr2_box_t;
692 693
 
693 694
 /*!
694 695
  * \brief AnimatedTexture structure.
@@ -697,8 +698,8 @@ typedef struct {
697 698
  */
698 699
 typedef struct {
699 700
     short num_texture_ids; //!< Number of Texture IDs - 1
700
-    short *texture_list;   //!< list of textures to cycle through
701
-} __attribute__ ((packed)) tr2_animated_texture_t;
701
+    short* texture_list;   //!< list of textures to cycle through
702
+} __attribute__((packed)) tr2_animated_texture_t;
702 703
 
703 704
 /*!
704 705
  * \brief Camera structure
@@ -709,7 +710,7 @@ typedef struct {
709 710
     int z;
710 711
     short room;
711 712
     unsigned short unknown1; //!< correlates to Boxes[]?
712
-} __attribute__ ((packed)) tr2_camera_t;
713
+} __attribute__((packed)) tr2_camera_t;
713 714
 
714 715
 /*
715 716
  * \brief Data for a flyby camera (40 bytes)
@@ -719,7 +720,7 @@ typedef struct {
719 720
     unsigned char index[2];    //!< A pair of indices
720 721
     unsigned short unknown[5]; //!< ??
721 722
     int id;                    //!< Index of something
722
-} __attribute__ ((packed)) tr4_extra_camera_t;
723
+} __attribute__((packed)) tr4_extra_camera_t;
723 724
 
724 725
 /*!
725 726
  * \brief Sound sample structure
@@ -730,7 +731,7 @@ typedef struct {
730 731
     short sound_range;
731 732
     short flags;       /*!< \ brief bits 8-15: priority?, 2-7: number of sound samples
732 733
                         * in this group, bits 0-1: channel number */
733
-} __attribute__ ((packed)) tr2_sound_details_t;
734
+} __attribute__((packed)) tr2_sound_details_t;
734 735
 
735 736
 /*!
736 737
  * \brief Cutscene Camera structure
@@ -744,7 +745,7 @@ typedef struct {
744 745
     short posx;     //!< X position of camera, relative to something
745 746
     short unknown1;
746 747
     short rotx;     //!< Rotation about X axis, +/-32767 ::= +/- 180 degrees
747
-} __attribute__ ((packed)) tr2_cinematic_frame_t;
748
+} __attribute__((packed)) tr2_cinematic_frame_t;
748 749
 
749 750
 /*!
750 751
  * \brief Data for a AI object (24 bytes).
@@ -755,14 +756,14 @@ typedef struct {
755 756
  */
756 757
 typedef struct {
757 758
     unsigned short int object_id; //!< the objectID from the AI object
758
-                                  //!< (AI_FOLLOW is 402)
759
+    //!< (AI_FOLLOW is 402)
759 760
     unsigned short int room;
760 761
     int x, y, a;
761 762
     unsigned short int ocb;
762 763
     unsigned short int flags;     //!< The trigger flags
763
-                                  //!< (button 1-5, first button has value 2)
764
+    //!< (button 1-5, first button has value 2)
764 765
     int angle;                    //!< rotation
765
-} __attribute__ ((packed)) tr4_ai_object_t;
766
+} __attribute__((packed)) tr4_ai_object_t;
766 767
 
767 768
 /*!
768 769
  * \brief Used to read packed TR4 texels
@@ -774,7 +775,7 @@ typedef struct {
774 775
     tr2_object_texture_vert_t vertices[4]; //!< same meaning as in TR3
775 776
     unsigned int unknown1, unknown2;       //!< new in TR4: x & y offset in something
776 777
     unsigned int xsize, ysize;             //!< new in TR4: width-1 & height-1 of the object texture
777
-} __attribute__ ((packed)) tr4_object_texture_t;
778
+} __attribute__((packed)) tr4_object_texture_t;
778 779
 
779 780
 /*!
780 781
  * \brief TR5 Room Layer (56 bytes)
@@ -785,7 +786,7 @@ typedef struct {
785 786
     uint16_t numLayerRectangles; //!< number of rectangles in this layer (2 bytes)
786 787
     uint16_t numLayerTriangles;  //!< number of triangles in this layer (2 bytes)
787 788
     uint16_t unknownL2;          //!< appears to be the number of 2 sided textures
788
-                                  //!< in this layer, however is sometimes 1 off (2 bytes)
789
+    //!< in this layer, however is sometimes 1 off (2 bytes)
789 790
     uint16_t filler;             //!< always 0 (2 bytes)
790 791
     uint16_t filler2;            //!< always 0 (2 bytes)
791 792
 
@@ -806,9 +807,9 @@ typedef struct {
806 807
  */
807 808
 typedef struct {
808 809
     uint16_t vertices[4]; //!< the values are the indices into the
809
-                           //!< appropriate layer vertice list. (2 bytes each)
810
+    //!< appropriate layer vertice list. (2 bytes each)
810 811
     uint16_t texture;     //!< the texture number for this face. Needs to be masked
811
-                           //!< with 0xFFF as the high 4 bits are flags (2 bytes)
812
+    //!< with 0xFFF as the high 4 bits are flags (2 bytes)
812 813
     uint16_t unknownF4;   //!< unknown (2 bytes)
813 814
 } tr5_face4_t;
814 815
 
@@ -817,9 +818,9 @@ typedef struct {
817 818
  */
818 819
 typedef struct {
819 820
     uint16_t vertices[3]; //!< the values are the indices into the
820
-                           //!< appropriate layer vertice list (2 bytes each)
821
+    //!< appropriate layer vertice list (2 bytes each)
821 822
     uint16_t texture;     //!< the texture number for this face. Needs to be masked
822
-                           //!< with 0xFFF as the high 4 bits are flags (2 bytes)
823
+    //!< with 0xFFF as the high 4 bits are flags (2 bytes)
823 824
     uint16_t unknownF3;   //!< unknown (2 bytes)
824 825
 } tr5_face3_t;
825 826
 
@@ -840,9 +841,9 @@ typedef struct {
840 841
  * \brief This is to help store and manage TR5 layer based polgons for rooms
841 842
  */
842 843
 typedef struct {
843
-    tr5_face4_t *quads;
844
-    tr5_face3_t *tris;
845
-    tr5_vertex_t *verts;
844
+    tr5_face4_t* quads;
845
+    tr5_face3_t* tris;
846
+    tr5_vertex_t* verts;
846 847
 } tr5_room_geometry_t;
847 848
 
848 849
 /*!
@@ -964,10 +965,10 @@ typedef struct {
964 965
     uint32_t seperator8;          //!< 0xCDCDCDCD (4 bytes)
965 966
     uint32_t unknownR6;           //!< unknown (4 bytes)
966 967
     float roomX;                   //!< X position of room in world coordinates
967
-                                   //!< If  null room then this data will be 0xCDCDCDCD (4 bytes)
968
+    //!< If  null room then this data will be 0xCDCDCDCD (4 bytes)
968 969
     uint32_t seperator9;          //!< 0x00000000 or 0xCDCDCDCD if null room. (4 bytes)
969 970
     float roomZ;                   //!< Z position of room in world coordinates
970
-                                   //!< If null room then will be bitu32 0xCDCDCDCD (4 bytes)
971
+    //!< If null room then will be bitu32 0xCDCDCDCD (4 bytes)
971 972
     uint32_t seperator10;         //!< 0xCDCDCDCD (4 bytes)
972 973
     uint32_t seperator11;         //!< 0xCDCDCDCD (4 bytes)
973 974
     uint32_t seperator12;         //!< 0xCDCDCDCD (4 bytes)
@@ -981,48 +982,48 @@ typedef struct {
981 982
     uint32_t numTotalRoomLights;  //!< total number of lights this room (4 bytes)
982 983
     uint32_t unknownR7;           //!< unknown, usually equals 0, 1, 2, or 3 (4 bytes)
983 984
     int32_t unknownR8;             //!< usually equals room yTop. Sometimes a few blocks off.
984
-                                   //!< If null room then 0xCDCDCDCD
985
+    //!< If null room then 0xCDCDCDCD
985 986
     int32_t lyBottom;              //!< equals room yBottom. If null room then 0xCDCDCDCD (4 bytes)
986 987
     uint32_t numLayers;           //!< number of layers (pieces) this room (4 bytes)
987 988
     uint32_t layerOffset;         //!< this number + 216 will give you an offset from the start
988
-                                   //!< of the room data to the start of the layer data (4 bytes)
989
+    //!< of the room data to the start of the layer data (4 bytes)
989 990
     uint32_t verticesOffset;      //!< this number + 216 will give you an offset from the start
990
-                                   //!< of the room data to the start of the verex data (4 bytes)
991
+    //!< of the room data to the start of the verex data (4 bytes)
991 992
     uint32_t polyOffset;          //!< this number + 216 will give you an offset from the start
992
-                                   //!< of the room data to the start of the rectangle/triangle data (4 bytes)
993
+    //!< of the room data to the start of the rectangle/triangle data (4 bytes)
993 994
     uint32_t polyOffset2;         //!< same as above ? (4 bytes)
994 995
     uint32_t verticesSize;        //!< size of vertices data block (4 bytes)
995 996
     uint32_t seperator17;         //!< 0xCDCDCDCD (4 bytes)
996 997
     uint32_t seperator18;         //!< 0xCDCDCDCD (4 bytes)
997 998
     uint32_t seperator19;         //!< 0xCDCDCDCD (4 bytes)
998 999
     uint32_t seperator20;         //!< 0xCDCDCDCD (4 bytes)
999
-    tr5_light_t *lights;           //!< [LightSize];
1000
-                                   //!< data for the lights (88 bytes * NumRoomLights)
1001
-    tr2_room_sector_t *sectors;    //!< Data[(NumXSectors * NumZSectors) * 8];
1002
-                                   //!< normal sector data structure
1000
+    tr5_light_t* lights;           //!< [LightSize];
1001
+    //!< data for the lights (88 bytes * NumRoomLights)
1002
+    tr2_room_sector_t* sectors;    //!< Data[(NumXSectors * NumZSectors) * 8];
1003
+    //!< normal sector data structure
1003 1004
     uint16_t numDoors;            //!< number of portals (2 bytes)
1004
-    tr2_room_portal_t *doors;      //!< [NumDoors];
1005
-                                   //!< normal portal structure (32 bytes * NumDoors)
1005
+    tr2_room_portal_t* doors;      //!< [NumDoors];
1006
+    //!< normal portal structure (32 bytes * NumDoors)
1006 1007
     uint16_t seperator21;         //!< 0xCDCD (2 bytes)
1007
-    tr2_room_staticmesh_t *meshes; //!< [NumStaticMeshes];
1008
-                                   //!< normal room static mesh structure (20 bytes * NumRoomStaticMeshes)
1009
-    tr5_room_layer_t *layers;      //!< [NumLayers];
1010
-                                   //!< data for the room layers (pieces) (56 bytes * NumLayers)
1011
-    tr5_room_geometry_t *faces;    //!< [NumRoomRectangles + NumRoomTriangles];
1012
-                                   /* Data for the room polys (face4 and face3).
1013
-                                    * Structured as first layers rectangles
1014
-                                    * then triangles, followed by the
1015
-                                    * next layers rectangles and triangles, etc.,
1016
-                                    * until all layers are done.
1017
-                                    * (12 bytes each rectangle. 10 bytes each triangle)
1018
-                                    */
1019
-    tr5_vertex_t *vertices;        //!< [VerticesSize];
1020
-                                   /*!< Data for the room vertices.
1021
-                                    * Structured as vertices for the first layer,
1022
-                                    * then vertices for the second layer, etc.,
1023
-                                    * until all layers are done.
1024
-                                    * (28 bytes each vertex.
1025
-                                    */
1008
+    tr2_room_staticmesh_t* meshes; //!< [NumStaticMeshes];
1009
+    //!< normal room static mesh structure (20 bytes * NumRoomStaticMeshes)
1010
+    tr5_room_layer_t* layers;      //!< [NumLayers];
1011
+    //!< data for the room layers (pieces) (56 bytes * NumLayers)
1012
+    tr5_room_geometry_t* faces;    //!< [NumRoomRectangles + NumRoomTriangles];
1013
+    /* Data for the room polys (face4 and face3).
1014
+     * Structured as first layers rectangles
1015
+     * then triangles, followed by the
1016
+     * next layers rectangles and triangles, etc.,
1017
+     * until all layers are done.
1018
+     * (12 bytes each rectangle. 10 bytes each triangle)
1019
+     */
1020
+    tr5_vertex_t* vertices;        //!< [VerticesSize];
1021
+    /*!< Data for the room vertices.
1022
+     * Structured as vertices for the first layer,
1023
+     * then vertices for the second layer, etc.,
1024
+     * until all layers are done.
1025
+     * (28 bytes each vertex.
1026
+     */
1026 1027
 } tr5_room_t;
1027 1028
 
1028 1029
 /*!
@@ -1030,10 +1031,10 @@ typedef struct {
1030 1031
  */
1031 1032
 typedef struct {
1032 1033
     uint8_t xCoordinate; //!< 0 if Xpixel is the low value,
1033
-                          //!< 255 if Xpixel is the high value in the object texture (1 byte)
1034
+    //!< 255 if Xpixel is the high value in the object texture (1 byte)
1034 1035
     uint8_t xPixel;      //!< (1 byte)
1035 1036
     uint8_t yCoordinate; //!< 0 if Ypixel is the low value,
1036
-                          //!< 255 if Ypixel is the high value in the object texture (1 byte)
1037
+    //!< 255 if Ypixel is the high value in the object texture (1 byte)
1037 1038
     uint8_t yPixel;      //!< (1 byte)
1038 1039
 } tr5_object_texture_vertex_t;
1039 1040
 
@@ -1043,7 +1044,7 @@ typedef struct {
1043 1044
 typedef struct {
1044 1045
     uint16_t attribute;                     //!< 0, 1, or 2 (2 means 2 sided) (2 bytes)
1045 1046
     uint32_t tile;                          //!< need to mask with 0xFF as other bits are flags.
1046
-                                             //!< ie int15_t seems to indicate triangle (4 bytes)
1047
+    //!< ie int15_t seems to indicate triangle (4 bytes)
1047 1048
     tr5_object_texture_vertex_t vertices[4]; //!< Vertices[4] (16 bytes)
1048 1049
     uint32_t uv1;                           //!< unknown how used (4 bytes)
1049 1050
     uint32_t uv2;                           //!< unknown how used (4 bytes)
@@ -1091,14 +1092,14 @@ typedef struct {
1091 1092
     tr2_vertex_t center;             //!< relative coordinates of mesh centre (6 bytes)
1092 1093
     uint8_t unknown1[4];            //!< unknown (4 bytes)
1093 1094
     int16_t numVertices;             //!< number of vertices to follow (2 bytes)
1094
-    tr2_vertex_t *vertices;          //!< list of vertices (NumVertices * 6 bytes)
1095
+    tr2_vertex_t* vertices;          //!< list of vertices (NumVertices * 6 bytes)
1095 1096
     int16_t numNormals;              //!< number of normals to follow (2 bytes)
1096
-    tr2_vertex_t *normals;           //!< list of normals (NumNormals * 6 bytes)
1097
-                                     //!< (becomes Lights if NumNormals < 0; 2 bytes)
1097
+    tr2_vertex_t* normals;           //!< list of normals (NumNormals * 6 bytes)
1098
+    //!< (becomes Lights if NumNormals < 0; 2 bytes)
1098 1099
     int16_t numTexturedRectangles;   //!< number of textured rectangles to follow (2 bytes)
1099
-    tr5_face4_t *texturedRectangles; //!< list of textured rectangles (NumTexturedRectangles * 12 bytes)
1100
+    tr5_face4_t* texturedRectangles; //!< list of textured rectangles (NumTexturedRectangles * 12 bytes)
1100 1101
     int16_t numTexturedTriangles;    //!< number of textured triangles to follow (2 bytes)
1101
-    tr5_face3_t *texturedTriangles;  //!< list of textured triangles (NumTexturedTriangles * 10 bytes)
1102
+    tr5_face3_t* texturedTriangles;  //!< list of textured triangles (NumTexturedTriangles * 10 bytes)
1102 1103
 } tr5_mesh_t;
1103 1104
 
1104 1105
 /*!

+ 3
- 3
include/UI.h Wyświetl plik

@@ -16,7 +16,7 @@
16 16
 #include "imgui/imgui.h"
17 17
 
18 18
 class UI {
19
-public:
19
+  public:
20 20
     static int initialize();
21 21
     static void eventsFinished();
22 22
     static void display();
@@ -26,14 +26,14 @@ public:
26 26
     static bool isVisible();
27 27
 
28 28
     static void handleKeyboard(KeyboardButton key, bool pressed);
29
-    static void handleText(char *text, bool notFinished);
29
+    static void handleText(char* text, bool notFinished);
30 30
     static void handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released);
31 31
     static void handleMouseMotion(int xrel, int yrel, int xabs, int yabs);
32 32
     static void handleMouseScroll(int xrel, int yrel);
33 33
 
34 34
     static void renderImGui(ImDrawList** const draw_lists, int count);
35 35
 
36
-private:
36
+  private:
37 37
     static bool visible;
38 38
     static unsigned int fontTex;
39 39
     static std::string iniFilename;

+ 2
- 2
include/ViewVolume.h Wyświetl plik

@@ -14,7 +14,7 @@
14 14
  * \brief Viewing Volume for culling use
15 15
  */
16 16
 class ViewVolume {
17
-public:
17
+  public:
18 18
 
19 19
     /*!
20 20
      * \brief Sides of the view volume
@@ -127,7 +127,7 @@ public:
127 127
      */
128 128
     void setProjection(float proj[16]);
129 129
 
130
-private:
130
+  private:
131 131
 
132 132
     /*!
133 133
      * \brief Computes clipping matrix.

+ 5
- 5
include/Window.h Wyświetl plik

@@ -12,7 +12,7 @@
12 12
  * \brief Windowing interface
13 13
  */
14 14
 class Window {
15
-public:
15
+  public:
16 16
 
17 17
     virtual ~Window() {}
18 18
 
@@ -47,10 +47,10 @@ public:
47 47
     virtual void glExit2D();
48 48
 
49 49
     static void lookAt(float eyeX, float eyeY, float eyeZ,
50
-                        float lookAtX, float lookAtY, float lookAtZ,
51
-                        float upX, float upY, float upZ);
50
+                       float lookAtX, float lookAtY, float lookAtZ,
51
+                       float upX, float upY, float upZ);
52 52
 
53
-protected:
53
+  protected:
54 54
     bool mInit;
55 55
     bool mFullscreen;
56 56
     bool mMousegrab;
@@ -59,7 +59,7 @@ protected:
59 59
     unsigned int mHeight;
60 60
 };
61 61
 
62
-Window &getWindow();
62
+Window& getWindow();
63 63
 
64 64
 #endif
65 65
 

+ 2
- 2
include/WindowGLUT.h Wyświetl plik

@@ -14,7 +14,7 @@
14 14
  * \brief GLUT windowing implementation
15 15
  */
16 16
 class WindowGLUT : public Window {
17
-public:
17
+  public:
18 18
 
19 19
     WindowGLUT();
20 20
 
@@ -32,7 +32,7 @@ public:
32 32
 
33 33
     virtual void swapBuffersGL();
34 34
 
35
-private:
35
+  private:
36 36
     static void reshapeCallback(int width, int height);
37 37
     static void keyboardCallback(unsigned char key, int x, int y);
38 38
     static void keyboardUpCallback(unsigned char key, int x, int y);

+ 3
- 3
include/WindowSDL.h Wyświetl plik

@@ -16,7 +16,7 @@
16 16
  * \brief SDL windowing implementation
17 17
  */
18 18
 class WindowSDL : public Window {
19
-public:
19
+  public:
20 20
 
21 21
     /*!
22 22
      * \brief Constructs an object of WindowSDL
@@ -42,8 +42,8 @@ public:
42 42
 
43 43
     virtual void swapBuffersGL();
44 44
 
45
-private:
46
-    SDL_Window *mWindow;      //!< This is the pointer to the SDL surface
45
+  private:
46
+    SDL_Window* mWindow;      //!< This is the pointer to the SDL surface
47 47
     SDL_GLContext mGLContext; //!< The OpenGL Context
48 48
 };
49 49
 

+ 13
- 13
include/World.h Wyświetl plik

@@ -22,7 +22,7 @@
22 22
  * \brief The game world (model)
23 23
  */
24 24
 class World {
25
-public:
25
+  public:
26 26
 
27 27
     /*!
28 28
      * \brief Deconstructs an object of World
@@ -34,25 +34,25 @@ public:
34 34
      */
35 35
     void destroy();
36 36
 
37
-    void addRoom(Room &room);
37
+    void addRoom(Room& room);
38 38
     unsigned long sizeRoom();
39
-    Room &getRoom(unsigned long index);
39
+    Room& getRoom(unsigned long index);
40 40
 
41
-    void addSprite(SpriteSequence &sprite);
41
+    void addSprite(SpriteSequence& sprite);
42 42
     unsigned long sizeSprite();
43
-    SpriteSequence &getSprite(unsigned long index);
43
+    SpriteSequence& getSprite(unsigned long index);
44 44
 
45
-    void addEntity(Entity &entity);
45
+    void addEntity(Entity& entity);
46 46
     unsigned long sizeEntity();
47
-    Entity &getEntity(unsigned long index);
47
+    Entity& getEntity(unsigned long index);
48 48
 
49
-    void addSkeletalModel(SkeletalModel &model);
49
+    void addSkeletalModel(SkeletalModel& model);
50 50
     unsigned long sizeSkeletalModel();
51
-    SkeletalModel &getSkeletalModel(unsigned long index);
51
+    SkeletalModel& getSkeletalModel(unsigned long index);
52 52
 
53
-    void addStaticMesh(StaticMesh &model);
53
+    void addStaticMesh(StaticMesh& model);
54 54
     unsigned long sizeStaticMesh();
55
-    StaticMesh &getStaticMesh(unsigned long index);
55
+    StaticMesh& getStaticMesh(unsigned long index);
56 56
 
57 57
     /*!
58 58
      * \brief Find room a location is in.
@@ -77,7 +77,7 @@ public:
77 77
      */
78 78
     long getRoomByLocation(float x, float y, float z);
79 79
 
80
-private:
80
+  private:
81 81
     std::vector<std::unique_ptr<Room>> mRooms;
82 82
     std::vector<std::unique_ptr<SpriteSequence>> mSprites;
83 83
     std::vector<std::unique_ptr<Entity>> mEntities;
@@ -85,6 +85,6 @@ private:
85 85
     std::vector<std::unique_ptr<StaticMesh>> mMeshes;
86 86
 };
87 87
 
88
-World &getWorld();
88
+World& getWorld();
89 89
 
90 90
 #endif

+ 2
- 2
include/commands/Command.h Wyświetl plik

@@ -14,7 +14,7 @@
14 14
 #include <vector>
15 15
 
16 16
 class Command {
17
-public:
17
+  public:
18 18
     virtual ~Command();
19 19
     virtual std::string name() = 0;
20 20
     virtual std::string brief() = 0;
@@ -25,7 +25,7 @@ public:
25 25
     static int command(std::string c);
26 26
     static int executeFile(std::string file);
27 27
 
28
-private:
28
+  private:
29 29
     static std::vector<std::shared_ptr<Command>> commands;
30 30
 };
31 31
 

+ 1
- 1
include/commands/CommandAnimate.h Wyświetl plik

@@ -11,7 +11,7 @@
11 11
 #include "commands/Command.h"
12 12
 
13 13
 class CommandAnimate : public Command {
14
-public:
14
+  public:
15 15
     virtual std::string name();
16 16
     virtual std::string brief();
17 17
     virtual void printHelp();

+ 2
- 2
include/commands/CommandBind.h Wyświetl plik

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

+ 3
- 3
include/commands/CommandEngine.h Wyświetl plik

@@ -11,7 +11,7 @@
11 11
 #include "commands/Command.h"
12 12
 
13 13
 class CommandLoad : public Command {
14
-public:
14
+  public:
15 15
     virtual std::string name();
16 16
     virtual std::string brief();
17 17
     virtual void printHelp();
@@ -19,7 +19,7 @@ public:
19 19
 };
20 20
 
21 21
 class CommandScreenshot : public Command {
22
-public:
22
+  public:
23 23
     virtual std::string name();
24 24
     virtual std::string brief();
25 25
     virtual void printHelp();
@@ -27,7 +27,7 @@ public:
27 27
 };
28 28
 
29 29
 class CommandQuit : public Command {
30
-public:
30
+  public:
31 31
     virtual std::string name();
32 32
     virtual std::string brief();
33 33
     virtual int execute(std::istream& args);

+ 4
- 4
include/commands/CommandGame.h Wyświetl plik

@@ -11,28 +11,28 @@
11 11
 #include "commands/Command.h"
12 12
 
13 13
 class CommandPos : public Command {
14
-public:
14
+  public:
15 15
     virtual std::string name();
16 16
     virtual std::string brief();
17 17
     virtual int execute(std::istream& args);
18 18
 };
19 19
 
20 20
 class CommandViewmodel : public Command {
21
-public:
21
+  public:
22 22
     virtual std::string name();
23 23
     virtual std::string brief();
24 24
     virtual int execute(std::istream& args);
25 25
 };
26 26
 
27 27
 class CommandPigtail : public Command {
28
-public:
28
+  public:
29 29
     virtual std::string name();
30 30
     virtual std::string brief();
31 31
     virtual int execute(std::istream& args);
32 32
 };
33 33
 
34 34
 class CommandPonypos : public Command {
35
-public:
35
+  public:
36 36
     virtual std::string name();
37 37
     virtual std::string brief();
38 38
     virtual int execute(std::istream& args);

+ 1
- 1
include/commands/CommandMove.h Wyświetl plik

@@ -11,7 +11,7 @@
11 11
 #include "commands/Command.h"
12 12
 
13 13
 class CommandMove : public Command {
14
-public:
14
+  public:
15 15
     virtual std::string name();
16 16
     virtual std::string brief();
17 17
     virtual void printHelp();

+ 3
- 3
include/commands/CommandRender.h Wyświetl plik

@@ -11,7 +11,7 @@
11 11
 #include "commands/Command.h"
12 12
 
13 13
 class CommandMode : public Command {
14
-public:
14
+  public:
15 15
     virtual std::string name();
16 16
     virtual std::string brief();
17 17
     virtual void printHelp();
@@ -19,13 +19,13 @@ public:
19 19
 };
20 20
 
21 21
 class CommandRenderflag : public Command {
22
-public:
22
+  public:
23 23
     virtual std::string name();
24 24
     virtual std::string brief();
25 25
     virtual void printHelp();
26 26
     virtual int execute(std::istream& args);
27 27
 
28
-private:
28
+  private:
29 29
     int stringToFlag(std::string flag);
30 30
 };
31 31
 

+ 1
- 1
include/commands/CommandSet.h Wyświetl plik

@@ -11,7 +11,7 @@
11 11
 #include "commands/Command.h"
12 12
 
13 13
 class CommandSet : public Command {
14
-public:
14
+  public:
15 15
     virtual std::string name();
16 16
     virtual std::string brief();
17 17
     virtual void printHelp();

+ 1
- 1
include/commands/CommandSound.h Wyświetl plik

@@ -11,7 +11,7 @@
11 11
 #include "commands/Command.h"
12 12
 
13 13
 class CommandSound : public Command {
14
-public:
14
+  public:
15 15
     virtual std::string name();
16 16
     virtual std::string brief();
17 17
     virtual void printHelp();

+ 1
- 1
include/games/TombRaider1.h Wyświetl plik

@@ -14,7 +14,7 @@
14 14
  * \brief Tomb Raider 1 items and states
15 15
  */
16 16
 class TombRaider1 {
17
-public:
17
+  public:
18 18
 
19 19
     /*!
20 20
      * \brief States of a Wolf (Item 7)

+ 8
- 6
include/global.h Wyświetl plik

@@ -107,11 +107,12 @@ typedef enum {
107 107
 #include <execinfo.h>
108 108
 
109 109
 template<typename T, typename U>
110
-[[noreturn]] void assertEqualImplementation(const char *exp, T a, U b, const char *file, int line, bool print) {
110
+[[noreturn]] void assertEqualImplementation(const char* exp, T a, U b, const char* file, int line,
111
+        bool print) {
111 112
     const unsigned int maxSize = 128;
112
-    void *callstack[maxSize];
113
+    void* callstack[maxSize];
113 114
     int frames = backtrace(callstack, maxSize);
114
-    char **strs = backtrace_symbols(callstack, frames);
115
+    char** strs = backtrace_symbols(callstack, frames);
115 116
 
116 117
     std::cout << std::endl << "assertion failed:" << std::endl;
117 118
     std::cout << "\t" << exp << std::endl;
@@ -127,11 +128,12 @@ template<typename T, typename U>
127 128
 }
128 129
 
129 130
 template<typename T, typename U>
130
-[[noreturn]] void assertNotEqualImplementation(const char *exp, T a, U b, const char *file, int line, bool print) {
131
+[[noreturn]] void assertNotEqualImplementation(const char* exp, T a, U b, const char* file,
132
+        int line, bool print) {
131 133
     const unsigned int maxSize = 128;
132
-    void *callstack[maxSize];
134
+    void* callstack[maxSize];
133 135
     int frames = backtrace(callstack, maxSize);
134
-    char **strs = backtrace_symbols(callstack, frames);
136
+    char** strs = backtrace_symbols(callstack, frames);
135 137
 
136 138
     std::cout << std::endl << "assertion failed:" << std::endl;
137 139
     std::cout << "\t" << exp << std::endl;

+ 2
- 2
include/loader/Loader.h Wyświetl plik

@@ -14,7 +14,7 @@
14 14
 #include "utils/binary.h"
15 15
 
16 16
 class Loader {
17
-public:
17
+  public:
18 18
 
19 19
     typedef enum {
20 20
         TR_UNKNOWN = 0,
@@ -33,7 +33,7 @@ public:
33 33
 
34 34
     virtual int load(std::string f) = 0;
35 35
 
36
-protected:
36
+  protected:
37 37
     BinaryFile file;
38 38
 };
39 39
 

+ 2
- 2
include/loader/LoaderTR1.h Wyświetl plik

@@ -11,13 +11,13 @@
11 11
 #include "loader/Loader.h"
12 12
 
13 13
 class LoaderTR1 : public Loader {
14
-public:
14
+  public:
15 15
     LoaderTR1();
16 16
     virtual ~LoaderTR1();
17 17
 
18 18
     virtual int load(std::string f);
19 19
 
20
-private:
20
+  private:
21 21
 
22 22
 };
23 23
 

+ 2
- 2
include/loader/LoaderTR2.h Wyświetl plik

@@ -11,13 +11,13 @@
11 11
 #include "loader/Loader.h"
12 12
 
13 13
 class LoaderTR2 : public Loader {
14
-public:
14
+  public:
15 15
     LoaderTR2();
16 16
     virtual ~LoaderTR2();
17 17
 
18 18
     virtual int load(std::string f);
19 19
 
20
-private:
20
+  private:
21 21
     void loadPaletteTextiles();
22 22
     void loadRooms();
23 23
     void loadFloorData();

+ 2
- 2
include/loader/LoaderTR3.h Wyświetl plik

@@ -11,13 +11,13 @@
11 11
 #include "loader/Loader.h"
12 12
 
13 13
 class LoaderTR3 : public Loader {
14
-public:
14
+  public:
15 15
     LoaderTR3();
16 16
     virtual ~LoaderTR3();
17 17
 
18 18
     virtual int load(std::string f);
19 19
 
20
-private:
20
+  private:
21 21
 
22 22
 };
23 23
 

+ 8
- 8
include/math/Matrix.h Wyświetl plik

@@ -35,7 +35,7 @@
35 35
  *     ///////////////////////////////////////////////
36 36
  */
37 37
 class Matrix {
38
-public:
38
+  public:
39 39
 
40 40
     /*!
41 41
      * \brief Constructs an object of Matrix
@@ -52,7 +52,7 @@ public:
52 52
      * \brief Constructs an object of Matrix
53 53
      * \param q Converts and assigns the Quaternion to the Matrix
54 54
      */
55
-    Matrix(Quaternion &q);
55
+    Matrix(Quaternion& q);
56 56
 
57 57
     /*!
58 58
      * \brief Returns this matrix copy
@@ -78,7 +78,7 @@ public:
78 78
      * \param b second matrix
79 79
      * \returns resultant matrix
80 80
      */
81
-    static Matrix multiply(const Matrix &a, const Matrix &b);
81
+    static Matrix multiply(const Matrix& a, const Matrix& b);
82 82
 
83 83
     /*!
84 84
      * \brief Multiplies v vector and this matrix
@@ -110,7 +110,7 @@ public:
110 110
      * \param a matrix to multiply with
111 111
      * \returns resultant matrix
112 112
      */
113
-    Matrix operator *(const Matrix &a);
113
+    Matrix operator *(const Matrix& a);
114 114
 
115 115
     /*!
116 116
      * \brief Multiply vector by this matrix
@@ -143,7 +143,7 @@ public:
143 143
      * \brief Rotate object in 3D space
144 144
      * \param xyz rotation in radians
145 145
      */
146
-    void rotate(const float *xyz);
146
+    void rotate(const float* xyz);
147 147
 
148 148
     /*!
149 149
      * \brief Scale object in 3D space
@@ -157,7 +157,7 @@ public:
157 157
      * \brief Scale object in 3D space
158 158
      * \param xyz scaling factors
159 159
      */
160
-    void scale(const float *xyz);
160
+    void scale(const float* xyz);
161 161
 
162 162
     /*!
163 163
      * \brief Translate (move) object in 3D space
@@ -171,7 +171,7 @@ public:
171 171
      * \brief Translate (move) object in 3D space
172 172
      * \param xyz translations
173 173
      */
174
-    void translate(const float *xyz);
174
+    void translate(const float* xyz);
175 175
 
176 176
     /*!
177 177
      * \brief Transpose this matrix
@@ -180,7 +180,7 @@ public:
180 180
 
181 181
     float mMatrix[16]; //!< Data model, moved public for faster external renderer feedback use
182 182
 
183
-private:
183
+  private:
184 184
 
185 185
     /*!
186 186
      * \brief Copys value from source to dest

+ 7
- 7
include/math/Quaternion.h Wyświetl plik

@@ -14,7 +14,7 @@
14 14
  * \brief Quaternion
15 15
  */
16 16
 class Quaternion {
17
-public:
17
+  public:
18 18
 
19 19
     /*!
20 20
      * \brief Constructs an object of Quaternion
@@ -51,35 +51,35 @@ public:
51 51
      * \returns resultant quaternion
52 52
      * \sa Quaternion::normalize()
53 53
      */
54
-    Quaternion operator *(const Quaternion &q);
54
+    Quaternion operator *(const Quaternion& q);
55 55
 
56 56
     /*!
57 57
      * \brief Divide from this quaternion
58 58
      * \param q what to divide from this quaternion
59 59
      * \returns resultant quaternion
60 60
      */
61
-    Quaternion operator /(const Quaternion &q);
61
+    Quaternion operator /(const Quaternion& q);
62 62
 
63 63
     /*!
64 64
      * \brief Add to this quaternion
65 65
      * \param q what to add to this quaternion
66 66
      * \returns resultant quaternion
67 67
      */
68
-    Quaternion operator +(const Quaternion &q);
68
+    Quaternion operator +(const Quaternion& q);
69 69
 
70 70
     /*!
71 71
      * \brief Subtract from this quaternion
72 72
      * \param q what to subtract from this quaternion
73 73
      * \returns resultant quaternion
74 74
      */
75
-    Quaternion operator -(const Quaternion &q);
75
+    Quaternion operator -(const Quaternion& q);
76 76
 
77 77
     /*!
78 78
      * \brief Compares q to this quaternion
79 79
      * \param q what to compare this quaternion to
80 80
      * \returns true if equal, false otherwise
81 81
      */
82
-    bool operator ==(const Quaternion &q);
82
+    bool operator ==(const Quaternion& q);
83 83
 
84 84
     /*!
85 85
      * \brief Conjugate this quaternion
@@ -158,7 +158,7 @@ public:
158 158
      */
159 159
     void setByMatrix(float m[16]);
160 160
 
161
-private:
161
+  private:
162 162
 
163 163
     /*!
164 164
      * \brief Multiplies two quaternions

+ 11
- 11
include/math/Vector3d.h Wyświetl plik

@@ -14,7 +14,7 @@
14 14
  * \brief 3D Math Vector
15 15
  */
16 16
 class Vector3d {
17
-public:
17
+  public:
18 18
 
19 19
     /*!
20 20
      * \brief Constructs an object of Vector3d
@@ -39,7 +39,7 @@ public:
39 39
      * \brief Constructs an object of Vector3d
40 40
      * \param v contents of new Vector3d
41 41
      */
42
-    Vector3d(const Vector3d &v);
42
+    Vector3d(const Vector3d& v);
43 43
 
44 44
     /*!
45 45
      * \brief Calculate dot product
@@ -47,7 +47,7 @@ public:
47 47
      * \param v second argument
48 48
      * \returns dot product of u and v vectors
49 49
      */
50
-    static float dot(const Vector3d &u, const Vector3d &v);
50
+    static float dot(const Vector3d& u, const Vector3d& v);
51 51
 
52 52
     /*!
53 53
      * \brief Calculate cross product
@@ -55,7 +55,7 @@ public:
55 55
      * \param v second argument
56 56
      * \returns cross product of u and v vectors
57 57
      */
58
-    static Vector3d cross(const Vector3d &u, const Vector3d &v);
58
+    static Vector3d cross(const Vector3d& u, const Vector3d& v);
59 59
 
60 60
     /*!
61 61
      * \brief Get Magnitude
@@ -80,14 +80,14 @@ public:
80 80
      * \param v addend
81 81
      * \returns a vector = this vector + v
82 82
      */
83
-    Vector3d operator +(const Vector3d &v);
83
+    Vector3d operator +(const Vector3d& v);
84 84
 
85 85
     /*!
86 86
      * \brief Subtract from this vector
87 87
      * \param v subtrahend
88 88
      * \returns a vector = this vector - v
89 89
      */
90
-    Vector3d operator -(const Vector3d &v);
90
+    Vector3d operator -(const Vector3d& v);
91 91
 
92 92
     /*!
93 93
      * \brief Negate this vector
@@ -114,7 +114,7 @@ public:
114 114
      * \param v second vector for dot product
115 115
      * \returns dot product of V by this vector
116 116
      */
117
-    float operator *(const Vector3d &v);
117
+    float operator *(const Vector3d& v);
118 118
 
119 119
     /*!
120 120
      * \brief Normalizes this vector
@@ -131,28 +131,28 @@ public:
131 131
      * \param v what this vector will be set to
132 132
      * \returns this vector, now equal to v
133 133
      */
134
-    Vector3d &operator =(const Vector3d &v);
134
+    Vector3d& operator =(const Vector3d& v);
135 135
 
136 136
     /*!
137 137
      * \brief Add to this vector, in place
138 138
      * \param v what will be added to this vector
139 139
      * \returns this vector, with v added
140 140
      */
141
-    Vector3d &operator +=(const Vector3d &v);
141
+    Vector3d& operator +=(const Vector3d& v);
142 142
 
143 143
     /*!
144 144
      * \brief Subtract from this vector, in place
145 145
      * \param v what will be subtracted from this vector
146 146
      * \returns this vector, with v subtracted
147 147
      */
148
-    Vector3d &operator -=(const Vector3d &v);
148
+    Vector3d& operator -=(const Vector3d& v);
149 149
 
150 150
     /*!
151 151
      * \brief Scale this vector, in place
152 152
      * \param s scaling factor
153 153
      * \returns this vactor multiplied by s
154 154
      */
155
-    Vector3d &operator *=(float s);
155
+    Vector3d& operator *=(float s);
156 156
 
157 157
     float mVec[3]; //!< Vector data
158 158
 };

+ 4
- 4
include/utils/File.h Wyświetl plik

@@ -13,13 +13,13 @@
13 13
 class Folder;
14 14
 
15 15
 class File {
16
-public:
16
+  public:
17 17
     File(std::string file);
18 18
 
19
-    std::string &getName();
20
-    std::string &getPath();
19
+    std::string& getName();
20
+    std::string& getPath();
21 21
 
22
-private:
22
+  private:
23 23
     std::string name;
24 24
     std::string path;
25 25
 };

+ 10
- 10
include/utils/Folder.h Wyświetl plik

@@ -17,33 +17,33 @@
17 17
 #include <vector>
18 18
 
19 19
 class Folder {
20
-public:
20
+  public:
21 21
     Folder(std::string folder, bool listDotFiles = false);
22 22
 
23
-    std::string &getName();
24
-    std::string &getPath();
23
+    std::string& getName();
24
+    std::string& getPath();
25 25
 
26 26
     unsigned long fileCount();
27
-    File &getFile(unsigned long i);
27
+    File& getFile(unsigned long i);
28 28
 
29 29
     unsigned long folderCount();
30
-    Folder &getFolder(unsigned long i);
30
+    Folder& getFolder(unsigned long i);
31 31
 
32 32
     Folder getParent();
33 33
 
34
-    void executeRemoveFiles(std::function<bool (File &f)> func);
34
+    void executeRemoveFiles(std::function<bool (File& f)> func);
35 35
 
36 36
     // Accessing a folder recursively
37 37
     // This treats all files in all subfolders as if they were in this folder
38 38
     unsigned long countRecursiveFiles();
39
-    void executeRemoveRecursiveFiles(std::function<bool (File &f)> func);
39
+    void executeRemoveRecursiveFiles(std::function<bool (File& f)> func);
40 40
     std::string getRecursiveFileName(unsigned long i);
41
-    File &getRecursiveFile(unsigned long i);
41
+    File& getRecursiveFile(unsigned long i);
42 42
 
43
-private:
43
+  private:
44 44
 
45 45
     void createFolderItems();
46
-    int readFolderItems(std::vector<std::string> &foundFiles, std::vector<std::string> &foundFolders);
46
+    int readFolderItems(std::vector<std::string>& foundFiles, std::vector<std::string>& foundFolders);
47 47
 
48 48
     std::string name; //!< Only last part of path
49 49
     std::string path; //!< Full path, with name and '/' at end

+ 3
- 3
include/utils/binary.h Wyświetl plik

@@ -11,11 +11,11 @@
11 11
 #include <fstream>
12 12
 
13 13
 class BinaryFile {
14
-public:
14
+  public:
15 15
 
16 16
     ~BinaryFile();
17 17
 
18
-    int open(const char *f);
18
+    int open(const char* f);
19 19
 
20 20
     long long tell();
21 21
     void seek(long long pos);
@@ -34,7 +34,7 @@ public:
34 34
 
35 35
     float readFloat();
36 36
 
37
-private:
37
+  private:
38 38
     std::ifstream file;
39 39
 };
40 40
 

+ 3
- 3
include/utils/pcx.h Wyświetl plik

@@ -16,7 +16,7 @@
16 16
  * \param filename path of file to read
17 17
  * \returns 0 on success
18 18
  */
19
-int pcxCheck(const char *filename);
19
+int pcxCheck(const char* filename);
20 20
 
21 21
 /*!
22 22
  * \brief Load a PCX image file into a buffer
@@ -28,8 +28,8 @@ int pcxCheck(const char *filename);
28 28
  * \param bpp place where pixel width will be stored (8, 24, 32)
29 29
  * \returns 0 on success
30 30
  */
31
-int pcxLoad(const char *filename, unsigned char **image,
32
-        unsigned int *width, unsigned int *height, ColorMode *mode, unsigned int *bpp);
31
+int pcxLoad(const char* filename, unsigned char** image,
32
+            unsigned int* width, unsigned int* height, ColorMode* mode, unsigned int* bpp);
33 33
 
34 34
 #endif
35 35
 

+ 7
- 6
include/utils/pixel.h Wyświetl plik

@@ -8,14 +8,15 @@
8 8
 #ifndef _UTILS_PIXEL_H_
9 9
 #define _UTILS_PIXEL_H_
10 10
 
11
-unsigned char *generateColorTexture(const unsigned char *rgba, unsigned int width,
12
-        unsigned int height, unsigned int bpp);
11
+unsigned char* generateColorTexture(const unsigned char* rgba, unsigned int width,
12
+                                    unsigned int height, unsigned int bpp);
13 13
 
14
-void bgr2rgb24(unsigned char *image, unsigned int w, unsigned int h);
15
-void bgra2rgba32(unsigned char *image, unsigned int w, unsigned int h);
16
-void argb2rgba32(unsigned char *image, unsigned int w, unsigned int h);
14
+void bgr2rgb24(unsigned char* image, unsigned int w, unsigned int h);
15
+void bgra2rgba32(unsigned char* image, unsigned int w, unsigned int h);
16
+void argb2rgba32(unsigned char* image, unsigned int w, unsigned int h);
17 17
 
18
-unsigned char *scaleBuffer(unsigned char *image, unsigned int *w, unsigned int *h, unsigned int bpp);
18
+unsigned char* scaleBuffer(unsigned char* image, unsigned int* w, unsigned int* h,
19
+                           unsigned int bpp);
19 20
 
20 21
 #endif
21 22
 

+ 5
- 5
include/utils/png.h Wyświetl plik

@@ -13,7 +13,7 @@
13 13
  * \param filename path of file to read
14 14
  * \returns 0 on success
15 15
  */
16
-int pngCheck(const char *filename);
16
+int pngCheck(const char* filename);
17 17
 
18 18
 /*!
19 19
  * \brief Load a PNG image file into an RGBA buffer
@@ -25,8 +25,8 @@ int pngCheck(const char *filename);
25 25
  * \param bpp place where pixel width will be stored (8, 24, 32)
26 26
  * \returns 0 on success
27 27
  */
28
-int pngLoad(const char *filename, unsigned char **image,
29
-        unsigned int *width, unsigned int *height, ColorMode *mode, unsigned int *bpp);
28
+int pngLoad(const char* filename, unsigned char** image,
29
+            unsigned int* width, unsigned int* height, ColorMode* mode, unsigned int* bpp);
30 30
 
31 31
 /*!
32 32
  * \brief Create a PNG image file from an RGBA buffer
@@ -38,8 +38,8 @@ int pngLoad(const char *filename, unsigned char **image,
38 38
  * \param bpp bits per pixel (8, 24, 32)
39 39
  * \returns 0 on success
40 40
  */
41
-int pngSave(const char *filename, unsigned char *image,
42
-        unsigned int width, unsigned int height, ColorMode mode, unsigned int bpp);
41
+int pngSave(const char* filename, unsigned char* image,
42
+            unsigned int width, unsigned int height, ColorMode mode, unsigned int bpp);
43 43
 
44 44
 #endif
45 45
 

+ 5
- 5
include/utils/tga.h Wyświetl plik

@@ -13,7 +13,7 @@
13 13
  * \param filename path to file
14 14
  * \returns 0 if valid, else error condition
15 15
  */
16
-int tgaCheck(const char *filename);
16
+int tgaCheck(const char* filename);
17 17
 
18 18
 /*!
19 19
  * \brief Load a TGA image from file
@@ -24,8 +24,8 @@ int tgaCheck(const char *filename);
24 24
  * \param type where the type will be stored (tga_type_t)
25 25
  * \returns 0 on success, else error condition
26 26
  */
27
-int tgaLoad(const char *filename, unsigned char **image,
28
-                unsigned int *width, unsigned int *height, char *type);
27
+int tgaLoad(const char* filename, unsigned char** image,
28
+            unsigned int* width, unsigned int* height, char* type);
29 29
 
30 30
 /*!
31 31
  * \brief Save a pixel buffer into a file on disk
@@ -36,8 +36,8 @@ int tgaLoad(const char *filename, unsigned char **image,
36 36
  * \param type tga type to use
37 37
  * \returns 0 on success, else error condition
38 38
  */
39
-int tgaSave(const char *filename, unsigned char *image,
40
-                unsigned int width, unsigned int height, char type);
39
+int tgaSave(const char* filename, unsigned char* image,
40
+            unsigned int width, unsigned int height, char type);
41 41
 
42 42
 #endif
43 43
 

+ 1
- 1
src/Console.cpp Wyświetl plik

@@ -78,7 +78,7 @@ void Console::display() {
78 78
         }
79 79
 
80 80
         if (ImGui::InputText("Command", buffer, bufferLength,
81
-                    ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_EnterReturnsTrue)) {
81
+                             ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_EnterReturnsTrue)) {
82 82
             getLog() << "> " << buffer << Log::endl;
83 83
             int error = Command::command(buffer);
84 84
             if (error != 0) {

+ 15
- 15
src/Entity.cpp Wyświetl plik

@@ -15,9 +15,9 @@
15 15
 
16 16
 #include "games/TombRaider1.h"
17 17
 
18
-Entity::Entity(TombRaider &tr, unsigned int index, unsigned int i, unsigned int model) {
19
-    tr2_moveable_t *moveable = tr.Moveable();
20
-    tr2_item_t *item = tr.Item();
18
+Entity::Entity(TombRaider& tr, unsigned int index, unsigned int i, unsigned int model) {
19
+    tr2_moveable_t* moveable = tr.Moveable();
20
+    tr2_item_t* item = tr.Item();
21 21
 
22 22
     pos[0] = item[i].x;
23 23
     pos[1] = item[i].y;
@@ -35,13 +35,13 @@ Entity::Entity(TombRaider &tr, unsigned int index, unsigned int i, unsigned int
35 35
     state = 0;
36 36
 }
37 37
 
38
-bool Entity::operator<(Entity &o) {
38
+bool Entity::operator<(Entity& o) {
39 39
     float distA = getRender().mViewVolume.getDistToSphereFromNear(pos[0], pos[1], pos[2], 1.0f);
40 40
     float distB = getRender().mViewVolume.getDistToSphereFromNear(o.pos[0], o.pos[1], o.pos[2], 1.0f);
41 41
     return (distA < distB);
42 42
 }
43 43
 
44
-bool Entity::compare(Entity *a, Entity *b) {
44
+bool Entity::compare(Entity* a, Entity* b) {
45 45
     return (*b) < (*a);
46 46
 }
47 47
 
@@ -114,7 +114,7 @@ void Entity::move(char movement) {
114 114
 
115 115
     if (roomNew == -1) { // Will we hit a portal?
116 116
         roomNew = getWorld().getRoom(room).getAdjoiningRoom(pos[0], pos[1], pos[2],
117
-                x, y, z);
117
+                  x, y, z);
118 118
 
119 119
         if (roomNew > -1)
120 120
             getLog() << "Crossing from room " << room << " to " << roomNew << Log::endl;
@@ -139,9 +139,9 @@ void Entity::move(char movement) {
139 139
     // Mongoose 2002.09.02, Add check for room -> room transition
140 140
     // (Only allow by movement between rooms by using portals)
141 141
     if (((moveType == MoveTypeNoClipping) ||
142
-                (moveType == MoveTypeFly) ||
143
-                (moveType == MoveTypeSwim)) ||
144
-            ((roomNew > -1) && (!wall))) {
142
+         (moveType == MoveTypeFly) ||
143
+         (moveType == MoveTypeSwim)) ||
144
+        ((roomNew > -1) && (!wall))) {
145 145
         room = roomNew;
146 146
 
147 147
         switch (movement) {
@@ -214,14 +214,14 @@ void Entity::move(char movement) {
214 214
 
215 215
 void Entity::print() {
216 216
     getLog() << "Entity " << objectId << ":" << Log::endl
217
-        << "  Room " << room << " (" << getWorld().getRoom(room).getFlags()
218
-        << ")" << Log::endl
219
-        << "  " << pos[0] << "x " << pos[1] << "y " << pos[2] << "z"
220
-        << Log::endl
221
-        << "  " << OR_RAD_TO_DEG(angles[1]) << " Yaw" << Log::endl;
217
+             << "  Room " << room << " (" << getWorld().getRoom(room).getFlags()
218
+             << ")" << Log::endl
219
+             << "  " << pos[0] << "x " << pos[1] << "y " << pos[2] << "z"
220
+             << Log::endl
221
+             << "  " << OR_RAD_TO_DEG(angles[1]) << " Yaw" << Log::endl;
222 222
 }
223 223
 
224
-SkeletalModel &Entity::getModel() {
224
+SkeletalModel& Entity::getModel() {
225 225
     return getWorld().getSkeletalModel(skeletalModel);
226 226
 }
227 227
 

+ 2
- 2
src/Exception.cpp Wyświetl plik

@@ -10,11 +10,11 @@
10 10
 
11 11
 std::string Exception::lastException("No custom exception since start!");
12 12
 
13
-Exception::Exception(const char *what) : runtime_error(what) {
13
+Exception::Exception(const char* what) : runtime_error(what) {
14 14
     lastException = what;
15 15
 }
16 16
 
17
-Exception::Exception(const std::string &what) : runtime_error(what) {
17
+Exception::Exception(const std::string& what) : runtime_error(what) {
18 18
     lastException = what;
19 19
 }
20 20
 

+ 3
- 3
src/Font.cpp Wyświetl plik

@@ -70,7 +70,7 @@ unsigned int Font::heightText(float scale, unsigned int maxWidth, std::string s)
70 70
 }
71 71
 
72 72
 void Font::drawText(unsigned int x, unsigned int y, float scale,
73
-        const unsigned char color[4], std::string s) {
73
+                    const unsigned char color[4], std::string s) {
74 74
     if (stringEndsWith(fontName, ".pc")) {
75 75
         FontTRLE::drawText(x, y, scale, color, s);
76 76
 #ifdef USING_SDL_FONT
@@ -83,7 +83,7 @@ void Font::drawText(unsigned int x, unsigned int y, float scale,
83 83
 }
84 84
 
85 85
 void Font::drawTextWrapped(unsigned int x, unsigned int y, float scale,
86
-        const unsigned char color[4], unsigned int maxWidth, std::string s) {
86
+                           const unsigned char color[4], unsigned int maxWidth, std::string s) {
87 87
     if (stringEndsWith(fontName, ".pc")) {
88 88
         FontTRLE::drawTextWrapped(x, y, scale, color, maxWidth, s);
89 89
 #ifdef USING_SDL_FONT
@@ -96,7 +96,7 @@ void Font::drawTextWrapped(unsigned int x, unsigned int y, float scale,
96 96
 }
97 97
 
98 98
 void Font::drawTextCentered(unsigned int x, unsigned int y, float scale,
99
-        const unsigned char color[4], unsigned int width, std::string s) {
99
+                            const unsigned char color[4], unsigned int width, std::string s) {
100 100
     drawText(x + ((width / 2) - (widthText(scale, s) / 2)), y, scale, color, s);
101 101
 }
102 102
 

+ 6
- 4
src/FontImGui.cpp Wyświetl plik

@@ -14,12 +14,13 @@
14 14
 
15 15
 unsigned int FontImGui::widthText(float scale, std::string s) {
16 16
     ImGuiIO& io = ImGui::GetIO();
17
-    ImVec2 size = io.Font->CalcTextSizeA(scale * SCALE_CALC, io.DisplaySize.y, s.c_str(), s.c_str() + s.length());
17
+    ImVec2 size = io.Font->CalcTextSizeA(scale * SCALE_CALC, io.DisplaySize.y, s.c_str(),
18
+                                         s.c_str() + s.length());
18 19
     return size.y;
19 20
 }
20 21
 
21 22
 void FontImGui::drawText(unsigned int x, unsigned int y, float scale,
22
-        const unsigned char color[4], std::string s) {
23
+                         const unsigned char color[4], std::string s) {
23 24
     ImGuiIO& io = ImGui::GetIO();
24 25
     ImVec2 pos = ImVec2(x, y);
25 26
     ImU32 col = color[0] | (color[1] << 8) | (color[2] << 16) | (color[3] << 24);
@@ -34,12 +35,13 @@ void FontImGui::drawText(unsigned int x, unsigned int y, float scale,
34 35
 
35 36
 unsigned int FontImGui::heightText(float scale, unsigned int maxWidth, std::string s) {
36 37
     ImGuiIO& io = ImGui::GetIO();
37
-    ImVec2 size = io.Font->CalcTextSizeA(scale * SCALE_CALC, maxWidth, s.c_str(), s.c_str() + s.length());
38
+    ImVec2 size = io.Font->CalcTextSizeA(scale * SCALE_CALC, maxWidth, s.c_str(),
39
+                                         s.c_str() + s.length());
38 40
     return size.x;
39 41
 }
40 42
 
41 43
 void FontImGui::drawTextWrapped(unsigned int x, unsigned int y, float scale,
42
-        const unsigned char color[4], unsigned int maxWidth, std::string s) {
44
+                                const unsigned char color[4], unsigned int maxWidth, std::string s) {
43 45
     drawText(x, y, scale, color, s);
44 46
 }
45 47
 

+ 9
- 7
src/FontSDL.cpp Wyświetl plik

@@ -62,7 +62,7 @@ unsigned int FontSDL::widthText(float scale, std::string s) {
62 62
 }
63 63
 
64 64
 void FontSDL::drawText(unsigned int x, unsigned int y, float scale,
65
-        const unsigned char color[4], std::string s) {
65
+                       const unsigned char color[4], std::string s) {
66 66
     assert(mFontInit == true);
67 67
     assert(mFont != nullptr);
68 68
     assert(s.length() > 0);
@@ -73,7 +73,7 @@ void FontSDL::drawText(unsigned int x, unsigned int y, float scale,
73 73
     col.b = color[2];
74 74
     col.a = color[3];
75 75
 
76
-    SDL_Surface *surface = TTF_RenderUTF8_Blended(mFont, s.c_str(), col);
76
+    SDL_Surface* surface = TTF_RenderUTF8_Blended(mFont, s.c_str(), col);
77 77
     if (surface == nullptr) {
78 78
         std::cout << "TTF_RenderUTF8_Blended Error: " << TTF_GetError() << std::endl;
79 79
         return;
@@ -98,7 +98,8 @@ void FontSDL::drawText(unsigned int x, unsigned int y, float scale,
98 98
     glBindTexture(GL_TEXTURE_2D, mFontTexture);
99 99
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
100 100
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
101
-    glTexImage2D(GL_TEXTURE_2D, 0, surface->format->BytesPerPixel, surface->w, surface->h, 0, textureFormat, GL_UNSIGNED_BYTE, surface->pixels);
101
+    glTexImage2D(GL_TEXTURE_2D, 0, surface->format->BytesPerPixel, surface->w, surface->h, 0,
102
+                 textureFormat, GL_UNSIGNED_BYTE, surface->pixels);
102 103
     SDL_FreeSurface(surface);
103 104
 
104 105
     GLuint xMin = x;
@@ -130,7 +131,7 @@ unsigned int FontSDL::heightText(float scale, unsigned int maxWidth, std::string
130 131
     assert(maxWidth > 0);
131 132
 
132 133
     SDL_Color col;
133
-    SDL_Surface *surface = TTF_RenderUTF8_Blended_Wrapped(mFont, s.c_str(), col, maxWidth);
134
+    SDL_Surface* surface = TTF_RenderUTF8_Blended_Wrapped(mFont, s.c_str(), col, maxWidth);
134 135
     if (surface == nullptr) {
135 136
         std::cout << "TTF_RenderUTF8_Blended_Wrapped Error: " << TTF_GetError() << std::endl;
136 137
         return 0;
@@ -141,7 +142,7 @@ unsigned int FontSDL::heightText(float scale, unsigned int maxWidth, std::string
141 142
 }
142 143
 
143 144
 void FontSDL::drawTextWrapped(unsigned int x, unsigned int y, float scale,
144
-        const unsigned char color[4], unsigned int maxWidth, std::string s) {
145
+                              const unsigned char color[4], unsigned int maxWidth, std::string s) {
145 146
     assert(mFontInit == true);
146 147
     assert(mFont != nullptr);
147 148
     assert(s.length() > 0);
@@ -153,7 +154,7 @@ void FontSDL::drawTextWrapped(unsigned int x, unsigned int y, float scale,
153 154
     col.b = color[2];
154 155
     col.a = color[3];
155 156
 
156
-    SDL_Surface *surface = TTF_RenderUTF8_Blended_Wrapped(mFont, s.c_str(), col, maxWidth);
157
+    SDL_Surface* surface = TTF_RenderUTF8_Blended_Wrapped(mFont, s.c_str(), col, maxWidth);
157 158
     if (surface == nullptr) {
158 159
         std::cout << "TTF_RenderUTF8_Blended_Wrapped Error: " << TTF_GetError() << std::endl;
159 160
         return;
@@ -178,7 +179,8 @@ void FontSDL::drawTextWrapped(unsigned int x, unsigned int y, float scale,
178 179
     glBindTexture(GL_TEXTURE_2D, mFontTexture);
179 180
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
180 181
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
181
-    glTexImage2D(GL_TEXTURE_2D, 0, surface->format->BytesPerPixel, surface->w, surface->h, 0, textureFormat, GL_UNSIGNED_BYTE, surface->pixels);
182
+    glTexImage2D(GL_TEXTURE_2D, 0, surface->format->BytesPerPixel, surface->w, surface->h, 0,
183
+                 textureFormat, GL_UNSIGNED_BYTE, surface->pixels);
182 184
     SDL_FreeSurface(surface);
183 185
 
184 186
     GLuint xMin = x;

+ 5
- 5
src/FontTRLE.cpp Wyświetl plik

@@ -32,8 +32,8 @@ int FontTRLE::initialize(std::string font) {
32 32
 
33 33
     // Load .pc file...
34 34
     std::ifstream file(font, std::ios::in | std::ios::binary);
35
-    unsigned char *pixels = new unsigned char[256 * 256 * 4];
36
-    if (!file.read((char *)pixels, 256 * 256 * 4)) {
35
+    unsigned char* pixels = new unsigned char[256 * 256 * 4];
36
+    if (!file.read((char*)pixels, 256 * 256 * 4)) {
37 37
         delete [] pixels;
38 38
         return -1;
39 39
     }
@@ -94,7 +94,7 @@ void FontTRLE::loadLPS(std::string f) {
94 94
 }
95 95
 
96 96
 void FontTRLE::writeChar(unsigned int index, unsigned int xDraw, unsigned int yDraw,
97
-        float scale, const unsigned char color[4]) {
97
+                         float scale, const unsigned char color[4]) {
98 98
     assert(mFontInit == true);
99 99
 
100 100
     int width = (int)(((float)offsets[index][2]) * scale * SCALING);
@@ -150,7 +150,7 @@ unsigned int FontTRLE::widthText(float scale, std::string s) {
150 150
 }
151 151
 
152 152
 void FontTRLE::drawText(unsigned int x, unsigned int y, float scale,
153
-        const unsigned char color[4], std::string s) {
153
+                        const unsigned char color[4], std::string s) {
154 154
     assert(mFontInit == true);
155 155
     assert(s.length() > 0);
156 156
 
@@ -203,7 +203,7 @@ unsigned int FontTRLE::heightText(float scale, unsigned int maxWidth, std::strin
203 203
 }
204 204
 
205 205
 void FontTRLE::drawTextWrapped(unsigned int x, unsigned int y, float scale,
206
-        const unsigned char color[4], unsigned int maxWidth, std::string s) {
206
+                               const unsigned char color[4], unsigned int maxWidth, std::string s) {
207 207
     assert(mFontInit == true);
208 208
     assert(s.length() > 0);
209 209
 

+ 22
- 29
src/Game.cpp Wyświetl plik

@@ -73,7 +73,7 @@ bool Game::isLoaded() {
73 73
     return mLoaded;
74 74
 }
75 75
 
76
-int Game::loadLevel(const char *level) {
76
+int Game::loadLevel(const char* level) {
77 77
     if (mLoaded)
78 78
         destroy();
79 79
 
@@ -183,7 +183,7 @@ void Game::handleMouseMotion(int xrel, int yrel, int xabs, int yabs) {
183 183
     }
184 184
 }
185 185
 
186
-Entity &Game::getLara() {
186
+Entity& Game::getLara() {
187 187
     assert(mLara >= 0);
188 188
     assert(mLara < (int)getWorld().sizeEntity());
189 189
     return getWorld().getEntity(mLara);
@@ -217,9 +217,8 @@ void Game::processModels() {
217 217
     getLog() << "Found " << mTombRaider.getMeshCount() << " meshes." << Log::endl;
218 218
 }
219 219
 
220
-void Game::processPakSounds()
221
-{
222
-    unsigned char *riff;
220
+void Game::processPakSounds() {
221
+    unsigned char* riff;
223 222
     unsigned int riffSz;
224 223
     //tr2_sound_source_t *sound;
225 224
     //tr2_sound_details_t *detail;
@@ -235,15 +234,14 @@ void Game::processPakSounds()
235 234
     // in this group, bits 0-1: channel number
236 235
     */
237 236
 
238
-    for (i = 0; i < mTombRaider.getSoundSamplesCount(); ++i)
239
-    {
237
+    for (i = 0; i < mTombRaider.getSoundSamplesCount(); ++i) {
240 238
         mTombRaider.getSoundSample(i, &riffSz, &riff);
241 239
 
242 240
         getSound().addWave(riff, riffSz, &id, Sound::SoundFlagsNone);
243 241
 
244 242
         //if (((i + 1) == TR_SOUND_F_PISTOL) && (id > 0))
245 243
         //{
246
-            //m_testSFX = id;
244
+        //m_testSFX = id;
247 245
         //}
248 246
 
249 247
         delete [] riff;
@@ -259,36 +257,33 @@ void Game::processPakSounds()
259 257
     getLog() << "Found " << mTombRaider.getSoundSamplesCount() << " sound samples." << Log::endl;
260 258
 }
261 259
 
262
-void Game::processTextures()
263
-{
264
-    unsigned char *image;
265
-    unsigned char *bumpmap;
260
+void Game::processTextures() {
261
+    unsigned char* image;
262
+    unsigned char* bumpmap;
266 263
     int i;
267 264
 
268 265
     //if ( mTombRaider.getNumBumpMaps())
269 266
     //  gBumpMapStart = mTombRaider.NumTextures();
270 267
 
271
-    for (i = 0; i < mTombRaider.NumTextures(); ++i)
272
-    {
268
+    for (i = 0; i < mTombRaider.NumTextures(); ++i) {
273 269
         mTombRaider.Texture(i, &image, &bumpmap);
274 270
 
275 271
         // Overwrite any previous level textures on load
276 272
         getTextureManager().loadBufferSlot(image, 256, 256,
277
-                RGBA, 32, (mTextureStart - 1) + i);
273
+                                           RGBA, 32, (mTextureStart - 1) + i);
278 274
 
279 275
 #ifdef MULTITEXTURE
280 276
         gMapTex2Bump[(mTextureStart - 1) + i] = -1;
281 277
 #endif
282 278
 
283
-        if (bumpmap)
284
-        {
279
+        if (bumpmap) {
285 280
 #ifdef MULTITEXTURE
286 281
             gMapTex2Bump[(mTextureStart - 1) + i] = (mTextureStart - 1) + i +
287
-                    mTombRaider.NumTextures();
282
+                                                    mTombRaider.NumTextures();
288 283
 #endif
289 284
             getTextureManager().loadBufferSlot(bumpmap, 256, 256,
290
-                    RGBA, 32,
291
-                    (mTextureStart - 1) + i + mTombRaider.NumTextures());
285
+                                               RGBA, 32,
286
+                                               (mTextureStart - 1) + i + mTombRaider.NumTextures());
292 287
         }
293 288
 
294 289
         if (image)
@@ -303,16 +298,14 @@ void Game::processTextures()
303 298
     getLog() << "Found " << mTombRaider.NumTextures() << " textures." << Log::endl;
304 299
 }
305 300
 
306
-void Game::processMoveables()
307
-{
301
+void Game::processMoveables() {
308 302
     unsigned int statCount = 0;
309 303
 
310
-    tr2_moveable_t *moveable = mTombRaider.Moveable();
311
-    tr2_item_t *item = mTombRaider.Item();
312
-    tr2_sprite_sequence_t *sprite_sequence = mTombRaider.SpriteSequence();
304
+    tr2_moveable_t* moveable = mTombRaider.Moveable();
305
+    tr2_item_t* item = mTombRaider.Item();
306
+    tr2_sprite_sequence_t* sprite_sequence = mTombRaider.SpriteSequence();
313 307
 
314
-    for (int i = 0; i < mTombRaider.NumItems(); ++i)
315
-    {
308
+    for (int i = 0; i < mTombRaider.NumItems(); ++i) {
316 309
         int j;
317 310
         int object_id = item[i].object_id;
318 311
 
@@ -406,7 +399,7 @@ void Game::processMoveable(int index, int i, int object_id) {
406 399
         getWorld().addSkeletalModel(*new SkeletalModel(mTombRaider, index, object_id));
407 400
 
408 401
     // Create a new Entity, using the cached or the new SkeletalModel
409
-    Entity &entity = *new Entity(mTombRaider, index, i, model);
402
+    Entity& entity = *new Entity(mTombRaider, index, i, model);
410 403
     getWorld().addEntity(entity);
411 404
 
412 405
     // Store reference to Lara
@@ -416,6 +409,6 @@ void Game::processMoveable(int index, int i, int object_id) {
416 409
     // Store reference to the SkyMesh
417 410
     if (i == mTombRaider.getSkyModelId())
418 411
         getRender().setSkyMesh(i, //moveable[i].starting_mesh,
419
-                (mTombRaider.Engine() == TR_VERSION_2));
412
+                               (mTombRaider.Engine() == TR_VERSION_2));
420 413
 }
421 414
 

+ 7
- 7
src/Menu.cpp Wyświetl plik

@@ -13,7 +13,7 @@
13 13
 #include "MenuFolder.h"
14 14
 
15 15
 void Menu::showDialog(std::string msg, std::string btn1, std::string btn2,
16
-        std::function<int (bool state)> callback) {
16
+                      std::function<int (bool state)> callback) {
17 17
     // Only show one dialog at a time
18 18
     assert(dialogText.length() == 0);
19 19
     assert(dialogButton1.length() == 0);
@@ -75,7 +75,7 @@ bool Menu::handleKeyboardDialog(KeyboardButton key, bool pressed) {
75 75
 }
76 76
 
77 77
 bool Menu::handleMouseClickDialog(unsigned int x, unsigned int y,
78
-            KeyboardButton button, bool released) {
78
+                                  KeyboardButton button, bool released) {
79 79
     //! \todo Allow mouse usage of Menu dialogs!
80 80
     return (dialogText.length() > 0);
81 81
 }
@@ -151,18 +151,18 @@ void Menu::displayDialog() {
151 151
         if (dialogButton2.length() > 0) {
152 152
             if ((w1 + w2) <= wMax) {
153 153
                 Font::drawTextWrapped(xOverlay + 10, yOverlay + 10 + h0, 1.0f,
154
-                    dialogState ? BLUE : RED, w1, dialogButton1);
154
+                                      dialogState ? BLUE : RED, w1, dialogButton1);
155 155
                 Font::drawTextWrapped(xOverlay + 10 + w1, yOverlay + 10 + h0,
156
-                    1.0f, dialogState ? RED : BLUE, w2, dialogButton2);
156
+                                      1.0f, dialogState ? RED : BLUE, w2, dialogButton2);
157 157
             } else {
158 158
                 Font::drawTextWrapped((::getWindow().getWidth() - w1) / 2,
159
-                    yOverlay + 10 + h0, 1.0f, dialogState ? BLUE : RED, w1, dialogButton1);
159
+                                      yOverlay + 10 + h0, 1.0f, dialogState ? BLUE : RED, w1, dialogButton1);
160 160
                 Font::drawTextWrapped((::getWindow().getWidth() - w2) / 2,
161
-                    yOverlay + 10 + h0 + h1, 1.0f, dialogState ? RED : BLUE, w2, dialogButton2);
161
+                                      yOverlay + 10 + h0 + h1, 1.0f, dialogState ? RED : BLUE, w2, dialogButton2);
162 162
             }
163 163
         } else {
164 164
             Font::drawTextWrapped((::getWindow().getWidth() - w1) / 2,
165
-                    yOverlay + 10 + h0, 1.0f, RED, w1, dialogButton1);
165
+                                  yOverlay + 10 + h0, 1.0f, RED, w1, dialogButton1);
166 166
         }
167 167
     }
168 168
 }

+ 12
- 11
src/MenuFolder.cpp Wyświetl plik

@@ -36,7 +36,7 @@ int MenuFolder::init(std::string s) {
36 36
     return init(new Folder(s));
37 37
 }
38 38
 
39
-int MenuFolder::init(Folder *folder, bool filter) {
39
+int MenuFolder::init(Folder* folder, bool filter) {
40 40
     if (mapFolder != nullptr)
41 41
         delete mapFolder;
42 42
 
@@ -44,7 +44,7 @@ int MenuFolder::init(Folder *folder, bool filter) {
44 44
     mMin = mCursor = 0;
45 45
 
46 46
     if (filter) {
47
-        mapFolder->executeRemoveFiles([](File &f) {
47
+        mapFolder->executeRemoveFiles([](File & f) {
48 48
             // Filter files based on file name
49 49
             if ((f.getName().length() > 4)
50 50
                 && (f.getName().compare(f.getName().length() - 4, 4, ".phd") != 0)
@@ -58,7 +58,7 @@ int MenuFolder::init(Folder *folder, bool filter) {
58 58
             Loader::LoaderVersion version = Loader::checkFile(f.getPath());
59 59
             if (version == Loader::TR_UNKNOWN) {
60 60
                 getLog() << "Error: pak file '" << f.getName().c_str()
61
-                    << "' invalid" << Log::endl;
61
+                         << "' invalid" << Log::endl;
62 62
                 return true; // delete file from list
63 63
             }
64 64
 
@@ -92,15 +92,15 @@ void MenuFolder::display() {
92 92
 
93 93
     // Print list of "..", folders, files
94 94
     for (long i = mMin; (i < (mMin + items))
95
-                && (i < (mapFolder->folderCount() + mapFolder->fileCount() + 1)); i++) {
95
+         && (i < (mapFolder->folderCount() + mapFolder->fileCount() + 1)); i++) {
96 96
         if (i == 0) {
97 97
             Font::drawText(25, 50, 0.75f, (mCursor == i) ? RED : BLUE, "..");
98 98
         } else {
99 99
             Font::drawText(25, (unsigned int)(50 + (25 * (i - mMin))), 0.75f,
100
-                (mCursor == i) ? RED : BLUE,
101
-                ((i - 1) < mapFolder->folderCount()) ?
102
-                    (mapFolder->getFolder(i - 1).getName() + "/")
103
-                    : mapFolder->getFile(i - 1 - mapFolder->folderCount()).getName());
100
+                           (mCursor == i) ? RED : BLUE,
101
+                           ((i - 1) < mapFolder->folderCount()) ?
102
+                           (mapFolder->getFolder(i - 1).getName() + "/")
103
+                           : mapFolder->getFile(i - 1 - mapFolder->folderCount()).getName());
104 104
         }
105 105
     }
106 106
 
@@ -120,7 +120,7 @@ void MenuFolder::loadOrOpen() {
120 120
         }
121 121
     } else {
122 122
         int error = getGame().loadLevel(mapFolder->getFile((unsigned long)mCursor
123
-                    - 1 - mapFolder->folderCount()).getPath().c_str());
123
+                                        - 1 - mapFolder->folderCount()).getPath().c_str());
124 124
         if (error == 0) {
125 125
             visible = false;
126 126
         } else {
@@ -165,7 +165,8 @@ void MenuFolder::handleKeyboard(KeyboardButton key, bool pressed) {
165 165
     }
166 166
 }
167 167
 
168
-void MenuFolder::handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released) {
168
+void MenuFolder::handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button,
169
+                                  bool released) {
169 170
     if (handleMouseClickDialog(x, y, button, released))
170 171
         return;
171 172
 
@@ -175,7 +176,7 @@ void MenuFolder::handleMouseClick(unsigned int x, unsigned int y, KeyboardButton
175 176
         return;
176 177
 
177 178
     if ((y >= 50) && (y <= (unsigned int)(50 + (25 * items)))
178
-            && ((mMin + (y / 25)) <= (mapFolder->folderCount() + mapFolder->fileCount() + 2))) {
179
+        && ((mMin + (y / 25)) <= (mapFolder->folderCount() + mapFolder->fileCount() + 2))) {
179 180
         y -= 50;
180 181
         if (mCursor == (mMin + (y / 25)))
181 182
             loadOrOpen();

+ 82
- 142
src/Mesh.cpp Wyświetl plik

@@ -15,8 +15,7 @@
15 15
 // Constructors
16 16
 ////////////////////////////////////////////////////////////
17 17
 
18
-Mesh::Mesh()
19
-{
18
+Mesh::Mesh() {
20 19
     mNumVertices = 0;
21 20
     mVertices = 0x0;
22 21
 
@@ -47,8 +46,7 @@ Mesh::Mesh()
47 46
 }
48 47
 
49 48
 
50
-Mesh::~Mesh()
51
-{
49
+Mesh::~Mesh() {
52 50
     for (unsigned int i = 0; i < mNumVertices; i++)
53 51
         delete [] mVertices[i];
54 52
     delete [] mVertices;
@@ -64,10 +62,8 @@ Mesh::~Mesh()
64 62
     delete [] mColors;
65 63
     mColors = NULL;
66 64
 
67
-    if (mTris)
68
-    {
69
-        for (unsigned int i = 0; i < mNumTris; ++i)
70
-        {
65
+    if (mTris) {
66
+        for (unsigned int i = 0; i < mNumTris; ++i) {
71 67
             delete [] mTris[i].triangles;
72 68
             delete [] mTris[i].alpha_triangles;
73 69
             delete [] mTris[i].texcoors;
@@ -78,10 +74,8 @@ Mesh::~Mesh()
78 74
         mTris = NULL;
79 75
     }
80 76
 
81
-    if (mQuads)
82
-    {
83
-        for (unsigned int i = 0; i < mNumQuads; ++i)
84
-        {
77
+    if (mQuads) {
78
+        for (unsigned int i = 0; i < mNumQuads; ++i) {
85 79
             delete [] mQuads[i].quads;
86 80
             delete [] mQuads[i].alpha_quads;
87 81
             delete [] mQuads[i].texcoors;
@@ -119,16 +113,13 @@ Mesh::~Mesh()
119 113
 // Public Accessors
120 114
 ////////////////////////////////////////////////////////////
121 115
 
122
-void Mesh::drawAlpha()
123
-{
116
+void Mesh::drawAlpha() {
124 117
     unsigned int i, j, k, index;
125 118
 
126 119
 
127 120
     // Render quadralaterals
128
-    for (mQuads ? i = 0 : i = mNumQuads; i < mNumQuads; ++i)
129
-    {
130
-        switch (mMode)
131
-        {
121
+    for (mQuads ? i = 0 : i = mNumQuads; i < mNumQuads; ++i) {
122
+        switch (mMode) {
132 123
             case MeshModeWireframe:
133 124
                 glColor3f(0.0, 0.0, 1.0);
134 125
                 glBindTexture(GL_TEXTURE_2D, 0);
@@ -140,19 +131,17 @@ void Mesh::drawAlpha()
140 131
             case MeshModeTexture:
141 132
             case MeshModeMultiTexture:
142 133
                 // Bind texture id for textures
143
-                glBindTexture(GL_TEXTURE_2D, mQuads[i].texture+1);
134
+                glBindTexture(GL_TEXTURE_2D, mQuads[i].texture + 1);
144 135
                 break;
145 136
         }
146 137
 
147 138
         glBegin(GL_QUADS);
148 139
 
149
-        for (j = 0; j < mQuads[i].num_alpha_quads; ++j)
150
-        {
151
-            for (k = 0; k < 4; ++k)
152
-            {
153
-                index = mQuads[i].alpha_quads[j*4+k];
140
+        for (j = 0; j < mQuads[i].num_alpha_quads; ++j) {
141
+            for (k = 0; k < 4; ++k) {
142
+                index = mQuads[i].alpha_quads[j * 4 + k];
154 143
 
155
-                glTexCoord2fv(mQuads[i].texcoors2[j*4+k]);
144
+                glTexCoord2fv(mQuads[i].texcoors2[j * 4 + k]);
156 145
                 glColor4fv(mColors[index]);
157 146
                 glVertex3fv(mVertices[index]);
158 147
             }
@@ -162,10 +151,8 @@ void Mesh::drawAlpha()
162 151
     }
163 152
 
164 153
     // Render triangles
165
-    for (mTris ? i = 0 : i = mNumTris; i < mNumTris; ++i)
166
-    {
167
-        switch (mMode)
168
-        {
154
+    for (mTris ? i = 0 : i = mNumTris; i < mNumTris; ++i) {
155
+        switch (mMode) {
169 156
             case MeshModeWireframe:
170 157
                 glColor3f(0.0, 1.0, 0.0);
171 158
                 glBindTexture(GL_TEXTURE_2D, 0);
@@ -177,19 +164,17 @@ void Mesh::drawAlpha()
177 164
             case MeshModeTexture:
178 165
             case MeshModeMultiTexture:
179 166
                 // Bind texture id for textures
180
-                glBindTexture(GL_TEXTURE_2D, mTris[i].texture+1);
167
+                glBindTexture(GL_TEXTURE_2D, mTris[i].texture + 1);
181 168
                 break;
182 169
         }
183 170
 
184 171
         glBegin(GL_TRIANGLES);
185 172
 
186
-        for (j = 0; j < mTris[i].num_alpha_triangles; ++j)
187
-        {
188
-            for (k = 0; k < 3; ++k)
189
-            {
190
-                index = mTris[i].alpha_triangles[j*3+k];
173
+        for (j = 0; j < mTris[i].num_alpha_triangles; ++j) {
174
+            for (k = 0; k < 3; ++k) {
175
+                index = mTris[i].alpha_triangles[j * 3 + k];
191 176
 
192
-                glTexCoord2fv(mTris[i].texcoors2[j*3+k]);
177
+                glTexCoord2fv(mTris[i].texcoors2[j * 3 + k]);
193 178
                 glColor4fv(mColors[index]);
194 179
                 glVertex3fv(mVertices[index]);
195 180
             }
@@ -200,13 +185,11 @@ void Mesh::drawAlpha()
200 185
 }
201 186
 
202 187
 
203
-void Mesh::drawSolid()
204
-{
188
+void Mesh::drawSolid() {
205 189
     unsigned int i, j, k, index;
206 190
 
207 191
 
208
-    if (mFlags & fMesh_UseVertexArray)
209
-    {
192
+    if (mFlags & fMesh_UseVertexArray) {
210 193
         //glEnableClientState(GL_VERTEX_ARRAY);
211 194
         //glVertexPointer(3, GL_FLOAT, 0, mVertexArray);
212 195
 
@@ -214,10 +197,9 @@ void Mesh::drawSolid()
214 197
         glColor3f(1.0f, 1.0f, 1.0f);
215 198
         glBegin(GL_TRIANGLES);
216 199
 
217
-        for (i = 0; i < mTriangleCount*3; ++i)
218
-        {
200
+        for (i = 0; i < mTriangleCount * 3; ++i) {
219 201
             //glArrayElement(mTriangleIndices[i]);
220
-            glVertex3fv(mVertexArray+mTriangleIndices[i]);
202
+            glVertex3fv(mVertexArray + mTriangleIndices[i]);
221 203
         }
222 204
 
223 205
         glEnd();
@@ -242,10 +224,8 @@ void Mesh::drawSolid()
242 224
     }
243 225
 
244 226
     // Render quadralaterals
245
-    for (mQuads ? i = 0 : i = mNumQuads; i < mNumQuads; ++i)
246
-    {
247
-        switch (mMode)
248
-        {
227
+    for (mQuads ? i = 0 : i = mNumQuads; i < mNumQuads; ++i) {
228
+        switch (mMode) {
249 229
             case MeshModeSolid:
250 230
                 glColor3f(0.0, 0.0, 0.0);
251 231
                 break;
@@ -257,11 +237,11 @@ void Mesh::drawSolid()
257 237
             case MeshModeMultiTexture:
258 238
                 glActiveTextureARB(GL_TEXTURE0_ARB);
259 239
                 glEnable(GL_TEXTURE_2D);
260
-                glBindTexture(GL_TEXTURE_2D, mQuads[i].texture+1);
240
+                glBindTexture(GL_TEXTURE_2D, mQuads[i].texture + 1);
261 241
 
262 242
                 glActiveTextureARB(GL_TEXTURE1_ARB);
263 243
                 glEnable(GL_TEXTURE_2D);
264
-                glBindTexture(GL_TEXTURE_2D, mQuads[i].bumpmap+1);
244
+                glBindTexture(GL_TEXTURE_2D, mQuads[i].bumpmap + 1);
265 245
                 break;
266 246
 #else
267 247
             case MeshModeMultiTexture:
@@ -269,31 +249,27 @@ void Mesh::drawSolid()
269 249
             case MeshModeTexture:
270 250
                 // Bind texture id for textures
271 251
                 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
272
-                glBindTexture(GL_TEXTURE_2D, mQuads[i].texture+1);
252
+                glBindTexture(GL_TEXTURE_2D, mQuads[i].texture + 1);
273 253
                 break;
274 254
         }
275 255
 
276 256
         glBegin(GL_QUADS);
277 257
 
278
-        for (j = 0; j < mQuads[i].num_quads; ++j)
279
-        {
280
-            for (k = 0; k < 4; ++k)
281
-            {
282
-                index = mQuads[i].quads[j*4+k];
258
+        for (j = 0; j < mQuads[i].num_quads; ++j) {
259
+            for (k = 0; k < 4; ++k) {
260
+                index = mQuads[i].quads[j * 4 + k];
283 261
 
284 262
                 glColor4fv(mColors[index]);
285 263
 
286 264
 #ifdef MULTITEXTURE
287
-                if (mMode == MeshModeMultiTexture)
288
-                {
265
+                if (mMode == MeshModeMultiTexture) {
289 266
                     glMultiTexCoord2fvARB(GL_TEXTURE0_ARB,
290
-                            mQuads[i].texcoors[j*4+k]);
267
+                                          mQuads[i].texcoors[j * 4 + k]);
291 268
                     glMultiTexCoord2fvARB(GL_TEXTURE1_ARB,
292
-                            mQuads[i].texcoors[j*4+k]);
293
-                }
294
-                else
269
+                                          mQuads[i].texcoors[j * 4 + k]);
270
+                } else
295 271
 #endif
296
-                    glTexCoord2fv(mQuads[i].texcoors[j*4+k]);
272
+                    glTexCoord2fv(mQuads[i].texcoors[j * 4 + k]);
297 273
 
298 274
                 glVertex3fv(mVertices[index]);
299 275
             }
@@ -303,10 +279,8 @@ void Mesh::drawSolid()
303 279
     }
304 280
 
305 281
     // Render triangles
306
-    for (mTris ? i = 0 : i = mNumTris; i < mNumTris; ++i)
307
-    {
308
-        switch (mMode)
309
-        {
282
+    for (mTris ? i = 0 : i = mNumTris; i < mNumTris; ++i) {
283
+        switch (mMode) {
310 284
             case MeshModeSolid:
311 285
                 glColor3f(1.0, 0.0, 0.0);
312 286
                 break;
@@ -318,11 +292,11 @@ void Mesh::drawSolid()
318 292
             case MeshModeMultiTexture:
319 293
                 glActiveTextureARB(GL_TEXTURE0_ARB);
320 294
                 glEnable(GL_TEXTURE_2D);
321
-                glBindTexture(GL_TEXTURE_2D, mTris[i].texture+1);
295
+                glBindTexture(GL_TEXTURE_2D, mTris[i].texture + 1);
322 296
 
323 297
                 glActiveTextureARB(GL_TEXTURE1_ARB);
324 298
                 glEnable(GL_TEXTURE_2D);
325
-                glBindTexture(GL_TEXTURE_2D, mTris[i].bumpmap+1);
299
+                glBindTexture(GL_TEXTURE_2D, mTris[i].bumpmap + 1);
326 300
                 break;
327 301
 #else
328 302
             case MeshModeMultiTexture:
@@ -330,29 +304,25 @@ void Mesh::drawSolid()
330 304
             case MeshModeTexture:
331 305
                 // Bind texture id for textures
332 306
                 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
333
-                glBindTexture(GL_TEXTURE_2D, mTris[i].texture+1);
307
+                glBindTexture(GL_TEXTURE_2D, mTris[i].texture + 1);
334 308
                 break;
335 309
         }
336 310
 
337 311
         glBegin(GL_TRIANGLES);
338 312
 
339
-        for (j = 0; j < mTris[i].num_triangles; ++j)
340
-        {
341
-            for (k = 0; k < 3; ++k)
342
-            {
343
-                index = mTris[i].triangles[j*3+k];
313
+        for (j = 0; j < mTris[i].num_triangles; ++j) {
314
+            for (k = 0; k < 3; ++k) {
315
+                index = mTris[i].triangles[j * 3 + k];
344 316
 
345 317
 #ifdef MULTITEXTURE
346
-                if (mMode == MeshModeMultiTexture)
347
-                {
318
+                if (mMode == MeshModeMultiTexture) {
348 319
                     glMultiTexCoord2fvARB(GL_TEXTURE0_ARB,
349
-                            mTris[i].texcoors[j*3+k]);
320
+                                          mTris[i].texcoors[j * 3 + k]);
350 321
                     glMultiTexCoord2fvARB(GL_TEXTURE1_ARB,
351
-                            mTris[i].texcoors[j*3+k]);
352
-                }
353
-                else
322
+                                          mTris[i].texcoors[j * 3 + k]);
323
+                } else
354 324
 #endif
355
-                    glTexCoord2fv(mTris[i].texcoors[j*3+k]);
325
+                    glTexCoord2fv(mTris[i].texcoors[j * 3 + k]);
356 326
 
357 327
                 glColor4fv(mColors[index]);
358 328
                 glVertex3fv(mVertices[index]);
@@ -363,8 +333,7 @@ void Mesh::drawSolid()
363 333
     }
364 334
 
365 335
 #ifdef MULTITEXTURE
366
-    if (mMode == MeshModeMultiTexture)
367
-    {
336
+    if (mMode == MeshModeMultiTexture) {
368 337
         glDisable(GL_TEXTURE_2D);
369 338
         glActiveTextureARB(GL_TEXTURE0_ARB);
370 339
     }
@@ -376,18 +345,15 @@ void Mesh::drawSolid()
376 345
 // Public Mutators
377 346
 ////////////////////////////////////////////////////////////
378 347
 
379
-void Mesh::allocateColors(unsigned int n)
380
-{
381
-    if (mColors)
382
-    {
348
+void Mesh::allocateColors(unsigned int n) {
349
+    if (mColors) {
383 350
         for (unsigned int i = 0; i < mNumColors; i++)
384 351
             delete [] mColors[i];
385 352
         delete [] mColors;
386 353
         mNumColors = 0;
387 354
     }
388 355
 
389
-    if (!n)
390
-    {
356
+    if (!n) {
391 357
         return;
392 358
     }
393 359
 
@@ -398,18 +364,15 @@ void Mesh::allocateColors(unsigned int n)
398 364
 }
399 365
 
400 366
 
401
-void Mesh::allocateNormals(unsigned int n)
402
-{
403
-    if (mNormals)
404
-    {
367
+void Mesh::allocateNormals(unsigned int n) {
368
+    if (mNormals) {
405 369
         for (unsigned int i = 0; i < mNumNormals; i++)
406 370
             delete [] mNormals[i];
407 371
         delete [] mNormals;
408 372
         mNumNormals = 0;
409 373
     }
410 374
 
411
-    if (!n)
412
-    {
375
+    if (!n) {
413 376
         return;
414 377
     }
415 378
 
@@ -420,16 +383,13 @@ void Mesh::allocateNormals(unsigned int n)
420 383
 }
421 384
 
422 385
 
423
-void Mesh::allocateRectangles(unsigned int n)
424
-{
425
-    if (mQuads)
426
-    {
386
+void Mesh::allocateRectangles(unsigned int n) {
387
+    if (mQuads) {
427 388
         mNumQuads = 0;
428 389
         delete [] mQuads;
429 390
     }
430 391
 
431
-    if (!n)
432
-    {
392
+    if (!n) {
433 393
         return;
434 394
     }
435 395
 
@@ -438,16 +398,13 @@ void Mesh::allocateRectangles(unsigned int n)
438 398
 }
439 399
 
440 400
 
441
-void Mesh::allocateTriangles(unsigned int n)
442
-{
443
-    if (mTris)
444
-    {
401
+void Mesh::allocateTriangles(unsigned int n) {
402
+    if (mTris) {
445 403
         mNumTris = 0;
446 404
         delete [] mTris;
447 405
     }
448 406
 
449
-    if (!n)
450
-    {
407
+    if (!n) {
451 408
         return;
452 409
     }
453 410
 
@@ -456,18 +413,15 @@ void Mesh::allocateTriangles(unsigned int n)
456 413
 }
457 414
 
458 415
 
459
-void Mesh::allocateVertices(unsigned int n)
460
-{
461
-    if (mVertices)
462
-    {
416
+void Mesh::allocateVertices(unsigned int n) {
417
+    if (mVertices) {
463 418
         for (unsigned int i = 0; i < mNumVertices; i++)
464 419
             delete [] mVertices[i];
465 420
         delete [] mVertices;
466 421
         mNumVertices = 0;
467 422
     }
468 423
 
469
-    if (!n)
470
-    {
424
+    if (!n) {
471 425
         return;
472 426
     }
473 427
 
@@ -478,18 +432,15 @@ void Mesh::allocateVertices(unsigned int n)
478 432
 }
479 433
 
480 434
 
481
-void Mesh::bufferColorArray(unsigned int colorCount, float *colors)
482
-{
483
-    if (mColors)
484
-    {
435
+void Mesh::bufferColorArray(unsigned int colorCount, float* colors) {
436
+    if (mColors) {
485 437
         for (unsigned int i = 0; i < mNumColors; i++)
486 438
             delete [] mColors[i];
487 439
         delete [] mColors;
488 440
         mNumColors = 0;
489 441
     }
490 442
 
491
-    if (!colorCount)
492
-    {
443
+    if (!colorCount) {
493 444
         return;
494 445
     }
495 446
 
@@ -498,18 +449,15 @@ void Mesh::bufferColorArray(unsigned int colorCount, float *colors)
498 449
 }
499 450
 
500 451
 
501
-void Mesh::bufferNormalArray(unsigned int normalCount, float *normals)
502
-{
503
-    if (mNormals)
504
-    {
452
+void Mesh::bufferNormalArray(unsigned int normalCount, float* normals) {
453
+    if (mNormals) {
505 454
         for (unsigned int i = 0; i < mNumNormals; i++)
506 455
             delete [] mNormals[i];
507 456
         delete [] mNormals;
508 457
         mNumNormals = 0;
509 458
     }
510 459
 
511
-    if (!normalCount)
512
-    {
460
+    if (!normalCount) {
513 461
         return;
514 462
     }
515 463
 
@@ -519,9 +467,8 @@ void Mesh::bufferNormalArray(unsigned int normalCount, float *normals)
519 467
 
520 468
 
521 469
 void Mesh::bufferTriangles(unsigned int count,
522
-        unsigned int *indices, float *texCoords,
523
-        int *textures, unsigned int *flags)
524
-{
470
+                           unsigned int* indices, float* texCoords,
471
+                           int* textures, unsigned int* flags) {
525 472
 
526 473
     mTriangleCount = count;
527 474
     mTriangleTextures = textures;
@@ -533,18 +480,15 @@ void Mesh::bufferTriangles(unsigned int count,
533 480
 }
534 481
 
535 482
 
536
-void Mesh::bufferVertexArray(unsigned int vertexCount, float *vertices)
537
-{
538
-    if (mVertices)
539
-    {
483
+void Mesh::bufferVertexArray(unsigned int vertexCount, float* vertices) {
484
+    if (mVertices) {
540 485
         for (unsigned int i = 0; i < mNumVertices; i++)
541 486
             delete [] mVertices[i];
542 487
         delete [] mVertices;
543 488
         mNumVertices = 0;
544 489
     }
545 490
 
546
-    if (!vertexCount)
547
-    {
491
+    if (!vertexCount) {
548 492
         return;
549 493
     }
550 494
 
@@ -555,8 +499,7 @@ void Mesh::bufferVertexArray(unsigned int vertexCount, float *vertices)
555 499
 
556 500
 
557 501
 void Mesh::setColor(unsigned int index,
558
-        float r, float g, float b, float a)
559
-{
502
+                    float r, float g, float b, float a) {
560 503
     assert(index < mNumColors);
561 504
 
562 505
     mColors[index][0] = r;
@@ -566,8 +509,7 @@ void Mesh::setColor(unsigned int index,
566 509
 }
567 510
 
568 511
 
569
-void Mesh::setColor(unsigned int index, float rgba[4])
570
-{
512
+void Mesh::setColor(unsigned int index, float rgba[4]) {
571 513
     assert(index < mNumColors);
572 514
 
573 515
     mColors[index][0] = rgba[0];
@@ -577,8 +519,7 @@ void Mesh::setColor(unsigned int index, float rgba[4])
577 519
 }
578 520
 
579 521
 
580
-void Mesh::setNormal(unsigned int index, float i, float j, float k)
581
-{
522
+void Mesh::setNormal(unsigned int index, float i, float j, float k) {
582 523
     assert(index < mNumNormals);
583 524
 
584 525
     mNormals[index][0] = i;
@@ -587,8 +528,7 @@ void Mesh::setNormal(unsigned int index, float i, float j, float k)
587 528
 }
588 529
 
589 530
 
590
-void Mesh::setVertex(unsigned int index, float x, float y, float z)
591
-{
531
+void Mesh::setVertex(unsigned int index, float x, float y, float z) {
592 532
     assert(index < mNumVertices);
593 533
 
594 534
     mVertices[index][0] = x;

+ 50
- 85
src/Render.cpp Wyświetl plik

@@ -39,10 +39,9 @@ void Render::ClearWorld() {
39 39
     mRoomRenderList.clear();
40 40
 }
41 41
 
42
-void Render::screenShot(const char *filenameBase)
43
-{
42
+void Render::screenShot(const char* filenameBase) {
44 43
     int sz = getWindow().getWidth() * getWindow().getHeight();
45
-    unsigned char *image = new unsigned char[sz * 3];
44
+    unsigned char* image = new unsigned char[sz * 3];
46 45
     static int count = 0;
47 46
     bool done = false;
48 47
 
@@ -53,7 +52,7 @@ void Render::screenShot(const char *filenameBase)
53 52
     while (!done) {
54 53
         filename << filenameBase << "-" << count++ << ".tga";
55 54
 
56
-        FILE *f = fopen(filename.str().c_str(), "rb");
55
+        FILE* f = fopen(filename.str().c_str(), "rb");
57 56
         if (f) {
58 57
             fclose(f);
59 58
         } else {
@@ -61,7 +60,8 @@ void Render::screenShot(const char *filenameBase)
61 60
         }
62 61
     }
63 62
 
64
-    glReadPixels(0, 0, getWindow().getWidth(), getWindow().getHeight(), GL_BGR_EXT, GL_UNSIGNED_BYTE, image);
63
+    glReadPixels(0, 0, getWindow().getWidth(), getWindow().getHeight(), GL_BGR_EXT, GL_UNSIGNED_BYTE,
64
+                 image);
65 65
     tgaSave(filename.str().c_str(), image, getWindow().getWidth(), getWindow().getHeight(), 0);
66 66
     delete [] image;
67 67
 }
@@ -70,11 +70,9 @@ unsigned int Render::getFlags() {
70 70
     return mFlags;
71 71
 }
72 72
 
73
-void Render::lightRoom(Room &room)
74
-{
75
-    for (unsigned int i = 0; i < room.sizeLights(); ++i)
76
-    {
77
-        Light &light = room.getLight(i);
73
+void Render::lightRoom(Room& room) {
74
+    for (unsigned int i = 0; i < room.sizeLights(); ++i) {
75
+        Light& light = room.getLight(i);
78 76
         float pos[4], color[4];
79 77
         float dir[3];
80 78
         light.getPos(pos);
@@ -83,8 +81,7 @@ void Render::lightRoom(Room &room)
83 81
 
84 82
         glEnable(GL_LIGHT0 + i);
85 83
 
86
-        switch (light.getType())
87
-        {
84
+        switch (light.getType()) {
88 85
             case Light::typeSpot:
89 86
                 glLightf(GL_LIGHT0 + i,  GL_SPOT_CUTOFF,    light.getCutoff());
90 87
                 glLightfv(GL_LIGHT0 + i, GL_POSITION,       pos);
@@ -106,30 +103,24 @@ void Render::lightRoom(Room &room)
106 103
     }
107 104
 }
108 105
 
109
-void Render::clearFlags(unsigned int flags)
110
-{
106
+void Render::clearFlags(unsigned int flags) {
111 107
     mFlags &= ~flags;
112 108
 
113
-    if (flags & Render::fFog)
114
-    {
115
-        if (glIsEnabled(GL_FOG))
116
-        {
109
+    if (flags & Render::fFog) {
110
+        if (glIsEnabled(GL_FOG)) {
117 111
             glDisable(GL_FOG);
118 112
         }
119 113
     }
120 114
 
121
-    if (flags & Render::fGL_Lights)
122
-    {
115
+    if (flags & Render::fGL_Lights) {
123 116
         glDisable(GL_LIGHTING);
124 117
     }
125 118
 }
126 119
 
127
-void Render::setFlags(unsigned int flags)
128
-{
120
+void Render::setFlags(unsigned int flags) {
129 121
     mFlags |= flags;
130 122
 
131
-    if (flags & Render::fFog)
132
-    {
123
+    if (flags & Render::fFog) {
133 124
         glEnable(GL_FOG);
134 125
         glFogf(GL_FOG_MODE, GL_EXP2);
135 126
         glFogf(GL_FOG_DENSITY, 0.00008f);
@@ -144,8 +135,7 @@ void Render::setFlags(unsigned int flags)
144 135
         glFogfv(GL_FOG_COLOR, color);
145 136
     }
146 137
 
147
-    if (flags & Render::fGL_Lights)
148
-    {
138
+    if (flags & Render::fGL_Lights) {
149 139
         float color[4];
150 140
         color[0] = WHITE[0] * 256.0f;
151 141
         color[1] = WHITE[1] * 256.0f;
@@ -165,32 +155,26 @@ void Render::setFlags(unsigned int flags)
165 155
     }
166 156
 }
167 157
 
168
-int Render::getMode()
169
-{
158
+int Render::getMode() {
170 159
     return mMode;
171 160
 }
172 161
 
173
-void Render::setMode(int n)
174
-{
162
+void Render::setMode(int n) {
175 163
     mMode = n;
176 164
 
177
-    switch (mMode)
178
-    {
165
+    switch (mMode) {
179 166
         case Render::modeDisabled:
180 167
             break;
181 168
         case Render::modeSolid:
182 169
         case Render::modeWireframe:
183 170
             glClearColor(PURPLE[0] * 256.0f, PURPLE[1] * 256.0f,
184
-                    PURPLE[2] * 256.0f, PURPLE[3] * 256.0f);
171
+                         PURPLE[2] * 256.0f, PURPLE[3] * 256.0f);
185 172
             glDisable(GL_TEXTURE_2D);
186 173
             break;
187 174
         default:
188
-            if (mMode == Render::modeLoadScreen)
189
-            {
175
+            if (mMode == Render::modeLoadScreen) {
190 176
                 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
191
-            }
192
-            else
193
-            {
177
+            } else {
194 178
                 glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
195 179
             }
196 180
 
@@ -200,10 +184,8 @@ void Render::setMode(int n)
200 184
     }
201 185
 }
202 186
 
203
-void Render::display()
204
-{
205
-    switch (mMode)
206
-    {
187
+void Render::display() {
188
+    switch (mMode) {
207 189
         case Render::modeDisabled:
208 190
             return;
209 191
         case Render::modeLoadScreen:
@@ -221,8 +203,7 @@ void Render::display()
221 203
 
222 204
     float camOffsetH = 0.0f;
223 205
 
224
-    switch (getGame().getLara().getMoveType())
225
-    {
206
+    switch (getGame().getLara().getMoveType()) {
226 207
         case Entity::MoveTypeFly:
227 208
         case Entity::MoveTypeNoClipping:
228 209
         case Entity::MoveTypeSwim:
@@ -252,8 +233,8 @@ void Render::display()
252 233
 
253 234
     // Handle camera out of world
254 235
     if ((sector < 0) ||
255
-            ((unsigned int)sector >= getWorld().getRoom(index).sizeSectors()) ||
256
-            getWorld().getRoom(index).isWall(sector)) {
236
+        ((unsigned int)sector >= getWorld().getRoom(index).sizeSectors()) ||
237
+        getWorld().getRoom(index).isWall(sector)) {
257 238
         camPos[0] = curPos[0] + (64.0f * sinf(yaw));
258 239
         camPos[1] -= 64.0f;
259 240
         camPos[2] = curPos[2] + (64.0f * cosf(yaw));
@@ -281,7 +262,7 @@ void Render::display()
281 262
 
282 263
     // Room solid pass, need to do depth sorting to avoid 2 pass render
283 264
     for (unsigned int i = 0; i < mRoomRenderList.size(); i++) {
284
-        Room &room = *mRoomRenderList[i];
265
+        Room& room = *mRoomRenderList[i];
285 266
 
286 267
         if (mFlags & Render::fGL_Lights)
287 268
             lightRoom(room);
@@ -291,10 +272,10 @@ void Render::display()
291 272
 
292 273
     // Draw all visible enities
293 274
     if (mFlags & Render::fEntityModels) {
294
-        std::vector<Entity *> entityRenderList;
275
+        std::vector<Entity*> entityRenderList;
295 276
 
296 277
         for (unsigned int i = 0; i < getWorld().sizeEntity(); i++) {
297
-            Entity &e = getWorld().getEntity(i);
278
+            Entity& e = getWorld().getEntity(i);
298 279
 
299 280
             // Don't show Lara to the player
300 281
             if (&e == &getGame().getLara())
@@ -303,7 +284,7 @@ void Render::display()
303 284
             // Mongoose 2002.08.15, Nothing to draw, skip
304 285
             // Mongoose 2002.12.24, Some entities have no animation =p
305 286
             if (e.getModel().size() == 0)
306
-                    continue;
287
+                continue;
307 288
 
308 289
             // Is it in view volume? ( Hack to use sphere )
309 290
             if (!isVisible(e.getPos(0), e.getPos(1), e.getPos(2), 512.0f))
@@ -326,7 +307,7 @@ void Render::display()
326 307
 
327 308
         // Draw sprites after player to handle alpha
328 309
         for (unsigned int i = 0; i < getWorld().sizeSprite(); i++) {
329
-            SpriteSequence &sprite = getWorld().getSprite(i);
310
+            SpriteSequence& sprite = getWorld().getSprite(i);
330 311
             for (unsigned int j = 0; j < sprite.size(); j++)
331 312
                 sprite.get(j).display();
332 313
         }
@@ -353,8 +334,7 @@ void Render::display()
353 334
     glFlush();
354 335
 }
355 336
 
356
-void Render::drawLoadScreen()
357
-{
337
+void Render::drawLoadScreen() {
358 338
     float x = 0.0f, y = 0.0f, z = 0.0f;
359 339
     float w = getWindow().getWidth(), h = getWindow().getHeight();
360 340
 
@@ -397,20 +377,15 @@ void Render::drawLoadScreen()
397 377
     glFlush();
398 378
 }
399 379
 
400
-void Render::newRoomRenderList(int index)
401
-{
380
+void Render::newRoomRenderList(int index) {
402 381
     static int currentRoomId = -1;
403 382
 
404
-    if (index == -1) // -1 is error, so draw room 0, for the hell of it
405
-    {
383
+    if (index == -1) { // -1 is error, so draw room 0, for the hell of it
406 384
         mRoomRenderList.clear();
407 385
         mRoomRenderList.push_back(&getWorld().getRoom(0));
408
-    }
409
-    else
410
-    {
386
+    } else {
411 387
         // Update room render list if needed
412
-        if (currentRoomId != index)
413
-        {
388
+        if (currentRoomId != index) {
414 389
             buildRoomRenderList(getWorld().getRoom(index));
415 390
         }
416 391
     }
@@ -418,8 +393,7 @@ void Render::newRoomRenderList(int index)
418 393
     currentRoomId = index;
419 394
 }
420 395
 
421
-void Render::buildRoomRenderList(Room &room)
422
-{
396
+void Render::buildRoomRenderList(Room& room) {
423 397
 
424 398
     // Must be visible
425 399
     //! \fixme Add depth sorting here - remove multipass
@@ -427,9 +401,8 @@ void Render::buildRoomRenderList(Room &room)
427 401
         return;
428 402
 
429 403
     // Must not already be cached
430
-    for (unsigned int i = 0; i < mRoomRenderList.size(); i++)
431
-    {
432
-        Room *room2 = mRoomRenderList[i];
404
+    for (unsigned int i = 0; i < mRoomRenderList.size(); i++) {
405
+        Room* room2 = mRoomRenderList[i];
433 406
 
434 407
         if (room2 == &room)
435 408
             return;
@@ -439,12 +412,11 @@ void Render::buildRoomRenderList(Room &room)
439 412
     mRoomRenderList.push_back(&room);
440 413
 
441 414
     // Try to add adj rooms and their adj rooms, skip this room
442
-    for (unsigned int i = 1; i < room.sizeAdjacentRooms(); i++)
443
-    {
415
+    for (unsigned int i = 1; i < room.sizeAdjacentRooms(); i++) {
444 416
         if (room.getAdjacentRoom(i) < 0)
445 417
             continue;
446 418
 
447
-        Room &room2 = getWorld().getRoom(room.getAdjacentRoom(i));
419
+        Room& room2 = getWorld().getRoom(room.getAdjacentRoom(i));
448 420
 
449 421
         //! \fixme Add portal visibility check here
450 422
 
@@ -453,8 +425,7 @@ void Render::buildRoomRenderList(Room &room)
453 425
     }
454 426
 }
455 427
 
456
-void Render::drawSkyMesh(float scale)
457
-{
428
+void Render::drawSkyMesh(float scale) {
458 429
     //skeletal_model_t *model = getWorld().getModel(mSkyMesh);
459 430
     //if (!model)
460 431
     //    return;
@@ -473,14 +444,12 @@ void Render::drawSkyMesh(float scale)
473 444
     glEnable(GL_DEPTH_TEST);
474 445
 }
475 446
 
476
-void Render::setSkyMesh(int index, bool rot)
477
-{
447
+void Render::setSkyMesh(int index, bool rot) {
478 448
     mSkyMesh = index;
479 449
     mSkyMeshRotation = rot;
480 450
 }
481 451
 
482
-void Render::updateViewVolume()
483
-{
452
+void Render::updateViewVolume() {
484 453
     float proj[16], mdl[16];
485 454
 
486 455
     glGetFloatv(GL_PROJECTION_MATRIX, proj);
@@ -488,7 +457,7 @@ void Render::updateViewVolume()
488 457
     mViewVolume.updateFrame(proj, mdl);
489 458
 }
490 459
 
491
-bool Render::isVisible(BoundingBox &box) {
460
+bool Render::isVisible(BoundingBox& box) {
492 461
     float bbox[2][3];
493 462
     box.getBoundingBox(bbox);
494 463
 
@@ -499,11 +468,9 @@ bool Render::isVisible(BoundingBox &box) {
499 468
     return mViewVolume.isBboxInFrustum(bbox[0], bbox[1]);
500 469
 }
501 470
 
502
-bool Render::isVisible(float x, float y, float z)
503
-{
471
+bool Render::isVisible(float x, float y, float z) {
504 472
     // For debugging purposes
505
-    if (mMode == Render::modeWireframe)
506
-    {
473
+    if (mMode == Render::modeWireframe) {
507 474
         glPointSize(5.0);
508 475
         glColor3ubv(PINK);
509 476
         glBegin(GL_POINTS);
@@ -514,11 +481,9 @@ bool Render::isVisible(float x, float y, float z)
514 481
     return (mViewVolume.isPointInFrustum(x, y, z));
515 482
 }
516 483
 
517
-bool Render::isVisible(float x, float y, float z, float radius)
518
-{
484
+bool Render::isVisible(float x, float y, float z, float radius) {
519 485
     // For debugging purposes
520
-    if (mMode == Render::modeWireframe)
521
-    {
486
+    if (mMode == Render::modeWireframe) {
522 487
         glPointSize(5.0);
523 488
         glColor3ubv(PINK);
524 489
         glBegin(GL_POINTS);

+ 87
- 128
src/Room.cpp Wyświetl plik

@@ -19,7 +19,7 @@
19 19
 extern std::map<int, int> gMapTex2Bump;
20 20
 #endif
21 21
 
22
-Room::Room(TombRaider &tr, unsigned int index) {
22
+Room::Room(TombRaider& tr, unsigned int index) {
23 23
     float box[2][3];
24 24
     Matrix transform;
25 25
 
@@ -88,25 +88,25 @@ Room::Room(TombRaider &tr, unsigned int index) {
88 88
 //#define EXPERIMENTAL_UNIFIED_ROOM_GEOMETERY
89 89
 #ifdef EXPERIMENTAL_UNIFIED_ROOM_GEOMETERY
90 90
     unsigned int vertexCount, normalCount, colorCount, triCount;
91
-    float *vertexArray;
92
-    float *normalArray;
93
-    float *colorArray;
94
-    unsigned int *indices, *fflags;
95
-    float *texCoords;
96
-    int *textures;
91
+    float* vertexArray;
92
+    float* normalArray;
93
+    float* colorArray;
94
+    unsigned int* indices, *fflags;
95
+    float* texCoords;
96
+    int* textures;
97 97
 
98 98
     tr.getRoomVertexArrays(index,
99
-            &vertexCount, &vertexArray,
100
-            &normalCount, &normalArray,
101
-            &colorCount, &colorArray);
99
+                           &vertexCount, &vertexArray,
100
+                           &normalCount, &normalArray,
101
+                           &colorCount, &colorArray);
102 102
 
103 103
     mesh.bufferVertexArray(vertexCount, vertexArray);
104 104
     mesh.bufferNormalArray(normalCount, normalArray);
105 105
     mesh.bufferColorArray(vertexCount, colorArray);
106 106
 
107 107
     tr.getRoomTriangles(index, getGame().getTextureStart(),
108
-            &triCount, &indices, &texCoords, &textures,
109
-            &fflags);
108
+                        &triCount, &indices, &texCoords, &textures,
109
+                        &fflags);
110 110
 
111 111
     mesh.bufferTriangles(triCount, indices, texCoords, textures, fflags);
112 112
 #else
@@ -119,8 +119,7 @@ Room::Room(TombRaider &tr, unsigned int index) {
119 119
     mesh.allocateNormals(0); // count
120 120
     mesh.allocateColors(count);
121 121
 
122
-    for (unsigned int i = 0; i < count; ++i)
123
-    {
122
+    for (unsigned int i = 0; i < count; ++i) {
124 123
         tr.getRoomVertex(index, i, xyz, rgba);
125 124
 
126 125
         mesh.setVertex(i, xyz[0], xyz[1], xyz[2]);
@@ -137,8 +136,7 @@ Room::Room(TombRaider &tr, unsigned int index) {
137 136
     int tris_mesh_map[TextureLimit];
138 137
     int rect_mesh_map[TextureLimit];
139 138
 
140
-    for (unsigned int i = 0; i < TextureLimit; ++i)
141
-    {
139
+    for (unsigned int i = 0; i < TextureLimit; ++i) {
142 140
         triangle_counter[i]        = 0;
143 141
         triangle_counter_alpha[i]  = 0;
144 142
         rectangle_counter[i]       = 0;
@@ -159,66 +157,54 @@ Room::Room(TombRaider &tr, unsigned int index) {
159 157
     count = tr.getRoomTriangleCount(index);
160 158
 
161 159
     // Mongoose 2002.08.15, Presort by alpha and texture and setup mapping
162
-    for (t = 0; t < count; ++t)
163
-    {
160
+    for (t = 0; t < count; ++t) {
164 161
         tr.getRoomTriangle(index, t,
165
-                indices, texCoords, &texture, &flags);
162
+                           indices, texCoords, &texture, &flags);
166 163
 
167 164
         texture += getGame().getTextureStart();
168 165
 
169
-        if (texture > (int)TextureLimit)
170
-        {
166
+        if (texture > (int)TextureLimit) {
171 167
             getLog() << "Handling bad room[" << index << "].tris["
172
-                << t << "].texture = " << texture << Log::endl;
168
+                     << t << "].texture = " << texture << Log::endl;
173 169
             texture = TextureLimit - 1;
174 170
         }
175 171
 
176 172
         // Counters set up polygon allocation
177 173
         if (flags & tombraiderFace_Alpha ||
178
-                flags & tombraiderFace_PartialAlpha)
179
-        {
174
+            flags & tombraiderFace_PartialAlpha) {
180 175
             triangle_counter_alpha[texture] += 1;
181
-        }
182
-        else
183
-        {
176
+        } else {
184 177
             triangle_counter[texture] += 1;
185 178
         }
186 179
 
187 180
         // Counter sets up texture id to mesh id mapping
188
-        if (tris_mesh_map[texture] == -1)
189
-        {
181
+        if (tris_mesh_map[texture] == -1) {
190 182
             tris_mesh_map[texture] = ++numTris;
191 183
         }
192 184
     }
193 185
 
194 186
     count = tr.getRoomRectangleCount(index);
195 187
 
196
-    for (r = 0; r < count; ++r)
197
-    {
188
+    for (r = 0; r < count; ++r) {
198 189
         tr.getRoomRectangle(index, r,
199
-                indices, texCoords, &texture, &flags);
190
+                            indices, texCoords, &texture, &flags);
200 191
 
201 192
         texture += getGame().getTextureStart();
202 193
 
203
-        if (texture > (int)TextureLimit)
204
-        {
194
+        if (texture > (int)TextureLimit) {
205 195
             getLog() << "Handling bad room[" << index << "].quad["
206
-                << r << "].texture = " << texture << Log::endl;
196
+                     << r << "].texture = " << texture << Log::endl;
207 197
             texture = TextureLimit - 1;
208 198
         }
209 199
 
210 200
         if (flags & tombraiderFace_Alpha ||
211
-                flags & tombraiderFace_PartialAlpha)
212
-        {
201
+            flags & tombraiderFace_PartialAlpha) {
213 202
             rectangle_counter_alpha[texture] += 1;
214
-        }
215
-        else
216
-        {
203
+        } else {
217 204
             rectangle_counter[texture] += 1;
218 205
         }
219 206
 
220
-        if (rect_mesh_map[texture] == -1)
221
-        {
207
+        if (rect_mesh_map[texture] == -1) {
222 208
             rect_mesh_map[texture] = ++numQuads;
223 209
         }
224 210
     }
@@ -227,10 +213,8 @@ Room::Room(TombRaider &tr, unsigned int index) {
227 213
     mesh.allocateTriangles(numTris);
228 214
     mesh.allocateRectangles(numQuads);
229 215
 
230
-    for (unsigned int i = 0, j = 0; i < TextureLimit; ++i)
231
-    {
232
-        if (tris_mesh_map[i] > 0)
233
-        {
216
+    for (unsigned int i = 0, j = 0; i < TextureLimit; ++i) {
217
+        if (tris_mesh_map[i] > 0) {
234 218
             j = tris_mesh_map[i] - 1;
235 219
 
236 220
             t = triangle_counter[i];
@@ -248,10 +232,9 @@ Room::Room(TombRaider &tr, unsigned int index) {
248 232
             mesh.mTris[j].texcoors = 0x0;
249 233
             mesh.mTris[j].texcoors2 = 0x0;
250 234
 
251
-            if (t > 0)
252
-            {
235
+            if (t > 0) {
253 236
                 mesh.mTris[j].num_triangles = t;
254
-                mesh.mTris[j].triangles = new unsigned int[t*3];
237
+                mesh.mTris[j].triangles = new unsigned int[t * 3];
255 238
                 mesh.mTris[j].num_texcoors = t * 3;
256 239
                 mesh.mTris[j].texcoors = new float *[t * 3];
257 240
                 for (unsigned int tmp = 0; tmp < (t * 3); tmp++)
@@ -260,10 +243,9 @@ Room::Room(TombRaider &tr, unsigned int index) {
260 243
 
261 244
             t = triangle_counter_alpha[i];
262 245
 
263
-            if (t > 0)
264
-            {
246
+            if (t > 0) {
265 247
                 mesh.mTris[j].num_alpha_triangles = t;
266
-                mesh.mTris[j].alpha_triangles = new unsigned int[t*3];
248
+                mesh.mTris[j].alpha_triangles = new unsigned int[t * 3];
267 249
                 mesh.mTris[j].num_texcoors2 = t * 3;
268 250
                 mesh.mTris[j].texcoors2 = new float *[t * 3];
269 251
                 for (unsigned int tmp = 0; tmp < (t * 3); tmp++)
@@ -273,8 +255,7 @@ Room::Room(TombRaider &tr, unsigned int index) {
273 255
 
274 256
         ///////////////////////////////////////////
275 257
 
276
-        if (rect_mesh_map[i] > 0)
277
-        {
258
+        if (rect_mesh_map[i] > 0) {
278 259
             j = rect_mesh_map[i] - 1;
279 260
 
280 261
             r = rectangle_counter[i];
@@ -292,10 +273,9 @@ Room::Room(TombRaider &tr, unsigned int index) {
292 273
             mesh.mQuads[j].texcoors = 0x0;
293 274
             mesh.mQuads[j].texcoors2 = 0x0;
294 275
 
295
-            if (r > 0)
296
-            {
276
+            if (r > 0) {
297 277
                 mesh.mQuads[j].num_quads = r;
298
-                mesh.mQuads[j].quads = new unsigned int[r*4];
278
+                mesh.mQuads[j].quads = new unsigned int[r * 4];
299 279
                 mesh.mQuads[j].num_texcoors = r * 4;
300 280
                 mesh.mQuads[j].texcoors = new float *[r * 4];
301 281
                 for (unsigned int tmp = 0; tmp < (r * 4); tmp++)
@@ -304,10 +284,9 @@ Room::Room(TombRaider &tr, unsigned int index) {
304 284
 
305 285
             r = rectangle_counter_alpha[i];
306 286
 
307
-            if (r > 0)
308
-            {
287
+            if (r > 0) {
309 288
                 mesh.mQuads[j].num_alpha_quads = r;
310
-                mesh.mQuads[j].alpha_quads = new unsigned int[r*4];
289
+                mesh.mQuads[j].alpha_quads = new unsigned int[r * 4];
311 290
                 mesh.mQuads[j].num_texcoors2 = r * 4;
312 291
                 mesh.mQuads[j].texcoors2 = new float *[r * 4];
313 292
                 for (unsigned int tmp = 0; tmp < (r * 4); tmp++)
@@ -319,10 +298,9 @@ Room::Room(TombRaider &tr, unsigned int index) {
319 298
     // Generate textured triangles
320 299
     count = tr.getRoomTriangleCount(index);
321 300
 
322
-    for (t = 0; t < count; ++t)
323
-    {
301
+    for (t = 0; t < count; ++t) {
324 302
         tr.getRoomTriangle(index, t,
325
-                indices, texCoords, &texture, &flags);
303
+                           indices, texCoords, &texture, &flags);
326 304
 
327 305
         // Adjust texture id using getGame().getTextureStart() to map into
328 306
         // correct textures
@@ -331,46 +309,38 @@ Room::Room(TombRaider &tr, unsigned int index) {
331 309
         unsigned int j = tris_mesh_map[texture] - 1;
332 310
 
333 311
         // Setup per vertex
334
-        for (unsigned int i = 0; i < 3; ++i)
335
-        {
312
+        for (unsigned int i = 0; i < 3; ++i) {
336 313
             // Get vertex index {(0, a), (1, b), (2, c)}
337 314
             v = indices[i];
338 315
 
339 316
             if ((flags & tombraiderFace_Alpha ||
340
-                        flags & tombraiderFace_PartialAlpha) &&
341
-                    mesh.mTris[j].num_alpha_triangles > 0)
342
-            {
343
-                q = mesh.mTris[j].cnum_alpha_triangles*3+i;
317
+                 flags & tombraiderFace_PartialAlpha) &&
318
+                mesh.mTris[j].num_alpha_triangles > 0) {
319
+                q = mesh.mTris[j].cnum_alpha_triangles * 3 + i;
344 320
 
345 321
                 mesh.mTris[j].alpha_triangles[q] = v;
346 322
 
347
-                mesh.mTris[j].texcoors2[q][0] = texCoords[i*2];
348
-                mesh.mTris[j].texcoors2[q][1] = texCoords[i*2+1];
349
-            }
350
-            else if (mesh.mTris[j].num_triangles > 0)
351
-            {
352
-                q = mesh.mTris[j].cnum_triangles*3+i;
323
+                mesh.mTris[j].texcoors2[q][0] = texCoords[i * 2];
324
+                mesh.mTris[j].texcoors2[q][1] = texCoords[i * 2 + 1];
325
+            } else if (mesh.mTris[j].num_triangles > 0) {
326
+                q = mesh.mTris[j].cnum_triangles * 3 + i;
353 327
 
354 328
                 mesh.mTris[j].triangles[q] = v;
355 329
 
356
-                mesh.mTris[j].texcoors[q][0] = texCoords[i*2];
357
-                mesh.mTris[j].texcoors[q][1] = texCoords[i*2+1];
330
+                mesh.mTris[j].texcoors[q][0] = texCoords[i * 2];
331
+                mesh.mTris[j].texcoors[q][1] = texCoords[i * 2 + 1];
358 332
             }
359 333
 
360 334
             // Partial alpha hack
361
-            if (flags & tombraiderFace_PartialAlpha)
362
-            {
335
+            if (flags & tombraiderFace_PartialAlpha) {
363 336
                 //mesh.colors[v].rgba[3] = 0.45;
364 337
             }
365 338
         }
366 339
 
367 340
         if (flags & tombraiderFace_Alpha ||
368
-                flags & tombraiderFace_PartialAlpha)
369
-        {
341
+            flags & tombraiderFace_PartialAlpha) {
370 342
             mesh.mTris[j].cnum_alpha_triangles++;
371
-        }
372
-        else
373
-        {
343
+        } else {
374 344
             mesh.mTris[j].cnum_triangles++;
375 345
         }
376 346
     }
@@ -378,67 +348,57 @@ Room::Room(TombRaider &tr, unsigned int index) {
378 348
     // Generate textured quads
379 349
     count = tr.getRoomRectangleCount(index);
380 350
 
381
-    for (r = 0; r < count; ++r)
382
-    {
351
+    for (r = 0; r < count; ++r) {
383 352
         tr.getRoomRectangle(index, r,
384
-                indices, texCoords, &texture, &flags);
353
+                            indices, texCoords, &texture, &flags);
385 354
 
386 355
         // Adjust texture id using getGame().getTextureStart() to map into
387 356
         // correct textures
388 357
         texture += getGame().getTextureStart();
389 358
 
390
-        if (texture > (int)TextureLimit)
391
-        {
359
+        if (texture > (int)TextureLimit) {
392 360
             texture = TextureLimit - 1;
393 361
         }
394 362
 
395 363
         unsigned int j = rect_mesh_map[texture] - 1;
396 364
 
397 365
         if (mesh.mQuads[j].num_quads <= 0 &&
398
-                mesh.mQuads[j].num_alpha_quads <= 0)
366
+            mesh.mQuads[j].num_alpha_quads <= 0)
399 367
             continue;
400 368
 
401 369
         // Setup per vertex
402
-        for (unsigned int i = 0; i < 4; ++i)
403
-        {
370
+        for (unsigned int i = 0; i < 4; ++i) {
404 371
             // Get vertex index {(0, a), (1, b), (2, c), (3, d)}
405 372
             v = indices[i];
406 373
 
407 374
             if ((flags & tombraiderFace_Alpha ||
408
-                        flags & tombraiderFace_PartialAlpha) &&
409
-                    mesh.mQuads[j].num_alpha_quads > 0)
410
-            {
411
-                q = mesh.mQuads[j].cnum_alpha_quads*4+i;
375
+                 flags & tombraiderFace_PartialAlpha) &&
376
+                mesh.mQuads[j].num_alpha_quads > 0) {
377
+                q = mesh.mQuads[j].cnum_alpha_quads * 4 + i;
412 378
 
413 379
                 mesh.mQuads[j].alpha_quads[q] = v;
414 380
 
415
-                mesh.mQuads[j].texcoors2[q][0] = texCoords[i*2];
416
-                mesh.mQuads[j].texcoors2[q][1] = texCoords[i*2+1];
417
-            }
418
-            else if (mesh.mQuads[j].num_quads > 0)
419
-            {
420
-                q = mesh.mQuads[j].cnum_quads*4+i;
381
+                mesh.mQuads[j].texcoors2[q][0] = texCoords[i * 2];
382
+                mesh.mQuads[j].texcoors2[q][1] = texCoords[i * 2 + 1];
383
+            } else if (mesh.mQuads[j].num_quads > 0) {
384
+                q = mesh.mQuads[j].cnum_quads * 4 + i;
421 385
 
422 386
                 mesh.mQuads[j].quads[q] = v;
423 387
 
424
-                mesh.mQuads[j].texcoors[q][0] = texCoords[i*2];
425
-                mesh.mQuads[j].texcoors[q][1] = texCoords[i*2+1];
388
+                mesh.mQuads[j].texcoors[q][0] = texCoords[i * 2];
389
+                mesh.mQuads[j].texcoors[q][1] = texCoords[i * 2 + 1];
426 390
             }
427 391
 
428 392
             // Partial alpha hack
429
-            if (flags & tombraiderFace_PartialAlpha)
430
-            {
393
+            if (flags & tombraiderFace_PartialAlpha) {
431 394
                 //rRoom->mesh.colors[v].rgba[3] = 0.45;
432 395
             }
433 396
         }
434 397
 
435 398
         if (flags & tombraiderFace_Alpha ||
436
-                flags & tombraiderFace_PartialAlpha)
437
-        {
399
+            flags & tombraiderFace_PartialAlpha) {
438 400
             mesh.mQuads[j].cnum_alpha_quads++;
439
-        }
440
-        else
441
-        {
401
+        } else {
442 402
             mesh.mQuads[j].cnum_quads++;
443 403
         }
444 404
     }
@@ -471,7 +431,7 @@ void Room::display(bool alpha) {
471 431
         glColor3ubv(RED);
472 432
 
473 433
         for (unsigned int i = 0; i < sizePortals(); i++) {
474
-            Portal &portal = getPortal(i);
434
+            Portal& portal = getPortal(i);
475 435
             float vertices[4][3];
476 436
             portal.getVertices(vertices);
477 437
 
@@ -495,8 +455,7 @@ void Room::display(bool alpha) {
495 455
     // Reset since GL_MODULATE used, reset to WHITE
496 456
     glColor3ubv(WHITE);
497 457
 
498
-    switch (getRender().getMode())
499
-    {
458
+    switch (getRender().getMode()) {
500 459
         case Render::modeWireframe:
501 460
             getMesh().mMode = Mesh::MeshModeWireframe;
502 461
             break;
@@ -517,7 +476,7 @@ void Room::display(bool alpha) {
517 476
 
518 477
     // Draw other room meshes and sprites
519 478
     if (alpha || (getRender().getMode() == Render::modeWireframe)
520
-            || (getRender().getMode() == Render::modeSolid)) {
479
+        || (getRender().getMode() == Render::modeSolid)) {
521 480
         sortModels();
522 481
         for (unsigned int i = 0; i < sizeModels(); i++)
523 482
             getModel(i).display();
@@ -534,7 +493,7 @@ bool Room::isWall(unsigned long sector) {
534 493
     return ((sector > 0) && sectors.at(sector)->isWall());
535 494
 }
536 495
 
537
-long Room::getSector(float x, float z, float *floor, float *ceiling) {
496
+long Room::getSector(float x, float z, float* floor, float* ceiling) {
538 497
     assert(floor != NULL);
539 498
     assert(ceiling != NULL);
540 499
 
@@ -550,7 +509,7 @@ long Room::getSector(float x, float z, float *floor, float *ceiling) {
550 509
 
551 510
 long Room::getSector(float x, float z) {
552 511
     long sector = (((((int)x - (int)pos[0]) / 1024) *
553
-        numZSectors) + (((int)z - (int)pos[2]) / 1024));
512
+                    numZSectors) + (((int)z - (int)pos[2]) / 1024));
554 513
 
555 514
     if (sector < 0)
556 515
         return -1;
@@ -558,14 +517,14 @@ long Room::getSector(float x, float z) {
558 517
     return sector;
559 518
 }
560 519
 
561
-void Room::getHeightAtPosition(float x, float *y, float z) {
520
+void Room::getHeightAtPosition(float x, float* y, float z) {
562 521
     long sector = getSector(x, z);
563 522
     if ((sector >= 0) && (sector < (long)sectors.size()))
564 523
         *y = sectors.at(sector)->getFloor();
565 524
 }
566 525
 
567 526
 int Room::getAdjoiningRoom(float x, float y, float z,
568
-        float x2, float y2, float z2) {
527
+                           float x2, float y2, float z2) {
569 528
     float intersect[3], p1[3], p2[3];
570 529
     float vertices[4][3];
571 530
 
@@ -575,7 +534,7 @@ int Room::getAdjoiningRoom(float x, float y, float z,
575 534
     for (unsigned long i = 0; i < portals.size(); i++) {
576 535
         portals.at(i)->getVertices(vertices);
577 536
         if (intersectionLinePolygon(intersect, p1, p2, //4,
578
-                    vertices))
537
+                                    vertices))
579 538
             return portals.at(i)->getAdjoiningRoom();
580 539
     }
581 540
 
@@ -612,7 +571,7 @@ unsigned long Room::sizePortals() {
612 571
     return portals.size();
613 572
 }
614 573
 
615
-Portal &Room::getPortal(unsigned long index) {
574
+Portal& Room::getPortal(unsigned long index) {
616 575
     assert(index < portals.size());
617 576
     return *portals.at(index);
618 577
 }
@@ -621,7 +580,7 @@ unsigned long Room::sizeSectors() {
621 580
     return sectors.size();
622 581
 }
623 582
 
624
-Sector &Room::getSector(unsigned long index) {
583
+Sector& Room::getSector(unsigned long index) {
625 584
     assert(index < sectors.size());
626 585
     return *sectors.at(index);
627 586
 }
@@ -630,7 +589,7 @@ unsigned long Room::sizeBox() {
630 589
     return boxes.size();
631 590
 }
632 591
 
633
-Box &Room::getBox(unsigned long index) {
592
+Box& Room::getBox(unsigned long index) {
634 593
     assert(index < boxes.size());
635 594
     return *boxes.at(index);
636 595
 }
@@ -639,7 +598,7 @@ unsigned long Room::sizeModels() {
639 598
     return models.size();
640 599
 }
641 600
 
642
-StaticModel &Room::getModel(unsigned long index) {
601
+StaticModel& Room::getModel(unsigned long index) {
643 602
     assert(index < models.size());
644 603
     return *models.at(index);
645 604
 }
@@ -652,7 +611,7 @@ unsigned long Room::sizeLights() {
652 611
     return lights.size();
653 612
 }
654 613
 
655
-Light &Room::getLight(unsigned long index) {
614
+Light& Room::getLight(unsigned long index) {
656 615
     assert(index < lights.size());
657 616
     return *lights.at(index);
658 617
 }
@@ -661,16 +620,16 @@ unsigned long Room::sizeSprites() {
661 620
     return sprites.size();
662 621
 }
663 622
 
664
-Sprite &Room::getSprite(unsigned long index) {
623
+Sprite& Room::getSprite(unsigned long index) {
665 624
     assert(index < sprites.size());
666 625
     return *sprites.at(index);
667 626
 }
668 627
 
669
-BoundingBox &Room::getBoundingBox() {
628
+BoundingBox& Room::getBoundingBox() {
670 629
     return bbox;
671 630
 }
672 631
 
673
-Mesh &Room::getMesh() {
632
+Mesh& Room::getMesh() {
674 633
     return mesh;
675 634
 }
676 635
 

+ 15
- 16
src/RoomData.cpp Wyświetl plik

@@ -56,8 +56,7 @@ void BoundingBox::display(bool points, const unsigned char c1[4], const unsigned
56 56
     glVertex3f(b[0], b[1], b[2]);
57 57
     glVertex3f(a[0], a[1], a[2]);
58 58
 
59
-    if (points)
60
-    {
59
+    if (points) {
61 60
         glVertex3f(b[0], a[1], b[2]);
62 61
         glVertex3f(a[0], b[1], b[2]);
63 62
         glVertex3f(b[0], b[1], a[2]);
@@ -119,11 +118,11 @@ void BoundingBox::display(bool points, const unsigned char c1[4], const unsigned
119 118
 
120 119
 // ----------------------------------------------------------------------------
121 120
 
122
-Light::Light(TombRaider &tr, unsigned int room, unsigned int index) {
121
+Light::Light(TombRaider& tr, unsigned int room, unsigned int index) {
123 122
     unsigned int lightFlags, lightType;
124 123
 
125 124
     tr.getRoomLight(room, index, pos, color,
126
-            dir, &att, &cutoff, &lightType, &lightFlags);
125
+                    dir, &att, &cutoff, &lightType, &lightFlags);
127 126
 
128 127
     switch (lightType) {
129 128
         case tombraiderLight_typeDirectional:
@@ -174,12 +173,12 @@ Light::LightType Light::getType() {
174 173
 
175 174
 // ----------------------------------------------------------------------------
176 175
 
177
-StaticModel::StaticModel(TombRaider &tr, unsigned int room, unsigned int i) {
176
+StaticModel::StaticModel(TombRaider& tr, unsigned int room, unsigned int i) {
178 177
     tr.getRoomModel(room, i, &index, pos, &yaw);
179 178
 }
180 179
 
181 180
 void StaticModel::display() {
182
-    StaticMesh &mesh = getWorld().getStaticMesh(index);
181
+    StaticMesh& mesh = getWorld().getStaticMesh(index);
183 182
 
184 183
     if (!getRender().isVisible(pos[0], pos[1], pos[2], mesh.getRadius()))
185 184
         return;
@@ -191,7 +190,7 @@ void StaticModel::display() {
191 190
     glPopMatrix();
192 191
 }
193 192
 
194
-bool StaticModel::operator<(const StaticModel &other) {
193
+bool StaticModel::operator<(const StaticModel& other) {
195 194
     float distA, distB;
196 195
     distA = getRender().mViewVolume.getDistToSphereFromNear(pos[0],
197 196
             pos[1], pos[2], 128.0f);
@@ -200,19 +199,19 @@ bool StaticModel::operator<(const StaticModel &other) {
200 199
     return (distA < distB);
201 200
 }
202 201
 
203
-bool StaticModel::compare(StaticModel *a, StaticModel *b) {
202
+bool StaticModel::compare(StaticModel* a, StaticModel* b) {
204 203
     return (*b) < (*a);
205 204
 }
206 205
 
207 206
 // ----------------------------------------------------------------------------
208 207
 
209
-Portal::Portal(TombRaider &tr, unsigned int room, unsigned int index, Matrix &transform) {
208
+Portal::Portal(TombRaider& tr, unsigned int room, unsigned int index, Matrix& transform) {
210 209
     float portalVertices[12];
211 210
     tr.getRoomPortal(room, index, &adjoiningRoom, normal, portalVertices);
212 211
     for (unsigned int j = 0; j < 4; ++j) {
213
-        vertices[j][0] = portalVertices[j*3];
214
-        vertices[j][1] = portalVertices[j*3+1];
215
-        vertices[j][2] = portalVertices[j*3+2];
212
+        vertices[j][0] = portalVertices[j * 3];
213
+        vertices[j][1] = portalVertices[j * 3 + 1];
214
+        vertices[j][2] = portalVertices[j * 3 + 2];
216 215
 
217 216
         // Relative coors in vis portals
218 217
         transform.multiply3v(vertices[j], vertices[j]);
@@ -233,19 +232,19 @@ int Portal::getAdjoiningRoom() {
233 232
 
234 233
 // ----------------------------------------------------------------------------
235 234
 
236
-Box::Box(TombRaider &tr, unsigned int room, unsigned int index) {
235
+Box::Box(TombRaider& tr, unsigned int room, unsigned int index) {
237 236
     tr.getRoomBox(room, index, a, b, c, d);
238 237
 }
239 238
 
240 239
 // ----------------------------------------------------------------------------
241 240
 
242
-Sector::Sector(TombRaider &tr, unsigned int room, unsigned int index) {
241
+Sector::Sector(TombRaider& tr, unsigned int room, unsigned int index) {
243 242
     unsigned int sectorFlags;
244 243
     int floorDataIndex, boxIndex, roomBelow, roomAbove;
245 244
 
246 245
     tr.getRoomSector(room, index, &sectorFlags,
247
-            &ceiling, &floor, &floorDataIndex, &boxIndex,
248
-            &roomBelow, &roomAbove);
246
+                     &ceiling, &floor, &floorDataIndex, &boxIndex,
247
+                     &roomBelow, &roomAbove);
249 248
 
250 249
     wall = (sectorFlags & tombraiderSector_wall);
251 250
 }

+ 9
- 8
src/Script.cpp Wyświetl plik

@@ -15,7 +15,7 @@ Script::~Script() {
15 15
 
16 16
 }
17 17
 
18
-int Script::load(const char *file) {
18
+int Script::load(const char* file) {
19 19
     BinaryFile f;
20 20
 
21 21
     if (f.open(file) != 0)
@@ -96,14 +96,14 @@ int Script::load(const char *file) {
96 96
     return 0;
97 97
 }
98 98
 
99
-void Script::readStringPackage(BinaryFile &f, std::vector<std::string> &v, unsigned int n) {
100
-    uint16_t *offset = new uint16_t[n];
99
+void Script::readStringPackage(BinaryFile& f, std::vector<std::string>& v, unsigned int n) {
100
+    uint16_t* offset = new uint16_t[n];
101 101
     for (unsigned int i = 0; i < n; i++)
102 102
         offset[i] = f.readU16();
103 103
 
104 104
     uint16_t numBytes = f.readU16();
105 105
 
106
-    char *list = new char[numBytes];
106
+    char* list = new char[numBytes];
107 107
     for (uint16_t i = 0; i < numBytes; i++) {
108 108
         list[i] = f.read8();
109 109
         if (flags & S_UseSecurityTag) {
@@ -120,8 +120,9 @@ void Script::readStringPackage(BinaryFile &f, std::vector<std::string> &v, unsig
120 120
     delete [] offset;
121 121
 }
122 122
 
123
-void Script::readScriptPackage(BinaryFile &f, std::vector<std::vector<uint16_t>> &v, unsigned int n) {
124
-    uint16_t *offset = new uint16_t[n];
123
+void Script::readScriptPackage(BinaryFile& f, std::vector<std::vector<uint16_t>>& v,
124
+                               unsigned int n) {
125
+    uint16_t* offset = new uint16_t[n];
125 126
     for (unsigned int i = 0; i < n; i++) {
126 127
         offset[i] = f.readU16();
127 128
         assertEqual(offset[i] % 2, 0);
@@ -130,7 +131,7 @@ void Script::readScriptPackage(BinaryFile &f, std::vector<std::vector<uint16_t>>
130 131
     uint16_t numBytes = f.readU16();
131 132
     assertEqual(numBytes % 2, 0); // 16 bit opcodes and operands
132 133
 
133
-    uint16_t *list = new uint16_t[(numBytes + 6) / 2];
134
+    uint16_t* list = new uint16_t[(numBytes + 6) / 2];
134 135
     for (uint16_t i = 0; i < (numBytes / 2); i++) {
135 136
         list[i] = f.readU16();
136 137
     }
@@ -143,7 +144,7 @@ void Script::readScriptPackage(BinaryFile &f, std::vector<std::vector<uint16_t>>
143 144
     hack[1] = f.readU16();
144 145
     hack[2] = f.readU16();
145 146
     if (((hack[0] == 19) && (hack[1] == 20) && (hack[2] == 21))
146
-            || ((hack[0] == 21) && (hack[1] == 22) && (hack[2] == 23))) {
147
+        || ((hack[0] == 21) && (hack[1] == 22) && (hack[2] == 23))) {
147 148
         list[numBytes / 2] = hack[0];
148 149
         list[(numBytes / 2) + 1] = hack[1];
149 150
         list[(numBytes / 2) + 2] = hack[2];

+ 30
- 28
src/SkeletalModel.cpp Wyświetl plik

@@ -12,10 +12,11 @@
12 12
 #include "SkeletalModel.h"
13 13
 #include "World.h"
14 14
 
15
-BoneTag::BoneTag(TombRaider &tr, unsigned int index, unsigned int i, unsigned int *l, unsigned int frame_offset) {
16
-    tr2_moveable_t *moveable = tr.Moveable();
17
-    tr2_meshtree_t *meshtree = tr.MeshTree();
18
-    unsigned short *frame = tr.Frame();
15
+BoneTag::BoneTag(TombRaider& tr, unsigned int index, unsigned int i, unsigned int* l,
16
+                 unsigned int frame_offset) {
17
+    tr2_moveable_t* moveable = tr.Moveable();
18
+    tr2_meshtree_t* meshtree = tr.MeshTree();
19
+    unsigned short* frame = tr.Frame();
19 20
 
20 21
     off[0] = 0.0f;
21 22
     off[1] = 0.0f;
@@ -34,9 +35,9 @@ BoneTag::BoneTag(TombRaider &tr, unsigned int index, unsigned int i, unsigned in
34 35
 
35 36
         // Hack: moveable[index].mesh_tree is a byte offset
36 37
         //       into mesh_tree[], so we have to convert to index
37
-        int *tree = (int *)(void *)meshtree;
38
-        tr2_meshtree_t *mesh_tree = (tr2_meshtree_t *)(tree
39
-                + moveable[index].mesh_tree + ((i - 1) * 4));
38
+        int* tree = (int*)(void*)meshtree;
39
+        tr2_meshtree_t* mesh_tree = (tr2_meshtree_t*)(tree
40
+                                    + moveable[index].mesh_tree + ((i - 1) * 4));
40 41
 
41 42
         off[0] = mesh_tree->x;
42 43
         off[1] = mesh_tree->y;
@@ -68,9 +69,9 @@ char BoneTag::getFlag() {
68 69
     return flag;
69 70
 }
70 71
 
71
-BoneFrame::BoneFrame(TombRaider &tr, unsigned int index, unsigned int frame_offset) {
72
-    tr2_moveable_t *moveable = tr.Moveable();
73
-    unsigned short *frame = tr.Frame();
72
+BoneFrame::BoneFrame(TombRaider& tr, unsigned int index, unsigned int frame_offset) {
73
+    tr2_moveable_t* moveable = tr.Moveable();
74
+    unsigned short* frame = tr.Frame();
74 75
 
75 76
     pos[0] = (short)frame[frame_offset + 6];
76 77
     pos[1] = (short)frame[frame_offset + 7];
@@ -91,7 +92,7 @@ unsigned long BoneFrame::size() {
91 92
     return tag.size();
92 93
 }
93 94
 
94
-BoneTag &BoneFrame::get(unsigned long i) {
95
+BoneTag& BoneFrame::get(unsigned long i) {
95 96
     assert(i < tag.size());
96 97
     return *tag.at(i);
97 98
 }
@@ -102,9 +103,10 @@ void BoneFrame::getPosition(float p[3]) {
102 103
     p[2] = pos[2];
103 104
 }
104 105
 
105
-AnimationFrame::AnimationFrame(TombRaider &tr, unsigned int index, int a, unsigned int *frame_offset, int frame_step) {
106
-    tr2_moveable_t *moveable = tr.Moveable();
107
-    tr2_animation_t *animation = tr.Animation();
106
+AnimationFrame::AnimationFrame(TombRaider& tr, unsigned int index, int a,
107
+                               unsigned int* frame_offset, int frame_step) {
108
+    tr2_moveable_t* moveable = tr.Moveable();
109
+    tr2_animation_t* animation = tr.Animation();
108 110
 
109 111
     unsigned int frame_count = (animation[a].frame_end - animation[a].frame_start) + 1;
110 112
     rate = animation[a].frame_rate;
@@ -138,8 +140,8 @@ AnimationFrame::AnimationFrame(TombRaider &tr, unsigned int index, int a, unsign
138 140
 
139 141
         if (*frame_offset > tr.NumFrames()) {
140 142
             getLog() << "WARNING: Bad animation frame " << *frame_offset
141
-                << " > " << tr.NumFrames() << " (" << index << "." << a << ")"
142
-                << Log::endl;
143
+                     << " > " << tr.NumFrames() << " (" << index << "." << a << ")"
144
+                     << Log::endl;
143 145
             return;
144 146
         }
145 147
 
@@ -156,15 +158,15 @@ unsigned long AnimationFrame::size() {
156 158
     return frame.size();
157 159
 }
158 160
 
159
-BoneFrame &AnimationFrame::get(unsigned long i) {
161
+BoneFrame& AnimationFrame::get(unsigned long i) {
160 162
     assert(i < frame.size());
161 163
     return *frame.at(i);
162 164
 }
163 165
 
164
-SkeletalModel::SkeletalModel(TombRaider &tr, unsigned int index, int objectId) {
165
-    tr2_moveable_t *moveable = tr.Moveable();
166
-    tr2_animation_t *anim = tr.Animation();
167
-    tr2_mesh_t *mesh = tr.Mesh();
166
+SkeletalModel::SkeletalModel(TombRaider& tr, unsigned int index, int objectId) {
167
+    tr2_moveable_t* moveable = tr.Moveable();
168
+    tr2_animation_t* anim = tr.Animation();
169
+    tr2_mesh_t* mesh = tr.Mesh();
168 170
 
169 171
     id = objectId;
170 172
 
@@ -184,7 +186,7 @@ SkeletalModel::SkeletalModel(TombRaider &tr, unsigned int index, int objectId) {
184 186
                 ponytailId = getWorld().sizeSkeletalModel(); //! \fixme Why is this even needed?
185 187
                 ponytailMeshId = moveable[index].starting_mesh;
186 188
                 ponytailNumMeshes = ((moveable[index].num_meshes > 0) ?
187
-                        moveable[index].num_meshes : 0);
189
+                                     moveable[index].num_meshes : 0);
188 190
                 ponytailAngle = -90.0f;
189 191
                 ponytail[0] = -3;
190 192
                 ponytail[1] = -22;
@@ -214,7 +216,7 @@ SkeletalModel::SkeletalModel(TombRaider &tr, unsigned int index, int objectId) {
214 216
                 ponytailId = getWorld().sizeSkeletalModel(); //! \fixme Why is this even needed?
215 217
                 ponytailMeshId = moveable[index].starting_mesh;
216 218
                 ponytailNumMeshes = ((moveable[index].num_meshes > 0) ?
217
-                        moveable[index].num_meshes : 0);
219
+                                     moveable[index].num_meshes : 0);
218 220
                 ponytailAngle = -90.0f;
219 221
                 ponytail[0] = 0;
220 222
                 ponytail[1] = -20;
@@ -271,15 +273,15 @@ void SkeletalModel::display(unsigned long aframe, unsigned long bframe) {
271 273
     assert(aframe < size());
272 274
     assert(bframe < get(aframe).size());
273 275
 
274
-    AnimationFrame &anim = get(aframe);
275
-    BoneFrame &boneframe = anim.get(bframe);
276
+    AnimationFrame& anim = get(aframe);
277
+    BoneFrame& boneframe = anim.get(bframe);
276 278
 
277 279
     float pos[3];
278 280
     boneframe.getPosition(pos);
279 281
     glTranslatef(pos[0], pos[1], pos[2]);
280 282
 
281 283
     for (unsigned int a = 0; a < boneframe.size(); a++) {
282
-        BoneTag &tag = boneframe.get(a);
284
+        BoneTag& tag = boneframe.get(a);
283 285
         float rot[3], off[3];
284 286
 
285 287
         tag.getRotation(rot);
@@ -304,7 +306,7 @@ void SkeletalModel::display(unsigned long aframe, unsigned long bframe) {
304 306
 
305 307
         // Draw layered lara in TR4 (2 meshes per tag)
306 308
         if (tr4Overlay) {
307
-            BoneFrame &boneframe2 = get(0).get(0); //! \fixme Woot?
309
+            BoneFrame& boneframe2 = get(0).get(0); //! \fixme Woot?
308 310
             if (a < boneframe2.size())
309 311
                 boneframe2.get(a).display();
310 312
         }
@@ -387,7 +389,7 @@ unsigned long SkeletalModel::size() {
387 389
     return animation.size();
388 390
 }
389 391
 
390
-AnimationFrame &SkeletalModel::get(unsigned long i) {
392
+AnimationFrame& SkeletalModel::get(unsigned long i) {
391 393
     assert(i < animation.size());
392 394
     return *animation.at(i);
393 395
 }

+ 7
- 6
src/SoundAL.cpp Wyświetl plik

@@ -40,8 +40,8 @@ int SoundAL::initialize() {
40 40
     if (!mEnabled)
41 41
         return 0;
42 42
 
43
-    ALCdevice *Device = alcOpenDevice(NULL);
44
-    ALCcontext *Context = alcCreateContext(Device, NULL);
43
+    ALCdevice* Device = alcOpenDevice(NULL);
44
+    ALCcontext* Context = alcCreateContext(Device, NULL);
45 45
     alcMakeContextCurrent(Context);
46 46
 
47 47
     if (alutInitWithoutContext(NULL, NULL) == AL_FALSE) {
@@ -120,11 +120,11 @@ void SoundAL::sourceAt(unsigned long source, float pos[3]) {
120 120
 }
121 121
 
122 122
 //! \fixme Seperate sourcing and buffering, Mongoose 2002.01.04
123
-int SoundAL::addFile(const char *filename, unsigned long *source, unsigned int flags) {
123
+int SoundAL::addFile(const char* filename, unsigned long* source, unsigned int flags) {
124 124
     ALsizei size;
125 125
     ALfloat freq;
126 126
     ALenum format;
127
-    ALvoid *data;
127
+    ALvoid* data;
128 128
     unsigned long id;
129 129
 
130 130
     assert(mSource.size() == mBuffer.size());
@@ -176,11 +176,12 @@ int SoundAL::addFile(const char *filename, unsigned long *source, unsigned int f
176 176
     return 0;
177 177
 }
178 178
 
179
-int SoundAL::addWave(unsigned char *wav, unsigned int length, unsigned long *source, unsigned int flags) {
179
+int SoundAL::addWave(unsigned char* wav, unsigned int length, unsigned long* source,
180
+                     unsigned int flags) {
180 181
     ALsizei size;
181 182
     ALfloat freq;
182 183
     ALenum format;
183
-    ALvoid *data;
184
+    ALvoid* data;
184 185
     int error = 0;
185 186
     unsigned long id;
186 187
 

+ 3
- 2
src/SoundNull.cpp Wyświetl plik

@@ -40,13 +40,14 @@ void SoundNull::sourceAt(unsigned long source, float pos[3]) {
40 40
     assert(source < sources);
41 41
 }
42 42
 
43
-int SoundNull::addFile(const char *filename, unsigned long *source, unsigned int flags) {
43
+int SoundNull::addFile(const char* filename, unsigned long* source, unsigned int flags) {
44 44
     *source = sources;
45 45
     sources++;
46 46
     return 0;
47 47
 }
48 48
 
49
-int SoundNull::addWave(unsigned char *wav, unsigned int length, unsigned long *source, unsigned int flags) {
49
+int SoundNull::addWave(unsigned char* wav, unsigned int length, unsigned long* source,
50
+                       unsigned int flags) {
50 51
     *source = sources;
51 52
     sources++;
52 53
     return 0;

+ 17
- 17
src/Sprite.cpp Wyświetl plik

@@ -11,7 +11,7 @@
11 11
 #include "Render.h"
12 12
 #include "Sprite.h"
13 13
 
14
-SpriteSequence::SpriteSequence(TombRaider &tr, unsigned int item, unsigned int sequence) {
14
+SpriteSequence::SpriteSequence(TombRaider& tr, unsigned int item, unsigned int sequence) {
15 15
     for (int i = 0; i < (-tr.SpriteSequence()[sequence].negative_length); i++)
16 16
         sprites.push_back(new Sprite(tr, item, sequence, i));
17 17
 }
@@ -25,18 +25,18 @@ unsigned long SpriteSequence::size() {
25 25
     return sprites.size();
26 26
 }
27 27
 
28
-Sprite &SpriteSequence::get(unsigned long index) {
28
+Sprite& SpriteSequence::get(unsigned long index) {
29 29
     assert(index < sprites.size());
30 30
     return *sprites.at(index);
31 31
 }
32 32
 
33
-Sprite::Sprite(TombRaider &tr, unsigned int item, unsigned int sequence, unsigned int index) {
34
-    tr2_item_t *i = tr.Item();
35
-    tr2_sprite_texture_t *spriteTextures = tr.Sprite();
36
-    tr2_sprite_sequence_t *spriteSequence = tr.SpriteSequence();
33
+Sprite::Sprite(TombRaider& tr, unsigned int item, unsigned int sequence, unsigned int index) {
34
+    tr2_item_t* i = tr.Item();
35
+    tr2_sprite_texture_t* spriteTextures = tr.Sprite();
36
+    tr2_sprite_sequence_t* spriteSequence = tr.SpriteSequence();
37 37
 
38 38
     //! \fixme index was unused?!
39
-    tr2_sprite_texture_t *sprite = &spriteTextures[spriteSequence[sequence].offset + index];
39
+    tr2_sprite_texture_t* sprite = &spriteTextures[spriteSequence[sequence].offset + index];
40 40
 
41 41
     int width = sprite->width >> 8;
42 42
     int height = sprite->height >> 8;
@@ -67,28 +67,28 @@ Sprite::Sprite(TombRaider &tr, unsigned int item, unsigned int sequence, unsigne
67 67
     vertex[2][2] = 0;
68 68
     vertex[3][2] = 0;
69 69
 
70
-    texel[3][0] = (float)(x+width)/texelScale;
71
-    texel[3][1] = (float)(y+height)/texelScale;
70
+    texel[3][0] = (float)(x + width) / texelScale;
71
+    texel[3][1] = (float)(y + height) / texelScale;
72 72
 
73
-    texel[2][0] = (float)(x+width)/texelScale;
74
-    texel[2][1] = (float)(y)/texelScale;
73
+    texel[2][0] = (float)(x + width) / texelScale;
74
+    texel[2][1] = (float)(y) / texelScale;
75 75
 
76
-    texel[1][0] = (float)(x) /texelScale;
77
-    texel[1][1] = (float)(y) /texelScale;
76
+    texel[1][0] = (float)(x) / texelScale;
77
+    texel[1][1] = (float)(y) / texelScale;
78 78
 
79 79
     texel[0][0] = (float)(x) / texelScale;
80
-    texel[0][1] = (float)(y+height)/texelScale;
80
+    texel[0][1] = (float)(y + height) / texelScale;
81 81
 
82 82
     texture = sprite->tile + getGame().getTextureStart();
83 83
     radius = width2 / 2.0f;
84 84
 }
85 85
 
86
-Sprite::Sprite(TombRaider &tr, unsigned int room, unsigned int index) {
86
+Sprite::Sprite(TombRaider& tr, unsigned int room, unsigned int index) {
87 87
     float spriteVertices[12];
88 88
     float spriteTexCoords[8];
89 89
 
90 90
     tr.getRoomSprite(room, index,
91
-            10.0f, &texture, pos, spriteVertices, spriteTexCoords);
91
+                     10.0f, &texture, pos, spriteVertices, spriteTexCoords);
92 92
 
93 93
     texture += getGame().getTextureStart(); // OpenRaider preloads some textures
94 94
 
@@ -140,7 +140,7 @@ void Sprite::display() {
140 140
             glColor3ubv(WHITE);
141 141
             break;
142 142
         default:
143
-            glBindTexture(GL_TEXTURE_2D, texture+1);
143
+            glBindTexture(GL_TEXTURE_2D, texture + 1);
144 144
 
145 145
             glBegin(GL_TRIANGLE_STRIP);
146 146
             glTexCoord2fv(texel[0]);

+ 30
- 29
src/StaticMesh.cpp Wyświetl plik

@@ -26,11 +26,11 @@ TexturedTriangle::TexturedTriangle(int i[3], float s[6], int tex, unsigned short
26 26
     transparency = trans;
27 27
 }
28 28
 
29
-void TexturedTriangle::display(float *vertices, float *colors, float *normals) {
29
+void TexturedTriangle::display(float* vertices, float* colors, float* normals) {
30 30
     assert(vertices != NULL);
31 31
 
32 32
     if ((getRender().getMode() != Render::modeWireframe)
33
-            && (getRender().getMode() != Render::modeSolid)) {
33
+        && (getRender().getMode() != Render::modeSolid)) {
34 34
         glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
35 35
         glBindTexture(GL_TEXTURE_2D, texture + 1);
36 36
     }
@@ -97,27 +97,27 @@ void TexturedTriangle::display(float *vertices, float *colors, float *normals) {
97 97
 #include <map>
98 98
 std::map<unsigned int, unsigned int> gColorTextureHACK;
99 99
 
100
-int setupTextureColor(float *colorf) {
100
+int setupTextureColor(float* colorf) {
101 101
     unsigned char color[4];
102 102
     unsigned int colorI;
103 103
     unsigned int texture;
104 104
 
105
-    color[0] = (unsigned char)(colorf[0]*255.0f);
106
-    color[1] = (unsigned char)(colorf[1]*255.0f);
107
-    color[2] = (unsigned char)(colorf[2]*255.0f);
108
-    color[3] = (unsigned char)(colorf[3]*255.0f);
105
+    color[0] = (unsigned char)(colorf[0] * 255.0f);
106
+    color[1] = (unsigned char)(colorf[1] * 255.0f);
107
+    color[2] = (unsigned char)(colorf[2] * 255.0f);
108
+    color[3] = (unsigned char)(colorf[3] * 255.0f);
109 109
 
110
-    ((unsigned char *)(&colorI))[3] = color[0];
111
-    ((unsigned char *)(&colorI))[2] = color[1];
112
-    ((unsigned char *)(&colorI))[1] = color[2];
113
-    ((unsigned char *)(&colorI))[0] = color[3];
110
+    ((unsigned char*)(&colorI))[3] = color[0];
111
+    ((unsigned char*)(&colorI))[2] = color[1];
112
+    ((unsigned char*)(&colorI))[1] = color[2];
113
+    ((unsigned char*)(&colorI))[0] = color[3];
114 114
 
115 115
     try {
116 116
         texture = gColorTextureHACK.at(colorI);
117 117
     } catch (...) {
118
-        unsigned char *image = generateColorTexture(color, 32, 32, 32);
118
+        unsigned char* image = generateColorTexture(color, 32, 32, 32);
119 119
         texture = getTextureManager().loadBufferSlot(image, 32, 32,
120
-                RGBA, 32, getTextureManager().getTextureCount());
120
+                  RGBA, 32, getTextureManager().getTextureCount());
121 121
         delete [] image;
122 122
     }
123 123
 
@@ -126,7 +126,7 @@ int setupTextureColor(float *colorf) {
126 126
 
127 127
 #endif
128 128
 
129
-StaticMesh::StaticMesh(TombRaider &tr, unsigned int index) {
129
+StaticMesh::StaticMesh(TombRaider& tr, unsigned int index) {
130 130
     int count, texture;
131 131
     int vertexIndices[6];
132 132
     float st[12];
@@ -146,25 +146,25 @@ StaticMesh::StaticMesh(TombRaider &tr, unsigned int index) {
146 146
     //! \fixme Arrays don't work either  =)
147 147
     // Mesh geometery, colors, etc
148 148
     tr.getMeshVertexArrays(index,
149
-            &vertexCount, &vertices,
150
-            &normalCount, &normals,
151
-            &colorCount,  &colors);
149
+                           &vertexCount, &vertices,
150
+                           &normalCount, &normals,
151
+                           &colorCount,  &colors);
152 152
 
153 153
     // Textured Triangles
154 154
     count = tr.getMeshTexturedTriangleCount(index);
155 155
     for (int i = 0; i < count; i++) {
156 156
         tr.getMeshTexturedTriangle(index, i,
157
-                vertexIndices, st,
158
-                &texture, &transparency);
157
+                                   vertexIndices, st,
158
+                                   &texture, &transparency);
159 159
         triangles.push_back(
160
-                new TexturedTriangle(vertexIndices, st, texture + getGame().getTextureStart(), transparency));
160
+            new TexturedTriangle(vertexIndices, st, texture + getGame().getTextureStart(), transparency));
161 161
     }
162 162
 
163 163
     // Coloured Triangles
164 164
     count = tr.getMeshColoredTriangleCount(index);
165 165
     for (int i = 0; i < count; i++) {
166 166
         tr.getMeshColoredTriangle(index, i,
167
-                vertexIndices, color);
167
+                                  vertexIndices, color);
168 168
         st[0] = color[0];
169 169
         st[1] = color[1];
170 170
         st[2] = color[2];
@@ -180,26 +180,27 @@ StaticMesh::StaticMesh(TombRaider &tr, unsigned int index) {
180 180
         transparency = 0;
181 181
 
182 182
         triangles.push_back(
183
-                new TexturedTriangle(vertexIndices, st, texture + getGame().getTextureStart(), transparency));
183
+            new TexturedTriangle(vertexIndices, st, texture + getGame().getTextureStart(), transparency));
184 184
     }
185 185
 
186 186
     // Textured Rectangles
187 187
     count = tr.getMeshTexturedRectangleCount(index);
188 188
     for (int i = 0; i < count; i++) {
189 189
         tr.getMeshTexturedRectangle(index, i,
190
-                vertexIndices, st,
191
-                &texture, &transparency);
190
+                                    vertexIndices, st,
191
+                                    &texture, &transparency);
192 192
         triangles.push_back(
193
-                new TexturedTriangle(vertexIndices, st, texture + getGame().getTextureStart(), transparency));
193
+            new TexturedTriangle(vertexIndices, st, texture + getGame().getTextureStart(), transparency));
194 194
         triangles.push_back(
195
-                new TexturedTriangle(vertexIndices + 3, st + 6, texture + getGame().getTextureStart(), transparency));
195
+            new TexturedTriangle(vertexIndices + 3, st + 6, texture + getGame().getTextureStart(),
196
+                                 transparency));
196 197
     }
197 198
 
198 199
     // Coloured Rectangles
199 200
     count = tr.getMeshColoredRectangleCount(index);
200 201
     for (int i = 0; i < count; i++) {
201 202
         tr.getMeshColoredRectangle(index, i,
202
-                vertexIndices, color);
203
+                                   vertexIndices, color);
203 204
 
204 205
         st[0] = color[0];
205 206
         st[1] = color[1];
@@ -216,9 +217,9 @@ StaticMesh::StaticMesh(TombRaider &tr, unsigned int index) {
216 217
         transparency = 0;
217 218
 
218 219
         triangles.push_back(
219
-                new TexturedTriangle(vertexIndices, st, texture + getGame().getTextureStart(), transparency));
220
+            new TexturedTriangle(vertexIndices, st, texture + getGame().getTextureStart(), transparency));
220 221
         triangles.push_back(
221
-                new TexturedTriangle(vertexIndices + 3, st, texture + getGame().getTextureStart(), transparency));
222
+            new TexturedTriangle(vertexIndices + 3, st, texture + getGame().getTextureStart(), transparency));
222 223
     }
223 224
 }
224 225
 

+ 20
- 20
src/TextureManager.cpp Wyświetl plik

@@ -41,7 +41,7 @@ void TextureManager::reset() {
41 41
 }
42 42
 
43 43
 int TextureManager::initialize() {
44
-    unsigned char *image = generateColorTexture(WHITE, 32, 32, 32);
44
+    unsigned char* image = generateColorTexture(WHITE, 32, 32, 32);
45 45
     loadBufferSlot(image, 32, 32, RGBA, 32, mTextureIds.size());
46 46
     delete [] image;
47 47
 
@@ -108,16 +108,16 @@ void TextureManager::bindMultiTexture(int texture0, int texture1) {
108 108
 #endif
109 109
 }
110 110
 
111
-int TextureManager::loadBufferSlot(unsigned char *image,
112
-        unsigned int width, unsigned int height,
113
-        ColorMode mode, unsigned int bpp,
114
-        unsigned int slot, bool filter) {
111
+int TextureManager::loadBufferSlot(unsigned char* image,
112
+                                   unsigned int width, unsigned int height,
113
+                                   ColorMode mode, unsigned int bpp,
114
+                                   unsigned int slot, bool filter) {
115 115
     assert(image != NULL);
116 116
     assert(width > 0);
117 117
     assert(height > 0);
118 118
     assert((mode == GREYSCALE) || (mode == RGB)
119
-            || (mode == BGR) || (mode == ARGB)
120
-            || (mode == RGBA) || (mode ==  BGRA));
119
+           || (mode == BGR) || (mode == ARGB)
120
+           || (mode == RGBA) || (mode ==  BGRA));
121 121
     assert((bpp == 8) || (bpp == 24) || (bpp == 32));
122 122
 
123 123
     while (mTextureIds.size() <= slot) {
@@ -192,7 +192,7 @@ void TextureManager::bindTextureId(unsigned int n) {
192 192
     glBindTexture(GL_TEXTURE_2D, mTextureIds.at(n));
193 193
 }
194 194
 
195
-int TextureManager::loadImage(const char *filename) {
195
+int TextureManager::loadImage(const char* filename) {
196 196
     if (stringEndsWith(filename, ".pcx") || stringEndsWith(filename, ".PCX")) {
197 197
         return loadPCX(filename);
198 198
     } else if (stringEndsWith(filename, ".png") || stringEndsWith(filename, ".PNG")) {
@@ -206,18 +206,18 @@ int TextureManager::loadImage(const char *filename) {
206 206
     return -1;
207 207
 }
208 208
 
209
-int TextureManager::loadPCX(const char *filename) {
209
+int TextureManager::loadPCX(const char* filename) {
210 210
     assert(filename != NULL);
211 211
     assert(filename[0] != '\0');
212 212
 
213
-    unsigned char *image;
213
+    unsigned char* image;
214 214
     unsigned int w, h, bpp;
215 215
     ColorMode c;
216 216
     int id = -1;
217 217
     int error = pcxLoad(filename, &image, &w, &h, &c, &bpp);
218 218
 
219 219
     if (error == 0) {
220
-        unsigned char *image2 = scaleBuffer(image, &w, &h, bpp);
220
+        unsigned char* image2 = scaleBuffer(image, &w, &h, bpp);
221 221
         if (image2) {
222 222
             delete [] image;
223 223
             image = image2;
@@ -229,7 +229,7 @@ int TextureManager::loadPCX(const char *filename) {
229 229
     return id;
230 230
 }
231 231
 
232
-int TextureManager::loadPNG(const char *filename) {
232
+int TextureManager::loadPNG(const char* filename) {
233 233
 #ifdef USING_PNG
234 234
     assert(filename != NULL);
235 235
     assert(filename[0] != '\0');
@@ -238,14 +238,14 @@ int TextureManager::loadPNG(const char *filename) {
238 238
         return -1;
239 239
     }
240 240
 
241
-    unsigned char *image;
241
+    unsigned char* image;
242 242
     unsigned int w, h, bpp;
243 243
     ColorMode c;
244 244
     int id = -1;
245 245
     int error = pngLoad(filename, &image, &w, &h, &c, &bpp);
246 246
 
247 247
     if (error == 0) {
248
-        unsigned char *image2 = scaleBuffer(image, &w, &h, bpp);
248
+        unsigned char* image2 = scaleBuffer(image, &w, &h, bpp);
249 249
         if (image2) {
250 250
             delete [] image;
251 251
             image = image2;
@@ -261,11 +261,11 @@ int TextureManager::loadPNG(const char *filename) {
261 261
 #endif
262 262
 }
263 263
 
264
-int TextureManager::loadTGA(const char *filename) {
264
+int TextureManager::loadTGA(const char* filename) {
265 265
     assert(filename != NULL);
266 266
     assert(filename[0] != '\0');
267 267
 
268
-    unsigned char *image;
268
+    unsigned char* image;
269 269
     unsigned int w, h;
270 270
     char type;
271 271
     int id = -1;
@@ -273,16 +273,16 @@ int TextureManager::loadTGA(const char *filename) {
273 273
     if (!tgaCheck(filename)) {
274 274
         tgaLoad(filename, &image, &w, &h, &type);
275 275
 
276
-        unsigned char *image2 = scaleBuffer(image, &w, &h, (type == 2) ? 32 : 24);
276
+        unsigned char* image2 = scaleBuffer(image, &w, &h, (type == 2) ? 32 : 24);
277 277
         if (image2) {
278 278
             delete [] image;
279 279
             image = image2;
280 280
         }
281 281
         if (image) {
282 282
             id = loadBufferSlot(image, w, h,
283
-                    (type == 2) ? RGBA : RGB,
284
-                    (type == 2) ? 32 : 24,
285
-                    mTextureIds.size());
283
+                                (type == 2) ? RGBA : RGB,
284
+                                (type == 2) ? 32 : 24,
285
+                                mTextureIds.size());
286 286
             delete [] image;
287 287
         }
288 288
     }

+ 916
- 1384
src/TombRaider.cpp
Plik diff jest za duży
Wyświetl plik


+ 14
- 14
src/UI.cpp Wyświetl plik

@@ -71,11 +71,11 @@ int UI::initialize() {
71 71
     ImGui::GetDefaultFontData(NULL, NULL, &png_data, &png_size);
72 72
     int tex_x, tex_y, tex_comp;
73 73
     void* tex_data = stbi_load_from_memory((const unsigned char*)png_data,
74
-            (int)png_size, &tex_x, &tex_y, &tex_comp, 0);
74
+                                           (int)png_size, &tex_x, &tex_y, &tex_comp, 0);
75 75
 
76
-     //! \fixme TODO use proper texture slot
77
-    fontTex = getTextureManager().loadBufferSlot((unsigned char *)tex_data,
78
-            tex_x, tex_y, RGBA, 32, 0, false);
76
+    //! \fixme TODO use proper texture slot
77
+    fontTex = getTextureManager().loadBufferSlot((unsigned char*)tex_data,
78
+              tex_x, tex_y, RGBA, 32, 0, false);
79 79
 
80 80
     stbi_image_free(tex_data);
81 81
 
@@ -99,7 +99,7 @@ void UI::eventsFinished() {
99 99
             auto i = clickEvents.front();
100 100
             if (getMenu().isVisible()) {
101 101
                 getMenu().handleMouseClick(std::get<0>(i), std::get<1>(i),
102
-                        std::get<2>(i), std::get<3>(i));
102
+                                           std::get<2>(i), std::get<3>(i));
103 103
             }
104 104
             clickEvents.pop_front();
105 105
         }
@@ -108,7 +108,7 @@ void UI::eventsFinished() {
108 108
             auto i = motionEvents.front();
109 109
             if (!getMenu().isVisible()) {
110 110
                 getGame().handleMouseMotion(std::get<0>(i), std::get<1>(i),
111
-                        std::get<2>(i), std::get<3>(i));
111
+                                            std::get<2>(i), std::get<3>(i));
112 112
             }
113 113
             motionEvents.pop_front();
114 114
         }
@@ -163,9 +163,9 @@ void UI::eventsFinished() {
163 163
     }
164 164
 
165 165
     if (visible && (
166
-                ((!io.WantCaptureKeyboard) && io.KeysDown[escapeKey])
167
-                || ((!io.WantCaptureMouse) && clicked)
168
-            )) {
166
+            ((!io.WantCaptureKeyboard) && io.KeysDown[escapeKey])
167
+            || ((!io.WantCaptureMouse) && clicked)
168
+        )) {
169 169
         visible = false;
170 170
     }
171 171
 
@@ -217,7 +217,7 @@ void UI::handleKeyboard(KeyboardButton key, bool pressed) {
217 217
         metaKeyIsActive = pressed;
218 218
 }
219 219
 
220
-void UI::handleText(char *text, bool notFinished) {
220
+void UI::handleText(char* text, bool notFinished) {
221 221
     if (notFinished)
222 222
         return;
223 223
 
@@ -289,15 +289,15 @@ void UI::renderImGui(ImDrawList** const cmd_lists, int cmd_lists_count) {
289 289
         const ImDrawList* cmd_list = cmd_lists[n];
290 290
         const unsigned char* vtx_buffer = (const unsigned char*)cmd_list->vtx_buffer.begin();
291 291
         glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (void*)(vtx_buffer));
292
-        glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (void*)(vtx_buffer+8));
293
-        glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (void*)(vtx_buffer+16));
292
+        glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (void*)(vtx_buffer + 8));
293
+        glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (void*)(vtx_buffer + 16));
294 294
 
295 295
         int vtx_offset = 0;
296 296
         const ImDrawCmd* pcmd_end = cmd_list->commands.end();
297 297
         for (const ImDrawCmd* pcmd = cmd_list->commands.begin(); pcmd != pcmd_end; pcmd++) {
298 298
             glScissor((int)pcmd->clip_rect.x, (int)(ImGui::GetIO().DisplaySize.y - pcmd->clip_rect.w),
299
-                    (int)(pcmd->clip_rect.z - pcmd->clip_rect.x),
300
-                    (int)(pcmd->clip_rect.w - pcmd->clip_rect.y));
299
+                      (int)(pcmd->clip_rect.z - pcmd->clip_rect.x),
300
+                      (int)(pcmd->clip_rect.w - pcmd->clip_rect.y));
301 301
             glDrawArrays(GL_TRIANGLES, vtx_offset, pcmd->vtx_count);
302 302
             vtx_offset += pcmd->vtx_count;
303 303
         }

+ 32
- 32
src/ViewVolume.cpp Wyświetl plik

@@ -24,7 +24,7 @@ ViewVolume::ViewVolume() {
24 24
 bool ViewVolume::isPointInFrustum(float x, float y, float z) {
25 25
     for (unsigned int p = 0; p < 6; ++p) {
26 26
         if (mFrustum[p][0] * x + mFrustum[p][1] * y + mFrustum[p][2] * z +
27
-                mFrustum[p][3] <= 0) {
27
+            mFrustum[p][3] <= 0) {
28 28
             return false;
29 29
         }
30 30
     }
@@ -43,43 +43,43 @@ bool ViewVolume::isSphereInFrustum(float x, float y, float z, float radius) {
43 43
 bool ViewVolume::isBboxInFrustum(float min[3], float max[3]) {
44 44
     for (unsigned int p = 0; p < 6; ++p) {
45 45
         if (mFrustum[p][0] * min[0] +
46
-                mFrustum[p][1] * min[1] +
47
-                mFrustum[p][2] * min[2] + mFrustum[p][3] > 0)
46
+            mFrustum[p][1] * min[1] +
47
+            mFrustum[p][2] * min[2] + mFrustum[p][3] > 0)
48 48
             continue;
49 49
 
50 50
         if (mFrustum[p][0] * max[0] +
51
-                mFrustum[p][1] * max[1] +
52
-                mFrustum[p][2] * max[2] + mFrustum[p][3] > 0)
51
+            mFrustum[p][1] * max[1] +
52
+            mFrustum[p][2] * max[2] + mFrustum[p][3] > 0)
53 53
             continue;
54 54
 
55 55
         if (mFrustum[p][0] * min[0] +
56
-                mFrustum[p][1] * max[1] +
57
-                mFrustum[p][2] * max[2] + mFrustum[p][3] > 0)
56
+            mFrustum[p][1] * max[1] +
57
+            mFrustum[p][2] * max[2] + mFrustum[p][3] > 0)
58 58
             continue;
59 59
 
60 60
         if (mFrustum[p][0] * min[0] +
61
-                mFrustum[p][1] * min[1] +
62
-                mFrustum[p][2] * max[2] + mFrustum[p][3] > 0)
61
+            mFrustum[p][1] * min[1] +
62
+            mFrustum[p][2] * max[2] + mFrustum[p][3] > 0)
63 63
             continue;
64 64
 
65 65
         if (mFrustum[p][0] * min[0] +
66
-                mFrustum[p][1] * max[1] +
67
-                mFrustum[p][2] * min[2] + mFrustum[p][3] > 0)
66
+            mFrustum[p][1] * max[1] +
67
+            mFrustum[p][2] * min[2] + mFrustum[p][3] > 0)
68 68
             continue;
69 69
 
70 70
         if (mFrustum[p][0] * max[0] +
71
-                mFrustum[p][1] * min[1] +
72
-                mFrustum[p][2] * min[2] + mFrustum[p][3] > 0)
71
+            mFrustum[p][1] * min[1] +
72
+            mFrustum[p][2] * min[2] + mFrustum[p][3] > 0)
73 73
             continue;
74 74
 
75 75
         if (mFrustum[p][0] * max[0] +
76
-                mFrustum[p][1] * max[1] +
77
-                mFrustum[p][2] * min[2] + mFrustum[p][3] > 0)
76
+            mFrustum[p][1] * max[1] +
77
+            mFrustum[p][2] * min[2] + mFrustum[p][3] > 0)
78 78
             continue;
79 79
 
80 80
         if (mFrustum[p][0] * max[0] +
81
-                mFrustum[p][1] * min[1] +
82
-                mFrustum[p][2] * max[2] + mFrustum[p][3] > 0)
81
+            mFrustum[p][1] * min[1] +
82
+            mFrustum[p][2] * max[2] + mFrustum[p][3] > 0)
83 83
             continue;
84 84
 
85 85
         return false;
@@ -105,9 +105,9 @@ float ViewVolume::getDistToBboxFromNear(const float min[3], const float max[3])
105 105
 
106 106
     // 5 should be near plane
107 107
     d = (mFrustum[5][0] * center[0] +
108
-            mFrustum[5][1] * center[1] +
109
-            mFrustum[5][2] * center[2] +
110
-            mFrustum[5][3]);
108
+         mFrustum[5][1] * center[1] +
109
+         mFrustum[5][2] * center[2] +
110
+         mFrustum[5][3]);
111 111
 
112 112
     radius = distance(max, center);
113 113
 
@@ -169,8 +169,8 @@ void ViewVolume::updateFrustum() {
169 169
 
170 170
     /* Normalize the result */
171 171
     t = sqrtf(mFrustum[0][0] * mFrustum[0][0] +
172
-            mFrustum[0][1] * mFrustum[0][1] +
173
-            mFrustum[0][2] * mFrustum[0][2]);
172
+              mFrustum[0][1] * mFrustum[0][1] +
173
+              mFrustum[0][2] * mFrustum[0][2]);
174 174
     mFrustum[0][0] /= t;
175 175
     mFrustum[0][1] /= t;
176 176
     mFrustum[0][2] /= t;
@@ -184,8 +184,8 @@ void ViewVolume::updateFrustum() {
184 184
 
185 185
     /* Normalize the result */
186 186
     t = sqrtf(mFrustum[1][0] * mFrustum[1][0] +
187
-            mFrustum[1][1] * mFrustum[1][1] +
188
-            mFrustum[1][2] * mFrustum[1][2]);
187
+              mFrustum[1][1] * mFrustum[1][1] +
188
+              mFrustum[1][2] * mFrustum[1][2]);
189 189
     mFrustum[1][0] /= t;
190 190
     mFrustum[1][1] /= t;
191 191
     mFrustum[1][2] /= t;
@@ -199,8 +199,8 @@ void ViewVolume::updateFrustum() {
199 199
 
200 200
     /* Normalize the result */
201 201
     t = sqrtf(mFrustum[2][0] * mFrustum[2][0] +
202
-            mFrustum[2][1] * mFrustum[2][1] +
203
-            mFrustum[2][2] * mFrustum[2][2]);
202
+              mFrustum[2][1] * mFrustum[2][1] +
203
+              mFrustum[2][2] * mFrustum[2][2]);
204 204
     mFrustum[2][0] /= t;
205 205
     mFrustum[2][1] /= t;
206 206
     mFrustum[2][2] /= t;
@@ -214,8 +214,8 @@ void ViewVolume::updateFrustum() {
214 214
 
215 215
     /* Normalize the result */
216 216
     t = sqrtf(mFrustum[3][0] * mFrustum[3][0] +
217
-            mFrustum[3][1] * mFrustum[3][1] +
218
-            mFrustum[3][2] * mFrustum[3][2]);
217
+              mFrustum[3][1] * mFrustum[3][1] +
218
+              mFrustum[3][2] * mFrustum[3][2]);
219 219
     mFrustum[3][0] /= t;
220 220
     mFrustum[3][1] /= t;
221 221
     mFrustum[3][2] /= t;
@@ -229,8 +229,8 @@ void ViewVolume::updateFrustum() {
229 229
 
230 230
     /* Normalize the result */
231 231
     t = sqrtf(mFrustum[4][0] * mFrustum[4][0] +
232
-            mFrustum[4][1] * mFrustum[4][1] +
233
-            mFrustum[4][2] * mFrustum[4][2]);
232
+              mFrustum[4][1] * mFrustum[4][1] +
233
+              mFrustum[4][2] * mFrustum[4][2]);
234 234
     mFrustum[4][0] /= t;
235 235
     mFrustum[4][1] /= t;
236 236
     mFrustum[4][2] /= t;
@@ -244,8 +244,8 @@ void ViewVolume::updateFrustum() {
244 244
 
245 245
     /* Normalize the result */
246 246
     t = sqrtf(mFrustum[5][0] * mFrustum[5][0] +
247
-            mFrustum[5][1] * mFrustum[5][1] +
248
-            mFrustum[5][2] * mFrustum[5][2]);
247
+              mFrustum[5][1] * mFrustum[5][1] +
248
+              mFrustum[5][2] * mFrustum[5][2]);
249 249
     mFrustum[5][0] /= t;
250 250
     mFrustum[5][1] /= t;
251 251
     mFrustum[5][2] /= t;

+ 9
- 9
src/Window.cpp Wyświetl plik

@@ -24,9 +24,9 @@ int Window::initializeGL() {
24 24
     // Testing for goodies
25 25
     //const char *s = (const char *)glGetString(GL_EXTENSIONS);
26 26
     //if ((s != NULL) && (s[0] != '\0')) {
27
-        //! \todo MultiTexture flag
28
-        //if (strstr(s, "GL_ARB_multitexture"))
29
-            //mFlags |= Render::fMultiTexture;
27
+    //! \todo MultiTexture flag
28
+    //if (strstr(s, "GL_ARB_multitexture"))
29
+    //mFlags |= Render::fMultiTexture;
30 30
     //}
31 31
 
32 32
     // Set up Z buffer
@@ -146,8 +146,8 @@ void Window::glExit2D() {
146 146
 // Replaced the deprecated gluLookAt with slightly modified code from here:
147 147
 // http://www.khronos.org/message_boards/showthread.php/4991
148 148
 void Window::lookAt(float eyeX, float eyeY, float eyeZ,
149
-        float lookAtX, float lookAtY, float lookAtZ,
150
-        float upX, float upY, float upZ) {
149
+                    float lookAtX, float lookAtY, float lookAtZ,
150
+                    float upX, float upY, float upZ) {
151 151
     // calculating the viewing vector
152 152
     float f[3] = {
153 153
         lookAtX - eyeX,
@@ -162,9 +162,9 @@ void Window::lookAt(float eyeX, float eyeY, float eyeZ,
162 162
     f[2] /= fMag;
163 163
 
164 164
     float s[3] = {
165
-        (f[1] * upZ) - (upY * f[2]),
166
-        (upX * f[2]) - (f[0] * upZ),
167
-        (f[0] * upY) - (upX * f[1])
165
+        (f[1] * upZ) - (upY* f[2]),
166
+        (upX* f[2]) - (f[0] * upZ),
167
+        (f[0] * upY) - (upX* f[1])
168 168
     };
169 169
 
170 170
     float u[3] = {
@@ -177,7 +177,7 @@ void Window::lookAt(float eyeX, float eyeY, float eyeZ,
177 177
         s[0], u[0], -f[0], 0,
178 178
         s[1], u[1], -f[1], 0,
179 179
         s[2], u[2], -f[2], 0,
180
-           0,    0,     0, 1
180
+        0,    0,     0, 1
181 181
     };
182 182
     glMultMatrixf(m);
183 183
     glTranslatef(-eyeX, -eyeY, -eyeZ);

+ 2
- 2
src/WindowGLUT.cpp Wyświetl plik

@@ -67,7 +67,7 @@ int WindowGLUT::initialize() {
67 67
     assert(mInit == false);
68 68
 
69 69
     int argc = 1;
70
-    char *argv[] = { new char[11], nullptr };
70
+    char* argv[] = { new char[11], nullptr };
71 71
     strcpy(argv[0], "OpenRaider");
72 72
     glutInit(&argc, argv);
73 73
     glutInitWindowSize(mWidth, mHeight);
@@ -197,7 +197,7 @@ KeyboardButton WindowGLUT::convertAsciiButton(unsigned char key) {
197 197
 
198 198
     // Alphanumerics can be returned as is
199 199
     if (((key >= '0') && (key <= '9'))
200
-            || ((key >= 'a') && (key <= 'z'))) {
200
+        || ((key >= 'a') && (key <= 'z'))) {
201 201
         return static_cast<KeyboardButton>(key);
202 202
     }
203 203
 

+ 2
- 2
src/WindowSDL.cpp Wyświetl plik

@@ -92,7 +92,7 @@ int WindowSDL::initialize() {
92 92
     }
93 93
 
94 94
     mWindow = SDL_CreateWindow(VERSION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
95
-                mWidth, mHeight, flags);
95
+                               mWidth, mHeight, flags);
96 96
     if (mWindow == NULL) {
97 97
         std::cout << "SDL_CreateWindow Error: " << SDL_GetError() << std::endl;
98 98
         return -3;
@@ -116,7 +116,7 @@ void WindowSDL::eventHandling() {
116 116
 
117 117
     assert(mInit == true);
118 118
 
119
-    while(SDL_PollEvent(&event)) {
119
+    while (SDL_PollEvent(&event)) {
120 120
         switch (event.type) {
121 121
             case SDL_MOUSEMOTION:
122 122
                 UI::handleMouseMotion(event.motion.xrel, event.motion.yrel, event.motion.x, event.motion.y);

+ 12
- 13
src/World.cpp Wyświetl plik

@@ -15,7 +15,7 @@ World::~World() {
15 15
     destroy();
16 16
 }
17 17
 
18
-void World::addRoom(Room &room) {
18
+void World::addRoom(Room& room) {
19 19
     mRooms.push_back(std::unique_ptr<Room>(&room));
20 20
 }
21 21
 
@@ -23,12 +23,12 @@ unsigned long World::sizeRoom() {
23 23
     return mRooms.size();
24 24
 }
25 25
 
26
-Room &World::getRoom(unsigned long index) {
26
+Room& World::getRoom(unsigned long index) {
27 27
     assert(index < mRooms.size());
28 28
     return *mRooms.at(index);
29 29
 }
30 30
 
31
-void World::addSprite(SpriteSequence &sprite) {
31
+void World::addSprite(SpriteSequence& sprite) {
32 32
     mSprites.push_back(std::unique_ptr<SpriteSequence>(&sprite));
33 33
 }
34 34
 
@@ -36,12 +36,12 @@ unsigned long World::sizeSprite() {
36 36
     return mSprites.size();
37 37
 }
38 38
 
39
-SpriteSequence &World::getSprite(unsigned long index) {
39
+SpriteSequence& World::getSprite(unsigned long index) {
40 40
     assert(index < mSprites.size());
41 41
     return *mSprites.at(index);
42 42
 }
43 43
 
44
-void World::addEntity(Entity &entity) {
44
+void World::addEntity(Entity& entity) {
45 45
     mEntities.push_back(std::unique_ptr<Entity>(&entity));
46 46
 }
47 47
 
@@ -49,12 +49,12 @@ unsigned long World::sizeEntity() {
49 49
     return mEntities.size();
50 50
 }
51 51
 
52
-Entity &World::getEntity(unsigned long index) {
52
+Entity& World::getEntity(unsigned long index) {
53 53
     assert(index < mEntities.size());
54 54
     return *mEntities.at(index);
55 55
 }
56 56
 
57
-void World::addSkeletalModel(SkeletalModel &model) {
57
+void World::addSkeletalModel(SkeletalModel& model) {
58 58
     mModels.push_back(std::unique_ptr<SkeletalModel>(&model));
59 59
 }
60 60
 
@@ -62,12 +62,12 @@ unsigned long World::sizeSkeletalModel() {
62 62
     return mModels.size();
63 63
 }
64 64
 
65
-SkeletalModel &World::getSkeletalModel(unsigned long index) {
65
+SkeletalModel& World::getSkeletalModel(unsigned long index) {
66 66
     assert(index < mModels.size());
67 67
     return *mModels.at(index);
68 68
 }
69 69
 
70
-void World::addStaticMesh(StaticMesh &model) {
70
+void World::addStaticMesh(StaticMesh& model) {
71 71
     mMeshes.push_back(std::unique_ptr<StaticMesh>(&model));
72 72
 }
73 73
 
@@ -75,17 +75,16 @@ unsigned long World::sizeStaticMesh() {
75 75
     return mMeshes.size();
76 76
 }
77 77
 
78
-StaticMesh &World::getStaticMesh(unsigned long index) {
78
+StaticMesh& World::getStaticMesh(unsigned long index) {
79 79
     assert(index < mMeshes.size());
80 80
     return *mMeshes.at(index);
81 81
 }
82 82
 
83 83
 
84
-long World::getRoomByLocation(long index, float x, float y, float z)
85
-{
84
+long World::getRoomByLocation(long index, float x, float y, float z) {
86 85
     assert(index >= 0);
87 86
     assert(index < (long)mRooms.size());
88
-    Room &room = *mRooms.at(index);
87
+    Room& room = *mRooms.at(index);
89 88
 
90 89
     if (room.getBoundingBox().inBox(x, y, z))
91 90
         return index;

+ 3
- 3
src/commands/Command.cpp Wyświetl plik

@@ -74,7 +74,7 @@ int Command::command(std::string c) {
74 74
             getLog() << "Available commands:" << Log::endl;
75 75
             getLog() << std::right << std::setw(11);
76 76
             getLog() << "help" << " - print command help" << Log::endl;
77
-            for (auto &x : commands) {
77
+            for (auto& x : commands) {
78 78
                 if (x) {
79 79
                     getLog() << std::right << std::setw(11);
80 80
                     getLog() << x->name() << " - " << x->brief() << Log::endl;
@@ -85,7 +85,7 @@ int Command::command(std::string c) {
85 85
             return 0;
86 86
         } else {
87 87
             // Show help for a specific command
88
-            for (auto &x : commands) {
88
+            for (auto& x : commands) {
89 89
                 if (x) {
90 90
                     if (x->name().compare(arg) == 0) {
91 91
                         x->printHelp();
@@ -99,7 +99,7 @@ int Command::command(std::string c) {
99 99
     }
100 100
 
101 101
     // Execute command
102
-    for (auto &x : commands) {
102
+    for (auto& x : commands) {
103 103
         if (x) {
104 104
             if (x->name().compare(cmd) == 0) {
105 105
                 return x->execute(command);

+ 6
- 7
src/commands/CommandAnimate.cpp Wyświetl plik

@@ -39,8 +39,8 @@ int CommandAnimate::execute(std::istream& args) {
39 39
         // Step all skeletal models to their next animation
40 40
         if (getRender().getFlags() & Render::fAnimateAllModels) {
41 41
             for (unsigned int i = 0; i < getWorld().sizeEntity(); i++) {
42
-                Entity &e = getWorld().getEntity(i);
43
-                SkeletalModel &m = e.getModel();
42
+                Entity& e = getWorld().getEntity(i);
43
+                SkeletalModel& m = e.getModel();
44 44
                 if (e.getAnimation() < (m.size() - 1))
45 45
                     e.setAnimation(e.getAnimation() + 1);
46 46
                 else
@@ -53,13 +53,12 @@ int CommandAnimate::execute(std::istream& args) {
53 53
         // Step all skeletal models to their previous animation
54 54
         if (getRender().getFlags() & Render::fAnimateAllModels) {
55 55
             for (unsigned int i = 0; i < getWorld().sizeEntity(); i++) {
56
-                Entity &e = getWorld().getEntity(i);
57
-                SkeletalModel &m = e.getModel();
56
+                Entity& e = getWorld().getEntity(i);
57
+                SkeletalModel& m = e.getModel();
58 58
                 if (e.getAnimation() > 0)
59 59
                     e.setAnimation(e.getAnimation() - 1);
60
-                else
61
-                    if (m.size() > 0)
62
-                        e.setAnimation(m.size() - 1);
60
+                else if (m.size() > 0)
61
+                    e.setAnimation(m.size() - 1);
63 62
             }
64 63
         } else {
65 64
             getLog() << "Animations need to be enabled!" << Log::endl;

+ 2
- 2
src/commands/CommandSet.cpp Wyświetl plik

@@ -46,8 +46,8 @@ namespace {
46 46
     std::string expandNames(std::string s) {
47 47
         // Remove quotes
48 48
         if ((s.length() >= 3) &&
49
-                (((s[0] == '"') && (s[s.length() - 1] == '"'))
50
-                || ((s[0] == '\'') && (s[s.length() - 1] == '\'')))) {
49
+            (((s[0] == '"') && (s[s.length() - 1] == '"'))
50
+             || ((s[0] == '\'') && (s[s.length() - 1] == '\'')))) {
51 51
             s.erase(0, 1);
52 52
             s.erase(s.length() - 1, 1);
53 53
         }

+ 3
- 3
src/loader/LoaderTR2.cpp Wyświetl plik

@@ -61,7 +61,7 @@ void LoaderTR2::loadPaletteTextiles() {
61 61
 
62 62
     // Read the 16bit palette, 256 * 4 bytes, RGBA, A unused
63 63
     std::array<uint32_t, 256> palette; //!< RGBA, A unused
64
-    for (auto &x : palette)
64
+    for (auto& x : palette)
65 65
         x = file.readU32();
66 66
 
67 67
     uint32_t numTextiles = file.readU32();
@@ -72,7 +72,7 @@ void LoaderTR2::loadPaletteTextiles() {
72 72
     std::vector<std::array<uint16_t, 256 * 256>> textiles;
73 73
     for (unsigned int i = 0; i < numTextiles; i++) {
74 74
         std::array<uint16_t, 256 * 256> arr;
75
-        for (auto &x : arr) {
75
+        for (auto& x : arr) {
76 76
             x = file.readU16();
77 77
         }
78 78
         textiles.push_back(arr);
@@ -605,7 +605,7 @@ void LoaderTR2::loadDemoData() {
605 605
 
606 606
 void LoaderTR2::loadSoundMap() {
607 607
     std::array<int16_t, 370> soundMap;
608
-    for (auto &x : soundMap) {
608
+    for (auto& x : soundMap) {
609 609
         x = file.read16();
610 610
     }
611 611
 

+ 13
- 13
src/main.cpp Wyświetl plik

@@ -56,43 +56,43 @@ static std::shared_ptr<TextureManager> gTextureManager;
56 56
 static std::shared_ptr<Window> gWindow;
57 57
 static std::shared_ptr<World> gWorld;
58 58
 
59
-Camera &getCamera() {
59
+Camera& getCamera() {
60 60
     return *gCamera;
61 61
 }
62 62
 
63
-Game &getGame() {
63
+Game& getGame() {
64 64
     return *gGame;
65 65
 }
66 66
 
67
-Log &getLog() {
67
+Log& getLog() {
68 68
     return *gLog;
69 69
 }
70 70
 
71
-Menu &getMenu() {
71
+Menu& getMenu() {
72 72
     return *gMenu;
73 73
 }
74 74
 
75
-Render &getRender() {
75
+Render& getRender() {
76 76
     return *gRender;
77 77
 }
78 78
 
79
-RunTime &getRunTime() {
79
+RunTime& getRunTime() {
80 80
     return *gRunTime;
81 81
 }
82 82
 
83
-Sound &getSound() {
83
+Sound& getSound() {
84 84
     return *gSound;
85 85
 }
86 86
 
87
-TextureManager &getTextureManager() {
87
+TextureManager& getTextureManager() {
88 88
     return *gTextureManager;
89 89
 }
90 90
 
91
-Window &getWindow() {
91
+Window& getWindow() {
92 92
     return *gWindow;
93 93
 }
94 94
 
95
-World &getWorld() {
95
+World& getWorld() {
96 96
     return *gWorld;
97 97
 }
98 98
 
@@ -100,7 +100,7 @@ int main(int argc, char* argv[]) {
100 100
     command_t cmd;
101 101
     command_init(&cmd, argv[0], VERSION);
102 102
     command_option(&cmd, "-c", "--config <file>", "select config file to use",
103
-            [](command_t *self) {
103
+    [](command_t* self) {
104 104
         configFileToUse = self->arg;
105 105
     });
106 106
     command_parse(&cmd, argc, argv);
@@ -271,9 +271,9 @@ namespace {
271 271
 
272 272
     [[noreturn]] void terminateHandler() {
273 273
         const unsigned int maxSize = 128;
274
-        void *callstack[maxSize];
274
+        void* callstack[maxSize];
275 275
         int frames = backtrace(callstack, maxSize);
276
-        char **strs = backtrace_symbols(callstack, frames);
276
+        char** strs = backtrace_symbols(callstack, frames);
277 277
 
278 278
         std::cout << std::endl;
279 279
         for (int i = 0; i < frames; i++)

+ 109
- 100
src/math/Matrix.cpp Wyświetl plik

@@ -19,7 +19,7 @@ Matrix::Matrix(float m[16]) {
19 19
     setMatrix(m);
20 20
 }
21 21
 
22
-Matrix::Matrix(Quaternion &q) {
22
+Matrix::Matrix(Quaternion& q) {
23 23
     float m[16];
24 24
     q.getMatrix(m);
25 25
     setMatrix(m);
@@ -43,34 +43,34 @@ bool Matrix::getInvert(float out[16]) {
43 43
 
44 44
     float wtmp[4][8];
45 45
     float m0, m1, m2, m3, s;
46
-    float *r0, *r1, *r2, *r3;
46
+    float* r0, *r1, *r2, *r3;
47 47
 
48 48
     r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3];
49 49
 
50
-    r0[0] = MAT(m,0,0), r0[1] = MAT(m,0,1),
51
-    r0[2] = MAT(m,0,2), r0[3] = MAT(m,0,3),
52
-    r0[4] = 1.0f, r0[5] = r0[6] = r0[7] = 0.0f,
50
+    r0[0] = MAT(m, 0, 0), r0[1] = MAT(m, 0, 1),
51
+                                  r0[2] = MAT(m, 0, 2), r0[3] = MAT(m, 0, 3),
52
+                                          r0[4] = 1.0f, r0[5] = r0[6] = r0[7] = 0.0f,
53 53
 
54
-    r1[0] = MAT(m,1,0), r1[1] = MAT(m,1,1),
55
-    r1[2] = MAT(m,1,2), r1[3] = MAT(m,1,3),
56
-    r1[5] = 1.0f, r1[4] = r1[6] = r1[7] = 0.0f,
54
+                                                  r1[0] = MAT(m, 1, 0), r1[1] = MAT(m, 1, 1),
55
+                                                          r1[2] = MAT(m, 1, 2), r1[3] = MAT(m, 1, 3),
56
+                                                                  r1[5] = 1.0f, r1[4] = r1[6] = r1[7] = 0.0f,
57 57
 
58
-    r2[0] = MAT(m,2,0), r2[1] = MAT(m,2,1),
59
-    r2[2] = MAT(m,2,2), r2[3] = MAT(m,2,3),
60
-    r2[6] = 1.0f, r2[4] = r2[5] = r2[7] = 0.0f,
58
+                                                                          r2[0] = MAT(m, 2, 0), r2[1] = MAT(m, 2, 1),
59
+                                                                                  r2[2] = MAT(m, 2, 2), r2[3] = MAT(m, 2, 3),
60
+                                                                                          r2[6] = 1.0f, r2[4] = r2[5] = r2[7] = 0.0f,
61 61
 
62
-    r3[0] = MAT(m,3,0), r3[1] = MAT(m,3,1),
63
-    r3[2] = MAT(m,3,2), r3[3] = MAT(m,3,3),
64
-    r3[7] = 1.0f, r3[4] = r3[5] = r3[6] = 0.0f;
62
+                                                                                                  r3[0] = MAT(m, 3, 0), r3[1] = MAT(m, 3, 1),
63
+                                                                                                          r3[2] = MAT(m, 3, 2), r3[3] = MAT(m, 3, 3),
64
+                                                                                                                  r3[7] = 1.0f, r3[4] = r3[5] = r3[6] = 0.0f;
65 65
 
66 66
     /* choose pivot - or die */
67
-    if (fabs(r3[0])>fabs(r2[0])) SWAP_ROWS(r3, r2);
68
-    if (fabs(r2[0])>fabs(r1[0])) SWAP_ROWS(r2, r1);
69
-    if (fabs(r1[0])>fabs(r0[0])) SWAP_ROWS(r1, r0);
67
+    if (fabs(r3[0]) > fabs(r2[0])) SWAP_ROWS(r3, r2);
68
+    if (fabs(r2[0]) > fabs(r1[0])) SWAP_ROWS(r2, r1);
69
+    if (fabs(r1[0]) > fabs(r0[0])) SWAP_ROWS(r1, r0);
70 70
     if (0.0f == r0[0])  return false;
71 71
 
72 72
     /* eliminate first variable     */
73
-    m1 = r1[0]/r0[0]; m2 = r2[0]/r0[0]; m3 = r3[0]/r0[0];
73
+    m1 = r1[0] / r0[0]; m2 = r2[0] / r0[0]; m3 = r3[0] / r0[0];
74 74
     s = r0[1]; r1[1] -= m1 * s; r2[1] -= m2 * s; r3[1] -= m3 * s;
75 75
     s = r0[2]; r1[2] -= m1 * s; r2[2] -= m2 * s; r3[2] -= m3 * s;
76 76
     s = r0[3]; r1[3] -= m1 * s; r2[3] -= m2 * s; r3[3] -= m3 * s;
@@ -84,68 +84,72 @@ bool Matrix::getInvert(float out[16]) {
84 84
     if (s != 0.0f) { r1[7] -= m1 * s; r2[7] -= m2 * s; r3[7] -= m3 * s; }
85 85
 
86 86
     /* choose pivot - or die */
87
-    if (fabs(r3[1])>fabs(r2[1])) SWAP_ROWS(r3, r2);
88
-    if (fabs(r2[1])>fabs(r1[1])) SWAP_ROWS(r2, r1);
87
+    if (fabs(r3[1]) > fabs(r2[1])) SWAP_ROWS(r3, r2);
88
+    if (fabs(r2[1]) > fabs(r1[1])) SWAP_ROWS(r2, r1);
89 89
     if (0.0f == r1[1])  return false;
90 90
 
91 91
     /* eliminate second variable */
92
-    m2 = r2[1]/r1[1]; m3 = r3[1]/r1[1];
92
+    m2 = r2[1] / r1[1]; m3 = r3[1] / r1[1];
93 93
     r2[2] -= m2 * r1[2]; r3[2] -= m3 * r1[2];
94 94
     r2[3] -= m2 * r1[3]; r3[3] -= m3 * r1[3];
95
-    s = r1[4]; if (0.0f != s) { r2[4] -= m2 * s; r3[4] -= m3 * s; }
96
-    s = r1[5]; if (0.0f != s) { r2[5] -= m2 * s; r3[5] -= m3 * s; }
97
-    s = r1[6]; if (0.0f != s) { r2[6] -= m2 * s; r3[6] -= m3 * s; }
98
-    s = r1[7]; if (0.0f != s) { r2[7] -= m2 * s; r3[7] -= m3 * s; }
95
+    s = r1[4];
96
+    if (0.0f != s) { r2[4] -= m2 * s; r3[4] -= m3 * s; }
97
+    s = r1[5];
98
+    if (0.0f != s) { r2[5] -= m2 * s; r3[5] -= m3 * s; }
99
+    s = r1[6];
100
+    if (0.0f != s) { r2[6] -= m2 * s; r3[6] -= m3 * s; }
101
+    s = r1[7];
102
+    if (0.0f != s) { r2[7] -= m2 * s; r3[7] -= m3 * s; }
99 103
 
100 104
     /* choose pivot - or die */
101
-    if (fabs(r3[2])>fabs(r2[2])) SWAP_ROWS(r3, r2);
105
+    if (fabs(r3[2]) > fabs(r2[2])) SWAP_ROWS(r3, r2);
102 106
     if (0.0f == r2[2])  return false;
103 107
 
104 108
     /* eliminate third variable */
105
-    m3 = r3[2]/r2[2];
109
+    m3 = r3[2] / r2[2];
106 110
     r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4],
107
-    r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6],
108
-    r3[7] -= m3 * r2[7];
111
+                                  r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6],
112
+                                           r3[7] -= m3 * r2[7];
109 113
 
110 114
     /* last check */
111 115
     if (0.0f == r3[3]) return false;
112 116
 
113
-    s = 1.0f/r3[3];              /* now back substitute row 3 */
117
+    s = 1.0f / r3[3];            /* now back substitute row 3 */
114 118
     r3[4] *= s; r3[5] *= s; r3[6] *= s; r3[7] *= s;
115 119
 
116 120
     m2 = r2[3];                 /* now back substitute row 2 */
117
-    s  = 1.0f/r2[2];
121
+    s  = 1.0f / r2[2];
118 122
     r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2),
119
-    r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2);
123
+            r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2);
120 124
     m1 = r1[3];
121 125
     r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1,
122
-    r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1;
126
+                                  r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1;
123 127
     m0 = r0[3];
124 128
     r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0,
125
-    r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0;
129
+                                  r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0;
126 130
 
127 131
     m1 = r1[2];                 /* now back substitute row 1 */
128
-    s  = 1.0f/r1[1];
132
+    s  = 1.0f / r1[1];
129 133
     r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1),
130
-    r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1);
134
+            r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1);
131 135
     m0 = r0[2];
132 136
     r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0,
133
-    r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0;
137
+                                  r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0;
134 138
 
135 139
     m0 = r0[1];                 /* now back substitute row 0 */
136
-    s  = 1.0f/r0[0];
140
+    s  = 1.0f / r0[0];
137 141
     r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0),
138
-    r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0);
139
-
140
-    MAT(out,0,0) = r0[4];
141
-    MAT(out,0,1) = r0[5], MAT(out,0,2) = r0[6];
142
-    MAT(out,0,3) = r0[7], MAT(out,1,0) = r1[4];
143
-    MAT(out,1,1) = r1[5], MAT(out,1,2) = r1[6];
144
-    MAT(out,1,3) = r1[7], MAT(out,2,0) = r2[4];
145
-    MAT(out,2,1) = r2[5], MAT(out,2,2) = r2[6];
146
-    MAT(out,2,3) = r2[7], MAT(out,3,0) = r3[4];
147
-    MAT(out,3,1) = r3[5], MAT(out,3,2) = r3[6];
148
-    MAT(out,3,3) = r3[7];
142
+            r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0);
143
+
144
+    MAT(out, 0, 0) = r0[4];
145
+    MAT(out, 0, 1) = r0[5], MAT(out, 0, 2) = r0[6];
146
+    MAT(out, 0, 3) = r0[7], MAT(out, 1, 0) = r1[4];
147
+    MAT(out, 1, 1) = r1[5], MAT(out, 1, 2) = r1[6];
148
+    MAT(out, 1, 3) = r1[7], MAT(out, 2, 0) = r2[4];
149
+    MAT(out, 2, 1) = r2[5], MAT(out, 2, 2) = r2[6];
150
+    MAT(out, 2, 3) = r2[7], MAT(out, 3, 0) = r3[4];
151
+    MAT(out, 3, 1) = r3[5], MAT(out, 3, 2) = r3[6];
152
+    MAT(out, 3, 3) = r3[7];
149 153
 
150 154
     return true;
151 155
 #undef MAT
@@ -157,19 +161,19 @@ void Matrix::getMatrix(float mat[16]) {
157 161
 }
158 162
 
159 163
 void Matrix::getTransposeMatrix(float m[16]) {
160
-    m[ 0]= mMatrix[0]; m[ 1]= mMatrix[4]; m[ 2]= mMatrix[ 8]; m[ 3]=mMatrix[12];
161
-    m[ 4]= mMatrix[1]; m[ 5]= mMatrix[5]; m[ 6]= mMatrix[ 9]; m[ 7]=mMatrix[13];
162
-    m[ 8]= mMatrix[2]; m[ 9]= mMatrix[6]; m[10]= mMatrix[10]; m[11]=mMatrix[14];
163
-    m[12]= mMatrix[3]; m[13]= mMatrix[7]; m[14]= mMatrix[11]; m[15]=mMatrix[15];
164
+    m[ 0] = mMatrix[0]; m[ 1] = mMatrix[4]; m[ 2] = mMatrix[ 8]; m[ 3] = mMatrix[12];
165
+    m[ 4] = mMatrix[1]; m[ 5] = mMatrix[5]; m[ 6] = mMatrix[ 9]; m[ 7] = mMatrix[13];
166
+    m[ 8] = mMatrix[2]; m[ 9] = mMatrix[6]; m[10] = mMatrix[10]; m[11] = mMatrix[14];
167
+    m[12] = mMatrix[3]; m[13] = mMatrix[7]; m[14] = mMatrix[11]; m[15] = mMatrix[15];
164 168
 }
165 169
 
166
-Matrix Matrix::multiply(const Matrix &a, const Matrix &b) {
170
+Matrix Matrix::multiply(const Matrix& a, const Matrix& b) {
167 171
     Matrix c;
168 172
     multiply(a.mMatrix, b.mMatrix, c.mMatrix);
169 173
     return c;
170 174
 }
171 175
 
172
-Matrix Matrix::operator *(const Matrix &a) {
176
+Matrix Matrix::operator *(const Matrix& a) {
173 177
     return multiply(a, *this);
174 178
 }
175 179
 
@@ -177,45 +181,45 @@ Vector3d Matrix::operator *(Vector3d v) {
177 181
     float x = v.mVec[0], y = v.mVec[1], z = v.mVec[2];
178 182
 
179 183
 #ifdef COLUMN_ORDER
180
-    return Vector3d(mMatrix[0]*x + mMatrix[4]*y + mMatrix[ 8]*z + mMatrix[12],
181
-            mMatrix[1]*x + mMatrix[5]*y + mMatrix[ 9]*z + mMatrix[13],
182
-            mMatrix[2]*x + mMatrix[6]*y + mMatrix[10]*z + mMatrix[14]);
184
+    return Vector3d(mMatrix[0] * x + mMatrix[4] * y + mMatrix[ 8] * z + mMatrix[12],
185
+                    mMatrix[1] * x + mMatrix[5] * y + mMatrix[ 9] * z + mMatrix[13],
186
+                    mMatrix[2] * x + mMatrix[6] * y + mMatrix[10] * z + mMatrix[14]);
183 187
 #else
184
-    return Vector3d(mMatrix[0]*x + mMatrix[1]*y + mMatrix[ 2]*z + mMatrix[ 3],
185
-            mMatrix[4]*x + mMatrix[5]*y + mMatrix[ 6]*z + mMatrix[ 7],
186
-            mMatrix[8]*x + mMatrix[9]*y + mMatrix[10]*z + mMatrix[11]);
188
+    return Vector3d(mMatrix[0] * x + mMatrix[1] * y + mMatrix[ 2] * z + mMatrix[ 3],
189
+                    mMatrix[4] * x + mMatrix[5] * y + mMatrix[ 6] * z + mMatrix[ 7],
190
+                    mMatrix[8] * x + mMatrix[9] * y + mMatrix[10] * z + mMatrix[11]);
187 191
 #endif
188 192
 }
189 193
 
190 194
 void Matrix::multiply3v(float v[3], float result[3]) {
191 195
     float x = v[0], y = v[1], z = v[2];
192 196
 
193
-    result[0] = mMatrix[0]*x + mMatrix[1]*y + mMatrix[ 2]*z + mMatrix[ 3];
194
-    result[1] = mMatrix[4]*x + mMatrix[5]*y + mMatrix[ 6]*z + mMatrix[ 7];
195
-    result[2] = mMatrix[8]*x + mMatrix[9]*y + mMatrix[10]*z + mMatrix[11];
197
+    result[0] = mMatrix[0] * x + mMatrix[1] * y + mMatrix[ 2] * z + mMatrix[ 3];
198
+    result[1] = mMatrix[4] * x + mMatrix[5] * y + mMatrix[ 6] * z + mMatrix[ 7];
199
+    result[2] = mMatrix[8] * x + mMatrix[9] * y + mMatrix[10] * z + mMatrix[11];
196 200
 }
197 201
 
198 202
 void Matrix::multiply4v(float v[4], float result[4]) {
199 203
     float x = v[0], y = v[1], z = v[2], w = v[3];
200 204
 
201
-    result[0] = mMatrix[ 0]*x + mMatrix[ 1]*y + mMatrix[ 2]*z + mMatrix[ 3]*w;
202
-    result[1] = mMatrix[ 4]*x + mMatrix[ 5]*y + mMatrix[ 6]*z + mMatrix[ 7]*w;
203
-    result[2] = mMatrix[ 8]*x + mMatrix[ 9]*y + mMatrix[10]*z + mMatrix[11]*w;
204
-    result[3] = mMatrix[12]*x + mMatrix[13]*y + mMatrix[14]*z + mMatrix[15]*w;
205
+    result[0] = mMatrix[ 0] * x + mMatrix[ 1] * y + mMatrix[ 2] * z + mMatrix[ 3] * w;
206
+    result[1] = mMatrix[ 4] * x + mMatrix[ 5] * y + mMatrix[ 6] * z + mMatrix[ 7] * w;
207
+    result[2] = mMatrix[ 8] * x + mMatrix[ 9] * y + mMatrix[10] * z + mMatrix[11] * w;
208
+    result[3] = mMatrix[12] * x + mMatrix[13] * y + mMatrix[14] * z + mMatrix[15] * w;
205 209
 }
206 210
 
207 211
 void Matrix::print() {
208 212
     printf("{\n%f %f %f %f\n%f %f %f %f\n%f %f %f %f\n%f %f %f %f\n}\n",
209 213
 #ifdef COLUMN_ORDER
210
-            mMatrix[0], mMatrix[4], mMatrix[ 8], mMatrix[12],
211
-            mMatrix[1], mMatrix[5], mMatrix[ 9], mMatrix[13],
212
-            mMatrix[2], mMatrix[6], mMatrix[10], mMatrix[14],
213
-            mMatrix[3], mMatrix[7], mMatrix[11], mMatrix[15]);
214
+           mMatrix[0], mMatrix[4], mMatrix[ 8], mMatrix[12],
215
+           mMatrix[1], mMatrix[5], mMatrix[ 9], mMatrix[13],
216
+           mMatrix[2], mMatrix[6], mMatrix[10], mMatrix[14],
217
+           mMatrix[3], mMatrix[7], mMatrix[11], mMatrix[15]);
214 218
 #else
215
-            mMatrix[ 0], mMatrix[ 1], mMatrix[ 2], mMatrix[ 3],
216
-            mMatrix[ 4], mMatrix[ 5], mMatrix[ 6], mMatrix[ 7],
217
-            mMatrix[ 8], mMatrix[ 9], mMatrix[10], mMatrix[11],
218
-            mMatrix[12], mMatrix[13], mMatrix[14], mMatrix[15]);
219
+           mMatrix[ 0], mMatrix[ 1], mMatrix[ 2], mMatrix[ 3],
220
+           mMatrix[ 4], mMatrix[ 5], mMatrix[ 6], mMatrix[ 7],
221
+           mMatrix[ 8], mMatrix[ 9], mMatrix[10], mMatrix[11],
222
+           mMatrix[12], mMatrix[13], mMatrix[14], mMatrix[15]);
219 223
 #endif
220 224
 }
221 225
 
@@ -230,11 +234,16 @@ bool Matrix::isIdentity() {
230 234
             mMatrix[15] == 1)
231 235
         return true;
232 236
     */
233
-    if (equalEpsilon(mMatrix[ 0], 1.0) && equalEpsilon(mMatrix[ 1], 0.0) && equalEpsilon(mMatrix[ 2], 0.0) &&
234
-        equalEpsilon(mMatrix[ 3], 0.0) && equalEpsilon(mMatrix[ 4], 0.0) && equalEpsilon(mMatrix[ 5], 1.0) &&
235
-        equalEpsilon(mMatrix[ 6], 0.0) && equalEpsilon(mMatrix[ 7], 0.0) && equalEpsilon(mMatrix[ 8], 0.0) &&
236
-        equalEpsilon(mMatrix[ 9], 0.0) && equalEpsilon(mMatrix[10], 1.0) && equalEpsilon(mMatrix[11], 0.0) &&
237
-        equalEpsilon(mMatrix[12], 0.0) && equalEpsilon(mMatrix[13], 0.0) && equalEpsilon(mMatrix[14], 0.0) &&
237
+    if (equalEpsilon(mMatrix[ 0], 1.0) && equalEpsilon(mMatrix[ 1], 0.0)
238
+        && equalEpsilon(mMatrix[ 2], 0.0) &&
239
+        equalEpsilon(mMatrix[ 3], 0.0) && equalEpsilon(mMatrix[ 4], 0.0) && equalEpsilon(mMatrix[ 5], 1.0)
240
+        &&
241
+        equalEpsilon(mMatrix[ 6], 0.0) && equalEpsilon(mMatrix[ 7], 0.0) && equalEpsilon(mMatrix[ 8], 0.0)
242
+        &&
243
+        equalEpsilon(mMatrix[ 9], 0.0) && equalEpsilon(mMatrix[10], 1.0) && equalEpsilon(mMatrix[11], 0.0)
244
+        &&
245
+        equalEpsilon(mMatrix[12], 0.0) && equalEpsilon(mMatrix[13], 0.0) && equalEpsilon(mMatrix[14], 0.0)
246
+        &&
238 247
         equalEpsilon(mMatrix[15], 1.0))
239 248
         return true;
240 249
 
@@ -252,7 +261,7 @@ void Matrix::setIdentity() {
252 261
     mMatrix[12] = 0; mMatrix[13] = 0; mMatrix[14] = 0; mMatrix[15] = 1;
253 262
 }
254 263
 
255
-void Matrix::scale(const float *xyz) {
264
+void Matrix::scale(const float* xyz) {
256 265
     scale(xyz[0], xyz[1], xyz[2]);
257 266
 }
258 267
 
@@ -269,44 +278,44 @@ void Matrix::scale(float sx, float sy, float sz) {
269 278
     multiply(tmp, smatrix, mMatrix);
270 279
 }
271 280
 
272
-void Matrix::rotate(const float *xyz) {
281
+void Matrix::rotate(const float* xyz) {
273 282
     rotate(xyz[0], xyz[1], xyz[2]);
274 283
 }
275 284
 
276 285
 void Matrix::rotate(float ax, float ay, float az) {
277 286
     float xmat[16], ymat[16], zmat[16], tmp[16], tmp2[16];
278 287
 
279
-    xmat[ 0]=1;         xmat[ 1]=0;         xmat[ 2]=0;         xmat[ 3]=0;
280
-    xmat[ 4]=0;         xmat[ 5]=cosf(ax);  xmat[ 6]=sinf(ax);  xmat[ 7]=0;
281
-    xmat[ 8]=0;         xmat[ 9]=-sinf(ax); xmat[10]=cosf(ax);  xmat[11]=0;
282
-    xmat[12]=0;         xmat[13]=0;         xmat[14]=0;         xmat[15]=1;
288
+    xmat[ 0] = 1;         xmat[ 1] = 0;         xmat[ 2] = 0;         xmat[ 3] = 0;
289
+    xmat[ 4] = 0;         xmat[ 5] = cosf(ax);  xmat[ 6] = sinf(ax);  xmat[ 7] = 0;
290
+    xmat[ 8] = 0;         xmat[ 9] = -sinf(ax); xmat[10] = cosf(ax);  xmat[11] = 0;
291
+    xmat[12] = 0;         xmat[13] = 0;         xmat[14] = 0;         xmat[15] = 1;
283 292
 
284
-    ymat[ 0]=cosf(ay);  ymat[ 1]=0;         ymat[ 2]=-sinf(ay); ymat[ 3]=0;
285
-    ymat[ 4]=0;         ymat[ 5]=1;         ymat[ 6]=0;         ymat[ 7]=0;
286
-    ymat[ 8]=sinf(ay);  ymat[ 9]=0;         ymat[10]=cosf(ay);  ymat[11]=0;
287
-    ymat[12]=0;         ymat[13]=0;         ymat[14]=0;         ymat[15]=1;
293
+    ymat[ 0] = cosf(ay);  ymat[ 1] = 0;         ymat[ 2] = -sinf(ay); ymat[ 3] = 0;
294
+    ymat[ 4] = 0;         ymat[ 5] = 1;         ymat[ 6] = 0;         ymat[ 7] = 0;
295
+    ymat[ 8] = sinf(ay);  ymat[ 9] = 0;         ymat[10] = cosf(ay);  ymat[11] = 0;
296
+    ymat[12] = 0;         ymat[13] = 0;         ymat[14] = 0;         ymat[15] = 1;
288 297
 
289
-    zmat[ 0]=cosf(az);  zmat[ 1]=sinf(az);  zmat[ 2]=0;         zmat[ 3]=0;
290
-    zmat[ 4]=-sinf(az); zmat[ 5]=cosf(az);  zmat[ 6]=0;         zmat[ 7]=0;
291
-    zmat[ 8]=0;         zmat[ 9]=0;         zmat[10]=1;         zmat[11]=0;
292
-    zmat[12]=0;         zmat[13]=0;         zmat[14]=0;         zmat[15]=1;
298
+    zmat[ 0] = cosf(az);  zmat[ 1] = sinf(az);  zmat[ 2] = 0;         zmat[ 3] = 0;
299
+    zmat[ 4] = -sinf(az); zmat[ 5] = cosf(az);  zmat[ 6] = 0;         zmat[ 7] = 0;
300
+    zmat[ 8] = 0;         zmat[ 9] = 0;         zmat[10] = 1;         zmat[11] = 0;
301
+    zmat[12] = 0;         zmat[13] = 0;         zmat[14] = 0;         zmat[15] = 1;
293 302
 
294 303
     multiply(mMatrix, ymat, tmp);
295 304
     multiply(tmp, xmat, tmp2);
296 305
     multiply(tmp2, zmat, mMatrix);
297 306
 }
298 307
 
299
-void Matrix::translate(const float *xyz) {
308
+void Matrix::translate(const float* xyz) {
300 309
     translate(xyz[0], xyz[1], xyz[2]);
301 310
 }
302 311
 
303 312
 void Matrix::translate(float tx, float ty, float tz) {
304 313
     float tmat[16], tmp[16];
305 314
 
306
-    tmat[ 0]=1;  tmat[ 1]=0;  tmat[ 2]=0;  tmat[ 3]=0;
307
-    tmat[ 4]=0;  tmat[ 5]=1;  tmat[ 6]=0;  tmat[ 7]=0;
308
-    tmat[ 8]=0;  tmat[ 9]=0;  tmat[10]=1;  tmat[11]=0;
309
-    tmat[12]=tx; tmat[13]=ty; tmat[14]=tz; tmat[15]=1;
315
+    tmat[ 0] = 1;  tmat[ 1] = 0;  tmat[ 2] = 0;  tmat[ 3] = 0;
316
+    tmat[ 4] = 0;  tmat[ 5] = 1;  tmat[ 6] = 0;  tmat[ 7] = 0;
317
+    tmat[ 8] = 0;  tmat[ 9] = 0;  tmat[10] = 1;  tmat[11] = 0;
318
+    tmat[12] = tx; tmat[13] = ty; tmat[14] = tz; tmat[15] = 1;
310 319
 
311 320
     copy(mMatrix, tmp);
312 321
     multiply(tmp, tmat, mMatrix);

+ 28
- 28
src/math/Quaternion.cpp Wyświetl plik

@@ -32,19 +32,19 @@ Quaternion::Quaternion(float v[4]) {
32 32
 }
33 33
 
34 34
 void Quaternion::getMatrix(float m[16]) {
35
-    m[ 0] = 1.0f - 2.0f * (mY*mY + mZ*mZ);
36
-    m[ 1] = 2.0f * (mX*mY - mW*mZ);
37
-    m[ 2] = 2.0f * (mX*mZ + mW*mY);
35
+    m[ 0] = 1.0f - 2.0f * (mY * mY + mZ * mZ);
36
+    m[ 1] = 2.0f * (mX * mY - mW * mZ);
37
+    m[ 2] = 2.0f * (mX * mZ + mW * mY);
38 38
     m[ 3] = 0.0f;
39 39
 
40
-    m[ 4] = 2.0f * (mX*mY + mW*mZ);
41
-    m[ 5] = 1.0f - 2.0f * (mX*mX + mZ*mZ);
42
-    m[ 6] = 2.0f * (mY*mZ - mW*mX);
40
+    m[ 4] = 2.0f * (mX * mY + mW * mZ);
41
+    m[ 5] = 1.0f - 2.0f * (mX * mX + mZ * mZ);
42
+    m[ 6] = 2.0f * (mY * mZ - mW * mX);
43 43
     m[ 7] = 0.0f;
44 44
 
45
-    m[ 8] = 2.0f * (mX*mZ - mW*mY);
46
-    m[ 9] = 2.0f * (mY*mZ + mW*mX);
47
-    m[10] = 1.0f - 2.0f * (mX*mX + mY*mY);
45
+    m[ 8] = 2.0f * (mX * mZ - mW * mY);
46
+    m[ 9] = 2.0f * (mY * mZ + mW * mX);
47
+    m[10] = 1.0f - 2.0f * (mX * mX + mY * mY);
48 48
     m[11] = 0.0f;
49 49
 
50 50
     m[12] = 0.0f;
@@ -53,23 +53,23 @@ void Quaternion::getMatrix(float m[16]) {
53 53
     m[15] = 1.0f;
54 54
 }
55 55
 
56
-Quaternion Quaternion::operator *(const Quaternion &q) {
56
+Quaternion Quaternion::operator *(const Quaternion& q) {
57 57
     return multiply(*this, q);
58 58
 }
59 59
 
60
-Quaternion Quaternion::operator /(const Quaternion &q) {
60
+Quaternion Quaternion::operator /(const Quaternion& q) {
61 61
     return divide(*this, q);
62 62
 }
63 63
 
64
-Quaternion Quaternion::operator +(const Quaternion &q) {
64
+Quaternion Quaternion::operator +(const Quaternion& q) {
65 65
     return add(*this, q);
66 66
 }
67 67
 
68
-Quaternion Quaternion::operator -(const Quaternion &q) {
68
+Quaternion Quaternion::operator -(const Quaternion& q) {
69 69
     return subtract(*this, q);
70 70
 }
71 71
 
72
-bool Quaternion::operator ==(const Quaternion &q) {
72
+bool Quaternion::operator ==(const Quaternion& q) {
73 73
     //return (mX == q.mX && mY == q.mY && mZ == q.mZ && mW == q.mW);
74 74
     return (equalEpsilon(mX, q.mX) && equalEpsilon(mY, q.mY) &&
75 75
             equalEpsilon(mZ, q.mZ) && equalEpsilon(mW, q.mW));
@@ -84,7 +84,7 @@ Quaternion Quaternion::scale(float s) {
84 84
 }
85 85
 
86 86
 Quaternion Quaternion::inverse() {
87
-    return conjugate().scale(1/magnitude());
87
+    return conjugate().scale(1 / magnitude());
88 88
 }
89 89
 
90 90
 float Quaternion::dot(Quaternion a, Quaternion b) {
@@ -106,7 +106,7 @@ void Quaternion::set(float angle, float x, float y, float z) {
106 106
     float temp, dist;
107 107
 
108 108
     // Normalize
109
-    temp = x*x + y*y + z*z;
109
+    temp = x * x + y * y + z * z;
110 110
 
111 111
     dist = 1.0f / sqrtf(temp);
112 112
 
@@ -228,7 +228,7 @@ void Quaternion::setByMatrix(float matrix[16]) {
228 228
         // If the first element of the diagonal is the greatest value
229 229
         if (matrix[0] > matrix[5] && matrix[0] > matrix[10]) {
230 230
             // Find the scale according to the first element, and double it
231
-            scale = (float)sqrt(1.0f + matrix[0] - matrix[5] - matrix[10])*2.0f;
231
+            scale = (float)sqrt(1.0f + matrix[0] - matrix[5] - matrix[10]) * 2.0f;
232 232
 
233 233
             // Calculate the quaternion
234 234
             w = (matrix[9] - matrix[6]) / scale;
@@ -238,7 +238,7 @@ void Quaternion::setByMatrix(float matrix[16]) {
238 238
         } else if (matrix[5] > matrix[10]) {
239 239
             // The second element of the diagonal is the greatest value
240 240
             // Find the scale according to the second element, and double it
241
-            scale = (float)sqrt(1.0f + matrix[5] - matrix[0] - matrix[10])*2.0f;
241
+            scale = (float)sqrt(1.0f + matrix[5] - matrix[0] - matrix[10]) * 2.0f;
242 242
 
243 243
             // Calculate the quaternion
244 244
             w = (matrix[2] - matrix[8]) / scale;
@@ -247,7 +247,7 @@ void Quaternion::setByMatrix(float matrix[16]) {
247 247
             z = (matrix[9] + matrix[6]) / scale;
248 248
         } else { // The third element of the diagonal is the greatest value
249 249
             // Find the scale according to the third element, and double it
250
-            scale = (float)sqrt(1.0f + matrix[10] - matrix[0] - matrix[5])*2.0f;
250
+            scale = (float)sqrt(1.0f + matrix[10] - matrix[0] - matrix[5]) * 2.0f;
251 251
 
252 252
             // Calculate the quaternion
253 253
             w = (matrix[4] - matrix[1]) / scale;
@@ -265,9 +265,9 @@ void Quaternion::setByMatrix(float matrix[16]) {
265 265
 
266 266
 Quaternion Quaternion::multiply(Quaternion a, Quaternion b) {
267 267
     return Quaternion(a.mW * b.mW - a.mX * b.mX - a.mY * b.mY - a.mZ * b.mZ,
268
-            a.mW * b.mX + a.mX * b.mW + a.mY * b.mZ - a.mZ * b.mY,
269
-            a.mW * b.mY + a.mY * b.mW + a.mZ * b.mX - a.mX * b.mZ,
270
-            a.mW * b.mZ + a.mZ * b.mW + a.mX * b.mY - a.mY * b.mX);
268
+                      a.mW * b.mX + a.mX * b.mW + a.mY * b.mZ - a.mZ * b.mY,
269
+                      a.mW * b.mY + a.mY * b.mW + a.mZ * b.mX - a.mX * b.mZ,
270
+                      a.mW * b.mZ + a.mZ * b.mW + a.mX * b.mY - a.mY * b.mX);
271 271
 }
272 272
 
273 273
 Quaternion Quaternion::divide(Quaternion a, Quaternion b) {
@@ -276,15 +276,15 @@ Quaternion Quaternion::divide(Quaternion a, Quaternion b) {
276 276
 
277 277
 Quaternion Quaternion::add(Quaternion a, Quaternion b) {
278 278
     return Quaternion(a.mW + b.mW,
279
-            a.mX + b.mX,
280
-            a.mY + b.mY,
281
-            a.mZ + b.mZ);
279
+                      a.mX + b.mX,
280
+                      a.mY + b.mY,
281
+                      a.mZ + b.mZ);
282 282
 }
283 283
 
284 284
 Quaternion Quaternion::subtract(Quaternion a, Quaternion b) {
285 285
     return Quaternion(a.mW - b.mW,
286
-            a.mX - b.mX,
287
-            a.mY - b.mY,
288
-            a.mZ - b.mZ);
286
+                      a.mX - b.mX,
287
+                      a.mY - b.mY,
288
+                      a.mZ - b.mZ);
289 289
 }
290 290
 

+ 26
- 26
src/math/Vector3d.cpp Wyświetl plik

@@ -26,69 +26,69 @@ Vector3d::Vector3d(float x, float y, float z) {
26 26
     mVec[2] = z;
27 27
 }
28 28
 
29
-Vector3d::Vector3d(const Vector3d &v) {
29
+Vector3d::Vector3d(const Vector3d& v) {
30 30
     mVec[0] = v.mVec[0];
31 31
     mVec[1] = v.mVec[1];
32 32
     mVec[2] = v.mVec[2];
33 33
 }
34 34
 
35
-float Vector3d::dot(const Vector3d &u, const Vector3d &v) {
36
-    return (u.mVec[0]*v.mVec[0] + u.mVec[1]*v.mVec[1] + u.mVec[2]*v.mVec[2]);
35
+float Vector3d::dot(const Vector3d& u, const Vector3d& v) {
36
+    return (u.mVec[0] * v.mVec[0] + u.mVec[1] * v.mVec[1] + u.mVec[2] * v.mVec[2]);
37 37
 }
38 38
 
39
-Vector3d Vector3d::cross(const Vector3d &u, const Vector3d &v) {
39
+Vector3d Vector3d::cross(const Vector3d& u, const Vector3d& v) {
40 40
     return Vector3d(u.mVec[1] * v.mVec[2] - u.mVec[2] * v.mVec[1],
41
-            u.mVec[2] * v.mVec[0] - u.mVec[0] * v.mVec[2],
42
-            u.mVec[0] * v.mVec[1] - u.mVec[1] * v.mVec[0]);
41
+                    u.mVec[2] * v.mVec[0] - u.mVec[0] * v.mVec[2],
42
+                    u.mVec[0] * v.mVec[1] - u.mVec[1] * v.mVec[0]);
43 43
 }
44 44
 
45 45
 float Vector3d::magnitude() {
46
-    return sqrtf(mVec[0]*mVec[0] + mVec[1]*mVec[1] + mVec[2]*mVec[2]);
46
+    return sqrtf(mVec[0] * mVec[0] + mVec[1] * mVec[1] + mVec[2] * mVec[2]);
47 47
 }
48 48
 
49 49
 Vector3d Vector3d::unit() {
50 50
     float norm = magnitude();
51 51
 
52 52
     return Vector3d(mVec[0] / norm,
53
-            mVec[1] / norm,
54
-            mVec[2] / norm);
53
+                    mVec[1] / norm,
54
+                    mVec[2] / norm);
55 55
 }
56 56
 
57 57
 Vector3d Vector3d::zeroVector() {
58 58
     return Vector3d(0, 0, 0);
59 59
 }
60 60
 
61
-Vector3d Vector3d::operator +(const Vector3d &v) {
61
+Vector3d Vector3d::operator +(const Vector3d& v) {
62 62
     return Vector3d(mVec[0] + v.mVec[0],
63
-            mVec[1] + v.mVec[1],
64
-            mVec[2] + v.mVec[2]);
63
+                    mVec[1] + v.mVec[1],
64
+                    mVec[2] + v.mVec[2]);
65 65
 }
66 66
 
67
-Vector3d Vector3d::operator -(const Vector3d &v) {
67
+Vector3d Vector3d::operator -(const Vector3d& v) {
68 68
     return Vector3d(mVec[0] - v.mVec[0],
69
-            mVec[1] - v.mVec[1],
70
-            mVec[2] - v.mVec[2]);
69
+                    mVec[1] - v.mVec[1],
70
+                    mVec[2] - v.mVec[2]);
71 71
 }
72 72
 
73 73
 Vector3d Vector3d::operator -() {
74 74
     return Vector3d(-mVec[0],
75
-            -mVec[1],
76
-            -mVec[2]);
75
+                    -mVec[1],
76
+                    -mVec[2]);
77 77
 }
78 78
 
79 79
 Vector3d Vector3d::operator *(float s) {
80 80
     return Vector3d(s * mVec[0],
81
-            s * mVec[1],
82
-            s * mVec[2]);
81
+                    s * mVec[1],
82
+                    s * mVec[2]);
83 83
 }
84 84
 
85 85
 Vector3d Vector3d::operator /(float s) {
86 86
     return Vector3d(mVec[0] / s,
87
-            mVec[1] / s,
88
-            mVec[2] / s);
87
+                    mVec[1] / s,
88
+                    mVec[2] / s);
89 89
 }
90 90
 
91
-float Vector3d::operator *(const Vector3d &v) {
91
+float Vector3d::operator *(const Vector3d& v) {
92 92
     return dot(*this, v);
93 93
 }
94 94
 
@@ -106,28 +106,28 @@ void Vector3d::zero() {
106 106
     mVec[2] = 0;
107 107
 }
108 108
 
109
-Vector3d &Vector3d::operator =(const Vector3d &v) {
109
+Vector3d& Vector3d::operator =(const Vector3d& v) {
110 110
     mVec[0] = v.mVec[0];
111 111
     mVec[1] = v.mVec[1];
112 112
     mVec[2] = v.mVec[2];
113 113
     return *this;
114 114
 }
115 115
 
116
-Vector3d &Vector3d::operator +=(const Vector3d &v) {
116
+Vector3d& Vector3d::operator +=(const Vector3d& v) {
117 117
     mVec[0] += v.mVec[0];
118 118
     mVec[1] += v.mVec[1];
119 119
     mVec[2] += v.mVec[2];
120 120
     return *this;
121 121
 }
122 122
 
123
-Vector3d &Vector3d::operator -=(const Vector3d &v) {
123
+Vector3d& Vector3d::operator -=(const Vector3d& v) {
124 124
     mVec[0] -= v.mVec[0];
125 125
     mVec[1] -= v.mVec[1];
126 126
     mVec[2] -= v.mVec[2];
127 127
     return *this;
128 128
 }
129 129
 
130
-Vector3d &Vector3d::operator *=(float s) {
130
+Vector3d& Vector3d::operator *=(float s) {
131 131
     mVec[0] *= s;
132 132
     mVec[1] *= s;
133 133
     mVec[2] *= s;

+ 1
- 1
src/math/math.cpp Wyświetl plik

@@ -25,7 +25,7 @@ bool equalEpsilon(float a, float b) {
25 25
 }
26 26
 
27 27
 int intersectionLinePolygon(float intersect[3],
28
-        float p1[3], float p2[3], float polygon[3][3]) {
28
+                            float p1[3], float p2[3], float polygon[3][3]) {
29 29
     assert(polygon != NULL);
30 30
 
31 31
     // float normal[3], a[3], b[3];

+ 2
- 2
src/utils/File.cpp Wyświetl plik

@@ -17,11 +17,11 @@ File::File(std::string file) : path(file) {
17 17
     std::transform(name.begin(), name.end(), name.begin(), ::tolower);
18 18
 }
19 19
 
20
-std::string &File::getName() {
20
+std::string& File::getName() {
21 21
     return name;
22 22
 }
23 23
 
24
-std::string &File::getPath() {
24
+std::string& File::getPath() {
25 25
     return path;
26 26
 }
27 27
 

+ 15
- 13
src/utils/Folder.cpp Wyświetl plik

@@ -28,11 +28,11 @@
28 28
 Folder::Folder(std::string folder, bool listDotFiles) {
29 29
     if (((folder.length() == 0) || (folder.compare(".") == 0))
30 30
 #ifdef _WIN32
31
-            || ((folder.compare(1, 2, std::string(":\\")) != 0) && (folder.at(0) != '~'))
31
+        || ((folder.compare(1, 2, std::string(":\\")) != 0) && (folder.at(0) != '~'))
32 32
 #else
33
-            || ((folder.at(0) != '/') && (folder.at(0) != '~'))
33
+        || ((folder.at(0) != '/') && (folder.at(0) != '~'))
34 34
 #endif
35
-            ) {
35
+       ) {
36 36
         // Prepend current working directory
37 37
         path = getCurrentWorkingDirectory();
38 38
         if (folder.length() > 1)
@@ -70,11 +70,11 @@ Folder::Folder(std::string folder, bool listDotFiles) {
70 70
     listDot = listDotFiles;
71 71
 }
72 72
 
73
-std::string &Folder::getName() {
73
+std::string& Folder::getName() {
74 74
     return name;
75 75
 }
76 76
 
77
-std::string &Folder::getPath() {
77
+std::string& Folder::getPath() {
78 78
     return path;
79 79
 }
80 80
 
@@ -83,7 +83,7 @@ unsigned long Folder::fileCount() {
83 83
     return files.size();
84 84
 }
85 85
 
86
-File &Folder::getFile(unsigned long i) {
86
+File& Folder::getFile(unsigned long i) {
87 87
     createFolderItems();
88 88
     assert(i < files.size());
89 89
     return files.at(i);
@@ -94,7 +94,7 @@ unsigned long Folder::folderCount() {
94 94
     return folders.size();
95 95
 }
96 96
 
97
-Folder &Folder::getFolder(unsigned long i) {
97
+Folder& Folder::getFolder(unsigned long i) {
98 98
     createFolderItems();
99 99
     assert(i < folders.size());
100 100
     return folders.at(i);
@@ -108,7 +108,7 @@ Folder Folder::getParent() {
108 108
     return Folder(parent, listDot);
109 109
 }
110 110
 
111
-void Folder::executeRemoveFiles(std::function<bool (File &f)> func) {
111
+void Folder::executeRemoveFiles(std::function<bool (File& f)> func) {
112 112
     createFolderItems();
113 113
     for (unsigned long i = 0; i < fileCount(); i++) {
114 114
         if (func(getFile(i))) {
@@ -159,17 +159,18 @@ void Folder::createFolderItems() {
159 159
 
160 160
 #ifdef USE_DIRENT
161 161
 
162
-int Folder::readFolderItems(std::vector<std::string> &foundFiles, std::vector<std::string> &foundFolders) {
162
+int Folder::readFolderItems(std::vector<std::string>& foundFiles,
163
+                            std::vector<std::string>& foundFolders) {
163 164
     struct dirent entry;
164
-    struct dirent *ep = nullptr;
165
-    DIR *pakDir;
165
+    struct dirent* ep = nullptr;
166
+    DIR* pakDir;
166 167
 
167 168
     pakDir = opendir(path.c_str());
168 169
     if (pakDir != nullptr) {
169 170
         readdir_r(pakDir, &entry, &ep);
170 171
         while (ep != nullptr) {
171 172
             if ((strcmp(".", ep->d_name) != 0)
172
-                     && (strcmp("..", ep->d_name) != 0)) {
173
+                && (strcmp("..", ep->d_name) != 0)) {
173 174
                 std::string tmp(path);
174 175
                 if (tmp.back() != '/')
175 176
                     tmp += '/';
@@ -194,7 +195,8 @@ int Folder::readFolderItems(std::vector<std::string> &foundFiles, std::vector<st
194 195
 
195 196
 #elif defined(USE_FINDFILE)
196 197
 
197
-int Folder::readFolderItems(std::vector<std::string> &foundFiles, std::vector<std::string> &foundFolders) {
198
+int Folder::readFolderItems(std::vector<std::string>& foundFiles,
199
+                            std::vector<std::string>& foundFolders) {
198 200
     std::string tmp(path);
199 201
     tmp += "/*";
200 202
 

+ 0
- 0
src/utils/FolderRecursive.cpp Wyświetl plik


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików

Ładowanie…
Anuluj
Zapisz