From 3a198a29dceb30e5508c1b9e7e4c9cea90f2e3ad Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 15 Nov 2009 14:33:35 +0000 Subject: [PATCH] - fixed: fullscreen images with texture scaling used the unscaled size for positioning. To avoid future problems with them I added a new DTA_Fullscreen option for DrawTexture. SVN r1983 (trunk) --- docs/rh-log.txt | 3 +++ src/d_main.cpp | 3 +-- src/f_finale.cpp | 33 +++++++++++++-------------------- src/v_draw.cpp | 10 ++++++++++ src/v_video.h | 1 + src/wi_stuff.cpp | 13 ++++++------- 6 files changed, 34 insertions(+), 29 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 11928da78..6ac525820 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ November 15, 2009 (Changes by Graf Zahl) +- fixed: fullscreen images with texture scaling used the unscaled size for + positioning. To avoid future problems with them I added a new DTA_Fullscreen + option for DrawTexture. - fixed: The sky baseline position needs to take texture scaling into account. November 14, 2009 diff --git a/src/d_main.cpp b/src/d_main.cpp index d8bae9f8a..70db2f050 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -953,8 +953,7 @@ void D_PageDrawer (void) if (Page != NULL) { screen->DrawTexture (Page, 0, 0, - DTA_VirtualWidth, Page->GetWidth(), - DTA_VirtualHeight, Page->GetHeight(), + DTA_Fullscreen, true, DTA_Masked, false, DTA_BilinearFilter, true, TAG_DONE); diff --git a/src/f_finale.cpp b/src/f_finale.cpp index 82b8a9e02..e08f249eb 100644 --- a/src/f_finale.cpp +++ b/src/f_finale.cpp @@ -809,8 +809,8 @@ void F_DemonScroll () int yval; FTexture *final1 = TexMan(tex1); FTexture *final2 = TexMan(tex2); - int fwidth = final1->GetWidth(); - int fheight = final1->GetHeight(); + int fwidth = final1->GetScaledWidth(); + int fheight = final1->GetScaledHeight(); if (FinaleCount < 70) { @@ -884,10 +884,7 @@ void F_DrawUnderwater(void) // intentional fall-through case 2: pic = TexMan("E2END"); - screen->DrawTexture (pic, 0, 0, - DTA_VirtualWidth, pic->GetWidth(), - DTA_VirtualHeight, pic->GetHeight(), - TAG_DONE); + screen->DrawTexture (pic, 0, 0, DTA_Fullscreen, true, TAG_DONE); screen->FillBorder (NULL); paused = false; menuactive = MENU_Off; @@ -907,10 +904,7 @@ void F_DrawUnderwater(void) screen->UpdatePalette (); pic = TexMan("TITLE"); - screen->DrawTexture (pic, 0, 0, - DTA_VirtualWidth, pic->GetWidth(), - DTA_VirtualHeight, pic->GetHeight(), - TAG_DONE); + screen->DrawTexture (pic, 0, 0, DTA_Fullscreen, true, TAG_DONE); screen->FillBorder (NULL); NoWipe = 0; break; @@ -960,8 +954,8 @@ void F_BunnyScroll (void) V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT); tex = TexMan(tex1); - fwidth = tex->GetWidth(); - fheight = tex->GetHeight(); + fwidth = tex->GetScaledWidth(); + fheight = tex->GetScaledHeight(); scrolled = clamp (((signed)FinaleCount-230)*fwidth/640, 0, fwidth); @@ -1315,25 +1309,24 @@ void F_Drawer (void) if (picname != NULL) { FTexture *pic = TexMan[picname]; - screen->DrawTexture (pic, 0, 0, - DTA_VirtualWidth, pic->GetWidth(), - DTA_VirtualHeight, pic->GetHeight(), - TAG_DONE); + screen->DrawTexture (pic, 0, 0, DTA_Fullscreen, true, TAG_DONE); screen->FillBorder (NULL); if (FinaleStage >= 14) { // Chess pic, draw the correct character graphic + double w = pic->GetScaledWidthDouble(); + double h = pic->GetScaledHeightDouble(); if (multiplayer) { screen->DrawTexture (TexMan["CHESSALL"], 20, 0, - DTA_VirtualWidth, pic->GetWidth(), - DTA_VirtualHeight, pic->GetHeight(), TAG_DONE); + DTA_VirtualWidth, w, + DTA_VirtualHeight, h, TAG_DONE); } else if (players[consoleplayer].CurrentPlayerClass > 0) { picname = players[consoleplayer].CurrentPlayerClass == 1 ? "CHESSC" : "CHESSM"; screen->DrawTexture (TexMan[picname], 60, 0, - DTA_VirtualWidth, pic->GetWidth(), - DTA_VirtualHeight, pic->GetHeight(), TAG_DONE); + DTA_VirtualWidth, w, + DTA_VirtualHeight, h, TAG_DONE); } } } diff --git a/src/v_draw.cpp b/src/v_draw.cpp index f53e7cd31..e6ff521cd 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -491,6 +491,16 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag parms->virtHeight = va_arg(tags, double); break; + case DTA_Fullscreen: + boolval = va_arg(tags, INTBOOL); + if (boolval) + { + parms->x = parms->y = 0; + parms->virtWidth = img->GetScaledWidthDouble(); + parms->virtHeight = img->GetScaledHeightDouble(); + } + break; + case DTA_Alpha: parms->alpha = MIN(FRACUNIT, va_arg (tags, fixed_t)); break; diff --git a/src/v_video.h b/src/v_video.h index 6e6e6c60d..69af12ada 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -103,6 +103,7 @@ enum DTA_BilinearFilter, // bool: apply bilinear filtering to the image DTA_SpecialColormap,// pointer to FSpecialColormapParameters (likely to be forever hardware-only) DTA_ColormapStyle, // pointer to FColormapStyle (hardware-only) + DTA_Fullscreen, // Draw image fullscreen (same as DTA_VirtualWidth/Height with graphics size.) // floating point duplicates of some of the above: DTA_DestWidthF, diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index ca7b11e37..a01d15346 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -595,8 +595,8 @@ void WI_updateAnimatedBack() void WI_drawBackground() { unsigned int i; - int animwidth=320; // For a flat fill or clear background scale animations to 320x200 - int animheight=200; + double animwidth=320; // For a flat fill or clear background scale animations to 320x200 + double animheight=200; if (background) { @@ -606,11 +606,10 @@ void WI_drawBackground() // scale all animations below to fit the size of the base pic // The base pic is always scaled to fit the screen so this allows // placing the animations precisely where they belong on the base pic - animwidth = background->GetWidth(); - animheight = background->GetHeight(); + animwidth = background->GetScaledWidth(); + animheight = background->GetScaledHeight(); screen->FillBorder (NULL); - screen->DrawTexture(background, 0, 0, DTA_VirtualWidth, animwidth, - DTA_VirtualHeight, animheight, TAG_DONE); + screen->DrawTexture(background, 0, 0, DTA_Fullscreen, true, TAG_DONE); } else { @@ -666,7 +665,7 @@ void WI_drawBackground() } if (a->ctr >= 0) screen->DrawTexture(a->p[a->ctr], a->loc.x, a->loc.y, - DTA_VirtualWidth, animwidth, DTA_VirtualHeight, animheight, TAG_DONE); + DTA_VirtualWidthF, animwidth, DTA_VirtualHeightF, animheight, TAG_DONE); } }