Exemplo n.º 1
0
Arquivo: d_main.c Projeto: jezze/doom
static void D_Display(void)
{

    if (!I_StartDisplay())
        return;

    if (gamestate != GS_LEVEL)
    {

        switch (gamestate)
        {

        case GS_INTERMISSION:
            WI_Drawer();

            break;

        case GS_FINALE:
            F_Drawer();

            break;

        default:
            break;

        }

    }
    
    else if (gametic != basetic)
    {

        HU_Erase();
        R_RenderPlayerView(&players[consoleplayer]);
        ST_Drawer();
        HU_Drawer();

    }

    M_Drawer();
    D_BuildNewTiccmds();
    I_FinishUpdate();
    I_EndDisplay();

}
Exemplo n.º 2
0
void D_Display (void)
{
    static  boolean		viewactivestate = false;
    static  boolean		menuactivestate = false;
    static  boolean		inhelpscreensstate = false;
    static  boolean		fullscreen = false;
    static  gamestate_t		oldgamestate = -1;
    static  int			borderdrawcount;
    int				nowtime;
    int				tics;
    int				wipestart;
    int				y;
    boolean			done;
    boolean			wipe;
    boolean			redrawsbar;

    if (nodrawers)
	return;                    // for comparative timing / profiling
		
    redrawsbar = false;
    
    // change the view size if needed
    if (setsizeneeded)
    {
	R_ExecuteSetViewSize ();
	oldgamestate = -1;                      // force background redraw
	borderdrawcount = 3;
    }

    // save the current screen if about to wipe
    if (gamestate != wipegamestate)
    {
	wipe = true;
	wipe_StartScreen(0, 0, SCREENWIDTH, SCREENHEIGHT);
    }
    else
	wipe = false;

    if (gamestate == GS_LEVEL && gametic)
	HU_Erase();
    
    // do buffered drawing
    switch (gamestate)
    {
      case GS_LEVEL:
	if (!gametic)
	    break;
	if (automapactive)
	    AM_Drawer ();
	if (wipe || (viewheight != 200 && fullscreen) )
	    redrawsbar = true;
	if (inhelpscreensstate && !inhelpscreens)
	    redrawsbar = true;              // just put away the help screen
	ST_Drawer (viewheight == 200, redrawsbar );
	fullscreen = viewheight == 200;
	break;

      case GS_INTERMISSION:
	WI_Drawer ();
	break;

      case GS_FINALE:
	F_Drawer ();
	break;

      case GS_DEMOSCREEN:
	D_PageDrawer ();
	break;
    }
    
    // draw buffered stuff to screen
    I_UpdateNoBlit ();
    
    // draw the view directly
    if (gamestate == GS_LEVEL && !automapactive && gametic)
	R_RenderPlayerView (&players[displayplayer]);

    if (gamestate == GS_LEVEL && gametic)
	HU_Drawer ();
    
    // clean up border stuff
    if (gamestate != oldgamestate && gamestate != GS_LEVEL)
	I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE));

    // see if the border needs to be initially drawn
    if (gamestate == GS_LEVEL && oldgamestate != GS_LEVEL)
    {
	viewactivestate = false;        // view was not active
	R_FillBackScreen ();    // draw the pattern into the back screen
    }

    // see if the border needs to be updated to the screen
    if (gamestate == GS_LEVEL && !automapactive && scaledviewwidth != 320)
    {
	if (menuactive || menuactivestate || !viewactivestate)
	    borderdrawcount = 3;
	if (borderdrawcount)
	{
	    R_DrawViewBorder ();    // erase old menu stuff
	    borderdrawcount--;
	}

    }

    menuactivestate = menuactive;
    viewactivestate = viewactive;
    inhelpscreensstate = inhelpscreens;
    oldgamestate = wipegamestate = gamestate;
    
    // draw pause pic
    if (paused)
    {
	if (automapactive)
	    y = 4;
	else
	    y = viewwindowy+4;
	V_DrawPatchDirect(viewwindowx+(scaledviewwidth-68)/2,
			  y,0,W_CacheLumpName ("M_PAUSE", PU_CACHE));
    }


    // menus go directly to the screen
    M_Drawer ();          // menu is drawn even on top of everything
    NetUpdate ();         // send out any new accumulation


    // normal update
    if (!wipe)
    {
	I_FinishUpdate ();              // page flip or blit buffer
	return;
    }
    
    // wipe update
    wipe_EndScreen(0, 0, SCREENWIDTH, SCREENHEIGHT);

    wipestart = I_GetTime () - 1;

    do
    {
	do
	{
	    nowtime = I_GetTime ();
	    tics = nowtime - wipestart;
	} while (!tics);
	wipestart = nowtime;
	done = wipe_ScreenWipe(wipe_Melt
			       , 0, 0, SCREENWIDTH, SCREENHEIGHT, tics);
	I_UpdateNoBlit ();
	M_Drawer ();                            // menu is drawn even on top of wipes
	I_FinishUpdate ();                      // page flip or blit buffer
    } while (!done);
}
Exemplo n.º 3
0
void D_Display (void)
{
   static boolean isborderstate        IDATA_ATTR= false;
   static boolean borderwillneedredraw IDATA_ATTR= false;
   static  gamestate_t  oldgamestate IDATA_ATTR= -1;
   boolean wipe;
   boolean viewactive = false, isborder = false;

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

   // save the current screen if about to wipe
   if ((wipe = gamestate != wipegamestate))
      wipe_StartScreen(0, 0, SCREENWIDTH, SCREENHEIGHT);

   if (gamestate != GS_LEVEL) { // Not a level
      switch (oldgamestate) {
      case (gamestate_t)-1:
      case GS_LEVEL:
         V_SetPalette(0); // cph - use default (basic) palette
      default:
         break;
      }

      switch (gamestate) {
      case GS_INTERMISSION:
         WI_Drawer();
         break;
      case GS_FINALE:
         F_Drawer();
         break;
      case GS_DEMOSCREEN:
         D_PageDrawer();
         break;
      default:
         break;
      }
   } else if (gametic != basetic) { // In a level
      boolean redrawborderstuff;

      HU_Erase();

      if (setsizeneeded) {               // change the view size if needed
         R_ExecuteSetViewSize();
         oldgamestate = -1;            // force background redraw
      }

      // Work out if the player view is visible, and if there is a border
      viewactive = (!(automapmode & am_active) || (automapmode & am_overlay)) && !inhelpscreens;
      isborder = viewactive ? (viewheight != SCREENHEIGHT) : (!inhelpscreens && (automapmode & am_active));

      if (oldgamestate != GS_LEVEL) {
         R_FillBackScreen ();    // draw the pattern into the back screen
         redrawborderstuff = isborder;
      } else {
         // CPhipps -
         // If there is a border, and either there was no border last time,
         // or the border might need refreshing, then redraw it.
         redrawborderstuff = isborder && (!isborderstate || borderwillneedredraw);
         // The border may need redrawing next time if the border surrounds the screen,
         // and there is a menu being displayed
         borderwillneedredraw = menuactive && isborder && viewactive && (viewwidth != SCREENWIDTH);
      }

      if (redrawborderstuff)
         R_DrawViewBorder();

      // Now do the drawing
      if (viewactive)
         R_RenderPlayerView (&players[displayplayer]);
      if (automapmode & am_active)
         AM_Drawer();
      ST_Drawer((viewheight != SCREENHEIGHT) || ((automapmode & am_active) && !(automapmode & am_overlay)), redrawborderstuff);
      R_DrawViewBorder();

      HU_Drawer();
   }

   isborderstate      = isborder;
   oldgamestate = wipegamestate = gamestate;

   // draw pause pic
   if (paused) {
      static int x;

      if (!x) { // Cache results of x pos calc
         int lump = W_GetNumForName("M_PAUSE");
         const patch_t* p = W_CacheLumpNum(lump);
         x = (320 - SHORT(p->width))/2;
         W_UnlockLumpNum(lump);
      }

      // CPhipps - updated for new patch drawing
      V_DrawNamePatch(x, (!(automapmode & am_active) || (automapmode & am_overlay))
                      ? 4+(viewwindowy*200/SCREENHEIGHT) : 4, // cph - Must un-stretch viewwindowy
                      0, "M_PAUSE", CR_DEFAULT, VPT_STRETCH);
   }

   // menus go directly to the screen
   M_Drawer();          // menu is drawn even on top of everything
   D_BuildNewTiccmds();

   // normal update
   if (!wipe)
      I_FinishUpdate ();              // page flip or blit buffer
   else {
      // wipe update
      wipe_EndScreen(0, 0, SCREENWIDTH, SCREENHEIGHT);
      D_Wipe();
   }
}
Exemplo n.º 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;

			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);
}
Exemplo n.º 5
0
void D_Display (void)
{
  static boolean inhelpscreensstate   = false;
  static boolean isborderstate        = false;
  static boolean borderwillneedredraw = false;
  static gamestate_t oldgamestate = -1;
  boolean wipe;
  boolean viewactive = false, isborder = false;

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

  if (!I_StartDisplay())
    return;

  // save the current screen if about to wipe
  if ((wipe = gamestate != wipegamestate) && (V_GetMode() != VID_MODEGL))
    wipe_StartScreen();

  if (gamestate != GS_LEVEL) { // Not a level
    switch (oldgamestate) {
    case -1:
    case GS_LEVEL:
      V_SetPalette(0); // cph - use default (basic) palette
    default:
      break;
    }

    switch (gamestate) {
    case GS_INTERMISSION:
      WI_Drawer();
      break;
    case GS_FINALE:
      F_Drawer();
      break;
    case GS_DEMOSCREEN:
      D_PageDrawer();
      break;
    default:
      break;
    }
  } else if (gametic != basetic) { // In a level
    boolean redrawborderstuff;

    HU_Erase();

    if (setsizeneeded) {               // change the view size if needed
      R_ExecuteSetViewSize();
      oldgamestate = -1;            // force background redraw
    }

    // Work out if the player view is visible, and if there is a border
    viewactive = (!(automapmode & am_active) || (automapmode & am_overlay)) && !inhelpscreens;
    isborder = viewactive ? (viewheight != SCREENHEIGHT) : (!inhelpscreens && (automapmode & am_active));

    if (oldgamestate != GS_LEVEL) {
      R_FillBackScreen ();    // draw the pattern into the back screen
      redrawborderstuff = isborder;
    } else {
      // CPhipps -
      // If there is a border, and either there was no border last time,
      // or the border might need refreshing, then redraw it.
      redrawborderstuff = isborder && (!isborderstate || borderwillneedredraw);
      // The border may need redrawing next time if the border surrounds the screen,
      // and there is a menu being displayed
      borderwillneedredraw = menuactive && isborder && viewactive && (viewwidth != SCREENWIDTH);
    }
    if (redrawborderstuff || (V_GetMode() == VID_MODEGL))
      R_DrawViewBorder();

    // Now do the drawing
    if (viewactive)
      R_RenderPlayerView (&players[displayplayer]);
    if (automapmode & am_active)
      AM_Drawer();
    ST_Drawer((viewheight != SCREENHEIGHT) || ((automapmode & am_active) && !(automapmode & am_overlay)), redrawborderstuff);
    if (V_GetMode() != VID_MODEGL)
      R_DrawViewBorder();
    HU_Drawer();
  }

  inhelpscreensstate = inhelpscreens;
  isborderstate      = isborder;
  oldgamestate = wipegamestate = gamestate;

  // draw pause pic
  if (paused) {
    // Simplified the "logic" here and no need for x-coord caching - POPE
    V_DrawNamePatch((320 - V_NamePatchWidth("M_PAUSE"))/2, 4,
                    0, "M_PAUSE", CR_DEFAULT, VPT_STRETCH);
  }

  // menus go directly to the screen
  M_Drawer();          // menu is drawn even on top of everything
#ifdef HAVE_NET
  NetUpdate();         // send out any new accumulation
#else
  D_BuildNewTiccmds();
#endif

  // normal update
  if (!wipe || (V_GetMode() == VID_MODEGL))
    I_FinishUpdate ();              // page flip or blit buffer
  else {
    // wipe update
    wipe_EndScreen();
    D_Wipe();
  }

  I_EndDisplay();

  //e6y: don't thrash cpu during pausing
  if (paused) {
    I_uSleep(1000);
  }
}
Exemplo n.º 6
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);
}
Exemplo n.º 7
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);
}
Exemplo n.º 8
0
void D_Display(fixed_t frac)
{
	static boolean automapstate = false;
	static boolean menuactivestate = false;
	static boolean inhelpscreensstate = false;
	static boolean oldviewheight = 0;
	int y;

	switch (gamestate) {
	case GS_LEVEL:
		if (!gametic)
			break;
		if (HU_Erase() ||
		    (inhelpscreensstate && !inhelpscreens) ||
		    (automapstate && !automapactive) ||
		    (menuactivestate && !menuactive) ||
		    (viewheight != oldviewheight) ||
		    gamestate != GS_LEVEL) {
			if (!automapactive)
				R_FillScreenBorder();
			ST_Drawer(viewheight == 200, true);
		} else {
			ST_Drawer(viewheight == 200, false);
		}

		if (automapactive)
			AM_Drawer();
		else
			R_RenderPlayerView(&players[displayplayer], frac);

		HU_Drawer();
		break;

	case GS_INTERMISSION:
		WI_Drawer();
		break;

	case GS_FINALE:
		F_Drawer();
		break;

	case GS_DEMOSCREEN:
		D_PageDrawer();
		break;
	}

	// clean up border stuff
	if (gamestate != oldgamestate && gamestate != GS_LEVEL)
		I_SetPalette(W_CacheLumpName("PLAYPAL", PU_CACHE));

	oldviewheight = viewheight;
	menuactivestate = menuactive;
	automapstate = automapactive;
	inhelpscreensstate = inhelpscreens;

	// draw pause pic
	if (paused) {
		if (automapactive)
			y = 4;
		else
			y = viewwindowy + 4;
		V_DrawPatchDirect(viewwindowx + (scaledviewwidth - 68) / 2,
				  y, 0, W_CacheLumpName("M_PAUSE", PU_CACHE));
	}
}
Exemplo n.º 9
0
void D_Display(void)
{
	static boolean viewactivestate = false;
	static boolean menuactivestate = false;
	static boolean inhelpscreensstate = false;
	static boolean fullscreen = false;
	static gamestate_t oldgamestate = -1;
	int     y;
	boolean redrawsbar;
	player_t *player = &players[displayplayer];
	boolean iscam = (player->plr->flags & DDPF_CAMERA) != 0;	// $democam

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

	redrawsbar = false;

	// $democam: can be set on every frame
	if(setblocks > 10 || iscam)
	{
		// Full screen.
		R_ViewWindow(0, 0, 320, 200);
	}
	else
	{
		int     w = setblocks * 32;
		int     h = setblocks * (200 - ST_HEIGHT * cfg.sbarscale / 20) / 10;

		R_ViewWindow(160 - (w >> 1),
					 (200 - ST_HEIGHT * cfg.sbarscale / 20 - h) >> 1, w, h);
	}

	// Do buffered drawing.
	switch (gamestate)
	{
	case GS_LEVEL:
		if(IS_CLIENT && (!Get(DD_GAME_READY) || !Get(DD_GOTFRAME)))
			break;
		if(leveltime < 2)
		{
			// Don't render too early; the first couple of frames 
			// might be a bit unstable -- this should be considered
			// a bug, but since there's an easy fix...
			break;
		}
		if(!automapactive || cfg.automapAlpha < 1)
		{
			// Draw the player view.
			if(IS_CLIENT)
			{
				// Server updates mobj flags in NetSv_Ticker.
				R_SetAllDoomsdayFlags();
			}
			// Don't draw self.
			Set(DD_VIEWANGLE_OFFSET, ANGLE_MAX * -lookOffset);
			GL_SetFilter(players[displayplayer].plr->filter);	// $democam
			// How about fullbright?
			Set(DD_FULLBRIGHT, (player->powers[pw_infrared] > 4 * 32) ||
				(player->powers[pw_infrared] & 8) ||
				player->powers[pw_invulnerability] > 30);

			// Render the view with possible custom filters.
			R_RenderPlayerView(players[displayplayer].plr);

			R_DrawSpecialFilter();
			// Crosshair.
			if(!iscam)
				X_Drawer();		// $democam
		}
		if(automapactive)
			AM_Drawer();

		// Level information is shown for a few seconds in the 
		// beginning of a level.
		R_DrawLevelTitle();

		if((viewheight != 200))
			redrawsbar = true;
		if(inhelpscreensstate && !inhelpscreens)
			redrawsbar = true;	// just put away the help screen
		if(!iscam)
			ST_Drawer(viewheight == 200, redrawsbar);	// $democam
		fullscreen = viewheight == 200;
		HU_Drawer();
		// Need to update the borders?
		if(oldgamestate != GS_LEVEL ||
		   ((Get(DD_VIEWWINDOW_WIDTH) != 320 || menuactive ||
			 cfg.sbarscale < 20)))
		{
			// Update the borders.
			GL_Update(DDUF_BORDER);
		}
		break;

	case GS_INTERMISSION:
		WI_Drawer();
		break;

	case GS_WAITING:
		gl.Clear(DGL_COLOR_BUFFER_BIT);
		M_WriteText2(5, 188, "WAITING... PRESS ESC FOR MENU", hu_font_a, 1, 0,
					 0);

	default:
		break;
	}

	GL_Update(DDUF_FULLSCREEN);

	menuactivestate = menuactive;
	viewactivestate = viewactive;
	inhelpscreensstate = inhelpscreens;
	oldgamestate = wipegamestate = gamestate;

	// draw pause pic (but not if InFine active)
	if(paused && !fi_active)
	{
		if(automapactive)
			y = 4;
		else
			y = viewwindowy + 4;

		WI_DrawPatch(126, y, W_GetNumForName("M_PAUSE"));
	}

	// InFine is drawn whenever active.
	FI_Drawer();
}
Exemplo n.º 10
0
void D_Display(void)
{
    static boolean     viewactivestate = false;
    static boolean     menuactivestate = false;
    static boolean     pausedstate = false;
    static gamestate_t oldgamestate = (gamestate_t)(-1);
    static int         borderdrawcount;
    int                nowtime;
    int                tics;
    int                wipestart;
    boolean            done;

    // change the view size if needed
    if (setsizeneeded)
    {
        R_ExecuteSetViewSize();
        oldgamestate = (gamestate_t)(-1);         // force background redraw
        borderdrawcount = 3;
    }

    // save the current screen if about to wipe
    if ((wipe = (gamestate != wipegamestate || forcewipe)))
    {
        wipe_StartScreen();
        if (forcewipe)
            forcewipe = false;
        else
            menuactive = false;
    }

    if (gamestate != GS_LEVEL)
    {
        if (gamestate != oldgamestate)
            I_SetPalette((byte *)W_CacheLumpName("PLAYPAL", PU_CACHE));

        switch (gamestate)
        {
            case GS_INTERMISSION:
                WI_Drawer();
                break;

            case GS_FINALE:
                F_Drawer();
                break;

            case GS_DEMOSCREEN:
                D_PageDrawer();
                break;
        }
    }
    else if (gametic)
    {
        HU_Erase();

        ST_Drawer(viewheight == SCREENHEIGHT, true);

        // draw the view directly
        R_RenderPlayerView(&players[displayplayer]);

        if (automapactive)
            AM_Drawer();

        // see if the border needs to be initially drawn
        if (oldgamestate != GS_LEVEL)
        {
            viewactivestate = false;    // view was not active
            R_FillBackScreen();         // draw the pattern into the back screen
        }

        // see if the border needs to be updated to the screen
        if (!automapactive)
        {
            if (scaledviewwidth != SCREENWIDTH)
            {
                if (menuactive || menuactivestate || !viewactivestate || paused || pausedstate || message_on)
                    borderdrawcount = 3;
                if (borderdrawcount)
                {
                    R_DrawViewBorder();     // erase old menu stuff
                    borderdrawcount--;
                }
            }
            if (graphicdetail == LOW)
                V_LowGraphicDetail(0, viewheight2);
        }
        HU_Drawer();
    }

    menuactivestate = menuactive;
    viewactivestate = viewactive;
    oldgamestate = wipegamestate = gamestate;

    // draw pause pic
    if ((pausedstate = paused))
    {
        M_DarkBackground();
        if (M_PAUSE)
        {
            patch_t     *patch = W_CacheLumpName("M_PAUSE", PU_CACHE);

            if (widescreen)
                V_DrawPatchWithShadow((ORIGINALWIDTH - patch->width) / 2,
                                      viewwindowy / 2 + (viewheight / 2 - patch->height) / 2,
                                      0, patch, false);
            else
                V_DrawPatchWithShadow((ORIGINALWIDTH - patch->width) / 2,
                                      (ORIGINALHEIGHT - patch->height) / 2,
                                      0, patch, false);
        }
        else
        {
            if (widescreen)
                M_DrawCenteredString(viewwindowy / 2 + (viewheight / 2 - 16) / 2, "Paused");
            else
                M_DrawCenteredString((ORIGINALHEIGHT - 16) / 2, "Paused");
        }
    }

    // menus go directly to the screen
    M_Drawer();                 // menu is drawn even on top of everything

    // normal update
    if (!wipe)
    {
        I_FinishUpdate();       // page flip or blit buffer
        return;
    }

    // wipe update
    wipe_EndScreen();

    wipestart = I_GetTime() - 1;

    do
    {
        do
        {
            nowtime = I_GetTime();
            tics = nowtime - wipestart;
            I_Sleep(1);
        }
        while (tics <= 0);

        wipestart = nowtime;
        done = wipe_ScreenWipe(tics);
        blurred = false;
        M_Drawer();             // menu is drawn even on top of wipes
        I_FinishUpdate();       // page flip or blit buffer
    }
    while (!done);
}
Exemplo n.º 11
0
void D_Display (void)
{
  boolean wipe, viewactive, isborder;
  static boolean isborderstate        = FALSE;
  static boolean borderwillneedredraw = FALSE;
  static gamestate_t oldgamestate = -1;

  // Reentrancy.
  if (in_d_wipe)
  {
     D_Wipe();
     return;
  }

  if (!I_StartDisplay())
    return;

  // save the current screen if about to wipe
  if ((wipe = gamestate != wipegamestate))
    wipe_StartScreen();

  if (gamestate != GS_LEVEL) { // Not a level
    switch (oldgamestate) {
    case -1:
    case GS_LEVEL:
      V_SetPalette(0); // cph - use default (basic) palette
    default:
      break;
    }

    switch (gamestate) {
    case GS_INTERMISSION:
      WI_Drawer();
      break;
    case GS_FINALE:
      F_Drawer();
      break;
    case GS_DEMOSCREEN:
      D_PageDrawer();
      break;
    default:
      break;
    }
  } else if (gametic != basetic) { // In a level
    boolean redrawborderstuff;

    HU_Erase();

    if (setsizeneeded) {               // change the view size if needed
      R_ExecuteSetViewSize();
      oldgamestate = -1;            // force background redraw
    }

    // Work out if the player view is visible, and if there is a border
    viewactive = (!(automapmode & am_active) || (automapmode & am_overlay)) && !inhelpscreens;
    isborder = viewactive ? (viewheight != SCREENHEIGHT) : (!inhelpscreens && (automapmode & am_active));

    if (oldgamestate != GS_LEVEL) {
      redrawborderstuff = isborder;
    } else {
      // CPhipps -
      // If there is a border, and either there was no border last time,
      // or the border might need refreshing, then redraw it.
      redrawborderstuff = isborder && (!isborderstate || borderwillneedredraw);
      // The border may need redrawing next time if the border surrounds the screen,
      // and there is a menu being displayed
      borderwillneedredraw = viewactive
        ? (menuactive && isborder)
        : (!inhelpscreens && menuactive == mnact_full);
    }

    // Now do the drawing
    if (viewactive)
      R_RenderPlayerView (&players[displayplayer]);
    if (automapmode & am_active)
      AM_Drawer();
    ST_Drawer(
        ((viewheight != SCREENHEIGHT)
         || ((automapmode & am_active) && !(automapmode & am_overlay))),
        redrawborderstuff,
        (menuactive == mnact_full));
    HU_Drawer();
  }

  isborderstate      = isborder;
  oldgamestate = wipegamestate = gamestate;

  // draw pause pic
  if (paused && (menuactive != mnact_full)) {
    // Simplified the "logic" here and no need for x-coord caching - POPE
    V_DrawNamePatch((320 - V_NamePatchWidth("M_PAUSE"))/2, 4,
                    0, "M_PAUSE", CR_DEFAULT, VPT_NONE);
  }

  // menus go directly to the screen
  M_Drawer();          // menu is drawn even on top of everything
#ifdef HAVE_NET
  NetUpdate();         // send out any new accumulation
#else
  D_BuildNewTiccmds();
#endif

  // normal update
  if (!wipe)
    I_FinishUpdate ();              // page flip or blit buffer
  else {
    // wipe update
    wipe_EndScreen();
    D_Wipe();
  }

  I_EndDisplay();
}