mirror of
https://github.com/ZDoom/gzdoom-last-svn.git
synced 2025-06-04 11:10:48 +00:00
* Updated to ZDoom r2981:
- Added some initial configurability to statistics intermission screen: * Font and color for map name can be set if it's not a titlepatch * 'Finished' and 'Entering' can be either patches or a printed text in all gamees now. * Font and color for 'finished' and 'entering' text can be set. * Moved 'finished' and 'Now entering:' texts into string table. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1071 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
parent
0dd982ce41
commit
88c45d187d
11 changed files with 164 additions and 91 deletions
190
src/wi_stuff.cpp
190
src/wi_stuff.cpp
|
@ -47,6 +47,7 @@
|
|||
#include "gi.h"
|
||||
#include "r_translate.h"
|
||||
#include "templates.h"
|
||||
#include "gstrings.h"
|
||||
|
||||
// States for the intermission
|
||||
typedef enum
|
||||
|
@ -206,10 +207,39 @@ static bool noautostartmap;
|
|||
// GRAPHICS
|
||||
//
|
||||
|
||||
struct FPatchInfo
|
||||
{
|
||||
FFont *mFont;
|
||||
FTexture *mPatch;
|
||||
EColorRange mColor;
|
||||
|
||||
void Init(FGIFont &gifont)
|
||||
{
|
||||
if (gifont.color == NAME_Null)
|
||||
{
|
||||
mPatch = TexMan[gifont.fontname]; // "entering"
|
||||
mColor = mPatch == NULL? CR_UNTRANSLATED : CR_UNDEFINED;
|
||||
mFont = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
mFont = V_GetFont(gifont.fontname);
|
||||
mColor = V_FindFontColor(gifont.color);
|
||||
mPatch = NULL;
|
||||
}
|
||||
if (mFont == NULL)
|
||||
{
|
||||
mFont = BigFont;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static FPatchInfo mapname;
|
||||
static FPatchInfo finished;
|
||||
static FPatchInfo entering;
|
||||
|
||||
static TArray<FTexture *> yah; // You Are Here graphic
|
||||
static FTexture* splat; // splat
|
||||
static FTexture* finished; // "Finished!" graphics
|
||||
static FTexture* entering; // "Entering" graphic
|
||||
static FTexture* sp_secret; // "secret"
|
||||
static FTexture* kills; // "Kills", "Scrt", "Items", "Frags"
|
||||
static FTexture* secret;
|
||||
|
@ -697,34 +727,67 @@ static int WI_DrawCharPatch (FFont *font, int charcode, int x, int y, EColorRang
|
|||
//
|
||||
//====================================================================
|
||||
|
||||
int WI_DrawName(int y, const char *levelname)
|
||||
int WI_DrawName(int y, FTexture *tex, const char *levelname)
|
||||
{
|
||||
int i;
|
||||
size_t l;
|
||||
const char *p;
|
||||
int h = 0;
|
||||
int lumph;
|
||||
|
||||
lumph = BigFont->GetHeight() * CleanYfac;
|
||||
|
||||
p = levelname;
|
||||
if (!p) return 0;
|
||||
l = strlen(p);
|
||||
if (!l) return 0;
|
||||
|
||||
FBrokenLines *lines = V_BreakLines(BigFont, screen->GetWidth() / CleanXfac, p);
|
||||
|
||||
if (lines)
|
||||
// draw <LevelName>
|
||||
if (tex)
|
||||
{
|
||||
for (i = 0; lines[i].Width >= 0; i++)
|
||||
{
|
||||
screen->DrawText(BigFont, CR_UNTRANSLATED, (SCREENWIDTH - lines[i].Width * CleanXfac) / 2, y + h,
|
||||
lines[i].Text, DTA_CleanNoMove, true, TAG_DONE);
|
||||
h += lumph;
|
||||
}
|
||||
V_FreeBrokenLines(lines);
|
||||
screen->DrawTexture(tex, (screen->GetWidth() - tex->GetScaledWidth()*CleanXfac) /2, y, DTA_CleanNoMove, true, TAG_DONE);
|
||||
return y + (tex->GetScaledHeight() + BigFont->GetHeight()/4) * CleanYfac;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
size_t l;
|
||||
const char *p;
|
||||
int h = 0;
|
||||
int lumph;
|
||||
|
||||
lumph = mapname.mFont->GetHeight() * CleanYfac;
|
||||
|
||||
p = levelname;
|
||||
if (!p) return 0;
|
||||
l = strlen(p);
|
||||
if (!l) return 0;
|
||||
|
||||
FBrokenLines *lines = V_BreakLines(mapname.mFont, screen->GetWidth() / CleanXfac, p);
|
||||
|
||||
if (lines)
|
||||
{
|
||||
for (i = 0; lines[i].Width >= 0; i++)
|
||||
{
|
||||
screen->DrawText(mapname.mFont, mapname.mColor, (SCREENWIDTH - lines[i].Width * CleanXfac) / 2, y + h,
|
||||
lines[i].Text, DTA_CleanNoMove, true, TAG_DONE);
|
||||
h += lumph;
|
||||
}
|
||||
V_FreeBrokenLines(lines);
|
||||
}
|
||||
return y + h + lumph/4;
|
||||
}
|
||||
}
|
||||
|
||||
//====================================================================
|
||||
//
|
||||
// Draws a text, either as patch or as string from the string table
|
||||
//
|
||||
//====================================================================
|
||||
|
||||
int WI_DrawPatchText(int y, FPatchInfo *pinfo, const char *stringname)
|
||||
{
|
||||
const char *string = GStrings(stringname);
|
||||
int midx = screen->GetWidth() / 2;
|
||||
|
||||
if (pinfo->mPatch != NULL)
|
||||
{
|
||||
screen->DrawTexture(pinfo->mPatch, midx - pinfo->mPatch->GetScaledWidth()*CleanXfac/2, y, DTA_CleanNoMove, true, TAG_DONE);
|
||||
return y + (pinfo->mPatch->GetScaledHeight() * CleanYfac);
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->DrawText(pinfo->mFont, pinfo->mColor, midx - pinfo->mFont->StringWidth(string)*CleanXfac/2,
|
||||
y, string, DTA_CleanNoMove, true, TAG_DONE);
|
||||
return y + pinfo->mFont->GetHeight() * CleanYfac;
|
||||
}
|
||||
return h + lumph/4;
|
||||
}
|
||||
|
||||
|
||||
|
@ -736,41 +799,21 @@ int WI_DrawName(int y, const char *levelname)
|
|||
// A level name patch can be specified for all games now, not just Doom.
|
||||
//
|
||||
//====================================================================
|
||||
|
||||
int WI_drawLF ()
|
||||
{
|
||||
int y = WI_TITLEY * CleanYfac;
|
||||
int midx = screen->GetWidth() / 2;
|
||||
|
||||
FTexture *tex = wbs->LName0;
|
||||
|
||||
// draw <LevelName>
|
||||
if (tex)
|
||||
{
|
||||
screen->DrawTexture(tex, midx - tex->GetScaledWidth()*CleanXfac/2, y, DTA_CleanNoMove, true, TAG_DONE);
|
||||
y += (tex->GetScaledHeight() + BigFont->GetHeight()/4) * CleanYfac;
|
||||
}
|
||||
else
|
||||
{
|
||||
y += WI_DrawName(y, lnametexts[0]);
|
||||
}
|
||||
y = WI_DrawName(y, wbs->LName0, lnametexts[0]);
|
||||
|
||||
// Adjustment for different font sizes for map name and 'finished'.
|
||||
y -= ((mapname.mFont->GetHeight() - finished.mFont->GetHeight()) * CleanYfac) / 4;
|
||||
|
||||
// draw "Finished!"
|
||||
FFont *font = gameinfo.gametype & GAME_Raven ? SmallFont : BigFont;
|
||||
if (y < (NG_STATSY - font->GetHeight()*3/4) * CleanYfac)
|
||||
if (y < (NG_STATSY - finished.mFont->GetHeight()*3/4) * CleanYfac)
|
||||
{
|
||||
// don't draw 'finished' if the level name is too high!
|
||||
if (gameinfo.gametype & GAME_DoomChex)
|
||||
{
|
||||
screen->DrawTexture(finished, midx - finished->GetScaledWidth()*CleanXfac/2, y, DTA_CleanNoMove, true, TAG_DONE);
|
||||
return y + finished->GetScaledHeight() * CleanYfac;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->DrawText(font, CR_WHITE,
|
||||
midx - font->StringWidth("finished")*CleanXfac/2, y - 4*CleanYfac, "finished",
|
||||
DTA_CleanNoMove, true, TAG_DONE);
|
||||
return y + font->GetHeight() * CleanYfac;
|
||||
}
|
||||
// don't draw 'finished' if the level name is too tall
|
||||
y = WI_DrawPatchText(y, &finished, "WI_FINISHED");
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
@ -784,36 +827,14 @@ int WI_drawLF ()
|
|||
// A level name patch can be specified for all games now, not just Doom.
|
||||
//
|
||||
//====================================================================
|
||||
|
||||
void WI_drawEL ()
|
||||
{
|
||||
int y = WI_TITLEY * CleanYfac;
|
||||
FFont *font = gameinfo.gametype & GAME_Raven ? SmallFont : BigFont;
|
||||
|
||||
// draw "entering"
|
||||
// be careful with the added height so that it works for oversized 'entering' patches!
|
||||
if (gameinfo.gametype & GAME_DoomChex)
|
||||
{
|
||||
screen->DrawTexture(entering, (SCREENWIDTH - entering->GetScaledWidth() * CleanXfac) / 2, y, DTA_CleanNoMove, true, TAG_DONE);
|
||||
y += (entering->GetScaledHeight() + font->GetHeight()/4) * CleanYfac;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->DrawText(font, CR_WHITE,
|
||||
(SCREENWIDTH - font->StringWidth("now entering:") * CleanXfac) / 2, y,
|
||||
"now entering:", DTA_CleanNoMove, true, TAG_DONE);
|
||||
y += font->GetHeight()*5*CleanYfac/4;
|
||||
}
|
||||
|
||||
// draw <LevelName>
|
||||
FTexture *tex = wbs->LName1;
|
||||
if (tex)
|
||||
{
|
||||
screen->DrawTexture(tex, (SCREENWIDTH - tex->GetScaledWidth() * CleanXfac) / 2, y, DTA_CleanNoMove, true, TAG_DONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
WI_DrawName(y, lnametexts[1]);
|
||||
}
|
||||
y = WI_DrawPatchText(y, &entering, "WI_ENTERING");
|
||||
y += entering.mFont->GetHeight() * CleanYfac / 4;
|
||||
WI_DrawName(y, wbs->LName1, lnametexts[1]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1905,12 +1926,15 @@ void WI_Ticker(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void WI_loadData(void)
|
||||
{
|
||||
entering.Init(gameinfo.mStatscreenEnteringFont);
|
||||
finished.Init(gameinfo.mStatscreenFinishedFont);
|
||||
mapname.Init(gameinfo.mStatscreenMapNameFont);
|
||||
|
||||
if (gameinfo.gametype & GAME_DoomChex)
|
||||
{
|
||||
finished = TexMan["WIF"]; // "finished"
|
||||
entering = TexMan["WIENTER"]; // "entering"
|
||||
kills = TexMan["WIOSTK"]; // "kills"
|
||||
secret = TexMan["WIOSTS"]; // "scrt"
|
||||
sp_secret = TexMan["WISCRT2"]; // "secret"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue