X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fgametypelist.qc;h=254f1c0012563edf052503b74a6a7cc819c75dc9;hb=280cc7f8d6a7123918b08858ee3a62d81f64c073;hp=030af6715339257b23ddb7d4a07531f1a489635c;hpb=ff442844108257ce535eae6dc08eaf659ff5efd7;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/gametypelist.qc b/qcsrc/menu/xonotic/gametypelist.qc index 030af6715..254f1c001 100644 --- a/qcsrc/menu/xonotic/gametypelist.qc +++ b/qcsrc/menu/xonotic/gametypelist.qc @@ -1,30 +1,9 @@ -#ifndef GAMETYPELIST_H -#define GAMETYPELIST_H -#include "listbox.qc" -CLASS(XonoticGametypeList, XonoticListBox) - METHOD(XonoticGametypeList, configureXonoticGametypeList, void(entity)) - ATTRIB(XonoticGametypeList, rowsPerItem, float, 2) - METHOD(XonoticGametypeList, drawListBoxItem, void(entity, int, vector, bool, bool)) - 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)) +#include "gametypelist.qh" - ATTRIB(XonoticGametypeList, realFontSize, vector, '0 0 0') - ATTRIB(XonoticGametypeList, realUpperMargin, float, 0) - ATTRIB(XonoticGametypeList, columnIconOrigin, float, 0) - ATTRIB(XonoticGametypeList, columnIconSize, float, 0) - ATTRIB(XonoticGametypeList, columnNameOrigin, float, 0) - ATTRIB(XonoticGametypeList, columnNameSize, float, 0) -ENDCLASS(XonoticGametypeList) -entity makeXonoticGametypeList(); -#endif +#include "dialog_multiplayer_create.qh" +#include -#ifdef IMPLEMENTATION - -entity makeXonoticGametypeList(void) +entity makeXonoticGametypeList() { entity me; me = NEW(XonoticGametypeList); @@ -51,8 +30,7 @@ void XonoticGametypeList_setSelected(entity me, float i) } void XonoticGametypeList_loadCvars(entity me) { - float t; - t = MapInfo_CurrentGametype(); + Gametype t = MapInfo_CurrentGametype(); float i; for(i = 0; i < GameType_GetCount(); ++i) if(t == GameType_GetID(i)) @@ -70,7 +48,7 @@ void XonoticGametypeList_loadCvars(entity me) } void XonoticGametypeList_saveCvars(entity me) { - int t = GameType_GetID(me.selectedItem); + Gametype t = GameType_GetID(me.selectedItem); if (t == MapInfo_CurrentGametype()) { return; } @@ -80,6 +58,15 @@ void XonoticGametypeList_saveCvars(entity me) owner.gameTypeChangeNotify(owner); } } +void XonoticGametypeList_draw(entity me) +{ + if(me.nItems != GameType_GetCount()) + { + me.nItems = GameType_GetCount(); + me.setSelected(me, 0); + } + SUPER(XonoticGametypeList).draw(me); +} void XonoticGametypeList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused) { string s1, s2; @@ -112,7 +99,7 @@ void XonoticGametypeList_drawListBoxItem(entity me, int i, vector absSize, bool void XonoticGametypeList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize) { me.itemAbsSize = '0 0 0'; - SUPER(XonoticServerList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); + SUPER(XonoticGametypeList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize); 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))); @@ -137,4 +124,10 @@ void XonoticGametypeList_clickListBoxItem(entity me, float i, vector where) { m_play_click_sound(MENU_SOUND_SELECT); } -#endif +void XonoticGametypeList_focusedItemChangeNotify(entity me) +{ + if(me.focusedItem >= 0) + setZonedTooltip(me, MapInfo_Type_Description(GameType_GetID(me.focusedItem)), string_null); + else + clearTooltip(me); +}