2018-11-05 07:28:01 +00:00
|
|
|
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
|
|
|
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
|
|
|
// See the included license file "BUILDLIC.TXT" for license info.
|
|
|
|
//
|
|
|
|
// This file has been modified from Ken Silverman's original release
|
|
|
|
// by Jonathon Fowler (jf@jonof.id.au)
|
|
|
|
// by the EDuke32 team (development@voidpoint.com)
|
|
|
|
|
2016-06-21 00:33:06 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifndef palette_h_
|
|
|
|
#define palette_h_
|
|
|
|
|
2019-03-01 08:51:50 +00:00
|
|
|
#include "cache1d.h"
|
|
|
|
#include "vfs.h"
|
|
|
|
|
2016-06-21 00:33:06 +00:00
|
|
|
#define MAXBASEPALS 256
|
|
|
|
#define MAXPALOOKUPS 256
|
|
|
|
#define MAXBLENDTABS 256
|
|
|
|
|
|
|
|
#define RESERVEDPALS 4 // don't forget to increment this when adding reserved pals
|
|
|
|
#define DETAILPAL (MAXPALOOKUPS - 1)
|
|
|
|
#define GLOWPAL (MAXPALOOKUPS - 2)
|
|
|
|
#define SPECULARPAL (MAXPALOOKUPS - 3)
|
|
|
|
#define NORMALPAL (MAXPALOOKUPS - 4)
|
|
|
|
|
|
|
|
extern uint8_t curbasepal;
|
|
|
|
|
|
|
|
#ifdef LUNATIC
|
2018-04-12 21:03:12 +00:00
|
|
|
extern const char *(paletteGetBlendTable) (int32_t blend);
|
2016-06-21 00:33:06 +00:00
|
|
|
#else
|
2018-04-12 21:03:12 +00:00
|
|
|
#define paletteGetBlendTable(blend) (blendtable[blend])
|
2016-06-21 00:33:06 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
extern uint32_t PaletteIndexFullbrights[8];
|
|
|
|
#define IsPaletteIndexFullbright(col) (PaletteIndexFullbrights[(col)>>5] & (1u<<((col)&31)))
|
|
|
|
#define SetPaletteIndexFullbright(col) (PaletteIndexFullbrights[(col)>>5] |= (1u<<((col)&31)))
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
char r, g, b, f;
|
|
|
|
} palette_t;
|
2017-11-29 07:29:27 +00:00
|
|
|
typedef struct {
|
|
|
|
uint8_t r, g, b;
|
|
|
|
} rgb24_t;
|
2016-06-21 00:33:06 +00:00
|
|
|
extern palette_t curpalette[256], curpalettefaded[256], palfadergb;
|
2018-04-12 21:02:31 +00:00
|
|
|
|
2016-06-21 00:33:06 +00:00
|
|
|
extern char palfadedelta;
|
2018-04-12 21:02:31 +00:00
|
|
|
extern void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f);
|
2019-09-19 20:02:45 +00:00
|
|
|
extern void fullscreen_tint_gl_blood(void);
|
2018-04-12 21:03:12 +00:00
|
|
|
extern void videoFadeToBlack(int32_t moreopaquep);
|
|
|
|
void paletteMakeLookupTable(int32_t palnum, const char *remapbuf, uint8_t r, uint8_t g, uint8_t b, char noFloorPal);
|
|
|
|
void paletteSetColorTable(int32_t id, uint8_t const *table);
|
|
|
|
void paletteFreeColorTable(int32_t id);
|
|
|
|
void paletteSetBlendTable(int32_t blend, const char *tab);
|
|
|
|
void paletteFreeBlendTable(int32_t blend);
|
|
|
|
int32_t paletteSetLookupTable(int32_t palnum, const uint8_t *shtab);
|
|
|
|
void paletteFreeLookupTable(int32_t palnum);
|
|
|
|
void videoSetPalette(char dabrightness, uint8_t dapalid, uint8_t flags);
|
|
|
|
void videoFadePalette(uint8_t r, uint8_t g, uint8_t b, uint8_t offset);
|
2019-09-19 20:02:45 +00:00
|
|
|
#ifdef USE_OPENGL
|
|
|
|
void videoTintBlood(int32_t r, int32_t g, int32_t b);
|
|
|
|
#endif
|
2016-06-21 00:33:06 +00:00
|
|
|
|
2017-11-29 07:29:30 +00:00
|
|
|
extern int32_t realmaxshade;
|
|
|
|
extern float frealmaxshade;
|
|
|
|
|
2018-10-16 06:09:09 +00:00
|
|
|
extern int32_t globalpal;
|
2016-06-21 00:33:06 +00:00
|
|
|
extern int32_t globalblend;
|
|
|
|
extern uint32_t g_lastpalettesum;
|
2018-04-12 21:03:12 +00:00
|
|
|
extern palette_t paletteGetColor(int32_t col);
|
|
|
|
extern void paletteLoadFromDisk(void);
|
|
|
|
extern void palettePostLoadTables(void);
|
2016-06-21 00:33:06 +00:00
|
|
|
extern void setup_blend(int32_t blend, int32_t doreverse);
|
|
|
|
extern uint8_t basepalreset;
|
|
|
|
extern int32_t curbrightness, gammabrightness;
|
|
|
|
|
2019-03-01 08:51:50 +00:00
|
|
|
extern int32_t paletteLoadLookupTable(buildvfs_kfd fp);
|
2018-04-12 21:03:12 +00:00
|
|
|
extern void paletteSetupDefaultFog(void);
|
|
|
|
extern void palettePostLoadLookups(void);
|
|
|
|
extern void paletteFixTranslucencyMask(void);
|
2016-06-21 00:33:06 +00:00
|
|
|
|
|
|
|
extern int8_t g_noFloorPal[MAXPALOOKUPS];
|
|
|
|
|
|
|
|
extern char britable[16][256];
|
|
|
|
|
|
|
|
#ifdef USE_OPENGL
|
|
|
|
extern palette_t palookupfog[MAXPALOOKUPS];
|
|
|
|
|
|
|
|
static inline void bricolor(palette_t *wpptr, int32_t dacol)
|
|
|
|
{
|
|
|
|
if (gammabrightness)
|
|
|
|
{
|
|
|
|
wpptr->r = curpalette[dacol].r;
|
|
|
|
wpptr->g = curpalette[dacol].g;
|
|
|
|
wpptr->b = curpalette[dacol].b;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wpptr->r = britable[curbrightness][curpalette[dacol].r];
|
|
|
|
wpptr->g = britable[curbrightness][curpalette[dacol].g];
|
|
|
|
wpptr->b = britable[curbrightness][curpalette[dacol].b];
|
|
|
|
}
|
|
|
|
}
|
2016-10-09 07:55:23 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
BLENDFACTOR_ZERO = 0,
|
|
|
|
BLENDFACTOR_ONE,
|
|
|
|
BLENDFACTOR_SRC_COLOR,
|
|
|
|
BLENDFACTOR_ONE_MINUS_SRC_COLOR,
|
|
|
|
BLENDFACTOR_SRC_ALPHA,
|
|
|
|
BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
|
|
|
|
BLENDFACTOR_DST_ALPHA,
|
|
|
|
BLENDFACTOR_ONE_MINUS_DST_ALPHA,
|
|
|
|
BLENDFACTOR_DST_COLOR,
|
|
|
|
BLENDFACTOR_ONE_MINUS_DST_COLOR,
|
|
|
|
NUMBLENDFACTORS,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct glblenddef_
|
|
|
|
{
|
|
|
|
float alpha;
|
|
|
|
uint8_t src, dst, flags;
|
|
|
|
} glblenddef_t;
|
|
|
|
|
|
|
|
typedef struct glblend_
|
|
|
|
{
|
|
|
|
glblenddef_t def[2];
|
|
|
|
} glblend_t;
|
|
|
|
|
|
|
|
extern glblend_t const nullglblend, defaultglblend;
|
|
|
|
extern glblend_t glblend[MAXBLENDTABS];
|
|
|
|
|
|
|
|
extern void handle_blend(uint8_t enable, uint8_t blend, uint8_t def);
|
2016-06-21 00:33:06 +00:00
|
|
|
#endif
|
|
|
|
|
2016-12-26 06:02:01 +00:00
|
|
|
#endif
|