mirror of
https://github.com/celisej567/source-engine.git
synced 2026-01-05 22:09:59 +03:00
amd64: fix multithread, fix vgui, fix physmodels
This commit is contained in:
@@ -2331,7 +2331,16 @@ void CDetailObjectSystem::RenderFastSprites( const Vector &viewOrigin, const Vec
|
||||
color[2] = pquad->m_RGBColor[0][2];
|
||||
color[3] = pColorsCasted[MANTISSA_LSB_OFFSET];
|
||||
|
||||
DetailPropSpriteDict_t *pDict = pquad->m_pSpriteDefs[0];
|
||||
DetailPropSpriteDict_t *pDict;
|
||||
#ifdef PLATFORM_64BITS
|
||||
if( nSubIdx == 1 )
|
||||
pDict = ((FastSpriteQuadBuildoutBufferNonSIMDView_t*)((intp)pquad+4))->m_pSpriteDefs[0];
|
||||
else if( nSubIdx == 3 )
|
||||
pDict = ((FastSpriteQuadBuildoutBufferNonSIMDView_t*)((intp)pquad-4))->m_pSpriteDefs[0];
|
||||
else
|
||||
#endif
|
||||
pDict = pquad->m_pSpriteDefs[0];
|
||||
|
||||
|
||||
meshBuilder.Position3f( pquad->m_flX0[0], pquad->m_flY0[0], pquad->m_flZ0[0] );
|
||||
meshBuilder.Color4ubv( color );
|
||||
@@ -2545,6 +2554,7 @@ void CDetailObjectSystem::RenderFastTranslucentDetailObjectsInLeaf( const Vector
|
||||
int nToDraw = MIN( nCount, nQuadsRemaining );
|
||||
nCount -= nToDraw;
|
||||
nQuadsRemaining -= nToDraw;
|
||||
|
||||
while( nToDraw-- )
|
||||
{
|
||||
// draw the sucker
|
||||
@@ -2553,17 +2563,28 @@ void CDetailObjectSystem::RenderFastTranslucentDetailObjectsInLeaf( const Vector
|
||||
|
||||
FastSpriteQuadBuildoutBufferNonSIMDView_t const *pquad = pQuadBuffer+nSIMDIdx;
|
||||
|
||||
|
||||
// voodoo - since everything is in 4s, offset structure pointer by a couple of floats to handle sub-index
|
||||
pquad = (FastSpriteQuadBuildoutBufferNonSIMDView_t const *) ( ( (intp) ( pquad ) )+ ( nSubIdx << 2 ) );
|
||||
|
||||
uint8 const *pColorsCasted = reinterpret_cast<uint8 const *> ( pquad->m_Alpha );
|
||||
|
||||
|
||||
uint8 color[4];
|
||||
color[0] = pquad->m_RGBColor[0][0];
|
||||
color[1] = pquad->m_RGBColor[0][1];
|
||||
color[2] = pquad->m_RGBColor[0][2];
|
||||
color[3] = pColorsCasted[MANTISSA_LSB_OFFSET];
|
||||
|
||||
DetailPropSpriteDict_t *pDict = pquad->m_pSpriteDefs[0];
|
||||
DetailPropSpriteDict_t *pDict;
|
||||
#ifdef PLATFORM_64BITS
|
||||
if( nSubIdx == 1 )
|
||||
pDict = ((FastSpriteQuadBuildoutBufferNonSIMDView_t*)((intp)pquad+4))->m_pSpriteDefs[0];
|
||||
else if( nSubIdx == 3 )
|
||||
pDict = ((FastSpriteQuadBuildoutBufferNonSIMDView_t*)((intp)pquad-4))->m_pSpriteDefs[0];
|
||||
else
|
||||
#endif
|
||||
pDict = pquad->m_pSpriteDefs[0];
|
||||
|
||||
meshBuilder.Position3f( pquad->m_flX0[0], pquad->m_flY0[0], pquad->m_flZ0[0] );
|
||||
meshBuilder.Color4ubv( color );
|
||||
|
||||
@@ -731,7 +731,10 @@ CBaseCombatCharacter::CBaseCombatCharacter( void )
|
||||
}
|
||||
|
||||
// not standing on a nav area yet
|
||||
#ifdef MEXT_BOT
|
||||
m_lastNavArea = NULL;
|
||||
#endif
|
||||
|
||||
m_registeredNavTeam = TEAM_INVALID;
|
||||
|
||||
for (int i = 0; i < MAX_WEAPONS; i++)
|
||||
@@ -3481,17 +3484,20 @@ void CBaseCombatCharacter::UpdateLastKnownArea( void )
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBaseCombatCharacter::IsAreaTraversable( const CNavArea *area ) const
|
||||
{
|
||||
#ifdef NEXT_BOT
|
||||
return area ? !area->IsBlocked( GetTeamNumber() ) : false;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Leaving the nav mesh
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBaseCombatCharacter::ClearLastKnownArea( void )
|
||||
{
|
||||
#ifdef NEXT_BOT
|
||||
OnNavAreaChanged( NULL, m_lastNavArea );
|
||||
|
||||
|
||||
if ( m_lastNavArea )
|
||||
{
|
||||
m_lastNavArea->DecrementPlayerCount( m_registeredNavTeam, entindex() );
|
||||
@@ -3499,21 +3505,22 @@ void CBaseCombatCharacter::ClearLastKnownArea( void )
|
||||
m_lastNavArea = NULL;
|
||||
m_registeredNavTeam = TEAM_INVALID;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Handling editor removing the area we're standing upon
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBaseCombatCharacter::OnNavAreaRemoved( CNavArea *removedArea )
|
||||
{
|
||||
#ifdef NEXT_BOT
|
||||
if ( m_lastNavArea == removedArea )
|
||||
{
|
||||
ClearLastKnownArea();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Changing team, maintain associated data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -400,11 +400,19 @@ public:
|
||||
void SetPreventWeaponPickup( bool bPrevent ) { m_bPreventWeaponPickup = bPrevent; }
|
||||
bool m_bPreventWeaponPickup;
|
||||
|
||||
virtual CNavArea *GetLastKnownArea( void ) const { return m_lastNavArea; } // return the last nav area the player occupied - NULL if unknown
|
||||
virtual bool IsAreaTraversable( const CNavArea *area ) const; // return true if we can use the given area
|
||||
virtual CNavArea *GetLastKnownArea( void ) const
|
||||
{
|
||||
#ifdef NEXT_BOT
|
||||
return m_lastNavArea;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
} // return the last nav area the player occupied - NULL if unknown
|
||||
|
||||
virtual void ClearLastKnownArea( void );
|
||||
virtual void UpdateLastKnownArea( void ); // invoke this to update our last known nav area (since there is no think method chained to CBaseCombatCharacter)
|
||||
virtual void OnNavAreaChanged( CNavArea *enteredArea, CNavArea *leftArea ) { } // invoked (by UpdateLastKnownArea) when we enter a new nav area (or it is reset to NULL)
|
||||
virtual bool IsAreaTraversable( const CNavArea *area ) const; // return true if we can use the given area
|
||||
virtual void OnNavAreaRemoved( CNavArea *removedArea );
|
||||
|
||||
// -----------------------
|
||||
|
||||
@@ -1968,7 +1968,7 @@ void CNPC_Barnacle::OnTongueTipUpdated()
|
||||
//-----------------------------------------------------------------------------
|
||||
void CNPC_Barnacle::UpdateTongue( void )
|
||||
{
|
||||
if ( m_hTongueTip == NULL )
|
||||
if ( m_hTongueTip == NULL || m_hTongueTip->m_pSpring == NULL )
|
||||
return;
|
||||
|
||||
// Set the spring's length to that of the tongue's extension
|
||||
|
||||
@@ -150,8 +150,8 @@ void PointCameraSetupVisibility( CBaseEntity *pPlayer, int area, unsigned char *
|
||||
pCameraEnt->SetActive( false );
|
||||
}
|
||||
|
||||
int nNext;
|
||||
for ( int i = g_InfoCameraLinkList.Head(); i != g_InfoCameraLinkList.InvalidIndex(); i = nNext )
|
||||
intp nNext;
|
||||
for ( intp i = g_InfoCameraLinkList.Head(); i != g_InfoCameraLinkList.InvalidIndex(); i = nNext )
|
||||
{
|
||||
nNext = g_InfoCameraLinkList.Next( i );
|
||||
|
||||
|
||||
@@ -73,7 +73,6 @@ public:
|
||||
bool operator()( CBaseCombatCharacter *actor )
|
||||
{
|
||||
actor->OnNavAreaRemoved( m_deadArea );
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -200,12 +199,12 @@ public:
|
||||
{
|
||||
#if PLATFORM_64BITS
|
||||
COMPILE_TIME_ASSERT( sizeof(CNavArea *) == 8 );
|
||||
int64 key[2] = { (int64)item.pAreas[0] + (int64)item.pAreas[1]->GetID(), (int64)item.pAreas[1] + (int64)item.pAreas[0]->GetID() };
|
||||
int64 key[2] = { (int64)(item.pAreas[0] + item.pAreas[1]->GetID()), (int64)(item.pAreas[1] + item.pAreas[0]->GetID()) };
|
||||
return Hash16( key );
|
||||
#else
|
||||
COMPILE_TIME_ASSERT( sizeof(CNavArea *) == 4 );
|
||||
int key[2] = { (int)(item.pAreas[0] + item.pAreas[1]->GetID()), (int)(item.pAreas[1] + item.pAreas[0]->GetID()) };
|
||||
return Hash8( key );
|
||||
return Hash8( key );
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,7 +45,9 @@ class CShowZone : public IForEachNavArea
|
||||
public:
|
||||
virtual bool Inspect( const CNavArea *area )
|
||||
{
|
||||
#ifdef NEXT_BOT
|
||||
area->DrawFilled( 255, 255, 0, 255, 9999.9f );
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -50,20 +50,22 @@ public:
|
||||
virtual void OnPostQuery( SpatialPartitionListMask_t listMask );
|
||||
|
||||
void AddEntity( CBaseEntity *pEntity );
|
||||
|
||||
|
||||
~CDirtySpatialPartitionEntityList();
|
||||
void LockPartitionForRead()
|
||||
{
|
||||
if ( m_readLockCount == 0 )
|
||||
int nThreadId = g_nThreadID;
|
||||
if ( m_nReadLockCount[nThreadId] == 0 )
|
||||
{
|
||||
m_partitionMutex.LockForRead();
|
||||
}
|
||||
m_readLockCount++;
|
||||
m_nReadLockCount[nThreadId]++;
|
||||
}
|
||||
void UnlockPartitionForRead()
|
||||
{
|
||||
m_readLockCount--;
|
||||
if ( m_readLockCount == 0 )
|
||||
int nThreadId = g_nThreadID;
|
||||
m_nReadLockCount[nThreadId]--;
|
||||
if ( m_nReadLockCount[nThreadId] == 0 )
|
||||
{
|
||||
m_partitionMutex.UnlockRead();
|
||||
}
|
||||
@@ -71,6 +73,8 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
int m_nReadLockCount[MAX_THREADS_SUPPORTED];
|
||||
|
||||
CTSListWithFreeList<CBaseHandle> m_DirtyEntities;
|
||||
CThreadSpinRWLock m_partitionMutex;
|
||||
uint32 m_partitionWriteId;
|
||||
@@ -106,7 +110,7 @@ void UpdateDirtySpatialPartitionEntities()
|
||||
CDirtySpatialPartitionEntityList::CDirtySpatialPartitionEntityList( char const *name ) : CAutoGameSystem( name )
|
||||
{
|
||||
m_DirtyEntities.Purge();
|
||||
m_readLockCount = 0;
|
||||
memset( m_nReadLockCount, 0, sizeof( m_nReadLockCount ) );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -164,7 +168,9 @@ void CDirtySpatialPartitionEntityList::OnPreQuery( SpatialPartitionListMask_t li
|
||||
if ( !( listMask & validMask ) )
|
||||
return;
|
||||
|
||||
if ( m_partitionWriteId != 0 && m_partitionWriteId == ThreadGetCurrentId() )
|
||||
int nThreadID = g_nThreadID;
|
||||
|
||||
if ( m_partitionWriteId != 0 && m_partitionWriteId == nThreadID + 1 )
|
||||
return;
|
||||
|
||||
#ifdef CLIENT_DLL
|
||||
@@ -180,11 +186,11 @@ void CDirtySpatialPartitionEntityList::OnPreQuery( SpatialPartitionListMask_t li
|
||||
// or became dirty due to some other thread or callback. Updating them may cause corruption further up the
|
||||
// stack (e.g. partition iterator). Ignoring the state change should be safe since it happened after the
|
||||
// trace was requested or was unable to be resolved in a previous attempt (still dirty).
|
||||
if ( m_DirtyEntities.Count() && !m_readLockCount )
|
||||
if ( m_DirtyEntities.Count() && !m_nReadLockCount[nThreadID] )
|
||||
{
|
||||
CUtlVector< CBaseHandle > vecStillDirty;
|
||||
m_partitionMutex.LockForWrite();
|
||||
m_partitionWriteId = ThreadGetCurrentId();
|
||||
m_partitionWriteId = nThreadID + 1;
|
||||
CTSListWithFreeList<CBaseHandle>::Node_t *pCurrent, *pNext;
|
||||
while ( ( pCurrent = m_DirtyEntities.Detach() ) != NULL )
|
||||
{
|
||||
|
||||
@@ -1814,7 +1814,7 @@ CAmmoDef *GetAmmoDef()
|
||||
def.AddAmmoType("Thumper", DMG_SONIC, TRACER_NONE, 10, 10, 2, 0, 0 );
|
||||
def.AddAmmoType("Gravity", DMG_CLUB, TRACER_NONE, 0, 0, 8, 0, 0 );
|
||||
// def.AddAmmoType("Extinguisher", DMG_BURN, TRACER_NONE, 0, 0, 100, 0, 0 );
|
||||
def.AddAmmoType("Battery", DMG_CLUB, TRACER_NONE, NULL, NULL, NULL, 0, 0 );
|
||||
def.AddAmmoType("Battery", DMG_CLUB, TRACER_NONE, 0, 0, 0, 0, 0 );
|
||||
def.AddAmmoType("GaussEnergy", DMG_SHOCK, TRACER_NONE, "sk_jeep_gauss_damage", "sk_jeep_gauss_damage", "sk_max_gauss_round", BULLET_IMPULSE(650, 8000), 0 ); // hit like a 10kg weight at 400 in/s
|
||||
def.AddAmmoType("CombineCannon", DMG_BULLET, TRACER_LINE, "sk_npc_dmg_gunship_to_plr", "sk_npc_dmg_gunship", NULL, 1.5 * 750 * 12, 0 ); // hit like a 1.5kg weight at 750 ft/s
|
||||
def.AddAmmoType("AirboatGun", DMG_AIRBOAT, TRACER_LINE, "sk_plr_dmg_airboat", "sk_npc_dmg_airboat", NULL, BULLET_IMPULSE(10, 600), 0 );
|
||||
|
||||
@@ -43,7 +43,7 @@ struct PhysBlockHeader_t
|
||||
BEGIN_SIMPLE_DATADESC( PhysBlockHeader_t )
|
||||
DEFINE_FIELD( nSaved, FIELD_INTEGER ),
|
||||
// NOTE: We want to save the actual address here for remapping, so use an integer
|
||||
DEFINE_FIELD( pWorldObject, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( pWorldObject, FIELD_POINTER ),
|
||||
END_DATADESC()
|
||||
|
||||
#if defined(_STATIC_LINKED) && defined(CLIENT_DLL)
|
||||
|
||||
@@ -40,7 +40,7 @@ void CRagdollLowViolenceManager::SetLowViolence( const char *pMapName )
|
||||
|
||||
#if !defined( CLIENT_DLL )
|
||||
// the server doesn't worry about low violence during multiplayer games
|
||||
if ( g_pGameRules->IsMultiplayer() )
|
||||
if ( g_pGameRules && g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
m_bLowViolence = false;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,8 @@ static int gSizes[FIELD_TYPECOUNT] =
|
||||
FIELD_SIZE( FIELD_MATERIALINDEX ),
|
||||
|
||||
FIELD_SIZE( FIELD_VECTOR2D ),
|
||||
FIELD_SIZE( FIELD_INTEGER64 ),
|
||||
FIELD_SIZE( FIELD_INTEGER64 ),
|
||||
FIELD_SIZE( FIELD_POINTER ),
|
||||
};
|
||||
|
||||
|
||||
@@ -687,7 +688,7 @@ bool CSave::ShouldSaveField( const void *pData, typedescription_t *pField )
|
||||
int *pEHandle = (int *)pData;
|
||||
for ( int i = 0; i < pField->fieldSize; ++i, ++pEHandle )
|
||||
{
|
||||
if ( (*pEHandle) != 0xFFFFFFFF )
|
||||
if ( (*pEHandle) != INVALID_EHANDLE_INDEX )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -721,11 +722,11 @@ bool CSave::WriteBasicField( const char *pname, void *pData, datamap_t *pRootMap
|
||||
case FIELD_FLOAT:
|
||||
WriteFloat( pField->fieldName, (float *)pData, pField->fieldSize );
|
||||
break;
|
||||
|
||||
|
||||
case FIELD_STRING:
|
||||
WriteString( pField->fieldName, (string_t *)pData, pField->fieldSize );
|
||||
break;
|
||||
|
||||
|
||||
case FIELD_VECTOR:
|
||||
WriteVector( pField->fieldName, (Vector *)pData, pField->fieldSize );
|
||||
break;
|
||||
@@ -1242,19 +1243,19 @@ bool CSave::WriteGameField( const char *pname, void *pData, datamap_t *pRootMap,
|
||||
case FIELD_CLASSPTR:
|
||||
WriteEntityPtr( pField->fieldName, (CBaseEntity **)pData, pField->fieldSize );
|
||||
break;
|
||||
|
||||
|
||||
case FIELD_EDICT:
|
||||
WriteEdictPtr( pField->fieldName, (edict_t **)pData, pField->fieldSize );
|
||||
break;
|
||||
|
||||
|
||||
case FIELD_EHANDLE:
|
||||
WriteEHandle( pField->fieldName, (EHANDLE *)pData, pField->fieldSize );
|
||||
break;
|
||||
|
||||
|
||||
case FIELD_POSITION_VECTOR:
|
||||
WritePositionVector( pField->fieldName, (Vector *)pData, pField->fieldSize );
|
||||
break;
|
||||
|
||||
|
||||
case FIELD_TIME:
|
||||
WriteTime( pField->fieldName, (float *)pData, pField->fieldSize );
|
||||
break;
|
||||
@@ -1262,7 +1263,7 @@ bool CSave::WriteGameField( const char *pname, void *pData, datamap_t *pRootMap,
|
||||
case FIELD_TICK:
|
||||
WriteTick( pField->fieldName, (int *)pData, pField->fieldSize );
|
||||
break;
|
||||
|
||||
|
||||
case FIELD_MODELINDEX:
|
||||
{
|
||||
int nModelIndex = *(int*)pData;
|
||||
@@ -1298,7 +1299,7 @@ bool CSave::WriteGameField( const char *pname, void *pData, datamap_t *pRootMap,
|
||||
case FIELD_FUNCTION:
|
||||
WriteFunction( pRootMap, pField->fieldName, (inputfunc_t **)(char *)pData, pField->fieldSize );
|
||||
break;
|
||||
|
||||
|
||||
case FIELD_VMATRIX:
|
||||
WriteVMatrix( pField->fieldName, (VMatrix *)pData, pField->fieldSize );
|
||||
break;
|
||||
@@ -1314,6 +1315,10 @@ bool CSave::WriteGameField( const char *pname, void *pData, datamap_t *pRootMap,
|
||||
WriteInterval( pField->fieldName, (interval_t *)pData, pField->fieldSize );
|
||||
break;
|
||||
|
||||
case FIELD_POINTER:
|
||||
WriteData( pField->fieldName, sizeof(void*)*pField->fieldSize, (char *)pData );
|
||||
break;
|
||||
|
||||
default:
|
||||
Warning( "Bad field type\n" );
|
||||
Assert(0);
|
||||
@@ -2154,6 +2159,10 @@ void CRestore::ReadGameField( const SaveRestoreRecordHeader_t &header, void *pDe
|
||||
ReadInterval( (interval_t *)pDest, pField->fieldSize, header.size );
|
||||
break;
|
||||
|
||||
case FIELD_POINTER:
|
||||
ReadData( (char *)pDest, sizeof(void*)*pField->fieldSize, header.size );
|
||||
break;
|
||||
|
||||
default:
|
||||
Warning( "Bad field type\n" );
|
||||
Assert(0);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
template <class UTLMAP, int KEY_TYPE, int FIELD_TYPE>
|
||||
template <class UTLMAP, intp KEY_TYPE, intp FIELD_TYPE>
|
||||
class CUtlMapDataOps : public CDefSaveRestoreOps
|
||||
{
|
||||
public:
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
template <int KEYTYPE, int FIELD_TYPE>
|
||||
template <intp KEYTYPE, intp FIELD_TYPE>
|
||||
class CUtlMapDataopsInstantiator
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user