ScummVM API documentation
PlayerState_Interact.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_PLAYER_STATE_INTERACT_H
29 #define GAME_PLAYER_STATE_INTERACT_H
30 
31 #include "hpl1/engine/engine.h"
32 #include "hpl1/penumbra-overture/PlayerState.h"
33 
34 using namespace hpl;
35 
36 //-----------------------------------------------------------------
37 
39 // GRAB STATE
41 
42 //-----------------------------------------------------------------
43 
45 public:
46  cPlayerState_Grab(cInit *apInit, cPlayer *apPlayer);
47 
48  void OnUpdate(float afTimeStep);
49 
50  void OnDraw();
51 
52  void OnPostSceneDraw();
53 
54  bool OnJump();
55 
56  void OnStartInteractMode();
57 
58  void OnStartInteract();
59  void OnStopInteract();
60  void OnStartExamine();
61 
62  bool OnAddYaw(float afVal);
63  bool OnAddPitch(float afVal);
64 
65  bool OnMoveForwards(float afMul, float afTimeStep);
66  bool OnMoveSideways(float afMul, float afTimeStep);
67 
68  void EnterState(iPlayerState *apPrevState);
69  void LeaveState(iPlayerState *apNextState);
70 
71  void OnStartCrouch();
72  void OnStopCrouch();
73  bool OnStartInventory();
74  bool OnStartInventoryShortCut(int alNum);
75 
76  static float mfMassDiv;
77 
78 private:
79  cVector3f mvRelPickPoint;
80  iPhysicsBody *mpPushBody;
81 
82  ePlayerMoveState mPrevMoveState;
83  ePlayerState mPrevState;
84 
85  cSpringVec3 mGrabSpring;
86  cPidControllerVec3 mGrabPid;
87  cSpringVec3 mRotateSpring;
88  cPidControllerVec3 mRotatePid;
89 
90  bool mbHasGravity;
91 
92  bool mbMoveHand;
93 
94  float mfGrabDist;
95 
96  float mfDefaultMass;
97 
98  bool mbHasPlayerGravityPush;
99 
100  bool mbPickAtPoint;
101  bool mbRotateWithPlayer;
102 
103  cVector3f mvObjectUp;
104  cVector3f mvObjectRight;
105 
106  cVector3f mvCurrentUp;
107  cVector3f mvCurrentUpAxis;
108 
109  float mfStartYaw;
110 
111  cVector3f mvCurrentDisered;
112 
113  float mfSpeedMul;
114 
115  float mfYRotation;
116 
117  float mfMaxPidForce;
118 
119  float mfMinThrowMass;
120  float mfMaxThrowMass;
121 
122  float mfMinThrowImpulse;
123  float mfMaxThrowImpulse;
124 
125  FontData *mpFont;
126 };
127 
128 //-----------------------------------------------------------------
129 
131 // MOVE STATE
133 
134 //-----------------------------------------------------------------
135 
137 public:
138  cPlayerState_Move_BodyCallback(cPlayer *apPlayer, float afTimeStep);
139 
140  bool OnBeginCollision(iPhysicsBody *apBody, iPhysicsBody *apCollideBody);
141  void OnCollide(iPhysicsBody *apBody, iPhysicsBody *apCollideBody, cPhysicsContactData *apContactData);
142 
143  float mfTimeStep;
144  int mlBackCount;
145  cPlayer *mpPlayer;
146 
147 private:
148 };
149 
150 //-----------------------------------------------------------------
151 
153 public:
154  cPlayerState_Move(cInit *apInit, cPlayer *apPlayer);
156 
157  void OnUpdate(float afTimeStep);
158 
159  void OnStartInteract();
160  void OnStopInteract();
161 
162  bool OnJump();
163 
164  void OnStartExamine();
165 
166  bool OnMoveForwards(float afMul, float afTimeStep);
167  bool OnMoveSideways(float afMul, float afTimeStep);
168 
169  bool OnAddYaw(float afVal);
170  bool OnAddPitch(float afVal);
171 
172  void EnterState(iPlayerState *apPrevState);
173  void LeaveState(iPlayerState *apNextState);
174 
175  void OnPostSceneDraw();
176 
177  bool OnStartInventory();
178  bool OnStartInventoryShortCut(int alNum);
179 
180 private:
181  cVector3f mvForward;
182  cVector3f mvRight;
183  cVector3f mvUp;
184 
185  cVector3f mvRelPickPoint;
186  cVector3f mvPickPoint;
187 
188  bool bPausedGravity;
189 
190  iPhysicsBody *mpPushBody;
191 
192  int mlMoveCount;
193 
194  ePlayerMoveState mPrevMoveState;
195  ePlayerState mPrevState;
196 
197  cPlayerState_Move_BodyCallback *mpCallback;
198 };
199 
201 // PUSH STATE
203 
205 public:
206  cPlayerState_Push(cInit *apInit, cPlayer *apPlayer);
207 
208  void OnUpdate(float afTimeStep);
209  bool OnJump();
210 
211  void OnStartInteract();
212  void OnStopInteract();
213 
214  void OnStartExamine();
215 
216  bool OnMoveForwards(float afMul, float afTimeStep);
217  bool OnMoveSideways(float afMul, float afTimeStep);
218 
219  void EnterState(iPlayerState *apPrevState);
220  void LeaveState(iPlayerState *apNextState);
221 
222  void OnPostSceneDraw();
223 
224  bool OnStartInventory();
225  bool OnStartInventoryShortCut(int alNum);
226 
227 private:
228  cVector3f mvForward;
229  cVector3f mvRight;
230 
231  cVector3f mvRelPickPoint;
232 
233  cVector3f mvLocalPickPoint;
234 
235  iPhysicsBody *mpPushBody;
236  cVector3f mvLastBodyPos;
237 
238  cVector2f mvPrevPitchLimits;
239 
240  bool mbHasPlayerGravityPush;
241 
242  float mfMaxSpeed;
243 
244  int mlForward;
245  int mlSideways;
246 
247  ePlayerMoveState mPrevMoveState;
248  ePlayerState mPrevState;
249 };
250 
251 #endif // GAME_PLAYER_STATE_INTERACT_H
Definition: AI.h:36
Definition: font_data.h:67
Definition: PlayerState.h:45
Definition: Player.h:145
Definition: PhysicsBody.h:49
Definition: PhysicsBody.h:117
Definition: PlayerState_Interact.h:44
Definition: PlayerState_Interact.h:136
Definition: PhysicsMaterial.h:58
Definition: PidController.h:37
Definition: PlayerState_Interact.h:204
Definition: Init.h:70
Definition: Spring.h:36
Definition: PlayerState_Interact.h:152