Editing base bomb & arrow capacity (LTTP)

Go down

Editing base bomb & arrow capacity (LTTP) Empty Editing base bomb & arrow capacity (LTTP)

Post by slartifer Thu 31 Aug 2017 - 20:02

Hi all,

An idea I've been playing around with, as part of a hack, is to prevent the use of bombs until they are unlocked by "finding" them. The simplest way to do this seems to be to set base bomb capacity to 0 (rather than 10) and then having a capacity upgrade as an item (as is done in the Randomizer -- that part's easy enough).

I'm wondering if anyone has mucked around with this, and can point me to the right part of the code. Presumably the cap is only checked when Link procures up a bomb refill, so this could be a simple edit.

Thanks in advance if anyone can point me to the right place!

slartifer
Bee
Bee

Since : 2017-08-31

Back to top Go down

Editing base bomb & arrow capacity (LTTP) Empty Re: Editing base bomb & arrow capacity (LTTP)

Post by slartifer Thu 31 Aug 2017 - 20:37

So, I answered my own question, but maybe this will be useful info for someone else. This was very easy. The bomb capacity upgrade number (0 through 7, internally) is actually a pointer to a simple table of maximum capacity values.

In the Japanese ROM I'm using it starts at 0x6DB48. (The similar arrow table is at 0x6DB58.) But you can also find it the same way I did, by just searching for possible bomb capacity values in sequence (0A0F1419...)

slartifer
Bee
Bee

Since : 2017-08-31

Back to top Go down

Editing base bomb & arrow capacity (LTTP) Empty Re: Editing base bomb & arrow capacity (LTTP)

Post by Schicksal88 Sat 9 Sep 2017 - 2:46

Did you make it work?
I'am kinda stuck right now. My plan was to set the "0x28" chestitem into a item that increases your max bombs instead of your current bombs.

But I can't find the address of the code that gets executed after the game checked if it is "0x28" to hook my own code into it.

The only things I could figure out are:

7E/F343: current bomb amount in ram

7E/F370: current bomb "upgrade" value, gets incremented by 1 to read the next value as maximum bombs at 0x6DB48

7E/02D8 = ram address with chestitemID that gets read after you open a chest

Schicksal88
Bee
Bee

Since : 2015-07-22

Back to top Go down

Editing base bomb & arrow capacity (LTTP) Empty Re: Editing base bomb & arrow capacity (LTTP)

Post by Puzzledude Sat 9 Sep 2017 - 7:47

But I can't find the address of the code that gets executed after the game checked if it is "0x28" to hook my own code into it.
Long story short, you can't. At least not like you want it. The entire chest-content has only 1 pointer (primary code), from which it then jumps to all chests content. However, this is still doable the different way, since I've done something similar a while back. You hook at the pointer for the entire chest code. Once you jump to your custom code, you repeat the old values, but the difference is, that the simple ASM takes into consideration 2 possibilities: if your specific item in inventory, then execute something new, otherwise: repeat old code/pointer.

This basically means you can hook here based on what you want. Thus you can make your bomb upgrade to be item dependent. However the item choosen must be unique (not sure what happens if it is not and thus gained twice).

For instance: when gaining the Lamp, you can then set it to: if gain Lamp, than increase max bomb capacity from 10 to 30. While the hook is set at the pointer for chest content, which surely executes, since when gaining the Lamp a chest needs to be opened first.


I'am kinda stuck right now. My plan was to set the "0x28" chestitem into a item that increases your max bombs instead of your current bombs.
This however is possible only with a bit more advanced ASM, as opposed if you choose the previous strategy, since item 28 (hex) is 40 dec is 3 bombs, which essentially is a sprite. You would have to then recode this sprite, which is not recomended to do.
Puzzledude
Puzzledude

Editing base bomb & arrow capacity (LTTP) Image213

Since : 2012-06-20

Back to top Go down

Editing base bomb & arrow capacity (LTTP) Empty Re: Editing base bomb & arrow capacity (LTTP)

Post by slartifer Sat 9 Sep 2017 - 8:56

One other thing I ran into, to be aware of: if you change the base bomb (or arrow) capacity to be 0, the game will respect this in certain instances (like if you try to buy bombs from a shop), but bombs/arrows that appear as enemy drops or under pots will add to your current quantity as if there is no limit.

Presumably this could be fixed with an ASM modification. I looked at the part of the code that handles it and, frankly, there was too much spaghetti for me at least to wade through Very Happy

slartifer
Bee
Bee

Since : 2017-08-31

Back to top Go down

Editing base bomb & arrow capacity (LTTP) Empty Re: Editing base bomb & arrow capacity (LTTP)

Post by Schicksal88 Tue 12 Sep 2017 - 1:43

Okay thanks for the reply you two. I hoped that somewhere is a simple
if chestitem == 00, jump to 0x___,
if chestitem == 01 jump to 0x____
and so on.
I had something like LDA 7E/D208, CMP 0x28, BEQ 0x____ in mind, couldn't find anything like that.

Writing the code for one specific chest item would have been possible, but understanding the entire routine and changing it to my likings is a little bit too much especially because the game is jumping around like crazy just to increase your bombs by 1. Smile

Anyway, thanks for the info.

Schicksal88
Bee
Bee

Since : 2015-07-22

Back to top Go down

Editing base bomb & arrow capacity (LTTP) Empty Re: Editing base bomb & arrow capacity (LTTP)

Post by Puzzledude Tue 12 Sep 2017 - 6:48

Okay thanks for the reply you two. I hoped that somewhere is a simple
if chestitem == 00, jump to 0x___,
if chestitem == 01 jump to 0x____
and so on.
Unfortunately it is actually:
if opening any chest, jump to choosen address, and read the content of all chest items for all chests, but then: load current room number and compare it to the code: when found, read next byte for which chest item to load. If two chests in one room, the chest number 1 is the one first in the hex code (for both: object code and chest content code). If +80 on the first byte of the room value, then the chest is a big chest, thus load the ram for big key etc.
Puzzledude
Puzzledude

Editing base bomb & arrow capacity (LTTP) Image213

Since : 2012-06-20

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum