reman3/Rayman_X/cpa/tempgrp/OGD/src/3dobjectCB.cpp

77 lines
2.5 KiB
C++

#include "ldt.h"
// ----------------------------------------------------------------------------
// Description : CallBack from reading 'Edit-ModifGeometric' section
// ----------------------------------------------------------------------------
int Geometry3D::LoadModif( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
Geometry3D *p_oGeom=(Geometry3D *)LDT_GetLinkValue( pLink );
p_oGeom -> m_oListOfModifiedPoints . RemoveAll();
p_oGeom -> m_oListOfGMTModif . RemoveAll();
p_oGeom -> m_oListOfFMDModif . RemoveAll ();
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)(szEntry+4))
{
case 'ioPd' : /* MovedPoint */
{
ACP_tdxIndex xIndex = atoi( LDT_szGetParam(1) );
if( xIndex < GEO_xGetGeometricObjectNumberOfPoints( p_oGeom -> GetStruct() ) )
{
p_oGeom -> fn_vAddModification( xIndex);
}
}
break;
case 'etaM' : /* GameMaterial */
{
ACP_tdxHandleOfElement hElement = atoi( LDT_szGetParam( 1 ) );
ACP_tdxIndex xIndexInElement = 0;
GMT_tdxHandleToGameMaterial hGM = NULL;
SCR_tdst_Link_Value *p_stValue = SCR_fnp_st_Link_SearchKey (GMT_fn_p_stGetLinkTable(), LDT_szGetParam(3));
if (p_stValue)
hGM = (GMT_tdxHandleToGameMaterial) SCR_M_ul_Link_GetValue (p_stValue);
if (hGM)
p_oGeom -> fn_vAddGMTModification( hElement, xIndexInElement, hGM );
}
break;
case 'caFd' : /* MovedFace */
{
ACP_tdxIndex xElementIT = atoi( LDT_szGetParam( 1 ) );
ACP_tdxIndex xIndexFaceIT = atoi( LDT_szGetParam( 2 ) );
ACP_tdxIndex xElementFMD = atoi( LDT_szGetParam( 3 ) );
ACP_tdxIndex xIndexFaceFMD = atoi( LDT_szGetParam( 4 ) );
p_oGeom -> fn_vAddFMDModification( xElementIT, xIndexFaceIT, xElementFMD, xIndexFaceFMD);
}
break;
}
}
}
}
// form modif
if( !p_oGeom -> m_oListOfModifiedPoints . IsEmpty() )
p_oGeom -> fn_vSetCurrentState( C_szFormModif, FALSE );
// material modif
if( !p_oGeom -> m_oListOfGMTModif . IsEmpty() )
p_oGeom -> fn_vSetCurrentState( C_szMaterialModif,FALSE );
if( !p_oGeom -> m_oListOfFMDModif . IsEmpty() )
p_oGeom -> fn_vSetCurrentState( C_szFMDModif,FALSE );
return 0;
}