Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,491 @@
/*=========================================================================
* CSLoad.c : Loading CS Files
*
* Version 1.0
* Creation date 05/05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1997
*=======================================================================*/
#define PO_FRIEND
#define PCS_FRIEND
#define PCS_MAIN
#include "ACP_Base.h"
#include "SCR.h"
#include "DPT.h"
#include "GEO.h"
#include "GLI.h"
#include "COL.h"
#include "SPO.h"
#include "PCS.h"
#include "PO.h"
//#include "BIN.h"
#include "ErmPO.h"
// global for CS Link Table
#if !defined(U64)
SCR_tdst_Link_Table CS_g_stLinkTable;
#endif /* U64 */
/*-----------------------------------------------------------------------------
* Description : initialize and close link table for CS
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#if !defined(U64)
SCR_tdst_Link_Table *CS_fn_p_stGetLinkTable(void)
{
return(&CS_g_stLinkTable);
}
#endif /* U64 */
void CS_fn_vInitLinkTable(void)
{
#if !defined(U64)
SCR_fn_v_Link_InitTable(&CS_g_stLinkTable);
#endif /* U64 */
}
void CS_fn_vCloseLinkTable(void)
{
#if !defined(U64)
SCR_fn_v_Link_CloseTable(&CS_g_stLinkTable);
#endif /* U64 */
}
/*-----------------------------------------------------------------------------
* Description : Used to register all script callback functions
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
void CS_fn_vRegisterAllScriptSections(void)
{
#if !defined(U64)
SCR_fn_v_RdL0_RegisterCallback(C_Section_CSHeader, CS_fn_eScriptCallBackHeader, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_Section_CSGeneral, CS_fn_eScriptCallBackGeneral, SCR_CRC_c_RdL0_ForSection);
/* SCR_fn_v_RdL0_RegisterCallback(C_Section_CSHeader, CS_fn_eScriptCallBackBinHeader, SCR_CRC_c_RdL0_ForBinSection);
SCR_fn_v_RdL0_RegisterCallback(C_Section_CSGeneral, CS_fn_eScriptCallBackBinGeneral, SCR_CRC_c_RdL0_ForBinSection);
*/
#endif /* U64 */
}
/*-----------------------------------------------------------------------------
* Description : call-back for header section of CS script file
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
#if !defined(U64)
SCR_tde_Anl_ReturnValue CS_fn_eScriptCallBackHeader(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;
if ( M_IsEntry )
{
if ( M_ActionIs( C_Entry_FileVersion ) )
{
// not used yet
//gs_wCSFileVersion = (short)fn_lAToI( _ap_szParams[0] );
}
}
return ( eReturnValue );
}
#endif /* U64 */
/*-----------------------------------------------------------------------------
* Description : call-back for general section of CS script file
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
#if !defined(U64)
SCR_tde_Anl_ReturnValue CS_fn_eScriptCallBackGeneral(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;
PCS_tdxHandleToPhysicalCollSet _hCollideSet;
char sz_LongPathForLinkTable[256];
//SCR_tdst_Cxt_Values *p_stVal;
ACP_tdxHandleOfObject _hGeometricObject;
//char s[80];
if ( M_IsTitle )
{
_hCollideSet = PCS_fn_hCreatePhysicalCollideSet(1);
SCR_M_RdL0_SetSectionLong(C_ThisContext,0,_hCollideSet);
SCR_M_RdL0_ComputeOpenSectionNameR(0,sz_LongPathForLinkTable);
SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&CS_g_stLinkTable,sz_LongPathForLinkTable,(unsigned long)_hCollideSet),1,strlen(sz_LongPathForLinkTable)-strlen(SCR_M_RdL0_GetCompleteSectionNameR(0)));
//SCR_fn_v_RdL0_ComputeSectionName(sz_LongPathForLinkTable,SCR_M_RdL0_GetOpenFileNameR(0),C_Section_CSGeneral,_p_szName);
/*
strcpy(sz_LongPathForLinkTable,fn_szGetLevelsDataPath());
strcat(sz_LongPathForLinkTable,"\\");
strcat(sz_LongPathForLinkTable,SCR_M_RdL0_GetCompleteSectionNameR(0));
*/
//SCR_fnp_st_Link_SetValue(&CS_g_stLinkTable, sz_LongPathForLinkTable, (unsigned long)_hCollideSet);
/*
strcpy(s,SCR_M_RdL0_GetCompleteSectionNameR(0));
strcat(s,"\n");
OutputDebugString(s);
*/
}
else if ( M_IsEntry )
{
if ( M_ActionIs( C_Entry_ZDR ) )
{
SCR_M_RdL0_GetSectionLong(C_ThisContext,0,PCS_tdxHandleToPhysicalCollSet,_hCollideSet);
/*p_stVal = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
_hGeometricObject = (ACP_tdxHandleOfObject)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);*/
_hGeometricObject = GLI_pLoadGeometricInFile(_ap_szParams[0]);
if ( _hGeometricObject->p_stOctree!=NULL&&GEO_fn_ucGetBlocNumberOf(_hGeometricObject)!=GEO_fn_ucGetBlocNumberOf(_hGeometricObject->p_stOctree)
||_hGeometricObject->p_stOctree==NULL&&GEO_fn_ucGetBlocNumberOf(_hGeometricObject)!=GEO_M_ucGetMemMallocMode())
{
M_POWarningErrorWithMessage(E_uwPOOctreeMustBeInFix,_p_stFile->a_szFileName);
_hGeometricObject->p_stOctree = NULL;
}
/* Computing Octree on ZDR (JO 23/09/97) */
COL_fn_bCreateOctree(_hGeometricObject,10,5,4);
PCS_fn_vSetZdrGeoObjOfPhysicalCollSet(_hCollideSet,_hGeometricObject);
}
else if ( M_ActionIs( C_Entry_ZDE ) )
{
SCR_M_RdL0_GetSectionLong(C_ThisContext,0,PCS_tdxHandleToPhysicalCollSet,_hCollideSet);
/*p_stVal = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
_hGeometricObject = (ACP_tdxHandleOfObject)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);*/
_hGeometricObject = GLI_pLoadGeometricInFile(_ap_szParams[0]);
PCS_fn_vSetZdeGeoObjOfPhysicalCollSet(_hCollideSet,_hGeometricObject);
}
else if ( M_ActionIs( C_Entry_ZDD ) )
{
SCR_M_RdL0_GetSectionLong(C_ThisContext,0,PCS_tdxHandleToPhysicalCollSet,_hCollideSet);
/*p_stVal = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
_hGeometricObject = (ACP_tdxHandleOfObject)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);*/
_hGeometricObject = GLI_pLoadGeometricInFile(_ap_szParams[0]);
PCS_fn_vSetZddGeoObjOfPhysicalCollSet(_hCollideSet,_hGeometricObject);
}
}
return ( eReturnValue );
}
#endif /* U64 */
/*-----------------------------------------------------------------------------
* Description : function to load a Collide Set (script or binary load)
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
PCS_tdxHandleToPhysicalCollSet CS_fn_xLoadCollideSet(char* _szSectionName)
{
PCS_tdxHandleToPhysicalCollSet hCollideSet=NULL;
#if !defined(U64)
SCR_tdst_Cxt_Values *p_stValues;
SCR_tdst_Link_Value *p_stLinkValue;
unsigned int uiPos;
uiPos = 0;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stLinkValue,SCR_M_st_Link_GetDynamicArray(&CS_g_stLinkTable));
while(p_stLinkValue)
{
if(!strcmpi(SCR_M_p_sz_Link_GetKey(p_stLinkValue) + SCR_M_ul_Link_GetAdditionalLong(p_stLinkValue,1),_szSectionName))
break;
uiPos++;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stLinkValue,SCR_M_st_Link_GetDynamicArray(&CS_g_stLinkTable));
}
// p_stLinkValue=BIN_fn_p_stSearchShortKey(&CS_g_stLinkTable,_szSectionName);
if(p_stLinkValue==NULL)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_szSectionName, SCR_CDF_uw_Anl_Normal);
hCollideSet = (PCS_tdxHandleToPhysicalCollSet)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0);
return hCollideSet;
}
else
return (PCS_tdxHandleToPhysicalCollSet)p_stLinkValue->ulValue;
#else /* U64 */
return hCollideSet;
#endif /* U64 */
}
/*-----------------------------------------------------------------------------
* Description : function to prepare the binary save process
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void CS_fn_vPrepareSaveBinaryBloc()
{
#if !defined(U64)
BIN_fn_vCreateBinaryIds(&CS_g_stLinkTable,BIN_C_CSID);
#endif // U64
GEO_fn_vPrepareSaveGeometricObjects();
}
*/
/*-----------------------------------------------------------------------------
* Description : function to write a binary collide set
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
unsigned long CS_fn_ulWriteBinaryBloc(unsigned long _ulStructAddress, char* _p_cDestBuffer)
{
char* p_cBufferPointer=_p_cDestBuffer;
#if !defined(U64)
PCS_tdxHandleToPhysicalCollSet hCollideSet=(PCS_tdxHandleToPhysicalCollSet)_ulStructAddress;
p_cBufferPointer=BIN_fn_p_cPutPointer(p_cBufferPointer,(unsigned long)PCS_fn_hGetZdmGeoObjOfPhysicalCollSet(hCollideSet),GLI_p_stGetLinkTableOfGeometric());
p_cBufferPointer=BIN_fn_p_cPutPointer(p_cBufferPointer,(unsigned long)PCS_fn_hGetZddGeoObjOfPhysicalCollSet(hCollideSet),GLI_p_stGetLinkTableOfGeometric());
p_cBufferPointer=BIN_fn_p_cPutPointer(p_cBufferPointer,(unsigned long)PCS_fn_hGetZdeGeoObjOfPhysicalCollSet(hCollideSet),GLI_p_stGetLinkTableOfGeometric());
p_cBufferPointer=BIN_fn_p_cPutPointer(p_cBufferPointer,(unsigned long)PCS_fn_hGetZdrGeoObjOfPhysicalCollSet(hCollideSet),GLI_p_stGetLinkTableOfGeometric());
#endif // U64
return p_cBufferPointer-_p_cDestBuffer;
}
*/
/*-----------------------------------------------------------------------------
* Description : function to write all the binary collide sets
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void CS_fn_vWriteAllCSBinaryBlocs(char* _szBinaryFileName)
{
CS_fn_vPrepareSaveBinaryBloc();
#if !defined(U64)
BIN_fn_vPutBinaryDataIntoFileFromLinkTable(_szBinaryFileName,&CS_g_stLinkTable,
4*sizeof(ACP_tdxHandleOfObject),CS_fn_ulWriteBinaryBloc);
#endif // U64
}
*/
/*-----------------------------------------------------------------------------
* Description : function to read a binary collide set
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
unsigned long CS_fn_ulReadBinaryBloc(char* _p_cLoadedBuffer,unsigned long _ulLoadedBufferSize)
{
ACP_tdxHandleOfObject hHandle;
PCS_tdxHandleToPhysicalCollSet hCollideSet;
char* p_cBufferPointer=_p_cLoadedBuffer;
// Allocation
hCollideSet = PCS_fn_hCreatePhysicalCollideSet();
#if !defined(U64)
p_cBufferPointer=BIN_fn_p_cGetPointer(p_cBufferPointer,(unsigned long*)&hHandle,GLI_p_stGetLinkTableOfGeometric());
PCS_fn_vSetZdmGeoObjOfPhysicalCollSet(hCollideSet,hHandle);
p_cBufferPointer=BIN_fn_p_cGetPointer(p_cBufferPointer,(unsigned long*)&hHandle,GLI_p_stGetLinkTableOfGeometric());
PCS_fn_vSetZddGeoObjOfPhysicalCollSet(hCollideSet,hHandle);
p_cBufferPointer=BIN_fn_p_cGetPointer(p_cBufferPointer,(unsigned long*)&hHandle,GLI_p_stGetLinkTableOfGeometric());
PCS_fn_vSetZdeGeoObjOfPhysicalCollSet(hCollideSet,hHandle);
p_cBufferPointer=BIN_fn_p_cGetPointer(p_cBufferPointer,(unsigned long*)&hHandle,GLI_p_stGetLinkTableOfGeometric());
PCS_fn_vSetZdrGeoObjOfPhysicalCollSet(hCollideSet,hHandle);
#endif // U64
return (unsigned long)hCollideSet;
}
*/
/*-----------------------------------------------------------------------------
* Description : function to read all the binary blocs fort the visual sets
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void CS_fn_vReadAllCSBinaryBlocs(char* _szBinaryFileName)
{
#if !defined(U64)
BIN_fn_vReadDataFromLinkTable(&CS_g_stLinkTable,CS_fn_ulReadBinaryBloc,4*sizeof(ACP_tdxHandleOfObject),_szBinaryFileName);
#endif // U64
}
*/
/*-----------------------------------------------------------------------------
* Description : function to read a binary collide set
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void CS_fn_vResolveBinaryBloc(unsigned long _ulAddress)
{
tdstPhysicalCollSet* hCollideSet;
hCollideSet=(tdstPhysicalCollSet*)_ulAddress;
#if !defined(U64)
BIN_fn_p_cGetPointer((char*)&hCollideSet->hZdm,(unsigned long*)&hCollideSet->hZdm,GLI_p_stGetLinkTableOfGeometric());
BIN_fn_p_cGetPointer((char*)&hCollideSet->hZdd,(unsigned long*)&hCollideSet->hZdd,GLI_p_stGetLinkTableOfGeometric());
BIN_fn_p_cGetPointer((char*)&hCollideSet->hZde,(unsigned long*)&hCollideSet->hZde,GLI_p_stGetLinkTableOfGeometric());
BIN_fn_p_cGetPointer((char*)&hCollideSet->hZdr,(unsigned long*)&hCollideSet->hZdr,GLI_p_stGetLinkTableOfGeometric());
#endif // U64
}
char* CS_fn_p_cGeneralAllocationFunction(unsigned long _ulSize)
{
char* p_cBuffer;
GEO_M_CPAMalloc(p_cBuffer,char *,_ulSize,E_uwGEONotEnoughtMemory);
return p_cBuffer;
}
*/
/*-----------------------------------------------------------------------------
* Description : function to read all the binary blocs fort the visual sets
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void CS_fn_vReadAllCSBinaryBlocs2(char* _szBinaryFileName)
{
#if !defined(U64)
BIN_fn_vReadDataFromLinkTableWithoutAllocation(&CS_g_stLinkTable,CS_fn_vResolveBinaryBloc,
4*sizeof(ACP_tdxHandleOfObject),_szBinaryFileName,
CS_fn_p_cGeneralAllocationFunction);
#endif // U64
}
*/
/*
BEGIN OS 02.03.98
Callbacks for bin files.
*/
/*-----------------------------------------------------------------------------
* Description : call-back for header section of CS script file
*-----------------------------------------------------------------------------*/
/*
#if !defined(U64)
SCR_tde_Anl_ReturnValue CS_fn_eScriptCallBackBinHeader(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;
if( _eAction != SCR_EA_Anl_BeginSection )
{
// do whatever ...
return SCR_ERV_Anl_NormalReturn;
}
SCR_fn_v_Bin_BeginSection(_p_stFile);
// not used yet
//gs_wCSFileVersion = (short)fn_lAToI( _ap_szParams[0] );
SCR_fn_us_Bin_GetUSHORT( _p_stFile );
SCR_fn_v_Bin_EndSection(_p_stFile);
return ( eReturnValue );
}
#endif // U64
*/
/*-----------------------------------------------------------------------------
* Description : call-back for general section of CS script file
*-----------------------------------------------------------------------------*/
/*
#if !defined(U64)
SCR_tde_Anl_ReturnValue CS_fn_eScriptCallBackBinGeneral(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;
PCS_tdxHandleToPhysicalCollSet _hCollideSet;
char sz_LongPathForLinkTable[256];
//SCR_tdst_Cxt_Values *p_stVal;
ACP_tdxHandleOfObject _hGeometricObject;
char chTag;
if( _eAction != SCR_EA_Anl_BeginSection )
{
// do whatever ...
return SCR_ERV_Anl_NormalReturn;
}
_hCollideSet = PCS_fn_hCreatePhysicalCollideSet(1);
SCR_M_RdL0_SetSectionLong(C_ThisContext,0,_hCollideSet);
SCR_M_RdL0_ComputeOpenSectionNameR(0,sz_LongPathForLinkTable);
SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&CS_g_stLinkTable,sz_LongPathForLinkTable,(unsigned long)_hCollideSet),1,strlen(sz_LongPathForLinkTable)-strlen(SCR_M_RdL0_GetCompleteSectionNameR(0)));
SCR_fn_v_Bin_BeginSection(_p_stFile);
do{
chTag=SCR_fn_ch_Bin_GetCHAR( _p_stFile );
switch (chTag)
{
case 0: //ZDR
{
char szP0[MAX_PATH];
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP0 );
_hGeometricObject = GLI_pLoadBinGeometricInFile(szP0);
if ( _hGeometricObject->p_stOctree!=NULL&&GEO_fn_ucGetBlocNumberOf(_hGeometricObject)!=GEO_fn_ucGetBlocNumberOf(_hGeometricObject->p_stOctree)
||_hGeometricObject->p_stOctree==NULL&&GEO_fn_ucGetBlocNumberOf(_hGeometricObject)!=GEO_M_ucGetMemMallocMode())
{
M_POWarningErrorWithMessage(E_uwPOOctreeMustBeInFix,_p_stFile->a_szFileName);
_hGeometricObject->p_stOctree = NULL;
}
// Computing Octree on ZDR (JO 23/09/97)
COL_fn_bCreateOctree(_hGeometricObject,10,5,4);
PCS_fn_vSetZdrGeoObjOfPhysicalCollSet(_hCollideSet,_hGeometricObject);
}
break;
case 1: //ZDE
{
char szP0[MAX_PATH];
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP0 );
_hGeometricObject = GLI_pLoadBinGeometricInFile(szP0);
PCS_fn_vSetZdeGeoObjOfPhysicalCollSet(_hCollideSet,_hGeometricObject);
}
break;
case 2: //ZDD
{
char szP0[MAX_PATH];
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP0 );
_hGeometricObject = GLI_pLoadBinGeometricInFile(szP0);
PCS_fn_vSetZddGeoObjOfPhysicalCollSet(_hCollideSet,_hGeometricObject);
}
break;
}
}while (chTag!=-1);
SCR_fn_v_Bin_EndSection(_p_stFile);
return ( eReturnValue );
}
#endif // U64
*/
/*
END OS 02.03.98
Callbacks for bin files.
*/

View File

@@ -0,0 +1,530 @@
/*=========================================================================
* POLoad.c : Loading PO Files
*
* Version 1.0
* Creation date 05/05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1997
*=======================================================================*/
#define PO_FRIEND
#include "ACP_Base.h"
#include "SCR.h"
#include "DPT.h"
#include "GEO.h"
#include "GLI.h"
#include "COL.h"
#include "SPO.h"
#include "PCS.h"
//#include "BIN.h"
#include "PO.h"
#define D_PO_VariableDefine
#include "ErmPO.h"
#ifdef __cplusplus
extern "C" {
#endif
void PO_fn_vFirstInit(void)
{
Erm_M_InitErrMsg(PO);
}
#ifdef __cplusplus
} //extern "C"
#endif
// global for PO Link Table
SCR_tdst_Link_Table PO_g_stLinkTable;
/*-----------------------------------------------------------------------------
* Description : initialize and close link table for PO
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
SCR_tdst_Link_Table *PO_fn_p_stGetLinkTable(void)
{
return(&PO_g_stLinkTable);
}
void PO_fn_vInitLinkTable(void)
{
SCR_fn_v_Link_InitTable(&PO_g_stLinkTable);
}
void PO_fn_vCloseLinkTable(void)
{
SCR_fn_v_Link_CloseTable(&PO_g_stLinkTable);
}
/*-----------------------------------------------------------------------------
* Description : Used to register all script callback functions
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
void PO_fn_vRegisterAllScriptSections(void)
{
SCR_fn_v_RdL0_RegisterCallback(C_Section_POHeader, PO_fn_eScriptCallBackHeader,SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_Section_POGeneral, PO_fn_eScriptCallBackGeneral,SCR_CRC_c_RdL0_ForSection);
// SCR_fn_v_RdL0_RegisterCallback(C_Section_POHeader, PO_fn_eScriptCallBackBinHeader,SCR_CRC_c_RdL0_ForBinSection);
// SCR_fn_v_RdL0_RegisterCallback(C_Section_POGeneral, PO_fn_eScriptCallBackBinGeneral,SCR_CRC_c_RdL0_ForBinSection);
}
/*-----------------------------------------------------------------------------
* Description : call-back for header section of PO script file
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue PO_fn_eScriptCallBackHeader(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;
if ( M_IsEntry )
{
if ( M_ActionIs( C_Entry_FileVersion ) )
{
// not used yet
//gs_wPOFileVersion = (short)fn_lAToI( _ap_szParams[0] );
}
}
return ( eReturnValue );
}
/*-----------------------------------------------------------------------------
* Description : call-back for general section of PO script file
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue PO_fn_eScriptCallBackGeneral(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;
PO_tdxHandleToPhysicalObject _hPhysicalObject;
SCR_tdst_Cxt_Values *p_stVal;
char sz_LongPathForLinkTable[MAX_PATH];
char sFile[MAX_PATH], sAction[MAX_PATH], sIdent[MAX_PATH];
char sz_SectionNameForCS[MAX_PATH];
//char s[80];
if ( M_IsTitle )
{
_hPhysicalObject = PO_fn_hAllocPhysicalObject();
SCR_M_RdL0_SetSectionLong(C_ThisContext,0,_hPhysicalObject);
SCR_M_RdL0_ComputeOpenSectionNameR(0,sz_LongPathForLinkTable);
SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&PO_g_stLinkTable,sz_LongPathForLinkTable,(unsigned long)_hPhysicalObject),1,strlen(sz_LongPathForLinkTable)-strlen(SCR_M_RdL0_GetCompleteSectionNameR(0)));
// SCR_fn_v_RdL0_ComputeSectionName(sz_LongPathForLinkTable,SCR_M_RdL0_GetOpenFileNameR(0),C_Section_POGeneral,_p_szName);
//SCR_M_RdL0_GetFileNameR(_Offset)
/*
strcpy(sz_LongPathForLinkTable,fn_szGetLevelsDataPath());
strcat(sz_LongPathForLinkTable,"\\");
strcat(sz_LongPathForLinkTable,SCR_M_RdL0_GetCompleteSectionNameR(0));
*/
//SCR_fnp_st_Link_SetValue(&PO_g_stLinkTable, sz_LongPathForLinkTable, (unsigned long)_hPhysicalObject);
/*
strcpy(s,SCR_M_RdL0_GetCompleteSectionNameR(0));
strcat(s,"\n");
OutputDebugString(s);
*/
}
else if ( M_IsEntry )
{
if ( M_ActionIs( C_Entry_VS ) )
{
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,PO_tdxHandleToPhysicalObject,_hPhysicalObject);
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
_hPhysicalObject->_hVisualSet = (GEO_tdxHandleToVisualSet)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
HIE_fn_vComputeOnePoBoundingVolume(_hPhysicalObject);
}
else if ( M_ActionIs( C_Entry_CS ) )
{
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,PO_tdxHandleToPhysicalObject,_hPhysicalObject);
SCR_fn_v_RdL0_SplitSectionName(_ap_szParams[0], sFile, sAction, sIdent);
strcpy(sz_SectionNameForCS,sFile);
strcat(sz_SectionNameForCS,"^");
strcat(sz_SectionNameForCS,C_Section_AllCollideSets);
strcat(sz_SectionNameForCS,"^");
strcat(sz_SectionNameForCS,sAction);
strcat(sz_SectionNameForCS,":");
strcat(sz_SectionNameForCS,sIdent);
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(sz_SectionNameForCS, SCR_CDF_uw_Anl_Normal);
_hPhysicalObject->_hCollideSet = (PCS_tdxHandleToPhysicalCollSet)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
}
else if ( M_ActionIs( C_Entry_BV ) )
{
/*
SCR_M_RdL0_GetSectionLong(C_ThisContext,0,PO_tdxHandleToPhysicalObject,_hPhysicalObject);
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
_hPhysicalObject->_hBoundingVolume = (ACP_tdxHandleOfObject)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
*/
}
}
return ( eReturnValue );
}
/*-----------------------------------------------------------------------------
* Description : function to load a PO (script or binary load)
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
PO_tdxHandleToPhysicalObject CS_fn_xLoadPhysicalObject(char* _szSectionName)
{
SCR_tdst_Cxt_Values *p_stValues;
SCR_tdst_Link_Value *p_stLinkValue;
PO_tdxHandleToPhysicalObject hPhysicalObject=NULL;
unsigned int uiPos;
uiPos = 0;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stLinkValue,SCR_M_st_Link_GetDynamicArray(&PO_g_stLinkTable));
while(p_stLinkValue)
{
if(!strcmpi(SCR_M_p_sz_Link_GetKey(p_stLinkValue) + SCR_M_ul_Link_GetAdditionalLong(p_stLinkValue,1),_szSectionName))
break;
uiPos++;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stLinkValue,SCR_M_st_Link_GetDynamicArray(&PO_g_stLinkTable));
}
// p_stLinkValue=BIN_fn_p_stSearchShortKey(&PO_g_stLinkTable,_szSectionName);
if(p_stLinkValue==NULL)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_szSectionName, SCR_CDF_uw_Anl_Normal);
hPhysicalObject = (PO_tdxHandleToPhysicalObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0);
return hPhysicalObject;
}
else
return (PO_tdxHandleToPhysicalObject)p_stLinkValue->ulValue;
}
// Shaitan => module list in the level
/*-----------------------------------------------------------------------------
* Description : function to load a PO (script or binary load)
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
PO_tdxHandleToPhysicalObject CS_fn_xFindPhysicalObject(char* _szSectionName)
{
SCR_tdst_Link_Value *p_stLinkValue;
PO_tdxHandleToPhysicalObject hPhysicalObject=NULL;
unsigned int uiPos;
uiPos = 0;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stLinkValue,SCR_M_st_Link_GetDynamicArray(&PO_g_stLinkTable));
while(p_stLinkValue)
{
if(!strcmpi(SCR_M_p_sz_Link_GetKey(p_stLinkValue) + SCR_M_ul_Link_GetAdditionalLong(p_stLinkValue,1),_szSectionName))
break;
uiPos++;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stLinkValue,SCR_M_st_Link_GetDynamicArray(&PO_g_stLinkTable));
}
if(p_stLinkValue==NULL)
return NULL;
else
return (PO_tdxHandleToPhysicalObject)p_stLinkValue->ulValue;
}
// End Shaitan => module list in the level
/*-----------------------------------------------------------------------------
* Description : function to prepare the binary save process
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void PO_fn_vPrepareSaveBinaryBloc()
{
BIN_fn_vCreateBinaryIds(&PO_g_stLinkTable,BIN_C_POID);
CS_fn_vPrepareSaveBinaryBloc();
VS_fn_vPrepareSaveBinaryBloc();
}
*/
/*-----------------------------------------------------------------------------
* Description : function to write a binary PO
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
unsigned long PO_fn_ulWriteBinaryBloc(unsigned long _ulStructAddress, char* _p_cDestBuffer)
{
PO_tdxHandleToPhysicalObject hPO=(PO_tdxHandleToPhysicalObject)_ulStructAddress;
char* p_cBufferPointer=_p_cDestBuffer;
p_cBufferPointer=BIN_fn_p_cPutPointer(p_cBufferPointer,
(unsigned long)PO_fn_hGetVisualSet(hPO),
&VS_g_stLinkTable);
p_cBufferPointer=BIN_fn_p_cPutPointer(p_cBufferPointer,
(unsigned long)PO_fn_hGetCollideSet(hPO),
&CS_g_stLinkTable);
p_cBufferPointer=BIN_fn_p_cPutLong(p_cBufferPointer,0);
return p_cBufferPointer-_p_cDestBuffer;
}
*/
/*-----------------------------------------------------------------------------
* Description : function to write all the binary PO
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void PO_fn_vWriteAllPOBinaryBlocs(char* _szBinaryFileName)
{
PO_fn_vPrepareSaveBinaryBloc();
BIN_fn_vPutBinaryDataIntoFileFromLinkTable(_szBinaryFileName,&PO_g_stLinkTable,
3*sizeof(unsigned long),PO_fn_ulWriteBinaryBloc);
}
*/
/*-----------------------------------------------------------------------------
* Description : function to read a binary PO
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
unsigned long PO_fn_ulReadBinaryBloc(char* _p_cLoadedBuffer,unsigned long _ulLoadedBufferSize)
{
unsigned long ulAddress;
PO_tdxHandleToPhysicalObject hPO;
char* p_cBufferPointer=_p_cLoadedBuffer;
long lCrap;
// Allocation
hPO = PO_fn_hAllocPhysicalObject();
p_cBufferPointer=BIN_fn_p_cGetPointer(p_cBufferPointer,(unsigned long*)&ulAddress,&VS_g_stLinkTable);
PO_fn_vSetVisualSet(hPO,(GEO_tdxHandleToVisualSet)ulAddress);
p_cBufferPointer=BIN_fn_p_cGetPointer(p_cBufferPointer,(unsigned long*)&ulAddress,&CS_g_stLinkTable);
PO_fn_vSetCollideSet(hPO,(PCS_tdxHandleToPhysicalCollSet)ulAddress);
p_cBufferPointer=BIN_fn_p_cGetLong(p_cBufferPointer,&lCrap);
HIE_fn_vComputeOnePoBoundingVolume(hPO);
return (unsigned long)hPO;
}
*/
/*-----------------------------------------------------------------------------
* Description : function to read all the binary blocs fort the visual sets
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void PO_fn_vReadAllPOBinaryBlocs(char* _szBinaryFileName)
{
BIN_fn_vReadDataFromLinkTable(&PO_g_stLinkTable,PO_fn_ulReadBinaryBloc,2*sizeof(unsigned long),_szBinaryFileName);
}
*/
/*-----------------------------------------------------------------------------
* Description : function to read a binary PO
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void PO_fn_vResolveBinaryBloc(unsigned long _ulAddress)
{
PO_tdxHandleToPhysicalObject hPO;
hPO=(PO_tdxHandleToPhysicalObject)_ulAddress;
BIN_fn_p_cGetPointer((char*)&hPO->_hVisualSet,(unsigned long*)&hPO->_hVisualSet,&VS_g_stLinkTable);
BIN_fn_p_cGetPointer((char*)&hPO->_hCollideSet,(unsigned long*)&hPO->_hCollideSet,&CS_g_stLinkTable);
}
char* PO_fn_p_cGeneralAllocationFunction(unsigned long _ulSize)
{
char* p_cBuffer;
GEO_M_CPAMalloc(p_cBuffer,char *, _ulSize, E_uwGEONotEnoughtMemory);
return p_cBuffer;
}
*/
/*-----------------------------------------------------------------------------
* Description : function to read all the binary blocs fort the visual sets
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void PO_fn_vReadAllPOBinaryBlocs2(char* _szBinaryFileName)
{
BIN_fn_vReadDataFromLinkTableWithoutAllocation(&PO_g_stLinkTable,PO_fn_vResolveBinaryBloc,
3*sizeof(unsigned long),_szBinaryFileName,
PO_fn_p_cGeneralAllocationFunction);
}
*/
/*-----------------------------------------------------------------------------
* Description : 2nd pass to read a binary PO
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Sep 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void PO_fn_vResolveBinaryBlocPass2(unsigned long _ulAddress)
{
PO_tdxHandleToPhysicalObject hPO;
hPO=(PO_tdxHandleToPhysicalObject)_ulAddress;
HIE_fn_vComputeOnePoBoundingVolume(hPO);
}
*/
/*
BEGIN OS 02.03.98
Callbacks for bin files.
*/
/*-----------------------------------------------------------------------------
* Description : call-back for header section of PO script file
*-----------------------------------------------------------------------------*/
/*
SCR_tde_Anl_ReturnValue PO_fn_eScriptCallBackBinHeader(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;
short sNotUsed;
// not used yet
//gs_wPOFileVersion = (short)fn_lAToI( _ap_szParams[0] );
if( _eAction != SCR_EA_Anl_BeginSection )
{
// do whatever ...
return SCR_ERV_Anl_NormalReturn;
}
SCR_fn_v_Bin_BeginSection(_p_stFile);
sNotUsed = SCR_fn_s_Bin_GetSHORT( _p_stFile );
SCR_fn_v_Bin_EndSection(_p_stFile);
return ( eReturnValue );
}
*/
/*-----------------------------------------------------------------------------
* Description : call-back for general section of PO script file
*-----------------------------------------------------------------------------*/
/*
SCR_tde_Anl_ReturnValue PO_fn_eScriptCallBackBinGeneral(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;
PO_tdxHandleToPhysicalObject _hPhysicalObject;
SCR_tdst_Cxt_Values *p_stVal;
char sz_LongPathForLinkTable[MAX_PATH];
char sFile[MAX_PATH], sAction[MAX_PATH], sIdent[MAX_PATH];
char sz_SectionNameForCS[MAX_PATH];
//char s[80];
char szP0[MAX_PATH], szP1[MAX_PATH];
if( _eAction != SCR_EA_Anl_BeginSection )
{
// do whatever ...
return SCR_ERV_Anl_NormalReturn;
}
SCR_fn_v_Bin_BeginSection(_p_stFile);
_hPhysicalObject = PO_fn_hAllocPhysicalObject();
SCR_M_RdL0_SetSectionLong(C_ThisContext,0,_hPhysicalObject);
SCR_M_RdL0_ComputeOpenSectionNameR(0,sz_LongPathForLinkTable);
SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&PO_g_stLinkTable,sz_LongPathForLinkTable,(unsigned long)_hPhysicalObject),1,strlen(sz_LongPathForLinkTable)-strlen(SCR_M_RdL0_GetCompleteSectionNameR(0)));
// VS
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP0 );
p_stVal = SCR_fnp_st_Bin_GetREFERENCE( szP0 );
_hPhysicalObject->_hVisualSet = (GEO_tdxHandleToVisualSet)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
HIE_fn_vComputeOnePoBoundingVolume(_hPhysicalObject);
// CS
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP1 );
SCR_fn_v_RdL0_SplitSectionName(szP1, sFile, sAction, sIdent);
strcpy(sz_SectionNameForCS,sFile);
strcat(sz_SectionNameForCS,"^");
strcat(sz_SectionNameForCS,C_Section_AllCollideSets);
strcat(sz_SectionNameForCS,"^");
strcat(sz_SectionNameForCS,sAction);
strcat(sz_SectionNameForCS,":");
strcat(sz_SectionNameForCS,sIdent);
p_stVal = SCR_fnp_st_Bin_GetREFERENCE( sz_SectionNameForCS );
_hPhysicalObject->_hCollideSet = (PCS_tdxHandleToPhysicalCollSet)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
SCR_fn_v_Bin_EndSection(_p_stFile);
return ( eReturnValue );
}
*/
/*
END OS 02.03.98
Callbacks for bin files.
*/
/*
BEGIN OS 05.03.98
Called functions by callbacks for bin files.
*/
/*-----------------------------------------------------------------------------
* Description : function to load a PO (script or binary load)
*-----------------------------------------------------------------------------*/
/*
PO_tdxHandleToPhysicalObject CS_fn_xLoadBinPhysicalObject(char* _szSectionName)
{
SCR_tdst_Cxt_Values *p_stValues;
SCR_tdst_Link_Value *p_stLinkValue;
PO_tdxHandleToPhysicalObject hPhysicalObject=NULL;
p_stLinkValue=BIN_fn_p_stSearchShortKey(&PO_g_stLinkTable,_szSectionName);
if(p_stLinkValue==NULL)
{
p_stValues = SCR_fnp_st_Bin_GetREFERENCE( _szSectionName );
hPhysicalObject = (PO_tdxHandleToPhysicalObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0);
return hPhysicalObject;
}
else
return (PO_tdxHandleToPhysicalObject)p_stLinkValue->ulValue;
}
*/
/*
END OS 05.03.98
Called functions by callbacks for bin files.
*/

View File

@@ -0,0 +1,240 @@
/*=========================================================================
* PhObjs.c : Physical Objects functions
*
* Version 1.0
* Creation date 18/02/97
* Revision date 18/03/97
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1997
*=======================================================================*/
#define PO_FRIEND
#include "ACP_Base.h"
#include "GEO.h"
#include "GLI.h"
#include "COL.h"
#include "SPO.h"
#include "PCS.h"
#include "PO.h"
/* ***************************************************************************** */
/* **************** Creation and first init of a PO **************************** */
/* ***************************************************************************** */
/*-----------------------------------------------------------------------------
* Description : Allocate a Physical Object
*-----------------------------------------------------------------------------
* Creation date : 18/02/97 Author : Sebastien DAVID
*-----------------------------------------------------------------------------*/
PO_tdxHandleToPhysicalObject PO_fn_hAllocPhysicalObject(void)
{
PO_tdstPhysicalObject *p_stPhysicalObject;
/*p_stPhysicalObject = (struct PO_tdstPhysicalObject_ *)Mmg_fn_p_vAlloc(sizeof(struct PO_tdstPhysicalObject_));
if ((stCurrentModeInfo.ucModuleId != 7) || (stCurrentModeInfo.ucMode)){
p_stPhysicalObject->_hVisualSet = NULL;// just for breack
}*/
MMG_fn_vAddMemoryInfo (MMG_C_lTypePO , MMG_C_lSubTypePOStructure , NULL);
GEO_M_CPAMalloc(p_stPhysicalObject,struct PO_tdstPhysicalObject_ *, sizeof(struct PO_tdstPhysicalObject_), E_uwGEONotEnoughtMemory);
//Set (char *s_szBankName,char *s_szObjectName)
//p_stPhysicalObject->p_stGeometricObject=GLI_p_stFindOrLoadGeometric(s_szBankName,s_szObjectName);
p_stPhysicalObject->_hVisualSet = NULL;
p_stPhysicalObject->_hCollideSet = NULL;
p_stPhysicalObject->_hBoundingVolume = NULL;
return (p_stPhysicalObject);
}
/*-----------------------------------------------------------------------------
* Description : Free a Physical Object
*-----------------------------------------------------------------------------
* Creation date : 18/02/97 Author : Sebastien DAVID
*-----------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_
void PO_fn_vFreePhysicalObject(PO_tdxHandleToPhysicalObject _hPhysicalObject)
{
Mmg_fn_vFree4Ch(_hPhysicalObject,C_ucMmgDefaultChannel);
}
#endif /* _FIRE_DEADCODE_U64_ */
/* ***************************************************************************** */
/* ******************** Access functions to Object in PO *********************** */
/* ***************************************************************************** */
/*-----------------------------------------------------------------------------
* Description : Get the Object in a Physical Object
*-----------------------------------------------------------------------------
* Creation date : 18/03/97 Author : Sebastien DAVID
*-----------------------------------------------------------------------------*/
/*
void * PO_fn_p_vGetObject(PO_tdxHandleToPhysicalObject _hPhysicalObject)
{
return(_hPhysicalObject->p_vObject);
}
*/
/*-----------------------------------------------------------------------------
* Description : Set the Object in a Physical Object
*-----------------------------------------------------------------------------
* Creation date : 18/03/97 Author : Sebastien DAVID
*-----------------------------------------------------------------------------*/
/*
void PO_fn_p_vSetObject(PO_tdxHandleToPhysicalObject _hPhysicalObject,void * p_vObject)
{
_hPhysicalObject->p_vObject = p_vObject;
}
*/
/*-----------------------------------------------------------------------------
* Description : Get the Visual Set Object in a Physical Object
*-----------------------------------------------------------------------------
* Creation date : 18/03/97 Author : Sebastien DAVID
*-----------------------------------------------------------------------------*/
GEO_tdxHandleToVisualSet PO_fn_hGetVisualSet(PO_tdxHandleToPhysicalObject _hPhysicalObject)
{
return(_hPhysicalObject->_hVisualSet);
}
/*-----------------------------------------------------------------------------
* Description : Set the Visual Set Object in a Physical Object
*-----------------------------------------------------------------------------
* Creation date : 18/03/97 Author : Sebastien DAVID
*-----------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_
void PO_fn_vSetVisualSet(PO_tdxHandleToPhysicalObject _hPhysicalObject
,GEO_tdxHandleToVisualSet _hNewVisualSet)
{
_hPhysicalObject->_hVisualSet = _hNewVisualSet;
}
#endif /* _FIRE_DEADCODE_U64_ */
/* ***************************************************************************** */
/* **************** Access functions to CollideSet in PO *********************** */
/* ***************************************************************************** */
/*-----------------------------------------------------------------------------
* Description : Get the Collide Set in a Physical Object
*-----------------------------------------------------------------------------
* Creation date : 19/02/97 Author : Sebastien DAVID
*-----------------------------------------------------------------------------*/
PCS_tdxHandleToPhysicalCollSet PO_fn_hGetCollideSet(PO_tdxHandleToPhysicalObject _hPhysicalObject)
{
return(_hPhysicalObject->_hCollideSet);
}
/*-----------------------------------------------------------------------------
* Description : Set the Collide Set in a Physical Object
*-----------------------------------------------------------------------------
* Creation date : 19/02/97 Author : Sebastien DAVID
*-----------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_
void PO_fn_vSetCollideSet(PO_tdxHandleToPhysicalObject _hPhysicalObject
,PCS_tdxHandleToPhysicalCollSet _hNewCollideSet)
{
_hPhysicalObject->_hCollideSet = _hNewCollideSet;
}
#endif /* _FIRE_DEADCODE_U64_ */
/* ***************************************************************************** */
/* **************** Access functions to BoundingVolume in PO ******************* */
/* ***************************************************************************** */
/*-----------------------------------------------------------------------------
* Description : Get the Bounding Volume in a Physical Object
*-----------------------------------------------------------------------------
* Creation date : 18/03/97 Author : Sebastien DAVID
*-----------------------------------------------------------------------------*/
GEO_tdxHandleToBoundingSphere PO_fn_hGetBoundingVolume(PO_tdxHandleToPhysicalObject _hPhysicalObject)
{
return(_hPhysicalObject->_hBoundingVolume);
}
/*-----------------------------------------------------------------------------
* Description : Set the Bounding Volume in a Physical Object
*-----------------------------------------------------------------------------
* Creation date : 18/03/97 Author : Sebastien DAVID
*-----------------------------------------------------------------------------*/
void PO_fn_vSetBoundingVolume(PO_tdxHandleToPhysicalObject _hPhysicalObject,
GEO_tdxHandleToBoundingSphere _hNewBoundingVolume)
{
_hPhysicalObject->_hBoundingVolume = _hNewBoundingVolume;
}
// temporairement !!!!!!!!!!!!!!!
void HIE_fn_vComputeOnePoBoundingVolume(PO_tdxHandleToPhysicalObject _hPhysicalObject)
{
MTH3D_tdstVector stLocalCenter;
MTH_tdxReal xRadius;
GEO_tdxHandleToBoundingSphere hBoundingSphere;
ACP_tdxHandleOfObject hGeometricObject;
MTH_tdxReal xReal;
GEO_fn_vCreateBoundingSphere(&hBoundingSphere);
GLI_vGetVisualSetLOD(PO_fn_hGetVisualSet(_hPhysicalObject), 0, &xReal, &hGeometricObject);
xRadius=0.0f;
#ifndef U64
#ifdef USE_ALTIMAPS
if( hGeometricObject->d_xListOfElementsTypes[ 0 ] == GEO_C_xElementAltimap )
{
//--- Altimap ---
GEO_vGetAltimapOrigin( hGeometricObject, 0, &stLocalCenter );
GEO_fn_vAddAltimapToSphere(hGeometricObject,&stLocalCenter,&xRadius);
}
else
#endif //USE_ALTIMAPS
{
//--- NOT Altimap ---
MTH3D_M_vCopyVector(&stLocalCenter, hGeometricObject->d_stListOfPoints);
GEO_fn_vAddObjectToSphere(hGeometricObject,&stLocalCenter,&xRadius);
}
#else
if( hGeometricObject->d_xListOfElementsTypes != NULL ) // Temporary antibug for sprites AR980327
{
#ifdef USE_ALTIMAPS
if( hGeometricObject->d_xListOfElementsTypes[ 0 ] == GEO_C_xElementAltimap )
{
//--- Altimap ---
GEO_vGetAltimapOrigin( hGeometricObject, 0, &stLocalCenter );
GEO_fn_vAddAltimapToSphere(hGeometricObject,&stLocalCenter,&xRadius);
}
else
#endif //USE_ALTIMAPS
if(hGeometricObject->d_stListOfPoints!=NULL)
{
//--- NOT Altimap ---
MTH3D_M_vCopyVector(&stLocalCenter, hGeometricObject->d_stListOfPoints);
GEO_fn_vAddObjectToSphere(hGeometricObject,&stLocalCenter,&xRadius);
}
else
{
MTH3D_M_vSetVectorElements(&stLocalCenter,
MTH_M_xFloatToReal(hGeometricObject->a3_fCenter[0]),
MTH_M_xFloatToReal(hGeometricObject->a3_fCenter[1]),
MTH_M_xFloatToReal(hGeometricObject->a3_fCenter[2]));
xRadius=MTH_M_xFloatToReal(hGeometricObject->fRadius);
}
}
else
{
MTH3D_M_vSetVectorElements(&stLocalCenter,MTH_C_ZERO,MTH_C_ZERO,MTH_C_ZERO);
xRadius=0.0f;
}
#endif
GEO_fn_vSetBoundingSphere(hBoundingSphere, &stLocalCenter, xRadius);
PO_fn_vSetBoundingVolume(_hPhysicalObject ,hBoundingSphere);
}

View File

@@ -0,0 +1,469 @@
/*=========================================================================
* VSLoad.c : Loading VS Files
*
* Version 1.0
* Creation date 05/05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1997
*=======================================================================*/
#define PO_FRIEND
#include "ACP_Base.h"
#include "SCR.h"
#include "DPT.h"
#include "GEO.h"
#include "GLI.h"
#include "COL.h"
#include "SPO.h"
#include "PCS.h"
#include "PO.h"
//#include "BIN.h"
#include "GLIGLOU\MULTIDRV\inc\VisuS_st.h" // Must be defined as friend
#define VS_C_MaxStructureSize 32*1024
// global for VS Link Table
SCR_tdst_Link_Table VS_g_stLinkTable;
/*-----------------------------------------------------------------------------
* Description : initialize and close link table for VS
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
SCR_tdst_Link_Table *VS_fn_p_stGetLinkTable(void)
{
return(&VS_g_stLinkTable);
}
void VS_fn_vInitLinkTable(void)
{
SCR_fn_v_Link_InitTable(&VS_g_stLinkTable);
}
void VS_fn_vCloseLinkTable(void)
{
SCR_fn_v_Link_CloseTable(&VS_g_stLinkTable);
}
/*-----------------------------------------------------------------------------
* Description : Used to register all script callback functions
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
void VS_fn_vRegisterAllScriptSections(void)
{
SCR_fn_v_RdL0_RegisterCallback(C_Section_VSHeader, VS_fn_eScriptCallBackHeader, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_Section_VSGeneral, VS_fn_eScriptCallBackGeneral, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_SubSection_LOD, VS_fn_eScriptCallBackLOD, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_Section_VSRLI, GLI_fn_xLoadRLI, SCR_CRC_c_RdL0_ForSection);
/* SCR_fn_v_RdL0_RegisterCallback(C_Section_VSHeader, VS_fn_eScriptCallBackBinHeader, SCR_CRC_c_RdL0_ForBinSection);
SCR_fn_v_RdL0_RegisterCallback(C_Section_VSGeneral, VS_fn_eScriptCallBackBinGeneral, SCR_CRC_c_RdL0_ForBinSection);
SCR_fn_v_RdL0_RegisterCallback(C_SubSection_LOD, VS_fn_eScriptCallBackBinLOD, SCR_CRC_c_RdL0_ForBinSection);
*/
}
/*-----------------------------------------------------------------------------
* Description : call-back for header section of VS script file
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue VS_fn_eScriptCallBackHeader(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;
if ( M_IsEntry )
{
if ( M_ActionIs( C_Entry_FileVersion ) )
{
// not used yet
//gs_wVSFileVersion = (short)fn_lAToI( _ap_szParams[0] );
}
}
return ( eReturnValue );
}
/*-----------------------------------------------------------------------------
* Description : call-back for general section of VS script file
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue VS_fn_eScriptCallBackGeneral(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;
GEO_tdxHandleToVisualSet _hVisualSet;
char sz_LongPathForLinkTable[256];
//char s[80];
if ( M_IsTitle )
{
_hVisualSet = GLI_p_stCreateVisualSet(atol(_ap_szParams[0]));
SCR_M_RdL0_SetSectionLong(C_ThisContext,0,_hVisualSet);
SCR_M_RdL0_ComputeOpenSectionNameR(0,sz_LongPathForLinkTable);
SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&VS_g_stLinkTable,sz_LongPathForLinkTable,(unsigned long)_hVisualSet),1,strlen(sz_LongPathForLinkTable)-strlen(SCR_M_RdL0_GetCompleteSectionNameR(0)));
/*
strcpy(sz_LongPathForLinkTable,fn_szGetLevelsDataPath());
strcat(sz_LongPathForLinkTable,"\\");
strcat(sz_LongPathForLinkTable,SCR_M_RdL0_GetCompleteSectionNameR(0));
SCR_fnp_st_Link_SetValue(&VS_g_stLinkTable, sz_LongPathForLinkTable, (unsigned long)_hVisualSet);
*/
/*
strcpy(s,SCR_M_RdL0_GetCompleteSectionNameR(0));
strcat(s,"\n");
OutputDebugString(s);
*/
}
else if ( M_IsBegSubSection )
{
SCR_M_RdL0_GetSectionLong(C_ThisContext,0,GEO_tdxHandleToVisualSet,_hVisualSet);
SCR_M_RdL0_SetContextLong(C_ChildContext,0,_hVisualSet);
SCR_M_RdL0_SetContextLong(C_ChildContext,1,atol(_ap_szParams[1])-1);
SCR_M_RdL0_SetContextDouble(C_ChildContext,0,0.0); //init Threshold=0
}
return ( eReturnValue );
}
/*-----------------------------------------------------------------------------
* Description : call-back for LODs sections of VS script file
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue VS_fn_eScriptCallBackLOD(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;
GEO_tdxHandleToVisualSet _hVisualSet;
//SCR_tdst_Cxt_Values *p_stVal;
ACP_tdxHandleOfObject _hGeometricObject;
long l_NumberOfLOD;
double lf_Tmp;
MTH_tdxReal xThreshold;
if ( M_IsEntry )
{
if ( M_ActionIs( C_Entry_LOD_Threshold ) )
{
SCR_M_RdL0_SetContextDouble(C_ThisContext,0,atof(_ap_szParams[0]));
}
else if ( M_ActionIs( C_Entry_FichierMOD ) )
{
SCR_M_RdL0_GetContextLong(C_ThisContext,0,GEO_tdxHandleToVisualSet,_hVisualSet);
SCR_M_RdL0_GetContextLong(C_ThisContext,1,long,l_NumberOfLOD);
SCR_M_RdL0_GetContextDouble(C_ThisContext,0,lf_Tmp); xThreshold = (float)lf_Tmp;
//p_stVal = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
//_hGeometricObject = (ACP_tdxHandleOfObject)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
_hGeometricObject = GLI_pLoadGeometricInFile(_ap_szParams[0]);
GLI_vSetVisualSetLOD(_hVisualSet,l_NumberOfLOD,xThreshold,_hGeometricObject);
}
//ANNECY JMD 17/02/98 {
else if ( M_ActionIs ( C_Entry_FichierRLI ) ) {
long lNumberOfTable ;
ACP_tdxHandleToRadiosity *d_hRLI ;
SCR_M_RdL0_GetContextLong(C_ThisContext,0,GEO_tdxHandleToVisualSet,_hVisualSet);
d_hRLI = GLI_vVisualSetLoadRLI (_ap_szParams[0], &lNumberOfTable ) ;
GLI_vVisualSetSetRLITable(_hVisualSet, d_hRLI, lNumberOfTable) ;
}
//END ANNECY JMD }
}
return ( eReturnValue );
}
/*-----------------------------------------------------------------------------
* Description : function to load a Visual Set (script or binary load)
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
GEO_tdxHandleToVisualSet VS_fn_xLoadVisualSet(char* _szSectionName)
{
SCR_tdst_Cxt_Values *p_stValues;
SCR_tdst_Link_Value *p_stLinkValue;
GEO_tdxHandleToVisualSet hVisualSet=NULL;
unsigned int uiPos;
uiPos = 0;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stLinkValue,SCR_M_st_Link_GetDynamicArray(&VS_g_stLinkTable));
while(p_stLinkValue)
{
if(!strcmpi(SCR_M_p_sz_Link_GetKey(p_stLinkValue) + SCR_M_ul_Link_GetAdditionalLong(p_stLinkValue,1),_szSectionName))
break;
uiPos++;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stLinkValue,SCR_M_st_Link_GetDynamicArray(&VS_g_stLinkTable));
}
// p_stLinkValue=BIN_fn_p_stSearchShortKey(&VS_g_stLinkTable,_szSectionName);
if(p_stLinkValue==NULL)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_szSectionName, SCR_CDF_uw_Anl_Normal);
hVisualSet = (GEO_tdxHandleToVisualSet)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0);
return hVisualSet;
}
else
return (GEO_tdxHandleToVisualSet)p_stLinkValue->ulValue;
}
/*-----------------------------------------------------------------------------
* Description : function to prepare the binary save process
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void VS_fn_vPrepareSaveBinaryBloc()
{
BIN_fn_vCreateBinaryIds(&VS_g_stLinkTable,BIN_C_VSID);
GEO_fn_vPrepareSaveGeometricObjects();
}
*/
/*-----------------------------------------------------------------------------
* Description : function to write a binary visual set
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
unsigned long VS_fn_ulWriteBinaryBloc(unsigned long _ulStructAddress, char* _p_cDestBuffer)
{
GEO_tdstVisualSet* p_stVisualSet=(GEO_tdstVisualSet*)_ulStructAddress;
char* p_cBufferPointer=_p_cDestBuffer;
ACP_tdxIndex xI;
p_cBufferPointer=BIN_fn_p_cPutReal(p_cBufferPointer,p_stVisualSet->xLastDistance);
p_cBufferPointer=BIN_fn_p_cPutLong(p_cBufferPointer,p_stVisualSet->xNbLodDefinitions);
p_cBufferPointer=BIN_fn_p_cPutLong(p_cBufferPointer,0); // place for the pointer
p_cBufferPointer=BIN_fn_p_cPutLong(p_cBufferPointer,0); // place for the pointer
p_cBufferPointer=BIN_fn_p_cPutStruct(p_cBufferPointer,(char*)p_stVisualSet->d_xThresholdsTable,sizeof(MTH_tdxReal)*p_stVisualSet->xNbLodDefinitions);
for(xI=0;xI<p_stVisualSet->xNbLodDefinitions;++xI)
p_cBufferPointer=BIN_fn_p_cPutPointer(p_cBufferPointer,(unsigned long)p_stVisualSet->d_p_stLodDefinitions[xI],GLI_p_stGetLinkTableOfGeometric());
return p_cBufferPointer-_p_cDestBuffer;
}
*/
/*-----------------------------------------------------------------------------
* Description : function to write all the binary visual sets
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void VS_fn_vWriteAllVSBinaryBlocs(char* _szBinaryFileName)
{
VS_fn_vPrepareSaveBinaryBloc();
BIN_fn_vPutBinaryDataIntoFileFromLinkTable(_szBinaryFileName,&VS_g_stLinkTable,
VS_C_MaxStructureSize,VS_fn_ulWriteBinaryBloc);
}
*/
/*-----------------------------------------------------------------------------
* Description : function to read a binary visual set
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
unsigned long VS_fn_ulReadBinaryBloc(char* _p_cLoadedBuffer,unsigned long _ulLoadedBufferSize)
{
GEO_tdstVisualSet* p_stVisualSet;
ACP_tdxIndex xNbLOD;
char* p_cBufferPointer=_p_cLoadedBuffer;
ACP_tdxIndex xI;
p_cBufferPointer=BIN_fn_p_cGetLong(p_cBufferPointer,&xNbLOD);
p_stVisualSet = GLI_p_stCreateVisualSet(xNbLOD);
p_cBufferPointer=BIN_fn_p_cGetReal(p_cBufferPointer,&p_stVisualSet->xLastDistance);
p_cBufferPointer=BIN_fn_p_cGetStruct(p_cBufferPointer,(char*)p_stVisualSet->d_xThresholdsTable,sizeof(MTH_tdxReal)*p_stVisualSet->xNbLodDefinitions);
for(xI=0;xI<p_stVisualSet->xNbLodDefinitions;++xI)
p_cBufferPointer=BIN_fn_p_cGetPointer(p_cBufferPointer,(unsigned long*)&p_stVisualSet->d_p_stLodDefinitions[xI],GLI_p_stGetLinkTableOfGeometric());
return (unsigned long)p_stVisualSet;
}
*/
/*-----------------------------------------------------------------------------
* Description : function to read all the binary blocs fort the visual sets
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void VS_fn_vReadAllVSBinaryBlocs(char* _szBinaryFileName)
{
BIN_fn_vReadDataFromLinkTable(&VS_g_stLinkTable,VS_fn_ulReadBinaryBloc,VS_C_MaxStructureSize,_szBinaryFileName);
}
*/
/*-----------------------------------------------------------------------------
* Description : function to read a binary visual set
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void VS_fn_vResolveBinaryBloc(unsigned long _ulAddress)
{
GEO_tdstVisualSet* p_stVisualSet;
ACP_tdxIndex xI;
p_stVisualSet=(GEO_tdstVisualSet*)_ulAddress;
p_stVisualSet->d_xThresholdsTable=(MTH_tdxReal*)((char*)p_stVisualSet+sizeof(GEO_tdstVisualSet));
p_stVisualSet->d_p_stLodDefinitions=(ACP_tdxHandleOfObject *)((char*)p_stVisualSet+
sizeof(GEO_tdstVisualSet)+
p_stVisualSet->xNbLodDefinitions*sizeof(MTH_tdxReal));
for(xI=0;xI<p_stVisualSet->xNbLodDefinitions;++xI)
BIN_fn_p_cGetPointer((char*)&p_stVisualSet->d_p_stLodDefinitions[xI],(unsigned long*)&p_stVisualSet->d_p_stLodDefinitions[xI],GLI_p_stGetLinkTableOfGeometric());
}
char* VS_fn_p_cAllocateFunction(unsigned long _ulSize)
{
char* p_cBuffer;
GEO_M_CPAMalloc(p_cBuffer ,char* ,_ulSize ,E_uwGEONotEnoughtMemory );
return p_cBuffer;
}
*/
/*-----------------------------------------------------------------------------
* Description : function to read all the binary blocs fort the visual sets
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : Aug 97 Author : Alain Robin
*-----------------------------------------------------------------------------*/
/*
void VS_fn_vReadAllVSBinaryBlocs2(char* _szBinaryFileName)
{
BIN_fn_vReadDataFromLinkTableWithoutAllocation(&VS_g_stLinkTable,VS_fn_vResolveBinaryBloc,
VS_C_MaxStructureSize,_szBinaryFileName,
VS_fn_p_cAllocateFunction);
}
*/
/*
BEGIN OS 02.03.98
Callbacks for bin files.
*/
/*-----------------------------------------------------------------------------
* Description : call-back for header section of VS script file
*---------------------------------------------------------------------------*/
/*
SCR_tde_Anl_ReturnValue VS_fn_eScriptCallBackBinHeader(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;
if( _eAction == SCR_EA_Anl_AlreadyAnalysed )
{
// do whatever ...
return SCR_ERV_Anl_NormalReturn;
}
SCR_fn_v_Bin_BeginSection(_p_stFile);
// not used yet
//gs_wVSFileVersion =
SCR_fn_s_Bin_GetSHORT( _p_stFile );
SCR_fn_v_Bin_EndSection(_p_stFile);
return ( eReturnValue );
}
*/
/*-----------------------------------------------------------------------------
* Description : call-back for general section of VS script file
*-----------------------------------------------------------------------------*/
/*
SCR_tde_Anl_ReturnValue VS_fn_eScriptCallBackBinGeneral(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;
GEO_tdxHandleToVisualSet _hVisualSet;
char sz_LongPathForLinkTable[256];
switch( _eAction )
{
case SCR_EA_Anl_BeginSection:
SCR_fn_v_Bin_BeginSection(_p_stFile);
_hVisualSet = GLI_p_stCreateVisualSet(SCR_fn_s_Bin_GetSHORT( _p_stFile ));
SCR_M_RdL0_SetSectionLong(C_ThisContext,0,_hVisualSet);
SCR_fn_v_Bin_EndSection(_p_stFile);
break;
case SCR_EA_Anl_BeginSubSection:
SCR_M_RdL0_ComputeOpenSectionNameR(0,sz_LongPathForLinkTable);
SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&VS_g_stLinkTable,sz_LongPathForLinkTable,(unsigned long)_hVisualSet),1,strlen(sz_LongPathForLinkTable)-strlen(SCR_M_RdL0_GetCompleteSectionNameR(0)));
SCR_M_RdL0_SetContextLong(C_ChildContext,0,_hVisualSet);
SCR_M_RdL0_SetContextLong(C_ChildContext,1,(short)atol(_ap_szParams[1]) - 1);
SCR_M_RdL0_SetContextDouble(C_ChildContext,0,0.0); //init Threshold=0
break;
}
return ( eReturnValue );
}
*/
/*-----------------------------------------------------------------------------
* Description : call-back for LODs sections of VS script file
*-----------------------------------------------------------------------------*/
/*
SCR_tde_Anl_ReturnValue VS_fn_eScriptCallBackBinLOD(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;
GEO_tdxHandleToVisualSet _hVisualSet;
//SCR_tdst_Cxt_Values *p_stVal;
ACP_tdxHandleOfObject _hGeometricObject;
long l_NumberOfLOD;
double lf_Tmp;
MTH_tdxReal xThreshold;
char szP0[MAX_PATH];
switch( _eAction )
{
case SCR_EA_Anl_BeginSection:
SCR_fn_v_Bin_BeginSection(_p_stFile);
// LOD_Threshold
SCR_M_RdL0_SetContextDouble(C_ThisContext,0, SCR_fn_s_Bin_GetSHORT( _p_stFile ));
// FichierMOD
SCR_M_RdL0_GetContextLong(C_ThisContext,0,GEO_tdxHandleToVisualSet,_hVisualSet);
SCR_M_RdL0_GetContextLong(C_ThisContext,1,long,l_NumberOfLOD);
SCR_M_RdL0_GetContextDouble(C_ThisContext,0,lf_Tmp); xThreshold = (float)lf_Tmp;
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP0 );
_hGeometricObject = GLI_pLoadBinGeometricInFile(szP0);
GLI_vSetVisualSetLOD(_hVisualSet,l_NumberOfLOD,xThreshold,_hGeometricObject);
SCR_fn_v_Bin_EndSection(_p_stFile);
break;
}
return ( eReturnValue );
}
*/
/*
END OS 02.03.98
Callbacks for bin files.
*/

View File

@@ -0,0 +1,104 @@
/*****************
loadCB.c
Ver 1.0
LDT version of
collision set
loading
*****************/
#include "ldt.h"
/*****************************************************************
Name:
Description: Create callback for LDT
Author: Mircea Petrescu
Date: 6/29/98
Modified:
*****************************************************************/
int CS_iCreateGeneral( LDT_tdst_Link *pLink )
{
PCS_tdxHandleToPhysicalCollSet _hCollideSet;
_hCollideSet = PCS_fn_hCreatePhysicalCollideSet(1);
pLink->pObject=(void *)_hCollideSet;
return 0;
}
/*****************************************************************
Name:
Description: Load callback for LDT
Author: Mircea Petrescu
Date: 6/29/98
Modified:
*****************************************************************/
extern HREF g_hRefPO;
#define iPOGeneral_VS 0
#define iCSGeneral_ZDR 1
int CS_iLoadGeneral( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
PCS_tdxHandleToPhysicalCollSet _hCollideSet=( PCS_tdxHandleToPhysicalCollSet )pLink->pObject;
ACP_tdxHandleOfObject _hGeometricObject;
int iLen;
char sz_LongPathForLinkTable[256];
iLen=LDT_ComputeSectionName(pLink, sz_LongPathForLinkTable);
SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&CS_g_stLinkTable,sz_LongPathForLinkTable,(unsigned long)_hCollideSet),1,iLen);
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case 'RDZ' : /* ZDR */
{
_hGeometricObject = GLI_pLoadGeometricInFile( LDT_szGetParam( 1 ) );
LDT_AddToRefsTable( g_hRefPO, pLink, iCSGeneral_ZDR, 0); //1, (long)_hGeometricObject );
}
break;
case 'EDZ' : /* ZDE */
{
_hGeometricObject = GLI_pLoadGeometricInFile( LDT_szGetParam( 1 ) );
PCS_fn_vSetZdeGeoObjOfPhysicalCollSet(_hCollideSet,_hGeometricObject);
}
break;
case 'DDZ' : /* ZDD */
{
_hGeometricObject = GLI_pLoadGeometricInFile( LDT_szGetParam( 1 ) );
PCS_fn_vSetZddGeoObjOfPhysicalCollSet(_hCollideSet,_hGeometricObject);
}
break;
}
}
break;
case ParseResult_BeginSection: /* a subsection */
LDT_LoadSection( NULL );
}
}
return 0;
}
/*-----------------------------------------------------------------------------
/*-----------------------------------------------------------------------------
* Description : Used to register all script callback functions
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
void CS_fn_vRegisterAllScriptSections(void)
{
#if !defined(U64)
LDT_RegisterType( C_Section_CSGeneral, CS_iCreateGeneral, CS_iLoadGeneral, LDT_REG_SECTION );
#endif /* U64 */
}

View File

@@ -0,0 +1,139 @@
/*****************
loadCB.c
Ver 1.0
LDT version of
physical objects
loading
*****************/
#include "ldt.h"
#define PostProcessPriority_PO 10
/*****************************************************************
Name:
Description: Create callback for LDT
Author: Mircea Petrescu
Date: 6/29/98
Modified:
*****************************************************************/
int PO_iCreateGeneral( LDT_tdst_Link *pLink )
{
PO_tdxHandleToPhysicalObject _hPhysicalObject;
_hPhysicalObject = PO_fn_hAllocPhysicalObject();
pLink->pObject=(void *)_hPhysicalObject;
return 0;
}
/*****************************************************************
Name:
Description: Load callback for LDT
Author: Mircea Petrescu
Date: 6/29/98
Modified:
*****************************************************************/
HREF g_hRefPO;
#define iPOGeneral_VS 0
#define iCSGeneral_ZDR 1
int PO_iLoadGeneral( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
PO_tdxHandleToPhysicalObject _hPhysicalObject=( PO_tdxHandleToPhysicalObject )pLink->pObject;
char sFile[MAX_PATH], sParent[MAX_PATH], sAction[MAX_PATH], sIdent[MAX_PATH];
char sz_SectionNameForCS[MAX_PATH];
char sz_LongPathForLinkTable[MAX_PATH];
int iLen=LDT_ComputeSectionName(pLink,sz_LongPathForLinkTable);
SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&PO_g_stLinkTable,sz_LongPathForLinkTable,(unsigned long)_hPhysicalObject),1,iLen);
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(short *)szEntry)
{
case 'SV' : /* VS */
{
_hPhysicalObject->_hVisualSet = (GEO_tdxHandleToVisualSet)LDT_LoadSection( LDT_szGetParam( 1 ) );
LDT_AddToRefsTable( g_hRefPO, (void *)pLink, iPOGeneral_VS, 0 );
}
break;
case 'SC' : /* CS */
{
LDT_SplitSectionName( LDT_szGetParam( 1 ), sFile, sParent, sAction, sIdent);
strcpy(sz_SectionNameForCS,sFile);
strcat(sz_SectionNameForCS,"^");
strcat(sz_SectionNameForCS,C_Section_AllCollideSets);
strcat(sz_SectionNameForCS,":^");
if( sParent[0] )
{
strcat(sz_SectionNameForCS,sParent);
strcat(sz_SectionNameForCS,":");
}
strcat(sz_SectionNameForCS,sAction);
strcat(sz_SectionNameForCS,":");
strcat(sz_SectionNameForCS,sIdent);
_hPhysicalObject->_hCollideSet = (PCS_tdxHandleToPhysicalCollSet)LDT_LoadSection( sz_SectionNameForCS );
}
break;
case 'VB' : /* BV -bounding volume */
{
}
break;
}
}
}
}
return 0;
}
void PO_vPostProcessLDT( HREF hRef )
{
LDT_tdst_Link *pObject;
LDT_tdst_Link *pGetFrom;
int iType;
short xCount;
long *pVal;
while( LDT_GetRefFromTable( hRef, &pObject, &pGetFrom, &iType, &xCount, &pVal )==0 )
{
switch( iType )
{
case iPOGeneral_VS:
{
PO_tdxHandleToPhysicalObject _hPhysicalObject=( PO_tdxHandleToPhysicalObject )pObject->pObject;
HIE_fn_vComputeOnePoBoundingVolume(_hPhysicalObject);
}
break;
case iCSGeneral_ZDR:
{
ACP_tdxHandleOfObject _hGeometricObject=(ACP_tdxHandleOfObject)pGetFrom->pObject;
PCS_tdxHandleToPhysicalCollSet _hCollideSet=(PCS_tdxHandleToPhysicalCollSet)pObject->pObject;
COL_fn_bCreateOctree(_hGeometricObject,10,5,4);
PCS_fn_vSetZdrGeoObjOfPhysicalCollSet(_hCollideSet,_hGeometricObject);
}
break;
}
}
}
void PO_fn_vRegisterAllScriptSections(void)
{
LDT_RegisterType( C_Section_POGeneral, PO_iCreateGeneral, PO_iLoadGeneral, LDT_REG_SECTION );
g_hRefPO=LDT_RegisterSolver( PO_vPostProcessLDT, PostProcessPriority_PO );
}

View File

@@ -0,0 +1,162 @@
/*****************
loadCB.c
Ver 1.0
LDT version of
visual set loading
*****************/
#include "ldt.h"
/*****************************************************************
Name:
Description: Create callback for LDT
Author: Mircea Petrescu
Date: 6/30/98
Modified:
*****************************************************************/
int VS_iCreateGeneral( LDT_tdst_Link *pLink )
{
GEO_tdxHandleToVisualSet _hVisualSet;
GEO_M_CPAMalloc(_hVisualSet ,GEO_tdstVisualSet * ,sizeof ( GEO_tdstVisualSet ) ,E_uwGEONotEnoughtMemory );
pLink->pObject=(void *)_hVisualSet;
return 0;
}
/*****************************************************************
Name:
Description: Load callback for LDT
Author: Mircea Petrescu
Date: 6/30/98
Modified:
*****************************************************************/
int VS_iLoadGeneral( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
GEO_tdxHandleToVisualSet _hVisualSet=( GEO_tdxHandleToVisualSet )pLink->pObject;
ACP_tdxIndex xLodCounter;
GEO_tdstVisualSet *p_stLocalVS=(GEO_tdstVisualSet *)_hVisualSet;
long lNbLOD=atol( LDT_szGetParam( 1 ) );
char sz_LongPathForLinkTable[256];
int iLen;
iLen=LDT_ComputeSectionName(pLink,sz_LongPathForLinkTable);
SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&VS_g_stLinkTable,sz_LongPathForLinkTable,(unsigned long)p_stLocalVS),1,iLen);
GEO_M_CPAMalloc(p_stLocalVS -> d_xThresholdsTable ,MTH_tdxReal *,sizeof ( MTH_tdxReal ) * lNbLOD,E_uwGEONotEnoughtMemory );
GEO_M_CPAMalloc(p_stLocalVS -> d_p_stLodDefinitions ,GEO_tdstGeometricObject ** ,sizeof ( GEO_tdstGeometricObject * ) * lNbLOD,E_uwGEONotEnoughtMemory );
p_stLocalVS -> xNbLodDefinitions = (ACP_tdxIndex)lNbLOD;
for (xLodCounter = 0;
xLodCounter < lNbLOD;
xLodCounter ++)
{
p_stLocalVS -> d_xThresholdsTable[xLodCounter] = 0.0;
p_stLocalVS -> d_p_stLodDefinitions[xLodCounter] = NULL;
}
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_BeginSection: /* a subsection */
{
LDT_SetFileLong( 8, (long)_hVisualSet );
LDT_SetFileLong( 9, (long)(atoi( LDT_szGetSectionName() )-1 ) );
LDT_SetFileDouble( 7, (double)0.0 );
LDT_LoadSection( NULL );
}
}
}
return 0;
}
/*****************************************************************
Name:
Description: Create callback for LDT
Author: Mircea Petrescu
Date: 6/30/98
Modified:
*****************************************************************/
int VS_iCreateLOD( LDT_tdst_Link *pLink )
{
return 0;
}
/*****************************************************************
Name:
Description: Load callback for LDT
Author: Mircea Petrescu
Date: 6/30/98
Modified:
*****************************************************************/
int VS_iLoadLOD( LDT_tdst_Link *pLink )
{
GEO_tdxHandleToVisualSet _hVisualSet=(GEO_tdxHandleToVisualSet)LDT_GetFileLong( 8 );
ACP_tdxHandleOfObject _hGeometricObject;
long l_NumberOfLOD=LDT_GetFileLong( 9 );
MTH_tdxReal xThreshold=(MTH_tdxReal)LDT_GetFileDouble( 7 );
LDT_tdeParseResult result=ParseResult_BeginSection;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)(szEntry+6))
{
case 'hser' : /* LOD_Threshold */
{
xThreshold=(MTH_tdxReal)atof( LDT_szGetParam( 1 ) );
}
break;
case 'DOMr' : /* FichierMOD */
{
_hGeometricObject = GLI_pLoadGeometricInFile(LDT_szGetParam( 1 ));
GLI_vSetVisualSetLOD(_hVisualSet,l_NumberOfLOD,xThreshold,_hGeometricObject);
}
break;
case 'ILRr' : /* FichierRLI */
{
long lNumberOfTable ;
ACP_tdxHandleToRadiosity *d_hRLI ;
d_hRLI = GLI_vVisualSetLoadRLI ( LDT_szGetParam( 1 ), &lNumberOfTable ) ;
GLI_vVisualSetSetRLITable(_hVisualSet, d_hRLI, lNumberOfTable) ;
}
break;
}
}
}
}
return 0;
}
/*-----------------------------------------------------------------------------
* Description : Used to register all script callback functions
*-----------------------------------------------------------------------------
* Creation date : 05/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
void VS_fn_vRegisterAllScriptSections(void)
{
LDT_RegisterType( C_Section_VSGeneral, VS_iCreateGeneral, VS_iLoadGeneral, LDT_REG_SECTION );
LDT_RegisterType( C_SubSection_LOD, VS_iCreateLOD, VS_iLoadLOD, LDT_REG_SECTION );
}