aboutsummaryrefslogtreecommitdiff
path: root/engines/toon
diff options
context:
space:
mode:
Diffstat (limited to 'engines/toon')
-rw-r--r--engines/toon/character.cpp9
-rw-r--r--engines/toon/movie.cpp3
-rw-r--r--engines/toon/picture.cpp11
-rw-r--r--engines/toon/picture.h2
-rw-r--r--engines/toon/toon.cpp15
5 files changed, 26 insertions, 14 deletions
diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp
index 06c6e21d21..022214157a 100644
--- a/engines/toon/character.cpp
+++ b/engines/toon/character.cpp
@@ -596,7 +596,8 @@ int32 Character::getId() {
void Character::save(Common::WriteStream *stream) {
debugC(1, kDebugCharacter, "save(stream)");
- stream->writeSint32LE(_flags);
+ // we have to save visibility too, put in flags to not invalidate old savegames.
+ stream->writeSint32LE(_flags | ((_visible == false) ? 0x100 : 0));
stream->writeSint32LE(_x);
stream->writeSint32LE(_y);
stream->writeSint32LE(_z);
@@ -633,6 +634,12 @@ void Character::load(Common::ReadStream *stream) {
if (_sceneAnimationId > -1) {
setAnimationInstance(_vm->getSceneAnimation(_sceneAnimationId)->_animInstance);
}
+
+ // "not visible" flag.
+ if (_flags & 0x100) {
+ _flags &= ~0x100;
+ setVisible(false);
+ }
}
void Character::setAnimScript(int32 animScriptId) {
diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp
index 2318eaaac7..7637f4e62f 100644
--- a/engines/toon/movie.cpp
+++ b/engines/toon/movie.cpp
@@ -94,7 +94,7 @@ void Movie::play(Common::String video, int32 flags) {
_vm->getAudioManager()->setMusicVolume(0);
_decoder->loadFile(video.c_str());
playVideo(isFirstIntroVideo);
- _vm->flushPalette(false);
+ _vm->flushPalette(true);
if (flags & 1)
_vm->getAudioManager()->setMusicVolume(_vm->getAudioManager()->isMusicMuted() ? 0 : 255);
_decoder->close();
@@ -103,7 +103,6 @@ void Movie::play(Common::String video, int32 flags) {
bool Movie::playVideo(bool isFirstIntroVideo) {
debugC(1, kDebugMovie, "playVideo(isFirstIntroVideo: %d)", isFirstIntroVideo);
-
while (!_vm->shouldQuit() && !_decoder->endOfVideo()) {
if (_decoder->needsUpdate()) {
const Graphics::Surface *frame = _decoder->decodeNextFrame();
diff --git a/engines/toon/picture.cpp b/engines/toon/picture.cpp
index 0257964fb5..295e304765 100644
--- a/engines/toon/picture.cpp
+++ b/engines/toon/picture.cpp
@@ -29,16 +29,14 @@
namespace Toon {
-bool Picture::loadPicture(Common::String file, bool totalPalette /*= false*/) {
- debugC(1, kDebugPicture, "loadPicture(%s, %d)", file.c_str(), (totalPalette) ? 1 : 0);
+bool Picture::loadPicture(Common::String file) {
+ debugC(1, kDebugPicture, "loadPicture(%s)", file.c_str());
uint32 size = 0;
uint8 *fileData = _vm->resources()->getFileData(file, &size);
if (!fileData)
return false;
- _useFullPalette = totalPalette;
-
uint32 compId = READ_BE_UINT32(fileData);
switch (compId) {
@@ -57,6 +55,8 @@ bool Picture::loadPicture(Common::String file, bool totalPalette /*= false*/) {
// do we have a palette ?
_paletteEntries = (dstsize & 0x7ff) / 3;
+ _useFullPalette = (_paletteEntries == 256);
+ // _useFullPalette = true;
if (_paletteEntries) {
_palette = new uint8[_paletteEntries * 3];
memcpy(_palette, _data + dstsize - (dstsize & 0x7ff), _paletteEntries * 3);
@@ -70,7 +70,8 @@ bool Picture::loadPicture(Common::String file, bool totalPalette /*= false*/) {
uint32 decSize = READ_LE_UINT32(fileData + 10);
_data = new uint8[decSize + 100];
_paletteEntries = READ_LE_UINT16(fileData + 14) / 3;
-
+ _useFullPalette = (_paletteEntries == 256);
+
if (_paletteEntries) {
_palette = new uint8[_paletteEntries * 3];
memcpy(_palette, fileData + 16, _paletteEntries * 3);
diff --git a/engines/toon/picture.h b/engines/toon/picture.h
index 23edbc91da..ee0e006702 100644
--- a/engines/toon/picture.h
+++ b/engines/toon/picture.h
@@ -38,7 +38,7 @@ class Picture {
public:
Picture(ToonEngine *vm);
~Picture();
- bool loadPicture(Common::String file, bool totalPalette = false);
+ bool loadPicture(Common::String file);
void setupPalette();
void draw(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32 dy);
void drawWithRectList(Graphics::Surface& surface, int32 x, int32 y, int32 dx, int32 dy, Common::Array<Common::Rect>& rectArray);
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index 26639d71f7..cff6c24469 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -614,7 +614,7 @@ struct MainMenuEntry {
bool ToonEngine::showMainmenu(bool &loadedGame) {
Picture *mainmenuPicture = new Picture(this);
- mainmenuPicture->loadPicture("TITLESCR.CPS", true);
+ mainmenuPicture->loadPicture("TITLESCR.CPS");
mainmenuPicture->setupPalette();
flushPalette(false);
@@ -690,6 +690,11 @@ bool ToonEngine::showMainmenu(bool &loadedGame) {
}
}
+ if (_needPaletteFlush) {
+ flushPalette(false);
+ _needPaletteFlush = false;
+ }
+
parseInput();
copyToVirtualScreen(true);
_system->delayMillis(17);
@@ -1547,7 +1552,7 @@ void ToonEngine::clickEvent() {
return;
}
} else {
- if (!_drew->walkTo(_mouseX, _mouseY)) {
+ if (!_drew->walkTo(_mouseX + _gameState->_currentScrollValue, _mouseY)) {
// walk was canceled ?
return;
}
@@ -2600,7 +2605,7 @@ int32 ToonEngine::showInventory() {
delete _inventoryPicture;
_inventoryPicture = new Picture(this);
fadeOut(5);
- _inventoryPicture->loadPicture("SACK128.CPS", true);
+ _inventoryPicture->loadPicture("SACK128.CPS");
_inventoryPicture->setupPalette();
dirtyAllScreen();
@@ -2786,7 +2791,7 @@ void ToonEngine::showCutaway(Common::String cutawayPicture) {
if (cutawayPicture == "") {
cutawayPicture = Common::String(_gameState->_locations[_gameState->_currentScene]._cutaway) + ".CPS";
}
- _currentCutaway->loadPicture(cutawayPicture, false);
+ _currentCutaway->loadPicture(cutawayPicture);
_currentCutaway->setupPalette();
_oldScrollValue = _gameState->_currentScrollValue;
_gameState->_currentScrollValue = 0;
@@ -3418,7 +3423,7 @@ void ToonEngine::viewInventoryItem(Common::String str, int32 lineId, int32 itemD
fadeOut(5);
Picture *pic = new Picture(this);
- pic->loadPicture(str, false);
+ pic->loadPicture(str);
pic->setupPalette();
dirtyAllScreen();
flushPalette();