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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Mar 18 16:50:43 CET 2008


Revision: 31182
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31182&view=rev
Author:   lordhoto
Date:     2008-03-18 08:50:43 -0700 (Tue, 18 Mar 2008)

Log Message:
-----------
- Implemented opcodes:
  -> 21: o2_backUpScreen
  -> 22: o2_restoreScreen
  -> 28: o2_addItemToInventory
  -> 50: o2_wipeDownMouseItem
  -> 67: o2_loadPalette384
  -> 68: o2_setPalette384
  -> 165: o2_disableTimer
  -> 166: o2_enableTimer
  -> 167: o2_setTimerCountdown
- renamed some timer functions

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/animator_v2.cpp
    scummvm/trunk/engines/kyra/gui_v2.cpp
    scummvm/trunk/engines/kyra/kyra_v2.cpp
    scummvm/trunk/engines/kyra/kyra_v2.h
    scummvm/trunk/engines/kyra/resource.cpp
    scummvm/trunk/engines/kyra/script_v2.cpp
    scummvm/trunk/engines/kyra/timer_v2.cpp

Modified: scummvm/trunk/engines/kyra/animator_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/animator_v2.cpp	2008-03-18 14:27:22 UTC (rev 31181)
+++ scummvm/trunk/engines/kyra/animator_v2.cpp	2008-03-18 15:50:43 UTC (rev 31182)
@@ -196,7 +196,7 @@
 void KyraEngine_v2::updateItemAnimations() {
 	bool nextFrame = false;
 
-	if (_itemAnimData[0].itemIndex == -1 || _holdItemAnims)
+	if (_itemAnimData[0].itemIndex == -1 || _inventorySaved)
 		return;	
 
 	ItemAnimData *s = &_itemAnimData[_nextAnimItem++];

Modified: scummvm/trunk/engines/kyra/gui_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.cpp	2008-03-18 14:27:22 UTC (rev 31181)
+++ scummvm/trunk/engines/kyra/gui_v2.cpp	2008-03-18 15:50:43 UTC (rev 31182)
@@ -650,6 +650,14 @@
 	return -1;
 }
 
+int KyraEngine_v2::findFreeVisibleInventorySlot() {
+	for (int i = 0; i < 10; ++i) {
+		if (_mainCharacter.inventory[i] == 0xFFFF)
+			return i;
+	}
+	return -1;
+}
+
 void KyraEngine_v2::removeItemFromInventory(int slot) {
 	_mainCharacter.inventory[slot] = 0xFFFF;
 	if (slot < 10) {

Modified: scummvm/trunk/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-03-18 14:27:22 UTC (rev 31181)
+++ scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-03-18 15:50:43 UTC (rev 31182)
@@ -97,7 +97,6 @@
 	memset(&_invWsa, 0, sizeof(_invWsa));
 	_itemAnimTable = 0;
 	_nextAnimItem = 0;
-	_holdItemAnims = false;
 
 	_colorCodeFlag1 = 0;
 	_colorCodeFlag2 = -1;

Modified: scummvm/trunk/engines/kyra/kyra_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.h	2008-03-18 14:27:22 UTC (rev 31181)
+++ scummvm/trunk/engines/kyra/kyra_v2.h	2008-03-18 15:50:43 UTC (rev 31182)
@@ -593,6 +593,7 @@
 	void clearInventorySlot(int slot, int page);
 	void redrawInventory(int page);
 	void scrollInventoryWheel();
+	int findFreeVisibleInventorySlot();
 
 	struct ItemAnimData {
 		int16 itemIndex;
@@ -603,7 +604,6 @@
 	} _itemAnimData[15];
 
 	int _nextAnimItem;
-	bool _holdItemAnims;
 
 	// gui
 	void loadButtonShapes();
@@ -908,11 +908,11 @@
 	void snd_playSoundEffect(int track);
 
 	// timer
-	void timerFunc2(int);
+	void timerFadeOutMessage(int);
 	void timerCauldronAnimation(int);
 	void timerFunc4(int);
 	void timerFunc5(int);
-	void timerFunc6(int);
+	void timerBurnZanthia(int);
 
 	void setTimer1DelaySecs(int secs);
 
@@ -967,12 +967,15 @@
 	int o2_showChapterMessage(ScriptState *script);
 	int o2_restoreTalkTextMessageBkgd(ScriptState *script);
 	int o2_wsaClose(ScriptState *script);
-	int o2_meanWhileScene(ScriptState *script);	
+	int o2_meanWhileScene(ScriptState *script);
+	int o2_backUpScreen(ScriptState *script);
+	int o2_restoreScreen(ScriptState *script);
 	int o2_displayWsaFrame(ScriptState *script);
 	int o2_displayWsaSequentialFramesLooping(ScriptState *script);
 	int o2_wsaOpen(ScriptState *script);
 	int o2_displayWsaSequentialFrames(ScriptState *script);
 	int o2_displayWsaSequence(ScriptState *script);
+	int o2_addItemToInventory(ScriptState *script);
 	int o2_drawShape(ScriptState *script);	
 	int o2_addItemToCurScene(ScriptState *script);
 	int o2_checkForItem(ScriptState *script);
@@ -990,6 +993,7 @@
 	int o2_addSpecialExit(ScriptState *script);
 	int o2_setMousePos(ScriptState *script);
 	int o2_showMouse(ScriptState *script);
+	int o2_wipeDownMouseItem(ScriptState *script);
 	//int o2_playSoundEffect(ScriptState *script);
 	int o2_delaySecs(ScriptState *script);
 	int o2_delay(ScriptState *script);
@@ -1000,6 +1004,8 @@
 	int o2_drawSceneShapeOnPage(ScriptState *script);
 	int o2_disableAnimObject(ScriptState *script);
 	int o2_enableAnimObject(ScriptState *script);
+	int o2_loadPalette384(ScriptState *script);
+	int o2_setPalette384(ScriptState *script);
 	int o2_restoreBackBuffer(ScriptState *script);
 	int o2_backUpInventoryGfx(ScriptState *script);
 	int o2_disableSceneAnim(ScriptState *script);
@@ -1065,6 +1071,9 @@
 	int o2_customChatFinish(ScriptState *script);
 	int o2_setupSceneAnimation(ScriptState *script);
 	int o2_stopSceneAnimation(ScriptState *script);
+	int o2_disableTimer(ScriptState *script);
+	int o2_enableTimer(ScriptState *script);
+	int o2_setTimerCountdown(ScriptState *script);
 	int o2_processPaletteIndex(ScriptState *script);
 	int o2_getBoolFromStack(ScriptState *script);
 	int o2_setVocHigh(ScriptState *script);

Modified: scummvm/trunk/engines/kyra/resource.cpp
===================================================================
--- scummvm/trunk/engines/kyra/resource.cpp	2008-03-18 14:27:22 UTC (rev 31181)
+++ scummvm/trunk/engines/kyra/resource.cpp	2008-03-18 15:50:43 UTC (rev 31182)
@@ -347,10 +347,6 @@
 	if (!stream)
 		return false;
 
-	if (maxSize < stream->size()) {
-		delete stream;
-		return false;
-	}
 	memset(buf, 0, maxSize);
 	stream->read(buf, stream->size());
 	delete stream;

Modified: scummvm/trunk/engines/kyra/script_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_v2.cpp	2008-03-18 14:27:22 UTC (rev 31181)
+++ scummvm/trunk/engines/kyra/script_v2.cpp	2008-03-18 15:50:43 UTC (rev 31182)
@@ -27,6 +27,7 @@
 #include "kyra/text_v2.h"
 #include "kyra/wsamovie.h"
 #include "kyra/sound.h"
+#include "kyra/timer.h"
 
 #include "common/endian.h"
 
@@ -196,6 +197,18 @@
 	return 0;
 }
 
+int KyraEngine_v2::o2_backUpScreen(ScriptState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_backUpScreen(%p) (%d)", (const void *)script, stackPos(0));
+	_screen->copyRegionToBuffer(stackPos(0), 0, 0, 320, 144, _screenBuffer);
+	return 0;
+}
+
+int KyraEngine_v2::o2_restoreScreen(ScriptState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_restoreScreen(%p) (%d)", (const void *)script, stackPos(0));
+	_screen->copyBlockToPage(stackPos(0), 0, 0, 320, 144, _screenBuffer);
+	return 0;
+}
+
 int KyraEngine_v2::o2_displayWsaFrame(ScriptState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_displayWsaFrame(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d)", (const void *)script,
 			stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8));
@@ -355,6 +368,17 @@
 	return 0;
 }
 
+int KyraEngine_v2::o2_addItemToInventory(ScriptState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_addItemToInventory(%p) (%d, -, %d)", (const void *)script, stackPos(0), stackPos(2));
+	int slot = findFreeVisibleInventorySlot();
+	if (slot != -1) {
+		_mainCharacter.inventory[slot] = stackPos(0);
+		if (stackPos(2))
+			redrawInventory(0);
+	}
+	return slot;
+}
+
 int KyraEngine_v2::o2_drawShape(ScriptState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_drawShape(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4));
 
@@ -519,6 +543,33 @@
 	return 0;
 }
 
+int KyraEngine_v2::o2_wipeDownMouseItem(ScriptState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_wipeDownMouseItem(%p) (-, %d, %d)", (const void *)script, stackPos(1), stackPos(2));
+	_screen->hideMouse();
+	const int x = stackPos(1) - 8;
+	const int y = stackPos(2) - 15;
+
+	if (_itemInHand >= 0) {
+		backUpGfxRect32x32(x, y);
+		uint8 *shape = getShapePtr(_itemInHand+64);
+		for (int curY = y, height = 16; height > 0; height -= 2, curY += 2) {
+			restoreGfxRect32x32(x, y);
+			_screen->setNewShapeHeight(shape, height);
+			uint32 waitTime = _system->getMillis() + _tickLength;
+			_screen->drawShape(0, shape, x, curY, 0, 0);
+			_screen->updateScreen();
+			delayUntil(waitTime);
+		}
+		restoreGfxRect32x32(x, y);
+		_screen->resetShapeHeight(shape);
+	}
+
+	_screen->showMouse();
+	removeHandItem();
+
+	return 0;
+}
+
 int KyraEngine_v2::o2_delaySecs(ScriptState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_delaySecs(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
 	delay(stackPos(0) * 1000, true);
@@ -602,6 +653,20 @@
 	return 0;
 }
 
+int KyraEngine_v2::o2_loadPalette384(ScriptState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_loadPalette384(%p) ('%s')", (const void *)script, stackPosString(0));
+	memcpy(_screen->getPalette(1), _screen->getPalette(0), 768);
+	_res->loadFileToBuf(stackPosString(0), _screen->getPalette(1), 384);
+	return 0;
+}
+
+int KyraEngine_v2::o2_setPalette384(ScriptState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setPalette384(%p) ()", (const void *)script);
+	memcpy(_screen->getPalette(0), _screen->getPalette(1), 384);
+	_screen->setScreenPalette(_screen->getPalette(0));
+	return 0;
+}
+
 int KyraEngine_v2::o2_restoreBackBuffer(ScriptState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_restoreBackBuffer(%p) (%d)", (const void *)script, stackPos(0));
 	int disable = stackPos(0);
@@ -1348,6 +1413,24 @@
 	return 0;
 }
 
+int KyraEngine_v2::o2_disableTimer(ScriptState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_disableTimer(%p) (%d)", (const void *)script, stackPos(0));
+	_timer->disable(stackPos(0));
+	return 0;
+}
+
+int KyraEngine_v2::o2_enableTimer(ScriptState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_enableTimer(%p) (%d)", (const void *)script, stackPos(0));
+	_timer->enable(stackPos(0));
+	return 0;
+}
+
+int KyraEngine_v2::o2_setTimerCountdown(ScriptState *script) {
+	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setTimerCountdown(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+	_timer->setCountdown(stackPos(0), stackPos(1));
+	return 0;
+}
+
 int KyraEngine_v2::o2_processPaletteIndex(ScriptState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_processPaletteIndex(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5));
 	uint8 *palette = _screen->getPalette(0);
@@ -1492,8 +1575,8 @@
 		OpcodeUnImpl(),
 		// 0x14
 		Opcode(o2_wsaClose),
-		OpcodeUnImpl(),
-		OpcodeUnImpl(),
+		Opcode(o2_backUpScreen),
+		Opcode(o2_restoreScreen),
 		Opcode(o2_displayWsaFrame),
 		// 0x18
 		Opcode(o2_displayWsaSequentialFramesLooping),
@@ -1501,7 +1584,7 @@
 		Opcode(o2_displayWsaSequentialFrames),
 		Opcode(o2_displayWsaSequence),
 		// 0x1c
-		OpcodeUnImpl(),
+		Opcode(o2_addItemToInventory),
 		Opcode(o2_drawShape),
 		Opcode(o2_addItemToCurScene),
 		OpcodeUnImpl(),
@@ -1528,8 +1611,8 @@
 		// 0x30
 		Opcode(o2_showMouse),
 		OpcodeUnImpl(),
+		Opcode(o2_wipeDownMouseItem),
 		OpcodeUnImpl(),
-		OpcodeUnImpl(),
 		// 0x34
 		OpcodeUnImpl(),
 		Opcode(o2_playSoundEffect),
@@ -1549,9 +1632,9 @@
 		Opcode(o2_disableAnimObject),
 		Opcode(o2_enableAnimObject),
 		Opcode(o2_dummy),
-		OpcodeUnImpl(),
+		Opcode(o2_loadPalette384),
 		// 0x44
-		OpcodeUnImpl(),
+		Opcode(o2_setPalette384),
 		Opcode(o2_restoreBackBuffer),
 		Opcode(o2_backUpInventoryGfx),
 		Opcode(o2_disableSceneAnim),
@@ -1661,9 +1744,9 @@
 		Opcode(o2_setupSceneAnimation),
 		Opcode(o2_stopSceneAnimation),
 		// 0x9c
-		OpcodeUnImpl(),
-		OpcodeUnImpl(),
-		OpcodeUnImpl(),
+		Opcode(o2_disableTimer),
+		Opcode(o2_enableTimer),
+		Opcode(o2_setTimerCountdown),
 		Opcode(o2_processPaletteIndex),
 		// 0xa0
 		OpcodeUnImpl(),

Modified: scummvm/trunk/engines/kyra/timer_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/timer_v2.cpp	2008-03-18 14:27:22 UTC (rev 31181)
+++ scummvm/trunk/engines/kyra/timer_v2.cpp	2008-03-18 15:50:43 UTC (rev 31182)
@@ -34,15 +34,15 @@
 	debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v2::setupTimers()");
 
 	_timer->addTimer(0, 0, 5, 1);
-	_timer->addTimer(1, TimerV2(timerFunc2), -1, 1);
+	_timer->addTimer(1, TimerV2(timerFadeOutMessage), -1, 1);
 	_timer->addTimer(2, TimerV2(timerCauldronAnimation), 1, 1);
 	_timer->addTimer(3, TimerV2(timerFunc4), 1, 0);
 	_timer->addTimer(4, TimerV2(timerFunc5), 1, 0);
-	_timer->addTimer(5, TimerV2(timerFunc6), 1, 0);
+	_timer->addTimer(5, TimerV2(timerBurnZanthia), 1, 0);
 }
 
-void KyraEngine_v2::timerFunc2(int arg) {
-	debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v2::timerFunc2(%d)", arg);
+void KyraEngine_v2::timerFadeOutMessage(int arg) {
+	debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v2::timerFadeOutMessage(%d)", arg);
 	if (_shownMessage)
 		_msgUnk1 = 1;
 }
@@ -78,16 +78,16 @@
 		updateSceneAnim(4, i);
 		delay(6);
 	}
-	//_unk1 = 4;
+	_deathHandler = 4;
 }
 
-void KyraEngine_v2::timerFunc6(int arg) {
-	debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v2::timerFunc6(%d)", arg);
+void KyraEngine_v2::timerBurnZanthia(int arg) {
+	debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v2::timerBurnZanthia(%d)", arg);
 	_timer->disable(5);
-	_screen->hideMouse();
+	//_screen->hideMouse();
 	snd_playSoundEffect(0x2D);
 	runTemporaryScript("_ZANBURN.EMC", 0, 1, 1, 0);
-	//_unk1 = 7;
+	_deathHandler = 7;
 	snd_playWanderScoreViaMap(0x53, 1);
 }
 


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