Пример #1
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();
    I_EnableLoadingDisk();

    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 ();
    }
}
Пример #2
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 ();
    }
}
Пример #3
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");
    }

    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 ();

        // Sound mixing for the buffer is snychronous.
        I_UpdateSound();

        // Update sound output.
        I_SubmitSound();
    }
}
Пример #4
0
static void D_DoomLoop(void)
{

    for (;;)
    {

        tryruntics();

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

        D_Display();

    }

}
Пример #5
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);
      }
    }
}
Пример #6
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();
}
Пример #7
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 ();
    }
}
Пример #8
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;
   }
}
Пример #9
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)
    {
        // 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
        D_Display();
    }
}
Пример #10
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();
    }
}
Пример #11
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
    }
}
Пример #12
0
int D_MiniLoop(void(*start)(void), void(*stop)(void),
               void (*draw)(void), dboolean(*tick)(void))
{
    int action = gameaction = ga_nothing;

    if(start) start();

    while(!action)
    {
        int i = 0;
        int lowtic = 0;
        int entertic = 0;
        int availabletics = 0;
        int counts = 0;

        // process one or more tics

        // get real tics
        entertic = I_GetTime() / ticdup;

        // get available ticks

        D_UpdateTiccmd();
        lowtic = D_GetLowTic();

        availabletics = lowtic - gametic/ticdup;

        // decide how many tics to run

        counts = availabletics;

        if(counts < 1) counts = 1;

        // wait for new tics if needed

        while(!D_PlayersInGame() || lowtic < gametic/ticdup + counts)	
        {
            D_UpdateTiccmd();
            lowtic = D_GetLowTic();
	
            if(lowtic < gametic/ticdup)
                I_Error("D_MiniLoop: lowtic < gametic");

            // Don't stay in this loop forever.  The menu is still running,
            // so return to update the screen

            if(I_GetTime() / ticdup - entertic > 0)
                goto drawframe;

            I_Sleep(1);
        }

        // run the count * ticdup dics
        while(counts--)
        {
            for(i = 0; i < ticdup; i++)
            {
                // check that there are players in the game.  if not, we cannot
                // run a tic.
        
                if(!D_PlayersInGame())
                    break;
    
                if(gametic / ticdup > lowtic)
                    I_Error("gametic>lowtic");

                G_Ticker();

                if(tick)
                    action = tick();

                if(gameaction != ga_nothing)
                    action = gameaction;

                gametic++;
	    
                // modify command for duplicated tics
                if(i != ticdup-1)
                {
                   ticcmd_t *cmd;
                   int buf;
                   int j;
				
                   buf = (gametic / ticdup) % BACKUPTICS; 
                   for(j = 0; j < MAXPLAYERS; j++)
                   {
                       cmd = &netcmds[j][buf];
                       if(cmd->buttons & BT_SPECIAL)
                           cmd->buttons = 0;
                   }
                }
            }

            D_UpdateTiccmd();   // check for new console commands
        }

drawframe:

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

        if(draw && !action)
        {
            draw();
            I_FinishFrame();
        }
        
        if(menuactive)
            M_Drawer();

        // send out any new accumulation
        D_UpdateTiccmd();

        // force garbage collection
        Z_FreeAlloca();

        if(devparm)
            D_PrintDevStats();
    }

    if(stop) stop();

    return action;
}
Пример #13
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
	}
}