New game def token "nofloorpal <pbeg> <pend>", disabling sprites taking on floor pals.

It has always annoyed me how floors with "shirt-color" type palookups like 21
affected the color of its containing sprites and HUD-drawn stuff.  This commit
allows one to specify an inclusive range of pals for which this should be
disabled for sprites (but not for HUD stuff, yet).

git-svn-id: https://svn.eduke32.com/eduke32@2517 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-03-22 22:47:29 +00:00
parent 85ab7d2e39
commit 5944a9ab0f

View file

@ -108,6 +108,8 @@ uint8_t water_pal[768],slime_pal[768],title_pal[768],dre_alms[768],ending_pal[76
uint8_t *basepaltable[BASEPALCOUNT] = { palette, water_pal, slime_pal, dre_alms, title_pal, ending_pal, NULL /*anim_pal*/ }; uint8_t *basepaltable[BASEPALCOUNT] = { palette, water_pal, slime_pal, dre_alms, title_pal, ending_pal, NULL /*anim_pal*/ };
static int8_t g_noFloorPal[MAXPALOOKUPS]; // 1 if sprite pal should not be taken over from floor pal
static int32_t g_skipDefaultCons = 0; static int32_t g_skipDefaultCons = 0;
static int32_t g_skipDefaultDefs = 0; // primarily for NAM/WWII GI appeasement static int32_t g_skipDefaultDefs = 0; // primarily for NAM/WWII GI appeasement
@ -230,6 +232,7 @@ enum gametokens
T_SOUND, T_SOUND,
T_FILE, T_FILE,
T_ANIMSOUNDS, T_ANIMSOUNDS,
T_NOFLOORPALRANGE,
T_ID T_ID
}; };
@ -5876,6 +5879,20 @@ SPAWN_END:
return i; return i;
} }
static int32_t maybe_take_on_pal_of_floor(spritetype *datspr, int32_t sect)
{
int32_t dapal = sector[sect].floorpal;
if (dapal && !g_noFloorPal[dapal] && dapal < g_numRealPalettes
&& !A_CheckSpriteFlags(datspr->owner,SPRITE_NOPAL))
{
datspr->pal = dapal;
return 1;
}
return 0;
}
#if 0 // def _MSC_VER #if 0 // def _MSC_VER
// Visual C thought this was a bit too hard to optimise so we'd better // Visual C thought this was a bit too hard to optimise so we'd better
// tell it not to try... such a pussy it is. // tell it not to try... such a pussy it is.
@ -6430,9 +6447,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
t->pal = g_player[p].ps->palookup; t->pal = g_player[p].ps->palookup;
} }
PALONLY: PALONLY:
maybe_take_on_pal_of_floor(t, sect);
if (sector[sect].floorpal && sector[sect].floorpal < g_numRealPalettes && !A_CheckSpriteFlags(t->owner,SPRITE_NOPAL))
t->pal = sector[sect].floorpal;
if (s->owner == -1) continue; if (s->owner == -1) continue;
@ -6472,8 +6487,7 @@ PALONLY:
else t->picnum += T1; else t->picnum += T1;
t->shade -= 6; t->shade -= 6;
if (sector[sect].floorpal && sector[sect].floorpal < g_numRealPalettes && !A_CheckSpriteFlags(t->owner,SPRITE_NOPAL)) maybe_take_on_pal_of_floor(t, sect);
t->pal = sector[sect].floorpal;
break; break;
case WATERBUBBLE__STATIC: case WATERBUBBLE__STATIC:
@ -6483,8 +6497,7 @@ PALONLY:
break; break;
} }
default: default:
if (sector[sect].floorpal && sector[sect].floorpal < g_numRealPalettes && !A_CheckSpriteFlags(t->owner,SPRITE_NOPAL)) maybe_take_on_pal_of_floor(t, sect);
t->pal = sector[sect].floorpal;
break; break;
} }
@ -6744,9 +6757,8 @@ skip:
t->picnum = actor[i].t_data[1]; t->picnum = actor[i].t_data[1];
else t->picnum = actor[s->owner].dispicnum; else t->picnum = actor[s->owner].dispicnum;
if (sector[t->sectnum].floorpal && sector[t->sectnum].floorpal < g_numRealPalettes && !A_CheckSpriteFlags(s->owner,SPRITE_NOPAL)) if (!maybe_take_on_pal_of_floor(t, sect))
t->pal = sector[t->sectnum].floorpal; t->pal = sprite[s->owner].pal;
else t->pal = sprite[s->owner].pal;
t->shade = sprite[s->owner].shade; t->shade = sprite[s->owner].shade;
t->ang = sprite[s->owner].ang; t->ang = sprite[s->owner].ang;
@ -8217,6 +8229,7 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
#ifdef USE_LIBVPX #ifdef USE_LIBVPX
{ "animsounds", T_ANIMSOUNDS }, { "animsounds", T_ANIMSOUNDS },
#endif #endif
{ "nofloorpalrange", T_NOFLOORPALRANGE },
}; };
static const tokenlist sound_musictokens[] = static const tokenlist sound_musictokens[] =
@ -8459,7 +8472,20 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
} }
break; break;
#endif // defined USE_LIBVPX #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);
for (i=b; i<=e; i++)
g_noFloorPal[i] = 1;
}
break;
case T_SOUND: case T_SOUND:
{ {
char *tinttokptr = script->ltextptr; char *tinttokptr = script->ltextptr;