Skip to content

[TF2] Remove the hard-coded F4 ready up bind for mp_tournament matches#1778

Open
dilbertron2 wants to merge 2 commits intoValveSoftware:masterfrom
dilbertron2:dynamic-mvm-bind-test
Open

[TF2] Remove the hard-coded F4 ready up bind for mp_tournament matches#1778
dilbertron2 wants to merge 2 commits intoValveSoftware:masterfrom
dilbertron2:dynamic-mvm-bind-test

Conversation

@dilbertron2
Copy link

@dilbertron2 dilbertron2 commented Jan 24, 2026

Note: I am not well-versed in the TF2 SDK or C++ in general, I tried my best. If I made any errors please tell me :)

The Issue

An issue with readying up in matches that utilise mp_tournament 1 (including Mann VS Machine) is that F4 is permanently bound to the player_ready_toggle command even if you bind another key to that action or unbind F4 via the console.

Looking at the code shows that player_ready_toggle simply simulates an F4 key press and feeds it into the CHudTournamentSetup::ToggleState function.

The Solution

Take the code from the CHudTournamentSetup::ToggleState function that handles readying up and put it into a new function called CHudTournamentSetup::TogglePlayerReadiness. Now update the player_ready_toggle command to call TogglePlayerReadiness.

This is the first part of the fix done but now we need to handle the text (Which is currently hard-coded to display F4 as the specified key.)

Update the #Tournament_Instructions localisation string from F4 = change team name/status to %s1 = change team name/status, and change #Tournament_Instructions_Ready from F4 = Toggle Ready to %s1 = Toggle Ready.

Now in all applicable places in tf_hud_tournament.cpp we look for the key that is bound to player_ready_toggle and insert it into the localisation string! This initially caused truncation in the ready up message for Mann VS Machine so I also increased the width of TournamentInstructionsLabel and TournamentInstructionsLabelShadow from 190 to 300 to ensure enough room, under the if_mvm section in Resource/UI/HudTournament.res

This also requires the xpos of both UI elements to be edited aswell to line up with the new width. TournamentInstructionsLabel gets its xpos set to c-150 and TournamentInstructionsLabelShadow gets its xpos set to c-149

Video

https://youtu.be/kE7cYbmGdeM <-- PR in action

Possible Issue

I am unaware if there is a way to dynamically center text based on length, if there is then I either missed it or cant understand it. Because of this the MvM ready up text wont always be centered(?)

Extra Steps for Valve

All other localisation files will need to be adjusted. Resource/UI/HudTournament.res will need to be modified. config_default.cfg will need to have bind "F4" "player_ready_toggle" added.

Files

Here are the modified .res and tf_english localisation file :)
Dynamic Ready Up Extra Files.zip (OLD VERSION)
Dynamic Ready Up Extra Files 2.zip (CURRENT VERSION)

Partially fixes ValveSoftware/Source-1-Games #7742

@Squid-Eevee
Copy link

you could center the label by setting it's xpos to cs-0.5 or c-<width/2>
you can then offset the drop shadow by using pin_to_sibling

@dilbertron2 dilbertron2 marked this pull request as draft January 24, 2026 19:09
@dilbertron2 dilbertron2 marked this pull request as ready for review January 25, 2026 15:28
@FlaminSarge
Copy link
Contributor

I'm not sure if string comparison with == works the way you intend here, but it'd probably also be better to either use a separate boolean for that case, or to just do that case's logic inside the block where the 'ready' text is set.

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.

[TF2] Replace hardcoded function keys on with console commands

3 participants