Pages: 1
RicBent |
Posted on 08-06-15, 05:14 pm (rev. 13 by ImageBot on 11-21-16, 03:16 am)
|
Mariomaster
Karma: 8168 Posts: 486/1613 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
![]() 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 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 |
|
Posted on 08-06-15, 05:55 pm
|
![]() Karma: 3498 Posts: 501/1071 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: 8168 Posts: 487/1613 Since: 06-09-12 |
|
Posted on 08-21-15, 08:41 am
|
![]() 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. ![]() |
|
Posted on 08-21-15, 04:23 pm
|
![]() ( ͡° ͜ʖ ͡°) Karma: 9591 Posts: 4303/4446 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) |
|
Posted on 08-21-15, 08:22 pm
|
![]() 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.
_________________________ |
|
Posted on 08-22-15, 11:57 am
|
![]() 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: 8168 Posts: 491/1613 Since: 06-09-12 |
![]() _________________________ GitHub - Kuribo64 - YouTube |
|
Posted on 12-17-17, 06:18 pm
|
![]() 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?
_________________________ |
RicBent |
Posted on 12-17-17, 08:15 pm
|
Mariomaster
Karma: 8168 Posts: 1039/1613 Since: 06-09-12 |
Pages: 1