예제 #1
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
    }
}
예제 #2
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
	}
}