ScummVM API documentation
PlayerState.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_STATES_H
29 #define GAME_PLAYER_STATES_H
30 
31 #include "hpl1/penumbra-overture/ButtonHandler.h"
32 #include "hpl1/penumbra-overture/DeathMenu.h"
33 #include "hpl1/penumbra-overture/GameItemType.h"
34 #include "hpl1/penumbra-overture/GameMessageHandler.h"
35 #include "hpl1/penumbra-overture/GameObject.h"
36 #include "hpl1/penumbra-overture/Inventory.h"
37 #include "hpl1/penumbra-overture/Notebook.h"
38 #include "hpl1/penumbra-overture/NumericalPanel.h"
39 #include "hpl1/penumbra-overture/PlayerHands.h"
40 
42 // BASE STATE
44 
45 class iPlayerState {
46 public:
47  ePlayerState mType;
48  ePlayerState mPreviuosState;
49 
50  iPlayerState(cInit *apInit, cPlayer *apPlayer, ePlayerState aType) {
51  mpInit = apInit;
52 
53  mpPlayer = apPlayer;
54  mType = aType;
55 
56  mPreviuosState = ePlayerState_LastEnum;
57  }
58 
59  virtual ~iPlayerState() {}
60 
61  //-------------------------------------
62 
63  void InitState(iPlayerState *apPrevState) {
64  if (apPrevState) {
65  apPrevState->LeaveState(this);
66  EnterState(apPrevState);
67  mPreviuosState = apPrevState->mType;
68  }
69  }
70 
71  //-------------------------------------
72 
73  virtual void OnUpdate(float afTimeStep) {}
74  virtual void OnPostSceneDraw() {}
75  virtual void OnDraw() {}
76 
77  virtual void OnStartInteract() {}
78  virtual void OnStopInteract() {}
79  virtual void OnStartExamine() {}
80  virtual void OnStopExamine() {}
81  virtual void OnStartHolster() {}
82 
83  virtual bool OnJump() { return true; }
84 
85  virtual void OnStartRun() {}
86  virtual void OnStopRun() {}
87 
88  virtual void OnStartCrouch() {}
89  virtual void OnStopCrouch() {}
90 
91  virtual void OnStartInteractMode() {}
92 
93  virtual bool OnStartInventory() { return true; }
94 
95  virtual bool OnStartInventoryShortCut(int alNum) { return true; }
96 
97  virtual bool OnMoveForwards(float afMul, float afTimeStep) { return true; }
98  virtual bool OnMoveSideways(float afMul, float afTimeStep) { return true; }
99 
100  virtual bool OnAddYaw(float afVal) { return true; }
101  virtual bool OnAddPitch(float afVal) { return true; }
102 
103  virtual void EnterState(iPlayerState *apPrevState) {}
104  virtual void LeaveState(iPlayerState *apNextState) {}
105 
106  //-------------------------------------
107 
108 protected:
109  cInit *mpInit;
110  cPlayer *mpPlayer;
111 };
112 
113 #endif // GAME_PLAYER_STATES_H
Definition: PlayerState.h:45
Definition: Player.h:145
Definition: Init.h:70