SBZ Trapdoor Display Glitch - RetroKoH/S1Fixed GitHub Wiki

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

The trap doors in Scrap Brain Zone have a small bug where if you are off screen, but not enough to despawn them, their sprite will wrap over and appear at the edge of the screen. For example, here's this trap door:
3soXJz8

And if I move a bit to the left, but not have it despawned yet...
A2Yf9W9

The reason for this is that it has a pretty ridiculously high sprite width set on initialization.

        move.b    #$80,obActWid(a0)

The trap door sprite is $80 (128) pixels wide, but the value set here is supposed to be half of that. The fix is simple: change the $80 to a $40.

It should be noted that the sound for when it moves is only ever played when the object is on screen. Due to the larger width, the sound could play even with it was just slightly off screen, but with this change, it will no longer play if the object is not off screen at all. If you want to retain that behavior, then you'll have to manually check the camera's position.

RetroKoH Note: It should be noted that there is at least one other object that might have a similar issue. The gigantic platform at the start of SBZ3 (Technically a Labyrinth Zone object). You'll never see this object in standard gameplay because when the sprite wraps over, it is obscured by the foreground chunks. I'll update with a fix later, as you might want to fix it if you plan on using this object in places where such a bug could occur.