Changeset 17 for abuse/trunk/src/imlib/mdlread.cpp
- Timestamp:
- Nov 10, 2005, 9:41:13 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/imlib/mdlread.cpp
r2 r17 11 11 // images. All images should be sized so they will fit on an mdl screen 12 12 // but no checking of that is done hhere. 13 void write_mdl(image **images, short total_images, palette *pal,char *fn,14 short firstpage, short images_per_page)13 void write_mdl(image **images, int16_t total_images, palette *pal,char *fn, 14 int16_t firstpage, int16_t images_per_page) 15 15 { 16 16 FILE *fp; 17 17 char buf[18]; 18 u nsigned short xy[2],x;18 uint16_t xy[2],x; 19 19 char name[13],page; 20 20 unsigned char *c; 21 short i;21 int16_t i; 22 22 palette *np; 23 23 clear_errors(); … … 43 43 memset(buf,0,6); // each image has 6 bytes of reserved 0 44 44 fwrite(buf,6,1,fp); 45 xy[0]= int_to_intel(i%100+20); xy[1]=int_to_intel(30); // the x and y position on the screen45 xy[0]=uint16_to_intel(i%100+20); xy[1]=uint16_to_intel(30); // the x and y position on the screen 46 46 fwrite(xy,4,1,fp); 47 47 sprintf(name,"JC%-10d",i); // set the name of the image … … 51 51 52 52 fwrite(&page,1,1,fp); // put all of the image on the first page 53 xy[0]= int_to_intel(images[i]->width()*images[i]->height()+4); // calc the size of the image53 xy[0]=uint16_to_intel(images[i]->width()*images[i]->height()+4); // calc the size of the image 54 54 55 55 fwrite(xy,2,1,fp); 56 xy[0]= int_to_intel(images[i]->width());56 xy[0]=uint16_to_intel(images[i]->width()); 57 57 fwrite(xy,2,1,fp); 58 xy[0]= int_to_intel(images[i]->height());58 xy[0]=uint16_to_intel(images[i]->height()); 59 59 fwrite(xy,2,1,fp); 60 for (x=0;x<(u nsigned short)images[i]->height();x++) // write all the scan_lines for the60 for (x=0;x<(uint16_t)images[i]->height();x++) // write all the scan_lines for the 61 61 { c=images[i]->scan_line(x); // image 62 62 fwrite(c,images[i]->width(),1,fp); … … 67 67 } 68 68 69 short mdl_total_images(char *fn)69 int16_t mdl_total_images(char *fn) 70 70 { 71 71 char buf[800]; 72 u nsigned short xy[2],t;72 uint16_t xy[2],t; 73 73 FILE *fp; 74 74 fp=fopen(fn,"rb"); … … 92 92 { 93 93 fread(xy,2,1,fp); 94 xy[0]= int_to_local(xy[0]);94 xy[0]=uint16_to_local(xy[0]); 95 95 fseek(fp,xy[0],SEEK_CUR); 96 96 t++; … … 104 104 // and a palette that is read form the file 105 105 // to load image numbers 4 through 9 let start =4, end=9 106 image **read_mdl(char *fn, palette *&pal, short startn, short endn, short &total)106 image **read_mdl(char *fn, palette *&pal, int16_t startn, int16_t endn, int16_t &total) 107 107 { 108 108 FILE *fp; 109 109 image **im; 110 110 char buf[50]; 111 u nsigned short xy[2],i,j;111 uint16_t xy[2],i,j; 112 112 clear_errors(); 113 113 make_block(sizeof(FILE)); … … 147 147 set_error(imFILE_CORRUPTED); 148 148 fread(xy,2,1,fp); 149 xy[0]= int_to_local(xy[0]);149 xy[0]=uint16_to_local(xy[0]); 150 150 fseek(fp,xy[0],SEEK_CUR); 151 151 startn--; if (endn>0) endn--; … … 161 161 else 162 162 { 163 j= int_to_local(j);163 j=uint16_to_local(j); 164 164 j-=4; 165 165 xy[0]=5; xy[1]=5; 166 166 if (fread(xy,1,4,fp)!=4) set_error(imFILE_CORRUPTED); 167 167 make_block(sizeof(image)); 168 xy[0]= int_to_local(xy[0]);169 xy[1]= int_to_local(xy[1]);168 xy[0]=uint16_to_local(xy[0]); 169 xy[1]=uint16_to_local(xy[1]); 170 170 im[startn]=new image(xy[0],xy[1]); 171 171 total++;
Note: See TracChangeset
for help on using the changeset viewer.