Skip to content

Fix MvM victory screen player animations #1286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

brokenparts
Copy link
Contributor

@brokenparts brokenparts commented May 16, 2025

Hi. This fixes several visual bugs relating to player animations on the Mann Up victory screen.

Before/After

Demoman with The Bootlegger equipped

image

image

Sniper with The Huntsman equipped

image

image

Details

This PR essentially just moves the class select animation logic from CTFClassMenu::LoadItems() to a new function CTFPlayerModelPanel::PlayClassSelectAnimation(), which can be used by both the class select menu and the MvM loot screen menu. This allows both menus to reuse the same animation logic, eliminating duplicated and potentially inconsistent code.

Note: As of the current master 39f6dde, this is affected by the class select animation playback bug. This could be resolved by merging my previous PR before merging this one:

Testing

To force the loot screen to show on a listen server, change this check to always be true:

if ( TFGameRules() && TFGameRules()->GetCurrentMatchGroup() == k_eTFMatchGroup_MvM_MannUp )

and add this ConCommand:

CON_COMMAND( test_show_mvm_victory_screen, "" )
{
	CTFHudMannVsMachineStatus *pMannVsMachineStatus = GET_HUDELEMENT( CTFHudMannVsMachineStatus );
	if ( pMannVsMachineStatus && TFObjectiveResource() )
	{
		pMannVsMachineStatus->ReopenVictoryPanel();

		CMsgMvMVictoryInfo victoryInfo = CMsgMvMVictoryInfo::default_instance();

		C_BasePlayer *pMe = C_BasePlayer::GetLocalPlayer();
		CSteamID mySteamId = { }; pMe->GetSteamID( &mySteamId );

		CEconItem testItem = CEconItem();
		testItem.SetDefinitionIndex( 169 );
		testItem.SetQuality( AE_SELFMADE );

		CSOEconItem testItemSO = { };
		testItem.SerializeToProtoBufItem( testItemSO );
		std::string test_item_bytes = { };
		testItemSO.SerializeToString( &test_item_bytes );

		for ( int i = 0; i < MVM_PLAYER_COUNT; ++i )
		{
			CMsgMvMVictoryInfo_Player *pVictoryPlayer = victoryInfo.add_players();
			pVictoryPlayer->set_steam_id( mySteamId.ConvertToUint64() );
			pVictoryPlayer->set_badge_level( 12345 );

			for ( int j = 0; j < 5; ++j )
			{
				CMsgMvMVictoryInfo_Item *pItem = pVictoryPlayer->add_items();
				pItem->set_item_data( test_item_bytes );
				pItem->set_grant_reason( j == 0 ? CMsgMvMVictoryInfo_GrantReason_BADGE_LEVELED : CMsgMvMVictoryInfo_GrantReason_MANN_UP );
			}
		}

		pMannVsMachineStatus->MVMVictoryGCResponse( victoryInfo );
	}
};

Add member function PlayClassSelectAnimation() to CTFPlayerModelPanel
and move class select logic from CTFClassMenu::LoadItems().

This will allow the MvM victory screen to use the exact same animations
as the class select menu.
Greatly simplifies MvM loot screen code by just calling
CTFPlayerModelPanel::PlayClassSelectAnimation, rather than trying to
replicate the same code in two places.

Fixes multiple visual bugs:
- Wrong weapon being held (Demoman booties)
- Wrong weapon animations playing (Sniper bows)
- Probably some more...
@brokenparts brokenparts marked this pull request as draft May 16, 2025 05:22
@brokenparts brokenparts marked this pull request as ready for review May 16, 2025 05:22
@rabscootle
Copy link
Contributor

rabscootle commented May 16, 2025

This might be better suited for another (optional) PR, but is there any chance that weapons that cannot use “fancy” class select animations instead have the user perform the taunt matching the currently held weapon?

@brokenparts
Copy link
Contributor Author

This might be better suited for another (optional) PR, but is there any chance that weapons that cannot use “fancy” class select animations instead have the user perform the taunt matching the currently held weapon?

Sounds like a good idea. This PR is already relatively large, so I'd rather wait and see if this one gets merged before attempting to add anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants