]> git.jsancho.org Git - lugaru.git/blob - Source/Devtools/ConsoleCmds.cpp
e1e553ed08ec517e1c103de0bfa44d7095bf4c72
[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]->creature = rabbittype;
474     Person::players[0]->skeletonLoad(true);
475     Person::players[0]->scale = .2;
476     Person::players[0]->headless = 0;
477     Person::players[0]->damagetolerance = 200;
478     set_proportion(0, "1 1 1 1");
479 }
480
481 void ch_wolfie(const char*)
482 {
483     Person::players[0]->creature = wolftype;
484     Person::players[0]->skeletonLoad();
485     Person::players[0]->scale = .23;
486     Person::players[0]->damagetolerance = 300;
487     set_proportion(0, "1 1 1 1");
488 }
489
490 void ch_lizardwolf(const char*)
491 {
492     Person::players[0]->skeleton.drawmodel.textureptr.load("Textures/FurWolfLizard.jpg", 1, &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
493 }
494
495 void ch_darko(const char*)
496 {
497     Person::players[0]->skeleton.drawmodel.textureptr.load("Textures/FurDarko.jpg", 1, &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
498 }
499
500 void ch_sizemin(const char*)
501 {
502     for (unsigned i = 1; i < Person::players.size(); i++) {
503         if (Person::players[i]->scale < 0.8 * 0.2) {
504             Person::players[i]->scale = 0.8 * 0.2;
505         }
506     }
507 }
508
509 void ch_tutorial(const char* args)
510 {
511     Tutorial::active = atoi(args);
512 }
513
514 void ch_hostile(const char* args)
515 {
516     hostile = atoi(args);
517 }
518
519 void ch_type(const char* args)
520 {
521     int n = sizeof(editortypenames) / sizeof(editortypenames[0]);
522     for (int i = 0; i < n; i++) {
523         if (stripfx(args, editortypenames[i])) {
524             editoractive = i;
525             break;
526         }
527     }
528 }
529
530 void ch_path(const char* args)
531 {
532     unsigned int n = sizeof(pathtypenames) / sizeof(pathtypenames[0]);
533     for (unsigned int i = 0; i < n; i++) {
534         if (stripfx(args, pathtypenames[i])) {
535             editorpathtype = i;
536             break;
537         }
538     }
539 }
540
541 void ch_hs(const char* args)
542 {
543     float size;
544     int type, shift;
545     sscanf(args, "%f%d %n", &size, &type, &shift);
546
547     Hotspot::hotspots.emplace_back(Person::players[0]->coords, type, size);
548
549     strcpy(Hotspot::hotspots.back().text, args + shift);
550     strcat(Hotspot::hotspots.back().text, "\n");
551 }
552
553 void ch_dialog(const char* args)
554 {
555     int type;
556     char buf1[32];
557
558     sscanf(args, "%d %31s", &type, buf1);
559     std::string filename = std::string("Dialogues/") + buf1 + ".txt";
560
561     Dialog::dialogs.push_back(Dialog(type, filename));
562
563     Dialog::directing = true;
564     Dialog::indialogue = 0;
565     Dialog::whichdialogue = Dialog::dialogs.size();
566 }
567
568 void ch_fixdialog(const char* args)
569 {
570     char buf1[32];
571     int whichdlg = 0;
572
573     sscanf(args, "%d %31s", &whichdlg, buf1);
574     std::string filename = std::string("Dialogues/") + buf1 + ".txt";
575
576     Dialog::dialogs[whichdlg] = Dialog(Dialog::dialogs[whichdlg].type, filename);
577 }
578
579 void ch_fixtype(const char* args)
580 {
581     int whichdlg = 0;
582     int type = 0;
583     sscanf(args, "%d %d", &whichdlg, &type);
584     Dialog::dialogs[whichdlg].type = type;
585 }
586
587 void ch_fixrotation(const char*)
588 {
589     int playerId = Dialog::currentScene().participantfocus;
590     Dialog::currentDialog().participantyaw[playerId] = Person::players[playerId]->yaw;
591 }
592
593 void ch_ddialog(const char* args)
594 {
595     if (Dialog::dialogs.empty() || Dialog::inDialog()) {
596         return;
597     }
598
599     int dlg = -1;
600     sscanf(args, "%d", &dlg);
601     if (dlg == -1) {
602         // Remove last entry
603         Dialog::dialogs.pop_back();
604         return;
605     }
606
607     if (dlg >= int(Dialog::dialogs.size())) {
608         // Invalid index, abort
609         return;
610     }
611
612     // Erase given index, higher indexes will be decreased by 1
613     Dialog::dialogs.erase(Dialog::dialogs.begin() + dlg);
614 }
615
616 void ch_dhs(const char*)
617 {
618     if (!Hotspot::hotspots.empty()) {
619         Hotspot::hotspots.pop_back();
620     }
621 }
622
623 void ch_immobile(const char*)
624 {
625     Person::players[0]->immobile = 1;
626 }
627
628 void ch_allimmobile(const char*)
629 {
630     for (unsigned i = 1; i < Person::players.size(); i++) {
631         Person::players[i]->immobile = 1;
632     }
633 }
634
635 void ch_mobile(const char*)
636 {
637     Person::players[0]->immobile = 0;
638 }
639
640 void ch_default(const char*)
641 {
642     Person::players[0]->armorhead = 1;
643     Person::players[0]->armorhigh = 1;
644     Person::players[0]->armorlow = 1;
645     Person::players[0]->protectionhead = 1;
646     Person::players[0]->protectionhigh = 1;
647     Person::players[0]->protectionlow = 1;
648     Person::players[0]->metalhead = 1;
649     Person::players[0]->metalhigh = 1;
650     Person::players[0]->metallow = 1;
651     Person::players[0]->power = 1;
652     Person::players[0]->speedmult = 1;
653     if (Person::players[0]->creature == wolftype) {
654         Person::players[0]->scale = .23;
655     } else if (Person::players[0]->creature == rabbittype) {
656         Person::players[0]->scale = .2;
657     }
658
659     Person::players[0]->setProportions(1, 1, 1, 1);
660
661     Person::players[0]->numclothes = 0;
662     Person::players[0]->skeleton.drawmodel.textureptr.load(
663         PersonType::types[Person::players[0]->creature].skins[Person::players[0]->whichskin], 1,
664         &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
665
666     editoractive = typeactive;
667     Person::players[0]->immobile = 0;
668 }
669
670 void ch_play(const char* args)
671 {
672     int dlg;
673     sscanf(args, "%d", &dlg);
674     Dialog::whichdialogue = dlg;
675
676     if (Dialog::whichdialogue >= int(Dialog::dialogs.size())) {
677         return;
678     }
679
680     Dialog::currentDialog().play();
681 }
682
683 void ch_mapkilleveryone(const char*)
684 {
685     maptype = mapkilleveryone;
686 }
687
688 void ch_mapkillmost(const char*)
689 {
690     maptype = mapkillmost;
691 }
692
693 void ch_mapkillsomeone(const char*)
694 {
695     maptype = mapkillsomeone;
696 }
697
698 void ch_mapgosomewhere(const char*)
699 {
700     maptype = mapgosomewhere;
701 }
702
703 void ch_viewdistance(const char* args)
704 {
705     viewdistance = atof(args) * 100;
706 }
707
708 void ch_fadestart(const char* args)
709 {
710     fadestart = atof(args);
711 }
712
713 void ch_slomo(const char* args)
714 {
715     slomospeed = atof(args);
716     slomo = !slomo;
717     slomodelay = 1000;
718 }
719
720 void ch_slofreq(const char* args)
721 {
722     slomofreq = atof(args);
723 }
724
725 void ch_skytint(const char* args)
726 {
727     sscanf(args, "%f%f%f", &skyboxr, &skyboxg, &skyboxb);
728
729     skyboxlightr = skyboxr;
730     skyboxlightg = skyboxg;
731     skyboxlightb = skyboxb;
732
733     SetUpLighting();
734
735     terrain.DoShadows();
736     Object::DoShadows();
737 }
738
739 void ch_skylight(const char* args)
740 {
741     sscanf(args, "%f%f%f", &skyboxlightr, &skyboxlightg, &skyboxlightb);
742
743     SetUpLighting();
744
745     terrain.DoShadows();
746     Object::DoShadows();
747 }
748
749 void ch_skybox(const char*)
750 {
751     skyboxtexture = !skyboxtexture;
752
753     SetUpLighting();
754
755     terrain.DoShadows();
756     Object::DoShadows();
757 }