Romhacking.net

Romhacking => Newcomer's Board => Topic started by: joe73ffdq on April 18, 2020, 10:54:13 pm

Title: Pointers and calls made
Post by: joe73ffdq on April 18, 2020, 10:54:13 pm
I am trying to revisit my project with DW2, and I ran into a difficulty I cant figure out... The entire spell structure has been redone. For characters it appears to work out just fine, but for enemies, there is something I am wondering... The game will make a call to heal or revive, once an enemies hp is 25% or less. Enemies will run if hp is 25% or less also... Given I rearranged the entire spell set, I was looking for pointers, and cant find any. If spells are not in the same location, how would the call for 25% hp be determined...

In the link below, check out line 193 in 3-unfinished data... On the left is the original 32 enemy skills. On the right is the new set of skills... I checked for pointers for all 32 skills, and all 32 locations for each one. 64 locations in total, and nothing appears to call from those locations.

Maybe I am over thinking it, or maybe there is something I am unaware to look for... I want to eliminate the run routine for enemies altogether, but am not sure if that location of code is called... 6 healing spells cut to 3, but are those locations called, and I am missing something.

Hopefully my question makes sense... What do I look for, and are these changes going to work... Check out line 193 in 3-unfinished data, and let me know what I might need to look for...


https://www.dropbox.com/s/zaah0d08ze93mwi/DW2%20-%20Remix%20and%20rebalance.zip?dl=0
Title: Re: Pointers and calls made
Post by: FAST6191 on April 19, 2020, 09:35:14 am
It does help to name the game at least once for those playing along at home.

Anyway is this not the sort of thing you watch the health value for?
If I were playing coder then take max health value, shift by 2 to quarter it (might be done during a standard loop, might be done right at the start, could also be the other way around and current shifted by 2 to multiply by 4 though that would be strange), if current health is less than shifted value then do this. Indeed you could probably add that yourself if you really wanted to spice things up -- if your rebalancing includes some nice AI mods then so much the better.

So yeah I would watch anything reading the health. Other than the obvious "are they dead yet?" anything else playing with that becomes of interest.
Title: Re: Pointers and calls made
Post by: abw on April 19, 2020, 10:16:52 am
Hopefully my question makes sense...
Not really. Are you saying you rewrote the entire battle command system but don't know whether you did it right or not? If that's the case, you're going to be the only person who can answer that question :P.

I want to eliminate the run routine for enemies altogether, but am not sure if that location of code is called...
Have you taken a look at the disassembly on the wiki (https://datacrystal.romhacking.net/wiki/Dragon_Warrior_II::ROM_map/ASM)? There could be some missing pointers, but based on what's there, it looks like the handler for Attack ID #$05: Run Away is only called from one place, so as long as you've removed running from each monster's list of commands, it should be safe to remove the code as well.

6 healing spells cut to 3, but are those locations called, and I am missing something.
Similarly, it looks like the only entry points to the 6 healing spells are from the command handler jump table, though they do have a bunch of internal links and they all feed in to $AB14/$AB16.
Title: Re: Pointers and calls made
Post by: joe73ffdq on April 19, 2020, 01:55:15 pm
I didnt know about the commented disassembly... This will help clear up what I am looking for, and also help me find other things :)

Some of the problem is my ability to concentrate... I need to set up the new enemy abilities, and then test each one, instead of wasting time looking for JSR's.

Thanks for the data crystal link. I didnt know it was updated  :beer:


...


I figured it out, and it ended up being simple.

In Dragon Warrior 2, there are 32 skills in 2 separate sets... Taking all these skills, and writing new spells, is already done, and all 32 pointers match.

What I was trying to find, was actually another routine I overlooked... Healing, revive, run away, and special armor resistance, is all done through a check. I had the armor check already done. There is an LDA which checks the skills, and then a CMP range for which skills. CMP  06-09 and 17-1A for example... I moved all the spells around, so for the armor resist, its now CMP 05-0a and 17-0b... That is what I needed to find, and after readjusting to the project, I was able to figure it out...