OSDN Git Service

4c0d1fb36aa378ae35b719f26fbe4eda59a8f5a4
[skyscrapersim/skyscraper.git] / src / sbs / floor.h
1 /* $Id$ */
2
3 /*
4         Scalable Building Simulator - Floor Object
5         The Skyscraper Project - Version 1.11 Alpha
6         Copyright (C)2004-2016 Ryan Thoryk
7         http://www.skyscrapersim.com
8         http://sourceforge.net/projects/skyscraper
9         Contact - ryan@skyscrapersim.com
10
11         This program is free software; you can redistribute it and/or
12         modify it under the terms of the GNU General Public License
13         as published by the Free Software Foundation; either version 2
14         of the License, or (at your option) any later version.
15
16         This program is distributed in the hope that it will be useful,
17         but WITHOUT ANY WARRANTY; without even the implied warranty of
18         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19         GNU General Public License for more details.
20
21         You should have received a copy of the GNU General Public License
22         along with this program; if not, write to the Free Software
23         Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24 */
25
26 #ifndef _SBS_FLOOR_H
27 #define _SBS_FLOOR_H
28
29 namespace SBS {
30
31 class SBSIMPEXP Floor : public Object
32 {
33 public:
34         MeshObject *Level; //level mesh
35         MeshObject *Interfloor; //interfloor mesh
36         MeshObject *ColumnFrame; //columnframe mesh
37
38         int Number; //floor number
39         std::string Name; //floor name
40         std::string ID;
41         std::string FloorType;
42         std::string Description;
43         std::string IndicatorTexture; //elevator indicator texture name
44         float Altitude; //floor altitude
45         float Height; //floor height (not including interfloor height)
46         float InterfloorHeight; //height of interfloor area
47         bool IsEnabled; //is floor enabled?
48         bool IsColumnFrameEnabled; //is columnframe enabled?
49         bool IsInterfloorEnabled; //is interfloor enabled?
50         std::vector<CallButton*> CallButtonArray; //pointer array to call button objects
51         std::vector<FloorIndicator*> FloorIndicatorArray; //pointer array to floor indicator objects
52         std::vector<int> Group; //floor group
53         bool EnabledGroup; //true if floor was enabled as part of a group, not directly
54         int EnabledGroup_Floor; //number of floor that enabled this floor as part of it's own group
55         bool AltitudeSet; //has altitude been set?
56
57         //functions
58         Floor(Object *parent, FloorManager *manager, int number);
59         ~Floor();
60         Wall* AddFloor(const std::string &name, const std::string &texture, float thickness, float x1, float z1, float x2, float z2, float voffset1, float voffset2, bool reverse_axis, bool texture_direction, float tw, float th, bool isexternal, bool legacy_behavior = false);
61         Wall* AddInterfloorFloor(const std::string &name, const std::string &texture, float thickness, float x1, float z1, float x2, float z2, float voffset1, float voffset2, bool reverse_axis, bool texture_direction, float tw, float th, bool legacy_behavior = false);
62         Wall* AddWall(const std::string &name, const std::string &texture, float thickness, float x1, float z1, float x2, float z2, float height_in1, float height_in2, float voffset1, float voffset2, float tw, float th, bool isexternal);
63         Wall* AddInterfloorWall(const std::string &name, const std::string &texture, float thickness, float x1, float z1, float x2, float z2, float height_in1, float height_in2, float voffset1, float voffset2, float tw, float th);
64         void Enabled(bool value);
65         float FullHeight();
66         CallButton* AddCallButtons(std::vector<int> &elevators, const std::string &sound_file, const std::string &BackTexture, const std::string &UpButtonTexture, const std::string &UpButtonTexture_Lit, const std::string &DownButtonTexture, const std::string &DownButtonTexture_Lit, float CenterX, float CenterZ, float voffset, const std::string &direction, float BackWidth, float BackHeight, bool ShowBack, float tw, float th);
67         void Cut(const Ogre::Vector3 &start, const Ogre::Vector3 &end, bool cutwalls, bool cutfloors, bool fast, int checkwallnumber = 0, bool prepare = false);
68         void CutAll(const Ogre::Vector3 &start, const Ogre::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(const std::string &open_sound, const std::string &close_sound, bool open_state, const std::string &texture, float thickness, int direction, float speed, float CenterX, float CenterZ, float width, float height, float voffset, float tw, float th, bool external = false);
74         bool CalculateAltitude();
75         void EnableColumnFrame(bool value);
76         void EnableInterfloor(bool value);
77         Wall* ColumnWallBox(const std::string &name, const std::string &texture, float x1, float x2, float z1, float z2, float height_in, float voffset, float tw, float th, bool inside, bool outside, bool top, bool bottom);
78         Wall* ColumnWallBox2(const std::string &name, const std::string &texture, float CenterX, float CenterZ, float WidthX, float LengthZ, float height_in, float voffset, float tw, float th, bool inside, bool outside, bool top, bool bottom);
79         FloorIndicator* AddFloorIndicator(int elevator, int car, bool relative, const std::string &texture_prefix, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset);
80         void UpdateFloorIndicators(int elevator);
81         void UpdateFloorIndicators();
82         void UpdateDirectionalIndicators(int elevator);
83         void UpdateDirectionalIndicators();
84         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, float CenterX, float CenterZ, float voffset, const std::string &direction, float BackWidth, float BackHeight, bool ShowBack, float tw, float th);
85         void SetDirectionalIndicators(int elevator, int car, bool UpLight, bool DownLight);
86         void Loop();
87         std::vector<int> GetCallButtons(int elevator);
88         CallButton* GetCallButton(int elevator);
89         void AddFillerWalls(const std::string &texture, float thickness, float CenterX, float CenterZ, float width, float height, float voffset, bool direction, float tw, float th, bool isexternal);
90         Sound* AddSound(const std::string &name, const std::string &filename, Ogre::Vector3 position, bool loop = true, float volume = 1.0, int speed = 100, float min_distance = 1.0, float max_distance = -1.0, float doppler_level = 0.0, float cone_inside_angle = 360, float cone_outside_angle = 360, float cone_outside_volume = 1.0, Ogre::Vector3 direction = Ogre::Vector3(0, 0, 0));
91         void Report(const std::string &message);
92         bool ReportError(const std::string &message);
93         float GetBase(bool relative = false);
94         Door* GetDoor(int number);
95         void RemoveCallButton(CallButton *callbutton);
96         void RemoveFloorIndicator(FloorIndicator *indicator);
97         void RemoveDirectionalIndicator(DirectionalIndicator *indicator);
98         void RemoveDoor(Door *door);
99         void RemoveSound(Sound *sound);
100         void RemoveLight(Light *light);
101         void RemoveModel(Model *model);
102         void RemoveControl(Control *control);
103         void RemoveTrigger(Trigger *trigger);
104         void RemoveCameraTexture(CameraTexture *cameratexture);
105         void RemoveEscalator(Escalator *escalator);
106         Light* AddLight(const std::string &name, int type, Ogre::Vector3 position, Ogre::Vector3 direction, float color_r, float color_g, float color_b, float spec_color_r, float spec_color_g, float spec_color_b, float spot_inner_angle, float spot_outer_angle, float spot_falloff, float att_range, float att_constant, float att_linear, float att_quadratic);
107         Model* AddModel(const std::string &name, const std::string &filename, bool center, Ogre::Vector3 position, Ogre::Vector3 rotation, float max_render_distance = 0, float scale_multiplier = 1, bool enable_physics = false, float restitution = 0, float friction = 0, float mass = 0);
108         void AddModel(Model *model);
109         void ReplaceTexture(const std::string &oldtexture, const std::string &newtexture);
110         Control* AddControl(const std::string &name, const std::string &sound, const std::string &direction, float CenterX, float CenterZ, float width, float height, float voffset, int selection_position, std::vector<std::string> &action_names, std::vector<std::string> &textures);
111         Trigger* AddTrigger(const std::string &name, const std::string &sound_file, Ogre::Vector3 &area_min, Ogre::Vector3 &area_max, std::vector<std::string> &action_names);
112         CameraTexture* AddCameraTexture(const std::string &name, bool enabled, int quality, float fov, Ogre::Vector3 position, bool use_rotation, Ogre::Vector3 rotation);
113         Escalator* AddEscalator(const std::string &name, bool run, bool run_direction, float speed, const std::string &sound_file, const std::string &texture, const std::string &direction, float CenterX, float CenterZ, float width, float risersize, float treadsize, int num_steps, float voffset, float tw, float th);
114         std::vector<Sound*> GetSound(const std::string &name);
115         void SetAltitude(float altitude);
116         void ShowInfo(bool detailed = true, bool display_header = true);
117         void GetElevatorList(std::vector<int> &listing, bool get_locals = true, bool get_express = true, bool get_service = true);
118         void GetStairsList(std::vector<int> &listing);
119         void GetShaftList(std::vector<int> &listing);
120         ElevatorRoute* GetDirectRoute(int DestinationFloor, std::string ElevatorType);
121         std::vector<int> GetDirectFloors(bool include_service);
122         Model* GetModel(std::string name);
123         RevolvingDoor* AddRevolvingDoor(const std::string &soundfile, const std::string &texture, float thickness, bool clockwise, int segments, float speed, float rotation, float CenterX, float CenterZ, float width, float height, float voffset, float tw, float th, bool external);
124         void RemoveRevolvingDoor(RevolvingDoor *door);
125         RevolvingDoor* GetRevolvingDoor(int number);
126
127 private:
128         //sound objects
129         std::vector<Sound*> sounds;
130
131         //doors
132         std::vector<Door*> DoorArray; //pointer array to door objects
133         std::vector<RevolvingDoor*> RDoorArray; //pointer array to revolving door objects
134         DynamicMesh *DoorWrapper; //door dynamic mesh wrapper
135
136         //lights
137         std::vector<Light*> lights;
138
139         //directional indicators
140         std::vector<DirectionalIndicator*> DirIndicatorArray;
141
142         //Models
143         std::vector<Model*> ModelArray;
144
145         //Controls
146         std::vector<Control*> ControlArray;
147
148         //Triggers
149         std::vector<Trigger*> TriggerArray;
150
151         //CameraTextures
152         std::vector<CameraTexture*> CameraTextureArray;
153
154         //Escalators
155         std::vector<Escalator*> EscalatorArray;
156 };
157
158 }
159
160 #endif