//Anim
DWORD Time, ElapsedTime,  t2;
DWORD LastTimee=0;
float t;
DWORD StartFrame, LpStartFrame, EndFrame,LpCurrentFrame, CurrentFrame, NextFrame;
float ANIMATION_SPEED, tisyacha;


//-----------------------------------------------------------------
DWORD ReturnCurrentTime()
{
ANIMATION_SPEED=5.0f;  //скорость анимации
tisyacha=1000.0f;

Time=GetTickCount();
ElapsedTime=Time-LastTimee;


//t= ElapsedTime / (1000 / ANIMATION_SPEED);
//                  1000/5.0=200
//004DEC7Ah=5106810/200 =25534.049999999999



t2=  1000 / ANIMATION_SPEED;
t=  ElapsedTime / t2;


//$fild t;
//$fild t2;


IF (ElapsedTime>=t2) {

                EBX=LpCurrentFrame+sizeof(md2_frame_t);
                LpCurrentFrame=EBX;
                CurrentFrame=DSDWORD[LpCurrentFrame];

                IF (NextFrame>=EndFrame)  {
                                          LpCurrentFrame=LpStartFrame;
                                          CurrentFrame=DSDWORD[LpCurrentFrame];
                                          NextFrame=DSDWORD[LpCurrentFrame+sizeof(md2_frame_t)];
	                                  }
	        ELSE 
                NextFrame=DSDWORD[LpCurrentFrame+sizeof(md2_frame_t)];

LastTimee=Time;
                
           }


RETURN t;
}



BOOLEAN InitFrame()
{
static DWORD SummaFrames;
//EBX=md2_model.header.numFrames;     
//C6h=198;

/*
struct md2_frame_t     
{
   char   name[16];   
   DWORD  vertices;      //md2_triangleVertex_t
};
sizeof(md2_frame_t)
*/

//EBX=md2_model.header.numFrames*sizeof(md2_frame_t);
SummaFrames=md2_model.header.numFrames-2;
EBX=SummaFrames*sizeof(md2_frame_t);
EAX=DSDWORD[md2_model.frames+EBX+#md2_frame_t.vertices];
//EAX+=EBX;
EndFrame=EAX; 



EBX=md2_model.frames+#md2_frame_t.vertices;
LpStartFrame=EBX;
LpCurrentFrame=EBX;
StartFrame=DSDWORD[EBX];


CurrentFrame=StartFrame;

NextFrame=DSDWORD[LpCurrentFrame+sizeof(md2_frame_t)];




RETURN TRUE;
}

