diff options
| author | Paul Gilbert | 2015-05-27 20:26:40 -0400 | 
|---|---|---|
| committer | Paul Gilbert | 2015-05-27 20:26:40 -0400 | 
| commit | 0d4163c6e932bed2b85843f6ab3b5066d0353df6 (patch) | |
| tree | c2c23e06cf5e60cdd1bd205a421469b902646d0b | |
| parent | 483a72b8b840a9ebbb7009b3dcd20878d0ffad58 (diff) | |
| download | scummvm-rg350-0d4163c6e932bed2b85843f6ab3b5066d0353df6.tar.gz scummvm-rg350-0d4163c6e932bed2b85843f6ab3b5066d0353df6.tar.bz2 scummvm-rg350-0d4163c6e932bed2b85843f6ab3b5066d0353df6.zip  | |
SHERLOCK: Implemented initial background clearing of RT doBgAnim
| -rw-r--r-- | engines/sherlock/inventory.cpp | 4 | ||||
| -rw-r--r-- | engines/sherlock/scene.cpp | 511 | ||||
| -rw-r--r-- | engines/sherlock/scene.h | 22 | ||||
| -rw-r--r-- | engines/sherlock/screen.h | 2 | ||||
| -rw-r--r-- | engines/sherlock/settings.cpp | 4 | ||||
| -rw-r--r-- | engines/sherlock/settings.h | 5 | ||||
| -rw-r--r-- | engines/sherlock/talk.cpp | 2 | ||||
| -rw-r--r-- | engines/sherlock/talk.h | 4 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/tattoo.cpp | 15 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/tattoo.h | 17 | ||||
| -rw-r--r-- | engines/sherlock/user_interface.cpp | 53 | ||||
| -rw-r--r-- | engines/sherlock/user_interface.h | 19 | 
12 files changed, 433 insertions, 225 deletions
diff --git a/engines/sherlock/inventory.cpp b/engines/sherlock/inventory.cpp index bbb7c75aea..7ec0b6421d 100644 --- a/engines/sherlock/inventory.cpp +++ b/engines/sherlock/inventory.cpp @@ -244,7 +244,7 @@ void Inventory::drawInventory(InvNewMode mode) {  	}  	assert(IS_SERRATED_SCALPEL); -	((ScalpelUserInterface *)_vm->_ui)->_oldUse = -1; +	((Scalpel::ScalpelUserInterface *)_vm->_ui)->_oldUse = -1;  }  void Inventory::invCommands(bool slamIt) { @@ -324,7 +324,7 @@ void Inventory::refreshInv() {  	Screen &screen = *_vm->_screen;  	Talk &talk = *_vm->_talk; -	ScalpelUserInterface &ui = *(ScalpelUserInterface *)_vm->_ui; +	Scalpel::ScalpelUserInterface &ui = *(Scalpel::ScalpelUserInterface *)_vm->_ui;  	ui._invLookFlag = true;  	freeInv(); diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp index 41aafff8c3..18690fb414 100644 --- a/engines/sherlock/scene.cpp +++ b/engines/sherlock/scene.cpp @@ -24,6 +24,7 @@  #include "sherlock/sherlock.h"  #include "sherlock/scalpel/scalpel.h"  #include "sherlock/screen.h" +#include "sherlock/tattoo/tattoo.h"  namespace Sherlock { @@ -152,9 +153,9 @@ void ScaleZone::load(Common::SeekableReadStream &s) {  Scene *Scene::init(SherlockEngine *vm) {  	if (vm->getGameID() == GType_SerratedScalpel) -		return new ScalpelScene(vm); +		return new Scalpel::ScalpelScene(vm);  	else -		return new TattooScene(vm); +		return new Tattoo::TattooScene(vm);  }  Scene::Scene(SherlockEngine *vm): _vm(vm) { @@ -1197,20 +1198,209 @@ int Scene::startCAnim(int cAnimNum, int playRate) {  	return 1;  } -void Scene::doBgAnim() { +int Scene::findBgShape(const Common::Rect &r) { +	if (!_doBgAnimDone) +		// New frame hasn't been drawn yet +		return -1; + +	for (int idx = (int)_bgShapes.size() - 1; idx >= 0; --idx) { +		Object &o = _bgShapes[idx]; +		if (o._type != INVALID && o._type != NO_SHAPE && o._type != HIDDEN +			&& o._aType <= PERSON) { +			if (r.intersects(o.getNewBounds())) +				return idx; +		} else if (o._type == NO_SHAPE) { +			if (r.intersects(o.getNoShapeBounds())) +				return idx; +		} +	} + +	return -1; +} + +int Scene::checkForZones(const Common::Point &pt, int zoneType) { +	int matches = 0; + +	for (uint idx = 0; idx < _bgShapes.size(); ++idx) { +		Object &o = _bgShapes[idx]; +		if ((o._aType == zoneType && o._type != INVALID) && o._type != HIDDEN) { +			Common::Rect r = o._type == NO_SHAPE ? o.getNoShapeBounds() : o.getNewBounds(); + +			if (r.contains(pt)) { +				++matches; +				o.setFlagsAndToggles(); +				_vm->_talk->talkTo(o._use[0]._target); +			} +		} +	} + +	return matches; +} + +int Scene::whichZone(const Common::Point &pt) { +	for (uint idx = 0; idx < _zones.size(); ++idx) { +		if (_zones[idx].contains(pt)) +			return idx; +	} + +	return -1; +} + +int Scene::closestZone(const Common::Point &pt) { +	int dist = 1000; +	int zone = -1; + +	for (uint idx = 0; idx < _zones.size(); ++idx) { +		Common::Point zc((_zones[idx].left + _zones[idx].right) / 2, +			(_zones[idx].top + _zones[idx].bottom) / 2); +		int d = ABS(zc.x - pt.x) + ABS(zc.y - pt.y); + +		if (d < dist) { +			// Found a closer zone +			dist = d; +			zone = idx; +		} +	} + +	return zone; +} + +void Scene::synchronize(Common::Serializer &s) { +	if (s.isSaving()) +		saveSceneStatus(); + +	if (s.isSaving()) { +		s.syncAsSint16LE(_currentScene); +	} else { +		s.syncAsSint16LE(_goToScene); +		_loadingSavedGame = true; +	} + +	for (int sceneNum = 0; sceneNum < SCENES_COUNT; ++sceneNum) { +		for (int flag = 0; flag < 65; ++flag) { +			s.syncAsByte(_sceneStats[sceneNum][flag]); +		} +	} +} + +void Scene::setNPCPath(int npc) { +	People &people = *_vm->_people; +	Talk &talk = *_vm->_talk; +	 +	people[npc].clearNPC(); +	people[npc]._name = Common::String::format("WATS%.2dA", _currentScene); + +	// If we're in the middle of a script that will continue once the scene is loaded, +	// return without calling the path script +	if (talk._scriptMoreFlag == 1 || talk._scriptMoreFlag == 3) +		return; + +	// Turn off all the NPCs, since the talk script will turn them back on as needed +	for (uint idx = 0; idx < MAX_NPC; ++idx) +		people[idx + 1]._type = INVALID; + +	// Call the path script for the scene +	Common::String pathFile = Common::String::format("PATH%.2dA", _currentScene); +	talk.talkTo(pathFile); +} + +void Scene::checkBgShapes() { +	People &people = *_vm->_people; +	Person &holmes = people._player; +	Common::Point pt(holmes._position.x / FIXED_INT_MULTIPLIER, holmes._position.y / FIXED_INT_MULTIPLIER); + +	// Iterate through the shapes +	for (uint idx = 0; idx < _bgShapes.size(); ++idx) { +		Object &obj = _bgShapes[idx]; +		if (obj._type == ACTIVE_BG_SHAPE || (IS_SERRATED_SCALPEL && obj._type == STATIC_BG_SHAPE)) { +			if ((obj._flags & 5) == 1) { +				obj._misc = (pt.y < (obj._position.y + obj.frameHeight() - 1)) ? +					NORMAL_FORWARD : NORMAL_BEHIND; +			} else if (!(obj._flags & OBJ_BEHIND)) { +				obj._misc = BEHIND; +			} else if (obj._flags & OBJ_FORWARD) { +				obj._misc = FORWARD; +			} +		} +	} +} + +/*----------------------------------------------------------------*/ + +namespace Scalpel { + +void ScalpelScene::checkBgShapes() { +	People &people = *_vm->_people; +	Person &holmes = people._player; +	Common::Point pt(holmes._position.x / FIXED_INT_MULTIPLIER, holmes._position.y / FIXED_INT_MULTIPLIER); + +	// Call the base scene method to handle bg shapes +	Scene::checkBgShapes(); + +	// Iterate through the canim list +	for (uint idx = 0; idx < _canimShapes.size(); ++idx) { +		Object &obj = _canimShapes[idx]; +		if (obj._type == STATIC_BG_SHAPE || obj._type == ACTIVE_BG_SHAPE) { +			if ((obj._flags & 5) == 1) { +				obj._misc = (pt.y < (obj._position.y + obj._imageFrame->_frame.h - 1)) ? +				NORMAL_FORWARD : NORMAL_BEHIND; +			} else if (!(obj._flags & 1)) { +				obj._misc = BEHIND; +			} else if (obj._flags & 4) { +				obj._misc = FORWARD; +			} +		} +	} +} + +void ScalpelScene::doBgAnimCheckCursor() { +	Inventory &inv = *_vm->_inventory; +	Events &events = *_vm->_events; +	Sound &sound = *_vm->_sound; +	UserInterface &ui = *_vm->_ui; +	Common::Point mousePos = events.mousePos(); + +	if (ui._menuMode == LOOK_MODE) { +		if (mousePos.y > CONTROLS_Y1) +			events.setCursor(ARROW); +		else if (mousePos.y < CONTROLS_Y) +			events.setCursor(MAGNIFY); +	} + +	// Check for setting magnifying glass cursor +	if (ui._menuMode == INV_MODE || ui._menuMode == USE_MODE || ui._menuMode == GIVE_MODE) { +		if (inv._invMode == INVMODE_LOOK) { +			// Only show Magnifying glass cursor if it's not on the inventory command line +			if (mousePos.y < CONTROLS_Y || mousePos.y >(CONTROLS_Y1 + 13)) +				events.setCursor(MAGNIFY); +			else +				events.setCursor(ARROW); +		} else { +			events.setCursor(ARROW); +		} +	} + +	if (sound._diskSoundPlaying && !*sound._soundIsOn) { +		// Loaded sound just finished playing +		sound.freeDigiSound(); +	} +} + +void ScalpelScene::doBgAnim() { +	Scalpel::ScalpelEngine &vm = *((Scalpel::ScalpelEngine *)_vm);  	Events &events = *_vm->_events;  	People &people = *_vm->_people;  	Screen &screen = *_vm->_screen;  	Talk &talk = *_vm->_talk; -	Common::Point mousePos = events.mousePos(); -	events.animateCursorIfNeeded();  	screen.setDisplayBounds(Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCENE_HEIGHT));  	talk._talkToAbort = false;  	if (_restoreFlag) { -		if (people[AL]._type == CHARACTER) -			people[AL].checkSprite(); +		for (int idx = 0; idx < MAX_CHARACTERS; ++idx) { +			if (people[idx]._type == CHARACTER) +				people[idx].checkSprite(); +		}  		for (uint idx = 0; idx < _bgShapes.size(); ++idx) {  			if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE) @@ -1225,8 +1415,8 @@ void Scene::doBgAnim() {  				_canimShapes[idx].checkObject();  		} -		if (_currentScene == 12 && IS_SERRATED_SCALPEL) -			((Scalpel::ScalpelEngine *)_vm)->eraseMirror12(); +		if (_currentScene == 12) +			vm.eraseMirror12();  		// Restore the back buffer from the back buffer 2 in the changed area  		Common::Rect bounds(people[AL]._oldPosition.x, people[AL]._oldPosition.y, @@ -1297,8 +1487,8 @@ void Scene::doBgAnim() {  	// Flag the bg shapes which need to be redrawn  	checkBgShapes(); -	if (_currentScene == 12 && IS_SERRATED_SCALPEL) -		((Scalpel::ScalpelEngine *)_vm)->doMirror12(); +	if (_currentScene == 12) +		vm.doMirror12();  	// Draw all active shapes which are behind the person  	for (uint idx = 0; idx < _bgShapes.size(); ++idx) { @@ -1407,8 +1597,8 @@ void Scene::doBgAnim() {  			}  		} -		if (_currentScene == 12 && IS_SERRATED_SCALPEL) -			((Scalpel::ScalpelEngine *)_vm)->flushMirror12(); +		if (_currentScene == 12) +			vm.flushMirror12();  		for (uint idx = 0; idx < _bgShapes.size(); ++idx) {  			Object &o = _bgShapes[idx]; @@ -1485,199 +1675,16 @@ void Scene::doBgAnim() {  	}  } -int Scene::findBgShape(const Common::Rect &r) { -	if (!_doBgAnimDone) -		// New frame hasn't been drawn yet -		return -1; - -	for (int idx = (int)_bgShapes.size() - 1; idx >= 0; --idx) { -		Object &o = _bgShapes[idx]; -		if (o._type != INVALID && o._type != NO_SHAPE && o._type != HIDDEN -			&& o._aType <= PERSON) { -			if (r.intersects(o.getNewBounds())) -				return idx; -		} else if (o._type == NO_SHAPE) { -			if (r.intersects(o.getNoShapeBounds())) -				return idx; -		} -	} - -	return -1; -} - -int Scene::checkForZones(const Common::Point &pt, int zoneType) { -	int matches = 0; - -	for (uint idx = 0; idx < _bgShapes.size(); ++idx) { -		Object &o = _bgShapes[idx]; -		if ((o._aType == zoneType && o._type != INVALID) && o._type != HIDDEN) { -			Common::Rect r = o._type == NO_SHAPE ? o.getNoShapeBounds() : o.getNewBounds(); - -			if (r.contains(pt)) { -				++matches; -				o.setFlagsAndToggles(); -				_vm->_talk->talkTo(o._use[0]._target); -			} -		} -	} - -	return matches; -} - -int Scene::whichZone(const Common::Point &pt) { -	for (uint idx = 0; idx < _zones.size(); ++idx) { -		if (_zones[idx].contains(pt)) -			return idx; -	} - -	return -1; -} - -int Scene::closestZone(const Common::Point &pt) { -	int dist = 1000; -	int zone = -1; - -	for (uint idx = 0; idx < _zones.size(); ++idx) { -		Common::Point zc((_zones[idx].left + _zones[idx].right) / 2, -			(_zones[idx].top + _zones[idx].bottom) / 2); -		int d = ABS(zc.x - pt.x) + ABS(zc.y - pt.y); - -		if (d < dist) { -			// Found a closer zone -			dist = d; -			zone = idx; -		} -	} - -	return zone; -} - -void Scene::synchronize(Common::Serializer &s) { -	if (s.isSaving()) -		saveSceneStatus(); - -	if (s.isSaving()) { -		s.syncAsSint16LE(_currentScene); -	} else { -		s.syncAsSint16LE(_goToScene); -		_loadingSavedGame = true; -	} - -	for (int sceneNum = 0; sceneNum < SCENES_COUNT; ++sceneNum) { -		for (int flag = 0; flag < 65; ++flag) { -			s.syncAsByte(_sceneStats[sceneNum][flag]); -		} -	} -} - -void Scene::setNPCPath(int npc) { -	People &people = *_vm->_people; -	Talk &talk = *_vm->_talk; -	 -	people[npc].clearNPC(); -	people[npc]._name = Common::String::format("WATS%.2dA", _currentScene); - -	// If we're in the middle of a script that will continue once the scene is loaded, -	// return without calling the path script -	if (talk._scriptMoreFlag == 1 || talk._scriptMoreFlag == 3) -		return; - -	// Turn off all the NPCs, since the talk script will turn them back on as needed -	for (uint idx = 0; idx < MAX_NPC; ++idx) -		people[idx + 1]._type = INVALID; - -	// Call the path script for the scene -	Common::String pathFile = Common::String::format("PATH%.2dA", _currentScene); -	talk.talkTo(pathFile); -} - -void Scene::checkBgShapes() { -	People &people = *_vm->_people; -	Person &holmes = people._player; -	Common::Point pt(holmes._position.x / FIXED_INT_MULTIPLIER, holmes._position.y / FIXED_INT_MULTIPLIER); - -	// Iterate through the shapes -	for (uint idx = 0; idx < _bgShapes.size(); ++idx) { -		Object &obj = _bgShapes[idx]; -		if (obj._type == ACTIVE_BG_SHAPE || (IS_SERRATED_SCALPEL && obj._type == STATIC_BG_SHAPE)) { -			if ((obj._flags & 5) == 1) { -				obj._misc = (pt.y < (obj._position.y + obj.frameHeight() - 1)) ? -					NORMAL_FORWARD : NORMAL_BEHIND; -			} else if (!(obj._flags & OBJ_BEHIND)) { -				obj._misc = BEHIND; -			} else if (obj._flags & OBJ_FORWARD) { -				obj._misc = FORWARD; -			} -		} -	} -} +} // End of namespace Scalpel  /*----------------------------------------------------------------*/ -void ScalpelScene::checkBgShapes() { -	People &people = *_vm->_people; -	Person &holmes = people._player; -	Common::Point pt(holmes._position.x / FIXED_INT_MULTIPLIER, holmes._position.y / FIXED_INT_MULTIPLIER); - -	// Call the base scene method to handle bg shapes -	Scene::checkBgShapes(); - -	// Iterate through the canim list -	for (uint idx = 0; idx < _canimShapes.size(); ++idx) { -		Object &obj = _canimShapes[idx]; -		if (obj._type == STATIC_BG_SHAPE || obj._type == ACTIVE_BG_SHAPE) { -			if ((obj._flags & 5) == 1) { -				obj._misc = (pt.y < (obj._position.y + obj._imageFrame->_frame.h - 1)) ? -				NORMAL_FORWARD : NORMAL_BEHIND; -			} else if (!(obj._flags & 1)) { -				obj._misc = BEHIND; -			} else if (obj._flags & 4) { -				obj._misc = FORWARD; -			} -		} -	} -} - -void ScalpelScene::doBgAnim() { -	Inventory &inv = *_vm->_inventory; -	Events &events = *_vm->_events; -	Sound &sound = *_vm->_sound; -	UserInterface &ui = *_vm->_ui; -	Common::Point mousePos = events.mousePos(); - -	if (ui._menuMode == LOOK_MODE) { -		if (mousePos.y > CONTROLS_Y1) -			events.setCursor(ARROW); -		else if (mousePos.y < CONTROLS_Y) -			events.setCursor(MAGNIFY); -	} - -	// Check for setting magnifying glass cursor -	if (ui._menuMode == INV_MODE || ui._menuMode == USE_MODE || ui._menuMode == GIVE_MODE) { -		if (inv._invMode == INVMODE_LOOK) { -			// Only show Magnifying glass cursor if it's not on the inventory command line -			if (mousePos.y < CONTROLS_Y || mousePos.y >(CONTROLS_Y1 + 13)) -				events.setCursor(MAGNIFY); -			else -				events.setCursor(ARROW); -		} else { -			events.setCursor(ARROW); -		} -	} - -	if (sound._diskSoundPlaying && !*sound._soundIsOn) { -		// Loaded sound just finished playing -		sound.freeDigiSound(); -	} - -	// Handle doing the actual drawing -	Scene::doBgAnim(); -} - -/*----------------------------------------------------------------*/ +namespace Tattoo {  TattooScene::TattooScene(SherlockEngine *vm) : Scene(vm) {  	_arrowZone = -1; +	_mask = _mask1 = nullptr; +	_maskCounter = 0;  }  void TattooScene::checkBgShapes() { @@ -1707,7 +1714,7 @@ void TattooScene::checkBgShapes() {  	}  } -void TattooScene::doBgAnim() { +void TattooScene::doBgAnimCheckCursor() {  	Events &events = *_vm->_events;  	UserInterface &ui = *_vm->_ui;  	Common::Point mousePos = events.mousePos(); @@ -1731,10 +1738,106 @@ void TattooScene::doBgAnim() {  		events.setCursor(cursorId);  	} +} -	// Handle doing the actual drawing -	_restoreFlag = true; -	Scene::doBgAnim(); +void TattooScene::doBgAnimHandleMask() { +	TattooEngine &vm = *((TattooEngine *)_vm); +	People &people = *_vm->_people; +	Screen &screen = *_vm->_screen; +	TattooUserInterface &ui = *((TattooUserInterface *)_vm->_ui); +	 +	static const int16 OFFSETS[16] = { -1, -2, -3, -3, -2, -1, -1, 0, 1, 2, 3, 3, 2, 1, 0, 0 }; + +	if (_mask != nullptr) { +		if (screen._backBuffer1.w() > screen.w()) +			screen.blitFrom(screen._backBuffer1, Common::Point(0, 0), Common::Rect(screen._currentScroll, 0, +			screen._currentScroll + screen.w(), screen.h())); +		else +			screen.blitFrom(screen._backBuffer1); + +		switch (_currentScene) { +		case 7: +			if (++_maskCounter == 2) { +				_maskCounter = 0; +				if (--_maskOffset.x < 0) +					_maskOffset.x = SHERLOCK_SCREEN_WIDTH - 1; +			} +			break; + +		case 8: +			_maskOffset.x += 2; +			if (_maskOffset.x >= SHERLOCK_SCREEN_WIDTH) +				_maskOffset.x = 0; +			break; + +		case 18: +		case 68: +			++_maskCounter; +			if (_maskCounter / 4 >= 16) +				_maskCounter = 0; + +			_maskOffset.x = OFFSETS[_maskCounter / 4]; +			break; + +		case 53: +			if (++_maskCounter == 2) { +				_maskCounter = 0; +				if (++_maskOffset.x == screen._backBuffer1.w()) +					_maskOffset.x = 0; +			} +			break; + +		default: +			break; +		} +	} else { +		// Standard scene without mask, so call user interface to erase any UI elements as necessary +		ui.doBgAnimRestoreUI(); +		 +		// Restore background for any areas covered by characters and shapes +		for (uint idx = 0; idx < MAX_CHARACTERS; ++idx) +			screen.restoreBackground(Common::Rect(people[idx]._oldPosition.x, people[idx]._oldPosition.y, +				people[idx]._oldPosition.x + people[idx]._oldSize.x, people[idx]._oldPosition.y + people[idx]._oldSize.y)); + +		for (uint idx = 0; idx < _bgShapes.size(); ++idx) { +			Object &obj = _bgShapes[idx]; +						 +			if ((obj._type == ACTIVE_BG_SHAPE && (obj._maxFrames > 1 || obj._delta.x != 0 || obj._delta.y != 0)) ||  +					obj._type == HIDE_SHAPE || obj._type == REMOVE) +				screen._backBuffer1.blitFrom(*obj._imageFrame, obj._oldPosition,  +					Common::Rect(obj._oldPosition.x, obj._oldPosition.y, obj._oldPosition.x + obj._oldSize.x, +						obj._oldPosition.y + obj._oldSize.y)); +		} + +		// If credits are active, erase the area they cover +		if (vm._creditsActive) +			vm.eraseCredits(); +	} +} + +void TattooScene::doBgAnim() { +	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; + +	for (int idx = 0; idx < MAX_CHARACTERS; ++idx) { +		if (people[idx]._type == CHARACTER) +			people[idx].checkSprite(); +	} + +	for (uint idx = 0; idx < _bgShapes.size(); ++idx) { +		if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE) +			_bgShapes[idx].checkObject(); +	}  } +} // End of namespace Tattoo +  } // End of namespace Sherlock diff --git a/engines/sherlock/scene.h b/engines/sherlock/scene.h index 2aecdfa3b2..1bd23fcde7 100644 --- a/engines/sherlock/scene.h +++ b/engines/sherlock/scene.h @@ -275,7 +275,7 @@ public:  	/**  	 * Draw all objects and characters.  	 */ -	virtual void doBgAnim(); +	virtual void doBgAnim() = 0;  	/**  	 * Attempts to find a background shape within the passed bounds. If found, @@ -318,7 +318,11 @@ public:  	void setNPCPath(int npc);  }; +namespace Scalpel { +  class ScalpelScene : public Scene { +private: +	void doBgAnimCheckCursor();  protected:  	/**  	 * Checks all the background shapes. If a background shape is animating, @@ -335,10 +339,19 @@ public:  	virtual void doBgAnim();  }; +} // End of namespace Scalpel + +namespace Tattoo { +  class TattooScene : public Scene {  private: -	CAnimStream _activeCAnim;  	int _arrowZone; +	int _maskCounter; +	Common::Point _maskOffset; +private: +	void doBgAnimCheckCursor(); + +	void doBgAnimHandleMask();  protected:  	/**  	 * Checks all the background shapes. If a background shape is animating, @@ -347,6 +360,9 @@ protected:  	 */  	virtual void checkBgShapes();  public: +	ImageFile *_mask, *_mask1; +	CAnimStream _activeCAnim; +public:  	TattooScene(SherlockEngine *vm);  	/** @@ -355,6 +371,8 @@ public:  	virtual void doBgAnim();  }; +} // End of namespace Tattoo +  } // End of namespace Sherlock  #endif diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h index 58c7d8f152..e730329ab4 100644 --- a/engines/sherlock/screen.h +++ b/engines/sherlock/screen.h @@ -72,7 +72,6 @@ private:  	byte _lookupTable[PALETTE_COUNT];  	byte _lookupTable1[PALETTE_COUNT];  	int _scrollSize; -	int _currentScroll;  	int _targetScroll;  private:  	/** @@ -102,6 +101,7 @@ public:  	byte _cMap[PALETTE_SIZE];  	byte _sMap[PALETTE_SIZE];  	byte _tMap[PALETTE_SIZE]; +	int _currentScroll;  public:  	Screen(SherlockEngine *vm);  	virtual ~Screen(); diff --git a/engines/sherlock/settings.cpp b/engines/sherlock/settings.cpp index cae5c6c67a..98a13a3e76 100644 --- a/engines/sherlock/settings.cpp +++ b/engines/sherlock/settings.cpp @@ -25,6 +25,8 @@  namespace Sherlock { +namespace Scalpel { +  static const int SETUP_POINTS[12][4]  = {  	{ 4, 154, 101, 53 },		// Exit  	{ 4, 165, 101, 53 },		// Music Toggle @@ -333,4 +335,6 @@ void Settings::show(SherlockEngine *vm) {  	ui._key = -1;  } +} // End of namespace Scalpel +  } // End of namespace Sherlock diff --git a/engines/sherlock/settings.h b/engines/sherlock/settings.h index fc5fb2959f..ff2e647a62 100644 --- a/engines/sherlock/settings.h +++ b/engines/sherlock/settings.h @@ -28,7 +28,8 @@  namespace Sherlock {  class SherlockEngine; -class UserInterface; + +namespace Scalpel {  class Settings {  private: @@ -55,6 +56,8 @@ public:  	static void show(SherlockEngine *vm);  }; +} // End of namespace Scalpel +  } // End of namespace Sherlock  #endif diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index b4be5eed8b..5e9cb02a3d 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -332,7 +332,7 @@ void Talk::talkTo(const Common::String &filename) {  	if (IS_SERRATED_SCALPEL) {  		// Restore any pressed button  		if (!ui._windowOpen && savedMode != STD_MODE) -			((ScalpelUserInterface *)_vm->_ui)->restoreButton((int)(savedMode - 1)); +			((Scalpel::ScalpelUserInterface *)_vm->_ui)->restoreButton((int)(savedMode - 1));  	}  	// Clear the ui counter so that anything displayed on the info line diff --git a/engines/sherlock/talk.h b/engines/sherlock/talk.h index dc6789cd9d..a5f81f38ba 100644 --- a/engines/sherlock/talk.h +++ b/engines/sherlock/talk.h @@ -108,8 +108,8 @@ enum {  enum OpcodeReturn { RET_EXIT = -1, RET_SUCCESS = 0, RET_CONTINUE = 1 };  class SherlockEngine; -class ScalpelUserInterface;  class Talk; +namespace Scalpel { class ScalpelUserInterface; };  typedef OpcodeReturn(Talk::*OpcodeMethod)(const byte *&str); @@ -164,7 +164,7 @@ struct TalkSequences {  };  class Talk { -	friend class ScalpelUserInterface; +	friend class Scalpel::ScalpelUserInterface;  private:  	/**  	 * Remove any voice commands from a loaded statement list diff --git a/engines/sherlock/tattoo/tattoo.cpp b/engines/sherlock/tattoo/tattoo.cpp index 47a7c2a9ba..6d90416c34 100644 --- a/engines/sherlock/tattoo/tattoo.cpp +++ b/engines/sherlock/tattoo/tattoo.cpp @@ -27,13 +27,15 @@ namespace Sherlock {  namespace Tattoo { +TattooEngine::TattooEngine(OSystem *syst, const SherlockGameDescription *gameDesc) : +		SherlockEngine(syst, gameDesc) { +	_creditsActive = false; +} +  void TattooEngine::showOpening() {  	// TODO  } -/** - * Initialize the engine - */  void TattooEngine::initialize() {  	initGraphics(640, 480, true); @@ -52,9 +54,6 @@ void TattooEngine::initialize() {  	loadInitialPalette();  } -/** - * Starting a scene within the game - */  void TattooEngine::startScene() {  	// TODO  } @@ -69,6 +68,10 @@ void TattooEngine::loadInitialPalette() {  	delete stream;  } +void TattooEngine::eraseCredits() { +	// TODO +} +  } // End of namespace Tattoo  } // End of namespace Scalpel diff --git a/engines/sherlock/tattoo/tattoo.h b/engines/sherlock/tattoo/tattoo.h index b9224e06ba..b6a85108e4 100644 --- a/engines/sherlock/tattoo/tattoo.h +++ b/engines/sherlock/tattoo/tattoo.h @@ -36,16 +36,27 @@ private:  	 */  	void loadInitialPalette();  protected: +	/** +	 * Initialize the engine +	 */  	virtual void initialize();  	virtual void showOpening(); +	/** +	 * Starting a scene within the game +	 */  	virtual void startScene();  public: -	TattooEngine(OSystem *syst, const SherlockGameDescription *gameDesc) : -		SherlockEngine(syst, gameDesc) {} - +	bool _creditsActive; +public: +	TattooEngine(OSystem *syst, const SherlockGameDescription *gameDesc);  	virtual ~TattooEngine() {} + +	/** +	 * Erase any area of the screen covered by credits +	 */ +	void eraseCredits();  };  } // End of namespace Tattoo diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp index 4f83e9151a..06ec62b6a2 100644 --- a/engines/sherlock/user_interface.cpp +++ b/engines/sherlock/user_interface.cpp @@ -82,9 +82,9 @@ const char *const MUSE[] = {  UserInterface *UserInterface::init(SherlockEngine *vm) {  	if (vm->getGameID() == GType_SerratedScalpel) -		return new ScalpelUserInterface(vm); +		return new Scalpel::ScalpelUserInterface(vm);  	else -		return new TattooUserInterface(vm); +		return new Tattoo::TattooUserInterface(vm);  }  UserInterface::UserInterface(SherlockEngine *vm) : _vm(vm) { @@ -108,6 +108,8 @@ UserInterface::UserInterface(SherlockEngine *vm) : _vm(vm) {  /*----------------------------------------------------------------*/ +namespace Scalpel { +  ScalpelUserInterface::ScalpelUserInterface(SherlockEngine *vm): UserInterface(vm) {  	_controls = new ImageFile("menu.all");  	_controlPanel = new ImageFile("controls.vgs"); @@ -2296,10 +2298,15 @@ void ScalpelUserInterface::checkAction(ActionType &action, const char *const mes  	events.setCursor(ARROW);  } +} +  /*----------------------------------------------------------------*/ +namespace Tattoo { +  TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm) { -	// +	_menuBuffer = nullptr; +	_invMenuBuffer = nullptr;  }  void TattooUserInterface::handleInput() { @@ -2307,4 +2314,44 @@ void TattooUserInterface::handleInput() {  	_vm->_events->pollEventsAndWait();  } +void TattooUserInterface::doBgAnimRestoreUI() { +	TattooScene &scene = *((TattooScene *)_vm->_scene); +	Screen &screen = *_vm->_screen; + +	// If _oldMenuBounds was set, then either a new menu has been opened or the current menu has been closed. +	// Either way, we need to restore the area where the menu was displayed +	if (_oldMenuBounds.width() > 0) +		screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_oldMenuBounds.left, _oldMenuBounds.top), +			_oldMenuBounds); + +	if (_oldInvMenuBounds.width() > 0) +		screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_oldInvMenuBounds.left, _oldInvMenuBounds.top), +			_oldInvMenuBounds); + +	if (_menuBuffer != nullptr) +		screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_menuBounds.left, _menuBounds.top), _menuBounds); +	if (_invMenuBuffer != nullptr) +		screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_invMenuBounds.left, _invMenuBounds.top), _invMenuBounds); + +	// If there is a Text Tag being display, restore the area underneath it +	if (_oldTagBounds.width() > 0) +		screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_oldTagBounds.left, _oldTagBounds.top),  +			_oldTagBounds); + +	// If there is an Inventory being shown, restore the graphics underneath it +	if (_oldInvGraphicBounds.width() > 0) +		screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_oldInvGraphicBounds.left, _oldInvGraphicBounds.top),  +			_oldInvGraphicBounds); + +	// If a canimation is active, restore the graphics underneath it +	if (scene._activeCAnim._images != nullptr) +		screen.restoreBackground(scene._activeCAnim._oldBounds); + +	// If a canimation just ended, remove it's graphics from the backbuffer +	if (scene._activeCAnim._removeBounds.width() > 0) +		screen.restoreBackground(scene._activeCAnim._removeBounds); +} + +} // End of namespace Tattoo +  } // End of namespace Sherlock diff --git a/engines/sherlock/user_interface.h b/engines/sherlock/user_interface.h index 2203ddf05e..7a640efea1 100644 --- a/engines/sherlock/user_interface.h +++ b/engines/sherlock/user_interface.h @@ -137,6 +137,8 @@ public:  	virtual void printObjectDesc() {}  }; +namespace Scalpel { +  class ScalpelUserInterface: public UserInterface {  	friend class Inventory;  	friend class Settings; @@ -314,9 +316,24 @@ public:  	virtual void printObjectDesc();  }; +} // End of namespace Scalpel + +namespace Tattoo { +  class TattooUserInterface : public UserInterface { +private: +	Common::Rect _menuBounds; +	Common::Rect _oldMenuBounds; +	Common::Rect _invMenuBounds; +	Common::Rect _oldInvMenuBounds; +	Common::Rect _oldTagBounds; +	Common::Rect _oldInvGraphicBounds; +	Surface *_menuBuffer; +	Surface *_invMenuBuffer;  public:  	TattooUserInterface(SherlockEngine *vm); + +	void doBgAnimRestoreUI();  public:  	virtual ~TattooUserInterface() {} @@ -326,6 +343,8 @@ public:  	virtual void handleInput();  }; +} // End of namespace Tattoo +  } // End of namespace Sherlock  #endif  | 
