diff --git a/wadsrc/static/zscript/ui/menu/conversationmenu.zs b/wadsrc/static/zscript/ui/menu/conversationmenu.zs index 3c939d380..efa1b10ec 100644 --- a/wadsrc/static/zscript/ui/menu/conversationmenu.zs +++ b/wadsrc/static/zscript/ui/menu/conversationmenu.zs @@ -77,6 +77,8 @@ class ConversationMenu : Menu Array mResponseLines; Array mResponses; bool mShowGold; + bool mHasBackdrop; + bool mConfineTextToBackdrop; StrifeDialogueNode mCurNode; int mYpos; PlayerInfo mPlayer; @@ -85,6 +87,7 @@ class ConversationMenu : Menu int LineHeight; int ReplyLineHeight; Font displayFont; + int speechDisplayWidth; int displayWidth; int displayHeight; 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; ConversationPauseTic = gametic + 20; DontDim = true; + + let tex = TexMan.CheckForTexture (CurNode.Backdrop, TexMan.Type_MiscPatch); + mHasBackdrop = tex.isValid(); + if (!generic_ui && !dlg_vgafont) { displayFont = SmallFont; @@ -123,17 +130,33 @@ class ConversationMenu : Menu ReplyWidth = 320-50-10; SpeechWidth = screen.GetWidth()/CleanXfac - 24*2; ReplyLineHeight = LineHeight = displayFont.GetHeight(); + mConfineTextToBackdrop = false; + speechDisplayWidth = displayWidth; } else { displayFont = NewSmallFont; fontScale = (CleanXfac+1) / 2; - displayWidth = screen.GetWidth() / fontScale; - displayHeight = screen.GetHeight() / fontScale; refwidth = 640; refheight = 400; 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; ReplyLineHeight = LineHeight * fontScale / CleanYfac; } @@ -442,13 +465,13 @@ class ConversationMenu : Menu 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; } x = 24 * screen.GetWidth() / 320; 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; } }