News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Poll

What should the new name for the "Spell" spell be?

Reveal
5 (21.7%)
Unveil
4 (17.4%)
Enigma
9 (39.1%)
Expose
5 (21.7%)

Total Members Voted: 23

Author Topic: Zelda II Redux  (Read 96236 times)

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Zelda II Redux
« Reply #360 on: January 31, 2019, 01:02:06 pm »
What would happen if you moved the boss health-bar up by one tile (Y-8)?
Wouldn’t that solve it?

/dACE
Tried that, but if you move the Y position of the health bar, the WHOLE health bar moves, that means both red and white tiles as a single object.

IcePenguin

  • RHDN Patreon Supporter!
  • Sr. Member
  • *****
  • Posts: 265
    • View Profile
Re: Zelda II Redux
« Reply #361 on: January 31, 2019, 05:38:10 pm »
Here is what I recommend.  If you are willing to adjust enemy exp, this will work.  Also, I think the exp values are more accurate this way because the blue fokka in the great palace should have more than 100 exp.  It's the toughest enemy!  :P

So here is my solution.  Only 3 enemies in the game use the "7" in the tiles for the pop up exp after being killed.  Blue Stalfos Knight, Red Fokka, and Barba Boss.  If you made the following changes, it would free up the "7" tiles highlighted with red in the image:



Then change Barba to give 1000exp, and Thunderbird 1500exp (should be higher than Barba, I think), and then update the pop up exp tiles accordingly for all of these enemies.  I'm sure no one would mind getting more exp, ha ha.  Anyway, that's just one solution.  It's simple, and comes with positives.  (extra exp)

Vanya

  • Hero Member
  • *****
  • Posts: 1380
    • View Profile
Re: Zelda II Redux
« Reply #362 on: January 31, 2019, 06:49:20 pm »
:pops head in:
Or you could just eliminate the pop up numbers entirely?
:runs back home:

Trax

  • Sr. Member
  • ****
  • Posts: 489
    • View Profile
    • Trax ROM Hacking
Re: Zelda II Redux
« Reply #363 on: January 31, 2019, 10:04:44 pm »
The white bar trick is not dark magic, it's just because sprites always use two tiles, n and n+1. What IcePenguin did is, he set the white box graphic as the top tile (the n tile) and an empty (transparent) graphic as the bottom tile (the n+1 tile). It's clever, it works for the HUD, but since it has a side effect elsewhere, it's not ideal. The reason the Boss Meter is displaced is because it's made of sprites, and not part of the background. The white meter portion uses the same offset as the magic box, so it's shifted up.

The original code lays out the red and white boxes as the same Y position, but different X positions. What we want here is exactly the opposite: same X, different Y. Likely, the code could be modified without even having to bridge.

IcePenguin

  • RHDN Patreon Supporter!
  • Sr. Member
  • *****
  • Posts: 265
    • View Profile
Re: Zelda II Redux
« Reply #364 on: January 31, 2019, 11:36:36 pm »
:pops head in:
Or you could just eliminate the pop up numbers entirely?
:runs back home:

That would certainly create a lot of free space!   :laugh:


The white bar trick is not dark magic, it's just because sprites always use two tiles, n and n+1. What IcePenguin did is, he set the white box graphic as the top tile (the n tile) and an empty (transparent) graphic as the bottom tile (the n+1 tile). It's clever, it works for the HUD, but since it has a side effect elsewhere, it's not ideal. The reason the Boss Meter is displaced is because it's made of sprites, and not part of the background. The white meter portion uses the same offset as the magic box, so it's shifted up.

The original code lays out the red and white boxes as the same Y position, but different X positions. What we want here is exactly the opposite: same X, different Y. Likely, the code could be modified without even having to bridge.

Do they have a Y position value?  I'm not doubting you, or anything, since you're extremely knowledgeable when it comes to Zelda II.   In an earlier post I made, I even mentioned something about the magic tile and health tile sharing the same Y value, but I'm not so sure it works that way.  Please correct me if I'm wrong.  :)

With every element in the HUD, there has only been data to indicate an X position.  For things like the life stat, magic meter, etc.  if it goes beyond a certain X position, it is shifted down to the next line in the HUD.  However, with the magic tile and health tile, it simply wraps to the other side of the screen without shifting down.  So I'm thinking there may be no Y position in the traditional sense, and they would instead have to be changed to work the same way as everything else, and shift down when exceeding a certain X position.
« Last Edit: February 01, 2019, 01:45:06 am by IcePenguin »

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Zelda II Redux
« Reply #365 on: February 01, 2019, 12:02:43 am »
Do they have a Y position value?  I'm not doubting you, or anything, since you're extremely knowledgeable when it comes to Zelda II.   In an earlier post I made, I even mentioned something about the magic tile and health tile sharing the same Y value, but I'm not so sure it works that way.  Please correct me if I'm wrong.  :)

With every element in the HUD, there has only been data to indicate an X position.  For things like the life stat, magic meter, etc.  if it goes beyond a certain X position, it is shifted down to the next line in the HUD.  However, with the magic tile and health tile, it simply wraps to the other side of the screen without shifting down.  So I'm thinking there may be no Y position in the traditional sense, and they would instead have to be changed to work the same way as everything else, and shift down when exceeding a certain X position.

Oh the 7 exp number sure is an interesting idea, and quite feasible, although it sacrifices some balancing.
I'll keep it in mind :)
I will play around with it next week for sure!

As for what Trax mentioned, he did make a post about it some pages ago, here:

As for the white Magic square, it's actually a sprite that is drawn in the background (there's a sprite attribute for that), and serves as the last container that is not full or empty. Full and empty containers are drawn as background tiles. Same for the Life square. These sprites move leftward as you take damage or consume magic, and rightward as you gain them.

I checked the code starting from the offset you gave me, and the code that sets the two sprites is a little further, starting at $17BB. There are 4 values written in sequence starting from $02F8 (this address is in a 2-byte table just before this routine, at $17B9), using the command STA ($00),Y. First value is 0F, which is the Y position of the sprites. This is your problem. The original game uses the same Y position for both. Your setup doesn't.

Second value is the tile code, taken from $1689 (70) or $168A (6E), depending of whether you're drawing Life or Magic. Third value is 0x21, which is the sprite attributes, and it sets the palette to 01 and activates the flag to draw the sprite in the background. Fourth value is the X position, taken from $168B or $168C, plus the value of the last unit of the meter.

Ideally, you'd have to rewrite the routine in a way that swaps the operations for X and Y positions. Your case has X position the same for both, so it would be hard-coded, and Y position different for each meter, so it would be taken from the table.

His idea about swapping the X position in the code for the Y position instead is pretty interesting, but I couldn't follow on with that one due to my limited knowledge in assembly :/
But it would be a nice thing to revisit for sure!
« Last Edit: February 01, 2019, 10:13:13 am by ShadowOne333 »

IcePenguin

  • RHDN Patreon Supporter!
  • Sr. Member
  • *****
  • Posts: 265
    • View Profile
Re: Zelda II Redux
« Reply #366 on: February 01, 2019, 01:43:12 am »
Thanks for re-posting Trax's post.  Now I understand.  The solution is simple!

At 0x17DF you have this data:

AA A9 0F

This is using the immediate value of 0F for both Y positions.  So let's change that, and point the data elsewhere.  Something you've probably done many times now, ha ha.

Replace it with BD B0 A8 (or any other address with free space).

For my example, I'm pointing to 0x28C0 and adding:

08 0F

Both tiles will have their own Y position.  The first byte is used by the magic tile, and the second is used by the health tile.  Thanks to Trax for the great info!   :)

Here is an image to show the result.  (no tile editing done)  I used Y positions 08 0C in the screenshot, but you'll want to use 08 0F which is the desired position you are looking for.
« Last Edit: February 01, 2019, 01:50:56 am by IcePenguin »

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Zelda II Redux
« Reply #367 on: February 01, 2019, 12:11:56 pm »
That...
Worked :D



Thank you so much, Trax and IcePenguin!

I never would have thought about making that one a BD opcode, that was nice :)
I moved the position values to address 0x2B80 (or $AB70), alongside the new repointed table for the HUD Exp stuff.

All in all, everything should be working properly now :)
So with that said...

Here's the latest beta patch:
https://www.dropbox.com/s/5dbq6pl321fj2dh/Zelda2Redux.ips?dl=0


This might be one of the very last betas before release.
Hopefully nothing goes out of place. :P

As always, let me know if there's something off or anything, so I can take a look at it and fix it asap.
With the latest changes done to the HUD, as like the white/red tiles positions, and the repointing of something like the Life meter + Exp counter, I think redrawing the HUD yet again might be now feasible.
I will try to do what I tried to do some months ago:

This is a quick comparison of what I could do in-game compared to what my mockup was:
                       In-game                             /                         Mockup



Now there are some particular problems in this:
  • The same issue with one of the meter bars moving only in an X position
  • The PPU tilemap for the life meter is tied with the Exp zeroes. This is why they always tend to show up right next to each other.
  • The PPU tilemap for the magic meter is tied with the number for the Life level, hence why the magic bar begins at the very edge of the screen in my test.
  • Given the previous issue with the Magic meter, the "M" might disappear due to overscan and on CRT monitors.

I tried to locate the part of the code where it loads the tables for the tile mappings, and found it at $16BD and $172E.
So, went ahead and reimplemented the tilemaps for those two in free-space, and tried separating them into proper tile maps in the AA BB XX format for each section, but i think this goes way beyond that, since the code I believe expects them to be right next to each other and with a set number of bytes, otherwise they won't be separated from each other.

Hopefully this time I will be able to replicate the mockup :)

In the meanwhile, enjoy the beta!
« Last Edit: February 01, 2019, 12:22:08 pm by ShadowOne333 »

darthvaderx

  • Full Member
  • ***
  • Posts: 121
    • View Profile
Re: Zelda II Redux
« Reply #368 on: February 01, 2019, 12:45:22 pm »

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Zelda II Redux
« Reply #369 on: February 01, 2019, 12:48:06 pm »
Opss, wrong patch, the rom remains unchanged.
Oops, I used the hacked ROM as the base and the clean ROM as the target.
Sorry ;D

Download it again from the same link, it should be the proper patch now.

IcePenguin

  • RHDN Patreon Supporter!
  • Sr. Member
  • *****
  • Posts: 265
    • View Profile
Re: Zelda II Redux
« Reply #370 on: February 01, 2019, 02:37:39 pm »
Your mock up looks really cool!  However, if you're doing what I think you're doing, you may need to extend the block of code for the magic meter and attack stat as well.

This is a quick comparison of what I could do in-game compared to what my mockup was:

                       In-game                             /                         Mockup




Now there are some particular problems in this:
  • The same issue with one of the meter bars moving only in an X position
  • The PPU tilemap for the life meter is tied with the Exp zeroes. This is why they always tend to show up right next to each other.
  • The PPU tilemap for the magic meter is tied with the number for the Life level, hence why the magic bar begins at the very edge of the screen in my test.
  • Given the previous issue with the Magic meter, the "M" might disappear due to overscan and on CRT monitors.

I'm assuming you'll use the screen wrap to get the attack stat on the opposite side of the screen from the magic meter?  They are connected by default, similar to the health and exp counter.  So I'll just preemptively post this, just in case that's what you are doing.  If it isn't just ignore me.  Ha ha.

Edit:  I didn't scroll far enough in your quote to see that you attempted to re-locate them and separate them.  Oops!  So again, if you found a solution already just ignore me.  :P  I will still leave this info here, in case others want to use it.



So with this screenshot, you have to extend the range of tiles for the attack stat and magic meter, then shift the magic meter over 1 space.  At 0x16D6, change 13 to 14, and then move the position of the magic meter from 0C to 0D.  Now being 2 spaces apart, this will allow you to get the screen wrap without the magic meter being right on the edge and be affected by overscan.  With the health meter and exp counter re-located, you should be able to extend it at its original location with no issue.  :)

« Last Edit: February 01, 2019, 02:57:41 pm by IcePenguin »

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Zelda II Redux
« Reply #371 on: February 01, 2019, 02:58:01 pm »
Right as you posted I was about to post this image in-game :D



I did manage to figure it out on my own, based on the previous positions of the Life meter and your explanation of it, it went rather smooth I gotta say :)
But still, the info you shared might help others if they want to implement it too! Thanks!

The game locks-up if you have no tile with pixels at position 6D.
You can move around the "L" for the Life, as long as you have another tile with pixels in position 6D.
It looks off-center, but that's because the dash from the "-EXP-" needs to go at 6D, otherwise the game locks.

I know Trax has told me several times not to move that tile, but I just want to mess around with it and see if I can pull a full playthrough of the game this way. ;D

Also, another side effect of this, is that after the red line below the "-EXP-", every blue pixel from below the letters "EXP" tend to move to the left when walking. It's pretty minor, but I assume it has to do with the Sprite Zero synchronization Trax told me about.
I can work around this issue by making a custom font that leaves the very last row of pixels free.
Something like this 7 pixels font I made:


I will see if I can manage to get the "-EXP-" working somehow so it looks centered, but so far it's looking pretty damn amazing :)
« Last Edit: February 01, 2019, 03:18:18 pm by ShadowOne333 »

IcePenguin

  • RHDN Patreon Supporter!
  • Sr. Member
  • *****
  • Posts: 265
    • View Profile
Re: Zelda II Redux
« Reply #372 on: February 01, 2019, 03:33:09 pm »
Looks great for sure!  Here is a simple solution to the sprite zero.

Tile edit it!  It's what I did in Shadow of Night.  I just tested your new HUD with it (quickly recreated it), and it works.

Simply reduce sprite zero to 1 pixel.  It will still overlap with the "E" in your "-EXP-" so it works as intended, all while being hidden.  Again, I did this in Shadow of Night, and there were no negative side effects.  :)



Edit:  Just to clarify a bit on what you said, you don't necessarily need anything in position 6D.  As long as something in the HUD has collision with sprite zero it will work.  So luckily, sprite zero is positioned in such a way to be in position 6D and 6E.  I'm sure there is an X position for sprite zero, but I think it'd be risky to move it as Trax said not to.  So a simple tile edit will get the job done, without all that extra work and testing.
« Last Edit: February 01, 2019, 04:27:42 pm by IcePenguin »

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Zelda II Redux
« Reply #373 on: February 01, 2019, 05:53:20 pm »
Looks great for sure!  Here is a simple solution to the sprite zero.

Tile edit it!  It's what I did in Shadow of Night.  I just tested your new HUD with it (quickly recreated it), and it works.

Simply reduce sprite zero to 1 pixel.  It will still overlap with the "E" in your "-EXP-" so it works as intended, all while being hidden.  Again, I did this in Shadow of Night, and there were no negative side effects.  :)



Edit:  Just to clarify a bit on what you said, you don't necessarily need anything in position 6D.  As long as something in the HUD has collision with sprite zero it will work.  So luckily, sprite zero is positioned in such a way to be in position 6D and 6E.  I'm sure there is an X position for sprite zero, but I think it'd be risky to move it as Trax said not to.  So a simple tile edit will get the job done, without all that extra work and testing.

Oh neat!
I didn't know the Sprite zero thing had its own tile ID, I couldn't even see it because it kinda meshed with the "5" :P
I already changed it to one pixel, and seems to work fine!

As for your edit, you are correct.
As long as the pixel itself has collision with another pixel from another tile, it should work fine.
I can move the "-EXP-" to 6E just fine if I replace the dash "-" with some other tile that has a pixel colliding with the Zero sprite. Interesting stuff indeed.

Here's the latest beta yet again with the latest changes:
https://www.dropbox.com/s/5dbq6pl321fj2dh/Zelda2Redux.ips?dl=0


I will try and see if I can still center the "-EXP-" by one tile to the right, if not, I might leave it like that.
It doesn't hurt at all like it is, and doesn't look bad if we compare it to how horrible the original HUD was. xD



This is getting close to completion!
As it is, it can be released right now.

However, I do want to hold off to see if I can somehow add the "PAUSE" message on the overworld.
The simple letters might do, just to make sure the player can have some visual feedback when the game is paused in the overworld.
I will also attempt to replicate the Pause Pane menu from Shadow of Night, but that is not priority, just for shits and giggles if I can. :P

Here's a comparison for those curious:
Spoiler:



« Last Edit: February 01, 2019, 06:01:22 pm by ShadowOne333 »

IcePenguin

  • RHDN Patreon Supporter!
  • Sr. Member
  • *****
  • Posts: 265
    • View Profile
Re: Zelda II Redux
« Reply #374 on: February 01, 2019, 07:56:17 pm »
If you do plan to re-create the inventory screen from Shadow of Night, you'd be able to free up the gfx tile that uses the "x" for lives, keys, and crystals.  Then you could possibly design a fancy symmetrical border (instead of just using a "-") that could surround the "EXP" and "LEVEL" in the HUD, while retaining collision with the zero sprite.  Oh, and it could be centered as you wanted.

I whipped up some examples just for fun, haha.  Hope you don't mind!  There's so much you could do to cover up the zero sprite, while making it look nice and clean.  Of course if you plan to keep the "-" tile, still looks good that way.  Just a thought...   :)



About the pause display, I can look into it.  Back in the day, JaSp created something similar in his SMB3 hack.  At the time, he was helping me implement that into a Zelda II hack I was working on.  If I can find it, I'll let you know.

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Zelda II Redux
« Reply #375 on: February 05, 2019, 06:03:47 pm »
Thanks for the idea, IcePenguin!
I managed to make some workaround for it, and made a couple of triangles which point to each other (first image is where you can see it as it is right now, the second and third image were captured before I changed the tile mapping :P)

Managed to revamp the whole Pause panes, both for the Spell menu and the Level Up menu, now they look really nice :)
I also went ahead and covered some points Trax made a while back about some spells consuming odd numbers for magic, now they should all consume amounts in multiples of 4. (4, 8, 12, 16, 20, etc).

Some screenshots:


Here's the latest patch:
https://www.dropbox.com/s/5dbq6pl321fj2dh/Zelda2Redux.ips?dl=0



So what's left?
  • The very last thing to hopefully implement would be the PAUSE message on the overworld, maybe something similar to what the Spell pane does when called, but perhaps in a much more simple way, and also adding a check for when Link is in the overworld or in sideview (I believe the game DOES some kind of check of this kind, to know when to open the Spell menu or not)
  • If you try the latest beta, you might notice that you can now move in the File Selection menu with the Up/Down buttons in the D-Pad. I tried to make this work in a way that UP moves the Fairy cursor up, and DOWN moves it down (duh), but right now both UP and DOWN do the same (and that is go down for both inputs). This is implemented for both the File Selection menu and also the Register Name one. If I can manage to make the UP and DOWN inputs work independently of each other, that'd be very nice :P I'm working on it at the moment.

    The offsets are:
    File Select Screen (0x17313), Register Your Name (0x176BC) and in Game Over Screen (0x1CA95).
    Unused space is at 0x17db1 ($BDA1)


    The opcodes are the AND $20 [29 20], I changed those for 29 2C so the UP and DOWN inputs work as the Select button too, except for the Game Over screen, where it has [29 30], and it doesn't matter what I change those to, they don't respond to anything else other than Start and Select (tried 3C in there but nothing).

As always, let me know if there is something odd!
« Last Edit: February 06, 2019, 04:36:45 pm by ShadowOne333 »

IcePenguin

  • RHDN Patreon Supporter!
  • Sr. Member
  • *****
  • Posts: 265
    • View Profile
Re: Zelda II Redux
« Reply #376 on: February 05, 2019, 07:06:18 pm »
One thing I noticed in your latest update is the shield icon (life) in the file select menu is different than the one in the game.  Didn't notice that in previous builds.  Is this intended?  Seems odd, but it's not a big deal.

Also, I have one major recommendation for your hack.  It's simple enough to change, but it makes a huge difference.  Increase the speed of the sword beam and fire spell.  They share the same data for speed, so you'd have to increase both - which is great thing.

The data for this is at 0x1829.

20 E0

20 is the right-directional speed, and E0 is the left-directional speed.  I suggest changing it to 30 D0.  It'll move much faster, and as a result travel a bit farther.  A much desired improvement, I believe.  :)

Also, live the new triangle tile for the "-" in the HUD.  Fits well!

njosro

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Zelda II Redux
« Reply #377 on: February 05, 2019, 07:36:37 pm »
Great work! I noticed in the second two screenshots that the arrows surrounding EXP and LEVEL both point to the right. Not sure if that matters. Edit: Oh I see IcePenguin has spotted it too!

As for the cursor on the file select screen, I looked at the code in that area, and it looks like you'd need to jsr to free space if the up button is detected and copy the existing section of code into the free space but tweak it so that it moves the cursor up. I say this because the code to move it down contains instructions for skipping inactive files, wrapping back to the top after the elimination mode option, etc. It's all for the downward direction. With the space limitations, it's easier to add separate code for up than to add additional branching paths to the existing code. Imho, it's more effort than it's worth, but maybe someone could find a different approach...

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1141
    • View Profile
Re: Zelda II Redux
« Reply #378 on: February 06, 2019, 11:10:09 am »
One thing I noticed in your latest update is the shield icon (life) in the file select menu is different than the one in the game.  Didn't notice that in previous builds.  Is this intended?  Seems odd, but it's not a big deal.

Also, I have one major recommendation for your hack.  It's simple enough to change, but it makes a huge difference.  Increase the speed of the sword beam and fire spell.  They share the same data for speed, so you'd have to increase both - which is great thing.

The data for this is at 0x1829.

20 E0

20 is the right-directional speed, and E0 is the left-directional speed.  I suggest changing it to 30 D0.  It'll move much faster, and as a result travel a bit farther.  A much desired improvement, I believe.  :)

Also, like the new triangle tile for the "-" in the HUD.  Fits well!

Oh you're correct.
I forgot to copy the new shield graphic to all banks.
Just did that, the new graphic should now appear in all banks.

Also, thanks for that tip!
I really didn't even think about that one. I made the change already :P
Thanks for that!

Great work! I noticed in the second two screenshots that the arrows surrounding EXP and LEVEL both point to the right. Not sure if that matters. Edit: Oh I see IcePenguin has spotted it too!

As for the cursor on the file select screen, I looked at the code in that area, and it looks like you'd need to jsr to free space if the up button is detected and copy the existing section of code into the free space but tweak it so that it moves the cursor up. I say this because the code to move it down contains instructions for skipping inactive files, wrapping back to the top after the elimination mode option, etc. It's all for the downward direction. With the space limitations, it's easier to add separate code for up than to add additional branching paths to the existing code. Imho, it's more effort than it's worth, but maybe someone could find a different approach...

Oh that is just because I took the 2nd and 3rd pic before I made the appropriate change for the arrows.
If you check the 1st image (in Zelda's Chamber) you will notice the two arrows are pointing correctly, I just forgot to take new pics for the new menus with the fixed arrows :P

I did try to kind of JSR to free space (there's quite a bunch of unused space at 0x17DB1, or $BDA1), but couldn't really make up how to make the branches work properly once the jump is done, I got confused there.
I will try to leave the code as it is for both the Select and the DOWN button, but for UP I'll have to implement new code. I will try again to see if I can somehow make it work in free space, I just need to figure out where to put the JSR and how to handle the branches within the existing code in the new range.


---------------------------------------------------------------------------------------------


It will require quite some ASM to get it working for the UP button for both the File Selection screen (0x17313) and the Register Your Name screen (0x176BC) too. I still have yet to figure out how to make UP/DOWN to register as inputs in the Game Over screen, even if I change the 29 30 to 29 3C at 0x1CA95, it still only registers Select as the only input to change the cursor.



---------------------------------------------------------------------------------------------



Out of that, I found something that could help towards making a PAUSE message appear on the OW.
It seems like there is a certain byte in memory that defines whether you are in Sidescroll or Overworld mode.
This byte is located at RAM address $0736, and seems like $0737 is a mirror of it (?).
If it's set to $0B, then the game is in Sidescrolling mode, and it seems like $05 is the value for the Overworld mode.
I think part of the code involved on checking this is between 0x1DDD and 0x1FCC, at least from what I've seen, I could be wrong :P
« Last Edit: February 06, 2019, 05:51:02 pm by ShadowOne333 »

IcePenguin

  • RHDN Patreon Supporter!
  • Sr. Member
  • *****
  • Posts: 265
    • View Profile
Re: Zelda II Redux
« Reply #379 on: February 07, 2019, 03:20:30 am »
This is unrelated to anything you had planned, but I made a little hack that addresses a common complaint about Zelda II - Losing all your exp when you get game over.  This hack will keep your current exp if you game over, and you choose the "continue" option.  However, if you choose the "save" option, it will wipe any exp you may have.  Works similar to the restart in palace hack.

Info you'll want to know beforehand:
1. In RAM, the player's current exp is at $775 and $776.
2. In RAM, the gained exp counter is at $755 and $756.  Gained exp is loaded here first, then added to your current exp.
3. In RAM, the position of the cursor in the game over screen is at $488.  00 is positioned on "continue" and 01 is positioned on "save".
4. The game wipes your exp at 2 different times.  Exact moment of game over, and when you choose "continue" in the game over screen.


With that knowledge, here is the hack:


At 0x1CA6D you have the following data:

A9 00 8D 75 07 8D 76 07

This bit of data wipes your current exp the exact moment you get a game over.  It loads the immediate value of 00 into the high and low byte for current exp, thus reducing it to zero.  So our first step is to change this.  Let's change it so it loads that 00 into the gained exp counter instead.  So change the code to:

A9 00 8D 55 07 8D 56 07

Next, let's go to address 0x1CAC7 to find the following data:

AD 88 04 F0 08 A9 40 8D B0 07 4C 05 CF 8D 75 07 8D 76 07 8D 56 07 8D 55 07

The first 5 bytes is checking RAM address $488 - the position of the cursor in the game over screen.  If it's equal to 0, it branches to the code in bold at 0x1CAD3, which is the code to wipe exp when choosing the "continue" option.  If it's not equal, it goes to the underlined code at 0x1CACC, which is for choosing the "save" option.

So what we wanna do is change how far it branches if the cursor position is on the "continue" option.  At 0x1CACB you'll find 08.  If the cursor is on "continue", it will branch ahead 08 bytes, skipping over the length of the underlined code.  Change this value to 14.

At 0x1CAC7 paste the following code:

AD 88 04 F0 14 A9 00 8D 75 07 8D 76 07 EA EA EA EA A9 40 8D B0 07 4C 05 CF

With this, it branches ahead 14 bytes, to the data in bold CF.  The data after this is related to how "continue" option works, but it's not relevant now.  The new underlined code will now wipe your exp when you choose the "save" option.  And selecting "continue" won't wipe it anymore.

Anyway, that's it.  Feel free to use this, or anyone else who is interested.  :)



February 07, 2019, 05:31:10 am - (Auto Merged - Double Posts are not allowed before 7 days.)
As an extension to that hack, here is an another way to do it. 

This way works the same, but in addition, when you get a game over and choose the "continue" option, you will always start on the screen you died on - be it on the world map, caves, towns, dungeons.

I know you have the "restart in palace" hack, but this could be an alternative to that, being able to continue on the screen you died on.  (even boss rooms!)  Plus, you wouldn't have to go all the way back to Zelda's Palace if you died in a cave somewhere.  :P

At 0x1CA6D paste the following code: (this is explained above)

A9 00 8D 55 07 8D 56 07

Next, at 0x1CAC7 paste the following code:

AD 88 04 F0 10 A9 00 8D 75 07 8D 76 07 A9 40 8D B0 07 4C 05 CF A9 03 8D 00 07 20 30 CF C9 0F F0 07 A9 06 A0 01 4C F0 CA 20 58 C3 EA EA A9 00

This difference here is the code in bold.  Your current exp is still saved, but now when you choose "continue" it will set your lives to 03 (with A9 03 8D 00 07), without resetting your location.  Resetting lives was needed, because without it, your lives would just keep counting down to 0, then to FF and so on.

With A9 06 (the part that is underlined), it prevents the game state from resetting your location.  I'm not sure on how to explain this part, ha ha.  You'll basically remain where you are in the world without it sending you back to Zelda's Palace.

I tested all this up though palace 1, and it worked fine.  More thorough testing could be done, but I believe it works with no issues.

Video:
https://youtu.be/-eYl_p-g_Uc

« Last Edit: February 07, 2019, 07:09:39 am by IcePenguin »