[Scummvm-cvs-logs] SF.net SVN: scummvm: [31736] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat Apr 26 23:52:16 CEST 2008


Revision: 31736
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31736&view=rev
Author:   lordhoto
Date:     2008-04-26 14:52:15 -0700 (Sat, 26 Apr 2008)

Log Message:
-----------
- Implemented support for jesters staff, mood change and score displaying
- Fixed bug in KyraEngine_v3::loadMalcolmShapes

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui_v3.cpp
    scummvm/trunk/engines/kyra/kyra_v3.cpp
    scummvm/trunk/engines/kyra/kyra_v3.h
    scummvm/trunk/engines/kyra/staticres.cpp
    scummvm/trunk/engines/kyra/text_v3.cpp

Modified: scummvm/trunk/engines/kyra/gui_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_v3.cpp	2008-04-26 21:08:47 UTC (rev 31735)
+++ scummvm/trunk/engines/kyra/gui_v3.cpp	2008-04-26 21:52:15 UTC (rev 31736)
@@ -276,7 +276,7 @@
 
 void KyraEngine_v3::drawMalcolmsMoodPointer(int frame, int page) {
 	debugC(9, kDebugLevelMain, "KyraEngine_v3::drawMalcolmsMoodPointer(%d, %d)", frame, page);
-	static const int stateTable[] = {
+	static const uint8 stateTable[] = {
 		1, 6, 11
 	};
 
@@ -452,7 +452,7 @@
 	} else if (_itemInHand == 27) {
 		if (_chatText)
 			return 0;
-		//XXX
+		return buttonJesterStaff(&_mainButtonData[3]);
 	} else {
 		if (slotItem >= 0) {
 			if (itemInventoryMagic(_itemInHand, slot))
@@ -483,6 +483,127 @@
 	return 0;
 }
 
+int KyraEngine_v3::buttonMoodChange(Button *button) {
+	if (queryGameFlag(0x219)) {
+		playSoundEffect(0x0D, 0xC8);
+		return 0;
+	}
+
+	static const uint8 frameTable[] = { 1, 6, 11 };
+
+	if (_mouseX >= 245 && _mouseX <= 267 && _mouseY >= 159 && _mouseY <= 198)
+		_malcolmsMood = 0;
+	else if (_mouseX >= 268 && _mouseX <= 289 && _mouseY >= 159 && _mouseY <= 198)
+		_malcolmsMood = 1;
+	else if (_mouseX >= 290 && _mouseX <= 312 && _mouseY >= 159 && _mouseY <= 198)
+		_malcolmsMood = 2;
+
+	int direction = (_invWsaFrame > frameTable[_malcolmsMood]) ? -1 : 1;
+
+	if (_invWsaFrame != frameTable[_malcolmsMood]) {
+		_screen->hideMouse();
+		setGameFlag(3);
+
+		playSoundEffect(0x2E, 0xC8);
+
+		while (_invWsaFrame != frameTable[_malcolmsMood]) {
+			uint32 endTime = _system->getMillis() + 2 * _tickLength;
+			_invWsaFrame += direction;
+
+			drawMalcolmsMoodPointer(_invWsaFrame, 0);
+			_screen->updateScreen();
+
+			while (endTime > _system->getMillis()) {
+				update();
+				_system->delayMillis(10);
+			}
+		}
+
+		resetGameFlag(3);
+		_screen->showMouse();
+
+		drawMalcolmsMoodText();
+		updateDlgIndex();
+		
+		ScriptData data;
+		ScriptState state;
+		memset(&data, 0, sizeof(data));
+		memset(&state, 0, sizeof(state));
+
+		_res->exists("_ACTOR.EMC", true);
+		_scriptInterpreter->loadScript("_ACTOR.EMC", &data, &_opcodes);
+		_scriptInterpreter->initScript(&state, &data);
+		_scriptInterpreter->startScript(&state, 1);
+
+		int vocHigh = _vocHigh;
+		_vocHigh = 200;
+		_useActorBuffer = true;
+
+		while (_scriptInterpreter->validScript(&state))
+			_scriptInterpreter->runScript(&state);
+
+		_useActorBuffer = false;
+		_vocHigh = vocHigh;
+		_scriptInterpreter->unloadScript(&data);
+	}
+
+	return 0;
+}
+
+int KyraEngine_v3::buttonShowScore(Button *button) {
+	strcpy(_stringBuffer, (const char*)getTableEntry(_cCodeFile, 18));
+
+	char *buffer = _stringBuffer;
+
+	while (*buffer != '%')
+		++buffer;
+
+	buffer[0] = (_score / 100) + '0';
+	buffer[1] = ((_score % 100) / 10) + '0';
+	buffer[2] = (_score % 10) + '0';
+
+	while (*buffer != '%')
+		++buffer;
+
+	buffer[0] = (_scoreMax / 100) + '0';
+	buffer[1] = ((_scoreMax % 100) / 10) + '0';
+	buffer[2] = (_scoreMax % 10) + '0';
+
+	showMessage(_stringBuffer, 0xFF, 0xF0);
+	return 0;
+}
+
+int KyraEngine_v3::buttonJesterStaff(Button *button) {
+	makeCharFacingMouse();
+	if (_itemInHand == 27) {
+		_screen->hideMouse();
+		removeHandItem();
+		playSoundEffect(0x0C, 0xC8);
+		drawJestersStaff(1, 0);
+		updateItemCommand(27, 2, 0xFF);
+		setGameFlag(0x97);
+		_screen->showMouse();
+	} else if (_itemInHand == -1) {
+		if (queryGameFlag(0x97)) {
+			_screen->hideMouse();
+			playSoundEffect(0x0B, 0xC8);
+			setHandItem(27);
+			drawJestersStaff(0, 0);
+			updateItemCommand(27, 0, 0xFF);
+			resetGameFlag(0x97);
+			_screen->showMouse();
+		} else {
+			if (queryGameFlag(0x2F))
+				objectChat((const char*)getTableEntry(_cCodeFile, 20), 0, 204, 20);
+			else
+				objectChat((const char*)getTableEntry(_cCodeFile, 25), 0, 204, 25);
+		}
+	} else {
+		objectChat((const char*)getTableEntry(_cCodeFile, 30), 0, 204, 30);
+	}
+	return 0;
+}
+
 #pragma mark -
 
 GUI_v3::GUI_v3(KyraEngine_v3 *vm) : GUI(vm), _vm(vm), _screen(vm->_screen) {

Modified: scummvm/trunk/engines/kyra/kyra_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v3.cpp	2008-04-26 21:08:47 UTC (rev 31735)
+++ scummvm/trunk/engines/kyra/kyra_v3.cpp	2008-04-26 21:52:15 UTC (rev 31736)
@@ -809,7 +809,7 @@
 		filename[numberOffset[i]+1] = lowNum;
 		_res->exists(filename, true);
 		_res->loadFileToBuf(filename, _screenBuffer, 64000);
-		for (int j = startShape[i]; j < endShape[i]; ++j) {
+		for (int j = startShape[i]; j <= endShape[i]; ++j) {
 			if (j == 87)
 				continue;
 			addShapeToPool(_screenBuffer, j, j-startShape[i]);

Modified: scummvm/trunk/engines/kyra/kyra_v3.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v3.h	2008-04-26 21:08:47 UTC (rev 31735)
+++ scummvm/trunk/engines/kyra/kyra_v3.h	2008-04-26 21:52:15 UTC (rev 31736)
@@ -157,6 +157,9 @@
 
 	bool _enableInventory;
 	int buttonInventory(Button *button);
+	int buttonMoodChange(Button *button);
+	int buttonShowScore(Button *button);
+	int buttonJesterStaff(Button *button);
 
 	// -> main menu
 	void initMainMenu();

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2008-04-26 21:08:47 UTC (rev 31735)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2008-04-26 21:52:15 UTC (rev 31736)
@@ -2439,8 +2439,11 @@
 
 		GUI_V3_BUTTON(_mainButtonData[0], 1, 0, 0, 4, 4, 4, 0x4487, 0,   5, 162, 50, 25, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0);
 		GUI_V3_BUTTON(_mainButtonData[1], 2, 0, 0, 1, 1, 1, 0x4487, 0, 245, 156, 69, 33, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0);
+		_mainButtonData[1].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v3, this, &KyraEngine_v3::buttonMoodChange);
 		GUI_V3_BUTTON(_mainButtonData[2], 3, 0, 0, 1, 1, 1, 0x4487, 0, 215, 191, 24,  9, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0);
+		_mainButtonData[2].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v3, this, &KyraEngine_v3::buttonShowScore);
 		GUI_V3_BUTTON(_mainButtonData[3], 4, 0, 0, 1, 1, 1, 0x4487, 0, 215, 155, 25, 36, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0);
+		_mainButtonData[3].buttonCallback = BUTTON_FUNCTOR(KyraEngine_v3, this, &KyraEngine_v3::buttonJesterStaff);
 
 		Button::Callback buttonInventoryFunctor = BUTTON_FUNCTOR(KyraEngine_v3, this, &KyraEngine_v3::buttonInventory);
 		for (int i = 0; i < 5; ++i) {

Modified: scummvm/trunk/engines/kyra/text_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/text_v3.cpp	2008-04-26 21:08:47 UTC (rev 31735)
+++ scummvm/trunk/engines/kyra/text_v3.cpp	2008-04-26 21:52:15 UTC (rev 31736)
@@ -223,7 +223,7 @@
 
 	static const char *talkFilenameTable[] = {
 		"MTFL00S.EMC", "MTFL00Q.EMC", "MTFL00E.EMC", "MTFL00T.EMC",
-		"MTFR00S.EMC", "MTFR00Q.EMC", "MTFR00E.EMC", "MTRF00T.EMC",
+		"MTFR00S.EMC", "MTFR00Q.EMC", "MTFR00E.EMC", "MTFR00T.EMC",
 		 "MTL00S.EMC",  "MTL00Q.EMC",  "MTL00E.EMC",  "MTL00T.EMC",
 		 "MTR00S.EMC",  "MTR00Q.EMC",  "MTR00E.EMC",  "MTR00T.EMC",
 		 "MTA00S.EMC",  "MTA00Q.EMC",  "MTA00Q.EMC",  "MTA00T.EMC"


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list