- 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
This commit is contained in:
Rachael Alexanderson 2017-06-04 14:42:03 -04:00
parent 91680a1e8d
commit 757957bfac

View file

@ -3877,7 +3877,7 @@ bool AActor::IsOkayToAttack (AActor *link)
void AActor::SetShade (uint32_t rgb) void AActor::SetShade (uint32_t rgb)
{ {
PalEntry *entry = (PalEntry *)&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) void AActor::SetShade (int r, int g, int b)
@ -6062,7 +6062,8 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
if (mthing->score) if (mthing->score)
mobj->Score = mthing->score; mobj->Score = mthing->score;
if (mthing->fillcolor) 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 (); mobj->CallBeginPlay ();
if (!(mobj->ObjectFlags & OF_EuthanizeMe)) if (!(mobj->ObjectFlags & OF_EuthanizeMe))