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