reman3/Rayman_X/cpa/tempgrp/GAM/P5/LoadFml.c

1158 lines
43 KiB
C
Raw Blame History

/*=========================================================================
* LoadFml.cpp : This module contain all functions used to load
* a family type, this states, and all over
* This is a part of the Game project.
*
* Version 1.0
* Creation date 28/08/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
#if defined (WIN32)
#include <stdio.h>
#endif /* WIN32 */
#define D_State_Define
#define D_ObjsTbls_Define
#include "ToolsCPA.h"
#include "structur\ObjsTbls.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/3DOSLkTb.h"
#include "Structur/Objects.h"
#include "Structur/ErrGame.h"
#include "Structur/GameScpt.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "PlayAnim/PLA_dbg.h"
#include "Structur/State.h"
#include "Structur/Anim_s.h"
#include "LoadLvl.h"
#include "Basic.h"
#include "Family.h"
#include "LoadAni.h"
#include "LoadFml.h"
#include "ObjType.h"
#include "ZeMem.h"
/* AR 971006 */
extern ACP_tdxBool g_xA3bOff;
#include "Structur/ObjsTbls.h"
#include "TBLLoad.h"
#include "CHLLoad.h"
#include "ChanList.h"
/* anim interpolated*/
#include "PlayAnim/Interpol/a3x_mem.h"
#include "PlayAnim/Interpol/a3x_intn.h"
#include "PlayAnim/Interpol/a3x_load.h"
#define _USE_BINARY_ANIM_BUFFER
#define MAX_FAMILY_ELEMENT_SIZE 128*1024
#define C_szConvertA3dToA3i "MakeAnim"
/*-----------------------------------------------------------------------------
* Description : Callback script function
*-----------------------------------------------------------------------------
* Input : family type
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : 26/05/97 Modification Author : Sebastien DAVID (Gizmo)
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vLoadFamily(struct tdstFamilyList_ *p_stFamily)
{
char szFileName[_MAX_PATH];
tdxHandleToState h_State;
// Shaitan => state list in the level
/*
tdxHandleToTransition h_Transition;
tdxHandleToProhibit h_Prohibit;
char szSectionPreName[_MAX_PATH];
*/
// End Shaitan => state list in the level
char szSectionName[_MAX_PATH];
SCR_tdst_Link_Value * _p_stLinkValue;
long i,j;
SCR_tdst_Cxt_Values *p_stVal;
tdxHandleToObjectsTablesList hObjectsTable; /* MR1508*/
/*// load of the default Objects table for this family
sprintf(szFileName,"%s\\%s.tbl",fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
if (SCR_fn_c_RdL0_IsSectionExists(szFileName))
{
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szFileName);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&TBL_g_stLinkTable,szSectionName);
if(_p_stLinkValue == NULL)
{
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szFileName, SCR_CDF_uw_Anl_Normal);
p_stFamily->h_DefaultObjectsTable = (tdxHandleToObjectsTablesList) SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
fn_vAddAnObjectsTablesInList( p_stFamily,p_stFamily->h_DefaultObjectsTable);
}
else
{
p_stFamily->h_DefaultObjectsTable = (tdxHandleToObjectsTablesList) SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
}
else
{
//M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadTargetState);
}*/
/* load of the channel references for this family*/
sprintf(szFileName,"%s\\%s.chl",fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
if (SCR_fn_c_RdL0_IsSectionExists(szFileName))
{
SCR_M_RdL0_SetContextLong(C_GrandChildContext, 0, (long)p_stFamily);
SCR_fnp_st_RdL0_AnalyseSection(szFileName, SCR_CDF_uw_Anl_Normal);
}
else
{
/*M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadTargetState);*/
}
/* Begin AR971211 (Modifications to use compressed animations)*/
/* Load the bloc of positions if it exists*/
/* End AR971211*/
// Shaitan => state list in the level
/**** try to load level states ****/
sprintf(szFileName,"%s\\%s\\Families\\%s\\%s.stl^%s",
fn_szGetLevelsDataPath(),
fn_p_szGetLevelName(),
fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),
fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),
C_SectionCreateListOfState);
if (SCR_fn_c_RdL0_IsSectionExists(szFileName))
{
SCR_M_RdL0_SetContextLong(C_GrandChildContext, 0, (long)p_stFamily);
SCR_fnp_st_RdL0_AnalyseSection(szFileName, SCR_CDF_uw_Anl_Normal);
}
/**** load all states ****/
else
{
sprintf(szFileName,"%s\\%s.sta",fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
if (SCR_fn_c_RdL0_IsSectionExists(szFileName))
{
SCR_M_RdL0_SetContextLong(C_GrandChildContext, 0, (long)p_stFamily);
SCR_fnp_st_RdL0_AnalyseSection(szFileName, SCR_CDF_uw_Anl_Normal);
}
}
fn_vInitStateList(p_stFamily);
/*
// **** Load All states **** //
sprintf(szFileName,"%s\\%s.sta",fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
if (SCR_fn_c_RdL0_IsSectionExists(szFileName))
{
SCR_M_RdL0_SetContextLong(C_GrandChildContext, 0, (long)p_stFamily);
SCR_fnp_st_RdL0_AnalyseSection(szFileName, SCR_CDF_uw_Anl_Normal);
LST2_M_StaticForEachElementOf(&p_stFamily->hForStateArray,h_State,i)
{
// * Init handle to NextState *********** //
SCR_fn_v_RdL0_ComputeSectionName(szSectionPreName,szFileName,C_SectionCreateNewState,(char *)(h_State->h_NextState));
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szSectionPreName);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szSectionName);
if(_p_stLinkValue != NULL)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_State->h_NextState);
h_State->h_NextState = (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
else
{
if( !strcmpi(C_szNoState,(char *)(h_State->h_NextState)) )
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_State->h_NextState);
h_State->h_NextState = NULL; /* NoState_EndOfAction* /
}
else
{
M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadNextState);
}
}
/* ************************************ /
/* Init All handles To Transitions **** /
LST2_M_StaticForEachElementOf(&h_State->hForTransitionArray,h_Transition,j)
{
/* Target State* /
SCR_fn_v_RdL0_ComputeSectionName(szSectionPreName,szFileName,C_SectionCreateNewState,(char *)(h_Transition->h_TargetState));
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szSectionPreName);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szSectionName);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_Transition->h_TargetState);
if(_p_stLinkValue != NULL)
{
h_Transition->h_TargetState = (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
else
{
M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadTargetState);
}
/* State To Go* /
SCR_fn_v_RdL0_ComputeSectionName(szSectionPreName,szFileName,C_SectionCreateNewState,(char *)(h_Transition->h_StateToGo));
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szSectionPreName);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szSectionName);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_Transition->h_StateToGo);
if(_p_stLinkValue != NULL)
{
h_Transition->h_StateToGo = (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
else
{
M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadStateToGo);
}
}
/* ************************************ /
/* Init All handles To Prohibited States **** /
LST2_M_StaticForEachElementOf(&h_State->hForProhibitArray,h_Prohibit,j)
{
/* Prohibited State* /
SCR_fn_v_RdL0_ComputeSectionName(szSectionPreName,szFileName,C_SectionCreateNewState,(char *)(h_Prohibit->h_ProhibitedState));
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szSectionPreName);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szSectionName);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_Prohibit->h_ProhibitedState);
if(_p_stLinkValue != NULL)
{
h_Prohibit->h_ProhibitedState = (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
else
{
M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadTargetState);
}
}
}
}
*/
// End Shaitan => state list in the level
// Shaitan => module list in the level
/* load of the module list of the family */
sprintf(szFileName,"%s\\%s\\Families\\%s\\%s.otl^%s",
fn_szGetLevelsDataPath(),
fn_p_szGetLevelName(),
fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),
fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),
C_SectionCreateListOfPOs);
if (SCR_fn_c_RdL0_IsSectionExists(szFileName))
{
SCR_fnp_st_RdL0_AnalyseSection(szFileName, SCR_CDF_uw_Anl_Normal);
p_stFamily->ucOptimized = 1;
}
else
{
p_stFamily->ucOptimized = 0;
}
// End Shaitan => module list in the level
/* load of the default Objects table for this family*/
sprintf(szFileName,"%s\\%s.tbl",fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
if (SCR_fn_c_RdL0_IsSectionExists(szFileName))
{
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szFileName);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&TBL_g_stLinkTable,szSectionName);
if(_p_stLinkValue == NULL)
{
// Shaitan => module list in the level
SCR_M_RdL0_SetContextLong(C_GrandChildContext, 1, (long)p_stFamily);
// End Shaitan => module list in the level
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szFileName, SCR_CDF_uw_Anl_Normal);
p_stFamily->h_DefaultObjectsTable = (tdxHandleToObjectsTablesList) SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
fn_vAddAnObjectsTablesInList( p_stFamily,p_stFamily->h_DefaultObjectsTable);
}
else
{
p_stFamily->h_DefaultObjectsTable = (tdxHandleToObjectsTablesList) SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
}
else
{
/*M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadTargetState);*/
}
/* init event of anim with TBL */
LST2_M_StaticForEachElementOf(&p_stFamily->hForStateArray,h_State,i) {
if (fn_p_stGetAnimInState(h_State))
GAM_fn_vUpdateEventArrayOfAnimation(fn_p_stGetAnimInState(h_State),p_stFamily->h_DefaultObjectsTable);
}
/* CGHT 14/05/97*/
/**** Load Bounding Volume ****/
sprintf(szFileName,"%s\\%s.bdv",fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
if (SCR_fn_c_RdL0_IsSectionExists(szFileName))
{
SCR_M_RdL0_SetContextLong(C_GrandChildContext, 0, (long)p_stFamily);
SCR_fnp_st_RdL0_AnalyseSection(szFileName, SCR_CDF_uw_Anl_Normal);
}
/* MR1508*/
LST2_M_StaticForEachElementOf(&p_stFamily->hForObjectsTablesList,hObjectsTable,i)
{
for (j=0;j<hObjectsTable->wNumberOfElement;j++)
{ char szFamily[255],*szChannel;
SCR_tdst_Link_Value * _p_stLinkValue;
if (
(
(hObjectsTable->d_stObjectsTable[j].wTypeOfTarget==C_wTdO_PhysicalObject)
||
(hObjectsTable->d_stObjectsTable[j].wTypeOfTarget==C_wTdO_Mirror)
)
&& (hObjectsTable->d_stObjectsTable[j].uwChannelNumber!=255)
)
{ szChannel=(char *)(hObjectsTable->d_stObjectsTable[j].uwChannelNumber);
strcpy(szFamily,fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
strcat(szFamily,"-");
strcat(szFamily,szChannel);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&CHL_g_stLinkTable,szFamily);
if(_p_stLinkValue)
{
hObjectsTable->d_stObjectsTable[j].uwChannelNumber = (unsigned long)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
else
{
hObjectsTable->d_stObjectsTable[j].uwChannelNumber = (unsigned short)C_ucUnknownChannel;
}
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLElement , hObjectsTable );
TMP_M_Free(szChannel);
}
}
}
/* End MR1508*/
}
// Shaitan => state list in the level
/*-----------------------------------------------------------------------------
* Description : init state list
*-----------------------------------------------------------------------------
* Input : family type
* Output : void
*-----------------------------------------------------------------------------*/
void fn_vInitStateList (struct tdstFamilyList_ *p_stFamily)
{
char szFileName[_MAX_PATH];
tdxHandleToState h_State;
tdxHandleToTransition h_Transition;
tdxHandleToProhibit h_Prohibit;
char szSectionName[_MAX_PATH];
char szSectionPreName[_MAX_PATH];
SCR_tdst_Link_Value * _p_stLinkValue;
long i,j;
sprintf(szFileName,"%s\\%s.sta",fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
LST2_M_StaticForEachElementOf(&p_stFamily->hForStateArray,h_State,i)
{
/* Init handle to NextState ***********/
char szStateName[_MAX_PATH];
char *p_szStateName;
if (h_State->h_NextState)
{
strcpy(szStateName, (char *)(h_State->h_NextState));
#ifdef _DEBUG_STRING_FOR_PLA_
p_szStateName = strstr(szStateName," - ");
if (p_szStateName)
strcpy(szStateName, p_szStateName + 3);
#endif
SCR_fn_v_RdL0_ComputeSectionName(szSectionPreName,szFileName,C_SectionCreateNewState,szStateName);
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szSectionPreName);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szSectionName);
if(_p_stLinkValue != NULL)
{
if (h_State->h_NextState != (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue))
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_State->h_NextState);
h_State->h_NextState = (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
}
else
{
if( !strcmpi(C_szNoState,szStateName) )
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_State->h_NextState);
h_State->h_NextState = NULL; /* NoState_EndOfAction*/
}
else
{
/* TMP_M_Free(h_State->h_NextState);*/
M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadNextState);
}
}
}
/* ************************************/
/* Init All handles To Transitions ****/
LST2_M_StaticForEachElementOf(&h_State->hForTransitionArray,h_Transition,j)
{
char szTargetName[_MAX_PATH];
char *p_szTargetName;
/* Target State*/
strcpy(szTargetName, (char *)(h_Transition->h_TargetState));
#ifdef _DEBUG_STRING_FOR_PLA_
p_szTargetName = strstr(szTargetName," - ");
if (p_szTargetName)
strcpy(szTargetName, p_szTargetName + 3);
#endif
SCR_fn_v_RdL0_ComputeSectionName(szSectionPreName,szFileName,C_SectionCreateNewState,szTargetName);
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szSectionPreName);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szSectionName);
if(_p_stLinkValue != NULL)
{
if (h_Transition->h_TargetState != (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue))
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_Transition->h_TargetState);
h_Transition->h_TargetState = (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
}
else
{
// Shaitan => state list in the level
// TMP_M_Free(h_Transition->h_TargetState);
// h_Transition->h_TargetState = NULL;
// M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadTargetState);
// End Shaitan => state list in the level
}
/* State To Go*/
strcpy(szTargetName, (char *)(h_Transition->h_StateToGo));
#ifdef _DEBUG_STRING_FOR_PLA_
p_szTargetName = strstr(szTargetName," - ");
if (p_szTargetName)
strcpy(szTargetName, p_szTargetName + 3);
#endif
SCR_fn_v_RdL0_ComputeSectionName(szSectionPreName,szFileName,C_SectionCreateNewState,szTargetName);
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szSectionPreName);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szSectionName);
if(_p_stLinkValue != NULL)
{
if (h_Transition->h_StateToGo != (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue))
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_Transition->h_StateToGo);
h_Transition->h_StateToGo = (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
}
else
{
// Shaitan => state list in the level
// TMP_M_Free(h_Transition->h_StateToGo);
// h_Transition->h_StateToGo = NULL;
// M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadStateToGo);
// End Shaitan => state list in the level
}
}
/* ************************************/
/* Init All handles To Prohibited States ****/
LST2_M_StaticForEachElementOf(&h_State->hForProhibitArray,h_Prohibit,j)
{
char szTargetName[_MAX_PATH];
char *p_szTargetName;
strcpy(szTargetName, (char *)(h_Prohibit->h_ProhibitedState));
#ifdef _DEBUG_STRING_FOR_PLA_
p_szTargetName = strstr(szTargetName," - ");
if (p_szTargetName)
strcpy(szTargetName, p_szTargetName + 3);
#endif
/* Prohibited State*/
SCR_fn_v_RdL0_ComputeSectionName(szSectionPreName,szFileName,C_SectionCreateNewState,szTargetName);
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szSectionPreName);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szSectionName);
if(_p_stLinkValue != NULL)
{
if (h_Prohibit->h_ProhibitedState != (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue))
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_Prohibit->h_ProhibitedState);
h_Prohibit->h_ProhibitedState = (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
}
else
{
// Shaitan => state list in the level
// M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadTargetState);
// Shaitan => state list in the level
}
}
}
}
// End Shaitan => state list in the level
// Shaitan => module list in the level
/*-----------------------------------------------------------------------------
* Description : find indexes used in the animations
*-----------------------------------------------------------------------------
* Input :
* Output :
*-----------------------------------------------------------------------------*/
void fn_vFindUsedIndexes(short *wArrayOfIndexes, short wMaxElements, struct tdstAnim3d_ *p_stAnim, MS_tdxHandleTo3dData h_3dData)
{
struct tdstFrame3d_ *p_stCurrentFrame3d;
struct tdstElement3d_ *p_stCurrentElement3d;
unsigned short uwCurrentFrame;
unsigned char ucElement;
// check each frame of the animation
for (uwCurrentFrame=0; uwCurrentFrame<p_stAnim->uwNumberOfFrames; uwCurrentFrame++)
{
// get current frame
p_stCurrentFrame3d = fn_p_st3dDataGetCurrentFrame(h_3dData);
fn_vAllocArrayOfElts3d (h_3dData , p_stAnim->ucMaxNumberOfElements);
p_stCurrentFrame3d->p_stAnim = NULL;
fn_vUpdateFrame(NULL,p_stCurrentFrame3d, p_stAnim, uwCurrentFrame);
// check each element
for (ucElement=0; ucElement<p_stAnim->ucMaxNumberOfElements; ucElement++)
{
p_stCurrentElement3d = &(p_stCurrentFrame3d->p_stArrayOfElts3d[ucElement]);
if (p_stCurrentElement3d && p_stCurrentElement3d->wElement < wMaxElements)
wArrayOfIndexes[p_stCurrentElement3d->wElement] = 1;
}
fn_vFreeArrayOfElts3d (h_3dData);
}
}
// End Shaitan => module list in the level
void fn_vCheckObjectsTables(struct tdstEngineObject_ *p_stEngineObject) {
#ifdef _DEBUG
struct tdstFamilyList_ *p_stFamily = fn_h3dDataGetFamily(p_stEngineObject->h_3dData);
char *p_szFileName;
tdxHandleToState h_State;
long i;
FILE *p_stFile;
struct tdstAnim3d_ *p_stCurrentAnim;
struct tdstFrame3d_ *p_stCurrentFrame3d;
struct tdstElement3d_ *p_stCurrentElement3d;
unsigned short uwCurrentFrame;
LST2_M_StaticForEachElementOf(&p_stFamily->hForStateArray,h_State,i)
{
static unsigned long ulFakeFrame= 5000;
unsigned char ucElement;
p_stCurrentAnim = h_State->p_stAnim;
if(p_stCurrentAnim == NULL)
continue;
for(uwCurrentFrame=0;uwCurrentFrame<p_stCurrentAnim->uwNumberOfFrames;uwCurrentFrame++)
{
p_stCurrentFrame3d = fn_p_st3dDataGetCurrentFrame(p_stEngineObject->h_3dData);
/* ANNECY MT - 22/09/98 {*/
/*
if (p_stCurrentFrame3d->p_stArrayOfElts3d)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeAnimation , p_stEngineObject->h_3dData->h_Family);
TMP_M_Free(p_stCurrentFrame3d->p_stArrayOfElts3d);
p_stCurrentFrame3d->p_stArrayOfElts3d = NULL;
}
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeAnimation , p_stEngineObject->h_3dData->h_Family);
p_stCurrentFrame3d->p_stArrayOfElts3d = (tdstElement3d*)TMP_M_p_Malloc(sizeof(tdstElement3d) * p_stCurrentAnim->ucMaxNumberOfElements);
memset(p_stCurrentFrame3d->p_stArrayOfElts3d,0,sizeof(tdstElement3d) * p_stCurrentAnim->ucMaxNumberOfElements);
*/
fn_vAllocArrayOfElts3d (p_stEngineObject -> h_3dData , p_stCurrentAnim->ucMaxNumberOfElements);
/* END ANNECY MT }*/
p_stCurrentFrame3d->p_stAnim = NULL;
fn_vUpdateFrame(NULL,p_stCurrentFrame3d,p_stCurrentAnim,uwCurrentFrame);
/* p_stCurrentFrame3d = fn_p_GetFramesAddress(p_stCurrentAnim, uwCurrentFrame,ulFakeFrame++,NULL);*/
for(ucElement=0;ucElement<p_stCurrentAnim->ucMaxNumberOfElements;ucElement++) {
p_stCurrentElement3d = &(p_stCurrentFrame3d->p_stArrayOfElts3d[ucElement]);
if(p_stCurrentElement3d==NULL)
break;
if(p_stCurrentElement3d->wElement>=fn_h3dDataGetCurrentObjectsTable(p_stEngineObject->h_3dData)->wNumberOfElement)
continue;
fn_h3dDataGetCurrentObjectsTable(p_stEngineObject->h_3dData)->d_stObjectsTable[p_stCurrentElement3d->wElement].wCounter++;
}
}
/* ANNECY MT - 22/09/98 {*/
/*
if (p_stCurrentFrame3d->p_stArrayOfElts3d)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeAnimation , p_stEngineObject->h_3dData->h_Family);
TMP_M_Free(p_stCurrentFrame3d->p_stArrayOfElts3d);
p_stCurrentFrame3d->p_stArrayOfElts3d = NULL;
}
*/
fn_vFreeArrayOfElts3d (p_stEngineObject -> h_3dData);
/* END ANNECY MT }*/
}
if ((p_stFile = fopen("CHECKTBL.LOG","at"))!=NULL) {
SCR_tdst_Link_Value *p_stLinkValue;
int flag;
p_stLinkValue=SCR_fnp_st_Link_SearchValue(&TBL_g_stLinkTable,(unsigned long)fn_h3dDataGetCurrentObjectsTable(p_stEngineObject->h_3dData));
if (p_stLinkValue!=NULL&&SCR_M_e_Link_GetState(p_stLinkValue)==SCR_ELS_Link_Initialized) {
p_szFileName = (char *)SCR_M_p_sz_Link_GetKey(p_stLinkValue);
flag = 0;
if(fn_h3dDataGetCurrentObjectsTable(p_stEngineObject->h_3dData)) {
unsigned short uwElement;
for(uwElement=0;uwElement<fn_h3dDataGetCurrentObjectsTable(p_stEngineObject->h_3dData)->wNumberOfElement;uwElement++) {
if(fn_h3dDataGetCurrentObjectsTable(p_stEngineObject->h_3dData)->d_stObjectsTable[uwElement].h_Target!=NULL) {
if(fn_h3dDataGetCurrentObjectsTable(p_stEngineObject->h_3dData)->d_stObjectsTable[uwElement].wCounter==0) {
if(flag==0)
fprintf(p_stFile,"%s\n",p_szFileName);
fprintf(p_stFile,"Indice : %d inutilis<69>\n",uwElement+1);
flag=1;
}
}
}
if(flag==1)
fprintf(p_stFile,"\n\n");
}
}
fclose(p_stFile);
}
#endif
}
/*-----------------------------------------------------------------------------
* Description : check a script version of the binary anim
*-----------------------------------------------------------------------------
* Output : boolean
*-----------------------------------------------------------------------------
* Creation date : 20/08/98 Author : Carlos Torres
*---------------------------------------------------------------------------*/
int fn_bNoScriptVersion(char * szBinFileName) {
char szScriptFileName[256];
strcpy(szScriptFileName,szBinFileName);
szScriptFileName[strlen(szBinFileName)-1] = 'd';
return !FIL_fn_bIsFileExist(szScriptFileName);
}
/*-----------------------------------------------------------------------------
* Description : Load an animation
*-----------------------------------------------------------------------------
* Input : ...
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 27/05/98 Author : Carlos Torres
* Modif 30/07/98 : change general function's algo
* and use a second data Directory - Carlos Torres
* Modif 19/08/98 : Use of a third directory (jesus have play with our dir) - Carlos Torres
* Modif 20/08/98 : rebuild A3i if a script file exist and not the bin File - Carlos Torres
* Modif 26/08/98 : just take anim in Dir1 - Carlos Torres
* Modif 28/08/98 : Check A3i File Version - Carlos Torres
* Modif 01/09/98 : Hide the command window of makeAnim - Carlos Torres
* Modif 07/09/98 : Change functiuon prototype - Carlos Torres
*---------------------------------------------------------------------------*/
tdstAnim3d * fn_p_stLoadAnimationFile(char * szFileName,struct tdstFamilyList_ *p_stFamily) {
char szInterpolAnimFileName[256];
FILE *p_xFile;
/*char szCompleteScriptFileName[256];*/
/*FILETIME xScriptModifyTime;*/
/*DWORD dwScriptSize;*/
/*HANDLE hScriptFile;*/
unsigned long ulBinaryFileLength;
char* p_cBinaryAnimBuffer;
tdstAnim3d * p_stAnim;
unsigned char bConversionDone=FALSE;
char szInterpolAnimFileName1[256];
char * szTmp;
HANDLE hScriptFile;
unsigned long ulHigh;
/* Build script file name */
/*strcpy(szCompleteScriptFileName,fn_szGetAnimDataPath());
strcat(szCompleteScriptFileName,"\\");
strcat(szCompleteScriptFileName,szFileName);
strcat(szCompleteScriptFileName,".a3d");*/
/* then get the informations about the script file */
/*hScriptFile=CreateFile(szCompleteScriptFileName,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if(hScriptFile!= INVALID_HANDLE_VALUE)
{
GetFileTime(hScriptFile,NULL,NULL,&xScriptModifyTime);
dwScriptSize=GetFileSize(hScriptFile,NULL);
CloseHandle(hScriptFile);
}
else
{
xScriptModifyTime.dwLowDateTime=0;
xScriptModifyTime.dwHighDateTime=0;
dwScriptSize=0;
}*/
/*if (g_xA3bOff==FALSE) {*/
/* -----------------------------------------------------------------------*/
/* Search anim in link table*/
/* -----------------------------------------------------------------------*/
/* Build path 0*/
sprintf(szInterpolAnimFileName,"%s\\%s.a3i",fn_szGetAnimDataPath(),szFileName);
/* Build path 1*/
szTmp = strchr(szInterpolAnimFileName,'\\');
sprintf(szInterpolAnimFileName1,"%s%s",gsz_Version,szTmp);
p_stAnim=fn_p_stGetAnimIntoA3bLinkTable(szInterpolAnimFileName);
/* anim not found in link table*/
if (!p_stAnim) {
do {
/* -----------------------------------------------------------------------*/
/* Open Anim File*/
/* -----------------------------------------------------------------------*/
p_xFile=fopen(szInterpolAnimFileName1,"rb");
/* file found in Path 1*/
if (p_xFile!=NULL) {
#if !defined(U64)
unsigned short uwVersion;
fread(&uwVersion,2,1,p_xFile);
/* Check A3i Version*/
if (uwVersion == A3i_Version)
break;
else {
fclose(p_xFile);
p_xFile = NULL;
if (bConversionDone) {
char szMessage[50];
sprintf(szMessage,"The Current version of MakeAnim(V%d.%02d%c) not correspond with the engine\nYou must have V%d.%02d%c\n",
(uwVersion&0xF000)>>12,(uwVersion&0x0FF0)>>4,(uwVersion&0x000F)?'a'+(uwVersion&0x000F)-1:' ',
(A3i_Version&0xF000)>>12,(A3i_Version&0x0FF0)>>4,(A3i_Version&0x000F)?'a'+(A3i_Version&0x000F)-1:' ');
Erm_M_UpdateLastError( Game, C_ucErmDefaultChannel, E_uwGameErrorWhileLoadingAnimation,
C_lErmNoDebugData,C_ucErmOpenInfoWindow, C_ucAllowStopForDebug,szMessage );
return NULL;
}
}
#else
break;
#endif
}
/* -----------------------------------------------------------------------*/
/* Convert A3D File To A3i*/
/* -----------------------------------------------------------------------*/
if (!bConversionDone) {
SCR_tdst_Link_Table* p_stAnimationLinkTable=NULL;
SCR_tdst_Link_Value* p_stAnimationLinkTableValue=NULL;
char szSystemCommand[256];
char *szTmp;
szTmp = strrchr( szFileName, '\\' );
*(szTmp) = 0;
sprintf(szSystemCommand,"%s %s",C_szConvertA3dToA3i,szFileName);
*(szTmp) = '\\';
/* execute command hiding the window proccess*/
{
STARTUPINFO stStartup;
PROCESS_INFORMATION stProcessInfo;
DWORD dwExitCode;
/* set flags to hide the window*/
memset( &stStartup, 0, sizeof( STARTUPINFO ) );
stStartup.cb = sizeof( STARTUPINFO );
stStartup.dwFlags = STARTF_USESHOWWINDOW;
stStartup.wShowWindow = SW_HIDE;
if ( CreateProcess( NULL,szSystemCommand, NULL,NULL,FALSE,0,NULL,NULL,&stStartup,&stProcessInfo) ) {
/* wait for the end of process*/
while ( 1 ) {
if ( GetExitCodeProcess( stProcessInfo.hProcess, &dwExitCode ) == 0)
break;
if ( dwExitCode != STILL_ACTIVE )
break;
Sleep(500);
}
}
/* cretaion preocess Fail - try to launch a sytem command*/
else
system(szSystemCommand);
}
/* set flag conversion done*/
bConversionDone = TRUE;
}
/* -----------------------------------------------------------------------*/
/* Conversion should fail*/
/* -----------------------------------------------------------------------*/
else {
char szMessage[50];
sprintf(szMessage,"Anim [...]%s wasn't found in any Data Dir",szTmp);
Erm_M_UpdateLastError( Game, C_ucErmDefaultChannel, E_uwGameErrorWhileLoadingAnimation,
C_lErmNoDebugData,C_ucErmOpenInfoWindow, C_ucAllowStopForDebug,szMessage );
return NULL;
}
} while (!p_xFile);
/* -----------------------------------------------------------------------*/
/* Load Binary Anim File - A3i Format*/
/* -----------------------------------------------------------------------*/
hScriptFile=CreateFile(szInterpolAnimFileName1,
GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if(hScriptFile!= INVALID_HANDLE_VALUE) {
/* size without version*/
ulBinaryFileLength=GetFileSize(hScriptFile,&ulHigh) - 2;
CloseHandle(hScriptFile);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeBinAnim , p_stFamily );
p_cBinaryAnimBuffer=TMP_M_p_Malloc(ulBinaryFileLength);
fread(p_cBinaryAnimBuffer,ulBinaryFileLength,1,p_xFile);
fclose(p_xFile);
/* Alloc Anim struct*/
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeAnimation , p_stFamily );
p_stAnim =(tdstAnim3d *)M_p_GameMallocInHLM(sizeof(tdstAnim3d));
/* Load animation*/
p_stAnim->uwNumOfA3dGENERAL=fn_uw_LoadAnimV6(p_cBinaryAnimBuffer);
/* update structure*/
fn_v_CalculateGeneral(p_stAnim,0); /* Calculate A3dGENERAL informations*/
/*GAM_fn_vUpdateEventArrayOfAnimation(p_stAnim,p_stFamily->h_DefaultObjectsTable);*/
/* Finally add the animation pointer into the link table*/
fn_vAddAnimIntoA3bLinkTable(p_stAnim,szInterpolAnimFileName);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeBinAnim , p_stFamily );
TMP_M_Free(p_cBinaryAnimBuffer);
}
else {
char szMessage[50];
sprintf(szMessage,"Cannot get size of Anim [...]%s to allocate memory",szTmp);
Erm_M_UpdateLastError( Game, C_ucErmDefaultChannel, E_uwGameErrorWhileLoadingAnimation,
C_lErmNoDebugData,C_ucErmOpenInfoWindow, C_ucAllowStopForDebug,szMessage );
return NULL;
}
}
/* -----------------------------------------------------------------------*/
/* Update Anim and State*/
/* -----------------------------------------------------------------------*/
#ifdef _DEBUG_STRING_FOR_PLA_
strcpy(p_stAnim->szAnimName,szFileName);
#endif
return p_stAnim;
}
// Shaitan => state list in the level
/*-----------------------------------------------------------------------------
* Description : Callback script function
*-----------------------------------------------------------------------------
* Input : ...
* Output : void
*---------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue fn_eScriptCallBackCreateListOfState(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action _eAction)
{
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
SCR_tdst_Cxt_Values *p_stVal;
if (M_IsEntry)
{
if (M_ActionIs(C_Entry_State))
{
if (SCR_fn_c_RdL0_IsSectionExists(_ap_szParams[0]))
{
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
}
}
}
return(eReturnValue);
}
// End Shaitan => state list in the level
// Shaitan => state list in the level
/*-----------------------------------------------------------------------------
* Description : Callback script function
*-----------------------------------------------------------------------------
* Input : ...
* Output : void
*---------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue fn_eScriptCallBackCreateListOfPOs(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action _eAction)
{
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
SCR_tdst_Cxt_Values *p_stVal;
if (M_IsEntry)
{
if (M_ActionIs(C_Entry_LoadPO))
{
if (SCR_fn_c_RdL0_IsSectionExists(_ap_szParams[0]))
{
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
}
}
}
return(eReturnValue);
}
// End Shaitan => state list in the level
/*-----------------------------------------------------------------------------
* Description : Callback script function
*-----------------------------------------------------------------------------
* Input : ...
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 22/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : 26/05/97 Modification Author : David Sebastien (Gizmo)
* Modifications : load animation
* Modif 07/09/98 : new prototype for load animation - Carlos Torres
*---------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue fn_eScriptCallBackCreateNewState(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action _eAction)
{
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
DNM_tdeMechanicsID eKindOfMechanics = DNM_eMIC_Error;
struct tdstFamilyList_ *p_stFamily;
tdxHandleToState h_State,h_NextState;
char szSectionName[_MAX_PATH];
tdxHandleToTransition h_Transition;
tdxHandleToProhibit h_Prohibit;
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,tdxHandleToState,h_State);
if (M_IsTitle)
{
VIG_fn_vAddToProgressBar(1);
SCR_M_RdL0_GetContextLong(C_ThisContext,0,struct tdstFamilyList_ *,p_stFamily);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily );
h_State = fn_h_StateAlloc();
LST2_M_StaticAddTail(&p_stFamily->hForStateArray, h_State);
#ifdef _DEBUG_STRING_FOR_PLA_
strcpy(h_State->szStateName,fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
strcat(h_State->szStateName," - ");
strcat(h_State->szStateName,_p_szName);
#endif
SCR_M_RdL0_ComputeOpenSectionNameR(0,szSectionName);
SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&g_st3DOSLinkTable.stState,szSectionName,(unsigned long)h_State),1,strlen(szSectionName)-strlen(SCR_M_RdL0_GetCompleteSectionNameR(0)));
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,h_State);
}
else if (M_IsEntry)
{
if (M_ActionIs(C_Entry_Animation))
{
SCR_M_RdL0_GetContextLong(C_ThisContext,0,struct tdstFamilyList_ *,p_stFamily);
/**** load the animation file ****/
strcpy(szSectionName,fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
strcat(szSectionName,"\\");
strcat(szSectionName,_ap_szParams[0]);
fn_vSetAnimInState(h_State,fn_p_stLoadAnimationFile(szSectionName,p_stFamily));
}
else if (M_ActionIs(C_Entry_NextState))
{
SCR_M_RdL0_GetContextLong(C_ThisContext,0,struct tdstFamilyList_ *,p_stFamily);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
h_NextState = (tdxHandleToState) TMP_M_p_Malloc(strlen(_ap_szParams[0])+1);
strcpy((char *)h_NextState,_ap_szParams[0]);
fn_vSetNextStateInState(h_State,h_NextState);
}
else if (M_ActionIs(C_Entry_Speed))
{
fn_vSetSpeedInState(h_State,(signed char)fn_lAToI(_ap_szParams[0]));
}
else if (M_ActionIs(C_Entry_Repeat))
{
fn_vSetRepeatAnimationInState(h_State,(unsigned char)(fn_lAToI(_ap_szParams[0])-1));
}
else if (M_ActionIs(C_Entry_TransitionStatusFlag))
{
if(!strcmpi(_ap_szParams[0],C_Value_TransitionAllowedByDefault))
{
fn_vSetTransitionStatusFlagInState(h_State,0);
}
else
{
fn_vSetTransitionStatusFlagInState(h_State,1);
}
}
else if (M_ActionIs(C_Entry_AddTargetState))
{
SCR_M_RdL0_GetContextLong(C_ThisContext,0,struct tdstFamilyList_ *,p_stFamily);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTransition , p_stFamily );
h_Transition = fn_h_TransitionAlloc();
LST2_M_StaticInitElement(h_Transition);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
h_Transition->h_TargetState = (tdxHandleToState) TMP_M_p_Malloc(strlen(_ap_szParams[0])+1);
strcpy((char *)h_Transition->h_TargetState,_ap_szParams[0]);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
h_Transition->h_StateToGo = (tdxHandleToState) TMP_M_p_Malloc(strlen(_ap_szParams[1])+1);
strcpy((char *)h_Transition->h_StateToGo,_ap_szParams[1]);
if(SCR_fn_uc_RdL0_GetNumberOfParameters(_ap_szParams)>2)
fn_vSetLinkingTypeInTransition(h_Transition,(unsigned char)fn_lAToI(_ap_szParams[2]));
else
fn_vSetLinkingTypeInTransition(h_Transition,C_ucStandardLink);
LST2_M_StaticAddTail(&h_State->hForTransitionArray, h_Transition);
}
else if (M_ActionIs(C_Entry_ProhibitedTargetState))
{
SCR_M_RdL0_GetContextLong(C_ThisContext,0,struct tdstFamilyList_ *,p_stFamily);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeProhibit , p_stFamily );
h_Prohibit = fn_h_ProhibitAlloc();
LST2_M_StaticInitElement(h_Prohibit);
h_Prohibit->h_ProhibitedState = (tdxHandleToState) TMP_M_p_Malloc(strlen(_ap_szParams[0])+1);
strcpy((char *)h_Prohibit->h_ProhibitedState,_ap_szParams[0]);
LST2_M_StaticAddTail(&h_State->hForProhibitArray, h_Prohibit);
}
else if (M_ActionIs(C_Entry_LinkMechanics))
{
M_CheckScriptParamNumber(1);
SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
SCR_M_RdL0_GetSectionLong(C_ChildSection,0,DNM_tdxHandleToMecIdentityCard,(h_State->h_LinkedMechanicsIdCard));
}
/* ANNECY MT - 24/11/98 {*/
else if (M_ActionIs(C_Entry_CustomBits))
{
M_CheckScriptParamNumber(1);
fn_vSetStateCustomBits(h_State,(unsigned char)fn_lAToI(_ap_szParams[0]));
}
/* END ANNECY MT }*/
}
if(M_IsEnd)
{
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,tdxHandleToState,h_State);
if ((h_State->scSpeedAnim<=1)&&h_State->p_stAnim)
h_State->scSpeedAnim=h_State->p_stAnim->ucFrameRate;
}
return(eReturnValue);
}
/*-----------------------------------------------------------------------------
* Description : Callback script function
*-----------------------------------------------------------------------------
* Input : ...
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 14/05/97 Author : Christophe Garrigues (CGHT)
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue fn_eScriptCallBackSetBoundingVolume(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action _eAction)
{
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
struct tdstFamilyList_ * p_stFamily;
MTH3D_tdstVector stCenter;
MTH_tdxReal xRadius;
ACP_tdxHandleOfObject hGeometricSphere;
if(M_IsTitle)
{
VIG_fn_vAddToProgressBar(1);
}
if(M_IsEntry)
{
if (M_ActionIs(C_Entry_Geometric))
{
hGeometricSphere = (ACP_tdxHandleOfObject)GLI_pLoadGeometricInFile(_ap_szParams[0]);
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,(long)hGeometricSphere);
}
}
if(M_IsEnd)
{
SCR_M_RdL0_GetContextLong(C_ThisContext,0,struct tdstFamilyList_ *,p_stFamily);
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,ACP_tdxHandleOfObject,hGeometricSphere);
GEO_fn_vGetInfoFromGeometricSphere(&stCenter, &xRadius, hGeometricSphere);
GEO_fn_vCreateBoundingSphere(&p_stFamily->hBoundingSphere);
GEO_fn_vSetBoundingSphere(p_stFamily->hBoundingSphere, &stCenter, xRadius);
#if defined (ACTIVE_EDITOR)
p_stFamily->hGeometricSphere = hGeometricSphere;
#else
GEO_vDeleteGeometricObject (&hGeometricSphere);
#endif /* ! ACTIVE_EDITOR*/
}
return( eReturnValue );
}
void fn_vRegisterAllBdVolumeScriptSections ()
{
SCR_fn_v_RdL0_RegisterCallback(C_SectionSetBoundingVolume, fn_eScriptCallBackSetBoundingVolume,SCR_CRC_c_RdL0_ForSection);
}