I've had a lot of trouble making sprites work properly in BMEngine, with 3 revisions to the code already and it was still not right. It's fairly close but glitches are common.
I simply can't use the Doom method because it relies on storing lots of edge information until the end of the scene and that breaks my DSP spanbuffer system, largely defeating the point of it.
The main problem is those floors which change texture or light level without also changing height - used for pools of light in doorways, under light panels etc. This causes sprites to be clipped against a false edge - because the sprite's center may be on the far side of the line, and linked to a different sector which doesn't get visited by the BSP until later. By that time the edge is already committed and nothing can be drawn closer than that edge. The scene is strictly depth/occlusion ordered.
There's no obvious problem for steps/windows etc. and it's not a problem at all for normal walls. Fake floor edges cause most of the headaches and can cause large pieces of sprite to go missing at some angles.
I think I now have a solution that works, but it has required a lot of (still incomplete) changes to the source. Not just sprites but other stuff - preparation of sectors, lightlevels etc. and when things get done.
I have solved the problem by 'looking across' certain types of line under specific circumstances, and activating sprites in sectors across those lines ahead of scene order - but this also requires the sector state to be updated at the same time because activating sprites commits their billboard 'lines' and sector light levels to the DSP segment buffer - and those sectors are not yet ready for drawing.
So the natural order of some drawing processes had to be split up and cached in a separate prepare step. It's slightly complicated by the fact sectors can be visited multiple times per frame since they are shared by subsectors, which are the primary scene (BSP) drawing primitive.
The type of line which gets this 'look ahead' is specifically the floor attibute edge type - and sprites which are activated need a special test which determines if they are trying to cross the line (sprite is on near side of line, or on far side of line AND distance to line is less than sprite radius). If they are in this state, they are considered part of the near sector and processed for drawing. Any bits left over get cleaned up when the adjacent sector is visited.
I haven't mentioned ceilings - because glitches are rare and hard to demonstrate. Gravity pulls downwards and most of the crap ends up collecting on the floor
the very few things which are on the ceiling were placed (manually) away from those types of edge.
The penalty for this is some extra work to do for open segments and some sprites being activated and visibility tested before they normally would, and losing out on some occlusion, because some walls from the current sector haven't been processed/added yet. They still get occluded but occasionally later than usual.
The whole thing is mind-meltingly inobvious so hopefully once this is done it doesn't need fixed again!