mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
Move g_noFloorPal[] to the engine side and adapt other stuff accordingly.
- 'nofloorpalrange' DEF token: now handled for both game and editor (for the latter, it's effective only for "shade preview" mode, [']+[X]). - in generatefogpals(), assign g_noFloorPal[] = 1 for every generated (default) fog pal; get rid of its return value / g_firstFogPal git-svn-id: https://svn.eduke32.com/eduke32@4811 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
c9943bcde0
commit
70cbde87eb
8 changed files with 38 additions and 55 deletions
|
@ -936,6 +936,8 @@ typedef struct {
|
|||
extern palette_t curpalette[256], curpalettefaded[256], palfadergb;
|
||||
extern char palfadedelta;
|
||||
|
||||
extern int8_t g_noFloorPal[MAXPALOOKUPS];
|
||||
|
||||
extern int32_t novoxmips;
|
||||
|
||||
#ifdef DEBUGGINGAIDS
|
||||
|
@ -1078,7 +1080,7 @@ int32_t initengine(void);
|
|||
void uninitengine(void);
|
||||
void initspritelists(void);
|
||||
int32_t loadlookups(int32_t fp);
|
||||
int32_t generatefogpals(void);
|
||||
void generatefogpals(void);
|
||||
void fillemptylookups(void);
|
||||
int32_t loadboard(const char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum);
|
||||
int32_t loadmaphack(const char *filename);
|
||||
|
|
|
@ -250,7 +250,7 @@ static int32_t defsparser(scriptfile *script)
|
|||
{ "music", T_MUSIC },
|
||||
{ "sound", T_SOUND },
|
||||
{ "animsounds", T_ANIMSOUNDS }, // dummy
|
||||
{ "nofloorpalrange", T_NOFLOORPALRANGE }, // dummy
|
||||
{ "nofloorpalrange", T_NOFLOORPALRANGE },
|
||||
{ "texhitscanrange", T_TEXHITSCANRANGE },
|
||||
{ "nofullbrightrange", T_NOFULLBRIGHTRANGE },
|
||||
// other stuff
|
||||
|
@ -467,6 +467,20 @@ static int32_t defsparser(scriptfile *script)
|
|||
makepalookup(p, NULL, r, g, b, 1);
|
||||
}
|
||||
break;
|
||||
case T_NOFLOORPALRANGE:
|
||||
{
|
||||
int32_t b,e,i;
|
||||
|
||||
if (scriptfile_getnumber(script,&b)) break;
|
||||
if (scriptfile_getnumber(script,&e)) break;
|
||||
|
||||
b = max(b, 1);
|
||||
e = min(e, MAXPALOOKUPS-1);
|
||||
|
||||
for (i=b; i<=e; i++)
|
||||
g_noFloorPal[i] = 1;
|
||||
}
|
||||
break;
|
||||
case T_LOADGRP:
|
||||
{
|
||||
char *bs;
|
||||
|
@ -2050,15 +2064,6 @@ static int32_t defsparser(scriptfile *script)
|
|||
}
|
||||
break;
|
||||
|
||||
case T_NOFLOORPALRANGE:
|
||||
{
|
||||
int32_t b,e;
|
||||
|
||||
if (EDUKE32_PREDICT_FALSE(scriptfile_getnumber(script,&b))) break;
|
||||
if (EDUKE32_PREDICT_FALSE(scriptfile_getnumber(script,&e))) break;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_TEXHITSCANRANGE:
|
||||
case T_NOFULLBRIGHTRANGE:
|
||||
{
|
||||
|
|
|
@ -188,6 +188,11 @@ static intptr_t slopalookup[16384]; // was 2048
|
|||
palette_t palookupfog[MAXPALOOKUPS];
|
||||
#endif
|
||||
|
||||
// For every pal number, whether tsprite pal should not be taken over from
|
||||
// floor pal.
|
||||
// NOTE: g_noFloorPal[0] is irrelevant as it's never checked.
|
||||
int8_t g_noFloorPal[MAXPALOOKUPS];
|
||||
|
||||
static void *pic = NULL;
|
||||
|
||||
// The tile file number (tilesXXX <- this) of each tile:
|
||||
|
@ -8335,15 +8340,11 @@ int32_t loadlookups(int32_t fp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Returns:
|
||||
// - if generated fog shade tables, their first palnum P (fog pals are [P .. P+3])
|
||||
// - if didn't (no room), 0
|
||||
int32_t generatefogpals(void)
|
||||
void generatefogpals(void)
|
||||
{
|
||||
int32_t j, firstfogpal=0;
|
||||
|
||||
// Find a gap of four consecutive unused pal numbers to generate fog shade tables.
|
||||
for (j=1; j<=255-3; j++)
|
||||
// Find a gap of four consecutive unused pal numbers to generate fog shade
|
||||
// tables.
|
||||
for (int32_t j=1; j<=255-3; j++)
|
||||
if (!palookup[j] && !palookup[j+1] && !palookup[j+2] && !palookup[j+3])
|
||||
{
|
||||
makepalookup(j, NULL, 15, 15, 15, 1);
|
||||
|
@ -8351,19 +8352,19 @@ int32_t generatefogpals(void)
|
|||
makepalookup(j+2, NULL, 0, 15, 0, 1);
|
||||
makepalookup(j+3, NULL, 0, 0, 15, 1);
|
||||
|
||||
firstfogpal = j;
|
||||
g_noFloorPal[j] = 1;
|
||||
g_noFloorPal[j+1] = 1;
|
||||
g_noFloorPal[j+2] = 1;
|
||||
g_noFloorPal[j+3] = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return firstfogpal;
|
||||
}
|
||||
|
||||
void fillemptylookups(void)
|
||||
{
|
||||
int32_t j;
|
||||
|
||||
// Alias remaining unused pal numbers to the base shade table.
|
||||
for (j=1; j<MAXPALOOKUPS; j++)
|
||||
for (int32_t j=1; j<MAXPALOOKUPS; j++)
|
||||
if (!palookup[j])
|
||||
makepalookup(j, NULL, 0,0,0, 1);
|
||||
}
|
||||
|
|
|
@ -10284,17 +10284,15 @@ void ExtAnalyzeSprites(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothr
|
|||
*/
|
||||
if (shadepreview)
|
||||
{
|
||||
int32_t wallaligned = (tspr->cstat & 16);
|
||||
int32_t fpal;
|
||||
|
||||
if (tspr->sectnum<0)
|
||||
continue;
|
||||
|
||||
fpal = sector[tspr->sectnum].floorpal;
|
||||
const int32_t wallaligned = (tspr->cstat & 16);
|
||||
const int32_t fpal = sector[tspr->sectnum].floorpal;
|
||||
|
||||
// 1st rule
|
||||
// Compare with game.c:G_MaybeTakeOnFloorPal()
|
||||
if (fpal > 0 && (!g_firstFogPal || !(fpal >= g_firstFogPal && fpal <= g_firstFogPal+3)))
|
||||
if (fpal && !g_noFloorPal[fpal])
|
||||
tspr->pal = fpal;
|
||||
|
||||
// 2nd and 3rd rule minus "actor condition"
|
||||
|
|
|
@ -1037,8 +1037,6 @@ uint8_t *basepaltable[BASEPALCOUNT] = {
|
|||
NULL /*anim_pal*/
|
||||
};
|
||||
|
||||
int32_t g_firstFogPal;
|
||||
|
||||
int32_t G_LoadLookups(void)
|
||||
{
|
||||
int32_t fp, j;
|
||||
|
@ -1073,7 +1071,7 @@ int32_t G_LoadLookups(void)
|
|||
|
||||
kclose(fp);
|
||||
|
||||
g_firstFogPal = generatefogpals();
|
||||
generatefogpals();
|
||||
|
||||
fillemptylookups();
|
||||
|
||||
|
|
|
@ -112,7 +112,6 @@ void G_DoAutoload(const char *dirname);
|
|||
|
||||
extern uint8_t *basepaltable[BASEPALCOUNT];
|
||||
|
||||
extern int32_t g_firstFogPal;
|
||||
extern int32_t G_LoadLookups(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -114,8 +114,6 @@ double g_moveActorsTime = 0; // in ms, smoothed
|
|||
|
||||
char boardfilename[BMAX_PATH] = {0}, currentboardfilename[BMAX_PATH] = {0};
|
||||
|
||||
int8_t g_noFloorPal[MAXPALOOKUPS]; // 1 if sprite pal should not be taken over from floor pal
|
||||
|
||||
int32_t voting = -1;
|
||||
int32_t vote_map = -1, vote_episode = -1;
|
||||
|
||||
|
@ -7033,8 +7031,7 @@ static int32_t G_MaybeTakeOnFloorPal(spritetype *datspr, int32_t sect)
|
|||
{
|
||||
int32_t dapal = sector[sect].floorpal;
|
||||
|
||||
if (dapal && (!g_firstFogPal || !(dapal >= g_firstFogPal && dapal <= g_firstFogPal+3))
|
||||
&& !g_noFloorPal[dapal]
|
||||
if (dapal && !g_noFloorPal[dapal]
|
||||
&& !A_CheckSpriteFlags(datspr->owner,SFLAG_NOPAL))
|
||||
{
|
||||
datspr->pal = dapal;
|
||||
|
@ -9355,7 +9352,6 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
|
|||
#ifdef USE_LIBVPX
|
||||
{ "animsounds", T_ANIMSOUNDS },
|
||||
#endif
|
||||
{ "nofloorpalrange", T_NOFLOORPALRANGE },
|
||||
};
|
||||
|
||||
static const tokenlist sound_musictokens[] =
|
||||
|
@ -9594,20 +9590,6 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
|
|||
}
|
||||
break;
|
||||
#endif // defined USE_LIBVPX
|
||||
case T_NOFLOORPALRANGE:
|
||||
{
|
||||
int32_t b,e,i;
|
||||
|
||||
if (scriptfile_getnumber(script,&b)) break;
|
||||
if (scriptfile_getnumber(script,&e)) break;
|
||||
|
||||
b = max(b, 1);
|
||||
e = min(e, MAXPALOOKUPS-1);
|
||||
|
||||
for (i=b; i<=e; i++)
|
||||
g_noFloorPal[i] = 1;
|
||||
}
|
||||
break;
|
||||
case T_SOUND:
|
||||
{
|
||||
char *tinttokptr = script->ltextptr;
|
||||
|
|
|
@ -304,8 +304,6 @@ extern palette_t DefaultCrosshairColors;
|
|||
|
||||
extern uint32_t g_frameDelay;
|
||||
|
||||
extern int8_t g_noFloorPal[MAXPALOOKUPS];
|
||||
|
||||
extern user_defs ud;
|
||||
|
||||
int32_t A_CheckInventorySprite(spritetype *s);
|
||||
|
|
Loading…
Reference in a new issue