Menu: Added support for Half-Life's logo.avi header image

This commit is contained in:
Marco Cawthorne 2019-01-16 01:14:54 +01:00
parent a4c77d7a95
commit 7597f23a9d
7 changed files with 41 additions and 1 deletions

View File

@ -16,6 +16,36 @@ vector col_refresh_title;
vector col_refresh_text;
vector col_refresh_bg;
string Colors_RGB8_to_HEX(vector color)
{
string out = "^x";
for (int i = 0; i < 3; i++) {
string a;
float b = rint(color[i] * 15);
switch (b) {
case 10:
a = "A";
case 11:
a = "B";
case 12:
a = "C";
case 13:
a = "D";
case 14:
a = "E";
case 15:
a = "F";
default:
a = ftos(b);
}
out = sprintf("%s%s", out, a);
}
return out;
}
void Colors_Init(void)
{
int c;

View File

@ -20,6 +20,7 @@ var int autocvar_menu_intro = FALSE;
int g_vidsize[2];
int g_menuofs[2];
int g_mousepos[2];
vector g_logosize;
int g_lastmousepos[2];
int g_active;
float g_btnofs;

View File

@ -15,6 +15,10 @@ void m_init(void)
font_arial = loadfont( "label", "gfx/shell/arial.ttf", "14", -1 );
font_label_b = loadfont( "label_b", "gfx/shell/arialbd.ttf", "14 12 16", -1 );
localcmd("plug_load ffmpeg\n");
localcmd("con_textsize -12\n");
shaderforname("logo_avi", "{\n{\nvideomap av:media/logo.avi\n}\n}");
for (int i = 0; i < g_bmp.length; i++) {
precache_pic(g_bmp[i]);
}

View File

@ -266,6 +266,10 @@ void menu_main_draw(void)
WLabel_Static(235, 440, m_reslbl[IDS_MAIN_QUITHELP], 10, 10,
col_help,1.0f, 0, font_label);
} else {
drawpic([g_menuofs[0],g_menuofs[1] + 70], "logo_avi",
g_logosize, [1,1,1], 1.0f);
g_logosize = gecko_get_texture_extent("logo_avi");
Widget_Draw(fn_main);
WLabel_Static(235, 216, m_reslbl[IDS_MAIN_NEWGAMEHELP], 10, 10,
col_help,1.0f, 0, font_label);

View File

@ -57,5 +57,6 @@ void WField_Static(int x, int y, string msg, int sx, int sy, vector col,
drawfont = font;
x += g_menuofs[0];
y += g_menuofs[1];
drawtextfield([x,y], [sx,sy], flags, sprintf("^xAAA%s",msg));
drawtextfield([x,y], [sx,sy], flags, sprintf("%s%s",
Colors_RGB8_to_HEX(col), msg));
}

Binary file not shown.