/*=========================================================================
* Anim_s.h :       Define the engine anim's structure.
* This is a part of the Game project.
*
* Version              2.0
* Creation date        09/08/96
* Revision date        24/10/96		DVD (Gizmo)
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
#if !defined(__ANIM_S_H__)
#define __ANIM_S_H__
 
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
 
#include "ACP_Base.h" /*AR9808 Must be included before all includes*/
#include "POS.H"
#include "GLI.H"
#include "SCT.H"
 
#include "GAM/Header.h"
#include "../PlayAnim/PLA_dbg.h"
 
#include "GAM/Macros.h"
 
#define C_ucSOUND_EVENT			0
#define C_ucMECHANIC_EVENT		1
#define C_ucGENERATE_EVENT		2
#define C_ucGENERIC_EVENT		3
 
#define C_ucNeverPlay     		255
 
/* MR1206*/
#define C_ucTAKE_OBJECT_EVENT		1
#define C_ucTAKE_IN_OBJECT_EVENT	2
#define C_ucTAKE_OUT_OBJECT_EVENT	3
#define C_ucDROP_OBJECT_EVENT		4
#define C_ucTHROW_OBJECT_EVENT		5
/*ANNECY VL 26/11/97{*/
#define C_ucEvent_User0		6
#define C_ucEvent_User1		7
#define C_ucEvent_User2		8
#define C_ucEvent_User3		9
#define C_ucEvent_User4		10
#define C_ucEvent_User5		11
#define C_ucEvent_User6		12
#define C_ucEvent_User7		13
/*ENDANNECY VL }*/
 
 
/*  structure describing a all events*/
typedef struct tdstEventInTable_ 
{
	void* p_xEvent;					/* pointer to the event*/
	unsigned char ucTypeOfEvent;	
	unsigned char ucPriority;
	unsigned char ucFirstCall;		/* number of anim loop before event*/
	unsigned char ucPeriod;			/* number of loop after FirstCall*/
#ifndef U64
	unsigned long ulBinaryEventId;	/* used for the binarisation only*/
#endif
} tdstEventInTable;
 
typedef struct tdstEvent_ 
{
	tdstEventInTable* p_stfEventInTBL;
	unsigned short usEventNumberInTBL;
	unsigned short uwFrameNumber;		
	unsigned short uwChannelNumber;		
} tdstEvent;
 
/*
 * structure describing a 3d element 
 */
 
M_BeginDeclareEnumerate( tdeTypeOfElement )
 TE_GraphicObject = 0,
 TE_SubAnimation,
 TE_EmptyObject,
 TE_Event,
 TE_Light,		/* MR2908*/
 TE_Fake,
 TE_Undefined
M_EndDeclareEnumerate( tdeTypeOfElement, unsigned char )
 
 
/*  structure Couple (Child,Father) for Hierarchy*/
typedef struct tdstCouple_
{
	unsigned short wChild,wFather;
} tdstCouple;
 
 
/*  structure Hierarchy*/
typedef struct tdstPLA_Hierarchy_
{
	unsigned long ulNbOfCouples;
	tdstCouple * d_stCouples;
} tdstPLA_Hierarchy;
 
 
#include "Specif/Elem_3d.h"
 
struct tdstAnim3d_;
 
typedef struct tdstFrame3d_
{
	/**** array of 3d element structure ****/
	struct tdstElement3d_ *p_stArrayOfElts3d;
#ifndef U64
	struct MTH3D_tdstMatrix_ *p_stAngularSpeedMatrix;
	struct MTH3D_tdstVector_ *p_stLinearSpeedVector;
#endif /*U64*/
	
	tdstPLA_Hierarchy stHierarchy;
 
	/* ref of the information of the frame*/
	struct tdstAnim3d_ * p_stAnim;
	unsigned short uwFrameNumber;
	unsigned char ucMatrixUpdated;
	unsigned char ucCacheEntry; /*AR9902 This is to be sure that the animation is still loaded into the same cache entry*/
} tdstFrame3d;
 
typedef struct stMorphData
{
	unsigned char ucTarget; /* index of the target PO into the objects table*/
	unsigned char ucMorphingAmount; /* ratio for the morphing*/
	unsigned short	uwChannelNumber;
	unsigned short	uwFrameNumber;
	unsigned short	uwAlign;
} tdstMorphData;
 
/*
 * structure describing an animation sequence
 */
typedef struct tdstAnim3d_
{
  #ifdef _DEBUG_STRING_FOR_PLA_
    char szAnimName[LEN_DEBUG_STRING];
  #endif
 
 
	/**** Number of frames in the animation ****/
	unsigned short		uwNumberOfFrames;		
	unsigned char		ucFrameRate;
	unsigned char		ucMaxNumberOfElements; /* total number of channels for this anim*/
	
	/**** point to the first event (sound or other) ****/
	struct tdstEvent_   *d_stAnimEvent;	    
 
/*	POS_tdstCompletePosition stOffsetMatrix;*/
	/* AR9811 Only the translation of this position is used*/
	/* I have replaced it by a simple vector*/
	MTH3D_tdstVector stOffsetMatrix;
/*	BOOL bCompressedAnim;*/
 
	/* MR2908*/
/*	tdstAnimLights *p_stLights;		// Array of lights*/
 
	/**** morph array *** AR980304*/
	tdstMorphData		*d_stMorphDataArray; /* WARNING ! FOR PC, A3B VERSION MUST BE CHANGED !!!*/
	unsigned short		uwNumOfA3dGENERAL; /* For interpolation*/
	unsigned char		ucNumberOfEvents;
	unsigned char		ucUnused;		/* alignment*/
} tdstAnim3d;
 
/*
 * structure describing an sub-animation sequence
 */
/*typedef struct tdstSubAnim3d_
{
 
 // current animation infos
 unsigned short uwCurrentFrame;			// current frame in the current animation
 unsigned char ucRepeatAnimation;		// how many animation after this one finished
 
 unsigned char ucElement;
 struct tdstState_  *p_stCurrentState;
 
} tdstSubAnim3d;
*/
#endif /* !__ANIM_S_H__ */
