added missing information in debug mode. Closes #77

This commit is contained in:
oy 2010-08-13 03:07:51 +02:00
parent 5a237c6f78
commit d01fb2eb78
2 changed files with 43 additions and 13 deletions

View file

@ -20,24 +20,52 @@ void CDebugHud::RenderNetCorrections()
if(!g_Config.m_Debug || !m_pClient->m_Snap.m_pLocalCharacter || !m_pClient->m_Snap.m_pLocalPrevCharacter) if(!g_Config.m_Debug || !m_pClient->m_Snap.m_pLocalCharacter || !m_pClient->m_Snap.m_pLocalPrevCharacter)
return; return;
Graphics()->MapScreen(0, 0, 300*Graphics()->ScreenAspect(), 300); float Width = 300*Graphics()->ScreenAspect();
Graphics()->MapScreen(0, 0, Width, 300);
/*float speed = distance(vec2(netobjects.local_prev_character->x, netobjects.local_prev_character->y), /*float speed = distance(vec2(netobjects.local_prev_character->x, netobjects.local_prev_character->y),
vec2(netobjects.local_character->x, netobjects.local_character->y));*/ vec2(netobjects.local_character->x, netobjects.local_character->y));*/
/* float Velspeed = length(vec2(m_pClient->m_Snap.m_pLocalCharacter->m_VelX/256.0f, m_pClient->m_Snap.m_pLocalCharacter->m_VelY/256.0f))*50;
float velspeed = length(vec2(gameclient.snap.local_character->m_VelX/256.0f, gameclient.snap.local_character->m_VelY/256.0f))*50; float Ramp = VelocityRamp(Velspeed, m_pClient->m_Tuning.m_VelrampStart, m_pClient->m_Tuning.m_VelrampRange, m_pClient->m_Tuning.m_VelrampCurvature);
float ramp = velocity_ramp(velspeed, gameclient.tuning.velramp_start, gameclient.tuning.velramp_range, gameclient.tuning.velramp_curvature); const char *paStrings[] = {"velspeed:", "velspeed*ramp:", "ramp:", "Pos", " x:", " y:", "netobj corrections", " num:", " on:"};
const int Num = sizeof(paStrings)/sizeof(char *);
const float LineHeight = 6.0f;
const float Fontsize = 5.0f;
char buf[512]; float x = Width-100.0f, y = 50.0f;
str_format(buf, sizeof(buf), "%.0f\n%.0f\n%.2f\n%d %s\n%d %d", for(int i = 0; i < Num; ++i)
velspeed, velspeed*ramp, ramp, TextRender()->Text(0, x, y+i*LineHeight, Fontsize, paStrings[i], -1);
netobj_num_corrections(), netobj_corrected_on(),
gameclient.snap.local_character->m_X, x = Width-10.0f;
gameclient.snap.local_character->m_Y char aBuf[128];
); str_format(aBuf, sizeof(aBuf), "%.0f", Velspeed);
TextRender()->Text(0, 150, 50, 12, buf, -1);*/ float w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
y += LineHeight;
str_format(aBuf, sizeof(aBuf), "%.0f", Velspeed*Ramp);
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
y += LineHeight;
str_format(aBuf, sizeof(aBuf), "%.2f", Ramp);
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
y += 2*LineHeight;
str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_Snap.m_pLocalCharacter->m_X);
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
y += LineHeight;
str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_Snap.m_pLocalCharacter->m_Y);
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
y += 2*LineHeight;
str_format(aBuf, sizeof(aBuf), "%d", m_pClient->NetobjNumCorrections());
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
y += LineHeight;
w = TextRender()->TextWidth(0, Fontsize, m_pClient->NetobjCorrectedOn(), -1);
TextRender()->Text(0, x-w, y, Fontsize, m_pClient->NetobjCorrectedOn(), -1);
} }
void CDebugHud::RenderTuning() void CDebugHud::RenderTuning()

View file

@ -75,6 +75,8 @@ public:
class CLayers *Layers() { return &m_Layers; }; class CLayers *Layers() { return &m_Layers; };
class CCollision *Collision() { return &m_Collision; }; class CCollision *Collision() { return &m_Collision; };
int NetobjNumCorrections() { return m_NetObjHandler.NumObjCorrections(); }
const char *NetobjCorrectedOn() { return m_NetObjHandler.CorrectedObjOn(); }
bool m_SuppressEvents; bool m_SuppressEvents;
bool m_NewTick; bool m_NewTick;