reman3/Rayman_X/cpa/tempgrp/GliGlou/MultiDRV/Src/load.c

1681 lines
70 KiB
C
Raw Blame History

/**************
LOAD.C
Ver 2.1
***************/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <assert.h>
#include "cpa_std.h"
#include "Acp_Base.h"
#include "GLD.h"
#include "GLI_st.h"
#include "vertex.h"
#include "GLI_Defn.h"
#include "material.h"
#include "load.h"
#include "textu_st.h"
#include "texture.h"
#include "TexProcedural.h"
#include "ErrGEO.h"
#include "MmgGEO.h"
#include "LinkTab.h"
#include "scr.h"
#include "TEX.h"
#include "GEO.h"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#ifdef __cplusplus
extern "C"
{
#endif
char szTexturePath[_MAX_PATH];
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
extern float fScale;
extern BOOL g_bLoadMap;
FILE *dump = NULL;
#endif //U64CONVERTLOG
// } fin N64-format
/*
=======================================================================================
Access function to texture path
=======================================================================================
*/
/********************************************************************
Set the texture's path
*********************************************************************/
void GLI_vSetPathOfTexture(char *szLoadPath)
{
long len;
assert(szLoadPath != NULL);
len = sprintf(szTexturePath,"%s",szLoadPath);
if( (szTexturePath[len-1] == '\\') || (szTexturePath[len-1] == '/') )
szTexturePath[len-1] = 0;
}
/********************************************************************
Get the texture's path by copy
*********************************************************************/
void GLI_vGetPathOfTexture(char *szLoadPath)
{
assert(szLoadPath != NULL);
strcpy(szLoadPath, szTexturePath);
}
/********************************************************************
Get the texture's path by pointer
*********************************************************************/
char *GLI_fn_szGetPathOfTexture(void)
{
return(szTexturePath);
}
/********************************************************************
Build texture file name
*********************************************************************/
BOOL GLI_bGetTextureName(char *szName, char *szTexture)
{
sprintf(szTexture,"%s/%s",szTexturePath,szName);
return (TRUE);
}
/*
=======================================================================================
callback to load object elements
=======================================================================================
*/
/********************************************************************
Load an indexed triangle element
*********************************************************************/
SCR_tde_Anl_ReturnValue GLI_xLoadElementIndexedTriangles(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
long xIndex;
GEO_tdstElementIndexedTriangles *p_stElement;
char a255_cLongName[255];
switch (cType)
{
case SCR_EA_Anl_BeginSection:
p_stElement = GEO_p_stAllocElementIndexedTriangles( (ACP_tdxIndex)atoi(szParams[0]), (ACP_tdxIndex)atoi(szParams[1]) );
SCR_M_RdL0_SetSectionLong(0,0,(long)p_stElement);
SCR_M_RdL0_SetContextLong(0,0,(long)p_stElement);
SCR_M_RdL0_ComputeOpenSectionNameR(0, a255_cLongName);
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfElementIndexedTriangle(), a255_cLongName, (unsigned long)p_stElement),
1,strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0))
);
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
if (g_bLoadMap)
{
fprintf (dump,"===================================================================\n");
fprintf (dump,"%s\n",a255_cLongName);
fflush(dump);
}
#endif //U64CONVERTLOG
// } fin N64-format
break;
case SCR_EA_Anl_Entry:
/* Recuperation du p_stElement a remplir*/
SCR_M_RdL0_GetContextLong(0,0,GEO_tdstElementIndexedTriangles*,p_stElement);
/* Loading of Face*/
if (strcmp(szAction,"AddFaceUV")==0)
{
xIndex = (long)atoi(szParams[0]);
p_stElement->d_stListOfFacesTripled[xIndex].a3_xIndex[0]=(ACP_tdxIndex)(atoi(szParams[1]));
p_stElement->d_stListOfFacesTripled[xIndex].a3_xIndex[1]=(ACP_tdxIndex)(atoi(szParams[2]));
p_stElement->d_stListOfFacesTripled[xIndex].a3_xIndex[2]=(ACP_tdxIndex)(atoi(szParams[3]));
MTH3D_M_vSetVectorElements
(
(p_stElement->d_stListOfFacesNormals+xIndex), MTH_M_xDoubleToReal(atof(szParams[4])),
MTH_M_xDoubleToReal(atof(szParams[5])), MTH_M_xDoubleToReal(atof(szParams[6]))
);
/* if (g_bLoadMap)
{
// round u64
(p_stElement->d_stListOfFacesNormals+xIndex)->xX = (float) (( (long)( ((p_stElement->d_stListOfFacesNormals+xIndex)->xX*fScale) + 0.5) ) / fScale);
(p_stElement->d_stListOfFacesNormals+xIndex)->xY = (float) (( (long)( ((p_stElement->d_stListOfFacesNormals+xIndex)->xY*fScale) + 0.5) ) / fScale);
(p_stElement->d_stListOfFacesNormals+xIndex)->xZ = (float) (( (long)( ((p_stElement->d_stListOfFacesNormals+xIndex)->xZ*fScale) + 0.5) ) / fScale);
fprintf (dump,"loaded face normal %03d : x=%f,y=%f,z=%f\n",xIndex,(p_stElement->d_stListOfFacesNormals+xIndex)->xX,(p_stElement->d_stListOfFacesNormals+xIndex)->xY,(p_stElement->d_stListOfFacesNormals+xIndex)->xZ);
fflush(dump);
}
*/
p_stElement->d_stListOfFacesTripledIndexUV[xIndex].a3_xIndex[0]=(ACP_tdxIndex)(atoi(szParams[7]));
p_stElement->d_stListOfFacesTripledIndexUV[xIndex].a3_xIndex[1]=(ACP_tdxIndex)(atoi(szParams[8]));
p_stElement->d_stListOfFacesTripledIndexUV[xIndex].a3_xIndex[2]=(ACP_tdxIndex)(atoi(szParams[9]));
}
else if (strcmp(szAction,"AddFace")==0)
{
xIndex = (long)atoi(szParams[0]);
p_stElement->d_stListOfFacesTripled[xIndex].a3_xIndex[0]=(ACP_tdxIndex)(atoi(szParams[1]));
p_stElement->d_stListOfFacesTripled[xIndex].a3_xIndex[1]=(ACP_tdxIndex)(atoi(szParams[2]));
p_stElement->d_stListOfFacesTripled[xIndex].a3_xIndex[2]=(ACP_tdxIndex)(atoi(szParams[3]));
MTH3D_M_vSetVectorElements
(
(p_stElement->d_stListOfFacesNormals+xIndex),MTH_M_xDoubleToReal(atof(szParams[4])),
MTH_M_xDoubleToReal(atof(szParams[5])),MTH_M_xDoubleToReal(atof(szParams[6]))
);
p_stElement->d_stListOfFacesTripledIndexUV[xIndex].a3_xIndex[0]=(long)(0);
p_stElement->d_stListOfFacesTripledIndexUV[xIndex].a3_xIndex[1]=(long)(0);
p_stElement->d_stListOfFacesTripledIndexUV[xIndex].a3_xIndex[2]=(long)(0);
}
else if (strcmp(szAction,"GetFaces")==0)
{
GEO_tdstElementIndexedTriangles *p_stTemp;
SCR_tdst_Cxt_Values *p_stVal;
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[0], SCR_CDF_uw_Anl_Normal);
p_stTemp = (GEO_tdstElementIndexedTriangles*)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
assert(p_stTemp != NULL);
GEO_M_CPAFree(p_stElement->d_stListOfFacesTripled);
GEO_M_CPAFree(p_stElement->d_stListOfFacesNormals);
GEO_M_CPAFree(p_stElement->d_stListOfFacesTripledIndexUV);
p_stElement->d_stListOfFacesTripled = p_stTemp->d_stListOfFacesTripled;
p_stElement->d_stListOfFacesNormals = p_stTemp->d_stListOfFacesNormals;
p_stElement->d_stListOfFacesTripledIndexUV = p_stTemp->d_stListOfFacesTripledIndexUV;
}
else if (strcmp(szAction,"AddUV")==0)
{
xIndex = (long)atoi(szParams[0]);
p_stElement->d_stListOfElementUV[xIndex].xU=(GLI_tdxUVValue)(atof(szParams[1]));
p_stElement->d_stListOfElementUV[xIndex].xV=(GLI_tdxUVValue)(atof(szParams[2]));
}
else if (strcmp(szAction,"GetUVs")==0)
{
GEO_tdstElementIndexedTriangles *p_stTemp;
SCR_tdst_Cxt_Values *p_stVal;
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[0], SCR_CDF_uw_Anl_Normal);
p_stTemp = (GEO_tdstElementIndexedTriangles*)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
assert(p_stTemp != NULL);
GEO_M_CPAFree(p_stElement->d_stListOfElementUV);
p_stElement->d_stListOfElementUV = p_stTemp->d_stListOfElementUV;
}
else if( (strcmp(szAction,"Material")==0) || (strcmp (szAction,"PointedSector")==0) )
{
SCR_tdst_Cxt_Values *p_stVal;
char sFile[256], sAction[256], sIdent[256];
/* Sector*/
if(strcmp(szAction,"PointedSector") == 0)
{
SCR_tdst_Link_Value *p_stRemoveValue;
/* Add the element into a special list of frontier elements */
SCR_M_RdL0_ComputeOpenSectionNameR(0, a255_cLongName);
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfFrontierElement(), a255_cLongName, (unsigned long)p_stElement),
1, strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0))
);
/* Remove it from the normal list of indexed triangles */
p_stRemoveValue=SCR_fnp_st_Link_SearchValue(GLI_p_stGetLinkTableOfElementIndexedTriangle(), (unsigned long)p_stElement);
SCR_fn_v_Link_DeleteEntry(GLI_p_stGetLinkTableOfElementIndexedTriangle(),p_stRemoveValue);
/* Analyse the pointed sector */
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[0], SCR_CDF_uw_Anl_Normal);
p_stElement->hMaterial = (GMT_tdxHandleToGameMaterial)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
}
else
{
SCR_fn_v_RdL0_SplitSectionName(szParams[0], sFile, sAction, sIdent);
if(strcmp(sAction,"Material") == 0)
{
/* material */
ACP_tdxHandleOfMaterial hMat;
GMT_tdxHandleToGameMaterial hGameMat;
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[0], SCR_CDF_uw_Anl_Normal);
hMat = (ACP_tdxHandleOfMaterial)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
hGameMat = GMT_fn_hCreateGameMaterial();
GMT_fn_vSetVisualMaterial(hGameMat, hMat);
p_stElement->hMaterial = hGameMat;
}
else
{
/* game material */
p_stElement->hMaterial=GMT_fn_hLoadGameMaterial(szParams[0]);
}
}
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/********************************************************************
Load a TMesh element
*********************************************************************/
SCR_tde_Anl_ReturnValue GLI_xLoadElementTMeshes(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
return SCR_ERV_Anl_NormalReturn;
}
/********************************************************************
Load a FaceMapDescriptor element
*********************************************************************/
SCR_tde_Anl_ReturnValue GLI_xLoadElementFaceMapDescriptors(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
long xIndex;
GEO_tdstElementFaceMapDescriptors *p_stElement;
char a255_cLongName[255];
switch (cType)
{
case SCR_EA_Anl_BeginSection:
p_stElement = GEO_p_stAllocElementFaceMap( (ACP_tdxIndex)atoi(szParams[0]) );
SCR_M_RdL0_SetSectionLong(0,0,(long)p_stElement);
SCR_M_RdL0_SetContextLong(0,0,(long)p_stElement);
SCR_M_RdL0_ComputeOpenSectionNameR(0, a255_cLongName);
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfElementFaceMapDescriptor(), a255_cLongName, (unsigned long)p_stElement),
1, strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0))
);
break;
case SCR_EA_Anl_Entry:
/* Recuperation du p_stElement a remplir*/
SCR_M_RdL0_GetContextLong(0,0,GEO_tdstElementFaceMapDescriptors*,p_stElement);
/* Loading of Face*/
if (strcmp(szAction,"AddFaceFMD")==0)
{
ACP_tdxHandleOfFMD hFaceMapDescriptor;
SCR_tdst_Cxt_Values *p_stVal;
xIndex = (long)atoi(szParams[0]);
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[7], SCR_CDF_uw_Anl_Normal);
hFaceMapDescriptor = (ACP_tdxHandleOfFMD)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
assert(hFaceMapDescriptor != NULL);
p_stElement->d_stListOfFacesQuadrupled[xIndex].stFaceTripled.a3_xIndex[0]=(ACP_tdxIndex)(atoi(szParams[1]));
p_stElement->d_stListOfFacesQuadrupled[xIndex].stFaceTripled.a3_xIndex[1]=(ACP_tdxIndex)(atoi(szParams[2]));
p_stElement->d_stListOfFacesQuadrupled[xIndex].stFaceTripled.a3_xIndex[2]=(ACP_tdxIndex)(atoi(szParams[3]));
p_stElement->d_stListOfFacesQuadrupled[xIndex].hFaceMapDescriptor = hFaceMapDescriptor;
MTH3D_M_vSetVectorElements((p_stElement->d_stListOfFacesNormals+xIndex), MTH_M_xDoubleToReal(atof(szParams[4])), MTH_M_xDoubleToReal(atof(szParams[5])), MTH_M_xDoubleToReal(atof(szParams[6])) );
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/********************************************************************
Load a sprite element
*********************************************************************/
SCR_tde_Anl_ReturnValue GLI_xLoadElementSprites(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
long xIndex;
GEO_tdstElementSprite *p_stElement;
char a255_cLongName[255];
switch (cType)
{
case SCR_EA_Anl_BeginSection:
p_stElement = GEO_p_stAllocElementSprite( (ACP_tdxIndex)atoi(szParams[0]) );
SCR_M_RdL0_SetSectionLong(0,0,(long)p_stElement);
SCR_M_RdL0_SetContextLong(0,0,(long)p_stElement);
SCR_M_RdL0_ComputeOpenSectionNameR(0, a255_cLongName);
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfElementSprite(), a255_cLongName, (unsigned long)p_stElement),
1, strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0))
);
break;
case SCR_EA_Anl_Entry:
/* Recuperation du p_stElement a remplir*/
SCR_M_RdL0_GetContextLong(0,0,GEO_tdstElementSprite*,p_stElement)
/* Loading of Face*/
if (strcmp(szAction,"AddSprite")==0)
{
ACP_tdxHandleOfSprite hSprite;
SCR_tdst_Cxt_Values *p_stVal;
xIndex = (long)atoi(szParams[0]);
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[4], SCR_CDF_uw_Anl_Normal);
hSprite = (ACP_tdxHandleOfSprite)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
assert(hSprite != NULL);
p_stElement->d_stListOfSprites[xIndex].xCenterPoint=(ACP_tdxIndex)(atoi(szParams[1]));
p_stElement->d_stListOfSprites[xIndex].stSize.xX=(MTH_tdxReal)(atof(szParams[2]));
p_stElement->d_stListOfSprites[xIndex].stSize.xY=(MTH_tdxReal)(atof(szParams[3]));
p_stElement->d_stListOfSprites[xIndex].hSprite=hSprite;
}
else if (strcmp(szAction,"AddRotationAxe")==0)
{
xIndex = (long)atoi(szParams[0]);
p_stElement->d_stListOfSprites[xIndex].stAxe.xX = (MTH_tdxReal)(atof(szParams[1]));
p_stElement->d_stListOfSprites[xIndex].stAxe.xY = (MTH_tdxReal)(atof(szParams[2]));
p_stElement->d_stListOfSprites[xIndex].stAxe.xZ = (MTH_tdxReal)(atof(szParams[3]));
}
else if (strcmp(szAction,"AddUV")==0)
{
xIndex = (long)atoi(szParams[0]);
p_stElement->d_stListOfSprites[xIndex].stUVpos.xU = (MTH_tdxReal)(atof(szParams[1]));
p_stElement->d_stListOfSprites[xIndex].stUVpos.xV = (MTH_tdxReal)(atof(szParams[2]));
p_stElement->d_stListOfSprites[xIndex].stUVsize.xU = (MTH_tdxReal)(atof(szParams[3]));
p_stElement->d_stListOfSprites[xIndex].stUVsize.xV = (MTH_tdxReal)(atof(szParams[4]));
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/********************************************************************
Load a line element
*********************************************************************/
SCR_tde_Anl_ReturnValue GLI_xLoadElementLines(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
long xIndex;
GEO_tdstElementLines *p_stElement;
char a255_cLongName[255];
switch (cType)
{
case SCR_EA_Anl_BeginSection:
p_stElement = GEO_p_stAllocElementLines( (ACP_tdxIndex)atoi(szParams[0]) );
SCR_M_RdL0_SetSectionLong(0,0,(long)p_stElement);
SCR_M_RdL0_SetContextLong(0,0,(long)p_stElement);
SCR_M_RdL0_ComputeOpenSectionNameR(0, a255_cLongName);
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfElementLine(), a255_cLongName, (unsigned long)p_stElement),
1, strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0))
);
break;
case SCR_EA_Anl_Entry:
/* Recuperation du p_stElement a remplir*/
SCR_M_RdL0_GetContextLong(0,0,GEO_tdstElementLines*,p_stElement);
/* Loading of Line*/
if (strcmp(szAction,"AddLine")==0)
{
xIndex = (long)atoi(szParams[0]);
p_stElement->d_stListOfLineIndex[xIndex].a2_xIndex[0]=(ACP_tdxIndex)(atoi(szParams[1]));
p_stElement->d_stListOfLineIndex[xIndex].a2_xIndex[1]=(ACP_tdxIndex)(atoi(szParams[2]));
}
else if (strcmp(szAction,"GetLines")==0)
{
GEO_tdstElementLines *p_stTemp;
SCR_tdst_Cxt_Values *p_stVal;
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[0], SCR_CDF_uw_Anl_Normal);
p_stTemp = (GEO_tdstElementLines*)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
assert(p_stTemp != NULL);
GEO_M_CPAFree(p_stElement->d_stListOfLineIndex);
p_stElement->d_stListOfLineIndex = p_stTemp->d_stListOfLineIndex;
}
else if (strcmp(szAction,"Thickness")==0)
{
p_stElement->xThickness = (MTH_tdxReal)(atof(szParams[0]));
}
else if (strcmp(szAction,"GetThickness")==0)
{
GEO_tdstElementLines *p_stTemp;
SCR_tdst_Cxt_Values *p_stVal;
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[0], SCR_CDF_uw_Anl_Normal);
p_stTemp = (GEO_tdstElementLines*)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
assert(p_stTemp != NULL);
p_stElement->xThickness = p_stTemp->xThickness;
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/********************************************************************
Load a sphere element
*********************************************************************/
SCR_tde_Anl_ReturnValue GLI_xLoadElementSpheres(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
long xIndex;
GEO_tdstElementSpheres *p_stElement;
char a255_cLongName[255];
switch (cType)
{
case SCR_EA_Anl_BeginSection:
p_stElement = GEO_p_stAllocElementSpheres( (ACP_tdxIndex)atoi(szParams[0]) );
SCR_M_RdL0_SetSectionLong(0,0,(long)p_stElement);
SCR_M_RdL0_SetContextLong(0,0,(long)p_stElement);
SCR_M_RdL0_ComputeOpenSectionNameR(0, a255_cLongName);
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfElementSphere(), a255_cLongName, (unsigned long)p_stElement),
1, strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0))
);
break;
case SCR_EA_Anl_Entry:
/* Recuperation du p_stElement a remplir*/
SCR_M_RdL0_GetContextLong(0,0,GEO_tdstElementSpheres*,p_stElement);
/* Loading of Face*/
if (strcmp(szAction,"AddSphere")==0)
{
GMT_tdxHandleToGameMaterial hMaterial;
xIndex = (long)atoi(szParams[0]);
hMaterial=GMT_fn_hLoadGameMaterial(szParams[3]);
assert(hMaterial != NULL);
p_stElement->d_stListOfSpheres[xIndex].xCenterPoint=(ACP_tdxIndex)(atoi(szParams[1]));
p_stElement->d_stListOfSpheres[xIndex].xRadius=(MTH_tdxReal)(GLI_dGetUnitInMeterInFile(p_fFile->a_szOpenFileName)*atof(szParams[2]));
p_stElement->d_stListOfSpheres[xIndex].hMaterial = hMaterial;
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/********************************************************************
Load alignedbox element
*********************************************************************/
SCR_tde_Anl_ReturnValue GLI_xLoadElementAlignedBoxes(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
long xIndex;
GEO_tdstElementAlignedBoxes *p_stElement;
char a255_cLongName[255];
switch (cType)
{
case SCR_EA_Anl_BeginSection:
p_stElement = GEO_p_stAllocElementAlignedBoxes( (ACP_tdxIndex)atoi(szParams[0]) );
SCR_M_RdL0_SetSectionLong(0,0,(long)p_stElement);
SCR_M_RdL0_SetContextLong(0,0,(long)p_stElement);
SCR_M_RdL0_ComputeOpenSectionNameR(0, a255_cLongName);
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfElementAlignedBoxe(), a255_cLongName, (unsigned long)p_stElement),
1, strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0))
);
break;
case SCR_EA_Anl_Entry:
/* Recuperation du p_stElement a remplir*/
SCR_M_RdL0_GetContextLong(0,0,GEO_tdstElementAlignedBoxes*,p_stElement);
/* Loading of Line*/
if (strcmp(szAction,"AddAlignedBox")==0)
{
GMT_tdxHandleToGameMaterial hMaterial;
xIndex = (long)atoi(szParams[0]);
hMaterial=GMT_fn_hLoadGameMaterial(szParams[3]);
assert(hMaterial != NULL);
p_stElement->d_stListOfAlignedBoxes[xIndex].xMinPoint=(ACP_tdxIndex)(atoi(szParams[1]));
p_stElement->d_stListOfAlignedBoxes[xIndex].xMaxPoint=(ACP_tdxIndex)(atoi(szParams[2]));
p_stElement->d_stListOfAlignedBoxes[xIndex].hMaterial = hMaterial;
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/********************************************************************
Load Point element
*********************************************************************/
SCR_tde_Anl_ReturnValue GLI_xLoadElementPoints(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
ACP_tdxIndex xIndex;
GEO_tdstElementPoints *p_stElement;
char a255_cLongName[255];
switch (cType)
{
case SCR_EA_Anl_BeginSection:
p_stElement = GEO_p_stAllocElementPoints( (ACP_tdxIndex)atoi(szParams[0]) );
SCR_M_RdL0_SetSectionLong(0,0,(long)p_stElement);
SCR_M_RdL0_SetContextLong(0,0,(long)p_stElement);
SCR_M_RdL0_ComputeOpenSectionNameR(0, a255_cLongName);
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfElementPoint(), a255_cLongName, (unsigned long)p_stElement),
1, strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0))
);
break;
case SCR_EA_Anl_Entry:
/* Recuperation du p_stElement a remplir*/
SCR_M_RdL0_GetContextLong(0,0,GEO_tdstElementPoints*,p_stElement);
/* Loading of Line*/
if (strcmp(szAction,"AddPoint")==0)
{
xIndex = (ACP_tdxIndex)atoi(szParams[0]);
p_stElement->d_xListOfPointIndex[xIndex]=(ACP_tdxIndex)(atoi(szParams[1]));
}
else if (strcmp(szAction,"GetPoints")==0)
{
GEO_tdstElementPoints *p_stTemp;
SCR_tdst_Cxt_Values *p_stVal;
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[0], SCR_CDF_uw_Anl_Normal);
p_stTemp = (GEO_tdstElementPoints*)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
assert(p_stTemp != NULL);
GEO_M_CPAFree(p_stElement->d_xListOfPointIndex);
p_stElement->d_xListOfPointIndex = p_stTemp->d_xListOfPointIndex;
}
else if (strcmp(szAction,"Fatness")==0)
{
p_stElement->xFatness = (MTH_tdxReal)(atof(szParams[0]));
}
else if (strcmp(szAction,"GetFatness")==0)
{
GEO_tdstElementPoints *p_stTemp;
SCR_tdst_Cxt_Values *p_stVal;
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[0], SCR_CDF_uw_Anl_Normal);
p_stTemp = (GEO_tdstElementPoints*)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
assert(p_stTemp != NULL);
p_stElement->xFatness = p_stTemp->xFatness;
}
else if( strcmp(szAction,"GameMaterial")==0 )
{
p_stElement->hMaterial = GMT_fn_hLoadGameMaterial(szParams[0]);
if( GMT_fn_hGetVisualMaterial(p_stElement->hMaterial)==NULL )
{
ACP_tdxHandleOfMaterial hVisualMat;
GLI_xCreateMaterial(&hVisualMat);
GMT_fn_vSetVisualMaterial(p_stElement->hMaterial,hVisualMat);
}
}
break;
case SCR_EA_Anl_EndSection:
SCR_M_RdL0_GetContextLong(0,0,GEO_tdstElementPoints*,p_stElement);
if( p_stElement->hMaterial==NULL )
{
ACP_tdxHandleOfMaterial hVisualMat;
p_stElement->hMaterial=GMT_fn_hCreateGameMaterial();
GLI_xCreateMaterial(&hVisualMat);
GMT_fn_vSetVisualMaterial(p_stElement->hMaterial,hVisualMat);
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/********************************************************************
Load a Cone Element
*********************************************************************/
SCR_tde_Anl_ReturnValue GLI_xLoadElementCones(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
long xIndex;
GEO_tdstElementCones *p_stElement;
char a255_cLongName[255];
switch (cType)
{
case SCR_EA_Anl_BeginSection:
p_stElement = GEO_p_stAllocElementCones( (ACP_tdxIndex)atoi(szParams[0]) );
SCR_M_RdL0_SetSectionLong(0,0,(long)p_stElement);
SCR_M_RdL0_SetContextLong(0,0,(long)p_stElement);
SCR_M_RdL0_ComputeOpenSectionNameR(0, a255_cLongName);
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfElementCone(), a255_cLongName, (unsigned long)p_stElement),
1, strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0))
);
break;
case SCR_EA_Anl_Entry:
/* Recuperation du p_stElement a remplir*/
SCR_M_RdL0_GetContextLong(0,0,GEO_tdstElementCones*,p_stElement);
/* Loading of Line*/
if (strcmp(szAction,"AddCone")==0)
{
GMT_tdxHandleToGameMaterial hMaterial;
SCR_tdst_Cxt_Values *p_stVal;
xIndex = (long)atoi(szParams[0]);
if(SCR_fn_uc_RdL0_GetNumberOfParameters(szParams) == 5)
{
if(strstr(szParams[4],"GameMaterial") == NULL) /* VisualMaterial*/
{
ACP_tdxHandleOfMaterial hMat;
GMT_tdxHandleToGameMaterial hGameMat;
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[4], SCR_CDF_uw_Anl_Normal);
hMat = (ACP_tdxHandleOfMaterial)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
hGameMat = GMT_fn_hCreateGameMaterial();
GMT_fn_vSetVisualMaterial(hGameMat, hMat);
hMaterial = hGameMat;
}
else
hMaterial = GMT_fn_hLoadGameMaterial(szParams[4]);
assert(hMaterial != NULL);
}
else
hMaterial = NULL;
p_stElement->d_stListOfCones[xIndex].xTopPoint=(ACP_tdxIndex)(atoi(szParams[1]));
p_stElement->d_stListOfCones[xIndex].xBasePoint=(ACP_tdxIndex)(atoi(szParams[2]));
p_stElement->d_stListOfCones[xIndex].xBaseRadius=MTH_M_xDoubleToReal(atof(szParams[3]) * GLI_dGetUnitInMeterInFile(p_fFile->a_szOpenFileName));
p_stElement->d_stListOfCones[xIndex].hMaterial = hMaterial;
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/********************************************************************
Load a visual material
*********************************************************************/
SCR_tde_Anl_ReturnValue GLI_xLoadMaterial(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
ACP_tdxHandleOfMaterial hVisualMat;
GEO_tdstColor stColor;
long localType;
char a255_cLongName[255];
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
switch (cType)
{
case SCR_EA_Anl_BeginSection:
GLI_xCreateMaterial(&hVisualMat);
SCR_M_RdL0_SetSectionLong(0,0,(long)hVisualMat);
SCR_M_RdL0_SetContextLong(0,0,(long)hVisualMat);
SCR_M_RdL0_ComputeOpenSectionNameR(0, a255_cLongName);
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfVisualMaterial(), a255_cLongName, (unsigned long)hVisualMat),
1, strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0))
);
/*GLI_vSetMaterialName ( hVisualMat, szAction);*/
break;
case SCR_EA_Anl_Entry:
/* Recuperation du materiau a remplir*/
SCR_M_RdL0_GetContextLong(0,0,ACP_tdxHandleOfMaterial,hVisualMat);
/* Loading of material type*/
if (strcmp(szAction,"Type")==0)
{
if(strcmp(szParams[0], "Gouraud")==0)
GLI_xSetMaterialType(hVisualMat, C_lGouraudElement);
else if(strcmp(szParams[0], "Flat")==0)
GLI_xSetMaterialType(hVisualMat, C_lGouraudElement - GLI_C_lIsGouraud);
else if(strcmp(szParams[0], "GouraudAlpha")==0)
GLI_xSetMaterialType(hVisualMat, C_lGouraudElement - GLI_C_lIsNotGrided - GLI_C_lIsNotLightAlphaSensitive);
else if(strcmp(szParams[0], "Transparent")==0)
GLI_xSetMaterialType(hVisualMat, C_lGouraudElement - GLI_C_lIsNotGrided );
}
else if (strcmp(szAction,"AmbientColor")==0)
{
stColor.xR = (float)atof(szParams[0]);
stColor.xG = (float)atof(szParams[1]);
stColor.xB = (float)atof(szParams[2]);
stColor.xA = (szParams[3]) ? (float)atof(szParams[3]) : 1.0f;
GLI_xSetMaterialAmbientCoef(hVisualMat, &stColor);
}
else if (strcmp(szAction,"DiffuseColor")==0)
{
stColor.xR = (float)atof(szParams[0]);
stColor.xG = (float)atof(szParams[1]);
stColor.xB = (float)atof(szParams[2]);
stColor.xA = (szParams[3]) ? (float)atof(szParams[3]) : 1.0f;
GLI_xSetMaterialDiffuseCoef(hVisualMat, &stColor);
}
else if (strcmp(szAction,"SpecularColor")==0)
{
stColor.xR = (float)atof(szParams[0]);
stColor.xG = (float)atof(szParams[1]);
stColor.xB = (float)atof(szParams[2]);
stColor.xA = (szParams[3]) ? (float)atof(szParams[3]) : 1.0f;
GLI_xSetMaterialSpecularCoef( hVisualMat, (szParams[4]) ? atol(szParams[4]) : 100, &stColor );
}
else if (strcmp(szAction,"Texture")==0)
{
char a_cFullName[255];
GLI_tdstTexture *p_stTexture;
if( GLI_bGetTextureName(szParams[0], a_cFullName) )
{
long localType;
#ifdef EXGEOM_APPLI
{
char szRealName[ _MAX_PATH ];
extern long EXGEOM_TEX_fnl_FindTexture( char *, char *);
if (EXGEOM_TEX_fnl_FindTexture( szParams[0], szRealName ) )
GLI_xLoadTexture(&p_stTexture,NULL,szRealName,0,0);
else
GLI_xLoadTexture(&p_stTexture,NULL,szParams[0],0,0);
}
#else
GLI_xLoadTexture(&p_stTexture,NULL,szParams[0],0,0);
#endif
if (p_stTexture==NULL)
{
GLI_xSetMaterialType(hVisualMat, C_lGouraudElement);
break;
}
if (szParams[1] && szParams[2])
{
GLI_xSetMaterialTextureScrollingCoef( hVisualMat , 0 , 1 , (float)atof(szParams[1]),(float)atof(szParams[2]));
}
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfTexture(), a_cFullName, (unsigned long)p_stTexture),
1, strlen(a_cFullName) - strlen(szParams[0])
);
GLI_xGetMaterialType(hVisualMat, &localType);
localType |= GLI_C_lIsTextured;
GLI_xSetMaterialType(hVisualMat, localType);
GLI_xSetMaterialTexture(hVisualMat, p_stTexture);
}
}
else if (strcmp(szAction,"Scroll")==0)
{
GLI_xSetMaterialTextureScrollingCoef( hVisualMat , 0 , 1 , (float)atof(szParams[1]),(float)atof(szParams[2]));
}
else if (strcmp(szAction,"Texture1")==0)
{
char a_cFullName[255];
char a_cFullNameMipMap[255];
long lNbLoD,lLodCounter;
GLI_tdstTexture *p_stTexture;
if( GLI_bGetTextureName(szParams[0], a_cFullName) )
{
GLI_xLoadTexture(&p_stTexture,NULL,szParams[0],0,atol(szParams[1]));
if (p_stTexture==NULL)
{
GLI_xSetMaterialType(hVisualMat, C_lGouraudElement);
break;
}
if (strcmp(szParams[2],"AUTO") == 0)
{
GLI_vComputeLod(p_stTexture);
}
else
{
if (atol(szParams[2])>0)
{
lNbLoD = atol(szParams[2]);
for (lLodCounter = 0 ; lLodCounter < lNbLoD ; lLodCounter ++ )
{
if (GLI_bGetTextureName(szParams[lLodCounter + 3], a_cFullNameMipMap))
GLI_vLoadLodAndAddItToTexture(p_stTexture,NULL,szParams[lLodCounter + 3],0,0);
}
}
}
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfTexture(), a_cFullName, (unsigned long)p_stTexture),
1, strlen(a_cFullName) - strlen(szParams[0])
);
GLI_xGetMaterialType(hVisualMat, &localType);
localType |= GLI_C_lIsTextured;
GLI_xSetMaterialType(hVisualMat, localType);
GLI_xSetMaterialTexture(hVisualMat, p_stTexture);
}
}
else if (strcmp(szAction,"AddTexture")==0)
{
GLI_tdstTexture *p_stTexture;
ACP_tdxIndex xIndex;
SCR_tdst_Cxt_Values *p_stVal;
xIndex = atoi(szParams[0]);
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[1], SCR_CDF_uw_Anl_Normal);
p_stTexture = (GLI_tdstTexture *) SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
GLI_xGetMaterialType(hVisualMat, &localType);
localType |= GLI_C_lIsTextured;
GLI_xSetMaterialType(hVisualMat, localType);
if (szParams[2])
GLI_vAddMaterialAnimatedTexture(hVisualMat, 0xffffff ,p_stTexture,MTH_M_xDoubleToFloat(atof(szParams[2])));
else
{
if (xIndex == 0)
GLI_xSetMaterialTexture(hVisualMat, p_stTexture);
/*VLMT*/
//GLI_Material_fn_lSetTexture( hVisualMat, xIndex, p_stTexture );
}
}
/*VLMT*/
#ifdef MULTI_TEXTURE
else if (strcmp( szAction, "MultiTexture") == 0)
{
GLI_tdstTexture *p_stTexture;
ACP_tdxIndex xIndex;
SCR_tdst_Cxt_Values *p_stVal;
xIndex = atoi(szParams[0]);
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[2], SCR_CDF_uw_Anl_Normal);
p_stTexture = (GLI_tdstTexture *) SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
GLI_xGetMaterialType(hVisualMat, &localType);
localType |= GLI_C_lIsTextured;
GLI_xSetMaterialType(hVisualMat, localType);
if (xIndex == 0)
GLI_xSetMaterialTexture(hVisualMat, p_stTexture);
GLI_Material_fn_lSetTexture( hVisualMat, xIndex, p_stTexture );
GLI_Material_fn_lSetTextureOpWithString( hVisualMat, xIndex, szParams[3] );
}
else if (strcmp( szAction, "UVComputing") == 0)
{
long lCanal;
float su, sv, alpha, speedalpha, du, dv, speedu, speedv;
lCanal = atoi( szParams[ 0 ] );
speedu = (float) atof( szParams[ 2 ] );
du = (float) atof( szParams[ 3 ] );
speedv = (float) atof( szParams[ 4 ] );
dv = (float) atof( szParams[ 5 ] );
speedalpha = (float) atof( szParams[ 6 ] );
alpha = (float) atof( szParams[ 7 ] );
su = (float) atof( szParams[ 8 ] );
sv = (float) atof( szParams[ 9 ] );
GLI_Material_fn_lSetUVFuncWithString( hVisualMat, lCanal, szParams[1], su, sv, speedalpha, alpha, speedu, speedv, du, dv );
}
#endif
/*EVLMT*/
else if ((strcmp(szAction,"Env1")==0) || (strcmp(szAction,"SetTextureAsEnvironnement")==0))
{
GLI_vSetMaterialAsChromed ( hVisualMat, 1);
}
else if (strcmp(szAction,"Backface")==0)
{
long lType;
GLI_xGetMaterialType (hVisualMat,&lType);
if (strcmp(szParams[0],"OFF") != 0)
lType &= 0xffffffff - GLI_C_lIsTestingBackface;
else
lType |= GLI_C_lIsTestingBackface;
GLI_xSetMaterialType (hVisualMat,lType);
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/*********************************************************************
*********************************************************************/
SCR_tde_Anl_ReturnValue GLI_xLoadFaceMapDescriptor(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
ACP_tdxHandleOfFMD hFMD;
char a255_cLongName[255];
switch (cType)
{
case SCR_EA_Anl_BeginSection:
GEO_xCreateFaceMapDescriptor(&hFMD);
SCR_M_RdL0_SetSectionLong(0,0,(long)hFMD);
SCR_M_RdL0_SetContextLong(0,0,(long)hFMD);
SCR_M_RdL0_ComputeOpenSectionNameR(0, a255_cLongName);
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfFaceMapDescriptor(), a255_cLongName, (unsigned long)hFMD),
1, strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0))
);
break;
case SCR_EA_Anl_Entry:
/* Recuperation du materiau a remplir*/
SCR_M_RdL0_GetContextLong(0,0,ACP_tdxHandleOfFMD,hFMD);
if (strcmp(szAction,"TripledUV")==0)
{
ACP_tdst2DUVValues stUV1,stUV2,stUV3;
stUV1.xU = (float)atof(szParams[0]);
stUV1.xV = (float)atof(szParams[1]);
stUV2.xU = (float)atof(szParams[2]);
stUV2.xV = (float)atof(szParams[3]);
stUV3.xU = (float)atof(szParams[4]);
stUV3.xV = (float)atof(szParams[5]);
GEO_xSetFaceMapDescriptorUV(hFMD, &stUV1, &stUV2, &stUV3);
}
else if (strcmp(szAction,"GetTripledUV")==0)
{
ACP_tdst2DUVValues stUV1,stUV2,stUV3;
ACP_tdxHandleOfFMD hTemp;
SCR_tdst_Cxt_Values *p_stVal;
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[0], SCR_CDF_uw_Anl_Normal);
hTemp = (ACP_tdxHandleOfFMD)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
assert(hTemp != NULL);
GEO_xGetFaceMapDescriptorUV(hTemp, &stUV1, &stUV2, &stUV3);
GEO_xSetFaceMapDescriptorUV(hFMD, &stUV1, &stUV2, &stUV3);
}
else if( strcmp(szAction,"Material") == 0 )
{
char sFile[256], sAction[256], sIdent[256];
GMT_tdxHandleToGameMaterial hMaterial;
SCR_tdst_Cxt_Values *p_stVal;
SCR_fn_v_RdL0_SplitSectionName(szParams[0], sFile, sAction, sIdent);
if(strcmp(sAction,"Material") == 0)
{
ACP_tdxHandleOfMaterial hMat;
GMT_tdxHandleToGameMaterial hGameMat;
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[0], SCR_CDF_uw_Anl_Normal);
hMat = (ACP_tdxHandleOfMaterial)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
hGameMat = GMT_fn_hCreateGameMaterial();
GMT_fn_vSetVisualMaterial(hGameMat, hMat);
hMaterial = hGameMat;
}
else
hMaterial = GMT_fn_hLoadGameMaterial(szParams[0]);
assert(hMaterial != NULL);
GEO_xSetFaceMapDescriptorGameMaterial(hFMD, hMaterial);
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/********************************************************************
*********************************************************************/
SCR_tde_Anl_ReturnValue GLI_xLoadSprite(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
ACP_tdxHandleOfSprite hSprite;
MTH2D_tdstVector stSize;
ACP_tdxIndex NbSprites;
char a255_cLongName[255];
switch (cType)
{
case SCR_EA_Anl_BeginSection:
NbSprites=atoi(szParams[0]);
GEO_vCreateRotativSprite(&hSprite, NbSprites);
SCR_M_RdL0_SetSectionLong(0,0,(long)hSprite);
SCR_M_RdL0_SetContextLong(0,0,(long)hSprite);
SCR_M_RdL0_ComputeOpenSectionNameR(0, a255_cLongName);
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfSprite(), a255_cLongName, (unsigned long)hSprite),
1, strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0))
);
break;
case SCR_EA_Anl_Entry:
/* Recuperation du handle a remplir*/
SCR_M_RdL0_GetContextLong(0,0,ACP_tdxHandleOfSprite, hSprite);
if (strcmp(szAction,"AddMaterial")==0)
{
char sFile[256], sAction[256], sIdent[256];
GMT_tdxHandleToGameMaterial hMaterial;
ACP_tdxIndex xIndex;
SCR_tdst_Cxt_Values *p_stVal;
xIndex = atoi(szParams[0]);
SCR_fn_v_RdL0_SplitSectionName(szParams[1], sFile, sAction, sIdent);
if(strcmp(sAction,"Material") == 0)
{
ACP_tdxHandleOfMaterial hMat;
GMT_tdxHandleToGameMaterial hGameMat;
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[1], SCR_CDF_uw_Anl_Normal);
hMat = (ACP_tdxHandleOfMaterial)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
hGameMat = GMT_fn_hCreateGameMaterial();
GMT_fn_vSetVisualMaterial(hGameMat, hMat);
hMaterial = hGameMat;
}
else
hMaterial = GMT_fn_hLoadGameMaterial(szParams[1]);
assert(hMaterial != NULL);
GEO_vSetGameMaterialOfSprite(hSprite, hMaterial, xIndex);
}
else if( strcmp(szAction,"AddInfo")==0)
{
ACP_tdxIndex xIndex;
MTH_tdxReal xParam;
BOOL b2DScaled;
xIndex = atoi(szParams[0]);
if( strcmp(szParams[1],"2DScaled")==0)
{
GEO_vSetModeOfSprite(hSprite, GEO_C_lSpriteDrawMode2DScaled , xIndex);/*Philippe*/
b2DScaled = TRUE;
}
else if( strcmp(szParams[1],"2DNonScaled")==0)
{
GEO_vSetModeOfSprite(hSprite, 0, xIndex); /* Marc V*/
b2DScaled = FALSE;
}
else if ( strcmp(szParams[1],"SemiLookAt")==0 )
{
GEO_vSetModeOfSprite(hSprite, GEO_C_lSpriteDrawModeSemiLookAt , xIndex);
b2DScaled = TRUE;
}
else if ( strcmp(szParams[1],"LensFlare")==0 )
{
GEO_vSetModeOfSprite(hSprite, GEO_C_lSpriteDrawModeLensFlare, xIndex);
b2DScaled = TRUE;
}
xParam = MTH_M_xDoubleToReal(atof(szParams[2]));
GEO_vSetThresholdOfSprite(hSprite, xParam, xIndex);
if(b2DScaled)
{
stSize.xX = MTH_M_xDoubleToReal(atof(szParams[3])*GLI_dGetUnitInMeterInFile(p_fFile->a_szOpenFileName) / 2.0);
stSize.xY = MTH_M_xDoubleToReal(atof(szParams[4])*GLI_dGetUnitInMeterInFile(p_fFile->a_szOpenFileName) / 2.0);
}
else
{
stSize.xX = MTH_M_xDoubleToReal(atof(szParams[3]) / 2.0);
stSize.xY = MTH_M_xDoubleToReal(atof(szParams[4]) / 2.0);
}
GEO_vSetSizeOfSprite(hSprite, &stSize, xIndex);
stSize.xX = MTH_M_xDoubleToReal(atof(szParams[5]));
stSize.xY = MTH_M_xDoubleToReal(atof(szParams[6]));
GEO_vSetDisplacementOfSprite(hSprite, &stSize, xIndex);
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/********************************************************************
ROLE : Load a texture
*********************************************************************/
GLI_tdstTexture gst_Texture;
SCR_tde_Anl_ReturnValue GLI_xLoadTextureSection(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
switch (cType)
{
case SCR_EA_Anl_BeginSection:
break;
case SCR_EA_Anl_Entry:
if (strcmp(szAction,"Chromakey")==0)
{
if (strcmp(szParams[0],"DISABLE") == 0)
{
TEX_vSetTextureChromakey ( &gst_Texture, 0 , 0, 0, 0, 0, 0);
}
else
{
long lFiltre;
unsigned char r,g,b,a;
lFiltre = (strcmp(szParams[1],"FILTERING_ON") == 0) ? 1 : 0;
r = (unsigned char)(atol(szParams[2]) & 0xff);
g = (unsigned char)(atol(szParams[3]) & 0xff);
b = (unsigned char)(atol(szParams[4]) & 0xff);
a = (unsigned char)(atol(szParams[5]) & 0xff);
TEX_vSetTextureChromakey( &gst_Texture, 1, lFiltre, r, g, b, a );
}
}
else if (strcmp(szAction,"Quality")==0)
{
char lQuality;
if ( strcmp(szParams[0],"LOW") == 0)
lQuality = TEX_C_QLOW;
else if (strcmp(szParams[0],"HIGH") == 0)
lQuality = (char)TEX_C_QHIGH;
else
lQuality = (char)TEX_C_QNORMAL;
TEX_vSetTextureQualityLevel( &gst_Texture, lQuality ) ;
}
else if (strcmp(szAction,"Tiling")==0)
{
TEX_vSetTextureTilingMode( &gst_Texture, strcmp(szParams[0],"ON") == 0 , strcmp(szParams[1],"ON") == 0 );
}
else if (strcmp(szAction,"MipMapping")==0)
{
gst_Texture.lNumberOfLod = (strcmp(szParams[0],"OFF") != 0) ? 1 : 0;
}
else if (strcmp(szAction,"LoadTexture")==0)
{
strcpy( gst_Texture.a255_cFileName, szParams[0] );
}
else if (strcmp(szAction,"Bilinear")==0)
{
TEX_vSetTextureBilinearMode( &gst_Texture, strcmp(szParams[0],"ON") == 0 , strcmp(szParams[1],"ON") == 0 );
}
else if (strcmp(szAction,"ZWrite")==0)
{
TEX_vSetTextureZWriteMode( &gst_Texture , strcmp(szParams[0],"OFF"));
}
/*
* entries for PROCEDURAL_TEXTURE
*/
else if (strcmp(szAction, "Procedural") == 0)
{
TEXPRO_fnl_InitProceduralTextureWithName( &gst_Texture, szParams[0], atoi( szParams[1] ), atoi( szParams[2] ), atoi( szParams[3] ) );
}
break;
case SCR_EA_Anl_EndSection:
{
char a_cFullName[255];
GLI_tdstTexture *hTexture = NULL;
char a255_cLongName[255];
SCR_tdst_Link_Value *pst_LinkValue;
GLI_bGetTextureName(gst_Texture.a255_cFileName, a_cFullName);
#ifdef EXGEOM_APPLI
{
char szRealName[ _MAX_PATH ];
extern long EXGEOM_TEX_fnl_FindTexture( char *, char *);
if (EXGEOM_TEX_fnl_FindTexture( gst_Texture.a255_cFileName, szRealName ) )
GLI_xLoadTexture( &hTexture,NULL,szRealName,0,0);
else
GLI_xLoadTexture( &hTexture,NULL,gst_Texture.a255_cFileName,0,0);
}
#else
GLI_xLoadTexture( &hTexture,NULL,gst_Texture.a255_cFileName,0,0);
#endif
SCR_M_RdL0_ComputeOpenSectionNameR ( 0 , a255_cLongName ) ;
pst_LinkValue = SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfTextureSection(), a255_cLongName, (unsigned long)hTexture);
SCR_M_v_Link_SetAdditionalLong( pst_LinkValue, 1, strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0) ) );
pst_LinkValue = SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfTexture(), a_cFullName, (unsigned long)hTexture);
SCR_M_v_Link_SetAdditionalLong( pst_LinkValue, 1, strlen(a_cFullName) - strlen(gst_Texture.a255_cFileName) );
SCR_M_RdL0_SetSectionLong(0,0,(long)hTexture);
SCR_M_RdL0_SetContextLong(0,0,(long)hTexture);
/*
* set parameters given by section entry
*/
if (hTexture)
{
BOOL bOn, bFilter;
BOOL bTilingU, bTilingV;
unsigned char r,g,b,a;
if (gst_Texture.lNumberOfLod) GLI_vComputeLod( hTexture );
TEX_vSetTextureQualityLevel(hTexture, TEX_ucGetTextureQualityLevel( &gst_Texture ) );
TEX_vGetTextureChromakey( &gst_Texture, &bOn ,&bFilter, &r, &g, &b, &a );
TEX_vSetTextureChromakey( hTexture, bOn, bFilter, r, g, b, a );
TEX_vSetTextureCyclingMode( hTexture, (unsigned char) (TEX_ucGetTextureCyclingMode( hTexture ) | TEX_ucGetTextureCyclingMode(&gst_Texture)) );
// restore tilling from parameters
TEX_vGetTextureTilingMode(&gst_Texture, &bTilingU, &bTilingV);
TEX_vSetTextureTilingMode(hTexture, bTilingU, bTilingV);
}
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/********************************************************************
ROLE : Load an Object
*********************************************************************/
SCR_tde_Anl_ReturnValue GLI_xLoadGeometric(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
ACP_tdxHandleOfObject hObject;
ACP_tdxIndex xIndex;
char a255_cLongName[255];
switch (cType)
{
case SCR_EA_Anl_BeginSection:
GEO_vCreateGeometricObject(&hObject, (ACP_tdxIndex)atoi(szParams[0]), (ACP_tdxIndex)atoi(szParams[2]));
SCR_M_RdL0_SetSectionLong(0,0,(long)hObject);
SCR_M_RdL0_SetContextLong(0,0,(long)hObject);
SCR_M_RdL0_ComputeOpenSectionNameR(0, a255_cLongName);
SCR_M_v_Link_SetAdditionalLong
(
SCR_fnp_st_Link_SetValue(GLI_p_stGetLinkTableOfGeometric(), a255_cLongName, (unsigned long)hObject),
1, strlen(a255_cLongName) - strlen(SCR_M_RdL0_GetCompleteSectionNameR(0))
);
hObject->xNbEdges=atoi(szParams[1]);
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
if (g_bLoadMap)
{
fprintf (dump,"===================================================================\n");
fprintf (dump,"%s\n",a255_cLongName);
fflush(dump);
}
#endif //U64CONVERTLOG
// } fin N64-format
break;
case SCR_EA_Anl_Entry:
/* Recuperation du LoadGeometric a remplir*/
SCR_M_RdL0_GetContextLong(0,0,ACP_tdxHandleOfObject, hObject);
/* Loading of object's vertex*/
if (strcmp(szAction,"AddVertex")==0)
{
MTH3D_tdstVector stPoint;
xIndex = (ACP_tdxIndex)atoi(szParams[0]);
MTH3D_M_vSetVectorElements
(
&stPoint,
MTH_M_xDoubleToReal(atof(szParams[1]) * GLI_dGetUnitInMeterInFile(p_fFile->a_szOpenFileName)),
MTH_M_xDoubleToReal(atof(szParams[2]) * GLI_dGetUnitInMeterInFile(p_fFile->a_szOpenFileName)),
MTH_M_xDoubleToReal(atof(szParams[3]) * GLI_dGetUnitInMeterInFile(p_fFile->a_szOpenFileName))
);
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
if (g_bLoadMap)
{
// round u64
stPoint.xX = (float) (( (long)( (stPoint.xX*fScale) + 0.5) ) / fScale);
stPoint.xY = (float) (( (long)( (stPoint.xY*fScale) + 0.5) ) / fScale);
stPoint.xZ = (float) (( (long)( (stPoint.xZ*fScale) + 0.5) ) / fScale);
fprintf (dump,"point %03d : x=%f,y=%f,z=%f\n",xIndex,stPoint.xX,stPoint.xY,stPoint.xZ);
fflush(dump);
}
#endif //U64CONVERTLOG
// } fin N64-format
GEO_vSetPointOfObject(hObject, &stPoint, xIndex);
MTH3D_M_vSetVectorElements
(
&stPoint,
MTH_M_xDoubleToReal(atof(szParams[4])),
MTH_M_xDoubleToReal(atof(szParams[5])),
MTH_M_xDoubleToReal(atof(szParams[6]))
);
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
if (g_bLoadMap)
{
// round u64
stPoint.xX = (float) (( (long)( (stPoint.xX*fScale) + 0.5) ) / fScale);
stPoint.xY = (float) (( (long)( (stPoint.xY*fScale) + 0.5) ) / fScale);
stPoint.xZ = (float) (( (long)( (stPoint.xZ*fScale) + 0.5) ) / fScale);
fprintf (dump,"point normal %03d : x=%f,y=%f,z=%f\n",xIndex,stPoint.xX,stPoint.xY,stPoint.xZ);
fflush(dump);
}
#endif //U64CONVERTLOG
// } fin N64-format
GEO_vSetNormalOfPointOfObject(hObject, &stPoint, xIndex);
}
else if (strcmp(szAction,"GetVertices")==0)
{
GEO_tdstGeometricObject *p_stTemp;
SCR_tdst_Cxt_Values *p_stVal;
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[0], SCR_CDF_uw_Anl_Normal);
p_stTemp = (GEO_tdstGeometricObject*)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
assert(p_stTemp != NULL);
GEO_M_CPAFree(hObject->d_stListOfPoints);
GEO_M_CPAFree(hObject->d_stListOfPointsNormals);
hObject->d_stListOfPoints = p_stTemp->d_stListOfPoints;
hObject->d_stListOfPointsNormals = p_stTemp->d_stListOfPointsNormals;
}
/* Loading of object's edge*/
else if (strcmp(szAction,"AddEdge")==0)
{
xIndex = (ACP_tdxIndex)atoi(szParams[0]);
hObject->d_stListOfEdges[xIndex].a2_xIndex[0] = (ACP_tdxIndex)(atoi(szParams[1]));
hObject->d_stListOfEdges[xIndex].a2_xIndex[1] = (ACP_tdxIndex)(atoi(szParams[2]));
}
else if (strcmp(szAction,"GetEdges")==0)
{
GEO_tdstGeometricObject *p_stTemp;
SCR_tdst_Cxt_Values *p_stVal;
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[0], SCR_CDF_uw_Anl_Normal);
p_stTemp = (GEO_tdstGeometricObject*)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
assert(p_stTemp != NULL);
GEO_M_CPAFree(hObject->d_stListOfEdges);
hObject->d_stListOfEdges = p_stTemp->d_stListOfEdges;
}
/* Loading of object's element*/
else if (strcmp(szAction,"AddElement")==0)
{
char sFile[256], sAction[256], sIdent[256];
SCR_tdst_Cxt_Values *p_stVal;
unsigned short uwTypeElement;
void *p_stElement;
xIndex = atoi(szParams[0]);
SCR_fn_v_RdL0_SplitSectionName(szParams[2], sFile, sAction, sIdent);
if(strcmp(sAction,"ElementIndexedTriangles")==0)
uwTypeElement = GEO_C_xElementIndexedTriangles;
else if(strcmp(sAction,"ElementSprites")==0)
uwTypeElement = GEO_C_xElementSprites;
else if(strcmp(sAction,"ElementFaceMapDescriptors")==0)
uwTypeElement = GEO_C_xElementFaceMapDescriptors;
else if(strcmp(sAction,"ElementTMeshes")==0)
uwTypeElement = GEO_C_xElementTMeshes;
else if(strcmp(sAction,"ElementSpheres")==0)
uwTypeElement = GEO_C_xElementSpheres;
else if(strcmp(sAction,"ElementAlignedBoxes")==0)
uwTypeElement = GEO_C_xElementAlignedBoxes;
else if(strcmp(sAction,"ElementPoints")==0)
uwTypeElement = GEO_C_xElementPoints;
else if(strcmp(sAction,"ElementLines")==0)
uwTypeElement = GEO_C_xElementLines;
else if(strcmp(sAction,"ElementCones")==0)
uwTypeElement = GEO_C_xElementCones;
/* Lecture du graphique*/
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[2], SCR_CDF_uw_Anl_Normal);
p_stElement = (void *)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
assert(p_stElement != NULL);
hObject->d_xListOfElementsTypes[xIndex] = uwTypeElement;
hObject->d_stListOfElements[xIndex] = p_stElement;
/* element bounding volume*/
if( (SCR_fn_uc_RdL0_GetNumberOfParameters(szParams)==4) && (hObject->xNbElements>1) )
{
ACP_tdxIndex xBoundingVolume = (ACP_tdxIndex)atoi(szParams[3]);
if( (xBoundingVolume>=0) && (xBoundingVolume<hObject->xNbElements) )
{
GEO_vSetParallelBoxIndexOfElement(hObject,xIndex,xBoundingVolume);
if( xBoundingVolume+1 > hObject->xNbParallelBoxes )
hObject->xNbParallelBoxes = xBoundingVolume+1;
}
}
}
else if (strcmp(szAction,"GetElement")==0)
{
GEO_tdstGeometricObject *p_stTemp;
long xIndexElement;
SCR_tdst_Cxt_Values *p_stVal;
xIndex = atoi(szParams[0]);
xIndexElement = atoi(szParams[2]);
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[1], SCR_CDF_uw_Anl_Normal);
p_stTemp = (GEO_tdstGeometricObject*)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
assert(p_stTemp != NULL);
hObject->d_xListOfElementsTypes[xIndex] = p_stTemp->d_xListOfElementsTypes[xIndexElement];
hObject->d_stListOfElements[xIndex] = p_stTemp->d_stListOfElements[xIndexElement];
if( SCR_fn_uc_RdL0_GetNumberOfParameters(szParams) == 4 )
{
ACP_tdxIndex xBoundingVolume = (ACP_tdxIndex)atoi(szParams[3]);
if ( xBoundingVolume < 0 )
xBoundingVolume = 0;
else if ( xBoundingVolume > hObject->xNbElements )
xBoundingVolume = hObject->xNbElements;
GEO_vSetParallelBoxIndexOfElement(hObject,xIndex,xBoundingVolume);
if( xBoundingVolume+1 > hObject->xNbParallelBoxes )
hObject->xNbParallelBoxes = xBoundingVolume+1;
}
}
else if ( strcmp (szAction, "LookAt") == 0 )
{
if ( stricmp (szParams[0], "TRUE") )
hObject->ulType = GEO_C_LookAt ;
else
hObject->ulType = GEO_C_SemiLookAt ;
}
break;
case SCR_EA_Anl_EndSection:
SCR_M_RdL0_GetContextLong(0,0,ACP_tdxHandleOfObject, hObject);
/* ANNECY AV {*/
/* If faudra faire la modif apr<70>s l'ECTS*/
/* GEO_vEndModifyObjectWithoutComputingNormal(hObject);*/
GEO_vEndModifyObject (hObject);
/* END ANNECY AV }*/
break;
}
return SCR_ERV_Anl_NormalReturn;
}
SCR_tde_Anl_ReturnValue GLI_xLoadModCallback(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
GLI_tdstGeometricInfo *p_xGeometricInFile;
ACP_tdxIndex xNbGeometric;
switch (cType)
{
case SCR_EA_Anl_BeginSection:
p_xGeometricInFile = (GLI_tdstGeometricInfo*)malloc(sizeof(GLI_tdstGeometricInfo));
SCR_M_RdL0_SetContextLong(0,0,(long)p_xGeometricInFile);
SCR_M_RdL0_SetContextLong(0,1,(long)0);
break;
case SCR_EA_Anl_EndSubSection:
if (strcmp(szParams[0],"Geometric")==0)
{
ACP_tdxHandleOfObject hGeometric;
SCR_M_RdL0_GetContextLong(0,0,GLI_tdstGeometricInfo*,p_xGeometricInFile);
SCR_M_RdL0_GetContextLong(0,1,ACP_tdxIndex,xNbGeometric);
p_xGeometricInFile = (GLI_tdstGeometricInfo*)realloc(p_xGeometricInFile,++xNbGeometric*sizeof(GLI_tdstGeometricInfo));
SCR_M_RdL0_GetSectionLong(1,0,ACP_tdxHandleOfObject,hGeometric);
strcpy(p_xGeometricInFile[xNbGeometric-1].a_cFileName,p_fFile->a_szOpenFileName);
strcpy(p_xGeometricInFile[xNbGeometric-1].a_cSectionName,szParams[2]);
p_xGeometricInFile[xNbGeometric-1].hObject=hGeometric;
SCR_M_RdL0_SetContextLong(0,0,(long)p_xGeometricInFile);
SCR_M_RdL0_SetContextLong(0,1,(long)xNbGeometric);
}
break;
case SCR_EA_Anl_EndSection:
SCR_M_RdL0_GetContextLong(0,0,GLI_tdstGeometricInfo*,p_xGeometricInFile);
SCR_M_RdL0_GetContextLong(0,1,ACP_tdxIndex,xNbGeometric);
SCR_M_RdL0_SetSectionLong(0,0,(long)p_xGeometricInFile);
SCR_M_RdL0_SetSectionLong(0,1,(long)xNbGeometric);
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/* Get File version*/
double GLI_dGetFileVersion(char *szGeometricFile)
{
double ret;
SCR_M_RdL0_GetFileDouble(0, 0, ret);
return ret;
}
/* Get Unite In Meter*/
double GLI_dGetUnitInMeterInFile(char *szGeometricFile)
{
double ret;
SCR_M_RdL0_GetFileDouble(0, 1, ret);
return ret;
}
/********************************************************************************
NOM : GLI_pLoadGeometricInFile
ROLE : Find an Object in szGeometricFile with szGeometricName and return p_stGeometric
*********************************************************************************/
ACP_tdxHandleOfObject GEO_fn_hLoadGeometricObject(char* _szSectionName, unsigned short _uwScriptMode);
ACP_tdxHandleOfObject GLI_pLoadGeometricInFile(char *szGeometricName)
{
ACP_tdxHandleOfObject hGeoObj;
hGeoObj=GEO_fn_hLoadGeometricObject(szGeometricName,SCR_CDF_uw_Anl_Normal);
return hGeoObj;
}
/*===============================================================================*/
/* FONCTIONS UTILISEES POUR LE CHARGEMENT D'UN FICHIER ENTIER */
/*===============================================================================*/
void GLI_vInitLoad()
{
/* Init des scripts et lecture du fichier*/
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionTexture, GLI_xLoadTextureSection , SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionGeometric, GLI_xLoadGeometric, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionPhysical, GLI_xLoadGeometric, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionSpecialEffect, GLI_xLoadGeometric, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionElementIndexedTriangles, GLI_xLoadElementIndexedTriangles, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionElementFaceMapDescriptors, GLI_xLoadElementFaceMapDescriptors, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionElementSprites, GLI_xLoadElementSprites, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionElementTMeshes, GLI_xLoadElementTMeshes, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionElementLines, GLI_xLoadElementLines, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionElementSpheres, GLI_xLoadElementSpheres, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionElementAlignedBoxes, GLI_xLoadElementAlignedBoxes, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionElementPoints, GLI_xLoadElementPoints, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionElementCones, GLI_xLoadElementCones, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionVisualMaterial, GLI_xLoadMaterial, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionFaceMapDescriptor, GLI_xLoadFaceMapDescriptor, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(GLI_C_SectionSprite, GLI_xLoadSprite, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(".mod", GLI_xLoadModCallback, SCR_CRC_c_RdL0_ForFile);
sprintf(szTexturePath,".");
GLI_vInitLinkTableOfGeometric();
}
/********************************************************************
NOM : GLI_vLoadMODFile
ROLE : Load an entire MOD File and return a tab of object's index in lib
*********************************************************************/
void GLI_vLoadMODFile(char *szPathName, char *szFileName, GLI_tdstGeometricInfo **h_xGeometricInFile, ACP_tdxIndex *p_xNbGeometric)
{
SCR_tdst_Cxt_Values *p_stVal;
SCR_fn_v_RdL0_RegisterPath(szPathName);
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szFileName, SCR_CDF_uw_Anl_Normal);
*h_xGeometricInFile = (GLI_tdstGeometricInfo *)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
*p_xNbGeometric = (ACP_tdxIndex)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,1);
}
#ifdef __cplusplus
} /*extern "C"*/
#endif