- 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. { // Reset world variables for the new hub.
P_ClearACSVars(false); 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; 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() void FMapInfoParser::ParseGameInfo()
{ {
sc.MustGetToken('{'); sc.MustGetToken('{');
@ -311,6 +333,11 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_INT(TextScreenX, "textscreenx") GAMEINFOKEY_INT(TextScreenX, "textscreenx")
GAMEINFOKEY_INT(TextScreenY, "textscreeny") GAMEINFOKEY_INT(TextScreenY, "textscreeny")
GAMEINFOKEY_STRING(DefaultEndSequence, "defaultendsequence") 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 else
{ {

View file

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

View file

@ -47,6 +47,7 @@
#include "gi.h" #include "gi.h"
#include "r_translate.h" #include "r_translate.h"
#include "templates.h" #include "templates.h"
#include "gstrings.h"
// States for the intermission // States for the intermission
typedef enum typedef enum
@ -206,10 +207,39 @@ static bool noautostartmap;
// GRAPHICS // 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 TArray<FTexture *> yah; // You Are Here graphic
static FTexture* splat; // splat static FTexture* splat; // splat
static FTexture* finished; // "Finished!" graphics
static FTexture* entering; // "Entering" graphic
static FTexture* sp_secret; // "secret" static FTexture* sp_secret; // "secret"
static FTexture* kills; // "Kills", "Scrt", "Items", "Frags" static FTexture* kills; // "Kills", "Scrt", "Items", "Frags"
static FTexture* secret; static FTexture* secret;
@ -697,7 +727,15 @@ 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)
{
// draw <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;
}
else
{ {
int i; int i;
size_t l; size_t l;
@ -705,26 +743,51 @@ int WI_DrawName(int y, const char *levelname)
int h = 0; int h = 0;
int lumph; int lumph;
lumph = BigFont->GetHeight() * CleanYfac; lumph = mapname.mFont->GetHeight() * CleanYfac;
p = levelname; p = levelname;
if (!p) return 0; if (!p) return 0;
l = strlen(p); l = strlen(p);
if (!l) return 0; if (!l) return 0;
FBrokenLines *lines = V_BreakLines(BigFont, screen->GetWidth() / CleanXfac, p); FBrokenLines *lines = V_BreakLines(mapname.mFont, screen->GetWidth() / CleanXfac, p);
if (lines) if (lines)
{ {
for (i = 0; lines[i].Width >= 0; i++) for (i = 0; lines[i].Width >= 0; i++)
{ {
screen->DrawText(BigFont, CR_UNTRANSLATED, (SCREENWIDTH - lines[i].Width * CleanXfac) / 2, y + h, screen->DrawText(mapname.mFont, mapname.mColor, (SCREENWIDTH - lines[i].Width * CleanXfac) / 2, y + h,
lines[i].Text, DTA_CleanNoMove, true, TAG_DONE); lines[i].Text, DTA_CleanNoMove, true, TAG_DONE);
h += lumph; h += lumph;
} }
V_FreeBrokenLines(lines); V_FreeBrokenLines(lines);
} }
return h + lumph/4; 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;
}
} }
@ -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. // A level name patch can be specified for all games now, not just Doom.
// //
//==================================================================== //====================================================================
int WI_drawLF () int WI_drawLF ()
{ {
int y = WI_TITLEY * CleanYfac; int y = WI_TITLEY * CleanYfac;
int midx = screen->GetWidth() / 2;
FTexture *tex = wbs->LName0; y = WI_DrawName(y, wbs->LName0, lnametexts[0]);
// draw <LevelName> // Adjustment for different font sizes for map name and 'finished'.
if (tex) y -= ((mapname.mFont->GetHeight() - finished.mFont->GetHeight()) * CleanYfac) / 4;
{
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]);
}
// draw "Finished!" // draw "Finished!"
FFont *font = gameinfo.gametype & GAME_Raven ? SmallFont : BigFont; if (y < (NG_STATSY - finished.mFont->GetHeight()*3/4) * CleanYfac)
if (y < (NG_STATSY - font->GetHeight()*3/4) * CleanYfac)
{ {
// don't draw 'finished' if the level name is too high! // don't draw 'finished' if the level name is too tall
if (gameinfo.gametype & GAME_DoomChex) y = WI_DrawPatchText(y, &finished, "WI_FINISHED");
{
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;
}
} }
return y; return y;
} }
@ -784,36 +827,14 @@ int WI_drawLF ()
// A level name patch can be specified for all games now, not just Doom. // A level name patch can be specified for all games now, not just Doom.
// //
//==================================================================== //====================================================================
void WI_drawEL () void WI_drawEL ()
{ {
int y = WI_TITLEY * CleanYfac; int y = WI_TITLEY * CleanYfac;
FFont *font = gameinfo.gametype & GAME_Raven ? SmallFont : BigFont;
// draw "entering" y = WI_DrawPatchText(y, &entering, "WI_ENTERING");
// be careful with the added height so that it works for oversized 'entering' patches! y += entering.mFont->GetHeight() * CleanYfac / 4;
if (gameinfo.gametype & GAME_DoomChex) WI_DrawName(y, wbs->LName1, lnametexts[1]);
{
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]);
}
} }
@ -1905,12 +1926,15 @@ void WI_Ticker(void)
} }
} }
void WI_loadData(void) void WI_loadData(void)
{ {
entering.Init(gameinfo.mStatscreenEnteringFont);
finished.Init(gameinfo.mStatscreenFinishedFont);
mapname.Init(gameinfo.mStatscreenMapNameFont);
if (gameinfo.gametype & GAME_DoomChex) if (gameinfo.gametype & GAME_DoomChex)
{ {
finished = TexMan["WIF"]; // "finished"
entering = TexMan["WIENTER"]; // "entering"
kills = TexMan["WIOSTK"]; // "kills" kills = TexMan["WIOSTK"]; // "kills"
secret = TexMan["WIOSTS"]; // "scrt" secret = TexMan["WIOSTS"]; // "scrt"
sp_secret = TexMan["WISCRT2"]; // "secret" sp_secret = TexMan["WISCRT2"]; // "secret"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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