Posted By: Matt_Aufderheide
Crash with pixel_to_vec - 04/30/09 18:22
can anyone tell me why this function crashes? I'm sure its something to with the line "if (temp_vec[0]==255)" ..in old c-script you used to be able to assign the pixel to temp and read it like temp.red ..this doesnt work in lite C apparently.
Code:
var treemask_array[256][256]; BMAP* treemask = "treemask.tga"; function init_treemask() { var format; var pixel; var county=0; var countx=256; var temp_vec[3]; format=bmap_lock(treemask,0); while(countx>0) { while(county<256) { pixel = pixel_for_bmap(treemask,countx,county); pixel_to_vec(temp_vec,NULL,888,pixel); //only write to array if red is 255 if (temp_vec[0]==255) { treemask_array[countx][county]=255; } else {treemask_array[countx][county]=0;} county+=1; } if (county>=256) { county=0; } countx-=1; } bmap_unlock(treemask); }