[Scummvm-cvs-logs] scummvm master -> 7d6d8c247592e959a0caba4127a13f0bc140e2ee

bluegr md5 at scummvm.org
Thu Oct 13 13:15:43 CEST 2011


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e7260d992c SCI: Updated a comment inside processPlaySound()
8d4e562555 SCI: Implemented kBitmap(3) and kBitmap(5). Some cleanup
7d6d8c2475 SCI: Extended the detection of certain selectors to work in SCI2


Commit: e7260d992c9f57c0a620fbfbfefb22d282163e6a
    https://github.com/scummvm/scummvm/commit/e7260d992c9f57c0a620fbfbfefb22d282163e6a
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-10-13T04:03:57-07:00

Commit Message:
SCI: Updated a comment inside processPlaySound()

Changed paths:
    engines/sci/sound/soundcmd.cpp



diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index 6391985..699a89d 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -146,9 +146,9 @@ void SoundCommandParser::processPlaySound(reg_t obj) {
 	MusicEntry *musicSlot = _music->getSlot(obj);
 	if (!musicSlot) {
 		warning("kDoSound(play): Slot not found (%04x:%04x), initializing it manually", PRINT_REG(obj));
-		// The sound hasn't been initialized for some reason, so initialize it here.
-		// Happens in KQ6, room 460, when giving the creature to the bookwork (the
-		// bookworm's child). Fixes bug #3413301.
+		// The sound hasn't been initialized for some reason, so initialize it
+		// here. Happens in KQ6, room 460, when giving the creature (child) to
+		// the bookworm. Fixes bugs #3413301 and #3421098.
 		processInitSound(obj);
 		musicSlot = _music->getSlot(obj);
 		if (!musicSlot)


Commit: 8d4e562555a5bc0bc5f9aea8ee2bbcb4f14dc18f
    https://github.com/scummvm/scummvm/commit/8d4e562555a5bc0bc5f9aea8ee2bbcb4f14dc18f
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-10-13T04:03:57-07:00

Commit Message:
SCI: Implemented kBitmap(3) and kBitmap(5). Some cleanup

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 ce670b2..5ea5132 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -1648,12 +1648,18 @@ reg_t kBitmap(EngineState *s, int argc, reg_t *argv) {
 		// script 64890 and TransView::init() in script 64884
 		uint16 width = argv[1].toUint16();
 		uint16 height = argv[2].toUint16();
-		uint16 skip = argv[3].toUint16();
+		//uint16 skip = argv[3].toUint16();
 		uint16 back = argv[4].toUint16();
-		uint16 width2 = (argc >= 6) ? argv[5].toUint16() : 0;
-		uint16 height2 = (argc >= 7) ? argv[6].toUint16() : 0;
-		uint16 transparentFlag = (argc >= 8) ? argv[7].toUint16() : 0;
-		return g_sci->_gfxText32->createTextBitmapSci21(width, height, skip, back, width2, height2, transparentFlag);
+		//uint16 width2 = (argc >= 6) ? argv[5].toUint16() : 0;
+		//uint16 height2 = (argc >= 7) ? argv[6].toUint16() : 0;
+		//uint16 transparentFlag = (argc >= 8) ? argv[7].toUint16() : 0;
+
+		// TODO: skip, width2, height2, transparentFlag
+		int entrySize = width * height;
+		reg_t memoryId = s->_segMan->allocateHunkEntry("TextBitmap()", entrySize);
+		byte *memoryPtr = s->_segMan->getHunkPointer(memoryId);
+		memset(memoryPtr, back, entrySize);
+		return memoryId;
 		}
 		break;
 	case 1:	// dispose text bitmap surface
@@ -1667,16 +1673,29 @@ reg_t kBitmap(EngineState *s, int argc, reg_t *argv) {
 		{
 		// 6 params, called e.g. from TiledBitmap::resize() in Torin's Passage,
 		// script 64869
-		reg_t bitmapPtr = argv[1];	// obtained from kBitmap(0)
+		reg_t hunkId = argv[1];	// obtained from kBitmap(0)
 		// The tiled view seems to always have 2 loops.
 		// These loops need to have 1 cel in loop 0 and 8 cels in loop 1.
-		uint16 view = argv[2].toUint16();	// vTiles selector
+		uint16 viewNum = argv[2].toUint16();	// vTiles selector
 		uint16 loop = argv[3].toUint16();
 		uint16 cel = argv[4].toUint16();
 		uint16 x = argv[5].toUint16();
 		uint16 y = argv[6].toUint16();
-		warning("kBitmap(3): bitmap ptr %04x:%04x, view %d, loop %d, cel %d, x %d, y %d",
-				PRINT_REG(bitmapPtr), view, loop, cel, x, y);
+
+		byte *bitmap = s->_segMan->getHunkPointer(hunkId);
+
+		GfxView *view = g_sci->_gfxCache->getView(viewNum);
+		uint16 width = view->getWidth(loop, cel);
+		uint16 height = view->getHeight(loop, cel);
+		const byte *viewBitmap = view->getBitmap(loop, cel);
+		uint32 curPixel = 0;
+
+		for (uint16 curY = y; curY < y + height; curY++) {
+			for (uint16 curX = x; curX < x + width; curX++) {
+				bitmap[curY + curX] = viewBitmap[curPixel++];
+			}
+		}
+
 		}
 		break;
 	case 4:	// process text
@@ -1699,18 +1718,25 @@ reg_t kBitmap(EngineState *s, int argc, reg_t *argv) {
 				PRINT_REG(bitmapPtr), font, mode, dimmed, text.c_str());
 		}
 		break;
-	case 5:
+	case 5:	// fill with color
 		{
 		// 6 params, called e.g. from TextView::init() and TextView::draw()
 		// in Torin's Passage, script 64890
-		reg_t bitmapPtr = argv[1];	// obtained from kBitmap(0)
-		uint16 unk1 = argv[2].toUint16();	// unknown, usually 0, judging from scripts?
-		uint16 unk2 = argv[3].toUint16();	// unknown, usually 0, judging from scripts?
+		reg_t hunkId = argv[1];	// obtained from kBitmap(0)
+		uint16 x = argv[2].toUint16();
+		uint16 y = argv[3].toUint16();
 		uint16 width = argv[4].toUint16();	// width - 1
 		uint16 height = argv[5].toUint16();	// height - 1
 		uint16 back = argv[6].toUint16();
-		warning("kBitmap(5): bitmap ptr %04x:%04x, unk1 %d, unk2 %d, width %d, height %d, back %d",
-				PRINT_REG(bitmapPtr), unk1, unk2, width, height, back);
+
+		byte *bitmap = s->_segMan->getHunkPointer(hunkId);
+
+		for (uint16 curY = y; curY < y + height; curY++) {
+			for (uint16 curX = x; curX < x + width; curX++) {
+				bitmap[curY + curX] = back;
+			}
+		}
+
 		}
 		break;
 	default:
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index 85ede02..52124fd 100644
--- a/engines/sci/graphics/text32.cpp
+++ b/engines/sci/graphics/text32.cpp
@@ -100,15 +100,6 @@ 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);
 }
diff --git a/engines/sci/graphics/text32.h b/engines/sci/graphics/text32.h
index 43395f6..5a06995 100644
--- a/engines/sci/graphics/text32.h
+++ b/engines/sci/graphics/text32.h
@@ -26,8 +26,6 @@
 #ifndef SCI_GRAPHICS_TEXT32_H
 #define SCI_GRAPHICS_TEXT32_H
 
-#include "common/hashmap.h"
-
 namespace Sci {
 
 /**
@@ -38,7 +36,6 @@ 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);


Commit: 7d6d8c247592e959a0caba4127a13f0bc140e2ee
    https://github.com/scummvm/scummvm/commit/7d6d8c247592e959a0caba4127a13f0bc140e2ee
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-10-13T04:03:58-07:00

Commit Message:
SCI: Extended the detection of certain selectors to work in SCI2

This is needed for some demos that do not supply a selector vocabulary
(i.e. vocab 997)

Changed paths:
    engines/sci/engine/static_selectors.cpp



diff --git a/engines/sci/engine/static_selectors.cpp b/engines/sci/engine/static_selectors.cpp
index 8f33377..74d2851 100644
--- a/engines/sci/engine/static_selectors.cpp
+++ b/engines/sci/engine/static_selectors.cpp
@@ -192,9 +192,6 @@ Common::StringArray Kernel::checkStaticSelectorNames() {
 			for (int i = count + countSci1; i < count + countSci1 + countSci11; i++)
 				names[i] = sci11Selectors[i - count - countSci1];
 		}
-
-		findSpecificSelectors(names);
-
 #ifdef ENABLE_SCI32
 	} else {
 		// SCI2+
@@ -203,6 +200,8 @@ Common::StringArray Kernel::checkStaticSelectorNames() {
 #endif
 	}
 
+	findSpecificSelectors(names);
+
 	for (const SelectorRemap *selectorRemap = sciSelectorRemap; selectorRemap->slot; ++selectorRemap) {
 		if (getSciVersion() >= selectorRemap->minVersion && getSciVersion() <= selectorRemap->maxVersion) {
 			const uint32 slot = selectorRemap->slot;
@@ -223,13 +222,16 @@ void Kernel::findSpecificSelectors(Common::StringArray &selectorNames) {
 	// We need to initialize script 0 here, to make sure that it's always
 	// located at segment 1.
 	_segMan->instantiateScript(0);
+	uint16 sci2Offset = (getSciVersion() >= SCI_VERSION_2) ? 64000 : 0;
 
 	// The Actor class contains the init, xLast and yLast selectors, which
 	// we reference directly. It's always in script 998, so we need to
 	// explicitly load it here.
 	if ((getSciVersion() >= SCI_VERSION_1_EGA_ONLY)) {
-		if (_resMan->testResource(ResourceId(kResourceTypeScript, 998))) {
-			_segMan->instantiateScript(998);
+		uint16 actorScript = 998;
+
+		if (_resMan->testResource(ResourceId(kResourceTypeScript, actorScript + sci2Offset))) {
+			_segMan->instantiateScript(actorScript + sci2Offset);
 
 			const Object *actorClass = _segMan->getObject(_segMan->findObjectByName("Actor"));
 
@@ -237,9 +239,10 @@ void Kernel::findSpecificSelectors(Common::StringArray &selectorNames) {
 				// Find the xLast and yLast selectors, used in kDoBresen
 
 				const int offset = (getSciVersion() < SCI_VERSION_1_1) ? 3 : 0;
+				const int offset2 = (getSciVersion() >= SCI_VERSION_2) ? 12 : 0;
 				// xLast and yLast always come between illegalBits and xStep
-				int illegalBitsSelectorPos = actorClass->locateVarSelector(_segMan, 15 + offset);	// illegalBits
-				int xStepSelectorPos = actorClass->locateVarSelector(_segMan, 51 + offset);	// xStep
+				int illegalBitsSelectorPos = actorClass->locateVarSelector(_segMan, 15 + offset + offset2);	// illegalBits
+				int xStepSelectorPos = actorClass->locateVarSelector(_segMan, 51 + offset + offset2);	// xStep
 				if (xStepSelectorPos - illegalBitsSelectorPos != 3) {
 					error("illegalBits and xStep selectors aren't found in "
 							"known locations. illegalBits = %d, xStep = %d",
@@ -263,10 +266,10 @@ void Kernel::findSpecificSelectors(Common::StringArray &selectorNames) {
 	// Find selectors from specific classes
 
 	for (int i = 0; i < ARRAYSIZE(classReferences); i++) {
-		if (!_resMan->testResource(ResourceId(kResourceTypeScript, classReferences[i].script)))
+		if (!_resMan->testResource(ResourceId(kResourceTypeScript, classReferences[i].script + sci2Offset)))
 			continue;
 
-		_segMan->instantiateScript(classReferences[i].script);
+		_segMan->instantiateScript(classReferences[i].script + sci2Offset);
 
 		const Object *targetClass = _segMan->getObject(_segMan->findObjectByName(classReferences[i].className));
 		int targetSelectorPos = 0;






More information about the Scummvm-git-logs mailing list