nitrofurano

rexpaint2aquariusdump02.sdlbas

Jul 8th, 2014
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /usr/bin/sdlbrt
  2.  
  3. finp$="test2z.csv"
  4. dim cellc[40,25],cella[40,25]
  5.  
  6. function locstrinfo$(a$,b$,c$)
  7.   '-bug to be fixed, find where
  8.   adra=1:adrb=1:blngt=len(b$):d$=""
  9.   while adrb<=blngt
  10.   if mid$ (a$,adra,1)=mid$ (b$,adrb,1) then:adrb+=1:end if
  11.   adra+=1:end while
  12.   while mid$(a$,adra,1)<>left$(c$,1):d$=d$+mid$(a$,adra,1):adra+=1:end while
  13.   locstrinfo$=d$
  14.   end function
  15.  
  16. function aquariuspalette(hxc$)
  17.   hxv=val("0x"+hxc$)
  18.   b=(hxv mod 256):hxv=int(hxv/256)
  19.   g=(hxv mod 256):hxv=int(hxv/256)
  20.   r=(hxv mod 256):hxv=int(hxv/256)
  21.   tqv=0
  22.   if g>128 then:tqv=tqv+2:end if
  23.   if r>128 then:tqv=tqv+1:end if
  24.   if b>128 then:tqv=tqv+4:end if
  25.   if tqv=7 and g<224 then:tqv=8:end if
  26.   if tqv=6 and g<180 then:tqv=9:end if
  27.   if tqv=5 and r<216 then:tqv=10:end if
  28.   if tqv=4 and b<176 then:tqv=11:end if
  29.   if tqv=3 and b>64 then:tqv=12:end if
  30.   if tqv=2 and g<220 then:tqv=13:end if
  31.   if tqv=1 and r<204 then:tqv=14:end if
  32.   if tqv=0 and g>16 then:tqv=15:end if
  33.   aquariuspalette=tqv
  34.   end function
  35.  
  36. open finp$ for input as #1
  37. open finp$+".bin" for output as #2
  38.  
  39. while eof(1)=0
  40.   file input #1,tlq$
  41.   if left$(tlq$,4)<>"X,Y," then:
  42.     tlq$=">"+tlq$+",0,0,0,0,0,0,0,0,"
  43.     xv$=locstrinfo$(tlq$,">",",")
  44.     yv$=locstrinfo$(tlq$,">,",",")
  45.     ch$=locstrinfo$(tlq$,">,,",",")
  46.     ik$=locstrinfo$(tlq$,">,,,#",",")
  47.     pp$=locstrinfo$(tlq$,">,,,,#",",")
  48.     cellc[val(xv$),val(yv$)]=val(ch$)
  49.     cella[val(xv$),val(yv$)]=aquariuspalette(ik$)*16+aquariuspalette(pp$)
  50.     end if
  51.   wend
  52.  
  53. for ypos=0 to 23
  54.   for xpos=0 to 39
  55.     writebyte(2,cellc[xpos,ypos])
  56.     next:next
  57. for ypos=0 to 63
  58.     writebyte(2,0)
  59.     next
  60. for ypos=0 to 23
  61.   for xpos=0 to 39
  62.     writebyte(2,cella[xpos,ypos])
  63.     next:next
  64.  
  65. close #1:close #2
Add Comment
Please, Sign In to add comment