Skip to content

Toggable monster HP bar#420

Open
nolt wants to merge 5 commits into
sven-n:mainfrom
nolt:monsters-hpbar
Open

Toggable monster HP bar#420
nolt wants to merge 5 commits into
sven-n:mainfrom
nolt:monsters-hpbar

Conversation

@nolt
Copy link
Copy Markdown
Contributor

@nolt nolt commented May 28, 2026

New Feature: Monster Health Bars

Files: NewUINameWindow.h / NewUINameWindow.cpp
Author: (MU Online client modification)

DESCRIPTION:
Pressing F8 toggles health bars above all alive monsters on the screen.
The health bar uses the same segmented style as the hover-over bar shown
at the top of the screen when mousing over a monster. Pressing F8 again
hides the bars.

HOW IT WORKS:

  • F8 - toggles monster HP bars on/off
  • Each bar consists of 20 red segments
  • The bar appears above the monster's head (~60 units above BoundingBox)
  • Bars are only drawn when the monster is on screen (visibility check
    using CameraProjection::WorldToScreen)

CHANGED FILES:

  • src/source/UI/NewUI/Character/NewUINameWindow.h

    • added: bool m_bShowMonsterHealthBar
    • added: void RenderMonsterHealthBars()
  • src/source/UI/NewUI/Character/NewUINameWindow.cpp

    • added includes: Camera/CameraProjection.h, Camera/CameraState.h
    • m_bShowMonsterHealthBar initialized to false
    • F8 toggle in UpdateKeyEvent()
    • RenderMonsterHealthBars() called in Render()
    • RenderMonsterHealthBars() implementation

DEPENDENCIES:

  • CameraProjection::WorldToScreen() from Camera/CameraProjection.h
  • g_Camera from Camera/CameraState.h
  • CharactersClient[], KIND_MONSTER, MAX_CHARACTERS_CLIENT
hpbar

nolt added 3 commits May 28, 2026 10:49
DESCRIPTION:
Pressing F8 toggles health bars above all alive monsters on the screen.
The health bar uses the same segmented style as the hover-over bar shown
at the top of the screen when mousing over a monster. Pressing F8 again
hides the bars.

HOW IT WORKS:
- F8  - toggles monster HP bars on/off
- Each bar consists of 20 red segments
- The bar appears above the monster's head (~60 units above BoundingBox)
- Bars are only drawn when the monster is on screen (visibility check
  using CameraProjection::WorldToScreen)
- F8  - toggles monster HP bars on/off
- Each bar consists of 20 red segments
- The bar appears above the monster's head (~60 units above BoundingBox)
- Bars are only drawn when the monster is on screen (visibility check
  using CameraProjection::WorldToScreen)
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the user interface by introducing dynamic, toggleable health bars for monsters. This feature aims to improve player awareness during combat by providing clear visual indicators of enemy health, which can aid in strategic targeting and engagement. The implementation is robust, covering key event handling, rendering logic, and multi-language support, ensuring a seamless and accessible experience for all players.

Highlights

  • New Feature: Toggleable Monster Health Bars: Introduced a new feature allowing players to toggle monster health bars on and off using the F8 key, providing immediate visual feedback on enemy health.
  • Visual Implementation: Implemented segmented red health bars that appear above monsters' heads, displaying their health status. These bars are only rendered for visible, alive monsters and are positioned dynamically.
  • Localization Support: Added localization entries across multiple languages to describe the new F8 keybind in the game's help and UI texts.
  • Core Logic Integration: Integrated the health bar rendering and toggle logic into the NewUINameWindow class, handling key events and drawing the bars using camera projection.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a feature to toggle monster HP bars using the F8 key, including localization updates across multiple languages and help menu entries. The feedback highlights two main issues: first, calling BeginOpengl() and EndOpengl() inside the loop for each monster is highly inefficient and should be moved outside the loop to reduce CPU overhead; second, using GetAsyncKeyState directly in Update() can capture input when the window is out of focus or during chat, so it should be handled via the event-driven input system or with focus checks.

Comment thread src/source/UI/NewUI/Character/NewUINameWindow.cpp
Comment thread src/source/UI/NewUI/Character/NewUINameWindow.cpp
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.

1 participant