// Motor Instances saving functions
////////////////////////////////////////
// Created by YB, 12/05/97
////////////////////////////////////////////////
#include "StdAfx.h"

/////////////////////////////////////////////////////
//////// !!!!!!!!!!!! DANGER !!!!!!!!!!! ////////////
/////////////////////////////////////////////////////
#define _ED_CAR_MUST_DEFINE_STRUCT_
#include "EdAllAct.hpp"
/////////////////////////////////////////////////////
//////// !!!!!!!!!!!! End DANGER !!!!!!!!!!! ////////
/////////////////////////////////////////////////////

#include "EDACMISv.hpp"
#include "EDAC2Mot.hpp"

#include "Defines.hpp"
#include "EDACStrg.hpp"
#include "ErO.h"

//-----------------IR-------------------------
#include "EdIRBeEn.hpp"
#include "EDACModl.hpp"
#include "EDACQuer.hpp"
//--------------------------------------------

#include "TFa.h"

#undef CPA_WANTS_IMPORT
#undef CPA_EXPORT
#define CPA_WANTS_EXPORT
//-----------------IR-------------------------
		#include "EdIRIRD.hpp"
//--------------------------------------------
    #include "_Actors.hpp"
#undef CPA_WANTS_EXPORT
#define CPA_WANTS_IMPORT

// Functions used to Save all MS
///////////////////////////////////

//********************************************************************************

//*****************************************************************************************************************
void ED_ACTORS_fn_vStdGameSaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject)
{
	char szSection[SCR_CV_ui_Cfg_MaxLenName];
	MS_tdxHandleToStandardGame h_StandardGame = p_stObject->h_StandardGame;

	if ( h_StandardGame != NULL )
	{
		SCR_M_SvL0_SaveBlankLine(p_stFile);
		SCR_M_SvL0_SaveComment(p_stFile, "**** StdGame mini-structure definition ****");

		sprintf(szSection,"%s:",C_SectionStdGameDescription);
		SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryStdGameType,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal,3,
			fn_szFindPersonalTypeNameOfPersonalType(fn_otStandardGameGetPersonalType(h_StandardGame)),
			fn_szFindModelTypeNameOfModelType(fn_otStandardGameGetModelType(h_StandardGame)),
			fn_szFindFamilyTypeNameOfFamilyType(fn_otStandardGameGetFamilyType(h_StandardGame)));

		CString csTempString;

		//Hit Points Init
		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryStdGameHitPointInit,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%i",
																					*fn_p_ucStdGameGetHitPointsInit(h_StandardGame));

		//Max Hit Points Init
		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryStdGameHitPointMaxInit,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%i",
																					*fn_p_ucStdGameGetHitPointsMaxInit(h_StandardGame));

		//Max Max Hit Points
		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryStdGameHitPointMaxMax,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%i",
																					fn_ucStandardGameGetHitPointsMaxMax(h_StandardGame));

		//Init Flags
		CString csFlagDeadOrTaken;
		switch ( fn_eStandardGameGetInitFlagWhenDeadOrTaken(h_StandardGame) )
		{
		case OI_WhenPlayerGoOutOfActionZone:
			csFlagDeadOrTaken = C_ValueStdInitFlagGoOutOfZone;
			break;
		case OI_Always:
			csFlagDeadOrTaken = C_ValueStdInitFlagAlways;
			break;
		case OI_WhenPlayerIsDead:
			csFlagDeadOrTaken = C_ValueStdInitFlagPlayerDead;
			break;
		case OI_WhenMapJustLoaded:
			csFlagDeadOrTaken = C_ValueStdInitFlagMapLoaded;
			break;
		case OI_NeverBackWhenTaken:
			csFlagDeadOrTaken = C_ValueStdInitFlagNeverBack;
			break;
//		case OI_WhenSavedGameJustLoaded:
//			csFlagDeadOrTaken = C_ValueStdInitFlagSavedGameLoaded;
//			break;
		default :
			csFlagDeadOrTaken = "Error";
			break;
		}

		CString csFlagOutOfZone;
		switch ( fn_eStandardGameGetInitFlagWhenOutOfZone(h_StandardGame) )
		{
		case OI_WhenPlayerGoOutOfActionZone:
			csFlagOutOfZone = C_ValueStdInitFlagGoOutOfZone;
			break;
		case OI_NeverBackWhenTaken:
			csFlagOutOfZone = C_ValueStdInitFlagNeverBack;
			break;
		default :
			csFlagOutOfZone = "Error";
			break;
		}

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryStdInitFlag,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,3,"%s,%s",
																					M_MAKECHAR(csFlagOutOfZone),
																					M_MAKECHAR(csFlagDeadOrTaken));

		//SCR_M_SvL0_SaveEntry(p_stFile,C_EntryStdSpecialPositionFlag,SCR_CC_C_Cfg_NoChar);
		//SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%i", fn_ucStandardGameGetSpecialPositionFlag(h_StandardGame));

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryStdGamePlatFormType,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%i", fn_ucStandardGameGetPlatFormType(h_StandardGame));

		//SCR_M_SvL0_SaveEntry(p_stFile,C_EntryStdGameLinkedToSectorFlag,SCR_CC_C_Cfg_NoChar);

//ANNECY BBB 20/11/97 {
		//SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%i", fn_ucStandardGameGetSectorLinkValue(h_StandardGame));
		//SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%i", fn_bStandardGameGetLinkToSectorFlag(h_StandardGame));
		//custom bits
		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryStdGameCustomBitsInit,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%u",
                                          *fn_p_ulStdGameGetCustomBitsInit(h_StandardGame));
//ENDANNECY BBB 20/11/97 }

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryStdGameCapabilities,SCR_CC_C_Cfg_NoChar);
		char szCapabilities[50];
		itoa(fn_ulStandardGameGetCapabilities(h_StandardGame), szCapabilities, 2 );
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,1,"%s", szCapabilities);

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryStdGameTransparencyZone,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,3,"%i,%i",
                                          fn_ucStandardGameGetTransparencyZoneMin(h_StandardGame),
										  fn_ucStandardGameGetTransparencyZoneMax(h_StandardGame));

// ANNECY MT - 22/10/98 {
		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryStdGameTooFarLimit,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%i", 
                                          fn_ucStandardGameGetTooFarLimit(h_StandardGame));
// END ANNECY MT }

		SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL)
	}
}

//*****************************************************************************************************************
void ED_ACTORS_fn_vSectInfoSaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject)
{
	char szSection[SCR_CV_ui_Cfg_MaxLenName];
	MS_tdxHandleToSectInfo h_SectInfo = p_stObject->h_SectInfo;

	if ( h_SectInfo != NULL )
	{
		SCR_M_SvL0_SaveBlankLine(p_stFile);
		SCR_M_SvL0_SaveComment(p_stFile, "**** SectInfo mini-structure definition ****");

		sprintf(szSection,"%s:",C_SectionSectInfoDescription);
		SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);

		//Saves entries
		//...

		SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
	}
}

//*****************************************************************************************************************
void ED_ACTORS_fn_vLightSaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject)
{
	char szSection[SCR_CV_ui_Cfg_MaxLenName];
	MS_tdxHandleToMSLight h_MSLight = p_stObject->h_MSLight;

	if ( h_MSLight != NULL )
	{
		SCR_M_SvL0_SaveBlankLine(p_stFile);
		SCR_M_SvL0_SaveComment(p_stFile, "**** MSLight mini-structure definition ****");

		sprintf(szSection,"%s:", C_SectionLightDescription);
		SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_NoChar);

		switch(*fn_p_lMSLightGetTypeInit(h_MSLight))
		{
		case GLI_C_lParallelLight:
			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1,"Parallel");
			break;
		case GLI_C_lSphericalLight:
			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1,"Spherical");
			break;
		case GLI_C_lHotSpotLight:
			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1,"HotSpot");
			break;
		case GLI_C_lAmbientLight:
			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1,"Ambient");
			break;
//CHINA WFQ (MT) 16/02/98 {
		case GLI_C_lParallelLight_With_Limit:
			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1,"ParallelBox");
			break;
//ENDCHINA WFQ }
        default:
			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1,"Ambient");
			break;
		}

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryLightOnOff,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2, "%d",*fn_p_lMSLightGetOnOffInit(h_MSLight));

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryLightFarNear,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,3,"%f,%f",*fn_p_xMSLightGetFarInit(h_MSLight),
																																					*fn_p_xMSLightGetNearInit(h_MSLight));

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryLightLittleBigAlpha,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,3,"%f,%f",*fn_p_xMSLightGetLittleAlphaInit(h_MSLight),
																																					*fn_p_xMSLightGetBigAlphaInit(h_MSLight));

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryLightLittleBigTangent,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,3,"%f,%f",*fn_p_xMSLightGetLittleTangentInit(h_MSLight),
																																					*fn_p_xMSLightGetBigTangentInit(h_MSLight));

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryLightColor,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,5,"%f,%f,%f,%f",
																																	*fn_p_xMSLightGetColorRInit(h_MSLight),
																																	*fn_p_xMSLightGetColorGInit(h_MSLight),
																																	*fn_p_xMSLightGetColorBInit(h_MSLight),
																																	0.0);

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryGiroPhare,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,3,"%d,%f",
																																	*fn_p_ucMSLightGetGiroPhareInit(h_MSLight),
																																	*fn_p_xMSLightGetStepGiroInit(h_MSLight));

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryPulse,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,4,"%d,%f,%f",
																																	*fn_p_ucMSLightGetPulsingInit(h_MSLight),
																																	*fn_p_xMSLightGetStepPulseInit(h_MSLight),
																																	*fn_p_xMSLightGetMaxRangePulseInit(h_MSLight));

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryOffset,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,4,"%f,%f,%f",
																																	fn_p_stMSLightGetOffsetVectInit(h_MSLight)->xX,
																																	fn_p_stMSLightGetOffsetVectInit(h_MSLight)->xY,
																																	fn_p_stMSLightGetOffsetVectInit(h_MSLight)->xZ);

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryDirection,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,4,"%f,%f,%f",
																																	fn_p_stMSLightGetAngleInit(h_MSLight)->xX,
																																	fn_p_stMSLightGetAngleInit(h_MSLight)->xY,
																																	fn_p_stMSLightGetAngleInit(h_MSLight)->xZ);

//ANNECY CT 13/01/98 {
		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryLocalLight,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%d",*fn_p_ucMSLightGetLocalLightInit(h_MSLight));

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryOnlyLocalLight,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%d",*fn_p_ucMSLightGetOnlyLocalInit(h_MSLight));
//ENDANNECY CT }

//CHINA WFQ (MT) 16/02/98 {
		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryInterMinPos,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,4,"%f,%f,%f",
													*fn_p_xMSLightGetInterMinXInit(h_MSLight),
													*fn_p_xMSLightGetInterMinYInit(h_MSLight),
													*fn_p_xMSLightGetInterMinZInit(h_MSLight));

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryInterMaxPos,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,4,"%f,%f,%f",
													*fn_p_xMSLightGetInterMaxXInit(h_MSLight),
													*fn_p_xMSLightGetInterMaxYInit(h_MSLight),
													*fn_p_xMSLightGetInterMaxZInit(h_MSLight));

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryExterMinPos,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,4,"%f,%f,%f",
													*fn_p_xMSLightGetExterMinXInit(h_MSLight),
													*fn_p_xMSLightGetExterMinYInit(h_MSLight),
													*fn_p_xMSLightGetExterMinZInit(h_MSLight));

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryExterMaxPos,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,4,"%f,%f,%f",
													*fn_p_xMSLightGetExterMaxXInit(h_MSLight),
													*fn_p_xMSLightGetExterMaxYInit(h_MSLight),
													*fn_p_xMSLightGetExterMaxZInit(h_MSLight));

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryIntensityMinMax,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,3,"%f,%f",
													*fn_p_xMSLightGetIntensityMinInit(h_MSLight),
													*fn_p_xMSLightGetIntensityMaxInit(h_MSLight));
//ENDCHINA WFQ }

        SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
	}
}

//*****************************************************************************************************************
void ED_ACTORS_fn_vMSWaySaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject)
{
	char szSection[SCR_CV_ui_Cfg_MaxLenName];
	MS_tdxHandleToMSWay h_MSWay = p_stObject->h_MSWay;

	if ( h_MSWay != NULL ) 
	{
		SCR_M_SvL0_SaveBlankLine(p_stFile);
		SCR_M_SvL0_SaveComment(p_stFile, "**** MSWay mini-structure definition ****");

		sprintf(szSection,"%s:",C_SectionMSWayDescription);
		SCR_M_SvL0_SaveBeginSection(p_stFile, szSection, SCR_CC_C_Cfg_EOL);

		SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
	}
}

//*****************************************************************************************************************
void ED_ACTORS_fn_vMicroSaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject)
{
	char szSection[SCR_CV_ui_Cfg_MaxLenName];
	MS_tdxHandleToMicro h_MS_Micro = p_stObject->h_Micro;
	MTH3D_tdstVector stX,stY,stZ;

	if ( h_MS_Micro != NULL )
	{
		SCR_M_SvL0_SaveBlankLine(p_stFile);
		SCR_M_SvL0_SaveComment(p_stFile, "**** MS_Micro mini-structure definition ****");

		sprintf(szSection,"%s:",C_SectionMicroDescription);
		SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);

		/** Put here the saving script functions **/
		POS_fn_vGetRotationMatrix(h_MS_Micro->hMicroMatrix, &stX, &stY, &stZ);
		SCR_M_SvL0_SaveEntry(p_stFile, C_EntryMicroRotationMatrix, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,9,
																																"%f,%f,%f,%f,%f,%f,%f,%f,%f",
																																stX.xX,stX.xY,stX.xZ,
																																stY.xX,stY.xY,stY.xZ,
																																stZ.xX,stZ.xY,stZ.xZ);

		POS_fn_vGetTranslationVector(h_MS_Micro->hMicroMatrix, &stX);
		SCR_M_SvL0_SaveEntry(p_stFile, C_EntryMicroTranslationMatrix, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,3,"%f,%f,%f",stX.xX,stX.xY,stX.xZ);

		//Micro is active
		if ( fn_bMicroGetActivationFlag(h_MS_Micro) )
		{
			SCR_M_SvL0_SaveEntry(p_stFile, C_EntryMicroActivation, SCR_CC_C_Cfg_NoChar);
		}
		else
		{
			SCR_M_SvL0_SaveEntry(p_stFile, C_EntryMicroUnactivation, SCR_CC_C_Cfg_NoChar);
		}
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,1,"");

		SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
	}
}

//*****************************************************************************************************************
void ED_ACTORS_fn_vDynamSaveMiniStructure(SCRIPT_tdstSaveFile *p_stFile,struct tdstEngineObject_ *p_stObject)
{
	char szSection[SCR_CV_ui_Cfg_MaxLenName];
	char szName[SCR_CV_ui_Cfg_MaxLenName];
//ANNECY jt {
	DNM_tdstDynamics* p_stDynamics;
//ENDANNECY jt }	
	
	MS_tdxHandleToDynam h_Dynam = p_stObject->h_Dynam;

	if ( h_Dynam != NULL )
	{
//ANNECY jt {	
		p_stDynamics = fn_p_stDynamGetDynamics(h_Dynam);
//ENDANNECY jt }
		
		SCR_M_SvL0_SaveBlankLine(p_stFile);
		SCR_M_SvL0_SaveComment(p_stFile, "**** Dynam mini-structure definition ****");

		sprintf(szSection,"%s:",C_SectionDynamDescription);

		if (DNM_M_bDynamicsIsComplexSize(p_stDynamics)) strcpy ( szName, C_szDynamicSizeComplex );
		else if (DNM_M_bDynamicsIsAdvancedSize(p_stDynamics)) strcpy ( szName, C_szDynamicSizeAdvanced );
		else strcpy ( szName, C_szDynamicSizeBase );


//		SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);

		SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 3, "%s,%i", szName, DNM_M_bDynamicsIsCollisionReport(p_stDynamics) );



		//Saves entries
		//////////////////
		//Object Type
//ANNECY jt {
/*		
		SCR_M_SvL0_SaveEntry(p_stFile, C_EntryDynamType, SCR_CC_C_Cfg_NoChar);

		CString csString1;
		CString csString2 = fn_b_DynamGetIfIsAMobile(h_Dynam) ? C_szIsMobile : C_szIsNotMobile;
		CString csString3 = fn_b_DynamGetIfCanHangSmthgOn(h_Dynam) ? C_szCanHangSmthgOn : C_szCanNotHangSmthgOn;

		switch ( fn_uc_DynamGetObjectType(h_Dynam) )
		{
		case DNM_C_lObjectType_Solid:
			csString1 = C_szSolid;
			break;
		case DNM_C_lObjectType_Liquid:
			csString1 = C_szLiquid;
			break;
		case DNM_C_lObjectType_Gas:
			csString1 = C_szGas;
			break;
		case DNM_C_lObjectType_Plasma:
			csString1 = C_szPlasma;
			break;
		default:
			csString1 = C_szUnknownType;
			break;
		};

		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,4,"%s,%s,%s",
																																		M_MAKECHAR(csString1),
																																		M_MAKECHAR(csString2),
																																		M_MAKECHAR(csString3));

		SCR_M_SvL0_SaveEntry(p_stFile, C_szTakeCareOfTheEnvironment, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%i", fn_bDynamTakeCareOfEnvironment(h_Dynam));
*/
		
/*		SCR_M_SvL0_SaveEntry (p_stFile, C_szSlideFactorX, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP (p_stFile, SCR_EF_SvL0_Scanf, 2, "%lf", DNM_M_xDynamicsGetSlideFactorX(p_stDynamics) );

		SCR_M_SvL0_SaveEntry (p_stFile, C_szSlideFactorY, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP (p_stFile, SCR_EF_SvL0_Scanf, 2, "%lf", DNM_M_xDynamicsGetSlideFactorY(p_stDynamics) );

		SCR_M_SvL0_SaveEntry (p_stFile, C_szSlideFactorZ, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP (p_stFile, SCR_EF_SvL0_Scanf, 2, "%lf", DNM_M_xDynamicsGetSlideFactorZ(p_stDynamics) );
*/
		

		if (DNM_M_bDynamicsIsAdvancedSize(p_stDynamics))
		{
			SCR_M_SvL0_SaveEntry (p_stFile, C_szSlideFactorX, SCR_CC_C_Cfg_NoChar);
			SCR_fn_v_SvL0_SaveParameters_MP (p_stFile, SCR_EF_SvL0_Scanf, 2, "%lf", p_stDynamics->m_tdstDynamicsAdvancedBlock.m_xSlideFactorX );

			SCR_M_SvL0_SaveEntry (p_stFile, C_szSlideFactorY, SCR_CC_C_Cfg_NoChar);
			SCR_fn_v_SvL0_SaveParameters_MP (p_stFile, SCR_EF_SvL0_Scanf, 2, "%lf", p_stDynamics->m_tdstDynamicsAdvancedBlock.m_xSlideFactorY );

			SCR_M_SvL0_SaveEntry (p_stFile, C_szSlideFactorZ, SCR_CC_C_Cfg_NoChar);
			SCR_fn_v_SvL0_SaveParameters_MP (p_stFile, SCR_EF_SvL0_Scanf, 2, "%lf", p_stDynamics->m_tdstDynamicsAdvancedBlock.m_xSlideFactorZ );
		}

//ENDANNECY jt }
		SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
	}
}

//*****************************************************************************************************************
void ED_ACTORS_fn_vCollSetSaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject)
{
	char szSection[SCR_CV_ui_Cfg_MaxLenName];
	MS_tdxHandleToCollSet h_CollSet = p_stObject->h_CollSet;

	char *szFamilyName = fn_szFindFamilyTypeNameOfFamilyType(fn_otStandardGameGetFamilyType(p_stObject->h_StandardGame));

	if ( h_CollSet != NULL )
	{
		SCR_M_SvL0_SaveBlankLine(p_stFile);
		SCR_M_SvL0_SaveComment(p_stFile, "**** CollSet mini-structure definition ****");

		sprintf(szSection,"%s:",C_SectionCollSetDescription);
		SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);

		CString csSectionName;

		//Character's priority
		SCR_M_SvL0_SaveEntry(p_stFile, C_Entry_CharacterPriority, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%i", CS_fn_ucGetCharacterPriority(h_CollSet));

		// Collision Flag
		SCR_M_SvL0_SaveEntry(p_stFile, C_EntryCollisionFlag, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%i", *fn_p_ucCollSetGetCharacterCollisionFlagInit(h_CollSet));

		// Collision Frequency
		SCR_M_SvL0_SaveEntry(p_stFile, C_EntryCollComputeFrequency, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%i", *fn_p_ucCollSetGetCollComputeFrequencyInit(h_CollSet));

 		SCR_M_SvL0_SaveBlankLine(p_stFile);

		if ((p_stObject->h_CollSet)->hZddList!=NULL)
		{
			SCR_M_SvL0_SaveEntry(p_stFile,C_EntryZddTable,SCR_CC_C_Cfg_NoChar);

			ERROR_VERIFY( EDACTORS_fn_b_GetZoneListSectionName((void*)(p_stObject->h_CollSet)->hZddList, TRUE, csSectionName) );	// MT 07/05/97

			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%s",LPCTSTR(csSectionName));
		}

		if ((p_stObject->h_CollSet)->hZdmList!=NULL)
		{
			SCR_M_SvL0_SaveEntry(p_stFile,C_EntryZdmTable,SCR_CC_C_Cfg_NoChar);

			ERROR_VERIFY( EDACTORS_fn_b_GetZoneListSectionName((void*)(p_stObject->h_CollSet)->hZdmList, TRUE, csSectionName) ); // MT 07/05/97

			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%s",LPCTSTR(csSectionName));
		}

		if ((p_stObject->h_CollSet)->hZdeList!=NULL)
		{
			SCR_M_SvL0_SaveEntry(p_stFile,C_EntryZdeTable,SCR_CC_C_Cfg_NoChar);

			ERROR_VERIFY( EDACTORS_fn_b_GetZoneListSectionName((void*)(p_stObject->h_CollSet)->hZdeList, TRUE, csSectionName) ); // MT 07/05/97

			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%s",LPCTSTR(csSectionName));
		}

		if ((p_stObject->h_CollSet)->hZdrList!=NULL)
		{
			SCR_M_SvL0_SaveEntry(p_stFile,C_EntryZdrTable,SCR_CC_C_Cfg_NoChar);

			ERROR_VERIFY( EDACTORS_fn_b_GetZoneListSectionName((void*)(p_stObject->h_CollSet)->hZdrList, TRUE, csSectionName) );

			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%s",LPCTSTR(csSectionName));
		}

		if ((p_stObject->h_CollSet)->hZddActivationList!=NULL)
		{
			SCR_M_SvL0_SaveEntry(p_stFile,C_EntryZddActivationTable,SCR_CC_C_Cfg_NoChar);

			ERROR_VERIFY( EDACTORS_fn_b_GetZoneListSectionName((void*)(p_stObject->h_CollSet)->hZddActivationList, FALSE, csSectionName) );

			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%s",LPCTSTR(csSectionName));
		}

		if ((p_stObject->h_CollSet)->hZdeActivationList!=NULL)
		{
			SCR_M_SvL0_SaveEntry(p_stFile,C_EntryZdeActivationTable,SCR_CC_C_Cfg_NoChar);

			ERROR_VERIFY( EDACTORS_fn_b_GetZoneListSectionName((void*)(p_stObject->h_CollSet)->hZdeActivationList, FALSE, csSectionName) );

			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%s",LPCTSTR(csSectionName));
		}

		if ((p_stObject->h_CollSet)->hZdmActivationList!=NULL)
		{
			SCR_M_SvL0_SaveEntry(p_stFile,C_EntryZdmActivationTable,SCR_CC_C_Cfg_NoChar);

			ERROR_VERIFY( EDACTORS_fn_b_GetZoneListSectionName((void*)(p_stObject->h_CollSet)->hZdmActivationList, FALSE, csSectionName) );

			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%s",LPCTSTR(csSectionName));
		}

		if ((p_stObject->h_CollSet)->hZdrActivationList!=NULL)
		{
			SCR_M_SvL0_SaveEntry(p_stFile,C_EntryZdrActivationTable,SCR_CC_C_Cfg_NoChar);

			ERROR_VERIFY( EDACTORS_fn_b_GetZoneListSectionName((void*)(p_stObject->h_CollSet)->hZdrActivationList, FALSE, csSectionName) );

			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%s",LPCTSTR(csSectionName));
		}

		SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
	}
}

//ANNECY CB
/*
 *=================================================================================================
 *	Save camera cineinfo MS.
 *=================================================================================================
 */
void ED_ACTORS_fn_vCineinfoSaveMiniStructure
(
	SCR_tdst_File_Description *p_stFile,
	struct tdstEngineObject_ *p_stObject
)
{
	char szSection[SCR_CV_ui_Cfg_MaxLenName];

	MS_tdxHandleToCineinfo			h_CineInfo = p_stObject->h_Cineinfo;
	MTH3D_tdstVector				*p_stVector;

	if (h_CineInfo != NULL)
	{
		MS_tdxHandleToInternalCineinfo	hCineinfoInit = M_GetInternalCineinfo(h_CineInfo, Init);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveBlankLine(p_stFile);
		SCR_M_SvL0_SaveComment(p_stFile, "**** CineInfo MS ****");
		/*---------------------------------------------------------------------------------------*/
		sprintf(szSection,"%s:", C_SectionCineinfoDescription);
		SCR_M_SvL0_SaveBeginSection(p_stFile, szSection, SCR_CC_C_Cfg_EOL);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile, C_CAM_EntryShiftTarget, SCR_CC_C_Cfg_NoChar);
		p_stVector = CAM_fn_p_stCineInfoGetShiftTarget(hCineinfoInit);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf,4,
			"%f,%f,%f",
			MTH3D_M_xGetXofVector(p_stVector),
			MTH3D_M_xGetYofVector(p_stVector),
			MTH3D_M_xGetZofVector(p_stVector)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile, C_CAM_EntryShiftPos, SCR_CC_C_Cfg_NoChar);
		p_stVector = CAM_fn_p_stCineInfoGetShiftPos(hCineinfoInit);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf,4,
			"%f,%f,%f",
			MTH3D_M_xGetXofVector(p_stVector),
			MTH3D_M_xGetYofVector(p_stVector),
			MTH3D_M_xGetZofVector(p_stVector)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile, C_CAM_EntryDistance, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf,5,
			"%f,%f, %f, %f",
			CAM_fn_xCineInfoGetDistMin(hCineinfoInit),
			CAM_fn_xCineInfoGetDistMax(hCineinfoInit),
			CAM_fn_xCineInfoGetBoundDistMin(hCineinfoInit),
			CAM_fn_xCineInfoGetBoundDistMax(hCineinfoInit)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile,C_CAM_EntryAlpha, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf,3,
			"%f,%f",
			CAM_fn_xCineInfoGetAngleAlpha(hCineinfoInit),
			CAM_fn_xCineInfoGetAngleShiftAlpha(hCineinfoInit)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile, C_CAM_EntryTheta, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf,3,
			"%f,%f",
			CAM_fn_xCineInfoGetAngleTheta(hCineinfoInit),
			CAM_fn_xCineInfoGetAngleShiftTheta(hCineinfoInit)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile, C_CAM_EntryLinearSpeed,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf,4,
			"%f,%f,%f",
			CAM_fn_xCineInfoGetLinearSpeed(hCineinfoInit),
			CAM_fn_xCineInfoGetLinearIncreaseSpeed(hCineinfoInit),
			CAM_fn_xCineInfoGetLinearDecreaseSpeed(hCineinfoInit)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile, C_CAM_EntryAngularSpeed,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf,4,
			"%f,%f,%f",
			CAM_fn_xCineInfoGetAngularSpeed(hCineinfoInit),
			CAM_fn_xCineInfoGetAngularIncreaseSpeed(hCineinfoInit),
			CAM_fn_xCineInfoGetAngularDecreaseSpeed(hCineinfoInit)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile, C_CAM_EntryTargetSpeed,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf,4,
			"%f,%f,%f",
			CAM_fn_xCineInfoGetTargetSpeed(hCineinfoInit),
			CAM_fn_xCineInfoGetTargetIncreaseSpeed(hCineinfoInit),
			CAM_fn_xCineInfoGetTargetDecreaseSpeed(hCineinfoInit)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile, C_CAM_EntryDNMFlags, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf, 2,
			"%d",
			CAM_fn_uwCineInfoGetDNMFlags(hCineinfoInit)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile, C_CAM_EntryIAFlags, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf, 2,
			"%d",
			CAM_fn_uwCineInfoGetIAFlags(hCineinfoInit)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile, C_CAM_EntryFocal, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf, 2,
			"%f",
			CAM_fn_xCineInfoGetFocal(hCineinfoInit)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile, C_CAM_EntryZMinMax, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf, 3,
			"%f, %f",
			CAM_fn_xCineInfoGetZMin(hCineinfoInit),
			CAM_fn_xCineInfoGetZMax(hCineinfoInit)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile, C_CAM_EntryViewport, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf,2,
			"%d",
			CAM_fn_eCineInfoGetTypeOfViewport(hCineinfoInit)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile, C_CAM_EntryChannel, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf, 2,
			"%i",
			CAM_fn_cCineInfoGetChannel(hCineinfoInit)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEntry(p_stFile, C_CAM_EntryActivation, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP
		(
			p_stFile, SCR_EF_SvL0_Scanf,2,
			"%d",
			CAM_fn_bCineInfoGetIsActive(hCineinfoInit)
		);
		/*---------------------------------------------------------------------------------------*/
		SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
	}
}
//ENDANNECY CB

//*****************************************************************************************************************
void ED_ACTORS_fn_v3dDataSaveMiniStructure(SCR_tdst_File_Description *p_stFile, struct tdstEngineObject_ *p_stObject)
{
	char szSection[SCR_CV_ui_Cfg_MaxLenName];
	MS_tdxHandleTo3dData h_3dData = p_stObject->h_3dData;

	if ( h_3dData != NULL )
	{
		SCR_M_SvL0_SaveBlankLine(p_stFile);
		SCR_M_SvL0_SaveComment(p_stFile, "**** 3dData mini-structure definition ****");

		sprintf(szSection,"%s:",C_Section3dDataDescription);
		SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);

		//Saves entries
		////////////////////

		//Saves Initial State
		CPA_Actor *pclActor = (CPA_Actor *)g_pclInterface->GetMainWorld()->fn_p_oFindObjectWithEngine(p_stObject, g_c_csActorType);
		//Gets Editor corresponding State
		CPA_State *pclEditorState = (CPA_State *)g_pclInterface->GetMainWorld()->fn_p_oFindObjectWithEngine((void *)h_3dData->h_InitialState, C_szStateTypeName);

		CString	csMsg = CString("The initial State of Actor '") + pclActor->GetName() + "' cannot be found";
		ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
										"Trying to save the initial State in a motor Actor (.car)",
										"ED_ACTORS_fn_v3dDataSaveMiniStructure(...)",
										E_ERROR_GRAVITY_WARNING,
										csMsg);
		ERROR_ASSERT( pclEditorState != NULL );

		if ( pclEditorState != NULL )
		{
			SCR_M_SvL0_SaveEntry(p_stFile, C_LevelCharacterInitialState, SCR_CC_C_Cfg_NoChar);
			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Normal, 1, pclEditorState->GetReferencedSectionName());
		}

		//Initial Object Table
		void *pvMotorOT = (void *)fn_h3dDataGetInitialObjectsTable(h_3dData);
		EditorObjectTable *pclInitOT = (EditorObjectTable *)g_pclInterface->GetMainWorld()->fn_p_oFindObjectWithEngine(pvMotorOT, C_szObjectTableTypeName);
		if ( pclInitOT != NULL )
		{
			CString csObjectTableParameter = pclInitOT->GetName();
			csObjectTableParameter = pclActor->m_pub_fn_pclGetFamily()->GetName() + "\\" + csObjectTableParameter;

			SCR_M_SvL0_SaveEntry(p_stFile, C_Entry3dDataInitialObjectsTable, SCR_CC_C_Cfg_NoChar);
			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%s", M_MAKECHAR(csObjectTableParameter));
		}

		//Saves Draw Mask
		SCR_M_SvL0_SaveEntry(p_stFile, C_Entry3dDataDrawMask, SCR_CC_C_Cfg_NoChar);
		//ANNECY VL PRT 08/04/98{
		//unsigned long ulDrawMask = (unsigned long)fn_l3dDataGetDrawMask(h_3dData);
		unsigned long ulDrawMask = (unsigned long)fn_l3dDataGetDrawMaskInit(h_3dData);
		//ENDANNECY VL}
		CString csFormattedString;
		csFormattedString.Format("%u", ulDrawMask);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%s", M_MAKECHAR(csFormattedString));

		//Saves Shadow Scale
		SCR_M_SvL0_SaveEntry(p_stFile, C_Entry3dDataShadowScale, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,3,"%f,%f",	fn_x3dDataGetShadowScaleX(h_3dData),
																																						fn_x3dDataGetShadowScaleY(h_3dData));

		//Saves Shadow Material
		SCR_tdst_Link_Table *p_tdstLinkTable = GMT_fn_p_stGetLinkTable();
		if ( p_tdstLinkTable !=  NULL )
		{
			SCR_tdst_Link_Value *p_tdstLinkValue = SCR_fnp_st_Link_SearchValue(p_tdstLinkTable, (unsigned long)fn_p_st3dDataGetShadowMaterial(h_3dData));

			if ( p_tdstLinkValue != NULL )
			{
				SCR_M_SvL0_SaveEntry(p_stFile, C_Entry3dDataShadowMaterial, SCR_CC_C_Cfg_NoChar);
				
				CString csKey = SCR_M_p_sz_Link_GetKey(p_tdstLinkValue);
				long lOffset = SCR_M_ul_Link_GetAdditionalLong(p_tdstLinkValue, 1);
				if ( lOffset > 0 )
					csKey = csKey.Right(csKey.GetLength() - lOffset);
				
				SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 2, "%s", M_MAKECHAR(csKey));
			}
		}
		//Saves Shadow Quality
		SCR_M_SvL0_SaveEntry(p_stFile, C_Entry3dDataShadowQuality, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%ld", fn_x3dDataGetShadowQuality(h_3dData));

		//Saves Shadow Heihgt
		SCR_M_SvL0_SaveEntry(p_stFile, C_Entry3dDataShadowHeight, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%f", *(fn_p_x3dDataGetSHWHeight(h_3dData)));

/* ANNECY MT - 09/11/98 {	Now, this value is set to 1 on init for every actor
		// Saves Brain computation frequency
		SCR_M_SvL0_SaveEntry(p_stFile,C_Entry3dDataBrainComputationFrequency,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2, "%d",fn_uc3dDataGetBrainComputationFrequency(h_3dData));
   END ANNECY MT }	*/

		// Saves Light computation frequency
		SCR_M_SvL0_SaveEntry(p_stFile,C_Entry3dDataLightComputationFrequency,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2, "%d",fn_uc3dDataGetLightComputationFrequency(h_3dData));

		// End Section
		SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL)

	}
}

//*****************************************************************************************************************
void ED_ACTORS_fn_vBrainSaveMiniStructure(CPA_Actor *pclActor,SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject)
{
	char szSection[SCR_CV_ui_Cfg_MaxLenName];
	MS_tdxHandleToBrain h_Brain = p_stObject->h_Brain;

//-----------------IR-------------------------
	CPA_EdIR_Brain	*pclBrain=pclActor->m_fn_pclGetModel()->m_fn_pclGetEditorModel()->m_pclBrain;
	/*
	if((
			pclBrain->m_clListOfIntelligenceBehaviours.GetCount()!=0 
			|| pclBrain->m_clListOfReflexBehaviours.GetCount()!=0 
			|| pclBrain->m_clListOfDeclarations.GetCount()!=0
			) 
		&& p_stObject->h_Brain!=NULL)
	*/
	if( p_stObject->h_Brain != NULL )
//--------------------------------------------
	{
		SCR_M_SvL0_SaveBlankLine(p_stFile);
		SCR_M_SvL0_SaveComment(p_stFile, "**** Brain mini-structure definition ****");
		
		sprintf(szSection,"%s:",C_SectionBrainDescription);
		SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);
		
		//Saves entries
		//...
//-----------------IR-------------------------
		EDAC_fn_vSaveInitValuesInBrainMS(pclActor,p_stFile);
//--------------------------------------------

// Shaitan FastC {
/*
		if (p_stObject->h_Brain->CFast_bIsC)
		{
			SCR_M_SvL0_SaveEntry(p_stFile, "CFast_IsC", SCR_CC_C_Cfg_NoChar);
			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1, "%ld", p_stObject->h_Brain->CFast_bIsC);
		}
		if (p_stObject->h_Brain->CFast_lFunction != 0)
		{
			SCR_M_SvL0_SaveEntry(p_stFile, "CFast_FunctionIndex", SCR_CC_C_Cfg_NoChar);
			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf, 1, "%ld", p_stObject->h_Brain->CFast_bIsC);
		}
*/
		//End Shaitan FastC }
		
		SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL)
	}
}

//*****************************************************************************************************************
void ED_ACTORS_fn_vPrtSourceSaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject)
{
	char szSection[SCR_CV_ui_Cfg_MaxLenName];
	MS_tdxHandleToMSPrtSrc h_PrtSrc = p_stObject->h_MSPrtSrc;

	if ( h_PrtSrc != NULL )
	{
		SCR_M_SvL0_SaveBlankLine(p_stFile);
		SCR_M_SvL0_SaveComment(p_stFile, "**** PrtSrc mini-structure definition ****");
		
		sprintf(szSection, "%s:", C_SectionMSPrtSrcDescription);
		SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);
		
		//Saves entries

		//
		SCR_M_SvL0_SaveEntry(p_stFile, C_EntryMSPrtSrcGeneratorActivation, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%s", fn_ucMSPrtSrcGetGeneratorActivation(h_PrtSrc) ? "ON" : "OFF");


		//Gets editor PG
		CPA_SaveObject *pclPG = (CPA_SaveObject *)g_pclInterface->GetMainWorld()->fn_p_oFindObjectWithEngine((void *)fn_p_stMSPrtSrcGetGenerator(h_PrtSrc), C_szPartGenGeneratorName);
		
		ERROR_PREPARE_M(g_c_csActorModuleNameForErrors,
										"Saving the MS 'PrtSource' in an Instance",
										"ED_ACTORS_fn_vPrtSourceSaveMiniStructure(...)",
										E_ERROR_GRAVITY_INSTABLE,
										"The Editor Object corresponding to the Motor value cannot be found : no save !");
		ERROR_ASSERT( pclPG != NULL );
		
		if ( pclPG != NULL )
		{
			//
			SCR_M_SvL0_SaveEntry(p_stFile, C_EntryMSPrtSrcParticleGenerator, SCR_CC_C_Cfg_NoChar);
			CString csRef = pclPG->GetReferencedSectionName();
			SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%s", M_MAKECHAR(csRef));
		}

		SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL)
	}
}

//ANNECY BBB 17/10/97 {
//*****************************************************************************************************************
void ED_ACTORS_fn_vAnimEffectSaveMiniStructure(SCR_tdst_File_Description *p_stFile, struct tdstEngineObject_ *p_stObject)
{
	char szSection[SCR_CV_ui_Cfg_MaxLenName];
  MS_tdxHandleToAnimEffect h_AnimEffect = p_stObject->h_AnimEffect;

  if ( h_AnimEffect != NULL )
	{
		SCR_M_SvL0_SaveBlankLine(p_stFile);
    SCR_M_SvL0_SaveComment(p_stFile, "**** AnimEffect mini-structure definition ****");

    sprintf(szSection,"%s:",C_SectionAnimEffectDescription);
		SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);

		//Saves entries
    MTH3D_tdstVector stVector;
    //shift phase
    stVector = fn_stAnimEffectGetShiftPhase(h_AnimEffect);
    SCR_M_SvL0_SaveEntry(p_stFile, C_EntryAnimEffectShiftPhase, SCR_CC_C_Cfg_NoChar);
    SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,4,"%f,%f,%f",
      MTH3D_M_xGetXofVector(&stVector),
      MTH3D_M_xGetYofVector(&stVector),
      MTH3D_M_xGetZofVector(&stVector)
    );
    //shift max
    stVector = fn_stAnimEffectGetShiftMax(h_AnimEffect);
    SCR_M_SvL0_SaveEntry(p_stFile, C_EntryAnimEffectShiftMax, SCR_CC_C_Cfg_NoChar);
    SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,4,"%f,%f,%f",
      MTH3D_M_xGetXofVector(&stVector),
      MTH3D_M_xGetYofVector(&stVector),
      MTH3D_M_xGetZofVector(&stVector)
    );
    //shift plus
    stVector = fn_stAnimEffectGetShiftPlus(h_AnimEffect);
    SCR_M_SvL0_SaveEntry(p_stFile, C_EntryAnimEffectShiftPlus, SCR_CC_C_Cfg_NoChar);
    SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,4,"%f,%f,%f",
      MTH3D_M_xGetXofVector(&stVector),
      MTH3D_M_xGetYofVector(&stVector),
      MTH3D_M_xGetZofVector(&stVector)
    );

		SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
	}
}
//ENDANNECY BBB 17/10/97 }

//*****************************************************************************************************************
void ED_ACTORS_fn_vSoundSaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject)
{
	char szSection[SCR_CV_ui_Cfg_MaxLenName];
	MS_tdxHandleToMSSound h_MSSound = p_stObject->h_MSSound;

	if ( h_MSSound != NULL )
	{
		SCR_M_SvL0_SaveBlankLine(p_stFile);
		SCR_M_SvL0_SaveComment(p_stFile, "**** MSSound mini-structure definition ****");
		
		sprintf(szSection, "%s:", C_SectionMSSoundDescription);
		SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);
		
		//Saves entries

		//Saturation Distance
		SCR_M_SvL0_SaveEntry(p_stFile, C_EntryMSSoundSaturationDistance, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%i", *fn_p_xMSSoundGetSaturationDistanceInit(h_MSSound));

		//BackGround Distance
		SCR_M_SvL0_SaveEntry(p_stFile, C_EntryMSSoundBackGroundDistance, SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%i", *fn_p_xMSSoundGetBackGroundDistanceInit(h_MSSound));

		SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL)
	}
}

// CHINA QZY (MT) 26/02/98 {
//*****************************************************************************************************************
void ED_ACTORS_fn_vMagnetSaveMiniStructure(SCR_tdst_File_Description *p_stFile,struct tdstEngineObject_ *p_stObject)
{
	char szSection[SCR_CV_ui_Cfg_MaxLenName];
	MS_tdxHandleToMSMagnet h_MSMagnet = p_stObject->h_MSMagnet;
	
	if ( h_MSMagnet != NULL )
	{
		SCR_M_SvL0_SaveBlankLine(p_stFile);
		SCR_M_SvL0_SaveComment(p_stFile, "**** MSMagnet mini-structure definition ****");
		
		sprintf(szSection,"%s:", C_SectionMSMagnetDescription);
		SCR_M_SvL0_SaveBeginSection(p_stFile,szSection,SCR_CC_C_Cfg_EOL);
				
		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryMagnetFar,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%f",*fn_p_xMSMagnetGetFarInit(h_MSMagnet));

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryMagnetNear,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%f",*fn_p_xMSMagnetGetNearInit(h_MSMagnet));
		
		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryMagnetStrength,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%f",*fn_p_xMSMagnetGetStrengthInit(h_MSMagnet));
		

		SCR_M_SvL0_SaveEntry(p_stFile,C_EntryMagnetDuration,SCR_CC_C_Cfg_NoChar);
		SCR_fn_v_SvL0_SaveParameters_MP(p_stFile, SCR_EF_SvL0_Scanf,2,"%d",*fn_p_ulMSMagnetGetDurationInit(h_MSMagnet));
		SCR_M_SvL0_SaveEndSection(p_stFile, SCR_CC_C_Cfg_EOL);
	}
}
// ENDCHINA QZY }
