private void RunGameTic()
{
idUserCommand cmd = null;
// TODO: demo file
// if we are doing a command demo, read or write from the file
/*if ( cmdDemoFile ) {
if ( !cmdDemoFile->Read( &logCmd, sizeof( logCmd ) ) ) {
common->Printf( "Command demo completed at logIndex %i\n", logIndex );
fileSystem->CloseFile( cmdDemoFile );
cmdDemoFile = NULL;
if ( aviCaptureMode ) {
EndAVICapture();
Shutdown();
}
// we fall out of the demo to normal commands
// the impulse and chat character toggles may not be correct, and the view
// angle will definitely be wrong
} else {
cmd = logCmd.cmd;
cmd.ByteSwap();
logCmd.consistencyHash = LittleLong( logCmd.consistencyHash );
}
}*/
// TODO: cmdDemoFile
// if we didn't get one from the file, get it locally
//if ( !cmdDemoFile ) {
// get a locally created command
if(idE.CvarSystem.GetBool("com_asyncInput") == true)
{
idConsole.Warning("TODO: usercmdgen");
//cmd = usercmdGen->TicCmd( lastGameTic );
}
else
{
cmd = idE.UserCommandGenerator.GetDirectCommand();
}
//lastGameTic++;
//}
// run the game logic every player move
int start = idE.System.Milliseconds;
GameReturn ret = idE.Game.RunFrame(new idUserCommand[] { cmd });
int end = idE.System.Milliseconds;
// TODO: timers time_gameFrame += end - start; // note time used for com_speeds
// check for constency failure from a recorded command
/*if ( cmdDemoFile ) {
if ( ret.consistencyHash != logCmd.consistencyHash ) {
common->Printf( "Consistency failure on logIndex %i\n", logIndex );
Stop();
return;
}
}*/
// save the cmd for cmdDemo archiving
/*if ( logIndex < MAX_LOGGED_USERCMDS ) {
loggedUsercmds[logIndex].cmd = cmd;
// save the consistencyHash for demo playback verification
loggedUsercmds[logIndex].consistencyHash = ret.consistencyHash;
if (logIndex % 30 == 0 && statIndex < MAX_LOGGED_STATS) {
loggedStats[statIndex].health = ret.health;
loggedStats[statIndex].heartRate = ret.heartRate;
loggedStats[statIndex].stamina = ret.stamina;
loggedStats[statIndex].combat = ret.combat;
statIndex++;
}
logIndex++;
}*/
_syncNextGameFrame = ret.SyncNextGameFrame;
if(ret.SessionCommand != null)
{
idConsole.Warning("TODO: {0}", ret.SessionCommand);
/*idCmdArgs args;
args.TokenizeString( ret.sessionCommand, false );
if ( !idStr::Icmp( args.Argv(0), "map" ) ) {
// get current player states
for ( int i = 0 ; i < numClients ; i++ ) {
mapSpawnData.persistentPlayerInfo[i] = game->GetPersistentPlayerInfo( i );
}
// clear the devmap key on serverinfo, so player spawns
// won't get the map testing items
mapSpawnData.serverInfo.Delete( "devmap" );
// go to the next map
MoveToNewMap( args.Argv(1) );
} else if ( !idStr::Icmp( args.Argv(0), "devmap" ) ) {
mapSpawnData.serverInfo.Set( "devmap", "1" );
MoveToNewMap( args.Argv(1) );
} else if ( !idStr::Icmp( args.Argv(0), "died" ) ) {
// restart on the same map
UnloadMap();
SetGUI(guiRestartMenu, NULL);
} else if ( !idStr::Icmp( args.Argv(0), "disconnect" ) ) {
cmdSystem->BufferCommandText( CMD_EXEC_INSERT, "stoprecording ; disconnect" );
} else if ( !idStr::Icmp( args.Argv(0), "endOfDemo" ) ) {
cmdSystem->BufferCommandText( CMD_EXEC_NOW, "endOfDemo" );
}*/
}
}