diff --git a/src/console.c b/src/console.c index eaa98550..212e6c8d 100644 --- a/src/console.c +++ b/src/console.c @@ -1442,7 +1442,7 @@ static void CON_DrawHudlines(void) if (con_hudlines <= 0) return; - if (chat_on && (cv_consolechat.value || vid.width < 640)) + if (chat_on && OLDCHAT) y = charheight; // leave place for chat input in the first row of text else y = 0; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index dd0d61fe..338fd26c 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -388,6 +388,8 @@ static void HU_removeChatText_Log(void) void HU_AddChatText(const char *text) { + if (cv_chatnotifications.value) + S_StartSound(NULL, sfx_radio); // TODO: check if we're oversaturating the log (we can only log CHAT_BUFSIZE messages.) @@ -791,18 +793,12 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) } - if (cv_consolechat.value) - { + HU_AddChatText(va(fmt2, prefix, cstart, dispname, cend, msg)); // add it reguardless, in case we decide to change our mind about our chat type. + + if OLDCHAT CONS_Printf(fmt, prefix, cstart, dispname, cend, msg); - HU_AddChatText(va(fmt2, prefix, cstart, dispname, cend, msg)); // add it reguardless, in case we decide to change our mind about our chat type. - } else - { - HU_AddChatText(va(fmt2, prefix, cstart, dispname, cend, msg)); - CON_LogMessage(va(fmt, prefix, cstart, dispname, cend, msg)); // save to log.txt - if (cv_chatnotifications.value) - S_StartSound(NULL, sfx_radio); - } + CON_LogMessage(va(fmt, prefix, cstart, dispname, cend, msg)); // save to log.txt if (tempchar) Z_Free(tempchar); @@ -1956,19 +1952,17 @@ void HU_Drawer(void) // count down the scroll timer. if (chat_scrolltime > 0) chat_scrolltime--; - if (!cv_consolechat.value && vid.width > 320) // don't even try using newchat sub 400p, I'm too fucking lazy + if (!OLDCHAT) HU_DrawChat(); else HU_DrawChat_Old(); // why the fuck......................... } else { - if (!cv_consolechat.value) - { + chat_scrolltime = 0; // do scroll anyway. + typelines = 1; // make sure that the chat doesn't have a weird blinking huge ass square if we typed a lot last time. + if (!OLDCHAT) HU_drawMiniChat(); // draw messages in a cool fashion. - chat_scrolltime = 0; // do scroll anyway. - typelines = 1; // make sure that the chat doesn't have a weird blinking huge ass square if we typed a lot last time. - } } if (netgame) // would handle that in hu_drawminichat, but it's actually kinda awkward when you're typing a lot of messages. (only handle that in netgames duh) diff --git a/src/hu_stuff.h b/src/hu_stuff.h index b4a78338..90ffeb42 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -80,6 +80,8 @@ extern patch_t *iconprefix[MAXSKINS]; #define CHAT_BUFSIZE 64 // that's enough messages, right? We'll delete the older ones when that gets out of hand. +#define OLDCHAT (cv_consolechat.value || dedicated || vid.width < 640) + // some functions void HU_AddChatText(const char *text); diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 068ae204..e13c1b0d 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -21,6 +21,7 @@ #include "s_sound.h" #include "g_game.h" #include "hu_stuff.h" +#include "console.h" #include "k_kart.h" #include "lua_script.h" @@ -96,11 +97,14 @@ static int lib_chatprint(lua_State *L) int len = strlen(str); if (len > 255) // string is too long!!! return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer."); - - if (cv_consolechat.value || !netgame) + + HU_AddChatText(str); + + if OLDCHAT CONS_Printf("%s\n", str); else - HU_AddChatText(str); + CON_LogMessage(str); // save to log.txt + return 0; } @@ -124,11 +128,14 @@ static int lib_chatprintf(lua_State *L) int len = strlen(str); if (len > 255) // string is too long!!! return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer."); - - if (cv_consolechat.value || !netgame) + + HU_AddChatText(str); + + if OLDCHAT CONS_Printf("%s\n", str); else - HU_AddChatText(str); + CON_LogMessage(str); // save to log.txt + return 0; }