Index: branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc	(revision 8638)
+++ branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc	(revision 8640)
@@ -582,10 +582,8 @@
   int MD3Model::prev(MD3Data* data, int nr)
   {
-#if 0
-    if( nr == anim.first)
-      return upperBound-1;
+    if( nr == data->animation->first)
+      return data->upperBound - 1;
     else
-      return nr-1;
-#endif
+      return nr - 1;
   }
 
@@ -599,54 +597,61 @@
   void MD3Model::doOp(MD3Data* data)
   {
-#if 0
-    //anim to be applied could have illegal data with respect to this model,
-    //ignore anim in this case
-    if( anim.first >= model.boneFrameNum || anim.first < 0)
+    // animation to be applied could have illegal data with respect to this model,
+    // ignore anim in this case
+    if( data->animation->first >= data->header->boneFrameNum || data->animation->first < 0)
       return;
 
-                //calc upper bound for animation frames in this model
-    if( anim.num < 0)
-      upperBound=model.boneFrameNum; //use all available frames
+    //calc upper bound for animation frames in this model
+    if( data->animation->numFrames < 0)
+      data->upperBound = data->header->boneFrameNum; //use all available frames
     else
-      upperBound=model.boneFrameNum<(anim.first+anim.num)?model.boneFrameNum:(anim.first+anim.num);
-
-    switch (op) {
+      data->upperBound = data->header->boneFrameNum <
+          (data->animation->first + data->animation->numFrames)?data->header->boneFrameNum:(data->animation->first +
+          data->animation->numFrames);
+
+    switch( data->op) {
+
       case NEXT:
-        if (interpolate) {
-          model.interpolationFraction+=FRACTION;
-          if (model.interpolationFraction>=1.0f) {
-            model.currentFrame=model.nextFrame;
-            model.nextFrame=next(model.nextFrame);
-            model.interpolationFraction=0.0f;
+        if( data->bInterpolate)
+        {
+          data->animationState.interpolationFraction += FRACTION;
+          if( data->animationState.interpolationFraction >= 1.0f)
+          {
+            data->animationState.currentFrame = data->animationState.nextFrame;
+            data->animationState.nextFrame = next(data, data->animationState.nextFrame);
+            data->animationState.interpolationFraction = 0.0f;
           }
         }
         else {
-          model.currentFrame=model.nextFrame;
-          model.nextFrame=next(model.nextFrame);
+          data->animationState.currentFrame = data->animationState.nextFrame;
+          data->animationState.nextFrame = next(data, data->animationState.nextFrame);
         }
         break;
+
       case PREVIOUS:
-        if (interpolate) {
-          model.interpolationFraction-=FRACTION;
-          if (model.interpolationFraction<0.0f) {
-            model.nextFrame=model.currentFrame;
-            model.currentFrame=prev(model.currentFrame);
-            model.interpolationFraction=0.8f;
+        if( data->bInterpolate)
+        {
+          data->animationState.interpolationFraction -= FRACTION;
+          if( data->animationState.interpolationFraction < 0.0f)
+          {
+            data->animationState.nextFrame = data->animationState.currentFrame;
+            data->animationState.currentFrame = prev(data, data->animationState.currentFrame);
+            data->animationState.interpolationFraction = 0.8f;
           }
         }
-        else {
-          model.nextFrame=model.currentFrame;
-          model.currentFrame=prev(model.currentFrame);
+        else
+        {
+          data->animationState.nextFrame = data->animationState.currentFrame;
+          data->animationState.currentFrame = prev(data, data->animationState.currentFrame);
         }
         break;
+
       case REWIND:
-        model.currentFrame=anim.first;
-        model.nextFrame=next(model.currentFrame);
-        model.interpolationFraction=0.0f;
+        data->animationState.currentFrame = data->animation->first;
+        data->animationState.nextFrame = next(data, data->animationState.currentFrame);
+        data->animationState.interpolationFraction = 0.0f;
         break;
     }
-#endif
-  }
-
+  }
 
 
