ok.. the tile-by-tile editor..
My problem is, that the cursor-block isn´t shown at the cursor position.
See Screen:
http://daten.rmxpworld.de/shot_0.jpgThe block-model has to be on the position of the red cursor square...
Here´s the code i use at the moment ( based on an idea by flits ):
function editor_raster_scale(var* pos,var tile_size)
{
// ->scale to raster
if(abs(fraction(pos[0]/tile_size)) > 0.5)
{pos[0] += (tile_size/2)*sign(pos[0]);}
if(abs(fraction(pos[1]/tile_size)) > 0.5)
{pos[1] += (tile_size/2)*sign(pos[1]);}
pos[0] = pos[0] * 1/tile_size;
pos[1] = pos[1] * 1/tile_size;
pos[0] = integer(pos[0]);
pos[1] = integer(pos[1]);
pos[0] = pos[0] * tile_size;
pos[1] = pos[1] * tile_size;
Feldhelper.x = pos[0];
Feldhelper.y = pos[1]+128;
}
function mouse_controll()
{
temp.x = mouse_pos.x;
temp.y = mouse_pos.y;
temp.z = camera.z;
vec_for_screen(temp,camera);
c_trace(camera,vector(temp.x,temp.y,-4000),IGNORE_ME | IGNORE_PASSABLE);
editor_raster_scale(temp.x,32);
}
Feldhelper is the block-entity
Hope someone has an idea...