qfile_t *historyfile;
ConBuffer_Init(&history, HIST_TEXTSIZE, HIST_MAXLINES, zonemempool);
+// not necessary for mobile
+#ifndef DP_MOBILETOUCH
historyfile = FS_OpenRealFile("darkplaces_history.txt", "rb", false); // rb to handle unix line endings on windows too
if(historyfile)
{
FS_Close(historyfile);
}
+#endif
history_line = -1;
}
{
// TODO write history to a file
+// not necessary for mobile
+#ifndef DP_MOBILETOUCH
qfile_t *historyfile = FS_OpenRealFile("darkplaces_history.txt", "w", false);
if(historyfile)
{
FS_Printf(historyfile, "%s\n", ConBuffer_GetLine(&history, i));
FS_Close(historyfile);
}
+#endif
ConBuffer_Shutdown(&history);
}
if(key_line[1]) // empty?
if(strcmp(key_line, "]quit")) // putting these into the history just sucks
if(strncmp(key_line, "]quit ", 6)) // putting these into the history just sucks
- ConBuffer_AddLine(&history, key_line + 1, strlen(key_line) - 1, 0);
+ if(strcmp(key_line, "]rcon_password")) // putting these into the history just sucks
+ if(strncmp(key_line, "]rcon_password ", 15)) // putting these into the history just sucks
+ ConBuffer_AddLine(&history, key_line + 1, (int)strlen(key_line) - 1, 0);
Con_Printf("%s\n", key_line); // don't mark empty lines as history
history_line = -1;
if (history_matchfound)
if (!history_matchfound)
return false;
strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
- key_linepos = strlen(key_line);
+ key_linepos = (int)strlen(key_line);
history_matchfound = false;
return true;
}
if(history_line != -1)
{
strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
- key_linepos = strlen(key_line);
+ key_linepos = (int)strlen(key_line);
}
}
else if(history_line > 0)
{
--history_line; // this also does -1 -> 0, so it is good
strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
- key_linepos = strlen(key_line);
+ key_linepos = (int)strlen(key_line);
}
}
strlcpy(key_line + 1, history_savedline, sizeof(key_line) - 1);
}
- key_linepos = strlen(key_line);
+ key_linepos = (int)strlen(key_line);
}
static void Key_History_First(void)
{
history_line = 0;
strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
- key_linepos = strlen(key_line);
+ key_linepos = (int)strlen(key_line);
}
}
{
history_line = CONBUFFER_LINES_COUNT(&history) - 1;
strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
- key_linepos = strlen(key_line);
+ key_linepos = (int)strlen(key_line);
}
}
// save the content of the variable in cvar_str
cvar_str = Cvar_VariableString(cvar);
- cvar_str_len = strlen(cvar_str);
+ cvar_str_len = (int)strlen(cvar_str);
if (cvar_str_len==0)
return;
// insert space and cvar_str in key_line
- chars_to_move = strlen(&key_line[key_linepos]);
+ chars_to_move = (int)strlen(&key_line[key_linepos]);
if (key_linepos + 1 + cvar_str_len + chars_to_move < MAX_INPUTLINE)
{
if (chars_to_move)
{
int pos;
size_t inchar = 0;
- pos = u8_prevbyte(key_line+1, key_linepos-1) + 1; // do NOT give the ']' to u8_prevbyte
+ pos = (int)u8_prevbyte(key_line+1, key_linepos-1) + 1; // do NOT give the ']' to u8_prevbyte
while (pos)
if(pos-1 > 0 && key_line[pos-1] == STRING_COLOR_TAG && isdigit(key_line[pos]))
pos-=2;
}
// we need to move to the beginning of the character when in a wide character:
u8_charidx(key_line, pos + 1, &inchar);
- key_linepos = pos + 1 - inchar;
+ key_linepos = (int)(pos + 1 - inchar);
}
else
{
- key_linepos = u8_prevbyte(key_line+1, key_linepos-1) + 1; // do NOT give the ']' to u8_prevbyte
+ key_linepos = (int)u8_prevbyte(key_line+1, key_linepos-1) + 1; // do NOT give the ']' to u8_prevbyte
}
return;
}
{
if (key_linepos > 1)
{
- int newpos = u8_prevbyte(key_line+1, key_linepos-1) + 1; // do NOT give the ']' to u8_prevbyte
+ int newpos = (int)u8_prevbyte(key_line+1, key_linepos-1) + 1; // do NOT give the ']' to u8_prevbyte
strlcpy(key_line + newpos, key_line + key_linepos, sizeof(key_line) + 1 - key_linepos);
key_linepos = newpos;
}
// skip the char
if (key_line[pos] == STRING_COLOR_TAG && key_line[pos+1] == STRING_COLOR_TAG) // consider ^^ as a character
pos++;
- pos += u8_bytelen(key_line + pos, 1);
+ pos += (int)u8_bytelen(key_line + pos, 1);
// now go beyond all next consecutive color tags, if any
if(pos < len)
key_linepos = pos;
}
else
- key_linepos += u8_bytelen(key_line + key_linepos, 1);
+ key_linepos += (int)u8_bytelen(key_line + key_linepos, 1);
return;
}
if (key == K_BACKSPACE) {
if (chat_bufferlen) {
- chat_bufferlen = u8_prevbyte(chat_buffer, chat_bufferlen);
+ chat_bufferlen = (unsigned int)u8_prevbyte(chat_buffer, chat_bufferlen);
chat_buffer[chat_bufferlen] = 0;
}
return;
return;
}
- if (ascii == 0x80 && utf8_enable.integer) // pressing AltGr-5 (or AltGr-e) and for some reason we get windows-1252 encoding?
- ascii = 0x20AC; // we want the Euro currency sign
- // TODO find out which vid_ drivers do it and fix it there
- // but catching U+0080 here is no loss as that char is not useful anyway
-
// get key binding
bind = keybindings[key_bmap][key];
if (!bind)
if(key_consoleactive)
keydest = key_console;
-
+
if (down)
{
// increment key repeat count each time a down is received so that things
if(keydest == key_void)
return;
-
+
// key_consoleactive is a flag not a key_dest because the console is a
// high priority overlay ontop of the normal screen (designed as a safety
// feature so that developers and users can rescue themselves from a bad
if(key_consoleactive & KEY_CONSOLEACTIVE_FORCED)
{
key_consoleactive &= ~KEY_CONSOLEACTIVE_USER;
+#ifdef CONFIG_MENU
MR_ToggleMenu(1);
+#endif
}
else
Con_ToggleConsole_f();
case key_menu:
case key_menu_grabbed:
+#ifdef CONFIG_MENU
MR_KeyEvent (key, ascii, down);
+#endif
break;
case key_game:
// csqc has priority over toggle menu if it wants to (e.g. handling escape for UI stuff in-game.. :sick:)
q = CL_VM_InputEvent(down ? 0 : 1, key, ascii);
+#ifdef CONFIG_MENU
if (!q && down)
MR_ToggleMenu(1);
+#endif
break;
default:
if (cl_videoplaying)
{
if (gamemode == GAME_BLOODOMNICIDE) // menu controls key events
+#ifdef CONFIG_MENU
MR_KeyEvent(key, ascii, down);
+#else
+ {
+ }
+#endif
else
CL_Video_KeyEvent (key, ascii, keydown[key] != 0);
return;
break;
case key_menu:
case key_menu_grabbed:
+#ifdef CONFIG_MENU
MR_KeyEvent (key, ascii, down);
+#endif
break;
case key_game:
q = CL_VM_InputEvent(down ? 0 : 1, key, ascii);