예제 #1
0
void TryRunTics (void)
{
	int runtics;
	int entertime = I_GetTime();

	// Wait for tics to run
	while (1)
	{
#ifdef HAVE_NET
    NetUpdate();
#else
    D_BuildNewTiccmds();
#endif

    runtics = (server ? remotetic : maketic) - gametic;
	
    if (!runtics)
	{
		if (server)
			I_WaitForPacket(ms_to_next_tick);
		else
			I_uSleep(ms_to_next_tick*1000);

		if (I_GetTime() - entertime > 10)
		{
			remotesend--;
			
			if (server)
			{
				char buf[sizeof(packet_header_t) + 1];
				
				packet_set((packet_header_t *)buf, PKT_RETRANS, remotetic);
				buf[sizeof(buf) - 1] = consoleplayer;
				I_SendPacket((packet_header_t *)buf, sizeof buf);
			}
			
			M_Ticker();
			return;
		}
		} else break;
	}

	while (runtics--)
	{
#ifdef HAVE_NET
		if (server) CheckQueuedPackets();
#endif
		if (advancedemo) D_DoAdvanceDemo ();
	
		M_Ticker ();
		G_Ticker ();
	
		gametic++;
	
#ifdef HAVE_NET
		NetUpdate(); // Keep sending our tics to avoid stalling remote nodes
#endif
	}
}
예제 #2
0
void TryRunTics (void)
{
  int runtics;
  int entertime = I_GetTime();

  // Wait for tics to run
  while (1) {
    NetUpdate();
    runtics = (server ? remotetic : maketic) - gametic;
    if (!runtics) {
      if (!movement_smooth) {
        if (server)
          I_WaitForPacket(ms_to_next_tick);
        else
          I_uSleep(ms_to_next_tick*1000);
      }
      if (I_GetTime() - entertime > 10) {
        if (server) {
          char buf[sizeof(packet_header_t)+1];
          remotesend--;
          packet_set((packet_header_t *)buf, PKT_RETRANS, remotetic);
          buf[sizeof(buf)-1] = consoleplayer;
          I_SendPacket((packet_header_t *)buf, sizeof buf);
        }
        M_Ticker(); return;
      }
      {
        WasRenderedInTryRunTics = TRUE;
        if (movement_smooth && gamestate==wipegamestate)
        {
          isExtraDDisplay = TRUE;
          D_Display();
          isExtraDDisplay = FALSE;
        }
      }
    } else break;
  }

  while (runtics--) {
    if (server) CheckQueuedPackets();
    if (advancedemo)
      D_DoAdvanceDemo ();
    M_Ticker ();
    I_GetTime_SaveMS();
    G_Ticker ();
    P_Checksum(gametic);
    gametic++;
    NetUpdate(); // Keep sending our tics to avoid stalling remote nodes
  }
}
예제 #3
0
void TryRunTics (void)
{
  int runtics;

  // Wait for tics to run
  while (1) {
    D_BuildNewTiccmds();
    runtics = maketic - gametic;
    if (runtics)
      break;

        WasRenderedInTryRunTics = TRUE;
        if (movement_smooth && gamestate==wipegamestate)
        {
          isExtraDDisplay = TRUE;
          D_Display();
          isExtraDDisplay = FALSE;
        }
  }

  if (advancedemo)
	  D_DoAdvanceDemo ();
  M_Ticker ();
  I_GetTime_SaveMS();
  G_Ticker ();
  P_Checksum(gametic);
  gametic++;
}
예제 #4
0
파일: d_main.c 프로젝트: HendrikR/rockbox
static void D_DoomLoop (void)
{
   basetic = gametic;

   I_SubmitSound();

   while (!doomexit)
   {
      // process one or more tics
      if (singletics)
      {
         I_StartTic ();
         G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]);
         if (advancedemo)
            D_DoAdvanceDemo ();
         M_Ticker ();
         G_Ticker ();
         gametic++;
         maketic++;
      }
      else
         TryRunTics (); // will run at least one tic

      // killough 3/16/98: change consoleplayer to displayplayer
      if (players[displayplayer].mo) // cph 2002/08/10
         S_UpdateSounds(players[displayplayer].mo);// move positional sounds

      // Update display, next frame, with current state.
      D_Display();

      // Give the system some time
      rb->yield();
   }
}
예제 #5
0
void D_DoomLoop (void)
{
    if (demorecording)
        G_BeginRecording ();

    if (M_CheckParm ("-debugfile"))
    {
        char    filename[20];
        sprintf (filename,"debug%i.txt",consoleplayer);
        printf ("debug output to: %s\n",filename);
        debugfile = fopen (filename,"w");
    }

    I_InitGraphics ();

    for (;;)
    {
        // frame syncronous IO operations
        I_StartFrame ();

        // process one or more tics
        if (singletics)
        {
            I_StartTic ();
            D_ProcessEvents ();
            G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]);
            if (advancedemo)
                D_DoAdvanceDemo ();
            M_Ticker ();
            G_Ticker ();
            gametic++;
            maketic++;
        }
        else
        {
            TryRunTics (); // will run at least one tic
        }

        S_UpdateSounds (players[consoleplayer].mo);// move positional sounds

        // Update display, next frame, with current state.
        D_Display ();

#ifndef OS2
#ifndef SNDSERV
        // Sound mixing for the buffer is snychronous.
        I_UpdateSound();
#endif
        // Synchronous sound output is explicitly called.
#ifndef SNDINTR
        // Update sound output.
        I_SubmitSound();
#endif
#endif
    }
}
예제 #6
0
void TryRunTics(void)
{
  while (maketic <= gametic)
     D_BuildNewTiccmds();

  if (advancedemo)
     D_DoAdvanceDemo ();
  M_Ticker ();
  G_Ticker ();
  P_Checksum(gametic);
  gametic++;
}
예제 #7
0
파일: d_main.c 프로젝트: jezze/doom
static void tryruntics(void)
{

    int runtics;
    int entertime = I_GetTime();

    while (1)
    {

        D_BuildNewTiccmds();

        runtics = maketic - gametic;

        if (runtics)
            break;

        I_uSleep(ms_to_next_tick * 1000);

        if (I_GetTime() - entertime > 10)
        {

            M_Ticker();
                
            return;

        }

    }

    while (runtics--)
    {

        M_Ticker();
        G_Ticker();

        gametic++;

    }

}
예제 #8
0
파일: d_net.c 프로젝트: jdbcdev/doomretro
void NetUpdate(void)
{
    int         nowtime;
    int         newtics;
    int         i;
    int         gameticdiv;

    // check time
    nowtime = GetTime() / ticdup;
    newtics = nowtime - lasttime;

    lasttime = nowtime;

    if (newtics <= 0)   // nothing new to update
        return;

    if (skiptics <= newtics)
    {
        newtics -= skiptics;
        skiptics = 0;
    }
    else
    {
        skiptics -= newtics;
        newtics = 0;
    }

    // build new ticcmds for console player
    gameticdiv = gametic / ticdup;

    for (i = 0; i < newtics; i++)
    {
        ticcmd_t cmd;

        I_StartTic();
        D_ProcessEvents();

        // Always run the menu
        M_Ticker();

        if (maketic - gameticdiv >= 5)
            break;

        memset(&cmd, 0, sizeof(ticcmd_t));
        G_BuildTiccmd(&cmd);

        netcmds[consoleplayer][maketic % BACKUPTICS] = cmd;

        ++maketic;
        nettics[consoleplayer] = maketic;
    }
}
예제 #9
0
파일: d_main.c 프로젝트: svkaiser/doom64DS
void D_UpdateTiccmd(void)
{
    int nowtime;
    int newtics;
    int i;
    int gameticdiv;

    // check time
    nowtime = D_GetAdjustedTime()/ticdup;
    newtics = nowtime - gametime;
    gametime = nowtime;

    if(skiptics <= newtics)
    {
		newtics -= skiptics;
		skiptics = 0;
    }
    else
    {
		skiptics -= newtics;
		newtics = 0;
    }

    // build new ticcmds for console player(s)
    gameticdiv = gametic/ticdup;

    for(i = 0; i < newtics; i++)
    {
		ticcmd_t cmd;

		I_StartTic();
		D_ProcessEvents();

        M_Ticker();
	
		// If playing single player, do not allow tics to buffer
        // up very far

        if((!netgame || demoplayback) && maketic - gameticdiv > 2)
            break;

        // Never go more than ~200ms ahead
        if(maketic - gameticdiv > 8)
            break;

		G_BuildTiccmd(&cmd);

        netcmds[consoleplayer][maketic % BACKUPTICS] = cmd;
		++maketic;
    }
}
예제 #10
0
void TryRunTics(void) // Avoid sleeping/timer crap, just run it. (Themaister)
{
   int runtics = maketic - gametic;

   while (runtics--)
   {
      if (advancedemo)
         D_DoAdvanceDemo ();
      M_Ticker ();
      G_Ticker ();
      P_Checksum(gametic);
      gametic++;
   }
}
예제 #11
0
파일: d_main.c 프로젝트: japeq/nios-doom
void D_DoomTicker(int tics, fixed_t frac)
{
	static boolean wipe = false;
	int i;

	if (tics > 4) tics = 4;

	if (!wipe) {
		D_ProcessEvents();

		for (i = 0; i < tics; ++i) {
			D_DoAdvanceDemo();
			M_Ticker();
			G_Ticker();
		}

		// move positional sounds
		S_UpdateSounds(players[consoleplayer].mo);

		// change the view size if needed
		if (setsizeneeded) {
			R_ExecuteSetViewSize();
			oldgamestate = -1;	// force background redraw
		}
		// save the current screen if about to wipe
		if (gamestate != wipegamestate) {
			wipe = true;
			wipe_StartScreen(0, 0, SCREENWIDTH, SCREENHEIGHT);
		}

		D_Display(frac);
		oldgamestate = wipegamestate = gamestate;

		if (wipe) {
			wipe_EndScreen(0, 0, SCREENWIDTH, SCREENHEIGHT);
		}
	}

	if (wipe && tics > 0) {
		if (wipe_ScreenWipe(wipe_Melt, 0, 0, SCREENWIDTH, SCREENHEIGHT,
				    tics)) {
			// done
			wipe = false;
		}
	}
	// menu is drawn even on top of everything
	M_Drawer();
	I_FinishUpdate(tics);
	framecount++;
}
예제 #12
0
void D_DoomLoop (void)
{
    if (demorecording)
	G_BeginRecording ();
		
    TryRunTics();

    I_InitGraphics ();

    R_ExecuteSetViewSize();

    D_StartGameLoop();

    if (testcontrols)
    {
        wipegamestate = gamestate;
    }

    while (1)
    {
	// frame syncronous IO operations
	I_StartFrame ();                
	
	// process one or more tics
	if (singletics)
	{
	    I_StartTic ();
	    D_ProcessEvents ();
	    G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]);
	    if (advancedemo)
		D_DoAdvanceDemo ();
	    M_Ticker ();
	    G_Ticker ();
	    gametic++;
	    maketic++;
	}
	else
	{
	    TryRunTics (); // will run at least one tic
	}
		
	S_UpdateSounds (players[consoleplayer].mo);// move positional sounds

	// Update display, next frame, with current state.
        if (screenvisible)
            D_Display ();
    }
}
예제 #13
0
파일: d_main.c 프로젝트: Nekrofage/DoomRPi
static void D_DoomLoop(void)
{
  for (;;)
    {
      WasRenderedInTryRunTics = false;
      // frame syncronous IO operations
      I_StartFrame ();

      if (ffmap == gamemap) ffmap = 0;

      // process one or more tics
      if (singletics)
        {
          I_StartTic ();
          G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]);
          if (advancedemo)
            D_DoAdvanceDemo ();
          M_Ticker ();
          G_Ticker ();
          P_Checksum(gametic);
          gametic++;
          maketic++;
        }
      else
        TryRunTics (); // will run at least one tic

      // killough 3/16/98: change consoleplayer to displayplayer
      if (players[displayplayer].mo) // cph 2002/08/10
	S_UpdateSounds(players[displayplayer].mo);// move positional sounds

      if (V_GetMode() == VID_MODEGL ? 
        !movement_smooth || !WasRenderedInTryRunTics :
        !movement_smooth || !WasRenderedInTryRunTics || gamestate != wipegamestate
      )
        {
        // Update display, next frame, with current state.
        D_Display();
      }

      // CPhipps - auto screenshot
      if (auto_shot_fname && !--auto_shot_count) {
  auto_shot_count = auto_shot_time;
  M_DoScreenShot(auto_shot_fname);
      }
    }
}
예제 #14
0
// MIKE 11/08 main game loop, called every frame by Flash
void D_DoomLoop (void)
{
	// frame syncronous IO operations
	I_StartFrame ();

	if(!wipe)
	{
		// process one or more tics
		if (singletics)
		{
			I_StartTic ();
			D_ProcessEvents ();
			G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]);
			if (advancedemo)
			D_DoAdvanceDemo ();
			M_Ticker ();
			G_Ticker ();
			gametic++;
			maketic++;
		}
		else
		{
			TryRunTics (); // will run at least one tic
		}
			
		S_UpdateSounds (players[consoleplayer].mo);// move positional sounds

		// Update display, next frame, with current state.
		//D_Display ();
	}
	// MIKE

#ifndef SNDSERV
	// Sound mixing for the buffer is snychronous.
	I_UpdateSound();
#endif	
	// Synchronous sound output is explicitly called.
#ifndef SNDINTR
	// Update sound output.
//	I_SubmitSound();
#endif

	gameTime++;

	return AS3_Null();
}
예제 #15
0
파일: d_main.c 프로젝트: jm--/seL4Doom
void D_DoomLoop (void)
{
    if (demorecording)
	G_BeginRecording ();
		
    if (M_CheckParm ("-debugfile"))
    {
	char    filename[20];
	sprintf (filename,"debug%i.txt",consoleplayer);
	printf ("debug output to: %s\n",filename);
	debugfile = fopen (filename,"w");
    }
	
    I_InitGraphics ();

    while (1)
    {
	// frame syncronous IO operations
	I_StartFrame ();                
	
	// process one or more tics
	if (singletics)
	{
	    I_StartTic ();
	    D_ProcessEvents ();
	    G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]);
	    if (advancedemo)
		D_DoAdvanceDemo ();
	    M_Ticker ();
	    G_Ticker ();
	    gametic++;
	    maketic++;
	}
	else
	{
	    TryRunTics (); // will run at least one tic
	}

	S_UpdateSounds (players[consoleplayer].mo);// move positional sounds

	// Update display, next frame, with current state.
	D_Display ();
    }
}
예제 #16
0
파일: d_loop.c 프로젝트: mdgunn/doomretro
static dboolean BuildNewTic(void)
{
    ticcmd_t    cmd;

    I_StartTic();
    D_ProcessEvents();

    // Always run the menu
    M_Ticker();

    if (maketic - gametic > 2)
        return false;

    G_BuildTiccmd(&cmd);

    netcmds[maketic % BACKUPTICS] = cmd;

    ++maketic;

    return true;
}
예제 #17
0
void TryRunTics(void)
{
    static int  lastmadetic;
    int         newtics = I_GetTime() - lastmadetic;
    int         runtics;

    lastmadetic += newtics;

    while (newtics--)
    {
        I_StartTic();

        if (maketic - gametime > BACKUPTICS / 2)
            break;

        G_BuildTiccmd(&localcmds[maketic++ % BACKUPTICS]);
    }

    if (!(runtics = maketic - gametime) && vid_capfps != TICRATE)
        return;

    while (runtics--)
    {
        if (advancetitle)
            D_DoAdvanceTitle();

        if (menuactive)
            M_Ticker();

        G_Ticker();
        gametime++;

        if (localcmds[0].buttons & BT_SPECIAL)
            localcmds[0].buttons = 0;
    }
}
예제 #18
0
void TryStepTics(QWORD tics)
{
	DObject::BeginFrame ();
	
	// run the realtics tics
	while (tics--)
	{
		if(canceltics && canceltics--)
			continue;

		NetUpdate ();

		if (advancedemo)
			D_DoAdvanceDemo ();
		
		C_Ticker ();
		M_Ticker ();
		G_Ticker ();
		gametic++;
	}
	
	DObject::EndFrame ();

}
예제 #19
0
파일: d_client.c 프로젝트: DrBeef/DVR
void TryRunTics ()
{
  int runtics;
  int entertime = I_GetTime();

  // Wait for tics to run
  while (1) {
#ifdef HAVE_NET
    NetUpdate();
#else

    D_BuildNewTiccmds();

#endif
    runtics = (server ? remotetic : maketic) - gametic;

    if (!runtics) {
      if (!movement_smooth) {
#ifdef HAVE_NET
        if (server)
          I_WaitForPacket(ms_to_next_tick);
        else
#endif
          I_uSleep(ms_to_next_tick*1000);
      }

      if (I_GetTime() - entertime > 10) {
#ifdef HAVE_NET
        if (server) {
          char buf[sizeof(packet_header_t)+1];
          remotesend--;
          packet_set((packet_header_t *)buf, PKT_RETRANS, remotetic);
          buf[sizeof(buf)-1] = consoleplayer;
          I_SendPacket((packet_header_t *)buf, sizeof buf);
        }
#endif

        M_Ticker(); return;
      }
      //if ((displaytime) < (tic_vars.next-SDL_GetTicks()))
      {
        WasRenderedInTryRunTics = true;
        if (V_GetMode() == VID_MODEGL ? 
            movement_smooth : 
            movement_smooth && gamestate==wipegamestate)
        {
          isExtraDDisplay = true;
          D_Display(0);
          D_Display(1);
          isExtraDDisplay = false;
        }
      }
    } else break;
  }

  while (runtics--) {
#ifdef HAVE_NET
    if (server) CheckQueuedPackets();
#endif


    if (advancedemo)
      D_DoAdvanceDemo ();


    M_Ticker ();
    I_GetTime_SaveMS();
    G_Ticker ();
    P_Checksum(gametic);
    gametic++;
#ifdef HAVE_NET
    NetUpdate(); // Keep sending our tics to avoid stalling remote nodes
#endif
  }
}
예제 #20
0
void NetUpdate(void)
{
    int nowtime;
    int newtics;
    int i;
    int gameticdiv;

    // check time
    nowtime = GetAdjustedTime() / ticdup;
    newtics = nowtime - lasttime;

    lasttime = nowtime;

    if (skiptics <= newtics)
    {
        newtics -= skiptics;
        skiptics = 0;
    }
    else
    {
        skiptics -= newtics;
        newtics = 0;
    }

    // build new ticcmds for console player
    gameticdiv = gametic / ticdup;

    for (i = 0; i < newtics; i++)
    {
        ticcmd_t cmd;

        I_StartTic();
        D_ProcessEvents();

        // Always run the menu

        M_Ticker();

        if (net_cl_new_sync)
        {
            // If playing single player, do not allow tics to buffer
            // up very far

            if ((!netgame || demoplayback) && maketic - gameticdiv > 2)
                break;

            // Never go more than ~200ms ahead

            if (maketic - gameticdiv > 8)
                break;
        }
        else
        {
            if (maketic - gameticdiv >= 5)
                break;
        }

        memset(&cmd, 0, sizeof(ticcmd_t));
        G_BuildTiccmd(&cmd, maketic);

        netcmds[consoleplayer][maketic % BACKUPTICS] = cmd;

        ++maketic;
        nettics[consoleplayer] = maketic;
    }
}