Added WIP v142 toolset support based on Source SDK 2013: Community Edition repo

This commit is contained in:
Blixibon 2021-07-12 14:47:34 -05:00
parent 7ce328cbb9
commit 9b795b3c51
58 changed files with 427 additions and 194 deletions

View File

@ -80,7 +80,7 @@ public:
QAngle m_angRotation; QAngle m_angRotation;
Vector m_vOriginVelocity; Vector m_vOriginVelocity;
int m_nLastFramecount : 31; int m_nLastFramecount : 31;
int m_bAnglesComputed : 1; bool m_bAnglesComputed : 1;
}; };

View File

@ -4927,9 +4927,15 @@ C_BaseEntity *C_BaseEntity::Instance( int iEnt )
} }
#ifdef WIN32 #ifdef WIN32
#if _MSC_VER < 1900
#pragma warning( push ) #pragma warning( push )
#include <typeinfo.h> #include <typeinfo.h>
#pragma warning( pop ) #pragma warning( pop )
#else
#include <typeinfo>
#endif
#endif #endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -1263,7 +1263,7 @@ public:
#ifdef _DEBUG #ifdef _DEBUG
void FunctionCheck( void *pFunction, const char *name ); void FunctionCheck( void *pFunction, const char *name );
ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name ) ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, const char *name )
{ {
//COMPILE_TIME_ASSERT( sizeof(func) == 4 ); //COMPILE_TIME_ASSERT( sizeof(func) == 4 );
m_pfnTouch = func; m_pfnTouch = func;

View File

@ -528,15 +528,15 @@ void CLCD::ShowItems_R( CLCDPage *page, unsigned int dwCurTime, CUtlVector< CLCD
{ {
CLCDItem *newItem = NULL; CLCDItem *newItem = NULL;
CLCDItem *item = ag->m_Definition[ r ]; CLCDItem *itemLocl = ag->m_Definition[ r ];
switch ( item->m_Type ) switch ( itemLocl->m_Type )
{ {
default: default:
break; break;
case LCDITEM_TEXT: case LCDITEM_TEXT:
{ {
CLCDItemText *text = static_cast< CLCDItemText * >( item ); CLCDItemText *text = static_cast< CLCDItemText * >( itemLocl );
CUtlString s; CUtlString s;
s = text->m_OriginalText; s = text->m_OriginalText;
Replace( s, prefix, s1 ); Replace( s, prefix, s1 );
@ -551,7 +551,7 @@ void CLCD::ShowItems_R( CLCDPage *page, unsigned int dwCurTime, CUtlVector< CLCD
// text->m_OriginalText = s; // text->m_OriginalText = s;
CLCDItemText *copy = static_cast< CLCDItemText * >( page->Alloc( item->m_Type ) ); CLCDItemText *copy = static_cast< CLCDItemText * >( page->Alloc( itemLocl->m_Type ) );
*copy = *text; *copy = *text;
copy->m_bActive = true; copy->m_bActive = true;
copy->m_OriginalText = s; copy->m_OriginalText = s;
@ -564,8 +564,8 @@ void CLCD::ShowItems_R( CLCDPage *page, unsigned int dwCurTime, CUtlVector< CLCD
break; break;
case LCDITEM_ICON: case LCDITEM_ICON:
{ {
CLCDItemIcon *icon = static_cast< CLCDItemIcon * >( item ); CLCDItemIcon *icon = static_cast< CLCDItemIcon * >( itemLocl );
CLCDItemIcon *copy = static_cast< CLCDItemIcon * >( page->Alloc( item->m_Type ) ); CLCDItemIcon *copy = static_cast< CLCDItemIcon * >( page->Alloc( itemLocl->m_Type ) );
*copy = *icon; *copy = *icon;
copy->m_bActive = true; copy->m_bActive = true;
copy->Create( m_lcd ); copy->Create( m_lcd );
@ -1186,16 +1186,16 @@ void CLCD::DumpPlayer()
C_Team *team = player->GetTeam(); C_Team *team = player->GetTeam();
if ( team ) if ( team )
{ {
CDescribeData helper( team ); CDescribeData helperLocl( team );
helper.DumpDescription( team->GetPredDescMap() ); helperLocl.DumpDescription( team->GetPredDescMap() );
} }
Msg( "(playerresource)\n\n" ); Msg( "(playerresource)\n\n" );
if ( g_PR ) if ( g_PR )
{ {
CDescribeData helper( g_PR ); CDescribeData helperLocl( g_PR );
helper.DumpDescription( g_PR->GetPredDescMap() ); helperLocl.DumpDescription( g_PR->GetPredDescMap() );
} }
Msg( "(localplayerweapon)\n\n" ); Msg( "(localplayerweapon)\n\n" );
@ -1203,8 +1203,8 @@ void CLCD::DumpPlayer()
C_BaseCombatWeapon *active = player->GetActiveWeapon(); C_BaseCombatWeapon *active = player->GetActiveWeapon();
if ( active ) if ( active )
{ {
CDescribeData helper( active ); CDescribeData helperLocl( active );
helper.DumpDescription( active->GetPredDescMap() ); helperLocl.DumpDescription( active->GetPredDescMap() );
} }
Msg( "Other replacements:\n\n" ); Msg( "Other replacements:\n\n" );

View File

@ -21,9 +21,15 @@ static CPDumpPanel *g_pPDumpPanel = NULL;
// we pragma'd away in platform.h, so this little compiler specific hack will eliminate those warnings while // we pragma'd away in platform.h, so this little compiler specific hack will eliminate those warnings while
// retaining our own warning setup...ywb // retaining our own warning setup...ywb
#ifdef WIN32 #ifdef WIN32
#if _MSC_VER < 1900
#pragma warning( push ) #pragma warning( push )
#include <typeinfo.h> #include <typeinfo.h>
#pragma warning( pop ) #pragma warning( pop )
#else
#include <typeinfo>
#endif
#endif #endif
using namespace vgui; using namespace vgui;

View File

@ -25,7 +25,9 @@
#include "tier0/icommandline.h" #include "tier0/icommandline.h"
#include "inputsystem/iinputsystem.h" #include "inputsystem/iinputsystem.h"
#include "inputsystem/ButtonCode.h" #include "inputsystem/ButtonCode.h"
#if _MSC_VER < 1900
#include "math.h" #include "math.h"
#endif
#include "tier1/convar_serverbounded.h" #include "tier1/convar_serverbounded.h"
#include "cam_thirdperson.h" #include "cam_thirdperson.h"

View File

@ -119,7 +119,7 @@ entities. Each one is useful under different conditions.
#include "tier0/fasttimer.h" #include "tier0/fasttimer.h"
#include "utllinkedlist.h" #include "utllinkedlist.h"
#include "utldict.h" #include "utldict.h"
#ifdef WIN32 #if defined(WIN32) && _MSC_VER < 1900
#include <typeinfo.h> #include <typeinfo.h>
#else #else
#include <typeinfo> #include <typeinfo>

View File

@ -6,7 +6,7 @@
//=============================================================================// //=============================================================================//
#include "cbase.h" #include "cbase.h"
#include "c_baseentity.h" #include "c_baseentity.h"
#ifdef WIN32 #if defined(WIN32) && _MSC_VER < 1900
#include <typeinfo.h> #include <typeinfo.h>
#endif #endif
#include "tier0/vprof.h" #include "tier0/vprof.h"

View File

@ -121,7 +121,7 @@ char *CHudTextMessage::BufferedLocaliseTextString( const char *msg )
char *CHudTextMessage::LookupString( const char *msg, int *msg_dest ) char *CHudTextMessage::LookupString( const char *msg, int *msg_dest )
{ {
if ( !msg ) if ( !msg )
return ""; return (char*)"";
// '#' character indicates this is a reference to a string in titles.txt, and not the string itself // '#' character indicates this is a reference to a string in titles.txt, and not the string itself
if ( msg[0] == '#' ) if ( msg[0] == '#' )

View File

@ -892,7 +892,7 @@ bool IsListeningToCommentary( void )
void CPointCommentaryNode::Spawn( void ) void CPointCommentaryNode::Spawn( void )
{ {
// No model specified? // No model specified?
char *szModel = (char *)STRING( GetModelName() ); const char *szModel = STRING( GetModelName() );
if (!szModel || !*szModel) if (!szModel || !*szModel)
{ {
szModel = "models/extras/info_speech.mdl"; szModel = "models/extras/info_speech.mdl";

View File

@ -1272,7 +1272,7 @@ public:
#ifdef _DEBUG #ifdef _DEBUG
void FunctionCheck( void *pFunction, const char *name ); void FunctionCheck( void *pFunction, const char *name );
ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name ) ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, const char *name )
{ {
#ifdef GNUC #ifdef GNUC
COMPILE_TIME_ASSERT( sizeof(func) == 8 ); COMPILE_TIME_ASSERT( sizeof(func) == 8 );
@ -1283,7 +1283,7 @@ public:
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnTouch)), name ); FunctionCheck( *(reinterpret_cast<void **>(&m_pfnTouch)), name );
return func; return func;
} }
USEPTR UseSet( USEPTR func, char *name ) USEPTR UseSet( USEPTR func, const char *name )
{ {
#ifdef GNUC #ifdef GNUC
COMPILE_TIME_ASSERT( sizeof(func) == 8 ); COMPILE_TIME_ASSERT( sizeof(func) == 8 );
@ -1294,7 +1294,7 @@ public:
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnUse)), name ); FunctionCheck( *(reinterpret_cast<void **>(&m_pfnUse)), name );
return func; return func;
} }
ENTITYFUNCPTR BlockedSet( ENTITYFUNCPTR func, char *name ) ENTITYFUNCPTR BlockedSet( ENTITYFUNCPTR func, const char *name )
{ {
#ifdef GNUC #ifdef GNUC
COMPILE_TIME_ASSERT( sizeof(func) == 8 ); COMPILE_TIME_ASSERT( sizeof(func) == 8 );

View File

@ -14,6 +14,13 @@
#include "sceneentity.h" #include "sceneentity.h"
#include "particles/particles.h" #include "particles/particles.h"
#if _MSC_VER >= 1900
#include "icommandline.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Interface from engine to tools for manipulating entities // Interface from engine to tools for manipulating entities

View File

@ -412,7 +412,7 @@ void ExplosionCreate( const Vector &center, const QAngle &angles,
CEnvExplosion *pExplosion = (CEnvExplosion*)CBaseEntity::Create( "env_explosion", center, angles, pOwner ); CEnvExplosion *pExplosion = (CEnvExplosion*)CBaseEntity::Create( "env_explosion", center, angles, pOwner );
Q_snprintf( buf,sizeof(buf), "%3d", magnitude ); Q_snprintf( buf,sizeof(buf), "%3d", magnitude );
char *szKeyName = "iMagnitude"; const char *szKeyName = "iMagnitude";
char *szValue = buf; char *szValue = buf;
pExplosion->KeyValue( szKeyName, szValue ); pExplosion->KeyValue( szKeyName, szValue );

View File

@ -67,7 +67,7 @@ public: // CBaseGameSystem overrides
virtual void Shutdown(); virtual void Shutdown();
virtual void FrameUpdatePostEntityThink(); virtual void FrameUpdatePostEntityThink();
virtual void LevelInitPostEntity(); virtual void LevelInitPostEntity();
virtual char *GetFixedCameraEntityName( void ) { return "point_viewcontrol"; } virtual const char *GetFixedCameraEntityName( void ) { return "point_viewcontrol"; }
bool SetCameraMan( int iPlayerIndex ); bool SetCameraMan( int iPlayerIndex );
int GetCameraMan() { return m_iCameraManIndex; } int GetCameraMan() { return m_iCameraManIndex; }

View File

@ -303,7 +303,7 @@ void CNavMesh::CommandNavMergeMesh( const CCommand &args )
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
int NavMeshMergeAutocomplete( char const *partial, char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ] ) int NavMeshMergeAutocomplete( char const *partial, char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ] )
{ {
char *commandName = "nav_merge_mesh"; const char *commandName = "nav_merge_mesh";
int numMatches = 0; int numMatches = 0;
partial += Q_strlen( commandName ) + 1; partial += Q_strlen( commandName ) + 1;
int partialLength = Q_strlen( partial ); int partialLength = Q_strlen( partial );

View File

@ -7,12 +7,12 @@
#include "cbase.h" #include "cbase.h"
#ifdef _WIN32 #if POSIX || _MSC_VER >= 1900
#include <typeinfo>
#elif defined(_WIN32)
#include "typeinfo.h" #include "typeinfo.h"
// BUGBUG: typeinfo stomps some of the warning settings (in yvals.h) // BUGBUG: typeinfo stomps some of the warning settings (in yvals.h)
#pragma warning(disable:4244) #pragma warning(disable:4244)
#elif POSIX
#include <typeinfo>
#else #else
#error "need typeinfo defined" #error "need typeinfo defined"
#endif #endif
@ -942,8 +942,8 @@ void CBaseEntity::PhysicsDispatchThink( BASEPTR thinkFunc )
if ( thinkLimit ) if ( thinkLimit )
{ {
// calculate running time of the AI in milliseconds // calculate running time of the AI in milliseconds
float time = ( engine->Time() - startTime ) * 1000.0f; float flTime = ( engine->Time() - startTime ) * 1000.0f;
if ( time > thinkLimit ) if ( flTime > thinkLimit )
{ {
#if defined( _XBOX ) && !defined( _RETAIL ) #if defined( _XBOX ) && !defined( _RETAIL )
if ( vprof_think_limit.GetBool() ) if ( vprof_think_limit.GetBool() )
@ -956,14 +956,14 @@ void CBaseEntity::PhysicsDispatchThink( BASEPTR thinkFunc )
CAI_BaseNPC *pNPC = MyNPCPointer(); CAI_BaseNPC *pNPC = MyNPCPointer();
if (pNPC && pNPC->GetCurSchedule()) if (pNPC && pNPC->GetCurSchedule())
{ {
pNPC->ReportOverThinkLimit( time ); pNPC->ReportOverThinkLimit( flTime );
} }
else else
{ {
#ifdef _WIN32 #ifdef _WIN32
Msg( "%s(%s) thinking for %.02f ms!!!\n", GetClassname(), typeid(this).raw_name(), time ); Msg( "%s(%s) thinking for %.02f ms!!!\n", GetClassname(), typeid(this).raw_name(), flTime );
#elif POSIX #elif POSIX
Msg( "%s(%s) thinking for %.02f ms!!!\n", GetClassname(), typeid(this).name(), time ); Msg( "%s(%s) thinking for %.02f ms!!!\n", GetClassname(), typeid(this).name(), flTime );
#else #else
#error "typeinfo" #error "typeinfo"
#endif #endif

View File

@ -25,7 +25,7 @@ public:
{ {
} }
~CGameEventListener() virtual ~CGameEventListener()
{ {
StopListeningForAllEvents(); StopListeningForAllEvents();
} }

View File

@ -1126,7 +1126,7 @@ float CountdownTimer::Now( void ) const
#endif #endif
char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *pFilename ) const char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *pFilename )
{ {
const char *pValue = pSub->GetString( pName, NULL ); const char *pValue = pSub->GetString( pName, NULL );
if ( !pValue ) if ( !pValue )

View File

@ -606,7 +606,7 @@ private:
float Now( void ) const; // work-around since client header doesn't like inlined gpGlobals->curtime float Now( void ) const; // work-around since client header doesn't like inlined gpGlobals->curtime
}; };
char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *pFilename = NULL ); const char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *pFilename = NULL );
int UTIL_StringFieldToInt( const char *szValue, const char **pValueStrings, int iNumStrings ); int UTIL_StringFieldToInt( const char *szValue, const char **pValueStrings, int iNumStrings );

View File

@ -1015,12 +1015,12 @@ CPolyhedron *ClipLinkedGeometry( GeneratePolyhedronFromPlanes_UnorderedPolygonLL
//Scan for onplane points connected to only other onplane/dead points, these points get downgraded to dead status. //Scan for onplane points connected to only other onplane/dead points, these points get downgraded to dead status.
{ {
GeneratePolyhedronFromPlanes_UnorderedPointLL *pActivePointWalk = pAllPoints; GeneratePolyhedronFromPlanes_UnorderedPointLL *pActivePointWalkLocl = pAllPoints;
do do
{ {
if( pActivePointWalk->pPoint->planarity == POINT_ONPLANE ) if( pActivePointWalkLocl->pPoint->planarity == POINT_ONPLANE )
{ {
GeneratePolyhedronFromPlanes_LineLL *pOnPlaneLineWalk = pActivePointWalk->pPoint->pConnectedLines; GeneratePolyhedronFromPlanes_LineLL *pOnPlaneLineWalk = pActivePointWalkLocl->pPoint->pConnectedLines;
GeneratePolyhedronFromPlanes_LineLL *pStartLineWalk = pOnPlaneLineWalk; GeneratePolyhedronFromPlanes_LineLL *pStartLineWalk = pOnPlaneLineWalk;
bool bDead = true; //assume it's dead and disprove bool bDead = true; //assume it's dead and disprove
do do
@ -1047,7 +1047,7 @@ CPolyhedron *ClipLinkedGeometry( GeneratePolyhedronFromPlanes_UnorderedPolygonLL
if( bDead ) if( bDead )
{ {
pActivePointWalk->pPoint->planarity = POINT_DEAD; pActivePointWalkLocl->pPoint->planarity = POINT_DEAD;
pOnPlaneLineWalk = pStartLineWalk; pOnPlaneLineWalk = pStartLineWalk;
@ -1059,8 +1059,8 @@ CPolyhedron *ClipLinkedGeometry( GeneratePolyhedronFromPlanes_UnorderedPolygonLL
} while( pOnPlaneLineWalk != pStartLineWalk ); } while( pOnPlaneLineWalk != pStartLineWalk );
} }
} }
pActivePointWalk = pActivePointWalk->pNext; pActivePointWalkLocl = pActivePointWalkLocl->pNext;
} while( pActivePointWalk ); } while( pActivePointWalkLocl );
} }
#ifdef _DEBUG #ifdef _DEBUG
PlaneCutHistory.AddToTail( &pOutwardFacingPlanes[iCurrentPlane * 4] ); PlaneCutHistory.AddToTail( &pOutwardFacingPlanes[iCurrentPlane * 4] );
@ -1337,17 +1337,17 @@ CPolyhedron *ClipLinkedGeometry( GeneratePolyhedronFromPlanes_UnorderedPolygonLL
//verify that the new point isn't sitting on top of another //verify that the new point isn't sitting on top of another
{ {
GeneratePolyhedronFromPlanes_UnorderedPointLL *pActivePointWalk = pAllPoints; GeneratePolyhedronFromPlanes_UnorderedPointLL *pActivePointWalkLocl = pAllPoints;
do do
{ {
if( pActivePointWalk->pPoint != pNewPoint ) if( pActivePointWalkLocl->pPoint != pNewPoint )
{ {
Vector vDiff = pActivePointWalk->pPoint->ptPosition - pNewPoint->ptPosition; Vector vDiff = pActivePointWalkLocl->pPoint->ptPosition - pNewPoint->ptPosition;
AssertMsg_DumpPolyhedron( vDiff.Length() > fOnPlaneEpsilon, "Generated a point on top of another" ); AssertMsg_DumpPolyhedron( vDiff.Length() > fOnPlaneEpsilon, "Generated a point on top of another" );
} }
pActivePointWalk = pActivePointWalk->pNext; pActivePointWalkLocl = pActivePointWalk->pNext;
} while( pActivePointWalk ); } while( pActivePointWalkLocl );
} }
#endif #endif

View File

@ -141,11 +141,11 @@ void CScratchPadGraph::UpdateTicksAndStuff( float flTime, float flValue )
// Extend the lines attached to the time labels. // Extend the lines attached to the time labels.
for ( int i=0; i < m_nTimeLabelsDrawn; i++ ) for ( int i=0; i < m_nTimeLabelsDrawn; i++ )
{ {
float flTime = m_flTimeOrigin + m_nTimeLabelsDrawn * m_flTimeLabelEveryNSeconds; float flTimeLocl = m_flTimeOrigin + m_nTimeLabelsDrawn * m_flTimeLabelEveryNSeconds;
m_pPad->DrawLine( m_pPad->DrawLine(
CSPVert((const Vector&) GetSamplePosition( flTime, m_flHighestValue )), CSPVert((const Vector&) GetSamplePosition( flTimeLocl, m_flHighestValue )),
CSPVert((const Vector&) GetSamplePosition( flTime, flValue ) ) CSPVert((const Vector&) GetSamplePosition( flTimeLocl, flValue ) )
); );
} }
@ -158,21 +158,21 @@ void CScratchPadGraph::UpdateTicksAndStuff( float flTime, float flValue )
{ {
CTextParams params; CTextParams params;
float flTime = m_flTimeOrigin + m_nTimeLabelsDrawn * m_flTimeLabelEveryNSeconds; float flTimeLocl = m_flTimeOrigin + m_nTimeLabelsDrawn * m_flTimeLabelEveryNSeconds;
params.m_bSolidBackground = true; params.m_bSolidBackground = true;
params.m_vPos = GetSamplePosition( flTime, m_flValueOrigin-5 ); params.m_vPos = GetSamplePosition( flTimeLocl, m_flValueOrigin-5 );
params.m_bTwoSided = true; params.m_bTwoSided = true;
char str[512]; char str[512];
Q_snprintf( str, sizeof( str ), "time: %.2f", flTime ); Q_snprintf( str, sizeof( str ), "time: %.2f", flTimeLocl );
m_pPad->DrawText( str, params ); m_pPad->DrawText( str, params );
// Now draw the vertical line for the value.. // Now draw the vertical line for the value..
m_pPad->DrawLine( m_pPad->DrawLine(
CSPVert( (const Vector&)GetSamplePosition( flTime, m_flValueOrigin ) ), CSPVert( (const Vector&)GetSamplePosition( flTimeLocl, m_flValueOrigin ) ),
CSPVert( (const Vector&)GetSamplePosition( flTime, m_flHighestValue ) ) CSPVert( (const Vector&)GetSamplePosition( flTimeLocl, m_flHighestValue ) )
); );

View File

@ -21,7 +21,7 @@ enum NormalDecodeMode_t
}; };
// Forward declaration // Forward declaration
#ifdef _WIN32 #if defined(_WIN32) && _MSC_VER < 1900
typedef enum _D3DFORMAT D3DFORMAT; typedef enum _D3DFORMAT D3DFORMAT;
#endif #endif
@ -103,7 +103,7 @@ enum ImageFormat
NUM_IMAGE_FORMATS NUM_IMAGE_FORMATS
}; };
#if defined( POSIX ) || defined( DX_TO_GL_ABSTRACTION ) #if defined( POSIX ) || defined( DX_TO_GL_ABSTRACTION ) || _MSC_VER >= 1900
typedef enum _D3DFORMAT typedef enum _D3DFORMAT
{ {
D3DFMT_INDEX16, D3DFMT_INDEX16,

View File

@ -933,8 +933,8 @@ static void CalcVirtualAnimation( virtualmodel_t *pVModel, const CStudioHdr *pSt
{ {
if (pStudioHdr->boneFlags(i) & boneMask) if (pStudioHdr->boneFlags(i) & boneMask)
{ {
int j = pSeqGroup->boneMap[i]; int l = pSeqGroup->boneMap[i];
if (j >= 0 && pweight[j] > 0.0f) if (l >= 0 && pweight[l] > 0.0f)
{ {
if (animdesc.flags & STUDIO_DELTA) if (animdesc.flags & STUDIO_DELTA)
{ {
@ -943,13 +943,13 @@ static void CalcVirtualAnimation( virtualmodel_t *pVModel, const CStudioHdr *pSt
} }
else if (pSeqLinearBones) else if (pSeqLinearBones)
{ {
q[i] = pSeqLinearBones->quat(j); q[i] = pSeqLinearBones->quat(l);
pos[i] = pSeqLinearBones->pos(j); pos[i] = pSeqLinearBones->pos(l);
} }
else else
{ {
q[i] = pSeqbone[j].quat; q[i] = pSeqbone[l].quat;
pos[i] = pSeqbone[j].pos; pos[i] = pSeqbone[l].pos;
} }
#ifdef STUDIO_ENABLE_PERF_COUNTERS #ifdef STUDIO_ENABLE_PERF_COUNTERS
pStudioHdr->m_nPerfUsedBones++; pStudioHdr->m_nPerfUsedBones++;
@ -997,10 +997,9 @@ static void CalcVirtualAnimation( virtualmodel_t *pVModel, const CStudioHdr *pSt
matrix3x4_t *boneToWorld = g_MatrixPool.Alloc(); matrix3x4_t *boneToWorld = g_MatrixPool.Alloc();
CBoneBitList boneComputed; CBoneBitList boneComputed;
int i; for (int l = 0; i < animdesc.numlocalhierarchy; i++)
for (i = 0; i < animdesc.numlocalhierarchy; i++)
{ {
mstudiolocalhierarchy_t *pHierarchy = animdesc.pHierarchy( i ); mstudiolocalhierarchy_t *pHierarchy = animdesc.pHierarchy( l );
if ( !pHierarchy ) if ( !pHierarchy )
break; break;
@ -1141,10 +1140,9 @@ static void CalcAnimation( const CStudioHdr *pStudioHdr, Vector *pos, Quaternion
matrix3x4_t *boneToWorld = g_MatrixPool.Alloc(); matrix3x4_t *boneToWorld = g_MatrixPool.Alloc();
CBoneBitList boneComputed; CBoneBitList boneComputed;
int i; for (int j = 0; j < animdesc.numlocalhierarchy; j++)
for (i = 0; i < animdesc.numlocalhierarchy; i++)
{ {
mstudiolocalhierarchy_t *pHierarchy = animdesc.pHierarchy( i ); mstudiolocalhierarchy_t *pHierarchy = animdesc.pHierarchy( j );
if ( !pHierarchy ) if ( !pHierarchy )
break; break;
@ -5610,9 +5608,9 @@ bool Studio_AnimPosition( mstudioanimdesc_t *panim, float flCycle, Vector &vecPo
vecAngle.y = vecAngle.y * (1 - f) + pmove->angle * f; vecAngle.y = vecAngle.y * (1 - f) + pmove->angle * f;
if (iLoops != 0) if (iLoops != 0)
{ {
mstudiomovement_t *pmove = panim->pMovement( panim->nummovements - 1 ); mstudiomovement_t *pmoveLocl = panim->pMovement( panim->nummovements - 1 );
vecPos = vecPos + iLoops * pmove->position; vecPos = vecPos + iLoops * pmoveLocl->position;
vecAngle.y = vecAngle.y + iLoops * pmove->angle; vecAngle.y = vecAngle.y + iLoops * pmoveLocl->angle;
} }
return true; return true;
} }

View File

@ -134,7 +134,7 @@ void* SendProxy_LengthTable( const SendProp *pProp, const void *pStructBase, con
// Note: you have to be DILIGENT about calling NetworkStateChanged whenever an element in your CUtlVector changes // Note: you have to be DILIGENT about calling NetworkStateChanged whenever an element in your CUtlVector changes
// since CUtlVector doesn't do this automatically. // since CUtlVector doesn't do this automatically.
SendProp SendPropUtlVector( SendProp SendPropUtlVector(
char *pVarName, // Use SENDINFO_UTLVECTOR to generate these 4. const char *pVarName, // Use SENDINFO_UTLVECTOR to generate these 4.
int offset, // Used to generate pData in the function specified in varProxy. int offset, // Used to generate pData in the function specified in varProxy.
int sizeofVar, // The size of each element in the utlvector. int sizeofVar, // The size of each element in the utlvector.
EnsureCapacityFn ensureFn, // This is the value returned for elements out of the array's current range. EnsureCapacityFn ensureFn, // This is the value returned for elements out of the array's current range.

View File

@ -43,7 +43,7 @@
// ) // )
// //
SendProp SendPropUtlVector( SendProp SendPropUtlVector(
char *pVarName, // Use SENDINFO_UTLVECTOR to generate these first 4 parameters. const char *pVarName, // Use SENDINFO_UTLVECTOR to generate these first 4 parameters.
int offset, int offset,
int sizeofVar, int sizeofVar,
EnsureCapacityFn ensureFn, EnsureCapacityFn ensureFn,

View File

@ -138,6 +138,10 @@ void ConnectHaptics(CreateInterfaceFn appFactory)
HookHapticMessages(); HookHapticMessages();
} }
// deleting haptics results in a warning about deleting something with a non-virtual destructor
// big yikes but we can't do anything about it as it's accessed via interface
#pragma warning (disable: 5205)
void DisconnectHaptics() void DisconnectHaptics()
{ {
haptics->ShutdownHaptics(); haptics->ShutdownHaptics();

View File

@ -154,7 +154,7 @@ class CPositionInterpolator_Linear : public IPositionInterpolator
{ {
public: public:
virtual void Release(); virtual void Release();
virtual void GetDetails( char **outName, int *outMinKeyReq, int *outMaxKeyReq ); virtual void GetDetails( const char **outName, int *outMinKeyReq, int *outMaxKeyReq );
virtual void SetKeyPosition( int keyNum, Vector const &vPos ); virtual void SetKeyPosition( int keyNum, Vector const &vPos );
virtual void InterpolatePosition( float time, Vector &vOut ); virtual void InterpolatePosition( float time, Vector &vOut );
virtual bool ProcessKey( char const *pName, char const *pValue ) { return false; } virtual bool ProcessKey( char const *pName, char const *pValue ) { return false; }
@ -171,7 +171,7 @@ void CPositionInterpolator_Linear::Release()
{ {
} }
void CPositionInterpolator_Linear::GetDetails( char **outName, int *outMinKeyReq, int *outMaxKeyReq ) void CPositionInterpolator_Linear::GetDetails( const char **outName, int *outMinKeyReq, int *outMaxKeyReq )
{ {
*outName = "Linear"; *outName = "Linear";
*outMinKeyReq = 0; *outMinKeyReq = 0;
@ -201,7 +201,7 @@ class CPositionInterpolator_CatmullRom : public IPositionInterpolator
{ {
public: public:
virtual void Release(); virtual void Release();
virtual void GetDetails( char **outName, int *outMinKeyReq, int *outMaxKeyReq ); virtual void GetDetails( const char **outName, int *outMinKeyReq, int *outMaxKeyReq );
virtual void SetKeyPosition( int keyNum, Vector const &vPos ); virtual void SetKeyPosition( int keyNum, Vector const &vPos );
virtual void InterpolatePosition( float time, Vector &vOut ); virtual void InterpolatePosition( float time, Vector &vOut );
virtual bool ProcessKey( char const *pName, char const *pValue ) { return false; } virtual bool ProcessKey( char const *pName, char const *pValue ) { return false; }
@ -218,7 +218,7 @@ void CPositionInterpolator_CatmullRom::Release()
{ {
} }
void CPositionInterpolator_CatmullRom::GetDetails( char **outName, int *outMinKeyReq, int *outMaxKeyReq ) void CPositionInterpolator_CatmullRom::GetDetails( const char **outName, int *outMinKeyReq, int *outMaxKeyReq )
{ {
*outName = "Catmull-Rom Spline"; *outName = "Catmull-Rom Spline";
*outMinKeyReq = -1; *outMinKeyReq = -1;
@ -282,7 +282,7 @@ public:
CPositionInterpolator_Rope(); CPositionInterpolator_Rope();
virtual void Release(); virtual void Release();
virtual void GetDetails( char **outName, int *outMinKeyReq, int *outMaxKeyReq ); virtual void GetDetails( const char **outName, int *outMinKeyReq, int *outMaxKeyReq );
virtual void SetKeyPosition( int keyNum, Vector const &vPos ); virtual void SetKeyPosition( int keyNum, Vector const &vPos );
virtual void InterpolatePosition( float time, Vector &vOut ); virtual void InterpolatePosition( float time, Vector &vOut );
virtual bool ProcessKey( char const *pName, char const *pValue ); virtual bool ProcessKey( char const *pName, char const *pValue );
@ -319,7 +319,7 @@ void CPositionInterpolator_Rope::Release()
delete this; delete this;
} }
void CPositionInterpolator_Rope::GetDetails( char **outName, int *outMinKeyReq, int *outMaxKeyReq ) void CPositionInterpolator_Rope::GetDetails( const char **outName, int *outMinKeyReq, int *outMaxKeyReq )
{ {
*outName = "Rope"; *outName = "Rope";
*outMinKeyReq = 0; *outMinKeyReq = 0;
@ -433,7 +433,7 @@ typedef void (*RotationInterpolatorFunc_t)(float time, Quaternion &outRot);
typedef struct typedef struct
{ {
char *szName; const char *szName;
RotationInterpolatorFunc_t pFunc; RotationInterpolatorFunc_t pFunc;
// defines the range of keys this interpolator needs to function // defines the range of keys this interpolator needs to function
@ -458,7 +458,7 @@ int Motion_GetNumberOfRotationInterpolators( void )
return ARRAYSIZE(g_RotationInterpolators); return ARRAYSIZE(g_RotationInterpolators);
} }
bool Motion_GetRotationInterpolatorDetails( int rotInterpNum, char **outName, int *outMinKeyReq, int *outMaxKeyReq ) bool Motion_GetRotationInterpolatorDetails( int rotInterpNum, const char **outName, int *outMinKeyReq, int *outMaxKeyReq )
{ {
if ( rotInterpNum < 0 || rotInterpNum >= Motion_GetNumberOfRotationInterpolators() ) if ( rotInterpNum < 0 || rotInterpNum >= Motion_GetNumberOfRotationInterpolators() )
{ {

View File

@ -14,7 +14,7 @@ class IPositionInterpolator
public: public:
virtual void Release() = 0; virtual void Release() = 0;
virtual void GetDetails( char **outName, int *outMinKeyReq, int *outMaxKeyReq ) = 0; virtual void GetDetails( const char **outName, int *outMinKeyReq, int *outMaxKeyReq ) = 0;
virtual void SetKeyPosition( int keyNum, Vector const &vPos ) = 0; virtual void SetKeyPosition( int keyNum, Vector const &vPos ) = 0;
virtual void InterpolatePosition( float time, Vector &vOut ) = 0; virtual void InterpolatePosition( float time, Vector &vOut ) = 0;
@ -34,7 +34,7 @@ IPositionInterpolator* Motion_GetPositionInterpolator( int interpNum );
// Rotation interpolators. // Rotation interpolators.
int Motion_GetNumberOfRotationInterpolators( void ); int Motion_GetNumberOfRotationInterpolators( void );
bool Motion_GetRotationInterpolatorDetails( int rotInterpNum, char **outName, int *outMinKeyReq, int *outMaxKeyReq ); bool Motion_GetRotationInterpolatorDetails( int rotInterpNum, const char **outName, int *outMinKeyReq, int *outMaxKeyReq );
bool Motion_InterpolateRotation( float time, int interpFuncNum, Quaternion &outQuatRotation ); bool Motion_InterpolateRotation( float time, int interpFuncNum, Quaternion &outQuatRotation );
bool Motion_SetKeyAngles( int keyNum, Quaternion &quatAngles ); bool Motion_SetKeyAngles( int keyNum, Quaternion &quatAngles );

View File

@ -72,6 +72,10 @@ public:
void Init( char const* pTexture, const char *pTextureGroupName, bool bComplain = true ); void Init( char const* pTexture, const char *pTextureGroupName, bool bComplain = true );
void InitProceduralTexture( const char *pTextureName, const char *pTextureGroupName, int w, int h, ImageFormat fmt, int nFlags ); void InitProceduralTexture( const char *pTextureName, const char *pTextureGroupName, int w, int h, ImageFormat fmt, int nFlags );
void InitRenderTarget( int w, int h, RenderTargetSizeMode_t sizeMode, ImageFormat fmt, MaterialRenderTargetDepth_t depth, bool bHDR, char *pStrOptionalName = NULL ); void InitRenderTarget( int w, int h, RenderTargetSizeMode_t sizeMode, ImageFormat fmt, MaterialRenderTargetDepth_t depth, bool bHDR, char *pStrOptionalName = NULL );
void InitRenderTarget(int w, int h, RenderTargetSizeMode_t sizeMode, ImageFormat fmt, MaterialRenderTargetDepth_t depth, bool bHDR, const char* pStrOptionalName = NULL)
{
InitRenderTarget(w, h, sizeMode, fmt, depth, bHDR, const_cast<char*>(pStrOptionalName));
}
#if defined( _X360 ) #if defined( _X360 )
// used when RT coupling is disparate (texture is DDR based, surface is EDRAM based) // used when RT coupling is disparate (texture is DDR based, surface is EDRAM based)
void InitRenderTargetTexture( int width, int height, RenderTargetSizeMode_t sizeMode, ImageFormat fmt, MaterialRenderTargetDepth_t depth, bool bHDR, char *pStrOptionalName = NULL ); void InitRenderTargetTexture( int width, int height, RenderTargetSizeMode_t sizeMode, ImageFormat fmt, MaterialRenderTargetDepth_t depth, bool bHDR, char *pStrOptionalName = NULL );

View File

@ -744,9 +744,9 @@ private:
const type* Base() const { return m_Value; } \ const type* Base() const { return m_Value; } \
int Count() const { return count; } \ int Count() const { return count; } \
protected: \ protected: \
inline void NetworkStateChanged( int index ) \ inline void NetworkStateChanged( int _index ) \
{ \ { \
CHECK_USENETWORKVARS ((ThisClass*)(((char*)this) - MyOffsetOf(ThisClass,name)))->stateChangedFn( &m_Value[index] ); \ CHECK_USENETWORKVARS ((ThisClass*)(((char*)this) - MyOffsetOf(ThisClass,name)))->stateChangedFn( &m_Value[_index] ); \
} \ } \
type m_Value[count]; \ type m_Value[count]; \
}; \ }; \

View File

@ -181,7 +181,7 @@ class CGameSaveRestoreInfo
{ {
public: public:
CGameSaveRestoreInfo() CGameSaveRestoreInfo()
: tableCount( 0 ), pTable( 0 ), m_pCurrentEntity( 0 ), m_EntityToIndex( 1024 ) : m_iTableCount( 0 ), m_pTable( 0 ), m_pCurrentEntity( 0 ), m_EntityToIndex( 1024 )
{ {
memset( &levelInfo, 0, sizeof( levelInfo ) ); memset( &levelInfo, 0, sizeof( levelInfo ) );
modelSpaceOffset.Init( 0, 0, 0 ); modelSpaceOffset.Init( 0, 0, 0 );
@ -189,8 +189,8 @@ public:
void InitEntityTable( entitytable_t *pNewTable = NULL, int size = 0 ) void InitEntityTable( entitytable_t *pNewTable = NULL, int size = 0 )
{ {
pTable = pNewTable; m_pTable = pNewTable;
tableCount = size; m_iTableCount = size;
for ( int i = 0; i < NumEntities(); i++ ) for ( int i = 0; i < NumEntities(); i++ )
{ {
@ -200,17 +200,17 @@ public:
entitytable_t *DetachEntityTable() entitytable_t *DetachEntityTable()
{ {
entitytable_t *pReturn = pTable; entitytable_t *pReturn = m_pTable;
pTable = NULL; m_pTable = NULL;
tableCount = 0; m_iTableCount = 0;
return pReturn; return pReturn;
} }
CBaseEntity *GetCurrentEntityContext() { return m_pCurrentEntity; } CBaseEntity *GetCurrentEntityContext() { return m_pCurrentEntity; }
void SetCurrentEntityContext(CBaseEntity *pEntity) { m_pCurrentEntity = pEntity; } void SetCurrentEntityContext(CBaseEntity *pEntity) { m_pCurrentEntity = pEntity; }
int NumEntities() { return tableCount; } int NumEntities() { return m_iTableCount; }
entitytable_t *GetEntityInfo( int i ) { return (pTable + i); } entitytable_t *GetEntityInfo( int i ) { return (m_pTable + i); }
float GetBaseTime() const { return levelInfo.time; } float GetBaseTime() const { return levelInfo.time; }
Vector GetLandmark() const { return ( levelInfo.fUseLandmark ) ? levelInfo.vecLandmarkOffset : vec3_origin; } Vector GetLandmark() const { return ( levelInfo.fUseLandmark ) ? levelInfo.vecLandmarkOffset : vec3_origin; }
@ -218,13 +218,13 @@ public:
{ {
#ifdef GAME_DLL #ifdef GAME_DLL
int i; int i;
entitytable_t *pTable; entitytable_t *m_pTable;
int nEntities = NumEntities(); int nEntities = NumEntities();
for ( i = 0; i < nEntities; i++ ) for ( i = 0; i < nEntities; i++ )
{ {
pTable = GetEntityInfo( i ); m_pTable = GetEntityInfo( i );
m_EntityToIndex.Insert( CHashElement( pTable->hEnt.Get(), i ) ); m_EntityToIndex.Insert( CHashElement( m_pTable->hEnt.Get(), i ) );
} }
#endif #endif
} }
@ -269,8 +269,8 @@ public:
Vector modelSpaceOffset; // used only for globaly entity brushes modelled in different coordinate systems. Vector modelSpaceOffset; // used only for globaly entity brushes modelled in different coordinate systems.
private: private:
int tableCount; // Number of elements in the entity table int m_iTableCount; // Number of elements in the entity table
entitytable_t *pTable; // Array of entitytable_t elements (1 for each entity) entitytable_t *m_pTable; // Array of entitytable_t elements (1 for each entity)
CBaseEntity *m_pCurrentEntity; // only valid during the save functions of this entity, NULL otherwise CBaseEntity *m_pCurrentEntity; // only valid during the save functions of this entity, NULL otherwise

View File

@ -51,7 +51,7 @@ public:
m_pCachedRenderData = NULL; m_pCachedRenderData = NULL;
} }
~CBaseCommand() virtual ~CBaseCommand()
{ {
ReleaseCachedRenderData(); ReleaseCachedRenderData();
} }

View File

@ -508,7 +508,7 @@ void CSentence::ParseWords( CUtlBuffer& buf )
// Parse phoneme // Parse phoneme
int code; int code;
char phonemename[ 256 ]; char phonemename[ 256 ];
float start, end; float startLocl, endLocl;
float volume; float volume;
code = atoi( token ); code = atoi( token );
@ -516,9 +516,9 @@ void CSentence::ParseWords( CUtlBuffer& buf )
buf.GetString( token ); buf.GetString( token );
Q_strncpy( phonemename, token, sizeof( phonemename ) ); Q_strncpy( phonemename, token, sizeof( phonemename ) );
buf.GetString( token ); buf.GetString( token );
start = atof( token ); startLocl = atof( token );
buf.GetString( token ); buf.GetString( token );
end = atof( token ); endLocl = atof( token );
buf.GetString( token ); buf.GetString( token );
volume = atof( token ); volume = atof( token );
@ -526,8 +526,8 @@ void CSentence::ParseWords( CUtlBuffer& buf )
assert( pt ); assert( pt );
pt->SetPhonemeCode( code ); pt->SetPhonemeCode( code );
pt->SetTag( phonemename ); pt->SetTag( phonemename );
pt->SetStartTime( start ); pt->SetStartTime( startLocl );
pt->SetEndTime( end ); pt->SetEndTime( endLocl );
AddPhonemeTag( wt, pt ); AddPhonemeTag( wt, pt );
} }
@ -1304,9 +1304,9 @@ void CSentence::Append( float starttime, const CSentence& src )
// Offset times // Offset times
int c = newWord->m_Phonemes.Count(); int c = newWord->m_Phonemes.Count();
for ( int i = 0; i < c; ++i ) for ( int j = 0; j < c; ++j )
{ {
CPhonemeTag *tag = newWord->m_Phonemes[ i ]; CPhonemeTag *tag = newWord->m_Phonemes[ j ];
tag->AddStartTime( starttime ); tag->AddStartTime( starttime );
tag->AddEndTime( starttime ); tag->AddEndTime( starttime );
} }

View File

@ -516,7 +516,7 @@ void studiohdr_t::SetAttachmentBone( int iAttachment, int iBone )
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
char *studiohdr_t::pszNodeName( int iNode ) const char *studiohdr_t::pszNodeName( int iNode )
{ {
if (numincludemodels == 0) if (numincludemodels == 0)
{ {
@ -565,7 +565,7 @@ int studiohdr_t::GetActivityListVersion( void )
virtualmodel_t *pVModel = (virtualmodel_t *)GetVirtualModel(); virtualmodel_t *pVModel = (virtualmodel_t *)GetVirtualModel();
Assert( pVModel ); Assert( pVModel );
int version = activitylistversion; int versionLocl = activitylistversion;
int i; int i;
for (i = 1; i < pVModel->m_group.Count(); i++) for (i = 1; i < pVModel->m_group.Count(); i++)
@ -575,15 +575,15 @@ int studiohdr_t::GetActivityListVersion( void )
Assert( pStudioHdr ); Assert( pStudioHdr );
version = min( version, pStudioHdr->activitylistversion ); versionLocl = min( versionLocl, pStudioHdr->activitylistversion );
} }
return version; return versionLocl;
} }
void studiohdr_t::SetActivityListVersion( int version ) const void studiohdr_t::SetActivityListVersion( int iVersion ) const
{ {
activitylistversion = version; activitylistversion = iVersion;
if (numincludemodels == 0) if (numincludemodels == 0)
{ {
@ -601,7 +601,7 @@ void studiohdr_t::SetActivityListVersion( int version ) const
Assert( pStudioHdr ); Assert( pStudioHdr );
pStudioHdr->SetActivityListVersion( version ); pStudioHdr->SetActivityListVersion( iVersion );
} }
} }
@ -1152,7 +1152,7 @@ void CStudioHdr::SetAttachmentBone( int iAttachment, int iBone )
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
char *CStudioHdr::pszNodeName( int iNode ) const char *CStudioHdr::pszNodeName( int iNode )
{ {
if (m_pVModel == NULL) if (m_pVModel == NULL)
{ {
@ -1433,9 +1433,9 @@ void CStudioHdr::RunFlexRules( const float *src, float *dest )
{ {
int m = pops->d.index; int m = pops->d.index;
int km = k - m; int km = k - m;
for ( int i = km + 1; i < k; ++i ) for ( int l = km + 1; l < k; ++l )
{ {
stack[ km ] *= stack[ i ]; stack[ km ] *= stack[ l ];
} }
k = k - m + 1; k = k - m + 1;
} }
@ -1445,9 +1445,9 @@ void CStudioHdr::RunFlexRules( const float *src, float *dest )
int m = pops->d.index; int m = pops->d.index;
int km = k - m; int km = k - m;
float dv = stack[ km ]; float dv = stack[ km ];
for ( int i = km + 1; i < k; ++i ) for ( int l = km + 1; l < k; ++l )
{ {
dv *= stack[ i ]; dv *= stack[ l ];
} }
stack[ km - 1 ] *= 1.0f - dv; stack[ km - 1 ] *= 1.0f - dv;
k -= m; k -= m;
@ -1701,7 +1701,7 @@ void CStudioHdr::CActivityToSequenceMapping::Initialize( CStudioHdr * __restrict
// This stack may potentially grow very large; so if you have problems with it, // This stack may potentially grow very large; so if you have problems with it,
// go to a utlmap or similar structure. // go to a utlmap or similar structure.
unsigned int allocsize = (topActivity + 1) * sizeof(int); unsigned int allocsize = (topActivity + 1) * sizeof(int);
#define ALIGN_VALUE( val, alignment ) ( ( val + alignment - 1 ) & ~( alignment - 1 ) ) // need macro for constant expression //#define ALIGN_VALUE( val, alignment ) ( ( val + alignment - 1 ) & ~( alignment - 1 ) ) // need macro for constant expression
allocsize = ALIGN_VALUE(allocsize,16); allocsize = ALIGN_VALUE(allocsize,16);
int * __restrict seqsPerAct = static_cast<int *>(stackalloc(allocsize)); int * __restrict seqsPerAct = static_cast<int *>(stackalloc(allocsize));
memset(seqsPerAct, 0, allocsize); memset(seqsPerAct, 0, allocsize);

View File

@ -2137,7 +2137,7 @@ struct studiohdr_t
int GetSequenceActivity( int iSequence ); int GetSequenceActivity( int iSequence );
void SetSequenceActivity( int iSequence, int iActivity ); void SetSequenceActivity( int iSequence, int iActivity );
int GetActivityListVersion( void ); int GetActivityListVersion( void );
void SetActivityListVersion( int version ) const; void SetActivityListVersion( int iVersion ) const;
int GetEventListVersion( void ); int GetEventListVersion( void );
void SetEventListVersion( int version ); void SetEventListVersion( int version );
@ -2185,7 +2185,7 @@ struct studiohdr_t
//public: //public:
int EntryNode( int iSequence ); int EntryNode( int iSequence );
int ExitNode( int iSequence ); int ExitNode( int iSequence );
char *pszNodeName( int iNode ); const char *pszNodeName( int iNode );
int GetTransition( int iFrom, int iTo ) const; int GetTransition( int iFrom, int iTo ) const;
int numflexdesc; int numflexdesc;
@ -2395,7 +2395,7 @@ public:
int EntryNode( int iSequence ); int EntryNode( int iSequence );
int ExitNode( int iSequence ); int ExitNode( int iSequence );
char *pszNodeName( int iNode ); const char *pszNodeName( int iNode );
// FIXME: where should this one be? // FIXME: where should this one be?
int GetTransition( int iFrom, int iTo ) const; int GetTransition( int iFrom, int iTo ) const;

View File

@ -15,7 +15,9 @@
#include "basetypes.h" #include "basetypes.h"
#include "dbgflag.h" #include "dbgflag.h"
#include "platform.h" #include "platform.h"
#if _MSC_VER < 1900
#include <math.h> #include <math.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
@ -247,10 +249,10 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent();
if (!(_exp)) \ if (!(_exp)) \
{ \ { \
_SpewInfo( SPEW_ASSERT, __TFILE__, __LINE__ ); \ _SpewInfo( SPEW_ASSERT, __TFILE__, __LINE__ ); \
SpewRetval_t ret = _SpewMessage("%s", static_cast<const char*>( _msg )); \ SpewRetval_t _ret = _SpewMessage("%s", static_cast<const char*>( _msg )); \
CallAssertFailedNotifyFunc( __TFILE__, __LINE__, _msg ); \ CallAssertFailedNotifyFunc( __TFILE__, __LINE__, _msg ); \
_executeExp; \ _executeExp; \
if ( ret == SPEW_DEBUGGER) \ if ( _ret == SPEW_DEBUGGER) \
{ \ { \
if ( !ShouldUseNewAssertDialog() || DoNewAssertDialog( __TFILE__, __LINE__, _msg ) ) \ if ( !ShouldUseNewAssertDialog() || DoNewAssertDialog( __TFILE__, __LINE__, _msg ) ) \
{ \ { \

View File

@ -382,7 +382,12 @@ public:
#pragma warning(disable:4290) #pragma warning(disable:4290)
#pragma warning(push) #pragma warning(push)
#if _MSC_VER < 1900
#include <typeinfo.h> #include <typeinfo.h>
#else
#include <typeinfo>
#endif
// MEM_DEBUG_CLASSNAME is opt-in. // MEM_DEBUG_CLASSNAME is opt-in.
// Note: typeid().name() is not threadsafe, so if the project needs to access it in multiple threads // Note: typeid().name() is not threadsafe, so if the project needs to access it in multiple threads

View File

@ -37,7 +37,7 @@
#include "commonmacros.h" #include "commonmacros.h"
#include "memalloc.h" #include "memalloc.h"
#if defined(USE_MEM_DEBUG) #if USE_MEM_DEBUG
#if defined( POSIX ) #if defined( POSIX )
#define _NORMAL_BLOCK 1 #define _NORMAL_BLOCK 1
@ -91,7 +91,7 @@ inline void *MemAlloc_InlineCallocMemset( void *pMem, size_t nCount, size_t nEle
} }
#endif #endif
#define calloc(c, s) MemAlloc_InlineCallocMemset(malloc(c*s), c, s) #define calloc(c, s) MemAlloc_InlineCallocMemset(malloc((c)*(s)), (c), (s))
#define free(p) g_pMemAlloc->Free( p ) #define free(p) g_pMemAlloc->Free( p )
#define _msize(p) g_pMemAlloc->GetSize( p ) #define _msize(p) g_pMemAlloc->GetSize( p )
#define _expand(p, s) _expand_NoLongerSupported(p, s) #define _expand(p, s) _expand_NoLongerSupported(p, s)
@ -99,7 +99,7 @@ inline void *MemAlloc_InlineCallocMemset( void *pMem, size_t nCount, size_t nEle
// -------------------------------------------------------- // --------------------------------------------------------
// Debug path // Debug path
#if defined(USE_MEM_DEBUG) #if USE_MEM_DEBUG
#define malloc(s) g_pMemAlloc->Alloc( s, __FILE__, __LINE__) #define malloc(s) g_pMemAlloc->Alloc( s, __FILE__, __LINE__)
#define realloc(p, s) g_pMemAlloc->Realloc( p, s, __FILE__, __LINE__ ) #define realloc(p, s) g_pMemAlloc->Realloc( p, s, __FILE__, __LINE__ )
@ -231,7 +231,7 @@ inline wchar_t *MemAlloc_WcStrDup(const wchar_t *pString)
#else #else
#if defined(USE_MEM_DEBUG) #if USE_MEM_DEBUG
#ifndef _STATIC_LINKED #ifndef _STATIC_LINKED
#pragma message ("Note: file includes crtdbg.h directly, therefore will cannot use memdbgon.h in non-debug build") #pragma message ("Note: file includes crtdbg.h directly, therefore will cannot use memdbgon.h in non-debug build")
#else #else

View File

@ -40,9 +40,17 @@
#define __cdecl #define __cdecl
#endif #endif
#undef _malloc_dbg
#undef _calloc_dbg
#undef _free_dbg
#undef _CrtSetCheckCount
#undef _CrtGetCheckCount
#undef _CrtSetDebugFillThreshold
#if defined( _WIN32 ) && !defined( _X360 ) #if defined( _WIN32 ) && !defined( _X360 )
const char *MakeModuleFileName() const char *MakeModuleFileName()
{ {
#if _MSC_VER < 1900
if ( g_pMemAlloc->IsDebugHeap() ) if ( g_pMemAlloc->IsDebugHeap() )
{ {
char *pszModuleName = (char *)HeapAlloc( GetProcessHeap(), 0, MAX_PATH ); // small leak, debug only char *pszModuleName = (char *)HeapAlloc( GetProcessHeap(), 0, MAX_PATH ); // small leak, debug only
@ -65,27 +73,36 @@ const char *MakeModuleFileName()
return pszModuleName; return pszModuleName;
} }
#endif
return NULL; return NULL;
} }
static void *AllocUnattributed( size_t nSize ) static void *AllocUnattributed( size_t nSize )
{ {
#if _MSC_VER < 1900
static const char *pszOwner = MakeModuleFileName(); static const char *pszOwner = MakeModuleFileName();
if ( !pszOwner ) if ( !pszOwner )
return g_pMemAlloc->Alloc(nSize); return g_pMemAlloc->Alloc(nSize);
else else
return g_pMemAlloc->Alloc(nSize, pszOwner, 0); return g_pMemAlloc->Alloc(nSize, pszOwner, 0);
#else
return g_pMemAlloc->Alloc(nSize);
#endif
} }
static void *ReallocUnattributed( void *pMem, size_t nSize ) static void *ReallocUnattributed( void *pMem, size_t nSize )
{ {
#if _MSC_VER < 1900
static const char *pszOwner = MakeModuleFileName(); static const char *pszOwner = MakeModuleFileName();
if ( !pszOwner ) if ( !pszOwner )
return g_pMemAlloc->Realloc(pMem, nSize); return g_pMemAlloc->Realloc(pMem, nSize);
else else
return g_pMemAlloc->Realloc(pMem, nSize, pszOwner, 0); return g_pMemAlloc->Realloc(pMem, nSize, pszOwner, 0);
#else
return g_pMemAlloc->Realloc(pMem, nSize);
#endif
} }
#else #else
@ -108,6 +125,9 @@ inline void *ReallocUnattributed( void *pMem, size_t nSize )
// this magic only works under win32 // this magic only works under win32
// under linux this malloc() overrides the libc malloc() and so we // under linux this malloc() overrides the libc malloc() and so we
// end up in a recursion (as g_pMemAlloc->Alloc() calls malloc) // end up in a recursion (as g_pMemAlloc->Alloc() calls malloc)
#if _MSC_VER >= 1900 && !defined(_CRTNOALIAS)
#define _CRTNOALIAS
#endif
#if _MSC_VER >= 1400 #if _MSC_VER >= 1400
#define ALLOC_CALL _CRTNOALIAS _CRTRESTRICT #define ALLOC_CALL _CRTNOALIAS _CRTRESTRICT
#define FREE_CALL _CRTNOALIAS #define FREE_CALL _CRTNOALIAS
@ -155,6 +175,11 @@ void* __cdecl _malloc_base( size_t nSize )
{ {
return AllocUnattributed( nSize ); return AllocUnattributed( nSize );
} }
#elif _MSC_VER >= 1900
__declspec(restrict) void* _malloc_base(size_t nSize)
{
return AllocUnattributed(nSize);
}
#else #else
void *_malloc_base( size_t nSize ) void *_malloc_base( size_t nSize )
{ {
@ -162,24 +187,47 @@ void *_malloc_base( size_t nSize )
} }
#endif #endif
#if _MSC_VER >= 1900
__declspec(restrict) void* _calloc_base(size_t count, size_t nSize)
{
void* pMem = AllocUnattributed(count * nSize);
memset(pMem, 0, count * nSize);
return pMem;
}
#else
void *_calloc_base( size_t nSize ) void *_calloc_base( size_t nSize )
{ {
void *pMem = AllocUnattributed( nSize ); void *pMem = AllocUnattributed( nSize );
memset(pMem, 0, nSize); memset(pMem, 0, nSize);
return pMem; return pMem;
} }
#endif
#if _MSC_VER >= 1900
__declspec(restrict) void* _realloc_base(void* pMem, size_t nSize)
{
return ReallocUnattributed(pMem, nSize);
}
#else
void *_realloc_base( void *pMem, size_t nSize ) void *_realloc_base( void *pMem, size_t nSize )
{ {
return ReallocUnattributed( pMem, nSize ); return ReallocUnattributed( pMem, nSize );
} }
#endif
#if _MSC_VER >= 1900
__declspec(restrict) void* _recalloc_base(void* pMem, size_t count, size_t nSize)
{
return _recalloc(pMem, count, nSize);
}
#else
void *_recalloc_base( void *pMem, size_t nSize ) void *_recalloc_base( void *pMem, size_t nSize )
{ {
void *pMemOut = ReallocUnattributed( pMem, nSize ); void *pMemOut = ReallocUnattributed( pMem, nSize );
memset(pMemOut, 0, nSize); memset(pMemOut, 0, nSize);
return pMemOut; return pMemOut;
} }
#endif
void _free_base( void *pMem ) void _free_base( void *pMem )
{ {
@ -200,7 +248,11 @@ void * __cdecl _malloc_crt(size_t size)
void * __cdecl _calloc_crt(size_t count, size_t size) void * __cdecl _calloc_crt(size_t count, size_t size)
{ {
#if _MSC_VER >= 1900
return _calloc_base(count, size);
#else
return _calloc_base( count * size ); return _calloc_base( count * size );
#endif
} }
void * __cdecl _realloc_crt(void *ptr, size_t size) void * __cdecl _realloc_crt(void *ptr, size_t size)
@ -210,14 +262,23 @@ void * __cdecl _realloc_crt(void *ptr, size_t size)
void * __cdecl _recalloc_crt(void *ptr, size_t count, size_t size) void * __cdecl _recalloc_crt(void *ptr, size_t count, size_t size)
{ {
#if _MSC_VER >= 1900
return _recalloc_base(ptr, count, size);
#else
return _recalloc_base( ptr, size * count ); return _recalloc_base( ptr, size * count );
#endif
} }
ALLOC_CALL void * __cdecl _recalloc ( void * memblock, size_t count, size_t size ) ALLOC_CALL void * __cdecl _recalloc ( void * memblock, size_t count, size_t size )
{ {
void *pMem = ReallocUnattributed( memblock, size * count ); const size_t oldSize = _msize(memblock);
memset( pMem, 0, size * count ); const size_t newSize = count * size;
return pMem; void* pMemOut = ReallocUnattributed(memblock, newSize);
if (newSize > oldSize)
memset(((char*)pMemOut) + oldSize, 0, newSize - oldSize);
return pMemOut;
} }
size_t _msize_base( void *pMem ) size_t _msize_base( void *pMem )
@ -485,6 +546,7 @@ void *__cdecl _calloc_dbg_impl( size_t nNum, size_t nSize, int nBlockUse,
return _calloc_dbg( nNum, nSize, nBlockUse, szFileName, nLine ); return _calloc_dbg( nNum, nSize, nBlockUse, szFileName, nLine );
} }
#ifdef DEBUG
void *__cdecl _realloc_dbg( void *pMem, size_t nNewSize, int nBlockUse, void *__cdecl _realloc_dbg( void *pMem, size_t nNewSize, int nBlockUse,
const char *pFileName, int nLine ) const char *pFileName, int nLine )
{ {
@ -498,6 +560,7 @@ void *__cdecl _expand_dbg( void *pMem, size_t nNewSize, int nBlockUse,
Assert( 0 ); Assert( 0 );
return NULL; return NULL;
} }
#endif
void __cdecl _free_dbg( void *pMem, int nBlockUse ) void __cdecl _free_dbg( void *pMem, int nBlockUse )
{ {
@ -505,6 +568,7 @@ void __cdecl _free_dbg( void *pMem, int nBlockUse )
g_pMemAlloc->Free(pMem); g_pMemAlloc->Free(pMem);
} }
#ifdef DEBUG
size_t __cdecl _msize_dbg( void *pMem, int nBlockUse ) size_t __cdecl _msize_dbg( void *pMem, int nBlockUse )
{ {
#ifdef _WIN32 #ifdef _WIN32
@ -514,6 +578,7 @@ size_t __cdecl _msize_dbg( void *pMem, int nBlockUse )
return 0; return 0;
#endif #endif
} }
#endif
#ifdef _WIN32 #ifdef _WIN32
@ -614,6 +679,7 @@ ALLOC_CALL void * __cdecl _aligned_offset_recalloc( void * memblock, size_t coun
extern "C" extern "C"
{ {
#ifdef DEBUG
int _CrtDumpMemoryLeaks(void) int _CrtDumpMemoryLeaks(void)
{ {
return 0; return 0;
@ -628,11 +694,25 @@ int _CrtSetDbgFlag( int nNewFlag )
{ {
return g_pMemAlloc->CrtSetDbgFlag( nNewFlag ); return g_pMemAlloc->CrtSetDbgFlag( nNewFlag );
} }
#endif
// 64-bit port. // 64-bit port.
#define AFNAME(var) __p_ ## var #define AFNAME(var) __p_ ## var
#define AFRET(var) &var #define AFRET(var) &var
#if _MSC_VER >= 1900
int* __cdecl __p__crtDbgFlag(void)
{
static int dummy = _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF;
return &dummy;
}
long* __cdecl __p__crtBreakAlloc(void)
{
static long dummy = 0;
return &dummy;
}
#else
int _crtDbgFlag = _CRTDBG_ALLOC_MEM_DF; int _crtDbgFlag = _CRTDBG_ALLOC_MEM_DF;
int* AFNAME(_crtDbgFlag)(void) int* AFNAME(_crtDbgFlag)(void)
{ {
@ -644,12 +724,14 @@ long* AFNAME(_crtBreakAlloc) (void)
{ {
return AFRET(_crtBreakAlloc); return AFRET(_crtBreakAlloc);
} }
#endif
void __cdecl _CrtSetDbgBlockType( void *pMem, int nBlockUse ) void __cdecl _CrtSetDbgBlockType( void *pMem, int nBlockUse )
{ {
DebuggerBreak(); DebuggerBreak();
} }
#ifdef DEBUG
_CRT_ALLOC_HOOK __cdecl _CrtSetAllocHook( _CRT_ALLOC_HOOK pfnNewHook ) _CRT_ALLOC_HOOK __cdecl _CrtSetAllocHook( _CRT_ALLOC_HOOK pfnNewHook )
{ {
DebuggerBreak(); DebuggerBreak();
@ -710,13 +792,14 @@ void __cdecl _CrtDoForAllClientObjects( void (*pfn)(void *, void *), void * pCon
{ {
DebuggerBreak(); DebuggerBreak();
} }
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Methods in dbgrpt.cpp // Methods in dbgrpt.cpp
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
long _crtAssertBusy = -1; long _crtAssertBusy = -1;
#ifdef DEBUG
int __cdecl _CrtSetReportMode( int nReportType, int nReportMode ) int __cdecl _CrtSetReportMode( int nReportType, int nReportMode )
{ {
return g_pMemAlloc->CrtSetReportMode( nReportType, nReportMode ); return g_pMemAlloc->CrtSetReportMode( nReportType, nReportMode );
@ -731,6 +814,7 @@ _CRT_REPORT_HOOK __cdecl _CrtSetReportHook( _CRT_REPORT_HOOK pfnNewHook )
{ {
return (_CRT_REPORT_HOOK)g_pMemAlloc->CrtSetReportHook( pfnNewHook ); return (_CRT_REPORT_HOOK)g_pMemAlloc->CrtSetReportHook( pfnNewHook );
} }
#endif
int __cdecl _CrtDbgReport( int nRptType, const char * szFile, int __cdecl _CrtDbgReport( int nRptType, const char * szFile,
int nLine, const char * szModule, const char * szFormat, ... ) int nLine, const char * szModule, const char * szFormat, ... )
@ -863,7 +947,7 @@ ErrorHandlerRegistrar::ErrorHandlerRegistrar()
_set_invalid_parameter_handler( VInvalidParameterHandler ); _set_invalid_parameter_handler( VInvalidParameterHandler );
} }
#if defined( _DEBUG ) #if 0 // defined( _DEBUG )
// wrapper which passes no debug info; not available in debug // wrapper which passes no debug info; not available in debug
#ifndef SUPPRESS_INVALID_PARAMETER_NO_INFO #ifndef SUPPRESS_INVALID_PARAMETER_NO_INFO
@ -887,21 +971,41 @@ int __cdecl __crtMessageWindowW( int nRptType, const wchar_t * szFile, const wch
int __cdecl _CrtDbgReportV( int nRptType, const wchar_t *szFile, int nLine, int __cdecl _CrtDbgReportV( int nRptType, const wchar_t *szFile, int nLine,
const wchar_t *szModule, const wchar_t *szFormat, va_list arglist ) const wchar_t *szModule, const wchar_t *szFormat, va_list arglist )
{ {
Assert(0); wchar_t buffer[256];
vswprintf(buffer, 256, szFormat, arglist);
DevWarning("%ls", buffer);
return 0; return 0;
} }
int __cdecl _CrtDbgReportW( int nRptType, const wchar_t *szFile, int nLine, int __cdecl _CrtDbgReportW( int nRptType, const wchar_t *szFile, int nLine,
const wchar_t *szModule, const wchar_t *szFormat, ...) const wchar_t *szModule, const wchar_t *szFormat, ...)
{ {
Assert(0); wchar_t buffer[256];
va_list args;
va_start(args, szFormat);
vswprintf(buffer, 256, szFormat, args);
va_end(args);
DevWarning("%ls", buffer);
return 0; return 0;
} }
#if _MSC_VER >= 1900
int __cdecl _VCrtDbgReportA(int nRptType, void* returnAddress, const char* szFile, int nLine,
const char* szModule, const char* szFormat, va_list arglist)
#else
int __cdecl _VCrtDbgReportA( int nRptType, const wchar_t * szFile, int nLine, int __cdecl _VCrtDbgReportA( int nRptType, const wchar_t * szFile, int nLine,
const wchar_t * szModule, const wchar_t * szFormat, va_list arglist ) const wchar_t * szModule, const wchar_t * szFormat, va_list arglist )
#endif
{ {
Assert(0); #if _MSC_VER >= 1900
char buffer[256];
vsnprintf(buffer, 256, szFormat, arglist);
DevWarning("%s", buffer);
#else
wchar_t buffer[256];
vswprintf(buffer, 256, szFormat, arglist);
DevWarning("%ls", buffer);
#endif // _MSC_VER >= 1900
return 0; return 0;
} }
@ -927,13 +1031,12 @@ extern "C" int __cdecl _CrtGetCheckCount( void )
return __crtDebugCheckCount; return __crtDebugCheckCount;
} }
#ifdef DEBUG
// aligned offset debug // aligned offset debug
extern "C" void * __cdecl _aligned_offset_recalloc_dbg( void * memblock, size_t count, size_t size, size_t align, size_t offset, const char * f_name, int line_n ) extern "C" void * __cdecl _aligned_offset_recalloc_dbg( void * memblock, size_t count, size_t size, size_t align, size_t offset, const char * f_name, int line_n )
{ {
Assert( IsPC() || 0 ); Assert( IsPC() || 0 );
void *pMem = ReallocUnattributed( memblock, size * count ); return ReallocUnattributed(memblock, size * count);
memset( pMem, 0, size * count );
return pMem;
} }
extern "C" void * __cdecl _aligned_recalloc_dbg( void *memblock, size_t count, size_t size, size_t align, const char * f_name, int line_n ) extern "C" void * __cdecl _aligned_recalloc_dbg( void *memblock, size_t count, size_t size, size_t align, const char * f_name, int line_n )
@ -950,12 +1053,16 @@ _CRT_REPORT_HOOK __cdecl _CrtGetReportHook( void )
{ {
return NULL; return NULL;
} }
#endif // DEBUG
#endif #endif
#ifdef DEBUG
int __cdecl _CrtReportBlockType(const void * pUserData) int __cdecl _CrtReportBlockType(const void * pUserData)
{ {
return 0; return 0;
} }
#endif
} // end extern "C" } // end extern "C"
@ -995,14 +1102,14 @@ void * __cdecl _heap_alloc_dbg( size_t nSize, int nBlockUse, const char * szFile
static void * __cdecl realloc_help( void * pUserData, size_t * pnNewSize, int nBlockUse,const char * szFileName, static void * __cdecl realloc_help( void * pUserData, size_t * pnNewSize, int nBlockUse,const char * szFileName,
int nLine, int fRealloc ) int nLine, int fRealloc )
{ {
assert(0); // Shouldn't be needed Assert(0); // Shouldn't be needed
return NULL; return NULL;
} }
#else #else
static void * __cdecl realloc_help( void * pUserData, size_t nNewSize, int nBlockUse, const char * szFileName, static void * __cdecl realloc_help( void * pUserData, size_t nNewSize, int nBlockUse, const char * szFileName,
int nLine, int fRealloc) int nLine, int fRealloc)
{ {
assert(0); // Shouldn't be needed Assert(0); // Shouldn't be needed
return NULL; return NULL;
} }
#endif #endif
@ -1018,11 +1125,13 @@ void __cdecl _free_dbg_nolock( void * pUserData, int nBlockUse)
_free_dbg(pUserData, 0); _free_dbg(pUserData, 0);
} }
#ifdef DEBUG
_CRT_ALLOC_HOOK __cdecl _CrtGetAllocHook ( void) _CRT_ALLOC_HOOK __cdecl _CrtGetAllocHook ( void)
{ {
assert(0); Assert(0);
return NULL; return NULL;
} }
#endif
static int __cdecl CheckBytes( unsigned char * pb, unsigned char bCheck, size_t nSize) static int __cdecl CheckBytes( unsigned char * pb, unsigned char bCheck, size_t nSize)
{ {
@ -1030,12 +1139,13 @@ static int __cdecl CheckBytes( unsigned char * pb, unsigned char bCheck, size_t
return bOkay; return bOkay;
} }
#ifdef DEBUG
_CRT_DUMP_CLIENT __cdecl _CrtGetDumpClient ( void) _CRT_DUMP_CLIENT __cdecl _CrtGetDumpClient ( void)
{ {
assert(0); Assert(0);
return NULL; return NULL;
} }
#endif
#if _MSC_VER >= 1400 #if _MSC_VER >= 1400
static void __cdecl _printMemBlockData( _locale_t plocinfo, _CrtMemBlockHeader * pHead) static void __cdecl _printMemBlockData( _locale_t plocinfo, _CrtMemBlockHeader * pHead)
@ -1046,6 +1156,8 @@ static void __cdecl _CrtMemDumpAllObjectsSince_stat( const _CrtMemState * state,
{ {
} }
#endif #endif
#if defined(DEBUG) && _MSC_VER >= 1900
void * __cdecl _aligned_malloc_dbg( size_t size, size_t align, const char * f_name, int line_n) void * __cdecl _aligned_malloc_dbg( size_t size, size_t align, const char * f_name, int line_n)
{ {
return _aligned_malloc(size, align); return _aligned_malloc(size, align);
@ -1073,16 +1185,19 @@ void __cdecl _aligned_free_dbg( void * memblock)
{ {
_aligned_free(memblock); _aligned_free(memblock);
} }
#endif // DEBUG
#if _MSC_VER < 1900
size_t __cdecl _CrtSetDebugFillThreshold( size_t _NewDebugFillThreshold) size_t __cdecl _CrtSetDebugFillThreshold( size_t _NewDebugFillThreshold)
{ {
assert(0); assert(0);
return 0; return 0;
} }
#endif
//=========================================== //===========================================
// NEW!!! 64-bit // NEW!!! 64-bit
#ifndef PROTECTED_THINGS_DISABLE
char * __cdecl _strdup ( const char * string ) char * __cdecl _strdup ( const char * string )
{ {
int nSize = (int)strlen(string) + 1; int nSize = (int)strlen(string) + 1;
@ -1094,6 +1209,7 @@ char * __cdecl _strdup ( const char * string )
memcpy( pCopy, string, nSize ); memcpy( pCopy, string, nSize );
return pCopy; return pCopy;
} }
#endif
#if 0 #if 0
_TSCHAR * __cdecl _tfullpath_dbg ( _TSCHAR *UserBuf, const _TSCHAR *path, size_t maxlen, int nBlockUse, const char * szFileName, int nLine ) _TSCHAR * __cdecl _tfullpath_dbg ( _TSCHAR *UserBuf, const _TSCHAR *path, size_t maxlen, int nBlockUse, const char * szFileName, int nLine )
@ -1143,7 +1259,6 @@ _TSCHAR * __cdecl _ttempnam ( const _TSCHAR *dir, const _TSCHAR *pfx )
Assert(0); Assert(0);
return 0; return 0;
} }
#endif
wchar_t * __cdecl _wcsdup_dbg ( const wchar_t * string, int nBlockUse, const char * szFileName, int nLine ) wchar_t * __cdecl _wcsdup_dbg ( const wchar_t * string, int nBlockUse, const char * szFileName, int nLine )
{ {
@ -1156,6 +1271,7 @@ wchar_t * __cdecl _wcsdup ( const wchar_t * string )
Assert(0); Assert(0);
return 0; return 0;
} }
#endif
} // end extern "C" } // end extern "C"
@ -1344,6 +1460,12 @@ _CRTIMP extern uintptr_t __cdecl __threadhandle(void);
/* Structure for each thread's data */ /* Structure for each thread's data */
#if _MSC_VER >= 1900
typedef __crt_multibyte_data* pthreadmbcinfo;
typedef __crt_locale_data* pthreadlocinfo;
typedef __crt_locale_pointers _locale_tstruct;
#endif
struct _tiddata { struct _tiddata {
unsigned long _tid; /* thread ID */ unsigned long _tid; /* thread ID */
@ -1387,7 +1509,7 @@ struct _tiddata {
* the thread */ * the thread */
pthreadmbcinfo ptmbcinfo; pthreadmbcinfo ptmbcinfo;
/* pointer to the copy of the locale informaton used by the thead */ /* pointer to the copy of the locale information used by the thread */
pthreadlocinfo ptlocinfo; pthreadlocinfo ptlocinfo;
int _ownlocale; /* if 1, this thread owns its own locale */ int _ownlocale; /* if 1, this thread owns its own locale */
@ -1502,7 +1624,7 @@ struct _tiddata {
* the thread */ * the thread */
pthreadmbcinfo ptmbcinfo; pthreadmbcinfo ptmbcinfo;
/* pointer to the copy of the locale informaton used by the thead */ /* pointer to the copy of the locale information used by the thread */
pthreadlocinfo ptlocinfo; pthreadlocinfo ptlocinfo;
int _ownlocale; /* if 1, this thread owns its own locale */ int _ownlocale; /* if 1, this thread owns its own locale */

View File

@ -367,7 +367,7 @@ typedef void * HINSTANCE;
#define MAX_UNICODE_PATH MAX_PATH #define MAX_UNICODE_PATH MAX_PATH
#endif #endif
#define MAX_UNICODE_PATH_IN_UTF8 MAX_UNICODE_PATH*4 #define MAX_UNICODE_PATH_IN_UTF8 (MAX_UNICODE_PATH*4)
#ifdef GNUC #ifdef GNUC
#undef offsetof #undef offsetof
@ -379,7 +379,7 @@ typedef void * HINSTANCE;
#endif #endif
#define ALIGN_VALUE( val, alignment ) ( ( val + alignment - 1 ) & ~( alignment - 1 ) ) // need macro for constant expression #define ALIGN_VALUE( val, alignment ) ( ( (val) + (alignment) - 1 ) & ~( (alignment) - 1 ) ) // need macro for constant expression
// Used to step into the debugger // Used to step into the debugger
#if defined( _WIN32 ) && !defined( _X360 ) #if defined( _WIN32 ) && !defined( _X360 )
@ -572,7 +572,16 @@ typedef void * HINSTANCE;
#endif #endif
// GCC 3.4.1 has a bug in supporting forced inline of templated functions // GCC 3.4.1 has a bug in supporting forced inline of templated functions
// this macro lets us not force inlining in that case // this macro lets us not force inlining in that case
#define FORCEINLINE_TEMPLATE inline #if __GNUC__ < 4
#define FORCEINLINE_TEMPLATE inline
#else
#define FORCEINLINE_TEMPLATE inline __attribute__((always_inline))
#endif
#if __cpp_constexpr >= 201304
#define CONSTEXPR_FUNC constexpr
#else
#define CONSTEXPR_FUNC
#endif
// #define __stdcall __attribute__ ((__stdcall__)) // #define __stdcall __attribute__ ((__stdcall__))
#endif #endif
@ -672,6 +681,40 @@ typedef void * HINSTANCE;
#pragma warning( disable : 4312 ) // conversion from 'unsigned int' to 'memhandle_t' of greater size #pragma warning( disable : 4312 ) // conversion from 'unsigned int' to 'memhandle_t' of greater size
#endif #endif
// Detect C++11 support for "rvalue references" / "move semantics" / other C++11 (and up) stuff
#if defined(_MSC_VER)
#if _MSC_VER >= 1600
#define VALVE_RVALUE_REFS 1
#endif
#if _MSC_VER >= 1800
#define VALVE_INITIALIZER_LIST_SUPPORT 1
#define VALVE_EXPLICIT_CONVERSION_OP 1
#endif
#elif defined(__clang__)
#if __has_extension(cxx_rvalue_references)
#define VALVE_RVALUE_REFS 1
#endif
#if __has_feature(cxx_generalized_initializers)
#define VALVE_INITIALIZER_LIST_SUPPORT 1
#endif
#if __has_feature(cxx_explicit_conversions)
#define VALVE_EXPLICIT_CONVERSION_OP 1
#endif
#elif defined(__GNUC__)
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6 )
#if defined(__GXX_EXPERIMENTAL_CXX0X__)
#define VALVE_RVALUE_REFS 1
#define VALVE_INITIALIZER_LIST_SUPPORT 1
#define VALVE_EXPLICIT_CONVERSION_OP 1
#endif
#endif
#endif
#ifdef VALVE_RVALUE_REFS
#include "tier0/valve_minmax_off.h"
#include <utility>
#include "tier0/valve_minmax_on.h"
#endif
#ifdef POSIX #ifdef POSIX
#define _stricmp stricmp #define _stricmp stricmp
@ -1313,62 +1356,81 @@ inline const char *GetPlatformExt( void )
template <class T> template <class T>
inline T* Construct( T* pMemory ) inline T* Construct( T* pMemory )
{ {
HINT(pMemory != 0);
return ::new( pMemory ) T; return ::new( pMemory ) T;
} }
template <class T, typename ARG1> template <class T, typename ARG1>
inline T* Construct( T* pMemory, ARG1 a1 ) inline T* Construct( T* pMemory, ARG1 a1 )
{ {
HINT(pMemory != 0);
return ::new( pMemory ) T( a1 ); return ::new( pMemory ) T( a1 );
} }
template <class T, typename ARG1, typename ARG2> template <class T, typename ARG1, typename ARG2>
inline T* Construct( T* pMemory, ARG1 a1, ARG2 a2 ) inline T* Construct( T* pMemory, ARG1 a1, ARG2 a2 )
{ {
HINT(pMemory != 0);
return ::new( pMemory ) T( a1, a2 ); return ::new( pMemory ) T( a1, a2 );
} }
template <class T, typename ARG1, typename ARG2, typename ARG3> template <class T, typename ARG1, typename ARG2, typename ARG3>
inline T* Construct( T* pMemory, ARG1 a1, ARG2 a2, ARG3 a3 ) inline T* Construct( T* pMemory, ARG1 a1, ARG2 a2, ARG3 a3 )
{ {
HINT(pMemory != 0);
return ::new( pMemory ) T( a1, a2, a3 ); return ::new( pMemory ) T( a1, a2, a3 );
} }
template <class T, typename ARG1, typename ARG2, typename ARG3, typename ARG4> template <class T, typename ARG1, typename ARG2, typename ARG3, typename ARG4>
inline T* Construct( T* pMemory, ARG1 a1, ARG2 a2, ARG3 a3, ARG4 a4 ) inline T* Construct( T* pMemory, ARG1 a1, ARG2 a2, ARG3 a3, ARG4 a4 )
{ {
HINT(pMemory != 0);
return ::new( pMemory ) T( a1, a2, a3, a4 ); return ::new( pMemory ) T( a1, a2, a3, a4 );
} }
template <class T, typename ARG1, typename ARG2, typename ARG3, typename ARG4, typename ARG5> template <class T, typename ARG1, typename ARG2, typename ARG3, typename ARG4, typename ARG5>
inline T* Construct( T* pMemory, ARG1 a1, ARG2 a2, ARG3 a3, ARG4 a4, ARG5 a5 ) inline T* Construct( T* pMemory, ARG1 a1, ARG2 a2, ARG3 a3, ARG4 a4, ARG5 a5 )
{ {
HINT(pMemory != 0);
return ::new( pMemory ) T( a1, a2, a3, a4, a5 ); return ::new( pMemory ) T( a1, a2, a3, a4, a5 );
} }
template <class T, class P> template <class T, class P>
inline void ConstructOneArg( T* pMemory, P const& arg) inline void ConstructOneArg( T* pMemory, P const& arg)
{ {
HINT(pMemory != 0);
::new( pMemory ) T(arg); ::new( pMemory ) T(arg);
} }
template <class T, class P1, class P2 > template <class T, class P1, class P2 >
inline void ConstructTwoArg( T* pMemory, P1 const& arg1, P2 const& arg2) inline void ConstructTwoArg( T* pMemory, P1 const& arg1, P2 const& arg2)
{ {
HINT(pMemory != 0);
::new( pMemory ) T(arg1, arg2); ::new( pMemory ) T(arg1, arg2);
} }
template <class T, class P1, class P2, class P3 > template <class T, class P1, class P2, class P3 >
inline void ConstructThreeArg( T* pMemory, P1 const& arg1, P2 const& arg2, P3 const& arg3) inline void ConstructThreeArg( T* pMemory, P1 const& arg1, P2 const& arg2, P3 const& arg3)
{ {
HINT(pMemory != 0);
::new( pMemory ) T(arg1, arg2, arg3); ::new( pMemory ) T(arg1, arg2, arg3);
} }
template <class T> template <class T>
inline T* CopyConstruct( T* pMemory, T const& src ) inline T* CopyConstruct( T* pMemory, T const& src )
{ {
HINT(pMemory != 0);
return ::new( pMemory ) T(src); return ::new( pMemory ) T(src);
} }
#ifdef VALVE_RVALUE_REFS
template <class T>
inline void CopyConstruct(T* pMemory, T&& src)
{
HINT(pMemory != 0);
::new(pMemory)T(std::forward<T>(src));
}
#endif
template <class T> template <class T>
inline void Destruct( T* pMemory ) inline void Destruct( T* pMemory )

View File

@ -245,7 +245,7 @@ void CUtlSortVector<T, LessFunc, BaseVector>::QuickSort( LessFunc& less, int nLo
ctx.m_pLessContext = m_pLessContext; ctx.m_pLessContext = m_pLessContext;
ctx.m_pLessFunc = &less; ctx.m_pLessFunc = &less;
qsort_s( Base(), Count(), sizeof(T), (QSortCompareFunc_t)&CUtlSortVector<T, LessFunc>::CompareHelper, &ctx ); qsort_s( this->Base(), this->Count(), sizeof(T), (QSortCompareFunc_t)&CUtlSortVector<T, LessFunc>::CompareHelper, &ctx );
} }
#else #else
typedef int (__cdecl *QSortCompareFunc_t)( const void *, const void *); typedef int (__cdecl *QSortCompareFunc_t)( const void *, const void *);

View File

@ -186,7 +186,7 @@ public:
if( !m_bSwapBytes || ( sizeof(T) == 1 ) ) if( !m_bSwapBytes || ( sizeof(T) == 1 ) )
{ {
// If we were just going to swap in place then return. // If we were just going to swap in place then return.
if( !inputBuffer ) if( inputBuffer == outputBuffer )
return; return;
// Otherwise copy the inputBuffer to the outputBuffer: // Otherwise copy the inputBuffer to the outputBuffer:

View File

@ -139,7 +139,7 @@ class IForceVirtualInheritancePanel
// This is designed as an easy-access to the vgui-functionality; for more // This is designed as an easy-access to the vgui-functionality; for more
// low-level access to vgui functions use the IPanel/IClientPanel interfaces directly // low-level access to vgui functions use the IPanel/IClientPanel interfaces directly
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class Panel : public IClientPanel, virtual IForceVirtualInheritancePanel class Panel : public IClientPanel, public virtual IForceVirtualInheritancePanel
{ {
DECLARE_CLASS_SIMPLE_NOBASE( Panel ); DECLARE_CLASS_SIMPLE_NOBASE( Panel );
@ -1011,7 +1011,7 @@ public:
void VguiPanelGetSortedChildPanelList( Panel *pParentPanel, void *pSortedPanels ); void VguiPanelGetSortedChildPanelList( Panel *pParentPanel, void *pSortedPanels );
void VguiPanelGetSortedChildButtonList( Panel *pParentPanel, void *pSortedPanels, char *pchFilter = NULL, int nFilterType = 0 ); void VguiPanelGetSortedChildButtonList( Panel *pParentPanel, void *pSortedPanels, const char *pchFilter = NULL, int nFilterType = 0 );
int VguiPanelNavigateSortedChildButtonList( void *pSortedPanels, int nDir ); int VguiPanelNavigateSortedChildButtonList( void *pSortedPanels, int nDir );

View File

@ -828,6 +828,8 @@ enum ScriptStatus_t
class IScriptVM class IScriptVM
{ {
public: public:
virtual ~IScriptVM() {}
virtual bool Init() = 0; virtual bool Init() = 0;
virtual void Shutdown() = 0; virtual void Shutdown() = 0;

View File

@ -425,11 +425,11 @@ void RayTracingEnvironment::Trace4Rays(const FourRays &rays, fltx4 TMin, fltx4 T
MulSIMD( MulSIMD(
SubSIMD(ReplicateX4(CurNode->SplittingPlaneValue), SubSIMD(ReplicateX4(CurNode->SplittingPlaneValue),
rays.origin[split_plane_number]),OneOverRayDir[split_plane_number]); rays.origin[split_plane_number]),OneOverRayDir[split_plane_number]);
fltx4 active=CmpLeSIMD(TMin,TMax); // mask of which rays are active fltx4 activeLocl=CmpLeSIMD(TMin,TMax); // mask of which rays are active
// now, decide how to traverse children. can either do front,back, or do front and push // now, decide how to traverse children. can either do front,back, or do front and push
// back. // back.
fltx4 hits_front=AndSIMD(active,CmpGeSIMD(dist_to_sep_plane,TMin)); fltx4 hits_front=AndSIMD(activeLocl,CmpGeSIMD(dist_to_sep_plane,TMin));
if (! IsAnyNegative(hits_front)) if (! IsAnyNegative(hits_front))
{ {
// missed the front. only traverse back // missed the front. only traverse back
@ -440,7 +440,7 @@ void RayTracingEnvironment::Trace4Rays(const FourRays &rays, fltx4 TMin, fltx4 T
} }
else else
{ {
fltx4 hits_back=AndSIMD(active,CmpLeSIMD(dist_to_sep_plane,TMax)); fltx4 hits_back=AndSIMD(activeLocl,CmpLeSIMD(dist_to_sep_plane,TMax));
if (! IsAnyNegative(hits_back) ) if (! IsAnyNegative(hits_back) )
{ {
// missed the back - only need to traverse front node // missed the back - only need to traverse front node

View File

@ -155,14 +155,14 @@ void RayTracingEnvironment::RenderScene(
fltx4 MaxT=ldir.length(); fltx4 MaxT=ldir.length();
ldir.VectorNormalizeFast(); ldir.VectorNormalizeFast();
// now, compute shadow flag // now, compute shadow flag
FourRays myrays; FourRays myraysLocl;
myrays.origin=surface_pos; myraysLocl.origin=surface_pos;
FourVectors epsilon=ldir; FourVectors epsilon=ldir;
epsilon*=0.01; epsilon*=0.01;
myrays.origin+=epsilon; myraysLocl.origin+=epsilon;
myrays.direction=ldir; myraysLocl.direction=ldir;
RayTracingResult shadowtest; RayTracingResult shadowtest;
Trace4Rays(myrays,Four_Zeros,MaxT, &shadowtest); Trace4Rays(myraysLocl,Four_Zeros,MaxT, &shadowtest);
fltx4 unshadowed=CmpGtSIMD(shadowtest.HitDistance,MaxT); fltx4 unshadowed=CmpGtSIMD(shadowtest.HitDistance,MaxT);
if (! (IsAllZeros(unshadowed))) if (! (IsAllZeros(unshadowed)))
{ {

View File

@ -1357,13 +1357,13 @@ int64 bf_read::ReadLongLong()
float bf_read::ReadFloat() float bf_read::ReadFloat()
{ {
float ret; float retLocl;
Assert( sizeof(ret) == 4 ); Assert( sizeof(retLocl) == 4 );
ReadBits(&ret, 32); ReadBits(&retLocl, 32);
// Swap the float, since ReadBits reads raw data // Swap the float, since ReadBits reads raw data
LittleFloat( &ret, &ret ); LittleFloat( &retLocl, &retLocl );
return ret; return retLocl;
} }
bool bf_read::ReadBytes(void *pOut, int nBytes) bool bf_read::ReadBytes(void *pOut, int nBytes)

View File

@ -138,7 +138,7 @@ class LogMessage {
class LogMessageCrash : public LogMessage { class LogMessageCrash : public LogMessage {
public: public:
LogMessageCrash() { } LogMessageCrash() { }
#if _MSC_VER == 1700 || _MSC_VER == 1800 #if _MSC_VER >= 1700
// Bogus warning from VS 2012 and VS 2013: // Bogus warning from VS 2012 and VS 2013:
// warning C4722: 'snappy::LogMessageCrash::~LogMessageCrash' : destructor never returns, potential memory leak // warning C4722: 'snappy::LogMessageCrash::~LogMessageCrash' : destructor never returns, potential memory leak
#pragma warning(push) #pragma warning(push)

View File

@ -14,7 +14,8 @@ $Configuration
$Compiler $Compiler
{ {
$AdditionalIncludeDirectories "$BASE,..\common,$SRCDIR\game\shared,.\" $AdditionalIncludeDirectories "$BASE,..\common,$SRCDIR\game\shared,.\"
$PreprocessorDefinitions "$BASE;captioncompiler" $PreprocessorDefinitions "$BASE;PROTECTED_THINGS_DISABLE;captioncompiler" [$VS2019]
$PreprocessorDefinitions "$BASE;captioncompiler" [!$VS2019]
} }
} }

View File

@ -8510,7 +8510,7 @@ void VguiPanelGetSortedChildPanelList( Panel *pParentPanel, void *pSortedPanels
} }
} }
void VguiPanelGetSortedChildButtonList( Panel *pParentPanel, void *pSortedPanels, char *pchFilter /*= NULL*/, int nFilterType /*= 0*/ ) void VguiPanelGetSortedChildButtonList( Panel *pParentPanel, void *pSortedPanels, const char *pchFilter /*= NULL*/, int nFilterType /*= 0*/ )
{ {
CUtlSortVector< SortedPanel_t, CSortedPanelYLess > *pList = reinterpret_cast< CUtlSortVector< SortedPanel_t, CSortedPanelYLess >* >( pSortedPanels ); CUtlSortVector< SortedPanel_t, CSortedPanelYLess > *pList = reinterpret_cast< CUtlSortVector< SortedPanel_t, CSortedPanelYLess >* >( pSortedPanels );

View File

@ -18,7 +18,9 @@
#include <vgui_controls/ScrollBarSlider.h> #include <vgui_controls/ScrollBarSlider.h>
#include <vgui_controls/Controls.h> #include <vgui_controls/Controls.h>
#if _MSC_VER < 1900
#include <math.h> #include <math.h>
#endif
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h> #include <tier0/memdbgon.h>

View File

@ -6,8 +6,8 @@
// and implement another button here. // and implement another button here.
//=============================================================================// //=============================================================================//
#include <math.h> //#include <math.h>
#define PROTECTED_THINGS_DISABLE //#define PROTECTED_THINGS_DISABLE
#include <vgui/IInput.h> #include <vgui/IInput.h>
#include <vgui/ISystem.h> #include <vgui/ISystem.h>

View File

@ -418,7 +418,7 @@ class TreeNode : public Panel
public: public:
TreeNode(Panel *parent, TreeView *pTreeView); TreeNode(Panel *parent, TreeView *pTreeView);
~TreeNode(); virtual ~TreeNode();
void SetText(const char *pszText); void SetText(const char *pszText);
void SetFont(HFont font); void SetFont(HFont font);
void SetKeyValues(KeyValues *data); void SetKeyValues(KeyValues *data);

View File

@ -16,17 +16,15 @@
//$Conditional TF_BETA "1" //$Conditional TF_BETA "1"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Mapbase conditional, equivalent to (and required for) our MAPBASE preprocessor defined below
$Conditional MAPBASE "1"
// Toggles Mapbase's RPC implementation $Conditional VS2019 "1" // Toggles Visual Studio 2019 toolset (NOTE: This makes the solution incompatible with Visual Studio 2013)
$Conditional MAPBASE_RPC "1"
// Toggles VScript implementation (note: interfaces still exist, just the provided implementation is not present) // Mapbase functionality conditionals
$Conditional MAPBASE_VSCRIPT "1" $Conditional MAPBASE "1" // Equivalent to (and required for) our MAPBASE preprocessor defined below
$Conditional MAPBASE_RPC "1" // Toggles Mapbase's Rich Presence Client implementations
$Conditional MAPBASE_VSCRIPT "1" // Toggles VScript implementation (note: interfaces still exist, just the provided implementation is not present)
$Conditional NEW_RESPONSE_SYSTEM "1" // Toggles the new Response System library based on the Alien Swarm SDK
// Toggles the new Response System library based on the Alien Swarm SDK.
$Conditional NEW_RESPONSE_SYSTEM "1"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
$Configuration "Debug" $Configuration "Debug"

View File

@ -39,12 +39,14 @@ $Configuration
$Compiler [$WIN32] $Compiler [$WIN32]
{ {
$EnableEnhancedInstructionSet "Streaming SIMD Extensions (/arch:SSE)" $EnableEnhancedInstructionSet "Streaming SIMD Extensions (/arch:SSE)" [!$VS2019]
$EnableEnhancedInstructionSet "Streaming SIMD Extensions 2 (/arch:SSE2)" [$VS2019]
} }
$Linker $Linker
{ {
$AdditionalDependencies "$BASE shell32.lib user32.lib advapi32.lib gdi32.lib comdlg32.lib ole32.lib" [$WIN32||$WIN64] $AdditionalDependencies "$BASE shell32.lib user32.lib advapi32.lib gdi32.lib comdlg32.lib ole32.lib" [($WIN32||$WIN64) && !$VS2019]
$AdditionalDependencies "$BASE shell32.lib user32.lib advapi32.lib gdi32.lib comdlg32.lib ole32.lib legacy_stdio_definitions.lib" [($WIN32||$WIN64) && $VS2019]
$TargetMachine "MachineX86 (/MACHINE:X86)" [$WIN32] $TargetMachine "MachineX86 (/MACHINE:X86)" [$WIN32]
$TargetMachine "MachineX64 (/MACHINE:X64)" [$WIN64] $TargetMachine "MachineX64 (/MACHINE:X64)" [$WIN64]
// Suppress this pointless warning using the undocumented /ignore linker switch // Suppress this pointless warning using the undocumented /ignore linker switch
@ -69,7 +71,7 @@ $Configuration
"if ERRORLEVEL 1 goto BuildEventFailed" "\n" \ "if ERRORLEVEL 1 goto BuildEventFailed" "\n" \
"if exist $QUOTE$(TargetDir)$(TargetName).map$QUOTE copy $QUOTE$(TargetDir)$(TargetName).map$QUOTE $OUTBINDIR\$(TargetName).map" "\n" "if exist $QUOTE$(TargetDir)$(TargetName).map$QUOTE copy $QUOTE$(TargetDir)$(TargetName).map$QUOTE $OUTBINDIR\$(TargetName).map" "\n"
$CommandLine "$BASE" "call $SRCDIR\vpc_scripts\valve_p4_edit.cmd $QUOTE$OUTBINDIR\$(TargetName).pdb$QUOTE $SRCDIR" "\n" [!$SOURCESDK] $CommandLine "$BASE" "call $SRCDIR\vpc_scripts\valve_p4_edit.cmd $QUOTE$OUTBINDIR\$(TargetName).pdb$QUOTE $SRCDIR" "\n" [!$SOURCESDK]
$CommandLine "$BASE" "copy $QUOTE$(TargetDir)$(TargetName).pdb$QUOTE $OUTBINDIR\$(TargetName).pdb" "\n" \ $CommandLine "$BASE" "copy $QUOTE$(TargetDir)$(TargetName).pdb$QUOTE $QUOTE$OUTBINDIR\$(TargetName).pdb$QUOTE" "\n" \
"if ERRORLEVEL 1 goto BuildEventFailed" "\n" \ "if ERRORLEVEL 1 goto BuildEventFailed" "\n" \
"goto BuildEventOK" "\n" \ "goto BuildEventOK" "\n" \
":BuildEventFailed" "\n" \ ":BuildEventFailed" "\n" \
@ -114,7 +116,8 @@ $Project
$CustomBuildStep $CustomBuildStep
{ {
// General // General
$CommandLine "$QUOTE$(VCInstallDir)bin\ml.exe$QUOTE /safeseh /c /Cp /Zi /Fo$QUOTE$(IntDir)\$(InputName).obj$QUOTE $QUOTE$(InputPath)$QUOTE" $CommandLine "$QUOTE$(VCInstallDir)bin\ml.exe$QUOTE /safeseh /c /Cp /Zi /Fo$QUOTE$(IntDir)\$(InputName).obj$QUOTE $QUOTE$(InputPath)$QUOTE" [!$VS2019]
$CommandLine "$QUOTE$(VC_ExecutablePath_x64_x86)bin\ml.exe$QUOTE /safeseh /c /Cp /Zi /Fo$QUOTE$(IntDir)\$(InputName).obj$QUOTE $QUOTE$(InputPath)$QUOTE" [$VS2019]
$Description "Compiling pointeroverride.asm" $Description "Compiling pointeroverride.asm"
$Outputs "$(IntDir)\$(InputName).obj" $Outputs "$(IntDir)\$(InputName).obj"
} }

View File

@ -39,7 +39,8 @@ $Configuration
$Compiler [$WIN32] $Compiler [$WIN32]
{ {
$EnableEnhancedInstructionSet "Streaming SIMD Extensions (/arch:SSE)" $EnableEnhancedInstructionSet "Streaming SIMD Extensions (/arch:SSE)" [!$VS2019]
$EnableEnhancedInstructionSet "Streaming SIMD Extensions 2 (/arch:SSE2)" [$VS2019]
} }
$Linker $Linker
@ -66,7 +67,8 @@ $Configuration
$PostBuildEvent [!$ANALYZE] $PostBuildEvent [!$ANALYZE]
{ {
$CommandLine "call $SRCDIR\vpc_scripts\valve_p4_edit.cmd $OUTBINDIR\$(TargetFileName) $SRCDIR" "\n" [!$SOURCESDK] $CommandLine "call $SRCDIR\vpc_scripts\valve_p4_edit.cmd $OUTBINDIR\$(TargetFileName) $SRCDIR" "\n" [!$SOURCESDK && !$VS2019]
$CommandLine "if not exist $QUOTE$OUTBINDIR$QUOTE mkdir $QUOTE$OUTBINDIR$QUOTE" "\n" [!$SOURCESDK && $VS2019]
$CommandLine "$BASE" "copy $QUOTE$(TargetDir)$QUOTE$(TargetFileName) $OUTBINDIR\$(TargetFileName) >nul" "\n" \ $CommandLine "$BASE" "copy $QUOTE$(TargetDir)$QUOTE$(TargetFileName) $OUTBINDIR\$(TargetFileName) >nul" "\n" \
"if ERRORLEVEL 1 goto BuildEventFailed" "\n" \ "if ERRORLEVEL 1 goto BuildEventFailed" "\n" \
"if exist $QUOTE$(TargetDir)$QUOTE$(TargetName).map copy $QUOTE$(TargetDir)$QUOTE$(TargetName).map $OUTBINDIR\$(TargetName).map >nul" "\n" "if exist $QUOTE$(TargetDir)$QUOTE$(TargetName).map copy $QUOTE$(TargetDir)$QUOTE$(TargetName).map $OUTBINDIR\$(TargetName).map >nul" "\n"
@ -109,7 +111,8 @@ $Project
$CustomBuildStep $CustomBuildStep
{ {
// General // General
$CommandLine "$QUOTE$(VCInstallDir)bin\ml.exe$QUOTE /c /Cp /Zi /Fo$QUOTE$(IntDir)\$(InputName).obj$QUOTE $QUOTE$(InputPath)$QUOTE" $CommandLine "$QUOTE$(VCInstallDir)bin\ml.exe$QUOTE /c /Cp /Zi /Fo$QUOTE$(IntDir)\$(InputName).obj$QUOTE $QUOTE$(InputPath)$QUOTE" [!$VS2019]
$CommandLine "$QUOTE$(VC_ExecutablePath_x64_x86)\ml.exe$QUOTE /c /Cp /Zi /Fo$QUOTE$(IntDir)\$(InputName).obj$QUOTE $QUOTE$(InputPath)$QUOTE" [$VS2019]
$Description "Compiling pointeroverride.asm" $Description "Compiling pointeroverride.asm"
$Outputs "$(IntDir)\$(InputName).obj" $Outputs "$(IntDir)\$(InputName).obj"
} }

View File

@ -38,7 +38,8 @@ $Configuration
$Compiler [$WIN32] $Compiler [$WIN32]
{ {
$EnableEnhancedInstructionSet "Streaming SIMD Extensions (/arch:SSE)" $EnableEnhancedInstructionSet "Streaming SIMD Extensions (/arch:SSE)" [!$VS2019]
$EnableEnhancedInstructionSet "Streaming SIMD Extensions 2 (/arch:SSE2)" [$VS2019]
} }
$PreBuildEvent $PreBuildEvent

View File

@ -8,10 +8,11 @@ $Configuration
$General $General
{ {
// Request a specific compiler toolset. // Request a specific compiler toolset.
$PlatformToolset "v110_xp" [$VS2012 && !$ANALYZE] // VS 2012 targeting Windows XP - http://msdn.microsoft.com/en-us/library/vstudio/jj851139.aspx $PlatformToolset "v110_xp" [$VS2012 && !$ANALYZE && !$VS2019] // VS 2012 targeting Windows XP - http://msdn.microsoft.com/en-us/library/vstudio/jj851139.aspx
$PlatformToolset "v110" [$VS2012 && $ANALYZE] // VS 2012 for /analyze $PlatformToolset "v110" [$VS2012 && $ANALYZE && !$VS2019] // VS 2012 for /analyze
$PlatformToolset "v120_xp" [$VS2013 && !$ANALYZE] // VS 2013 targeting Windows XP - http://msdn.microsoft.com/en-us/library/vstudio/jj851139.aspx $PlatformToolset "v120_xp" [$VS2013 && !$ANALYZE && !$VS2019] // VS 2013 targeting Windows XP - http://msdn.microsoft.com/en-us/library/vstudio/jj851139.aspx
$PlatformToolset "v120" [$VS2013 && $ANALYZE] // VS 2013 for /analyze $PlatformToolset "v120" [$VS2013 && $ANALYZE && !$VS2019] // VS 2013 for /analyze
$PlatformToolset "v142" [$VS2019] // VS 2019
} }
$General $General
@ -31,6 +32,10 @@ $Configuration
// warning C4316: object allocated on the heap may not be aligned 16 // warning C4316: object allocated on the heap may not be aligned 16
$DisableSpecificWarnings "$BASE;4316" [$VS2013] $DisableSpecificWarnings "$BASE;4316" [$VS2013]
// warning C4838: conversion requires a narrowing conversion
// warning C4456-4459: variable shadowing. TODO: fix those!
$DisableSpecificWarnings "$BASE;4316;4838;4456;4457;4458;4459" [$VS2019]
// Having lots of warnings makes it harder to notice new, and possibly // Having lots of warnings makes it harder to notice new, and possibly
// important warnings, both on buildbot and in the output window. Lots // important warnings, both on buildbot and in the output window. Lots