Well I did more testing, here is what I got to work.
//FutureCop LAPD Remake
//Level Editor
//Hussein Duvigneau
//2nd Oct 2009
set display mode 1366,768,32
sync on
autocam off
position camera -20,50,-20
set ambient light 100
#constant FVF_XYZ = 0x002 `2 untransformed vertex - discludes FVF_XYZRHW
#constant FVF_XYZRHW = 0x004 `4 tranformed vertex - discludes FVFXYZ and FVF_NORMAL
#constant FVF_XYZB1 = 0x006 `6 position data and weighting values for vertex blending matrix calcs
#constant FVF_XYZB2 = 0x008 `8
#constant FVF_XYZB3 = 0x00a `10
#constant FVF_XYZB4 = 0x00c `12
#constant FVF_XYZB5 = 0x00e `338
#constant FVF_NORMAL = 0x010 `16 vertex normal
#constant FVF_PSIZE = 0x020 `32 vertex point size
#constant FVF_DIFFUSE = 0x040 `64 vertex diffuse color
#constant FVF_SPECULAR = 0x080 `128 vertex specular color
#constant FVF_TEX0 = 0x000 `338 Number of texture coordinate sets for vertex, 1 - 8
#constant FVF_TEX1 = 0x100 `256
#constant FVF_TEX2 = 0x200 `512
#constant FVF_TEX3 = 0x300 `768
#constant FVF_TEX4 = 0x400 `1024
#constant FVF_TEX5 = 0x500 `1280
#constant FVF_TEX6 = 0x600 `1536
#constant FVF_TEX7 = 0x700 `1792
#constant FVF_TEX8 = 0x800 `2048
FloorTileID = loadtexture("Floortile.jpg")
load image "grass1.bmp",1
FloorTileID=1
global debug=0
WorldObjID=MakeMap(9,9)
scale object WorldObjID,1000,1000,1000
`Set Object Wireframe WorldObjID,1
texture object WorldObjID,0,FloorTileID
PointCamToObj(WorldObjID)
do
text 10,10,str$(timer()/100)
move camera (upkey()-downkey())
move camera left leftkey()-rightkey()
position camera camera position x(),50,camera position z()
sync
loop
Function MakeMap(w,h)
obj = find free object()
verts = (w+1)*(h+1)*5
inds = ((w*h*10)+w*6+h*6+4)*3
vpr = 5*(1+w)//verts per row
make object new obj,verts,inds,FVF_XYZ||FVF_NORMAL||FVF_DIFFUSE||FVF_SPECULAR||FVF_TEX2
lock vertexdata for limb obj,0
v = 0
i = 0
for vz = 0 to h-1
for vx = 0 to w-1
if debug = 1 then message "make TL"
set vertexdata position v, vx+0, 0, vz+0 //a
set vertexdata position v+1, vx+0.1, 0, vz+0 //b
set vertexdata position v+2, vx+0.05, 0, vz+0.05 //c
set vertexdata position v+3, vx+0, 0, vz+0.1 //d
set vertexdata position v+4, vx+0.1, 0, vz+0.1 //e
set vertexdata uv v+0,0,vx+0,vz+0
set vertexdata uv v+1,0,vx+0.1,vz+0
set vertexdata uv v+2,0,vx+0.05,vz+0.05
set vertexdata uv v+3,0,vx+0,vz+0.1
set vertexdata uv v+4,0,vx+0.1,vz+0.1
set indexdata i,v+1 //abc
set indexdata i+1,v+0
set indexdata i+2,v+2
set indexdata i+3,v+1 //bce
set indexdata i+4,v+2
set indexdata i+5,v+4
set indexdata i+6,v+2 //cde
set indexdata i+7,v+3
set indexdata i+8,v+4
set indexdata i+9,v+2 //acd
set indexdata i+10,v+0
set indexdata i+11,v+3
inc i,12
if debug = 1 then message "..and midpoint" : sync
set indexdata i,v+8 //eBi or edb* *of adjacent
set indexdata i+1,v+4
set indexdata i+2,v+1+vpr
set indexdata i+4,v+8 //bdh or iBj* *of adjacent
set indexdata i+3,v+5+vpr
set indexdata i+5,v+1+vpr
inc i,6
if vx<w
if debug = 1 then message "TL to TR"
//gap between TL and TR
set indexdata i, v+1 //bef
set indexdata i+1,v+4
set indexdata i+2,v+5
set indexdata i+3,v+4 //efB
set indexdata i+4,v+8
set indexdata i+5,v+5
inc i,6
endif
if vz<h
if debug = 1 then message "TL to BL"
inc pies
set indexdata i,v+3 //hid
set indexdata i+1,v+vpr
set indexdata i+2,v+1+vpr
set indexdata i+3,v+4 //die
set indexdata i+4,v+3
set indexdata i+5,v+1+vpr
inc i,6
endif
inc v,5
if vx = w-1 //and vz < h-1
if debug = 1 then message "vx=w-1, make TR"
set vertexdata position v, vx+0.9, 0, vz+0 //f
set vertexdata position v+1, vx+1, 0, vz+0 //g
set vertexdata position v+2, vx+0.95, 0, vz+0.05 //A
set vertexdata position v+3, vx+0.9, 0, vz+0.1 //B
set vertexdata position v+4, vx+1, 0, vz+0.1 //C
set vertexdata uv v+0,0,vx+0.9,vz+0
set vertexdata uv v+1,0,vx+1,vz+0
set vertexdata uv v+2,0,vx+0.95,vz+0.05
set vertexdata uv v+3,0,vx+0.9,vz+0.1
set vertexdata uv v+4,0,vx+1,vz+0.1
set indexdata i,v+1 //gfA
set indexdata i+1,v
set indexdata i+2,v+2
set indexdata i+3,v+2 //CAg
set indexdata i+4,v+4
set indexdata i+5,v+1
set indexdata i+6,v+4 //CAB
set indexdata i+7,v+2
set indexdata i+8,v+3
set indexdata i+9,v //BAf
set indexdata i+10,v+3
set indexdata i+11,v+2
inc i,12
if debug = 1 then message "TR to BR"
inc unpies
set indexdata i,v+3 //hid
set indexdata i+1,v+vpr
set indexdata i+2,v+1+vpr
set indexdata i+3,v+4 //die
set indexdata i+4,v+3
set indexdata i+5,v+1+vpr
inc i,6
inc v,5
endif
next vx
next vz
dec vz
for vx = 0 to w-1
if debug = 1 then message "vz=h-1, make BL"
set vertexdata position v, vx+0, 0, vz+0.9 //h
set vertexdata position v+1, vx+0.1, 0, vz+0.9 //i
set vertexdata position v+2, vx+0.1, 0, vz+1 //H
set vertexdata position v+3, vx+0, 0, vz+1 //I
set vertexdata position v+4, vx+0.05, 0, vz+0.95 //J
set vertexdata uv v+0,0,vx+0,vz+0.9
set vertexdata uv v+1,0,vx+0.1,vz+0.9
set vertexdata uv v+2,0,vx+0.1,vz+1
set vertexdata uv v+3,0,vx+0,vz+1
set vertexdata uv v+4,0,vx+0.05,vz+0.95
set indexdata i,v+4 //hiJ
set indexdata i+1,v+1
set indexdata i+2,v+0
set indexdata i+3,v+2 //JiH
set indexdata i+4,v+1
set indexdata i+5,v+4
set indexdata i+6,v+2 //JHI
set indexdata i+7,v+4
set indexdata i+8,v+3
set indexdata i+9,v+3 //JhI
set indexdata i+10,v+4
set indexdata i+11,v
inc i,12
if vx<w
if debug = 1 then message "BL to BR"
set indexdata i,v+5//Hij
set indexdata i+1,v+1
set indexdata i+2,v+2
set indexdata i+3,v+2 //HjF
set indexdata i+4,v+8
set indexdata i+5,v+5
inc i,6
endif
inc v,5
next vx
vx=w-1 : vz = h-1
if debug=1 then message "last corner"
set vertexdata position v, vx+0.9, 0, vz+0.9 //j
set vertexdata position v+1, vx+1, 0, vz+0.9 //D
set vertexdata position v+4, vx+1, 0, vz+1 //E
set vertexdata position v+3, vx+0.9, 0, vz+1 //F
set vertexdata position v+2, vx+0.95, 0, vz+0.95 //G
set vertexdata uv v+0,0,vx+0.9,vz+0.9
set vertexdata uv v+1,0,vx+1,vz+0.9
set vertexdata uv v+2,0,vx+1,vz+1
set vertexdata uv v+3,0,vx+0.9,vz+1
set vertexdata uv v+4,0,vx+0.95,vz+0.95
set indexdata i,v+4 //jDE
set indexdata i+1,v+1
set indexdata i+2,v+0
set indexdata i+3,v+1 //DGE
set indexdata i+4,v+2
set indexdata i+5,v+4
set indexdata i+6,v+2 //GEF
set indexdata i+7,v+3
set indexdata i+8,v+4
set indexdata i+9,v+3 //FEj
set indexdata i+10,v+4
set indexdata i+11,v
inc i,12
inc v,5
//for v = 0 to verts-1
// set vertexdata normals v,0,1,0
//next v
unlock vertexdata
Endfunction obj
remstart
eg MakeMap(2,2)
a---b--------- f---g--------- o---. 6
5-> |>c<| 4 |>A<| |>o<| 3
d---e--------- B---C--------- o---o 6
| | | | | |
| 4 | 4 | | | |
| | | | | |
| | | | | |
h---i--------- j---D--------- o---o 6
|>J<| |>E<| |>o<| 3
I---H--------- F---G--------- o---o 6
| | | | | |
| | | | | |
| | | | | |
| | | | | |
o---o--------- o---o--------- o---o 6
|>o<| |>o<| |>o<| 3
.---o--------- o---o--------- o---. 6
109 Indices
45 Vertices
remend
function PointCamToObj(id)
point camera object position x(id),object position y(id),object position z(id)
endfunction
function loadtexture(file$)
img = find free image()
load image file$,img,0
endfunction img
Needs to be at the top of your program or at least executed first
setting display mode deletes any loaded textures I believe
set display mode 1366,768,32
sync on
autocam off
position camera -20,50,-20
set ambient light 100
I add the ambient light, you can play with this
I added loading my own .bmp file for testing
hope this helps