mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
DIRECTOR: More debug output and code tidying up
This commit is contained in:
parent
cdcce73ff8
commit
578d013e9c
@ -249,9 +249,11 @@ void TextCast::setText(const char *text) {
|
||||
}
|
||||
|
||||
ShapeCast::ShapeCast(Common::ReadStreamEndian &stream, uint16 version) {
|
||||
byte flags, unk1;
|
||||
|
||||
if (version < 4) {
|
||||
/*byte flags = */ stream.readByte();
|
||||
/*unk1 = */ stream.readByte();
|
||||
flags = stream.readByte();
|
||||
unk1 = stream.readByte();
|
||||
_shapeType = static_cast<ShapeType>(stream.readByte());
|
||||
_initialRect = Score::readRect(stream);
|
||||
_pattern = stream.readUint16BE();
|
||||
@ -261,8 +263,8 @@ ShapeCast::ShapeCast(Common::ReadStreamEndian &stream, uint16 version) {
|
||||
_lineThickness = stream.readByte();
|
||||
_lineDirection = stream.readByte();
|
||||
} else {
|
||||
stream.readByte();
|
||||
stream.readByte();
|
||||
flags = stream.readByte();
|
||||
unk1 = stream.readByte();
|
||||
|
||||
_initialRect = Score::readRect(stream);
|
||||
_boundingRect = Score::readRect(stream);
|
||||
@ -275,6 +277,12 @@ ShapeCast::ShapeCast(Common::ReadStreamEndian &stream, uint16 version) {
|
||||
_lineDirection = 0;
|
||||
}
|
||||
_modified = 0;
|
||||
|
||||
debugC(3, kDebugLoading, "ShapeCast: fl: %x unk1: %x type: %d pat: %d fg: %d bg: %d fill: %d thick: %d dir: %d",
|
||||
flags, unk1, _shapeType, _pattern, _fgCol, _bgCol, _fillType, _lineThickness, _lineDirection);
|
||||
|
||||
if (debugChannelSet(3, kDebugLoading))
|
||||
_initialRect.debugPrint(0, "ShapeCast: rect:");
|
||||
}
|
||||
|
||||
ButtonCast::ButtonCast(Common::ReadStreamEndian &stream, uint16 version) : TextCast(stream, version) {
|
||||
|
@ -68,13 +68,6 @@ public:
|
||||
uint32 _tag;
|
||||
};
|
||||
|
||||
enum ShapeType {
|
||||
kShapeRectangle,
|
||||
kShapeRoundRect,
|
||||
kShapeOval,
|
||||
kShapeLine
|
||||
};
|
||||
|
||||
class ShapeCast : public Cast {
|
||||
public:
|
||||
ShapeCast(Common::ReadStreamEndian &stream, uint16 version = 2);
|
||||
|
@ -649,27 +649,34 @@ void Frame::addDrawRect(uint16 spriteId, Common::Rect &rect) {
|
||||
}
|
||||
|
||||
void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) {
|
||||
Common::Rect shapeRect = Common::Rect(_sprites[spriteId]->_startPoint.x,
|
||||
_sprites[spriteId]->_startPoint.y,
|
||||
_sprites[spriteId]->_startPoint.x + _sprites[spriteId]->_width,
|
||||
_sprites[spriteId]->_startPoint.y + _sprites[spriteId]->_height);
|
||||
Sprite *sp = _sprites[spriteId];
|
||||
|
||||
if (sp->_shapeCast == NULL) {
|
||||
warning("Frame::renderShape(): missing shapecast in sprite id: %d", spriteId);
|
||||
return;
|
||||
}
|
||||
|
||||
Common::Rect shapeRect = Common::Rect(sp->_startPoint.x,
|
||||
sp->_startPoint.y,
|
||||
sp->_startPoint.x + sp->_width,
|
||||
sp->_startPoint.y + sp->_height);
|
||||
|
||||
Graphics::ManagedSurface tmpSurface;
|
||||
tmpSurface.create(shapeRect.width(), shapeRect.height(), Graphics::PixelFormat::createFormatCLUT8());
|
||||
if (_vm->getVersion() <= 3 && _sprites[spriteId]->_spriteType == kOutlinedRectangleSprite) {
|
||||
if (_vm->getVersion() <= 3 && sp->_spriteType == kOutlinedRectangleSprite) {
|
||||
tmpSurface.fillRect(Common::Rect(shapeRect.width(), shapeRect.height()), (_vm->getCurrentScore()->_currentMouseDownSpriteId == spriteId ? 0 : 0xff));
|
||||
//tmpSurface.frameRect(Common::Rect(shapeRect.width(), shapeRect.height()), 0);
|
||||
// TODO: don't override, work out how to display correctly.
|
||||
_sprites[spriteId]->_ink = kInkTypeReverse;
|
||||
sp->_ink = kInkTypeReverse;
|
||||
} else {
|
||||
// No minus one on the pattern here! MacPlotData will do that for us!
|
||||
Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), _sprites[spriteId]->_castId, 1, _sprites[spriteId]->_backColor);
|
||||
Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), sp->_castId, 1, sp->_shapeCast->_bgCol);
|
||||
Common::Rect fillRect(shapeRect.width(), shapeRect.height());
|
||||
Graphics::drawFilledRect(fillRect, _sprites[spriteId]->_foreColor, Graphics::macDrawPixel, &pd);
|
||||
Graphics::drawFilledRect(fillRect, sp->_shapeCast->_fgCol, Graphics::macDrawPixel, &pd);
|
||||
}
|
||||
|
||||
if (_sprites[spriteId]->_lineSize > 0) {
|
||||
for (int rr = 0; rr < (_sprites[spriteId]->_lineSize - 1); rr++)
|
||||
if (sp->_lineSize > 0) {
|
||||
for (int rr = 0; rr < (sp->_lineSize - 1); rr++)
|
||||
tmpSurface.frameRect(Common::Rect(rr, rr, shapeRect.width() - (rr * 2), shapeRect.height() - (rr * 2)), 0);
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,6 @@ void Score::loadArchive() {
|
||||
assert(_movieArchive->hasResource(MKTAG('V', 'W', 'S', 'C'), -1));
|
||||
loadFrames(*_movieArchive->getFirstResource(MKTAG('V', 'W', 'S', 'C')));
|
||||
|
||||
|
||||
if (_movieArchive->hasResource(MKTAG('V', 'W', 'C', 'F'), -1)) {
|
||||
loadConfig(*_movieArchive->getFirstResource(MKTAG('V', 'W', 'C', 'F')));
|
||||
} else {
|
||||
@ -464,7 +463,7 @@ void Score::loadFrames(Common::SeekableSubReadStreamEndian &stream) {
|
||||
frame->readChannels(str);
|
||||
delete str;
|
||||
|
||||
debugC(3, kDebugLoading, "Frame %d actionId: %d", _frames.size(), frame->_actionId);
|
||||
debugC(8, kDebugLoading, "Frame %d actionId: %d", _frames.size(), frame->_actionId);
|
||||
|
||||
_frames.push_back(frame);
|
||||
} else {
|
||||
@ -546,6 +545,9 @@ void Score::setSpriteCasts() {
|
||||
for (uint16 j = 0; j < _frames[i]->_sprites.size(); j++) {
|
||||
uint16 castId = _frames[i]->_sprites[j]->_castId;
|
||||
|
||||
if (castId == 0)
|
||||
continue;
|
||||
|
||||
if (_vm->getSharedScore() != nullptr && _vm->getSharedScore()->_loadedBitmaps->contains(castId)) {
|
||||
_frames[i]->_sprites[j]->_bitmapCast = _vm->getSharedScore()->_loadedBitmaps->getVal(castId);
|
||||
} else if (_loadedBitmaps->contains(castId)) {
|
||||
|
@ -51,6 +51,13 @@ enum ScriptType {
|
||||
kMaxScriptType = 4 // Sync with score.cpp:45, array scriptTypes[]
|
||||
};
|
||||
|
||||
enum ShapeType {
|
||||
kShapeRectangle,
|
||||
kShapeRoundRect,
|
||||
kShapeOval,
|
||||
kShapeLine
|
||||
};
|
||||
|
||||
enum TextType {
|
||||
kTextTypeAdjustToFit,
|
||||
kTextTypeScrolling,
|
||||
|
Loading…
Reference in New Issue
Block a user