From d350a6b244b389d0fd7ffb67fe4fef7a1a12826e Mon Sep 17 00:00:00 2001 From: zicodxx <> Date: Thu, 19 Oct 2006 09:38:07 +0000 Subject: [PATCH] make write_bmp use PhysFS --- arch/ogl/gr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/ogl/gr.c b/arch/ogl/gr.c index 5cc279dab..936541f75 100755 --- a/arch/ogl/gr.c +++ b/arch/ogl/gr.c @@ -757,8 +757,8 @@ typedef struct { //writes out an uncompressed RGB .tga file //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 - FILE* TGAFile; +void write_bmp(char *savename,int w,int h,unsigned char *buf){ + PHYSFS_file* TGAFile; TGA_header TGA; 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); - TGAFile = fopen(savename, "wb"); + TGAFile = PHYSFSX_openWriteBuffered(savename); HeightH = (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[4] = (GLbyte) 24; TGA.header[5] = 0; - fwrite(&TGA,sizeof(TGA_header),1,TGAFile); - fwrite(buf,w*h*3*sizeof(unsigned char),1,TGAFile); - fclose(TGAFile); + PHYSFS_write(TGAFile,&TGA,sizeof(TGA_header),1); + PHYSFS_write(TGAFile,buf,w*h*3*sizeof(unsigned char),1); + PHYSFS_close(TGAFile); free(buf); }