reman3/Rayman_X/cpa/tempgrp/GAM/Actions/ms_microCB.c

132 lines
3.7 KiB
C

/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_Micro_StructureDefine
#define D_Micro_VariableDefine
#include "ToolsCPA.h"
#include "SND.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "ObjInit.h"
#include "ZeMem.h"
#include "ldt.h"
#define lTagMatrixRotation 'atoR'
#define lTagMatrixTranslation 'narT'
#define lTagMicroIsActive 'tcAs'
#define lTagMicroIsInactive 'anIs'
/*****************************************************************
Function name : fn_iCreateMicro
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateMicro( LDT_tdst_Link *pLink )
{
MS_tdxHandleToMicro h_MS_Micro;
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
MMG_fn_vBeginMemoryInfo (MMG_C_lTypeMiniStructure , MMG_C_lSubTypeMicro , p_stEngineObject);
h_MS_Micro = fn_h_MicroRealAlloc();
MMG_fn_vEndMemoryInfo ();
p_stEngineObject->h_Micro = h_MS_Micro;
h_MS_Micro->bIsActive = 0;
POS_fn_vSetIdentityMatrix( h_MS_Micro->hMicroMatrix );
pLink->pObject = (void*)h_MS_Micro;
return 0;
}
/*****************************************************************
Function name : fn_iLoadMicro
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadMicro( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
MS_tdxHandleToMicro h_MS_Micro = (MS_tdxHandleToMicro)pLink->pObject;
struct tdstEngineObject_ *p_stEngineObject = (struct tdstEngineObject_ *)pLink->pParent->pObject;
MTH3D_tdstVector stX,stY,stZ;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case lTagMatrixRotation : /* */
{
MTH3D_M_vSetVectorElements(&stX,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
MTH3D_M_vSetVectorElements(&stY,
(float)atof(LDT_szGetParam(4)), (float)atof(LDT_szGetParam(5)), (float)atof(LDT_szGetParam(6)) );
MTH3D_M_vSetVectorElements(&stZ,
(float)atof(LDT_szGetParam(7)), (float)atof(LDT_szGetParam(8)), (float)atof(LDT_szGetParam(9)) );
POS_fn_vSetRotationMatrix(h_MS_Micro->hMicroMatrix,&stX,&stY,&stZ);
}
break;
case lTagMatrixTranslation : /* */
{
MTH3D_M_vSetVectorElements(&stX,
(float)atof(LDT_szGetParam(1)), (float)atof(LDT_szGetParam(2)), (float)atof(LDT_szGetParam(3)) );
POS_fn_vSetTranslationVector(h_MS_Micro->hMicroMatrix,&stX);
}
break;
case lTagMicroIsActive : /* */
{
h_MS_Micro->bIsActive = 1;
}
break;
case lTagMicroIsInactive : /* */
{
h_MS_Micro->bIsActive = 0;
}
break;
}
}
}
}
return 0;
}