]> git.jsancho.org Git - lugaru.git/blob - Source/Devtools/ConsoleCmds.cpp
Moved default scale and default damage tolerance to PersonType.
[lugaru.git] / Source / Devtools / ConsoleCmds.cpp
1 /*
2 Copyright (C) 2003, 2010 - Wolfire Games
3 Copyright (C) 2010-2017 - Lugaru contributors (see AUTHORS file)
4
5 This file is part of Lugaru.
6
7 Lugaru is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 Lugaru is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Lugaru.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "Devtools/ConsoleCmds.hpp"
22
23 #include "Game.hpp"
24 #include "Level/Dialog.hpp"
25 #include "Level/Hotspot.hpp"
26 #include "Tutorial.hpp"
27 #include "Utils/Folders.hpp"
28
29 const char* cmd_names[cmd_count] = {
30 #define DECLARE_COMMAND(cmd) #cmd,
31 #include "ConsoleCmds.def"
32 #undef DECLARE_COMMAND
33 };
34
35 console_handler cmd_handlers[cmd_count] = {
36 #define DECLARE_COMMAND(cmd) ch_##cmd,
37 #include "ConsoleCmds.def"
38 #undef DECLARE_COMMAND
39 };
40
41 using namespace Game;
42
43 /* globals */
44
45 extern bool campaign;
46 extern bool cellophane;
47 extern int editoractive;
48 extern int editorpathtype;
49 extern int environment;
50 extern float fadestart;
51 extern float slomospeed;
52 extern float slomofreq;
53 extern int hostile;
54 extern int maptype;
55 extern int slomo;
56 extern float slomodelay;
57 extern bool skyboxtexture;
58 extern float skyboxr;
59 extern float skyboxg;
60 extern float skyboxb;
61 extern float skyboxlightr;
62 extern float skyboxlightg;
63 extern float skyboxlightb;
64 extern Terrain terrain;
65 extern float viewdistance;
66
67 /* defined in GameTick.cpp */
68
69 extern int whichlevel;
70
71 float tintr = 1, tintg = 1, tintb = 1;
72
73 /* Helpers used in console commands */
74
75 /* Return true if PFX is a prefix of STR (case-insensitive).  */
76 static bool stripfx(const char* str, const char* pfx)
77 {
78     return !strncasecmp(str, pfx, strlen(pfx));
79 }
80
81 static void set_proportion(int pnum, const char* args)
82 {
83     float headprop, bodyprop, armprop, legprop;
84
85     sscanf(args, "%f%f%f%f", &headprop, &bodyprop, &armprop, &legprop);
86
87     Person::players[pnum]->setProportions(headprop, bodyprop, armprop, legprop);
88 }
89
90 static void set_protection(int pnum, const char* args)
91 {
92     float head, high, low;
93     sscanf(args, "%f%f%f", &head, &high, &low);
94
95     Person::players[pnum]->protectionhead = head;
96     Person::players[pnum]->protectionhigh = high;
97     Person::players[pnum]->protectionlow = low;
98 }
99
100 static void set_armor(int pnum, const char* args)
101 {
102     float head, high, low;
103     sscanf(args, "%f%f%f", &head, &high, &low);
104
105     Person::players[pnum]->armorhead = head;
106     Person::players[pnum]->armorhigh = high;
107     Person::players[pnum]->armorlow = low;
108 }
109
110 static void set_metal(int pnum, const char* args)
111 {
112     float head, high, low;
113     sscanf(args, "%f%f%f", &head, &high, &low);
114
115     Person::players[pnum]->metalhead = head;
116     Person::players[pnum]->metalhigh = high;
117     Person::players[pnum]->metallow = low;
118 }
119
120 static void set_noclothes(int pnum, const char*)
121 {
122     Person::players[pnum]->numclothes = 0;
123     Person::players[pnum]->skeleton.drawmodel.textureptr.load(
124         PersonType::types[Person::players[pnum]->creature].skins[Person::players[pnum]->whichskin], 1,
125         &Person::players[pnum]->skeleton.skinText[0], &Person::players[pnum]->skeleton.skinsize);
126 }
127
128 static void set_clothes(int pnum, const char* args)
129 {
130     char buf[64];
131     snprintf(buf, 63, "Textures/%s.png", args);
132
133     const std::string file_path = Folders::getResourcePath(buf);
134     FILE* tfile;
135     tfile = fopen(file_path.c_str(), "rb");
136     if (tfile == NULL) {
137         perror((std::string("Couldn't find file ") + file_path + " to assign as clothes").c_str());
138
139         // FIXME: Reduce code duplication with GameTick (should come from a Console class)
140         for (int k = 14; k >= 1; k--) {
141             consoletext[k] = consoletext[k - 1];
142         }
143         consoletext[0] = std::string("Could not load the requested texture '") + args + "', aborting.";
144         consoleselected = 0;
145
146         return;
147     }
148
149     int id = Person::players[pnum]->numclothes;
150     strncpy(Person::players[pnum]->clothes[id], buf, 64);
151     Person::players[pnum]->clothestintr[id] = tintr;
152     Person::players[pnum]->clothestintg[id] = tintg;
153     Person::players[pnum]->clothestintb[id] = tintb;
154     Person::players[pnum]->numclothes++;
155
156     if (!Person::players[pnum]->addClothes(id)) {
157         return;
158     }
159
160     Person::players[pnum]->DoMipmaps();
161 }
162
163 static void list_clothes(int pnum)
164 {
165     printf("Clothes from player %d:\n", pnum);
166     for (int i = 0; i < Person::players[pnum]->numclothes; i++) {
167         printf("%s (%f %f %f)\n",
168                Person::players[pnum]->clothes[i],
169                Person::players[pnum]->clothestintr[i],
170                Person::players[pnum]->clothestintg[i],
171                Person::players[pnum]->clothestintb[i]);
172     }
173 }
174
175 /* Console commands themselves */
176
177 void ch_quit(const char*)
178 {
179     tryquit = 1;
180 }
181
182 void ch_map(const char* args)
183 {
184     if (!LoadLevel(args)) {
185         // FIXME: Reduce code duplication with GameTick (should come from a Console class)
186         for (int k = 14; k >= 1; k--) {
187             consoletext[k] = consoletext[k - 1];
188         }
189         consoletext[0] = std::string("Could not load the requested level '") + args + "', aborting.";
190         consoleselected = 0;
191     }
192     whichlevel = -2;
193     campaign = 0;
194 }
195
196 void ch_save(const char* args)
197 {
198     std::string map_path = Folders::getUserDataPath() + "/Maps";
199     Folders::makeDirectory(map_path);
200     map_path = map_path + "/" + args;
201
202     int mapvers = 12;
203
204     FILE* tfile;
205     tfile = fopen(map_path.c_str(), "wb");
206     if (tfile == NULL) {
207         perror((std::string("Couldn't open file ") + map_path + " for saving").c_str());
208         return;
209     }
210     fpackf(tfile, "Bi", mapvers);
211     fpackf(tfile, "Bi", maptype);
212     fpackf(tfile, "Bi", hostile);
213     fpackf(tfile, "Bf Bf", viewdistance, fadestart);
214     fpackf(tfile, "Bb Bf Bf Bf", skyboxtexture, skyboxr, skyboxg, skyboxb);
215     fpackf(tfile, "Bf Bf Bf", skyboxlightr, skyboxlightg, skyboxlightb);
216     fpackf(tfile, "Bf Bf Bf Bf Bf Bi", Person::players[0]->coords.x, Person::players[0]->coords.y, Person::players[0]->coords.z,
217            Person::players[0]->yaw, Person::players[0]->targetyaw, Person::players[0]->num_weapons);
218     if (Person::players[0]->num_weapons > 0 && Person::players[0]->num_weapons < 5) {
219         for (int j = 0; j < Person::players[0]->num_weapons; j++) {
220             fpackf(tfile, "Bi", weapons[Person::players[0]->weaponids[j]].getType());
221         }
222     }
223
224     fpackf(tfile, "Bf Bf Bf", Person::players[0]->armorhead, Person::players[0]->armorhigh, Person::players[0]->armorlow);
225     fpackf(tfile, "Bf Bf Bf", Person::players[0]->protectionhead, Person::players[0]->protectionhigh, Person::players[0]->protectionlow);
226     fpackf(tfile, "Bf Bf Bf", Person::players[0]->metalhead, Person::players[0]->metalhigh, Person::players[0]->metallow);
227     fpackf(tfile, "Bf Bf", Person::players[0]->power, Person::players[0]->speedmult);
228
229     fpackf(tfile, "Bi", Person::players[0]->numclothes);
230
231     fpackf(tfile, "Bi Bi", Person::players[0]->whichskin, Person::players[0]->creature);
232
233     Dialog::saveDialogs(tfile);
234
235     for (int k = 0; k < Person::players[0]->numclothes; k++) {
236         int templength = strlen(Person::players[0]->clothes[k]);
237         fpackf(tfile, "Bi", templength);
238         for (int l = 0; l < templength; l++) {
239             fpackf(tfile, "Bb", Person::players[0]->clothes[k][l]);
240         }
241         fpackf(tfile, "Bf Bf Bf", Person::players[0]->clothestintr[k], Person::players[0]->clothestintg[k], Person::players[0]->clothestintb[k]);
242     }
243
244     fpackf(tfile, "Bi", environment);
245
246     fpackf(tfile, "Bi", Object::objects.size());
247
248     for (unsigned int k = 0; k < Object::objects.size(); k++) {
249         fpackf(tfile, "Bi Bf Bf Bf Bf Bf Bf", Object::objects[k]->type, Object::objects[k]->yaw, Object::objects[k]->pitch,
250                Object::objects[k]->position.x, Object::objects[k]->position.y, Object::objects[k]->position.z, Object::objects[k]->scale);
251     }
252
253     fpackf(tfile, "Bi", Hotspot::hotspots.size());
254     for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) {
255         fpackf(tfile, "Bi Bf Bf Bf Bf", Hotspot::hotspots[i].type, Hotspot::hotspots[i].size, Hotspot::hotspots[i].position.x, Hotspot::hotspots[i].position.y, Hotspot::hotspots[i].position.z);
256         int templength = strlen(Hotspot::hotspots[i].text);
257         fpackf(tfile, "Bi", templength);
258         for (int l = 0; l < templength; l++) {
259             fpackf(tfile, "Bb", Hotspot::hotspots[i].text[l]);
260         }
261     }
262
263     fpackf(tfile, "Bi", Person::players.size());
264     if (Person::players.size() > maxplayers) {
265         cout << "Warning: this level contains more players than allowed" << endl;
266     }
267     for (unsigned j = 1; j < Person::players.size(); j++) {
268         fpackf(tfile, "Bi Bi Bf Bf Bf Bi Bi Bf Bb Bf", Person::players[j]->whichskin, Person::players[j]->creature,
269                Person::players[j]->coords.x, Person::players[j]->coords.y, Person::players[j]->coords.z,
270                Person::players[j]->num_weapons, Person::players[j]->howactive, Person::players[j]->scale, Person::players[j]->immobile, Person::players[j]->yaw);
271         if (Person::players[j]->num_weapons < 5) {
272             for (int k = 0; k < Person::players[j]->num_weapons; k++) {
273                 fpackf(tfile, "Bi", weapons[Person::players[j]->weaponids[k]].getType());
274             }
275         }
276         if (Person::players[j]->numwaypoints < 30) {
277             fpackf(tfile, "Bi", Person::players[j]->numwaypoints);
278             for (int k = 0; k < Person::players[j]->numwaypoints; k++) {
279                 fpackf(tfile, "Bf", Person::players[j]->waypoints[k].x);
280                 fpackf(tfile, "Bf", Person::players[j]->waypoints[k].y);
281                 fpackf(tfile, "Bf", Person::players[j]->waypoints[k].z);
282                 fpackf(tfile, "Bi", Person::players[j]->waypointtype[k]);
283             }
284             fpackf(tfile, "Bi", Person::players[j]->waypoint);
285         } else {
286             Person::players[j]->numwaypoints = 0;
287             Person::players[j]->waypoint = 0;
288             fpackf(tfile, "Bi Bi Bi", Person::players[j]->numwaypoints, Person::players[j]->waypoint, Person::players[j]->waypoint);
289         }
290
291         fpackf(tfile, "Bf Bf Bf", Person::players[j]->armorhead, Person::players[j]->armorhigh, Person::players[j]->armorlow);
292         fpackf(tfile, "Bf Bf Bf", Person::players[j]->protectionhead, Person::players[j]->protectionhigh, Person::players[j]->protectionlow);
293         fpackf(tfile, "Bf Bf Bf", Person::players[j]->metalhead, Person::players[j]->metalhigh, Person::players[j]->metallow);
294         fpackf(tfile, "Bf Bf", Person::players[j]->power, Person::players[j]->speedmult);
295         fpackf(tfile, "Bf Bf Bf Bf", Person::players[j]->getProportion(0), Person::players[j]->getProportion(1), Person::players[j]->getProportion(2), Person::players[j]->getProportion(3));
296
297         fpackf(tfile, "Bi", Person::players[j]->numclothes);
298         if (Person::players[j]->numclothes) {
299             for (int k = 0; k < Person::players[j]->numclothes; k++) {
300                 int templength;
301                 templength = strlen(Person::players[j]->clothes[k]);
302                 fpackf(tfile, "Bi", templength);
303                 for (int l = 0; l < templength; l++) {
304                     fpackf(tfile, "Bb", Person::players[j]->clothes[k][l]);
305                 }
306                 fpackf(tfile, "Bf Bf Bf", Person::players[j]->clothestintr[k], Person::players[j]->clothestintg[k], Person::players[j]->clothestintb[k]);
307             }
308         }
309     }
310
311     fpackf(tfile, "Bi", numpathpoints);
312     for (int j = 0; j < numpathpoints; j++) {
313         fpackf(tfile, "Bf Bf Bf Bi", pathpoint[j].x, pathpoint[j].y, pathpoint[j].z, numpathpointconnect[j]);
314         for (int k = 0; k < numpathpointconnect[j]; k++) {
315             fpackf(tfile, "Bi", pathpointconnect[j][k]);
316         }
317     }
318
319     fpackf(tfile, "Bf Bf Bf Bf", mapcenter.x, mapcenter.y, mapcenter.z, mapradius);
320
321     fclose(tfile);
322 }
323
324 void ch_tint(const char* args)
325 {
326     sscanf(args, "%f%f%f", &tintr, &tintg, &tintb);
327 }
328
329 void ch_tintr(const char* args)
330 {
331     tintr = atof(args);
332 }
333
334 void ch_tintg(const char* args)
335 {
336     tintg = atof(args);
337 }
338
339 void ch_tintb(const char* args)
340 {
341     tintb = atof(args);
342 }
343
344 void ch_speed(const char* args)
345 {
346     Person::players[0]->speedmult = atof(args);
347 }
348
349 void ch_strength(const char* args)
350 {
351     Person::players[0]->power = atof(args);
352 }
353
354 void ch_power(const char* args)
355 {
356     Person::players[0]->power = atof(args);
357 }
358
359 void ch_size(const char* args)
360 {
361     Person::players[0]->scale = atof(args) * .2;
362 }
363
364 void ch_sizenear(const char* args)
365 {
366     int closest = findClosestPlayer();
367     if (closest >= 0) {
368         Person::players[closest]->scale = atof(args) * .2;
369     }
370 }
371
372 void ch_proportion(const char* args)
373 {
374     set_proportion(0, args);
375 }
376
377 void ch_proportionnear(const char* args)
378 {
379     int closest = findClosestPlayer();
380     if (closest >= 0) {
381         set_proportion(closest, args);
382     }
383 }
384
385 void ch_protection(const char* args)
386 {
387     set_protection(0, args);
388 }
389
390 void ch_protectionnear(const char* args)
391 {
392     int closest = findClosestPlayer();
393     if (closest >= 0) {
394         set_protection(closest, args);
395     }
396 }
397
398 void ch_armor(const char* args)
399 {
400     set_armor(0, args);
401 }
402
403 void ch_armornear(const char* args)
404 {
405     int closest = findClosestPlayer();
406     if (closest >= 0) {
407         set_armor(closest, args);
408     }
409 }
410
411 void ch_protectionreset(const char*)
412 {
413     set_protection(0, "1 1 1");
414     set_armor(0, "1 1 1");
415 }
416
417 void ch_metal(const char* args)
418 {
419     set_metal(0, args);
420 }
421
422 void ch_noclothes(const char* args)
423 {
424     set_noclothes(0, args);
425 }
426
427 void ch_noclothesnear(const char* args)
428 {
429     int closest = findClosestPlayer();
430     if (closest >= 0) {
431         set_noclothes(closest, args);
432     }
433 }
434
435 void ch_clothes(const char* args)
436 {
437     set_clothes(0, args);
438 }
439
440 void ch_clothesnear(const char* args)
441 {
442     int closest = findClosestPlayer();
443     if (closest >= 0) {
444         set_clothes(closest, args);
445     }
446 }
447
448 void ch_clotheslist(const char*)
449 {
450     list_clothes(0);
451 }
452
453 void ch_clotheslistnear(const char*)
454 {
455     int closest = findClosestPlayer();
456     if (closest >= 0) {
457         list_clothes(closest);
458     }
459 }
460
461 void ch_belt(const char*)
462 {
463     Person::players[0]->skeleton.clothes = !Person::players[0]->skeleton.clothes;
464 }
465
466 void ch_cellophane(const char*)
467 {
468     cellophane = !cellophane;
469 }
470
471 void ch_funnybunny(const char*)
472 {
473     Person::players[0]->changeCreatureType(rabbittype);
474     Person::players[0]->headless = 0;
475     set_proportion(0, "1 1 1 1");
476 }
477
478 void ch_wolfie(const char*)
479 {
480     Person::players[0]->changeCreatureType(wolftype);
481     set_proportion(0, "1 1 1 1");
482 }
483
484 void ch_lizardwolf(const char*)
485 {
486     Person::players[0]->skeleton.drawmodel.textureptr.load("Textures/FurWolfLizard.jpg", 1, &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
487 }
488
489 void ch_darko(const char*)
490 {
491     Person::players[0]->skeleton.drawmodel.textureptr.load("Textures/FurDarko.jpg", 1, &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
492 }
493
494 void ch_sizemin(const char*)
495 {
496     for (unsigned i = 1; i < Person::players.size(); i++) {
497         if (Person::players[i]->scale < 0.8 * 0.2) {
498             Person::players[i]->scale = 0.8 * 0.2;
499         }
500     }
501 }
502
503 void ch_tutorial(const char* args)
504 {
505     Tutorial::active = atoi(args);
506 }
507
508 void ch_hostile(const char* args)
509 {
510     hostile = atoi(args);
511 }
512
513 void ch_type(const char* args)
514 {
515     int n = sizeof(editortypenames) / sizeof(editortypenames[0]);
516     for (int i = 0; i < n; i++) {
517         if (stripfx(args, editortypenames[i])) {
518             editoractive = i;
519             break;
520         }
521     }
522 }
523
524 void ch_path(const char* args)
525 {
526     unsigned int n = sizeof(pathtypenames) / sizeof(pathtypenames[0]);
527     for (unsigned int i = 0; i < n; i++) {
528         if (stripfx(args, pathtypenames[i])) {
529             editorpathtype = i;
530             break;
531         }
532     }
533 }
534
535 void ch_hs(const char* args)
536 {
537     float size;
538     int type, shift;
539     sscanf(args, "%f%d %n", &size, &type, &shift);
540
541     Hotspot::hotspots.emplace_back(Person::players[0]->coords, type, size);
542
543     strcpy(Hotspot::hotspots.back().text, args + shift);
544     strcat(Hotspot::hotspots.back().text, "\n");
545 }
546
547 void ch_dialog(const char* args)
548 {
549     int type;
550     char buf1[32];
551
552     sscanf(args, "%d %31s", &type, buf1);
553     std::string filename = std::string("Dialogues/") + buf1 + ".txt";
554
555     Dialog::dialogs.push_back(Dialog(type, filename));
556
557     Dialog::directing = true;
558     Dialog::indialogue = 0;
559     Dialog::whichdialogue = Dialog::dialogs.size();
560 }
561
562 void ch_fixdialog(const char* args)
563 {
564     char buf1[32];
565     int whichdlg = 0;
566
567     sscanf(args, "%d %31s", &whichdlg, buf1);
568     std::string filename = std::string("Dialogues/") + buf1 + ".txt";
569
570     Dialog::dialogs[whichdlg] = Dialog(Dialog::dialogs[whichdlg].type, filename);
571 }
572
573 void ch_fixtype(const char* args)
574 {
575     int whichdlg = 0;
576     int type = 0;
577     sscanf(args, "%d %d", &whichdlg, &type);
578     Dialog::dialogs[whichdlg].type = type;
579 }
580
581 void ch_fixrotation(const char*)
582 {
583     int playerId = Dialog::currentScene().participantfocus;
584     Dialog::currentDialog().participantyaw[playerId] = Person::players[playerId]->yaw;
585 }
586
587 void ch_ddialog(const char* args)
588 {
589     if (Dialog::dialogs.empty() || Dialog::inDialog()) {
590         return;
591     }
592
593     int dlg = -1;
594     sscanf(args, "%d", &dlg);
595     if (dlg == -1) {
596         // Remove last entry
597         Dialog::dialogs.pop_back();
598         return;
599     }
600
601     if (dlg >= int(Dialog::dialogs.size())) {
602         // Invalid index, abort
603         return;
604     }
605
606     // Erase given index, higher indexes will be decreased by 1
607     Dialog::dialogs.erase(Dialog::dialogs.begin() + dlg);
608 }
609
610 void ch_dhs(const char*)
611 {
612     if (!Hotspot::hotspots.empty()) {
613         Hotspot::hotspots.pop_back();
614     }
615 }
616
617 void ch_immobile(const char*)
618 {
619     Person::players[0]->immobile = 1;
620 }
621
622 void ch_allimmobile(const char*)
623 {
624     for (unsigned i = 1; i < Person::players.size(); i++) {
625         Person::players[i]->immobile = 1;
626     }
627 }
628
629 void ch_mobile(const char*)
630 {
631     Person::players[0]->immobile = 0;
632 }
633
634 void ch_default(const char*)
635 {
636     Person::players[0]->armorhead = 1;
637     Person::players[0]->armorhigh = 1;
638     Person::players[0]->armorlow = 1;
639     Person::players[0]->protectionhead = 1;
640     Person::players[0]->protectionhigh = 1;
641     Person::players[0]->protectionlow = 1;
642     Person::players[0]->metalhead = 1;
643     Person::players[0]->metalhigh = 1;
644     Person::players[0]->metallow = 1;
645     Person::players[0]->power = 1;
646     Person::players[0]->speedmult = 1;
647     Person::players[0]->scale = PersonType::types[Person::players[0]->creature].defaultScale;
648
649     Person::players[0]->setProportions(1, 1, 1, 1);
650
651     Person::players[0]->numclothes = 0;
652     Person::players[0]->skeleton.drawmodel.textureptr.load(
653         PersonType::types[Person::players[0]->creature].skins[Person::players[0]->whichskin], 1,
654         &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
655
656     editoractive = typeactive;
657     Person::players[0]->immobile = 0;
658 }
659
660 void ch_play(const char* args)
661 {
662     int dlg;
663     sscanf(args, "%d", &dlg);
664     Dialog::whichdialogue = dlg;
665
666     if (Dialog::whichdialogue >= int(Dialog::dialogs.size())) {
667         return;
668     }
669
670     Dialog::currentDialog().play();
671 }
672
673 void ch_mapkilleveryone(const char*)
674 {
675     maptype = mapkilleveryone;
676 }
677
678 void ch_mapkillmost(const char*)
679 {
680     maptype = mapkillmost;
681 }
682
683 void ch_mapkillsomeone(const char*)
684 {
685     maptype = mapkillsomeone;
686 }
687
688 void ch_mapgosomewhere(const char*)
689 {
690     maptype = mapgosomewhere;
691 }
692
693 void ch_viewdistance(const char* args)
694 {
695     viewdistance = atof(args) * 100;
696 }
697
698 void ch_fadestart(const char* args)
699 {
700     fadestart = atof(args);
701 }
702
703 void ch_slomo(const char* args)
704 {
705     slomospeed = atof(args);
706     slomo = !slomo;
707     slomodelay = 1000;
708 }
709
710 void ch_slofreq(const char* args)
711 {
712     slomofreq = atof(args);
713 }
714
715 void ch_skytint(const char* args)
716 {
717     sscanf(args, "%f%f%f", &skyboxr, &skyboxg, &skyboxb);
718
719     skyboxlightr = skyboxr;
720     skyboxlightg = skyboxg;
721     skyboxlightb = skyboxb;
722
723     SetUpLighting();
724
725     terrain.DoShadows();
726     Object::DoShadows();
727 }
728
729 void ch_skylight(const char* args)
730 {
731     sscanf(args, "%f%f%f", &skyboxlightr, &skyboxlightg, &skyboxlightb);
732
733     SetUpLighting();
734
735     terrain.DoShadows();
736     Object::DoShadows();
737 }
738
739 void ch_skybox(const char*)
740 {
741     skyboxtexture = !skyboxtexture;
742
743     SetUpLighting();
744
745     terrain.DoShadows();
746     Object::DoShadows();
747 }