DIRECTOR: Format code, send movie, sprite scripts to Lingo

This commit is contained in:
Dmitry Iskrich 2016-06-15 16:00:10 +03:00 committed by Eugene Sandulenko
parent c520b45247
commit d3b49ba509
4 changed files with 22 additions and 16 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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<Common::String> 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<Common::String> 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<transitionType>(stream.readByte());
_transType = static_cast<TransitionType>(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<inkType>(sprite._flags & 0x3f);
sprite._ink = static_cast<InkType>(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);

View File

@ -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<Common::String> loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader = true);
public: