Move screenshots to $fs_userpath/QF.

I got tired of screenshots getting scatter across the tree. ShotsPath in
the dirconf can override this.
This commit is contained in:
Bill Currie 2012-01-05 17:04:23 +09:00
parent 91cb875115
commit b13a2b6dbd
7 changed files with 13 additions and 4 deletions

View file

@ -93,6 +93,9 @@ Supported attributes are:
<dt><code>MapPath</code></dt>
<dd>Where to look for maps. Defaults to
<code>\${path}/maps</code>.</dd>
<dt><code>ShotsPath</code></dt>
<dd>Where to write screenshots. Defaults to
<code>QF</code>.</dd>
</dl>
Attribute allow variable substitution. Variables can take the form of

View file

@ -64,6 +64,7 @@ typedef struct gamedir_s {
const char *models; ///< directory to which to write models
const char *sound; ///< directory to which to write sounds
const char *maps; ///< directory to which to write maps
const char *shots; ///< directory to which to write screenshots
} dir;
} gamedir_t;

View file

@ -338,6 +338,8 @@ qfs_get_gd_params (plitem_t *gdpl, gamedir_t *gamedir, dstring_t *path,
gamedir->dir.sound = qfs_var_subst (PL_String (p), vars);
if (!gamedir->dir.maps && (p = PL_ObjectForKey (gdpl, "MapPath")))
gamedir->dir.maps = qfs_var_subst (PL_String (p), vars);
if (!gamedir->dir.shots && (p = PL_ObjectForKey (gdpl, "ShotsPath")))
gamedir->dir.shots = qfs_var_subst (PL_String (p), vars);
}
static void
@ -550,6 +552,8 @@ qfs_build_gamedir (const char **list)
gamedir->dir.sound = nva ("%s/sound", gamedir->dir.def);
if (!gamedir->dir.maps)
gamedir->dir.maps = nva ("%s/maps", gamedir->dir.def);
if (!gamedir->dir.shots)
gamedir->dir.shots = strdup ("QF");
qfs_gamedir = gamedir;
Sys_MaskPrintf (SYS_FS, "%s\n", qfs_gamedir->name);

View file

@ -138,7 +138,7 @@ SCR_ScreenShot_f (void)
// find a file name to save it to
if (!QFS_NextFilename (pcxname,
va ("%s/qf", qfs_gamedir->dir.def), ".tga")) {
va ("%s/qf", qfs_gamedir->dir.shots), ".tga")) {
Sys_Printf ("SCR_ScreenShot_f: Couldn't create a TGA file\n");
} else {
buffer = malloc (vid.width * vid.height * 3);

View file

@ -217,7 +217,8 @@ SCR_ScreenShot_f (void)
int size, i;
// find a file name to save it to
if (!QFS_NextFilename (name, va ("%s/qf", qfs_gamedir->dir.def), ".png")) {
if (!QFS_NextFilename (name,
va ("%s/qf", qfs_gamedir->dir.shots), ".png")) {
Sys_Printf ("SCR_ScreenShot_f: Couldn't create a PNG file\n");
} else {
size = vid.width * vid.height;

View file

@ -161,7 +161,7 @@ SCR_ScreenShot_f (void)
// find a file name to save it to
if (!QFS_NextFilename (pcxname,
va ("%s/qf", qfs_gamedir->dir.def), ".pcx")) {
va ("%s/qf", qfs_gamedir->dir.shots), ".pcx")) {
Sys_Printf ("SCR_ScreenShot_f: Couldn't create a PCX");
} else {
// enable direct drawing of console to back buffer

View file

@ -170,7 +170,7 @@ SCR_ScreenShot_f (void)
// find a file name to save it to
if (!QFS_NextFilename (pcxname,
va ("%s/qf", qfs_gamedir->dir.def), ".pcx")) {
va ("%s/qf", qfs_gamedir->dir.shots), ".pcx")) {
Sys_Printf ("SCR_ScreenShot_f: Couldn't create a PCX");
} else {
// enable direct drawing of console to back buffer