gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Sprite rotation

#46097 - whodoo - Mon Jun 20, 2005 12:55 am

How is the rotationdata stored for a sprite? I know that a sprite uses 4 "attribute3"-variables to keep track of the rotation, but which ones?

What I mean is, is sprite0 always associated with the attribute3 in sprite 0,1,2,3, and sprite 4 is associated with attribute3 in sprite 4,5,6,7 (which mean that only sprite0, sprite4, sprite8, sprite12 ... can be rotated/scaled), or is every sprite just depending on the following 4 attribute3s? (which mean that sprite number 7 could use sprite 7,8,9,10's attribute3 to store rotation data), so I can make a arbitrary sprite rotate?

#46098 - DekuTree64 - Mon Jun 20, 2005 1:00 am

It's selected by a field in the sprite's attribute1 (bits 9-13). Basically you have 32 sets of rotation parameters, and each sprite can select which one to use.

If you want it to use rotation data set 5 (attr3 of sprites 20-23), you'd do like
Code:
sprite.attr1 = stuff | (5 << 9);

_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#46113 - whodoo - Mon Jun 20, 2005 12:44 pm

thanks..so the "begining of the rotation-info" must allways be stored at spriteK, where K is a multiple of 4?