Spectate / enter game in chat + New console colours + Highlight chat scroll arrow + small cleanup for consolefill

This commit is contained in:
Latapostrophe 2018-10-25 13:21:44 +02:00
parent 26093de2e9
commit e5d4020f3e
8 changed files with 78 additions and 81 deletions

View file

@ -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;
}

View file

@ -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.

View file

@ -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;

View file

@ -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++)
{

View file

@ -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;

View file

@ -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)\
{\

View file

@ -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;

View file

@ -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.