#endif
#include <time.h>
-float con_cursorspeed = 4;
+// for u8_encodech
+#include "ft2.h"
-#define CON_TEXTSIZE 1048576
-#define CON_MAXLINES 16384
+float con_cursorspeed = 4;
// lines up from bottom to display
int con_backscroll;
cvar_t con_textsize = {CVAR_SAVE, "con_textsize","8", "console text size in virtual 2D pixels"};
cvar_t con_notifysize = {CVAR_SAVE, "con_notifysize","8", "notify text size in virtual 2D pixels"};
cvar_t con_chatsize = {CVAR_SAVE, "con_chatsize","8", "chat text size in virtual 2D pixels (if con_chat is enabled)"};
+cvar_t con_chatsound = {CVAR_SAVE, "con_chatsound","1", "enables chat sound to play on message"};
cvar_t sys_specialcharactertranslation = {0, "sys_specialcharactertranslation", "1", "terminal console conchars to ASCII translation (set to 0 if your conchars.tga is for an 8bit character set or if you want raw output)"};
void ConBuffer_Init(conbuffer_t *buf, int textsize, int maxlines, mempool_t *mempool)
{
+ buf->active = true;
buf->textsize = textsize;
buf->text = (char *) Mem_Alloc(mempool, textsize);
buf->maxlines = maxlines;
*/
void ConBuffer_Shutdown(conbuffer_t *buf)
{
+ buf->active = false;
Mem_Free(buf->text);
Mem_Free(buf->lines);
buf->text = NULL;
char *putpos;
con_lineinfo_t *p;
+ // developer_memory 1 during shutdown prints while conbuffer_t is being freed
+ if (!buf->active)
+ return;
+
ConBuffer_FixTimes(buf);
if(len >= buf->textsize)
==============================================================================
*/
+/// \name Logging
+//@{
cvar_t log_file = {0, "log_file","", "filename to log messages to"};
cvar_t log_dest_udp = {0, "log_dest_udp","", "UDP address to log messages to (in QW rcon compatible format); multiple destinations can be separated by spaces; DO NOT SPECIFY DNS NAMES HERE"};
char log_dest_buffer[1400]; // UDP packet
size_t logq_size = 0;
void Log_ConPrint (const char *msg);
-
+//@}
/*
====================
Log_DestBuffer_Init
====================
*/
-static void Log_DestBuffer_Init()
+static void Log_DestBuffer_Init(void)
{
memcpy(log_dest_buffer, "\377\377\377\377n", 5); // QW rcon print
log_dest_buffer_pos = 5;
Log_DestBuffer_Flush
====================
*/
-void Log_DestBuffer_Flush()
+void Log_DestBuffer_Flush(void)
{
lhnetaddress_t log_dest_addr;
lhnetsocket_t *log_dest_socket;
/*
================
Con_ClearNotify
-
-Clear all notify lines.
================
*/
void Con_ClearNotify (void)
/*
================
Con_CheckResize
-
-If the line width has changed, reformat the buffer.
================
*/
void Con_CheckResize (void)
FS_Close(file);
}
-void Con_Clear_f ()
+void Con_Clear_f (void)
{
ConBuffer_Clear(&con);
}
Cvar_RegisterVariable (&con_notifysize);
Cvar_RegisterVariable (&con_notifytime);
Cvar_RegisterVariable (&con_textsize);
+ Cvar_RegisterVariable (&con_chatsound);
// --blub
Cvar_RegisterVariable (&con_nickcompletion);
}
}
-/* The translation table between the graphical font and plain ASCII --KB */
+/*! The translation table between the graphical font and plain ASCII --KB */
static char qfont_table[256] = {
'\0', '#', '#', '#', '#', '.', '#', '#',
'#', 9, 10, '#', ' ', 13, '.', '.',
rcon_redirect_bufferpos = 5;
}
-void Con_Rcon_Redirect_Flush()
+void Con_Rcon_Redirect_Flush(void)
{
rcon_redirect_buffer[rcon_redirect_bufferpos] = 0;
NetConn_WriteString(rcon_redirect_sock, rcon_redirect_buffer, rcon_redirect_dest);
rcon_redirect_bufferpos = 5;
}
-void Con_Rcon_Redirect_End()
+void Con_Rcon_Redirect_End(void)
{
Con_Rcon_Redirect_Flush();
rcon_redirect_dest = NULL;
rcon_redirect_sock = NULL;
}
-void Con_Rcon_Redirect_Abort()
+void Con_Rcon_Redirect_Abort(void)
{
rcon_redirect_dest = NULL;
rcon_redirect_sock = NULL;
/*
================
Con_Rcon_AddChar
-
-Adds a character to the rcon buffer
================
*/
+/// Adds a character to the rcon buffer.
void Con_Rcon_AddChar(int c)
{
if(log_dest_buffer_appending)
/*
================
Con_Print
-
-Prints to all appropriate console targets, and adds timestamps
================
*/
extern cvar_t timestamps;
// play talk wav
if (*msg == 1)
{
- if(gamemode == GAME_NEXUIZ)
+ if (con_chatsound.value)
{
- if(msg[1] == '\r' && cl.foundtalk2wav)
- S_LocalSound ("sound/misc/talk2.wav");
- else
- S_LocalSound ("sound/misc/talk.wav");
- }
- else
- {
- if (msg[1] == '(' && cl.foundtalk2wav)
- S_LocalSound ("sound/misc/talk2.wav");
+ if(gamemode == GAME_NEXUIZ)
+ {
+ if(msg[1] == '\r' && cl.foundtalk2wav)
+ S_LocalSound ("sound/misc/talk2.wav");
+ else
+ S_LocalSound ("sound/misc/talk.wav");
+ }
else
- S_LocalSound ("sound/misc/talk.wav");
+ {
+ if (msg[1] == '(' && cl.foundtalk2wav)
+ S_LocalSound ("sound/misc/talk2.wav");
+ else
+ S_LocalSound ("sound/misc/talk.wav");
+ }
}
mask = CON_MASK_CHAT;
}
/*
================
Con_Printf
-
-Prints to all appropriate console targets
================
*/
void Con_Printf(const char *fmt, ...)
/*
================
Con_DPrint
-
-A Con_Print that only shows up if the "developer" cvar is set
================
*/
void Con_DPrint(const char *msg)
/*
================
Con_DPrintf
-
-A Con_Printf that only shows up if the "developer" cvar is set
================
*/
void Con_DPrintf(const char *fmt, ...)
// add the cursor frame
if ((int)(realtime*con_cursorspeed) & 1) // cursor is visible
- text[key_linepos] = 11 + 130 * key_insert; // either solid or triangle facing right
+ {
+ if (!utf8_enable.integer)
+ text[key_linepos] = 11 + 130 * key_insert; // either solid or triangle facing right
+ else if (y + 3 < (int)sizeof(editlinecopy)-1)
+ {
+ int ofs = u8_bytelen(text + key_linepos, 1);
+ size_t len;
+ const char *curbuf;
+ curbuf = u8_encodech(0xE000 + 11 + 130 * key_insert, &len);
+
+ if (curbuf)
+ {
+ memmove(text + key_linepos + len, text + key_linepos + ofs, sizeof(editlinecopy) - key_linepos - len);
+ memcpy(text + key_linepos, curbuf, len);
+ }
+ } else
+ text[key_linepos] = '-' + ('+' - '-') * key_insert;
+ }
// text[key_linepos + 1] = 0;
ti->colorindex = -1;
return ti->fontsize * ti->font->maxwidth;
}
+ /*
if(maxWidth >= 0)
return DrawQ_TextWidth_Font_UntilWidth(w, length, false, ti->font, maxWidth / ti->fontsize) * ti->fontsize;
else if(maxWidth == -1)
return DrawQ_TextWidth_Font(w, *length, false, ti->font) * ti->fontsize;
+ */
+ if(maxWidth >= 0)
+ return DrawQ_TextWidth_Font_UntilWidth_Size(w, ti->fontsize, ti->fontsize, length, false, ti->font, maxWidth);
+ else if(maxWidth == -1)
+ return DrawQ_TextWidth_Font_Size(w, ti->fontsize, ti->fontsize, *length, false, ti->font);
else
{
printf("Con_WordWidthFunc: can't get here (maxWidth should never be %f)\n", maxWidth);
if(numChatlines)
{
v = chatstart + numChatlines * con_chatsize.value;
- Con_DrawNotifyRect(CON_MASK_CHAT, CON_MASK_INPUT, con_chattime.value, 0, chatstart, vid_conwidth.value * con_chatwidth.value, v - chatstart, con_chatsize.value, 0.0, 1.0, "^3\014\014\014 "); // 015 is ·> character in conchars.tga
+ Con_DrawNotifyRect(CON_MASK_CHAT, CON_MASK_INPUT, con_chattime.value, 0, chatstart, vid_conwidth.value * con_chatwidth.value, v - chatstart, con_chatsize.value, 0.0, 1.0, /*"^3\014\014\014 "*/ "^3\xee\x80\x8d\xee\x80\x8d\xee\x80\x8d "); // 015 is ·> character in conchars.tga
}
if (key_dest == key_message)
{
+ //static char *cursor[2] = { "\xee\x80\x8a", "\xee\x80\x8b" }; // { off, on }
int colorindex = -1;
+ const char *cursor;
+ cursor = u8_encodech(0xE00A + ((int)(realtime * con_cursorspeed)&1), NULL);
// LordHavoc: speedup, and other improvements
if (chat_mode < 0)
- dpsnprintf(temptext, sizeof(temptext), "]%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1));
+ dpsnprintf(temptext, sizeof(temptext), "]%s%s", chat_buffer, cursor);
else if(chat_mode)
- dpsnprintf(temptext, sizeof(temptext), "say_team:%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1));
+ dpsnprintf(temptext, sizeof(temptext), "say_team:%s%s", chat_buffer, cursor);
else
- dpsnprintf(temptext, sizeof(temptext), "say:%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1));
+ dpsnprintf(temptext, sizeof(temptext), "say:%s%s", chat_buffer, cursor);
// FIXME word wrap
inputsize = (numChatlines ? con_chatsize : con_notifysize).value;