~rabbits/public-inbox

3 2

varvara screen auto x/y for sprites

Details
Message ID
<36cb43b1-7eab-4065-be2c-caff11b51bc7@app.fastmail.com>
DKIM signature
pass
Download raw message
Hello,

I'm currently implementing varvara's screen in Dusk OS and I'm confused by
this part of screen.c:

    dx = (d->dat[0x6] & 0x01) << 3;
    dy = (d->dat[0x6] & 0x02) << 2;
    [...]
    screen_blit(&uxn_screen, layer, x + dy * i, y + dx * i, [...]

So, dx is properly set to 8 when the X auto flag is set, dy is also set to 8
when the Y auto flag is set... but dx is applied to y and dy is applied to x.

Even more puzzling is that examples roms seem to... go along with it and use
inverted X/Y auto flag for sprites (because for pixels, the behavior is
correct).

Am I missing something? Did I misread documentation? I'd submit a patch, but it
would probably break a whole lot of existing programs.

I tried to search the mailing list for this subject but didn't find anything.

Regards,
Virgil
Details
Message ID
<CAKis=aEaW7YWd2bSNue9kn9Wqv9MT0-6uvQsTLTv4Letx=9EgA@mail.gmail.com>
In-Reply-To
<36cb43b1-7eab-4065-be2c-caff11b51bc7@app.fastmail.com> (view parent)
DKIM signature
pass
Download raw message
Ah! yes, it's kind of odd. I should really make a sort of illustration
that explains this one.

So, imagine a single sprite(8x8 pixels), with auto-x, would move to
the tile at its right. Now imagine we do the same thing with auto-x,
but with a size value in the high nibble of 3(#21).

https://assets.merveilles.town/media_attachments/files/109/536/783/001/064/529/original/8cd98831ab435b8c.png

We'd move to its right, but we're painting 3 extra tiles vertically each time.

Does that make sense?
Details
Message ID
<CAKis=aErWfw9+d7tE=jxrA7kQ6OEtHpH19pmqhofAbeC2-0MLg@mail.gmail.com>
In-Reply-To
<CAKis=aEaW7YWd2bSNue9kn9Wqv9MT0-6uvQsTLTv4Letx=9EgA@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
I meant to write (#31) in there, sorry.

I have also found a graphics for the NeoGeo that explains this somewhat:

https://wiki.neogeodev.org/images/e/e7/Mutnatsprite.png
Details
Message ID
<71fc03db-d774-4cf3-8442-539a3ab38552@app.fastmail.com>
In-Reply-To
<CAKis=aErWfw9+d7tE=jxrA7kQ6OEtHpH19pmqhofAbeC2-0MLg@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
On Sun, Dec 18, 2022, at 4:28 PM, Hundred Rabbits wrote:
> I meant to write (#31) in there, sorry.
>
> I have also found a graphics for the NeoGeo that explains this somewhat:
>
> https://wiki.neogeodev.org/images/e/e7/Mutnatsprite.png

Oh, I get it now, thanks. It would indeed help to at least mention that auto x/y
are inverted in the "length" loop, but it would be even better with an image
such as the one you've just linked. It helps a lot.

Regards,
Virgil
Reply to thread Export thread (mbox)