Free Hero Mesh

Diff
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.

Differences From Artifact [b1d6c4cbe4]:

To Artifact [399282ff2d]:


68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
  for(i=0;i<256;i++) {
    if(fp) {
      if(fscanf(fp,"%2hhX%2hhX%2hhX ",&pal[i].r,&pal[i].g,&pal[i].b)!=3) fatal("Invalid palette file\n");
    } else {
      sscanf(default_palette+i*7,"%2hhX%2hhX%2hhX ",&pal[i].r,&pal[i].g,&pal[i].b);
    }
    if(usegamma) {
      j=(int)pow(pal[i].r+0.3,gamma); pal[i].r=j<0?0:j>255?255:j;
      j=(int)pow(pal[i].g+0.3,gamma); pal[i].g=j<0?0:j>255?255:j;
      j=(int)pow(pal[i].b+0.3,gamma); pal[i].b=j<0?0:j>255?255:j;
    }
  }
  if(fp) fclose(fp);
  SDL_SetColors(screen,pal,0,256);
  SDL_SetColors(picts,pal,0,256);
}








|
|
|







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
  for(i=0;i<256;i++) {
    if(fp) {
      if(fscanf(fp,"%2hhX%2hhX%2hhX ",&pal[i].r,&pal[i].g,&pal[i].b)!=3) fatal("Invalid palette file\n");
    } else {
      sscanf(default_palette+i*7,"%2hhX%2hhX%2hhX ",&pal[i].r,&pal[i].g,&pal[i].b);
    }
    if(usegamma) {
      j=(int)(255.0*pow(pal[i].r/255.0,gamma)+0.2); pal[i].r=j<0?0:j>255?255:j;
      j=(int)(255.0*pow(pal[i].g/255.0,gamma)+0.2); pal[i].g=j<0?0:j>255?255:j;
      j=(int)(255.0*pow(pal[i].b/255.0,gamma)+0.2); pal[i].b=j<0?0:j>255?255:j;
    }
  }
  if(fp) fclose(fp);
  SDL_SetColors(screen,pal,0,256);
  SDL_SetColors(picts,pal,0,256);
}