Browse Source

Split Log class from Console

Thomas Buck 9 years ago
parent
commit
f00fb80309

+ 1
- 0
ChangeLog.md View File

@@ -7,6 +7,7 @@
7 7
     * World now using smart pointers
8 8
     * Removed atexit handler, now breaking out of main loop on quit
9 9
     * Added calculate and shutdown calls to UI interface, properly shutting down imgui
10
+    * Created Log class holding logging infos, used by others instead of Console.
10 11
 
11 12
     [ 20140903 ]
12 13
     * Finishing imgui integration, but now as UI layer and not on top of everything

+ 0
- 1
TODO.md View File

@@ -9,7 +9,6 @@
9 9
 * Add verbose command line flag for debug output also in release builds
10 10
 * Don’t depend on setup: no data or config files should be necessary
11 11
 * Be able to change configuration from within OpenRaider
12
-* Put log functionality outside of Console
13 12
 
14 13
 ## Bugs
15 14
 

+ 0
- 19
include/Console.h View File

@@ -9,7 +9,6 @@
9 9
 #define _CONSOLE_H_
10 10
 
11 11
 #include <string>
12
-#include <sstream>
13 12
 #include <vector>
14 13
 
15 14
 #include "UI.h"
@@ -23,19 +22,6 @@ public:
23 22
     Console();
24 23
     ~Console();
25 24
 
26
-    template<typename T>
27
-    Console &operator<<(const T t) {
28
-        printBuffer << t;
29
-        if (printBuffer.str().back() == '\n') {
30
-            mHistory.push_back(printBuffer.str().substr(0, printBuffer.str().length() - 1));
31
-#ifdef DEBUG
32
-            std::cout << printBuffer.str().substr(0, printBuffer.str().length() - 1) << std::endl;
33
-#endif
34
-            printBuffer.str("");
35
-        }
36
-        return (*this);
37
-    }
38
-
39 25
     virtual void moveToTop();
40 26
     virtual void makeInvisible();
41 27
     virtual void display();
@@ -43,23 +29,18 @@ public:
43 29
     virtual void handleText(char *text, bool notFinished);
44 30
     virtual void handleMouseScroll(int xrel, int yrel);
45 31
 
46
-    const static char endl = '\n';
47
-
48 32
 private:
49 33
 
50 34
     void moveInHistory(bool up);
51 35
 
52 36
     std::string mInputBuffer;
53 37
     std::string mPartialInput;
54
-    std::vector<std::string> mHistory;
55 38
 
56 39
     size_t mHistoryPointer;
57 40
     std::vector<std::string> mCommandHistory;
58 41
     std::string mUnfinishedInput;
59 42
 
60 43
     unsigned int mLineOffset;
61
-
62
-    std::ostringstream printBuffer;
63 44
 };
64 45
 
65 46
 Console &getConsole();

+ 45
- 0
include/Log.h View File

@@ -0,0 +1,45 @@
1
+/*!
2
+ * \file include/Log.h
3
+ * \brief Log
4
+ *
5
+ * \author xythobuz
6
+ */
7
+
8
+#ifndef _LOG_H_
9
+#define _LOG_H_
10
+
11
+#include <string>
12
+#include <sstream>
13
+#include <vector>
14
+
15
+class Log {
16
+public:
17
+
18
+    const static char endl = '\n';
19
+
20
+    ~Log();
21
+
22
+    unsigned long size();
23
+    std::string get(unsigned long i);
24
+
25
+    template<typename T>
26
+    Log& operator<< (const T t) {
27
+        printBuffer << t;
28
+        if (printBuffer.str().back() == endl) {
29
+            mHistory.push_back(printBuffer.str().substr(0, printBuffer.str().length() - 1));
30
+#ifdef DEBUG
31
+            std::cout << printBuffer.str().substr(0, printBuffer.str().length() - 1) << std::endl;
32
+#endif
33
+            printBuffer.str("");
34
+        }
35
+        return (*this);
36
+    }
37
+
38
+private:
39
+    std::vector<std::string> mHistory;
40
+    std::ostringstream printBuffer;
41
+};
42
+
43
+Log &getLog();
44
+
45
+#endif

+ 1
- 0
src/CMakeLists.txt View File

@@ -56,6 +56,7 @@ set (SRCS ${SRCS} "Font.cpp")
56 56
 set (SRCS ${SRCS} "FontManager.cpp")
57 57
 set (SRCS ${SRCS} "FontTRLE.cpp")
58 58
 set (SRCS ${SRCS} "Game.cpp")
59
+set (SRCS ${SRCS} "Log.cpp")
59 60
 set (SRCS ${SRCS} "main.cpp")
60 61
 set (SRCS ${SRCS} "Menu.cpp")
61 62
 set (SRCS ${SRCS} "MenuFolder.cpp")

+ 14
- 13
src/Console.cpp View File

@@ -10,6 +10,7 @@
10 10
 #include "global.h"
11 11
 #include "commands/Command.h"
12 12
 #include "Font.h"
13
+#include "Log.h"
13 14
 #include "utf8-cpp/utf8.h"
14 15
 #include "utils/strings.h"
15 16
 #include "utils/time.h"
@@ -64,8 +65,8 @@ void Console::display() {
64 65
     glEnable(GL_TEXTURE_2D);
65 66
 
66 67
     unsigned long scrollIndicator;
67
-    if (mHistory.size() > lineCount) {
68
-        scrollIndicator = (mHistory.size() - lineCount - mLineOffset) * 100 / (mHistory.size() - lineCount);
68
+    if (getLog().size() > lineCount) {
69
+        scrollIndicator = (getLog().size() - lineCount - mLineOffset) * 100 / (getLog().size() - lineCount);
69 70
     } else {
70 71
         scrollIndicator = 100;
71 72
         mLineOffset = 0;
@@ -80,16 +81,16 @@ void Console::display() {
80 81
     long end = lineCount;
81 82
     long drawOffset = 0;
82 83
     long historyOffset = 0;
83
-    if (mHistory.size() < lineCount) {
84
-        end = mHistory.size();
85
-        drawOffset = lineCount - mHistory.size();
86
-    } else if (lineCount < mHistory.size()) {
87
-        historyOffset = mHistory.size() - lineCount;
84
+    if (getLog().size() < lineCount) {
85
+        end = getLog().size();
86
+        drawOffset = lineCount - getLog().size();
87
+    } else if (lineCount < getLog().size()) {
88
+        historyOffset = getLog().size() - lineCount;
88 89
     }
89 90
 
90 91
     for (int i = 0; i < end; i++) {
91 92
         getFont().drawText(10, (unsigned int)((i + drawOffset) * lineSteps) + firstLine,
92
-                0.75f, BLUE, mHistory.at(i + historyOffset - mLineOffset));
93
+                0.75f, BLUE, getLog().get(i + historyOffset - mLineOffset));
93 94
     }
94 95
 
95 96
     // Draw current input
@@ -102,14 +103,14 @@ void Console::handleKeyboard(KeyboardButton key, bool pressed) {
102 103
     if (pressed && (key == enterKey)) {
103 104
         // Execute entered command
104 105
         if (mInputBuffer.length() > 0) {
105
-            (*this) << "> " << mInputBuffer.c_str() << endl;
106
+            getLog() << "> " << mInputBuffer.c_str() << Log::endl;
106 107
             mCommandHistory.push_back(mInputBuffer.c_str());
107 108
             int error = Command::command(mInputBuffer);
108 109
             if (error != 0) {
109
-                (*this) << "Error Code: " << error << endl;
110
+                getLog() << "Error Code: " << error << Log::endl;
110 111
             }
111 112
         } else {
112
-            (*this) << "> " << endl;
113
+            getLog() << "> " << Log::endl;
113 114
         }
114 115
 
115 116
         // Clear partial and input buffer
@@ -200,9 +201,9 @@ void Console::handleMouseScroll(int xrel, int yrel) {
200 201
         lineCount = (lastLine - firstLine + lineSteps) / lineSteps;
201 202
     }
202 203
 
203
-    if (mHistory.size() > lineCount) {
204
+    if (getLog().size() > lineCount) {
204 205
         if (yrel > 0) {
205
-            if (mLineOffset < (mHistory.size() - lineCount)) {
206
+            if (mLineOffset < (getLog().size() - lineCount)) {
206 207
                 mLineOffset++;
207 208
             }
208 209
         } else if (yrel < 0) {

+ 7
- 7
src/Entity.cpp View File

@@ -8,10 +8,10 @@
8 8
 #include <cmath>
9 9
 
10 10
 #include "global.h"
11
-#include "Console.h"
12
-#include "Entity.h"
11
+#include "Log.h"
13 12
 #include "Render.h"
14 13
 #include "World.h"
14
+#include "Entity.h"
15 15
 
16 16
 #include "games/TombRaider1.h"
17 17
 
@@ -117,7 +117,7 @@ void Entity::move(char movement) {
117 117
                 x, y, z);
118 118
 
119 119
         if (roomNew > -1)
120
-            getConsole() << "Crossing from room " << room << " to " << roomNew << Console::endl;
120
+            getLog() << "Crossing from room " << room << " to " << roomNew << Log::endl;
121 121
         else
122 122
             //! \fixme mRooms, sectors, ... are now std::vector, but often upper bound checks are missing
123 123
             return;
@@ -213,12 +213,12 @@ void Entity::move(char movement) {
213 213
 }
214 214
 
215 215
 void Entity::print() {
216
-    getConsole() << "Entity " << objectId << ":" << Console::endl
216
+    getLog() << "Entity " << objectId << ":" << Log::endl
217 217
         << "  Room " << room << " (" << getWorld().getRoom(room).getFlags()
218
-        << ")" << Console::endl
218
+        << ")" << Log::endl
219 219
         << "  " << pos[0] << "x " << pos[1] << "y " << pos[2] << "z"
220
-        << Console::endl
221
-        << "  " << OR_RAD_TO_DEG(angles[1]) << " Yaw" << Console::endl;
220
+        << Log::endl
221
+        << "  " << OR_RAD_TO_DEG(angles[1]) << " Yaw" << Log::endl;
222 222
 }
223 223
 
224 224
 SkeletalModel &Entity::getModel() {

+ 11
- 11
src/Game.cpp View File

@@ -12,9 +12,9 @@
12 12
 
13 13
 #include "global.h"
14 14
 #include "Camera.h"
15
-#include "Console.h"
16 15
 #include "Game.h"
17 16
 #include "loader/Loader.h"
17
+#include "Log.h"
18 18
 #include "Render.h"
19 19
 #include "Sound.h"
20 20
 #include "StaticMesh.h"
@@ -83,7 +83,7 @@ int Game::loadLevel(const char *level) {
83 83
 
84 84
     levelName = level;
85 85
 
86
-    getConsole() << "Loading " << levelName << Console::endl;
86
+    getLog() << "Loading " << levelName << Log::endl;
87 87
 
88 88
     int error = 0;
89 89
     auto loader = Loader::createLoader(level);
@@ -96,7 +96,7 @@ int Game::loadLevel(const char *level) {
96 96
 
97 97
         // And now...?
98 98
 
99
-        getConsole() << "Tried Loader..." << Console::endl;
99
+        getLog() << "Tried Loader..." << Log::endl;
100 100
     }
101 101
 
102 102
     if ((!loader) || (error == 0)) {
@@ -113,7 +113,7 @@ int Game::loadLevel(const char *level) {
113 113
             tmp += "MAIN.SFX";
114 114
             error = mTombRaider.loadSFX(tmp.c_str());
115 115
             if (error != 0)
116
-                getConsole() << "Could not load " << tmp << Console::endl;
116
+                getLog() << "Could not load " << tmp << Log::endl;
117 117
         }
118 118
 
119 119
         // Process data
@@ -128,7 +128,7 @@ int Game::loadLevel(const char *level) {
128 128
 
129 129
         if (mLara == -1) {
130 130
             //! \todo Cutscene support
131
-            getConsole() << "Can't find Lara entity in level pak!" << Console::endl;
131
+            getLog() << "Can't find Lara entity in level pak!" << Log::endl;
132 132
             destroy();
133 133
             return -1;
134 134
         } else {
@@ -204,21 +204,21 @@ void Game::processSprites() {
204 204
         }
205 205
     }
206 206
 
207
-    getConsole() << "Found " << mTombRaider.NumSpriteSequences() << " sprites." << Console::endl;
207
+    getLog() << "Found " << mTombRaider.NumSpriteSequences() << " sprites." << Log::endl;
208 208
 }
209 209
 
210 210
 void Game::processRooms() {
211 211
     for (int index = 0; index < mTombRaider.NumRooms(); index++)
212 212
         getWorld().addRoom(*new Room(mTombRaider, index));
213 213
 
214
-    getConsole() << "Found " << mTombRaider.NumRooms() << " rooms." << Console::endl;
214
+    getLog() << "Found " << mTombRaider.NumRooms() << " rooms." << Log::endl;
215 215
 }
216 216
 
217 217
 void Game::processModels() {
218 218
     for (int index = 0; index < mTombRaider.getMeshCount(); index++)
219 219
         getWorld().addStaticMesh(*new StaticMesh(mTombRaider, index));
220 220
 
221
-    getConsole() << "Found " << mTombRaider.getMeshCount() << " meshes." << Console::endl;
221
+    getLog() << "Found " << mTombRaider.getMeshCount() << " meshes." << Log::endl;
222 222
 }
223 223
 
224 224
 void Game::processPakSounds()
@@ -260,7 +260,7 @@ void Game::processPakSounds()
260 260
         //getSound().SourceAt(id, pos);
261 261
     }
262 262
 
263
-    getConsole() << "Found " << mTombRaider.getSoundSamplesCount() << " sound samples." << Console::endl;
263
+    getLog() << "Found " << mTombRaider.getSoundSamplesCount() << " sound samples." << Log::endl;
264 264
 }
265 265
 
266 266
 void Game::processTextures()
@@ -304,7 +304,7 @@ void Game::processTextures()
304 304
 
305 305
     mTextureOffset = (mTextureStart - 1) + mTombRaider.NumTextures();
306 306
 
307
-    getConsole() << "Found " << mTombRaider.NumTextures() << " textures." << Console::endl;
307
+    getLog() << "Found " << mTombRaider.NumTextures() << " textures." << Log::endl;
308 308
 }
309 309
 
310 310
 void Game::processMoveables()
@@ -389,7 +389,7 @@ void Game::processMoveables()
389 389
     }
390 390
     */
391 391
 
392
-    getConsole() << "Found " << mTombRaider.NumMoveables() + statCount << " moveables." << Console::endl;
392
+    getLog() << "Found " << mTombRaider.NumMoveables() + statCount << " moveables." << Log::endl;
393 393
 }
394 394
 
395 395
 // index moveable, i item, sometimes both moveable

+ 22
- 0
src/Log.cpp View File

@@ -0,0 +1,22 @@
1
+/*!
2
+ * \file src/Log.cpp
3
+ * \brief Log
4
+ *
5
+ * \author xythobuz
6
+ */
7
+
8
+#include "global.h"
9
+#include "Log.h"
10
+
11
+Log::~Log() {
12
+}
13
+
14
+unsigned long Log::size() {
15
+    return mHistory.size();
16
+}
17
+
18
+std::string Log::get(unsigned long i) {
19
+    assert(i < mHistory.size());
20
+    return mHistory.at(i);
21
+}
22
+

+ 2
- 2
src/Menu.cpp View File

@@ -6,8 +6,8 @@
6 6
  */
7 7
 
8 8
 #include "global.h"
9
-#include "Console.h"
10 9
 #include "Font.h"
10
+#include "Log.h"
11 11
 #include "Window.h"
12 12
 #include "Menu.h"
13 13
 #include "MenuFolder.h"
@@ -28,7 +28,7 @@ void Menu::showDialog(std::string msg, std::string btn1, std::string btn2,
28 28
     dialogState = false;
29 29
     dialogFunction = callback;
30 30
 
31
-    getConsole() << dialogText << Console::endl;
31
+    getLog() << dialogText << Log::endl;
32 32
 }
33 33
 
34 34
 void Menu::ackDialog() {

+ 3
- 3
src/MenuFolder.cpp View File

@@ -6,10 +6,10 @@
6 6
  */
7 7
 
8 8
 #include "global.h"
9
-#include "Console.h"
10 9
 #include "Font.h"
11 10
 #include "Game.h"
12 11
 #include "loader/Loader.h"
12
+#include "Log.h"
13 13
 #include "RunTime.h"
14 14
 #include "Window.h"
15 15
 #include "MenuFolder.h"
@@ -61,8 +61,8 @@ int MenuFolder::init(Folder *folder, bool filter) {
61 61
             // Check maps for validity
62 62
             Loader::LoaderVersion version = Loader::checkFile(f.getPath());
63 63
             if (version == Loader::TR_UNKNOWN) {
64
-                getConsole() << "Error: pak file '" << f.getName().c_str()
65
-                    << "' invalid" << Console::endl;
64
+                getLog() << "Error: pak file '" << f.getName().c_str()
65
+                    << "' invalid" << Log::endl;
66 66
                 return true; // delete file from list
67 67
             }
68 68
 

+ 6
- 6
src/Room.cpp View File

@@ -8,8 +8,8 @@
8 8
 #include <algorithm>
9 9
 
10 10
 #include "global.h"
11
-#include "Console.h"
12 11
 #include "Game.h"
12
+#include "Log.h"
13 13
 #include "Render.h"
14 14
 #include "Room.h"
15 15
 #include "TextureManager.h"
@@ -24,7 +24,7 @@ Room::Room(TombRaider &tr, unsigned int index) {
24 24
     Matrix transform;
25 25
 
26 26
     if (!tr.isRoomValid(index)) {
27
-        getConsole() << "WARNING: Handling invalid vertex array in room" << Console::endl;
27
+        getLog() << "WARNING: Handling invalid vertex array in room" << Log::endl;
28 28
         return;
29 29
     }
30 30
 
@@ -168,8 +168,8 @@ Room::Room(TombRaider &tr, unsigned int index) {
168 168
 
169 169
         if (texture > (int)TextureLimit)
170 170
         {
171
-            getConsole() << "Handling bad room[" << index << "].tris["
172
-                << t << "].texture = " << texture << Console::endl;
171
+            getLog() << "Handling bad room[" << index << "].tris["
172
+                << t << "].texture = " << texture << Log::endl;
173 173
             texture = TextureLimit - 1;
174 174
         }
175 175
 
@@ -202,8 +202,8 @@ Room::Room(TombRaider &tr, unsigned int index) {
202 202
 
203 203
         if (texture > (int)TextureLimit)
204 204
         {
205
-            getConsole() << "Handling bad room[" << index << "].quad["
206
-                << r << "].texture = " << texture << Console::endl;
205
+            getLog() << "Handling bad room[" << index << "].quad["
206
+                << r << "].texture = " << texture << Log::endl;
207 207
             texture = TextureLimit - 1;
208 208
         }
209 209
 

+ 6
- 6
src/SkeletalModel.cpp View File

@@ -7,7 +7,7 @@
7 7
  */
8 8
 
9 9
 #include "global.h"
10
-#include "Console.h"
10
+#include "Log.h"
11 11
 #include "Render.h"
12 12
 #include "SkeletalModel.h"
13 13
 #include "World.h"
@@ -137,9 +137,9 @@ AnimationFrame::AnimationFrame(TombRaider &tr, unsigned int index, int a, unsign
137 137
         }
138 138
 
139 139
         if (*frame_offset > tr.NumFrames()) {
140
-            getConsole() << "WARNING: Bad animation frame " << *frame_offset
140
+            getLog() << "WARNING: Bad animation frame " << *frame_offset
141 141
                 << " > " << tr.NumFrames() << " (" << index << "." << a << ")"
142
-                << Console::endl;
142
+                << Log::endl;
143 143
             return;
144 144
         }
145 145
 
@@ -201,7 +201,7 @@ SkeletalModel::SkeletalModel(TombRaider &tr, unsigned int index, int objectId) {
201 201
                 }
202 202
 
203 203
                 getRender().setFlags(Render::fRenderPonytail);
204
-                getConsole() << "Found known ponytail" << Console::endl;
204
+                getLog() << "Found known ponytail" << Log::endl;
205 205
             }
206 206
             break;
207 207
 
@@ -223,7 +223,7 @@ SkeletalModel::SkeletalModel(TombRaider &tr, unsigned int index, int objectId) {
223 223
                 ponyOff2 = 0;
224 224
 
225 225
                 getRender().setFlags(Render::fRenderPonytail);
226
-                getConsole() << "Found ponytail?" << Console::endl;
226
+                getLog() << "Found ponytail?" << Log::endl;
227 227
             }
228 228
             break;
229 229
     }
@@ -247,7 +247,7 @@ SkeletalModel::SkeletalModel(TombRaider &tr, unsigned int index, int objectId) {
247 247
         frame_offset += frame_step * (frame_cycle % a);
248 248
 
249 249
     if (a < 0) {
250
-        getConsole() << "Invalid animation data for model " << index << ". Skip!" << Console::endl;
250
+        getLog() << "Invalid animation data for model " << index << ". Skip!" << Log::endl;
251 251
         return;
252 252
     } else {
253 253
         for (; a < tr.getNumAnimsForMoveable(index); a++) {

+ 3
- 3
src/TextureManager.cpp View File

@@ -12,7 +12,7 @@
12 12
 #include <stdarg.h>
13 13
 
14 14
 #include "global.h"
15
-#include "Console.h"
15
+#include "Log.h"
16 16
 #include "RunTime.h"
17 17
 #include "utils/pcx.h"
18 18
 #include "utils/pixel.h"
@@ -200,7 +200,7 @@ int TextureManager::loadImage(const char *filename) {
200 200
     } else if (stringEndsWith(filename, ".tga") || stringEndsWith(filename, ".TGA")) {
201 201
         return loadTGA(filename);
202 202
     } else {
203
-        getConsole() << "No known image file type? (" << filename << ")" << Console::endl;
203
+        getLog() << "No known image file type? (" << filename << ")" << Log::endl;
204 204
     }
205 205
 
206 206
     return -1;
@@ -256,7 +256,7 @@ int TextureManager::loadPNG(const char *filename) {
256 256
 
257 257
     return id;
258 258
 #else
259
-    getConsole() << "No PNG support available (" << filename << ")" << Console::endl;
259
+    getLog() << "No PNG support available (" << filename << ")" << Log::endl;
260 260
     return -1;
261 261
 #endif
262 262
 }

+ 1
- 3
src/UI.cpp View File

@@ -84,9 +84,7 @@ void UI::passKeyboard(KeyboardButton key, bool pressed) {
84 84
                 getConsole().moveToTop();
85 85
             }
86 86
         } else if (getRunTime().getKeyBinding(debugAction) == key) {
87
-            if (getDebug().isOnTop()) {
88
-                getDebug().makeInvisible();
89
-            } else {
87
+            if (!getDebug().isOnTop()) {
90 88
                 getDebug().moveToTop();
91 89
             }
92 90
         }

+ 14
- 14
src/commands/Command.cpp View File

@@ -9,7 +9,7 @@
9 9
 #include <iomanip>
10 10
 
11 11
 #include "global.h"
12
-#include "Console.h"
12
+#include "Log.h"
13 13
 #include "utils/strings.h"
14 14
 #include "commands/Command.h"
15 15
 #include "commands/CommandAnimate.h"
@@ -27,7 +27,7 @@ Command::~Command() {
27 27
 }
28 28
 
29 29
 void Command::printHelp() {
30
-    getConsole() << "No help available!" << Console::endl;
30
+    getLog() << "No help available!" << Log::endl;
31 31
 }
32 32
 
33 33
 void Command::fillCommandList() {
@@ -71,17 +71,17 @@ int Command::command(std::string c) {
71 71
         command >> arg;
72 72
         if (arg.length() == 0) {
73 73
             // List all available commands
74
-            getConsole() << "Available commands:" << Console::endl;
75
-            getConsole() << std::right << std::setw(11);
76
-            getConsole() << "help" << " - print command help" << Console::endl;
74
+            getLog() << "Available commands:" << Log::endl;
75
+            getLog() << std::right << std::setw(11);
76
+            getLog() << "help" << " - print command help" << Log::endl;
77 77
             for (auto &x : commands) {
78 78
                 if (x) {
79
-                    getConsole() << std::right << std::setw(11);
80
-                    getConsole() << x->name() << " - " << x->brief() << Console::endl;
79
+                    getLog() << std::right << std::setw(11);
80
+                    getLog() << x->name() << " - " << x->brief() << Log::endl;
81 81
                 }
82 82
             }
83
-            getConsole() << "Use help COMMAND to get additional info" << Console::endl;
84
-            getConsole() << "Pass BOOLs as true or false" << Console::endl;
83
+            getLog() << "Use help COMMAND to get additional info" << Log::endl;
84
+            getLog() << "Pass BOOLs as true or false" << Log::endl;
85 85
             return 0;
86 86
         } else {
87 87
             // Show help for a specific command
@@ -93,7 +93,7 @@ int Command::command(std::string c) {
93 93
                     }
94 94
                 }
95 95
             }
96
-            getConsole() << "Unknown command: \"" << arg << "\"" << Console::endl;
96
+            getLog() << "Unknown command: \"" << arg << "\"" << Log::endl;
97 97
             return -1;
98 98
         }
99 99
     }
@@ -107,17 +107,17 @@ int Command::command(std::string c) {
107 107
         }
108 108
     }
109 109
 
110
-    getConsole() << "Unknown command: \"" << cmd << "\"" << Console::endl;
110
+    getLog() << "Unknown command: \"" << cmd << "\"" << Log::endl;
111 111
     return -1;
112 112
 }
113 113
 
114 114
 int Command::executeFile(std::string file) {
115 115
     std::string configFile = expandHomeDirectory(file);
116
-    getConsole() << "Loading config from \"" << configFile << "\"..." << Console::endl;
116
+    getLog() << "Loading config from \"" << configFile << "\"..." << Log::endl;
117 117
 
118 118
     std::ifstream f(configFile);
119 119
     if (!f) {
120
-        getConsole() << "Could not open file!" << Console::endl;
120
+        getLog() << "Could not open file!" << Log::endl;
121 121
         return -1;
122 122
     }
123 123
 
@@ -127,7 +127,7 @@ int Command::executeFile(std::string file) {
127 127
 
128 128
         int error = Command::command(line);
129 129
         if (error != 0)
130
-            getConsole() << "Error Code: " << error << Console::endl;
130
+            getLog() << "Error Code: " << error << Log::endl;
131 131
     }
132 132
 
133 133
     f.close();

+ 12
- 12
src/commands/CommandAnimate.cpp View File

@@ -6,7 +6,7 @@
6 6
  */
7 7
 
8 8
 #include "global.h"
9
-#include "Console.h"
9
+#include "Log.h"
10 10
 #include "Game.h"
11 11
 #include "Render.h"
12 12
 #include "World.h"
@@ -21,17 +21,17 @@ std::string CommandAnimate::brief() {
21 21
 }
22 22
 
23 23
 void CommandAnimate::printHelp() {
24
-    getConsole() << "animate-Command Usage:" << Console::endl;
25
-    getConsole() << "  animate [n|p|BOOL]" << Console::endl;
26
-    getConsole() << "Where the commands have the following meaning:" << Console::endl;
27
-    getConsole() << "  BOOL to (de)activate animating all models" << Console::endl;
28
-    getConsole() << "  n to step all models to their next animation" << Console::endl;
29
-    getConsole() << "  p to step all models to their previous animation" << Console::endl;
24
+    getLog() << "animate-Command Usage:" << Log::endl;
25
+    getLog() << "  animate [n|p|BOOL]" << Log::endl;
26
+    getLog() << "Where the commands have the following meaning:" << Log::endl;
27
+    getLog() << "  BOOL to (de)activate animating all models" << Log::endl;
28
+    getLog() << "  n to step all models to their next animation" << Log::endl;
29
+    getLog() << "  p to step all models to their previous animation" << Log::endl;
30 30
 }
31 31
 
32 32
 int CommandAnimate::execute(std::istream& args) {
33 33
     if (!getGame().isLoaded()) {
34
-        getConsole() << "Use animate command interactively!" << Console::endl;
34
+        getLog() << "Use animate command interactively!" << Log::endl;
35 35
         return -1;
36 36
     }
37 37
 
@@ -47,7 +47,7 @@ int CommandAnimate::execute(std::istream& args) {
47 47
                     e.setAnimation(0);
48 48
             }
49 49
         } else {
50
-            getConsole() << "Animations need to be enabled!" << Console::endl;
50
+            getLog() << "Animations need to be enabled!" << Log::endl;
51 51
         }
52 52
     } else if (args.peek() == 'p') {
53 53
         // Step all skeletal models to their previous animation
@@ -62,20 +62,20 @@ int CommandAnimate::execute(std::istream& args) {
62 62
                         e.setAnimation(m.size() - 1);
63 63
             }
64 64
         } else {
65
-            getConsole() << "Animations need to be enabled!" << Console::endl;
65
+            getLog() << "Animations need to be enabled!" << Log::endl;
66 66
         }
67 67
     } else {
68 68
         // Enable or disable animating all skeletal models
69 69
         bool b = false;
70 70
         if (!(args >> b)) {
71
-            getConsole() << "Pass BOOL to animate command!" << Console::endl;
71
+            getLog() << "Pass BOOL to animate command!" << Log::endl;
72 72
             return -2;
73 73
         }
74 74
         if (b)
75 75
             getRender().setFlags(Render::fAnimateAllModels);
76 76
         else
77 77
             getRender().clearFlags(Render::fAnimateAllModels);
78
-        getConsole() << (b ? "Animating all models" : "No longer animating all models") << Console::endl;
78
+        getLog() << (b ? "Animating all models" : "No longer animating all models") << Log::endl;
79 79
     }
80 80
 
81 81
     return 0;

+ 22
- 22
src/commands/CommandBind.cpp View File

@@ -6,7 +6,7 @@
6 6
  */
7 7
 
8 8
 #include "global.h"
9
-#include "Console.h"
9
+#include "Log.h"
10 10
 #include "RunTime.h"
11 11
 #include "commands/CommandBind.h"
12 12
 
@@ -19,41 +19,41 @@ std::string CommandBind::brief() {
19 19
 }
20 20
 
21 21
 void CommandBind::printHelp() {
22
-    getConsole() << "bind-Command Usage:" << Console::endl;
23
-    getConsole() << "  bind ACTION KEY" << Console::endl;
24
-    getConsole() << "Available Actions:" << Console::endl;
25
-    getConsole() << "  menu" << Console::endl;
26
-    getConsole() << "  console" << Console::endl;
27
-    getConsole() << "  debug" << Console::endl;
28
-    getConsole() << "  forward" << Console::endl;
29
-    getConsole() << "  backward" << Console::endl;
30
-    getConsole() << "  left" << Console::endl;
31
-    getConsole() << "  right" << Console::endl;
32
-    getConsole() << "  jump" << Console::endl;
33
-    getConsole() << "  crouch" << Console::endl;
34
-    getConsole() << "  use" << Console::endl;
35
-    getConsole() << "  holster" << Console::endl;
36
-    getConsole() << "  walk" << Console::endl;
37
-    getConsole() << "Key-Format:" << Console::endl;
38
-    getConsole() << "  'a' or '1'    for character/number keys" << Console::endl;
39
-    getConsole() << "  \"leftctrl\"  for symbols and special keys" << Console::endl;
22
+    getLog() << "bind-Command Usage:" << Log::endl;
23
+    getLog() << "  bind ACTION KEY" << Log::endl;
24
+    getLog() << "Available Actions:" << Log::endl;
25
+    getLog() << "  menu" << Log::endl;
26
+    getLog() << "  console" << Log::endl;
27
+    getLog() << "  debug" << Log::endl;
28
+    getLog() << "  forward" << Log::endl;
29
+    getLog() << "  backward" << Log::endl;
30
+    getLog() << "  left" << Log::endl;
31
+    getLog() << "  right" << Log::endl;
32
+    getLog() << "  jump" << Log::endl;
33
+    getLog() << "  crouch" << Log::endl;
34
+    getLog() << "  use" << Log::endl;
35
+    getLog() << "  holster" << Log::endl;
36
+    getLog() << "  walk" << Log::endl;
37
+    getLog() << "Key-Format:" << Log::endl;
38
+    getLog() << "  'a' or '1'    for character/number keys" << Log::endl;
39
+    getLog() << "  \"leftctrl\"  for symbols and special keys" << Log::endl;
40 40
 }
41 41
 
42 42
 int CommandBind::execute(std::istream& args) {
43 43
     std::string a, b;
44 44
     if (!(args >> a >> b)) {
45
-        getConsole() << "Invalid use of bind-command" << Console::endl;
45
+        getLog() << "Invalid use of bind-command" << Log::endl;
46 46
         return -1;
47 47
     } else {
48 48
         ActionEvents e = stringToActionEvent(a);
49 49
         if (e == ActionEventCount) {
50
-            getConsole() << "bind-Error: Unknown action (" << a << ")" << Console::endl;
50
+            getLog() << "bind-Error: Unknown action (" << a << ")" << Log::endl;
51 51
             return -2;
52 52
         }
53 53
 
54 54
         KeyboardButton c = stringToKeyboardButton(b);
55 55
         if (c == unknownKey) {
56
-            getConsole() << "bind-Error: Unknown key (" << b << ")" << Console::endl;
56
+            getLog() << "bind-Error: Unknown key (" << b << ")" << Log::endl;
57 57
             return -3;
58 58
         }
59 59
 

+ 9
- 9
src/commands/CommandEngine.cpp View File

@@ -8,6 +8,7 @@
8 8
 #include "global.h"
9 9
 #include "Console.h"
10 10
 #include "Game.h"
11
+#include "Log.h"
11 12
 #include "Menu.h"
12 13
 #include "RunTime.h"
13 14
 #include "Render.h"
@@ -22,13 +23,13 @@ std::string CommandLoad::brief() {
22 23
 }
23 24
 
24 25
 void CommandLoad::printHelp() {
25
-    getConsole() << "load-Command Usage:" << Console::endl;
26
-    getConsole() << "  load /path/to/level" << Console::endl;
26
+    getLog() << "load-Command Usage:" << Log::endl;
27
+    getLog() << "  load /path/to/level" << Log::endl;
27 28
 }
28 29
 
29 30
 int CommandLoad::execute(std::istream& args) {
30 31
     if (!getRunTime().isRunning()) {
31
-        getConsole() << "Use load command interactively!" << Console::endl;
32
+        getLog() << "Use load command interactively!" << Log::endl;
32 33
         return -1;
33 34
     }
34 35
 
@@ -49,14 +50,14 @@ std::string CommandScreenshot::brief() {
49 50
 }
50 51
 
51 52
 void CommandScreenshot::printHelp() {
52
-    getConsole() << "sshot-Command Usage:" << Console::endl;
53
-    getConsole() << "  sshot [console|menu] [console|menu]" << Console::endl;
54
-    getConsole() << "Add console/menu to capture them too" << Console::endl;
53
+    getLog() << "sshot-Command Usage:" << Log::endl;
54
+    getLog() << "  sshot [console|menu] [console|menu]" << Log::endl;
55
+    getLog() << "Add console/menu to capture them too" << Log::endl;
55 56
 }
56 57
 
57 58
 int CommandScreenshot::execute(std::istream& args) {
58 59
     if (!getRunTime().isRunning()) {
59
-        getConsole() << "Use sshot command interactively!" << Console::endl;
60
+        getLog() << "Use sshot command interactively!" << Log::endl;
60 61
         return -1;
61 62
     }
62 63
 
@@ -64,7 +65,6 @@ int CommandScreenshot::execute(std::istream& args) {
64 65
     filename += "/sshots/";
65 66
     filename += VERSION_SHORT;
66 67
 
67
-    bool console = false, menu = false;
68 68
     std::string temp, temp2;
69 69
     args >> temp >> temp2;
70 70
 
@@ -88,7 +88,7 @@ int CommandScreenshot::execute(std::istream& args) {
88 88
     getMenu().makeInvisible();
89 89
     getConsole().moveToTop();
90 90
 
91
-    getConsole() << "Screenshot stored..." << Console::endl;
91
+    getLog() << "Screenshot stored..." << Log::endl;
92 92
     return 0;
93 93
 }
94 94
 

+ 9
- 9
src/commands/CommandGame.cpp View File

@@ -6,8 +6,8 @@
6 6
  */
7 7
 
8 8
 #include "global.h"
9
-#include "Console.h"
10 9
 #include "Game.h"
10
+#include "Log.h"
11 11
 #include "RunTime.h"
12 12
 #include "World.h"
13 13
 #include "commands/CommandGame.h"
@@ -22,7 +22,7 @@ std::string CommandPos::brief() {
22 22
 
23 23
 int CommandPos::execute(std::istream& args) {
24 24
     if ((!getRunTime().isRunning()) || (!getGame().isLoaded())) {
25
-        getConsole() << "Use pos command interactively!" << Console::endl;
25
+        getLog() << "Use pos command interactively!" << Log::endl;
26 26
         return -1;
27 27
     }
28 28
 
@@ -42,7 +42,7 @@ std::string CommandViewmodel::brief() {
42 42
 
43 43
 int CommandViewmodel::execute(std::istream& args) {
44 44
     if ((!getRunTime().isRunning()) || (!getGame().isLoaded())) {
45
-        getConsole() << "Use viewmodel command interactively!" << Console::endl;
45
+        getLog() << "Use viewmodel command interactively!" << Log::endl;
46 46
         return -1;
47 47
     }
48 48
 
@@ -56,7 +56,7 @@ int CommandViewmodel::execute(std::istream& args) {
56 56
         getGame().getLara().setSkeletalModel(n);
57 57
         return 0;
58 58
     } else {
59
-        getConsole() << "Invalid SkeletalModel index!" << Console::endl;
59
+        getLog() << "Invalid SkeletalModel index!" << Log::endl;
60 60
         return -2;
61 61
     }
62 62
 }
@@ -73,19 +73,19 @@ std::string CommandPigtail::brief() {
73 73
 
74 74
 int CommandPigtail::execute(std::istream& args) {
75 75
     if ((!getRunTime().isRunning()) || (!getGame().isLoaded())) {
76
-        getConsole() << "Use pigtail command interactively!" << Console::endl;
76
+        getLog() << "Use pigtail command interactively!" << Log::endl;
77 77
         return -1;
78 78
     }
79 79
 
80 80
     bool b;
81 81
     args >> b;
82 82
     if (!args) {
83
-        getConsole() << "Pass BOOL to pigtail command!" << Console::endl;
83
+        getLog() << "Pass BOOL to pigtail command!" << Log::endl;
84 84
         return -2;
85 85
     }
86 86
 
87 87
     getGame().getLara().getModel().setPigTail(b);
88
-    getConsole() << "Pigtail is now " << (b ? "on" : "off") << Console::endl;
88
+    getLog() << "Pigtail is now " << (b ? "on" : "off") << Log::endl;
89 89
     return 0;
90 90
 }
91 91
 
@@ -101,14 +101,14 @@ std::string CommandPonypos::brief() {
101 101
 
102 102
 int CommandPonypos::execute(std::istream& args) {
103 103
     if ((!getRunTime().isRunning()) || (!getGame().isLoaded())) {
104
-        getConsole() << "Use ponypos command interactively!" << Console::endl;
104
+        getLog() << "Use ponypos command interactively!" << Log::endl;
105 105
         return -1;
106 106
     }
107 107
 
108 108
     float a, b, c, d;
109 109
     args >> a >> b >> c >> d;
110 110
     if (!args) {
111
-        getConsole() << "Pass four FLOATs to ponypos command!" << Console::endl;
111
+        getLog() << "Pass four FLOATs to ponypos command!" << Log::endl;
112 112
         return -2;
113 113
     }
114 114
 

+ 10
- 10
src/commands/CommandMove.cpp View File

@@ -6,8 +6,8 @@
6 6
  */
7 7
 
8 8
 #include "global.h"
9
-#include "Console.h"
10 9
 #include "Game.h"
10
+#include "Log.h"
11 11
 #include "RunTime.h"
12 12
 #include "commands/CommandMove.h"
13 13
 
@@ -20,17 +20,17 @@ std::string CommandMove::brief() {
20 20
 }
21 21
 
22 22
 void CommandMove::printHelp() {
23
-    getConsole() << "move-Command Usage:" << Console::endl;
24
-    getConsole() << "  move COMMAND" << Console::endl;
25
-    getConsole() << "Where COMMAND is one of the following:" << Console::endl;
26
-    getConsole() << "  walk" << Console::endl;
27
-    getConsole() << "  fly" << Console::endl;
28
-    getConsole() << "  noclip" << Console::endl;
23
+    getLog() << "move-Command Usage:" << Log::endl;
24
+    getLog() << "  move COMMAND" << Log::endl;
25
+    getLog() << "Where COMMAND is one of the following:" << Log::endl;
26
+    getLog() << "  walk" << Log::endl;
27
+    getLog() << "  fly" << Log::endl;
28
+    getLog() << "  noclip" << Log::endl;
29 29
 }
30 30
 
31 31
 int CommandMove::execute(std::istream& args) {
32 32
     if ((!getRunTime().isRunning()) || (!getGame().isLoaded())) {
33
-        getConsole() << "Use move command interactively!" << Console::endl;
33
+        getLog() << "Use move command interactively!" << Log::endl;
34 34
         return -1;
35 35
     }
36 36
 
@@ -43,11 +43,11 @@ int CommandMove::execute(std::istream& args) {
43 43
     } else if (s.compare("noclip") == 0) {
44 44
         getGame().getLara().setMoveType(Entity::MoveTypeNoClipping);
45 45
     } else {
46
-        getConsole() << "Invalid use of move command (" << s << ")!" << Console::endl;
46
+        getLog() << "Invalid use of move command (" << s << ")!" << Log::endl;
47 47
         return -2;
48 48
     }
49 49
 
50
-    getConsole() << s  << "ing" << Console::endl;
50
+    getLog() << s  << "ing" << Log::endl;
51 51
     return 0;
52 52
 }
53 53
 

+ 27
- 27
src/commands/CommandRender.cpp View File

@@ -6,8 +6,8 @@
6 6
  */
7 7
 
8 8
 #include "global.h"
9
-#include "Console.h"
10 9
 #include "Game.h"
10
+#include "Log.h"
11 11
 #include "RunTime.h"
12 12
 #include "Render.h"
13 13
 #include "commands/CommandRender.h"
@@ -21,20 +21,20 @@ std::string CommandMode::brief() {
21 21
 }
22 22
 
23 23
 void CommandMode::printHelp() {
24
-    getConsole() << "mode-Command Usage:" << Console::endl;
25
-    getConsole() << "  mode MODE" << Console::endl;
26
-    getConsole() << "Where MODE is one of the following:" << Console::endl;
27
-    getConsole() << "  wireframe" << Console::endl;
28
-    getConsole() << "  solid" << Console::endl;
29
-    getConsole() << "  texture" << Console::endl;
30
-    getConsole() << "  vertexlight" << Console::endl;
31
-    getConsole() << "  titlescreen" << Console::endl;
24
+    getLog() << "mode-Command Usage:" << Log::endl;
25
+    getLog() << "  mode MODE" << Log::endl;
26
+    getLog() << "Where MODE is one of the following:" << Log::endl;
27
+    getLog() << "  wireframe" << Log::endl;
28
+    getLog() << "  solid" << Log::endl;
29
+    getLog() << "  texture" << Log::endl;
30
+    getLog() << "  vertexlight" << Log::endl;
31
+    getLog() << "  titlescreen" << Log::endl;
32 32
 
33 33
 }
34 34
 
35 35
 int CommandMode::execute(std::istream& args) {
36 36
     if (!getGame().isLoaded()) {
37
-        getConsole() << "Load a level to set the mode!" << Console::endl;
37
+        getLog() << "Load a level to set the mode!" << Log::endl;
38 38
         return -1;
39 39
     }
40 40
 
@@ -43,21 +43,21 @@ int CommandMode::execute(std::istream& args) {
43 43
 
44 44
     if (s.compare("wireframe") == 0) {
45 45
         getRender().setMode(Render::modeWireframe);
46
-        getConsole() << "Wireframe mode" << Console::endl;
46
+        getLog() << "Wireframe mode" << Log::endl;
47 47
     } else if (s.compare("solid") == 0) {
48 48
         getRender().setMode(Render::modeSolid);
49
-        getConsole() << "Solid mode" << Console::endl;
49
+        getLog() << "Solid mode" << Log::endl;
50 50
     } else if (s.compare("texture") == 0) {
51 51
         getRender().setMode(Render::modeTexture);
52
-        getConsole() << "Texture mode" << Console::endl;
52
+        getLog() << "Texture mode" << Log::endl;
53 53
     } else if (s.compare("vertexlight") == 0) {
54 54
         getRender().setMode(Render::modeVertexLight);
55
-        getConsole() << "Vertexlight mode" << Console::endl;
55
+        getLog() << "Vertexlight mode" << Log::endl;
56 56
     } else if (s.compare("titlescreen") == 0) {
57 57
         getRender().setMode(Render::modeLoadScreen);
58
-        getConsole() << "Titlescreen mode" << Console::endl;
58
+        getLog() << "Titlescreen mode" << Log::endl;
59 59
     } else {
60
-        getConsole() << "Invalid use of mode command (" << s << ")!" << Console::endl;
60
+        getLog() << "Invalid use of mode command (" << s << ")!" << Log::endl;
61 61
         return -2;
62 62
     }
63 63
 
@@ -75,19 +75,19 @@ std::string CommandRenderflag::brief() {
75 75
 }
76 76
 
77 77
 void CommandRenderflag::printHelp() {
78
-    getConsole() << "renderflag-Command Usage:" << Console::endl;
79
-    getConsole() << "  renderflag STRING BOOL" << Console::endl;
80
-    getConsole() << "Where STRING is one of the following:" << Console::endl;
81
-    getConsole() << "  ralpha" << Console::endl;
82
-    getConsole() << "  entmodel" << Console::endl;
83
-    getConsole() << "  fog" << Console::endl;
84
-    getConsole() << "  light" << Console::endl;
85
-    getConsole() << "  ponytail" << Console::endl;
78
+    getLog() << "renderflag-Command Usage:" << Log::endl;
79
+    getLog() << "  renderflag STRING BOOL" << Log::endl;
80
+    getLog() << "Where STRING is one of the following:" << Log::endl;
81
+    getLog() << "  ralpha" << Log::endl;
82
+    getLog() << "  entmodel" << Log::endl;
83
+    getLog() << "  fog" << Log::endl;
84
+    getLog() << "  light" << Log::endl;
85
+    getLog() << "  ponytail" << Log::endl;
86 86
 }
87 87
 
88 88
 int CommandRenderflag::execute(std::istream& args) {
89 89
     if (!getRunTime().isRunning()) {
90
-        getConsole() << "Use renderflag-Command interactively!" << Console::endl;
90
+        getLog() << "Use renderflag-Command interactively!" << Log::endl;
91 91
         return -1;
92 92
     }
93 93
 
@@ -95,13 +95,13 @@ int CommandRenderflag::execute(std::istream& args) {
95 95
     bool b;
96 96
     args >> flag >> b;
97 97
     if (!args) {
98
-        getConsole() << "Pass STRING and BOOL to renderflag command!" << Console::endl;
98
+        getLog() << "Pass STRING and BOOL to renderflag command!" << Log::endl;
99 99
         return -2;
100 100
     }
101 101
 
102 102
     int f = stringToFlag(flag);
103 103
     if (f == -1) {
104
-        getConsole() << "Unknown flag \"" << flag << "\"!" << Console::endl;
104
+        getLog() << "Unknown flag \"" << flag << "\"!" << Log::endl;
105 105
         return -3;
106 106
     }
107 107
 

+ 25
- 25
src/commands/CommandSet.cpp View File

@@ -7,8 +7,8 @@
7 7
 
8 8
 #include "global.h"
9 9
 #include "Camera.h"
10
-#include "Console.h"
11 10
 #include "Font.h"
11
+#include "Log.h"
12 12
 #include "RunTime.h"
13 13
 #include "Sound.h"
14 14
 #include "Window.h"
@@ -24,22 +24,22 @@ std::string CommandSet::brief() {
24 24
 }
25 25
 
26 26
 void CommandSet::printHelp() {
27
-    getConsole() << "set-Command Usage:" << Console::endl;
28
-    getConsole() << "  set VAR VAL" << Console::endl;
29
-    getConsole() << "Available Variables:" << Console::endl;
30
-    getConsole() << "  basedir    STRING" << Console::endl;
31
-    getConsole() << "  pakdir     STRING" << Console::endl;
32
-    getConsole() << "  audiodir   STRING" << Console::endl;
33
-    getConsole() << "  datadir    STRING" << Console::endl;
34
-    getConsole() << "  font       STRING" << Console::endl;
35
-    getConsole() << "  size       INT INT" << Console::endl;
36
-    getConsole() << "  fullscreen BOOL" << Console::endl;
37
-    getConsole() << "  audio      BOOL" << Console::endl;
38
-    getConsole() << "  volume     BOOL" << Console::endl;
39
-    getConsole() << "  mouse_x    FLOAT" << Console::endl;
40
-    getConsole() << "  mouse_y    FLOAT" << Console::endl;
41
-    getConsole() << "  fps        BOOL" << Console::endl;
42
-    getConsole() << "Enclose STRINGs with \"\"!" << Console::endl;
27
+    getLog() << "set-Command Usage:" << Log::endl;
28
+    getLog() << "  set VAR VAL" << Log::endl;
29
+    getLog() << "Available Variables:" << Log::endl;
30
+    getLog() << "  basedir    STRING" << Log::endl;
31
+    getLog() << "  pakdir     STRING" << Log::endl;
32
+    getLog() << "  audiodir   STRING" << Log::endl;
33
+    getLog() << "  datadir    STRING" << Log::endl;
34
+    getLog() << "  font       STRING" << Log::endl;
35
+    getLog() << "  size       INT INT" << Log::endl;
36
+    getLog() << "  fullscreen BOOL" << Log::endl;
37
+    getLog() << "  audio      BOOL" << Log::endl;
38
+    getLog() << "  volume     BOOL" << Log::endl;
39
+    getLog() << "  mouse_x    FLOAT" << Log::endl;
40
+    getLog() << "  mouse_y    FLOAT" << Log::endl;
41
+    getLog() << "  fps        BOOL" << Log::endl;
42
+    getLog() << "Enclose STRINGs with \"\"!" << Log::endl;
43 43
 }
44 44
 
45 45
 namespace {
@@ -72,49 +72,49 @@ int CommandSet::execute(std::istream& args) {
72 72
     if (var.compare("size") == 0) {
73 73
         unsigned int w = DEFAULT_WIDTH, h = DEFAULT_HEIGHT;
74 74
         if (!(args >> w >> h)) {
75
-            getConsole() << "set-size-Error: Invalid value(s)" << Console::endl;
75
+            getLog() << "set-size-Error: Invalid value(s)" << Log::endl;
76 76
             return -2;
77 77
         }
78 78
         getWindow().setSize(w, h);
79 79
     } else if (var.compare("fullscreen") == 0) {
80 80
         bool fullscreen = false;
81 81
         if (!(args >> fullscreen)) {
82
-            getConsole() << "set-fullscreen-Error: Invalid value" << Console::endl;
82
+            getLog() << "set-fullscreen-Error: Invalid value" << Log::endl;
83 83
             return -3;
84 84
         }
85 85
         getWindow().setFullscreen(fullscreen);
86 86
     } else if (var.compare("audio") == 0) {
87 87
         bool audio = false;
88 88
         if (!(args >> audio)) {
89
-            getConsole() << "set-audio-Error: Invalid value" << Console::endl;
89
+            getLog() << "set-audio-Error: Invalid value" << Log::endl;
90 90
             return -4;
91 91
         }
92 92
         getSound().setEnabled(audio);
93 93
     } else if (var.compare("volume") == 0) {
94 94
         float vol = 1.0f;
95 95
         if (!(args >> vol)) {
96
-            getConsole() << "set-volume-Error: Invalid value" << Console::endl;
96
+            getLog() << "set-volume-Error: Invalid value" << Log::endl;
97 97
             return -5;
98 98
         }
99 99
         getSound().setVolume(vol);
100 100
     } else if (var.compare("mouse_x") == 0) {
101 101
         float sense = 1.0f;
102 102
         if (!(args >> sense)) {
103
-            getConsole() << "set-mouse_x-Error: Invalid value" << Console::endl;
103
+            getLog() << "set-mouse_x-Error: Invalid value" << Log::endl;
104 104
             return -6;
105 105
         }
106 106
         getCamera().setSensitivityX(OR_DEG_TO_RAD(sense));
107 107
     } else if (var.compare("mouse_y") == 0) {
108 108
         float sense = 1.0f;
109 109
         if (!(args >> sense)) {
110
-            getConsole() << "set-mouse_y-Error: Invalid value" << Console::endl;
110
+            getLog() << "set-mouse_y-Error: Invalid value" << Log::endl;
111 111
             return -7;
112 112
         }
113 113
         getCamera().setSensitivityY(OR_DEG_TO_RAD(sense));
114 114
     } else if (var.compare("fps") == 0) {
115 115
         bool fps = false;
116 116
         if (!(args >> fps)) {
117
-            getConsole() << "set-fps-Error: Invalid value" << Console::endl;
117
+            getLog() << "set-fps-Error: Invalid value" << Log::endl;
118 118
             return -8;
119 119
         }
120 120
         getRunTime().setFPS(fps);
@@ -139,7 +139,7 @@ int CommandSet::execute(std::istream& args) {
139 139
         args >> temp;
140 140
         getFont().setFont(expandNames(temp).c_str());
141 141
     } else {
142
-        getConsole() << "set-Error: Unknown variable (" << var.c_str() << ")" << Console::endl;
142
+        getLog() << "set-Error: Unknown variable (" << var.c_str() << ")" << Log::endl;
143 143
         return -1;
144 144
     }
145 145
 

+ 6
- 6
src/commands/CommandSound.cpp View File

@@ -6,8 +6,8 @@
6 6
  */
7 7
 
8 8
 #include "global.h"
9
-#include "Console.h"
10 9
 #include "Game.h"
10
+#include "Log.h"
11 11
 #include "RunTime.h"
12 12
 #include "Sound.h"
13 13
 #include "commands/CommandSound.h"
@@ -21,15 +21,15 @@ std::string CommandSound::brief() {
21 21
 }
22 22
 
23 23
 void CommandSound::printHelp() {
24
-    getConsole() << "sound-Command Usage:" << Console::endl;
25
-    getConsole() << "sound-Command Usage:" << Console::endl;
26
-    getConsole() << "  sound INT" << Console::endl;
27
-    getConsole() << "Where INT is a valid sound ID integer" << Console::endl;
24
+    getLog() << "sound-Command Usage:" << Log::endl;
25
+    getLog() << "sound-Command Usage:" << Log::endl;
26
+    getLog() << "  sound INT" << Log::endl;
27
+    getLog() << "Where INT is a valid sound ID integer" << Log::endl;
28 28
 }
29 29
 
30 30
 int CommandSound::execute(std::istream& args) {
31 31
     if (!getGame().isLoaded()) {
32
-        getConsole() << "Use sound command interactively!" << Console::endl;
32
+        getLog() << "Use sound command interactively!" << Log::endl;
33 33
         return -1;
34 34
     }
35 35
 

+ 19
- 19
src/loader/LoaderTR2.cpp View File

@@ -10,7 +10,7 @@
10 10
 #include <vector>
11 11
 
12 12
 #include "global.h"
13
-#include "Console.h"
13
+#include "Log.h"
14 14
 #include "loader/LoaderTR2.h"
15 15
 
16 16
 LoaderTR2::LoaderTR2() {
@@ -29,62 +29,62 @@ int LoaderTR2::load(std::string f) {
29 29
     }
30 30
 
31 31
     loadPaletteTextiles();
32
-    getConsole() << "->loaded palette" << Console::endl;
32
+    getLog() << "->loaded palette" << Log::endl;
33 33
 
34 34
     file.seek(file.tell() + 4); // Unused value?
35 35
 
36 36
     loadRooms();
37
-    getConsole() << "->loaded rooms" << Console::endl;
37
+    getLog() << "->loaded rooms" << Log::endl;
38 38
 
39 39
     loadFloorData();
40
-    getConsole() << "->loaded floor data" << Console::endl;
40
+    getLog() << "->loaded floor data" << Log::endl;
41 41
 
42 42
     loadMeshes();
43
-    getConsole() << "->loaded meshes" << Console::endl;
43
+    getLog() << "->loaded meshes" << Log::endl;
44 44
 
45 45
     loadMoveables();
46
-    getConsole() << "->loaded moveables" << Console::endl;
46
+    getLog() << "->loaded moveables" << Log::endl;
47 47
 
48 48
     loadStaticMeshes();
49
-    getConsole() << "->loaded static meshes" << Console::endl;
49
+    getLog() << "->loaded static meshes" << Log::endl;
50 50
 
51 51
     loadTextures();
52
-    getConsole() << "->loaded textures" << Console::endl;
52
+    getLog() << "->loaded textures" << Log::endl;
53 53
 
54 54
     loadSprites();
55
-    getConsole() << "->loaded sprites" << Console::endl;
55
+    getLog() << "->loaded sprites" << Log::endl;
56 56
 
57 57
     loadCameras();
58
-    getConsole() << "->loaded cameras" << Console::endl;
58
+    getLog() << "->loaded cameras" << Log::endl;
59 59
 
60 60
     loadSoundSources();
61
-    getConsole() << "->loaded sound sources" << Console::endl;
61
+    getLog() << "->loaded sound sources" << Log::endl;
62 62
 
63 63
     loadBoxesOverlapsZones();
64
-    getConsole() << "->loaded boxes overlaps zones" << Console::endl;
64
+    getLog() << "->loaded boxes overlaps zones" << Log::endl;
65 65
 
66 66
     loadAnimatedTextures();
67
-    getConsole() << "->loaded animated textures" << Console::endl;
67
+    getLog() << "->loaded animated textures" << Log::endl;
68 68
 
69 69
     loadItems();
70
-    getConsole() << "->loaded items" << Console::endl;
70
+    getLog() << "->loaded items" << Log::endl;
71 71
 
72 72
     file.seek(file.tell() + 8192); // Skip Light map, only for 8bit coloring
73 73
 
74 74
     loadCinematicFrames();
75
-    getConsole() << "->loaded cinematic frames" << Console::endl;
75
+    getLog() << "->loaded cinematic frames" << Log::endl;
76 76
 
77 77
     loadDemoData();
78
-    getConsole() << "->loaded demo data" << Console::endl;
78
+    getLog() << "->loaded demo data" << Log::endl;
79 79
 
80 80
     loadSoundMap();
81
-    getConsole() << "->loaded sound map" << Console::endl;
81
+    getLog() << "->loaded sound map" << Log::endl;
82 82
 
83 83
     loadSoundDetails();
84
-    getConsole() << "->loaded sound details" << Console::endl;
84
+    getLog() << "->loaded sound details" << Log::endl;
85 85
 
86 86
     loadSampleIndices();
87
-    getConsole() << "->loaded sample indices" << Console::endl;
87
+    getLog() << "->loaded sample indices" << Log::endl;
88 88
 
89 89
     return 0;
90 90
 }

+ 9
- 2
src/main.cpp View File

@@ -21,6 +21,7 @@
21 21
 #include "Debug.h"
22 22
 #include "FontManager.h"
23 23
 #include "Game.h"
24
+#include "Log.h"
24 25
 #include "MenuFolder.h"
25 26
 #include "Render.h"
26 27
 #include "RunTime.h"
@@ -48,6 +49,7 @@ static std::shared_ptr<Console> gConsole;
48 49
 static std::shared_ptr<Debug> gDebug;
49 50
 static std::shared_ptr<FontManager> gFont;
50 51
 static std::shared_ptr<Game> gGame;
52
+static std::shared_ptr<Log> gLog;
51 53
 static std::shared_ptr<MenuFolder> gMenu;
52 54
 static std::shared_ptr<Render> gRender;
53 55
 static std::shared_ptr<RunTime> gRunTime;
@@ -76,6 +78,10 @@ Game &getGame() {
76 78
     return *gGame;
77 79
 }
78 80
 
81
+Log &getLog() {
82
+    return *gLog;
83
+}
84
+
79 85
 Menu &getMenu() {
80 86
     return *gMenu;
81 87
 }
@@ -119,6 +125,7 @@ int main(int argc, char* argv[]) {
119 125
     gDebug.reset(new Debug());
120 126
     gFont.reset(new FontManager());
121 127
     gGame.reset(new Game());
128
+    gLog.reset(new Log());
122 129
     gMenu.reset(new MenuFolder());
123 130
     gRender.reset(new Render());
124 131
     gRunTime.reset(new RunTime());
@@ -145,7 +152,7 @@ int main(int argc, char* argv[]) {
145 152
         Command::executeFile(configFileToUse);
146 153
     }
147 154
 
148
-    getConsole() << "Initializing " << VERSION << Console::endl;
155
+    getLog() << "Initializing " << VERSION << Log::endl;
149 156
 
150 157
     // Initialize Windowing
151 158
     int error = getWindow().initialize();
@@ -189,7 +196,7 @@ int main(int argc, char* argv[]) {
189 196
         return -6;
190 197
     }
191 198
 
192
-    getConsole() << "Starting " << VERSION << Console::endl;
199
+    getLog() << "Starting " << VERSION << Log::endl;
193 200
     getMenu().moveToTop();
194 201
     systemTimerReset();
195 202
     getRunTime().setRunning(true);

Loading…
Cancel
Save