Here's the whole code:

Code:
function mtlShaft_event();
 
MATERIAL* mtlShaftDepth = {
	effect = "shaftDepth.fx";
	event = mtlShaft_event;
	flags = ENABLE_VIEW;
} 

VIEW* ShaftView = {
	bmap = "#64x64x14";
	material = mtlShaftDepth;
	flags = SHOW|NOFLAG1;
}

MATERIAL* mtlShaft = {
	effect = "lShaft.fx";
}

void mtlShaft_event() {
	float sTexAdj[16] = { 0.5, 0.0, 0.0, 0.0, 0.0,-0.5, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 };
	if(ShaftView.bmap) {
		sTexAdj[12] = 0.5 + (0.5/(float)ShaftView.bmap.width);
		sTexAdj[13] = 0.5 + (0.5/(float)ShaftView.bmap.width);
	}
	mat_set(mtlShaft.matrix,matViewProj);
	mat_multiply(mtlShaft.matrix,sTexAdj);
}



The code's a contribution of another forum member as far as I remember.