Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update tf2 #86

Open
wants to merge 23 commits into
base: tf2
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make g_nActivityListVersion and g_nEventListVersion pointers, update …
…IVModelInfo
  • Loading branch information
arthurdead committed Sep 15, 2022
commit 02846c232cf3da5542911dc95f988b1883b1bee2
8 changes: 4 additions & 4 deletions game/server/nav_area.h
Original file line number Diff line number Diff line change
@@ -837,14 +837,14 @@ inline bool CNavArea::IsOpen( void ) const
//--------------------------------------------------------------------------------------------------------------
inline bool CNavArea::IsOpenListEmpty( void )
{
Assert( (m_openList && m_openList->m_prevOpen == NULL) || m_openList == NULL );
//Assert( (m_openList && m_openList->m_prevOpen == NULL) || m_openList == NULL );
return (*m_openList) ? false : true;
}

//--------------------------------------------------------------------------------------------------------------
inline CNavArea *CNavArea::PopOpenList( void )
{
Assert( (m_openList && m_openList->m_prevOpen == NULL) || m_openList == NULL );
//Assert( (m_openList && m_openList->m_prevOpen == NULL) || m_openList == NULL );

if ( *m_openList )
{
@@ -855,12 +855,12 @@ inline CNavArea *CNavArea::PopOpenList( void )
area->m_prevOpen = NULL;
area->m_nextOpen = NULL;

Assert( (m_openList && m_openList->m_prevOpen == NULL) || m_openList == NULL );
//Assert( (m_openList && m_openList->m_prevOpen == NULL) || m_openList == NULL );

return area;
}

Assert( (m_openList && m_openList->m_prevOpen == NULL) || m_openList == NULL );
//Assert( (m_openList && m_openList->m_prevOpen == NULL) || m_openList == NULL );

return NULL;
}
16 changes: 8 additions & 8 deletions game/shared/animation.cpp
Original file line number Diff line number Diff line change
@@ -57,8 +57,8 @@ int ExtractBbox( CStudioHdr *pstudiohdr, int sequence, Vector& mins, Vector& max
// Output : mstudioseqdesc_t
//-----------------------------------------------------------------------------

extern int g_nActivityListVersion;
extern int g_nEventListVersion;
extern int *g_nActivityListVersion;
extern int *g_nEventListVersion;

void SetEventIndexForSequence( mstudioseqdesc_t &seqdesc )
{
@@ -112,14 +112,14 @@ void BuildAllAnimationEventIndexes( CStudioHdr *pstudiohdr )
if ( !pstudiohdr )
return;

if( pstudiohdr->GetEventListVersion() != g_nEventListVersion )
if( pstudiohdr->GetEventListVersion() != *g_nEventListVersion )
{
for ( int i = 0 ; i < pstudiohdr->GetNumSeq() ; i++ )
{
SetEventIndexForSequence( pstudiohdr->pSeqdesc( i ) );
}

pstudiohdr->SetEventListVersion( g_nEventListVersion );
pstudiohdr->SetEventListVersion( *g_nEventListVersion );
}
}

@@ -133,7 +133,7 @@ void ResetEventIndexes( CStudioHdr *pstudiohdr )
if (! pstudiohdr)
return;

pstudiohdr->SetEventListVersion( g_nEventListVersion - 1 );
pstudiohdr->SetEventListVersion( *g_nEventListVersion - 1 );
}

//-----------------------------------------------------------------------------
@@ -193,7 +193,7 @@ void IndexModelSequences( CStudioHdr *pstudiohdr )
SetEventIndexForSequence( pstudiohdr->pSeqdesc( i ) );
}

pstudiohdr->SetActivityListVersion( g_nActivityListVersion );
pstudiohdr->SetActivityListVersion( *g_nActivityListVersion );
}

//-----------------------------------------------------------------------------
@@ -206,7 +206,7 @@ void ResetActivityIndexes( CStudioHdr *pstudiohdr )
if (! pstudiohdr)
return;

pstudiohdr->SetActivityListVersion( g_nActivityListVersion - 1 );
pstudiohdr->SetActivityListVersion( *g_nActivityListVersion - 1 );
}

void VerifySequenceIndex( CStudioHdr *pstudiohdr )
@@ -216,7 +216,7 @@ void VerifySequenceIndex( CStudioHdr *pstudiohdr )
return;
}

if( pstudiohdr->GetActivityListVersion( ) != g_nActivityListVersion )
if( pstudiohdr->GetActivityListVersion( ) != *g_nActivityListVersion )
{
// this model's sequences have not yet been indexed by activity
IndexModelSequences( pstudiohdr );
51 changes: 40 additions & 11 deletions public/engine/ivmodelinfo.h
Original file line number Diff line number Diff line change
@@ -33,29 +33,33 @@ class CPhysCollide;
typedef unsigned short MDLHandle_t;
class CUtlBuffer;
class IClientRenderable;

class IModelLoadCallback;

//-----------------------------------------------------------------------------
// Model info interface
//-----------------------------------------------------------------------------

// change this when the new version is incompatable with the old
#define VMODELINFO_CLIENT_INTERFACE_VERSION "VModelInfoClient004"
#define VMODELINFO_SERVER_INTERFACE_VERSION "VModelInfoServer002"
#define VMODELINFO_CLIENT_INTERFACE_VERSION "VModelInfoClient006"
#define VMODELINFO_SERVER_INTERFACE_VERSION_3 "VModelInfoServer003"
#define VMODELINFO_SERVER_INTERFACE_VERSION "VModelInfoServer004"

class IVModelInfo
abstract_class IVModelInfo
{
public:
virtual ~IVModelInfo( void ) { }

virtual const model_t *GetModel( int modelindex ) const = 0;
// Returns index of model by name
// Returns model_t* pointer for a model given a precached or dynamic model index.
virtual const model_t *GetModel( int modelindex ) = 0;

// Returns index of model by name for precached or known dynamic models.
// Does not adjust reference count for dynamic models.
virtual int GetModelIndex( const char *name ) const = 0;

// Returns name of model
virtual const char *GetModelName( const model_t *model ) const = 0;
virtual vcollide_t *GetVCollide( const model_t *model ) const = 0;
virtual vcollide_t *GetVCollide( int modelindex ) const = 0;
virtual vcollide_t *GetVCollide( const model_t *model ) = 0;
virtual vcollide_t *GetVCollide( int modelindex ) = 0;
virtual void GetModelBounds( const model_t *model, Vector& mins, Vector& maxs ) const = 0;
virtual void GetModelRenderBounds( const model_t *model, Vector& mins, Vector& maxs ) const = 0;
virtual int GetModelFrameCount( const model_t *model ) const = 0;
@@ -64,7 +68,7 @@ class IVModelInfo
virtual bool ModelHasMaterialProxy( const model_t *model ) const = 0;
virtual bool IsTranslucent( model_t const* model ) const = 0;
virtual bool IsTranslucentTwoPass( const model_t *model ) const = 0;
virtual void RecomputeTranslucency( const model_t *model, int nSkin, int nBody, void /*IClientRenderable*/ *pClientRenderable ) = 0;
virtual void RecomputeTranslucency( const model_t *model, int nSkin, int nBody, void /*IClientRenderable*/ *pClientRenderable, float fInstanceAlphaModulate=1.0f) = 0;
virtual int GetModelMaterialCount( const model_t* model ) const = 0;
virtual void GetModelMaterials( const model_t *model, int count, IMaterial** ppMaterial ) = 0;
virtual bool IsModelVertexLit( const model_t *model ) const = 0;
@@ -84,7 +88,7 @@ class IVModelInfo
virtual void GetIlluminationPoint( const model_t *model, IClientRenderable *pRenderable, Vector const& origin,
QAngle const& angles, Vector* pLightingCenter ) = 0;

virtual int GetModelContents( int modelIndex ) const = 0;
virtual int GetModelContents( int modelIndex ) = 0;
virtual studiohdr_t *GetStudiomodel( const model_t *mod ) = 0;
virtual int GetModelSpriteWidth( const model_t *model ) const = 0;
virtual int GetModelSpriteHeight( const model_t *model ) const = 0;
@@ -109,14 +113,39 @@ class IVModelInfo

virtual bool IsUsingFBTexture( const model_t *model, int nSkin, int nBody, void /*IClientRenderable*/ *pClientRenderable ) const = 0;

virtual const model_t *FindOrLoadModel( const char *name ) const = 0;
// Obsolete methods. These are left in to maintain binary compatibility with clients using the IVModelInfo old version.
virtual const model_t *FindOrLoadModel( const char *name ) { Warning( "IVModelInfo::FindOrLoadModel is now obsolte.\n" ); return NULL; }
virtual void InitDynamicModels( ) { Warning( "IVModelInfo::InitDynamicModels is now obsolte.\n" ); }
virtual void ShutdownDynamicModels( ) { Warning( "IVModelInfo::ShutdownDynamicModels is now obsolte.\n" ); }
virtual void AddDynamicModel( const char *name, int nModelIndex = -1 ) { Warning( "IVModelInfo::AddDynamicModel is now obsolte.\n" ); }
virtual void ReferenceModel( int modelindex ) { Warning( "IVModelInfo::ReferenceModel is now obsolte.\n" ); }
virtual void UnreferenceModel( int modelindex ) { Warning( "IVModelInfo::UnreferenceModel is now obsolte.\n" ); }
virtual void CleanupDynamicModels( bool bForce = false ) { Warning( "IVModelInfo::CleanupDynamicModels is now obsolte.\n" ); }

virtual MDLHandle_t GetCacheHandle( const model_t *model ) const = 0;

// Returns planes of non-nodraw brush model surfaces
virtual int GetBrushModelPlaneCount( const model_t *model ) const = 0;
virtual void GetBrushModelPlane( const model_t *model, int nIndex, cplane_t &plane, Vector *pOrigin ) const = 0;
virtual int GetSurfacepropsForVirtualTerrain( int index ) = 0;

// Poked by engine host system
virtual void OnLevelChange() = 0;

virtual int GetModelClientSideIndex( const char *name ) const = 0;

// Returns index of model by name, dynamically registered if not already known.
virtual int RegisterDynamicModel( const char *name, bool bClientSide ) = 0;

virtual bool IsDynamicModelLoading( int modelIndex ) = 0;

virtual void AddRefDynamicModel( int modelIndex ) = 0;
virtual void ReleaseDynamicModel( int modelIndex ) = 0;

// Registers callback for when dynamic model has finished loading.
// Automatically adds reference, pair with ReleaseDynamicModel.
virtual bool RegisterModelLoadCallback( int modelindex, IModelLoadCallback* pCallback, bool bCallImmediatelyIfLoaded = true ) = 0;
virtual void UnregisterModelLoadCallback( int modelindex, IModelLoadCallback* pCallback ) = 0;
};