I planned to replace the additional vector functions bit by bit with smaller and clearer code snippets. This seems to be the right occasion to continue this plan.

Here is the new line-plane intersection test:
http://www.opserver.de/wiki/index.php/Plane-Line_Intersection

You can use it like that:
Code:
#include <acknex.h>

<<<INCLUDE LINE-PLANE INTERSECTION TEST CODE HERE>>>

void main()
{
    level_load(NULL);
    mouse_mode = 4;
    
    vec_set(camera.x, vector(-200,0,300));
    camera.tilt = -45;
    
    // Create a simple floor.
    ENTITY *cube = ent_create(CUBE_MDL, NULLVECTOR, NULL);
    cube.z -= cube.max_z;
    vec_set(cube.scale_x, vector(8,8,1));
    
    while(1)
    {
        VECTOR to;
        vec_set(to,mouse_dir3d);
        vec_add(to,mouse_pos3d);
    
        // Get the intersection between the mouse ray and the floor.
        VECTOR *ip = get_line_plane_intersection(mouse_pos3d, to, NULLVECTOR,
            vector(0,0,1), NULL);

        if (ip) // Draw intersection point.
            draw_point3d(ip, COLOR_RED, 100, 6);
            
        wait(1);
    }
}


Just insert the intersection test code and compile it to see it in action.