reman3/Rayman_X/cpa/tempgrp/SCT/P5/Sectload.c

2210 lines
63 KiB
C
Raw Blame History

/* (c) Ubi Studios 1996*/
/* See Vincent Greco or Christophe Durand for any comment or question*/
/*For game material*/
#include "GMT/GmtHandl.h"
#include "ACP_base.h"
/*memory management of geometry.*/
#include "GEO.h"
#include "GLI.h"
#include "SCR.h"
/*Include For "Sector.h"*/
#include "MTH.h"
#include "COL.h"
#include "SPO.h"
#include "LST.h"
#include "VIG.h"
/*For the sound*/
#include "SND.h"
#include "SCT.h"
/*PATH NAME*/
#include "DPT.h"
/* binarization*/
/*#include "BIN.h"*/
#include "SNA.h"
SCR_tdst_Link_Table SECT_stLinkTable;
#define SCT_C_MAXBINSIZE 128*1024
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
extern float fScale;
extern FILE *dump;
#endif //U64CONVERTLOG
// } fin N64-format
/*Prototypes*/
SCR_tde_Anl_ReturnValue SECT_fn_xLoadSector(SCR_tdst_File_Description *_p_stFile,char *_p_szName, char *_ap_szParams[],SCR_tde_Anl_Action _eAction);
SCR_tde_Anl_ReturnValue SCT_fn_xLoadSectorBorder(SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction);
SCR_tde_Anl_ReturnValue SCT_fn_xLoadSectorsLink(SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction);
SCR_tde_Anl_ReturnValue SCT_fn_xLoadStaticLightsSector(SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction);
/*BEGIN OS 06-Mar-98*/
/*
SCR_tde_Anl_ReturnValue SECT_fn_xLoadBinSector(SCR_tdst_File_Description *_p_stFile,char *_p_szName, char *_ap_szParams[],SCR_tde_Anl_Action _eAction);
SCR_tde_Anl_ReturnValue SCT_fn_xLoadBinSectorBorder(SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction);
SCR_tde_Anl_ReturnValue SCT_fn_xLoadBinSectorsLink(SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction);
SCR_tde_Anl_ReturnValue SCT_fn_xLoadBinStaticLightsSector(SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction);
*/
/*END OS 06-Mar-98*/
/*End prototypes*/
/*Function*/
BOOL SECT_fn_bInitSectorLoading(void)
{
SCR_fn_v_RdL0_RegisterCallback("Sector", SECT_fn_xLoadSector, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback("SectorsLink", SCT_fn_xLoadSectorsLink, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback("Border", SCT_fn_xLoadSectorBorder, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback("StaticLights", SCT_fn_xLoadStaticLightsSector, SCR_CRC_c_RdL0_ForSection);
/*BEGIN OS 06-Mar-98*/
/*
SCR_fn_v_RdL0_RegisterCallback("Sector", SECT_fn_xLoadBinSector, SCR_CRC_c_RdL0_ForBinSection);
SCR_fn_v_RdL0_RegisterCallback("SectorsLink", SCT_fn_xLoadBinSectorsLink, SCR_CRC_c_RdL0_ForBinSection);
SCR_fn_v_RdL0_RegisterCallback("Border", SCT_fn_xLoadBinSectorBorder, SCR_CRC_c_RdL0_ForBinSection);
SCR_fn_v_RdL0_RegisterCallback("StaticLights", SCT_fn_xLoadBinStaticLightsSector, SCR_CRC_c_RdL0_ForBinSection);
*/
/*END OS 06-Mar-98*/
SCR_fn_v_Link_InitTable(&SECT_stLinkTable);
return TRUE;
}
/*End of */
/*Function */
/*void SECT_fn_vLoadSectorFile(char *szLoadPath, char *szFileName)
{
char szOldPath[C_MaxLenPath];
// Deplacement dans le repertoire des datas
getcwd(szOldPath,C_MaxLenPath);
chdir(szLoadPath);
SCRIPT_vRegisterPath(szLoadPath);
SCRIPT_vSetResultSubSection((unsigned long)NULL);
SCRIPT_ulAnalyseFile(szFileName);
//M_CheckScriptError();
chdir(szOldPath);
}
//End of
*/
/*Function*/
SCR_tde_Anl_ReturnValue SECT_fn_xLoadSector(SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction)
{
SECT_tdxHandleOfSectorObject hSector;
SECT_tdxHandleOfSectorObject hNewSector;
HIE_tdxHandleToSuperObject hSuperObjectSector;
SECT_tdxHandleOfElementLstGraphicInteraction hGElement;
SECT_tdxHandleOfElementLstCollisionInteraction hColElement;
SECT_tdxHandleOfElementLstActivityInteraction hActElement;
SECT_tdxHandleOfElementLstSoundInteraction hSoundElement;
SECT_tdxHandleOfElementLstStaticLights hStaticLightsElement;
SCR_tdst_Cxt_Values *p_stValues;
/*char a255_cTempName[255];*/
switch (_eAction)
{
case SCR_EA_Anl_BeginSection:
VIG_fn_vAddToProgressBar(1);
/* new Sector for that section*/
hNewSector=SECT_fn_hCreateSector();
/*I return my own handle*/
SCR_M_RdL0_SetSectionLong (0,0,hNewSector);
SCR_M_RdL0_SetContextLong (0,0,hNewSector);
/* LinkTable management*/
{
char a255_cLinkKey[255];
SCR_M_RdL0_ComputeOpenSectionNameR(0,a255_cLinkKey);
/* JO 09/12/97*/
#ifdef _DEBUG
strcpy(hNewSector->szSectorName,a255_cLinkKey);
#endif /* _DEBUG */
SCR_M_v_Link_SetAdditionalLong(
SCR_fnp_st_Link_SetValue(&SECT_stLinkTable,
a255_cLinkKey,(unsigned long)hNewSector),
1,
strlen(a255_cLinkKey)-strlen(SCR_M_RdL0_GetCompleteSectionNameR(0)));
}
/* //Get Path
strcpy(a255_cTempName,fn_szGetLevelsDataPath());
strcat(a255_cTempName,"\\");
strcat(a255_cTempName,SCR_M_RdL0_GetCompleteSectionNameR(0));
SCR_fnp_st_Link_SetValue(
&SECT_stLinkTable,
a255_cTempName,
(unsigned long)hNewSector
);
*/
hNewSector->pSkyVisualMaterial = NULL;
hNewSector->FogIntensity = 0;
break;
case SCR_EA_Anl_Entry:
/* Here is my own handle*/
SCR_M_RdL0_GetContextLong(0,0,SECT_tdxHandleOfSectorObject,hSector);
/* do the link with the hierarchy*/
if (strcmp(_p_szName,"LinkedSuperObject")==0)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
hSuperObjectSector = ( HIE_tdxHandleToSuperObject )SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0);
HIE_fn_vSetSuperObjectObjectAndType(hSuperObjectSector,hSector,HIE_C_ulSector);
}
}
/* Add a Element to the activity interaction list*/
else if (strcmp(_p_szName,"AddLstActivity")==0)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
hActElement=SECT_fn_hCreateElementLstActivityInteraction();
SECT_fn_vSetSectorPointedElementLSTActivityInt(hActElement,
(HIE_tdxHandleToSuperObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInActivityInteraction),hActElement);
}
}
/* Add a Element to the graphic interaction list*/
else if (strcmp(_p_szName,"AddLstGraphic")==0)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
hGElement=SECT_fn_hCreateElementLstGraphicInteraction();
SECT_fn_vSetSectorPointedElementLSTGraphicInt(hGElement,
(HIE_tdxHandleToSuperObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
SECT_fn_vSetLevelElementLSTGraphicInt(hGElement, (short)atoi(_ap_szParams[1]));
/* Begin Shaitan ModeLook*/
SECT_fn_vSetModeElementLSTGraphicInt(hGElement, (char)atoi(_ap_szParams[2]));
/* End Shaitan ModeLook*/
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInGraphicInteraction),hGElement);
}
}
/* Add a Element to the collision interaction list*/
else if (strcmp(_p_szName,"AddLstCollision")==0)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
hColElement=SECT_fn_hCreateElementLstCollisionInteraction();
SECT_fn_vSetSectorPointedElementLSTCollisionInt(hColElement,
(HIE_tdxHandleToSuperObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInCollisionInteraction),hColElement);
}
}
/* Add a Element to the Sound interaction list*/
else if (strcmp(_p_szName,"AddLstSound")==0)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
hSoundElement=SECT_fn_hCreateElementLstSoundInteraction();
SECT_fn_vSetSectorPointedElementLSTSoundInt(hSoundElement,
(HIE_tdxHandleToSuperObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
SCT_fn_vSetVolumeLSTSoundInt(hSoundElement,atol(_ap_szParams[1]));
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInSoundInteraction),hSoundElement);
}
}
/* Add a Element to the static lights list*/
else if (strcmp(_p_szName,"AddLstStaticLights")==0)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
hStaticLightsElement=SECT_fn_hCreateElementLstStaticLights();
SECT_fn_vSetHandleOfLightsInStaticLightsList(hStaticLightsElement,(GLI_tdxHandleToLight)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
LST2_M_StaticAddTail(&(hSector->stListOfStaticLights),hStaticLightsElement);
}
}
/* Virtual or not virtual*/
else if (strcmp(_p_szName,"Virtual")==0)
{
SECT_fn_vSetOnVirtualSector(hSector);
}
/* Priority*/
else if (strcmp(_p_szName,"Priority")==0)
{
SECT_fn_vSetSectorPriority(hSector, (char)atoi(_ap_szParams[0]));
}
/* Sky( ScrollX, ScrollY, FogCoef, Material )*/
else if (strcmp(_p_szName,"Sky")==0)
{
hSector->FogIntensity = (char)atoi(_ap_szParams[2]);
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[3], SCR_CDF_uw_Anl_Normal);
hSector->pSkyVisualMaterial = (void *)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0);
GLI_xSetMaterialTextureScrollingCoef( hSector->pSkyVisualMaterial, 0, 1, (float)atof(_ap_szParams[0]), (float)atof(_ap_szParams[1]) );
}
break;
case SCR_EA_Anl_EndSection:
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/*End of */
/*ANNECY Shaitan Add {*/
/*Function*/
SCR_tde_Anl_ReturnValue SCT_fn_xLoadSectorBorder (SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction)
{
SECT_tdxHandleOfSectorObject hSector;
MTH3D_tdstVector stMaxPoint, stMinPoint;
if (_eAction == SCR_EA_Anl_Entry)
{
/* Get the handle of the section*/
SCR_M_RdL0_GetContextLong(-1,0,SECT_tdxHandleOfSectorObject,hSector);
/* loading min point of border*/
if (strcmp(_p_szName,"MinPointOfBorder")==0)
{
MTH3D_M_vSetVectorElements(&stMinPoint,
GLI_M_FloatToValue(atof(_ap_szParams[0])),
GLI_M_FloatToValue(atof(_ap_szParams[1])),
GLI_M_FloatToValue(atof(_ap_szParams[2])));
SECT_fn_vSetMinPointInBorder(hSector, &stMinPoint);
}
/* loading max point of border*/
if (strcmp(_p_szName,"MaxPointOfBorder")==0)
{
MTH3D_M_vSetVectorElements(&stMaxPoint,
GLI_M_FloatToValue(atof(_ap_szParams[0])),
GLI_M_FloatToValue(atof(_ap_szParams[1])),
GLI_M_FloatToValue(atof(_ap_szParams[2])));
SECT_fn_vSetMaxPointInBorder(hSector, &stMaxPoint);
}
/* loading of Zmax border*/
if (strcmp(_p_szName,"ZmaxOfBorder")==0)
{
stMaxPoint.xX = stMaxPoint.xY = MTH_C_InfinitMinus;
stMaxPoint.xZ = GLI_M_FloatToValue(atof(_ap_szParams[0]));
SECT_fn_vSetMaxPointInBorder(hSector, &stMaxPoint);
#ifdef ACTIVE_EDITOR
SECT_fn_vSetZmaxOfBorder(hSector, GLI_M_FloatToValue(atof(_ap_szParams[0])));
#endif /*ACTIVE_EDITOR*/
}
}
return SCR_ERV_Anl_NormalReturn;
}
/*End of */
/*ENDANNECY Shaitan Add }*/
/* fbolefeysot - 07/05/98{cleanage*/
/*Function*/
/*SCR_tde_Anl_ReturnValue SCT_fn_xLoadGoThroughSector(SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction)
{
SECT_tdxHandleOfSectorObject hSector;
ACP_tdxHandleOfObject hBorderGeometric;
if (_eAction==SCR_EA_Anl_Entry)
{
// Get the handle of the section
SCR_M_RdL0_GetContextLong(-1,0,SECT_tdxHandleOfSectorObject,hSector);
// Loading of border object
if (strcmp(_p_szName,"GoThrough")==0)
{
hBorderGeometric =GLI_pLoadGeometricInFile(_ap_szParams[0]);
// Connect Sector with its BorderGeometric
SECT_fn_vSetBorderObjectInSector(hSector,hBorderGeometric);
}
}
return SCR_ERV_Anl_NormalReturn;
}
*/
/*End of */
/*END fbolefeysot}*/
/*Function*/
SCR_tde_Anl_ReturnValue SCT_fn_xLoadSectorsLink(SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction)
{
SECT_tdxHandleOfSectorObject hSector;
SECT_tdxHandleOfElementLstGraphicInteraction hGElement;
SECT_tdxHandleOfElementLstCollisionInteraction hColElement;
SECT_tdxHandleOfElementLstActivityInteraction hActElement;
SECT_tdxHandleOfElementLstSoundInteraction hSoundElement;
SCT_tdxHandleOfLstSoundEvent hSoundEventElement;
SCR_tdst_Cxt_Values *p_stValues ;
if (_eAction==SCR_EA_Anl_Entry)
{
/* Get the handle of the section*/
SCR_M_RdL0_GetContextLong(-1,0,SECT_tdxHandleOfSectorObject,hSector);
/* Add a Element to the activity interaction list*/
if (strcmp(_p_szName,"AddLstActivity")==0)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
hActElement=SECT_fn_hCreateElementLstActivityInteraction();
SECT_fn_vSetSectorPointedElementLSTActivityInt(hActElement,
(HIE_tdxHandleToSuperObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInActivityInteraction),hActElement);
}
}
/* Add a Element to the graphic interaction list*/
if (strcmp(_p_szName,"AddLstGraphic")==0)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
hGElement=SECT_fn_hCreateElementLstGraphicInteraction();
SECT_fn_vSetSectorPointedElementLSTGraphicInt(hGElement,
(HIE_tdxHandleToSuperObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
SECT_fn_vSetLevelElementLSTGraphicInt(hGElement, (short)atoi(_ap_szParams[1]));
/* Begin Shaitan ModeLook*/
SECT_fn_vSetModeElementLSTGraphicInt(hGElement, (char)atoi(_ap_szParams[2]));
/* End Shaitan ModeLook*/
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInGraphicInteraction),hGElement);
}
}
/* Add a Element to the collision interaction list*/
if (strcmp(_p_szName,"AddLstCollision")==0)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
hColElement=SECT_fn_hCreateElementLstCollisionInteraction();
SECT_fn_vSetSectorPointedElementLSTCollisionInt(hColElement,
(HIE_tdxHandleToSuperObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInCollisionInteraction),hColElement);
}
}
/* Add a Element to the Sound interaction list*/
if (strcmp(_p_szName,"AddLstSound")==0)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
hSoundElement=SECT_fn_hCreateElementLstSoundInteraction();
SECT_fn_vSetSectorPointedElementLSTSoundInt(hSoundElement,
(HIE_tdxHandleToSuperObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
SCT_fn_vSetVolumeLSTSoundInt(hSoundElement,atol(_ap_szParams[1]));
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInSoundInteraction),hSoundElement);
}
}
/* Add a Element to the Sound Event list*/
if (strcmp(_p_szName,"AddLstSoundEvent")==0)
{
/* JO 04/08/97*/
if( strcmp(_ap_szParams[0],"FromAllSectors")==0 )
{
hSoundEventElement = SCT_fn_hCreateElementLstSoundEvent();
SCT_fn_vSetSectorPointedElementLSTSoundEvent(hSoundEventElement,NULL);
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[1], SCR_CDF_uw_Anl_Normal);
if( p_stValues )
{
/* CGHT SNA*/
if (SNA_fn_ucGetLoadType()==SNA_SAVE_SNAPSHOT) /* MR0110*/
SNA_fn_vWriteSoundEntryInSoundTableFile(SND_fn_ulGetEventBinIdFromPointer((SND_tdxHandleToSoundEvent)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0)) ,(unsigned long)&(hSoundEventElement->uSoundEvent.pstPtr));
SCT_fn_vSetEventListElementLSTSoundEvent(hSoundEventElement,(SND_tdstBlockEvent *)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
}
LST2_M_StaticAddTail(&(hSector->stListOfSoundEvent),hSoundEventElement);
}
else
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
hSoundEventElement=SCT_fn_hCreateElementLstSoundEvent();
SCT_fn_vSetSectorPointedElementLSTSoundEvent(hSoundEventElement,
(HIE_tdxHandleToSuperObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[1], SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
/* CGHT SNA*/
if (SNA_fn_ucGetLoadType()==SNA_SAVE_SNAPSHOT) /* MR0110*/
SNA_fn_vWriteSoundEntryInSoundTableFile(SND_fn_ulGetEventBinIdFromPointer((SND_tdxHandleToSoundEvent)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0)) ,(unsigned long)&(hSoundEventElement->uSoundEvent.pstPtr));
SCT_fn_vSetEventListElementLSTSoundEvent(hSoundEventElement,(SND_tdstBlockEvent *)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
}
LST2_M_StaticAddTail(&(hSector->stListOfSoundEvent),hSoundEventElement);
}
}
}
/* Virtual or not virtual*/
if (strcmp(_p_szName,"Virtual")==0)
{
SECT_fn_vSetOnVirtualSector(hSector);
}
/* Priority*/
if (strcmp(_p_szName,"Priority")==0)
{
SECT_fn_vSetSectorPriority(hSector, (char)atoi(_ap_szParams[0]));
}
if (strcmp(_p_szName,"CameraType")==0)
{
hSector->cCameraType = atoi(_ap_szParams[0]);
}
if (strcmp(_p_szName,"ZFar")==0)
{
hSector->xZFar = (MTH_tdxReal) atof(_ap_szParams[0]);
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
hSector->xZFar = (float) (( (long)( (hSector->xZFar*fScale) + 0.5) ) / fScale);
fprintf(dump,"sector : %s ZFar = %f\n",hSector->szSectorName,hSector->xZFar);
fflush(dump);
#endif //U64CONVERTLOG
// } fin N64-format
}
}
return SCR_ERV_Anl_NormalReturn;
}
/*End of */
/*Function*/
SCR_tde_Anl_ReturnValue SCT_fn_xLoadStaticLightsSector(SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction)
{
SECT_tdxHandleOfSectorObject hSector;
SECT_tdxHandleOfElementLstStaticLights hStaticLightsElement;
SCR_tdst_Cxt_Values *p_stValues ;
if (_eAction==SCR_EA_Anl_Entry)
{
/* Get the handle of the section*/
SCR_M_RdL0_GetContextLong(-1,0,SECT_tdxHandleOfSectorObject,hSector);
/* Add a Element to the static lights list*/
if (strcmp(_p_szName,"AddLstStaticLights")==0)
{
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
if(p_stValues)
{
hStaticLightsElement=SECT_fn_hCreateElementLstStaticLights();
SECT_fn_vSetHandleOfLightsInStaticLightsList(hStaticLightsElement,(GLI_tdxHandleToLight)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
LST2_M_StaticAddTail(&(hSector->stListOfStaticLights),hStaticLightsElement);
}
}
}
return SCR_ERV_Anl_NormalReturn;
}
/*End of */
/*Function*/
SECT_tdxHandleOfSectorObject SECT_fn_hCreateSector (void)
{
MTH3D_tdstVector stMin, stMax;
SECT_tdxHandleOfSectorObject hNewSector;
/*hNewSector=(SECT_tdxHandleOfSectorObject)malloc(sizeof(struct SECT_tdstSector_));*/
MMG_fn_vAddMemoryInfo( MMG_C_lTypeSector , MMG_C_lSubTypeSector , 0 );
GEO_M_CPAMalloc( hNewSector, SECT_tdxHandleOfSectorObject, sizeof(struct SECT_tdstSector_), E_uwGEONotEnoughtMemory);
SECT_fn_vSetOffVirtualSector(hNewSector);
SECT_fn_vSetSectorPriority(hNewSector, C_SectorNormalPriority);
LST2_M_DynamicInitAnchor(&(hNewSector->stListOfCharacters));
LST2_M_DynamicInitAnchor(&(hNewSector->stListOfDNMLights));
LST2_M_StaticInitAnchor(&(hNewSector->stListOfStaticLights));
LST2_M_StaticInitAnchor(&(hNewSector->stListOfSectorsInGraphicInteraction));
LST2_M_StaticInitAnchor(&(hNewSector->stListOfSectorsInCollisionInteraction));
LST2_M_StaticInitAnchor(&(hNewSector->stListOfSectorsInActivityInteraction));
LST2_M_StaticInitAnchor(&(hNewSector->stListOfSectorsInSoundInteraction));
LST2_M_StaticInitAnchor(&(hNewSector->stListOfSoundEvent));
/* init min&max*/
stMin.xX = stMin.xY = stMin.xZ = MTH_C_InfinitPlus;
stMax.xX = stMax.xY = stMax.xZ = MTH_C_InfinitMinus;
/* set border*/
SECT_fn_vSetMinPointInBorder(hNewSector, &stMin);
SECT_fn_vSetMaxPointInBorder(hNewSector, &stMax);
#ifdef ACTIVE_EDITOR
SECT_fn_vSetZmaxOfBorder(hNewSector, MTH_C_InfinitMinus);
SECT_fn_vSetRealZmax(hNewSector, MTH_C_InfinitMinus);
#endif /*ACTIVE_EDITOR*/
hNewSector->cCameraType = 0;
hNewSector->xZFar = MTH_C_ZERO;
hNewSector->cCounter = 0;
return hNewSector;
}
/*End of */
/*Function*/
void SECT_fn_vSetOnVirtualSector(SECT_tdxHandleOfSectorObject hSector)
{
hSector->xVirtual=TRUE;
}
/*End of*/
/*Function*/
void SECT_fn_vSetOffVirtualSector(SECT_tdxHandleOfSectorObject hSector)
{
hSector->xVirtual=FALSE;
}
/*End of*/
/*Function*/
void SECT_fn_vSetSectorPriority(SECT_tdxHandleOfSectorObject hSector, char cPriority)
{
hSector->cPriority=cPriority;
}
/*End of*/
/*Function*/
char SECT_fn_cGetSectorPriority(SECT_tdxHandleOfSectorObject hSector)
{
return hSector->cPriority;
}
/*End of*/
/*ANNECY Shaitan Add {*/
/*Function*/
void SECT_fn_vSetMinPointInBorder (SECT_tdxHandleOfSectorObject _hSector,
MTH3D_tdstVector *_p_stMinPoint)
{
MTH3D_M_vCopyVector(&_hSector->stMinMaxPoints[0], _p_stMinPoint);
}
/*End of*/
/*Function*/
void SECT_fn_vSetMaxPointInBorder (SECT_tdxHandleOfSectorObject _hSector,
MTH3D_tdstVector *_p_stMaxPoint)
{
MTH3D_M_vCopyVector(&_hSector->stMinMaxPoints[1], _p_stMaxPoint);
}
/*End of*/
#ifdef ACTIVE_EDITOR
/*Function*/
MTH_tdxReal SECT_fn_xGetZmaxOfBorder (SECT_tdxHandleOfSectorObject _hSector)
{
return _hSector->xZmaxOfBorder;
}
/*End of*/
/*Function*/
void SECT_fn_vSetZmaxOfBorder (SECT_tdxHandleOfSectorObject _hSector, MTH_tdxReal _xZmaxOfBorder)
{
_hSector->xZmaxOfBorder = _xZmaxOfBorder;
}
/*End of*/
/*Function*/
MTH_tdxReal SECT_fn_xGetRealZmax (SECT_tdxHandleOfSectorObject _hSector)
{
return _hSector->xRealZmax;
}
/*End of*/
/*Function*/
void SECT_fn_vSetRealZmax (SECT_tdxHandleOfSectorObject _hSector, MTH_tdxReal _xRealZmax)
{
_hSector->xRealZmax = _xRealZmax;
}
/*End of*/
#endif /*ACTIVE_EDITOR*/
/*ENDANNECY Shaitan Add }*/
/* fbolefeysot - 07/05/98{cleanage*/
/*Function*/
/*void SECT_fn_vSetBorderObjectInSector(SECT_tdxHandleOfSectorObject hSector,
ACP_tdxHandleOfObject hBorderGeometric)
{
hSector->hBorderBoundsObject=hBorderGeometric;
}
*//*End of */
/*END fbolefeysot}*/
/*Function*/
SECT_tdxHandleOfElementLstGraphicInteraction SECT_fn_hCreateElementLstGraphicInteraction(void)
{
SECT_tdxHandleOfElementLstGraphicInteraction hGElement;
/*hGElement=(SECT_tdxHandleOfElementLstGraphicInteraction)malloc( sizeof(SECT_tdstListOfSOSectorsInGraphicInteraction));*/
MMG_fn_vAddMemoryInfo( MMG_C_lTypeSector , MMG_C_lSubTypeGraphicElement , 0 );
GEO_M_CPAMalloc( hGElement, SECT_tdxHandleOfElementLstGraphicInteraction, sizeof(SECT_tdstListOfSOSectorsInGraphicInteraction), E_uwGEONotEnoughtMemory);
LST2_M_StaticInitElement(hGElement);
return hGElement;
}
/*End of */
/*Function*/
void SECT_fn_vSetSectorPointedElementLSTGraphicInt(SECT_tdxHandleOfElementLstGraphicInteraction hGElement,
HIE_tdxHandleToSuperObject hSectorSuperObject)
{
hGElement->hPointerOfSectorSO = hSectorSuperObject;
}
/*End of */
/*Function*/
void SECT_fn_vSetLevelElementLSTGraphicInt(SECT_tdxHandleOfElementLstGraphicInteraction hGElement,
short wLevelOfDetail)
{
hGElement->wLevelOfDetail = wLevelOfDetail;
}
/*End of */
/* Begin Shaitan ModeLook*/
/*Function*/
void SECT_fn_vSetModeElementLSTGraphicInt(SECT_tdxHandleOfElementLstGraphicInteraction hGElement,
char cDisplayMode)
{
hGElement->cDisplayMode = cDisplayMode;
}
/*End of */
/* End Shaitan ModeLook*/
/*Function*/
SECT_tdxHandleOfElementLstCollisionInteraction SECT_fn_hCreateElementLstCollisionInteraction(void)
{
SECT_tdxHandleOfElementLstCollisionInteraction hColElement;
/*hColElement=(SECT_tdxHandleOfElementLstCollisionInteraction)malloc( sizeof(SECT_tdstListOfSOSectorsInCollisionInteraction));*/
MMG_fn_vAddMemoryInfo( MMG_C_lTypeSector , MMG_C_lSubTypeCollisionElement , 0 );
GEO_M_CPAMalloc( hColElement, SECT_tdxHandleOfElementLstCollisionInteraction, sizeof(SECT_tdstListOfSOSectorsInCollisionInteraction), E_uwGEONotEnoughtMemory);
LST2_M_StaticInitElement(hColElement);
return hColElement;
}
/*End of */
/*Function*/
void SECT_fn_vSetSectorPointedElementLSTCollisionInt(SECT_tdxHandleOfElementLstCollisionInteraction hColElement,
HIE_tdxHandleToSuperObject hSectorSuperObject)
{
hColElement->hPointerOfSectorSO = hSectorSuperObject;
}
/*End of */
/*Function*/
SECT_tdxHandleOfElementLstActivityInteraction SECT_fn_hCreateElementLstActivityInteraction(void)
{
SECT_tdxHandleOfElementLstActivityInteraction hActElement;
/*hActElement=(SECT_tdxHandleOfElementLstActivityInteraction)malloc( sizeof(SECT_tdstListOfSOSectorsInActivityInteraction));*/
MMG_fn_vAddMemoryInfo( MMG_C_lTypeSector , MMG_C_lSubTypeActiveElement , 0 );
GEO_M_CPAMalloc( hActElement, SECT_tdxHandleOfElementLstActivityInteraction, sizeof(SECT_tdstListOfSOSectorsInActivityInteraction), E_uwGEONotEnoughtMemory);
LST2_M_StaticInitElement(hActElement);
return hActElement;
}
/*End of */
/*Function*/
void SECT_fn_vSetSectorPointedElementLSTActivityInt(SECT_tdxHandleOfElementLstActivityInteraction hActElement,
HIE_tdxHandleToSuperObject hSectorSuperObject)
{
hActElement->hPointerOfSectorSO = hSectorSuperObject;
}
/*End of */
/*Function*/
SECT_tdxHandleOfElementLstSoundInteraction SECT_fn_hCreateElementLstSoundInteraction(void)
{
SECT_tdxHandleOfElementLstSoundInteraction hSndElement;
/*hSndElement=(SECT_tdxHandleOfElementLstSoundInteraction)malloc( sizeof(SECT_tdstListOfSOSectorsInSoundInteraction));*/
MMG_fn_vAddMemoryInfo( MMG_C_lTypeSector , MMG_C_lSubTypeSoundElement , 0 );
GEO_M_CPAMalloc( hSndElement, SECT_tdxHandleOfElementLstSoundInteraction, sizeof(SECT_tdstListOfSOSectorsInSoundInteraction), E_uwGEONotEnoughtMemory);
LST2_M_StaticInitElement(hSndElement);
return hSndElement;
}
/*End of */
/*Function*/
SCT_tdxHandleOfLstSoundEvent SCT_fn_hCreateElementLstSoundEvent(void)
{
SCT_tdxHandleOfLstSoundEvent hSndEventElement;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeSector , MMG_C_lSubTypeSoundEvent , 0 );
GEO_M_CPAMalloc( hSndEventElement, SCT_tdxHandleOfLstSoundEvent, sizeof(SCT_tdstListOfSoundEvent), E_uwGEONotEnoughtMemory);
LST2_M_StaticInitElement(hSndEventElement);
return hSndEventElement;
}
/*End of */
/*Function*/
void SECT_fn_vSetSectorPointedElementLSTSoundInt(SECT_tdxHandleOfElementLstSoundInteraction hSndElement,
HIE_tdxHandleToSuperObject hSectorSuperObject)
{
hSndElement->hPointerOfSectorSO = hSectorSuperObject;
}
/*End of */
/*Function*/
void SCT_fn_vSetVolumeLSTSoundInt(SECT_tdxHandleOfElementLstSoundInteraction hSndElement,long lVolume)
{
hSndElement->lVolume = lVolume;
}
/*End of*/
/*Function*/
void SCT_fn_vSetSectorPointedElementLSTSoundEvent(SCT_tdxHandleOfLstSoundEvent hSndEventElement,
HIE_tdxHandleToSuperObject hSectorSuperObject)
{
hSndEventElement->hPointerOfSectorSO = hSectorSuperObject;
}
/*End of */
/*Function*/
void SCT_fn_vSetEventListElementLSTSoundEvent(SCT_tdxHandleOfLstSoundEvent hSndEventElement,SND_tdxHandleToSoundEvent p_stSoundEvent)
{
hSndEventElement->uSoundEvent.pstPtr = p_stSoundEvent;
}
/*End of*/
/*Function*/
SECT_tdxHandleOfElementLstStaticLights SECT_fn_hCreateElementLstStaticLights(void)
{
SECT_tdxHandleOfElementLstStaticLights hStaticLightsElement;
/*hStaticLightsElement=(SECT_tdxHandleOfElementLstStaticLights)malloc( sizeof(struct SECT_tdstListOfStaticLights_));*/
MMG_fn_vAddMemoryInfo( MMG_C_lTypeSector , MMG_C_lSubTypeStaticLightElement , 0 );
GEO_M_CPAMalloc( hStaticLightsElement, SECT_tdxHandleOfElementLstStaticLights, sizeof(struct SECT_tdstListOfStaticLights_), E_uwGEONotEnoughtMemory);
LST2_M_StaticInitElement(hStaticLightsElement);
return hStaticLightsElement;
}
/*End of*/
/*Function*/
void SECT_fn_vSetHandleOfLightsInStaticLightsList(
SECT_tdxHandleOfElementLstStaticLights hStaticLightsElement,
GLI_tdxHandleToLight hStaticLights
)
{
hStaticLightsElement->hStaticLights= hStaticLights;
}
/* End of*/
SCR_tdst_Link_Table *SECT_fn_pGetLinkTable(void)
{
return &SECT_stLinkTable;
}
void SECT_fn_vDisinit(void)
{
SCR_fn_v_Link_CloseTable(&SECT_stLinkTable);
}
/* Binarisation */
SECT_tdxHandleOfSectorObject SCT_fn_hLoadSector(
char* _szSectionName)
{
SCR_tdst_Cxt_Values *p_stValues ;
SCR_tdst_Link_Value *p_stLinkValue;
unsigned long ulResult;
unsigned int uiPos;
/* p_stLinkValue = BIN_fn_p_stSearchShortKey(
SECT_fn_pGetLinkTable(),
_szSectionName);
*/
uiPos = 0;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value, uiPos, p_stLinkValue,SCR_M_st_Link_GetDynamicArray(SECT_fn_pGetLinkTable()));
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(SECT_fn_pGetLinkTable()));
}
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 (SECT_tdxHandleOfSectorObject) ulResult;
}
else
return (SECT_tdxHandleOfSectorObject) NULL;
}
else return (SECT_tdxHandleOfSectorObject) p_stLinkValue->ulValue;
}
/*
void SCT_fn_vPrepareSaveBinaryBloc()
{
BIN_fn_vCreateBinaryIds(
SECT_fn_pGetLinkTable(),
BIN_C_SCTID);
GLI_fn_vPrepareSaveLightBinaryBloc();
}
// Macro for saving a LST2Anchor (of any type)
#define BIN_SCT_M_SaveLST2( \
Type, \
StructPtr) \
p_cBufferPointer = BIN_fn_p_cPutLong( \
p_cBufferPointer, \
0L); \
p_cBufferPointer = BIN_fn_p_cPutLong( \
p_cBufferPointer, \
0L); \
p_cBufferPointer = BIN_fn_p_cPutLong( \
p_cBufferPointer, \
(unsigned long) LST2_M_##Type##GetNumberOfElements(##StructPtr##));
// Macro for saving a LST2Element (of any type)
#define BIN_SCT_M_SaveLST2Elt() \
// NextBrother \
p_cBufferPointer = BIN_fn_p_cPutLong( \
p_cBufferPointer, \
0L); \
// PrevBrother \
p_cBufferPointer = BIN_fn_p_cPutLong( \
p_cBufferPointer, \
0L); \
// Father \
p_cBufferPointer = BIN_fn_p_cPutLong( \
p_cBufferPointer, \
0L);
// fbolefeysot - 07/05/98{cleanage
//extern CPA_EXPORT ACP_tdxHandleOfObject BIN_SECT_fn_hGetGeoObjOfSector(
// SECT_tdstSector *_pSector);
//END fbolefeysot}
extern CPA_EXPORT SECT_tdxHandleOfElementLstDNMLights BIN_SECT_fn_hGetFirstDNMLightsListInSector(
SECT_tdstSector *_pSector);
extern CPA_EXPORT SECT_tdxHandleOfElementLstStaticLights BIN_SECT_fn_hGetFirstStaticLightsListInSector(
SECT_tdstSector *_pSector);
extern CPA_EXPORT SECT_tdxHandleOfElementLstCharacter BIN_SECT_fn_hGetFirstCharListInSector(
SECT_tdstSector *_pSector);
extern CPA_EXPORT SECT_tdxHandleOfElementLstCollisionInteraction BIN_SECT_fn_hGetFirstCollisionNodeInCollisionList(
SECT_tdstSector *_pSector);
extern CPA_EXPORT SECT_tdxHandleOfElementLstActivityInteraction BIN_SECT_fn_hGetFirstActivityNodeInActivityList(
SECT_tdstSector *_pSector);
extern CPA_EXPORT SECT_tdxHandleOfElementLstGraphicInteraction BIN_SECT_fn_hGetFirstGraphicNodeInGraphicList(
SECT_tdstSector *_pSector);
extern CPA_EXPORT SECT_tdxHandleOfElementLstSoundInteraction BIN_SECT_fn_hGetFirstSoundNodeInSoundList(
SECT_tdstSector *_pSector);
extern CPA_EXPORT SCT_tdxHandleOfLstSoundEvent BIN_SCT_fn_hGetFirstSoundEventNodeInSoundEventList(
SECT_tdstSector *_pSector);
extern CPA_EXPORT void BIN_SECT_fn_vAddTailCharListNode(
SECT_tdstSector *_pSector,
SECT_tdxHandleOfElementLstCharacter hNode);
extern CPA_EXPORT void BIN_SECT_fn_vAddTailCollisionListNode(
SECT_tdstSector *_pSector,
SECT_tdxHandleOfElementLstCollisionInteraction hNode);
extern CPA_EXPORT void BIN_SECT_fn_vAddTailActivityListNode(
SECT_tdstSector *_pSector,
SECT_tdxHandleOfElementLstActivityInteraction hNode);
extern CPA_EXPORT void BIN_SECT_fn_vAddTailGraphicListNode(
SECT_tdstSector *_pSector,
SECT_tdxHandleOfElementLstGraphicInteraction hNode);
extern CPA_EXPORT void BIN_SECT_fn_vAddTailSoundListNode(
SECT_tdstSector *_pSector,
SECT_tdxHandleOfElementLstSoundInteraction hNode);
extern CPA_EXPORT void BIN_SCT_fn_vAddTailSoundEventListNode(
SECT_tdstSector *_pSector,
SCT_tdxHandleOfLstSoundEvent hNode);
extern CPA_EXPORT void BIN_SECT_fn_vAddTailDNMLightsListNode(
SECT_tdstSector *_pSector,
SECT_tdxHandleOfElementLstDNMLights hNode);
extern CPA_EXPORT void BIN_SECT_fn_vAddTailStaticLightsListNode(
SECT_tdstSector *_pSector,
SECT_tdxHandleOfElementLstStaticLights hNode);
*/
/*
unsigned long SCT_fn_ulWriteBinaryBloc(
unsigned long _ulStructAddress,
char* _p_cDestBuffer)
{
SECT_tdxHandleOfSectorObject hSCT = (SECT_tdxHandleOfSectorObject) _ulStructAddress;
char *p_cBufferPointer =_p_cDestBuffer;
int iCnt;
p_cBufferPointer = BIN_fn_p_cPutBool(
p_cBufferPointer,
hSCT->xVirtual);
// Save LST2 Anchor
BIN_SCT_M_SaveLST2(
Dynamic,
&hSCT->stListOfCharacters)
// Save LST2 Anchor
BIN_SCT_M_SaveLST2(
Static,
&hSCT->stListOfStaticLights)
// Save LST2 Anchor
BIN_SCT_M_SaveLST2(
Dynamic,
&hSCT->stListOfDNMLights)
// Save LST2 Anchor
BIN_SCT_M_SaveLST2(
Static,
&hSCT->stListOfSectorsInGraphicInteraction)
// Save LST2 Anchor
BIN_SCT_M_SaveLST2(
Static,
&hSCT->stListOfSectorsInCollisionInteraction)
// Save LST2 Anchor
BIN_SCT_M_SaveLST2(
Static,
&hSCT->stListOfSectorsInActivityInteraction)
// Save LST2 Anchor
BIN_SCT_M_SaveLST2(
Static,
&hSCT->stListOfSectorsInSoundInteraction)
// Save LST2 Anchor
BIN_SCT_M_SaveLST2(
Static,
&hSCT->stListOfSoundEvent)
// Save LST2 List
{ SECT_tdxHandleOfElementLstCharacter hCur;
BIN_SECT_M_ForEachCharListInSector(hSCT, hCur, iCnt)
{
p_cBufferPointer = BIN_fn_p_cPutPointer(
p_cBufferPointer,
(unsigned long) hCur->hPointerOfCharacter,
HIE_fn_p_stGetSuperObjectLinkTable());
BIN_SCT_M_SaveLST2Elt()
}
}
// Save LST2 List
{ SECT_tdxHandleOfElementLstStaticLights hCur;
BIN_SECT_M_ForEachStaticLightsListInSector(hSCT, hCur, iCnt)
{
p_cBufferPointer = BIN_fn_p_cPutPointer(
p_cBufferPointer,
(unsigned long) hCur->hStaticLights,
LGT_fn_p_stGetLightLinkTable());
BIN_SCT_M_SaveLST2Elt()
}
}
// Save LST2 List
{ SECT_tdxHandleOfElementLstDNMLights hCur;
BIN_SECT_M_ForEachDNMLightsListInSector(hSCT, hCur, iCnt)
{
p_cBufferPointer = BIN_fn_p_cPutPointer(
p_cBufferPointer,
(unsigned long) hCur->hDNMLights,
LGT_fn_p_stGetLightLinkTable());
BIN_SCT_M_SaveLST2Elt()
}
}
// Save LST2 List
{ SECT_tdxHandleOfElementLstGraphicInteraction hCur;
BIN_SECT_M_ForEachGraphicNodeInGraphicInteractionList(hSCT, hCur, iCnt)
{
p_cBufferPointer = BIN_fn_p_cPutLong(
p_cBufferPointer,
(unsigned long) hCur->wLevelOfDetail);
p_cBufferPointer = BIN_fn_p_cPutPointer(
p_cBufferPointer,
(unsigned long) hCur->hPointerOfSectorSO,
HIE_fn_p_stGetSuperObjectLinkTable());
BIN_SCT_M_SaveLST2Elt()
}
}
// Save LST2 List
{ SECT_tdxHandleOfElementLstCollisionInteraction hCur;
BIN_SECT_M_ForEachCollisionNodeInCollisionInteractionList(hSCT, hCur, iCnt)
{
p_cBufferPointer = BIN_fn_p_cPutPointer(
p_cBufferPointer,
(unsigned long) hCur->hPointerOfSectorSO,
HIE_fn_p_stGetSuperObjectLinkTable());
BIN_SCT_M_SaveLST2Elt()
}
}
// Save LST2 List
{ SECT_tdxHandleOfElementLstActivityInteraction hCur;
BIN_SECT_M_ForEachActivityNodeInActivityInteractionList(hSCT, hCur, iCnt)
{
p_cBufferPointer = BIN_fn_p_cPutPointer(
p_cBufferPointer,
(unsigned long) hCur->hPointerOfSectorSO,
HIE_fn_p_stGetSuperObjectLinkTable());
BIN_SCT_M_SaveLST2Elt()
}
}
// Save LST2 List
{ SECT_tdxHandleOfElementLstSoundInteraction hCur;
BIN_SECT_M_ForEachSoundNodeInSoundInteractionList(hSCT, hCur, iCnt)
{
p_cBufferPointer = BIN_fn_p_cPutPointer(
p_cBufferPointer,
(unsigned long) hCur->hPointerOfSectorSO,
HIE_fn_p_stGetSuperObjectLinkTable());
p_cBufferPointer = BIN_fn_p_cPutLong(
p_cBufferPointer,
(unsigned long) hCur->lVolume);
BIN_SCT_M_SaveLST2Elt()
}
}
// Save LST2 List
{ SCT_tdxHandleOfLstSoundEvent hCur;
unsigned long ulSoundID;
BIN_SCT_M_ForEachSoundEventNodeInSoundEventList(hSCT, hCur, iCnt)
{
p_cBufferPointer = BIN_fn_p_cPutPointer(
p_cBufferPointer,
(unsigned long) hCur->hPointerOfSectorSO,
HIE_fn_p_stGetSuperObjectLinkTable());
ulSoundID=SND_fn_ulGetEventBinIdFromPointer((SND_tdstBlockEvent*)hCur->uSoundEvent.pstPtr);
p_cBufferPointer = BIN_fn_p_cPutLong(
p_cBufferPointer,
ulSoundID);
BIN_SCT_M_SaveLST2Elt()
}
}
return p_cBufferPointer - _p_cDestBuffer;
}
*/
/*
void SCT_fn_vWriteAllSectorBinaryBlocs(
char *_szBinaryFileName)
{
SCT_fn_vPrepareSaveBinaryBloc();
BIN_fn_vPutBinaryDataIntoFileFromLinkTable(
_szBinaryFileName,
SECT_fn_pGetLinkTable(),
SCT_C_MAXBINSIZE,
SCT_fn_ulWriteBinaryBloc);
}
*/
/* Restores real pointer*/
/*
#define BIN_M_ResetPointer( \
LinkTable, \
Pointer, \
Struct) \
ulAddress = BIN_fn_ulGetAddressFromId( \
LinkTable, \
(unsigned long)##Pointer##); \
if (ulAddress != 0) \
Pointer = (##Struct##) ulAddress; \
else \
{ BIN_fn_vGetScriptSectionNameFromIdAndRemoveIt( \
szSectionName, \
LinkTable, \
(unsigned long)##Pointer##); \
if ( (*szSectionName!='#') \
&& (*szSectionName!=0) ) \
{ SCR_tdst_Cxt_Values *p_stValues; \
p_stValues = SCR_fnp_st_RdL0_AnalyseSection( \
szSectionName, \
SCR_CDF_uw_Anl_Normal); \
if (p_stValues) \
Pointer = (##Struct##) p_stValues->a_ulValues[0]; \
} \
}
*/
/*
#define BIN_M_ResetPointer( \
LinkTable, \
Pointer, \
Struct) \
(##Struct##)BIN_fn_p_cGetPointer((char*)&Pointer,(unsigned long*)&Pointer,LinkTable);
#define BIN_M_ResetPointerSuperObject( \
LinkTable, \
Pointer, \
Struct) \
(void) BIN_fn_p_cGetBinaryId((unsigned char *) (&##Pointer##), &ulAddress); \
*((unsigned long *)&##Pointer##) = (unsigned long) (ulAddress);
#define BIN_M_ResetPointerSuperObject2ndPass( \
LinkTable, \
Pointer, \
Struct) \
ulAddress = BIN_fn_ulGetAddressFromId( \
LinkTable, \
(unsigned long)##Pointer##); \
Pointer = (##Struct##) ulAddress;
#define BIN_SCT_M_NewLST2( \
Type, \
Pointer, \
LST2Type) \
//iNb = LST2_M_##Type##GetNumberOfElements(Pointer); \
// Clean function, but not working \
iNb = ((long *) Pointer)[2]; \
memset( \
Pointer, \
0, \
sizeof(LST2_M_##Type##AnchorDeclaration(LST2Type)));
// Adds an item to a LST2
#define BIN_SCT_M_AddLST2( \
Type, \
Pointer, \
LST2Type) \
LST2_M_##Type##AddTail( \
Pointer, \
(LST2Type) p_xLST2pos);
// Sets current buffer position
#define BIN_SCT_M_GetPtr( \
Struct) \
Struct *p_stCur = (Struct *) p_xLST2pos;
// Go to next entry
#define BIN_SCT_M_AddPtr( \
Struct) \
p_xLST2pos += sizeof(Struct);
*/
/*
unsigned long SCT_fn_ulReadSectorBinaryBloc(
char *_p_cLoadedBuffer,
unsigned long _ulLoadedBufferSize)
{
SECT_tdxHandleOfSectorObject hSCT = NULL;
// unsigned long ulAddress;
// char szSectionName[256];
char *p_xLST2pos = NULL;
int iCnt, iNb;
GEO_M_CPAMalloc(
hSCT,
SECT_tdxHandleOfSectorObject,
_ulLoadedBufferSize,
E_uwGEONotEnoughtMemory);
memcpy(
(char *) hSCT,
_p_cLoadedBuffer,
_ulLoadedBufferSize);
// Ajout d'une nouvelle liste: (Ronan Bel)
// - Remplir la macro BIN_SCT_M_NewLST2
// - La recopier en M_BIN_AddLST2
// - Remplir la macro M_BIN_GetPTr
// - La recoper en M_BIN_AddPtr
// - Faire des BIN_M_ResetPointer si n<>cessaire
{
BIN_SCT_M_NewLST2(
Dynamic,
&hSCT->stListOfCharacters,
SECT_tdxHandleOfElementLstCharacter)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SECT_tdstListOfSOCharacters)
BIN_SCT_M_AddLST2(
Dynamic,
&hSCT->stListOfCharacters,
SECT_tdxHandleOfElementLstCharacter)
BIN_SCT_M_AddPtr(
SECT_tdstListOfSOCharacters)
}
}
{
BIN_SCT_M_NewLST2(
Static,
&hSCT->stListOfStaticLights,
SECT_tdxHandleOfElementLstStaticLights)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SECT_tdstListOfStaticLights)
BIN_SCT_M_AddLST2(
Static,
&hSCT->stListOfStaticLights,
SECT_tdxHandleOfElementLstStaticLights)
BIN_M_ResetPointer(
LGT_fn_p_stGetLightLinkTable(),
p_stCur->hStaticLights,
GLI_tdxHandleToLight)
BIN_SCT_M_AddPtr(
SECT_tdstListOfStaticLights)
}
}
{
BIN_SCT_M_NewLST2(
Dynamic,
&hSCT->stListOfDNMLights,
SECT_tdxHandleOfElementLstDNMLights)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SECT_tdstListOfDNMLights)
BIN_SCT_M_AddLST2(
Dynamic,
&hSCT->stListOfDNMLights,
SECT_tdxHandleOfElementLstDNMLights)
BIN_M_ResetPointer(
LGT_fn_p_stGetLightLinkTable(),
p_stCur->hDNMLights,
GLI_tdxHandleToLight)
BIN_SCT_M_AddPtr(
SECT_tdstListOfDNMLights)
}
}
{
BIN_SCT_M_NewLST2(
Static,
&hSCT->stListOfSectorsInGraphicInteraction,
SECT_tdxHandleOfElementLstGraphicInteraction)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SECT_tdstListOfSOSectorsInGraphicInteraction)
BIN_SCT_M_AddLST2(
Static,
&hSCT->stListOfSectorsInGraphicInteraction,
SECT_tdxHandleOfElementLstGraphicInteraction)
BIN_SCT_M_AddPtr(
SECT_tdstListOfSOSectorsInGraphicInteraction)
}
}
{
BIN_SCT_M_NewLST2(
Static,
&hSCT->stListOfSectorsInCollisionInteraction,
SECT_tdxHandleOfElementLstCollisionInteraction)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SECT_tdstListOfSOSectorsInCollisionInteraction)
BIN_SCT_M_AddLST2(
Static,
&hSCT->stListOfSectorsInCollisionInteraction,
SECT_tdxHandleOfElementLstCollisionInteraction)
BIN_SCT_M_AddPtr(
SECT_tdstListOfSOSectorsInCollisionInteraction)
}
}
{
BIN_SCT_M_NewLST2(
Static,
&hSCT->stListOfSectorsInActivityInteraction,
SECT_tdxHandleOfElementLstActivityInteraction)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SECT_tdstListOfSOSectorsInActivityInteraction)
BIN_SCT_M_AddLST2(
Static,
&hSCT->stListOfSectorsInActivityInteraction,
SECT_tdxHandleOfElementLstActivityInteraction)
BIN_SCT_M_AddPtr(
SECT_tdstListOfSOSectorsInActivityInteraction)
}
}
{
BIN_SCT_M_NewLST2(
Static,
&hSCT->stListOfSectorsInSoundInteraction,
SECT_tdxHandleOfElementLstSoundInteraction)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SECT_tdstListOfSOSectorsInSoundInteraction)
BIN_SCT_M_AddLST2(
Static,
&hSCT->stListOfSectorsInSoundInteraction,
SECT_tdxHandleOfElementLstSoundInteraction)
BIN_SCT_M_AddPtr(
SECT_tdstListOfSOSectorsInSoundInteraction)
}
}
{
SND_tdstBlockEvent *p_stSoundEvent;
BIN_SCT_M_NewLST2(
Static,
&hSCT->stListOfSoundEvent,
SCT_tdxHandleOfLstSoundEvent)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SCT_tdstListOfSoundEvent)
BIN_SCT_M_AddLST2(
Static,
&hSCT->stListOfSoundEvent,
SCT_tdxHandleOfLstSoundEvent)
p_stSoundEvent = SND_fn_pGetBinEvent((unsigned long)p_stCur->uSoundEvent.Id);
p_stCur->uSoundEvent.pstPtr = p_stSoundEvent;
BIN_SCT_M_AddPtr(
SCT_tdstListOfSoundEvent)
}
}
return (unsigned long) hSCT;
}
*/
/* AR 970913 */
/* Read function without allocation and direct resolving of pointers */
/*
void SCT_fn_vResolveSectorBinaryBloc2(unsigned long _ulAddress)
{
SECT_tdxHandleOfSectorObject hSCT = NULL;
// unsigned long ulAddress;
// char szSectionName[256];
char *p_xLST2pos;
int iCnt, iNb;
hSCT=(SECT_tdxHandleOfSectorObject)_ulAddress;
// fbolefeysot - 07/05/98{cleanage
//END fbolefeysot}
p_xLST2pos = ((char *) hSCT) + sizeof(SECT_tdstSector);
// Ajout d'une nouvelle liste: (Ronan Bel)
// Remplir la macro BIN_SCT_M_NewLST2
// La recopier en M_BIN_AddLST2
// Remplir la macro M_BIN_GetPTr
// La recoper en M_BIN_AddPtr
// Faire des BIN_M_ResetPointer si n<>cessaire
{
BIN_SCT_M_NewLST2(
Dynamic,
&hSCT->stListOfCharacters,
SECT_tdxHandleOfElementLstCharacter)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SECT_tdstListOfSOCharacters)
BIN_SCT_M_AddLST2(
Dynamic,
&hSCT->stListOfCharacters,
SECT_tdxHandleOfElementLstCharacter)
BIN_M_ResetPointer(
HIE_fn_p_stGetSuperObjectLinkTable(),
p_stCur->hPointerOfCharacter,
HIE_tdxHandleToSuperObject)
BIN_SCT_M_AddPtr(
SECT_tdstListOfSOCharacters)
}
}
{
BIN_SCT_M_NewLST2(
Static,
&hSCT->stListOfStaticLights,
SECT_tdxHandleOfElementLstStaticLights)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SECT_tdstListOfStaticLights)
BIN_SCT_M_AddLST2(
Static,
&hSCT->stListOfStaticLights,
SECT_tdxHandleOfElementLstStaticLights)
BIN_M_ResetPointer(
LGT_fn_p_stGetLightLinkTable(),
p_stCur->hStaticLights,
GLI_tdxHandleToLight)
BIN_SCT_M_AddPtr(
SECT_tdstListOfStaticLights)
}
}
{
BIN_SCT_M_NewLST2(
Dynamic,
&hSCT->stListOfDNMLights,
SECT_tdxHandleOfElementLstDNMLights)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SECT_tdstListOfDNMLights)
BIN_SCT_M_AddLST2(
Dynamic,
&hSCT->stListOfDNMLights,
SECT_tdxHandleOfElementLstDNMLights)
BIN_M_ResetPointer(
LGT_fn_p_stGetLightLinkTable(),
p_stCur->hDNMLights,
GLI_tdxHandleToLight)
BIN_SCT_M_AddPtr(
SECT_tdstListOfDNMLights)
}
}
{
BIN_SCT_M_NewLST2(
Static,
&hSCT->stListOfSectorsInGraphicInteraction,
SECT_tdxHandleOfElementLstGraphicInteraction)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SECT_tdstListOfSOSectorsInGraphicInteraction)
BIN_SCT_M_AddLST2(
Static,
&hSCT->stListOfSectorsInGraphicInteraction,
SECT_tdxHandleOfElementLstGraphicInteraction)
BIN_M_ResetPointer(
HIE_fn_p_stGetSuperObjectLinkTable(),
p_stCur->hPointerOfSectorSO,
HIE_tdxHandleToSuperObject)
BIN_SCT_M_AddPtr(
SECT_tdstListOfSOSectorsInGraphicInteraction)
}
}
{
BIN_SCT_M_NewLST2(
Static,
&hSCT->stListOfSectorsInCollisionInteraction,
SECT_tdxHandleOfElementLstCollisionInteraction)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SECT_tdstListOfSOSectorsInCollisionInteraction)
BIN_SCT_M_AddLST2(
Static,
&hSCT->stListOfSectorsInCollisionInteraction,
SECT_tdxHandleOfElementLstCollisionInteraction)
BIN_M_ResetPointer(
HIE_fn_p_stGetSuperObjectLinkTable(),
p_stCur->hPointerOfSectorSO,
HIE_tdxHandleToSuperObject)
BIN_SCT_M_AddPtr(
SECT_tdstListOfSOSectorsInCollisionInteraction)
}
}
{
BIN_SCT_M_NewLST2(
Static,
&hSCT->stListOfSectorsInActivityInteraction,
SECT_tdxHandleOfElementLstActivityInteraction)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SECT_tdstListOfSOSectorsInActivityInteraction)
BIN_SCT_M_AddLST2(
Static,
&hSCT->stListOfSectorsInActivityInteraction,
SECT_tdxHandleOfElementLstActivityInteraction)
BIN_M_ResetPointer(
HIE_fn_p_stGetSuperObjectLinkTable(),
p_stCur->hPointerOfSectorSO,
HIE_tdxHandleToSuperObject)
BIN_SCT_M_AddPtr(
SECT_tdstListOfSOSectorsInActivityInteraction)
}
}
{
BIN_SCT_M_NewLST2(
Static,
&hSCT->stListOfSectorsInSoundInteraction,
SECT_tdxHandleOfElementLstSoundInteraction)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SECT_tdstListOfSOSectorsInSoundInteraction)
BIN_SCT_M_AddLST2(
Static,
&hSCT->stListOfSectorsInSoundInteraction,
SECT_tdxHandleOfElementLstSoundInteraction)
BIN_M_ResetPointer(
HIE_fn_p_stGetSuperObjectLinkTable(),
p_stCur->hPointerOfSectorSO,
HIE_tdxHandleToSuperObject)
BIN_SCT_M_AddPtr(
SECT_tdstListOfSOSectorsInSoundInteraction)
}
}
{
SND_tdstBlockEvent *p_stSoundEvent;
BIN_SCT_M_NewLST2(
Static,
&hSCT->stListOfSoundEvent,
SCT_tdxHandleOfLstSoundEvent)
for (iCnt = 0; iCnt < iNb; iCnt++)
{
BIN_SCT_M_GetPtr(
SCT_tdstListOfSoundEvent)
BIN_SCT_M_AddLST2(
Static,
&hSCT->stListOfSoundEvent,
SCT_tdxHandleOfLstSoundEvent)
BIN_M_ResetPointer(
HIE_fn_p_stGetSuperObjectLinkTable(),
p_stCur->hPointerOfSectorSO,
HIE_tdxHandleToSuperObject)
p_stSoundEvent = SND_fn_pGetBinEvent((unsigned long)p_stCur->uSoundEvent.Id);
p_stCur->uSoundEvent.pstPtr = p_stSoundEvent;
BIN_SCT_M_AddPtr(
SCT_tdstListOfSoundEvent)
}
}
}
*/
/*
structures dans SECTOR.H
fonctions dans SECTEXT.H (public)
*/
/*
void SCT_fn_vResolveSectorBinaryBloc(
unsigned long _ulStructAdr)
{
SECT_tdxHandleOfSectorObject hSCT = (SECT_tdxHandleOfSectorObject) _ulStructAdr;
unsigned long ulAddress;
int iCnt;
{ SECT_tdxHandleOfElementLstCharacter hCur;
BIN_SECT_M_ForEachCharListInSector(hSCT, hCur, iCnt)
{
BIN_M_ResetPointerSuperObject2ndPass(
HIE_fn_p_stGetSuperObjectLinkTable(),
hCur->hPointerOfCharacter,
HIE_tdxHandleToSuperObject)
}
}
{ SECT_tdxHandleOfElementLstGraphicInteraction hCur;
BIN_SECT_M_ForEachGraphicNodeInGraphicInteractionList(hSCT, hCur, iCnt)
{
BIN_M_ResetPointerSuperObject2ndPass(
HIE_fn_p_stGetSuperObjectLinkTable(),
hCur->hPointerOfSectorSO,
HIE_tdxHandleToSuperObject)
}
}
{ SECT_tdxHandleOfElementLstCollisionInteraction hCur;
BIN_SECT_M_ForEachCollisionNodeInCollisionInteractionList(hSCT, hCur, iCnt)
{
BIN_M_ResetPointerSuperObject2ndPass(
HIE_fn_p_stGetSuperObjectLinkTable(),
hCur->hPointerOfSectorSO,
HIE_tdxHandleToSuperObject)
}
}
{ SECT_tdxHandleOfElementLstActivityInteraction hCur;
BIN_SECT_M_ForEachActivityNodeInActivityInteractionList(hSCT, hCur, iCnt)
{
BIN_M_ResetPointerSuperObject2ndPass(
HIE_fn_p_stGetSuperObjectLinkTable(),
hCur->hPointerOfSectorSO,
HIE_tdxHandleToSuperObject)
}
}
{ SECT_tdxHandleOfElementLstSoundInteraction hCur;
BIN_SECT_M_ForEachSoundNodeInSoundInteractionList(hSCT, hCur, iCnt)
{
BIN_M_ResetPointerSuperObject2ndPass(
HIE_fn_p_stGetSuperObjectLinkTable(),
hCur->hPointerOfSectorSO,
HIE_tdxHandleToSuperObject)
}
}
{ SCT_tdxHandleOfLstSoundEvent hCur;
BIN_SCT_M_ForEachSoundEventNodeInSoundEventList(hSCT, hCur, iCnt)
{
BIN_M_ResetPointerSuperObject2ndPass(
HIE_fn_p_stGetSuperObjectLinkTable(),
hCur->hPointerOfSectorSO,
HIE_tdxHandleToSuperObject)
}
}
}
void SCT_fn_vReadAllSectorBinaryBlocs(
char *_szBinaryFileName)
{
BIN_fn_vReadDataFromLinkTable(
SECT_fn_pGetLinkTable(),
SCT_fn_ulReadSectorBinaryBloc,
SCT_C_MAXBINSIZE,
_szBinaryFileName);
}
char* SCT_fn_p_cGenericAllocationFunction(unsigned long _ulSize)
{
char* p_cBuffer;
GEO_M_CPAMalloc(p_cBuffer,char*,_ulSize,E_uwGEONotEnoughtMemory);
return p_cBuffer;
}
void SCT_fn_vReadAllSectorBinaryBlocs2(char *_szBinaryFileName)
{
BIN_fn_vReadDataFromLinkTableWithoutAllocation(SECT_fn_pGetLinkTable(),
SCT_fn_vResolveSectorBinaryBloc2,
SCT_C_MAXBINSIZE,
_szBinaryFileName,
SCT_fn_p_cGenericAllocationFunction);
}
void SCT_fn_vResolveAllSectorBinaryBlocs(
void)
{
BIN_fn_vResolvePointersFromLinkTable(
SECT_fn_pGetLinkTable(),
SCT_fn_vResolveSectorBinaryBloc);
}
*/
/*
BEGIN OS 06-Mar-98
Callbacks for bin files.
*/
/*
NOTE : the 'Sector' section has only subsections so I've commented out some code converted from previous version.
*/
/*
SCR_tde_Anl_ReturnValue SECT_fn_xLoadBinSector(SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction)
{
SECT_tdxHandleOfSectorObject hSector;
SECT_tdxHandleOfSectorObject hNewSector;
if( _eAction != SCR_EA_Anl_BeginSection )
{
//do whatever ...
return SCR_ERV_Anl_NormalReturn;
}
SCR_fn_v_Bin_BeginSection(_p_stFile);
VIG_fn_vAddToProgressBar(1);
// new Sector for that section
hSector = hNewSector=SECT_fn_hCreateSector();
//I return my own handle
SCR_M_RdL0_SetSectionLong (0,0,hNewSector);
SCR_M_RdL0_SetContextLong (0,0,hNewSector);
// LinkTable management
{
char a255_cLinkKey[255];
SCR_M_RdL0_ComputeOpenSectionNameR(0,a255_cLinkKey);
// JO 09/12/97
#if (defined(_DEBUG) || defined(USE_PROFILER))
strcpy(hNewSector->szSectorName,a255_cLinkKey);
#endif /* _DEBUG || USE_PROFILER
SCR_M_v_Link_SetAdditionalLong(
SCR_fnp_st_Link_SetValue(&SECT_stLinkTable,
a255_cLinkKey,(unsigned long)hNewSector),
1,
strlen(a255_cLinkKey)-strlen(SCR_M_RdL0_GetCompleteSectionNameR(0)));
}
SCR_fn_v_Bin_EndSection(_p_stFile);
return SCR_ERV_Anl_NormalReturn;
}
*/
/*-----------------------------------------*/
/*
SCR_tde_Anl_ReturnValue SCT_fn_xLoadBinSectorsLink(SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction)
{
SECT_tdxHandleOfSectorObject hSector;
SECT_tdxHandleOfElementLstGraphicInteraction hGElement;
SECT_tdxHandleOfElementLstCollisionInteraction hColElement;
SECT_tdxHandleOfElementLstActivityInteraction hActElement;
SECT_tdxHandleOfElementLstSoundInteraction hSoundElement;
SCT_tdxHandleOfLstSoundEvent hSoundEventElement;
SCR_tdst_Cxt_Values *p_stValues ;
char szP0[MAX_PATH], szP1[MAX_PATH], chTag;
unsigned short usQ, i;
if( _eAction != SCR_EA_Anl_BeginSection )
{
//do whatever ...
return SCR_ERV_Anl_NormalReturn;
}
SCR_fn_v_Bin_BeginSection(_p_stFile);
// Get the handle of the section
SCR_M_RdL0_GetContextLong(-1,0,SECT_tdxHandleOfSectorObject,hSector);
do{
chTag=SCR_fn_ch_Bin_GetCHAR( _p_stFile );
switch (chTag)
{
case 0: //AddLstActivity
{
usQ = SCR_fn_us_Bin_GetUSHORT( _p_stFile );
for (i=0; i<usQ; i++)
{
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP0 );
p_stValues = SCR_fnp_st_Bin_GetREFERENCE( szP0 );
if(p_stValues)
{
hActElement=SECT_fn_hCreateElementLstActivityInteraction();
SECT_fn_vSetSectorPointedElementLSTActivityInt(hActElement,
(HIE_tdxHandleToSuperObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInActivityInteraction),hActElement);
}
}
}
break;
case 1: //AddLstGraphic
{
usQ = SCR_fn_us_Bin_GetUSHORT( _p_stFile );
for (i=0; i<usQ; i++)
{
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP0 );
p_stValues = SCR_fnp_st_Bin_GetREFERENCE( szP0 );
if(p_stValues)
{
hGElement=SECT_fn_hCreateElementLstGraphicInteraction();
SECT_fn_vSetSectorPointedElementLSTGraphicInt(hGElement,
(HIE_tdxHandleToSuperObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
SECT_fn_vSetLevelElementLSTGraphicInt(hGElement, SCR_fn_s_Bin_GetSHORT( _p_stFile ));
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInGraphicInteraction),hGElement);
}
}
}
break;
case 2: //AddLstCollision
{
usQ = SCR_fn_us_Bin_GetUSHORT( _p_stFile );
for (i=0; i<usQ; i++)
{
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP0 );
p_stValues = SCR_fnp_st_Bin_GetREFERENCE( szP0 );
if(p_stValues)
{
hColElement=SECT_fn_hCreateElementLstCollisionInteraction();
SECT_fn_vSetSectorPointedElementLSTCollisionInt(hColElement,
(HIE_tdxHandleToSuperObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInCollisionInteraction),hColElement);
}
}
}
break;
case 3: //AddLstSound
{
usQ = SCR_fn_us_Bin_GetUSHORT( _p_stFile );
for (i=0; i<usQ; i++)
{
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP0 );
p_stValues = SCR_fnp_st_Bin_GetREFERENCE( szP0 );
if(p_stValues)
{
hSoundElement=SECT_fn_hCreateElementLstSoundInteraction();
SECT_fn_vSetSectorPointedElementLSTSoundInt(hSoundElement,
(HIE_tdxHandleToSuperObject)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
SCT_fn_vSetVolumeLSTSoundInt(hSoundElement, SCR_fn_l_Bin_GetLONG( _p_stFile ));
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInSoundInteraction),hSoundElement);
}
}
}
break;
case 4: //AddLstSoundEvent
{
usQ = SCR_fn_us_Bin_GetUSHORT( _p_stFile );
for (i=0; i<usQ; i++)
{
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP0 );
if (strcmp(szP0,"FromAllSectors")==0 )
{
hSoundEventElement = SCT_fn_hCreateElementLstSoundEvent();
SCT_fn_vSetSectorPointedElementLSTSoundEvent(hSoundEventElement,NULL);
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP1 );
p_stValues = SCR_fnp_st_Bin_GetREFERENCE( szP1 );
if( p_stValues )
{
if (SNA_fn_ucGetLoadType()==SNA_SAVE_SNAPSHOT) // MR0110
SNA_fn_vWriteSoundEntryInSoundTableFile(SND_fn_ulGetEventBinIdFromPointer((SND_tdxHandleToSoundEvent)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0)) ,(unsigned long)&(hSoundEventElement->uSoundEvent.pstPtr));
SCT_fn_vSetEventListElementLSTSoundEvent(hSoundEventElement,(SND_tdstBlockEvent *)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
}
LST2_M_StaticAddTail(&(hSector->stListOfSoundEvent),hSoundEventElement);
}
else
{
p_stValues = SCR_fnp_st_Bin_GetREFERENCE( szP0 );
if(p_stValues)
{
hSoundEventElement=SCT_fn_hCreateElementLstSoundEvent();
SCT_fn_vSetSectorPointedElementLSTSoundEvent(hSoundEventElement,
(HIE_tdxHandleToSuperObject)SCR_M_ul_RdL0_ExtractLongValue( p_stValues, 0 ));
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP1 );
p_stValues = SCR_fnp_st_Bin_GetREFERENCE( szP1 );
if(p_stValues)
{
if (SNA_fn_ucGetLoadType()==SNA_SAVE_SNAPSHOT) // MR0110
SNA_fn_vWriteSoundEntryInSoundTableFile(SND_fn_ulGetEventBinIdFromPointer((SND_tdxHandleToSoundEvent)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0)) ,(unsigned long)&(hSoundEventElement->uSoundEvent.pstPtr));
SCT_fn_vSetEventListElementLSTSoundEvent(hSoundEventElement,(SND_tdstBlockEvent *)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
}
LST2_M_StaticAddTail(&(hSector->stListOfSoundEvent),hSoundEventElement);
}
}
}
}
break;
case 7: //Virtual
{
unsigned short usVirtual;
usVirtual = SCR_fn_us_Bin_GetUSHORT( _p_stFile );
if (usVirtual > 0)
SECT_fn_vSetOnVirtualSector(hSector);
}
break;
}
}while (chTag!=-1);
SCR_fn_v_Bin_EndSection(_p_stFile);
return SCR_ERV_Anl_NormalReturn;
}
*/
/*-----------------------------------------*/
/*
SCR_tde_Anl_ReturnValue SCT_fn_xLoadBinSectorBorder(SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction)
{
SECT_tdxHandleOfSectorObject hSector;
MTH3D_tdstVector stMaxPoint, stMinPoint;
float xZ;
float f0, f1, f2;
char chTag;
if( _eAction != SCR_EA_Anl_BeginSection )
{
//do whatever ...
return SCR_ERV_Anl_NormalReturn;
}
SCR_fn_v_Bin_BeginSection(_p_stFile);
SCR_M_RdL0_GetContextLong(-1,0,SECT_tdxHandleOfSectorObject,hSector);
do{
chTag=SCR_fn_ch_Bin_GetCHAR( _p_stFile );
switch (chTag)
{
case 0: //ZmaxOfBorder
{
xZ = SCR_fn_f_Bin_GetFLOAT( _p_stFile );
stMaxPoint.xX = stMaxPoint.xY = MTH_C_InfinitMinus;
stMaxPoint.xZ = xZ;
SECT_fn_vSetMaxPointInBorder(hSector, &stMaxPoint);
#ifdef ACTIVE_EDITOR
SECT_fn_vSetZmaxOfBorder(hSector, xZ);
#endif //ACTIVE_EDITOR
}
break;
case 1: //MinPointOfBorder
{
f0 = SCR_fn_f_Bin_GetFLOAT( _p_stFile );
f1 = SCR_fn_f_Bin_GetFLOAT( _p_stFile );
f2 = SCR_fn_f_Bin_GetFLOAT( _p_stFile );
MTH3D_M_vSetVectorElements(&stMinPoint, f0, f1, f2);
SECT_fn_vSetMinPointInBorder(hSector, &stMinPoint);
}
break;
case 2: //MaxPointOfBorder
{
f0 = SCR_fn_f_Bin_GetFLOAT( _p_stFile );
f1 = SCR_fn_f_Bin_GetFLOAT( _p_stFile );
f2 = SCR_fn_f_Bin_GetFLOAT( _p_stFile );
MTH3D_M_vSetVectorElements(&stMaxPoint, f0, f1, f2);
SECT_fn_vSetMaxPointInBorder(hSector, &stMaxPoint);
}
break;
}
}while (chTag!=-1);
SCR_fn_v_Bin_EndSection(_p_stFile);
return SCR_ERV_Anl_NormalReturn;
}
*/
/*-----------------------------------------*/
/*
SCR_tde_Anl_ReturnValue SCT_fn_xLoadBinStaticLightsSector(SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction)
{
SECT_tdxHandleOfSectorObject hSector;
SECT_tdxHandleOfElementLstStaticLights hStaticLightsElement;
SCR_tdst_Cxt_Values *p_stValues ;
char szP0[MAX_PATH];
unsigned short usQ, i;
if( _eAction != SCR_EA_Anl_BeginSection )
{
//do whatever ...
return SCR_ERV_Anl_NormalReturn;
}
SCR_fn_v_Bin_BeginSection(_p_stFile);
// Get the handle of the section
SCR_M_RdL0_GetContextLong(-1,0,SECT_tdxHandleOfSectorObject,hSector);
usQ = SCR_fn_us_Bin_GetUSHORT( _p_stFile );
for (i = 0; i < usQ; i++)
{
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP0 );
p_stValues = SCR_fnp_st_Bin_GetREFERENCE( szP0 );
if(p_stValues)
{
hStaticLightsElement=SECT_fn_hCreateElementLstStaticLights();
SECT_fn_vSetHandleOfLightsInStaticLightsList(hStaticLightsElement,(GLI_tdxHandleToLight)SCR_M_ul_RdL0_ExtractLongValue(p_stValues,0));
LST2_M_StaticAddTail(&(hSector->stListOfStaticLights),hStaticLightsElement);
}
}
SCR_fn_v_Bin_EndSection(_p_stFile);
return SCR_ERV_Anl_NormalReturn;
}
*/