Do not apply zero floorpal on color sectors

This commit is contained in:
nukeykt 2019-10-15 23:13:54 +09:00 committed by Christoph Oelckers
parent a94404232b
commit 37322d001d

View file

@ -2148,6 +2148,16 @@ uspritetype *viewAddEffect(int nTSprite, VIEW_EFFECT nViewEffect)
LOCATION gPrevSpriteLoc[kMaxSprites]; LOCATION gPrevSpriteLoc[kMaxSprites];
static void viewApplyDefaultPal(uspritetype *pTSprite, sectortype const *pSector)
{
int const nXSector = pSector->extra;
XSECTOR const *pXSector = nXSector >= 0 ? &xsector[nXSector] : NULL;
if (pXSector && pXSector->color && (VanillaMode() || pSector->floorpal != 0))
{
pTSprite->pal = pSector->floorpal;
}
}
void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t smooth) void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t smooth)
{ {
UNREFERENCED_PARAMETER(cA); UNREFERENCED_PARAMETER(cA);
@ -2375,7 +2385,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
} }
break; break;
default: default:
if (pXSector && pXSector->color) pTSprite->pal = pSector->floorpal; viewApplyDefaultPal(pTSprite, pSector);
break; break;
} }
} }
@ -2405,10 +2415,8 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
default: default:
if (pTSprite->type >= kItemKeySkull && pTSprite->type < kItemKeyMax) if (pTSprite->type >= kItemKeySkull && pTSprite->type < kItemKeyMax)
pTSprite->shade = -128; pTSprite->shade = -128;
if (pXSector && pXSector->color) { viewApplyDefaultPal(pTSprite, pSector);
pTSprite->pal = pSector->floorpal;
}
break; break;
} }
} }
@ -2464,10 +2472,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
break; break;
} }
} }
if (pXSector && pXSector->color) viewApplyDefaultPal(pTSprite, pSector);
{
pTSprite->pal = pSector->floorpal;
}
if (powerupCheck(gView, 25) > 0) if (powerupCheck(gView, 25) > 0)
{ {
pTSprite->shade = -128; pTSprite->shade = -128;
@ -2555,8 +2560,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
break; break;
} }
case kStatThing: { case kStatThing: {
if (pXSector && pXSector->color) viewApplyDefaultPal(pTSprite, pSector);
pTSprite->pal = pSector->floorpal;
if (pTSprite->type < kThingBase || pTSprite->type >= kThingMax || !gSpriteHit[nXSprite].florhit) { if (pTSprite->type < kThingBase || pTSprite->type >= kThingMax || !gSpriteHit[nXSprite].florhit) {
if ((pTSprite->flags & kPhysMove) && getflorzofslope(pTSprite->sectnum, pTSprite->x, pTSprite->y) >= cZ) if ((pTSprite->flags & kPhysMove) && getflorzofslope(pTSprite->sectnum, pTSprite->x, pTSprite->y) >= cZ)