Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Nov 27, 2018
1 parent 2b11b50 commit 897dd90
Show file tree
Hide file tree
Showing 22 changed files with 366 additions and 147 deletions.
12 changes: 12 additions & 0 deletions change.log
Expand Up @@ -16,6 +16,18 @@ VGUI: - a VGUI implementation code in xash.dll
Memory: - a memory manager in xash.dll
Physic: - a server physics code in xash.dll

build 4312

Client: demos moved from folder that called "demos" into the root of gamefolder
Client: demoshots are removed
Client: automatically detection of demo type (Quake or Xash3D)
Render: a new debug visualization of world bsp-tree (cvar r_showtree 0\1)
Render: do a some corrections for Quake fog settings
Client: fix bug playing AVI with compressed soundtracks
Input: ignore to suspend display while game window is foreground
Server: development command that called "nextmap". change the maps with alphabethical order
GameUI: fully support for steam background splashes (with BackgroundLayout.txt script)

build 4281

GameUI: new gameinfo setting "noskills" 0/1 that disables sub-menu for skill selection
Expand Down
26 changes: 3 additions & 23 deletions engine/client/cl_cmds.c
Expand Up @@ -345,7 +345,7 @@ void CL_LevelShot_f( void )
if( cls.demoplayback && ( cls.demonum != -1 ))
{
Q_sprintf( cls.shotname, "levelshots/%s_%s.bmp", cls.demoname, glState.wideScreen ? "16x9" : "4x3" );
Q_snprintf( filename, sizeof( filename ), "demos/%s.dem", cls.demoname );
Q_snprintf( filename, sizeof( filename ), "%s.dem", cls.demoname );

// make sure what levelshot is newer than demo
ft1 = FS_FileTime( filename, false );
Expand Down Expand Up @@ -385,25 +385,6 @@ void CL_SaveShot_f( void )
cls.scrshot_action = scrshot_savegame; // build new frame for saveshot
}

/*
==================
CL_DemoShot_f
mini-pic in playdemo menu
==================
*/
void CL_DemoShot_f( void )
{
if( Cmd_Argc() < 2 )
{
Con_Printf( S_USAGE "demoshot <demoname>\n" );
return;
}

Q_sprintf( cls.shotname, "demos/%s.bmp", Cmd_Argv( 1 ));
cls.scrshot_action = scrshot_demoshot; // build new frame for demoshot
}

/*
==============
CL_DeleteDemo_f
Expand All @@ -424,9 +405,8 @@ void CL_DeleteDemo_f( void )
return;
}

// delete save and saveshot
FS_Delete( va( "demos/%s.dem", Cmd_Argv( 1 )));
FS_Delete( va( "demos/%s.bmp", Cmd_Argv( 1 )));
// delete demo
FS_Delete( va( "%s.dem", Cmd_Argv( 1 )));
}

/*
Expand Down
95 changes: 44 additions & 51 deletions engine/client/cl_demo.c
Expand Up @@ -669,31 +669,6 @@ void CL_DemoStartPlayback( int mode )
cl.last_command_ack = -1;
}

/*
=================
CL_PlayDemoQuake
=================
*/
void CL_PlayDemoQuake( const char *demoname )
{
int c, neg = false;

cls.demofile = FS_Open( demoname, "rb", true );
Q_strncpy( cls.demoname, demoname, sizeof( cls.demoname ));
Q_strncpy( gameui.globals->demoname, demoname, sizeof( gameui.globals->demoname ));
demo.header.host_fps = host_maxfps->value;
cls.forcetrack = 0;

while(( c = FS_Getc( cls.demofile )) != '\n' )
{
if( c == '-' ) neg = true;
else cls.forcetrack = cls.forcetrack * 10 + (c - '0');
}

if( neg ) cls.forcetrack = -cls.forcetrack;
CL_DemoStartPlayback( DEMO_QUAKE1 );
}

/*
=================
CL_DemoAborted
Expand Down Expand Up @@ -1178,6 +1153,7 @@ void CL_StopPlayback( void )
// let game known about demo state
Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY );
cls.state = ca_disconnected;
cls.set_lastdemo = false;
S_StopBackgroundTrack();
cls.connect_time = 0;
cls.demonum = -1;
Expand Down Expand Up @@ -1356,8 +1332,8 @@ Begins recording a demo from the current position
*/
void CL_Record_f( void )
{
string demoname, demopath;
const char *name;
string demoname, demopath, demoshot;
int n;

if( Cmd_Argc() == 1 )
Expand Down Expand Up @@ -1398,7 +1374,7 @@ void CL_Record_f( void )
for( n = 0; n < 10000; n++ )
{
CL_DemoGetName( n, demoname );
if( !FS_FileExists( va( "demos/%s.dem", demoname ), true ))
if( !FS_FileExists( va( "%s.dem", demoname ), true ))
break;
}

Expand All @@ -1411,18 +1387,12 @@ void CL_Record_f( void )
else Q_strncpy( demoname, name, sizeof( demoname ));

// open the demo file
Q_sprintf( demopath, "demos/%s.dem", demoname );
Q_sprintf( demoshot, "demos/%s.bmp", demoname );

// unload previous image from memory (it's will be overwritten)
GL_FreeImage( demoshot );
Q_sprintf( demopath, "%s.dem", demoname );

// make sure what old demo is removed
if( FS_FileExists( demopath, false )) FS_Delete( demopath );
if( FS_FileExists( demoshot, false )) FS_Delete( demoshot );
if( FS_FileExists( demopath, false ))
FS_Delete( demopath );

// write demoshot for preview
Cbuf_AddText( va( "demoshot \"%s\"\n", demoname ));
Q_strncpy( cls.demoname, demoname, sizeof( cls.demoname ));
Q_strncpy( gameui.globals->demoname, demoname, sizeof( gameui.globals->demoname ));

Expand All @@ -1438,12 +1408,11 @@ playdemo <demoname>
*/
void CL_PlayDemo_f( void )
{
char filename1[MAX_QPATH];
char filename2[MAX_QPATH];
char filename[MAX_QPATH];
char demoname[MAX_QPATH];
int i;
int i, ident;

if( Cmd_Argc() != 2 )
if( Cmd_Argc() < 2 )
{
Con_Printf( S_USAGE "playdemo <demoname>\n" );
return;
Expand All @@ -1462,26 +1431,50 @@ void CL_PlayDemo_f( void )

Q_strncpy( demoname, Cmd_Argv( 1 ), sizeof( demoname ));
COM_StripExtension( demoname );
Q_snprintf( filename1, sizeof( filename1 ), "%s.dem", demoname );
Q_snprintf( filename2, sizeof( filename2 ), "demos/%s.dem", demoname );
Q_snprintf( filename, sizeof( filename ), "%s.dem", demoname );

if( FS_FileExists( filename1, true ))
{
CL_PlayDemoQuake( filename1 );
return;
}
else if( !FS_FileExists( filename2, true ))
// hidden parameter
if( Cmd_Argc() > 2 )
cls.set_lastdemo = Q_atoi( Cmd_Argv( 2 ));

// member last demo
if( cls.set_lastdemo )
Cvar_Set( "lastdemo", demoname );

if( !FS_FileExists( filename, true ))
{
Con_Printf( S_ERROR "couldn't open %s\n", filename2 );
Con_Printf( S_ERROR "couldn't open %s\n", filename );
CL_DemoAborted();
return;
}

cls.demofile = FS_Open( filename2, "rb", true );
cls.demofile = FS_Open( filename, "rb", true );
Q_strncpy( cls.demoname, demoname, sizeof( cls.demoname ));
Q_strncpy( gameui.globals->demoname, demoname, sizeof( gameui.globals->demoname ));

// read in the m_DemoHeader
FS_Read( cls.demofile, &ident, sizeof( int ));
FS_Seek( cls.demofile, 0, SEEK_SET ); // rewind back to start
cls.forcetrack = 0;

// check for quake demos
if( ident != IDEMOHEADER )
{
int c, neg = false;

demo.header.host_fps = host_maxfps->value;

while(( c = FS_Getc( cls.demofile )) != '\n' )
{
if( c == '-' ) neg = true;
else cls.forcetrack = cls.forcetrack * 10 + (c - '0');
}

if( neg ) cls.forcetrack = -cls.forcetrack;
CL_DemoStartPlayback( DEMO_QUAKE1 );
return; // quake demo is started
}

// read in the demo header
FS_Read( cls.demofile, &demo.header, sizeof( demoheader_t ));

if( demo.header.id != IDEMOHEADER )
Expand Down
5 changes: 3 additions & 2 deletions engine/client/cl_main.c
Expand Up @@ -1416,6 +1416,7 @@ void CL_Disconnect( void )
Netchan_Clear( &cls.netchan );

cls.state = ca_disconnected;
cls.set_lastdemo = false;
cls.connect_retry = 0;
cls.signon = 0;

Expand Down Expand Up @@ -2627,6 +2628,7 @@ void CL_InitLocal( void )
Cvar_Get( "hud_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud at current resolution" );
Cvar_Get( "cl_background", "0", FCVAR_READ_ONLY, "indicate what background map is running" );
cl_showevents = Cvar_Get( "cl_showevents", "0", FCVAR_ARCHIVE, "show events playback" );
Cvar_Get( "lastdemo", "", FCVAR_ARCHIVE, "last played demo" );

// these two added to shut up CS 1.5 about 'unknown' commands
Cvar_Get( "lightgamma", "1", FCVAR_ARCHIVE, "ambient lighting level (legacy, unused)" );
Expand Down Expand Up @@ -2658,7 +2660,7 @@ void CL_InitLocal( void )
Cmd_AddCommand ("record", CL_Record_f, "record a demo" );
Cmd_AddCommand ("playdemo", CL_PlayDemo_f, "play a demo" );
Cmd_AddCommand ("timedemo", CL_TimeDemo_f, "demo benchmark" );
Cmd_AddCommand ("killdemo", CL_DeleteDemo_f, "delete a specified demo file and demoshot" );
Cmd_AddCommand ("killdemo", CL_DeleteDemo_f, "delete a specified demo file" );
Cmd_AddCommand ("startdemos", CL_StartDemos_f, "start playing back the selected demos sequentially" );
Cmd_AddCommand ("demos", CL_Demos_f, "restart looping demos defined by the last startdemos command" );
Cmd_AddCommand ("movie", CL_PlayVideo_f, "play a movie" );
Expand All @@ -2680,7 +2682,6 @@ void CL_InitLocal( void )
Cmd_AddCommand ("skyshot", CL_SkyShot_f, "takes a six-sides envmap (skybox) shot with specified name" );
Cmd_AddCommand ("levelshot", CL_LevelShot_f, "same as \"screenshot\", used for create plaque images" );
Cmd_AddCommand ("saveshot", CL_SaveShot_f, "used for create save previews with LoadGame menu" );
Cmd_AddCommand ("demoshot", CL_DemoShot_f, "used for create demo previews with PlayDemo menu" );

Cmd_AddCommand ("connect", CL_Connect_f, "connect to a server by hostname" );
Cmd_AddCommand ("reconnect", CL_Reconnect_f, "reconnect to current level" );
Expand Down
1 change: 0 additions & 1 deletion engine/client/cl_scrn.c
Expand Up @@ -255,7 +255,6 @@ void SCR_MakeScreenShot( void )
iRet = VID_ScreenShot( cls.shotname, VID_LEVELSHOT );
break;
case scrshot_savegame:
case scrshot_demoshot:
iRet = VID_ScreenShot( cls.shotname, VID_MINISHOT );
break;
case scrshot_envshot:
Expand Down
1 change: 1 addition & 0 deletions engine/client/cl_view.c
Expand Up @@ -384,6 +384,7 @@ void V_PostRender( void )
CL_DrawDemoRecording();
CL_DrawHUD( CL_CHANGELEVEL );
R_ShowTextures();
R_ShowTree();
Con_DrawConsole();
UI_UpdateMenu( host.realtime );
Con_DrawVersion();
Expand Down
3 changes: 1 addition & 2 deletions engine/client/client.h
Expand Up @@ -320,7 +320,6 @@ typedef enum
scrshot_snapshot, // in-game snapshot
scrshot_plaque, // levelshot
scrshot_savegame, // saveshot
scrshot_demoshot, // for demos preview
scrshot_envshot, // cubemap view
scrshot_skyshot, // skybox view
scrshot_mapshot // overview layer
Expand Down Expand Up @@ -654,6 +653,7 @@ typedef struct
qboolean timedemo;
string demoname; // for demo looping
double demotime; // recording time
qboolean set_lastdemo; // store name of last played demo into the cvar

file_t *demofile;
file_t *demoheader; // contain demo startup info in case we record a demo on this level
Expand Down Expand Up @@ -734,7 +734,6 @@ void CL_PlayCDTrack_f( void );
void CL_EnvShot_f( void );
void CL_SkyShot_f( void );
void CL_SaveShot_f( void );
void CL_DemoShot_f( void );
void CL_LevelShot_f( void );
void CL_SetSky_f( void );
void SCR_Viewpos_f( void );
Expand Down

0 comments on commit 897dd90

Please sign in to comment.