mirror of https://github.com/mgba-emu/mgba.git
Implement blending on sprites
This commit is contained in:
parent
07b96cddef
commit
4446e0dbde
|
@ -298,6 +298,13 @@ static void GBAVideoSoftwareRendererWriteBLDCNT(struct GBAVideoSoftwareRenderer*
|
||||||
|
|
||||||
static void _compositeBackground(struct GBAVideoSoftwareRenderer* renderer, int offset, int entry, struct PixelFlags flags) {
|
static void _compositeBackground(struct GBAVideoSoftwareRenderer* renderer, int offset, int entry, struct PixelFlags flags) {
|
||||||
if (renderer->flags[offset].isSprite && flags.priority >= renderer->flags[offset].priority) {
|
if (renderer->flags[offset].isSprite && flags.priority >= renderer->flags[offset].priority) {
|
||||||
|
if (renderer->flags[offset].target1) {
|
||||||
|
if (flags.target2) {
|
||||||
|
renderer->row[offset] = _mix(renderer->bldb, renderer->d.palette[entry], renderer->blda, renderer->row[offset]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
renderer->flags[offset].finalized = 1;
|
||||||
|
renderer->flags[offset].written = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (renderer->blendEffect == BLEND_NONE || (!flags.target1 && !flags.target2)) {
|
if (renderer->blendEffect == BLEND_NONE || (!flags.target1 && !flags.target2)) {
|
||||||
|
@ -310,10 +317,8 @@ static void _compositeBackground(struct GBAVideoSoftwareRenderer* renderer, int
|
||||||
if (renderer->flags[offset].written) {
|
if (renderer->flags[offset].written) {
|
||||||
if (renderer->flags[offset].target1 && flags.target2) {
|
if (renderer->flags[offset].target1 && flags.target2) {
|
||||||
renderer->row[offset] = _mix(renderer->bldb, renderer->d.palette[entry], renderer->blda, renderer->row[offset]);
|
renderer->row[offset] = _mix(renderer->bldb, renderer->d.palette[entry], renderer->blda, renderer->row[offset]);
|
||||||
renderer->flags[offset].finalized = 1;
|
|
||||||
} else {
|
|
||||||
renderer->flags[offset].finalized = 1;
|
|
||||||
}
|
}
|
||||||
|
renderer->flags[offset].finalized = 1;
|
||||||
} else {
|
} else {
|
||||||
renderer->row[offset] = renderer->d.palette[entry];
|
renderer->row[offset] = renderer->d.palette[entry];
|
||||||
renderer->flags[offset].target1 = flags.target1;
|
renderer->flags[offset].target1 = flags.target1;
|
||||||
|
@ -394,8 +399,8 @@ static void _drawSprite(struct GBAVideoSoftwareRenderer* renderer, struct GBAObj
|
||||||
struct PixelFlags flags = {
|
struct PixelFlags flags = {
|
||||||
.priority = sprite->priority,
|
.priority = sprite->priority,
|
||||||
.isSprite = 1,
|
.isSprite = 1,
|
||||||
.target1 = renderer->target1Obj,
|
.target1 = renderer->target1Obj || sprite->mode == OBJ_MODE_SEMITRANSPARENT,
|
||||||
.target2 = renderer->target1Obj || sprite->mode == OBJ_MODE_SEMITRANSPARENT
|
.target2 = renderer->target2Obj
|
||||||
};
|
};
|
||||||
int inX = sprite->x;
|
int inX = sprite->x;
|
||||||
int inY = y - sprite->y;
|
int inY = y - sprite->y;
|
||||||
|
|
Loading…
Reference in New Issue