mirror of
https://github.com/nillerusr/source-engine.git
synced 2024-12-23 06:36:54 +00:00
43 lines
1.4 KiB
C++
43 lines
1.4 KiB
C++
//========= Copyright Valve Corporation, All rights reserved. ============//
|
|
#include "stdafx.h"
|
|
#include "simplify.h"
|
|
|
|
extern IPhysicsCollision *physcollision;
|
|
|
|
vcollide_t *ConvertVCollideToPHX( const vcollide_t *pCollideIn, const simplifyparams_t ¶ms, int *pSize, bool bStoreSurfaceprops, bool bStoreSolidNames )
|
|
{
|
|
Assert( !pCollideIn->isPacked );
|
|
vcollide_t *pCollideOut = new vcollide_t;
|
|
pCollideOut->solids = new CPhysCollide *[pCollideIn->solidCount];
|
|
pCollideOut->solidCount = pCollideIn->solidCount;
|
|
*pSize = 0;
|
|
|
|
for ( int i = 0; i < pCollideIn->solidCount; i++ )
|
|
{
|
|
Assert( pCollideIn->solids[i] );
|
|
pCollideOut->solids[i] = SimplifyCollide( pCollideIn->solids[i], i, params );
|
|
Assert( pCollideOut->solids[i] );
|
|
int collideSize = physcollision->CollideSize( pCollideOut->solids[i] );
|
|
*pSize += collideSize;
|
|
}
|
|
int packedTextSize;
|
|
pCollideOut->pKeyValues = (char *)physcollision->PackVCollideText( pCollideIn->pKeyValues, &packedTextSize, bStoreSolidNames, bStoreSurfaceprops );
|
|
pCollideOut->isPacked = true;
|
|
pCollideOut->descSize = packedTextSize;
|
|
*pSize += packedTextSize;
|
|
|
|
return pCollideOut;
|
|
}
|
|
|
|
|
|
void DestroyPHX( vcollide_t *pCollide )
|
|
{
|
|
for ( int i = 0; i < pCollide->solidCount; i++ )
|
|
{
|
|
physcollision->DestroyCollide( pCollide->solids[i] );
|
|
}
|
|
delete[] pCollide->solids;
|
|
physcollision->DestroyVCollideText( pCollide->pKeyValues );
|
|
delete pCollide;
|
|
}
|