765 lines
36 KiB
C
765 lines
36 KiB
C
/* (c) Ubi R&D 1996*/
|
|
/* See Alain Robin for any comment or question*/
|
|
|
|
/****************************************************************************/
|
|
/* INCLUDES */
|
|
/****************************************************************************/
|
|
#include "acp_base.h"
|
|
|
|
#include "MTH.h"
|
|
#include "GEO.h"
|
|
#include "GLI.h"
|
|
|
|
#define __DeclareGlobalVariableErmGmt_h__
|
|
#include "ErmGmt.h"
|
|
|
|
#include "GmtStruc.h" /* structure definition*/
|
|
#include "GmtFunct.h" /* access function definition*/
|
|
#include "GmtProto.h" /* complex function definition*/
|
|
|
|
/****************************************************************************/
|
|
/* PRIVATE FUNCTIONS */
|
|
/****************************************************************************/
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_vRaiseFatalError
|
|
// Used to raise a fatal error of the GMT module
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use corresponding macro in ERM
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input :
|
|
// Output :
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : Mar 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications :
|
|
// Modification date : Modification author :
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
|
|
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
|
void GMT_fn_vRaiseFatalError()
|
|
{
|
|
Erm_M_UpdateLastError(Gmt, C_ucErmDefaultChannel, E_uwGmtFatalError1,
|
|
C_lErmNoDebugData, C_ucErmOpenInfoWindow,
|
|
C_ucAllowStopForDebug, NULL);
|
|
}
|
|
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
|
|
|
|
|
/****************************************************************************/
|
|
/* BASIC FUNCTIONS */
|
|
/****************************************************************************/
|
|
|
|
/*----------------------------------------------------------------------------
|
|
// Description : GMT_fn_vInitGameMaterialErrorAndMemory
|
|
// Used to initialize the memory and error variables
|
|
----------------------------------------------------------------------------//
|
|
// Methods : None
|
|
----------------------------------------------------------------------------//
|
|
// Input :
|
|
// Output :
|
|
----------------------------------------------------------------------------//
|
|
// Creation date : May 97 Author: Alain Robin
|
|
----------------------------------------------------------------------------//
|
|
// Modifications :
|
|
// Modification date : Modification author : Alain Robin
|
|
----------------------------------------------------------------------------*/
|
|
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
|
void GMT_fn_vInitGameMaterialErrorAndMemory(void)
|
|
{
|
|
Erm_M_InitErrMsg(Gmt);
|
|
}
|
|
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_hCreateGameMaterial
|
|
// Used to create an empty game material struct
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : None
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input :
|
|
// Output : Handle to the created game material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : 14 Jan 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : Add support for sectors
|
|
// Modification date : 22 Jan 97 Modification author : Alain Robin
|
|
////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : We don't allocate anything anymore for the sub-parts
|
|
// Modification date : Apr 97 Modification author : Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
GMT_tdxHandleToGameMaterial GMT_fn_hCreateGameMaterial(void)
|
|
{
|
|
/* return GMT_p_fn_hVirtualCreate ? GMT_p_fn_hVirtualCreate() : NULL;*/
|
|
if (GMT_p_fn_hVirtualCreate)
|
|
return GMT_p_fn_hVirtualCreate();
|
|
else
|
|
return NULL;
|
|
}
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_vCopyGameMaterial
|
|
// Used to copy an existing game material struct
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use the "Get" and the "Set" macros to copy the field pointers
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hSrc : source game material
|
|
// Output : _hDst : copied game material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : 14 Jan 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : Add support for sector material
|
|
// Modification date : 22 Jan 97 Modification author : Alain Robin
|
|
////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : Add handle validity verification
|
|
// Modification date : Mar 97 Modification author : Alain Robin
|
|
////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : Duplicate visual material when we copy a game material
|
|
// Modification date : Apr 97 Modification author : Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
|
|
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
|
void GMT_fn_vCopyGameMaterial(GMT_tdxHandleToGameMaterial _hDst, GMT_tdxHandleToGameMaterial _hSrc)
|
|
{
|
|
/* ACP_tdxHandleOfMaterial hVisual,hCopyOfVisual;
|
|
#ifdef _DEBUG
|
|
if((!GMT_fn_b_ulIsValid(_hDst))||(!GMT_fn_b_ulIsValid(_hSrc)))
|
|
GMT_fn_vRaiseFatalError();
|
|
#endif*/
|
|
/* Duplicate visual material */
|
|
/* hVisual=GMT_fn_hGetVisualMaterial(_hSrc);
|
|
GLI_xDuplicateMaterial (&hCopyOfVisual,hVisual);
|
|
GMT_M_vSetVisualMaterial(_hDst,hCopyOfVisual);
|
|
|
|
GMT_M_vSetSoundMaterial(_hDst,GMT_M_hGetSoundMaterial(_hSrc));
|
|
GMT_M_vSetCollideMaterial(_hDst,GMT_M_hGetCollideMaterial(_hSrc));*/
|
|
|
|
/* Copy initial values */
|
|
/* if(_hSrc->p_stInitialValues!=NULL)
|
|
{
|
|
if(_hDst->p_stInitialValues==NULL)
|
|
{
|
|
_hDst->p_stInitialValues=GMT_fn_hCreateGameMaterial();
|
|
memcpy(_hDst->p_stInitialValues,_hSrc->p_stInitialValues,sizeof(struct GMT_tdstGameMaterial_));
|
|
}
|
|
else
|
|
{
|
|
memcpy(_hDst->p_stInitialValues,_hSrc->p_stInitialValues,sizeof(struct GMT_tdstGameMaterial_));
|
|
}
|
|
}
|
|
|
|
#ifdef SECTOR_IN_GMT
|
|
GMT_M_vSetSectorMaterial(_hDst,GMT_M_hGetSectorMaterial(_hSrc));
|
|
#endif // SECTOR_IN_GMT */
|
|
if(GMT_p_fn_vVirtualCopy!=NULL)
|
|
GMT_p_fn_vVirtualCopy(_hDst,_hSrc);
|
|
}
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_vDestroyGameMaterial
|
|
// Delete a created game material handle
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : None
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hOld : game material handle to delete
|
|
// Output :
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : 14 Jan 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications :
|
|
// Modification date : Modification author :
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
void GMT_fn_vDestroyGameMaterial(GMT_tdxHandleToGameMaterial _hOld)
|
|
{
|
|
if(GMT_p_fn_vVirtualDestroy!=NULL)
|
|
GMT_p_fn_vVirtualDestroy(_hOld);
|
|
}
|
|
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
|
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_b_ulIsValid
|
|
// Checks if the handle is valid
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : None
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hOld : game material handle to delete
|
|
// Output :
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : 14 Jan 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications :
|
|
// Modification date : Modification author :
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
unsigned long GMT_fn_b_ulIsValid(GMT_tdxHandleToGameMaterial _hMaterial)
|
|
{
|
|
/*XB*/
|
|
#ifdef CHECK_POINTER
|
|
return (_hMaterial!=(GMT_tdxHandleToGameMaterial)GMT_C_ulInvalidHandle)&&
|
|
(_hMaterial!=NULL)&&(((unsigned long)_hMaterial & 0xFF000000) == 0x80000000);
|
|
#else /* CHECK_POINTER */
|
|
return (_hMaterial!=(GMT_tdxHandleToGameMaterial)GMT_C_ulInvalidHandle)&&(_hMaterial!=NULL);
|
|
#endif /* CHECK_POINTER */
|
|
/*End XB*/
|
|
}
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_vInvalidate
|
|
// Invalidate an handle
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : None
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _p_hOld : game material handle to invalidate
|
|
// Output :
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : Mar 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications :
|
|
// Modification date : Modification author :
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
|
|
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
|
void GMT_fn_vInvalidate(GMT_tdxHandleToGameMaterial* _p_hOld)
|
|
{
|
|
*_p_hOld = (GMT_tdxHandleToGameMaterial)GMT_C_ulInvalidHandle;
|
|
}
|
|
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
|
|
|
|
|
/****************************************************************************/
|
|
/* ACCESSORS */
|
|
/****************************************************************************/
|
|
|
|
/*Friend module access with macros*/
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_hGetVisualMaterial
|
|
// Used to get the visual part of the material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use corresponding macro
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// Output : Handle to the visual material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : 14 Jan 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : Add handle validity test
|
|
// Modification date : Mar 97 Modification author : A.R.
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
ACP_tdxHandleOfMaterial GMT_fn_hGetVisualMaterial(GMT_tdxHandleToGameMaterial _hGameMat)
|
|
{
|
|
#ifdef _DEBUG
|
|
if(!GMT_fn_b_ulIsValid(_hGameMat))
|
|
GMT_fn_vRaiseFatalError();
|
|
#endif
|
|
return GMT_M_hGetVisualMaterial(_hGameMat);
|
|
}
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_vSetVisualMaterial
|
|
// Used to set the visual part of the material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use corresponding macro
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// _hVisualMat : Handle to the visual meterial
|
|
// Output :
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : 14 Jan 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : Add verification of the validity of the handle
|
|
// Modification date : Modification author : A.R.
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
void GMT_fn_vSetVisualMaterial(GMT_tdxHandleToGameMaterial _hGameMat, ACP_tdxHandleOfMaterial _hVisualMat)
|
|
{
|
|
#ifdef _DEBUG
|
|
if(!GMT_fn_b_ulIsValid(_hGameMat))
|
|
GMT_fn_vRaiseFatalError();
|
|
#endif
|
|
GMT_M_vSetVisualMaterial(_hGameMat,_hVisualMat);
|
|
}
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_hGetMechanicsMaterial
|
|
// Used to get the mechanics part of the material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use corresponding macro
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// Output : Handle to the mechanics material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : 14 Jan 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : Add the handle validity verification
|
|
// Modification date : Mar 97 Modification author : A.R.
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
DNM_tdxHandleToMecMatCharacteristics GMT_fn_hGetMechanicsMaterial(GMT_tdxHandleToGameMaterial _hGameMat)
|
|
{
|
|
#ifdef _DEBUG
|
|
if(!GMT_fn_b_ulIsValid(_hGameMat))
|
|
GMT_fn_vRaiseFatalError();
|
|
#endif
|
|
return GMT_M_hGetMechanicsMaterial(_hGameMat);
|
|
}
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_vSetMechanicsMaterial
|
|
// Used to set the mechanics part of the material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use corresponding macro
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// _hMechanicsMat : Handle to the mechanics characteristics
|
|
// Output :
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : 14 Jan 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : Check the handle validity
|
|
// Modification date : Mar 97 Modification author : A.R.
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
void GMT_fn_vSetMechanicsMaterial(GMT_tdxHandleToGameMaterial _hGameMat, DNM_tdxHandleToMecMatCharacteristics _hMechanicsMat)
|
|
{
|
|
#ifdef _DEBUG
|
|
if(!GMT_fn_b_ulIsValid(_hGameMat))
|
|
GMT_fn_vRaiseFatalError();
|
|
#endif
|
|
GMT_M_vSetMechanicsMaterial(_hGameMat,_hMechanicsMat);
|
|
}
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_hGetSoundMaterial
|
|
// Used to set the sound characteristics of the material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use corresponding macro
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// Output : the sound material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : 14 Jan 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : Check the handle validity
|
|
// Modification date : Mar 97 Modification author : A.R.
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
SND_tdxHandleToSoundMaterial GMT_fn_hGetSoundMaterial(GMT_tdxHandleToGameMaterial _hGameMat)
|
|
{
|
|
#ifdef _DEBUG
|
|
if(!GMT_fn_b_ulIsValid(_hGameMat))
|
|
GMT_fn_vRaiseFatalError();
|
|
#endif
|
|
return GMT_M_hGetSoundMaterial(_hGameMat);
|
|
}
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_vSetSoundMaterial
|
|
// Used to set the sound part of the material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use corresponding macro
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// _hMechanicsMat : Handle to the mechanics characteristics
|
|
// Output :
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : 14 Jan 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : Check the handle validity
|
|
// Modification date : Mar 97 Modification author : A.R.
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
void GMT_fn_vSetSoundMaterial(GMT_tdxHandleToGameMaterial _hGameMat, SND_tdxHandleToSoundMaterial _hSoundMat)
|
|
{
|
|
#ifdef _DEBUG
|
|
if(!GMT_fn_b_ulIsValid(_hGameMat))
|
|
GMT_fn_vRaiseFatalError();
|
|
#endif
|
|
GMT_M_vSetSoundMaterial(_hGameMat,_hSoundMat);
|
|
}
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_hGetCollideMaterial
|
|
// Used to set the collision characteristics of the material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use corresponding macro
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// Output : the collide material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : 14 Jan 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : Check the handle validity
|
|
// Modification date : March 97 Modification author : A.R.
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
GMT_tdxHandleToCollideMaterial GMT_fn_hGetCollideMaterial(GMT_tdxHandleToGameMaterial _hGameMat)
|
|
{
|
|
#ifdef _DEBUG
|
|
if(!GMT_fn_b_ulIsValid(_hGameMat))
|
|
GMT_fn_vRaiseFatalError();
|
|
#endif
|
|
return GMT_M_hGetCollideMaterial(_hGameMat);
|
|
}
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_vSetCollideMaterial
|
|
// Used to set the collision part of the material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use corresponding macro
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// _hCollideMat : Handle to the collide material
|
|
// Output :
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : 14 Jan 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : Check the handle validity
|
|
// Modification date : Mar 97 Modification author : A.R.
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
void GMT_fn_vSetCollideMaterial(GMT_tdxHandleToGameMaterial _hGameMat, GMT_tdxHandleToCollideMaterial _hCollideMat)
|
|
{
|
|
#ifdef _DEBUG
|
|
if(!GMT_fn_b_ulIsValid(_hGameMat))
|
|
GMT_fn_vRaiseFatalError();
|
|
#endif
|
|
GMT_M_vSetCollideMaterial(_hGameMat,_hCollideMat);
|
|
}
|
|
|
|
#ifdef SECTOR_IN_GMT
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_hGetSectorMaterial
|
|
// Used to set the sector characteristics of the material (handle to the next
|
|
// sector)
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use corresponding macro
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// Output : the sector material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : 22 Jan 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : Check the handle validity
|
|
// Modification date : Mar 97 Modification author : A.R.
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
HIE_tdxHandleToSuperObject GMT_fn_hGetSectorMaterial(GMT_tdxHandleToGameMaterial _hGameMat)
|
|
{
|
|
#ifdef _DEBUG
|
|
if(!GMT_fn_b_ulIsValid(_hGameMat))
|
|
GMT_fn_vRaiseFatalError();
|
|
#endif
|
|
return GMT_M_hGetSectorMaterial(_hGameMat);
|
|
}
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_vSetSectorMaterial
|
|
// Used to set the sector part of the material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use corresponding macro
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// _hCollideMat : Handle to the collide material
|
|
// Output :
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : 22 Jan 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications : Check the handle validity
|
|
// Modification date : Mar 97 Modification author : A.R.
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
void GMT_fn_vSetSectorMaterial(GMT_tdxHandleToGameMaterial _hGameMat, HIE_tdxHandleToSuperObject _hSectorMat)
|
|
{
|
|
#ifdef _DEBUG
|
|
if(!GMT_fn_b_ulIsValid(_hGameMat))
|
|
GMT_fn_vRaiseFatalError();
|
|
#endif
|
|
GMT_M_vSetSectorMaterial(_hGameMat,_hSectorMat);
|
|
}
|
|
|
|
#endif /* SECTOR_IN_GMT*/
|
|
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_vReInitializeGameMaterial
|
|
// Restore loaded values for GMT structure
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use the member pointer
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// Output :
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : May 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications :
|
|
// Modification date : Modification author :
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
/* fbolefeysot - 01/10/98*/
|
|
/* remove init values in GMT{*/
|
|
/*void GMT_fn_vReInitializeGameMaterial(GMT_tdxHandleToGameMaterial _hGameMat)
|
|
{
|
|
GMT_tdxHandleToGameMaterial hInitialGameMat;
|
|
|
|
hInitialGameMat=(GMT_tdxHandleToGameMaterial)(_hGameMat->p_stInitialValues);
|
|
if(hInitialGameMat!=NULL)
|
|
{
|
|
GMT_fn_vSetCollideMaterial(_hGameMat,GMT_fn_hGetCollideMaterial(hInitialGameMat));
|
|
GMT_fn_vSetMechanicsMaterial(_hGameMat,GMT_fn_hGetMechanicsMaterial(hInitialGameMat));
|
|
GMT_fn_vSetSoundMaterial(_hGameMat,GMT_fn_hGetSoundMaterial(hInitialGameMat));
|
|
GMT_fn_vSetVisualMaterial(_hGameMat,GMT_fn_hGetVisualMaterial(hInitialGameMat));
|
|
}
|
|
}
|
|
*/
|
|
/*END fbolefeysot}*/
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_vSetGameMaterialInitialValues
|
|
// put current values into initial values of the game material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use the member pointer
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// Output :
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : October 97 Author: Benoit Germain
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications :
|
|
// Modification date : Modification author :
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
|
|
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
|
/* fbolefeysot - 01/10/98*/
|
|
/* remove init values in GMT{*/
|
|
/*
|
|
void GMT_fn_vSetGameMaterialInitialValues(GMT_tdxHandleToGameMaterial _hGameMat)
|
|
{
|
|
if ( GMT_fn_b_ulIsValid(_hGameMat) )
|
|
{
|
|
//remember the pointer on the initial game material
|
|
GMT_tdxHandleToGameMaterial hInitialGameMat = _hGameMat->p_stInitialValues;
|
|
// if not valid, create some
|
|
if ( !GMT_fn_b_ulIsValid(hInitialGameMat) )
|
|
_hGameMat->p_stInitialValues = hInitialGameMat = GMT_fn_hCreateGameMaterial();
|
|
//copy the initial values into the game material
|
|
memcpy(hInitialGameMat,_hGameMat,sizeof(struct GMT_tdstGameMaterial_));
|
|
//but do not forget to clear the pointer on the initial values' initial values
|
|
hInitialGameMat->p_stInitialValues = NULL;
|
|
}
|
|
}
|
|
*/
|
|
/*END fbolefeysot}*/
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_vSetCollideIdentifierTypeOfGameMaterial
|
|
// Set the collide type for the identifier to 1
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use accessors and functions of Collide Material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// _uwType : Type to set into the identifier (0 to 15)
|
|
// Output :
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : May 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications :
|
|
// Modification date : Modification author :
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
void GMT_fn_vSetCollideIdentifierTypeOfGameMaterial(GMT_tdxHandleToGameMaterial _hGameMat,
|
|
unsigned short _uwType)
|
|
{
|
|
GMT_tdxHandleToCollideMaterial hCollideMat;
|
|
|
|
hCollideMat=GMT_fn_hGetCollideMaterial(_hGameMat);
|
|
GMT_fn_vSetCollideMaterialTypeOfIdentifier(hCollideMat,_uwType);
|
|
}
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_vResetCollideIdentifierTypeOfGameMaterial
|
|
// Set the collide type for the identifier to 0
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use accessors and functions of Collide Material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// _uwType : Type to set into the identifier (0 to 15)
|
|
// Output :
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : May 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications :
|
|
// Modification date : Modification author :
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
void GMT_fn_vResetCollideIdentifierTypeOfGameMaterial(GMT_tdxHandleToGameMaterial _hGameMat,
|
|
unsigned short _uwType)
|
|
{
|
|
GMT_tdxHandleToCollideMaterial hCollideMat;
|
|
|
|
hCollideMat=GMT_fn_hGetCollideMaterial(_hGameMat);
|
|
GMT_fn_vResetCollideMaterialTypeOfIdentifier(hCollideMat,_uwType);
|
|
}
|
|
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
|
|
|
|
|
/* ////////////////////////////////////////////////////////////////////////////
|
|
// Description : GMT_fn_xTestCollideIdentifierTypeOfGameMaterial
|
|
// Test the collide type for the identifier
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Methods : Use accessors and functions of Collide Material
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Input : _hGameMat : Handle to the game material
|
|
// _uwType : Type to test into the identifier (0 to 15)
|
|
// Output :
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Creation date : May 97 Author: Alain Robin
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// Modifications :
|
|
// Modification date : Modification author :
|
|
//////////////////////////////////////////////////////////////////////////// */
|
|
ACP_tdxBool GMT_fn_xTestCollideIdentifierTypeOfGameMaterial(GMT_tdxHandleToGameMaterial _hGameMat,
|
|
unsigned short _uwType)
|
|
{
|
|
GMT_tdxHandleToCollideMaterial hCollideMat;
|
|
|
|
hCollideMat=GMT_fn_hGetCollideMaterial(_hGameMat);
|
|
if (hCollideMat == (GMT_tdxHandleToCollideMaterial)GMT_C_InvalidCollideMaterial) return FALSE;
|
|
return GMT_fn_xTestCollideMaterialTypeOfIdentifier(hCollideMat,_uwType);
|
|
}
|
|
|
|
/*----------------------------------------------------------------------------
|
|
// Description : GMT_fn_xMultipleTestCollideIdentifierFromGameMaterial
|
|
// Test the collide type for the identifier (test several bits in one operation)
|
|
------------------------------------------------------------------------------
|
|
// Method : Logical operation
|
|
------------------------------------------------------------------------------
|
|
// Input : _hGameMat : Handle to the game material
|
|
// _xType : Mask containing the bits to test
|
|
// Output : TRUE if all the bits set in _xType are present into the collide material
|
|
// identifier, FALSE else
|
|
------------------------------------------------------------------------------
|
|
// Creation date : May 97 Author : Alain Robin
|
|
------------------------------------------------------------------------------
|
|
// Modification :
|
|
// Modification date : Modification author :
|
|
----------------------------------------------------------------------------*/
|
|
ACP_tdxBool GMT_fn_xMultipleTestCollideIdentifierFromGameMaterial(GMT_tdxHandleToGameMaterial _hGameMat,
|
|
GMT_tdxMask _xType)
|
|
{
|
|
GMT_tdxHandleToCollideMaterial hCollideMat;
|
|
|
|
if (_xType == 0)
|
|
return TRUE;
|
|
|
|
hCollideMat=GMT_fn_hGetCollideMaterial(_hGameMat);
|
|
if( !hCollideMat || hCollideMat==GMT_C_InvalidCollideMaterial )
|
|
return FALSE;
|
|
return GMT_fn_xMultipleTestCollideIdentifier(hCollideMat,_xType);
|
|
}
|
|
|
|
/*----------------------------------------------------------------------------
|
|
// Description : GMT_fn_xGetOneTextureFromGameMaterial
|
|
// Get one of the texture composing the animated texture
|
|
------------------------------------------------------------------------------
|
|
// Method : Nothing to say
|
|
------------------------------------------------------------------------------
|
|
// Input : _hGameMat : Handle to the game material
|
|
// _llNumberOfAnimatedTexture : Number of the texture into the texture list
|
|
// Output : The handle to the texture
|
|
------------------------------------------------------------------------------
|
|
// Creation date : Nov 97 Author : Alain Robin
|
|
------------------------------------------------------------------------------
|
|
// Modification :
|
|
// Modification date : Modification author :
|
|
----------------------------------------------------------------------------*/
|
|
|
|
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
|
ACP_tdxHandleOfTexture GMT_fn_xGetOneTextureFromGameMaterialAndLockIt(GMT_tdxHandleToGameMaterial _hGameMat,
|
|
long _llNumberOfAnimatedTexture)
|
|
{
|
|
ACP_tdxHandleOfMaterial hVisualMat;
|
|
ACP_tdxHandleOfTexture hTexture;
|
|
float fDisplayTime;
|
|
|
|
hVisualMat=GMT_fn_hGetVisualMaterial(_hGameMat);
|
|
GLI_vLockAnimatedTexture(hVisualMat);
|
|
GLI_vGetMaterialAnimatedTexture(hVisualMat,_llNumberOfAnimatedTexture,&hTexture,&fDisplayTime);
|
|
return hTexture;
|
|
}
|
|
|
|
/*----------------------------------------------------------------------------
|
|
// Description : GMT_fn_vUnLockTextureFromGameMaterial
|
|
// Unlock the animated texture (locked with GMT_fn_xGetOneTextureFromGameMaterialAndLockIt)
|
|
------------------------------------------------------------------------------
|
|
// Method : Nothing to say
|
|
------------------------------------------------------------------------------
|
|
// Input : _hGameMat : Handle to the game material
|
|
// Output :
|
|
------------------------------------------------------------------------------
|
|
// Creation date : Nov 97 Author : Alain Robin
|
|
------------------------------------------------------------------------------
|
|
// Modification :
|
|
// Modification date : Modification author :
|
|
----------------------------------------------------------------------------*/
|
|
void GMT_fn_vUnLockTextureFromGameMaterial(GMT_tdxHandleToGameMaterial _hGameMat)
|
|
{
|
|
ACP_tdxHandleOfMaterial hVisualMat;
|
|
|
|
hVisualMat=GMT_fn_hGetVisualMaterial(_hGameMat);
|
|
GLI_vUnLockAnimatedTexture(hVisualMat);
|
|
}
|
|
|
|
/*----------------------------------------------------------------------------
|
|
// Description : GMT_fn_lGetNumberOfAnimatedTexturesFromGameMaterial
|
|
------------------------------------------------------------------------------
|
|
// Method : Nothing to say
|
|
------------------------------------------------------------------------------
|
|
// Input : _hGameMat : Handle to the game material
|
|
// Output :
|
|
------------------------------------------------------------------------------
|
|
// Creation date : Nov 97 Author : Alain Robin
|
|
------------------------------------------------------------------------------
|
|
// Modification :
|
|
// Modification date : Modification author :
|
|
----------------------------------------------------------------------------*/
|
|
long GMT_fn_lGetNumberOfAnimatedTexturesFromGameMaterial(GMT_tdxHandleToGameMaterial _hGameMat)
|
|
{
|
|
ACP_tdxHandleOfMaterial hVisualMat;
|
|
|
|
hVisualMat=GMT_fn_hGetVisualMaterial(_hGameMat);
|
|
return GLI_lGetMaterialNumberOfAnimatedTexture(hVisualMat);
|
|
}
|
|
|
|
/*----------------------------------------------------------------------------
|
|
// Description : GMT_fn_vSetCurrentFrameOfAnimatedTexturesFromGameMaterial
|
|
------------------------------------------------------------------------------
|
|
// Method : Nothing to say
|
|
------------------------------------------------------------------------------
|
|
// Input : _hGameMat : Handle to the game material
|
|
// Output :
|
|
------------------------------------------------------------------------------
|
|
// Creation date : Nov 97 Author : Alain Robin
|
|
------------------------------------------------------------------------------
|
|
// Modification :
|
|
// Modification date : Modification author :
|
|
----------------------------------------------------------------------------*/
|
|
void GMT_fn_vSetCurrentFrameOfAnimatedTexturesFromGameMaterial(GMT_tdxHandleToGameMaterial _hGameMat, long _lTextureNumber)
|
|
{
|
|
ACP_tdxHandleOfMaterial hVisualMat;
|
|
|
|
hVisualMat=GMT_fn_hGetVisualMaterial(_hGameMat);
|
|
GLI_vSetCurrentAnimatedTextureNumber(hVisualMat,_lTextureNumber);
|
|
}
|
|
|
|
/*----------------------------------------------------------------------------
|
|
// Description : GMT_fn_lGetCurrentFrameOfAnimatedTexturesFromGameMaterial
|
|
------------------------------------------------------------------------------
|
|
// Method : Nothing to say
|
|
------------------------------------------------------------------------------
|
|
// Input : _hGameMat : Handle to the game material
|
|
// Output :
|
|
------------------------------------------------------------------------------
|
|
// Creation date : Nov 97 Author : Alain Robin
|
|
------------------------------------------------------------------------------
|
|
// Modification :
|
|
// Modification date : Modification author :
|
|
----------------------------------------------------------------------------*/
|
|
long GMT_fn_lGetCurrentFrameOfAnimatedTexturesFromGameMaterial(GMT_tdxHandleToGameMaterial _hGameMat)
|
|
{
|
|
ACP_tdxHandleOfMaterial hVisualMat;
|
|
|
|
hVisualMat=GMT_fn_hGetVisualMaterial(_hGameMat);
|
|
return GLI_lGetCurrentAnimatedTextureNumber(hVisualMat);
|
|
}
|
|
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
|
|