aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/myst.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2010-11-17 19:58:19 +0000
committerMatthew Hoops2010-11-17 19:58:19 +0000
commitecb42156ce6f4530f3e5fcaec68544d2ab552565 (patch)
tree5eebbac24f3db0380b033a638fac0aabe95277dd /engines/mohawk/myst.cpp
parent84a753d8409ba0dc9323b135bf730bff5dd39aa3 (diff)
downloadscummvm-rg350-ecb42156ce6f4530f3e5fcaec68544d2ab552565.tar.gz
scummvm-rg350-ecb42156ce6f4530f3e5fcaec68544d2ab552565.tar.bz2
scummvm-rg350-ecb42156ce6f4530f3e5fcaec68544d2ab552565.zip
MOHAWK: Cache the Myst screen buffer
This is needed for use with sliders. The screen is now updated fewer times as well. svn-id: r54300
Diffstat (limited to 'engines/mohawk/myst.cpp')
-rw-r--r--engines/mohawk/myst.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 39c460edd5..bed917165c 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -299,9 +299,7 @@ Common::Error MohawkEngine_Myst::run() {
_resources[_curResource]->handleMouseUp();
}
- for (uint16 i = 0; i < _resources.size(); i++)
- if (_resources[i]->isEnabled())
- _resources[i]->drawDataToScreen();
+ drawResourceImages();
break;
case Common::EVENT_LBUTTONDOWN:
if (_curResource >= 0) {
@@ -450,6 +448,9 @@ void MohawkEngine_Myst::changeToCard(uint16 card) {
error("Unknown sound action %d", soundAction);
}
+ // Update the images of each area too
+ drawResourceImages();
+
// TODO: Handle Script Resources
// Run the entrance script (if present)
@@ -739,6 +740,8 @@ void MohawkEngine_Myst::runInitScript() {
for (uint16 i = 0; i < scriptCount; i++)
delete[] scripts[i].values;
delete[] scripts;
+
+ _gfx->updateScreen();
}
void MohawkEngine_Myst::runExitScript() {
@@ -792,6 +795,8 @@ void MohawkEngine_Myst::runExitScript() {
for (uint16 i = 0; i < scriptCount; i++)
delete[] scripts[i].values;
delete[] scripts;
+
+ _gfx->updateScreen();
}
void MohawkEngine_Myst::loadHelp(uint16 id) {
@@ -930,6 +935,15 @@ void MohawkEngine_Myst::setResourceEnabled(uint16 resourceId, bool enable) {
warning("Attempt to change unknown resource enable state");
}
+void MohawkEngine_Myst::drawResourceImages() {
+ for (uint16 i = 0; i < _resources.size(); i++)
+ if (_resources[i]->isEnabled())
+ _resources[i]->drawDataToScreen();
+
+ // Make sure the screen is updated
+ _gfx->updateScreen();
+}
+
static MystResource *loadResource(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) {
uint16 type = rlstStream->readUint16LE();
@@ -1605,6 +1619,7 @@ void MystResourceType12::handleAnimation() {
// TODO: Probably not final version. Variable/Type 11 Controlled?
if (_doAnimation) {
_vm->_gfx->copyImageToScreen(_currentFrame++, _frameRect);
+ _vm->_gfx->updateScreen();
if ((_currentFrame - _firstFrame) >= _numFrames)
_doAnimation = false;
}