engine: client: make the code that generates screenshots and demos names simpler.

This commit is contained in:
Andrey Akhmichin 2019-11-03 13:16:05 +05:00 committed by Alibek Omarov
parent f09682131f
commit 0c34a5081c
2 changed files with 3 additions and 33 deletions

View File

@ -147,23 +147,13 @@ CL_ScreenshotGetName
*/ */
qboolean CL_ScreenshotGetName( int lastnum, char *filename ) qboolean CL_ScreenshotGetName( int lastnum, char *filename )
{ {
int a, b, c, d;
if( lastnum < 0 || lastnum > 9999 ) if( lastnum < 0 || lastnum > 9999 )
{ {
Con_Printf( S_ERROR "unable to write screenshot\n" ); Con_Printf( S_ERROR "unable to write screenshot\n" );
return false; return false;
} }
a = lastnum / 1000; Q_sprintf( filename, "scrshots/%s_shot%0004d.png", clgame.mapname, lastnum );
lastnum -= a * 1000;
b = lastnum / 100;
lastnum -= b * 100;
c = lastnum / 10;
lastnum -= c * 10;
d = lastnum;
Q_sprintf( filename, "scrshots/%s_shot%i%i%i%i.png", clgame.mapname, a, b, c, d );
return true; return true;
} }
@ -175,8 +165,6 @@ CL_SnapshotGetName
*/ */
qboolean CL_SnapshotGetName( int lastnum, char *filename ) qboolean CL_SnapshotGetName( int lastnum, char *filename )
{ {
int a, b, c, d;
if( lastnum < 0 || lastnum > 9999 ) if( lastnum < 0 || lastnum > 9999 )
{ {
Con_Printf( S_ERROR "unable to write snapshot\n" ); Con_Printf( S_ERROR "unable to write snapshot\n" );
@ -184,15 +172,7 @@ qboolean CL_SnapshotGetName( int lastnum, char *filename )
return false; return false;
} }
a = lastnum / 1000; Q_sprintf( filename, "../%s_%0004d.png", clgame.mapname, lastnum );
lastnum -= a * 1000;
b = lastnum / 100;
lastnum -= b * 100;
c = lastnum / 10;
lastnum -= c * 10;
d = lastnum;
Q_sprintf( filename, "../%s_%i%i%i%i.png", clgame.mapname, a, b, c, d );
return true; return true;
} }

View File

@ -1304,8 +1304,6 @@ CL_DemoGetName
*/ */
static void CL_DemoGetName( int lastnum, char *filename ) static void CL_DemoGetName( int lastnum, char *filename )
{ {
int a, b, c, d;
if( lastnum < 0 || lastnum > 9999 ) if( lastnum < 0 || lastnum > 9999 )
{ {
// bound // bound
@ -1313,15 +1311,7 @@ static void CL_DemoGetName( int lastnum, char *filename )
return; return;
} }
a = lastnum / 1000; Q_sprintf( filename, "demo%0004d", lastnum );
lastnum -= a * 1000;
b = lastnum / 100;
lastnum -= b * 100;
c = lastnum / 10;
lastnum -= c * 10;
d = lastnum;
Q_sprintf( filename, "demo%i%i%i%i", a, b, c, d );
} }
/* /*