/*=========================================================================
* ObjsTbls.h :       Define the engine state structure.
* This is a part of the Game project.
*
* Version              1.0
* Creation date        25/03/97
* Revision date
* Author                Sebastien DAVID
* 
* That file needs to be compatible for all platforms.
* (c) Ubi Studios 1997
*=======================================================================*/
#if !defined(__OBJSTBLS_H__)
#define __OBJSTBLS_H__
 
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
 
#include "GAM/Header.h"
#include "GAM/GAMHandl.h"
 
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
 
#define C_wTdO_Undefined	0xffff
#define C_wTdO_PhysicalObject	0
#define C_wTdO_Animation			1
#define C_wTdO_Light					2
#define C_wTdO_Camera					3
#define C_wTdO_Mirror					4
 
#define C_wTdO_Event			5	
 
/* ANNECY AV {*/
#define  C_wObjectTableHasZdd   0x0001
#define  C_wObjectTableHasZde   0x0002
/* END ANNECY AV }*/
 
/**************************/
/**** Structure define ****/
/**************************/
#if defined(D_ObjsTbls_Define)
 
typedef struct tdstObjectsTableElement_
{
  MTH3D_tdstVector * p_stCustomZoom; /* AR971014 Changed for alignment*/
 
  /* to create an Array of POs ...*/
  tdxHandleToVoid h_Target;
 
  unsigned long uwChannelNumber; /* AR971107 Warning ! Bad prefix !!!*/
  unsigned short wTypeOfTarget; /* AR971014 Changed for alignment*/
#ifndef U64
  unsigned char ucPhoneme;
  unsigned char ucIntensity;
  unsigned char ucExpression;
#endif //U64
 
  #ifdef _DEBUG
  unsigned short wCounter;
  #endif
 
} tdstObjectsTableElement;
 
typedef struct tdstObjectsTablesList_
{
  /* to use a List of Objects Tables ...*/
  LST2_M_StaticElementDeclaration(tdxHandleToObjectsTablesList) 
  
  /*BOOL bDuplicateTable;		// MR0707*/
  struct tdstObjectsTableElement_ * d_stObjectsTable;
#ifndef U64 //AR9904 Useless !
  struct tdstObjectsTableElement_ * d_stInitObjectsTable;
#endif //U64
  /* to access to an Objects Table ...*/
  unsigned short wNumberOfElement; /* AR971014 Changed for alignment*/
 
/* ANNECY AV {*/
  unsigned short wZDxUsed;    /* can be C_wObjectTableHasZdd | C_wObjectTableHasZde*/
/* END ANNECY AV }*/
 
} tdstObjectsTablesList;
 
 
#endif /* D_ObjsTbls_Define */
 
/*******************************/
/**** Base functions define ****/
/*******************************/
 
/* ************* ObjectsTablesList *************/
extern CPA_EXPORT tdxHandleToObjectsTablesList fn_hObjectsTablesListAlloc();
extern CPA_EXPORT void fn_hObjectsTablesListFree(tdxHandleToObjectsTablesList h_ObjectsTableElement);
 
 
/**********************************/
/**** Special functions define ****/
/**********************************/
extern CPA_EXPORT void fn_vInitObjectsTablesList(struct tdstFamilyList_ *p_stFamily);
extern CPA_EXPORT void fn_vAddAnObjectsTablesInList(	struct tdstFamilyList_ *p_stFamily
																	,	tdxHandleToObjectsTablesList h_ObjectsTablesListElement);
extern CPA_EXPORT void fn_vObjectsTablesAlloc(tdxHandleToObjectsTablesList h_ObjectsTablesListElement,unsigned short wNumberOfElement);
 
extern CPA_EXPORT void fn_vChangeObjectsTableForCharacter(HIE_tdxHandleToSuperObject p_stSuperObject, long l_Number);
extern CPA_EXPORT void fn_vExchangeTwoObjectsInCurrentObjectsTable(HIE_tdxHandleToSuperObject p_stSuperObject
																								 ,unsigned short w_ObjectA ,unsigned short w_ObjectB);
extern CPA_EXPORT void fn_vCopyObjectDestFromSourceOfObjectsTable(HIE_tdxHandleToSuperObject p_stSuperObject
																								 ,unsigned short w_ObjectDest ,unsigned short w_ObjectSource);
 
extern CPA_EXPORT void fn_vCopyObjectFromObjectTabletoAnother(tdxHandleToObjectsTablesList, tdxHandleToObjectsTablesList, unsigned short, unsigned short);
extern CPA_EXPORT unsigned short fn_uwGetObjectTableNumberOfelements(tdxHandleToObjectsTablesList _hTargetTable);
 
/* ANNECY AV {*/
extern CPA_EXPORT ACP_tdxBool fn_bObjectTableHasZdd (tdxHandleToObjectsTablesList _hObjectTableList);
extern CPA_EXPORT ACP_tdxBool fn_bObjectTableHasZde (tdxHandleToObjectsTablesList _hObjectTableList);
/* END ANNECY AV }*/
 
/* ***** ACCESS FUNCTIONS BY HANDLES ***** */
 
extern CPA_EXPORT tdxHandleToObjectsTableElement fn_d_hGetObjectsTable(tdxHandleToObjectsTablesList h_ObjectsTablesListElement);
extern CPA_EXPORT tdxHandleToObjectsTableElement fn_d_hGetInitObjectsTable(tdxHandleToObjectsTablesList h_ObjectsTablesListElement);
 
extern CPA_EXPORT tdxHandleToObjectsTableElement fn_d_hGetElementByNumberInObjectsTable(tdxHandleToObjectsTablesList h_ObjectsTablesListElement
																	  ,unsigned short wNumberInTable);
 
extern CPA_EXPORT unsigned short fn_wObjectsTableGetTypeOfTarget(tdxHandleToObjectsTableElement h_ObjectsTablesElement);
extern CPA_EXPORT void fn_vObjectsTableSetTypeOfTarget(tdxHandleToObjectsTableElement h_ObjectsTablesElement
									,unsigned short wTypeOfTarget);
extern CPA_EXPORT tdxHandleToVoid fn_hObjectsTableGetTarget(tdxHandleToObjectsTableElement h_ObjectsTablesElement);
extern CPA_EXPORT void fn_vObjectsTableSetTarget(tdxHandleToObjectsTableElement h_ObjectsTablesElement
									,tdxHandleToVoid h_Target);
 
extern CPA_EXPORT void fn_vDuplicateObjectTable(tdxHandleToObjectsTablesList hObjTableList);
extern CPA_EXPORT void fn_vReInitObjectTable(tdxHandleToObjectsTablesList hObjTableList);
 
#ifndef U64 
// Shaitan => module list in the level
extern CPA_EXPORT void fn_vFindUsedIndexes(short *wArrayOfIndexes, short wMaxElements, struct tdstAnim3d_ *p_stAnim, struct tdst3dData_ * h3dData);
// End Shaitan => module list in the level
#endif
/*
extern CPA_EXPORT void fn_vSetObjectTableListDuplicate(tdxHandleToObjectsTablesList hObjTableList,BOOL bDuplicate);
extern CPA_EXPORT BOOL fn_bGetObjectTableListDuplicate(tdxHandleToObjectsTablesList hObjTableList);
*/
 
extern void fn_vCheckObjectsTables(struct tdstEngineObject_ *p_stEngineObject);
 
#if defined(__cplusplus)
}
#endif /* __cplusplus */
 
#endif /* !__OBJSTBLS_H__ */
