]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/weaponslist.qc
Merge CLASS and EXTENDS, #define NEW(cname) (spawn##cname())
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / weaponslist.qc
index 8a8e2205dde03b0ed001162728dda4e6e6783dc9..a82f2525e6be4b318127d09be7ec378059dea8df 100644 (file)
@@ -1,5 +1,5 @@
 #ifdef INTERFACE
-CLASS(XonoticWeaponsList) EXTENDS(XonoticListBox)
+CLASS(XonoticWeaponsListXonoticListBox)
        METHOD(XonoticWeaponsList, configureXonoticWeaponsList, void(entity))
        METHOD(XonoticWeaponsList, toString, string(entity))
        ATTRIB(XonoticWeaponsList, rowsPerItem, float, 1)
@@ -20,7 +20,7 @@ void WeaponsList_MoveDown_Click(entity box, entity me);
 entity makeXonoticWeaponsList()
 {
        entity me;
-       me = spawnXonoticWeaponsList();
+       me = NEW(XonoticWeaponsList);
        me.configureXonoticWeaponsList(me);
        return me;
 }
@@ -59,15 +59,14 @@ void XonoticWeaponsList_resizeNotify(entity me, vector relOrigin, vector relSize
 {
        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.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
+       me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight);
+       me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth));
+       me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
 }
 float XonoticWeaponsList_mouseDrag(entity me, vector pos)
 {
-       float f, i;
-       i = me.selectedItem;
-       f = SUPER(XonoticWeaponsList).mouseDrag(me, pos);
+       int i = me.selectedItem;
+       float f = SUPER(XonoticWeaponsList).mouseDrag(me, pos);
 
        if(me.pressed != 1) // don't change priority if the person is just scrolling
        {
@@ -102,10 +101,10 @@ void XonoticWeaponsList_drawListBoxItem(entity me, float i, vector absSize, floa
                msg = sprintf(_("%s (mutator weapon)"), msg);
 
        vector save_fontscale = draw_fontscale;
-       float f = draw_CondensedFontFactor(msg, FALSE, me.realFontSize, 1);
-       draw_fontscale_x *= f;
+       float f = draw_CondensedFontFactor(msg, false, me.realFontSize, 1);
+       draw_fontscale.x *= f;
        vector fs = me.realFontSize;
-       fs_x *= f;
+       fs.x *= f;
        draw_Text(me.realUpperMargin * eY, msg, fs, SKINCOLOR_TEXT, SKINALPHA_TEXT, 0);
        draw_fontscale = save_fontscale;
 }