mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-29 20:50:38 +00:00
* Homogenise old chat mode detection, which includes cv_consolechat.value
, dedicated
, and vid.width < 640
.
* Make the chat notification sounds work in old chat mode.
This commit is contained in:
parent
ad119af07b
commit
b319c2d9b8
4 changed files with 26 additions and 23 deletions
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue