Emergency 20 Dokumentation  4.2.0
BuildingComponent-inl.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Includes ]
6 //[-------------------------------------------------------]
8 
9 #include <camp/arraymapper.hpp>
10 
11 
12 //[-------------------------------------------------------]
13 //[ Namespace ]
14 //[-------------------------------------------------------]
15 namespace em5
16 {
17 
18 
19  //[-------------------------------------------------------]
20  //[ Struct constructors ]
21  //[-------------------------------------------------------]
22  inline BuildingComponent::DoorData::DoorData() :
23  mMainDoorId(qsf::getUninitialized<uint64>())
24  {
25  // Nothing here
26  }
27 
28  inline BuildingComponent::LightData::LightData() :
29  mLightsActive(false)
30  {
31  // Nothing here
32  }
33 
34 
35  //[-------------------------------------------------------]
36  //[ Public methods ]
37  //[-------------------------------------------------------]
39  SimpleDamageComponent(prototype),
40  PrototypeContainer(*prototype),
41  mEvacuateBuildingId(qsf::getUninitialized<uint64>()),
42  mClippingEnabled(true),
43  mEventWindowId(qsf::getUninitialized<uint64>()),
44  mPersonInWindowEntityId(qsf::getUninitialized<uint64>()),
45  mEboxRepairTime(qsf::Time::fromSeconds(30.0f)),
46  mFirefighterRescueTime(qsf::Time::fromSeconds(2.5f)),
47  mCanCreateTrappedPersons(true),
48  mSetupNumberOfPersonsTrapped(0),
49  mSetupNumberOfInjuredPersonsTrapped(0),
50  mTrappedPersonsInjuryId(qsf::getUninitialized<uint32>()),
51  mTrappedPersonsDieTimerId(qsf::getUninitialized<uint32>()),
52  mDoorParticleEffectId(qsf::getUninitialized<uint64>()),
53  mIsDoorBlocked(false),
54  mMainDoorIsDamaged(false),
55  mCollapseAnimationEntityId(qsf::getUninitialized<uint64>()),
56  mCollapseAnimationYDistance(0.0f),
57  mCollapseElapsedTime(0.0f),
58  mCollapseDampeningFactor(0.6f),
59  mCollapseDelay(2.0f),
60  mCollapseShowRuinsDelay(0.5f),
61  mCollapseDelayTimeout(0.0f),
62  mCollapseComplete(false),
63  mDamageLevel1MaterialActive(false),
64  mBuildingClippingManager(nullptr),
65  mUseCameraClipping(false),
66  mDirtyMaterialAabb(false),
67  mCurrentCameraHeight(0.0f),
68  mCurrentFadeOffset(0.0f),
69  LightArray(*this, mLights.mLightIds),
70  DamagedLevel1EntitiesArray(*this, mDamagedLevel1EntityIds),
71  DamagedLevel2EntitiesArray(*this, mDamagedLevel2EntityIds),
72  DestroyedEntitiesArray(*this, mDestroyedEntityIds),
73  CollapseRubbleArray(*this, mCollapseRubbleEntityIds),
74  EboxEntitiesArray(*this, mEboxEntityIds)
75  {
76  mInternalFlags.set(MESH_ACTIVE);
77  }
78 
80  {
81  // Noting here
82  }
83 
85  {
86  return mClippingEnabled;
87  }
88 
89  inline void BuildingComponent::setClippingEnabled(bool clippingEnabled)
90  {
91  assignAndPromoteChange(mClippingEnabled, clippingEnabled, CLIPPING_ENABLED);
92  }
93 
95  {
96  return mSetupNumberOfPersonsTrapped;
97  }
98 
100  {
101  return mSetupNumberOfInjuredPersonsTrapped;
102  }
103 
105  {
106  return qsf::isInitialized(mPersonInWindowEntityId);
107  }
108 
110  {
111  return mDamagedLevel1Material;
112  }
113 
115  {
116  return mIntactMaterial;
117  }
118 
120  {
121  return mCollapseDampeningFactor;
122  }
123 
124  inline void BuildingComponent::setCollapseDampeningFactor(float collapseDampeningFactor)
125  {
126  mCollapseDampeningFactor = collapseDampeningFactor;
127  }
128 
130  {
131  return mCollapseDelay;
132  }
133 
134  inline void BuildingComponent::setCollapseDelay(float collapseDelay)
135  {
136  mCollapseDelay = collapseDelay;
137  }
138 
140  {
141  return mCollapseShowRuinsDelay;
142  }
143 
144  inline void BuildingComponent::setCollapseShowRuinsDelay(float collapseShowRuinsDelay)
145  {
146  mCollapseShowRuinsDelay = collapseShowRuinsDelay;
147  }
148 
149  inline bool BuildingComponent::isClipped() const
150  {
151  return mUseCameraClipping;
152  }
153 
155  {
156  return mIsDoorBlocked;
157  }
158 
159  inline void BuildingComponent::setIsDoorBlocked(bool isDoorBlocked)
160  {
161  mIsDoorBlocked = isDoorBlocked;
162  }
163 
165  {
166  return mEboxRepairTime;
167  }
168 
170  {
171  mEboxRepairTime = time;
172  }
173 
175  {
176  return mFirefighterRescueTime;
177  }
178 
180  {
181  mFirefighterRescueTime = time;
182  }
183 
184 
185  //[-------------------------------------------------------]
186  //[ CAMP reflection system ]
187  //[-------------------------------------------------------]
188  inline std::size_t BuildingComponent::EntityIdArrayInterface::size() const
189  {
190  return getVariable().size();
191  }
192 
193  inline const uint64& BuildingComponent::EntityIdArrayInterface::get(std::size_t index) const
194  {
195  return getVariable()[index];
196  }
197 
198  inline void BuildingComponent::EntityIdArrayInterface::set(std::size_t index, const uint64& value)
199  {
200  getVariable()[index] = value;
201  }
202 
203  inline void BuildingComponent::EntityIdArrayInterface::insert(std::size_t before, const uint64& value)
204  {
205  getVariable().insert(getVariable().begin() + before, value);
206  }
207 
208  inline void BuildingComponent::EntityIdArrayInterface::remove(std::size_t index)
209  {
210  getVariable().erase(getVariable().begin() + index);
211  }
212 
213 
214 //[-------------------------------------------------------]
215 //[ Namespace ]
216 //[-------------------------------------------------------]
217 } // em5
Definition: ActionPriority.h:13
const qsf::AssetProxy & getIntactMaterial() const
Definition: BuildingComponent-inl.h:114
qsf::Time getEboxRepairTime() const
Definition: BuildingComponent-inl.h:164
void set(ENUM flag)
Set a single flag.
Definition: EnumBitmask.h:187
float getCollapseDampeningFactor() const
Definition: BuildingComponent-inl.h:119
EMERGENCY 5 simple damage component class.
Definition: SimpleDamageComponent.h:36
bool isClipped() const
Definition: BuildingComponent-inl.h:149
void setCollapseDampeningFactor(float collapseDampeningFactor)
Definition: BuildingComponent-inl.h:124
unsigned int uint32
Definition: PlatformTypes.h:181
virtual ~BuildingComponent()
Destructor.
Definition: BuildingComponent-inl.h:79
bool getIsDoorBlocked() const
Definition: BuildingComponent-inl.h:154
void setCollapseShowRuinsDelay(float collapseShowRuinsDelay)
Definition: BuildingComponent-inl.h:144
const qsf::AssetProxy & getDamagedLevel1Material() const
Definition: BuildingComponent-inl.h:109
uint16 getSetupNumberOfTrappedPersons() const
Returns the number of persons trapped in the building. This value is just for setup, in case a fire starts and has nothing to do with the persons actually inside.
Definition: BuildingComponent-inl.h:94
bool isInitialized(const T &value)
Definition: GetUninitialized.h:66
uint64_t uint64
Definition: PlatformTypes.h:184
BuildingComponent(qsf::Prototype *prototype)
Constructor.
Definition: BuildingComponent-inl.h:38
void setFirefighterRescueTime(qsf::Time time)
Definition: BuildingComponent-inl.h:179
Definition: PickupPersonByParamedicAction.h:21
void setIsDoorBlocked(bool isDoorBlocked)
Definition: BuildingComponent-inl.h:159
Asset proxy class.
Definition: AssetProxy.h:57
static const uint32 CLIPPING_ENABLED
"ClippingEnabled" unique class property ID inside the class
Definition: BuildingComponent.h:73
T getUninitialized()
Definition: GetUninitialized.h:38
uint16 getSetupNumberOfTrappedInjuredPersons() const
Returns the number of persons trapped in the building which are injured. This value is just for setup...
Definition: BuildingComponent-inl.h:99
unsigned short uint16
Definition: PlatformTypes.h:178
qsf::Time getFirefighterRescueTime() const
Definition: BuildingComponent-inl.h:174
void setCollapseDelay(float collapseDelay)
Definition: BuildingComponent-inl.h:134
bool isPersonWavingOutOfWindow() const
Check if a person is waving out of the window.
Definition: BuildingComponent-inl.h:104
bool getClippingEnabled() const
Return whether or not building clipping is enabled.
Definition: BuildingComponent-inl.h:84
Prototype class.
Definition: Prototype.h:100
float getCollapseDelay() const
Definition: BuildingComponent-inl.h:129
void setClippingEnabled(bool clippingEnabled)
Set whether or not building clipping is enabled.
Definition: BuildingComponent-inl.h:89
void setEboxRepairTime(qsf::Time time)
Definition: BuildingComponent-inl.h:169
bool assignAndPromoteChange(T &variable, const S &newValue, uint32 propertyId)
Comfort function for updating an exported member variable and promoting any change that happened...
Definition: Component-inl.h:141
float getCollapseShowRuinsDelay() const
Definition: BuildingComponent-inl.h:139
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32