X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fmapvoting.qc;h=a7ef9a19230ec1d2dadb971e8533c0dae511a7d1;hb=24da50d8c47399ca7b76ea962a9975d12fe93842;hp=5baa268fcfffba7616ab3957b9d62fee7e5ff974;hpb=7f991322e66aa699880b24d1c8e59d3f2f1c7754;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index 5baa268fc..a7ef9a192 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -21,13 +21,13 @@ float mv_selection; string MapVote_FormatMapItem(float id, string map, float count, float maxwidth, vector fontsize) { string pre, post; - pre = strcat(ftos(id+1), ". "); + pre = sprintf("%d. ", id+1); if(mv_detail) { if(count == 1) - post = strcat(" (1 vote)"); - else - post = strcat(" (", ftos(count), " votes)"); + post = _(" (1 vote)"); + else if(count >= 0) + post = sprintf(_(" (%d votes)"), count); } else post = ""; @@ -88,7 +88,10 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin } else { - drawpic(pos, pic, img_size, '1 1 1', alpha, DRAWFLAG_NORMAL); + if(precache_pic(pic) == "") + drawpic(pos, draw_UseSkinFor("nopreview_player"), img_size, '1 1 1', alpha, DRAWFLAG_NORMAL); + else + drawpic(pos, pic, img_size, '1 1 1', alpha, DRAWFLAG_NORMAL); } if(id == mv_ownvote) @@ -110,7 +113,7 @@ void MapVote_DrawAbstain(vector pos, float isize, float tsize, float count, floa pos_y = pos_y + hud_fontsize_y; - label = MapVote_FormatMapItem(id, "Don't care", count, tsize, hud_fontsize); + label = MapVote_FormatMapItem(id, _("Don't care"), count, tsize, hud_fontsize); text_size = stringwidth(label, false, hud_fontsize); @@ -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,14 +193,14 @@ 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); + + 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 = strcat(ftos(i), " seconds left"); - //pos_x = center - stringwidth(map, false) * 0.5 * 16; + map = sprintf(_("%d seconds left"), i); pos_x = center - stringwidth(map, false, '8 0 0'); drawstring(pos, map, '16 16 0', '0 1 0', 1, DRAWFLAG_NORMAL); pos_y += 22; @@ -207,7 +210,7 @@ void MapVote_Draw() ymin = pos_y; if(mv_abstain) mv_num_maps -= 1; - + if(mv_num_maps > 3) { columns = 3; @@ -242,7 +245,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; @@ -260,7 +263,7 @@ void Cmd_MapVote_MapDownload(float argc) if(argc != 2 || !mv_pk3list) { - print("mv_mapdownload: ^3You're not supposed to use this command on your own!\n"); + print(_("mv_mapdownload: ^3You're not supposed to use this command on your own!\n")); return; } @@ -270,19 +273,16 @@ void Cmd_MapVote_MapDownload(float argc) break; if(!pak || pak.sv_entnum != id) { - print("^1Error:^7 Couldn't find pak index.\n"); + print(_("^1Error:^7 Couldn't find pak index.\n")); return; } - //print(strcat("^3Adding: ", ftos(id), " - ", pak.message, " - ")); - if(PreviewExists(pak.message)) { mv_preview[id] = true; - //print("^2Found...\n"); return; } else { - print("Requesting preview...\n"); + print(_("Requesting preview...\n")); localcmd(strcat("\ncmd mv_getpic ", ftos(id), "\n")); } } @@ -381,7 +381,6 @@ void MapVote_Init() mv_preview[i] = false; - //print(strcat("RECV: ", map, " in ", pk3, "\n")); MapVote_CheckPic(map, pk3, i); } else @@ -415,6 +414,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) @@ -440,7 +452,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)