Hi,
I modified the guiPortrait module a bit and I was wondering if someone had an idea on how to add the speed for blink frames...right now this is ignored, so if I place a delay of 40 on a certain blink frame, the animation ignores it completly. SSH is currently too busy to help me out with this so Ive been trying on my own for a while now...and well...I suck! heheh
I think I have to do something with the ".Speed" command, but Im not too sure how to implement it. To test, if I remove the "Portrait_vf.Speed" part in these lines:Code: ags , the script no longer takes into account the delays in the speech views either, so I believe somehow I need to do something like that, but for the blinking (which I really dont know how to proceed, Ive been trying all night...
)
Code: ags
I modified the guiPortrait module a bit and I was wondering if someone had an idea on how to add the speed for blink frames...right now this is ignored, so if I place a delay of 40 on a certain blink frame, the animation ignores it completly. SSH is currently too busy to help me out with this so Ive been trying on my own for a while now...and well...I suck! heheh
I think I have to do something with the ".Speed" command, but Im not too sure how to implement it. To test, if I remove the "Portrait_vf.Speed" part in these lines:
Portrait_Counter = (Portrait_AnimSpeed + Portrait_vf.Speed + 1);

function Portrait_DoFrame()
{
Portrait_vf = Game.GetViewFrame(Portrait_View, Portrait_Loop, Portrait_Frame);
bool flip = Portrait_vf.Flipped;
// Something like:
if (Portrait_AutoFlip && Portrait_AtRight) flip =! flip;
Portrait_Mod = DynamicSprite.CreateFromExistingSprite(Portrait_vf.Graphic, true);
if (Portrait_BlinkTimer == 0)
{
DrawingSurface *mod = Portrait_Mod.GetDrawingSurface();
Portrait_bvf = Game.GetViewFrame(Portrait_BlinkView, Portrait_BlinkLoop, Portrait_BlinkFrame);
mod.DrawImage(0, 0, Portrait_bvf.Graphic);
mod.Release();
Portrait_BlinkFrame++;
if (Portrait_BlinkFrame == Game.GetFrameCountForLoop(Portrait_BlinkView, Portrait_BlinkLoop))
{
Portrait_BlinkTimer = Portrait_BlinkInterval;
Portrait_BlinkFrame = 0;
}
}
// Flip AFTER blink, if required
if (flip) Portrait_Mod.Flip(eFlipLeftToRight);
Portrait_GUI.BackgroundGraphic = Portrait_Mod.Graphic;
}
function repeatedly_execute_always()
{
if (Portrait_Counter == 0)
{
Portrait_Frame++;
if (Portrait_Frame == Game.GetFrameCountForLoop(Portrait_View, Portrait_Loop)) Portrait_Frame = 0;
Portrait_DoFrame();
Portrait_Counter = (Portrait_AnimSpeed + Portrait_vf.Speed + 1);
}
else if (Portrait_Counter >= 0) Portrait_Counter--;
if (Portrait_BlinkTimer > 0) Portrait_BlinkTimer--;
}
// TBD: Animate
// Check for flipped frames
// Blinking: goes on top of speech view
function GSay(this Character*, String what, int view, int loop)
{
if (view < 1) view = this.SpeechView;
Portrait_Frame = 0;
Portrait_Loop = loop;
Portrait_View = view;
Portrait_AnimSpeed = this.SpeechAnimationDelay;
int positioning = GetGameOption(OPT_PORTRAITPOSITION);
int x;
//Left
if (positioning == 0) Portrait_AtRight = false;
//Right
else if (positioning == 1) Portrait_AtRight = true;
//Alternate
else if (positioning == 2)
{
if (this != Portrait_Last_Talker) Portrait_AtRight =! Portrait_AtRight;
}
// Based on Character Position Relation to the Main Player
else
{
if (this == player)
{
player.SetupCharacterPortrait(playerFaceAnim, playerClothes, playerProp);
if (BasePortrait_BASE.BackgroundGraphic != 372) BasePortrait_BASE.BackgroundGraphic = 372;
if (this.x <= partner.x) Portrait_AtRight = false;
else if (this.x > partner.x) Portrait_AtRight = true;
}
else if (this == partner)
{
//Display("Partner's Clothes being st to: %d", partnerClothes);
partner.SetupCharacterPortrait(partnerFaceAnim, partnerClothes, partnerProp);
if (partner == cDispatcherA) BasePortrait_BASE.BackgroundGraphic = 1105;
else if (BasePortrait_BASE.BackgroundGraphic != 372) BasePortrait_BASE.BackgroundGraphic = 372;
if (this.x >= player.x) Portrait_AtRight = true;
else if (this.x < player.x)Portrait_AtRight = false;
}
}
Portrait_DoFrame();
if (Portrait_AtRight == true)
{
x = (System.ViewportWidth - Game.SpriteWidth[Portrait_vf.Graphic] - Portrait_Right_Indent);
BasePortrait_FRAME.X = x;
if (this == player)
{
BasePortrait_PLAYERCLOTHES.X = x;
BasePortrait_PLAYERPROPS.X = x;
}
else if (this == partner)
{
BasePortrait_PARTNERCLOTHES.X = x;
BasePortrait_PARTNERPROPS.X = x;
}
}
else if (Portrait_AtRight == false)
{
x = Portrait_Left_Indent;
BasePortrait_FRAME.X = Portrait_Left_Indent;
if (this == player)
{
BasePortrait_PLAYERCLOTHES.X = Portrait_Left_Indent;
BasePortrait_PLAYERPROPS.X = Portrait_Left_Indent;
}
else if (this == partner)
{
BasePortrait_PARTNERCLOTHES.X = Portrait_Left_Indent;
BasePortrait_PARTNERPROPS.X = Portrait_Left_Indent;
}
}
Portrait_GUI.X = x;
Portrait_GUI.Y = Portrait_Sierra_Y;
BasePortrait_BASE.X = x; //ACL MODIFICATIONS
BasePortrait_BASE.Y = Portrait_Sierra_Y; //ACL MODIFICATIONS
SetGameOption(OPT_PORTRAITPOSITION, Portrait_AtRight);
BasePortrait_BASE.Visible = true;
if(BasePortrait_BASE.BackgroundGraphic == 1105 )
{
BasePortrait_BASE.LockView(19);
BasePortrait_BASE.Animate(0, 5, eRepeat, eNoBlock);
}
else BasePortrait_BASE.UnlockView(false);
BasePortrait_FRAME.Visible = true;
if (this == player)
{
BasePortrait_PLAYERCLOTHES.Visible = true;
BasePortrait_PLAYERPROPS.Visible = true;
}
else if (this == partner)
{
BasePortrait_PARTNERCLOTHES.Visible = true;
BasePortrait_PARTNERPROPS.Visible = true;
}
Portrait_GUI.Visible = true;
Portrait_Counter = (Portrait_AnimSpeed + Portrait_vf.Speed + 1);
if (this.BlinkView > 0)
{
Portrait_BlinkTimer = this.BlinkInterval;
Portrait_BlinkInterval = this.BlinkInterval;
Portrait_BlinkView = this.BlinkView;
Portrait_BlinkLoop = 0;
Portrait_BlinkFrame = 0;
}
else Portrait_BlinkTimer = -1;
this.Say(what);
BasePortrait_BASE.Visible = false;
BasePortrait_FRAME.Visible = false;
if (this == player)
{
BasePortrait_PLAYERCLOTHES.Visible = false;
BasePortrait_PLAYERPROPS.Visible = false;
}
else if (this == partner)
{
BasePortrait_PARTNERCLOTHES.Visible = false;
BasePortrait_PARTNERPROPS.Visible = false;
}
Portrait_GUI.Visible = false;
SetGameOption(OPT_PORTRAITPOSITION, positioning);
Portrait_Counter = -1;
Portrait_BlinkTimer = -1;
player.SetupCharacterPortrait(playerFaceAnim, playerClothes, playerProp);
}