Jun 17, 2021

Sypha's Lightning Targeting Error

In all versions of CV3, Sypha's lightning spell actually fails to track targets correctly. This is a very minor issue due to how quickly each orb acquires a target, but the typo is still there. 

The offending byte (yup, just one byte as usual) can be found at $03B107 in the US version and $03B0C3 in the Japanese version, with a value of #B0 (it should be #E017 just before it). You should change this byte to #90.

Instruction #B0 is a "branch carry set" instruction, or BCS for short. The carry was set by that prior #E017, which compares (#E0) the accumulator value to #17. Since #17 is the maximum number of instances allowed, a BCS should be used to break the loop, since values of #17 or greater would be illegal. However, the BCS in this case attempts to continue the loop illegally. The only time this branch would have succeeded is if the final lightning orb acquired a target, but such scenario would never arise due to this typo which causes the loop to break prematurely.

So what would fixing this typo actually achieve? To put it simply, in the situation that there are multiple enemies near Sypha when she casts her lightning spell, each orb would acquire its own unique target right out of the gate. Instead, what happens is each orb is forced to wait a couple steps prior to finding a target. Like I said, it's a very minor issue, since most enemies will have only moved 2 or 3 pixels in that time. 


One other area that may or may not be a bug can be found a few bytes prior. You can find a #C980 about 11 bytes up, then a #C940 about 18 bytes before that. If you swap these two values around so #C980 is first, you can change the criteria for lock-ons. Currently, an enemy must be within 64 pixels horizontally and within 128 pixels vertically. Taking into consideration thew screen is larger horizontally than it is vertically, especially when taking the HUD into account, it may be more logical to have the horizontal distance be longer than the vertical. For die-hard fans, this may be more noticeable.

No comments:

Post a Comment

©TheouAegis Productions™. Powered by Blogger.