2005-02-28 07:16:19 +00:00
|
|
|
//read menu.h
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#include "quakedef.h"
|
|
|
|
#include "winquake.h"
|
2009-11-04 21:16:50 +00:00
|
|
|
#include "shader.h"
|
2014-09-17 03:04:08 +00:00
|
|
|
#ifndef NOBUILTINMENUS
|
2018-08-04 07:05:20 +00:00
|
|
|
#if !defined(CLIENTONLY) && defined(SAVEDGAMES)
|
2004-08-23 00:15:46 +00:00
|
|
|
//=============================================================================
|
|
|
|
/* LOAD/SAVE MENU */
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int issave;
|
|
|
|
int cursorpos;
|
|
|
|
menutext_t *cursoritem;
|
2015-01-21 18:18:37 +00:00
|
|
|
|
|
|
|
int picslot;
|
|
|
|
shader_t *picshader;
|
2004-08-23 00:15:46 +00:00
|
|
|
} loadsavemenuinfo_t;
|
|
|
|
|
2016-01-18 05:22:07 +00:00
|
|
|
#define SAVEFIRST_AUTO 1
|
|
|
|
#define SAVECOUNT_AUTO 3
|
|
|
|
#define SAVEFIRST_STANDARD (SAVEFIRST_AUTO + SAVECOUNT_AUTO)
|
|
|
|
#define SAVECOUNT_STANDARD 20
|
|
|
|
#define MAX_SAVEGAMES (1+SAVECOUNT_AUTO+SAVECOUNT_STANDARD)
|
2015-01-21 18:18:37 +00:00
|
|
|
struct
|
|
|
|
{
|
2016-01-18 05:22:07 +00:00
|
|
|
qboolean loadable;
|
|
|
|
qbyte saveable; //0=autosave, 1=regular, 2=quick
|
|
|
|
char sname[9];
|
|
|
|
char desc[22+1];
|
2015-01-21 18:18:37 +00:00
|
|
|
char kills[39-22+1];
|
|
|
|
char time[64];
|
2016-01-18 05:22:07 +00:00
|
|
|
char map[32];
|
2015-01-21 18:18:37 +00:00
|
|
|
} m_saves[MAX_SAVEGAMES];
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2016-01-18 05:22:07 +00:00
|
|
|
static void M_ScanSave(unsigned int slot, const char *name, qboolean savable)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2016-01-18 05:22:07 +00:00
|
|
|
char *in, *out, *end;
|
|
|
|
int j;
|
2006-01-02 22:43:59 +00:00
|
|
|
char line[MAX_OSPATH];
|
2018-10-11 10:31:23 +00:00
|
|
|
flocation_t loc;
|
|
|
|
time_t mtime;
|
2006-01-02 22:43:59 +00:00
|
|
|
vfsfile_t *f;
|
2004-08-23 00:15:46 +00:00
|
|
|
int version;
|
|
|
|
|
2016-01-18 05:22:07 +00:00
|
|
|
m_saves[slot].saveable = savable;
|
|
|
|
m_saves[slot].loadable = false;
|
|
|
|
Q_strncpyz (m_saves[slot].sname, name, sizeof(m_saves[slot].sname));
|
|
|
|
Q_strncpyz (m_saves[slot].desc, "--- UNUSED SLOT ---", sizeof(m_saves[slot].desc));
|
|
|
|
Q_strncpyz (m_saves[slot].kills, "", sizeof(m_saves[slot].kills));
|
|
|
|
Q_strncpyz (m_saves[slot].time, "", sizeof(m_saves[slot].time));
|
|
|
|
|
|
|
|
snprintf (line, sizeof(line), "saves/%s/info.fsv", m_saves[slot].sname);
|
2018-10-11 10:31:23 +00:00
|
|
|
if (!FS_FLocateFile(line, FSLF_DONTREFERENCE|FSLF_IGNOREPURE, &loc))
|
2016-01-18 05:22:07 +00:00
|
|
|
{ //legacy saved games from some other engine
|
|
|
|
snprintf (line, sizeof(line), "%s.sav", m_saves[slot].sname);
|
2018-10-11 10:31:23 +00:00
|
|
|
if (!FS_FLocateFile(line, FSLF_DONTREFERENCE|FSLF_IGNOREPURE, &loc))
|
|
|
|
return; //not found
|
2016-01-18 05:22:07 +00:00
|
|
|
}
|
2021-06-02 15:29:44 +00:00
|
|
|
f = FS_OpenReadLocation(line, &loc);
|
2016-01-18 05:22:07 +00:00
|
|
|
if (f)
|
|
|
|
{
|
|
|
|
VFS_GETS(f, line, sizeof(line));
|
|
|
|
version = atoi(line);
|
2018-08-23 06:03:31 +00:00
|
|
|
if (version != SAVEGAME_VERSION_NQ && version != SAVEGAME_VERSION_QW && version != SAVEGAME_VERSION_FTE_LEG && (version < SAVEGAME_VERSION_FTE_HUB || version >= SAVEGAME_VERSION_FTE_HUB+GT_MAX))
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2016-01-18 05:22:07 +00:00
|
|
|
Q_strncpyz (m_saves[slot].desc, "Incompatible version", sizeof(m_saves[slot].desc));
|
2006-01-02 22:43:59 +00:00
|
|
|
VFS_CLOSE (f);
|
2016-01-18 05:22:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// read the desc, change _ back to space, fill the separate fields
|
|
|
|
VFS_GETS(f, line, sizeof(line));
|
|
|
|
for (j=0 ; line[j] ; j++)
|
|
|
|
if (line[j] == '_')
|
|
|
|
line[j] = ' ';
|
|
|
|
for (; j < sizeof(line[j]); j++)
|
|
|
|
line[j] = '\0';
|
|
|
|
memcpy(m_saves[slot].desc, line, 22);
|
|
|
|
m_saves[slot].desc[22] = 0;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2016-01-18 05:22:07 +00:00
|
|
|
for (in = line+22, out = m_saves[slot].kills, end = line+39; in < end && *in == ' '; )
|
|
|
|
in++;
|
|
|
|
for (out = m_saves[slot].kills; in < end; )
|
|
|
|
*out++ = *in++;
|
|
|
|
for (end = m_saves[slot].kills; out > end && out[-1] == ' '; )
|
|
|
|
out--;
|
|
|
|
*out = 0;
|
|
|
|
|
2018-10-11 10:31:23 +00:00
|
|
|
if (strlen(line) > 39)
|
|
|
|
Q_strncpyz(m_saves[slot].time, line+39, sizeof(m_saves[slot].time));
|
|
|
|
else if (FS_GetLocMTime(&loc, &mtime))
|
|
|
|
strftime(m_saves[slot].time, sizeof(m_saves[slot].time), "%Y-%m-%d %H:%M:%S", localtime( &mtime ));
|
|
|
|
// else time unknown, just leave it blank
|
2016-01-18 05:22:07 +00:00
|
|
|
|
|
|
|
if (version == 5 || version == 6)
|
|
|
|
{
|
|
|
|
for (j = 0; j < 16; j++)
|
|
|
|
VFS_GETS(f, line, sizeof(line)); //16 parms
|
|
|
|
VFS_GETS(f, line, sizeof(line)); //skill
|
|
|
|
VFS_GETS(f, m_saves[slot].map, sizeof(m_saves[slot].map));
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2016-01-18 05:22:07 +00:00
|
|
|
|
|
|
|
m_saves[slot].loadable = true;
|
|
|
|
VFS_CLOSE (f);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-18 05:22:07 +00:00
|
|
|
const char *M_ChooseAutoSave(void)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
for (i = SAVEFIRST_AUTO; i < SAVEFIRST_AUTO+SAVECOUNT_AUTO; i++)
|
|
|
|
{
|
|
|
|
M_ScanSave(i, va("a%i", i-SAVEFIRST_AUTO), false);
|
|
|
|
if (!m_saves[i].loadable)
|
|
|
|
return m_saves[i].sname;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = SAVEFIRST_AUTO; i < SAVEFIRST_AUTO+SAVECOUNT_AUTO; i++)
|
|
|
|
{
|
|
|
|
for (j = SAVEFIRST_AUTO; j < SAVEFIRST_AUTO+SAVECOUNT_AUTO; j++)
|
|
|
|
if (strcmp(m_saves[i].time, m_saves[j].time) > 0)
|
|
|
|
break;
|
|
|
|
if (j == SAVEFIRST_AUTO+SAVECOUNT_AUTO)
|
|
|
|
return m_saves[i].sname;
|
|
|
|
}
|
|
|
|
|
|
|
|
return m_saves[SAVEFIRST_AUTO].sname;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void M_ScanSaves (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
M_ScanSave(0, "quick", 2);
|
|
|
|
for (i=SAVEFIRST_AUTO ; i<SAVEFIRST_AUTO+SAVECOUNT_AUTO ; i++)
|
|
|
|
M_ScanSave(i, va("a%i", i-SAVEFIRST_AUTO), false);
|
|
|
|
for (i=SAVEFIRST_STANDARD ; i<SAVEFIRST_STANDARD+SAVECOUNT_STANDARD ; i++)
|
|
|
|
M_ScanSave(i, va("s%i", i-SAVEFIRST_STANDARD), true);
|
|
|
|
}
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void M_Menu_LoadSave_UnloadShaders(emenu_t *menu)
|
2015-01-21 18:18:37 +00:00
|
|
|
{
|
|
|
|
loadsavemenuinfo_t *info = menu->data;
|
|
|
|
if (info->picshader)
|
|
|
|
{
|
2015-05-03 19:57:46 +00:00
|
|
|
Image_UnloadTexture(info->picshader->defaulttextures->base);
|
2015-01-21 18:18:37 +00:00
|
|
|
R_UnloadShader(info->picshader);
|
2016-07-12 00:40:13 +00:00
|
|
|
info->picshader = NULL;
|
2015-01-21 18:18:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void M_Menu_LoadSave_Preview_Draw(int x, int y, menucustom_t *item, emenu_t *menu)
|
2015-01-21 18:18:37 +00:00
|
|
|
{
|
|
|
|
loadsavemenuinfo_t *info = menu->data;
|
|
|
|
int slot;
|
|
|
|
if (!menu->selecteditem)
|
|
|
|
return;
|
|
|
|
slot = (menu->selecteditem->common.posy - 32)/8;
|
|
|
|
if (slot >= 0 && slot < MAX_SAVEGAMES)
|
|
|
|
{
|
|
|
|
int width, height;
|
|
|
|
if (slot != info->picslot || !info->picshader)
|
|
|
|
{
|
|
|
|
info->picslot = slot;
|
|
|
|
if (info->picshader)
|
|
|
|
{
|
2015-05-03 19:57:46 +00:00
|
|
|
Image_UnloadTexture(info->picshader->defaulttextures->base);
|
2015-01-21 18:18:37 +00:00
|
|
|
R_UnloadShader(info->picshader);
|
|
|
|
}
|
2017-01-24 20:15:14 +00:00
|
|
|
info->picshader = R_RegisterPic(va("saves/%s/screeny.tga", m_saves[slot].sname), NULL);
|
2015-01-21 18:18:37 +00:00
|
|
|
}
|
|
|
|
if (info->picshader)
|
|
|
|
{
|
2016-01-18 05:22:07 +00:00
|
|
|
shader_t *pic = NULL;
|
|
|
|
switch(R_GetShaderSizes(info->picshader, &width, &height, false))
|
2015-01-21 18:18:37 +00:00
|
|
|
{
|
2016-01-18 05:22:07 +00:00
|
|
|
case 1:
|
|
|
|
pic = info->picshader;
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
if (*m_saves[slot].map)
|
2017-01-24 20:15:14 +00:00
|
|
|
pic = R_RegisterPic(va("levelshots/%s", m_saves[slot].map), NULL);
|
2016-01-18 05:22:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (pic)
|
|
|
|
{
|
|
|
|
int w = 160;
|
|
|
|
int h = 120;
|
|
|
|
if (R_GetShaderSizes(pic, &width, &height, false) <= 0)
|
|
|
|
{
|
|
|
|
width = 64;
|
|
|
|
height = 64;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((float)width/height > (float)w/h)
|
|
|
|
{
|
|
|
|
w = 160;
|
|
|
|
h = ((float)w*height) / width;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
h = 120;
|
|
|
|
w = ((float)h*width) / height;
|
|
|
|
}
|
|
|
|
R2D_ScalePic (x + (160-w)/2, y + (120-h)/2, w, h, pic);
|
2015-01-21 18:18:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Draw_FunStringWidth(x, y+120+0, m_saves[slot].time, 160, 2, false);
|
|
|
|
Draw_FunStringWidth(x, y+120+8, m_saves[slot].kills, 160, 2, false);
|
2016-01-18 05:22:07 +00:00
|
|
|
|
|
|
|
switch(m_saves[slot].saveable)
|
|
|
|
{
|
|
|
|
case 2:
|
|
|
|
Draw_FunStringWidth(x, y+120+16, "Quick Save", 160, 2, false);
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
Draw_FunStringWidth(x, y+120+16, "Autosave", 160, 2, false);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
Draw_FunStringWidth(x, y+120+24, m_saves[slot].sname, 160, 2, false);
|
2015-01-21 18:18:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
void M_Menu_Save_f (void)
|
|
|
|
{
|
|
|
|
menuoption_t *op = NULL;
|
2019-09-04 07:59:40 +00:00
|
|
|
emenu_t *menu;
|
2004-08-23 00:15:46 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!sv.state)
|
|
|
|
return;
|
|
|
|
|
2015-09-01 04:45:15 +00:00
|
|
|
if (cl.intermissionmode != IM_NONE)
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
menu = M_CreateMenu(sizeof(loadsavemenuinfo_t));
|
|
|
|
menu->data = menu+1;
|
2016-07-12 00:40:13 +00:00
|
|
|
menu->remove = M_Menu_LoadSave_UnloadShaders;
|
|
|
|
menu->reset = M_Menu_LoadSave_UnloadShaders;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2019-01-13 16:51:50 +00:00
|
|
|
switch(M_GameType())
|
|
|
|
{
|
|
|
|
#ifdef Q2CLIENT
|
|
|
|
case MGT_QUAKE2:
|
|
|
|
MC_AddCenterPicture(menu, 4, 24, "pics/m_banner_save_game.pcx");
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
MC_AddCenterPicture(menu, 4, 24, "gfx/p_save.lmp");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-03-30 08:55:06 +00:00
|
|
|
menu->cursoritem = (menuoption_t *)MC_AddRedText(menu, 8, 0, 32, NULL, false);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
M_ScanSaves ();
|
|
|
|
|
|
|
|
for (i=0 ; i< MAX_SAVEGAMES; i++)
|
|
|
|
{
|
2016-01-18 05:22:07 +00:00
|
|
|
if (m_saves[i].saveable)
|
|
|
|
op = (menuoption_t *)MC_AddConsoleCommandf(menu, 16, 192, 32+8*i, false, m_saves[i].desc, "savegame %s\nclosemenu\n", m_saves[i].sname);
|
|
|
|
else
|
|
|
|
MC_AddWhiteText(menu, 16, 170, 32+8*i, m_saves[i].desc, false);
|
2004-08-23 00:15:46 +00:00
|
|
|
if (!menu->selecteditem)
|
|
|
|
menu->selecteditem = op;
|
|
|
|
}
|
2015-01-21 18:18:37 +00:00
|
|
|
|
2019-01-15 14:12:49 +00:00
|
|
|
MC_AddCustom(menu, 192, 60-16, NULL, 0, NULL)->draw = M_Menu_LoadSave_Preview_Draw;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
void M_Menu_Load_f (void)
|
|
|
|
{
|
|
|
|
menuoption_t *op = NULL;
|
2019-09-04 07:59:40 +00:00
|
|
|
emenu_t *menu;
|
2004-08-23 00:15:46 +00:00
|
|
|
int i;
|
2016-07-12 00:40:13 +00:00
|
|
|
char time[64];
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
menu = M_CreateMenu(sizeof(loadsavemenuinfo_t));
|
|
|
|
menu->data = menu+1;
|
2016-07-12 00:40:13 +00:00
|
|
|
menu->remove = M_Menu_LoadSave_UnloadShaders;
|
|
|
|
menu->reset = M_Menu_LoadSave_UnloadShaders;
|
2019-01-13 16:51:50 +00:00
|
|
|
|
|
|
|
switch(M_GameType())
|
|
|
|
{
|
|
|
|
#ifdef Q2CLIENT
|
|
|
|
case MGT_QUAKE2:
|
|
|
|
MC_AddCenterPicture(menu, 4, 24, "pics/m_banner_load_game.pcx");
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
MC_AddCenterPicture(menu, 4, 24, "gfx/p_load.lmp");
|
|
|
|
break;
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
M_ScanSaves ();
|
|
|
|
|
|
|
|
for (i=0 ; i< MAX_SAVEGAMES; i++)
|
|
|
|
{
|
2016-01-18 05:22:07 +00:00
|
|
|
if (m_saves[i].loadable)
|
|
|
|
op = (menuoption_t *)MC_AddConsoleCommandf(menu, 16, 170, 32+8*i, false, m_saves[i].desc, "loadgame %s\nclosemenu\n", m_saves[i].sname);
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2016-01-18 05:22:07 +00:00
|
|
|
MC_AddWhiteText(menu, 16, 170, 32+8*i, m_saves[i].desc, false);
|
2016-07-12 00:40:13 +00:00
|
|
|
if (op)
|
|
|
|
if (!menu->selecteditem || (*m_saves[i].time && strcmp(time, m_saves[i].time) < 0))
|
|
|
|
{
|
|
|
|
menu->selecteditem = op;
|
|
|
|
Q_strncpyz(time, m_saves[i].time, sizeof(time));
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2015-01-21 18:18:37 +00:00
|
|
|
|
2016-01-18 05:22:07 +00:00
|
|
|
if (menu->selecteditem)
|
|
|
|
menu->cursoritem = (menuoption_t *)MC_AddRedText(menu, 8, 0, menu->selecteditem->common.posy, NULL, false);
|
|
|
|
|
2019-01-15 14:12:49 +00:00
|
|
|
MC_AddCustom(menu, 192, 60-16, NULL, 0, NULL)->draw = M_Menu_LoadSave_Preview_Draw;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void M_Menu_SinglePlayer_f (void)
|
|
|
|
{
|
2019-09-04 07:59:40 +00:00
|
|
|
emenu_t *menu;
|
2005-04-18 17:12:18 +00:00
|
|
|
#ifndef CLIENTONLY
|
2004-08-23 00:15:46 +00:00
|
|
|
menubutton_t *b;
|
2004-12-24 08:45:56 +00:00
|
|
|
mpic_t *p;
|
2014-08-17 03:18:43 +00:00
|
|
|
static menuresel_t resel;
|
2016-07-15 12:26:24 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2019-07-07 04:20:09 +00:00
|
|
|
#if MAX_SPLITS > 1
|
|
|
|
static const char *splitopts[] =
|
|
|
|
{
|
|
|
|
"Single",
|
|
|
|
"Dual",
|
|
|
|
"Tripple",
|
|
|
|
"QUAD",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
static const char *splitvals[] =
|
|
|
|
{
|
|
|
|
"0",
|
|
|
|
"1",
|
|
|
|
"2",
|
|
|
|
"3",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2009-11-04 21:16:50 +00:00
|
|
|
#ifdef CLIENTONLY
|
|
|
|
menu = M_CreateMenu(0);
|
|
|
|
|
2014-03-30 08:55:06 +00:00
|
|
|
MC_AddWhiteText(menu, 84, 0, 12*8, "This build is unable", false);
|
|
|
|
MC_AddWhiteText(menu, 84, 0, 13*8, "to start a local game", false);
|
2009-11-04 21:16:50 +00:00
|
|
|
|
2020-04-19 01:23:32 +00:00
|
|
|
MC_AddBox (menu, 60, 11*8, 25*8, 4*8);
|
2009-11-04 21:16:50 +00:00
|
|
|
#else
|
|
|
|
|
2014-10-05 20:04:11 +00:00
|
|
|
switch(M_GameType())
|
|
|
|
{
|
|
|
|
#ifdef Q2CLIENT
|
|
|
|
case MGT_QUAKE2:
|
2004-08-23 00:15:46 +00:00
|
|
|
menu = M_CreateMenu(0);
|
|
|
|
|
2009-11-04 21:16:50 +00:00
|
|
|
MC_AddCenterPicture(menu, 4, 24, "pics/m_banner_game");
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2016-07-12 00:40:13 +00:00
|
|
|
//quake2 uses the 'newgame' alias, which controls the intro video and then start map.
|
2004-08-23 00:15:46 +00:00
|
|
|
menu->selecteditem = (menuoption_t*)
|
2019-07-07 04:20:09 +00:00
|
|
|
MC_AddConsoleCommand (menu, 64, 170, 40, "Easy", va("closemenu; skill 0;deathmatch 0; set_calc coop ($cl_splitscreen>0);newgame\n"));
|
|
|
|
MC_AddConsoleCommand (menu, 64, 170, 48, "Medium", va("closemenu; skill 1;deathmatch 0; set_calc coop ($cl_splitscreen>0);newgame\n"));
|
|
|
|
MC_AddConsoleCommand (menu, 64, 170, 56, "Hard", va("closemenu; skill 2;deathmatch 0; set_calc coop ($cl_splitscreen>0);newgame\n"));
|
2018-08-04 07:05:20 +00:00
|
|
|
#ifdef SAVEDGAMES
|
2014-03-30 08:55:06 +00:00
|
|
|
MC_AddConsoleCommand (menu, 64, 170, 72, "Load Game", "menu_load\n");
|
|
|
|
MC_AddConsoleCommand (menu, 64, 170, 80, "Save Game", "menu_save\n");
|
2018-08-04 07:05:20 +00:00
|
|
|
#endif
|
2019-07-07 04:20:09 +00:00
|
|
|
|
|
|
|
#if MAX_SPLITS > 1
|
|
|
|
b = (menubutton_t*)MC_AddCvarCombo(menu, 72, 170, 96, "Splitscreen", &cl_splitscreen, splitopts, splitvals);
|
|
|
|
#endif
|
|
|
|
|
2014-03-30 08:55:06 +00:00
|
|
|
menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 48, 0, 40, NULL, false);
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
2014-10-05 20:04:11 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HEXEN2
|
|
|
|
case MGT_HEXEN2:
|
|
|
|
{
|
|
|
|
int y;
|
|
|
|
int i;
|
|
|
|
cvar_t *pc;
|
|
|
|
qboolean havemp;
|
|
|
|
static char *classlistmp[] = {
|
2016-07-12 00:40:13 +00:00
|
|
|
"Random",
|
2014-10-05 20:04:11 +00:00
|
|
|
"Paladin",
|
|
|
|
"Crusader",
|
|
|
|
"Necromancer",
|
|
|
|
"Assasin",
|
|
|
|
"Demoness"
|
|
|
|
};
|
|
|
|
menubutton_t *b;
|
2016-07-12 00:40:13 +00:00
|
|
|
havemp = !!COM_FCheckExists("maps/keep1.bsp");
|
2014-10-05 20:04:11 +00:00
|
|
|
menu = M_CreateMenu(0);
|
|
|
|
MC_AddPicture(menu, 16, 0, 35, 176, "gfx/menu/hplaque.lmp");
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2014-10-05 20:04:11 +00:00
|
|
|
Cvar_Get("cl_playerclass", "1", CVAR_USERINFO|CVAR_ARCHIVE, "Hexen2");
|
2010-08-17 02:44:21 +00:00
|
|
|
|
2014-10-05 20:04:11 +00:00
|
|
|
y = 64-20;
|
2010-08-16 02:03:02 +00:00
|
|
|
|
2014-10-05 20:04:11 +00:00
|
|
|
if (!strncmp(Cmd_Argv(1), "class", 5))
|
|
|
|
{
|
|
|
|
int pnum;
|
|
|
|
pnum = atoi(Cmd_Argv(1)+5);
|
|
|
|
if (!pnum)
|
|
|
|
pnum = 1;
|
2010-08-16 02:03:02 +00:00
|
|
|
|
2014-10-05 20:04:11 +00:00
|
|
|
MC_AddCenterPicture(menu, 0, 60, "gfx/menu/title2.lmp");
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2014-10-05 20:04:11 +00:00
|
|
|
if (cl_splitscreen.ival)
|
|
|
|
MC_AddBufferedText(menu, 80, 0, (y+=8)+12, va("Player %i\n", pnum), false, true);
|
2010-08-16 02:03:02 +00:00
|
|
|
|
2016-07-12 00:40:13 +00:00
|
|
|
for (i = 0; i <= 4+havemp; i++)
|
2014-10-05 20:04:11 +00:00
|
|
|
{
|
|
|
|
b = MC_AddConsoleCommandHexen2BigFont(menu, 80, y+=20, classlistmp[i],
|
|
|
|
va("p%i setinfo cl_playerclass %i; menu_single %s %s\n",
|
|
|
|
pnum,
|
2016-07-12 00:40:13 +00:00
|
|
|
i?i:((rand()%(4+havemp))+1),
|
2014-10-05 20:04:11 +00:00
|
|
|
((pnum+1 > cl_splitscreen.ival+1)?"skill":va("class%i",pnum+1)),
|
|
|
|
Cmd_Argv(2)));
|
|
|
|
if (!menu->selecteditem)
|
|
|
|
menu->selecteditem = (menuoption_t*)b;
|
|
|
|
}
|
2010-08-16 02:03:02 +00:00
|
|
|
}
|
2014-10-05 20:04:11 +00:00
|
|
|
else if (!strncmp(Cmd_Argv(1), "skill", 5))
|
2010-08-16 02:03:02 +00:00
|
|
|
{
|
2018-09-23 19:35:24 +00:00
|
|
|
//yes, hexen2 has per-class names for the skill levels. because being weird and obtuse is kinda its forte
|
2014-10-05 20:04:11 +00:00
|
|
|
static char *skillnames[6][4] =
|
2010-08-16 02:03:02 +00:00
|
|
|
{
|
2019-06-17 04:21:41 +00:00
|
|
|
{ //generic/random
|
2014-10-05 20:04:11 +00:00
|
|
|
"Easy",
|
|
|
|
"Medium",
|
|
|
|
"Hard",
|
|
|
|
"Nightmare"
|
|
|
|
},
|
2019-06-17 04:21:41 +00:00
|
|
|
{ //barbarian
|
|
|
|
"Servant", //string changed, because somehow the original is malicious. was: "Apprentice",
|
2014-10-05 20:04:11 +00:00
|
|
|
"Squire",
|
|
|
|
"Adept",
|
|
|
|
"Lord"
|
|
|
|
},
|
2019-06-17 04:21:41 +00:00
|
|
|
{ //paladin
|
2014-10-05 20:04:11 +00:00
|
|
|
"Gallant",
|
|
|
|
"Holy Avenger",
|
|
|
|
"Divine Hero",
|
|
|
|
"Legend"
|
|
|
|
},
|
2019-06-17 04:21:41 +00:00
|
|
|
{ //necromancer
|
2014-10-05 20:04:11 +00:00
|
|
|
"Sorcerer",
|
|
|
|
"Dark Servant",
|
|
|
|
"Warlock",
|
|
|
|
"Lich King"
|
|
|
|
},
|
2019-06-17 04:21:41 +00:00
|
|
|
{ //assassin
|
2014-10-05 20:04:11 +00:00
|
|
|
"Rogue",
|
|
|
|
"Cutthroat",
|
|
|
|
"Executioner",
|
|
|
|
"Widow Maker"
|
|
|
|
},
|
2019-06-17 04:21:41 +00:00
|
|
|
{ //demoness
|
2014-10-05 20:04:11 +00:00
|
|
|
"Larva",
|
|
|
|
"Spawn",
|
|
|
|
"Fiend",
|
|
|
|
"She Bitch"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
char **sn = skillnames[0];
|
|
|
|
pc = Cvar_Get("cl_playerclass", "1", CVAR_USERINFO|CVAR_ARCHIVE, "Hexen2");
|
|
|
|
if (pc && (unsigned)pc->ival <= 5)
|
|
|
|
sn = skillnames[pc->ival];
|
|
|
|
|
|
|
|
MC_AddCenterPicture(menu, 0, 60, "gfx/menu/title5.lmp");
|
|
|
|
for (i = 0; i < 4; i++)
|
2010-08-16 02:03:02 +00:00
|
|
|
{
|
2016-07-12 00:40:13 +00:00
|
|
|
b = MC_AddConsoleCommandHexen2BigFont(menu, 80, y+=20, sn[i], va("skill %i; closemenu; disconnect; deathmatch 0; coop %i;wait;map %s\n", i, cl_splitscreen.ival>0, Cmd_Argv(2)));
|
2014-10-05 20:04:11 +00:00
|
|
|
if (!menu->selecteditem)
|
|
|
|
menu->selecteditem = (menuoption_t*)b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MC_AddCenterPicture(menu, 0, 60, "gfx/menu/title1.lmp");
|
|
|
|
//startmap selection in hexen2 is nasty.
|
|
|
|
if (havemp)
|
2010-08-16 02:03:02 +00:00
|
|
|
{
|
2014-10-05 20:04:11 +00:00
|
|
|
menu->selecteditem = (menuoption_t*)
|
|
|
|
MC_AddConsoleCommandHexen2BigFont(menu, 80, y+=20, "New Mission", "menu_single class keep1\n");
|
|
|
|
MC_AddConsoleCommandHexen2BigFont(menu, 80, y+=20, "Old Mission", "menu_single class demo1\n");
|
|
|
|
}
|
|
|
|
else
|
2010-08-16 02:03:02 +00:00
|
|
|
{
|
2014-10-05 20:04:11 +00:00
|
|
|
menu->selecteditem = (menuoption_t*)
|
|
|
|
MC_AddConsoleCommandHexen2BigFont(menu, 80, y+=20, "New Game", "menu_single class demo1\n");
|
2010-08-16 02:03:02 +00:00
|
|
|
}
|
2018-08-04 07:05:20 +00:00
|
|
|
#ifdef SAVEDGAMES
|
2014-10-05 20:04:11 +00:00
|
|
|
MC_AddConsoleCommandHexen2BigFont(menu, 80, y+=20, "Save Game", "menu_save\n");
|
|
|
|
MC_AddConsoleCommandHexen2BigFont(menu, 80, y+=20, "Load Game", "menu_load\n");
|
2018-08-04 07:05:20 +00:00
|
|
|
#endif
|
2019-07-07 04:20:09 +00:00
|
|
|
|
|
|
|
MC_AddCvarCombo(menu, 72, 170, y+=20, "Splitscreen", &cl_splitscreen, splitopts, splitvals);
|
2014-10-05 20:04:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
menu->cursoritem = (menuoption_t *)MC_AddCursor(menu, &resel, 56, menu->selecteditem?menu->selecteditem->common.posy:0);
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
|
2014-10-05 20:04:11 +00:00
|
|
|
return;
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
}
|
2014-10-05 20:04:11 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
if (QBigFontWorks())
|
|
|
|
{
|
|
|
|
menu = M_CreateMenu(0);
|
|
|
|
MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp");
|
2016-09-01 14:31:24 +00:00
|
|
|
MC_AddCenterPicture(menu, 4, 24, "gfx/ttl_sgl.lmp");
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
|
2014-10-05 20:04:11 +00:00
|
|
|
menu->selecteditem = (menuoption_t*)
|
2023-07-15 01:38:06 +00:00
|
|
|
MC_AddConsoleCommandQBigFont (menu, 72, 32, "New Game", "closemenu;disconnect;maxclients 1;spectator \"\";samelevel \"\";deathmatch \"\";set_calc coop ($cl_splitscreen>0);startmap_sp\n");
|
2018-08-04 07:05:20 +00:00
|
|
|
#ifdef SAVEDGAMES
|
2014-10-05 20:04:11 +00:00
|
|
|
MC_AddConsoleCommandQBigFont (menu, 72, 52, "Load Game", "menu_load\n");
|
|
|
|
MC_AddConsoleCommandQBigFont (menu, 72, 72, "Save Game", "menu_save\n");
|
2018-08-04 07:05:20 +00:00
|
|
|
#endif
|
2006-03-06 01:41:09 +00:00
|
|
|
|
2014-10-05 20:04:11 +00:00
|
|
|
menu->cursoritem = (menuoption_t*)MC_AddCursor(menu, &resel, 54, 32);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ //q1
|
|
|
|
menu = M_CreateMenu(0);
|
|
|
|
MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp");
|
2016-02-10 23:23:43 +00:00
|
|
|
MC_AddCenterPicture(menu, 4, 24, "gfx/ttl_sgl.lmp");
|
2014-10-05 20:04:11 +00:00
|
|
|
}
|
|
|
|
break;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
2011-03-31 01:14:01 +00:00
|
|
|
p = R2D_SafeCachePic("gfx/sp_menu.lmp");
|
2004-08-23 00:15:46 +00:00
|
|
|
if (!p)
|
|
|
|
{
|
2014-03-30 08:55:06 +00:00
|
|
|
MC_AddWhiteText(menu, 92, 0, 12*8, "Couldn't find file", false);
|
|
|
|
MC_AddWhiteText(menu, 92, 0, 13*8, "gfx/sp_menu.lmp", false);
|
2021-04-14 05:21:04 +00:00
|
|
|
MC_AddBox (menu, 72, 11*8, 23*8, 4*8);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-10-13 17:50:28 +00:00
|
|
|
int width;
|
|
|
|
if (R_GetShaderSizes(p, &width, NULL, true) <= 0)
|
|
|
|
width = 232;
|
|
|
|
|
2009-11-04 21:16:50 +00:00
|
|
|
MC_AddPicture(menu, 72, 32, 232, 64, "gfx/sp_menu.lmp");
|
|
|
|
|
2023-07-15 01:38:06 +00:00
|
|
|
b = MC_AddConsoleCommand (menu, 72, 304, 32, "", "closemenu;disconnect;maxclients 1;spectator \"\";samelevel \"\";deathmatch \"\";set_calc coop ($cl_splitscreen>0);startmap_sp\n");
|
2009-11-04 21:16:50 +00:00
|
|
|
menu->selecteditem = (menuoption_t *)b;
|
2017-10-13 17:50:28 +00:00
|
|
|
b->common.width = width;
|
2009-11-04 21:16:50 +00:00
|
|
|
b->common.height = 20;
|
2018-08-04 07:05:20 +00:00
|
|
|
#ifdef SAVEDGAMES
|
2017-10-13 17:50:28 +00:00
|
|
|
b = MC_AddConsoleCommand (menu, 72, 304, 52, "", "menu_load\n");
|
|
|
|
b->common.width = width;
|
2009-11-04 21:16:50 +00:00
|
|
|
b->common.height = 20;
|
2017-10-13 17:50:28 +00:00
|
|
|
b = MC_AddConsoleCommand (menu, 72, 304, 72, "", "menu_save\n");
|
|
|
|
b->common.width = width;
|
|
|
|
b->common.height = 20;
|
2018-08-04 07:05:20 +00:00
|
|
|
#endif
|
2017-10-13 17:50:28 +00:00
|
|
|
|
2018-03-25 09:36:14 +00:00
|
|
|
#if MAX_SPLITS > 1
|
2019-07-07 04:20:09 +00:00
|
|
|
b = (menubutton_t*)MC_AddCvarCombo(menu, 72, 72+width/2, 92, "", &cl_splitscreen, splitopts, splitvals);
|
2017-10-13 17:50:28 +00:00
|
|
|
MC_AddWhiteText(menu, 72, 0, 92, "^aSplitscreen", false);
|
2009-11-04 21:16:50 +00:00
|
|
|
b->common.height = 20;
|
2017-10-13 17:50:28 +00:00
|
|
|
b->common.width = width;
|
2018-03-25 09:36:14 +00:00
|
|
|
#endif
|
2009-04-01 22:03:56 +00:00
|
|
|
|
2014-08-17 03:18:43 +00:00
|
|
|
menu->cursoritem = (menuoption_t*)MC_AddCursor(menu, &resel, 54, 32);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2009-11-04 21:16:50 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-05 00:19:57 +00:00
|
|
|
typedef struct demoitem_s {
|
|
|
|
qboolean isdir;
|
|
|
|
int size;
|
|
|
|
struct demoitem_s *next;
|
|
|
|
struct demoitem_s *prev;
|
2011-07-22 13:54:42 +00:00
|
|
|
char name[1];
|
2008-02-05 00:19:57 +00:00
|
|
|
} demoitem_t;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2015-07-09 18:02:49 +00:00
|
|
|
typedef struct {
|
|
|
|
int fsroot; //FS_SYSTEM, FS_GAME, FS_GAMEONLY. if FS_SYSTEM, executed command will have a leading #
|
|
|
|
char path[MAX_OSPATH];
|
|
|
|
char selname[MAX_OSPATH];
|
|
|
|
} demoloc_t;
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
typedef struct {
|
|
|
|
menucustom_t *list;
|
2008-02-05 00:19:57 +00:00
|
|
|
demoitem_t *selected;
|
|
|
|
demoitem_t *firstitem;
|
2013-06-23 02:17:02 +00:00
|
|
|
|
2015-07-09 18:02:49 +00:00
|
|
|
demoloc_t *fs;
|
2004-08-23 00:15:46 +00:00
|
|
|
int pathlen;
|
|
|
|
|
|
|
|
char *command[64]; //these let the menu be used for nearly any sort of file browser.
|
|
|
|
char *ext[64];
|
|
|
|
int numext;
|
|
|
|
|
2015-09-18 20:30:10 +00:00
|
|
|
int dragscroll;
|
|
|
|
int mousedownpos;
|
|
|
|
|
2008-02-05 00:19:57 +00:00
|
|
|
demoitem_t *items;
|
2004-08-23 00:15:46 +00:00
|
|
|
} demomenu_t;
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void M_DemoDraw(int x, int y, menucustom_t *control, emenu_t *menu)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
char *text;
|
|
|
|
demomenu_t *info = menu->data;
|
2008-02-05 00:19:57 +00:00
|
|
|
demoitem_t *item, *lostit;
|
|
|
|
int ty;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2020-04-19 01:23:32 +00:00
|
|
|
char syspath[MAX_OSPATH];
|
|
|
|
if (FS_NativePath(info->fs->path, (info->fs->fsroot==FS_GAME)?FS_GAMEONLY:info->fs->fsroot, syspath, sizeof(syspath)))
|
|
|
|
Draw_FunString(x, y-16, syspath);
|
|
|
|
|
2008-02-05 00:19:57 +00:00
|
|
|
ty = vid.height-24;
|
|
|
|
item = info->selected;
|
|
|
|
while(item)
|
|
|
|
{
|
|
|
|
if (info->firstitem == item)
|
|
|
|
break;
|
|
|
|
if (ty < y)
|
|
|
|
{
|
|
|
|
//we couldn't find it
|
|
|
|
for (lostit = info->firstitem; lostit; lostit = lostit->prev)
|
|
|
|
{
|
|
|
|
if (info->selected == lostit)
|
|
|
|
{
|
|
|
|
item = lostit;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
info->firstitem = item;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
item = item->prev;
|
|
|
|
ty-=8;
|
|
|
|
}
|
|
|
|
if (!item)
|
|
|
|
info->firstitem = info->items;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2023-01-09 05:12:59 +00:00
|
|
|
if (!info->dragscroll && (keydown[K_MOUSE1] || keydown[K_TOUCH]))
|
2015-09-18 20:30:10 +00:00
|
|
|
{
|
|
|
|
info->dragscroll = 1;
|
|
|
|
info->mousedownpos = mousecursor_y;
|
|
|
|
}
|
2023-01-09 05:12:59 +00:00
|
|
|
if (info->dragscroll && (keydown[K_MOUSE1] || keydown[K_TOUCH]))
|
2015-09-18 20:30:10 +00:00
|
|
|
{
|
|
|
|
if (info->mousedownpos >= mousecursor_y+8)
|
|
|
|
{
|
|
|
|
info->dragscroll = 2;
|
|
|
|
info->mousedownpos -= 8;
|
|
|
|
if (info->firstitem->next)
|
|
|
|
{
|
|
|
|
if (info->firstitem == info->selected)
|
|
|
|
info->selected = info->firstitem->next;
|
|
|
|
info->firstitem = info->firstitem->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (info->mousedownpos+8 <= mousecursor_y)
|
|
|
|
{
|
|
|
|
info->dragscroll = 2;
|
|
|
|
info->mousedownpos += 8;
|
|
|
|
if (info->firstitem->prev)
|
|
|
|
{
|
|
|
|
if (ty <= 24)
|
|
|
|
info->selected = info->selected->prev;
|
|
|
|
info->firstitem = info->firstitem->prev;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-02-05 00:19:57 +00:00
|
|
|
|
|
|
|
item = info->firstitem;
|
|
|
|
while(item)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2015-09-18 20:30:10 +00:00
|
|
|
if (y >= vid.height)
|
2008-02-05 00:19:57 +00:00
|
|
|
return;
|
|
|
|
if (!item->isdir)
|
|
|
|
text = va("%-32.32s%6iKB", item->name+info->pathlen, item->size/1024);
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2008-02-05 00:19:57 +00:00
|
|
|
text = item->name+info->pathlen;
|
|
|
|
if (item == info->selected)
|
2015-09-18 20:30:10 +00:00
|
|
|
Draw_AltFunString(x, y, text);
|
2004-08-23 00:15:46 +00:00
|
|
|
else
|
2015-09-18 20:30:10 +00:00
|
|
|
Draw_FunString(x, y, text);
|
2004-08-23 00:15:46 +00:00
|
|
|
y+=8;
|
2008-02-05 00:19:57 +00:00
|
|
|
item = item->next;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
}
|
2019-09-04 07:59:40 +00:00
|
|
|
static void ShowDemoMenu (emenu_t *menu, const char *path);
|
|
|
|
static qboolean M_DemoKey(menucustom_t *control, emenu_t *menu, int key, unsigned int unicode)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
demomenu_t *info = menu->data;
|
2015-09-18 20:30:10 +00:00
|
|
|
demoitem_t *it;
|
2008-02-05 00:19:57 +00:00
|
|
|
int i;
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
switch (key)
|
|
|
|
{
|
2008-02-05 00:19:57 +00:00
|
|
|
case K_MWHEELUP:
|
2004-08-23 00:15:46 +00:00
|
|
|
case K_UPARROW:
|
2017-08-16 02:14:07 +00:00
|
|
|
case K_KP_UPARROW:
|
|
|
|
case K_GP_DPAD_UP:
|
2008-02-05 00:19:57 +00:00
|
|
|
if (info->selected && info->selected->prev)
|
|
|
|
info->selected = info->selected->prev;
|
2015-07-09 18:02:49 +00:00
|
|
|
break;
|
2008-02-05 00:19:57 +00:00
|
|
|
case K_MWHEELDOWN:
|
2004-08-23 00:15:46 +00:00
|
|
|
case K_DOWNARROW:
|
2017-08-16 02:14:07 +00:00
|
|
|
case K_KP_DOWNARROW:
|
|
|
|
case K_GP_DPAD_DOWN:
|
2008-02-05 00:19:57 +00:00
|
|
|
if (info->selected && info->selected->next)
|
|
|
|
info->selected = info->selected->next;
|
2015-07-09 18:02:49 +00:00
|
|
|
break;
|
2008-02-05 00:19:57 +00:00
|
|
|
case K_HOME:
|
|
|
|
info->selected = info->items;
|
2015-07-09 18:02:49 +00:00
|
|
|
break;
|
2008-02-05 00:19:57 +00:00
|
|
|
case K_END:
|
|
|
|
info->selected = info->items;
|
|
|
|
while(info->selected->next)
|
|
|
|
info->selected = info->selected->next;
|
2015-07-09 18:02:49 +00:00
|
|
|
break;
|
2004-08-23 00:15:46 +00:00
|
|
|
case K_PGUP:
|
2008-02-05 00:19:57 +00:00
|
|
|
for (i = 0; i < 10; i++)
|
|
|
|
{
|
|
|
|
if (info->selected && info->selected->prev)
|
|
|
|
info->selected = info->selected->prev;
|
|
|
|
}
|
2015-07-09 18:02:49 +00:00
|
|
|
break;
|
2004-08-23 00:15:46 +00:00
|
|
|
case K_PGDN:
|
2008-02-05 00:19:57 +00:00
|
|
|
for (i = 0; i < 10; i++)
|
|
|
|
{
|
|
|
|
if (info->selected && info->selected->next)
|
|
|
|
info->selected = info->selected->next;
|
|
|
|
}
|
2015-07-09 18:02:49 +00:00
|
|
|
break;
|
2023-01-09 05:14:38 +00:00
|
|
|
case K_TOUCHTAP:
|
2015-09-18 20:30:10 +00:00
|
|
|
case K_MOUSE1:
|
|
|
|
if (info->dragscroll == 2)
|
|
|
|
{
|
|
|
|
info->dragscroll = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
it = info->firstitem;
|
|
|
|
i = (mousecursor_y - control->common.posy) / 8;
|
|
|
|
while(i > 0 && it && it->next)
|
|
|
|
{
|
|
|
|
it = it->next;
|
|
|
|
i--;
|
|
|
|
}
|
|
|
|
if (info->selected != it)
|
|
|
|
{
|
|
|
|
info->selected = it;
|
|
|
|
info->dragscroll = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
//fallthrough
|
2004-08-23 00:15:46 +00:00
|
|
|
case K_ENTER:
|
2013-05-03 04:28:08 +00:00
|
|
|
case K_KP_ENTER:
|
2023-01-09 05:12:59 +00:00
|
|
|
case K_GP_DIAMOND_CONFIRM:
|
2008-02-05 00:19:57 +00:00
|
|
|
if (info->selected)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2008-02-05 00:19:57 +00:00
|
|
|
if (info->selected->isdir)
|
2013-06-23 02:17:02 +00:00
|
|
|
ShowDemoMenu(menu, info->selected->name);
|
2008-02-05 00:19:57 +00:00
|
|
|
else
|
|
|
|
{
|
2015-07-14 14:47:00 +00:00
|
|
|
extern int shift_down;
|
2008-02-05 00:19:57 +00:00
|
|
|
int extnum;
|
2017-07-12 08:15:27 +00:00
|
|
|
const char *ext = COM_GetFileExtension(info->selected->name, NULL);
|
2008-02-05 00:19:57 +00:00
|
|
|
for (extnum = 0; extnum < info->numext; extnum++)
|
2017-07-12 08:15:27 +00:00
|
|
|
if (!stricmp(ext, info->ext[extnum]))
|
2008-02-05 00:19:57 +00:00
|
|
|
break;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-02-05 00:19:57 +00:00
|
|
|
if (extnum == info->numext) //wasn't on our list of extensions.
|
|
|
|
extnum = 0;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2015-09-18 20:30:10 +00:00
|
|
|
if (!info->command[extnum])
|
2017-07-12 08:15:27 +00:00
|
|
|
{ //acceptable archive formats
|
|
|
|
ShowDemoMenu(menu, va("%s/", info->selected->name));
|
|
|
|
return true;
|
|
|
|
}
|
2015-09-18 20:30:10 +00:00
|
|
|
|
2015-07-09 18:02:49 +00:00
|
|
|
Cbuf_AddText(va("%s \"%s%s\"\n", info->command[extnum], (info->fs->fsroot==FS_SYSTEM)?"#":"", info->selected->name), RESTRICT_LOCAL);
|
2015-07-14 14:47:00 +00:00
|
|
|
if (!shift_down)
|
|
|
|
M_RemoveMenu(menu);
|
2015-07-09 18:02:49 +00:00
|
|
|
return true;
|
2008-02-05 00:19:57 +00:00
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2015-07-09 18:02:49 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return false;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2015-07-09 18:02:49 +00:00
|
|
|
if (info->selected)
|
|
|
|
Q_strncpyz(info->fs->selname, info->selected->name, sizeof(info->fs->selname));
|
|
|
|
else
|
|
|
|
Q_strncpyz(info->fs->selname, "", sizeof(info->fs->selname));
|
|
|
|
return true;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
2015-02-02 08:01:53 +00:00
|
|
|
static int QDECL DemoAddItem(const char *filename, qofs_t size, time_t modified, void *parm, searchpathfuncs_t *spath)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
int extnum;
|
|
|
|
demomenu_t *menu = parm;
|
2008-02-05 00:19:57 +00:00
|
|
|
demoitem_t *link, *newi;
|
|
|
|
int side;
|
|
|
|
qboolean isdir;
|
2008-02-05 00:31:34 +00:00
|
|
|
char tempfname[MAX_QPATH];
|
2008-02-05 00:19:57 +00:00
|
|
|
|
|
|
|
char *i;
|
|
|
|
|
|
|
|
i = strchr(filename+menu->pathlen, '/');
|
|
|
|
if (i == NULL)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
for (extnum = 0; extnum < menu->numext; extnum++)
|
2017-07-12 08:15:27 +00:00
|
|
|
if (!stricmp(COM_GetFileExtension(filename, NULL), menu->ext[extnum]))
|
2004-08-23 00:15:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
if (extnum == menu->numext) //wasn't on our list of extensions.
|
|
|
|
return true;
|
2008-02-05 00:19:57 +00:00
|
|
|
isdir = false;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2006-09-17 00:59:22 +00:00
|
|
|
else
|
|
|
|
{
|
2008-02-05 00:19:57 +00:00
|
|
|
i++;
|
|
|
|
if (i-filename > sizeof(tempfname)-2)
|
|
|
|
return true; //too long to fit in our buffers anyway
|
|
|
|
strncpy(tempfname, filename, i-filename);
|
|
|
|
tempfname[i-filename] = 0;
|
|
|
|
filename = tempfname;
|
|
|
|
|
|
|
|
size = 0;
|
|
|
|
isdir = true;
|
2006-09-17 00:59:22 +00:00
|
|
|
}
|
2008-02-05 00:19:57 +00:00
|
|
|
|
|
|
|
if (!menu->items)
|
2011-07-22 13:54:42 +00:00
|
|
|
menu->items = newi = BZ_Malloc(sizeof(*newi) + strlen(filename));
|
2008-02-05 00:19:57 +00:00
|
|
|
else
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2008-02-05 00:19:57 +00:00
|
|
|
link = menu->items;
|
|
|
|
for(;;)
|
|
|
|
{
|
|
|
|
if (link->isdir != isdir) //bias directories, so they sink
|
|
|
|
side = (link->isdir > isdir)?1:-1;
|
|
|
|
else
|
|
|
|
side = stricmp(link->name, filename);
|
|
|
|
if (side == 0)
|
|
|
|
return true; //already got this file
|
|
|
|
else if (side > 0)
|
|
|
|
{
|
|
|
|
if (!link->prev)
|
|
|
|
{
|
2011-07-22 13:54:42 +00:00
|
|
|
link->prev = newi = BZ_Malloc(sizeof(*newi) + strlen(filename));
|
2008-02-05 00:19:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
link = link->prev;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!link->next)
|
|
|
|
{
|
2011-07-22 13:54:42 +00:00
|
|
|
link->next = newi = BZ_Malloc(sizeof(*newi) + strlen(filename));
|
2008-02-05 00:19:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
link = link->next;
|
|
|
|
}
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2008-02-05 00:19:57 +00:00
|
|
|
|
2011-07-22 13:54:42 +00:00
|
|
|
strcpy(newi->name, filename);
|
2008-02-05 00:19:57 +00:00
|
|
|
newi->size = size;
|
|
|
|
newi->isdir = isdir;
|
|
|
|
newi->prev = NULL;
|
|
|
|
newi->next = NULL;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-02-05 00:19:57 +00:00
|
|
|
//converts the binary tree into sorted linked list
|
|
|
|
static void M_Demo_Flatten(demomenu_t *info)
|
|
|
|
{
|
|
|
|
demoitem_t *btree = info->items, *item, *lastitem;
|
|
|
|
demoitem_t *listhead = NULL, *listlast = NULL;
|
|
|
|
|
|
|
|
while(btree)
|
|
|
|
{
|
|
|
|
if (!btree->prev)
|
|
|
|
{ //none on left side, descend down right removing head node
|
|
|
|
item = btree;
|
|
|
|
btree = btree->next;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
item = btree;
|
|
|
|
lastitem = item;
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
if (!item->prev)
|
|
|
|
{
|
|
|
|
lastitem->prev = item->next;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
lastitem = item;
|
|
|
|
item = lastitem->prev;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (listlast)
|
|
|
|
{
|
|
|
|
listlast->next = item;
|
|
|
|
item->prev = listlast;
|
|
|
|
listlast = item;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
listhead = listlast = item;
|
|
|
|
item->prev = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (listlast)
|
|
|
|
listlast->next = NULL;
|
|
|
|
info->items = listhead;
|
|
|
|
info->selected = listhead;
|
|
|
|
info->firstitem = listhead;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void M_Demo_Flush (demomenu_t *info)
|
|
|
|
{
|
|
|
|
demoitem_t *item;
|
|
|
|
while (info->items)
|
|
|
|
{
|
|
|
|
item = info->items;
|
|
|
|
info->items = item->next;
|
|
|
|
BZ_Free(item);
|
|
|
|
}
|
|
|
|
info->items = NULL;
|
|
|
|
info->selected = NULL;
|
|
|
|
info->firstitem = NULL;
|
|
|
|
}
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void M_Demo_Remove (emenu_t *menu)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
demomenu_t *info = menu->data;
|
2008-02-05 00:19:57 +00:00
|
|
|
M_Demo_Flush(info);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
2019-09-04 07:59:40 +00:00
|
|
|
static void ShowDemoMenu (emenu_t *menu, const char *path)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2013-06-23 02:17:02 +00:00
|
|
|
demomenu_t *info = menu->data;
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
int c;
|
|
|
|
char *s;
|
|
|
|
char match[256];
|
2013-06-23 02:17:02 +00:00
|
|
|
|
2015-07-09 18:02:49 +00:00
|
|
|
if (path != info->fs->path)
|
|
|
|
{
|
2020-04-19 01:23:32 +00:00
|
|
|
if (*path == '/' && info->fs->fsroot != FS_SYSTEM)
|
2015-07-09 18:02:49 +00:00
|
|
|
path++;
|
|
|
|
Q_strncpyz(info->fs->path, path, sizeof(info->fs->path));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (info->fs->fsroot == FS_GAME)
|
2020-04-19 01:23:32 +00:00
|
|
|
{
|
|
|
|
if (!strcmp(path, "../"))
|
|
|
|
{
|
|
|
|
Q_strncpyz(info->fs->path, "", sizeof(info->fs->path));
|
|
|
|
info->fs->fsroot = FS_ROOT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (info->fs->fsroot == FS_ROOT)
|
2013-06-23 02:17:02 +00:00
|
|
|
{
|
|
|
|
if (!strcmp(path, "../"))
|
|
|
|
{
|
2015-07-09 18:02:49 +00:00
|
|
|
FS_NativePath("", FS_ROOT, info->fs->path, sizeof(info->fs->path));
|
2020-04-19 01:23:32 +00:00
|
|
|
Q_strncatz(info->fs->path, "../", sizeof(info->fs->path));
|
2015-07-09 18:02:49 +00:00
|
|
|
info->fs->fsroot = FS_SYSTEM;
|
|
|
|
while((s = strchr(info->fs->path, '\\')))
|
2013-06-23 02:17:02 +00:00
|
|
|
*s = '/';
|
|
|
|
}
|
|
|
|
}
|
2015-07-09 18:02:49 +00:00
|
|
|
while (!strcmp(info->fs->path+strlen(info->fs->path)-3, "../"))
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
c = 0;
|
2015-07-09 18:02:49 +00:00
|
|
|
for (s = info->fs->path+strlen(info->fs->path)-3; s >= info->fs->path; s--)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
if (*s == '/')
|
|
|
|
{
|
|
|
|
c++;
|
|
|
|
s[1] = '\0';
|
|
|
|
if (c == 2)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (c<2)
|
2015-07-09 18:02:49 +00:00
|
|
|
*info->fs->path = '\0';
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2013-06-23 02:17:02 +00:00
|
|
|
info->selected = NULL;
|
2015-07-09 18:02:49 +00:00
|
|
|
info->pathlen = strlen(info->fs->path);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-02-05 00:19:57 +00:00
|
|
|
M_Demo_Flush(menu->data);
|
2015-07-09 18:02:49 +00:00
|
|
|
if (info->fs->fsroot == FS_SYSTEM)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2015-07-09 18:02:49 +00:00
|
|
|
s = strchr(info->fs->path, '/');
|
2013-06-23 02:17:02 +00:00
|
|
|
if (s && strchr(s+1, '/'))
|
|
|
|
{
|
2015-07-09 18:02:49 +00:00
|
|
|
Q_snprintfz(match, sizeof(match), "%s../", info->fs->path);
|
2015-02-02 08:01:53 +00:00
|
|
|
DemoAddItem(match, 0, 0, info, NULL);
|
2013-06-23 02:17:02 +00:00
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2015-07-09 18:02:49 +00:00
|
|
|
else if (*info->fs->path)
|
2013-06-23 02:17:02 +00:00
|
|
|
{
|
2015-07-09 18:02:49 +00:00
|
|
|
Q_snprintfz(match, sizeof(match), "%s../", info->fs->path);
|
2015-02-02 08:01:53 +00:00
|
|
|
DemoAddItem(match, 0, 0, info, NULL);
|
2013-06-23 02:17:02 +00:00
|
|
|
}
|
2020-04-19 01:23:32 +00:00
|
|
|
else if (info->fs->fsroot == FS_GAME || info->fs->fsroot == FS_ROOT)
|
2013-06-23 02:17:02 +00:00
|
|
|
{
|
2013-06-23 03:59:48 +00:00
|
|
|
Q_snprintfz(match, sizeof(match), "../");
|
2015-02-02 08:01:53 +00:00
|
|
|
DemoAddItem(match, 0, 0, info, NULL);
|
2013-06-23 02:17:02 +00:00
|
|
|
}
|
2015-07-09 18:02:49 +00:00
|
|
|
if (info->fs->fsroot == FS_SYSTEM)
|
2013-06-23 02:17:02 +00:00
|
|
|
{
|
2016-07-12 00:40:13 +00:00
|
|
|
if (*info->fs->path)
|
2015-07-09 18:02:49 +00:00
|
|
|
Q_snprintfz(match, sizeof(match), "%s*", info->fs->path);
|
2014-12-11 16:26:26 +00:00
|
|
|
else
|
|
|
|
Q_snprintfz(match, sizeof(match), "/*");
|
2013-06-23 02:17:02 +00:00
|
|
|
Sys_EnumerateFiles("", match, DemoAddItem, info, NULL);
|
|
|
|
}
|
2020-04-19 01:23:32 +00:00
|
|
|
else if (info->fs->fsroot == FS_ROOT)
|
|
|
|
{
|
|
|
|
Q_snprintfz(match, sizeof(match), "%s*", info->fs->path);
|
|
|
|
if (*com_homepath)
|
|
|
|
Sys_EnumerateFiles(com_homepath, match, DemoAddItem, info, NULL);
|
|
|
|
Sys_EnumerateFiles(com_gamepath, match, DemoAddItem, info, NULL);
|
|
|
|
}
|
2013-06-23 02:17:02 +00:00
|
|
|
else
|
|
|
|
{
|
2015-07-09 18:02:49 +00:00
|
|
|
Q_snprintfz(match, sizeof(match), "%s*", info->fs->path);
|
2017-07-12 08:15:27 +00:00
|
|
|
CL_ListFilesInPackage(NULL, match, DemoAddItem, info, NULL);
|
|
|
|
// COM_EnumerateFiles(match, DemoAddItem, info);
|
2013-06-23 02:17:02 +00:00
|
|
|
}
|
|
|
|
M_Demo_Flatten(info);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2015-07-09 18:02:49 +00:00
|
|
|
void M_Demo_Reselect(demomenu_t *info, const char *name)
|
|
|
|
{
|
|
|
|
demoitem_t *item;
|
|
|
|
for(item = info->items; item; item = item->next)
|
|
|
|
{
|
|
|
|
if (!strcmp(item->name, name))
|
|
|
|
{
|
|
|
|
info->selected = item;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
void M_Menu_Demos_f (void)
|
|
|
|
{
|
2018-09-01 04:18:08 +00:00
|
|
|
char *demoexts[] = {
|
|
|
|
".mvd", ".mvd.gz",
|
|
|
|
".qwz", ".qwz.gz",
|
|
|
|
#ifdef NQPROT
|
|
|
|
".dem", ".dem.gz",
|
|
|
|
#endif
|
|
|
|
#ifdef Q2CLIENT
|
|
|
|
".dm2", ".dm2.gz"
|
|
|
|
#endif
|
|
|
|
//there are also qizmo demos (.qwz) out there...
|
|
|
|
//we don't support them, but if we were to ask quizmo to decode them for us, we could do.
|
|
|
|
};
|
|
|
|
char *archiveexts[] = {
|
|
|
|
#ifdef PACKAGE_PK3
|
|
|
|
".zip", ".pk3", ".pk4",
|
|
|
|
#endif
|
|
|
|
#ifdef PACKAGE_Q1PAK
|
|
|
|
".pak",
|
|
|
|
#endif
|
|
|
|
#ifdef PACKAGE_DZIP
|
|
|
|
".dz",
|
|
|
|
#endif
|
2018-10-17 00:43:04 +00:00
|
|
|
NULL //in case none of the above are defined. compilers don't much like 0-length arrays.
|
2018-09-01 04:18:08 +00:00
|
|
|
};
|
|
|
|
size_t u;
|
2004-08-23 00:15:46 +00:00
|
|
|
demomenu_t *info;
|
2019-09-04 07:59:40 +00:00
|
|
|
emenu_t *menu;
|
2016-07-12 00:40:13 +00:00
|
|
|
static demoloc_t mediareenterloc = {FS_GAME, "demos/"};
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2015-07-09 18:02:49 +00:00
|
|
|
Key_Dest_Remove(kdm_console);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
menu = M_CreateMenu(sizeof(demomenu_t));
|
|
|
|
menu->remove = M_Demo_Remove;
|
|
|
|
info = menu->data;
|
|
|
|
|
2015-07-09 18:02:49 +00:00
|
|
|
info->fs = &mediareenterloc;
|
2013-06-23 02:17:02 +00:00
|
|
|
|
2016-07-12 00:40:13 +00:00
|
|
|
if (Cmd_Argc()>1)
|
|
|
|
{
|
|
|
|
char *startdemo = Cmd_Argv(1);
|
|
|
|
if (*startdemo == '#')
|
|
|
|
{
|
|
|
|
startdemo++;
|
|
|
|
info->fs->fsroot = FS_SYSTEM;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
info->fs->fsroot = FS_GAME;
|
|
|
|
Q_strncpyz(info->fs->path, startdemo, sizeof(info->fs->path));
|
|
|
|
*COM_SkipPath(info->fs->path) = 0;
|
|
|
|
Q_strncpyz(info->fs->selname, startdemo, sizeof(info->fs->selname));
|
|
|
|
}
|
|
|
|
|
2014-03-30 08:55:06 +00:00
|
|
|
info->numext = 0;
|
2018-09-01 04:18:08 +00:00
|
|
|
for (u = 0; u < countof(demoexts); u++)
|
|
|
|
{
|
|
|
|
info->command[info->numext] = "closemenu;playdemo";
|
|
|
|
info->ext[info->numext++] = demoexts[u];
|
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2014-03-30 08:55:06 +00:00
|
|
|
//and some archive formats... for the luls
|
2018-09-01 04:18:08 +00:00
|
|
|
for (u = 0; u < countof(archiveexts); u++)
|
|
|
|
{
|
2018-10-17 00:43:04 +00:00
|
|
|
if (!archiveexts[u])
|
2018-09-01 04:18:08 +00:00
|
|
|
continue;
|
|
|
|
info->command[info->numext] = NULL;
|
|
|
|
info->ext[info->numext++] = archiveexts[u];
|
|
|
|
}
|
2014-03-30 08:55:06 +00:00
|
|
|
|
|
|
|
MC_AddWhiteText(menu, 24, 170, 8, "Choose a Demo", false);
|
2016-07-21 19:27:59 +00:00
|
|
|
MC_AddWhiteText(menu, 16, 170, 24, "^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f", false);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2019-01-15 14:12:49 +00:00
|
|
|
info->list = MC_AddCustom(menu, 0, 32, NULL, 0, NULL);
|
2004-08-23 00:15:46 +00:00
|
|
|
info->list->draw = M_DemoDraw;
|
|
|
|
info->list->key = M_DemoKey;
|
|
|
|
|
|
|
|
menu->selecteditem = (menuoption_t*)info->list;
|
|
|
|
|
2015-07-09 18:02:49 +00:00
|
|
|
ShowDemoMenu(menu, info->fs->path);
|
|
|
|
M_Demo_Reselect(info, info->fs->selname);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
2017-02-21 20:22:07 +00:00
|
|
|
#ifdef HAVE_JUKEBOX
|
2004-08-23 00:15:46 +00:00
|
|
|
void M_Menu_MediaFiles_f (void)
|
|
|
|
{
|
|
|
|
demomenu_t *info;
|
2019-09-04 07:59:40 +00:00
|
|
|
emenu_t *menu;
|
2015-07-09 18:02:49 +00:00
|
|
|
static demoloc_t mediareenterloc = {FS_GAME};
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
menu = M_CreateMenu(sizeof(demomenu_t));
|
|
|
|
menu->remove = M_Demo_Remove;
|
|
|
|
info = menu->data;
|
|
|
|
|
2015-07-09 18:02:49 +00:00
|
|
|
info->fs = &mediareenterloc;
|
2015-07-14 14:47:00 +00:00
|
|
|
info->numext = 0;
|
2013-06-23 02:17:02 +00:00
|
|
|
|
2017-02-21 20:22:07 +00:00
|
|
|
#ifdef HAVE_JUKEBOX
|
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
|
|
|
// info->ext[info->numext] = ".m3u";
|
|
|
|
// info->command[info->numext] = "mediaplaylist";
|
|
|
|
// info->numext++;
|
2015-07-14 14:47:00 +00:00
|
|
|
info->ext[info->numext] = ".wav";
|
|
|
|
info->command[info->numext] = "media_add";
|
|
|
|
info->numext++;
|
2020-10-26 06:30:35 +00:00
|
|
|
#if defined(AVAIL_OGGOPUS) || defined(FTE_TARGET_WEB) || defined(PLUGINS)
|
2018-05-06 16:09:07 +00:00
|
|
|
info->ext[info->numext] = ".opus";
|
|
|
|
info->command[info->numext] = "media_add";
|
|
|
|
info->numext++;
|
|
|
|
#endif
|
2020-10-26 06:30:35 +00:00
|
|
|
#if defined(AVAIL_OGGVORBIS) || defined(FTE_TARGET_WEB) || defined(PLUGINS)
|
2018-05-06 16:09:07 +00:00
|
|
|
info->ext[info->numext] = ".ogg";
|
2015-07-14 14:47:00 +00:00
|
|
|
info->command[info->numext] = "media_add";
|
|
|
|
info->numext++;
|
|
|
|
#endif
|
2020-10-26 06:30:35 +00:00
|
|
|
#if defined(AVAIL_MP3_ACM) || defined(FTE_TARGET_WEB) || defined(PLUGINS)
|
|
|
|
info->ext[info->numext] = ".mp3";
|
|
|
|
info->command[info->numext] = "media_add";
|
|
|
|
info->numext++;
|
|
|
|
#endif
|
|
|
|
#if defined(PLUGINS)
|
|
|
|
info->ext[info->numext] = ".flac";
|
|
|
|
info->command[info->numext] = "media_add";
|
|
|
|
info->numext++;
|
|
|
|
#endif
|
2017-02-21 20:22:07 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2017-02-21 20:22:07 +00:00
|
|
|
#ifdef HAVE_MEDIA_DECODER
|
2015-07-14 14:47:00 +00:00
|
|
|
info->ext[info->numext] = ".roq";
|
|
|
|
info->command[info->numext] = "playfilm";
|
|
|
|
info->numext++;
|
2004-08-23 00:15:46 +00:00
|
|
|
#ifdef _WIN32 //avis are only playable on windows due to a windows dll being used to decode them.
|
|
|
|
info->ext[info->numext] = ".avi";
|
|
|
|
info->command[info->numext] = "playfilm";
|
|
|
|
info->numext++;
|
2017-02-21 20:22:07 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
2014-03-30 08:55:06 +00:00
|
|
|
MC_AddWhiteText(menu, 24, 170, 8, "Media List", false);
|
2016-07-21 19:27:59 +00:00
|
|
|
MC_AddWhiteText(menu, 16, 170, 24, "^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f", false);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2019-01-15 14:12:49 +00:00
|
|
|
info->list = MC_AddCustom(menu, 0, 32, NULL, 0, NULL);
|
2004-08-23 00:15:46 +00:00
|
|
|
info->list->draw = M_DemoDraw;
|
|
|
|
info->list->key = M_DemoKey;
|
|
|
|
|
|
|
|
menu->selecteditem = (menuoption_t*)info->list;
|
|
|
|
|
2015-07-09 18:02:49 +00:00
|
|
|
ShowDemoMenu(menu, info->fs->path);
|
|
|
|
M_Demo_Reselect(info, info->fs->selname);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2014-09-02 02:44:43 +00:00
|
|
|
#endif
|
2017-02-21 20:22:07 +00:00
|
|
|
#endif
|