* Get chat to compile with errormode on.

* Add chat options to the HUD and Sound Option menus.
This commit is contained in:
toaster 2018-08-02 23:52:07 +01:00
parent 9109bb1ee7
commit ad119af07b
5 changed files with 254 additions and 244 deletions

View File

@ -422,6 +422,7 @@ consvar_t cv_chatnotifications= {"chatnotifications", "On", CV_SAVE, CV_OnOff, N
consvar_t cv_chatspamprotection = {"chatspamprotection", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_chatspamprotection = {"chatspamprotection", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// old shit console chat. (mostly exists for stuff like terminal, not because I cared if anyone liked the old chat.) // old shit console chat. (mostly exists for stuff like terminal, not because I cared if anyone liked the old chat.)
//static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Box"}, {1, "Console"}, {0, NULL}}; -- for menu, but menu disabled...
consvar_t cv_consolechat = {"consolechat", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_consolechat = {"consolechat", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_crosshair = {"crosshair", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_crosshair = {"crosshair", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};

View File

@ -76,7 +76,7 @@ patch_t *cred_font[CRED_FONTSIZE];
static player_t *plr; static player_t *plr;
boolean chat_on; // entering a chat message? boolean chat_on; // entering a chat message?
static char w_chat[HU_MAXMSGLEN]; static char w_chat[HU_MAXMSGLEN];
static INT32 c_input = 0; // let's try to make the chat input less shitty. static UINT32 c_input = 0; // let's try to make the chat input less shitty.
static boolean headsupactive = false; static boolean headsupactive = false;
boolean hu_showscores; // draw rankings boolean hu_showscores; // draw rankings
static char hu_tick; static char hu_tick;
@ -345,7 +345,7 @@ static UINT32 chat_nummsg_min = 0;
static UINT32 chat_scroll = 0; static UINT32 chat_scroll = 0;
static tic_t chat_scrolltime = 0; static tic_t chat_scrolltime = 0;
static INT32 chat_maxscroll = 0; // how far can we scroll? static UINT32 chat_maxscroll = 0; // how far can we scroll?
//static chatmsg_t chat_mini[CHAT_BUFSIZE]; // Display the last few messages sent. //static chatmsg_t chat_mini[CHAT_BUFSIZE]; // Display the last few messages sent.
//static chatmsg_t chat_log[CHAT_BUFSIZE]; // Keep every message sent to us in memory so we can scroll n shit, it's cool. //static chatmsg_t chat_log[CHAT_BUFSIZE]; // Keep every message sent to us in memory so we can scroll n shit, it's cool.
@ -363,7 +363,7 @@ static INT16 addy = 0; // use this to make the messages scroll smoothly when one
static void HU_removeChatText_Mini(void) static void HU_removeChatText_Mini(void)
{ {
// MPC: Don't create new arrays, just iterate through an existing one // MPC: Don't create new arrays, just iterate through an existing one
int i; UINT32 i;
for(i=0;i<chat_nummsg_min-1;i++) { for(i=0;i<chat_nummsg_min-1;i++) {
strcpy(chat_mini[i], chat_mini[i+1]); strcpy(chat_mini[i], chat_mini[i+1]);
chat_timers[i] = chat_timers[i+1]; chat_timers[i] = chat_timers[i+1];
@ -379,7 +379,7 @@ static void HU_removeChatText_Mini(void)
static void HU_removeChatText_Log(void) static void HU_removeChatText_Log(void)
{ {
// MPC: Don't create new arrays, just iterate through an existing one // MPC: Don't create new arrays, just iterate through an existing one
int i; UINT32 i;
for(i=0;i<chat_nummsg_log-1;i++) { for(i=0;i<chat_nummsg_log-1;i++) {
strcpy(chat_log[i], chat_log[i+1]); strcpy(chat_log[i], chat_log[i+1]);
} }
@ -502,7 +502,7 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
} }
buf[0] = target; buf[0] = target;
const char *newmsg = msg+5+spc; const char *newmsg = msg+5+spc;
memcpy(msg, newmsg, 255); memcpy(msg, newmsg, 252);
} }
SendNetXCmd(XD_SAY, buf, strlen(msg) + 1 + msg-buf); SendNetXCmd(XD_SAY, buf, strlen(msg) + 1 + msg-buf);
@ -839,7 +839,7 @@ static inline boolean HU_keyInChatString(char *s, char ch)
{ {
// move everything past c_input for new characters: // move everything past c_input for new characters:
INT32 m = HU_MAXMSGLEN-1; UINT32 m = HU_MAXMSGLEN-1;
for (;(m>=c_input);m--) for (;(m>=c_input);m--)
{ {
if (s[m]) if (s[m])
@ -901,7 +901,7 @@ static boolean teamtalk = false;
// //
// //
static void HU_queueChatChar(char c) static void HU_queueChatChar(INT32 c)
{ {
// send automaticly the message (no more chat char) // send automaticly the message (no more chat char)
if (c == KEY_ENTER) if (c == KEY_ENTER)
@ -1013,7 +1013,7 @@ static boolean justscrolledup;
// //
boolean HU_Responder(event_t *ev) boolean HU_Responder(event_t *ev)
{ {
UINT8 c=0; INT32 c=0;
if (ev->type != ev_keydown) if (ev->type != ev_keydown)
return false; return false;
@ -1057,7 +1057,7 @@ boolean HU_Responder(event_t *ev)
|| ev->data1 == KEY_LALT || ev->data1 == KEY_RALT) || ev->data1 == KEY_LALT || ev->data1 == KEY_RALT)
return true; return true;
c = (UINT8)ev->data1; c = (INT32)ev->data1;
// capslock // capslock
if (c && c == KEY_CAPSLOCK) // it's a toggle. if (c && c == KEY_CAPSLOCK) // it's a toggle.
@ -1187,7 +1187,7 @@ static UINT8 *CHAT_GetStringColormap(INT32 colorflags) // pasted from video.c, s
// This is a muuuch better method than V_WORDWRAP. // This is a muuuch better method than V_WORDWRAP.
// again stolen and modified a bit from video.c, don't mind me, will need to rearrange this one day. // again stolen and modified a bit from video.c, don't mind me, will need to rearrange this one day.
// this one is simplified for the chat drawer. // this one is simplified for the chat drawer.
char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string) static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
{ {
int c; int c;
size_t chw, i, lastusablespace = 0; size_t chw, i, lastusablespace = 0;
@ -1247,11 +1247,9 @@ INT16 chatx = 13, chaty = 169; // let's use this as our coordinates, shh
static void HU_drawMiniChat(void) static void HU_drawMiniChat(void)
{ {
if (!chat_nummsg_min) if (!chat_nummsg_min)
return; // needless to say it's useless to do anything if we don't have anything to draw. return; // needless to say it's useless to do anything if we don't have anything to draw.
INT32 x = chatx+2; INT32 x = chatx+2;
INT32 charwidth = 4, charheight = 6; INT32 charwidth = 4, charheight = 6;
INT32 dx = 0, dy = 0; INT32 dx = 0, dy = 0;
@ -1309,7 +1307,6 @@ static void HU_drawMiniChat(void)
for (; i<=(chat_nummsg_min-1); i++) // iterate through our hot messages for (; i<=(chat_nummsg_min-1); i++) // iterate through our hot messages
{ {
INT32 clrflag = 0; INT32 clrflag = 0;
INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below... INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below...
INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one. INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one.
@ -1402,7 +1399,7 @@ static void HU_drawChatLog(INT32 offset)
INT32 charwidth = 4, charheight = 6; INT32 charwidth = 4, charheight = 6;
INT32 x = chatx+2, y = chaty - offset*charheight - (chat_scroll*charheight) - cv_chatheight.value*charheight - 12 - (cv_kartspeedometer.value ? 16 : 0), dx = 0, dy = 0; INT32 x = chatx+2, y = chaty - offset*charheight - (chat_scroll*charheight) - cv_chatheight.value*charheight - 12 - (cv_kartspeedometer.value ? 16 : 0), dx = 0, dy = 0;
size_t i = 0; UINT32 i = 0;
INT32 chat_topy = y + chat_scroll*charheight; INT32 chat_topy = y + chat_scroll*charheight;
INT32 chat_bottomy = chat_topy + cv_chatheight.value*charheight; INT32 chat_bottomy = chat_topy + cv_chatheight.value*charheight;
boolean atbottom = false; boolean atbottom = false;
@ -1412,7 +1409,7 @@ static void HU_drawChatLog(INT32 offset)
for (i=0; i<chat_nummsg_log; i++) // iterate through our chatlog for (i=0; i<chat_nummsg_log; i++) // iterate through our chatlog
{ {
INT32 clrflag = 0; INT32 clrflag = 0;
size_t j = 0; INT32 j = 0;
const char *msg = CHAT_WordWrap(x, cv_chatwidth.value-charwidth, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_log[i]); // get the current message, and word wrap it. const char *msg = CHAT_WordWrap(x, cv_chatwidth.value-charwidth, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_log[i]); // get the current message, and word wrap it.
while(msg[j]) // iterate through msg while(msg[j]) // iterate through msg
{ {
@ -1463,9 +1460,11 @@ static void HU_drawChatLog(INT32 offset)
chat_scrollmedown = false; chat_scrollmedown = false;
// getmaxscroll through a lazy hack. We do all these loops, so let's not do more loops that are gonna lag the game more. :P // getmaxscroll through a lazy hack. We do all these loops, so let's not do more loops that are gonna lag the game more. :P
chat_maxscroll = (dy/charheight)-cv_chatheight.value; // welcome to C, we don't know what min() and max() are. chat_maxscroll = (dy/charheight); // welcome to C, we don't know what min() and max() are.
if (chat_maxscroll < 0) if (chat_maxscroll <= (UINT32)cv_chatheight.value)
chat_maxscroll = 0; chat_maxscroll = 0;
else
chat_maxscroll -= cv_chatheight.value;
// if we're not bound by the time, autoscroll for next frame: // if we're not bound by the time, autoscroll for next frame:
if (atbottom) if (atbottom)
@ -1493,7 +1492,7 @@ static void HU_DrawChat(void)
{ {
INT32 charwidth = 4, charheight = 6; INT32 charwidth = 4, charheight = 6;
INT32 t = 0, c = 0, y = chaty - (typelines*charheight) - (cv_kartspeedometer.value ? 16 : 0); INT32 t = 0, c = 0, y = chaty - (typelines*charheight) - (cv_kartspeedometer.value ? 16 : 0);
size_t i = 0; UINT32 i = 0;
const char *ntalk = "Say: ", *ttalk = "Team: "; const char *ntalk = "Say: ", *ttalk = "Team: ";
const char *talk = ntalk; const char *talk = ntalk;
@ -1563,7 +1562,7 @@ static void HU_DrawChat(void)
if (strnicmp(w_chat, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai if (strnicmp(w_chat, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai
{ {
i = 0; i = 0;
int count = 0; INT32 count = 0;
INT32 p_dispy = chaty - charheight -1; INT32 p_dispy = chaty - charheight -1;
for(i=0; (i<MAXPLAYERS); i++) for(i=0; (i<MAXPLAYERS); i++)
{ {
@ -1579,7 +1578,7 @@ static void HU_DrawChat(void)
char *nodenum = (char*) malloc(3); char *nodenum = (char*) malloc(3);
strncpy(nodenum, w_chat+3, 4); strncpy(nodenum, w_chat+3, 4);
INT32 n = atoi((const char*) nodenum); // turn that into a number UINT32 n = atoi((const char*) nodenum); // turn that into a number
// special cases: // special cases:
if ((n == 0) && !(w_chat[4] == '0')) if ((n == 0) && !(w_chat[4] == '0'))

View File

@ -20,6 +20,7 @@
#include "m_random.h" #include "m_random.h"
#include "s_sound.h" #include "s_sound.h"
#include "g_game.h" #include "g_game.h"
#include "hu_stuff.h"
#include "k_kart.h" #include "k_kart.h"
#include "lua_script.h" #include "lua_script.h"

View File

@ -1334,13 +1334,14 @@ static menuitem_t OP_SoundOptionsMenu[] =
{IT_STRING|IT_CALL, NULL, "Restart Audio System", M_RestartAudio, 50}, {IT_STRING|IT_CALL, NULL, "Restart Audio System", M_RestartAudio, 50},
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 70}, {IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 65},
{IT_STRING|IT_CVAR, NULL, "Surround Sound", &surround, 80}, {IT_STRING|IT_CVAR, NULL, "Surround Sound", &surround, 75},
{IT_STRING|IT_CVAR, NULL, "Chat sounds", &cv_chatnotifications, 90},
{IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 100}, {IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 100},
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 110}, {IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 110},
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 130}, {IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 125},
}; };
/*static menuitem_t OP_DataOptionsMenu[] = /*static menuitem_t OP_DataOptionsMenu[] =
@ -1398,14 +1399,22 @@ static menuitem_t OP_HUDOptionsMenu[] =
NULL, "HUD Visibility", &cv_translucenthud, 20}, NULL, "HUD Visibility", &cv_translucenthud, 20},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, {IT_STRING | IT_CVAR | IT_CV_SLIDER,
NULL, "Minimap Visibility", &cv_kartminimap, 40}, NULL, "Minimap Visibility", &cv_kartminimap, 35},
{IT_STRING | IT_CVAR, NULL, "Speedometer Display", &cv_kartspeedometer, 50}, {IT_STRING | IT_CVAR, NULL, "Speedometer Display", &cv_kartspeedometer, 45},
{IT_STRING | IT_CVAR, NULL, "Show \"CHECK\"", &cv_kartcheck, 60}, {IT_STRING | IT_CVAR, NULL, "Show \"CHECK\"", &cv_kartcheck, 55},
{IT_STRING | IT_CVAR, NULL, "Console Color", &cons_backcolor, 80}, {IT_STRING | IT_CVAR, NULL, "Menu Highlights", &cons_menuhighlight, 70},
{IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 90}, // highlight info - (GOOD HIGHLIGHT, WARNING HIGHLIGHT) - 80 (see M_DrawHUDOptions)
{IT_STRING | IT_CVAR, NULL, "Menu Highlights", &cons_menuhighlight, 110}, //{IT_STRING | IT_CVAR, NULL, "Chat mode", &cv_consolechat, 95}, -- will ANYONE who doesn't know how to use the console want to touch this
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
NULL, "Chat box width", &cv_chatwidth, 95},
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
NULL, "Chat box height", &cv_chatheight, 105},
{IT_STRING | IT_CVAR, NULL, "Chat fadeout time", &cv_chattime, 115},
{IT_STRING | IT_CVAR, NULL, "Background Color", &cons_backcolor, 130},
{IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 140},
}; };
static menuitem_t OP_GameOptionsMenu[] = static menuitem_t OP_GameOptionsMenu[] =
@ -8364,7 +8373,7 @@ static void M_DrawHUDOptions(void)
const char *str1 = " Warning highlight"; const char *str1 = " Warning highlight";
const char *str2 = ","; const char *str2 = ",";
const char *str3 = "Good highlight"; const char *str3 = "Good highlight";
INT32 x = BASEVIDWIDTH - currentMenu->x + 2, y = currentMenu->y + 120; INT32 x = BASEVIDWIDTH - currentMenu->x + 2, y = currentMenu->y + 80;
INT32 w0 = V_StringWidth(str0, 0), w1 = V_StringWidth(str1, 0), w2 = V_StringWidth(str2, 0), w3 = V_StringWidth(str3, 0); INT32 w0 = V_StringWidth(str0, 0), w1 = V_StringWidth(str1, 0), w2 = V_StringWidth(str2, 0), w3 = V_StringWidth(str3, 0);
M_DrawGenericMenu(); M_DrawGenericMenu();
x -= w0; x -= w0;