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