News: 11 March 2016 - Forum Rules

Poll

Restored: ROM space allowing, should attacks be tallied for each weapon type used in combat? (support multiple weapon EXP for weapon swapping)

No. Restored already has passive growth, only end-of-combat weapon should receive bonus.
Yes. All weapons used in combat should receive this bonus credit.

Author Topic: Final Fantasy II Restored  (Read 205528 times)

redmagejoe

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Final Fantasy II Restored
« Reply #320 on: May 06, 2020, 06:46:17 pm »
Nah, abw's the one who really took this project to the point it's now at. I've become overwhelmed by other obligations, but this is something I definitely want to see to its completion unlike my last project. The game deserves a touch-up like this, and it's significantly more playable now in its intended manner. The disassembly is much more readable now if you were curious about it, Jiggers, or wanted to take a look at unknown sections.

Rough DisASM
Reassemblable DisASM

I'm noticing that resources online have Poison as the permanent status and Venom as the temporary status, whereas it seems reversed in the Chaos Rush translation. I think I need to update that patch again.
« Last Edit: May 06, 2020, 08:03:06 pm by redmagejoe »

abw

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: Final Fantasy II Restored
« Reply #321 on: May 06, 2020, 09:48:37 pm »
I know it's a janky fix I used in the first place, but without trying to rewrite/rearrange that space to have it specifically check number of characters used and do a conditional E8 or not (so only 5-character spell names would result in "Thunder16" while "Cure 16" would still display properly) which I don't have the confidence in myself to do, it's my best bet.
Adding a condition would be pretty easy - you just need a compare and a branch, and a little bit of code rearranging would free up 3 of the 4 bytes you need for that.

Is it safe to assume that this would just require the 3 bytes for the JSR to our stat refresh? I feel like there were multiple JSRs... Sorry, I've been out of the loop on this for so long I'm starting to forget some of the methods we used to achieve some basic fixes...  :(
This turns out to be both more and less complicated: we were calling $FAFB during battle, but that doesn't work so well outside of battle since it clobbers a bunch of out-of-battle RAM with in-battle data. Fortunately, there's another place that triggers stat refresh outside of battle, the equipment screen, which calls $FA03 instead to stash and restore out-of-battle data, and it looks like calling that inside the orb loop does the trick.

@abw: It seems like Guy, the only 1 of 2 front row characters (the other being Firion) is getting a disproportionate amount of enemy focus. Did something happen with the enemy targetting? I thought we'd fixed that, but I just had Guy exclusively focused by a Soldier, and then a Land Turtle (two different battles) 8 times in a row. Maybe it was just really bad RNG, since I've been locked in a standstill with 2 Ogres and an Ogre Mage, and they're regularly targetting Firion and Guy pretty fairly. I doubt that an entry this early in the series has monster AI that focuses specific targets (like lowest HP or highest HP, etc).
I haven't noticed anything unusual. Over the course of a full game with all characters in the front row all the time, my evasion levels/experience for the 3 main characters were 4-18, 4-17, 4-02, which works out to about a 2% difference between highest and lowest. My Guy had low evasion % throughout the game, so he was more susceptible to status ailments, which in turn meant he lost out on more experience gains than the rest of the party. The enemy attack selection is purely random, though that would be a fun and mean thing to change >:D.

Also still getting spells cast on me by Ogre Mages that I SEEMINGLY successfully landed Minwu's Fog (Amnesia, permanent mute) on. EDIT: It's only happening on the same turn where the spell is cast, but according to online descriptions, a successful Mute/Amnesia should cause the spell to fail if the monster has already issued the order. That doesn't appear to be happening. Is this also a vanilla bug? I should probably add that to the list if it is.
This is probably a vanilla bug. I've also noticed that targets who have had their MP reduced to 0 via Osmose/Swap in the current round are still able to cast their previously selected spell, which is arguably a bug too.

I'm noticing that resources online have Poison as the permanent status and Venom as the temporary status, whereas it seems reversed in the Chaos Rush translation. I think I need to update that patch again.
Yeah, I noticed some confusion between sources there too. The official SNES FF2us/FF3us versions went with Poison as the name for the weaker form of poison spells, so I'm going to side with Chaos Rush on this one.

redmagejoe

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Final Fantasy II Restored
« Reply #322 on: May 06, 2020, 10:23:02 pm »
This turns out to be both more and less complicated: we were calling $FAFB during battle, but that doesn't work so well outside of battle since it clobbers a bunch of out-of-battle RAM with in-battle data. Fortunately, there's another place that triggers stat refresh outside of battle, the equipment screen, which calls $FA03 instead to stash and restore out-of-battle data, and it looks like calling that inside the orb loop does the trick.

Is it safe to assume that you're already testing an application of this by that last comment, or should I try to play around with it again?

I haven't noticed anything unusual. Over the course of a full game with all characters in the front row all the time, my evasion levels/experience for the 3 main characters were 4-18, 4-17, 4-02, which works out to about a 2% difference between highest and lowest. My Guy had low evasion % throughout the game, so he was more susceptible to status ailments, which in turn meant he lost out on more experience gains than the rest of the party. The enemy attack selection is purely random, though that would be a fun and mean thing to change >:D.

Yeah, it seems like specific enemies are predisposed to beating on Guy, but it's definitely not universal, so I don't know. RNG shenanigans or something.

This is probably a vanilla bug. I've also noticed that targets who have had their MP reduced to 0 via Osmose/Swap in the current round are still able to cast their previously selected spell, which is arguably a bug too.

I will add an item to the first post list about enemies only checking conditions of their actions at the start of a round. Them attacking a dead character and yielding "Not Effective" seems okay, since it's in line with what happens with your own characters. Yet your own characters are restricted by their current status at the time they attempt an action, and I think enemies should be as well, so I'll put that in the bug list.

Yeah, I noticed some confusion between sources there too. The official SNES FF2us/FF3us versions went with Poison as the name for the weaker form of poison spells, so I'm going to side with Chaos Rush on this one.

I'm kind of inclined to lean toward the re-releases, and looking at sources, Venom only appears to show up in three of the games. Poison, meanwhile, has always been in the games and almost always is of the "permanent" nature, so I'm comfortable with swapping the terms used to bring it in line with series convention.

I've already got a WIP ROM with Devenomed, Cured of poison, Envenomed, Poisoned, Vnm., Psn. flipped. Not going to commit it to a patch yet though, because I'd kind of like to implement that conditional spacing you suggested. I've been out of the loop for a while, though... Do you think you can point me in the right direction where I can free up some bytes in that area?

I'm going to have to work with you on a compatibility patch anyway, since that code shifts in the Bug Fix and Restored patches. ;D



I am certainly noticing that Rank 1, and even Rank 2 monsters run away quite frequently, and I'm wondering if this is a side effect of the current fear logic bug? Or is it just that having 1500 total party HP makes me too scary? :P
« Last Edit: May 08, 2020, 01:24:45 pm by redmagejoe »

abw

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: Final Fantasy II Restored
« Reply #323 on: May 07, 2020, 10:11:58 pm »
Is it safe to assume that you're already testing an application of this by that last comment, or should I try to play around with it again?
Yup, implemented and appeared to work well! I'll upload the updated version just as soon as Google stops being stupid :/.

I've already got a WIP ROM with Devenomed, Cured of poison, Envenomed, Poisoned, Vnm., Psn. flipped. Not going to commit it to a patch yet though, because I'd kind of like to implement that conditional spacing you suggested. I've been out of the loop for a while, though... Do you think you can point me in the right direction where I can free up some bytes in that area?
So, it turns out the spacing fix is easy for the J ROM where 1 byte = 1 tile (I put together a version that right-aligns the spell level to also cover 1-, 2-, and 3-tile spell names), but spell names in the Chaos Rush translation make use of DTE, so instead of just compare and branch, we'd also have to add code for parsing through the entire string to count the number of tiles to be displayed. Blech :P.

I am certainly noticing that Rank 1, and even Rank 2 monsters run away quite frequently, and I'm wondering if this is a side effect of the current fear logic bug? Or is it just that having 1500 total party HP makes me too scary? :P
A lot of wimpy monsters have a non-zero chance to run away from your starting party with a grand total of 90 HP, so, uh, yeah, having 1500 HP makes that far more likely :P.

redmagejoe

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Final Fantasy II Restored
« Reply #324 on: May 08, 2020, 11:46:51 am »
If it helps, it's actually not using DTE, but rather custom-sprited tiles... unless I don't fully understand what's going on and there's some DTE-to-sprite shenanigans happening, in which case ignore everything after this line. I had tested removing parts of the names in the past, and rather than whole letters vanishing, it appeared as though "pieces" of the letters were sprited to specific tiles. So Thunder wasn't T, hu, nd, er, but rather the third byte was the right half of 'u', all of 'n', and the left half of 'd'. So 'T' 'hu' 'und' 'de' 'r '

Thunder and Blizzard are, in fact, five tiles and five bytes. Looking at them in CastleFynn for example reveals that Thunder is "T[E6][E7][E8][E9]". So all of the names that mess up the display are 5 tiles and 5 bytes. Before I started working with the Chaos Rush translation at length, I too thought they were just DTE and would be easy to change for this exact purpose. It wasn't until I found out that they were custom graphics that I realized this particular fix would be beyond my pay grade, so to speak. If the idea you propose can be applied specifically to 5-byte names here, then I think it should work?

I'll list CastleFynn's spell names below, in the hopes it might be of help for testing and save you the trouble. "Attacks" bank, starts at 0x17157 in a Chaos Rush patched ROM.
Code: [Select]
# of Bytes | Name as appears to player - Characters used
--------------------------------------------------------
4 | Fire - Fire
5 | Thunder - T[E6][E7][E8][E9]
5 | Blizzard - B[EA][EB][EC][ED]
5 | Scrge - Scrg[F6]
4 | Drain - Dr[7D]n
5 | Osmse - Osms[F6]
4 | Flare - F[7E]re
4 | Sleep - S[7F]ep
4 | Stun - Stun
4 | Stop - Stop
5 | Cnfse - Cnfs[F6]
4 | Blind - B[D3]nd
4 | Curs - Curs
4 | Toad - Toad
4 | Break - B[D7]ak
4 | Death - Dea[D8]
4 | Warp - Warp
4 | Bsrk - Bsrk
4 | Haste - Has[D9]
4 | Aura - Aura
4 | Cure - Cure
4 | Life - Life
5 | Basuna - B[EE][EF][F0][F1]
5 | Esuna - Es[F2][F3][F4]
5 | Barrier - Ba[circle][D6][DD]
4 | Blink - B[D3]nk
4 | Prtec - Pr[D9]c
4 | Shell - She[D1]
4 | Wall - Wall
4 | Dspl - Dspl
4 | Mini - Mini
5 | Silence - S[D2][E2][F5][F6]
3 | Sap - Sap
3 | Fog - Fog
4 | Slow - Slow
4 | Swap - Swap
4 | Fear - Fear
4 | Holy - Holy
5 | Telepr - Te[7F]p[E9]
4 | Ultima - U[DA][DB][DC]

(spells below are used mostly by monsters, and may not exceed Lvl 9, but still worth mentioning; only spells that have 5 byte names and can have a level are listed, so Destr, Drink, Gaze, etc are not listed)
5 | PsnCl - PsnCl (goes up to 16)
5 | Breth - Breth (goes up to 10)
5 | Charm - Charm (goes up to 9)
5 | Quake - Quake (goes up to 10)
5 | Cycln - Cycln (goes up to 13)
5 | Tsunm - Tsunm (goes up to 8)
5 | Blder - Blder (goes up to 9)
5 | Blstr - Bls[D9]r (goes up to 10)
5 | Meteor - Me[D9]or (goes up to 10)

Fire assigned to Blaze/Flame (goes up to 16), Blizzard assigned to Icestorm/Snowstorm (goes up to 16), Thunder assigned to Thunderbolt (goes up to 16)

There's a duplicate Fire, Blizzard, and Thunder starting at Message 54, whereabout enemy attacks start, with pointers to the original instances. I'm assuming Chaos Rush simply assigned Fire to Blaze/Flame, Blizzard to Icestorm/Snowstorm, and Thunder to Thunderbolt. Whether these are worth changing for "flavor" at the cost of more work is up for debate. I lean towards leaving it alone and saving bank space, since the skills have the exact same effects.

I put a trimmed down version below with only the "problem" spells listed.

Code: [Select]
5 | Thunder - T[E6][E7][E8][E9]
5 | Blizzard - B[EA][EB][EC][ED]
5 | Scrge - Scrg[F6]
5 | Osmse - Osms[F6]
5 | Cnfse - Cnfs[F6]
5 | Basuna - B[EE][EF][F0][F1]
5 | Esuna - Es[F2][F3][F4]
5 | Barrier - Ba[circle][D6][DD]
5 | Silence - S[D2][E2][F5][F6]
5 | Telepr - Te[7F]p[E9]
5 | PsnCl - PsnCl (goes up to 16)
5 | Breth - Breth (goes up to 10)
5 | Quake - Quake (goes up to 10)
5 | Cycln - Cycln (goes up to 13)
5 | Blstr - Bls[D9]r (goes up to 10)
5 | Meteor - Me[D9]or (goes up to 10)
« Last Edit: May 08, 2020, 01:05:08 pm by redmagejoe »

abw

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: Final Fantasy II Restored
« Reply #325 on: May 08, 2020, 06:39:57 pm »
If it helps, it's actually not using DTE, but rather custom-sprited tiles... unless I don't fully understand what's going on and there's some DTE-to-sprite shenanigans happening, in which case ignore everything after this line.
It's option #2 in this case :P.

The squishy tile stuff is fine, it doesn't matter how many characters are on a tile, but you'll need extra code for dealing with cases where one byte results in multiple tiles. As an example, Flare is stored as 8F+7E+4A = F+[la]+re, where "[la]" is 2 characters on one tile but "re" are separate tiles, so it's 3 bytes = 4 tiles, which means you can't use the number of bytes to tell how many tiles are going to be drawn.

redmagejoe

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Final Fantasy II Restored
« Reply #326 on: May 08, 2020, 06:45:46 pm »

The squishy tile stuff is fine, it doesn't matter how many characters are on a tile, but you'll need extra code for dealing with cases where one byte results in multiple tiles. As an example, Flare is stored as 8F+7E+4A = F+[la]+re, where "[la]" is 2 characters on one tile but "re" are separate tiles, so it's 3 bytes = 4 tiles, which means you can't use the number of bytes to tell how many tiles are going to be drawn.

So the issue isn't actually that he used squishy tiles, but that he maybe assumed that normal DTE bytes would somehow make a single tile? I'll admit that the character / byte / tile relationship went over my head too when I first set out to try to fix this 5-character problem. I figured DTE would solve the issue, until I noticed that 're' and DTE 're', while saving a byte in code, didn't actually reduce the number of tiles. So then... was my original Plan B the most ideal, to make more squishy tiles, perhaps? I don't know if that would be more or less work than trying to do what I can only assume is some messy extra code to account for these scenarios.

Going through bytes that are already used for squishy tiles, to see if there's extra spaces that can be used for new tiles, while also trimming down long words using existing available ones. I can see where 3 bytes can be replaced in Esuna and Thunder could be redone so that the bytes are 'hu', 'nd', 'er' which allows us to use 'er' elsewhere. Blaster could use 'B', an existing 'la', a new 'st', and a new 'er'. Lots of ideas like this for redoing the custom squish tiles.

Code: [Select]
Esuna - Es[F2][F3][F4]  ==> E[EF][F0][F1] (allows us to take back F2, F3, F4 as well) makes this 4 bytes and 4 tiles
Breth - Breth ==> B[D7][EE][D8] (re, squished a, and th used by Death) makes this 4 bytes and 4 tiles


Thunder - T[E6][E7][E8][E9] (redoing Thunder tiles would give us a new byte to work with for Blaster and Barrier, and a second free tile)
Blizzard - B[EA][EB][EC][ED]
Scrge - Scrg[F6]
Osmse - Osms[F6]
Cnfse - Cnfs[F6]
Basuna - B[EE][EF][F0][F1]   (both Basuna and Barrier could be fixed by making a +1 'Ba' squishy tile)
Barrier - Ba[circle][D6][DD]
Silence - S[D2][E2][F5][F6]
Telepr - Te[7F]p[E9] (changing Thunder to use DD would allow us to turn E9 into 'pr')
PsnCl - PsnCl
Quake - Quake
Cycln - Cycln
Blstr - Bls[D9]r (could use 'B', 'la', +1 'st', +1 'er')
Meteor - Me[D9]or
« Last Edit: May 08, 2020, 08:43:44 pm by redmagejoe »

abw

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: Final Fantasy II Restored
« Reply #327 on: May 09, 2020, 12:43:31 pm »
So the issue isn't actually that he used squishy tiles, but that he maybe assumed that normal DTE bytes would somehow make a single tile?
DTE for spell names wasn't present in Demi's version, so presumably that's something Chaos Rush added. Probably only Chaos Rush knows what Chaos Rush was or was not thinking when that decision was made.

So then... was my original Plan B the most ideal, to make more squishy tiles, perhaps? I don't know if that would be more or less work than trying to do what I can only assume is some messy extra code to account for these scenarios.
More squishy tiles would work, assuming there's enough space for all of them. You sure you don't want to just expand the box to allow 8 tiles?

The actual code for counting tiles and adding spaces isn't hard, but it does add a good 40 bytes, which is more than we have available at the moment, so we'd need to do some more crunching.
Spoiler:
Code: [Select]
LDY #$00 ; number of tiles
LDX $7CBF ; index into string buffer at $7D47; number of bytes
@count_tiles:
DEX
BMI @got_tile_count
INY
LDA $7D47,X ; string buffer tile #0
CMP #$3C
BCC @count_tiles
CMP #$6E
BCS @count_tiles
INY
BPL @count_tiles
@got_tile_count:
LDX $7CBF ; index into string buffer at $7D47
LDA #$FF
@add_spaces:
CPY #$06
BCS @done_spaces
STA $7D47,X ; string buffer tile #0
INX
INY
BNE @add_spaces
@done_spaces:

redmagejoe

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Final Fantasy II Restored
« Reply #328 on: May 09, 2020, 12:50:56 pm »
Nah, I'm fine with adding more squishy tiles if it will save such a huge overhead (40 bytes, yikes). I already see places that I can make them and I'm planning around what's available and how many would need to be added. I think I might be able to make it work. That way we also don't have to have a compatibility patch.

I'm getting close in my playthrough to the point where the first item that should be thrown away, the Pass, is going to be checked, so I may take a break until I can take a peek at the code that removes those in the Restored WIP. Currently playtesting with the Bug Fix WIP. I updated the first post with current WIP bugs, and while I'm thinking about it, I may try to figure out where and why the shop interface graphics glitch is a thing. B Button Dash patch needs to be added to Restored, while I'm guessing the Mysidian Orbs Stat Refresh still needs to be added to both Bug Fix and Restored. Updated first post again.

UPDATE: A lot of spells could benefit from an "se" tile being added, but frankly the "e" at the end of Scrge (scourge) seems unnecessary. It's easy to infer from Scrg what the word is, and since most abbreviation relies on knowledge of the language and inference, not really anything else "scrg" could be other than "scourge". That'll save us a byte and a tile. I've got one extra reclaimed byte to work with, and about 7 spell names left, so the planning phase is looking promising. Removing the trailing "e" from a lot of spells (replacing the "se" with a new byte) actually works for shaving off a fifth tile, and there's only 2 spells that would use it after the "se" addition. Silence and Scourge. Changing them to Silenc and Scrg would eliminate the need for that byte and give us another to work with. Worrying too much about fitting as many letters of a word as possible as opposed to as many as necessary to convey what the word is, I think, was the downfall here. I'll take the latter approach.

UPDATE2: Only 2 spell names left, though I've run out of bytes to work with at the moment. I'm sure I can repurpose one, or just rename the two spells to get them down to 4. There's a lot of duplicate bytes that have a very slight difference in pixels that are ultimately not significant enough to justify a second byte, like Blind and Blink using their own version of "li" when they could probably just use Blizzard's "li".

UPDATE3: I have successfully repurposed bytes with minimal need for respriting tiles, with only 10 bytes needing to be redone... Almost. Looking at the tile size, "Ba" won't be possible as there's no way to fit those letters on one tile and have them be remotely readable, so I'll have to re-examine Basuna and Barrier.

UPDATE4: Finally looking at everything in YY-CHR, I can see the restrictions are the 8x8 sprites and readability. With a 4-width character standard for lowercase letters, it's very hard to cram two whole letters into a single sprite. I can see why he sprited portions of words the way he did, so it may be much easier to touch up a few things here and there and just concatenate spell names so there's as little need for re-spriting as possible.

UPDATE5: Spriting is going well, and there's only a few more spells (4 for the player) that need to be shortened, and I have plenty of free bytes to work with now. It's just a matter of finding what letters can be squished together without looking like a mess. Admittedly, "Blizzrd" is a bit rough, but it's still clear what it says and it fits in 4 tiles, so I'm not going to lose sleep over it.

FINAL UPDATE: Success! I've managed to trim all spell names down to 4 tiles, and I think that the sprites look quite nice as well! It's not quite as verbose as Chaos Rush's original sprites had been, but just like his it's still far more verbose than the NeoDemi patch which I believe stuck to 4 bytes, 4 characters, 4 tiles like the original US Final Fantasy I used. It's a good compromise, I think. I'll put the new patch into the queue as soon as I clean a few things up.

:)



I found a minor bug in my translation where I accidentally inserted a "scroll to newline" in a few places, causing NPC text to scroll to a blank box before the "Ask, Learn, Items" interface shows up. I found and fixed in my WIP v2.1a patch the one where the woman who loves Josef says "Poor Nelly... I'll look after her. Josef would want that." But I know there's one, maybe two that came before that which I forgot to document. If you happen upon them in your playthrough, please make note of them.
« Last Edit: May 10, 2020, 02:16:09 pm by redmagejoe »

abw

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: Final Fantasy II Restored
« Reply #329 on: May 10, 2020, 11:04:30 pm »
[squishy tiles]
Sounds nice - I'm looking forward to seeing the end result!

I found a minor bug in my translation where I accidentally inserted a "scroll to newline" in a few places, causing NPC text to scroll to a blank box before the "Ask, Learn, Items" interface shows up. I found and fixed in my WIP v2.1a patch the one where the woman who loves Josef says "Poor Nelly... I'll look after her. Josef would want that." But I know there's one, maybe two that came before that which I forgot to document. If you happen upon them in your playthrough, please make note of them.
Yeah, I did notice a few of those scattered around, but wasn't keeping notes. I think this shouldn't be too hard to check for, though... any time you have a newline immediately followed by an end token, you should be able to drop the newline, right?

redmagejoe

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Final Fantasy II Restored
« Reply #330 on: May 10, 2020, 11:31:25 pm »
It's not exactly something I can search for with CastleFynn, and heaven forbid I try to do it via hex. I don't have a full script dump, so CastleFynn's the way I've been managing it. The idea of clicking through hundreds of messages looking for those errant newlines makes me want to jump off a bridge. It's also not that easy, as there's some valid uses of that newline in order to ensure that none of the previous 4 lines are shown, I believe. I guess I could always make another file with overpowered characters and scroll through the text looking for the 1 or 2 instances since they're not exactly far into the game.

EDIT: I believe I found them. If you give the spy in Bafsk who lets you into the sewers to access the under-construction Dreadnought the password "Wild Rose" or "Dreadnought", he gives a blank box before the interface returns. He's a "disappearing" NPC which has no other meaningful interactions once you close the box since he's meant to vanish, but I'm fairly certain these two instances aren't convention and thus why they stood out to me. It should be easy enough to remove them, but those were the ones I was looking for.
« Last Edit: May 11, 2020, 12:48:45 am by redmagejoe »

abw

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: Final Fantasy II Restored
« Reply #331 on: May 11, 2020, 09:16:44 am »
It's not exactly something I can search for with CastleFynn, and heaven forbid I try to do it via hex. I don't have a full script dump, so CastleFynn's the way I've been managing it.
Hmm, in that case, a little bit of grep work based on the text from Chaos Rush's 1.8 patch says the 119 strings from the following pointers end with a newline + end token combination:
Spoiler:
$18016
$18018
$1801E
$18020
$18022
$18024
$18028
$18030
$18038
$18040
$18048
$1804A
$1805A
$1805C
$1805E
$1806A
$1806E
$1807E
$18080
$18088
$1808A
$1808C
$1808E
$18090
$18092
$18094
$18096
$180A4
$180AC
$180B0
$180B6
$180BA
$180C2
$180C6
$180CA
$180CE
$180D8
$180DE
$180E0
$180E8
$180EA
$180EE
$18104
$18106
$1810A
$1810E
$18110
$18118
$18128
$18138
$1813C
$18140
$18144
$1814A
$18164
$18168
$1816A
$18170
$18174
$18176
$18178
$1817A
$1817C
$1817E
$18182
$1818A
$1818E
$18194
$18198
$181A0
$181A2
$181A4
$181B6
$181CE
$181D4
$181E4
$181E6
$18204
$28018
$2801E
$28022
$28028
$2802A
$28048
$28054
$28058
$28066
$28086
$2809C
$280A0
$280D2
$28138
$2813A
$28142
$28150
$281C6
$281E4
$284A8
$37F12
$37F14
$37F16
$37F18
$37F1A
$37F26
$37F28
$37F30
$37F3E
$37F54
$37F56
$37F5A
$37F5E
$37F66
$37F68
$37F74
$37F76
$37F7A
$37FA4
$37FA6
$37FA8

It's also not that easy, as there's some valid uses of that newline in order to ensure that none of the previous 4 lines are shown, I believe.
I haven't looked in to whether the game requires a newline token in order to overwrite text from the previous page; if it does, then most of those strings will be fine, but if not, you could save a few bytes by dropping the extra newlines.

redmagejoe

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Final Fantasy II Restored
« Reply #332 on: May 11, 2020, 12:28:27 pm »
Fixed up the ones I've seen, and I'll keep my eyes peeled for any I haven't run across yet. v2.1a is up in queue now, and v2.1 (update to spell names and squishy tiles) is available for use right now.

Now that I've more or less got the translation out of the way, I'd like to see if I can't try to help with the remaining bugs. I've been playtesting with Bug Fix version, but I'd be eager to help with implementing some of the proposed features for Restored once the bug list is trimmed down. I could look into the following issue?

Quote
  • Monsters that are killed by poison/venom have their current HP set to 0 and KO Ailment bit set, but are not actually removed from battle; they remain valid targets (you can even cast Life on them to bring them back!) and need to attacked again in order to remove them from battle.

Also, does the latest version have the stat refresh on Mysidian Orbs already? I had a rough fix I was working on over a week ago, but I'm pretty sure that yours is probably going to be more elegant. :D



Another question I had that I've noticed in my playthrough... Are we sure some weirdness hasn't happened with the RNG? I mean, it still seems right outside the Dreadnought, Guy and Maria have been getting particularly focused with their higher evasion levels, Stamina, and HP than Firion, but I'll sit on that quandry for now... The thing I'm really curious about is enemy casters. I'm almost certain in the original, they would often target a single character with a spell rather than the whole party. I don't think I've seen a single spell cast in the 100 or so uses thus far target any one character and have exclusively hit the whole party. Just an observation, may be worth taking a closer look at what's happening.

I'm noticing that weapons that apply a status still seem to push the message like "Fell asleep" even if the KO bit is set, and always follows the "enemy fell" message. I don't recall if original did this, but it does seem a bit awkward. Not sure if there's an easy way to ignore these messages if the KO bit is set. Should I add this as a bug?
« Last Edit: May 11, 2020, 08:03:28 pm by redmagejoe »

abw

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: Final Fantasy II Restored
« Reply #333 on: May 12, 2020, 09:16:00 am »
Now that I've more or less got the translation out of the way, I'd like to see if I can't try to help with the remaining bugs. I've been playtesting with Bug Fix version, but I'd be eager to help with implementing some of the proposed features for Restored once the bug list is trimmed down.
Feel free to take a stab at any of them - I'm not working on anything in particular at the moment!

Also, does the latest version have the stat refresh on Mysidian Orbs already? I had a rough fix I was working on over a week ago, but I'm pretty sure that yours is probably going to be more elegant. :D
Yup, each character's calculated stats should now get updated after they receive the boost to their base stats from each orb.

The thing I'm really curious about is enemy casters. I'm almost certain in the original, they would often target a single character with a spell rather than the whole party.
Whether a monster ability targets a single character or multiple characters is part of the ability data, so the RNG fix wouldn't affect that, and in particular I believe the Magicians around the Dreadnought only use target-all spells. The RNG fix does affect the probabilities for a monster selecting the first or last option in their ability list, but only by 0.5% each since the roll is out of 100.

I'm noticing that weapons that apply a status still seem to push the message like "Fell asleep" even if the KO bit is set, and always follows the "enemy fell" message. I don't recall if original did this, but it does seem a bit awkward. Not sure if there's an easy way to ignore these messages if the KO bit is set. Should I add this as a bug?
Hmm, that sounds like a side effect of moving the weapon special effects code to earlier in the process. I'll look into that one when I get a chance.

Edit: I've updated both Bug Fix and Restored patches with a fix for this to restore the original message order. If you wanted to skip status messages for targets that got killed, that would be an easy change (swapping 2 lines of code), but displaying the status messages is still useful in some cases; for one, it gives an extra chance to find out what ailments a weapon can inflict (useful e.g. for new players, if somebody decides to make a randomizer patch, etc.), and for two, if a character gets KO'd by a Confuse attack, knowing whether the character became confused might affect your plans for reviving that character (side note: should reviving a dead character in battle clear all other ailments?).

Edit 2: I've added B-button dash to the Restored patch; the B-button dash redmagejoe dug up didn't work on the world map, but knowing which variable to watch meant that a moment's work with a debugger was enough to find the section of code for dealing with walking speed on the world map, so I applied the same change there too. I only gave it about 20 seconds of testing, though, so caveat emptor!
« Last Edit: May 13, 2020, 09:10:13 pm by abw »

redmagejoe

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Final Fantasy II Restored
« Reply #334 on: May 13, 2020, 09:27:34 pm »
I recall there was a reason stated (somewhere... I think...) for why the dash wasn't set to work on the world map by choice. That said, Final Fantasy Restored enabled world map dashing, so for the sake of sticking to the conventions, I don't think it's really an issue for dashing to work on the world map. That said, upon further review, it does seem like the world map in remakes doesn't allow dashing, so use your discretion on this one, I suppose. Loyalty to remake or established precedent from a previous project. Personally I lean towards "Restored convention" rather than remake convention.

I did feel like status should clear on KO'd allies, and found it odd that it didn't when that seemed to be the convention across the rest of the series. Let me test how status and KO works in the remake, and I'll get back to you. Leaving the messages but having them come before the KO message sounds fine. It's less awkward and fits with NES "quirks" of the time, so it doesn't seem like a bug honestly.

EDIT: Took some finagling with the maxed out file, but sure enough, KO'd allies clear their ailments upon death. I think we should try to implement that behavior given that I can't think of any other entries in the series that maintain a status upon revival. If I'm being honest, I think this should probably go into Bug Fix rather than just Restored, as it's hard to tell if this was intended or not, but given the game's track record so far and series convention, it would be easy to assume it was a bug or oversight.



Oh dear. There appears to be QUITE the message bug when a character is KO'd, in either Bug Fix or Restored. In one case, "Firion lost." appeared, while in another, "Toad" appeared.

Also something minor in both patch versions, really a non-issue beyond "polish", but it seems that during the delay between end-of-battle messages and the transition to "enemy item drops" screen, there's a very brief (maybe a few frames?) graphical glitch not present in unpatched or even ChaosRush patched ROM. Maybe it's just a timing issue like we had with our stat refreshes or something. Just thought I'd mention it for documentation, but it really is the lowest priority out of anything else on the list.
« Last Edit: May 14, 2020, 01:23:33 pm by redmagejoe »

abw

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: Final Fantasy II Restored
« Reply #335 on: May 14, 2020, 08:09:24 pm »
I recall there was a reason stated (somewhere... I think...) for why the dash wasn't set to work on the world map by choice. That said, Final Fantasy Restored enabled world map dashing, so for the sake of sticking to the conventions, I don't think it's really an issue for dashing to work on the world map. That said, upon further review, it does seem like the world map in remakes doesn't allow dashing, so use your discretion on this one, I suppose. Loyalty to remake or established precedent from a previous project. Personally I lean towards "Restored convention" rather than remake convention.
Ehh, I have no strong feelings about it either way, but I feel like FF2 has more long overworld walks than FF1 (e.g. Kashuan Keep -> Dreadnought, though that does tend to be a profitable trek); perhaps that's just because I've played FF2 more recently now.

EDIT: Took some finagling with the maxed out file, but sure enough, KO'd allies clear their ailments upon death. I think we should try to implement that behavior given that I can't think of any other entries in the series that maintain a status upon revival. If I'm being honest, I think this should probably go into Bug Fix rather than just Restored, as it's hard to tell if this was intended or not, but given the game's track record so far and series convention, it would be easy to assume it was a bug or oversight.
Probably the best spot to remove other ailments from dead characters would be when a character dies, except death isn't really centralized anywhere, so we'd have to modify every damage-inflicting routine, which does not sound like fun (there is death code that runs at the end of every battle round, but that doesn't help with reviving during the same round a character died). There's no way to die outside of battle, right? Venom and damage tiles won't reduce your HP below 1.

If instead we made reviving clear the other ailments, then I think there are only a few places to patch: casting Life during battle, casting Life outside of battle, and being revived by a Goddess statue. Am I missing anything else? Oh, maybe Phoenix Down outside battle (inside battle it just calls the Life routine) and I guess Esuna both in and out of battle. Alright, maybe 5 places then. Altering Life inside battle is fine, and getting enough successes with Esuna already clears out all other persistent ailments (but not temporary ailments, so we'd have to do those too), but I haven't looked at the code for any of the other revival methods yet.

Oh dear. There appears to be QUITE the message bug when a character is KO'd, in either Bug Fix or Restored. In one case, "Firion lost." appeared, while in another, "Toad" appeared.
Ha, oops, I dropped a line while rearranging some code. Both patches have been updated!

Also something minor in both patch versions, really a non-issue beyond "polish", but it seems that during the delay between end-of-battle messages and the transition to "enemy item drops" screen, there's a very brief (maybe a few frames?) graphical glitch not present in unpatched or even ChaosRush patched ROM. Maybe it's just a timing issue like we had with our stat refreshes or something. Just thought I'd mention it for documentation, but it really is the lowest priority out of anything else on the list.
Hmm, I can't say I noticed any graphical glitches around the item drops screen on my last playthrough, and even testing it by stepping through frame by frame didn't make anything jump out at me.

redmagejoe

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Final Fantasy II Restored
« Reply #336 on: May 14, 2020, 08:17:56 pm »
If instead we made reviving clear the other ailments, then I think there are only a few places to patch: casting Life during battle, casting Life outside of battle, and being revived by a Goddess statue. Am I missing anything else? Oh, maybe Phoenix Down outside battle (inside battle it just calls the Life routine) and I guess Esuna both in and out of battle. Alright, maybe 5 places then. Altering Life inside battle is fine, and getting enough successes with Esuna already clears out all other persistent ailments (but not temporary ailments, so we'd have to do those too), but I haven't looked at the code for any of the other revival methods yet.
Yeah, doing it on revival seems like the way to go.

Hmm, I can't say I noticed any graphical glitches around the item drops screen on my last playthrough, and even testing it by stepping through frame by frame didn't make anything jump out at me.
It doesn't seem to happen all the time, so I might have to watch it more closely in vanilla as well, but watch the top of the screen (above the "background strip" that is supposed to be forest or dungeon or sea or whatever backdrop the battle's meant to have) when you know you're going to get item drops (most notable for 0 gil battles). There's a brief graphical glitch that appears which... I'm fairly certain isn't in vanilla JP, or ChaosRush. That said, I'd have to sit down and extensively test. Happens on both my fceux emulator and FCEU GX on the Wii. Maybe it's an emulation issue though, I don't know.



Refresh my memory. Do persistent status ailments other than Stone or KO still prevent stat gains? Apparently that didn't make it into any of the remakes, which leads me to believe it was a programming error. I can't recall over the course of this project if that was considered for fixing.
« Last Edit: May 15, 2020, 12:49:19 am by redmagejoe »

Jiggers

  • Sr. Member
  • ****
  • Posts: 422
    • View Profile
    • My Ko-Fi Page
Re: Final Fantasy II Restored
« Reply #337 on: May 14, 2020, 11:45:27 pm »
Quote
Probably the best spot to remove other ailments from dead characters would be when a character dies, except death isn't really centralized anywhere, so we'd have to modify every damage-inflicting routine, which does not sound like fun (there is death code that runs at the end of every battle round, but that doesn't help with reviving during the same round a character died). There's no way to die outside of battle, right? Venom and damage tiles won't reduce your HP below 1.

Does FF2 have a routine that adjusts the sprites based on status, that updates fairly regularly? That's where I put mine. FF1 sets their HP to 0 here as well. So the very act of drawing them dead could be used to clear ailments out.

Code: [Select]
: LDA ch_ailments, Y          ; check this character's ailment
    AND #AIL_DEAD
    BEQ :+                      ; if they're dead
      STA ch_ailments, Y        ;; JIGS - if they're dead, it should be their ONLY ailment!
      LDA #$00                  ; zero their hit points
      STA ch_curhp, Y
      STA ch_curhp+1, Y
I know exactly what I'm doing. I just don't know what effect it's going to have.

I wrote some NES music! Its a legal ROM file. - I got a Ko-Fi page too.

abw

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: Final Fantasy II Restored
« Reply #338 on: May 15, 2020, 09:09:43 am »
Refresh my memory. Do persistent status ailments other than Stone or KO still prevent stat gains? Apparently that didn't make it into any of the remakes, which leads me to believe it was a programming error. I can't recall over the course of this project if that was considered for fixing.
Yes, basically any persistent ailment will prevent growth (except for whatever bit 0 represents, which I think is unused, but the game still checks for it, so I dunno). The code for that starts at $05:$A54D. Switching AND #$FE to AND #$C0 would fix that, although one could argue that toads shouldn't be gaining physical skills/stats, people with memory problems shouldn't be gaining weapon/spell skills, and maybe curses should still impede growth.

Does FF2 have a routine that adjusts the sprites based on status, that updates fairly regularly? That's where I put mine. FF1 sets their HP to 0 here as well. So the very act of drawing them dead could be used to clear ailments out.
Probably somewhere, but I haven't come across it yet. There are a variety of issues with character battle poses in the original ROM which still need to be fixed. I guess I ought to finish documenting the rest of the battle code in order to find the best place for this change; hopefully that process will also shed some more light on how battle poses are handled.

redmagejoe

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Final Fantasy II Restored
« Reply #339 on: May 15, 2020, 12:29:23 pm »
Yeah, ailments preventing growth can probably be left alone, unless you had this overwhelming urge to pick out specific ailment bits (poison, blind), which I'm assuming would demand more code. It'll be one of those things that sets it apart from remakes at least, and the logic is sound. Should be more encouragement to use Esuna before the battle's end, too.

Having scanned through the disASM and found where battle messages are stored ($05:$B5A9) and knowing that I'm either looking for any references to $05:$B5A9 with an offset of $13 (Preemeptive Strike) or $15 (Ambushed), or specifically calls to those messages which I doubt will be a thing given the deliberately vague and relative nature of instructions in place of specific conditions, I've eliminated the first 7/17 instances of $05:$B5A9 being relevant. They all seem to deal with post-battle messages, but #8 I believe falls within battle setup routines, correct me if I'm wrong.

I'm looking at 0x03173F|$0C:$972F currently.



Fun new bug discovered. First of all, I wasn't aware that undead enemies would actually run away... You know, being undead and thus supposedly fearless... But apparently if you try to cast Life on a space where an enemy has fled, it will still succeed, said that enemy "fell", "Collapsed!" (is this supposed to come after "fell" for instant death spells?) and play the death sound. No items or gil or anything like that as if you actually killed it, but it is still worth noting, I think.



Another minor, interesting one I've been testing, and thought was another translation bug at first. It seems any enemy formation that has both DualHeads and DualDeads also displays in the "enemy names" window that only appears at the start of a battle Stalagmites as well, even if there aren't any Stalagmites present. I'm guessing this is a pointer issue.
« Last Edit: May 15, 2020, 08:40:02 pm by redmagejoe »