Przeglądaj źródła

Format code [skip ci]

Thomas Buck 10 lat temu
rodzic
commit
09b15dddcd

+ 1
- 1
include/global.h Wyświetl plik

@@ -106,7 +106,7 @@ typedef enum {
106 106
 
107 107
 template<typename T, typename U>
108 108
 [[noreturn]] void assertEqualImplementation(const char* exp, T a, U b, const char* file, int line,
109
-                                            bool print = false, const char* str = nullptr) {
109
+        bool print = false, const char* str = nullptr) {
110 110
     const unsigned int maxSize = 128;
111 111
     void* callstack[maxSize];
112 112
     int frames = backtrace(callstack, maxSize);

+ 2
- 2
include/system/FontTTF.h Wyświetl plik

@@ -23,7 +23,7 @@ class FontMapTTF {
23 23
     int initialize(unsigned char* fontData, int firstChar);
24 24
     bool contains(int c);
25 25
     int getTexture() { return texture; }
26
-    void getQuad(int c, float* xpos, float* ypos, stbtt_aligned_quad *quad);
26
+    void getQuad(int c, float* xpos, float* ypos, stbtt_aligned_quad* quad);
27 27
 
28 28
   private:
29 29
     int begin;
@@ -46,7 +46,7 @@ class FontTTF {
46 46
 
47 47
   private:
48 48
     static int charIsMapped(int c);
49
-    static int getQuad(int c, float* xpos, float* ypos, stbtt_aligned_quad *quad);
49
+    static int getQuad(int c, float* xpos, float* ypos, stbtt_aligned_quad* quad);
50 50
     static void drawTextInternal(unsigned int x, unsigned int y, float scale,
51 51
                                  const unsigned char color[4], unsigned int maxWidth, std::string s,
52 52
                                  bool drawWrapped);

+ 1
- 1
include/system/Shader.h Wyświetl plik

@@ -21,7 +21,7 @@ class ShaderBuffer {
21 21
 
22 22
     template<typename T>
23 23
     void bufferData(std::vector<T> v)
24
-        { bufferData(v.size(), sizeof(T), &v[0]); }
24
+    { bufferData(v.size(), sizeof(T), &v[0]); }
25 25
 
26 26
     void bindBuffer();
27 27
     void bindBuffer(int location, int size);

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

@@ -49,7 +49,8 @@ class Folder {
49 49
     void executeRemoveRecursiveFiles(std::function<bool (File& f)> func);
50 50
     std::string getRecursiveFileName(unsigned long i);
51 51
     File& getRecursiveFile(unsigned long i);
52
-    void findRecursiveFilesEndingWith(std::vector<File>& found, std::string end, bool casesensitive = false);
52
+    void findRecursiveFilesEndingWith(std::vector<File>& found, std::string end,
53
+                                      bool casesensitive = false);
53 54
 
54 55
   private:
55 56
     void createFolderItems();

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

@@ -89,7 +89,7 @@ void Console::display() {
89 89
         ImGui::Checkbox("Info##log", &visibleLogs[3]);
90 90
         ImGui::SameLine();
91 91
         ImGui::Checkbox("Debug##log", &visibleLogs[4]);
92
-        ImGui::SameLine();
92
+
93 93
         static bool logToTTY = false, logToClipboard = false, logToFile = false;
94 94
         if (ImGui::Button("Log to TTY")) { logToTTY = true; }
95 95
         ImGui::SameLine();

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

@@ -43,11 +43,11 @@ void Entity::move(char movement) {
43 43
 
44 44
 void Entity::print() {
45 45
     Log::get(LOG_INFO) << "Entity " << objectId << ":" << Log::endl
46
-             << "  Room " << room << " (" << getWorld().getRoom(room).getFlags()
47
-             << ")" << Log::endl
48
-             << "  " << pos[0] << "x " << pos[1] << "y " << pos[2] << "z"
49
-             << Log::endl
50
-             << "  " << glm::degrees(angles[1]) << " Yaw" << Log::endl;
46
+                       << "  Room " << room << " (" << getWorld().getRoom(room).getFlags()
47
+                       << ")" << Log::endl
48
+                       << "  " << pos[0] << "x " << pos[1] << "y " << pos[2] << "z"
49
+                       << Log::endl
50
+                       << "  " << glm::degrees(angles[1]) << " Yaw" << Log::endl;
51 51
 }
52 52
 
53 53
 SkeletalModel& Entity::getModel() {

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

@@ -59,7 +59,7 @@ int MenuFolder::init(Folder* folder, bool filter) {
59 59
             Loader::LoaderVersion version = Loader::checkFile(f.getPath());
60 60
             if (version == Loader::TR_UNKNOWN) {
61 61
                 Log::get(LOG_ERROR) << "Error: pak file '" << f.getName().c_str()
62
-                         << "' invalid" << Log::endl;
62
+                                    << "' invalid" << Log::endl;
63 63
                 return true; // delete file from list
64 64
             }
65 65
 
@@ -118,7 +118,7 @@ void MenuFolder::loadOrOpen() {
118 118
         }
119 119
     } else {
120 120
         int error = Game::loadLevel(mapFolder->getFile((unsigned long)mCursor
121
-                                        - 1 - mapFolder->folderCount()).getPath().c_str());
121
+                                    - 1 - mapFolder->folderCount()).getPath().c_str());
122 122
         if (error == 0) {
123 123
             visible = false;
124 124
         } else {

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

@@ -133,7 +133,7 @@ void Mesh::display(glm::mat4 MVP) {
133 133
 
134 134
         while ((indexStart != indexPos) && (indexPos < indicesBuff.size())) {
135 135
             while ((indexPos < indicesBuff.size())
136
-                    && (texturesBuff.at(indicesBuff.at(indexPos)) == texture)) {
136
+                   && (texturesBuff.at(indicesBuff.at(indexPos)) == texture)) {
137 137
                 indexPos++;
138 138
             }
139 139
 

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

@@ -16,7 +16,7 @@ bool Room::showBoundingBox = false;
16 16
 
17 17
 Room::Room(glm::vec3 _pos, BoundingBox* _bbox, RoomMesh* _mesh, unsigned int f,
18 18
            int a, int x, int z) : pos(_pos), bbox(_bbox), mesh(_mesh), flags(f),
19
-                                  alternateRoom(a), numXSectors(x), numZSectors(z) {
19
+    alternateRoom(a), numXSectors(x), numZSectors(z) {
20 20
     model = glm::translate(glm::mat4(1.0f), pos);
21 21
 }
22 22
 

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

@@ -77,7 +77,7 @@ void RoomMesh::display(glm::mat4 MVP) {
77 77
 
78 78
         while ((indexStart != indexPos) && (indexPos < indicesBuff.size())) {
79 79
             while ((indexPos < indicesBuff.size())
80
-                    && (texturesBuff.at(indicesBuff.at(indexPos)) == texture)) {
80
+                   && (texturesBuff.at(indicesBuff.at(indexPos)) == texture)) {
81 81
                 indexPos++;
82 82
             }
83 83
 

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

@@ -246,7 +246,7 @@ int TextureManager::loadImage(std::string filename, TextureStorage s, int slot)
246 246
         if (data) {
247 247
             if ((n < 3) || (n > 4)) {
248 248
                 Log::get(LOG_ERROR) << "Image \"" << filename << "\" has unsupported format ("
249
-                         << n << ")!" << Log::endl;
249
+                                    << n << ")!" << Log::endl;
250 250
                 stbi_image_free(data);
251 251
                 return -2;
252 252
             }

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

@@ -92,8 +92,8 @@ int UI::initialize() {
92 92
                                            (int)png_size, &tex_x, &tex_y, &tex_comp, 0);
93 93
 
94 94
     fontTex = TextureManager::loadBufferSlot((unsigned char*)tex_data,
95
-                                             tex_x, tex_y, ColorMode::RGBA, 32,
96
-                                             TextureStorage::SYSTEM, -1, false);
95
+              tex_x, tex_y, ColorMode::RGBA, 32,
96
+              TextureStorage::SYSTEM, -1, false);
97 97
 
98 98
     stbi_image_free(tex_data);
99 99
 
@@ -175,7 +175,7 @@ void UI::eventsFinished() {
175 175
             auto i = motionEvents.front();
176 176
             if (!getMenu().isVisible()) {
177 177
                 Game::handleMouseMotion(std::get<0>(i), std::get<1>(i),
178
-                                            std::get<2>(i), std::get<3>(i));
178
+                                        std::get<2>(i), std::get<3>(i));
179 179
             }
180 180
             motionEvents.pop_front();
181 181
         }
@@ -251,7 +251,7 @@ void UI::eventsFinished() {
251 251
 
252 252
 void UI::display() {
253 253
     if (RunTime::getShowFPS()) {
254
-        if (ImGui::Begin("Debug Overlay", nullptr, ImVec2(0,0), 0.3f,
254
+        if (ImGui::Begin("Debug Overlay", nullptr, ImVec2(0, 0), 0.3f,
255 255
                          ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize
256 256
                          | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings
257 257
                          | ImGuiWindowFlags_AlwaysAutoResize)) {

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

@@ -137,7 +137,8 @@ int CommandSet::execute(std::istream& args) {
137 137
         args >> temp;
138 138
         int error = Font::initialize(expandNames(temp));
139 139
         if (error != 0)
140
-            Log::get(LOG_USER) << "Error initializing font: " << expandNames(temp) << "(" << error << ")" << Log::endl;
140
+            Log::get(LOG_USER) << "Error initializing font: " << expandNames(temp) << "(" << error << ")" <<
141
+                               Log::endl;
141 142
     } else {
142 143
         Log::get(LOG_USER) << "set-Error: Unknown variable (" << var.c_str() << ")" << Log::endl;
143 144
         return -1;

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

@@ -156,7 +156,7 @@ void LoaderTR2::loadAnimatedTextures() {
156 156
         int count = animatedTextures.at(pos) + 1;
157 157
         if ((pos + count) >= numWords) {
158 158
             Log::get(LOG_DEBUG) << "LoaderTR2: Invalid AnimatedTextures ("
159
-                     << pos + count << " >= " << numWords << ")!" << Log::endl;
159
+                                << pos + count << " >= " << numWords << ")!" << Log::endl;
160 160
             return;
161 161
         }
162 162
 
@@ -168,7 +168,8 @@ void LoaderTR2::loadAnimatedTextures() {
168 168
     }
169 169
 
170 170
     if ((numAnimatedTextures > 0) || (numWords > 0))
171
-        Log::get(LOG_INFO) << "LoaderTR2: Found " << numAnimatedTextures << " Animated Textures!" << Log::endl;
171
+        Log::get(LOG_INFO) << "LoaderTR2: Found " << numAnimatedTextures << " Animated Textures!" <<
172
+                           Log::endl;
172 173
     else
173 174
         Log::get(LOG_INFO) << "LoaderTR2: No Animated Textures in this level?!" << Log::endl;
174 175
 
@@ -407,8 +408,8 @@ void LoaderTR2::loadRooms() {
407 408
         if ((numPortals == 0) && (numVertices == 0)
408 409
             && (numRectangles == 0) && (numTriangles == 0))
409 410
             Log::get(LOG_DEBUG) << "LoaderTR2: Room " << i << " seems invalid: " << numPortals << "p "
410
-                     << numRectangles << "r " << numTriangles << "t " << numVertices
411
-                     << "v" << Log::endl;
411
+                                << numRectangles << "r " << numTriangles << "t " << numVertices
412
+                                << "v" << Log::endl;
412 413
     }
413 414
 
414 415
     if (numRooms > 0)
@@ -426,7 +427,8 @@ void LoaderTR2::loadFloorData() {
426 427
     }
427 428
 
428 429
     if (numFloorData > 0)
429
-        Log::get(LOG_INFO) << "LoaderTR2: Found " << numFloorData << " words FloorData, unimplemented!" << Log::endl;
430
+        Log::get(LOG_INFO) << "LoaderTR2: Found " << numFloorData << " words FloorData, unimplemented!" <<
431
+                           Log::endl;
430 432
     else
431 433
         Log::get(LOG_INFO) << "LoaderTR2: No FloorData in this level?!" << Log::endl;
432 434
 }
@@ -468,8 +470,9 @@ void LoaderTR2::loadSprites() {
468 470
     }
469 471
 
470 472
     if ((numSpriteTextures > 0) || (numSpriteSequences > 0))
471
-        Log::get(LOG_INFO) << "LoaderTR2: Found " << numSpriteTextures << " Sprites in " << numSpriteSequences <<
472
-                 " Sequences!" << Log::endl;
473
+        Log::get(LOG_INFO) << "LoaderTR2: Found " << numSpriteTextures << " Sprites in " <<
474
+                           numSpriteSequences <<
475
+                           " Sequences!" << Log::endl;
473 476
     else
474 477
         Log::get(LOG_INFO) << "LoaderTR2: No Sprites in this level?!" << Log::endl;
475 478
 }
@@ -494,7 +497,7 @@ void LoaderTR2::loadMeshes() {
494 497
 
495 498
         if (numMeshData < (meshPointer / 2)) {
496 499
             Log::get(LOG_DEBUG) << "LoaderTR2: Invalid Mesh: "
497
-                     << (meshPointer / 2) << " > " << numMeshData << Log::endl;
500
+                                << (meshPointer / 2) << " > " << numMeshData << Log::endl;
498 501
             continue;
499 502
         }
500 503
 
@@ -742,7 +745,8 @@ void LoaderTR2::loadMoveables() {
742 745
     }
743 746
 
744 747
     if (numAnimDispatches > 0)
745
-        Log::get(LOG_INFO) << "LoaderTR2: Found " << numAnimDispatches << " AnimationDispatches!" << Log::endl;
748
+        Log::get(LOG_INFO) << "LoaderTR2: Found " << numAnimDispatches << " AnimationDispatches!" <<
749
+                           Log::endl;
746 750
     else
747 751
         Log::get(LOG_INFO) << "LoaderTR2: No AnimationDispatches in this level?!" << Log::endl;
748 752
 
@@ -998,7 +1002,7 @@ void LoaderTR2::loadBoxesOverlapsZones() {
998 1002
 
999 1003
     if ((numBoxes > 0) || (numOverlaps > 0))
1000 1004
         Log::get(LOG_INFO) << "LoaderTR2: Found NPC NavigationHints (" << numBoxes
1001
-                 << ", " << numOverlaps << ", " << list << "), unimplemented!" << Log::endl;
1005
+                           << ", " << numOverlaps << ", " << list << "), unimplemented!" << Log::endl;
1002 1006
     else
1003 1007
         Log::get(LOG_INFO) << "LoaderTR2: No NPC NavigationHints in this level?!" << Log::endl;
1004 1008
 }
@@ -1092,7 +1096,7 @@ void LoaderTR2::loadExternalSoundFile(std::string f) {
1092 1096
 
1093 1097
         if (std::string("RIFF") != std::string(test)) {
1094 1098
             Log::get(LOG_DEBUG) << "LoaderTR2: External SFX invalid! (" << riffCount
1095
-                     << ", \"" << test << "\" != \"RIFF\")" << Log::endl;
1099
+                                << ", \"" << test << "\" != \"RIFF\")" << Log::endl;
1096 1100
             return;
1097 1101
         }
1098 1102
 
@@ -1152,7 +1156,7 @@ void LoaderTR2::loadCinematicFrames() {
1152 1156
 
1153 1157
     if (numCinematicFrames > 0)
1154 1158
         Log::get(LOG_INFO) << "LoaderTR2: Found " << numCinematicFrames
1155
-                 << " CinematicFrames, unimplemented!" << Log::endl;
1159
+                           << " CinematicFrames, unimplemented!" << Log::endl;
1156 1160
 }
1157 1161
 
1158 1162
 void LoaderTR2::loadDemoData() {
@@ -1163,6 +1167,6 @@ void LoaderTR2::loadDemoData() {
1163 1167
     // TODO store demo data somewhere, find out meaning
1164 1168
     if (numDemoData > 0)
1165 1169
         Log::get(LOG_INFO) << "LoaderTR2: Found " << numDemoData << " bytes DemoData, unimplemented!" <<
1166
-                 Log::endl;
1170
+                           Log::endl;
1167 1171
 }
1168 1172
 

+ 2
- 2
src/system/FontTRLE.cpp Wyświetl plik

@@ -47,8 +47,8 @@ int FontTRLE::initialize(std::string font) {
47 47
     }
48 48
 
49 49
     mFontTexture = TextureManager::loadBufferSlot(pixels, 256, 256,
50
-                                                  ColorMode::BGRA, 32,
51
-                                                  TextureStorage::SYSTEM);
50
+                   ColorMode::BGRA, 32,
51
+                   TextureStorage::SYSTEM);
52 52
     delete [] pixels;
53 53
 
54 54
     // Try to load .lps file or use default glyph positions

+ 4
- 4
src/system/FontTTF.cpp Wyświetl plik

@@ -67,7 +67,7 @@ int FontMapTTF::initialize(unsigned char* fontData, int firstChar) {
67 67
     delete [] pixels;
68 68
 
69 69
     texture = TextureManager::loadBufferSlot(rgb, MAP_WIDTH, MAP_HEIGHT, ColorMode::RGBA,
70
-                                             32, TextureStorage::SYSTEM, texture);
70
+              32, TextureStorage::SYSTEM, texture);
71 71
     delete [] rgb;
72 72
     if (texture < 0) {
73 73
         delete [] charInfo;
@@ -85,7 +85,7 @@ bool FontMapTTF::contains(int c) {
85 85
     return (begin >= 0) && (c >= begin) && (c < (begin + MAP_NUM_CHARS));
86 86
 }
87 87
 
88
-void FontMapTTF::getQuad(int c, float* xpos, float* ypos, stbtt_aligned_quad *quad) {
88
+void FontMapTTF::getQuad(int c, float* xpos, float* ypos, stbtt_aligned_quad* quad) {
89 89
     assert(contains(c));
90 90
     stbtt_GetPackedQuad(charInfo, MAP_WIDTH, MAP_HEIGHT, c - begin, xpos, ypos, quad, 0);
91 91
 }
@@ -255,7 +255,7 @@ int FontTTF::charIsMapped(int c) {
255 255
         begin -= (MAP_NUM_CHARS / 2);
256 256
 
257 257
     Log::get(LOG_INFO) << "Unmapped character '" << char(c) << "', new map from " << begin << " to "
258
-             << begin + MAP_NUM_CHARS - 1 << "..." << Log::endl;
258
+                       << begin + MAP_NUM_CHARS - 1 << "..." << Log::endl;
259 259
 
260 260
     int p = maps.size();
261 261
     maps.emplace_back();
@@ -266,7 +266,7 @@ int FontTTF::charIsMapped(int c) {
266 266
     return p;
267 267
 }
268 268
 
269
-int FontTTF::getQuad(int c, float* xpos, float* ypos, stbtt_aligned_quad *quad) {
269
+int FontTTF::getQuad(int c, float* xpos, float* ypos, stbtt_aligned_quad* quad) {
270 270
     if (c < 0) {
271 271
         //! \todo This has nothing to do with proper UTF8 support...
272 272
         c += 128;

+ 3
- 3
src/system/WindowSDL.cpp Wyświetl plik

@@ -74,15 +74,15 @@ int WindowSDL::initialize() {
74 74
             controller = SDL_GameControllerOpen(i);
75 75
             if (controller) {
76 76
                 Log::get(LOG_INFO) << "Using controller \"" << SDL_GameControllerName(controller)
77
-                         << "\"..." << Log::endl;
77
+                                   << "\"..." << Log::endl;
78 78
                 break;
79 79
             } else {
80 80
                 Log::get(LOG_WARNING) << "Couldn't open controller \"" << SDL_GameControllerNameForIndex(i)
81
-                         << "\"!" << Log::endl;
81
+                                      << "\"!" << Log::endl;
82 82
             }
83 83
         } else {
84 84
             Log::get(LOG_WARNING) << "Joystick \"" << SDL_JoystickNameForIndex(i)
85
-                     << "\" is no compatible controller!" << Log::endl;
85
+                                  << "\" is no compatible controller!" << Log::endl;
86 86
         }
87 87
     }
88 88
 

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

@@ -63,7 +63,8 @@ File& Folder::getRecursiveFile(unsigned long i) {
63 63
     return files.at(0);
64 64
 }
65 65
 
66
-void Folder::findRecursiveFilesEndingWith(std::vector<File>& found, std::string end, bool casesensitive) {
66
+void Folder::findRecursiveFilesEndingWith(std::vector<File>& found, std::string end,
67
+        bool casesensitive) {
67 68
     createFolderItems();
68 69
     for (unsigned long i = 0; i < countRecursiveFiles(); i++) {
69 70
         if (stringEndsWith(getRecursiveFile(i).getName(), end, casesensitive)) {

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

@@ -31,7 +31,8 @@ int pcxCheck(const char* filename) {
31 31
     }
32 32
 
33 33
     if (header[0] != 0x0A) {
34
-        Log::get(LOG_ERROR) << "Magic number at file start is wrong (" << header[0] << " != 0x0A)" << Log::endl;
34
+        Log::get(LOG_ERROR) << "Magic number at file start is wrong (" << header[0] << " != 0x0A)" <<
35
+                            Log::endl;
35 36
         delete [] header;
36 37
         return -2;
37 38
     }
@@ -89,7 +90,8 @@ int pcxLoad(const char* filename, unsigned char** image,
89 90
     }
90 91
 
91 92
     if (header[0] != 0x0A) {
92
-        Log::get(LOG_ERROR) << "Magic number at file start is wrong (" << header[0] << " != 0x0A)" << Log::endl;
93
+        Log::get(LOG_ERROR) << "Magic number at file start is wrong (" << header[0] << " != 0x0A)" <<
94
+                            Log::endl;
93 95
         delete [] header;
94 96
         return -2;
95 97
     }

Ładowanie…
Anuluj
Zapisz