Try make backup of carlevel directory and replace all code in main.c with:

Code:
//////////////////////////////////////////////////////////////
// carlevel main.c: Load level,init physics, do camera control
//////////////////////////////////////////////////////////////
//--------------------------------------------------------------
// Normal Mapping Shader
//
// Matt_Aufderheide, Bloodline, William, xXxGuitar511
// -------------------------------------------------------------
// title: Normal Mapping Shader
// text -
// -------------------------------------------------------------

#include <acknex.h>
#include <default.c>

var camera_arc=100;
//////////////////////////////////////////////////////////////

function start_all();
function zoom_cam();

// global vars
FONT* fontArial = "Arial#20b"; // truetype font
ENTITY* pFocus; // camera will orbit around this entity
var temp[3];
var temp2[3];

//////////////////////////////////////////////////////////////
#include "physics_car.c" // <--- that's where the magic happens
#include "startup01.c" // splash screen
#include "cg_add.c" // Czeslaw Gorski actions
//////////////////////////////////////////////////////////////

// NM SHADER CODE
// section: Ambient Lighting:
// enable: Faked Dynamics
#define staFake
// enable: Ambience
#define staAmb

// entry: FX File:
STRING* fxNM = "NM.fx";
// NM SHADER CODE

STRING* levelname = "loop.wmb";
ENTITY* sky = { type = "skycube+6.tga"; flags2 = SKY | CUBE | VISIBLE; }

//////////////////////////////////////////////////////////////
// camera control (orbit around pFocus, or chase camera or cockpit cam

var camMode=-1; // 0:orbit, 1:chase, 2:cockpit, -1 disabled
var rotspd=20; // cam movement speed
var minang=5; var maxang=70; // orbit between 5-70 degrees and 300-3000 distance
var mindist=200; var maxdist=3000;

var cameraTPos[3]; // camera target position
var cameraTAng[3]; // camera target angle

#define KEY_CAMERA key_c // use this key to switch camera modes
#define JOY_CAMERA joy_3

// NM SHADER CODE
MATERIAL* comics =
{
ambient_blue = 100;
ambient_green = 100;
ambient_red = 100;
albedo = 0;
}

MATERIAL* mat_NM =
{
// section: Diffuse:
// entry: Red
diffuse_red = 255;
// entry: Green
diffuse_green = 255;
// entry: Blue
diffuse_blue = 255;

// section: Ambient:
// entry: Red
ambient_red = 16.0;
// entry: Green
ambient_green = 16.0;
// entry: Blue
ambient_blue = 16.0;

// // section: Sun:
// // entry: Red
// specular_red = 64.0;
// // entry: Green
// specular_green = 64.0;
// // entry: Blue
// specular_blue = 64.0;

// section: Static Lighting:
// entry: Red
emissive_red = 255.0;
// entry: Green
emissive_green = 255.0;
// entry: Blue
emissive_blue = 255.0;
//
flags = tangent | enable_render;
effect = fxNM;
//event = checkLight;
}


function effect_startup()
{
effect_load(mat_NM, fxNM);
//
var SLF;
while(1)
{
SLF = 0;
#ifdef staAmb
SLF += 1;
#endif
#ifdef staFake
SLF += 2;
#endif
//
vec_set(mat_NM.specular_blue, sun_color);
mat_NM.skill1 = pixel_for_vec(nullvector, SLF*10, 8888);
wait(1);
}
}

//function checkLight()
//{
// vec_set(temp, my.x);
// temp.z -= floor_range;
// c_trace(my.x, temp, ignore_me | scan_texture);
// mtl.skill1 = pixel_for_vec(tex_color, tex_light, 8888);
//}

#define _Red skill1
#define _Green skill2
#define _Blue skill3
#define _Range skill4
// action: Dynamic Light
// text: -
// skill1: Red 128
// skill2: Green 128
// skill3: Blue 128
// skill4: Range 300
action DLight()
{
my.red = my._Red;
my.green = my._Green;
my.blue = my._Blue;
my.lightrange = my._Range;
set(my,LIGHT);
}

void init_normal()
{
effect_startup();
}


action SpinMe()
{
while(1)
{
my.material = mat_NM;
my.pan -= 2 * time_smooth;
wait(1);
}
}
// NM SHADER CODE

//////////////////////////////////////////////////////////////
function ControlCamera_startup()
{
// set fog and view params
fog_color = 1;
camera.fog_start=1000;
camera.fog_end =1.2*camera.clip_far;
camera.clip_near=25;

// init level and wait for focus object (we will orbit around it)
while(pFocus==NULL || camMode<0){wait(1);}

// current distance from focus and ang
var cam_dist=200;
ANGLE cam_ang;
// reset if previously rolled around
cam_ang.pan= pFocus.pan-180;
cam_ang.tilt=30;
cam_ang.roll=0;

while(1)
{
// for focus object (we will orbit around it)
while(pFocus==NULL){wait(1);}

if (camMode==0) // free orbit cam
{
reset(pFocus,INVISIBLE);
//orbit
if(mouse_right)
{
cam_ang.pan+=rotspd*mouse_force.x;
cam_ang.tilt+=rotspd*mouse_force.y;
cam_ang.tilt=clamp(cam_ang.tilt,minang,maxang);
}

// zoom with mousewheel
cam_dist-=integer(mickey.z);
cam_dist=clamp(cam_dist,mindist,maxdist);

// do some trig to find camera location and then aim it at pFocus
camera.x=pFocus.x+cos(cam_ang.pan)*(cam_dist*cos(cam_ang.tilt));
camera.y=pFocus.y+sin(cam_ang.pan)*(cam_dist*cos(cam_ang.tilt));
camera.z=pFocus.z+sin(cam_ang.tilt)*cam_dist;
vec_set(temp,pFocus.x);
vec_sub(temp,camera.x);
vec_to_angle(camera.pan,temp);
}
if (camMode==1) // chase cam
{
reset(pFocus,INVISIBLE);
if(mouse_right)
{
// mouse moves head
vecChaseAngOff.pan-=rotspd*mouse_force.x * time_step;
vecChaseAngOff.tilt+=rotspd*mouse_force.y * time_step;
vecChaseAngOff.pan=clamp(vecChaseAngOff.pan,-20,20);
vecChaseAngOff.tilt=clamp(vecChaseAngOff.tilt,-20,20);
}
else
{
// return to center
if(vecChaseAngOff.pan > 0.25) { vecChaseAngOff.pan -= 2* time_step; }
if(vecChaseAngOff.pan < -0.25) { vecChaseAngOff.pan += 2* time_step; }
if(vecChaseAngOff.tilt > 6) { vecChaseAngOff.tilt -= 2* time_step; }
if(vecChaseAngOff.tilt < 5) { vecChaseAngOff.tilt += 2* time_step; }

}

vec_set(cameraTPos, vecChaseOffset); // move behind and up
var offset;
offset= clamp(0.01*linSpeed*linSpeed, -100,100);
cameraTPos[0] -= offset; // offset by speed
vec_rotate(cameraTPos, vector(ang(pFocus.pan),0,0));
vec_add(cameraTPos, pFocus.x);

// collide with any object in the way
c_trace(pFocus.x,cameraTPos,
(IGNORE_PASSABLE+IGNORE_PASSENTS+IGNORE_MODELS));
if(trace_hit == 1)
{
// offset from that target along the vector
vec_set(cameraTPos,target);
// offset from the wall along normal by the near clipping dist
vec_normalize(normal,(camera.clip_near/2));
vec_add(cameraTPos,normal);
// draw_text("HIT_BACK",30,300,vector(123,123,200));
}
else
{
// make sure we don't 'clip' into walls next to us..
vec_diff(temp,pFocus.x,cameraTPos);
vec_normalize(temp,camera.clip_near);
vec_rotate(temp,vector(90,0,0));
vec_set(temp2,cameraTPos);
vec_add(temp2,temp); // move out by the clip_near value
c_trace(cameraTPos,temp2,(IGNORE_PASSABLE+IGNORE_PASSENTS+IGNORE_MODELS));
if(trace_hit == 1)
{
// offset from that target along the vector
vec_set(cameraTPos,target);
// offset from the wall along normal by the near clipping dist
vec_normalize(normal,(camera.clip_near/2));
vec_add(cameraTPos,normal);
// draw_text("HIT_1",30,300,vector(123,123,200));
}
else
{
// rotate temp back the other dir twice as much..
vec_rotate(temp,vector(-180,0,0));
vec_set(temp2,cameraTPos);
vec_add(temp2,temp); // move out by the clip_near value
c_trace(cameraTPos,temp2,(IGNORE_PASSABLE+IGNORE_PASSENTS+IGNORE_MODELS));
if(trace_hit == 1)
{
// offset from that target along the vector
vec_set(cameraTPos,target);
// offset from the wall along normal by the near clipping dist
vec_normalize(normal,(camera.clip_near/2));
vec_add(cameraTPos,normal);
// draw_text("HIT_2",30,300,vector(123,123,200));
}
}

}

// Smooth out transition...
vec_diff(temp,cameraTPos,camera.x);
var vscale = clamp((time_step*0.5),0.001,1);
vec_scale(temp,vscale);
vec_add(camera.x,temp);

// calc angle from camera to target...
vec_diff(temp,pFocus.x,cameraTPos);
vec_to_angle(cameraTAng,temp); // camera target angle looks at focus center
vec_add(cameraTAng, vecChaseAngOff.pan); // tweak it
// Smooth out rotation...
vec_diff(temp,cameraTAng,camera.pan);
temp[0] = ang(temp[0]); // note! only pan is needed in this game!
vec_scale(temp,vscale);
vec_add(camera.pan,temp);
// vec_set(camera.pan,cameraTAng.pan);
}

if (camMode==2) // cockpit view
{
//set(pFocus,INVISIBLE); // You might want to set this to on if using dashboard bitmap
vec_set(camera.pan, pFocus.pan);
vec_set(camera.x, pFocus.x);
// raise seat and move to driver side
vec_set(temp, vecDriverOffset);
vec_rotate(temp, pFocus.pan);
vec_add(camera.x, temp);
}
//toggle camera
if (KEY_CAMERA || JOY_CAMERA) {
while (KEY_CAMERA || JOY_CAMERA) { wait(1); }
camMode+=1; if (camMode>2) { camMode=0; }
// reset if previously rolled around
vec_set(camera.pan, cam_ang);
}
wait(1);
}
}

//////////////////////////////////////////////////////////////
// assign this to terrain for multitexturing, uses 2nd skin as detail map
action ffp_terr_detail()
{
detail_size = 16;
}

//////////////////////////////////////////////////////////////
// assign this to MDLs when user is to drive on them
action MakePoly()
{
set(my,POLYGON);
}

var StopWatchOn;

function Stopwatch_startup()
{
while (1) {
if (StopWatchOn)
timerSeconds+= time_step/16;
speed_and_time(); //cg
wait(1);
}
}

function ToggleStopwatch()
{
StopWatchOn = !StopWatchOn;
}



//////////////////////////////////////////////////////////////
// main
function main()
{
video_mode=7; //800x600
shadow_stencil= ON;
d3d_autotransparency = ON;
vec_set(d3d_lodfactor,vector(35,60,75)); // default LOD switches

on_t = ToggleStopwatch;
on_f1 = help_me;
on_h = EventImpact;
on_i = EventHorn;

cg_start();
init_normal(); // NM SHADER
wait(1);
level_load(levelname);
// show title screen and spin camera

while(pFocus==NULL){wait(1);}

// activate real camera
camMode = 1;
set(physics_panel,VISIBLE);
}

action Prop()
{
phent_settype(my, PH_RIGID, PH_BOX);
phent_setdamping(my, 10, 30);
}



Now reload the cardemo level inside WED and attach the action SpinMe to the entity of choice. You can also add the dlight.mdl to the level and if i'm right the action Dlight will be attached by magic. Rebuild the level and run.

Note: NM.fx,dlight.mdl must be in the carlevel directory.


smile