Posted By: Frederick_Lim
temp var? - 08/02/07 05:38
Is the temp variable removed in lite-c?
...
vec_rotate(temp, vector(angle, 0, 0));
...
ANGLE temp_ang;
...
temp_ang.pan = angle;
temp_ang.tilt = 0;
temp_ang.roll = 0;
vec_rotate(temp, temp_ang);
...
#include <default.c>
STRING* testLevel = "level0.wmb";
BMAP* crosshair = "crosshairsmall.pcx";
VECTOR* mouse_target; // mouse target position in 3D world
// Get the target vector
function get_target()
{
my.push = 2;
set(me,INVISIBLE);
VECTOR* vecFrom;
VECTOR* vecTo;
vec_zero(vecFrom);
vec_zero(vecTo);
while(1)
{
//store the mouse position to vecFrom
vecFrom.x = mouse_pos.x + mouse_spot.x;
vecFrom.y = mouse_pos.y + mouse_spot.y;
vecFrom.z = 1;//close point
vec_set(vecTo,vecFrom); //set the vecTo same as vecFrom
vec_for_screen(vecFrom,camera); //world position of mouse position
vecTo.z = 5000;//vecTo 10000 away from camera
vec_for_screen(vecTo,camera);//far point
c_trace(vecFrom, vecTo, IGNORE_PASSABLE|IGNORE_PUSH);//trace a line between the two points
vec_set(mouse_target,target); //put the c_trace target vector to mouse_target
wait(1);
}
}
function main()
{
level_load(testLevel);
wait(2); // wait until the level is loaded
vec_zero(mouse_target);
mouse_range = 3000; //mouse range from camera
mouse_mode = 1; //make cursor visible and moving
mouse_pointer = 0;
mouse_map = crosshair; //mouse bmap
mouse_spot.x = bmap_width(crosshair)/2; // hot spot in the bmap center
mouse_spot.y = bmap_height(crosshair)/2;
wait(1);
video_switch(6,0,2);
ent_create("crosshairsmall.pcx", nullvector, get_target);
}
set(me, NARROW);
set(me, FAT);
wait(1);
vec_set(my.max_x,vector(32,32,37));
vec_set(my.min_x,vector(-32,-32,-27));