]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/skinlist.qc
Merge branch 'master' into terencehill/menu_listbox_changes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / skinlist.qc
index de1dafaae789e92f975adbc18ced80ec3e64046f..d505a2894e4790050dfba4cce9c85d368cc31641 100644 (file)
@@ -1,5 +1,7 @@
-#ifdef INTERFACE
-CLASS(XonoticSkinList) EXTENDS(XonoticListBox)
+#ifndef SKINLIST_H
+#define SKINLIST_H
+#include "listbox.qc"
+CLASS(XonoticSkinList, XonoticListBox)
        METHOD(XonoticSkinList, configureXonoticSkinList, void(entity))
        ATTRIB(XonoticSkinList, rowsPerItem, float, 4)
        METHOD(XonoticSkinList, resizeNotify, void(entity, vector, vector, vector, vector))
@@ -42,7 +44,7 @@ const float SKINPARM_COUNT = 4;
 entity makeXonoticSkinList()
 {
        entity me;
-       me = spawnXonoticSkinList();
+       me = NEW(XonoticSkinList);
        me.configureXonoticSkinList(me);
        return me;
 }
@@ -64,7 +66,7 @@ void XonoticSkinList_loadCvars(entity me)
        {
                if(me.skinParameter(me, i, SKINPARM_NAME) == s)
                {
-                       me.selectedItem = i;
+                       me.setSelected(me, i);
                        break;
                }
        }
@@ -83,7 +85,7 @@ string XonoticSkinList_skinParameter(entity me, float i, float key)
 void XonoticSkinList_getSkins(entity me)
 {
        float glob, buf, i, n, fh;
-       string s;
+       string s, name;
 
        buf = buf_create();
        glob = search_begin("gfx/menu/*/skinvalues.txt", true, true);
@@ -98,7 +100,8 @@ void XonoticSkinList_getSkins(entity me)
        for(i = 0; i < n; ++i)
        {
                s = search_getfilename(glob, i);
-               bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_NAME, substring(s, 9, strlen(s) - 24)); // the * part
+               name = substring(s, 9, strlen(s) - 24); // the * part
+               bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_NAME, name);
                bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_TITLE, _("<TITLE>"));
                bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_AUTHOR, _("<AUTHOR>"));
                if(draw_PictureSize(strcat("/gfx/menu/", substring(s, 9, strlen(s) - 24), "/skinpreview")) == '0 0 0')
@@ -115,7 +118,12 @@ void XonoticSkinList_getSkins(entity me)
                {
                        // these two are handled by skinlist.qc
                        if(substring(s, 0, 6) == "title ")
-                               bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_TITLE, substring(s, 6, strlen(s) - 6));
+                       {
+                               if (name == cvar_defstring("menu_skin"))
+                                       bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_TITLE, strcat(substring(s, 6, strlen(s) - 6), " (", _("Default"), ")"));
+                               else
+                                       bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_TITLE, substring(s, 6, strlen(s) - 6));
+                       }
                        else if(substring(s, 0, 7) == "author ")
                                bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_AUTHOR, substring(s, 7, strlen(s) - 7));
                }