Double posting and appologies...
Okay so it looks like this:
function Terraformc(ObjectNumber, RayObjNum, BrushSize#)
If ShiftKey()=0 and Controlkey()=0 then multiplier#=1.0
If ShiftKey()=1 and Controlkey()=0 then multiplier#=5.0
If Controlkey()=1 and Shiftkey()=0 then multiplier#=0.25
If ShiftKey()=1 and Controlkey()=1 then multiplier#=1.0
if Objectnumber>0
objNums(0) = Objectnumber
objNums(1) = Objectnumber + 1
objNums(2) = Objectnumber - 1
objNums(3) = Objectnumber + tile_sz
objNums(4) = Objectnumber + tile_sz + 1
objNums(5) = Objectnumber + tile_sz - 1
objNums(6) = Objectnumber - tile_sz
objNums(7) = Objectnumber - tile_sz + 1
objNums(8) = Objectnumber - tile_sz - 1
ENDIF
A=FIND FREE VECTOR(100,200)
temp=MAKE VECTOR2(A)
D=FIND FREE VECTOR(100,200)
temp=MAKE VECTOR2(D)
F=FIND FREE Vector(100,200)
temp=MAKE VECTOR2(F)
for obj = 0 to 8
reCalculateNormals = 0
if objNums(obj) > 0 and objNums(obj) <= tile_sz*tile_sz
LOCK VERTEXDATA FOR LIMB objNums(obj), 0
Vcount=GET VERTEXDATA VERTEX COUNT()-1
For Array=0 to Vcount
VerX#=GET VERTEXDATA POSITION X(Array)
VerY#=GET VERTEXDATA POSITION Y(Array)
VerZ#=GET VERTEXDATA POSITION Z(Array)
`calculate the correct vertices on the object to check against the others
tempX# = VerX# + OBJECT POSITION X(objNums(obj))
tempY# = VerY# + OBJECT POSITION Y(objNums(obj))
tempZ# = VerZ# + OBJECT POSITION Z(objNums(obj))
length=1
[b]D#=Distance(TempX#, TempY#, TempZ#, OBJECT POSITION X(RayObjNum), OBJECT POSITION Y(RayObjNum), OBJECT POSITION Z(RayObjNum), 0)
SET VECTOR2 D, tempX#, tempz#
NORMALIZE VECTOR2 D, D
SET VECTOR2 A, object position X(rayobjnum), object position z(rayobjnum)
NORMALIZE VECTOR2 A, A
Size#=DOT PRODUCT VECTOR2(d, a)
if D#=<BrushSize#
Sheight#=(tempy#)*size#
endif
if D#>BrushSize#
Sheight#=(tempy#)
endif[/b]
If tempY#>-31.0 then SET VERTEXDATA DIFFUSE array, RGB(0,15,45)
If tempY#>-29.0 then SET VERTEXDATA DIFFUSE array, RGB(15,35,60)
If tempY#>-27.0 then SET VERTEXDATA DIFFUSE array, RGB(30,50,80)
If tempY#>-25.0 then SET VERTEXDATA DIFFUSE array, RGB(45,67,100)
If tempY#>-23.0 then SET VERTEXDATA DIFFUSE array, RGB(65,80,120)
If tempY#>-21.0 then SET VERTEXDATA DIFFUSE array, RGB(85,90,135)
If tempY#>-19.0 then SET VERTEXDATA DIFFUSE array, RGB(90,105,130)
If tempY#>-17.0 then SET VERTEXDATA DIFFUSE array, RGB(100,105,120)
If tempY#>-15.0 then SET VERTEXDATA DIFFUSE array, RGB(90,92,80)
If tempY#>-13.0 then SET VERTEXDATA DIFFUSE array, RGB(85,85,60)
If tempY#>-11.0 then SET VERTEXDATA DIFFUSE array, RGB(75,85,50)
If tempY#>-9.0 then SET VERTEXDATA DIFFUSE array, RGB(60,75,30)
If tempY#>-7.0 then SET VERTEXDATA DIFFUSE array, RGB(50,75,15)
If tempY#>-5.0 then SET VERTEXDATA DIFFUSE array, RGB(35,85,10)
If tempY#>-3.0 then SET VERTEXDATA DIFFUSE array, RGB(20,90,5)
If tempY#>-1.0 then SET VERTEXDATA DIFFUSE array, RGB(3,106,0)
if tempY#>5.0 then SET VERTEXDATA DIFFUSE array, RGB(20,110,10) `RGB(152,174,68)
if tempY#>10.0 then SET VERTEXDATA DIFFUSE array, RGB(40,120,20)
if tempY#>15.0 then SET VERTEXDATA DIFFUSE array, RGB(70,135,30)
if tempY#>20.0 then SET VERTEXDATA DIFFUSE array, RGB(85,145,35)
if tempY#>25.0 then SET VERTEXDATA DIFFUSE array, RGB(100,160,40)
if tempY#>30.0 then SET VERTEXDATA DIFFUSE array, RGB(105,165,45)
if tempY#>35.0 then SET VERTEXDATA DIFFUSE array, RGB(120,170,55)
if tempY#>40.0 then SET VERTEXDATA DIFFUSE array, RGB(125,160,40)
if tempY#>45.0 then SET VERTEXDATA DIFFUSE array, RGB(130,150,20)
if tempY#>50.0 then SET VERTEXDATA DIFFUSE array, RGB(135,130,15)
if tempY#>55.0 then SET VERTEXDATA DIFFUSE array, RGB(110,100,20)
if tempY#>60.0 then SET VERTEXDATA DIFFUSE array, RGB(105,90,30)
if tempY#>65.0 then SET VERTEXDATA DIFFUSE array, RGB(95,75,30)
if tempY#>70.0 then SET VERTEXDATA DIFFUSE array, RGB(85,60,35)
if tempY#>75.0 then SET VERTEXDATA DIFFUSE array, RGB(65,50,40)
if tempY#>80.0 then SET VERTEXDATA DIFFUSE array, RGB(45,40,35)
if tempY#>85.0 then SET VERTEXDATA DIFFUSE array, RGB(30,30,45)
if tempY#>87.5 then SET VERTEXDATA DIFFUSE array, RGB(40,45,60)
if tempY#>90.0 then SET VERTEXDATA DIFFUSE array, RGB(45,55,75)
if tempY#>92.5 then SET VERTEXDATA DIFFUSE array, RGB(55,70,90)
if tempY#>95.0 then SET VERTEXDATA DIFFUSE array, RGB(65,85,100)
if tempY#>97.5 then SET VERTEXDATA DIFFUSE array, RGB(85,100,128)
if tempY#>100.0 then SET VERTEXDATA DIFFUSE array, RGB(100,120,150)
if tempY#>101.0 then SET VERTEXDATA DIFFUSE array, RGB(130,170,200)
if tempY#>102.0 then SET VERTEXDATA DIFFUSE array, RGB(150,200,225)
if tempY#>103.0 then SET VERTEXDATA DIFFUSE array, RGB(180,220,250)
if tempY#>104.0 then SET VERTEXDATA DIFFUSE array, RGB(210,230,255)
SET VERTEXDATA POSITION Array, VerX#, sheight#, VerZ# : reCalculateNormals = 1
`SET VERTEXDATA DIFFUSE Array, RGB(64*sin(Very#)+64,64*Cos(Very#)+64, 32*Tan(Very#)+32)
SC_UpdateObject objNums(obj)
NEXT ARRAY
UNLOCK VERTEXDATA
SC_UpdateObject objNums(obj)
if reCalculateNormals=1
SET OBJECT NORMALS objNums(obj)
reCalculateNormals=0
endif
endif
next obj
If VECTOR EXIST(a)=1 then B=DELETE VECTOR3(A)
if VECTOR EXIST(d)=1 then C=DELETE VECTOR3(D)
if VECTOR EXIST(F)=1 then E=DELETE VECTOR3(F)
ENDFUNCTION
My math must be wrong... silly vectors - trying to be 3d and sh*t.
I see a lil' byte, its 1/4th a dword, Double float, Double float - but it doesnt beat a Global. Very very frightning, integers dividing me! Look a constant oh a constant. Oh-oh I just want the byte!