mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 19:38:06 -04:00
count others' kills against you on the deathmatch score board (#2010)
* count others' kills against you on the deathmatch score board much more interesting with more than 2 players * factor deathmatch scoreboard out into a separate widget
This commit is contained in:
parent
5df25953b8
commit
ca4152176c
@ -758,37 +758,6 @@ static void UpdateMonSec(sbe_widget_t *widget)
|
|||||||
|
|
||||||
const int cr_blue = (widget->font == stcfnt) ? CR_BLUE2 : CR_BLUE1;
|
const int cr_blue = (widget->font == stcfnt) ? CR_BLUE2 : CR_BLUE1;
|
||||||
|
|
||||||
if (deathmatch)
|
|
||||||
{
|
|
||||||
int offset = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < MAXPLAYERS; ++i)
|
|
||||||
{
|
|
||||||
int result = 0;
|
|
||||||
|
|
||||||
if (!playeringame[i])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int p = 0; p < MAXPLAYERS; ++p)
|
|
||||||
{
|
|
||||||
if (i != p)
|
|
||||||
result += players[i].frags[p];
|
|
||||||
else
|
|
||||||
result -= players[i].frags[p];
|
|
||||||
}
|
|
||||||
|
|
||||||
offset = M_snprintf(string + offset, sizeof(string) - offset,
|
|
||||||
"\x1b%c%3d ", (i == displayplayer) ?
|
|
||||||
'0' + cr_blue : '0' + CR_GRAY, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
ST_AddLine(widget, string);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int fullkillcount = 0;
|
int fullkillcount = 0;
|
||||||
int fullitemcount = 0;
|
int fullitemcount = 0;
|
||||||
int fullsecretcount = 0;
|
int fullsecretcount = 0;
|
||||||
@ -835,6 +804,58 @@ static void UpdateMonSec(sbe_widget_t *widget)
|
|||||||
ST_AddLine(widget, string);
|
ST_AddLine(widget, string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void UpdateDM(sbe_widget_t *widget)
|
||||||
|
{
|
||||||
|
ST_ClearLines(widget);
|
||||||
|
|
||||||
|
if (!WidgetEnabled(hud_level_stats))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ForceDoomFont(widget);
|
||||||
|
|
||||||
|
static char string[120];
|
||||||
|
|
||||||
|
const int cr_blue = (widget->font == stcfnt) ? CR_BLUE2 : CR_BLUE1;
|
||||||
|
|
||||||
|
int offset = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < MAXPLAYERS; ++i)
|
||||||
|
{
|
||||||
|
int result = 0, others = 0;
|
||||||
|
|
||||||
|
if (!playeringame[i])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int p = 0; p < MAXPLAYERS; ++p)
|
||||||
|
{
|
||||||
|
if (!playeringame[p])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i != p)
|
||||||
|
{
|
||||||
|
result += players[i].frags[p];
|
||||||
|
others -= players[p].frags[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result -= players[i].frags[p];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
offset += M_snprintf(string + offset, sizeof(string) - offset,
|
||||||
|
"\x1b%c%d/%d ", (i == displayplayer) ?
|
||||||
|
'0' + cr_blue : '0' + CR_GRAY, result, others);
|
||||||
|
}
|
||||||
|
|
||||||
|
ST_AddLine(widget, string);
|
||||||
|
}
|
||||||
|
|
||||||
static void UpdateStTime(sbe_widget_t *widget, player_t *player)
|
static void UpdateStTime(sbe_widget_t *widget, player_t *player)
|
||||||
{
|
{
|
||||||
ST_ClearLines(widget);
|
ST_ClearLines(widget);
|
||||||
@ -1092,6 +1113,9 @@ void ST_UpdateWidget(sbarelem_t *elem, player_t *player)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case sbw_monsec:
|
case sbw_monsec:
|
||||||
|
if (deathmatch)
|
||||||
|
UpdateDM(widget);
|
||||||
|
else
|
||||||
UpdateMonSec(widget);
|
UpdateMonSec(widget);
|
||||||
break;
|
break;
|
||||||
case sbw_time:
|
case sbw_time:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user