Language…
2 users online: Alby64World, misha_topor - Guests: 1,068 - Bots: 99
Users: 67,679 (2,003 active)
Latest user: Saya

Displaying a Permanent, Animated Sprite

Hey there everyone. I need a little help with Extended Sprites. First of all the definition.

Am I getting it right that an Extended Sprite is a sprite that is not in the any of the foure SP graphic packs? So for example Mario, Mario's cape and Yoshi are Extended Sprites? And if that's it, then how do you display Extended Sprites? I mean I know the one or other thing about regular sprites and know how to make and display them (at least with the help of sprite tool), but I don't know anything about how to use Extended Sprites, but if they are what I think they are then they are exactly what I need.

Hope you can help me and thanks.
Feel free to visit my website/blog - it's updated rarely, but it looks pretty cool!
My knowledge is limited, but:

Extended sprites are like mario's fireball and the shattered block rocks. They have their own tables and whatnot. They're different from regular sprites in that they have far less code associated with them. They still use the OAM (every sprite has to, from bounce blocks to cluster sprites).


As for mario, I do not know how he works. I *think* the game uses the same concept as exanimation; mario's tiles are in the regular sprite pages (where "nintendo presents" and the empty box with an x in it is), but they're updated with different tiles when he's supposed to animate. I very well could be wrong though.
So that's what that is. So I guess it's after all different from what I thought.

Well then lets change the question a bit to make it more exact: I want to add a sword to the game as a weapon. The main weapon to be exact. Of course that means that the sword has to be present on each map and of course it would be nice to lose as few other sprites for that as possible. The sword has different "poses" (depending on the hero's pose) as well, so I guess I'll have to use exanimation here as well, if I want to use the same method as is used for Mario? Or lets just ask the question like this: What would be the best way of displaying that sword?
Feel free to visit my website/blog - it's updated rarely, but it looks pretty cool!
For this sword, use the exanimation/dynamic style of doing this for a few reasons:

-it's the main weapon, it's going to be on screen alot, you don't want to remove a large amount of tiles from your regular sprite pages to use it
-I am guessing only 1 sword will be on screen at a time for the player, it means you only have to reserve enough space in vram to fit a single frame of it, then just swap out the tiles as required.

If the sword was 16x16 for example, you just reserve 16x16 of space in vram, update it using some custom code each frame to change the tiles there. You implement something similar to mario pose which chooses which tiles from some file in ROM, then sends it to vram at your special reserved spot. In OAM then you just reference the same OAM tile # every frame but because you are changing the tile graphics itself, it will animate as normal.
By display, do you mean spawn?
Your layout has been removed.
@The Ghostly Kirby : Well, by display I mean "make it so that the sword is there when I need it".

@smkdan : Oh, so let me sum this up to see if I got everything right. So I have to

-Clear as many tiles on my sprite GFX pages (=in VRAM) as needed for one sword graphic (so in this case I guess it would be four, I don't think my sword is ever bigger then four tiles)
-Make a routine that checks the hero's pose and then depending on that writes the correct sword graphics to the locations in VRAM I "cleared" before
-Make a routine that handles the OAM stuff, while always using the same OAM location and the same VRAM tiles (so basically everything I've got to do is changing the offsets, I guess with a table?)

This should be more or less the way it goes, right? And the when I've got the sword in the game it acts just the same as a sprite that I've with sprite tool?
Feel free to visit my website/blog - it's updated rarely, but it looks pretty cool!
Well if you use it with sprite tool it'll use the regular sprite tables (and cut your available sprites on the screen by 1). Since it's always active it'd probably be best (though not easy) if you create your own independent routine specifically for this sprite. You could hijack something that's run every frame and do all your calculations yourself.

But if you're not worried about efficiency or anything then using a regular sprite tool inserted sprite can work fine.
Well I'm not going to do it with sprite tool anyways. Probably I should have asked the question differently: Do the sprites I display this way work similiar to the sprites I make for sprite tool, like, for example, with contact routines or graphics or whatever? Or do I have to completely "relearn" the basics of working with sprites? Well I hope you get my question. It's a bit hard to express :P . Probably this question is better: How big is the difference between sprites inserted manually and sprites made for sprite tool?
Feel free to visit my website/blog - it's updated rarely, but it looks pretty cool!
There's no huge difference. You'll have to write your own contact routine. You'll have to keep track of the sprite's x/y yourself, and do your own speed calculations, ect ect ect.

The graphics routine is particular isn't different at all. You'll want to have a dedicated section of the OAM for your sword so there won't be any checking for free slots. Just write your tile data and it'll show.
Quote
-Clear as many tiles on my sprite GFX pages (=in VRAM) as needed for one sword graphic (so in this case I guess it would be four, I don't think my sword is ever bigger then four tiles)
-Make a routine that checks the hero's pose and then depending on that writes the correct sword graphics to the locations in VRAM I "cleared" before
-Make a routine that handles the OAM stuff, while always using the same OAM location and the same VRAM tiles (so basically everything I've got to do is changing the offsets, I guess with a table?)


yeah, but for the first point it doesn't really matter what is originally there, it's going to be erased by your code. Like it does with the "Nintendo Presents" graphics originally in the game. That graphic is trashed when the game uploads mario's graphics.

edit: reread post, interepreted 'clear' as in 'erase the tile data at the space' I am guessing you just meant reserving the space for use with this.

With spritetool it automatically calls the sprite when needed, has tables set out for you, interaction routines in place for interaction wiht other sprites. You have to do a little more code to get it working in non-spritetool code, but it does free up a slot.
There should be a rule against having "how to" in a title when the thread is actually a question.
Originally posted by smkdan
reread post, interepreted 'clear' as in 'erase the tile data at the space' I am guessing you just meant reserving the space for use with this.


Yeah, I meant "reserve". Well since I can't use those slots for other sprites I thought I might as well call it "clear".

Originally posted by Smallhaunter
There should be a rule against having "how to" in a title when the thread is actually a question.


Well is "how to" not an indication for a question :P ? Anyways I changed the thread title to fit the content of this thread more.

OK, now I have another question concerning the OAM and sprite priority. In another thread (it was already some time agao) I read something about sprite priority and what determines it. If I remember correctly, then it depends on the order of the sprites in OAM. I'm not very familiar with SMW's OAM, though. Can anyone suggest me a good OAM location for a sprite that goes in front of Mario?
Feel free to visit my website/blog - it's updated rarely, but it looks pretty cool!
provided the RAM map is right on this:

Quote
$7E:0200 544 bytes I/O OAM. $0310-$0313 is for Mario's upper tile, $0314-$0317 for Mario's lower tile.


Order tiles are stored here defines the priority on screen between them. i.e. the tile in $200-$203 will appear above mario, the tile in $3FC-$3FF will not.
Originally posted by Satan
Well is "how to" not an indication for a question :P ?


No. "How to" means "This is how you...", not "How do I...?"

</offtopic>
@smkdan : OK, thanks :) ! Only one last question: Do you know of a good way to check which of the OAM mostly remains unused and which doesn't?

@Smallhacker : OK, you've got a point there :| . I guess my Engrish is just too broken.
Feel free to visit my website/blog - it's updated rarely, but it looks pretty cool!
You could use a debugger, such as SNES9x debugger.
Check if each second byte of each OAM slot if F0 - since if it is, that means the OAM slot is free ; it isn't supposed to be displayed.
I used parts of the OAM, such as $0240-$025F, $0280-$028F and $02B0-$02DF for the spike hell sprite. I can't guarantee these aren't used by other sprites, however. Normal sprites don't use them, that's for sure, but there is a small chance the parts of OAM I mentioned are used by a number of extended sprites.
--------> Don't follow "Find Roy's Dignity", my hack. Because it's pretty outdated. <--------