/* Sector.h*/
#undef extern
 
#ifndef __SECTOR
#define __SECTOR
 
 
#include "LST.H"
#include "SND.H"
#include "SPO.H"
 
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
 
LST2_M_DynamicUseListOf(SECT_tdxHandleOfElementLstCharacter);
/* MR0808*/
LST2_M_DynamicUseListOf(SECT_tdxHandleOfElementLstDNMLights);
LST2_M_StaticUseListOf(SECT_tdxHandleOfElementLstStaticLights);
LST2_M_StaticUseListOf(SECT_tdxHandleOfElementLstSoundInteraction);
LST2_M_StaticUseListOf(SECT_tdxHandleOfElementLstActivityInteraction);
LST2_M_StaticUseListOf(SECT_tdxHandleOfElementLstCollisionInteraction);
LST2_M_StaticUseListOf(SECT_tdxHandleOfElementLstGraphicInteraction);
LST2_M_StaticUseListOf(SCT_tdxHandleOfLstSoundEvent);
 
 
/*Common Vertices*/
typedef struct SCT_tdstCommonVertices_
{
  ACP_tdxIndex xVertexIndex;
  ACP_tdxHandleOfObject hPhysicalObject;
} SCT_tdstCommonVertices;
/*End of LST of Characters*/
 
 
 
/*LST of characters*/
typedef struct SECT_tdstListOfSOCharacters_
{
	HIE_tdxHandleToSuperObject		hPointerOfCharacter;
	LST2_M_DynamicElementDeclaration(SECT_tdxHandleOfElementLstCharacter)
} SECT_tdstListOfSOCharacters;
/*End of LST of Characters*/
 
/* Begin Shaitan ModeLook*/
#define C_SECT_ModeLookOnly	2
#define C_SECT_ModeNormal	0
/* End Shaitan ModeLook*/
 
/*LST of graphic interaction*/
typedef struct SECT_tdstListOfSOSectorsInGraphicInteraction_
{
	short	wLevelOfDetail;
/* Begin Shaitan ModeLook*/
	char	cDisplayMode;
/* End Shaitan ModeLook*/
	HIE_tdxHandleToSuperObject	hPointerOfSectorSO;
	LST2_M_StaticElementDeclaration(SECT_tdxHandleOfElementLstGraphicInteraction)
} SECT_tdstListOfSOSectorsInGraphicInteraction;
/*End of LST of graphic interaction*/
 
 
/*LST of collision interaction*/
typedef struct SECT_tdstListOfSOSectorsInCollisionInteraction_
{
	HIE_tdxHandleToSuperObject hPointerOfSectorSO;
	LST2_M_StaticElementDeclaration(SECT_tdxHandleOfElementLstCollisionInteraction)
} SECT_tdstListOfSOSectorsInCollisionInteraction;
 
/*End of LST of collision interaction*/
 
 
/*LST of Activity interaction*/
typedef struct SECT_tdstListOfSOSectorsInActivityInteraction_
{
	HIE_tdxHandleToSuperObject	hPointerOfSectorSO;
	LST2_M_StaticElementDeclaration(SECT_tdxHandleOfElementLstActivityInteraction)
} SECT_tdstListOfSOSectorsInActivityInteraction;
 
/*End of LST of Activity interaction*/
 
 
/*LST of Sound interaction*/
typedef struct SECT_tdstListOfSOSectorsInSoundInteraction_
{
	HIE_tdxHandleToSuperObject	hPointerOfSectorSO;
  long lVolume;
	LST2_M_StaticElementDeclaration(SECT_tdxHandleOfElementLstSoundInteraction)
} SECT_tdstListOfSOSectorsInSoundInteraction;
 
/*End of LST of Sound interaction*/
 
 
 
/*LST of Sound Event*/
typedef struct SCT_tdstListOfSoundEvent_
{
	HIE_tdxHandleToSuperObject	hPointerOfSectorSO;
  SND_tduRefEvt uSoundEvent;
	LST2_M_StaticElementDeclaration(SCT_tdxHandleOfLstSoundEvent)
} SCT_tdstListOfSoundEvent;
 
/*End of LST of Sound Event*/
 
 
 
/*LST of static lights*/
typedef struct SECT_tdstListOfStaticLights_
{
	GLI_tdxHandleToLight	hStaticLights;
	LST2_M_StaticElementDeclaration(SECT_tdxHandleOfElementLstStaticLights)
} SECT_tdstListOfStaticLights;
 
/*End of LST of static lights*/
 
/*LST of DNM lights*/
typedef struct SECT_tdstListOfDNMLights_
{
	GLI_tdxHandleToLight	hDNMLights;
	LST2_M_DynamicElementDeclaration(SECT_tdxHandleOfElementLstDNMLights)
} SECT_tdstListOfDNMLights;
 
/*End of LST of DNM lights*/
 
#define C_SectorMinPriority 0
#define C_SectorMaxPriority 127
#define C_SectorNormalPriority 64
 
typedef struct SECT_tdstSector_
{
	LST2_M_DynamicAnchorDeclaration(SECT_tdxHandleOfElementLstCharacter) stListOfCharacters; 
	LST2_M_StaticAnchorDeclaration(SECT_tdxHandleOfElementLstStaticLights) stListOfStaticLights; 
	LST2_M_DynamicAnchorDeclaration(SECT_tdxHandleOfElementLstDNMLights) stListOfDNMLights; 
	/* MR0808*/
	LST2_M_StaticAnchorDeclaration(SECT_tdxHandleOfElementLstGraphicInteraction) stListOfSectorsInGraphicInteraction;
	LST2_M_StaticAnchorDeclaration(SECT_tdxHandleOfElementLstCollisionInteraction) stListOfSectorsInCollisionInteraction;
	LST2_M_StaticAnchorDeclaration(SECT_tdxHandleOfElementLstActivityInteraction) stListOfSectorsInActivityInteraction;
	LST2_M_StaticAnchorDeclaration(SECT_tdxHandleOfElementLstSoundInteraction) stListOfSectorsInSoundInteraction;
	LST2_M_StaticAnchorDeclaration(SCT_tdxHandleOfLstSoundEvent) stListOfSoundEvent;
 
	MTH3D_tdstVector stMinMaxPoints [2];
#ifdef ACTIVE_EDITOR
	MTH_tdxReal		 xZmaxOfBorder;
	MTH_tdxReal		 xRealZmax;
#endif /*ACTIVE_EDITOR*/
	MTH_tdxReal		xZFar;			/* all object that are farest from camera than this value are clipped*/
									/* if value is MTH_C_ZERO there's no far clipping*/
 
	/* FQ SCTSKY*/
#ifdef U64
	float fAddU;
	float fAddV;
#endif /* U64*/
 
	ACP_tdxBool		xVirtual;
	char			cCameraType;
	char			cCounter;
	char			cPriority;
 
	/* FQ SCTSKY*/
	void *pSkyVisualMaterial;
	unsigned char FogIntensity;
#ifdef U64
	unsigned char bUseSky;
#endif /* U64*/
 
 
#ifndef U64
#if (defined(_DEBUG) || defined(USE_PROFILER))
	char szSectorName[255];
#endif /* _DEBUG || USE_PROFILER */
#endif
 
 
}SECT_tdstSector;
 
 
/*--------------------------------*/
/* ANNECY AV*/
/* Inline functions to go faster*/
/*--------------------------------*/
 
#ifndef CODEWARRIOR
static
#endif
__inline HIE_tdxHandleToSuperObject SECT_GetCharacterInList(SECT_tdxHandleOfElementLstCharacter hCharacterList)
    { return(hCharacterList->hPointerOfCharacter); }
 
#ifndef CODEWARRIOR
static
#endif
__inline HIE_tdxHandleToSuperObject SECT_GetSectorInCollisionList(SECT_tdxHandleOfElementLstCollisionInteraction hCollisionList)
    { return(hCollisionList->hPointerOfSectorSO); }
 
#ifndef CODEWARRIOR
static
#endif
__inline HIE_tdxHandleToSuperObject SECT_GetSectorInActivityList(SECT_tdxHandleOfElementLstActivityInteraction hActivityList)
    { return(hActivityList->hPointerOfSectorSO); }
 
#ifndef CODEWARRIOR
static
#endif
__inline HIE_tdxHandleToSuperObject SECT_GetSectorInGraphicList(SECT_tdxHandleOfElementLstGraphicInteraction hGraphicList)
    { return(hGraphicList->hPointerOfSectorSO); }
 
#ifndef CODEWARRIOR
static
#endif
__inline short SCT_fn_wGetLODInGraphicList(SECT_tdxHandleOfElementLstGraphicInteraction hGraphicList)
    { return(hGraphicList->wLevelOfDetail); }
 
/* Begin Shaitan ModeLook*/
#ifndef CODEWARRIOR
static
#endif
__inline char SCT_fn_wGetModeInGraphicList(SECT_tdxHandleOfElementLstGraphicInteraction hGraphicList)
    { return(hGraphicList->cDisplayMode); }
/* End Shaitan ModeLook*/
 
#ifndef CODEWARRIOR
static
#endif
__inline HIE_tdxHandleToSuperObject SECT_GetSectorInSoundList(SECT_tdxHandleOfElementLstSoundInteraction hSoundList)
    { return(hSoundList->hPointerOfSectorSO); }
 
#ifndef CODEWARRIOR
static
#endif
__inline long SCT_fn_lGetVolumeInSoundList(SECT_tdxHandleOfElementLstSoundInteraction hSoundList)
    { return(hSoundList->lVolume); }
 
#ifndef CODEWARRIOR
static
#endif
__inline HIE_tdxHandleToSuperObject SCT_fn_hGetSectorInSoundEventList(SCT_tdxHandleOfLstSoundEvent hSoundEventList)
    { return(hSoundEventList->hPointerOfSectorSO); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SND_tdxHandleToSoundEvent SCT_fn_uGetSoundEventInSoundEventList(SCT_tdxHandleOfLstSoundEvent hSoundEventList)
    { return(hSoundEventList->uSoundEvent.pstPtr); }
 
#ifndef CODEWARRIOR
static
#endif
__inline GLI_tdxHandleToLight SECT_GetDNMLightsInList(SECT_tdxHandleOfElementLstDNMLights hDNMLightsList)
    { return(hDNMLightsList->hDNMLights); }
 
#ifndef CODEWARRIOR
static
#endif
__inline GLI_tdxHandleToLight SECT_GetStaticLightsInList(SECT_tdxHandleOfElementLstStaticLights hStaticLightsList)
    { return(hStaticLightsList->hStaticLights); }
 
#ifndef CODEWARRIOR
static
#endif
__inline char SECT_cGetCounterInSector(HIE_tdxHandleToSuperObject _hSector)
	{ return ((SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(_hSector))->cCounter; }
 
#ifndef CODEWARRIOR
static
#endif
__inline void SECT_vSetCounterInSector(HIE_tdxHandleToSuperObject _hSector, char _cCounter)
	{ ((SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(_hSector))->cCounter = _cCounter; }
 
/*//////////////////////////////////*/
#ifndef CODEWARRIOR
static
#endif
__inline SECT_tdxHandleOfElementLstDNMLights SECT_fn_hGetFirstDNMLightsListInSector(HIE_tdxHandleToSuperObject _hSector)
    { return(LST2_M_DynamicGetFirstElement( &((SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(_hSector))->stListOfDNMLights)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SECT_tdxHandleOfElementLstDNMLights SECT_fn_hGetNextDNMLightsListInSector(SECT_tdxHandleOfElementLstDNMLights _hDNMLightsList)
    { return(LST2_M_DynamicGetNextElement( _hDNMLightsList)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SECT_tdxHandleOfElementLstStaticLights SECT_fn_hGetFirstStaticLightsListInSector(HIE_tdxHandleToSuperObject _hSector)
    { return(LST2_M_StaticGetFirstElement( &((SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(_hSector))->stListOfStaticLights)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SECT_tdxHandleOfElementLstStaticLights SECT_fn_hGetNextStaticLightsListInSector(SECT_tdxHandleOfElementLstStaticLights _hStaticLightsList)
    { return(LST2_M_StaticGetNextElement( _hStaticLightsList)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SECT_tdxHandleOfElementLstCharacter SECT_fn_hGetFirstCharListInSector(HIE_tdxHandleToSuperObject _hSector)
    { return(LST2_M_DynamicGetFirstElement( &((SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(_hSector))->stListOfCharacters)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SECT_tdxHandleOfElementLstCharacter SECT_fn_hGetNextCharListInSector(SECT_tdxHandleOfElementLstCharacter _hCharList)
    { return(LST2_M_DynamicGetNextElement( _hCharList)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline long  SECT_fn_lGetNbCharListInSector(HIE_tdxHandleToSuperObject _hSector)
    { return(LST2_M_DynamicGetNumberOfElements( &((SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(_hSector))->stListOfCharacters)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SECT_tdxHandleOfElementLstCollisionInteraction SECT_fn_hGetFirstCollisionNodeInCollisionList(HIE_tdxHandleToSuperObject _hSector)
    { return(LST2_M_StaticGetFirstElement( &((SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(_hSector))->stListOfSectorsInCollisionInteraction)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SECT_tdxHandleOfElementLstCollisionInteraction SECT_fn_hGetNextCollisionNodeInCollisionList(SECT_tdxHandleOfElementLstCollisionInteraction _hCollNode)
    { return(LST2_M_StaticGetNextElement( _hCollNode)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SECT_tdxHandleOfElementLstActivityInteraction SECT_fn_hGetFirstActivityNodeInActivityList(HIE_tdxHandleToSuperObject _hSector)
    { return(LST2_M_StaticGetFirstElement( &((SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(_hSector))->stListOfSectorsInActivityInteraction)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SECT_tdxHandleOfElementLstActivityInteraction SECT_fn_hGetNextActivityNodeInActivityList(SECT_tdxHandleOfElementLstActivityInteraction _hActNode)
    { return(LST2_M_StaticGetNextElement( _hActNode)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SECT_tdxHandleOfElementLstGraphicInteraction SECT_fn_hGetFirstGraphicNodeInGraphicList(HIE_tdxHandleToSuperObject _hSector)
    { return(LST2_M_StaticGetFirstElement( &((SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(_hSector))->stListOfSectorsInGraphicInteraction)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SECT_tdxHandleOfElementLstGraphicInteraction SECT_fn_hGetNextGraphicNodeInGraphicList(SECT_tdxHandleOfElementLstGraphicInteraction _GraphicNode)
    { return(LST2_M_StaticGetNextElement( _GraphicNode)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SECT_tdxHandleOfElementLstSoundInteraction SECT_fn_hGetFirstSoundNodeInSoundList(HIE_tdxHandleToSuperObject _hSector)
    { return(LST2_M_StaticGetFirstElement( &((SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(_hSector))->stListOfSectorsInSoundInteraction)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SECT_tdxHandleOfElementLstSoundInteraction SECT_fn_hGetNextSoundNodeInSoundList(SECT_tdxHandleOfElementLstSoundInteraction _hSoundNode)
    { return(LST2_M_StaticGetNextElement( _hSoundNode)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SCT_tdxHandleOfLstSoundEvent SCT_fn_hGetFirstSoundEventNodeInSoundEventList(HIE_tdxHandleToSuperObject _hSector)
    { return(LST2_M_StaticGetFirstElement( &((SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(_hSector))->stListOfSoundEvent)); }
 
#ifndef CODEWARRIOR
static
#endif
__inline SCT_tdxHandleOfLstSoundEvent SCT_fn_hGetNextSoundEventNodeInSoundEventList(SCT_tdxHandleOfLstSoundEvent _hSoundEventNode)
    { return(LST2_M_StaticGetNextElement( _hSoundEventNode)); }
 
#ifdef __cplusplus
};
#endif /* __cplusplus */
 
#endif	/*__SECTOR*/
