MCPcopy Create free account
hub / github.com/assaultcube/AC / r_accuracy

Function r_accuracy

source/src/weapon.cpp:880–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

878VARP(accuracy,0,0,1);
879
880void r_accuracy(int h)
881{
882 int i = player1->weaponsel->type;
883 if(accuracy && valid_weapon(i))
884 {
885 int x_offset = 2 * HUDPOS_X_BOTTOMLEFT, y_offset = 2 * (h - 1.75 * FONTH);
886 string line;
887 float acc = accuracym[i].shots ? 100.0 * accuracym[i].hits / (float)accuracym[i].shots : 0;
888 if(i == GUN_GRENADE || i == GUN_SHOTGUN)
889 {
890 formatstring(line)("\f5%5.1f%% (%.1f/%d): \f0%s", acc, accuracym[i].hits, accuracym[i].shots, weapstr(i));
891 }
892 else
893 {
894 formatstring(line)("\f5%5.1f%% (%d/%d): \f0%s", acc, (int)accuracym[i].hits, accuracym[i].shots, weapstr(i));
895 }
896 blendbox(x_offset, y_offset + FONTH, x_offset + text_width(line) + 2 * FONTH, y_offset - FONTH, false, -1);
897 draw_textf("%s", x_offset + FONTH, y_offset - 0.5 * FONTH, line);
898 }
899}
900
901void accuracyinfo()
902{

Callers 1

gl_drawhudFunction · 0.85

Calls 4

weapstrFunction · 0.85
blendboxFunction · 0.85
text_widthFunction · 0.85
draw_textfFunction · 0.85

Tested by

no test coverage detected