Index: trunk/src/lib/graphics/graphics_engine.cc
===================================================================
--- trunk/src/lib/graphics/graphics_engine.cc	(revision 6165)
+++ trunk/src/lib/graphics/graphics_engine.cc	(revision 6222)
@@ -37,5 +37,4 @@
 #ifdef __WIN32__
  #include "class_list.h"
- #include "list.h"
  #include "static_model.h"
 #endif
@@ -579,6 +578,6 @@
   std::list<WorldEntity*>::const_iterator entity;
   for (entity = drawList.begin(); entity != drawList.end(); entity++)
-    if ((*entity)->isVisible()) 
-      (*entity)->draw(); 
+    if ((*entity)->isVisible())
+      (*entity)->draw();
 }
 
Index: trunk/src/lib/graphics/importer/md2Model.cc
===================================================================
--- trunk/src/lib/graphics/importer/md2Model.cc	(revision 6165)
+++ trunk/src/lib/graphics/importer/md2Model.cc	(revision 6222)
@@ -21,6 +21,4 @@
 #include "resource_manager.h"
 
-//#include <fstream>
-
 
 using namespace std;
@@ -36,6 +34,4 @@
 };
 
-//! again one of these strange id software parts
-static float *shadeDots = MD2Model::anormsDots[0];
 
 //! the angle under which the model is viewd, used internaly
@@ -46,26 +42,26 @@
 sAnim MD2Model::animationList[21] =
   {
- // begin, end, fps
-    {   0,  39,  9 },   //!< STAND
-    {  40,  45, 10 },   //!< RUN
-    {  46,  53, 10 },   //!< ATTACK
-    {  54,  57,  7 },   //!< PAIN_A
-    {  58,  61,  7 },   //!< PAIN_B
-    {  62,  65,  7 },   //!< PAIN_C
-    {  66,  71,  7 },   //!< JUMP
-    {  72,  83,  7 },   //!< FLIP
-    {  84,  94,  7 },   //!< SALUTE
-    {  95, 111, 10 },   //!< FALLBACK
-    { 112, 122,  7 },   //!< WAVE
-    { 123, 134,  6 },   //!< POINTT
-    { 135, 153, 10 },   //!< CROUCH_STAND
-    { 154, 159,  7 },   //!< CROUCH_WALK
-    { 160, 168, 10 },   //!< CROUCH_ATTACK
-    { 196, 172,  7 },   //!< CROUCH_PAIN
-    { 173, 177,  5 },   //!< CROUCH_DEATH
-    { 178, 183,  7 },   //!< DEATH_FALLBACK
-    { 184, 189,  7 },   //!< DEATH_FALLFORWARD
-    { 190, 197,  7 },   //!< DEATH_FALLBACKSLOW
-    { 198, 198,  5 },   //!< BOOM
+ // begin, end, fps, interruptable
+    {   0,  39,  9, 1 },   //!< STAND
+    {  40,  45, 10, 1 },   //!< RUN
+    {  46,  53, 10, 0 },   //!< ATTACK
+    {  54,  57,  7, 1 },   //!< PAIN_A
+    {  58,  61,  7, 1 },   //!< PAIN_B
+    {  62,  65,  7, 1 },   //!< PAIN_C
+    {  66,  71,  7, 0 },   //!< JUMP
+    {  72,  83,  7, 1 },   //!< FLIP
+    {  84,  94,  7, 1 },   //!< SALUTE
+    {  95, 111, 10, 1 },   //!< FALLBACK
+    { 112, 122,  7, 1 },   //!< WAVE
+    { 123, 134,  6, 1 },   //!< POINTT
+    { 135, 153, 10, 1 },   //!< CROUCH_STAND
+    { 154, 159,  7, 1 },   //!< CROUCH_WALK
+    { 160, 168, 10, 1 },   //!< CROUCH_ATTACK
+    { 196, 172,  7, 1 },   //!< CROUCH_PAIN
+    { 173, 177,  5, 0 },   //!< CROUCH_DEATH
+    { 178, 183,  7, 0 },   //!< DEATH_FALLBACK
+    { 184, 189,  7, 0 },   //!< DEATH_FALLFORWARD
+    { 190, 197,  7, 0 },   //!< DEATH_FALLBACKSLOW
+    { 198, 198,  5, 1 },   //!< BOOM
   };
 
@@ -87,5 +83,12 @@
 
   this->scaleFactor = this->data->scaleFactor;
+
+  shadeDots = MD2Model::anormsDots[0];
+  /* set the animation stat mannualy */
+  this->animationState.type = STAND;
+  this->animationState.numPlays = 1;
   this->setAnim(STAND);
+
+  this->debug();
 }
 
@@ -103,10 +106,10 @@
 /**
  *  initializes an array of vert with the current frame scaled vertices
- * @param verticesList: the list of vertices to interpolate between
+ * @param this->verticesList: the list of vertices to interpolate between
 
    we won't use the pVertices array directly, since its much easier and we need
    saving of data anyway
 */
-void MD2Model::interpolate(sVec3D* verticesList)
+void MD2Model::interpolate(/*sVec3D* this->verticesList*/)
 {
   sVec3D* currVec;
@@ -118,7 +121,7 @@
   for( int i = 0; i < this->data->numVertices; ++i)
     {
-      verticesList[i][0] = currVec[i][0] + this->animationState.interpolationState * (nextVec[i][0] - currVec[i][0]);
-      verticesList[i][1] = currVec[i][1] + this->animationState.interpolationState * (nextVec[i][1] - currVec[i][1]);
-      verticesList[i][2] = currVec[i][2] + this->animationState.interpolationState * (nextVec[i][2] - currVec[i][2]);
+      this->verticesList[i][0] = currVec[i][0] + this->animationState.interpolationState * (nextVec[i][0] - currVec[i][0]);
+      this->verticesList[i][1] = currVec[i][1] + this->animationState.interpolationState * (nextVec[i][1] - currVec[i][1]);
+      this->verticesList[i][2] = currVec[i][2] + this->animationState.interpolationState * (nextVec[i][2] - currVec[i][2]);
     }
 }
@@ -135,4 +138,10 @@
   if( (type < 0) || (type > MAX_ANIMATIONS) )
     type = STAND;
+
+  if( MD2Model::animationList[this->animationState.type].bStoppable == 0)
+  {
+    if( this->animationState.numPlays == 0 )
+      return;
+  }
 
   this->animationState.startFrame = animationList[type].firstFrame;
@@ -141,4 +150,5 @@
   this->animationState.fps = animationList[type].fps;
   this->animationState.type = type;
+  this->animationState.numPlays = 0;
 
   this->animationState.interpolationState = 0.0f;
@@ -155,5 +165,7 @@
 void MD2Model::tick(float time)
 {
-  this->animationState.localTime += time;
+  this->animate(time);
+  this->processLighting();
+  this->interpolate(/*this->verticesList*/);
 }
 
@@ -164,13 +176,9 @@
  * FIXME
  */
-void MD2Model::draw()
-{
-  if( likely(this->animationState.localTime > 0.0))
-    this->animate();
-
+void MD2Model::draw() const
+{
   glPushMatrix();
-
   this->renderFrame();
-
+  // renderFrameTriangles();
   glPopMatrix();
 }
@@ -180,7 +188,6 @@
   \brief this is an internal function to render this special frame selected by animate()
 */
-void MD2Model::renderFrame()
-{
-  static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */
+void MD2Model::renderFrame() const
+{
   int* pCommands = this->data->pGLCommands;
 
@@ -191,6 +198,4 @@
   glCullFace(GL_BACK);
 
-  this->processLighting();
-  this->interpolate(verticesList);
   this->data->material->select();
 
@@ -208,10 +213,9 @@
         }
 
-
       for(; i > 0; i--, pCommands += 3) /* down counting for loop, next 3 gl commands */
         {
           glTexCoord2f( ((float *)pCommands)[0], ((float *)pCommands)[1] );
           glNormal3fv(anorms[this->data->pLightNormals[pCommands[2]]]);
-          glVertex3fv(verticesList[pCommands[2]]);
+          glVertex3fv(this->verticesList[pCommands[2]]);
         }
       glEnd();
@@ -223,4 +227,47 @@
 
 
+void MD2Model::renderFrameTriangles() const
+{
+  //static sVec3D this->verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */
+  int* pCommands = this->data->pGLCommands;
+  /* some face culling stuff */
+//   glPushAttrib(GL_POLYGON_BIT);
+//   glFrontFace(GL_CW);
+//   glEnable(GL_CULL_FACE);
+//   glCullFace(GL_BACK);
+//
+//   this->processLighting();
+//   this->interpolate(/*this->verticesList*/);
+  this->data->material->select();
+
+  /* draw the triangles */
+  glBegin(GL_TRIANGLES);
+
+  for( int i = 0, k = 0; i < this->data->numTriangles; ++i, k += 3)
+  {
+    float* v = this->data->pVertices[this->data->pTriangles[i].indexToVertices[0]];
+
+    printf("triangle: %i\n", i);
+    printf("     v0: (%f, %f, %f)\n", v[0], v[1], v[2]);
+    v = this->data->pVertices[this->data->pTriangles[i].indexToVertices[1]];
+    printf("     v1: (%f, %f, %f)\n", v[0], v[1], v[2]);
+    v = this->data->pVertices[this->data->pTriangles[i].indexToVertices[2]];
+    printf("     v2: (%f, %f, %f)\n", v[0], v[1], v[2]);
+
+
+    glNormal3f(anorms[i][0], anorms[i][1], anorms[i][2]);
+    glVertex3fv(this->data->pVertices[this->data->pTriangles[i].indexToVertices[0]]);
+
+    glNormal3f(anorms[i][0], anorms[i][1], anorms[i][2]);
+    glVertex3fv(this->data->pVertices[this->data->pTriangles[i].indexToVertices[1]]);
+
+    glNormal3f(anorms[i][0], anorms[i][1], anorms[i][2]);
+    glVertex3fv(this->data->pVertices[this->data->pTriangles[i].indexToVertices[2]]);
+  }
+
+  glEnd();
+}
+
+
 /**
   \brief animates the current model
@@ -228,6 +275,8 @@
   depending on the time passed (tick function), the player will select another model
 */
-void MD2Model::animate()
-{
+void MD2Model::animate(float time)
+{
+  this->animationState.localTime += time;
+
   if( this->animationState.localTime - this->animationState.lastTime > (1.0f / this->animationState.fps))
     {
@@ -236,5 +285,8 @@
 
       if( this->animationState.nextFrame > this->animationState.endFrame)
+      {
         this->animationState.nextFrame = this->animationState.startFrame;
+        this->animationState.numPlays++;
+      }
       this->animationState.lastTime = this->animationState.localTime;
     }
@@ -297,5 +349,6 @@
   this->numTexCoor = 0;
 
-  this->scaleFactor = 0.2f;
+//   this->scaleFactor = 1.0f;
+  this->scaleFactor = 0.1f;
 
   this->fileName = NULL;
@@ -399,11 +452,14 @@
         {
           /* SPEEDUP: *(pVerts + i + 0) = (*(frame->pVertices + i + 0)...  */
-          pVertex[j][0] = ((frame->pVertices[j].v[0] * frame->scale[0] ) + frame->translate[0] )* this->scaleFactor;
-          pVertex[j][1] = ((frame->pVertices[j].v[2] * frame->scale[2]) + frame->translate[2]) * this->scaleFactor;
-          pVertex[j][2] = (-1.0 * (frame->pVertices[j].v[1] * frame->scale[1] + frame->translate[1])) * this->scaleFactor;
+           pVertex[j][0] = ((frame->pVertices[j].v[0] * frame->scale[0] ) + frame->translate[0] )* this->scaleFactor;
+           pVertex[j][1] = ((frame->pVertices[j].v[2] * frame->scale[2]) + frame->translate[2]) * this->scaleFactor;
+           pVertex[j][2] = (-1.0 * (frame->pVertices[j].v[1] * frame->scale[1] + frame->translate[1])) * this->scaleFactor;
+
+          //printf("vertex %i/%i: (%f, %f, %f)\n", j, this->numVertices, pVertex[j][0], pVertex[j][1], pVertex[j][2]);
 
           pNormals[j] = frame->pVertices[j].lightNormalIndex;
         }
     }
+    PRINTF(4)("Finished loading the md2 file\n");
 
   delete [] buffer;
Index: trunk/src/lib/graphics/importer/md2Model.h
===================================================================
--- trunk/src/lib/graphics/importer/md2Model.h	(revision 6165)
+++ trunk/src/lib/graphics/importer/md2Model.h	(revision 6222)
@@ -65,4 +65,76 @@
 };
 
+
+//! compressed vertex data: char insetead of float, the value will be expanded by the scale value. only for loading
+typedef struct
+{
+  unsigned char    v[3];                 //!< the vector of the vertex
+  unsigned char    lightNormalIndex;     //!< the index of the light normal
+} sVertex;
+
+
+//! compressed texture offset data: coords scaled by the texture size. Only for loading
+typedef struct
+{
+  short            s;                    //!< the s,t coordinates of a texture
+  short            t;                    //!< the s,t coordinates of a texture
+} sTexCoor;
+
+
+//! holds tha informations about a md2 frame
+typedef struct
+{
+  sVec3D           scale;                //!< scales values of the model
+  sVec3D           translate;            //!< translates the model
+  char             name[16];             //!< frame name: something like "run32"
+  sVertex          pVertices[1];         //!< first vertex of thes frame
+} sFrame;
+
+
+//! holds the information about a triangle
+typedef struct
+{
+  unsigned short   indexToVertices[3];   //!< index to the verteces of the triangle
+  unsigned short   indexToTexCoor[3];    //!< index to the texture coordinates
+} sTriangle;
+
+
+
+//! the command list of the md2 model, very md2 specific
+typedef struct
+{
+  float            s;                    //!< texture coordinate 1
+  float            t;                    //!< texture coordinate 2
+  int              vertexIndex;          //!< index of the vertex in the vertex list
+} glCommandVertex;
+
+
+//! a md2 animation definition
+typedef struct
+{
+  int              firstFrame;           //!< first frame of the animation
+  int              lastFrame;            //!< last frame of the animation
+  int              fps;                  //!< speed: number of frames per second
+  int              bStoppable;           //!< 1 if the animation is stoppable 0 else
+} sAnim;
+
+
+//! animation state definition
+typedef struct
+{
+  int              startFrame;           //!< the start frame of an animation
+  int              endFrame;             //!< last frame of the animation
+  int              fps;                  //!< fps of the animaion (speed)
+
+  float            localTime;            //!< the local time
+  float            lastTime;             //!< last time stamp
+  float            interpolationState;   //!< the state of the animation [0..1]
+
+  int              type;                 //!< animation type
+
+  int              currentFrame;         //!< the current frame
+  int              nextFrame;            //!< the next frame in the list
+  int              numPlays;             //!< the number of times, this has been played in series
+} sAnimState;
 
 
@@ -143,22 +215,23 @@
   virtual ~MD2Model();
 
-  void draw();
+  virtual void draw() const;
+  void renderFrameTriangles() const;
+
 
   void setAnim(int type);
-  /**
-   *  scales the current model
-   * @param scaleFactor: the factor [0..1] to use for scaling
-  */
+  /**  returns the current animation @returns animation type */
+  inline int MD2Model::getAnim() { return this->animationState.type; }
+  /**  scales the current model @param scaleFactor: the factor [0..1] to use for scaling */
   void scaleModel(float scaleFactor) { this->scaleFactor = scaleFactor;}
 
-  void tick(float dtS);
+  virtual void tick(float dtS);
   void debug();
 
 
 private:
-  void animate();
+  void animate(float time);
   void processLighting();
-  void interpolate(sVec3D* verticesList);
-  void renderFrame();
+  void interpolate(/*sVec3D* verticesList*/);
+  void renderFrame() const ;
 
 
@@ -168,4 +241,6 @@
   static float        anormsDots[SHADEDOT_QUANT][256];  //!< the anormals dot products
   static sAnim        animationList[21];                //!< the anomation list
+   //! again one of these strange id software parts
+  float*              shadeDots;
 
   MD2Data*            data;                             //!< the md2 data pointer
@@ -174,4 +249,5 @@
   float               scaleFactor;                      //!< the scale factor (individual)
   sAnimState          animationState;                   //!< animation state of the model
+  sVec3D              verticesList[MD2_MAX_VERTICES];   //!< place to temp sav the vert
 };
 
Index: trunk/src/lib/graphics/importer/model.h
===================================================================
--- trunk/src/lib/graphics/importer/model.h	(revision 6165)
+++ trunk/src/lib/graphics/importer/model.h	(revision 6222)
@@ -29,39 +29,4 @@
 
 
-
-//! compressed vertex data: char insetead of float, the value will be expanded by the scale value. only for loading
-typedef struct
-{
-  char             v[3];                 //!< the vector of the vertex
-  unsigned char    lightNormalIndex;     //!< the index of the light normal
-} sVertex;
-
-
-//! compressed texture offset data: coords scaled by the texture size. Only for loading
-typedef struct
-{
-  short            s;                    //!< the s,t coordinates of a texture
-  short            t;                    //!< the s,t coordinates of a texture
-} sTexCoor;
-
-
-//! holds tha informations about a md2 frame
-typedef struct
-{
-  sVec3D           scale;                //!< scales values of the model
-  sVec3D           translate;            //!< translates the model
-  char             name[16];             //!< frame name: something like "run32"
-  sVertex          pVertices[1];         //!< first vertex of thes frame
-} sFrame;
-
-
-//! holds the information about a triangle
-typedef struct
-{
-  unsigned short   indexToVertices[3];   //!< index to the verteces of the triangle
-  unsigned short   indexToTexCoor[3];    //!< index to the texture coordinates
-} sTriangle;
-
-
 //! holds the information about a triangle
 typedef struct
@@ -72,39 +37,4 @@
 } sTriangleExt;
 
-
-//! the command list of the md2 model, very md2 specific
-typedef struct
-{
-  float            s;                    //!< texture coordinate 1
-  float            t;                    //!< texture coordinate 2
-  int              vertexIndex;          //!< index of the vertex in the vertex list
-} glCommandVertex;
-
-
-//! a md2 animation definition
-typedef struct
-{
-  int              firstFrame;           //!< first frame of the animation
-  int              lastFrame;            //!< last frame of the animation
-  int              fps;                  //!< speed: number of frames per second
-} sAnim;
-
-
-//! animation state definition
-typedef struct
-{
-  int              startFrame;           //!< the start frame of an animation
-  int              endFrame;             //!< last frame of the animation
-  int              fps;                  //!< fps of the animaion (speed)
-
-  float            localTime;            //!< the local time
-  float            lastTime;             //!< last time stamp
-  float            interpolationState;   //!< the state of the animation [0..1]
-
-  int              type;                 //!< animation type
-
-  int              currentFrame;         //!< the current frame
-  int              nextFrame;            //!< the next frame in the list
-} sAnimState;
 
 //! Model Information definitions
@@ -122,5 +52,4 @@
 
 } modelInfo;
-
 
 
Index: trunk/src/lib/graphics/render2D/render_2d.cc
===================================================================
--- trunk/src/lib/graphics/render2D/render_2d.cc	(revision 6165)
+++ trunk/src/lib/graphics/render2D/render_2d.cc	(revision 6222)
@@ -20,5 +20,4 @@
 #include "graphics_engine.h"
 #include "class_list.h"
-#include "list.h"
 #include "element_2d.h"
 
Index: trunk/src/lib/graphics/text_engine/text_engine.cc
===================================================================
--- trunk/src/lib/graphics/text_engine/text_engine.cc	(revision 6165)
+++ trunk/src/lib/graphics/text_engine/text_engine.cc	(revision 6222)
@@ -37,5 +37,4 @@
 
 #include "debug.h"
-#include "list.h"
 
 ///////////////////
