/* =============== UI_DemosMenu =============== */ void UI_DemosMenu (qboolean useQuakeLiveDir) { UseQuakeLiveDir = useQuakeLiveDir; if (UseQuakeLiveDir) { Demos_MenuInit("ql:demos"); } else { Demos_MenuInit("demos"); } UI_PushMenu(&s_demos.menu); }
static void Demos_PlayDemoOrChangeDir (void) { const char *fname; int i; int len; int end; char strippedName[MAX_OSPATH]; const char *matchString; if (UseQuakeLiveDir) { matchString = "ql:demos"; } else { matchString = "demos"; } fname = s_demos.list.itemnames[s_demos.list.curvalue]; if (Demos_IsDir(fname)) { //Com_Printf("dir: '%s' '%s'\n", s_demos.dirName, fname); if (!Q_stricmpn(fname, "../", strlen("../"))) { if (!Q_stricmpn(s_demos.dirName, matchString, sizeof(s_demos.dirName))) { //FIXME hack to avoid problems return; } UI_PopMenu(); len = strlen(s_demos.dirName); if (len <= 0) { Com_Printf("^1Demos_PlayDemoOrChangeDir() FIXME shouldn't happen dirName NULL\n"); return; } end = len - 1; for (i = end; i >= 0; i--) { if (s_demos.dirName[i] == '/') { s_demos.dirName[i] = '\0'; break; } } Demos_MenuInit(va("%s", s_demos.dirName)); } else { // subdir UI_PopMenu(); Q_strncpyz(strippedName, fname, sizeof(strippedName)); strippedName[strlen(fname) - 1] = '\0'; Demos_MenuInit(va("%s/%s", s_demos.dirName, strippedName)); } //UI_PopMenu(); UI_PushMenu(&s_demos.menu); return; } else { //FIXME hack //Com_Printf("^3dirName '%s' fname '%s'\n", s_demos.dirName, fname); UI_ForceMenuOff(); trap_Cmd_ExecuteText(EXEC_APPEND, va("demo \"%s/%s\"\n", s_demos.dirName, fname)); } }
/* =============== UI_DemosMenu =============== */ void UI_DemosMenu( void ) { Demos_MenuInit(); UI_PushMenu( &s_demos.menu ); }