423 lines
10 KiB
C
423 lines
10 KiB
C
/* (c) Ubi Studios 1996*/
|
|
/* See Vincent Greco for any comment or question*/
|
|
|
|
#ifndef __HIESPOBJ_H__
|
|
#define __HIESPOBJ_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* For DLL using these function :*/
|
|
#include "cpa_expt.h"
|
|
#include "SPO/hiedef.h"
|
|
|
|
|
|
extern ACP_tdxIndex g_xFixIndex;
|
|
|
|
typedef union HIE_tduLinkedObject_
|
|
{
|
|
struct HIE_tdstSuperObject_ * p_stSuperObject;
|
|
struct GEO_tdstGeometricObject_ * p_stGeometricObject;
|
|
struct PO_tdstPhysicalObject_ * p_stPhysicalObject;
|
|
struct IPO_tdstInstanciatedPhysicalObject_ * p_stInstanciatedPhysicalObject;
|
|
struct SECT_tdstSector_ * p_stSector;
|
|
struct tdstEngineObject_ * p_stCharacter;
|
|
struct GLI_tdstLight_ * p_stLight;
|
|
void* p_Void;
|
|
} HIE_tduLinkedObject;
|
|
|
|
typedef struct HIE_tdstSuperObject_
|
|
{
|
|
/* fbolefeysot - 01/10/98*/
|
|
/* change SPO enum to flags{*/
|
|
unsigned long ulTypeOfLinkedObject; /* sie hieconst.h for flags*/
|
|
/*END fbolefeysot}*/
|
|
HIE_tduLinkedObject hLinkedObject;
|
|
LST2_M_DynamicParentDeclaration(struct HIE_tdstSuperObject_*)
|
|
LST2_M_DynamicChildDeclaration(struct HIE_tdstSuperObject_*, struct HIE_tdstSuperObject_*)
|
|
GEO_tdxHandleToMatrix hLocalMatrix;
|
|
GEO_tdxHandleToMatrix hGlobalMatrix;
|
|
long lLastComputeFrame;
|
|
long lDrawModeMask;
|
|
unsigned long ulFlags;
|
|
|
|
void * hBoundingVolume;
|
|
|
|
float fTransparenceLevel;
|
|
|
|
#ifndef U64
|
|
MTH3D_tdstVector stSemiLookAtVector ;
|
|
#endif
|
|
|
|
#ifdef ACTIVE_EDITOR
|
|
long llastComputeFrameForModule;
|
|
#endif
|
|
|
|
|
|
} HIE_tdstSuperObject;
|
|
|
|
|
|
#undef __HIE_EXTERN
|
|
#ifdef __HIE_GLOBALS
|
|
#define __HIE_EXTERN
|
|
#else
|
|
#define __HIE_EXTERN extern
|
|
#endif
|
|
|
|
__HIE_EXTERN long HIE_gs_lCurrentFrame ;/*extern only for optimisation*/
|
|
|
|
|
|
|
|
/* inline functions*/
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline struct HIE_tdstSuperObject_ *HIE_fn_hGetElementFromSuperObjectTab(struct HIE_tdstSuperObject_ *_hTab, long _lIndex)
|
|
{
|
|
return _hTab+_lIndex;
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline long HIE_fn_hGetIndexFromSuperObjectTabAndElement(struct HIE_tdstSuperObject_ *_hTab, struct HIE_tdstSuperObject_ *_hElement)
|
|
{
|
|
return _hElement-_hTab;
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline ACP_tdxIndex HIE_fn_xGetNumberOfElementInFixViewport ()
|
|
{
|
|
return (g_xFixIndex) ;
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline void HIE_fn_vInvalidateSuperObject(struct HIE_tdstSuperObject_ **hSuperObject)
|
|
{
|
|
(*hSuperObject) = HIE_C_InvalidSuperObject;
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline struct HIE_tdstSuperObject_ *HIE_fn_hGetSuperObjectFather(struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
return HIE_M_hGetSuperObjectFather(_hSprObj);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline struct HIE_tdstSuperObject_ *HIE_fn_hGetSuperObjectNextBrother(struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
return HIE_M_hNextChild(_hSprObj);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline struct HIE_tdstSuperObject_ *HIE_fn_hGetSuperObjectFirstChild(struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
return HIE_M_hFirstChild(_hSprObj);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline void HIE_fn_vSuperObjectAddTail(struct HIE_tdstSuperObject_ *_hNewFather, struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
HIE_M_vAddTail(_hNewFather, _hSprObj);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline void HIE_fn_vSuperObjectAddHead(struct HIE_tdstSuperObject_ *_hNewFather, struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
HIE_M_vAddHead(_hNewFather, _hSprObj);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline long HIE_fn_lGetNumberOfChildren(struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
return HIE_M_lGetNumberOfChildren(_hSprObj);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline unsigned long HIE_fn_ulGetSuperObjectType(struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
return HIE_M_xGetSuperObjectMember(_hSprObj,ulTypeOfLinkedObject);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline HIE_tdxHandleToVoid HIE_fn_hGetSuperObjectObject(struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
return HIE_M_xGetSuperObjectMember(_hSprObj,hLinkedObject.p_Void);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline GEO_tdxHandleToMatrix HIE_fn_hGetSuperObjectGlobalMatrix(struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
return HIE_M_xGetSuperObjectMember(_hSprObj,hGlobalMatrix);
|
|
}
|
|
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline GEO_tdxHandleToMatrix HIE_fn_hGetSuperObjectMatrix(struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
return HIE_M_xGetSuperObjectMember(_hSprObj,hLocalMatrix);
|
|
}
|
|
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline void HIE_fn_vSetSuperObjectMatrix(struct HIE_tdstSuperObject_ *_hSprObj, GEO_tdxHandleToMatrix _hMatrix)
|
|
{
|
|
HIE_M_vSetSuperObjectMember(_hSprObj,hLocalMatrix,_hMatrix);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline long HIE_fn_lGetSuperObjectDrawMask(struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
return HIE_M_xGetSuperObjectMember(_hSprObj, lDrawModeMask);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline void HIE_fn_vSetSuperObjectDrawMask(struct HIE_tdstSuperObject_ *_hSprObj, long _lDrawMask)
|
|
{
|
|
HIE_M_vSetSuperObjectMember(_hSprObj,lDrawModeMask, _lDrawMask);
|
|
}
|
|
|
|
/*
|
|
* Accessors for the Super Object Flags
|
|
*/
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline void HIE_fn_SO_vSetFlags( struct HIE_tdstSuperObject_ *_hSO, unsigned long _ulFlags )
|
|
{
|
|
_hSO->ulFlags = _ulFlags;
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline unsigned long HIE_fn_SO_ulGetFlags( struct HIE_tdstSuperObject_ *_hSO )
|
|
{
|
|
return _hSO->ulFlags;
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline ACP_tdxBool HIE_fn_SO_bIsNotPickable( struct HIE_tdstSuperObject_ *_hSO )
|
|
{
|
|
return (ACP_tdxBool)(_hSO->ulFlags & HIE_C_Flag_ulNotPickable);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline ACP_tdxBool HIE_fn_SO_bIsHidden( struct HIE_tdstSuperObject_ *_hSO )
|
|
{
|
|
return (ACP_tdxBool)(_hSO->ulFlags & HIE_C_Flag_ulHidden );
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline ACP_tdxBool HIE_fn_SO_bIsSuperimposed (struct HIE_tdstSuperObject_ *_hSO)
|
|
{
|
|
return (ACP_tdxBool)(_hSO->ulFlags & HIE_C_Flag_ulSuperimposed);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline void HIE_fn_SO_vSetSemiLookAtFlag (struct HIE_tdstSuperObject_ *_hSO)
|
|
{
|
|
_hSO->ulFlags |= HIE_C_Flag_ulSemiLookAt ;
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline void HIE_fn_SO_vSetNotHitByraytraceFlag (struct HIE_tdstSuperObject_ *_hSO)
|
|
{
|
|
_hSO->ulFlags |= HIE_C_Flag_ulNotHitByRayTrace ;
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline ACP_tdxBool HIE_fn_SO_bIsSemiLookAt (struct HIE_tdstSuperObject_ *_hSO)
|
|
{
|
|
return (ACP_tdxBool)((_hSO->ulFlags & HIE_C_Flag_ulSemiLookAt) >> 8);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline ACP_tdxBool HIE_fn_SO_bCanDrawShadowOnMe (struct HIE_tdstSuperObject_ *_hSO)
|
|
{
|
|
return (ACP_tdxBool)(!(_hSO->ulFlags & HIE_C_Flag_ulNoShadowOnMe ));
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline ACP_tdxBool HIE_fn_SO_bIsHitByRaytrace (struct HIE_tdstSuperObject_ *_hSO)
|
|
{
|
|
return (ACP_tdxBool)(!(_hSO->ulFlags & HIE_C_Flag_ulNotHitByRayTrace));
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline ACP_tdxBool HIE_fn_SO_bCheckChildren (struct HIE_tdstSuperObject_ *_hSO)
|
|
{
|
|
return (ACP_tdxBool)((_hSO->ulFlags & HIE_C_Flag_ulCheckChildren) >> 8);
|
|
}
|
|
|
|
/* The Bounding Volume of a SuperObject can be either a Box or a Sphere ...*/
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline ACP_tdxBool HIE_fn_SO_bHasABoxBoundingVolume( struct HIE_tdstSuperObject_ *_hSO )
|
|
{
|
|
return (ACP_tdxBool)(_hSO->ulFlags & HIE_C_Flag_ulTypeOfBoundingVolume);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline ACP_tdxBool HIE_fn_SO_bHasNoTransformationMatrix( struct HIE_tdstSuperObject_ *_hSO )
|
|
{
|
|
return (ACP_tdxBool) (_hSO->ulFlags & HIE_C_Flag_ulNoTransformationMatrix);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline void * HIE_fn_hGetSuperObjectBoundingVolume(struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
return (HIE_M_xGetSuperObjectMember(_hSprObj, hBoundingVolume));
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline void HIE_fn_vSetSuperObjectBoundingVolume(struct HIE_tdstSuperObject_ *_hSprObj, void * _hVolume)
|
|
{
|
|
HIE_M_vSetSuperObjectMember(_hSprObj, hBoundingVolume, _hVolume);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline unsigned char HIE_fn_bGetSuperObjectExcluLight(struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
return (unsigned char)((_hSprObj->ulFlags & HIE_C_Flag_ExcluLight) >> 16);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline ACP_tdxBool HIE_fn_bIsGlobalMatrixValid(struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
long lFrame;
|
|
|
|
lFrame = HIE_M_xGetSuperObjectMember(_hSprObj,lLastComputeFrame);
|
|
return (ACP_tdxBool) (lFrame == HIE_gs_lCurrentFrame || lFrame == HIE_C_lCounterNotValid);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline void HIE_fn_vValidateGlobalMatrix(struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
HIE_M_vSetSuperObjectMember(_hSprObj, lLastComputeFrame, HIE_gs_lCurrentFrame);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline long HIE_fn_lGetGlobalMatrixFrameCounter(void)
|
|
{
|
|
return HIE_gs_lCurrentFrame;
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline ACP_tdxHandleOfObject HIE_fn_hGetSuperObjectBoxBoundingVolume(struct HIE_tdstSuperObject_ *_hSprObj)
|
|
{
|
|
return (ACP_tdxHandleOfObject) HIE_M_xGetSuperObjectMember(_hSprObj, hBoundingVolume);
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline void HIE_fn_vSetSuperObjectFirstChild(struct HIE_tdstSuperObject_ *_hSprObj,struct HIE_tdstSuperObject_ *_hChild)
|
|
{
|
|
HIE_M_hFirstChild(_hSprObj)=_hChild;
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline float HIE_fn_fGetSuperObjectTransparenceLevel(struct HIE_tdstSuperObject_ *_hSuperObj)
|
|
{
|
|
return( HIE_M_xGetSuperObjectMember( _hSuperObj,fTransparenceLevel ) );
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline void HIE_fn_vSetSuperObjectTransparenceLevel(struct HIE_tdstSuperObject_ *_hSuperObj,float _fTransparenceLevel)
|
|
{
|
|
HIE_M_vSetSuperObjectMember( _hSuperObj,fTransparenceLevel,_fTransparenceLevel );
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline long HIE_fn_lGetSuperObjectLastComputeFrame(struct HIE_tdstSuperObject_ *_hSuperObj)
|
|
{
|
|
return( HIE_M_xGetSuperObjectMember( _hSuperObj,lLastComputeFrame ) );
|
|
}
|
|
|
|
#ifndef CODEWARRIOR
|
|
static
|
|
#endif
|
|
__inline void HIE_fn_vSetSuperObjectLastComputeFrame(struct HIE_tdstSuperObject_ *_hSuperObj,long _lLastComputeFrame)
|
|
{
|
|
HIE_M_vSetSuperObjectMember( _hSuperObj,lLastComputeFrame,_lLastComputeFrame );
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}/* extern "C" */
|
|
#endif
|
|
|
|
#endif /* __HIESPOBJ_H__*/
|