[Scummvm-cvs-logs] CVS: scummvm/kyra kyra.cpp,1.123,1.124 kyra.h,1.69,1.70 screen.cpp,1.39,1.40 screen.h,1.25,1.26 script_v1.cpp,1.68,1.69

Johannes Schickel lordhoto at users.sourceforge.net
Sat Jan 14 13:15:00 CET 2006


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

Modified Files:
	kyra.cpp kyra.h screen.cpp screen.h script_v1.cpp 
Log Message:
Implemented "cmd_loadPageFromDisk" and "cmd_savePageToDisk".


Index: kyra.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -d -r1.123 -r1.124
--- kyra.cpp	14 Jan 2006 14:25:31 -0000	1.123
+++ kyra.cpp	14 Jan 2006 21:14:27 -0000	1.124
@@ -389,8 +389,6 @@
 	_lastProcessedItem = 0;
 	_lastProcessedItemHeight = 16;
 	
-	_hidPage = _screenPage = 0;
-	
 	_unkScreenVar1 = 1;
 	_unkScreenVar2 = 0;
 	_unkScreenVar3 = 0;

Index: kyra.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- kyra.h	13 Jan 2006 23:06:04 -0000	1.69
+++ kyra.h	14 Jan 2006 21:14:27 -0000	1.70
@@ -614,7 +614,6 @@
 	bool _mousePressFlag;
 	uint8 _flagsTable[53];
 	uint8 *_unkPtr1, *_unkPtr2;
-	uint8 *_hidPage, *_screenPage;
 	uint8 *_shapes[377];
 	uint16 _gameSpeed;
 	uint16 _tickLength;

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/screen.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- screen.cpp	14 Jan 2006 15:20:00 -0000	1.39
+++ screen.cpp	14 Jan 2006 21:14:27 -0000	1.40
@@ -70,6 +70,7 @@
 	assert(_bitBlitRects);
 	memset(_bitBlitRects, 0, sizeof(Rect)*BITBLIT_RECTS);
 	_bitBlitNum = 0;
+	memset(_saveLoadPage, 0, sizeof(_saveLoadPage));
 }
 
 Screen::~Screen() {
@@ -89,6 +90,10 @@
 		free(_palettes[i]);
 	}
 	delete [] _bitBlitRects;
+	for (int i = 0; i < ARRAYSIZE(_saveLoadPage); ++i) {
+		delete [] _saveLoadPage[i];
+		_saveLoadPage[i] = 0;
+	}
 }
 
 void Screen::updateScreen() {
@@ -1881,4 +1886,20 @@
 		++cur;
 	}
 }
+
+void Screen::savePageToDisk(const char *file, int page) {
+	debug(9, "Screen::savePageToDisk('%s', %d)", file, page);
+	if (!_saveLoadPage[page/2]) {
+		_saveLoadPage[page/2] = new uint8[SCREEN_W * SCREEN_H];
+		assert(_saveLoadPage[page/2]);
+	}
+	memcpy(_saveLoadPage[page/2], getPagePtr(page), SCREEN_W * SCREEN_H);
+}
+
+void Screen::loadPageFromDisk(const char *file, int page) {
+	debug(9, "Screen::loadPageFromDisk('%s', %d)", file, page);
+	copyBlockToPage(page, 0, 0, SCREEN_W, SCREEN_H, _saveLoadPage[page/2]);
+	delete [] _saveLoadPage[page/2];
+	_saveLoadPage[page/2] = 0;
+}
 } // End of namespace Kyra

Index: screen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/screen.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- screen.h	14 Jan 2006 15:20:00 -0000	1.25
+++ screen.h	14 Jan 2006 21:14:27 -0000	1.26
@@ -143,6 +143,9 @@
 	
 	void addBitBlitRect(int x, int y, int w, int h);
 	void bitBlitRects();
+	
+	void savePageToDisk(const char *file, int page);
+	void loadPageFromDisk(const char *file, int page);
 
 	int _charWidth;
 	int _charOffset;
@@ -162,6 +165,7 @@
 	void copyScreenToRect(int x, int y, int w, int h, uint8 *ptr);
 
 	uint8 *_pagePtrs[16];
+	uint8 *_saveLoadPage[8];
 	uint8 *_screenPalette;
 	uint8 *_palettes[3];
 	FontId _currentFont;

Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/script_v1.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- script_v1.cpp	14 Jan 2006 15:20:00 -0000	1.68
+++ script_v1.cpp	14 Jan 2006 21:14:27 -0000	1.69
@@ -74,8 +74,8 @@
 }
 
 int KyraEngine::cmd_drawSceneAnimShape(ScriptState *script) {
-	debug(3, "cmd_drawSceneAnimShape(0x%X) (%d, %d, %d, %d)", script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
-	_screen->drawShape(stackPos(4), _sprites->_sceneShapes[stackPos(0)], stackPos(1), stackPos(2), 0, stackPos(3));
+	debug(3, "cmd_drawSceneAnimShape(0x%X) (%d, %d, %d, %d, %d)", script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4));
+	_screen->drawShape(stackPos(4), _sprites->_sceneShapes[stackPos(0)], stackPos(1), stackPos(2), 0, (stackPos(3) != 0) ? 1 : 0);
 	return 0;
 }
 
@@ -202,7 +202,8 @@
 }
 
 int KyraEngine::cmd_savePageToDisk(ScriptState *script) {
-	warning("STUB: cmd_savePageToDisk");
+	debug(3, "cmd_savePageToDisk(0x%X) ('%s', %d)", script, stackPosString(0), stackPos(1));
+	_screen->savePageToDisk(stackPosString(0), stackPos(1));
 	return 0;
 }
 
@@ -605,7 +606,9 @@
 }
 
 int KyraEngine::cmd_loadPageFromDisk(ScriptState *script) {
-	warning("STUB: cmd_loadPageFromDisk");
+	debug(3, "cmd_loadPageFromDisk(0x%X) ('%s', %d)", script, stackPosString(0), stackPos(1));
+	_screen->loadPageFromDisk(stackPosString(0), stackPos(1));
+	_animator->_updateScreen = true;
 	return 0;
 }
 
@@ -678,7 +681,8 @@
 	int height = stackPos(3);
 	int srcPage = stackPos(4);
 	int dstPage = stackPos(5);
-	_screen->copyRegion(xpos, ypos, xpos, ypos, width, height, srcPage, dstPage, 0);
+	_screen->copyRegion(xpos, ypos, xpos, ypos, width, height, srcPage, dstPage);
+	_animator->_updateScreen = true;
 	return 0;
 }
 
@@ -709,12 +713,12 @@
 	int wsaIndex = stackPos(4);
 	
 	_screen->hideMouse();
+	uint32 continueTime = waitTime * _tickLength + _system->getMillis();
 	_movieObjects[wsaIndex]->_x = xpos;
 	_movieObjects[wsaIndex]->_y = ypos;
 	_movieObjects[wsaIndex]->_drawPage = 2;
 	_movieObjects[wsaIndex]->displayFrame(frame);
 	_animator->_updateScreen = true;
-	uint32 continueTime = waitTime * _tickLength + _system->getMillis();
 	while (_system->getMillis() < continueTime) {
 		_sprites->updateSceneAnims();
 		_animator->updateAllObjectShapes();
@@ -1032,12 +1036,9 @@
 
 int KyraEngine::cmd_specialEventDisplayBrynnsNote(ScriptState *script) {
 	debug(3, "cmd_specialEventDisplayBrynnsNote(0x%X) ()", script);
-	_hidPage = (uint8*)malloc(320*200);
-	_screenPage = (uint8*)malloc(320*200);
-	assert(_hidPage && _screenPage);
 	_screen->hideMouse();
-	_screen->copyRegionToBuffer(0, 0, 0, 320, 200, _screenPage);
-	_screen->copyRegionToBuffer(2, 0, 0, 320, 200, _hidPage);
+	_screen->savePageToDisk("HIDPAGE.TMP", 2);
+	_screen->savePageToDisk("SEENPAGE.TMP", 0);
 	if (_features & GF_TALKIE) {
 		if (_features & GF_ENGLISH) {
 			loadBitmap("NOTEENG.CPS", 3, 3, 0);
@@ -1059,11 +1060,8 @@
 int KyraEngine::cmd_specialEventRemoveBrynnsNote(ScriptState *script) {
 	debug(3, "cmd_specialEventRemoveBrynnsNote(0x%X) ()", script);
 	_screen->hideMouse();
-	assert(_hidPage && _screenPage);
-	_screen->copyBlockToPage(0, 0, 0, 320, 200, _screenPage);
-	_screen->copyBlockToPage(2, 0, 0, 320, 200, _hidPage);
-	free(_screenPage);
-	free(_hidPage);
+	_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
+	_screen->loadPageFromDisk("HIDPAGE.TMP", 2);
 	_screen->updateScreen();
 	_screen->showMouse();
 	_screen->setFont(Screen::FID_8_FNT);





More information about the Scummvm-git-logs mailing list