ScummVM API documentation
GameStickArea.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_STICK_AREA_H
29 #define GAME_GAME_STICK_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(cGameStickArea_SaveData);
40 
41 public:
42  cVector3f mvSize;
43 
44  tString msAttachFunction;
45  tString msDetachFunction;
46 
47  tString msAttachSound;
48  tString msDetachSound;
49 
50  tString msAttachPS;
51  tString msDetachPS;
52 
53  bool mbCanDeatch;
54 
55  tString msAttachedBody;
56 
57  bool mbCheckCenterInArea;
58 
59  float mfPoseTime;
60 
61  float mfSetMtxTime;
62 
63  iGameEntity *CreateEntity();
64 };
65 
66 //------------------------------------------
67 
68 class cGameStickArea : public iGameEntity {
69  typedef iGameEntity super;
70  friend class cAreaLoader_GameStickArea;
71 
72 public:
73  cGameStickArea(cInit *apInit, const tString &asName);
74  ~cGameStickArea(void);
75 
76  void OnPlayerPick();
77 
78  void Update(float afTimeStep);
79 
80  void OnPostSceneDraw();
81 
82  iPhysicsBody *GetAttachedBody() { return mpAttachedBody; }
83  void DetachBody();
84 
85  void SetAttachFunction(const tString &asX) { msAttachFunction = asX; }
86  void SetDetachFunction(const tString &asX) { msDetachFunction = asX; }
87 
88  void SetAttachSound(const tString &asX) { msAttachSound = asX; }
89  void SetDetachSound(const tString &asX) { msDetachSound = asX; }
90 
91  void SetAttachPS(const tString &asX) { msAttachPS = asX; }
92  void SetDetachPS(const tString &asX) { msDetachPS = asX; }
93 
94  void SetCanDeatch(bool abX) { mbCanDeatch = abX; }
95  bool GetCanDeatch();
96 
97  void SetCheckCenterInArea(bool abX) { mbCheckCenterInArea = abX; }
98 
99  void SetPoseTime(float afX) { mfPoseTime = afX; }
100 
101  void SetMoveBody(bool abX) { mbMoveBody = abX; }
102  bool GetMoveBody() { return mbMoveBody; }
103  void SetRotateBody(bool abX) { mbRotateBody = abX; }
104  bool GetRotateBody() { return mbRotateBody; }
105 
106  tString GetCallbackFunc(const tString &asFunc, iPhysicsBody *apBody);
107 
108  static bool mbAllowAttachment;
109 
110  // SaveObject implementation
111  iGameEntity_SaveData *CreateSaveData();
112  void SaveToSaveData(iGameEntity_SaveData *apSaveData);
113  void LoadFromSaveData(iGameEntity_SaveData *apSaveData);
114  void SetupSaveData(iGameEntity_SaveData *apSaveData);
115 
116 private:
117  tString msAttachFunction;
118  tString msDetachFunction;
119 
120  tString msAttachSound;
121  tString msDetachSound;
122 
123  tString msAttachPS;
124  tString msDetachPS;
125 
126  bool mbMoveBody;
127  bool mbRotateBody;
128 
129  bool mbCheckCenterInArea;
130 
131  float mfPoseTime;
132 
133  bool mbCanDeatch;
134 
135  bool mbBodyGravity;
136  float mfBodyMass;
137  iPhysicsBody *mpAttachedBody;
138  iPhysicsBody *mpLastAttachedBody;
139 
140  float mfSetMtxTime;
141  cMatrixf mtxAttachedStart;
142 };
143 
144 //------------------------------------------
145 
147 
148 public:
149  cAreaLoader_GameStickArea(const tString &asName, cInit *apInit);
151 
152  iEntity3D *Load(const tString &asName, const cVector3f &avSize, const cMatrixf &a_mtxTransform, cWorld3D *apWorld);
153 
154 private:
155  cInit *mpInit;
156 };
157 
158 #endif // GAME_GAME_STICK_AREA_H
Definition: AI.h:36
Definition: str.h:59
Definition: GameEntity.h:76
Definition: GameStickArea.h:68
Definition: PhysicsBody.h:117
Definition: World3D.h:179
Definition: GameStickArea.h:38
Definition: GameStickArea.h:146
Definition: Entity3D.h:81
Definition: Resources.h:133
Definition: GameEntity.h:126
Definition: Init.h:70