Skip to content

game_menu entity#400

Merged
Blixibon merged 1 commit into
mapbase-source:developfrom
Blixibon:mapbase/feature/game-menu-entity
Jun 4, 2025
Merged

game_menu entity#400
Blixibon merged 1 commit into
mapbase-source:developfrom
Blixibon:mapbase/feature/game-menu-entity

Conversation

@Blixibon
Copy link
Copy Markdown
Member

This PR adds a new entity called game_menu which displays a custom dialog from CHudMenu, which is normally used by multiplayer games to initiate voice commands.

Example:

mapbase_demo_v8fixes10000

This PR also contains some changes to CHudMenu which are associated with this entity.


PR Checklist

  • My PR follows all guidelines in the CONTRIBUTING.md file
  • My PR targets a develop branch OR targets another branch with a specific goal in mind

@Blixibon Blixibon force-pushed the mapbase/feature/game-menu-entity branch 3 times, most recently from de1fd8e to bf325df Compare February 13, 2025 17:03
@Blixibon
Copy link
Copy Markdown
Member Author

Blixibon commented Mar 1, 2025

I've been told that INVALID_MENUITEM being set at -1 instead of 0 may break SourceMod plugins. Putting this in draft until I have a better solution

@Blixibon Blixibon marked this pull request as draft March 1, 2025 22:33
@Blixibon Blixibon force-pushed the mapbase/feature/game-menu-entity branch from bf325df to 2925fce Compare May 29, 2025 01:01
@Blixibon Blixibon marked this pull request as ready for review May 29, 2025 01:24
@Blixibon Blixibon force-pushed the mapbase/feature/game-menu-entity branch from 2925fce to 53c7c19 Compare May 29, 2025 01:51
@Blixibon
Copy link
Copy Markdown
Member Author

I've been told that INVALID_MENUITEM being set at -1 instead of 0 may break SourceMod plugins. Putting this in draft until I have a better solution

Following up from this: The invalid menu item was changed from 0 to -1 so that the paint code could differentiate between the title and the 10th/cancel option, which both use an item ID of 0. Without this, the cancel option would use the larger font intended for the title.

In order to get around the aforementioned plugin incompatibility, I made the paint code differentiate between them in a way that allows their IDs to remain the same. If the item ID is 0 and it contains "0." at the start of the text, then it is considered a menu item. If the item ID is 0 and it does not contain "0." at the start, then it is considered the title.

I am aware that this is a bit of a hack and only differentiates them implicitly. If the title happens to contain "0." at the start, then it will be considered a menu item, although this simply makes it use the smaller font and has no other negative effects. Since there is already an explicit 10th option that corresponds to "0.", I don't expect this to be a significant problem.

Perhaps there could be a more proper way to apply one font over the other in the future, although I don't see that being in the current scope of this feature.

@samisalreadytaken
Copy link
Copy Markdown

Using control characters (a la terminal escape codes) would be compatible with plugins (nobody would send non-printable characters) and open up the possibilities of any kind of customisation, not limited to text changes.

For example it could be "\x01" to denote title case, "\x1BB;" for bold text, "\x1BCRRGGBB;" to colour, etc..

@azzyr azzyr self-assigned this May 29, 2025
Copy link
Copy Markdown
Collaborator

@azzyr azzyr left a comment

Choose a reason for hiding this comment

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

This looks good to me after the refactor for INVALID_MENUITEM. This could potentially be improved in the future with support for pagination

@Blixibon Blixibon merged commit cdafc12 into mapbase-source:develop Jun 4, 2025
4 checks passed
@Blixibon Blixibon deleted the mapbase/feature/game-menu-entity branch June 4, 2025 13:05
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.

3 participants