I'm running into some trouble with my current project and I think it's an AGS quirk. I created a simple test case for it and it seems to be reproducible outside of my game. The problem is that the default .Say() command right aligns text to about 70 pixels from the right, regardless of the size of the speech view. Here are a couple of demonstrative screenshots from my testing project:
(http://i.imgur.com/pBcGIUh.png)
(http://i.imgur.com/BiUzKbe.png)
To reproduce, create a blank project and set the speech style to "SierraWithBackground", create a speech view for Roger (e.g. the cup) and ensure this code gets run:
SetGameOption(OPT_PORTRAITPOSITION, 0);
cEgo.Say("Test left");
SetGameOption(OPT_PORTRAITPOSITION, 1);
cEgo.Say("Test right");
Now, I could be wrong, but I suspect it's a bug/quirk/limitation of AGS. I'd like to know if I'm missing something here and/or I just don't understand how left and right alignment should work. If I've misinterpreted things, please ignore this little section below.
Spoiler
Tinkering as I do, I was able to fix the problem by changing line 2283-2284 of character.cpp from:
if (bwidth < 0)
bwidth = scrnwid/2 + scrnwid/4;
To:
if (bwidth < 0)
bwidth = scrnwid;
This has the side effect that the maximum width of a .Say() speech box is the width of the screen, not 3/4 of the screen, but it fixes an issue later on where "bwidth" is used to determine the auto-sized position of the speech box.
There are several checks later in the code that sanitise the value of bwidth to ensure it has adequate margins from the edge of the screen. Part of the reason why this issue couldn't just be fixed by adding scrnwid/4 to the x-position of the speech box.