Use 0 to 260 degree in Angle display, and do not display decimals of speed in debughd

This commit is contained in:
c0d3d3v 2022-06-15 10:52:29 +02:00
parent 44478b13ba
commit 6e8efa9204
No known key found for this signature in database
GPG key ID: 068AF680530DFF31
2 changed files with 12 additions and 8 deletions

View file

@ -37,15 +37,15 @@ void CDebugHud::RenderNetCorrections()
x = Width - 10.0f;
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "%.2f Bps", Velspeed / 32);
str_format(aBuf, sizeof(aBuf), "%.0f Bps", Velspeed / 32);
float w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
TextRender()->Text(0, x - w, y, Fontsize, aBuf, -1.0f);
y += LineHeight;
str_format(aBuf, sizeof(aBuf), "%.2f Bps", VelspeedX / 32 * Ramp);
str_format(aBuf, sizeof(aBuf), "%.0f Bps", VelspeedX / 32 * Ramp);
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
TextRender()->Text(0, x - w, y, Fontsize, aBuf, -1.0f);
y += LineHeight;
str_format(aBuf, sizeof(aBuf), "%.2f Bps", VelspeedY / 32);
str_format(aBuf, sizeof(aBuf), "%.0f Bps", VelspeedY / 32);
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
TextRender()->Text(0, x - w, y, Fontsize, aBuf, -1.0f);
y += LineHeight;

View file

@ -1390,17 +1390,21 @@ void CHud::RenderMovementInformation(const int ClientID)
DisplaySpeedX *= (m_pClient->m_Snap.m_aCharacters[ClientID].m_ExtendedDisplayInfo.m_RampValue / 1000.0f);
}
float Angle = Character->m_Angle / 256.0f;
if(Angle > pi)
{
Angle -= 2.0f * pi;
}
float Angle = 0.0f;
if(m_pClient->m_Snap.m_aCharacters[ClientID].m_HasExtendedDisplayInfo)
{
// On DDNet servers the more accurate angle is displayed, calculated from the target coordinates
CNetObj_DDNetCharacterDisplayInfo *CharacterDisplayInfo = &m_pClient->m_Snap.m_aCharacters[ClientID].m_ExtendedDisplayInfo;
Angle = atan2f(CharacterDisplayInfo->m_TargetY, CharacterDisplayInfo->m_TargetX);
}
else
{
Angle = Character->m_Angle / 256.0f;
}
if(Angle < 0)
{
Angle += 2.0f * pi;
}
float DisplayAngle = Angle * 180.0f / pi;
char aBuf[128];