|
@@ -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
|
|