X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fmaplist.c;h=60eeb445c6c4877caf508aa145ccf9c403d9e5ef;hb=935f38b6d41fb6e2579a4ee1e7c6fb0d063e5869;hp=14bf48ec9edf0f00282075f5549ce40f3456587b;hpb=70dbd52151c76d8300738a163ed92768ad606b15;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/maplist.c b/qcsrc/menu/xonotic/maplist.c index 14bf48ec9..60eeb445c 100644 --- a/qcsrc/menu/xonotic/maplist.c +++ b/qcsrc/menu/xonotic/maplist.c @@ -84,7 +84,7 @@ void XonoticMapList_g_maplistCacheToggle(entity me, float i) string a, b, c, s, bspname; float n; s = me.g_maplistCache; - if not(s) + if (!s) return; b = substring(s, i, 1); if(b == "0") @@ -98,7 +98,7 @@ void XonoticMapList_g_maplistCacheToggle(entity me, float i) strunzone(s); me.g_maplistCache = strzone(strcat(a, b, c)); // TODO also update the actual cvar - if not((bspname = MapInfo_BSPName_ByID(i))) + if (!((bspname = MapInfo_BSPName_ByID(i)))) return; if(b == "1") cvar_set("g_maplist", strcat(bspname, " ", cvar_string("g_maplist"))); @@ -142,32 +142,30 @@ void XonoticMapList_resizeNotify(entity me, vector relOrigin, vector relSize, ve void XonoticMapList_clickListBoxItem(entity me, float i, vector where) { if(where_x <= me.columnPreviewOrigin + me.columnPreviewSize) - { if(where_x >= 0) me.g_maplistCacheToggle(me, i); - } + if(where_x >= me.columnNameOrigin) if(where_x <= 1) - { - if(i == me.lastClickedMap) - if(time < me.lastClickedTime + 0.3) - { - // DOUBLE CLICK! - // pop up map info screen - main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, i, me); - DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * i - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize)); - return; - } - me.lastClickedMap = i; - me.lastClickedTime = time; - } + { + if(i == me.lastClickedMap) + if(time < me.lastClickedTime + 0.3) + { + // DOUBLE CLICK! + // pop up map info screen + main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, i, me); + DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * i - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize)); + return; + } + me.lastClickedMap = i; + me.lastClickedTime = time; + } } void XonoticMapList_drawListBoxItem(entity me, float i, vector absSize, float isSelected) { // layout: Ping, Map name, Map name, NP, TP, MP string s; - float p; float theAlpha; float included; @@ -185,7 +183,6 @@ void XonoticMapList_drawListBoxItem(entity me, float i, vector absSize, float is else if(included) draw_Fill('0 0 0', '1 1 0', SKINCOLOR_MAPLIST_INCLUDEDBG, SKINALPHA_MAPLIST_INCLUDEDBG); - s = ftos(p); if(draw_PictureSize(strcat("/maps/", MapInfo_Map_bspname)) == '0 0 0') draw_Picture(me.columnPreviewOrigin * eX, "nopreview_map", me.columnPreviewSize * eX + eY, '1 1 1', theAlpha); else @@ -193,9 +190,9 @@ void XonoticMapList_drawListBoxItem(entity me, float i, vector absSize, float is if(included) draw_Picture(me.checkMarkOrigin, "checkmark", me.checkMarkSize, '1 1 1', 1); - s = draw_TextShortenToWidth(MapInfo_Map_titlestring, me.columnNameSize, 0, me.realFontSize); + s = draw_TextShortenToWidth(strdecolorize(MapInfo_Map_titlestring), me.columnNameSize, 0, me.realFontSize); draw_Text(me.realUpperMargin1 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_TITLE, theAlpha, 0); - s = draw_TextShortenToWidth(MapInfo_Map_author, me.columnNameSize, 0, me.realFontSize); + s = draw_TextShortenToWidth(strdecolorize(MapInfo_Map_author), me.columnNameSize, 0, me.realFontSize); draw_Text(me.realUpperMargin2 * eY + (me.columnNameOrigin + 1.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_AUTHOR, theAlpha, 0); MapInfo_ClearTemps(); @@ -246,7 +243,7 @@ void MapList_All(entity btn, entity me) { float i; string s; - MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, MAPINFO_FLAG_FORBIDDEN | MAPINFO_FLAG_HIDDEN, 0); // all + MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, MapInfo_ForbiddenFlags(), 0); // all s = ""; for(i = 0; i < MapInfo_count; ++i) s = strcat(s, " ", MapInfo_BSPName_ByID(i)); @@ -277,7 +274,7 @@ void MapList_LoadMap(entity btn, entity me) return; m = MapInfo_BSPName_ByID(i); - if not(m) + if (!m) { print(_("Huh? Can't play this (m is NULL). Refiltering so this won't happen again.\n")); me.refilter(me); @@ -303,19 +300,19 @@ float XonoticMapList_keyDown(entity me, float scan, float ascii, float shift) string ch, save; if(me.nItems <= 0) return SUPER(XonoticMapList).keyDown(me, scan, ascii, shift); - if(scan == K_ENTER || scan == K_KP_ENTER) + if(scan == K_MOUSE2 || scan == K_SPACE || scan == K_ENTER || scan == K_KP_ENTER) { // pop up map info screen main.mapInfoDialog.loadMapInfo(main.mapInfoDialog, me.selectedItem, me); DialogOpenButton_Click_withCoords(NULL, main.mapInfoDialog, me.origin + eX * (me.columnNameOrigin * me.size_x) + eY * ((me.itemHeight * me.selectedItem - me.scrollPos) * me.size_y), eY * me.itemAbsSize_y + eX * (me.itemAbsSize_x * me.columnNameSize)); } - else if(scan == K_SPACE) + else if(scan == K_MOUSE3 || scan == K_INS || scan == K_KP_INS) { me.g_maplistCacheToggle(me, me.selectedItem); } else if(ascii == 43) // + { - if not(me.g_maplistCacheQuery(me, me.selectedItem)) + if (!me.g_maplistCacheQuery(me, me.selectedItem)) me.g_maplistCacheToggle(me, me.selectedItem); } else if(ascii == 45) // -