X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fmapvoting.qc;h=48b2106e1471b9d99a1227d69c40656fc7f021c7;hb=dbcdd58814a7281aef637c8c07a02242331c4c86;hp=e94d6a68aa786786f9babdf009e71deeb5b64259;hpb=a2aac26e6d660e5e70e65d7639a669bced3de9e2;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index e94d6a68a..750bd2a75 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -26,7 +26,7 @@ string MapVote_FormatMapItem(float id, string map, float count, float maxwidth, { if(count == 1) post = _(" (1 vote)"); - else + else if(count >= 0) post = sprintf(_(" (%d votes)"), count); } else @@ -68,14 +68,14 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin text_size = stringwidth(label, false, hud_fontsize); - float alpha; + float theAlpha; if (count < 0 && mv_top2_alpha) - alpha = mv_top2_alpha; + theAlpha = mv_top2_alpha; else - alpha = 1; + theAlpha = 1; pos_x -= text_size*0.5; - drawstring(pos, label, hud_fontsize, rgb, alpha, DRAWFLAG_NORMAL); + drawstring(pos, label, hud_fontsize, rgb, theAlpha, DRAWFLAG_NORMAL); pos_x = pos_x + text_size*0.5 - img_size_x*0.5; pos_y = pos_y - img_size_y; @@ -84,17 +84,20 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin img_size -= (autocvar_scoreboard_border_thickness * 2) * '1 1 0'; if(pic == "") { - drawfill(pos, img_size, '.5 .5 .5', .7 * alpha, DRAWFLAG_NORMAL); + drawfill(pos, img_size, '.5 .5 .5', .7 * theAlpha, DRAWFLAG_NORMAL); } else { - drawpic(pos, pic, img_size, '1 1 1', alpha, DRAWFLAG_NORMAL); + if(drawgetimagesize(pic) == '0 0 0') + drawpic(pos, draw_UseSkinFor("nopreview_map"), img_size, '1 1 1', theAlpha, DRAWFLAG_NORMAL); + else + drawpic(pos, pic, img_size, '1 1 1', theAlpha, DRAWFLAG_NORMAL); } if(id == mv_ownvote) - drawborderlines(autocvar_scoreboard_border_thickness, pos, img_size, rgb, alpha, DRAWFLAG_NORMAL); + drawborderlines(autocvar_scoreboard_border_thickness, pos, img_size, rgb, theAlpha, DRAWFLAG_NORMAL); else - drawborderlines(autocvar_scoreboard_border_thickness, pos, img_size, '0 0 0', alpha, DRAWFLAG_NORMAL); + drawborderlines(autocvar_scoreboard_border_thickness, pos, img_size, '0 0 0', theAlpha, DRAWFLAG_NORMAL); if(id == mv_selection && count >= 0) drawfill(pos, img_size, '1 1 1', 0.1, DRAWFLAG_NORMAL); @@ -170,7 +173,7 @@ void MapVote_Draw() if(!mv_active) return; - + mv_mousepos = mv_mousepos + getmousepos(); mv_mousepos_x = bound(0, mv_mousepos_x, vid_conwidth); @@ -190,24 +193,26 @@ void MapVote_Draw() pos_y = ymin; pos_z = 0; - //pos_x = center - stringwidth("Vote for a map", false) * 0.5 * 24; - pos_x = center - stringwidth(_("Vote for a map"), false, '12 0 0'); - drawstring(pos, "Vote for a map", '24 24 0', '1 1 1', 1, DRAWFLAG_NORMAL); + + draw_beginBoldFont(); + map = _("Vote for a map"); + pos_x = center - stringwidth(map, false, '12 0 0'); + drawstring(pos, map, '24 24 0', '1 1 1', 1, DRAWFLAG_NORMAL); pos_y += 26; i = ceil(max(0, mv_timeout - time)); map = sprintf(_("%d seconds left"), i); - //pos_x = center - stringwidth(map, false) * 0.5 * 16; pos_x = center - stringwidth(map, false, '8 0 0'); drawstring(pos, map, '16 16 0', '0 1 0', 1, DRAWFLAG_NORMAL); pos_y += 22; pos_x = xmin; + draw_endBoldFont(); // base for multi-column stuff... ymin = pos_y; if(mv_abstain) mv_num_maps -= 1; - + if(mv_num_maps > 3) { columns = 3; @@ -242,7 +247,7 @@ void MapVote_Draw() if(mv_abstain) ++mv_num_maps; - + if(mv_abstain && i < mv_num_maps) { tmp = mv_votes[i]; pos_y = ymax + isize - hud_fontsize_y; @@ -280,7 +285,7 @@ void Cmd_MapVote_MapDownload(float argc) return; } else { print(_("Requesting preview...\n")); - localcmd(strcat("\ncmd mv_getpic ", ftos(id), "\n")); + localcmd(strcat("\ncmd mv_getpicture ", ftos(id), "\n")); } } @@ -358,8 +363,8 @@ void MapVote_Init() else mv_maps_mask = ReadShort(); - // Assume mv_pk3list is NULL, there should only be 1 mapvote per round - mv_pk3list = NULL; // I'm still paranoid! + // Assume mv_pk3list is world, there should only be 1 mapvote per round + mv_pk3list = world; // I'm still paranoid! for(i = 0, power = 1; i < mv_num_maps; ++i, power *= 2) { @@ -411,6 +416,19 @@ float MapVote_InputEvent(float bInputType, float nPrimary, float nSecondary) localcmd(strcat("\nimpulse ", ftos(imp), "\n")); return true; } + switch(nPrimary) + { + case K_KP_1: localcmd("\nimpulse 1\n"); return true; + case K_KP_2: localcmd("\nimpulse 2\n"); return true; + case K_KP_3: localcmd("\nimpulse 3\n"); return true; + case K_KP_4: localcmd("\nimpulse 4\n"); return true; + case K_KP_5: localcmd("\nimpulse 5\n"); return true; + case K_KP_6: localcmd("\nimpulse 6\n"); return true; + case K_KP_7: localcmd("\nimpulse 7\n"); return true; + case K_KP_8: localcmd("\nimpulse 8\n"); return true; + case K_KP_9: localcmd("\nimpulse 9\n"); return true; + case K_KP_0: localcmd("\nimpulse 10\n"); return true; + } if (nPrimary == K_MOUSE1) if (mv_selection >= 0) @@ -436,7 +454,7 @@ void MapVote_UpdateMask() if(oldmask & mv_maps_mask != oldmask) if(oldmask & mv_maps_mask == mv_maps_mask) - sound(world, CHAN_AUTO, "misc_invshot.wav", VOL_BASE, ATTN_NONE); + sound(world, CH_INFO, "misc_invshot.wav", VOL_BASE, ATTN_NONE); // remove votes that no longer apply for(i = 0, power = 1; i < mv_num_maps; ++i, power *= 2)