mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-27 07:51:36 +00:00
"Use Button Names" option
This commit is contained in:
parent
4bc2c576f0
commit
8c51bc235d
4 changed files with 29 additions and 6 deletions
|
|
@ -334,6 +334,8 @@ consvar_t cv_soundvolume = Player("soundvolume", "80").min_max(0, 100);
|
|||
consvar_t cv_discordstreamer = Player("discordstreamer", "Off").on_off();
|
||||
#endif
|
||||
|
||||
consvar_t cv_descriptiveinput = Player("descriptiveinput", "Yes").yes_no(); // Display bound controls instead of Saturn buttons
|
||||
|
||||
consvar_t cv_drawdist = Player("drawdist", "Normal").values({
|
||||
{3072, "Shortest"},
|
||||
{4096, "Shorter"},
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
#include "../r_main.h" // cv_showhud
|
||||
#include "../v_video.h" // cv_constextsize
|
||||
|
||||
extern consvar_t cv_descriptiveinput;
|
||||
|
||||
menuitem_t OPTIONS_HUD[] =
|
||||
{
|
||||
|
||||
|
|
@ -37,6 +39,12 @@ menuitem_t OPTIONS_HUD[] =
|
|||
{IT_SPACE | IT_NOTHING, NULL, NULL,
|
||||
NULL, {NULL}, 0, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, "Use Button Names", "Show button/key names in help text? When off, show Saturn buttons.",
|
||||
NULL, {.cvar = &cv_descriptiveinput}, 0, 0},
|
||||
|
||||
{IT_SPACE | IT_NOTHING, NULL, NULL,
|
||||
NULL, {NULL}, 0, 0},
|
||||
|
||||
{IT_STRING | IT_SUBMENU, "Online Chat Options...", "Visual options for the online chat box.",
|
||||
NULL, {.submenu = &OPTIONS_HUDOnlineDef}, 0, 0},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "w_wad.h"
|
||||
#include "z_zone.h"
|
||||
#include "k_profiles.h" // controls
|
||||
#include "p_local.h" // stplyr
|
||||
|
||||
using srb2::Draw;
|
||||
using Chain = Draw::Chain;
|
||||
|
|
@ -131,14 +132,24 @@ Draw::TextElement& Draw::TextElement::parse(std::string_view raw)
|
|||
|
||||
if (auto it = translation.find(code); it != translation.end())
|
||||
{
|
||||
if (auto id = inputdefinition.find(it->second & (~0xF0)); it != translation.end())
|
||||
if (cv_descriptiveinput.value) // Does this char represent a game control?
|
||||
{
|
||||
profile_t *ourProfile = PR_GetProfile(cv_lastprofile[0].value);
|
||||
string_.append("\x88");
|
||||
string_.append(G_KeynumToString(ourProfile->controls[id->second][0]));
|
||||
string_.append("\x80");
|
||||
if (auto id = inputdefinition.find(it->second & (~0xF0)); it != translation.end()) // This is a game control, do descriptive input translation!
|
||||
{
|
||||
profile_t *ourProfile = PR_GetPlayerProfile(stplyr); // FIXME: Doesn't work, stplyr is always 0 here!
|
||||
if (ourProfile == NULL)
|
||||
ourProfile = PR_GetLocalPlayerProfile(0);
|
||||
|
||||
string_.append("\x88");
|
||||
string_.append(G_KeynumToString(ourProfile->controls[id->second][0]));
|
||||
string_.append("\x80");
|
||||
}
|
||||
else // This is a color code or some other generic glyph, treat it as is.
|
||||
{
|
||||
string_.push_back(it->second); // replace with character code
|
||||
}
|
||||
}
|
||||
else
|
||||
else // We don't care whether this is a generic glyph, because input translation isn't on.
|
||||
{
|
||||
string_.push_back(it->second); // replace with character code
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
#include "typedef.h"
|
||||
#include "v_video.h"
|
||||
|
||||
extern consvar_t cv_descriptiveinput;
|
||||
|
||||
namespace srb2
|
||||
{
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue