- reworked the load/save menu to use the new console font.

Parts of this menu suffered badly from lack of screen space to convey the intended information due to the oversized fonts. With the new font this is a lot less problematic (unless using 320x200, of course)
This commit is contained in:
Christoph Oelckers 2019-03-11 20:59:43 +01:00
commit 22cf35c1c7
6 changed files with 54 additions and 64 deletions

View file

@ -478,8 +478,7 @@ unsigned FSavegameManager::ExtractSaveData(int index)
comment = time;
if (time.Len() > 0) comment += "\n";
comment += pcomment;
SaveComment = V_BreakLines(SmallFont, WindowSize, comment.GetChars());
SaveCommentString = comment;
// Extract pic
FResourceLump *pic = resf->FindLump("savepic.png");
@ -533,9 +532,8 @@ void FSavegameManager::UnloadSaveData()
{
delete SavePic;
}
SaveComment.Clear();
SaveComment.ShrinkToFit();
SaveCommentString = "";
SavePic = nullptr;
SavePicData.Clear();
}
@ -592,46 +590,6 @@ DEFINE_ACTION_FUNCTION(FSavegameManager, DrawSavePic)
ACTION_RETURN_BOOL(self->DrawSavePic(x, y, w, h));
}
//=============================================================================
//
//
//
//=============================================================================
void FSavegameManager::DrawSaveComment(FFont *font, int cr, int x, int y, int scalefactor)
{
int sx = CleanXfac;
int sy = CleanYfac;
CleanXfac = CleanYfac = scalefactor;
int maxlines = screen->GetHeight()>400?10:screen->GetHeight()>240?7:screen->GetHeight()>200?8:5;
if (SmallFont->GetHeight() > 9) maxlines--; // not Doom
// I'm not sure why SaveComment would go nullptr in this loop, but I got
// a crash report where it was nullptr when i reached 1, so now I check
// for that.
for (int i = 0; i < maxlines && (unsigned)i < SaveComment.Size(); ++i)
{
screen->DrawText(font, cr, x, y + font->GetHeight() * i * scalefactor, SaveComment[i].Text, DTA_CleanNoMove, true, TAG_DONE);
}
CleanXfac = sx;
CleanYfac = sy;
}
DEFINE_ACTION_FUNCTION(FSavegameManager, DrawSaveComment)
{
PARAM_SELF_STRUCT_PROLOGUE(FSavegameManager);
PARAM_POINTER(fnt, FFont);
PARAM_INT(cr);
PARAM_INT(x);
PARAM_INT(y);
PARAM_INT(fac);
self->DrawSaveComment(fnt, cr, x, y, fac);
return 0;
}
//=============================================================================
//
//
@ -642,9 +600,7 @@ void FSavegameManager::SetFileInfo(int Selected)
{
if (!SaveGames[Selected]->Filename.IsEmpty())
{
FString work;
work.Format("File on disk:\n%s", SaveGames[Selected]->Filename.GetChars());
SaveComment = V_BreakLines(SmallFont, WindowSize, work);
SaveCommentString.Format("File on disk:\n%s", SaveGames[Selected]->Filename.GetChars());
}
}
@ -753,4 +709,5 @@ DEFINE_FIELD(FSaveGameNode, bNoDelete);
DEFINE_FIELD(FSavegameManager, WindowSize);
DEFINE_FIELD(FSavegameManager, quickSaveSlot);
DEFINE_FIELD(FSavegameManager, SaveCommentString);