Skyscraper 2.0
commands.cpp
Go to the documentation of this file.
1/*
2 Skyscraper 2.0 Alpha - Script Processor - Global Commands
3 Copyright (C)2003-2024 Ryan Thoryk
4 https://www.skyscrapersim.net
5 https://sourceforge.net/projects/skyscraper/
6 Contact - ryan@skyscrapersim.net
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21*/
22
23#include "globals.h"
24#include "sbs.h"
25#include "enginecontext.h"
26#include "floor.h"
27#include "camera.h"
28#include "texture.h"
29#include "mesh.h"
30#include "soundsystem.h"
31#include "sound.h"
32#include "reverb.h"
33#include "wall.h"
34#include "trigger.h"
35#include "control.h"
36#include "model.h"
37#include "primitive.h"
38#include "custom.h"
39#include "stairs.h"
40#include "shaft.h"
41#include "light.h"
42#include "elevator.h"
43#include "elevatorcar.h"
44#include "cameratexture.h"
45#include "door.h"
46#include "manager.h"
47#include "utility.h"
48#include "geometry.h"
49#include "scriptproc.h"
50#include "section.h"
51
52using namespace SBS;
53
54namespace Skyscraper {
55
60
62{
63 //process global commands
64
65 //IF/While statement
66 int IsIf = 0;
67 if (StartsWithNoCase(LineData, "if"))
68 IsIf = 1;
69 if (StartsWithNoCase(LineData, "while"))
70 IsIf = 2;
71 if (IsIf > 0)
72 {
73 int loc1 = LineData.find("[", 0);
74 int loc2 = LineData.find("]", 0);
75 std::string str;
76 if (loc1 + loc2 > 0)
77 str = LineData.substr(loc1 + 1, loc2 - loc1 - 1);
78 else
79 str = "";
80 TrimString(str);
81 if (IfProc(str) == true)
82 {
83 //trim off IF/While statement
84 LineData = LineData.substr(loc2 + 1);
86
87 if (IsIf == 2)
88 config->InWhile = true;
89
90 return sCheckFloors;
91 }
92 else
93 return sNextLine; //skip line
94 }
95
96 if (config->SectionNum != 2 && config->SectionNum != 4)
97 {
98 //process math functions
99 if (MathFunctions(LineData) == sError)
100 return sError;
101
102 //process any functions
103 if (parent->FunctionProc() == true)
104 return sNextLine;
105 }
106
107 TextureManager *texturemanager = Simcore->GetTextureManager();
108
109 //AddTriangleWall command
110 if (StartsWithNoCase(LineData, "addtrianglewall"))
111 {
112 //get data
113 int params = SplitData(LineData, 16);
114
115 if (params != 14)
116 return ScriptError("Incorrect number of parameters");
117
118 //check numeric values
119 for (int i = 3; i <= 13; i++)
120 {
121 if (!IsNumeric(tempdata[i]))
122 return ScriptError("Invalid value: " + tempdata[i]);
123 }
124
125 std::string meshname = SetCaseCopy(tempdata[0], false);
126
127 MeshObject *mesh = GetMeshObject(meshname);
128
129 if (!mesh)
130 return ScriptError("Invalid object");
131
132 Real voffset1 = ToFloat(tempdata[4]);
133 Real voffset2 = ToFloat(tempdata[7]);
134 Real voffset3 = ToFloat(tempdata[10]);
135
136 if (config->SectionNum == 2)
137 {
138 if (meshname == "floor")
139 {
140 Real base = Simcore->GetFloor(config->Current)->GetBase(true);
141 voffset1 += base;
142 voffset2 += base;
143 voffset3 += base;
144 }
145 else if (meshname == "external" || meshname == "landscape" || meshname == "buildings")
146 {
148 voffset1 += base;
149 voffset2 += base;
150 voffset3 += base;
151 }
152 }
153
154 //stop here if in Check mode
155 if (config->CheckScript == true)
156 return sNextLine;
157
158 //create triangle wall
159 StoreCommand(Simcore->AddTriangleWall(mesh, tempdata[1], tempdata[2], ToFloat(tempdata[3]), voffset1, ToFloat(tempdata[5]), ToFloat(tempdata[6]), voffset2, ToFloat(tempdata[8]), ToFloat(tempdata[9]), voffset3, ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13])));
160
161 return sNextLine;
162 }
163
164 //AddWall command
165 if (StartsWithNoCase(LineData, "addwall"))
166 {
167 //get data
168 int params = SplitData(LineData, 8);
169
170 if (params != 14)
171 return ScriptError("Incorrect number of parameters");
172
173 //check numeric values
174 for (int i = 3; i <= 13; i++)
175 {
176 if (!IsNumeric(tempdata[i]))
177 return ScriptError("Invalid value: " + tempdata[i]);
178 }
179
180 std::string meshname = SetCaseCopy(tempdata[0], false);
181
182 MeshObject *mesh = GetMeshObject(meshname);
183
184 if (!mesh)
185 return ScriptError("Invalid object");
186
187 //stop here if in Check mode
188 if (config->CheckScript == true)
189 return sNextLine;
190
191 //create wall
192 StoreCommand(Simcore->AddWall(mesh, tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), ToFloat(tempdata[9]), ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13])));
193 return sNextLine;
194 }
195
196 //AddFloor command
197 if (StartsWithNoCase(LineData, "addfloor "))
198 {
199 //get data
200 int params = SplitData(LineData, 9);
201
202 if (params != 12 && params != 14)
203 return ScriptError("Incorrect number of parameters");
204
205 bool compat = false;
206 if (params == 12)
207 compat = true;
208
209 //check numeric values
210 if (compat == true)
211 {
212 for (int i = 3; i <= 11; i++)
213 {
214 if (!IsNumeric(tempdata[i]))
215 return ScriptError("Invalid value: " + tempdata[i]);
216 }
217 if (warn_deprecated == true)
218 ScriptWarning("Syntax deprecated");
219 }
220 else
221 {
222 for (int i = 3; i <= 13; i++)
223 {
224 if (i == 10)
225 i = 12;
226
227 if (!IsNumeric(tempdata[i]))
228 return ScriptError("Invalid value: " + tempdata[i]);
229 }
230 }
231
232 std::string meshname = SetCaseCopy(tempdata[0], false);
233
234 MeshObject *mesh = GetMeshObject(meshname);
235
236 if (!mesh)
237 return ScriptError("Invalid object");
238
239 //stop here if in Check mode
240 if (config->CheckScript == true)
241 return sNextLine;
242
243 //create floor
244 if (compat == true)
245 StoreCommand(Simcore->AddFloor(mesh, tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), ToFloat(tempdata[9]), config->ReverseAxis, false, ToFloat(tempdata[10]), ToFloat(tempdata[11]), true));
246 else
247 StoreCommand(Simcore->AddFloor(mesh, tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), ToFloat(tempdata[9]), ToBool(tempdata[10]), ToBool(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13])));
248 return sNextLine;
249 }
250
251 //AddGround command
252 if (StartsWithNoCase(LineData, "addground"))
253 {
254 //get data
255 int params = SplitData(LineData, 10);
256
257 if (params != 9)
258 return ScriptError("Incorrect number of parameters");
259
260 //check numeric values
261 for (int i = 2; i <= 8; i++)
262 {
263 if (!IsNumeric(tempdata[i]))
264 return ScriptError("Invalid value: " + tempdata[i]);
265 }
266
267 //stop here if in Check mode
268 if (config->CheckScript == true)
269 return sNextLine;
270
271 //create tiled ground
272 StoreCommand(Simcore->AddGround(tempdata[0], tempdata[1], ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToInt(tempdata[7]), ToInt(tempdata[8])));
273 return sNextLine;
274 }
275
276 //Cut command
277 if (StartsWithNoCase(LineData, "cut "))
278 {
279 //get data
280 int params = SplitData(LineData, 4);
281
282 if (params != 9)
283 return ScriptError("Incorrect number of parameters");
284
285 //check numeric values
286 for (int i = 1; i <= 6; i++)
287 {
288 if (!IsNumeric(tempdata[i]))
289 return ScriptError("Invalid value: " + tempdata[i]);
290 }
291
292 MeshObject *mesh = GetMeshObject(tempdata[0]);
293
294 if (!mesh)
295 return ScriptError("Invalid object");
296
297 //stop here if in Check mode
298 if (config->CheckScript == true)
299 return sNextLine;
300
301 //perform cut
302 mesh->Cut(Vector3(ToFloat(tempdata[1]), ToFloat(tempdata[2]), ToFloat(tempdata[3])), Vector3(ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6])), ToBool(tempdata[7]), ToBool(tempdata[8]));
303 return sNextLine;
304 }
305
306 //Set command
307 if (StartsWithNoCase(LineData, "set "))
308 {
309 int loc = LineData.find("=", 0);
310 if (loc < 0)
311 return ScriptError("Syntax Error");
312
313 std::string str = GetBeforeEquals(LineData, false);
314
315 //reserved keywords
316 if (str == "base" || str == "floor" || str == "height" || str == "interfloorheight" || str == "fullheight" || str == "elevator" || str == "minx" || str == "maxx" || str == "minz" || str == "maxz" || str == "number" || str.substr(0, 4) == "param" || str == "floorname" || str == "floortype" || str == "floorid" || str == "description")
317 return ScriptError("Cannot use system variable name");
318
319 //get text after equal sign
320 bool equals;
321 std::string value = Calc(GetAfterEquals(LineData, equals));
322
323 //find existing variable by name
324 int index = -1;
325 for (int i = 0; i < (int)parent->variables.size(); i++)
326 {
327 if (parent->variables[i].name == str)
328 {
329 index = i;
330 break;
331 }
332 }
333
334 if (index == -1)
335 {
336 //create new variable
337 VariableMap variable;
338 variable.name = str;
339 variable.value = value;
340 parent->variables.emplace_back(variable);
341 value = variable.value;
342 }
343 else
344 {
345 //set existing variable
346 parent->variables[index].name = str;
347 parent->variables[index].value = value;
348 value = parent->variables[index].value;
349 }
350
351 if (Simcore->Verbose == true)
352 engine->Report("Variable '" + str + "' set to " + value);
353 return sNextLine;
354 }
355
356 //CreateWallBox2 command
357 if (StartsWithNoCase(LineData, "createwallbox2"))
358 {
359 //get data
360 int params = SplitData(LineData, 15);
361
362 if (params != 15)
363 return ScriptError("Incorrect number of parameters");
364
365 //check numeric values
366 for (int i = 3; i <= 10; i++)
367 {
368 if (!IsNumeric(tempdata[i]))
369 return ScriptError("Invalid value: " + tempdata[i]);
370 }
371
372 std::string meshname = SetCaseCopy(tempdata[0], false);
373
374 MeshObject *mesh = GetMeshObject(meshname);
375
376 if (!mesh)
377 return ScriptError("Invalid object");
378
379 //stop here if in Check mode
380 if (config->CheckScript == true)
381 return sNextLine;
382
383 Real voffset = ToFloat(tempdata[8]);
384
385 if (config->SectionNum == 2)
386 {
387 if (meshname == "floor")
388 voffset += Real(Simcore->GetFloor(config->Current)->GetBase(true));
389 else if (meshname == "external" || meshname == "landscape" || meshname == "buildings")
390 voffset += Real(Simcore->GetFloor(config->Current)->GetBase());
391 }
392
393 StoreCommand(Simcore->CreateWallBox2(mesh, tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), voffset, ToFloat(tempdata[9]), ToFloat(tempdata[10]), ToBool(tempdata[11]), ToBool(tempdata[12]), ToBool(tempdata[13]), ToBool(tempdata[14])));
394
395 return sNextLine;
396 }
397
398 //CreateWallBox command
399 if (StartsWithNoCase(LineData, "createwallbox "))
400 {
401 //get data
402 int params = SplitData(LineData, 14);
403
404 if (params != 15)
405 return ScriptError("Incorrect number of parameters");
406
407 //check numeric values
408 for (int i = 3; i <= 10; i++)
409 {
410 if (!IsNumeric(tempdata[i]))
411 return ScriptError("Invalid value: " + tempdata[i]);
412 }
413
414 std::string meshname = SetCaseCopy(tempdata[0], false);
415
416 MeshObject *mesh = GetMeshObject(meshname);
417
418 if (!mesh)
419 return ScriptError("Invalid object");
420
421 //stop here if in Check mode
422 if (config->CheckScript == true)
423 return sNextLine;
424
425 Real voffset = ToFloat(tempdata[8]);
426
427 if (config->SectionNum == 2)
428 {
429 if (meshname == "floor")
430 voffset += Real(Simcore->GetFloor(config->Current)->GetBase(true));
431 else if (meshname == "external" || meshname == "landscape" || meshname == "buildings")
432 voffset += Real(Simcore->GetFloor(config->Current)->GetBase());
433 }
434
435 StoreCommand(Simcore->CreateWallBox(mesh, tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), voffset, ToFloat(tempdata[9]), ToFloat(tempdata[10]), ToBool(tempdata[11]), ToBool(tempdata[12]), ToBool(tempdata[13]), ToBool(tempdata[14])));
436
437 return sNextLine;
438 }
439
440 //AddCustomWall command
441 if (StartsWithNoCase(LineData, "addcustomwall "))
442 {
443 //get data
444 int params = SplitData(LineData, 14);
445
446 if (params < 14)
447 return ScriptError("Incorrect number of parameters");
448
449 bool relative_option = false, relative = false;
450 if (IsNumeric(tempdata[3]) == false)
451 {
452 relative_option = true;
453 relative = ToBool(tempdata[3]);
454 }
455
456 //check numeric values
457 int start = 3;
458 if (relative_option == true)
459 start = 4;
460
461 for (int i = start; i < params; i++)
462 {
463 if (!IsNumeric(tempdata[i]))
464 return ScriptError("Invalid value: " + tempdata[i]);
465 }
466
467 std::string meshname = SetCaseCopy(tempdata[0], false);
468
469 MeshObject *mesh = GetMeshObject(meshname);
470
471 if (!mesh)
472 return ScriptError("Invalid object");
473
474 //stop here if in Check mode
475 if (config->CheckScript == true)
476 return sNextLine;
477
478 Real voffset = 0;
479
480 if (config->SectionNum == 2)
481 {
482 if (relative == true)
483 {
484 if (meshname == "floor")
485 voffset += Real(Simcore->GetFloor(config->Current)->GetBase(true));
486 else if (meshname == "external" || meshname == "landscape" || meshname == "buildings")
487 voffset += Real(Simcore->GetFloor(config->Current)->GetBase());
488 }
489 else if (relative_option == false)
490 {
491 if (meshname == "floor" && config->SectionNum == 2)
492 voffset -= mesh->GetPosition().y; //subtract altitude for new positioning model
493 }
494 }
495
496 PolyArray varray;
497 for (int i = start; i < params - 2; i += 3)
498 varray.emplace_back(Vector3(ToFloat(tempdata[i]), ToFloat(tempdata[i + 1]) + voffset, ToFloat(tempdata[i + 2])));
499
500 StoreCommand(Simcore->AddCustomWall(mesh, tempdata[1], tempdata[2], varray, ToFloat(tempdata[params - 2]), ToFloat(tempdata[params - 1])));
501
502 return sNextLine;
503 }
504
505 //AddCustomFloor command
506 if (StartsWithNoCase(LineData, "addcustomfloor "))
507 {
508 //get data
509 int params = SplitData(LineData, 15);
510
511 //check numeric values
512 for (int i = 3; i < params; i++)
513 {
514 if (!IsNumeric(tempdata[i]))
515 return ScriptError("Invalid value: " + tempdata[i]);
516 }
517
518 std::string meshname = SetCaseCopy(tempdata[0], false);
519
520 MeshObject *mesh = GetMeshObject(meshname);
521
522 if (!mesh)
523 return ScriptError("Invalid object");
524
525 //stop here if in Check mode
526 if (config->CheckScript == true)
527 return sNextLine;
528
529 Real altitude = ToFloat(tempdata[params - 3]);
530
531 if (config->SectionNum == 2)
532 {
533 if (meshname == "floor")
534 altitude += Simcore->GetFloor(config->Current)->GetBase(true);
535 else if (meshname == "external" || meshname == "landscape" || meshname == "buildings")
536 altitude += Simcore->GetFloor(config->Current)->GetBase();
537 }
538
539 std::vector<Vector2> varray;
540 for (int i = 3; i < params - 3; i += 2)
541 varray.emplace_back(Vector2(ToFloat(tempdata[i]), ToFloat(tempdata[i + 1])));
542
543 StoreCommand(Simcore->AddCustomFloor(mesh, tempdata[1], tempdata[2], varray, altitude, ToFloat(tempdata[params - 2]), ToFloat(tempdata[params - 1])));
544
545 return sNextLine;
546 }
547
548 //AddPolygon command
549 if (StartsWithNoCase(LineData, "addpolygon"))
550 {
551 //get data
552 int params = SplitData(LineData, 11);
553
554 //check numeric values
555 for (int i = 3; i < params; i++)
556 {
557 if (!IsNumeric(tempdata[i]))
558 return ScriptError("Invalid value: " + tempdata[i]);
559 }
560
561 std::string meshname = SetCaseCopy(tempdata[0], false);
562
563 MeshObject *mesh = GetMeshObject(meshname);
564
565 if (!mesh)
566 return ScriptError("Invalid mesh object");
567
568 Wall *wall = mesh->GetWallByName(tempdata[1]);
569
570 if (!wall)
571 return ScriptError("Invalid wall object");
572
573 //stop here if in Check mode
574 if (config->CheckScript == true)
575 return sNextLine;
576
577 Real voffset = 0.0;
578
579 if (config->SectionNum == 2)
580 {
581 if (meshname == "floor")
582 voffset += Simcore->GetFloor(config->Current)->GetBase(true);
583 else if (meshname == "external" || meshname == "landscape" || meshname == "buildings")
584 voffset += Simcore->GetFloor(config->Current)->GetBase();
585 }
586
587 PolyArray varray;
588 for (int i = 3; i < params - 2; i += 3)
589 varray.emplace_back(Vector3(ToFloat(tempdata[i]), ToFloat(tempdata[i + 1]) + voffset, ToFloat(tempdata[i + 2])));
590
591 Simcore->AddPolygon(wall, tempdata[2], varray, ToFloat(tempdata[params - 2]), ToFloat(tempdata[params - 1]));
592
593 return sNextLine;
594 }
595
596 //AddShaft command
597 if (StartsWithNoCase(LineData, "addshaft "))
598 {
599 //get data
600 int params = SplitData(LineData, 9);
601
602 if (params != 5 && params != 6)
603 return ScriptError("Incorrect number of parameters");
604
605 bool compat = false;
606 if (params == 6)
607 compat = true;
608
609 //check numeric values
610 if (compat == true)
611 {
612 for (int i = 0; i <= 5; i++)
613 {
614 if (!IsNumeric(tempdata[i]))
615 return ScriptError("Invalid value: " + tempdata[i]);
616 }
617 if (warn_deprecated == true)
618 ScriptWarning("Syntax deprecated");
619 }
620 else
621 {
622 for (int i = 0; i <= 4; i++)
623 {
624 if (!IsNumeric(tempdata[i]))
625 return ScriptError("Invalid value: " + tempdata[i]);
626 }
627 }
628
629 int startfloor, endfloor;
630 if (compat == true)
631 {
632 startfloor = ToInt(tempdata[4]);
633 endfloor = ToInt(tempdata[5]);
634 }
635 else
636 {
637 startfloor = ToInt(tempdata[3]);
638 endfloor = ToInt(tempdata[4]);
639 }
640
641 if (startfloor < -Simcore->Basements)
642 return ScriptError("Invalid starting floor");
643 if (endfloor > Simcore->Floors - 1)
644 return ScriptError("Invalid ending floor");
645
646 Shaft *shaft;
647 if (compat == true)
648 shaft = Simcore->CreateShaft(ToInt(tempdata[0]), ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToInt(tempdata[4]), ToInt(tempdata[5]));
649 else
650 shaft = Simcore->CreateShaft(ToInt(tempdata[0]), ToFloat(tempdata[1]), ToFloat(tempdata[2]), ToInt(tempdata[3]), ToInt(tempdata[4]));
651
652 if (!shaft)
653 return ScriptError();
654
655 StoreCommand(shaft);
656 return sNextLine;
657 }
658
659 //ShaftCut command
660 if (StartsWithNoCase(LineData, "shaftcut "))
661 {
662 //get data
663 int params = SplitData(LineData, 9);
664
665 if (params != 7)
666 return ScriptError("Incorrect number of parameters");
667
668 //check numeric values
669 for (int i = 0; i <= 6; i++)
670 {
671 if (!IsNumeric(tempdata[i]))
672 return ScriptError("Invalid value: " + tempdata[i]);
673 }
674
675 //check for existence of shaft
676 int shaftnum = ToInt(tempdata[0]);
677 if (shaftnum < 1 || shaftnum > Simcore->GetShaftCount())
678 return ScriptError("Invalid shaft " + tempdata[0]);
679
680 //stop here if in Check mode
681 if (config->CheckScript == true)
682 return sNextLine;
683
684 Simcore->GetShaft(shaftnum)->CutFloors(true, Vector2(ToFloat(tempdata[1]), ToFloat(tempdata[2])), Vector2(ToFloat(tempdata[3]), ToFloat(tempdata[4])), ToFloat(tempdata[5]), ToFloat(tempdata[6]));
685 return sNextLine;
686 }
687
688 //ShaftShowFloors command
689 if (StartsWithNoCase(LineData, "shaftshowfloors"))
690 {
691 //get shaft number
692 int loc = LineData.find("=");
693 if (loc < 0)
694 return ScriptError("Syntax error");
695 int shaftnum;
696 std::string str = GetBeforeEquals(LineData);
697 if (!IsNumeric(str, shaftnum))
698 return ScriptError("Invalid shaft number");
699
700 if (shaftnum < 1 || shaftnum > Simcore->GetShaftCount())
701 return ScriptError("Invalid shaft number");
702
703 int params = SplitAfterEquals(LineData, false);
704 if (params < 1)
705 return ScriptError("Syntax Error");
706
707 Simcore->GetShaft(shaftnum)->ShowFloors = 1;
708
709 //determine if last parameter is a boolean, used for full floor selection on/off
710 if (IsBoolean(tempdata[params - 1]) == true)
711 {
712 if (ToBool(tempdata[params - 1]) == true)
713 Simcore->GetShaft(shaftnum)->ShowFloors = 2;
714 params--;
715 }
716
717 for (int line = 0; line < params; line++)
718 {
719 if (tempdata[line].find("-", 1) > 0)
720 {
721 int start, end;
722 //found a range marker
723 std::string str1 = tempdata[line].substr(0, tempdata[line].find("-", 1));
724 std::string str2 = tempdata[line].substr(tempdata[line].find("-", 1) + 1);
725 TrimString(str1);
726 TrimString(str2);
727 if (!IsNumeric(str1, start) || !IsNumeric(str2, end))
728 return ScriptError("Invalid value");
729
730 if (end < start)
731 {
732 int temp = start;
733 start = end;
734 end = temp;
735 }
736
737 for (int k = start; k <= end; k++)
738 Simcore->GetShaft(shaftnum)->AddShowFloor(k);
739 }
740 else
741 {
742 int showfloor;
743 if (!IsNumeric(tempdata[line], showfloor))
744 return ScriptError("Invalid value");
745 Simcore->GetShaft(shaftnum)->AddShowFloor(showfloor);
746 }
747 }
748 return sNextLine;
749 }
750
751 //ShaftShowInterfloors command
752 if (StartsWithNoCase(LineData, "shaftshowinterfloors"))
753 {
754 //get shaft number
755 int loc = LineData.find("=");
756 if (loc < 0)
757 return ScriptError("Syntax error");
758 int shaftnum;
759 std::string str = GetBeforeEquals(LineData);
760 if (!IsNumeric(str, shaftnum))
761 return ScriptError("Invalid shaft number");
762 if (shaftnum < 1 || shaftnum > Simcore->GetShaftCount())
763 return ScriptError("Invalid shaft number");
764 Simcore->GetShaft(shaftnum)->ShowInterfloors = true;
765
766 int params = SplitAfterEquals(LineData, false);
767 if (params < 1)
768 return ScriptError("Syntax Error");
769
770 for (int line = 0; line < params; line++)
771 {
772 int start, end;
773 if (GetRange(tempdata[line], start, end))
774 {
775 for (int k = start; k <= end; k++)
776 Simcore->GetShaft(shaftnum)->AddShowInterfloor(k);
777 }
778 else
779 {
780 int showfloor;
781 if (!IsNumeric(tempdata[line], showfloor))
782 return ScriptError("Invalid value");
783 Simcore->GetShaft(shaftnum)->AddShowInterfloor(showfloor);
784 }
785 }
786 return sNextLine;
787 }
788
789 //ShaftShowOutside command
790 if (StartsWithNoCase(LineData, "shaftshowoutside"))
791 {
792 //get shaft number
793 int loc = LineData.find("=");
794 if (loc < 0)
795 return ScriptError("Syntax error");
796 int shaftnum;
797 std::string str = GetBeforeEquals(LineData);
798 if (!IsNumeric(str, shaftnum))
799 return ScriptError("Invalid shaft number");
800 if (shaftnum < 1 || shaftnum > Simcore->GetShaftCount())
801 return ScriptError("Invalid shaft number");
802 Simcore->GetShaft(shaftnum)->ShowOutside = true;
803
804 int params = SplitAfterEquals(LineData, false);
805 if (params < 1)
806 return ScriptError("Syntax Error");
807
808 for (int line = 0; line < params; line++)
809 {
810 int start, end;
811 if (GetRange(tempdata[line], start, end))
812 {
813 for (int k = start; k <= end; k++)
814 Simcore->GetShaft(shaftnum)->AddShowOutside(k);
815 }
816 else
817 {
818 int showfloor;
819 if (!IsNumeric(tempdata[line], showfloor))
820 return ScriptError("Invalid value");
821 Simcore->GetShaft(shaftnum)->AddShowOutside(showfloor);
822 }
823 }
824 return sNextLine;
825 }
826
827 //ShowFullShaft command
828 if (StartsWithNoCase(LineData, "showfullshaft"))
829 {
830 //get shaft number
831 int loc = LineData.find("=");
832 if (loc < 0)
833 return ScriptError("Syntax error");
834 int shaftnum;
835 std::string str = GetBeforeEquals(LineData);
836 if (!IsNumeric(str, shaftnum))
837 return ScriptError("Invalid shaft number");
838 if (shaftnum < 1 || shaftnum > Simcore->GetShaftCount())
839 return ScriptError("Invalid shaft number");
840
841 //get text after equal sign
842 bool equals;
843 std::string value = GetAfterEquals(LineData, equals);
844
845 Simcore->GetShaft(shaftnum)->SetShowFull(ToBool(value));
846 return sNextLine;
847 }
848
849 //CreateStairwell command
850 if (StartsWithNoCase(LineData, "createstairwell"))
851 {
852 //get data
853 int params = SplitData(LineData, 16);
854
855 if (params != 5)
856 return ScriptError("Incorrect number of parameters");
857
858 //check numeric values
859 for (int i = 0; i <= 4; i++)
860 {
861 if (!IsNumeric(tempdata[i]))
862 return ScriptError("Invalid value: " + tempdata[i]);
863 }
864
865 Stairwell *stairs = Simcore->CreateStairwell(ToInt(tempdata[0]), ToFloat(tempdata[1]), ToFloat(tempdata[2]), ToInt(tempdata[3]), ToInt(tempdata[4]));
866 if (!stairs)
867 return ScriptError();
868
869 StoreCommand(stairs);
870 return sNextLine;
871 }
872
873 //CutStairwell command
874 if (StartsWithNoCase(LineData, "cutstairwell "))
875 {
876 //get data
877 int params = SplitData(LineData, 13);
878
879 if (params != 7)
880 return ScriptError("Incorrect number of parameters");
881
882 //check numeric values
883 for (int i = 0; i <= 6; i++)
884 {
885 if (!IsNumeric(tempdata[i]))
886 return ScriptError("Invalid value: " + tempdata[i]);
887 }
888
889 int stairwell = ToInt(tempdata[0]);
890 if (!Simcore->GetStairwell(stairwell))
891 return ScriptError("Invalid stairwell " + tempdata[0]);
892
893 //stop here if in Check mode
894 if (config->CheckScript == true)
895 return sNextLine;
896
897 Simcore->GetStairwell(stairwell)->CutFloors(true, Vector2(ToFloat(tempdata[1]), ToFloat(tempdata[2])), Vector2(ToFloat(tempdata[3]), ToFloat(tempdata[4])), ToFloat(tempdata[5]), ToFloat(tempdata[6]));
898 return sNextLine;
899 }
900
901 //StairsShowFloors command
902 if (StartsWithNoCase(LineData, "stairsshowfloors"))
903 {
904 //get stairwell number
905 int loc = LineData.find("=");
906 if (loc < 0)
907 return ScriptError("Syntax error");
908 int stairnum;
909 std::string str = GetBeforeEquals(LineData);
910 if (!IsNumeric(str, stairnum))
911 return ScriptError("Invalid stairwell number");
912
913 if (stairnum < 1 || stairnum > Simcore->GetStairwellCount())
914 return ScriptError("Invalid stairwell number");
915
916 Simcore->GetStairwell(stairnum)->ShowFloors = true;
917
918 int params = SplitAfterEquals(LineData, false);
919 if (params < 1)
920 return ScriptError("Syntax Error");
921
922 for (int line = 0; line < params; line++)
923 {
924 int start, end;
925 if (GetRange(tempdata[line], start, end))
926 {
927 for (int k = start; k <= end; k++)
928 Simcore->GetStairwell(stairnum)->AddShowFloor(k);
929 }
930 else
931 {
932 int showfloor;
933 if (!IsNumeric(tempdata[line], showfloor))
934 return ScriptError("Invalid value");
935 Simcore->GetStairwell(stairnum)->AddShowFloor(showfloor);
936 }
937 }
938 return sNextLine;
939 }
940
941 //ShowFullStairs command
942 if (StartsWithNoCase(LineData, "showfullstairs"))
943 {
944 //get shaft number
945 int loc = LineData.find("=");
946 if (loc < 0)
947 return ScriptError("Syntax error");
948 int stairnum;
949 std::string str = GetBeforeEquals(LineData);
950 if (!IsNumeric(str, stairnum))
951 return ScriptError("Invalid stairwell number");
952 if (stairnum < 1 || stairnum > Simcore->GetStairwellCount())
953 return ScriptError("Invalid stairwell number");
954
955 //get text after equal sign
956 bool equals;
957 std::string strvalue = GetAfterEquals(LineData, equals);
958 SetCase(strvalue, false);
959
960 int value = 0;
961
962 if (IsBoolean(strvalue) == true)
963 {
964 if (ToBool(strvalue) == true)
965 value = 1;
966 }
967 else
968 {
969 if (strvalue == "inside")
970 value = 1;
971 else if (strvalue == "always")
972 value = 2;
973 else
974 return ScriptError("Invalid value: " + strvalue);
975 }
976
977 Simcore->GetStairwell(stairnum)->SetShowFull(value);
978 return sNextLine;
979 }
980
981 //WallOrientation command
982 if (StartsWithNoCase(LineData, "wallorientation"))
983 {
984 //get text after equal sign
985 bool equals;
986 std::string value = GetAfterEquals(LineData, equals);
987
988 if (!Simcore->SetWallOrientation(value))
989 return ScriptError();
990 return sNextLine;
991 }
992
993 //FloorOrientation command
994 if (StartsWithNoCase(LineData, "floororientation"))
995 {
996 //get text after equal sign
997 bool equals;
998 std::string value = GetAfterEquals(LineData, equals);
999
1000 if (!Simcore->SetFloorOrientation(value))
1001 return ScriptError();
1002 return sNextLine;
1003 }
1004
1005 //DrawWalls command
1006 if (StartsWithNoCase(LineData, "drawwalls"))
1007 {
1008 int params = SplitAfterEquals(LineData);
1009
1010 if (params != 6)
1011 return ScriptError("Incorrect number of parameters");
1012
1013 Simcore->DrawWalls(ToBool(tempdata[0]),
1014 ToBool(tempdata[1]),
1015 ToBool(tempdata[2]),
1016 ToBool(tempdata[3]),
1017 ToBool(tempdata[4]),
1018 ToBool(tempdata[5]));
1019 return sNextLine;
1020 }
1021
1022 //SetTextureMapping command
1023 if (StartsWithNoCase(LineData, "settexturemapping "))
1024 {
1025 //get data
1026 int params = SplitData(LineData, 18);
1027
1028 if (params != 9)
1029 return ScriptError("Incorrect number of parameters");
1030
1031 //check numeric values
1032 for (int i = 0; i <= 8; i++)
1033 {
1034 if (!IsNumeric(tempdata[i]))
1035 return ScriptError("Invalid value: " + tempdata[i]);
1036 }
1037
1038 texturemanager->SetTextureMapping(ToInt(tempdata[0]), Vector2(ToFloat(tempdata[1]), ToFloat(tempdata[2])),
1039 ToInt(tempdata[3]), Vector2(ToFloat(tempdata[4]), ToFloat(tempdata[5])),
1040 ToInt(tempdata[6]), Vector2(ToFloat(tempdata[7]), ToFloat(tempdata[8])));
1041 return sNextLine;
1042 }
1043
1044 //SetTextureMapping2 command
1045 if (StartsWithNoCase(LineData, "settexturemapping2"))
1046 {
1047 //get data
1048 int params = SplitData(LineData, 19);
1049
1050 if (params != 15)
1051 return ScriptError("Incorrect number of parameters");
1052
1053 //check numeric values
1054 for (int i = 3; i <= 14; i++)
1055 {
1056 if (i == 5)
1057 i = 8;
1058 if (i == 10)
1059 i = 13;
1060 if (!IsNumeric(tempdata[i]))
1061 return ScriptError("Invalid value: " + tempdata[i]);
1062 }
1063
1064 texturemanager->SetTextureMapping2(tempdata[0], tempdata[1], tempdata[2], Vector2(ToFloat(tempdata[3]), ToFloat(tempdata[4])),
1065 tempdata[5], tempdata[6], tempdata[7], Vector2(ToFloat(tempdata[8]), ToFloat(tempdata[9])),
1066 tempdata[10], tempdata[11], tempdata[12], Vector2(ToFloat(tempdata[13]), ToFloat(tempdata[14])));
1067 return sNextLine;
1068 }
1069
1070 //ResetTextureMapping command
1071 if (StartsWithNoCase(LineData, "resettexturemapping"))
1072 {
1073 int check = (int)LineData.find("=", 0);
1074 if (check < 0)
1075 return ScriptError("Syntax Error");
1076
1077 //get text after equal sign
1078 bool equals;
1079 std::string value = GetAfterEquals(LineData, equals);
1080
1081 texturemanager->ResetTextureMapping(ToBool(value));
1082 return sNextLine;
1083 }
1084
1085 //SetPlanarMapping command
1086 if (StartsWithNoCase(LineData, "setplanarmapping"))
1087 {
1088 //get data
1089 int params = SplitData(LineData, 17);
1090
1091 if (params != 4 && params != 5)
1092 return ScriptError("Incorrect number of parameters");
1093
1094 if (params == 4)
1095 {
1096 texturemanager->SetPlanarMapping(ToBool(tempdata[0]),
1097 ToBool(tempdata[1]),
1098 ToBool(tempdata[2]),
1099 ToBool(tempdata[3]), false);
1100 if (warn_deprecated == true)
1101 ScriptWarning("Syntax deprecated");
1102 }
1103 else
1104 {
1105 texturemanager->SetPlanarMapping(ToBool(tempdata[0]),
1106 ToBool(tempdata[1]),
1107 ToBool(tempdata[2]),
1108 ToBool(tempdata[3]),
1109 ToBool(tempdata[4]));
1110 }
1111 return sNextLine;
1112 }
1113
1114 //ReverseAxis command
1115 if (StartsWithNoCase(LineData, "reverseaxis"))
1116 {
1117 //backwards compatibility
1118 if (warn_deprecated == true)
1119 ScriptWarning("Command deprecated");
1120
1121 int check = (int)LineData.find("=", 0);
1122 if (check < 0)
1123 return ScriptError("Syntax Error");
1124 bool equals;
1125 std::string value = GetAfterEquals(LineData, equals);
1126
1127 config->ReverseAxis = ToBool(value);
1128 return sNextLine;
1129 }
1130
1131 //Intersection points
1132 std::string linecheck = SetCaseCopy(LineData, false);
1133 int found = (int)linecheck.find("isect(", 0);
1134 while (found > -1)
1135 {
1136 int loc1 = LineData.find("(", 0);
1137 int loc2 = LineData.find(")", 0);
1138 if (loc1 < 0 || loc2 < 0)
1139 return ScriptError("Syntax error");
1140
1141 std::string buffer;
1142 SplitString(tempdata, LineData.substr(loc1 + 1, loc2 - loc1 - 1), ',');
1143 for (size_t i = 0; i < tempdata.size(); i++)
1144 {
1145 buffer = Calc(tempdata[i]);
1146 tempdata[i] = buffer;
1147 }
1148 if (tempdata.size() < 8 || tempdata.size() > 8)
1149 return ScriptError("Incorrect number of parameters");
1150
1151 //check numeric values
1152 for (int i = 2; i <= 7; i++)
1153 {
1154 if (!IsNumeric(tempdata[i]))
1155 return ScriptError("Invalid value: " + tempdata[i]);
1156 }
1157
1158 MeshObject *mesh = GetMeshObject(tempdata[0]);
1159
1160 if (!mesh)
1161 return ScriptError("Invalid object");
1162
1163 //stop here if in Check mode
1164 if (config->CheckScript == true)
1165 return sNextLine;
1166
1167 Vector3 isect = mesh->GetPoint(tempdata[1], Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4])), Vector3(ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7])));
1168
1169 buffer = LineData.substr(0, found) + ToString(isect.x) + ", " + ToString(isect.y) + ", " + ToString(isect.z) + LineData.substr(loc2 + 1);
1170 LineData = buffer;
1171 linecheck = SetCaseCopy(LineData, false);
1172 found = linecheck.find("isect(", 0);
1173 }
1174
1175 //Endpoint function
1176 found = linecheck.find("endpoint(", 0);
1177 while (found > -1)
1178 {
1179 int loc1 = LineData.find("(", 0);
1180 int loc2 = LineData.find(")", 0);
1181 if (loc1 < 0 || loc2 < 0)
1182 return ScriptError("Syntax error");
1183
1184 std::string buffer;
1185 SplitString(tempdata, LineData.substr(loc1 + 1, loc2 - loc1 - 1), ',');
1186 for (size_t i = 0; i < tempdata.size(); i++)
1187 {
1188 buffer = Calc(tempdata[i]);
1189 tempdata[i] = buffer;
1190 }
1191 if (tempdata.size() != 4)
1192 return ScriptError("Incorrect number of parameters");
1193
1194 //check numeric values
1195 for (int i = 0; i <= 3; i++)
1196 {
1197 if (!IsNumeric(tempdata[i]))
1198 return ScriptError("Invalid value: " + tempdata[i]);
1199 }
1200
1201 //stop here if in Check mode
1202 if (config->CheckScript == true)
1203 return sNextLine;
1204
1205 Vector2 startpoint (ToFloat(tempdata[0]), ToFloat(tempdata[1]));
1206 Vector2 endpoint = Simcore->GetUtility()->GetEndPoint(startpoint, ToFloat(tempdata[2]), ToFloat(tempdata[3]));
1207
1208 buffer = LineData.substr(0, found) + ToString(endpoint.x) + ", " + ToString(endpoint.y) + LineData.substr(loc2 + 1);
1209 LineData = buffer;
1210 linecheck = SetCaseCopy(LineData, false);
1211 found = linecheck.find("endpoint(", 0);
1212 }
1213
1214 //GetWallExtents command
1215 if (StartsWithNoCase(LineData, "getwallextents"))
1216 {
1217 //get data
1218 int params = SplitData(LineData, 15);
1219
1220 if (params != 3)
1221 return ScriptError("Incorrect number of parameters");
1222
1223 //check numeric values
1224 if (!IsNumeric(tempdata[2]))
1225 return ScriptError("Invalid value: " + tempdata[2]);
1226
1227 Real offset = 0;
1228
1229 std::string meshname = SetCaseCopy(tempdata[0], false);
1230
1231 MeshObject *mesh = GetMeshObject(meshname);
1232
1233 if (!mesh)
1234 return ScriptError("Invalid object");
1235
1236 //stop here if in Check mode
1237 if (config->CheckScript == true)
1238 return sNextLine;
1239
1240 if (meshname == "floor" && config->SectionNum == 2)
1241 offset = mesh->GetPosition().y;
1242
1243 Real alt = ToFloat(tempdata[2]);
1244
1245 //GetWallExtents command requires relative position, so subtract altitude from value
1246 alt -= offset;
1247
1248 config->MinExtent = mesh->GetWallExtents(tempdata[1], alt, false);
1249 config->MaxExtent = mesh->GetWallExtents(tempdata[1], alt, true);
1250 return sNextLine;
1251 }
1252
1253 //SetAutoSize command
1254 if (StartsWithNoCase(LineData, "setautosize"))
1255 {
1256 int params = SplitAfterEquals(LineData);
1257
1258 if (params != 2)
1259 return ScriptError("Incorrect number of parameters");
1260
1261 texturemanager->SetAutoSize(ToBool(tempdata[0]),
1262 ToBool(tempdata[1]));
1263 return sNextLine;
1264 }
1265
1266 //TextureOverride command
1267 if (StartsWithNoCase(LineData, "textureoverride"))
1268 {
1269 int params = SplitData(LineData, 16, false);
1270
1271 if (params != 6)
1272 return ScriptError("Incorrect number of parameters");
1273
1274 texturemanager->SetTextureOverride(tempdata[0], tempdata[1], tempdata[2], tempdata[3], tempdata[4], tempdata[5]);
1275 return sSkipReset;
1276 }
1277
1278 //TextureFlip command
1279 if (StartsWithNoCase(LineData, "textureflip"))
1280 {
1281 int params = SplitData(LineData, 12, false);
1282
1283 if (params != 6)
1284 return ScriptError("Incorrect number of parameters");
1285
1286 //check numeric values
1287 for (int i = 0; i <= 5; i++)
1288 {
1289 if (!IsNumeric(tempdata[i]))
1290 return ScriptError("Invalid value: " + tempdata[i]);
1291 }
1292
1293 texturemanager->SetTextureFlip(ToInt(tempdata[0]), ToInt(tempdata[1]), ToInt(tempdata[2]), ToInt(tempdata[3]), ToInt(tempdata[4]), ToInt(tempdata[5]));
1294 return sSkipReset;
1295 }
1296
1297 //Mount command
1298 if (StartsWithNoCase(LineData, "mount"))
1299 {
1300 //get data
1301 int params = SplitData(LineData, 6, false);
1302
1303 if (params != 2)
1304 return ScriptError("Incorrect number of parameters");
1305
1306 if (!Simcore->Mount(tempdata[0], tempdata[1]))
1307 return ScriptError();
1308
1309 return sNextLine;
1310 }
1311
1312 //AddFloorAutoArea command
1313 if (StartsWithNoCase(LineData, "addfloorautoarea"))
1314 {
1315 //get data
1316 int params = SplitData(LineData, 17);
1317
1318 if (params != 6)
1319 return ScriptError("Incorrect number of parameters");
1320
1321 //check numeric values
1322 for (int i = 0; i <= 5; i++)
1323 {
1324 if (!IsNumeric(tempdata[i]))
1325 return ScriptError("Invalid value: " + tempdata[i]);
1326 }
1327
1328 //stop here if in Check mode
1329 if (config->CheckScript == true)
1330 return sNextLine;
1331
1332 //create floor auto area
1333 Simcore->AddFloorAutoArea(Vector3(ToFloat(tempdata[0]), ToFloat(tempdata[1]), ToFloat(tempdata[2])), Vector3(ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5])));
1334 return sNextLine;
1335 }
1336
1337 //AddSound command
1338 if (StartsWithNoCase(LineData, "addsound"))
1339 {
1340 //get data
1341 int params = SplitData(LineData, 9);
1342
1343 if (params != 5 && params != 6 && params != 13 && params != 17)
1344 return ScriptError("Incorrect number of parameters");
1345
1346 bool partial = false;
1347 bool compat = false;
1348 if (params == 5 || params == 6)
1349 partial = true;
1350 if (params == 5 || params == 13)
1351 compat = true;
1352
1353 //check numeric values
1354 if (partial == true)
1355 {
1356 for (int i = 2; i <= 4; i++)
1357 {
1358 if (!IsNumeric(tempdata[i]))
1359 return ScriptError("Invalid value: " + tempdata[i]);
1360 }
1361 }
1362 else
1363 {
1364 if (compat == true)
1365 {
1366 for (int i = 2; i <= 12; i++)
1367 {
1368 if (!IsNumeric(tempdata[i]))
1369 return ScriptError("Invalid value: " + tempdata[i]);
1370 }
1371 if (warn_deprecated == true)
1372 ScriptWarning("Syntax deprecated");
1373 }
1374 else
1375 {
1376 for (int i = 2; i <= 16; i++)
1377 {
1378 if (i == 5)
1379 i = 6;
1380
1381 if (!IsNumeric(tempdata[i]))
1382 return ScriptError("Invalid value: " + tempdata[i]);
1383 }
1384 }
1385 }
1386
1387 //check to see if file exists
1388 parent->CheckFile("data/" + tempdata[1]);
1389
1390 //stop here if in Check mode
1391 if (config->CheckScript == true)
1392 return sNextLine;
1393
1394 if (compat == true)
1395 {
1396 if (partial == true)
1397 StoreCommand(Simcore->AddSound(tempdata[0], tempdata[1], Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4]))));
1398 else
1399 StoreCommand(Simcore->AddSound(tempdata[0], tempdata[1], Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4])), true, ToFloat(tempdata[5]), ToInt(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), 0.0, 360, 360, 1.0, Vector3(ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]))));
1400 }
1401 else
1402 {
1403 if (partial == true)
1404 StoreCommand(Simcore->AddSound(tempdata[0], tempdata[1], Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4])), ToBool(tempdata[5])));
1405 else
1406 StoreCommand(Simcore->AddSound(tempdata[0], tempdata[1], Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4])), ToBool(tempdata[5]), ToFloat(tempdata[6]), ToInt(tempdata[7]), ToFloat(tempdata[8]), ToFloat(tempdata[9]), ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]), Vector3(ToFloat(tempdata[14]), ToFloat(tempdata[15]), ToFloat(tempdata[16]))));
1407 }
1408 return sNextLine;
1409 }
1410
1411 //AddReverb command
1412 if (StartsWithNoCase(LineData, "addreverb"))
1413 {
1414 //get data
1415 int params = SplitData(LineData, 9);
1416
1417 if (params != 7)
1418 return ScriptError("Incorrect number of parameters");
1419
1420 //check numeric values
1421 for (int i = 2; i <= 6; i++)
1422 {
1423 if (!IsNumeric(tempdata[i]))
1424 return ScriptError("Invalid value: " + tempdata[i]);
1425 }
1426
1427 //stop here if in Check mode
1428 if (config->CheckScript == true)
1429 return sNextLine;
1430
1431 StoreCommand(Simcore->AddReverb(tempdata[0], tempdata[1], Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4])), ToFloat(tempdata[5]), ToFloat(tempdata[6])));
1432 return sNextLine;
1433 }
1434
1435 //AddModel command
1436 if (StartsWithNoCase(LineData, "addmodel"))
1437 {
1438 if (parent->NoModels == true)
1439 return sNextLine;
1440
1441 //get data
1442 int params = SplitData(LineData, 9);
1443
1444 if (params != 14 && params != 15)
1445 return ScriptError("Incorrect number of parameters");
1446
1447 bool compat = false;
1448 if (params == 14)
1449 compat = true;
1450
1451 //check numeric values
1452 if (compat == true)
1453 {
1454 for (int i = 2; i <= 13; i++)
1455 {
1456 if (i == 10)
1457 i++;
1458 if (!IsNumeric(tempdata[i]))
1459 return ScriptError("Invalid value: " + tempdata[i]);
1460 }
1461 if (warn_deprecated == true)
1462 ScriptWarning("Syntax deprecated");
1463 }
1464 else
1465 {
1466 for (int i = 3; i <= 14; i++)
1467 {
1468 if (i == 11)
1469 i++;
1470 if (!IsNumeric(tempdata[i]))
1471 return ScriptError("Invalid value: " + tempdata[i]);
1472 }
1473 }
1474
1475 //check to see if file exists
1476 parent->CheckFile("data/" + tempdata[1]);
1477
1478 //stop here if in Check mode
1479 if (config->CheckScript == true)
1480 {
1481 config->setkey = false;
1482 return sNextLine;
1483 }
1484
1485 //create model
1486 Model* model;
1487 if (compat == true)
1488 model = Simcore->AddModel(tempdata[0], tempdata[1], false, Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4])), Vector3(ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7])), ToFloat(tempdata[8]), ToFloat(tempdata[9]), ToBool(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]));
1489 else
1490 model = Simcore->AddModel(tempdata[0], tempdata[1], ToBool(tempdata[2]), Vector3(ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5])), Vector3(ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8])), ToFloat(tempdata[9]), ToFloat(tempdata[10]), ToBool(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]), ToFloat(tempdata[14]));
1491
1492 if (config->setkey == true && model)
1493 model->SetKey(config->keyvalue);
1494 config->setkey = false;
1495
1496 StoreCommand(model);
1497 return sNextLine;
1498 }
1499
1500 //AddAction command
1501 if (StartsWithNoCase(LineData, "addaction "))
1502 {
1503 //get data
1504 int params = SplitData(LineData, 10);
1505
1506 if (params < 3)
1507 return ScriptError("Incorrect number of parameters");
1508
1509 std::vector<Object*> objects;
1510 std::string tmpname = tempdata[1];
1511 SetCase(tmpname, false);
1512 if (tmpname == "global")
1513 objects.emplace_back(Simcore);
1514 else
1515 objects = Simcore->GetObjectRange(tempdata[1]);
1516
1517 std::vector<std::string> actparams;
1518 if (params > 3)
1519 {
1520 for (int i = 3; i < params; i++)
1521 {
1522 actparams.emplace_back(tempdata[i]);
1523 }
1524 }
1525
1526 if (objects.size() > 0)
1527 {
1528 if (params > 3)
1529 Simcore->AddAction(tempdata[0], objects, tempdata[2], actparams);
1530 else
1531 Simcore->AddAction(tempdata[0], objects, tempdata[2]);
1532 }
1533 else
1534 return ScriptError("Invalid parent object(s)");
1535 return sNextLine;
1536 }
1537
1538 //AddActionParent command
1539 if (StartsWithNoCase(LineData, "addactionparent "))
1540 {
1541 //get data
1542 int params = SplitData(LineData, 16);
1543
1544 if (params != 2)
1545 return ScriptError("Incorrect number of parameters");
1546
1547 std::vector<Object*> objects;
1548 std::string tmpname = tempdata[1];
1549 SetCase(tmpname, false);
1550 if (tmpname == "global")
1551 objects.emplace_back(Simcore);
1552 else
1553 objects = Simcore->GetObjectRange(tempdata[1]);
1554
1555 if (objects.size() > 0)
1556 Simcore->AddActionParent(tempdata[0], objects);
1557 else
1558 return ScriptError("Invalid parent object(s)");
1559 return sNextLine;
1560 }
1561
1562 //RemoveActionParent command
1563 if (StartsWithNoCase(LineData, "removeactionparent "))
1564 {
1565 //get data
1566 int params = SplitData(LineData, 19);
1567
1568 if (params != 2)
1569 return ScriptError("Incorrect number of parameters");
1570
1571 std::vector<Object*> objects;
1572 std::string tmpname = tempdata[1];
1573 SetCase(tmpname, false);
1574 if (tmpname == "global")
1575 objects.emplace_back(Simcore);
1576 else
1577 objects = Simcore->GetObjectRange(tempdata[1]);
1578
1579 if (objects.size() > 0)
1580 Simcore->RemoveActionParent(tempdata[0], objects);
1581 else
1582 return ScriptError("Invalid parent object(s)");
1583 return sNextLine;
1584 }
1585
1586 //AddActionControl command
1587 if (StartsWithNoCase(LineData, "addactioncontrol"))
1588 {
1589 //get data
1590 int params = SplitData(LineData, 17);
1591
1592 if (params < 10)
1593 return ScriptError("Incorrect number of parameters");
1594
1595 //set backwards compatibility
1596 bool compat = false;
1597 if (IsNumeric(tempdata[8]) == false)
1598 compat = true;
1599
1600 int end = 8;
1601 if (compat == true)
1602 {
1603 end = 7;
1604
1605 if (warn_deprecated == true)
1606 ScriptWarning("Syntax deprecated");
1607 }
1608
1609 //check numeric values
1610 for (int i = 3; i <= end; i++)
1611 {
1612 if (!IsNumeric(tempdata[i]))
1613 return ScriptError("Invalid value: " + tempdata[i]);
1614 }
1615
1616 std::vector<std::string> action_array, tex_array;
1617 int slength, parameters;
1618
1619 //get number of action & texture parameters
1620 slength = (int)tempdata.size();
1621 parameters = slength - (end + 1); //strip off main parameters
1622
1623 //action & texture parameter number needs to be even
1624 if (IsEven(parameters) == false)
1625 return ScriptError("Incorrect number of parameters");
1626
1627 for (int i = (end + 1); i < slength - (parameters / 2); i++)
1628 action_array.emplace_back(tempdata[i]);
1629 for (int i = slength - (parameters / 2); i < slength; i++)
1630 tex_array.emplace_back(tempdata[i]);
1631
1632 //check to see if file exists
1633 parent->CheckFile("data/" + tempdata[1]);
1634
1635 //stop here if in Check mode
1636 if (config->CheckScript == true)
1637 return sNextLine;
1638
1639 Control* control = 0;
1640 if (compat == true)
1641 control = Simcore->AddControl(tempdata[0], tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), 1, action_array, tex_array);
1642 else
1643 control = Simcore->AddControl(tempdata[0], tempdata[1], tempdata[2], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToInt(tempdata[8]), action_array, tex_array);
1644
1645 if (control)
1646 {
1647 if (config->lockvalue == 0)
1648 control->SetLocked(false, config->keyvalue);
1649 else
1650 control->SetLocked(true, config->keyvalue);
1651 }
1652 StoreCommand(control);
1653 return sNextLine;
1654 }
1655
1656 //AddTrigger command
1657 if (StartsWithNoCase(LineData, "addtrigger"))
1658 {
1659 //get data
1660 int params = SplitData(LineData, 11);
1661
1662 if (params < 9)
1663 return ScriptError("Incorrect number of parameters");
1664
1665 //check numeric values
1666 for (int i = 2; i <= 7; i++)
1667 {
1668 if (!IsNumeric(tempdata[i]))
1669 return ScriptError("Invalid value: " + tempdata[i]);
1670 }
1671
1672 std::vector<std::string> action_array;
1673
1674 //get number of action & texture parameters
1675 for (int i = 8; i < params; i++)
1676 action_array.emplace_back(tempdata[i]);
1677
1678 //check to see if file exists
1679 parent->CheckFile("data/" + tempdata[1]);
1680
1681 //stop here if in Check mode
1682 if (config->CheckScript == true)
1683 return sNextLine;
1684
1685 Vector3 min = Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4]));
1686 Vector3 max = Vector3(ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]));
1687 StoreCommand(Simcore->AddTrigger(tempdata[0], tempdata[1], min, max, action_array));
1688 return sNextLine;
1689 }
1690
1691 //AddLight command
1692 if (StartsWithNoCase(LineData, "addlight "))
1693 {
1694 //get data
1695 int params = SplitData(LineData, 9);
1696
1697 if (params != 3)
1698 return ScriptError("Incorrect number of parameters");
1699
1700 //check numeric values
1701 if (!IsNumeric(tempdata[2]))
1702 return ScriptError("Invalid value: " + tempdata[1]);
1703
1704 //int floor;
1705 std::string name = tempdata[0];
1706 TrimString(name);
1707 Object *obj = Simcore->GetObject(name);
1708
1709 if (!obj)
1710 return ScriptError("Invalid object " + name);
1711
1712 Floor *floorobj = 0;
1713 Elevator *elevatorobj = 0;
1714 ElevatorCar *elevatorcarobj = 0;
1715 Shaft::Level *shaftobj = 0;
1716 Stairwell::Level *stairsobj = 0;
1717 ::SBS::SBS *sbs = 0;
1718
1719 //get parent object of light
1720 if (obj->GetType() == "Floor")
1721 floorobj = static_cast<Floor*>(obj);
1722 if (obj->GetType() == "Elevator")
1723 elevatorobj = static_cast<Elevator*>(obj);
1724 if (obj->GetType() == "ElevatorCar")
1725 elevatorcarobj = static_cast<ElevatorCar*>(obj);
1726 if (obj->GetType() == "Shaft Level")
1727 shaftobj = static_cast<Shaft::Level*>(obj);
1728 if (obj->GetType() == "Stairwell Level")
1729 stairsobj = static_cast<Stairwell::Level*>(obj);
1730 if (obj->GetType() == "SBS")
1731 sbs = static_cast<::SBS::SBS*>(obj);
1732
1733 if (elevatorobj)
1734 elevatorcarobj = elevatorobj->GetCar(0);
1735
1736 //stop here if in Check mode
1737 if (config->CheckScript == true)
1738 return sNextLine;
1739
1740 //create light
1741 if (floorobj)
1742 StoreCommand(floorobj->AddLight(tempdata[1], ToInt(tempdata[2])));
1743 else if (elevatorcarobj)
1744 StoreCommand(elevatorcarobj->AddLight(tempdata[1], ToInt(tempdata[2])));
1745 else if (shaftobj)
1746 StoreCommand(shaftobj->AddLight(tempdata[1], ToInt(tempdata[2])));
1747 else if (stairsobj)
1748 StoreCommand(stairsobj->AddLight(tempdata[1], ToInt(tempdata[2])));
1749 else if (sbs)
1750 StoreCommand(sbs->AddLight(tempdata[1], ToInt(tempdata[2])));
1751 else
1752 return ScriptError("Invalid object " + name);
1753
1754 return sNextLine;
1755 }
1756
1757 //SetLightColor command
1758 if (StartsWithNoCase(LineData, "setlightcolor "))
1759 {
1760 //get data
1761 int params = SplitData(LineData, 14);
1762
1763 if (params != 5)
1764 return ScriptError("Incorrect number of parameters");
1765
1766 //check numeric values
1767 for (int i = 2; i <= 4; i++)
1768 {
1769 if (!IsNumeric(tempdata[i]))
1770 return ScriptError("Invalid value: " + tempdata[i]);
1771 }
1772
1773 std::string name = tempdata[0];
1774 TrimString(name);
1775 Object *obj = Simcore->GetObject(name);
1776
1777 if (!obj)
1778 return ScriptError("Invalid object " + name);
1779
1780 Floor *floorobj = 0;
1781 Elevator *elevatorobj = 0;
1782 ElevatorCar *elevatorcarobj = 0;
1783 Shaft::Level *shaftobj = 0;
1784 Stairwell::Level *stairsobj = 0;
1785 ::SBS::SBS *sbs = 0;
1786
1787 //get parent object
1788 if (obj->GetType() == "Floor")
1789 floorobj = static_cast<Floor*>(obj);
1790 if (obj->GetType() == "Elevator")
1791 elevatorobj = static_cast<Elevator*>(obj);
1792 if (obj->GetType() == "ElevatorCar")
1793 elevatorcarobj = static_cast<ElevatorCar*>(obj);
1794 if (obj->GetType() == "Shaft Level")
1795 shaftobj = static_cast<Shaft::Level*>(obj);
1796 if (obj->GetType() == "Stairwell Level")
1797 stairsobj = static_cast<Stairwell::Level*>(obj);
1798 if (obj->GetType() == "SBS")
1799 sbs = static_cast<::SBS::SBS*>(obj);
1800
1801 if (elevatorobj)
1802 elevatorcarobj = elevatorobj->GetCar(0);
1803
1804 //stop here if in Check mode
1805 if (config->CheckScript == true)
1806 return sNextLine;
1807
1808 //get light object
1809 Light *light = 0;
1810 if (floorobj)
1811 light = floorobj->GetLight(tempdata[1]);
1812 if (elevatorcarobj)
1813 light = elevatorcarobj->GetLight(tempdata[1]);
1814 if (shaftobj)
1815 light = shaftobj->GetLight(tempdata[1]);
1816 if (stairsobj)
1817 light = stairsobj->GetLight(tempdata[1]);
1818 if (sbs)
1819 light = sbs->GetLight(tempdata[1]);
1820
1821 if (!light)
1822 return ScriptError("Invalid light " + tempdata[1] + " in " + name);
1823
1824 //modify light
1825 light->SetColor(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4]));
1826
1827 return sNextLine;
1828 }
1829
1830 //SetLightSpecular command
1831 if (StartsWithNoCase(LineData, "setlightspecular "))
1832 {
1833 //get data
1834 int params = SplitData(LineData, 17);
1835
1836 if (params != 5)
1837 return ScriptError("Incorrect number of parameters");
1838
1839 //check numeric values
1840 for (int i = 2; i <= 4; i++)
1841 {
1842 if (!IsNumeric(tempdata[i]))
1843 return ScriptError("Invalid value: " + tempdata[i]);
1844 }
1845
1846 std::string name = tempdata[0];
1847 TrimString(name);
1848 Object *obj = Simcore->GetObject(name);
1849
1850 if (!obj)
1851 return ScriptError("Invalid object " + name);
1852
1853 Floor *floorobj = 0;
1854 Elevator *elevatorobj = 0;
1855 ElevatorCar *elevatorcarobj = 0;
1856 Shaft::Level *shaftobj = 0;
1857 Stairwell::Level *stairsobj = 0;
1858 ::SBS::SBS *sbs = 0;
1859
1860 //get parent object
1861 if (obj->GetType() == "Floor")
1862 floorobj = static_cast<Floor*>(obj);
1863 if (obj->GetType() == "Elevator")
1864 elevatorobj = static_cast<Elevator*>(obj);
1865 if (obj->GetType() == "ElevatorCar")
1866 elevatorcarobj = static_cast<ElevatorCar*>(obj);
1867 if (obj->GetType() == "Shaft Level")
1868 shaftobj = static_cast<Shaft::Level*>(obj);
1869 if (obj->GetType() == "Stairwell Level")
1870 stairsobj = static_cast<Stairwell::Level*>(obj);
1871 if (obj->GetType() == "SBS")
1872 sbs = static_cast<::SBS::SBS*>(obj);
1873
1874 if (elevatorobj)
1875 elevatorcarobj = elevatorobj->GetCar(0);
1876
1877 //stop here if in Check mode
1878 if (config->CheckScript == true)
1879 return sNextLine;
1880
1881 //get light object
1882 Light *light = 0;
1883 if (floorobj)
1884 light = floorobj->GetLight(tempdata[1]);
1885 if (elevatorcarobj)
1886 light = elevatorcarobj->GetLight(tempdata[1]);
1887 if (shaftobj)
1888 light = shaftobj->GetLight(tempdata[1]);
1889 if (stairsobj)
1890 light = stairsobj->GetLight(tempdata[1]);
1891 if (sbs)
1892 light = sbs->GetLight(tempdata[1]);
1893
1894 if (!light)
1895 return ScriptError("Invalid light " + tempdata[1] + " in " + name);
1896
1897 //modify light
1898 light->SetSpecularColor(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4]));
1899
1900 return sNextLine;
1901 }
1902
1903 //SetLightAttenuation command
1904 if (StartsWithNoCase(LineData, "setlightattenuation "))
1905 {
1906 //get data
1907 int params = SplitData(LineData, 20);
1908
1909 if (params != 6)
1910 return ScriptError("Incorrect number of parameters");
1911
1912 //check numeric values
1913 for (int i = 2; i <= 5; i++)
1914 {
1915 if (!IsNumeric(tempdata[i]))
1916 return ScriptError("Invalid value: " + tempdata[i]);
1917 }
1918
1919 std::string name = tempdata[0];
1920 TrimString(name);
1921 Object *obj = Simcore->GetObject(name);
1922
1923 if (!obj)
1924 return ScriptError("Invalid object " + name);
1925
1926 Floor *floorobj = 0;
1927 Elevator *elevatorobj = 0;
1928 ElevatorCar *elevatorcarobj = 0;
1929 Shaft::Level *shaftobj = 0;
1930 Stairwell::Level *stairsobj = 0;
1931 ::SBS::SBS *sbs = 0;
1932
1933 //get parent object
1934 if (obj->GetType() == "Floor")
1935 floorobj = static_cast<Floor*>(obj);
1936 if (obj->GetType() == "Elevator")
1937 elevatorobj = static_cast<Elevator*>(obj);
1938 if (obj->GetType() == "ElevatorCar")
1939 elevatorcarobj = static_cast<ElevatorCar*>(obj);
1940 if (obj->GetType() == "Shaft Level")
1941 shaftobj = static_cast<Shaft::Level*>(obj);
1942 if (obj->GetType() == "Stairwell Level")
1943 stairsobj = static_cast<Stairwell::Level*>(obj);
1944 if (obj->GetType() == "SBS")
1945 sbs = static_cast<::SBS::SBS*>(obj);
1946
1947 if (elevatorobj)
1948 elevatorcarobj = elevatorobj->GetCar(0);
1949
1950 //stop here if in Check mode
1951 if (config->CheckScript == true)
1952 return sNextLine;
1953
1954 //get light object
1955 Light *light = 0;
1956 if (floorobj)
1957 light = floorobj->GetLight(tempdata[1]);
1958 if (elevatorcarobj)
1959 light = elevatorcarobj->GetLight(tempdata[1]);
1960 if (shaftobj)
1961 light = shaftobj->GetLight(tempdata[1]);
1962 if (stairsobj)
1963 light = stairsobj->GetLight(tempdata[1]);
1964 if (sbs)
1965 light = sbs->GetLight(tempdata[1]);
1966
1967 if (!light)
1968 return ScriptError("Invalid light " + tempdata[1] + " in " + name);
1969
1970 //modify light
1971 light->SetAttenuation(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]));
1972
1973 return sNextLine;
1974 }
1975
1976 //SetSpotlightRange command
1977 if (StartsWithNoCase(LineData, "setspotlightrange "))
1978 {
1979 //get data
1980 int params = SplitData(LineData, 18);
1981
1982 if (params != 5)
1983 return ScriptError("Incorrect number of parameters");
1984
1985 //check numeric values
1986 for (int i = 2; i <= 4; i++)
1987 {
1988 if (!IsNumeric(tempdata[i]))
1989 return ScriptError("Invalid value: " + tempdata[i]);
1990 }
1991
1992 std::string name = tempdata[0];
1993 TrimString(name);
1994 Object *obj = Simcore->GetObject(name);
1995
1996 if (!obj)
1997 return ScriptError("Invalid object " + name);
1998
1999 Floor *floorobj = 0;
2000 Elevator *elevatorobj = 0;
2001 ElevatorCar *elevatorcarobj = 0;
2002 Shaft::Level *shaftobj = 0;
2003 Stairwell::Level *stairsobj = 0;
2004 ::SBS::SBS *sbs = 0;
2005
2006 //get parent object
2007 if (obj->GetType() == "Floor")
2008 floorobj = static_cast<Floor*>(obj);
2009 if (obj->GetType() == "Elevator")
2010 elevatorobj = static_cast<Elevator*>(obj);
2011 if (obj->GetType() == "ElevatorCar")
2012 elevatorcarobj = static_cast<ElevatorCar*>(obj);
2013 if (obj->GetType() == "Shaft Level")
2014 shaftobj = static_cast<Shaft::Level*>(obj);
2015 if (obj->GetType() == "Stairwell Level")
2016 stairsobj = static_cast<Stairwell::Level*>(obj);
2017 if (obj->GetType() == "SBS")
2018 sbs = static_cast<::SBS::SBS*>(obj);
2019
2020 if (elevatorobj)
2021 elevatorcarobj = elevatorobj->GetCar(0);
2022
2023 //stop here if in Check mode
2024 if (config->CheckScript == true)
2025 return sNextLine;
2026
2027 //get light object
2028 Light *light = 0;
2029 if (floorobj)
2030 light = floorobj->GetLight(tempdata[1]);
2031 if (elevatorcarobj)
2032 light = elevatorcarobj->GetLight(tempdata[1]);
2033 if (shaftobj)
2034 light = shaftobj->GetLight(tempdata[1]);
2035 if (stairsobj)
2036 light = stairsobj->GetLight(tempdata[1]);
2037 if (sbs)
2038 light = sbs->GetLight(tempdata[1]);
2039
2040 if (!light)
2041 return ScriptError("Invalid light " + tempdata[1] + " in " + name);
2042
2043 //modify light
2044 light->SetSpotlightRange(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4]));
2045
2046 return sNextLine;
2047 }
2048
2049 //SetLightDirection command
2050 if (StartsWithNoCase(LineData, "setlightdirection "))
2051 {
2052 //get data
2053 int params = SplitData(LineData, 18);
2054
2055 if (params != 5)
2056 return ScriptError("Incorrect number of parameters");
2057
2058 //check numeric values
2059 for (int i = 2; i <= 4; i++)
2060 {
2061 if (!IsNumeric(tempdata[i]))
2062 return ScriptError("Invalid value: " + tempdata[i]);
2063 }
2064
2065 std::string name = tempdata[0];
2066 TrimString(name);
2067 Object *obj = Simcore->GetObject(name);
2068
2069 if (!obj)
2070 return ScriptError("Invalid object " + name);
2071
2072 Floor *floorobj = 0;
2073 Elevator *elevatorobj = 0;
2074 ElevatorCar *elevatorcarobj = 0;
2075 Shaft::Level *shaftobj = 0;
2076 Stairwell::Level *stairsobj = 0;
2077 ::SBS::SBS *sbs = 0;
2078
2079 //get parent object
2080 if (obj->GetType() == "Floor")
2081 floorobj = static_cast<Floor*>(obj);
2082 if (obj->GetType() == "Elevator")
2083 elevatorobj = static_cast<Elevator*>(obj);
2084 if (obj->GetType() == "ElevatorCar")
2085 elevatorcarobj = static_cast<ElevatorCar*>(obj);
2086 if (obj->GetType() == "Shaft Level")
2087 shaftobj = static_cast<Shaft::Level*>(obj);
2088 if (obj->GetType() == "Stairwell Level")
2089 stairsobj = static_cast<Stairwell::Level*>(obj);
2090 if (obj->GetType() == "SBS")
2091 sbs = static_cast<::SBS::SBS*>(obj);
2092
2093 if (elevatorobj)
2094 elevatorcarobj = elevatorobj->GetCar(0);
2095
2096 //stop here if in Check mode
2097 if (config->CheckScript == true)
2098 return sNextLine;
2099
2100 //get light object
2101 Light *light = 0;
2102 if (floorobj)
2103 light = floorobj->GetLight(tempdata[1]);
2104 if (elevatorcarobj)
2105 light = elevatorcarobj->GetLight(tempdata[1]);
2106 if (shaftobj)
2107 light = shaftobj->GetLight(tempdata[1]);
2108 if (stairsobj)
2109 light = stairsobj->GetLight(tempdata[1]);
2110 if (sbs)
2111 light = sbs->GetLight(tempdata[1]);
2112
2113 if (!light)
2114 return ScriptError("Invalid light " + tempdata[1] + " in " + name);
2115
2116 //modify light
2117 light->SetDirection(Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4])));
2118
2119 return sNextLine;
2120 }
2121
2122 //MoveLight command
2123 if (StartsWithNoCase(LineData, "movelight "))
2124 {
2125 //get data
2126 int params = SplitData(LineData, 10);
2127
2128 if (params != 5)
2129 return ScriptError("Incorrect number of parameters");
2130
2131 //check numeric values
2132 for (int i = 2; i <= 4; i++)
2133 {
2134 if (!IsNumeric(tempdata[i]))
2135 return ScriptError("Invalid value: " + tempdata[i]);
2136 }
2137
2138 std::string name = tempdata[0];
2139 TrimString(name);
2140 Object *obj = Simcore->GetObject(name);
2141
2142 if (!obj)
2143 return ScriptError("Invalid object " + name);
2144
2145 Floor *floorobj = 0;
2146 Elevator *elevatorobj = 0;
2147 ElevatorCar *elevatorcarobj = 0;
2148 Shaft::Level *shaftobj = 0;
2149 Stairwell::Level *stairsobj = 0;
2150 ::SBS::SBS *sbs = 0;
2151
2152 //get parent object
2153 if (obj->GetType() == "Floor")
2154 floorobj = static_cast<Floor*>(obj);
2155 if (obj->GetType() == "Elevator")
2156 elevatorobj = static_cast<Elevator*>(obj);
2157 if (obj->GetType() == "ElevatorCar")
2158 elevatorcarobj = static_cast<ElevatorCar*>(obj);
2159 if (obj->GetType() == "Shaft Level")
2160 shaftobj = static_cast<Shaft::Level*>(obj);
2161 if (obj->GetType() == "Stairwell Level")
2162 stairsobj = static_cast<Stairwell::Level*>(obj);
2163 if (obj->GetType() == "SBS")
2164 sbs = static_cast<::SBS::SBS*>(obj);
2165
2166 if (elevatorobj)
2167 elevatorcarobj = elevatorobj->GetCar(0);
2168
2169 //stop here if in Check mode
2170 if (config->CheckScript == true)
2171 return sNextLine;
2172
2173 //get light object
2174 Light *light = 0;
2175 if (floorobj)
2176 light = floorobj->GetLight(tempdata[1]);
2177 if (elevatorcarobj)
2178 light = elevatorcarobj->GetLight(tempdata[1]);
2179 if (shaftobj)
2180 light = shaftobj->GetLight(tempdata[1]);
2181 if (stairsobj)
2182 light = stairsobj->GetLight(tempdata[1]);
2183 if (sbs)
2184 light = sbs->GetLight(tempdata[1]);
2185
2186 if (!light)
2187 return ScriptError("Invalid light " + tempdata[1] + " in " + name);
2188
2189 //move light
2190 light->Move(Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4])));
2191
2192 return sNextLine;
2193 }
2194
2195 //AddCameraTexture command
2196 if (StartsWithNoCase(LineData, "addcameratexture"))
2197 {
2198 //get data
2199 int params = SplitData(LineData, 17);
2200
2201 if (params != 11)
2202 return ScriptError("Incorrect number of parameters");
2203
2204 //check numeric values
2205 for (int i = 2; i <= 10; i++)
2206 {
2207 if (i == 7)
2208 i++;
2209
2210 if (!IsNumeric(tempdata[i]))
2211 return ScriptError("Invalid value: " + tempdata[i]);
2212 }
2213
2214 std::string name = tempdata[0];
2215 TrimString(name);
2216 Object *obj = Simcore->GetObject(name);
2217
2218 if (!obj)
2219 return ScriptError("Invalid object " + name);
2220
2221 Floor *floorobj = 0;
2222 Elevator *elevatorobj = 0;
2223 ElevatorCar *elevatorcarobj = 0;
2224 Shaft::Level *shaftobj = 0;
2225 Stairwell::Level *stairsobj = 0;
2226
2227 //get parent object
2228 if (obj->GetType() == "Floor")
2229 floorobj = static_cast<Floor*>(obj);
2230 if (obj->GetType() == "Elevator")
2231 elevatorobj = static_cast<Elevator*>(obj);
2232 if (obj->GetType() == "ElevatorCar")
2233 elevatorcarobj = static_cast<ElevatorCar*>(obj);
2234 if (obj->GetType() == "Shaft Level")
2235 shaftobj = static_cast<Shaft::Level*>(obj);
2236 if (obj->GetType() == "Stairwell Level")
2237 stairsobj = static_cast<Stairwell::Level*>(obj);
2238
2239 if (elevatorobj)
2240 elevatorcarobj = elevatorobj->GetCar(0);
2241
2242 //stop here if in Check mode
2243 if (config->CheckScript == true)
2244 return sNextLine;
2245
2246 if (floorobj)
2247 StoreCommand(floorobj->AddCameraTexture(tempdata[1], ToInt(tempdata[2]), ToFloat(tempdata[3]), Vector3(ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6])), ToBool(tempdata[7]), Vector3(ToFloat(tempdata[8]), ToFloat(tempdata[9]), ToFloat(tempdata[10]))));
2248 else if (elevatorcarobj)
2249 StoreCommand(elevatorcarobj->AddCameraTexture(tempdata[1], ToInt(tempdata[2]), ToFloat(tempdata[3]), Vector3(ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6])), ToBool(tempdata[7]), Vector3(ToFloat(tempdata[8]), ToFloat(tempdata[9]), ToFloat(tempdata[10]))));
2250 else if (shaftobj)
2251 StoreCommand(shaftobj->AddCameraTexture(tempdata[1], ToInt(tempdata[2]), ToFloat(tempdata[3]), Vector3(ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6])), ToBool(tempdata[7]), Vector3(ToFloat(tempdata[8]), ToFloat(tempdata[9]), ToFloat(tempdata[10]))));
2252 else if (stairsobj)
2253 StoreCommand(stairsobj->AddCameraTexture(tempdata[1], ToInt(tempdata[2]), ToFloat(tempdata[3]), Vector3(ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6])), ToBool(tempdata[7]), Vector3(ToFloat(tempdata[8]), ToFloat(tempdata[9]), ToFloat(tempdata[10]))));
2254 else
2255 return ScriptError("Invalid object");
2256
2257 return sNextLine;
2258 }
2259
2260 //SetCameraZoom command
2261 if (StartsWithNoCase(LineData, "setcamerazoom"))
2262 {
2263 //get data
2264 int params = SplitData(LineData, 14);
2265
2266 if (params != 3)
2267 return ScriptError("Incorrect number of parameters");
2268
2269 //get SBS object
2270 Object* object = Simcore->GetObjectOfParent(tempdata[0], tempdata[1], "CameraTexture", false);
2271 if (!object)
2272 return ScriptError("Object not found: parent " + tempdata[0] + ", name " + tempdata[1]);
2273
2274 ::SBS::CameraTexture* camtex = static_cast<::SBS::CameraTexture*>(object);
2275
2276 if (!camtex)
2277 return ScriptError("Invalid camera texture " + tempdata[1] + " in " + tempdata[0]);
2278
2279 //stop here if in Check mode
2280 if (config->CheckScript == true)
2281 return sNextLine;
2282
2283 //zoom camera
2284 camtex->SetZoom(ToFloat(tempdata[2]));
2285
2286 return sNextLine;
2287 }
2288
2289 //AddSlidingDoor command
2290 if (StartsWithNoCase(LineData, "addslidingdoor"))
2291 {
2292 //get data
2293 int params = SplitData(LineData, 15);
2294
2295 if (params != 21)
2296 return ScriptError("Incorrect number of parameters");
2297
2298 //check numeric values
2299 for (int i = 7; i <= 20; i++)
2300 {
2301 if (i == 8)
2302 i = 10;
2303
2304 if (!IsNumeric(tempdata[i]))
2305 return ScriptError("Invalid value: " + tempdata[i]);
2306 }
2307
2308 std::string name = tempdata[0];
2309 TrimString(name);
2310 Object *obj = Simcore->GetObject(name);
2311
2312 if (!obj)
2313 return ScriptError("Invalid object " + name);
2314
2315 Floor *floorobj = 0;
2316 Elevator *elevatorobj = 0;
2317 ElevatorCar *elevatorcarobj = 0;
2318 Shaft::Level *shaftobj = 0;
2319 Stairwell::Level *stairsobj = 0;
2320 DoorManager *managerobj = 0;
2321
2322 //get parent object
2323 if (obj->GetType() == "Floor")
2324 floorobj = static_cast<Floor*>(obj);
2325 if (obj->GetType() == "Elevator")
2326 elevatorobj = static_cast<Elevator*>(obj);
2327 if (obj->GetType() == "ElevatorCar")
2328 elevatorcarobj = static_cast<ElevatorCar*>(obj);
2329 if (obj->GetType() == "Shaft Level")
2330 shaftobj = static_cast<Shaft::Level*>(obj);
2331 if (obj->GetType() == "Stairwell Level")
2332 stairsobj = static_cast<Stairwell::Level*>(obj);
2333 if (obj->GetType() == "DoorManager")
2334 managerobj = static_cast<DoorManager*>(obj);
2335
2336 if (elevatorobj)
2337 elevatorcarobj = elevatorobj->GetCar(0);
2338
2339 //stop here if in Check mode
2340 if (config->CheckScript == true)
2341 return sNextLine;
2342
2343 //create door
2344 Door* door = 0;
2345
2346 if (floorobj)
2347 door = floorobj->AddDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]), tempdata[5], tempdata[6], ToFloat(tempdata[7]), tempdata[8], tempdata[9], false, ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]), ToFloat(tempdata[14]), ToFloat(tempdata[15]), ToFloat(tempdata[16]), ToFloat(tempdata[17]), ToFloat(tempdata[18]), ToFloat(tempdata[19]), ToFloat(tempdata[20]));
2348 else if (elevatorcarobj)
2349 door = elevatorcarobj->AddDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]), tempdata[5], tempdata[6], ToFloat(tempdata[7]), tempdata[8], tempdata[9], false, ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]), ToFloat(tempdata[14]), ToFloat(tempdata[15]), ToFloat(tempdata[16]), ToFloat(tempdata[17]), ToFloat(tempdata[18]), ToFloat(tempdata[19]), ToFloat(tempdata[20]));
2350 else if (shaftobj)
2351 door = shaftobj->AddDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]), tempdata[5], tempdata[6], ToFloat(tempdata[7]), tempdata[8], tempdata[9], false, ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]), ToFloat(tempdata[14]), ToFloat(tempdata[15]), ToFloat(tempdata[16]), ToFloat(tempdata[17]), ToFloat(tempdata[18]), ToFloat(tempdata[19]), ToFloat(tempdata[20]));
2352 else if (stairsobj)
2353 door = stairsobj->AddDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]), tempdata[5], tempdata[6], ToFloat(tempdata[7]), tempdata[8], tempdata[9], false, ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]), ToFloat(tempdata[14]), ToFloat(tempdata[15]), ToFloat(tempdata[16]), ToFloat(tempdata[17]), ToFloat(tempdata[18]), ToFloat(tempdata[19]), ToFloat(tempdata[20]));
2354 else if (managerobj)
2355 door = managerobj->AddDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]), tempdata[5], tempdata[6], ToFloat(tempdata[7]), tempdata[8], tempdata[9], false, ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]), ToFloat(tempdata[14]), ToFloat(tempdata[15]), ToFloat(tempdata[16]), ToFloat(tempdata[17]), ToFloat(tempdata[18]), ToFloat(tempdata[19]), ToFloat(tempdata[20]));
2356 else
2357 return ScriptError("Invalid object");
2358
2359 if (door)
2361
2362 StoreCommand(door);
2363 return sNextLine;
2364 }
2365
2366 //AddStdDoor command
2367 if (StartsWithNoCase(LineData, "addstddoor"))
2368 {
2369 //get data
2370 int params = SplitData(LineData, 11);
2371
2372 if (params != 21)
2373 return ScriptError("Incorrect number of parameters");
2374
2375 //check numeric values
2376 for (int i = 7; i <= 20; i++)
2377 {
2378 if (i == 8)
2379 i = 10;
2380
2381 if (!IsNumeric(tempdata[i]))
2382 return ScriptError("Invalid value: " + tempdata[i]);
2383 }
2384
2385 std::string name = tempdata[0];
2386 TrimString(name);
2387 Object *obj = Simcore->GetObject(name);
2388
2389 if (!obj)
2390 return ScriptError("Invalid object " + name);
2391
2392 Floor *floorobj = 0;
2393 Elevator *elevatorobj = 0;
2394 ElevatorCar *elevatorcarobj = 0;
2395 Shaft::Level *shaftobj = 0;
2396 Stairwell::Level *stairsobj = 0;
2397 DoorManager *managerobj = 0;
2398
2399 //get parent object
2400 if (obj->GetType() == "Floor")
2401 floorobj = static_cast<Floor*>(obj);
2402 if (obj->GetType() == "Elevator")
2403 elevatorobj = static_cast<Elevator*>(obj);
2404 if (obj->GetType() == "ElevatorCar")
2405 elevatorcarobj = static_cast<ElevatorCar*>(obj);
2406 if (obj->GetType() == "Shaft Level")
2407 shaftobj = static_cast<Shaft::Level*>(obj);
2408 if (obj->GetType() == "Stairwell Level")
2409 stairsobj = static_cast<Stairwell::Level*>(obj);
2410 if (obj->GetType() == "DoorManager")
2411 managerobj = static_cast<DoorManager*>(obj);
2412
2413 if (elevatorobj)
2414 elevatorcarobj = elevatorobj->GetCar(0);
2415
2416 //stop here if in Check mode
2417 if (config->CheckScript == true)
2418 return sNextLine;
2419
2420 //create door
2421 Door* door = 0;
2422
2423 if (floorobj)
2424 door = floorobj->AddDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]), tempdata[5], tempdata[6], ToFloat(tempdata[7]), tempdata[8], tempdata[9], true, ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]), ToFloat(tempdata[14]), ToFloat(tempdata[15]), ToFloat(tempdata[16]), ToFloat(tempdata[17]), ToFloat(tempdata[18]), ToFloat(tempdata[19]), ToFloat(tempdata[20]));
2425 else if (elevatorcarobj)
2426 door = elevatorcarobj->AddDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]), tempdata[5], tempdata[6], ToFloat(tempdata[7]), tempdata[8], tempdata[9], true, ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]), ToFloat(tempdata[14]), ToFloat(tempdata[15]), ToFloat(tempdata[16]), ToFloat(tempdata[17]), ToFloat(tempdata[18]), ToFloat(tempdata[19]), ToFloat(tempdata[20]));
2427 else if (shaftobj)
2428 door = shaftobj->AddDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]), tempdata[5], tempdata[6], ToFloat(tempdata[7]), tempdata[8], tempdata[9], true, ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]), ToFloat(tempdata[14]), ToFloat(tempdata[15]), ToFloat(tempdata[16]), ToFloat(tempdata[17]), ToFloat(tempdata[18]), ToFloat(tempdata[19]), ToFloat(tempdata[20]));
2429 else if (stairsobj)
2430 door = stairsobj->AddDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]), tempdata[5], tempdata[6], ToFloat(tempdata[7]), tempdata[8], tempdata[9], true, ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]), ToFloat(tempdata[14]), ToFloat(tempdata[15]), ToFloat(tempdata[16]), ToFloat(tempdata[17]), ToFloat(tempdata[18]), ToFloat(tempdata[19]), ToFloat(tempdata[20]));
2431 else if (managerobj)
2432 door = managerobj->AddDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]), tempdata[5], tempdata[6], ToFloat(tempdata[7]), tempdata[8], tempdata[9], true, ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]), ToFloat(tempdata[14]), ToFloat(tempdata[15]), ToFloat(tempdata[16]), ToFloat(tempdata[17]), ToFloat(tempdata[18]), ToFloat(tempdata[19]), ToFloat(tempdata[20]));
2433 else
2434 return ScriptError("Invalid object");
2435
2436 if (door)
2438
2439 StoreCommand(door);
2440 return sNextLine;
2441 }
2442
2443 //CreateCustomDoor command
2444 if (StartsWithNoCase(LineData, "createcustomdoor"))
2445 {
2446 //get data
2447 int params = SplitData(LineData, 17);
2448
2449 if (params != 5)
2450 return ScriptError("Incorrect number of parameters");
2451
2452 std::string name = tempdata[0];
2453 TrimString(name);
2454 Object *obj = Simcore->GetObject(name);
2455
2456 if (!obj)
2457 return ScriptError("Invalid object " + name);
2458
2459 Floor *floorobj = 0;
2460 Elevator *elevatorobj = 0;
2461 ElevatorCar *elevatorcarobj = 0;
2462 Shaft::Level *shaftobj = 0;
2463 Stairwell::Level *stairsobj = 0;
2464 DoorManager *managerobj = 0;
2465
2466 //get parent object
2467 if (obj->GetType() == "Floor")
2468 floorobj = static_cast<Floor*>(obj);
2469 if (obj->GetType() == "Elevator")
2470 elevatorobj = static_cast<Elevator*>(obj);
2471 if (obj->GetType() == "ElevatorCar")
2472 elevatorcarobj = static_cast<ElevatorCar*>(obj);
2473 if (obj->GetType() == "Shaft Level")
2474 shaftobj = static_cast<Shaft::Level*>(obj);
2475 if (obj->GetType() == "Stairwell Level")
2476 stairsobj = static_cast<Stairwell::Level*>(obj);
2477 if (obj->GetType() == "DoorManager")
2478 managerobj = static_cast<DoorManager*>(obj);
2479
2480 if (elevatorobj)
2481 elevatorcarobj = elevatorobj->GetCar(0);
2482
2483 //stop here if in Check mode
2484 if (config->CheckScript == true)
2485 return sNextLine;
2486
2487 //create door
2488 Door* door = 0;
2489
2490 if (floorobj)
2491 door = floorobj->CreateDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]));
2492 else if (elevatorcarobj)
2493 door = elevatorcarobj->CreateDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]));
2494 else if (shaftobj)
2495 door = shaftobj->CreateDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]));
2496 else if (stairsobj)
2497 door = stairsobj->CreateDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]));
2498 else if (managerobj)
2499 door = managerobj->CreateDoor(tempdata[1], tempdata[2], tempdata[3], ToBool(tempdata[4]));
2500 else
2501 return ScriptError("Invalid object");
2502
2503 StoreCommand(door);
2504 return sNextLine;
2505 }
2506
2507 //CustomDoorComponent command
2508 if (StartsWithNoCase(LineData, "customdoorcomponent"))
2509 {
2510 //get data
2511 int params = SplitData(LineData, 20);
2512
2513 if (params != 21)
2514 return ScriptError("Incorrect number of parameters");
2515
2516 //check numeric values
2517 for (int i = 5; i <= 20; i++)
2518 {
2519 if (i == 6)
2520 i = 9;
2521
2522 if (!IsNumeric(tempdata[i]))
2523 return ScriptError("Invalid value: " + tempdata[i]);
2524 }
2525
2526 std::string name = tempdata[0];
2527 TrimString(name);
2528 Object *obj = Simcore->GetObject(name);
2529
2530 if (!obj)
2531 return ScriptError("Invalid object " + name);
2532
2533 Floor *floorobj = 0;
2534 Elevator *elevatorobj = 0;
2535 ElevatorCar *elevatorcarobj = 0;
2536 Shaft::Level *shaftobj = 0;
2537 Stairwell::Level *stairsobj = 0;
2538 DoorManager *managerobj = 0;
2539
2540 //get parent object
2541 if (obj->GetType() == "Floor")
2542 floorobj = static_cast<Floor*>(obj);
2543 if (obj->GetType() == "Elevator")
2544 elevatorobj = static_cast<Elevator*>(obj);
2545 if (obj->GetType() == "ElevatorCar")
2546 elevatorcarobj = static_cast<ElevatorCar*>(obj);
2547 if (obj->GetType() == "Shaft Level")
2548 shaftobj = static_cast<Shaft::Level*>(obj);
2549 if (obj->GetType() == "Stairwell Level")
2550 stairsobj = static_cast<Stairwell::Level*>(obj);
2551 if (obj->GetType() == "DoorManager")
2552 managerobj = static_cast<DoorManager*>(obj);
2553
2554 if (elevatorobj)
2555 elevatorcarobj = elevatorobj->GetCar(0);
2556
2557 //stop here if in Check mode
2558 if (config->CheckScript == true)
2559 return sNextLine;
2560
2561 //get door object
2562 Door *door = 0;
2563 if (floorobj)
2564 door = floorobj->GetDoor(tempdata[1]);
2565 if (elevatorcarobj)
2566 door = elevatorcarobj->GetDoor(tempdata[1]);
2567 if (shaftobj)
2568 door = shaftobj->GetDoor(tempdata[1]);
2569 if (stairsobj)
2570 door = stairsobj->GetDoor(tempdata[1]);
2571 if (managerobj)
2572 door = managerobj->GetDoor(tempdata[1]);
2573
2574 if (!door)
2575 return ScriptError("Invalid door " + tempdata[1] + " in " + name);
2576
2577 door->AddDoorComponent(tempdata[2], tempdata[3], tempdata[4], ToFloat(tempdata[5]), tempdata[6], tempdata[7], ToBool(tempdata[8]), ToFloat(tempdata[9]), ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]), ToFloat(tempdata[14]), ToFloat(tempdata[15]), ToFloat(tempdata[16]), ToFloat(tempdata[17]), ToFloat(tempdata[18]), ToFloat(tempdata[19]), ToFloat(tempdata[20]));
2578
2579 return sNextLine;
2580 }
2581
2582 //FinishDoor command
2583 if (StartsWithNoCase(LineData, "finishdoor "))
2584 {
2585 //get data
2586 int params = SplitData(LineData, 11);
2587
2588 if (params != 3)
2589 return ScriptError("Incorrect number of parameters");
2590
2591 std::string name = tempdata[0];
2592 TrimString(name);
2593 Object *obj = Simcore->GetObject(name);
2594
2595 if (!obj)
2596 return ScriptError("Invalid object " + name);
2597
2598 Floor *floorobj = 0;
2599 Elevator *elevatorobj = 0;
2600 ElevatorCar *elevatorcarobj = 0;
2601 Shaft::Level *shaftobj = 0;
2602 Stairwell::Level *stairsobj = 0;
2603 DoorManager *managerobj = 0;
2604
2605 //get parent object
2606 if (obj->GetType() == "Floor")
2607 floorobj = static_cast<Floor*>(obj);
2608 if (obj->GetType() == "Elevator")
2609 elevatorobj = static_cast<Elevator*>(obj);
2610 if (obj->GetType() == "ElevatorCar")
2611 elevatorcarobj = static_cast<ElevatorCar*>(obj);
2612 if (obj->GetType() == "Shaft Level")
2613 shaftobj = static_cast<Shaft::Level*>(obj);
2614 if (obj->GetType() == "Stairwell Level")
2615 stairsobj = static_cast<Stairwell::Level*>(obj);
2616 if (obj->GetType() == "DoorManager")
2617 managerobj = static_cast<DoorManager*>(obj);
2618
2619 if (elevatorobj)
2620 elevatorcarobj = elevatorobj->GetCar(0);
2621
2622 //stop here if in Check mode
2623 if (config->CheckScript == true)
2624 return sNextLine;
2625
2626 //get door object
2627 Door *door = 0;
2628 if (floorobj)
2629 door = floorobj->GetDoor(tempdata[1]);
2630 if (elevatorcarobj)
2631 door = elevatorcarobj->GetDoor(tempdata[1]);
2632 if (shaftobj)
2633 door = shaftobj->GetDoor(tempdata[1]);
2634 if (stairsobj)
2635 door = stairsobj->GetDoor(tempdata[1]);
2636 if (managerobj)
2637 door = managerobj->GetDoor(tempdata[1]);
2638
2639 if (!door)
2640 return ScriptError("Invalid door " + tempdata[1] + " in " + name);
2641
2642 //finish door
2643 door->FinishDoor(ToBool(tempdata[2]));
2644
2646
2647 return sNextLine;
2648 }
2649
2650 //MoveDoor command
2651 if (StartsWithNoCase(LineData, "movedoor"))
2652 {
2653 //get data
2654 int params = SplitData(LineData, 9);
2655
2656 if (params != 5)
2657 return ScriptError("Incorrect number of parameters");
2658
2659 std::string name = tempdata[0];
2660 TrimString(name);
2661 Object *obj = Simcore->GetObject(name);
2662
2663 if (!obj)
2664 return ScriptError("Invalid object " + name);
2665
2666 Floor *floorobj = 0;
2667 Elevator *elevatorobj = 0;
2668 ElevatorCar *elevatorcarobj = 0;
2669 Shaft::Level *shaftobj = 0;
2670 Stairwell::Level *stairsobj = 0;
2671 DoorManager *managerobj = 0;
2672
2673 //get parent object
2674 if (obj->GetType() == "Floor")
2675 floorobj = static_cast<Floor*>(obj);
2676 if (obj->GetType() == "Elevator")
2677 elevatorobj = static_cast<Elevator*>(obj);
2678 if (obj->GetType() == "ElevatorCar")
2679 elevatorcarobj = static_cast<ElevatorCar*>(obj);
2680 if (obj->GetType() == "Shaft Level")
2681 shaftobj = static_cast<Shaft::Level*>(obj);
2682 if (obj->GetType() == "Stairwell Level")
2683 stairsobj = static_cast<Stairwell::Level*>(obj);
2684 if (obj->GetType() == "DoorManager")
2685 managerobj = static_cast<DoorManager*>(obj);
2686
2687 if (elevatorobj)
2688 elevatorcarobj = elevatorobj->GetCar(0);
2689
2690 //stop here if in Check mode
2691 if (config->CheckScript == true)
2692 return sNextLine;
2693
2694 //get door object
2695 Door *door = 0;
2696 if (floorobj)
2697 door = floorobj->GetDoor(tempdata[1]);
2698 if (elevatorcarobj)
2699 door = elevatorcarobj->GetDoor(tempdata[1]);
2700 if (shaftobj)
2701 door = shaftobj->GetDoor(tempdata[1]);
2702 if (stairsobj)
2703 door = stairsobj->GetDoor(tempdata[1]);
2704 if (managerobj)
2705 door = managerobj->GetDoor(tempdata[1]);
2706
2707 if (!door)
2708 return ScriptError("Invalid door " + tempdata[1] + " in " + name);
2709
2710 //move door
2711 door->Move(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4]));
2712
2713 return sNextLine;
2714 }
2715
2716 //SetAutoClose command
2717 if (StartsWithNoCase(LineData, "setautoclose"))
2718 {
2719 //get data
2720 int params = SplitData(LineData, 13);
2721
2722 if (params != 3)
2723 return ScriptError("Incorrect number of parameters");
2724
2725 std::string name = tempdata[0];
2726 TrimString(name);
2727 Object *obj = Simcore->GetObject(name);
2728
2729 if (!obj)
2730 return ScriptError("Invalid object " + name);
2731
2732 Floor *floorobj = 0;
2733 Elevator *elevatorobj = 0;
2734 ElevatorCar *elevatorcarobj = 0;
2735 Shaft::Level *shaftobj = 0;
2736 Stairwell::Level *stairsobj = 0;
2737 DoorManager *managerobj = 0;
2738
2739 //get parent object
2740 if (obj->GetType() == "Floor")
2741 floorobj = static_cast<Floor*>(obj);
2742 if (obj->GetType() == "Elevator")
2743 elevatorobj = static_cast<Elevator*>(obj);
2744 if (obj->GetType() == "ElevatorCar")
2745 elevatorcarobj = static_cast<ElevatorCar*>(obj);
2746 if (obj->GetType() == "Shaft Level")
2747 shaftobj = static_cast<Shaft::Level*>(obj);
2748 if (obj->GetType() == "Stairwell Level")
2749 stairsobj = static_cast<Stairwell::Level*>(obj);
2750 if (obj->GetType() == "DoorManager")
2751 managerobj = static_cast<DoorManager*>(obj);
2752
2753 if (elevatorobj)
2754 elevatorcarobj = elevatorobj->GetCar(0);
2755
2756 //stop here if in Check mode
2757 if (config->CheckScript == true)
2758 return sNextLine;
2759
2760 //get door object
2761 Door *door = 0;
2762 if (floorobj)
2763 door = floorobj->GetDoor(tempdata[1]);
2764 if (elevatorcarobj)
2765 door = elevatorcarobj->GetDoor(tempdata[1]);
2766 if (shaftobj)
2767 door = shaftobj->GetDoor(tempdata[1]);
2768 if (stairsobj)
2769 door = stairsobj->GetDoor(tempdata[1]);
2770 if (managerobj)
2771 door = managerobj->GetDoor(tempdata[1]);
2772
2773 if (!door)
2774 return ScriptError("Invalid door " + tempdata[1] + " in " + name);
2775
2776 //set autoclose on a door
2777 door->AutoClose(ToInt(tempdata[2]));
2778
2779 return sNextLine;
2780 }
2781
2782 //PrimAttach command
2783 if (StartsWithNoCase(LineData, "primattach"))
2784 {
2785 //get data
2786 int params = SplitData(LineData, 11);
2787
2788 if (params != 8 && params != 14)
2789 return ScriptError("Incorrect number of parameters");
2790
2791 //check numeric values
2792 for (int i = 2; i <= 7; i++)
2793 {
2794 if (!IsNumeric(tempdata[i]))
2795 return ScriptError("Invalid value: " + tempdata[i]);
2796 }
2797 if (params == 14)
2798 {
2799 for (int i = 11; i <= 13; i++)
2800 {
2801 if (!IsNumeric(tempdata[i]))
2802 return ScriptError("Invalid value: " + tempdata[i]);
2803 }
2804 }
2805
2806 std::string name = tempdata[0];
2807 TrimString(name);
2808 Object *obj = Simcore->GetObject(name);
2809
2810 if (!obj)
2811 return ScriptError("Invalid object " + name);
2812
2813 Floor *floorobj = 0;
2814 Elevator *elevatorobj = 0;
2815 ElevatorCar *elevatorcarobj = 0;
2816 Shaft::Level *shaftobj = 0;
2817 Stairwell::Level *stairsobj = 0;
2818 ::SBS::SBS *sbs = 0;
2819
2820 //get parent object
2821 if (obj->GetType() == "Floor")
2822 floorobj = static_cast<Floor*>(obj);
2823 if (obj->GetType() == "Elevator")
2824 elevatorobj = static_cast<Elevator*>(obj);
2825 if (obj->GetType() == "ElevatorCar")
2826 elevatorcarobj = static_cast<ElevatorCar*>(obj);
2827 if (obj->GetType() == "Shaft Level")
2828 shaftobj = static_cast<Shaft::Level*>(obj);
2829 if (obj->GetType() == "Stairwell Level")
2830 stairsobj = static_cast<Stairwell::Level*>(obj);
2831 if (obj->GetType() == "SBS")
2832 sbs = static_cast<::SBS::SBS*>(obj);
2833
2834 if (elevatorobj)
2835 elevatorcarobj = elevatorobj->GetCar(0);
2836
2837 //stop here if in Check mode
2838 if (config->CheckScript == true)
2839 return sNextLine;
2840
2841 //get prim object
2842 Primitive *prim = 0;
2843 if (floorobj)
2844 prim = floorobj->GetPrimitive(tempdata[1]);
2845 if (elevatorcarobj)
2846 prim = elevatorcarobj->GetPrimitive(tempdata[1]);
2847 if (shaftobj)
2848 prim = shaftobj->GetPrimitive(tempdata[1]);
2849 if (stairsobj)
2850 prim = stairsobj->GetPrimitive(tempdata[1]);
2851 if (sbs)
2852 prim = sbs->GetPrimitive(tempdata[1]);
2853
2854 if (!prim)
2855 return ScriptError("Invalid primitive " + tempdata[1] + " in " + name);
2856
2857 //modify prim
2858 Ogre::Vector3 pos;
2859 pos.x = ToFloat(tempdata[2]);
2860 pos.y = ToFloat(tempdata[3]);
2861 pos.z = ToFloat(tempdata[4]);
2862 Ogre::Vector3 rot;
2863 rot.x = ToFloat(tempdata[5]);
2864 rot.y = ToFloat(tempdata[6]);
2865 rot.z = ToFloat(tempdata[7]);
2866
2867 if (params == 14)
2868 prim->Attach(tempdata[1], pos, rot, ToFloat(tempdata[8]), ToFloat(tempdata[9]), ToBool(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]));
2869 else
2870 prim->Attach(tempdata[1], pos, rot);
2871 return sNextLine;
2872 }
2873
2874 //PrimTexture command
2875 if (StartsWithNoCase(LineData, "primtexture"))
2876 {
2877 //get data
2878 int params = SplitData(LineData, 12);
2879
2880 if (params != 3)
2881 return ScriptError("Incorrect number of parameters");
2882
2883 std::string name = tempdata[0];
2884 TrimString(name);
2885 Object *obj = Simcore->GetObject(name);
2886
2887 if (!obj)
2888 return ScriptError("Invalid object " + name);
2889
2890 Floor *floorobj = 0;
2891 Elevator *elevatorobj = 0;
2892 ElevatorCar *elevatorcarobj = 0;
2893 Shaft::Level *shaftobj = 0;
2894 Stairwell::Level *stairsobj = 0;
2895 ::SBS::SBS *sbs = 0;
2896
2897 //get parent object
2898 if (obj->GetType() == "Floor")
2899 floorobj = static_cast<Floor*>(obj);
2900 if (obj->GetType() == "Elevator")
2901 elevatorobj = static_cast<Elevator*>(obj);
2902 if (obj->GetType() == "ElevatorCar")
2903 elevatorcarobj = static_cast<ElevatorCar*>(obj);
2904 if (obj->GetType() == "Shaft Level")
2905 shaftobj = static_cast<Shaft::Level*>(obj);
2906 if (obj->GetType() == "Stairwell Level")
2907 stairsobj = static_cast<Stairwell::Level*>(obj);
2908 if (obj->GetType() == "SBS")
2909 sbs = static_cast<::SBS::SBS*>(obj);
2910
2911 if (elevatorobj)
2912 elevatorcarobj = elevatorobj->GetCar(0);
2913
2914 //stop here if in Check mode
2915 if (config->CheckScript == true)
2916 return sNextLine;
2917
2918 //get prim object
2919 Primitive *prim = 0;
2920 if (floorobj)
2921 prim = floorobj->GetPrimitive(tempdata[1]);
2922 if (elevatorcarobj)
2923 prim = elevatorcarobj->GetPrimitive(tempdata[1]);
2924 if (shaftobj)
2925 prim = shaftobj->GetPrimitive(tempdata[1]);
2926 if (stairsobj)
2927 prim = stairsobj->GetPrimitive(tempdata[1]);
2928 if (sbs)
2929 prim = sbs->GetPrimitive(tempdata[1]);
2930
2931 if (!prim)
2932 return ScriptError("Invalid primitive " + tempdata[1] + " in " + name);
2933
2934 prim->SetTexture(tempdata[2]);
2935
2936 return sNextLine;
2937 }
2938
2939 //CreatePrim/PrimShape command
2940 if (StartsWithNoCase(LineData, "primshape") || StartsWithNoCase(LineData, "createprim"))
2941 {
2942 //get data
2943 int params = SplitData(LineData, 11);
2944
2945 if (params < 7 || params > 13)
2946 return ScriptError("Incorrect number of parameters");
2947
2948 std::string name = tempdata[0];
2949 TrimString(name);
2950 Object *obj = Simcore->GetObject(name);
2951
2952 if (!obj)
2953 return ScriptError("Invalid object " + name);
2954
2955 Floor *floorobj = 0;
2956 Elevator *elevatorobj = 0;
2957 ElevatorCar *elevatorcarobj = 0;
2958 Shaft::Level *shaftobj = 0;
2959 Stairwell::Level *stairsobj = 0;
2960 ::SBS::SBS *sbs = 0;
2961
2962 //get parent object of light
2963 if (obj->GetType() == "Floor")
2964 floorobj = static_cast<Floor*>(obj);
2965 if (obj->GetType() == "Elevator")
2966 elevatorobj = static_cast<Elevator*>(obj);
2967 if (obj->GetType() == "ElevatorCar")
2968 elevatorcarobj = static_cast<ElevatorCar*>(obj);
2969 if (obj->GetType() == "Shaft Level")
2970 shaftobj = static_cast<Shaft::Level*>(obj);
2971 if (obj->GetType() == "Stairwell Level")
2972 stairsobj = static_cast<Stairwell::Level*>(obj);
2973 if (obj->GetType() == "SBS")
2974 sbs = static_cast<::SBS::SBS*>(obj);
2975
2976 //get parent object
2977 if (elevatorobj)
2978 {
2979 elevatorcarobj = elevatorobj->GetCar(0);
2980 obj = elevatorcarobj;
2981 }
2982
2983 //stop here if in Check mode
2984 if (config->CheckScript == true)
2985 return sNextLine;
2986
2987 //create prim
2988 if (floorobj)
2989 StoreCommand(floorobj->AddPrimitive(tempdata[1]));
2990 else if (elevatorcarobj)
2991 StoreCommand(elevatorcarobj->AddPrimitive(tempdata[1]));
2992 else if (shaftobj)
2993 StoreCommand(shaftobj->AddPrimitive(tempdata[1]));
2994 else if (stairsobj)
2995 StoreCommand(stairsobj->AddPrimitive(tempdata[1]));
2996 else if (sbs)
2997 StoreCommand(sbs->AddPrimitive(tempdata[1]));
2998 else
2999 return ScriptError("Invalid object " + name);
3000
3001 GeometryController* geometry = Simcore->GetGeometry();
3002
3003 std::string type = tempdata[2];
3004 SetCase(type, false);
3005 if (type == "plane")
3006 {
3007 if (params != 9)
3008 return ScriptError("Incorrect number of parameters");
3009 geometry->CreatePlane(obj, tempdata[1], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToInt(tempdata[5]), ToInt(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]));
3010 }
3011 else if (type == "sphere")
3012 {
3013 if (params != 8)
3014 return ScriptError("Incorrect number of parameters");
3015 geometry->CreateSphere(obj, tempdata[1], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToInt(tempdata[6]), ToInt(tempdata[7]));
3016 }
3017 else if (type == "cylinder")
3018 {
3019 if (params != 10)
3020 return ScriptError("Incorrect number of parameters");
3021 geometry->CreateCylinder(obj, tempdata[1], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToInt(tempdata[7]), ToInt(tempdata[8]), ToBool(tempdata[9]));
3022 }
3023 else if (type == "torus")
3024 {
3025 if (params != 7)
3026 return ScriptError("Incorrect number of parameters");
3027 geometry->CreateTorus(obj, tempdata[1], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]));
3028 }
3029 else if (type == "cone")
3030 {
3031 if (params != 9)
3032 return ScriptError("Incorrect number of parameters");
3033 geometry->CreateCone(obj, tempdata[1], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToInt(tempdata[7]), ToInt(tempdata[8]));
3034 }
3035 else if (type == "tube")
3036 {
3037 if (params != 10)
3038 return ScriptError("Incorrect number of parameters");
3039 geometry->CreateTube(obj, tempdata[1], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToInt(tempdata[8]), ToInt(tempdata[9]));
3040 }
3041 else if (type == "box")
3042 {
3043 if (params != 11)
3044 return ScriptError("Incorrect number of parameters");
3045 geometry->CreateBox(obj, tempdata[1], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToInt(tempdata[8]), ToInt(tempdata[9]), ToInt(tempdata[10]));
3046 }
3047 else if (type == "capsule")
3048 {
3049 if (params != 11)
3050 return ScriptError("Incorrect number of parameters");
3051 geometry->CreateCapsule(obj, tempdata[1], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToInt(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToInt(tempdata[8]), ToInt(tempdata[9]), ToBool(tempdata[10]));
3052 }
3053 else if (type == "torusknot")
3054 {
3055 if (params != 11)
3056 return ScriptError("Incorrect number of parameters");
3057 geometry->CreateTorusKnot(obj, tempdata[1], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToInt(tempdata[7]), ToInt(tempdata[8]), ToInt(tempdata[9]), ToInt(tempdata[10]));
3058 }
3059 else if (type == "icosphere")
3060 {
3061 if (params != 7)
3062 return ScriptError("Incorrect number of parameters");
3063 geometry->CreateIcoSphere(obj, tempdata[1], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToInt(tempdata[6]));
3064 }
3065 else if (type == "roundedbox")
3066 {
3067 if (params != 13)
3068 return ScriptError("Incorrect number of parameters");
3069 geometry->CreateRoundedBox(obj, tempdata[1], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), ToInt(tempdata[9]), ToInt(tempdata[10]), ToInt(tempdata[11]), ToBool(tempdata[12]));
3070 }
3071 else if (type == "spring")
3072 {
3073 if (params != 12)
3074 return ScriptError("Incorrect number of parameters");
3075 geometry->CreateSpring(obj, tempdata[1], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), ToInt(tempdata[9]), ToInt(tempdata[10]), ToBool(tempdata[11]));
3076 }
3077 else if (type == "prism")
3078 {
3079 if (params != 8)
3080 return ScriptError("Incorrect number of parameters");
3081 geometry->CreatePrism(obj, tempdata[1], ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToInt(tempdata[5]), ToInt(tempdata[6]), ToBool(tempdata[7]));
3082 }
3083 else
3084 return ScriptError("Invalid shape type");
3085 return sNextLine;
3086 }
3087
3088 //PrimVisible command
3089 if (StartsWithNoCase(LineData, "primvisible"))
3090 {
3091 //get data
3092 int params = SplitData(LineData, 12);
3093
3094 if (params != 3)
3095 return ScriptError("Incorrect number of parameters");
3096
3097 std::string name = tempdata[0];
3098 TrimString(name);
3099 Object *obj = Simcore->GetObject(name);
3100
3101 if (!obj)
3102 return ScriptError("Invalid object " + name);
3103
3104 Floor *floorobj = 0;
3105 Elevator *elevatorobj = 0;
3106 ElevatorCar *elevatorcarobj = 0;
3107 Shaft::Level *shaftobj = 0;
3108 Stairwell::Level *stairsobj = 0;
3109 ::SBS::SBS *sbs = 0;
3110
3111 //get parent object
3112 if (obj->GetType() == "Floor")
3113 floorobj = static_cast<Floor*>(obj);
3114 if (obj->GetType() == "Elevator")
3115 elevatorobj = static_cast<Elevator*>(obj);
3116 if (obj->GetType() == "ElevatorCar")
3117 elevatorcarobj = static_cast<ElevatorCar*>(obj);
3118 if (obj->GetType() == "Shaft Level")
3119 shaftobj = static_cast<Shaft::Level*>(obj);
3120 if (obj->GetType() == "Stairwell Level")
3121 stairsobj = static_cast<Stairwell::Level*>(obj);
3122 if (obj->GetType() == "SBS")
3123 sbs = static_cast<::SBS::SBS*>(obj);
3124
3125 if (elevatorobj)
3126 elevatorcarobj = elevatorobj->GetCar(0);
3127
3128 //stop here if in Check mode
3129 if (config->CheckScript == true)
3130 return sNextLine;
3131
3132 //get prim object
3133 Primitive *prim = 0;
3134 if (floorobj)
3135 prim = floorobj->GetPrimitive(tempdata[1]);
3136 if (elevatorcarobj)
3137 prim = elevatorcarobj->GetPrimitive(tempdata[1]);
3138 if (shaftobj)
3139 prim = shaftobj->GetPrimitive(tempdata[1]);
3140 if (stairsobj)
3141 prim = stairsobj->GetPrimitive(tempdata[1]);
3142 if (sbs)
3143 prim = sbs->GetPrimitive(tempdata[1]);
3144
3145 if (!prim)
3146 return ScriptError("Invalid primitive " + tempdata[1] + " in " + name);
3147
3148 prim->always_visible = ToBool(tempdata[2]);
3149
3150 return sNextLine;
3151 }
3152
3153 //PrimCollider command
3154 if (StartsWithNoCase(LineData, "primcollider"))
3155 {
3156 //get data
3157 int params = SplitData(LineData, 13);
3158
3159 if (params != 3)
3160 return ScriptError("Incorrect number of parameters");
3161
3162 std::string name = tempdata[0];
3163 TrimString(name);
3164 Object *obj = Simcore->GetObject(name);
3165
3166 if (!obj)
3167 return ScriptError("Invalid object " + name);
3168
3169 Floor *floorobj = 0;
3170 Elevator *elevatorobj = 0;
3171 ElevatorCar *elevatorcarobj = 0;
3172 Shaft::Level *shaftobj = 0;
3173 Stairwell::Level *stairsobj = 0;
3174 ::SBS::SBS *sbs = 0;
3175
3176 //get parent object
3177 if (obj->GetType() == "Floor")
3178 floorobj = static_cast<Floor*>(obj);
3179 if (obj->GetType() == "Elevator")
3180 elevatorobj = static_cast<Elevator*>(obj);
3181 if (obj->GetType() == "ElevatorCar")
3182 elevatorcarobj = static_cast<ElevatorCar*>(obj);
3183 if (obj->GetType() == "Shaft Level")
3184 shaftobj = static_cast<Shaft::Level*>(obj);
3185 if (obj->GetType() == "Stairwell Level")
3186 stairsobj = static_cast<Stairwell::Level*>(obj);
3187 if (obj->GetType() == "SBS")
3188 sbs = static_cast<::SBS::SBS*>(obj);
3189
3190 if (elevatorobj)
3191 elevatorcarobj = elevatorobj->GetCar(0);
3192
3193 //stop here if in Check mode
3194 if (config->CheckScript == true)
3195 return sNextLine;
3196
3197 //get prim object
3198 Primitive *prim = 0;
3199 if (floorobj)
3200 prim = floorobj->GetPrimitive(tempdata[1]);
3201 if (elevatorcarobj)
3202 prim = elevatorcarobj->GetPrimitive(tempdata[1]);
3203 if (shaftobj)
3204 prim = shaftobj->GetPrimitive(tempdata[1]);
3205 if (stairsobj)
3206 prim = stairsobj->GetPrimitive(tempdata[1]);
3207 if (sbs)
3208 prim = sbs->GetPrimitive(tempdata[1]);
3209
3210 if (!prim)
3211 return ScriptError("Invalid primitive " + tempdata[1] + " in " + name);
3212
3213 prim->collider_type = ToInt(tempdata[2]);
3214
3215 return sNextLine;
3216 }
3217
3218 //CreateObject command
3219 if (StartsWithNoCase(LineData, "createobject"))
3220 {
3221 //get data
3222 int params = SplitData(LineData, 12);
3223
3224 if (params < 7 || params > 13)
3225 return ScriptError("Incorrect number of parameters");
3226
3227 //check numeric values
3228 for (int i = 2; i <= 9; i++)
3229 {
3230 if (!IsNumeric(tempdata[i]))
3231 return ScriptError("Invalid value: " + tempdata[i]);
3232 }
3233
3234 std::string name = tempdata[0];
3235 TrimString(name);
3236 Object *obj = Simcore->GetObject(name);
3237
3238 if (!obj)
3239 return ScriptError("Invalid object " + name);
3240
3241 Floor *floorobj = 0;
3242 Elevator *elevatorobj = 0;
3243 ElevatorCar *elevatorcarobj = 0;
3244 Shaft::Level *shaftobj = 0;
3245 Stairwell::Level *stairsobj = 0;
3246 ::SBS::SBS *sbs = 0;
3247
3248 //get parent object of light
3249 if (obj->GetType() == "Floor")
3250 floorobj = static_cast<Floor*>(obj);
3251 if (obj->GetType() == "Elevator")
3252 elevatorobj = static_cast<Elevator*>(obj);
3253 if (obj->GetType() == "ElevatorCar")
3254 elevatorcarobj = static_cast<ElevatorCar*>(obj);
3255 if (obj->GetType() == "Shaft Level")
3256 shaftobj = static_cast<Shaft::Level*>(obj);
3257 if (obj->GetType() == "Stairwell Level")
3258 stairsobj = static_cast<Stairwell::Level*>(obj);
3259 if (obj->GetType() == "SBS")
3260 sbs = static_cast<::SBS::SBS*>(obj);
3261
3262 //get parent object
3263 if (elevatorobj)
3264 {
3265 elevatorcarobj = elevatorobj->GetCar(0);
3266 obj = elevatorcarobj;
3267 }
3268
3269 //stop here if in Check mode
3270 if (config->CheckScript == true)
3271 return sNextLine;
3272
3273 //create prim
3274 if (floorobj)
3275 StoreCommand(floorobj->AddCustomObject(tempdata[1], Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4])), Vector3(ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7])), ToFloat(tempdata[8]), ToFloat(tempdata[9])));
3276 else if (elevatorcarobj)
3277 StoreCommand(elevatorcarobj->AddCustomObject(tempdata[1], Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4])), Vector3(ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7])), ToFloat(tempdata[8]), ToFloat(tempdata[9])));
3278 else if (shaftobj)
3279 StoreCommand(shaftobj->AddCustomObject(tempdata[1], Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4])), Vector3(ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7])), ToFloat(tempdata[8]), ToFloat(tempdata[9])));
3280 else if (stairsobj)
3281 StoreCommand(stairsobj->AddCustomObject(tempdata[1], Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4])), Vector3(ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7])), ToFloat(tempdata[8]), ToFloat(tempdata[9])));
3282 else if (sbs)
3283 StoreCommand(sbs->AddCustomObject(tempdata[1], Vector3(ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4])), Vector3(ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7])), ToFloat(tempdata[8]), ToFloat(tempdata[9])));
3284 else
3285 return ScriptError("Invalid object " + name);
3286
3287 return sNextLine;
3288 }
3289
3290 //ObjectVisible command
3291 if (StartsWithNoCase(LineData, "objectvisible"))
3292 {
3293 //get data
3294 int params = SplitData(LineData, 13);
3295
3296 if (params != 3)
3297 return ScriptError("Incorrect number of parameters");
3298
3299 std::string name = tempdata[0];
3300 TrimString(name);
3301 Object *obj = Simcore->GetObject(name);
3302
3303 if (!obj)
3304 return ScriptError("Invalid object " + name);
3305
3306 Floor *floorobj = 0;
3307 Elevator *elevatorobj = 0;
3308 ElevatorCar *elevatorcarobj = 0;
3309 Shaft::Level *shaftobj = 0;
3310 Stairwell::Level *stairsobj = 0;
3311 ::SBS::SBS *sbs = 0;
3312
3313 //get parent object
3314 if (obj->GetType() == "Floor")
3315 floorobj = static_cast<Floor*>(obj);
3316 if (obj->GetType() == "Elevator")
3317 elevatorobj = static_cast<Elevator*>(obj);
3318 if (obj->GetType() == "ElevatorCar")
3319 elevatorcarobj = static_cast<ElevatorCar*>(obj);
3320 if (obj->GetType() == "Shaft Level")
3321 shaftobj = static_cast<Shaft::Level*>(obj);
3322 if (obj->GetType() == "Stairwell Level")
3323 stairsobj = static_cast<Stairwell::Level*>(obj);
3324 if (obj->GetType() == "SBS")
3325 sbs = static_cast<::SBS::SBS*>(obj);
3326
3327 if (elevatorobj)
3328 elevatorcarobj = elevatorobj->GetCar(0);
3329
3330 //stop here if in Check mode
3331 if (config->CheckScript == true)
3332 return sNextLine;
3333
3334 //get custom object
3335 CustomObject *object = 0;
3336 if (floorobj)
3337 object = floorobj->GetCustomObject(tempdata[1]);
3338 if (elevatorcarobj)
3339 object = elevatorcarobj->GetCustomObject(tempdata[1]);
3340 if (shaftobj)
3341 object = shaftobj->GetCustomObject(tempdata[1]);
3342 if (stairsobj)
3343 object = stairsobj->GetCustomObject(tempdata[1]);
3344 if (sbs)
3345 object = sbs->GetCustomObject(tempdata[1]);
3346
3347 if (!object)
3348 return ScriptError("Invalid custom object " + tempdata[1] + " in " + name);
3349
3350 object->always_visible = ToBool(tempdata[2]);
3351
3352 return sNextLine;
3353 }
3354
3355 //FinishObject command
3356 if (StartsWithNoCase(LineData, "finishobject"))
3357 {
3358 //get data
3359 int params = SplitData(LineData, 12);
3360
3361 if (params != 2 && params != 5)
3362 return ScriptError("Incorrect number of parameters");
3363
3364 //check numeric values
3365 if (params == 5)
3366 {
3367 for (int i = 2; i <= 4; i++)
3368 {
3369 if (!IsNumeric(tempdata[i]))
3370 return ScriptError("Invalid value: " + tempdata[i]);
3371 }
3372 }
3373
3374 std::string name = tempdata[0];
3375 TrimString(name);
3376 Object *obj = Simcore->GetObject(name);
3377
3378 if (!obj)
3379 return ScriptError("Invalid object " + name);
3380
3381 Floor *floorobj = 0;
3382 Elevator *elevatorobj = 0;
3383 ElevatorCar *elevatorcarobj = 0;
3384 Shaft::Level *shaftobj = 0;
3385 Stairwell::Level *stairsobj = 0;
3386 ::SBS::SBS *sbs = 0;
3387
3388 //get parent object
3389 if (obj->GetType() == "Floor")
3390 floorobj = static_cast<Floor*>(obj);
3391 if (obj->GetType() == "Elevator")
3392 elevatorobj = static_cast<Elevator*>(obj);
3393 if (obj->GetType() == "ElevatorCar")
3394 elevatorcarobj = static_cast<ElevatorCar*>(obj);
3395 if (obj->GetType() == "Shaft Level")
3396 shaftobj = static_cast<Shaft::Level*>(obj);
3397 if (obj->GetType() == "Stairwell Level")
3398 stairsobj = static_cast<Stairwell::Level*>(obj);
3399 if (obj->GetType() == "SBS")
3400 sbs = static_cast<::SBS::SBS*>(obj);
3401
3402 if (elevatorobj)
3403 elevatorcarobj = elevatorobj->GetCar(0);
3404
3405 //stop here if in Check mode
3406 if (config->CheckScript == true)
3407 return sNextLine;
3408
3409 //get custom object
3410 CustomObject *object = 0;
3411 if (floorobj)
3412 object = floorobj->GetCustomObject(tempdata[1]);
3413 if (elevatorcarobj)
3414 object = elevatorcarobj->GetCustomObject(tempdata[1]);
3415 if (shaftobj)
3416 object = shaftobj->GetCustomObject(tempdata[1]);
3417 if (stairsobj)
3418 object = stairsobj->GetCustomObject(tempdata[1]);
3419 if (sbs)
3420 object = sbs->GetCustomObject(tempdata[1]);
3421
3422 if (!object)
3423 return ScriptError("Invalid custom object " + tempdata[1] + " in " + name);
3424
3425 if (params == 2)
3426 object->Finish();
3427 else
3428 object->Finish(true, ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4]));
3429
3430 return sNextLine;
3431 }
3432
3433 //ObjectWall command
3434 if (StartsWithNoCase(LineData, "objectwall "))
3435 {
3436 //get data
3437 int params = SplitData(LineData, 11);
3438
3439 if (params != 15)
3440 return ScriptError("Incorrect number of parameters");
3441
3442 //check numeric values
3443 for (int i = 4; i <= 14; i++)
3444 {
3445 if (!IsNumeric(tempdata[i]))
3446 return ScriptError("Invalid value: " + tempdata[i]);
3447 }
3448
3449 std::string name = tempdata[0];
3450 TrimString(name);
3451 Object *obj = Simcore->GetObject(name);
3452
3453 if (!obj)
3454 return ScriptError("Invalid object " + name);
3455
3456 Floor *floorobj = 0;
3457 Elevator *elevatorobj = 0;
3458 ElevatorCar *elevatorcarobj = 0;
3459 Shaft::Level *shaftobj = 0;
3460 Stairwell::Level *stairsobj = 0;
3461 ::SBS::SBS *sbs = 0;
3462
3463 //get parent object
3464 if (obj->GetType() == "Floor")
3465 floorobj = static_cast<Floor*>(obj);
3466 if (obj->GetType() == "Elevator")
3467 elevatorobj = static_cast<Elevator*>(obj);
3468 if (obj->GetType() == "ElevatorCar")
3469 elevatorcarobj = static_cast<ElevatorCar*>(obj);
3470 if (obj->GetType() == "Shaft Level")
3471 shaftobj = static_cast<Shaft::Level*>(obj);
3472 if (obj->GetType() == "Stairwell Level")
3473 stairsobj = static_cast<Stairwell::Level*>(obj);
3474 if (obj->GetType() == "SBS")
3475 sbs = static_cast<::SBS::SBS*>(obj);
3476
3477 if (elevatorobj)
3478 elevatorcarobj = elevatorobj->GetCar(0);
3479
3480 //stop here if in Check mode
3481 if (config->CheckScript == true)
3482 return sNextLine;
3483
3484 //get custom object
3485 CustomObject *object = 0;
3486 if (floorobj)
3487 object = floorobj->GetCustomObject(tempdata[1]);
3488 if (elevatorcarobj)
3489 object = elevatorcarobj->GetCustomObject(tempdata[1]);
3490 if (shaftobj)
3491 object = shaftobj->GetCustomObject(tempdata[1]);
3492 if (stairsobj)
3493 object = stairsobj->GetCustomObject(tempdata[1]);
3494 if (sbs)
3495 object = sbs->GetCustomObject(tempdata[1]);
3496
3497 if (!object)
3498 return ScriptError("Invalid custom object " + tempdata[1] + " in " + name);
3499
3500 StoreCommand(Simcore->AddWall(object->GetMeshObject(), tempdata[2], tempdata[3], ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), ToFloat(tempdata[9]), ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToFloat(tempdata[12]), ToFloat(tempdata[13]), ToFloat(tempdata[14])));
3501
3502 return sNextLine;
3503 }
3504
3505 //ObjectFloor command
3506 if (StartsWithNoCase(LineData, "objectfloor"))
3507 {
3508 //get data
3509 int params = SplitData(LineData, 11);
3510
3511 if (params != 15)
3512 return ScriptError("Incorrect number of parameters");
3513
3514 //check numeric values
3515 for (int i = 4; i <= 14; i++)
3516 {
3517 if (i == 11)
3518 i = 13;
3519
3520 if (!IsNumeric(tempdata[i]))
3521 return ScriptError("Invalid value: " + tempdata[i]);
3522 }
3523
3524 std::string name = tempdata[0];
3525 TrimString(name);
3526 Object *obj = Simcore->GetObject(name);
3527
3528 if (!obj)
3529 return ScriptError("Invalid object " + name);
3530
3531 Floor *floorobj = 0;
3532 Elevator *elevatorobj = 0;
3533 ElevatorCar *elevatorcarobj = 0;
3534 Shaft::Level *shaftobj = 0;
3535 Stairwell::Level *stairsobj = 0;
3536 ::SBS::SBS *sbs = 0;
3537
3538 //get parent object
3539 if (obj->GetType() == "Floor")
3540 floorobj = static_cast<Floor*>(obj);
3541 if (obj->GetType() == "Elevator")
3542 elevatorobj = static_cast<Elevator*>(obj);
3543 if (obj->GetType() == "ElevatorCar")
3544 elevatorcarobj = static_cast<ElevatorCar*>(obj);
3545 if (obj->GetType() == "Shaft Level")
3546 shaftobj = static_cast<Shaft::Level*>(obj);
3547 if (obj->GetType() == "Stairwell Level")
3548 stairsobj = static_cast<Stairwell::Level*>(obj);
3549 if (obj->GetType() == "SBS")
3550 sbs = static_cast<::SBS::SBS*>(obj);
3551
3552 if (elevatorobj)
3553 elevatorcarobj = elevatorobj->GetCar(0);
3554
3555 //stop here if in Check mode
3556 if (config->CheckScript == true)
3557 return sNextLine;
3558
3559 //get custom object
3560 CustomObject *object = 0;
3561 if (floorobj)
3562 object = floorobj->GetCustomObject(tempdata[1]);
3563 if (elevatorcarobj)
3564 object = elevatorcarobj->GetCustomObject(tempdata[1]);
3565 if (shaftobj)
3566 object = shaftobj->GetCustomObject(tempdata[1]);
3567 if (stairsobj)
3568 object = stairsobj->GetCustomObject(tempdata[1]);
3569 if (sbs)
3570 object = sbs->GetCustomObject(tempdata[1]);
3571
3572 if (!object)
3573 return ScriptError("Invalid custom object " + tempdata[1] + " in " + name);
3574
3575 StoreCommand(Simcore->AddFloor(object->GetMeshObject(), tempdata[2], tempdata[3], ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), ToFloat(tempdata[9]), ToFloat(tempdata[10]), ToBool(tempdata[11]), ToBool(tempdata[12]), ToFloat(tempdata[13]), ToFloat(tempdata[14]), false));
3576
3577 return sNextLine;
3578 }
3579
3580 //ObjectWallBox command
3581 if (StartsWithNoCase(LineData, "objectwallbox "))
3582 {
3583 //get data
3584 int params = SplitData(LineData, 14);
3585
3586 if (params != 17)
3587 return ScriptError("Incorrect number of parameters");
3588
3589 //check numeric values
3590 for (int i = 4; i <= 11; i++)
3591 {
3592 if (!IsNumeric(tempdata[i]))
3593 return ScriptError("Invalid value: " + tempdata[i]);
3594 }
3595
3596 std::string name = tempdata[0];
3597 TrimString(name);
3598 Object *obj = Simcore->GetObject(name);
3599
3600 if (!obj)
3601 return ScriptError("Invalid object " + name);
3602
3603 Floor *floorobj = 0;
3604 Elevator *elevatorobj = 0;
3605 ElevatorCar *elevatorcarobj = 0;
3606 Shaft::Level *shaftobj = 0;
3607 Stairwell::Level *stairsobj = 0;
3608 ::SBS::SBS *sbs = 0;
3609
3610 //get parent object
3611 if (obj->GetType() == "Floor")
3612 floorobj = static_cast<Floor*>(obj);
3613 if (obj->GetType() == "Elevator")
3614 elevatorobj = static_cast<Elevator*>(obj);
3615 if (obj->GetType() == "ElevatorCar")
3616 elevatorcarobj = static_cast<ElevatorCar*>(obj);
3617 if (obj->GetType() == "Shaft Level")
3618 shaftobj = static_cast<Shaft::Level*>(obj);
3619 if (obj->GetType() == "Stairwell Level")
3620 stairsobj = static_cast<Stairwell::Level*>(obj);
3621 if (obj->GetType() == "SBS")
3622 sbs = static_cast<::SBS::SBS*>(obj);
3623
3624 if (elevatorobj)
3625 elevatorcarobj = elevatorobj->GetCar(0);
3626
3627 //stop here if in Check mode
3628 if (config->CheckScript == true)
3629 return sNextLine;
3630
3631 //get custom object
3632 CustomObject *object = 0;
3633 if (floorobj)
3634 object = floorobj->GetCustomObject(tempdata[1]);
3635 if (elevatorcarobj)
3636 object = elevatorcarobj->GetCustomObject(tempdata[1]);
3637 if (shaftobj)
3638 object = shaftobj->GetCustomObject(tempdata[1]);
3639 if (stairsobj)
3640 object = stairsobj->GetCustomObject(tempdata[1]);
3641 if (sbs)
3642 object = sbs->GetCustomObject(tempdata[1]);
3643
3644 if (!object)
3645 return ScriptError("Invalid custom object " + tempdata[1] + " in " + name);
3646
3647 StoreCommand(Simcore->CreateWallBox(object->GetMeshObject(), tempdata[2], tempdata[3], ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), ToFloat(tempdata[9]), ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToBool(tempdata[12]), ToBool(tempdata[13]), ToBool(tempdata[14]), ToBool(tempdata[15]), ToBool(tempdata[16])));
3648
3649 return sNextLine;
3650 }
3651
3652 //CustomWallBox2 command
3653 if (StartsWithNoCase(LineData, "objectwallbox2"))
3654 {
3655 //get data
3656 int params = SplitData(LineData, 14);
3657
3658 if (params != 17)
3659 return ScriptError("Incorrect number of parameters");
3660
3661 //check numeric values
3662 for (int i = 4; i <= 11; i++)
3663 {
3664 if (!IsNumeric(tempdata[i]))
3665 return ScriptError("Invalid value: " + tempdata[i]);
3666 }
3667
3668 std::string name = tempdata[0];
3669 TrimString(name);
3670 Object *obj = Simcore->GetObject(name);
3671
3672 if (!obj)
3673 return ScriptError("Invalid object " + name);
3674
3675 Floor *floorobj = 0;
3676 Elevator *elevatorobj = 0;
3677 ElevatorCar *elevatorcarobj = 0;
3678 Shaft::Level *shaftobj = 0;
3679 Stairwell::Level *stairsobj = 0;
3680 ::SBS::SBS *sbs = 0;
3681
3682 //get parent object
3683 if (obj->GetType() == "Floor")
3684 floorobj = static_cast<Floor*>(obj);
3685 if (obj->GetType() == "Elevator")
3686 elevatorobj = static_cast<Elevator*>(obj);
3687 if (obj->GetType() == "ElevatorCar")
3688 elevatorcarobj = static_cast<ElevatorCar*>(obj);
3689 if (obj->GetType() == "Shaft Level")
3690 shaftobj = static_cast<Shaft::Level*>(obj);
3691 if (obj->GetType() == "Stairwell Level")
3692 stairsobj = static_cast<Stairwell::Level*>(obj);
3693 if (obj->GetType() == "SBS")
3694 sbs = static_cast<::SBS::SBS*>(obj);
3695
3696 if (elevatorobj)
3697 elevatorcarobj = elevatorobj->GetCar(0);
3698
3699 //stop here if in Check mode
3700 if (config->CheckScript == true)
3701 return sNextLine;
3702
3703 //get prim object
3704 CustomObject *object = 0;
3705 if (floorobj)
3706 object = floorobj->GetCustomObject(tempdata[1]);
3707 if (elevatorcarobj)
3708 object = elevatorcarobj->GetCustomObject(tempdata[1]);
3709 if (shaftobj)
3710 object = shaftobj->GetCustomObject(tempdata[1]);
3711 if (stairsobj)
3712 object = stairsobj->GetCustomObject(tempdata[1]);
3713 if (sbs)
3714 object = sbs->GetCustomObject(tempdata[1]);
3715
3716 if (!object)
3717 return ScriptError("Invalid custom object " + tempdata[1] + " in " + name);
3718
3719 StoreCommand(Simcore->CreateWallBox2(object->GetMeshObject(), tempdata[2], tempdata[3], ToFloat(tempdata[4]), ToFloat(tempdata[5]), ToFloat(tempdata[6]), ToFloat(tempdata[7]), ToFloat(tempdata[8]), ToFloat(tempdata[9]), ToFloat(tempdata[10]), ToFloat(tempdata[11]), ToBool(tempdata[12]), ToBool(tempdata[13]), ToBool(tempdata[14]), ToBool(tempdata[15]), ToBool(tempdata[16])));
3720
3721 return sNextLine;
3722 }
3723
3724 //Rotate command
3725 if (StartsWithNoCase(LineData, "rotate "))
3726 {
3727 //get data
3728 int params = SplitData(LineData, 7);
3729
3730 if (params != 5)
3731 return ScriptError("Incorrect number of parameters");
3732
3733 //check numeric values
3734 for (int i = 1; i <= 4; i++)
3735 {
3736 if (!IsNumeric(tempdata[i]))
3737 return ScriptError("Invalid value: " + tempdata[i]);
3738 }
3739
3740 std::string name = tempdata[0];
3741 TrimString(name);
3742 Object *obj = Simcore->GetObject(name);
3743
3744 if (!obj)
3745 return ScriptError("Invalid object " + name);
3746
3747 //stop here if in Check mode
3748 if (config->CheckScript == true)
3749 return sNextLine;
3750
3751 //rotate object
3752 obj->Rotate(ToFloat(tempdata[1]), ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4]));
3753
3754 return sNextLine;
3755 }
3756
3757 //SetRotation command
3758 if (StartsWithNoCase(LineData, "setrotation"))
3759 {
3760 //get data
3761 int params = SplitData(LineData, 12);
3762
3763 if (params != 4)
3764 return ScriptError("Incorrect number of parameters");
3765
3766 //check numeric values
3767 for (int i = 1; i <= 3; i++)
3768 {
3769 if (!IsNumeric(tempdata[i]))
3770 return ScriptError("Invalid value: " + tempdata[i]);
3771 }
3772
3773 std::string name = tempdata[0];
3774 TrimString(name);
3775 Object *obj = Simcore->GetObject(name);
3776
3777 if (!obj)
3778 return ScriptError("Invalid object " + name);
3779
3780 //stop here if in Check mode
3781 if (config->CheckScript == true)
3782 return sNextLine;
3783
3784 //rotate object
3785 obj->SetRotation(ToFloat(tempdata[1]), ToFloat(tempdata[2]), ToFloat(tempdata[3]));
3786
3787 return sNextLine;
3788 }
3789
3790 //Move command
3791 if (StartsWithNoCase(LineData, "move "))
3792 {
3793 //get data
3794 int params = SplitData(LineData, 5);
3795
3796 if (params != 5)
3797 return ScriptError("Incorrect number of parameters");
3798
3799 //check numeric values
3800 for (int i = 1; i <= 4; i++)
3801 {
3802 if (!IsNumeric(tempdata[i]))
3803 return ScriptError("Invalid value: " + tempdata[i]);
3804 }
3805
3806 std::string name = tempdata[0];
3807 TrimString(name);
3808 Object *obj = Simcore->GetObject(name);
3809
3810 if (!obj)
3811 return ScriptError("Invalid object " + name);
3812
3813 //stop here if in Check mode
3814 if (config->CheckScript == true)
3815 return sNextLine;
3816
3817 //rotate object
3818 obj->Move(ToFloat(tempdata[1]), ToFloat(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4]));
3819
3820 return sNextLine;
3821 }
3822
3823 //SetPosition command
3824 if (StartsWithNoCase(LineData, "setposition ") && config->SectionNum != 9)
3825 {
3826 //get data
3827 int params = SplitData(LineData, 12);
3828
3829 if (params != 4)
3830 return ScriptError("Incorrect number of parameters");
3831
3832 //check numeric values
3833 for (int i = 1; i <= 3; i++)
3834 {
3835 if (!IsNumeric(tempdata[i]))
3836 return ScriptError("Invalid value: " + tempdata[i]);
3837 }
3838
3839 std::string name = tempdata[0];
3840 TrimString(name);
3841 Object *obj = Simcore->GetObject(name);
3842
3843 if (!obj)
3844 return ScriptError("Invalid object " + name);
3845
3846 //stop here if in Check mode
3847 if (config->CheckScript == true)
3848 return sNextLine;
3849
3850 //rotate object
3851 obj->SetPosition(ToFloat(tempdata[1]), ToFloat(tempdata[2]), ToFloat(tempdata[3]));
3852
3853 return sNextLine;
3854 }
3855
3856 //SetPositionY command
3857 if (StartsWithNoCase(LineData, "setpositiony"))
3858 {
3859 //get data
3860 int params = SplitData(LineData, 13);
3861
3862 if (params != 2)
3863 return ScriptError("Incorrect number of parameters");
3864
3865 //check numeric values
3866 if (!IsNumeric(tempdata[1]))
3867 return ScriptError("Invalid value: " + tempdata[1]);
3868
3869 std::string name = tempdata[0];
3870 TrimString(name);
3871 Object *obj = Simcore->GetObject(name);
3872
3873 if (!obj)
3874 return ScriptError("Invalid object " + name);
3875
3876 //stop here if in Check mode
3877 if (config->CheckScript == true)
3878 return sNextLine;
3879
3880 //rotate object
3881 obj->SetPositionY(ToFloat(tempdata[1]));
3882
3883 return sNextLine;
3884 }
3885
3886 //SetPositionRelative command
3887 if (linecheck.substr(0, 19) == "setpositionrelative")
3888 {
3889 //get data
3890 int params = SplitData(LineData, 20);
3891
3892 if (params != 4)
3893 return ScriptError("Incorrect number of parameters");
3894
3895 //check numeric values
3896 for (int i = 1; i <= 3; i++)
3897 {
3898 if (!IsNumeric(tempdata[i]))
3899 return ScriptError("Invalid value: " + tempdata[i]);
3900 }
3901
3902 std::string name = tempdata[0];
3903 TrimString(name);
3904 Object *obj = Simcore->GetObject(name);
3905
3906 if (!obj)
3907 return ScriptError("Invalid object " + name);
3908
3909 //stop here if in Check mode
3910 if (config->CheckScript == true)
3911 return sNextLine;
3912
3913 //rotate object
3914 obj->SetPositionRelative(ToFloat(tempdata[1]), ToFloat(tempdata[2]), ToFloat(tempdata[3]));
3915
3916 return sNextLine;
3917 }
3918
3919 //CreateWallObject command
3920 if (StartsWithNoCase(LineData, "createwallobject"))
3921 {
3922 //get data
3923 int params = SplitData(LineData, 17);
3924
3925 if (params != 2)
3926 return ScriptError("Incorrect number of parameters");
3927
3928 MeshObject *mesh = GetMeshObject(tempdata[0]);
3929
3930 if (!mesh)
3931 return ScriptError("Invalid object");
3932
3933 StoreCommand(mesh->CreateWallObject(tempdata[1]));
3934
3935 return sNextLine;
3936 }
3937
3938 //SetKey command
3939 if (StartsWithNoCase(LineData, "setkey"))
3940 {
3941 //get data
3942 int params = SplitData(LineData, 7);
3943
3944 if (params != 1)
3945 return ScriptError("Incorrect number of parameters");
3946
3947 //check numeric values
3948 if (!IsNumeric(tempdata[0]))
3949 return ScriptError("Invalid value: " + tempdata[0]);
3950
3951 config->keyvalue = ToInt(tempdata[0]);
3952 if (config->keyvalue < 1)
3953 {
3954 config->keyvalue = 0;
3955 return ScriptError("Incorrect key ID number");
3956 }
3957
3958 config->setkey = true;
3959 return sNextLine;
3960 }
3961
3962 //SetLock command
3963 if (StartsWithNoCase(LineData, "setlock"))
3964 {
3965 //get data
3966 int params = SplitData(LineData, 8);
3967
3968 if (params != 2)
3969 return ScriptError("Incorrect number of parameters");
3970
3971 //check numeric values
3972 for (int i = 0; i <= 1; i++)
3973 {
3974 if (!IsNumeric(tempdata[i]))
3975 return ScriptError("Invalid value: " + tempdata[i]);
3976 }
3977
3978 config->lockvalue = ToInt(tempdata[0]);
3979 if (config->lockvalue < 0 || config->lockvalue > 3)
3980 {
3981 config->lockvalue = 0;
3982 config->keyvalue = 0;
3983 return ScriptError("Incorrect lock parameter");
3984 }
3985
3986 config->keyvalue = ToInt(tempdata[1]);
3987 if (config->keyvalue < 0)
3988 {
3989 config->lockvalue = 0;
3990 config->keyvalue = 0;
3991 return ScriptError("Incorrect key ID number");
3992 }
3993 return sNextLine;
3994 }
3995
3996 //Delete command
3997 if (StartsWithNoCase(LineData, "delete"))
3998 {
3999 if (LineData.size() == 6)
4000 return ScriptError("Incorrect number of parameters");
4001
4002 //calculate inline math
4003 std::string value = Calc(LineData.substr(7));
4004
4005 int obj;
4006 if (!IsNumeric(value, obj))
4007 return ScriptError("Invalid value: " + value);
4008
4009 //delete object
4010 Simcore->DeleteObject(obj);
4011
4012 return sNextLine;
4013 }
4014
4015 //RunAction command
4016 if (StartsWithNoCase(LineData, "runaction"))
4017 {
4018 if (LineData.size() == 9)
4019 return ScriptError("Incorrect number of parameters");
4020
4021 //calculate inline math
4022 std::string value = Calc(LineData.substr(10));
4023
4024 //run action
4025 Simcore->RunAction(value);
4026
4027 return sNextLine;
4028 }
4029
4030 //Teleport command
4031 if (StartsWithNoCase(LineData, "teleport"))
4032 {
4033 //get data
4034 int params = SplitData(LineData, 9);
4035
4036 if (params != 3)
4037 return ScriptError("Incorrect number of parameters");
4038
4039 //check numeric values
4040 for (int i = 0; i <= 2; i++)
4041 {
4042 if (!IsNumeric(tempdata[i]))
4043 return ScriptError("Invalid value: " + tempdata[i]);
4044 }
4045
4046 Simcore->camera->Teleport(ToFloat(tempdata[0]), ToFloat(tempdata[1]), ToFloat(tempdata[2]));
4047
4048 return sNextLine;
4049 }
4050
4051 //GotoFloor command
4052 if (StartsWithNoCase(LineData, "gotofloor"))
4053 {
4054 if (LineData.size() == 9)
4055 return ScriptError("Incorrect number of parameters");
4056
4057 //calculate inline math
4058 std::string value = Calc(LineData.substr(10));
4059
4060 int num;
4061 if (!IsNumeric(value, num))
4062 return ScriptError("Invalid value: " + value);
4063
4064 Simcore->camera->GotoFloor(num);
4065
4066 return sNextLine;
4067 }
4068
4069 //FloorInfo command
4070 if (StartsWithNoCase(LineData, "floorinfo"))
4071 {
4072 if (LineData.size() == 9)
4074 else
4075 {
4076 //calculate inline math
4077 std::string value = Calc(LineData.substr(10));
4078
4079 int num;
4080 if (!IsNumeric(value, num))
4081 return ScriptError("Invalid value: " + value);
4082
4083 Floor *floor = Simcore->GetFloor(num);
4084 if (floor)
4085 floor->ShowInfo();
4086 }
4087 return sNextLine;
4088 }
4089
4090 //ListTextures command
4091 if (StartsWithNoCase(LineData, "listtextures"))
4092 {
4093 Simcore->Report(texturemanager->ListTextures(true));
4094 return sNextLine;
4095 }
4096
4097 //ListVisibleMeshes command
4098 if (StartsWithNoCase(LineData, "listvisiblemeshes"))
4099 {
4101 return sNextLine;
4102 }
4103
4104 //ShowLoadedSounds command
4105 if (StartsWithNoCase(LineData, "showloadedsounds"))
4106 {
4107 if (Simcore->GetSoundSystem())
4109 return sNextLine;
4110 }
4111
4112 //ShowPlayingSounds command
4113 if (StartsWithNoCase(LineData, "showplayingsounds"))
4114 {
4115 if (Simcore->GetSoundSystem())
4117 return sNextLine;
4118 }
4119
4120 //Print command
4121 if (StartsWithNoCase(LineData, "print"))
4122 {
4123 //calculate inline math
4124 std::string value = Calc(LineData.substr(5));
4125
4126 //print line
4127 engine->Report(value);
4128
4129 return sNextLine;
4130 }
4131
4132 //EnablePhysics command
4133 if (StartsWithNoCase(LineData, "enablephysics"))
4134 {
4135 //get data
4136 int params = SplitData(LineData, 14);
4137
4138 if (params != 6)
4139 return ScriptError("Incorrect number of parameters");
4140
4141 //check numeric values
4142 for (int i = 3; i <= 5; i++)
4143 {
4144 if (!IsNumeric(tempdata[i]))
4145 return ScriptError("Invalid value: " + tempdata[i]);
4146 }
4147
4148 //get SBS object
4149 Object* object = Simcore->GetObjectOfParent(tempdata[0], tempdata[1], "Mesh", false);
4150 if (!object)
4151 return ScriptError("Object not found: parent " + tempdata[0] + ", name " + tempdata[1]);
4152
4153 ::SBS::MeshObject* mesh = static_cast<::SBS::MeshObject*>(object);
4154
4155 //enable physics on a matching object
4156 if (mesh)
4157 mesh->EnablePhysics(ToBool(tempdata[2]), ToFloat(tempdata[3]), ToFloat(tempdata[4]), ToFloat(tempdata[5]));
4158
4159 return sNextLine;
4160 }
4161
4162 return sContinue;
4163}
4164
4165}
void SetZoom(Real value)
void Teleport(Real X, Real Y, Real Z)
Definition camera.cpp:1516
void GotoFloor(int floor, bool disable_current=true)
Definition camera.cpp:1166
MeshObject * GetMeshObject()
Definition custom.h:48
void SetLocked(int side, int keyid)
Definition lock.cpp:91
Door * GetDoor(const std::string &name)
Definition manager.cpp:750
Door * CreateDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool rotate)
Definition manager.cpp:739
Door * AddDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool open_state, const std::string &texture, const std::string &side_texture, Real thickness, const std::string &face_direction, const std::string &open_direction, bool rotate, Real open_speed, Real close_speed, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th)
Definition manager.cpp:727
DoorWrapper * FinishDoor(bool open_state)
Definition door.cpp:414
void AutoClose(int interval)
Definition door.cpp:493
DoorWrapper * AddDoorComponent(const std::string &name, const std::string &texture, const std::string &sidetexture, Real thickness, const std::string &face_direction, const std::string &open_direction, bool OpenClockwise, Real OpenSpeed, Real CloseSpeed, Real x1, Real z1, Real x2, Real z2, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th)
Definition door.cpp:357
Door * AddDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool open_state, const std::string &texture, const std::string &side_texture, Real thickness, const std::string &face_direction, const std::string &open_direction, bool rotate, Real open_speed, Real close_speed, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th)
Door * CreateDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool rotate)
Primitive * GetPrimitive(std::string name)
CustomObject * GetCustomObject(std::string name)
Light * AddLight(const std::string &name, int type)
Primitive * AddPrimitive(const std::string &name)
CustomObject * AddCustomObject(const std::string &name, const Vector3 &position, const Vector3 &rotation, Real max_render_distance=0, Real scale_multiplier=1)
CameraTexture * AddCameraTexture(const std::string &name, int quality, Real fov, const Vector3 &position, bool use_rotation, const Vector3 &rotation)
Light * GetLight(const std::string &name)
ElevatorDoor * GetDoor(int number)
ElevatorCar * GetCar(int number)
Primitive * GetPrimitive(std::string name)
Definition floor.cpp:1881
void ShowInfo(bool detailed=true, bool display_header=true)
Definition floor.cpp:1656
Light * GetLight(const std::string &name)
Definition floor.cpp:1509
CameraTexture * AddCameraTexture(const std::string &name, int quality, Real fov, const Vector3 &position, bool use_rotation, const Vector3 &rotation)
Definition floor.cpp:1624
Door * CreateDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool rotate)
Definition floor.cpp:824
Real GetBase(bool relative=false)
Definition floor.cpp:1140
Light * AddLight(const std::string &name, int type)
Definition floor.cpp:1499
Primitive * AddPrimitive(const std::string &name)
Definition floor.cpp:1548
CustomObject * AddCustomObject(const std::string &name, const Vector3 &position, const Vector3 &rotation, Real max_render_distance=0, Real scale_multiplier=1)
Definition floor.cpp:1573
Door * GetDoor(const std::string &name)
Definition floor.cpp:1303
CustomObject * GetCustomObject(std::string name)
Definition floor.cpp:1896
Door * AddDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool open_state, const std::string &texture, const std::string &side_texture, Real thickness, const std::string &face_direction, const std::string &open_direction, bool rotate, Real open_speed, Real close_speed, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th, bool external=false)
Definition floor.cpp:779
Ogre::MeshPtr CreatePrism(Object *parent, const std::string &name, Real radius, Real height, unsigned int sides, unsigned int segments_height, bool capped)
Definition geometry.cpp:104
Ogre::MeshPtr CreateCylinder(Object *parent, const std::string &name, Real radius, Real height, Real utile, Real vtile, unsigned int segments_base, unsigned int segments_height, bool capped)
Definition geometry.cpp:54
Ogre::MeshPtr CreatePlane(Object *parent, const std::string &name, Real size_x, Real size_y, unsigned int segments_x, unsigned int segments_y, Real utile, Real vtile)
Definition geometry.cpp:44
Ogre::MeshPtr CreateRoundedBox(Object *parent, const std::string &name, Real size_x, Real size_y, Real size_z, Real chamfer_size, Real utile, Real vtile, unsigned int segments_x, unsigned int segments_y, unsigned int segments_z, bool capped)
Definition geometry.cpp:94
Ogre::MeshPtr CreateSpring(Object *parent, const std::string &name, Real radius_circle, Real radius_helix, Real height, Real round, Real utile, Real vtile, unsigned int segments_circle, unsigned int segments_path, bool capped)
Definition geometry.cpp:99
Ogre::MeshPtr CreateTorus(Object *parent, const std::string &name, Real radius, Real section_radius, Real utile, Real vtile)
Definition geometry.cpp:59
Ogre::MeshPtr CreateBox(Object *parent, const std::string &name, Real size_x, Real size_y, Real size_z, Real utile, Real vtile, unsigned int segments_x, unsigned int segments_y, unsigned int segments_z)
Definition geometry.cpp:74
Ogre::MeshPtr CreateTube(Object *parent, const std::string &name, Real inner_radius, Real outer_radius, Real height, Real utile, Real vtile, unsigned int segments_base, unsigned int segments_height)
Definition geometry.cpp:69
Ogre::MeshPtr CreateIcoSphere(Object *parent, const std::string &name, Real radius, Real utile, Real vtile, unsigned int iterations)
Definition geometry.cpp:89
Ogre::MeshPtr CreateCapsule(Object *parent, const std::string &name, Real radius, Real height, unsigned int rings, Real utile, Real vtile, unsigned int segments, unsigned int segments_height, bool capped)
Definition geometry.cpp:79
Ogre::MeshPtr CreateCone(Object *parent, const std::string &name, Real radius, Real height, Real utile, Real vtile, unsigned int segments_base, unsigned int segments_height)
Definition geometry.cpp:64
Ogre::MeshPtr CreateSphere(Object *parent, const std::string &name, Real radius, Real utile, Real vtile, unsigned int rings, unsigned int segments)
Definition geometry.cpp:49
Ogre::MeshPtr CreateTorusKnot(Object *parent, const std::string &name, Real radius, Real section_radius, Real utile, Real vtile, unsigned int segments_circle, unsigned int seg_section, int p, int q)
Definition geometry.cpp:84
void SetDirection(const Vector3 &direction)
Definition light.cpp:126
void SetColor(Real color_r=1.0f, Real color_g=1.0f, Real color_b=1.0f)
Definition light.cpp:104
void SetAttenuation(Real att_range=100000.f, Real att_constant=1.f, Real att_linear=0.f, Real att_quadratic=0.f)
Definition light.cpp:115
void SetSpotlightRange(Real spot_inner_angle=30.f, Real spot_outer_angle=40.f, Real spot_falloff=1.f)
Definition light.cpp:120
void SetSpecularColor(Real color_r=0.0f, Real color_g=0.0f, Real color_b=0.0f)
Definition light.cpp:110
void SetLocked(bool value, int keyid)
Definition lock.cpp:37
Vector3 GetWallExtents(const std::string &name, Real altitude, bool get_max)
Definition mesh.cpp:425
Wall * GetWallByName(std::string name)
Definition mesh.cpp:219
void Cut(Vector3 start, Vector3 end, bool cutwalls, bool cutfloors, int checkwallnumber=0, bool reset_check=true)
Definition mesh.cpp:511
Vector3 GetPoint(const std::string &wallname, const Vector3 &start, const Vector3 &end)
Definition mesh.cpp:412
Wall * CreateWallObject(const std::string &name)
Definition mesh.cpp:208
void EnablePhysics(bool value, Real restitution=0, Real friction=0, Real mass=0)
Definition mesh.cpp:1206
void SetKey(int keyid)
Definition model.cpp:110
virtual void Report(const std::string &message)
Definition object.cpp:78
virtual void SetRotation(const Vector3 &rotation)
Definition object.cpp:332
virtual void Move(const Vector3 &vector, Real speed=1.0)
Definition object.cpp:253
virtual void SetPositionY(Real value)
Definition object.cpp:313
virtual Vector3 GetPosition(bool relative=false)
Definition object.cpp:321
void SetPositionRelative(const Vector3 &position)
Definition object.cpp:287
const std::string & GetType()
Definition object.cpp:177
virtual void Rotate(const Vector3 &vector, Real speed=1.0)
Definition object.cpp:353
virtual void SetPosition(const Vector3 &position)
Definition object.cpp:274
bool always_visible
Definition primitive.h:33
void SetTexture(const std::string &texture)
bool Attach(const std::string &meshname, const Vector3 &position, const Vector3 &rotation, Real max_render_distance=0, Real scale_multiplier=1, bool enable_physics=false, Real restitution=0, Real friction=0, Real mass=0)
Action * AddAction(const std::string &name, std::vector< Object * > &action_parents, const std::string &command, const std::vector< std::string > &parameters)
Definition sbs.cpp:3413
Shaft * GetShaft(int number)
Definition sbs.cpp:1753
Reverb * AddReverb(const std::string &name, const std::string &type, const Vector3 &position, Real min_distance, Real max_distance)
Definition sbs.cpp:2324
void ListVisibleMeshes()
Definition sbs.cpp:3992
Light * GetLight(std::string name)
Definition sbs.cpp:4437
bool Mount(const std::string &filename, const std::string &path)
Definition sbs.cpp:2174
Shaft * CreateShaft(int number, Real CenterX, Real CenterZ, int startfloor, int endfloor)
Definition sbs.cpp:1661
bool RemoveActionParent(const std::string &name, std::vector< Object * > &parents)
Definition sbs.cpp:3479
Sound * AddSound(const std::string &name, const std::string &filename, const Vector3 &position, bool loop=true, Real volume=1.0, int speed=100, Real min_distance=1.0, Real max_distance=-1.0, Real doppler_level=0.0, Real cone_inside_angle=360, Real cone_outside_angle=360, Real cone_outside_volume=1.0, const Vector3 &direction=Vector3(0, 0, 0))
Definition sbs.cpp:2265
CustomObject * GetCustomObject(std::string name)
Definition sbs.cpp:4482
void AddFloorAutoArea(Vector3 start, Vector3 end)
Definition sbs.cpp:2193
Wall * AddFloor(MeshObject *mesh, const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real altitude1, Real altitude2, bool reverse_axis, bool texture_direction, Real tw, Real th, bool legacy_behavior=false)
Definition sbs.cpp:1912
Floor * GetFloor(int number)
Definition sbs.cpp:1739
Utility * GetUtility()
Definition sbs.cpp:4611
bool RunAction(const std::string &name)
Definition sbs.cpp:3867
Stairwell * GetStairwell(int number)
Definition sbs.cpp:1760
TextureManager * GetTextureManager()
Definition sbs.cpp:4558
Camera * camera
Definition sbs.h:160
Wall * AddCustomFloor(MeshObject *mesh, const std::string &name, const std::string &texture, std::vector< Vector2 > &varray, Real altitude, Real tw, Real th)
Definition sbs.cpp:1444
Wall * CreateWallBox2(MeshObject *mesh, const std::string &name, const std::string &texture, Real CenterX, Real CenterZ, Real WidthX, Real LengthZ, Real height_in, Real voffset, Real tw, Real th, bool inside=true, bool outside=true, bool top=true, bool bottom=true, bool autosize=true)
Definition sbs.cpp:1369
Primitive * AddPrimitive(const std::string &name)
Definition sbs.cpp:3184
Object * GetObjectOfParent(std::string parent_name, std::string name, const std::string &type, bool case_sensitive=true)
Definition sbs.cpp:3728
Wall * AddCustomWall(MeshObject *mesh, const std::string &name, const std::string &texture, PolyArray &varray, Real tw, Real th)
Definition sbs.cpp:1428
Model * AddModel(const std::string &name, const std::string &filename, bool center, const Vector3 &position, const Vector3 &rotation, Real max_render_distance=0, Real scale_multiplier=1, bool enable_physics=false, Real restitution=0, Real friction=0, Real mass=0)
Definition sbs.cpp:3155
Primitive * GetPrimitive(std::string name)
Definition sbs.cpp:4467
Wall * AddTriangleWall(MeshObject *mesh, const std::string &name, const std::string &texture, Real x1, Real y1, Real z1, Real x2, Real y2, Real z2, Real x3, Real y3, Real z3, Real tw, Real th)
Definition sbs.cpp:1460
int GetStairwellCount()
Definition sbs.cpp:1727
bool AddActionParent(const std::string &name, std::vector< Object * > &parents)
Definition sbs.cpp:3460
Wall * AddWall(MeshObject *mesh, const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real height_in1, Real height_in2, Real altitude1, Real altitude2, Real tw, Real th)
Definition sbs.cpp:1899
Trigger * AddTrigger(const std::string &name, const std::string &sound_file, const Vector3 &area_min, const Vector3 &area_max, std::vector< std::string > &action_names)
Definition sbs.cpp:3405
GeometryController * GetGeometry()
Definition sbs.cpp:4616
CustomObject * AddCustomObject(const std::string &name, const Vector3 &position, const Vector3 &rotation, Real max_render_distance=0, Real scale_multiplier=1)
Definition sbs.cpp:3208
bool SetWallOrientation(std::string direction)
Definition sbs.cpp:1781
bool SetFloorOrientation(std::string direction)
Definition sbs.cpp:1807
void AddPolygon(Wall *wallobject, const std::string &texture, PolyArray &varray, Real tw, Real th)
Definition sbs.cpp:1381
void DrawWalls(bool MainN, bool MainP, bool SideN, bool SideP, bool Top, bool Bottom)
Definition sbs.cpp:1833
int Floors
Definition sbs.h:158
SoundSystem * GetSoundSystem()
Definition sbs.cpp:4518
Wall * AddGround(const std::string &name, const std::string &texture, Real x1, Real z1, Real x2, Real z2, Real altitude, int tile_x, int tile_z)
Definition sbs.cpp:1925
int GetShaftCount()
Definition sbs.cpp:1721
Object * GetObject(int number)
Definition sbs.cpp:2452
Wall * CreateWallBox(MeshObject *mesh, const std::string &name, const std::string &texture, Real x1, Real x2, Real z1, Real z2, Real height_in, Real voffset, Real tw, Real th, bool inside=true, bool outside=true, bool top=true, bool bottom=true, bool autosize=true)
Definition sbs.cpp:1162
Stairwell * CreateStairwell(int number, Real CenterX, Real CenterZ, int startfloor, int endfloor)
Definition sbs.cpp:1668
Light * AddLight(const std::string &name, int type)
Definition sbs.cpp:3118
std::vector< Object * > GetObjectRange(const std::string &expression)
Definition sbs.cpp:3776
bool DeleteObject(Object *object)
Definition sbs.cpp:2567
void ShowFloorList()
Definition sbs.cpp:3956
Control * AddControl(const std::string &name, const std::string &sound, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, int selection_position, std::vector< std::string > &action_names, std::vector< std::string > &textures)
Definition sbs.cpp:3395
bool Verbose
Definition sbs.h:186
Door * GetDoor(const std::string &name)
Definition shaft.cpp:1315
Primitive * GetPrimitive(std::string name)
Definition shaft.cpp:1194
CustomObject * AddCustomObject(const std::string &name, const Vector3 &position, const Vector3 &rotation, Real max_render_distance=0, Real scale_multiplier=1)
Definition shaft.cpp:1128
CustomObject * GetCustomObject(std::string name)
Definition shaft.cpp:1209
Primitive * AddPrimitive(const std::string &name)
Definition shaft.cpp:1104
Door * AddDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool open_state, const std::string &texture, const std::string &side_texture, Real thickness, const std::string &face_direction, const std::string &open_direction, bool rotate, Real open_speed, Real close_speed, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th)
Definition shaft.cpp:1241
Light * AddLight(const std::string &name, int type)
Definition shaft.cpp:1055
Light * GetLight(const std::string &name)
Definition shaft.cpp:1064
Door * CreateDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool rotate)
Definition shaft.cpp:1301
CameraTexture * AddCameraTexture(const std::string &name, int quality, Real fov, const Vector3 &position, bool use_rotation, const Vector3 &rotation)
Definition shaft.cpp:1338
void AddShowInterfloor(int floor)
Definition shaft.cpp:396
void CutFloors(bool relative, const Vector2 &start, const Vector2 &end, Real startvoffset, Real endvoffset)
Definition shaft.cpp:208
bool ShowOutside
Definition shaft.h:45
void SetShowFull(bool value)
Definition shaft.cpp:664
int ShowFloors
Definition shaft.h:44
bool ShowInterfloors
Definition shaft.h:46
void AddShowFloor(int floor)
Definition shaft.cpp:322
void AddShowOutside(int floor)
Definition shaft.cpp:359
void ShowPlayingSounds(bool verbose=true)
Primitive * GetPrimitive(std::string name)
Definition stairs.cpp:1202
CustomObject * GetCustomObject(std::string name)
Definition stairs.cpp:1217
Primitive * AddPrimitive(const std::string &name)
Definition stairs.cpp:1111
Light * GetLight(const std::string &name)
Definition stairs.cpp:1064
Door * AddDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool open_state, const std::string &texture, const std::string &side_texture, Real thickness, const std::string &face_direction, const std::string &open_direction, bool rotate, Real open_speed, Real close_speed, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th)
Definition stairs.cpp:839
CameraTexture * AddCameraTexture(const std::string &name, int quality, Real fov, const Vector3 &position, bool use_rotation, const Vector3 &rotation)
Definition stairs.cpp:1249
CustomObject * AddCustomObject(const std::string &name, const Vector3 &position, const Vector3 &rotation, Real max_render_distance=0, Real scale_multiplier=1)
Definition stairs.cpp:1135
Light * AddLight(const std::string &name, int type)
Definition stairs.cpp:1055
Door * CreateDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool rotate)
Definition stairs.cpp:899
Door * GetDoor(const std::string &name)
Definition stairs.cpp:913
bool ShowFloors
Definition stairs.h:41
void CutFloors(bool relative, const Vector2 &start, const Vector2 &end, Real startvoffset, Real endvoffset)
Definition stairs.cpp:225
void AddShowFloor(int floor)
Definition stairs.cpp:367
void SetShowFull(int value)
Definition stairs.cpp:122
Vector2 GetEndPoint(const Vector2 &StartPoint, Real angle, Real distance)
Definition utility.cpp:490
void Report(const std::string &message)
CommandsSection(ScriptProcessor *parent)
Definition commands.cpp:56
static const int sNextLine
Definition scriptproc.h:70
static const int sContinue
Definition scriptproc.h:69
static const int sError
Definition scriptproc.h:71
int ScriptWarning(std::string message)
static const int sCheckFloors
Definition scriptproc.h:72
void StoreCommand(::SBS::Object *object)
std::string Calc(const std::string &expression)
static const int sSkipReset
Definition scriptproc.h:75
Ogre::Vector3 Vector3
Definition globals.h:58
Ogre::Real Real
Definition globals.h:57
Ogre::Vector2 Vector2
Definition globals.h:59
std::vector< Vector3 > PolyArray
Definition sbs.h:118
bool IsBoolean(std::string string)
Definition globals.cpp:391
bool StartsWithNoCase(const std::string &string, const std::string &check_string)
Definition globals.cpp:237
void SplitString(std::vector< std::string > &dest_array, const std::string &original_string, char separator)
Definition globals.cpp:242
int ToInt(const std::string &string)
Definition globals.cpp:402
void SetCase(std::string &string, bool uppercase)
Definition globals.cpp:172
std::string ToString(int number)
Definition globals.cpp:279
std::string SetCaseCopy(std::string string, bool uppercase)
Definition globals.cpp:165
Real ToFloat(const std::string &string)
Definition globals.cpp:397
void TrimString(std::string &string)
Definition globals.cpp:188
bool ToBool(std::string string)
Definition globals.cpp:407
bool IsEven(int Number)
Definition globals.cpp:37
bool IsNumeric(const wxString &string)