//qbism//00-04-29 muff@yakko.globalnet.co.uk - 17 Mar 2000
	trace_t        steptrace, downtrace;
	vec3_t        dest,stop,downmove;
	float        s1,c1; //this will store the sin and cos values as they are used so heavily

	//end of muff

	lheight = currententity->origin[2] - lightspot[2];

	height = 0;
	verts = (trivertx_t *)((byte *)paliashdr + paliashdr->posedata);
	verts += posenum * paliashdr->poseverts;
	order = (int *)((byte *)paliashdr + paliashdr->commands);

	height = -lheight ;//+ 1.0; //was 1.0 - muff

	//qbism//00-04-29 muff@yakko.globalnet.co.uk - 17 Mar 2000
	// better shadowing, now takes angle of ground into account
	// cast a traceline into the floor directly below the player
	// and gets normals from this
	VectorCopy (currententity->origin, downmove);
	downmove[2] = downmove[2] - 4096;
	memset (&downtrace, 0, sizeof(downtrace));
	SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, currententity->origin, downmove, &downtrace);

	// calculate the all important angles to keep speed up
	s1 = sin( currententity->angles[1]/180*M_PI);
	c1 = cos( currententity->angles[1]/180*M_PI);

	// end of muff

	while (1)
	{
		// get the vertex count and primitive type
		count = *order++;
		if (!count)
			break;        // done

		if (count < 0)
		{
			count = -count;
			glBegin (GL_TRIANGLE_FAN);
		}
		else
		    glBegin (GL_TRIANGLE_STRIP);

		do
		    {
			// texture coordinates come from the draw list
			// (skipped for shadows) glTexCoord2fv ((float *)order);
			order += 2;

			// normals and vertexes come from the frame list
			point[0] = verts->v[0] * paliashdr->scale[0] + paliashdr->scale_origin[0];
			point[1] = verts->v[1] * paliashdr->scale[1] + paliashdr->scale_origin[1];
			point[2] = verts->v[2] * paliashdr->scale[2] + paliashdr->scale_origin[2];

			//qbism//00-04-29 muff@yakko.globalnet.co.uk - 17 Mar 2000
			// first remove the existing height adjustment, as we are going to do this ourselves
			//original code
			// point[0] -= shadevector[0]*(point[0] +lheight);
			// point[1] -= shadevector[1]*(point[1] +lheight);
			//    point[2] = height;
			//    height -= 0.001;
			// end of original code

			point[0] -= shadevector[0]*(point[0]);
			point[1] -= shadevector[1]*(point[1]);
			point[2] -= shadevector[2]*(point[2]);

			//drop it down to floor
			point[2] = point[2] - (currententity->origin[2] - downtrace.endpos[2]) ;

			// now adjust the point with respect to all the normals of the tracepoint
			// I'm probably missing an easy piece of maths to do this
			// it reads messy, but works ;)
			point[2] +=     (        (point[1] * (s1 * downtrace.plane.normal[0])) -
				    (point[0] * (c1 * downtrace.plane.normal[0])) -
				    (point[0] * (s1 * downtrace.plane.normal[1])) -
				    (point[1] * (c1 * downtrace.plane.normal[1]))
				    ) +  ((1.0 - downtrace.plane.normal[2])*20)
				+ 0.2 ;

			//end of muff

			glVertex3fv (point);

