Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,703 @@
/* (c) Ubi Studios 1997 */
/* See Vincent Greco or Frederic Philippe for any comment or question */
#include "ACP_base.h"
#include "GEO.h"
#include "GLI.h"
#include "COL.h"
#include "PCS.h"
#include "PO.h"
#include "IPO.h"
#include "SCT.h"
#undef extern /*for PO (and AI)*/
#include "SPO/HieConst.h"
#include "LST.h"
#include "SPO/HieSpObj.h"
#include "SPO/HieHand.h"
#include "SPO/HieDef.h"
#include "SPO/HieMacro.h"
#include "SPO/HieMtStk.h"
#include "SPO/HieExt.h"
#include "SPO\HieBdVol.h"
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
extern FILE *dump;
extern float fScale;
extern SCR_tdst_Link_Table PO_g_stLinkTable;
#endif //U64CONVERTLOG
// } fin N64-format&
MTH_tdxReal VoidReal;
ACP_tdxHandleOfObject GeoHandle;
/*-----------------------------------------------------------------------------*/
#define M_hGetRepositionZoneFromPo(Po) \
(GLI_vGetVisualSetLOD(PO_fn_hGetVisualSet(Po), 0, &VoidReal, &GeoHandle), GeoHandle)
/*-----------------------------------------------------------------------------*/
ACP_tdxBool HIE_fn_bIsChildInsideHisFather( ACP_tdxBool bFatherBox, void * hFatherBdV,
ACP_tdxBool bChildBox, void *hChildBdV,
MTH3D_tdstVector * _p_stTranslation)
{
GEO_tdxHandleToParallelBox hFatherBox;
GEO_tdxHandleToParallelBox hChildBox;
MTH3D_tdstVector stMaxChildPoint;
MTH3D_tdstVector stMinChildPoint;
MTH3D_tdstVector stChildCenter;
MTH_tdxReal xChildRadius;
MTH3D_tdstVector * p_stFatherMax;
MTH3D_tdstVector * p_stFatherMin;
MTH3D_tdstVector stFatherCenter;
MTH_tdxReal xFatherRadius;
if(bFatherBox)
{
hFatherBox = (GEO_tdxHandleToParallelBox)hFatherBdV;
p_stFatherMax = GEO_fn_pGetMaxPointOfParallelBox(hFatherBox);
p_stFatherMin = GEO_fn_pGetMinPointOfParallelBox(hFatherBox);
if(bChildBox)
/* Father ---> Box*/
/* Child ---> Box*/
{
MTH3D_tdstVector *p_stMinPoint;
MTH3D_tdstVector *p_stMaxPoint;
hChildBox = (GEO_tdxHandleToParallelBox)hChildBdV;
p_stMinPoint = GEO_fn_pGetMinPointOfParallelBox(hChildBox);
p_stMaxPoint = GEO_fn_pGetMaxPointOfParallelBox(hChildBox);
MTH3D_M_vAddVector(&stMinChildPoint, p_stMinPoint , _p_stTranslation);
MTH3D_M_vAddVector(&stMaxChildPoint, p_stMaxPoint , _p_stTranslation);
return( MTH_M_bLessEqual (MTH3D_M_xGetXofVector(&stMaxChildPoint), MTH3D_M_xGetXofVector(p_stFatherMax)) &&
MTH_M_bLessEqual (MTH3D_M_xGetXofVector(p_stFatherMin), MTH3D_M_xGetXofVector(&stMinChildPoint)) &&
MTH_M_bLessEqual (MTH3D_M_xGetYofVector(&stMaxChildPoint), MTH3D_M_xGetYofVector(p_stFatherMax)) &&
MTH_M_bLessEqual (MTH3D_M_xGetYofVector(p_stFatherMin), MTH3D_M_xGetYofVector(&stMinChildPoint)) &&
MTH_M_bLessEqual (MTH3D_M_xGetZofVector(&stMaxChildPoint), MTH3D_M_xGetZofVector(p_stFatherMax)) &&
MTH_M_bLessEqual (MTH3D_M_xGetZofVector(p_stFatherMin), MTH3D_M_xGetZofVector(&stMinChildPoint)));
}
else
/* Father ---> Box*/
/* Child ---> Sphere*/
{
xChildRadius = GEO_fn_xGetRadiusOfBoundingSphere(hChildBdV);
MTH3D_M_vAddVector(&stChildCenter, GEO_fn_pGetCenterPointOfBoundingSphere(hChildBdV), _p_stTranslation);
return( MTH_M_bLessEqual (xChildRadius, MTH_M_xSub( MTH3D_M_xGetXofVector(p_stFatherMax), MTH3D_M_xGetXofVector(&stChildCenter))) &&
MTH_M_bLessEqual (xChildRadius, MTH_M_xSub( MTH3D_M_xGetXofVector(&stChildCenter), MTH3D_M_xGetXofVector(p_stFatherMin))) &&
MTH_M_bLessEqual (xChildRadius, MTH_M_xSub( MTH3D_M_xGetYofVector(p_stFatherMax), MTH3D_M_xGetYofVector(&stChildCenter))) &&
MTH_M_bLessEqual (xChildRadius, MTH_M_xSub( MTH3D_M_xGetYofVector(&stChildCenter), MTH3D_M_xGetYofVector(p_stFatherMin))) &&
MTH_M_bLessEqual (xChildRadius, MTH_M_xSub( MTH3D_M_xGetZofVector(p_stFatherMax), MTH3D_M_xGetZofVector(&stChildCenter))) &&
MTH_M_bLessEqual (xChildRadius, MTH_M_xSub( MTH3D_M_xGetZofVector(&stChildCenter), MTH3D_M_xGetZofVector(p_stFatherMin))));
}
}
else
{
MTH3D_M_vCopyVector( &stChildCenter, GEO_fn_pGetCenterPointOfBoundingSphere(hFatherBdV));
xFatherRadius = GEO_fn_xGetRadiusOfBoundingSphere(hFatherBdV);
MTH3D_M_vAddVector(&stFatherCenter, &stFatherCenter, _p_stTranslation);
if(bChildBox)
/* Father ---> Sphere*/
/* Child ---> Box*/
{
MTH3D_tdstVector *p_stMinPoint;
MTH3D_tdstVector *p_stMaxPoint;
hChildBox = (GEO_tdxHandleToParallelBox)hChildBdV;
p_stMinPoint = GEO_fn_pGetMinPointOfParallelBox(hChildBox);
p_stMaxPoint = GEO_fn_pGetMaxPointOfParallelBox(hChildBox);
MTH3D_M_vAddVector(&stMinChildPoint, p_stMinPoint , _p_stTranslation);
MTH3D_M_vAddVector(&stMaxChildPoint, p_stMaxPoint , _p_stTranslation);
return( MTH_M_bLessEqual( MTH3D_M_xGetXofVector(&stMaxChildPoint), MTH_M_xAdd(MTH3D_M_xGetXofVector(&stFatherCenter), xFatherRadius)) &&
MTH_M_bLessEqual( MTH_M_xSub(MTH3D_M_xGetXofVector(&stFatherCenter), xFatherRadius), MTH3D_M_xGetXofVector(&stMinChildPoint)) &&
MTH_M_bLessEqual( MTH3D_M_xGetYofVector(&stMaxChildPoint), MTH_M_xAdd(MTH3D_M_xGetYofVector(&stFatherCenter), xFatherRadius)) &&
MTH_M_bLessEqual( MTH_M_xSub(MTH3D_M_xGetYofVector(&stFatherCenter), xFatherRadius), MTH3D_M_xGetYofVector(&stMinChildPoint)) &&
MTH_M_bLessEqual( MTH3D_M_xGetZofVector(&stMaxChildPoint), MTH_M_xAdd(MTH3D_M_xGetZofVector(&stFatherCenter), xFatherRadius)) &&
MTH_M_bLessEqual( MTH_M_xSub(MTH3D_M_xGetZofVector(&stFatherCenter), xFatherRadius), MTH3D_M_xGetZofVector(&stMinChildPoint)));
}
else
/* Father ---> Sphere*/
/* Child ---> Sphere*/
{
MTH3D_M_vCopyVector( &stChildCenter, GEO_fn_pGetCenterPointOfBoundingSphere(hChildBdV));
MTH3D_M_vAddVector(&stChildCenter, &stChildCenter, _p_stTranslation);
xChildRadius = GEO_fn_xGetRadiusOfBoundingSphere(hChildBdV);
return( MTH_M_bLessEqual( MTH_M_xAdd (MTH3D_M_xGetXofVector( &stChildCenter), xChildRadius), MTH_M_xAdd (MTH3D_M_xGetXofVector( &stFatherCenter), xFatherRadius)) &&
MTH_M_bLessEqual( MTH_M_xSub (MTH3D_M_xGetXofVector( &stFatherCenter), xFatherRadius), MTH_M_xSub (MTH3D_M_xGetXofVector( &stChildCenter), xChildRadius)) &&
MTH_M_bLessEqual( MTH_M_xAdd (MTH3D_M_xGetYofVector( &stChildCenter), xChildRadius), MTH_M_xAdd (MTH3D_M_xGetYofVector( &stFatherCenter), xFatherRadius)) &&
MTH_M_bLessEqual( MTH_M_xSub (MTH3D_M_xGetYofVector( &stFatherCenter), xFatherRadius), MTH_M_xSub (MTH3D_M_xGetYofVector( &stChildCenter), xChildRadius)) &&
MTH_M_bLessEqual( MTH_M_xAdd (MTH3D_M_xGetZofVector( &stChildCenter), xChildRadius), MTH_M_xAdd (MTH3D_M_xGetZofVector( &stFatherCenter), xFatherRadius)) &&
MTH_M_bLessEqual( MTH_M_xSub (MTH3D_M_xGetZofVector( &stFatherCenter), xFatherRadius), MTH_M_xSub (MTH3D_M_xGetZofVector( &stChildCenter), xChildRadius)));
}
}
}
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
int level = 0;
int ddd;
char tab[512];
char *tab2;
#endif //U64CONVERTLOG
// } fin N64-format
/*-----------------------------------------------------------------------------*/
void HIE_fn_vComputeAllBoundingVolumes(HIE_tdxHandleToSuperObject _hSprObj)
{
ACP_tdxIndex xIndex;
long lType;
MTH3D_tdstVector stGlobalMaxBoxPoint;
MTH3D_tdstVector stGlobalMinBoxPoint;
MTH3D_tdstVector stLocalMaxBoxPoint;
MTH3D_tdstVector stLocalMinBoxPoint;
MTH3D_tdstVector stFatherCenter;
MTH_tdxReal xFatherRadius;
HIE_tdxHandleToSuperObject hChild;
ACP_tdxHandleOfObject hGeometricObject;
ACP_tdxHandleOfObject hCollideGeometricObject;
PO_tdxHandleToPhysicalObject hTempPo;
GEO_tdxHandleToMatrix hGlobalMatrix;
GEO_tdxHandleToMatrix hLocalMatrix;
GEO_tdxHandleToParallelBox hFatherBox;
GEO_tdxHandleToBoundingSphere hFatherSphere;
ACP_tdxBool bFatherBoundingBox;
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
char txt[20];
#endif //U64CONVERTLOG
// } fin N64-format
hFatherBox = NULL;
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
level++;
tab[0] = 0;
sprintf (txt,"\t");
for (ddd=0;ddd<level;ddd++)
{
strcat(tab,txt);
}
#endif //U64CONVERTLOG
// } fin N64-format
bFatherBoundingBox = HIE_fn_SO_bHasABoxBoundingVolume(_hSprObj);
hGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix(_hSprObj);
lType=HIE_fn_ulGetSuperObjectType(_hSprObj);
if(bFatherBoundingBox)
{
if(lType & (HIE_C_ulPO | HIE_C_ulPO_Mirror))
{
assert(0);
hFatherBox = (GEO_tdxHandleToParallelBox)HIE_fn_hGetSuperObjectBoundingVolume(_hSprObj);
if(!hFatherBox)
GEO_fn_vCreateParallelBox(&hFatherBox);
hTempPo=(PO_tdxHandleToPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj);
hGeometricObject=M_hGetRepositionZoneFromPo(hTempPo);
hCollideGeometricObject = (PO_fn_hGetCollideSet(hTempPo)) ? PCS_fn_hGetZdrGeoObjOfPhysicalCollSet(PO_fn_hGetCollideSet(hTempPo)) : NULL;
#ifdef USE_ALTIMAPS
if( hGeometricObject->d_xListOfElementsTypes[0] == GEO_C_xElementAltimap )
{
MTH3D_M_vCopyVector(&stLocalMaxBoxPoint, &(((GEO_tdstElementAltimap *)(hGeometricObject->d_stListOfElements[0]))->stOrigin));
MTH3D_M_vCopyVector(&stLocalMinBoxPoint, &(((GEO_tdstElementAltimap *)(hGeometricObject->d_stListOfElements[0]))->stOrigin));
}
else
#endif /*USE_ALTIMAPS*/
/* Oliv' - 19/05/1998*/
if( hGeometricObject->d_stListOfPoints )
{
MTH3D_M_vCopyVector(&stLocalMaxBoxPoint, hGeometricObject->d_stListOfPoints);
MTH3D_M_vCopyVector(&stLocalMinBoxPoint, hGeometricObject->d_stListOfPoints);
}
else
{
#if defined(U64)
MTH_tdxReal xTemp;
xTemp = MTH_M_xFloatToReal( (float)sqrt(2.0f) * hGeometricObject->fRadius );
MTH3D_M_vSetVectorElements( &stLocalMaxBoxPoint, xTemp, xTemp, xTemp );
MTH3D_M_vNegVector( &stLocalMinBoxPoint, &stLocalMaxBoxPoint );
#else
MTH3D_M_vNullVector(&stLocalMaxBoxPoint);
MTH3D_M_vNullVector(&stLocalMinBoxPoint);
#endif /* U64 */
}
MTH3D_M_vMulMatrixVector ( &stGlobalMaxBoxPoint, &hGlobalMatrix->stTransformMatrix, &stLocalMaxBoxPoint);
MTH3D_M_vMulMatrixVector ( &stGlobalMinBoxPoint, &hGlobalMatrix->stTransformMatrix, &stLocalMinBoxPoint);
GEO_fn_vAddObjectToBox(hGeometricObject, hGlobalMatrix, &stGlobalMaxBoxPoint, &stGlobalMinBoxPoint);
if(hCollideGeometricObject)
GEO_fn_vAddObjectToBox(hCollideGeometricObject, hGlobalMatrix, &stGlobalMaxBoxPoint, &stGlobalMinBoxPoint);
}
/*The linked object is an IPO*/
if(lType & (HIE_C_ulIPO | HIE_C_ulIPO_Mirror))
{
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
SCR_tdst_Link_Value *test;
#endif //U64CONVERTLOG
// } fin N64-format
hFatherBox = (GEO_tdxHandleToParallelBox)HIE_fn_hGetSuperObjectBoundingVolume(_hSprObj);
if(!hFatherBox)
GEO_fn_vCreateParallelBox(&hFatherBox);
hTempPo=IPO_fn_hGetPhysicalObject((IPO_tdxHandleToInstanciatedPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj));
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
test = SCR_fnp_st_Link_SearchValue(&PO_g_stLinkTable, (unsigned long)hTempPo);
if (test != NULL)
{
tab2 = SCR_M_p_sz_Link_GetKey(test);
}
else
{
tab2 = NULL;
}
#endif //U64CONVERTLOG
// } fin N64-format
hGeometricObject=M_hGetRepositionZoneFromPo(hTempPo);
hCollideGeometricObject = (PO_fn_hGetCollideSet(hTempPo)) ? PCS_fn_hGetZdrGeoObjOfPhysicalCollSet(PO_fn_hGetCollideSet(hTempPo)) : NULL;
#ifdef USE_ALTIMAPS
if( hGeometricObject->d_xListOfElementsTypes[0] == GEO_C_xElementAltimap )
{
MTH3D_M_vCopyVector(&stLocalMaxBoxPoint, &(((GEO_tdstElementAltimap *)(hGeometricObject->d_stListOfElements[0]))->stOrigin));
MTH3D_M_vCopyVector(&stLocalMinBoxPoint, &(((GEO_tdstElementAltimap *)(hGeometricObject->d_stListOfElements[0]))->stOrigin));
}
else
#endif /*USE_ALTIMAPS*/
/* Oliv' - 19/05/1998*/
if( hGeometricObject->d_stListOfPoints )
{
MTH3D_M_vCopyVector(&stLocalMaxBoxPoint, hGeometricObject->d_stListOfPoints);
MTH3D_M_vCopyVector(&stLocalMinBoxPoint, hGeometricObject->d_stListOfPoints);
}
else
{
#if defined(U64)
MTH_tdxReal xTemp;
xTemp = MTH_M_xFloatToReal( (float)sqrt(2.0f) * hGeometricObject->fRadius );
MTH3D_M_vSetVectorElements( &stLocalMaxBoxPoint, xTemp, xTemp, xTemp );
MTH3D_M_vNegVector( &stLocalMinBoxPoint, &stLocalMaxBoxPoint );
#else
MTH3D_M_vNullVector(&stLocalMaxBoxPoint);
MTH3D_M_vNullVector(&stLocalMinBoxPoint);
#endif /* U64 */
}
MTH3D_M_vMulMatrixVector ( &stGlobalMaxBoxPoint, &hGlobalMatrix->stTransformMatrix, &stLocalMaxBoxPoint);
MTH3D_M_vMulMatrixVector ( &stGlobalMinBoxPoint, &hGlobalMatrix->stTransformMatrix, &stLocalMinBoxPoint);
GEO_fn_vAddObjectToBox(hGeometricObject, hGlobalMatrix, &stGlobalMaxBoxPoint, &stGlobalMinBoxPoint);
if(hCollideGeometricObject)
GEO_fn_vAddObjectToBox(hCollideGeometricObject, hGlobalMatrix, &stGlobalMaxBoxPoint,&stGlobalMinBoxPoint);
}
if(lType & (HIE_C_ulEDT_Geometric | HIE_C_ulMirror))/*provisoire*/
{
assert(0);
hFatherBox = (GEO_tdxHandleToParallelBox)HIE_fn_hGetSuperObjectBoundingVolume(_hSprObj);
if(!hFatherBox)
GEO_fn_vCreateParallelBox(&hFatherBox);
hGeometricObject=(ACP_tdxHandleOfObject)HIE_fn_hGetSuperObjectObject(_hSprObj);
#ifdef USE_ALTIMAPS
if( hGeometricObject->d_xListOfElementsTypes[0] == GEO_C_xElementAltimap )
{
MTH3D_M_vCopyVector(&stLocalMaxBoxPoint, &(((GEO_tdstElementAltimap *)(hGeometricObject->d_stListOfElements[0]))->stOrigin));
MTH3D_M_vCopyVector(&stLocalMinBoxPoint, &(((GEO_tdstElementAltimap *)(hGeometricObject->d_stListOfElements[0]))->stOrigin));
}
else
#endif /*USE_ALTIMAPS*/
/* Oliv' - 19/05/1998*/
if( hGeometricObject->d_stListOfPoints )
{
MTH3D_M_vCopyVector(&stLocalMaxBoxPoint, hGeometricObject->d_stListOfPoints);
MTH3D_M_vCopyVector(&stLocalMinBoxPoint, hGeometricObject->d_stListOfPoints);
}
else
{
#if defined(U64)
MTH_tdxReal xTemp;
xTemp = MTH_M_xFloatToReal( (float)sqrt(2.0f) * hGeometricObject->fRadius );
MTH3D_M_vSetVectorElements( &stLocalMaxBoxPoint, xTemp, xTemp, xTemp );
MTH3D_M_vNegVector( &stLocalMinBoxPoint, &stLocalMaxBoxPoint );
#else
MTH3D_M_vNullVector(&stLocalMaxBoxPoint);
MTH3D_M_vNullVector(&stLocalMinBoxPoint);
#endif /* U64 */
}
MTH3D_M_vMulMatrixVector ( &stGlobalMaxBoxPoint, &hGlobalMatrix->stTransformMatrix, &stLocalMaxBoxPoint);
MTH3D_M_vMulMatrixVector ( &stGlobalMinBoxPoint, &hGlobalMatrix->stTransformMatrix, &stLocalMinBoxPoint);
GEO_fn_vAddObjectToBox(hGeometricObject, hGlobalMatrix, &stGlobalMaxBoxPoint, &stGlobalMinBoxPoint);
}
/* The bounding volumes of the sectors are computed in another function*/
if(lType != HIE_C_ulSector)
{
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
stGlobalMaxBoxPoint.xX = (float) (( (long)( (stGlobalMaxBoxPoint.xX*fScale) + 0.5) ) / fScale);
stGlobalMaxBoxPoint.xY = (float) (( (long)( (stGlobalMaxBoxPoint.xY*fScale) + 0.5) ) / fScale);
stGlobalMaxBoxPoint.xZ = (float) (( (long)( (stGlobalMaxBoxPoint.xZ*fScale) + 0.5) ) / fScale);
stGlobalMinBoxPoint.xX = (float) (( (long)( (stGlobalMinBoxPoint.xX*fScale) + 0.5) ) / fScale);
stGlobalMinBoxPoint.xY = (float) (( (long)( (stGlobalMinBoxPoint.xY*fScale) + 0.5) ) / fScale);
stGlobalMinBoxPoint.xZ = (float) (( (long)( (stGlobalMinBoxPoint.xZ*fScale) + 0.5) ) / fScale);
#endif //U64CONVERTLOG
// } fin N64-format
GEO_fn_vSetMaxPointOfParallelBox(hFatherBox, &stGlobalMaxBoxPoint);
GEO_fn_vSetMinPointOfParallelBox(hFatherBox, &stGlobalMinBoxPoint);
HIE_fn_vSetSuperObjectBoundingVolume(_hSprObj, (void *)hFatherBox);
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
if (tab2 != NULL)
fprintf (dump,"%s%s\n%smin : %f,%f,%f\n%smax : %f,%f,%f\n",tab,tab2,tab,stGlobalMinBoxPoint.xX,stGlobalMinBoxPoint.xY,stGlobalMinBoxPoint.xZ,tab,stGlobalMaxBoxPoint.xX,stGlobalMaxBoxPoint.xY,stGlobalMaxBoxPoint.xZ);
else
fprintf (dump,"%s-- no name --\n%smin : %f,%f,%f\n%smax : %f,%f,%f\n",tab,tab,stGlobalMinBoxPoint.xX,stGlobalMinBoxPoint.xY,stGlobalMinBoxPoint.xZ,tab,stGlobalMaxBoxPoint.xX,stGlobalMaxBoxPoint.xY,stGlobalMaxBoxPoint.xZ);
fflush (dump);
#endif //U64CONVERTLOG
// } fin N64-format
}
}
else
{
if(lType & (HIE_C_ulPO | HIE_C_ulPO_Mirror))
{
/* if the linked object is a PhysicalObject gets its Bounding Volume */
hFatherSphere=(GEO_tdxHandleToBoundingSphere)PO_fn_hGetBoundingVolume((PO_tdxHandleToPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj));
}
if(lType & (HIE_C_ulIPO | HIE_C_ulIPO_Mirror))
{
/* if the linked object is a PhysicalObject gets its Bounding Volume */
hFatherSphere=(GEO_tdxHandleToBoundingSphere)PO_fn_hGetBoundingVolume(IPO_fn_hGetPhysicalObject((IPO_tdxHandleToInstanciatedPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj)));
}
if(lType & (HIE_C_ulEDT_Geometric | HIE_C_ulMirror))/*provisoire*/
{
hGeometricObject=(ACP_tdxHandleOfObject)HIE_fn_hGetSuperObjectObject(_hSprObj);
MTH3D_M_vCopyVector(&stFatherCenter, hGeometricObject->d_stListOfPoints/*beurk*/);
xFatherRadius=0.0f;
GEO_fn_vAddObjectToSphere(hGeometricObject, &stFatherCenter, &xFatherRadius);
GEO_fn_vCreateBoundingSphere(&hFatherSphere);
GEO_fn_vSetBoundingSphere(hFatherSphere, &stFatherCenter, xFatherRadius);
}
HIE_fn_vSetSuperObjectBoundingVolume(_hSprObj, (void *)hFatherSphere);
}
HIE_M_ForEachChildOf(_hSprObj, hChild, xIndex)
{
ACP_tdxBool bChildBoundingBox;
GEO_tdxHandleToBoundingSphere hChildSphere;
GEO_tdxHandleToParallelBox hChildBox;
MTH3D_tdstVector stTranslation;
bChildBoundingBox = HIE_fn_SO_bHasABoxBoundingVolume(hChild);
hLocalMatrix = HIE_fn_hGetSuperObjectMatrix(hChild);
POS_fn_vGetTranslationVector(hLocalMatrix, &stTranslation);
HIE_fn_vComputeAllBoundingVolumes(hChild);
if(lType & (HIE_C_ulPO | HIE_C_ulIPO | HIE_C_ulEDT_Geometric | HIE_C_ulMirror | HIE_C_ulPO_Mirror| HIE_C_ulIPO_Mirror))
{
if(bFatherBoundingBox)
{
if(bChildBoundingBox)
/* Father ---> Box*/
/* Child ---> Box*/
{
hChildBox = (GEO_tdxHandleToParallelBox)HIE_fn_hGetSuperObjectBoundingVolume(hChild);
if(!HIE_fn_bIsChildInsideHisFather(bFatherBoundingBox, (void *)hFatherBox , bChildBoundingBox, (void *)hChildBox, &stTranslation))
HIE_fn_SO_vSetFlags (_hSprObj, HIE_fn_SO_ulGetFlags (_hSprObj) | HIE_C_Flag_ulCheckChildren);
}
else
/* Father ---> Box*/
/* Child ---> Sphere*/
{
hChildSphere = (GEO_tdxHandleToBoundingSphere)HIE_fn_hGetSuperObjectBoundingVolume(hChild);
if(!HIE_fn_bIsChildInsideHisFather(bFatherBoundingBox, (void *)hFatherBox , bChildBoundingBox, (void *)hChildSphere, &stTranslation))
HIE_fn_SO_vSetFlags (_hSprObj, HIE_fn_SO_ulGetFlags (_hSprObj) | HIE_C_Flag_ulCheckChildren);
}
}
else
{
if(bChildBoundingBox)
/* Father ---> Sphere*/
/* Child ---> Box*/
{
hChildBox = (GEO_tdxHandleToParallelBox)HIE_fn_hGetSuperObjectBoundingVolume(hChild);
if(!HIE_fn_bIsChildInsideHisFather(bFatherBoundingBox, hFatherSphere , bChildBoundingBox, (ACP_tdxHandleOfObject)hChildBox, &stTranslation))
HIE_fn_SO_vSetFlags (_hSprObj, HIE_fn_SO_ulGetFlags (_hSprObj) | HIE_C_Flag_ulCheckChildren);
}
else
/* Father ---> Sphere*/
/* Child ---> Sphere*/
{
hChildSphere = (GEO_tdxHandleToBoundingSphere)HIE_fn_hGetSuperObjectBoundingVolume(hChild);
if(!HIE_fn_bIsChildInsideHisFather(bFatherBoundingBox, hFatherSphere , bChildBoundingBox, hChildSphere, &stTranslation))
HIE_fn_SO_vSetFlags (_hSprObj, HIE_fn_SO_ulGetFlags (_hSprObj) | HIE_C_Flag_ulCheckChildren);
}
}
}
}
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
level--;
#endif //U64CONVERTLOG
// } fin N64-format
}
/*-----------------------------------------------------------------------------*/
void HIE_fn_vComputePoAndIpoBoundingVolumes(HIE_tdxHandleToSuperObject _hSprObj)
{
MTH3D_tdstVector stLocalCenter;
MTH_tdxReal xRadius;
GEO_tdxHandleToBoundingSphere hBoundingSphere;
ACP_tdxHandleOfObject hGeometricObject;
ACP_tdxIndex xIndex;
HIE_tdxHandleToSuperObject hChild;
PO_tdxHandleToPhysicalObject hTempPo = NULL;
long lType;
/*--- Node Examination ---*/
HIE_M_ForEachChildOf(_hSprObj, hChild, xIndex)
{
HIE_fn_vPushMatrix(hChild);
HIE_fn_vComputePoAndIpoBoundingVolumes(hChild);
HIE_fn_vPopMatrix();
}
lType=HIE_fn_ulGetSuperObjectType(_hSprObj);
if(lType & (HIE_C_ulPO | HIE_C_ulPO_Mirror))
{
HIE_fn_vComputeOnePoBoundingVolume(HIE_fn_hGetSuperObjectObject(_hSprObj));
hTempPo=(PO_tdxHandleToPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj);
}
if(lType & (HIE_C_ulIPO | HIE_C_ulIPO_Mirror))
{
hTempPo=IPO_fn_hGetPhysicalObject((IPO_tdxHandleToInstanciatedPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj));
}
xRadius=MTH_C_ZERO;
if( lType & (HIE_C_ulPO | HIE_C_ulIPO | HIE_C_ulPO_Mirror | HIE_C_ulIPO_Mirror))
{
GEO_fn_vCreateBoundingSphere(&hBoundingSphere);
hGeometricObject = M_hGetRepositionZoneFromPo(hTempPo);
#ifndef U64
#ifdef USE_ALTIMAPS
if( hGeometricObject->d_xListOfElementsTypes[ 0 ] == GEO_C_xElementAltimap )
{
/*--- Altimap ---*/
GEO_vGetAltimapOrigin( hGeometricObject, 0, &stLocalCenter );
GEO_fn_vAddAltimapToSphere(hGeometricObject,&stLocalCenter,&xRadius);
}
else
#endif /*USE_ALTIMAPS*/
{
/*--- NOT Altimap ---*/
if( hGeometricObject->d_stListOfPoints )
{
MTH3D_M_vCopyVector(&stLocalCenter, hGeometricObject->d_stListOfPoints);
GEO_fn_vAddObjectToSphere(hGeometricObject,&stLocalCenter,&xRadius);
}
}
#else
#ifdef USE_ALTIMAPS
if( hGeometricObject->d_xListOfElementsTypes[ 0 ] == GEO_C_xElementAltimap )
{
/*--- Altimap ---*/
GEO_vGetAltimapOrigin( hGeometricObject, 0, &stLocalCenter );
GEO_fn_vAddAltimapToSphere(hGeometricObject,&stLocalCenter,&xRadius);
}
else
#endif /*USE_ALTIMAPS*/
if( hGeometricObject->d_stListOfPoints!=NULL)
{
/*--- NOT Altimap ---*/
MTH3D_M_vCopyVector(&stLocalCenter, hGeometricObject->d_stListOfPoints);
GEO_fn_vAddObjectToSphere(hGeometricObject,&stLocalCenter,&xRadius);
}
else
{
/* Oliv' - 12/06/1998 - GeoObjs are now always centered...*/
/* MTH3D_M_vSetVectorElements(&stLocalCenter,
MTH_M_xFloatToReal(hGeometricObject->a3_fCenter[0]),
MTH_M_xFloatToReal(hGeometricObject->a3_fCenter[1]),
MTH_M_xFloatToReal(hGeometricObject->a3_fCenter[2]));*/
MTH3D_M_vSetVectorElements(&stLocalCenter,MTH_C_ZERO,MTH_C_ZERO,MTH_C_ZERO);
/* EndOfOliv'*/
xRadius=MTH_M_xFloatToReal(hGeometricObject->fRadius);
}
#endif
GEO_fn_vSetBoundingSphere(hBoundingSphere, &stLocalCenter, xRadius);
PO_fn_vSetBoundingVolume(hTempPo ,hBoundingSphere);
}
}
/*-----------------------------------------------------------------------------*/
void HIE_fn_vComputeSectorBoundingVolume(HIE_tdxHandleToSuperObject hSector)
{
SECT_tdxHandleOfSectorObject hSectorObject;
HIE_tdxHandleToSuperObject hSectorChild;
ACP_tdxHandleOfObject hGeometricObject;
MTH3D_tdstVector stGlobalMaxBoxPoint;
MTH3D_tdstVector stGlobalMinBoxPoint;
MTH3D_tdstVector stLocalMaxBoxPoint;
MTH3D_tdstVector stLocalMinBoxPoint;
ACP_tdxIndex xInd;
ACP_tdxBool bFirstChild=TRUE;
MTH_tdxReal xTemp;
GEO_tdxHandleToParallelBox hParallelBox;
hSectorObject = (SECT_tdxHandleOfSectorObject) HIE_fn_hGetSuperObjectObject(hSector);
hParallelBox = (GEO_tdxHandleToParallelBox)HIE_fn_hGetSuperObjectBoundingVolume(hSector);
if(!hParallelBox)
GEO_fn_vCreateParallelBox(&hParallelBox);
HIE_M_ForEachChildOf(hSector, hSectorChild, xInd)
{
GEO_tdxHandleToMatrix hGlobalMatrix;
hGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix(hSectorChild);
switch (HIE_fn_ulGetSuperObjectType(hSectorChild))
{
case HIE_C_ulEDT_Geometric:
hGeometricObject = (ACP_tdxHandleOfObject) HIE_fn_hGetSuperObjectObject(hSectorChild);
break;
case HIE_C_ulIPO:
case HIE_C_ulIPO_Mirror:
GLI_vGetVisualSetLOD(PO_fn_hGetVisualSet(IPO_fn_hGetPhysicalObject((IPO_tdxHandleToInstanciatedPhysicalObject)HIE_fn_hGetSuperObjectObject(hSectorChild))),
0L,
&xTemp,
&hGeometricObject);
break;
case HIE_C_ulPO:
GLI_vGetVisualSetLOD(PO_fn_hGetVisualSet((PO_tdxHandleToPhysicalObject)HIE_fn_hGetSuperObjectObject(hSectorChild)),
0L,
&xTemp,
&hGeometricObject);
break;
default:
hGeometricObject = NULL;
break;
}
if(( hGeometricObject->d_stListOfPoints ) && (bFirstChild))
{
bFirstChild = 0;
MTH3D_M_vCopyVector(&stLocalMaxBoxPoint, hGeometricObject->d_stListOfPoints);
MTH3D_M_vCopyVector(&stLocalMinBoxPoint, hGeometricObject->d_stListOfPoints);
#ifndef U64
MTH3D_M_vMulMatrixVector (&stGlobalMaxBoxPoint, &hGlobalMatrix->stTransformMatrix, &stLocalMaxBoxPoint);
MTH3D_M_vMulMatrixVector (&stGlobalMinBoxPoint, &hGlobalMatrix->stTransformMatrix, &stLocalMinBoxPoint);
#else
POS_fn_vMulMatrixVertex (&stGlobalMaxBoxPoint, hGlobalMatrix, &stLocalMaxBoxPoint);
POS_fn_vMulMatrixVertex (&stGlobalMinBoxPoint, hGlobalMatrix, &stLocalMinBoxPoint);
#endif
}
else
{
if(bFirstChild)
{
MTH3D_M_vNullVector(&stLocalMaxBoxPoint);
MTH3D_M_vNullVector(&stLocalMinBoxPoint);
#ifndef U64
MTH3D_M_vMulMatrixVector (&stGlobalMaxBoxPoint, &hGlobalMatrix->stTransformMatrix, &stLocalMaxBoxPoint);
MTH3D_M_vMulMatrixVector (&stGlobalMinBoxPoint, &hGlobalMatrix->stTransformMatrix, &stLocalMinBoxPoint);
#else
POS_fn_vMulMatrixVertex (&stGlobalMaxBoxPoint, hGlobalMatrix, &stLocalMaxBoxPoint);
POS_fn_vMulMatrixVertex (&stGlobalMinBoxPoint, hGlobalMatrix, &stLocalMinBoxPoint);
#endif
}
}
if (hGeometricObject)
#ifndef U64
GEO_fn_vAddObjectToBox(hGeometricObject, hGlobalMatrix, &stGlobalMaxBoxPoint, &stGlobalMinBoxPoint);
#else
GEO_fn_vAddObjectToBox2(hGeometricObject, hGlobalMatrix, &stGlobalMaxBoxPoint, &stGlobalMinBoxPoint);
#endif
}
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
stGlobalMaxBoxPoint.xX = (float) (( (long)( (stGlobalMaxBoxPoint.xX*fScale) + 0.5) ) / fScale);
stGlobalMaxBoxPoint.xY = (float) (( (long)( (stGlobalMaxBoxPoint.xY*fScale) + 0.5) ) / fScale);
stGlobalMaxBoxPoint.xZ = (float) (( (long)( (stGlobalMaxBoxPoint.xZ*fScale) + 0.5) ) / fScale);
stGlobalMinBoxPoint.xX = (float) (( (long)( (stGlobalMinBoxPoint.xX*fScale) + 0.5) ) / fScale);
stGlobalMinBoxPoint.xY = (float) (( (long)( (stGlobalMinBoxPoint.xY*fScale) + 0.5) ) / fScale);
stGlobalMinBoxPoint.xZ = (float) (( (long)( (stGlobalMinBoxPoint.xZ*fScale) + 0.5) ) / fScale);
#endif //U64CONVERTLOG
// } fin N64-format
GEO_fn_vSetMaxPointOfParallelBox(hParallelBox, &stGlobalMaxBoxPoint);
GEO_fn_vSetMinPointOfParallelBox(hParallelBox, &stGlobalMinBoxPoint);
HIE_fn_vSetSuperObjectBoundingVolume(hSector, (void *)hParallelBox);
// FBF N64-format pour coords, et logfile dans x:\exe\geodump.log{
#ifdef U64CONVERTETLOG
fprintf (dump,"Bounding Volume Secteur %s :\nmin : %f,%f,%f\nmax : %f,%f,%f\n",hSectorObject->szSectorName,stGlobalMinBoxPoint.xX,stGlobalMinBoxPoint.xY,stGlobalMinBoxPoint.xZ,stGlobalMaxBoxPoint.xX,stGlobalMaxBoxPoint.xY,stGlobalMaxBoxPoint.xZ);
fflush(dump);
#endif //U64CONVERTLOG
// } fin N64-format
}
/*-----------------------------------------------------------------------------*/
void HIE_fn_vComputeBoundingVolumeOfSuperObjectBranch(HIE_tdxHandleToSuperObject _hSprObj)
{
HIE_tdxHandleToSuperObject hChild;
ACP_tdxIndex xIndex;
long lType;
HIE_M_ForEachChildOf(_hSprObj, hChild, xIndex)
{
lType = HIE_fn_ulGetSuperObjectType(hChild);
if(lType == HIE_C_ulSector)
HIE_fn_vComputeSectorBoundingVolume(hChild);
HIE_fn_vComputeAllBoundingVolumes( hChild );
}
}
/*-----------------------------------------------------------------------------*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,45 @@
/* (c) Ubi Studios 1998*/
/* See Vincent Greco for any comment or question*/
#ifndef __HIEALLDRW_H__
#define __HIEALLDRW_H__
#ifdef __cplusplus
extern "C" {
#endif
#define HIE_M_MustBeDisplayed(_lDrawMask) \
(( (_lDrawMask&GLI_C_lIsNotVisibleInRealWorld) && (_lDrawMask&GLI_C_lIsNotDrawingInMirror) ) || \
( (_lDrawMask&GLI_C_lIsNotVisibleInSymetricWorld) && !(_lDrawMask&GLI_C_lIsNotDrawingInMirror) ))
#define HIE_C_InheritableFlags \
(GLI_C_lIsNotVisibleInRealWorld|\
GLI_C_lIsNotVisibleInSymetricWorld|\
GLI_C_lCameraIsUnderWater|\
GLI_C_lIsNotDrawingSuperObjectBoundingVolume|\
GLI_C_lIsNotDrawingInMirror|\
GLI_C_lNotInvertBackfaces|\
GLI_C_lNotHideWhatIsUnderWater|\
GLI_C_lIsNotWired)
void fn_vSendOneModuleToViewPort(GLD_tdxHandleToViewportAttributes _hVpt,
HIE_tdxHandleToSuperObject _hSprObj ,
long _lDrawMask);
ACP_tdxBool fn_bSendOneSuperObjectToViewport(
GLD_tdxHandleToViewportAttributes _hVpt,
HIE_tdxHandleToSuperObject _hSprObj,
long *_DrawMask,
long _lCullingResult
);
#ifdef __cplusplus
}/* extern "C" */
#endif
#endif /* __HIEALLDRW_H__*/

View File

@@ -0,0 +1,236 @@
#include "ACP_base.h"
#include "GMT.h"
/*memory management of geometry.*/
/*
#include "ErrGEO.h"
#include "MemGEO.h"
*/
/* 007 #include "incGEO.h"*/
/*#include "MmgGEO.h"*/
/* 007 #include "incGLI.h"*/
/* 007*/
#include "geo.h"
#include "gli.h"
#include "SPO/HieMtStk.h"
extern POS_tdstCompletePosition *g_p_stCurrentMatrix ;/*provisoire*/
/*utiliser des EXTERN <20> l'occasion ...*/
GEO_tdxHandleToMatrix HIE_g_a_hMatrixStack[HIE_C_lMaxMatrixInStack];
GEO_tdxHandleToMatrix HIE_g_hCurrentMatrix ;
long HIE_g_lNbMatrixInStack = 0;
#define HIE_M_vUpdateStack()\
{\
g_p_stCurrentMatrix=HIE_g_hCurrentMatrix=HIE_g_a_hMatrixStack[HIE_g_lNbMatrixInStack-1];\
}
GEO_tdxHandleToMatrix GEO_fn_hCreateMatrix(void)
{
GEO_tdxHandleToMatrix hReturn;
MMG_fn_vAddMemoryInfo( MMG_C_lTypePosition , MMG_C_lSubTypePosition , 0 );
GEO_M_CPAMalloc(hReturn, GEO_tdxHandleToMatrix, sizeof(POS_tdstCompletePosition), E_uwGEONotEnoughtMemory);
POS_fn_vSetIdentityMatrix(hReturn);
return hReturn;
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GEO_fn_vDestroyMatrix(GEO_tdxHandleToMatrix _hMatrix)
{
GEO_M_CPAFree(_hMatrix);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
void HIE_fn_vCreateMatrixStack(void)
{
HIE_g_a_hMatrixStack[0] = GEO_fn_hCreateMatrix();
HIE_g_lNbMatrixInStack = 1;
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void HIE_fn_vDestroyMatrixStack(void)
{
GEO_fn_vDestroyMatrix( HIE_g_a_hMatrixStack[0] );
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*erase all the stack and then put the identity on the top*/
void HIE_fn_vInitMatrixStack(void)
{
HIE_g_lNbMatrixInStack=0;
POS_fn_vSetIdentityMatrix(HIE_g_a_hMatrixStack[HIE_g_lNbMatrixInStack]);
HIE_g_lNbMatrixInStack++;
HIE_M_vUpdateStack();
}
ACP_tdxBool HIE_fn_bLoadIdentity(void)
{
if( HIE_g_lNbMatrixInStack == HIE_C_lMaxMatrixInStack )
#if !defined(U64)
return NOK;
#else
ASM_BREAK;
#endif /* U64 */
HIE_g_a_hMatrixStack[HIE_g_lNbMatrixInStack] = HIE_g_a_hMatrixStack[0];
HIE_g_lNbMatrixInStack++;
HIE_M_vUpdateStack();
return OK;
}
/* remove the top of the stack*/
ACP_tdxBool HIE_fn_bPopMatrix(void)
{
if( HIE_g_lNbMatrixInStack == 0 )
#if !defined(U64)
return NOK;
#else
ASM_BREAK;
#endif /* U64 */
HIE_g_lNbMatrixInStack--;
HIE_M_vUpdateStack();
return OK;
}
/*put the parameter on the top of the stack*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
ACP_tdxBool HIE_fn_bLoadMatrix(GEO_tdxHandleToMatrix _hMatrix)
{
return HIE_fn_bStoreMatrix(_hMatrix);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*empty the stack*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void HIE_fn_vResetMatrixStack(void)
{
HIE_g_lNbMatrixInStack=0;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
ACP_tdxBool HIE_fn_bStoreMatrix( GEO_tdxHandleToMatrix _hMatrix )
{
if( HIE_g_lNbMatrixInStack == HIE_C_lMaxMatrixInStack )
#if !defined(U64)
return NOK;
#else
ASM_BREAK;
#endif /* U64 */
HIE_g_a_hMatrixStack[HIE_g_lNbMatrixInStack] = _hMatrix;
HIE_g_lNbMatrixInStack++;
HIE_M_vUpdateStack();
return OK;
}
/*//////////////////////////////////////////////////////////////////////////////////////////////////////*/
/*//////////////////////////////////////////////////////////////////////////////////////////////////////*/
/* New stack used to push the camera matrix first*/
/*//////////////////////////////////////////////////////////////////////////////////////////////////////*/
/*//////////////////////////////////////////////////////////////////////////////////////////////////////*/
extern POS_tdstCompletePosition *g_p_stCurrentInCamCoordsMatrix;
POS_tdstCompletePosition HIE_g_a_stCameraMatrixStack[HIE_C_lMaxMatrixInStack+1];
unsigned long HIE_g_lNbMatrixInCameraStack;
#define HIE_M_vUpdateCameraMatrixStack() \
{\
g_p_stCurrentInCamCoordsMatrix = &HIE_g_a_stCameraMatrixStack[HIE_g_lNbMatrixInCameraStack-1]; \
}
/* empty the stack and push the camera mtrix of the given viewport*/
ACP_tdxBool HIE_fn_bInitCameraMatrixStack(GLD_tdxHandleToViewportAttributes _hVpt)
{
HIE_g_lNbMatrixInCameraStack=0;
#if defined(ACTIVE_EDITOR)
if( ((( GLI_tdstSpecificAttributesFor3D *)_hVpt->p_vSpecificToXD)->p_stCam) == NULL )
return NOK;
#endif
POS_fn_vCopyMatrix(&HIE_g_a_stCameraMatrixStack[HIE_g_lNbMatrixInCameraStack] , &((( GLI_tdstSpecificAttributesFor3D *)_hVpt->p_vSpecificToXD)->p_stCam)->stMatrix);
HIE_g_lNbMatrixInCameraStack++;
HIE_M_vUpdateCameraMatrixStack();
return OK;
}
/* update the stak with global matrix of the given SuperObject*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 07/06/99 */
ACP_tdxBool HIE_fn_bStoreOnCameraMatrixStack( GEO_tdxHandleToMatrix _hMatrix )
{
if( !HIE_g_lNbMatrixInCameraStack || HIE_g_lNbMatrixInCameraStack == HIE_C_lMaxMatrixInStack )
#if !defined(U64)
return NOK;
#else
ASM_BREAK;
#endif /* U64 */
POS_fn_vMulMatrixMatrix( &HIE_g_a_stCameraMatrixStack[HIE_g_lNbMatrixInCameraStack] , &HIE_g_a_stCameraMatrixStack[0]
, _hMatrix );
HIE_g_lNbMatrixInCameraStack++;
HIE_M_vUpdateCameraMatrixStack();
return OK;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 07/06/99 */
/* update the stak with local matrix of the given SuperObject*/
ACP_tdxBool HIE_fn_bPushOnCameraMatrixStack( GEO_tdxHandleToMatrix _hMatrix )
{
if( !HIE_g_lNbMatrixInCameraStack || HIE_g_lNbMatrixInCameraStack == HIE_C_lMaxMatrixInStack )
#if !defined(U64)
return NOK;
#else
ASM_BREAK;
#endif /* U64 */
POS_fn_vMulMatrixMatrix( &HIE_g_a_stCameraMatrixStack[HIE_g_lNbMatrixInCameraStack] , &HIE_g_a_stCameraMatrixStack[HIE_g_lNbMatrixInCameraStack-1]
, _hMatrix );
HIE_g_lNbMatrixInCameraStack++;
HIE_M_vUpdateCameraMatrixStack();
return OK;
}
/* */
ACP_tdxBool HIE_fn_bPopOnCameraMatrixStack()
{
if( HIE_g_lNbMatrixInCameraStack == 0 )
#if !defined(U64)
return NOK;
#else
ASM_BREAK;
#endif /* U64 */
HIE_g_lNbMatrixInCameraStack--;
assert(HIE_g_lNbMatrixInCameraStack>0);
HIE_M_vUpdateCameraMatrixStack();
return OK;
}
/**/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void HIE_fn_vSetCurrentInCamCoordsMatrix (POS_tdstCompletePosition *p_stMatrix)
{
g_p_stCurrentInCamCoordsMatrix = p_stMatrix;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
POS_tdstCompletePosition * HIE_fn_pGetCurrentInCamCoordsMatrix (void)
{
return g_p_stCurrentInCamCoordsMatrix;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */

View File

@@ -0,0 +1,968 @@
/*ANNECY CB Attention, tout a <20>t<EFBFBD> modifi<66> dans ce fichier !!!*/
#include "ACP_base.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "PCS.h"
#include "COL.h"
#include "lst.h"
#include "PO.h"
#include "FIL.h"
#include "snd.h"
#include "gld.h"
#include "mec.h"
#ifdef USE_IPT_DX5
#include "IPT_DX5.h" /* InPuT (absolutely before GAM.h)*/
#else /* USE_IPT_WIN */
#include "IPT.h" /* InPuT (absolutely before GAM.h)*/
#endif /* USE_IPT_WIN */
#include "sct.h"
#ifndef D_THROW_PRT
#include "PRT.h"
#endif /* D_THROW_PRT */
#include "gam.h"
#include "tmr.h"
/*XB980821*/
#ifndef D_THROW_IPO
#include "IPO.h"
#endif /* D_THROW_IPO */
/*End XB*/
#undef extern
#include "SPO/HieConst.h"
#include "LST.h"
#include "SPO/HieSpObj.h"
#include "SPO/HieHand.h"
#include "SPO/HieDef.h"
#include "SPO/HieMacro.h"
#include "SPO/HieMtStk.h"
#include "SPO/HieExt.h"
#include "SPO/HiePick.h"
/*HP 180698*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
MTH_tdxReal VoidReal;
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
ACP_tdxHandleOfObject GeoHandle;
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef D_THROW_VISUAL_SET
#define M_hGetFirstLodOfVisualSetFromPo(Po) (GLI_vGetVisualSetLOD(PO_fn_hGetVisualSet(Po), 0, &VoidReal, &GeoHandle), GeoHandle)
#define M_hGetRepositionZoneFromPo(Po) (GLI_vGetVisualSetLOD(PO_fn_hGetVisualSet(Po), 0, &VoidReal, &GeoHandle), GeoHandle)
#else
#define M_hGetFirstLodOfVisualSetFromPo(Po) PO_fn_hGetGeometricObject(Po)
#define M_hGetRepositionZoneFromPo(Po) PO_fn_hGetGeometricObject(Po)
#endif /* D_THROW_VISUAL_SET */
extern BOOL fn_bIsEditorsActive(void);
extern unsigned long fn_ulStandardGameGetCustomBitsSO (HIE_tdxHandleToSuperObject hSupObj);
extern ACP_tdxHandleOfObject fn_hMakeOneObjectFromManyZdx (unsigned char _ucZoneType, HIE_tdxHandleToSuperObject _hCharacter);
unsigned long g_ulSpoMask = 0;
/*
*=================================================================================================
*=================================================================================================
*/
#ifdef ACTIVE_EDITOR
/* active editor only*/
static ACP_tdxBool fn_bIsBoundingVolumeIntersect
(
GEO_tdxHandleToMatrix _p_stCurrentMatrix,
MTH3D_tdstVector * _p_stVertexA,
MTH3D_tdstVector * _p_stVectAB,
GEO_tdxHandleToBoundingSphere _hBoundingSphere
)
{
MTH3D_tdstVector stGlobalSphereCenter;
MTH_tdxReal xScaledRadius;
MTH3D_M_vMulMatrixVector(&stGlobalSphereCenter, &_p_stCurrentMatrix->stRotationMatrix, GEO_fn_pGetCenterPointOfBoundingSphere(_hBoundingSphere));
MTH3D_M_vAddVector(&stGlobalSphereCenter, &_p_stCurrentMatrix->stTranslationVector, &stGlobalSphereCenter);
xScaledRadius = GEO_fn_xGetRadiusOfBoundingSphere(_hBoundingSphere) * POS_fn_xGetMaxScale(_p_stCurrentMatrix);
return INT_fn_bDetectIntersectSemiAxeWithSphere (_p_stVertexA, _p_stVectAB, &stGlobalSphereCenter, xScaledRadius);
}
#endif
/* used*/
ACP_tdxBool fn_bDetectIntersectSegmentWithBoundingSphere
(
GEO_tdxHandleToMatrix _p_stCurrentMatrix,
MTH3D_tdstVector * _p_stVertexA,
MTH3D_tdstVector * _p_stVectAB,
GEO_tdxHandleToBoundingSphere _hBoundingSphere
)
{
MTH3D_tdstVector stGlobalSphereCenter;
MTH_tdxReal xScaledRadius;
MTH3D_M_vMulMatrixVector(&stGlobalSphereCenter, &_p_stCurrentMatrix->stRotationMatrix, GEO_fn_pGetCenterPointOfBoundingSphere(_hBoundingSphere));
MTH3D_M_vAddVector(&stGlobalSphereCenter, &_p_stCurrentMatrix->stTranslationVector, &stGlobalSphereCenter);
xScaledRadius = GEO_fn_xGetRadiusOfBoundingSphere(_hBoundingSphere) * POS_fn_xGetMaxScale(_p_stCurrentMatrix);
return INT_fn_bDetectIntersectSegmentWithSphere (_p_stVertexA, _p_stVectAB, &stGlobalSphereCenter, xScaledRadius);
}
/*
*=================================================================================================
*=================================================================================================
*/
#ifdef ACTIVE_EDITOR
/* active editor only*/
static ACP_tdxIndex fn_xIntersectSemiAxeWithRepositioningSuperObject
(
GLI_tdeModePicking xModePicking,
MTH3D_tdstVector *p_stVertexA,
MTH3D_tdstVector *p_stVertexB,
MTH3D_tdstVector *p_stVectAB,
HIE_tdxHandleToSuperObject _hSprObj,
HIE_tdstPickInfo *p_stPickInfo ,
ACP_tdxIndex *p_xNbPickInfo
)
{
static GEO_tdxHandleToBoundingSphere hBoundingSphere;
static GEO_tdxHandleToParallelBox hParallelBox;
static ACP_tdxHandleOfObject hSentObject;
static MTH3D_tdstVector stMinPoint;
static MTH3D_tdstVector stMaxPoint;
static ACP_tdxBool bBoxBoundingVolume,bIntersect;
ACP_tdxIndex i;
static long lType,lCustomBits;
HIE_tdxHandleToSuperObject hChild;
static MTH3D_tdstVector stVertexALocal, stVectAB;
static POS_tdstCompletePosition stInvMatrix;
static GLI_tdstPickedObject stPickedObject;
/* eliminate every object that must be ignored...*/
if (HIE_fn_SO_bIsNotPickable( _hSprObj ))
{
return *p_xNbPickInfo;
}
lType=HIE_fn_ulGetSuperObjectType(_hSprObj);
/* we test if the character is rayman (has the custombit 32)*/
/* we also ignore the character if he can't be hit by ray tracing.*/
/* we also ignore inactive characters*/
if (lType==HIE_C_ulActor)
{
lCustomBits = fn_ulStandardGameGetCustomBitsSO(_hSprObj);
if ( !(lCustomBits & GAM_C_CustBitRayHit) || /* not hit by ray tracing*/
!(fn_bf1StandardGameGetIsActive(M_GetMSHandle(_hSprObj,StandardGame))) || /* inactive*/
(lCustomBits & (1<<31)) ) /* Rayman*/
{
return *p_xNbPickInfo;
}
}
/* ok, now we can pick*/
hBoundingSphere = NULL;
hParallelBox = NULL;
hSentObject = NULL;
HIE_fn_vPushMatrix (_hSprObj);
/* do we have a bounding sphere or a bounding box ??*/
bBoxBoundingVolume = HIE_fn_SO_bHasABoxBoundingVolume(_hSprObj);
if(bBoxBoundingVolume)
{
/* this is a BOX !! */
hParallelBox = (GEO_tdxHandleToParallelBox)HIE_fn_hGetSuperObjectBoundingVolume(_hSprObj);
if (hParallelBox)
{
/* the box realy exists, compute its 2 points in world coordinates*/
MTH3D_tdstVector *p_stMinPoint;
MTH3D_tdstVector *p_stMaxPoint;
MTH3D_tdstVector stTranslation;
p_stMinPoint = GEO_fn_pGetMinPointOfParallelBox(hParallelBox);
p_stMaxPoint = GEO_fn_pGetMaxPointOfParallelBox(hParallelBox);
stTranslation = (HIE_fn_hGetSuperObjectGlobalMatrix(_hSprObj))->stTranslationVector;
MTH3D_M_vAddVector(&stMinPoint, p_stMinPoint , &stTranslation);
MTH3D_M_vAddVector(&stMaxPoint, p_stMaxPoint , &stTranslation);
}
}
else
{
/* this is a SPHERE, get it*/
hBoundingSphere = (GEO_tdxHandleToBoundingSphere)HIE_fn_hGetSuperObjectBoundingVolume(_hSprObj);
}
/* test intersection*/
if (!hBoundingSphere && !hParallelBox)
{
/* if there are no bounding volume at all (no box nor sphere) --> go further*/
bIntersect = TRUE;
}
else if (!bBoxBoundingVolume)
{
/* if there is a BV Sphere, seek an intersect between the sphere and the axe*/
bIntersect = fn_bIsBoundingVolumeIntersect(HIE_fn_hGetSuperObjectGlobalMatrix(_hSprObj), p_stVertexA, p_stVectAB, hBoundingSphere);
}
else
{
/*if there is a BV Box, seek an intersect between the box and the axe */
bIntersect = INT_fn_bDetectIntersectSemiAxeWithBox(p_stVertexA, p_stVertexB, p_stVectAB, &stMinPoint, &stMaxPoint);
}
if(bIntersect)
{
if( lType & (HIE_C_ulEDT_Geometric | HIE_C_ulMirror))
{
hSentObject = (ACP_tdxHandleOfObject)HIE_fn_hGetSuperObjectObject(_hSprObj);
}
else if( lType & (HIE_C_ulPO | HIE_C_ulPO_Mirror))
{
PCS_tdxHandleToPhysicalCollSet hCollSet = PO_fn_hGetCollideSet((PO_tdxHandleToPhysicalObject) HIE_fn_hGetSuperObjectObject (_hSprObj)); /*AR9809*/
hSentObject = hCollSet ? PCS_fn_hGetZdrGeoObjOfPhysicalCollSet (hCollSet) : NULL;
}
#ifndef D_THROW_IPO
else if( lType & (HIE_C_ulIPO | HIE_C_ulIPO_Mirror))
{
PCS_tdxHandleToPhysicalCollSet hCollSet = PO_fn_hGetCollideSet (IPO_fn_hGetPhysicalObject
((IPO_tdxHandleToInstanciatedPhysicalObject) HIE_fn_hGetSuperObjectObject (_hSprObj)));
hSentObject = hCollSet ? PCS_fn_hGetZdrGeoObjOfPhysicalCollSet (hCollSet) : NULL;
}
#endif
else if( lType == HIE_C_ulActor )
{
hSentObject=fn_hMakeOneObjectFromManyZdx(C_ucTypeZdr, _hSprObj);
}
/* intersection test*/
if (hSentObject)
{
/* convertion local coordinate system*/
POS_fn_vInvertMatrix(&stInvMatrix, g_p_stCurrentMatrix);
MTH3D_M_vMulMatrixVectorWithoutBuffer(&stVectAB, &(stInvMatrix.stTransformMatrix), p_stVectAB);
MTH3D_M_vAddVector(&stVectAB, &(stInvMatrix.stTranslationVector), &stVectAB);
MTH3D_M_vMulMatrixVectorWithoutBuffer(&stVertexALocal, &(stInvMatrix.stTransformMatrix), p_stVertexA);
MTH3D_M_vAddVector(&stVertexALocal, &(stInvMatrix.stTranslationVector), &stVertexALocal);
if (PIC_bIntersectSemiAxeWithGeometricObject (xModePicking,&stVertexALocal,&stVectAB,hSentObject,&stPickedObject))
{
ACP_tdxIndex i;
i=(*p_xNbPickInfo)-1;
while( (i >= 0) && (stPickedObject.aDEF_stDataOfElement[0].xDistance
< p_stPickInfo[i].stPickedObject.aDEF_stDataOfElement[0].xDistance) )
{
if ( i < (HIE_C_DepthPickingObjects-1) )
p_stPickInfo[i+1] = p_stPickInfo[i];
i--;
}
if ( i < (HIE_C_DepthPickingObjects-1) )
{
p_stPickInfo[i+1].stPickedObject = stPickedObject;
p_stPickInfo[i+1].hSprObject = _hSprObj;
p_stPickInfo[i+1].hGeoObject=hSentObject;
if ( (*p_xNbPickInfo) < HIE_C_DepthPickingObjects )
(*p_xNbPickInfo)++;
}
}
}
}
if (bIntersect || HIE_fn_SO_bCheckChildren(_hSprObj))
{
/* node examination*/
HIE_M_ForEachChildOf(_hSprObj, hChild, i)
{
/* recurence*/
fn_xIntersectSemiAxeWithRepositioningSuperObject(xModePicking,
p_stVertexA,
p_stVertexB,
p_stVectAB,
hChild,
p_stPickInfo,
p_xNbPickInfo);
}
}
HIE_fn_vPopMatrix ();
return *p_xNbPickInfo;
}
#endif /* ACTIVE_EDITOR*/
/*
*=================================================================================================
*=================================================================================================
*/
#ifdef ACTIVE_EDITOR
/* active editor only*/
ACP_tdxIndex fn_xIntersectSemiAxeWithVisualSuperObject
(
GLI_tdeModePicking xModePicking,
MTH3D_tdstVector *p_stVertexA,
MTH3D_tdstVector *p_stVertexB,
MTH3D_tdstVector *p_stVectAB,
HIE_tdxHandleToSuperObject _hSprObj,
HIE_tdstPickInfo *p_stPickInfo ,
ACP_tdxIndex *p_xNbPickInfo
)
{
ACP_tdxHandleOfObject hSentObject = NULL;
ACP_tdxIndex i;
HIE_tdxHandleToSuperObject hChild;
long lType;
HIE_fn_vPushMatrix(_hSprObj);
lType=HIE_fn_ulGetSuperObjectType(_hSprObj);
{
if (
HIE_fn_SO_bIsNotPickable( _hSprObj )
#ifdef ACTIVE_EDITOR
&& !fn_bIsEditorsActive()
#endif
)
{
HIE_fn_vPopMatrix ();
return *p_xNbPickInfo;
}
if( lType & (HIE_C_ulEDT_Geometric | HIE_C_ulPO | HIE_C_ulIPO | HIE_C_ulMirror| HIE_C_ulPO_Mirror | HIE_C_ulIPO_Mirror))
{
MTH3D_tdstVector stVertexALocal, stVertexBLocal, stVectAB;
POS_tdstCompletePosition stInvMatrix;
GLI_tdstPickedObject stPickedObject;
/* convertion loacal coordinate system*/
POS_fn_vInvertMatrix(&stInvMatrix, g_p_stCurrentMatrix);/*!!!*/
POS_fn_vMulMatrixVertex(&stVertexALocal, &stInvMatrix, p_stVertexA);
POS_fn_vMulMatrixVertex(&stVertexBLocal, &stInvMatrix, p_stVertexB);
MTH3D_M_vSubVector(&stVectAB, &stVertexBLocal, &stVertexALocal);
if(lType & (HIE_C_ulEDT_Geometric | HIE_C_ulMirror))
hSentObject=(ACP_tdxHandleOfObject)HIE_fn_hGetSuperObjectObject(_hSprObj);
if(lType & (HIE_C_ulPO | HIE_C_ulPO_Mirror))
hSentObject=M_hGetFirstLodOfVisualSetFromPo((PO_tdxHandleToPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj));
/*XB980821*/
#ifndef D_THROW_IPO
if(lType & (HIE_C_ulIPO | HIE_C_ulIPO_Mirror))
hSentObject=M_hGetFirstLodOfVisualSetFromPo(IPO_fn_hGetPhysicalObject((IPO_tdxHandleToInstanciatedPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj)));
#endif /* D_THROW_IPO */
/*End XB*/
/* intersection test*/
if( PIC_bIntersectSemiAxeWithGeometricObject(xModePicking,
&stVertexALocal,
/* &stVertexBLocal,*/
&stVectAB,
hSentObject,
&stPickedObject) )
{ /* l'objet est sous la souris*/
ACP_tdxIndex i;
i=(*p_xNbPickInfo)-1;
while( (i >= 0) && (stPickedObject.aDEF_stDataOfElement[0].xDistance
< p_stPickInfo[i].stPickedObject.aDEF_stDataOfElement[0].xDistance) )
{
if ( i < (HIE_C_DepthPickingObjects-1) )
p_stPickInfo[i+1] = p_stPickInfo[i];
i--;
}
if ( i < (HIE_C_DepthPickingObjects-1) )
{
p_stPickInfo[i+1].stPickedObject = stPickedObject;
p_stPickInfo[i+1].hSprObject = _hSprObj;
p_stPickInfo[i+1].hGeoObject=hSentObject;
if ( (*p_xNbPickInfo) < HIE_C_DepthPickingObjects )
(*p_xNbPickInfo)++;
}
}
}
/* node examination*/
HIE_M_ForEachChildOf(_hSprObj, hChild, i)
{
/* recurence*/
fn_xIntersectSemiAxeWithVisualSuperObject(xModePicking,
p_stVertexA,
p_stVertexB,
p_stVectAB,
hChild,
p_stPickInfo,
p_xNbPickInfo);
}
}
HIE_fn_vPopMatrix ();
return *p_xNbPickInfo;
}
#endif /* ACTIVE_EDITOR*/
/*
*=================================================================================================
*=================================================================================================
*/
#ifdef ACTIVE_EDITOR
/* active editor only*/
ACP_tdxIndex HIE_xIsSuperObjectPick
(
GLI_tdeModePicking xModePicking,
GLD_tdhDevice hDev,
GLD_tdhViewport hVp,
GLI_tdst2DVertex *p_stSouris2D,
HIE_tdxHandleToSuperObject hSprObj,
HIE_tdstPickInfo *p_stPickInfo
)
{
MTH3D_tdstVector stSouris3D, stVertex12, stCameraPos;
ACP_tdxIndex xNbPickInfo=0;
/* calcul des positions 3d de la camera et de la souris dans le repere global*/
PIC_vGetPosCamAndMouse(hDev, hVp, p_stSouris2D, &stSouris3D, &stCameraPos);
MTH3D_M_vSubVector(&stVertex12, &stSouris3D, &stCameraPos);
return fn_xIntersectSemiAxeWithVisualSuperObject
(
xModePicking,
&stCameraPos,
&stSouris3D,
&stVertex12,
hSprObj,
p_stPickInfo,
&xNbPickInfo
);
}
#endif
/*
*=================================================================================================
*=================================================================================================
*/
#ifdef ACTIVE_EDITOR
/* active editor only*/
ACP_tdxIndex HIE_bIntersectSemiAxeWithSuperObject
(
GLI_tdeModePicking xModePicking,
MTH3D_tdstVector *p_stVertexA,
MTH3D_tdstVector *p_stVertexB,
MTH3D_tdstVector *p_stVectAB,
HIE_tdxHandleToSuperObject hSprObj,
HIE_tdstPickInfo *p_stPickInfo
)
{
ACP_tdxIndex xNbPickInfo = 0;
ACP_tdxIndex iRet;
HIE_fn_bLoadIdentity();
iRet = fn_xIntersectSemiAxeWithRepositioningSuperObject
(
xModePicking,
p_stVertexA,
p_stVertexB,
p_stVectAB,
hSprObj,
p_stPickInfo,
&xNbPickInfo
);
HIE_fn_vPopMatrix();
return iRet;
}
#endif
/*
*=================================================================================================
*=================================================================================================
*/
/*
*=================================================================================================
*=================================================================================================
*/
/* used*/
static ACP_tdxIndex fn_xIntersectSegmentWithRepositioningSuperObject
(
MTH3D_tdstVector *p_stVertexA,
MTH3D_tdstVector *p_stVectAB,
HIE_tdxHandleToSuperObject _hSprObj,
HIE_tdstPickInfo *p_stPickInfo ,
ACP_tdxIndex *p_xNbPickInfo
)
{
static GEO_tdxHandleToBoundingSphere hBoundingSphere;
static GEO_tdxHandleToParallelBox hParallelBox;
static ACP_tdxHandleOfObject hSentObject;
static MTH3D_tdstVector stMinPoint;
static MTH3D_tdstVector stMaxPoint;
static ACP_tdxBool bBoxBoundingVolume,bIntersect;
ACP_tdxIndex i;
/* XB 05/05/99 */
/* static long lType,lCustomBits; */
static long lType;
/* End XB 05/05/99 */
HIE_tdxHandleToSuperObject hChild;
static MTH3D_tdstVector stVertexALocal, stVectAB;
static POS_tdstCompletePosition stInvMatrix;
static GLI_tdstPickedObject stPickedObject;
register unsigned long ulSpoFlags;
ulSpoFlags = HIE_M_xGetSuperObjectMember(_hSprObj,ulFlags);
/* eliminate every object that has the No_Collision flag*/
if (ulSpoFlags & HIE_C_Flag_ulNotPickable)
{
return *p_xNbPickInfo;
}
lType=HIE_fn_ulGetSuperObjectType(_hSprObj);
/* if object is not an actor, check the flags with the given mask...*/
/* else, check the custom bit */
if (lType != HIE_C_ulActor)
{
if (ulSpoFlags & g_ulSpoMask)
return *p_xNbPickInfo;
}
else
{
if (!fn_ulStandardGameGetCustomBitsSO(_hSprObj) & GAM_C_CustBitShadowOnMe)
{
return *p_xNbPickInfo;
}
}
hBoundingSphere = NULL;
hParallelBox = NULL;
hSentObject = NULL;
HIE_fn_vPushMatrix(_hSprObj);
/* do we have a bounding sphere or a bounding box ??*/
bBoxBoundingVolume = (unsigned char)(ulSpoFlags & HIE_C_Flag_ulTypeOfBoundingVolume);
if(bBoxBoundingVolume)
{
/* this is a BOX !! */
hParallelBox = (GEO_tdxHandleToParallelBox)HIE_fn_hGetSuperObjectBoundingVolume(_hSprObj);
if (hParallelBox)
{
/* the box realy exists, compute its 2 points in world coordinates*/
MTH3D_tdstVector *p_stMinPoint;
MTH3D_tdstVector *p_stMaxPoint;
MTH3D_tdstVector stTranslation;
p_stMinPoint = GEO_fn_pGetMinPointOfParallelBox(hParallelBox);
p_stMaxPoint = GEO_fn_pGetMaxPointOfParallelBox(hParallelBox);
stTranslation = (HIE_fn_hGetSuperObjectGlobalMatrix(_hSprObj))->stTranslationVector;
MTH3D_M_vAddVector(&stMinPoint, p_stMinPoint , &stTranslation);
MTH3D_M_vAddVector(&stMaxPoint, p_stMaxPoint , &stTranslation);
}
}
else
{
/* this is a SPHERE, get it*/
hBoundingSphere = (GEO_tdxHandleToBoundingSphere)HIE_fn_hGetSuperObjectBoundingVolume(_hSprObj);
}
/* test intersection*/
if (!hBoundingSphere && !hParallelBox)
{
/* if there are no bounding volume at all (no box nor sphere) --> go further*/
bIntersect = TRUE;
}
else if (!bBoxBoundingVolume)
{
/* if there is a BV Sphere, seek an intersect between the sphere and the axe*/
bIntersect = fn_bDetectIntersectSegmentWithBoundingSphere(HIE_fn_hGetSuperObjectGlobalMatrix(_hSprObj), p_stVertexA, p_stVectAB, hBoundingSphere);
}
else
{
/*if there is a BV Box, seek an intersect between the box and the axe */
bIntersect = INT_fn_bDetectIntersectSegmentWithBox(p_stVertexA, p_stVectAB, &stMinPoint, &stMaxPoint,NULL);
}
if(bIntersect)
{
/* we found an intersection between the segment and the bounding volume --> let's see if we must get down to the faces*/
#ifndef U64 /* no editor objects on u64*/
if( lType & (HIE_C_ulEDT_Geometric | HIE_C_ulMirror))
{
hSentObject = (ACP_tdxHandleOfObject)HIE_fn_hGetSuperObjectObject(_hSprObj);
}
else
#endif
if( lType & (HIE_C_ulPO | HIE_C_ulPO_Mirror))
{
PCS_tdxHandleToPhysicalCollSet hCollSet = PO_fn_hGetCollideSet((PO_tdxHandleToPhysicalObject) HIE_fn_hGetSuperObjectObject (_hSprObj)); /*AR9809*/
hSentObject = hCollSet ? PCS_fn_hGetZdrGeoObjOfPhysicalCollSet (hCollSet) : NULL;
}
#ifndef D_THROW_IPO
else if( lType & (HIE_C_ulIPO | HIE_C_ulIPO_Mirror))
{
PCS_tdxHandleToPhysicalCollSet hCollSet = PO_fn_hGetCollideSet (IPO_fn_hGetPhysicalObject
((IPO_tdxHandleToInstanciatedPhysicalObject) HIE_fn_hGetSuperObjectObject (_hSprObj)));
hSentObject = hCollSet ? PCS_fn_hGetZdrGeoObjOfPhysicalCollSet (hCollSet) : NULL;
}
#endif
else if( lType == HIE_C_ulActor )
{
hSentObject=fn_hMakeOneObjectFromManyZdx(C_ucTypeZdr, _hSprObj);
}
if (hSentObject)
{
/* the detected objetc is relevant, let's see if there is a collision with its faces...*/
/*Convertion local coordinate system.*/
if (ulSpoFlags & HIE_C_Flag_ulNoTransformationMatrix)
{
/* Only translation, compute A i local*/
MTH3D_M_vSubVector (&stVertexALocal , p_stVertexA , &_hSprObj->hGlobalMatrix->stTranslationVector);
/* and nothing for the vector AB...*/
MTH3D_M_vCopyVector(&stVectAB,p_stVectAB);
}
else
{
POS_fn_vInvertMatrix(&stInvMatrix,_hSprObj->hGlobalMatrix);
/* MTH3D_M_vTranspMatrixWithoutBuffer(&stInvMatrix,&_hSprObj->hGlobalMatrix->stRotationMatrix);*/
/* here, stVectAB is used only as a temporary variable and has no meaning...*/
/* compute A in local coordinates*/
/* MTH3D_M_vSubVector (&stVectAB , p_stVertexA , &_hSprObj->hGlobalMatrix->stTranslationVector);*/
/* MTH3D_M_vMulMatrixVectorWithoutBuffer(&stVertexALocal, &stInvMatrix, &stVectAB);*/
POS_fn_vMulMatrixVertex(&stVertexALocal,&stInvMatrix, p_stVertexA);
/* compute AB in local coordinates*/
POS_fn_vMulMatrixVector(&stVectAB, &stInvMatrix, p_stVectAB);
/* MTH3D_M_vMulMatrixVectorWithoutBuffer(&stVectAB, &stInvMatrix, p_stVectAB);*/
}
if (PIC_bIntersectSegmentWithGeometricObject (&stVertexALocal,&stVectAB,hSentObject,&stPickedObject))
{
/* yes, we got an intersection !!*/
/* if it is the first one, then remember it*/
if (*p_xNbPickInfo == 0)
{
/* first one !*/
p_stPickInfo[0].stPickedObject = stPickedObject;
p_stPickInfo[0].hSprObject = _hSprObj;
p_stPickInfo[0].hGeoObject = hSentObject;
*p_xNbPickInfo = 1;
/* and reduce the lenght of the segment */
MTH3D_M_vSubVector(p_stVectAB, &(stPickedObject.aDEF_stDataOfElement[0].stHit),p_stVertexA);
}
else
{
/* there has already been a collision in this search, so check distance*/
/* compare this detection with the previous one*/
if (stPickedObject.aDEF_stDataOfElement[0].xDistance < p_stPickInfo[0].stPickedObject.aDEF_stDataOfElement[0].xDistance)
{
/* ok, the new one is nearer*/
/* lets remember the data*/
p_stPickInfo[0].stPickedObject = stPickedObject;
p_stPickInfo[0].hSprObject = _hSprObj;
p_stPickInfo[0].hGeoObject = hSentObject;
/* and reduce the lenght of the segment */
MTH3D_M_vSubVector(p_stVectAB, &(stPickedObject.aDEF_stDataOfElement[0].stHit),p_stVertexA);
}
}
}
}
}
/* keep going on the sons of this SO */
if (bIntersect || HIE_fn_SO_bCheckChildren(_hSprObj))
{
HIE_M_ForEachChildOf(_hSprObj, hChild, i)
{
/* recurence*/
fn_xIntersectSegmentWithRepositioningSuperObject
(
p_stVertexA,
p_stVectAB,
hChild,
p_stPickInfo,
p_xNbPickInfo
);
}
}
HIE_fn_vPopMatrix ();
return *p_xNbPickInfo;
}
/*
*=================================================================================================
*=================================================================================================
*/
/* used*/
ACP_tdxIndex HIE_bIntersectSegmentWithSuperObject
(
MTH3D_tdstVector *p_stVertexA,
MTH3D_tdstVector *p_stVectAB,
HIE_tdxHandleToSuperObject hSprObj,
HIE_tdstPickInfo *p_stPickInfo
)
{
ACP_tdxIndex xNbPickInfo = 0, xReturnValue;
HIE_fn_bLoadIdentity();
xReturnValue = fn_xIntersectSegmentWithRepositioningSuperObject
(
p_stVertexA,
p_stVectAB,
hSprObj,
p_stPickInfo,
&xNbPickInfo
);
HIE_fn_bPopMatrix();
return xReturnValue;
}
/*
*=================================================================================================
*=================================================================================================
*/
/* used*/
/* compute the intersection between the segment [A, A+AB], and the hSprObj and its descendants*/
ACP_tdxBool HIE_bIntersectSegmentWithFirstSuperObject(MTH3D_tdstVector *_p_stVertexA,
MTH3D_tdstVector *_p_stVectAB,
HIE_tdxHandleToSuperObject hSprObj,
MTH3D_tdstVector *_p_stHit,
MTH3D_tdstVector *_p_stNormal,
HIE_tdxHandleToSuperObject *_p_hSprObjHit
)
{
HIE_aDEF_stTabOfPickInfo aDEF_stIntersInfo;
GEO_tdstGeometricObject *p_stGeomObj;
GLI_tdstDataOfElement *p_stDataOfElement;
MTH3D_tdstVector stNormal;
long lType;
if( HIE_bIntersectSegmentWithSuperObject(_p_stVertexA,_p_stVectAB,hSprObj,aDEF_stIntersInfo) > 0)
{
/* detection !!!*/
p_stGeomObj = aDEF_stIntersInfo[0].hGeoObject;
p_stDataOfElement = &(aDEF_stIntersInfo[0].stPickedObject.aDEF_stDataOfElement[0]);
lType = HIE_fn_ulGetSuperObjectType(aDEF_stIntersInfo[0].hSprObject);
if(lType & (HIE_C_ulEDT_Geometric | HIE_C_ulPO | HIE_C_ulMirror | HIE_C_ulPO_Mirror | HIE_C_ulActor | HIE_C_ulIPO | HIE_C_ulIPO_Mirror))
{
*_p_hSprObjHit = aDEF_stIntersInfo[0].hSprObject;
}
else
{
*_p_hSprObjHit = NULL;
}
MTH3D_M_vCopyVector( _p_stHit, &(p_stDataOfElement->stHit));
if (_p_hSprObjHit && p_stGeomObj->d_xListOfElementsTypes[p_stDataOfElement->xElements] == GEO_C_xElementSpheres)
{
MTH3D_tdstVector stSphereCenter;
/* Get the sphere element*/
GEO_tdstElementSpheres * p_stElementSpheres = (GEO_tdstElementSpheres *) p_stGeomObj->d_stListOfElements[p_stDataOfElement->xElements];
/* The normal is the vector from the center of the sphere to the hit point (in the global axis)*/
POS_fn_vMulMatrixVertex (& stSphereCenter,
HIE_fn_hGetSuperObjectGlobalMatrix(* _p_hSprObjHit),
& p_stGeomObj->d_stListOfPoints[p_stElementSpheres->d_stListOfSpheres[p_stDataOfElement->xIndexOfFace].xCenterPoint]);
MTH3D_M_vSubVector (_p_stNormal, _p_stHit, & stSphereCenter);
MTH3D_M_vNormalizeVector (_p_stNormal, _p_stNormal);
}
else
{
GEO_vGetNormalOfGeometricObjectElement(p_stGeomObj,p_stDataOfElement->xElements,p_stDataOfElement->xIndexOfFace,&stNormal);
POS_fn_vMulMatrixVector(_p_stNormal, HIE_fn_hGetSuperObjectGlobalMatrix(* _p_hSprObjHit), &stNormal);
/* don't forget to normalize in case the target had scale... */
MTH3D_M_vNormalizeVector (_p_stNormal, _p_stNormal);
}
return TRUE;
}
else
{
return FALSE;
}
}
/*
******************************************************************************************************
******************************************************************************************************
******************************************************************************************************
******************************************************************************************************
*/
/*
*=================================================================================================
* Picking function for camera.
*=================================================================================================
*/
/* used*/
ACP_tdxBool HIE_bDetectIntersectSegmentWithSuperObject
(
MTH3D_tdstVector *p_stVertexA,
MTH3D_tdstVector *p_stVectAB,
HIE_tdxHandleToSuperObject _hSprObj
)
{
static GEO_tdxHandleToBoundingSphere hBoundingSphere;
static GEO_tdxHandleToParallelBox hParallelBox;
static MTH3D_tdstVector stMinPoint;
static MTH3D_tdstVector stMaxPoint;
static MTH3D_tdstVector *p_stTranslation;
static ACP_tdxBool bBoxBoundingVolume,bIntersect;
static ACP_tdxHandleOfObject hSentObject;
ACP_tdxIndex i;
HIE_tdxHandleToSuperObject hChild;
static long lType;
/* XB 05/05/99 */
/* static MTH3D_tdstVector stVertexALocal, stVertexBLocal, stVectAB; */
static MTH3D_tdstVector stVertexALocal, stVectAB;
/* End XB 05/05/99 */
static POS_tdstCompletePosition stInvMatrix;
hBoundingSphere = NULL;
hParallelBox = NULL;
hSentObject = NULL;
p_stTranslation = &_hSprObj->hGlobalMatrix->stTranslationVector;
bBoxBoundingVolume = HIE_fn_SO_bHasABoxBoundingVolume(_hSprObj);
if(bBoxBoundingVolume)
{
hParallelBox = (GEO_tdxHandleToParallelBox)HIE_fn_hGetSuperObjectBoundingVolume(_hSprObj);
if (hParallelBox)
{
MTH3D_tdstVector *p_stMinPoint;
MTH3D_tdstVector *p_stMaxPoint;
/* get the min and max points in world coordinates*/
p_stMinPoint = GEO_fn_pGetMinPointOfParallelBox(hParallelBox);
p_stMaxPoint = GEO_fn_pGetMaxPointOfParallelBox(hParallelBox);
MTH3D_M_vAddVector(&stMinPoint, p_stMinPoint , p_stTranslation);
MTH3D_M_vAddVector(&stMaxPoint, p_stMaxPoint , p_stTranslation);
}
}
else
{
/* get the bounding sphere*/
hBoundingSphere = (GEO_tdxHandleToBoundingSphere)HIE_fn_hGetSuperObjectBoundingVolume(_hSprObj);
}
/* test intersection*/
if (!hBoundingSphere && !hParallelBox)
{
/* if there are no bounding volume at all (no box nor sphere) --> go further*/
bIntersect = TRUE;
}
else if (!bBoxBoundingVolume)
{
/* if there is a BV Sphere, seek an intersect between the sphere and the axe*/
bIntersect = fn_bDetectIntersectSegmentWithBoundingSphere(HIE_fn_hGetSuperObjectGlobalMatrix(_hSprObj), p_stVertexA, p_stVectAB, hBoundingSphere);
}
else
{
/*if there is a BV Box, seek an intersect between the box and the axe */
bIntersect = INT_fn_bDetectIntersectSegmentWithBox(p_stVertexA, p_stVectAB, &stMinPoint, &stMaxPoint,NULL);
}
if(bIntersect)
{
lType = HIE_fn_ulGetSuperObjectType(_hSprObj);
#ifndef U64 /* no editor objects on u64*/
if( lType & (HIE_C_ulEDT_Geometric | HIE_C_ulMirror ))
{
hSentObject = (ACP_tdxHandleOfObject)HIE_fn_hGetSuperObjectObject(_hSprObj);
}
else
#endif
if( lType & (HIE_C_ulPO | HIE_C_ulPO_Mirror))
{
hSentObject = M_hGetRepositionZoneFromPo((PO_tdxHandleToPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj));
}
#ifndef D_THROW_IPO
else if( lType & (HIE_C_ulIPO | HIE_C_ulIPO_Mirror))
{
hSentObject = M_hGetRepositionZoneFromPo(IPO_fn_hGetPhysicalObject((IPO_tdxHandleToInstanciatedPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj)));
}
#endif /* D_THROW_IPO */
else if (lType == HIE_C_ulActor)
{
hSentObject = fn_hMakeOneObjectFromManyZdx(C_ucTypeZdr,_hSprObj);
}
if (hSentObject)
{
/*Convertion local coordinate system.*/
if (HIE_fn_SO_bHasNoTransformationMatrix (_hSprObj))
{
/* Only translation, compute A i local*/
MTH3D_M_vSubVector (&stVertexALocal , p_stVertexA , p_stTranslation);
/* and nothing for the vector AB...*/
MTH3D_M_vCopyVector(&stVectAB,p_stVectAB);
}
else
{
POS_fn_vInvertMatrix(&stInvMatrix,_hSprObj->hGlobalMatrix);
/* compute A in local coordinates*/
POS_fn_vMulMatrixVertex(&stVertexALocal,&stInvMatrix, p_stVertexA);
/* compute AB in local coordinates*/
POS_fn_vMulMatrixVector(&stVectAB, &stInvMatrix, p_stVectAB);
}
/*
* Intersection test.
*/
if( INT_fn_bDetectIntersectSegmentWithFaceOfGeometricObject(&stVertexALocal, &stVectAB, hSentObject))
{
return TRUE;
}
}
}
if (bIntersect || HIE_fn_SO_bCheckChildren(_hSprObj))
{
/* keep going on the sons of this SO, only if they are not actors */
HIE_M_ForEachChildOf(_hSprObj, hChild, i)
{
if( (HIE_fn_ulGetSuperObjectType(hChild) != HIE_C_ulActor) &&
(HIE_bDetectIntersectSegmentWithSuperObject(p_stVertexA,p_stVectAB,hChild))
)
{
return TRUE;
}
}
}
return FALSE;
}
/*
*=================================================================================================
*=================================================================================================
*/

View File

@@ -0,0 +1,548 @@
/* (c) Ubi Studios 1996*/
/* See Vincent Greco for any comment or question*/
#include "ACP_base.h"
#include "GEO.h"
#include "GLI.h"
#include "LST.h"
#include "SPO/HieMtStk.h"
#include "SPO/HieConst.h" /*constants*/
#define __HIE_GLOBALS
#include "SPO/HieSpObj.h" /*structures and access macros*/
#include "SPO/HieHand.h" /*handle definitions*/
#include "SPO/HieExt.h"
#include "SPO/HieDef.h" /*macros for the macros ...*/
extern HIE_tdxHandleToSuperObject gd_hFixSPO[HIE_C_MaxNumberOfSPOInTheFix] ;
extern HIE_tdxHandleToSuperObject gd_hFixSPOSave[HIE_C_MaxNumberOfSPOInTheFix] ;
extern ACP_tdxIndex g_xFixIndex;
extern ACP_tdxIndex g_xFixIndexSave;
unsigned char gd_ucContextOfSPOSave[HIE_C_MaxNumberOfSPOInTheFix] ;
unsigned char g_ucContext = 0 ;
/*function accessors definition*/
ACP_tdxBool HIE_fn_bIsSuperObjectValid(HIE_tdxHandleToSuperObject hSuperObject)
{
return (hSuperObject)!=HIE_C_InvalidSuperObject;
}
void HIE_fn_vSetSuperObjectObjectAndType(HIE_tdxHandleToSuperObject _hSprObj, HIE_tdxHandleToVoid _hObj, unsigned long _ulType)
{
if(_hObj==NULL)
_ulType=HIE_C_ulSuperObject;/* if the linked object does not exist do not try to process it*/
HIE_M_vSetSuperObjectMember(_hSprObj, ulTypeOfLinkedObject, _ulType);
HIE_M_vSetSuperObjectMember(_hSprObj, hLinkedObject.p_Void, _hObj);
}
/*****************************************************************************************************
* superimposed
*****************************************************************************************************/
void SPO_ReinitSuperimposedArray(void) {
ACP_tdxIndex xIndex ;
for ( xIndex = 0 ; xIndex < g_xFixIndex ; xIndex ++ ) {
gd_hFixSPO[xIndex]->ulFlags &= ~(HIE_C_Flag_ulSuperimposed | HIE_C_Flag_ulNotPickable );
}
g_xFixIndex = 0 ;
g_ucContext = 0 ;
g_xFixIndexSave = 0 ;
}
HIE_tdxHandleToSuperObject HIE_fn_hGetElementFormFixViewport ( ACP_tdxIndex xIndex ) {
if ( xIndex < g_xFixIndex ) {
return ( gd_hFixSPO[xIndex] ) ;
}
else
return NULL ;
}
void HIE_fn_SO_vSetSuperimposedFlag (HIE_tdxHandleToSuperObject _hSO)
{
if ( (_hSO->ulFlags & HIE_C_Flag_ulSuperimposed ) == HIE_C_Flag_ulSuperimposed )
return ;
/*
* set the flag for this SPO
*/
_hSO->ulFlags |= (HIE_C_Flag_ulSuperimposed | HIE_C_Flag_ulNotPickable );
/*
* register the SPO
*/
if ( g_xFixIndex < HIE_C_MaxNumberOfSPOInTheFix ) {
gd_hFixSPO[g_xFixIndex] = _hSO ;
g_xFixIndex ++ ;
}
}
void HIE_fn_SO_vClearSuperimposedFlag(HIE_tdxHandleToSuperObject _hSO)
{
ACP_tdxIndex xIndex;
if ( (_hSO->ulFlags & HIE_C_Flag_ulSuperimposed ) != HIE_C_Flag_ulSuperimposed )
return ;
/*
* clear the flag for this SPO
*/
_hSO->ulFlags &= ~(HIE_C_Flag_ulSuperimposed | HIE_C_Flag_ulNotPickable );
if (g_xFixIndex == 0)
return;
/*
* unregister the SPO
*/
for ( xIndex = 0; xIndex < HIE_C_MaxNumberOfSPOInTheFix; xIndex ++ )
{
if ( gd_hFixSPO[xIndex] == _hSO ) /* scan until we find it*/
{
/* fill the gap by moving the last SO in the array into the hole we just create*/
g_xFixIndex --;
if (g_xFixIndex != 0)
gd_hFixSPO[xIndex] = gd_hFixSPO[g_xFixIndex];
gd_hFixSPO[g_xFixIndex] = NULL;
break;
}
}
}
/*AR9902 Bug corrected : must test gd_ucContextOfSPOSave[g_xFixIndexSave-1] instead of gd_ucContextOfSPOSave[g_xFixIndexSave]*/
void HIE_fn_SO_SwitchSuperImposedTab (long lParam)
{
int i ;
if ( lParam )
{
/* lparam = 1 -> show menu */
if ( g_xFixIndex )
{
for ( i=0 ; i<g_xFixIndex ; i++ )
{
gd_hFixSPOSave[g_xFixIndexSave++] = gd_hFixSPO[i] ;
gd_ucContextOfSPOSave[i] = g_ucContext ;
}
g_xFixIndex = 0 ;
}
g_ucContext ++ ;
}
else
{
/* lparam = 0 -> show normal fix viewport */
unsigned char fn_ucStdGameCheckValidity(HIE_tdxHandleToSuperObject _h_SprObj) ;
g_ucContext -- ;
if ( g_xFixIndexSave )
{
g_xFixIndex = 0 ;
for ( ; (g_xFixIndexSave>0) && (gd_ucContextOfSPOSave[g_xFixIndexSave-1] == g_ucContext) ; g_xFixIndexSave-- )
{
if ( fn_ucStdGameCheckValidity(gd_hFixSPOSave[g_xFixIndexSave-1]))
{
gd_hFixSPO[g_xFixIndex++] = gd_hFixSPOSave[g_xFixIndexSave-1] ;
}
}
}
}
}
/******************************************************************************************************/
void HIE_fn_vSetSuperObjectExcluLight(HIE_tdxHandleToSuperObject _hSprObj,unsigned char _bExcluLight)
{
if( _bExcluLight )
_hSprObj->ulFlags |= HIE_C_Flag_ExcluLight;
else
_hSprObj->ulFlags &= ~HIE_C_Flag_ExcluLight;
}
/*---------------------------------------------------------------*/
/*for Francois DO NOT USE THESEe FUNCTIONS*/
void HIE_fn_vIsolate(HIE_tdxHandleToSuperObject _hSprObj)
{
HIE_M_vIsolate(_hSprObj);
}
/*---------------------------------------------------------------*/
void HIE_fn_vPseudoIsolate(HIE_tdxHandleToSuperObject _hSprObj)
{
HIE_tdxHandleToSuperObject hNext;
hNext = LST2_M_DynamicGetNextElement(_hSprObj);
HIE_M_vIsolate(_hSprObj);
LST2_M_DynamicSetNextElement(_hSprObj,hNext);
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void HIE_fn_vInitParent(HIE_tdxHandleToSuperObject _hSprObj)
{
LST2_M_DynamicInitAnchor(_hSprObj);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*--------------------------------------------------------------------------------------*/
/* Name : HIE_fn_vGetParallelBoxFromBoundingVolume*/
/* Author : Thierry QUERE*/
/* Date : 16/02/98*/
/* Description :*/
/* Optimized ? : No*/
/*--------------------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void HIE_fn_vGetParallelBoxFromBoundingVolume(MTH3D_tdstVector * _p_stMaxBoxPoint,
MTH3D_tdstVector * _p_stMinBoxPoint,
ACP_tdxHandleOfObject _hBoundingVolume)
{
_p_stMaxBoxPoint = GEO_fn_pGetMaxPointOfParallelBox ((GEO_tdstParallelBox*) _hBoundingVolume);
_p_stMinBoxPoint = GEO_fn_pGetMinPointOfParallelBox ((GEO_tdstParallelBox*) _hBoundingVolume);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
HIE_tdxHandleToSuperObject HIE_fn_hCreateSuperObject(void)
{
HIE_tdxHandleToSuperObject hNewSuperObject;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeSuperObject , MMG_C_lSubTypeSuperObject , 0 );
GEO_M_CPAMalloc( hNewSuperObject,
HIE_tdxHandleToSuperObject,
sizeof(struct HIE_tdstSuperObject_),
E_uwGEONotEnoughtMemory);
LST2_M_DynamicInitAnchor(hNewSuperObject);
LST2_M_DynamicInitElement(hNewSuperObject);
HIE_fn_vSetSuperObjectObjectAndType(hNewSuperObject,NULL,HIE_C_ulSuperObject);
HIE_fn_vSetSuperObjectBoundingVolume(hNewSuperObject, NULL);
HIE_fn_vSetSuperObjectDrawMask(hNewSuperObject, GLI_C_lAllIsEnable/*&(~GLI_C_lIsNotDrawCollideInformation)*/);
HIE_M_vSetSuperObjectMember(hNewSuperObject,hGlobalMatrix,GEO_fn_hCreateMatrix());
POS_fn_vSetIdentityMatrix(HIE_M_xGetSuperObjectMember(hNewSuperObject,hGlobalMatrix));
HIE_fn_vInvalidateOneGlobalMatrix(hNewSuperObject);
HIE_M_vSetSuperObjectMember( hNewSuperObject,fTransparenceLevel,255.0f );
HIE_fn_vSetSuperObjectExcluLight ( hNewSuperObject,0);
return hNewSuperObject;
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void HIE_fn_vCopySuperObject(HIE_tdxHandleToSuperObject _hDst,HIE_tdxHandleToSuperObject _hSrc)
{
HIE_fn_vSetSuperObjectObjectAndType
(_hDst,
HIE_fn_hGetSuperObjectObject(_hSrc),
HIE_fn_ulGetSuperObjectType(_hSrc));
HIE_fn_vSetSuperObjectDrawMask(_hDst, HIE_fn_lGetSuperObjectDrawMask(_hSrc));
HIE_fn_vSetSuperObjectMatrix(_hDst, HIE_fn_hGetSuperObjectMatrix(_hSrc));
GEO_M_vCopyMatrix(HIE_fn_hGetSuperObjectGlobalMatrix(_hDst),HIE_fn_hGetSuperObjectGlobalMatrix(_hSrc));
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_
HIE_tdxHandleToSuperObject HIE_fn_hDuplicateSuperObject(HIE_tdxHandleToSuperObject _hSuperObject)
{
HIE_tdxHandleToSuperObject hNewSuperObject;
hNewSuperObject=HIE_fn_hCreateSuperObject();
HIE_fn_vCopySuperObject(hNewSuperObject,_hSuperObject);
return hNewSuperObject;
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void HIE_fn_vDestroySuperObject(HIE_tdxHandleToSuperObject hOldSuperObject)
{
GEO_fn_vDestroyMatrix(HIE_M_xGetSuperObjectMember(hOldSuperObject,hGlobalMatrix));
GEO_M_CPAFree(hOldSuperObject);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*!!! no DestroySuperObjectTab !*/
HIE_tdxHandleToSuperObjectTab HIE_fn_p_stCreateSuperObjectTab(long lSize)
{
struct HIE_tdstSuperObject_* hNewSuperObjectTab;
struct HIE_tdstSuperObject_* hNewSuperObject;
long lIndex;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeSuperObject , MMG_C_lSubTypeSuperObjectTable , 0 );
GEO_M_CPAMalloc(hNewSuperObjectTab, HIE_tdxHandleToSuperObject, sizeof(struct HIE_tdstSuperObject_)*lSize, E_uwGEONotEnoughtMemory);
for(hNewSuperObject=hNewSuperObjectTab,lIndex=0;lIndex<lSize;hNewSuperObject++,lIndex++)
{
LST2_M_DynamicInitAnchor(hNewSuperObject);
LST2_M_DynamicInitElement(hNewSuperObject);
HIE_fn_vSetSuperObjectObjectAndType(hNewSuperObject,NULL,0);
HIE_fn_vSetSuperObjectBoundingVolume(hNewSuperObject, NULL);
HIE_fn_vSetSuperObjectDrawMask(hNewSuperObject, GLI_C_lAllIsEnable);
HIE_M_vSetSuperObjectMember(hNewSuperObject,hGlobalMatrix,GEO_fn_hCreateMatrix());
POS_fn_vSetIdentityMatrix(HIE_M_xGetSuperObjectMember(hNewSuperObject,hGlobalMatrix));
HIE_fn_vInvalidateOneGlobalMatrix(hNewSuperObject);
HIE_M_vSetSuperObjectMember( hNewSuperObject,fTransparenceLevel,255.0f );
HIE_fn_vSetSuperObjectExcluLight( hNewSuperObject,0);
}
return hNewSuperObjectTab;
}
HIE_tdxHandleToSuperObject HIE_fn_hForceGetSuperObjectNextBrother(HIE_tdxHandleToSuperObject _hSprObj)
{
if(HIE_fn_bIsSuperObjectValid(_hSprObj))
return HIE_M_hNextChild(_hSprObj);
else
return _hSprObj;/*i.e. Invalid*/
}
HIE_tdxHandleToSuperObject HIE_fn_hForceGetSuperObjectPrevBrother(HIE_tdxHandleToSuperObject _hSprObj)
{
if(HIE_fn_bIsSuperObjectValid(_hSprObj))
return HIE_M_hPrevChild(_hSprObj);
else
return _hSprObj;/*i.e. Invalid*/
}
HIE_tdxHandleToSuperObject HIE_fn_hGetChildNumber(HIE_tdxHandleToSuperObject _hParent, long _lNumber)
{
HIE_tdxHandleToSuperObject hChild;
ACP_tdxIndex i;
LST2_M_DynamicGetElementNumber(_hParent, hChild, _lNumber, i);
return hChild;
}
#ifndef _FIRE_DEADCODE_U64_
long HIE_fn_lGetNumberOfElement(HIE_tdxHandleToSuperObject _hParent, HIE_tdxHandleToSuperObject _hChild)
{
long lResult;
HIE_tdxHandleToSuperObject hChild;
LST2_M_DynamicWhatElementNumber(_hChild, hChild, lResult);
return lResult;
}
#endif /* _FIRE_DEADCODE_U64_ */
void HIE_fn_vInvalidateAllGlobalMatrices(void)
{
HIE_gs_lCurrentFrame++; /*macro when optimized ?*/
if(HIE_gs_lCurrentFrame==HIE_C_lCounterNotValid) HIE_gs_lCurrentFrame++;
}
void HIE_fn_vInvalidateOneGlobalMatrix(HIE_tdxHandleToSuperObject _hSprObj)
{
if (HIE_M_xGetSuperObjectMember(_hSprObj,lLastComputeFrame) == HIE_C_lCounterNotValid)
{
/* assert(0);*/
return;
}
if(HIE_gs_lCurrentFrame!=HIE_C_lCounterNotValid+1)
{
HIE_M_vSetSuperObjectMember(_hSprObj,lLastComputeFrame, HIE_gs_lCurrentFrame-1);
}
else
{
HIE_M_vSetSuperObjectMember(_hSprObj,lLastComputeFrame, HIE_gs_lCurrentFrame-2);
}
}
void HIE_fn_vSetSuperObjectStaticMatrix(HIE_tdxHandleToSuperObject _hSprObj, GEO_tdxHandleToMatrix _hMatrix)
{
GEO_M_vCopyMatrix(HIE_M_xGetSuperObjectMember(_hSprObj,hGlobalMatrix), _hMatrix);
HIE_M_vSetSuperObjectMember(_hSprObj,lLastComputeFrame, HIE_C_lCounterNotValid);
}
void HIE_fn_vInitGlobalMatrixFrameCounter(long lValue)
{
if(lValue!=HIE_C_lCounterNotValid)
HIE_gs_lCurrentFrame=lValue;
else
HIE_gs_lCurrentFrame=lValue+1;
}
void HIE_fn_vPushMatrix( HIE_tdxHandleToSuperObject _hSprObj )
{
if(HIE_fn_bIsGlobalMatrixValid(_hSprObj))
{
HIE_fn_bStoreMatrix( HIE_M_xGetSuperObjectMember(_hSprObj,hGlobalMatrix) );
}
else
{
POS_fn_vMulMatrixMatrix(
HIE_M_xGetSuperObjectMember(_hSprObj,hGlobalMatrix),
HIE_g_a_hMatrixStack[HIE_g_lNbMatrixInStack-1],
HIE_M_xGetSuperObjectMember(_hSprObj,hLocalMatrix) );
HIE_fn_bStoreMatrix( HIE_M_xGetSuperObjectMember(_hSprObj,hGlobalMatrix) );
HIE_fn_vValidateGlobalMatrix(_hSprObj);
}
}
void HIE_fn_vPopMatrix (void)
{
HIE_fn_bPopMatrix ();
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
void HIE_fn_vStoreOnCameraMatrixStack(HIE_tdxHandleToSuperObject _hSprObj)
{
HIE_fn_bStoreOnCameraMatrixStack (HIE_M_xGetSuperObjectMember(_hSprObj,hGlobalMatrix));
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
void HIE_fn_vPushOnCameraMatrixStack(HIE_tdxHandleToSuperObject _hSprObj)
{
HIE_fn_bPushOnCameraMatrixStack (HIE_M_xGetSuperObjectMember(_hSprObj,hLocalMatrix));
}
void HIE_fn_vPopOnCameraMatrixStack()
{
HIE_fn_bPopOnCameraMatrixStack ();
}
/* compute the relative matrix of the SO, without changing the absolute one */
void HIE_fn_vComputeNewRelativeMatrix(HIE_tdxHandleToSuperObject _hSprObj)
{
POS_tdstCompletePosition stLocalMatrix;
POS_fn_vInvertMatrix(&stLocalMatrix, HIE_M_xGetSuperObjectMember(HIE_M_hGetSuperObjectFather(_hSprObj),hGlobalMatrix));
POS_fn_vMulMatrixMatrix(HIE_M_xGetSuperObjectMember(_hSprObj, hLocalMatrix), &stLocalMatrix, HIE_M_xGetSuperObjectMember(_hSprObj, hGlobalMatrix));
}
void HIE_fn_vComputeNewRelativeScaleMatrix(HIE_tdxHandleToSuperObject _hSprObj)
{
/* GEO_tdxHandleToMatrix hMatrix;
POS_tdstCompletePosition LocalMatrix;
hMatrix=&LocalMatrix;
POS_fn_vSetIdentityMatrix(hMatrix);
POS_fn_vInvertMatrix(hMatrix, HIE_M_xGetSuperObjectMember(HIE_M_hGetSuperObjectFather(_hSprObj),hGlobalMatrix));
POS_fn_vMulMatrixMatrix(HIE_M_xGetSuperObjectMember(_hSprObj, hLocalMatrix), hMatrix, HIE_M_xGetSuperObjectMember(_hSprObj, hGlobalMatrix));
*/
HIE_fn_vComputeNewRelativeMatrix (_hSprObj);
}
/* the SO will be the last child of its new father */
void HIE_fn_vChangeFather(HIE_tdxHandleToSuperObject _hSprObj, HIE_tdxHandleToSuperObject _hNewFather, ACP_tdxBool _bAtHead)
{
HIE_M_vIsolate(_hSprObj);
if ( _bAtHead )
{
HIE_fn_vSuperObjectAddHead(_hNewFather, _hSprObj);
}
else
{
HIE_fn_vSuperObjectAddTail(_hNewFather, _hSprObj);
}
HIE_fn_vComputeNewRelativeScaleMatrix(_hSprObj);
}
#ifndef _FIRE_DEADCODE_U64_
/* the SO will be the next brother of its new brother */
void HIE_fn_vChangeBrother(HIE_tdxHandleToSuperObject _hSprObj, HIE_tdxHandleToSuperObject _hNewPrevBrother)
{
HIE_M_vIsolate(_hSprObj);
HIE_M_vInsertBetween(_hSprObj, _hNewPrevBrother, HIE_M_hNextChild(_hNewPrevBrother));
HIE_fn_vComputeNewRelativeScaleMatrix(_hSprObj);
}
#endif /* _FIRE_DEADCODE_U64_ */
/*Be careful : this is a recursive function !!!*/
/* If a global matrix is invalid, it is recomputed from the local matrix*/
/* you can use HIE_fn_vInvalidaeAllGlobalMatrices() before this function*/
/* to force all the global matrices to be recomputed*/
void HIE_fn_vRefreshHierarchy(HIE_tdxHandleToSuperObject _hSprObj)
{
ACP_tdxIndex i;
HIE_tdxHandleToSuperObject hChild;
HIE_fn_vPushMatrix (_hSprObj);
HIE_M_ForEachChildOf(_hSprObj, hChild, i)
HIE_fn_vRefreshHierarchy(hChild);
HIE_fn_vPopMatrix ();
}
void HIE_fn_vInvalidateHierarchy(HIE_tdxHandleToSuperObject _hSprObj)
{
ACP_tdxIndex i;
HIE_tdxHandleToSuperObject hChild;
HIE_fn_vInvalidateOneGlobalMatrix(_hSprObj);
HIE_M_ForEachChildOf(_hSprObj, hChild, i)
HIE_fn_vInvalidateHierarchy(hChild);
}
#define HIE_M_hNextChild(_hBrother) LST2_M_DynamicGetNextElement(_hBrother)
#define HIE_M_hFirstChild(_hParent) LST2_M_DynamicGetFirstElement(_hParent)
#define HIE_M_hPrevChild(_hBrother) LST2_M_DynamicGetPrevElement(_hBrother)
#define HIE_M_hLastChild(_hParent) LST2_M_DynamicGetLastElement(_hParent)
#define HIE_M_hGetSuperObjectFather(_hSprObj) LST2_M_DynamicGetFather(_hSprObj)
/*for binarisation only : DO NOT use these functions (too low level)*/
#ifndef _FIRE_DEADCODE_U64_
HIE_tdxHandleToSuperObject HIE_fn_hGetSuperObjectPrevBrother(HIE_tdxHandleToSuperObject _hSprObj)
{
return HIE_M_hPrevChild(_hSprObj);
}
HIE_tdxHandleToSuperObject HIE_fn_hGetSuperObjectLastChild(HIE_tdxHandleToSuperObject _hSprObj)
{
return HIE_M_hLastChild(_hSprObj);
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_
void HIE_fn_vSetSuperObjectLastChild(HIE_tdxHandleToSuperObject _hSprObj,HIE_tdxHandleToSuperObject _hChild)
{
HIE_M_hLastChild(_hSprObj)=_hChild;
}
void HIE_fn_vSetSuperObjectNextBrother(HIE_tdxHandleToSuperObject _hSprObj,HIE_tdxHandleToSuperObject _hBrother)
{
HIE_M_hNextChild(_hSprObj)=_hBrother;
}
void HIE_fn_vSetSuperObjectPrevBrother(HIE_tdxHandleToSuperObject _hSprObj,HIE_tdxHandleToSuperObject _hBrother)
{
HIE_M_hPrevChild(_hSprObj)=_hBrother;
}
void HIE_fn_vSetSuperObjectFather(HIE_tdxHandleToSuperObject _hSprObj,HIE_tdxHandleToSuperObject _hFather)
{
HIE_M_hGetSuperObjectFather(_hSprObj)=_hFather;
}
#endif /* _FIRE_DEADCODE_U64_ */
/* LOL*/
#ifndef _FIRE_DEADCODE_U64_
/* ANNECY MT 06/03/98 {*/
void HIE_fn_vSetMagnetModification(HIE_tdxHandleToSuperObject _hSprObj, ACP_tdxBool xModified)
{
if( xModified )
_hSprObj->ulFlags |= HIE_C_Flag_MagnetModification;
else
_hSprObj->ulFlags &= ~HIE_C_Flag_MagnetModification;
}
ACP_tdxBool HIE_fn_bGetMagnetModification(HIE_tdxHandleToSuperObject _hSprObj)
{
return ((_hSprObj->ulFlags & HIE_C_Flag_MagnetModification) ? TRUE : FALSE);
}
/* END ANNECY MT }*/
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
MTH3D_tdstVector *HIE_fn_xGetSemiLookAtVector (HIE_tdxHandleToSuperObject _hSprObj) {
return ((MTH3D_tdstVector *)&(HIE_M_xGetSuperObjectMember(_hSprObj, stSemiLookAtVector))) ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */

View File

@@ -0,0 +1,227 @@
# Microsoft Developer Studio Project File - Name="SPO" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=SPO - Win32 Debug with Editors
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "SPO.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "SPO.mak" CFG="SPO - Win32 Debug with Editors"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "SPO - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "SPO - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "SPO - Win32 Debug with Editors" (based on\
"Win32 (x86) Static Library")
!MESSAGE "SPO - Win32 Retail" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/SPO", ROEAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
!IF "$(CFG)" == "SPO - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "Tmp\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /W3 /GX /Z7 /O2 /I "x:\CPA\Public" /D "NDEBUG" /D "USE_PROFILER" /D "USE_IPT_DX5" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"X:\CPA\Lib\SPOP5_vr.lib"
!ELSEIF "$(CFG)" == "SPO - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\Cpa\Lib"
# PROP Intermediate_Dir "Tmp\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /W3 /GX /Z7 /Od /I "x:\CPA\Public" /I "t:\dxsdk\sdk\inc" /D "_DEBUG" /D "USE_PROFILER" /D "MTH_CHECK" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"x:\Cpa\Lib\SPOP5_vd.lib"
!ELSEIF "$(CFG)" == "SPO - Win32 Debug with Editors"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "SPO___Wi"
# PROP BASE Intermediate_Dir "SPO___Wi"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\Cpa\Lib"
# PROP Intermediate_Dir "Tmp\DebgEd"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /MD /W3 /GX /Z7 /Od /I "x:\CPA\Public" /I "t:\dxsdk\sdk\inc" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "CPA_WANTS_EXPORT" /D "VISUAL" /D "USE_ALTIMAPS" /D "USE_PROFILER" /FD /c
# SUBTRACT BASE CPP /Fr /YX
# ADD CPP /nologo /G5 /W3 /GX /Z7 /Od /I "x:\CPA\Public" /I "t:\dxsdk\sdk\inc" /D "_DEBUG" /D "USE_PROFILER" /D "MTH_CHECK" /D "ACTIVE_EDITOR" /D "CPA_WANTS_EXPORT" /D "USE_IPT_DX5" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"x:\Cpa\Lib\SPOP5_vd.lib"
# ADD LIB32 /nologo /out:"x:\Cpa\Lib\SPOP5Evd.lib"
!ELSEIF "$(CFG)" == "SPO - Win32 Retail"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "SPO___Wi"
# PROP BASE Intermediate_Dir "SPO___Wi"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:/cpa/lib"
# PROP Intermediate_Dir "tmp/retail"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /MD /W3 /GX /O2 /I "x:\CPA\Public" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "CPA_WANTS_EXPORT" /D "VISUAL" /FD /c
# SUBTRACT BASE CPP /Fr /YX
# ADD CPP /nologo /G5 /W3 /GX /O2 /I "x:\CPA\Public" /D "NDEBUG" /D "RETAIL" /D "USE_IPT_DX5" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"X:\CPA\Lib\SPOP5_vr.lib"
# ADD LIB32 /nologo /out:"X:\CPA\Lib\SPOP5_vf.lib"
!ENDIF
# Begin Target
# Name "SPO - Win32 Release"
# Name "SPO - Win32 Debug"
# Name "SPO - Win32 Debug with Editors"
# Name "SPO - Win32 Retail"
# Begin Group "Src"
# PROP Default_Filter "*.c*"
# Begin Source File
SOURCE=.\HieBdVol.c
# End Source File
# Begin Source File
SOURCE=.\HieDraw.c
# End Source File
# Begin Source File
SOURCE=.\Specif\HieLoad.c
# End Source File
# Begin Source File
SOURCE=.\HieMtStk.c
# End Source File
# Begin Source File
SOURCE=.\Specif\HiePcDrw.c
# End Source File
# Begin Source File
SOURCE=.\HiePick.c
# End Source File
# Begin Source File
SOURCE=.\HieSpObj.c
# End Source File
# End Group
# Begin Group "Inc"
# PROP Default_Filter "*.h*"
# Begin Source File
SOURCE=..\..\public\SPO\HieBdVol.h
# End Source File
# Begin Source File
SOURCE=..\..\public\SPO\HieConst.h
# End Source File
# Begin Source File
SOURCE=..\..\public\SPO\HieDef.h
# End Source File
# Begin Source File
SOURCE=..\..\public\SPO\HieDraw.h
# End Source File
# Begin Source File
SOURCE=.\HieDrw.h
# End Source File
# Begin Source File
SOURCE=..\..\public\SPO\HieExt.h
# End Source File
# Begin Source File
SOURCE=..\..\public\SPO\HieHand.h
# End Source File
# Begin Source File
SOURCE=..\..\public\SPO\Specif\HieLoad.h
# End Source File
# Begin Source File
SOURCE=..\..\public\SPO\HieMacro.h
# End Source File
# Begin Source File
SOURCE=..\..\public\SPO\HieMtStk.h
# End Source File
# Begin Source File
SOURCE=..\..\public\SPO\HiePick.h
# End Source File
# Begin Source File
SOURCE=..\..\public\SPO\HieSpObj.h
# End Source File
# Begin Source File
SOURCE=..\..\Public\incspo.h
# End Source File
# Begin Source File
SOURCE=..\..\public\SPO.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\SPO.mak
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,518 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="SPO"
ProjectGUID="{ED11AC4C-5509-4FC3-8038-84EA139C76A8}"
SccProjectName="&quot;$/cpa/tempgrp/SPO&quot;, ROEAAAAA"
SccAuxPath=""
SccLocalPath="."
SccProvider="MSSCCI:NXN alienbrain">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Retail|Win32"
OutputDirectory="x:/cpa/lib"
IntermediateDirectory=".\tmp/retail"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="x:\CPA\Public"
PreprocessorDefinitions="NDEBUG;RETAIL;USE_IPT_DX5;VISUAL;WIN32"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\tmp/retail/SPO.pch"
AssemblerListingLocation=".\tmp/retail/"
ObjectFile=".\tmp/retail/"
ProgramDataBaseFileName=".\tmp/retail/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Lib\SPOP5_vf.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="x:\cpa\lib"
IntermediateDirectory=".\Tmp\Release"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="x:\CPA\Public"
PreprocessorDefinitions="NDEBUG;USE_PROFILER;USE_IPT_DX5;VISUAL;WIN32"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
PrecompiledHeaderFile=".\Tmp\Release/SPO.pch"
AssemblerListingLocation=".\Tmp\Release/"
ObjectFile=".\Tmp\Release/"
ProgramDataBaseFileName=".\Tmp\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="X:\CPA\Lib\SPOP5_vr.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory="x:\Cpa\Libd"
IntermediateDirectory=".\Tmp\Debug"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="x:\CPA\Public,t:\dxsdk\sdk\inc"
PreprocessorDefinitions="_DEBUG;USE_PROFILER;MTH_CHECK;VISUAL;WIN32"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Tmp\Debug/SPO.pch"
AssemblerListingLocation=".\Tmp\Debug/"
ObjectFile=".\Tmp\Debug/"
ProgramDataBaseFileName=".\Tmp\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="x:\Cpa\Libd\SPOP5_vd.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug with Editors|Win32"
OutputDirectory="x:\Cpa\Libd"
IntermediateDirectory=".\Tmp\DebgEd"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
OptimizeForProcessor="1"
AdditionalIncludeDirectories="x:\CPA\Public,t:\dxsdk\sdk\inc"
PreprocessorDefinitions="_DEBUG;USE_PROFILER;MTH_CHECK;ACTIVE_EDITOR;CPA_WANTS_EXPORT;VISUAL;WIN32"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Tmp\DebgEd/SPO.pch"
AssemblerListingLocation=".\Tmp\DebgEd/"
ObjectFile=".\Tmp\DebgEd/"
ProgramDataBaseFileName=".\Tmp\DebgEd/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="1"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="x:\Cpa\Libd\SPOP5Evd.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Src"
Filter="*.c*">
<File
RelativePath="HieBdVol.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="HieDraw.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="Specif\HieLoad.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="HieMtStk.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="Specif\HiePcDrw.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="HiePick.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="HieSpObj.c">
<FileConfiguration
Name="Retail|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug with Editors|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Inc"
Filter="*.h*">
<File
RelativePath="..\..\public\SPO\HieBdVol.h">
</File>
<File
RelativePath="..\..\public\SPO\HieConst.h">
</File>
<File
RelativePath="..\..\public\SPO\HieDef.h">
</File>
<File
RelativePath="..\..\public\SPO\HieDraw.h">
</File>
<File
RelativePath="HieDrw.h">
</File>
<File
RelativePath="..\..\public\SPO\HieExt.h">
</File>
<File
RelativePath="..\..\public\SPO\HieHand.h">
</File>
<File
RelativePath="..\..\public\SPO\Specif\HieLoad.h">
</File>
<File
RelativePath="..\..\public\SPO\HieMacro.h">
</File>
<File
RelativePath="..\..\public\SPO\HieMtStk.h">
</File>
<File
RelativePath="..\..\public\SPO\HiePick.h">
</File>
<File
RelativePath="..\..\public\SPO\HieSpObj.h">
</File>
<File
RelativePath="..\..\Public\incspo.h">
</File>
<File
RelativePath="..\..\public\SPO.h">
</File>
</Filter>
<File
RelativePath="SPO.mak">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,684 @@
/* (c) Ubi Studios 1996-97-98*/
/* See Vincent Greco for any comment or question*/
#include "ACP_base.h"
#include "cpa_std.h"
#include "GEO.h"
#include "GLI.h"
#include "PCS.h"
#include "PO.h"
#include "IPO.h"
#include "POS.h"
#include "SPO/HieConst.h"
#include "LST.h"
#include "SPO/HieSpObj.h"
#include "SPO/HieHand.h"
#include "SPO/HieDef.h"
#include "SPO/HieMacro.h"
#include "SPO/HieMtStk.h"
#include "SPO/HieExt.h"
#include "../HieDrw.h"
#include "PRF.h"
extern int g_iSPODisplayed;
extern ACP_tdxBool bViewingInMirror;
#include "MEC.h"
/*#include "ENV.h"*/
#ifdef USE_IPT_DX5
#include "IPT_DX5.h" /* InPuT (absolutely before GAM.h)*/
#else /* USE_IPT_WIN */
#include "IPT.h" /* InPuT (absolutely before GAM.h)*/
#endif /* USE_IPT_WIN */
#include "PCS.h" /* Physical Collide Set */
#include "RND.h" /* RaNDom*/
#include "VIG.h" /* Vignette*/
/*#include "SRF.h" // Surface*/
#include "SND.h" /* SND*/
#include "SCT.h" /* SeCTor*/
#include "FIL.h" /* SeCTor*/
#include "PRT.h" /* PaRTicules*/
#include "Gam.h"
/*ANNECY JMD 17/02/98 {*/
#include "ISI.h"
/*END ANNECY JMD }*/
#define HIE_M_MustBeDisplayed(_lDrawMask) \
(( (_lDrawMask&GLI_C_lIsNotVisibleInRealWorld) && (_lDrawMask&GLI_C_lIsNotDrawingInMirror) ) || \
( (_lDrawMask&GLI_C_lIsNotVisibleInSymetricWorld) && !(_lDrawMask&GLI_C_lIsNotDrawingInMirror) ))
#define HIE_C_InheritableFlags \
(GLI_C_lIsNotVisibleInRealWorld|\
GLI_C_lIsNotVisibleInSymetricWorld|\
GLI_C_lCameraIsUnderWater|\
GLI_C_lIsNotDrawingSuperObjectBoundingVolume|\
GLI_C_lIsNotDrawingInMirror|\
GLI_C_lNotInvertBackfaces|\
GLI_C_lNotHideWhatIsUnderWater|\
GLI_C_lIsNotWired)
/*
* Blend RLI
*/
unsigned char g_ucNbRLIUse = 0 ;
unsigned char g_ucIndex1 = 0 ;
unsigned char g_ucIndex2 = 0 ;
MTH_tdxReal g_xPercent ;
void HIE_vSetCharactereRLI ( unsigned char ucNbRLI, unsigned char ucIndex1, unsigned char ucIndex2, MTH_tdxReal xPercent)
{
if ( ucNbRLI <= 2 || ucNbRLI >= 0 )
{
g_ucNbRLIUse = ucNbRLI ;
g_ucIndex1 = ucIndex1 - 1;
g_ucIndex2 = ucIndex2 - 1;
g_xPercent = xPercent ;
}
}
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/* New version*/
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
#if defined(USE_PROFILER) && !defined(PRESS_DEMO)
ACP_tdxBool fn_bSendOneSuperObjectToViewportReal
(
GLD_tdxHandleToViewportAttributes _hVpt ,
HIE_tdxHandleToSuperObject _hSprObj ,
long *_p_lDrawMask,
long _lCullingResult
)
#else
ACP_tdxBool fn_bSendOneSuperObjectToViewport
(
GLD_tdxHandleToViewportAttributes _hVpt ,
HIE_tdxHandleToSuperObject _hSprObj ,
long *_p_lDrawMask,
long _lCullingResult
)
#endif
{
long lType , lCullingResult;
unsigned long ulCurrentBits;
GEO_tdxHandleToBoundingSphere hBoundingSphere = NULL;
GEO_tdxHandleToParallelBox hParallelBox = NULL;
MTH3D_tdstVector stSphereCenter;
MTH_tdxReal xSphereRadius;
ACP_tdxHandleToRadiosity hRad;
float fGlobalAlphaTemp , fCullingTransparency;
ACP_tdxBool bBoxBoundingVolume;
MTH3D_tdstVector stMinPoint;
MTH3D_tdstVector stMaxPoint;
POS_tdstCompletePosition stIdentityMatrix;
if ( _lCullingResult != GEO_C_lCullingIn )
{
/* Get bounding Volume*/
bBoxBoundingVolume = (ACP_tdxBool) HIE_fn_SO_bHasABoxBoundingVolume(_hSprObj);
if(bBoxBoundingVolume)
{
hParallelBox = (GEO_tdxHandleToParallelBox)HIE_fn_hGetSuperObjectBoundingVolume(_hSprObj);
}
else
{
hBoundingSphere = (GEO_tdxHandleToBoundingSphere)HIE_fn_hGetSuperObjectBoundingVolume(_hSprObj);
}
if ((!bBoxBoundingVolume) && (hBoundingSphere))
{
MTH3D_M_vCopyVector(&stSphereCenter, GEO_fn_pGetCenterPointOfBoundingSphere(hBoundingSphere));
xSphereRadius = GEO_fn_xGetRadiusOfBoundingSphere(hBoundingSphere);
}
if ( (bBoxBoundingVolume) && (hParallelBox) )
{
MTH3D_tdstVector *p_stMinPoint;
MTH3D_tdstVector *p_stMaxPoint;
MTH3D_tdstVector stTranslation;
p_stMinPoint = GEO_fn_pGetMinPointOfParallelBox(hParallelBox);
p_stMaxPoint = GEO_fn_pGetMaxPointOfParallelBox(hParallelBox);
stTranslation = (HIE_fn_hGetSuperObjectGlobalMatrix(_hSprObj))->stTranslationVector;
MTH3D_M_vAddVector(&stMinPoint, p_stMinPoint , &stTranslation);
MTH3D_M_vAddVector(&stMaxPoint, p_stMaxPoint , &stTranslation);
POS_fn_vSetIdentityMatrix(&stIdentityMatrix);
}
}
lType = HIE_fn_ulGetSuperObjectType(_hSprObj);
if (lType == HIE_C_ulActor)
{
ulCurrentBits = fn_ulStandardGameGetCustomBits(M_GetMSHandle(_hSprObj,StandardGame));
lCullingResult = GEO_C_lCullingIn; /* to force recursive culling*/
if
(
(_lCullingResult != GEO_C_lCullingIn)
||
(
( (!hBoundingSphere) && (!hParallelBox) )
||
(
(!bBoxBoundingVolume)
&& ((lCullingResult = GEO_lCullingSphereNoMMM(_hVpt, &stSphereCenter, xSphereRadius, HIE_fn_hGetSuperObjectGlobalMatrix(_hSprObj), _lCullingResult)) != GEO_C_lCullingOut)/* volontary assignment*/
)
||
(
(bBoxBoundingVolume)
&& ((lCullingResult = GEO_lCullingBox(_hVpt, &stMinPoint, &stMaxPoint, _lCullingResult)) != GEO_C_lCullingOut) /* volontary assignment*/
)
)
)
{
*_p_lDrawMask |= ~HIE_C_InheritableFlags;
*_p_lDrawMask &= HIE_fn_lGetSuperObjectDrawMask(_hSprObj);
/* invisibility bit*/
if ( HIE_M_MustBeDisplayed(*_p_lDrawMask) && !HIE_fn_SO_bIsHidden( _hSprObj ) )
{
/* clear*/
ulCurrentBits &= ~GAM_C_CustBitOutOfVisibility;
}
#ifdef U64
/*unnecessary on PC, because it was set as default before anything is sent to the viewport (default value)*/
else
{
/* set*/
ulCurrentBits |= GAM_C_CustBitOutOfVisibility;
}
#endif /* U64 */
fn_vStandardGameSetCustomBits(M_GetMSHandle(_hSprObj,StandardGame), ulCurrentBits);
/* culling bit*/
if( lCullingResult == GEO_C_lCullingIn )
{
/* set*/
/* ANNECY MT - 12/10/98 {*/
fn_vStandardGameSetUselessCulling(M_GetMSHandle(_hSprObj,StandardGame), TRUE);
/* END ANNECY MT }*/
}
else
{
/* clear*/
/* ANNECY MT - 12/10/98 {*/
fn_vStandardGameSetUselessCulling(M_GetMSHandle(_hSprObj,StandardGame), FALSE);
/* END ANNECY MT }*/
}
return TRUE;
}
#ifdef U64
/*unnecessary on PC, because it was set as default before anything is sent to the viewport (default value)*/
else
{
ulCurrentBits |= GAM_C_CustBitOutOfVisibility;
fn_vStandardGameSetCustomBits(M_GetMSHandle(_hSprObj,StandardGame), ulCurrentBits);
}
#endif /* U64 */
}
else
{
if
(
(_lCullingResult != GEO_C_lCullingIn)
||
(
( (!hBoundingSphere) && (!hParallelBox) )
||
(
(!bBoxBoundingVolume)
&& (lCullingResult = GEO_lCullingSphereNoMMM(_hVpt, &stSphereCenter, xSphereRadius, HIE_fn_hGetSuperObjectGlobalMatrix(_hSprObj), _lCullingResult) != GEO_C_lCullingOut) /* volontary assignment*/
)
||
(
(bBoxBoundingVolume)
&& ((lCullingResult = GEO_lCullingBox(_hVpt, &stMinPoint, &stMaxPoint, _lCullingResult)) != GEO_C_lCullingOut)/* volontary assignment*/
)
)
)
{
*_p_lDrawMask &= HIE_fn_lGetSuperObjectDrawMask(_hSprObj);
/**/
if ( HIE_M_MustBeDisplayed(*_p_lDrawMask) && !HIE_fn_SO_bIsHidden( _hSprObj ) )
{
fGlobalAlphaTemp = GLI_vGetGlobalAlpha();
fCullingTransparency = MTH_M_xRealToFloat( GEO_xGetZFarTransparencyLevel() );
GLI_vSetGlobalAlpha( fCullingTransparency * HIE_fn_fGetSuperObjectTransparenceLevel(_hSprObj) );
if ( lType == HIE_C_ulPO )
{
GEO_tdxHandleToVisualSet hVisualSet ;
/*if the SuperObject is a leaf, its Bounding Volume is the same that*/
/*the one of its linked object : no need to test it (so I set hBoundingVolume to NULL).*/
/*unless the bounding volume of the SuperObject was NULL*/
if(bBoxBoundingVolume)
{
MTH3D_M_vMiddleVector(&stSphereCenter, &stMinPoint, &stMaxPoint);
MTH3D_M_vSubVector (& stSphereCenter , & stSphereCenter , & HIE_fn_hGetSuperObjectGlobalMatrix (_hSprObj) -> stTranslationVector);
}
else
{
if (!hBoundingSphere)
hBoundingSphere = PO_fn_hGetBoundingVolume((PO_tdxHandleToPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj));
MTH3D_M_vCopyVector(&stSphereCenter, GEO_fn_pGetCenterPointOfBoundingSphere(hBoundingSphere));
xSphereRadius = GEO_fn_xGetRadiusOfBoundingSphere(hBoundingSphere);
}
hVisualSet = PO_fn_hGetVisualSet((PO_tdxHandleToPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj)) ;
if ( g_ucNbRLIUse == 1 )
{
hRad = GLI_hGetRLI ( hVisualSet, g_ucIndex1 ) ;
PRF_fn_vIncreaseVariable( PRF_C_ulVarObjects + PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvComputed, 1 ); /* update number of computed objects*/
GLI_lSendVisualSetToViewportWithRLI2(_hVpt,hVisualSet ,&stSphereCenter,*_p_lDrawMask, hRad);
}
else if ( g_ucNbRLIUse == 2 )
{
/* xNumISILOD = 0 ???--------------------------------------------|*/
hRad = GLI_hComputeBlendRLI (hVisualSet, g_ucIndex1, g_ucIndex2, 0, g_xPercent) ;
PRF_fn_vIncreaseVariable( PRF_C_ulVarObjects + PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvComputed, 1 ); /* update number of computed objects*/
if ( hRad != NULL )
{
GLI_lSendVisualSetToViewportWithRLI2(_hVpt,hVisualSet,&stSphereCenter,*_p_lDrawMask, hRad);
ISI_fn_vFreeISI (hRad) ;
}
else
{
if(((hBoundingSphere) || (hParallelBox)))
{
GLI_lSendVisualSetToViewportBV2(_hVpt ,hVisualSet ,&stSphereCenter, xSphereRadius, *_p_lDrawMask);
}
else
{
GLI_lSendVisualSetToViewport2(_hVpt ,hVisualSet ,&stSphereCenter, *_p_lDrawMask);
}
}
}
else
{
PRF_fn_vIncreaseVariable( PRF_C_ulVarObjects + PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvComputed, 1 ); /* update number of computed objects*/
if(((hBoundingSphere) || (hParallelBox)))
{
GLI_lSendVisualSetToViewportBV2(_hVpt ,hVisualSet ,&stSphereCenter, xSphereRadius, *_p_lDrawMask);
}
else
{
GLI_lSendVisualSetToViewport2(_hVpt ,hVisualSet ,&stSphereCenter, *_p_lDrawMask);
}
}
}
/*the linked object is IPO*/
else if ( lType==HIE_C_ulIPO )
{
if ( bBoxBoundingVolume )
{
MTH3D_M_vMiddleVector(&stSphereCenter, &stMinPoint, &stMaxPoint);
MTH3D_M_vSubVector (& stSphereCenter , & stSphereCenter , & HIE_fn_hGetSuperObjectGlobalMatrix (_hSprObj) -> stTranslationVector);
}
else
{
if ( !hBoundingSphere )
{
hBoundingSphere = PO_fn_hGetBoundingVolume(IPO_fn_hGetPhysicalObject((IPO_tdxHandleToInstanciatedPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj)));
}
MTH3D_M_vCopyVector(&stSphereCenter, GEO_fn_pGetCenterPointOfBoundingSphere(hBoundingSphere));
xSphereRadius = GEO_fn_xGetRadiusOfBoundingSphere(hBoundingSphere);
}
hRad = IPO_fn_hGetRadiosity((IPO_tdxHandleToInstanciatedPhysicalObject) HIE_fn_hGetSuperObjectObject(_hSprObj));
PRF_fn_vIncreaseVariable( PRF_C_ulVarObjects + PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvComputed, 1 ); /* update number of computed objects*/
GLI_lSendVisualSetToViewportWithRLI2(_hVpt,PO_fn_hGetVisualSet(IPO_fn_hGetPhysicalObject((IPO_tdxHandleToInstanciatedPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj))),&stSphereCenter,*_p_lDrawMask, hRad);
}
/*the linked object is geometric*/
else if ( lType &( HIE_C_ulEDT_Geometric | HIE_C_ulSpecialEffect))
{
PRF_fn_vIncreaseVariable( PRF_C_ulVarObjects + PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvComputed, 1 ); /* update number of computed objects*/
GLI_xSendObjectToViewportWithLights(_hVpt, (ACP_tdxHandleOfObject)HIE_fn_hGetSuperObjectObject(_hSprObj), *_p_lDrawMask);
}
GLI_vSetGlobalAlpha( fGlobalAlphaTemp );
}
return TRUE;
}
}
return (ACP_tdxBool) HIE_fn_SO_bCheckChildren(_hSprObj);
}
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
extern void GLI_fn_vDrawMirror(BOOL);
#if defined(USE_PROFILER) && !defined(PRESS_DEMO)
void fn_vSendOneModuleToViewPortReal(GLD_tdxHandleToViewportAttributes _hVpt,
HIE_tdxHandleToSuperObject _hSprObj ,
long _lDrawMask)
#else
void fn_vSendOneModuleToViewPort(GLD_tdxHandleToViewportAttributes _hVpt,
HIE_tdxHandleToSuperObject _hSprObj ,
long _lDrawMask)
#endif
{
long lType;
GEO_tdxHandleToBoundingSphere hBoundingSphere = NULL;
GEO_tdxHandleToParallelBox hParallelBox = NULL;
MTH3D_tdstVector stSphereCenter;
MTH_tdxReal xSphereRadius;
ACP_tdxHandleToRadiosity hRad;
float fGlobalAlphaTemp , fCullingTransparency;
void GLI_vSetLensFlareRef ( void *p_vRef ) ;
GLI_vSetLensFlareRef ( (void *) _hSprObj ) ;
fGlobalAlphaTemp = GLI_vGetGlobalAlpha();
fCullingTransparency = MTH_M_xRealToFloat( GEO_xGetZFarTransparencyLevel() );
GLI_vSetGlobalAlpha( fCullingTransparency * HIE_fn_fGetSuperObjectTransparenceLevel(_hSprObj) );
lType = HIE_fn_ulGetSuperObjectType(_hSprObj);
if ( lType == HIE_C_ulPO )
{
GEO_tdxHandleToVisualSet hVisualSet ;
/*if the SuperObject is a leaf, its Bounding Volume is the same that*/
/*the one of its linked object : no need to test it (so I set hBoundingVolume to NULL).*/
/*unless the bounding volume of the SuperObject was NULL*/
hBoundingSphere = PO_fn_hGetBoundingVolume((PO_tdxHandleToPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj));
MTH3D_M_vCopyVector(&stSphereCenter, GEO_fn_pGetCenterPointOfBoundingSphere(hBoundingSphere));
xSphereRadius = GEO_fn_xGetRadiusOfBoundingSphere(hBoundingSphere);
hVisualSet = PO_fn_hGetVisualSet((PO_tdxHandleToPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj)) ;
/* VL modif pour prendre en compte les RLI si un perso n'a pas de MSLight */
if ( ( g_ucNbRLIUse == 0 ) && (GLI_lGetVisualSetNumbertOfLOD( hVisualSet ) == 1) )
{
hRad = GLI_hGetRLI ( hVisualSet, 0 ) ;
PRF_fn_vIncreaseVariable( PRF_C_ulVarObjects + PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvComputed, 1 ); /* update number of computed objects*/
GLI_lSendVisualSetToViewportWithRLI2(_hVpt,hVisualSet ,&stSphereCenter,_lDrawMask, hRad);
}
else
/* fun modif VL */
if ( g_ucNbRLIUse == 1 )
{
hRad = GLI_hGetRLI ( hVisualSet, g_ucIndex1 ) ;
PRF_fn_vIncreaseVariable( PRF_C_ulVarObjects + PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvComputed, 1 ); /* update number of computed objects*/
GLI_lSendVisualSetToViewportWithRLI2(_hVpt,hVisualSet ,&stSphereCenter,_lDrawMask, hRad);
}
else if ( g_ucNbRLIUse == 2 )
{
/* xNumISILOD = 0 ???--------------------------------------------|*/
hRad = GLI_hComputeBlendRLI (hVisualSet, g_ucIndex1, g_ucIndex2, 0, g_xPercent) ;
PRF_fn_vIncreaseVariable( PRF_C_ulVarObjects + PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvComputed, 1 ); /* update number of computed objects*/
if ( hRad != NULL )
{
GLI_lSendVisualSetToViewportWithRLI2(_hVpt,hVisualSet,&stSphereCenter,_lDrawMask, hRad);
ISI_fn_vFreeISI (hRad) ;
}
else
{
if(((hBoundingSphere) || (hParallelBox)))
GLI_lSendVisualSetToViewportBV2(_hVpt ,hVisualSet ,&stSphereCenter, xSphereRadius, _lDrawMask);
else
GLI_lSendVisualSetToViewport2(_hVpt ,hVisualSet ,&stSphereCenter, _lDrawMask);
}
}
else
{
PRF_fn_vIncreaseVariable( PRF_C_ulVarObjects + PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvComputed, 1 ); /* update number of computed objects*/
if(((hBoundingSphere) || (hParallelBox)))
GLI_lSendVisualSetToViewportBV2(_hVpt ,hVisualSet ,&stSphereCenter, xSphereRadius, _lDrawMask);
else
GLI_lSendVisualSetToViewport2(_hVpt ,hVisualSet ,&stSphereCenter, _lDrawMask);
}
}
/*the linked object is IPO*/
else if ( lType==HIE_C_ulIPO )
{
hBoundingSphere = PO_fn_hGetBoundingVolume(IPO_fn_hGetPhysicalObject((IPO_tdxHandleToInstanciatedPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj)));
MTH3D_M_vCopyVector(&stSphereCenter, GEO_fn_pGetCenterPointOfBoundingSphere(hBoundingSphere));
xSphereRadius = GEO_fn_xGetRadiusOfBoundingSphere(hBoundingSphere);
hRad = IPO_fn_hGetRadiosity((IPO_tdxHandleToInstanciatedPhysicalObject) HIE_fn_hGetSuperObjectObject(_hSprObj));
PRF_fn_vIncreaseVariable( PRF_C_ulVarObjects + PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvComputed, 1 ); /* update number of computed objects*/
GLI_lSendVisualSetToViewportWithRLI2(_hVpt,PO_fn_hGetVisualSet(IPO_fn_hGetPhysicalObject((IPO_tdxHandleToInstanciatedPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj))),&stSphereCenter,_lDrawMask, hRad);
}
/*the linked object is IPO_Mirror*/
else if ( lType==HIE_C_ulIPO_Mirror )
{
if (bViewingInMirror)
{
hBoundingSphere = PO_fn_hGetBoundingVolume(IPO_fn_hGetPhysicalObject((IPO_tdxHandleToInstanciatedPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj)));
MTH3D_M_vCopyVector(&stSphereCenter, GEO_fn_pGetCenterPointOfBoundingSphere(hBoundingSphere));
xSphereRadius = GEO_fn_xGetRadiusOfBoundingSphere(hBoundingSphere);
hRad = IPO_fn_hGetRadiosity((IPO_tdxHandleToInstanciatedPhysicalObject) HIE_fn_hGetSuperObjectObject(_hSprObj));
PRF_fn_vIncreaseVariable( PRF_C_ulVarObjects + PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvComputed, 1 ); /* update number of computed objects*/
GLI_fn_vDrawMirror( 1 );
GLI_lSendVisualSetToViewportWithRLI2(_hVpt,PO_fn_hGetVisualSet(IPO_fn_hGetPhysicalObject((IPO_tdxHandleToInstanciatedPhysicalObject)HIE_fn_hGetSuperObjectObject(_hSprObj))),&stSphereCenter,_lDrawMask, hRad);
GLI_fn_vDrawMirror( 0 );
}
}
/*the linked object is geometric*/
else if( lType & (HIE_C_ulEDT_Geometric | HIE_C_ulSpecialEffect))
{
PRF_fn_vIncreaseVariable( PRF_C_ulVarObjects + PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvComputed, 1 ); /* update number of computed objects*/
GLI_xSendObjectToViewportWithLights(_hVpt, (ACP_tdxHandleOfObject)HIE_fn_hGetSuperObjectObject(_hSprObj), _lDrawMask);
}
GLI_vSetGlobalAlpha( fGlobalAlphaTemp );
}
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////*/
#if defined(USE_PROFILER) && !defined(PRESS_DEMO)
ACP_tdxBool fn_bSendOneSuperObjectToViewport
(
GLD_tdxHandleToViewportAttributes _hVpt,
HIE_tdxHandleToSuperObject _hSprObj,
long *_p_lDrawMask,
long _lCullingResult
)
{
ACP_tdxBool bResult,bStopChrono;
void *p_vData,*p_vData2;
p_vData2 = NULL;
PRF_fn_vSetIndependantVariable( PRF_C_ulIdpDisplayedElements, 0 ); /* init flag "faces displayed"*/
bStopChrono = (PRF_fn_iGetFunctionNumberOfStart( PRF_C_ulFctDisplay , &p_vData ) > 0 ? 1 : 0);
if( bStopChrono )
{
if( PRF_fn_iGetFunctionNumberOfStart( PRF_C_ulFctDisplayCommon , &p_vData2 ) > 0 )
PRF_fn_vStopChrono( PRF_C_ulFctDisplayCommon , p_vData2 );
else
p_vData2 = NULL;
PRF_fn_vStopChrono( PRF_C_ulFctDisplay, p_vData );
PRF_fn_vStartChrono( PRF_C_ulFctDisplaySpecific, PRF_C_pvMisc );
}
bResult = fn_bSendOneSuperObjectToViewportReal( _hVpt, _hSprObj, _p_lDrawMask, _lCullingResult);
if( bStopChrono )
{
PRF_fn_vStopChrono( PRF_C_ulFctDisplaySpecific, PRF_C_pvMisc );
PRF_fn_vStartChrono( PRF_C_ulFctDisplay, p_vData );
if( p_vData2 )
PRF_fn_vStartChrono( PRF_C_ulFctDisplayCommon, p_vData2 );
}
if( PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDisplayedElements ) ) /* at least one face has been displayed*/
{
PRF_fn_vIncreaseVariable( PRF_C_ulVarObjects + PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvDisplayed, 1 ); /* update number of displayed objects*/
PRF_fn_vSetIndependantVariable( PRF_C_ulIdpDisplayedObjects, 1 ); /* set flag "object displayed" for sector*/
}
return bResult;
}
void fn_vSendOneModuleToViewPort(GLD_tdxHandleToViewportAttributes _hVpt,
HIE_tdxHandleToSuperObject _hSprObj ,
long _lDrawMask)
{
ACP_tdxBool bStopChrono;
void *p_vData,*p_vData2;
p_vData2 = NULL;
PRF_fn_vSetIndependantVariable( PRF_C_ulIdpDisplayedElements, 0 ); /* init flag "faces displayed"*/
bStopChrono = (PRF_fn_iGetFunctionNumberOfStart( PRF_C_ulFctDisplay , &p_vData ) > 0 ? 1 : 0);
if( bStopChrono )
{
if( PRF_fn_iGetFunctionNumberOfStart( PRF_C_ulFctDisplayCommon , &p_vData2 ) > 0 )
PRF_fn_vStopChrono( PRF_C_ulFctDisplayCommon , p_vData2 );
else
p_vData2 = NULL;
PRF_fn_vStopChrono( PRF_C_ulFctDisplay, p_vData );
PRF_fn_vStartChrono( PRF_C_ulFctDisplaySpecific, PRF_C_pvMisc );
}
fn_vSendOneModuleToViewPortReal( _hVpt, _hSprObj, _lDrawMask );
if( bStopChrono )
{
PRF_fn_vStopChrono( PRF_C_ulFctDisplaySpecific, PRF_C_pvMisc );
PRF_fn_vStartChrono( PRF_C_ulFctDisplay, p_vData );
if( p_vData2 )
PRF_fn_vStartChrono( PRF_C_ulFctDisplayCommon, p_vData2 );
}
if( PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDisplayedElements ) ) /* at least one face has been displayed*/
{
PRF_fn_vIncreaseVariable( PRF_C_ulVarObjects + PRF_fn_lGetIndependantVariable( PRF_C_ulIdpDynOrSta ), PRF_C_pvDisplayed, 1 ); /* update number of displayed objects*/
PRF_fn_vSetIndependantVariable( PRF_C_ulIdpDisplayedObjects, 1 ); /* set flag "object displayed" for sector*/
}
}
void HIE_fn_vUpdateRasterForObject( GEO_tdstGeometricObject *p_stObject,
unsigned long _ulRasterObject,
unsigned long _ulRasterFace,
unsigned long _ulRasterElement )
{
/* take account Object*/
if( p_stObject )
{
ACP_tdxIndex xIndexElement, xNbElements;
/* update number of activated objects*/
PRF_fn_vIncreaseVariable( _ulRasterObject, PRF_C_pvVisible, 1 );
/* ANNECY MT - 27/05/98 {*/
/* update number of elements*/
xNbElements = GEO_xGetGeometricObjectNumberOfElements( p_stObject );
PRF_fn_vIncreaseVariable( _ulRasterElement, PRF_C_pvVisible, xNbElements );
/* update number of faces*/
/* END ANNECY MT }*/
for( xIndexElement = 0 ; xIndexElement < xNbElements ; xIndexElement++ )
{
switch( GEO_xGetElementType( p_stObject, xIndexElement ) )
{
case GEO_C_xElementIndexedTriangles:
PRF_fn_vIncreaseVariable( _ulRasterFace, PRF_C_pvVisible, GEO_lGetIndexedTriangleNbFaces( p_stObject, xIndexElement ) );
break;
case GEO_C_xElementFaceMapDescriptors:
PRF_fn_vIncreaseVariable( _ulRasterFace, PRF_C_pvVisible, ((GEO_tdstElementFaceMapDescriptors *)p_stObject -> d_stListOfElements[xIndexElement])->xNbFaces );
break;
case GEO_C_xElementSprites:
PRF_fn_vIncreaseVariable( _ulRasterFace, PRF_C_pvVisible, ((GEO_tdstElementSprite *)p_stObject -> d_stListOfElements[xIndexElement])->xNbSprites * 2 );
break;
case GEO_C_xElementTMeshes:
PRF_fn_vIncreaseVariable( _ulRasterFace, PRF_C_pvVisible, ((GEO_tdstElementTMeshes *) p_stObject -> d_stListOfElements[xIndexElement])->xNbFaces );
break;
case GEO_C_xElementPoints:
case GEO_C_xElementLines:
case GEO_C_xElementSpheres:
case GEO_C_xElementAlignedBoxes:
case GEO_C_xElementCones:
break;
#ifdef USE_ALTIMAPS
case GEO_C_xElementAltimap:
PRF_fn_vIncreaseVariable( _ulRasterFace, PRF_C_pvVisible, ((GEO_tdstElementAltimap *)p_stObject -> d_stListOfElements[xIndexElement])->xNbFaces );
break;
#endif
default:
break;
}
}
}
}
void HIE_fn_vUpdateRasterForSuperObject( HIE_tdxHandleToSuperObject _hSuperObject,
unsigned long _ulRasterObject,
unsigned long _ulRasterFace,
unsigned long _ulRasterElement )
{
GEO_tdstGeometricObject *p_stObject;
ACP_tdxIndex i;
HIE_tdxHandleToSuperObject hChild;
if(HIE_fn_lGetSuperObjectDrawMask(_hSuperObject) & GLI_C_lDrawNothing)
{
p_stObject = HIE_fn_p_stGetGeometricObjectFromSuperObject( _hSuperObject );
/* take account SuperObject*/
HIE_fn_vUpdateRasterForObject( p_stObject, _ulRasterObject, _ulRasterFace, _ulRasterElement );
/* take account children*/
HIE_M_ForEachChildOf(_hSuperObject, hChild, i)
{
/* ANNECY MT - 27/05/98 {*/
HIE_fn_vUpdateRasterForSuperObject( hChild, _ulRasterObject, _ulRasterFace, _ulRasterElement );
/* END ANNECY MT }*/
}
}
}
#endif /* USE_PROFILER && PRESS_DEMO */
/*
* Use for Lens Flare
*/
ACP_tdxBool HIE_fn_bIsSegmentIntersectedInCameraSector (POS_tdstCompletePosition *p_stCameraPos, POS_tdstCompletePosition *p_stSPOPos) {
MTH3D_tdstVector stOrg, stOrgVect, stVect, stNormal, stHit ;
HIE_tdxHandleToSuperObject hSprObjHit, hSector ;
POS_tdstCompletePosition hCameraPosInv ;
HIE_tdxHandleToSuperObject hMainCamera = CAM_fn_hGetActiveCamera(1); /* 1 ... aaargh !*/
ACP_tdxIndex xIndex;
SECT_tdxHandleOfSectorObject hSectorObject;
SECT_tdxHandleOfElementLstGraphicInteraction hGraphicInteractionChild;
/* coordonn<6E>es camera dans le repere du monde*/
POS_fn_vInvertIsoMatrix( &hCameraPosInv, p_stCameraPos );
POS_fn_vGetTranslationVector(&hCameraPosInv, &stOrg) ;
/* coordonn<6E>es du centre d'objet dans le repere du monde*/
POS_fn_vGetTranslationVector(p_stSPOPos, &stVect) ;
MTH3D_M_vSubVector(&stOrgVect, &stVect, &stOrg) ;
/* le secteur courant*/
hSector = fn_h_SectInfoGetCurrentSector(M_GetMSHandle(hMainCamera, SectInfo)) ;
/* distance dans stVect qui est reduit a chaque intersection*/
MTH3D_M_vCopyVector(&stVect, &stOrgVect) ;
if ( HIE_bIntersectSegmentWithFirstSuperObject (&stOrg, &stVect, hSector, &stHit, &stNormal, &hSprObjHit) ){
return (1) ;
}
/* For each sector in graphic interaction*/
hSectorObject=(SECT_tdxHandleOfSectorObject)HIE_fn_hGetSuperObjectObject(hSector);
LST2_M_StaticForEachElementOf( &(hSectorObject->stListOfSectorsInGraphicInteraction), hGraphicInteractionChild, xIndex) {
MTH3D_M_vCopyVector(&stVect, &stOrgVect) ;
if ( HIE_bIntersectSegmentWithFirstSuperObject( &stOrg, &stVect, hGraphicInteractionChild->hPointerOfSectorSO,
&stHit, &stNormal, &hSprObjHit) ){
return (1) ;
}
}
return (0) ;
}

View File

@@ -0,0 +1,358 @@
#define HIE_FRIEND
#include "ACP_base.h"
#include "GMT.h"
#include "GEO.h"
#include "GLI.h"
#include "DPT.h"
#include "VIG.h"
#include "MEC.h"
#include "PCS.h"
#include "PO.h"
#include "IPO.h"
#include "LST.h"
#include "SND.h"
#include "SCT.h"
#include "SPO/HieMtStk.h"
#include "SPO/HieConst.h"
#include "SPO/HieExt.h"
#include "SPO/Specif/HieLoad.h"
#include "SPO/Specif/HieSpObj.h"
#include "GAM/Structur/3DOSLkTb.h" /* any other way ? perhaps...*/
/*ROMTEAM PLG Files Ionut Grozea 01-05-1998*/
#ifdef ACTIVE_EDITOR
struct ISI_tdstObjectColorStruct_ m_ObjectColorStruct;
#endif
/*ENDROMTEAM PLG Files Ionut Grozea 01-05-1998*/
#include "ldt.h"
#define lTagAddChild 'CddA'
#define lTagPutMatrix 'MtuP'
#define lTagLinkedObject 'kniL'
#define lTagFlags 'galF'
#define lTagTransparency 'narT'
#define lTagMatrixTranslation 'narT'
#define lTagMatrixScale 'lacS'
#define lTagMatrixRotation 'atoR'
HREF g_hRefSPO;
#ifdef ACTIVE_EDITOR
extern void PLG_InitPLGLoad();
void LGT_fn_xLoadPlgObject();
#endif
/*****************************************************************
Function name : fn_iCreateSuperObject
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 14-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateSuperObject( LDT_tdst_Link *pLink )
{
VIG_fn_vAddToProgressBar(1);
/* new SuperObject for that section*/
pLink->pObject = (void*)HIE_fn_hCreateSuperObject();
return 0;
}
/*****************************************************************
Function name : fn_iLoadSuperObject
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 14-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadSuperObject( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
HIE_tdxHandleToSuperObject hSuperObject = (HIE_tdxHandleToSuperObject)pLink->pObject;
POS_tdstCompletePosition *p_stMatrix;
HIE_tdxHandleToVoid hLinkedObj;
char a255_cLongName[255];
HIE_tdxHandleToSuperObject hNewSuperObject;
int nLen;
static int iCount;
nLen = LDT_ComputeSectionName(pLink, a255_cLongName);
SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(HIE_fn_p_stGetSuperObjectLinkTable(), a255_cLongName, (unsigned long)hSuperObject), 1, nLen);
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case lTagAddChild : /* */
{
hNewSuperObject = (HIE_tdxHandleToSuperObject)LDT_LoadSection(LDT_szGetParam(1));
HIE_fn_vSuperObjectAddTail(hSuperObject, hNewSuperObject);
}
break;
case lTagPutMatrix : /* */
{
p_stMatrix = (POS_tdstCompletePosition *)LDT_LoadSection(LDT_szGetParam(1));
HIE_fn_vSetSuperObjectMatrix(hSuperObject, p_stMatrix);
}
break;
case lTagLinkedObject : /* */
{
char szFile[SCR_CV_ui_Cfg_MaxLenName], szParent[SCR_CV_ui_Cfg_MaxLenName], szSection[SCR_CV_ui_Cfg_MaxLenName], szId[SCR_CV_ui_Cfg_MaxLenName];
char* szParams = LDT_szGetParam(1);
long lType;
LDT_SplitSectionName( szParams, szFile, szParent, szSection, szId );
if (strcmpi(szSection,"Geometric")==0)
{
hLinkedObj =(HIE_tdxHandleToVoid)GLI_pLoadGeometricInFile(szParams);
lType=HIE_C_ulEDT_Geometric;
}
else if (strcmpi(szSection,"Sector")==0)
{
hLinkedObj =(HIE_tdxHandleToVoid)LDT_LoadSection(szParams);
lType=HIE_C_ulSector;
}
else if (strcmpi(szSection,"SpecialEffect")==0)
{
hLinkedObj =(HIE_tdxHandleToVoid)LDT_LoadSection(szParams);
lType=HIE_C_ulSpecialEffect;
}
else if (strcmpi(szSection,"PHY")==0)
{
hLinkedObj = (HIE_tdxHandleToVoid)LDT_LoadSection(szParams);
lType=HIE_C_ulPO;
}
else if (strcmpi(szSection,"IPO")==0)
{
hLinkedObj = (HIE_tdxHandleToVoid)LDT_LoadSection(szParams);
lType=HIE_C_ulIPO;
}
else if (strcmpi(szSection,"Mirror")==0)
{
hLinkedObj =(HIE_tdxHandleToVoid)LDT_LoadSection(szParams);
lType=HIE_C_ulMirror;
}
else if (strcmpi(szSection,"Ipo_Mirror")==0)
{
hLinkedObj =(HIE_tdxHandleToVoid)LDT_LoadSection(szParams);
lType=HIE_C_ulIPO_Mirror;
}
else if (strcmpi(szSection,"PhyMirror")==0)
{
hLinkedObj =(HIE_tdxHandleToVoid)LDT_LoadSection(szParams);
lType=HIE_C_ulPO_Mirror;
}
/* Link the SuperObject with its Object*/
HIE_fn_vSetSuperObjectObjectAndType( hSuperObject,hLinkedObj,lType);
}
break;
case lTagFlags : /* */
{
HIE_fn_SO_vSetFlags( hSuperObject, atoi( LDT_szGetParam(1) ) );
}
break;
case lTagTransparency : /* */
{
HIE_fn_vSetSuperObjectTransparenceLevel( hSuperObject, (float)atof( LDT_szGetParam(1) ) );
}
break;
}
}
}
}
LDT_AddToRefsTable( g_hRefSPO, pLink, 0, 0);
/* By default, a loaded super object has the "box instead of sphere bounding volume" flag*/
HIE_fn_SO_vSetFlags (hSuperObject, HIE_fn_SO_ulGetFlags (hSuperObject) | HIE_C_Flag_ulTypeOfBoundingVolume);
/*ROMTEAM PLG Files Ionut Grozea 01-05-1998*/
#ifdef ACTIVE_EDITOR
if (!iCount)
{
PLG_InitPLGLoad();
LGT_fn_xLoadPlgObject();
iCount = 1;
}
#endif
/*ENDROMTEAM PLG Files Ionut Grozea 01-05-1998*/
return 0;
}
/*****************************************************************
Function name : fn_vSPOPostProcessLDT
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 14-Oct-98
Modified :
Return type : void
Argument : HREF hRef
*****************************************************************/
void fn_vSPOPostProcessLDT( HREF hRef )
{
LDT_tdst_Link *pLink;
LDT_tdst_Link *pGetFrom;
int iType;
short xCount;
long *pVal;
MTH3D_tdstMatrix stIdentityMatrix;
MTH3D_tdstMatrix * p_stTransformationMatrix;
while( LDT_GetRefFromTable( hRef, &pLink, &pGetFrom, &iType, &xCount, &pVal )==0 )
{
HIE_tdxHandleToSuperObject hSuperObject = (HIE_tdxHandleToSuperObject)pLink->pObject;
/* If the matrix is the identity, we set the 'no transformation matrix' flag*/
MTH3D_M_vSetIdentityMatrix (& stIdentityMatrix);
p_stTransformationMatrix = & HIE_fn_hGetSuperObjectMatrix (hSuperObject) -> stTransformMatrix;
if (MTH3D_M_bEqualMatrix (p_stTransformationMatrix, & stIdentityMatrix))
{
HIE_fn_SO_vSetFlags (hSuperObject, HIE_fn_SO_ulGetFlags (hSuperObject) | HIE_C_Flag_ulNoTransformationMatrix);
}
}
}
/*****************************************************************
Function name : fn_iCreateOneMatrix
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 14-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateOneMatrix( LDT_tdst_Link *pLink )
{
POS_tdstCompletePosition *p_stMatrix;
p_stMatrix=GEO_fn_hCreateMatrix();
POS_fn_vSetIdentityMatrix(p_stMatrix);
pLink->pObject = (void*)p_stMatrix;
return 0;
}
/*****************************************************************
Function name : fn_iLoadOneMatrix
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 14-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadOneMatrix( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
POS_tdstCompletePosition *p_stMatrix = (POS_tdstCompletePosition *)pLink->pObject;
long i;
GLI_tdxValue a_xVertex[9];
MTH3D_tdstVector stI,stJ,stK;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)(szEntry+6))
{
case lTagMatrixTranslation : /* */
{
char szFileName[_MAX_PATH], *szP;
LDT_ComputeSectionName(pLink, szFileName);
szP = strchr(szFileName, '^');
*szP = 0;
for (i=1;i<4;i++)
a_xVertex[i-1]=(GLI_tdxValue)GLI_M_FloatToValue(atof(LDT_szGetParam(i) ) * GLI_dGetUnitInMeterInFile(szFileName));
MTH3D_M_vSetVectorElements(&stI,a_xVertex[0],a_xVertex[1],a_xVertex[2]);
POS_fn_vSetTranslationVector(p_stMatrix,&stI);
}
break;
case lTagMatrixScale : /* */
{
for (i=1;i<10;i++)
a_xVertex[i-1]=(GLI_tdxValue)GLI_M_FloatToValue(atof(LDT_szGetParam(i) ));
if( !( (a_xVertex[0] == 1.0)
&& (a_xVertex[1] == 0.0)
&& (a_xVertex[2] == 0.0)
&& (a_xVertex[3] == 0.0)
&& (a_xVertex[4] == 1.0)
&& (a_xVertex[5] == 0.0)
&& (a_xVertex[6] == 0.0)
&& (a_xVertex[7] == 0.0)
&& (a_xVertex[8] == 1.0))
)
{
MTH3D_M_vSetVectorElements(&stI,a_xVertex[0],a_xVertex[1],a_xVertex[2]);
MTH3D_M_vSetVectorElements(&stJ,a_xVertex[3],a_xVertex[4],a_xVertex[5]);
MTH3D_M_vSetVectorElements(&stK,a_xVertex[6],a_xVertex[7],a_xVertex[8]);
POS_fn_vSetScaleMatrix(p_stMatrix,&stI,&stJ,&stK);
}
}
break;
case lTagMatrixRotation : /* */
{
for (i=1;i<10;i++)
a_xVertex[i-1]=(GLI_tdxValue)GLI_M_FloatToValue(atof(LDT_szGetParam(i)));
MTH3D_M_vSetVectorElements(&stI,a_xVertex[0],a_xVertex[1],a_xVertex[2]);
MTH3D_M_vSetVectorElements(&stJ,a_xVertex[3],a_xVertex[4],a_xVertex[5]);
MTH3D_M_vSetVectorElements(&stK,a_xVertex[6],a_xVertex[7],a_xVertex[8]);
POS_fn_vSetRotationMatrix(p_stMatrix,&stI,&stJ,&stK);
}
break;
}
}
}
}
/* Recalcul automatique du type*/
POS_fn_vUpdateMatrixType(p_stMatrix);
return 0;
}

View File

@@ -0,0 +1,5 @@
SCC = This is a source code control file
[SPO.vcproj]
SCC_Aux_Path = "P4SCC#srvperforce-ma:1666##raymandata##Editor"
SCC_Project_Name = Perforce Project