This commit is contained in:
parent
1a601a2e0a
commit
8419a607ef
|
@ -51,10 +51,22 @@ void C_ASW_Medal_Store::LoadMedalStore()
|
||||||
#else
|
#else
|
||||||
ISteamRemoteStorage *pRemoteStorage = SteamClient() ? ( ISteamRemoteStorage * )SteamClient()->GetISteamGenericInterface(
|
ISteamRemoteStorage *pRemoteStorage = SteamClient() ? ( ISteamRemoteStorage * )SteamClient()->GetISteamGenericInterface(
|
||||||
SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), STEAMREMOTESTORAGE_INTERFACE_VERSION ) : NULL;
|
SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), STEAMREMOTESTORAGE_INTERFACE_VERSION ) : NULL;
|
||||||
|
ISteamUser *pSteamUser = steamapicontext ? steamapicontext->SteamUser() : NULL;
|
||||||
|
if ( !pSteamUser )
|
||||||
|
return;
|
||||||
|
|
||||||
|
char szMedalFile[ 256 ];
|
||||||
|
Q_snprintf( szMedalFile, sizeof( szMedalFile ), "cfg/clientc_%s.dat", pSteamUser->GetSteamID().Render() );
|
||||||
|
int len = Q_strlen( szMedalFile );
|
||||||
|
for ( int i = 0; i < len; i++ )
|
||||||
|
{
|
||||||
|
if ( szMedalFile[ i ] == ':' )
|
||||||
|
szMedalFile[i] = '_';
|
||||||
|
}
|
||||||
|
|
||||||
if ( asw_steam_cloud.GetBool() && pRemoteStorage )
|
if ( asw_steam_cloud.GetBool() && pRemoteStorage )
|
||||||
{
|
{
|
||||||
if ( !GetFileFromRemoteStorage( pRemoteStorage, "PersistentMarines.dat", "cfg/clientc.dat" ) )
|
if ( !GetFileFromRemoteStorage( pRemoteStorage, "PersistentMarines.dat", szMedalFile ) )
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Warning( "Failed to get client.dat from Steam Cloud.\n" );
|
Warning( "Failed to get client.dat from Steam Cloud.\n" );
|
||||||
|
@ -74,7 +86,7 @@ void C_ASW_Medal_Store::LoadMedalStore()
|
||||||
|
|
||||||
m_bLoaded = true;
|
m_bLoaded = true;
|
||||||
|
|
||||||
FileHandle_t f = filesystem->Open( "cfg/clientc.dat", "rb", "MOD" );
|
FileHandle_t f = filesystem->Open( szMedalFile, "rb", "MOD" );
|
||||||
if ( !f )
|
if ( !f )
|
||||||
return; // if we get here, it means the player has no clientc.dat file and therefore no medals
|
return; // if we get here, it means the player has no clientc.dat file and therefore no medals
|
||||||
|
|
||||||
|
@ -211,6 +223,9 @@ void C_ASW_Medal_Store::LoadMedalStore()
|
||||||
|
|
||||||
bool C_ASW_Medal_Store::SaveMedalStore()
|
bool C_ASW_Medal_Store::SaveMedalStore()
|
||||||
{
|
{
|
||||||
|
if ( !m_bLoaded )
|
||||||
|
return false;
|
||||||
|
|
||||||
KeyValues *kv = new KeyValues( "CLIENTDAT" );
|
KeyValues *kv = new KeyValues( "CLIENTDAT" );
|
||||||
|
|
||||||
// output missions/campaigns/kills
|
// output missions/campaigns/kills
|
||||||
|
@ -302,19 +317,34 @@ bool C_ASW_Medal_Store::SaveMedalStore()
|
||||||
}
|
}
|
||||||
UTIL_EncodeICE( (unsigned char*) buf.Base(), buf.TellPut(), g_ucMedalStoreEncryptionKey );
|
UTIL_EncodeICE( (unsigned char*) buf.Base(), buf.TellPut(), g_ucMedalStoreEncryptionKey );
|
||||||
|
|
||||||
bool bResult = filesystem->WriteFile( "cfg/clientc.dat", "MOD", buf );
|
ISteamUser *pSteamUser = steamapicontext ? steamapicontext->SteamUser() : NULL;
|
||||||
|
if ( !pSteamUser )
|
||||||
|
return false;
|
||||||
|
|
||||||
#if defined(NO_STEAM)
|
char szMedalFile[ 256 ];
|
||||||
AssertMsg( false, "SteamCloud not available." );
|
Q_snprintf( szMedalFile, sizeof( szMedalFile ), "cfg/clientc_%s.dat", pSteamUser->GetSteamID().Render() );
|
||||||
#else
|
int len = Q_strlen( szMedalFile );
|
||||||
ISteamRemoteStorage *pRemoteStorage = SteamClient() ? ( ISteamRemoteStorage * )SteamClient()->GetISteamGenericInterface(
|
for ( int i = 0; i < len; i++ )
|
||||||
SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), STEAMREMOTESTORAGE_INTERFACE_VERSION ) : NULL;
|
|
||||||
|
|
||||||
if ( asw_steam_cloud.GetBool() && pRemoteStorage )
|
|
||||||
{
|
{
|
||||||
WriteFileToRemoteStorage( pRemoteStorage, "PersistentMarines.dat", "cfg/clientc.dat" );
|
if ( szMedalFile[ i ] == ':' )
|
||||||
|
szMedalFile[i] = '_';
|
||||||
|
}
|
||||||
|
|
||||||
|
bool bResult = filesystem->WriteFile( szMedalFile, "MOD", buf );
|
||||||
|
if ( bResult )
|
||||||
|
{
|
||||||
|
#if defined(NO_STEAM)
|
||||||
|
AssertMsg( false, "SteamCloud not available." );
|
||||||
|
#else
|
||||||
|
ISteamRemoteStorage *pRemoteStorage = SteamClient() ? ( ISteamRemoteStorage * )SteamClient()->GetISteamGenericInterface(
|
||||||
|
SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), STEAMREMOTESTORAGE_INTERFACE_VERSION ) : NULL;
|
||||||
|
|
||||||
|
if ( asw_steam_cloud.GetBool() && pRemoteStorage )
|
||||||
|
{
|
||||||
|
WriteFileToRemoteStorage( pRemoteStorage, "PersistentMarines.dat", szMedalFile );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,7 +310,7 @@ bool CPhysicsPushedEntities::SpeculativelyCheckPush( PhysicsPushedInfo_t &info,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pBlocker->SetAbsOrigin( pushDestPosition );
|
pBlocker->SetAbsOrigin( pushDestPosition );
|
||||||
DevMsg(1, "Ignoring player blocking train!\n");
|
//DevMsg(1, "Ignoring player blocking train!\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -96,12 +96,6 @@ bool CASW_Base_Spawner::CanSpawn( const Vector &vecHullMins, const Vector &vecHu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_iMoveAsideCount > 5)
|
|
||||||
{
|
|
||||||
// we've tried to move aliens aside 5 times, don't do it anymore, else they'll never go to sleep and save CPU
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector mins = GetAbsOrigin() - Vector( 23, 23, 0 );
|
Vector mins = GetAbsOrigin() - Vector( 23, 23, 0 );
|
||||||
Vector maxs = GetAbsOrigin() + Vector( 23, 23, 0 );
|
Vector maxs = GetAbsOrigin() + Vector( 23, 23, 0 );
|
||||||
CBaseEntity *pList[128];
|
CBaseEntity *pList[128];
|
||||||
|
@ -132,15 +126,17 @@ bool CASW_Base_Spawner::CanSpawn( const Vector &vecHullMins, const Vector &vecHu
|
||||||
|
|
||||||
if (tr.fraction < 1.0f && tr.DidHitNonWorldEntity())
|
if (tr.fraction < 1.0f && tr.DidHitNonWorldEntity())
|
||||||
{
|
{
|
||||||
bool bMovedSomethingAside = false;
|
|
||||||
// some non-world entity is blocking the spawn point, so don't spawn
|
// some non-world entity is blocking the spawn point, so don't spawn
|
||||||
if (tr.m_pEnt)
|
if (tr.m_pEnt)
|
||||||
{
|
{
|
||||||
IASW_Spawnable_NPC *pSpawnable = dynamic_cast<IASW_Spawnable_NPC*>(tr.m_pEnt);
|
if ( m_iMoveAsideCount < 6 ) // don't send 'move aside' commands more than 5 times in a row, else you'll stop blocked NPCs going to sleep.
|
||||||
if (pSpawnable)
|
|
||||||
{
|
{
|
||||||
pSpawnable->MoveAside(); // try and make him move aside
|
IASW_Spawnable_NPC *pSpawnable = dynamic_cast<IASW_Spawnable_NPC*>(tr.m_pEnt);
|
||||||
bMovedSomethingAside = true;
|
if (pSpawnable)
|
||||||
|
{
|
||||||
|
pSpawnable->MoveAside(); // try and make him move aside
|
||||||
|
m_iMoveAsideCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (asw_debug_spawners.GetBool())
|
if (asw_debug_spawners.GetBool())
|
||||||
Msg("asw_spawner(%s): Alien can't spawn because a non-world entity is blocking the spawn point: %s\n", GetEntityName(), tr.m_pEnt->GetClassname());
|
Msg("asw_spawner(%s): Alien can't spawn because a non-world entity is blocking the spawn point: %s\n", GetEntityName(), tr.m_pEnt->GetClassname());
|
||||||
|
@ -151,8 +147,6 @@ bool CASW_Base_Spawner::CanSpawn( const Vector &vecHullMins, const Vector &vecHu
|
||||||
Msg("asw_spawner(%s): Alien can't spawn because a non-world entity is blocking the spawn point.\n", GetEntityName());
|
Msg("asw_spawner(%s): Alien can't spawn because a non-world entity is blocking the spawn point.\n", GetEntityName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bMovedSomethingAside)
|
|
||||||
m_iMoveAsideCount++;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue