Always allow typing replay search query, similar to addon search

This commit is contained in:
indev authored and Alug committed 2024-08-16 01:03:18 +02:00
1 parent 01e51767e7
commit bce621d647
1 file changed
+7 -21
+7 -21
View File
@@ -6761,7 +6761,6 @@ I_mutex replayquerymutex;
#define MAXREPLAYQUERY 40
char replayqueryinput[MAXREPLAYQUERY+1]; // The input typed
size_t replayquerypos = 0; // Position in input window
boolean replayqueryopen = false; // Is query window open?
size_t replayqueryfound = 0; // Number of checked replay entries
size_t replayquerycheck = 0; // Index of next replay entry to check in demolist_all
@@ -6821,7 +6820,6 @@ static void ResetReplayQuery(void)
{
memset(replayqueryinput, 0, MAXREPLAYQUERY);
replayquerypos = 0;
replayqueryopen = false;
replayqueryfound = 0;
replayquerycheck = 0;
@@ -6968,16 +6966,8 @@ void M_ReplayHut(INT32 choice)
static boolean M_HandleReplayHutQuery(INT32 choice)
{
if (!replayqueryopen)
return false;
switch (choice)
{
case KEY_ENTER:
case KEY_ESCAPE:
replayqueryopen = false;
break;
case KEY_BACKSPACE:
if (replayquerypos == 0)
break;
@@ -6991,7 +6981,7 @@ static boolean M_HandleReplayHutQuery(INT32 choice)
dir_on[menudepthleft] = 0;
PrepReplayList(false);
break;
return true;
default:
if (choice < 32 || choice > 127)
@@ -7009,9 +6999,11 @@ static boolean M_HandleReplayHutQuery(INT32 choice)
dir_on[menudepthleft] = 0;
PrepReplayList(false);
}
return true;
}
return true;
return false;
}
static void M_HandleReplayHutList(INT32 choice)
@@ -7021,12 +7013,6 @@ static void M_HandleReplayHutList(INT32 choice)
switch (choice)
{
case '/':
case 'f':
case 'F':
replayqueryopen = true;
break;
case KEY_UPARROW:
if (!replaynamesloaded)
return;
@@ -7445,13 +7431,13 @@ static void M_DrawReplayHut(void)
// Draw search query
M_DrawTextBoxFlags(x, 200 - 22, MAXREPLAYQUERY, 1, V_SNAPTOBOTTOM);
if (replayqueryopen || replayquerypos)
if (replayquerypos)
V_DrawString(x + 8, 200 - 14, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, replayqueryinput);
else
V_DrawString(x + 8, 200 - 14, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, "\x86Press '/' or 'f' to search replays");
V_DrawString(x + 8, 200 - 14, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, "\x86Type to search...");
// draw text cursor for name
if (replayqueryopen && skullAnimCounter < 4) // blink cursor
if (replayquerypos && skullAnimCounter < 4) // blink cursor
V_DrawCharacter(x + 8 + V_StringWidth(replayqueryinput, V_ALLOWLOWERCASE), 200 - 14, '_'|V_SNAPTOBOTTOM, false);
if (replaynamesloaded && replayquerycheck < sizedirmenu)