Pages: 1
Posted on 03-06-16, 05:52 pm
Death by cuteness

Karma: 6554
Posts: 375/598
Since: 05-01-13
A simple tutorial about how to animate any background you want.



First decompress overlay 0 if it's not decompressed already.


Foreground animation table offset:
0×2F734 (US) 0×2EB34 (JAP) 0×2EF48 (EUR) 0×2EBF4 (KOR) 0×2EBF4 (CH)


Background animation table offset:
0×2F69C (US) 0×2EA9C (JAP) 0×2EEB0 (EUR) 0×2EB5C (KOR) 0×2EB5C (CH)



Each table is 152 bytes long, and contains 2 bytes long data for each of the 76 background slots (1st table) / 76 foreground slots (2nd table).
If the data for a given background is 00 00, then this background won't be animated.

Offset formula for a given foreground slot is:
Foreground_table_offset + (Foreground_slot_number × 2)


Offset formula for a given background slot is:
Background_table_offset + (Background_slot_number × 2)




For example let's say you want to animate both FG and BG 59 the same way than FG and BG 4 respectively on the US version.

Retrieve the value used for FG 4:
4×2=8 (0×8);
So 2F734+8=2F73C.
Read the 2 bytes at offset 2F6A4, which are 07 00.

Now go to FG 59 offset:
59×2=118 (0×76);
So 2F734+76=2F7AA.
Read the 2 bytes at offset 2F7AA, which are 00 00.
Now replace them by the value in FG 4, which is 07 00.


Retrieve the value used for BG 4:
4×2=8 (0×8);
So 2F69C+8=2F6A4.
Read the 2 bytes at offset 2F6A4, which are 07 00.

Now go to BG 59 offset:
59×2=118 (0×76);
So 2F69C+76=2F712.
Read the 2 bytes at offset 2F712, which are 00 00.
Now replace them by the value in BG 4, which is 07 00.

Save overlay 0 and test in-game to see the results by yourself.


This tutorial pretty much voids my former tutorial about animating backgrounds.
Thanks to  Dirbaio for being the one who discovered the code in the first place, have a look at his thread.
Posted on 06-16-16, 05:29 pm
Roy Koopa


Karma: 4011
Posts: 2708/2722
Since: 06-26-11
As a sidenote: this only works for Animations that do nothing else than moving the Background from left to right or from top to bottom.
If you try to use Animations that are a little more complex like the underwater animation, this whole thing does not work. I'm not quite sure why exactly. There must be some information stored that tells parts of the Background to animate differently. Kinda like a Tile Behavior for Backgrounds.
_________________________
See a lots of creative DS Hacking here
If you want to support me, you might check out my Patreon Page : )
Posted on 06-16-16, 06:18 pm (rev. 1 by  MeroMero on 06-16-16, 06:18 pm)
Death by cuteness

Karma: 6554
Posts: 409/598
Since: 05-01-13
Actually this is caused if either Sprite 316 or Sprite 317 is present in the View.
Try to C/P their sprite data on levels with non-underwater backgrounds and you'll see
Posted on 06-16-16, 06:31 pm (rev. 1 by  ray on 06-16-16, 06:36 pm)
Roy Koopa


Karma: 4011
Posts: 2709/2722
Since: 06-26-11
Tried, did not work. Instead I can just swim around as expected.

EDIT: Yeah that effect is caused by those sprites. Nonetheless, the background associated with those sprites needs to have the Animation ID 02. Otherwise that effect won't show up.
I'm wondering, is there any way to use that effect without using the sprites? It would make for some very cool backgrounds but unfortunately you're always swimming as soon as you place those sprites in your level.
_________________________
See a lots of creative DS Hacking here
If you want to support me, you might check out my Patreon Page : )
Posted on 06-16-16, 07:07 pm (rev. 1 by  MeroMero on 06-16-16, 07:12 pm)
Death by cuteness

Karma: 6554
Posts: 410/598
Since: 05-01-13
Without using the sprites I dunno…

But you can always make a quick ASM hack that would read one of the sprite data 4 upper nybbles of your choice* and then make it so that the game disable the swimming property if nybble X != 0 (and also force both backgrounds scrolling value to 2 for the view they are located in if you want, that way you don't have to touch the actual value).


*Normally I would advise against it since those 4 nybbles are what the game usually uses to identify Event IDs; but for sprites 316 and 317, all 8 lower nybbles are used, and there's no Event IDs property for those Sprites anyway so there's that.
Posted on 06-16-16, 07:11 pm
Roy Koopa


Karma: 4011
Posts: 2710/2722
Since: 06-26-11
Heh as if I could make a quick ASM hack lol.
_________________________
See a lots of creative DS Hacking here
If you want to support me, you might check out my Patreon Page : )
Posted on 06-17-16, 08:09 pm (rev. 1 by  MeroMero on 06-17-16, 08:44 pm)
Death by cuteness

Karma: 6554
Posts: 411/598
Since: 05-01-13
So as I learned sprites 316 and 317 are not required to create a wavy background, setting the Animation ID of the BG of your choice to 2 is the only necessary condition.

BUT, the waves only work when they are :
_either directly behind Water, Lava, Poison Water, Unused jungle effect
_or if Sprite 316 is present in the View


To bypass this restriction:
On (decompressed) overlay 0, at offset 0×1913C replace 01A192E7 with 00A0A0E3.

Now you can use this effect to simulate for example a heat haze on desert backgrounds.
Note that you still have to use the Water, Lava or Poison Water sprite, but you can place it 5 to 8 tiles under the View.
Posted on 06-18-16, 01:12 am
Roy Koopa


Karma: 4011
Posts: 2711/2722
Since: 06-26-11
Hell yeah! Thanks a lot : )
_________________________
See a lots of creative DS Hacking here
If you want to support me, you might check out my Patreon Page : )
Posted on 06-23-16, 12:37 pm
Not a hacker

Karma: 188
Posts: 114/153
Since: 04-05-16
I have the opposite problem:

i replaced a custom background that should'd be animated in an animated bg slot. How do i remove the animation?
_________________________
Discord server
Posted on 06-23-16, 12:40 pm
Death by cuteness

Karma: 6554
Posts: 422/598
Since: 05-01-13
Simply put a value of 0, this will make the background static.
Posted on 06-23-16, 12:46 pm
Not a hacker

Karma: 188
Posts: 115/153
Since: 04-05-16
Posted by MeroMero
Simply put a value of 0, this will make the background static.

but i didn't use your method, and please explain better -.-
_________________________
Discord server
Posted on 06-23-16, 12:49 pm
Death by cuteness

Karma: 6554
Posts: 423/598
Since: 05-01-13
First then I will need to know what are Top and Bottom background slots number.
And second I need the version of the game (Armerican, European, or other).
Posted on 06-23-16, 12:51 pm
Not a hacker

Karma: 188
Posts: 116/153
Since: 04-05-16
1)bottom 0
2) US rom
_________________________
Discord server
Posted on 06-23-16, 12:54 pm (rev. 1 by  MeroMero on 06-23-16, 12:54 pm)
Death by cuteness

Karma: 6554
Posts: 424/598
Since: 05-01-13
So:
_First check if overlay 0 is above 200 000 bytes, if not open the Jyotyu tileset and save (assuming you're using the latest version of NSMBe, if not download it)
_second open overlay 0 and go to offset 0×2F69C and replace the 2 bytes that are there with 00 00.
Posted on 12-07-20, 05:49 pm (rev. 3 by  PolteryGamer on 07-17-21, 09:01 pm)
PolteryGamer

Karma: 39
Posts: 4/13
Since: 10-09-20
*Deleted*

(asked a question I now know the answer to)
Pages: 1