[Scummvm-cvs-logs] scummvm master -> 4ced5ccf306450bc4b0bd6afd66b5bc7bec1e814

bluegr md5 at scummvm.org
Thu Jul 5 13:02:43 CEST 2012


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

Summary:
fb215929ef SCI: Some updates to SCI32 kernel graphics functions
4ced5ccf30 SCI: Handle calls from MessageState::outputString() to arrays


Commit: fb215929efaefdf0b75521caab8a86e93181c5b2
    https://github.com/scummvm/scummvm/commit/fb215929efaefdf0b75521caab8a86e93181c5b2
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-07-05T03:58:41-07:00

Commit Message:
SCI: Some updates to SCI32 kernel graphics functions

- Added a stub for kSetScroll, which sets the target picture immediately
for now
- Added an initial stub of kPalCycle (doesn't work correctly yet)
- Adjusted the signatures of kUpdateLine and kDeleteLine for LSL6
- Unmapped kSetHotRectangles again, with updated information on how it
is used in Phantasmagoria

Changed paths:
    engines/sci/engine/kernel.h
    engines/sci/engine/kernel_tables.h
    engines/sci/engine/kgraphics32.cpp
    engines/sci/engine/state.cpp
    engines/sci/engine/state.h
    engines/sci/graphics/frameout.cpp



diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index c3fcdd0..441ea26 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -436,6 +436,8 @@ reg_t kObjectIntersect(EngineState *s, int argc, reg_t *argv);
 reg_t kEditText(EngineState *s, int argc, reg_t *argv);
 reg_t kMakeSaveCatName(EngineState *s, int argc, reg_t *argv);
 reg_t kMakeSaveFileName(EngineState *s, int argc, reg_t *argv);
+reg_t kSetScroll(EngineState *s, int argc, reg_t *argv);
+reg_t kPalCycle(EngineState *s, int argc, reg_t *argv);
 
 // SCI2.1 Kernel Functions
 reg_t kText(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index c4443c9..825ec90 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -517,10 +517,8 @@ static SciKernelMapEntry s_kernelMap[] = {
 	{ MAP_CALL(EditText),          SIG_EVERYWHERE,           "o",                     NULL,            NULL },
 	{ MAP_CALL(MakeSaveCatName),   SIG_EVERYWHERE,           "rr",                    NULL,            NULL },
 	{ MAP_CALL(MakeSaveFileName),  SIG_EVERYWHERE,           "rri",                   NULL,            NULL },
-
-	// SCI2 unmapped functions - TODO!
-
-	// PalCycle - called by Game::newRoom. Related to RemapColors.
+	{ MAP_CALL(SetScroll),         SIG_EVERYWHERE,           "oiiiii(i)",             NULL,            NULL },
+	{ MAP_CALL(PalCycle),          SIG_EVERYWHERE,           "i(.*)",                 NULL,            NULL },
 
 	// SCI2 Empty functions
 	
@@ -587,8 +585,8 @@ static SciKernelMapEntry s_kernelMap[] = {
 	{ MAP_CALL(Font),              SIG_EVERYWHERE,           "i(.*)",                 NULL,            NULL },
 	{ MAP_CALL(Bitmap),            SIG_EVERYWHERE,           "(.*)",                  NULL,            NULL },
 	{ MAP_CALL(AddLine),           SIG_EVERYWHERE,           "oiiiiiiiii",            NULL,            NULL },
-	{ MAP_CALL(UpdateLine),        SIG_EVERYWHERE,           "roiiiiiiiii",           NULL,            NULL },
-	{ MAP_CALL(DeleteLine),        SIG_EVERYWHERE,           "ro",                    NULL,            NULL },
+	{ MAP_CALL(UpdateLine),        SIG_EVERYWHERE,           "[r0]oiiiiiiiii",        NULL,            NULL },
+	{ MAP_CALL(DeleteLine),        SIG_EVERYWHERE,           "[r0]o",                 NULL,            NULL },
 
 	// SCI2.1 Empty Functions
 
@@ -624,8 +622,6 @@ static SciKernelMapEntry s_kernelMap[] = {
 	{ MAP_DUMMY(WinDLL),            SIG_EVERYWHERE,           "(.*)",                 NULL,            NULL },
 	{ MAP_DUMMY(DeletePic),         SIG_EVERYWHERE,           "(.*)",                 NULL,            NULL },
 	{ MAP_DUMMY(GetSierraProfileString), SIG_EVERYWHERE,      "(.*)",                 NULL,            NULL },
-	// SetHotRectangles is used by Phantasmagoria 1, script 64981 (a debug script)
-	{ MAP_DUMMY(SetHotRectangles),  SIG_EVERYWHERE,           "(.*)",                  NULL,            NULL },
 
 	// Unused / debug functions in the in-between SCI2.1 interpreters
 	{ MAP_DUMMY(PreloadResource),   SIG_EVERYWHERE,           "(.*)",                 NULL,            NULL },
@@ -635,6 +631,10 @@ static SciKernelMapEntry s_kernelMap[] = {
 
 	// SCI2.1 unmapped functions - TODO!
 
+	// SetHotRectangles - used by Phantasmagoria 1, script 64981 (used in the chase scene)
+	//     <lskovlun> The idea, if I understand correctly, is that the engine generates events
+	//     of a special HotRect type continuously when the mouse is on that rectangle
+
 	// MovePlaneItems - used by SQ6 to scroll through the inventory via the up/down buttons
 	// SetPalStyleRange - 2 integer parameters, start and end. All styles from start-end
 	//   (inclusive) are set to 0
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
index 072d4df..16e54a5 100644
--- a/engines/sci/engine/kgraphics32.cpp
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -637,6 +637,96 @@ reg_t kDeleteLine(EngineState *s, int argc, reg_t *argv) {
 	return s->r_acc;
 }
 
+reg_t kSetScroll(EngineState *s, int argc, reg_t *argv) {
+	// Called in the intro of LSL6 hires (room 110)
+	// The end effect of this is the same as the old screen scroll transition
+
+	// 7 parameters
+	reg_t planeObject = argv[0];
+	//int16 x = argv[1].toSint16();
+	//int16 y = argv[2].toSint16();
+	uint16 pictureId = argv[3].toUint16();
+	// param 4: int (0 in LSL6, probably scroll direction? The picture in LSL6 scrolls down)
+	// param 5: int (first call is 1, then the subsequent one is 0 in LSL6)
+	// param 6: optional int (0 in LSL6)
+
+	// Set the new picture directly for now
+	//writeSelectorValue(s->_segMan, planeObject, SELECTOR(left), x);
+	//writeSelectorValue(s->_segMan, planeObject, SELECTOR(top), y);
+	writeSelectorValue(s->_segMan, planeObject, SELECTOR(picture), pictureId);
+	// and update our draw list
+	g_sci->_gfxFrameout->kernelUpdatePlane(planeObject);
+
+	// TODO
+	return kStub(s, argc, argv);
+}
+
+reg_t kPalCycle(EngineState *s, int argc, reg_t *argv) {
+	// Examples: GK1 room 480 (Bayou ritual), LSL6 room 100 (title screen)
+
+	switch (argv[0].toUint16()) {
+	case 0: {	// Palette animation initialization
+		// 3 or 4 extra params
+		// Case 1 sends fromColor and speed again, so we don't need them here.
+		// Only toColor is stored
+		//uint16 fromColor = argv[1].toUint16();
+		s->_palCycleToColor = argv[2].toUint16();
+		//uint16 speed = argv[3].toUint16();
+
+		// Invalidate the picture, so that the palette steps calls (case 1
+		// below) can update its palette without it being overwritten by the
+		// view/picture palettes.
+		g_sci->_gfxScreen->_picNotValid = 1;
+
+		// TODO: The fourth optional parameter is an unknown integer, and is 0 by default
+		if (argc == 5) {
+			// When this variant is used, picNotValid doesn't seem to be set
+			// (e.g. GK1 room 480). In this case, the animation step calls are
+			// not made, so perhaps this signifies the palette cycling steps
+			// to make.
+			// GK1 sets this to 6 (6 palette steps?)
+			g_sci->_gfxScreen->_picNotValid = 0;
+		}
+		kStub(s, argc, argv);
+		}
+		break;
+	case 1:	{ // Palette animation step
+		// This is the same as the old kPaletteAnimate call, with 1 set of colors.
+		// The end color is set up during initialization in case 0 above.
+
+		// 1 or 2 extra params
+		uint16 fromColor = argv[1].toUint16();
+		uint16 speed = (argc == 2) ? 1 : argv[2].toUint16();
+		// TODO: For some reason, this doesn't set the color correctly
+		// (e.g. LSL6 intro, room 100, Sierra logo)
+		if (g_sci->_gfxPalette->kernelAnimate(fromColor, s->_palCycleToColor, speed))
+			g_sci->_gfxPalette->kernelAnimateSet();
+		}
+		// No kStub() call here, as this gets called loads of times, like kPaletteAnimate
+		break;
+	// case 2 hasn't been encountered
+	// case 3 hasn't been encountered
+	case 4:	// reset any palette cycling and make the picture valid again
+		// Gets called when changing rooms and after palette cycling animations finish
+		// 0 or 1 extra params
+		if (argc == 1) {
+			g_sci->_gfxScreen->_picNotValid = 0;
+			// TODO: This also seems to perform more steps
+		} else {
+			// The variant with the 1 extra param resets remapping to base
+			// TODO
+		}
+		kStub(s, argc, argv);
+		break;
+	default:
+		// TODO
+		kStub(s, argc, argv);
+		break;
+	}
+
+	return s->r_acc;
+}
+
 #endif
 
 } // End of namespace Sci
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 94a3fe3..0f0c8dc 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -122,8 +122,11 @@ void EngineState::reset(bool isRestoring) {
 
 	_videoState.reset();
 	_syncedAudioOptions = false;
+
 	_vmdPalStart = 0;
 	_vmdPalEnd = 256;
+
+	_palCycleToColor = 255;
 }
 
 void EngineState::speedThrottler(uint32 neededSleep) {
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index 9ae6299..8109087 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -199,6 +199,8 @@ public:
 	uint16 _vmdPalStart, _vmdPalEnd;
 	bool _syncedAudioOptions;
 
+	uint16 _palCycleToColor;
+
 	/**
 	 * Resets the engine state.
 	 */
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 5b857fe..31ad7a5 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -294,6 +294,10 @@ reg_t GfxFrameout::addPlaneLine(reg_t object, Common::Point startPoint, Common::
 }
 
 void GfxFrameout::updatePlaneLine(reg_t object, reg_t hunkId, Common::Point startPoint, Common::Point endPoint, byte color, byte priority, byte control) {
+	// Check if we're asked to update a line that was never added
+	if (object.isNull())
+		return;
+
 	for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); ++it) {
 		if (it->object == object) {
 			for (PlaneLineList::iterator it2 = it->lines.begin(); it2 != it->lines.end(); ++it2) {
@@ -311,6 +315,10 @@ void GfxFrameout::updatePlaneLine(reg_t object, reg_t hunkId, Common::Point star
 }
 
 void GfxFrameout::deletePlaneLine(reg_t object, reg_t hunkId) {
+	// Check if we're asked to delete a line that was never added (happens during the intro of LSL6)
+	if (object.isNull())
+		return;
+
 	for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); ++it) {
 		if (it->object == object) {
 			for (PlaneLineList::iterator it2 = it->lines.begin(); it2 != it->lines.end(); ++it2) {


Commit: 4ced5ccf306450bc4b0bd6afd66b5bc7bec1e814
    https://github.com/scummvm/scummvm/commit/4ced5ccf306450bc4b0bd6afd66b5bc7bec1e814
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-07-05T03:58:43-07:00

Commit Message:
SCI: Handle calls from MessageState::outputString() to arrays

This happens during the intro of LSL6 hires (room 110)

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



diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp
index cddd01e..a92d572 100644
--- a/engines/sci/engine/message.cpp
+++ b/engines/sci/engine/message.cpp
@@ -400,11 +400,21 @@ Common::String MessageState::processString(const char *s) {
 void MessageState::outputString(reg_t buf, const Common::String &str) {
 #ifdef ENABLE_SCI32
 	if (getSciVersion() >= SCI_VERSION_2) {
-		SciString *sciString = _segMan->lookupString(buf);
-		sciString->setSize(str.size() + 1);
-		for (uint32 i = 0; i < str.size(); i++)
-			sciString->setValue(i, str.c_str()[i]);
-		sciString->setValue(str.size(), 0);
+		if (_segMan->getSegmentType(buf.getSegment()) == SEG_TYPE_STRING) {
+			SciString *sciString = _segMan->lookupString(buf);
+			sciString->setSize(str.size() + 1);
+			for (uint32 i = 0; i < str.size(); i++)
+				sciString->setValue(i, str.c_str()[i]);
+			sciString->setValue(str.size(), 0);
+		} else if (_segMan->getSegmentType(buf.getSegment()) == SEG_TYPE_ARRAY) {
+			// Happens in the intro of LSL6, we are asked to write the string
+			// into an array
+			SciArray<reg_t> *sciString = _segMan->lookupArray(buf);
+			sciString->setSize(str.size() + 1);
+			for (uint32 i = 0; i < str.size(); i++)
+				sciString->setValue(i, make_reg(0, str.c_str()[i]));
+			sciString->setValue(str.size(), NULL_REG);
+		}
 	} else {
 #endif
 		SegmentRef buffer_r = _segMan->dereference(buf);






More information about the Scummvm-git-logs mailing list