1 | /*! |
---|
2 | * @file fps_player.h |
---|
3 | * Implements a playable for fps games |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _FPS_PLAYER_H |
---|
7 | #define _FPS_PLAYER_H |
---|
8 | |
---|
9 | |
---|
10 | #include "playable.h" |
---|
11 | #include "glgui.h" |
---|
12 | |
---|
13 | |
---|
14 | class FPSSniperRifle; |
---|
15 | |
---|
16 | |
---|
17 | class FPSPlayer : public Playable |
---|
18 | { |
---|
19 | ObjectListDeclaration(FPSPlayer); |
---|
20 | |
---|
21 | public: |
---|
22 | FPSPlayer(const TiXmlElement* root = NULL); |
---|
23 | virtual ~FPSPlayer(); |
---|
24 | |
---|
25 | virtual void loadParams(const TiXmlElement* root); |
---|
26 | |
---|
27 | virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f); |
---|
28 | |
---|
29 | virtual void enter(); |
---|
30 | virtual void leave(); |
---|
31 | |
---|
32 | virtual void reset(); |
---|
33 | |
---|
34 | virtual void hit(float damage, WorldEntity* killer); |
---|
35 | |
---|
36 | virtual void destroy(WorldEntity* killer); |
---|
37 | virtual void respawn(); |
---|
38 | |
---|
39 | virtual void tick(float time); |
---|
40 | virtual void draw() const; |
---|
41 | |
---|
42 | void displayHUDText( const std::string& message ); |
---|
43 | |
---|
44 | |
---|
45 | virtual void process(const Event &event); |
---|
46 | |
---|
47 | private: |
---|
48 | void init(); |
---|
49 | |
---|
50 | bool bLeft; //!< strafe left |
---|
51 | bool bRight; //!< strafe right |
---|
52 | bool bForward; //!< walk forward |
---|
53 | bool bBackward; //!< walk backward |
---|
54 | bool bJump; //!< jumping |
---|
55 | bool bPosBut; //!< position button |
---|
56 | bool bFire; //!< fire button |
---|
57 | bool bFire2; //!< alternate fire button |
---|
58 | bool bCrouch; //!< crouch button |
---|
59 | |
---|
60 | float xMouse; //!< mouse moved in x-Direction |
---|
61 | float yMouse; //!< mouse moved in y-Direction |
---|
62 | |
---|
63 | |
---|
64 | float heading; //!< the direction where the player heads to |
---|
65 | float attitude; //!< defines the camera angle to the x-z-plane |
---|
66 | |
---|
67 | PNode* cameraNode; //!< the "eyes" of the player (or call it head if you want) |
---|
68 | |
---|
69 | float fallVelocity; //!< velocity for falling down |
---|
70 | float jumpAcceleration; //!< the jump acceleration |
---|
71 | |
---|
72 | bool initWeapon; |
---|
73 | bool changeZoom; //!< zoom sight of player |
---|
74 | bool inZoomMode; //!< zoomsight |
---|
75 | bool changingZoom; |
---|
76 | |
---|
77 | float damageTicker; //!< ticker for dealing damage |
---|
78 | |
---|
79 | FPSSniperRifle* weapon; |
---|
80 | |
---|
81 | OM_LIST myList; |
---|
82 | OrxGui::GLGuiBox* deadBox; |
---|
83 | void onButtonContinue(); |
---|
84 | void onButtonExit(); |
---|
85 | void showDeadScreen(); |
---|
86 | |
---|
87 | }; |
---|
88 | |
---|
89 | #endif |
---|