X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fskinlist.qc;h=c849254e8b85c66a925a5f2d8bcdc28b1d285bbb;hb=86c9dc7c3696c329496b06375c1e79fb407401ce;hp=936ca7baf1125253a3698b784b2fc433721a30d0;hpb=853b6160a59c1e6f1b67af9abd43cf98d25b8625;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/skinlist.qc b/qcsrc/menu/xonotic/skinlist.qc index 936ca7baf..c849254e8 100644 --- a/qcsrc/menu/xonotic/skinlist.qc +++ b/qcsrc/menu/xonotic/skinlist.qc @@ -2,18 +2,18 @@ #define SKINLIST_H #include "listbox.qc" CLASS(XonoticSkinList, XonoticListBox) - METHOD(XonoticSkinList, configureXonoticSkinList, void(entity)) + METHOD(XonoticSkinList, configureXonoticSkinList, void(entity)); ATTRIB(XonoticSkinList, rowsPerItem, float, 4) - METHOD(XonoticSkinList, resizeNotify, void(entity, vector, vector, vector, vector)) - METHOD(XonoticSkinList, drawListBoxItem, void(entity, float, vector, float)) - METHOD(XonoticSkinList, getSkins, void(entity)) - METHOD(XonoticSkinList, setSkin, void(entity)) - METHOD(XonoticSkinList, loadCvars, void(entity)) - METHOD(XonoticSkinList, saveCvars, void(entity)) - METHOD(XonoticSkinList, skinParameter, string(entity, float, float)) - METHOD(XonoticSkinList, doubleClickListBoxItem, void(entity, float, vector)) - METHOD(XonoticSkinList, keyDown, float(entity, float, float, float)) - METHOD(XonoticSkinList, destroy, void(entity)) + METHOD(XonoticSkinList, resizeNotify, void(entity, vector, vector, vector, vector)); + METHOD(XonoticSkinList, drawListBoxItem, void(entity, int, vector, bool, bool)); + METHOD(XonoticSkinList, getSkins, void(entity)); + METHOD(XonoticSkinList, setSkin, void(entity)); + METHOD(XonoticSkinList, loadCvars, void(entity)); + METHOD(XonoticSkinList, saveCvars, void(entity)); + METHOD(XonoticSkinList, skinParameter, string(entity, float, float)); + METHOD(XonoticSkinList, doubleClickListBoxItem, void(entity, float, vector)); + METHOD(XonoticSkinList, keyDown, float(entity, float, float, float)); + METHOD(XonoticSkinList, destroy, void(entity)); ATTRIB(XonoticSkinList, skinlist, float, -1) ATTRIB(XonoticSkinList, realFontSize, vector, '0 0 0') @@ -66,7 +66,7 @@ void XonoticSkinList_loadCvars(entity me) { if(me.skinParameter(me, i, SKINPARM_NAME) == s) { - me.selectedItem = i; + me.setSelected(me, i); break; } } @@ -85,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); @@ -100,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, _("")); 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') @@ -110,14 +111,19 @@ void XonoticSkinList_getSkins(entity me) fh = fopen(language_filename(s), FILE_READ); if(fh < 0) { - print("Warning: can't open skinvalues.txt file\n"); + LOG_INFO("Warning: can't open skinvalues.txt file\n"); continue; } while((s = fgets(fh))) { // 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)); } @@ -151,12 +157,17 @@ void XonoticSkinList_resizeNotify(entity me, vector relOrigin, vector relSize, v me.columnNameSize = 1 - me.columnPreviewSize - 2 * me.realFontSize.x; } -void XonoticSkinList_drawListBoxItem(entity me, float i, vector absSize, float isSelected) +void XonoticSkinList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused) { string s; if(isSelected) draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED); + else if(isFocused) + { + me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED); + draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha); + } s = me.skinParameter(me, i, SKINPARM_PREVIEW); draw_Picture(me.columnPreviewOrigin * eX, s, me.columnPreviewSize * eX + eY, '1 1 1', 1);