Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub fastvds_load ( index as integer = 2)
- dim as integer slide=0,col=0,row=0,headw=16,headh=16
- redim as string slides(),lines(),pixies(), dimensions()
- dim as string buffer,filename
- filename=".\datapack\fastvds\map"+string_crop(index,3,"0")+".vds"
- '[?] create maps array
- if ubound(maps,0)=0 then
- redim preserve maps(0 to 0)
- end if
- '[?] expand maps array by index
- if ubound(maps,1)<index then
- redim preserve maps(0 to index)
- end if
- '[?] pull buffer by filename
- fastload filename, buffer
- '[?] capture slides
- fasttok buffer, gt, slides()
- '[?] step through slides
- for slide=lbound(slides,1) to ubound(slides,1) step 1
- '[?] skip over blank slides
- if not(len(slides(slide))=0) then
- '[?] fit slides to current map
- if ubound(maps,1)=0 then
- redim maps(0 to 0)
- else
- redim preserve maps(lbound(maps,1) to slide-lbound(slides,1))
- end if
- '[?] capture lines from current slide
- fasttok slides(slide),crlf,lines()
- '[?] check that first line in current slide is not blank
- if not(len(lines(lbound(lines,1)))=0) then
- '[?] check first line in slide for map dimensions
- fasttok lines(lbound(lines,1)),comma,dimensions()
- '[?] check dimensions validity
- if lbound(dimensions,1)=0 and ubound(dimensions,1)>=2 then
- maps(index).w=val(dimensions(lbound(dimensions,1)+1))
- maps(index).h=val(dimensions(lbound(dimensions,1)+2))
- '''[!!!] irrelevant code
- '''tiles(ubound(tiles,1)).img=imagecreate(headw,headh,0,8)
- end if
- end if
- '[?] check that map size is valid
- if maps(index).w>0 and maps(index).h>0 then
- '[?] size map to fit data
- redim preserve (maps(index).px)(0 to maps(index).w-1,0 to maps(index).h-1)
- '[?] populate map
- for row=0 to maps(index).h-1 step 1
- '[?] capture data from map row
- fasttok lines(row+1),comma,pixies()
- for col=0 to maps(index).w-1 step 1
- '[?] populate data from map col
- if col>=lbound(pixies,1) and col<=ubound(pixies,1) then
- maps(index).px(col,row)=val(pixies(col))
- end if
- next col
- next row
- end if
- end if
- next slide
- end sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement