aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public
diff options
context:
space:
mode:
authorNarendra Umate <[email protected]>2013-12-08 01:27:41 -0800
committerNarendra Umate <[email protected]>2013-12-08 01:27:41 -0800
commit4fa56874ba1557274c10077bf8386ece4c61dbd6 (patch)
treee2d336604e960b548e996d2e7dcfc5a1e1401b9e /mp/src/public
parentAdded DS_Store to .gitignore. (diff)
parentMake libSDL2.so/dylib into symlinks. (diff)
downloadsource-sdk-2013-4fa56874ba1557274c10077bf8386ece4c61dbd6.tar.xz
source-sdk-2013-4fa56874ba1557274c10077bf8386ece4c61dbd6.zip
Merge remote-tracking branch 'upstream/master'
Reverted .gitattributes xcode_ccache_wrapper change. Fixed line endings for .gitignore and .gitattributes.
Diffstat (limited to 'mp/src/public')
-rw-r--r--mp/src/public/VGuiMatSurface/IMatSystemSurface.h4
-rw-r--r--mp/src/public/XUnzip.cpp10
-rw-r--r--mp/src/public/bone_setup.cpp108
-rw-r--r--mp/src/public/bone_setup.h2
-rw-r--r--mp/src/public/filesystem_init.cpp64
-rw-r--r--mp/src/public/filesystem_init.h3
-rw-r--r--mp/src/public/materialsystem/imaterialsystem.h15
-rw-r--r--mp/src/public/materialsystem/materialsystem_config.h7
-rw-r--r--mp/src/public/mathlib/vector.h2
-rw-r--r--mp/src/public/mathlib/vmatrix.h3
-rw-r--r--mp/src/public/matsys_controls/mdlpanel.h8
-rw-r--r--mp/src/public/matsys_controls/mdlpicker.h1
-rw-r--r--mp/src/public/matsys_controls/potterywheelpanel.h3
-rw-r--r--mp/src/public/shaderapi/IShaderDevice.h1
-rw-r--r--mp/src/public/shaderapi/ishaderapi.h2
-rw-r--r--mp/src/public/sourcevr/isourcevirtualreality.h (renamed from mp/src/public/headtrack/isourcevirtualreality.h)102
-rw-r--r--mp/src/public/studio.h184
-rw-r--r--mp/src/public/tier0/afxmem_override.cpp8
-rw-r--r--mp/src/public/tier0/dbg.h10
-rw-r--r--mp/src/public/tier0/pointeroverride.asm32
-rw-r--r--mp/src/public/tier1/fmtstr.h115
-rw-r--r--mp/src/public/togl/glfuncs.inl14
-rw-r--r--mp/src/public/vgui/ISurface.h9
-rw-r--r--mp/src/public/windows_default.manifest28
24 files changed, 516 insertions, 219 deletions
diff --git a/mp/src/public/VGuiMatSurface/IMatSystemSurface.h b/mp/src/public/VGuiMatSurface/IMatSystemSurface.h
index ddc73e69..03ff33b0 100644
--- a/mp/src/public/VGuiMatSurface/IMatSystemSurface.h
+++ b/mp/src/public/VGuiMatSurface/IMatSystemSurface.h
@@ -105,6 +105,10 @@ public:
// Gets a material bound to a surface texture ID
virtual IMaterial *DrawGetTextureMaterial( int id ) = 0;
+
+ // The matching method is in ISurface, but we can't add anything there and remain mod-compatible.
+ // So this goes here instead.
+ virtual void GetFullscreenViewportAndRenderTarget( int & x, int & y, int & w, int & h, ITexture **ppRenderTarget ) = 0;
};
diff --git a/mp/src/public/XUnzip.cpp b/mp/src/public/XUnzip.cpp
index bd7dc20e..cea57582 100644
--- a/mp/src/public/XUnzip.cpp
+++ b/mp/src/public/XUnzip.cpp
@@ -4474,15 +4474,7 @@ bool SafeUnzipMemory( const void *pvZipped, int cubZipped, void *pvDest, int cub
int iRes = ZR_CORRUPT;
if ( hZip )
{
- try
- {
- iRes = UnzipItem( hZip, 0, pvDest, cubDest, ZIP_MEMORY );
- }
- catch ( ... )
- {
- // failed to unzip, try to continue
- iRes = ZR_CORRUPT;
- }
+ iRes = UnzipItem( hZip, 0, pvDest, cubDest, ZIP_MEMORY );
CloseZip( hZip );
}
diff --git a/mp/src/public/bone_setup.cpp b/mp/src/public/bone_setup.cpp
index 0cc81c67..250133d5 100644
--- a/mp/src/public/bone_setup.cpp
+++ b/mp/src/public/bone_setup.cpp
@@ -678,6 +678,12 @@ static void CalcLocalHierarchyAnimation(
int boneMask
)
{
+#ifdef STAGING_ONLY
+ Assert( iNewParent == -1 || (iNewParent >= 0 && iNewParent < MAXSTUDIOBONES) );
+ Assert( iBone > 0 );
+ Assert( iBone < MAXSTUDIOBONES );
+#endif // STAGING_ONLY
+
Vector localPos;
Quaternion localQ;
@@ -715,12 +721,19 @@ static void CalcLocalHierarchyAnimation(
CalcDecompressedAnimation( pHierarchy->pLocalAnim(), iFrame - pHierarchy->iStart, flFraq, localPos, localQ );
BuildBoneChain( pStudioHdr, rootXform, pos, q, iBone, boneToWorld, boneComputed );
- BuildBoneChain( pStudioHdr, rootXform, pos, q, iNewParent, boneToWorld, boneComputed );
matrix3x4_t localXform;
AngleMatrix( localQ, localPos, localXform );
- ConcatTransforms( boneToWorld[iNewParent], localXform, boneToWorld[iBone] );
+ if ( iNewParent != -1 )
+ {
+ BuildBoneChain( pStudioHdr, rootXform, pos, q, iNewParent, boneToWorld, boneComputed );
+ ConcatTransforms( boneToWorld[iNewParent], localXform, boneToWorld[iBone] );
+ }
+ else
+ {
+ boneToWorld[iBone] = localXform;
+ }
// back solve
Vector p1;
@@ -995,10 +1008,17 @@ static void CalcVirtualAnimation( virtualmodel_t *pVModel, const CStudioHdr *pSt
int iBone = pAnimGroup->masterBone[pHierarchy->iBone];
if (iBone >= 0 && (pStudioHdr->boneFlags(iBone) & boneMask))
{
- int iNewParent = pAnimGroup->masterBone[pHierarchy->iNewParent];
- if (iNewParent >= 0 && (pStudioHdr->boneFlags(iNewParent) & boneMask))
+ if ( pHierarchy->iNewParent != -1 )
{
- CalcLocalHierarchyAnimation( pStudioHdr, boneToWorld, boneComputed, pos, q, pbone, pHierarchy, iBone, iNewParent, cycle, iFrame, s, boneMask );
+ int iNewParent = pAnimGroup->masterBone[pHierarchy->iNewParent];
+ if (iNewParent >= 0 && (pStudioHdr->boneFlags(iNewParent) & boneMask))
+ {
+ CalcLocalHierarchyAnimation( pStudioHdr, boneToWorld, boneComputed, pos, q, pbone, pHierarchy, iBone, iNewParent, cycle, iFrame, s, boneMask );
+ }
+ }
+ else
+ {
+ CalcLocalHierarchyAnimation( pStudioHdr, boneToWorld, boneComputed, pos, q, pbone, pHierarchy, iBone, -1, cycle, iFrame, s, boneMask );
}
}
}
@@ -5948,3 +5968,81 @@ bool Studio_PrefetchSequence( const CStudioHdr *pStudioHdr, int iSequence )
// Everything for this sequence is resident?
return !pendingload;
}
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Drive a flex controller from a component of a bone
+//-----------------------------------------------------------------------------
+void Studio_RunBoneFlexDrivers( float *pflFlexControllerWeights, const CStudioHdr *pStudioHdr, const Vector *pvPositions, const matrix3x4_t *pBoneToWorld, const matrix3x4_t &mRootToWorld )
+{
+ bool bRootToWorldInvComputed = false;
+ matrix3x4_t mRootToWorldInv;
+ matrix3x4_t mParentInv;
+ matrix3x4_t mBoneLocal;
+
+ const int nBoneFlexDriverCount = pStudioHdr->BoneFlexDriverCount();
+
+ for ( int i = 0; i < nBoneFlexDriverCount; ++i )
+ {
+ const mstudioboneflexdriver_t *pBoneFlexDriver = pStudioHdr->BoneFlexDriver( i );
+ const mstudiobone_t *pStudioBone = pStudioHdr->pBone( pBoneFlexDriver->m_nBoneIndex );
+
+ const int nControllerCount = pBoneFlexDriver->m_nControlCount;
+
+ if ( pStudioBone->flags & BONE_USED_BY_BONE_MERGE )
+ {
+ // The local space version of the bone is not available if this is a bonemerged bone
+ // so do the slow computation of the local version of the bone from boneToWorld
+
+ if ( pStudioBone->parent < 0 )
+ {
+ if ( !bRootToWorldInvComputed )
+ {
+ MatrixInvert( mRootToWorld, mRootToWorldInv );
+ bRootToWorldInvComputed = true;
+ }
+
+ MatrixMultiply( mRootToWorldInv, pBoneToWorld[ pBoneFlexDriver->m_nBoneIndex ], mBoneLocal );
+ }
+ else
+ {
+ MatrixInvert( pBoneToWorld[ pStudioBone->parent ], mParentInv );
+ MatrixMultiply( mParentInv, pBoneToWorld[ pBoneFlexDriver->m_nBoneIndex ], mBoneLocal );
+ }
+
+ for ( int j = 0; j < nControllerCount; ++j )
+ {
+ const mstudioboneflexdrivercontrol_t *pController = pBoneFlexDriver->pBoneFlexDriverControl( j );
+ const mstudioflexcontroller_t *pFlexController = pStudioHdr->pFlexcontroller( static_cast< LocalFlexController_t >( pController->m_nFlexControllerIndex ) );
+
+ if ( pFlexController->localToGlobal < 0 )
+ continue;
+
+ Assert( pController->m_nFlexControllerIndex >= 0 && pController->m_nFlexControllerIndex < pStudioHdr->numflexcontrollers() );
+ Assert( pController->m_nBoneComponent >= 0 && pController->m_nBoneComponent <= 2 );
+ pflFlexControllerWeights[pFlexController->localToGlobal] =
+ RemapValClamped( mBoneLocal[pController->m_nBoneComponent][3], pController->m_flMin, pController->m_flMax, 0.0f, 1.0f );
+ }
+ }
+ else
+ {
+ // Use the local space version of the bone directly for non-bonemerged bones
+
+ const Vector &position = pvPositions[ pBoneFlexDriver->m_nBoneIndex ];
+
+ for ( int j = 0; j < nControllerCount; ++j )
+ {
+ const mstudioboneflexdrivercontrol_t *pController = pBoneFlexDriver->pBoneFlexDriverControl( j );
+ const mstudioflexcontroller_t *pFlexController = pStudioHdr->pFlexcontroller( static_cast< LocalFlexController_t >( pController->m_nFlexControllerIndex ) );
+
+ if ( pFlexController->localToGlobal < 0 )
+ continue;
+
+ Assert( pController->m_nFlexControllerIndex >= 0 && pController->m_nFlexControllerIndex < pStudioHdr->numflexcontrollers() );
+ Assert( pController->m_nBoneComponent >= 0 && pController->m_nBoneComponent <= 2 );
+ pflFlexControllerWeights[pFlexController->localToGlobal] =
+ RemapValClamped( position[pController->m_nBoneComponent], pController->m_flMin, pController->m_flMax, 0.0f, 1.0f );
+ }
+ }
+ }
+}
diff --git a/mp/src/public/bone_setup.h b/mp/src/public/bone_setup.h
index ebbdfd57..76f00a66 100644
--- a/mp/src/public/bone_setup.h
+++ b/mp/src/public/bone_setup.h
@@ -444,4 +444,6 @@ void QuaternionMA( const Quaternion &p, float s, const Quaternion &q, Quaternion
bool Studio_PrefetchSequence( const CStudioHdr *pStudioHdr, int iSequence );
+void Studio_RunBoneFlexDrivers( float *pFlexController, const CStudioHdr *pStudioHdr, const Vector *pPositions, const matrix3x4_t *pBoneToWorld, const matrix3x4_t &mRootToWorld );
+
#endif // BONE_SETUP_H
diff --git a/mp/src/public/filesystem_init.cpp b/mp/src/public/filesystem_init.cpp
index 08e8da17..36b484f5 100644
--- a/mp/src/public/filesystem_init.cpp
+++ b/mp/src/public/filesystem_init.cpp
@@ -224,6 +224,7 @@ CFSSearchPathsInit::CFSSearchPathsInit()
m_pDirectoryName = NULL;
m_pLanguage = NULL;
m_ModPath[0] = 0;
+ m_bMountHDContent = m_bLowViolence = false;
}
@@ -460,52 +461,6 @@ FSReturnCode_t LoadGameInfoFile(
return FS_OK;
}
-// checks the registry for the low violence setting
-// Check "HKEY_CURRENT_USER\Software\Valve\Source\Settings" and "User Token 2" or "User Token 3"
-bool IsLowViolenceBuild( void )
-{
-#if defined(_WIN32)
- HKEY hKey;
- char szValue[64];
- unsigned long len = sizeof(szValue) - 1;
- bool retVal = false;
-
- if ( IsPC() && RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\Valve\\Source\\Settings", NULL, KEY_READ, &hKey) == ERROR_SUCCESS )
- {
- // User Token 2
- if ( RegQueryValueEx( hKey, "User Token 2", NULL, NULL, (unsigned char*)szValue, &len ) == ERROR_SUCCESS )
- {
- if ( Q_strlen( szValue ) > 0 )
- {
- retVal = true;
- }
- }
-
- if ( !retVal )
- {
- // reset "len" for the next check
- len = sizeof(szValue) - 1;
-
- // User Token 3
- if ( RegQueryValueEx( hKey, "User Token 3", NULL, NULL, (unsigned char*)szValue, &len ) == ERROR_SUCCESS )
- {
- if ( Q_strlen( szValue ) > 0 )
- {
- retVal = true;
- }
- }
- }
-
- RegCloseKey(hKey);
- }
-
- return retVal;
-#elif POSIX
- return false;
-#else
- #error "Fix me"
-#endif
-}
static void FileSystem_AddLoadedSearchPath(
CFSSearchPathsInit &initInfo,
@@ -519,13 +474,26 @@ static void FileSystem_AddLoadedSearchPath(
{
// Not in LV build, don't mount
- if ( !bLowViolence )
+ if ( !initInfo.m_bLowViolence )
+ return;
+
+ // Mount, as a game path
+ pPathID = "game";
+ }
+
+ // Check for mounting HD game content if enabled
+ if ( V_stricmp( pPathID, "game_hd" ) == 0 )
+ {
+
+ // Not in LV build, don't mount
+ if ( !initInfo.m_bMountHDContent )
return;
// Mount, as a game path
pPathID = "game";
}
+
// Special processing for ordinary game folders
if ( V_stristr( fullLocationPath, ".vpk" ) == NULL && Q_stricmp( pPathID, "game" ) == 0 )
{
@@ -600,7 +568,7 @@ FSReturnCode_t FileSystem_LoadSearchPaths( CFSSearchPathsInit &initInfo )
}
}
- bool bLowViolence = IsLowViolenceBuild();
+ bool bLowViolence = initInfo.m_bLowViolence;
for ( KeyValues *pCur=pSearchPaths->GetFirstValue(); pCur; pCur=pCur->GetNextValue() )
{
const char *pLocation = pCur->GetString();
diff --git a/mp/src/public/filesystem_init.h b/mp/src/public/filesystem_init.h
index 182ea411..d95e7c3a 100644
--- a/mp/src/public/filesystem_init.h
+++ b/mp/src/public/filesystem_init.h
@@ -156,6 +156,9 @@ public:
// This is the filesystem FileSystem_LoadSearchPaths is talking to.
IFileSystem *m_pFileSystem;
+ bool m_bMountHDContent;
+ bool m_bLowViolence;
+
// Outputs.
public:
// This is the location of the first search path called "game", which also becomes your "mod" search path.
diff --git a/mp/src/public/materialsystem/imaterialsystem.h b/mp/src/public/materialsystem/imaterialsystem.h
index 9a16b9db..812eb262 100644
--- a/mp/src/public/materialsystem/imaterialsystem.h
+++ b/mp/src/public/materialsystem/imaterialsystem.h
@@ -524,7 +524,8 @@ enum RenderTargetSizeMode_t
RT_SIZE_FULL_FRAME_BUFFER=4, // Same size as frame buffer, or next lower power of 2 if we can't do that.
RT_SIZE_OFFSCREEN=5, // Target of specified size, don't mess with dimensions
RT_SIZE_FULL_FRAME_BUFFER_ROUNDED_UP=6, // Same size as the frame buffer, rounded up if necessary for systems that can't do non-power of two textures.
- RT_SIZE_REPLAY_SCREENSHOT = 7 // Rounded down to power of 2, essentially...
+ RT_SIZE_REPLAY_SCREENSHOT = 7, // Rounded down to power of 2, essentially...
+ RT_SIZE_LITERAL = 8 // Use the size passed in. Don't clamp it to the frame buffer size. Really.
};
typedef void (*MaterialBufferReleaseFunc_t)( );
@@ -1028,6 +1029,16 @@ public:
#ifdef DX_TO_GL_ABSTRACTION
virtual void DoStartupShaderPreloading( void ) = 0;
#endif
+
+ // Sets the override sizes for all render target size tests. These replace the frame buffer size.
+ // Set them when you are rendering primarily to something larger than the frame buffer (as in VR mode).
+ virtual void SetRenderTargetFrameBufferSizeOverrides( int nWidth, int nHeight ) = 0;
+
+ // Returns the (possibly overridden) framebuffer size for render target sizing.
+ virtual void GetRenderTargetFrameBufferDimensions( int & nWidth, int & nHeight ) = 0;
+
+ // returns the display device name that matches the adapter index we were started with
+ virtual char *GetDisplayDeviceName() const = 0;
};
@@ -1482,7 +1493,7 @@ public:
// Returns whether a pointer is render data. NOTE: passing NULL returns true
virtual bool IsRenderData( const void *pData ) const = 0;
virtual void PrintfVA( char *fmt, va_list vargs ) = 0;
- virtual void Printf( PRINTF_FORMAT_STRING char *fmt, ... ) = 0;
+ virtual void Printf( PRINTF_FORMAT_STRING const char *fmt, ... ) = 0;
virtual float Knob( char *knobname, float *setvalue = NULL ) = 0;
// Allows us to override the alpha write setting of a material
virtual void OverrideAlphaWriteEnable( bool bEnable, bool bAlphaWriteEnable ) = 0;
diff --git a/mp/src/public/materialsystem/materialsystem_config.h b/mp/src/public/materialsystem/materialsystem_config.h
index b0fe3a27..2908d2ce 100644
--- a/mp/src/public/materialsystem/materialsystem_config.h
+++ b/mp/src/public/materialsystem/materialsystem_config.h
@@ -33,6 +33,7 @@ enum MaterialSystem_Config_Flags_t
MATSYS_VIDCFG_FLAGS_SCALE_TO_OUTPUT_RESOLUTION = ( 1 << 14 ),
MATSYS_VIDCFG_FLAGS_USING_MULTIPLE_WINDOWS = ( 1 << 15 ),
MATSYS_VIDCFG_FLAGS_DISABLE_PHONG = ( 1 << 16 ),
+ MATSYS_VIDCFG_FLAGS_VR_MODE = ( 1 << 17 ),
};
struct MaterialSystemHardwareIdentifier_t
@@ -64,6 +65,7 @@ struct MaterialSystem_Config_t
bool ScaleToOutputResolution() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_SCALE_TO_OUTPUT_RESOLUTION ) != 0; }
bool UsingMultipleWindows() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_USING_MULTIPLE_WINDOWS ) != 0; }
bool UsePhong() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_DISABLE_PHONG ) == 0; }
+ bool VRMode() const { return ( m_Flags & MATSYS_VIDCFG_FLAGS_VR_MODE) != 0; }
bool ShadowDepthTexture() const { return m_bShadowDepthTexture; }
bool MotionBlur() const { return m_bMotionBlur; }
bool SupportFlashlight() const { return m_bSupportFlashlight; }
@@ -140,6 +142,8 @@ struct MaterialSystem_Config_t
bool m_bMotionBlur;
bool m_bSupportFlashlight;
+ int m_nVRModeAdapter;
+
MaterialSystem_Config_t()
{
memset( this, 0, sizeof( *this ) );
@@ -160,6 +164,7 @@ struct MaterialSystem_Config_t
SetFlag( MATSYS_VIDCFG_FLAGS_SCALE_TO_OUTPUT_RESOLUTION, false );
SetFlag( MATSYS_VIDCFG_FLAGS_USING_MULTIPLE_WINDOWS, false );
SetFlag( MATSYS_VIDCFG_FLAGS_DISABLE_PHONG, false );
+ SetFlag( MATSYS_VIDCFG_FLAGS_VR_MODE, false );
m_VideoMode.m_Width = 640;
m_VideoMode.m_Height = 480;
@@ -182,6 +187,8 @@ struct MaterialSystem_Config_t
m_bMotionBlur = false;
m_bSupportFlashlight = true;
+ m_nVRModeAdapter = -1;
+
// misc defaults
bAllowCheats = false;
bCompressedTextures = true;
diff --git a/mp/src/public/mathlib/vector.h b/mp/src/public/mathlib/vector.h
index c19261d7..a797da25 100644
--- a/mp/src/public/mathlib/vector.h
+++ b/mp/src/public/mathlib/vector.h
@@ -1187,7 +1187,7 @@ inline Vector &AllocTempVector()
}
ThreadPause();
}
- return s_vecTemp[nIndex & 0xffff];
+ return s_vecTemp[nIndex];
}
diff --git a/mp/src/public/mathlib/vmatrix.h b/mp/src/public/mathlib/vmatrix.h
index 2c536672..c18e4822 100644
--- a/mp/src/public/mathlib/vmatrix.h
+++ b/mp/src/public/mathlib/vmatrix.h
@@ -200,6 +200,9 @@ public:
// Setup a matrix for origin and angles.
void SetupMatrixOrgAngles( const Vector &origin, const QAngle &vAngles );
+ // Setup a matrix for angles and no translation.
+ void SetupMatrixAngles( const QAngle &vAngles );
+
// General inverse. This may fail so check the return!
bool InverseGeneral(VMatrix &vInverse) const;
diff --git a/mp/src/public/matsys_controls/mdlpanel.h b/mp/src/public/matsys_controls/mdlpanel.h
index 8f0ccb30..91f936e7 100644
--- a/mp/src/public/matsys_controls/mdlpanel.h
+++ b/mp/src/public/matsys_controls/mdlpanel.h
@@ -51,6 +51,8 @@ public:
virtual void OnTick();
+ virtual void Paint();
+
// Sets the current mdl
virtual void SetMDL( MDLHandle_t handle, void *pProxyData = NULL );
virtual void SetMDL( const char *pMDLName, void *pProxyData = NULL );
@@ -78,6 +80,7 @@ public:
void SetSkin( int nSkin );
void SetLookAtCamera( bool bLookAtCamera );
void SetIgnoreDoubleClick( bool bState );
+ void SetThumbnailSafeZone( bool bVisible );
// Bounds.
bool GetBoundingBox( Vector &vecBoundsMin, Vector &vecBoundsMax );
@@ -103,6 +106,8 @@ public:
protected:
+ virtual void SetupRenderState( int nDisplayWidth, int nDisplayHeight ) OVERRIDE;
+
struct MDLData_t
{
CMDL m_MDL;
@@ -122,7 +127,7 @@ protected:
private:
// paint it!
- void OnPaint3D();
+ virtual void OnPaint3D();
virtual void PrePaint3D( IMatRenderContext *pRenderContext ) { };
virtual void PostPaint3D( IMatRenderContext *pRenderContext ) { };
virtual void RenderingMergedModel( IMatRenderContext *pRenderContext, CStudioHdr *pStudioHdr, MDLHandle_t mdlHandle, matrix3x4_t *pWorldMatrix ) { };
@@ -141,6 +146,7 @@ private:
bool m_bWireFrame : 1;
bool m_bLookAtCamera : 1;
bool m_bIgnoreDoubleClick : 1;
+ bool m_bThumbnailSafeZone : 1;
float m_PoseParameters[ MAXSTUDIOPOSEPARAM ];
};
diff --git a/mp/src/public/matsys_controls/mdlpicker.h b/mp/src/public/matsys_controls/mdlpicker.h
index 202167c5..fcacfc9c 100644
--- a/mp/src/public/matsys_controls/mdlpicker.h
+++ b/mp/src/public/matsys_controls/mdlpicker.h
@@ -101,6 +101,7 @@ private:
void WriteBackbackVMTFiles( const char *assetName );
void GenerateBackpackIcons( void );
+ CUtlString GetOutputFileSuffix();
MESSAGE_FUNC_PARAMS( OnCheckButtonChecked, "CheckButtonChecked", kv );
MESSAGE_FUNC_PARAMS( OnItemSelected, "ItemSelected", kv );
diff --git a/mp/src/public/matsys_controls/potterywheelpanel.h b/mp/src/public/matsys_controls/potterywheelpanel.h
index 8cb41497..47125a3f 100644
--- a/mp/src/public/matsys_controls/potterywheelpanel.h
+++ b/mp/src/public/matsys_controls/potterywheelpanel.h
@@ -131,8 +131,9 @@ protected:
bool m_bRenderToTexture;
+ virtual void SetupRenderState( int nDisplayWidth, int nDisplayHeight );
+
private:
- void SetupRenderState( int nDisplayWidth, int nDisplayHeight );
void CreateDefaultLights();
void DestroyLights();
diff --git a/mp/src/public/shaderapi/IShaderDevice.h b/mp/src/public/shaderapi/IShaderDevice.h
index 34749de0..832e6ac7 100644
--- a/mp/src/public/shaderapi/IShaderDevice.h
+++ b/mp/src/public/shaderapi/IShaderDevice.h
@@ -271,6 +271,7 @@ public:
#ifdef DX_TO_GL_ABSTRACTION
virtual void DoStartupShaderPreloading( void ) = 0;
#endif
+ virtual char *GetDisplayDeviceName() = 0;
};
diff --git a/mp/src/public/shaderapi/ishaderapi.h b/mp/src/public/shaderapi/ishaderapi.h
index 69782a60..367cd0e9 100644
--- a/mp/src/public/shaderapi/ishaderapi.h
+++ b/mp/src/public/shaderapi/ishaderapi.h
@@ -603,7 +603,7 @@ public:
// debug logging
// only implemented in some subclasses
virtual void PrintfVA( char *fmt, va_list vargs ) = 0;
- virtual void Printf( PRINTF_FORMAT_STRING char *fmt, ... ) = 0;
+ virtual void Printf( PRINTF_FORMAT_STRING const char *fmt, ... ) = 0;
virtual float Knob( char *knobname, float *setvalue = NULL ) = 0;
// Allows us to override the alpha write setting of a material
virtual void OverrideAlphaWriteEnable( bool bEnable, bool bAlphaWriteEnable ) = 0;
diff --git a/mp/src/public/headtrack/isourcevirtualreality.h b/mp/src/public/sourcevr/isourcevirtualreality.h
index 291d28a6..3e438455 100644
--- a/mp/src/public/headtrack/isourcevirtualreality.h
+++ b/mp/src/public/sourcevr/isourcevirtualreality.h
@@ -21,21 +21,19 @@
//-----------------------------------------------------------------------------
// forward declarations
//-----------------------------------------------------------------------------
+class ITexture;
+class IMaterialSystem;
//-----------------------------------------------------------------------------
// important enumeration
//-----------------------------------------------------------------------------
-struct VRTrackerState_t
-{
- // Tracker has finished starting up and has produced at least one valid pose.
- bool bInitialized;
-
- // Tracker currently has a valid pose.
- bool bHasValidPose;
- // Tracker is in a state where it is likely to suffer from yaw drift. This
- // would apply to any gyro-only tracking system.
- bool bWillDriftInYaw;
+struct VRRect_t
+{
+ int32 nX;
+ int32 nY;
+ int32 nWidth;
+ int32 nHeight;
};
@@ -69,6 +67,14 @@ public:
VREye_Right
};
+ // Which texture is being requested in GetRenderTarget?
+ enum EWhichRenderTarget
+ {
+ RT_Color = 0,
+ RT_Depth,
+ };
+
+
// ----------------------------------------------------------------------
// General utilities
// ----------------------------------------------------------------------
@@ -76,24 +82,17 @@ public:
// Returns true if the game should run in VR mode
virtual bool ShouldRunInVR() = 0;
- // The name of the display at which the game should put its window.
- // TODO: This is pretty horrible from a "what the game has to do" point
- // of view. Make it better.
- virtual const char *GetDisplayName() = 0;
-
- // The size of the window that the game should create
- virtual bool GetWindowSize( int *pnWidth, int *pnHeight ) = 0;
-
- // Lets engine tell headtrack that it's going to use a different size window based
- // what the display is actually using. This happens when somebody clones
- // their desktop onto the HMD
- virtual void OverrideWindowSize( int nWidth, int nHeight ) = 0;
+ // Returns true if there is a compatible HMD connected
+ virtual bool IsHmdConnected() = 0;
// The size and position of the viewport for the specified eye
virtual void GetViewportBounds( VREye eEye, int *pnX, int *pnY, int *pnWidth, int *pnHeight ) = 0;
// Performs the distortion post-processing.
- virtual bool DoDistortionProcessing ( const vrect_t *SrcRect ) = 0;
+ virtual bool DoDistortionProcessing ( VREye eEye ) = 0;
+
+ // Composites the HUD directly onto the backbuffer / render target, including undistort.
+ virtual bool CompositeHud ( VREye eEye, float ndcHudBounds[4], bool bDoUndistort, bool bBlackout, bool bTranslucent ) = 0;
// ----------------------------------------------------------------------
// Getting the current pose
@@ -102,13 +101,6 @@ public:
// returns the pose relative to the zero point
virtual VMatrix GetMideyePose() = 0;
- // returns the gravity-relative HUD correction matrix (I think)
- virtual VMatrix GetHudUpCorrection() = 0;
-
- // transforms to mid eye form left/right
- virtual VMatrix GetMidEyeFromLeft() = 0;
- virtual VMatrix GetMidEyeFromRight() = 0;
-
// All-in-one interfaces (they call GetCameraPoseZeroFromCurrent)
// Grabs the current tracking data and sets up state for the Override* calls.
virtual bool SampleTrackingState ( float PlayerGameFov, float fPredictionSeconds ) = 0;
@@ -117,41 +109,49 @@ public:
// Information about the display
// ----------------------------------------------------------------------
- // returns the serial number for the display or NULL if no serial number
- // could be retrieved
- virtual const char *GetDisplaySerialNumber() = 0;
-
- // returns the model number for the display or NULL if no model number
- // could be retrieved
- virtual const char *GetDisplayModelNumber() = 0;
-
- // returns the "ipd" of the display. This is the separation of the centers
- // of the two lenses in mm
- virtual float GetDisplaySeparationMM() = 0;
+ // Passes back the bounds of the window that the game should create. This might
+ // span two displays if we're dealing with a two-input display. Returns true
+ // if the bounds were set.
+ virtual bool GetDisplayBounds( VRRect_t *pRect ) = 0;
// Computes and returns the projection matrix for the eye
virtual bool GetEyeProjectionMatrix ( VMatrix *pResult, VREye, float zNear, float zFar, float fovScale ) = 0;
- // Returns the horizontal FOV of the display in degrees
- virtual float GetHorizontalFOVDegrees() = 0;
+ // Returns the transform from the mid-eye to the specified eye. Multiply this by
+ // the tweaked (for mouse rotation and WASD translation) mideye position to get the
+ // view matrix. This matrix takes the user's IPD into account.
+ virtual VMatrix GetMidEyeFromEye( VREye eEye ) = 0;
+
+ // returns the adapter index to use for VR mode
+ virtual int GetVRModeAdapter() = 0;
// ----------------------------------------------------------------------
- // Information about the user
+ // Information about the tracker
// ----------------------------------------------------------------------
- // returns the intrapupilar distance of the user in mm
- virtual float GetUserIPDMM() = 0;
+ virtual bool WillDriftInYaw() = 0;
- // sets the intrapupilar distance of the user in mm
- virtual void SetUserIPDMM( float fIPDMM ) = 0;
+ // ----------------------------------------------------------------------
+ // Methods about oversized offscreen rendering
+ // ----------------------------------------------------------------------
+
+ // Sets up the pre-distortion render targets.
+ virtual void CreateRenderTargets( IMaterialSystem *pMaterialSystem ) = 0;
+ virtual void ShutdownRenderTargets() = 0;
+
+ // fetches the render target for the specified eye
+ virtual ITexture *GetRenderTarget( VREye eEye, EWhichRenderTarget eWhich ) = 0;
+ // Returns the (possibly overridden) framebuffer size for render target sizing.
+ virtual void GetRenderTargetFrameBufferDimensions( int & nWidth, int & nHeight ) = 0;
// ----------------------------------------------------------------------
- // Information about the tracker
+ // Enter/leave VR mode
// ----------------------------------------------------------------------
+ virtual bool Activate() = 0;
+ virtual void Deactivate() = 0;
+
- // returns the state of the tracking system
- virtual VRTrackerState_t GetTrackerState() = 0;
};
diff --git a/mp/src/public/studio.h b/mp/src/public/studio.h
index 95f22a36..bcc38d5d 100644
--- a/mp/src/public/studio.h
+++ b/mp/src/public/studio.h
@@ -313,6 +313,63 @@ private:
};
+//-----------------------------------------------------------------------------
+// The component of the bone used by mstudioboneflexdriver_t
+//-----------------------------------------------------------------------------
+enum StudioBoneFlexComponent_t
+{
+ STUDIO_BONE_FLEX_INVALID = -1, // Invalid
+ STUDIO_BONE_FLEX_TX = 0, // Translate X
+ STUDIO_BONE_FLEX_TY = 1, // Translate Y
+ STUDIO_BONE_FLEX_TZ = 2 // Translate Z
+};
+
+
+//-----------------------------------------------------------------------------
+// Component is one of Translate X, Y or Z [0,2] (StudioBoneFlexComponent_t)
+//-----------------------------------------------------------------------------
+struct mstudioboneflexdrivercontrol_t
+{
+ DECLARE_BYTESWAP_DATADESC();
+
+ int m_nBoneComponent; // Bone component that drives flex, StudioBoneFlexComponent_t
+ int m_nFlexControllerIndex; // Flex controller to drive
+ float m_flMin; // Min value of bone component mapped to 0 on flex controller
+ float m_flMax; // Max value of bone component mapped to 1 on flex controller
+
+ mstudioboneflexdrivercontrol_t(){}
+private:
+ // No copy constructors allowed
+ mstudioboneflexdrivercontrol_t( const mstudioboneflexdrivercontrol_t &vOther );
+};
+
+
+//-----------------------------------------------------------------------------
+// Drive flex controllers from bone components
+//-----------------------------------------------------------------------------
+struct mstudioboneflexdriver_t
+{
+ DECLARE_BYTESWAP_DATADESC();
+
+ int m_nBoneIndex; // Bone to drive flex controller
+ int m_nControlCount; // Number of flex controllers being driven
+ int m_nControlIndex; // Index into data where controllers are (relative to this)
+
+ inline mstudioboneflexdrivercontrol_t *pBoneFlexDriverControl( int i ) const
+ {
+ Assert( i >= 0 && i < m_nControlCount );
+ return (mstudioboneflexdrivercontrol_t *)(((byte *)this) + m_nControlIndex) + i;
+ }
+
+ int unused[3];
+
+ mstudioboneflexdriver_t(){}
+private:
+ // No copy constructors allowed
+ mstudioboneflexdriver_t( const mstudioboneflexdriver_t &vOther );
+};
+
+
#define BONE_CALCULATE_MASK 0x1F
#define BONE_PHYSICALLY_SIMULATED 0x01 // bone is physically simulated when physics are active
#define BONE_PHYSICS_PROCEDURAL 0x02 // procedural when physics is active
@@ -902,33 +959,6 @@ struct mstudioflexcontrollerui_t
};
-// these are the on-disk format vertex anims
-struct dstudiovertanim_t
-{
- unsigned short index;
- byte speed; // 255/max_length_in_flex
- byte side; // 255/left_right
- Vector48 delta;
- Vector48 ndelta;
-
-private:
- // No copy constructors allowed
- dstudiovertanim_t(const dstudiovertanim_t& vOther);
-};
-
-
-struct dstudiovertanim_wrinkle_t : public dstudiovertanim_t
-{
- short wrinkledelta; // Encodes a range from -1 to 1. NOTE: -32768 == -32767 == -1.0f, 32767 = 1.0f
-
-private:
- // No copy constructors allowed
- dstudiovertanim_wrinkle_t( const dstudiovertanim_t& vOther );
-};
-
-const float g_VertAnimFixedPointScale = 1.0f / 4096.0f;
-const float g_VertAnimFixedPointScaleInv = 1.0f / g_VertAnimFixedPointScale;
-
// this is the memory image of vertex anims (16-bit fixed point)
struct mstudiovertanim_t
{
@@ -952,21 +982,31 @@ protected:
};
public:
- inline Vector GetDeltaFixed()
+ inline void ConvertToFixed( float flVertAnimFixedPointScale )
{
- return Vector( delta[0]*g_VertAnimFixedPointScale, delta[1]*g_VertAnimFixedPointScale, delta[2]*g_VertAnimFixedPointScale );
+ delta[0] = flDelta[0].GetFloat() / flVertAnimFixedPointScale;
+ delta[1] = flDelta[1].GetFloat() / flVertAnimFixedPointScale;
+ delta[2] = flDelta[2].GetFloat() / flVertAnimFixedPointScale;
+ ndelta[0] = flNDelta[0].GetFloat() / flVertAnimFixedPointScale;
+ ndelta[1] = flNDelta[1].GetFloat() / flVertAnimFixedPointScale;
+ ndelta[2] = flNDelta[2].GetFloat() / flVertAnimFixedPointScale;
}
- inline Vector GetNDeltaFixed()
+
+ inline Vector GetDeltaFixed( float flVertAnimFixedPointScale )
{
- return Vector( ndelta[0]*g_VertAnimFixedPointScale, ndelta[1]*g_VertAnimFixedPointScale, ndelta[2]*g_VertAnimFixedPointScale );
+ return Vector( delta[0] * flVertAnimFixedPointScale, delta[1] * flVertAnimFixedPointScale, delta[2] * flVertAnimFixedPointScale );
}
- inline void GetDeltaFixed4DAligned( Vector4DAligned *vFillIn )
+ inline Vector GetNDeltaFixed( float flVertAnimFixedPointScale )
{
- vFillIn->Set( delta[0]*g_VertAnimFixedPointScale, delta[1]*g_VertAnimFixedPointScale, delta[2]*g_VertAnimFixedPointScale, 0.0f );
+ return Vector( ndelta[0] * flVertAnimFixedPointScale, ndelta[1] * flVertAnimFixedPointScale, ndelta[2] * flVertAnimFixedPointScale );
}
- inline void GetNDeltaFixed4DAligned( Vector4DAligned *vFillIn )
+ inline void GetDeltaFixed4DAligned( Vector4DAligned *vFillIn, float flVertAnimFixedPointScale )
{
- vFillIn->Set( ndelta[0]*g_VertAnimFixedPointScale, ndelta[1]*g_VertAnimFixedPointScale, ndelta[2]*g_VertAnimFixedPointScale, 0.0f );
+ vFillIn->Set( delta[0] * flVertAnimFixedPointScale, delta[1] * flVertAnimFixedPointScale, delta[2] * flVertAnimFixedPointScale, 0.0f );
+ }
+ inline void GetNDeltaFixed4DAligned( Vector4DAligned *vFillIn, float flVertAnimFixedPointScale )
+ {
+ vFillIn->Set( ndelta[0] * flVertAnimFixedPointScale, ndelta[1] * flVertAnimFixedPointScale, ndelta[2] * flVertAnimFixedPointScale, 0.0f );
}
inline Vector GetDeltaFloat()
{
@@ -976,17 +1016,17 @@ public:
{
return Vector (flNDelta[0].GetFloat(), flNDelta[1].GetFloat(), flNDelta[2].GetFloat());
}
- inline void SetDeltaFixed( const Vector& vInput )
+ inline void SetDeltaFixed( const Vector& vInput, float flVertAnimFixedPointScale )
{
- delta[0] = vInput.x * g_VertAnimFixedPointScaleInv;
- delta[1] = vInput.y * g_VertAnimFixedPointScaleInv;
- delta[2] = vInput.z * g_VertAnimFixedPointScaleInv;
+ delta[0] = vInput.x / flVertAnimFixedPointScale;
+ delta[1] = vInput.y / flVertAnimFixedPointScale;
+ delta[2] = vInput.z / flVertAnimFixedPointScale;
}
- inline void SetNDeltaFixed( const Vector& vInputNormal )
+ inline void SetNDeltaFixed( const Vector& vInputNormal, float flVertAnimFixedPointScale )
{
- ndelta[0] = vInputNormal.x * g_VertAnimFixedPointScaleInv;
- ndelta[1] = vInputNormal.y * g_VertAnimFixedPointScaleInv;
- ndelta[2] = vInputNormal.z * g_VertAnimFixedPointScaleInv;
+ ndelta[0] = vInputNormal.x / flVertAnimFixedPointScale;
+ ndelta[1] = vInputNormal.y / flVertAnimFixedPointScale;
+ ndelta[2] = vInputNormal.z / flVertAnimFixedPointScale;
}
// Ick...can also force fp16 data into this structure for writing to file in legacy format...
@@ -1003,10 +1043,20 @@ public:
flNDelta[2].SetFloat( vInputNormal.z );
}
+ class CSortByIndex
+ {
+ public:
+ bool operator()(const mstudiovertanim_t &left, const mstudiovertanim_t & right)const
+ {
+ return left.index < right.index;
+ }
+ };
+ friend class CSortByIndex;
+
mstudiovertanim_t(){}
-private:
- // No copy constructors allowed
- mstudiovertanim_t(const mstudiovertanim_t& vOther);
+//private:
+// No copy constructors allowed, but it's needed for std::sort()
+// mstudiovertanim_t(const mstudiovertanim_t& vOther);
};
@@ -1017,20 +1067,25 @@ struct mstudiovertanim_wrinkle_t : public mstudiovertanim_t
short wrinkledelta;
- inline void SetWrinkleFixed( float flWrinkle )
+ inline void SetWrinkleFixed( float flWrinkle, float flVertAnimFixedPointScale )
{
- int nWrinkleDeltaInt = flWrinkle * g_VertAnimFixedPointScaleInv;
+ int nWrinkleDeltaInt = flWrinkle / flVertAnimFixedPointScale;
wrinkledelta = clamp( nWrinkleDeltaInt, -32767, 32767 );
}
- inline Vector4D GetDeltaFixed()
+ inline Vector4D GetDeltaFixed( float flVertAnimFixedPointScale )
{
- return Vector4D( delta[0]*g_VertAnimFixedPointScale, delta[1]*g_VertAnimFixedPointScale, delta[2]*g_VertAnimFixedPointScale, wrinkledelta*g_VertAnimFixedPointScale );
+ return Vector4D( delta[0] * flVertAnimFixedPointScale, delta[1] * flVertAnimFixedPointScale, delta[2] * flVertAnimFixedPointScale, wrinkledelta * flVertAnimFixedPointScale );
}
- inline void GetDeltaFixed4DAligned( Vector4DAligned *vFillIn )
+ inline void GetDeltaFixed4DAligned( Vector4DAligned *vFillIn, float flVertAnimFixedPointScale )
{
- vFillIn->Set( delta[0]*g_VertAnimFixedPointScale, delta[1]*g_VertAnimFixedPointScale, delta[2]*g_VertAnimFixedPointScale, wrinkledelta*g_VertAnimFixedPointScale );
+ vFillIn->Set( delta[0] * flVertAnimFixedPointScale, delta[1] * flVertAnimFixedPointScale, delta[2] * flVertAnimFixedPointScale, wrinkledelta * flVertAnimFixedPointScale );
+ }
+
+ inline float GetWrinkleDeltaFixed( float flVertAnimFixedPointScale )
+ {
+ return wrinkledelta * flVertAnimFixedPointScale;
}
};
@@ -1959,6 +2014,9 @@ struct vertexFileFixup_t
#define STUDIOHDR_FLAGS_CAST_TEXTURE_SHADOWS ( 1 << 18 )
+// flagged on load to indicate no animation events on this model
+#define STUDIOHDR_FLAGS_VERT_ANIM_FIXED_POINT_SCALE ( 1 << 21 )
+
// NOTE! Next time we up the .mdl file format, remove studiohdr2_t
// and insert all fields in this structure into studiohdr_t.
struct studiohdr2_t
@@ -1982,7 +2040,11 @@ struct studiohdr2_t
int sznameindex;
inline char *pszName() { return (sznameindex) ? (char *)(((byte *)this) + sznameindex ) : NULL; }
- int reserved[58];
+ int m_nBoneFlexDriverCount;
+ int m_nBoneFlexDriverIndex;
+ inline mstudioboneflexdriver_t *pBoneFlexDriver( int i ) const { Assert( i >= 0 && i < m_nBoneFlexDriverCount ); return (mstudioboneflexdriver_t *)(((byte *)this) + m_nBoneFlexDriverIndex) + i; }
+
+ int reserved[56];
};
struct studiohdr_t
@@ -2229,7 +2291,10 @@ struct studiohdr_t
int flexcontrolleruiindex;
mstudioflexcontrollerui_t *pFlexControllerUI( int i ) const { Assert( i >= 0 && i < numflexcontrollerui); return (mstudioflexcontrollerui_t *)(((byte *)this) + flexcontrolleruiindex) + i; }
- int unused3[2];
+ float flVertAnimFixedPointScale;
+ inline float VertAnimFixedPointScale() const { return ( flags & STUDIOHDR_FLAGS_VERT_ANIM_FIXED_POINT_SCALE ) ? flVertAnimFixedPointScale : 1.0f / 4096.0f; }
+
+ int unused3[1];
// FIXME: Remove when we up the model version. Move all fields of studiohdr2_t into studiohdr_t.
int studiohdr2index;
@@ -2245,6 +2310,9 @@ struct studiohdr_t
inline mstudiolinearbone_t *pLinearBones() const { return studiohdr2index ? pStudioHdr2()->pLinearBones() : NULL; }
+ inline int BoneFlexDriverCount() const { return studiohdr2index ? pStudioHdr2()->m_nBoneFlexDriverCount : 0; }
+ inline const mstudioboneflexdriver_t* BoneFlexDriver( int i ) const { Assert( i >= 0 && i < BoneFlexDriverCount() ); return studiohdr2index ? pStudioHdr2()->pBoneFlexDriver( i ) : NULL; }
+
// NOTE: No room to add stuff? Up the .mdl file format version
// [and move all fields in studiohdr2_t into studiohdr_t and kill studiohdr2_t],
// or add your stuff to studiohdr2_t. See NumSrcBoneTransforms/SrcBoneTransform for the pattern to use.
@@ -2404,6 +2472,11 @@ public:
inline mstudiolinearbone_t *pLinearBones() const { return m_pStudioHdr->pLinearBones(); }
+ inline int BoneFlexDriverCount() const { return m_pStudioHdr->BoneFlexDriverCount(); }
+ inline const mstudioboneflexdriver_t *BoneFlexDriver( int i ) const { return m_pStudioHdr->BoneFlexDriver( i ); }
+
+ inline float VertAnimFixedPointScale() const { return m_pStudioHdr->VertAnimFixedPointScale(); }
+
public:
int IsSequenceLooping( int iSequence );
float GetSequenceCycleRate( int iSequence );
@@ -2971,6 +3044,9 @@ inline void Studio_SetRootLOD( studiohdr_t *pStudioHdr, int rootLOD )
rootLOD = pStudioHdr->numAllowedRootLODs - 1;
}
+ Assert( rootLOD >= 0 && rootLOD < MAX_NUM_LODS );
+ Clamp( rootLOD, 0, MAX_NUM_LODS - 1 );
+
// run the lod fixups that culls higher detail lods
// vertexes are external, fixups ensure relative offsets and counts are cognizant of shrinking data
// indexes are built in lodN..lod0 order so higher detail lod data can be truncated at load
diff --git a/mp/src/public/tier0/afxmem_override.cpp b/mp/src/public/tier0/afxmem_override.cpp
index 425cabd8..f5794b27 100644
--- a/mp/src/public/tier0/afxmem_override.cpp
+++ b/mp/src/public/tier0/afxmem_override.cpp
@@ -429,8 +429,7 @@ void* __cdecl operator new(size_t nSize, int nType, LPCSTR lpszFileName, int nLi
#endif
}
-#if 0
-#if _MSC_VER >= 1200
+#if _MSC_VER >= 1700
void __cdecl operator delete(void* p, int nType, LPCSTR /* lpszFileName */, int /* nLine */)
{
#if !defined(_AFX_NO_DEBUG_CRT) && defined(_DEBUG)
@@ -440,19 +439,16 @@ void __cdecl operator delete(void* p, int nType, LPCSTR /* lpszFileName */, int
#endif
}
#endif // _MSC_VER >= 1200
-#endif
-#if _MSC_VER >= 1210
+#if _MSC_VER >= 1700
void* __cdecl operator new[](size_t nSize, int nType, LPCSTR lpszFileName, int nLine)
{
return ::operator new(nSize, nType, lpszFileName, nLine);
}
-#if 0
void __cdecl operator delete[](void* p, int nType, LPCSTR lpszFileName, int nLine)
{
::operator delete(p, nType, lpszFileName, nLine);
}
-#endif
#endif // _MSC_VER >= 1210
#endif //_DEBUG
diff --git a/mp/src/public/tier0/dbg.h b/mp/src/public/tier0/dbg.h
index ac7930a4..5fe45a1c 100644
--- a/mp/src/public/tier0/dbg.h
+++ b/mp/src/public/tier0/dbg.h
@@ -247,8 +247,8 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent();
if (!(_exp)) \
{ \
_SpewInfo( SPEW_ASSERT, __TFILE__, __LINE__ ); \
- SpewRetval_t ret = _SpewMessage("%s", _msg); \
- CallAssertFailedNotifyFunc( __TFILE__, __LINE__, _msg ); \
+ SpewRetval_t ret = _SpewMessage("%s", static_cast<const char*>( _msg )); \
+ CallAssertFailedNotifyFunc( __TFILE__, __LINE__, _msg ); \
_executeExp; \
if ( ret == SPEW_DEBUGGER) \
{ \
@@ -343,6 +343,9 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent();
#define AssertEquals( _exp, _expectedValue ) AssertMsg2( (_exp) == (_expectedValue), _T("Expected %d but got %d!"), (_expectedValue), (_exp) )
#define AssertFloatEquals( _exp, _expectedValue, _tol ) AssertMsg2( fabs((_exp) - (_expectedValue)) <= (_tol), _T("Expected %f but got %f!"), (_expectedValue), (_exp) )
#define Verify( _exp ) Assert( _exp )
+#define VerifyMsg1( _exp, _msg, a1 ) AssertMsg1( _exp, _msg, a1 )
+#define VerifyMsg2( _exp, _msg, a1, a2 ) AssertMsg2( _exp, _msg, a1, a2 )
+#define VerifyMsg3( _exp, _msg, a1, a2, a3 ) AssertMsg3( _exp, _msg, a1, a2, a3 )
#define VerifyEquals( _exp, _expectedValue ) AssertEquals( _exp, _expectedValue )
#define DbgVerify( _exp ) Assert( _exp )
@@ -366,6 +369,9 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent();
#define AssertEquals( _exp, _expectedValue ) ((void)0)
#define AssertFloatEquals( _exp, _expectedValue, _tol ) ((void)0)
#define Verify( _exp ) (_exp)
+#define VerifyMsg1( _exp, _msg, a1 ) (_exp)
+#define VerifyMsg2( _exp, _msg, a1, a2 ) (_exp)
+#define VerifyMsg3( _exp, _msg, a1, a2, a3 ) (_exp)
#define VerifyEquals( _exp, _expectedValue ) (_exp)
#define DbgVerify( _exp ) (_exp)
diff --git a/mp/src/public/tier0/pointeroverride.asm b/mp/src/public/tier0/pointeroverride.asm
index 9695e2df..e75ed65b 100644
--- a/mp/src/public/tier0/pointeroverride.asm
+++ b/mp/src/public/tier0/pointeroverride.asm
@@ -1,17 +1,17 @@
-.model flat, C
-
-.data
- __imp__EncodePointer@4 dd dummy
- __imp__DecodePointer@4 dd dummy
-
- EXTERNDEF __imp__EncodePointer@4 : DWORD
- EXTERNDEF __imp__DecodePointer@4 : DWORD
-
-.code
- dummy proc
- mov eax, [esp+4]
- ret 4
- dummy endp
-
-end
+.model flat, C
+
+.data
+ __imp__EncodePointer@4 dd dummy
+ __imp__DecodePointer@4 dd dummy
+
+ EXTERNDEF __imp__EncodePointer@4 : DWORD
+ EXTERNDEF __imp__DecodePointer@4 : DWORD
+
+.code
+ dummy proc
+ mov eax, [esp+4]
+ ret 4
+ dummy endp
+
+end
\ No newline at end of file
diff --git a/mp/src/public/tier1/fmtstr.h b/mp/src/public/tier1/fmtstr.h
index 8c9ccf47..31ee23c7 100644
--- a/mp/src/public/tier1/fmtstr.h
+++ b/mp/src/public/tier1/fmtstr.h
@@ -125,7 +125,42 @@ public:
}
void AppendFormatV( const char *pchFormat, va_list args );
- void Append( const char *pchValue ) { AppendFormat( "%s", pchValue ); }
+
+ void Append( const char *pchValue )
+ {
+ // This function is close to the metal to cut down on the CPU cost
+ // of the previous incantation of Append which was implemented as
+ // AppendFormat( "%s", pchValue ). This implementation, though not
+ // as easy to read, instead does a strcpy from the existing end
+ // point of the CFmtStrN. This brings something like a 10-20x speedup
+ // in my rudimentary tests. It isn't using V_strncpy because that
+ // function doesn't return the number of characters copied, which
+ // we need to adjust m_nLength. Doing the V_strncpy with a V_strlen
+ // afterwards took twice as long as this implementations in tests,
+ // so V_strncpy's implementation was used to write this method.
+ char *pDest = m_szBuf + m_nLength;
+ const int maxLen = SIZE_BUF - m_nLength;
+ char *pLast = pDest + maxLen - 1;
+ while ( (pDest < pLast) && (*pchValue != 0) )
+ {
+ *pDest = *pchValue;
+ ++pDest; ++pchValue;
+ }
+ *pDest = 0;
+ m_nLength = pDest - m_szBuf;
+ }
+
+ //optimized version of append for just adding a single character
+ void Append( char ch )
+ {
+ if( m_nLength < SIZE_BUF - 1 )
+ {
+ m_szBuf[ m_nLength ] = ch;
+ m_nLength++;
+ m_szBuf[ m_nLength ] = '\0';
+ }
+ }
+
void AppendIndent( uint32 unCount, char chIndent = '\t' );
protected:
@@ -193,6 +228,84 @@ typedef CFmtStrQuietTruncationN<FMTSTR_STD_LEN> CFmtStrQuietTruncation;
typedef CFmtStrN<1024> CFmtStr1024;
typedef CFmtStrN<8192> CFmtStrMax;
+
+//-----------------------------------------------------------------------------
+// Purpose: Fast-path number-to-string helper (with optional quoting)
+// Derived off of the Steam CNumStr but with a few tweaks, such as
+// trimming off the in-our-cases-unnecessary strlen calls (by not
+// storing the length in the class).
+//-----------------------------------------------------------------------------
+
+class CNumStr
+{
+public:
+ CNumStr() { m_szBuf[0] = 0; }
+
+ explicit CNumStr( bool b ) { SetBool( b ); }
+
+ explicit CNumStr( int8 n8 ) { SetInt8( n8 ); }
+ explicit CNumStr( uint8 un8 ) { SetUint8( un8 ); }
+ explicit CNumStr( int16 n16 ) { SetInt16( n16 ); }
+ explicit CNumStr( uint16 un16 ) { SetUint16( un16 ); }
+ explicit CNumStr( int32 n32 ) { SetInt32( n32 ); }
+ explicit CNumStr( uint32 un32 ) { SetUint32( un32 ); }
+ explicit CNumStr( int64 n64 ) { SetInt64( n64 ); }
+ explicit CNumStr( uint64 un64 ) { SetUint64( un64 ); }
+
+#if defined(COMPILER_GCC) && defined(PLATFORM_64BITS)
+ explicit CNumStr( lint64 n64 ) { SetInt64( (int64)n64 ); }
+ explicit CNumStr( ulint64 un64 ) { SetUint64( (uint64)un64 ); }
+#endif
+
+ explicit CNumStr( double f ) { SetDouble( f ); }
+ explicit CNumStr( float f ) { SetFloat( f ); }
+
+ inline void SetBool( bool b ) { Q_memcpy( m_szBuf, b ? "1" : "0", 2 ); }
+
+#ifdef _WIN32
+ inline void SetInt8( int8 n8 ) { _itoa( (int32)n8, m_szBuf, 10 ); }
+ inline void SetUint8( uint8 un8 ) { _itoa( (int32)un8, m_szBuf, 10 ); }
+ inline void SetInt16( int16 n16 ) { _itoa( (int32)n16, m_szBuf, 10 ); }
+ inline void SetUint16( uint16 un16 ) { _itoa( (int32)un16, m_szBuf, 10 ); }
+ inline void SetInt32( int32 n32 ) { _itoa( n32, m_szBuf, 10 ); }
+ inline void SetUint32( uint32 un32 ) { _i64toa( (int64)un32, m_szBuf, 10 ); }
+ inline void SetInt64( int64 n64 ) { _i64toa( n64, m_szBuf, 10 ); }
+ inline void SetUint64( uint64 un64 ) { _ui64toa( un64, m_szBuf, 10 ); }
+#else
+ inline void SetInt8( int8 n8 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%d", (int32)n8 ); }
+ inline void SetUint8( uint8 un8 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%d", (int32)un8 ); }
+ inline void SetInt16( int16 n16 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%d", (int32)n16 ); }
+ inline void SetUint16( uint16 un16 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%d", (int32)un16 ); }
+ inline void SetInt32( int32 n32 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%d", n32 ); }
+ inline void SetUint32( uint32 un32 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%u", un32 ); }
+ inline void SetInt64( int64 n64 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%lld", n64 ); }
+ inline void SetUint64( uint64 un64 ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%llu", un64 ); }
+#endif
+
+ inline void SetDouble( double f ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%.18g", f ); }
+ inline void SetFloat( float f ) { Q_snprintf( m_szBuf, sizeof(m_szBuf), "%.18g", f ); }
+
+ inline void SetHexUint64( uint64 un64 ) { Q_binarytohex( (byte *)&un64, sizeof( un64 ), m_szBuf, sizeof( m_szBuf ) ); }
+
+ operator const char *() const { return m_szBuf; }
+ const char* String() const { return m_szBuf; }
+
+ void AddQuotes()
+ {
+ Assert( m_szBuf[0] != '"' );
+ const int nLength = Q_strlen( m_szBuf );
+ Q_memmove( m_szBuf + 1, m_szBuf, nLength );
+ m_szBuf[0] = '"';
+ m_szBuf[nLength + 1] = '"';
+ m_szBuf[nLength + 2] = 0;
+ }
+
+protected:
+ char m_szBuf[28]; // long enough to hold 18 digits of precision, a decimal, a - sign, e+### suffix, and quotes
+
+};
+
+
//=============================================================================
bool BGetLocalFormattedDateAndTime( time_t timeVal, char *pchDate, int cubDate, char *pchTime, int cubTime );
diff --git a/mp/src/public/togl/glfuncs.inl b/mp/src/public/togl/glfuncs.inl
index dafd0949..55a24f45 100644
--- a/mp/src/public/togl/glfuncs.inl
+++ b/mp/src/public/togl/glfuncs.inl
@@ -1,7 +1,7 @@
-#if defined(LINUX) || defined(_WIN32)
-#include "togl/linuxwin/glfuncs.h"
-#endif
-#if defined(OSX)
-#include "togl/osx/glfuncs.h"
-#endif
-
+#if defined(LINUX) || defined(_WIN32)
+#include "togl/linuxwin/glfuncs.h"
+#endif
+#if defined(OSX)
+#include "togl/osx/glfuncs.h"
+#endif
+
diff --git a/mp/src/public/vgui/ISurface.h b/mp/src/public/vgui/ISurface.h
index b1e39bd4..0ccc8157 100644
--- a/mp/src/public/vgui/ISurface.h
+++ b/mp/src/public/vgui/ISurface.h
@@ -32,6 +32,7 @@
#endif
class Color;
+class ITexture;
namespace vgui
{
@@ -386,7 +387,7 @@ public:
virtual IHTMLChromeController *AccessChromeHTMLController() = 0;
// the origin of the viewport on the framebuffer (Which might not be 0,0 for stereo)
- virtual void SetFullscreenViewport( int x, int y, int w, int h ) = 0;
+ virtual void SetFullscreenViewportAndRenderTarget( int x, int y, int w, int h, ITexture *pRenderTarget ) = 0;
virtual void GetFullscreenViewport( int & x, int & y, int & w, int & h ) = 0;
virtual void PushFullscreenViewport() = 0;
virtual void PopFullscreenViewport() = 0;
@@ -394,6 +395,12 @@ public:
// handles support for software cursors
virtual void SetSoftwareCursor( bool bUseSoftwareCursor ) = 0;
virtual void PaintSoftwareCursor() = 0;
+
+
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ // !! WARNING! YOU MUST NOT ADD YOUR NEW METHOD HERE OR YOU WILL BREAK MODS !!
+ // !! Add your new stuff to the bottom of IMatSystemSurface instead. !!
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
};
}
diff --git a/mp/src/public/windows_default.manifest b/mp/src/public/windows_default.manifest
index 19973c57..f7bc13e5 100644
--- a/mp/src/public/windows_default.manifest
+++ b/mp/src/public/windows_default.manifest
@@ -1,13 +1,15 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
- <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
- <application>
- <!--The ID below indicates application support for Windows Vista -->
- <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
- <!--The ID below indicates application support for Windows 7 -->
- <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
- <!--The ID below indicates application support for Windows 8 -->
- <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
- </application>
- </compatibility>
-</assembly>
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <!--The ID below indicates application support for Windows Vista -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ <!--The ID below indicates application support for Windows 7 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
+ <!--The ID below indicates application support for Windows 8 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <!--The ID below indicates application support for Windows 8.1 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ </application>
+ </compatibility>
+</assembly>