Well name a copy of your x landscape as xland.x and try this..
It may not work straightforward with your x landscape because of this height adjusting lines:
h#=xplaneh#-10000
and
leftfronth#=leftfrontisect#-10000 etcc..
in that case tweak that value (-10000) till you get h# printed out correctly
Rem * Title : intersect_tests
Rem * Author : Scorpyo
Rem * Date : July2003
top:
rem ********** MAIN 1 ****************
set display mode 800,600,16
hide mouse
sync on
backdrop on
x#=0.0,y#=0.0,z#=0.0
gosub Setupland1
gosub Character
gosub makewheels
set global collision off
sync rate 40
set camera range 10,10000
gosub Resetcam
rem set camera fov 120
rem *****MAIN LOOP******
do
gosub Playercontrol
gosub printdata
rem call to camera changes subroutine ( bottom key row )
gosub camera_controls
rem Calculate position data
x#=newxvalue(x#,a#,s#)
z#=newzvalue(z#,a#,s#)
gosub heightcheck
position object 9999,x#,h#+6,z#
yrotate object 9999,a#
gosub wheelput
rem calls camera update subroutine
gosub update_camera
rem Update screen
sync
rem End loop
loop
rem ** SUBROUTINES ***************************
rem ****** CREATE LEVEL ******
Setupland1:
load object "xland.x",60000
position object 60000,0,0,0
set object 60000,1,1,0,1,1,1,1
set object specular 60000,0
rem Create fog and ambience
set ambient light 80
if fog available()=1
fog on
fog distance 100000
fog color rgb(150,150,255)
endif
return
rem ***** PLAYERCONTROL *****
printdata:
set cursor 0,0
set text opaque
rem debug check
print "Fps=",screen fps()
print "polygons=",statistic(1)
print "------object data-------"
print "x=",x#
print "z=",z#
print "a#=",a#
print "-------cam data----------"
print "camlen=",camlen
print "camrot=",camrot
print "camhgt=",camhgt
print "camdist=",camdist
print "-------intersect data--------"
print "xplaneh#=",xplaneh#
print "h#=",h#
return
Playercontrol:
rem ****Character walk ****
if upkey()=1 and s#<12 then s#=s#+2
if downkey()=1 and s#>-12 then s#=s#-2
if leftkey()=1 then a#=wrapvalue(a#-4)
if rightkey()=1 then a#=wrapvalue(a#+4)
rem stop if "Ã "
if inkey$()="Ã " then s#=0.0
rem fast if "ù"
if inkey$()="ù" then s#=60.0
return
rem ****BUILD PLAYER****
rem object 9999
Character:
rem make cube
make object cube 9999,20
scale object 9999,100,50,200
return
makewheels:
for n=1 to 4
make object sphere n,10
next n
return
camera_controls:
if inkey$()="z" then camdist=camdist+2
if inkey$()="Z" then camdist=camdist-2
if inkey$()="x" then camhgt=camhgt+2
if inkey$()="X" then camhgt=camhgt-2
if inkey$()="c" then camrot=wrapvalue(camrot+2)
if inkey$()="C" then camrot=wrapvalue(camrot-2)
if inkey$()="v" then camlen=camlen+2
if inkey$()="V" then camlen=camlen-2
if inkey$()="b" then camrot = 180
if inkey$()="B" then camrot = 0
if inkey$()="n" then camdist=80:camlen=0:camrot=180:camhgt=100:camflag=0:wait 1
if inkey$()="N" then camdist=80:camlen=0:camrot=0:camhgt=100:camflag=1:wait 1
if inkey$()=">" then gosub Resetcam
if inkey$()="m" then camdist=-1000:camhgt=500:set camera range 100,skysize+1000
if inkey$()="M" then camdist=-3000:camhgt=1000:set camera range 100,skysize+1000
return
rem camera update
update_camera:
rem Position camera to the back of the character
ca#=wrapvalue(a#+camrot)
cx#=newxvalue(x#,ca#,camdist)
cz#=newzvalue(z#,ca#,camdist)
cy#=h#
rem cy#=get ground height(1,x#,z#)
position camera cx#,cy#+camhgt,cz#
rem Point camera at object
point camera x#,cy#+camhgt,z#
return
Resetcam:
camdist=-250
camhgt=100
camrot=60
camlen=200
rem --- check collision-----
heightcheck:
`calculate the height at player X & Z
xplaneh#=intersect object(60000,x#,-10000,z#,x#,10000,z#)
h#=xplaneh#-10000
return
wheelput:
leftfrontx#=x#+cos(a#-135) * 50
leftfrontz#=z#+sin(a#-135) * -50
leftfrontisect#=intersect object(60000,leftfrontx#,-10000,leftfrontz#,leftfrontx#,10000,leftfrontz#)
leftfronth#=leftfrontisect#-10000
position object 1,leftfrontx#,leftfronth#,leftfrontz#
rightfrontx#=x#+cos(a#-45) * 50
rightfrontz#=z#+sin(a#-45) * -50
rightfrontisect#=intersect object(60000,rightfrontx#,-10000,rightfrontz#,rightfrontx#,10000,rightfrontz#)
rightfronth#=rightfrontisect#-10000
position object 2,rightfrontx#,rightfronth#,rightfrontz#
leftrearx#=x#+cos(a#+45) * 50
leftrearz#=z#+sin(a#+45) * -50
leftrearisect#=intersect object(60000,leftrearx#,-10000,leftrearz#,leftrearx#,10000,leftrearz#)
leftrearh#=leftrearisect#-10000
position object 3,leftrearx#,leftrearh#,leftrearz#
rightrearx#=x#+cos(a#+135) * 50
rightrearz#=z#+sin(a#+135) * -50
rightrearisect#=intersect object(60000,rightrearx#,-10000,rightrearz#,rightrearx#,10000,rightrearz#)
rightrearh#=rightrearisect#-10000
position object 4,rightrearx#,rightrearh#,rightrearz#
return
end