digress Posted January 15, 2014 Share Posted January 15, 2014 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); Quote Link to comment Share on other sites More sharing options...
Kiwi Posted January 15, 2014 Share Posted January 15, 2014 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. Quote Link to comment Share on other sites More sharing options...
digress Posted January 16, 2014 Author Share Posted January 16, 2014 Yeah I want a c language example of it's use. I'll try to figure it out in the meanwhile. right now it could save me a lot of sprite table space. Quote Link to comment Share on other sites More sharing options...
digress Posted January 16, 2014 Author Share Posted January 16, 2014 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 Quote Link to comment Share on other sites More sharing options...
Pixelboy Posted January 16, 2014 Share Posted January 16, 2014 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. Quote Link to comment Share on other sites More sharing options...
digress Posted January 16, 2014 Author Share Posted January 16, 2014 (edited) 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 January 16, 2014 by digress 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.