From 757957bfac1577971ce32ba9d20cdea52c07990e Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 4 Jun 2017 14:42:03 -0400 Subject: [PATCH] - prevent SetShaded action function from messing up the RGB-to-PAL conversion with a possible overflow - add RGB-to-PAL support for UDMF fillcolor property --- src/p_mobj.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index fc0abc373e..e36ff15881 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3877,7 +3877,7 @@ bool AActor::IsOkayToAttack (AActor *link) void AActor::SetShade (uint32_t rgb) { PalEntry *entry = (PalEntry *)&rgb; - fillcolor = rgb | (ColorMatcher.Pick (entry->r, entry->g, entry->b) << 24); + fillcolor = (rgb & 0xffffff) | (ColorMatcher.Pick (entry->r, entry->g, entry->b) << 24); } void AActor::SetShade (int r, int g, int b) @@ -6062,7 +6062,8 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) if (mthing->score) mobj->Score = mthing->score; if (mthing->fillcolor) - mobj->fillcolor = mthing->fillcolor; + mobj->fillcolor = (mthing->fillcolor & 0xffffff) | (ColorMatcher.Pick((mthing->fillcolor & 0xff0000) >> 16, + (mthing->fillcolor & 0xff00) >> 8, (mthing->fillcolor & 0xff)) << 24); mobj->CallBeginPlay (); if (!(mobj->ObjectFlags & OF_EuthanizeMe))