Skyscraper 2.0
floor.cpp
Go to the documentation of this file.
1/*
2 Scalable Building Simulator - Floor Object
3 The Skyscraper Project - Version 2.0
4 Copyright (C)2004-2024 Ryan Thoryk
5 https://www.skyscrapersim.net
6 https://sourceforge.net/projects/skyscraper/
7 Contact - ryan@skyscrapersim.net
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22*/
23
24#include "globals.h"
25#include "sbs.h"
26#include "manager.h"
27#include "dynamicmesh.h"
28#include "mesh.h"
29#include "elevator.h"
30#include "elevatorcar.h"
31#include "shaft.h"
32#include "stairs.h"
33#include "door.h"
34#include "model.h"
35#include "primitive.h"
36#include "custom.h"
37#include "light.h"
38#include "camera.h"
39#include "route.h"
40#include "escalator.h"
41#include "cameratexture.h"
42#include "callstation.h"
43#include "control.h"
44#include "trigger.h"
45#include "floorindicator.h"
46#include "directional.h"
47#include "sound.h"
48#include "profiler.h"
49#include "revolvingdoor.h"
50#include "movingwalkway.h"
51#include "controller.h"
52#include "utility.h"
53#include "reverb.h"
54#include "floor.h"
55
56namespace SBS {
57
58Floor::Floor(Object *parent, FloorManager *manager, int number) : Object(parent)
59{
60 //set up SBS object
61 SetValues("Floor", "", false);
62
63 //Set floor's object number
64 Number = number;
65 std::string num = ToString(Number);
66 SetName("Floor " + num);
67
68 //Create primary level mesh
69 Level = new MeshObject(this, "Level " + num, manager->GetFloorDynMesh());
70
71 //Create interfloor mesh
72 Interfloor = new MeshObject(this, "Interfloor " + num, manager->GetIFloorDynMesh());
73
74 //Create columnframe mesh
75 ColumnFrame = new MeshObject(this, "ColumnFrame " + num, manager->GetColumnDynMesh());
76
77 //set enabled flags
78 IsEnabled = true;
81
82 //init other variables
83 Name = "";
84 ID = "";
85 NumberID = "";
86 FloorType = "";
87 Description = "";
89 Altitude = 0;
90 Height = 0;
92 EnabledGroup = false;
94 AltitudeSet = false;
95
96 //create a dynamic mesh for doors
97 DoorWrapper = new DynamicMesh(this, GetSceneNode(), GetName() + " Door Container", 0, true);
98 DoorWrapper->force_combine = true;
99}
100
102{
103 //Destructor
104
105 //delete moving walkways
106 for (size_t i = 0; i < MovingWalkwayArray.size(); i++)
107 {
108 if (MovingWalkwayArray[i])
109 {
111 delete MovingWalkwayArray[i];
112 }
113 MovingWalkwayArray[i] = 0;
114 }
115
116 //delete escalators
117 for (size_t i = 0; i < EscalatorArray.size(); i++)
118 {
119 if (EscalatorArray[i])
120 {
121 EscalatorArray[i]->parent_deleting = true;
122 delete EscalatorArray[i];
123 }
124 EscalatorArray[i] = 0;
125 }
126
127 //delete camera textures
128 for (size_t i = 0; i < CameraTextureArray.size(); i++)
129 {
130 if (CameraTextureArray[i])
131 {
132 CameraTextureArray[i]->parent_deleting = true;
133 delete CameraTextureArray[i];
134 }
135 CameraTextureArray[i] = 0;
136 }
137
138 //delete controls
139 for (size_t i = 0; i < ControlArray.size(); i++)
140 {
141 if (ControlArray[i])
142 {
143 ControlArray[i]->parent_deleting = true;
144 delete ControlArray[i];
145 }
146 ControlArray[i] = 0;
147 }
148
149 //delete triggers
150 for (size_t i = 0; i < TriggerArray.size(); i++)
151 {
152 if (TriggerArray[i])
153 {
154 TriggerArray[i]->parent_deleting = true;
155 delete TriggerArray[i];
156 }
157 TriggerArray[i] = 0;
158 }
159
160 //delete models
161 for (size_t i = 0; i < ModelArray.size(); i++)
162 {
163 if (ModelArray[i])
164 {
165 ModelArray[i]->parent_deleting = true;
166 delete ModelArray[i];
167 }
168 ModelArray[i] = 0;
169 }
170
171 //delete primitives
172 for (size_t i = 0; i < PrimArray.size(); i++)
173 {
174 if (PrimArray[i])
175 {
176 PrimArray[i]->parent_deleting = true;
177 delete PrimArray[i];
178 }
179 PrimArray[i] = 0;
180 }
181
182 //delete custom objects
183 for (size_t i = 0; i < CustomObjectArray.size(); i++)
184 {
185 if (CustomObjectArray[i])
186 {
187 CustomObjectArray[i]->parent_deleting = true;
188 delete CustomObjectArray[i];
189 }
190 CustomObjectArray[i] = 0;
191 }
192
193 //delete lights
194 for (size_t i = 0; i < lights.size(); i++)
195 {
196 if (lights[i])
197 {
198 lights[i]->parent_deleting = true;
199 delete lights[i];
200 }
201 lights[i] = 0;
202 }
203
204 //delete call stations
205 for (size_t i = 0; i < CallStationArray.size(); i++)
206 {
207 if (CallStationArray[i])
208 {
209 CallStationArray[i]->parent_deleting = true;
210 delete CallStationArray[i];
211 }
212 CallStationArray[i] = 0;
213 }
214
215 //delete doors
216 for (size_t i = 0; i < DoorArray.size(); i++)
217 {
218 if (DoorArray[i])
219 {
220 DoorArray[i]->parent_deleting = true;
221 delete DoorArray[i];
222 }
223 DoorArray[i] = 0;
224 }
225
226 //delete revolving doors
227 for (size_t i = 0; i < RDoorArray.size(); i++)
228 {
229 if (RDoorArray[i])
230 {
231 RDoorArray[i]->parent_deleting = true;
232 delete RDoorArray[i];
233 }
234 RDoorArray[i] = 0;
235 }
236
237 if (DoorWrapper)
238 delete DoorWrapper;
239 DoorWrapper = 0;
240
241 //delete floor indicators
242 for (size_t i = 0; i < FloorIndicatorArray.size(); i++)
243 {
244 if (FloorIndicatorArray[i])
245 {
247 delete FloorIndicatorArray[i];
248 }
249 FloorIndicatorArray[i] = 0;
250 }
251
252 //delete directional indicators
253 for (size_t i = 0; i < DirIndicatorArray.size(); i++)
254 {
255 if (DirIndicatorArray[i])
256 {
257 DirIndicatorArray[i]->parent_deleting = true;
258 delete DirIndicatorArray[i];
259 }
260 DirIndicatorArray[i] = 0;
261 }
262
263 //delete sounds
264 for (size_t i = 0; i < sounds.size(); i++)
265 {
266 if (sounds[i])
267 {
268 sounds[i]->parent_deleting = true;
269 delete sounds[i];
270 }
271 sounds[i] = 0;
272 }
273
274 //delete reverbs
275 for (size_t i = 0; i < reverbs.size(); i++)
276 {
277 if (reverbs[i])
278 {
279 reverbs[i]->parent_deleting = true;
280 delete reverbs[i];
281 }
282 reverbs[i] = 0;
283 }
284
285 //delete meshes
286 if (Level)
287 {
288 Level->parent_deleting = true;
289 delete Level;
290 }
291 Level = 0;
292
293 if (Interfloor)
294 {
296 delete Interfloor;
297 }
298 Interfloor = 0;
299
300 if (ColumnFrame)
301 {
303 delete ColumnFrame;
304 }
305 ColumnFrame = 0;
306
307 //delete walls in external mesh
308 if (sbs->FastDelete == false && sbs->External)
309 sbs->External->DeleteWalls(this);
310
311 //unregister from parent
312 if (sbs->FastDelete == false && parent_deleting == false)
313 sbs->RemoveFloor(this);
314}
315
316Wall* Floor::AddFloor(const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real voffset1, Real voffset2, bool reverse_axis, bool texture_direction, Real tw, Real th, bool isexternal, bool legacy_behavior)
317{
318 //Adds a floor with the specified dimensions and vertical offset
319
320 Wall *wall = 0;
321
322 if (isexternal == false)
323 {
324 wall = Level->CreateWallObject(name);
325 sbs->AddFloorMain(wall, name, texture, thickness, x1, z1, x2, z2, GetBase(true) + voffset1, GetBase(true) + voffset2, reverse_axis, texture_direction, tw, th, true, legacy_behavior);
326 }
327 else
328 {
329 if (sbs->External)
330 {
331 wall = sbs->External->CreateWallObject(name);
332 sbs->AddFloorMain(wall, name, texture, thickness, x1, z1, x2, z2, Altitude + voffset1, Altitude + voffset2, reverse_axis, texture_direction, tw, th, true, legacy_behavior);
333 }
334 }
335 return wall;
336}
337
338Wall* Floor::AddInterfloorFloor(const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real voffset1, Real voffset2, bool reverse_axis, bool texture_direction, Real tw, Real th, bool legacy_behavior)
339{
340 //Adds an interfloor floor with the specified dimensions and vertical offset
341
342 Wall *wall = Interfloor->CreateWallObject(name);
343 sbs->AddFloorMain(wall, name, texture, thickness, x1, z1, x2, z2, voffset1, voffset2, reverse_axis, texture_direction, tw, th, true, legacy_behavior);
344 return wall;
345}
346
347Wall* Floor::AddWall(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 voffset1, Real voffset2, Real tw, Real th, bool isexternal)
348{
349 //Adds a wall with the specified dimensions
350
351 Wall *wall = 0;
352 if (isexternal == false)
353 {
354 wall = Level->CreateWallObject(name);
355 sbs->AddWallMain(wall, name, texture, thickness, x1, z1, x2, z2, height_in1, height_in2, GetBase(true) + voffset1, GetBase(true) + voffset2, tw, th, true);
356 }
357 else
358 {
359 if (sbs->External)
360 {
361 wall = sbs->External->CreateWallObject(name);
362 sbs->AddWallMain(wall, name, texture, thickness, x1, z1, x2, z2, height_in1, height_in2, Altitude + voffset1, Altitude + voffset2, tw, th, true);
363 }
364 }
365 return wall;
366}
367
368Wall* Floor::AddInterfloorWall(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 voffset1, Real voffset2, Real tw, Real th)
369{
370 //Adds an interfloor wall with the specified dimensions
371
372 Wall *wall = Interfloor->CreateWallObject(name);
373 sbs->AddWallMain(wall, name, texture, thickness, x1, z1, x2, z2, height_in1, height_in2, voffset1, voffset2, tw, th, true);
374 return wall;
375}
376
377void Floor::Enabled(bool value)
378{
379 //turns floor on/off
380
381 if (IsEnabled == value)
382 return;
383
384 SBS_PROFILE("Floor::Enabled");
385 Level->Enabled(value);
386 IsEnabled = value;
387
388 EnableLoop(value);
389
390 if (sbs->Verbose)
391 {
392 if (value == true)
393 Report("Enabled");
394 else
395 Report("Disabled");
396 }
397
398 //handle interfloors
399 if (value == false)
400 {
401 if (sbs->InterfloorOnTop == false)
402 {
403 //only turn off interfloor if floor below is disabled
404 Floor *floor = sbs->GetFloor(Number - 1);
405 if (floor)
406 {
407 if (floor->IsEnabled == false)
408 EnableInterfloor(false);
409 }
410 else
411 EnableInterfloor(false);
412
413 //turn off adjacent interfloor
414 floor = sbs->GetFloor(Number + 1);
415 if (floor)
416 {
417 if (floor->IsEnabled == false)
418 floor->EnableInterfloor(false);
419 }
420 }
421 else
422 {
423 //only turn off interfloor if floor above is disabled
424 Floor *floor = sbs->GetFloor(Number + 1);
425 if (floor)
426 {
427 if (floor->IsEnabled == false)
428 EnableInterfloor(false);
429 }
430 else
431 EnableInterfloor(false);
432
433 //turn off adjacent interfloor
434 floor = sbs->GetFloor(Number - 1);
435 if (floor)
436 {
437 if (floor->IsEnabled == false)
438 floor->EnableInterfloor(false);
439 }
440 }
441 }
442 else
443 {
444 if (sbs->InterfloorOnTop == false)
445 {
446 //turn on interfloor for next floor
447 if (sbs->GetFloor(Number + 1))
448 sbs->GetFloor(Number + 1)->EnableInterfloor(true);
449 }
450 else
451 {
452 //turn on interfloor for previous floor
453 if (sbs->GetFloor(Number - 1))
454 sbs->GetFloor(Number - 1)->EnableInterfloor(true);
455 }
456 EnableInterfloor(true);
457 }
458
459 EnableColumnFrame(value);
460
461 //controls
462 for (size_t i = 0; i < ControlArray.size(); i++)
463 {
464 if (ControlArray[i])
465 ControlArray[i]->Enabled(value);
466 }
467
468 //triggers
469 for (size_t i = 0; i < TriggerArray.size(); i++)
470 {
471 if (TriggerArray[i])
472 TriggerArray[i]->Enabled(value);
473 }
474
475 //models
476 for (size_t i = 0; i < ModelArray.size(); i++)
477 {
478 if (ModelArray[i])
479 ModelArray[i]->Enabled(value);
480 }
481
482 //primitives
483 for (size_t i = 0; i < PrimArray.size(); i++)
484 {
485 if (PrimArray[i])
486 PrimArray[i]->Enabled(value);
487 }
488
489 //custom objects
490 for (size_t i = 0; i < CustomObjectArray.size(); i++)
491 {
492 if (CustomObjectArray[i])
493 CustomObjectArray[i]->Enabled(value);
494 }
495
496 //call stations
497 for (size_t i = 0; i < CallStationArray.size(); i++)
498 {
499 if (CallStationArray[i])
500 CallStationArray[i]->Enabled(value);
501 }
502
503 //doors
504 for (size_t i = 0; i < DoorArray.size(); i++)
505 {
506 if (DoorArray[i])
507 DoorArray[i]->Enabled(value);
508 }
509 DoorWrapper->Enabled(value);
510
511 //turn on/off directional indicators
512 for (size_t i = 0; i < DirIndicatorArray.size(); i++)
513 {
514 if (DirIndicatorArray[i])
515 DirIndicatorArray[i]->Enabled(value);
516 }
518
519 //floor indicators
520 for (size_t i = 0; i < FloorIndicatorArray.size(); i++)
521 {
522 if (FloorIndicatorArray[i])
523 FloorIndicatorArray[i]->Enabled(value);
524 }
525 //update floor indicator values
527
528 //escalators
529 for (size_t i = 0; i < EscalatorArray.size(); i++)
530 {
531 if (EscalatorArray[i])
532 EscalatorArray[i]->Enabled(value);
533 }
534
535 //moving walkways
536 for (size_t i = 0; i < MovingWalkwayArray.size(); i++)
537 {
538 if (MovingWalkwayArray[i])
539 MovingWalkwayArray[i]->Enabled(value);
540 }
541
542 //sounds
543 for (size_t i = 0; i < sounds.size(); i++)
544 {
545 if (sounds[i])
546 {
547 if (sounds[i]->GetLoopState() == true)
548 {
549 if (value == false)
550 sounds[i]->Stop();
551 else
552 sounds[i]->Play();
553 }
554 }
555 }
556
557 //reverbs
558 for (size_t i = 0; i < reverbs.size(); i++)
559 {
560 if (reverbs[i])
561 reverbs[i]->Enabled(value);
562 }
563
564 //lights
565 for (size_t i = 0; i < lights.size(); i++)
566 {
567 if (lights[i])
568 lights[i]->Enabled(value);
569 }
570}
571
573{
574 //calculate full height of a floor
575 return InterfloorHeight + Height;
576}
577
578CallStation* Floor::AddCallButtons(int controller, const std::string &sound_file_up, const std::string &sound_file_down, const std::string &BackTexture, const std::string &UpButtonTexture, const std::string &UpButtonTexture_Lit, const std::string &DownButtonTexture, const std::string &DownButtonTexture_Lit, Real CenterX, Real CenterZ, Real voffset, const std::string &direction, Real BackWidth, Real BackHeight, bool ShowBack, Real tw, Real th)
579{
580 //create call buttons
581
582 //make sure the controller serves this floor before proceeding
583 if (sbs->GetController(controller))
584 {
585 if (sbs->GetController(controller)->ServesFloor(Number) == false)
586 return 0;
587 }
588
590 station->SetController(controller);
591 station->CreateCallButtons(sound_file_up, sound_file_down, BackTexture, UpButtonTexture, UpButtonTexture_Lit, DownButtonTexture, DownButtonTexture_Lit, direction, BackWidth, BackHeight, ShowBack, tw, th);
592
593 station->Move(CenterX, GetBase(true) + voffset, CenterZ);
594
595 return station;
596}
597
599{
600 //create a new call station object
601
602 CallStation *station = new CallStation(this, Number, number);
603 CallStationArray.emplace_back(station);
604 return station;
605}
606
607void Floor::Cut(const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, bool fast, int checkwallnumber, bool prepare)
608{
609 //caller to SBS cut function
610 //Y values are relative to the floor's altitude
611 //if fast is specified, skips the interfloor scan
612
613 for (size_t i = 0; i < Level->Walls.size(); i++)
614 {
615 if (!Level->Walls[i])
616 continue;
617
618 bool reset = true;
619 if (i > 0)
620 reset = false;
621
622 sbs->GetUtility()->Cut(Level->Walls[i], Vector3(start.x, start.y, start.z), Vector3(end.x, end.y, end.z), cutwalls, cutfloors, checkwallnumber, reset);
623 }
624 if (fast == false)
625 {
626 for (size_t i = 0; i < Interfloor->Walls.size(); i++)
627 {
628 if (!Interfloor->Walls[i])
629 continue;
630
631 sbs->GetUtility()->Cut(Interfloor->Walls[i], Vector3(start.x, start.y, start.z), Vector3(end.x, end.y, end.z), cutwalls, cutfloors, checkwallnumber, false);
632 }
633 }
634}
635
636void Floor::CutAll(const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, bool prepare)
637{
638 //cuts all objects related to this floor (floor, interfloor, shafts, stairs and external)
639 //Y values are relative to the floor's altitude
640
641 //cut current level
642 Cut(start, end, cutwalls, cutfloors, false);
643
644 //cut shafts
645 for (int i = 1; i <= sbs->GetShaftCount(); i++)
646 {
647 if (sbs->GetShaft(i))
648 {
649 if (sbs->GetShaft(i)->GetLevel(Number))
650 sbs->GetShaft(i)->GetLevel(Number)->Cut(false, start, end, cutwalls, cutfloors);
651 }
652 }
653
654 Vector3 offset (0, GetBase(true), 0);
655
656 //cut stairs
657 for (int i = 1; i <= sbs->GetStairwellCount(); i++)
658 {
659 if (sbs->GetStairwell(i))
660 {
662 sbs->GetStairwell(i)->GetLevel(Number)->Cut(false, start - offset, end - offset, cutwalls, cutfloors);
663 }
664 }
665
666 //cut external
667 if (sbs->External)
668 {
669 for (size_t i = 0; i < sbs->External->Walls.size(); i++)
670 {
671 if (!sbs->External->Walls[i])
672 continue;
673
674 sbs->GetUtility()->Cut(sbs->External->Walls[i], Vector3(start.x, Altitude + start.y, start.z), Vector3(end.x, Altitude + end.y, end.z), cutwalls, cutfloors);
675 }
676 }
677}
678
679void Floor::AddGroupFloor(int number)
680{
681 //adds a floor number to the group list.
682 //Groups are used to enable multiple floors at the same time when
683 //a user arrives at a floor
684
685 if (IsInGroup(number))
686 return;
687
688 Group.emplace_back(number);
689 std::sort(Group.begin(), Group.end());
690}
691
693{
694 //removes a floor number from the group list
695
696 for (size_t i = 0; i < Group.size(); i++)
697 {
698 if (Group[i] == number)
699 {
700 Group.erase(Group.begin() + i);
701 return;
702 }
703 }
704}
705
706void Floor::EnableGroup(bool value)
707{
708 //enable floors grouped with this floor
709
710 SBS_PROFILE("Floor::EnableGroup");
711 if (Group.size() > 0)
712 {
713 for (size_t i = 0; i < Group.size(); i++)
714 {
715 Floor *floor = sbs->GetFloor(Group[i]);
716
717 //check if floor exists
718 if (floor)
719 {
720 //enable other floor
721 floor->Enabled(value);
722
723 if (value == true)
724 {
725 floor->EnabledGroup = true;
726 floor->EnabledGroup_Floor = Number;
727 }
728 else
729 {
730 floor->EnabledGroup = false;
731 floor->EnabledGroup_Floor = 0;
732 }
733
734 //enable shafts and stairs for other floor
735 for (int j = 1; j <= sbs->GetShaftCount(); j++)
736 {
737 Shaft *shaft = sbs->GetShaft(j);
738 if (shaft)
739 {
740 if (shaft->IsEnabled == false)
741 {
742 if (shaft->GetLevel(Group[i]))
743 shaft->GetLevel(Group[i])->Enabled(value, true);
744 }
745 }
746 }
747 for (int j = 1; j <= sbs->GetStairwellCount(); j++)
748 {
749 Stairwell *stairs = sbs->GetStairwell(j);
750 if (stairs)
751 {
752 if (stairs->IsEnabled == false)
753 {
754 if (stairs->GetLevel(Group[i]))
755 stairs->GetLevel(Group[i])->Enabled(value);
756 }
757 }
758 }
759 }
760 }
761 }
762}
763
764bool Floor::IsInGroup(int floor)
765{
766 //return true if the specified floor is in the group listing
767
768 if (Group.size() > 0)
769 {
770 for (size_t i = 0; i < Group.size(); i++)
771 {
772 if (Group[i] == floor)
773 return true;
774 }
775 }
776 return false;
777}
778
779Door* Floor::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)
780{
781 //add a door to the floor
782
783 //set up coordinates
784 Real x1, z1, x2, z2;
785 if (face_direction == "left" || face_direction == "right")
786 {
787 x1 = CenterX;
788 x2 = CenterX;
789 z1 = CenterZ - (width / 2);
790 z2 = CenterZ + (width / 2);
791 }
792 else
793 {
794 x1 = CenterX - (width / 2);
795 x2 = CenterX + (width / 2);
796 z1 = CenterZ;
797 z2 = CenterZ;
798 }
799
800 Real base = 0.0;
801 if (external == false)
802 base = GetBase(true);
803
804 //cut area
805 if (face_direction == "left" || face_direction == "right")
806 CutAll(Vector3(x1 - 1, base + voffset, z1), Vector3(x2 + 1, base + voffset + height, z2), true, false);
807 else
808 CutAll(Vector3(x1, base + voffset, z1 - 1), Vector3(x2, base + voffset + height, z2 + 1), true, false);
809
810 //create an external (global) door if specified
811 if (external == true)
812 return sbs->GetDoorManager()->AddDoor(name, open_sound, close_sound, open_state, texture, side_texture, thickness, face_direction, open_direction, rotate, open_speed, close_speed, CenterX, CenterZ, width, height, Altitude + voffset, tw, th, side_tw, side_th);
813
814 int number = (int)DoorArray.size();
815 if (name == "")
816 name = "Door " + ToString(number);
817
818 Door* door = new Door(this, DoorWrapper, name, open_sound, close_sound, rotate);
819 door->CreateDoor(open_state, texture, side_texture, thickness, face_direction, open_direction, open_speed, close_speed, CenterX, CenterZ, width, height, base + voffset, tw, th, side_tw, side_th);
820 DoorArray.emplace_back(door);
821 return door;
822}
823
824Door* Floor::CreateDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool rotate)
825{
826 //start creation of a manual door
827 //since the door is unfinished, AddDoorComponent and FinishDoor need to be run on the returned Door object
828
829 int number = (int)DoorArray.size();
830 if (name == "")
831 name = "Door " + ToString(number);
832
833 Door* door = new Door(this, DoorWrapper, name, open_sound, close_sound, rotate);
834 DoorArray.emplace_back(door);
835 door->Move(0, GetBase(true), 0);
836 return door;
837}
838
840{
841 //calculate the floor's altitude in relation to floor below (or above it, if it's a basement level)
842 //and return the altitude value
843
844 //floors 0 or -1 can be created first.
845 //if any of the other floors don't have an adjacent floor, return false
846
847 if (Altitude == 0)
848 {
849 if (Number >= 0)
850 {
851 if (sbs->GetFloor(Number - 1))
853 else if (Number != 0)
854 return ReportError("Invalid floor number specified - no adjacent floor");
855 }
856 else
857 {
858 if (sbs->GetFloor(Number + 1))
860 else
861 {
862 if (Number == -1)
863 Altitude = -FullHeight();
864 else
865 return ReportError("Invalid floor number specified - no adjacent floor");
866 }
867 }
868 }
869
870 //set altitude
872
873 return true;
874}
875
877{
878 //enable/disable columnframe mesh
879 ColumnFrame->Enabled(value);
880 IsColumnFrameEnabled = value;
881}
882
884{
885 //enable/disable interfloor mesh
886 Interfloor->Enabled(value);
887 IsInterfloorEnabled = value;
888}
889
890Wall* Floor::ColumnWallBox(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, bool outside, bool top, bool bottom)
891{
892 //create columnframe wall box
893
894 return sbs->CreateWallBox(ColumnFrame, name, texture, x1, x2, z1, z2, height_in, voffset, tw, th, inside, outside, top, bottom, true);
895}
896
897Wall* Floor::ColumnWallBox2(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, bool outside, bool top, bool bottom)
898{
899 //create columnframe wall box from a central location
900
901 return sbs->CreateWallBox2(ColumnFrame, name, texture, CenterX, CenterZ, WidthX, LengthZ, height_in, voffset, tw, th, inside, outside, top, bottom, true);
902}
903
904FloorIndicator* Floor::AddFloorIndicator(int elevator, int car, bool relative, const std::string &texture_prefix, const std::string &blank_texture, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real height, Real voffset)
905{
906 //Creates a floor indicator at the specified location
907
908 if (relative == false)
909 {
910 FloorIndicator *ind = new FloorIndicator(this, FloorIndicatorArray.size(), elevator, car, texture_prefix, blank_texture, direction, CenterX, CenterZ, width, height, GetBase(true) + voffset);
911 FloorIndicatorArray.emplace_back(ind);
912 return ind;
913 }
914 else
915 {
916 Elevator* elev = sbs->GetElevator(elevator);
917 if (elev)
918 {
919 FloorIndicator *ind = new FloorIndicator(this, FloorIndicatorArray.size(), elevator, car, texture_prefix, blank_texture, direction, elev->GetPosition().x + CenterX, elev->GetPosition().z + CenterZ, width, height, GetBase(true) + voffset);
920 FloorIndicatorArray.emplace_back(ind);
921 return ind;
922 }
923 else
924 return 0;
925 }
926}
927
929{
930 //updates a floor indicator for a specified elevator
931
932 for (size_t i = 0; i < FloorIndicatorArray.size(); i++)
933 {
934 if (FloorIndicatorArray[i])
935 {
936 if (FloorIndicatorArray[i]->elev == elevator)
938 }
939 }
940}
941
943{
944 //updates all floor indicators
945
946 SBS_PROFILE("Floor::UpdateFloorIndicators");
947
948 for (size_t i = 0; i < FloorIndicatorArray.size(); i++)
949 {
950 if (FloorIndicatorArray[i])
951 FloorIndicatorArray[i]->Update();
952 }
953}
954
956{
957 //floor object main loop; runs if camera is currently on this floor
958
959 if (IsEnabled == false)
960 return;
961
962 SBS_PROFILE("Floor::Loop");
963
964 LoopChildren();
965}
966
967std::vector<int> Floor::GetCallStations(int elevator)
968{
969 //get numbers of call stations that service the specified elevator
970
971 std::vector<int> stations;
972 stations.reserve(CallStationArray.size());
973 for (size_t i = 0; i < CallStationArray.size(); i++)
974 {
975 //put station number onto the array if it serves the elevator
976 if (CallStationArray[i])
977 {
978 if (CallStationArray[i]->ServicesElevator(elevator) == true)
979 stations.emplace_back((int)i);
980 }
981 }
982 return stations;
983}
984
986{
987 //returns the first call button object that services the specified elevator
988
989 for (size_t i = 0; i < CallStationArray.size(); i++)
990 {
991 if (CallStationArray[i])
992 {
993 if (CallStationArray[i]->ServicesElevator(elevator) == true)
994 return CallStationArray[i];
995 }
996 }
997 return 0;
998}
999
1001{
1002 for (size_t i = 0; i < CallStationArray.size(); i++)
1003 {
1004 if (CallStationArray[i])
1005 {
1006 if (CallStationArray[i]->Number == number)
1007 return CallStationArray[i];
1008 }
1009 }
1010 return 0;
1011}
1012
1013void Floor::AddFillerWalls(const std::string &texture, Real thickness, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, bool direction, Real tw, Real th, bool isexternal)
1014{
1015 //convenience function for adding filler walls around doors
1016 //direction is either "false" for a door that faces left/right, or "true" for one that faces front/back
1017
1018 Real x1 = 0, x2 = 0, z1 = 0, z2 = 0, depth1 = 0, depth2 = 0;
1019
1020 //exit if no height given
1021 if (height == 0.0)
1022 {
1023 ReportError("AddFillerWalls: no wall height specified");
1024 return;
1025 }
1026
1027 if (sbs->GetWallOrientation() == 0)
1028 {
1029 depth1 = 0;
1030 depth2 = thickness;
1031 }
1032 if (sbs->GetWallOrientation() == 1)
1033 {
1034 depth1 = thickness / 2;
1035 depth2 = thickness / 2;
1036 }
1037 if (sbs->GetWallOrientation() == 2)
1038 {
1039 depth1 = thickness;
1040 depth2 = 0;
1041 }
1042
1043 if (direction == false)
1044 {
1045 //door faces left/right
1046 x1 = CenterX - depth1;
1047 x2 = CenterX + depth2;
1048 z1 = CenterZ - (width / 2);
1049 z2 = CenterZ + (width / 2);
1050 }
1051 else
1052 {
1053 //door faces front/back
1054 x1 = CenterX - (width / 2);
1055 x2 = CenterX + (width / 2);
1056 z1 = CenterZ - depth1;
1057 z2 = CenterZ + depth2;
1058 }
1059
1060 //perform a cut in the area
1061 if (isexternal == false)
1062 CutAll(Vector3(x1, GetBase(true) + voffset, z1), Vector3(x2, GetBase(true) + voffset + height, z2), true, false);
1063 else
1064 CutAll(Vector3(x1, voffset, z1), Vector3(x2, voffset + height, z2), true, false);
1065
1066 //create walls
1067 sbs->DrawWalls(false, true, false, false, false, false);
1068 if (direction == false)
1069 AddWall("FillerWallLeft", texture, 0, x1, z1, x2, z1, height, height, voffset, voffset, tw, th, isexternal);
1070 else
1071 AddWall("FillerWallLeft", texture, 0, x1, z1, x1, z2, height, height, voffset, voffset, tw, th, isexternal);
1072 sbs->ResetWalls();
1073
1074 sbs->DrawWalls(true, false, false, false, false, false);
1075 if (direction == false)
1076 AddWall("FillerWallRight", texture, 0, x1, z2, x2, z2, height, height, voffset, voffset, tw, th, isexternal);
1077 else
1078 AddWall("FillerWallRight", texture, 0, x2, z1, x2, z2, height, height, voffset, voffset, tw, th, isexternal);
1079
1080 AddFloor("FillerWallTop", texture, 0, x1, z1, x2, z2, height + voffset, height + voffset, false, false, tw, th, isexternal);
1081 sbs->ResetWalls();
1082}
1083
1084Sound* Floor::AddSound(const std::string &name, const std::string &filename, Vector3 position, bool loop, Real volume, int speed, Real min_distance, Real max_distance, Real doppler_level, Real cone_inside_angle, Real cone_outside_angle, Real cone_outside_volume, Vector3 direction)
1085{
1086 //create a looping sound object
1087
1088 Sound *sound = new Sound(this, name, false);
1089 sounds.emplace_back(sound);
1090
1091 //set parameters and play sound
1092 sound->Move(position.x, GetBase(true) + position.y, position.z);
1093 sound->SetDirection(direction);
1094 sound->SetVolume(volume);
1095 sound->SetSpeed(speed);
1096 sound->SetDistances(min_distance, max_distance);
1097 sound->SetDirection(direction);
1098 sound->SetDopplerLevel(doppler_level);
1099 sound->SetConeSettings(cone_inside_angle, cone_outside_angle, cone_outside_volume);
1100 sound->Load(filename);
1101 sound->SetLoopState(loop);
1102 if (loop && sbs->IsRunning == true && sbs->camera->CurrentFloor == Number)
1103 sound->Play();
1104
1105 return sound;
1106}
1107
1108std::vector<Sound*> Floor::GetSound(const std::string &name)
1109{
1110 //get sound by name
1111
1112 std::string findname = name;
1113 SetCase(findname, false);
1114 std::vector<Sound*> soundlist;
1115 for (size_t i = 0; i < sounds.size(); i++)
1116 {
1117 if (sounds[i])
1118 {
1119 std::string name2 = sounds[i]->GetName();
1120 SetCase(name2, false);
1121 if (findname == name2)
1122 soundlist.emplace_back(sounds[i]);
1123 }
1124 }
1125 return soundlist;
1126}
1127
1128void Floor::Report(const std::string &message)
1129{
1130 //general reporting function
1131 Object::Report("Floor " + ToString(Number) + ": " + message);
1132}
1133
1134bool Floor::ReportError(const std::string &message)
1135{
1136 //general reporting function
1137 return Object::ReportError("Floor " + ToString(Number) + ": " + message);
1138}
1139
1140Real Floor::GetBase(bool relative)
1141{
1142 //returns the base of the floor
1143 //if Interfloor is on the bottom of the level (by default), the base is GetBase()
1144 //otherwise the base is just altitude
1145 if (relative == false)
1146 {
1147 if (sbs->InterfloorOnTop == false)
1148 return Altitude + InterfloorHeight;
1149 else
1150 return Altitude;
1151 }
1152 else
1153 {
1154 if (sbs->InterfloorOnTop == false)
1155 return InterfloorHeight;
1156 else
1157 return 0;
1158 }
1159}
1160
1161DirectionalIndicator* Floor::AddDirectionalIndicator(int elevator, int car, bool relative, bool active_direction, bool single, bool vertical, const std::string &BackTexture, const std::string &uptexture, const std::string &uptexture_lit, const std::string &downtexture, const std::string &downtexture_lit, Real CenterX, Real CenterZ, Real voffset, const std::string &direction, Real BackWidth, Real BackHeight, bool ShowBack, Real tw, Real th)
1162{
1163 //create a directional indicator on the specified floor, associated with a given elevator
1164
1165 if (sbs->Verbose)
1166 Report("adding directional indicator");
1167
1168 Elevator *elev = sbs->GetElevator(elevator);
1169 if (!elev)
1170 return 0;
1171
1172 Real x, z;
1173 if (relative == true)
1174 {
1175 x = elev->GetPosition().x + CenterX;
1176 z = elev->GetPosition().z + CenterZ;
1177 }
1178 else
1179 {
1180 x = CenterX;
1181 z = CenterZ;
1182 }
1183
1184 if (active_direction == false)
1185 {
1186 //if active_direction is false, only create indicator if the elevator serves the floor
1187 if (elev->IsServicedFloor(Number) == false)
1188 return 0;
1189 }
1190
1191 DirectionalIndicator *indicator = new DirectionalIndicator(this, elevator, car, Number, active_direction, single, vertical, BackTexture, uptexture, uptexture_lit, downtexture, downtexture_lit, x, z, GetBase(true) + voffset, direction, BackWidth, BackHeight, ShowBack, tw, th);
1192 DirIndicatorArray.emplace_back(indicator);
1193 return indicator;
1194}
1195
1196void Floor::SetDirectionalIndicators(int elevator, int car, bool UpLight, bool DownLight)
1197{
1198 //set light status of all standard (non active-direction) directional indicators associated with the given elevator and car
1199
1200 for (size_t i = 0; i < DirIndicatorArray.size(); i++)
1201 {
1203
1204 if (indicator)
1205 {
1206 if (indicator->elevator == elevator && indicator->car == car && indicator->ActiveDirection == false)
1207 {
1208 indicator->DownLight(DownLight);
1209 indicator->UpLight(UpLight);
1210 }
1211 }
1212 }
1213}
1214
1216{
1217 //updates the active-direction indicators associated with the given elevator
1218
1219 SBS_PROFILE("Floor::UpdateDirectionalIndicators1");
1220 for (size_t i = 0; i < DirIndicatorArray.size(); i++)
1221 {
1223
1224 if (indicator)
1225 {
1226 if (indicator->elevator == elevator && indicator->ActiveDirection == true)
1227 {
1228 Elevator *elev = sbs->GetElevator(elevator);
1229
1230 if (!elev)
1231 return;
1232
1233 if (elev->ActiveDirection == 1)
1234 {
1235 indicator->UpLight(true);
1236 indicator->DownLight(false);
1237 }
1238 if (elev->ActiveDirection == 0)
1239 {
1240 indicator->UpLight(false);
1241 indicator->DownLight(false);
1242 }
1243 if (elev->ActiveDirection == -1)
1244 {
1245 indicator->UpLight(false);
1246 indicator->DownLight(true);
1247 }
1248 }
1249 }
1250 }
1251}
1252
1254{
1255 //updates all active-direction indicators
1256
1257 SBS_PROFILE("Floor::UpdateDirectionalIndicators2");
1258 for (size_t i = 0; i < DirIndicatorArray.size(); i++)
1259 {
1261
1262 if (indicator)
1263 {
1264 if (indicator->ActiveDirection == true)
1265 {
1266 Elevator *elev = sbs->GetElevator(indicator->elevator);
1267
1268 if (!elev)
1269 return;
1270
1271 if (elev->ActiveDirection == 1)
1272 {
1273 indicator->UpLight(true);
1274 indicator->DownLight(false);
1275 }
1276 if (elev->ActiveDirection == 0)
1277 {
1278 indicator->UpLight(false);
1279 indicator->DownLight(false);
1280 }
1281 if (elev->ActiveDirection == -1)
1282 {
1283 indicator->UpLight(false);
1284 indicator->DownLight(true);
1285 }
1286 }
1287 }
1288 }
1289}
1290
1292{
1293 //get door object
1294 if (number < (int)DoorArray.size())
1295 {
1296 if (DoorArray[number])
1297 return DoorArray[number];
1298 }
1299
1300 return 0;
1301}
1302
1303Door* Floor::GetDoor(const std::string &name)
1304{
1305 for (size_t i = 0; i < DoorArray.size(); i++)
1306 {
1307 if (DoorArray[i]->GetName() == name)
1308 return DoorArray[i];
1309 }
1310 return 0;
1311}
1312
1314{
1315 //remove a call station reference (does not delete the object itself)
1316 for (size_t i = 0; i < CallStationArray.size(); i++)
1317 {
1318 if (CallStationArray[i] == station)
1319 {
1320 CallStationArray.erase(CallStationArray.begin() + i);
1321 return;
1322 }
1323 }
1324}
1325
1327{
1328 //remove a floor indicator from the array
1329 //this does not delete the object
1330 for (size_t i = 0; i < FloorIndicatorArray.size(); i++)
1331 {
1332 if (FloorIndicatorArray[i] == indicator)
1333 {
1334 FloorIndicatorArray.erase(FloorIndicatorArray.begin() + i);
1335 return;
1336 }
1337 }
1338}
1339
1341{
1342 //remove a directional indicator from the array
1343 //this does not delete the object
1344 for (size_t i = 0; i < DirIndicatorArray.size(); i++)
1345 {
1346 if (DirIndicatorArray[i] == indicator)
1347 {
1348 DirIndicatorArray.erase(DirIndicatorArray.begin() + i);
1349 return;
1350 }
1351 }
1352}
1353
1355{
1356 //remove a door from the array
1357 //this does not delete the object
1358 for (size_t i = 0; i < DoorArray.size(); i++)
1359 {
1360 if (DoorArray[i] == door)
1361 {
1362 DoorArray.erase(DoorArray.begin() + i);
1363 return;
1364 }
1365 }
1366}
1367
1369{
1370 //remove a sound from the array
1371 //this does not delete the object
1372 for (size_t i = 0; i < sounds.size(); i++)
1373 {
1374 if (sounds[i] == sound)
1375 {
1376 sounds.erase(sounds.begin() + i);
1377 return;
1378 }
1379 }
1380}
1381
1383{
1384 //remove a light reference (does not delete the object itself)
1385 for (size_t i = 0; i < lights.size(); i++)
1386 {
1387 if (lights[i] == light)
1388 {
1389 lights.erase(lights.begin() + i);
1390 return;
1391 }
1392 }
1393}
1394
1396{
1397 //remove a model reference (does not delete the object itself)
1398 for (size_t i = 0; i < ModelArray.size(); i++)
1399 {
1400 if (ModelArray[i] == model)
1401 {
1402 ModelArray.erase(ModelArray.begin() + i);
1403 return;
1404 }
1405 }
1406}
1407
1409{
1410 //remove a prim reference (does not delete the object itself)
1411 for (size_t i = 0; i < PrimArray.size(); i++)
1412 {
1413 if (PrimArray[i] == prim)
1414 {
1415 PrimArray.erase(PrimArray.begin() + i);
1416 return;
1417 }
1418 }
1419}
1420
1422{
1423 //remove a custom object reference (does not delete the object itself)
1424 for (size_t i = 0; i < CustomObjectArray.size(); i++)
1425 {
1426 if (CustomObjectArray[i] == object)
1427 {
1428 CustomObjectArray.erase(CustomObjectArray.begin() + i);
1429 return;
1430 }
1431 }
1432}
1433
1435{
1436 //remove a control reference (does not delete the object itself)
1437 for (size_t i = 0; i < ControlArray.size(); i++)
1438 {
1439 if (ControlArray[i] == control)
1440 {
1441 ControlArray.erase(ControlArray.begin() + i);
1442 return;
1443 }
1444 }
1445}
1446
1448{
1449 //remove a trigger reference (does not delete the object itself)
1450 for (size_t i = 0; i < TriggerArray.size(); i++)
1451 {
1452 if (TriggerArray[i] == trigger)
1453 {
1454 TriggerArray.erase(TriggerArray.begin() + i);
1455 return;
1456 }
1457 }
1458}
1459
1461{
1462 //remove a camera texture reference (does not delete the object itself)
1463 for (size_t i = 0; i < CameraTextureArray.size(); i++)
1464 {
1465 if (CameraTextureArray[i] == cameratexture)
1466 {
1467 CameraTextureArray.erase(CameraTextureArray.begin() + i);
1468 return;
1469 }
1470 }
1471}
1472
1474{
1475 //remove an escalator reference (does not delete the object itself)
1476 for (size_t i = 0; i < EscalatorArray.size(); i++)
1477 {
1478 if (EscalatorArray[i] == escalator)
1479 {
1480 EscalatorArray.erase(EscalatorArray.begin() + i);
1481 return;
1482 }
1483 }
1484}
1485
1487{
1488 //remove an escalator reference (does not delete the object itself)
1489 for (size_t i = 0; i < MovingWalkwayArray.size(); i++)
1490 {
1491 if (MovingWalkwayArray[i] == walkway)
1492 {
1493 MovingWalkwayArray.erase(MovingWalkwayArray.begin() + i);
1494 return;
1495 }
1496 }
1497}
1498
1499Light* Floor::AddLight(const std::string &name, int type)
1500{
1501 //add a light
1502
1503 Light* light = new Light(this, name, type);
1504 light->Move(Vector3(0, GetBase(true), 0));
1505 lights.emplace_back(light);
1506 return light;
1507}
1508
1509Light* Floor::GetLight(const std::string &name)
1510{
1511 for (size_t i = 0; i < lights.size(); i++)
1512 {
1513 if (lights[i]->GetName() == name)
1514 return lights[i];
1515 }
1516 return 0;
1517}
1518
1519Model* Floor::AddModel(const std::string &name, const std::string &filename, bool center, Vector3 position, Vector3 rotation, Real max_render_distance, Real scale_multiplier, bool enable_physics, Real restitution, Real friction, Real mass)
1520{
1521 //add a model
1522 Model* model = new Model(this, name, filename, center, position + Vector3(0, GetBase(true), 0), rotation, max_render_distance, scale_multiplier, enable_physics, restitution, friction, mass);
1523 if (model->load_error == true)
1524 {
1525 delete model;
1526 return 0;
1527 }
1528 ModelArray.emplace_back(model);
1529 return model;
1530}
1531
1533{
1534 //add a model reference
1535
1536 if (!model)
1537 return;
1538
1539 for (size_t i = 0; i < ModelArray.size(); i++)
1540 {
1541 if (ModelArray[i] == model)
1542 return;
1543 }
1544
1545 ModelArray.emplace_back(model);
1546}
1547
1548Primitive* Floor::AddPrimitive(const std::string &name)
1549{
1550 //add a prim
1551 Primitive* prim = new Primitive(this, name);
1552 PrimArray.emplace_back(prim);
1553 prim->Move(Vector3(0, GetBase(true), 0));
1554 return prim;
1555}
1556
1558{
1559 //add a model reference
1560
1561 if (!primitive)
1562 return;
1563
1564 for (size_t i = 0; i < PrimArray.size(); i++)
1565 {
1566 if (PrimArray[i] == primitive)
1567 return;
1568 }
1569
1570 PrimArray.emplace_back(primitive);
1571}
1572
1573CustomObject* Floor::AddCustomObject(const std::string &name, const Vector3 &position, const Vector3 &rotation, Real max_render_distance, Real scale_multiplier)
1574{
1575 //add a custom object
1576 CustomObject* object = new CustomObject(this, name, position, rotation, max_render_distance, scale_multiplier);
1577 CustomObjectArray.emplace_back(object);
1578 return object;
1579}
1580
1582{
1583 //add a custom object reference
1584
1585 if (!object)
1586 return;
1587
1588 for (size_t i = 0; i < CustomObjectArray.size(); i++)
1589 {
1590 if (CustomObjectArray[i] == object)
1591 return;
1592 }
1593
1594 CustomObjectArray.emplace_back(object);
1595}
1596
1597void Floor::ReplaceTexture(const std::string &oldtexture, const std::string &newtexture)
1598{
1599 //change all instances of oldtexture in all meshes to newtexture
1600 Level->ReplaceTexture(oldtexture, newtexture);
1601 Interfloor->ReplaceTexture(oldtexture, newtexture);
1602 ColumnFrame->ReplaceTexture(oldtexture, newtexture);
1603}
1604
1605Control* Floor::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)
1606{
1607 //add a control
1608 std::vector<Action*> actionnull; //not used
1609 Control* control = new Control(this, name, false, sound, action_names, actionnull, textures, direction, width, height, true, selection_position);
1610 control->Move(CenterX, GetBase(true) + voffset, CenterZ);
1611 ControlArray.emplace_back(control);
1612 return control;
1613}
1614
1615Trigger* Floor::AddTrigger(const std::string &name, const std::string &sound_file, Vector3 &area_min, Vector3 &area_max, std::vector<std::string> &action_names)
1616{
1617 //add a trigger
1618 Trigger* trigger = new Trigger(this, name, false, sound_file, area_min, area_max, action_names);
1619 TriggerArray.emplace_back(trigger);
1620 trigger->Move(0, GetBase(true), 0);
1621 return trigger;
1622}
1623
1624CameraTexture* Floor::AddCameraTexture(const std::string &name, int quality, Real fov, const Vector3 &position, bool use_rotation, const Vector3 &rotation)
1625{
1626 //add a camera texture
1627 CameraTexture* cameratexture = new CameraTexture(this, name, quality, fov, GetBase(true) + position, use_rotation, rotation);
1628 CameraTextureArray.emplace_back(cameratexture);
1629 return cameratexture;
1630}
1631
1632Escalator* Floor::AddEscalator(const std::string &name, int run, Real speed, const std::string &sound_file, const std::string &riser_texture, const std::string &tread_texture, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real risersize, Real treadsize, int num_steps, Real voffset, Real tw, Real th)
1633{
1634 //add an escalator
1635 Escalator* escalator = new Escalator(this, name, run, speed, sound_file, riser_texture, tread_texture, direction, CenterX, CenterZ, width, risersize, treadsize, num_steps, GetBase(true) + voffset, tw, th);
1636 EscalatorArray.emplace_back(escalator);
1637 return escalator;
1638}
1639
1640MovingWalkway* Floor::AddMovingWalkway(const std::string &name, int run, Real speed, const std::string &sound_file, const std::string &texture, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real treadsize, int num_steps, Real voffset, Real tw, Real th)
1641{
1642 //add an escalator
1643 MovingWalkway* walkway = new MovingWalkway(this, name, run, speed, sound_file, texture, direction, CenterX, CenterZ, width, treadsize, num_steps, GetBase(true) + voffset, tw, th);
1644 MovingWalkwayArray.emplace_back(walkway);
1645 return walkway;
1646}
1647
1649{
1650 //position object at altitude
1651 SetPositionY(altitude);
1652 Altitude = altitude;
1653 AltitudeSet = true;
1654}
1655
1656void Floor::ShowInfo(bool detailed, bool display_header)
1657{
1658 //show information about this floor on the console
1659
1660 //if detailed is true (default), show detailed information for this floor
1661 //otherwise, show a single-line listing suitable for showing in a list with other floors
1662
1663 //if display_header is true, show header/key along with listing
1664
1665 if (display_header == true)
1666 {
1667 Object::Report("");
1668 Object::Report("--- Floor Information ---");
1669 Object::Report("");
1670 }
1671
1672 if (detailed == true)
1673 {
1674 Object::Report("Number: " + ToString(Number));
1675 Object::Report("ID: " + ID);
1676 Object::Report("Name: " + Name);
1677 Object::Report("Type: " + FloorType);
1678 Object::Report("Description: " + Description);
1679 Object::Report("Height: " + ToString(Height));
1680 Object::Report("InterfloorHeight: " + ToString(InterfloorHeight));
1681 Object::Report("FullHeight: " + ToString(FullHeight()));
1682 Object::Report("Altitude: " + ToString(Altitude));
1683 Object::Report("Base: " + ToString(GetBase()));
1684
1685 std::vector<int> elevator_list, stairs_list, shaft_list;
1686 GetElevatorList(elevator_list);
1687 GetStairwellList(stairs_list);
1688 GetShaftList(shaft_list);
1689
1690 std::string elevs;
1691 for (size_t i = 0; i < elevator_list.size(); i++)
1692 {
1693 elevs += ToString(elevator_list[i]);
1694 if (i < elevator_list.size() - 1)
1695 elevs += ", ";
1696 }
1697 Object::Report("Elevators servicing: " + elevs);
1698
1699 std::string stairs;
1700 for (size_t i = 0; i < stairs_list.size(); i++)
1701 {
1702 stairs += ToString(stairs_list[i]);
1703 if (i < stairs_list.size() - 1)
1704 stairs += ", ";
1705 }
1706 Object::Report("Stairwells spanning: " + stairs);
1707
1708 std::string shafts;
1709 for (size_t i = 0; i < shaft_list.size(); i++)
1710 {
1711 shafts += ToString(shaft_list[i]);
1712 if (i < shaft_list.size() - 1)
1713 shafts += ", ";
1714 }
1715 Object::Report("Shafts spanning: " + shafts);
1716
1717 if (display_header == true)
1718 Object::Report("");
1719 }
1720 else
1721 {
1722 if (display_header == true)
1723 Object::Report("Number(ID)\t----\tName\t----\tType\t----\tHeight\t----\tIFloorHeight\t----\tAltitude\t----\tBase\t----\tDescription");
1724
1725 Object::Report(ToString(Number) + "(" + ID + ")\t----\t" + Name + "\t----\t" + FloorType + "\t----\t" + ToString(Height) + "\t----\t" + ToString(InterfloorHeight) + "\t----\t" + ToString(Altitude) + "\t----\t" + ToString(GetBase()) + "\t----\t" + Description);
1726 }
1727}
1728
1729void Floor::GetElevatorList(std::vector<int> &listing, bool get_locals, bool get_express, bool get_service)
1730{
1731 //return a list of elevators that service this floor
1732
1733 for (int i = 1; i <= sbs->GetElevatorCount(); i++)
1734 {
1735 Elevator *elev = sbs->GetElevator(i);
1736 if (elev)
1737 {
1738 std::string type = SetCaseCopy(elev->Type, false);
1739
1740 if (elev->IsServicedFloor(Number) == true)
1741 {
1742 if (get_locals == true && type == "local")
1743 listing.emplace_back(elev->Number);
1744
1745 else if (get_express == true && type == "express")
1746 listing.emplace_back(elev->Number);
1747
1748 else if (get_service == true && type == "service")
1749 listing.emplace_back(elev->Number);
1750 }
1751 }
1752 }
1753}
1754
1755void Floor::GetStairwellList(std::vector<int> &listing)
1756{
1757 //return a list of stairwells that span this floor
1758
1759 for (int i = 1; i <= sbs->GetStairwellCount(); i++)
1760 {
1761 Stairwell *stairs = sbs->GetStairwell(i);
1762 if (stairs)
1763 {
1764 if (stairs->IsValidFloor(Number) == true)
1765 listing.emplace_back(stairs->StairsNum);
1766 }
1767 }
1768}
1769
1770void Floor::GetShaftList(std::vector<int> &listing)
1771{
1772 //return a list of shafts that span this floor
1773
1774 for (int i = 1; i <= sbs->GetShaftCount(); i++)
1775 {
1776 Shaft *shaft = sbs->GetShaft(i);
1777 if (shaft)
1778 {
1779 if (shaft->IsValidFloor(Number) == true)
1780 listing.emplace_back(shaft->ShaftNumber);
1781 }
1782 }
1783}
1784
1785ElevatorRoute* Floor::GetDirectRoute(int DestinationFloor, std::string ElevatorType)
1786{
1787 //return elevator if this floor has a direct elevator connection to another floor,
1788 //based on the given elevator type
1789
1790 SetCase(ElevatorType, false);
1791 std::vector<int> list;
1792 GetElevatorList(list);
1793
1794 for (size_t i = 0; i < list.size(); i++)
1795 {
1796 Elevator *elev = sbs->GetElevator(list[i]);
1797 if (elev)
1798 {
1799 ElevatorCar *car = elev->GetCarForFloor(Number);
1800 if (car)
1801 {
1802 std::string type = SetCaseCopy(elev->Type, false);
1803 bool serviced = car->IsServicedFloor(DestinationFloor);
1805
1806 if (serviced == true && type == ElevatorType && station)
1807 {
1808 ElevatorRoute* route = new ElevatorRoute(car, DestinationFloor);
1809 return route;
1810 }
1811 }
1812 }
1813 }
1814
1815 return 0;
1816}
1817
1818std::vector<int> Floor::GetDirectFloors(bool include_service)
1819{
1820 //return a list of floors that can be directly accessed by the elevators that service this floor
1821
1822 std::vector<int> list, result;
1823 GetElevatorList(list);
1824
1825 for (size_t i = 0; i < list.size(); i++)
1826 {
1827 Elevator *elev = sbs->GetElevator(list[i]);
1828 if (elev)
1829 {
1830 std::string type = SetCaseCopy(elev->Type, false);
1831 if (include_service == false && type == "service")
1832 continue;
1833
1834 ElevatorCar *car = elev->GetCarForFloor(Number);
1835 if (car)
1836 {
1837 for (int j = 0; j < car->GetServicedFloorCount(); j++)
1838 {
1839 int floor = car->GetServicedFloor(j);
1840
1841 //skip this floor
1842 if (floor == Number)
1843 continue;
1844
1845 bool found = false;
1846 for (size_t k = 0; k < result.size(); k++)
1847 {
1848 //make sure floor is not already in result list
1849 if (result[k] == floor)
1850 {
1851 found = true;
1852 break;
1853 }
1854 }
1855
1856 if (found == false)
1857 result.emplace_back(floor);
1858 }
1859 }
1860 }
1861 }
1862
1863 return result;
1864}
1865
1866Model* Floor::GetModel(std::string name)
1867{
1868 //get a model by name
1869
1870 SetCase(name, false);
1871
1872 for (size_t i = 0; i < ModelArray.size(); i++)
1873 {
1874 if (SetCaseCopy(ModelArray[i]->GetName(), false) == name)
1875 return ModelArray[i];
1876 }
1877
1878 return 0;
1879}
1880
1882{
1883 //get a primitive by name
1884
1885 SetCase(name, false);
1886
1887 for (size_t i = 0; i < PrimArray.size(); i++)
1888 {
1889 if (SetCaseCopy(PrimArray[i]->GetName(), false) == name)
1890 return PrimArray[i];
1891 }
1892
1893 return 0;
1894}
1895
1897{
1898 //get a custom object by name
1899
1900 SetCase(name, false);
1901
1902 for (size_t i = 0; i < CustomObjectArray.size(); i++)
1903 {
1904 if (SetCaseCopy(CustomObjectArray[i]->GetName(), false) == name)
1905 return CustomObjectArray[i];
1906 }
1907
1908 return 0;
1909}
1910
1911RevolvingDoor* Floor::AddRevolvingDoor(std::string name, bool run, const std::string &soundfile, const std::string &texture, Real thickness, bool clockwise, int segments, Real speed, Real rotation, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, Real tw, Real th, bool external)
1912{
1913 //create an external (global) door if specified
1914 if (external == true)
1915 return sbs->GetRevolvingDoorManager()->AddDoor(name, run, soundfile, texture, thickness, clockwise, segments, speed, rotation, CenterX, CenterZ, width, height, Altitude + voffset, tw, th);
1916
1917 int number = (int)RDoorArray.size();
1918 if (name == "")
1919 name = "RevolvingDoor " + ToString(number);
1920
1921 RevolvingDoor* door = new RevolvingDoor(this, DoorWrapper, name, run, soundfile, texture, thickness, clockwise, segments, speed, rotation, CenterX, CenterZ, width, height, GetBase(true) + voffset, tw, th);
1922 RDoorArray.emplace_back(door);
1923 return door;
1924}
1925
1927{
1928 //remove a door from the array
1929 //this does not delete the object
1930 for (size_t i = 0; i < RDoorArray.size(); i++)
1931 {
1932 if (RDoorArray[i] == door)
1933 {
1934 RDoorArray.erase(RDoorArray.begin() + i);
1935 return;
1936 }
1937 }
1938}
1939
1941{
1942 //get door object
1943 if (number < (int)RDoorArray.size())
1944 {
1945 if (RDoorArray[number])
1946 return RDoorArray[number];
1947 }
1948
1949 return 0;
1950}
1951
1953{
1954 if (number < CameraTextureArray.size())
1955 return CameraTextureArray[number];
1956 else
1957 return 0;
1958}
1959
1961{
1962 return (int)CallStationArray.size();
1963}
1964
1965Reverb* Floor::AddReverb(const std::string &name, const std::string &type, const Vector3 &position, Real min_distance, Real max_distance)
1966{
1967 //create a reverb object
1968 Reverb *reverb = new Reverb(this, name, type, position, min_distance, max_distance, false);
1969 reverbs.emplace_back(reverb);
1970 return reverb;
1971}
1972
1973Reverb* Floor::GetReverb(const std::string &name)
1974{
1975 //get reverb by name
1976
1977 std::string findname = name;
1978 SetCase(findname, false);
1979 for (size_t i = 0; i < reverbs.size(); i++)
1980 {
1981 if (reverbs[i])
1982 {
1983 std::string name2 = reverbs[i]->GetName();
1984 SetCase(name2, false);
1985 if (findname == name2)
1986 return reverbs[i];
1987 }
1988 }
1989 return 0;
1990}
1991
1993{
1994 //remove a reverb from the array
1995 //this does not delete the object
1996
1997 for (size_t i = 0; i < reverbs.size(); i++)
1998 {
1999 if (reverbs[i] == reverb)
2000 {
2001 reverbs.erase(reverbs.begin() + i);
2002 return;
2003 }
2004 }
2005}
2006
2008{
2009 return (int)reverbs.size();
2010}
2011
2013{
2014 if (index >= 0 && index < (int)reverbs.size())
2015 return reverbs[index];
2016 return 0;
2017}
2018
2019}
void SetController(int number)
bool CreateCallButtons(const std::string &sound_file_up, const std::string &sound_file_down, std::string BackTexture, const std::string &UpButtonTexture, const std::string &UpButtonTexture_Lit, const std::string &DownButtonTexture, const std::string &DownButtonTexture_Lit, const std::string &direction, Real BackWidth, Real BackHeight, bool ShowBack, Real tw, Real th)
int CurrentFloor
Definition camera.h:49
void DownLight(bool value)
bool ServesFloor(int floor)
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 * CreateDoor(bool open_state, const std::string &texture, const std::string &side_texture, Real thickness, const std::string &face_direction, const std::string &open_direction, 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 door.cpp:294
bool IsServicedFloor(int floor, bool report=true)
int GetServicedFloor(int index)
std::string Type
Definition elevator.h:38
int ActiveDirection
Definition elevator.h:95
ElevatorCar * GetCarForFloor(int number, bool report_on_failure=false)
bool IsServicedFloor(int floor, bool report=true)
void Update(bool blank=false)
DynamicMesh * GetColumnDynMesh()
Definition manager.h:53
DynamicMesh * GetIFloorDynMesh()
Definition manager.h:52
DynamicMesh * GetFloorDynMesh()
Definition manager.h:51
DirectionalIndicator * AddDirectionalIndicator(int elevator, int car, bool relative, bool active_direction, bool single, bool vertical, const std::string &BackTexture, const std::string &uptexture, const std::string &uptexture_lit, const std::string &downtexture, const std::string &downtexture_lit, Real CenterX, Real CenterZ, Real voffset, const std::string &direction, Real BackWidth, Real BackHeight, bool ShowBack, Real tw, Real th)
Definition floor.cpp:1161
void AddGroupFloor(int number)
Definition floor.cpp:679
void UpdateFloorIndicators()
Definition floor.cpp:942
void RemoveFloorIndicator(FloorIndicator *indicator)
Definition floor.cpp:1326
CallStation * AddCallButtons(int controller, const std::string &sound_file_up, const std::string &sound_file_down, const std::string &BackTexture, const std::string &UpButtonTexture, const std::string &UpButtonTexture_Lit, const std::string &DownButtonTexture, const std::string &DownButtonTexture_Lit, Real CenterX, Real CenterZ, Real voffset, const std::string &direction, Real BackWidth, Real BackHeight, bool ShowBack, Real tw, Real th)
Definition floor.cpp:578
std::vector< CustomObject * > CustomObjectArray
Definition floor.h:173
int EnabledGroup_Floor
Definition floor.h:53
bool IsInGroup(int floor)
Definition floor.cpp:764
std::vector< Sound * > GetSound(const std::string &name)
Definition floor.cpp:1108
void UpdateDirectionalIndicators()
Definition floor.cpp:1253
CameraTexture * GetCameraTexture(int number)
Definition floor.cpp:1952
MovingWalkway * AddMovingWalkway(const std::string &name, int run, Real speed, const std::string &sound_file, const std::string &texture, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real treadsize, int num_steps, Real voffset, Real tw, Real th)
Definition floor.cpp:1640
void RemoveCallStation(CallStation *station)
Definition floor.cpp:1313
Reverb * GetReverb(const std::string &name)
Definition floor.cpp:1973
std::vector< FloorIndicator * > FloorIndicatorArray
Definition floor.h:50
void RemoveLight(Light *light)
Definition floor.cpp:1382
void RemoveDoor(Door *door)
Definition floor.cpp:1354
std::string IndicatorTexture
Definition floor.h:42
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
void Cut(const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, bool fast, int checkwallnumber=0, bool prepare=false)
Definition floor.cpp:607
Wall * AddInterfloorFloor(const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real voffset1, Real voffset2, bool reverse_axis, bool texture_direction, Real tw, Real th, bool legacy_behavior=false)
Definition floor.cpp:338
void RemoveMovingWalkway(MovingWalkway *walkway)
Definition floor.cpp:1486
Reverb * AddReverb(const std::string &name, const std::string &type, const Vector3 &position, Real min_distance, Real max_distance)
Definition floor.cpp:1965
int Number
Definition floor.h:36
Wall * AddInterfloorWall(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 voffset1, Real voffset2, Real tw, Real th)
Definition floor.cpp:368
void GetStairwellList(std::vector< int > &listing)
Definition floor.cpp:1755
std::vector< Trigger * > TriggerArray
Definition floor.h:179
void GetShaftList(std::vector< int > &listing)
Definition floor.cpp:1770
std::vector< Escalator * > EscalatorArray
Definition floor.h:185
CallStation * AddCallStation(int number)
Definition floor.cpp:598
Escalator * AddEscalator(const std::string &name, int run, Real speed, const std::string &sound_file, const std::string &riser_texture, const std::string &tread_texture, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real risersize, Real treadsize, int num_steps, Real voffset, Real tw, Real th)
Definition floor.cpp:1632
bool ReportError(const std::string &message)
Definition floor.cpp:1134
std::string Name
Definition floor.h:37
Floor(Object *parent, FloorManager *manager, int number)
Definition floor.cpp:58
MeshObject * ColumnFrame
Definition floor.h:34
Real FullHeight()
Definition floor.cpp:572
CameraTexture * AddCameraTexture(const std::string &name, int quality, Real fov, const Vector3 &position, bool use_rotation, const Vector3 &rotation)
Definition floor.cpp:1624
void RemoveRevolvingDoor(RevolvingDoor *door)
Definition floor.cpp:1926
std::vector< DirectionalIndicator * > DirIndicatorArray
Definition floor.h:164
bool IsEnabled
Definition floor.h:46
std::vector< Door * > DoorArray
Definition floor.h:156
void SetAltitude(Real altitude)
Definition floor.cpp:1648
Door * CreateDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool rotate)
Definition floor.cpp:824
MeshObject * Level
Definition floor.h:32
void EnableInterfloor(bool value)
Definition floor.cpp:883
void RemoveControl(Control *control)
Definition floor.cpp:1434
DynamicMesh * DoorWrapper
Definition floor.h:158
void AddFillerWalls(const std::string &texture, Real thickness, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, bool direction, Real tw, Real th, bool isexternal)
Definition floor.cpp:1013
Sound * AddSound(const std::string &name, const std::string &filename, 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, Vector3 direction=Vector3(0, 0, 0))
Definition floor.cpp:1084
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 floor.cpp:1605
Model * GetModel(std::string name)
Definition floor.cpp:1866
Real Altitude
Definition floor.h:43
std::string FloorType
Definition floor.h:40
void EnableColumnFrame(bool value)
Definition floor.cpp:876
void RemoveCustomObject(CustomObject *object)
Definition floor.cpp:1421
void RemoveReverb(Reverb *reverb)
Definition floor.cpp:1992
Real GetBase(bool relative=false)
Definition floor.cpp:1140
void Loop()
Definition floor.cpp:955
int GetCallStationCount()
Definition floor.cpp:1960
Model * AddModel(const std::string &name, const std::string &filename, bool center, Vector3 position, 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 floor.cpp:1519
FloorIndicator * AddFloorIndicator(int elevator, int car, bool relative, const std::string &texture_prefix, const std::string &blank_texture, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real height, Real voffset)
Definition floor.cpp:904
std::vector< CallStation * > CallStationArray
Definition floor.h:49
void RemoveDirectionalIndicator(DirectionalIndicator *indicator)
Definition floor.cpp:1340
void RemoveSound(Sound *sound)
Definition floor.cpp:1368
void RemoveGroupFloor(int number)
Definition floor.cpp:692
bool IsColumnFrameEnabled
Definition floor.h:47
Light * AddLight(const std::string &name, int type)
Definition floor.cpp:1499
void RemoveTrigger(Trigger *trigger)
Definition floor.cpp:1447
void RemoveCameraTexture(CameraTexture *cameratexture)
Definition floor.cpp:1460
std::vector< Primitive * > PrimArray
Definition floor.h:170
std::string ID
Definition floor.h:38
bool EnabledGroup
Definition floor.h:52
std::vector< Light * > lights
Definition floor.h:161
void Report(const std::string &message)
Definition floor.cpp:1128
CallStation * GetCallStation(int number)
Definition floor.cpp:1000
void RemoveEscalator(Escalator *escalator)
Definition floor.cpp:1473
std::vector< int > GetCallStations(int elevator)
Definition floor.cpp:967
void ReplaceTexture(const std::string &oldtexture, const std::string &newtexture)
Definition floor.cpp:1597
ElevatorRoute * GetDirectRoute(int DestinationFloor, std::string ElevatorType)
Definition floor.cpp:1785
std::vector< Sound * > sounds
Definition floor.h:150
void RemoveModel(Model *model)
Definition floor.cpp:1395
Primitive * AddPrimitive(const std::string &name)
Definition floor.cpp:1548
Real Height
Definition floor.h:44
void GetElevatorList(std::vector< int > &listing, bool get_locals=true, bool get_express=true, bool get_service=true)
Definition floor.cpp:1729
Trigger * AddTrigger(const std::string &name, const std::string &sound_file, Vector3 &area_min, Vector3 &area_max, std::vector< std::string > &action_names)
Definition floor.cpp:1615
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
void EnableGroup(bool value)
Definition floor.cpp:706
void CutAll(const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, bool prepare=false)
Definition floor.cpp:636
std::vector< RevolvingDoor * > RDoorArray
Definition floor.h:157
std::vector< MovingWalkway * > MovingWalkwayArray
Definition floor.h:188
bool CalculateAltitude()
Definition floor.cpp:839
std::vector< Model * > ModelArray
Definition floor.h:167
std::vector< int > GetDirectFloors(bool include_service)
Definition floor.cpp:1818
bool IsInterfloorEnabled
Definition floor.h:48
Door * GetDoor(const std::string &name)
Definition floor.cpp:1303
RevolvingDoor * GetRevolvingDoor(int number)
Definition floor.cpp:1940
void SetDirectionalIndicators(int elevator, int car, bool UpLight, bool DownLight)
Definition floor.cpp:1196
Wall * ColumnWallBox2(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, bool outside, bool top, bool bottom)
Definition floor.cpp:897
RevolvingDoor * AddRevolvingDoor(std::string name, bool run, const std::string &soundfile, const std::string &texture, Real thickness, bool clockwise, int segments, Real speed, Real rotation, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, Real tw, Real th, bool external)
Definition floor.cpp:1911
bool AltitudeSet
Definition floor.h:54
std::vector< Control * > ControlArray
Definition floor.h:176
std::vector< Reverb * > reverbs
Definition floor.h:153
void Enabled(bool value)
Definition floor.cpp:377
void RemovePrimitive(Primitive *prim)
Definition floor.cpp:1408
CustomObject * GetCustomObject(std::string name)
Definition floor.cpp:1896
MeshObject * Interfloor
Definition floor.h:33
Wall * ColumnWallBox(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, bool outside, bool top, bool bottom)
Definition floor.cpp:890
Real InterfloorHeight
Definition floor.h:45
std::vector< int > Group
Definition floor.h:51
Wall * AddWall(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 voffset1, Real voffset2, Real tw, Real th, bool isexternal)
Definition floor.cpp:347
Wall * AddFloor(const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real voffset1, Real voffset2, bool reverse_axis, bool texture_direction, Real tw, Real th, bool isexternal, bool legacy_behavior=false)
Definition floor.cpp:316
std::string NumberID
Definition floor.h:39
CallStation * GetCallStationForElevator(int elevator)
Definition floor.cpp:985
std::string Description
Definition floor.h:41
int GetReverbCount()
Definition floor.cpp:2007
std::vector< CameraTexture * > CameraTextureArray
Definition floor.h:182
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
std::vector< Wall * > Walls
Definition mesh.h:99
void Enabled(bool value)
Definition mesh.cpp:154
void DeleteWalls()
Definition mesh.cpp:372
bool ReplaceTexture(const std::string &oldtexture, const std::string &newtexture)
Definition mesh.cpp:691
Wall * CreateWallObject(const std::string &name)
Definition mesh.cpp:208
bool load_error
Definition model.h:32
const std::string & GetName()
Definition object.cpp:53
virtual bool ReportError(const std::string &message)
Definition object.cpp:84
virtual void Report(const std::string &message)
Definition object.cpp:78
void SetName(const std::string &name)
Definition object.cpp:72
bool parent_deleting
Definition object.h:64
virtual void Move(const Vector3 &vector, Real speed=1.0)
Definition object.cpp:253
void LoopChildren()
Definition object.cpp:579
virtual void SetPositionY(Real value)
Definition object.cpp:313
virtual Vector3 GetPosition(bool relative=false)
Definition object.cpp:321
SceneNode * GetSceneNode()
Definition object.cpp:240
void SetValues(const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
Definition object.cpp:144
void EnableLoop(bool value)
Definition object.cpp:521
RevolvingDoor * AddDoor(std::string name, bool run, const std::string &soundfile, const std::string &texture, Real thickness, bool clockwise, int segments, Real speed, Real rotation, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, Real tw, Real th)
Definition manager.cpp:824
Shaft * GetShaft(int number)
Definition sbs.cpp:1753
Elevator * GetElevator(int number)
Definition sbs.cpp:1746
bool IsRunning
Definition sbs.h:157
DoorManager * GetDoorManager()
Definition sbs.cpp:4553
DispatchController * GetController(int number)
Definition sbs.cpp:1774
MeshObject * External
Definition sbs.h:422
bool InterfloorOnTop
Definition sbs.h:187
int GetWallOrientation()
Definition sbs.cpp:1802
bool AddWallMain(Wall *wallobject, 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, bool autosize)
Definition sbs.cpp:690
int GetElevatorCount()
Definition sbs.cpp:1703
void ResetWalls(bool ToDefaults=false)
Definition sbs.cpp:1854
Floor * GetFloor(int number)
Definition sbs.cpp:1739
Utility * GetUtility()
Definition sbs.cpp:4611
bool FastDelete
Definition sbs.h:188
Stairwell * GetStairwell(int number)
Definition sbs.cpp:1760
int callstation_index
Definition sbs.h:199
void RemoveFloor(Floor *floor)
Definition sbs.cpp:2773
Camera * camera
Definition sbs.h:160
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
int GetStairwellCount()
Definition sbs.cpp:1727
void DrawWalls(bool MainN, bool MainP, bool SideN, bool SideP, bool Top, bool Bottom)
Definition sbs.cpp:1833
int GetShaftCount()
Definition sbs.cpp:1721
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
bool AddFloorMain(Wall *wallobject, 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 autosize, bool legacy_behavior=false)
Definition sbs.cpp:921
RevolvingDoorManager * GetRevolvingDoorManager()
Definition sbs.cpp:4563
bool Verbose
Definition sbs.h:186
void Enabled(bool value, bool EnableShaftDoors)
Definition shaft.cpp:848
bool Cut(bool relative, const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, int checkwallnumber=0)
Definition shaft.cpp:930
bool IsValidFloor(int floor)
Definition shaft.cpp:433
int ShaftNumber
Definition shaft.h:34
Level * GetLevel(int floor)
Definition shaft.cpp:135
bool IsEnabled
Definition shaft.h:43
bool Load(const std::string &filename, bool force=false)
Definition sound.cpp:386
bool Play(bool reset=true)
Definition sound.cpp:321
void SetSpeed(int percent)
Definition sound.cpp:273
void SetDopplerLevel(Real level)
Definition sound.cpp:462
void SetLoopState(bool value)
Definition sound.cpp:204
void SetConeSettings(Real inside_angle=360.0, Real outside_angle=360.0, Real outside_volume=1.0)
Definition sound.cpp:196
void SetVolume(Real value)
Definition sound.cpp:138
void SetDirection(const Vector3 &direction)
Definition sound.cpp:179
void SetDistances(Real min, Real max)
Definition sound.cpp:158
void Enabled(bool value)
Definition stairs.cpp:778
bool Cut(bool relative, const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, int checkwallnumber=0)
Definition stairs.cpp:923
int StairsNum
Definition stairs.h:34
bool IsEnabled
Definition stairs.h:40
bool IsValidFloor(int floor)
Definition stairs.cpp:326
Level * GetLevel(int floor)
Definition stairs.cpp:112
void Cut(Wall *wall, Vector3 start, Vector3 end, bool cutwalls, bool cutfloors, int checkwallnumber=0, bool reset_check=true)
Definition utility.cpp:96
Ogre::Vector3 Vector3
Definition globals.h:58
Ogre::Real Real
Definition globals.h:57
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
#define SBS_PROFILE(name)
Definition profiler.h:131
void Enabled(bool value)