- default:
- case 1:
- if(gamemode == GAME_NEXUIZ)
- unit = "in/s";
- else
- unit = "qu/s";
- f = 1.0;
- break;
- case 2:
- unit = "m/s";
- f = 0.0254;
- if(gamemode != GAME_NEXUIZ) f *= 1.5;
- // 1qu=1.5in is for non-Nexuiz only - Nexuiz players are overly large, but 1qu=1in fixes that
- break;
- case 3:
- unit = "km/h";
- f = 0.0254 * 3.6;
- if(gamemode != GAME_NEXUIZ) f *= 1.5;
- break;
- case 4:
- unit = "mph";
- f = 0.0254 * 3.6 * 0.6213711922;
- if(gamemode != GAME_NEXUIZ) f *= 1.5;
- break;
- case 5:
- unit = "knots";
- f = 0.0254 * 1.943844492; // 1 m/s = 1.943844492 knots, because 1 knot = 1.852 km/h
- if(gamemode != GAME_NEXUIZ) f *= 1.5;
- break;
+ get_showspeed_unit(showspeed.integer, &f, &unit);
+ dpsnprintf(speedstring, sizeof(speedstring), "%.0f (%.0f) %s", f*speed, f*speedxy, unit);
+ }
+ if (showtopspeed.integer)
+ {
+ qboolean topspeed_latched = false, topspeedxy_latched = false;
+ get_showspeed_unit(showtopspeed.integer, &f, &unit);
+ if (speed >= topspeed || current_time - top_time > 3)
+ {
+ topspeed = speed;
+ time(&top_time);
+ }
+ else
+ topspeed_latched = true;
+ if (speedxy >= topspeedxy || current_time - topxy_time > 3)
+ {
+ topspeedxy = speedxy;
+ time(&topxy_time);
+ }
+ else
+ topspeedxy_latched = true;
+ dpsnprintf(topspeedstring, sizeof(topspeedstring), "%s%.0f%s (%s%.0f%s) %s",
+ topspeed_latched ? "^xf00" : "^xf88", f*topspeed, "^xf88",
+ topspeedxy_latched ? "^xf00" : "^xf88", f*topspeedxy, "^xf88",
+ unit);
+ time(¤t_time);