aboutsummaryrefslogtreecommitdiff
path: root/engines/composer
diff options
context:
space:
mode:
Diffstat (limited to 'engines/composer')
-rw-r--r--engines/composer/composer.cpp25
-rw-r--r--engines/composer/composer.h4
-rw-r--r--engines/composer/configure.engine3
-rw-r--r--engines/composer/graphics.cpp10
4 files changed, 24 insertions, 18 deletions
diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp
index 5db778dfda..2d7075cba1 100644
--- a/engines/composer/composer.cpp
+++ b/engines/composer/composer.cpp
@@ -48,6 +48,15 @@ namespace Composer {
ComposerEngine::ComposerEngine(OSystem *syst, const ComposerGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
_rnd = new Common::RandomSource("composer");
_audioStream = NULL;
+ _currSoundPriority = 0;
+ _currentTime = 0;
+ _lastTime = 0;
+ _needsUpdate = true;
+ _directoriesToStrip = 1;
+ _mouseVisible = true;
+ _mouseEnabled = false;
+ _mouseSpriteId = 0;
+ _lastButton = NULL;
}
ComposerEngine::~ComposerEngine() {
@@ -79,12 +88,6 @@ Common::Error ComposerEngine::run() {
_queuedScripts[i]._scriptId = 0;
}
- _mouseVisible = true;
- _mouseEnabled = false;
- _mouseSpriteId = 0;
- _lastButton = NULL;
-
- _directoriesToStrip = 1;
if (!_bookIni.loadFromFile("book.ini")) {
_directoriesToStrip = 0;
if (!_bookIni.loadFromFile("programs/book.ini")) {
@@ -103,7 +106,6 @@ Common::Error ComposerEngine::run() {
height = atoi(getStringFromConfig("Common", "Height").c_str());
initGraphics(width, height, true);
_screen.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
- _needsUpdate = true;
Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(),
@@ -113,11 +115,12 @@ Common::Error ComposerEngine::run() {
loadLibrary(0);
- _currentTime = 0;
- _lastTime = 0;
-
uint fps = atoi(getStringFromConfig("Common", "FPS").c_str());
- uint frameTime = 1000 / fps;
+ uint frameTime = 125; // Default to 125ms (1000/8)
+ if (fps != 0)
+ frameTime = 1000 / fps;
+ else
+ warning("FPS in book.ini is zero. Defaulting to 8...");
uint32 lastDrawTime = 0;
while (!shouldQuit()) {
diff --git a/engines/composer/composer.h b/engines/composer/composer.h
index 33a5356b3a..7d8022455a 100644
--- a/engines/composer/composer.h
+++ b/engines/composer/composer.h
@@ -23,7 +23,7 @@
#ifndef COMPOSER_H
#define COMPOSER_H
-#include "common/config-file.h"
+#include "common/ini-file.h"
#include "common/random.h"
#include "common/system.h"
#include "common/debug.h"
@@ -174,7 +174,7 @@ private:
Common::List<Sprite> _sprites;
uint _directoriesToStrip;
- Common::ConfigFile _bookIni;
+ Common::INIFile _bookIni;
Common::String _bookGroup;
Common::List<Library> _libraries;
Common::Array<PendingPageChange> _pendingPageChanges;
diff --git a/engines/composer/configure.engine b/engines/composer/configure.engine
new file mode 100644
index 0000000000..71a79acb5d
--- /dev/null
+++ b/engines/composer/configure.engine
@@ -0,0 +1,3 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine composer "Magic Composer" yes
diff --git a/engines/composer/graphics.cpp b/engines/composer/graphics.cpp
index 2b68fac233..caf3ba3a40 100644
--- a/engines/composer/graphics.cpp
+++ b/engines/composer/graphics.cpp
@@ -39,7 +39,7 @@ bool Sprite::contains(const Common::Point &pos) const {
return false;
if (adjustedPos.y < 0 || adjustedPos.y >= _surface.h)
return false;
- byte *pixels = (byte *)_surface.pixels;
+ const byte *pixels = (const byte *)_surface.getPixels();
return (pixels[(_surface.h - adjustedPos.y - 1) * _surface.w + adjustedPos.x] != 0);
}
@@ -541,7 +541,7 @@ void ComposerEngine::redraw() {
for (uint i = 0; i < _dirtyRects.size(); i++) {
const Common::Rect &rect = _dirtyRects[i];
- byte *pixels = (byte *)_screen.pixels + (rect.top * _screen.pitch) + rect.left;
+ byte *pixels = (byte *)_screen.getBasePtr(rect.left, rect.top);
_system->copyRectToScreen(pixels, _screen.pitch, rect.left, rect.top, rect.width(), rect.height());
}
_system->updateScreen();
@@ -794,7 +794,7 @@ bool ComposerEngine::initSprite(Sprite &sprite) {
if (width > 0 && height > 0) {
sprite._surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
- decompressBitmap(type, stream, (byte *)sprite._surface.pixels, size, width, height);
+ decompressBitmap(type, stream, (byte *)sprite._surface.getPixels(), size, width, height);
} else {
// there are some sprites (e.g. a -998x-998 one in Gregory's title screen)
// which have an invalid size, but the original engine doesn't notice for
@@ -814,13 +814,13 @@ void ComposerEngine::drawSprite(const Sprite &sprite) {
int y = sprite._pos.y;
// incoming data is BMP-style (bottom-up), so flip it
- byte *pixels = (byte *)_screen.pixels;
+ byte *pixels = (byte *)_screen.getPixels();
for (int j = 0; j < sprite._surface.h; j++) {
if (j + y < 0)
continue;
if (j + y >= _screen.h)
break;
- byte *in = (byte *)sprite._surface.pixels + (sprite._surface.h - j - 1) * sprite._surface.w;
+ const byte *in = (const byte *)sprite._surface.getBasePtr(0, sprite._surface.h - j - 1);
byte *out = pixels + ((j + y) * _screen.w) + x;
for (int i = 0; i < sprite._surface.w; i++)
if ((x + i >= 0) && (x + i < _screen.w) && in[i])