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