PAL.CPP 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***************************************************************************
  19. ** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
  20. ***************************************************************************
  21. * *
  22. * Project Name : VQAVIEW *
  23. * *
  24. * File Name : PAL.CPP *
  25. * *
  26. * Programmer : Mike Grayford *
  27. * *
  28. * Start Date : November 20, 1995 *
  29. * *
  30. * Last Update : Nov 20, 1995 [MG] *
  31. * *
  32. *-------------------------------------------------------------------------*
  33. * Functions: *
  34. * *
  35. * Update_Full_Palette -- Modifies the Windows palette *
  36. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  37. #include <windows.h>
  38. #include <westwood.h>
  39. #include <vidmode.h>
  40. #include <pal.h>
  41. #include <gbuffer.h>
  42. #include <main.h>
  43. #include <monochrm.h>
  44. #include <wwlib.h>
  45. #include <memflag.h>
  46. #include <vq.h>
  47. //---------------------------------------------------------------------------------------------
  48. // PUBLIC DATA
  49. //---------------------------------------------------------------------------------------------
  50. //---------------------------------------------------------------------------------------------
  51. // PRIVATE GLOBALS
  52. //---------------------------------------------------------------------------------------------
  53. /***************************************************************************
  54. * Update_Full_Palette -- Modifies the Windows palette *
  55. * *
  56. * INPUT: unsigned char *palette - pointer to the entire raw palette *
  57. * *
  58. * OUTPUT: NONE *
  59. * *
  60. * WARNINGS: Watch out for falling bricks. *
  61. * *
  62. * HISTORY: *
  63. * 11/27/1995 MG : Created. *
  64. *=========================================================================*/
  65. void Update_Full_Palette( unsigned char *palette )
  66. {
  67. PALETTEENTRY pe[ SIZE_OF_PALETTE ];
  68. unsigned char *pal_pos;
  69. int i;
  70. pal_pos = palette;
  71. for ( i = 0; i < SIZE_OF_PALETTE; i ++ ) {
  72. pe[ i ].peRed = *pal_pos;
  73. pal_pos ++;
  74. pe[ i ].peGreen = *pal_pos;
  75. pal_pos ++;
  76. pe[ i ].peBlue = *pal_pos;
  77. pal_pos ++;
  78. }
  79. Mem_Copy( palette, CurrentPalette, SIZE_OF_PALETTE * 3 );
  80. DirectDrawObject->CreatePalette( DDPCAPS_8BIT, &pe[ 0 ], &PalettePtr, NULL );
  81. Screen_Buffer->Get_Graphic_Buffer()->Get_DD_Surface()->SetPalette( PalettePtr );
  82. PalettePtr->SetEntries( DDPSETPAL_VSYNC , 0 , SIZE_OF_PALETTE , &pe[ 0 ] );
  83. }
  84. extern VQAClass *TestVqa;
  85. extern "C"{
  86. void __cdecl SetPalette(unsigned char *palette,long ,unsigned long );
  87. }
  88. void __cdecl SetPalette(unsigned char *palette,long ,unsigned long )
  89. {
  90. TestVqa->Update_Palette(palette);
  91. }