MODULE: DistortChar v1.0: Scale/other distortions on all frames of a character

Started by SSH, Fri 06/03/2009 12:01:42

Previous topic - Next topic

SSH

Following on from the discussion in this thread I've created a module that you can use to scale all the sprites for a character, or to apply various other "distortions" to the sprites instead.

Needs: AGS 3.1.2 (but might work with earlier ones from 3.0 on, try it and see!)

Documentation
Download
12

Joe

Copinstar © Oficial Site

GarageGothic

Interesting approach to store and re-use the DynamicSprites once rendered. I employ a lot of similar effects in my scripts but always generate them on a loop by loop basis, which of course impairs the framerate if overused (though often necessary for dynamic shadows and lightmap tinting). Have you run any tests on how the module affects memory overhead and savegame size?

SSH

Nope!

It's a shame that you can't generate dynamic arrays of Dynamic Sprite pointers, as that's what I'd prefer (or what might be best was if all sprite numbers inside AGS were actually pointers so you could set the pointer to the dynamic sprite so that it would still have a global reference and not need to worry about it getting garbage-collected.)
12

monkey0506

Quote from: SSH on Fri 06/03/2009 12:41:40It's a shame that you can't generate dynamic arrays of Dynamic Sprite pointers, as that's what I'd prefer

Yes you can. In fact if it makes you more comfortable you can even write your own alloc/free functions:

Code: ags
DynamicSprite *Sprites[];
int SpriteCount = 0;

void spr_free() {
  SpriteCount = 0;
  Sprites = null;
}

void spr_alloc(int count) {
  if ((count <= 0) || (count > 1000000)) {
    spr_free();
    return;
  }
  SpriteCount = count;
  Sprites = new DynamicSprite[count];
}


Just tested that and it runs perfectly.

SSH

Oh! The manual says that you can't make dynamic arrays of managed types...
12

monkey0506

That's rather silly considering it's only the basic data and the managed types you can make dynamic arrays of...hmmm...

Contents>Scripting>Dynamic Arrays
QuoteAlso, at present you can create arrays of basic types (int, char, etc) and of built-in types (String, Character, etc) but not of custom structs.

Where does it say you can't use managed types?

SSH

12

Joe

Copinstar © Oficial Site

SSH

12

Joe

Really don't know what can I do with a pointer, either what pointer means...

I've heard that word many times when I received programming lessons, but never understood it, so what's it?
Copinstar © Oficial Site

monkey0506

Well Joe, this is the best way I have of explaining that.

And SSH, I just wanted to let you know how stoked I am to hear that I'm not the only one who goes into cerebral arrest writing these modules sometimes...

SMF spam blocked by CleanTalk