Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. DINKWASHERE
  2. static UINT32 EmphRGB(INT32 pal_idx, UINT8 type)
  3. {
  4. #if 0
  5. UINT32 er = 1.0 * (1<<16); // 16.16
  6. UINT32 eg = 1.0 * (1<<16);
  7. UINT32 eb = 1.0 * (1<<16);
  8. UINT32 EMPH = 1.1 * (1<<16);
  9. UINT32 DEEMPH = 0.9 * (1<<16);
  10. if (type & 1) {
  11. er = er * EMPH;
  12. eg = eg * DEEMPH;
  13. eb = eb * DEEMPH;
  14. }
  15. if (type & 2) {
  16. er = er * DEEMPH;
  17. eg = eg * EMPH;
  18. eb = eb * DEEMPH;
  19. }
  20. if (type & 4) {
  21. er = er * DEEMPH;
  22. eg = eg * DEEMPH;
  23. eb = eb * EMPH;
  24. }
  25.  
  26. UINT32 r = (((nes_palette[pal_idx & 0x3f] >> 16) & 0xff) * er) >> 16;
  27. if (r > 0xff) r = 0xff;
  28. UINT32 g = (((nes_palette[pal_idx & 0x3f] >> 8) & 0xff) * eg) >> 16;
  29. if (g > 0xff) g = 0xff;
  30. UINT32 b = (((nes_palette[pal_idx & 0x3f] >> 0) & 0xff) * eb) >> 16;
  31. if (b > 0xff) b = 0xff;
  32. #endif
  33. float er = 1.0; // 16.16
  34. float eg = 1.0;
  35. float eb = 1.0;
  36. float EMPH = 1.1;
  37. float DEEMPH = 0.9;
  38. if (type & 1) {
  39. er = er * EMPH;
  40. eg = eg * DEEMPH;
  41. eb = eb * DEEMPH;
  42. }
  43. if (type & 2) {
  44. er = er * DEEMPH;
  45. eg = eg * EMPH;
  46. eb = eb * DEEMPH;
  47. }
  48. if (type & 4) {
  49. er = er * DEEMPH;
  50. eg = eg * DEEMPH;
  51. eb = eb * EMPH;
  52. }
  53.  
  54. UINT32 r = (((nes_palette[pal_idx & 0x3f] >> 16) & 0xff) * er);
  55. if (r > 0xff) r = 0xff;
  56. UINT32 g = (((nes_palette[pal_idx & 0x3f] >> 8) & 0xff) * eg);
  57. if (g > 0xff) g = 0xff;
  58. UINT32 b = (((nes_palette[pal_idx & 0x3f] >> 0) & 0xff) * eb);
  59. if (b > 0xff) b = 0xff;
  60.  
  61. return BurnHighCol(r, g, b, 0);
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement