Skip to content

Commit 2a5fddf

Browse files
committed
2 parents 7122e19 + 0bd9873 commit 2a5fddf

File tree

6 files changed

+66
-17
lines changed

6 files changed

+66
-17
lines changed

TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,12 @@ namespace TFE_FrontEndUI
12071207
gameSettings->df_showSecretFoundMsg = showSecretMsg;
12081208
}
12091209

1210+
bool showKeysUsed = gameSettings->df_showKeyUsed;
1211+
if (ImGui::Checkbox("Show Key Used messages", &showKeysUsed))
1212+
{
1213+
gameSettings->df_showKeyUsed = showKeysUsed;
1214+
}
1215+
12101216
bool autorun = gameSettings->df_autorun;
12111217
if (ImGui::Checkbox("Autorun", &autorun))
12121218
{

TheForceEngine/TFE_Jedi/InfSystem/infSystem.cpp

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <TFE_System/system.h>
2424
#include <TFE_System/memoryPool.h>
2525
#include <TFE_System/math.h>
26+
#include <TFE_System/tfeMessage.h>
2627
#include <TFE_Jedi/Level/rtexture.h>
2728
#include <TFE_Jedi/Task/task.h>
2829
// TODO: This will make adding Outlaws harder, fix the abstraction.
@@ -2791,26 +2792,54 @@ namespace TFE_Jedi
27912792

27922793
// Does the player have the key?
27932794
KeyItem key = elev->key;
2794-
if (key == KEY_RED && !s_playerInfo.itemRedKey)
2795+
char keyBuffer[50];
2796+
char keyBufferWrapper[50];
2797+
snprintf(keyBufferWrapper, 50, "%s", TFE_System::getMessage(TFE_MSG_KEY));
2798+
2799+
if (key == KEY_RED)
27952800
{
2796-
// "You need the red key."
2797-
hud_sendTextMessage(6);
2798-
sound_play(s_needKeySoundId);
2799-
return;
2801+
if (TFE_Settings::getGameSettings()->df_showKeyUsed && s_playerInfo.itemRedKey)
2802+
{
2803+
sprintf(keyBuffer, keyBufferWrapper, TFE_System::getMessage(TFE_MSG_RED));
2804+
TFE_DarkForces::hud_sendTextMessage(keyBuffer, 1, false);
2805+
}
2806+
else if (!s_playerInfo.itemRedKey)
2807+
{
2808+
// "You need the red key."
2809+
hud_sendTextMessage(6);
2810+
sound_play(s_needKeySoundId);
2811+
return;
2812+
}
28002813
}
2801-
else if (key == KEY_YELLOW && !s_playerInfo.itemYellowKey)
2814+
else if (key == KEY_YELLOW)
28022815
{
2803-
// "You need the yellow key."
2804-
hud_sendTextMessage(7);
2805-
sound_play(s_needKeySoundId);
2806-
return;
2816+
if (TFE_Settings::getGameSettings()->df_showKeyUsed && s_playerInfo.itemYellowKey)
2817+
{
2818+
sprintf(keyBuffer, keyBufferWrapper, TFE_System::getMessage(TFE_MSG_YELLOW));
2819+
TFE_DarkForces::hud_sendTextMessage(keyBuffer, 1, false);
2820+
}
2821+
else if (!s_playerInfo.itemYellowKey)
2822+
{
2823+
// "You need the yellow key."
2824+
hud_sendTextMessage(7);
2825+
sound_play(s_needKeySoundId);
2826+
return;
2827+
}
28072828
}
2808-
else if (key == KEY_BLUE && !s_playerInfo.itemBlueKey)
2829+
else if (key == KEY_BLUE)
28092830
{
2810-
// "You need the blue key."
2811-
hud_sendTextMessage(8);
2812-
sound_play(s_needKeySoundId);
2813-
return;
2831+
if (TFE_Settings::getGameSettings()->df_showKeyUsed && s_playerInfo.itemBlueKey)
2832+
{
2833+
sprintf(keyBuffer, keyBufferWrapper, TFE_System::getMessage(TFE_MSG_BLUE));
2834+
TFE_DarkForces::hud_sendTextMessage(keyBuffer, 1, false);
2835+
}
2836+
else if (!s_playerInfo.itemBlueKey)
2837+
{
2838+
// "You need the blue key."
2839+
hud_sendTextMessage(8);
2840+
sound_play(s_needKeySoundId);
2841+
return;
2842+
}
28142843
}
28152844
}
28162845

TheForceEngine/TFE_Settings/settings.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,7 @@ namespace TFE_Settings
575575
writeKeyValue_Bool(settings, "df_enableRecordingAll", s_gameSettings.df_enableRecordingAll);
576576
writeKeyValue_Bool(settings, "df_demologging", s_gameSettings.df_demologging);
577577
writeKeyValue_Bool(settings, "df_autoNextMission", s_gameSettings.df_autoEndMission);
578+
writeKeyValue_Bool(settings, "df_showKeyUsed", s_gameSettings.df_showKeyUsed);
578579
writeKeyValue_Bool(settings, "df_showKeyColors", s_gameSettings.df_showKeyColors);
579580
}
580581

@@ -1237,6 +1238,10 @@ namespace TFE_Settings
12371238
{
12381239
s_gameSettings.df_autoEndMission = parseBool(value);
12391240
}
1241+
else if (strcasecmp("df_showKeyUsed", key) == 0)
1242+
{
1243+
s_gameSettings.df_showKeyUsed = parseBool(value);
1244+
}
12401245
else if (strcasecmp("df_showKeyColors", key) == 0)
12411246
{
12421247
s_gameSettings.df_showKeyColors = parseBool(value);

TheForceEngine/TFE_Settings/settings.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,10 @@ struct TFE_Settings_Game
228228
bool df_showReplayCounter = false; // Show the replay counter on the HUD.
229229
bool df_demologging = false; // Log the record/playback logging
230230
bool df_autoEndMission = false; // Automatically skip to the next mission
231-
bool df_showKeyColors = false; // Shows the door key color on the minimap
231+
bool df_showKeyColors = false; // Shows the door key color on the minimap
232232
s32 df_recordFrameRate = 4; // Recording Framerate value
233233
s32 df_playbackFrameRate = 2; // Playback Framerate value
234+
bool df_showKeyUsed = true; // Show a message when a key is used.
234235
PitchLimit df_pitchLimit = PITCH_VANILLA_PLUS;
235236
};
236237

TheForceEngine/TFE_System/tfeMessage.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ enum TFE_Message
2323
TFE_MSG_HARDCORE,
2424
TFE_MSG_FULLBRIGHT,
2525
TFE_MSG_HD,
26+
TFE_MSG_RED,
27+
TFE_MSG_BLUE,
28+
TFE_MSG_YELLOW,
29+
TFE_MSG_KEY,
2630
TFE_MSG_COUNT
2731
};
2832

TheForceEngine/UI_Text/TfeMessages.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@
1111
"One-Hit Kill Toggle." // TFE_MSG_ONEHITKILL
1212
"Hardcore Mode Toggle." // TFE_MSG_HARDCORE
1313
"Full-Bright Toggle." // TFE_MSG_FULLBRIGHT
14-
"HD Assets Toggle." // TFE_MSG_HD
14+
"HD Assets Toggle." // TFE_MSG_HD
15+
"Red" // TFE_MSG_RED
16+
"Blue" // TFE_MSG_BLUE
17+
"Yellow" // TFE_MSG_YELLOW
18+
"Using the %s key" // TFE_MSG_KEY

0 commit comments

Comments
 (0)