BMAP* pointer_tga = "pointer.tga";
VECTOR temp;
function mouse_startup()
{
mouse_mode = 2;
mouse_map = pointer_tga;
while (1)
{
vec_set(mouse_pos, mouse_cursor);
wait(1);
}
}
function pick_or_drop()
{
wait (1);
my.skill1 += 1;
if ((my.skill1 % 2) == 1) // clicked the object?
{
while (mouse_left) {wait (1);} // wait until the player releases the left mouse button
while (!mouse_left) // move the object until the player presses the mouse button again
{
temp.x = mouse_cursor.x;
temp.y = mouse_cursor.y;
temp.z = 200; // move the object 200 quants below the camera, play with this value
vec_for_screen(temp.x, camera);
vec_set (my.x, temp.x);
set (my, PASSABLE);
wait (1);
}
}
else // drop the object here
{
vec_set (temp.x, my.x);
temp.z -= 3000; // trace up to 5,000 quants below the player
// make sure to drop the object on the ground
my.z -= c_trace (my.x, temp.x, IGNORE_ME + IGNORE_SPRITES + IGNORE_MODELS + USE_BOX);
reset (my, PASSABLE);
}
}
action click_and_move()
{
my.skill1 = 0;
my.emask |= ENABLE_CLICK;
my.event = pick_or_drop;
}