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