Beispiel #1
0
//
//  D_DoomLoop
//
void D_DoomLoop (void)
{
    while (1)
    {
        try
        {
            TryRunTics (); // will run at least one tic

            if (!connected)
                CL_RequestConnectInfo();

            // [RH] Use the consoleplayer's camera to update sounds
            S_UpdateSounds (listenplayer().camera);	// move positional sounds
            S_UpdateMusic();	// play another chunk of music

            // Update display, next frame, with current state.
            D_Display ();
        }
        catch (CRecoverableError &error)
        {
            Printf_Bold ("\n%s\n", error.GetMsg().c_str());

            CL_QuitNetGame ();

            G_ClearSnapshots ();

            DThinker::DestroyAllThinkers();

            players.clear();

            gameaction = ga_fullconsole;
        }
    }
}
Beispiel #2
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++;
}
Beispiel #3
0
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();
   }
}
Beispiel #4
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
    }
}
Beispiel #5
0
FrameType D_DoomFrame(int& elapsedTicks)
{
	// process one or more tics
	TryRunTics(elapsedTicks); // will run at least one tic

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

	// Update display, next frame, with current state.
	return D_Display();
}
Beispiel #6
0
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++;
}
Beispiel #7
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
  }
}
Beispiel #8
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 ();
    }
}
Beispiel #9
0
//
//  D_DoomLoop
//
void D_DoomLoop (void)
{
    if (bfgedition &&
        (demorecording || (gameaction == ga_playdemo) || netgame))
    {
        printf(" WARNING: You are playing using one of the Doom Classic\n"
               " IWAD files shipped with the Doom 3: BFG Edition. These are\n"
               " known to be incompatible with the regular IWAD files and\n"
               " may cause demos and network games to get out of sync.\n");
    }

    if (demorecording)
	G_BeginRecording ();

    main_loop_started = true;

    TryRunTics();

    I_SetWindowTitle(gamedescription);
    I_GraphicsCheckCommandLine();
    I_SetGrabMouseCallback(D_GrabMouseCallback);
    I_InitGraphics();
    V_EnableLoadingDisk(SCREENWIDTH - LOADING_DISK_W, SCREENHEIGHT - LOADING_DISK_H);

    V_RestoreBuffer();
    R_ExecuteSetViewSize();

    D_StartGameLoop();

    if (testcontrols)
    {
        wipegamestate = gamestate;
    }

    while (1)
    {
	// frame syncronous IO operations
	I_StartFrame ();

        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 ();
    }
}
Beispiel #10
0
static void D_DoomLoop(void)
{

    for (;;)
    {

        tryruntics();

        if (players[consoleplayer].mo)
            S_UpdateSounds(players[consoleplayer].mo);

        D_Display();

    }

}
Beispiel #11
0
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);
      }
    }
}
Beispiel #12
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 ();

    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 ();
    }
}
Beispiel #13
0
//
//  D_DoomLoop
//
//  haleyjd 08/23/10: [STRIFE] Verified unmodified.
//
void D_DoomLoop (void)
{
    if (demorecording)
        G_BeginRecording ();

    main_loop_started = true;

    TryRunTics();

    if (!showintro)
    {
        I_SetWindowTitle(gamedescription);
        I_InitGraphics();
    }

    I_EnableLoadingDisk();
    I_SetGrabMouseCallback(D_GrabMouseCallback);

    V_RestoreBuffer();
    R_ExecuteSetViewSize();

    D_StartGameLoop();

    if (testcontrols)
    {
        wipegamestate = gamestate;
    }

    while (1)
    {
        // frame syncronous IO operations
        I_StartFrame ();

        // process one or more tics
        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 ();
    }
}
Beispiel #14
0
void D_DoomLoop(void)
{
   //Doom loop
   WasRenderedInTryRunTics = FALSE;

   if (ffmap == gamemap) ffmap = 0;

   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 (!movement_smooth || !WasRenderedInTryRunTics || gamestate != wipegamestate)
   {
      // Update display, next frame, with current state.
      D_Display();
      return;
   }
}
Beispiel #15
0
//
//  D_DoomLoop
//
void D_DoomLoop(void)
{
    TryRunTics();

    I_InitGraphics();

    R_ExecuteSetViewSize();

    D_StartGameLoop();

    while (1)
    {
        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();
    }
}
Beispiel #16
0
void D_SRB2Loop(void)
{
	tic_t oldentertics = 0, entertic = 0, realtics = 0, rendertimeout = INFTICS;

	if (demorecording)
		G_BeginRecording();

	// user settings
	if (dedicated)
		COM_BufAddText(va("exec \"%s"PATHSEP"adedserv.cfg\"\n", srb2home));
	else
		COM_BufAddText(va("exec \"%s"PATHSEP"autoexec.cfg\" -noerror\n", srb2home));

	if (dedicated)
		server = true;

	if (M_CheckParm("-voodoo")) // 256x256 Texture Limiter
		COM_BufAddText("gr_voodoocompatibility on\n");

	// Pushing of + parameters is now done back in D_SRB2Main, not here.

	// end of loading screen: CONS_Printf() will no more call FinishUpdate()
	con_startup = false;

	CONS_Printf("I_StartupKeyboard...\n");
	I_StartupKeyboard();

#ifdef _WINDOWS
	CONS_Printf("I_StartupMouse...\n");
	I_DoStartupMouse();
#endif

	oldentertics = I_GetTime();

	// make sure to do a d_display to init mode _before_ load a level
	SCR_SetMode(); // change video mode
	SCR_Recalc();

	for (;;)
	{
		// get real tics
		entertic = I_GetTime();
		realtics = entertic - oldentertics;
		oldentertics = entertic;

#ifdef DEBUGFILE
		if (!realtics)
			if (debugload)
				debugload--;
#endif

		if (!realtics && !singletics)
		{
			I_Sleep();
			continue;
		}

#ifdef HW3SOUND
		HW3S_BeginFrameUpdate();
#endif

		// process tics (but maybe not if realtic == 0)
		TryRunTics(realtics);

		if (lastdraw || singletics || gametic > rendergametic)
		{
			rendergametic = gametic;
			rendertimeout = entertic+TICRATE/17;

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

			if (moviemode)
			{
#ifdef HAVE_PNG
				M_SaveFrame();
#else
				COM_BufAddText("screenshot");
#endif
			}
		}
		else if (rendertimeout < entertic) // in case the server hang or netsplit
		{
			// Lagless camera! Yay!
			if (gamestate == GS_LEVEL && netgame)
			{
				if (splitscreen && camera2.chase)
					P_MoveChaseCamera(&players[secondarydisplayplayer], &camera2, true);
				if (camera.chase)
					P_MoveChaseCamera(&players[displayplayer], &camera, true);
			}
			D_Display();
		}

		// consoleplayer -> displayplayer (hear sounds from viewpoint)
		S_UpdateSounds(); // move positional sounds

		// check for media change, loop music..
		I_UpdateCD();

#ifdef HW3SOUND
		HW3S_EndFrameUpdate();
#endif
	}
}
Beispiel #17
0
void D_SRB2Loop(void)
{
    tic_t oldentertics = 0, entertic = 0, realtics = 0, rendertimeout = INFTICS;

    if (dedicated)
        server = true;

    if (M_CheckParm("-voodoo")) // 256x256 Texture Limiter
        COM_BufAddText("gr_voodoocompatibility on\n");

    // Pushing of + parameters is now done back in D_SRB2Main, not here.

    CONS_Printf("I_StartupKeyboard()...\n");
    I_StartupKeyboard();

#ifdef _WINDOWS
    CONS_Printf("I_StartupMouse()...\n");
    I_DoStartupMouse();
#endif

    oldentertics = I_GetTime();

    // end of loading screen: CONS_Printf() will no more call FinishUpdate()
    con_startup = false;

    // make sure to do a d_display to init mode _before_ load a level
    SCR_SetMode(); // change video mode
    SCR_Recalc();

    // Check and print which version is executed.
    // Use this as the border between setup and the main game loop being entered.
    CONS_Printf(
        "===========================================================================\n"
        "                   We hope you enjoy this game as\n"
        "                     much as we did making it!\n"
        "                            ...wait. =P\n"
        "===========================================================================\n");

    // hack to start on a nice clear console screen.
    COM_ImmedExecute("cls;version");

    if (rendermode == render_soft)
        V_DrawScaledPatch(0, 0, 0, (patch_t *)W_CacheLumpNum(W_GetNumForName("CONSBACK"), PU_CACHE));
    I_FinishUpdate(); // page flip or blit buffer

    for (;;)
    {
        if (lastwipetic)
        {
            oldentertics = lastwipetic;
            lastwipetic = 0;
        }

        // get real tics
        entertic = I_GetTime();
        realtics = entertic - oldentertics;
        oldentertics = entertic;

#ifdef DEBUGFILE
        if (!realtics)
            if (debugload)
                debugload--;
#endif

        if (!realtics && !singletics)
        {
            I_Sleep();
            continue;
        }

#ifdef HW3SOUND
        HW3S_BeginFrameUpdate();
#endif

        // don't skip more than 10 frames at a time
        // (fadein / fadeout cause massive frame skip!)
        if (realtics > 8)
            realtics = 1;

        // process tics (but maybe not if realtic == 0)
        TryRunTics(realtics);

        if (lastdraw || singletics || gametic > rendergametic)
        {
            rendergametic = gametic;
            rendertimeout = entertic+TICRATE/17;

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

            if (moviemode)
                M_SaveFrame();
            if (takescreenshot) // Only take screenshots after drawing.
                M_DoScreenShot();
        }
        else if (rendertimeout < entertic) // in case the server hang or netsplit
        {
            // Lagless camera! Yay!
            if (gamestate == GS_LEVEL && netgame)
            {
                if (splitscreen && camera2.chase)
                    P_MoveChaseCamera(&players[secondarydisplayplayer], &camera2, false);
                if (camera.chase)
                    P_MoveChaseCamera(&players[displayplayer], &camera, false);
            }
            D_Display();

            if (moviemode)
                M_SaveFrame();
            if (takescreenshot) // Only take screenshots after drawing.
                M_DoScreenShot();
        }

        // consoleplayer -> displayplayer (hear sounds from viewpoint)
        S_UpdateSounds(); // move positional sounds

        // check for media change, loop music..
        I_UpdateCD();

#ifdef HW3SOUND
        HW3S_EndFrameUpdate();
#endif
    }
}
Beispiel #18
0
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
  }
}