This was an intentional change actually, that I needed to do in order to add broken support for drawing O-Layer image overlays above platforms. Compare the attached hold's The Entrance with how it looks in 5.1.1 and 5.1.0 (attached in the next post).
Essentially the idea is that we have this rendering order at the moment:
1. Draw O-Layer except platforms
2. Draw Platforms
3. Draw O-Layer effects
4. Draw Platform lighting
5. Draw T-Layer, while also applying lighting
The issue is the combination of a moving platform, drawing platform lighting, room darkness. Pit tiles only get room darkness, while platforms also receive cast light. Let's say I change it so that platform lighting is applied directly at the light's position:
So platform P moves from tile A to tile D. Tiles A, B and C are pit and only receive room darkness. Tile D is a platform (because from game's perspective the platform is already there) and thus it receives no lighting from step #5, because lighting was already applied at step #4, so D would be completely bright, while the parts of platform that are on A, B and C would be darker than required.
There are two solutions I can think of but I didn't want to implement them due to how complex they are:
1. When drawing each T-Layer tile, check if it is not partially covered by a moving platform, and if it is only draw the darkness over the part that is not on platform. I was afraid of this change because it seemed very computationally intensive.
2. Draw lighting to a separate surface, so that different passes overwrite (rather than multiply/add) the light, and then draw the whole light surface over the room all at once. So first it would draw the regular lighting for all the tiles, then draw Platform lighting on top of it, replacing the pit's darkness, and then finally apply the lighting to the room surface.
Solution #2 would have some additional benefits too - it could potentially simplify other code (eg. how moving mirrors/kegs are drawn) and open the door for more lighting variation with different elements.
But I was a little bit scared to do either of those changes.
____________________________
My website