|
@@ -272,6 +272,54 @@ int Game::command(std::vector<char *> *args) {
|
272
|
272
|
gOpenRaider->mConsole->print("Invalid use of sound command!");
|
273
|
273
|
return -11;
|
274
|
274
|
}
|
|
275
|
+ } else if (strcmp(cmd, "animate") == 0) {
|
|
276
|
+ if (args->size() > 1) {
|
|
277
|
+ char c = args->at(1)[0];
|
|
278
|
+ if (c == 'n') {
|
|
279
|
+ // Step all skeletal models to their next animation
|
|
280
|
+ if (mRender->getFlags() & Render::fAnimateAllModels) {
|
|
281
|
+ for (unsigned int i = 0; i < mRender->mModels.size(); i++) {
|
|
282
|
+ SkeletalModel *m = mRender->mModels[i];
|
|
283
|
+ if (m->getAnimation() < ((int)m->model->animation.size() - 1))
|
|
284
|
+ m->setAnimation(m->getAnimation() + 1);
|
|
285
|
+ else
|
|
286
|
+ if (m->getAnimation() != 0)
|
|
287
|
+ m->setAnimation(0);
|
|
288
|
+ }
|
|
289
|
+ } else {
|
|
290
|
+ gOpenRaider->mConsole->print("Animations need to be enabled!");
|
|
291
|
+ }
|
|
292
|
+ } else if (c == 'p') {
|
|
293
|
+ // Step all skeletal models to their previous animation
|
|
294
|
+ if (mRender->getFlags() & Render::fAnimateAllModels) {
|
|
295
|
+ for (unsigned int i = 0; i < mRender->mModels.size(); i++) {
|
|
296
|
+ SkeletalModel *m = mRender->mModels[i];
|
|
297
|
+ if (m->getAnimation() > 0)
|
|
298
|
+ m->setAnimation(m->getAnimation() - 1);
|
|
299
|
+ else
|
|
300
|
+ if (m->model->animation.size() > 0)
|
|
301
|
+ m->setAnimation(m->model->animation.size() - 1);
|
|
302
|
+ }
|
|
303
|
+ } else {
|
|
304
|
+ gOpenRaider->mConsole->print("Animations need to be enabled!");
|
|
305
|
+ }
|
|
306
|
+ } else {
|
|
307
|
+ // Enable or disable animating all skeletal models
|
|
308
|
+ bool b;
|
|
309
|
+ if (readBool(args->at(1), &b) < 0) {
|
|
310
|
+ gOpenRaider->mConsole->print("Pass BOOL to animate command!");
|
|
311
|
+ return -12;
|
|
312
|
+ }
|
|
313
|
+ if (b)
|
|
314
|
+ mRender->setFlags(Render::fAnimateAllModels);
|
|
315
|
+ else
|
|
316
|
+ mRender->clearFlags(Render::fAnimateAllModels);
|
|
317
|
+ gOpenRaider->mConsole->print(b ? "Animating all models" : "No longer animating all models");
|
|
318
|
+ }
|
|
319
|
+ } else {
|
|
320
|
+ gOpenRaider->mConsole->print("Invalid use of animate command!");
|
|
321
|
+ return -13;
|
|
322
|
+ }
|
275
|
323
|
} else if (strcmp(cmd, "help") == 0) {
|
276
|
324
|
if (args->size() < 2) {
|
277
|
325
|
gOpenRaider->mConsole->print("game-command Usage:");
|
|
@@ -280,6 +328,7 @@ int Game::command(std::vector<char *> *args) {
|
280
|
328
|
gOpenRaider->mConsole->print(" move [walk|fly|noclip]");
|
281
|
329
|
gOpenRaider->mConsole->print(" sound INT");
|
282
|
330
|
gOpenRaider->mConsole->print(" mode MODE");
|
|
331
|
+ gOpenRaider->mConsole->print(" animate [BOOL|n|p]");
|
283
|
332
|
} else if (strcmp(args->at(1), "sound") == 0) {
|
284
|
333
|
gOpenRaider->mConsole->print("game-sound-command Usage:");
|
285
|
334
|
gOpenRaider->mConsole->print(" game sound INT");
|
|
@@ -300,13 +349,20 @@ int Game::command(std::vector<char *> *args) {
|
300
|
349
|
gOpenRaider->mConsole->print(" texture");
|
301
|
350
|
gOpenRaider->mConsole->print(" vertexlight");
|
302
|
351
|
gOpenRaider->mConsole->print(" titlescreen");
|
|
352
|
+ } else if (strcmp(args->at(1), "animate") == 0) {
|
|
353
|
+ gOpenRaider->mConsole->print("game-animate-command Usage:");
|
|
354
|
+ gOpenRaider->mConsole->print(" game animate [n|p|BOOL]");
|
|
355
|
+ gOpenRaider->mConsole->print("Where the commands have the following meaning:");
|
|
356
|
+ gOpenRaider->mConsole->print(" BOOL to (de)activate animating all models");
|
|
357
|
+ gOpenRaider->mConsole->print(" n to step all models to their next animation");
|
|
358
|
+ gOpenRaider->mConsole->print(" p to step all models to their previous animation");
|
303
|
359
|
} else {
|
304
|
360
|
gOpenRaider->mConsole->print("No help available for game %s.", args->at(1));
|
305
|
|
- return -12;
|
|
361
|
+ return -14;
|
306
|
362
|
}
|
307
|
363
|
} else {
|
308
|
364
|
gOpenRaider->mConsole->print("Invalid use of game-command (%s)!", cmd);
|
309
|
|
- return -13;
|
|
365
|
+ return -15;
|
310
|
366
|
}
|
311
|
367
|
|
312
|
368
|
return 0;
|