PDA

View Full Version : Development: Why the really tall grass doesn't work in firered and how to fix it.


knizz
May 21st, 2011, 03:01 AM
If you're not interested in the techical details scroll down

As you probably know you can change the behaviourbyte of the grass block from 2 (normal grass) to 3(tall grass) in advancemap. However no animation is played for 3.

Everything starts at 083A70BC which is a table of functions. The interesting entries are at index 1 and 2: 080683C8 and 08068414. They end with:
08068402 MOVS R0, #4
08068404 BL overworld_effect_start
0806844E MOVS R0, #0x11
08068450 BL overworld_effect_start
(the numbers that "overworld_effect_start" uses are the same as for the do_animation npc script command)
overworld_effect_start has a script collection (081D96AC) with it's own bytecode (dispatch table is at 083CBE30). The commands in bytecode are: 0 load graphics
1 load palette (v1)
2 load palette (v1)
3 call asm
4 end
5 combination of 0 1 3
6 combination of 0 3
7 combination of 1 3

Effect 0x4:07 083A5348 080DB349 04
Effect 0x11:07 083A5348 080DB5F5 04
Part of the function called from animation 0x4:...
080DB368 LDR R0, =0x083A0010 @ array of pointers to object templates (see http://www.pokecommunity.com/showthread.php?t=238937)
080DB36A LDR R0, [R0,#0x10] @ selects the array-entry for the normal grass
...
080DB378 BL template_instanciate
...
Part of the function called from animation 0x11...
080DB614 LDR R0, =0x083A0010 @ array of pointers to object templates (see http://www.pokecommunity.com/showthread.php?t=238937)
080DB616 LDR R0, [R0,#0x3C] @ selects the array-entry for the tall grass
...
080DB624 BL template_instanciate
...
083A5420 grass_normal:object_template <0xFFFF, 0x1005, unk_083A36F0, \
083A5420 off_083A541C, stru_083A53DC, \
083A5420 rotscale_table_empty, objc_grass_normal>
083A593C grass_tall: object_template <0xFFFF, 0x1005, unk_083A36F0, \
083A593C off_083A5938, stru_083A58F8, \
083A593C rotscale_table_empty, objc_grass_tall>

The last entry in this structure is the callback that executed once every frame. Those are almost equal except for:
...
080DB46C BL complex_function
080DB470 LSLS R0, R0, #0x18
080DB472 CMP R0, #0
080DB474 BEQ loc_080DB48C
...
...
080DB71C BL put_0_into_r0_and_do_nothing
080DB720 LSLS R0, R0, #0x18
080DB722 CMP R0, #0
080DB724 BEQ loc_080DB73C
...

To make the tall grass work, a function, equivalent to the one used in the function for normal grass, needs to be written at the same offset.

HOW TO FIX IT
Start overwriting at 08059f34 with 00 21 00 06 00 0e 02 28 01 d0 d1 28 01 d1 01 20 00 e0 00 20 00 21 70 47 03 28 f5 e7

eh 08059f34 0x2100
eh 08059f48 0x2100
eh 08059f4a 0x4770
eh 08059f4c 0x2803
eh 08059f4e 0xE7F5

Have fun and please credit me.

EDIT
If you want to enable the tiny grass too overwrite at 0805A0EC with 0C 30 09 E0. (It's mapped to behaviour byte 7)

Crimson Stardust
May 21st, 2011, 05:33 PM
Wow, finally someone do it,
i did post a thread about this, not exactly about this, but yeah same thing,
i was figuring out why the tall grass animation is not working..so this is great man..

Derlo
May 21st, 2011, 05:57 PM
Man if there's one thing I always wanted to fix was that ...
Great job!
I wonder know if you have tried enable other animations from the 3rd generation? Like the grass with ash on it ...

I tried to do one thing:

08068402 MOVS R0, # 4
08068404 BL dp02_exec_aka_do_animation

This #4 refers to animations that will be loaded into tile ... I tried to change this for any other byte below #40. And what I got was that instead of the normal animation of grass other animations were loaded (in fact I think all the animation tiles had been carried).

For example:
* If you place a # 01, the animation will be loaded, is when we use the cut on the grass tiles.
* And if you put # 07, the animation will be loaded is the grass with ash on top (which I referred to earlier), merged with a setmaptile with some tile of the second tileset.

And so on ...

Maybe this way there is how to enable other animations or even create new ones.

Good luck and thanks!

knizz
May 22nd, 2011, 12:18 AM
I think that the ashgrass is also available via behaviourbytes but deactivated just like the tall grass. Finding a patch for that shouldn't be hard. I'll make one if I have time. And thank you Derlo for the animation-number of the ashgrass.

r0bert
May 22nd, 2011, 04:10 AM
You fix it with a Hex editor,right?

knizz
May 22nd, 2011, 04:44 AM
Patch for tall grass on behaviourbyte 0x03 and ash grass on behaviourbyte 0x24

eh 08059f34 0x2100
eh 08059f48 0x2100
eh 08059f4a 0x4770
eh 08059f4c 0x2803
eh 08059f4e 0xE7F5
eh 08059f50 0x2824
eh 08059f52 0xE7F3
eb 0806e820 0x04
eh 0806ebdc <special tile with ash>
eh 0806ebe0 <special tile without ash>
eh 0806ec00 <grass tile without ash>

You fix it with a hex editor, right?
Yes.

Derlo
May 22nd, 2011, 05:10 AM
Great job man!
It worked perfectly ..

I'm making a list of all the animations I've ever encountered.
When this is done, I'll post here.

Good luck and thanks.

r0bert
May 22nd, 2011, 05:43 AM
I have a small problem:I'm using XVI32 and I can't find the offset.Should I use a different Hex-editor?

knizz
May 22nd, 2011, 05:52 AM
I have a small problem: I'm using XVI32 and I can't find the offset. Should I use a different hex-editor?

You can't even use a hex-editor correctly? I am disappoint. Sorry, I was in a bad mood when I wrote this.

I wrote addresses/pointers not offsets. In GBA the ROM Origin is 08000000. So if you want the offset you have to subtract this number from the address.

Derlo
May 22nd, 2011, 06:45 AM
Remember...
All of bytes, are written on the offset: 08068402. (Normal Grass)
And will activates when any OW steps on the tile.


01 - Animation of the HM CUT on the grass tiles. (Some leaves turning around the player)
02 - Same as before. (But without the animation of the leaves)
03 - Apparently nothing.
04 - Normal Grass.
05 - Ripple on the water when an OW step in puddles of water. (The animation appears only in these coordinates: x = y = 0d 13)
06 - Bar with a sprite POKEMON random. (The POKEMON that is shown depends on the coordinates X) [When load repeatedly times, Break the rom.]
07 - Grass with ashes on top, mixed with a setmaptile with some of the tiles.
08 - Loads the OW of HM SURF (pokemon in which the player stands on top in the water)
09 - Loads the HM SURF to the player.
0A - Dust when an OW performs a jump on the floor.
0B - Apparently nothing.
0C - effect when an OW performs a jump in the grass tiles.
0D - Footprints in the sand. (Animation is not complete, only one tile of the animation)
0E - effect when an OW performs a jump in the water tiles. (Splash)
0F - Apparently nothing.
10 - Splash of footsteps in the water.
11 - Apparently nothing.
12 - Another animation of grass. Very interesting ...
13 - Another animation of grass diferent than the previous. (The tile always gets excited. "shaking" lol.)
14 - Another animation of the grass #12. (The tile always gets excited. "shaking" lol.)
15 - A type of hole in the sand. [Possibly a WARP] (animated constantly)
16 - Submerge the water. [Possibly a WARP] (animated constantly)
17 - Apparently nothing.
18 - Same as # 0D
19 - Animation of Pokeballs in Pokecenter.
1A - 1D - Apparently nothing.
1E - Pokemon landing after using HMFLY. (The Standing animation always loaded in the player's position)
1F - 22 - Apparently nothing.
23 - BIKE Trail in the sand. (Animation is not complete, only one tile of the animation)
24 - Apparently nothing.
25 - Player using the Pokeball and POKEMON. (Possibly HM Strength)
26 - Player using the Pokeball and POKEMON. (Teleport to last WARP)
27 - Apparently nothing.
28 - Player using the Pokeball and POKEMON.
29 - 2A - Apparently nothing.
2B - Break the rom.
2C - Bar with Sprite POKEMON (Break the rom.)
2D - appears a drawing of a Pokeball in the left corner of the screen, then fades. (Possibly is not a tile)
2E - 30 - Apparently nothing.
31 - When we are sucked into the sand. (WARP)
32 - Splash water. (WARP)
33 - Animation SWEETSCENT.
34 - Apparently nothing.
35 - Bubbles on the floor.
36 - 39 - Apparently nothing.
3A - Leaves turning around the OW player.
3B - Bar with a sprit of a POKEMON.
3C - 3D - Apparently nothing.
3E - animation of the machine that records the data on FAMEHALL.
3F - Teleport to the center of the map.
40 - Apparently nothing.
41 - Animation VS.SEECKER. (Break the rom.)
42 - 44 - Apparently nothing.
45 - The screen flashes. (As a Flash)
46-9F - Resets the ROM or Break the rom.

EDIT:
A0-A1 - Resets the ROM or Break the rom.
A2 - Lock the screen, and the movements of the OW are slow.
A3-B7 - Resets the ROM or Break the rom.
B8 - Movement of the OW slower and damage their image.
B9-DD - Resets the ROM or Break the rom.
DE - Apparently nothing.
DF-E7 - Resets the ROM or Break the rom.
E8 - Apparently nothing.
E9-EE - Resets the ROM or Break the rom.
EF - Apparently nothing.
F0-F7 - Resets the ROM or Break the rom.
F8 - Apparently nothing.
F9-FF - Resets the ROM or Break the rom.

knizz
May 22nd, 2011, 06:49 AM
46-9F - Resets the ROM or Break the rom.

A0-FF - Still Searching ...

That's the limit. There isn't more than that.

sonic1
May 22nd, 2011, 07:38 AM
That's the limit. There isn't more than that.

It is? Well, i'm not sure, but the command doanimation uses a word as parameter, not a byte. But i'm not sure, as there can be a table or something...

~Sonic1

Quilava's Master
May 22nd, 2011, 08:04 AM
This is beyond incredible. I definitely wish to implement this in Shattered Dreams. What I love most is how easy it is to understand for anyone who's ever worked with a hex editor! Many thanks Knizz! But I do have a question regarding the ash grass. Will it work in accordance with the "Soot Sack" item in the same vein as it did in RSE?

Note: I would have tested this myself before asking but my laptop is out of commission right now.

Shiny Quagsire
May 22nd, 2011, 11:45 AM
On the topic of animation ids, could you make a new tile that animates when stepped on?

knizz
May 22nd, 2011, 01:14 PM
It is? Well, i'm not sure, but the command doanimation uses a word as parameter, not a byte. But i'm not sure, as there can be a table or something...

~Sonic1

It is a table it is at 081D96AC. And it has 0x46 entries.

This is beyond incredible. I definitely wish to implement this in Shattered Dreams. What I love most is how easy it is to understand for anyone who's ever worked with a hex editor! Many thanks Knizz! But I do have a question regarding the ash grass. Will it work in accordance with the "Soot Sack" item in the same vein as it did in RSE?

Note: I would have tested this myself before asking but my laptop is out of commission right now.

I have no idea. I think this ash-grass doesn't even have pokemon encounters so it's at least broken in ONE way.

On the topic of animation ids, could you make a new tile that animates when stepped on?

Can? Yes! Want? If you pay me. I can give you a few tips though if you're serious about it. Contact me via email, PN, MSN or IRC.

r0bert
May 22nd, 2011, 01:50 PM
excuse me for being noobish,but how can you activate the other animations?

knizz
May 22nd, 2011, 02:04 PM
excuse me for being noobish, but how can you activate the other animations?

Which other animations? You mean except for tall grass and ash? You can't. That'd require new patches. But no one wrote them yet. But lot's of animations are activated already. Just open AdvanceMaps block-editor and play around with the behaviour-byte.

Full Metal
May 22nd, 2011, 03:36 PM
By reading the thread and attempting to understand it. :)

shinyabsol1
May 22nd, 2011, 06:18 PM
So this activates the previously blocked tall grass animation...great! I'll try it when I have the time. Thanks!

One question though: does this mean the tall grass animation can now be edited into a new grassy patch animation?

knizz
May 22nd, 2011, 09:55 PM
So this activates the previously blocked tall grass animation...great! I'll try it when I have the time. Thanks!

One question though: does this mean the tall grass animation can now be edited into a new grassy patch animation?

When I said patch I meant "small modification".

You can replace the images used in the animation and edit their order. Just edit the corresponding "unknown_structure". (More infos in first post)

r0bert
May 23rd, 2011, 12:44 PM
Which other animations? You mean except for tall grass and ash? You can't. That'd require new patches. But no one wrote them yet. But lot's of animations are activated already. Just open AdvanceMaps block-editor and play around with the behaviour-byte.
I kinda meant the micro grass animation.
also what are the rest of the animations?(pic in attachment)
the ones I can't recognise are in a blue square.

>Dante<
June 1st, 2011, 02:20 AM
oh WOW! This is totaly awesome!! Thank you very much friend but...yeah, there are a lot of bases animation such as the micro grass animation...look:

http://img845.imageshack.us/img845/2288/immaginesb.png

How to fix it?

hinkage
July 13th, 2011, 09:28 AM
Sorry for being new and stupid, but what does this part mean?

"eh 08059f34 0x2100
eh 08059f48 0x2100
eh 08059f4a 0x4770
eh 08059f4c 0x2803
eh 08059f4e 0xE7F5"

What do I do with it? I DID research a little, and the only part that confuses me still is the 0x2100, etc.

Hackrex
November 22nd, 2011, 01:14 PM
ok for all who didn´t understand it: The Offset you can see on the top are written in ASM.

So the most people don´t know where they can find it in there Hex Viewer....

So here is the "Hex" Offset:
059F34 for firered english
059F34 for firered german (feuerrot) - it´s really rare that the german rom has the same offset than the English

this is the hex code you have to use
00 21 00 06 00 0e 02 28 01 d0 d1 28 01 d1 01 20 00 e0 00 20 00 21 70 47 03 28 f5 e7

here you can see that it works
http://hackrex.ha.funpic.de/images/hohes%20gras.png


//Edit:
I have a question: How can I make that I can´t drive with the bike over the really tall grass block?

DealNotTheDevil
February 4th, 2012, 04:48 AM
Hi, I wanted to check if one can create a new behavioural byte for pokemon emerald,
Because I am attempting to create a "super region",
And I want kanto maps that I port into Emerald to play kanto battle themes and wild encounter themes when I am on those maps!

Lost Heart
February 4th, 2012, 05:13 AM
Hi, I wanted to check if one can create a new behavioural byte for pokemon emerald,
Because I am attempting to create a "super region",
And I want kanto maps that I port into Emerald to play kanto battle themes and wild encounter themes when I am on those maps!

Yes, you can, if you know ASM...

Anyways, to enable this for LeafGreen, it is the exact same thing as FireRed. Offsets and everything. :D

ShinyDragonHunter
July 20th, 2012, 10:20 PM
ok for all who didn´t understand it: The Offset you can see on the top are written in ASM.

So the most people don´t know where they can find it in there Hex Viewer....

So here is the "Hex" Offset:
059F34 for firered english
059F34 for firered german (feuerrot) - it´s really rare that the german rom has the same offset than the English

this is the hex code you have to use
00 21 00 06 00 0e 02 28 01 d0 d1 28 01 d1 01 20 00 e0 00 20 00 21 70 47 03 28 f5 e7

here you can see that it works
http://hackrex.ha.funpic.de/images/hohes%20gras.png


//Edit:
I have a question: How can I make that I can´t drive with the bike over the really tall grass block?

I've changed the hex code for that offset but nothing is happening.

Hackrex
July 22nd, 2012, 02:44 AM
You must change the behaviour bytes on the block on which you want to use the animation.
In Advance Map:
Normal Gras:
behaviour-Byte:
02 02
Background-Byte:
00 01
01
Tall Gras:
behaviour-byte
03 03
background-Byte:
00 01
01

Spherical Ice
April 14th, 2013, 05:54 AM
The pointers to the frames of animation that appear when you walk in the Ash Grass is located at 0x83A54A0.

28 89 39 08 80 00 00 00
A8 89 39 08 80 00 00 00
28 8A 39 08 80 00 00 00
A8 8A 39 08 80 00 00 00
28 8B 39 08 80 00 00 00

Frame 1: 0x8398928
Frame 2: 0x83989A8
Frame 3: 0x8398A28
Frame 4: 0x8398AA8
Frame 5: 0x8398B28

You can change those pointers to a different sprite to change the animation, which could lead to some interesting gym puzzles or terrain (snow, perhaps?). It uses the palette located at 0x8398FC8, which is pointed to by 0x83A5348 for FireRed.

darkprince909
February 3rd, 2014, 01:08 PM
I've been looking for the address of the tall grass routine in Ruby, so I can change it to behave more like the normal grass (it normally makes the player's body priority 3 behind pri 2 graphics, whereas normal grass leaves the player and the animation at pri 2). Would I be able to search for some of those lines of code in the first post to find the routine? What program might I need to find the ASM code?

knizz
August 5th, 2014, 09:14 AM
I extended the opening post by information about how to backport the micro grass too. Overwrite at 0805A0EC with 0C 30 09 E0. Then assign the behaviour byte 7 to some tile.
Hope you enjoy.

Tyroz
August 6th, 2014, 05:01 PM
Kniz has helped so much with my questions, and even added in the correct Hex Edit for not only adding in the Tall Grass Animation, but ALSO the tiny grass animation; WHich by the way is hard to see unless you really look at the players feet.

This is such an amazing concept and it helped me. I did check the rules, and Hashtag did say:

The revival limit does not apply in this forum


So...I would like to bump this thread and see what others have to say 3 years later.

Cloudfury
August 21st, 2014, 12:09 AM
How do I search for the numbers in a hex editor? I'm using HxD. Tried copy pasting into the search and doesn't find it. Even offsets won't work.

Lance32497
October 18th, 2014, 01:51 AM
Sorry for being noob

But, does this tutorial works in FR US?

Shiny Quagsire
October 18th, 2014, 10:06 AM
Sorry for being noob

But, does this tutorial works in FR US?

Most ASM research is FR US only, mostly because it's easier to research one ROM rather than a whole bunch of ROMs.