]> git.jsancho.org Git - lugaru.git/blob - Source/Devtools/ConsoleCmds.cpp
Moved proportions system in a PersonType class
[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         creatureskin[Person::players[pnum]->creature][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 /* Console commands themselves */
164
165 void ch_quit(const char*)
166 {
167     tryquit = 1;
168 }
169
170 void ch_map(const char* args)
171 {
172     if (!LoadLevel(args)) {
173         // FIXME: Reduce code duplication with GameTick (should come from a Console class)
174         for (int k = 14; k >= 1; k--) {
175             consoletext[k] = consoletext[k - 1];
176         }
177         consoletext[0] = std::string("Could not load the requested level '") + args + "', aborting.";
178         consoleselected = 0;
179     }
180     whichlevel = -2;
181     campaign = 0;
182 }
183
184 void ch_save(const char* args)
185 {
186     std::string map_path = Folders::getUserDataPath() + "/Maps";
187     Folders::makeDirectory(map_path);
188     map_path = map_path + "/" + args;
189
190     int mapvers = 12;
191
192     FILE* tfile;
193     tfile = fopen(map_path.c_str(), "wb");
194     if (tfile == NULL) {
195         perror((std::string("Couldn't open file ") + map_path + " for saving").c_str());
196         return;
197     }
198     fpackf(tfile, "Bi", mapvers);
199     fpackf(tfile, "Bi", maptype);
200     fpackf(tfile, "Bi", hostile);
201     fpackf(tfile, "Bf Bf", viewdistance, fadestart);
202     fpackf(tfile, "Bb Bf Bf Bf", skyboxtexture, skyboxr, skyboxg, skyboxb);
203     fpackf(tfile, "Bf Bf Bf", skyboxlightr, skyboxlightg, skyboxlightb);
204     fpackf(tfile, "Bf Bf Bf Bf Bf Bi", Person::players[0]->coords.x, Person::players[0]->coords.y, Person::players[0]->coords.z,
205            Person::players[0]->yaw, Person::players[0]->targetyaw, Person::players[0]->num_weapons);
206     if (Person::players[0]->num_weapons > 0 && Person::players[0]->num_weapons < 5) {
207         for (int j = 0; j < Person::players[0]->num_weapons; j++) {
208             fpackf(tfile, "Bi", weapons[Person::players[0]->weaponids[j]].getType());
209         }
210     }
211
212     fpackf(tfile, "Bf Bf Bf", Person::players[0]->armorhead, Person::players[0]->armorhigh, Person::players[0]->armorlow);
213     fpackf(tfile, "Bf Bf Bf", Person::players[0]->protectionhead, Person::players[0]->protectionhigh, Person::players[0]->protectionlow);
214     fpackf(tfile, "Bf Bf Bf", Person::players[0]->metalhead, Person::players[0]->metalhigh, Person::players[0]->metallow);
215     fpackf(tfile, "Bf Bf", Person::players[0]->power, Person::players[0]->speedmult);
216
217     fpackf(tfile, "Bi", Person::players[0]->numclothes);
218
219     fpackf(tfile, "Bi Bi", Person::players[0]->whichskin, Person::players[0]->creature);
220
221     Dialog::saveDialogs(tfile);
222
223     for (int k = 0; k < Person::players[0]->numclothes; k++) {
224         int templength = strlen(Person::players[0]->clothes[k]);
225         fpackf(tfile, "Bi", templength);
226         for (int l = 0; l < templength; l++) {
227             fpackf(tfile, "Bb", Person::players[0]->clothes[k][l]);
228         }
229         fpackf(tfile, "Bf Bf Bf", Person::players[0]->clothestintr[k], Person::players[0]->clothestintg[k], Person::players[0]->clothestintb[k]);
230     }
231
232     fpackf(tfile, "Bi", environment);
233
234     fpackf(tfile, "Bi", Object::objects.size());
235
236     for (unsigned int k = 0; k < Object::objects.size(); k++) {
237         fpackf(tfile, "Bi Bf Bf Bf Bf Bf Bf", Object::objects[k]->type, Object::objects[k]->yaw, Object::objects[k]->pitch,
238                Object::objects[k]->position.x, Object::objects[k]->position.y, Object::objects[k]->position.z, Object::objects[k]->scale);
239     }
240
241     fpackf(tfile, "Bi", Hotspot::hotspots.size());
242     for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) {
243         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);
244         int templength = strlen(Hotspot::hotspots[i].text);
245         fpackf(tfile, "Bi", templength);
246         for (int l = 0; l < templength; l++) {
247             fpackf(tfile, "Bb", Hotspot::hotspots[i].text[l]);
248         }
249     }
250
251     fpackf(tfile, "Bi", Person::players.size());
252     if (Person::players.size() > maxplayers) {
253         cout << "Warning: this level contains more players than allowed" << endl;
254     }
255     for (unsigned j = 1; j < Person::players.size(); j++) {
256         fpackf(tfile, "Bi Bi Bf Bf Bf Bi Bi Bf Bb Bf", Person::players[j]->whichskin, Person::players[j]->creature,
257                Person::players[j]->coords.x, Person::players[j]->coords.y, Person::players[j]->coords.z,
258                Person::players[j]->num_weapons, Person::players[j]->howactive, Person::players[j]->scale, Person::players[j]->immobile, Person::players[j]->yaw);
259         if (Person::players[j]->num_weapons < 5) {
260             for (int k = 0; k < Person::players[j]->num_weapons; k++) {
261                 fpackf(tfile, "Bi", weapons[Person::players[j]->weaponids[k]].getType());
262             }
263         }
264         if (Person::players[j]->numwaypoints < 30) {
265             fpackf(tfile, "Bi", Person::players[j]->numwaypoints);
266             for (int k = 0; k < Person::players[j]->numwaypoints; k++) {
267                 fpackf(tfile, "Bf", Person::players[j]->waypoints[k].x);
268                 fpackf(tfile, "Bf", Person::players[j]->waypoints[k].y);
269                 fpackf(tfile, "Bf", Person::players[j]->waypoints[k].z);
270                 fpackf(tfile, "Bi", Person::players[j]->waypointtype[k]);
271             }
272             fpackf(tfile, "Bi", Person::players[j]->waypoint);
273         } else {
274             Person::players[j]->numwaypoints = 0;
275             Person::players[j]->waypoint = 0;
276             fpackf(tfile, "Bi Bi Bi", Person::players[j]->numwaypoints, Person::players[j]->waypoint, Person::players[j]->waypoint);
277         }
278
279         fpackf(tfile, "Bf Bf Bf", Person::players[j]->armorhead, Person::players[j]->armorhigh, Person::players[j]->armorlow);
280         fpackf(tfile, "Bf Bf Bf", Person::players[j]->protectionhead, Person::players[j]->protectionhigh, Person::players[j]->protectionlow);
281         fpackf(tfile, "Bf Bf Bf", Person::players[j]->metalhead, Person::players[j]->metalhigh, Person::players[j]->metallow);
282         fpackf(tfile, "Bf Bf", Person::players[j]->power, Person::players[j]->speedmult);
283         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));
284
285         fpackf(tfile, "Bi", Person::players[j]->numclothes);
286         if (Person::players[j]->numclothes) {
287             for (int k = 0; k < Person::players[j]->numclothes; k++) {
288                 int templength;
289                 templength = strlen(Person::players[j]->clothes[k]);
290                 fpackf(tfile, "Bi", templength);
291                 for (int l = 0; l < templength; l++) {
292                     fpackf(tfile, "Bb", Person::players[j]->clothes[k][l]);
293                 }
294                 fpackf(tfile, "Bf Bf Bf", Person::players[j]->clothestintr[k], Person::players[j]->clothestintg[k], Person::players[j]->clothestintb[k]);
295             }
296         }
297     }
298
299     fpackf(tfile, "Bi", numpathpoints);
300     for (int j = 0; j < numpathpoints; j++) {
301         fpackf(tfile, "Bf Bf Bf Bi", pathpoint[j].x, pathpoint[j].y, pathpoint[j].z, numpathpointconnect[j]);
302         for (int k = 0; k < numpathpointconnect[j]; k++) {
303             fpackf(tfile, "Bi", pathpointconnect[j][k]);
304         }
305     }
306
307     fpackf(tfile, "Bf Bf Bf Bf", mapcenter.x, mapcenter.y, mapcenter.z, mapradius);
308
309     fclose(tfile);
310 }
311
312 void ch_cellar(const char*)
313 {
314     Person::players[0]->skeleton.drawmodel.textureptr.load("Textures/Furdarko.jpg", 1, &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
315 }
316
317 void ch_tint(const char* args)
318 {
319     sscanf(args, "%f%f%f", &tintr, &tintg, &tintb);
320 }
321
322 void ch_tintr(const char* args)
323 {
324     tintr = atof(args);
325 }
326
327 void ch_tintg(const char* args)
328 {
329     tintg = atof(args);
330 }
331
332 void ch_tintb(const char* args)
333 {
334     tintb = atof(args);
335 }
336
337 void ch_speed(const char* args)
338 {
339     Person::players[0]->speedmult = atof(args);
340 }
341
342 void ch_strength(const char* args)
343 {
344     Person::players[0]->power = atof(args);
345 }
346
347 void ch_power(const char* args)
348 {
349     Person::players[0]->power = atof(args);
350 }
351
352 void ch_size(const char* args)
353 {
354     Person::players[0]->scale = atof(args) * .2;
355 }
356
357 void ch_sizenear(const char* args)
358 {
359     int closest = findClosestPlayer();
360     if (closest >= 0) {
361         Person::players[closest]->scale = atof(args) * .2;
362     }
363 }
364
365 void ch_proportion(const char* args)
366 {
367     set_proportion(0, args);
368 }
369
370 void ch_proportionnear(const char* args)
371 {
372     int closest = findClosestPlayer();
373     if (closest >= 0) {
374         set_proportion(closest, args);
375     }
376 }
377
378 void ch_protection(const char* args)
379 {
380     set_protection(0, args);
381 }
382
383 void ch_protectionnear(const char* args)
384 {
385     int closest = findClosestPlayer();
386     if (closest >= 0) {
387         set_protection(closest, args);
388     }
389 }
390
391 void ch_armor(const char* args)
392 {
393     set_armor(0, args);
394 }
395
396 void ch_armornear(const char* args)
397 {
398     int closest = findClosestPlayer();
399     if (closest >= 0) {
400         set_armor(closest, args);
401     }
402 }
403
404 void ch_protectionreset(const char*)
405 {
406     set_protection(0, "1 1 1");
407     set_armor(0, "1 1 1");
408 }
409
410 void ch_metal(const char* args)
411 {
412     set_metal(0, args);
413 }
414
415 void ch_noclothes(const char* args)
416 {
417     set_noclothes(0, args);
418 }
419
420 void ch_noclothesnear(const char* args)
421 {
422     int closest = findClosestPlayer();
423     if (closest >= 0) {
424         set_noclothes(closest, args);
425     }
426 }
427
428 void ch_clothes(const char* args)
429 {
430     set_clothes(0, args);
431 }
432
433 void ch_clothesnear(const char* args)
434 {
435     int closest = findClosestPlayer();
436     if (closest >= 0) {
437         set_clothes(closest, args);
438     }
439 }
440
441 void ch_belt(const char*)
442 {
443     Person::players[0]->skeleton.clothes = !Person::players[0]->skeleton.clothes;
444 }
445
446 void ch_cellophane(const char*)
447 {
448     cellophane = !cellophane;
449 }
450
451 void ch_funnybunny(const char*)
452 {
453     Person::players[0]->creature = rabbittype;
454     Person::players[0]->skeletonLoad(true);
455     Person::players[0]->scale = .2;
456     Person::players[0]->headless = 0;
457     Person::players[0]->damagetolerance = 200;
458     set_proportion(0, "1 1 1 1");
459 }
460
461 void ch_wolfie(const char*)
462 {
463     Person::players[0]->creature = wolftype;
464     Person::players[0]->skeletonLoad();
465     Person::players[0]->damagetolerance = 300;
466     set_proportion(0, "1 1 1 1");
467 }
468
469 void ch_wolfieisgod(const char* args)
470 {
471     ch_wolfie(args);
472 }
473
474 void ch_wolf(const char*)
475 {
476     Person::players[0]->skeleton.drawmodel.textureptr.load("Textures/Wolf.jpg", 1, &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
477 }
478
479 void ch_snowwolf(const char*)
480 {
481     Person::players[0]->skeleton.drawmodel.textureptr.load("Textures/SnowWolf.jpg", 1, &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
482 }
483
484 void ch_darkwolf(const char*)
485 {
486     Person::players[0]->skeleton.drawmodel.textureptr.load("Textures/DarkWolf.jpg", 1, &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
487 }
488
489 void ch_lizardwolf(const char*)
490 {
491     Person::players[0]->skeleton.drawmodel.textureptr.load("Textures/LizardWolf.jpg", 1, &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
492 }
493
494 void ch_white(const char*)
495 {
496     Person::players[0]->skeleton.drawmodel.textureptr.load("Textures/Fur.jpg", 1, &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
497 }
498
499 void ch_brown(const char*)
500 {
501     Person::players[0]->skeleton.drawmodel.textureptr.load("Textures/Fur3.jpg", 1, &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
502 }
503
504 void ch_black(const char*)
505 {
506     Person::players[0]->skeleton.drawmodel.textureptr.load("Textures/Fur2.jpg", 1, &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
507 }
508
509 void ch_sizemin(const char*)
510 {
511     for (unsigned i = 1; i < Person::players.size(); i++) {
512         if (Person::players[i]->scale < 0.8 * 0.2) {
513             Person::players[i]->scale = 0.8 * 0.2;
514         }
515     }
516 }
517
518 void ch_tutorial(const char* args)
519 {
520     Tutorial::active = atoi(args);
521 }
522
523 void ch_hostile(const char* args)
524 {
525     hostile = atoi(args);
526 }
527
528 void ch_type(const char* args)
529 {
530     int n = sizeof(editortypenames) / sizeof(editortypenames[0]);
531     for (int i = 0; i < n; i++) {
532         if (stripfx(args, editortypenames[i])) {
533             editoractive = i;
534             break;
535         }
536     }
537 }
538
539 void ch_path(const char* args)
540 {
541     unsigned int n = sizeof(pathtypenames) / sizeof(pathtypenames[0]);
542     for (unsigned int i = 0; i < n; i++) {
543         if (stripfx(args, pathtypenames[i])) {
544             editorpathtype = i;
545             break;
546         }
547     }
548 }
549
550 void ch_hs(const char* args)
551 {
552     float size;
553     int type, shift;
554     sscanf(args, "%f%d %n", &size, &type, &shift);
555
556     Hotspot::hotspots.emplace_back(Person::players[0]->coords, type, size);
557
558     strcpy(Hotspot::hotspots.back().text, args + shift);
559     strcat(Hotspot::hotspots.back().text, "\n");
560 }
561
562 void ch_dialogue(const char* args)
563 {
564     int type;
565     char buf1[32];
566
567     sscanf(args, "%d %31s", &type, buf1);
568     std::string filename = std::string("Dialogues/") + buf1 + ".txt";
569
570     Dialog::dialogs.push_back(Dialog(type, filename));
571
572     Dialog::directing = true;
573     Dialog::indialogue = 0;
574     Dialog::whichdialogue = Dialog::dialogs.size();
575 }
576
577 void ch_fixdialogue(const char* args)
578 {
579     char buf1[32];
580     int whichdi;
581
582     sscanf(args, "%d %31s", &whichdi, buf1);
583     std::string filename = std::string("Dialogues/") + buf1 + ".txt";
584
585     Dialog::dialogs[whichdi] = Dialog(Dialog::dialogs[whichdi].type, filename);
586 }
587
588 void ch_fixtype(const char* args)
589 {
590     int dlg;
591     sscanf(args, "%d", &dlg);
592     Dialog::dialogs[0].type = dlg;
593 }
594
595 void ch_fixrotation(const char*)
596 {
597     int playerId = Dialog::currentScene().participantfocus;
598     Dialog::currentDialog().participantyaw[playerId] = Person::players[playerId]->yaw;
599 }
600
601 void ch_ddialogue(const char*)
602 {
603     if (!Dialog::dialogs.empty()) {
604         Dialog::dialogs.pop_back();
605     }
606 }
607
608 void ch_dhs(const char*)
609 {
610     if (!Hotspot::hotspots.empty()) {
611         Hotspot::hotspots.pop_back();
612     }
613 }
614
615 void ch_immobile(const char*)
616 {
617     Person::players[0]->immobile = 1;
618 }
619
620 void ch_allimmobile(const char*)
621 {
622     for (unsigned i = 1; i < Person::players.size(); i++) {
623         Person::players[i]->immobile = 1;
624     }
625 }
626
627 void ch_mobile(const char*)
628 {
629     Person::players[0]->immobile = 0;
630 }
631
632 void ch_default(const char*)
633 {
634     Person::players[0]->armorhead = 1;
635     Person::players[0]->armorhigh = 1;
636     Person::players[0]->armorlow = 1;
637     Person::players[0]->protectionhead = 1;
638     Person::players[0]->protectionhigh = 1;
639     Person::players[0]->protectionlow = 1;
640     Person::players[0]->metalhead = 1;
641     Person::players[0]->metalhigh = 1;
642     Person::players[0]->metallow = 1;
643     Person::players[0]->power = 1;
644     Person::players[0]->speedmult = 1;
645     Person::players[0]->scale = 1;
646
647     Person::players[0]->setProportions(1, 1, 1, 1);
648
649     Person::players[0]->numclothes = 0;
650     Person::players[0]->skeleton.drawmodel.textureptr.load(
651         creatureskin[Person::players[0]->creature][Person::players[0]->whichskin], 1,
652         &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
653
654     editoractive = typeactive;
655     Person::players[0]->immobile = 0;
656 }
657
658 void ch_play(const char* args)
659 {
660     int dlg;
661     sscanf(args, "%d", &dlg);
662     Dialog::whichdialogue = dlg;
663
664     if (Dialog::whichdialogue >= int(Dialog::dialogs.size())) {
665         return;
666     }
667
668     Dialog::currentDialog().play();
669 }
670
671 void ch_mapkilleveryone(const char*)
672 {
673     maptype = mapkilleveryone;
674 }
675
676 void ch_mapkillmost(const char*)
677 {
678     maptype = mapkillmost;
679 }
680
681 void ch_mapkillsomeone(const char*)
682 {
683     maptype = mapkillsomeone;
684 }
685
686 void ch_mapgosomewhere(const char*)
687 {
688     maptype = mapgosomewhere;
689 }
690
691 void ch_viewdistance(const char* args)
692 {
693     viewdistance = atof(args) * 100;
694 }
695
696 void ch_fadestart(const char* args)
697 {
698     fadestart = atof(args);
699 }
700
701 void ch_slomo(const char* args)
702 {
703     slomospeed = atof(args);
704     slomo = !slomo;
705     slomodelay = 1000;
706 }
707
708 void ch_slofreq(const char* args)
709 {
710     slomofreq = atof(args);
711 }
712
713 void ch_skytint(const char* args)
714 {
715     sscanf(args, "%f%f%f", &skyboxr, &skyboxg, &skyboxb);
716
717     skyboxlightr = skyboxr;
718     skyboxlightg = skyboxg;
719     skyboxlightb = skyboxb;
720
721     SetUpLighting();
722
723     terrain.DoShadows();
724     Object::DoShadows();
725 }
726
727 void ch_skylight(const char* args)
728 {
729     sscanf(args, "%f%f%f", &skyboxlightr, &skyboxlightg, &skyboxlightb);
730
731     SetUpLighting();
732
733     terrain.DoShadows();
734     Object::DoShadows();
735 }
736
737 void ch_skybox(const char*)
738 {
739     skyboxtexture = !skyboxtexture;
740
741     SetUpLighting();
742
743     terrain.DoShadows();
744     Object::DoShadows();
745 }