/* ************************************************************************************************** ************************************************************************************************** ************************************************************************************************** ************************************************************************************************** */ #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" extern HIE_tdxHandleToSuperObject g_hOldTargetedPerso; /* ************************************************************************************************** ************************************************************************************************** GLOBALS ************************************************************************************************** ************************************************************************************************** */ /* * To receive some camera internal constants values. */ CAM_tdstCameraConstants CAM_g_stCameraConstants; CAM_tdstCameraConstants CAM_g_stCopyCameraConstants; /* ************************************************************************************************** ************************************************************************************************** ************************************************************************************************** ************************************************************************************************** */ /* *================================================================================================= * Load the camera internal constants value. *================================================================================================= */ void CAM_fn_vLoadCameraConstants(void) { CAM_g_stCameraConstants.xRayCameraSphereToGo1 = MTH_M_xFloatToReal(0.35f); CAM_g_stCameraConstants.xRayCameraSphereToGo2 = MTH_M_xFloatToReal(0.35f); CAM_g_stCameraConstants.xRayCameraSphereToSee1 = MTH_M_xFloatToReal(0.10f); CAM_g_stCameraConstants.xRayCameraSphereToSee2 = MTH_M_xFloatToReal(0.10f); CAM_g_stCameraConstants.xBaseAngleComputePosNormal = MTH_C_PiBy4; CAM_g_stCameraConstants.xBaseAngleComputePosFailure = MTH_C_PiBy4; CAM_g_stCameraConstants.xBaseCutAngle = MTH_C_PiBy8; CAM_g_stCameraConstants.xAverageForComputePos = MTH_M_xFloatToReal(0.40f); CAM_g_stCameraConstants.xAverageForComputeLinearSpeed = MTH_M_xFloatToReal(0.40f); CAM_g_stCameraConstants.xMinLinearSpeedCamera = MTH_M_xFloatToReal(0.005f); CAM_g_stCameraConstants.xMinLinearSpeedTgtPerso = MTH_M_xFloatToReal(0.01f); CAM_g_stCameraConstants.xMinAngularSpeedTgtPerso = MTH_M_xFloatToReal(0.01f); CAM_g_stCameraConstants.xEpsilonDynTgtAngle = MTH_C_PiBy4; CAM_g_stCameraConstants.xEpsilonDynTgtFocalAngle = MTH_M_xDiv(MTH_C_Pi, MTH_M_xFloatToReal(16.0f));; CAM_g_stCameraConstants.xEpsilonForEqualVectors = MTH_M_xFloatToReal(0.5f); CAM_g_stCameraConstants.xOffsetMinDistPerso = MTH_M_xFloatToReal(0.05f); CAM_g_stCameraConstants.xDistanceForNoCut = MTH_M_xFloatToReal(5.00f); CAM_g_stCameraConstants.xNumRayCameraCanGo = 3; CAM_g_stCameraConstants.xNumRayCameraCanSee = 1; CAM_g_stCameraConstants.xTickTestVisibility = 4; CAM_g_stCameraConstants.xTickFindBetterPos = 20; CAM_g_stCameraConstants.xTickFindBetterPosIfNoMove = 60; CAM_g_stCameraConstants.xTickFailureCantSee = 60; CAM_g_stCameraConstants.xDynSpeed_LinearFactNorm = MTH_M_xFloatToReal(3.0f); CAM_g_stCameraConstants.xDynSpeed_LinearMax = MTH_M_xFloatToReal(10.0f); CAM_g_stCameraConstants.xDynSpeed_LinearMulPerso = MTH_M_xFloatToReal(1.5f); CAM_g_stCameraConstants.xDynSpeed_AngularFactNorm = MTH_M_xFloatToReal(3.0f); CAM_g_stCameraConstants.xDynSpeed_AngularMax = MTH_M_xFloatToReal(3.0f); CAM_g_stCameraConstants.xDynSpeed_AngularMulPerso = MTH_M_xFloatToReal(0.0f); CAM_g_stCameraConstants.xDynSpeed_TargetFactNorm = MTH_M_xFloatToReal(4.0f); CAM_g_stCameraConstants.xDynSpeed_TargetMax = MTH_M_xFloatToReal(10.0f); CAM_g_stCameraConstants.xDynSpeed_TargetMulPerso = MTH_M_xFloatToReal(1.0f); CAM_g_stCameraConstants.xCutAngleFactorPos = MTH_M_xFloatToReal(1.0f); CAM_g_stCameraConstants.xCutAngleFactorTgt = MTH_M_xFloatToReal(1.0f); CAM_g_stCameraConstants.wFlags = 0; } /* ************************************************************************************************** ************************************************************************************************** FUNCTIONS ************************************************************************************************** ************************************************************************************************** */ /* *================================================================================================= * Cineinfo's object action script callback *================================================================================================= */ #if defined(GAM_USE_SCRIPT) SCR_tde_Anl_ReturnValue CAM_fn_eCineinfoScriptCallBack ( SCR_tdst_File_Description *_p_stFile, char *_p_szName, char *_ap_szParams[], SCR_tde_Anl_Action _eAction ) { /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn; MS_tdxHandleToInternalCineinfo hCineinfoInit; MS_tdxHandleToCineinfo hCineinfo; struct tdstEngineObject_ *p_stEngineObject; /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ SCR_M_RdL0_GetSectionLong(C_ParentSection,0,struct tdstEngineObject_ *, p_stEngineObject); if (M_IsTitle) { CAM_fn_vCineinfoAlloc(p_stEngineObject); hCineinfo = p_stEngineObject->h_Cineinfo; SCR_M_RdL0_SetSectionLong(C_ThisSection,0,hCineinfo); } else if (M_IsEntry) { SCR_M_RdL0_GetSectionLong(C_ThisSection,0,MS_tdxHandleToCineinfo,hCineinfo); hCineinfo = p_stEngineObject->h_Cineinfo; hCineinfoInit = p_stEngineObject->h_Cineinfo->hInit; /*---------------------------------------------------------------------------------------*/ if (M_ActionIs(C_CAM_EntryShiftTarget)) { M_CheckScriptParamNumber(3); MTH3D_M_vSetVectorElements(&hCineinfoInit->stShiftTarget, fn_fAToF(_ap_szParams[0]), fn_fAToF(_ap_szParams[1]), fn_fAToF(_ap_szParams[2])); } /*---------------------------------------------------------------------------------------*/ else if (M_ActionIs(C_CAM_EntryShiftPos)) { M_CheckScriptParamNumber(3); MTH3D_M_vSetVectorElements(&hCineinfoInit->stShiftPos,fn_fAToF(_ap_szParams[0]),fn_fAToF(_ap_szParams[1]),fn_fAToF(_ap_szParams[2])); } /*---------------------------------------------------------------------------------------*/ else if(M_ActionIs(C_CAM_EntryDistance)) { M_CheckScriptParamNumber(4); hCineinfoInit->xDistMin = fn_fAToF(_ap_szParams[0]); hCineinfoInit->xDistMax = fn_fAToF(_ap_szParams[1]); hCineinfoInit->xBoundDistMin = fn_fAToF(_ap_szParams[2]); hCineinfoInit->xBoundDistMax = fn_fAToF(_ap_szParams[3]); } /*---------------------------------------------------------------------------------------*/ else if(M_ActionIs(C_CAM_EntryAlpha)) { M_CheckScriptParamNumber(2); hCineinfoInit->xAngleAlpha = fn_fAToF(_ap_szParams[0]); hCineinfoInit->xAngleShiftAlpha = fn_fAToF(_ap_szParams[1]); } /*---------------------------------------------------------------------------------------*/ else if(M_ActionIs(C_CAM_EntryTheta)) { M_CheckScriptParamNumber(2); hCineinfoInit->xAngleTheta = fn_fAToF(_ap_szParams[0]); hCineinfoInit->xAngleShiftTheta = fn_fAToF(_ap_szParams[1]); } /*---------------------------------------------------------------------------------------*/ else if(M_ActionIs(C_CAM_EntryLinearSpeed)) { M_CheckScriptParamNumber(3); hCineinfoInit->xLinearSpeed = fn_fAToF(_ap_szParams[0]); hCineinfoInit->xLinearIncreaseSpeed = fn_fAToF(_ap_szParams[1]); hCineinfoInit->xLinearDecreaseSpeed = fn_fAToF(_ap_szParams[2]); } /*---------------------------------------------------------------------------------------*/ else if(M_ActionIs(C_CAM_EntryAngularSpeed)) { M_CheckScriptParamNumber(3); hCineinfoInit->xAngularSpeed = fn_fAToF(_ap_szParams[0]); hCineinfoInit->xAngularIncreaseSpeed = fn_fAToF(_ap_szParams[1]); hCineinfoInit->xAngularDecreaseSpeed = fn_fAToF(_ap_szParams[2]); } /*---------------------------------------------------------------------------------------*/ else if(M_ActionIs(C_CAM_EntryTargetSpeed)) { M_CheckScriptParamNumber(3); hCineinfoInit->xTargetSpeed = fn_fAToF(_ap_szParams[0]); hCineinfoInit->xTargetIncreaseSpeed = fn_fAToF(_ap_szParams[1]); hCineinfoInit->xTargetDecreaseSpeed = fn_fAToF(_ap_szParams[2]); } /*---------------------------------------------------------------------------------------*/ else if (M_ActionIs(C_CAM_EntryDNMFlags)) { M_CheckScriptParamNumber(1); hCineinfoInit->uwDNMFlags = (unsigned short) fn_lAToI(_ap_szParams[0]); } /*---------------------------------------------------------------------------------------*/ else if (M_ActionIs(C_CAM_EntryIAFlags)) { M_CheckScriptParamNumber(1); hCineinfoInit->uwIAFlags = (unsigned short) fn_lAToI(_ap_szParams[0]); } /*---------------------------------------------------------------------------------------*/ else if (M_ActionIs(C_CAM_EntryFocal)) { M_CheckScriptParamNumber(1); hCineinfoInit->xFocal = fn_fAToF(_ap_szParams[0]); } /*---------------------------------------------------------------------------------------*/ else if (M_ActionIs(C_CAM_EntryZMinMax)) { M_CheckScriptParamNumber(2); hCineinfoInit->xZMin = fn_fAToF(_ap_szParams[0]); hCineinfoInit->xZMax = fn_fAToF(_ap_szParams[1]); } /*---------------------------------------------------------------------------------------*/ else if (M_ActionIs(C_CAM_EntryViewport)) { M_CheckScriptParamNumber(1); hCineinfoInit->eTypeOfViewport = (enum e_ucListViewport_) fn_lAToI(_ap_szParams[0]); } /*---------------------------------------------------------------------------------------*/ else if (M_ActionIs(C_CAM_EntryChannel)) { M_CheckScriptParamNumber(1); hCineinfoInit->cChannel = (char) fn_lAToI(_ap_szParams[0]); } /*---------------------------------------------------------------------------------------*/ else if (M_ActionIs(C_CAM_EntryActivation)) { M_CheckScriptParamNumber(1); hCineinfoInit->bIsActive = (ACP_tdxBool) fn_lAToI(_ap_szParams[0]); } /*---------------------------------------------------------------------------------------*/ } return(eReturnValue); } #endif /* GAM_USE_SCRIPT */ /* *================================================================================================= * Cineinfo's mini-structure sizeof *================================================================================================= */ unsigned long CAM_fn_ulCineinfoSizeOf( void ) { return(sizeof(struct tdstCineinfo_)); } unsigned long CAM_fn_ulCineinfoInternalSizeOf( void ) { return(sizeof(struct tdstInternalStructurCineinfo_)); } /* *================================================================================================= * Cineinfo's object action allocation * We initialise field to default values. *================================================================================================= */ void CAM_fn_vCineinfoAlloc(struct tdstEngineObject_ *_p_stObject) { if (_p_stObject==NULL) M_GameFatalError(E_uwGameMiniStructObjectNull); if (_p_stObject->h_Cineinfo!=NULL) M_GameFatalError(E_uwGameMiniStructAllocAlreadyAlloc); /* * Allocations. */ MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeCineInfo , _p_stObject); _p_stObject->h_Cineinfo = CAM_fn_hCineinfoRealAlloc(); _p_stObject->h_Cineinfo->hInit = CAM_fn_hCineinfoInternalRealAlloc(); _p_stObject->h_Cineinfo->hCurrent = CAM_fn_hCineinfoInternalRealAlloc(); _p_stObject->h_Cineinfo->hVisibility = CAM_fn_hCineinfoInternalRealAlloc(); _p_stObject->h_Cineinfo->hWork = CAM_fn_hCineinfoInternalRealAlloc(); MMG_fn_vEndMemoryInfo (); /* * Default values for init internal structure. */ MTH3D_M_vNullVector(&_p_stObject->h_Cineinfo->hInit->stShiftTarget); MTH3D_M_vNullVector(&_p_stObject->h_Cineinfo->hInit->stShiftPos); _p_stObject->h_Cineinfo->hInit->xDistMin = MTH_M_xFloatToReal(6.0f); _p_stObject->h_Cineinfo->hInit->xDistMax = MTH_M_xFloatToReal(6.0f); _p_stObject->h_Cineinfo->hInit->xBoundDistMin = MTH_M_xFloatToReal(2.0f); _p_stObject->h_Cineinfo->hInit->xBoundDistMax = MTH_M_xFloatToReal(10.0f); _p_stObject->h_Cineinfo->hInit->xAngleAlpha = MTH_C_ZERO; _p_stObject->h_Cineinfo->hInit->xAngleShiftAlpha = MTH_C_ZERO; _p_stObject->h_Cineinfo->hInit->xAngleTheta = MTH_C_ZERO; _p_stObject->h_Cineinfo->hInit->xAngleShiftTheta = MTH_C_ZERO; _p_stObject->h_Cineinfo->hInit->xLinearSpeed = MTH_M_xFloatToReal(200.0f); _p_stObject->h_Cineinfo->hInit->xLinearIncreaseSpeed = MTH_M_xFloatToReal(1.0f); _p_stObject->h_Cineinfo->hInit->xLinearDecreaseSpeed = MTH_C_ZERO; _p_stObject->h_Cineinfo->hInit->xAngularSpeed = MTH_M_xFloatToReal(3.14f); _p_stObject->h_Cineinfo->hInit->xAngularIncreaseSpeed = MTH_M_xFloatToReal(1.0f); _p_stObject->h_Cineinfo->hInit->xAngularDecreaseSpeed = MTH_C_ZERO; _p_stObject->h_Cineinfo->hInit->xTargetSpeed = MTH_M_xFloatToReal(200.0f); _p_stObject->h_Cineinfo->hInit->xTargetIncreaseSpeed = MTH_M_xFloatToReal(1.0f); _p_stObject->h_Cineinfo->hInit->xTargetDecreaseSpeed = MTH_C_ZERO; _p_stObject->h_Cineinfo->hInit->xFocal = MTH_M_xFloatToReal(1.5f); _p_stObject->h_Cineinfo->hInit->xZMin = MTH_C_InfinitMinus; _p_stObject->h_Cineinfo->hInit->xZMax = MTH_C_InfinitPlus; _p_stObject->h_Cineinfo->hInit->hSuperObjectTargeted = NULL; _p_stObject->h_Cineinfo->hInit->hSecondSuperObjectTargeted = NULL; _p_stObject->h_Cineinfo->hInit->uwDNMFlags = 0; _p_stObject->h_Cineinfo->hInit->uwIAFlags = 0; _p_stObject->h_Cineinfo->hInit->eTypeOfViewport = CAM_e_NoViewport; _p_stObject->h_Cineinfo->hInit->cChannel = -1; _p_stObject->h_Cineinfo->hInit->bIsActive = FALSE; } MS_tdxHandleToCineinfo CAM_fn_hCineinfoRealAlloc( void ) { MS_tdxHandleToCineinfo hCineinfo; hCineinfo = (MS_tdxHandleToCineinfo) M_p_GameMallocInHLM(CAM_fn_ulCineinfoSizeOf()); return(hCineinfo); } MS_tdxHandleToInternalCineinfo CAM_fn_hCineinfoInternalRealAlloc() { MS_tdxHandleToInternalCineinfo hCineinfoInternal; hCineinfoInternal = (MS_tdxHandleToInternalCineinfo) M_p_GameMallocInHLM (CAM_fn_ulCineinfoInternalSizeOf()); return(hCineinfoInternal); } /* *================================================================================================= * Cineinfo's object action free. *================================================================================================= */ void CAM_fn_vCineinfoFree(struct tdstEngineObject_ *_p_stObject) { if (_p_stObject == NULL) M_GameFatalError(E_uwGameMiniStructObjectNull); if (_p_stObject->h_Cineinfo == NULL) M_GameFatalError(E_uwGameMiniStructNull); if (_p_stObject->h_Cineinfo->hInit == NULL) M_GameFatalError(E_uwGameMiniStructNull); MMG_fn_vBeginMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubTypeCineInfo , _p_stObject ); M_GameFreeInHLM(_p_stObject->h_Cineinfo->hInit); if (_p_stObject->h_Cineinfo->hCurrent == NULL) M_GameFatalError(E_uwGameMiniStructNull); M_GameFreeInHLM(_p_stObject->h_Cineinfo->hCurrent); if (_p_stObject->h_Cineinfo->hVisibility == NULL) M_GameFatalError(E_uwGameMiniStructNull); M_GameFreeInHLM(_p_stObject->h_Cineinfo->hVisibility); if (_p_stObject->h_Cineinfo->hWork == NULL) M_GameFatalError(E_uwGameMiniStructNull); M_GameFreeInHLM(_p_stObject->h_Cineinfo->hWork); M_GameFreeInHLM(_p_stObject->h_Cineinfo); MMG_fn_vEndMemoryInfo(); } /* *================================================================================================= * Reinit private structure of cineinfo. *================================================================================================= */ void CAM_fn_vInitCompleteCineinfo(MS_tdxHandleToCineinfo _hCineinfo) { MTH3D_M_vNullVector(&_hCineinfo->stLastFailedOrigin); MTH3D_M_vNullVector(&_hCineinfo->stLastFailedWanted); MTH3D_M_vNullVector(&_hCineinfo->stForceTarget); MTH3D_M_vNullVector(&_hCineinfo->stForcePosition); MTH3D_M_vNullVector(&_hCineinfo->stForceRefAxisY); MTH3D_M_vNullVector(&_hCineinfo->stForceRefAxisZ); _hCineinfo->xApexRatio = MTH_C_ZERO; _hCineinfo->xLastDeltaCut = MTH_C_ZERO; _hCineinfo->eState = CAM_e_State_GoToOptimal; /* ANNECY MT - 03/08/99 { */ /* _hCineinfo->wCounter1 = 0; _hCineinfo->wCounter2 = 0; _hCineinfo->wCounter3 = 0; _hCineinfo->wCounter4 = 0; */ _hCineinfo->xCounter1 = MTH_C_ZERO; _hCineinfo->xCounter2 = MTH_C_ZERO; _hCineinfo->xCounter3 = MTH_C_ZERO; _hCineinfo->xCounter4 = MTH_C_ZERO; /* END ANNECY MT } */ _hCineinfo->ucVolIAFlags = 0; _hCineinfo->ucPerIAFlags = 0; _hCineinfo->cLastCutAngleSens = 0; _hCineinfo->bCanDoBestPos = TRUE; CAM_fn_vUpdateTargetPosition(_hCineinfo); g_hOldTargetedPerso = NULL; /* Important : After all other inits !!! */ CAM_fn_vSetCineinfoCurrentFromInit(_hCineinfo); } /* *================================================================================================= *================================================================================================= */ void CAM_fn_vUpdateTargetPosition(MS_tdxHandleToCineinfo _hCineinfo) { HIE_tdxHandleToSuperObject hSuperObj; MTH3D_tdstVector Axis; hSuperObj = _hCineinfo->hWork->hSuperObjectTargeted; if (hSuperObj!=NULL) { /* MTH3D_M_vNullVector(&MVectorNull); for(uc=0; ucAveragePosition.a_CheckedSpeed[uc]),&MVectorNull); MTH3D_M_vCopyVector(&(_hCineinfo ->AveragePosition.a_CheckedPos[uc]),&MVectorNull); _hCineinfo->AveragePosition.a_CheckedTime[uc] = MTH_C_ZERO; } */ memset( _hCineinfo ->AveragePosition.a_CheckedSpeed , 0 , C_ucNbOfCheckedSpeeds * sizeof(MTH3D_tdstVector) ); memset( _hCineinfo ->AveragePosition.a_CheckedPos , 0 , C_ucNbOfCheckedSpeeds * sizeof(MTH3D_tdstVector) ); memset( _hCineinfo->AveragePosition.a_CheckedTime , 0 , C_ucNbOfCheckedSpeeds * sizeof(MTH_tdxReal) ); MTH3D_M_vSetVectorElements( &Axis, MTH_C_ZERO, MTH_C_MinusONE, MTH_C_ZERO); fn_vCineinfoSetSightAxis(_hCineinfo,&Axis); MTH3D_M_vSetVectorElements( &Axis, MTH_C_MinusONE, MTH_C_ZERO, MTH_C_ZERO); fn_vCineinfoSetFirstComplementaryAxis(_hCineinfo,&Axis); MTH3D_M_vSetVectorElements( &Axis, MTH_C_ZERO,MTH_C_ZERO,MTH_C_MinusONE); fn_vCineinfoSetSecondComplementaryAxis(_hCineinfo,&Axis); } } /* *================================================================================================= * Cineinfo's object action initialisation. *================================================================================================= */ void CAM_fn_vCineinfoInit(struct tdstEngineObject_ *_p_stObject, enum tdeObjectTreeInit_ eObjectInit) { /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ MS_tdxHandleToCineinfo hCineinfo; HIE_tdxHandleToSuperObject hTarget; HIE_tdxHandleToSuperObject hSupObjectCamera; /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ if (_p_stObject == NULL) M_GameFatalError(E_uwGameMiniStructObjectNull); hCineinfo = _p_stObject->h_Cineinfo; if (_p_stObject->h_Cineinfo == NULL) M_GameFatalError(E_uwGameMiniStructNull); switch(eObjectInit) { case OTI_AlwaysCreated: case OTI_PlayerDead: case OTI_ReinitTheMap: /*HP 301198*/ case OTI_LoadSavedGame: /* * Get handle of target */ hTarget = MC_fn_hGetCharacterInMainCharacterNode( MC_fn_hGetFirstMainCharNode()); hCineinfo->hInit->hSuperObjectTargeted = hTarget; CAM_fn_vInitCompleteCineinfo(hCineinfo); break; /* case OTI_LoadSavedGame:*/ case OTI_WhenGameStart: break; case OTI_MapLoaded: hSupObjectCamera = M_GetSuperObject(_p_stObject); if (hSupObjectCamera==NULL) M_GameFatalError(E_uwGameCineInfoSuperObjectNull); CAM_fn_vSetCameraInList(hSupObjectCamera); /* * Get handle of target */ hTarget = MC_fn_hGetCharacterInMainCharacterNode( MC_fn_hGetFirstMainCharNode()); hCineinfo->hInit->hSuperObjectTargeted = hTarget; CAM_fn_vInitCompleteCineinfo(hCineinfo); break; } } /* *================================================================================================= * Cineinfo's object action desinitialisation *================================================================================================= */ void CAM_fn_vCineinfoDesinit(struct tdstEngineObject_ *_p_stObject, enum tdeObjectTreeInit_ _eObjectInit) { if (_p_stObject==NULL) M_GameFatalError(E_uwGameMiniStructObjectNull); if (_p_stObject->h_Cineinfo==NULL) M_GameFatalError(E_uwGameMiniStructNull); switch(_eObjectInit) { case OTI_LoadSavedGame: break; case OTI_ReinitTheMap: break; case OTI_MapLoaded: break; case OTI_AlwaysCreated: case OTI_PlayerDead: break; default: break; } } /* *================================================================================================= * Cineinfo's object copy clone action *================================================================================================= */ void CAM_fn_vCineinfoCopyClone(struct tdstEngineObject_ *_p_stObjectDest,struct tdstEngineObject_ *_p_stObjectSrc) { memcpy(_p_stObjectDest->h_Cineinfo->hInit, _p_stObjectSrc->h_Cineinfo->hInit, sizeof(struct tdstInternalStructurCineinfo_)); } /* ************************************************************************************************** ************************************************************************************************** Access Functions for fields in the internal structure ************************************************************************************************** ************************************************************************************************** */ /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH3D_tdstVector *CAM_fn_p_stCineInfoGetShiftTarget(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(&(_hIntCineinfo->stShiftTarget)); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetShiftTarget(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH3D_tdstVector *_p_stShiftTarget) { memcpy( &(_hIntCineinfo->stShiftTarget), _p_stShiftTarget, sizeof(MTH3D_tdstVector)); } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH3D_tdstVector *CAM_fn_p_stCineInfoGetShiftPos(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(&(_hIntCineinfo->stShiftPos)); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetShiftPos(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH3D_tdstVector *_p_stShiftPos) { memcpy(&(_hIntCineinfo->stShiftPos), _p_stShiftPos,sizeof(MTH3D_tdstVector)); } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetDistMin(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xDistMin); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetDistMin(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xDistance) { _hIntCineinfo->xDistMin = _xDistance; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetDistMax(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xDistMax); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetDistMax(MS_tdxHandleToInternalCineinfo _hIntCineinfo,MTH_tdxReal _xDistance) { _hIntCineinfo->xDistMax = _xDistance; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetBoundDistMin(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xBoundDistMin); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetBoundDistMin(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xDistance) { _hIntCineinfo->xBoundDistMin = _xDistance; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetBoundDistMax(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xBoundDistMax); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetBoundDistMax(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xDistance) { _hIntCineinfo->xBoundDistMax = _xDistance; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetAngleAlpha(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xAngleAlpha); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetAngleAlpha(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xAngle) { _hIntCineinfo->xAngleAlpha = _xAngle; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetAngleShiftAlpha(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xAngleShiftAlpha); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetAngleShiftAlpha(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xAngle) { _hIntCineinfo->xAngleShiftAlpha = _xAngle; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetAngleTheta(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xAngleTheta); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetAngleTheta(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xAngle) { _hIntCineinfo->xAngleTheta = _xAngle; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetAngleShiftTheta(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xAngleShiftTheta); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetAngleShiftTheta(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xAngle) { _hIntCineinfo->xAngleShiftTheta = _xAngle; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetLinearSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xLinearSpeed); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetLinearSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xSpeed) { _hIntCineinfo->xLinearSpeed = _xSpeed; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetLinearIncreaseSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xLinearIncreaseSpeed); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetLinearIncreaseSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xFact) { _hIntCineinfo->xLinearIncreaseSpeed = _xFact; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetLinearDecreaseSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xLinearDecreaseSpeed); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetLinearDecreaseSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xFact) { _hIntCineinfo->xLinearDecreaseSpeed = _xFact; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetAngularSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xAngularSpeed); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetAngularSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xAngle) { _hIntCineinfo->xAngularSpeed = _xAngle; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetAngularIncreaseSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xAngularIncreaseSpeed); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetAngularIncreaseSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xFact) { _hIntCineinfo->xAngularIncreaseSpeed = _xFact; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetAngularDecreaseSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xAngularDecreaseSpeed); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetAngularDecreaseSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xFact) { _hIntCineinfo->xAngularDecreaseSpeed = _xFact; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetTargetSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xTargetSpeed); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetTargetSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xSpeed) { _hIntCineinfo->xTargetSpeed = _xSpeed; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetTargetIncreaseSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xTargetIncreaseSpeed); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetTargetIncreaseSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xFact) { _hIntCineinfo->xTargetIncreaseSpeed = _xFact; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetTargetDecreaseSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xTargetDecreaseSpeed); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetTargetDecreaseSpeed(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xFact) { _hIntCineinfo->xTargetDecreaseSpeed = _xFact; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetFocal(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xFocal); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetFocal(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xAngle) { _hIntCineinfo->xFocal = _xAngle; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetZMin(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xZMin); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetZMin(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xZ) { _hIntCineinfo->xZMin = _xZ; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ MTH_tdxReal CAM_fn_xCineInfoGetZMax(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->xZMax); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetZMax(MS_tdxHandleToInternalCineinfo _hIntCineinfo, MTH_tdxReal _xZ) { _hIntCineinfo->xZMax = _xZ; } /* ================================================================================================= ================================================================================================= */ HIE_tdxHandleToSuperObject CAM_fn_hCineInfoGetSuperObjectTargeted(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->hSuperObjectTargeted); } #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ void CAM_fn_vCineInfoSetSuperObjectTargeted(MS_tdxHandleToInternalCineinfo _hIntCineinfo, HIE_tdxHandleToSuperObject _hSuperObject) { _hIntCineinfo->hSuperObjectTargeted = _hSuperObject; } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ unsigned short CAM_fn_uwCineInfoGetDNMFlags(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->uwDNMFlags); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetDNMFlags(MS_tdxHandleToInternalCineinfo _hIntCineinfo, unsigned short _uwFlag) { _hIntCineinfo->uwDNMFlags = _uwFlag; } /* ================================================================================================= ================================================================================================= */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ unsigned short CAM_fn_uwCineInfoGetIAFlags(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->uwIAFlags); } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ void CAM_fn_vCineInfoSetIAFlags(MS_tdxHandleToInternalCineinfo _hIntCineinfo, unsigned short _uwFlag) { _hIntCineinfo->uwIAFlags = _uwFlag; } /* ================================================================================================= Type of viewport ================================================================================================= */ enum e_ucListViewport_ CAM_fn_eCineInfoGetTypeOfViewport(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->eTypeOfViewport); } void CAM_fn_vCineInfoSetTypeOfViewport(MS_tdxHandleToInternalCineinfo _hIntCineinfo, enum e_ucListViewport_ _eType) { _hIntCineinfo->eTypeOfViewport = _eType; } /* ================================================================================================= ================================================================================================= */ char CAM_fn_cCineInfoGetChannel(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return (_hIntCineinfo -> cChannel); } void CAM_fn_vCineInfoSetChannel(MS_tdxHandleToInternalCineinfo _hIntCineinfo, char _cChannel) { _hIntCineinfo -> cChannel = _cChannel; } /* ================================================================================================= ================================================================================================= */ ACP_tdxBool CAM_fn_bCineInfoGetIsActive(MS_tdxHandleToInternalCineinfo _hIntCineinfo) { return(_hIntCineinfo->bIsActive); } void CAM_fn_vCineInfoSetIsActive(MS_tdxHandleToInternalCineinfo _hIntCineinfo, ACP_tdxBool _bIsActive) { _hIntCineinfo->bIsActive = _bIsActive; } /* ************************************************************************************************** ************************************************************************************************** Special functions ************************************************************************************************** ************************************************************************************************** */ /* ================================================================================================= * Activation of a camera (used by editor) ================================================================================================= */ /* void CAM_fn_vCameraActivedByEditor(HIE_tdxHandleToSuperObject _hSuperObject) { MS_tdxHandleToInternalCineinfo hCurrentCineinfo; hCurrentCineinfo = M_GetCineinfo( _hSuperObject, Current); CAM_fn_vCineInfoSetIsActive(hCurrentCineinfo, TRUE); CAM_fn_vCineInfoSetTypeOfViewport(hCurrentCineinfo, CAM_e_NoViewport); } */ /* ================================================================================================= * Disable a camera (used by editor) ================================================================================================= */ /* void CAM_fn_vCameraDesactivedByEditor(HIE_tdxHandleToSuperObject _hSuperObject) { MS_tdxHandleToInternalCineinfo hCurrentCineinfo, hInitCineinfo; hCurrentCineinfo = M_GetCineinfo( _hSuperObject, Current); hInitCineinfo = M_GetCineinfo( _hSuperObject, Init); CAM_fn_vCineInfoSetIsActive(hCurrentCineinfo, CAM_fn_bCineInfoGetIsActive(hInitCineinfo)); CAM_fn_vCineInfoSetTypeOfViewport(hCurrentCineinfo, CAM_fn_eCineInfoGetTypeOfViewport(hInitCineinfo)); } */ /* ================================================================================================= * Copy the cineinfos structures. ================================================================================================= */ /*extern void CAM_memcpy(void *dest, void *src, long size);*/ #define CAM_memcpy memcpy void CAM_fn_vSetCineinfoCurrentFromInit(MS_tdxHandleToCineinfo _hCineinfo) { CAM_memcpy(_hCineinfo->hCurrent, _hCineinfo->hInit, sizeof(struct tdstInternalStructurCineinfo_)); _hCineinfo->ucVolIAFlags |= C_VolIAFlags_InitJustCopiedInCurrent; } void CAM_fn_vSetCineinfoWorkFromCurrent(MS_tdxHandleToCineinfo _hCineinfo) { if (!(_hCineinfo->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)) { _hCineinfo->ucVolIAFlags |= C_VolIAFlags_CurrentAlreadyCopiedInWork; CAM_memcpy(_hCineinfo->hWork, _hCineinfo->hCurrent, sizeof(struct tdstInternalStructurCineinfo_)); } } void CAM_fn_vSetCineinfoVisibilityFromCurrent(MS_tdxHandleToCineinfo _hCineinfo) { if(!(_hCineinfo->ucPerIAFlags & C_PerIAFlags_VisibilityCopied)) { CAM_memcpy(_hCineinfo->hVisibility, _hCineinfo->hCurrent, sizeof(struct tdstInternalStructurCineinfo_)); _hCineinfo->ucPerIAFlags |= C_PerIAFlags_VisibilityCopied; } } void CAM_fn_vSetCineinfoCurrentFromVisibility(MS_tdxHandleToCineinfo _hCineinfo) { CAM_memcpy(_hCineinfo->hCurrent, _hCineinfo->hVisibility, sizeof(struct tdstInternalStructurCineinfo_)); _hCineinfo->ucPerIAFlags &= ~C_PerIAFlags_VisibilityCopied; } void CAM_fn_vSetCineinfoWorkFromVisibility(MS_tdxHandleToCineinfo _hCineinfo) { CAM_memcpy(_hCineinfo->hWork, _hCineinfo->hVisibility, sizeof(struct tdstInternalStructurCineinfo_)); } /* ************************************************************************************************** ************************************************************************************************** ************************************************************************************************** ************************************************************************************************** */ /* ================================================================================================== * Add camera in camera's list ================================================================================================== */ void CAM_fn_vSetCameraInList(HIE_tdxHandleToSuperObject _hSupObjectCamera) { tdstNodeCamera *p_stTempNodeCamera; /* Add This Camera to the List of Active Ones */ MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubTypeCineInfo , 0 ); p_stTempNodeCamera=(tdstNodeCamera *)M_p_GameMallocInHLM(sizeof(tdstNodeCamera)); p_stTempNodeCamera->p_stSuperObjectCamera = _hSupObjectCamera; LST2_M_DynamicInitElement(p_stTempNodeCamera); LST2_M_DynamicAddTail(&g_stEngineStructure.hCameraList,p_stTempNodeCamera); } /* ================================================================================================== * Delete camera in camera's list ================================================================================================== */ #ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */ void CAM_fn_vDeleteCameraInList(HIE_tdxHandleToSuperObject _hSupObjectCamera) { long i; tdstNodeCamera *p_stTempNodeCamera; HIE_tdxHandleToSuperObject hSuperObject ; LST2_M_DynamicForEachElementOf(&g_stEngineStructure.hCameraList,p_stTempNodeCamera,i) { if (p_stTempNodeCamera != NULL) { /* Search the SuperObject with HIE_C_ulActor type */ hSuperObject = p_stTempNodeCamera->p_stSuperObjectCamera; if (hSuperObject == _hSupObjectCamera) { LST2_M_DynamicIsolate(p_stTempNodeCamera); MMG_fn_vAddMemoryInfo( MMG_C_lTypeMiniStructure , MMG_C_lSubTypeCineInfo , 0 ); M_GameFreeInHLM(p_stTempNodeCamera) } } } } #endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */ /* ================================================================================================== * Get Main camera ================================================================================================== */ HIE_tdxHandleToSuperObject CAM_fn_hGetMainActiveCamera(HIE_tdxHandleToSuperObject hSuperObject) { HIE_tdxHandleToSuperObject hChild; HIE_tdxHandleToSuperObject hActiveCamera = NULL; long i; long lSuperObjectType; HIE_M_ForEachChildOf(hSuperObject,hChild,i) { hActiveCamera = CAM_fn_hGetMainActiveCamera(hChild); if (hActiveCamera!=NULL) break; } if (hActiveCamera == NULL) { lSuperObjectType = HIE_fn_ulGetSuperObjectType(hSuperObject); if (lSuperObjectType == HIE_C_ulActor) { if (M_GetMSHandle(hSuperObject,Cineinfo) != NULL) { if ( CAM_fn_bCineInfoGetIsActive(M_GetCineinfo(hSuperObject,Init)) && CAM_fn_eCineInfoGetTypeOfViewport(M_GetCineinfo(hSuperObject,Init)) != CAM_e_NoViewport ) { hActiveCamera = hSuperObject; } } } } return(hActiveCamera); } /* ************************************************************************************************** ************************************************************************************************** */ MTH3D_tdstVector *fn_p_CineinfoGetSightAxis(MS_tdxHandleToCineinfo _hCineinfo) { return (&(_hCineinfo->stSightAxisSystem.SightAxis)); } void fn_vCineinfoSetSightAxis(MS_tdxHandleToCineinfo _hCineinfo,MTH3D_tdstVector *p_stVector) { MTH3D_M_vCopyVector(&(_hCineinfo->stSightAxisSystem.SightAxis), p_stVector); } /*----------------------------------------------------------------------------- *---------------------------------------------------------------------------*/ MTH3D_tdstVector *fn_p_CineinfoGetFirstComplementaryAxis(MS_tdxHandleToCineinfo _hCineinfo) { return (&(_hCineinfo->stSightAxisSystem.FirstComplementaryAxis)); } void fn_vCineinfoSetFirstComplementaryAxis(MS_tdxHandleToCineinfo _hCineinfo,MTH3D_tdstVector *p_stVector) { MTH3D_M_vCopyVector(&(_hCineinfo->stSightAxisSystem.FirstComplementaryAxis), p_stVector); } /*----------------------------------------------------------------------------- *---------------------------------------------------------------------------*/ MTH3D_tdstVector *fn_p_CineinfoGetSecondComplementaryAxis(MS_tdxHandleToCineinfo _hCineinfo) { return (&(_hCineinfo->stSightAxisSystem.SecondComplementaryAxis)); } void fn_vCineinfoSetSecondComplementaryAxis(MS_tdxHandleToCineinfo _hCineinfo,MTH3D_tdstVector *p_stVector) { MTH3D_M_vCopyVector(&(_hCineinfo->stSightAxisSystem.SecondComplementaryAxis), p_stVector); } /*----------------------------------------------------------------------------- *---------------------------------------------------------------------------*/ /* MTH3D_tdstVector *fn_p_CineinfoGetCheckedSpeed(MS_tdxHandleToCineinfo _hCineinfo,unsigned long _ul) { if ( _ul < C_ucNbOfCheckedSpeeds ) return (&(_hCineinfo ->AveragePosition.a_CheckedSpeed[_ul])); return NULL; } void fn_vCineinfoSetCheckedSpeed(MS_tdxHandleToCineinfo _hCineinfo,unsigned long _ul,MTH3D_tdstVector *p_Speed) { if ( _ul < C_ucNbOfCheckedSpeeds ) { MTH3D_M_vCopyVector((&(_hCineinfo->AveragePosition.a_CheckedSpeed[_ul])),p_Speed); } } */ /*----------------------------------------------------------------------------- *---------------------------------------------------------------------------*/ /* MTH_tdxReal fn_xCineinfoGetCheckedTime(MS_tdxHandleToCineinfo _hCineinfo,unsigned long _ul) { if ( _ul < C_ucNbOfCheckedSpeeds ) return (_hCineinfo ->AveragePosition.a_CheckedTime[_ul]); return 0; } void fn_vCineinfoSetCheckedTime(MS_tdxHandleToCineinfo _hCineinfo,unsigned long _ul,MTH_tdxReal _dt) { if ( _ul < C_ucNbOfCheckedSpeeds ) { _hCineinfo->AveragePosition.a_CheckedTime[_ul] = _dt; } } */ /*----------------------------------------------------------------------------- *---------------------------------------------------------------------------*/ /* MTH3D_tdstVector *fn_p_CineinfoGetCheckedPos(MS_tdxHandleToCineinfo _hCineinfo,unsigned long _ul) { if ( _ul < C_ucNbOfCheckedSpeeds ) return (&(_hCineinfo ->AveragePosition.a_CheckedPos[_ul])); return NULL; } void fn_vCineinfoSetCheckedPos(MS_tdxHandleToCineinfo _hCineinfo,unsigned long _ul,MTH3D_tdstVector *p_Pos) { if ( _ul < C_ucNbOfCheckedSpeeds ) { MTH3D_M_vCopyVector((&(_hCineinfo->AveragePosition.a_CheckedPos[_ul])),p_Pos); } } */ /*----------------------------------------------------------------------------- *---------------------------------------------------------------------------*/ void fn_vGetPersoSightAxisSystem ( MS_tdxHandleToCineinfo _hCineinfo, MTH3D_tdstVector *_p_stSightAxis, MTH3D_tdstVector *_p_stFirstComplementaryAxis, MTH3D_tdstVector *_p_stSecondComplementaryAxis ) { MTH3D_M_vCopyVector(_p_stSightAxis , fn_p_CineinfoGetSightAxis(_hCineinfo)); MTH3D_M_vCopyVector(_p_stFirstComplementaryAxis , fn_p_CineinfoGetFirstComplementaryAxis(_hCineinfo)); MTH3D_M_vCopyVector(_p_stSecondComplementaryAxis , fn_p_CineinfoGetSecondComplementaryAxis(_hCineinfo)); } /*----------------------------------------------------------------------------- *---------------------------------------------------------------------------*/ void fn_vInitAveragePositionDatasIfNecessary(MS_tdxHandleToCineinfo _hCineinfo) { unsigned long ulIndex; MTH_tdxReal xBaseTime; MTH3D_tdstVector *p_stVectorPos; for ( ulIndex = 0; ulIndex < C_ucNbOfCheckedSpeeds; ulIndex ++ ) if(_hCineinfo ->AveragePosition.a_CheckedTime[ulIndex]) break; /* if there are already some datas in the structure, it is not necessary to init it*/ if(ulIndex < C_ucNbOfCheckedSpeeds) return; p_stVectorPos = POS_fn_p_stGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(_hCineinfo->hWork->hSuperObjectTargeted)); xBaseTime = MTH_M_xFloatToReal(0.03f); for ( ulIndex = 0; ulIndex < C_ucNbOfCheckedSpeeds; ulIndex ++ ) { _hCineinfo->AveragePosition.a_CheckedTime[ulIndex] = xBaseTime; MTH3D_M_vNullVector(&(_hCineinfo ->AveragePosition.a_CheckedSpeed[ulIndex])); MTH3D_M_vCopyVector(&(_hCineinfo ->AveragePosition.a_CheckedPos[ulIndex]),p_stVectorPos); } } /*----------------------------------------------------------------------------- * index of added value unimportant *---------------------------------------------------------------------------*/ void CAM_fn_vRemindSpeed(MS_tdxHandleToCineinfo _hCineinfo,MTH_tdstMove *_p_Speed) { /* unsigned long ulIndex; for ( ulIndex = C_ucNbOfCheckedSpeeds - 1; ulIndex > 0; ulIndex --) MTH3D_M_vCopyVector(&(_hCineinfo ->AveragePosition.a_CheckedSpeed[ulIndex]),&(_hCineinfo ->AveragePosition.a_CheckedSpeed[ulIndex - 1])); MTH3D_M_vCopyVector(&(_hCineinfo ->AveragePosition.a_CheckedSpeed[0]),MTH_M_p_stMoveGetLinear(_p_Speed)); */ memcpy (_hCineinfo -> AveragePosition . a_CheckedSpeed , & (_hCineinfo -> AveragePosition . a_CheckedSpeed[1]), (C_ucNbOfCheckedSpeeds - 1) * sizeof (MTH3D_tdstVector) ); MTH3D_M_vCopyVector ( & (_hCineinfo -> AveragePosition . a_CheckedSpeed [C_ucNbOfCheckedSpeeds-1]) , MTH_M_p_stMoveGetLinear (_p_Speed)); } /*----------------------------------------------------------------------------- * index of added value unimportant *---------------------------------------------------------------------------*/ void CAM_fn_vRemindPos(MS_tdxHandleToCineinfo _hCineinfo,MTH_tdstMove *_p_Pos) { /* unsigned long ulIndex; for ( ulIndex = C_ucNbOfCheckedSpeeds - 1; ulIndex > 0; ulIndex -- ) MTH3D_M_vCopyVector(&(_hCineinfo ->AveragePosition.a_CheckedPos[ulIndex]), &(_hCineinfo ->AveragePosition.a_CheckedPos[ulIndex-1])); MTH3D_M_vCopyVector(&(_hCineinfo ->AveragePosition.a_CheckedPos[0]),MTH_M_p_stMoveGetLinear(_p_Pos)); */ memcpy ( _hCineinfo -> AveragePosition . a_CheckedPos , & (_hCineinfo -> AveragePosition . a_CheckedPos[1]), (C_ucNbOfCheckedSpeeds - 1) * sizeof (MTH3D_tdstVector) ); MTH3D_M_vCopyVector ( & (_hCineinfo -> AveragePosition . a_CheckedPos [C_ucNbOfCheckedSpeeds-1]) , MTH_M_p_stMoveGetLinear (_p_Pos)); } /*----------------------------------------------------------------------------- * index of added value unimportant *---------------------------------------------------------------------------*/ void CAM_fn_vRemindTime(MS_tdxHandleToCineinfo _hCineinfo,MTH_tdxReal _dt) { /* unsigned long ulIndex; for ( ulIndex = C_ucNbOfCheckedSpeeds - 1; ulIndex > 0; ulIndex -- ) _hCineinfo->AveragePosition.a_CheckedTime[ulIndex] = _hCineinfo->AveragePosition.a_CheckedTime[ulIndex-1]; _hCineinfo->AveragePosition.a_CheckedTime[0] = _dt; */ memcpy (_hCineinfo -> AveragePosition . a_CheckedTime , & (_hCineinfo -> AveragePosition . a_CheckedTime[1]) , (C_ucNbOfCheckedSpeeds - 1) * sizeof (MTH_tdxReal)); _hCineinfo->AveragePosition.a_CheckedTime[C_ucNbOfCheckedSpeeds-1] = _dt; } /*----------------------------------------------------------------------------- *---------------------------------------------------------------------------*/ void CAM_fn_vAverageSpeed(MS_tdxHandleToCineinfo _hCineinfo,MTH_tdxReal xTimeWindow,MTH3D_tdstVector *p_result) { MTH_tdxReal xCurrentTime,tmpTime; unsigned long ulIndex; MTH3D_tdstVector *p_stTmp; fn_vInitAveragePositionDatasIfNecessary(_hCineinfo); xCurrentTime = 0; MTH3D_M_vNullVector(p_result); for ( ulIndex = 0; ulIndex < C_ucNbOfCheckedSpeeds; ulIndex ++ ) { tmpTime = _hCineinfo ->AveragePosition.a_CheckedTime[ulIndex]; p_stTmp = &(_hCineinfo ->AveragePosition.a_CheckedSpeed[ulIndex]); if(tmpTime && !MTH3D_M_bIsNullVector(p_stTmp)) { xCurrentTime += tmpTime; /*MTH3D_M_vCopyVector(&tmp ,&(_hCineinfo ->AveragePosition.a_CheckedSpeed[ulIndex]));*/ /*MTH3D_M_vMulScalarVector( &tmp, tmpTime,&tmp);*/ /*MTH3D_M_vAddVector( &tmpResult,&tmpResult,&tmp);*/ MTH3D_M_vMulAddVector( p_result, tmpTime , p_stTmp , p_result ); if(xCurrentTime >= xTimeWindow) break; } } if ( xCurrentTime ) MTH3D_M_vDivScalarVector( p_result , p_result , xCurrentTime); } /*----------------------------------------------------------------------------- *---------------------------------------------------------------------------*/ void CAM_fn_vAveragePosition(MS_tdxHandleToCineinfo _hCineinfo,MTH_tdxReal xTimeWindow,MTH3D_tdstVector *p_result) { MTH_tdxReal xCurrentTime,tmpTime; unsigned long ulIndex; MTH3D_tdstVector *p_stTmp; fn_vInitAveragePositionDatasIfNecessary(_hCineinfo); xCurrentTime = 0; MTH3D_M_vNullVector(p_result); for ( ulIndex = 0; ulIndex < C_ucNbOfCheckedSpeeds; ulIndex ++ ) { tmpTime = _hCineinfo ->AveragePosition.a_CheckedTime[ulIndex]; p_stTmp = &(_hCineinfo ->AveragePosition.a_CheckedPos[ulIndex]); if(tmpTime && !MTH3D_M_bIsNullVector(p_stTmp)) { xCurrentTime += tmpTime; /*MTH3D_M_vCopyVector(&tmp ,&(_hCineinfo ->AveragePosition.a_CheckedPos[ulIndex]));*/ /*MTH3D_M_vMulScalarVector( &tmp, tmpTime,&tmp);*/ /*MTH3D_M_vAddVector( &tmpResult,&tmpResult,&tmp);*/ MTH3D_M_vMulAddVector( p_result, tmpTime , p_stTmp , p_result ); if(xCurrentTime >= xTimeWindow) break; } } if(xCurrentTime) MTH3D_M_vDivScalarVector( p_result, p_result, xCurrentTime); } /* ************************************************************************************************** ************************************************************************************************** ************************************************************************************************** ************************************************************************************************** */