style cleanup - remove unneeded ';'s
[blender.git] / source / gameengine / Ketsji / KX_SteeringActuator.h
1 /*
2  * Add steering behaviors
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *
20  * The Original Code is: all of this file.
21  *
22  * Contributor(s): none yet.
23  *
24  * ***** END GPL LICENSE BLOCK *****
25  */
26
27 #ifndef __KX_STEERINGACTUATOR_H__
28 #define __KX_STEERINGACTUATOR_H__
29
30 #include "SCA_IActuator.h"
31 #include "SCA_LogicManager.h"
32 #include "MT_Matrix3x3.h"
33
34 class KX_GameObject;
35 class KX_NavMeshObject;
36 struct KX_Obstacle;
37 class KX_ObstacleSimulation;
38 const int MAX_PATH_LENGTH  = 128;
39
40 class KX_SteeringActuator : public SCA_IActuator
41 {
42         Py_Header
43
44         /** Target object */
45         KX_GameObject *m_target;
46         KX_NavMeshObject *m_navmesh;
47         int     m_mode;
48         float m_distance;
49         float m_velocity;
50         float m_acceleration;
51         float m_turnspeed;
52         KX_ObstacleSimulation* m_simulation;
53         
54         double m_updateTime;
55         KX_Obstacle* m_obstacle;
56         bool m_isActive;
57         bool m_isSelfTerminated;
58         bool m_enableVisualization;
59         short m_facingMode;
60         bool m_normalUp;
61         float m_path[MAX_PATH_LENGTH*3];
62         int m_pathLen;
63         int m_pathUpdatePeriod;
64         double m_pathUpdateTime;
65         int m_wayPointIdx;
66         MT_Matrix3x3 m_parentlocalmat;
67         MT_Vector3 m_steerVec;
68         void HandleActorFace(MT_Vector3& velocity);
69 public:
70         enum KX_STEERINGACT_MODE
71         {
72                 KX_STEERING_NODEF = 0,
73                 KX_STEERING_SEEK,
74                 KX_STEERING_FLEE,
75                 KX_STEERING_PATHFOLLOWING,
76                 KX_STEERING_MAX
77         };
78
79         KX_SteeringActuator(class SCA_IObject* gameobj,
80                                                 int mode,
81                                                 KX_GameObject *target, 
82                                                 KX_GameObject *navmesh,
83                                                 float distance,
84                                                 float velocity, 
85                                                 float acceleration,                                                                     
86                                                 float turnspeed,
87                                                 bool  isSelfTerminated,
88                                                 int pathUpdatePeriod,
89                                                 KX_ObstacleSimulation* simulation,
90                                                 short facingmode,
91                                                 bool normalup,
92                                                 bool enableVisualization);
93         virtual ~KX_SteeringActuator();
94         virtual bool Update(double curtime, bool frame);
95
96         virtual CValue* GetReplica();
97         virtual void ProcessReplica();
98         virtual void Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map);
99         virtual bool UnlinkObject(SCA_IObject* clientobj);
100         const MT_Vector3& GetSteeringVec();
101
102 #ifdef WITH_PYTHON
103
104         /* --------------------------------------------------------------------- */
105         /* Python interface ---------------------------------------------------- */
106         /* --------------------------------------------------------------------- */
107
108         /* These are used to get and set m_target */
109         static PyObject* pyattr_get_target(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
110         static int pyattr_set_target(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
111         static PyObject* pyattr_get_navmesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
112         static int pyattr_set_navmesh(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
113         static PyObject* pyattr_get_steeringVec(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
114         
115
116 #endif // WITH_PYTHON
117
118 }; /* end of class KX_SteeringActuator : public SCA_PropertyActuator */
119
120 #endif
121