From bd0ea0a9cd1390430dc69c65e8770217c7dcf533 Mon Sep 17 00:00:00 2001 From: Mithrand Date: Tue, 5 Aug 2025 13:43:11 +0200 Subject: [PATCH 1/5] fix a bug where the challenge is reset after asw_mission_restart --- src/game/shared/swarm/asw_gamerules.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/game/shared/swarm/asw_gamerules.cpp b/src/game/shared/swarm/asw_gamerules.cpp index b436e2c49..92a24dc54 100644 --- a/src/game/shared/swarm/asw_gamerules.cpp +++ b/src/game/shared/swarm/asw_gamerules.cpp @@ -9932,9 +9932,11 @@ void CAlienSwarm::EnableChallenge( const char *szChallengeName ) KeyValues::AutoDelete pKV( "CHALLENGE" ); bool bEnabled = ReactiveDropChallenges::ReadData( pKV, szChallengeName ); - rd_challenge.SetValue(""); - ResetChallengeConVars(); - rd_challenge.SetValue(szChallengeName); + if ( bChanged ) { + rd_challenge.SetValue("0"); + ResetChallengeConVars(); + rd_challenge.SetValue(szChallengeName); + } if ( ASWDeathmatchMode() ) { @@ -9956,7 +9958,6 @@ void CAlienSwarm::EnableChallenge( const char *szChallengeName ) if ( bEnabled ) { ApplyChallengeConVars( pKV ); - EnforceWeaponSelectionRules(); } if ( !bEnabled ) @@ -9975,6 +9976,7 @@ void CAlienSwarm::EnableChallenge( const char *szChallengeName ) // if rd_max_marines changed we need to update marines limits using SetMaxMarines SetMaxMarines(); EnforceMaxMarines(); + EnforceWeaponSelectionRules(); OnSkillLevelChanged( m_iSkillLevel ); if ( V_strcmp( rd_challenge.GetString(), "0" ) ) From 06fafb10d8bab27327569261e0c0eedd76cfbb67 Mon Sep 17 00:00:00 2001 From: Mithrand Date: Tue, 5 Aug 2025 18:55:09 +0200 Subject: [PATCH 2/5] Revert "fix a bug where the challenge is reset after asw_mission_restart" This reverts commit bd0ea0a9cd1390430dc69c65e8770217c7dcf533. --- src/game/shared/swarm/asw_gamerules.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/game/shared/swarm/asw_gamerules.cpp b/src/game/shared/swarm/asw_gamerules.cpp index 92a24dc54..b436e2c49 100644 --- a/src/game/shared/swarm/asw_gamerules.cpp +++ b/src/game/shared/swarm/asw_gamerules.cpp @@ -9932,11 +9932,9 @@ void CAlienSwarm::EnableChallenge( const char *szChallengeName ) KeyValues::AutoDelete pKV( "CHALLENGE" ); bool bEnabled = ReactiveDropChallenges::ReadData( pKV, szChallengeName ); - if ( bChanged ) { - rd_challenge.SetValue("0"); - ResetChallengeConVars(); - rd_challenge.SetValue(szChallengeName); - } + rd_challenge.SetValue(""); + ResetChallengeConVars(); + rd_challenge.SetValue(szChallengeName); if ( ASWDeathmatchMode() ) { @@ -9958,6 +9956,7 @@ void CAlienSwarm::EnableChallenge( const char *szChallengeName ) if ( bEnabled ) { ApplyChallengeConVars( pKV ); + EnforceWeaponSelectionRules(); } if ( !bEnabled ) @@ -9976,7 +9975,6 @@ void CAlienSwarm::EnableChallenge( const char *szChallengeName ) // if rd_max_marines changed we need to update marines limits using SetMaxMarines SetMaxMarines(); EnforceMaxMarines(); - EnforceWeaponSelectionRules(); OnSkillLevelChanged( m_iSkillLevel ); if ( V_strcmp( rd_challenge.GetString(), "0" ) ) From b5a35b25d9f4f8dde1925f2821232c12486e1c5e Mon Sep 17 00:00:00 2001 From: Mithrand Date: Tue, 5 Aug 2025 18:55:46 +0200 Subject: [PATCH 3/5] Revert "Merge pull request #926 from ReactiveDrop/bugfix/rd-challenge" This reverts commit e60ea785a62705561bd66f08a1516574a6c20fc7, reversing changes made to 3b7795af4f2cd034d19951334077ceac61accfb8. --- src/game/shared/swarm/asw_gamerules.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/game/shared/swarm/asw_gamerules.cpp b/src/game/shared/swarm/asw_gamerules.cpp index b436e2c49..f79554a21 100644 --- a/src/game/shared/swarm/asw_gamerules.cpp +++ b/src/game/shared/swarm/asw_gamerules.cpp @@ -9932,10 +9932,7 @@ void CAlienSwarm::EnableChallenge( const char *szChallengeName ) KeyValues::AutoDelete pKV( "CHALLENGE" ); bool bEnabled = ReactiveDropChallenges::ReadData( pKV, szChallengeName ); - rd_challenge.SetValue(""); ResetChallengeConVars(); - rd_challenge.SetValue(szChallengeName); - if ( ASWDeathmatchMode() ) { ASWDeathmatchMode()->ApplyDeathmatchConVars(); @@ -9975,6 +9972,7 @@ void CAlienSwarm::EnableChallenge( const char *szChallengeName ) // if rd_max_marines changed we need to update marines limits using SetMaxMarines SetMaxMarines(); EnforceMaxMarines(); + rd_challenge.SetValue( szChallengeName ); OnSkillLevelChanged( m_iSkillLevel ); if ( V_strcmp( rd_challenge.GetString(), "0" ) ) From 245c065ee2d331dd352abcd2a2f301197ee03f96 Mon Sep 17 00:00:00 2001 From: Mithrand Date: Tue, 5 Aug 2025 21:17:13 +0200 Subject: [PATCH 4/5] adds a variable that allows monitoring challenge changes and transitions --- src/game/shared/swarm/asw_gamerules.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/game/shared/swarm/asw_gamerules.cpp b/src/game/shared/swarm/asw_gamerules.cpp index f79554a21..f97cb36ab 100644 --- a/src/game/shared/swarm/asw_gamerules.cpp +++ b/src/game/shared/swarm/asw_gamerules.cpp @@ -609,6 +609,7 @@ ConVar asw_marine_ff_absorption( "asw_marine_ff_absorption", "1", FCVAR_REPLICAT ConVar asw_horde_override( "asw_horde_override", "0", FCVAR_REPLICATED, "Forces hordes to spawn", UpdateMatchmakingTagsCallback ); ConVar asw_wanderer_override( "asw_wanderer_override", "0", FCVAR_REPLICATED, "Forces wanderers to spawn", UpdateMatchmakingTagsCallback ); ConVar rd_challenge( "rd_challenge", "0", FCVAR_REPLICATED | FCVAR_DEMO, "Activates a challenge by ID", UpdateMatchmakingTagsCallback ); +ConVar rd_challenge_changing( "rd_challenge_changing", "0", FCVAR_GAMEDLL | FCVAR_CHEAT | FCVAR_HIDDEN, "Internally used for diagnostics during challenge transitions" ); ConVar rd_lock_difficulty( "rd_lock_difficulty", "0", FCVAR_REPLICATED, "If 1, the lobby leader cannot change the difficulty level." ); ConVar rd_lock_onslaught( "rd_lock_onslaught", "0", FCVAR_REPLICATED, "If 1, the lobby leader cannot change the onslaught setting." ); ConVar rd_lock_hardcoreff( "rd_lock_hardcoreff", "0", FCVAR_REPLICATED, "If 1, the lobby leader cannot change the hardcore friendly fire setting." ); @@ -9916,6 +9917,7 @@ void CAlienSwarm::RevertSavedConvars() void CAlienSwarm::EnableChallenge( const char *szChallengeName ) { extern ConVar rd_challenge; + extern ConVar rd_challenge_changing; const RD_Challenge_t *pSummary = ReactiveDropChallenges::GetSummary( szChallengeName ); if ( !pSummary || ( ASWDeathmatchMode() ? !pSummary->AllowDeathmatch : !pSummary->AllowCoop ) ) @@ -9932,6 +9934,7 @@ void CAlienSwarm::EnableChallenge( const char *szChallengeName ) KeyValues::AutoDelete pKV( "CHALLENGE" ); bool bEnabled = ReactiveDropChallenges::ReadData( pKV, szChallengeName ); + rd_challenge_changing.SetValue(true); ResetChallengeConVars(); if ( ASWDeathmatchMode() ) { @@ -9972,7 +9975,6 @@ void CAlienSwarm::EnableChallenge( const char *szChallengeName ) // if rd_max_marines changed we need to update marines limits using SetMaxMarines SetMaxMarines(); EnforceMaxMarines(); - rd_challenge.SetValue( szChallengeName ); OnSkillLevelChanged( m_iSkillLevel ); if ( V_strcmp( rd_challenge.GetString(), "0" ) ) @@ -9987,6 +9989,8 @@ void CAlienSwarm::EnableChallenge( const char *szChallengeName ) { V_strncpy( m_szGameDescription, "Alien Swarm: Reactive Drop", sizeof( m_szGameDescription ) ); } + + rd_challenge_changing.SetValue(false); } void CAlienSwarm::CheckChallengeConVars() From 9fca4dd5cbd81684f4917040b8291c0c53b91f3d Mon Sep 17 00:00:00 2001 From: Mithrand Date: Tue, 5 Aug 2025 21:22:33 +0200 Subject: [PATCH 5/5] add more states --- src/game/shared/swarm/asw_gamerules.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/game/shared/swarm/asw_gamerules.cpp b/src/game/shared/swarm/asw_gamerules.cpp index f97cb36ab..58c9881eb 100644 --- a/src/game/shared/swarm/asw_gamerules.cpp +++ b/src/game/shared/swarm/asw_gamerules.cpp @@ -9934,8 +9934,10 @@ void CAlienSwarm::EnableChallenge( const char *szChallengeName ) KeyValues::AutoDelete pKV( "CHALLENGE" ); bool bEnabled = ReactiveDropChallenges::ReadData( pKV, szChallengeName ); - rd_challenge_changing.SetValue(true); + rd_challenge_changing.SetValue(1); ResetChallengeConVars(); + rd_challenge_changing.SetValue(2); + if ( ASWDeathmatchMode() ) { ASWDeathmatchMode()->ApplyDeathmatchConVars(); @@ -9959,6 +9961,8 @@ void CAlienSwarm::EnableChallenge( const char *szChallengeName ) EnforceWeaponSelectionRules(); } + rd_challenge_changing.SetValue(3); + if ( !bEnabled ) { szChallengeName = "0"; @@ -9990,7 +9994,7 @@ void CAlienSwarm::EnableChallenge( const char *szChallengeName ) V_strncpy( m_szGameDescription, "Alien Swarm: Reactive Drop", sizeof( m_szGameDescription ) ); } - rd_challenge_changing.SetValue(false); + rd_challenge_changing.SetValue(0); } void CAlienSwarm::CheckChallengeConVars()