diff options
author | Paul Gilbert | 2014-03-02 18:37:09 -0500 |
---|---|---|
committer | Paul Gilbert | 2014-03-02 18:37:09 -0500 |
commit | 4931c8257df6d5dbc3d7fa1bc2b85f859cec17d9 (patch) | |
tree | 359c078f27afc7be8f3e07fb8e387ad87d31edb6 /engines | |
parent | d5b5cbbb686596f50cdb9ea072c9178775ada720 (diff) | |
download | scummvm-rg350-4931c8257df6d5dbc3d7fa1bc2b85f859cec17d9.tar.gz scummvm-rg350-4931c8257df6d5dbc3d7fa1bc2b85f859cec17d9.tar.bz2 scummvm-rg350-4931c8257df6d5dbc3d7fa1bc2b85f859cec17d9.zip |
MADS: Further animation loading and final section of scene loading code
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mads/animation.cpp | 33 | ||||
-rw-r--r-- | engines/mads/animation.h | 2 | ||||
-rw-r--r-- | engines/mads/scene.cpp | 16 | ||||
-rw-r--r-- | engines/mads/scene.h | 5 | ||||
-rw-r--r-- | engines/mads/scene_data.cpp | 2 | ||||
-rw-r--r-- | engines/mads/scene_data.h | 2 |
6 files changed, 40 insertions, 20 deletions
diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 339ee72d46..ebb2289443 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -23,12 +23,12 @@ #include "mads/animation.h" #include "mads/compression.h" -#define FILENAME_SIZE 64 +#define FILENAME_SIZE 13 namespace MADS { AAHeader::AAHeader(Common::SeekableReadStream *f) { - _spriteListCount = f->readUint16LE(); + _spriteSetsCount = f->readUint16LE(); _miscEntriesCount = f->readUint16LE(); _frameEntriesCount = f->readUint16LE(); _messagesCount = f->readUint16LE(); @@ -43,43 +43,43 @@ AAHeader::AAHeader(Common::SeekableReadStream *f) { _spriteListIndex = f->readUint16LE(); _scrollPosition.x = f->readSint16LE(); _scrollPosition.y = f->readSint16LE(); - _scrollTicks = f->readUint16LE(); - f->skip(8); + _scrollTicks = f->readUint32LE(); + f->skip(6); char buffer[FILENAME_SIZE]; f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE] = '\0'; + buffer[FILENAME_SIZE - 1] = '\0'; _interfaceFile = Common::String(buffer); for (int i = 0; i < 10; ++i) { f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE] = '\0'; - _spriteSetNames[i] = Common::String(buffer); + buffer[FILENAME_SIZE - 1] = '\0'; + _spriteSetNames.push_back(Common::String(buffer)); } f->skip(81); f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE] = '\0'; + buffer[FILENAME_SIZE - 1] = '\0'; _lbmFilename = Common::String(buffer); f->skip(365); f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE] = '\0'; + buffer[FILENAME_SIZE - 1] = '\0'; _spritesFilename = Common::String(buffer); f->skip(48); f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE] = '\0'; + buffer[FILENAME_SIZE - 1] = '\0'; _soundName = Common::String(buffer); f->skip(13); f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE] = '\0'; + buffer[FILENAME_SIZE - 1] = '\0'; _dsrName = Common::String(buffer); f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE] = '\0'; - Common::String fontResource(buffer); + buffer[FILENAME_SIZE - 1] = '\0'; + _fontResource = Common::String(buffer); } /*------------------------------------------------------------------------*/ @@ -176,7 +176,7 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, // Initialize the reference list _spriteListIndexes.clear(); - for (int i = 0; i < aaHeader._spriteListCount; ++i) + for (int i = 0; i < aaHeader._spriteSetsCount; ++i) _spriteListIndexes.push_back(-1); _messages.clear(); @@ -234,9 +234,9 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, for (uint i = 0; i < _spriteSets.size(); ++i) delete _spriteSets[i]; _spriteSets.clear(); - _spriteSets.resize(aaHeader._spriteListCount); + _spriteSets.resize(aaHeader._spriteSetsCount); - for (int i = 0; i < aaHeader._spriteListCount; ++i) { + for (int i = 0; i < aaHeader._spriteSetsCount; ++i) { if (aaHeader._manualFlag && (i == aaHeader._spriteListIndex)) { // Skip over field, since it's manually loaded _spriteSets[i] = nullptr; @@ -272,7 +272,6 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, f.close(); } - void Animation::loadInterface(InterfaceSurface &interfaceSurface, MSurface &depthSurface, AAHeader &header, int flags, Common::Array<RGB4> *palAnimData, SceneInfo *sceneInfo) { _scene->_depthStyle = 0; diff --git a/engines/mads/animation.h b/engines/mads/animation.h index d96e89b1b9..ce145cdd35 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -81,7 +81,7 @@ public: class AAHeader { public: - int _spriteListCount; + int _spriteSetsCount; int _miscEntriesCount; int _frameEntriesCount; int _messagesCount; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index e6c02b89e0..23c118eaf2 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -149,8 +149,24 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { int flags = _vm->_game->_v2 ? 0x4101 : 0x4100; if (!_vm->_textWindowStill) flags |= 0x200; + _animation = Animation::init(_vm, this); + MSurface surface; + _animation->load(surface, _interfaceSurface, prefix, flags, nullptr, nullptr); + _vm->_palette->_paletteUsage.load(0); + + _bandsRange = _sceneInfo->_yBandsEnd - _sceneInfo->_yBandsStart; + _scaleRange = _sceneInfo->_maxScale - _sceneInfo->_minScale; + + _spriteSlots.clear(false); + _screenY = 0; + _interfaceY = MADS_SCENE_HEIGHT; + _spritesCount = _sprites.size(); + + warning("TODO: sub_1EA80 / showMouse"); + + warning("TODO: inventory_anim_allocate"); } void Scene::loadHotspots() { diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 03980f7043..4968291146 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -90,6 +90,11 @@ public: Common::StringArray _vocabStrings; Animation *_animation; int _depthStyle; + int _bandsRange; + int _scaleRange; + int _screenY; + int _interfaceY; + int _spritesCount; /** * Constructor diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index db2237557b..d7aaa6216d 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -84,7 +84,7 @@ int SpriteSets::add(SpriteAsset *asset, int idx) { if (!idx) idx = size(); - if (idx >= (size() + 1)) + if (idx >= (int)(size() + 1)) resize(idx + 1); delete (*this)[idx]; (*this)[idx] = asset; diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 87fddfedd7..557a6aab2b 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -55,7 +55,7 @@ enum MadsActionMode2 { ACTMODE2_0 = 0, ACTMODE2_2 = 2, ACTMODE2_4 = 4, ACTMODE2_ enum AbortTimerMode { ABORTMODE_0 = 0, ABORTMODE_1 = 1, ABORTMODE_2 = 2 }; #define MADS_INTERFACE_HEIGHT 44 -#define MADS_SCENE_HEIGHT (MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT) +#define MADS_SCENE_HEIGHT 156 #define DEPTH_BANDS_SIZE 15 #define MAX_ROUTE_NODES 22 |