SLZ Pylon Fix - RetroKoH/S1Fixed GitHub Wiki

(Original guide by Mercury)
Source: ReadySonic
Commit: f49b600

Ever wonder why there aren't many lampposts in Star Light Zone? There is only one, in Act 3... right before the boss. Why is that though? Well, that's because there is a minor bug with the foreground pylon tower objects that decorate the zone. If Sonic respawns at a Lamppost, the pylon won't respawn, and therefore will not appear in the foreground. This is because the pylon object's x and y are (0,0) in the object layouts and is unable to load unless Sonic spawns at the start of the level. This will become more apparent if you decide to make larger SLZ layouts with checkpoints throughout. To fix this, we are going to remove the pylons from the object layouts and hard-code them into Star Light Zone in the Objects Manager.

Object Layout Editing

You'll want SonLvl for this. Open the three Star Light Zone acts, open the Objects tab and go to the top left corner of the map. Delete the object at the top-left corner and save. A more in-depth guide on level editing with SonLvl will be added to the wiki later. Hopefully these instructions will suffice.

Objects Manager Mod

As of right now, we have no foreground pylons whatsoever. Let's fix that. Typically, the Object Manager reads object layout files such as the ones we just edited, and loads objects into RAM based on the screen's current position in the level. Fortunately for you, we don't need to get too deep into the weeds to force load an object into RAM regardless of position. Simply open sonic.asm, go to OPL_ClrList:, and add 3 lines and a label like so:

OPL_ClrList:
		clr.l	(a0)+
		dbf     d1,OPL_ClrList			; clear	pre-destroyed object list

+		cmpi.b	#id_SLZ,(v_zone).w		; are we currently in Star Light Zone?
+		bne.s	.notSLZ				; if not, branch
+		move.b	#id_Pylon,(v_lvlobjspace).w	; Manually load the pylon object.
+.notSLZ:

		move.w	(v_zone).w,d0
		lsl.b	#6,d0

We now have Pylons loaded into all 3 acts of Star Light Zone, regardless of spawning position. All done!