Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hypothetical scenario. this is not a valid actor heap address.
- chest is at 80100000
- spawn variable is at actor+0x1C
- so spawn variable is at 8010001C
- the spawn variable is a 2 byte value that is passed into the Spawn_Actor function at spawn time.
- this variable can contain verious information about an actor. it uses all 16 bits of this 2 byte number to store that information.
- we are interested in the chest contents, which is stored in the bits shown below:
- spawn var = 0000cccc ccc00000
- where c is the contents
- for more info on spawn variables, see the writeup here: https://wiki.cloudmodding.com/oot/Actor_List_(Variables)#Overview
- to modify 8010001C directly with the x coordinate (where SRM starts modifying), you would need to be holding spawn variable -0x24
- 8010001C - 0x24 = 800FFFF8
- but since actors on the heap are 10 byte aligned this doesn't work.
- so 800FFFF0 will have to do
- address of held actor is 800FFFF0
- with SRM, you would start modifying at 800FFFF0+0x24 = 80100014
- 4 byte float for x @ 80100014
- 4 byte float for y @ 80100018
- 4 byte float for z @ 8010001C
- 32 bit z coordinate lines up with 16 bit spawn variable like so:
- zzzz zzzz zzzz zzzz
- ssss ssss uuuu uuuu
- where z is z coordinate, s is spawn variable, and u is something irrelevant for the chest contents.
- note that bad values for u, or the x/y/actor rotation can cause unwanted effects/crashes.
- this means that the upper 2 bytes of the 4 byte z coordinate float are what is modifying the contents.
- specifically these bits shown earlier:
- 0000cccc ccc00000 00000000 00000000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement