From 346c6bce9655e5e743d6c017e5495124e60ea519 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Wed, 10 Oct 2018 21:24:55 +0200 Subject: [PATCH 1/8] HU_AddChatText cleanup for future use + chat mode Window (Hidden) added. --- src/d_netcmd.c | 12 +++++++---- src/g_game.c | 2 +- src/hu_stuff.c | 51 +++++++++++++++++++---------------------------- src/hu_stuff.h | 4 ++-- src/lua_baselib.c | 16 ++++----------- 5 files changed, 36 insertions(+), 49 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index da303f26..50ed146b 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -5144,13 +5144,17 @@ static void Color4_OnChange(void) */ static void Mute_OnChange(void) { - if (server || (IsPlayerAdmin(consoleplayer))) - return; + /*if (server || (IsPlayerAdmin(consoleplayer))) + return;*/ + // Kinda dumb IMO, you should be able to see confirmation for having muted the chat as the host or admin. + + if (leveltime <= 1) + return; // avoid having this notification put in our console / log when we boot the server. if (cv_mute.value) - CONS_Printf(M_GetText("Chat has been muted.\n")); + HU_AddChatText(M_GetText("*Chat has been muted."), false); else - CONS_Printf(M_GetText("Chat is no longer muted.\n")); + HU_AddChatText(M_GetText("*Chat is no longer muted."), false); } /** Hack to clear all changed flags after game start. diff --git a/src/g_game.c b/src/g_game.c index 8d706bbf..fc32b7d5 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -425,7 +425,7 @@ consvar_t cv_chatspamprotection = {"chatspamprotection", "On", CV_SAVE, CV_OnOff consvar_t cv_chatbacktint = {"chatbacktint", "Off", 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.) -static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Window"}, {1, "Console"}, {0, NULL}}; +static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Window"}, {1, "Console"}, {2, "Window (Hidden)"}, {0, NULL}}; consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; /*consvar_t cv_crosshair = {"crosshair", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 2632197c..b915cc81 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -386,13 +386,12 @@ static void HU_removeChatText_Log(void) chat_nummsg_log--; // lost 1 msg. } -void HU_AddChatText(const char *text) +void HU_AddChatText(const char *text, boolean playsound) { - if (cv_chatnotifications.value) + if (playsound && cv_consolechat.value != 2) // Don't play the sound if we're using hidden chat. S_StartSound(NULL, sfx_radio); - - // TODO: check if we're oversaturating the log (we can only log CHAT_BUFSIZE messages.) - + // reguardless of our preferences, put all of this in the chat buffer in case we decide to change from oldchat mid-game. + if (chat_nummsg_log >= CHAT_BUFSIZE) HU_removeChatText_Log(); @@ -405,6 +404,11 @@ void HU_AddChatText(const char *text) strcpy(chat_mini[chat_nummsg_min], text); chat_timers[chat_nummsg_min] = TICRATE*cv_chattime.value; chat_nummsg_min++; + + if (OLDCHAT) // if we're using oldchat, print directly in console + CONS_Printf("%s\n", text); + else // if we aren't, still save the message to log.txt + CON_LogMessage(va("%s\n", text)); } /** Runs a say command, sending an ::XD_SAY message. @@ -437,7 +441,7 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags) if (CHAT_MUTE) // TODO: Per Player mute. { - HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85")); + HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false); return; } @@ -478,7 +482,7 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags) // let it slide else { - HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm \'."); + HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm \'.", false); return; } } @@ -487,7 +491,7 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags) { if (msg[5] != ' ') { - HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm \'."); + HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm \'.", false); return; } } @@ -500,7 +504,7 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags) target++; // even though playernums are from 0 to 31, target is 1 to 32, so up that by 1 to have it work! else { - HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target)); // same + HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same return; } buf[0] = target; @@ -716,7 +720,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) || target == 0 // To everyone || consoleplayer == target-1) // To you { - const char *prefix = "", *cstart = "", *cend = "", *adminchar = "\x82~\x83", *remotechar = "\x82@\x83", *fmt, *fmt2, *textcolor = "\x80"; + const char *prefix = "", *cstart = "", *cend = "", *adminchar = "\x82~\x83", *remotechar = "\x82@\x83", *fmt2, *textcolor = "\x80"; char *tempchar = NULL; // player is a spectator? @@ -796,16 +800,12 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) // name, color end, and the message itself. // '\4' makes the message yellow and beeps; '\3' just beeps. if (action) - { - fmt = "\3* %s%s%s%s \x82%s%s\n"; // don't make /me yellow, yellow will be for mentions and PMs! fmt2 = "* %s%s%s%s \x82%s%s"; - } else if (target-1 == consoleplayer) // To you { prefix = "\x82[PM]"; cstart = "\x82"; textcolor = "\x82"; - fmt = "\4%s<%s%s>%s\x80 %s%s\n"; // make this yellow, however. fmt2 = "%s<%s%s>%s\x80 %s%s"; } else if (target > 0) // By you, to another player @@ -814,15 +814,11 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) dispname = player_names[target-1]; prefix = "\x82[TO]"; cstart = "\x82"; - fmt = "\4%s<%s%s>%s\x80 %s%s\n"; // make this yellow, however. fmt2 = "%s<%s%s>%s\x80 %s%s"; } else // To everyone or sayteam, it doesn't change anything. - { - fmt = "\3%s<%s%s%s>\x80 %s%s\n"; fmt2 = "%s<%s%s%s>\x80 %s%s"; - } /*else // To your team { if (players[playernum].ctfteam == 1) // red @@ -836,12 +832,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) fmt2 = "%s<%s%s>\x80%s %s%s"; }*/ - HU_AddChatText(va(fmt2, prefix, cstart, dispname, cend, textcolor, 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, textcolor, msg); - else - CON_LogMessage(va(fmt, prefix, cstart, dispname, cend, textcolor, msg)); // save to log.txt + HU_AddChatText(va(fmt2, prefix, cstart, dispname, cend, textcolor, msg), cv_chatnotifications.value); // add to chat if (tempchar) Z_Free(tempchar); @@ -968,7 +959,7 @@ static void HU_queueChatChar(INT32 c) // last minute mute check if (CHAT_MUTE) { - HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85")); + HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false); return; } @@ -983,7 +974,7 @@ static void HU_queueChatChar(INT32 c) // teamtalk can't send PMs, just don't send it, else everyone would be able to see it, and no one wants to see your sex RP sicko. if (teamtalk) { - HU_AddChatText(va("%sCannot send sayto in Say-Team.", "\x85")); + HU_AddChatText(va("%sCannot send sayto in Say-Team.", "\x85"), false); return; } @@ -999,7 +990,7 @@ static void HU_queueChatChar(INT32 c) // let it slide else { - HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm \'."); + HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm \'.", false); return; } } @@ -1008,7 +999,7 @@ static void HU_queueChatChar(INT32 c) { if (msg[5] != ' ') { - HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm \'."); + HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm \'.", false); return; } } @@ -1021,7 +1012,7 @@ static void HU_queueChatChar(INT32 c) target++; // even though playernums are from 0 to 31, target is 1 to 32, so up that by 1 to have it work! else { - HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target)); // same + HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same return; } // we need to get rid of the /pm @@ -1998,7 +1989,7 @@ void HU_Drawer(void) { 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) + if (!OLDCHAT && cv_consolechat.value < 2) // Don't display minimized chat if you set the mode to Window (Hidden) HU_drawMiniChat(); // draw messages in a cool fashion. } } diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 28a31d4b..2fa879df 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -80,12 +80,12 @@ 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) +#define OLDCHAT (cv_consolechat.value == 1 || dedicated || vid.width < 640) #define CHAT_MUTE (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // this still allows to open the chat but not to type. That's used for scrolling and whatnot. #define OLD_MUTE (OLDCHAT && cv_mute.value && !(server || IsPlayerAdmin(consoleplayer))) // this is used to prevent oldchat from opening when muted. // some functions -void HU_AddChatText(const char *text); +void HU_AddChatText(const char *text, boolean playsound); // set true when entering a chat message extern boolean chat_on; diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 240db71c..0e644413 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -92,6 +92,7 @@ static int lib_print(lua_State *L) static int lib_chatprint(lua_State *L) { const char *str = luaL_checkstring(L, 1); // retrieve string + boolean sound = luaL_checkboolean(L, 2); // retrieve sound boolean int len; if (str == NULL) // error if we don't have a string! return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("chatprint")); @@ -99,12 +100,7 @@ static int lib_chatprint(lua_State *L) if (len > 255) // string is too long!!! return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer."); - HU_AddChatText(str); - - if OLDCHAT - CONS_Printf("%s\n", str); - else - CON_LogMessage(str); // save to log.txt + HU_AddChatText(str, sound); return 0; } @@ -115,6 +111,7 @@ static int lib_chatprintf(lua_State *L) int n = lua_gettop(L); /* number of arguments */ player_t *plr; const char *str; + boolean sound = luaL_checkboolean(L, 3); int len; if (n < 2) return luaL_error(L, "chatprintf requires at least two arguments: player and text."); @@ -132,12 +129,7 @@ static int lib_chatprintf(lua_State *L) if (len > 255) // string is too long!!! return luaL_error(L, "String exceeds the 255 characters limit of the chat buffer."); - HU_AddChatText(str); - - if OLDCHAT - CONS_Printf("%s\n", str); - else - CON_LogMessage(str); // save to log.txt + HU_AddChatText(str, sound); return 0; } From 49f2c62b5d59186eecb1deec992d685128098c8e Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Thu, 11 Oct 2018 21:39:19 +0200 Subject: [PATCH 2/8] More stuff goes in HU_AddChatText, fixed /pm list not having the correct coords if kartspeedometer was on. --- src/d_clisrv.c | 39 +++++++++++++++++++++------------------ src/d_netcmd.c | 8 ++++---- src/hu_stuff.c | 8 ++++---- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index ec3aa444..0c228cba 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2812,7 +2812,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) msg = KICK_MSG_CON_FAIL; } - CONS_Printf("\x82%s ", player_names[pnum]); + //CONS_Printf("\x82%s ", player_names[pnum]); // If a verified admin banned someone, the server needs to know about it. // If the playernum isn't zero (the server) then the server needs to record the ban. @@ -2829,15 +2829,15 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) switch (msg) { case KICK_MSG_GO_AWAY: - CONS_Printf(M_GetText("has been kicked (Go away)\n")); + HU_AddChatText(va("\x82*%s has been kicked (Go away)", player_names[pnum]), false); break; #ifdef NEWPING case KICK_MSG_PING_HIGH: - CONS_Printf(M_GetText("left the game (Broke ping limit)\n")); + HU_AddChatText(va("\x82*%s left the game (Broke ping limit)", player_names[pnum]), false); break; #endif case KICK_MSG_CON_FAIL: - CONS_Printf(M_GetText("left the game (Synch failure)\n")); + HU_AddChatText(va("\x82*%s left the game (Synch Failure)", player_names[pnum]), false); if (M_CheckParm("-consisdump")) // Helps debugging some problems { @@ -2873,22 +2873,22 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) } break; case KICK_MSG_TIMEOUT: - CONS_Printf(M_GetText("left the game (Connection timeout)\n")); + HU_AddChatText(va("\x82*%s left the game (Connection timeout)", player_names[pnum]), false); break; case KICK_MSG_PLAYER_QUIT: if (netgame) // not splitscreen/bots - CONS_Printf(M_GetText("left the game\n")); + HU_AddChatText(va("\x82*%s left the game", player_names[pnum]), false); break; case KICK_MSG_BANNED: - CONS_Printf(M_GetText("has been banned (Don't come back)\n")); + HU_AddChatText(va("\x82*%s has been banned (Don't come back)", player_names[pnum]), false); break; case KICK_MSG_CUSTOM_KICK: READSTRINGN(*p, reason, MAX_REASONLENGTH+1); - CONS_Printf(M_GetText("has been kicked (%s)\n"), reason); + HU_AddChatText(va("\x82*%s has been kicked (%s)", player_names[pnum], reason), false); break; case KICK_MSG_CUSTOM_BAN: READSTRINGN(*p, reason, MAX_REASONLENGTH+1); - CONS_Printf(M_GetText("has been banned (%s)\n"), reason); + HU_AddChatText(va("\x82*%s has been banned (%s)", player_names[pnum], reason), false); break; } @@ -3167,9 +3167,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) if (newplayernum+1 > doomcom->numslots) doomcom->numslots = (INT16)(newplayernum+1); - if (netgame) - CONS_Printf(M_GetText("Player %d has joined the game (node %d)\n"), newplayernum+1, node); - // the server is creating my player if (node == mynode) { @@ -3228,13 +3225,19 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) D_SendPlayerConfig(); addedtogame = true; } - else if (server && netgame && cv_showjoinaddress.value) - { - const char *address; - if (I_GetNodeAddress && (address = I_GetNodeAddress(node)) != NULL) - CONS_Printf(M_GetText("Player Address is %s\n"), address); + + if (netgame) + { + if (server && netgame && cv_showjoinaddress.value) + { + const char *address; + if (I_GetNodeAddress && (address = I_GetNodeAddress(node)) != NULL) + HU_AddChatText(va("\x82*Player %d has joined the game (node %d) (%s)", newplayernum+1, node, address), false); // merge join notification + IP to avoid clogging console/chat. + } + else + HU_AddChatText(va("\x82*Player %d has joined the game (node %d)", newplayernum+1, node), false); } - + if (server && multiplayer && motd[0] != '\0') COM_BufAddText(va("sayto %d %s\n", newplayernum, motd)); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 50ed146b..c1156d4b 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1140,8 +1140,8 @@ static void SetPlayerName(INT32 playernum, char *newname) if (strcasecmp(newname, player_names[playernum]) != 0) { if (netgame) - CONS_Printf(M_GetText("%s renamed to %s\n"), - player_names[playernum], newname); + HU_AddChatText(va("\x82*%s renamed to %s", player_names[playernum], newname), false); + strcpy(player_names[playernum], newname); } } @@ -5152,9 +5152,9 @@ static void Mute_OnChange(void) return; // avoid having this notification put in our console / log when we boot the server. if (cv_mute.value) - HU_AddChatText(M_GetText("*Chat has been muted."), false); + HU_AddChatText(M_GetText("\x82*Chat has been muted."), false); else - HU_AddChatText(M_GetText("*Chat is no longer muted."), false); + HU_AddChatText(M_GetText("\x82*Chat is no longer muted."), false); } /** Hack to clear all changed flags after game start. diff --git a/src/hu_stuff.c b/src/hu_stuff.c index b915cc81..5ffad630 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1634,15 +1634,15 @@ static void HU_DrawChat(void) { char name[MAXPLAYERNAME+1]; strlcpy(name, player_names[i], 7); // shorten name to 7 characters. - V_DrawFillConsoleMap(chatx+ cv_chatwidth.value + 2, p_dispy- (6*count), 48, 6, 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); // fill it like the chat so the text doesn't become hard to read because of the hud. - V_DrawSmallString(chatx+ cv_chatwidth.value + 4, p_dispy- (6*count), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va("\x82%d\x80 - %s", i, name)); + V_DrawFillConsoleMap(chatx+ cv_chatwidth.value + 2, p_dispy- (6*count) - (cv_kartspeedometer.value ? 16 : 0), 48, 6, 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); // fill it like the chat so the text doesn't become hard to read because of the hud. + V_DrawSmallString(chatx+ cv_chatwidth.value + 4, p_dispy- (6*count) - (cv_kartspeedometer.value ? 16 : 0), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va("\x82%d\x80 - %s", i, name)); count++; } } if (count == 0) // no results. { - V_DrawFillConsoleMap(chatx-50, p_dispy- (6*count), 48, 6, 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); // fill it like the chat so the text doesn't become hard to read because of the hud. - V_DrawSmallString(chatx-48, p_dispy- (6*count), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, "NO RESULT."); + V_DrawFillConsoleMap(chatx+ cv_chatwidth.value + 2, p_dispy- (6*count) - (cv_kartspeedometer.value ? 16 : 0), 48, 6, 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); // fill it like the chat so the text doesn't become hard to read because of the hud. + V_DrawSmallString(chatx+ cv_chatwidth.value + 4, p_dispy- (6*count) - (cv_kartspeedometer.value ? 16 : 0), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, "NO RESULT."); } } From e2394d47a14591fe8e9ee418c3f3dcebec6e7fff Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sun, 21 Oct 2018 14:09:25 +0200 Subject: [PATCH 3/8] More messages in chatbox + new console backcolours --- src/console.c | 29 ++++++++++++++++++++--------- src/v_video.c | 39 +++++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/src/console.c b/src/console.c index f79a6faf..b007a09b 100644 --- a/src/console.c +++ b/src/console.c @@ -135,8 +135,11 @@ static CV_PossibleValue_t backpic_cons_t[] = {{0, "translucent"}, {1, "picture"} static consvar_t cons_backpic = {"con_backpic", "translucent", CV_SAVE, backpic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Gray"}, {2, "Brown"}, - {3, "Red"}, {4, "Orange"}, {5, "Yellow"}, - {6, "Green"}, {7, "Blue"}, {8, "Cyan"}, + {3, "Pink"}, {4, "Rose"}, {5, "Red"}, + {6, "Orange"}, {7, "Gold"}, {8, "Yellow"}, + {9, "Emerald"}, {10,"Green"}, {11,"Cyan"}, + {12,"Steel"}, {13,"Blue"}, {14,"Purple"}, + {15,"Lavender"}, {0, NULL}}; consvar_t cons_backcolor = {"con_backcolor", "Green", CV_CALL|CV_SAVE, backcolor_cons_t, CONS_backcolor_Change, 0, NULL, NULL, 0, 0, NULL}; @@ -255,6 +258,7 @@ void CON_SetupBackColormap(void) UINT16 i, palsum; UINT8 j, palindex; UINT8 *pal = W_CacheLumpName(GetPalette(), PU_CACHE); + INT32 shift = 6; if (!consolebgmap) consolebgmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); @@ -264,12 +268,19 @@ void CON_SetupBackColormap(void) case 0: palindex = 15; break; // White case 1: palindex = 31; break; // Gray case 2: palindex = 63; break; // Brown - case 3: palindex = 143; break; // Red - case 4: palindex = 95; break; // Orange - case 5: palindex = 111; break; // Yellow - case 6: palindex = 175; break; // Green - case 7: palindex = 239; break; // Blue - case 8: palindex = 219; break; // Cyan + case 3: palindex = 150; shift = 7; break; // Pink + case 4: palindex = 127; shift = 7; break; // Rose + case 5: palindex = 143; break; // Red + case 6: palindex = 95; break; // Orange + case 7: palindex = 119; shift = 7; break; // Gold + case 8: palindex = 111; break; // Yellow + case 9: palindex = 191; shift = 7; break; // Emerald + case 10: palindex = 175; break; // Green + case 11: palindex = 219; break; // Cyan + case 12: palindex = 207; shift = 7; break; // Steel + case 13: palindex = 239; break; // Blue + case 14: palindex = 199; shift = 7; break; // Purple + case 15: palindex = 255; shift = 7; break; // Lavender // Default green default: palindex = 175; break; } @@ -277,7 +288,7 @@ void CON_SetupBackColormap(void) // setup background colormap for (i = 0, j = 0; i < 768; i += 3, j++) { - palsum = (pal[i] + pal[i+1] + pal[i+2]) >> 6; + palsum = (pal[i] + pal[i+1] + pal[i+2]) >> shift; consolebgmap[j] = (UINT8)(palindex - palsum); } } diff --git a/src/v_video.c b/src/v_video.c index 1ddaccfd..58ff3c60 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -976,12 +976,19 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) case 0: hwcolor = 0xffffff00; break; // White case 1: hwcolor = 0x80808000; break; // Gray case 2: hwcolor = 0x40201000; break; // Brown - case 3: hwcolor = 0xff000000; break; // Red - case 4: hwcolor = 0xff800000; break; // Orange - case 5: hwcolor = 0x80800000; break; // Yellow - case 6: hwcolor = 0x00800000; break; // Green - case 7: hwcolor = 0x0000ff00; break; // Blue - case 8: hwcolor = 0x4080ff00; break; // Cyan + case 3: hwcolor = 0xfa807200; break; // Pink + case 4: hwcolor = 0xff69b400; break; // Rose + case 5: hwcolor = 0xff000000; break; // Red + case 6: hwcolor = 0xff800000; break; // Orange + case 7: hwcolor = 0xdaa52000; break; // Gold + case 8: hwcolor = 0x80800000; break; // Yellow + case 9: hwcolor = 0x00ff0000; break; // Emerald + case 10: hwcolor = 0x00800000; break; // Green + case 11: hwcolor = 0x4080ff00; break; // Cyan + case 12: hwcolor = 0x4682b400; break; // Steel + case 13: hwcolor = 0x0000ff00; break; // Blue + case 14: hwcolor = 0xff00ff00; break; // Purple + case 15: hwcolor = 0xee82ee00; break; // Lavender // Default green default: hwcolor = 0x00800000; break; } @@ -1236,12 +1243,20 @@ void V_DrawFadeConsBack(INT32 plines) case 0: hwcolor = 0xffffff00; break; // White case 1: hwcolor = 0x80808000; break; // Gray case 2: hwcolor = 0x40201000; break; // Brown - case 3: hwcolor = 0xff000000; break; // Red - case 4: hwcolor = 0xff800000; break; // Orange - case 5: hwcolor = 0x80800000; break; // Yellow - case 6: hwcolor = 0x00800000; break; // Green - case 7: hwcolor = 0x0000ff00; break; // Blue - case 8: hwcolor = 0x4080ff00; break; // Cyan + case 3: hwcolor = 0xfa807200; break; // Pink + case 4: hwcolor = 0xff69b400; break; // Rose + case 5: hwcolor = 0xff000000; break; // Red + case 6: hwcolor = 0xff800000; break; // Orange + case 7: hwcolor = 0xdaa52000; break; // Gold + case 8: hwcolor = 0x80800000; break; // Yellow + case 9: hwcolor = 0x00ff0000; break; // Emerald + case 10: hwcolor = 0x00800000; break; // Green + case 11: hwcolor = 0x4080ff00; break; // Cyan + case 12: hwcolor = 0x4682b400; break; // Steel + case 13: hwcolor = 0x0000ff00; break; // Blue + case 14: hwcolor = 0xff00ff00; break; // Purple + case 15: hwcolor = 0xee82ee00; break; // Lavender + // Default green default: hwcolor = 0x00800000; break; } From 10d8105a5277ee8ed919d559df841cc8cd239a55 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sun, 21 Oct 2018 14:51:34 +0200 Subject: [PATCH 4/8] Console background color default changed to Black + Resolved merge conflict (hopefully) --- src/console.c | 4 +-- src/hu_stuff.c | 96 +++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 77 insertions(+), 23 deletions(-) diff --git a/src/console.c b/src/console.c index b007a09b..26fcf206 100644 --- a/src/console.c +++ b/src/console.c @@ -134,14 +134,14 @@ static CV_PossibleValue_t backpic_cons_t[] = {{0, "translucent"}, {1, "picture"} // whether to use console background picture, or translucent mode static consvar_t cons_backpic = {"con_backpic", "translucent", CV_SAVE, backpic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Gray"}, {2, "Brown"}, +static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Black"}, {2, "Brown"}, {3, "Pink"}, {4, "Rose"}, {5, "Red"}, {6, "Orange"}, {7, "Gold"}, {8, "Yellow"}, {9, "Emerald"}, {10,"Green"}, {11,"Cyan"}, {12,"Steel"}, {13,"Blue"}, {14,"Purple"}, {15,"Lavender"}, {0, NULL}}; -consvar_t cons_backcolor = {"con_backcolor", "Green", CV_CALL|CV_SAVE, backcolor_cons_t, CONS_backcolor_Change, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cons_backcolor = {"con_backcolor", "Black", CV_CALL|CV_SAVE, backcolor_cons_t, CONS_backcolor_Change, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t menuhighlight_cons_t[] = { diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 5ffad630..41aa91d7 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1260,6 +1260,7 @@ static void HU_drawMiniChat(void) { INT32 x = chatx+2; INT32 charwidth = 4, charheight = 6; + INT32 boxw = cv_chatwidth.value; INT32 dx = 0, dy = 0; size_t i = chat_nummsg_min; boolean prev_linereturn = false; // a hack to prevent double \n while I have no idea why they happen in the first place. @@ -1271,9 +1272,12 @@ static void HU_drawMiniChat(void) if (!chat_nummsg_min) return; // needless to say it's useless to do anything if we don't have anything to draw. + if (splitscreen > 1) + boxw = max(64, boxw/2); + for (; i>0; i--) { - const char *msg = CHAT_WordWrap(x+2, cv_chatwidth.value-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]); + const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]); size_t j = 0; INT32 linescount = 0; @@ -1306,7 +1310,7 @@ static void HU_drawMiniChat(void) } prev_linereturn = false; dx += charwidth; - if (dx >= cv_chatwidth.value) + if (dx >= boxw) { dx = 0; linescount += 1; @@ -1317,7 +1321,17 @@ static void HU_drawMiniChat(void) msglines += linescount+1; } - y = chaty - charheight*(msglines+1) - (cv_kartspeedometer.value ? 16 : 0); + y = chaty - charheight*(msglines+1); + + if (splitscreen) + { + y -= BASEVIDHEIGHT/2; + if (splitscreen > 1) + y += 16; + } + else + y -= (cv_kartspeedometer.value ? 16 : 0); + dx = 0; dy = 0; i = 0; @@ -1329,7 +1343,7 @@ static void HU_drawMiniChat(void) 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. size_t j = 0; - const char *msg = CHAT_WordWrap(x+2, cv_chatwidth.value-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it. + const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it. UINT8 *colormap = NULL; while(msg[j]) // iterate through msg @@ -1367,7 +1381,7 @@ static void HU_drawMiniChat(void) dx += charwidth; prev_linereturn = false; - if (dx >= cv_chatwidth.value) + if (dx >= boxw) { dx = 0; dy += charheight; @@ -1388,6 +1402,7 @@ static void HU_drawMiniChat(void) static void HU_drawChatLog(INT32 offset) { INT32 charwidth = 4, charheight = 6; + INT32 boxw = cv_chatwidth.value, boxh = cv_chatheight.value; INT32 x = chatx+2, y, dx = 0, dy = 0; UINT32 i = 0; INT32 chat_topy, chat_bottomy; @@ -1397,17 +1412,34 @@ static void HU_drawChatLog(INT32 offset) if (chat_scroll > chat_maxscroll) chat_scroll = chat_maxscroll; - y = chaty - offset*charheight - (chat_scroll*charheight) - cv_chatheight.value*charheight - 12 - (cv_kartspeedometer.value ? 16 : 0); - chat_topy = y + chat_scroll*charheight; - chat_bottomy = chat_topy + cv_chatheight.value*charheight; + if (splitscreen) + { + boxh = max(6, boxh/2); + if (splitscreen > 1) + boxw = max(64, boxw/2); + } - V_DrawFillConsoleMap(chatx, chat_topy, cv_chatwidth.value, cv_chatheight.value*charheight +2, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box + y = chaty - offset*charheight - (chat_scroll*charheight) - boxh*charheight - 12; + + if (splitscreen) + { + y -= BASEVIDHEIGHT/2; + if (splitscreen > 1) + y += 16; + } + else + y -= (cv_kartspeedometer.value ? 16 : 0); + + chat_topy = y + chat_scroll*charheight; + chat_bottomy = chat_topy + boxh*charheight; + + V_DrawFillConsoleMap(chatx, chat_topy, boxw, boxh*charheight +2, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box for (i=0; i= cv_chatwidth.value-charwidth-2 && i= HU_FONTSTART) // end of message shouldn't count, nor should invisible characters!!!! + if (dx >= boxw-charwidth-2 && i= HU_FONTSTART) // end of message shouldn't count, nor should invisible characters!!!! { dx = 0; dy += charheight; @@ -1457,10 +1489,10 @@ static void HU_drawChatLog(INT32 offset) // 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); // welcome to C, we don't know what min() and max() are. - if (chat_maxscroll <= (UINT32)cv_chatheight.value) + if (chat_maxscroll <= (UINT32)boxh) chat_maxscroll = 0; else - chat_maxscroll -= cv_chatheight.value; + chat_maxscroll -= boxh; // if we're not bound by the time, autoscroll for next frame: if (atbottom) @@ -1493,13 +1525,26 @@ static INT16 typelines = 1; // number of drawfill lines we need. it's some weird static void HU_DrawChat(void) { INT32 charwidth = 4, charheight = 6; - INT32 t = 0, c = 0, y = chaty - (typelines*charheight) - (cv_kartspeedometer.value ? 16 : 0); + INT32 boxw = cv_chatwidth.value; + INT32 t = 0, c = 0, y = chaty - (typelines*charheight); UINT32 i = 0, saylen = strlen(w_chat); // You learn new things everyday! INT32 cflag = 0; const char *ntalk = "Say: ", *ttalk = "Team: "; const char *talk = ntalk; const char *mute = "Chat has been muted."; + if (splitscreen) + { + y -= BASEVIDHEIGHT/2; + if (splitscreen > 1) + { + y += 16; + boxw = max(64, boxw/2); + } + } + else + y -= (cv_kartspeedometer.value ? 16 : 0); + if (teamtalk) { talk = ttalk; @@ -1518,7 +1563,7 @@ static void HU_DrawChat(void) cflag = V_GRAYMAP; // set text in gray if chat is muted. } - V_DrawFillConsoleMap(chatx, y-1, cv_chatwidth.value, (typelines*charheight), 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); + V_DrawFillConsoleMap(chatx, y-1, boxw, (typelines*charheight), 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); while (talk[i]) { @@ -1551,7 +1596,7 @@ static void HU_DrawChat(void) boolean skippedline = false; if (c_input == (i+1)) { - int cursorx = (c+charwidth < cv_chatwidth.value-charwidth) ? (chatx + 2 + c+charwidth) : (chatx+1); // we may have to go down. + int cursorx = (c+charwidth < boxw-charwidth) ? (chatx + 2 + c+charwidth) : (chatx+1); // we may have to go down. int cursory = (cursorx != chatx+1) ? (y) : (y+charheight); if (hu_tick < 4) V_DrawChatCharacter(cursorx, cursory+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL); @@ -1571,7 +1616,7 @@ static void HU_DrawChat(void) V_DrawChatCharacter(chatx + c + 2, y, w_chat[i++] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, !cv_allcaps.value, NULL); c += charwidth; - if (c > cv_chatwidth.value-(charwidth*2) && !skippedline) + if (c > boxw-(charwidth*2) && !skippedline) { c = 0; y += charheight; @@ -1584,6 +1629,14 @@ static void HU_DrawChat(void) { INT32 count = 0; INT32 p_dispy = chaty - charheight -1; + if (splitscreen) + { + p_dispy -= BASEVIDHEIGHT/2; + if (splitscreen > 1) + p_dispy += 16; + } + else + p_dispy -= (cv_kartspeedometer.value ? 16 : 0); i = 0; for(i=0; (i Date: Sun, 21 Oct 2018 14:58:50 +0200 Subject: [PATCH 5/8] Console color default changed to Black + resolved mergeconflict hopefully --- src/hu_stuff.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index bcb10292..41aa91d7 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1057,26 +1057,6 @@ boolean HU_Responder(event_t *ev) // only KeyDown events now... - // Shoot, to prevent P1 chatting from ruining the game for everyone else, it's either: - // A. completely disallow opening chat entirely in online splitscreen - // or B. iterate through all controls to make sure it's bound to player 1 before eating - // You can see which one I chose. - // (Unless if you're sharing a keyboard, since you probably establish when you start chatting that you have dibs on it...) - // (Ahhh, the good ol days when I was a kid who couldn't afford an extra USB controller...) - - if (ev->data1 >= KEY_MOUSE1) - { - INT32 i; - for (i = 0; i < num_gamecontrols; i++) - { - if (gamecontrol[i][0] == ev->data1 || gamecontrol[i][1] == ev->data1) - break; - } - - if (i == num_gamecontrols) - return false; - } - if (!chat_on) { // enter chat mode From e5d4020f3ed40a2fd2fdeacd97e312723544e464 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Thu, 25 Oct 2018 13:21:44 +0200 Subject: [PATCH 6/8] Spectate / enter game in chat + New console colours + Highlight chat scroll arrow + small cleanup for consolefill --- src/console.c | 48 ++++++++++++++++------------- src/d_netcmd.c | 6 ++-- src/hu_stuff.c | 8 ++--- src/k_kart.c | 2 ++ src/m_menu.c | 4 +-- src/m_menu.h | 3 ++ src/p_user.c | 4 +-- src/v_video.c | 84 ++++++++++++++++++++++---------------------------- 8 files changed, 78 insertions(+), 81 deletions(-) diff --git a/src/console.c b/src/console.c index 38b593f0..88ef0b49 100644 --- a/src/console.c +++ b/src/console.c @@ -134,12 +134,13 @@ static CV_PossibleValue_t backpic_cons_t[] = {{0, "translucent"}, {1, "picture"} // whether to use console background picture, or translucent mode static consvar_t cons_backpic = {"con_backpic", "translucent", CV_SAVE, backpic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Black"}, {2, "Brown"}, - {3, "Pink"}, {4, "Rose"}, {5, "Red"}, - {6, "Orange"}, {7, "Gold"}, {8, "Yellow"}, - {9, "Emerald"}, {10,"Green"}, {11,"Cyan"}, - {12,"Steel"}, {13,"Blue"}, {14,"Purple"}, - {15,"Lavender"}, +static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Black"}, {2, "Sepia"}, + {3, "Brown"}, {4, "Pink"}, {5, "Raspberry"}, + {6, "Red"}, {7, "Creamsicle"}, {8, "Orange"}, + {9, "Gold"}, {10,"Yellow"}, {11,"Emerald"}, + {12,"Green"}, {13,"Cyan"}, {14,"Steel"}, + {15,"Periwinkle"}, {16,"Blue"}, {17,"Purple"}, + {18,"Lavender"}, {0, NULL}}; consvar_t cons_backcolor = {"con_backcolor", "Black", CV_CALL|CV_SAVE, backcolor_cons_t, CONS_backcolor_Change, 0, NULL, NULL, 0, 0, NULL}; @@ -265,22 +266,25 @@ void CON_SetupBackColormap(void) switch (cons_backcolor.value) { - case 0: palindex = 15; break; // White - case 1: palindex = 31; break; // Gray - case 2: palindex = 63; break; // Brown - case 3: palindex = 150; shift = 7; break; // Pink - case 4: palindex = 127; shift = 7; break; // Rose - case 5: palindex = 143; break; // Red - case 6: palindex = 95; break; // Orange - case 7: palindex = 119; shift = 7; break; // Gold - case 8: palindex = 111; break; // Yellow - case 9: palindex = 191; shift = 7; break; // Emerald - case 10: palindex = 175; break; // Green - case 11: palindex = 219; break; // Cyan - case 12: palindex = 207; shift = 7; break; // Steel - case 13: palindex = 239; break; // Blue - case 14: palindex = 199; shift = 7; break; // Purple - case 15: palindex = 255; shift = 7; break; // Lavender + case 0: palindex = 15; break; // White + case 1: palindex = 31; break; // Gray + case 2: palindex = 47; break; // Sepia + case 3: palindex = 63; break; // Brown + case 4: palindex = 150; shift = 7; break; // Pink + case 5: palindex = 127; shift = 7; break; // Raspberry + case 6: palindex = 143; break; // Red + case 7: palindex = 86; shift = 7; break; // Creamsicle + case 8: palindex = 95; break; // Orange + case 9: palindex = 119; shift = 7; break; // Gold + case 10: palindex = 111; break; // Yellow + case 11: palindex = 191; shift = 7; break; // Emerald + case 12: palindex = 175; break; // Green + case 13: palindex = 219; break; // Cyan + case 14: palindex = 207; shift = 7; break; // Steel + case 15: palindex = 230; shift = 7; break; // Periwinkle + case 16: palindex = 239; break; // Blue + case 17: palindex = 199; shift = 7; break; // Purple + case 18: palindex = 255; shift = 7; break; // Lavender // Default green default: palindex = 175; break; } diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 950f5cfb..a2dd550f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3315,12 +3315,10 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) else CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[playernum], '\x84', M_GetText("Blue Team"), '\x80'); } - else if (NetPacket.packet.newteam == 3) - CON_LogMessage(va(M_GetText("%s entered the game.\n"), player_names[playernum])); else if (players[playernum].pflags & PF_WANTSTOJOIN) players[playernum].pflags &= ~PF_WANTSTOJOIN; else - CON_LogMessage(va(M_GetText("%s became a spectator.\n"), player_names[playernum])); + HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); //reset view if you are changed, or viewing someone who was changed. if (playernum == consoleplayer || displayplayer == playernum) @@ -5265,7 +5263,7 @@ static void Mute_OnChange(void) /*if (server || (IsPlayerAdmin(consoleplayer))) return;*/ // Kinda dumb IMO, you should be able to see confirmation for having muted the chat as the host or admin. - + if (leveltime <= 1) return; // avoid having this notification put in our console / log when we boot the server. diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 41aa91d7..f0c773e1 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -391,7 +391,7 @@ void HU_AddChatText(const char *text, boolean playsound) if (playsound && cv_consolechat.value != 2) // Don't play the sound if we're using hidden chat. S_StartSound(NULL, sfx_radio); // reguardless of our preferences, put all of this in the chat buffer in case we decide to change from oldchat mid-game. - + if (chat_nummsg_log >= CHAT_BUFSIZE) HU_removeChatText_Log(); @@ -404,7 +404,7 @@ void HU_AddChatText(const char *text, boolean playsound) strcpy(chat_mini[chat_nummsg_min], text); chat_timers[chat_nummsg_min] = TICRATE*cv_chattime.value; chat_nummsg_min++; - + if (OLDCHAT) // if we're using oldchat, print directly in console CONS_Printf("%s\n", text); else // if we aren't, still save the message to log.txt @@ -1503,12 +1503,12 @@ static void HU_drawChatLog(INT32 offset) if (chat_scroll > 0) { V_DrawCharacter(chatx-9, ((justscrolledup) ? (chat_topy-1) : (chat_topy)), - '\x1A' | V_SNAPTOBOTTOM | V_SNAPTOLEFT, false); // up arrow + '\x1A' | V_SNAPTOBOTTOM | V_SNAPTOLEFT | highlightflags, false); // up arrow } if (chat_scroll < chat_maxscroll) { V_DrawCharacter(chatx-9, chat_bottomy-((justscrolleddown) ? 5 : 6), - '\x1B' | V_SNAPTOBOTTOM | V_SNAPTOLEFT, false); // down arrow + '\x1B' | V_SNAPTOBOTTOM | V_SNAPTOLEFT | highlightflags, false); // down arrow } justscrolleddown = false; diff --git a/src/k_kart.c b/src/k_kart.c index ea5d10ed..af3e5d87 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5434,6 +5434,8 @@ void K_CheckSpectateStatus(void) UINT8 respawnlist[MAXPLAYERS]; UINT8 i, numingame = 0, numjoiners = 0; + if (!cv_allowteamchange.value) return; + // Get the number of players in game, and the players to be de-spectated. for (i = 0; i < MAXPLAYERS; i++) { diff --git a/src/m_menu.c b/src/m_menu.c index 6e42504b..8449e6cc 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1586,7 +1586,7 @@ menu_t MISC_HelpDef = IMAGEDEF(MISC_HelpMenu); // See also G_GetGametypeColor. // -static INT32 highlightflags, recommendedflags, warningflags; +static INT32 recommendedflags, warningflags; inline static void M_GetGametypeColor(void) { @@ -7410,7 +7410,7 @@ static void M_StartServer(INT32 choice) if (cv_maxplayers.value < ssplayers+1) CV_SetValue(&cv_maxplayers, ssplayers+1); - + if (splitscreen != ssplayers) { splitscreen = ssplayers; diff --git a/src/m_menu.h b/src/m_menu.h index cb083b0e..e4070b56 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -228,6 +228,9 @@ void Screenshot_option_Onchange(void); // Addons menu updating void Addons_option_Onchange(void); +// This is now defined here so that the chat arrows can also benefit from the highlight to look good. +INT32 highlightflags; + // These defines make it a little easier to make menus #define DEFAULTMENUSTYLE(header, source, prev, x, y)\ {\ diff --git a/src/p_user.c b/src/p_user.c index dc4bdaf5..0f89f826 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1179,7 +1179,7 @@ boolean P_EndingMusic(player_t *player) bestlocalplayer = player; bestlocalpos = ((player->pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : player->kartstuff[k_position]); } - + if (G_RaceGametype() && bestlocalpos == MAXPLAYERS+1) sprintf(buffer, "k*fail"); // F-Zero death results theme else @@ -8687,7 +8687,7 @@ boolean P_SpectatorJoinGame(player_t *player) if (P_IsLocalPlayer(player) && displayplayer != consoleplayer) displayplayer = consoleplayer; - CON_LogMessage(va(M_GetText("%s entered the game.\n"), player_names[player-players])); + HU_AddChatText(va(M_GetText("\x82*%s entered the game."), player_names[player-players]), false); return true; // no more player->mo, cannot continue. } return false; diff --git a/src/v_video.c b/src/v_video.c index 39cd3d9d..d57276fa 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -952,6 +952,39 @@ void V_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 c) } } +#ifdef HWRENDER +// This is now a function since it's otherwise repeated 2 times and honestly looks retarded: +static UINT32 V_GetHWConsBackColor(void) +{ + UINT32 hwcolor; + switch (cons_backcolor.value) + { + case 0: hwcolor = 0xffffff00; break; // White + case 1: hwcolor = 0x80808000; break; // Gray + case 2: hwcolor = 0xdeb88700; break; // Sepia + case 3: hwcolor = 0x40201000; break; // Brown + case 4: hwcolor = 0xfa807200; break; // Pink + case 5: hwcolor = 0xff69b400; break; // Raspberry + case 6: hwcolor = 0xff000000; break; // Red + case 7: hwcolor = 0xffd68300; break; // Creamsicle + case 8: hwcolor = 0xff800000; break; // Orange + case 9: hwcolor = 0xdaa52000; break; // Gold + case 10: hwcolor = 0x80800000; break; // Yellow + case 11: hwcolor = 0x00ff0000; break; // Emerald + case 12: hwcolor = 0x00800000; break; // Green + case 13: hwcolor = 0x4080ff00; break; // Cyan + case 14: hwcolor = 0x4682b400; break; // Steel + case 15: hwcolor = 0x1e90ff00; break; // Periwinkle + case 16: hwcolor = 0x0000ff00; break; // Blue + case 17: hwcolor = 0xff00ff00; break; // Purple + case 18: hwcolor = 0xee82ee00; break; // Lavender + // Default green + default: hwcolor = 0x00800000; break; + } + return hwcolor; +} +#endif + // THANK YOU MPC!!! void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) @@ -966,28 +999,7 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) #ifdef HWRENDER if (rendermode != render_soft && rendermode != render_none) { - UINT32 hwcolor; - switch (cons_backcolor.value) - { - case 0: hwcolor = 0xffffff00; break; // White - case 1: hwcolor = 0x80808000; break; // Gray - case 2: hwcolor = 0x40201000; break; // Brown - case 3: hwcolor = 0xfa807200; break; // Pink - case 4: hwcolor = 0xff69b400; break; // Rose - case 5: hwcolor = 0xff000000; break; // Red - case 6: hwcolor = 0xff800000; break; // Orange - case 7: hwcolor = 0xdaa52000; break; // Gold - case 8: hwcolor = 0x80800000; break; // Yellow - case 9: hwcolor = 0x00ff0000; break; // Emerald - case 10: hwcolor = 0x00800000; break; // Green - case 11: hwcolor = 0x4080ff00; break; // Cyan - case 12: hwcolor = 0x4682b400; break; // Steel - case 13: hwcolor = 0x0000ff00; break; // Blue - case 14: hwcolor = 0xff00ff00; break; // Purple - case 15: hwcolor = 0xee82ee00; break; // Lavender - // Default green - default: hwcolor = 0x00800000; break; - } + UINT32 hwcolor = V_GetHWConsBackColor(); HWR_DrawConsoleFill(x, y, w, h, hwcolor, c); // we still use the regular color stuff but only for flags. actual draw color is "hwcolor" for this. return; } @@ -1233,29 +1245,7 @@ void V_DrawFadeConsBack(INT32 plines) #ifdef HWRENDER // not win32 only 19990829 by Kin if (rendermode != render_soft && rendermode != render_none) { - UINT32 hwcolor; - switch (cons_backcolor.value) - { - case 0: hwcolor = 0xffffff00; break; // White - case 1: hwcolor = 0x80808000; break; // Gray - case 2: hwcolor = 0x40201000; break; // Brown - case 3: hwcolor = 0xfa807200; break; // Pink - case 4: hwcolor = 0xff69b400; break; // Rose - case 5: hwcolor = 0xff000000; break; // Red - case 6: hwcolor = 0xff800000; break; // Orange - case 7: hwcolor = 0xdaa52000; break; // Gold - case 8: hwcolor = 0x80800000; break; // Yellow - case 9: hwcolor = 0x00ff0000; break; // Emerald - case 10: hwcolor = 0x00800000; break; // Green - case 11: hwcolor = 0x4080ff00; break; // Cyan - case 12: hwcolor = 0x4682b400; break; // Steel - case 13: hwcolor = 0x0000ff00; break; // Blue - case 14: hwcolor = 0xff00ff00; break; // Purple - case 15: hwcolor = 0xee82ee00; break; // Lavender - - // Default green - default: hwcolor = 0x00800000; break; - } + UINT32 hwcolor = V_GetHWConsBackColor(); HWR_DrawConsoleBack(hwcolor, plines); return; } @@ -1362,10 +1352,10 @@ void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UI w = (vid.width < 640 ) ? (SHORT(hu_font[c]->width)/2) : (SHORT(hu_font[c]->width)); // use normal sized characters if we're using a terribly low resolution. if (x + w > vid.width) return; - + V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, (vid.width < 640) ? (FRACUNIT) : (FRACUNIT/2), flags, hu_font[c], colormap); - + } // Precompile a wordwrapped string to any given width. From 20cfd80767aca088c9bf3898e11ded0a6ca9771c Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Thu, 25 Oct 2018 19:41:14 +0200 Subject: [PATCH 7/8] Fixed the menu highlight thing --- src/hu_stuff.c | 5 +++-- src/m_menu.c | 9 ++++++++- src/m_menu.h | 3 +-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index f0c773e1..45a2aac1 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1406,6 +1406,7 @@ static void HU_drawChatLog(INT32 offset) INT32 x = chatx+2, y, dx = 0, dy = 0; UINT32 i = 0; INT32 chat_topy, chat_bottomy; + INT32 highlight = HU_GetHighlightColor(); boolean atbottom = false; // make sure that our scroll position isn't "illegal"; @@ -1503,12 +1504,12 @@ static void HU_drawChatLog(INT32 offset) if (chat_scroll > 0) { V_DrawCharacter(chatx-9, ((justscrolledup) ? (chat_topy-1) : (chat_topy)), - '\x1A' | V_SNAPTOBOTTOM | V_SNAPTOLEFT | highlightflags, false); // up arrow + '\x1A' | V_SNAPTOBOTTOM | V_SNAPTOLEFT | highlight, false); // up arrow } if (chat_scroll < chat_maxscroll) { V_DrawCharacter(chatx-9, chat_bottomy-((justscrolleddown) ? 5 : 6), - '\x1B' | V_SNAPTOBOTTOM | V_SNAPTOLEFT | highlightflags, false); // down arrow + '\x1B' | V_SNAPTOBOTTOM | V_SNAPTOLEFT | highlight, false); // down arrow } justscrolleddown = false; diff --git a/src/m_menu.c b/src/m_menu.c index 8449e6cc..1827bf7b 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1586,7 +1586,7 @@ menu_t MISC_HelpDef = IMAGEDEF(MISC_HelpMenu); // See also G_GetGametypeColor. // -static INT32 recommendedflags, warningflags; +static INT32 highlightflags, recommendedflags, warningflags; inline static void M_GetGametypeColor(void) { @@ -1646,6 +1646,13 @@ inline static void M_GetGametypeColor(void) highlightflags = V_YELLOWMAP; // FALLBACK } +// excuse me but I'm extremely lazy: +INT32 HU_GetHighlightColor(void) +{ + M_GetGametypeColor(); // update flag colour reguardless of the menu being opened or not. + return highlightflags; +} + // Sky Room menu_t SR_PandoraDef = { diff --git a/src/m_menu.h b/src/m_menu.h index e4070b56..c300380b 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -228,8 +228,7 @@ void Screenshot_option_Onchange(void); // Addons menu updating void Addons_option_Onchange(void); -// This is now defined here so that the chat arrows can also benefit from the highlight to look good. -INT32 highlightflags; +INT32 HU_GetHighlightColor(void); // These defines make it a little easier to make menus #define DEFAULTMENUSTYLE(header, source, prev, x, y)\ From b9c6210822b7b147820deb3b289c6587dbce2dcc Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Thu, 25 Oct 2018 20:02:43 +0200 Subject: [PATCH 8/8] Reimplemented the splitscreen chat fix --- src/hu_stuff.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 45a2aac1..4210b70e 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1057,6 +1057,26 @@ boolean HU_Responder(event_t *ev) // only KeyDown events now... + // Shoot, to prevent P1 chatting from ruining the game for everyone else, it's either: + // A. completely disallow opening chat entirely in online splitscreen + // or B. iterate through all controls to make sure it's bound to player 1 before eating + // You can see which one I chose. + // (Unless if you're sharing a keyboard, since you probably establish when you start chatting that you have dibs on it...) + // (Ahhh, the good ol days when I was a kid who couldn't afford an extra USB controller...) + + if (ev->data1 >= KEY_MOUSE1) + { + INT32 i; + for (i = 0; i < num_gamecontrols; i++) + { + if (gamecontrol[i][0] == ev->data1 || gamecontrol[i][1] == ev->data1) + break; + } + + if (i == num_gamecontrols) + return false; + } + if (!chat_on) { // enter chat mode