upload "kind" alien swarm

This commit is contained in:
nillerusr
2023-10-03 17:23:56 +03:00
parent b7bd94c52e
commit 7d3c0d8b5a
4229 changed files with 462903 additions and 495158 deletions

View File

@@ -1,4 +1,4 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
@@ -7,10 +7,8 @@
#include "cbase.h"
#include "utlhashtable.h"
#ifndef GC
#include "stringpool.h"
#include "igamesystem.h"
#endif
#include "gamestringpool.h"
// memdbgon must be the last include file in a .cpp file!!!
@@ -19,79 +17,31 @@
//-----------------------------------------------------------------------------
// Purpose: The actual storage for pooled per-level strings
//-----------------------------------------------------------------------------
#ifdef GC
class CGameStringPool
#else
class CGameStringPool : public CBaseGameSystem
#endif
class CGameStringPool : public CStringPool, public CBaseGameSystem
{
virtual char const *Name() { return "CGameStringPool"; }
virtual void LevelShutdownPostEntity() { FreeAll(); }
void FreeAll()
virtual void LevelShutdownPostEntity()
{
#if 0 && _DEBUG
m_Strings.DbgCheckIntegrity();
m_KeyLookupCache.DbgCheckIntegrity();
#endif
m_Strings.Purge();
m_KeyLookupCache.Purge();
FreeAll();
CGameString::IncrementSerialNumber();
}
CUtlHashtable<CUtlConstString> m_Strings;
CUtlHashtable<const void*, const char*> m_KeyLookupCache;
public:
CGameStringPool() : m_Strings(256) { }
~CGameStringPool() { FreeAll(); }
void Dump( void )
{
CUtlVector<const char*> strings( 0, m_Strings.Count() );
for (UtlHashHandle_t i = m_Strings.FirstHandle(); i != m_Strings.InvalidHandle(); i = m_Strings.NextHandle(i))
for ( int i = m_Strings.FirstInorder(); i != m_Strings.InvalidIndex(); i = m_Strings.NextInorder(i) )
{
strings.AddToTail( strings[i] );
}
struct _Local {
static int __cdecl F(const char * const *a, const char * const *b) { return strcmp(*a, *b); }
};
strings.Sort( _Local::F );
for ( int i = 0; i < strings.Count(); ++i )
{
DevMsg( " %d (0x%p) : %s\n", i, strings[i], strings[i] );
DevMsg( " %d (0x%p) : %s\n", i, m_Strings[i], m_Strings[i] );
}
DevMsg( "\n" );
DevMsg( "Size: %d items\n", strings.Count() );
}
const char *Find(const char *string)
{
UtlHashHandle_t i = m_Strings.Find( string );
return i == m_Strings.InvalidHandle() ? NULL : m_Strings[ i ].Get();
}
const char *Allocate(const char *string)
{
return m_Strings[ m_Strings.Insert( string ) ].Get();
}
const char *AllocateWithKey(const char *string, const void* key)
{
const char * &cached = m_KeyLookupCache[ m_KeyLookupCache.Insert( key, NULL ) ];
if (cached == NULL)
{
cached = Allocate( string );
}
return cached;
DevMsg( "Size: %d items\n", m_Strings.Count() );
}
};
static CGameStringPool g_GameStringPool;
#ifndef GC
//-----------------------------------------------------------------------------
// String system accessor
//-----------------------------------------------------------------------------
@@ -99,7 +49,6 @@ IGameSystem *GameStringSystem()
{
return &g_GameStringPool;
}
#endif
//-----------------------------------------------------------------------------
@@ -112,26 +61,19 @@ string_t AllocPooledString( const char * pszValue )
return NULL_STRING;
}
string_t AllocPooledString_StaticConstantStringPointer( const char * pszGlobalConstValue )
{
Assert(pszGlobalConstValue && *pszGlobalConstValue);
return MAKE_STRING( g_GameStringPool.AllocateWithKey( pszGlobalConstValue, pszGlobalConstValue ) );
}
string_t FindPooledString( const char *pszValue )
{
return MAKE_STRING( g_GameStringPool.Find( pszValue ) );
}
#if !defined(CLIENT_DLL) && !defined( GC )
int CGameString::gm_iSerialNumber = 1;
#ifndef CLIENT_DLL
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CC_DumpGameStringTable( void )
{
if ( !UTIL_IsCommandIssuedByServerAdmin() )
return;
g_GameStringPool.Dump();
}
static ConCommand dumpgamestringtable("dumpgamestringtable", CC_DumpGameStringTable, "Dump the contents of the game string table to the console.", FCVAR_CHEAT);