From 62402e743ece682c19f986ab25c9941686262ef7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 7 Jun 2010 10:17:44 +0000 Subject: Added extra positioning and dummy depths surface so that the introduction cutscene now starts up svn-id: r49480 --- engines/m4/mads_anim.cpp | 11 ++--------- engines/m4/mads_views.cpp | 25 +++++++++++++------------ engines/m4/mads_views.h | 7 ++++--- 3 files changed, 19 insertions(+), 24 deletions(-) (limited to 'engines') diff --git a/engines/m4/mads_anim.cpp b/engines/m4/mads_anim.cpp index 4400dbf094..e1dbbaf106 100644 --- a/engines/m4/mads_anim.cpp +++ b/engines/m4/mads_anim.cpp @@ -446,6 +446,7 @@ AnimviewView::AnimviewView(MadsM4Engine *vm): MadsView::_bgSurface = &_backgroundSurface; MadsView::_depthSurface = &_codeSurface; + MadsView::_yOffset = MADS_Y_OFFSET; _screenType = VIEWID_ANIMVIEW; _screenFlags.layer = LAYER_BACKGROUND; @@ -512,14 +513,6 @@ void AnimviewView::updateState() { if (!_script) return; - // Only update state if wait period has expired - if (_previousUpdate > 0) { - if (g_system->getMillis() - _previousUpdate < 100) - return; - - _previousUpdate = g_system->getMillis(); - } - if (!_activeAnimation) { readNextCommand(); assert(_activeAnimation); @@ -579,7 +572,7 @@ void AnimviewView::readNextCommand() { _backgroundSurface.loadBackground(_activeAnimation->roomNumber()); _codeSurface.setSize(_backgroundSurface.width(), _backgroundSurface.height()); - _codeSurface.clear(); + _codeSurface.fillRect(_codeSurface.bounds(), 0xff); _spriteSlots.fullRefresh(); /* diff --git a/engines/m4/mads_views.cpp b/engines/m4/mads_views.cpp index cfcb113dcd..c7b4f76a00 100644 --- a/engines/m4/mads_views.cpp +++ b/engines/m4/mads_views.cpp @@ -170,7 +170,7 @@ void MadsSpriteSlots::drawBackground() { _owner._dirtyAreas[i].active = false; } -void MadsSpriteSlots::drawForeground(View *view) { +void MadsSpriteSlots::drawForeground(View *view, int yOffset) { DepthList depthList; // Get a list of sprite object depths for active objects @@ -196,7 +196,7 @@ void MadsSpriteSlots::drawForeground(View *view) { // Minimalised drawing assert(slot.spriteListIndex < (int)_sprites.size()); M4Sprite *spr = spriteSet.getFrame((slot.frameNumber & 0x7fff) - 1); - spr->copyTo(view, slot.xp, slot.yp, slot.depth, _owner._depthSurface, slot.scale, 0); + spr->copyTo(view, slot.xp, slot.yp + yOffset, slot.depth, _owner._depthSurface, slot.scale, 0); } else { int xp, yp; M4Sprite *spr = spriteSet.getFrame(slot.frameNumber - 1); @@ -211,10 +211,10 @@ void MadsSpriteSlots::drawForeground(View *view) { if (slot.depth > 1) { // Draw the frame with depth processing - spr->copyTo(view, xp, yp, slot.depth, _owner._depthSurface, 100, 0); + spr->copyTo(view, xp, yp + yOffset, slot.depth, _owner._depthSurface, 100, 0); } else { // No depth, so simply draw the image - spr->copyTo(view, xp, yp, 0); + spr->copyTo(view, xp, yp + yOffset, 0); } } } @@ -326,12 +326,12 @@ void MadsTextDisplay::setDirtyAreas2() { } } -void MadsTextDisplay::draw(View *view) { +void MadsTextDisplay::draw(View *view, int yOffset) { for (uint idx = 0; idx < _entries.size(); ++idx) { if (_entries[idx].active && (_entries[idx].expire >= 0)) { _entries[idx].font->setColours(_entries[idx].colour1, _entries[idx].colour2, 0); _entries[idx].font->writeString(view, _entries[idx].msg, - _entries[idx].bounds.left, _entries[idx].bounds.top, _entries[idx].bounds.width(), + _entries[idx].bounds.left, _entries[idx].bounds.top + yOffset, _entries[idx].bounds.width(), _entries[idx].spacing); } } @@ -855,10 +855,10 @@ void MadsDirtyAreas::mergeAreas(int idx1, int idx2) { da1.textActive = true; } -void MadsDirtyAreas::copy(M4Surface *dest, M4Surface *src) { +void MadsDirtyAreas::copy(M4Surface *dest, M4Surface *src, int yOffset) { for (uint i = 0; i < _entries.size(); ++i) { if (_entries[i].active && _entries[i].bounds.isValidRect()) - src->copyTo(dest, _entries[i].bounds, _entries[i].bounds.left, _entries[i].bounds.top); + src->copyTo(dest, _entries[i].bounds, _entries[i].bounds.left, _entries[i].bounds.top + yOffset); } } @@ -1180,7 +1180,8 @@ MadsView::MadsView(View *view): _view(view), _dynamicHotspots(*this), _sequenceL _abortTimers2 = 0; _abortTimersMode = ABORTMODE_0; _abortTimersMode2 = ABORTMODE_0; - + + _yOffset = 0; _depthSurface = NULL; _bgSurface = NULL; _sceneAnimation = new MadsAnimation(_vm, this); @@ -1201,7 +1202,7 @@ void MadsView::refresh() { _dirtyAreas.merge(1, DIRTY_AREAS_SIZE); // Copy dirty areas to the main display surface - _dirtyAreas.copy(_view, _bgSurface); + _dirtyAreas.copy(_view, _bgSurface, _yOffset); // Handle dirty areas for foreground objects _spriteSlots.setDirtyAreas(); @@ -1209,10 +1210,10 @@ void MadsView::refresh() { _dirtyAreas.merge(1, DIRTY_AREAS_SIZE); // Draw foreground sprites - _spriteSlots.drawForeground(_view); + _spriteSlots.drawForeground(_view, _yOffset); // Draw text elements onto the view - _textDisplay.draw(_view); + _textDisplay.draw(_view, _yOffset); // Remove any sprite slots that are no longer needed _spriteSlots.cleanUp(); diff --git a/engines/m4/mads_views.h b/engines/m4/mads_views.h index f44d640c8b..29adb7048a 100644 --- a/engines/m4/mads_views.h +++ b/engines/m4/mads_views.h @@ -98,7 +98,7 @@ public: void deleteTimer(int seqIndex); void drawBackground(); - void drawForeground(View *view); + void drawForeground(View *view, int yOffset); void setDirtyAreas(); void fullRefresh(); void cleanUp(); @@ -139,7 +139,7 @@ public: int add(int xp, int yp, uint fontColour, int charSpacing, const char *msg, Font *font); void clear(); - void draw(View *view); + void draw(View *view, int yOffset); void setDirtyAreas(); void setDirtyAreas2(); void cleanUp(); @@ -289,7 +289,7 @@ public: void merge(int startIndex, int count); bool intersects(int idx1, int idx2); void mergeAreas(int idx1, int idx2); - void copy(M4Surface *dest, M4Surface *src); + void copy(M4Surface *dest, M4Surface *src, int yOffset); }; enum SpriteAnimType {ANIMTYPE_CYCLED = 1, ANIMTYPE_REVERSIBLE = 2}; @@ -398,6 +398,7 @@ public: M4Surface *_depthSurface; M4Surface *_bgSurface; + int _yOffset; public: MadsView(View *view); ~MadsView(); -- cgit v1.2.3