78 #define STOP_EPSILON 0.1
86 backoff =
DotProduct (in, normal) * overbounce;
90 change = normal[
i]*backoff;
91 out[
i] = in[
i] - change;
111 #define MIN_STEP_NORMAL 0.7 // can't step up onto very steep slopes
112 #define MAX_CLIP_PLANES 5
115 int bumpcount, numbumps;
133 for (bumpcount=0 ; bumpcount<numbumps ; bumpcount++)
135 for (
i=0 ;
i<3 ;
i++)
162 time_left -= time_left * trace.
fraction;
184 rub = 1.0 + 0.5 *
DotProduct (dir, planes[0]);
198 rub = 1.0 + 0.5 *
DotProduct (dir, planes[0]);
276 float down_dist, up_dist;
320 down_dist = (down_o[0] - start_o[0])*(down_o[0] - start_o[0])
321 + (down_o[1] - start_o[1])*(down_o[1] - start_o[1]);
322 up_dist = (
up[0] - start_o[0])*(
up[0] - start_o[0])
323 + (
up[1] - start_o[1])*(
up[1] - start_o[1]);
348 float speed, newspeed, control;
354 speed =
sqrt(vel[0]*vel[0] +vel[1]*vel[1] + vel[2]*vel[2]);
377 newspeed = speed - drop;
384 vel[0] = vel[0] * newspeed;
385 vel[1] = vel[1] * newspeed;
386 vel[2] = vel[2] * newspeed;
400 float addspeed, accelspeed, currentspeed;
403 addspeed = wishspeed - currentspeed;
407 if (accelspeed > addspeed)
408 accelspeed = addspeed;
410 for (
i=0 ;
i<3 ;
i++)
417 float addspeed, accelspeed, currentspeed, wishspd = wishspeed;
422 addspeed = wishspd - currentspeed;
426 if (accelspeed > addspeed)
427 accelspeed = addspeed;
429 for (
i=0 ;
i<3 ;
i++)
461 if (wishvel[0] < -25)
463 else if (wishvel[0] > 25)
466 if (wishvel[1] < -25)
468 else if (wishvel[1] > 25)
543 for (
i=0 ;
i<3 ;
i++)
595 for (
i=0 ;
i<2 ;
i++)
609 if (wishspeed > maxspeed)
611 VectorScale (wishvel, maxspeed/wishspeed, wishvel);
612 wishspeed = maxspeed;
749 sample1 = sample2 / 2;
884 float speed, drop, friction, control, newspeed;
885 float currentspeed, addspeed, accelspeed;
912 newspeed = speed - drop;
927 for (
i=0 ;
i<3 ;
i++)
945 addspeed = wishspeed - currentspeed;
949 if (accelspeed > addspeed)
950 accelspeed = addspeed;
952 for (
i=0 ;
i<3 ;
i++)
956 for (
i=0 ;
i<3 ;
i++)
1066 for (
i=0 ;
i<3 ;
i++)
1087 static int jitterbits[8] = {0,4,1,2,3,5,6,7};
1090 for (
i=0 ;
i<3 ;
i++)
1093 for (
i=0 ;
i<3 ;
i++)
1106 for (
j=0 ;
j<8 ;
j++)
1108 bits = jitterbits[
j];
1110 for (
i=0 ;
i<3 ;
i++)
1138 for (
z=1 ;
z>=-1 ;
z--)
1141 for (
y=1 ;
y>=-1 ;
y--)
1144 for (
x=1 ;
x>=-1 ;
x--)
1172 static int offset[3] = { 0, -1, 1 };
1176 for (
z = 0;
z < 3;
z++ ) {
1178 for (
y = 0;
y < 3;
y++ ) {
1180 for (
x = 0;
x < 3;
x++ ) {
1218 for (
i=0 ;
i<3 ;
i++)
1253 memset (&
pml, 0,
sizeof(
pml));
1345 if (angles[
PITCH] > 180)