Example #1
0
void demoAutoComplete(void) {
	CL_StopRecord_f();
	char newName[MAX_QPATH];
	//if we are not manually saving, then temporarily store a demo in LastDemo folder
	if (!*demo.record.demoName && FS_CopyFile(va("%s/demos/%s.dm_26", demo.record.mod, demo.record.defaultName), va("%s/demos/LastDemo/LastDemo.dm_26", demo.record.mod), NULL, 0)) {
		Com_Printf(S_COLOR_GREEN"Demo temporarily saved into LastDemo/LastDemo.dm_26\n");
	} else if (FS_CopyFile(va("%s/demos/%s.dm_26", demo.record.mod, demo.record.defaultName), va("%s/demos/%s.dm_26", demo.record.mod, demo.record.demoName), newName, sizeof(newName))) {
		Com_Printf(S_COLOR_GREEN"Demo successfully saved into %s.dm_26\n", (Q_stricmp(newName, "")) ? newName : demo.record.demoName);
	} else {
		Com_Printf(S_COLOR_RED"Demo has failed to save\n");
	}
}
Example #2
0
void demoAutoComplete(void) {
	char newName[MAX_OSPATH];
	CL_StopRecord_f();
	//if we are not manually saving, then temporarily store a demo in LastDemo folder
	if (!demoAuto.demoName[0]
		&& FS_CopyFile(
			va("%s/demos/%s%s", demoAuto.mod, DEFAULT_NAME, demoAuto.ext),
			va("%s/demos/%s%s", demoAuto.mod, DEFAULT_NAME_LAST, demoAuto.ext)
		)) {
		Com_Printf(S_COLOR_GREEN "Demo temporarily saved into %s%s\n", DEFAULT_NAME, demoAuto.ext);
	} else if (
		FS_CopyFile(
			va("%s/demos/%s%s", demoAuto.mod, DEFAULT_NAME, demoAuto.ext),
			va("%s/demos/%s%s", demoAuto.mod, demoAuto.demoName, demoAuto.ext), newName, sizeof(newName)
		)) {
		Com_Printf(S_COLOR_GREEN "Demo successfully saved into %s\n", ((Q_stricmp(newName, "")) ? newName : demoAuto.demoName));
	} else {
		Com_Printf(S_COLOR_RED "Demo has failed to save\n");
	}
}
Example #3
0
/*
==================
CL_ParseGamestate
==================
*/
void CL_ParseGamestate( msg_t *msg ) {
	int				i;
	entityState_t	*es;
	int				newnum;
	entityState_t	nullstate;
	int				cmd;
	char			*s;
	char oldGame[MAX_QPATH];

	Con_Close();

	clc.connectPacketCount = 0;

	// wipe local client state
	CL_ClearState();

	// a gamestate always marks a server command sequence
	clc.serverCommandSequence = MSG_ReadLong( msg );

	// parse all the configstrings and baselines
	cl.gameState.dataCount = 1;	// leave a 0 at the beginning for uninitialized configstrings
	while ( 1 ) {
		cmd = MSG_ReadByte( msg );

		if ( cmd == svc_EOF ) {
			break;
		}
		
		if ( cmd == svc_configstring ) {
			int		len;

			i = MSG_ReadShort( msg );
			if ( i < 0 || i >= MAX_CONFIGSTRINGS ) {
				Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );
			}
			s = MSG_ReadBigString( msg );
			len = strlen( s );

			if ( len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS ) {
				Com_Error( ERR_DROP, "MAX_GAMESTATE_CHARS exceeded" );
			}

			// append it to the gameState string buffer
			cl.gameState.stringOffsets[ i ] = cl.gameState.dataCount;
			Com_Memcpy( cl.gameState.stringData + cl.gameState.dataCount, s, len + 1 );
			cl.gameState.dataCount += len + 1;
		} else if ( cmd == svc_baseline ) {
			newnum = MSG_ReadBits( msg, GENTITYNUM_BITS );
			if ( newnum < 0 || newnum >= MAX_GENTITIES ) {
				Com_Error( ERR_DROP, "Baseline number out of range: %i", newnum );
			}
			Com_Memset (&nullstate, 0, sizeof(nullstate));
			es = &cl.entityBaselines[ newnum ];
			MSG_ReadDeltaEntity( msg, &nullstate, es, newnum );
		} else {
			Com_Error( ERR_DROP, "CL_ParseGamestate: bad command byte" );
		}
	}

	clc.clientNum = MSG_ReadLong(msg);
	// read the checksum feed
	clc.checksumFeed = MSG_ReadLong( msg );

	// save old gamedir
	Cvar_VariableStringBuffer("fs_game", oldGame, sizeof(oldGame));

	// parse useful values out of CS_SERVERINFO
	CL_ParseServerInfo();

	// parse serverId and other cvars
	CL_SystemInfoChanged();

	// stop recording now so the demo won't have an unnecessary level load at the end.
	if(cl_autoRecordDemo->integer && clc.demorecording)
		CL_StopRecord_f();
	
	// reinitialize the filesystem if the game directory has changed
	if(!cl_oldGameSet && (Cvar_Flags("fs_game") & CVAR_MODIFIED))
	{
		cl_oldGameSet = qtrue;
		Q_strncpyz(cl_oldGame, oldGame, sizeof(cl_oldGame));
	}

	FS_ConditionalRestart(clc.checksumFeed, qfalse);

	// This used to call CL_StartHunkUsers, but now we enter the download state before loading the
	// cgame
	CL_InitDownloads();

	// make sure the game starts
	Cvar_Set( "cl_paused", "0" );
}