News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

[SM] [ITEMS] Changing functionality of items

Started by shadedmagus, October 14, 2011, 08:44:12 PM

Previous topic - Next topic

shadedmagus

I've found a number of useful patches and hex tweaks that I've included into my project since I stumbled across Metroid Construction, but now I have a request. What I'd like to do is make the following changes to the following items:

  • Springball function moved into Hi-Jump
  • Shinespark drains energy until the (Springball) item is acquired
I happened to see them in the descriptions for Black Falcon's set of Shinespark Control patches. I'd like to find the documentation that made those changes possible, but I'm not seeing it anywhere on the site, in the forums, or in some of the user websites I've come across. Can anyone assist?

EDIT: revised post and title for clarity.

Reaper901

to combine spring ball with hi-jump boots, in the item editor simply take the value of springball and add it to the value of hi jump boots for example hi-jump boots index = 0100 springball index = 0002 so changing hi jump index to  0102 will combine the two. this can be done with many items but not all of them, hope this helps  :yay:

shadedmagus

I haven't used SMILE much yet, so it took me a few minutes to realize that you can only get to the Item Editor by clicking on the item in the room. I made the change, but it doesn't look like it took. So to finalize the change you have to Save Definition and then Save Changes to PLM's Text File?

Mon732

Quote from: shadedmagusSo to finalize the change you have to Save Definition and then Save Changes to PLM's Text File?
You only have to Save Definition, the text file is only for information on the PLM.
After you Save Definition just load up the rom or testplay, grab the item and you should be set.

shadedmagus

It doesn't appear that changing the item value for Hi-Jump Boots to 0102 worked - I saved the definition, saved the room in SMILE and loaded up the ROM, and when I got the item and tried to jump while morphed, it de-morphed me.

Is there any way to manipulate what each item does through hex or ASM?

Smiley

Are you sure that you changed the correct item?
There are three versions of every collectible item (one hidden in scenery, one hidden in Chozo orbs, and one in plain sight), so you might have changed the wrong one.

shadedmagus

#6
I'll admit I don't know my way fully around the ROM (or SMILE) that well just yet - I only changed the one that was in the Chozo orb. I'll change them all and see if that does it.

EDIT:

That worked, very cool. So now I guess is the second part of my question - how do I change the effect of the now-redundant item?

EDIT2:

Black Falcon helped me figure it out - I needed to introduce a bit check for whether the Springball item was equipped into the code that drains energy during shinesparking. Sweet!

shadedmagus

Sorry to double-post, I guess it's been long enough. I've been on holiday and was just now able to test this out.

So basically, I've got some asm that Black Falcon was kind enough to give me help me with that inserts a bit check for the Springball item and decrements energy during shinesparking if it isn't present. Springball is $0002.

The problem I'm seeing is that when I changed the item value for Hi-Jump Boots to $0102 in SMILE, it gives me Springball functionality when I pick them up, but it also gives me the Springball item, which I didn't want.

Is there any other way to merge the functionality of these two items into Hi-Jump without also giving me the Springball item at the same time?

uzqap

of course this method will give u both items. silly filly

u may want to create a new PLM and let the energy drain check for this one instead, or let the routine check for the item LOW variable (which must be saved somewhere too or everything would respawn)
that's how i would approach this problem

Scyzer

Go to each of these locations and change the value there from #$0002 to #$0100.

$91B4CB, $91B4D4, $91E83E, $91E86B

shadedmagus

Quote from: uzqap on November 16, 2011, 10:35:49 AM
of course this method will give u both items. silly filly

I haven't seen any documentation that explains where items are located and how to change their functionality, so I wouldn't know what the results of combining item values would be.

Quote from: Scyzer on November 16, 2011, 10:40:06 AM
Go to each of these locations and change the value there from #$0002 to #$0100.

$91B4CB, $91B4D4, $91E83E, $91E86B

Thank you, SadFish! Do you know if there's any documentation that explains the item ASM at all? I've been looking for some but I haven't found any so far...

P.JBoy

What those PLM do is simply mark in the RAM that you've collected those items, the game checks that place in the RAM in every instance; the addresses Scyzer gave were all of the checks that are done in the spring balling routines, telling them to check the RAM for hi-jump rather than spring ball.

As for item ASM, there isn't really any.  The item pick-ups are handled with PLM, and after picking them up, their effects are handled by a combination of the transition table and snippets spread through Samus' routines
...

shadedmagus

Ahh, OK. That gives me a better understanding of how item collection actually works - instead of separate item indices and routines, there are just values that are used for bit checks to activate certain parts of routines, and a lot of branching. Or so it seems; as always, please correct me if I'm wrong.

Does this mean that Reaper was correct in telling me to merge the item values for Springball and Hi-Jump in order to put both into the same item? I undid that on the off-chance that it would interfere with the hex changes I was told to make, but that explanation makes me think that it wouldn't.

Mon732

Merging the Item Values means that picking up highjump boots will give both highjump boots and springball however they will appear as seperate items on the equipment screen. This means that they (springball and highjump boots) can be turned on and off individually.

Scyzer's hex change and merging the Item Values will mean that only highjump boots will show on the equipment screen when highjump boots are collected but you will get both highjump boots and springball. Turning off highjump boots will turn off both highjump boots and springball.

That's my understanding of it at least. If I'm barking up the wrong tree then tell me off. :P

Scyzer

The item values are which items you get from the PLM. Using a value of $0102 means you will get High jump boots AND Spring ball, regardless of what these items actually do. They will both appear on the status screen.

The hex changes I gave you are for the physics routines that handle how spring ball works. All it does is changes what item to actually check for. Instead of checking for the Spring ball item, it checks for the high jump item. Applying this change means that the spring ball item will do absolutely nothing. You can collect the item, but it has no effect in game, because there are no routines that check for that item bit.

The item value change and the physics changes do not have any effect on each other. You can use both, or one of either. They do different things. The item values will give you both items, but the physics edits will merge the item effects into a single item.

shadedmagus

Quote from: Scyzer on November 16, 2011, 05:15:52 PM
The item values are which items you get from the PLM. Using a value of $0102 means you will get High jump boots AND Spring ball, regardless of what these items actually do. They will both appear on the status screen.

The hex changes I gave you are for the physics routines that handle how spring ball works. All it does is changes what item to actually check for. Instead of checking for the Spring ball item, it checks for the high jump item. Applying this change means that the spring ball item will do absolutely nothing. You can collect the item, but it has no effect in game, because there are no routines that check for that item bit.

Awesome, that is exactly what I needed to know. I have code already in place to prevent shinesparking from draining energy once the Spring Ball is obtained, so no worries on that score. Now I just need to test this out.

I want to add that everyone here has been very helpful in giving answers and explaining the "whys" of the things I'm trying to do, and it's been very cool. Thanks so much for being a great place to learn!

Prime Hunter

Is there a list or document somewhere that explains where each of the locations are for the item checks, or at least where to start look for them? For instance, I had the idea of moving the Screw Attack's properties to the Space Jump (Similar to Prime 2 and 3) and then use the Screw Attack's spot for a different item but I can't figure out where to make the changes like Scyzer posted for the Spring Ball.

Any help would be appreciated.

Scyzer

There's no easy way. Just look for LDA $09A2 (AD A2 09) in the rom, and immediately following it should be either an AND (29) or BIT (89). the 2 bytes following the AND/BIT are what item to check for in that routine. The problem is that these bytes show up hundreds of times in the rom, so it can take a while.

For screw attack, you'll be looking for either [AD A2 09 89 08 00] or [AD A2 09 29 08 00]. Just change all of these to [AD A2 09 XX 00 02]. You can just do a replace all in your hex editor for these ones. What this does is change all of the bit checks for screw attack into space jump, so all routines that would run with screw attack equipped now run with space jump.

Prime Hunter

From a quick test of this it seems like it worked the way I was hoping for. Thanks for everything once again!

Because of this I can now have both the Boost Ball and Spider Ball work together in a single hack, since before they were both competing over the Spring Ball slot and I didn't know where to move the Boost Ball to instead. Now I finally have that opening.

JAM

#19
Actually, you can have 5 more items in your hack. Every item use a single bit at RAM address 7E:09A2 / 7E:09A4. Word contains of 2 bytes (or 16 bits).

Quote from Kej docs:
Quote
Item Array
7E:09A2/09A4
0000 0000 0000 0000
||||  ||||  ||||  |||\Varia
||||  ||||  ||||  ||\-Spring Ball
||||  ||||  ||||  |\--Morphing Ball
||||  ||||  ||||  \---Screw Attack
||||  ||||  ||||
||||  ||||  |||\-----Unused (1)
||||  ||||  ||\------Gravity Suit
||||  ||||  |\-------Unused (2)
||||  ||||  \--------Unused (3)
||||  ||||
||||  |||\-----------High Jump
||||  ||\------------Space Jump
||||  |\-------------Unused (4)
||||  \--------------Unused (5)
||||
|||\----------------Bomb
||\-----------------Speed Booster
|\------------------Grapple
\-------------------X-Ray

So, it's no need to join 2 items to have place for a new one.

Damski

Quote from: JAM on March 23, 2012, 07:25:47 PM
Actually, you can have 5 more items in your hack. Every item use a single bit at RAM address 7E:09A2 / 7E:09A4. Word contains of 2 bytes (or 16 bits).

Quote from Kej docs:
Quote
Item Array
7E:09A2/09A4
0000 0000 0000 0000
||||  ||||  ||||  |||\Varia
||||  ||||  ||||  ||\-Spring Ball
||||  ||||  ||||  |\--Morphing Ball
||||  ||||  ||||  \---Screw Attack
||||  ||||  ||||
||||  ||||  |||\-----Unused (1)
||||  ||||  ||\------Gravity Suit
||||  ||||  |\-------Unused (2)
||||  ||||  \--------Unused (3)
||||  ||||
||||  |||\-----------High Jump
||||  ||\------------Space Jump
||||  |\-------------Unused (4)
||||  \--------------Unused (5)
||||
|||\----------------Bomb
||\-----------------Speed Booster
|\------------------Grapple
\-------------------X-Ray

Does this need asm to work?

Prime Hunter

#21
Well no, I didn't need to combine Screw Attack and Space Jump together but it works for my plans by having them as one and it has the added benefit of opening up an item slot for something else I'm already planning on using. To me it seems far simpler to just hijack that freed item, one that has everything in place and is already proven to work, and modify it to fit my needs than to add in a new item entirely. Of course that may not be true for someone with a more advanced knowledge of ASM than I have, but for me it works.


But yeah, I'd assume adding in items would require ASM. If I'm understanding all of this properly, you would need to add in additional routines and item checks on top of the code for the new item itself and that seems a bit more complex than just modifying something that's already there.