Skip to content

Replace hud_reloadscheme hack with EditablePanel + LoadControlSettings, indirectly fixes MOTD title + layout#368

Merged
nullsystem merged 3 commits intoNeotokyoRebuild:masterfrom
nullsystem:GH-367_ChangeToEditablePanel
Jun 25, 2024
Merged

Replace hud_reloadscheme hack with EditablePanel + LoadControlSettings, indirectly fixes MOTD title + layout#368
nullsystem merged 3 commits intoNeotokyoRebuild:masterfrom
nullsystem:GH-367_ChangeToEditablePanel

Conversation

@nullsystem
Copy link
Copy Markdown
Collaborator

@nullsystem nullsystem commented Jun 15, 2024

  • Both ammo and health-aux huds had a hack which forces hud_reloadscheme to be called on initialization. However this has visibly caused an issue with the MOTD which in Valve's code resets the data and look a bit odd. This also enforced reload on all huds which is unnecessary.
  • The proper way to load those HudLayout.res settings is instead to have those inherit EditablePanel which most importantly provides a method LoadControlSettings to properly load those settings instead.
  • This also refactor the font applying to ApplySchemeSettings
  • Minor edit in HudLayout.res chat box is intentional otherwise there's a permanent background with using this EditablePanel change.
  • fixes neo_hud health/compass/ammo need to change to EditablePanel #367

Testing

  • What to change around:
    • Change/add around values in: scripts/HudLayout.res. Minimal example to differentiate from defaults. Compass +20 instead of +3, Ammo read bg, Health bar RGB, 255-0-255:
      NHudCompass
      {
              "fieldName"             "NHudCompass"
              "y_bottom_pos"          "20"
      }
      NHudWeapon
      {
              "fieldName"             "NHudWeapon"
              "box_color_r"           "254"
      }
      NHudHealth
      {
              "fieldName"             "NHudHealth"
              "health_color_g"        "0"
      }
      
  • What needed to be checked:

@nullsystem nullsystem changed the title Replace hud_reloadscheme hack with EditablePanel + LoadControlSettings Replace hud_reloadscheme hack with EditablePanel + LoadControlSettings, fixes MOTD title + layout Jun 15, 2024
@nullsystem nullsystem requested review from a team and AdamTadeusz June 15, 2024 00:11
@nullsystem nullsystem changed the title Replace hud_reloadscheme hack with EditablePanel + LoadControlSettings, fixes MOTD title + layout Replace hud_reloadscheme hack with EditablePanel + LoadControlSettings, indirectly fixes MOTD title + layout Jun 15, 2024
Copy link
Copy Markdown
Collaborator

@Rainyan Rainyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the MOTD layout indeed seems fixed by this PR:

20240619191739_1

However, after using hud_reloadscheme, the layout is broken again upon next server join:

20240619191810_1

Is this MOTD business outside the scope of this PR?

@Rainyan

This comment was marked as resolved.

* Both ammo and health-aux huds had a hack which forces hud_reloadscheme
  to be called on initialization. However this has visibly caused an
  issue with the MOTD which in Valve's code resets the data and look a
  bit odd. This also enforced reload on all huds which is unnecessary.
* The proper way to load those HudLayout.res settings is
  instead to have those inherit EditablePanel which most importantly
  provides a method `LoadControlSettings` to properly load those
  settings instead.
* This also refactor the font applying to ApplySchemeSettings
* Minor edit in HudLayout.res chat box is intentional otherwise there's
  a permanent background with using this EditablePanel change.
* fixes #367
@nullsystem
Copy link
Copy Markdown
Collaborator Author

nullsystem commented Jun 19, 2024

@Rainyan Actually, only the server title/contents being intact being the main fix of this regarding MOTD. So I shouldn't really have mentioned the layout stuff. Technically though, the 2nd picture's "broken" layout is the "actual" res layout of the MOTD straight from OG:NT's TextWindow.res file I think. The fix is probably more like define our own one that doesn't look so bad/closer to HL2's one and also fix that vguitextwindow class to read from the res from the beginning.

So in this case, yeah out of scope of this PR.

Rainyan

This comment was marked as resolved.

@nullsystem
Copy link
Copy Markdown
Collaborator Author

nullsystem commented Jun 19, 2024

@Rainyan Try out with the latest commit in, I think it's just moving around SetScreenSize/SetBounds lines caused it. Don't think I see the warning after the commit (but seen before) but have a check.

@nullsystem nullsystem merged commit 66e522e into NeotokyoRebuild:master Jun 25, 2024
Rainyan pushed a commit that referenced this pull request Jul 1, 2024
…s, indirectly fixes MOTD title + layout (#368)

* Replace hud_reloadscheme hack with EditablePanel + LoadControlSettings

* Both ammo and health-aux huds had a hack which forces hud_reloadscheme
  to be called on initialization. However this has visibly caused an
  issue with the MOTD which in Valve's code resets the data and look a
  bit odd. This also enforced reload on all huds which is unnecessary.
* The proper way to load those HudLayout.res settings is
  instead to have those inherit EditablePanel which most importantly
  provides a method `LoadControlSettings` to properly load those
  settings instead.
* This also refactor the font applying to ApplySchemeSettings
* Minor edit in HudLayout.res chat box is intentional otherwise there's
  a permanent background with using this EditablePanel change.
* fixes #367

* Code review, dont need InvalidateLayout

* Merge fix?
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.

neo_hud health/compass/ammo need to change to EditablePanel

3 participants