Skyscraper 2.0
shaft.cpp
Go to the documentation of this file.
1/*
2 Scalable Building Simulator - Shaft 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 "floor.h"
27#include "elevator.h"
28#include "elevatorcar.h"
29#include "dynamicmesh.h"
30#include "mesh.h"
31#include "polymesh.h"
32#include "sound.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 "control.h"
40#include "profiler.h"
41#include "cameratexture.h"
42#include "utility.h"
43#include "trigger.h"
44#include "shaft.h"
45
46namespace SBS {
47
48Shaft::Shaft(Object *parent, int number, Real CenterX, Real CenterZ, int startfloor, int endfloor) : Object(parent)
49{
50 //creates a shaft in the location specified by CenterX and CenterZ
51 //and that spans the floor range specified by startfloor and endfloor
52
53 //set up SBS object
54 SetValues("Shaft", "", false);
55
56 ShaftNumber = number;
57 this->startfloor = startfloor;
58 this->endfloor = endfloor;
59
60 //make sure start and ending floors are within a valid range
61 if (startfloor < -sbs->Basements)
62 return;
63 if (endfloor > sbs->Floors - 1)
64 return;
65
66 InsideShaft = false;
67 IsEnabled = true;
70 cutstart = Vector2::ZERO;
71 cutend = Vector2::ZERO;
72 ShowFloors = 0;
73 ShowOutside = false;
74 ShowInterfloors = false;
75 ShowFullShaft = false;
76 EnableCheck = false;
77 lastcheckresult = false;
78 checkfirstrun = true;
79 lastposition = Vector3::ZERO;
80 InElevator = false;
82
83 std::string name = "Shaft " + ToString(number);
84
85 SetName(name);
86 SetPosition(CenterX, sbs->GetFloor(startfloor)->Altitude, CenterZ);
87
88 dynamic_mesh = new DynamicMesh(this, GetSceneNode(), name);
89
90 for (int i = startfloor; i <= endfloor; i++)
91 {
92 Levels.emplace_back(new Level(this, i));
93 }
94
95 //create a dynamic mesh for doors
96 DoorWrapper = new DynamicMesh(this, GetSceneNode(), GetName() + " Door Container", 0, true);
97
98 //create a dynamic mesh for doors
99 ShaftDoorContainer = new DynamicMesh(this, GetSceneNode(), name + " Shaft Door Container", 0, true);
100
101 Report("created at " + TruncateNumber(CenterX, 4) + ", " + TruncateNumber(CenterZ, 4));
102
103 EnableLoop(true);
104}
105
107{
108 //destructor
109
110 //delete levels
111 for (size_t i = 0; i < Levels.size(); i++)
112 {
113 if (Levels[i])
114 delete Levels[i];
115 Levels[i] = 0;
116 }
117
118 if (DoorWrapper)
119 delete DoorWrapper;
120 DoorWrapper = 0;
121
123 delete ShaftDoorContainer;
125
126 //delete dynamic mesh
127 if (dynamic_mesh)
128 delete dynamic_mesh;
129 dynamic_mesh = 0;
130
131 //unregister from parent
132 if (sbs->FastDelete == false && parent_deleting == false)
133 sbs->RemoveShaft(this);
134}
135
137{
138 for (size_t i = 0; i < Levels.size(); i++)
139 {
140 if (Levels[i]->GetFloor() == floor)
141 return Levels[i];
142 }
143 return 0;
144}
145
146void Shaft::EnableWhole(bool value, bool EnableShaftDoors, bool force)
147{
148 //turn on/off entire shaft
149
150 if (value == false && ShowFullShaft == true)
151 return;
152
153 if (force == true)
154 IsEnabled = !value;
155
156 if (IsEnabled == !value && EnableCheck == false)
157 {
158 for (int i = startfloor; i <= endfloor; i++)
159 {
160 if (force == true)
161 GetLevel(i)->enabled = !value;
162 GetLevel(i)->Enabled(value, EnableShaftDoors);
163 }
164 }
165
166 //enable/disable dynamic meshes
167 dynamic_mesh->Enabled(value);
169 DoorWrapper->Enabled(value);
170
171 IsEnabled = value;
172 if (ShowFullShaft == true)
173 EnableCheck = true;
174}
175
176bool Shaft::IsInside(const Vector3 &position)
177{
178 //SBS_PROFILE("Shaft::IsInShaft");
179
180 //if last position is the same as new, return previous result
181 if (position.positionEquals(lastposition) == true && checkfirstrun == false)
182 return lastcheckresult;
183
184 checkfirstrun = false;
185
186 if (position.y > bottom && position.y < top && Levels.size() > 0)
187 {
188 //first determine if camera has X and Z values within the first shaft floor's bounding box
189 if (Levels[0]->GetMeshObject()->InBoundingBox(position, false) == true)
190 {
191 //do a hit beam test from the position to the bottom of the shaft, to see if it hits a shaft floor
192 bool result = (Levels[0]->GetMeshObject()->HitBeam(position, Vector3::NEGATIVE_UNIT_Y, position.y - (bottom - 1)) >= 0);
193
194 //cache values
195 lastcheckresult = result;
196 lastposition = position;
197
198 return result;
199 }
200 }
201
202 //cache values
203 lastcheckresult = false;
204 lastposition = position;
205
206 return false;
207}
208
209void Shaft::CutFloors(bool relative, const Vector2 &start, const Vector2 &end, Real startvoffset, Real endvoffset)
210{
211 //Cut through floor/ceiling polygons on all associated levels, within the voffsets
212
213 Report("cutting...");
214
215 Real voffset1, voffset2;
216
217 if (relative == true)
218 {
219 cutstart = start;
220 cutend = end;
221 }
222 else
223 {
224 cutstart = Vector2(start.x - GetPosition().x, start.y - GetPosition().z);
225 cutend = Vector2(end.x - GetPosition().x, end.y - GetPosition().z);
226 }
227
229 return;
230
231 for (int i = startfloor; i <= endfloor; i++)
232 {
233 Floor *floorptr = sbs->GetFloor(i);
234 if (!floorptr)
235 continue;
236
237 voffset1 = 0;
238 voffset2 = floorptr->FullHeight() + 1;
239
240 if (i == startfloor)
241 voffset1 = startvoffset;
242 else if (i == endfloor)
243 voffset2 = endvoffset;
244
245 if (relative == true)
246 floorptr->Cut(Vector3(GetPosition().x + start.x, voffset1, GetPosition().z + start.y), Vector3(GetPosition().x + end.x, voffset2, GetPosition().z + end.y), false, true, false);
247 else
248 floorptr->Cut(Vector3(start.x, voffset1, start.y), Vector3(end.x, voffset2, end.y), false, true, false);
249 floorptr = 0;
250 }
251
252 //cut external
253 voffset1 = sbs->GetFloor(startfloor)->Altitude + startvoffset;
254 voffset2 = sbs->GetFloor(endfloor)->Altitude + endvoffset;
255
256 if (sbs->External)
257 {
258 for (size_t i = 0; i < sbs->External->Walls.size(); i++)
259 {
260 if (!sbs->External->Walls[i])
261 continue;
262
263 if (relative == true)
264 sbs->GetUtility()->Cut(sbs->External->Walls[i], Vector3(GetPosition().x + start.x, voffset1, GetPosition().z + start.y), Vector3(GetPosition().x + end.x, voffset2, GetPosition().z + end.y), false, true);
265 else
266 sbs->GetUtility()->Cut(sbs->External->Walls[i], Vector3(start.x, voffset1, start.y), Vector3(end.x, voffset2, end.y), false, true);
267 }
268 }
269}
270
271void Shaft::EnableRange(int floor, int range, bool value, bool EnableShaftDoors)
272{
273 //turn on/off a range of floors
274 //if range is 3, show shaft on current floor (floor), and 1 floor below and above (3 total floors)
275 //if range is 1, show only the current floor (floor)
276
277 //exit if ShowFullShaft is true
278 if (ShowFullShaft == true)
279 return;
280
281 if (!sbs->GetFloor(floor))
282 return;
283
284 SBS_PROFILE("Shaft::EnableRange");
285
286 //range must be greater than 0
287 if (range < 1)
288 range = 1;
289
290 //range must be an odd number; if it's even, then add 1
291 if (IsEven(range) == true)
292 range++;
293
294 int additionalfloors;
295 if (range > 1)
296 additionalfloors = (range - 1) / 2;
297 else
298 additionalfloors = 0;
299
300 //disable floors 1 floor outside of range
301 if (value == true)
302 {
303 if (floor - additionalfloors - 1 >= startfloor && floor - additionalfloors - 1 <= endfloor)
304 {
305 if (sbs->GetFloor(floor)->IsInGroup(floor - additionalfloors - 1) == false) //only disable if not in group
306 GetLevel(floor - additionalfloors - 1)->Enabled(false, EnableShaftDoors);
307 }
308 if (floor + additionalfloors + 1 >= startfloor && floor + additionalfloors + 1 <= endfloor)
309 {
310 if (sbs->GetFloor(floor)->IsInGroup(floor + additionalfloors + 1) == false) //only disable if not in group
311 GetLevel(floor + additionalfloors + 1)->Enabled(false, EnableShaftDoors);
312 }
313 }
314
315 //enable floors within range
316 for (int i = floor - additionalfloors; i <= floor + additionalfloors; i++)
317 {
318 if (i >= startfloor && i <= endfloor)
319 GetLevel(i)->Enabled(value, EnableShaftDoors);
320 }
321}
322
323void Shaft::AddShowFloor(int floor)
324{
325 //adds a floor number to the ShowFloors list
326
327 if (IsShowFloor(floor))
328 return;
329
330 ShowFloorsList.emplace_back(floor);
331 std::sort(ShowFloorsList.begin(), ShowFloorsList.end());
332}
333
335{
336 //removes a floor number from the ShowFloors list
337
338 for (size_t i = 0; i < ShowFloorsList.size(); i++)
339 {
340 if (ShowFloorsList[i] == floor)
341 {
342 ShowFloorsList.erase(ShowFloorsList.begin() + i);
343 return;
344 }
345 }
346}
347
348bool Shaft::IsShowFloor(int floor)
349{
350 //return true if a floor is in the ShowFloors list
351
352 for (size_t i = 0; i < ShowFloorsList.size(); i++)
353 {
354 if (ShowFloorsList[i] == floor)
355 return true;
356 }
357 return false;
358}
359
361{
362 //adds a floor number to the ShowOutside list
363
364 if (IsShowOutside(floor))
365 return;
366
367 ShowOutsideList.emplace_back(floor);
368 std::sort(ShowOutsideList.begin(), ShowOutsideList.end());
369}
370
372{
373 //removes a floor number from the ShowOutside list
374
375 for (size_t i = 0; i < ShowOutsideList.size(); i++)
376 {
377 if (ShowOutsideList[i] == floor)
378 {
379 ShowOutsideList.erase(ShowOutsideList.begin() + i);
380 return;
381 }
382 }
383}
384
385bool Shaft::IsShowOutside(int floor)
386{
387 //return true if a floor is in the ShowOutside list
388
389 for (size_t i = 0; i < ShowOutsideList.size(); i++)
390 {
391 if (ShowOutsideList[i] == floor)
392 return true;
393 }
394 return false;
395}
396
398{
399 //adds a floor number to the ShowInterfloors list
400
401 if (IsShowInterfloor(floor))
402 return;
403
404 ShowInterfloorsList.emplace_back(floor);
405 std::sort(ShowInterfloorsList.begin(), ShowInterfloorsList.end());
406}
407
409{
410 //removes a floor number from the ShowInterfloors list
411
412 for (size_t i = 0; i < ShowInterfloorsList.size(); i++)
413 {
414 if (ShowInterfloorsList[i] == floor)
415 {
416 ShowInterfloorsList.erase(ShowInterfloorsList.begin() + i);
417 return;
418 }
419 }
420}
421
423{
424 //return true if a floor is in the ShowInterfloors list
425
426 for (size_t i = 0; i < ShowInterfloorsList.size(); i++)
427 {
428 if (ShowInterfloorsList[i] == floor)
429 return true;
430 }
431 return false;
432}
433
434bool Shaft::IsValidFloor(int floor)
435{
436 //return true if the shaft services the specified floor
437
438 if (floor < startfloor || floor > endfloor)
439 return false;
440
441 if (!GetLevel(floor))
442 return false;
443
444 return true;
445}
446
447void Shaft::AddElevator(int number)
448{
449 //add specified elevator to list
450
451 for (size_t i = 0; i < elevators.size(); i++)
452 {
453 if (elevators[i] == number)
454 return;
455 }
456
457 elevators.emplace_back(number);
458 std::sort(elevators.begin(), elevators.end());
459}
460
461void Shaft::RemoveElevator(int number)
462{
463 //remove specified elevator from list
464 for (size_t i = 0; i < elevators.size(); i++)
465 {
466 if (elevators[i] == number)
467 {
468 elevators.erase(elevators.begin() + i);
469 return;
470 }
471 }
472}
473
474void Shaft::Report(const std::string &message)
475{
476 //general reporting function
477 Object::Report("Shaft " + ToString(ShaftNumber) + ": " + message);
478}
479
480bool Shaft::ReportError(const std::string &message)
481{
482 //general reporting function
483 return Object::ReportError("Shaft " + ToString(ShaftNumber) + ": " + message);
484}
485
486void Shaft::ReplaceTexture(const std::string &oldtexture, const std::string &newtexture)
487{
488 for (size_t i = 0; i < Levels.size(); i++)
489 Levels[i]->ReplaceTexture(oldtexture, newtexture);
490}
491
493{
494 //startup initialization of shafts
495
496 if (ShowFullShaft == false)
497 EnableWhole(false, true);
498 else
499 EnableWhole(true, true, true);
500}
501
502void Shaft::Check(Vector3 position, int current_floor)
503{
505
506 if (!elevator)
507 return;
508
509 ElevatorCar *car = elevator->GetCar(sbs->CarNumber);
510
511 if (!car)
512 return;
513
514 SBS_PROFILE("Shaft::Check");
515
516 if (IsInside(position) == true)
517 {
518 if (InsideShaft == false && sbs->InElevator == false)
519 {
520 //user is in the shaft
521 InsideShaft = true;
522 sbs->InShaft = true;
523 InElevator = false;
524
525 //turn on entire shaft
526 EnableWhole(true, true);
527 }
528 else if (InsideShaft == true && sbs->InElevator == true)
529 {
530 //user has moved from the shaft to an elevator
531 InsideShaft = false;
532 sbs->InShaft = false;
533 InElevator = true;
534
536 }
537 else if (InsideShaft == false && sbs->InElevator == true && ShowFullShaft == false)
538 {
539 //if user is in an elevator, show a range of the shaft at a time (while it's moving)
540 EnableRange(current_floor, sbs->ShaftDisplayRange, true, false);
541 car->ShaftDoorsEnabledRange(0, current_floor, sbs->ShaftDisplayRange);
542 }
543
544 //turn on related floors if ShowFloors is true
545 //display a selected range of floors in the floor list if the user is in a moving elevator
546 if (InsideShaft == false && sbs->InElevator == true && elevator->IsMoving == true && elevator->Leveling == false)
547 {
548 if (ShowFloors == 1)
549 sbs->EnableFloorRange(current_floor, sbs->FloorDisplayRange, true, true, ShaftNumber);
550
551 if (ShowOutside == true)
552 {
553 if (IsShowOutside(current_floor) == true)
554 {
555 sbs->EnableSkybox(true);
556 sbs->EnableBuildings(true);
557 sbs->EnableLandscape(true);
558 sbs->EnableExternal(true);
559 }
560 else
561 {
562 sbs->EnableSkybox(false);
563 sbs->EnableBuildings(false);
564 sbs->EnableLandscape(false);
565 sbs->EnableExternal(false);
566 }
567 }
568 }
569
570 //display the full range of floors in the floor list
571 if (ShowFloors == 2 && ShowFloorsFull_Enabled == false)
572 {
574 for (size_t i = 0; i < ShowFloorsList.size(); i++)
575 {
576 Floor *floor = sbs->GetFloor(ShowFloorsList[i]);
577 if (floor->IsEnabled() == false)
578 {
579 floor->Enabled(true);
580 //floor->EnableGroup(true);
581 }
582 }
583 }
584
585 //display interfloors
586 if (ShowInterfloors == true)
587 {
588 for (size_t i = 0; i < ShowInterfloorsList.size(); i++)
589 {
591 if (floor->IsInterfloorEnabled == false)
592 floor->EnableInterfloor(true);
593 }
594 }
595
596 }
597 else if (InsideShaft == true || InElevator == true)
598 {
599 //user has moved out of the shaft
600 InsideShaft = false;
601 sbs->InShaft = false;
602 InElevator = false;
603
604 //turn off shaft
605 EnableWhole(false, true, true);
606
607 //disable floors listed in ShowFloors list, when "full" mode is enabled
608 if (ShowFloors == 2 && ShowFloorsFull_Enabled == true)
609 {
611 for (size_t i = 0; i < ShowFloorsList.size(); i++)
612 {
613 Floor *floor = sbs->GetFloor(ShowFloorsList[i]);
614 if (floor->IsEnabled() == true && sbs->camera->CurrentFloor != floor->Number)
615 {
616 //don't disable floors that were originally enabled as part of the camera floor's group
617 if ((floor->EnabledGroup == true && floor->EnabledGroup_Floor == sbs->camera->CurrentFloor) == false)
618 {
619 //only disable floor if not part of the camera floor's group
620 if (floor->IsInGroup(sbs->camera->CurrentFloor) == false)
621 {
622 floor->Enabled(false);
623 //floor->EnableGroup(false);
624 }
625 }
626 }
627 }
628 }
629
630 //disable interfloors
631 if (ShowInterfloors == true)
632 {
633 for (size_t i = 0; i < ShowInterfloorsList.size(); i++)
634 {
636 if (floor->IsInterfloorEnabled == true && floor->IsEnabled() == false)
637 floor->EnableInterfloor(false);
638 }
639 }
640 }
641 else if (InsideShaft == false)
642 {
643 //show specified shaft range if outside the shaft
644 EnableRange(current_floor, sbs->ShaftOutsideDisplayRange, true, true);
645 }
646}
647
649{
650 //shaft runloop
651
652 LoopChildren();
653}
654
659
664
665void Shaft::SetShowFull(bool value)
666{
667 ShowFullShaft = value;
668
669 //force the combining of dynamic meshes, since they'll be fully shown
671 DoorWrapper->force_combine = value;
673}
674
675Shaft::Level::Level(Shaft *parent, int number) : Object(parent)
676{
677 //set up SBS object
678 SetValues("Shaft Level", "", true);
679
680 enabled = true;
681 floornum = number;
682 this->parent = parent;
683
684 std::string name;
685 name = "Shaft " + ToString(parent->ShaftNumber) + ": Level " + ToString(number);
686 SetName(name);
687
688 //Create level mesh
689 mesh = new MeshObject(this, parent->GetName() + ":" + ToString(floornum), parent->GetDynamicMesh());
691
692 EnableLoop(true);
693}
694
696{
697 //delete controls
698 for (size_t i = 0; i < ControlArray.size(); i++)
699 {
700 if (ControlArray[i])
701 {
702 ControlArray[i]->parent_deleting = true;
703 delete ControlArray[i];
704 }
705 ControlArray[i] = 0;
706 }
707
708 //delete triggers
709 for (size_t i = 0; i < TriggerArray.size(); i++)
710 {
711 if (TriggerArray[i])
712 {
713 TriggerArray[i]->parent_deleting = true;
714 delete TriggerArray[i];
715 }
716 TriggerArray[i] = 0;
717 }
718
719 //delete models
720 for (size_t i = 0; i < ModelArray.size(); i++)
721 {
722 if (ModelArray[i])
723 {
724 ModelArray[i]->parent_deleting = true;
725 delete ModelArray[i];
726 }
727 ModelArray[i] = 0;
728 }
729
730 //delete primitives
731 for (size_t i = 0; i < PrimArray.size(); i++)
732 {
733 if (PrimArray[i])
734 {
735 PrimArray[i]->parent_deleting = true;
736 delete PrimArray[i];
737 }
738 PrimArray[i] = 0;
739 }
740
741 //delete custom objects
742 for (size_t i = 0; i < CustomObjectArray.size(); i++)
743 {
744 if (CustomObjectArray[i])
745 {
746 CustomObjectArray[i]->parent_deleting = true;
747 delete CustomObjectArray[i];
748 }
749 CustomObjectArray[i] = 0;
750 }
751
752 //delete lights
753 for (size_t i = 0; i < lights.size(); i++)
754 {
755 if (lights[i])
756 {
757 lights[i]->parent_deleting = true;
758 delete lights[i];
759 }
760 lights[i] = 0;
761 }
762
763 //delete doors
764 for (size_t i = 0; i < DoorArray.size(); i++)
765 {
766 if (DoorArray[i])
767 {
768 DoorArray[i]->parent_deleting = true;
769 delete DoorArray[i];
770 }
771 DoorArray[i] = 0;
772 }
773
774 //delete camera textures
775 for (size_t i = 0; i < CameraTextureArray.size(); i++)
776 {
777 if (CameraTextureArray[i])
778 {
779 CameraTextureArray[i]->parent_deleting = true;
780 delete CameraTextureArray[i];
781 }
782 CameraTextureArray[i] = 0;
783 }
784
785 if (mesh)
786 delete mesh;
787 mesh = 0;
788}
789
790Wall* Shaft::Level::AddWall(const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real height1, Real height2, Real voffset1, Real voffset2, Real tw, Real th)
791{
792 //exit with an error if floor is invalid
793 /*if (IsValidFloor(floor) == false)
794 {
795 ReportError("AddWall: Floor " + ToString(floor) + " out of range");
796 return 0;
797 }*/
798
799 Wall *wall = mesh->CreateWallObject(name);
800 AddWall(wall, name, texture, thickness, x1, z1, x2, z2, height1, height2, voffset1, voffset2, tw, th);
801 return wall;
802}
803
804bool Shaft::Level::AddWall(Wall *wall, const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real height1, Real height2, Real voffset1, Real voffset2, Real tw, Real th)
805{
806 //exit with an error if floor is invalid
807 /*if (IsValidFloor(floor) == false)
808 return ReportError("AddWall: Floor " + ToString(floor) + " out of range");*/
809
810 return sbs->AddWallMain(wall, name, texture, thickness, x1, z1, x2, z2, height1, height2, voffset1, voffset2, tw, th, true);
811}
812
813Wall* Shaft::Level::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 legacy_behavior)
814{
815 //exit with an error if floor is invalid
816 /*if (IsValidFloor(floor) == false)
817 {
818 ReportError("AddFloor: Floor " + ToString(floor) + " out of range");
819 return 0;
820 }*/
821
822 Wall *wall = mesh->CreateWallObject(name);
823 AddFloor(wall, name, texture, thickness, x1, z1, x2, z2, voffset1, voffset2, reverse_axis, texture_direction, tw, th, legacy_behavior);
824 return wall;
825}
826
827bool Shaft::Level::AddFloor(Wall *wall, 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)
828{
829 //exit with an error if floor is invalid
830 //if (IsValidFloor(floor) == false)
831 //return ReportError("AddFloor: Floor " + ToString(floor) + " out of range");
832
833 //get shaft extents
834 Real altitude = sbs->GetFloor(floornum)->Altitude;
835
836 //recalculate shaft extents if needed
837 if (altitude + voffset1 < parent->bottom)
838 parent->bottom = altitude + voffset1;
839 if (altitude + voffset2 < parent->bottom)
840 parent->bottom = altitude + voffset2;
841 if (altitude + voffset1 > parent->top)
842 parent->top = altitude + voffset1;
843 if (altitude + voffset2 > parent->top)
844 parent->top = altitude + voffset2;
845
846 return sbs->AddFloorMain(wall, name, texture, thickness, x1, z1, x2, z2, voffset1, voffset2, reverse_axis, texture_direction, tw, th, true, legacy_behavior);
847}
848
849void Shaft::Level::Enabled(bool value, bool EnableShaftDoors)
850{
851 SBS_PROFILE("Shaft::Enabled");
852 if (IsEnabled() != value && parent->EnableCheck == false)
853 {
854 //turns shaft on/off for a specific floor
855
856 mesh->Enabled(value);
857 enabled = value;
858
859 //doors
860 for (size_t i = 0; i < DoorArray.size(); i++)
861 {
862 if (DoorArray[i])
863 DoorArray[i]->Enabled(value);
864 }
865
866 //controls
867 for (size_t i = 0; i < ControlArray.size(); i++)
868 {
869 if (ControlArray[i])
870 ControlArray[i]->Enabled(value);
871 }
872
873 //triggers
874 for (size_t i = 0; i < TriggerArray.size(); i++)
875 {
876 if (TriggerArray[i])
877 TriggerArray[i]->Enabled(value);
878 }
879
880 //models
881 for (size_t i = 0; i < ModelArray.size(); i++)
882 {
883 if (ModelArray[i])
884 ModelArray[i]->Enabled(value);
885 }
886
887 //primitives
888 for (size_t i = 0; i < PrimArray.size(); i++)
889 {
890 if (PrimArray[i])
891 PrimArray[i]->Enabled(value);
892 }
893
894 //custom objects
895 for (size_t i = 0; i < CustomObjectArray.size(); i++)
896 {
897 if (CustomObjectArray[i])
898 CustomObjectArray[i]->Enabled(value);
899 }
900
901 //lights
902 for (size_t i = 0; i < lights.size(); i++)
903 {
904 if (lights[i])
905 lights[i]->Enabled(value);
906 }
907
908 if (EnableShaftDoors == true)
909 {
910 for (size_t i = 0; i < parent->elevators.size(); i++)
911 {
912 Elevator *elevator = sbs->GetElevator(parent->elevators[i]);
913 if (elevator)
914 {
915 for (size_t j = 1; j <= elevator->GetCarCount(); j++)
916 {
917 ElevatorCar *car = elevator->GetCar(j);
918
919 for (size_t k = 0; k < car->ServicedFloors.size(); k++)
920 {
921 if (car->ServicedFloors[k] == floornum)
922 car->ShaftDoorsEnabled(0, car->ServicedFloors[k], value);
923 }
924 }
925 }
926 }
927 }
928 }
929}
930
931bool Shaft::Level::Cut(bool relative, const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, int checkwallnumber)
932{
933 //Cut through a wall segment
934 //the Y values in start and end are both relative to the floor's altitude
935
936 //exit with an error if floor is invalid
937 /*if (IsValidFloor(floor) == false)
938 {
939 if (sbs->Verbose)
940 ReportError("Cut: Floor " + ToString(floor) + " out of range");
941 else
942 sbs->LastError = "Cut: Floor " + ToString(floor) + " out of range";
943 return false;
944 }*/
945
946 if (!sbs->GetFloor(floornum))
947 return false;
948
949 for (size_t i = 0; i < mesh->Walls.size(); i++)
950 {
951 if (!mesh->Walls[i])
952 continue;
953
954 bool reset = true;
955 if (i > 0)
956 reset = false;
957
958 if (relative == true)
959 sbs->GetUtility()->Cut(mesh->Walls[i], Vector3(start.x, start.y, start.z), Vector3(end.x, end.y, end.z), cutwalls, cutfloors, checkwallnumber, reset);
960 else
961 sbs->GetUtility()->Cut(mesh->Walls[i], Vector3(start.x - GetPosition().x, start.y, start.z - GetPosition().z), Vector3(end.x - GetPosition().x, end.y, end.z - GetPosition().z), cutwalls, cutfloors, checkwallnumber, reset);
962 }
963 return true;
964}
965
967{
968 return enabled;
969}
970
972{
973 //remove a light reference (does not delete the object itself)
974 for (size_t i = 0; i < lights.size(); i++)
975 {
976 if (lights[i] == light)
977 {
978 lights.erase(lights.begin() + i);
979 return;
980 }
981 }
982}
983
985{
986 //remove a model reference (does not delete the object itself)
987 for (size_t i = 0; i < ModelArray.size(); i++)
988 {
989 if (ModelArray[i] == model)
990 {
991 ModelArray.erase(ModelArray.begin() + i);
992 return;
993 }
994 }
995}
996
998{
999 //remove a prim reference (does not delete the object itself)
1000 for (size_t i = 0; i < PrimArray.size(); i++)
1001 {
1002 if (PrimArray[i] == prim)
1003 {
1004 PrimArray.erase(PrimArray.begin() + i);
1005 return;
1006 }
1007 }
1008}
1009
1011{
1012 //remove a custom object reference (does not delete the object itself)
1013 for (size_t i = 0; i < CustomObjectArray.size(); i++)
1014 {
1015 if (CustomObjectArray[i] == object)
1016 {
1017 CustomObjectArray.erase(CustomObjectArray.begin() + i);
1018 return;
1019 }
1020 }
1021}
1022
1024{
1025 //remove a control reference (does not delete the object itself)
1026 for (size_t i = 0; i < ControlArray.size(); i++)
1027 {
1028 if (ControlArray[i] == control)
1029 {
1030 ControlArray.erase(ControlArray.begin() + i);
1031 return;
1032 }
1033 }
1034}
1035
1037{
1038 //remove a trigger reference (does not delete the object itself)
1039 for (size_t i = 0; i < TriggerArray.size(); i++)
1040 {
1041 if (TriggerArray[i] == trigger)
1042 {
1043 TriggerArray.erase(TriggerArray.begin() + i);
1044 return;
1045 }
1046 }
1047}
1048
1050{
1051 //returns the mesh object for the specified floor
1052
1053 return mesh;
1054}
1055
1056Light* Shaft::Level::AddLight(const std::string &name, int type)
1057{
1058 //add a global light
1059
1060 Light* light = new Light(this, name, type);
1061 lights.emplace_back(light);
1062 return light;
1063}
1064
1065Light* Shaft::Level::GetLight(const std::string &name)
1066{
1067 for (size_t i = 0; i < lights.size(); i++)
1068 {
1069 if (lights[i]->GetName() == name)
1070 return lights[i];
1071 }
1072 return 0;
1073}
1074
1075Model* Shaft::Level::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)
1076{
1077 //add a model
1078
1079 Model* model = new Model(this, name, filename, center, position, rotation, max_render_distance, scale_multiplier, enable_physics, restitution, friction, mass);
1080 if (model->load_error == true)
1081 {
1082 delete model;
1083 return 0;
1084 }
1085 ModelArray.emplace_back(model);
1086 return model;
1087}
1088
1090{
1091 //add a model reference
1092
1093 if (!model)
1094 return;
1095
1096 for (size_t i = 0; i < ModelArray.size(); i++)
1097 {
1098 if (ModelArray[i] == model)
1099 return;
1100 }
1101
1102 ModelArray.emplace_back(model);
1103}
1104
1105Primitive* Shaft::Level::AddPrimitive(const std::string &name)
1106{
1107 //add a prim
1108 Primitive* prim = new Primitive(this, name);
1109 PrimArray.emplace_back(prim);
1110 return prim;
1111}
1112
1114{
1115 //add a model reference
1116
1117 if (!primitive)
1118 return;
1119
1120 for (size_t i = 0; i < PrimArray.size(); i++)
1121 {
1122 if (PrimArray[i] == primitive)
1123 return;
1124 }
1125
1126 PrimArray.emplace_back(primitive);
1127}
1128
1129CustomObject* Shaft::Level::AddCustomObject(const std::string &name, const Vector3 &position, const Vector3 &rotation, Real max_render_distance, Real scale_multiplier)
1130{
1131 //add a custom object
1132 CustomObject* object = new CustomObject(this, name, position, rotation, max_render_distance, scale_multiplier);
1133 CustomObjectArray.emplace_back(object);
1134 return object;
1135}
1136
1138{
1139 //add a custom object reference
1140
1141 if (!object)
1142 return;
1143
1144 for (size_t i = 0; i < CustomObjectArray.size(); i++)
1145 {
1146 if (CustomObjectArray[i] == object)
1147 return;
1148 }
1149
1150 CustomObjectArray.emplace_back(object);
1151}
1152
1153Control* Shaft::Level::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)
1154{
1155 //add a control
1156
1157 std::vector<Action*> actionnull; //not used
1158 Control* control = new Control(this, name, false, sound, action_names, actionnull, textures, direction, width, height, true, selection_position);
1159 control->Move(CenterX, voffset, CenterZ);
1160 ControlArray.emplace_back(control);
1161 return control;
1162}
1163
1164Trigger* Shaft::Level::AddTrigger(const std::string &name, const std::string &sound_file, Vector3 &area_min, Vector3 &area_max, std::vector<std::string> &action_names)
1165{
1166 //add a trigger
1167
1168 Trigger* trigger = new Trigger(this, name, false, sound_file, area_min, area_max, action_names);
1169 TriggerArray.emplace_back(trigger);
1170 return trigger;
1171}
1172
1174{
1175 //get a model by name
1176
1177 SetCase(name, false);
1178
1179 for (size_t i = 0; i < ModelArray.size(); i++)
1180 {
1181 if (SetCaseCopy(ModelArray[i]->GetName(), false) == name)
1182 return ModelArray[i];
1183 }
1184
1185 return 0;
1186}
1187
1189{
1190 //get a primitive by name
1191
1192 SetCase(name, false);
1193
1194 for (size_t i = 0; i < PrimArray.size(); i++)
1195 {
1196 if (SetCaseCopy(PrimArray[i]->GetName(), false) == name)
1197 return PrimArray[i];
1198 }
1199
1200 return 0;
1201}
1202
1204{
1205 //get a custom object by name
1206
1207 SetCase(name, false);
1208
1209 for (size_t i = 0; i < CustomObjectArray.size(); i++)
1210 {
1211 if (SetCaseCopy(CustomObjectArray[i]->GetName(), false) == name)
1212 return CustomObjectArray[i];
1213 }
1214
1215 return 0;
1216}
1217
1218void Shaft::Level::ReplaceTexture(const std::string &oldtexture, const std::string &newtexture)
1219{
1220 mesh->ReplaceTexture(oldtexture, newtexture);
1221}
1222
1224{
1225 return floornum;
1226}
1227
1229{
1230 //level runloop
1231
1232 LoopChildren();
1233}
1234
1235Door* Shaft::Level::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)
1236{
1237 //add a door
1238
1239 //exit with an error if floor is invalid
1240 /*if (IsValidFloor(floor) == false)
1241 {
1242 ReportError("AddDoor: Floor " + ToString(floor) + " out of range");
1243 return 0;
1244 }*/
1245
1246 Floor *floorptr = sbs->GetFloor(floornum);
1247 if (!floorptr)
1248 return 0;
1249
1250 //set up coordinates
1251 Real x1, z1, x2, z2;
1252 if (face_direction == "left" || face_direction == "right")
1253 {
1254 x1 = CenterX;
1255 x2 = CenterX;
1256 z1 = CenterZ - (width / 2);
1257 z2 = CenterZ + (width / 2);
1258 }
1259 else
1260 {
1261 x1 = CenterX - (width / 2);
1262 x2 = CenterX + (width / 2);
1263 z1 = CenterZ;
1264 z2 = CenterZ;
1265 }
1266
1267 //cut area
1269 if (face_direction == "left" || face_direction == "right")
1270 {
1271 Cut(1, Vector3(x1 - 0.5, voffset, z1), Vector3(x2 + 0.5, voffset + height, z2), true, false, 1);
1272 floorptr->Cut(Vector3(GetPosition().x + x1 - 0.5, floorptr->GetBase(true) + voffset, GetPosition().z + z1), Vector3(GetPosition().x + x2 + 0.5, floorptr->GetBase(true) + voffset + height, GetPosition().z + z2), true, false, true, 2);
1273 }
1274 else
1275 {
1276 Cut(1, Vector3(x1, voffset, z1 - 0.5), Vector3(x2, voffset + height, z2 + 0.5), true, false, 1);
1277 floorptr->Cut(Vector3(GetPosition().x + x1, floorptr->GetBase(true) + voffset, GetPosition().z + z1 - 0.5), Vector3(GetPosition().x + x2, floorptr->GetBase(true) + voffset + height, GetPosition().z + z2 + 0.5), true, false, true, 2);
1278 }
1279
1280 //create doorway walls
1281 sbs->GetUtility()->AddDoorwayWalls(mesh, "Connection Walls", "ConnectionWall", 0, 0);
1282
1283 std::string num = ToString((int)DoorArray.size());
1284 if (name == "")
1285 name = "Door " + num;
1286
1287 Door* door = new Door(this, parent->GetDoorWrapper(), name, open_sound, close_sound, rotate);
1288 door->CreateDoor(open_state, texture, side_texture, thickness, face_direction, open_direction, open_speed, close_speed, CenterX, CenterZ, width, height, floorptr->GetBase(true) + voffset, tw, th, side_tw, side_th);
1289 DoorArray.emplace_back(door);
1290
1291 floorptr = 0;
1292 return door;
1293}
1294
1295Door* Shaft::Level::CreateDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool rotate)
1296{
1297 //start creation of a manual door
1298 //since the door is unfinished, AddDoorComponent and FinishDoor need to be run on the returned Door object
1299
1300 std::string num = ToString((int)DoorArray.size());
1301 if (name == "")
1302 name = "Door " + num;
1303
1304 Door* door = new Door(this, parent->GetDoorWrapper(), name, open_sound, close_sound, rotate);
1305 DoorArray.emplace_back(door);
1306 return door;
1307}
1308
1309Door* Shaft::Level::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 door reference (this does not delete the object)
1322 for (size_t i = 0; i < DoorArray.size(); i++)
1323 {
1324 if (DoorArray[i] == door)
1325 {
1326 DoorArray.erase(DoorArray.begin() + i);
1327 return;
1328 }
1329 }
1330}
1331
1332CameraTexture* Shaft::Level::AddCameraTexture(const std::string &name, int quality, Real fov, const Vector3 &position, bool use_rotation, const Vector3 &rotation)
1333{
1334 //add a camera texture
1335 CameraTexture* cameratexture = new CameraTexture(this, name, quality, fov, position, use_rotation, rotation);
1336 CameraTextureArray.emplace_back(cameratexture);
1337 return cameratexture;
1338}
1339
1341{
1342 //remove a cameratexture reference (does not delete the object itself)
1343 for (size_t i = 0; i < CameraTextureArray.size(); i++)
1344 {
1345 if (CameraTextureArray[i] == camtex)
1346 {
1347 CameraTextureArray.erase(CameraTextureArray.begin() + i);
1348 return;
1349 }
1350 }
1351}
1352
1353}
int CurrentFloor
Definition camera.h:49
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
void Enabled(bool value, MeshObject *client=0)
void ShaftDoorsEnabled(int number, int floor, bool value)
std::vector< int > ServicedFloors
Definition elevatorcar.h:38
void ShaftDoorsEnabledRange(int number, int floor, int range)
ElevatorCar * GetCar(int number)
bool Leveling
Definition elevator.h:90
bool IsMoving
Definition elevator.h:60
int EnabledGroup_Floor
Definition floor.h:52
bool IsInGroup(int floor)
Definition floor.cpp:770
bool IsEnabled()
Definition floor.cpp:573
void Cut(const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, bool fast, int checkwallnumber=0, bool prepare=false)
Definition floor.cpp:613
int Number
Definition floor.h:36
Real FullHeight()
Definition floor.cpp:577
void EnableInterfloor(bool value)
Definition floor.cpp:889
Real Altitude
Definition floor.h:43
Real GetBase(bool relative=false)
Definition floor.cpp:1146
bool EnabledGroup
Definition floor.h:51
bool IsInterfloorEnabled
Definition floor.h:47
void Enabled(bool value)
Definition floor.cpp:378
std::vector< Wall * > Walls
Definition mesh.h:99
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 SetPosition(const Vector3 &position, bool relative=false, bool force=false)
Definition object.cpp:280
virtual void SetPositionY(Real value, bool force=false)
Definition object.cpp:299
Elevator * GetElevator(int number)
Definition sbs.cpp:1776
void EnableBuildings(bool value)
Definition sbs.cpp:1518
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
int CarNumber
Definition sbs.h:166
bool InShaft
Definition sbs.h:164
int FloorDisplayRange
Definition sbs.h:182
void RemoveShaft(Shaft *shaft)
Definition sbs.cpp:2817
MeshObject * External
Definition sbs.h:424
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
int ShaftDisplayRange
Definition sbs.h:178
Floor * GetFloor(int number)
Definition sbs.cpp:1769
Utility * GetUtility()
Definition sbs.cpp:4641
int ShaftOutsideDisplayRange
Definition sbs.h:180
bool FastDelete
Definition sbs.h:188
Camera * camera
Definition sbs.h:160
void EnableLandscape(bool value)
Definition sbs.cpp:1525
void EnableSkybox(bool value)
Definition sbs.cpp:1541
int ElevatorNumber
Definition sbs.h:165
void EnableExternal(bool value)
Definition sbs.cpp:1532
void EnableFloorRange(int floor, int range, bool value, bool enablegroups, int shaftnumber=0, int stairsnumber=0)
Definition sbs.cpp:2016
bool InElevator
Definition sbs.h:163
int Floors
Definition sbs.h:158
void RemoveCustomObject(CustomObject *object)
Definition shaft.cpp:1010
Door * GetDoor(const std::string &name)
Definition shaft.cpp:1309
Primitive * GetPrimitive(std::string name)
Definition shaft.cpp:1188
CustomObject * AddCustomObject(const std::string &name, const Vector3 &position, const Vector3 &rotation, Real max_render_distance=0, Real scale_multiplier=1)
Definition shaft.cpp:1129
void Enabled(bool value, bool EnableShaftDoors)
Definition shaft.cpp:849
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 shaft.cpp:1153
CustomObject * GetCustomObject(std::string name)
Definition shaft.cpp:1203
void RemovePrimitive(Primitive *prim)
Definition shaft.cpp:997
Model * GetModel(std::string name)
Definition shaft.cpp:1173
Primitive * AddPrimitive(const std::string &name)
Definition shaft.cpp:1105
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 shaft.cpp:1075
void RemoveCameraTexture(CameraTexture *camtex)
Definition shaft.cpp:1340
Wall * AddWall(const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real height1, Real height2, Real voffset1, Real voffset2, Real tw, Real th)
Definition shaft.cpp:790
Trigger * AddTrigger(const std::string &name, const std::string &sound_file, Vector3 &area_min, Vector3 &area_max, std::vector< std::string > &action_names)
Definition shaft.cpp:1164
Door * AddDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool open_state, const std::string &texture, const std::string &side_texture, Real thickness, const std::string &face_direction, const std::string &open_direction, bool rotate, Real open_speed, Real close_speed, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th)
Definition shaft.cpp:1235
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 legacy_behavior=false)
Definition shaft.cpp:813
Shaft * parent
Definition shaft.h:153
void RemoveLight(Light *light)
Definition shaft.cpp:971
Light * AddLight(const std::string &name, int type)
Definition shaft.cpp:1056
Level(Shaft *parent, int number)
Definition shaft.cpp:675
void RemoveModel(Model *model)
Definition shaft.cpp:984
void RemoveControl(Control *control)
Definition shaft.cpp:1023
void ReplaceTexture(const std::string &oldtexture, const std::string &newtexture)
Definition shaft.cpp:1218
Light * GetLight(const std::string &name)
Definition shaft.cpp:1065
bool Cut(bool relative, const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, int checkwallnumber=0)
Definition shaft.cpp:931
void RemoveDoor(Door *door)
Definition shaft.cpp:1319
Door * CreateDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool rotate)
Definition shaft.cpp:1295
MeshObject * GetMeshObject()
Definition shaft.cpp:1049
CameraTexture * AddCameraTexture(const std::string &name, int quality, Real fov, const Vector3 &position, bool use_rotation, const Vector3 &rotation)
Definition shaft.cpp:1332
MeshObject * mesh
Definition shaft.h:126
void RemoveTrigger(Trigger *trigger)
Definition shaft.cpp:1036
Shaft(Object *parent, int number, Real CenterX, Real CenterZ, int startfloor, int endfloor)
Definition shaft.cpp:48
bool IsInside(const Vector3 &position)
Definition shaft.cpp:176
DynamicMesh * GetDynamicMesh()
Definition shaft.cpp:655
void OnInit()
Definition shaft.cpp:492
int endfloor
Definition shaft.h:36
void AddShowInterfloor(int floor)
Definition shaft.cpp:397
std::vector< Level * > Levels
Definition shaft.h:157
void Loop()
Definition shaft.cpp:648
Vector3 lastposition
Definition shaft.h:170
bool ShowFloorsFull_Enabled
Definition shaft.h:174
void AddElevator(int number)
Definition shaft.cpp:447
Vector2 cutstart
Definition shaft.h:41
void RemoveElevator(int number)
Definition shaft.cpp:461
std::vector< int > ShowFloorsList
Definition shaft.h:158
void RemoveShowOutside(int floor)
Definition shaft.cpp:371
void Report(const std::string &message)
Definition shaft.cpp:474
DynamicMesh * dynamic_mesh
Definition shaft.h:177
void RemoveShowInterfloor(int floor)
Definition shaft.cpp:408
bool IsShowOutside(int floor)
Definition shaft.cpp:385
bool checkfirstrun
Definition shaft.h:172
bool IsShowInterfloor(int floor)
Definition shaft.cpp:422
std::vector< int > elevators
Definition shaft.h:37
void EnableWhole(bool value, bool EnableShaftDoors, bool force=false)
Definition shaft.cpp:146
void CutFloors(bool relative, const Vector2 &start, const Vector2 &end, Real startvoffset, Real endvoffset)
Definition shaft.cpp:209
Real top
Definition shaft.h:40
void ReplaceTexture(const std::string &oldtexture, const std::string &newtexture)
Definition shaft.cpp:486
DynamicMesh * GetDoorWrapper()
Definition shaft.cpp:660
void RemoveShowFloor(int floor)
Definition shaft.cpp:334
bool ShowOutside
Definition shaft.h:45
void SetShowFull(bool value)
Definition shaft.cpp:665
int ShowFloors
Definition shaft.h:44
bool EnableCheck
Definition shaft.h:47
std::vector< int > ShowInterfloorsList
Definition shaft.h:160
void Check(Vector3 position, int current_floor)
Definition shaft.cpp:502
Vector2 cutend
Definition shaft.h:42
bool IsShowFloor(int floor)
Definition shaft.cpp:348
bool ShowInterfloors
Definition shaft.h:46
bool IsValidFloor(int floor)
Definition shaft.cpp:434
bool ReportError(const std::string &message)
Definition shaft.cpp:480
void AddShowFloor(int floor)
Definition shaft.cpp:323
DynamicMesh * ShaftDoorContainer
Definition shaft.h:167
int ShaftNumber
Definition shaft.h:34
bool ShowFullShaft
Definition shaft.h:161
int startfloor
Definition shaft.h:35
DynamicMesh * DoorWrapper
Definition shaft.h:164
void EnableRange(int floor, int range, bool value, bool EnableShaftDoors)
Definition shaft.cpp:271
Real bottom
Definition shaft.h:39
bool lastcheckresult
Definition shaft.h:171
std::vector< int > ShowOutsideList
Definition shaft.h:159
void AddShowOutside(int floor)
Definition shaft.cpp:360
bool InsideShaft
Definition shaft.h:38
bool InElevator
Definition shaft.h:173
Level * GetLevel(int floor)
Definition shaft.cpp:136
bool IsEnabled
Definition shaft.h:43
void ResetDoorwayWalls()
Definition utility.cpp:518
Wall * AddDoorwayWalls(MeshObject *mesh, const std::string &wallname, const std::string &texture, Real tw, Real th)
Definition utility.cpp:529
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
Ogre::Vector2 Vector2
Definition globals.h:59
std::string TruncateNumber(float value, int decimals)
Definition globals.cpp:416
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
bool IsEven(int Number)
Definition globals.cpp:37
#define SBS_PROFILE(name)
Definition profiler.h:131
void Enabled(bool value)