Pages: 1
RicBent |
Posted on 08-06-15, 05:14 pm (rev. 13 by ImageBot on 11-21-16, 03:16 am)
|
Mariomaster
Karma: 8573 Posts: 486/1681 Since: 06-09-12 |
Warning: You shouldn't try this "tutorial" if you don't have some basic ASM hacking/C++ knowledge. This is also very basic and only explains the important parts to make it work. If you have any questions feel free to ask
Dirbaio made an ASM hack for the Comunity Remix, allowing custom tileset animations. If you don't know what I am talking about look the beneath video (I'm not talking about custom tile behaviors). It works like the lava or conveyor animations in the castle tileset. On IRC I asked him how it works and how to get it to work. So this is what this thread is about. First of all the code: #include "nsmb.h"
int frame = 1;
u16* charPtr = NULL;
u16* animationFile = NULL;
int *tileset1ID = (int*)(0x020CACBC);
void copy8Tile(int dn, int sn)
{
u16* destPtr = charPtr + dn * (8 * 8 / 2) + (256 * 48 / 2);
u16* srcPtr = animationFile + sn * (8 * 8 / 2);
for(int i = 0; i < 8*8/2; i++)
destPtr[i] = srcPtr[i];
}
void copyTile(int dx, int dy, int sx, int sy)
{
sy += sx / 4;
sx %= 4;
copy8Tile(dx*2 + dy*64, sx*2+sy*32);
copy8Tile(dx*2+1 + dy*64, sx*2+1+sy*32);
copy8Tile(dx*2 + dy*64+32, sx*2+sy*16+8);
copy8Tile(dx*2+1 + dy*64+32, sx*2+1+sy*16+8);
}
void hook_020b8370()
{
frame++;
if(frame == 4*6) frame = 0;
charPtr = G2_GetBG2CharPtr();
if (*tileset1ID == 67) copyTile(0, 0, frame%4, 0);
}
void hook_020AE318()
{
animationFile = (u16*) allocFromCacheTable(28672);
loadFileByExtId_LZ_Dest(179 - 0x83, animationFile); //ExtID 179 -> wrecking_crew.narc
} And now how to use it: 1. Create a LZ compressed ncg that is 64 wide and as many blocks heigh as the count of your wished animated tiles, that contains 4 frames of your animation from left to right. This tool helps you with the creation. Import the generated .bin and LZ compress it. The image should look like this: 2. Import it into ARCHIVE/wrecking_crew.narc 3. Get the size of the file (in decompressed form!) 4. Go to line 39. You'll see "allocFromCacheTable(28672)". In the braces write the size from step 3. 5. Go to line 34. You'll see "if (*tileset1ID == 67) copyTile(0, 0, frame%4, 0);" That 67 is the tileset ID that'll get animated. Of course you can change it. Now the interesting part: That 0, 0 in the braces are the tile coordinates in your tileset gfx. Top-left tile is 0, 0. So the waterfall tile is 0, 0. That last 0 in the braces is the row of the animated tile in the animations ncg. Copy and paste that line as often as you wish to. 6. Make and insert the code Of course you can play with the code and do stuff like more frames, animations for different tilesets and much more with it. If someone cares I'll tell you how all this works and what each line does Of course all credit goes to Dirbaio. Edit: Of course you can do Jyotyu animations, too. Just remove that "(256 * 48 / 2)" in line 11. Edit: You can hook 0x020B68CC if yöou want the animations to update more often. (0x020B68CC has something to du with the coin animations) _________________________ GitHub - Kuribo64 - YouTube |
KingYoshi |
Posted on 08-06-15, 05:55 pm
|
Fire Snake
Eugene Karma: 3810 Posts: 501/1156 Since: 11-29-11 |
I don't know much about ASM Hacking, so I probably won't be able to use this, but I'm sure this will be very useful for others. Great job!
|
RicBent |
Posted on 08-08-15, 12:01 pm (rev. 1 by RicBent on 08-08-15, 12:01 pm)
|
Mariomaster
Karma: 8573 Posts: 487/1681 Since: 06-09-12 |
fun maker |
Posted on 08-21-15, 08:41 am
|
Goomba
Karma: -133 Posts: 2/22 Since: 07-14-15 |
i don't understand where that code for is and how to change tile set ID and that stuff.
and i don't know what that step 3 code is. |
Dirbaio |
Posted on 08-21-15, 04:23 pm
|
Super Mario
( ͡° ͜ʖ ͡°) Karma: 10081 Posts: 4303/4458 Since: 06-08-11 |
You may want to read these to understand more
tutorial How ASM hacks are setup ASM hacking project template! (Which BTW are sticked in this very forum) |
LuigiXHero |
Posted on 08-21-15, 08:22 pm
|
Ninji
Karma: 379 Posts: 159/226 Since: 08-17-11 |
Awesome. Tutorials like these are always great. I honestly think we should have more but thanks for posting it.
_________________________ |
fun maker |
Posted on 08-22-15, 11:57 am
|
Goomba
Karma: -133 Posts: 3/22 Since: 07-14-15 |
oh, eh maybe my problem was that i use the hex editor but i think that hex editor the wrong editor is.
he'y can somebody upload the working file that i can use for my own animations? |
RicBent |
Posted on 08-22-15, 06:11 pm
|
Mariomaster
Karma: 8573 Posts: 491/1681 Since: 06-09-12 |
fun maker, no offence, but before you should start thinking about tile animations, you should get at least a bit familiar to ASM hacking by reading the threads mentioned by Dirbaio above. I am not willed to explain every step to setup this hack if these are written somewhere else and easy to find. But if someone has questions regarding how to setup things related not to ASM hacking in General feel free to ask
_________________________ GitHub - Kuribo64 - YouTube |
dreamydude |
Posted on 12-17-17, 06:18 pm
|
Goomba
permanently banned: reregistering while banned Karma: -52 Posts: 17/24 Since: 10-18-17 |
if you have created an ncg creator, can you make an ncl creator too?
_________________________ anyways, keep doin' what youre doing |
RicBent |
Posted on 12-17-17, 08:15 pm
|
Mariomaster
Karma: 8573 Posts: 1039/1681 Since: 06-09-12 |
Pages: 1