43 post = _(
" (1 vote)");
45 post = sprintf(_(
" (%d votes)"), _count);
54 return strcat(pre, text, post);
69 return '1 1 0' +
eZ * (time_frac >= 1 ? 1 :
sqrt(time_frac));
94 vector rect_pos = pos -
'0.5 0.5 0' * rect_margin;
95 vector rect_size =
'1 1 0';
96 rect_size.x = tsize + rect_margin;
97 rect_size.y = maxh + rect_margin;
130 if (maxh < image_size.y)
131 image_size =
'1 1 0' * maxh;
134 pos.x += image_size.x + desc_padding;
137 float desc_tsize = tsize - (image_size.x + desc_padding);
138 string the_label =
mv_desc[id];
154 vector old_offset = offset;
155 float old_maxh = maxh;
158 offset.y += maxh * 0.5;
174 if (time_frac >= 0 && time_frac < 1)
176 float extra_padding =
min(desc_padding, title_gap);
177 float transition_progress = 1 -
sqrt(time_frac);
178 image_size *= transition_progress * (extra_padding / image_size.x) + 1;
179 offset_padding = transition_progress * extra_padding *
'-0.5 -0.5 0';
182 offset_padding =
'0 0 0';
194 offset -= old_offset;
231 vector rect_pos = pos -
'0.5 0.5 0' * rect_margin;
232 vector rect_size =
'1 1 0';
233 rect_size.x = tsize + rect_margin;
234 rect_size.y = isize + rect_margin;
236 const float img_ar = 4/3;
237 vector img_size =
'0 0 0';
238 img_size.x =
min(tsize, isize * img_ar);
239 img_size.y = img_size.x / img_ar;
241 img_size.x = img_size.y * img_ar;
254 float save_rect_sizex = rect_size.x;
255 rect_size.x =
max(img_size.x, text_size) + rect_margin;
256 rect_pos.x += (save_rect_sizex - rect_size.x) * 0.5;
259 text_pos.x = pos.x + (tsize - text_size) * 0.5;
260 text_pos.y = pos.y + img_size.y;
263 pos.x += (tsize - img_size.x) * 0.5;
335 theAlpha = 1 -
sqrt(time_frac);
349 TC(
int, i);
TC(
int, m);
352 eX * (gridspec.x * r)
354 eY * (gridspec.y * (i - r) / m);
364 for (
int c, r = 0; r < rows; ++r)
365 for (c = 0; c < columns; ++c)
366 if (
mousepos.x >= topleft.x + cellsize.x * c
367 &&
mousepos.x <= topleft.x + cellsize.x * (c + 1)
368 &&
mousepos.y >= topleft.y + cellsize.y * r
369 &&
mousepos.y <= topleft.y + cellsize.y * (r + 1))
421 string map = (
gametypevote) ? _(
"Decide the gametype") : _(
"Vote for a map");
460 ymax -= abstain_spacing;
463 ymax -= suggester_spacing;
469 int rows = table_size.y;
478 dist.y =
min(dist.y, dist.x / item_aspect);
484 dist.x =
min(dist.x, dist.y * item_aspect);
488 if (dist.x / dist.y > item_aspect)
489 dist.x = dist.y * item_aspect;
491 dist.y = dist.x / item_aspect;
495 xmin = pos.x += offset;
497 offset = ((
ymax - pos.y) - dist.y * rows) * 0.5;
535 void(
vector,
float,
float,
string,
string,
float,
int,
int) DrawItem;
549 pos.y =
ymax + abstain_spacing;
555 pos.y += suggester_spacing;
564 startsize.x = startsize.y * 4/3;
570 endsize.x = endsize.y * 4/3;
579 vector img_size = endsize * f + startsize * (1 - f);
580 vector img_pos = endpos * f + startpos * (1 - f);
586 float suggester_startposy = pos.y;
588 pos.y = suggester_endposy * f + suggester_startposy * (1 - f);
605 LOG_INFO(_(
"mv_mapdownload: ^3You're not supposed to use this command on your own!"));
612 if (pak.sv_entnum ==
id)
615 if (!pak || pak.sv_entnum !=
id)
617 LOG_INFO(_(
"^1Error:^7 Couldn't find pak index."));
628 LOG_INFO(_(
"Requesting preview..."));
645 localcmd(
"\ncurl --pak ", pk3,
"; wait; cl_cmd mv_download ",
itos(
id),
"\n");
738 static int first_digit = 0;
757 bool key_pressed = (bInputType == 0);
786 #define IMPULSE_ARROW_CASE(key, func) \
790 mv_selection_keyboard = true; \
791 mv_selection = func(mv_selection); \
798 #undef IMPULSE_ARROW_CASE
805 #define IMPULSE_NUM_CASE(num, imp_num) \
820 #undef IMPULSE_NUM_CASE
827 first_digit =
imp % 10;
831 imp = first_digit * 10 + (
imp % 10);
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
void Cmd_MapVote_MapDownload(int argc)
void MapVote_Draw_Export(int fh)
void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string gtype, string pic, int _count, int id, int most_votes)
void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, string pic, int _count, int id, int most_votes)
int MapVote_MoveRight(int pos)
vector MapVote_GridVec(vector gridspec, int i, int m)
void MapVote_CheckPic(string pic, string pk3, int id)
void MapVote_DrawMapPicture(string pic, vector pos, vector img_size, float theAlpha)
void MapVote_CheckPK3(string pic, string pk3, int id)
#define IMPULSE_ARROW_CASE(key, func)
bool PreviewExists(string name)
int MapVote_Selection(vector topleft, vector cellsize, int rows, int columns)
string MapVote_FormatItem(int id, string text, int _count, float maxwidth, vector fontsize)
int MapVote_MoveLeft(int pos)
float MapVote_InputEvent(int bInputType, float nPrimary, float nSecondary)
vector MapVote_RGB(int id)
void MapVote_DrawSuggester(vector pos)
int MapVote_MoveUp(int pos)
void MapVote_DrawAbstain(vector pos, float tsize, int _count, int id)
#define IMPULSE_NUM_CASE(num, imp_num)
int MapVote_MoveDown(int pos)
void MapVote_Draw(bool should_draw)
Draws map vote or gametype vote.
bool mv_selection_keyboard
float mv_select_lasttime[MAPVOTE_COUNT]
vector gtv_text_size_small
int mv_flags_start[MAPVOTE_COUNT]
(gt) mv_flags initially
bool autocvar_cl_readpicture_force
float mv_suggester_cachetime
string mv_suggester_cache
string mv_desc[MAPVOTE_COUNT]
(gt) gametype description
string mv_data[MAPVOTE_COUNT]
(shared) map pk3 name/gametype human readable name
float autocvar_hud_panel_mapvote_highlight_border
float mv_preview[MAPVOTE_COUNT]
(shared) whether there is a pic
string mv_pics[MAPVOTE_COUNT]
(shared) pic file location
void drawborderlines(float thickness, vector pos, vector dim, vector color, float theAlpha, float drawflag)
#define drawcolorcodedstring(position, text, scale, alpha, flag)
#define drawstring(position, text, scale, rgb, alpha, flag)
#define drawpic(position, pic, size, rgb, alpha, flag)
#define draw_beginBoldFont()
#define drawfill(position, size, rgb, alpha, flag)
#define draw_endBoldFont()
string textShortenToWidth(string theText, float maxWidth, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
string getWrappedLine(float maxWidth, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
string getWrappedLine_remaining
#define count_seconds(time)
const float DRAWFLAG_NORMAL
vector drawgetimagesize(string pic)
#define tokenizebyseparator
ERASEABLE bool fexists(string f)
void HUD_Panel_LoadCvars()
vector HUD_GetFontsize(string cvarname)
vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect)
#define HUD_Panel_DrawBg()
#define HUD_Write_Cvar(cvar)
noref float vid_conheight
void MapVote_WritePlayerVote(int index)
bool mv_abstain
(shared) if abstaining is possible, false in gametype voting
int mv_count
(shared) number of maps/gametypes
int mv_flags[MAPVOTE_COUNT]
(shared) map/gametype flags
string mv_entries[MAPVOTE_COUNT]
(shared) map name or gametype name
int mv_detail
(shared) how much information about the votes/results is revealed
int mv_count_real
(shared) number of maps/gametypes, excluding abstain
const int GTV_AVAILABLE
Can be voted.
int mv_votes[MAPVOTE_COUNT]
(shared) number of votes for the map/gametype
string mv_suggester[MAPVOTE_COUNT]
(maps) .netname of the player who suggested the map
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
ERASEABLE string ColorTranslateRGB(string s)
float stringwidth_nocolors(string s, vector theSize)
float stringwidth_colors(string s, vector theSize)