Skyscraper 2.0
floor.h
Go to the documentation of this file.
1/*
2 Scalable Building Simulator - Floor Object
3 The Skyscraper Project - Version 2.0
4 Copyright (C)2004-2024 Ryan Thoryk
5 https://www.skyscrapersim.net
6 https://sourceforge.net/projects/skyscraper/
7 Contact - ryan@skyscrapersim.net
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22*/
23
24#ifndef _SBS_FLOOR_H
25#define _SBS_FLOOR_H
26
27namespace SBS {
28
29class SBSIMPEXP Floor : public Object
30{
31public:
32 MeshObject *Level; //level mesh
33 MeshObject *Interfloor; //interfloor mesh
34 MeshObject *ColumnFrame; //columnframe mesh
35
36 int Number; //floor number
37 std::string Name; //floor name
38 std::string ID;
39 std::string NumberID; //number ID of floor, for use with Destination Dispatch keypads
40 std::string FloorType;
41 std::string Description;
42 std::string IndicatorTexture; //elevator indicator texture name
43 Real Altitude; //floor altitude
44 Real Height; //floor height (not including interfloor height)
45 Real InterfloorHeight; //height of interfloor area
46 bool IsEnabled; //is floor enabled?
47 bool IsColumnFrameEnabled; //is columnframe enabled?
48 bool IsInterfloorEnabled; //is interfloor enabled?
49 std::vector<CallStation*> CallStationArray; //pointer array to call station objects
50 std::vector<FloorIndicator*> FloorIndicatorArray; //pointer array to floor indicator objects
51 std::vector<int> Group; //floor group
52 bool EnabledGroup; //true if floor was enabled as part of a group, not directly
53 int EnabledGroup_Floor; //number of floor that enabled this floor as part of it's own group
54 bool AltitudeSet; //has altitude been set?
55
56 //functions
57 Floor(Object *parent, FloorManager *manager, int number);
58 ~Floor();
59 Wall* AddFloor(const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real voffset1, Real voffset2, bool reverse_axis, bool texture_direction, Real tw, Real th, bool isexternal, bool legacy_behavior = false);
60 Wall* AddInterfloorFloor(const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real voffset1, Real voffset2, bool reverse_axis, bool texture_direction, Real tw, Real th, bool legacy_behavior = false);
61 Wall* AddWall(const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real height_in1, Real height_in2, Real voffset1, Real voffset2, Real tw, Real th, bool isexternal);
62 Wall* AddInterfloorWall(const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real height_in1, Real height_in2, Real voffset1, Real voffset2, Real tw, Real th);
63 void Enabled(bool value);
64 Real FullHeight();
65 CallStation* AddCallButtons(int controller, const std::string &sound_file_up, const std::string &sound_file_down, const std::string &BackTexture, const std::string &UpButtonTexture, const std::string &UpButtonTexture_Lit, const std::string &DownButtonTexture, const std::string &DownButtonTexture_Lit, Real CenterX, Real CenterZ, Real voffset, const std::string &direction, Real BackWidth, Real BackHeight, bool ShowBack, Real tw, Real th);
66 CallStation* AddCallStation(int number);
67 void Cut(const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, bool fast, int checkwallnumber = 0, bool prepare = false);
68 void CutAll(const Vector3 &start, const Vector3 &end, bool cutwalls, bool cutfloors, bool prepare = false);
69 void AddGroupFloor(int number);
70 void RemoveGroupFloor(int number);
71 void EnableGroup(bool value);
72 bool IsInGroup(int floor);
73 Door* AddDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool open_state, const std::string &texture, const std::string &side_texture, Real thickness, const std::string &face_direction, const std::string &open_direction, bool rotate, Real open_speed, Real close_speed, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th, bool external = false);
74 Door* CreateDoor(std::string name, const std::string &open_sound, const std::string &close_sound, bool rotate);
75 Door* GetDoor(const std::string &name);
76 bool CalculateAltitude();
77 void EnableColumnFrame(bool value);
78 void EnableInterfloor(bool value);
79 Wall* ColumnWallBox(const std::string &name, const std::string &texture, Real x1, Real x2, Real z1, Real z2, Real height_in, Real voffset, Real tw, Real th, bool inside, bool outside, bool top, bool bottom);
80 Wall* ColumnWallBox2(const std::string &name, const std::string &texture, Real CenterX, Real CenterZ, Real WidthX, Real LengthZ, Real height_in, Real voffset, Real tw, Real th, bool inside, bool outside, bool top, bool bottom);
81 FloorIndicator* AddFloorIndicator(int elevator, int car, bool relative, const std::string &texture_prefix, const std::string &blank_texture, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real height, Real voffset);
82 void UpdateFloorIndicators(int elevator);
83 void UpdateFloorIndicators();
84 void UpdateDirectionalIndicators(int elevator);
85 void UpdateDirectionalIndicators();
86 DirectionalIndicator* AddDirectionalIndicator(int elevator, int car, bool relative, bool active_direction, bool single, bool vertical, const std::string &BackTexture, const std::string &uptexture, const std::string &uptexture_lit, const std::string &downtexture, const std::string &downtexture_lit, Real CenterX, Real CenterZ, Real voffset, const std::string &direction, Real BackWidth, Real BackHeight, bool ShowBack, Real tw, Real th);
87 void SetDirectionalIndicators(int elevator, int car, bool UpLight, bool DownLight);
88 void Loop();
89 std::vector<int> GetCallStations(int elevator);
90 CallStation* GetCallStationForElevator(int elevator);
91 CallStation* GetCallStation(int number);
92 void AddFillerWalls(const std::string &texture, Real thickness, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, bool direction, Real tw, Real th, bool isexternal);
93 Sound* AddSound(const std::string &name, const std::string &filename, Vector3 position, bool loop = true, Real volume = 1.0, int speed = 100, Real min_distance = 1.0, Real max_distance = -1.0, Real doppler_level = 0.0, Real cone_inside_angle = 360, Real cone_outside_angle = 360, Real cone_outside_volume = 1.0, Vector3 direction = Vector3(0, 0, 0));
94 Reverb* AddReverb(const std::string &name, const std::string &type, const Vector3 &position, Real min_distance, Real max_distance);
95 void Report(const std::string &message);
96 bool ReportError(const std::string &message);
97 Real GetBase(bool relative = false);
98 Door* GetDoor(int number);
99 void RemoveCallStation(CallStation* station);
100 void RemoveFloorIndicator(FloorIndicator *indicator);
101 void RemoveDirectionalIndicator(DirectionalIndicator *indicator);
102 void RemoveDoor(Door *door);
103 void RemoveSound(Sound *sound);
104 void RemoveReverb(Reverb *reverb);
105 void RemoveLight(Light *light);
106 void RemoveModel(Model *model);
107 void RemovePrimitive(Primitive *prim);
108 void RemoveCustomObject(CustomObject *object);
109 void RemoveControl(Control *control);
110 void RemoveTrigger(Trigger *trigger);
111 void RemoveCameraTexture(CameraTexture *cameratexture);
112 void RemoveEscalator(Escalator *escalator);
113 void RemoveMovingWalkway(MovingWalkway *walkway);
114 Light* AddLight(const std::string &name, int type);
115 Light* GetLight(const std::string &name);
116 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);
117 void AddModel(Model *model);
118 Primitive* AddPrimitive(const std::string &name);
119 void AddPrimitive(Primitive *primitive);
120 CustomObject* AddCustomObject(const std::string &name, const Vector3 &position, const Vector3 &rotation, Real max_render_distance = 0, Real scale_multiplier = 1);
121 void AddCustomObject(CustomObject *object);
122 void ReplaceTexture(const std::string &oldtexture, const std::string &newtexture);
123 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);
124 Trigger* AddTrigger(const std::string &name, const std::string &sound_file, Vector3 &area_min, Vector3 &area_max, std::vector<std::string> &action_names);
125 CameraTexture* AddCameraTexture(const std::string &name, int quality, Real fov, const Vector3 &position, bool use_rotation, const Vector3 &rotation);
126 Escalator* AddEscalator(const std::string &name, int run, Real speed, const std::string &sound_file, const std::string &riser_texture, const std::string &tread_texture, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real risersize, Real treadsize, int num_steps, Real voffset, Real tw, Real th);
127 MovingWalkway* AddMovingWalkway(const std::string &name, int run, Real speed, const std::string &sound_file, const std::string &texture, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real treadsize, int num_steps, Real voffset, Real tw, Real th);
128 std::vector<Sound*> GetSound(const std::string &name);
129 Reverb* GetReverb(const std::string &name);
130 void SetAltitude(Real altitude);
131 void ShowInfo(bool detailed = true, bool display_header = true);
132 void GetElevatorList(std::vector<int> &listing, bool get_locals = true, bool get_express = true, bool get_service = true);
133 void GetStairwellList(std::vector<int> &listing);
134 void GetShaftList(std::vector<int> &listing);
135 ElevatorRoute* GetDirectRoute(int DestinationFloor, std::string ElevatorType);
136 std::vector<int> GetDirectFloors(bool include_service);
137 Model* GetModel(std::string name);
138 Primitive* GetPrimitive(std::string name);
139 CustomObject* GetCustomObject(std::string name);
140 RevolvingDoor* AddRevolvingDoor(std::string name, bool run, const std::string &soundfile, const std::string &texture, Real thickness, bool clockwise, int segments, Real speed, Real rotation, Real CenterX, Real CenterZ, Real width, Real height, Real voffset, Real tw, Real th, bool external);
141 void RemoveRevolvingDoor(RevolvingDoor *door);
142 RevolvingDoor* GetRevolvingDoor(int number);
143 CameraTexture* GetCameraTexture(int number);
144 int GetCallStationCount();
145 int GetReverbCount();
146 Reverb* GetReverb(int index);
147
148private:
149 //sound objects
150 std::vector<Sound*> sounds;
151
152 //reverb objects
153 std::vector<Reverb*> reverbs;
154
155 //doors
156 std::vector<Door*> DoorArray; //pointer array to door objects
157 std::vector<RevolvingDoor*> RDoorArray; //pointer array to revolving door objects
158 DynamicMesh *DoorWrapper; //door dynamic mesh wrapper
159
160 //lights
161 std::vector<Light*> lights;
162
163 //directional indicators
164 std::vector<DirectionalIndicator*> DirIndicatorArray;
165
166 //Models
167 std::vector<Model*> ModelArray;
168
169 //Primitives
170 std::vector<Primitive*> PrimArray;
171
172 //custom objects
173 std::vector<CustomObject*> CustomObjectArray;
174
175 //Controls
176 std::vector<Control*> ControlArray;
177
178 //Triggers
179 std::vector<Trigger*> TriggerArray;
180
181 //CameraTextures
182 std::vector<CameraTexture*> CameraTextureArray;
183
184 //Escalators
185 std::vector<Escalator*> EscalatorArray;
186
187 //Moving walkways
188 std::vector<MovingWalkway*> MovingWalkwayArray;
189};
190
191}
192
193#endif
std::vector< CustomObject * > CustomObjectArray
Definition floor.h:173
int EnabledGroup_Floor
Definition floor.h:53
std::vector< FloorIndicator * > FloorIndicatorArray
Definition floor.h:50
std::string IndicatorTexture
Definition floor.h:42
int Number
Definition floor.h:36
std::vector< Trigger * > TriggerArray
Definition floor.h:179
std::vector< Escalator * > EscalatorArray
Definition floor.h:185
std::string Name
Definition floor.h:37
MeshObject * ColumnFrame
Definition floor.h:34
std::vector< DirectionalIndicator * > DirIndicatorArray
Definition floor.h:164
bool IsEnabled
Definition floor.h:46
std::vector< Door * > DoorArray
Definition floor.h:156
MeshObject * Level
Definition floor.h:32
DynamicMesh * DoorWrapper
Definition floor.h:158
Real Altitude
Definition floor.h:43
std::string FloorType
Definition floor.h:40
std::vector< CallStation * > CallStationArray
Definition floor.h:49
bool IsColumnFrameEnabled
Definition floor.h:47
std::vector< Primitive * > PrimArray
Definition floor.h:170
std::string ID
Definition floor.h:38
bool EnabledGroup
Definition floor.h:52
std::vector< Light * > lights
Definition floor.h:161
std::vector< Sound * > sounds
Definition floor.h:150
Real Height
Definition floor.h:44
std::vector< RevolvingDoor * > RDoorArray
Definition floor.h:157
std::vector< MovingWalkway * > MovingWalkwayArray
Definition floor.h:188
std::vector< Model * > ModelArray
Definition floor.h:167
bool IsInterfloorEnabled
Definition floor.h:48
bool AltitudeSet
Definition floor.h:54
std::vector< Control * > ControlArray
Definition floor.h:176
std::vector< Reverb * > reverbs
Definition floor.h:153
MeshObject * Interfloor
Definition floor.h:33
Real InterfloorHeight
Definition floor.h:45
std::vector< int > Group
Definition floor.h:51
std::string NumberID
Definition floor.h:39
std::string Description
Definition floor.h:41
std::vector< CameraTexture * > CameraTextureArray
Definition floor.h:182
Ogre::Vector3 Vector3
Definition globals.h:58
Ogre::Real Real
Definition globals.h:57
#define SBSIMPEXP
Definition globals.h:53