mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-02-17 09:34:02 +00:00
More HUD fuzziness
This commit is contained in:
parent
0ec2c2a26c
commit
4125076cdf
1 changed files with 31 additions and 29 deletions
|
@ -890,7 +890,7 @@ CG_DrawFPSandPing
|
||||||
|
|
||||||
static float CG_DrawFPSandPing(float y)
|
static float CG_DrawFPSandPing(float y)
|
||||||
{
|
{
|
||||||
char *s;
|
char *sfps = NULL, *sping = NULL;
|
||||||
int w;
|
int w;
|
||||||
static int previousTimes[FPS_FRAMES];
|
static int previousTimes[FPS_FRAMES];
|
||||||
static int index;
|
static int index;
|
||||||
|
@ -899,6 +899,10 @@ static float CG_DrawFPSandPing(float y)
|
||||||
static int previous;
|
static int previous;
|
||||||
int t, frameTime, x = 0, num = 0;
|
int t, frameTime, x = 0, num = 0;
|
||||||
float Color[4];
|
float Color[4];
|
||||||
|
|
||||||
|
const int expand = 4;
|
||||||
|
const int corner = 12;
|
||||||
|
const float shadowAlpha = 0.75f;
|
||||||
|
|
||||||
/*static int Pings[PING_SNAPS];
|
/*static int Pings[PING_SNAPS];
|
||||||
static int currentSnapshotNum;
|
static int currentSnapshotNum;
|
||||||
|
@ -936,17 +940,12 @@ static float CG_DrawFPSandPing(float y)
|
||||||
fps = 1000 * FPS_FRAMES / total;
|
fps = 1000 * FPS_FRAMES / total;
|
||||||
|
|
||||||
if (cg_drawFPS.integer) {
|
if (cg_drawFPS.integer) {
|
||||||
s = va("%ifps", fps);
|
sfps = va("%ifps", fps);
|
||||||
w = CG_DrawStrlen(s) * SMALLCHAR_WIDTH;
|
w = CG_DrawStrlen(sfps) * SMALLCHAR_WIDTH;
|
||||||
x = w;
|
x = w;
|
||||||
|
|
||||||
MAKERGBA(Color, 0.0f, 0.0f, 0.0f, 0.4f);
|
CG_DrawFuzzyShadow(cgs.screenXMax - x - 12 - expand, y - 1 - expand, w + 6 + expand + expand, SMALLCHAR_HEIGHT + 6 + expand + expand, 12, shadowAlpha);
|
||||||
CG_FillRect(cgs.screenXMax - x - 12, y - 1, w + 6, SMALLCHAR_HEIGHT + 6, Color);
|
CG_DrawSmallString(cgs.screenXMax - x - 9, y + 2, sfps, 1.0F);
|
||||||
|
|
||||||
MAKERGBA(Color, 0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
CG_DrawCleanRect(cgs.screenXMax - x - 12, y - 1, w + 6, SMALLCHAR_HEIGHT + 6, 1, Color);
|
|
||||||
|
|
||||||
CG_DrawSmallString(cgs.screenXMax - x - 9, y + 2, s, 1.0F);
|
|
||||||
|
|
||||||
x += 9;
|
x += 9;
|
||||||
}
|
}
|
||||||
|
@ -970,19 +969,15 @@ static float CG_DrawFPSandPing(float y)
|
||||||
else
|
else
|
||||||
avgping = 0;
|
avgping = 0;
|
||||||
|
|
||||||
s = va("%ims", avgping);
|
sping = va("%ims", avgping);
|
||||||
w = CG_DrawStrlen(s) * SMALLCHAR_WIDTH;
|
w = CG_DrawStrlen(sping) * SMALLCHAR_WIDTH;
|
||||||
x += w;
|
x += w;
|
||||||
|
|
||||||
l = (lagometer.frameCount & (LAG_SAMPLES - 1)) - 1;
|
l = (lagometer.frameCount & (LAG_SAMPLES - 1)) - 1;
|
||||||
if (l < 0) l += LAG_SAMPLES;
|
if (l < 0) l += LAG_SAMPLES;
|
||||||
|
|
||||||
MAKERGBA(Color, 0.0f, 0.0f, 0.0f, 0.4f);
|
|
||||||
CG_FillRect(cgs.screenXMax - x - 12, y - 1, w + 6, SMALLCHAR_HEIGHT + 6, Color);
|
|
||||||
|
|
||||||
MAKERGBA(Color, 0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
CG_DrawCleanRect(cgs.screenXMax - x - 12, y - 1, w + 6, SMALLCHAR_HEIGHT + 6, 1, Color);
|
|
||||||
|
|
||||||
|
CG_DrawFuzzyShadow(cgs.screenXMax - x - 12 - expand, y - 1 - expand, w + 6 + expand + expand, SMALLCHAR_HEIGHT + 6 + expand + expand, corner, shadowAlpha);
|
||||||
|
|
||||||
MAKERGBA(Color, 0.0f, 1.0f, 0.0f, 1.0f); // Green, All good
|
MAKERGBA(Color, 0.0f, 1.0f, 0.0f, 1.0f); // Green, All good
|
||||||
|
|
||||||
|
@ -992,7 +987,7 @@ static float CG_DrawFPSandPing(float y)
|
||||||
if (lagometer.snapshotFlags[l] & SNAPFLAG_RATE_DELAYED) // Yellow. Delayed packet
|
if (lagometer.snapshotFlags[l] & SNAPFLAG_RATE_DELAYED) // Yellow. Delayed packet
|
||||||
MAKERGBA(Color, 1.0f, 1.0f, 0.0f, 1.0f);
|
MAKERGBA(Color, 1.0f, 1.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
CG_DrawStringExt(cgs.screenXMax - x - 9, y + 2, s, Color, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0);
|
CG_DrawStringExt(cgs.screenXMax - x - 9, y + 2, sping, Color, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cg_drawFPS.integer && (!cg_drawPing.integer || cg.demoPlayback))
|
if (!cg_drawFPS.integer && (!cg_drawPing.integer || cg.demoPlayback))
|
||||||
|
@ -1403,6 +1398,7 @@ static float CG_DrawMessageQueue(float y)
|
||||||
int i, len;
|
int i, len;
|
||||||
vec4_t hcolor;
|
vec4_t hcolor;
|
||||||
int chatHeight;
|
int chatHeight;
|
||||||
|
int maxtime = 0;
|
||||||
float div;
|
float div;
|
||||||
|
|
||||||
#define CHATLOC_Y y
|
#define CHATLOC_Y y
|
||||||
|
@ -1425,29 +1421,35 @@ static float CG_DrawMessageQueue(float y)
|
||||||
|
|
||||||
w = 0;
|
w = 0;
|
||||||
|
|
||||||
|
div = 1.f / cg_messageQueueTime.integer;
|
||||||
|
|
||||||
for (i = cgs.teamLastChatPos; i < cgs.teamChatPos; i++) {
|
for (i = cgs.teamLastChatPos; i < cgs.teamChatPos; i++) {
|
||||||
len = CG_DrawStrlen(cgs.teamChatMsgs[i % chatHeight]);
|
int index = i % chatHeight;
|
||||||
|
len = CG_DrawStrlen(cgs.teamChatMsgs[index]);
|
||||||
if (len > w)
|
if (len > w)
|
||||||
w = len;
|
w = len;
|
||||||
|
if (cgs.teamChatMsgTimes[index] > maxtime)
|
||||||
|
maxtime = cgs.teamChatMsgTimes[index];
|
||||||
}
|
}
|
||||||
w *= TINYCHAR_WIDTH;
|
w *= TINYCHAR_WIDTH;
|
||||||
w += TINYCHAR_WIDTH * 2;
|
w += TINYCHAR_WIDTH * 2;
|
||||||
|
|
||||||
div = 1.f / cg_messageQueueTime.integer;
|
{
|
||||||
|
float frac = SmoothLerp(Com_Clamp(0.f, 1.f, 8.f * (1.f - (cg.time - maxtime) * div)));
|
||||||
|
const int expand = 8;
|
||||||
|
CG_DrawFuzzyShadow(CHATLOC_X - expand, CHATLOC_Y - h + TINYCHAR_HEIGHT - expand, w + expand + expand, h + expand + expand, 12.f, 0.5f * frac);
|
||||||
|
}
|
||||||
|
|
||||||
hcolor[0] = hcolor[1] = hcolor[2] = 1.0f;
|
hcolor[0] = hcolor[1] = hcolor[2] = 1.0f;
|
||||||
hcolor[3] = 1.0f;
|
hcolor[3] = 1.0f;
|
||||||
|
|
||||||
for (i = cgs.teamChatPos - 1; i >= cgs.teamLastChatPos; i--) {
|
for (i = cgs.teamChatPos - 1; i >= cgs.teamLastChatPos; i--) {
|
||||||
int index = i % chatHeight;
|
int index = i % chatHeight;
|
||||||
float frac = (cg.time - cgs.teamChatMsgTimes[index]) * div;
|
float frac = SmoothLerp(Com_Clamp(0.f, 1.f, 8.f * (1.f - (cg.time - cgs.teamChatMsgTimes[index]) * div)));
|
||||||
if (frac > 1.f)
|
hcolor[3] = frac;
|
||||||
continue;
|
CG_DrawStringExt(CHATLOC_X + TINYCHAR_WIDTH, CHATLOC_Y,
|
||||||
hcolor[3] = frac > 0.875f ? (1.f - frac) * 8.f : 1.f;
|
cgs.teamChatMsgs[index], hcolor, qfalse, qtrue,
|
||||||
CG_DrawStringExt(CHATLOC_X + TINYCHAR_WIDTH,
|
TINYCHAR_WIDTH, TINYCHAR_HEIGHT, 0);
|
||||||
CHATLOC_Y,
|
|
||||||
cgs.teamChatMsgs[index], hcolor, qfalse, qtrue,
|
|
||||||
TINYCHAR_WIDTH, TINYCHAR_HEIGHT, 0);
|
|
||||||
y -= TINYCHAR_HEIGHT;
|
y -= TINYCHAR_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue