[Scummvm-cvs-logs] scummvm master -> a9c6d2a4c4e80708d63dbbd7dc2c0419258d6d19
bluegr
md5 at scummvm.org
Tue Oct 11 01:41:27 CEST 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a9c6d2a4c4 SCI: Some work on the SCI32 bitmap / font code
Commit: a9c6d2a4c4e80708d63dbbd7dc2c0419258d6d19
https://github.com/scummvm/scummvm/commit/a9c6d2a4c4e80708d63dbbd7dc2c0419258d6d19
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-10-10T16:33:45-07:00
Commit Message:
SCI: Some work on the SCI32 bitmap / font code
- Initial implementation of kBitmap(0)
- Bugfixes for fonts in upscaled games
Changed paths:
engines/sci/engine/kgraphics.cpp
engines/sci/graphics/text32.cpp
engines/sci/graphics/text32.h
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index be86cb5..5c33db0 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -1637,10 +1637,8 @@ reg_t kBitmap(EngineState *s, int argc, reg_t *argv) {
uint16 back = argv[4].toUint16();
uint16 width2 = (argc >= 6) ? argv[5].toUint16() : 0;
uint16 height2 = (argc >= 7) ? argv[6].toUint16() : 0;
- uint16 transparent = (argc >= 8) ? argv[7].toUint16() : 0;
- warning("kBitmap(0): width %d, height %d, skip %d, back %d, width2 %d, height2 %d, transparent %d",
- width, height, skip, back, width2, height2, transparent);
- return NULL_REG; // TODO: return a hunk handle for the new bitmap surface
+ uint16 transparentFlag = (argc >= 8) ? argv[7].toUint16() : 0;
+ return g_sci->_gfxText32->createTextBitmapSci21(width, height, skip, back, width2, height2, transparentFlag);
}
break;
case 1: // dispose text bitmap surface
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index d906d56..1939bae 100644
--- a/engines/sci/graphics/text32.cpp
+++ b/engines/sci/graphics/text32.cpp
@@ -100,6 +100,15 @@ reg_t GfxText32::createTextBitmap(reg_t textObject, uint16 maxWidth, uint16 maxH
return memoryId;
}
+reg_t GfxText32::createTextBitmapSci21(uint16 width, uint16 height, byte skip, byte back, uint16 width2, uint16 height2, byte transparentFlag) {
+ // TODO: skip, width2, height2, transparentFlag
+ int entrySize = width * height;
+ reg_t memoryId = _segMan->allocateHunkEntry("TextBitmap()", entrySize);
+ byte *memoryPtr = _segMan->getHunkPointer(memoryId);
+ memset(memoryPtr, back, entrySize);
+ return memoryId;
+}
+
void GfxText32::disposeTextBitmap(reg_t hunkId) {
_segMan->freeHunkEntry(hunkId);
}
@@ -119,11 +128,17 @@ void GfxText32::drawTextBitmap(reg_t textObject) {
uint16 width = nsRect.width();
uint16 height = nsRect.height();
+ // Upscale the coordinates/width if the fonts are already upscaled
+ if (_screen->fontIsUpscaled()) {
+ textX = textX * _screen->getDisplayWidth() / _screen->getWidth();
+ textY = textY * _screen->getDisplayHeight() / _screen->getHeight();
+ }
+
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
byte pixel = surface[curByte++];
if (pixel)
- _screen->putPixel(x + textX, y + textY, 1, pixel, 0, 0);
+ _screen->putFontPixel(textY, x + textX, y, pixel);
}
}
}
diff --git a/engines/sci/graphics/text32.h b/engines/sci/graphics/text32.h
index 4c1e53d..43395f6 100644
--- a/engines/sci/graphics/text32.h
+++ b/engines/sci/graphics/text32.h
@@ -38,6 +38,7 @@ public:
GfxText32(SegManager *segMan, GfxCache *fonts, GfxScreen *screen);
~GfxText32();
reg_t createTextBitmap(reg_t textObject, uint16 maxWidth = 0, uint16 maxHeight = 0);
+ reg_t createTextBitmapSci21(uint16 width, uint16 height, byte skip, byte back, uint16 width2, uint16 height2, byte transparentFlag);
void disposeTextBitmap(reg_t hunkId);
void drawTextBitmap(reg_t textObject);
int16 GetLongest(const char *text, int16 maxWidth, GfxFont *font);
More information about the Scummvm-git-logs
mailing list