MouseDrag(obj/cell/over_object)
if(currentartist != usr) return
if(!(istype(over_object,/obj/cell))) return
if(brush == DIAGONAL)
for(var/obj/cell/P in temp)
Recolor(P,P.oldr,P.oldg,P.oldb,0)
temp = list(over_object)
var/obj/cell/Currentcell = Start
var/Distance = 0
var/CurX = 0
var/CurY = 0
do
if(Start == null)
Start = src
CurX = Start.cell_x+round(sin(round(Get_Angle(Start,over_object),45))*Distance)
CurY = Start.cell_y+round(cos(round(Get_Angle(Start,over_object),45))*Distance)
if(CurX > 56||CurY > 48||CurX < 1||CurY <1)
break
Currentcell = cells[CurX][CurY]
if(Currentcell)
Recolor(Currentcell,R,G,B,0)
temp.Add(Currentcell)
if(Start.cell_x <= over_object.cell_x)
if(Start.cell_y <= over_object.cell_y)
if(Currentcell.cell_x >= over_object.cell_x&&Currentcell.cell_y >= over_object.cell_y)
break
else
if(Currentcell.cell_x >= over_object.cell_x&&Currentcell.cell_y <= over_object.cell_y)
break
else
if(Start.cell_y >= over_object.cell_y)
if(Currentcell.cell_x <= over_object.cell_x&&Currentcell.cell_y <= over_object.cell_y)
break
else
if(Currentcell.cell_x <= over_object.cell_x&&Currentcell.cell_y >= over_object.cell_y)
break
Distance++
while(1)
proc/Get_Angle(obj/cell/start, obj/cell/end)
if(!start || !end) return 0
var/dy
var/dx
dy = end.cell_y - start.cell_y
dx = end.cell_x - start.cell_x
if(!dy)
return (dx>=0) ? 90 : 270
. = arctan(dx/dy)
if(dy<0)
. += 180
else if(dx<0)
.+=360
Problem description: If you move the mouse in a circle, it jumps to the far sides for vertical and horizontal lines. It just does it, for no apparent reason and I'm totally confused. :-(
-Doh
EDIT: This is SUPPOSED to "lock" the mouse in 45 degree angles, allowing you to draw perfect lines. An example would be to open MS Paint, hold down shift and drag the mouse to see what I mean.
- Doh