Skip to content

Commit

Permalink
DIRECTOR: Format code, send movie, sprite scripts to Lingo
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Iskrich authored and sev- committed Aug 3, 2016
1 parent c520b45 commit d3b49ba
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion engines/director/lingo/lingo.cpp
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion engines/director/lingo/lingo.h
Expand Up @@ -75,7 +75,7 @@ class Lingo {
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);

Expand Down
14 changes: 10 additions & 4 deletions engines/director/score.cpp
Expand Up @@ -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];
Expand Down Expand Up @@ -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]);
Expand All @@ -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];
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
20 changes: 10 additions & 10 deletions engines/director/score.h
Expand Up @@ -38,7 +38,7 @@ class Score;

#define CHANNEL_COUNT 24

enum castType {
enum CastType {
kCastBitmap = 1,
kCastFilmLoop,
kCastText,
Expand All @@ -52,7 +52,7 @@ enum castType {
kCastScript
};

enum spritePositions {
enum SpritePosition {
kSpritePositionUnk1 = 0,
kSpritePositionEnabled,
kSpritePositionUnk2,
Expand All @@ -64,7 +64,7 @@ enum spritePositions {
kSpritePositionWidth = 14
};

enum mainChannelsPosition {
enum MainChannelsPosition {
kScriptIdPosition = 0,
kSoundType1Position,
kTransFlagsPosition,
Expand All @@ -79,7 +79,7 @@ enum mainChannelsPosition {
kPaletePosition = 15
};

enum inkType {
enum InkType {
kInkTypeCopy,
kInkTypeTransparent,
kInkTypeReverse,
Expand All @@ -101,13 +101,13 @@ enum inkType {
kInkTypeDark
};

enum scriptType {
enum ScriptType {
kMovieScript,
kSpriteScript,
kFrameScript
};

enum transitionType {
enum TransitionType {
kTransWipeRight = 1,
kTransWipeLeft,
kTransWipeDown,
Expand Down Expand Up @@ -163,7 +163,7 @@ enum transitionType {
};

struct Cast {
castType type;
CastType type;
Common::Rect initialRect;
};

Expand Down Expand Up @@ -228,7 +228,7 @@ class Sprite {
Sprite(const Sprite &sprite);
bool _enabled;
byte _castId;
inkType _ink;
InkType _ink;
uint16 _trails;
Cast *_cast;
uint16 _flags;
Expand Down Expand Up @@ -259,7 +259,7 @@ class Frame {
uint8 _transDuration;
uint8 _transArea; //1 - Whole Stage, 0 - Changing Area
uint8 _transChunkSize;
transitionType _transType;
TransitionType _transType;
PaletteInfo *_palette;
uint8 _tempo;

Expand Down Expand Up @@ -293,7 +293,7 @@ class Score {
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:
Expand Down

0 comments on commit d3b49ba

Please sign in to comment.