reman3/Rayman_X/cpa/Appli/CvrtA3DtoA3i/Src/l_sta_v6.cpp

118 lines
3.1 KiB
C++

// **********************************************************************************
// * "l_sta_v6.c" *
// * Written by : Carlos Torres *
// * Tabulations : 4 char *
// **********************************************************************************
// **********************************************************************************
// Included files
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "SCR.h"
#include "specif\\a3x_pref.h"
#include "makeanim.h"
#include "l_sta_v6.h"
// New State
#define STA_STATE_SECTION "CreateNewState"
#define STA_ANIM "Animation"
// **********************************************************************************
// Global Variables
// ********************************************************** fn_eNewStateCallBackV6i
// NEW STATE CALLBACK
//
// **********************************************************************************
SCR_tde_Anl_ReturnValue fn_eNewStateCallBackV6i( SCR_tdst_File_Description *_p_stFile,
char *_p_szName,
char *_ap_SzParam[],
SCR_tde_Anl_Action _eAction )
{
// Section already analysed
if (_eAction == SCR_EA_Anl_AlreadyAnalysed) {
fprintf( ErrorFile, "%s : STA NewState already analysed\n", AnimationName );
}
// Beginning of section
if (_eAction == SCR_EA_Anl_BeginSection) {
// nop
}
// We are in the section
else if (_eAction == SCR_EA_Anl_Entry)
{
// Create new State
if ( !strcmp(_p_szName, STA_ANIM) ) {
int i;
tdstAnimInfo * p_stCurrAnim=stAnims;
// search the anim
for (i=0;i<g_uwTotalNumOfAnim;i++,p_stCurrAnim++) {
char * p_szA3DExtension = szAnimName(p_stCurrAnim) + strlen(szAnimName(p_stCurrAnim)) - 4;
// supress .A3D for comparaison
*p_szA3DExtension = '\0';
// find the good anim and validate it
if (!stricmp(szAnimName(p_stCurrAnim),_ap_SzParam[0])) {
bValid(p_stCurrAnim) = 0;
// reset extension .A3D
*p_szA3DExtension = '.';
break;
}
else {
// reset extension .A3D
*p_szA3DExtension = '.';
}
}
if (i == g_uwTotalNumOfAnim) {
fprintf( ErrorFile,"Anim %s in STA File without an A3D File\n",_ap_SzParam[0]);
}
}
// Unknown field
else {
// nop
}
}
// End of section
else if (_eAction == SCR_EA_Anl_EndSection) {
// nop
}
return SCR_ERV_Anl_NormalReturn;
}
// ****************************************************************** fn_v_InitSTAV6i
// Register Call back for the different sections
//
// **********************************************************************************
void fn_v_InitSTAV6i( void ) {
int i;
tdstAnimInfo * p_stCurrAnim=stAnims;
// invalidate all anims
for (i=0;i<g_uwTotalNumOfAnim;i++,p_stCurrAnim++)
bValid(p_stCurrAnim) = 1;
// Channel Names Section
SCR_fn_v_RdL0_RegisterCallback(STA_STATE_SECTION,fn_eNewStateCallBackV6i,SCR_CRC_c_RdL0_ForSection );
}
// **********************************************************************************