From 287a814a18962580c8046c8d406f6e9b4ea51051 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 22 Mar 2012 22:07:47 +0000 Subject: [PATCH] - Fixed: Deus Vult II uses fullscreen level name patches (which are mostly blank) for the intermission. This caused the net scoreboard to be drawn off the bottom of the screen. SVN r3465 (trunk) --- src/wi_stuff.cpp | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index 5e3955cc4..1b81aeb00 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -719,6 +719,41 @@ static int WI_DrawCharPatch (FFont *font, int charcode, int x, int y, EColorRang return x - width; } +//==================================================================== +// +// CheckRealHeight +// +// Checks the posts in a texture and returns the lowest row (plus one) +// of the texture that is actually used. +// +//==================================================================== + +int CheckRealHeight(FTexture *tex) +{ + const FTexture::Span *span; + int maxy = 0, miny = tex->GetHeight(); + + for (int i = 0; i < tex->GetWidth(); ++i) + { + tex->GetColumn(i, &span); + while (span->Length != 0) + { + if (span->TopOffset < miny) + { + miny = span->TopOffset; + } + if (span->TopOffset + span->Length > maxy) + { + maxy = span->TopOffset + span->Length; + } + span++; + } + } + // Scale maxy before returning it + maxy = (maxy << 17) / tex->yScale; + maxy = (maxy >> 1) + (maxy & 1); + return maxy; +} //==================================================================== // @@ -735,7 +770,13 @@ int WI_DrawName(int y, FTexture *tex, const char *levelname) if (tex) { screen->DrawTexture(tex, (screen->GetWidth() - tex->GetScaledWidth()*CleanXfac) /2, y, DTA_CleanNoMove, true, TAG_DONE); - return y + (tex->GetScaledHeight() + BigFont->GetHeight()/4) * CleanYfac; + int h = tex->GetScaledHeight(); + if (h > 50) + { // Fix for Deus Vult II and similar wads that decide to make these hugely tall + // patches with vast amounts of empty space at the bottom. + h = CheckRealHeight(tex); + } + return y + (h + BigFont->GetHeight()/4) * CleanYfac; } else {