- when using the VGA font, confine the speaker's text in Strife dialogues to the backdrop picture.

This looks a lot better. Unfortunately for the regular SmallFont this would severely reduce the available space for the text so it isn't done here, even though for shorter texts the formatting would look better as well.
This commit is contained in:
Christoph Oelckers 2019-07-27 09:35:45 +02:00
parent b768c6877c
commit 1dd98a5c89

View file

@ -77,6 +77,8 @@ class ConversationMenu : Menu
Array<String> mResponseLines; Array<String> mResponseLines;
Array<uint> mResponses; Array<uint> mResponses;
bool mShowGold; bool mShowGold;
bool mHasBackdrop;
bool mConfineTextToBackdrop;
StrifeDialogueNode mCurNode; StrifeDialogueNode mCurNode;
int mYpos; int mYpos;
PlayerInfo mPlayer; PlayerInfo mPlayer;
@ -85,6 +87,7 @@ class ConversationMenu : Menu
int LineHeight; int LineHeight;
int ReplyLineHeight; int ReplyLineHeight;
Font displayFont; Font displayFont;
int speechDisplayWidth;
int displayWidth; int displayWidth;
int displayHeight; int displayHeight;
int fontScale; int fontScale;
@ -101,7 +104,7 @@ class ConversationMenu : Menu
//============================================================================= //=============================================================================
// //
// returns the y position of the replies boy for positioning the terminal response. // returns the y position of the replies box for positioning the terminal response.
// //
//============================================================================= //=============================================================================
@ -112,6 +115,10 @@ class ConversationMenu : Menu
mShowGold = false; mShowGold = false;
ConversationPauseTic = gametic + 20; ConversationPauseTic = gametic + 20;
DontDim = true; DontDim = true;
let tex = TexMan.CheckForTexture (CurNode.Backdrop, TexMan.Type_MiscPatch);
mHasBackdrop = tex.isValid();
if (!generic_ui && !dlg_vgafont) if (!generic_ui && !dlg_vgafont)
{ {
displayFont = SmallFont; displayFont = SmallFont;
@ -123,17 +130,33 @@ class ConversationMenu : Menu
ReplyWidth = 320-50-10; ReplyWidth = 320-50-10;
SpeechWidth = screen.GetWidth()/CleanXfac - 24*2; SpeechWidth = screen.GetWidth()/CleanXfac - 24*2;
ReplyLineHeight = LineHeight = displayFont.GetHeight(); ReplyLineHeight = LineHeight = displayFont.GetHeight();
mConfineTextToBackdrop = false;
speechDisplayWidth = displayWidth;
} }
else else
{ {
displayFont = NewSmallFont; displayFont = NewSmallFont;
fontScale = (CleanXfac+1) / 2; fontScale = (CleanXfac+1) / 2;
displayWidth = screen.GetWidth() / fontScale;
displayHeight = screen.GetHeight() / fontScale;
refwidth = 640; refwidth = 640;
refheight = 400; refheight = 400;
ReplyWidth = 640-100-20; ReplyWidth = 640-100-20;
SpeechWidth = screen.GetWidth()/fontScale - (24*2 * CleanXfac / fontScale); displayWidth = screen.GetWidth() / fontScale;
displayHeight = screen.GetHeight() / fontScale;
let aspect = Screen.GetAspectRatio();
if (!mHasBackdrop || aspect <= 1.3334)
{
SpeechWidth = screen.GetWidth()/fontScale - (24*3 * CleanXfac / fontScale);
mConfineTextToBackdrop = false;
speechDisplayWidth = displayWidth;
}
else
{
let formatWidth = Screen.GetHeight() * 1.3333;
SpeechWidth = formatWidth / fontScale - (24*3 * CleanXfac / fontScale);
mConfineTextToBackdrop = true;
speechDisplayWidth = formatWidth / fontScale;
}
LineHeight = displayFont.GetHeight() + 2; LineHeight = displayFont.GetHeight() + 2;
ReplyLineHeight = LineHeight * fontScale / CleanYfac; ReplyLineHeight = LineHeight * fontScale / CleanYfac;
} }
@ -442,13 +465,13 @@ class ConversationMenu : Menu
if (speakerName.Length() > 0) if (speakerName.Length() > 0)
{ {
screen.DrawText(displayFont, Font.CR_WHITE, x / fontScale, y / fontScale, speakerName, DTA_KeepRatio, true, DTA_VirtualWidth, displayWidth, DTA_VirtualHeight, displayHeight); screen.DrawText(displayFont, Font.CR_WHITE, x / fontScale, y / fontScale, speakerName, DTA_KeepRatio, !mConfineTextToBackdrop, DTA_VirtualWidth, speechDisplayWidth, DTA_VirtualHeight, displayHeight);
y += linesize * 3 / 2; y += linesize * 3 / 2;
} }
x = 24 * screen.GetWidth() / 320; x = 24 * screen.GetWidth() / 320;
for (int i = 0; i < cnt; ++i) for (int i = 0; i < cnt; ++i)
{ {
screen.DrawText(displayFont, Font.CR_UNTRANSLATED, x / fontScale, y / fontScale, mDialogueLines.StringAt(i), DTA_KeepRatio, true, DTA_VirtualWidth, displayWidth, DTA_VirtualHeight, displayHeight); screen.DrawText(displayFont, Font.CR_UNTRANSLATED, x / fontScale, y / fontScale, mDialogueLines.StringAt(i), DTA_KeepRatio, !mConfineTextToBackdrop, DTA_VirtualWidth, speechDisplayWidth, DTA_VirtualHeight, displayHeight);
y += linesize; y += linesize;
} }
} }