From 9c563891f6b25a0be3e2d543caa071e12dbcd9a2 Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Sun, 1 Aug 2010 19:26:54 -0500 Subject: [PATCH] SDK sync. --- game/client/swarm/asw_medal_store.cpp | 54 +++++++++++++++++++------ game/server/physics_main.cpp | 2 +- game/server/swarm/asw_base_spawner.cpp | 22 ++++------ game/shared/swarm/asw_marine_skills.cpp | 2 +- 4 files changed, 52 insertions(+), 28 deletions(-) diff --git a/game/client/swarm/asw_medal_store.cpp b/game/client/swarm/asw_medal_store.cpp index 5e66bd0e..9439be1c 100644 --- a/game/client/swarm/asw_medal_store.cpp +++ b/game/client/swarm/asw_medal_store.cpp @@ -51,10 +51,22 @@ void C_ASW_Medal_Store::LoadMedalStore() #else ISteamRemoteStorage *pRemoteStorage = SteamClient() ? ( ISteamRemoteStorage * )SteamClient()->GetISteamGenericInterface( 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 ( !GetFileFromRemoteStorage( pRemoteStorage, "PersistentMarines.dat", "cfg/clientc.dat" ) ) + if ( !GetFileFromRemoteStorage( pRemoteStorage, "PersistentMarines.dat", szMedalFile ) ) { #ifdef _DEBUG Warning( "Failed to get client.dat from Steam Cloud.\n" ); @@ -74,7 +86,7 @@ void C_ASW_Medal_Store::LoadMedalStore() m_bLoaded = true; - FileHandle_t f = filesystem->Open( "cfg/clientc.dat", "rb", "MOD" ); + FileHandle_t f = filesystem->Open( szMedalFile, "rb", "MOD" ); if ( !f ) 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() { + if ( !m_bLoaded ) + return false; + KeyValues *kv = new KeyValues( "CLIENTDAT" ); // output missions/campaigns/kills @@ -302,19 +317,34 @@ bool C_ASW_Medal_Store::SaveMedalStore() } 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) - 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 ) + 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++ ) { - 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; } diff --git a/game/server/physics_main.cpp b/game/server/physics_main.cpp index 21c62710..97ec23f6 100644 --- a/game/server/physics_main.cpp +++ b/game/server/physics_main.cpp @@ -310,7 +310,7 @@ bool CPhysicsPushedEntities::SpeculativelyCheckPush( PhysicsPushedInfo_t &info, } } pBlocker->SetAbsOrigin( pushDestPosition ); - DevMsg(1, "Ignoring player blocking train!\n"); + //DevMsg(1, "Ignoring player blocking train!\n"); return true; } else diff --git a/game/server/swarm/asw_base_spawner.cpp b/game/server/swarm/asw_base_spawner.cpp index cc6be9c2..e34b18b2 100644 --- a/game/server/swarm/asw_base_spawner.cpp +++ b/game/server/swarm/asw_base_spawner.cpp @@ -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 maxs = GetAbsOrigin() + Vector( 23, 23, 0 ); 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()) { - bool bMovedSomethingAside = false; // some non-world entity is blocking the spawn point, so don't spawn if (tr.m_pEnt) { - IASW_Spawnable_NPC *pSpawnable = dynamic_cast(tr.m_pEnt); - if (pSpawnable) + 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. { - pSpawnable->MoveAside(); // try and make him move aside - bMovedSomethingAside = true; + IASW_Spawnable_NPC *pSpawnable = dynamic_cast(tr.m_pEnt); + if (pSpawnable) + { + pSpawnable->MoveAside(); // try and make him move aside + m_iMoveAsideCount++; + } } 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()); @@ -150,9 +146,7 @@ bool CASW_Base_Spawner::CanSpawn( const Vector &vecHullMins, const Vector &vecHu if (asw_debug_spawners.GetBool()) 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; } } diff --git a/game/shared/swarm/asw_marine_skills.cpp b/game/shared/swarm/asw_marine_skills.cpp index a75e8c42..bfaef35b 100644 --- a/game/shared/swarm/asw_marine_skills.cpp +++ b/game/shared/swarm/asw_marine_skills.cpp @@ -136,7 +136,7 @@ ConVar asw_skill_muzzle_flash_step("asw_skill_muzzle_flash_step", "0.2", FCVAR_R ConVar asw_skill_accuracy_sniper_rifle_dmg_base("asw_skill_accuracy_sniper_rifle_dmg_base", "0", FCVAR_REPLICATED | FCVAR_CHEAT ); ConVar asw_skill_accuracy_sniper_rifle_dmg_step("asw_skill_accuracy_sniper_rifle_dmg_step", "10", FCVAR_REPLICATED | FCVAR_CHEAT ); ConVar asw_skill_accuracy_tesla_cannon_dmg_base("asw_skill_accuracy_tesla_cannon_dmg_base", "0", FCVAR_REPLICATED | FCVAR_CHEAT ); -ConVar asw_skill_accuracy_tesla_cannon_dmg_step("asw_skill_accuracy_tesla_cannon_dmg_step", "025", FCVAR_REPLICATED | FCVAR_CHEAT ); +ConVar asw_skill_accuracy_tesla_cannon_dmg_step("asw_skill_accuracy_tesla_cannon_dmg_step", "0.25", FCVAR_REPLICATED | FCVAR_CHEAT ); namespace {