#define D_CineInfo_StructureDefine
#define D_CineInfo_VariableDefine
 
#include "ToolsCPA.h"
#include "Options/Def_Snd.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/EngMode.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/3DOSLkTb.h"
#include "ToolCam.h"
#include "TypeCam.h"
#include "ObjInit.h"  
#include "ZeMem.h"
#include "ObjType.h"
#include "Basic.h"
    
#ifdef SOUND_FOR_3DOS 
#include "Micros.h"
#endif
 
#include "GameEng.h" 
 
#include "MainChar.h"
 
#include "ldt.h"
 
#define lTagShift						'fihS'
#define lTagDistance				'tsiD'
#define lTagAlpha						'hplA'
#define lTagTheta						'tehT'
#define lTagLinearSpeed			'eniL'
#define lTagAngularSpeed		'ugnA'
#define lTagTargetSpeed			'graT'
#define lTagDNMFlags				'FMND'
#define lTagIAFlags					'lFAI'
#define lTagFocal						'acoF'
#define lTagZMinMax					'niMZ'
#define lTagViewport				'weiV'
#define lTagChannel					'nahC'
#define lTagActivation			'itcA'
 
 
 
/*****************************************************************
Function name   : fn_iCreateCineInfo
Description     : 
Author          : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date   : 13-Oct-98
Modified        : 
Return type     : int 
Argument        : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateCineInfo( LDT_tdst_Link *pLink )
{
	struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_	*)pLink->pParent->pObject;
 
	CAM_fn_vCineinfoAlloc(p_stEngineObject);	
	pLink->pObject = (MS_tdxHandleToCineinfo)p_stEngineObject->h_Cineinfo;
 
  return 0;
}
 
 
 
/*****************************************************************
Function name   : fn_iLoadCineInfo
Description     : 
Author          : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date   : 13-Oct-98
Modified        : 
Return type     : int 
Argument        : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadCineInfo( LDT_tdst_Link *pLink )
{
  LDT_tdeParseResult result=ParseResult_BeginSection;
	MS_tdxHandleToInternalCineinfo	hCineinfoInit;
	MS_tdxHandleToCineinfo			hCineinfo;
	struct tdstEngineObject_		*p_stEngineObject = (struct tdstEngineObject_	*)pLink->pParent->pObject;;
 
	hCineinfo = p_stEngineObject->h_Cineinfo;
	hCineinfoInit = p_stEngineObject->h_Cineinfo->hInit;
 
 
  while( result!=ParseResult_EndSection ) 
  {
  	result=LDT_GetNextEntry();
  	switch( result )
  	{
  	  case ParseResult_Entry: /* an entry */
  	  {
  	    char *szEntry=LDT_szGetEntryName();
  	    switch (*(long*)szEntry)
  	    {
 
  	      case  lTagShift : /*  */
  	      {
						if (strlen(szEntry) > 9) /*ShiftTarget*/
						{
							MTH3D_M_vSetVectorElements(&hCineinfoInit->stShiftTarget, 
								(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)));
						}
						else /*ShiftPos*/
						{
							MTH3D_M_vSetVectorElements(&hCineinfoInit->stShiftPos,
								(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)));
						}
  	      }
  	      break;
  	      case  lTagDistance : /*  */
  	      {
						hCineinfoInit->xDistMin = (float)atof(LDT_szGetParam(1));
						hCineinfoInit->xDistMax = (float)atof(LDT_szGetParam(2));
						hCineinfoInit->xBoundDistMin = (float)atof(LDT_szGetParam(3));
						hCineinfoInit->xBoundDistMax = (float)atof(LDT_szGetParam(4));
 
  	      }
  	      break;
  	      case  lTagAlpha : /*  */
  	      {
						hCineinfoInit->xAngleAlpha = (float)atof(LDT_szGetParam(1));
						hCineinfoInit->xAngleShiftAlpha = (float)atof(LDT_szGetParam(2));
 
  	      }
  	      break;
  	      case  lTagTheta : /*  */
  	      {
						hCineinfoInit->xAngleTheta = (float)atof(LDT_szGetParam(1));
						hCineinfoInit->xAngleShiftTheta = (float)atof(LDT_szGetParam(2));
 
  	      }
  	      break;
  	      case  lTagLinearSpeed : /*  */
  	      {
						hCineinfoInit->xLinearSpeed = (float)atof(LDT_szGetParam(1));
						hCineinfoInit->xLinearIncreaseSpeed = (float)atof(LDT_szGetParam(2));
						hCineinfoInit->xLinearDecreaseSpeed = (float)atof(LDT_szGetParam(3));
 
  	      }
  	      break;
  	      case  lTagAngularSpeed : /*  */
  	      {
						hCineinfoInit->xAngularSpeed = (float)atof(LDT_szGetParam(1));
						hCineinfoInit->xAngularIncreaseSpeed = (float)atof(LDT_szGetParam(2));
						hCineinfoInit->xAngularDecreaseSpeed = (float)atof(LDT_szGetParam(3));
 
  	      }
  	      break;
  	      case  lTagTargetSpeed : /*  */
  	      {
						hCineinfoInit->xTargetSpeed = (float)atof(LDT_szGetParam(1));
						hCineinfoInit->xTargetIncreaseSpeed = (float)atof(LDT_szGetParam(2));
						hCineinfoInit->xTargetDecreaseSpeed = (float)atof(LDT_szGetParam(3));
 
  	      }
  	      break;
  	      case  lTagDNMFlags : /*  */
  	      {
						hCineinfoInit->uwDNMFlags = (unsigned short) atoi(LDT_szGetParam(1));
  	      }
  	      break;
  	      case  lTagIAFlags : /*  */
  	      {
						hCineinfoInit->uwIAFlags = (unsigned short) atoi(LDT_szGetParam(1));
  	      }
  	      break;
  	      case  lTagFocal : /*  */
  	      {
						hCineinfoInit->xFocal = (float)atof(LDT_szGetParam(1));
  	      }
  	      break;
  	      case  lTagZMinMax : /*  */
  	      {
						hCineinfoInit->xZMin = (float)atof(LDT_szGetParam(1));
						hCineinfoInit->xZMax = (float)atof(LDT_szGetParam(2));
 
  	      }
  	      break;
  	      case  lTagViewport : /*  */
  	      {
						hCineinfoInit->eTypeOfViewport = (enum e_ucListViewport_) atoi(LDT_szGetParam(1));
  	      }
  	      break;
  	      case  lTagChannel : /*  */
  	      {
						hCineinfoInit->cChannel = (char) atoi(LDT_szGetParam(1));
  	      }
  	      break;
  	      case  lTagActivation : /*  */
  	      {
						hCineinfoInit->bIsActive = (ACP_tdxBool) atoi(LDT_szGetParam(1));
  	      }
  	      break;
  	    }
  	  }
  	}
  }
 
 
  return 0;
}
 
