splitscreen: tweak base palette application, remove resp. code from splitscr.con.

Basically, base palettes with lower indices trump higher ones.  For example,
when one player is underwater and the other above, the normal palette takes
precedence.

git-svn-id: https://svn.eduke32.com/eduke32@2955 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-08-22 22:49:27 +00:00
parent 96acc3dc52
commit 481a986a30
3 changed files with 18 additions and 19 deletions

View file

@ -11,12 +11,6 @@ Usage: eduke32 splitscr.con -q2
include GAME.CON
// Those are inventory parts
definequote 160 ON
definequote 161 OFF
definequote 162 %
definequote 163 AUTO
// Key name definitions
definegamefuncname 11 P2_Move_Forward
definegamefuncname 12 P2_Move_Backward
@ -373,14 +367,4 @@ onevent EVENT_DISPLAYROOMS
// NOTE: weapons are drawn for both players now (EDuke32 hack)
// Common night vision googles
getplayer[THISACTOR].heat_on p1heat
getplayer[pid].heat_on p2heat
ifvarn p1heat 1
ifvarn p2heat 1
setgamepalette 0
else
setgamepalette 2
endevent

View file

@ -2667,8 +2667,18 @@ void G_DisplayRest(int32_t smoothratio)
if (g_restorePalette < 2 || omovethingscnt+1 == g_moveThingsCount)
{
int32_t pal = pp->palette;
const int32_t opal = pal;
if (pp2) // splitscreen HACK: BASEPAL trumps all, then it's arbitrary.
pal = min(pal, pp2->palette);
// g_restorePalette < 0: reset tinting, too (e.g. when loading new game)
P_SetGamePalette(pp,pp->palette, 2 + (g_restorePalette>0)*16);
P_SetGamePalette(pp, pal, 2 + (g_restorePalette>0)*16);
if (pp2) // keep first player's pal as its member!
pp->palette = opal;
g_restorePalette = 0;
}
else
@ -6734,6 +6744,9 @@ PALONLY:
#ifndef LUNATIC
skip:
#endif
// XXX: currently, for the splitscreen mod, sprites will be pal6-colored iff the first
// player has nightvision on. We should pass stuff like "from which player is this view
// supposed to be" as parameters ("drawing context") instead of relying on globals.
if (g_player[screenpeek].ps->inv_amount[GET_HEATS] > 0 && g_player[screenpeek].ps->heat_on &&
(A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SPRITE_NVG) || s->picnum == APLAYER || s->statnum == STAT_DUMMYPLAYER))
{

View file

@ -54,10 +54,11 @@ void P_PalFrom(DukePlayer_t *p, uint8_t f, uint8_t r, uint8_t g, uint8_t b)
void P_UpdateScreenPal(DukePlayer_t *p)
{
int32_t intowater = 0;
const int32_t sect = p->cursectnum;
if (p->heat_on) p->palette = SLIMEPAL;
else if (p->cursectnum < 0) p->palette = BASEPAL;
else if ((sector[p->cursectnum].ceilingpicnum >= FLOORSLIME)&&(sector[p->cursectnum].ceilingpicnum <=FLOORSLIME+2))
else if (sect < 0) p->palette = BASEPAL;
else if (sector[sect].ceilingpicnum >= FLOORSLIME && sector[sect].ceilingpicnum <= FLOORSLIME+2)
{
p->palette = SLIMEPAL;
intowater = 1;
@ -68,6 +69,7 @@ void P_UpdateScreenPal(DukePlayer_t *p)
else p->palette = BASEPAL;
intowater = 1;
}
g_restorePalette = 1+intowater;
}