#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;
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)
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;
FS_Close(file);
}
-void Con_Clear_f ()
+void Con_Clear_f (void)
{
ConBuffer_Clear(&con);
}
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;
// 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;
return ti->fontsize * ti->font->maxwidth;
}
if(maxWidth >= 0)
- return DrawQ_TextWidth_Font_UntilWidth(w, length, false, ti->font, maxWidth / ti->fontsize) * ti->fontsize;
+ return DrawQ_TextWidth_Font_UntilWidth_Size(w, ti->fontsize, ti->fontsize, length, false, ti->font, -maxWidth); // -maxWidth: we want at least one char
else if(maxWidth == -1)
- return DrawQ_TextWidth_Font(w, *length, false, ti->font) * ti->fontsize;
+ 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, (utf8_enable.integer ? "^3\xee\x80\x8c\xee\x80\x8c\xee\x80\x8c " : "^3\014\014\014 ")); // 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;