Jump to content
IGNORED

rotate_90 how do I rotate a sprite pattern?


digress

Recommended Posts

I am attempting to use the rotate_90 routine to rotate this sprite.

 

sprites[0].pattern = (0*4);

 

 

 

 

What is the code if I intitialized the sprite patterns from these 2 lines

 

put_vram (sprgen,sprites_init,sizeof(sprites_init));
/* Upload sprite patterns */
rle2vram (sprite_patterns,sprtab);

 

also is this permanently rotating the sprite pattern in memory or only this instance of it. In other words do I have to un rotate it to get if my character is again moving in the intitial direction.

 

Thanks

 

 

 

 

 

 

/* Rotate clockwise N times 8 bytes of pattern */

/* table_code : 0 = sprite_name, 1 = sprite_generator, 2 = name (screen), 3 = pattern, 4 = color */

void rotate_90 (byte table_code, unsigned source, unsigned destination, unsigned count);

 

 

Link to comment
Share on other sites

I do wish there is a working code that demonstrate how to use the BIOS function. Computer Space there is 16 sprites of the ship rotation plus 32 more for the thrust animation. I tried reflect horizonial routines for Pong, but the instruction doesn't make sense even in the official Colecovision programmer manual it was hard to understand. So, I wrote a routine that split the byte into 8 bytes, and then reorder them, then put 8 byte back to 1 byte. I used that for Deluxe version of the sports game so I don't have to keep mirrored copy on ROM. I just run the routine as soon as the person select the game. The pletter compression routine along with the sprite mirror and copy routine took less of a second until it goes to the game screen.

Link to comment
Share on other sites

 

I got it working. works great but only on 8x8 sprite size.

 

now I need to develop an algorithm to rotate the whole 16 x 16 sprite I intended

 

this will save an enormous amount of graphics table room

So the "unsigned source" and "unsigned destination" parameters are addresses in RAM, I gather? Also, if it only works on 8x8 sprites, what is the "unsigned count" parameter for?

 

I've never tried the rotate_90 function, as you might have guessed. :)

Link to comment
Share on other sites

I have just now successfully rotated a 16 x 16 sprite using this technique and a little algorithm. This will also work for the mirror horizontal & vertical.

 

 

Unsigned source is the 8x8 sprite you are copying from

Unsigned destination is the 8x8 sprite you are write the newly rotated pattern to.

 

unsigned count is how many consecutive 8x8 sprites to rotated by 90 degrees from the starting sprite inclusive

 

 

 

 

I'm going to be able to use 5 sprites table positions to display over 16 rotation points for the object and more if I flip it horizontally & vertically.

 

5 = 4 original sprite drawings at 4 different angles + 1 sprite to use for drawing any other sprite based on the rotation operation

 

This is going to help my project significantly.

Edited by digress
  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...