You could put the planes in this example in the middle tile positions ,and get the tile number when you pass the mouse over.
And when you're done just hide them.
It's just for editing tho, it's useless for in game situation.
Cheers
Find here attached a pic of DBP matrix "logic"
rem Edit Matrix
rem Player = object 10
set display mode 1024,768,32
SYNC ON
SYNC RATE 60
autocam off
set global collision off
x#=0.0:z#=0.0:a#=0.0:s#=0.0:h#=0.0
cx#=0.0:cy#=0.0:cz#=0.0:cax#=0.0:camght#=0.0:camdist=0
camrot=0:camdist=0:hideflag=0:landsize=0:skysize=0:grid=0:inkcolor#=0.0:mtxrandomize=1
markerx#=0.0:markery#=0.0:markerz#=0.0:span#=200.0:span=200:theight#=0.0
objy#=0.0:objpick=0:txnum=0:tznum=0
mymousex=0:mymousey=0:mymousez=0:mtx$="":mtxcount=0:totalfiles=0:matrixname$=""
filenum$="":filenum=0:mx#=0.0:mz#=0.0:obj=0
dim filename$(50)
gosub Setupmatrix
gosub setupwater
gosub setuphandles
gosub makeplayer
gosub resetcam
x#=landsize/2:z#=100.0
position mouse 500,300
backdrop on
color backdrop rgb(10,100,120)
do
if inkey$()="e" then sync rate 0
if inkey$()="E" then sync rate 60
if inkey$()="k" then gosub keyinfo
if inkey$()="r" then gosub resetcam
if inkey$()="h" and hideflag=0 then gosub hidemarkers
if inkey$()="h" and hideflag=1 then gosub showmarkers
if inkey$()="s" then gosub savematrix
if inkey$()="l" then gosub loadmatrix
if inkey$()="a" then gosub saveasmatrix
if inkey$()="f" then gosub resetmatrix
gosub printdata
gosub update_camera
gosub Playercontrol
gosub checkmarker
gosub editmatrix
SYNC
loop
rem -------------ROUTINES--------------------
checkmarker:
objpick=pick object(mousex(),mousey(),101,1062)
if objpick>0
markerx#=object position x(objpick)
markerz#=object position z(objpick)
objy#=object position y(objpick)
txnum=int(markerx#/span#)
tznum=int(markerz#/span#)
endif
return
editmatrix:
if mouseclick()=1
mymousey=mousemovey()
if mymousey>0 then theight#=theight#-5.0
if mymousey<0 then theight#=theight#+5.0
if txnum>0 and txnum<31 and tznum>0 and tznum<31 and objpick>100 and objpick<1002
set matrix height 1,txnum,tznum,theight#
update matrix 1
matrixtiles#(txnum,tznum)=theight#
save array "landbackup.arr",matrixtiles#(0)
markery#=get ground height(1,markerx#,markerz#)
position object objpick,markerx#,markery#,markerz#
endif
endif
if mouseclick()=0 then theight#=objy#
return
savematrix:
mtxcount=mtxcount+1:mtx$="mtx"+str$(mtxcount)+".arr"
save array mtx$,matrixtiles#(0)
wait 500
return
saveasmatrix:
cls:sync
perform checklist for files
totalfiles=checklist quantity()
for f=1 to totalfiles
filename$(f)=checklist string$(f)
next f
set cursor 0,0
for f=1 to totalfiles
print f;" - ";filename$(f)
next f
text 400,10,"INPUT MATRIX SAVE NAME - no extension"
sync
clear entry buffer
wait key
rem sync
repeat
matrixname$=matrixname$+entry$()
clear entry buffer
text 400,10,"INPUT MATRIX SAVE NAME - no extension"
text 400,50,matrixname$+"<"
sync
until returnkey()=1
matrixname$=matrixname$+".arr"
save array matrixname$,matrixtiles#(0)
wait 500
matrixname$=""
return
loadmatrix:
cls:sync
perform checklist for files
totalfiles=checklist quantity()
for f=1 to totalfiles
filename$(f)=checklist string$(f)
next f
back1b:
set cursor 0,0
for f=1 to totalfiles
print f;" - ";filename$(f)
next f
text 400,10,"INPUT MATRIX ARRAY NUMBER - press q to go back"
sync
clear entry buffer
wait key
rem sync
repeat
filenum$=filenum$+entry$()
clear entry buffer
text 400,10,"INPUT MATRIX ARRAY NUMBER - press q to go back"
text 400,50,filenum$+"<"
sync
until returnkey()=1
filenum=val(filenum$)
if filenum>totalfiles then filenum$="":goto back1b
if filenum=0 then filenum$="":goto back1b
if right$(filename$(filenum),3)<>"arr" then filenum$="":goto back1b
load array filename$(filenum),matrixtiles#(0)
for n=0 to grid
for m=0 to grid
set matrix height 1,n,m,matrixtiles#(n,m)
next m
next n
update matrix 1
filenum$=""
return
resetmatrix:
for n=0 to grid
for m=0 to grid
set matrix height 1,n,m,0.0
next m
next n
update matrix 1
obj=100:mx#=0.0:mz#=0.0
for n=0 to 30
for m=0 to 30
obj=obj+1
my#=get ground height (1,mx#,mz#)
position object obj,mx#,my#+5,mz#
mz#=mz#+200
next m
mz#=0
mx#=mx#+200
next n
return
Playercontrol:
rem ---- Control Character ----
x#=newxvalue(x#,a#,s#)
z#=newzvalue(z#,a#,s#)
h#=get ground height(1,x#,z#)
position object 10,x#,h#+10,z#
yrotate object 10,a#
if upkey()=1 and s#<1.2 then s#=s#+0.02
if downkey()=1 and s#>-1.2 then s#=s#-0.02
if leftkey()=1 then a#=wrapvalue(a#-1)
if rightkey()=1 then a#=wrapvalue(a#+1)
if inkey$()="ù" then s#=0.0
if inkey$()="à" then s#=10.0
return
rem -------CAMERA--------
update_camera:
if mouseclick()=2
mymousex=mousemovex()
if mymousex>0 then camhgt#=camhgt#+10
if mymousex<0 then camhgt#=camhgt#-10
endif
if mouseclick()=2
mymousey=mousemovey()
if mymousey>0 then cax#=wrapvalue(cax#+1.0)
if mymousey<0 then cax#=wrapvalue(cax#-1.0)
xrotate camera cax#
endif
mymousez=mousemovez()
if mymousez>0 then camdist=camdist+50
if mymousez<0 then camdist=camdist-50
cx#=newxvalue(x#,a#,camdist)
cz#=newzvalue(z#,a#,camdist)
cy#=h#
position camera cx#,cy#+camhgt#,cz#
yrotate camera a#
return
rem camera reset
Resetcam:
set camera range 1,20000
camdist=-600
camhgt#=600
cax#=20.0
xrotate camera cax#
return
printdata:
set cursor 0,0
print " Polys=",statistic(1)
print " FPS=",screen fps()
print " x#= ",x#
print " h#= ",h#
print " z#= ",z#
print " a#= ",a#
print " theight#= ",theight#
print " txnum= ",txnum
print " tznum= ",tznum
print " press k for key info"
return
keyinfo:
set cursor 0,200
print " e = sync rate 0"
print " E = sync rate 60"
print " à = fast walk"
print " ù = stop walk"
print
print " h = show / hide markers"
print " s = incremental save matrix"
print " a = save matrix (with name)"
print " l = load matrix (.arr files)"
print " f = flatten matrix"
print " r = reset camera"
print
print " Lmouse + mouse move y = pick marker / raise - lower matrix"
print " Rmouse + mouse move y = camera tilt"
print " Rmouse + mouse move x = camera height"
print " Mouse wheel = camera distance"
return
Setupmatrix:
rem ground textures
rem create texture
cls rgb(0,100,20)
inkcolor#=rgb(255,255,255)
line 0,0,0,250
line 1,1,1,250
line 2,2,2,250
line 0,0,250,0
line 1,1,250,1
line 2,2,250,2
get image 2,0,0,250,250
rem Make landscape
span#=200.0:span=200:grid=30:landsize=span*grid:mtxrandomize=10
dim matrixtiles#(grid,grid)
make matrix 1,landsize,landsize,grid,grid
set matrix 1,1,0,0,1,1,1,1
prepare matrix texture 1,2,1,1
randomize matrix 1,mtxrandomize
rem ***********
rem get ground done
update matrix 1
return
setupwater:
make object plain 9,landsize,landsize
set object 9,1,1,0,1,1,1,1
position object 9,landsize/2,-10,landsize/2
xrotate object 9,270
cls rgb(10,100,200)
get image 3,0,0,250,250
texture object 9,3
ghost object on 9
return
setuphandles:
for n=101 to 1062
make object plain n,30,30
next n
obj=100
for n=0 to 30
for m=0 to 30
obj=obj+1
my#=get ground height (1,mx#,mz#)
position object obj,mx#,my#+5,mz#
mz#=mz#+200
next m
mz#=0
mx#=mx#+200
next n
return
hidemarkers:
for n=101 to 1001
hide object n
next n
hideflag=1
wait 20
return
showmarkers:
for n=101 to 1001
show object n
next n
hideflag=0
wait 20
return
rem -------------Characters----------------
makeplayer:
make object cone 10,30
scale object 10,100,200,100
set object 10,1,1,0
xrotate object 10,90
fix object pivot 10
return
end