- how do the $86 and $87 bitmasks in Functions C0/7CE1 and C0/7D03 work? what are the criteria for choosing different ones?
The only values held in $86 and $87 are 0Fh, 1Fh, 3Fh, 7Fh and FFh. By the looks of it, these are related to map sizes and are used for clamping things like NPC locations to map coordinates (e.g. you can't have an NPC at (40, 8) on a 32x32 map).
Hmm... I wonder if we can use that to fix the camera problem in the Fanatics' Tower's White Drgn room...
- sometimes, the direction in $087E,Y can be above 4, but apparently not when C0/5263 is called. any idea what these higher values/bits mean, or in what contexts they are or aren't stripped out?
$087E,Y is usually used for movement direction (0 = none, 1 = up, 2 = right, 3 = down, 4 = left). It's also sometimes used with higher values, including for stuff like movement speed, but your guess is as good as mine about how that works.
- there is weirdness with the Opera House rats encounter triggering:
http://mnrogar.slickproductions.org/phpBB3/viewtopic.php?f=2&t=236&p=2680#p2680
I think it's just delayed reaction. You can run into the same thing in the 3-party defense battles.
or maybe it'll make things worse, as entities "occupying" two tiles at a time increases their chances of colliding.
My patch doesn't do anything if there's already an object at the destination tile, and as far as I understand the game generally does a pretty good job of maintaining this.
now, even if it is the latter answer, it'd be hard to blame your patch, as the idea that an entity straddling two tiles is in both seems pretty sound to me... and it's ultimately the limited tile-based placement system that's probably at the root of things.
That's exactly what it is. For example, Locke is able to bypass the guard in South Figaro if you enter the Main Menu with precise timing because when the guard starts to take a step downward, he's treated as being at the tile beneath him as well as his current tile, and he's not removed from the "current tile" until the step is completed. When exiting the Main Menu, however, he's put back at the "current tile" but not the destination tile, which means the destination tile is open for Locke to step to, and then the tile behind the guard opens up when the guard is done stepping, allowing Locke to carry on through.