CodeBase - Matrix 03
Return to the CodeBase listing
Category: Complete Applications
Version: 1.0
Information
Uploaded: 28th Feb 2005 17:58
Modified: 1st Jan 1970 01:00
Author: Anonymous Coder
Summary
` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com Rem Project: MatrixMaster Rem Created: 5/6/04 4:25:55 PM Rem ***** Main Source File ***** rem this program written by Richard Sardini Jr rem my e-mail:noramdia@adelphia.net rem my phone:814-504-6033 rem check end of program for code snippet to load matrix into your dark basic programs set display mode 800,600,16 create bitmap 1,50,50 ink RGB(128,128,0),0:for x=0 to 50:line x,0,x,50:next x ink RGB(0,128,0),0:for x=0 to 200:dot rnd(50),rnd(50):next x ink RGB(255,128,0),0:for x=0 to 50:dot rnd(50),rnd(50):next x ink RGB(128,128,255),0:for x=0 to 90:dot rnd(50),rnd(50):next x ink RGB(255,255,255),0:for x=0 to 20:dot rnd(50),rnd(50):next x get image 1,0,0,50,50 delete bitmap 1 hint=1:hints=21:hintdelay=750 dim hint$(21):hintc1=50:ghost=-1 hint$(1)="Green marker=unselected coordinate Red marker=selected coordinate." hint$(2)="Press ' w ' to toggle wireframe on and off." hint$(3)="Press ' s ' to select all visible coordinate markers." hint$(4)="Press ' t ' to toggle or invert all visible coordinate markers." hint$(5)="Press ' u ' to un-select all visible coordinate markers that are currently selected." hint$(6)="Press ' + ' or ' - ' to zoom in and out or turn the mouse wheel." hint$(7)="Press arrow keys to pan your view or press and hold mouse botton 2 and move mouse." hint$(8)="Press and hold both mouse buttons 1 and 2 and move mouse to rotate camera view." hint$(9)="Left click and drag mouse-(top left to bottom right)-and red box will appear to select markers in box." hint$(10)="Left click and drag mouse-(bottom right to top left)-and yellow box will appear to toggle or invert selected markers in box." hint$(11)="Press ' h ' to hide all unselected markers-this is handy to isolate work areas." hint$(12)="Press ' h ' again to show all hidden markers. Use this feature to hide and prevent selecting backround markers." hint$(13)="Press and hold mouse wheel button 3 and move mouse up and down to lower or raise selected markers respectively." hint$(14)="Or use keyboard less than ' < ' or greater than ' > ' to lower or raise selected markers respectively." hint$(15)="Press ' n ' anytime to start a new matrix." hint$(16)="Set the cross hairs on your destination point and then zoom in." hint$(17)="Press ' z ' to zip to the next hint." hint$(18)="Press ' L ' to level the matrix back to zero." hint$(19)="Left click on marker to toggle coordinate marker selection." hint$(20)="Press ' g ' to toggle ghost matrix on and off" hint$(21)="Press ' escape ' key anytime to exit MATRIX MASTER" startover: set text size 16 set current bitmap 0 load=0 cls rgb(0,0,0):ink RGB(255,255,0),0 set cursor screen width()/2-20,0 print "MATRIX-MASTER Matrix Editor" ink rgb(255,255,255),0 print redomatrix: input "Give your matrix a name and press enter>";matname$:sleep 200 redoinput: print "Is this matrix name ";:ink rgb(0,255,0),0:print matname$;:ink rgb(255,255,255),0:print " correct?(y/n)>" redoinkey: g$=inkey$() if g$<>"n" and g$<>"y" and g$<>"" then print "Please confirm your matrix name>":sleep 500:goto redoinput if g$="n" then goto redomatrix if g$="y" then goto redoxsize goto redoinkey redoxsize: print "Matrix name accepted":sleep 1000:cls rgb(0,0,0):ink RGB(255,255,0),0 set cursor screen width()/2-20,0 print "MATRIX-MASTER Matrix Editor" ink rgb(255,255,255),0 print input "Input matrix size X and press enter>";matsizex if matsizex<1 or matsizex>10000 then print "Bad input-try again>":sleep 500:goto redoxsize matsizex=int(matsizex) redozsize: input "Input matrix size Z and press enter>";matsizez if matsizez<1 or matsizez>10000 then print "Bad input-try again>":sleep 500:goto redozsize matsizez=int(matsizez) redoxseg: input "Input matrix segment X and press enter>";matsegx if matsegx<1 or matsegx>matsizex/2 then print "Bad input-try again>":sleep 500:goto redoxseg matsegx=int(matsegx) redozseg: input "Input matrix segment Z and press enter>";matsegz if matsegz<1 or matsegz>matsizez/2 then print "Bad input-try again>":sleep 500:goto redozseg matsegz=int(matsegz) print "Matrix parameters accepted" print "Working..."; sleep 500 backdrop on dim height((matsegx+1)*(matsegz+1)) dim xpos((matsegx+1)*(matsegz+1)):dim zpos((matsegz+1)*(matsegx+1)) loaded: if matsizex>500 and matsizez>500 then size=6 else size=2 if matsizex>2000 and matsizez>2000 then size=10 if matsizex>5000 and matsizez>5000 then size=30 dim objstat((matsegx+1)*(matsegz+1)) matsegx1=matsizex/matsegx:matsegz1=matsizez/matsegz banding=0:mx1=0:mx2=0:my1=0:my2=0:hide=-1 objnum=1 for z=0 to matsegz for x=0 to matsegx objstat(objnum)=-1 finalcount=objnum inc objnum next x print "."; next z sync on autocam off make matrix 1,matsizex,matsizez,matsegx,matsegz prepare matrix texture 1,1,1,1 update matrix 1 make object cube 50000,10:position object 50000,-10,0,-10:color object 50000,RGB(0,255,255) if load=1 for x=1 to finalcount read long 1,xpos(x) read long 1,zpos(x) read long 1,height(x) next x close file 1 endif load=0 objnum=1 for z=0 to matsegz for x=0 to matsegx make object sphere objnum,size:color object objnum,rgb(0,255,0) position object objnum,x*matsegx1,height(objnum),z*matsegz1 set matrix height 1,x,z,height(objnum) if load=1 then goto skipassign xpos(objnum)=x:zpos(objnum)=z skipassign: inc objnum next x next z update matrix 1 set camera range 1,100000 position camera 0,200,0 point camera 0,0,200 mousexold#=mousex():mouseyold#=mousey() mainloop: do dec hintdelay if hintdelay<0 then hintdelay=850:inc hint if hint>hints then hint=1 if inkey$()="z" inc hint if hint>hints then hint=1 hintdelay=1200 sleep 200 endif if inkey$()="n" sync off:backdrop off:set matrix wireframe on 1 set cursor 0,0:cls rgb(0,0,0):ink RGB(255,255,255),0 print "Confirm! Do you want to start a new matrix?(y/n)" print "You may want to answer no and save this matrix first lest it be lost." sleep 500 getagain5: g$=inkey$() if g$<>"y" and g$<>"n" then goto getagain5 if g$="y" for x=1 to finalcount:delete object x:next x:delete object 50000 delete matrix 1 undim xpos(finalcount):undim zpos(finalcount) undim height(finalcount):undim objstat(finalcount) sleep 200 goto startover endif if g$="n" sync on:backdrop on endif sleep 500 set matrix wireframe off 1 endif if inkey$()="g" ghost=ghost*-1 if ghost=1 ghost matrix on 1 endif if ghost=-1 ghost matrix off 1 endif sleep 200 endif if inkey$()="l" sync off:backdrop off cls rgb(0,0,0):ink rgb(255,255,255),0 print "Are you sure you want to level your matrix back to zero?(y/n)" sleep 200 getagain6: g$=inkey$() if g$<>"y" and g$<>"n" then goto getagain6 if g$="y" for x=1 to finalcount height(x)=0 set matrix height 1,xpos(x),zpos(x),height(x) position object x,xpos(x)*matsegx1,height(x),zpos(x)*matsegz1 objstat(x)=-1:color object x,rgb(0,255,0) next x update matrix 1 endif sync on:backdrop on endif if inkey$()="1" then goto savematrix if inkey$()="2" then goto loadmatrix base=get ground height(1,0,0):position object 50000,-10,base,-10 mousexnew#=mousexold#-mousex():mouseynew#=mouseyold#-mousey() if upkey()=1 or mouseclick()=2 and mouseynew#>0 pitch camera down 2 endif if downkey()=1 or mouseclick()=2 and mouseynew#<0 pitch camera up 2 endif if leftkey()=1 or mouseclick()=2 and mousexnew#>0 turn camera left 2 endif if rightkey()=1 or mouseclick()=2 and mousexnew#<0 turn camera right 2 endif if mousezold<mousez() or inkey$()="+" move camera 20*size endif if mousezold>mousez() or inkey$()="-" move camera -20*size endif if banding=1 then goto skiptilt if mouseclick()=3 and mousexnew#>0 roll camera left 2 endif if mouseclick()=3 and mousexnew#<0 roll camera right 2 endif skiptilt: if banding=1 then goto skipfirst if mouseclick()=1 mx1=mousex():my1=mousey():banding=1 endif skipfirst: if banding=1 then mx2=mousex():my2=mousey() if mx1>mx2 and my1<my2 or mx1<mx2 and my1>my2 then banding=0 if banding=1 and mouseclick()=0 if mx1<mx2 for x=1 to finalcount ox=object screen x(x):oy=object screen y(x) if object visible(x)=1 if ox>mx1 and ox<mx2 and oy>my1 and oy<my2 objstat(x)=1:color object x,rgb(255,0,0) endif endif next x endif if mx1>mx2 for x=1 to finalcount ox=object screen x(x):oy=object screen y(x) if object visible(x)=1 if ox<mx1 and ox>mx2 and oy<my1 and oy>my2 objstat(x)=objstat(x)*-1 if objstat(x)=1 then color object x,rgb(255,0,0) if objstat(x)=-1 then color object x,rgb(0,255,0) endif endif next x endif banding=0 endif if banding=1 and mx1<>mx2 and my1<>my2 then goto skipselect if mousexnew#=0 and mouseynew#=0 if mouseclick()=1 and mx1=mx2 and banding=1 and mx1=mx2 and my1=my2 for x=1 to finalcount if object in screen(x)=1 if object visible(x)=1 sx=object screen x(x):sy=object screen y(x) if mousex()>sx-5 and mousex()<sx+5 and mousey()>sy-5 and mousey()<sy+5 objstat(x)=objstat(x)*-1 if objstat(x)=1 then color object x,rgb(255,0,0) if objstat(x)=-1 then color object x,rgb(0,255,0) sleep 200 x=finalcount:banding=0 endif endif endif next x sleep 200 endif endif skipselect: if mouseclick()=4 and mouseynew#>0 or inkey$()="." for x=1 to finalcount if objstat(x)=1 gh#=get matrix height(1,xpos(x),zpos(x)) inc height(x),(size/2+1) set matrix height 1,xpos(x),zpos(x),height(x) position object x,xpos(x)*matsegx1,height(x),zpos(x)*matsegz1 endif next x update matrix 1 endif if mouseclick()=4 and mouseynew#<0 or inkey$()="," for x=1 to finalcount if objstat(x)=1 dec height(x),(size/2+1) set matrix height 1,xpos(x),zpos(x),height(x) position object x,xpos(x)*matsegx1,height(x),zpos(x)*matsegz1 endif next x update matrix 1 endif if inkey$()="u" for x=1 to finalcount if objstat(x)=1 objstat(x)=-1 color object x,rgb(0,255,0) endif next x endif if inkey$()="s" for x=1 to finalcount if object visible(x)=1 then objstat(x)=1:color object x,rgb(255,0,0) next x endif if inkey$()="t" for x=1 to finalcount if object visible(x)=1 objstat(x)=objstat(x)*-1 if objstat(x)=1 then color object x,rgb(255,0,0) if objstat(x)=-1 then color object x,rgb(0,255,0) endif next x sleep 200 endif if inkey$()="h" hide=hide*-1 if hide=1 for x=1 to finalcount if objstat(x)=-1 hide object x endif next x endif if hide=-1 for x=1 to finalcount if objstat(x)=-1 if object visible(x)=0 then show object x endif next x endif sleep 200 endif mousexold#=mousex():mouseyold#=mousey():mousezold=mousez() if inkey$()="w" if matrix wireframe state(1)=1 then set matrix wireframe off 1 else set matrix wireframe on 1 sleep 200 endif ink RGB(0,255,255),0 set cursor screen width()/2-120,0 print "MATRIX MASTER - by Richard Sardini" ink RGB(0,128,255),0 set cursor screen width()/2-80,40 print "You are editing matix> ";:ink rgb(255,255,0),0:print matname$:ink rgb(255,255,255),0 xl=screen width()/2:yl=screen height()/2 ink RGB(192,192,192),0 line xl,200,xl,screen height()-200 line 250,yl,screen width()-250,yl ink rgb(255,255,255),0 if banding=1 if mx1<mx2 then ink RGB(255,0,128),0 else ink RGB(255,255,0),0 line mx1,my1,mx2,my1:line mx1,my2,mx1,my1 line mx2,my1,mx2,my2:line mx1,my2,mx2,my2 ink rgb(255,255,255),0 endif cnt1=0 for x=1 to finalcount if objstat(x)=1 print "X->";xpos(x);" Z->";zpos(x);" Height->";height(x) inc cnt1 if cnt1>15 then x=finalcount endif next x inc hintc1,8:if hintc1>255 then hintc1=100 hintcolor=rgb(0,hintc1,0) ink hintcolor,0 text int(screen width()/30),screen height()-100,hint$(hint) set cursor screen width()/5,screen height()-60 ink rgb(255,255,255),0 print "Press: 1-Save, 2-Load, Z-Zip to next hint" sync loop savematrix: backdrop off sync off:cls rgb(0,0,0) ink rgb(255,255,255),0 savematrix1: if file exist(matname$)=1 sleep 500 print "File already exist - Would you like to overwrite this file or rename your matrix?" print "Press 2 to overwrite or 3 to rename this matrix" getagain: g$=inkey$() if g$<>"2" and g$<>"3" then sleep 200:goto getagain if g$="3" sleep 200 print "What is the new file name?";:input matname$ sleep 200 goto savematrix1 endif if g$="2" then delete file matname$:sleep 200 endif open to write 1,matname$ write long 1,matsizex:write long 1,matsizez:write long 1,matsegx:write long 1,matsegz write long 1,finalcount for x=1 to finalcount write long 1,xpos(x) write long 1,zpos(x) write long 1,height(x) next x close file 1 print "File saved: Press any key to return to editor" sleep 500 wait key sleep 200 sync on backdrop on goto mainloop loadmatrix: backdrop off sync off:cls rgb(0,0,0) ink rgb(255,255,255),0 print "Current matrix will be lost. Proceed(Y/N)?" getinput: g$=inkey$() if g$="n" or g$="N" then sync on:backdrop on:goto mainloop if g$<>"y" then goto getinput delete matrix 1 for x=1 to finalcount delete object x next x delete object 50000 undim xpos(finalcount):undim zpos(finalcount) undim height(finalcount):undim objstat(finalcount) redomatrixname: input "File name to load?";matname$ if matname$="exit" then goto startover if file exist(matname$)=0 print "File does not exist: Try again or type exit" sleep 500 goto redomatrixname endif if file exist(matname$)=1 open to read 1,matname$ read long 1,matsizex:read long 1,matsizez read long 1,matsegx:read long 1,matsegz read long 1,finalcount dim height(finalcount):dim xpos(finalcount):dim zpos(finalcount) load=1 endif sync on backdrop on goto loaded remstart This is the code snippet you will need to re-load your matrix into your DB programs open to read 1,<filenamehere> read long 1,matsizex:read long 1,matsizez read long 1,matsegx:read long 1,matsegz read long 1,finalcount dim height(finalcount):dim xpos(finalcount):dim zpos(finalcount) for x=1 to finalcount read long 1,xpos(x) read long 1,zpos(x) read long 1,height(x) next x close file 1 make matrix 1,matsizex,matsizez,matsegx,matsegz for x=1 to finalcount set matrix height 1,xpos(x),zpos(x),height(x) next x update matrix 1 endrem
Full Description
` This code was downloaded from The Game Creators<br /> ` It is reproduced here with full permission<br /> ` http://www.thegamecreators.com<br /> <br /> Rem Project: MatrixMaster<br /> Rem Created: 5/6/04 4:25:55 PM<br /> <br /> Rem ***** Main Source File *****<br /> rem this program written by Richard Sardini Jr<br /> rem my e-mail:noramdia@adelphia.net<br /> rem my phone:814-504-6033<br /> rem check end of program for code snippet to load matrix into your dark basic programs<br /> set display mode 800,600,16<br /> create bitmap 1,50,50<br /> ink RGB(128,128,0),0:for x=0 to 50:line x,0,x,50:next x<br /> ink RGB(0,128,0),0:for x=0 to 200:dot rnd(50),rnd(50):next x<br /> ink RGB(255,128,0),0:for x=0 to 50:dot rnd(50),rnd(50):next x<br /> ink RGB(128,128,255),0:for x=0 to 90:dot rnd(50),rnd(50):next x<br /> ink RGB(255,255,255),0:for x=0 to 20:dot rnd(50),rnd(50):next x<br /> get image 1,0,0,50,50<br /> delete bitmap 1<br /> hint=1:hints=21:hintdelay=750<br /> dim hint$(21):hintc1=50:ghost=-1<br /> hint$(1)="Green marker=unselected coordinate Red marker=selected coordinate."<br /> hint$(2)="Press ' w ' to toggle wireframe on and off."<br /> hint$(3)="Press ' s ' to select all visible coordinate markers."<br /> hint$(4)="Press ' t ' to toggle or invert all visible coordinate markers."<br /> hint$(5)="Press ' u ' to un-select all visible coordinate markers that are currently selected."<br /> hint$(6)="Press ' + ' or ' - ' to zoom in and out or turn the mouse wheel."<br /> hint$(7)="Press arrow keys to pan your view or press and hold mouse botton 2 and move mouse."<br /> hint$(8)="Press and hold both mouse buttons 1 and 2 and move mouse to rotate camera view."<br /> hint$(9)="Left click and drag mouse-(top left to bottom right)-and red box will appear to select markers in box."<br /> hint$(10)="Left click and drag mouse-(bottom right to top left)-and yellow box will appear to toggle or invert selected markers in box."<br /> hint$(11)="Press ' h ' to hide all unselected markers-this is handy to isolate work areas."<br /> hint$(12)="Press ' h ' again to show all hidden markers. Use this feature to hide and prevent selecting backround markers."<br /> hint$(13)="Press and hold mouse wheel button 3 and move mouse up and down to lower or raise selected markers respectively."<br /> hint$(14)="Or use keyboard less than ' < ' or greater than ' > ' to lower or raise selected markers respectively."<br /> hint$(15)="Press ' n ' anytime to start a new matrix."<br /> hint$(16)="Set the cross hairs on your destination point and then zoom in."<br /> hint$(17)="Press ' z ' to zip to the next hint."<br /> hint$(18)="Press ' L ' to level the matrix back to zero."<br /> hint$(19)="Left click on marker to toggle coordinate marker selection."<br /> hint$(20)="Press ' g ' to toggle ghost matrix on and off"<br /> hint$(21)="Press ' escape ' key anytime to exit MATRIX MASTER"<br /> startover:<br /> set text size 16<br /> set current bitmap 0<br /> load=0<br /> cls rgb(0,0,0):ink RGB(255,255,0),0<br /> set cursor screen width()/2-20,0<br /> print "MATRIX-MASTER Matrix Editor"<br /> ink rgb(255,255,255),0<br /> <br /> print<br /> redomatrix:<br /> input "Give your matrix a name and press enter>";matname$:sleep 200<br /> redoinput:<br /> print "Is this matrix name ";:ink rgb(0,255,0),0:print matname$;:ink rgb(255,255,255),0:print " correct?(y/n)>"<br /> redoinkey:<br /> g$=inkey$()<br /> if g$<>"n" and g$<>"y" and g$<>"" then print "Please confirm your matrix name>":sleep 500:goto redoinput<br /> if g$="n" then goto redomatrix<br /> if g$="y" then goto redoxsize<br /> goto redoinkey<br /> redoxsize:<br /> print "Matrix name accepted":sleep 1000:cls rgb(0,0,0):ink RGB(255,255,0),0<br /> set cursor screen width()/2-20,0<br /> print "MATRIX-MASTER Matrix Editor"<br /> ink rgb(255,255,255),0<br /> print<br /> input "Input matrix size X and press enter>";matsizex<br /> if matsizex<1 or matsizex>10000 then print "Bad input-try again>":sleep 500:goto redoxsize<br /> matsizex=int(matsizex)<br /> redozsize:<br /> input "Input matrix size Z and press enter>";matsizez<br /> if matsizez<1 or matsizez>10000 then print "Bad input-try again>":sleep 500:goto redozsize<br /> matsizez=int(matsizez)<br /> <br /> redoxseg:<br /> input "Input matrix segment X and press enter>";matsegx<br /> if matsegx<1 or matsegx>matsizex/2 then print "Bad input-try again>":sleep 500:goto redoxseg<br /> matsegx=int(matsegx)<br /> redozseg:<br /> input "Input matrix segment Z and press enter>";matsegz<br /> if matsegz<1 or matsegz>matsizez/2 then print "Bad input-try again>":sleep 500:goto redozseg<br /> matsegz=int(matsegz)<br /> <br /> print "Matrix parameters accepted"<br /> <br /> print "Working...";<br /> sleep 500<br /> backdrop on<br /> dim height((matsegx+1)*(matsegz+1))<br /> dim xpos((matsegx+1)*(matsegz+1)):dim zpos((matsegz+1)*(matsegx+1))<br /> loaded:<br /> <br /> if matsizex>500 and matsizez>500 then size=6 else size=2<br /> if matsizex>2000 and matsizez>2000 then size=10<br /> if matsizex>5000 and matsizez>5000 then size=30<br /> <br /> dim objstat((matsegx+1)*(matsegz+1))<br /> matsegx1=matsizex/matsegx:matsegz1=matsizez/matsegz<br /> banding=0:mx1=0:mx2=0:my1=0:my2=0:hide=-1<br /> <br /> objnum=1<br /> for z=0 to matsegz<br /> for x=0 to matsegx<br /> objstat(objnum)=-1<br /> finalcount=objnum<br /> inc objnum<br /> next x<br /> print ".";<br /> next z<br /> <br /> sync on<br /> autocam off<br /> make matrix 1,matsizex,matsizez,matsegx,matsegz<br /> prepare matrix texture 1,1,1,1<br /> update matrix 1<br /> make object cube 50000,10:position object 50000,-10,0,-10:color object 50000,RGB(0,255,255)<br /> <br /> if load=1<br /> for x=1 to finalcount<br /> read long 1,xpos(x)<br /> read long 1,zpos(x)<br /> read long 1,height(x)<br /> next x<br /> close file 1<br /> endif<br /> load=0<br /> <br /> objnum=1<br /> for z=0 to matsegz<br /> for x=0 to matsegx<br /> make object sphere objnum,size:color object objnum,rgb(0,255,0)<br /> position object objnum,x*matsegx1,height(objnum),z*matsegz1<br /> set matrix height 1,x,z,height(objnum)<br /> if load=1 then goto skipassign<br /> xpos(objnum)=x:zpos(objnum)=z<br /> skipassign:<br /> inc objnum<br /> next x<br /> next z<br /> update matrix 1<br /> <br /> set camera range 1,100000<br /> position camera 0,200,0<br /> point camera 0,0,200<br /> <br /> mousexold#=mousex():mouseyold#=mousey()<br /> <br /> mainloop:<br /> do<br /> <br /> dec hintdelay<br /> if hintdelay<0 then hintdelay=850:inc hint<br /> if hint>hints then hint=1<br /> if inkey$()="z"<br /> inc hint<br /> if hint>hints then hint=1<br /> hintdelay=1200<br /> sleep 200<br /> endif<br /> <br /> if inkey$()="n"<br /> sync off:backdrop off:set matrix wireframe on 1<br /> set cursor 0,0:cls rgb(0,0,0):ink RGB(255,255,255),0<br /> print "Confirm! Do you want to start a new matrix?(y/n)"<br /> print "You may want to answer no and save this matrix first lest it be lost."<br /> sleep 500<br /> getagain5:<br /> g$=inkey$()<br /> if g$<>"y" and g$<>"n" then goto getagain5<br /> if g$="y"<br /> for x=1 to finalcount:delete object x:next x:delete object 50000<br /> delete matrix 1<br /> undim xpos(finalcount):undim zpos(finalcount)<br /> undim height(finalcount):undim objstat(finalcount)<br /> sleep 200<br /> goto startover<br /> endif<br /> if g$="n"<br /> sync on:backdrop on<br /> endif<br /> sleep 500<br /> set matrix wireframe off 1<br /> endif<br /> <br /> if inkey$()="g"<br /> ghost=ghost*-1<br /> if ghost=1<br /> ghost matrix on 1<br /> endif<br /> if ghost=-1<br /> ghost matrix off 1<br /> endif<br /> sleep 200<br /> endif<br /> <br /> <br /> <br /> if inkey$()="l"<br /> sync off:backdrop off<br /> cls rgb(0,0,0):ink rgb(255,255,255),0<br /> print "Are you sure you want to level your matrix back to zero?(y/n)"<br /> sleep 200<br /> getagain6:<br /> g$=inkey$()<br /> if g$<>"y" and g$<>"n" then goto getagain6<br /> if g$="y"<br /> for x=1 to finalcount<br /> height(x)=0<br /> set matrix height 1,xpos(x),zpos(x),height(x)<br /> position object x,xpos(x)*matsegx1,height(x),zpos(x)*matsegz1<br /> objstat(x)=-1:color object x,rgb(0,255,0)<br /> next x<br /> update matrix 1<br /> endif<br /> sync on:backdrop on<br /> endif<br /> <br /> if inkey$()="1" then goto savematrix<br /> if inkey$()="2" then goto loadmatrix<br /> <br /> base=get ground height(1,0,0):position object 50000,-10,base,-10<br /> mousexnew#=mousexold#-mousex():mouseynew#=mouseyold#-mousey()<br /> <br /> if upkey()=1 or mouseclick()=2 and mouseynew#>0<br /> pitch camera down 2<br /> endif<br /> <br /> if downkey()=1 or mouseclick()=2 and mouseynew#<0<br /> pitch camera up 2<br /> endif<br /> <br /> if leftkey()=1 or mouseclick()=2 and mousexnew#>0<br /> turn camera left 2<br /> endif<br /> <br /> if rightkey()=1 or mouseclick()=2 and mousexnew#<0<br /> turn camera right 2<br /> endif<br /> if mousezold<mousez() or inkey$()="+"<br /> move camera 20*size<br /> endif<br /> if mousezold>mousez() or inkey$()="-"<br /> move camera -20*size<br /> endif<br /> <br /> if banding=1 then goto skiptilt<br /> if mouseclick()=3 and mousexnew#>0<br /> roll camera left 2<br /> endif<br /> if mouseclick()=3 and mousexnew#<0<br /> roll camera right 2<br /> endif<br /> <br /> skiptilt:<br /> <br /> if banding=1 then goto skipfirst<br /> if mouseclick()=1<br /> mx1=mousex():my1=mousey():banding=1<br /> endif<br /> <br /> skipfirst:<br /> <br /> if banding=1 then mx2=mousex():my2=mousey()<br /> if mx1>mx2 and my1<my2 or mx1<mx2 and my1>my2 then banding=0<br /> <br /> if banding=1 and mouseclick()=0<br /> if mx1<mx2<br /> for x=1 to finalcount<br /> ox=object screen x(x):oy=object screen y(x)<br /> if object visible(x)=1<br /> if ox>mx1 and ox<mx2 and oy>my1 and oy<my2<br /> objstat(x)=1:color object x,rgb(255,0,0)<br /> endif<br /> endif<br /> next x<br /> endif<br /> if mx1>mx2<br /> for x=1 to finalcount<br /> ox=object screen x(x):oy=object screen y(x)<br /> if object visible(x)=1<br /> if ox<mx1 and ox>mx2 and oy<my1 and oy>my2<br /> objstat(x)=objstat(x)*-1<br /> if objstat(x)=1 then color object x,rgb(255,0,0)<br /> if objstat(x)=-1 then color object x,rgb(0,255,0)<br /> endif<br /> endif<br /> next x<br /> endif<br /> banding=0<br /> endif<br /> <br /> if banding=1 and mx1<>mx2 and my1<>my2 then goto skipselect<br /> <br /> if mousexnew#=0 and mouseynew#=0<br /> if mouseclick()=1 and mx1=mx2 and banding=1 and mx1=mx2 and my1=my2<br /> for x=1 to finalcount<br /> if object in screen(x)=1<br /> if object visible(x)=1<br /> sx=object screen x(x):sy=object screen y(x)<br /> if mousex()>sx-5 and mousex()<sx+5 and mousey()>sy-5 and mousey()<sy+5<br /> objstat(x)=objstat(x)*-1<br /> if objstat(x)=1 then color object x,rgb(255,0,0)<br /> if objstat(x)=-1 then color object x,rgb(0,255,0)<br /> sleep 200<br /> x=finalcount:banding=0<br /> endif<br /> endif<br /> endif<br /> next x<br /> sleep 200<br /> endif<br /> endif<br /> skipselect:<br /> <br /> if mouseclick()=4 and mouseynew#>0 or inkey$()="."<br /> for x=1 to finalcount<br /> if objstat(x)=1<br /> gh#=get matrix height(1,xpos(x),zpos(x))<br /> inc height(x),(size/2+1)<br /> set matrix height 1,xpos(x),zpos(x),height(x)<br /> position object x,xpos(x)*matsegx1,height(x),zpos(x)*matsegz1<br /> endif<br /> next x<br /> update matrix 1<br /> endif<br /> <br /> if mouseclick()=4 and mouseynew#<0 or inkey$()=","<br /> for x=1 to finalcount<br /> if objstat(x)=1<br /> dec height(x),(size/2+1)<br /> set matrix height 1,xpos(x),zpos(x),height(x)<br /> position object x,xpos(x)*matsegx1,height(x),zpos(x)*matsegz1<br /> endif<br /> next x<br /> update matrix 1<br /> endif<br /> if inkey$()="u"<br /> for x=1 to finalcount<br /> if objstat(x)=1<br /> objstat(x)=-1<br /> color object x,rgb(0,255,0)<br /> endif<br /> next x<br /> endif<br /> <br /> if inkey$()="s"<br /> for x=1 to finalcount<br /> if object visible(x)=1 then objstat(x)=1:color object x,rgb(255,0,0)<br /> next x<br /> endif<br /> <br /> if inkey$()="t"<br /> for x=1 to finalcount<br /> if object visible(x)=1<br /> objstat(x)=objstat(x)*-1<br /> if objstat(x)=1 then color object x,rgb(255,0,0)<br /> if objstat(x)=-1 then color object x,rgb(0,255,0)<br /> endif<br /> next x<br /> sleep 200<br /> endif<br /> if inkey$()="h"<br /> hide=hide*-1<br /> if hide=1<br /> for x=1 to finalcount<br /> if objstat(x)=-1<br /> hide object x<br /> endif<br /> next x<br /> endif<br /> if hide=-1<br /> for x=1 to finalcount<br /> if objstat(x)=-1<br /> if object visible(x)=0 then show object x<br /> endif<br /> next x<br /> endif<br /> sleep 200<br /> endif<br /> <br /> mousexold#=mousex():mouseyold#=mousey():mousezold=mousez()<br /> <br /> if inkey$()="w"<br /> if matrix wireframe state(1)=1 then set matrix wireframe off 1 else set matrix wireframe on 1<br /> sleep 200<br /> endif<br /> ink RGB(0,255,255),0<br /> set cursor screen width()/2-120,0<br /> print "MATRIX MASTER - by Richard Sardini"<br /> ink RGB(0,128,255),0<br /> set cursor screen width()/2-80,40<br /> print "You are editing matix> ";:ink rgb(255,255,0),0:print matname$:ink rgb(255,255,255),0<br /> <br /> xl=screen width()/2:yl=screen height()/2<br /> ink RGB(192,192,192),0<br /> line xl,200,xl,screen height()-200<br /> line 250,yl,screen width()-250,yl<br /> ink rgb(255,255,255),0<br /> if banding=1<br /> if mx1<mx2 then ink RGB(255,0,128),0 else ink RGB(255,255,0),0<br /> line mx1,my1,mx2,my1:line mx1,my2,mx1,my1<br /> line mx2,my1,mx2,my2:line mx1,my2,mx2,my2<br /> ink rgb(255,255,255),0<br /> endif<br /> cnt1=0<br /> for x=1 to finalcount<br /> if objstat(x)=1<br /> print "X->";xpos(x);" Z->";zpos(x);" Height->";height(x)<br /> inc cnt1<br /> if cnt1>15 then x=finalcount<br /> endif<br /> next x<br /> inc hintc1,8:if hintc1>255 then hintc1=100<br /> hintcolor=rgb(0,hintc1,0)<br /> <br /> ink hintcolor,0<br /> text int(screen width()/30),screen height()-100,hint$(hint)<br /> set cursor screen width()/5,screen height()-60<br /> ink rgb(255,255,255),0<br /> print "Press: 1-Save, 2-Load, Z-Zip to next hint"<br /> <br /> sync<br /> loop<br /> <br /> savematrix:<br /> backdrop off<br /> sync off:cls rgb(0,0,0)<br /> ink rgb(255,255,255),0<br /> savematrix1:<br /> if file exist(matname$)=1<br /> sleep 500<br /> print "File already exist - Would you like to overwrite this file or rename your matrix?"<br /> <br /> print "Press 2 to overwrite or 3 to rename this matrix"<br /> getagain:<br /> g$=inkey$()<br /> if g$<>"2" and g$<>"3" then sleep 200:goto getagain<br /> if g$="3"<br /> sleep 200<br /> print "What is the new file name?";:input matname$<br /> sleep 200<br /> goto savematrix1<br /> endif<br /> if g$="2" then delete file matname$:sleep 200<br /> endif<br /> open to write 1,matname$<br /> write long 1,matsizex:write long 1,matsizez:write long 1,matsegx:write long 1,matsegz<br /> write long 1,finalcount<br /> for x=1 to finalcount<br /> write long 1,xpos(x)<br /> write long 1,zpos(x)<br /> write long 1,height(x)<br /> next x<br /> close file 1<br /> print "File saved: Press any key to return to editor"<br /> sleep 500<br /> wait key<br /> sleep 200<br /> sync on<br /> backdrop on<br /> goto mainloop<br /> <br /> <br /> <br /> loadmatrix:<br /> backdrop off<br /> sync off:cls rgb(0,0,0)<br /> ink rgb(255,255,255),0<br /> <br /> print "Current matrix will be lost. Proceed(Y/N)?"<br /> getinput:<br /> g$=inkey$()<br /> if g$="n" or g$="N" then sync on:backdrop on:goto mainloop<br /> if g$<>"y" then goto getinput<br /> delete matrix 1<br /> for x=1 to finalcount<br /> delete object x<br /> next x<br /> delete object 50000<br /> undim xpos(finalcount):undim zpos(finalcount)<br /> undim height(finalcount):undim objstat(finalcount)<br /> redomatrixname:<br /> input "File name to load?";matname$<br /> if matname$="exit" then goto startover<br /> if file exist(matname$)=0<br /> print "File does not exist: Try again or type exit"<br /> sleep 500<br /> goto redomatrixname<br /> endif<br /> if file exist(matname$)=1<br /> open to read 1,matname$<br /> read long 1,matsizex:read long 1,matsizez<br /> read long 1,matsegx:read long 1,matsegz<br /> read long 1,finalcount<br /> dim height(finalcount):dim xpos(finalcount):dim zpos(finalcount)<br /> load=1<br /> endif<br /> sync on<br /> backdrop on<br /> <br /> goto loaded<br /> <br /> <br /> remstart<br /> <br /> This is the code snippet you will need to re-load your matrix into your DB programs<br /> <br /> open to read 1,<filenamehere><br /> read long 1,matsizex:read long 1,matsizez<br /> read long 1,matsegx:read long 1,matsegz<br /> read long 1,finalcount<br /> dim height(finalcount):dim xpos(finalcount):dim zpos(finalcount)<br /> for x=1 to finalcount<br /> read long 1,xpos(x)<br /> read long 1,zpos(x)<br /> read long 1,height(x)<br /> next x<br /> close file 1<br /> make matrix 1,matsizex,matsizez,matsegx,matsegz<br /> for x=1 to finalcount<br /> set matrix height 1,xpos(x),zpos(x),height(x)<br /> next x<br /> update matrix 1<br /> <br /> endrem
Comments
No comments yet.