no time to comment, sorry
read and run the source, you need a couple (1 actually) textures for the editor
encoder's not polished yet
encoder:
do
print "Press d to decode"
print "Press e to encode"
if keystate(32)=1 then gosub decode
if keystate(18)=1 then gosub encode
wait key
cls
loop
encode:
cls
print "Encode"
print "Remember to remove spaces and spelling things wrong can help."
input "To encode: ";phrase$
for a=1 to len(phrase$)
a=rnd(3) : b=rnd(2) : c=rnd(3) : d=rnd(3) : e=rnd(3)
f=rnd(3) : g=rnd(3) : h=rnd(3) : i=rnd(3) : j=rnd(3)
k=rnd(3) : l=rnd(3) : m=rnd(3) : n=rnd(3) : o=rnd(3)
p=rnd(3) : q=rnd(3) : r=rnd(3) : s=rnd(3) : t=rnd(3)
u=rnd(3) : v=rnd(3) : w=rnd(3) : x=rnd(3) : y=rnd(3)
z=rnd(3)
a$=mid$(phrase$,a)
if a$="b" and b=1 then a$="48 "
if a$="b" and b=2 then a$="81 "
l$=l$+a$
next a
print l$
wait key
return
decode:
cls
print "Decode"
input "To decode: ";phrase$
b=1
for a=1 to len(phrase$)
a1$=mid$(phrase$,b)
a2$=mid$(phrase$,b+1)
inc b,3
l$=a1$+a2$
if l$="09" or l$="12" or l$="33" or l$="47" or l$="53" or l$="67" or l$="78" or l$="92" then l$="a"
if l$="48" or l$="81" then l$="b"
if l$="13" or l$="41" or l$="62" then l$="c"
if l$="01" or l$="03" or l$="45" or l$="79" then l$="d"
if l$="14" or l$="16" or l$="24" or l$="44" or l$="46" or l$="55" or l$="57" or l$="64" or l$="74" or l$="82" or l$="87" or l$="98" then l$="e"
if l$="10" or l$="31" then l$="f"
if l$="06" or l$="25" then l$="g"
if l$="23" then l$="h"
if l$="32" or l$="70" or l$="73" or l$="83" or l$="88" or l$="93" then l$="i"
if l$="15" then l$="j"
if l$="04" then l$="k"
if l$="26" or l$="37" or l$="51" or l$="84" then l$="l"
if l$="22" or l$="27" then l$="m"
if l$="18" or l$="58" or l$="59" or l$="66" or l$="71" or l$="91" then l$="n"
if l$="00" or l$="05" or l$="07" or l$="54" or l$="72" or l$="90" or l$="99" then l$="o"
if l$="38" or l$="95" then l$="p"
if l$="94" then l$="q"
if l$="29" or l$="35" or l$="40" or l$="42" or l$="77" or l$="80" then l$="r"
if l$="11" or l$="19" or l$="36" or l$="76" or l$="86" or l$="96" then l$="s"
if l$="17" or l$="20" or l$="30" or l$="43" or l$="49" or l$="69" or l$="75" or l$="85" or l$="97" then l$="t"
if l$="08" or l$="61" or l$="63" then l$="u"
if l$="34" then l$="v"
if l$="60" or l$="89" then l$="w"
if l$="28" then l$="x"
if l$="21" or l$="52" then l$="y"
if l$="02" then l$="z"
a$=a$+l$
next a
print a$
wait key
return
map editor:
rem set-upness
sync on : sync rate 30 : hide mouse
name$="file.map"
make matrix 1,1000,1000,50,50
make object cone 1,50
scale object 1,50,200,50
xrotate object 1,180
position camera 500,500,-500
rotate camera 20,0,0
rem defaultness
mode#=1
wire#=1
rem texture
load image "media\textures\default.bmp",1
prepare matrix texture 1,1,2,2
do
set cursor 10,10
if keystate(2)=1 then mode#=1 ; print "Small moulding"
if keystate(3)=1 then mode#=2 ; print "Medium moulding"
if keystate(4)=1 then mode#=3 ; print "Large moulding"
gosub mainbit
gosub camera
if keystate(31)=1 then gosub save ; print "Save"
if keystate(38)=1 then gosub load ; print "Load"
if keystate(16)=1 then wire#=1
if keystate(17)=1 then wire#=0
if wire#=0 then set matrix wireframe on 1
if wire#=1 then set matrix wireframe off 1
if keystate(18)=1
if light exist(1) then delete light 1
make light 1
position light 1,1000,1000,1000
set light range 1,5000
point light 1,0,0,0
fog on
fog color rgb(100,100,100)
fog distance 1000
endif
if wire#=0
if light exist(1) then delete light 1
fog off
endif
sync
loop
camera:
rem NOTE: Press r to rotate 360 degrees. DO NOT edit while this is happening.
rem simple camera bit
control camera using arrowkeys 0,10,0
rem complex camera bit
rem up/down
camposy#=camera position y()
camposx#=camera position x()
camposz#=camera position z()
if keystate(19)=1
yrotate camera camera angle y()+1
endif
if keystate(19)=0 then yrotate camera 0
if keystate(209)=1 then dec camposy#,10
if keystate(201)=1 then inc camposy#,10
if leftkey()=1 then dec camposx#,10
if rightkey()=1 then inc camposx#,10
position camera camposx#,camposy#,camposz#
return
mainbit:
if mouseclick()=0
X#=X#+mousemovex()
Z#=Z#-mousemovey()
endif
Y#=get ground height(1,X#,Z#)+50
position object 1,X#,Y#,Z#
rem large moulding
if mode#=3
if mouseclick()=1
if X#<1000 and Z#<1000
set matrix height 1,(X#/20),(Z#/20),Y#
position object 1,X#,Y#,Z#
Y#=Y#-mousemovey()
endif
smooth1(X#/20,Z#/20,Y#)
update matrix 1
endif
endif
rem medium moulding
if mode#=2
if mouseclick()=1
if X#<1000 and Z#<1000
set matrix height 1,(X#/20),(Z#/20),Y#
position object 1,X#,Y#,Z#
Y#=Y#-mousemovey()
endif
smooth2(X#/20,Z#/20,Y#)
update matrix 1
endif
endif
rem small moulding
if mode#=1
if mouseclick()=1
if X#<1000 and Z#<1000
set matrix height 1,(X#/20),(Z#/20),Y#
position object 1,X#,Y#,Z#
Y#=Y#-mousemovey()
endif
update matrix 1
endif
endif
return
save:
dim mtx(1,50,50)
for x=0 to 50 : for z=0 to 50
mtx(1,x,z)=get matrix height(1,x,z)
next x : next z
for x=1 to 50
for z=1 to 50
y#=get matrix height(1,x,z)
y$=y$+str$(y#)
next x
next z
if file exist(name$)=1 then delete file name$
make file name$
open to write 1,name$
wor=val(y$)
write word 1,wor
return
load:
for x=0 to 50
for z=0 to 50
set matrix height 1,x,z,mtx(1,x,z)
next x
next z
update matrix 1
return
function smooth1(posx#,posz#,h#)
dim h(25)
rem outer layer
for a=1 to 5
h(a)=(h#/3)+(rnd(2)/4)
next a
for a=21 to 25
h(a)=(h#/3)+(rnd(2)/4)
next a
for a=10 to 20 step 5
h(a)=(h#/3)+(rnd(2)/4)
next a
for a=6 to 16 step 5
h(a)=(h#/3)+(rnd(2)/4)
next a
rem second layer
for a=7 to 8
h(a)=(h#/2)+(rnd(2)/4)
next a
for a=17 to 19
h(a)=(h#/2)+(rnd(2)/4)
next a
h(12)=(h#/2)+(rnd(2)/4)
h(14)=(h#/2)+(rnd(2)/4)
rem inner layer
h(13)=h#
set matrix height 1,posx#-2,posz#-2,h(1)
set matrix height 1,posx#-1,posz#-2,h(2)
set matrix height 1,posx#,posz#-2,h(3)
set matrix height 1,posx#+1,posz#-2,h(4)
set matrix height 1,posx#+2,posz#-2,h(5)
set matrix height 1,posx#-2,posz#-1,h(6)
set matrix height 1,posx#-1,posz#-1,h(7)
set matrix height 1,posx#,posz#-1,h(8)
set matrix height 1,posx#+1,posz#-1,h(9)
set matrix height 1,posx#+2,posz#-1,h(10)
set matrix height 1,posx#-2,posz#,h(11)
set matrix height 1,posx#-1,posz#,h(12)
set matrix height 1,posx#,posz#,h(13)
set matrix height 1,posx#+1,posz#,h(14)
set matrix height 1,posx#+2,posz#,h(15)
set matrix height 1,posx#-2,posz#+1,h(16)
set matrix height 1,posx#-1,posz#+1,h(17)
set matrix height 1,posx#,posz#+1,h(18)
set matrix height 1,posx#+1,posz#+1,h(19)
set matrix height 1,posx#+2,posz#+1,h(20)
set matrix height 1,posx#-2,posz#+2,h(21)
set matrix height 1,posx#-1,posz#+2,h(22)
set matrix height 1,posx#,posz#+2,h(23)
set matrix height 1,posx#+1,posz#+2,h(24)
set matrix height 1,posx#+2,posz#+2,h(25)
update matrix 1
endfunction
function smooth2(posx#,posz#,h#)
dim h(9)
rem outer layer
for a=1 to 3
h(a)=(h#/2)+(rnd(2)/4)
next a
for a=7 to 9
h(a)=(h#/2)+(rnd(2)/4)
next a
h(6)=(h#/2)+(rnd(2)/4)
h(4)=(h#/2)+(rnd(2)/4)
rem inner layer
h(5)=h#
set matrix height 1,posx#-1,posz#-1,h(1)
set matrix height 1,posx#,posz#-1,h(2)
set matrix height 1,posx#+1,posz#-1,h(3)
set matrix height 1,posx#-1,posz#,h(4)
set matrix height 1,posx#,posz#,h(5)
set matrix height 1,posx#+1,posz#,h(6)
set matrix height 1,posx#-1,posz#+1,h(7)
set matrix height 1,posx#,posz#+1,h(8)
set matrix height 1,posx#+1,posz#+1,h(9)
update matrix 1
endfunction
the editor still needs a save/load function but it's still quite nifty
thanks