| Forum Home > HL1 Programming > [C++] Speed,Info,Velocity | ||
|---|---|---|
|
Member Posts: 27 |
cvar: cvar_t *infospeed;
regcmd: infospeed = g_Engine.pfnRegisterVariable( "666xD_infospeed","1",0);
hud_playermove: zSpeed = ppmove->flFallVelocity; g_Local.flXYspeed = sqrt(POW(ppmove->velocity[0]) + POW(ppmove->velocity[1]));
main.h: inline float __fastcall GroundDistance() { Vector vTemp = g_Local.vOrigin; vTemp[2] -= 8192; pmtrace_t *trace = g_Engine.PM_TraceLine(g_Local.vOrigin, vTemp, 1, 0, -1); vec3_t vDistance = (vTemp - g_Local.vOrigin) * trace->fraction; return -vDistance[2]; }
hud_redraw: if( infospeed->value ) { g_Arial.Print(g_Screen.iWidth / 2, g_Screen.iHeight * 0.73 + Y * 0, 255, 255, 255, 0, "Units/Sec %.2f", g_Local.flXYspeed); g_Arial.Print(g_Screen.iWidth / 2, g_Screen.iHeight * 0.76 + Y * 0, 255, 255, 255, 0, "Velocity Speed: %.5f", zSpeed ); g_Arial.Print(g_Screen.iWidth / 2, g_Screen.iHeight * 0.82 + Y * 0, 255, 255, 255, 0, "Height: %.2f", GroundDistance()); g_Arial.Print(g_Screen.iWidth / 2, g_Screen.iHeight * 0.88 + Y * 0, 255, 255, 255, 0, "Your Name Hack"); }
| |
| ||