2 CLASS(XonoticCrosshairPicker) EXTENDS(XonoticPicker)
3 METHOD(XonoticCrosshairPicker, configureXonoticCrosshairPicker, void(entity))
5 ATTRIB(XonoticCrosshairPicker, rows, float, 3)
6 ATTRIB(XonoticCrosshairPicker, columns, float, 12)
8 METHOD(XonoticCrosshairPicker, cellSelect, void(entity))
9 METHOD(XonoticCrosshairPicker, cellIsValid, bool(entity, vector))
10 METHOD(XonoticCrosshairPicker, cellDraw, void(entity, vector, vector, float))
11 ENDCLASS(XonoticCrosshairPicker)
12 entity makeXonoticCrosshairPicker();
17 string crosshairpicker_cellToCrosshair(entity me, vector cell)
19 float crosshair = 31 + cell.y * me.columns + cell.x;
21 if (crosshair >= 31 && crosshair < 31 + me.columns * me.rows)
22 return ftos(crosshair);
27 entity makeXonoticCrosshairPicker()
30 me = spawnXonoticCrosshairPicker();
31 me.configureXonoticCrosshairPicker(me);
35 void XonoticCrosshairPicker_configureXonoticCrosshairPicker(entity me)
37 me.configureXonoticPicker(me);
40 void XonoticCrosshairPicker_cellSelect(entity me)
42 cvar_set("crosshair", crosshairpicker_cellToCrosshair(me, me.focusedCell));
45 bool XonoticCrosshairPicker_cellIsValid(entity me, vector cell)
47 if(crosshairpicker_cellToCrosshair(me, cell) == "")
52 void XonoticCrosshairPicker_cellDraw(entity me, vector cell, vector cellPos, float highlightedTime)
55 string cross = strcat("/gfx/crosshair", crosshairpicker_cellToCrosshair(me, cell));
56 sz = draw_PictureSize(cross);
57 sz = globalToBoxSize(sz, me.size);
59 float ar = sz.x / sz.y;
60 sz.x = me.realCellSize.x;
66 vector crosshairPos = cellPos + 0.5 * me.realCellSize;
67 draw_Picture(crosshairPos - 0.5 * sz, cross, sz, rgb, me.alpha);
69 if(cvar("crosshair_dot"))
71 if(cvar("crosshair_dot_color_custom") && (cvar_string("crosshair_dot_color") != "0"))
72 rgb = stov(cvar_string("crosshair_dot_color"));
74 draw_Picture(crosshairPos - 0.5 * sz * cvar("crosshair_dot_size"), "/gfx/crosshairdot", sz * cvar("crosshair_dot_size"), rgb, me.alpha);