Index: branches/bsp_model/src/lib/graphics/importer/Makefile.am
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/Makefile.am	(revision 8342)
+++ branches/bsp_model/src/lib/graphics/importer/Makefile.am	(revision 8343)
@@ -21,5 +21,10 @@
                            bsp_file.cc \
                            bsp_tree_node.cc \
-                           bsp_tree_leaf.cc
+                           bsp_tree_leaf.cc \
+                           \
+                           md3/md3_model.cc \
+                           md3/md3_animation.cc \
+                           md3/md3_bone_frame.cc \
+                           md3/md3_mesh.cc
 
 
@@ -49,3 +54,9 @@
 		bsp_file.h \
 		bsp_tree_node.h \
-		bsp_tree_leaf.h
+		bsp_tree_leaf.h \
+                \
+                md3/md3_model.h \
+                md3/md3_animation.h \
+                md3/md3_bone_frame.h \
+                md3/md3_mesh.h
+
Index: branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc	(revision 8342)
+++ branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc	(revision 8343)
@@ -885,62 +885,55 @@
 
 
-  if(/*!worldEntity->isA(CL_PLAYABLE)*/ false) {
-
-
-
+
+
+  bool collision = false;
+  Vector position1 = position + Vector(0.0,0.1,0.0);
+  Vector position2 = position + Vector(0.0,0.2,0.0);
+  Vector dest1 = position1 + forwardDir;
+  Vector dest2 = position2 + forwardDir;
+  dest = position - Vector(0.0, 40.0,0.0);
+  Vector out1;
+  Vector out2;
+
+
+  float height = 40;
+  this->outputAllSolid = false;
+
+  this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest );
+
+  PRINTF(0)(" checking collision: %s, solid = %i, fraction = %f\n", worldEntity->getClassName(), this->outputAllSolid, this->outputFraction);
+//   position1.debug();
+
+  if( this->outputFraction == 1.0f)
+  {
+    if(this->outputAllSolid)
+    {
+      this->collPlane = new plane;
+      this->collPlane->x = 1.0f;
+      this->collPlane->y = 0.0f;
+      this->collPlane->z = 0.0f;
+      collision = true;
+    }
+    else
+      collision = false;
+
+
+    out = dest;
   }
   else {
 
-    bool collision = false;
-    Vector position1 = position + Vector(0.0,0.1,0.0);
-    Vector position2 = position + Vector(0.0,0.2,0.0);
-    Vector dest1 = position1 + forwardDir;
-    Vector dest2 = position2 + forwardDir;
-    dest = position - Vector(0.0, 40.0,0.0);
-    Vector out1;
-    Vector out2;
-
-
-    float height = 40;
-    this->outputAllSolid = false;
-
-    this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest );
-
-    if( this->outputFraction == 1.0f)
-    {
-      if(this->outputAllSolid)
-      {
-        this->collPlane = new plane;
-        this->collPlane->x = 1.0f;
-        this->collPlane->y = 0.0f;
-        this->collPlane->z = 0.0f;
-        collision = true;
-      }
-      else
-        collision = false;
-
-
-      out = dest;
-    }
-    else {
-
-      collision = true;
-      out.x = position.x + (dest.x -position.x) * this->outputFraction;
-      out.y = position.y + (dest.y -position.y) * this->outputFraction;
-      out.z = position.z + (dest.z -position.z) * this->outputFraction;
-
-      Vector out3 = out + Vector(height*this->collPlane->x,height*this->collPlane->y,height*this->collPlane->z);
-      this->out = out;
-      //this->out1 = out1;
-      //this->out2 = out2;
-      //this->drawDebugCube(&out1);
-      //this->drawDebugCube(&out2);
-      //this->drawDebugCube(&out3);
-    }
-    // Return the normal here: Normal's stored in this->collPlane;
-    if(collision ) {
-//       PRINTF(0)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction);
-      worldEntity->registerCollision(this->parent, worldEntity, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out);
-    }
+    collision = true;
+    out.x = position.x + (dest.x -position.x) * this->outputFraction;
+    out.y = position.y + (dest.y -position.y) * this->outputFraction;
+    out.z = position.z + (dest.z -position.z) * this->outputFraction;
+
+    Vector out3 = out + Vector(height*this->collPlane->x,height*this->collPlane->y,height*this->collPlane->z);
+    this->out = out;
+  }
+
+  // Return the normal here: Normal's stored in this->collPlane;
+  if( collision) {
+    PRINTF(0)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction);
+    worldEntity->registerCollision(this->parent, worldEntity, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out);
   }
 
Index: branches/bsp_model/src/lib/graphics/importer/md3/md3_bone_frame.cc
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/md3/md3_bone_frame.cc	(revision 8342)
+++ branches/bsp_model/src/lib/graphics/importer/md3/md3_bone_frame.cc	(revision 8343)
@@ -14,2 +14,3 @@
 
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER
+
Index: branches/bsp_model/src/lib/graphics/importer/md3/md3_mesh.cc
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/md3/md3_mesh.cc	(revision 8342)
+++ branches/bsp_model/src/lib/graphics/importer/md3/md3_mesh.cc	(revision 8343)
@@ -14,2 +14,3 @@
 
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER
+
Index: branches/bsp_model/src/lib/graphics/importer/md3/md3_mesh.h
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/md3/md3_mesh.h	(revision 8342)
+++ branches/bsp_model/src/lib/graphics/importer/md3/md3_mesh.h	(revision 8343)
@@ -12,5 +12,6 @@
 {
   public:
-
+    MD3Mesh() { /* loadMesh(this, din) */ }
+    virtual ~MD3Mesh();
 
 
Index: branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h	(revision 8342)
+++ branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h	(revision 8343)
@@ -1,269 +1,52 @@
 /*!
- * @file md2Model.h
-  *  Definition of an MD2 Model, a model format invented by ID Software.
+ * @file md3_model.h
+ *
+ * Code heavely inspired by: JAVA MD3 Model Viewer - A Java based Quake 3 model viewer
+ * Copyright (C) 1999 Erwin 'KLR8' Vervaet
+ */
 
-    We are deeply thankfull for all the wunderfull things id software made for us gamers!
+#ifndef _MD3_MODEL_H
+#define _MD3_MODEL_H
 
-    The md2 file format is structured in a very simple way: it contains animations which are made out of
-    frames (so called keyframes). Each frame is a complete draweable model in a specific position.
-    A frame is a collection of vertex and its compagnions (normals, texture coordinates).
+#include <string>
 
-    A typical model has about 200 frames, the maximum frame count is fixed by MD2_MAX_FRAMES to currently
-    512 frames. The maximal vetices count is set to 2048 verteces, not enough?
-    You just have to change the MD2_MAX_* values if it doesn't fit your purposes...
 
-    Surface Culling is fully implemented in md2 models: quake2 uses front face culling.
-*/
+class MD3BoneFrame;
+class MD3Mesh;
 
-#ifndef _MD2MODEL_H
-#define _MD2MODEL_H
 
-#include "base_object.h"
+class MD3Model
+{
 
-#include "model.h"
-#include "material.h"
+  public:
+    MD3Model();
+    ~MD3Model();
 
-//! These are the needed defines for the max values when loading .MD2 files
-#define MD2_IDENT                       (('2'<<24) + ('P'<<16) + ('D'<<8) + 'I') //!< the md2 identifier tag in the bin file
-#define MD2_VERSION                     8                                        //!< the md2 version in the header
-#define MD2_MAX_TRIANGLES               4096                                     //!< maximal triangles count
-#define MD2_MAX_VERTICES                2048                                     //!< maximal vertices count
-#define MD2_MAX_TEXCOORDS               2048                                     //!< maximal tex coordinates
-#define MD2_MAX_FRAMES                  512                                      //!< maximal frames
-#define MD2_MAX_SKINS                   32                                       //!< maximal skins
-#define MD2_MAX_FRAMESIZE               (MD2_MAX_VERTICES * 4 + 128)             //!< maximal framesize
 
-#define NUM_VERTEX_NORMALS              162                                      //!< number of vertex normals
-#define SHADEDOT_QUANT                  16                                       //!< shade dot quantity - no idea what it is
 
-//! This stores the speed of the animation between each key frame - currently conflicting with the animation framework
-#define kAnimationSpeed                 12.0f                                    //!< animation speed
+  private:
+    std::string         filename;          //!< the name of the file as recorded in the .md3 file
+    std::string         loadFilename;      //!< filename of the actual file from which data was loaded
 
-//! This holds the header information that is read in at the beginning of the file: id software definition
-struct MD2Header
-{
-   int ident;                           //!< This is used to identify the file
-   int version;                         //!< The version number of the file (Must be 8)
+    int                 boneFrameNum;      //!< number of anumation key fames in the models
+    int                 tagNum;            //!< number of tags
+    int                 meshNum;           //!< number of meshes
 
-   int skinWidth;                       //!< The skin width in pixels
-   int skinHeight;                      //!< The skin height in pixels
-   int frameSize;                       //!< The size in bytes the frames are
+    int                 maxTextureNum;     //!< maximum number of unique used in an md3 file
+    int                 boneFrameStart;    //!< starting position of bone frame data structures
+    int                 tagStart;          //!< starting position of tag-structures
 
-   int numSkins;                        //!< The number of skins associated with the model
-   int numVertices;                     //!< The number of vertices (constant for each frame)
-   int numTexCoords;                    //!< The number of texture coordinates
-   int numTriangles;                    //!< The number of faces (polygons)
-   int numGlCommands;                   //!< The number of gl commands
-   int numFrames;                       //!< The number of animation frames
+    int                 meshStart;         //!< starting position of mesh structures
 
-   int offsetSkins;                     //!< The offset in the file for the skin data
-   int offsetTexCoords;                 //!< The offset in the file for the texture data
-   int offsetTriangles;                 //!< The offset in the file for the face data
-   int offsetFrames;                    //!< The offset in the file for the frames data
-   int offsetGlCommands;                //!< The offset in the file for the gl commands data
-   int offsetEnd;                       //!< The end of the file offset
+    int                 fileSize;          //!< file size
+
+
+    MD3BoneFrame*       boneFrames;        //!< array of bone frames, contains the metadata (bounding box, tags,...) for each frame
+    MD3Mesh*            meshes;            //!< array of meshes in the model. each containing the mesh for each of the animation
+
+    int                 parentTagIndex;    //!< tag index
+    MD3Model*           parent;            //!< reference to the MD3Model
 };
 
 
-//! 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
-
-  int              animPlaybackMode;     //!< the playback mode
-} sAnimState;
-
-
-//! animation names enumeration
-typedef enum animType
-  {
-    STAND,                       //0
-    RUN,                         //1
-    ATTACK,                      //2
-    PAIN_A,                      //3
-    PAIN_B,                      //4
-    PAIN_C,          //5
-    JUMP,            //6
-    FLIP,            //7
-    SALUTE,          //8
-    FALLBACK,        //9
-    WAVE,            //10
-    POINT,           //11
-    CROUCH_STAND,
-    CROUCH_WALK,
-    CROUCH_ATTACK,
-    CROUCH_PAIN,
-    CROUCH_DEATH,
-    DEATH_FALLBACK,
-    DEATH_FALLFORWARD,
-    DEATH_FALLBACKSLOW,
-    BOOM,
-
-    MAX_ANIMATIONS
-  };
-
-
-typedef enum animPlayback
-{
-  MD2_ANIM_LOOP = 0,
-  MD2_ANIM_ONCE,
-
-  MD2_ANIM_NUM
-};
-
-
-
-/* forward definitions */
-class Material;
-
-
-
-//! class to store the md2 data in
-class MD2Data : public BaseObject
-{
- public:
-   MD2Data(const std::string& modelFileName, const std::string& skinFileName, float scale = 1.0f);
-  virtual ~MD2Data();
-
- private:
-   bool loadModel(const std::string& fileName);
-   bool loadSkin(const std::string& fileName = "");
-
- public:
-  int                numFrames;             //!< number of frames
-  int                numVertices;           //!< number of vertices
-  int                numTriangles;          //!< number of triangles
-  int                numTexCoor;            //!< number of texture coordinates
-  int                numGLCommands;         //!< number of gl commands in the glList (tells how to draw)
-  std::string        fileName;              //!< file name of the model File
-  std::string        skinFileName;          //!< file name of the skin file
-  MD2Header*         header;                //!< the header file
-
-  sVec3D*            pVertices;             //!< pointer to the vertices data block
-  sTriangle*         pTriangles;            //!< pointer to the triangles data
-  sTexCoor*          pTexCoor;              //!< pointer to the texture coordinate data
-  int*               pGLCommands;           //!< pointer to the gllist data block
-  int*               pLightNormals;         //!< pointer to the light normals
-
-  Material           material;              //!< pointer to the material
-  float              scaleFactor;           //!< the scale factor of the model, (global)
-};
-
-
-
-
-//! This is a MD2 Model class
-class MD2Model : public Model {
-
-public:
-  MD2Model(const std::string& modelFileName, const std::string& skinFileName = "", float scale = 1.0f);
-  virtual ~MD2Model();
-
-  virtual void draw() const;
-  void renderFrameTriangles() const;
-
-
-  void setAnim(int type, int animPlayback = MD2_ANIM_LOOP);
-  /**  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;}
-
-  virtual void tick(float dtS);
-  void debug();
-
-
-private:
-  void animate(float time);
-  void processLighting();
-  void interpolate(/*sVec3D* verticesList*/);
-  void renderFrame() const ;
-
-
- public:
-  /* these variables are static, because they are all the same for every model */
-  static sVec3D       anorms[NUM_VERTEX_NORMALS];       //!< the anormals
-  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
-
- private:
-  float               scaleFactor;                      //!< the scale factor (individual)
-  sAnimState          animationState;                   //!< animation state of the model
-  sVec3D              verticesList[MD2_MAX_VERTICES];   //!< place to temp sav the vert
-};
-
-
-
-
-
-#endif /* _MD2MODEL_H */
+#endif /* _MD3_MODEL_H */
Index: branches/bsp_model/src/world_entities/space_ships/collision_probe.cc
===================================================================
--- branches/bsp_model/src/world_entities/space_ships/collision_probe.cc	(revision 8342)
+++ branches/bsp_model/src/world_entities/space_ships/collision_probe.cc	(revision 8343)
@@ -63,5 +63,5 @@
   this->setHealth(80);
 
-  this->toList(OM_GROUP_01);
+  this->toList(OM_GROUP_00);
   this->loadMD2Texture("maps/dr_freak.pcx");
   this->loadModel("models/dr_freak.md2");
