version 1.17 | | version 1.18 |
---|
| | |
int ogl_rt_loaded=0; | | int ogl_rt_loaded=0; |
int ogl_init_load_library(void) | | int ogl_init_load_library(void) |
{ | | { |
int retcode=-1; | | int retcode=0; |
if (!ogl_rt_loaded){ | | if (!ogl_rt_loaded){ |
int t; | | int t; |
if ((t=FindArg("-gl_library"))) | | if ((t=FindArg("-gl_library"))) |
| | |
} | | } |
} | | } |
| | |
//writes out a raw bitmap file. Eventually it could be made to write a "real" bmp with header, or tiff, etc. (if I ever get the screen shot func to produce any data) | | //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){ | | void write_bmp(char *savename,int w,int h,unsigned char *buf){ |
int f; | | int f; |
| | |
f=open(savename,O_CREAT|O_EXCL|O_WRONLY,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); | | f=open(savename,O_CREAT|O_EXCL|O_WRONLY,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); |
#endif | | #endif |
if (f>=0){ | | if (f>=0){ |
| | GLubyte targaMagic[12] = { 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| | GLubyte blah; |
int r; | | int r; |
int i=w*h*3; | | int i=w*h*3; |
| | |
| | //write .TGA header. |
| | write (f,targaMagic,sizeof(targaMagic)); |
| | blah=w%256;write (f,&blah,1);//w, low |
| | blah=w/256;write (f,&blah,1);//w, high |
| | blah=h%256;write (f,&blah,1);//h, low |
| | blah=h/256;write (f,&blah,1);//h, high |
| | blah=24;write (f,&blah,1);//24 bpp |
| | blah=0;write (f,&blah,1);//? |
while (i>0){ | | while (i>0){ |
r=write(f,buf,i); | | i-=3; |
| | r=write(f,buf+i,3); |
if (r<=0){ | | if (r<=0){ |
mprintf((0,"screeshot error, couldn't write to %s (err %i)\n",savename,errno)); | | mprintf((0,"screeshot error, couldn't write to %s (err %i)\n",savename,errno)); |
break; | | break; |
} | | } |
i-=r; | | else if (r!=3){ |
buf+=r; | | mprintf((0,"screeshot error, only wrote %i (e %i)\n",r,errno)); |
| | break; |
| | } |
| | // i-=r; |
| | // buf+=r; |
} | | } |
close(f); | | close(f); |
}else{ | | }else{ |
| | |
| | |
//added/changed on 10/31/98 by Victor Rachels to fix overwrite each new game | | //added/changed on 10/31/98 by Victor Rachels to fix overwrite each new game |
if ( savenum == 9999 ) savenum = 0; | | if ( savenum == 9999 ) savenum = 0; |
sprintf(savename,"scrn%04d.raw",savenum++); | | sprintf(savename,"scrn%04d.tga",savenum++); |
| | |
while(!access(savename,0)) | | while(!access(savename,0)) |
{ | | { |
if ( savenum == 9999 ) savenum = 0; | | if ( savenum == 9999 ) savenum = 0; |
sprintf(savename,"scrn%04d.raw",savenum++); | | sprintf(savename,"scrn%04d.tga",savenum++); |
} | | } |
sprintf( message, "%s '%s'", TXT_DUMPING_SCREEN, savename ); | | sprintf( message, "%s '%s'", TXT_DUMPING_SCREEN, savename ); |
//end this section addition/change - Victor Rachels | | //end this section addition/change - Victor Rachels |