66 pre = sprintf(
"%d. ",
id+1);
70 post = _(
" (1 vote)");
71 else if(_count >= 0 && (
mv_flags[
id] & GTV_AVAILABLE))
72 post = sprintf(_(
" (%d votes)"), _count);
80 return strcat(pre, map, post);
117 vector rect_pos = pos -
'0.5 0.5 0' * rect_margin;
118 vector rect_size =
'1 1 0';
119 rect_size.x = tsize + rect_margin;
120 rect_size.y = maxh + rect_margin;
144 if ( maxh < image_size.y )
145 image_size =
'1 1 0' * maxh;
148 pos.x += image_size.x + desc_padding;
149 tsize -= image_size.x + desc_padding;
156 string thelabel =
mv_desc[id], ts;
173 next.origin = pos-offset;
193 drawpic(
'0 1 0'*title_gap+
'0.5 0 0'*desc_padding+offset, pic, image_size,
'1 1 1', alpha,
DRAWFLAG_NORMAL);
196 for ( last = title.chain; last ; )
211 vector img_size =
'0 0 0';
222 vector rect_pos = pos -
'0.5 0.5 0' * rect_margin;
223 vector rect_size =
'1 1 0';
224 rect_size.x = tsize + rect_margin;
225 rect_size.y = isize + rect_margin;
228 img_size.x =
min(tsize, isize * img_ar);
229 img_size.y = img_size.x / img_ar;
231 img_size.x = img_size.y * img_ar;
239 float save_rect_sizex = rect_size.x;
240 rect_size.x =
max(img_size.x, text_size) + rect_margin;
241 rect_pos.x += (save_rect_sizex - rect_size.x) / 2;
243 vector text_pos =
'0 0 0';
244 text_pos.x = pos.x + (tsize - text_size) / 2;
245 text_pos.y = pos.y + img_size.y;
247 pos.x += (tsize - img_size.x) / 2;
296 pos.x -= text_size*0.5;
302 TC(
int, i);
TC(
int, m);
305 '1 0 0' * (gridspec.x * r)
307 '0 1 0' * (gridspec.y * (i - r) / m);
317 for (r = 0; r < rows; ++r)
318 for (c = 0; c < columns; ++c)
320 if (
mousepos.x >= topleft.x + cellsize.x * c &&
321 mousepos.x <= topleft.x + cellsize.x * (c + 1) &&
322 mousepos.y >= topleft.y + cellsize.y * r &&
323 mousepos.y <= topleft.y + cellsize.y * (r + 1))
383 map = ((
gametypevote) ? _(
"Decide the gametype") : _(
"Vote for a map"));
400 map = sprintf(_(
"%d seconds left"), i);
414 ymax -= abstain_spacing;
424 dist.y = (
ymax - pos.y) / rows;
431 dist.y =
min(dist.y, dist.x / item_aspect);
437 dist.x =
min(dist.x, dist.y * item_aspect);
441 if(dist.x / dist.y > item_aspect)
442 dist.x = dist.y * item_aspect;
444 dist.y = dist.x / item_aspect;
449 xmin = pos.x += offset;
451 offset = ((
ymax - pos.y) - dist.y * rows) / 2;
478 void (
vector,
float,
float,
string,
string,
float,
float) DrawItem;
500 pos.y =
ymax + abstain_spacing;
513 LOG_INFO(_(
"mv_mapdownload: ^3You're not supposed to use this command on your own!"));
519 if(pak.sv_entnum ==
id)
522 if(!pak || pak.sv_entnum !=
id) {
523 LOG_INFO(_(
"^1Error:^7 Couldn't find pak index."));
532 LOG_INFO(_(
"Requesting preview..."));
551 localcmd(
strcat(
"\ncurl --pak ", pk3,
"; wait; cl_cmd mv_download ",
ftos(
id),
"\n"));
627 string basetype =
"";
648 mv_picpath =
strcat(
"gfx/menu/default/gametype_", gt);
654 mv_picpath =
strcat(
"gfx/menu/default/gametype_", basetype);
658 string pic =
strzone(mv_picpath);
764 if (imp == -mv_columns)
765 imp = mv_columns * mv_rows - 1;
767 imp = imp + mv_columns * mv_rows - 1;
785 if ((imp % mv_columns) == mv_columns - 1)
788 imp = imp % mv_columns + 1;
800 static int first_digit = 0;
819 bool key_pressed = (bInputType == 0);
841 if (!key_pressed)
return true;
846 if (!key_pressed)
return true;
851 if (!key_pressed)
return true;
856 if (!key_pressed)
return true;
863 if (!key_pressed)
return true;
867 case '1':
case K_KP_1: imp = 1;
break;
868 case '2':
case K_KP_2: imp = 2;
break;
869 case '3':
case K_KP_3: imp = 3;
break;
870 case '4':
case K_KP_4: imp = 4;
break;
871 case '5':
case K_KP_5: imp = 5;
break;
872 case '6':
case K_KP_6: imp = 6;
break;
873 case '7':
case K_KP_7: imp = 7;
break;
874 case '8':
case K_KP_8: imp = 8;
break;
875 case '9':
case K_KP_9: imp = 9;
break;
876 case '0':
case K_KP_0: imp = 10;
break;
885 first_digit = imp % 10;
889 imp = first_digit * 10 + (imp % 10);
966 int type = ReadByte();
string mv_maps[MAPVOTE_COUNT]
#define draw_endBoldFont()
string ssdirs[NUM_SSDIRS]
string getWrappedLine_remaining
void MapVote_CheckPK3(string pic, string pk3, int id)
void MapVote_UpdateMask()
int MapVote_MoveDown(int pos)
#define draw_beginBoldFont()
int MapVote_MoveUp(int pos)
float mv_flags_start[MAPVOTE_COUNT]
string MapInfo_Type_ToText(Gametype t)
vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect)
string textShortenToWidth(string theText, float maxWidth, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
int MapVote_MoveRight(int pos)
void MapVote_CheckPic(string pic, string pk3, int id)
vector drawgetimagesize(string pic)
bool autocvar_cl_readpicture_force
int MapVote_MoveLeft(int pos)
vector MapVote_GridVec(vector gridspec, int i, int m)
void MapVote_ReadOption(int i)
string draw_UseSkinFor(string pic)
float autocvar_hud_panel_mapvote_highlight_border
vector MapVote_RGB(int id)
#define HUD_Panel_DrawBg()
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
vector gtv_text_size_small
Gametype MapInfo_Type_FromString(string gtype, bool dowarn)
void Net_MapVote_Picture()
int mv_selection_keyboard
float MapVote_InputEvent(int bInputType, float nPrimary, float nSecondary)
void MapVote_DrawAbstain(vector pos, float isize, float tsize, float _count, int id)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
vector HUD_GetFontsize(string cvarname)
string mv_desc[MAPVOTE_COUNT]
float mv_preview[MAPVOTE_COUNT]
string autocvar_menu_skin
float mv_flags[MAPVOTE_COUNT]
const float DRAWFLAG_NORMAL
string mv_pics[MAPVOTE_COUNT]
float mv_votes[MAPVOTE_COUNT]
void GameTypeVote_ReadOption(int i)
void Cmd_MapVote_MapDownload(int argc)
NET_HANDLE(ENT_CLIENT_MAPVOTE, bool isnew)
float MapVote_Selection(vector topleft, vector cellsize, float rows, float columns)
bool PreviewExists(string name)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
string MapInfo_Type_Description(Gametype t)
void drawborderlines(float thickness, vector pos, vector dim, vector color, float theAlpha, float drawflag)
#define tokenizebyseparator
string mv_pk3[MAPVOTE_COUNT]
void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string gtype, string pic, float _count, int id)
string getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
#define HUD_Write_Cvar(cvar)
ERASEABLE bool fexists(string f)
void MapVote_UpdateVotes()
string MapVote_FormatMapItem(int id, string map, float _count, float maxwidth, vector fontsize)
bool autocvar_hud_cursormode
void MapVote_Draw_Export(int fh)
void MapVote_SendChoice(int index)
void HUD_Panel_LoadCvars()
void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, string pic, float _count, int id)