Fix a bunch of ticking in hu_ drawing functions

This commit is contained in:
Sally Coolatta 2022-04-25 20:58:13 -04:00 committed by Eidolon
parent 48b3ea31c4
commit fa12c51fcf

View file

@ -170,6 +170,8 @@ static INT32 cechoflags = 0;
// HEADS UP INIT
//======================================================================
static tic_t resynch_ticker = 0;
#ifndef NONET
// just after
static void Command_Say_f(void);
@ -382,12 +384,12 @@ static INT16 addy = 0; // use this to make the messages scroll smoothly when one
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
size_t i;
for(i=0;i<chat_nummsg_min-1;i++) {
strcpy(chat_mini[i], chat_mini[i+1]);
chat_timers[i] = chat_timers[i+1];
}
for(i=0;i<chat_nummsg_min-1;i++) {
strcpy(chat_mini[i], chat_mini[i+1]);
chat_timers[i] = chat_timers[i+1];
}
chat_nummsg_min--; // lost 1 msg.
// use addy and make shit slide smoothly af.
@ -400,10 +402,10 @@ static void HU_removeChatText_Log(void)
{
// MPC: Don't create new arrays, just iterate through an existing one
size_t i;
for(i=0;i<chat_nummsg_log-1;i++) {
strcpy(chat_log[i], chat_log[i+1]);
}
chat_nummsg_log--; // lost 1 msg.
for(i=0;i<chat_nummsg_log-1;i++) {
strcpy(chat_log[i], chat_log[i+1]);
}
chat_nummsg_log--; // lost 1 msg.
}
#endif
@ -874,6 +876,39 @@ void HU_Ticker(void)
hu_showscores = !chat_on;
else
hu_showscores = false;
if (chat_on)
{
// count down the scroll timer.
if (chat_scrolltime > 0)
chat_scrolltime--;
}
if (netgame)
{
size_t i = 0;
// handle spam while we're at it:
for(; (i<MAXPLAYERS); i++)
{
if (stop_spamming[i] > 0)
stop_spamming[i]--;
}
// handle chat timers
for (i=0; (i<chat_nummsg_min); i++)
{
if (chat_timers[i] > 0)
chat_timers[i]--;
else
HU_removeChatText_Mini();
}
}
--cechotimer;
if (hu_redownloadinggamestate)
resynch_ticker++;
}
#ifndef NONET
@ -1854,8 +1889,6 @@ static void HU_DrawCEcho(void)
echoptr = line;
echoptr++;
}
--cechotimer;
}
static void HU_drawGametype(void)
@ -1917,9 +1950,6 @@ void HU_Drawer(void)
// draw chat string plus cursor
if (chat_on)
{
// count down the scroll timer.
if (chat_scrolltime > 0)
chat_scrolltime--;
if (!OLDCHAT)
HU_DrawChat();
else
@ -1929,30 +1959,10 @@ void HU_Drawer(void)
{
typelines = 1;
chat_scrolltime = 0;
if (!OLDCHAT && cv_consolechat.value < 2 && netgame) // Don't display minimized chat if you set the mode to Window (Hidden)
HU_drawMiniChat(); // draw messages in a cool fashion.
}
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)
{
size_t i = 0;
// handle spam while we're at it:
for(; (i<MAXPLAYERS); i++)
{
if (stop_spamming[i] > 0)
stop_spamming[i]--;
}
// handle chat timers
for (i=0; (i<chat_nummsg_min); i++)
{
if (chat_timers[i] > 0)
chat_timers[i]--;
else
HU_removeChatText_Mini();
}
}
#endif
if (cechotimer)
@ -1992,12 +2002,9 @@ void HU_Drawer(void)
// draw desynch text
if (hu_redownloadinggamestate)
{
static UINT32 resynch_ticker = 0;
char resynch_text[14];
UINT32 i;
// Animate the dots
resynch_ticker++;
strcpy(resynch_text, "Resynching");
for (i = 0; i < (resynch_ticker / 16) % 4; i++)
strcat(resynch_text, ".");