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)
}
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);
SUPER(XonoticGametypeList).setSelected(me, i);
me.saveCvars(me);
}
-
void XonoticGametypeList_loadCvars(entity me)
{
float t;
}
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);
-
+
if(_MapInfo_GetTeamPlayBool(GameType_GetID(i)))
s2 = _("teamplay");
else
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