aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-11-08 21:51:51 +0100
committerEugene Sandulenko2016-11-08 21:51:51 +0100
commit25a233339439ed2cdf6b52f82c57f1adaa59e0bc (patch)
tree399d2986426fb681444ab8b9dcfef6c0dd6746e5
parent2b8a41b980950df8ff9f481c61d964c93236c746 (diff)
downloadscummvm-rg350-25a233339439ed2cdf6b52f82c57f1adaa59e0bc.tar.gz
scummvm-rg350-25a233339439ed2cdf6b52f82c57f1adaa59e0bc.tar.bz2
scummvm-rg350-25a233339439ed2cdf6b52f82c57f1adaa59e0bc.zip
DIRECTOR: Split out cast-related classes into separate file
-rw-r--r--engines/director/cast.cpp94
-rw-r--r--engines/director/cast.h155
-rw-r--r--engines/director/frame.cpp1
-rw-r--r--engines/director/lingo/lingo-the.cpp1
-rw-r--r--engines/director/module.mk1
-rw-r--r--engines/director/score.cpp64
-rw-r--r--engines/director/score.h124
-rw-r--r--engines/director/sprite.cpp1
8 files changed, 256 insertions, 185 deletions
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
new file mode 100644
index 0000000000..e0d0603ca0
--- /dev/null
+++ b/engines/director/cast.cpp
@@ -0,0 +1,94 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/array.h"
+#include "common/hashmap.h"
+
+#include "director/cast.h"
+#include "director/score.h"
+
+namespace Director {
+
+BitmapCast::BitmapCast(Common::SeekableSubReadStreamEndian &stream) {
+ flags = stream.readByte();
+ someFlaggyThing = stream.readUint16();
+ initialRect = Score::readRect(stream);
+ boundingRect = Score::readRect(stream);
+ regY = stream.readUint16();
+ regX = stream.readUint16();
+ unk1 = unk2 = 0;
+
+ if (someFlaggyThing & 0x8000) {
+ unk1 = stream.readUint16();
+ unk2 = stream.readUint16();
+ }
+ modified = 0;
+}
+
+TextCast::TextCast(Common::SeekableSubReadStreamEndian &stream) {
+ flags1 = stream.readByte();
+ borderSize = static_cast<SizeType>(stream.readByte());
+ gutterSize = static_cast<SizeType>(stream.readByte());
+ boxShadow = static_cast<SizeType>(stream.readByte());
+ textType = static_cast<TextType>(stream.readByte());
+ textAlign = static_cast<TextAlignType>(stream.readUint16());
+ palinfo1 = stream.readUint16();
+ palinfo2 = stream.readUint16();
+ palinfo3 = stream.readUint16();
+
+ int t = stream.readUint32();
+ assert(t == 0); // So far we saw only 0 here
+
+ initialRect = Score::readRect(stream);
+ textShadow = static_cast<SizeType>(stream.readByte());
+ byte flags = stream.readByte();
+ if (flags & 0x1)
+ textFlags.push_back(kTextFlagEditable);
+ if (flags & 0x2)
+ textFlags.push_back(kTextFlagAutoTab);
+ if (flags & 0x4)
+ textFlags.push_back(kTextFlagDoNotWrap);
+ if (flags & 0xf8)
+ warning("Unproxessed text cast flags: %x", flags & 0xf8);
+
+ // TODO: FIXME: guesswork
+ fontId = stream.readByte();
+ fontSize = stream.readByte();
+
+ modified = 0;
+}
+
+ShapeCast::ShapeCast(Common::SeekableSubReadStreamEndian &stream) {
+ /*byte flags = */ stream.readByte();
+ /*unk1 = */ stream.readByte();
+ shapeType = static_cast<ShapeType>(stream.readByte());
+ initialRect = Score::readRect(stream);
+ pattern = stream.readUint16BE();
+ fgCol = stream.readByte();
+ bgCol = stream.readByte();
+ fillType = stream.readByte();
+ lineThickness = stream.readByte();
+ lineDirection = stream.readByte();
+ modified = 0;
+}
+
+} // End of namespace Director
diff --git a/engines/director/cast.h b/engines/director/cast.h
new file mode 100644
index 0000000000..96ad87947f
--- /dev/null
+++ b/engines/director/cast.h
@@ -0,0 +1,155 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DIRECTOR_CAST_H
+#define DIRECTOR_CAST_H
+
+#include "common/rect.h"
+#include "common/substream.h"
+
+namespace Director {
+
+enum CastType {
+ kCastBitmap = 1,
+ kCastFilmLoop = 2,
+ kCastText = 3,
+ kCastPalette = 4,
+ kCastPicture = 5,
+ kCastSound = 6,
+ kCastButton = 7,
+ kCastShape = 8,
+ kCastMovie = 9,
+ kCastDigitalVideo = 10,
+ kCastScript = 11
+};
+
+struct Cast {
+ CastType type;
+ Common::Rect initialRect;
+ byte modified;
+};
+
+struct BitmapCast : Cast {
+ BitmapCast(Common::SeekableSubReadStreamEndian &stream);
+
+ Common::Rect boundingRect;
+ uint16 regX;
+ uint16 regY;
+ uint8 flags;
+ uint16 someFlaggyThing;
+ uint16 unk1, unk2;
+};
+
+enum ShapeType {
+ kShapeRectangle,
+ kShapeRoundRect,
+ kShapeOval,
+ kShapeLine
+};
+
+struct ShapeCast : Cast {
+ ShapeCast(Common::SeekableSubReadStreamEndian &stream);
+
+ ShapeType shapeType;
+ uint16 pattern;
+ byte fgCol;
+ byte bgCol;
+ byte fillType;
+ byte lineThickness;
+ byte lineDirection;
+};
+
+enum TextType {
+ kTextTypeAdjustToFit,
+ kTextTypeScrolling,
+ kTextTypeFixed
+};
+
+enum TextAlignType {
+ kTextAlignRight = -1,
+ kTextAlignLeft,
+ kTextAlignCenter
+};
+
+enum TextFlag {
+ kTextFlagEditable,
+ kTextFlagAutoTab,
+ kTextFlagDoNotWrap
+};
+
+enum SizeType {
+ kSizeNone,
+ kSizeSmallest,
+ kSizeSmall,
+ kSizeMedium,
+ kSizeLarge,
+ kSizeLargest
+};
+
+struct TextCast : Cast {
+ TextCast(Common::SeekableSubReadStreamEndian &stream);
+
+ SizeType borderSize;
+ SizeType gutterSize;
+ SizeType boxShadow;
+
+ byte flags1;
+ uint32 fontId;
+ uint16 fontSize;
+ TextType textType;
+ TextAlignType textAlign;
+ SizeType textShadow;
+ Common::Array<TextFlag> textFlags;
+ int16 palinfo1, palinfo2, palinfo3;
+};
+
+enum ButtonType {
+ kTypeButton,
+ kTypeCheckBox,
+ kTypeRadio
+};
+
+struct ButtonCast : TextCast {
+ ButtonCast(Common::SeekableSubReadStreamEndian &stream) : TextCast(stream) {
+ buttonType = static_cast<ButtonType>(stream.readUint16BE());
+ }
+
+ ButtonType buttonType;
+};
+
+struct CastInfo {
+ Common::String script;
+ Common::String name;
+ Common::String directory;
+ Common::String fileName;
+ Common::String type;
+};
+
+struct Label {
+ Common::String name;
+ uint16 number;
+ Label(Common::String name1, uint16 number1) { name = name1; number = number1; }
+};
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index b84023961c..6464943d99 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -27,6 +27,7 @@
#include "image/bmp.h"
#include "director/director.h"
+#include "director/cast.h"
#include "director/frame.h"
#include "director/images.h"
#include "director/archive.h"
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index a8633f1765..270746678b 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -21,6 +21,7 @@
*/
#include "director/lingo/lingo.h"
+#include "director/cast.h"
#include "director/sprite.h"
namespace Director {
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 1ea361590a..38e3cfea4a 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -2,6 +2,7 @@ MODULE := engines/director
MODULE_OBJS = \
archive.o \
+ cast.o \
detection.o \
director.o \
frame.o \
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 98d25cf3f1..407a671a45 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -31,6 +31,7 @@
#include "graphics/macgui/macfontmanager.h"
#include "graphics/macgui/macwindowmanager.h"
+#include "director/cast.h"
#include "director/score.h"
#include "director/frame.h"
#include "director/archive.h"
@@ -829,69 +830,6 @@ void Score::loadFontMap(Common::SeekableSubReadStreamEndian &stream) {
}
}
-BitmapCast::BitmapCast(Common::SeekableSubReadStreamEndian &stream) {
- flags = stream.readByte();
- someFlaggyThing = stream.readUint16();
- initialRect = Score::readRect(stream);
- boundingRect = Score::readRect(stream);
- regY = stream.readUint16();
- regX = stream.readUint16();
- unk1 = unk2 = 0;
-
- if (someFlaggyThing & 0x8000) {
- unk1 = stream.readUint16();
- unk2 = stream.readUint16();
- }
- modified = 0;
-}
-
-TextCast::TextCast(Common::SeekableSubReadStreamEndian &stream) {
- flags1 = stream.readByte();
- borderSize = static_cast<SizeType>(stream.readByte());
- gutterSize = static_cast<SizeType>(stream.readByte());
- boxShadow = static_cast<SizeType>(stream.readByte());
- textType = static_cast<TextType>(stream.readByte());
- textAlign = static_cast<TextAlignType>(stream.readUint16());
- palinfo1 = stream.readUint16();
- palinfo2 = stream.readUint16();
- palinfo3 = stream.readUint16();
-
- int t = stream.readUint32();
- assert(t == 0); // So far we saw only 0 here
-
- initialRect = Score::readRect(stream);
- textShadow = static_cast<SizeType>(stream.readByte());
- byte flags = stream.readByte();
- if (flags & 0x1)
- textFlags.push_back(kTextFlagEditable);
- if (flags & 0x2)
- textFlags.push_back(kTextFlagAutoTab);
- if (flags & 0x4)
- textFlags.push_back(kTextFlagDoNotWrap);
- if (flags & 0xf8)
- warning("Unproxessed text cast flags: %x", flags & 0xf8);
-
- // TODO: FIXME: guesswork
- fontId = stream.readByte();
- fontSize = stream.readByte();
-
- modified = 0;
-}
-
-ShapeCast::ShapeCast(Common::SeekableSubReadStreamEndian &stream) {
- /*byte flags = */ stream.readByte();
- /*unk1 = */ stream.readByte();
- shapeType = static_cast<ShapeType>(stream.readByte());
- initialRect = Score::readRect(stream);
- pattern = stream.readUint16BE();
- fgCol = stream.readByte();
- bgCol = stream.readByte();
- fillType = stream.readByte();
- lineThickness = stream.readByte();
- lineDirection = stream.readByte();
- modified = 0;
-}
-
Common::Rect Score::readRect(Common::SeekableSubReadStreamEndian &stream) {
Common::Rect *rect = new Common::Rect();
rect->top = stream.readUint16();
diff --git a/engines/director/score.h b/engines/director/score.h
index a60f2d7c5a..ca148aff85 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -34,26 +34,14 @@ namespace Graphics {
namespace Director {
class Archive;
+struct CastInfo;
class DirectorEngine;
class DirectorSound;
class Frame;
+struct Label;
class Lingo;
class Sprite;
-enum CastType {
- kCastBitmap = 1,
- kCastFilmLoop = 2,
- kCastText = 3,
- kCastPalette = 4,
- kCastPicture = 5,
- kCastSound = 6,
- kCastButton = 7,
- kCastShape = 8,
- kCastMovie = 9,
- kCastDigitalVideo = 10,
- kCastScript = 11
-};
-
enum ScriptType {
kMovieScript = 0,
kSpriteScript = 1,
@@ -62,114 +50,6 @@ enum ScriptType {
kMaxScriptType = 2
};
-struct Cast {
- CastType type;
- Common::Rect initialRect;
- byte modified;
-};
-
-struct BitmapCast : Cast {
- BitmapCast(Common::SeekableSubReadStreamEndian &stream);
-
- Common::Rect boundingRect;
- uint16 regX;
- uint16 regY;
- uint8 flags;
- uint16 someFlaggyThing;
- uint16 unk1, unk2;
-};
-
-enum ShapeType {
- kShapeRectangle,
- kShapeRoundRect,
- kShapeOval,
- kShapeLine
-};
-
-struct ShapeCast : Cast {
- ShapeCast(Common::SeekableSubReadStreamEndian &stream);
-
- ShapeType shapeType;
- uint16 pattern;
- byte fgCol;
- byte bgCol;
- byte fillType;
- byte lineThickness;
- byte lineDirection;
-};
-
-enum TextType {
- kTextTypeAdjustToFit,
- kTextTypeScrolling,
- kTextTypeFixed
-};
-
-enum TextAlignType {
- kTextAlignRight = -1,
- kTextAlignLeft,
- kTextAlignCenter
-};
-
-enum TextFlag {
- kTextFlagEditable,
- kTextFlagAutoTab,
- kTextFlagDoNotWrap
-};
-
-enum SizeType {
- kSizeNone,
- kSizeSmallest,
- kSizeSmall,
- kSizeMedium,
- kSizeLarge,
- kSizeLargest
-};
-
-struct TextCast : Cast {
- TextCast(Common::SeekableSubReadStreamEndian &stream);
-
- SizeType borderSize;
- SizeType gutterSize;
- SizeType boxShadow;
-
- byte flags1;
- uint32 fontId;
- uint16 fontSize;
- TextType textType;
- TextAlignType textAlign;
- SizeType textShadow;
- Common::Array<TextFlag> textFlags;
- int16 palinfo1, palinfo2, palinfo3;
-};
-
-enum ButtonType {
- kTypeButton,
- kTypeCheckBox,
- kTypeRadio
-};
-
-struct ButtonCast : TextCast {
- ButtonCast(Common::SeekableSubReadStreamEndian &stream) : TextCast(stream) {
- buttonType = static_cast<ButtonType>(stream.readUint16BE());
- }
-
- ButtonType buttonType;
-};
-
-struct CastInfo {
- Common::String script;
- Common::String name;
- Common::String directory;
- Common::String fileName;
- Common::String type;
-};
-
-struct Label {
- Common::String name;
- uint16 number;
- Label(Common::String name1, uint16 number1) { name = name1; number = number1; }
-};
-
class Score {
public:
Score(DirectorEngine *vm, Archive *);
diff --git a/engines/director/sprite.cpp b/engines/director/sprite.cpp
index ccbe8e3c5a..a59313ad33 100644
--- a/engines/director/sprite.cpp
+++ b/engines/director/sprite.cpp
@@ -21,6 +21,7 @@
*/
#include "director/director.h"
+#include "director/cast.h"
#include "director/score.h"
#include "director/sprite.h"