mirror of
https://github.com/unknownworlds/NS.git
synced 2024-11-22 04:31:14 +00:00
Ported performance changes from SVN revision 221, 3.0.5 performance branch.
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@239 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
f7a95da94a
commit
241a3b0282
5 changed files with 22 additions and 11 deletions
|
@ -125,7 +125,7 @@ void CBaseMonster :: MakeIdealYaw( Vector vecTarget ) { }
|
|||
float CBaseMonster::ChangeYaw ( int yawSpeed ) { return 0; }
|
||||
int CBaseAnimating :: LookupActivity ( int activity ) { return 0; }
|
||||
int CBaseAnimating :: LookupActivityHeaviest ( int activity ) { return 0; }
|
||||
int CBaseAnimating :: LookupSequence ( const char *label ) { return 0; }
|
||||
int CBaseAnimating :: LookupSequence ( const char *label, int queue ) { return 0; }
|
||||
void CBaseAnimating :: ResetSequenceInfo ( ) { }
|
||||
BOOL CBaseAnimating :: GetSequenceFlags( ) { return FALSE; }
|
||||
void CBaseAnimating :: DispatchAnimEvents ( float flInterval ) { }
|
||||
|
|
|
@ -97,11 +97,18 @@ int CBaseAnimating :: LookupActivityHeaviest ( int activity )
|
|||
|
||||
//=========================================================
|
||||
//=========================================================
|
||||
int CBaseAnimating :: LookupSequence ( const char *label )
|
||||
int CBaseAnimating :: LookupSequence ( const char *label, int queue )
|
||||
{
|
||||
void *pmodel = GET_MODEL_PTR( ENT(pev) );
|
||||
|
||||
return ::LookupSequence( pmodel, label );
|
||||
if (strcmp(label, this->mPreviousLookupString[queue]) == 0)
|
||||
{
|
||||
return this->mPreviousLookupSequence[queue];
|
||||
}
|
||||
|
||||
strcpy(this->mPreviousLookupSequence[queue], label);
|
||||
this->mPreviousLookupSequence[queue] = ::LookupSequence( pmodel, label );
|
||||
return this->mPreviousLookupSequence[queue];
|
||||
}
|
||||
|
||||
const char* CBaseAnimating::LookupSequence(int inSequence)
|
||||
|
|
|
@ -172,12 +172,12 @@ int LookupSequence( void *pmodel, const char *label )
|
|||
}
|
||||
|
||||
//if(GetGameRules()->GetIsTesting())
|
||||
if(CVAR_GET_FLOAT(kvTesting) > 0)
|
||||
{
|
||||
char theMessage[256];
|
||||
sprintf(theMessage, "%s%s\n", "Couldn't find animation: ", label);
|
||||
ALERT(at_console, theMessage);
|
||||
}
|
||||
//if(CVAR_GET_FLOAT(kvTesting) > 0)
|
||||
//{
|
||||
// char theMessage[256];
|
||||
// sprintf(theMessage, "%s%s\n", "Couldn't find animation: ", label);
|
||||
// ALERT(at_console, theMessage);
|
||||
//}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -487,7 +487,7 @@ public:
|
|||
int GetSequenceFlags( void );
|
||||
int LookupActivity ( int activity );
|
||||
int LookupActivityHeaviest ( int activity );
|
||||
int LookupSequence ( const char *label );
|
||||
int LookupSequence ( const char *label, int queue = 0 );
|
||||
const char* LookupSequence(int inSequence);
|
||||
void ResetSequenceInfo ( );
|
||||
void DispatchAnimEvents ( float flFutureInterval = 0.1 ); // Handle events that have happend since last time called up until X seconds into the future
|
||||
|
@ -510,6 +510,10 @@ public:
|
|||
float m_flLastEventCheck; // last time the event list was checked
|
||||
BOOL m_fSequenceFinished;// flag set when StudioAdvanceFrame moves across a frame boundry
|
||||
BOOL m_fSequenceLoops; // true if the sequence loops
|
||||
|
||||
// For performance gain during LookupSequence
|
||||
char mPreviousLookupString[3][64];
|
||||
int mPreviousLookupSequence[3];
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1311,7 +1311,7 @@ void CBasePlayer::SetAnimation( PLAYER_ANIM playerAnim )
|
|||
}
|
||||
|
||||
// Set the gaitsequence
|
||||
gaitDesired = LookupSequence(szAnim);
|
||||
gaitDesired = LookupSequence(szAnim, 1);
|
||||
if(gaitDesired == -1)
|
||||
{
|
||||
gaitDesired = 0;
|
||||
|
|
Loading…
Reference in a new issue