about summary refs log tree commit diff
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-08-13 03:07:51 +0200
committeroy <Tom_Adams@web.de>2010-08-13 03:07:51 +0200
commitd01fb2eb7818c121ab892f29b929f55d66e4e7ce (patch)
tree3b927aab1b26759e969eb2e2e4b130f0dd51b577
parent5a237c6f78a2cfed58ec4eb9b23b81ff8925ecce (diff)
downloadzcatch-d01fb2eb7818c121ab892f29b929f55d66e4e7ce.tar.gz
zcatch-d01fb2eb7818c121ab892f29b929f55d66e4e7ce.zip
added missing information in debug mode. Closes #77
-rw-r--r--src/game/client/components/debughud.cpp54
-rw-r--r--src/game/client/gameclient.h2
2 files changed, 43 insertions, 13 deletions
diff --git a/src/game/client/components/debughud.cpp b/src/game/client/components/debughud.cpp
index 0fa004cb..6b52914b 100644
--- a/src/game/client/components/debughud.cpp
+++ b/src/game/client/components/debughud.cpp
@@ -20,24 +20,52 @@ void CDebugHud::RenderNetCorrections()
 	if(!g_Config.m_Debug || !m_pClient->m_Snap.m_pLocalCharacter || !m_pClient->m_Snap.m_pLocalPrevCharacter)
 		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),
 		vec2(netobjects.local_character->x, netobjects.local_character->y));*/
 
-/*
-	float velspeed = length(vec2(gameclient.snap.local_character->m_VelX/256.0f, gameclient.snap.local_character->m_VelY/256.0f))*50;
-	
-	float ramp = velocity_ramp(velspeed, gameclient.tuning.velramp_start, gameclient.tuning.velramp_range, gameclient.tuning.velramp_curvature);
+	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 Ramp = VelocityRamp(Velspeed, m_pClient->m_Tuning.m_VelrampStart, m_pClient->m_Tuning.m_VelrampRange, m_pClient->m_Tuning.m_VelrampCurvature);
 	
-	char buf[512];
-	str_format(buf, sizeof(buf), "%.0f\n%.0f\n%.2f\n%d %s\n%d %d",
-		velspeed, velspeed*ramp, ramp,
-		netobj_num_corrections(), netobj_corrected_on(),
-		gameclient.snap.local_character->m_X,
-		gameclient.snap.local_character->m_Y
-	);
-	TextRender()->Text(0, 150, 50, 12, buf, -1);*/
+	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;
+
+	float x = Width-100.0f, y = 50.0f;
+	for(int i = 0; i < Num; ++i)
+		TextRender()->Text(0, x, y+i*LineHeight, Fontsize, paStrings[i], -1);
+
+	x = Width-10.0f;
+	char aBuf[128];
+	str_format(aBuf, sizeof(aBuf), "%.0f", Velspeed);
+	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()
diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h
index 28043794..211e3b11 100644
--- a/src/game/client/gameclient.h
+++ b/src/game/client/gameclient.h
@@ -75,6 +75,8 @@ public:
 	class CLayers *Layers() { return &m_Layers; };
 	class CCollision *Collision() { return &m_Collision; };
 	
+	int NetobjNumCorrections() { return m_NetObjHandler.NumObjCorrections(); }
+	const char *NetobjCorrectedOn() { return m_NetObjHandler.CorrectedObjOn(); }
 
 	bool m_SuppressEvents;
 	bool m_NewTick;