I think what would help Tormentor667 more than anything else right now is just a single use-case example showing this in action that he can edit to suit his own needs.
Were I knowledgeable about this and not engaging in other projects at the moment, I would do this, myself.
Thanks for the reply. I do understand that Graf follows this new philosophy and that's something people can actually live with. Concerning ZScript - I have no idea where to start honestly... I am really no programmer at all so taking a look at the sourcecode will make things just worse
You'll have to write a new DrawBackdrop function in that new class. But to give you some help you should do a mock-up as demonstration of what you plan to do.
That may require a bit more of fiddling with the script code. If I had some time on my hands I might be able to help you but I'm afraid you'll have to ask someone else.
Fortunately, Nash is already trying something. Let's see where he ends up with, he is very skilled with stuff like that and knows the code so we have good chances I'd say. Thanks still for your help.
So, I made a thing... Then saw that Nash is working this already. Oh, well.
Used existing graphics (the pain flash is the background, hence the red tint).
The fade image (pain flash here) is always drawn, and the face image co-opts the existing background image in ZSDF (so no change to existing dialogue lumps is needed). Left the default font because I wasn't sure what you actually wanted done there. The indents on the name and first line are in LANGUAGE, so could be removed easily there - by default, the text all aligns left.
Some choice strings may need to be re-worked because they are too wide now (like the costs and durations on the clerk's other conversation).
class BoAConversationMenu : ConversationMenu { int widthRatio, heightRatio, BulletWidth; double xOffset, yOffset;
//============================================================================= // // returns the y position of the replies boy for positioning the terminal response. // //=============================================================================
override int FormatReplies(int activereply) { mSelection = -1;
StrifeDialogueReply reply; int r = -1; int i = 1,j; for (reply = mCurNode.Children; reply != NULL; reply = reply.Next) { r++; if (reply.ShouldSkipReply(mPlayer)) { continue; } if (activereply == r) mSelection = i - 1;
mShowGold |= reply.NeedsGold;
let ReplyText = Stringtable.Localize(reply.Reply); if (reply.NeedsGold) ReplyText.AppendFormat(" for %u", reply.PrintAmount);
let ReplyLines = SmallFont.BreakLines (ReplyText, ReplyWidth - BulletWidth);
//============================================================================ // // Draw the backdrop, returns true if the text background should be dimmed // //============================================================================
void DrawBackdropIcon() { let tex = TexMan.CheckForTexture (mCurNode.Backdrop, TexMan.Type_MiscPatch); if (tex.isValid()) { int posx = 24; int posy = 20; int w = 38; int h = 38;
//============================================================================ // // Draw the speaker text // //============================================================================
// Who is talking to you? if (mCurNode.SpeakerName.Length() > 0) { speakerName = Stringtable.Localize(mCurNode.SpeakerName); } else { speakerName = players[consoleplayer].ConversationNPC.GetTag("Person"); }
int x = xOffset + 74 * widthRatio; int y = yOffset + 16 * heightRatio;
if (speakerName.Length() > 0) { screen.DrawText("SmallFnt", Font.CR_WHITE, x, y, speakerName, DTA_CleanNoMove, true); y += linesize * 3 / 2; }
for (int i = 0; i < cnt; ++i) { screen.DrawText("SmallFnt", Font.CR_UNTRANSLATED, x, y, mDialogueLines.StringAt(i), DTA_CleanNoMove, true); y += linesize; } }
//============================================================================ // // Draw the replies // //============================================================================
@Tormentor - Give me the go-ahead, and I'll commit this to github for testing.
Current state:
Right now, everything looks good at 4:3 and 16:9, but there are alignment issues at other aspect ratios - nothing game-breaking, just not pretty... I reinvented the wheel on some of the code, because I was learning it as I went, so there's definitely room for improvement, still.
Nash wrote:The pixels on the font look dirty... are you using the clean scaling tags?
No... That was part of the "reinventing the wheel" that I was talking about. It should be a relatively quick fix, I just didn't have time to rework it last night.
Hey Afa, thanks alot for helping us out with this, it looks already very good Feel free to commit the work. Regarding the line height/gap, just keep it as it was before. The mockup for the text was only meant to know where the text is, not how it looks.
Maybe you have also ideas on how to improve it or make it look better, so feel free to add your own suggestions.
Also implemented independent scaling for the conversation text and the replies... The replies shown here are slightly smaller than the speaker's text, mostly so that everything fits without re-doing the DIALOGUE lumps.
class BoAConversationMenu : ConversationMenu { double textscale, replytextscale; int BulletWidth, leftside, topside;
//============================================================================= // // Returns the y position of the replies to position the terminal response. // //=============================================================================
//============================================================================= // // Sets up array of lines for reply values with given width // //=============================================================================
override int FormatReplies(int activereply) { mSelection = -1;
StrifeDialogueReply reply; int r = -1; int i = 1,j; for (reply = mCurNode.Children; reply != NULL; reply = reply.Next) { r++; if (reply.ShouldSkipReply(mPlayer)) { continue; } if (activereply == r) mSelection = i - 1;
mShowGold |= reply.NeedsGold;
let ReplyText = Stringtable.Localize(reply.Reply); if (reply.NeedsGold) ReplyText.AppendFormat(" for %u", reply.PrintAmount);
let ReplyLines = SmallFont.BreakLines (ReplyText, int((ReplyWidth - BulletWidth) / replytextscale));
//============================================================================ // // Draw the backdrop, returns true if the text background should be dimmed // //============================================================================
//============================================================================ // // Draw the ZSDF-defined backdrop, fit to a square for use as a speaker icon // //============================================================================
void DrawBackdropIcon() { let tex = TexMan.CheckForTexture (mCurNode.Backdrop, TexMan.Type_MiscPatch); if (tex.isValid()) { int w = 38; int h = 38; int posx = leftside - 10 - w; int posy = topside;
//============================================================================ // // Draw the speaker text // //============================================================================
override void DrawSpeakerText(bool dimbg) { String speakerName; int linesize = int(OptionMenuSettings.mLinespacing * 1.5); int cnt = mDialogueLines.Count();
// Who is talking to you? if (mCurNode.SpeakerName.Length() > 0) { speakerName = Stringtable.Localize(mCurNode.SpeakerName); } else { speakerName = players[consoleplayer].ConversationNPC.GetTag("Person"); }
int x = int(leftside / textscale); int y = int(topside / textscale);
if (speakerName.Length() > 0) { screen.DrawText("SmallFnt", Font.CR_WHITE, x, y, speakerName, DTA_VirtualWidth, int(320 / textscale), DTA_VirtualHeight, int(240 / textscale)); y += linesize * 3 / 2; }
for (int i = 0; i < cnt; ++i) { screen.DrawText("SmallFnt", Font.CR_GREEN, x, y, mDialogueLines.StringAt(i), DTA_VirtualWidth, int(320 / textscale), DTA_VirtualHeight, int(240 / textscale));
y += linesize; } }
//============================================================================ // // Draw the replies // //============================================================================
int posx = leftside; int h = mResponseLines.Size() * fontheight + 4; int posy = 225 - h; int w = ReplyWidth;
DimArea(posx, posy, w, h);
int response = 0; for (int i = 0; i < mResponseLines.Size(); i++) { int x = int((posx + 4 + BulletWidth) / replytextscale); int y = int((posy + 4 + (i * fontheight)) / replytextscale);
void DimArea(int x = 0, int y = 0, int w = 320, int h = 200, double alpha = 0.45) { double widthRatio = screen.GetWidth() / 320.; double heightRatio = screen.GetHeight() / 240.;
Oh yes Thanks so kindly AFADoomer, this looks perfect now and the terribly looking Dialogue with overlapping text and mugs is gone Thanksthanksthanks!!!
*EDIT* Noticed two issues when trying it with the latest SVN, first: I can't use the mouse anymore to choose from the options. Second, if you start a new game and choose the difficulty, the "are you sure" message appears to be off-center. Would you mind trying?
*EDIT2* For some reason the toilet dialogue isn't talking anymore as well even though it hasn't been touched.