ScummVM API documentation
GameLiquidArea.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of Penumbra Overture.
26  */
27 
28 #ifndef GAME_GAME_LIQUID_AREA_H
29 #define GAME_GAME_LIQUID_AREA_H
30 
31 #include "hpl1/engine/engine.h"
32 #include "hpl1/penumbra-overture/GameEntity.h"
33 
34 using namespace hpl;
35 
36 //------------------------------------------
37 
39  kSerializableClassInit(cGameLiquidArea_SaveData);
40 
41 public:
42  cVector3f mvSize;
43 
44  float mfDensity;
45  float mfLinearViscosity;
46  float mfAngularViscosity;
47  cColor mColor;
48 
49  tString msPhysicsMaterial;
50 
51  cPlanef mSurfacePlane;
52 
53  bool mbHasWaves;
54 
55  iGameEntity *CreateEntity();
56 };
57 
58 //------------------------------------------
59 
60 class cGameLiquidArea : public iGameEntity {
61  typedef iGameEntity super;
62  friend class cAreaLoader_GameLiquidArea;
63 
64 public:
65  cGameLiquidArea(cInit *apInit, const tString &asName);
66  ~cGameLiquidArea(void);
67 
68  void OnPlayerPick();
69 
70  void Update(float afTimeStep);
71 
72  void SetDensity(float afX) { mfDensity = afX; }
73  void SetLinearViscosity(float afX) { mfLinearViscosity = afX; }
74  void SetAngularViscosity(float afX) { mfAngularViscosity = afX; }
75  void SetPhysicsMaterial(const tString asName);
76  void SetColor(const cColor &aColor) { mColor = aColor; }
77  void SetHasWaves(bool abX) { mbHasWaves = abX; }
78 
79  void Setup();
80 
81  iPhysicsMaterial *GetPhysicsMaterial() { return mpPhysicsMaterial; }
82 
83  // SaveObject implementation
84  iGameEntity_SaveData *CreateSaveData();
85  void SaveToSaveData(iGameEntity_SaveData *apSaveData);
86  void LoadFromSaveData(iGameEntity_SaveData *apSaveData);
87  void SetupSaveData(iGameEntity_SaveData *apSaveData);
88 
89 private:
90  void SplashEffect(iPhysicsBody *apBody);
91 
92  float mfDensity;
93  float mfLinearViscosity;
94  float mfAngularViscosity;
95  cColor mColor;
96 
97  iPhysicsMaterial *mpPhysicsMaterial;
98 
99  bool mbHasWaves;
100  float mfWaveAmp;
101  float mfWaveFreq;
102 
103  float mfTimeCount;
104 
105  cPlanef mSurfacePlane;
106 };
107 
108 //------------------------------------------
109 
111 
112 public:
113  cAreaLoader_GameLiquidArea(const tString &asName, cInit *apInit);
115 
116  iEntity3D *Load(const tString &asName, const cVector3f &avSize, const cMatrixf &a_mtxTransform, cWorld3D *apWorld);
117 
118 private:
119  cInit *mpInit;
120 };
121 
122 #endif // GAME_GAME_DAMAGE_AREA_H
Definition: AI.h:36
Definition: str.h:59
Definition: GameLiquidArea.h:60
Definition: GameLiquidArea.h:110
Definition: GameEntity.h:76
Definition: GameLiquidArea.h:38
Definition: PhysicsBody.h:117
Definition: World3D.h:179
Definition: PhysicsMaterial.h:77
Definition: Color.h:37
Definition: Entity3D.h:81
Definition: Resources.h:133
Definition: GameEntity.h:126
Definition: Init.h:70