| Stats |
Time/Date
08-02-11 01:07:16 PM
Posts
9858
Days Here
1491
Level
146
|
|
| Metal_Man88's Post |
Adding in Twili's tutorial here, since he sort of destructed from his hubris. I've taken the liberty of rehosting his images in case he decides to try anything else stupid.
We will be using a gs code of yoshiman's, as well as creating one for this. His code being:
Replace signpost with Blarrg in Lethal Lava Land Star 1 (JS)
NTSC
8133E9FC 8018
8133E9FE A15C
8133EA24 8014
8133EA26 9A10
8133EA14 4000
8133EA18 4000
8133EA1C 4000
8133EA88 C5A8
8133EA8C 421A
8133EA90 45B0
8033EB19 0020
8133EBE0 4406
8033EB6B 0002
Were you to startup the game and turn this code on before entering Lethal Lava Land, you would be greeted with Blarrg bobbing up and down. Let's go to the RAM offset of the animation itself. You will need to use an emulator like Nemu64 to view the memory.
I know from verification via the SM64 Exposed Animation Values page that lines 3 and 4 contain the RAM offset of the animation header, 80149A10:
00 00 00 00 00 00 00 00 [00 2D] [00 05] [05] [00 5E B8] [05] [00 60 28]
002D is the frame count (45 in decimal).
0005 is the number of limbs/joints/bones/nodes/etc. in the geo layout/object hierarchy for Blarrg.
The lone 05 bytes in brackets are the RAM bank this is in, 05.
005EB8 is the offset to the rotation and translation values.
006028 is the offset to the rotation and translation index.
The start of RAM bank 05 when in Lethal Lava Land is 801439A0, so to reach the rotation/translation values, we would do 801439A0 + 005EB8 to get 80149858. There, you will see:
[00 00] [00 16] [FF FC] [FF B9] [FF 61] [FF 08] [FE C0] [FE 9F]
These are the rotation/translation values for Blarrg's animation. Rotations are unsigned shorts (16-bit). 4000 is 90 degrees, 8000 is 180 degrees, C000 is 270 degrees, 0000 is 360/0 degrees, etc.
Translation values are SIGNED shorts.
0000 - 7FFF = 0 to 32,767.
8000 - FFFF = -32,768 to -1.
So how do we differentiate between rotations and translations? That's what the rotation/translation index is for! It's at 801499C8 (801439A0 + 006028):
[00 01] [00 00]
[00 2D] [00 01]
[00 01] [00 00]
[00 01] [00 00]
[00 01] [00 2E]
[00 01] [00 00]
[00 01] [00 00]
[00 01] [00 00]
[00 2D] [00 8A]
[00 01] [00 00]
[00 01] [00 00]
[00 2D] [00 5D]
[00 01] [00 00]
[00 01] [00 00]
[00 01] [00 5C]
[00 01] [00 00]
[00 01] [00 00]
[00 2D] [00 2F]
Each group of twelve bytes represents a complete rotation/translation, X, Y, and Z. The top row is X, middle is Y, and bottom is Z. The first twelve bytes here are for Blarrg's translation. The rest are for rotation of its limbs. The part in brackets on the left is the key. If the key is equal to the number of frames the animation has (002D!), the rotation/translation is dynamic (changing each frame). If it is equal to 0001, it's static.
The part in brackets on the right is the indexed location inside of the rotation/translation values. For dynamic rotation/translation, the index points to the rotation/translation value for the first frame. The next two bytes in from the indexed location are for the second frame, etc. For static, the same value is used for every frame.
To prove this information accurate, I have created a new code to use in conjunction with the one that loads Blarrg in Lethal Lava Land:
811499CC 0001
811499CE 0015
811499DA 0000
811499E8 0001
811499EA 0000
811499F4 0001
811499F6 0000
81149A02 0000
81149A0C 0001
81149A0E 0000
This manipulates the rotation/translation index to give Blarrg the highest Y translation (indexed location 0015) the animation has to offer (because it bobs up and down), and locks it from changing each frame. The first two code lines do that. The rest lock the limb rotations and point to indexed location 0000 (which seems to always contain a rotation of zero, a Nintendo standard).
Using both codes together, you will be greeted with this:

Blarrg in default rotation. From reading his geo layout and nulling the Display List pointers one at a time, I have reached the following consensus:
Limb 1 is the base/root for the entire model.
Limb 2 is Blarrg's body.
Limb 3 is Blarrg's head.
Limb 4 governs Blarrg's jaw.
Limb 5 is Blarrg's jaw.
The second grouping of twelve bytes in the rotation/translation index is for the model root, because I said the first was for Blarrg's translation. Third is for Blarrg's body, you get the idea. Change line 3 of my code from 0000 to 002E, and upon reloading, you will notice that Blarrg has rotated to be perpendicular to the island in the lava:

This code line modifies the indexed location for the model root's Y rotation.
Now change code line 5 from 0000 to 008A, and THIS will happen:

Just a bit more recognizable, eh? This code line modifies the indexed location for Blarrg's body's Z rotation.
Change code line 7 from 0000 to 005D:

Blarrg's head is lowered slightly. This code line modifies the indexed location for Blarrg's head's Z rotation.
Change code line 8 from 0000 to 005C:

This change is perhaps the most subtle of them all. It rotates Blarrg's jaw out of the head and into the body. This code line modifies the indexed location for the limb that governs Blarrg's jaw's Z rotation.
One final change. Code line 10. Change from 0000 to 0048:

Blarrg's jaw is now rotated correctly to show an open mouth! This code line modifies the indexed location for Blarrg's jaw's direct Z rotation.
This concludes Animation 101.
____________________
|
|