diff --git a/polymer/eduke32/samples/splitscr.con b/polymer/eduke32/samples/splitscr.con index b6b4947ec..e444e101c 100644 --- a/polymer/eduke32/samples/splitscr.con +++ b/polymer/eduke32/samples/splitscr.con @@ -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 diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index a727fb2d8..d89d94ee0 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -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)) { diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index e7c528d22..b25390a64 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -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; }