1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Cyrill Frei |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _FpsPlayer_H__ |
---|
30 | #define _FpsPlayer_H__ |
---|
31 | |
---|
32 | #include "OrxonoxPrereqs.h" |
---|
33 | |
---|
34 | #include <string> |
---|
35 | #include <LinearMath/btVector3.h> |
---|
36 | #include "util/Math.h" |
---|
37 | #include "tools/Mesh.h" |
---|
38 | #include "Pawn.h" |
---|
39 | |
---|
40 | namespace orxonox |
---|
41 | { |
---|
42 | class _OrxonoxExport FpsPlayer : public Pawn |
---|
43 | { |
---|
44 | public: |
---|
45 | FpsPlayer(Context* context); |
---|
46 | virtual ~FpsPlayer(); |
---|
47 | |
---|
48 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; |
---|
49 | virtual void tick(float dt) override; |
---|
50 | void registerVariables(); |
---|
51 | void setConfigValues(); |
---|
52 | |
---|
53 | virtual void moveFrontBack(const Vector2& value) override; |
---|
54 | virtual void moveRightLeft(const Vector2& value) override; |
---|
55 | virtual void moveUpDown(const Vector2& value) override; |
---|
56 | |
---|
57 | virtual void rotateYaw(const Vector2& value) override; |
---|
58 | virtual void rotatePitch(const Vector2& value) override; |
---|
59 | virtual void rotateRoll(const Vector2& value) override; |
---|
60 | |
---|
61 | |
---|
62 | inline void setMeshSource(const std::string& meshname) |
---|
63 | { this->meshSrc_ = meshname; this->changedMesh(); } |
---|
64 | inline const std::string& getMeshSource() const |
---|
65 | { return this->meshSrc_; } |
---|
66 | |
---|
67 | void boost(bool bBoost) override; //actually jump |
---|
68 | |
---|
69 | virtual void fire(); |
---|
70 | |
---|
71 | virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; |
---|
72 | |
---|
73 | virtual void addedWeaponPack(WeaponPack* wPack) override; |
---|
74 | |
---|
75 | protected: |
---|
76 | virtual void setPlayer(PlayerInfo* player) override; |
---|
77 | virtual void startLocalHumanControl() override; |
---|
78 | bool bInvertYAxis_; |
---|
79 | |
---|
80 | bool bBoost_; |
---|
81 | bool bPermanentBoost_; |
---|
82 | Vector3 steering_; |
---|
83 | float primaryThrust_; |
---|
84 | float auxilaryThrust_; |
---|
85 | float rotationThrust_; |
---|
86 | std::string weaponMashName_; |
---|
87 | btVector3 localLinearAcceleration_; |
---|
88 | btVector3 localAngularAcceleration_; |
---|
89 | |
---|
90 | private: |
---|
91 | virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const override; |
---|
92 | float speed_; |
---|
93 | |
---|
94 | void changedMesh(); |
---|
95 | Mesh mesh_; |
---|
96 | std::string meshSrc_; |
---|
97 | float yaw_; |
---|
98 | float pitch_; |
---|
99 | float roll_; |
---|
100 | Vector3 localVelocity_; |
---|
101 | bool isFloor_; |
---|
102 | bool thisTickBoost_; |
---|
103 | Quaternion savedOrientation_; |
---|
104 | Ogre::SceneNode* weaponNode_; |
---|
105 | }; |
---|
106 | } |
---|
107 | |
---|
108 | #endif /* _FpsPlayer_H__ */ |
---|