From d3b49ba5095af8af75555bd5609122ad2105f016 Mon Sep 17 00:00:00 2001 From: Dmitry Iskrich Date: Wed, 15 Jun 2016 16:00:10 +0300 Subject: DIRECTOR: Format code, send movie, sprite scripts to Lingo --- engines/director/lingo/lingo.cpp | 2 +- engines/director/lingo/lingo.h | 2 +- engines/director/score.cpp | 14 ++++++++++---- engines/director/score.h | 20 ++++++++++---------- 4 files changed, 22 insertions(+), 16 deletions(-) (limited to 'engines') diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index b17bb0d388..3d166acba0 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -76,7 +76,7 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) { Lingo::~Lingo() { } -void Lingo::addCode(Common::String code, scriptType type, uint16 id) { +void Lingo::addCode(Common::String code, ScriptType type, uint16 id) { debug(0, "Add code %s for type %d with id %d", code.c_str(), type, id); } diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index f7a25eab32..9fb024f30c 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -75,7 +75,7 @@ public: Lingo(DirectorEngine *vm); ~Lingo(); - void addCode(Common::String code, scriptType type, uint16 id); + void addCode(Common::String code, ScriptType type, uint16 id); void processEvent(LEvent event, int entityId); diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 579eec17f5..5bce536300 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -263,7 +263,7 @@ void Score::loadActions(Common::SeekableReadStream &stream) { } } -void Score::dumpScript(uint16 id, scriptType type, Common::String script) { +void Score::dumpScript(uint16 id, ScriptType type, Common::String script) { Common::DumpFile out; Common::String typeName; char buf[256]; @@ -297,6 +297,9 @@ void Score::loadCastInfo(Common::SeekableReadStream &stream, uint16 id) { Common::Array castStrings = loadStrings(stream, entryType); CastInfo *ci = new CastInfo(); ci->script = castStrings[0]; + if (ci->script != "") { + _lingo->addCode(ci->script, kSpriteScript, id); + } ci->name = getString(castStrings[1]); ci->directory = getString(castStrings[2]); ci->fileName = getString(castStrings[3]); @@ -323,6 +326,9 @@ Common::String Score::getString(Common::String str) { void Score::loadFileInfo(Common::SeekableReadStream &stream) { Common::Array fileInfoStrings = loadStrings(stream, _flags); _script = fileInfoStrings[0]; + if (_script != "") { + _lingo->addCode(_script, kMovieScript, 0); + } _changedBy = fileInfoStrings[1]; _createdBy = fileInfoStrings[2]; _directory = fileInfoStrings[3]; @@ -639,7 +645,7 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset, offset++; break; case kTransTypePosition: - _transType = static_cast(stream.readByte()); + _transType = static_cast(stream.readByte()); offset++; break; case kSound1Position: @@ -708,7 +714,7 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 break; case kSpritePositionFlags: sprite._flags = stream.readUint16BE(); - sprite._ink = static_cast(sprite._flags & 0x3f); + sprite._ink = static_cast(sprite._flags & 0x3f); if (sprite._flags & 0x40) sprite._trails = 1; else @@ -853,7 +859,7 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co } void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) { - uint8 skipColor = 15; //FIXME is it always white (last entry in pallette) ? + uint8 skipColor = *(byte *)target.getBasePtr(0, 0); //FIXME is it always white (last entry in pallette) ? for (int ii = 0; ii < sprite.h; ii++) { const byte *src = (const byte *)sprite.getBasePtr(0, ii); byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + ii); diff --git a/engines/director/score.h b/engines/director/score.h index 885df973a5..90226d7149 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -38,7 +38,7 @@ class Score; #define CHANNEL_COUNT 24 -enum castType { +enum CastType { kCastBitmap = 1, kCastFilmLoop, kCastText, @@ -52,7 +52,7 @@ enum castType { kCastScript }; -enum spritePositions { +enum SpritePosition { kSpritePositionUnk1 = 0, kSpritePositionEnabled, kSpritePositionUnk2, @@ -64,7 +64,7 @@ enum spritePositions { kSpritePositionWidth = 14 }; -enum mainChannelsPosition { +enum MainChannelsPosition { kScriptIdPosition = 0, kSoundType1Position, kTransFlagsPosition, @@ -79,7 +79,7 @@ enum mainChannelsPosition { kPaletePosition = 15 }; -enum inkType { +enum InkType { kInkTypeCopy, kInkTypeTransparent, kInkTypeReverse, @@ -101,13 +101,13 @@ enum inkType { kInkTypeDark }; -enum scriptType { +enum ScriptType { kMovieScript, kSpriteScript, kFrameScript }; -enum transitionType { +enum TransitionType { kTransWipeRight = 1, kTransWipeLeft, kTransWipeDown, @@ -163,7 +163,7 @@ enum transitionType { }; struct Cast { - castType type; + CastType type; Common::Rect initialRect; }; @@ -228,7 +228,7 @@ public: Sprite(const Sprite &sprite); bool _enabled; byte _castId; - inkType _ink; + InkType _ink; uint16 _trails; Cast *_cast; uint16 _flags; @@ -259,7 +259,7 @@ public: uint8 _transDuration; uint8 _transArea; //1 - Whole Stage, 0 - Changing Area uint8 _transChunkSize; - transitionType _transType; + TransitionType _transType; PaletteInfo *_palette; uint8 _tempo; @@ -293,7 +293,7 @@ private: void loadCastInfo(Common::SeekableReadStream &stream, uint16 id); void loadFileInfo(Common::SeekableReadStream &stream); void loadFontMap(Common::SeekableReadStream &stream); - void dumpScript(uint16 id, scriptType type, Common::String script); + void dumpScript(uint16 id, ScriptType type, Common::String script); Common::String getString(Common::String str); Common::Array loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader = true); public: -- cgit v1.2.3