Hey,
I have switched over from the vanilla terrain to blitzterrain but it crashes on startup... Anyone had this before? I cant see anything wrong the the code:
`Display Setup
width = desktop width()
height = desktop height()
set display mode width, height, 32, 1
set window off
sync on : sync rate 60
hide mouse
`Variables
jumping = 0
jumpstage = 1
height1# = 2
height2# = 6
takeheight = 1
down = 1
zoneno = 1
`Camera Setup
make camera 1
position camera 1, 100, 0, 100
`Images
load image "files\textures\water bump.bmp",1
load image "files\textures\grass.jpg", 2
load image "files\textures\water.bmp", 3
load image "files\textures\sky.bmp", 4
load image "files\heightmaps\zone4.bmp", 5
load image "files\textures\zone4.png", 6
load image "files\environments\zone4.png", 7
`Terrain Setup
terrainid = bt maketerrain()
bt setterrainheightmap terrainid, 5
bt setterraintexture terrainid, 6
bt setterrainlod terrainid, 3
bt setterrainenvironment terrainid, 7
bt setterrainsmoothing terrainid, 1
bt buildterrain terrainid, 5
`Water Setup
vCount=VDW_MakeWater(1,1000,1000,64)
texture object 1, 3
scale object texture 1, 50, 50
set alpha mapping on 1, 60
position object 1, 250, 15, 250
`Sky Setup
make object sphere 2, (-500 * 6)
texture object 2, 4
position object 2, 250, 0, 250
set ambient light 100
make light 1
position light 1, 0, 50, 0
`Collision
sc_setupComplexObject 5,1,2
`Main Loop
do
if spacekey() = 0 then jumped = 0
gosub lookinghandler
gosub movementhandler
gosub gravityhandler
gosub worldhandler
sync
loop
lookinghandler:
camy# = camy# + mousemovex() * 0.1
camx# = camx# + mousemovey() * 0.1
yrotate camera 1, camy#
xrotate camera 1, camx#
if wrapvalue(camera angle x(1))>90 and wrapvalue(camera angle x(1))<180 then xrotate camera 1,90
if wrapvalue(camera angle x(1))>180 and wrapvalue(camera angle x(1))<260 then xrotate camera 1,260
return
movementhandler:
if shiftkey() = 1
if keystate(17) = 1 then move camera 1, 3
else
if keystate(17) = 1 then move camera 1, 0.4
endif
if keystate(31) = 1 then move camera 1, -0.2
if keystate(30) = 1 then move camera left 1, 0.4
if keystate(32) = 1 then move camera right 1, 0.4
if spacekey() = 1 and jumped = 0 then jumping = 1
return
gravityhandler:
if jumping = 0
terrainheight# = get terrain ground height(5, camera position x(1), camera position z(1))
position camera 1, camera position x(1), terrainheight# + 5, camera position z(1)
endif
if jumping = 1
jumped = 1
if takeheight = 1 then height1# = terrainheight# + 5
takeheight = 0
if jumpstage = 1
inc height1#, 0.4
position camera 1, camera position x(1), height1#, camera position z(1)
inc timesincreased, 1
endif
if jumpstage = 2
if camera position y(1)> get terrain ground height(5, camera position x(1), camera position z(1)) + 5.2
dec height2#, 0.5
position camera 1, camera position x(1), height2#, camera position z(1)
else
jumpstage = 1
jumping = 0
timesdecreased = 0
height2# = 6
takeheight = 1
endif
endif
if timesincreased = 10
jumpstage = 2
timesincreased = 0
height2# = height1#
height1# = 2
endif
endif
return
worldhandler:
`Water
VDW_UpdateWater(1,1,1,5,vCount)
if camera position y(1) < object position y(1)
color ambient light rgb(0,0,192)
else
color ambient light rgb(255,255,255)
endif
`Sky
yrotate object 2, object angle y(2) + 0.05
return
function maketerrain(zoneno)
if terrain exist(5) then delete terrain 5
make object terrain 5
set terrain heightmap 5, "files\heightmaps\zone" + str$(zoneno) + ".bmp"
set terrain scale 5, 3, 0.6, 3
set terrain split 5, 16
set terrain tiling 5, 4
set terrain light 5, 1, -0.25, 0, 1, 1, 0.78, 0.5
set terrain texture 5, 1, 2
build terrain 5
endfunction
`Water Functions
Type VDW_Vecs_T
X as float
Y as float
Z as float
Endtype
Function VDW_Setup()
global VDW_SinAng#
DIM VDW_Sin#(360)
for s = 0 to 360
VDW_Sin#(s)=sin(s)
next s
Endfunction
Function VDW_MakeWater(obj as integer,XSize#,ZSize#,Detail)
if Detail>255 then Detail=255
make object plane obj,XSize#,ZSize#,Detail,Detail,274
VertCount=(Detail+1)*(Detail+1)
Endfunction VertCount
Function VDW_NoSinUpdateWater(obj,WaveSpeed#,WaveHeight#,WaveCount,VertexCount)
inc VDW_SinAng#,WaveSpeed#
lock vertexdata for limb obj,0,1
for o = 1 to VertexCount
p#=o*1.0/VertexCount*1.0
xp#=get vertexdata position x(o)
vdws=wrapvalue( (p#*360+VDW_SinAng#)*WaveCount )
yp#=WaveHeight#*VDW_Sin#(vdws)
zp#=get vertexdata position z(o)
set vertexdata position o,xp#,yp#,zp#
next o
unlock vertexdata
Endfunction
Function VDW_UpdateWater(obj,WaveSpeed#,WaveHeight#,WaveCount,VertexCount)
inc VDW_SinAng#,WaveSpeed#
lock vertexdata for limb obj,0,1
for o = 0 to VertexCount
p#=o*1.0/VertexCount*1.0
xp#=get vertexdata position x(o)
yp#=WaveHeight#*sin((p#*360+VDW_SinAng#)*WaveCount)
zp#=get vertexdata position z(o)
set vertexdata position o,xp#,yp#,zp#
next o
unlock vertexdata
Endfunction
Function VDW_SetWaterWaveOffset(OffsetAngle#)
VDW_SinAng#=OffsetAngle#
Endfunction
Welcome down to London City where the attitudes bad and the weather is shitty...