Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cooming 2013: "Yumiko in the haunted Mansion"
#33
britlion Wrote:
LCD Wrote:but if you managed to get a routine that calculates some masks automatically (this is usually not possible, I guess) and invert them (e.g. at the beginning of each game level, or whatever) you will save a lot of memory. I've always wanted something like this :roll:

Hmm. You know, I sort of wrote that code once or twice. Once in a routine I never got to work, trying to do automatic proportional printing for any font. And once in the random functions I put in the library...

The basic idea is to take the left hand side, and rotate until a bit drops into carry, counting how many rotates. Then you know how many pixels wide the mask is for that byte. Left hand side rotates left, right hand side rotates right - and it's reasonable to assume that you don't want to mask between the extremes of pixels, since that's sprite.

Not particularly fast, but if you're decompressing material for use, then this would work in most cases...


From the random code (imagine this is left side, and your sprite byte arrived in A):
Code:
LD C,255
    randomBinLoop:
    RLA
    JR C, randomBinLoopExit
    RR C
    JR randomBinLoop ; LOOP back UNTIL we find a bit.
    randomBinLoopExit:

Of course, this is rotating C the wrong way to be a graphics mask - I wanted to mask the active bits, not the missing ones, here.
Not a bad idea after all. This would save a lot of memory, especialy if the graphics is compressed.
Before my father died, I already made Aplib compression for DEFB's in BorIDE, and lot more, so decompression of graphics and autogenerating mask could be great for simple sprites. Bigger and more complex sprites on the other side, won't be suitable for automasking.
Anyway, I want to add Masking ability in BorIDE's Painter later.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)