Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/lang.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,14 @@ enum StringID {

#define STR_SCALE "25", "50", "75", "100"

const char *helpText =
static char helpText[1024];
const char *helpTextFormat =
"Start - add second player or restore Lara@"
"H - Show or hide this help@"
"ALT and ENTER - Fullscreen@"
"5 - Save Game@"
"9 - Load Game@"
"C - Look@"
"%s - Look@"
"R - Slow motion@"
"T - Fast motion@"
"Roll - Up & Down@"
Expand All @@ -310,6 +311,20 @@ const char *helpText =
"DOZY on - Look & Duck & Action & Jump@"
"DOZY off - Walk@"
"Free Camera - hold L & R stick";
inline const char* getKeyName(InputKey key) {
static const char* keyNames[] = {
STR_KEYS
};
if ((int)key >= 0 && (int)key < COUNT(keyNames))
return keyNames[(int)key];
return "UNKNOWN";
}

inline void updateHelpText() {
InputKey lookKey = (InputKey)Core::settings.controls[0].keys[cLook].key;
const char* keyName = getKeyName(lookKey);
sprintf(helpText, helpTextFormat, keyName);
}

#include "lang/en.h"
#include "lang/fr.h"
Expand Down
4 changes: 3 additions & 1 deletion src/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ namespace UI {

void init(IGame *game) {
ensureLanguage(Core::settings.audio.language);
updateHelpText();
UI::game = game;
showHelp = false;
helpTipTime = 5.0f;
Expand Down Expand Up @@ -635,6 +636,7 @@ namespace UI {
if (Input::down[ikH]) {
Input::down[ikH] = false;
showHelp = !showHelp;
updateHelpText();
helpTipTime = 0.0f;
}
if (helpTipTime > 0.0f)
Expand Down Expand Up @@ -726,7 +728,7 @@ namespace UI {

#if defined(_OS_WEB) || defined(_OS_WIN) || defined(_OS_LINUX) || defined(_OS_MAC) || defined(_OS_RPI)
if (showHelp) {
textOut(vec2(32, 32), STR_HELP_TEXT, aLeft, width - 32, 255, UI::SHADE_GRAY);
textOut(vec2(32, 32), helpText, aLeft, width - 32, 255, UI::SHADE_GRAY);
} else {
if (helpTipTime > 0.0f) {
textOut(vec2(0, height - 16), STR_HELP_PRESS, aCenter, width, 255, UI::SHADE_ORANGE);
Expand Down