Hello,
Could someone please help me with getting this 3D to 2D Amiga Basic code to run with Dark Basic Pro?
One problem is the functions, and the other problem is with the algebra not having enough brackets () to
allow DBPro to understand the calculations. The program draws 3D landscapes in 2D.
It originally comes from an Apple 2 program which I converted to Amiga basic.
After replacing the Hplot commands with line commands it worked with Amiga Basic, but I cannot get it to
work with DBPro. Your help will be much appreciated. If you can get it working then please email me the text
and I will run it in DBPro. My email address is cyber01@iprimus.com.au
I have attached a picture showing what kind of landscapes are drawn.
Many thanks for your help.
Here is the program, please copy it:
Sync Off
set display mode 800,600,32
hide mouse
set text font "arial":set text size 20
set text to bold :set text transparent
cx=300:cy=100:t=0
ink rgb(0,200,0),rgb(0,0,0)
cls 0:set cursor 230,300
input "Enter random seed (1000-1000000)?";rd
randomize rd
cls 0:set cursor 250,300
input "(1) Manual or (2) Random parameters?";pm
if pm=1 then goto 35
if pm=2 then goto 20
20:
rh=20+rnd(20):d=400+rnd(80)
b=rnd(9):gosub 2000
c=rnd(9):gosub 2010
e=rnd(9):gosub 2020
g=rnd(9):gosub 2030
th=rnd(1):gosub 3500:goto 50
35:
cls 0:set cursor 320,300:input "Zoom 1?(20-50)";rh
cls 0:set cursor 320,300:input "Zoom 2?(400-500)";d
cls 0:set cursor 230,300:input "Vertical Camera Angle?(1-1.55)";ph
cls 0:set cursor 230,300:input "Horizontal Camera Angle?(0-1)";th
cls 0:set cursor 280,300:input "Area 1 profile?(-9-9)";b
cls 0:set cursor 280,300:input "Maths Factor 1?(0-10)";b1
cls 0:set cursor 280,300:input "Maths Factor 2?(0-10)";b2
cls 0:set cursor 280,300:input "Area 2 profile?(-9-9)";c
cls 0:set cursor 280,300:input "Maths Factor 1?(0-10)";c3
cls 0:set cursor 280,300:input "Maths Factor 2?(0-10)";c4
cls 0:set cursor 280,300:input "Area 3 profile?(-9-9)";e
cls 0:set cursor 280,300:input "Maths Factor 1?(0-10)";e1
cls 0:set cursor 280,300:input "Maths Factor 2?(0-10)";e2
cls 0:set cursor 280,300:input "Area 4 profile?(-9-9)";g
cls 0:set cursor 280,300:input "Maths Factor 1?(0-10)";g1
cls 0:set cursor 280,300:input "Maths Factor 2?(0-10)";g2
50:
cls 0
s1=sin(th):c1=cos(th)
s2=sin(ph):c2=cos(ph)
dim yn(640)
dim yx(640)
60:
for i=0 to 639:yn(i)=191:next i
def fn w(x)=b*exp(-.1*((y+b1)^2)-.02*((x+b2)^2))
def fn r(x)=c*exp(-.1*((x+c3)^2)-.03*((y-c4)^2))
def fn s(x)=e*exp(-.1*((y+e1)^2)-.02*((x-e2)^2))
def fn u(x)=g*exp(-.1*((x-g1)^2)-.1*((y-g2)^2))
def fn z(x)=u(x)+ r(x)+ w(x)+ s(x)
xs=8:ys=-8:x2=-9:y2=8
sp=(y2-ys)/(x2-xs)
for x=14 to -18 step -1
fl=0:yl=ys+(x-xs)+sp
for y=yl to 17 step 0.5
z=fn z(x):gosub 490
next y
next x
fl=0
for x=14 to -18 step -0.4
y=ys+(x-xs)*sp:z=fn z(x):gosub 490
next x
for x=-5 to -18 step -1
fl=0
for y=-13 to 0 step 0.5
z=fn z(x):gosub 490
next y
next x
end
490:
xe=-x*s1+y*c1
ye=-x*c1*c2-y*s1*c2+z*s2
ze=-x*s2*c1-y*s2*s1-z*c2+rh
sx=d*(xe/ze)+cx
sy=-d*(ye/ze)+cy
if fl=0 then fl=1:f=0:goto 660
dx=ox-sx:if dx=0 then dx=1
sl=(oy-sy)/dx:yp=oy
for xp=int(ox)+1 to sx
fg=1
yp=yp+sl
if xp<0 or xp>639 then fg=0:f=0:goto 650
gosub 900
if yp>191 or yp<0 then fg=0:f=0
if yp<=yn(xp) then goto 670
if yp>=yx(xp) then goto 720
f=0
650:
next xp
660:
ox=sx:oy=sy:return
670:
yn(xp)=yp
if fg=0 then goto 710
if f=0 then line xp,yp,xp,yp:ss=xp:rr=yp:f=1
line ss,rr,xp,yp:ss=xp:rr=yp
710:
if yp<yx(xp) then goto 650
720:
yx(xp)=yp
if fg=0 then goto 760
if f=0 then line xp,yp,xp,yp:ss=xp:rr=yp:f=1
line ss,rr,xp,yp:ss=xp:rr=yp
760:
goto 650
900:
if m$="n" then return
t=rnd(2500)+1
if t<5 then gosub 1000
return
1000:
rem Random colour
if m$="n" then return
xx=rnd(3):if xx<1 then goto 1000
a=xx:return
2000:
gosub 3000
if bb>1.5 then b=-b
return
2010:
gosub 3000
if bb>1.5 then c=-c
return
2020:
gosub 3000
if bb>1.5 then e=-e
return
2030:
gosub 3000
if bb>1.5 then g=-g
return
3000:
bb=rnd(3)
e1=rnd(10):e2=rnd(10)
b1=rnd(10):b2=rnd(10)
c3=rnd(10):c4=rnd(10)
g1=rnd(10):g2=rnd(10)
a1=rnd(0.1)
c6=rnd(3)
if bb<1 then return
if bb>1 and bb<1.6 then e1=-e1:b1=-b1:c3=-c3:g1=-g1
if bb>1.5 and bb<2.1 then e2=-e2:b2=-b2:c4=-c4:g2=-g2
if bb>2 and bb<2.6 then e1=-e1:b2=-b2:c3=-c3:g2=-g2
if bb>2.5 and bb<3.1 then e2=-e2:b1=-b1:c4=-c4:g1=-g1
return
3500:
vb=int(rnd(10)):if vb=0 then goto 3500
if vb=1 then ph=1
if vb=2 then ph=1.15
if vb=3 then ph=1.2
if vb=4 then ph=1.25
if vb=5 then ph=1.3
if vb=6 then ph=1.35
if vb=7 then ph=1.4
if vb=8 then ph=1.45
if vb=9 then ph=1.5
if vb=10 then ph=1.55
return
Mod Edit: When posting code please put them in "code" format so it doesn't stretch the post too long. You'll find this in the AUP, thanks! 
GL with your conversion.