Newer Sierra like narration GUI.

Started by Devoe, Fri 04/08/2017 00:12:43

Previous topic - Next topic

Devoe

Hello,

I'm quite new to AGS, though I'm not trying anything quite coherent, just getting around things.

I've been thinking of making the narrative text (which one uses Display() for) in the bottom of the screen, just like it was in the first Gabriel Knight or in Police Quest IV. I saw the VerbCoin template using a similar solution with the transparent overhotspot GUI, but whenever the skull reacts to something, the text is still somewhere closer to the end of the screen. Should I just use a custom text window GUI and use DisplayAt? Though that didn't help even when I had the Speech As Dialog option on. Using either DisplayAtY or DisplayAt got me the "good ol'" white window back.

dayowlron

#1
I would either use a custom text window GUI or a textual overlay.
With DisplayAt and DisplayAtY you can change the white window background to be something else but there will be a background of one sort.
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

Devoe

So there is no option to appropriate the dialog options area for that? Which is around where this would be in Gabriel Knight (Police Quest: Open Season is different as it's above the icon bar and has only one line rather than two like Sins of the Fathers).

Grundislav

Hey, I think I have an idea of what you want to do. I'm doing something similar in my game, but I'm not sure if it's exactly what you want.


Narrator text appears at the bottom of the screen.


Dialogue options in "wide" view also appear at the bottom of the screen.


Dialogue options in closeup conversation view appear in a list in the center on a custom GUI.

If this is more or less what you're trying to achieve, I'll gladly let you know how I'm doing it!

Devoe

Yes, yes, exactly like that! I like how you got a similar GUI/look to the original Gabriel Knight, too!

Grundislav

It's a great aesthetic that nobody ever used, so that's why I'm appropriating it :)

Anyway, for the text on the bottom, I wrote a simple custom function I called SayEx:
Code: ags
function SayEx(this Character *, String text)
{
  Game.SpeechFont = eFontFont3;
  Speech.TextAlignment = eAlignLeft;
  if (text.Length >= 102)
  {
    this.SayAt(0, 376, 630, text);
  }
  else
  {
    this.SayAt(0, 365, 630, text);
  }
  Game.SpeechFont = eFontFont1;
  Speech.TextAlignment = eAlignCentre;
}


What this does is change the display font (if it's going to be different from the rest of your game's font) and it also checks to see how long the string is so it can determine where to display the text. Since SayAt can be a little tricky, I have to have it display at different Y coordinates if it's longer than 102 characters. You might have to play around with these values to figure out what works best for you.

As for the dialogue GUIS, I have a custom text box GUI for the closeup options, and have this custom script for the regular dialogues at the bottom of the screen:
Code: ags
function dialog_options_get_dimensions(DialogOptionsRenderingInfo *info)
{
  if (GetGameOption(OPT_DIALOGOPTIONSGUI) != 2)
  {
  // Create a 200x200 dialog options area at (50,100)
  info.X = 0;
  info.Width = 640;
  info.Height = 43;
  // Enable alpha channel for the drawing surface
  info.HasAlphaChannel = true;
  }
}

function dialog_options_render(DialogOptionsRenderingInfo *info)
{
  if (GetGameOption(OPT_DIALOGOPTIONSGUI) != 2)
  {
  // Clear the area yellow
  info.Surface.Clear(16);
  int i = 1,  ypos = 0;
  // Render all the options that are enabled
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      if (info.ActiveOptionID == i) info.Surface.DrawingColor = 15;
      else info.Surface.DrawingColor = 17430;
      info.Surface.DrawStringWrapped(5, ypos, info.Width - 10, 
                         eFontFont3, eAlignLeft, info.DialogToRender.GetOptionText(i));
      ypos += GetTextHeight(info.DialogToRender.GetOptionText(i), eFontFont3, info.Width - 10);
    }
    i++;
  }
  }
}

function dialog_options_get_active(DialogOptionsRenderingInfo *info)
{
  if (GetGameOption(OPT_DIALOGOPTIONSGUI) != 2)
  {
  int i = 1,  ypos = 0;
  // Find the option that corresponds to where the player clicked
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      ypos += GetTextHeight(info.DialogToRender.GetOptionText(i), eFontFont3, info.Width - 10);
      if ((mouse.y - info.Y) < ypos)
      {
        info.ActiveOptionID = i;
        return;
      }
    }
    i++;
  }
  }
}

function dialog_options_mouse_click(DialogOptionsRenderingInfo *info, MouseButton button)
{
  // do something here if you want!
}


At this point in the game, it's just a matter of calling SetGameOption(OPT_DIALOGOPTIONSGUI, dialog GUI number)

Hope that helps!

Devoe

Thanks, gonna try with a rudimentary background.

That said, you're using a 640x480 resolution?

Devoe

It worked, thanks! I just worked a bit on making it 1920x1080 as I might want to work :) .

Grundislav

Yeah, I'm using 640x400.

Glad to hear it worked!

SMF spam blocked by CleanTalk