aboutsummaryrefslogtreecommitdiff
path: root/engines/toon
diff options
context:
space:
mode:
authorMatthew Hoops2011-05-11 00:30:02 -0400
committerMatthew Hoops2011-05-11 00:30:28 -0400
commita1d41da096c0bcf502a85919cb1cb1ee471719c5 (patch)
tree8c51419daa486f1d4833757db4715dadab6c3497 /engines/toon
parentaccb0c2a5d0c9e7b353cda4b74f511a498ed8073 (diff)
parent33c3e19cea2a08fbf26ecbe940763e8ee1c37d28 (diff)
downloadscummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.gz
scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.bz2
scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.zip
Merge remote branch 'upstream/master' into t7g-ios
Conflicts: audio/decoders/qdm2.h common/util.cpp engines/groovie/music.cpp engines/groovie/resource.h video/qt_decoder.cpp video/qt_decoder.h
Diffstat (limited to 'engines/toon')
-rw-r--r--engines/toon/anim.cpp3
-rw-r--r--engines/toon/audio.cpp2
-rw-r--r--engines/toon/character.cpp8
-rw-r--r--engines/toon/drew.cpp2
-rw-r--r--engines/toon/flux.cpp2
-rw-r--r--engines/toon/font.cpp10
-rw-r--r--engines/toon/hotspot.cpp2
-rw-r--r--engines/toon/movie.cpp11
-rw-r--r--engines/toon/path.cpp8
-rw-r--r--engines/toon/picture.cpp3
-rw-r--r--engines/toon/resource.cpp1
-rw-r--r--engines/toon/script.cpp3
-rw-r--r--engines/toon/script_func.cpp3
-rw-r--r--engines/toon/state.cpp2
-rw-r--r--engines/toon/text.cpp2
-rw-r--r--engines/toon/tools.cpp2
-rw-r--r--engines/toon/toon.cpp14
-rw-r--r--engines/toon/toon.h1
18 files changed, 67 insertions, 12 deletions
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp
index 6004aacead..856acbd986 100644
--- a/engines/toon/anim.cpp
+++ b/engines/toon/anim.cpp
@@ -23,6 +23,9 @@
*
*/
+#include "common/debug.h"
+#include "common/rect.h"
+
#include "toon/anim.h"
#include "toon/toon.h"
#include "toon/tools.h"
diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp
index c2e0bf7b20..026450d3c9 100644
--- a/engines/toon/audio.cpp
+++ b/engines/toon/audio.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/audio.h"
#include "common/memstream.h"
#include "common/substream.h"
diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp
index 69051d45fd..29a61ffd78 100644
--- a/engines/toon/character.cpp
+++ b/engines/toon/character.cpp
@@ -23,6 +23,9 @@
*
*/
+#include "common/debug.h"
+#include "common/system.h"
+
#include "toon/character.h"
#include "toon/drew.h"
#include "toon/flux.h"
@@ -166,8 +169,9 @@ bool Character::walkTo(int32 newPosX, int32 newPosY) {
_vm->getPathFinding()->resetBlockingRects();
- if (_id == 1) {
- int32 sizeX = MAX<int32>(5, 40 * _vm->getDrew()->getScale() / 1024);
+ // don't allow flux to go at the same position as drew
+ if (_id == 1 ) {
+ int32 sizeX = MAX<int32>(5, 30 * _vm->getDrew()->getScale() / 1024);
int32 sizeY = MAX<int32>(2, 20 * _vm->getDrew()->getScale() / 1024);
_vm->getPathFinding()->addBlockingEllipse(_vm->getDrew()->getFinalX(), _vm->getDrew()->getFinalY(), sizeX, sizeY);
}
diff --git a/engines/toon/drew.cpp b/engines/toon/drew.cpp
index 4f8152833b..77333c4a9f 100644
--- a/engines/toon/drew.cpp
+++ b/engines/toon/drew.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/drew.h"
namespace Toon {
diff --git a/engines/toon/flux.cpp b/engines/toon/flux.cpp
index 034332af56..833fdbf5ce 100644
--- a/engines/toon/flux.cpp
+++ b/engines/toon/flux.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/flux.h"
namespace Toon {
diff --git a/engines/toon/font.cpp b/engines/toon/font.cpp
index 8192a6f6f1..9367d79036 100644
--- a/engines/toon/font.cpp
+++ b/engines/toon/font.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/font.h"
namespace Toon {
@@ -81,7 +83,7 @@ void FontRenderer::renderText(int32 x, int32 y, Common::String origText, int32 m
x -= xx / 2;
}
- _vm->addDirtyRect(x, y, x + xx, y + yy);
+ _vm->addDirtyRect(x, y, x + xx + 2, y + yy);
int32 curX = x;
int32 curY = y;
@@ -214,7 +216,7 @@ void FontRenderer::renderMultiLineText(int32 x, int32 y, Common::String origText
curChar = textToFont(curChar);
int width = _currentFont->getFrameWidth(curChar);
- curWidth += width - 2;
+ curWidth += MAX<int32>(width - 2, 0);
it++;
curLetterNr++;
}
@@ -275,12 +277,12 @@ void FontRenderer::renderMultiLineText(int32 x, int32 y, Common::String origText
for (int32 i = 0; i < numLines; i++) {
const byte *line = lines[i];
curX = x - lineSize[i] / 2;
- _vm->addDirtyRect(curX + _vm->state()->_currentScrollValue, y, curX + lineSize[i] + _vm->state()->_currentScrollValue, curY + height);
+ _vm->addDirtyRect(curX + _vm->state()->_currentScrollValue, curY, curX + lineSize[i] + _vm->state()->_currentScrollValue + 2, curY + height);
while (*line) {
byte curChar = textToFont(*line);
if (curChar != 32) _currentFont->drawFontFrame(_vm->getMainSurface(), curChar, curX + _vm->state()->_currentScrollValue, curY, _currentFontColor);
- curX = curX + _currentFont->getFrameWidth(curChar) - 2;
+ curX = curX + MAX<int32>(_currentFont->getFrameWidth(curChar) - 2, 0);
//height = MAX(height, _currentFont->getFrameHeight(curChar));
line++;
}
diff --git a/engines/toon/hotspot.cpp b/engines/toon/hotspot.cpp
index 0573e92fef..1c1e23e39e 100644
--- a/engines/toon/hotspot.cpp
+++ b/engines/toon/hotspot.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/hotspot.h"
#include "toon/tools.h"
diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp
index 4305abb62b..64b80c29b3 100644
--- a/engines/toon/movie.cpp
+++ b/engines/toon/movie.cpp
@@ -23,7 +23,16 @@
*
*/
+#include "common/debug.h"
+#include "common/events.h"
+#include "common/keyboard.h"
+#include "common/stream.h"
+#include "common/system.h"
+#include "graphics/surface.h"
+
+#include "toon/audio.h"
#include "toon/movie.h"
+#include "toon/toon.h"
namespace Toon {
@@ -50,7 +59,7 @@ bool ToonstruckSmackerDecoder::loadFile(const Common::String &filename) {
delete _surface;
}
_surface = new Graphics::Surface();
- _surface->create(640, 400, 1);
+ _surface->create(640, 400, Graphics::PixelFormat::createFormatCLUT8());
_header.flags = 4;
}
diff --git a/engines/toon/path.cpp b/engines/toon/path.cpp
index e0cdf87502..26355863f6 100644
--- a/engines/toon/path.cpp
+++ b/engines/toon/path.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/path.h"
namespace Toon {
@@ -407,7 +409,11 @@ void PathFinding::init(Picture *mask) {
_height = mask->getHeight();
_currentMask = mask;
_heap->unload();
- _heap->init(_width * _height);
+ // In order to reduce memory fragmentation on small devices, we use the maximum
+ // possible size here which is TOON_BACKBUFFER_WIDTH. Even though this is
+ // 1280 as opposed to the possible 640, it actually helps memory allocation on
+ // those devices.
+ _heap->init(TOON_BACKBUFFER_WIDTH * _height); // should really be _width
delete[] _gridTemp;
_gridTemp = new int32[_width*_height];
}
diff --git a/engines/toon/picture.cpp b/engines/toon/picture.cpp
index 1945f0fe45..ce28f9c68b 100644
--- a/engines/toon/picture.cpp
+++ b/engines/toon/picture.cpp
@@ -25,6 +25,9 @@
#include "toon/picture.h"
#include "toon/tools.h"
+
+#include "common/debug.h"
+#include "common/rect.h"
#include "common/stack.h"
namespace Toon {
diff --git a/engines/toon/resource.cpp b/engines/toon/resource.cpp
index b29aa3b72d..f9f65b423b 100644
--- a/engines/toon/resource.cpp
+++ b/engines/toon/resource.cpp
@@ -24,6 +24,7 @@
*/
#include "toon/resource.h"
+#include "common/debug.h"
#include "common/file.h"
#include "common/memstream.h"
#include "common/substream.h"
diff --git a/engines/toon/script.cpp b/engines/toon/script.cpp
index 0242ace7e3..8703666781 100644
--- a/engines/toon/script.cpp
+++ b/engines/toon/script.cpp
@@ -23,10 +23,9 @@
*
*/
+#include "common/debug.h"
#include "common/endian.h"
#include "common/stream.h"
-#include "common/util.h"
-#include "common/system.h"
#include "toon/toon.h"
#include "toon/script.h"
diff --git a/engines/toon/script_func.cpp b/engines/toon/script_func.cpp
index b181591bf0..8f75097bd4 100644
--- a/engines/toon/script_func.cpp
+++ b/engines/toon/script_func.cpp
@@ -23,6 +23,9 @@
*
*/
+#include "common/debug.h"
+#include "common/system.h"
+
#include "toon/script_func.h"
#include "toon/script.h"
#include "toon/state.h"
diff --git a/engines/toon/state.cpp b/engines/toon/state.cpp
index 0d6977842d..af37ea9e68 100644
--- a/engines/toon/state.cpp
+++ b/engines/toon/state.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/state.h"
#include "toon/toon.h"
diff --git a/engines/toon/text.cpp b/engines/toon/text.cpp
index f0d17dd34e..94a3ea5aa7 100644
--- a/engines/toon/text.cpp
+++ b/engines/toon/text.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/text.h"
namespace Toon {
diff --git a/engines/toon/tools.cpp b/engines/toon/tools.cpp
index da6e0f712e..ff72e69543 100644
--- a/engines/toon/tools.cpp
+++ b/engines/toon/tools.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/tools.h"
#include "toon/toon.h"
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index 2040668245..81c4d313e4 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -33,6 +33,7 @@
#include "common/memstream.h"
#include "engines/util.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "graphics/thumbnail.h"
#include "gui/saveload.h"
@@ -57,7 +58,7 @@ void ToonEngine::init() {
_hotspots = new Hotspots(this);
_mainSurface = new Graphics::Surface();
- _mainSurface->create(TOON_BACKBUFFER_WIDTH, TOON_BACKBUFFER_HEIGHT, 1);
+ _mainSurface->create(TOON_BACKBUFFER_WIDTH, TOON_BACKBUFFER_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
_finalPalette = new uint8[768];
_backupPalette = new uint8[768];
@@ -116,6 +117,8 @@ void ToonEngine::init() {
_drew = _characters[0];
_flux = _characters[1];
+
+
// preload walk anim for flux and drew
_drew->loadWalkAnimation("STNDWALK.CAF");
_drew->setupPalette();
@@ -135,6 +138,9 @@ void ToonEngine::init() {
memset(_sceneAnimations, 0, sizeof(_sceneAnimations));
memset(_sceneAnimationScripts, 0, sizeof(_sceneAnimationScripts));
+ _drew->setVisible(false);
+ _flux->setVisible(false);
+
_gameState->_currentChapter = 1;
initChapter();
loadCursor();
@@ -843,6 +849,7 @@ ToonEngine::ToonEngine(OSystem *syst, const ADGameDescription *gameDescription)
_backupPalette = NULL;
_additionalPalette1 = NULL;
_additionalPalette2 = NULL;
+ _additionalPalette2Present = false;
_cutawayPalette = NULL;
_universalPalette = NULL;
_fluxPalette = NULL;
@@ -1148,6 +1155,7 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) {
strcat(temp, ".NPP");
loadAdditionalPalette(temp, 0);
+ _additionalPalette2Present = false;
strcpy(temp, state()->_locations[SceneId]._name);
strcat(temp, ".NP2");
loadAdditionalPalette(temp, 1);
@@ -1318,6 +1326,7 @@ void ToonEngine::loadAdditionalPalette(Common::String fileName, int32 mode) {
case 1:
memcpy(_additionalPalette2, palette, 69);
fixPaletteEntries(_additionalPalette2, 23);
+ _additionalPalette2Present = true;
break;
case 2:
memcpy(_cutawayPalette, palette, size);
@@ -1786,7 +1795,8 @@ void ToonEngine::flipScreens() {
if (_gameState->_inCloseUp) {
_gameState->_currentScrollValue = TOON_SCREEN_WIDTH;
setPaletteEntries(_cutawayPalette, 1, 128);
- setPaletteEntries(_additionalPalette2, 232, 23);
+ if (_additionalPalette2Present)
+ setPaletteEntries(_additionalPalette2, 232, 23);
} else {
_gameState->_currentScrollValue = 0;
_currentPicture->setupPalette();
diff --git a/engines/toon/toon.h b/engines/toon/toon.h
index 3554900684..373437d658 100644
--- a/engines/toon/toon.h
+++ b/engines/toon/toon.h
@@ -352,6 +352,7 @@ protected:
uint8 *_backupPalette;
uint8 *_additionalPalette1;
uint8 *_additionalPalette2;
+ bool _additionalPalette2Present;
uint8 *_cutawayPalette;
uint8 *_universalPalette;
uint8 *_fluxPalette;