Skip to content
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

Defrag hud #274

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

PeenScreeker
Copy link
Member

Added convar wishlist items for player configurable strafe hud settings.

Added convars for user-configurable strafe hud elements

revised color defaults

revised defaults and added colors for coloring snap zones based on speed gain potential

feat: added minimum speed for accel and snap zones

fix: min speed format

fixed previously swapped max and default values
@braem
Copy link
Member

braem commented Mar 24, 2022

PR up for adding these internally, with names slightly tweaked. Here is what they look like (note this is not Valve code, it is what this would look like on 0.8.7 (public build on 2013SDK); no leaks):

static MAKE_CONVAR_C( mom_df_hud_projection, "0", FCVAR_ARCHIVE, "Projection mode for strafe hud. 0 = Perspective, 1 = Arc length, 2 = Panoramic.\n", 0, 2, OnHUDProjectionUpdate );

static MAKE_TOGGLE_CONVAR_C( mom_df_hud_fov_override_enable, "0", FCVAR_ARCHIVE, "Toggles overriding the viewport FOV for the Defrag HUD. 0 = OFF, 1 = ON.\n", OnHUDFOVUpdate );
static MAKE_CONVAR_C( mom_df_hud_fov_override, "50", FCVAR_ARCHIVE, "FOV override for Defrag HUD\n", 50.f, 130.f, OnHUDFOVUpdate );

static MAKE_TOGGLE_CONVAR_C( mom_df_hud_accel_enable, "1", FCVAR_ARCHIVE, "Toggles showing the hud timer. 0 = OFF, 1 = ON.\n", OnHUDAccelUpdate );
static MAKE_TOGGLE_CONVAR_C( mom_df_hud_accel_mirror_enable, "1", FCVAR_ARCHIVE, "Display accel zones for mirrored inputs. 0 = OFF, 1 = ON.\n", OnHUDAccelUpdate );
static MAKE_TOGGLE_CONVAR_C( mom_df_hud_accel_scale_enable, "1", FCVAR_ARCHIVE, "Scale accel zones by current movement input scale. 0 = OFF, 1 = ON.\n", OnHUDAccelUpdate );
static MAKE_CONVAR_C( mom_df_hud_accel_min_speed, "1", FCVAR_ARCHIVE, "Minimum speed required to draw accel zones.\n", 1.f, 1000.f, OnHUDAccelUpdate );
static MAKE_CONVAR_C( mom_df_hud_accel_height, "20", FCVAR_ARCHIVE, "Height of accel zones in pixels (scaled).\n", 0.f, 50.f, OnHUDAccelUpdate );
static MAKE_CONVAR_C( mom_df_hud_accel_offset, "10", FCVAR_ARCHIVE, "Vertical offset from center screen in pixels (scaled).\n", -200.f, 200.f, OnHUDAccelUpdate );
static ConVar mom_df_hud_accel_dz_color( "mom_df_hud_accel_dz_color", "128 128 128 0", FCVAR_ARCHIVE, "No-accel zone color.\n", OnHUDAccelUpdate );
static ConVar mom_df_hud_accel_fast_color( "mom_df_hud_accel_fast_color", "20 150 210 150", FCVAR_ARCHIVE, "Full-accel zone color.\n", OnHUDAccelUpdate );
static ConVar mom_df_hud_accel_slow_color( "mom_df_hud_accel_slow_color", "240 240 240 180", FCVAR_ARCHIVE, "Partial-accel zone color.\n", OnHUDAccelUpdate );
static ConVar mom_df_hud_accel_turn_color( "mom_df_hud_accel_turn_color", "240 110 110 180", FCVAR_ARCHIVE, "Turn zone color.\n", OnHUDAccelUpdate );

static MAKE_TOGGLE_CONVAR_C( mom_df_hud_snap_enable, "0", FCVAR_ARCHIVE, "Display snap zones where velocity rounding impacts speed gain. 0 = OFF, 1 = ON.\n", OnHUDSnapUpdate );
static MAKE_TOGGLE_CONVAR_C( mom_df_hud_snap_heightgain_enable, "0", FCVAR_ARCHIVE, "Size snap zones by speed gain potential. 0 = OFF, 1 = ON.\n", OnHUDSnapUpdate );
static MAKE_TOGGLE_CONVAR_C( mom_df_hud_snap_hl_enable, "0", FCVAR_ARCHIVE, "Highlight active snap zone. 0 = OFF, 1 = ON.\n", OnHUDSnapUpdate );
static MAKE_CONVAR_C( mom_df_hud_snap_color_mode, "0", FCVAR_ARCHIVE, "Color snap zones by speed gain potential. 0 = off, 1 = colored by potential gain, 2 = fade color by actual speed gain.\n", 0, 2, OnHUDSnapUpdate );
static MAKE_CONVAR_C( mom_df_hud_snap_min_speed, "0", FCVAR_ARCHIVE, "Minimum speed required to draw accel zones.\n", 0.f, 1000.f, OnHUDSnapUpdate );
static MAKE_CONVAR_C( mom_df_hud_snap_height, "10", FCVAR_ARCHIVE, "Height of snap zones in pixels (scaled).\n", 1, 50, OnHUDSnapUpdate );
static MAKE_CONVAR_C( mom_df_hud_snap_offset, "0", FCVAR_ARCHIVE, "Vertical offset from top of accel zone in pixels (scaled).\n", -200.f, 200.f, OnHUDSnapUpdate );
static ConVar mom_df_hud_snap_color( "mom_df_hud_snap_color", "210 210 210 150", FCVAR_ARCHIVE, "Colored snap zone color.\n", OnHUDSnapUpdate );
static ConVar mom_df_hud_snap_hl_color( "mom_df_hud_snap_hl_color", "240 240 240 180", FCVAR_ARCHIVE, "Colored snap zone highlight color.\n", OnHUDSnapUpdate );
static ConVar mom_df_hud_snap_hl_alt_color( "mom_df_hud_snap_hl_alt_color", "240 240 240 40", FCVAR_ARCHIVE, "Uncolored snap zone highlight color.\n", OnHUDSnapUpdate );
static ConVar mom_df_hud_snap_fast_color( "mom_df_hud_snap_fast_color", "110 240 110 150", FCVAR_ARCHIVE, "Snap zone color used as maximum for color-by-gain mode.\n", OnHUDSnapUpdate );
static ConVar mom_df_hud_snap_slow_color( "mom_df_hud_snap_slow_color", "240 110 110 150", FCVAR_ARCHIVE, "Snap zone color used as minimum for color-by-gain mode.\n", OnHUDSnapUpdate );

static MAKE_TOGGLE_CONVAR_C( mom_df_hud_velocity_enable, "0", FCVAR_ARCHIVE, "Display velocity direction arrow. 0 = OFF, 1 = ON.\n", OnHUDVelocityUpdate );
static MAKE_CONVAR_C( mom_df_hud_velocity_size, "8", FCVAR_ARCHIVE, "Velocity arrow half-height in pixels (scaled).\n", 0, 25, OnHUDVelocityUpdate );
static ConVar mom_df_hud_velocity_color( "mom_df_hud_velocity_color", "240 240 240 180", FCVAR_ARCHIVE, "Velocity arrow color.\n", OnHUDVelocityUpdate );

static MAKE_TOGGLE_CONVAR_C( mom_df_hud_windicator_enable, "0", FCVAR_ARCHIVE, "Display w-turn indicator (windicator) arrow. 0 = OFF, 1 = ON.\n", OnHUDWIndicatorUpdate );
static MAKE_CONVAR_C( mom_df_hud_windicator_size, "6", FCVAR_ARCHIVE, "Windicator arrow half-height in pixels (scaled).\n", 0, 25, OnHUDWIndicatorUpdate );
static ConVar mom_df_hud_windicator_color( "mom_df_hud_windicator_color", "240 240 0 180", FCVAR_ARCHIVE, "Windicator arrow color.\n", OnHUDWIndicatorUpdate );

First value in quotes is the default value, while the bounds are the second numbers. The last parameter in each of these is a callback function that fires a panorama event of similar name:

  • OnDefragHUDProjectionChange
  • OnDefragHUDFOVChange
  • OnDefragHUDAccelChange
  • OnDefragHUDSnapChange
  • OnDefragHUDVelocityChange
  • OnDefragHUDWIndicatorChange

Each event sends no data. Data will have to fetched from DefragAPI.

Available in DefragAPI:

  • GetDFPhysicsMode() -> int, moved from MomentumMovementAPI
  • GetHUDProjection() -> int, gets value of mom_df_hud_projection
  • GetHUDFOV() -> float, gets value of mom_df_hud_fov_override if mom_df_hud_fov_override_enable is enabled, else returns 0
  • GetHUDAccelCFG() -> DFHUDAccel_t, a JSO with fields
    • enable, mirrorEnable, scaleEnable, minSpeed, height, offset, dzColor, fastColor, slowColor, turnColor
  • GetHUDSnapCFG() -> DFHUDSnap_t, a JSO with fields
    • enable, enableHeightGain, highlightEnable, colorMode, minSpeed, height, offset, color, highlightColor, altHighlightColor, fastColor, slowColor
  • GetHUDVelocityCFG() -> DFHUDVelocity_t, a JSO with fields
    • enable, size, color
  • GetHUDWIndicatorCFG() -> DFHUDWIndicator_t, a JSO with fields
    • enable, size, color

Note that color values will be converted into the format rgba(x,x,x,x) when being sent to JS, and so can be directly passed to panelname.style.color.

@braem braem added the Blocked: Needs work PR requires significant additional work label Apr 9, 2022
@tsa96
Copy link
Member

tsa96 commented May 7, 2023

@PeenScreeker reminder that this PR exists! You'll need to migrate some files over to Hugo, give me a shout if you need a hand with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked: Needs work PR requires significant additional work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants