[Scummvm-git-logs] scummvm master -> 7643cccc54816eedb44bd97720c8dbd4c01b4f2f
sluicebox
noreply at scummvm.org
Fri May 2 00:18:01 UTC 2025
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
265c703013 SCI: Fix EGA picture default palette
7643cccc54 SCI: Implement vector picture wrap-around behavior
Commit: 265c703013c52b831c84837aece8cefd6669bd1c
https://github.com/scummvm/scummvm/commit/265c703013c52b831c84837aece8cefd6669bd1c
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-05-01T17:12:14-07:00
Commit Message:
SCI: Fix EGA picture default palette
Color 33 is a dither of blue and light blue, but they were swapped.
This first occurred in SCI Decoder in 1992.
Fixes the robot skull in SQ3 picture 5
Changed paths:
engines/sci/graphics/picture.cpp
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index 6fff73ec271..e686ad54530 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -407,7 +407,7 @@ static const byte vector_defaultEGApalette[PIC_EGAPALETTE_SIZE] = {
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0x88,
0x88, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x88,
0x88, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
- 0x08, 0x91, 0x2a, 0x3b, 0x4c, 0x5d, 0x6e, 0x88
+ 0x08, 0x19, 0x2a, 0x3b, 0x4c, 0x5d, 0x6e, 0x88
};
static const byte vector_defaultEGApriority[PIC_EGAPRIORITY_SIZE] = {
Commit: 7643cccc54816eedb44bd97720c8dbd4c01b4f2f
https://github.com/scummvm/scummvm/commit/7643cccc54816eedb44bd97720c8dbd4c01b4f2f
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-05-01T17:12:33-07:00
Commit Message:
SCI: Implement vector picture wrap-around behavior
Changed paths:
engines/sci/graphics/picture.cpp
engines/sci/graphics/picture.h
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index e686ad54530..cc1571b4af0 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -1050,34 +1050,57 @@ static const byte vectorPatternTextureOffset[128] = {
};
void GfxPicture::vectorPatternBox(Common::Rect box, Common::Rect clipBox, byte color, byte prio, byte control) {
- byte flag = _screen->getDrawingMask(color, prio, control);
+ byte drawMask = _screen->getDrawingMask(color, prio, control);
- box.clip(clipBox);
for (int y = box.top; y < box.bottom; y++) {
for (int x = box.left; x < box.right; x++) {
- _screen->vectorPutPixel(x, y, flag, color, prio, control);
+ vectorPatternBoxPixel(x, y, clipBox, drawMask, color, prio, control);
}
}
}
void GfxPicture::vectorPatternTexturedBox(Common::Rect box, Common::Rect clipBox, byte color, byte prio, byte control, byte texture) {
- byte flag = _screen->getDrawingMask(color, prio, control);
+ byte drawMask = _screen->getDrawingMask(color, prio, control);
const bool *textureData = &vectorPatternTextures[vectorPatternTextureOffset[texture]];
for (int y = box.top; y < box.bottom; y++) {
for (int x = box.left; x < box.right; x++) {
if (*textureData) {
- if (clipBox.contains(x, y)) {
- _screen->vectorPutPixel(x, y, flag, color, prio, control);
- }
+ vectorPatternBoxPixel(x, y, clipBox, drawMask, color, prio, control);
}
textureData++;
}
}
}
+/**
+ * Draw a rectangle pattern pixel. Includes wrap-around behavior from the original.
+ * Patterns can be placed at the right edge of the picture with their last column
+ * going beyond the edge. These pixels wrap around to the next row with the opposite
+ * dither color than what would normally be drawn at that coordinate. This does
+ * not apply to circles because their last column only contains transparent pixels.
+ */
+void GfxPicture::vectorPatternBoxPixel(int16 x, int16 y, Common::Rect clipBox, byte drawMask, byte color, byte prio, byte control) {
+ if (!(clipBox.left <= x && clipBox.top <= y && y < clipBox.bottom)) {
+ return;
+ }
+
+ if (x < clipBox.right) {
+ // draw pixel normally if x is within bounds
+ _screen->vectorPutPixel(x, y, drawMask, color, prio, control);
+ } else if (y < clipBox.bottom - 1) {
+ // wrap pixel around to next row with opposite dither color
+ if (color & 0xf0) {
+ color ^= (color << 4); // decode
+ color = (color << 4) | (color >> 4); // swap
+ color ^= (color << 4); // re-encode
+ }
+ _screen->vectorPutPixel(0, y + 1, drawMask, color, prio, control);
+ }
+}
+
void GfxPicture::vectorPatternCircle(Common::Rect box, Common::Rect clipBox, byte size, byte color, byte prio, byte control) {
- byte flag = _screen->getDrawingMask(color, prio, control);
+ byte drawMask = _screen->getDrawingMask(color, prio, control);
assert(size < ARRAYSIZE(vectorPatternCircles));
const byte *circleData = vectorPatternCircles[size];
byte bitmap = *circleData;
@@ -1092,7 +1115,7 @@ void GfxPicture::vectorPatternCircle(Common::Rect box, Common::Rect clipBox, byt
}
if (bitmap & 1) {
if (clipBox.contains(x, y)) {
- _screen->vectorPutPixel(x, y, flag, color, prio, control);
+ _screen->vectorPutPixel(x, y, drawMask, color, prio, control);
}
}
bitNo++;
@@ -1102,7 +1125,7 @@ void GfxPicture::vectorPatternCircle(Common::Rect box, Common::Rect clipBox, byt
}
void GfxPicture::vectorPatternTexturedCircle(Common::Rect box, Common::Rect clipBox, byte size, byte color, byte prio, byte control, byte texture) {
- byte flag = _screen->getDrawingMask(color, prio, control);
+ byte drawMask = _screen->getDrawingMask(color, prio, control);
assert(size < ARRAYSIZE(vectorPatternCircles));
const byte *circleData = vectorPatternCircles[size];
byte bitmap = *circleData;
@@ -1119,7 +1142,7 @@ void GfxPicture::vectorPatternTexturedCircle(Common::Rect box, Common::Rect clip
if (bitmap & 1) {
if (*textureData) {
if (clipBox.contains(x, y)) {
- _screen->vectorPutPixel(x, y, flag, color, prio, control);
+ _screen->vectorPutPixel(x, y, drawMask, color, prio, control);
}
}
textureData++;
diff --git a/engines/sci/graphics/picture.h b/engines/sci/graphics/picture.h
index 0e6ec962fe1..9c75997b91a 100644
--- a/engines/sci/graphics/picture.h
+++ b/engines/sci/graphics/picture.h
@@ -72,6 +72,7 @@ private:
void vectorPattern(int16 x, int16 y, byte pic_color, byte pic_priority, byte pic_control, byte code, byte texture);
void vectorPatternBox(Common::Rect box, Common::Rect clipBox, byte color, byte prio, byte control);
void vectorPatternTexturedBox(Common::Rect box, Common::Rect clipBox, byte color, byte prio, byte control, byte texture);
+ void vectorPatternBoxPixel(int16 x, int16 y, Common::Rect clipBox, byte drawMask, byte color, byte prio, byte control);
void vectorPatternCircle(Common::Rect box, Common::Rect clipBox, byte size, byte color, byte prio, byte control);
void vectorPatternTexturedCircle(Common::Rect box, Common::Rect clipBox, byte size, byte color, byte prio, byte control, byte texture);
More information about the Scummvm-git-logs
mailing list