- 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.


SVN r2981 (trunk)
This commit is contained in:
Christoph Oelckers 2010-11-06 09:28:17 +00:00
parent 4a9892725d
commit 72192397ad
10 changed files with 162 additions and 89 deletions

View file

@ -742,12 +742,7 @@ void G_DoCompleted (void)
{ // Reset world variables for the new hub.
P_ClearACSVars(false);
}
// With hub statistics the time should be per hub.
// Additionally there is a global time counter now so nothing is missed by changing it
//else if (mode == FINISH_NoHub)
{ // Reset time to zero if not entering/staying in a hub.
level.time = 0;
}
level.time = 0;
level.maptime = 0;
}

View file

@ -163,6 +163,28 @@ const char* GameInfoBoarders[] =
} \
}
#define GAMEINFOKEY_FONT(key, variable) \
else if(nextKey.CompareNoCase(variable) == 0) \
{ \
sc.MustGetToken(TK_StringConst); \
gameinfo.key.fontname = sc.String; \
if (sc.CheckToken(',')) { \
sc.MustGetToken(TK_StringConst); \
gameinfo.key.color = sc.String; \
} else { \
gameinfo.key.color = NAME_None; \
} \
}
#define GAMEINFOKEY_PATCH(key, variable) \
else if(nextKey.CompareNoCase(variable) == 0) \
{ \
sc.MustGetToken(TK_StringConst); \
gameinfo.key.fontname = sc.String; \
gameinfo.key.color = NAME_Null; \
}
void FMapInfoParser::ParseGameInfo()
{
sc.MustGetToken('{');
@ -311,6 +333,11 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_INT(TextScreenX, "textscreenx")
GAMEINFOKEY_INT(TextScreenY, "textscreeny")
GAMEINFOKEY_STRING(DefaultEndSequence, "defaultendsequence")
GAMEINFOKEY_FONT(mStatscreenMapNameFont, "statscreen_mapnamefont")
GAMEINFOKEY_FONT(mStatscreenFinishedFont, "statscreen_finishedfont")
GAMEINFOKEY_FONT(mStatscreenEnteringFont, "statscreen_enteringfont")
GAMEINFOKEY_PATCH(mStatscreenFinishedFont, "statscreen_finishedpatch")
GAMEINFOKEY_PATCH(mStatscreenEnteringFont, "statscreen_enteringpatch")
else
{

View file

@ -66,6 +66,12 @@ struct gameborder_t
char br[8];
};
struct FGIFont
{
FName fontname;
FName color;
};
struct gameinfo_t
{
int flags;
@ -130,6 +136,9 @@ struct gameinfo_t
int TextScreenY;
FName DefaultEndSequence;
FString mMapArrow, mCheatMapArrow;
FGIFont mStatscreenMapNameFont;
FGIFont mStatscreenFinishedFont;
FGIFont mStatscreenEnteringFont;
const char *GetFinalePage(unsigned int num) const;
};

View file

@ -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"

View file

@ -1563,6 +1563,9 @@ $ifgame(heretic) SWSTRING = "ONLY AVAILABLE IN THE REGISTERED VERSION";
MNU_EPISODE = "Select Episode";
WI_FINISHED = "finished";
WI_ENTERING = "Now entering:";
// Bloodbath announcer
BBA_BONED = "%k boned %o like a fish";

View file

@ -61,6 +61,9 @@ gameinfo
textscreeny = 10
defaultendsequence = "Inter_Pic1"
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
statscreen_mapnamefont = "BigFont"
statscreen_finishedpatch = "WIF"
statscreen_enteringpatch = "WIENTER"
}
skill baby

View file

@ -62,6 +62,9 @@ gameinfo
textscreeny = 10
defaultendsequence = "Inter_Cast"
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
statscreen_mapnamefont = "BigFont"
statscreen_finishedpatch = "WIF"
statscreen_enteringpatch = "WIENTER"
}
skill baby

View file

@ -61,6 +61,9 @@ gameinfo
textscreeny = 5
defaultendsequence = "Inter_Pic1"
maparrow = "maparrows/dagger.txt"
statscreen_mapnamefont = "BigFont"
statscreen_finishedfont = "SmallFont"
statscreen_enteringfont = "SmallFont"
}
skill baby

View file

@ -59,6 +59,9 @@ gameinfo
textscreeny = 5
defaultendsequence = "Inter_Chess"
maparrow = "maparrows/dagger.txt"
statscreen_mapnamefont = "BigFont"
statscreen_finishedfont = "SmallFont"
statscreen_enteringfont = "SmallFont"
}
skill baby

View file

@ -61,6 +61,9 @@ gameinfo
textscreeny = 10
defaultendsequence = "Inter_Strife"
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
statscreen_mapnamefont = "BigFont"
statscreen_finishedfont = "BigFont", "white"
statscreen_enteringfont = "BigFont", "white"
}
Intermission Inter_Strife_Good