This commit is contained in:
nephacks
2025-06-04 03:22:50 +02:00
parent f234f23848
commit f12416cffd
14243 changed files with 6446499 additions and 26 deletions

View File

@@ -0,0 +1,40 @@
// ----------------------------------------- //
// File generated by VPC //
// ----------------------------------------- //
Source file: F:\csgo_64\cstrike15_src\tier3\choreoutils.cpp
Debug output file: F:\csgo_64\cstrike15_src\tier3\choreoutils.cpp
Release output file: F:\csgo_64\cstrike15_src\tier3\choreoutils.cpp
Containing unity file:
PCH file:
Source file: F:\csgo_64\cstrike15_src\common\debug_lib_check.cpp
Debug output file: F:\csgo_64\cstrike15_src\common\debug_lib_check.cpp
Release output file: F:\csgo_64\cstrike15_src\common\debug_lib_check.cpp
Containing unity file:
PCH file:
Source file: F:\csgo_64\cstrike15_src\tier3\mdlutils.cpp
Debug output file: F:\csgo_64\cstrike15_src\tier3\mdlutils.cpp
Release output file: F:\csgo_64\cstrike15_src\tier3\mdlutils.cpp
Containing unity file:
PCH file:
Source file: F:\csgo_64\cstrike15_src\tier3\scenetokenprocessor.cpp
Debug output file: F:\csgo_64\cstrike15_src\tier3\scenetokenprocessor.cpp
Release output file: F:\csgo_64\cstrike15_src\tier3\scenetokenprocessor.cpp
Containing unity file:
PCH file:
Source file: F:\csgo_64\cstrike15_src\tier3\studiohdrstub.cpp
Debug output file: F:\csgo_64\cstrike15_src\tier3\studiohdrstub.cpp
Release output file: F:\csgo_64\cstrike15_src\tier3\studiohdrstub.cpp
Containing unity file:
PCH file:
Source file: F:\csgo_64\cstrike15_src\tier3\tier3.cpp
Debug output file: F:\csgo_64\cstrike15_src\tier3\tier3.cpp
Release output file: F:\csgo_64\cstrike15_src\tier3\tier3.cpp
Containing unity file:
PCH file:

345
tier3/choreoutils.cpp Normal file
View File

@@ -0,0 +1,345 @@
//===== Copyright <20> 2005-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose: Helper methods + classes for file access
//
//===========================================================================//
#include "tier3/choreoutils.h"
#include "tier3/tier3.h"
#include "SoundEmitterSystem/isoundemittersystembase.h"
#include "studio.h"
#include "../game/shared/choreoscene.h"
#include "../game/shared/choreoevent.h"
#include "tier1/keyvalues.h"
#include "bone_setup.h"
#include "soundchars.h"
// NOTE: This has to be the last file included!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// Find sequence by name
//-----------------------------------------------------------------------------
static int LookupSequence( CStudioHdr *pStudioHdr, const char *pSequenceName )
{
return pStudioHdr->LookupSequence( pSequenceName );
}
//-----------------------------------------------------------------------------
// Returns sequence flags
//-----------------------------------------------------------------------------
static int GetSequenceFlags( CStudioHdr *pStudioHdr, int nSequence )
{
if ( !pStudioHdr || nSequence < 0 || nSequence >= pStudioHdr->GetNumSeq() )
return 0;
mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( nSequence );
return seqdesc.flags;
}
//-----------------------------------------------------------------------------
// Does a sequence loop?
//-----------------------------------------------------------------------------
static bool DoesSequenceLoop( CStudioHdr *pStudioHdr, int nSequence )
{
int nFlags = GetSequenceFlags( pStudioHdr, nSequence );
bool bLooping = ( nFlags & STUDIO_LOOPING ) ? true : false;
return bLooping;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool AutoAddGestureKeys( CChoreoEvent *e, CStudioHdr *pStudioHdr, float *pPoseParameters, bool bCheckOnly )
{
int iSequence = LookupSequence( pStudioHdr, e->GetParameters() );
if ( iSequence < 0 )
return false;
KeyValues *pSeqKeyValues = new KeyValues( "" );
if ( !pSeqKeyValues->LoadFromBuffer( pStudioHdr->name(), Studio_GetKeyValueText( pStudioHdr, iSequence ) ) )
{
pSeqKeyValues->deleteThis();
return false;
}
// Do we have a build point section?
KeyValues *pKVAllFaceposer = pSeqKeyValues->FindKey("faceposer");
if ( !pKVAllFaceposer )
{
pSeqKeyValues->deleteThis();
return false;
}
int nMaxFrame = Studio_MaxFrame( pStudioHdr, iSequence, pPoseParameters ) - 1;
// Start grabbing the sounds and slotting them in
KeyValues *pkvFaceposer;
char szStartLoop[CEventAbsoluteTag::MAX_EVENTTAG_LENGTH] = { "loop" };
char szEndLoop[CEventAbsoluteTag::MAX_EVENTTAG_LENGTH] = { "end" };
char szEntry[CEventAbsoluteTag::MAX_EVENTTAG_LENGTH] = { "apex" };
char szExit[CEventAbsoluteTag::MAX_EVENTTAG_LENGTH] = { "end" };
for ( pkvFaceposer = pKVAllFaceposer->GetFirstSubKey(); pkvFaceposer; pkvFaceposer = pkvFaceposer->GetNextKey() )
{
if ( !Q_stricmp( pkvFaceposer->GetName(), "startloop" ) )
{
Q_strncpy( szStartLoop, pkvFaceposer->GetString(), sizeof(szStartLoop) );
continue;
}
if ( !Q_stricmp( pkvFaceposer->GetName(), "endloop" ) )
{
Q_strncpy( szEndLoop, pkvFaceposer->GetString(), sizeof(szEndLoop) );
continue;
}
if ( !Q_stricmp( pkvFaceposer->GetName(), "entrytag" ) )
{
Q_strncpy( szEntry, pkvFaceposer->GetString(), sizeof(szEntry) );
continue;
}
if ( !Q_stricmp( pkvFaceposer->GetName(), "exittag" ) )
{
Q_strncpy( szExit, pkvFaceposer->GetString(), sizeof(szExit) );
continue;
}
if ( !Q_stricmp( pkvFaceposer->GetName(), "tags" ) )
{
if ( nMaxFrame <= 0 )
continue;
KeyValues *pkvTags;
for ( pkvTags = pkvFaceposer->GetFirstSubKey(); pkvTags; pkvTags = pkvTags->GetNextKey() )
{
float flPercentage = (float)pkvTags->GetInt() / nMaxFrame;
CEventAbsoluteTag *ptag = e->FindAbsoluteTag( CChoreoEvent::ORIGINAL, pkvTags->GetName() );
if (ptag)
{
// reposition tag
ptag->SetPercentage( flPercentage );
}
else
{
e->AddAbsoluteTag( CChoreoEvent::ORIGINAL, pkvTags->GetName(), flPercentage );
e->AddAbsoluteTag( CChoreoEvent::PLAYBACK, pkvTags->GetName(), flPercentage );
}
// lock the original tags so they can't be edited
ptag = e->FindAbsoluteTag( CChoreoEvent::ORIGINAL, pkvTags->GetName() );
Assert( ptag );
ptag->SetLocked( true );
}
e->VerifyTagOrder();
e->PreventTagOverlap();
continue;
}
}
// FIXME: lookup linear tags in sequence data
{
CEventAbsoluteTag *ptag;
ptag = e->FindAbsoluteTag( CChoreoEvent::ORIGINAL, szStartLoop );
if (ptag)
{
ptag->SetLinear( true );
}
ptag = e->FindAbsoluteTag( CChoreoEvent::PLAYBACK, szStartLoop );
if (ptag)
{
ptag->SetLinear( true );
}
ptag = e->FindAbsoluteTag( CChoreoEvent::ORIGINAL, szEndLoop );
if (ptag)
{
ptag->SetLinear( true );
}
ptag = e->FindAbsoluteTag( CChoreoEvent::PLAYBACK, szEndLoop );
if (ptag)
{
ptag->SetLinear( true );
}
ptag = e->FindAbsoluteTag( CChoreoEvent::ORIGINAL, szEntry );
if (ptag)
{
ptag->SetEntry( true );
}
ptag = e->FindAbsoluteTag( CChoreoEvent::PLAYBACK, szEntry );
if (ptag)
{
ptag->SetEntry( true );
}
ptag = e->FindAbsoluteTag( CChoreoEvent::ORIGINAL, szExit );
if (ptag)
{
ptag->SetExit( true );
}
ptag = e->FindAbsoluteTag( CChoreoEvent::PLAYBACK, szExit );
if (ptag)
{
ptag->SetExit( true );
}
}
pSeqKeyValues->deleteThis();
return true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool UpdateGestureLength( CChoreoEvent *e, CStudioHdr *pStudioHdr, float *pPoseParameters, bool bCheckOnly )
{
Assert( e );
if ( !e )
return false;
if ( e->GetType() != CChoreoEvent::GESTURE )
return false;
int iSequence = LookupSequence( pStudioHdr, e->GetParameters() );
if ( iSequence < 0 )
return false;
bool bChanged = false;
float flSeqDuration = Studio_Duration( pStudioHdr, iSequence, pPoseParameters );
float flCurDuration;
e->GetGestureSequenceDuration( flCurDuration );
if ( flSeqDuration != 0.0f && flSeqDuration != flCurDuration )
{
bChanged = true;
if ( !bCheckOnly )
{
e->SetGestureSequenceDuration( flSeqDuration );
}
}
return bChanged;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool UpdateSequenceLength( CChoreoEvent *e, CStudioHdr *pStudioHdr, float *pPoseParameters, bool bCheckOnly, bool bVerbose )
{
Assert( e );
if ( !e )
return false;
if ( e->GetType() != CChoreoEvent::SEQUENCE )
{
if ( bVerbose )
{
ConMsg( "UpdateSequenceLength: called on non-SEQUENCE event %s\n", e->GetName() );
}
return false;
}
int iSequence = LookupSequence( pStudioHdr, e->GetParameters() );
if ( iSequence < 0 )
return false;
bool bChanged = false;
bool bLooping = DoesSequenceLoop( pStudioHdr, iSequence );
float flSeqDuration = Studio_Duration( pStudioHdr, iSequence, pPoseParameters );
if ( bLooping )
{
if ( e->IsFixedLength() )
{
if ( bCheckOnly )
return true;
if ( bVerbose )
{
ConMsg( "UpdateSequenceLength: %s is looping, removing fixed length flag\n", e->GetName() );
}
bChanged = true;
}
e->SetFixedLength( false );
if ( !e->HasEndTime() )
{
if ( bCheckOnly )
return true;
if ( bVerbose )
{
ConMsg( "CheckSequenceLength: %s is looping, setting default end time\n", e->GetName() );
}
e->SetEndTime( e->GetStartTime() + flSeqDuration );
bChanged = true;
}
return bChanged;
}
if ( !e->IsFixedLength() )
{
if ( bCheckOnly )
return true;
if ( bVerbose )
{
ConMsg( "CheckSequenceLength: %s is fixed length, removing looping flag\n", e->GetName() );
}
bChanged = true;
}
e->SetFixedLength( true );
if ( e->HasEndTime() )
{
float dt = e->GetDuration();
if ( fabs( dt - flSeqDuration ) > 0.01f )
{
if ( bCheckOnly )
return true;
if ( bVerbose )
{
ConMsg( "CheckSequenceLength: %s has wrong duration, changing length from %f to %f seconds\n",
e->GetName(), dt, flSeqDuration );
}
bChanged = true;
}
}
else
{
if ( bCheckOnly )
return true;
if ( bVerbose )
{
ConMsg( "CheckSequenceLength: %s has wrong duration, changing length to %f seconds\n",
e->GetName(), flSeqDuration );
}
bChanged = true;
}
if ( !bCheckOnly )
{
e->SetEndTime( e->GetStartTime() + flSeqDuration );
}
return bChanged;
}
//-----------------------------------------------------------------------------
// Finds sound files associated with events
//-----------------------------------------------------------------------------
const char *GetSoundForEvent( CChoreoEvent *pEvent, CStudioHdr *pStudioHdr )
{
const char *pSoundName = pEvent->GetParameters();
if ( Q_stristr( pSoundName, ".wav" ) )
return PSkipSoundChars( pSoundName );
const char *pFileName = g_pSoundEmitterSystem->GetWavFileForSound( pSoundName, ( pStudioHdr && pStudioHdr->IsValid() ) ? pStudioHdr->name() : NULL );
return PSkipSoundChars( pFileName );
}

1073
tier3/mdlutils.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,204 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#include "../game/shared/choreoscene.h"
#include "../game/shared/choreoactor.h"
#include "../game/shared/choreochannel.h"
#include "../game/shared/choreoevent.h"
#include "../game/shared/iscenetokenprocessor.h"
#include "characterset.h"
// NOTE: This has to be the last file included!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// Purpose: Helper for parsing scene data file
//-----------------------------------------------------------------------------
class CSceneTokenProcessor : public ISceneTokenProcessor
{
public:
CSceneTokenProcessor();
const char *CurrentToken( void );
bool GetToken( bool crossline );
bool TokenAvailable( void );
void Error( const char *fmt, ... );
void SetBuffer( char *buffer );
private:
const char *ParseNextToken (const char *data);
const char *m_pBuffer;
char m_szToken[ 1024 ];
characterset_t m_BreakSetIncludingColons;
};
CSceneTokenProcessor::CSceneTokenProcessor()
{
CharacterSetBuild( &m_BreakSetIncludingColons, "{}()':" );
}
//-----------------------------------------------------------------------------
// Purpose:
// Output : const char
//-----------------------------------------------------------------------------
const char *CSceneTokenProcessor::CurrentToken( void )
{
return m_szToken;
}
const char *CSceneTokenProcessor::ParseNextToken (const char *data)
{
unsigned char c;
int len;
characterset_t *breaks;
breaks = &m_BreakSetIncludingColons;
len = 0;
m_szToken[0] = 0;
if (!data)
return NULL;
// skip whitespace
skipwhite:
while ( (c = *data) <= ' ')
{
if (c == 0)
return NULL; // end of file;
data++;
}
// skip // comments
if (c=='/' && data[1] == '/')
{
while (*data && *data != '\n')
data++;
goto skipwhite;
}
// handle quoted strings specially
if (c == '\"')
{
data++;
while (1)
{
c = *data++;
if (c=='\"' || !c)
{
m_szToken[len] = 0;
return data;
}
m_szToken[len] = c;
len++;
}
}
// parse single characters
if ( IN_CHARACTERSET( *breaks, c ) )
{
m_szToken[len] = c;
len++;
m_szToken[len] = 0;
return data+1;
}
// parse a regular word
do
{
m_szToken[len] = c;
data++;
len++;
c = *data;
if ( IN_CHARACTERSET( *breaks, c ) )
break;
} while (c>32);
m_szToken[len] = 0;
return data;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : crossline -
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CSceneTokenProcessor::GetToken( bool crossline )
{
// NOTE: crossline is ignored here, may need to implement if needed
m_pBuffer = ParseNextToken( m_pBuffer );
if ( Q_strlen( m_szToken ) >= 0 )
return true;
return false;
}
//-----------------------------------------------------------------------------
// Purpose:
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CSceneTokenProcessor::TokenAvailable( void )
{
const char *search_p = m_pBuffer;
while ( *search_p <= 32)
{
if (*search_p == '\n')
return false;
search_p++;
if ( !*search_p )
return false;
}
if (*search_p == ';' || *search_p == '#' || // semicolon and # is comment field
(*search_p == '/' && *((search_p)+1) == '/')) // also make // a comment field
return false;
return true;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *fmt -
// ... -
//-----------------------------------------------------------------------------
void CSceneTokenProcessor::Error( const char *fmt, ... )
{
char string[ 2048 ];
va_list argptr;
va_start( argptr, fmt );
Q_vsnprintf( string, sizeof(string), fmt, argptr );
va_end( argptr );
Warning( "%s", string );
Assert(0);
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : *buffer -
//-----------------------------------------------------------------------------
void CSceneTokenProcessor::SetBuffer( char *buffer )
{
m_pBuffer = buffer;
}
CSceneTokenProcessor g_TokenProcessor;
ISceneTokenProcessor *GetTokenProcessor()
{
return &g_TokenProcessor;
}
void SetTokenProcessorBuffer( const char *buf )
{
g_TokenProcessor.SetBuffer( (char *)buf );
}

52
tier3/studiohdrstub.cpp Normal file
View File

@@ -0,0 +1,52 @@
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
//#include "studio.h"
#include "studio.h"
#include "datacache/imdlcache.h"
#include "istudiorender.h"
#include "tier3/tier3.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// FIXME: This trashy glue code is really not acceptable. Figure out a way of making it unnecessary.
//-----------------------------------------------------------------------------
const studiohdr_t *studiohdr_t::FindModel( void **cache, char const *pModelName ) const
{
MDLHandle_t handle = g_pMDLCache->FindMDL( pModelName );
*cache = (void*)(uintp)handle;
return g_pMDLCache->GetStudioHdr( handle );
}
virtualmodel_t *studiohdr_t::GetVirtualModel( void ) const
{
return g_pMDLCache->GetVirtualModel( VoidPtrToMDLHandle( VirtualModel() ) );
}
byte *studiohdr_t::GetAnimBlock( int i, bool preloadIfMissing ) const
{
return g_pMDLCache->GetAnimBlock( VoidPtrToMDLHandle( VirtualModel() ), i, preloadIfMissing );
}
// Shame that this code is duplicated... :(
bool studiohdr_t::hasAnimBlockBeenPreloaded( int i ) const
{
return g_pMDLCache->HasAnimBlockBeenPreloaded( VoidPtrToMDLHandle( VirtualModel() ), i );
}
int studiohdr_t::GetAutoplayList( unsigned short **pOut ) const
{
return g_pMDLCache->GetAutoplayList( VoidPtrToMDLHandle( VirtualModel() ), pOut );
}
const studiohdr_t *virtualgroup_t::GetStudioHdr( void ) const
{
return g_pMDLCache->GetStudioHdr( VoidPtrToMDLHandle( cache ) );
}

32
tier3/tier3.cpp Normal file
View File

@@ -0,0 +1,32 @@
//===== Copyright (c) 2005-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose: A higher level link library for general use in the game and tools.
//
//===========================================================================//
#include "tier3/tier3.h"
#include "tier0/dbg.h"
// NOTE: This has to be the last file included!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// These tier3 libraries must be set by any users of this library.
// They can be set by calling ConnectTier3Libraries.
// It is hoped that setting this, and using this library will be the common mechanism for
// allowing link libraries to access tier3 library interfaces
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Call this to connect to all tier 3 libraries.
// It's up to the caller to check the globals it cares about to see if ones are missing
//-----------------------------------------------------------------------------
void ConnectTier3Libraries( CreateInterfaceFn *pFactoryList, int nFactoryCount )
{
}
void DisconnectTier3Libraries()
{
}

29
tier3/tier3.vpc Normal file
View File

@@ -0,0 +1,29 @@
//-----------------------------------------------------------------------------
// TIER3.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$macro SRCDIR ".."
$include "$SRCDIR\vpc_scripts\source_lib_base.vpc"
$Project "tier3"
{
$Folder "Source Files"
{
$File "tier3.cpp"
$File "mdlutils.cpp"
$File "choreoutils.cpp"
$File "scenetokenprocessor.cpp"
$File "studiohdrstub.cpp"
}
$Folder "Header Files"
{
$File "$SRCDIR\public\tier3\tier3.h"
$File "$SRCDIR\public\tier3\mdlutils.h"
$File "$SRCDIR\public\tier3\choreoutils.h"
$File "$SRCDIR\public\tier3\scenetokenprocessor.h"
}
}

13
tier3/tier3.vpc.vpc_cache Normal file
View File

@@ -0,0 +1,13 @@
"vpc_cache"
{
"CacheVersion" "1"
"win32"
{
"CRCFile" "tier3.vcxproj.vpc_crc"
"OutputFiles"
{
"0" "tier3.vcxproj"
"1" "tier3.vcxproj.filters"
}
}
}

2
tier3/vsi.nul Normal file
View File

@@ -0,0 +1,2 @@
SN Visual Studio Integration
IMPORTANT: Do not remove the custom build step for this file