[Scummvm-cvs-logs] CVS: scummvm/kyra kyra.cpp,1.81,1.82 kyra.h,1.42,1.43 script_v1.cpp,1.35,1.36

Johannes Schickel lordhoto at users.sourceforge.net
Sat Dec 10 07:53:00 CET 2005


Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19051

Modified Files:
	kyra.cpp kyra.h script_v1.cpp 
Log Message:
Implemented cmd_bkgdScrollSceneAndMasksRight.


Index: kyra.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- kyra.cpp	9 Dec 2005 23:48:51 -0000	1.81
+++ kyra.cpp	10 Dec 2005 15:52:38 -0000	1.82
@@ -273,6 +273,7 @@
 	_seq = new SeqPlayer(this, _system);
 	assert(_seq);
 	
+	_paletteChanged = 1;
 	_currentCharacter = 0;
 	_characterList = new Character[11];
 	assert(_characterList);
@@ -453,13 +454,17 @@
 		int size = _screen->getRectSize(3, 24);
 		_shapes[365+i] = (byte*)malloc(size);
 	}
-	_shapes[0] = (byte*)malloc(_screen->getRectSize(3, 24));
+	_unkPtr1 = (uint8*)malloc(_screen->getRectSize(1, 144));
+	memset(_unkPtr1, 0, _screen->getRectSize(1, 144));
+	_unkPtr2 = (uint8*)malloc(_screen->getRectSize(1, 144));
+	memset(_unkPtr2, 0, _screen->getRectSize(1, 144));
+	_shapes[0] = (uint8*)malloc(_screen->getRectSize(3, 24));
 	memset(_shapes[0], 0, _screen->getRectSize(3, 24));
-	_shapes[1] = (byte*)malloc(_screen->getRectSize(4, 32));
+	_shapes[1] = (uint8*)malloc(_screen->getRectSize(4, 32));
 	memset(_shapes[1], 0, _screen->getRectSize(4, 32));
-	_shapes[2] = (byte*)malloc(_screen->getRectSize(8, 69));
+	_shapes[2] = (uint8*)malloc(_screen->getRectSize(8, 69));
 	memset(_shapes[2], 0, _screen->getRectSize(8, 69));
-	_shapes[3] = (byte*)malloc(_screen->getRectSize(8, 69));
+	_shapes[3] = (uint8*)malloc(_screen->getRectSize(8, 69));
 	memset(_shapes[3], 0, _screen->getRectSize(8, 69));
 	for (int i = 0; i < _roomTableSize; ++i) {
 		for (int item = 0; item < 12; ++item) {
@@ -3698,6 +3703,51 @@
 	return layer;
 }
 
+void KyraEngine::copyBackgroundBlock(int x, int page, int flag) {
+	debug(9, "copyBackgroundBlock(%d, %d, %d)", x, page, flag);
+	
+	if (x < 1)
+		return;
+	
+	int height = 128;
+	if (flag)
+		height += 8;	
+	if (!(x & 1))
+		++x;
+	if (x == 19)
+		x = 17;
+	uint8 *ptr1 = _unkPtr1;
+	uint8 *ptr2 = _unkPtr2;
+	int oldVideoPage = _screen->_curPage;
+	_screen->_curPage = page;
+	
+	int curX = x;
+	_screen->hideMouse();
+	_screen->copyRegionToBuffer(_screen->_curPage, 8, 8, 8, height, ptr2);
+	for (int i = 0; i < 19; ++i) {
+		int tempX = curX + 1;
+		_screen->copyRegionToBuffer(_screen->_curPage, tempX<<3, 8, 8, height, ptr1);
+		_screen->copyBlockToPage(_screen->_curPage, tempX<<3, 8, 8, height, ptr2);
+		int newXPos = curX + x;
+		if (newXPos > 37) {
+			newXPos = newXPos % 38;
+		}
+		tempX = newXPos + 1;
+		_screen->copyRegionToBuffer(_screen->_curPage, tempX<<3, 8, 8, height, ptr2);
+		_screen->copyBlockToPage(_screen->_curPage, tempX<<3, 8, 8, height, ptr1);
+		curX += x*2;
+		if (curX > 37) {
+			curX = curX % 38;
+		}
+	}
+	_screen->showMouse();
+	_screen->_curPage = oldVideoPage;
+}
+
+void KyraEngine::copyBackgroundBlock2(int x) {
+	copyBackgroundBlock(x, 4, 1);
+}
+
 #pragma mark -
 #pragma mark - Pathfinder
 #pragma mark -

Index: kyra.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- kyra.h	9 Dec 2005 23:48:52 -0000	1.42
+++ kyra.h	10 Dec 2005 15:52:38 -0000	1.43
@@ -182,6 +182,7 @@
 	int16 _northExitHeight;
 
 	Character *_currentCharacter;
+	int _paletteChanged;
 
 	typedef void (KyraEngine::*IntroProc)();
 	typedef int (KyraEngine::*OpcodeProc)(ScriptState *script);
@@ -465,6 +466,8 @@
 	void restoreRect0(int xpos, int ypos);
 	void backUpRect1(int xpos, int ypos);
 	void restoreRect1(int xpos, int ypos);
+	void copyBackgroundBlock(int x, int page, int flag);
+	void copyBackgroundBlock2(int x);
 	
 	void processInput(int xpos, int ypos);
 	int processInputHelper(int xpos, int ypos);
@@ -561,6 +564,7 @@
 	uint16 _talkMessageH;
 	bool _talkMessagePrinted;
 	uint8 _flagsTable[53];
+	uint8 *_unkPtr1, *_unkPtr2;
 	uint8 *_shapes[377];
 	uint16 _gameSpeed;
 	uint16 _tickLength;

Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/script_v1.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- script_v1.cpp	9 Dec 2005 23:48:52 -0000	1.35
+++ script_v1.cpp	10 Dec 2005 15:52:38 -0000	1.36
@@ -1200,7 +1200,12 @@
 }
 
 int KyraEngine::cmd_bkgdScrollSceneAndMasksRight(ScriptState *script) {
-	warning("STUB: cmd_bkgdScrollSceneAndMasksRight");
+	debug(3, "cmd_bkgdScrollSceneAndMasksRight(0x%X) (%d)", script, stackPos(0));
+	copyBackgroundBlock(stackPos(0), 2, 0);
+	copyBackgroundBlock2(stackPos(0));
+	// update the whole screen
+	_screen->copyRegion(7, 7, 7, 7, 305, 129, 3, 0);
+	_screen->updateScreen();
 	return 0;
 }
 
@@ -1529,8 +1534,9 @@
 }
 
 int KyraEngine::cmd_setPaletteChangeFlag(ScriptState *script) {
-	warning("STUB: cmd_setPaletteChangeFlag");
-	return 0;
+	debug(3, "cmd_setPaletteChangeFlag(0x%X) (%d)", script, stackPos(0));
+	_paletteChanged = stackPos(0);
+	return _paletteChanged;
 }
 
 int KyraEngine::cmd_fillRect(ScriptState *script) {





More information about the Scummvm-git-logs mailing list