X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fgametypelist.qc;h=eac075a9c041f16f78b1f139ff505c245e5c5af5;hp=45f493bb9b295dde44119e74ce24dddacea7bad5;hb=20387ff9f8cef7536362de05c76cc0062416a64c;hpb=1ba59bdc6b1e1ad0368f34dbd297e40cc42be243 diff --git a/qcsrc/menu/xonotic/gametypelist.qc b/qcsrc/menu/xonotic/gametypelist.qc index 45f493bb9b..eac075a9c0 100644 --- a/qcsrc/menu/xonotic/gametypelist.qc +++ b/qcsrc/menu/xonotic/gametypelist.qc @@ -2,12 +2,13 @@ CLASS(XonoticGametypeList) EXTENDS(XonoticListBox) METHOD(XonoticGametypeList, configureXonoticGametypeList, void(entity)) ATTRIB(XonoticGametypeList, rowsPerItem, float, 2) - METHOD(XonoticGametypeList, drawListBoxItem, void(entity, float, vector, float)) + METHOD(XonoticGametypeList, drawListBoxItem, void(entity, int, vector, bool, float)) METHOD(XonoticGametypeList, resizeNotify, void(entity, vector, vector, vector, vector)) METHOD(XonoticGametypeList, setSelected, void(entity, float)) METHOD(XonoticGametypeList, loadCvars, void(entity)) METHOD(XonoticGametypeList, saveCvars, void(entity)) METHOD(XonoticGametypeList, keyDown, float(entity, float, float, float)) + METHOD(XonoticGametypeList, clickListBoxItem, void(entity, float, vector)) ATTRIB(XonoticGametypeList, realFontSize, vector, '0 0 0') ATTRIB(XonoticGametypeList, realUpperMargin, float, 0) @@ -30,12 +31,11 @@ entity makeXonoticGametypeList(void) } void XonoticGametypeList_configureXonoticGametypeList(entity me) { - float i; me.configureXonoticListBox(me); me.nItems = GameType_GetCount(); // we want the pics mipmapped - for(i = 0; i < GameType_GetCount(); ++i) + for(int i = 0; i < GameType_GetCount(); ++i) draw_PreloadPictureWithFlags(GameType_GetIcon(i), PRECACHE_PIC_MIPMAP); me.loadCvars(me); @@ -45,7 +45,6 @@ void XonoticGametypeList_setSelected(entity me, float i) SUPER(XonoticGametypeList).setSelected(me, i); me.saveCvars(me); } - void XonoticGametypeList_loadCvars(entity me) { float t; @@ -67,19 +66,24 @@ void XonoticGametypeList_loadCvars(entity me) } void XonoticGametypeList_saveCvars(entity me) { - float t; - t = GameType_GetID(me.selectedItem); - if(t == MapInfo_CurrentGametype()) + int t = GameType_GetID(me.selectedItem); + if (t == MapInfo_CurrentGametype()) { return; + } MapInfo_SwitchGameType(t); - me.parent.gameTypeChangeNotify(me.parent); + entity owner = me.parent; + if (owner) { // not set immediately + owner.gameTypeChangeNotify(owner); + } } -void XonoticGametypeList_drawListBoxItem(entity me, float i, vector absSize, float isSelected) +void XonoticGametypeList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime) { string s1, s2; if(isSelected) draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED); + else if(highlightedTime) + draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime)); draw_Picture(me.columnIconOrigin * eX, GameType_GetIcon(i), me.columnIconSize * eX + eY, '1 1 1', SKINALPHA_LISTBOX_SELECTED); s1 = GameType_GetName(i); @@ -111,15 +115,19 @@ void XonoticGametypeList_resizeNotify(entity me, vector relOrigin, vector relSiz me.columnNameOrigin = me.columnIconOrigin + me.columnIconSize + (0.5 * me.realFontSize.x); me.columnNameSize = 1 - me.columnIconSize - (1.5 * me.realFontSize.x); } - float XonoticGametypeList_keyDown(entity me, float scan, float ascii, float shift) { if(scan == K_ENTER || scan == K_KP_ENTER) { + m_play_click_sound(MENU_SOUND_EXECUTE); me.parent.gameTypeSelectNotify(me.parent); return 1; } return SUPER(XonoticGametypeList).keyDown(me, scan, ascii, shift); } +void XonoticGametypeList_clickListBoxItem(entity me, float i, vector where) +{ + m_play_click_sound(MENU_SOUND_SELECT); +} #endif