Skyscraper 2.0
door.h
Go to the documentation of this file.
1/*
2 Scalable Building Simulator - Door 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_DOOR_H
25#define _SBS_DOOR_H
26
27#include "lock.h"
28
29namespace SBS {
30
31struct DoorWrapper;
32
33class SBSIMPEXP Door : public Object, public DoorLock
34{
35public:
36
39 bool IsMoving; //is door moving?
40 bool OpenDoor; //open or close door?
41 std::string OpenSound; //opening sound
42 std::string CloseSound; //closing sound
43
44 Door(Object *parent, DynamicMesh *wrapper, const std::string &name, const std::string &open_sound, const std::string &close_sound, bool rotate);
45 ~Door();
46 bool Open(Vector3 &position, bool playsound = true, bool force = false);
47 void Close(bool playsound = true);
48 bool IsOpen();
49 void Enabled(bool value);
50 bool IsEnabled() { return is_enabled; }
51 void Loop();
52 void ClickDoor(Vector3 &position);
53 void OnClick(Vector3 &position, bool shift, bool ctrl, bool alt, bool right);
54 void Report(const std::string &message);
55 bool ReportError(const std::string &message);
56 bool GetDoorChanged();
57 bool GetPreviousOpen();
58 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);
59 DoorWrapper* AddDoorComponent(const std::string &name, const std::string &texture, const std::string &sidetexture, Real thickness, const std::string &face_direction, const std::string &open_direction, bool OpenClockwise, Real OpenSpeed, Real CloseSpeed, Real x1, Real z1, Real x2, Real z2, Real height, Real voffset, Real tw, Real th, Real side_tw, Real side_th);
60 DoorWrapper* FinishDoor(bool open_state);
61 void AutoClose(int interval);
62
63private:
64 void MoveDoor();
65
66 DoorWrapper *door; //door wrapper
68
69 //sound object
71
75 bool running;
76
77 //timer object
78 class Timer; //internal timer class
81};
82
83}
84
85#endif
bool OpenDoor
Definition door.h:40
bool door_changed
Definition door.h:73
bool running
Definition door.h:75
bool OpenState
Definition door.h:38
bool IsEnabled()
Definition door.h:50
bool DoorDirection
Definition door.h:37
DoorWrapper * door
Definition door.h:66
DynamicMesh * wrapper
Definition door.h:67
bool previous_open
Definition door.h:74
Timer * timer
Definition door.h:79
std::string CloseSound
Definition door.h:42
bool IsMoving
Definition door.h:39
std::string OpenSound
Definition door.h:41
int timer_interval
Definition door.h:80
Sound * sound
Definition door.h:70
bool is_enabled
Definition door.h:72
Ogre::Vector3 Vector3
Definition globals.h:58
Ogre::Real Real
Definition globals.h:57
#define SBSIMPEXP
Definition globals.h:53