Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. // DGen v1.13+
  2. #include <stdio.h>
  3. #include "md.h"
  4.  
  5. // This allows you to get the palette, mess around with it
  6. // (e.g. contrast/brightness)
  7. // and then pass it back
  8. int get_md_palette(unsigned char pal[256],unsigned char *cram)
  9. {
  10.   int c;
  11.   if (pal==NULL) return 1;
  12.   for (c=0;c<64;c++)
  13.   {
  14.     int r,g,b;
  15.     b=(cram[c*2+0]&0x0e)<<4;
  16.     g=(cram[c*2+1]&0xe0);
  17.     r=(cram[c*2+1]&0x0e)<<4;
  18.  
  19.     pal[c*4+0]=r;
  20.     pal[c*4+1]=g;
  21.     pal[c*4+2]=b;
  22.   }
  23.   return 0;
  24. }
  25.