Menu: Add gameinfo_steambg manifest setting, so we can support background
images for games designed for the SteamUI-era
This commit is contained in:
parent
76507b3e9e
commit
8e4ec974e0
6 changed files with 60 additions and 3 deletions
48
src/menu-fn/background.qc
Normal file
48
src/menu-fn/background.qc
Normal file
|
@ -0,0 +1,48 @@
|
|||
void
|
||||
Background_WON(void)
|
||||
{
|
||||
drawpic([g_menuofs[0],g_menuofs[1]], g_bmp[SPLASH],
|
||||
[640,480], [1,1,1], 1.0f);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
string strMat;
|
||||
vector vecSize;
|
||||
vector vecPos;
|
||||
} backResource_t;
|
||||
|
||||
backResource_t g_back800[] =
|
||||
{
|
||||
{"resource/background/800_1_a_loading",[256,256,0],[0,0,0]},
|
||||
{"resource/background/800_1_b_loading",[256,256,0],[256,0,0]},
|
||||
{"resource/background/800_1_c_loading",[256,256,0],[512,0,0]},
|
||||
{"resource/background/800_1_d_loading",[32,256,0],[768,0,0]},
|
||||
{"resource/background/800_2_a_loading",[256,256,0],[0,256,0]},
|
||||
{"resource/background/800_2_b_loading",[256,256,0],[256,256,0]},
|
||||
{"resource/background/800_2_c_loading",[256,256,0],[512,256,0]},
|
||||
{"resource/background/800_2_d_loading",[32,256,0],[768,256,0]},
|
||||
{"resource/background/800_3_a_loading",[256,88,0],[0,512,0]},
|
||||
{"resource/background/800_3_b_loading",[256,88,0],[256,512,0]},
|
||||
{"resource/background/800_3_c_loading",[256,88,0],[512,512,0]},
|
||||
{"resource/background/800_3_d_loading",[32,88,0],[768,512,0]}
|
||||
};
|
||||
|
||||
void
|
||||
Background_Steam(void)
|
||||
{
|
||||
for (int i = 0; i < g_back800.length; i++) {
|
||||
vector pos, size;
|
||||
|
||||
/* scale down 800x600 to 640x480 */
|
||||
size = g_back800[i].vecSize * 0.8f;
|
||||
pos[0] = g_menuofs[0] + (g_back800[i].vecPos[0] * 0.8f);
|
||||
pos[1] = g_menuofs[1] + (g_back800[i].vecPos[1] * 0.8f);
|
||||
|
||||
drawpic(pos, \
|
||||
g_back800[i].strMat, \
|
||||
size, \
|
||||
[1,1,1], \
|
||||
1.0f);
|
||||
}
|
||||
}
|
|
@ -90,6 +90,7 @@ typedef struct
|
|||
string fallback_dir;
|
||||
string chatroom;
|
||||
string introvideo;
|
||||
int steambg;
|
||||
} gameinfo_t;
|
||||
|
||||
var int gameinfo_current = -1;
|
||||
|
|
|
@ -211,8 +211,11 @@ m_draw(vector screensize)
|
|||
drawfill([0,0], screensize, [0,0,0], 0.75f);
|
||||
} else {
|
||||
drawfill([0,0], screensize, [0,0,0], 1.0f);
|
||||
drawpic([g_menuofs[0],g_menuofs[1]], g_bmp[SPLASH],
|
||||
[640,480], [1,1,1], 1.0f);
|
||||
|
||||
if (games[gameinfo_current].steambg == 0)
|
||||
Background_WON();
|
||||
else
|
||||
Background_Steam();
|
||||
}
|
||||
|
||||
const string ver = "Nuclide (build " __DATE__ ")";
|
||||
|
|
|
@ -244,6 +244,7 @@ games_init(void)
|
|||
games[id].chatroom = gamedirname;
|
||||
games[id].readme = "readme.txt";
|
||||
games[id].pkgid = -1;
|
||||
games[id].steambg = 0;
|
||||
|
||||
for (int i = 0; i < county; i++) {
|
||||
switch(argv(i)) {
|
||||
|
@ -331,6 +332,9 @@ games_init(void)
|
|||
case "gameinfo_introvideo":
|
||||
games[id].introvideo = argv(i+1);
|
||||
break;
|
||||
case "gameinfo_steambg":
|
||||
games[id].steambg = (int)stof(argv(i+1));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -373,7 +373,7 @@ menu_main_draw(void)
|
|||
col_help,1.0f, 0, font_label);
|
||||
} else {
|
||||
/* Don't even attempt to display the logo.avi otherwise */
|
||||
if (checkcommand("ffmpeg_videobitrate")) {
|
||||
if (games[gameinfo_current].steambg == 0 && checkcommand("ffmpeg_videobitrate")) {
|
||||
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");
|
||||
|
|
|
@ -69,5 +69,6 @@ m_intro.qc
|
|||
m_main.qc
|
||||
music.qc
|
||||
menu.qc
|
||||
background.qc
|
||||
entry.qc
|
||||
#endlist
|
||||
|
|
Loading…
Reference in a new issue