TGC Codebase Backup



Matrix hightmap + texuring DB(NT)+DBPro by TKF15H

7th Oct 2003 19:38
Summary

Makes and textures a matrix.(updated!)



Description

It'll open an image, and make a matrix according to it. Then it'll open another image split it up and use it as a texture for the whole matrix.

how to use:
m is how big you want the world to be. 1 is a normal size. 2 is two times. 3 do I really have to tell you?
LVLHM3.bmp is the hightmap
LVLTM3.bmp is the matrix's texture.
(both can be downloaded from my page: http://www.bugeyes.2ya.com/LVLHM3.bmp)

by TKF15H



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    gosub load_map
do
control camera using arrowkeys 0,10,5
sync
loop
end
load_map:
 M=2
 if matrix exist(1) then delete matrix 1
 load bitmap "FROG\HM1-1.jpg",1
 set current bitmap 1
 bw=bitmap width(1)-1
 bh=bitmap height(1)-1
 masix=(bw*100)*M
 masiz=(bh*100)*M
 make matrix 1,masix,masiz,bw,bh
 smx#=((bw*-500)*m)/2
 smz#=((bh*-500)*m)/2
 if image exist(1) then delete image 1
 load image "FROG\TM1-1.jpg",1
 prepare matrix texture 1,1,bw,bh
 in=0
 `bw-1
 for x=bh to 1 step -1
  for z=1 to bw
   in=in+1
   set matrix tile 1,z-1,x-1,in
  next z
 next x

 for x=0 to bw
  iz=bh+1
  for z=0 to bh
   iz=iz-1
   h=point(x,iz)
   h=(rgbr(h)+rgbg(h)+rgbb(h))/3
   set matrix height 1,x,z,h*(m+1)
  next z
 next x
 update matrix 1
 delete bitmap 1
return