Browse Source

Use Console as Stream everywhere

Thomas Buck 9 years ago
parent
commit
60df802f2a
14 changed files with 179 additions and 207 deletions
  1. 1
    0
      ChangeLog.md
  2. 11
    4
      include/Console.h
  3. 2
    2
      include/OpenRaider.h
  4. 90
    95
      src/Command.cpp
  5. 3
    31
      src/Console.cpp
  6. 7
    5
      src/Entity.cpp
  7. 9
    9
      src/Game.cpp
  8. 2
    2
      src/Menu.cpp
  9. 5
    7
      src/Room.cpp
  10. 6
    5
      src/SkeletalModel.cpp
  11. 2
    2
      src/TextureManager.cpp
  12. 2
    4
      src/main.cpp
  13. 20
    20
      src/utils/pcx.cpp
  14. 19
    21
      src/utils/png.cpp

+ 1
- 0
ChangeLog.md View File

@@ -13,6 +13,7 @@
13 13
     * Console is now using std::string instead of char *
14 14
     * Added utf8-cpp dependency to allow Console to delete multi-byte chars
15 15
     * Added stream-style printing to Console
16
+    * Using Console like Stream everywhere, removed old print method
16 17
 
17 18
     [ 20140809 ]
18 19
     * Script Unit Test brings it’s own scripts to test

+ 11
- 4
include/Console.h View File

@@ -28,10 +28,17 @@ public:
28 28
     bool isVisible();
29 29
 
30 30
     template<typename T>
31
-    Console &operator<<(T t);
32
-
33
-    // Deprecated!
34
-    void print(const char *s, ...) __attribute__((format(printf, 2, 3)));
31
+    Console &operator<<(const T t) {
32
+        printBuffer << t;
33
+        if (printBuffer.str().back() == '\n') {
34
+            mHistory.push_back(printBuffer.str().substr(0, printBuffer.str().length() - 1));
35
+#ifdef DEBUG
36
+            std::cout << printBuffer.str().substr(0, printBuffer.str().length() - 1) << std::endl;
37
+#endif
38
+            printBuffer.str("");
39
+        }
40
+        return (*this);
41
+    }
35 42
 
36 43
     void display();
37 44
 

+ 2
- 2
include/OpenRaider.h View File

@@ -35,8 +35,7 @@ public:
35 35
      */
36 36
     int loadConfig(const char *config);
37 37
 
38
-    int command(std::string &command);
39
-    int command(const char *command);
38
+    int command(std::string command);
40 39
 
41 40
     void run();
42 41
     void frame();
@@ -70,3 +69,4 @@ private:
70 69
 OpenRaider &getOpenRaider();
71 70
 
72 71
 #endif
72
+

+ 90
- 95
src/Command.cpp View File

@@ -30,11 +30,11 @@ int OpenRaider::loadConfig(const char *config) {
30 30
     assert(config[0] != '\0');
31 31
 
32 32
     char *configFile = fullPath(config, 0);
33
-    getConsole().print("Loading config from \"%s\"...", configFile);
33
+    getConsole() << "Loading config from \"" << configFile << "\"..." << Console::endl;
34 34
 
35 35
     std::ifstream file(configFile);
36 36
     if (!file) {
37
-        getConsole().print("Could not open file!");
37
+        getConsole() << "Could not open file!" << Console::endl;
38 38
         return -1;
39 39
     }
40 40
 
@@ -44,7 +44,7 @@ int OpenRaider::loadConfig(const char *config) {
44 44
 
45 45
         int error = command(line);
46 46
         if (error != 0)
47
-            getConsole().print("Error Code: %d", error);
47
+            getConsole() << "Error Code: " << error << Console::endl;
48 48
     }
49 49
 
50 50
     file.close();
@@ -52,12 +52,7 @@ int OpenRaider::loadConfig(const char *config) {
52 52
     return 0;
53 53
 }
54 54
 
55
-int OpenRaider::command(const char *command) {
56
-    std::string tmp(command);
57
-    return this->command(tmp);
58
-}
59
-
60
-int OpenRaider::command(std::string &c) {
55
+int OpenRaider::command(std::string c) {
61 56
     // Remove comment, if any
62 57
     size_t comment = c.find_first_of('#');
63 58
     if (comment != std::string::npos)
@@ -77,7 +72,7 @@ int OpenRaider::command(std::string &c) {
77 72
     } else if (cmd.compare("bind") == 0) {
78 73
         std::string a, b;
79 74
         if (!(command >> a >> b)) {
80
-            getConsole().print("Invalid use of bind-command");
75
+            getConsole() << "Invalid use of bind-command" << Console::endl;
81 76
             return -1;
82 77
         } else {
83 78
             return bind(a.c_str(), b.c_str());
@@ -86,7 +81,7 @@ int OpenRaider::command(std::string &c) {
86 81
         exit(0);
87 82
     } else if (cmd.compare("load") == 0) {
88 83
         if (!mRunning) {
89
-            getConsole().print("Use load command interactively!");
84
+            getConsole() << "Use load command interactively!" << Console::endl;
90 85
             return -999;
91 86
         }
92 87
         std::string temp;
@@ -96,37 +91,37 @@ int OpenRaider::command(std::string &c) {
96 91
     } else if (cmd.compare("help") == 0) {
97 92
         std::string tmp;
98 93
         if (!(command >> tmp)) {
99
-            getConsole().print("Available commands:");
100
-            getConsole().print("  load      - load a level");
101
-            getConsole().print("  set       - set a parameter");
102
-            getConsole().print("  bind      - bind a keyboard/mouse action");
103
-            getConsole().print("  animate   - [BOOL|n|p] - Animate models");
104
-            getConsole().print("  move      - [walk|fly|noclip]");
94
+            getConsole() << "Available commands:" << Console::endl;
95
+            getConsole() << "  load      - load a level" << Console::endl;
96
+            getConsole() << "  set       - set a parameter" << Console::endl;
97
+            getConsole() << "  bind      - bind a keyboard/mouse action" << Console::endl;
98
+            getConsole() << "  animate   - [BOOL|n|p] - Animate models" << Console::endl;
99
+            getConsole() << "  move      - [walk|fly|noclip]" << Console::endl;
105 100
 /*
106
-            getConsole().print("  sshot     - make a screenshot");
107
-            getConsole().print("  sound     - INT - Test play sound");
108
-            getConsole().print("  mode      - MODE - Render mode");
109
-            getConsole().print("  light     - BOOL - GL Lights");
110
-            getConsole().print("  fog       - BOOL - GL Fog");
111
-            getConsole().print("  viewmodel - INT - Change Laras model");
112
-            getConsole().print("  pos       - Print position info");
113
-            getConsole().print("  ralpha    - BOOL - Room Alpha");
114
-            getConsole().print("  upf       - BOOL - Update Room List Per Frame");
115
-            getConsole().print("  entmodel  - BOOL");
116
-            getConsole().print("  ponytail  - BOOL");
117
-            getConsole().print("  pigtail   - BOOL");
118
-            getConsole().print("  ponypos   - FLOAT FLOAT FLOAT FLOAT - x y z angle");
101
+            getConsole() << "  sshot     - make a screenshot" << Console::endl;
102
+            getConsole() << "  sound     - INT - Test play sound" << Console::endl;
103
+            getConsole() << "  mode      - MODE - Render mode" << Console::endl;
104
+            getConsole() << "  light     - BOOL - GL Lights" << Console::endl;
105
+            getConsole() << "  fog       - BOOL - GL Fog" << Console::endl;
106
+            getConsole() << "  viewmodel - INT - Change Laras model" << Console::endl;
107
+            getConsole() << "  pos       - Print position info" << Console::endl;
108
+            getConsole() << "  ralpha    - BOOL - Room Alpha" << Console::endl;
109
+            getConsole() << "  upf       - BOOL - Update Room List Per Frame" << Console::endl;
110
+            getConsole() << "  entmodel  - BOOL" << Console::endl;
111
+            getConsole() << "  ponytail  - BOOL" << Console::endl;
112
+            getConsole() << "  pigtail   - BOOL" << Console::endl;
113
+            getConsole() << "  ponypos   - FLOAT FLOAT FLOAT FLOAT - x y z angle" << Console::endl;
119 114
 */
120
-            getConsole().print("  help      - print command help");
121
-            getConsole().print("  quit      - exit OpenRaider");
122
-            getConsole().print("Use help COMMAND to get additional info");
123
-            getConsole().print("Pass BOOLs as true or false");
115
+            getConsole() << "  help      - print command help" << Console::endl;
116
+            getConsole() << "  quit      - exit OpenRaider" << Console::endl;
117
+            getConsole() << "Use help COMMAND to get additional info" << Console::endl;
118
+            getConsole() << "Pass BOOLs as true or false" << Console::endl;
124 119
         } else {
125 120
             return help(tmp);
126 121
         }
127 122
     } else if (cmd.compare("animate") == 0) {
128 123
         if ((!mRunning) || (!getGame().isLoaded())) {
129
-            getConsole().print("Use animate command interactively!");
124
+            getConsole() << "Use animate command interactively!" << Console::endl;
130 125
             return -999;
131 126
         }
132 127
         if (command.peek() == 'n') {
@@ -141,7 +136,7 @@ int OpenRaider::command(std::string &c) {
141 136
                         e.setAnimation(0);
142 137
                 }
143 138
             } else {
144
-                getConsole().print("Animations need to be enabled!");
139
+                getConsole() << "Animations need to be enabled!" << Console::endl;
145 140
             }
146 141
         } else if (command.peek() == 'p') {
147 142
             // Step all skeletal models to their previous animation
@@ -156,24 +151,24 @@ int OpenRaider::command(std::string &c) {
156 151
                             e.setAnimation(m.size() - 1);
157 152
                 }
158 153
             } else {
159
-                getConsole().print("Animations need to be enabled!");
154
+                getConsole() << "Animations need to be enabled!" << Console::endl;
160 155
             }
161 156
         } else {
162 157
             // Enable or disable animating all skeletal models
163 158
             bool b = false;
164 159
             if (!(command >> b)) {
165
-                getConsole().print("Pass BOOL to animate command!");
160
+                getConsole() << "Pass BOOL to animate command!" << Console::endl;
166 161
                 return -2;
167 162
             }
168 163
             if (b)
169 164
                 getRender().setFlags(Render::fAnimateAllModels);
170 165
             else
171 166
                 getRender().clearFlags(Render::fAnimateAllModels);
172
-            getConsole().print(b ? "Animating all models" : "No longer animating all models");
167
+            getConsole() << (b ? "Animating all models" : "No longer animating all models") << Console::endl;
173 168
         }
174 169
     } else if (cmd.compare("move") == 0) {
175 170
         if ((!mRunning) || (!getGame().isLoaded())) {
176
-            getConsole().print("Use move command interactively!");
171
+            getConsole() << "Use move command interactively!" << Console::endl;
177 172
             return -999;
178 173
         }
179 174
         std::string temp;
@@ -185,10 +180,10 @@ int OpenRaider::command(std::string &c) {
185 180
         } else if (temp.compare("noclip") == 0) {
186 181
             getGame().getLara().setMoveType(Entity::MoveTypeNoClipping);
187 182
         } else {
188
-            getConsole().print("Invalid use of move command (%s)!", temp.c_str());
183
+            getConsole() << "Invalid use of move command (" << temp.c_str() << ")!" << Console::endl;
189 184
             return -9;
190 185
         }
191
-        getConsole().print("%sing", temp.c_str());
186
+        getConsole() << temp.c_str()  << "ing" << Console::endl;
192 187
 
193 188
 /*
194 189
     } else if (cmd.compare("mode") == 0) {
@@ -398,7 +393,7 @@ int OpenRaider::command(std::string &c) {
398 393
         }
399 394
 */
400 395
     } else {
401
-        getConsole().print("Unknown command: %s", cmd.c_str());
396
+        getConsole() << "Unknown command: " << cmd.c_str() << Console::endl;
402 397
         return -50;
403 398
     }
404 399
 
@@ -407,43 +402,43 @@ int OpenRaider::command(std::string &c) {
407 402
 
408 403
 int OpenRaider::help(std::string &cmd) {
409 404
     if (cmd.compare("set") == 0) {
410
-        getConsole().print("set-Command Usage:");
411
-        getConsole().print("  set VAR VAL");
412
-        getConsole().print("Available Variables:");
413
-        getConsole().print("  basedir    STRING");
414
-        getConsole().print("  pakdir     STRING");
415
-        getConsole().print("  audiodir   STRING");
416
-        getConsole().print("  datadir    STRING");
417
-        getConsole().print("  font       STRING");
418
-        getConsole().print("  size       INT INT");
419
-        getConsole().print("  fullscreen BOOL");
420
-        getConsole().print("  audio      BOOL");
421
-        getConsole().print("  volume     BOOL");
422
-        getConsole().print("  mouse_x    FLOAT");
423
-        getConsole().print("  mouse_y    FLOAT");
424
-        getConsole().print("  fps        BOOL");
425
-        getConsole().print("Enclose STRINGs with \"\"!");
405
+        getConsole() << "set-Command Usage:" << Console::endl;
406
+        getConsole() << "  set VAR VAL" << Console::endl;
407
+        getConsole() << "Available Variables:" << Console::endl;
408
+        getConsole() << "  basedir    STRING" << Console::endl;
409
+        getConsole() << "  pakdir     STRING" << Console::endl;
410
+        getConsole() << "  audiodir   STRING" << Console::endl;
411
+        getConsole() << "  datadir    STRING" << Console::endl;
412
+        getConsole() << "  font       STRING" << Console::endl;
413
+        getConsole() << "  size       INT INT" << Console::endl;
414
+        getConsole() << "  fullscreen BOOL" << Console::endl;
415
+        getConsole() << "  audio      BOOL" << Console::endl;
416
+        getConsole() << "  volume     BOOL" << Console::endl;
417
+        getConsole() << "  mouse_x    FLOAT" << Console::endl;
418
+        getConsole() << "  mouse_y    FLOAT" << Console::endl;
419
+        getConsole() << "  fps        BOOL" << Console::endl;
420
+        getConsole() << "Enclose STRINGs with \"\"!" << Console::endl;
426 421
     } else if (cmd.compare("bind") == 0) {
427
-        getConsole().print("bind-Command Usage:");
428
-        getConsole().print("  bind ACTION KEY");
429
-        getConsole().print("Available Actions:");
430
-        getConsole().print("  menu");
431
-        getConsole().print("  console");
432
-        getConsole().print("  forward");
433
-        getConsole().print("  backward");
434
-        getConsole().print("  left");
435
-        getConsole().print("  right");
436
-        getConsole().print("  jump");
437
-        getConsole().print("  crouch");
438
-        getConsole().print("  use");
439
-        getConsole().print("  holster");
440
-        getConsole().print("  walk");
441
-        getConsole().print("Key-Format:");
442
-        getConsole().print("  'a' or '1'    for character/number keys");
443
-        getConsole().print("  \"leftctrl\"  for symbols and special keys");
422
+        getConsole() << "bind-Command Usage:" << Console::endl;
423
+        getConsole() << "  bind ACTION KEY" << Console::endl;
424
+        getConsole() << "Available Actions:" << Console::endl;
425
+        getConsole() << "  menu" << Console::endl;
426
+        getConsole() << "  console" << Console::endl;
427
+        getConsole() << "  forward" << Console::endl;
428
+        getConsole() << "  backward" << Console::endl;
429
+        getConsole() << "  left" << Console::endl;
430
+        getConsole() << "  right" << Console::endl;
431
+        getConsole() << "  jump" << Console::endl;
432
+        getConsole() << "  crouch" << Console::endl;
433
+        getConsole() << "  use" << Console::endl;
434
+        getConsole() << "  holster" << Console::endl;
435
+        getConsole() << "  walk" << Console::endl;
436
+        getConsole() << "Key-Format:" << Console::endl;
437
+        getConsole() << "  'a' or '1'    for character/number keys" << Console::endl;
438
+        getConsole() << "  \"leftctrl\"  for symbols and special keys" << Console::endl;
444 439
     } else if (cmd.compare("load") == 0) {
445
-        getConsole().print("load-Command Usage:");
446
-        getConsole().print("  load /path/to/level");
440
+        getConsole() << "load-Command Usage:" << Console::endl;
441
+        getConsole() << "  load /path/to/level" << Console::endl;
447 442
 /*
448 443
     } else if (cmd.compare("sshot") == 0) {
449 444
         getConsole().print("sshot-Command Usage:");
@@ -471,14 +466,14 @@ int OpenRaider::help(std::string &cmd) {
471 466
         getConsole().print("  titlescreen");
472 467
 */
473 468
     } else if (cmd.compare("animate") == 0) {
474
-        getConsole().print("animate-Command Usage:");
475
-        getConsole().print("  animate [n|p|BOOL]");
476
-        getConsole().print("Where the commands have the following meaning:");
477
-        getConsole().print("  BOOL to (de)activate animating all models");
478
-        getConsole().print("  n to step all models to their next animation");
479
-        getConsole().print("  p to step all models to their previous animation");
469
+        getConsole() << "animate-Command Usage:" << Console::endl;
470
+        getConsole() << "  animate [n|p|BOOL]" << Console::endl;
471
+        getConsole() << "Where the commands have the following meaning:" << Console::endl;
472
+        getConsole() << "  BOOL to (de)activate animating all models" << Console::endl;
473
+        getConsole() << "  n to step all models to their next animation" << Console::endl;
474
+        getConsole() << "  p to step all models to their previous animation" << Console::endl;
480 475
     } else {
481
-        getConsole().print("No help available for %s", cmd.c_str());
476
+        getConsole() << "No help available for " << cmd.c_str() << Console::endl;
482 477
         return -1;
483 478
     }
484 479
 
@@ -536,49 +531,49 @@ int OpenRaider::set(std::istream &command) {
536 531
     if (var.compare("size") == 0) {
537 532
         unsigned int w = DEFAULT_WIDTH, h = DEFAULT_HEIGHT;
538 533
         if (!(command >> w >> h)) {
539
-            getConsole().print("set-size-Error: Invalid value(s)");
534
+            getConsole() << "set-size-Error: Invalid value(s)" << Console::endl;
540 535
             return -2;
541 536
         }
542 537
         getWindow().setSize(w, h);
543 538
     } else if (var.compare("fullscreen") == 0) {
544 539
         bool fullscreen = false;
545 540
         if (!(command >> fullscreen)) {
546
-            getConsole().print("set-fullscreen-Error: Invalid value");
541
+            getConsole() << "set-fullscreen-Error: Invalid value" << Console::endl;
547 542
             return -3;
548 543
         }
549 544
         getWindow().setFullscreen(fullscreen);
550 545
     } else if (var.compare("audio") == 0) {
551 546
         bool audio = false;
552 547
         if (!(command >> audio)) {
553
-            getConsole().print("set-audio-Error: Invalid value");
548
+            getConsole() << "set-audio-Error: Invalid value" << Console::endl;
554 549
             return -4;
555 550
         }
556 551
         getSound().setEnabled(audio);
557 552
     } else if (var.compare("volume") == 0) {
558 553
         float vol = 1.0f;
559 554
         if (!(command >> vol)) {
560
-            getConsole().print("set-volume-Error: Invalid value");
555
+            getConsole() << "set-volume-Error: Invalid value" << Console::endl;
561 556
             return -5;
562 557
         }
563 558
         getSound().setVolume(vol);
564 559
     } else if (var.compare("mouse_x") == 0) {
565 560
         float sense = 1.0f;
566 561
         if (!(command >> sense)) {
567
-            getConsole().print("set-mouse_x-Error: Invalid value");
562
+            getConsole() << "set-mouse_x-Error: Invalid value" << Console::endl;
568 563
             return -6;
569 564
         }
570 565
         getCamera().setSensitivityX(OR_DEG_TO_RAD(sense));
571 566
     } else if (var.compare("mouse_y") == 0) {
572 567
         float sense = 1.0f;
573 568
         if (!(command >> sense)) {
574
-            getConsole().print("set-mouse_y-Error: Invalid value");
569
+            getConsole() << "set-mouse_y-Error: Invalid value" << Console::endl;
575 570
             return -7;
576 571
         }
577 572
         getCamera().setSensitivityY(OR_DEG_TO_RAD(sense));
578 573
     } else if (var.compare("fps") == 0) {
579 574
         bool fps = false;
580 575
         if (!(command >> fps)) {
581
-            getConsole().print("set-fps-Error: Invalid value");
576
+            getConsole() << "set-fps-Error: Invalid value" << Console::endl;
582 577
             return -8;
583 578
         }
584 579
         mFPS = fps;
@@ -600,7 +595,7 @@ int OpenRaider::set(std::istream &command) {
600 595
         delete [] tmp;
601 596
         delete [] quotes;
602 597
     } else {
603
-        getConsole().print("set-Error: Unknown variable (%s)", var.c_str());
598
+        getConsole() << "set-Error: Unknown variable (" << var.c_str() << ")" << Console::endl;
604 599
         return -1;
605 600
     }
606 601
 
@@ -615,13 +610,13 @@ int OpenRaider::bind(const char *action, const char *key) {
615 610
 
616 611
     ActionEvents e = stringToActionEvent(action);
617 612
     if (e == ActionEventCount) {
618
-        getConsole().print("bind-Error: Unknown action (%s --> %s)", key, action);
613
+        getConsole() << "bind-Error: Unknown action (" << key << " --> " << action << ")" << Console::endl;
619 614
         return -1;
620 615
     }
621 616
 
622 617
     KeyboardButton c = stringToKeyboardButton(key);
623 618
     if (c == unknownKey) {
624
-        getConsole().print("bind-Error: Unknown key (%s)", key);
619
+        getConsole() << "bind-Error: Unknown key (" << key << ")" << Console::endl;
625 620
         return -2;
626 621
     }
627 622
 

+ 3
- 31
src/Console.cpp View File

@@ -31,34 +31,6 @@ bool Console::isVisible() {
31 31
     return mVisible;
32 32
 }
33 33
 
34
-template<typename T>
35
-Console &Console::operator<<(T t) {
36
-    printBuffer << t;
37
-
38
-    if (printBuffer.str().back() == '\n') {
39
-        mHistory.push_back(printBuffer.str().substr(0, printBuffer.str().length() - 1));
40
-#ifdef DEBUG
41
-        std::cout << printBuffer.str().substr(0, printBuffer.str().length() - 1) << std::endl;
42
-#endif
43
-        printBuffer.str("");
44
-    }
45
-
46
-    return (*this);
47
-}
48
-
49
-// Deprecated!
50
-void Console::print(const char *s, ...) {
51
-    va_list args;
52
-    va_start(args, s);
53
-    char *tmp = bufferString(s, args);
54
-    va_end(args);
55
-
56
-    if (tmp != nullptr)
57
-        (*this) << tmp << endl;
58
-
59
-    delete [] tmp;
60
-}
61
-
62 34
 #define LINE_GEOMETRY(window) \
63 35
     unsigned int firstLine = 35; \
64 36
     unsigned int lastLine = (window.getHeight() / 2) - 55; \
@@ -120,14 +92,14 @@ void Console::handleKeyboard(KeyboardButton key, bool pressed) {
120 92
     if (pressed && (key == enterKey)) {
121 93
         // Execute entered command
122 94
         if (mInputBuffer.length() > 0) {
123
-            print("> %s", mInputBuffer.c_str());
95
+            (*this) << "> " << mInputBuffer.c_str() << endl;
124 96
             mCommandHistory.push_back(mInputBuffer.c_str());
125 97
             int error = getOpenRaider().command(mInputBuffer);
126 98
             if (error != 0) {
127
-                print("Error Code: %d", error);
99
+                (*this) << "Error Code: " << error << endl;
128 100
             }
129 101
         } else {
130
-            print("> ");
102
+            (*this) << "> " << endl;
131 103
         }
132 104
 
133 105
         // Clear partial and input buffer

+ 7
- 5
src/Entity.cpp View File

@@ -117,7 +117,7 @@ void Entity::move(char movement) {
117 117
                 x, y, z);
118 118
 
119 119
         if (roomNew > -1)
120
-            getConsole().print("Crossing from room %li to %li", room, roomNew);
120
+            getConsole() << "Crossing from room " << room << " to " << roomNew << Console::endl;
121 121
         else
122 122
             //! \fixme mRooms, sectors, ... are now std::vector, but often upper bound checks are missing
123 123
             return;
@@ -213,10 +213,12 @@ void Entity::move(char movement) {
213 213
 }
214 214
 
215 215
 void Entity::print() {
216
-    getConsole().print("Entity %d:", objectId);
217
-    getConsole().print("  Room %li (0x%X)", room, getWorld().getRoom(room).getFlags());
218
-    getConsole().print("  %.1fx %.1fy %.1fz", pos[0], pos[1], pos[2]);
219
-    getConsole().print("  %.1f Yaw", OR_RAD_TO_DEG(angles[1]));
216
+    getConsole() << "Entity " << objectId << ":" << Console::endl
217
+        << "  Room " << room << " (" << getWorld().getRoom(room).getFlags()
218
+        << ")" << Console::endl
219
+        << "  " << pos[0] << "x " << pos[1] << "y " << pos[2] << "z"
220
+        << Console::endl
221
+        << "  " << OR_RAD_TO_DEG(angles[1]) << " Yaw" << Console::endl;
220 222
 }
221 223
 
222 224
 SkeletalModel &Entity::getModel() {

+ 9
- 9
src/Game.cpp View File

@@ -80,7 +80,7 @@ int Game::loadLevel(const char *level) {
80 80
 
81 81
     mName = bufferString("%s", level);
82 82
 
83
-    getConsole().print("Loading %s", mName);
83
+    getConsole() << "Loading " << mName << Console::endl;
84 84
     int error = mTombRaider.Load(mName);
85 85
     if (error != 0)
86 86
         return error;
@@ -100,7 +100,7 @@ int Game::loadLevel(const char *level) {
100 100
         tmp[dir + 8] = '\0';
101 101
         error = mTombRaider.loadSFX(tmp);
102 102
         if (error != 0)
103
-            getConsole().print("Could not load %s", tmp);
103
+            getConsole() << "Could not load " << tmp << Console::endl;
104 104
         delete [] tmp;
105 105
     }
106 106
 
@@ -115,7 +115,7 @@ int Game::loadLevel(const char *level) {
115 115
     mTombRaider.reset();
116 116
 
117 117
     if (mLara == -1) {
118
-        getConsole().print("Can't find Lara entity in level pak!");
118
+        getConsole() << "Can't find Lara entity in level pak!" << Console::endl;
119 119
         destroy();
120 120
         return -1;
121 121
     } else {
@@ -190,21 +190,21 @@ void Game::processSprites() {
190 190
         }
191 191
     }
192 192
 
193
-    getConsole().print("Found %d sprites.", mTombRaider.NumSpriteSequences());
193
+    getConsole() << "Found " << mTombRaider.NumSpriteSequences() << " sprites." << Console::endl;
194 194
 }
195 195
 
196 196
 void Game::processRooms() {
197 197
     for (int index = 0; index < mTombRaider.NumRooms(); index++)
198 198
         getWorld().addRoom(*new Room(mTombRaider, index));
199 199
 
200
-    getConsole().print("Found %d rooms.", mTombRaider.NumRooms());
200
+    getConsole() << "Found " << mTombRaider.NumRooms() << " rooms." << Console::endl;
201 201
 }
202 202
 
203 203
 void Game::processModels() {
204 204
     for (int index = 0; index < mTombRaider.getMeshCount(); index++)
205 205
         getWorld().addStaticMesh(*new StaticMesh(mTombRaider, index));
206 206
 
207
-    getConsole().print("Found %d meshes.", mTombRaider.getMeshCount());
207
+    getConsole() << "Found " << mTombRaider.getMeshCount() << " meshes." << Console::endl;
208 208
 }
209 209
 
210 210
 void Game::processPakSounds()
@@ -246,7 +246,7 @@ void Game::processPakSounds()
246 246
         //getSound().SourceAt(id, pos);
247 247
     }
248 248
 
249
-    getConsole().print("Found %u sound samples.", mTombRaider.getSoundSamplesCount());
249
+    getConsole() << "Found " << mTombRaider.getSoundSamplesCount() << " sound samples." << Console::endl;
250 250
 }
251 251
 
252 252
 void Game::processTextures()
@@ -290,7 +290,7 @@ void Game::processTextures()
290 290
 
291 291
     mTextureOffset = (mTextureStart - 1) + mTombRaider.NumTextures();
292 292
 
293
-    getConsole().print("Found %d textures.", mTombRaider.NumTextures());
293
+    getConsole() << "Found " << mTombRaider.NumTextures() << " textures." << Console::endl;
294 294
 }
295 295
 
296 296
 void Game::processMoveables()
@@ -375,7 +375,7 @@ void Game::processMoveables()
375 375
     }
376 376
     */
377 377
 
378
-    getConsole().print("Found %d moveables.", mTombRaider.NumMoveables() + statCount);
378
+    getConsole() << "Found " << mTombRaider.NumMoveables() + statCount << " moveables." << Console::endl;
379 379
 }
380 380
 
381 381
 // index moveable, i item, sometimes both moveable

+ 2
- 2
src/Menu.cpp View File

@@ -57,8 +57,8 @@ int Menu::initialize(Folder *folder) {
57 57
         // Check maps for validity
58 58
         int error = TombRaider::checkMime(f.getPath().c_str());
59 59
         if (error != 0) {
60
-            getConsole().print("Error: pak file '%s' %s",
61
-                    f.getName().c_str(), (error == -1) ? "not found" : "invalid");
60
+            getConsole() << "Error: pak file '" << f.getName().c_str()
61
+                << "' " << ((error == -1) ? "not found" : "invalid") << Console::endl;
62 62
             return true; // delete file from list
63 63
         }
64 64
 

+ 5
- 7
src/Room.cpp View File

@@ -24,9 +24,7 @@ Room::Room(TombRaider &tr, unsigned int index) {
24 24
     Matrix transform;
25 25
 
26 26
     if (!tr.isRoomValid(index)) {
27
-        getConsole().print("WARNING: Handling invalid vertex array in room");
28
-        //printf("x");
29
-        //fflush(stdout);
27
+        getConsole() << "WARNING: Handling invalid vertex array in room" << Console::endl;
30 28
         return;
31 29
     }
32 30
 
@@ -170,8 +168,8 @@ Room::Room(TombRaider &tr, unsigned int index) {
170 168
 
171 169
         if (texture > (int)TextureLimit)
172 170
         {
173
-            getConsole().print("Handling bad room[%i].tris[%i].texture = %i",
174
-                    index, t, texture);
171
+            getConsole() << "Handling bad room[" << index << "].tris["
172
+                << t << "].texture = " << texture << Console::endl;
175 173
             texture = TextureLimit - 1;
176 174
         }
177 175
 
@@ -204,8 +202,8 @@ Room::Room(TombRaider &tr, unsigned int index) {
204 202
 
205 203
         if (texture > (int)TextureLimit)
206 204
         {
207
-            getConsole().print("Handling bad room[%i].quad[%i].texture = %i",
208
-                    index, r, texture);
205
+            getConsole() << "Handling bad room[" << index << "].quad["
206
+                << r << "].texture = " << texture << Console::endl;
209 207
             texture = TextureLimit - 1;
210 208
         }
211 209
 

+ 6
- 5
src/SkeletalModel.cpp View File

@@ -137,8 +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().print("WARNING: Bad animation frame %i > %i (%u.%d)",
141
-                    *frame_offset, tr.NumFrames(), index, a);
140
+            getConsole() << "WARNING: Bad animation frame " << *frame_offset
141
+                << " > " << tr.NumFrames() << " (" << index << "." << a << ")"
142
+                << Console::endl;
142 143
             return;
143 144
         }
144 145
 
@@ -200,7 +201,7 @@ SkeletalModel::SkeletalModel(TombRaider &tr, unsigned int index, int objectId) {
200 201
                 }
201 202
 
202 203
                 getRender().setFlags(Render::fRenderPonytail);
203
-                getConsole().print("Found known ponytail");
204
+                getConsole() << "Found known ponytail" << Console::endl;
204 205
             }
205 206
             break;
206 207
 
@@ -222,7 +223,7 @@ SkeletalModel::SkeletalModel(TombRaider &tr, unsigned int index, int objectId) {
222 223
                 ponyOff2 = 0;
223 224
 
224 225
                 getRender().setFlags(Render::fRenderPonytail);
225
-                getConsole().print("Found ponytail?");
226
+                getConsole() << "Found ponytail?" << Console::endl;
226 227
             }
227 228
             break;
228 229
     }
@@ -246,7 +247,7 @@ SkeletalModel::SkeletalModel(TombRaider &tr, unsigned int index, int objectId) {
246 247
         frame_offset += frame_step * (frame_cycle % a);
247 248
 
248 249
     if (a < 0) {
249
-        getConsole().print("Invalid animation data for model %d. Skip!", index);
250
+        getConsole() << "Invalid animation data for model " << index << ". Skip!" << Console::endl;
250 251
         return;
251 252
     } else {
252 253
         for (; a < tr.getNumAnimsForMoveable(index); a++) {

+ 2
- 2
src/TextureManager.cpp View File

@@ -198,7 +198,7 @@ int TextureManager::loadImage(const char *filename) {
198 198
     } else if (stringEndsWith(filename, ".tga") || stringEndsWith(filename, ".TGA")) {
199 199
         return loadTGA(filename);
200 200
     } else {
201
-        getConsole().print("No known image file type? (%s)", filename);
201
+        getConsole() << "No known image file type? (" << filename << ")" << Console::endl;
202 202
     }
203 203
 
204 204
     return -1;
@@ -254,7 +254,7 @@ int TextureManager::loadPNG(const char *filename) {
254 254
 
255 255
     return id;
256 256
 #else
257
-    getConsole().print("No PNG support available (%s)", filename);
257
+    getConsole() << "No PNG support available (" << filename << ")" << Console::endl;
258 258
     return -1;
259 259
 #endif
260 260
 }

+ 2
- 4
src/main.cpp View File

@@ -133,7 +133,7 @@ int main(int argc, char *argv[]) {
133 133
     }
134 134
 
135 135
 #ifdef DEBUG
136
-    getConsole().print("Initializing %s", VERSION);
136
+    getConsole() << "Initializing " << VERSION << Console::endl;
137 137
 #endif
138 138
 
139 139
     atexit(cleanupHandler);
@@ -146,7 +146,7 @@ int main(int argc, char *argv[]) {
146 146
 
147 147
     command_free(&cmd);
148 148
 
149
-    getConsole().print("Starting %s", VERSION);
149
+    getConsole() << "Starting " << VERSION << Console::endl;
150 150
     getOpenRaider().run();
151 151
 
152 152
     return 0;
@@ -176,7 +176,6 @@ ActionEvents stringToActionEvent(const char *action) {
176 176
     } else if (strcmp(action, "walk") == 0) {
177 177
         return walkAction;
178 178
     } else {
179
-        getConsole().print("Unknown action: \"%s\"", action);
180 179
         return ActionEventCount;
181 180
     }
182 181
 }
@@ -361,7 +360,6 @@ KeyboardButton stringToKeyboardButton(const char *key) {
361 360
         delete [] tmp;
362 361
     }
363 362
 
364
-    getConsole().print("Unknown key: %s", key);
365 363
     return unknownKey;
366 364
 }
367 365
 

+ 20
- 20
src/utils/pcx.cpp View File

@@ -9,13 +9,11 @@
9 9
  */
10 10
 
11 11
 #include <fstream>
12
+#include <iostream>
12 13
 
13 14
 #include "global.h"
14 15
 #include "utils/pcx.h"
15 16
 
16
-#include "Console.h"
17
-#define pcxPrint getConsole().print
18
-
19 17
 int pcxCheck(const char *filename) {
20 18
     assert(filename != NULL);
21 19
     assert(filename[0] != '\0');
@@ -27,38 +25,38 @@ int pcxCheck(const char *filename) {
27 25
 
28 26
     // Basic validation
29 27
     if (!file.read((char *)(&header[0]), 128)) {
30
-        pcxPrint("File not big enough for valid PCX header!");
28
+        std::cout << "File not big enough for valid PCX header!" << std::endl;
31 29
         delete [] header;
32 30
         return -1;
33 31
     }
34 32
 
35 33
     if (header[0] != 0x0A) {
36
-        pcxPrint("Magic number at file start is wrong (0x%X != 0x0A)", header[0]);
34
+        std::cout << "Magic number at file start is wrong (" << header[0] << " != 0x0A)" << std::endl;
37 35
         delete [] header;
38 36
         return -2;
39 37
     }
40 38
 
41 39
     if ((header[1] != 0) && ((header[1] < 2) || (header[1] > 5))) {
42 40
         // Valid: 0, 2, 3, 4, 5
43
-        pcxPrint("Unknown PCX file format version (%d)", header[1]);
41
+        std::cout << "Unknown PCX file format version (" << header[1] << ")" << std::endl;
44 42
         delete [] header;
45 43
         return -3;
46 44
     }
47 45
 
48 46
     if ((header[2] != 0) && (header[2] != 1)) {
49
-        pcxPrint("Unknown PCX file encoding (%d)", header[2]);
47
+        std::cout << "Unknown PCX file encoding (" << header[2] << ")" << std::endl;
50 48
         delete [] header;
51 49
         return -4;
52 50
     }
53 51
 
54 52
     if (header[3] != 8) {
55
-        pcxPrint("Only supporting 8bit (%dbit)", header[3]);
53
+        std::cout << "Only supporting 8bit (" << header[3] << "bit)" << std::endl;
56 54
         delete [] header;
57 55
         return -5;
58 56
     }
59 57
 
60 58
     if (header[64] != 0) {
61
-        pcxPrint("Reserved field is  used (%d != 0)", header[64]);
59
+        std::cout << "Reserved field is  used (" << header[64] << " != 0)" << std::endl;
62 60
         delete [] header;
63 61
         return -6;
64 62
     }
@@ -84,38 +82,38 @@ int pcxLoad(const char *filename, unsigned char **image,
84 82
 
85 83
     // Basic validation
86 84
     if (!file.read((char *)(&header[0]), 128)) {
87
-        pcxPrint("File not big enough for valid PCX header!");
85
+        std::cout << "File not big enough for valid PCX header!" << std::endl;
88 86
         delete [] header;
89 87
         return -1;
90 88
     }
91 89
 
92 90
     if (header[0] != 0x0A) {
93
-        pcxPrint("Magic number at file start is wrong (0x%X != 0x0A)", header[0]);
91
+        std::cout << "Magic number at file start is wrong (" << header[0] << " != 0x0A)" << std::endl;
94 92
         delete [] header;
95 93
         return -2;
96 94
     }
97 95
 
98 96
     if ((header[1] != 0) && ((header[1] < 2) || (header[1] > 5))) {
99 97
         // Valid: 0, 2, 3, 4, 5
100
-        pcxPrint("Unknown PCX file format version (%d)", header[1]);
98
+        std::cout << "Unknown PCX file format version (" << header[1] << ")" << std::endl;
101 99
         delete [] header;
102 100
         return -3;
103 101
     }
104 102
 
105 103
     if ((header[2] != 0) && (header[2] != 1)) {
106
-        pcxPrint("Unknown PCX file encoding (%d)", header[2]);
104
+        std::cout << "Unknown PCX file encoding (" << header[2] << ")" << std::endl;
107 105
         delete [] header;
108 106
         return -4;
109 107
     }
110 108
 
111 109
     if (header[3] != 8) {
112
-        pcxPrint("Only supporting 8bit (%dbit)", header[3]);
110
+        std::cout << "Only supporting 8bit (" << header[3] << "bit)" << std::endl;
113 111
         delete [] header;
114 112
         return -5;
115 113
     }
116 114
 
117 115
     if (header[64] != 0) {
118
-        pcxPrint("Reserved field is  used (%d != 0)", header[64]);
116
+        std::cout << "Reserved field is  used (" << header[64] << " != 0)" << std::endl;
119 117
         delete [] header;
120 118
         return -6;
121 119
     }
@@ -152,7 +150,8 @@ int pcxLoad(const char *filename, unsigned char **image,
152 150
         unsigned int n = 1; // Run-length-encoding assumes 1
153 151
         int c = file.get();
154 152
         if (!file) {
155
-            pcxPrint("Could not read data (%lu%s)", i, (file.eof() ? " EOF" : ""));
153
+            std::cout << "Could not read data (" << i
154
+                << (file.eof() ? " EOF" : "") << ")" << std::endl;
156 155
             delete [] buffer;
157 156
             return -7;
158 157
         }
@@ -163,7 +162,8 @@ int pcxLoad(const char *filename, unsigned char **image,
163 162
                 n = c & 0x3F;
164 163
                 c = file.get();
165 164
                 if (!file) {
166
-                    pcxPrint("Could not read data rle (%lu%s)", i, (file.eof() ? " EOF" : ""));
165
+                    std::cout << "Could not read data rle (" << i
166
+                        << (file.eof() ? " EOF" : "") << ")" << std::endl;
167 167
                     delete [] buffer;
168 168
                     return -8;
169 169
                 }
@@ -185,7 +185,7 @@ int pcxLoad(const char *filename, unsigned char **image,
185 185
             for (unsigned int i = 0; i < 768; i++) {
186 186
                 palette[i] = (unsigned char)file.get();
187 187
                 if (!file) {
188
-                    pcxPrint("Could not read 256 color palette (%d)", i);
188
+                    std::cout << "Could not read 256 color palette (" << i << ")" << std::endl;
189 189
                     delete [] buffer;
190 190
                     delete [] palette;
191 191
                     return -9;
@@ -208,7 +208,7 @@ int pcxLoad(const char *filename, unsigned char **image,
208 208
                     green = palette[(buffer[(y * totalBytes) + x] * 3) + 1];
209 209
                     blue = palette[(buffer[(y * totalBytes) + x] * 3) + 2];
210 210
                 } else {
211
-                    pcxPrint("Unsupported number of planes (%d)", nPlanes);
211
+                    std::cout << "Unsupported number of planes (" << nPlanes << ")" << std::endl;
212 212
                     delete [] buffer;
213 213
                     delete [] palette;
214 214
                     delete [] *image;
@@ -225,7 +225,7 @@ int pcxLoad(const char *filename, unsigned char **image,
225 225
                 } else if (nPlanes == 1) {
226 226
                     red = green = blue = buffer[(y * totalBytes) + x];
227 227
                 } else {
228
-                    pcxPrint("Unsupported number of planes (%d)", nPlanes);
228
+                    std::cout << "Unsupported number of planes (" << nPlanes << ")" << std::endl;
229 229
                     delete [] buffer;
230 230
                     delete [] palette;
231 231
                     delete [] *image;

+ 19
- 21
src/utils/png.cpp View File

@@ -10,14 +10,12 @@
10 10
 
11 11
 #include <png.h>
12 12
 #include <cstdio>
13
+#include <iostream>
13 14
 
14 15
 #include "global.h"
15 16
 #include "utils/pixel.h"
16 17
 #include "utils/png.h"
17 18
 
18
-#include "Console.h"
19
-#define pngPrint getConsole().print
20
-
21 19
 int pngCheck(const char *filename) {
22 20
     png_byte header[8];
23 21
 
@@ -26,7 +24,7 @@ int pngCheck(const char *filename) {
26 24
 
27 25
     FILE *fp = fopen(filename, "rb");
28 26
     if (fp == NULL) {
29
-        pngPrint("Could not open %s", filename);
27
+        std::cout << "Could not open " << filename << std::endl;
30 28
         return -1;
31 29
     }
32 30
 
@@ -34,7 +32,7 @@ int pngCheck(const char *filename) {
34 32
     fclose(fp);
35 33
 
36 34
     if (png_sig_cmp(header, 0, 8)) {
37
-        pngPrint("File %s is not a PNG.", filename);
35
+        std::cout << "File " << filename << " is not a PNG." << std::endl;
38 36
         return -2;
39 37
     }
40 38
 
@@ -55,28 +53,28 @@ int pngLoad(const char *filename, unsigned char **image,
55 53
 
56 54
     FILE *fp = fopen(filename, "rb");
57 55
     if (fp == NULL) {
58
-        pngPrint("Could not open %s", filename);
56
+        std::cout << "Could not open " << filename << std::endl;
59 57
         return -1;
60 58
     }
61 59
 
62 60
     fread(header, 1, 8, fp);
63 61
 
64 62
     if (png_sig_cmp(header, 0, 8)) {
65
-        pngPrint("File %s is not a PNG.", filename);
63
+        std::cout << "File " << filename << " is not a PNG." << std::endl;
66 64
         fclose(fp);
67 65
         return -2;
68 66
     }
69 67
 
70 68
     png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
71 69
     if (!png_ptr) {
72
-        pngPrint("png_create_read_struct returned 0.");
70
+        std::cout << "png_create_read_struct returned 0." << std::endl;
73 71
         fclose(fp);
74 72
         return -3;
75 73
     }
76 74
 
77 75
     png_infop info_ptr = png_create_info_struct(png_ptr);
78 76
     if (!info_ptr) {
79
-        pngPrint("png_create_info_struct returned 0.");
77
+        std::cout << "png_create_info_struct returned 0." << std::endl;
80 78
         png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
81 79
         fclose(fp);
82 80
         return -4;
@@ -84,14 +82,14 @@ int pngLoad(const char *filename, unsigned char **image,
84 82
 
85 83
     png_infop end_info = png_create_info_struct(png_ptr);
86 84
     if (!end_info) {
87
-        pngPrint("png_create_info_struct returned 0.");
85
+        std::cout << "png_create_info_struct returned 0." << std::endl;
88 86
         png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL);
89 87
         fclose(fp);
90 88
         return -5;
91 89
     }
92 90
 
93 91
     if (setjmp(png_jmpbuf(png_ptr))) {
94
-        pngPrint("Error from libpng");
92
+        std::cout << "Error from libpng" << std::endl;
95 93
         png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
96 94
         fclose(fp);
97 95
         return -6;
@@ -111,7 +109,7 @@ int pngLoad(const char *filename, unsigned char **image,
111 109
     *height = tmpHeight;
112 110
 
113 111
     if (bit_depth != 8) {
114
-        pngPrint("%s: Unsupported bit depth %d.  Must be 8.", filename, bit_depth);
112
+        std::cout << filename << ": Unsupported bit depth " << bit_depth << ".  Must be 8." << std::endl;
115 113
         return -7;
116 114
     }
117 115
 
@@ -141,7 +139,7 @@ int pngLoad(const char *filename, unsigned char **image,
141 139
         *mode = RGBA;
142 140
         *bpp = 32;
143 141
     } else {
144
-        pngPrint("%s: Unknown libpng color type %d.", filename, color_type);
142
+        std::cout << filename << ": Unknown libpng color type " << color_type << std::endl;
145 143
         delete [] image_data;
146 144
         return -8;
147 145
     }
@@ -175,27 +173,27 @@ int pngSave(const char *filename, unsigned char *image,
175 173
 
176 174
     FILE *fp = fopen(filename, "wb");
177 175
     if (!fp) {
178
-        pngPrint("File %s could not be opened for writing", filename);
176
+        std::cout << "File " << filename << " could not be opened for writing" << std::endl;
179 177
         return -1;
180 178
     }
181 179
 
182 180
     png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
183 181
 
184 182
     if (!png_ptr) {
185
-        pngPrint("png_create_write_struct failed");
183
+        std::cout << "png_create_write_struct failed" << std::endl;
186 184
         fclose(fp);
187 185
         return -2;
188 186
     }
189 187
 
190 188
     png_infop info_ptr = png_create_info_struct(png_ptr);
191 189
     if (!info_ptr) {
192
-        pngPrint("png_create_info_struct failed");
190
+        std::cout << "png_create_info_struct failed" << std::endl;
193 191
         fclose(fp);
194 192
         return -3;
195 193
     }
196 194
 
197 195
     if (setjmp(png_jmpbuf(png_ptr))) {
198
-        pngPrint("Error during init_io");
196
+        std::cout << "Error during init_io" << std::endl;
199 197
         fclose(fp);
200 198
         return -4;
201 199
     }
@@ -203,7 +201,7 @@ int pngSave(const char *filename, unsigned char *image,
203 201
     png_init_io(png_ptr, fp);
204 202
 
205 203
     if (setjmp(png_jmpbuf(png_ptr))) {
206
-        pngPrint("Error during writing header");
204
+        std::cout << "Error during writing header" << std::endl;
207 205
         fclose(fp);
208 206
         return -5;
209 207
     }
@@ -222,7 +220,7 @@ int pngSave(const char *filename, unsigned char *image,
222 220
         }
223 221
         color_type = PNG_COLOR_TYPE_RGB_ALPHA;
224 222
     } else {
225
-        pngPrint("Error invalid color mode");
223
+        std::cout << "Error invalid color mode" << std::endl;
226 224
         fclose(fp);
227 225
         return -6;
228 226
     }
@@ -239,7 +237,7 @@ int pngSave(const char *filename, unsigned char *image,
239 237
         row_pointers[height - 1 - i] = image + (i * width * 4);
240 238
 
241 239
     if (setjmp(png_jmpbuf(png_ptr))) {
242
-        pngPrint("Error during writing bytes");
240
+        std::cout << "Error during writing bytes" << std::endl;
243 241
         delete [] row_pointers;
244 242
         fclose(fp);
245 243
         return -7;
@@ -248,7 +246,7 @@ int pngSave(const char *filename, unsigned char *image,
248 246
     png_write_image(png_ptr, row_pointers);
249 247
 
250 248
     if (setjmp(png_jmpbuf(png_ptr))) {
251
-        pngPrint("Error during end of write");
249
+        std::cout << "Error during end of write" << std::endl;
252 250
         delete [] row_pointers;
253 251
         fclose(fp);
254 252
         return -8;

Loading…
Cancel
Save