Hack to guess when blending should be disabled

This commit is contained in:
Jeffrey Pfau 2013-11-01 23:39:26 -07:00
parent a87d30ed9f
commit e0eefa24da
1 changed files with 10 additions and 2 deletions

View File

@ -1267,7 +1267,11 @@ static int _preprocessSprite(struct GBAVideoSoftwareRenderer* renderer, struct G
flags |= FLAG_OBJWIN * (sprite->mode == OBJ_MODE_OBJWIN); flags |= FLAG_OBJWIN * (sprite->mode == OBJ_MODE_OBJWIN);
int x = sprite->x; int x = sprite->x;
unsigned charBase = BASE_TILE + sprite->tile * 0x20; unsigned charBase = BASE_TILE + sprite->tile * 0x20;
int variant = renderer->target1Obj && renderer->currentWindow.blendEnable && sprite->mode != OBJ_MODE_SEMITRANSPARENT && (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN); int variant = renderer->target1Obj && renderer->currentWindow.blendEnable && (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN);
if (sprite->mode == OBJ_MODE_SEMITRANSPARENT && renderer->target2Bd) {
// Hack: if a sprite is blended, then the variant palette is not used, but we don't know if it's blended in advance
variant = 0;
}
color_t* palette = renderer->normalPalette; color_t* palette = renderer->normalPalette;
if (variant) { if (variant) {
palette = renderer->variantPalette; palette = renderer->variantPalette;
@ -1335,7 +1339,11 @@ static int _preprocessTransformedSprite(struct GBAVideoSoftwareRenderer* rendere
int x = sprite->x; int x = sprite->x;
unsigned charBase = BASE_TILE + sprite->tile * 0x20; unsigned charBase = BASE_TILE + sprite->tile * 0x20;
struct GBAOAMMatrix* mat = &renderer->d.oam->mat[sprite->matIndex]; struct GBAOAMMatrix* mat = &renderer->d.oam->mat[sprite->matIndex];
int variant = renderer->target1Obj && renderer->currentWindow.blendEnable && sprite->mode != OBJ_MODE_SEMITRANSPARENT && (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN); int variant = renderer->target1Obj && renderer->currentWindow.blendEnable && (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN);
if (sprite->mode == OBJ_MODE_SEMITRANSPARENT && renderer->target2Bd) {
// Hack: if a sprite is blended, then the variant palette is not used, but we don't know if it's blended in advance
variant = 0;
}
color_t* palette = renderer->normalPalette; color_t* palette = renderer->normalPalette;
if (variant) { if (variant) {
palette = renderer->variantPalette; palette = renderer->variantPalette;