[Scummvm-cvs-logs] scummvm master -> 45c9b429968133f0e77a5d15ae2ad116726a4637

dreammaster dreammaster at scummvm.org
Sun May 31 23:56:55 CEST 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
45c9b42996 SHERLOCK: Implement remainder of RT doBgAnim


Commit: 45c9b429968133f0e77a5d15ae2ad116726a4637
    https://github.com/scummvm/scummvm/commit/45c9b429968133f0e77a5d15ae2ad116726a4637
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-05-31T17:55:56-04:00

Commit Message:
SHERLOCK: Implement remainder of RT doBgAnim

Changed paths:
    engines/sherlock/objects.cpp
    engines/sherlock/objects.h
    engines/sherlock/people.cpp
    engines/sherlock/people.h
    engines/sherlock/screen.cpp
    engines/sherlock/screen.h
    engines/sherlock/sherlock.cpp
    engines/sherlock/sherlock.h
    engines/sherlock/tattoo/tattoo.cpp
    engines/sherlock/tattoo/tattoo.h
    engines/sherlock/tattoo/tattoo_scene.cpp
    engines/sherlock/tattoo/tattoo_scene.h
    engines/sherlock/tattoo/tattoo_user_interface.cpp
    engines/sherlock/tattoo/tattoo_user_interface.h



diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 8818f80..4527c4e 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -364,6 +364,10 @@ void Sprite::checkSprite() {
 	}
 }
 
+const Common::Rect Sprite::getOldBounds() const {
+	return Common::Rect(_oldPosition.x, _oldPosition.y, _oldPosition.x + _oldSize.x, _oldPosition.y + _oldSize.y);
+}
+
 /*----------------------------------------------------------------*/
 
 void WalkSequence::load(Common::SeekableReadStream &s) {
diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h
index d671066..54cea69 100644
--- a/engines/sherlock/objects.h
+++ b/engines/sherlock/objects.h
@@ -242,6 +242,11 @@ public:
 	* Return frame height
 	*/
 	int frameHeight() const { return _imageFrame ? _imageFrame->_frame.h : 0; }
+
+	/**
+	 * Returns the old bounsd for the sprite from the previous frame
+	 */
+	const Common::Rect getOldBounds() const;
 };
 
 enum { OBJ_BEHIND = 1, OBJ_FLIPPED = 2, OBJ_FORWARD = 4, TURNON_OBJ = 0x20, TURNOFF_OBJ = 0x40 };
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index 0ef49ff..7686d52 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -79,6 +79,10 @@ void Person::clearNPC() {
 	_npcName = "";
 }
 
+void Person::updateNPC() {
+	// TODO
+}
+
 /*----------------------------------------------------------------*/
 
 People::People(SherlockEngine *vm) : _vm(vm), _player(_data[0]) {
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index 013727d..32faee5 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -76,6 +76,7 @@ public:
 	Common::String _npcName;
 	int _tempX;
 	int _tempScaleVal;
+	bool _updateNPCPath;
 
 	// Rose Tattoo fields
 	Common::String _walkVGSName;		// Name of walk library person is using
@@ -86,6 +87,11 @@ public:
 	 * Clear the NPC related data
 	 */
 	void clearNPC();
+
+	/**
+	 * Update the NPC
+	 */
+	void updateNPC();
 };
 
 class SherlockEngine;
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index 708493c..6c59c3b 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -306,6 +306,18 @@ void Screen::flushScaleImage(ImageFrame *frame, const Common::Point &pt, int16 *
 	*height = newBounds.height();
 }
 
+void Screen::flushImage(ImageFrame *frame, const Common::Point &pt, Common::Rect &newBounds, int scaleVal) {
+	Common::Point newPos, newSize;
+
+	if (scaleVal == 256)
+		flushImage(frame, pt, &newPos.x, &newPos.y, &newSize.x, &newSize.y);
+	else
+		flushScaleImage(frame, pt, &newPos.x, &newPos.y, &newSize.x, &newSize.y, scaleVal);
+
+	// Transfer the pos and size amounts into a single bounds rect
+	newBounds = Common::Rect(newPos.x, newPos.y, newPos.x + newSize.x, newPos.y + newSize.y);
+}
+
 void Screen::blockMove(const Common::Rect &r, const Common::Point &scrollPos) {
 	Common::Rect bounds = r;
 	bounds.translate(scrollPos.x, scrollPos.y);
diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h
index 2774673..7d49c52 100644
--- a/engines/sherlock/screen.h
+++ b/engines/sherlock/screen.h
@@ -190,6 +190,11 @@ public:
 		int16 *width, int16 *height, int scaleVal);
 
 	/**
+	 * Variation of flushImage/flushScaleImage that takes in and updates a rect
+	 */
+	void flushImage(ImageFrame *frame, const Common::Point &pt, Common::Rect &newBounds, int scaleVal);
+
+	/**
 	 * Copies data from the back buffer to the screen, taking into account scrolling position
 	 */
 	void blockMove(const Common::Rect &r, const Common::Point &scrollPos);
diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp
index 5ebf9e5..67a1552 100644
--- a/engines/sherlock/sherlock.cpp
+++ b/engines/sherlock/sherlock.cpp
@@ -50,6 +50,7 @@ SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gam
 	_canLoadSave = false;
 	_showOriginalSavesDialog = false;
 	_interactiveFl = true;
+	_fastMode = false;
 }
 
 SherlockEngine::~SherlockEngine() {
diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h
index 16dacd3..c233373 100644
--- a/engines/sherlock/sherlock.h
+++ b/engines/sherlock/sherlock.h
@@ -123,6 +123,7 @@ public:
 	bool _canLoadSave;
 	bool _showOriginalSavesDialog;
 	bool _interactiveFl;
+	bool _fastMode;
 public:
 	SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc);
 	virtual ~SherlockEngine();
diff --git a/engines/sherlock/tattoo/tattoo.cpp b/engines/sherlock/tattoo/tattoo.cpp
index 368b24b..765016b 100644
--- a/engines/sherlock/tattoo/tattoo.cpp
+++ b/engines/sherlock/tattoo/tattoo.cpp
@@ -72,6 +72,10 @@ void TattooEngine::drawCredits() {
 	// TODO
 }
 
+void TattooEngine::blitCredits() {
+	// TODO
+}
+
 void TattooEngine::eraseCredits() {
 	// TODO
 }
diff --git a/engines/sherlock/tattoo/tattoo.h b/engines/sherlock/tattoo/tattoo.h
index bb6310d..28fa77f 100644
--- a/engines/sherlock/tattoo/tattoo.h
+++ b/engines/sherlock/tattoo/tattoo.h
@@ -59,6 +59,11 @@ public:
 	void drawCredits();
 
 	/**
+	 * Blit the drawn credits to the screen
+	 */
+	void blitCredits();
+
+	/**
 	 * Erase any area of the screen covered by credits
 	 */
 	void eraseCredits();
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index cd86a58..8a3c586 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -196,15 +196,15 @@ void TattooScene::doBgAnimEraseBackground() {
 }
 
 void TattooScene::doBgAnim() {
+	TattooEngine &vm = *(TattooEngine *)_vm;
+	Events &events = *_vm->_events;
+	People &people = *_vm->_people;
+	Screen &screen = *_vm->_screen;
+	Talk &talk = *_vm->_talk;
 	TattooUserInterface &ui = *((TattooUserInterface *)_vm->_ui);
 
 	doBgAnimCheckCursor();
 
-//	Events &events = *_vm->_events;
-	People &people = *_vm->_people;
-//	Scene &scene = *_vm->_scene;
-	Screen &screen = *_vm->_screen;
-	Talk &talk = *_vm->_talk;
 
 	screen.setDisplayBounds(Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCENE_HEIGHT));
 	talk._talkToAbort = false;
@@ -226,6 +226,23 @@ void TattooScene::doBgAnim() {
 	doBgAnimUpdateBgObjectsAndAnim();
 
 	ui.drawInterface();
+
+	doBgAnimDrawSprites();
+
+	if (vm._creditsActive)
+		vm.blitCredits();
+
+	if (!vm._fastMode)
+		events.wait(3);
+
+	screen._flushScreen = false;
+	_doBgAnimDone = false;
+	ui._drawMenu = false;
+
+	for (uint idx = 1; idx < MAX_CHARACTERS; ++idx) {
+		if (people[idx]._updateNPCPath)
+			people[idx].updateNPC();
+	}
 }
 
 void TattooScene::doBgAnimUpdateBgObjectsAndAnim() {
@@ -288,7 +305,6 @@ void TattooScene::doBgAnimUpdateBgObjectsAndAnim() {
 	}
 }
 
-
 void TattooScene::updateBackground() {
 	People &people = *_vm->_people;
 	Screen &screen = *_vm->_screen;
@@ -397,6 +413,83 @@ void TattooScene::updateBackground() {
 	screen._flushScreen = false;
 }
 
+void TattooScene::doBgAnimDrawSprites() {
+	People &people = *_vm->_people;
+	Screen &screen = *_vm->_screen;
+	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
+
+	for (uint idx = 0; idx < MAX_CHARACTERS; ++idx) {
+		Person &person = people[idx];
+
+		if (person._type != INVALID) {
+			if (_goToScene == -1 || _cAnim.size() == 0) {
+				if (person._type == REMOVE) {
+					screen.slamRect(person.getOldBounds());
+					person._type = INVALID;
+				} else {
+					if (person._tempScaleVal == 256) {
+						screen.flushImage(person._imageFrame, Common::Point(person._tempX, person._position.y / FIXED_INT_MULTIPLIER
+							- person.frameHeight()), &person._oldPosition.x, &person._oldPosition.y, &person._oldSize.x, &person._oldSize.y);
+					}  else {
+						int ts = person._imageFrame->sDrawYSize(person._tempScaleVal);
+						int ty  = person._position.y / FIXED_INT_MULTIPLIER - ts;
+						screen.flushScaleImage(person._imageFrame, Common::Point(person._tempX, ty),
+							&person._oldPosition.x, &person._oldPosition.y, &person._oldSize.x, &person._oldSize.y, person._tempScaleVal);
+					}
+				}
+			}
+		}
+	}
+
+	for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
+		Object &obj = _bgShapes[idx];
+
+		if (obj._type == ACTIVE_BG_SHAPE || obj._type == REMOVE) {
+			if (_goToScene == -1) {
+				if (obj._scaleVal == 256)
+					screen.flushImage(obj._imageFrame, obj._position, &obj._oldPosition.x, &obj._oldPosition.y, 
+					&obj._oldSize.x, &obj._oldSize.y);
+				else
+					screen.flushScaleImage(obj._imageFrame, obj._position, &obj._oldPosition.x, &obj._oldPosition.y, 
+					&obj._oldSize.x, &obj._oldSize.y, obj._scaleVal);
+
+				if (obj._type == REMOVE)
+					obj._type = INVALID;
+			}
+		}
+	}
+
+	for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
+		Object &obj = _bgShapes[idx];
+
+		if (_goToScene == -1) {
+			if (obj._type == NO_SHAPE && (obj._flags & 1) == 0) {
+				screen.slamRect(obj.getNoShapeBounds());
+				screen.slamRect(obj.getOldBounds());
+			} else if (obj._type == HIDE_SHAPE) {
+				if (obj._scaleVal == 256)
+					screen.flushImage(obj._imageFrame, obj._position, &obj._oldPosition.x, &obj._oldPosition.y,
+						&obj._oldSize.x, &obj._oldSize.y);
+				else
+					screen.flushScaleImage(obj._imageFrame, obj._position, &obj._oldPosition.x, &obj._oldPosition.y,
+						&obj._oldSize.x, &obj._oldSize.y, obj._scaleVal);
+				obj._type = HIDDEN;
+			}
+		}
+	}
+
+	if (_activeCAnim._images != nullptr || _activeCAnim._zPlacement == REMOVE) {
+		if (_activeCAnim._zPlacement != REMOVE) {
+			screen.flushImage(_activeCAnim._imageFrame, _activeCAnim._position, _activeCAnim._oldBounds, _activeCAnim._scaleVal);
+		} else {
+			screen.slamArea(_activeCAnim._removeBounds.left - ui._currentScroll.x, _activeCAnim._removeBounds.top, 
+				_activeCAnim._removeBounds.width(), _activeCAnim._removeBounds.height());
+			_activeCAnim._removeBounds.left = _activeCAnim._removeBounds.top = 0;
+			_activeCAnim._removeBounds.right = _activeCAnim._removeBounds.bottom = 0;
+			_activeCAnim._zPlacement = -1;		// Reset _zPlacement so we don't REMOVE again
+		}
+	}
+}
 
 } // End of namespace Tattoo
 
diff --git a/engines/sherlock/tattoo/tattoo_scene.h b/engines/sherlock/tattoo/tattoo_scene.h
index de28306..91e7ad4 100644
--- a/engines/sherlock/tattoo/tattoo_scene.h
+++ b/engines/sherlock/tattoo/tattoo_scene.h
@@ -44,6 +44,8 @@ private:
 	 * Update the background objects and canimations as part of doBgAnim
 	 */
 	void doBgAnimUpdateBgObjectsAndAnim();
+
+	void doBgAnimDrawSprites();
 protected:
 	/**
 	 * Checks all the background shapes. If a background shape is animating,
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index e1568b4..6779cc4 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.cpp
+++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp
@@ -34,6 +34,7 @@ TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm)
 	_tagBuffer = nullptr;
 	_invGraphic = nullptr;
 	_scrollSize = _scrollSpeed = 0;
+	_drawMenu = false;
 }
 
 void TattooUserInterface::initScrollVars() {
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h
index fea9ca8..db6a04f 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.h
+++ b/engines/sherlock/tattoo/tattoo_user_interface.h
@@ -53,6 +53,7 @@ private:
 public:
 	Common::Point _currentScroll, _targetScroll;
 	int _scrollSize, _scrollSpeed;
+	bool _drawMenu;
 public:
 	TattooUserInterface(SherlockEngine *vm);
 






More information about the Scummvm-git-logs mailing list