Hi people.
The problem is that the floor moves with the player in same time. But if not draw walls i can see, that floor is just rotating but not moving in any direction — it is static. In the correct implementation, the player must walk on the floor. I attach the animation on which this effect is visible and my code that implements the collision with the floor. I have tried different versions of code for floorcasting (from forums, sources, including current version — from lodev).
Note: I implemented level geometry as sectors (set of lines), not as blocks like in Wolf3d. I know that Doom uses bsp tree, and renders floor in different way. But I suppose that current way works with sectors too (but slowly).
stripPosY = (ProjectionPlane.me().sizeInWorld.Y / 2 - (int)(stripHeight / 2));
stripPosY += (int)stripHeight-1;
startPixel = stripPosY;
while (startPixel != ProjectionPlane.me().sizeInWorld.Y)
{
float curdist = ProjectionPlane.me().sizeInWorld.Y / (2.0f * startPixel - ProjectionPlane.me().sizeInWorld.Y);
float weight = curdist / (float)(minimalDist);
float floorX = weight * ((PointF)minimalIntersection).X + (1.0f - weight) * (Player.me().worldPosition.X);
float floorY = weight * ((PointF)minimalIntersection).Y + (1.0f - weight) * (Player.me().worldPosition.Y);
int textureX = (int)(floorX * ProjectionPlane.imageFloor1.Width) % ProjectionPlane.imageFloor1.Width;
int textureY = (int)(floorY * ProjectionPlane.imageFloor1.Height) % ProjectionPlane.imageFloor1.Height;
textureX = (int)Math.Abs(textureX);
textureY = (int)Math.Abs(textureY);
SolidBrush b = new SolidBrush(ProjectionPlane.imageFloor1.GetPixel(textureX, textureY));
g.FillRectangle(b, stripX, startPixel, 1, 1);
startPixel++;
}