FZ Plasma Ball Fixes - RetroKoH/S1Fixed GitHub Wiki

(Original guide by Devon)
Source: Sonic Retro thread
Commit: cb4d4d6

There's a small bug that's probably really insignificant in the grand scheme of things, but still worth documenting.

The plasma balls in Final Zone have a small bug in the movement code which occurs when they first get spawned. If we go to loc_1A9C0 in _incObj/86 FZ Plasma Ball Launcher.asm, we can see this:

loc_1A9C0:
	tst.w	obVelX(a0)
	beq.s	loc_1A9E6
	jsr	(SpeedToPos).l

; Pay close attention to the code below this line
	move.w	obX(a0),d0
	sub.w	objoff_30(a0),d0	; d0 = distance between the plasma ball's current X position and its target X position
	bcc.s	loc_1A9E6		; branch ahead if distance is NOT negative (if zero or negative, it's reached its target position)
	clr.w	obVelX(a0)		; halt horizontal movement
	add.w	d0,obX(a0)		; <-- BUG
	movea.l	objoff_34(a0),a1
	subq.w	#1,objoff_32(a1)

The first 2 lines after the jump to SpeedToPos get the distance between the plasma ball's current X position and its target X position. If it has moved past that target X position, that distance value should be negative. The bcc.s branch after checks if the result is negative, and if it's not, it skips over the rest. If it HAS, then it stops its horizontal movement and attempts to align it to the target X position by nudging it by the amount that it has moved past.

The bug in question is that it uses an addition to do that alignment. When you add a negative number, it's a subtraction. In this case, it's basically moving the plasma ball MORE to the left, instead of pushing it towards the right to its actual target X position.

To fix that, just change the instruction from add to sub. Now, if you're okay with the balls spreading out a bit less like this, you can stop here.
mE4PGZD

In fact, this is the same behavior as the 2013 Taxman remake, because it doesn't have that bug in it.
ebvez4z

But, if you want them to actually spread out further, then go to Obj86_Loop and change muls.w #-$4F,d1 to muls.w #-$59,d1 and you'll get this again:
FyBWOt0