]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use me instead of this in guide menu dialogs
authorotta8634 <k9wolf@pm.me>
Thu, 2 Jan 2025 06:33:01 +0000 (14:33 +0800)
committerotta8634 <k9wolf@pm.me>
Thu, 2 Jan 2025 06:33:01 +0000 (14:33 +0800)
Makes it more consistent with (almost) the rest of the menu dialogs.

qcsrc/menu/xonotic/dialog_multiplayer_media_guide.qc
qcsrc/menu/xonotic/guide/description.qc
qcsrc/menu/xonotic/guide/entries.qc
qcsrc/menu/xonotic/guide/topics.qc

index 73f493e1056f3078f1c3549cfd0fef8da04cbf59..b3c2c432f35cae8f4041041463ebe7ded36fbd78 100644 (file)
@@ -4,50 +4,50 @@
 #include "maplist.qh"
 #include "textlabel.qh"
 
-void XonoticGuideTab_fill(entity this)
+void XonoticGuideTab_fill(entity me)
 {
-       entity topics = this.topicList;
+       entity topics = me.topicList;
                topics.onChange = XonoticGuideTab_topicChangeNotify;
-               topics.onChangeEntity = this;
-       entity entries = this.entryList;
+               topics.onChangeEntity = me;
+       entity entries = me.entryList;
                entries.onChange = XonoticGuideTab_entryChangeNotify;
-               entries.onChangeEntity = this;
+               entries.onChangeEntity = me;
        entity filter = entries.stringFilterBox = makeXonoticInputBox(false, string_null);
                filter.keyDown = MapList_StringFilterBox_keyDown;
                filter.onChange = MapList_StringFilterBox_Change;
                filter.onChangeEntity = entries;
        entries.controlledTextbox = filter;
-       entity description = this.descriptionPane;
+       entity description = me.descriptionPane;
 
        int
        col = 0, width = 1.5;
-       this.gotoRC(this, 0, col);
-               this.TD(this, 1, width, makeXonoticHeaderLabel(_("Topic")));
-       this.TR(this);
-               this.TD(this, this.rows - 1, width, topics);
+       me.gotoRC(me, 0, col);
+               me.TD(me, 1, width, makeXonoticHeaderLabel(_("Topic")));
+       me.TR(me);
+               me.TD(me, me.rows - 1, width, topics);
 
        col += width, width = 2;
-       this.gotoRC(this, 0, col); this.setFirstColumn(this, this.currentColumn);
-               this.TD(this, 1, width, makeXonoticHeaderLabel(_("Entry")));
-       this.TR(this);
-               this.TD(this, this.rows - 1 - 1, width, entries);
-       this.gotoRC(this, this.rows - 1, col);
-               this.TD(this, 1, 0.3, makeXonoticTextLabel(0, _("Filter:")));
-               this.TD(this, 1, width - 0.3, filter);
+       me.gotoRC(me, 0, col); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, width, makeXonoticHeaderLabel(_("Entry")));
+       me.TR(me);
+               me.TD(me, me.rows - 1 - 1, width, entries);
+       me.gotoRC(me, me.rows - 1, col);
+               me.TD(me, 1, 0.3, makeXonoticTextLabel(0, _("Filter:")));
+               me.TD(me, 1, width - 0.3, filter);
 
        col += width, width = 2.5;
-       this.gotoRC(this, 0, col); this.setFirstColumn(this, this.currentColumn);
-               this.TD(this, 1, width, makeXonoticHeaderLabel(_("Description")));
-       this.TR(this);
-               this.TD(this, this.rows - 1, width, description);
+       me.gotoRC(me, 0, col); me.setFirstColumn(me, me.currentColumn);
+               me.TD(me, 1, width, makeXonoticHeaderLabel(_("Description")));
+       me.TR(me);
+               me.TD(me, me.rows - 1, width, description);
 
-       this.topicChangeNotify(topics, this);
+       me.topicChangeNotify(topics, me);
 }
 
-void XonoticGuideTab_topicChangeNotify(entity, entity this)
+void XonoticGuideTab_topicChangeNotify(entity, entity me)
 {
-       entity topics = this.topicList;
-       entity entries = this.entryList;
+       entity topics = me.topicList;
+       entity entries = me.entryList;
        int i = topics.selectedItem;
        int idx = 0;
        entity found = NULL;
@@ -67,10 +67,10 @@ void XonoticGuideTab_topicChangeNotify(entity, entity this)
        entries.setSelected(entries, 0);
 }
 
-void XonoticGuideTab_entryChangeNotify(entity, entity this)
+void XonoticGuideTab_entryChangeNotify(entity, entity me)
 {
-       entity desc = this.descriptionPane;
-       entity entries = this.entryList;
+       entity desc = me.descriptionPane;
+       entity entries = me.entryList;
        entity e = entries.source.getEntry(entries.source, entries.selectedItem, func_null);
        string s = e.describe(e);
        if (gamestatus & GAME_DEVELOPER)
index bf198cc8d28b2b8aedd08b8b93de6e7b15f56dee..b0f2dc234dced83e0278fa7c7d6216895f87e856 100644 (file)
@@ -1,46 +1,46 @@
 #include "description.qh"
 
-void XonoticGuideDescription_drawListBoxItem(entity this, int i, vector absSize, bool isSelected, bool isFocused)
+void XonoticGuideDescription_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
-       tokenizebyseparator(this.descriptionWrapped, "\n");
-       draw_Text(this.realFontSize.x * eX + this.realUpperMargin * eY, argv(i), this.realFontSize, '1 1 1', 1, true);
+       tokenizebyseparator(me.descriptionWrapped, "\n");
+       draw_Text(me.realFontSize.x * eX + me.realUpperMargin * eY, argv(i), me.realFontSize, '1 1 1', 1, true);
 }
 
-void XonoticGuideDescription_setDescription(entity this, string desc)
+void XonoticGuideDescription_setDescription(entity me, string desc)
 {
-       string current = this.description;
+       string current = me.description;
        if (current && current != desc)
                strunzone(current);
-       this.description = strzone(desc);
+       me.description = strzone(desc);
 
-       string currentWrapped = this.descriptionWrapped;
+       string currentWrapped = me.descriptionWrapped;
        if (currentWrapped)
                strunzone(currentWrapped);
 
        string wrapped = "";
-       // horizontal padding is this.realFontSize.x on both sides
-       float maxWidth = 1 - 2 * this.realFontSize.x;
+       // horizontal padding is me.realFontSize.x on both sides
+       float maxWidth = 1 - 2 * me.realFontSize.x;
        for (int i = 0, n = tokenizebyseparator(desc, "\n"); i < n; ++i)
        {
                string line = "";
                for (getWrappedLine_remaining = argv(i); getWrappedLine_remaining; )
                {
-                       string s = getWrappedLine(maxWidth, this.realFontSize, draw_TextWidth_WithColors);
+                       string s = getWrappedLine(maxWidth, me.realFontSize, draw_TextWidth_WithColors);
                        line = strcat(line, "\n", s);
                }
                wrapped = strcat(wrapped, line);
        }
-       this.descriptionWrapped = strzone(wrapped);
+       me.descriptionWrapped = strzone(wrapped);
 
-       this.nItems = tokenizebyseparator(wrapped, "\n");
+       me.nItems = tokenizebyseparator(wrapped, "\n");
 }
 
-void XonoticGuideDescription_resizeNotify(entity this, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+void XonoticGuideDescription_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
 {
-       SUPER(XonoticGuideDescription).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
+       SUPER(XonoticGuideDescription).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
 
-       this.realFontSize_y = this.fontSize / (absSize.y * this.itemHeight);
-       this.realFontSize_x = this.fontSize / (absSize.x * (1 - this.controlWidth));
-       this.realUpperMargin = 0.5 * (1 - this.realFontSize.y);
-       this.setDescription(this, this.description);
+       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.setDescription(me, me.description);
 }
index 5d7fe8e96ba44f461ad6c73fa4ebdc7b91d0c201..f801b30f7de119bc7c6e4a9c0b4e22bd60e07396 100644 (file)
@@ -11,18 +11,18 @@ void XonoticEntryList_cb(string _name, string _icon)
        XonoticEntryList_cb_icon = _icon;
 }
 
-void XonoticEntryList_drawListBoxItem(entity this, int i, vector absSize, bool isSelected, bool isFocused)
+void XonoticEntryList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
-       if (!this.source) return;
-       if (!this.source.getEntry(this.source, i, XonoticEntryList_cb)) return;
+       if (!me.source) return;
+       if (!me.source.getEntry(me.source, i, XonoticEntryList_cb)) return;
        string name = XonoticEntryList_cb_name;
        string icon = XonoticEntryList_cb_icon;
        if (isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
        else if (isFocused)
        {
-               this.focusedItemAlpha = getFadedAlpha(this.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, this.focusedItemAlpha);
+               me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
        }
        vector sz = draw_PictureSize(icon);
        if (!sz)
@@ -30,12 +30,12 @@ void XonoticEntryList_drawListBoxItem(entity this, int i, vector absSize, bool i
        float szr = sz.x / sz.y;
        if (strstrofs(icon, "map", 0) >= 0)
                szr = 4 / 3;
-       float asr = this.itemAbsSize.x / this.itemAbsSize.y;
+       float asr = me.itemAbsSize.x / me.itemAbsSize.y;
        sz.y = 1;
        sz.x = szr / asr;
        draw_Picture('0 0 0', icon, sz, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
-       string s = draw_TextShortenToWidth(strdecolorize(name), 1 - sz.x - 2 * this.realFontSize.x, 0, this.realFontSize);
-       draw_Text(this.realUpperMargin1 * eY + (sz.x + 0.5 * this.realFontSize.x) * eX, s, this.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
+       string s = draw_TextShortenToWidth(strdecolorize(name), 1 - sz.x - 2 * me.realFontSize.x, 0, me.realFontSize);
+       draw_Text(me.realUpperMargin1 * eY + (sz.x + 0.5 * me.realFontSize.x) * eX, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
 }
 
 METHOD(XonoticEntryList, keyDown, float(entity this, float scan, float ascii, float shift))
@@ -76,32 +76,32 @@ METHOD(XonoticEntryList, keyDown, float(entity this, float scan, float ascii, fl
        return SUPER(XonoticEntryList).keyDown(this, scan, ascii, shift);
 }
 
-void XonoticEntryList_refilter(entity this)
+void XonoticEntryList_refilter(entity me)
 {
-       if (!this.source)
+       if (!me.source)
        {
-               this.nItems = 0;
+               me.nItems = 0;
                return;
        }
-       this.nItems = this.source.reload(this.source, this.stringFilter);
-       for (int i = 0, n = this.nItems; i < n; ++i)
-               if (this.source.getEntry(this.source, i, XonoticEntryList_cb))
+       me.nItems = me.source.reload(me.source, me.stringFilter);
+       for (int i = 0, n = me.nItems; i < n; ++i)
+               if (me.source.getEntry(me.source, i, XonoticEntryList_cb))
                        draw_PreloadPicture(XonoticEntryList_cb_icon);
 }
 
-void XonoticEntryList_resizeNotify(entity this, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+void XonoticEntryList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
 {
-       this.itemAbsSize = '0 0 0';
-       SUPER(XonoticEntryList).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
+       me.itemAbsSize = '0 0 0';
+       SUPER(XonoticEntryList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
 
-       this.realFontSize_y = this.fontSize / (this.itemAbsSize_y = (absSize.y * this.itemHeight));
-       this.realFontSize_x = this.fontSize / (this.itemAbsSize_x = (absSize.x * (1 - this.controlWidth)));
-       this.realUpperMargin1 = 0.5 * (1 - 2.5 * this.realFontSize.y);
-       this.realUpperMargin2 = this.realUpperMargin1 + 1.5 * this.realFontSize.y;
+       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight));
+       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth)));
+       me.realUpperMargin1 = 0.5 * (1 - 2.5 * me.realFontSize.y);
+       me.realUpperMargin2 = me.realUpperMargin1 + 1.5 * me.realFontSize.y;
 }
 
-void XonoticEntryList_setSelected(entity this, int i)
+void XonoticEntryList_setSelected(entity me, int i)
 {
-       SUPER(XonoticEntryList).setSelected(this, i);
-       this.onChange(this, this.onChangeEntity);
+       SUPER(XonoticEntryList).setSelected(me, i);
+       me.onChange(me, me.onChangeEntity);
 }
index 369509f9f9cd638497d107ede7713f962991f5a5..d62f2ae9533c1cecd73eebe33975e3fb6d1adea5 100644 (file)
@@ -2,7 +2,7 @@
 
 #include <menu/xonotic/guide/entries.qh>
 
-void XonoticTopicList_clickListBoxItem(entity this, float i, vector where)
+void XonoticTopicList_clickListBoxItem(entity me, float i, vector where)
 {
        m_play_click_sound(MENU_SOUND_SELECT);
 }
@@ -14,55 +14,55 @@ void XonoticTopicList_cb(string _name, string _icon)
        XonoticTopicList_cb_icon = _icon;
 }
 
-void XonoticTopicList_drawListBoxItem(entity this, int i, vector absSize, bool isSelected, bool isFocused)
+void XonoticTopicList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
-       if (!this.source) return;
-       if (!this.source.getEntry(this.source, i, XonoticTopicList_cb)) return;
+       if (!me.source) return;
+       if (!me.source.getEntry(me.source, i, XonoticTopicList_cb)) return;
        string icon = XonoticTopicList_cb_icon;
        string name = XonoticTopicList_cb_name;
        if (isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
        else if (isFocused)
        {
-               this.focusedItemAlpha = getFadedAlpha(this.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
-               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, this.focusedItemAlpha);
+               me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
        }
-       draw_Picture(this.columnIconOrigin * eX, icon, this.columnIconSize * eX + eY, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
+       draw_Picture(me.columnIconOrigin * eX, icon, me.columnIconSize * eX + eY, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
        vector save_fontscale = draw_fontscale;
-       float f = draw_CondensedFontFactor(name, false, this.realFontSize, 1);
+       float f = draw_CondensedFontFactor(name, false, me.realFontSize, 1);
        draw_fontscale.x *= f;
-       vector fs = this.realFontSize;
+       vector fs = me.realFontSize;
        fs.x *= f;
-       draw_Text(this.realUpperMargin * eY + this.columnNameOrigin * eX, name, fs, '1 1 1', SKINALPHA_TEXT, 0);
+       draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, name, fs, '1 1 1', SKINALPHA_TEXT, 0);
        draw_fontscale = save_fontscale;
 }
 
-bool XonoticTopicList_keyDown(entity this, float scan, float ascii, float shift)
+bool XonoticTopicList_keyDown(entity me, float scan, float ascii, float shift)
 {
        if (scan == K_ENTER || scan == K_KP_ENTER)
        {
                m_play_click_sound(MENU_SOUND_EXECUTE);
                return true;
        }
-       return SUPER(XonoticEntryList).keyDown(this, scan, ascii, shift);
+       return SUPER(XonoticEntryList).keyDown(me, scan, ascii, shift);
 }
 
-void XonoticTopicList_resizeNotify(entity this, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+void XonoticTopicList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
 {
-       this.itemAbsSize = '0 0 0';
-       SUPER(XonoticEntryList).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
+       me.itemAbsSize = '0 0 0';
+       SUPER(XonoticEntryList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
 
-       this.realFontSize_y = this.fontSize / (this.itemAbsSize_y = (absSize.y * this.itemHeight));
-       this.realFontSize_x = this.fontSize / (this.itemAbsSize_x = (absSize.x * (1 - this.controlWidth)));
-       this.realUpperMargin = 0.5 * (1 - this.realFontSize.y);
-       this.columnIconOrigin = 0;
-       this.columnIconSize = this.itemAbsSize.y / this.itemAbsSize.x;
-       this.columnNameOrigin = this.columnIconOrigin + this.columnIconSize + (0.5 * this.realFontSize.x);
-       this.columnNameSize = 1 - this.columnIconSize - (1.5 * this.realFontSize.x);
+       me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight));
+       me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth)));
+       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);
 }
 
-void XonoticTopicList_setSelected(entity this, int i)
+void XonoticTopicList_setSelected(entity me, int i)
 {
-       SUPER(XonoticEntryList).setSelected(this, i);
-       this.onChange(this, this.onChangeEntity);
+       SUPER(XonoticEntryList).setSelected(me, i);
+       me.onChange(me, me.onChangeEntity);
 }