make write_bmp use PhysFS
This commit is contained in:
parent
f32434bdbb
commit
d350a6b244
|
@ -757,8 +757,8 @@ typedef struct {
|
||||||
|
|
||||||
//writes out an uncompressed RGB .tga file
|
//writes out an uncompressed RGB .tga file
|
||||||
//if we got really spiffy, we could optionally link in libpng or something, and use that.
|
//if we got really spiffy, we could optionally link in libpng or something, and use that.
|
||||||
void write_bmp(char *savename,int w,int h,unsigned char *buf){ // ZICO - modified for win32
|
void write_bmp(char *savename,int w,int h,unsigned char *buf){
|
||||||
FILE* TGAFile;
|
PHYSFS_file* TGAFile;
|
||||||
TGA_header TGA;
|
TGA_header TGA;
|
||||||
GLbyte HeightH,HeightL,WidthH,WidthL;
|
GLbyte HeightH,HeightL,WidthH,WidthL;
|
||||||
|
|
||||||
|
@ -766,7 +766,7 @@ void write_bmp(char *savename,int w,int h,unsigned char *buf){ // ZICO - modifie
|
||||||
|
|
||||||
glReadPixels(0,0,w,h,GL_BGR_EXT,GL_UNSIGNED_BYTE,buf);
|
glReadPixels(0,0,w,h,GL_BGR_EXT,GL_UNSIGNED_BYTE,buf);
|
||||||
|
|
||||||
TGAFile = fopen(savename, "wb");
|
TGAFile = PHYSFSX_openWriteBuffered(savename);
|
||||||
|
|
||||||
HeightH = (GLbyte)(h / 256);
|
HeightH = (GLbyte)(h / 256);
|
||||||
HeightL = (GLbyte)(h % 256);
|
HeightL = (GLbyte)(h % 256);
|
||||||
|
@ -791,9 +791,9 @@ void write_bmp(char *savename,int w,int h,unsigned char *buf){ // ZICO - modifie
|
||||||
TGA.header[3] = (GLbyte) HeightH;
|
TGA.header[3] = (GLbyte) HeightH;
|
||||||
TGA.header[4] = (GLbyte) 24;
|
TGA.header[4] = (GLbyte) 24;
|
||||||
TGA.header[5] = 0;
|
TGA.header[5] = 0;
|
||||||
fwrite(&TGA,sizeof(TGA_header),1,TGAFile);
|
PHYSFS_write(TGAFile,&TGA,sizeof(TGA_header),1);
|
||||||
fwrite(buf,w*h*3*sizeof(unsigned char),1,TGAFile);
|
PHYSFS_write(TGAFile,buf,w*h*3*sizeof(unsigned char),1);
|
||||||
fclose(TGAFile);
|
PHYSFS_close(TGAFile);
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue