Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
1 user currently in Rom Hacking: |
Acmlm's Board - I2 Archive - Rom Hacking - TSA / Sprite data? | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
crusher Newcomer Level: 5 Posts: 2/7 EXP: 449 For next: 80 Since: 03-23-04 From: Sweden Since last post: 13 days Last activity: 1 day |
| ||
Heya people! I need help once again. I'm the guy who's working on a Ufouria level editor. I'm trying to find out how to read the sprite data directly from the NES ROM. I've read Vagla's The Art of ROM Hacking and I think I got the idea behind TSA. But I still can't find anything usefull. Either I just suck (most likely) or it uses some weird format... Anyways, can you people please give me some guidelines to find this data or some documents (except TAoRH) that can help me? Oh and here is the latest screen of my editor. The sprites are at the moment, stored in external images. One sprite equels one image. And it will be way too many images if I do it that way. :\ Thank you people! |
|||
Gavin Fuzzy Rhinoceruses don't play games. They fucking charge your ass. Level: 43 Posts: 88/799 EXP: 551711 For next: 13335 Since: 03-15-04 From: IL, USA Since last post: 13 hours Last activity: 13 hours |
| ||
Vagla seems to have figured everything out, nice and orderly like, and he wanted to lend a hand. so here you are: "Okay, well, I decided to take a look into the game for you, and here's what I figured out. Ufouria has a weird format that basically makes a single sprite frame out of multiple frames. Each of these frame sets can have an absolute minimum of 6 bytes, but depending on how many tiles you need and how many additional frames you need in each sprite, it could be much more. Also, Ufouria uses the 8x16 tile mode, so each byte will define 8x16 pixels as opposed to the usual 8x8 tiles (I'm sorry I didn't mention this in my document under the sprite TSA section, but there is a little bit about it in the dictionary under 8x16 Sprite Mode). As for how that works, an even byte will grab tiles from the left table, and an odd byte will grab them from the right table. 20 would get 40 and 41 from the left table; 41 would get 40 and 41 from the right table. 78 would get 78 and 79 from the left, 79 would get 78 and 79 from the right, etc. Simple as that. No matter what, though, it uses the 4 sprite palettes, and thus obviously can't use background palettes, just like normal sprites. Anyway, for Ufouria's sprite TSA setup, here's the basic format: At the beginning of each frame set, you have a byte which tells the game how many frames are in the current frame set. In many cases, this will simply be 01, but sometimes you'll need more frames, so then it could be 02 or 03 or what-have-you. The data for each frame in the frame set begins after this first byte, and is 5 bytes in size, minimum. First, there's a byte which says how many 8x16 tiles will be in the current frame. For your standard 16x16 pixel sprites, this is usually going to be 02. Then comes 2 bytes that define the frame's xx and yy offsets, in that order. This is mostly useful for other frames in the current frame set, as far as I know. Then comes the attributes byte, which follows the format yxz000pp where y is vertical mirroring, x is horizontal mirroring, z is the background priority (set it if you want the frame behind the background), the 0's are unused, and pp is the sprite palette (00, 01, 02, or 03). Finally comes the tile ID set, the length of which is defined by the first byte in the frame. If that byte is 01, then there is one tile ID to define, so the tile ID set is only 1 byte long (if 02, then 2 bytes, if 05, then 5 bytes, etc). For your standard 16x16 enemies, there will likely be 2 tile IDs here. Now, if the amount of frames in the current frame set is greater than 01, then you simply make another frame after the end of the previous frame, using the same format, and after all of the frames are done, there is a new "frame" set byte. Pretty simple. [To sum it up more quickly, you first have the "Frames in Frame Set" byte, and then one or more frames following this format: number of 8x16 tiles in frame, XX coordinate offset, YY corrdinate offset, Attributes, and Tile ID set (where the set is as many bytes long as the first byte in the frame's data defined)] The reason you might need additional frames in a frame set is illustrated by that one moving platform by the very start of the game that opens its eyes when you stand on it and carries you over the water. See, in the pattern tables, you'll notice that there is no mirrored version of that sprite's eye; there is simply the 8x16 tile for its left eye. So, if you want to have a right eye for that sprite, you'll need to create a second frame. You can not mirror individual tiles inside of a frame of more than one tile in size, so you can't just have all 3 of that sprite's 8x16 tiles in a single frame where the first 2 have an attribute byte of 02 and the third has an attribute byte of 42 (42 would mean mirror horizontally and use the 3rd sprite palette). What has to be done, then, is have the first 2 tiles in their own frame and then the third tile in a seperate frame which is mirrored horizontally. That way, the mirroring works perfectly. Also, extra frames in a frame set could (in theory; I haven't looked at any of the sprites that are more than 16 pixels tall) be used to add tiles to the top or bottom of a sprite; that's what the xx and yy offset bytes are for. Anyway, here are a couple sprite frame set locations to help you out (all are with the .nes ROM header): B178- Small hooded enemy's walking frame #1 (7 bytes long, 1 frame in set) B17F- Small hooded enemy's walking frame #2 (7 bytes long, 1 frame in set) B186- Small hooded enemy's walking frame #3 (7 bytes long, 1 frame in set) B18D- Small hooded enemy's crushed frame (7 bytes long, 1 frame in set) B0C0- Moving platform with eyes near the start, eyes closed (12 bytes long, 2 frames in set) B88C- Moving platform with eyes near the start, eyes open (12 bytes long, 2 frames in set) Finding sprite frames is pretty easy. Do a search for whichever palette it is that the sprite is using (00, 01, 02, or 03) and then 2 or so of the sprite IDs, from left to right. If that doesn't work, try other kinds of searches (you'll probably find other methods when you're familiar with the format). *shrugs* There's still other data that you need to find, I'm pretty sure, such as the data which says what frame sets to use for each sprite, where each frame set begins, etc, but hopefully this is a good start for you. If you have any questions, feel free to ask, but I encourage you to try fiddling around with the data first. Here's a little something to try for fun: change B17C to 000D1D, B183 to 000111, B18A to 000515, and B191 to 004B5B. That'll change the little enemies you encounter at the start (the hooded ones) into your own head, though it will look a little odd when you jump because the first graphics page (tiles 00-3F on the right pattern table) will change while you're jumping, as well as crawling and getting hurt. But anyway, just toy around with it. Hope that helps. -Vagla" (edited by Gavin on 07-12-04 09:21 PM) (edited by Gavin on 07-12-04 09:22 PM) (edited by Gavin on 07-12-04 09:25 PM) (edited by Gavin on 07-12-04 09:29 PM) |
|||
crusher Newcomer Level: 5 Posts: 3/7 EXP: 449 For next: 80 Since: 03-23-04 From: Sweden Since last post: 13 days Last activity: 1 day |
| ||
Thank you so much Vagla! As you said this is a good start for me. A VERY good start. Now I'm gonna try to understand the format fully then I'll make a small app that reads the data and shows the sprite. Heh, changing those enemies into your head certainly looks weird. Ah the wonders of ROM hacking. ^^ Again thanks Vagla. You are my hero. And thanks Gavin for posting his reply! (edited by crusher on 07-13-04 05:18 AM) |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Rom Hacking - TSA / Sprite data? | | | |