reman3/Rayman_X/cpa/tempgrp/GEO/P5/BinLoad.c

112 lines
4.2 KiB
C

/* (c) Ubi R&D 1997*/
/* See Alain Robin for any comment or question*/
/****************************************************************************/
/* INCLUDES */
/****************************************************************************/
#include "acp_base.h"
#include "cpa_std.h"
/*
#define BOOL ACP_tdxBool
*/
#include "SCR.h"
/*#include "BIN.h"*/
#include "DPT.h"
#include "SPO/Specif/HieLoad.h"
#include "GEO/GeoObj.h"
#include "GLI/LinkTab.h"
#include "GEO/LoadBin.h"
#include "Geo/GeoMem.h"
/****************************************************************************/
/* GLOBAL VARIABLES */
/****************************************************************************/
/*
ACP_tdxBool g_bUseMob=TRUE;
char* GEO_g_p_cLoadBuffer=NULL;
extern SCR_tdst_Link_Table stLinkTableOfGeometric;
extern ACP_tdxBool g_bUseBinaryData;
DWORD dwTotal2=0; // For Benchmark
*/
/*----------------------------------------------------------------------------
// Description : GEO_fn_p_stLoadIndexedTriangle
// Loads an indexed triangle with script file
------------------------------------------------------------------------------
// Methods : Nothing to say
------------------------------------------------------------------------------
// Input : _szSectionName
// Output : The pointer to the indexed triangle
------------------------------------------------------------------------------
// Creation date : Aug 97 Author: Alain Robin
------------------------------------------------------------------------------
// Modifications :
// Modification date : Modification author :
----------------------------------------------------------------------------*/
GEO_tdstElementIndexedTriangles* GEO_fn_p_stLoadIndexedTriangle(char* _szSectionName)
{
SCR_tdst_Cxt_Values *p_stValues ;
SCR_tdst_Link_Value *p_stLinkValue;
unsigned long ulResult;
unsigned int uiPos;
uiPos = 0;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stLinkValue,SCR_M_st_Link_GetDynamicArray(GLI_p_stGetLinkTableOfElementIndexedTriangle()));
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(GLI_p_stGetLinkTableOfElementIndexedTriangle()));
}
/* p_stLinkValue=BIN_fn_p_stSearchShortKey(GLI_p_stGetLinkTableOfElementIndexedTriangle(),
_szSectionName);*/
if(p_stLinkValue==NULL)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_szSectionName,SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
ulResult = SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0);
return (GEO_tdstElementIndexedTriangles*)ulResult;
}
else
return NULL;
}
else return (GEO_tdstElementIndexedTriangles*)SCR_M_ul_Link_GetValue(p_stLinkValue);
}
/*----------------------------------------------------------------------------
// Description : GEO_fn_hLoadGeometricObject
// Load a geometric object from an ascii script or from a binary script
------------------------------------------------------------------------------
// Methods : Nothing to say
------------------------------------------------------------------------------
// Input : _szSectionName : Name of the section to load
// Output : Handle to the geometric element loaded
------------------------------------------------------------------------------
// Creation date : Jul 97 Author: Alain Robin
------------------------------------------------------------------------------
// Modifications :
// Modification date : Modification author :
----------------------------------------------------------------------------*/
ACP_tdxHandleOfObject GEO_fn_hLoadGeometricObject(char* _szSectionName, unsigned short _uwScriptMode)
{
ACP_tdxHandleOfObject hGeometricObject=NULL;
SCR_tdst_Cxt_Values *p_stVal=NULL;
/* Use script */
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(_szSectionName, _uwScriptMode);
hGeometricObject = (ACP_tdxHandleOfObject)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
return hGeometricObject;
}