aboutsummaryrefslogtreecommitdiff
path: root/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2006-01-14 21:14:27 +0000
committerJohannes Schickel2006-01-14 21:14:27 +0000
commitff7a1c734f4ea32b330dfacf212b719f3b590955 (patch)
tree0d075a7c929ab085f317aee5d999d765c37ec989 /kyra
parenta61e62db95d30c9886cf2e66e84f9e753c04f2d5 (diff)
downloadscummvm-rg350-ff7a1c734f4ea32b330dfacf212b719f3b590955.tar.gz
scummvm-rg350-ff7a1c734f4ea32b330dfacf212b719f3b590955.tar.bz2
scummvm-rg350-ff7a1c734f4ea32b330dfacf212b719f3b590955.zip
Implemented "cmd_loadPageFromDisk" and "cmd_savePageToDisk".
svn-id: r20032
Diffstat (limited to 'kyra')
-rw-r--r--kyra/kyra.cpp2
-rw-r--r--kyra/kyra.h1
-rw-r--r--kyra/screen.cpp21
-rw-r--r--kyra/screen.h4
-rw-r--r--kyra/script_v1.cpp30
5 files changed, 39 insertions, 19 deletions
diff --git a/kyra/kyra.cpp b/kyra/kyra.cpp
index 2c12ce07d8..ec85b2ec35 100644
--- a/kyra/kyra.cpp
+++ b/kyra/kyra.cpp
@@ -389,8 +389,6 @@ int KyraEngine::init(GameDetector &detector) {
_lastProcessedItem = 0;
_lastProcessedItemHeight = 16;
- _hidPage = _screenPage = 0;
-
_unkScreenVar1 = 1;
_unkScreenVar2 = 0;
_unkScreenVar3 = 0;
diff --git a/kyra/kyra.h b/kyra/kyra.h
index b845267a73..a68651e111 100644
--- a/kyra/kyra.h
+++ b/kyra/kyra.h
@@ -614,7 +614,6 @@ protected:
bool _mousePressFlag;
uint8 _flagsTable[53];
uint8 *_unkPtr1, *_unkPtr2;
- uint8 *_hidPage, *_screenPage;
uint8 *_shapes[377];
uint16 _gameSpeed;
uint16 _tickLength;
diff --git a/kyra/screen.cpp b/kyra/screen.cpp
index 3677132056..f3a217f043 100644
--- a/kyra/screen.cpp
+++ b/kyra/screen.cpp
@@ -70,6 +70,7 @@ Screen::Screen(KyraEngine *vm, OSystem *system)
assert(_bitBlitRects);
memset(_bitBlitRects, 0, sizeof(Rect)*BITBLIT_RECTS);
_bitBlitNum = 0;
+ memset(_saveLoadPage, 0, sizeof(_saveLoadPage));
}
Screen::~Screen() {
@@ -89,6 +90,10 @@ Screen::~Screen() {
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 @@ void Screen::bitBlitRects() {
++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
diff --git a/kyra/screen.h b/kyra/screen.h
index cdf9761106..d2ee052317 100644
--- a/kyra/screen.h
+++ b/kyra/screen.h
@@ -143,6 +143,9 @@ public:
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 @@ private:
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;
diff --git a/kyra/script_v1.cpp b/kyra/script_v1.cpp
index 88900dd0b9..46d63a0944 100644
--- a/kyra/script_v1.cpp
+++ b/kyra/script_v1.cpp
@@ -74,8 +74,8 @@ int KyraEngine::cmd_pauseTicks(ScriptState *script) {
}
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_createMouseItem(ScriptState *script) {
}
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_setCustomPaletteRange(ScriptState *script) {
}
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 KyraEngine::cmd_copyWSARegion(ScriptState *script) {
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 KyraEngine::cmd_displayWSAFrameOnHidPage(ScriptState *script) {
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_walkCharacterToPoint(ScriptState *script) {
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_specialEventDisplayBrynnsNote(ScriptState *script) {
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);