diff options
Diffstat (limited to 'engines')
| -rw-r--r-- | engines/sherlock/people.cpp | 1 | ||||
| -rw-r--r-- | engines/sherlock/people.h | 2 | ||||
| -rw-r--r-- | engines/sherlock/resources.cpp | 10 | ||||
| -rw-r--r-- | engines/sherlock/resources.h | 4 | ||||
| -rw-r--r-- | engines/sherlock/scene.h | 22 | ||||
| -rw-r--r-- | engines/sherlock/screen.cpp | 33 | ||||
| -rw-r--r-- | engines/sherlock/screen.h | 3 | ||||
| -rw-r--r-- | engines/sherlock/surface.cpp | 6 | ||||
| -rw-r--r-- | engines/sherlock/surface.h | 2 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/tattoo_scene.cpp | 108 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/tattoo_scene.h | 7 | 
11 files changed, 174 insertions, 24 deletions
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp index f8dd8e299b..0ef49ffefb 100644 --- a/engines/sherlock/people.cpp +++ b/engines/sherlock/people.cpp @@ -70,6 +70,7 @@ const char *const WALK_LIB_NAMES[10] = {  Person::Person() : Sprite(), _walkLoaded(false), _npcIndex(0), _npcStack(0), _npcPause(false)  {  	Common::fill(&_npcPath[0], &_npcPath[MAX_NPC_PATH], 0); +	_tempX = _tempScaleVal = 0;  }  void Person::clearNPC() { diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h index f4aba5aa98..013727d8ba 100644 --- a/engines/sherlock/people.h +++ b/engines/sherlock/people.h @@ -74,6 +74,8 @@ public:  	bool _npcPause;  	byte _npcPath[MAX_NPC_PATH];  	Common::String _npcName; +	int _tempX; +	int _tempScaleVal;  	// Rose Tattoo fields  	Common::String _walkVGSName;		// Name of walk library person is using diff --git a/engines/sherlock/resources.cpp b/engines/sherlock/resources.cpp index 4e10ba97c9..961286fcf4 100644 --- a/engines/sherlock/resources.cpp +++ b/engines/sherlock/resources.cpp @@ -466,4 +466,14 @@ void ImageFile::decompressFrame(ImageFrame &frame, const byte *src) {  	}  } +/*----------------------------------------------------------------*/ + +int ImageFrame::sDrawXSize(int scaleVal) const { +	error("TODO: sDrawXSize"); +} + +int ImageFrame::sDrawYSize(int scaleVal) const { +	error("TODO: sDrawYSize"); +} +  } // End of namespace Sherlock diff --git a/engines/sherlock/resources.h b/engines/sherlock/resources.h index 659ecf0110..c5b76ac151 100644 --- a/engines/sherlock/resources.h +++ b/engines/sherlock/resources.h @@ -173,6 +173,10 @@ struct ImageFrame {  	Common::Point _offset;  	byte _rleMarker;  	Graphics::Surface _frame; + +	int sDrawXSize(int scaleVal) const; + +	int sDrawYSize(int scaleVal) const;  };  class ImageFile : public Common::Array<ImageFrame> { diff --git a/engines/sherlock/scene.h b/engines/sherlock/scene.h index b5e27ff99d..624e4d3c99 100644 --- a/engines/sherlock/scene.h +++ b/engines/sherlock/scene.h @@ -273,11 +273,6 @@ public:  	int toggleObject(const Common::String &name);  	/** -	 * Draw all objects and characters. -	 */ -	virtual void doBgAnim() = 0; - -	/**  	 * Attempts to find a background shape within the passed bounds. If found,  	 * it will return the shape number, or -1 on failure.  	 */ @@ -300,12 +295,6 @@ public:  	int closestZone(const Common::Point &pt);  	/** -	 * Update the screen back buffer with all of the scene objects which need -	 * to be drawn -	 */ -	void updateBackground(); - -	/**  	 * Synchronize the data for a savegame  	 */  	void synchronize(Common::Serializer &s); @@ -316,6 +305,17 @@ public:  	 *		the scene number being entered  	 */  	void setNPCPath(int npc); +public: +	/** +	 * Draw all objects and characters. +	 */ +	virtual void doBgAnim() = 0; + +	/** +	 * Update the screen back buffer with all of the scene objects which need +	 * to be drawn +	 */ +	virtual void updateBackground();  };  } // End of namespace Sherlock diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp index 350341f608..e826a10fc0 100644 --- a/engines/sherlock/screen.cpp +++ b/engines/sherlock/screen.cpp @@ -253,24 +253,26 @@ void Screen::slamRect(const Common::Rect &r) {  	}  } -void Screen::flushImage(ImageFrame *frame, const Common::Point &pt, -		int16 *xp, int16 *yp, int16 *width, int16 *height) { +void Screen::flushImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,  +		int16 *width, int16 *height) {  	Common::Point imgPos = pt + frame->_offset;  	Common::Rect newBounds(imgPos.x, imgPos.y, imgPos.x + frame->_frame.w, imgPos.y + frame->_frame.h);  	Common::Rect oldBounds(*xp, *yp, *xp + *width, *yp + *height); -	// See if the areas of the old and new overlap, and if so combine the areas -	if (newBounds.intersects(oldBounds)) { -		Common::Rect mergedBounds = newBounds; -		mergedBounds.extend(oldBounds); -		mergedBounds.right += 1; -		mergedBounds.bottom += 1; +	if (!_flushScreen) { +		// See if the areas of the old and new overlap, and if so combine the areas +		if (newBounds.intersects(oldBounds)) { +			Common::Rect mergedBounds = newBounds; +			mergedBounds.extend(oldBounds); +			mergedBounds.right += 1; +			mergedBounds.bottom += 1; -		slamRect(mergedBounds); -	} else { -		// The two areas are independent, so copy them both -		slamRect(newBounds); -		slamRect(oldBounds); +			slamRect(mergedBounds); +		} else { +			// The two areas are independent, so copy them both +			slamRect(newBounds); +			slamRect(oldBounds); +		}  	}  	*xp = newBounds.left; @@ -279,6 +281,11 @@ void Screen::flushImage(ImageFrame *frame, const Common::Point &pt,  	*height = newBounds.height();  } +void Screen::flushScaleImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp, +		int16 *width, int16 *height, int scaleVal) { +	error("TODO"); +} +  void Screen::print(const Common::Point &pt, byte color, const char *formatStr, ...) {  	// Create the string to display  	va_list args; diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h index ae368cf633..949f9debf8 100644 --- a/engines/sherlock/screen.h +++ b/engines/sherlock/screen.h @@ -184,6 +184,9 @@ public:  	void flushImage(ImageFrame *frame, const Common::Point &pt,  		int16 *xp, int16 *yp, int16 *width, int16 *height); +	void flushScaleImage(ImageFrame *frame, const Common::Point &pt, +		int16 *xp, int16 *yp, int16 *width, int16 *height, int scaleVal); +  	/**  	 * Returns the width of a string in pixels  	 */ diff --git a/engines/sherlock/surface.cpp b/engines/sherlock/surface.cpp index 80495a398c..6cf479c962 100644 --- a/engines/sherlock/surface.cpp +++ b/engines/sherlock/surface.cpp @@ -186,4 +186,10 @@ void Surface::setPixels(byte *pixels, int width, int height) {  	_surface.setPixels(pixels);  } +void Surface::maskArea(const ImageFrame &src, const Common::Point &pt, int scrollX) { +	// TODO +	error("TODO: maskArea"); +} + +  } // End of namespace Sherlock diff --git a/engines/sherlock/surface.h b/engines/sherlock/surface.h index ccabf02a23..663f87f37f 100644 --- a/engines/sherlock/surface.h +++ b/engines/sherlock/surface.h @@ -126,6 +126,8 @@ public:  	 */  	void fillRect(const Common::Rect &r, byte color); +	void maskArea(const ImageFrame &src, const Common::Point &pt, int scrollX); +  	/**  	 * Clear the screen  	 */ diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp index f03e791c52..1effd60682 100644 --- a/engines/sherlock/tattoo/tattoo_scene.cpp +++ b/engines/sherlock/tattoo/tattoo_scene.cpp @@ -222,6 +222,114 @@ void TattooScene::doBgAnim() {  	doBgAnimEraseBackground();  } +void TattooScene::updateBackground() { +	People &people = *_vm->_people; +	Screen &screen = *_vm->_screen; + +	Scene::updateBackground(); + +	if (_mask != nullptr) { +		switch (_currentScene) { +		case 7: +			screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x - SHERLOCK_SCREEN_WIDTH, 110), screen._currentScroll); +			screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x, 110), screen._currentScroll); +			screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x + SHERLOCK_SCREEN_WIDTH, 110), screen._currentScroll); +			break; + +		case 8: +			screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x - SHERLOCK_SCREEN_WIDTH, 180), screen._currentScroll); +			screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x, 180), screen._currentScroll); +			screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x + SHERLOCK_SCREEN_WIDTH, 180), screen._currentScroll); +			if (!_vm->readFlags(880)) +				screen._backBuffer1.maskArea((*_mask1)[0], Common::Point(940, 300), screen._currentScroll); +			break; + +		case 18: +			screen._backBuffer1.maskArea((*_mask)[0], Common::Point(0, 203), screen._currentScroll); +			if (!_vm->readFlags(189)) +				screen._backBuffer1.maskArea((*_mask1)[0], Common::Point(124, 239), screen._currentScroll); +			break; + +		case 53: +			screen._backBuffer1.maskArea((*_mask)[0], Common::Point(_maskOffset.x, 110), screen._currentScroll); +			break; + +		case 68: +			screen._backBuffer1.maskArea((*_mask)[0], Common::Point(0, 203), screen._currentScroll); +			screen._backBuffer1.maskArea((*_mask1)[0], Common::Point(124, 239), screen._currentScroll); +			break; + +		default: +			break; +		} +	} + +	screen._flushScreen = true; + +	for (int idx = 0; idx < MAX_CHARACTERS; ++idx) { +		Person &p = people[idx]; + +		if (p._type != INVALID) { +			if (_goToScene == -1 || _cAnim.size() == 0) { +				if (p._type == REMOVE) { +					screen.slamArea(p._oldPosition.x, p._oldPosition.y, p._oldSize.x, p._oldSize.y); +					p._type = INVALID; +				} else { +					if (p._tempScaleVal == 256) { +						screen.flushImage(p._imageFrame, Common::Point(p._tempX, p._position.y / FIXED_INT_MULTIPLIER +							- p._imageFrame->_width), &p._oldPosition.x, &p._oldPosition.y, &p._oldSize.x, &p._oldSize.y); +					}  else { +						int ts = p._imageFrame->sDrawYSize(p._tempScaleVal); +						int ty = p._position.y / FIXED_INT_MULTIPLIER - ts; +						screen.flushScaleImage(p._imageFrame, Common::Point(p._tempX, ty), +							&p._oldPosition.x, &p._oldPosition.y, &p._oldSize.x, &p._oldSize.y, p._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; +			} +		} +	} + +	screen._flushScreen = false; +} + +  } // End of namespace Tattoo  } // End of namespace Sherlock diff --git a/engines/sherlock/tattoo/tattoo_scene.h b/engines/sherlock/tattoo/tattoo_scene.h index 34e87f41a8..5e26eaa455 100644 --- a/engines/sherlock/tattoo/tattoo_scene.h +++ b/engines/sherlock/tattoo/tattoo_scene.h @@ -56,6 +56,13 @@ public:  	 * Draw all objects and characters.  	 */  	virtual void doBgAnim(); + +	/** +	 * Update the screen back buffer with all of the scene objects which need +	 * to be drawn +	 */ +	virtual void updateBackground(); +  };  } // End of namespace Tattoo  | 
