mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 03:00:38 +00:00
Move PaletteIndexFullbrights back into the engine and autodetect fullbrights instead of hardcoding them.
git-svn-id: https://svn.eduke32.com/eduke32@5373 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
ac6cd00f7c
commit
f232b2fa51
7 changed files with 29 additions and 10 deletions
|
@ -85,8 +85,6 @@ enum rendmode_t {
|
||||||
#define MAXSPRITESONSCREEN 4096
|
#define MAXSPRITESONSCREEN 4096
|
||||||
#define MAXUNIQHUDID 256 //Extra slots so HUD models can store animation state without messing game sprites
|
#define MAXUNIQHUDID 256 //Extra slots so HUD models can store animation state without messing game sprites
|
||||||
|
|
||||||
extern uint32_t PaletteIndexFullbrights[8];
|
|
||||||
|
|
||||||
#define RESERVEDPALS 4 // don't forget to increment this when adding reserved pals
|
#define RESERVEDPALS 4 // don't forget to increment this when adding reserved pals
|
||||||
#define DETAILPAL (MAXPALOOKUPS - 1)
|
#define DETAILPAL (MAXPALOOKUPS - 1)
|
||||||
#define GLOWPAL (MAXPALOOKUPS - 2)
|
#define GLOWPAL (MAXPALOOKUPS - 2)
|
||||||
|
|
|
@ -8408,6 +8408,8 @@ static void loadpalette(void)
|
||||||
kclose(fil);
|
kclose(fil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t PaletteIndexFullbrights[8];
|
||||||
|
|
||||||
static void E_PostLoadPalette(void)
|
static void E_PostLoadPalette(void)
|
||||||
{
|
{
|
||||||
globalpal = 0;
|
globalpal = 0;
|
||||||
|
@ -8433,6 +8435,27 @@ static void E_PostLoadPalette(void)
|
||||||
j = palette[i*3] + palette[i*3+1] + palette[i*3+2];
|
j = palette[i*3] + palette[i*3+1] + palette[i*3+2];
|
||||||
if (j < k) { k = j; blackcol = i; }
|
if (j < k) { k = j; blackcol = i; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bmemset(PaletteIndexFullbrights, 0, sizeof(PaletteIndexFullbrights));
|
||||||
|
for (int c = 0; c < 255; ++c) // skipping transparent color
|
||||||
|
{
|
||||||
|
char const * const thispalookup = palookup[0];
|
||||||
|
char const color = thispalookup[c];
|
||||||
|
|
||||||
|
if (EDUKE32_PREDICT_FALSE(palette[color*3] == 0 &&
|
||||||
|
palette[color*3+1] == 0 &&
|
||||||
|
palette[color*3+2] == 0))
|
||||||
|
continue; // don't consider #000000 fullbright
|
||||||
|
|
||||||
|
for (int s = c + 256; s < 256*32; s += 256)
|
||||||
|
if (EDUKE32_PREDICT_FALSE(thispalookup[s] != color))
|
||||||
|
goto PostLoad_NotFullbright;
|
||||||
|
|
||||||
|
SetPaletteIndexFullbright(c);
|
||||||
|
|
||||||
|
PostLoad_NotFullbright:
|
||||||
|
continue; // should be optimized out
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_ReplaceTransparentColorWithBlack(void)
|
void E_ReplaceTransparentColorWithBlack(void)
|
||||||
|
|
|
@ -81,6 +81,10 @@ void calc_and_apply_fog(int32_t tile, int32_t shade, int32_t vis, int32_t pal);
|
||||||
void calc_and_apply_fog_factor(int32_t tile, int32_t shade, int32_t vis, int32_t pal, float factor);
|
void calc_and_apply_fog_factor(int32_t tile, int32_t shade, int32_t vis, int32_t pal, float factor);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern uint32_t PaletteIndexFullbrights[8];
|
||||||
|
#define IsPaletteIndexFullbright(col) (PaletteIndexFullbrights[(col)>>5] & (1u<<((col)&31)))
|
||||||
|
#define SetPaletteIndexFullbright(col) (PaletteIndexFullbrights[(col)>>5] |= (1u<<((col)&31)))
|
||||||
|
|
||||||
// int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dastat);
|
// int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dastat);
|
||||||
int32_t wallfront(int32_t l1, int32_t l2);
|
int32_t wallfront(int32_t l1, int32_t l2);
|
||||||
|
|
||||||
|
|
|
@ -843,7 +843,7 @@ void gloadtile_art(int32_t dapic, int32_t dapal, int32_t tintpalnum, int32_t das
|
||||||
if (!fullbrightloadingpass)
|
if (!fullbrightloadingpass)
|
||||||
{
|
{
|
||||||
// regular texture
|
// regular texture
|
||||||
if ((PaletteIndexFullbrights[dacol>>5] & (1<<(dacol&31))) && dofullbright)
|
if (IsPaletteIndexFullbright(dacol) && dofullbright)
|
||||||
hasfullbright = 1;
|
hasfullbright = 1;
|
||||||
|
|
||||||
wpptr->a = 255;
|
wpptr->a = 255;
|
||||||
|
@ -851,7 +851,7 @@ void gloadtile_art(int32_t dapic, int32_t dapal, int32_t tintpalnum, int32_t das
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// texture with only fullbright areas
|
// texture with only fullbright areas
|
||||||
if (!(PaletteIndexFullbrights[dacol>>5] & (1<<(dacol&31)))) // regular colors
|
if (!IsPaletteIndexFullbright(dacol)) // regular colors
|
||||||
{
|
{
|
||||||
wpptr->a = 0;
|
wpptr->a = 0;
|
||||||
hasalpha = 1;
|
hasalpha = 1;
|
||||||
|
|
|
@ -997,8 +997,6 @@ void G_DoAutoload(const char *dirname)
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
|
|
||||||
uint32_t PaletteIndexFullbrights[8] = { 0, 0, 0, 0, 0, 0, 0, 2147418112 };
|
|
||||||
|
|
||||||
void G_LoadLookups(void)
|
void G_LoadLookups(void)
|
||||||
{
|
{
|
||||||
int32_t fp, j;
|
int32_t fp, j;
|
||||||
|
|
|
@ -29,8 +29,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
||||||
#include "pal.h"
|
#include "pal.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
|
||||||
uint32_t PaletteIndexFullbrights[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
||||||
|
|
||||||
short f_c = 3;
|
short f_c = 3;
|
||||||
static unsigned char tempbuf[256];
|
static unsigned char tempbuf[256];
|
||||||
unsigned char DefaultPalette[256 * 32];
|
unsigned char DefaultPalette[256 * 32];
|
||||||
|
|
|
@ -26,8 +26,6 @@ const char *G_DefFile(void)
|
||||||
return defaultdeffilename;
|
return defaultdeffilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t PaletteIndexFullbrights[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
||||||
|
|
||||||
void Ken_InitMultiPsky(void)
|
void Ken_InitMultiPsky(void)
|
||||||
{
|
{
|
||||||
// default
|
// default
|
||||||
|
|
Loading…
Reference in a new issue