set MSX palette when loading
This commit is contained in:
		
							parent
							
								
									4d57ba39bb
								
							
						
					
					
						commit
						c1c6be51cf
					
				@ -33,6 +33,7 @@
 | 
				
			|||||||
#include "loadsavefuncs.h"
 | 
					#include "loadsavefuncs.h"
 | 
				
			||||||
#include "io.h"
 | 
					#include "io.h"
 | 
				
			||||||
#include "misc.h"
 | 
					#include "misc.h"
 | 
				
			||||||
 | 
					#include "oldies.h"
 | 
				
			||||||
#include "gfx2log.h"
 | 
					#include "gfx2log.h"
 | 
				
			||||||
#include "gfx2mem.h"
 | 
					#include "gfx2mem.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -129,7 +130,9 @@ void Load_MSX(T_IO_Context * context)
 | 
				
			|||||||
  fclose(file);
 | 
					  fclose(file);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  File_error = 0;
 | 
					  File_error = 0;
 | 
				
			||||||
  // TODO: load MSX palette
 | 
					  if (Config.Clear_palette)
 | 
				
			||||||
 | 
					    memset(context->Palette, 0, sizeof(T_Palette));
 | 
				
			||||||
 | 
					  MSX_set_palette(context->Palette);
 | 
				
			||||||
  context->Transparent_color = 0; // Set color 0 as transparent
 | 
					  context->Transparent_color = 0; // Set color 0 as transparent
 | 
				
			||||||
  Pre_load(context, 256, 192, file_size, FORMAT_MSX, PIXEL_SIMPLE, 4);
 | 
					  Pre_load(context, 256, 192, file_size, FORMAT_MSX, PIXEL_SIMPLE, 4);
 | 
				
			||||||
  for (row = 0; row < 24; row++)
 | 
					  for (row = 0; row < 24; row++)
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										26
									
								
								src/oldies.c
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								src/oldies.c
									
									
									
									
									
								
							@ -1068,3 +1068,29 @@ void DHGR_set_palette(T_Components * palette)
 | 
				
			|||||||
  palette[31].G = 255;
 | 
					  palette[31].G = 255;
 | 
				
			||||||
  palette[31].B = 255;
 | 
					  palette[31].B = 255;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void MSX_set_palette(T_Components * palette)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  static const T_Components MSX_palette[] = {
 | 
				
			||||||
 | 
					    {0, 0, 0},
 | 
				
			||||||
 | 
					    {32,219,32},
 | 
				
			||||||
 | 
					    {109,255,109},
 | 
				
			||||||
 | 
					    {32,32,255},
 | 
				
			||||||
 | 
					    {48,109,255},
 | 
				
			||||||
 | 
					    {182,32,32},
 | 
				
			||||||
 | 
					    {73,219,255},
 | 
				
			||||||
 | 
					    {255,32,32},
 | 
				
			||||||
 | 
					    {255,109,109},
 | 
				
			||||||
 | 
					    {219,219,32},
 | 
				
			||||||
 | 
					    {219,219,146},
 | 
				
			||||||
 | 
					    {32,146,32},
 | 
				
			||||||
 | 
					    {219,73,182},
 | 
				
			||||||
 | 
					    {182,182,182},
 | 
				
			||||||
 | 
					    {255,255,255}
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					  memcpy(palette + 1, MSX_palette, sizeof(MSX_palette));
 | 
				
			||||||
 | 
					  // set color 0 (transparent) to a dark gray
 | 
				
			||||||
 | 
					  palette[0].R = 32;
 | 
				
			||||||
 | 
					  palette[0].G = 32;
 | 
				
			||||||
 | 
					  palette[0].B = 32;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								src/oldies.h
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/oldies.h
									
									
									
									
									
								
							@ -19,6 +19,9 @@
 | 
				
			|||||||
    along with Grafx2; if not, see <http://www.gnu.org/licenses/>
 | 
					    along with Grafx2; if not, see <http://www.gnu.org/licenses/>
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef OLDIES_H_DEFINED
 | 
				
			||||||
 | 
					#define OLDIES_H_DEFINED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///@file oldies.h
 | 
					///@file oldies.h
 | 
				
			||||||
/// functions relative to old computers (Commodore 64, Thomsons MO/TO, Amstrad CPC, ZX Spectrum, etc.)
 | 
					/// functions relative to old computers (Commodore 64, Thomsons MO/TO, Amstrad CPC, ZX Spectrum, etc.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -297,3 +300,10 @@ void HGR_set_palette(T_Components * palette);
 | 
				
			|||||||
void DHGR_set_palette(T_Components * palette);
 | 
					void DHGR_set_palette(T_Components * palette);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** @}*/
 | 
					/** @}*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Set the 15 color MSX palette
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void MSX_set_palette(T_Components * palette);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user