Legend of the Mana Sword (GB Final Fantasy Adventure hack)

Started by xenophile, January 30, 2022, 10:52:35 PM

Previous topic - Next topic

xenophile

I decided that my changes are unlikely to break anything and put a new version into the queue. Last time I made an educated guess that I hadn't broken anything I had a tester look at it anyway and I had so many bugs, so hopefully I'm luckier this time.


Quote from: dagmor on June 09, 2022, 04:10:33 PM
Looking forward to it!

That's interesting. I'd be interested to know if any enemy is vulnerable to mute, and if so try it on them. The most obvious enemy (the wizards) are not vulnerable. It makes sense that they would be...

I tried it on Wizards and Eye Spies at the Undersea Volcano. It seemed to work. What I did was keep casting it regularly while standing near them, and observed that they did not throw projectiles at me. No clue how long it lasts (probably 20 seconds) or if it has any bugs related to opening windows (like Nectar). It's pretty likely that it's buggy.

QuoteThat's an interesting idea. It's kinda annoying how the girl acts so helpless, it feeds a bad stereotype. A moogle would help, but you'd need to add a mother moogle as well. What's the Mana saga lore around this? Is it always a female human who sacrifices her life for the continuation of the Mana trees? If so, probably best to leave it...

The mother is a tree. The child can be a moogle.

There is a scene where characters are surprised she's Fuji's mother. That scene is much improved by Fuji being a moogle.


I reworked the line. According to the livestream translation of this line and Adventures of Mana, Julius says he can see or sense Fuji, which probably got cut for space. I am still not 100% happy with having him mention gender here and having just worked on it I now remember why: if you are playing as Amanda it comes off like you might be the one they are searching for. While story wise that's not a particularly bad fake-out to have, it an entirely new plot point.

Of course I also just talked about how awesome a plot point it is when characters realize a moogle has a non-moogle mother, so I'm taking my own objections with a grain of salt.

QuoteWould that be easier than increasing the equip menu size?

Increasing menu size may or may not be difficult, but it would absolutely break save game compatibility. There will be a point where I break save game compatibility. When I get close to that point I'll investigate it, but I'm not there yet.

Thinking about the Battle Axe, both the Were Axe and the Zeus Axe can be trashed or sold. Just letting the player trash the Battle Axe after getting one of those would allow them to soft lock themselves in a lot of places. I'm holding off on making any changes for the now.

QuoteIt'd be good to know how it can fail, even if it's not fixable.

Yeah. I've had the switches in that room fail for me before. I started looking at. It looks like roughly 10% of the time the script just isn't triggered. That is going to be a nightmare to debug.

QuoteDavias's fireballs do not need to flash. I do think it's important for the red dragon to flash though. That's the mechanism for all the bosses (except Shadow Knight) to know they're being damaged. Can you change the name of "Red Dragon" to "Blue Dragon" or something else instead?

Unfortunately I sort of agree with you (at least right now). I'm reverting this change for the next version, but I'm also pretty disappointed.

QuoteVery amusing. Good job Amanda, you did it - high five!

Yup, but I regret to inform you I've fixed it in the next version.

QuoteYep, it is. And I don't think it's worth fixing.I'll give you a consistent mechanism to reproduce.
1. Stand here (facing down is important)
2. Swing the sickle
3. Walk left

My pleasure. I'd be happy to continue helping/testing too!

I have been able to reproduce with this. That will help a lot. Thank you.

QuoteI'd like to eventually build on your patch with a Speedrun patch that:
1) Fixes the iron helm bug
2) Uses a fixed seed for enemy locations when you enter a screen (to avoid back-forth shenanigans). Think of the fixed positions like a speed wall in climbing sports.

Maybe more...

Excellent! At this point I'm both really good at this game and really terrible at it so it would be interesting to try that hack.


dagmor

Just completed another run through. One patch bug and a couple non-patch-related bugs found.

First off, the text boxes for the most part were improved, looks good! There was one scene though where it broke down:


I imagine that's from the scene starting with the characters at the top, then "Man" shows up through the bottom.

Next, here's another chest room that needs fixing. It's not until a box is destroyed (after placing them all) that the door opens; I don't think that's intentional.




And this is a fun one. If you beat Shadow Knight with Lit, sometimes he bugs out and starts falling through the screen, and wrapping back from the top. The only way I could stop it was to hit him again.




Finally, maybe but a bug, but certainly funny. If you go south from the palace when Wendel is under attack, and get hit by a monster near the top of the screen, you'll get knocked upwards. With the way that transition is coded, it'll take you back to the palace and you'll fly into this guy.


He'll repeat himself either 4 or 6 times, depending on how close to the top of the last screen you were when hit. I just love the sprite expression alongside the text on forced repeat!

JKPhage

Quote from: xenophile on June 09, 2022, 07:10:31 PM
The mother is a tree. The child can be a moogle.

There is a scene where characters are surprised she's Fuji's mother. That scene is much improved by Fuji being a moogle.

While I know I'm going to sound like some ungrateful snob for saying this, please don't do something like this. This is shaping up to be such an amazing project with proper character names, colorization, bug fixes, translation cleanup and basic improvements to a game that sorely needs it, and I'd love to add it to my collection of hacks that have outright replaced the original version. Switching Fuji into a moogle would kind of kill all the drama if I'm being frank.

That said, there are plenty of hacks like this that offer optional patches and the like to pick and choose certain elements. I could easily see a "Fuji is a Moogle" optional patch or vice versa if you choose to make it the default, because that's your prerogative. I'm loving all that I see of this so far, and as of yet it's shaping up to be a definitive way to play the game with badly needed improvements and a slightly more faithful translation, so all I can really ask is that if you do choose to mess around with big things like this, please consider offering some kind of "opt out" patch for it.

That out of the way, this really does look phenomenal, and I look forward to seeing what the finished product comes out like. I appreciate all the work you're putting into it, and the fact that you're sharing it with the community. :laugh:

xenophile

Quote from: dagmor on June 18, 2022, 09:56:41 AM
Just completed another run through. One patch bug and a couple non-patch-related bugs found.

First off, the text boxes for the most part were improved, looks good! There was one scene though where it broke down:


I imagine that's from the scene starting with the characters at the top, then "Man" shows up through the bottom.

Thanks for spotting that. It will be easy enough to fix by having the hero take one more step to the south, and I think it will look better that way too. (I might make Cibba turn around to face the action as well.)

QuoteNext, here's another chest room that needs fixing. It's not until a box is destroyed (after placing them all) that the door opens; I don't think that's intentional.

I took a look at the script for this and I bet it is intentional. There is one script shared by all four blocks, and it is very simple:

IF_TRIGGERED_OFF_BY(a9 )
  SOUND_EFFECT 10
  OPEN_DOOR_NORTH
END


What would I change that to? The switch puzzle scripts essentially double in length every time you add a unique switch to the puzzle; I don't think they ever dared to use four that needed objects placed on them. It could be that they intended to in this case, but it was problematic enough that they decided to change it completely.

QuoteAnd this is a fun one. If you beat Shadow Knight with Lit, sometimes he bugs out and starts falling through the screen, and wrapping back from the top. The only way I could stop it was to hit him again.

Yeah. I haven't gone looking for Shadow Knight's code yet, but I'm pretty sure there is a fairly large amount of rather buggy assembly just for that one fight. That's a big project on its own so that fight will probably stay a little buggy.

QuoteFinally, maybe but a bug, but certainly funny. If you go south from the palace when Wendel is under attack, and get hit by a monster near the top of the screen, you'll get knocked upwards. With the way that transition is coded, it'll take you back to the palace and you'll fly into this guy.


He'll repeat himself either 4 or 6 times, depending on how close to the top of the last screen you were when hit. I just love the sprite expression alongside the text on forced repeat!

It also happens fairly often after the first fight. Much less amusing there. A first time player could encounter this bug in the first minute of play. I would love to see this fixed. The collision code is still a black box to me but I am hoping to work on it eventually.

Quote from: JKPhage on June 18, 2022, 07:49:27 PM
While I know I'm going to sound like some ungrateful snob for saying this, please don't do something like this. This is shaping up to be such an amazing project with proper character names, colorization, bug fixes, translation cleanup and basic improvements to a game that sorely needs it, and I'd love to add it to my collection of hacks that have outright replaced the original version. Switching Fuji into a moogle would kind of kill all the drama if I'm being frank.

That said, there are plenty of hacks like this that offer optional patches and the like to pick and choose certain elements. I could easily see a "Fuji is a Moogle" optional patch or vice versa if you choose to make it the default, because that's your prerogative. I'm loving all that I see of this so far, and as of yet it's shaping up to be a definitive way to play the game with badly needed improvements and a slightly more faithful translation, so all I can really ask is that if you do choose to mess around with big things like this, please consider offering some kind of "opt out" patch for it.

That out of the way, this really does look phenomenal, and I look forward to seeing what the finished product comes out like. I appreciate all the work you're putting into it, and the fact that you're sharing it with the community. :laugh:

Thanks so much! I did actually release the moogle patch as an optional with FFA Gender Swap, but while it was awesome for *one* play-through, it would certainly never be the default.


Here's an old screenshot I had lying around.


Also, after that I did another optional patch that I never released. It happened to be the playthrough where I actually backed up my .sav file at important parts, so now Fuji is always referred to as Tim (Curry) because the character I swapped is "The Buttler". I have long since gotten tired of this joke.  :(

MD_Prometh

https://imgur.com/a/2UtnQlH

This line of dialog doesn't really read well when spoken out loud, and IMO should be rephrased to something like "There's a girl I've seen who has the key". Maybe it would be a good idea to compare the original Japanese text.

xenophile

#25
Quote from: MD_Prometh on August 03, 2022, 04:21:06 PMhttps://imgur.com/a/2UtnQlH

This line of dialog doesn't really read well when spoken out loud, and IMO should be rephrased to something like "There's a girl I've seen who has the key". Maybe it would be a good idea to compare the original Japanese text.

Update: I had avoided Google Translate this time since it's usually really bad, but I kinda like it's version of this.
QuoteJulius:...One person
 holds the key...
 I can see it...

I may just use that. I mean, it's still a bit awkward, but that's how I imagine Julius speaking.

I agree. I've struggled with that line a lot. I've started looking at it and the surrounding conversation.

What I've done with the last few bits I've re-localized (still unreleased) is to create a spreadsheet of all the lines in the conversation (here starting with "Shadow Knight and Julius... What's going on?" and ending with "Where is this?") and then collect the different versions of them from EN, JP, Adventures of Mana, Tomato's live translation, and the current LotMS. Then I've found that there are several people on a Mana related Discord who are generally interested in providing translations, which get their own column(s).

At that point it's just a matter of figuring out how to convey that best, since it's typically much more verbose than the official english translation. Space is less of an issue than you would think, but doubling the amount the player has to read is usually not a good move.

The actual line you've flagged, the official English translation was "A girl has the key to it." This was from the Japanese "...ひとりの しょうじょが かぎを にぎってます... わたしには それが みえます...". Obviously this had some heavy editing.

I decided to try and figure out some of the nuance myself before putting out to fluent translators. The first word is "hitori", which is the first word in Legend of Zelda, translated as "alone" of which it is dangerous to go--this gets dropped from pretty much every translation except Tomato's. The next bit is "shoujo" as in "Shōjo manga"--I've heard Japanese usually doesn't go out of its way to gender people, but that sure seems pretty strongly gendered to me. Then we get to the first part I decided to look up: "kagi", meaning "key" but can also mean "clue", which is helpful to me because I wasn't clear on whether the key is the Pendant, or Fuji's heritage/knowledge. I'm reading it as having double meanings in Japanese, which is great because it's hard to translate so it doesn't.

The second sentence is also difficult. As far as I can tell, Julius is just mentioning having seen her, not that he has had visions of her. Shadow Knight seems to know what he's talking about, but I'm pretty sure it's not supposed to be clear to the player at this point. It's sure not clear in the official English translation where it's completely dropped!

Anyway, I'm about half way through a pre-release test run at this point, but I'll get in a re-write of this scene.


Cris1997XX

I know this hack isn't even finished, and it'll probably still take a long time, but it would be amazing to see a fully colorized version of the game that takes advantage of the Game Boy Color's faster CPU to lessen the slowdown (If there is any, I honestly haven't tried it yet)

xenophile

New version released! This started out as a quick bug fix for the Wendel cutscene bug dagmor noticed, and then got a little out of hand with a bunch of small enhancements. Once again, there's no big headline feature, just a lot of small improvements (some of which were a lot of work).

A lot of work went into this release that won't be obvious. I did some research into the "line effects" (fade effect for the intro scroll, the transition "shutter" effect, Dark status effect, the letterbox effect in the ending) because these effects need a re-write to work in a colorization. Two changes (bug fixes to the original game) made it into this as a result of that research: the transition "shutter" effect no longer begins with the screen flashing all white for a frame, and the same effect when you have the Dark status effect now works properly.

Can't really blame them for not testing their transition effect while under the effect of Dark, but it was obvious they tried to handle that case, and got it wrong.

Quote from: MD_Prometh on August 17, 2022, 08:49:07 PMThat script change works.

After a fair amount of thought and consultation with people on The Mana Series Discord, this is what I went with:

I also found there was some pacing in that scene (implemented by adding short sleep commands between drawing text) that had been removed from the english localization which I restored.

Quote from: Cris1997XX on August 18, 2022, 04:06:31 PMI know this hack isn't even finished, and it'll probably still take a long time, but it would be amazing to see a fully colorized version of the game that takes advantage of the Game Boy Color's faster CPU to lessen the slowdown (If there is any, I honestly haven't tried it yet)

Slowdown isn't a big problem in this game. I'll take a look at double speed mode at some point, but I haven't yet. One thing I did try out was using the CGB's HDMA functionality to load tile graphics. That cuts down slightly the amount of time it takes to scroll to a new screen. Turning on double speed would likely have a similar benefit and might be easier.


Cris1997XX

Quote from: xenophile on August 22, 2022, 03:39:44 PMSlowdown isn't a big problem in this game. I'll take a look at double speed mode at some point, but I haven't yet. One thing I did try out was using the CGB's HDMA functionality to load tile graphics. That cuts down slightly the amount of time it takes to scroll to a new screen. Turning on double speed would likely have a similar benefit and might be easier.


There's a colorization patch for Faceball 2000 on Game Boy with two different versions, and one of them uses the GBC's HDMA functionality. It is pretty fast compared to the original, but the graphics appear glitchy on most emulators -Mostly because they aren't accurate enough?-. I'd say double speed would be the safer method by far, although it isn't that important yet

radimerry

Hi! Played some of the hack and like it so far. Noticed a likely vanilla game bug. Doesn't always happen when damaged.



And an unimportant side-note. The code to fix the window shutter can be simplified down further (copy forward instead of reverse)
https://github.com/radimerry/bucket/raw/f5728a68c43ff821fd28fc20ffc5e333e430f17f/ffa-shutter-flicker.txt


bug note:
LotMS 2022-08-21 code uses rra - rra which can be an unlikely small problem.
a = 0d ==> 06 + c ==> 83

xenophile

Quote from: radimerry on September 05, 2022, 09:33:43 PMHi! Played some of the hack and like it so far. Noticed a likely vanilla game bug. Doesn't always happen when damaged.

You are saying the bug is the hero disappearing there? There are a lot of oddities like that. I'm hoping that eventually the combat routines get teased out enough to make debugging things like that easier.

QuoteAnd an unimportant side-note. The code to fix the window shutter can be simplified down further (copy forward instead of reverse)
https://github.com/radimerry/bucket/raw/f5728a68c43ff821fd28fc20ffc5e333e430f17f/ffa-shutter-flicker.txt

I'm really happy to hear someone's looking over my code!

I have this comment in my change: "this copies the buffer backwards, maybe to make sure it always stays ff terminated?"

I found it hard to prove that there wasn't a timing window that could result in a bug if an interrupt fired during the copy, if the copy happened forward. I found it trivial to think through all the cases copying backwards (since the 0xff terminator is the first thing written).

I might be overly paranoid, but I find it difficult to prove that they were being overly paranoid.

Quotebug note:
LotMS 2022-08-21 code uses rra - rra which can be an unlikely small problem.
a = 0d ==> 06 + c ==> 83

Huh. Yeah, that's ugly. It looks like that actually happens 100% of the time... so why isn't it a problem?

Looks like when this is read back it immediately gets doubled and then quadrupled with add commands (not adc). The first add strips out the extraneous high bit, but leaves the carry bit set. The second add resets the carry bit.

Good find. I got lucky (or unlucky) that this works. As a side note, I think (if I recall correctly) that everything that uses this value quadruples it, but I decided to use a light touch and not pre-multiply it.

Thanks for the notes on my assembly. It's exciting that someone is actually looking at it.

radimerry

QuoteYou are saying the bug is the hero disappearing there?

Yes. First time, I thought the game broke and reset. Happened again (!) and I waited. Reset anyways and then I got the expected result (no disappearing heroine).

There's a damage timer at C4D2 but noticed that VRAM gets wiped during the blinking phase. Plus game uses lots of scripting routines. I suppose not all 256 (?) s-opcodes are used and some can be hijacked for other uses?

Sadly the timer gets frozen when the cutscene starts and doesn't have a way to restore the invisible sprite.


QuoteI found it hard to prove that there wasn't a timing window that could result in a bug if an interrupt fired during the copy, if the copy happened forward.

Discussion only for thought.

Game uses a halt. Vblank fires, uploads data, runs music and returns. Game then runs the scripting code which says to create the window effect, so this would start at LY~0D-10 worst-case perhaps. We have until 7E (status bar) to do what we want. A fast copy takes 1.0-1.5 lines.

If the LCD is being actively used between 00-7D, that IRQ could fry someone. Does the game play dangerously by creating a new window effect while another one is running? If yes, I'd be worried. If no, then I (expect) nothing bad to happen because only LCD can interrupt and harm.

Though if the hacker is not hurting for space in Bank 0, optimization is an unnecessary moot point.


QuoteGood find. I got lucky (or unlucky) that this works. As a side note, I think (if I recall correctly) that everything that uses this value quadruples it, but I decided to use a light touch and not pre-multiply it.

I think there was some safety net during the LCD ISR that catches unusual value ranges and prevents danger. LCD handler is setup to run in 4-byte fixed structs but the no pre-multiply penalty is so tiny, a few cycles won't speed up the game anywhere.

radimerry

#33
The "Iron Helm" bug can be helpful and problem.



Glitch is activated when it finds 1st empty equipment slot when loading save. It then sets power ratings to this array:
12 11 10 9 8 7 6 5 4 3 2 1 @ d6be


In above example, 1st Genji Helmet has +19 (25) ==> +0A (10) bonus. Every item after gets weaker, with the last one being crushed.

Weaker items gain from the exploit but strong items become nerfed.


A sample fix
https://github.com/radimerry/bucket/raw/4e791f8e1fec2733449f0beb358c7959d564b341/ffa-load-equip-power.txt

The bug was that hl was not incremented if the slot was empty. It would keep looping and re-reading this same empty value until end-of-inventory.

ROM2:7355 21 DD D6        ld  hl,D6DD        equip items
ROM2:7358 11 B3 D6        ld  de,D6B3
ROM2:735B 06 0C           ld  b,0C


ROM2:735D C5              push bc
ROM2:735E 7E              ld  a,(hl)        item #
ROM2:735F CD 9C 56        call 569C        get property
ROM2:7362 78              ld  a,b
ROM2:7363 0C              inc  c
ROM2:7364 28 15           jr  z,737B        === bug: hl not bumped

For unsuspecting players, this can be a handicap. Sell a bunch of items or throw things away (make your inventory have bunch of holes), save game, load game later and the bug appears. Your DP will suffer until you sort everything into 1 solid block and re-save + re-load.

xenophile

#34
Quote from: radimerry on September 06, 2022, 04:26:23 PMYes. First time, I thought the game broke and reset. Happened again (!) and I waited. Reset anyways and then I got the expected result (no disappearing heroine).

There's a damage timer at C4D2 but noticed that VRAM gets wiped during the blinking phase. Plus game uses lots of scripting routines. I suppose not all 256 (?) s-opcodes are used and some can be hijacked for other uses?

Sadly the timer gets frozen when the cutscene starts and doesn't have a way to restore the invisible sprite.

Is it pausing longer in this case?

This is also annoying because under certain conditions you can trip the script while being knocked back, and that causes you to have to talk to Willy about five times in a row.

There are definitely fewer that 256 defined script commands. Here's the table with labels: https://github.com/daid/FFA-Disassembly/blob/master/src/code/script/opcodetable.asm

I think LotMS still isn't using any custom script commands, but I've done experiments and what I usually do is just replace scriptOpCodeTakeXP since that saves a few steps, and it's a large block of unused code I can replace (in Bank 0 no less!).

QuoteThough if the hacker is not hurting for space in Bank 0, optimization is an unnecessary moot point.

More space in Bank 0 is never a bad thing. As I said, I think this is safe, but it is tough to be 100% sure. I'll think about it. I often put in one hack per release that I think has a chance to cause bugs, so if bugs get reported I know where to start looking, so if nothing else potentially dangerous makes it in then this probably will.
[/quote]

Quote from: radimerry on September 06, 2022, 09:26:12 PMThe "Iron Helm" bug can be helpful and problem.

That's a nice fix! I didn't realize it had a chance of having a negative impact. I've gone ahead and added it to the next version.

I thought you might like to know, I changed your code slightly: As far as I can tell the
res 7, a is not necessary because the called function does an and $7f.

Also, while I'm happy to have you working on whatever strikes your fancy, this fix reminded me of something that's been in my todo list for a while:
QuoteFix high level Flare: "If you raise the skill (affects the power of magic) too much (94 or more), the power of the magic "flare" will weaken."
(That's Google translate.)

This isn't something I've personally reproduced, but apparently if you hit 94 Wisdom, the Flare spell starts doing zero damage. If you do this before destroying the crystal in the desert (an invisible enemy with 1 hp that is immune to everything except Flare), you have to reset and cast without opening any menus.

There are also larger assembly changes I've been putting off that I could pitch you on if you wanted, but this one seemed like it's related to the loading code you were looking at. Of course figuring out the disappearing on damage issue would also be awesome.

Ok Impala!

#35
Something I'm hugely interested in is getting rid of the bounce back when you get hit by a monster. As long as the player is in that state it ignores all event scripts on screen. Making it possible to glitch onto tiles you aren't supposed to be on. Eliminating bounce back would fix this, and I'm sure it would feel better in game too.

There is already code for that in the game. When you walk over spikes, you get hurt, but you don't bounce back.

@radimerry: We've got a Discord server where we discuss FFA hacking. Please send me a DM or e-mail if you'd like to join us there for a more indepth discussion about the improvements we are working on for FFA.

radimerry

#36
QuoteSomething I'm hugely interested in is getting rid of the bounce back when you get hit by a monster.

I think 01:4f7b controls the damage type, with the object speed at 01:4fa5 (set to 00 and player stands still). Assuming that collision flag disabler is around there too.


QuoteAs long as the player is in that state it ignores all event scripts on screen. Making it possible to glitch onto tiles you aren't supposed to be on.

I got hit by a monster and shoved onto the tile between Hasim and Girl. Game moved them around to let me escape.


QuoteWe've got a Discord server where we discuss FFA hacking.

Mostly here for bug fix assistance but I'll think about it.


QuoteIs it pausing longer in this case?

Felt like 3-4 seconds of inactivity before the box appears.


QuoteAs far as I can tell the res 7, a is not necessary because the called function does an and $7f.

Good catch!


QuoteThis isn't something I've personally reproduced, but apparently if you hit 94 Wisdom, the Flare spell starts doing zero damage. If you do this before destroying the crystal in the desert (an invisible enemy with 1 hp that is immune to everything except Flare), you have to reset and cast without opening any menus.

Not able to test that area yet but possible that Rev 0 (Japan) has the bug but not Rev 1 (USA). Speculation though.


QuoteWarp bug



Player is standing on red spot in swamp. When you destroy the left leaf off-screen (y=09, x=ff), it triggers the bug.

Basically we're reading metatile data outside the range and it ends up writing back, corrupting the player ypos to 0 (see 01:52a5). But we could be destroying other data too depending where on the screen border.


One suggestion on fixing:
- There's a table at 01:51f2. With 5 ptr entries that can be combined and reduced down. DE has the x-y meta position. Use a boundary check to keep it within visible map coords, which I haven't checked the max values.


EDIT:
Warp bug wip1

https://github.com/radimerry/bucket/raw/d90bd79d44fdc712bb47904436e3890172de98c2/room-tile-replace.txt

Adds boundary checks for meta-tile writes. Which reveals the real bug - that off-screen 0xff appears to be a rounding error and should be 0x00.




EDIT2:
So this function
ROM0:08C4 CB 3A            srl  d
ROM0:08C6 CB 3A            srl  d
ROM0:08C8 CB 3A            srl  d
ROM0:08CA 15               dec  d
ROM0:08CB 15               dec  d
ROM0:08CC CB 3B            srl  e
ROM0:08CE CB 3B            srl  e
ROM0:08D0 CB 3B            srl  e
ROM0:08D2 1D               dec  e
ROM0:08D3 C9               ret 

converts an x-y pair to meta-tile coord, but it doesn't check for zero clipping (02 / 8 - 1 = -1 xpos).


Chose to do it inside the routine instead
https://github.com/radimerry/bucket/raw/79df2de583f257f81c55b37f41f3c0d1af382375/room-tile-replace.txt

which yields



xenophile

Quote from: radimerry on September 08, 2022, 06:23:56 PMPlayer is standing on red spot in swamp. When you destroy the left leaf off-screen (y=09, x=ff), it triggers the bug.

Basically we're reading metatile data outside the range and it ends up writing back, corrupting the player ypos to 0 (see 01:52a5). But we could be destroying other data too depending where on the screen border.


One suggestion on fixing:
- There's a table at 01:51f2. With 5 ptr entries that can be combined and reduced down. DE has the x-y meta position. Use a boundary check to keep it within visible map coords, which I haven't checked the max values.

I think I understand (mostly). This function should an x value from 0 to 19, and a y value from 0 to 15, but it's also possible that it gets passed values outside these ranges. The test case here has it getting x=0x255. Your code looks to handle x=255, x=254, y=255, x>19, and y>15.

For the 255/254 cases it does this by replacing those values with 0, which results in the bush behind you being cut.

One odd thing I notice here is that if you stand in the same place relative to bushes that are not at the edge of the screen and use your Sickle, one of the bushes behind you does not get cut.

If I'm reading this right, one of your earlier patches left that bush uncut, but your newest has it cut, but only if you are at the very edge of the screen?

My gut instinct is it would be best if all the bushes behind you get cut, but if that's impossible I would prefer your earlier draft.

Thoughts?

Also, am I missing something or does the game check the attributes of the correct tile before replacing the wrong tile? So they do the math twice and get a different answer each time?

radimerry

#38
QuoteAlso, am I missing something or does the game check the attributes of the correct tile before replacing the wrong tile? So they do the math twice and get a different answer each time?

Taking a look at both pictures.

==

Mm .. mmm .. okay. I think I'm missing something like you suggest. The x=ff and player ypos being overwritten is correct. :)


QuoteOne odd thing I notice here is that if you stand in the same place relative to bushes that are not at the edge of the screen and use your Sickle, one of the bushes behind you does not get cut.

Original == wip1 == wip2

That one bush is still bugged. Have to debug the x,y value. Not sure why original asm fetches metatile x-1 and y-2. :huh:


EDIT2:
I believe you are correct. It reads the meta-data from 1 location but writes the data to the wrong spot. So the original plant meta-tile will keep reading back as uncut.

And the swing cutting is always going to miss some tiles, since we're on that 8px mid-boundary. Agree that draft1 (uncut bush at screen edge) would be better solution. Or a different coding hijack to fix the warp bug.

--

Plus yes, that diagonal sickle does look strange for a few frames (vram upload is split into 2 transfers so the odd-looking sprite for a brief moment).


EDIT3:
Flare bug only happens with Japan. Could not repeat for USA.


EDIT4:
Sadly can only offer analysis but no fixes.

--

Seems related to the meta-tile swinging bug. Only the left 8px and middle floor tile will register. Right 8px is not detected by game.

dagmor

So much love to you folks for working on this game! :beer:

I did another playtest of the latest release. Overall, I enjoyed the improvements. Here's a few oddities I encountered:

  • Check out Amanda's head. This happens consistently in the menu from this spot.

  • I don't think I've noticed a chest forming on top of an open chest before. Not a big deal, but odd nonetheless.

  • I recommend resetting the darkness condition if possible at the start of cutscenes. Otherwise you sometimes wind up with this, which doesn't translate well with the inverted palette (scene crossing the bridge right before coming out of the waterfall):

  • I think this has been around a while, but I recommend moving shadow knight down a bit to prevent the overlap.

  • So this is new to me, but could be a bug in the original: in this room I killed an enemy with fire, then cast fire again as the enemy turned into a chest, and my fireball started making cloverleaf patterns around the new chest. It never could "kill" the chest, so it just kept trying indefinitely. I grabbed a RetroArch save state if interested. The heroine could not perform any action while the fireball danced. Eventually another monster would get in the way of the fireball and take it's impact. Then all was back to normal.

  • The Dime castle loads slowly upon re-entering the region. I'm not sure if this is original, but it seemed slower than I remember. In general, there seemed to be more flashy/slow sprite action, but it's hard to say if that was due to RetroArch or my own poor memory.

  • As an aside, the ninjas can get glitched with the Lit spell just like Shadow Knight. After being hit they move in a straight line, completely off screen, then reappear on the other side. This continues until the player hits the ninja again, then it dies.

  • Original but annoying. On this screen, if I walk to the left, there's an invisible staircase to go back to the path with elephants. I would argue that transition should occur anytime the player walks below a certain tile, not just on one specific tile with an invisible staircase.