#include #include #include "lib/ivis_common/ivi.h" #include "lib/ivis_common/piestate.h" #include "lib/ivis_common/piepalette.h" #include "lib/ivis_common/rendmode.h" #include "lib/ivis_common/bug.h" #include "lib/framework/fractions.h" #include "screen.h" #define RED_CHROMATICITY 1 #define GREEN_CHROMATICITY 1 #define BLUE_CHROMATICITY 1 uint8 pal_GetNearestColour(uint8 r, uint8 g, uint8 b); void pie_SetColourDefines(void); /* This is how far from the end you want the drawn as the artist intended shades to appear */ #define COLOUR_BALANCE 6 // 3 from the end. (two brighter shades!) iColour* psGamePal = NULL; uint8 palShades[PALETTE_SIZE * PALETTE_SHADE_LEVEL]; BOOL bPaletteInitialised = FALSE; uint8 colours[16]; //************************************************************************* //*** add a new palette //* //* params pal = pointer to palette to add //* //* returns slot number of added palette or -1 if error //* //****** int pal_AddNewPalette(iColour *pal) { int i; iColour *p; bPaletteInitialised = TRUE; if (psGamePal == NULL) { psGamePal = (iColour*) MALLOC(PALETTE_SIZE * sizeof(iColour)); if (psGamePal == NULL) { debug( LOG_ERROR, "pal_AddNewPalette - Out of memory" ); abort(); return FALSE; } } p = psGamePal; for (i=0; i255) seekRed = 255; if(seekGreen >255) seekGreen = 255; if(seekBlue >255) seekBlue = 255; palShades[(numColours * PALETTE_SHADE_LEVEL) + (numShades-COLOUR_BALANCE)] = pal_GetNearestColour((uint8) seekRed, (uint8) seekGreen, (uint8) seekBlue); } } } iColour* pie_GetGamePal(void) { ASSERT( bPaletteInitialised,"pie_GetGamePal, palette not initialised" ); return psGamePal; }