|
@@ -73,11 +73,11 @@ int OpenRaider::loadConfig(const char *config) {
|
73
|
73
|
assert(config[0] != '\0');
|
74
|
74
|
|
75
|
75
|
char *configFile = fullPath(config, 0);
|
76
|
|
- printf("Loading config from \"%s\"...\n", configFile);
|
|
76
|
+ mConsole->print("Loading config from \"%s\"...", configFile);
|
77
|
77
|
|
78
|
78
|
FILE *f = fopen(configFile, "r");
|
79
|
79
|
if (f == NULL) {
|
80
|
|
- printf("Could not open file!\n");
|
|
80
|
+ mConsole->print("Could not open file!");
|
81
|
81
|
return -1;
|
82
|
82
|
}
|
83
|
83
|
|
|
@@ -132,7 +132,7 @@ int OpenRaider::command(const char *command, std::vector<char *> *args) {
|
132
|
132
|
|
133
|
133
|
if (strcmp(command, "set") == 0) {
|
134
|
134
|
if (args->size() != 2) {
|
135
|
|
- printf("Invalid use of set-command ");
|
|
135
|
+ mConsole->print("Invalid use of set-command ");
|
136
|
136
|
printStringVector(args);
|
137
|
137
|
printf("\n");
|
138
|
138
|
return -2;
|
|
@@ -141,15 +141,17 @@ int OpenRaider::command(const char *command, std::vector<char *> *args) {
|
141
|
141
|
}
|
142
|
142
|
} else if (strcmp(command, "bind") == 0) {
|
143
|
143
|
if (args->size() != 2) {
|
144
|
|
- printf("Invalid use of bind-command ");
|
|
144
|
+ mConsole->print("Invalid use of bind-command ");
|
145
|
145
|
printStringVector(args);
|
146
|
146
|
printf("\n");
|
147
|
147
|
return -3;
|
148
|
148
|
} else {
|
149
|
149
|
return bind(args->at(0), args->at(1));
|
150
|
150
|
}
|
|
151
|
+ } else if (strcmp(command, "quit") == 0) {
|
|
152
|
+ exit(0);
|
151
|
153
|
} else {
|
152
|
|
- printf("Unknown command: %s ", command);
|
|
154
|
+ mConsole->print("Unknown command: %s ", command);
|
153
|
155
|
printStringVector(args);
|
154
|
156
|
printf("\n");
|
155
|
157
|
return -1;
|
|
@@ -206,14 +208,14 @@ int OpenRaider::set(const char *var, const char *value) {
|
206
|
208
|
// value has format like "\"1024x768\""
|
207
|
209
|
unsigned int w = DEFAULT_WIDTH, h = DEFAULT_HEIGHT;
|
208
|
210
|
if (sscanf(value, "\"%dx%d\"", &w, &h) != 2) {
|
209
|
|
- printf("set-size-Error: Invalid value (%s)\n", value);
|
|
211
|
+ mConsole->print("set-size-Error: Invalid value (%s)", value);
|
210
|
212
|
return -2;
|
211
|
213
|
}
|
212
|
214
|
mWindow->setSize(w, h);
|
213
|
215
|
} else if (strcmp(var, "fullscreen") == 0) {
|
214
|
216
|
bool fullscreen = false;
|
215
|
217
|
if (readBool(value, &fullscreen) != 0) {
|
216
|
|
- printf("set-fullscreen-Error: Invalid value (%s)\n", value);
|
|
218
|
+ mConsole->print("set-fullscreen-Error: Invalid value (%s)", value);
|
217
|
219
|
return -3;
|
218
|
220
|
}
|
219
|
221
|
mWindow->setFullscreen(fullscreen);
|
|
@@ -222,28 +224,28 @@ int OpenRaider::set(const char *var, const char *value) {
|
222
|
224
|
} else if (strcmp(var, "audio") == 0) {
|
223
|
225
|
bool audio = false;
|
224
|
226
|
if (readBool(value, &audio) != 0) {
|
225
|
|
- printf("set-audio-Error: Invalid value (%s)\n", value);
|
|
227
|
+ mConsole->print("set-audio-Error: Invalid value (%s)", value);
|
226
|
228
|
return -4;
|
227
|
229
|
}
|
228
|
230
|
mSound->setEnabled(audio);
|
229
|
231
|
} else if (strcmp(var, "volume") == 0) {
|
230
|
232
|
float vol = 1.0f;
|
231
|
233
|
if (sscanf(value, "%f", &vol) != 1) {
|
232
|
|
- printf("set-volume-Error: Invalid value (%s)\n", value);
|
|
234
|
+ mConsole->print("set-volume-Error: Invalid value (%s)", value);
|
233
|
235
|
return -5;
|
234
|
236
|
}
|
235
|
237
|
mSound->setVolume(vol);
|
236
|
238
|
} else if (strcmp(var, "mouse_x") == 0) {
|
237
|
239
|
float sense = 1.0f;
|
238
|
240
|
if (sscanf(value, "%f", &sense) != 1) {
|
239
|
|
- printf("set-mouse_x-Error: Invalid value (%s)\n", value);
|
|
241
|
+ mConsole->print("set-mouse_x-Error: Invalid value (%s)", value);
|
240
|
242
|
return -6;
|
241
|
243
|
}
|
242
|
244
|
//! \todo mouse support
|
243
|
245
|
} else if (strcmp(var, "mouse_y") == 0) {
|
244
|
246
|
float sense = 1.0f;
|
245
|
247
|
if (sscanf(value, "%f", &sense) != 1) {
|
246
|
|
- printf("set-mouse_y-Error: Invalid value (%s)\n", value);
|
|
248
|
+ mConsole->print("set-mouse_y-Error: Invalid value (%s)", value);
|
247
|
249
|
return -7;
|
248
|
250
|
}
|
249
|
251
|
//! \todo mouse support
|
|
@@ -266,7 +268,7 @@ int OpenRaider::set(const char *var, const char *value) {
|
266
|
268
|
}
|
267
|
269
|
delete [] quotes;
|
268
|
270
|
} else {
|
269
|
|
- printf("set-Error: Unknown variable (%s = %s)\n", var, value);
|
|
271
|
+ mConsole->print("set-Error: Unknown variable (%s = %s)", var, value);
|
270
|
272
|
return -1;
|
271
|
273
|
}
|
272
|
274
|
|
|
@@ -299,7 +301,7 @@ int OpenRaider::bind(const char *action, const char *key) {
|
299
|
301
|
} else if (strcmp(tmp, "holster") == 0) {
|
300
|
302
|
return bind(holster, key);
|
301
|
303
|
} else {
|
302
|
|
- printf("bind-Error: Unknown action (%s --> %s)\n", key, action);
|
|
304
|
+ mConsole->print("bind-Error: Unknown action (%s --> %s)", key, action);
|
303
|
305
|
return -1;
|
304
|
306
|
}
|
305
|
307
|
}
|
|
@@ -317,7 +319,7 @@ int OpenRaider::bind(ActionEvents action, const char *key) {
|
317
|
319
|
|| ((c >= 'a') && (c <= 'z'))) {
|
318
|
320
|
keyBindings[action] = (KeyboardButton)c;
|
319
|
321
|
} else {
|
320
|
|
- printf("bind-\'\'-Error: Unknown key (%s)\n", key);
|
|
322
|
+ mConsole->print("bind-\'\'-Error: Unknown key (%s)", key);
|
321
|
323
|
return -1;
|
322
|
324
|
}
|
323
|
325
|
} else if ((key[0] == '\"') && (key[length - 1] == '\"')) {
|
|
@@ -424,13 +426,13 @@ int OpenRaider::bind(ActionEvents action, const char *key) {
|
424
|
426
|
} else if (strcmp(tmp, "tab") == 0) {
|
425
|
427
|
keyBindings[action] = tab;
|
426
|
428
|
} else {
|
427
|
|
- printf("bind-\"\"-Error: Unknown key (%s)\n", key);
|
|
429
|
+ mConsole->print("bind-\"\"-Error: Unknown key (%s)", key);
|
428
|
430
|
delete [] tmp;
|
429
|
431
|
return -2;
|
430
|
432
|
}
|
431
|
433
|
delete [] tmp;
|
432
|
434
|
} else {
|
433
|
|
- printf("bind-Error: Unknown key (%s)\n", key);
|
|
435
|
+ mConsole->print("bind-Error: Unknown key (%s)", key);
|
434
|
436
|
return -3;
|
435
|
437
|
}
|
436
|
438
|
return 0;
|
|
@@ -464,12 +466,12 @@ void OpenRaider::loadPakFolderRecursive(const char *dir) {
|
464
|
466
|
|| stringEndsWith(lowerPath, ".tr4")
|
465
|
467
|
|| stringEndsWith(lowerPath, ".trc")) {
|
466
|
468
|
//if (m_tombraider.checkMime(fullPathMap) == 0) {
|
467
|
|
- // printf("Validated pak: '%s'\n", fullPathMap);
|
|
469
|
+ // mConsole->print("Validated pak: '%s'", fullPathMap);
|
468
|
470
|
|
469
|
471
|
// Just load relative filename
|
470
|
472
|
mMapList.push_back(bufferString("%s", (fullPathMap + strlen(mPakDir))));
|
471
|
473
|
//} else {
|
472
|
|
- // printf("ERROR: pak file '%s' not found or invalid\n", fullPathMap);
|
|
474
|
+ // mConsole->print("ERROR: pak file '%s' not found or invalid", fullPathMap);
|
473
|
475
|
//}
|
474
|
476
|
}
|
475
|
477
|
|
|
@@ -479,7 +481,7 @@ void OpenRaider::loadPakFolderRecursive(const char *dir) {
|
479
|
481
|
}
|
480
|
482
|
closedir(pakDir);
|
481
|
483
|
} else {
|
482
|
|
- printf("Could not open PAK dir %s!\n", dir);
|
|
484
|
+ mConsole->print("Could not open PAK dir %s!", dir);
|
483
|
485
|
}
|
484
|
486
|
}
|
485
|
487
|
|