Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Knox

#501
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
Portrait_Counter = (Portrait_AnimSpeed + Portrait_vf.Speed + 1);
, 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

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);
}
#502
yeah I know...lol!

I cant test the tearing until I actually get my game advanced enough so it could actually tear (I dont have much oging on right now)...so for me I wont be able to give you any results until a good while..I just wanted to see if it did anything to the framerate by default, if that makes any sense  :P
#503
Yep! No errors once I place that dll in those folders...

For the tearing, my game hasnt done it yet so I cant really test to see if it prevents it...but so far my framerate hasnt changed with this plugin on.
#504
Hey Xenogia,

I just downloaded the dll directly, and copied it into my system32 and sysWOW64 folders:

http://www.dll-download-system.com/home/m-dlls-not-system-/msvcr100.dll/details.html
#505
Hey Calin,

Dont know if Im the only one but when I place your new dll version into my AGS folder, I get "MSVCR100D.dll" is missing + error loading "agsvsync.dll"

Ok I downloaded it and placed into my sys32/syswow folders.

Can this plugin diminish your fps?

Testing now :P
#506
ok, so its pretty much a waste of time then compressing files with external programs/plugins before importing them into AGS...

I guess then what's left for me to optimize, sprite wise, is the number of sprites :P
#507
ah crap, serious...

Well if I import a png thats 120kb, and one that is 60kb...doesnt AGS still compress both at a certain %...so the 120kb becomes (say) 60kb, and  the 60kb becomes 30kb...? So wouldnt it still be better to make sure the sprites are as small as possible before importing into AGS?

If I understand correctly then, if I import an uncompressed png (120kb), AGS will compress it as if I already did it manually with an external program (like png gauntlet)...and ends up, say, 60kb...so If I imported tha compressed png into AGS, that sprite wont be further compressed cause its already at its maximum compression...right?
#508
Sorry to re-open this old topic and Im not sure if this issue hasn't already been raised:

There seems to be problems with having semi-transparency on textGui's borders...It works with "magic pink" sprites and Im sure I can use 2 gui's to get a kinda hack going...but using png's with semi-transparent alpha's or alpha's that slowly fade out (like smooth shadows) seems wont work properly like other gui's do.

All I could find on this subject was this old topic, so Im wondering if this is a feature that will be added in a future release?

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=18767.0

If not, Ill probably have to do a "2 gui" hack (one over the other, the one under is the smooth alpha sprite and some how get it to match the varying length of the text box above it). (?)

#509
hmm interesting...I looked up lossless compression...

Well Ill just do it that way then, instead of trying to find a way to move smaller sprites inside views, etc...since the full-size sprite with 1 color in a large area is actually smaller than the small sprite, its not worth it to screw around trying to get the animation on a button.

Oh, I dont know if people are aware of this free program but it seems cool for optimizing png's:
http://benhollis.net/software/pnggauntlet/

Also, there's this plugin for photoshop (not free) that saves png's smaller than the photoshop's standard png plugin:
http://www.ardfry.com/png-plugin/
#510
Sorry for two posts one after the other but I noticed something in explorer and I was wondering if its a bug or not...look at these 3 images:





The smaller sprite (07.PNG) is 88x105, and its size is 22.0kb...but the one above it is way bigger but its smaller in size; 13.0 kb...

Why? If this is the case, then I think Ive solved the problem and Ill just make the sprites like the 2nd sprite, magic-pink all around the animated mouth area. I thought I was going to save in memory by reducing the animated sprites to a small area, but looks like its not the case !(?)
#511
Ah ok, too bad we didnt have that feature, could be really time saving! Imagine being able change a view's x,y position from within the view editor in relation to what its attached to! Has someone asked if we can add that in the next release? If not, I think I will!
Right now I just have sprites for the face, the rest is just a static image.

Ok, Ill look into what you suggested then for creating a button in the custom gui module...Im also using GuiPortrait that I already modified a bit to add a background behind the animated views so I can change character's clothes without having to make a gazillion animated sprites for each change :P

**EDIT**

Ok, well here is where I'm at...Ive got the "face" view animation appearing in the top left corner of the gui cause its directly drawn onto that surface (I think?)...Ive got the buttons setup, which later, will move depending on the character, but Ill get to that later. Also, Ive got a background gui behind everything that also appears under the view, and this gui's background image will also update when the other dialog partner talks...



What Im not sure how to do is how do I actually draw that view onto the button itself? Also, if I draw the view on the button, will the text move with it? Id like the text to be displayed off-set from the border of the portrait, not the button...if you look at the image up top, notice how the text box is close to the "face" view...of course if I make the "face view" the full size of  the actual portrait frame, it will be OK, but Im trying to avoid that to save sprite-size space.

Im guessing using btn.Animate, but Im not too sure how to modify the module further to get this to work. Here is what Ive got so far:

**ACL MODIFICATIONS are what I added.

Code: ags

// GuiPortrait module script 
//MODIFIED ACL 27/08/2010

function game_start() 
{
  gPortrait.Visible = false;
  Portrait_Sierra_Y = 57; 
  Portrait_Left_Indent = 20;
  Portrait_Right_Indent = 10; 
  Portrait_Counter = -1;
  Portrait_BlinkTimer = -1;
#ifdef PORTRAIT
  Portrait_GUI = gPortrait;
#endif
  BasePortrait_GUI = gBasePortrait; //ACL MODIFICATIONS
  BasePortrait_GUI.BackgroundGraphic = 1087; //ACL MODIFICATIONS
}

function DialogPartner(Character *dialogPartner2)
{
  partner = dialogPartner2;
}

function Portrait_DoFrame() 
{
  //this will eventually be a variable called from startDialog in DialogFunctions_ACL
  BasePortrait_GUI.BackgroundGraphic = iBasePortrait;  //ACL MODIFICATIONS
  //move the player's view in the right position onto face
  
  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)
    {
      if (partner == null)//means its a dialog with dispatch
      {
        if (Portrait_Last_Talker != null && this != Portrait_Last_Talker) Portrait_AtRight = this.x > Portrait_Last_Talker.x;
        else 
        {
          if (this.x < (System.ViewportWidth/2)) Portrait_AtRight = false;
          else Portrait_AtRight = true;
        }          
      }
      else
      {
        if (this.x <= partner.x) Portrait_AtRight = false;
        else if (this.x > partner.x) Portrait_AtRight = true;
      }
    } 
    else
    {
      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);
  else if (Portrait_AtRight == false) x = Portrait_Left_Indent; 
		
  Portrait_GUI.X = x;
  Portrait_GUI.Y = Portrait_Sierra_Y;
  
  BasePortrait_GUI.X = x; //ACL MODIFICATIONS
  BasePortrait_GUI.Y = Portrait_Sierra_Y; //ACL MODIFICATIONS 
  
  SetGameOption(OPT_PORTRAITPOSITION, Portrait_AtRight);
  
  BasePortrait_GUI.Visible = true; //ACL MODIFICATIONS 
  
  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_GUI.Visible = false; //ACL MODIFICATIONS 
  
  Portrait_GUI.Visible = false;
  SetGameOption(OPT_PORTRAITPOSITION, positioning);
  Portrait_Counter = -1;
  Portrait_BlinkTimer = -1;
}

#512
Hi guys,

Im not sure if this is a simple one, but seems to me it should be pretty easy.

I looked up view and viewframe but  I didnt seem to find the "x,y" property of a view. Right now Im showing a view over a gui for a custom portrait animation and Id like to change the view's position directly (not creating a new gui, and moving the gui)...is this possible?

The view in question is a series of sprites smaller than the base of the portrait so I dont have to use large sprites for parts that arent animating.

Hope this makes sense, if not I can clarify with pics.
#513
Well I wrote it nnow in a way that I save the resized sprite to a "buffer" sprite and keep that in memory until the item selected has changed, then, in that case, I redraw the sprite. I use t he saved resized sprite to do all my other overlays, so now its only a little slow on the first click of a new selection.

;D
#514
yeah...thats what I thought...well Ill see if I can somehow store it before changing the cursor and just update the sprite instead of redrawing + running that algorithm everytime :P
#515
0.5 seconds...heh, thats pretty approximate

The way Im using it now probably isnt a really good idea: Im using it for mouse cursors, so depending on what the mouse hovers over, I redraw the mouse cursor with various dynamic sprites....and using the module + plugin I get a slight delay to update the mouse cursor (like maybe .75 to 1.0 second...but I dont have a nano-second stopwatch or anything :P)

#516
Well if the module can be optimized by like .5 seconds, it would be worth it...if not, if someone was able/willing to convert Khris' bilinear filter into a plugin Im sure people like me would be willing to offer a reward (artwork, monies or sexual favors*)

*this part is not true
#517
QuoteUnfortunately, my module is pretty slow as it is without much room for optimization

Ok, so the module is pretty much as fast as it can get right now? If the bilinear filter was inside a plugin, it could be faster?
#518
Ok, Ill use this way then since you guys are already doing it this way!
#519
Actually you're right, it does work now...I must have generated another error for something else and fixed it since then...:P
#520
Say I have a function "void updateConfirmBox(int iSpriteTitle, int iSpriteQuestion)"

If this function is kept in my global script, when I start typing the function and add the parenthesis, autocomplete gives me a pop-up of what goes inside "(int iSpriteTitle, int iSpriteQuestion)"...

However, if I place the function in another script and import it into the .ash, I have to write it like this:
Code: ags

import void updateConfirmBox(int, int);


If I try to include the int's name, Ill get an error...so how do I write it in the .ash so I dont get an error--->
Code: ags
(cannot define body of imported function)


Id like it when Autocomplete shows me a pop-up of what goes inside the parenthesis, it doesnt just show "(int, int)", but "(int iSpriteTitle, int iSpriteQuestion)"?

SMF spam blocked by CleanTalk