This commit is contained in:
mv 2024-08-30 03:06:39 +03:00
parent 1a601a2e0a
commit 8419a607ef
3 changed files with 51 additions and 27 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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<IASW_Spawnable_NPC*>(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<IASW_Spawnable_NPC*>(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;
}
}