Difference for arch/ogl/gr.c from version 1.17 to 1.18


version 1.17 version 1.18
Line 219
 
Line 219
 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")))
Line 500
 
Line 500
  }   }
 }  }
   
 //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;
Line 510
 
Line 510
  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{
Line 554
 
Line 570
   
 //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

Legend:
line(s) removed in v.1.17 
line(s) changed
 line(s) added in v.1.18