From a59d4b1d15f798d83041ea727029e7f1217cbc1e Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Tue, 10 Jun 2003 17:50:50 +0000 Subject: [PATCH] gr_copy_palette no really a kludge, I think --- 2d/palette.c | 32 +++++++++++++++++++------------- main/kludge.c | 2 +- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/2d/palette.c b/2d/palette.c index 92da632b..30ed0e68 100644 --- a/2d/palette.c +++ b/2d/palette.c @@ -1,4 +1,4 @@ -/* $Id: palette.c,v 1.9 2003-06-10 07:31:38 btb Exp $ */ +/* $Id: palette.c,v 1.10 2003-06-10 17:50:50 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -147,6 +147,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include #include +#include #include "pstypes.h" #include "u_mem.h" @@ -164,6 +165,18 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. extern int gr_installed; +#define SQUARE(x) ((x)*(x)) + +#define MAX_COMPUTED_COLORS 32 + +int Num_computed_colors=0; + +typedef struct { + ubyte r,g,b,color_num; +} color_record; + +color_record Computed_colors[MAX_COMPUTED_COLORS]; + ubyte gr_palette[256*3]; ubyte gr_current_pal[256*3]; ubyte gr_fade_table[256*34]; @@ -237,6 +250,11 @@ void gr_use_palette_table( char * filename ) gr_fade_table[i*256+255] = 255; } + Num_computed_colors = 0; // Flush palette cache. +#if defined(POLY_ACC) + pa_update_clut(gr_palette, 0, 256, 0); +#endif + // swap colors 0 and 255 of the palette along with fade table entries #ifdef SWAP_0_255 @@ -255,18 +273,6 @@ void gr_use_palette_table( char * filename ) #endif } -#define SQUARE(x) ((x)*(x)) - -#define MAX_COMPUTED_COLORS 32 - -int Num_computed_colors=0; - -typedef struct { - ubyte r,g,b,color_num; -} color_record; - -color_record Computed_colors[MAX_COMPUTED_COLORS]; - // Add a computed color (by gr_find_closest_color) to list of computed colors in Computed_colors. // If list wasn't full already, increment Num_computed_colors. // If was full, replace a random one. diff --git a/main/kludge.c b/main/kludge.c index 6afd03bd..917f409e 100644 --- a/main/kludge.c +++ b/main/kludge.c @@ -2,7 +2,7 @@ #include #include #include -#include + #include "gr.h" #include "pstypes.h" #include "maths.h" -- 2.39.2