Пример #1
0
void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoint, int fov)
{
	BYTE *Pixels = const_cast<BYTE*>(tex->GetPixels());
	DSimpleCanvas *Canvas = tex->GetCanvas();

	float savedfov = LastFOV;
	R_SetFOV ((float)fov);
	R_RenderViewToCanvas (viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), tex->bFirstUpdate);
	R_SetFOV (savedfov);
	if (Pixels == Canvas->GetBuffer())
	{
		FTexture::FlipSquareBlockRemap (Pixels, tex->GetWidth(), tex->GetHeight(), GPalette.Remap);
	}
	else
	{
		FTexture::FlipNonSquareBlockRemap (Pixels, Canvas->GetBuffer(), tex->GetWidth(), tex->GetHeight(), Canvas->GetPitch(), GPalette.Remap);
	}
	tex->SetUpdated();
}
Пример #2
0
//
// D_Display
//  draw current display, possibly wiping it from the previous
//
void D_Display (void)
{
	if (nodrawers)
		return; 				// for comparative timing / profiling

	BEGIN_STAT(D_Display);

	// [RH] change the screen mode if needed
	if (setmodeneeded)
	{
		// Change screen mode.
		if (!V_SetResolution (NewWidth, NewHeight, NewBits))
			I_FatalError ("Could not change screen mode");

		// Recalculate various view parameters.
		setsizeneeded = true;
		// Trick status bar into rethinking its position
		st_scale.Callback ();
		// Refresh the console.
		C_NewModeAdjust ();
	}

	// [AM] Moved to below setmodeneeded so we have accurate screen size info.
	if (gamestate == GS_LEVEL && viewactive && consoleplayer().camera)
	{
		if (consoleplayer().camera->player)
			R_SetFOV(consoleplayer().camera->player->fov, setmodeneeded || setsizeneeded);
		else
			R_SetFOV(90.0f, setmodeneeded || setsizeneeded);
	}

	// change the view size if needed
	if (setsizeneeded)
	{
		R_ExecuteSetViewSize ();
		setmodeneeded = false;
	}

	I_BeginUpdate ();

	// [RH] Allow temporarily disabling wipes
	if (NoWipe)
	{
		NoWipe--;
		wipegamestate = gamestate;
	}
	else if (gamestate != wipegamestate && gamestate != GS_FULLCONSOLE)
	{
		wipegamestate = gamestate;
		Wipe_Start();
		wiping_screen = true;
	}

	switch (gamestate)
	{
		case GS_FULLCONSOLE:
		case GS_DOWNLOAD:
		case GS_CONNECTING:
        case GS_CONNECTED:
			C_DrawConsole ();
			M_Drawer ();
			I_FinishUpdate ();
			return;

		case GS_LEVEL:
			if (!gametic)
				break;

			V_DoPaletteEffects();
			if (viewactive)
				R_RenderPlayerView(&displayplayer());
			if (automapactive)
				AM_Drawer();
			V_RestorePalettes();
			R_DrawViewBorder();
			C_DrawMid ();
			C_DrawGMid();
			CTF_DrawHud ();
			ST_Drawer ();
			HU_Drawer ();
			break;

		case GS_INTERMISSION:
			if (viewactive)
				R_RenderPlayerView(&displayplayer());
			C_DrawMid ();
			CTF_DrawHud ();
			WI_Drawer ();
			HU_Drawer ();
			break;

		case GS_FINALE:
			F_Drawer ();
			break;

		case GS_DEMOSCREEN:
			D_PageDrawer ();
			break;

	default:
	    break;
	}

	// draw pause pic
	if (paused && !menuactive)
	{
		const Texture* texture = R_LoadTexture("M_PAUSE");
		int x = (screen->width - texture->getWidth() * CleanXfac) / 2;
		int y = (automapactive && !viewactive) ? 4 : viewwindowy + 4;
		screen->DrawTextureCleanNoMove(texture, x, y);
	}

	// [RH] Draw icon, if any
	if (D_DrawIcon)
	{
		texhandle_t texhandle = texturemanager.getHandle(D_DrawIcon, Texture::TEX_PATCH);
		const Texture* texture = texturemanager.getTexture(texhandle);
		D_DrawIcon = NULL;

		int x = 160 - texture->getWidth() / 2;
		int y = 100 - texture->getHeight() / 2;
		screen->DrawTextureIndirect(texture, x, y);
		NoWipe = 10;
	}

	if (wiping_screen)
		Wipe_Drawer();

	C_DrawConsole();	// draw console
	M_Drawer();			// menu is drawn even on top of everything
	I_FinishUpdate();	// page flip or blit buffer

	END_STAT(D_Display);
}
Пример #3
0
//
// D_Display
//  draw current display, possibly wiping it from the previous
//
void D_Display (void)
{
    BOOL wipe;

    if (nodrawers)
        return; 				// for comparative timing / profiling

    BEGIN_STAT(D_Display);

    if (gamestate == GS_LEVEL && viewactive && consoleplayer().camera)
        R_SetFOV (consoleplayer().camera->player ?
                  consoleplayer().camera->player->fov : 90.0f);

    // [RH] change the screen mode if needed
    if (setmodeneeded)
    {
        int oldwidth = screen->width;
        int oldheight = screen->height;
        int oldbits = DisplayBits;

        // Change screen mode.
        if (!V_SetResolution (NewWidth, NewHeight, NewBits))
            if (!V_SetResolution (oldwidth, oldheight, oldbits))
                I_FatalError ("Could not change screen mode");

        // Recalculate various view parameters.
        setsizeneeded = true;
        // Trick status bar into rethinking its position
        st_scale.Callback ();
        // Refresh the console.
        C_NewModeAdjust ();
    }

    // change the view size if needed
    if (setsizeneeded)
    {
        R_ExecuteSetViewSize ();
        setmodeneeded = false;
    }

    I_BeginUpdate ();

    // [RH] Allow temporarily disabling wipes
    if (NoWipe)
    {
        NoWipe--;
        wipe = false;
        wipegamestate = gamestate;
    }
    else if (gamestate != wipegamestate && gamestate != GS_FULLCONSOLE)
    {   // save the current screen if about to wipe
        wipe = true;
        wipe_StartScreen ();
        wipegamestate = gamestate;
    }
    else
    {
        wipe = false;
    }

    switch (gamestate)
    {
    case GS_FULLCONSOLE:
    case GS_DOWNLOAD:
    case GS_CONNECTING:
        C_DrawConsole ();
        M_Drawer ();
        I_FinishUpdate ();
        return;

    case GS_LEVEL:
        if (!gametic)
            break;

        // denis - freshen the borders (ffs..)
        R_DrawViewBorder ();    // erase old menu stuff

        if (viewactive)
            R_RenderPlayerView (&displayplayer());
        if (automapactive)
            AM_Drawer ();
        C_DrawMid ();
        CTF_DrawHud ();
        ST_Drawer ();
        HU_Drawer ();
        break;

    case GS_INTERMISSION:
        if (viewactive)
            R_RenderPlayerView (&displayplayer());
        C_DrawMid ();
        CTF_DrawHud ();
        WI_Drawer ();
        HU_Drawer ();
        break;

    case GS_FINALE:
        F_Drawer ();
        break;

    case GS_DEMOSCREEN:
        D_PageDrawer ();
        break;

    default:
        break;
    }

    // draw pause pic
    if (paused && !menuactive)
    {
        patch_t *pause = W_CachePatch ("M_PAUSE");
        int y;

        y = (automapactive && !viewactive) ? 4 : viewwindowy + 4;
        screen->DrawPatchCleanNoMove (pause, (screen->width-(pause->width())*CleanXfac)/2, y);
    }

    // [RH] Draw icon, if any
    if (D_DrawIcon)
    {
        int lump = W_CheckNumForName (D_DrawIcon);

        D_DrawIcon = NULL;
        if (lump >= 0)
        {
            patch_t *p = W_CachePatch (lump);

            screen->DrawPatchIndirect (p, 160-p->width()/2, 100-p->height()/2);
        }
        NoWipe = 10;
    }

    static bool live_wiping = false;

    if (!wipe)
    {
        if(live_wiping)
        {
            // wipe update online (multiple calls, not just looping here)
            C_DrawConsole ();
            wipe_EndScreen();
            live_wiping = !wipe_ScreenWipe (1);
            M_Drawer ();			// menu is drawn even on top of wipes
            I_FinishUpdate ();		// page flip or blit buffer
        }
        else
        {
            // normal update
            C_DrawConsole ();	// draw console
            M_Drawer ();		// menu is drawn even on top of everything
            I_FinishUpdate ();	// page flip or blit buffer
        }
    }
    else
    {
        if(!connected)
        {
            // wipe update offline
            int wipestart, wipecont, nowtime, tics;
            BOOL done;

            C_DrawConsole ();
            wipe_EndScreen ();
            I_FinishUpdateNoBlit ();

            extern int canceltics;

            wipestart = I_GetTime ();
            wipecont = wipestart - 1;

            do
            {
                do
                {
                    nowtime = I_GetTime ();
                    tics = nowtime - wipecont;
                } while (!tics);
                wipecont = nowtime;
                I_BeginUpdate ();
                done = wipe_ScreenWipe (tics);
                M_Drawer ();			// menu is drawn even on top of wipes
                I_FinishUpdate ();		// page flip or blit buffer
            } while (!done);

            if(!connected)
                canceltics += I_GetTime () - wipestart;
        }
        else
        {
            // wipe update online
            live_wiping = true;

            // wipe update online (multiple calls, not just looping here)
            C_DrawConsole ();
            wipe_EndScreen();
            live_wiping = !wipe_ScreenWipe (1);
            M_Drawer ();			// menu is drawn even on top of wipes
            I_FinishUpdate ();		// page flip or blit buffer
        }
    }

    END_STAT(D_Display);
}
Пример #4
0
//
// D_Display
//  draw current display, possibly wiping it from the previous
//
void D_Display (void)
{
	if (nodrawers)
		return; 				// for comparative timing / profiling

	BEGIN_STAT(D_Display);

	// [RH] change the screen mode if needed
	if (setmodeneeded)
	{
		// Change screen mode.
		if (!V_SetResolution (NewWidth, NewHeight, NewBits))
			I_FatalError ("Could not change screen mode");

		// Recalculate various view parameters.
		setsizeneeded = true;
		// Trick status bar into rethinking its position
		st_scale.Callback ();
		// Refresh the console.
		C_NewModeAdjust ();
	}

	// [AM] Moved to below setmodeneeded so we have accurate screen size info.
	if (gamestate == GS_LEVEL && viewactive && consoleplayer().camera)
	{
		if (consoleplayer().camera->player)
			R_SetFOV(consoleplayer().camera->player->fov, setmodeneeded || setsizeneeded);
		else
			R_SetFOV(90.0f, setmodeneeded || setsizeneeded);
	}

	// change the view size if needed
	if (setsizeneeded)
	{
		R_ExecuteSetViewSize ();
		setmodeneeded = false;
	}

	I_BeginUpdate ();

	// [RH] Allow temporarily disabling wipes
	if (NoWipe)
	{
		NoWipe--;
		wipegamestate = gamestate;
	}
	else if (gamestate != wipegamestate && gamestate != GS_FULLCONSOLE)
	{
		wipegamestate = gamestate;
		Wipe_Start();
		wiping_screen = true;
	}

	switch (gamestate)
	{
		case GS_FULLCONSOLE:
		case GS_DOWNLOAD:
		case GS_CONNECTING:
        case GS_CONNECTED:
			C_DrawConsole ();
			M_Drawer ();
			I_FinishUpdate ();
			return;

		case GS_LEVEL:
			if (!gametic)
				break;

			// denis - freshen the borders (ffs..)
			R_DrawViewBorder ();    // erase old menu stuff

			if (viewactive)
				R_RenderPlayerView (&displayplayer());
			if (automapactive)
				AM_Drawer ();
			C_DrawMid ();
			C_DrawGMid();
			CTF_DrawHud ();
			ST_Drawer ();
			HU_Drawer ();
			break;

		case GS_INTERMISSION:
			if (viewactive)
				R_RenderPlayerView (&displayplayer());
			C_DrawMid ();
			CTF_DrawHud ();
			WI_Drawer ();
			HU_Drawer ();
			break;

		case GS_FINALE:
			F_Drawer ();
			break;

		case GS_DEMOSCREEN:
			D_PageDrawer ();
			break;

	default:
	    break;
	}

	// draw pause pic
	if (paused && !menuactive)
	{
		patch_t *pause = W_CachePatch ("M_PAUSE");
		int y;

		y = (automapactive && !viewactive) ? 4 : viewwindowy + 4;
		screen->DrawPatchCleanNoMove (pause, (screen->width-(pause->width())*CleanXfac)/2, y);
	}

	// [RH] Draw icon, if any
	if (D_DrawIcon)
	{
		int lump = W_CheckNumForName (D_DrawIcon);

		D_DrawIcon = NULL;
		if (lump >= 0)
		{
			patch_t *p = W_CachePatch (lump);

			screen->DrawPatchIndirect (p, 160-p->width()/2, 100-p->height()/2);
		}
		NoWipe = 10;
	}

	if (wiping_screen)
		Wipe_Drawer();

	C_DrawConsole();	// draw console
	M_Drawer();			// menu is drawn even on top of everything
	I_FinishUpdate();	// page flip or blit buffer

	END_STAT(D_Display);
}