Looking to modify the Hearts HUD (Health meter)

Go down

Looking to modify the Hearts HUD (Health meter) Empty Looking to modify the Hearts HUD (Health meter)

Post by aacroke Wed 14 Sep 2016 - 3:01

I'm looking to make a rebalanced version, and increase the amount of findables/collectibles in Zelda 3. To that end, I'm first looking to increase the number of full Hearts Link can carry from 20 to 30, and have the extra row of hearts displayed in the HUD.

I intend to add an additional 8 heart pieces and 8 heart containers to be found at various locations to bring the total to 30.

Lastly (and I really want to know this one for other hacks), I want to modify the game such that loading from a saved file starts Link with full health instead of half.

What do I need to do to achieve this? I'm fairly new to ROM hacking and unfamiliar with ASM, but willing to learn what I need to know.

P.S.: Would Faeries/Medicines/etc. need to be modified to refill to 30 or do they refill to a variable max? I just want to make sure I don't miss anything.

aacroke
Bee
Bee

Since : 2016-09-14

Back to top Go down

Looking to modify the Hearts HUD (Health meter) Empty Re: Looking to modify the Hearts HUD (Health meter)

Post by Conn Wed 14 Sep 2016 - 6:36

Hearts are saved on 7ef36b, each heart adds 08, giving a max of d20, in hex: h14*h08=hA0.
You need to increase this to hF0=d30; adding another row in the hud should be do-able...

Without having ever done asm, this is hardly to reach for you I think Sad
Conn
Conn

Looking to modify the Hearts HUD (Health meter) Image212

Since : 2013-06-30

Back to top Go down

Looking to modify the Hearts HUD (Health meter) Empty Re: Looking to modify the Hearts HUD (Health meter)

Post by Puzzledude Wed 14 Sep 2016 - 7:17

I'm looking to make a rebalanced version, and increase the amount of findables/collectibles in Zelda 3. To that end, I'm first looking to increase the number of full Hearts Link can carry from 20 to 30, and have the extra row of hearts displayed in the HUD.
adding another row in the hud should be do-able...
Not really. I tried this once and it seems, no matter what you do, the game will simply not allow the max value to exceed 22 hearts. When you go beyond this value, the game will bug out, despite the fact you would enter the new max health value correctly.

This also brings some serious problems to the Player select screen. Adding a new row might be doable in the ingame HUD, but certainly not in the Player select screen, since there is no phisical room to display it - not even for one file, imagine on 3 files, which thus means you would need room for 9 rows, while the original is made for 6 (which again bugs the game out).

There will also be severe problems with the Fairy/medicine, since when you exceed 22 hearts, the game will think the value beyond that is a negative value. For instance 25 is cosidered as -3 for the game.

This basically means the Fairy health can be adopted to refil 20 hearts, but the game will again not bug out only when the counter reaches 20 as max, same with potions.

Not to mention what would happen, if you were to fall down the pit on 25 hearts, since the instruction is to take one heart away, -3 -1= -4. So when you have 25 hearts and fall down the pit, you would be instantly dead (this was tested) by default programing in Alttp.

Studying the game's code, you can clearly see, that the game is stuck on 20 hearts max, while the fairy (at least the resurrecting one) must always give exactly 7 hearts. If you change this to for instance 14, until the later 7 are filled, Link will float in the air (display bug). If you change this to 3 (or less than 7) its a perma-stuck bug.

It would need some serious ASM workarounds to change the max health from 20 hearts to 30 hearts, while this is altogether not recomended. And all together questionable if this is in fact possible, since like said the game thinks the value, which should be 25 hearts, is actually -3 in its book, while the value is completely valid and should be recognized as 25. But for some reason it can correctly recognize the values 21 and 22, but not beyond.
Puzzledude
Puzzledude

Looking to modify the Hearts HUD (Health meter) Image213

Since : 2012-06-20

Back to top Go down

Looking to modify the Hearts HUD (Health meter) Empty Re: Looking to modify the Hearts HUD (Health meter)

Post by aacroke Wed 14 Sep 2016 - 8:34

I had pretty much assumed it would be nightmarish-to-impossible. Thanks for the info!

the game will simply not allow the max value to exceed 22 hearts

How about 22 hearts? There seems to be enough room on the HUD and on the file loading screen to fit an eleventh heart in each row. How can I make it draw the extra two hearts?

As well, is there anything special I need to do before simply plunking 8 more heart pieces into various maps in Hyrule Magic?

And lastly, I'd still love to know how to make save files load with full health if possible.

aacroke
Bee
Bee

Since : 2016-09-14

Back to top Go down

Looking to modify the Hearts HUD (Health meter) Empty Re: Looking to modify the Hearts HUD (Health meter)

Post by Puzzledude Wed 14 Sep 2016 - 9:06

As well, is there anything special I need to do before simply plunking 8 more heart pieces into various maps in Hyrule Magic?
Not really. You can not just add heartpieces or containers. If you have 20 heart containers and get another heart container, the game will automatically know to go to NOP (no operation), since it would otherwise bug itself. Original authors made this NOP to debug the game.

To increase your max energy, the quickest way is to hack into the starting RAM, which will then go to Save-RAM automatically.

Go to hex address (no header) 274F2 and change the bytes from 18 18 to A8 A8. Ie 21 hearts, and go over this number: A8 A8 for 21, B0 B0 for 22, and further B8 B8 for 23, C0 C0 for 24 etc to F0 F0= 30.

I retested this, only 21 works, the rest doesn't and it will bug the game. So the game can only handle 21 hearts and not beyond (since beyond is a negative value for the game, ie instant death).

To be able to receive the 21th heart after you have 20, will require ASM (since this was made sure to go to NOP), to write this additional heart in the first ir second row and not third, will also require ASM.

Speaking in general, A link to the past is coded in such a way, that it will not allow you to have more than 20 heart containers.

Example of forced out 30 hearts:
Looking to modify the Hearts HUD (Health meter) Z3767

Example of instant death with 2 hearts disappearing in the HUD:
Looking to modify the Hearts HUD (Health meter) Z3857

And lastly, I'd still love to know how to make save files load with full health if possible.
This was not yet documented, but it should be an easy hex fix after the tracing is done. This will again need an ASM person.
Puzzledude
Puzzledude

Looking to modify the Hearts HUD (Health meter) Image213

Since : 2012-06-20

Back to top Go down

Looking to modify the Hearts HUD (Health meter) Empty Re: Looking to modify the Hearts HUD (Health meter)

Post by aacroke Wed 14 Sep 2016 - 9:20

Thanks a lot, I really appreciate all of the information you provided.

We can't always get what we want with this kind of stuff, but it's nice to know there are people who will help to explain why rather than exercising douchebaggotry.

Thanks again to Puzzledude!

aacroke
Bee
Bee

Since : 2016-09-14

Back to top Go down

Looking to modify the Hearts HUD (Health meter) Empty Re: Looking to modify the Hearts HUD (Health meter)

Post by Puzzledude Wed 14 Sep 2016 - 10:42

I was tempted to make 30 hearts as well back in the day specially after this:
Looking to modify the Hearts HUD (Health meter) Z3767

But unfortunately the game doesn't see it the way a human does. In theory this byte (originally 08) can obviously go to FF. So max (in theory) would be F8 (=31 hearts), before it would have to swap to a 2byte value. Strangly the game does not see B0 correctly.

This is how the game sees it: byte 08 to A8 (from 1 to 21 hearts), B0 to F8 (should be from 22 to 31, but is in fact -1 to -10 hearts). Who knows what Nintendo was thinking/programming here. I guess they never bothered to solve this problem, but they did mannage to make the 21st heart to work for some reason.

By the way, original authors could re-make the game to be able to have 30 hearts, but that would in fact be a lot of work, debugging and testing.
Puzzledude
Puzzledude

Looking to modify the Hearts HUD (Health meter) Image213

Since : 2012-06-20

Back to top Go down

Looking to modify the Hearts HUD (Health meter) Empty Re: Looking to modify the Hearts HUD (Health meter)

Post by Puzzledude Wed 14 Sep 2016 - 10:56

Lastly (and I really want to know this one for other hacks), I want to modify the game such that loading from a saved file starts Link with full health instead of half.
This is what you should concentrate and maybe ask Conn if he is willing to look into this (if he indeed has the time), since there are very few people able to tackle with tracing and ASM, and are obviously not always ready to do tasks.

I'm guessing this should not be a lot of work, probably a byte or two telling the game how much to reduce from the full health after starting the game (after defeat or save and quit).

However the trick with hex editing is actually finding the code, editing is not really a problem, specially if only one or two instructions are to be modified.

Like this for instance (found by Conn):
4F413: F0 --> 80.
Instead of "branch if fairy in bottle" rather "branch always".
Which basically means unlimited Fairy resurrection (ie God mode), despite not having any Fairies at all.

Flying fairy gives more hearts:
351AC: 38 --> A0 (20 hearts, instead of 7)

Resurrecting fairy gives more hearts:
4F6A9: 38 --> A0 (20 hearts, instead of 7)
partial bug though (Link floats in the air while receiving hearts 8-20), but then he can continue though.
Puzzledude
Puzzledude

Looking to modify the Hearts HUD (Health meter) Image213

Since : 2012-06-20

Back to top Go down

Looking to modify the Hearts HUD (Health meter) Empty Re: Looking to modify the Hearts HUD (Health meter)

Post by aacroke Thu 15 Sep 2016 - 12:58

I'm going to take that one question and open a thread with it so anyone can contribute.

Thanks again!

aacroke
Bee
Bee

Since : 2016-09-14

Back to top Go down

Back to top

- Similar topics

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