Romhacking.net

Romhacking => ROM Hacking Discussion => Topic started by: njosro on February 05, 2018, 10:20:28 pm

Title: zelda 2 ASM hacking and improvements
Post by: njosro on February 05, 2018, 10:20:28 pm
A few years ago I tried to do an asm hack that would alleviate the pain of being sent back to the beginning after you lost all your lives. It was my first time doing any sort of assembly, so it had a few flaws that would mess up the collectible items.

Recently I had a good reason to work on version 2.0: It was requested by hollowshadow for his new hack.

So here it is. It doesn't have any unwanted side effects! (at least I'm 95% sure...)

http://www.romhacking.net/hacks/3859/ (http://www.romhacking.net/hacks/3859/)

Here is the code for anyone interested.

Code: [Select]
Asterisk * means I added this section or modded the instruction.

07:CAD0 (01CAE0)
JSR $AB10*
--------------------------
00: AB10 (002B20)*
LDA $707 ; current world
RTS
--------------------------
07:CAD3 (01CAE3)
CMP #$03* ; if > 3
BCS $CADE ; goto the jsr below
LDA #$00
LDY #$01
JMP $CAF0 ; jump to ~~label 1~~
JSR $AB14*
--------------------------
00:AB14 (002B24)*
LDA $706 ; region
ASL ; *2
ASL ; *2
CLC
ADC $707 ; +world
ADC $748 ; +area_index
SEC
SBC #$34 ; -52
TAX
LDA $AB30,X ; @ AB33, AB34, AB36, AB38, AB3B, AB3D, or AB3F
STA $561 ; set scene index
JMP $C358

07:C358 () ; (built-in) reset lives and other paramaters.
LDA #$03
STA $700
INC $760
INC $76C
RTS
--------------------------
07:CAE1 ()
LDA #$00
NOP
NOP
NOP
STA $701
STA $75C
LDA #$01
LDY #$02
~~label 1~~
STA $76C
STY $75F
RTS

the end.
Title: Re: zelda 2 restart from current palace after game over
Post by: ShadowOne333 on February 05, 2018, 11:42:45 pm
This hack really sparked my interest for sure!
It will aliviate one of the more excruciatingly obnoxious points in the game, which is having to traverse Hyrule all over again just to get a shot at the Temple you left off befor a Game Over.

I will try this one out for sure!

Also, are you willing to make some more quality ASM hacks into Zelda II?
To make it a more suitable experience overall, don't know if you have any ideas but it'd be neat to at least take them into consideration for a further project implementing this as the base. :P

EDIT:
Btw, does this also change where you spawn after you reboot the game and continue a save file?
Title: Re: zelda 2 restart from current palace after game over
Post by: Revility on February 06, 2018, 08:42:40 am
Very cool!  I will give this a shot.

This game has so much potential, but just needs the rough edges sanded off. This is definitely a great little quality of life improvement.

Can I add it into the rev hack?
I'm going to make a seperate version that is purely just the updated sprites to make it easier for other's to use in their hacks.  :)
Title: Re: zelda 2 restart from current palace after game over
Post by: ultimaweapon on February 08, 2018, 11:13:00 am
This is definitely a most welcomed edition. It's most certainly a pain trying to get back to a palace after losing all of your lives especially the last 4 palaces.
Title: Re: zelda 2 restart from current palace after game over
Post by: njosro on February 09, 2018, 11:42:54 am
Thanks guys!

ShadowOne, yes, I made a few other asm hacks. The most notable one is built-in to the side view editor. It lets you assign any key item to any palace (i.e. the condition to turn to stone) without screwing up the crystal returns. In the original game this was not possible.

This particular "respawn" hack does not affect where you start after rebooting the game. That would be a whole new thing to implement.

I also made one more half-done hack where SPELL becomes GHOST. It makes Link flicker for the entire screen so he's invulnerable.

Revility, you can patch this to your hack :) Just be careful that you don't overwrite something important. I don't think it will be a problem, but it's something to remember if you experience any problems.
Title: Re: zelda 2 restart from current palace after game over
Post by: ShadowOne333 on February 09, 2018, 12:15:34 pm
Neat!

Another thing I would suggest is probably...
When you save the game manually, that counts as a Game Over or as a Death towards the counter in the Selection Screen.
Perhaps keep it so that when saving manually does NOT count towards that number, and only Deaths and Game Overs do count towards it.

This is something I never liked from the 2D Zeldas.
Title: Re: zelda 2 restart from current palace after game over
Post by: ultimaweapon on February 11, 2018, 10:24:58 pm
NJOSRO

Changing SPELL to GHOST is quite interesting. What is the link, so I can check that out? I wish I would have known that you have done that?

Also, do you think you could change JUMP in the way it behaves from jumping high to doing a double jump? I think a double just would be better for Zelda 2 as opposed to jumping higher.
Title: Re: zelda 2 restart from current palace after game over
Post by: Shadic on February 13, 2018, 02:02:39 pm
This is awesome!

The biggest "rough edge" I believe that the game has left would be losing a life when you fall into a pit.. Would it be feasible to make it instead restart the room and take 10-20% of your life?
Title: Re: zelda 2 restart from current palace after game over
Post by: Gideon Zhi on February 13, 2018, 02:35:29 pm
Curious, if you don't get kicked back to the starting palace when you game over, what's the difference between losing one life and losing all of your lives? Do you now, in effect, have infinite lives?
Title: Re: zelda 2 restart from current palace after game over
Post by: pocket on February 13, 2018, 02:49:48 pm
That's one of the biggest problems with the game out of the way. All I'd change now is speeding up the NPC text.
Title: Re: zelda 2 restart from current palace after game over
Post by: njosro on February 14, 2018, 12:40:45 pm
Thanks guys!!

Another thing I would suggest is probably...
When you save the game manually, that counts as a Game Over or as a Death towards the counter in the Selection Screen.
Perhaps keep it so that when saving manually does NOT count towards that number, and only Deaths and Game Overs do count towards it.

To do that you would need to set a flag when the game detects up + A on the controller (or whatever it was), and then check the flag when you choose the save option. (But I always ignore the game over counter anyway hahaha)

Changing SPELL to GHOST is quite interesting. What is the link, so I can check that out? I wish I would have known that you have done that?

Also, do you think you could change JUMP in the way it behaves from jumping high to doing a double jump? I think a double just would be better for Zelda 2 as opposed to jumping higher.

I don't have a patch ready for download because I was just experimenting with it a long time ago. I don't think I have the file anymore. Maybe one day I'll try it again.
As for JUMP, I don't have much experience messing with the physics of the game. It's an interesting suggestion though, and I think I would try it!

The biggest "rough edge" I believe that the game has left would be losing a life when you fall into a pit.. Would it be feasible to make it instead restart the room and take 10-20% of your life?

I actually had the same thought! I haven't tried to do anything like that yet... but if I did, I'd imagine it going like this:
1. Lose a some life the moment you touch the lava
2. Skip the death, and just go to the routine that "refreshes" the room. This would also make the music keep playing.


Curious, if you don't get kicked back to the starting palace when you game over, what's the difference between losing one life and losing all of your lives? Do you now, in effect, have infinite lives?

No, you still get punished for losing all your lives. It's just softer. When you lose one life you start at the exact same screen, and you keep your EXP. When you lose all your lives, you get kicked back to the entrance of the palace and lose all your EXP. If you're not in a palace, you go back to the starting palace and lose all your EXP like the original.

That's one of the biggest problems with the game out of the way. All I'd change now is speeding up the NPC text.

If you download my dialog editor you can change the text speed.
Title: Re: zelda 2 restart from current palace after game over
Post by: ShadowOne333 on February 14, 2018, 01:04:10 pm
Thanks guys!!

To do that you would need to set a flag when the game detects up + A on the controller (or whatever it was), and then check the flag when you choose the save option. (But I always ignore the game over counter anyway hahaha)
I managed to get the game to save with Controller #1 by pressing Up+A after pausing.
This saves manually, all I gotta do is add the flag check right now and make the custom subroutine.

I am really interested in making some sort of Quality hack for Zelda II, as it's the one that needs it most out of the NES Zeldas.
Basically I am planning this right now:
I don't know how this sounds for you, but I would love to see this come to fruition.
Perhaps someone else has better ideas as to how to make Zelda II a better and more balanced game.
I was also thinking about the possibility of reducing how much Magic each spell consumes, this should be fairly easy to do as well.

So let me know what do you think, and what others think as well
I am very interested in doing this to let Zelda II become a more welcomed game to the franchise instead of the Black Sheep.
Title: Re: zelda 2 restart from current palace after game over
Post by: IAmCaptPlanet on February 15, 2018, 04:17:25 pm
I think all of that sounds great!

And as a suggestion, also try to get the double jump thing in there. the Jump Spell makes Link to "floaty".

and would really be nice to have Hearts for a health meter and a green Magic meter, to bring it more in line with the rest of the series (although it would be purely cosmetic, i think it would help out a lot)

also, the dialogue speed,and the ANNOYING CLACK CLACK (typewriter noise) could use some work.
Title: Re: zelda 2 restart from current palace after game over
Post by: ShadowOne333 on February 15, 2018, 08:42:59 pm
and would really be nice to have Hearts for a health meter and a green Magic meter, to bring it more in line with the rest of the series (although it would be purely cosmetic, i think it would help out a lot)
I could try that.

Edit:
Okay I might take a while to try to do this lol
The Linux PC where I usually do all my hacking just had a cutoff update and I have to pinpoint what package it was and reinstall/update again. Until then :P

In the meanwhile, I searched around for existing hacks of Zelda II that could be a great addition to a Quality hack for Zelda II:
Zelda II MMC1 to MMC3 Hack (http://www.romhacking.net/hacks/2451/), Zelda II: Remove big flasheffect (http://www.romhacking.net/hacks/740/) and some aspects of Zelda II Easy (http://www.romhacking.net/hacks/1084/), like less Magic consumption and perhaps more starting lives and I'm not sure if perhaps lowering the Experience points required per-level.
Title: Re: zelda 2 restart from current palace after game over
Post by: njosro on February 16, 2018, 11:50:27 pm
I tinkered around tonight, and I have a strong base for anyone interested in the lava code. It's cool and all, but I don't want to spend time debugging and perfecting it. Here is what I've got. Feel free to build on it.

Whenever RAM $494 is incremented, you die. This is the way the game does it.

The code for sinking in lava and executing a lava death is at 119E in ROM:

Code: [Select]
LDA #$00
STA $0014
LDA $29         ; y position
CMP #$D0        ; if not at bottom of screen,
BCC $119C       ; skip next instruction
INC $0494       ; DIE
INC $29 ; increment y position
JSR $93AC
JMP $EBF0

If you change INC $0494 to a JSR, you can inject your own code. I decided to JSR to the middle of some empty space at the end of bank 0 (at 3F0A in ROM). I put 3 instructions there:

Code: [Select]
LDA #$07
STA $0736
RTS

RAM $736 controls what 'mode' the game is in. A value of 7 instructs the game to reload the scene. The game naturally writes to this address when changing scenes. (Other values for $736 specify whether Link is falling, whether it's a side view vs the over world, and so on.)

It works, but with 2 issues.

1. You can see the screen jerk around a bit before it blacks out to refresh
2. The enemies don't reappear for some reason. Not even the blobs will respawn.

So there you go! Refer to the zelda 2 dump at https://lemmy.neocities.org/zelda2/zelda2.html if you want to add your own stuff.
Title: Re: zelda 2 restart from current palace after game over
Post by: ShadowOne333 on February 17, 2018, 03:09:11 pm
How is this for a PoC for making the Health bar Hearts instead of a single bar? :P

(http://i63.tinypic.com/6z3ea9.png)

I struggled quite a bit because the game uses some kind of background colour for keeping track of the health, which is why I ended up putting a blue colour around the hearts so that this effect is not seen while in gameplay.

I am also thinking about making the Magic meter a single block instead of segmented blocks, but I'm not sure yet, this is how it'd look:
(http://i65.tinypic.com/14vijgn.png)

Some might like it, some might not.
In the meanwhile, I'll leave it as segmented blocks instead.

Another modification I thought of is switching the places of the Magic and Health meters.
I am nitpicky like that and feel like Health should go before Magic, but that's just me. xD

Here is the IPS Patch:
https://www.dropbox.com/s/iq0za2d5rvr21lk/Zelda2%20-%20LifeMeter-ManualSave.ips?dl=0

Also, as an added bonus, this patch also has a Manual Save feature ;)
While in gameplay, Pause the game and then press Up+A to save at any time during gameplay.

@njosro, the code which reads the button combo for saving is located in 0x0021AF for Sidescrolling sections and in 0x0021ED for Overworld areas. For some reason the code is split like that.
The RAM address for button inputs on controller #1 is at $00F7, and the value which the code checks for is $88 (Up+A), while the Death counter is stored at $742A in RAM.
The beginning opcode in hex looks like this for the first section of code (Sidescrolling section manual save):

[A5 F7 C9 88 D0 37 20 4C D2 20]

I haven't figured out a way to make it so that saving manually doesn't add to the Death counter, but if you manage to find a way before I do, that'd be awesome :P
ASM is not my strength so I am making baby steps with this, so I'll see what I can do.
Title: Re: zelda 2 restart from current palace after game over
Post by: ultimaweapon on February 20, 2018, 12:21:04 pm
@ShadowOne333 - Trax already has a tool for reducing the cost for magic spells, but it's for Mac OS X Tiger and earlier versions and not Windows. I had to emulate the Mac OS to use it for my hack I'm working on. Here is Trax's tool. https://www.romhacking.net/utilities/375/ (https://www.romhacking.net/utilities/375/)

I like the design of the hearts. It gives it a more classic Zelda feel.
Title: Re: zelda 2 restart from current palace after game over
Post by: ShadowOne333 on February 20, 2018, 01:36:03 pm
@ShadowOne333 - Trax already has a tool for reducing the cost for magic spells, but it's for Mac OS X Tiger and earlier versions and not Windows. I had to emulate the Mac OS to use it for my hack I'm working on. Here is Trax's tool. https://www.romhacking.net/utilities/375/ (https://www.romhacking.net/utilities/375/)

I like the design of the hearts. It gives it a more classic Zelda feel.
Oh I didn't know about that software.
It does look good, sadly it relies on Mac OSX, which is somewhat niche when it comes to RomHacking in general.
I mostly use Linux to work on hacks, and since the source code for that app is not available, I won't be able to run it in anything else other than a VM, which might take way more time than I'd like.
I'd try to port it to Linux if I had the source code handy.

Besides, I believe I already have the ROM offsets identified which modify the values for magic, so changing them manually through Hex editing should be fairly easier than doing a whole VM setup just for that one software :P
Title: Re: zelda 2 restart from current palace after game over
Post by: Revility on February 20, 2018, 09:37:42 pm
There are hearts for the life bar in the last build of the rev hack.  Feel free to use or edit. 

I looked into changing the magic bar green, but it appears part of the bar has it's color set in a different way so I stopped snooping into it.

The health and magic bars go into negative when your dead or use all your magic.  I have a hunch this wasn't intentional just by how the negative part of the bar looks when it happens.
Title: Re: zelda 2 restart from current palace after game over
Post by: ultimaweapon on February 21, 2018, 01:33:48 pm
@ShadowOne333 - Do you think you can find the ROM offsets that controls how much experience you gain from each enemy? If so, I have a problem with my hack that maybe you can help me solve.
Title: Re: zelda 2 restart from current palace after game over
Post by: njosro on February 21, 2018, 10:17:07 pm
@ultimaweapon - Use the zelda 2 disassembly I linked to in my previous post. It has the information you need.

Here is an excerpt from bank 1. This particular section is thanks to Trax! The bytes in this table start at 0x54E5 in rom.
Code: [Select]
Enemy Attributes (Palette, Experience Code, etc.)                 
                                                                             
"xx.. .... Palette Code (0-3)                                                  "
"..x. .... No Damage from Sword (needs Fire)                                   "
"...x .... Steals Experience Points                                            "
".... xxxx Experience Code (0-F)                                               "
                                                                             
"40 .x.. .... Fairy                                                            "
"40 .x.. .... Red Jar (or Exp. Bag or Magic/Heart Container)                   "
"40 .x.. .... Locked Door                                                      "
"C2 xx.. ..x. Myu                                                              "
"C1 xx.. ...x Bot                                                              "
"81 x... ...x Bit                                                              "
"94 x..x .x.. Moa                                                              "
"C2 xx.. ..x. Ache                                                             "
"80 x... .... ?                                                                "
"90 x..x .... ?                                                                "
"84 x... .x.. Acheman                                                          "
"10 ...x .... Bubble Generator                                                 "
"10 ...x .... Rock Generator                                                   "
"81 x... ...x Red Deeler                                                       "
"C2 xx.. ..x. Blue Deeler                                                      "
"02 .... ..x. Bago Bago Generator                                              "
"92 x..x ..x. Bago Bago                                                        "
"84 x... .x.. Red Octorok - Jumping                                            "
"84 x... .x.. Red Octorok - Moving                                             "
"40 .x.. .... Elevator                                                         "
"44 .x.. .x.. Moblin - Orange                                                  "
"85 x... .x.x Moblin - Red                                                     "
"C5 xx.. .x.x Moblin - Blue                                                    "
"48 .x.. x... Daira - Orange                                                   "
"89 x... x..x Daira - Red                                                      "
"45 .x.. .x.x Goriya - Orange                                                  "
"85 x... .x.x Goriya - Red                                                     "
"C6 xx.. .xx. Goriya - Blue                                                    "
"C2 xx.. ..x. Lowder                                                           "
"00 .... .... Moby Generator                                                   "
"51 .x.x ...x Moby                                                             "
"C3 xx.. ..xx Megmat                                                           "
"83 x... ..xx Geldarm                                                          "
"00 .... .... Dumb Moblin Generator                                            "
"50 .x.x .... Dumb Moblin                                                      "
"02 .... ..x. ?                                                                "

There is a table like this in each bank. search through the disassembly for "experience code" and you should find it.

edit:

The same recommendation goes for you too, ShadowOne333. It's great you found the relevant RAM addresses and opcode locations! These are readily available in the disassembly, which you can follow along as you discover new things. And if you would like to improve your ASM you should look through some of it because it is labeled and commented. Search the word "manual" in bank 0 of the disassembly and you'll find relevant code for the up + A thing.
Title: Re: zelda 2 restart from current palace after game over
Post by: ultimaweapon on February 24, 2018, 03:42:57 pm
@njosro - From what I read, it only deals with enemies in Western and Eastern Hyrule and Death Mountain. It doesn't give that info on palace enemies. I need that info for Mounted Ironknuckle. In my hack, no matter what I do, when you beat Mounted Ironknuckle, he only gives you 10 exp, and I can't seem to fix that.
Title: Re: zelda 2 restart from current palace after game over
Post by: ShadowOne333 on February 24, 2018, 07:43:21 pm
@njosro - From what I read, it only deals with enemies in Western and Eastern Hyrule and Death Mountain. It doesn't give that info on palace enemies. I need that info for Mounted Ironknuckle. In my hack, no matter what I do, when you beat Mounted Ironknuckle, he only gives you 10 exp, and I can't seem to fix that.
Here:
http://datacrystal.romhacking.net/wiki/Zelda_II:_The_Adventure_of_Link:Enemy_Data
Title: Re: zelda 2 restart from current palace after game over
Post by: Jeville on February 25, 2018, 11:10:18 am
Link doll: Make this increase your starting lives by one permanently. You start with 3 lives as normal, getting a doll increase it to 4, and it will stay 4 after a game over and when booting the file up again. There are only 6 dolls that are gone permanently after pickup, bringing the total starting lives to 9. The 1-up you get via experience points should either be eliminated, or grant a temporary increase like it does now.

Blue jar: Increase the amount of magic it gives.
Title: Re: zelda 2 restart from current palace after game over
Post by: PresidentLeever on February 25, 2018, 12:55:26 pm
Nice work :)

Would be cool to see these things fixed:
-sword attack is canceled if you swing right before landing or jumping
-need to reselect spells in every new screen/room before use and after using a spell once you need to reselect it again
-accumulated exp is wasted when you finish a dungeon and level up instantly
Title: Re: zelda 2 restart from current palace after game over
Post by: Trax on February 27, 2018, 11:18:36 pm
NJosro, good to see that you're putting some efforts into making the code more adequate and avoid unwanted side effects. This post is not meant to be any kind of "told ya" rebuke, but well, I literally told you the first time I saw the code in writing.

I remember the first version of your code (or at least one of the first) messed with the function at CF30, and it had to be bad for some other crucial aspect of the game. One is what I call Item Presence Tables. Each part of the game keeps track of what objects are already taken or not. This data is kept in RAM at 6xx, and saved to cartridge RAM so it is memorized between saves. The routine at 1C2B3 uses the routine at CF30 (Region Code * 5 + World Code) to point to the correct location in RAM.

Do you mind explaining what happens in your code? If I understand correctly, you created your own table with the starting Area Codes for each palace. Makes sense, since the original code only relies on the player being in Palace 7 and simply resets the Area Code to 00, which works for Palaces 1, 3 and 7 (and North Castle, obviously), but not the others, since the palace entrances are not always Area Code 00 in their respective ROM banks. This is good also if someone shuffles the rooms around, you can simply edit the table with the correct Area Codes.

By the way, I don't want to look too harsh regarding this project, because the last thing I want is to scare people away from the great game that is Zelda II. So please, make bold moves, and I will be glad to add my input. I nearly disassembled the whole game, so I know a lot about its internal coding.

February 28, 2018, 12:17:39 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Now, for some other ideas evoqued in this thread.

The GHOST spell is interesting, but it could easily become a game breaker, especially with bosses. An alternative would be to have a limited invincibility time, that could even increase with your Magic level. Or it could be a number of hits before the spell wears off, and again, more hits as you level up.

I like the idea of a double jump. It could be quite tricky to achieve. There are several variables that keeps track of Link's "status", like contact with other surrounding tiles, whether he is falling, whether he is in mid-air after a jump. All this must be taken into account. You also have to decide if you want to be able to change direction for your second jump. That would be awesome. If you want to start somewhere, try RAM 479 (related to mid-air status), and A7, which has bitfields that keeps track of Link's contact in all four directions. The Jump spell modifier is RAM D0. Spell spell modifier is DE, but it's used for other things, so be careful.

For text speed, there are 4 variables you can use to make text type faster (or slower). Lower value means faster because they are delays, in frames. All in Bank 3. All delays related to letters are kept in RAM 566.

- Delay before text starts typing. F615 in ROM. Default is 2A = 42 decimal = 0.7 second.
- Delay between letters. F74E in ROM. Default is 05 = 5 decimal = 0.08 second.
- Delay after normal line break, letter code FD. F657 in ROM. Default is 0B = 11 decimal = 0.18 second.
- Delay after long line break, letter code FE. F65D in ROM. Default is 2D = 45 decimal = 0.75 second.

As for the typewriter sound, you can change it to anything that already exists, so it may not produce something harmonious. The offset is F747. Default is 60. Normally, sounds in are single bitfields, so a value of 60 seems peculiar. Try other values for possibly weird effects. A few examples:

01 = Death
02 = Sword hits something solid
04 = Spell spell
08 = Flute tune
10 = Big Door in Hidden Kasuto appears
20 = Random tune
40 = Force Field in Palace 7 removed
80 = Boss defeated
C0 = Fairy

There are 4 variables in RAM for sound effects: EC, ED, EE and EF. Default for typewriter is EC, but you can change it at F749 in ROM to have access to other "sets" of sound effects. RAM EB is for music. I don't think there are many sounds in the library that could adequately replace the typewriter sound, unless we could somehow import the sound used in the Japanese version, which sounded a bit more like someone talking (as far as the Famicom sound chip could produce).
Title: Re: zelda 2 restart from current palace after game over
Post by: njosro on February 28, 2018, 01:34:23 pm
It's great to hear from you again, Trax.

Quote
This post is not meant to be any kind of "told ya" rebuke, but well, I literally told you the first time I saw the code in writing.

Yes, I had that coming hahaha
I was so tired of messing around with the original code that year. I just left it even though it was flawed. But this version doesn't do any weird stuff :) Actually I'm a lot more familiar with the game's inner workings now thanks to making those editors and using your disassembly.

Quote
Do you mind explaining what happens in your code?

I created my own table for the exact reason you stated. I made it find the correct entry in the table by doing my own calculation instead of the one at CF30. I borrowed ideas from it though (of course).

LDA $706      ; get region
ASL         ; x2
ASL         ; x2
CLC
ADC $707      ; + world
ADC $748      ; + overworld area index
SEC
SBC #$34      ; -52

...And then it looks up the scene index (or "area code" in your terminology) from the table I created:

TAX
LDA $AB30,X      ; @ AB33, AB34, AB36, AB38, AB3B, AB3D, or AB3F
STA $561      ; set scene index


The table is not filled contiguously. There are gaps between the table entries to make the formula work.

Quote
I don't want to look too harsh regarding this project

Critiquing the code and offering your input makes it more satisfying and worthwhile to me. I will do the same if I think I have something to offer (even though I'm not as experienced).
Title: Re: zelda 2 restart from current palace after game over
Post by: ShadowOne333 on February 28, 2018, 04:44:33 pm
Mmmm I tried looking around the disassembly but I couldn't find anything related to the Death Counter at all.
I only want to bypass the count for when you save normally, but I cannot find anything on it.
I think it's handled by a STY/LDY opcode. The Death counter is stored at $742A in RAM.

I searched around in the Manual Save subroutine from the disassembly, but the only bit which seems related to the save is this:

Code: [Select]
LA1A5                                                                          ;
jsr      bank7_Remove_All_Sprites      ; 0x21b5 $A1A5 20 4C D2                 ;
jsr      bank7_Mute_music_when_loading_between_areas; 0x21b8 $A1A8 20 3D D0    ;
lda      #$02                          ; 0x21bb $A1AB A9 02                    ; A = 02
sta      $076C                         ; 0x21bd $A1AD 8D 6C 07                 ;; begin a special routine. Changing this value has the most 'automation' ;(00=restart from zelda's castle with 3 lives,  01=no routine, 02=die, 03=wake up zelda, 04=roll credits, 06=show the lives then restart the scene)
sta      $076D                         ; 0x21c0 $A1B0 8D 6D 07                 ;

The important part here is the LDA #$02.
This is the byte that tells the game what to do when it detects the Up+A press after a Pause.
However, I don't see a JSR or any jump near that section to at least try to pinpoint where it causes the counter to go up by 1 whenever it detects a save/death by means of a button press.

I am really noobish when it comes to ASM, so I am trying to learn bit by bit here. :P
Any kind of help will be appreciated.
Title: Re: zelda 2 restart from current palace after game over
Post by: njosro on February 28, 2018, 06:49:58 pm
Hey shadowone sorry to leave you in the dark for a bit. I actually did create a reply about the save thing, but I was dumb and didn't copy the text. When I tried to post, I had been inactive too long and rhdn booted me out, so I lost the reply. I intended to do it again the next day but forgot.

I'll reply properly soon.
Title: Re: zelda 2 restart from current palace after game over
Post by: ShadowOne333 on February 28, 2018, 11:13:44 pm
Oh don't worry njosro :)
I made some debugging on my part with Fceumm, and that's where I got the idea that the code might be using STY/LDY opcodes.
I am not familiar with those at all, so I couldn't make much out of them, but I'll try to read some basic ASM examples for those and see what I can gather :)

Thanks for taking the time for trying to help too!
Any help will be incredibly welcomed for sure :)
Title: Re: zelda 2 restart from current palace after game over
Post by: Trax on March 01, 2018, 12:24:44 am
Oh, and by the way, sorry for the super old Mac OS X editor. I've been working on and off on a better version, and I should have made at least a minor update since then. Shame on me. I think I made a thread in this forum quite some time ago about all the new features of my editor, which I now call Sword II.

If you want to change the magic requirements for spells, the table is at ROM offset 0D7B. Also, the spell effects bits are in the table immediately after, at 0DBB.

0D7B: Table for Magic Needed for Spells (40 bytes)
      
40 30 30 20 20 20 20 20      Shield
60 50 40 40 28 20 18 10      Jump
8C 8C 78 78 64 64 64 64      Life
A0 A0 78 78 50 50 50 50      Fairy
F0 A0 78 3C 20 20 20 20      Fire
F0 F0 A0 60 50 40 30 20      Reflect
F0 E0 C0 A0 60 40 30 20      Spell
F0 F0 F0 F0 F0 F0 C8 80      Thunder

----

0DBB: 01 02 04 08 10 20 40 80   Table for Spell effects bits (8 bytes)

Each row in the first table represents a spell, whereas each column represents a magic level, from 1 to 8. Keep in mind that a single square of magic in the meter is worth 32 (20 in hex) units. So the first byte in the table means the Shield spell when you are at Magic level 1 costs 64 units (40 in hex), or 2 squares.  And for some reason, you have to divide the values in the table by 2 to get the correct cost displayed in the Pause pane.

The spell effects bits mean that you can combine spells in any combination you want. Bit 0 is for Shield, bit 1 for Jump, and so on. If you take the first byte and set bits 0 and 1, which gives you the value 03, the Shield spell will also cast Jump at the same time. A value of FF would cast all the 8 spells simultaneously, but I think some spells may cancel others out. Experiment.

As for experience given by enemies, there is an universal table of preset experience values in Bank 7. You can set one of the 16 possible experience values to any enemy. The table is separated into low and high bytes, to account for values higher than 255. What's weird is that there are three tables, the second one seemingly a remnant of the Japanese version, since the numbers correspond. Here are the tables in question:

1DDC0: Experience Table Low Byte (10 bytes)

00 02 03 05 0A 14 1E 32 46 64 96 C8 2D F4 BC E8

1DDD0: 00 01 02 05 0A 14 32 64 C8 F4 E8 D0   Table for ? (C bytes)

Looks like the Japanese version score table...

1DDDC: Experience Table High Byte (10 bytes)

00 00 00 00 00 00 00 00 00 00 00 00 01 01 02 03

The values from table 1DDDC and 1DDC0 are combined to form 2-byte numbers.

The index into these tables is what is used in the Enemy Attributes table. For example, in bank 4 (Palaces Type A), Enemy Attributes are at 114D5. One byte per enemy. The bits 0-3 are for the Experience Type (or index). For example, the Guma is enemy code 1E. Value index 1E in Enemy Attributes table is 87. Bits 0-3 make 7. So the experience Guma gives is index 7 in the Universal Experience table, which is hex 32 = 50 pts.

Also, keep in mind that changing these values will not affect the little floating numbers that appear after you defeat an enemy. These are mapped in another table, at 1DD4C in Bank 7. Each floating number is made of two tiles. Small numbers (0, 2, 3, 5, 10) have the first tile as a transparent one. Here are the tiles you can use with the original graphics in the game:

F5 = Nothing
A0 = 10
A2 = 5
A4 = 2
A6 = 7
60 = 3
6C = 15
9C = 0
9E = 00

If you wanted a number that can't be made with one or two of these tiles (such as 40), you'd have to edit the graphics in the game.
Title: Re: zelda 2 restart from current palace after game over
Post by: ultimaweapon on March 01, 2018, 11:29:29 am
@TRAX - How is your process with Sword II? I remember you stating you were also looking to create some new moves like a charged sword attack.
Title: Re: zelda 2 restart from current palace after game over
Post by: PowerPanda on March 01, 2018, 01:49:38 pm
First off, thank you so much for the existing hacks and utilities. I just did a full playthrough combining the easy-type hack with your restart from the current palace, along with using a utility to speed up the text, and it was like playing a new game. I ran into a bug in Palace 6 where the 2nd mounted knight boss would not appear, but taking an intentional game over fixed the game, so I don't know what happened there.

Here are some possible changes that I think would improve the Zelda II experience.

1. Health drops
There are 2 magic vials available right now, the blue ones, which refill 16 points of magic, and the red ones, which refill all magic. What if the refill for the blue vials was doubled to 32, and the red vials refilled one to two bars of health instead? In the current game, I always, ALWAYS cast "Health" before picking up a red vial anyway.

A special consideration would need to be given for the red vial secrets on the overworld. They could be replaced with fairies in 1 of 2 ways:
1. Do a recolored fairy sprite that restores magic.
2. Change fairies so that they restore health and magic, like in later Zelda titles.

2. Spells
There are two spells I felt were missing from the game:
Sword - Doubles Link's damage. There are a lot of enemies that are just a pain to fight, so this would reduce the length of battles. Boss HP might need to increase to make up for it though. I could see this replacing "Spell", but I'd want to gain it before the Death Mountain trip.
Run - Increases Link's movement speed by 50%. It always felt weird to me that you could double your jump height, but not your speed. One note on this spell is that it would also make Link jump further. I envision it replacing "Fairy", and changing the 2-3 screens in the game where Fairy is needed into pits that you must long-jump.
Title: Re: zelda 2 restart from current palace after game over
Post by: ultimaweapon on March 01, 2018, 05:28:21 pm
@PowerPanda - I believe IcePenguin's hack Shadow Of Night has a DASH spell in place of SPELL spell. It's very challenging, but a good hack. https://www.romhacking.net/hacks/728/ (https://www.romhacking.net/hacks/728/)
Title: Re: zelda 2 restart from current palace after game over
Post by: PowerPanda on March 01, 2018, 05:55:43 pm
How is this for a PoC for making the Health bar Hearts instead of a single bar? :P

(http://i63.tinypic.com/6z3ea9.png)

I struggled quite a bit because the game uses some kind of background colour for keeping track of the health, which is why I ended up putting a blue colour around the hearts so that this effect is not seen while in gameplay.

I am also thinking about making the Magic meter a single block instead of segmented blocks, but I'm not sure yet, this is how it'd look:
(http://i65.tinypic.com/14vijgn.png)

Some might like it, some might not.
In the meanwhile, I'll leave it as segmented blocks instead.

Hmmm... I like the idea. Seems like you're just adding a blue mask over the top of a sliding scale. That's a genius solution. Since this game is unique in having "Magic Containers" just like heart containers, could you use the same solution on the magic bar? I'll put a mockup below. I'm guessing that the problem with the colors comes from the palettes? Do the magic and life bars use the same palette of white/blue/red/transparent? If so, I'll change my mockups to accommodate that.

However, there are a few things to take into consideration. In other Zelda games, the hearts have 3 states: full, half, and empty. However, each bar in Zelda 2 actually has 8 states, one for each pixel. One of those pixels is the blue/white line between each container, which means that one container's State 8 is graphically indistinguishable from the next's State 1. (That's why you can still be alive even when it appears you have "0 health". You're actually just in State 1.) In yours, because of the white outlines, States 7&8 and the next container's States 1&2 are all indistinguishable, meaning that the player's view is only 50% accurate. It might be good to remove the white outlines. Here's a picture illustrating:
http://imgur.com/VBnvD6v (http://imgur.com/VBnvD6v)

Put together, here's a mockup of what I think it could look like:
http://imgur.com/Bb5hwdo (http://imgur.com/Bb5hwdo)

EDIT: Still new to this forum, and can't figure out how to embed images.
Title: Re: zelda 2 restart from current palace after game over
Post by: Trax on March 01, 2018, 08:02:50 pm
My editor has a full fledged Overworld editor, you can modify palettes (there are 4), and set any palette to any of the 16 tiles. You can force a terrain "group" to stop with the bracket tool, so that covers places like the hidden palace 6. Now all attributes on key areas are accurately understood, so you can change all of them, and move the key areas around. The "crosshair" tool lets you select and move key areas, but you can also use the popup menu to select them. This means you can also select them by hand even if you can't see them on the map (an area with Y position 0 is out of bounds). You can use the lasso tool to fill, swap or randomize tiles. You can choose a few display settings, like grid and connections between areas. Nothing about the Demons, which could be a nice addition.

The Side View editor is quite advanced, but it doesn't save yet. You have access to all regions. You can change the association between the data and the area code. This is because more than one area can have the same terrain. Change the enemy group for each area. You can modify objects attributes, add or remove objects, modify enemies, add or remove enemies. The enemy sets can be browsed and selected from another window. You can change the area destinations for each of the four sides. You can also edit all the attributes: background map, no ceiling, extra layers, palette set, tile set, area width. In the Towns section, you can set the destinations of doors.

There's also an editor for Link's attributes: attack power, magic names, costs and effects, and level ups names and experience needed. This one is pretty much like before, except I put everything in the same window, instead of using multiple tabs. Plus some sugar, like the attack power differentials for each level. This shows how Link is going to progress as he levels up.

The enemy editor is quite interesting, you get to change all attributes (steals points, immune to Thunder, etc.), the experience code with the master experience table in the same window for reference, which can be modified too. You can change the item type given by the enemy (no item, minor and major). You can also change the damage code of the enemy, and again the damage table for reference, editable.

The text editor still only covers the Towns (no intro or ending), but all 98 dialogs are there. The new feature is that you have a picture that shows exactly how the dialog box will appear in the game, using the graphics from the ROM. There is also the Game Data editor, which contains various data, like beginning values: spells, items, techs, heart/magic containers, lives, crystals. Also, number of enemies to defeat for item, change the health below which it starts beeping, or cancel the beeping completely. Also, the amount of life restored by the Life spell. I could add quite a lot of miscellaneous stuff in there.

I started working on a tile editor (for the Side Views), which lets you edit what tiles are used for objects, the four 8x8 tiles that make the tiles used in layout, tiles palettes, and I will eventually add a way to change which tiles are solid and which aren't. You can see all of this in pictures in this old thread : http://www.romhacking.net/forum/index.php?topic=22077.0

It's been quite some time. I'm just back from a long dry spell of ROM hacking, so that's why the thread is that old. You can see a screenshot of the tile editor, and some of the "latest" progress.
Title: Re: zelda 2 restart from current palace after game over
Post by: ultimaweapon on March 01, 2018, 09:45:56 pm
@Trax - I remember seeing those pictures. I definite can't wait for you to finish it, so I could give it a test run.

I'm trying to finish my hack now. I'm nearly there. Just a couple of issues to finish working out.
Title: Re: zelda 2 restart from current palace after game over
Post by: PowerPanda on March 02, 2018, 04:08:56 pm
@PowerPanda - I believe IcePenguin's hack Shadow Of Night has a DASH spell in place of SPELL spell. It's very challenging, but a good hack. https://www.romhacking.net/hacks/728/ (https://www.romhacking.net/hacks/728/)

Thanks for the tip. I tried it, and it works beautifully! Great job, Trax. Do you have that code documented somewhere aside from Shadow of Night so that it could be used in other hacks?

Just to log possibilities, here is the approximate distance the player jumps in different states.
Normal: 4 Tiles
Jump: 5 Tiles
Dash: 6 Tiles
Dash + Jump: 7-8 Tiles

So, for example, if you wanted to replace the fairy spell, you just have to edit all of the sideview sections from the tall vertical climb to pits that are 7 tiles wide. Then, players can only clear it when they have both Jump and Dash.
Title: Re: zelda 2 restart from current palace after game over
Post by: ShadowOne333 on March 05, 2018, 12:28:44 pm
Hmmm... I like the idea. Seems like you're just adding a blue mask over the top of a sliding scale. That's a genius solution. Since this game is unique in having "Magic Containers" just like heart containers, could you use the same solution on the magic bar? I'll put a mockup below. I'm guessing that the problem with the colors comes from the palettes? Do the magic and life bars use the same palette of white/blue/red/transparent? If so, I'll change my mockups to accommodate that.

However, there are a few things to take into consideration. In other Zelda games, the hearts have 3 states: full, half, and empty. However, each bar in Zelda 2 actually has 8 states, one for each pixel. One of those pixels is the blue/white line between each container, which means that one container's State 8 is graphically indistinguishable from the next's State 1. (That's why you can still be alive even when it appears you have "0 health". You're actually just in State 1.) In yours, because of the white outlines, States 7&8 and the next container's States 1&2 are all indistinguishable, meaning that the player's view is only 50% accurate. It might be good to remove the white outlines. Here's a picture illustrating:
http://imgur.com/VBnvD6v (http://imgur.com/VBnvD6v)

Put together, here's a mockup of what I think it could look like:
http://imgur.com/Bb5hwdo (http://imgur.com/Bb5hwdo)

EDIT: Still new to this forum, and can't figure out how to embed images.

I could change the hearts a little bit to accommodate for that.
The only thing I won't be able to do is change the Magic Containers to a green colour.

The HUD uses 4 colours:
$0F (Black/Transparency), $30 (white), $12 (blue) and $16 (red).

White is used for the letters and the magic meter, red for the health and blue for the shadows of the letters and the M/L tiles in the meters.
What I could do is try to change the blue for green, and then swap the colours of the blue and white in the Magic Meter to make the Magic Containers green, but that would also change the letters' shadow as well as the Sword hilt to green.
So I would have to either do that or make the shape of the Magic Containers and make them white as they are right now.

Also, @njosro, is the code in the OP the one for v2.0 of the Restart from Current Palace hack?
I want to give it a try but I think the Hack's page has 1.0 and I'm not sure if v2.0 is the on in the OP or if it is in the works :P
Title: Re: zelda 2 restart from current palace after game over
Post by: njosro on March 05, 2018, 09:55:13 pm
Quote from: Trax
The Side View editor is quite advanced, but it doesn't save yet. You have access to all regions. You can change the association between the data and the area code. This is because more than one area can have the same terrain. Change the enemy group for each area. You can modify objects attributes, add or remove objects, modify enemies, add or remove enemies. The enemy sets can be browsed and selected from another window. You can change the area destinations for each of the four sides. You can also edit all the attributes: background map, no ceiling, extra layers, palette set, tile set, area width. In the Towns section, you can set the destinations of doors.

For the terrain data my editor is fine with moving it around, reassigning, add/delete and all that. But for the enemies, were you able to find a way to change the pointer of an enemy set (for add/delete purposes) without causing glitches? I was trying to get my editor to do it, but it causes freezing and other glitches in world 0. And I even downloaded another side view editor created recently (https://github.com/cfrantz/z2doc/wiki/sideview-editor) to see how he did it, but when you change enemies in his editor it causes problems too.

Quote from: PowerPanda
First off, thank you so much for the existing hacks and utilities. I just did a full playthrough combining the easy-type hack with your restart from the current palace, along with using a utility to speed up the text, and it was like playing a new game. I ran into a bug in Palace 6 where the 2nd mounted knight boss would not appear, but taking an intentional game over fixed the game, so I don't know what happened there.

Thank you! I'm glad you liked it. I will have to look into that palace 6 thing to see if it's related...
As for the existing utilities, I put a lot of effort into making them as user friendly as possible so I'm glad to see you're liking them.

Quote from: ShadowOne333
is the code in the OP the one for v2.0 of the Restart from Current Palace hack?
I want to give it a try but I think the Hack's page has 1.0 and I'm not sure if v2.0 is the on in the OP or if it is in the works :P

The hack I submitted to RHDN is the current version. That old version Trax and I were referring to was more of a "version zero" that I made about 4 years ago.
Title: Re: zelda 2 restart from current palace after game over
Post by: ultimaweapon on March 07, 2018, 09:08:16 am
Oh, and by the way, sorry for the super old Mac OS X editor. I've been working on and off on a better version, and I should have made at least a minor update since then. Shame on me. I think I made a thread in this forum quite some time ago about all the new features of my editor, which I now call Sword II.

If you want to change the magic requirements for spells, the table is at ROM offset 0D7B. Also, the spell effects bits are in the table immediately after, at 0DBB.

0D7B: Table for Magic Needed for Spells (40 bytes)
      
40 30 30 20 20 20 20 20      Shield
60 50 40 40 28 20 18 10      Jump
8C 8C 78 78 64 64 64 64      Life
A0 A0 78 78 50 50 50 50      Fairy
F0 A0 78 3C 20 20 20 20      Fire
F0 F0 A0 60 50 40 30 20      Reflect
F0 E0 C0 A0 60 40 30 20      Spell
F0 F0 F0 F0 F0 F0 C8 80      Thunder

----

0DBB: 01 02 04 08 10 20 40 80   Table for Spell effects bits (8 bytes)

Each row in the first table represents a spell, whereas each column represents a magic level, from 1 to 8. Keep in mind that a single square of magic in the meter is worth 32 (20 in hex) units. So the first byte in the table means the Shield spell when you are at Magic level 1 costs 64 units (40 in hex), or 2 squares.  And for some reason, you have to divide the values in the table by 2 to get the correct cost displayed in the Pause pane.

The spell effects bits mean that you can combine spells in any combination you want. Bit 0 is for Shield, bit 1 for Jump, and so on. If you take the first byte and set bits 0 and 1, which gives you the value 03, the Shield spell will also cast Jump at the same time. A value of FF would cast all the 8 spells simultaneously, but I think some spells may cancel others out. Experiment.

I've been trying to figure out how to combine (Reflect and Shield) and (Life and Shield) magic, but I'm still new to hex editing, and I can't figure this out.
Title: Re: zelda 2 restart from current palace after game over
Post by: ShadowOne333 on March 07, 2018, 01:33:13 pm
I've been trying to figure out how to combine (Reflect and Shield) and (Life and Shield) magic, but I'm still new to hex editing, and I can't figure this out.

Try the following.
At location 0x000DBB (PC Address), you will find the table for spell effects.
Modify what you get there for this:

0DBB: 01 02 04 08 10 20 40 80

to this

0DBB: 01 02 05 08 10 21 40 80

By modifying the 04 for 05 and the 20 for 21, you should get the desired effects (Reflect & Shield and Life & Shield).
Once you modify those two bytes in Hex, load up the ROM and try the spells out in-game.
Title: Re: zelda 2 restart from current palace after game over
Post by: ultimaweapon on March 07, 2018, 02:45:48 pm
Try the following.
At location 0x000DBB (PC Address), you will find the table for spell effects.
Modify what you get there for this:

0DBB: 01 02 04 08 10 20 40 80

to this

0DBB: 01 02 05 08 10 21 40 80

By modifying the 04 for 05 and the 20 for 21, you should get the desired effects (Reflect & Shield and Life & Shield).
Once you modify those two bytes in Hex, load up the ROM and try the spells out in-game.

So my thinking was right, and I had the right numbers. I may have been in the wrong location in the hex editor. I'll use a fresh copy of my hack and try that. I think I was a 0DBB0. Thanks ShadowOne, and I'll try it once I get home.
Title: Re: zelda 2 restart from current palace after game over
Post by: ShadowOne333 on March 07, 2018, 04:11:39 pm
So my thinking was right, and I had the right numbers. I may have been in the wrong location in the hex editor. I'll use a fresh copy of my hack and try that. I think I was a 0DBB0. Thanks ShadowOne, and I'll try it once I get home.
Welcome!
Hope it helps.

Also, guys, thanks to the wonderful help by @njosro, I managed to get a proper manual save working on Zelda II :)
Now whenever I press Up+A, the game saves without adding the manual save as a death in the death counter in the selection screen.

Here's the code (which njosro did for the most part :P I simply made the proper branches and jumps and implemented it all in Hex to the ROM).

Code: [Select]
JSR      LD3A0                         ; 0x1caac $CA9C 20 A0 D3                ; Jump to subroutine (label D3A0)
CMP      #$FF                          ; 0x1caaf $CA9F C9 FF                   ; Compare with 255
BEQ      LCAA6                         ; 0x1cab1 $CAA1 F0 03                   ; Branch if A=255
INC      $079F                         ; 0x1cab3 $CAA3 EE 9F 07                ; Number of Continues + 1

; LD3A0:
LDA      $0700                         ; 0x1d3b0 $D3A0 AD 00 07                ; Load Lives Counter from RAM
BEQ      LD3A8                         ; 0x1d3b3 $D3A3 F0 03                   ; If A=0 (Lives=0), branch to original code
LDA      #$FF                          ; 0x1d3b5 $D3A5 A9 FF                   ; Set A to 255
RTS                                    ; 0x1d3b7 $D3A7 60                      ; Return from Subroutine
; LD3A8:
LDA      $079F                        ; 0x1d3b8 $D3A8 AD 9F 07                ; Number of Continues used
RTS                                    ; 0x1d3bb $D3AB 60                      ; Return from Subroutine

I will be posting an IPS patch later today, so stay tuned :P


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


Here it is!
https://www.dropbox.com/s/9nvida92kyh5svj/Zelda2Redux.ips?dl=0

So that patch should include:

Next up I think will be lowering the amount of magic required for each spell.
I think about reducing each magic amount required for each spell by half to all of them (for all levels of magic), though I am not sure yet.
I will see how I tackle this.
Title: Re: zelda 2 restart from current palace after game over
Post by: Trax on March 07, 2018, 08:10:55 pm
I have the answer for the apparent inconsistency when some spells are moved around. There are two kinds of spells. Instant and persistent. Shield, Jump, Fairy, Fire, and Reflect are persistent spells. They stay activated until you leave the area. Life, Spell and Thunder are instant spells. Their effect is applied once, during one frame.

The consequences are that when an instant spell is cast, the effect bit of the spell must be set to zero after applying the effect, to avoid that the effect continues being executed every frame. If you don't do that, Life gives you infinite life, and Spell and Thunder are cast continously. Here's what the Life spell routine does at the very beginning:

0E5D: AD 6F07   LDA $076F   ; Magic State
0E60: 29 FB   AND #$FB   ; keep bits xxxx x.xx


You have to load the Magic State variable, 76F, and AND it with the reverse of the bit of the spell in question, i.e. a byte with all bits set, except the bit of the spell. Same for Spell and Thunder. That's why when you try to move these spells around by only changing the bytes in the table at 0DBB in not enough.
Title: Re: zelda 2 restart from current palace after game over
Post by: ultimaweapon on March 08, 2018, 10:21:23 am
@ShadowOne - That worked. I was clearly in the wrong location. As Trax noted, some spells don't play well together. Thunder and Life was an interesting combination. LOL!

Now if someone can figure out how to make JUMP spell do a jump in midair instead of just jump higher, that would be awesome!  ;D
Title: Re: zelda 2 restart from current palace after game over
Post by: ShadowOne333 on March 08, 2018, 12:45:33 pm
@ShadowOne - That worked. I was clearly in the wrong location. As Trax noted, some spells don't play well together. Thunder and Life was an interesting combination. LOL!

Now if someone can figure out how to make JUMP spell do a jump in midair instead of just jump higher, that would be awesome!  ;D

Oh good thing you found the right one. :)

Now as a general question to everyone.
What suggestions do you guys have in terms of difficulty or balancing to Life/Magic and enemies?
For example, right now I have these ideas in mind which I'd like to implement into Zelda II:


One thing I am still not sure of, is if I will attempt modifying Enemy health and/or how much damage Link does to enemies. I don't want to make the game TOO easy, just balanced enough so that people can have a much better experience playing Zelda II overall.

I don't think I will touch how much damage Link inflicts on enemies, but I might modify the health of some enemies, not all. Do you guys have any enemies in mind which have way too much health?
The only one I'm thinking right now is that bubble that appears in the very first Palace which takes a million hits to kill. I might change that one.

So, any suggestions?
Title: Re: zelda 2 restart from current palace after game over
Post by: ultimaweapon on March 08, 2018, 01:47:15 pm
Oh good thing you found the right one. :)

Now as a general question to everyone.
What suggestions do you guys have in terms of difficulty or balancing to Life/Magic and enemies?
For example, right now I have these ideas in mind which I'd like to implement into Zelda II:

  • Reduce the amount of magic consumption to half for all levels
  • Remove the ability enemies have to steal experience from you. This one bothers me quite a bit in recent playthroughs.
  • Increment experience values each enemy gives to around double the amount (when possible). If not double, perhaps a small amount above to what they usually give.
  • Edit experience message when destroying enemies to reflect the new experience they give (taken from above point).

One thing I am still not sure of, is if I will attempt modifying Enemy health and/or how much damage Link does to enemies. I don't want to make the game TOO easy, just balanced enough so that people can have a much better experience playing Zelda II overall.

I don't think I will touch how much damage Link inflicts on enemies, but I might modify the health of some enemies, not all. Do you guys have any enemies in mind which have way too much health?
The only one I'm thinking right now is that bubble that appears in the very first Palace which takes a million hits to kill. I might change that one.

So, any suggestions?

I can tell you what  I'm working on in my hack that I thought were good changes overall for Zelda II:

1. Increased HP of most enemies not all.
2. Increased damage Link can deliver with his sword on all levels except the 1st to balance things out.
3. Decreased magic cost for all magic including Thunder for levels 5 and higher. Thunder only cost 32 as opposed to 64.
4. Increased experience points for most enemies and bosses. Hammerhead gives 200 instead of 50 and Barba gives 1000 instead of 700.
5. Casting LIFE spell now fills half of your  life meter or 4 bars as opposed to 3.
6. Eliminated enemies stealing experience points since they already have more HP
7. Enemies drop Experience Bag or Magic Jar every 5 enemy kills instead of 6.

So those are the changes I have done. I should be releasing my hack this weekend after a few more tests. Are those changes you would consider good?
Title: Re: zelda 2 restart from current palace after game over
Post by: ShadowOne333 on March 08, 2018, 02:47:06 pm
I can tell you what  I'm working on in my hack that I thought were good changes overall for Zelda II:

1. Increased HP of most enemies not all.
2. Increased damage Link can deliver with his sword on all levels except the 1st to balance things out.
3. Decreased magic cost for all magic including Thunder for levels 5 and higher. Thunder only cost 32 as opposed to 64.
4. Increased experience points for most enemies and bosses. Hammerhead gives 200 instead of 50 and Barba gives 1000 instead of 700.
5. Casting LIFE spell now fills half of your  life meter or 4 bars as opposed to 3.
6. Eliminated enemies stealing experience points since they already have more HP
7. Enemies drop Experience Bag or Magic Jar every 5 enemy kills instead of 6.

So those are the changes I have done. I should be releasing my hack this weekend after a few more tests. Are those changes you would consider good?
I would be interested in points #4, #6 and #7.
The others not so much sadly :P I feel like the enemies and damage dealt are pretty much okay with how one progresses through the game.
I might end up reducing the magic costs by 1/4 or so, not half as it might seem a bit too much.
How did you end up removing the steal experience thing? I do have an idea on how to do so, but I'm interested in how you tackled it.

Also, on #4, what enemies did you change experience for and to what?
Title: Re: zelda 2 restart from current palace after game over
Post by: ultimaweapon on March 08, 2018, 03:35:42 pm
@ShadowOne

The weaker enemies' HP vary between 20-50. The stronger enemies vary between 50-200. Some enemies also vary by region as well. For example, and Octorok may have 18 HP in Western Hyrule and Death Mountain, but in East Hyrule and Maze Island, they would have 24 and the experience would be 20 vs 30 for respective regions. Dairas' give 100 & 150 experience for Orange and Red. I made similar changes in the palaces as well. Ironknuckles give 70, 100, and 200 for Blue sword throwing ones. No boss gives less than 200 experience. Helmethead gives 200 plus 150 for each head. Carock gives 500. Gooma gives 700, and Barba 1000. Experience bags have no less than 100 with most being either 200 or 500. I wish there was a way to make some 1000.

My experience scale is higher thus the need to give out more experience. I added balance by increasing HP and also increasing Link's attack strength. At Level 8, no enemy except The Great Palace and Bosses take more than 2 hits with a lot of them only requiring 1 hit. I wanted to change the enemies in the Great Palace, but the game goes haywire every time I try to change anything enemy related.

As far as my magic scale, Thunder, Fairy, and Life cost 32 points or 2 bars. All other magic less with Shield, Fire, Jump, and Reflect 8 and Spell 16. I haven't checked the Reflect/Shield combo, but if that works correctly, Then I will make Reflect 16 or 1 bar. BTW, these values are for Magic at Level 8. In a standard game, Thunder is 64, Life is 50, Fairy is 40, Reflect, Shield, Spell, and Fire 16, and Jump is 8 at Magic Level 8.

I also made LIFE spell refill 4 health bars instead of 3. 

As far as the Enemy HP, Attack Strength, Magic Point, Enemy Experience,I used Trax's tool for it since I'm still learning hex editing.

I'll probably need a beta tester before I release my hack, so when I'm ready, you can beta test it for me, and you can see my changes.

Title: Re: zelda 2 restart from current palace after game over
Post by: wolpak on March 08, 2018, 03:37:36 pm
I love the idea that a link doll gives you a permanent +1 life instead of one for that game.  Is that feasible at all?
Title: Re: zelda 2 ASM hacking and improvements
Post by: PowerPanda on March 09, 2018, 11:38:41 am
Tog's current easy patch has a really good balance. You guys should check it out.
https://www.romhacking.net/hacks/1084/ (https://www.romhacking.net/hacks/1084/)
Title: Re: zelda 2 ASM hacking and improvements
Post by: Trax on March 11, 2018, 04:31:50 pm
Personally, I don't really understand the desire to increase the experience gained from enemies. Obviously, I'm biased by the fact that I don't find the game that hard anymore, and this is because I played it so much. On a normal playthrough, without taking any detours or doing any grinding, getting to level 8 in the three stats happens somewhere around palace 6, from 3-3-3 (give or take) after palace 1, to 8-8-8 after palace 6. This is, in my opinion, quite a natural progression of the character's strength throughout the game. Adding more experience here and there would only result in the average player reaching level 8 faster. And you have to admit that Level 8 is quite overpowered. With Attack at level 8, most enemies are killed in 1 or 2 hits.

Wolpak. Welcome to RHDN forums, by the way. Getting a permanent +1 life would be relatively simple. Find a spot in Cartridge RAM to save the max lives counter. This is not hard, there is plenty of unused space in Cartridge RAM. Keep 3 bytes to account for the 3 save slots. When you get a doll, increase that number by 1. When lives are initialized, use this value instead of the arbitrary 3 in the game's engine.

Ultima. You can also change the probabilities of what item you get when the counter reaches 6 (or whatever value you change it to). You could tweak that as well. Here's the tables:

Code: [Select]
1E870: Table for Probability for Item given by killed enemy (10 bytes)

90 90 8A 90 90 90 90 90 Minor Item
91 8C 91 8C 8C 91 8C 91 Major Item

8A = 50 Exp. Bag
8C = 200 Exp. Bag
90 = Blue Jar
91 = Red Jar

These values mean that for an enemy that gives a minor item, you have 1/8 (12.5%) chance of getting a 50 Exp Bag, and 7/8 (87.5%) chance of getting a Blue Jar. For major items, you have 4/8 (50%) chance of getting a 200 Exp Bag and 4/8 (50%) chance of getting a Red Jar.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on March 11, 2018, 07:19:29 pm
@Trax - With the standard progression scale, by the time I finish the 4th palace, I'm usually Level 8 for everything. Just like you, the game has become relatively easy for me to. And I agree my Level 8 is a bit overpowered, but I'm treating it as a reward of sorts. With the scale I have, it requires 9000 experience to go from Level 7 to Level 8. I'll share with you through email my scale. But my goal was to make it harder to level up, but also more rewarding to level up. Actually if I remember correctly, I did email you and unfinished version of my hack on here, so you can see progression table.
Good thing is I left The Great Palace untouched, so most enemies there still take a lot of hits. I wanted to change the HP there to make them stronger, but every time I do, the enemies can't be killed (becoming intangible) or I have to turn on infinite magic and go crazy using Thunder Magic. Thunderbird took 150 uses of Thunder magic to kill it, and the game still never progressed to Dark Link. If there was a way to overcome that and make the enemies in The Great Palace more HP, I would do so.

Thanks for the info on the enemy drops. I would definitely want it to be more balanced for minor enemies as it is for major enemies.

March 11, 2018, 07:25:32 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
@Trax - Would it work if I change the minor enemies to also give a major drop (200 exp bag or red jar) or must they stick with the minor drops?
Title: Re: zelda 2 ASM hacking and improvements
Post by: Jeville on March 11, 2018, 08:05:21 pm
Personally, I don't really understand the desire to increase the experience gained from enemies. Obviously, I'm biased by the fact that I don't find the game that hard anymore, and this is because I played it so much. On a normal playthrough, without taking any detours or doing any grinding, getting to level 8 in the three stats happens somewhere around palace 6, from 3-3-3 (give or take) after palace 1, to 8-8-8 after palace 6.
That's assuming the average player knows and understands how to utilize the cancel option in a level up menu in order to achieve that comfortably, which they don't. If placing a crystal gives a specific amount of experience points after giving enough for the next level up, there'd be less need to understand. It'd also help if earned experience points can be saved data and not losing them all after a game over, then make more or all enemies steal points to keep it engaging.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on March 12, 2018, 02:55:29 am
Is this link really true about adding another overworld? https://github.com/cfrantz/z2doc/wiki/add-an-extra-overworld (https://github.com/cfrantz/z2doc/wiki/add-an-extra-overworld)
Title: Re: zelda 2 ASM hacking and improvements
Post by: ShadowOne333 on March 12, 2018, 05:48:55 pm
Okay I added a few more stuff to the hack I am making, here is the patch:
https://www.dropbox.com/s/9nvida92kyh5svj/Zelda2Redux.ips?dl=0

Here's the changelog of the hack compared to vanilla Zelda II so far:


If anyone can give a full run of the game and let me know how the changes feel, please let me know.
I won't be able to test it out until this weekend thoroughly.
Title: Re: zelda 2 ASM hacking and improvements
Post by: Trax on March 12, 2018, 08:14:50 pm
Ultima. You can set any enemy to one of 3 options for item drop. The data is in the second attributes table, at 54F9 in Bank 1, and corresponding offsets in other banks. In my docs, I call the tables "Enemy Vulnerability/Damage Codes", it's an old name and left it that way. I could call the tables "Attributes 1", "Attributes 2", etc. Bits 6-7 set the item drop type. Here's the complete structure:

Code: [Select]
54F9: Enemy Vulnerability/Damage Codes (24 bytes)

xx.. .... Item Type (0 = gives no items, 1 = minor item, 2 = major item)
..x. .... Immune to Flying Blade and Fire
...x .... ?
.... xxxx Damage Code

Value 3 could be used for a special item. This table also contains a flag (bit 4) that I couldn't identify, and some enemies have it set. Fairy, Red Jar, Locked Door, Enemies 8 and 9, Generators, Elevator and Geldarm. I don't know what these enemies have in common.

As for the extra Overworld, it is absolutely possible. Kudos to that cfrantz guy in GitHub for the thorough explanations of his method. I'm working on something similar for my next Zelda II hack, except I may not limit myself to adding a World 3. I'm not yet decided on whether I will double the map size or quadruple it. The hard part is the Taken Items bits, which are currently stored into RAM at 6xx. The guy mentions this problem at the end of his docs. Since there is no more space in RAM for so many bytes, the only solution is to swap it to Cartridge RAM, where there is ample unused space.

More to come on that...
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on March 16, 2018, 02:04:04 pm
Once I get my hack fixed and release it, I may experiment with creating an additional overworld.


After replaying Icepenguin's "Shadow Of Night" hack, it also has given me a few more ideas for Zelda 2.
Title: Re: zelda 2 ASM hacking and improvements
Post by: GTM604 on March 19, 2018, 01:33:42 pm
I wonder if it would be possible to assign a specific enemy to drop a key kind of the way a boss fight does but for a specific enemy that isnt a boss. working more like a drop does with red jars and pbags. obviously you wouldnt want all big drop enemies to have the ability to drop a key. players would just grind keys lol but maybe have a later enemy a one off enemy have this attribute or have a palace were you use a specific enemy only in that palalce and he is assigned to always drop a key. could make for an interesting puzzle or at least an interesting dynamic.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on March 20, 2018, 10:24:58 am
That would be a interesting dynamic for non palace locations. If certain strong enemies like Dairas, Blue Goriyas, Scorpions, Lizaflos, or Basilisks did have that ability, it does create some new things that could be done for the Overworld locations.
Title: Re: zelda 2 ASM hacking and improvements
Post by: Trax on March 20, 2018, 08:35:54 pm
The idea of dropping other items is certainly feasible. You can code specific conditions to your liking and make sure the items drop at specific locations and keep such items in limited quantity. I thought about something similar some time ago, and that should be a feature of my next hack. My original idea was to have special enemies in a special place give you special keys (or other unique item) that can only open special doors. That's quite special.

By the way, I just completed another of my sub-hacks: ice tiles in the Overworld. You can get a demo with a little puzzle here:

www.bwass.org/romhack/zelda2/icetile.zip

I used tile type D for the demo, so it sacrifices walkable water. I could also use type F since it's so rare and you can go without it in an entire region. However, it means that if you want different tiles in different regions, you need to have provisions for different tile mapping tables. And new graphics.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ShadowOne333 on March 20, 2018, 09:21:29 pm
The idea of dropping other items is certainly feasible. You can code specific conditions to your liking and make sure the items drop at specific locations and keep such items in limited quantity. I thought about something similar some time ago, and that should be a feature of my next hack. My original idea was to have special enemies in a special place give you special keys (or other unique item) that can only open special doors. That's quite special.

By the way, I just completed another of my sub-hacks: ice tiles in the Overworld. You can get a demo with a little puzzle here:

www.bwass.org/romhack/zelda2/icetile.zip

I used tile type D for the demo, so it sacrifices walkable water. I could also use type F since it's so rare and you can go without it in an entire region. However, it means that if you want different tiles in different regions, you need to have provisions for different tile mapping tables. And new graphics.

Hey Trax, sorry to bother you, but do you happen to know how I would go about restoring the animated water tiles in the overworld for the NES release?
Title: Re: zelda 2 ASM hacking and improvements
Post by: GTM604 on March 20, 2018, 11:10:24 pm

By the way, I just completed another of my sub-hacks: ice tiles in the Overworld. You can get a demo with a little puzzle here:

www.bwass.org/romhack/zelda2/icetile.zip

I used tile type D for the demo, so it sacrifices walkable water. I could also use type F since it's so rare and you can go without it in an entire region. However, it means that if you want different tiles in different regions, you need to have provisions for different tile mapping tables. And new graphics.

Now that was cool. It's hard to make the overworld interesting beyond what is already present in the original game imo that was simple yet adds a new layer to the overworld. only thing is you'd probably have to limit it to a few area. there's only so many cave systems in the game. other then death mountain and then your kind of limited to the size of the map and death mountain already works as a puzzle. I guess it could be a double layed puzzle but that could really try someones patience. I did really enjoy that in its small sample size.

edit - come to think of it you could have something like this a small puzzle leading into death mountain or leading into new cave areas would take a bit of work though cause of how the map uses its memory but it could be great
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on March 21, 2018, 09:53:59 am
This is awesome Trax. It reminds me of Tales Of Symphonia. I also like the blue color tunic for Link as well. There are a lot of overworld design possibilities with the ice tiles.
Title: Re: zelda 2 ASM hacking and improvements
Post by: Trax on March 23, 2018, 09:53:24 pm
ShadowOne, you are not bothering me :thumbsup:. I don't know exactly how to do it, but such a thing was done in the hack "Shadow of Night", by Ice Penguin. A guy named JaSp did the coding for the animation of the water in the Overworld. If I find the time, I will check the hack and peek in the code to see how it was done, but it would be better to ask JaSp directly.

ItemDrop. Keep in mind that the original game uses fewer areas than the game engine permits, a that both for West and East Hyrule. Palaces are tightly packed, however. Technically, the game allows 3E pointers, 62 in decimal. Because some areas are reused (for example, bridges), there is even less used pointers for Area Data than there are for Key Areas in OW. Also, Key Areas are used for maps that are not "local", like the Dock, both entrances to Death Mountain, Towns, Palaces, etc. With all that compiled, West Hyrule uses 45 Key Areas out of 62, leaving 17 unused areas. One of these unused areas is a Red Jar in Desert, one screen wide, like the spot east of Nabooru.

Ultima. The next step would be to code Ice Tiles in the side scrolling mode. I think it would be quite a challenge. I'm not sure if I'll do it, right now I have other priorities for my hack.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on March 23, 2018, 10:45:01 pm
Trax
     I'm guessing there might be a way to code the breakable blocks for ice tiles, but that's beyond my level of programming. How did you change the color Link's tunic to blue? I really like that blue color.
Also, I wanted to try my hand at creating a double jump for Link when casting JUMP spell, but I don't know where to start. Where in the hex editor is the command for jump and the one that tells Link to jump higher with JUMP spell. Any update on when you will launch your nw editor Sword II?

ShadowOne
      I know you are about to go on vacation, but when you return, if you can solve the mystery of the Boss Enemy Life Bar, that would be awesome. I'll need to re-patch my hack once you solve it, cause I can't figure out how you were able to change it.

Njosro
      Do you think you will try your had at creating that GHOST spell again? It was a great concept, and I'd love to see you recreate and perfect it.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ShadowOne333 on March 23, 2018, 11:04:31 pm
ShadowOne, you are not bothering me :thumbsup:. I don't know exactly how to do it, but such a thing was done in the hack "Shadow of Night", by Ice Penguin. A guy named JaSp did the coding for the animation of the water in the Overworld. If I find the time, I will check the hack and peek in the code to see how it was done, but it would be better to ask JaSp directly.
If you have the spare time to do so, it'd amazing :)
I'll ry to take a peek at it as well and see if I can find something once I'm back from vacations.
That's if you don't find it beforehand :P
Thanks!
ShadowOne
      I know you are about to go on vacation, but when you return, if you can solve the mystery of the Boss Enemy Life Bar, that would be awesome. I'll need to re-patch my hack once you solve it, cause I can't figure out how you were able to change it.
Sure thing!
I'm sure it's an easy enough thing to fix, I just gotta sit back, play a while and debug it properly to do so. Shouldn't take long, but rest assured I will post the fix once I find it in the Redux thread :)
Title: Re: zelda 2 ASM hacking and improvements
Post by: Trax on March 25, 2018, 07:15:55 pm
Ultima. If you want to learn about the jumping mechanics, you can start at 14C5, bank 0. It's not the exact start of everything related to Link's movement, but it's the main part for jumping. You may have to go back and forth between Bank 0 and Bank 7 a few times. I reuploaded all my disassemblies to my website (8 Banks + RAM Map), so that you can have the newest comments. You will need at least one variable of your own. You can store it in Cartridge RAM. That variable would indicate which jump Link is performing. You have to reset that variable when Link touches the ground. I figure the second jump would reset Link's negative Y velocity.

As for the Ice Tile shenanigans, the collision checks in Zelda II are quite limited. Either the tile is transparent (background tile, no collision), or the tile is solid. Every frame, the engine checks to the four sides of Link (and most enemies) whether the tile he touches is solid or not, and sets the variable at RAM A7 (A8,X for enemies) accordingly, one bit per side. This information is used to calculate jumps, falling, walking, etc.

Other than that, there are special tiles that have their own processes, like the surface of lava and breakable blocks, among others. Each region has a list of such tile codes, and the engine goes through them. For example, for West Hyrule, at 451A, there is a table of 9 bytes like this :

Code: [Select]
451A: Tile Codes for Specific Interactions (9 bytes)

00 00 00 00 61 60 80 87 91

Tile Code 61 is Breakable Block, 60 is Breaking Bridge, 80 and 87 are Lava Surface (maybe one is Water Surface, but the graphics are the same), and 91 is Swamp. Same table for East Hyrule, in Bank 2. Other banks have their own list. We can safely assume 00 does nothing, and therefore we can set whatever value we want there and code whatever we want.

For an Ice Tile to work, we would have to slow down acceleration and deceleration in some way. As far as I know, there is no "subunits" for velocity/acceleration in Zelda II, so we have to work with integers. On the other hand, table at 13B3 says that 18 is Link's max X Velocity, which can't be pixels/frame, that would be way too fast.

EDIT

Ultima. Banks 1 to 5 have palettes at [bank offset + 0x0E], so 400E, 800E, and so on. First the background palettes (8 groups of 0x10, plus one for grotto without candle), then at 0x40AE, sprites palettes, with the first byte of each group set to FF. Palette 0 is the one used for Link, so you can change them to whatever you want. If you want Link to always have the same color, you have to change the 5 sprite palette groups. The values I used in the Ice Tile hack are: FF 08 36 11. Use this chart for approximate reference:

(http://www.bwass.org/romhack/rgb.gif)

EDIT 2

Links for the disassemblies:

http://www.bwass.org/romhack/zelda2/zelda2bank0.txt
http://www.bwass.org/romhack/zelda2/zelda2bank1.txt
http://www.bwass.org/romhack/zelda2/zelda2bank2.txt
http://www.bwass.org/romhack/zelda2/zelda2bank3.txt
http://www.bwass.org/romhack/zelda2/zelda2bank4.txt
http://www.bwass.org/romhack/zelda2/zelda2bank5.txt
http://www.bwass.org/romhack/zelda2/zelda2bank6.txt
http://www.bwass.org/romhack/zelda2/zelda2bank7.txt
http://www.bwass.org/romhack/zelda2/zelda2rammap.txt
Title: Re: zelda 2 ASM hacking and improvements
Post by: njosro on April 17, 2018, 02:26:42 pm
Hey Ultima, I recreated the ghost spell.

Get it here (http://acmlm.kafuka.org/uploader/get.php?id=5320)

It changes the shield spell. Nothing else is changed.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on April 17, 2018, 05:30:10 pm
NJOSRO, That spell is awesome! I like it a lot!
Title: Re: zelda 2 ASM hacking and improvements
Post by: njosro on April 19, 2018, 11:08:41 pm
Thanks!

I made a gif of it in action (Link flickers much more quickly in the game)

(http://acmlm.kafuka.org/uploader/get.php?id=5321)
Title: Re: zelda 2 ASM hacking and improvements
Post by: GTM604 on April 20, 2018, 07:49:16 am
that my friend is awesome. Invincible link GG. now if the spell allowed him to walk through walls that would be something else XD
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on April 25, 2018, 08:11:02 am
I figured out how to do a midair jump, but it's something that would always be on rendering the JUMP spell useless. I'm still looking for a way to use it ONLY by casting the jump magic, but it's proving even harder than expected.
Title: Re: zelda 2 ASM hacking and improvements
Post by: GTM604 on April 25, 2018, 11:40:35 am
I figured out how to do a midair jump, but it's something that would always be on rendering the JUMP spell useless. I'm still looking for a way to use it ONLY by casting the jump magic, but it's proving even harder than expected.

that's not totally a bad thing you could then use jump as a new spell replace it with like dash but a double jump in z2 might be weird thing it could be cool asf but you'd have to build the entire game around that mechanic.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on April 25, 2018, 08:01:40 pm
that's not totally a bad thing you could then use jump as a new spell replace it with like dash but a double jump in z2 might be weird thing it could be cool asf but you'd have to build the entire game around that mechanic.

That would be cool but pointless right now unless I can limit the midair jump to just 1 jump. Right now, I have it to where you can midair jump continuously. Continuous midair jump does open new platform options, but I think it's a bit much. I need to figure a way to reduce it to just 1 maybe 2 at most.
Title: Re: zelda 2 ASM hacking and improvements
Post by: IcePenguin on April 25, 2018, 08:53:26 pm
That ghost spell is really cool, njosro!  For a brief moment in the gif you posted, it seemed like Link was stopped when his shield collided with the moblin.  Only an observation, and it's still quite cool to see! 

ultimaweapon, nice work on the double jump!  An infinite jump could work if the setting was the moon!  :P

Seems like stuff is brewing behind the scenes of Zelda II hacking.  Can't wait to see what new hacks are created for this game.   :happy:
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on April 25, 2018, 09:44:15 pm
Good to see you post here Ice Penguin.

If I can tweak it down to just 1 or 2 jumps, then I can look to having the JUMP spell replaced with something else. This is still proving to be challenging.
Title: Re: zelda 2 ASM hacking and improvements
Post by: njosro on April 26, 2018, 09:14:14 pm
Thanks icepenguin! Link DOES stop when his shield hits the moblin. Nothing's different when he's a ghost except he can't be harmed. The ghost spell just forces the flicker counter to stay constant instead of counting down to zero. Very basic, but it's something! And the best part is that there are 3 bytes that I NOP'ed so you could replace that with a JSR and add whatever you want!

Ultimaweapon, that's very cool! Did you change the rom or did you freeze a ram address to accomplish midair jumping? I never looked much into the jumping routine.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on April 27, 2018, 12:02:12 am
Njosro, I found a way to change the rom for the midair jump. I didn't want to do ram since that's simple enough with a game genie code. I wanted to make sure it was built into the game. I'm just still having a hard time limiting how many jumps it does.
Title: Re: zelda 2 ASM hacking and improvements
Post by: Trax on April 27, 2018, 11:41:47 pm
Nice job on the Ghost spell, Njosro. However, I think this is the kind of spell that need strict limitations, to avoid abuse. I'd say the first thing that is obvious is that it should be disabled in Boss Battles, and possibly other major rooms, like item rooms. And then, the magic cost. It should cost not too much to make it prohibitive (and therefore useless), but enough to make the player think twice about the opportunity tradeoff. You could also make it last a specific amount of time, and that amount could increase with Magic Level. Another balancing idea would be that the Ghost spell also prevents you from hitting any enemy. This way, you are invulnerable, but as a tradeoff you can't milk the spell for easy experience points.

And like ItemDrop said, the possibility of going through certain walls with this spell is also interesting.

Keep working on that and let us know if you come up with new ideas.
Title: Re: zelda 2 ASM hacking and improvements
Post by: njosro on April 29, 2018, 05:11:35 pm
Thanks Trax! I agree about the limitations. As it is right now, the spell is more of a cheat than anything else.

My first thought was what you mentioned about not being able to hit enemies. I think that could work nicely. The only problem would be that you could get stuck during an unwinnable boss battle. Can't win, can't die. Disabling it during a boss battle might be a bit strange.

But your idea about a time limit makes it a lot more interesting! With that sort of implementation, you can't abuse it, and you won't get stuck in a boss fight. Good idea! About the length of time increasing with magic level, it could be cool, but no other spell improves with magic level, so it might be a bit unexpected/out of place.

However, that could lead to VERY interesting gameplay change if we make ALL the spells yield better effects as magic level increases instead of costing less. Then we might be able to re-purpose the magic cost table to an "effectiveness" table...
Here's an idea:
Shield - decreases damage more and more
Jump - lets you jump higher and higher (You could level up your magic to access a treasure that's on a really high ledge)
Life - gives you more life
Fairy - time limited, lets you stay a fairy longer
Ghost - time limited, lets you stay a ghost longer
Reflect - can't think of anything, other than letting you reflect regular projectiles back at enemies (but that would be annoying to sift through the code)
Fire - Perhaps after a certain magic level is reached, fire (and I guess the flying blade as a side effect) can hurt the enemies that are initially immune
Thunder - Does more damage, though I'm aware it can glitch Thunderbird if you change this.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on April 29, 2018, 11:07:39 pm
While I disagree with disabling the attack, I agree there should be some limitations on the GHOST spell such as time.Walking through walls would also be cool.

There are other magic spells that need some evolution as well, and it would be cool to see someone be able to make changes to them.

Fire - Of all the fire based spells Link has received over the years, this is by far the weakest looking one looking even weaker than Zelda 1's Wand attack. With all the skills all of you have, I'm sure 1 day we can get the FIRE spell to look like Terry Bogard's Power Wave or Wolfgang Krauser's Kaiser Wave or something powerful and cool.

While REFLECT spell serves its purpose, it would be cool to see REFLECT spell actually reflect projectiles other than the wizard's attacks. Or it can be like the Mirror Shield in Ocarina Of Time blocking the same type of attack 3 times straight and counterattacking with a powerful blast.

SPELL spell needs to just go and be replaced with something else like the GHOST spell or the DASH spell from Shadow Of Night.

Normally, I would agree with the FAIRY spell having a time, but since it's main purpose was to bypass a locked door and transverse over a long pit, a nice change would be for FAIRY spell to also increase your life some based on level.

SHIELD spell could add a parry effect for a perfect block of an attack to create an attack opening on an enemy.

Those are some of my thoughts.
Title: Re: zelda 2 ASM hacking and improvements
Post by: GTM604 on April 30, 2018, 01:22:27 am
id love to see fire spell turned into ice spell and it freeze enemies and you can use them as platforms ala metroid i wish i could have that as a spell it would open up a different style of platforming and new ways to get into new rooms
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on April 30, 2018, 11:38:40 am
I'd keep the FIRE spell and get rid of the SPELL spell for an ICE spell. It would make more sense to me to have both FIRE & ICE like A Link To The Past.
Title: Re: zelda 2 ASM hacking and improvements
Post by: GTM604 on April 30, 2018, 11:54:43 am
I'd keep the FIRE spell and get rid of the SPELL spell for an ICE spell. It would make more sense to me to have both FIRE & ICE like A Link To The Past.

but spell spell is very handy turning moas and such into bots and it raises the tower from the ground to find a hidden item in hidden town :O
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on May 01, 2018, 08:35:27 am
Who needs to Moas into Bots? LOL! Just upward thrust them!  ;D

Getting the Magic Key from Kasuto is nice, but you technically don't have to. There are enough keys in palaces, and no keys are needed in the Great Palace. Plus you have FAIRY magic to help you bypass some locked doors. The SPELL spell is not a necessary spell IMO.

@Trax - You're the best when it comes to Zelda 2. Do you think it's possible to create some type of ICE spell?

Title: Re: zelda 2 ASM hacking and improvements
Post by: GTM604 on May 01, 2018, 08:56:24 am
Who needs to Moas into Bots? LOL! Just upward thrust them!  ;D

Getting the Magic Key from Kasuto is nice, but you technically don't have to. There are enough keys in palaces, and no keys are needed in the Great Palace. Plus you have FAIRY magic to help you bypass some locked doors. The SPELL spell is not a necessary spell IMO.

@Trax - You're the best when it comes to Zelda 2. Do you think it's possible to create some type of ICE spell?

obviously you've never speedrun zelda 2 XD turning stuff into bots not just moas is great plus. You have to think outside the box why does magic key have to be the only hidden item that can be hidden in the town you could put candle there flute etc. there's very little to do in towns as it is taking more away from them makes them worse again just my opinion. the only spell i can think which could be replaced with it is shield spell. Maybe tie shield to reflect making it easier to make early game a but more harder without the use of shield.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on May 01, 2018, 10:09:27 am
obviously you've never speedrun zelda 2 XD turning stuff into bots not just moas is great plus. You have to think outside the box why does magic key have to be the only hidden item that can be hidden in the town you could put candle there flute etc. there's very little to do in towns as it is taking more away from them makes them worse again just my opinion. the only spell i can think which could be replaced with it is shield spell. Maybe tie shield to reflect making it easier to make early game a but more harder without the use of shield.

You're right Itemdrop. I've never done a speed run and don't see the purpose in a speed run in most games especially RPGs. A game like Double Dragon... maybe.

I also agree with hiding other items outside of the Magic Key. Now, if that could be done in other towns and not just New Kasuto, then that would be awesome. Hiding some of the Heart or Magic containers or the Boots, etc would be cool. Or even hiding a old man to learn one of the other spells from would be cool too. If there's a way to have other towns hide items that require the SPELL spell, I'm all for it.
Title: Re: zelda 2 ASM hacking and improvements
Post by: Trax on May 02, 2018, 12:53:56 am
Well, lots of things are possible in theory. As long as you have enough ROM and RAM space, you can code things from scratch. It's the implications that are often hard to predict or assess. I can see the Ice spell as a variant of the Fire spell, and some of the code could be reused. Now, tweaking something that already exists is WAY easier than adding something to the game. Here's what comes to mind at first glance:

- Because it's a spell, you need new graphics that are available everywhere. It means almost every graphics bank must have the new graphics. A sacrifice could become necessary. Either that or you use the Fireball graphics and use a blue palette.
- You have to create a new type of projectile, other than flying blade and fire, with its own attributes and behavior.
- New sound effect?
- Every enemy that is vulnerable to the spell must be programmed to react to its collision. That's the hard part.

Having an enemy stop moving would be relatively trivial. There's already a routine that does something similar when an enemy is paralyzed temporarily after a hit. But then, it depends exactly what kind of effect you expect. Does the enemy simply stops moving? Does the enemy become "solid"? Does it change color? Are you blocked by it? Can you step on it? Does the enemy thaws after a while? All these things make the idea increasingly hard to produce.

Other than the technical requirements, you have to think about what it would bring to the game in terms of gameplay. Like suggested by ItemDrop, stepping on a frozen enemy may be cool on paper, but Zelda II is not exactly a platformer. Sure, you jump and you can fall, but Link is not Mario. There's no extended Y axis to the game. You are not constantly trying to reach new heights with your jumps. Zelda II is about fighting, mostly. If you freeze an enemy, the goal is likely to avoid it, or make it easy to kill. If a spell is not deemed useful enough by the player, it will be ignored. I think the Fire spell shows this symptom. It lets you kill a handful of enemies, but is not required whatsoever anywhere in the game. Having a boss that requires creative use of the Fire spell, now that's interesting.
Title: Re: zelda 2 ASM hacking and improvements
Post by: GTM604 on May 02, 2018, 01:14:39 am
I am trying to work in a boss fight were fire is required to beat the boss. As I feel fire as you stated is almost unnecessary. some things in zelda 2 are barely used or needed but at the same time I feel like this was an intended mechanic of the developers. such as four tile jumps can be made without jump spell but jump makes them easier. I kind of appreciate this balance in z2 were choosing when and were to use magic plays into you're game play.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on May 02, 2018, 08:15:49 am
To all my hackers extraordinaires. Is it possible to swap enemies out for enemies from another game? For example, is it possible to swap out Horsehead for Abobo from Double Dragon? I was thinking another way to improve the gameplay for Zelda 2 is to introduce new enemies to the game.

Just reading Trax's response, that answer would probably be yes, but it would involve a lot of programming changes and graphic and palette swaps and changes to enemy's behavior. Well beyond my level of programming. I'm over 20 years removed from college and learning about programming.  :laugh:
Yes I am old in the gaming world. LOL

I agree that some of the spells need to be used more. Like Itemdrop, I'm checking to see if there is a boss to where the FIRE spell must be used to defeat it.

I'd like to see Dark Link replaced with the final boss of The Battle Of Olympus. With some facial changes, he can be made to look more like Ganon. https://www.youtube.com/watch?v=VJwEYMk2TBc (https://www.youtube.com/watch?v=VJwEYMk2TBc)


Title: Re: zelda 2 ASM hacking and improvements
Post by: Trax on May 02, 2018, 10:43:41 pm
UltimaWeapon. What you say is, again, theoretically possible, but you are talking about creating something from nothing. You'd have to program everything. Unless you see some common ground between a Zelda II boss and the enemy you want to insert into the game, you start from nothing, except the basic building blocks that the game engine provides. In Banks 1 and 2, which correspond to the 4 Overworld regions, there are enemies type 08 and 09 that are unused. In Bank 1, there's also Enemy 23, and in Bank 2, there's 1E to 23. Take one of these slots and go with it.

Here's a broad picture of what you need to consider (again, from the top of my head):

- Init routine. This one is what happens just as the enemy is spawned into existence. Most of the time, nothing happens here, other than the game's engine doing something that is common to all enemies, like setting the X/Y coordinates according to enemy data.
- Main routine. That's where you have to code everything your enemy does. Move there, accelerate, disappear, attack, wait, generate projectile, react to Link's movements, apply gravity (or not), collide with ground, ceiling and walls, etc.
- Display routine. This one sets how the enemy appears on screen, i.e., how the various sprites that compose the enemy are configured.

These 3 pieces are the main part of your puzzle. After that, you setup other details, like HP, enemy size, vulnerability, collision parameters, damage code, etc. For the sprites, you also need tile mappings offsets, and tile mapping codes, that must be inserted in specific tables along with other enemies' codes. And, that's it.

Some time ago, I tried to take the Fokka and make it Enemy 08 in West Hyrule. It almost works. I had to sacrifice some tiles, and I still need to copy the code for the Flying Blade projectile. But it's feasible. What you could do is to start with something very basic, like an enemy made of two sprites (2x2 tiles) that simply moves left at the rate of 1 pixel/frame.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on May 03, 2018, 10:12:04 am
@Trax - Thanks for explaining it. I know it's something I definitely won't try right now. Maybe after I get a few years under my belt in hacking. I think I'll focus more on learning hex editing and ASM, leave that other stuff to you specialists!  :laugh:

@Trax - Did you happen to get that email I sent to your email address?

@Itemdrop - I did find one boss that the FIRE spell can be used to defeat.
Title: Re: zelda 2 ASM hacking and improvements
Post by: GTM604 on May 03, 2018, 10:47:34 am

@Itemdrop - I did find one boss that the FIRE spell can be used to defeat.

interesting if i had to guess. you get fire in east hyrule so making horsehead or helmethead or rebo wouldnt make much sense although horsehead is in the fds version in palace 5 so if it was to be any of west hyrule bosses it would be him. i know it doesnt work on dark link and carock so it's either gooma or barba ?
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on May 03, 2018, 10:58:15 am
interesting if i had to guess. you get fire in east hyrule so making horsehead or helmethead or rebo wouldnt make much sense although horsehead is in the fds version in palace 5 so if it was to be any of west hyrule bosses it would be him. i know it doesnt work on dark link and carock so it's either gooma or barba ?

Oddly enough, it was Horsehead. It had zero effect on Carock which is the one I truly wanted it to work on. I haven't had time to test it on Rebonack, Gooma or Barba yet. It had no effect on Helmethead when I tried him. I'll try the others once I get home from work. If it doesn't work on the others, then I will look to see if there's a way to change the requirement needed to get the FIRE spell. Your Magic level has to be at least 4 to get the FIRE spell, and I would see if that could be changed to level 2. If it can be changed, then creating a path to get FIRE magic before beating Palace 1 would be a simple task.
Title: Re: zelda 2 ASM hacking and improvements
Post by: GTM604 on May 05, 2018, 08:35:30 pm
is there anyway to un hidden hidden town and just make it a regular town
Title: Re: zelda 2 ASM hacking and improvements
Post by: njosro on May 06, 2018, 10:38:30 am
If you want to make the town accessible by just walking over the forest tile (instead of hammering it), change the value at offset 8660 from 00 to D1.
00 is off the map (and the hammer changes it to D1.) By forcing it to D1 from the start you make it accessible.

If you want to see the town tile, use an overworld editor and put a town tile on the spot. If you use mine, you'll see an exclamation point on the hidden spot.
Title: Re: zelda 2 ASM hacking and improvements
Post by: GTM604 on May 06, 2018, 11:28:32 am
If you want to make the town accessible by just walking over the forest tile (instead of hammering it), change the value at offset 8660 from 00 to D1.
00 is off the map (and the hammer changes it to D1.) By forcing it to D1 from the start you make it accessible.

If you want to see the town tile, use an overworld editor and put a town tile on the spot. If you use mine, you'll see an exclamation point on the hidden spot.

thanks njosro  :)
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on May 06, 2018, 01:02:45 pm
@Itemdrop - The 1st past of the battle with Rebonack(on the horse) and Barba can also be fought with the FIRE with some tinkering. The spell does not work on any other bosses except Horsehead. This revelation does add for some new boss fighting mechanics.

@Njosro - That's good to know about New Kasuto. I was also curious about that. Can you move the Hidden Palace (Palace 6) to a new location, and keep it hidden in the new location, so that the flute is used to reveal it?

This is for everyone knowledgeable about ASM. I disassembled Zelda 2, modified some code, but I can't find anything that would aloow me to assemble it together. Any ideas on how to get this done?
Title: Re: zelda 2 ASM hacking and improvements
Post by: Trax on May 06, 2018, 11:53:08 pm
What was said about Hidden Kasuto is correct. The Y position is set to 0 initially, and when you chop the correct Forest unit, the game sets a Town unit at the correct location, draws the Town tiles, plays a sound and modifies the Key Area byte to have the correct Y location, which enables you to enter the Area by stepping on it.

Palace 6 is similar. When you play the Flute, the game checks if you are in the right location, then sets the Palace tile in place of the corresponding Desert tile. If I remember correctly, the drawing, though, is set explicitly 2 tile units down from Link's location. I think that's what makes changing the Palace location a bit harder. Unless you completely change the ASM, you are forced to have the Palace 2 tiles down from the Flute spot.

Ultima. Yes, I got your email. I'll take a look at it when I have time.

Nsjoro. Usually, a disassembler should be able to do the assembly as well, assuming it uses the same formatting rules.
Title: Re: zelda 2 ASM hacking and improvements
Post by: njosro on May 07, 2018, 10:04:59 am
@itemdrop no problem :)

@Ultimaweapon You can assemble the code you wrote with whatever tool you used, and paste it at the correct rom offset using a hex editor. I use FCEUX's hex editor. Also, if you want to make just a small code change, the easiest thing to do is use the debugger tool in FCEUX. You first freeze the game, then seek to the address, then click the left margin beside the instruction, and then you can just type the asm line by line. It will assemble your code and modify the rom right away.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on May 09, 2018, 08:02:52 am
@njosro - This link here is what I'm trying to accomplish. https://github.com/cfrantz/z2doc/wiki/bigger-overworlds (https://github.com/cfrantz/z2doc/wiki/bigger-overworlds)
So I downloaded a disassembly program, changed the code that I needed, and of course I can't assemble the game back. So I'm trying your method aith the hex editor and debugger from FCEUX, and I can't figure out how to modify the code. I'm not getting any options to do that, so it looks like I'm stuck at the moment. I wish there was a way I could just copy and paste all the work I did.  :banghead:
Title: Re: zelda 2 ASM hacking and improvements
Post by: njosro on May 09, 2018, 08:44:15 am
Oh! I've seen those github pages before. A very intelligent programmer, CFrantz, did a bunch of advanced zelda 2 tinkering and posted his stuff there.

To convert your asm into byte code just use this online tool. No download required:
http://www.e-tradition.net/bytes/6502/assembler.html

Copy the object code that it generates.

For example,

LDA #$05
STA $768

becomes:

A9 05 8D 68 07

And paste it at the right location in the hex editor.

Don't use the FCEUX's debugger tool for large modifications. I was talking about small changes for that, like maybe 3 instructions here and there.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on May 09, 2018, 11:04:47 am
Oh! I've seen those github pages before. A very intelligent programmer, CFrantz, did a bunch of advanced zelda 2 tinkering and posted his stuff there.

To convert your asm into byte code just use this online tool. No download required:
http://www.e-tradition.net/bytes/6502/assembler.html

Copy the object code that it generates.

For example,

LDA #$05
STA $768

becomes:

A9 05 8D 68 07

And paste it at the right location in the hex editor.

Don't use the FCEUX's debugger tool for large modifications. I was talking about small changes for that, like maybe 3 instructions here and there.

Thank you for that heads up. I was probably making changes I don't need to and others I needed. I will definitely try this tonight. BTW, what I'm attempting to do is increase the size of the overworld. Have you thought about updating your overworld editor to do this automatically? I think it's cool to have a bigger overworld and not have to change any code to handle this.

Also have you done any updates to your sideview editor? I know you said because of requests you would consider including a "delete all terrain" "add enemy" "delete enemy" and "delete all enemy"? I still think those would be great additions to your editor njosro.
Title: Re: zelda 2 ASM hacking and improvements
Post by: Trax on May 09, 2018, 10:44:32 pm
Be careful about the Overworld changes, because of the Item Presence data. Unless you want an overly complex sharing of Item Presence bits between multiple Overworld regions, you have to consider this bottleneck. All Item Presence bits are stored in RAM, in the 6xx range.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on May 10, 2018, 07:06:28 am
I followed every detail and still can't get it to work, so I will just abandon it for now. 'll go back to my other plans for my next Zelda 2 hacks.
Title: Re: zelda 2 ASM hacking and improvements
Post by: Trax on May 14, 2018, 10:37:16 pm
It's quite a demanding task to have a larger Overworld, as it involves so much new data and many variables that have to work flawlessly. I will let you know when I find a safe way to do it.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on May 15, 2018, 01:31:27 pm
May the Triforce be with you Trax!  :laugh:

I'm going back and work on my next 2 Zelda II hacks (yes I said 2). 1 of my ideas of course I have to wait on you Trax... no worries. I'd gladly wait.

My other idea on the other hand, I'm working on. I'm still trying to figure out this midair jump.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on May 23, 2018, 07:44:14 am
@Trax & Njosro - Is it possible to make one of the other palaces such as the Great Palace hidden to where it would require the flute to reveal just like palace 6?
Title: Re: zelda 2 ASM hacking and improvements
Post by: Trax on May 29, 2018, 02:18:02 am
With new ASM, you could have as many hidden things as you want. The hard part is that the original programming is hard-coded to have the 6th palace's Area appear specifically 2 tiles under Link's current position. The simplest way would be to recycle the 6th palace Area to make it point to the Great Palace. Very straightforward.
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on May 29, 2018, 06:12:42 pm
With new ASM, you could have as many hidden things as you want. The hard part is that the original programming is hard-coded to have the 6th palace's Area appear specifically 2 tiles under Link's current position. The simplest way would be to recycle the 6th palace Area to make it point to the Great Palace. Very straightforward.

I relocated palace 6 and the Great Palace to where palace 6 was and hidden it. When I test it, a palace tile appears, but I cannot enter. It grants no entry into the Great Palace. How do I get the area to point to The Great Palace? I'm going through the disassembly, and I see at bank 0 at 04E9, bank 1 at 4368 and bank 2 at 8368 are all indications about the Hidden Palace, but I'm a bit confused. 
Title: Re: zelda 2 ASM hacking and improvements
Post by: Trax on May 30, 2018, 08:15:49 pm
You don't have to change the code. Just find the Key Area attributes of the 6th palace, and replace the Region and World bitfields with the same values as the Great Palace. You should have to change the Map Number as well. The original 6th palace Key Area index is 35 (hex). Here's the structure of the Key Area bitfields:

Code: [Select]
Byte 0

.xxx xxxx - Y position
x... .... - External to this world (immediately return to Overworld upon entrance)

Byte 1 (offset 3F bytes from Byte 0)

..xx xxxx - X position
xx.. .... - On exit, appear at the location of area index minus this value (0-3)

Rauru, Ruto, North Saria and Mido have bit 6 set
If Area Index minus Exit Offset = 0, music stops when entering area
If Area Index minus Exit Offset < 0, Link ends up in the lower-left corner of the OW

Byte 2 (offset 7E bytes from Byte 0)

..xx xxxx - Map number
xx.. .... - Horizontal position to enter within map
    0 = enter from the left
    1 = enter at x=256 or from the right for 2 screens maps
    2 = enter at x=512 or from the right for 3 screens maps
    3 = enter from the right for 4 screens maps

Byte 3 (offset BD bytes from Byte 0)

.... ..xx - Region number
...x xx.. - World number
..x. .... - Forced enter from the right edge of screen
.x.. .... - Pass through
x... .... - Fall in hole
Title: Re: zelda 2 ASM hacking and improvements
Post by: njosro on June 01, 2018, 04:57:47 pm
Hi ultimaweapon, maybe I can help since this seems doable through the editor :)

Quote
I relocated palace 6 and the Great Palace to where palace 6 was and hidden it.

This is what I understood from that:
1. You moved the area warp of palace 6
2. You moved the area warp of the great palace to where palace 6 used to be
3. You set the Y coordinate of the great palace's area warp to 0

If that's what you did, then here's what's wrong:
As trax said, the game just "draws" a palace tile when you play the flue and it moves the area warp of palace 6, NOT the great palace. So you probably saw the drawn image of a palace but it's just that: an image tile.

Here's what I suggest:
1. Undo everything you did with the moves and such.
2. In the editor, in area editing mode, click any area to select it, then right-click it. (Yeah, it's a bug that you gotta left click first)
3. From the drop down menu, click "Seek Index..."
4. Type 53 (that's the index of palace 6's area warp), then click OK. (in hex it's 35 like trax said, but 53 in decimal)
5. You'll see the view go all the way up north since palace 6 has a Y value of 0. You can't click it since it's out of bounds, but you can change its properties.
   Change the scene and world to the appropriate values that you want. (Probably scene 0 in Great Palace)
6. SAVE!

It will work. (I've done this before.) BUT you will need to fix the graphics of the great palace when you enter. Maybe trax can help you with that...?

I hope this information is what you're looking for!
Title: Re: zelda 2 ASM hacking and improvements
Post by: ultimaweapon on June 02, 2018, 04:27:57 pm
Hi ultimaweapon, maybe I can help since this seems doable through the editor :)

This is what I understood from that:
1. You moved the area warp of palace 6
2. You moved the area warp of the great palace to where palace 6 used to be
3. You set the Y coordinate of the great palace's area warp to 0

If that's what you did, then here's what's wrong:
As trax said, the game just "draws" a palace tile when you play the flue and it moves the area warp of palace 6, NOT the great palace. So you probably saw the drawn image of a palace but it's just that: an image tile.

Here's what I suggest:
1. Undo everything you did with the moves and such.
2. In the editor, in area editing mode, click any area to select it, then right-click it. (Yeah, it's a bug that you gotta left click first)
3. From the drop down menu, click "Seek Index..."
4. Type 53 (that's the index of palace 6's area warp), then click OK. (in hex it's 35 like trax said, but 53 in decimal)
5. You'll see the view go all the way up north since palace 6 has a Y value of 0. You can't click it since it's out of bounds, but you can change its properties.
   Change the scene and world to the appropriate values that you want. (Probably scene 0 in Great Palace)
6. SAVE!

It will work. (I've done this before.) BUT you will need to fix the graphics of the great palace when you enter. Maybe trax can help you with that...?

I hope this information is what you're looking for!

You were spot on Njosro. I tried what you said, and that did work. Like you said, the graphics were totally distorted. I even tried swapping the CHR bank and palette offset, but that didn't work. I'll probably just switch it back to normal.

Here's what I would like to do. Keep Palace 6 hidden where it belongs, but I would also like to hide Palace & (Great Palace) so that it would appear 2 spaces above Link. I figured I needed ASM, but what I can't figure out is how Palace 6 is hidden with ASM, so I can try to replicate the process for Palace 7. Any info that can help is greatly appreciated.
Title: Re: zelda 2 ASM hacking and improvements
Post by: GTM604 on June 12, 2018, 10:17:39 pm
is it possible to have different music for different palaces ?
 instead of the same track for all but Great Palace
Title: Re: zelda 2 ASM hacking and improvements
Post by: Trax on June 23, 2018, 04:15:17 am
If you can't create your own music, which is quite difficult a task, then you have to work with the game's theme, which are relatively few. Intro, Overworld, Battle, Palace, Great Palace, Town, House, Palace Boss, Final Boss, and Ending Credits. You could alternate between regular palace and Great Palace themes, but other than that, I think it would feel out of place. For example, the music for inside the houses in the towns would not make a good ambience when fighting skeletons and knights. Unless it's a haunted palace, and you want to create some sort of dissonance? Maybe...

The other possibility, assuming new music can't be produced, would be to hack the music engine to give different tones and textures of sounds for different palaces. You still have the same melody, but the different tones act like slight variations on the same theme. Or maybe find a way to change the tempo. Stuff like that...
Title: Re: zelda 2 ASM hacking and improvements
Post by: GTM604 on June 26, 2018, 09:17:56 am
thanks for the reply trax

I really wanted to add the dungeon theme from the original legend of zelda to one palace and leave all the other palaces with the original music but it looks like thats not an option no worries thanks for the info. also agree with house music feeling out of place in palaces