Added console-links support.
Shift click IPs/words/links on the console to enter them as arguments. Fixed some utf-8 issues. Fixed issue with csaddon.dat not loading in release builds. Fixed berkelium inputs, should have a full range of keys now, though there's still no 'back' support. Bad name rejection made more paranoid. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4124 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
fc2ab857f5
commit
5d9ba4b548
20 changed files with 866 additions and 179 deletions
|
@ -848,7 +848,7 @@ int Con_DrawInput (int left, int right, int y)
|
|||
text[key_linepos] = 0;
|
||||
cursor = COM_ParseFunString(CON_WHITEMASK, text, maskedtext, sizeof(maskedtext) - sizeof(maskedtext[0]), true);
|
||||
text[key_linepos] = i;
|
||||
endmtext = COM_ParseFunString(CON_WHITEMASK, text, maskedtext, sizeof(maskedtext) - sizeof(maskedtext[0]), true);
|
||||
endmtext = COM_ParseFunString(CON_WHITEMASK, text+key_linepos, cursor, ((char*)maskedtext)+sizeof(maskedtext) - (char*)(cursor+1), true);
|
||||
|
||||
endmtext[1] = 0;
|
||||
|
||||
|
@ -890,11 +890,11 @@ int Con_DrawInput (int left, int right, int y)
|
|||
#endif
|
||||
cursorframe = ((int)(realtime*con_cursorspeed)&1);
|
||||
|
||||
for (lhs = 0, i = key_linepos-1; i >= 0; i--)
|
||||
for (lhs = 0, i = cursor - maskedtext-1; i >= 0; i--)
|
||||
{
|
||||
lhs += Font_CharWidth(maskedtext[i]);
|
||||
}
|
||||
for (rhs = 0, i = key_linepos+1; maskedtext[i]; i++)
|
||||
for (rhs = 0, i = cursor - maskedtext; maskedtext[i]; i++)
|
||||
{
|
||||
rhs += Font_CharWidth(maskedtext[i]);
|
||||
}
|
||||
|
@ -1575,11 +1575,12 @@ void Con_DrawConsole (int lines, qboolean noback)
|
|||
|
||||
|
||||
|
||||
char *Con_CopyConsole(void)
|
||||
char *Con_CopyConsole(qboolean nomarkup)
|
||||
{
|
||||
conchar_t *cur;
|
||||
conline_t *l;
|
||||
conchar_t *lend;
|
||||
conchar_t col = CON_WHITEMASK;
|
||||
char *result;
|
||||
int outlen, maxlen;
|
||||
int finalendoffset;
|
||||
|
@ -1590,6 +1591,9 @@ char *Con_CopyConsole(void)
|
|||
maxlen = 1024*1024;
|
||||
result = Z_Malloc(maxlen+1);
|
||||
|
||||
// for (cur = (conchar_t*)(selstartline+1), finalendoffset = 0; cur < (conchar_t*)(selstartline+1) + selstartline->length; cur++, finalendoffset++)
|
||||
// result[finalendoffset] = *cur & 0xffff;
|
||||
|
||||
l = selstartline;
|
||||
cur = (conchar_t*)(l+1) + selstartoffset;
|
||||
finalendoffset = selendoffset;
|
||||
|
@ -1603,21 +1607,48 @@ char *Con_CopyConsole(void)
|
|||
while (cur > (conchar_t*)(l+1))
|
||||
{
|
||||
cur--;
|
||||
if ((*cur & 0xff) == ' ')
|
||||
if ((*cur & CON_CHARMASK) == ' ')
|
||||
{
|
||||
cur++;
|
||||
break;
|
||||
}
|
||||
if (*cur == CON_LINKSTART)
|
||||
break;
|
||||
}
|
||||
while (finalendoffset < selendline->length)
|
||||
{
|
||||
if ((((conchar_t*)(l+1))[finalendoffset] & 0xff) != ' ')
|
||||
if ((((conchar_t*)(l+1))[finalendoffset] & CON_CHARMASK) != ' ')
|
||||
finalendoffset++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//scan backwards to find any link enclosure
|
||||
for(lend = cur; lend >= (conchar_t*)(l+1); lend--)
|
||||
{
|
||||
if (*lend == CON_LINKSTART)
|
||||
{
|
||||
//found one
|
||||
cur = lend;
|
||||
break;
|
||||
}
|
||||
if (*lend == CON_LINKEND)
|
||||
{
|
||||
//some other link ended here. don't use its start.
|
||||
break;
|
||||
}
|
||||
}
|
||||
//scan forwards to find the end of the selected link
|
||||
for(lend = (conchar_t*)(selendline+1) + finalendoffset; lend < (conchar_t*)(selendline+1) + selendline->length; lend++)
|
||||
{
|
||||
if (*lend == CON_LINKEND)
|
||||
{
|
||||
finalendoffset = lend+1 - (conchar_t*)(selendline+1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
outlen = 0;
|
||||
for (;;)
|
||||
|
@ -1626,12 +1657,8 @@ char *Con_CopyConsole(void)
|
|||
lend = (conchar_t*)(l+1) + finalendoffset;
|
||||
else
|
||||
lend = (conchar_t*)(l+1) + l->length;
|
||||
while (cur < lend)
|
||||
{
|
||||
if (outlen == maxlen)
|
||||
break;
|
||||
result[outlen++] = *cur++;
|
||||
}
|
||||
|
||||
outlen = COM_DeFunString(cur, lend, result + outlen, maxlen - outlen, nomarkup) - result;
|
||||
|
||||
if (l == selendline)
|
||||
break;
|
||||
|
@ -1642,6 +1669,9 @@ char *Con_CopyConsole(void)
|
|||
Con_Printf("Error: Bad console buffer\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (outlen+3 > maxlen)
|
||||
break;
|
||||
#ifdef _WIN32
|
||||
result[outlen++] = '\r';
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue