#include "LDT.h"
 
/*****************************************************************
Name: 
Description: Create callback for LDT
Author: Mircea Petrescu
Date: 8/13/98
Modified: 
*****************************************************************/
int fn_iCreateGameMaterial( LDT_tdst_Link *pLink )
{
  GMT_tdxHandleToGameMaterial h_GameMaterial= GMT_fn_hCreateGameMaterial(); 	
  pLink->pObject=(void *)h_GameMaterial;
  return 0;
}
 
 
/*****************************************************************
Name: 
Description: Load callback for LDT
Author: Mircea Petrescu
Date: 8/13/98
Modified: 
*****************************************************************/
int fn_iLoadGameMaterial( LDT_tdst_Link *pLink )
{
  LDT_tdeParseResult result=ParseResult_BeginSection;
  GMT_tdxHandleToGameMaterial h_GameMaterial=(GMT_tdxHandleToGameMaterial)pLink->pObject;
  char a255_cLongName[256];
  int iLen=LDT_ComputeSectionName(pLink,a255_cLongName);
  SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(
	  &g_stGmtLinkTable, a255_cLongName, (long)h_GameMaterial)
	  ,1 , iLen);
 
 
  while( result!=ParseResult_EndSection ) 
  {
  	result=LDT_GetNextEntry();
  	switch( result )
  	{
  	  case ParseResult_Entry: /* an entry */
  	  {
  	    char *szEntry=LDT_szGetEntryName();
  	    switch (*(long*)szEntry)
  	    {
  	      case 'usiV' : /* VisualMat */
  	      {
			ACP_tdxHandleOfMaterial hVisualMat;
			hVisualMat=(ACP_tdxHandleOfMaterial)LDT_LoadSection( LDT_szGetParam(1) );
			GMT_fn_vSetVisualMaterial(h_GameMaterial,hVisualMat);
  	      }
  	      break;
  	      case 'hceM' : /* MechanicalMat */
  	      {
			SCR_tdst_Cxt_Values *p_stValues ;
			unsigned long ulResult;
 
			/* Call the call back for the other properties into the .miv file */
			/* and put the handles into the structure GameMaterial Handled */
 
      GMT_fn_vSetMechanicsMaterial(h_GameMaterial,(DNM_tdxHandleToMecMatCharacteristics)LDT_LoadSection( LDT_szGetParam(1) ));
 
          }
  	      break;
  	      case 'lloC' : /* CollideMat */
  	      {
 
			/* Call the call back for the other properties into the .miv file */
			/* and put the handles into the structure GameMaterial Handled */
 
				GMT_fn_vSetCollideMaterial(h_GameMaterial,(GMT_tdxHandleToCollideMaterial)LDT_LoadSection(LDT_szGetParam(1)));
  	      }
  	      break;
  	      case 'nuoS' : /* SoundType */
  	      {
			GMT_fn_vSetSoundMaterial(h_GameMaterial,(long)atoi( LDT_szGetParam( 1 ) ));
  	      }
  	      break;
  	    }
  	  }
	  break;
  	}
  }
 
  return 0;
}
 
 
 
