So I keep running out of memory (this is what i get for starting to have animations, right ;)), which kind of sucks, but then it occurred to me that having a second copy of the data for my sprites in memory was kind of a problem..... and indeed, this got me back to being able to boot into the game, so I though i'd share it:
function reado32(filename)
file = fopen(filename, "rt")
dimensions = Int(Val(fgets(file)))
command_count = Int(Val(fgets(file)))
print "Reading "+command_count+"commands of "+dimensions+"d object from "+filename
dim o[command_count, dimensions + 1]
for j = 1 to command_count
o[j, 1] = Int(Val(fgets(file)))
for k = 1 to dimensions
o[j, k+1] = Val(fgets(file))
next
next
print "done!"
return o
endfunction
The format is:
[dimensions]
[commands]
... and then [commands] list of comamnds. I formed my test file by taking a function, and doing:
cat lightcycle.bai | sed 's/MoveTo/0/g' | sed 's/DrawTo/1/g' | sed 's/,/\r/g' | sed 's/\{/\r/g' | sed 's/}/\r/g' | sed 's/_/\r/g' | sed '/^ *$/d' > lightcycle.o32
and then filling in my dimensions(3) and vertex count (145) at the top of the file, resulting in:
3
145
0
-0.284963
-0.242065
1.085209
1
-0.284963
-0.550938
1.394082
1
-0.452639
-0.242065
1.394082
1
-0.284963
-0.242065
1.702956