Index: branches/single_player_map/src/lib/util/executor/executor_lua.cc
===================================================================
--- branches/single_player_map/src/lib/util/executor/executor_lua.cc	(revision 8907)
+++ branches/single_player_map/src/lib/util/executor/executor_lua.cc	(revision 8908)
@@ -37,3 +37,3 @@
 template<> void toLua<float>(lua_State* state, float value) { lua_pushnumber(state, (lua_Number) value); };
 template<> void toLua<char>(lua_State* state, char value) { lua_pushnumber(state, (lua_Number) value); };
-template<> void toLua<const std::string&>(lua_State* state, const std::string& value) {lua_pushstring (state, value.c_str()); }
+template<> void toLua<const std::string&>(lua_State* state, const std::string& value) { lua_pushstring (state, value.c_str()); }
Index: branches/single_player_map/src/world_entities/npcs/generic_npc.cc
===================================================================
--- branches/single_player_map/src/world_entities/npcs/generic_npc.cc	(revision 8907)
+++ branches/single_player_map/src/world_entities/npcs/generic_npc.cc	(revision 8908)
@@ -17,4 +17,6 @@
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
 
+#include "generic_npc.h"
+
 
 #include "util/loading/factory.h"
@@ -27,11 +29,4 @@
 
 #include "loading/resource_manager.h"
-
-#include "generic_npc.h"
-
-#include "animation/animation3d.h"
-
-using namespace std;
-
 
 
@@ -41,7 +36,6 @@
 CREATE_SCRIPTABLE_CLASS(GenericNPC, CL_GENERIC_NPC,
                        // Move
-                        addMethod("walkTo", ExecutorLua3ret<GenericNPC,float,float,float,float>(&GenericNPC::walkTo))
-                        ->addMethod("setTime", ExecutorLua1<GenericNPC,float>(&GenericNPC::setTime))
-                        ->addMethod("turnTo", ExecutorLua4ret<GenericNPC,bool,float,float,float,float>(&GenericNPC::turnTo))
+                        addMethod("walkTo", ExecutorLua3<GenericNPC,float,float,float>(&GenericNPC::walkTo))
+                        ->addMethod("turnTo", ExecutorLua1<GenericNPC,float>(&GenericNPC::turnTo))
                        // Display
                         ->addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
@@ -53,5 +47,5 @@
                         ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
                         ->addMethod("setAbsDir", ExecutorLua4<PNode,float,float,float,float>(&PNode::setAbsDir))
-                            
+
                        );
 
@@ -71,10 +65,4 @@
 
 
-GenericNPC::GenericNPC()
-  : NPC(NULL)
-{
-
-}
-
 /**
  * deconstructor
@@ -82,6 +70,4 @@
 GenericNPC::~GenericNPC ()
 {
-  if( this->currentAnim != NULL)
-    delete this->currentAnim;
 }
 
@@ -151,239 +137,4 @@
 
 
-/**
- * walt to
- * @param coordinate: coordinate to go to
- */
-float GenericNPC::walkTo(float x, float y, float z, float qu, float qx, float qy, float qz)
-{
-  Vector destCoor = Vector(x, y, z);
-  Quaternion destDir = Quaternion(Vector(qx, qy, qz), qu);
-
-  // check if this is the current goal
-  if( this->destCoor != destCoor || this->destDir != destDir)
-  {
-    this->destCoor = destCoor;
-    this->destDir = destDir;
-
-    //float time = 100.0f;
-
-    if( this->currentAnim != NULL)
-      delete this->currentAnim;
-
-    this->currentAnim = new Animation3D(this);
-    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), 0.0f, ANIM_LINEAR, ANIM_LINEAR);
-    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR);
-    this->currentAnim->addKeyFrame(this->destCoor, this->destDir, time, ANIM_LINEAR, ANIM_LINEAR);
-
-    this->currentAnim->setInfinity(ANIM_INF_CONSTANT);
-    this->currentAnim->play();
-
-    this->setAnimation(RUN, MD2_ANIM_LOOP);
-  }
-
-  // calculate the distance
-  Vector distance = this->getAbsCoor() - this->destCoor;
-  return distance.len();
-}
-
-
-/**
- * walk to a specific place with direction
- *
- * @param x: x coordinate to go to
- * @param y: y coordinate to go to
- * @param z: z coordinate to go to
- *
- * without turning itself
- */
-float GenericNPC::walkTo(float x, float y, float z)
-{
-  Quaternion q = this->getAbsDir();
-
-  //printf("%s moving to %f, %f, %f \n",this->getName(),x,y,z);
-
-  return this->walkTo(x, y, z, q.w, q.v.x, q.v.y, q.v.z);
-}
-
-/**
- * walk to a specific place with direction
- *
- * @param x: x coordinate to go to
- * @param y: y coordinate to go to
- * @param qu: angle to rotate
- * @param qx: x coordinate of rotation vector
- * @param qy: y coordinate of rotation vector
- * @param qz: z coordinate of rotation vector
- *
- */
-float GenericNPC::walkTo(float x, float y, float qu, float qx, float qy, float qz)
-{
-  return this->walkTo(x, y, 0.0f, qu, qx, qy, qz);
-}
-
-
-/**
- * walk to a specific place with direction
- *
- * @param coor: vector place
- * @param dir: direction
- *
- */
-float GenericNPC::walkTo(const Vector& coor, const Quaternion& dir)
-{
-  return this->walkTo(coor.x, coor.y, coor.z, dir.w, dir.v.x, dir.v.y, dir.v.z);
-}
-
-
-
-/**
- * run to a specific place with direction
- *
- * @param x: x coordinate to go to
- * @param y: y coordinate to go to
- * @param z: z coordinate to go to
- * @param qu: angle to rotate
- * @param qx: x coordinate of rotation vector
- * @param qy: y coordinate of rotation vector
- * @param qz: z coordinate of rotation vector
- *
- */
-float GenericNPC::runTo(float x, float y, float z, float qu, float qx, float qy, float qz)
-{
-  Vector destCoor = Vector(x, y, z);
-  Quaternion destDir = Quaternion(Vector(qx, qy, qz), qu);
-
-  // check if this is the current goal
-  if( this->destCoor != destCoor || this->destDir != destDir)
-  {
-    this->destCoor = destCoor;
-    this->destDir = destDir;
-
-    float time = 5.0f;
-
-    if( this->currentAnim != NULL)
-      delete this->currentAnim;
-
-    this->currentAnim = new Animation3D(this);
-    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR);
-    this->currentAnim->addKeyFrame(this->destCoor, this->destDir, time, ANIM_LINEAR, ANIM_LINEAR);
-
-
-    this->currentAnim->setInfinity(ANIM_INF_CONSTANT);
-    this->currentAnim->play();
-
-    this->setAnimation(RUN, MD2_ANIM_LOOP);
-  }
-
-  // calculate the distance
-  Vector distance = this->getAbsCoor() - this->destCoor;
-  return distance.len();
-}
-
-
-/**
- * run to a specific place with direction
- *
- * @param x: x coordinate to go to
- * @param y: y coordinate to go to
- * @param qu: angle to rotate
- * @param qx: x coordinate of rotation vector
- * @param qy: y coordinate of rotation vector
- * @param qz: z coordinate of rotation vector
- *
- */
-float GenericNPC::runTo(float x, float y, float qu, float qx, float qy, float qz)
-{
-  this->runTo(x, y, 0.0f, qu, qx, qy, qz);
-}
-
-
-/**
- * run to a specific place with direction
- *
- * @param coor: vector place
- * @param dir: direction
- *
- */
-float GenericNPC::runTo(const Vector& coordinate, const Quaternion& dir)
-{
-  this->runTo(coordinate.x, coordinate.y, coordinate.z, dir.w, dir.v.x, dir.v.y, dir.v.z);
-}
-
-
-/**
- * crouch to a specific place with direction
- *
- * @param x: x coordinate to go to
- * @param y: y coordinate to go to
- * @param z: z coordinate to go to
- * @param qu: angle to rotate
- * @param qx: x coordinate of rotation vector
- * @param qy: y coordinate of rotation vector
- * @param qz: z coordinate of rotation vector
- *
- */
-float GenericNPC::crouchTo(float x, float y, float z, float qu, float qx, float qy, float qz)
-{
-  Vector destCoor = Vector(x, y, z);
-  Quaternion destDir = Quaternion(Vector(qx, qy, qz), qu);
-
-  // check if this is the current goal
-  if( this->destCoor != destCoor || this->destDir != destDir)
-  {
-    this->destCoor = destCoor;
-    this->destDir = destDir;
-
-
-    if( this->currentAnim != NULL)
-      delete this->currentAnim;
-
-    this->currentAnim = new Animation3D(this);
-    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR);
-    this->currentAnim->addKeyFrame(this->destCoor, this->destDir, time, ANIM_LINEAR, ANIM_LINEAR);
-
-
-    this->currentAnim->setInfinity(ANIM_INF_CONSTANT);
-    this->currentAnim->play();
-
-    this->setAnimation(CROUCH_WALK, MD2_ANIM_LOOP);
-  }
-
-  // calculate the distance
-  Vector distance = this->getAbsCoor() - this->destCoor;
-  return distance.len();
-}
-
-
-/**
- * couch to a specific place with direction
- *
- * @param x: x coordinate to go to
- * @param y: y coordinate to go to
- * @param qu: angle to rotate
- * @param qx: x coordinate of rotation vector
- * @param qy: y coordinate of rotation vector
- * @param qz: z coordinate of rotation vector
- *
- */
-float GenericNPC::crouchTo(float x, float y, float qu, float qx, float qy, float qz)
-{
-  this->crouchTo(x, y, 0.0f, qu, qx, qy, qz);
-}
-
-
-
-/**
- * crouch to a specific place with direction
- *
- * @param coor: vector place
- * @param dir: direction
- *
- */
-float GenericNPC::crouchTo(const Vector& coordinate, const Quaternion& dir)
-{
-  this->crouchTo(coordinate.x, coordinate.y, coordinate.z, dir.w, dir.v.x, dir.v.y, dir.v.z);
-}
-
 
 /**
@@ -392,13 +143,39 @@
 void GenericNPC::stop()
 {
-  if( this->currentAnim != NULL)
-  {
-    this->currentAnim->stop();
-    delete this->currentAnim;
-    this->currentAnim = NULL;
-
-    this->setAnimation(STAND, MD2_ANIM_LOOP);
-  }
-}
+
+}
+
+
+void GenericNPC::walkTo(const Vector& coordinate)
+{
+}
+
+void GenericNPC::walkTo(float x, float y)
+{}
+
+void GenericNPC::walkTo(float x, float y, float z)
+{}
+
+/* running functions */
+void GenericNPC::runTo(const Vector& coordinate)
+{}
+void GenericNPC::runTo(float x, float y)
+{}
+void GenericNPC::runTo(float x, float y, float z)
+{}
+
+/* couching functinos */
+void GenericNPC::crouchTo(const Vector& coordinate)
+{}
+void GenericNPC::crouchTo(float x, float y)
+{}
+void GenericNPC::crouchTo(float x, float y, float z)
+{}
+
+
+
+void GenericNPC::turnTo(float degreeInY)
+{}
+
 
 
@@ -407,48 +184,7 @@
  * @param worldEntity: the worldentity to look at
  */
-float GenericNPC::lookAt(WorldEntity* worldEntity)
-{}
-
-
-/**
- * turns to a given direction
- */
-bool GenericNPC::turnTo(float qu, float qx, float qy, float qz)
-{
-  Quaternion destDir = Quaternion(Vector(qx, qy, qz).getNormalized(), qu);
-
-  printf("Turning: %f, %f, %f, %f \n",qu,qx,qy,qz);
-  // check if this is the current goal
-  if( this->destDir != destDir)
-  {
-//     if( this->currentAnim != NULL)
-//       this->currentAnim->stop();
-//
-    PRINTF(0)("SET ANIMATION\n");
-    this->destDir = destDir;
-//
-
-
-    if( this->currentAnim != NULL)
-      delete this->currentAnim;
-
-    this->setAbsDir(destDir);
-/*
-    this->currentAnim = new Animation3D(this);
-    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), 0.0f, ANIM_LINEAR, ANIM_LINEAR);
-    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR);
-    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->destDir, time, ANIM_LINEAR, ANIM_LINEAR);
-
-
-    this->currentAnim->setInfinity(ANIM_INF_CONSTANT);
-    this->currentAnim->play();*/
-
-    this->setAnimation(STAND, MD2_ANIM_LOOP);
-  }
-
-  // calculate the distance
-  Vector distance = this->getAbsCoor() - this->destCoor;
-  return distance.len();
-}
+void GenericNPC::lookAt(WorldEntity* worldEntity)
+{}
+
 
 
@@ -459,5 +195,5 @@
  * @param dialogNr: sound nr to be played (from the xml load tags)
  */
-float GenericNPC::talkTo(WorldEntity* worldEntity, int dialogNr)
+void GenericNPC::talkTo(WorldEntity* worldEntity, int dialogNr)
 {}
 
Index: branches/single_player_map/src/world_entities/npcs/generic_npc.h
===================================================================
--- branches/single_player_map/src/world_entities/npcs/generic_npc.h	(revision 8907)
+++ branches/single_player_map/src/world_entities/npcs/generic_npc.h	(revision 8908)
@@ -10,11 +10,6 @@
 #include "npc.h"
 
-#include <string>
 
 #include "sound_source.h"
-
-#include "vector.h"
-#include "quaternion.h"
-
 
 namespace OrxSound{ class SoundSource; }
@@ -27,10 +22,10 @@
 class GenericNPC : public NPC
 {
+
+
  public:
-  GenericNPC();
-  GenericNPC(const TiXmlElement* root);
+  GenericNPC(const TiXmlElement* root = NULL);
   virtual ~GenericNPC ();
 
-  void init();
   virtual void loadParams(const TiXmlElement* root);
 
@@ -40,21 +35,22 @@
 
 
-  /* npc controlling functions */
 
+  bool finalGoalReached() const { return this->behaviourList.empty(); };
+
+  /* npc controlling functions to be Queued */
   /* walking functions */
-  float walkTo(const Vector& coordinate, const Quaternion& dir);
-  float walkTo(float x, float y, float z);
-  float walkTo(float x, float y, float z, float qu, float qx, float qy, float qz);
-  float walkTo(float x, float y, float qu, float qx, float qy, float qz);
+  void walkTo(const Vector& coordinate);
+  void walkTo(float x, float y);
+  void walkTo(float x, float y, float z);
 
   /* running functions */
-  float runTo(const Vector& coordinate, const Quaternion& dir);
-  float runTo(float x, float y, float z, float qu, float qx, float qy, float qz);
-  float runTo(float x, float y, float qu, float qx, float qy, float qz);
+  void runTo(const Vector& coordinate);
+  void runTo(float x, float y);
+  void runTo(float x, float y, float z);
 
   /* couching functinos */
-  float crouchTo(const Vector& coordinate, const Quaternion& dir);
-  float crouchTo(float x, float y, float z, float qu, float qx, float qy, float qz);
-  float crouchTo(float x, float y, float qu, float qx, float qy, float qz);
+  void crouchTo(const Vector& coordinate);
+  void crouchTo(float x, float y);
+  void crouchTo(float x, float y, float z);
 
   /* stopping the movement */
@@ -62,9 +58,10 @@
 
   /* some oriantation functions */
-  float lookAt(WorldEntity* worldEntity);
-  bool turnTo(float qu, float qx, float qy, float qz);
+  void lookAt(WorldEntity* worldEntity);
+  void turnTo(float qu, float qx, float qy, float qz);
+  void turnTo(float degreeInY);
 
   /* talking funcitons*/
-  float talkTo(WorldEntity* worldEntity, int dialogNr);
+  void talkTo(WorldEntity* worldEntity, int dialogNr);
 
   /* shooting functions */
@@ -77,6 +74,4 @@
   void playSound(int i);
 
-  void setTime(float newTime){ this->time = newTime; };
-  
   virtual void tick (float time);
 
@@ -84,10 +79,47 @@
   void destroy();
 
+  private:
+    void init();
+
 
  private:
+
+   typedef enum {
+    Walk,
+    Run,
+    Crouch,
+    Jump,
+    TurnTo,
+    LookAt,
+    TalkTo,
+
+    Shoot,
+
+
+   } AnimType;
+
+   typedef struct Anim
+   {
+     Anim();
+
+     Vector        v;
+     Quaternion    q;
+
+
+     WorldEntity*  entity;
+     float         speed;
+
+
+     AnimType      type;
+   };
+   typedef std::list<GenericNPC::Anim>     genNPCAnimList;
+
+
+
    OrxSound::SoundSource                   soundSource;
    OrxSound::SoundBuffer*                  soundBuffer;
    float                                   soundVolume;
 
+   std::list<GenericNPC::Anim>             behaviourList;
    Vector                                  destCoor;
    Quaternion                              destDir;
