Skip to content

Commit

Permalink
add keyhint forwards and forceUpdate (#1201)
Browse files Browse the repository at this point in the history
* add keyhint forwards/remove unused params from topleft forwards

* allow forcing keyhint through pre forward

* implement track/style params, edit force updating logic

* doc touchups

* fix typo

* do some styling since the blame was already affected by the indentation changes

---------

Co-authored-by: Nimmy2222 <[email protected]>
Co-authored-by: rtldg <[email protected]>
  • Loading branch information
3 people authored Mar 12, 2024
1 parent 64d6a1d commit d57ec73
Show file tree
Hide file tree
Showing 2 changed files with 269 additions and 163 deletions.
32 changes: 31 additions & 1 deletion addons/sourcemod/scripting/include/shavit/hud.inc
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,40 @@ forward Action Shavit_OnTopLeftHUD(int client, int target, char[] topleft, int t
* @param topleftlength Max length of the topleft buffer.
* @param track Target's track.
* @param style Target's style.
* @param forceUpdate Force even if the client has disabled HUD_TOPLEFT.
*
* @return Plugin_Handled or Plugin_Stop to block the HUD message from appearing. Plugin_Changed to use own topleft string instead of shavit-hud building it.
*/
forward Action Shavit_PreOnTopLeftHUD(int client, int target, char[] topleft, int topleftlength, int track, int style);
forward Action Shavit_PreOnTopLeftHUD(int client, int target, char[] topleft, int topleftlength, int track, int style, bool &forceUpdate);

/**
* Called when key hint (bottom left) HUD updates (Source 2013 only).
*
* @param client Client index that recieves the hud.
* @param target Target entity that is either the client or what the client is spectating.
* @param keyhint Reference to the HUD buffer.
* @param keyhintlength Max length of the keyhint buffer.
* @param track Target's track.
* @param style Target's style.
*
* @return Plugin_Handled or Plugin_Stop to block the HUD message from appearing. Anything else to pass along new values.
*/
forward Action Shavit_OnKeyHintHUD(int client, int target, char[] keyhint, int keyhintlength, int track, int style);

/**
* Called before the key hint HUD (bottom left) updates and used to build the string for shavit-hud (Source 2013 only).
*
* @param client Client index that recieves the hud.
* @param target Target entity that is either the client or what the client is spectating.
* @param keyhint Reference to the HUD buffer.
* @param keyhintlength Max length of the keyhint buffer.
* @param track Target's track.
* @param style Target's style.
* @param forceUpdate Force even if the client has disabled HUD_SYNC, HUD_TIMELEFT, and HUD2_PERFS.
*
* @return Plugin_Handled or Plugin_Stop to block the HUD message from appearing. Plugin_Changed to use own keyhint string instead of shavit-hud building it.
*/
forward Action Shavit_PreOnKeyHintHUD(int client, int target, char[] keyhint, int keyhintlength, int track, int style, bool &forceUpdate);

/**
* Called before the center hud updates.
Expand Down
Loading

0 comments on commit d57ec73

Please sign in to comment.