public void Frame()
{
// TODO: Sound
/*if ( com_asyncSound.GetInteger() == 0 ) {
soundSystem->AsyncUpdate( Sys_Milliseconds() );
}*/
// if the console is down, we don't need to hold
// the mouse cursor
if(idE.Console.IsActive == true)
{
idE.Input.GrabMouse = false;
}
else
{
idE.Input.GrabMouse = true;
}
// save the screenshot and audio from the last draw if needed
/* TODO: if ( aviCaptureMode ) {
idStr name;
name = va("demos/%s/%s_%05i.tga", aviDemoShortName.c_str(), aviDemoShortName.c_str(), aviTicStart );
float ratio = 30.0f / ( 1000.0f / USERCMD_MSEC / com_aviDemoTics.GetInteger() );
aviDemoFrameCount += ratio;
if ( aviTicStart + 1 != ( int )aviDemoFrameCount ) {
// skipped frames so write them out
int c = aviDemoFrameCount - aviTicStart;
while ( c-- ) {
renderSystem->TakeScreenshot( com_aviDemoWidth.GetInteger(), com_aviDemoHeight.GetInteger(), name, com_aviDemoSamples.GetInteger(), NULL );
name = va("demos/%s/%s_%05i.tga", aviDemoShortName.c_str(), aviDemoShortName.c_str(), ++aviTicStart );
}
}
aviTicStart = aviDemoFrameCount;
// remove any printed lines at the top before taking the screenshot
console->ClearNotifyLines();
// this will call Draw, possibly multiple times if com_aviDemoSamples is > 1
renderSystem->TakeScreenshot( com_aviDemoWidth.GetInteger(), com_aviDemoHeight.GetInteger(), name, com_aviDemoSamples.GetInteger(), NULL );
}*/
// send frame and mouse events to active guis
GuiFrameEvents();
// advance demos
/* TODO: if ( readDemo ) {
AdvanceRenderDemo( false );
return;
}*/
//------------ single player game tics --------------
if((_mapSpawned == false) || (_guiActive != null))
{
if(idE.CvarSystem.GetBool("com_asyncInput") == false)
{
// early exit, won't do RunGameTic .. but still need to update mouse position for GUIs
idE.UserCommandGenerator.GetDirectCommand();
}
}
if(_mapSpawned == false)
{
return;
}
if(_guiActive != null)
{
// TODO: lastGameTic = latchedTicNumber;
return;
}
// in message box / GUIFrame, idSessionLocal::Frame is used for GUI interactivity
// but we early exit to avoid running game frames
if(idE.AsyncNetwork.IsActive == true)
{
return;
}
// check for user info changes
if((idE.CvarSystem.ModifiedFlags & CvarFlags.UserInfo) == CvarFlags.UserInfo)
{
idE.CvarSystem.CopyCvarsToDictionary(_mapSpawnData.UserInformation[0], CvarFlags.UserInfo);
idE.Game.SetUserInformation(0, _mapSpawnData.UserInformation[0], false, false);
idE.CvarSystem.ModifiedFlags &= ~CvarFlags.UserInfo;
}
RunGameTic();
}