.bool disabled;
+string XonoticWeaponsList_cb_name, XonoticWeaponsList_cb_icon;
+void XonoticWeaponsList_cb(string _name, string _icon)
+{
+ XonoticWeaponsList_cb_name = _name;
+ XonoticWeaponsList_cb_icon = _icon;
+}
+
entity makeXonoticWeaponsList()
{
entity me;
{
SUPER(XonoticWeaponsList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
- me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight);
- me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth));
+ me.itemAbsSize.y = absSize.y * me.itemHeight;
+ me.itemAbsSize.x = absSize.x * (1 - me.controlWidth);
+ me.realFontSize.y = me.fontSize / me.itemAbsSize.y;
+ me.realFontSize.x = me.fontSize / me.itemAbsSize.x;
me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
+ me.columnIconOrigin = 0;
+ me.columnIconSize = me.itemAbsSize.y / me.itemAbsSize.x;
+ me.columnNameOrigin = me.columnIconOrigin + me.columnIconSize + (0.5 * me.realFontSize.x);
+ me.columnNameSize = 1 - me.columnIconSize - (1.5 * me.realFontSize.x); // unused
}
float XonoticWeaponsList_mouseDrag(entity me, vector pos)
{
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
}
e = REGISTRY_GET(Weapons, stof(argv(i)));
- string msg = e.m_name;
- if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
- msg = strcat(msg, "*");
+ e.display(e, XonoticWeaponsList_cb);
+ string msg = XonoticWeaponsList_cb_name;
+ string icon = XonoticWeaponsList_cb_icon;
+
+ draw_Picture(me.columnIconOrigin * eX, icon, me.columnIconSize * eX + eY, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
+ bool drawStar = e.spawnflags & WEP_FLAG_MUTATORBLOCKED;
vector save_fontscale = draw_fontscale;
- float f = draw_CondensedFontFactor(msg, false, me.realFontSize, 1);
+ float f = draw_CondensedFontFactor(strcat(msg, drawStar ? "*" : ""), false, me.realFontSize, 1);
draw_fontscale.x *= f;
vector fs = me.realFontSize;
fs.x *= f;
- draw_Text(me.realUpperMargin * eY, msg, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0);
+ draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, msg, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0);
+ if(drawStar)
+ draw_Text(me.realUpperMargin * eY + (me.columnNameOrigin + draw_TextWidth(msg, 0, fs)) * eX, "*", fs, SKINCOLOR_HEADER, SKINALPHA_HEADER, 0);
draw_fontscale = save_fontscale;
}
METHOD(XonoticWeaponsList, drawListBoxItem, void(entity, int, vector, bool, bool));
METHOD(XonoticWeaponsList, resizeNotify, void(entity, vector, vector, vector, vector));
METHOD(XonoticWeaponsList, keyDown, float(entity, float, float, float));
+
ATTRIB(XonoticWeaponsList, realFontSize, vector, '0 0 0');
ATTRIB(XonoticWeaponsList, realUpperMargin, float, 0);
- METHOD(XonoticWeaponsList, mouseDrag, float(entity, vector));
+ ATTRIB(XonoticWeaponsList, columnIconOrigin, float, 0);
+ ATTRIB(XonoticWeaponsList, columnIconSize, float, 0);
+ ATTRIB(XonoticWeaponsList, columnNameOrigin, float, 0);
+ ATTRIB(XonoticWeaponsList, columnNameSize, float, 0);
+ METHOD(XonoticWeaponsList, mouseDrag, float(entity, vector));
ATTRIB(XonoticWeaponsList, applyButton, entity);
ENDCLASS(XonoticWeaponsList)
entity makeXonoticWeaponsList();