reman3/Rayman_X/cpa/tempgrp/GAM/PlayAnim/Anim.c

140 lines
4.4 KiB
C

/*ANNECY CT 20/02/98{*/
#include "TOOLSCPA.h"
#include "GAM.H"
#include "PlayAnim/Anim.h"
#include "ZeMem.h"
#include "GAM\STRUCTUR\anim_s.h"
#include "gam/actions/3ddata.h"
/*******************************************************/
/* Function : fn_vFreeJustStructAnim*/
/* Input : Animation*/
/**/
/* Free just the structure (pointer fields are not freed)*/
/**/
/* Create : 20/02/98 Carlos Torres*/
/*******************************************************/
/*void fn_vFreeJustStructAnim(tdstAnim3d * p_stAnim) {
M_GameFreeInHLM(p_stAnim);
}*/
/*******************************************************/
/* Function : fn_vFreeSubStructAnim*/
/* Input : Animation*/
/**/
/* Free sub structure in the animation structure*/
/* the structre tdstAnim3d is not freed*/
/**/
/* Create : 20/02/98 Carlos Torres*/
/* Modif : Free Morphing table (Carlos Torres) 06/03/98*/
/*******************************************************/
/*void fn_vFreeSubStructAnim(tdstAnim3d * p_stAnim)
{
int iFrame,j;
if (!p_stAnim)
return;
// free Frame Table
if (p_stAnim->d_stFrame3d) {
tdstFrame3d * p_stFrame3d;
MTH3D_tdstVector * p_stPreviousLinearSpeedVector=NULL;
MTH3D_tdstMatrix * p_stPreviousAngularSpeedMatrix=NULL;
tdstPLA_Hierarchy * p_stPreviousHierarchy=NULL;
// free all frames
for(iFrame=0,p_stFrame3d=p_stAnim->d_stFrame3d;iFrame<p_stAnim->uwNumberOfFrames;iFrame++,p_stFrame3d++) {
tdstElement3d * p_stElement3d;
// Free Element table
for(j=0,p_stElement3d=p_stFrame3d->p_stArrayOfElts3d;j<p_stAnim->ucMaxNumberOfElements;j++,p_stElement3d++)
{
if (iFrame==1)
{
M_GameFreeInHLM(p_stElement3d->stMatrix);
}
else if (!POS_fn_vIsMatrixIdentityConst(p_stElement3d->stMatrix))
{
POS_M_GameFree(p_stElement3d->stMatrix);
}
}
//del table of element
M_GameFreeInHLM(p_stFrame3d->p_stArrayOfElts3d);
// free speed if different from the previous
if (p_stFrame3d->p_stAngularSpeedMatrix != p_stPreviousAngularSpeedMatrix) {
p_stPreviousAngularSpeedMatrix = p_stFrame3d->p_stAngularSpeedMatrix;
M_GameFreeInHLM(p_stFrame3d->p_stAngularSpeedMatrix);
}
if (p_stFrame3d->p_stLinearSpeedVector != p_stPreviousLinearSpeedVector) {
p_stPreviousLinearSpeedVector = p_stFrame3d->p_stLinearSpeedVector;
M_GameFreeInHLM(p_stFrame3d->p_stLinearSpeedVector);
}
// free hierarchy if different from the previous
if (p_stFrame3d->p_stHierarchy != p_stPreviousHierarchy) {
p_stPreviousHierarchy = p_stFrame3d->p_stHierarchy;
M_GameFreeInHLM(p_stFrame3d->p_stHierarchy->d_stCouples);
M_GameFreeInHLM(p_stFrame3d->p_stHierarchy);
}
}
M_GameFreeInHLM(p_stAnim->d_stFrame3d);
}
// Free Event Table
if (p_stAnim->d_stAnimEvent) {
M_GameFreeInHLM(p_stAnim->d_stAnimEvent);
}
// Free light Table
if (p_stAnim->p_stLights) {
GLI_tdstLight ** p_p_stLight;
for(j=0,p_p_stLight=p_stAnim->p_stLights->a_p_stLights;j<p_stAnim->p_stLights->uwNumberOfLights;j++,p_p_stLight++)
M_GameFreeInHLM(*p_p_stLight);
M_GameFreeInHLM(p_stAnim->p_stLights->a_p_stLights);
M_GameFreeInHLM(p_stAnim->p_stLights->a_hLightsInSector);
M_GameFreeInHLM(p_stAnim->p_stLights);
}
}*/
/*ENDANNECY CT}*/
/*******************************************************/
/* Function : ANI_fn_vFreeze*/
/* Input : Super Object*/
/**/
/* Freeze tha animation of the character*/
/* no more treat by the anim player*/
/**/
/* Create : 13/03/98 Carlos Torres*/
/*******************************************************/
void ANI_fn_vFreeze(HIE_tdxHandleToSuperObject hSuperObjPerso) {
MS_tdxHandleTo3dData h_Current3dData = M_GetMSHandle(hSuperObjPerso,3dData);
/* set speed to zero (if not freeze)*/
if (fn_uc3dDataGetFrameRate(h_Current3dData))
fn_v3dDataSetFrameRate(h_Current3dData,0);
}
/*******************************************************/
/* Function : ANI_fn_vUnFreeze*/
/* Input : Super Object*/
/**/
/* UnFreeze tha animation of the character*/
/* animation restart at the freezed frame*/
/**/
/* Create : 13/03/98 Carlos Torres*/
/*******************************************************/
void ANI_fn_vUnFreeze(HIE_tdxHandleToSuperObject hSuperObjPerso) {
MS_tdxHandleTo3dData h_Current3dData = M_GetMSHandle(hSuperObjPerso,3dData);
if (!fn_uc3dDataGetFrameRate(h_Current3dData)) {
/* reset speed*/
fn_v3dDataSetFrameRate(h_Current3dData,fn_scGetSpeedInState(fn_h3dDataGetCurrentState(h_Current3dData)));
/* reinit current frame*/
PLA_fn_vSetCurrFrame(hSuperObjPerso,(short)(fn_uw3dDataGetCurrentFrame(h_Current3dData)+1));
}
}