[Scummvm-cvs-logs] scummvm master -> 9ce285a11e1bfc981c518e89f2401b1896b4a367

bluegr bluegr at gmail.com
Sat Feb 14 14:10:47 CET 2015


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

Summary:
14914b2a31 ZVISION: Add custom equality operators for game location
60c06b84b6 ZVISION: Fix script bug #6794 - "ZVISION: Yoruk's coffin instant death"
9ce285a11e ZVISION: Also reference the script manager in ResultAction members


Commit: 14914b2a31399ceb6b2e4d7616535e346ee3acd6
    https://github.com/scummvm/scummvm/commit/14914b2a31399ceb6b2e4d7616535e346ee3acd6
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-02-14T15:08:28+02:00

Commit Message:
ZVISION: Add custom equality operators for game location

This makes the location checks more readable

Changed paths:
    engines/zvision/core/events.cpp
    engines/zvision/scripting/effects/music_effect.cpp
    engines/zvision/scripting/script_manager.cpp
    engines/zvision/scripting/script_manager.h



diff --git a/engines/zvision/core/events.cpp b/engines/zvision/core/events.cpp
index 9cf5d04..cc1c00b 100644
--- a/engines/zvision/core/events.cpp
+++ b/engines/zvision/core/events.cpp
@@ -152,7 +152,7 @@ void ZVision::cheatCodes(uint8 key) {
 
 		if (checkCode("HELLOSAILOR")) {
 			Audio::AudioStream *soundStream;
-			if (loc.world == 'v' && loc.room == 'b' && loc.node == '1' && loc.view == '0') {
+			if (loc == "vb10") {
 				soundStream = makeRawZorkStream("v000hpta.raw", this);
 			} else {
 				soundStream = makeRawZorkStream("v000hnta.raw", this);
diff --git a/engines/zvision/scripting/effects/music_effect.cpp b/engines/zvision/scripting/effects/music_effect.cpp
index 2e20847..ad3c0f6 100644
--- a/engines/zvision/scripting/effects/music_effect.cpp
+++ b/engines/zvision/scripting/effects/music_effect.cpp
@@ -227,8 +227,7 @@ bool PanTrackNode::process(uint32 deltaTimeInMillis) {
 		int volumeCorrection = 2;
 
 		if (_engine->getGameId() == GID_GRANDINQUISITOR) {
-			Location loc = scriptManager->getCurrentLocation();
-			if (loc.world == 'd' && loc.room == 'c' && loc.node == '1' && loc.view == '0')
+			if (scriptManager->getCurrentLocation() == "dc10")
 				volumeCorrection = 5;
 		}
 
diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp
index 71966b3..70eaab2 100644
--- a/engines/zvision/scripting/script_manager.cpp
+++ b/engines/zvision/scripting/script_manager.cpp
@@ -72,8 +72,7 @@ void ScriptManager::initialize() {
 }
 
 void ScriptManager::update(uint deltaTimeMillis) {
-	if (_currentLocation.node != _nextLocation.node || _currentLocation.room != _nextLocation.room ||
-	        _currentLocation.view != _nextLocation.view || _currentLocation.world != _nextLocation.world) {
+	if (_currentLocation != _nextLocation) {
 		ChangeLocationReal(false);
 	}
 
@@ -543,7 +542,7 @@ void ScriptManager::changeLocation(char _world, char _room, char _node, char _vi
 	_nextLocation.view = _view;
 	_nextLocation.offset = offset;
 	// If next location is 0000, return to the previous location.
-	if (_nextLocation.world == '0' && _nextLocation.room == '0' && _nextLocation.node == '0' && _nextLocation.view == '0') {
+	if (_nextLocation == "0000") {
 		if (getStateValue(StateKey_World) != 'g' || getStateValue(StateKey_Room) != 'j') {
 			_nextLocation.world = getStateValue(StateKey_LastWorld);
 			_nextLocation.room = getStateValue(StateKey_LastRoom);
@@ -680,7 +679,7 @@ void ScriptManager::ChangeLocationReal(bool isLoading) {
 	// Change the background position
 	_engine->getRenderManager()->setBackgroundPosition(_nextLocation.offset);
 
-	if (_currentLocation.world == 0 && _currentLocation.room == 0 && _currentLocation.node == 0 && _currentLocation.view == 0) {
+	if (_currentLocation == "0000") {
 		_currentLocation = _nextLocation;
 		execScope(world);
 		execScope(room);
diff --git a/engines/zvision/scripting/script_manager.h b/engines/zvision/scripting/script_manager.h
index d8e3721..7c276bf 100644
--- a/engines/zvision/scripting/script_manager.h
+++ b/engines/zvision/scripting/script_manager.h
@@ -113,6 +113,28 @@ struct Location {
 	uint32 offset;
 };
 
+inline bool operator==(const Location& lhs, const Location& rhs) {
+	return (
+		lhs.world == rhs.world &&
+		lhs.room == rhs.room &&
+		lhs.node == rhs.node &&
+		lhs.view == rhs.view
+	);
+}
+
+inline bool operator==(const Location& lhs, const char* rhs) {
+	Common::String lhsStr = Common::String::format("%c%c%c%c", lhs.world, lhs.room, lhs.node, lhs.view);
+	return lhsStr == rhs;
+}
+
+inline bool operator!=(const Location& lhs, const Location& rhs) {
+	return !(lhs == rhs);
+}
+
+inline bool operator!=(const Location& lhs, const char* rhs) {
+	return !(lhs == rhs);
+}
+
 typedef Common::List<Puzzle *> PuzzleList;
 typedef Common::Queue<Puzzle *> PuzzleQueue;
 typedef Common::List<Control *> ControlList;


Commit: 60c06b84b68a5711db442d8fd296f3978d685da5
    https://github.com/scummvm/scummvm/commit/60c06b84b68a5711db442d8fd296f3978d685da5
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-02-14T15:08:28+02:00

Commit Message:
ZVISION: Fix script bug #6794 - "ZVISION: Yoruk's coffin instant death"

Fixes an edge case where the player goes to the dark room with the grue
without holding a torch, and then quickly runs away before the grue's
sound effect finishes. Many thanks to eriktorbjorn for the original
workaround

Changed paths:
    engines/zvision/scripting/actions.cpp



diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp
index 5238561..248ebae 100644
--- a/engines/zvision/scripting/actions.cpp
+++ b/engines/zvision/scripting/actions.cpp
@@ -480,6 +480,14 @@ ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &l
 		}
 		_volume = new ValueSlot(engine->getScriptManager(), volumeBuffer);
 	}
+
+	// WORKAROUND for a script bug in Zork Nemesis, rooms mq70/mq80.
+	// Fixes an edge case where the player goes to the dark room with the grue
+	// without holding a torch, and then quickly runs away before the grue's
+	// sound effect finishes. Fixes script bug #6794.
+	if (engine->getGameId() == GID_NEMESIS && _slotKey == 14822 && engine->getScriptManager()->getStateValue(_slotKey) == 2)
+		engine->getScriptManager()->setStateValue(_slotKey, 0);
+
 }
 
 ActionMusic::~ActionMusic() {


Commit: 9ce285a11e1bfc981c518e89f2401b1896b4a367
    https://github.com/scummvm/scummvm/commit/9ce285a11e1bfc981c518e89f2401b1896b4a367
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-02-14T15:08:28+02:00

Commit Message:
ZVISION: Also reference the script manager in ResultAction members

Changed paths:
    engines/zvision/scripting/actions.cpp
    engines/zvision/scripting/actions.h



diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp
index 248ebae..90d32e4 100644
--- a/engines/zvision/scripting/actions.cpp
+++ b/engines/zvision/scripting/actions.cpp
@@ -47,6 +47,9 @@
 
 namespace ZVision {
 
+ResultAction::ResultAction(ZVision *engine, int32 slotkey) : _engine(engine), _slotKey(slotkey), _scriptManager(engine->getScriptManager()) {
+}
+
 //////////////////////////////////////////////////////////////////////////////
 // ActionAdd
 //////////////////////////////////////////////////////////////////////////////
@@ -60,7 +63,7 @@ ActionAdd::ActionAdd(ZVision *engine, int32 slotkey, const Common::String &line)
 }
 
 bool ActionAdd::execute() {
-	_engine->getScriptManager()->setStateValue(_key, _engine->getScriptManager()->getStateValue(_key) + _value);
+	_scriptManager->setStateValue(_key, _scriptManager->getStateValue(_key) + _value);
 	return true;
 }
 
@@ -75,7 +78,7 @@ ActionAssign::ActionAssign(ZVision *engine, int32 slotkey, const Common::String
 	char buf[64];
 	memset(buf, 0, 64);
 	sscanf(line.c_str(), "%u, %s", &_key, buf);
-	_value = new ValueSlot(_engine->getScriptManager(), buf);
+	_value = new ValueSlot(_scriptManager, buf);
 }
 
 ActionAssign::~ActionAssign() {
@@ -83,7 +86,7 @@ ActionAssign::~ActionAssign() {
 }
 
 bool ActionAssign::execute() {
-	_engine->getScriptManager()->setStateValue(_key, _value->getValue());
+	_scriptManager->setStateValue(_key, _value->getValue());
 	return true;
 }
 
@@ -100,7 +103,7 @@ ActionAttenuate::ActionAttenuate(ZVision *engine, int32 slotkey, const Common::S
 }
 
 bool ActionAttenuate::execute() {
-	ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_key);
+	ScriptingEffect *fx = _scriptManager->getSideFX(_key);
 	if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) {
 		MusicNodeBASE *mus = (MusicNodeBASE *)fx;
 		mus->setVolume(255 * (10000 - abs(_attenuation)) / 10000 );
@@ -125,7 +128,7 @@ ActionChangeLocation::ActionChangeLocation(ZVision *engine, int32 slotkey, const
 
 bool ActionChangeLocation::execute() {
 	// We can't directly call ScriptManager::ChangeLocationIntern() because doing so clears all the Puzzles, and thus would corrupt the current puzzle checking
-	_engine->getScriptManager()->changeLocation(_world, _room, _node, _view, _offset);
+	_scriptManager->changeLocation(_world, _room, _node, _view, _offset);
 	// Tell the puzzle system to stop checking any more puzzles
 	return false;
 }
@@ -151,7 +154,7 @@ ActionCrossfade::ActionCrossfade(ZVision *engine, int32 slotkey, const Common::S
 
 bool ActionCrossfade::execute() {
 	if (_keyOne) {
-		ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_keyOne);
+		ScriptingEffect *fx = _scriptManager->getSideFX(_keyOne);
 		if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) {
 			MusicNodeBASE *mus = (MusicNodeBASE *)fx;
 			if (_oneStartVolume >= 0)
@@ -162,7 +165,7 @@ bool ActionCrossfade::execute() {
 	}
 
 	if (_keyTwo) {
-		ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_keyTwo);
+		ScriptingEffect *fx = _scriptManager->getSideFX(_keyTwo);
 		if (fx && fx->getType() == ScriptingEffect::SCRIPTING_EFFECT_AUDIO) {
 			MusicNodeBASE *mus = (MusicNodeBASE *)fx;
 			if (_twoStartVolume >= 0)
@@ -233,7 +236,7 @@ ActionDisableControl::ActionDisableControl(ZVision *engine, int32 slotkey, const
 }
 
 bool ActionDisableControl::execute() {
-	_engine->getScriptManager()->setStateFlag(_key, Puzzle::DISABLED);
+	_scriptManager->setStateFlag(_key, Puzzle::DISABLED);
 	return true;
 }
 
@@ -250,7 +253,7 @@ ActionDisplayMessage::ActionDisplayMessage(ZVision *engine, int32 slotkey, const
 }
 
 bool ActionDisplayMessage::execute() {
-	Control *ctrl = _engine->getScriptManager()->getControl(_control);
+	Control *ctrl = _scriptManager->getControl(_control);
 	if (ctrl && ctrl->getType() == Control::CONTROL_TITLER) {
 		TitlerControl *titler = (TitlerControl *)ctrl;
 		titler->setString(_msgid);
@@ -289,14 +292,14 @@ ActionDistort::ActionDistort(ZVision *engine, int32 slotkey, const Common::Strin
 }
 
 ActionDistort::~ActionDistort() {
-	_engine->getScriptManager()->killSideFx(_distSlot);
+	_scriptManager->killSideFx(_distSlot);
 }
 
 bool ActionDistort::execute() {
-	if (_engine->getScriptManager()->getSideFX(_distSlot))
+	if (_scriptManager->getSideFX(_distSlot))
 		return true;
 
-	_engine->getScriptManager()->addSideFX(new DistortNode(_engine, _distSlot, _speed, _startAngle, _endAngle, _startLineScale, _endLineScale));
+	_scriptManager->addSideFX(new DistortNode(_engine, _distSlot, _speed, _startAngle, _endAngle, _startLineScale, _endLineScale));
 
 	return true;
 }
@@ -313,7 +316,7 @@ ActionEnableControl::ActionEnableControl(ZVision *engine, int32 slotkey, const C
 }
 
 bool ActionEnableControl::execute() {
-	_engine->getScriptManager()->unsetStateFlag(_key, Puzzle::DISABLED);
+	_scriptManager->unsetStateFlag(_key, Puzzle::DISABLED);
 	return true;
 }
 
@@ -326,8 +329,8 @@ ActionFlushMouseEvents::ActionFlushMouseEvents(ZVision *engine, int32 slotkey) :
 }
 
 bool ActionFlushMouseEvents::execute() {
-	_engine->getScriptManager()->flushEvent(Common::EVENT_LBUTTONUP);
-	_engine->getScriptManager()->flushEvent(Common::EVENT_LBUTTONDOWN);
+	_scriptManager->flushEvent(Common::EVENT_LBUTTONUP);
+	_scriptManager->flushEvent(Common::EVENT_LBUTTONDOWN);
 	return true;
 }
 
@@ -360,22 +363,22 @@ ActionInventory::ActionInventory(ZVision *engine, int32 slotkey, const Common::S
 bool ActionInventory::execute() {
 	switch (_type) {
 	case 0: // add
-		_engine->getScriptManager()->inventoryAdd(_key);
+		_scriptManager->inventoryAdd(_key);
 		break;
 	case 1: // addi
-		_engine->getScriptManager()->inventoryAdd(_engine->getScriptManager()->getStateValue(_key));
+		_scriptManager->inventoryAdd(_scriptManager->getStateValue(_key));
 		break;
 	case 2: // drop
 		if (_key >= 0)
-			_engine->getScriptManager()->inventoryDrop(_key);
+			_scriptManager->inventoryDrop(_key);
 		else
-			_engine->getScriptManager()->inventoryDrop(_engine->getScriptManager()->getStateValue(StateKey_InventoryItem));
+			_scriptManager->inventoryDrop(_scriptManager->getStateValue(StateKey_InventoryItem));
 		break;
 	case 3: // dropi
-		_engine->getScriptManager()->inventoryDrop(_engine->getScriptManager()->getStateValue(_key));
+		_scriptManager->inventoryDrop(_scriptManager->getStateValue(_key));
 		break;
 	case 4: // cycle
-		_engine->getScriptManager()->inventoryCycle();
+		_scriptManager->inventoryCycle();
 		break;
 	default:
 		break;
@@ -416,9 +419,9 @@ ActionKill::ActionKill(ZVision *engine, int32 slotkey, const Common::String &lin
 
 bool ActionKill::execute() {
 	if (_type)
-		_engine->getScriptManager()->killSideFxType((ScriptingEffect::ScriptingEffectType)_type);
+		_scriptManager->killSideFxType((ScriptingEffect::ScriptingEffectType)_type);
 	else
-		_engine->getScriptManager()->killSideFx(_key);
+		_scriptManager->killSideFx(_key);
 	return true;
 }
 
@@ -465,7 +468,7 @@ ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &l
 		int note;
 		int prog;
 		sscanf(line.c_str(), "%u %d %d %14s", &type, &prog, &note, volumeBuffer);
-		_volume = new ValueSlot(_engine->getScriptManager(), volumeBuffer);
+		_volume = new ValueSlot(_scriptManager, volumeBuffer);
 		_note = note;
 		_prog = prog;
 	} else {
@@ -478,40 +481,40 @@ ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &l
 			warning("ActionMusic: Adjusting volume for %s from %s to 100", _fileName.c_str(), volumeBuffer);
 			strcpy(volumeBuffer, "100");
 		}
-		_volume = new ValueSlot(engine->getScriptManager(), volumeBuffer);
+		_volume = new ValueSlot(_scriptManager, volumeBuffer);
 	}
 
 	// WORKAROUND for a script bug in Zork Nemesis, rooms mq70/mq80.
 	// Fixes an edge case where the player goes to the dark room with the grue
 	// without holding a torch, and then quickly runs away before the grue's
 	// sound effect finishes. Fixes script bug #6794.
-	if (engine->getGameId() == GID_NEMESIS && _slotKey == 14822 && engine->getScriptManager()->getStateValue(_slotKey) == 2)
-		engine->getScriptManager()->setStateValue(_slotKey, 0);
+	if (engine->getGameId() == GID_NEMESIS && _slotKey == 14822 && _scriptManager->getStateValue(_slotKey) == 2)
+		_scriptManager->setStateValue(_slotKey, 0);
 
 }
 
 ActionMusic::~ActionMusic() {
 	if (!_universe)
-		_engine->getScriptManager()->killSideFx(_slotKey);
+		_scriptManager->killSideFx(_slotKey);
 	delete _volume;
 }
 
 bool ActionMusic::execute() {
-	if (_engine->getScriptManager()->getSideFX(_slotKey)) {
-		_engine->getScriptManager()->killSideFx(_slotKey);
-		_engine->getScriptManager()->setStateValue(_slotKey, 2);
+	if (_scriptManager->getSideFX(_slotKey)) {
+		_scriptManager->killSideFx(_slotKey);
+		_scriptManager->setStateValue(_slotKey, 2);
 	}
 
 	uint volume = _volume->getValue();
 
 	if (_midi) {
-		_engine->getScriptManager()->addSideFX(new MusicMidiNode(_engine, _slotKey, _prog, _note, volume));
+		_scriptManager->addSideFX(new MusicMidiNode(_engine, _slotKey, _prog, _note, volume));
 	} else {
 		if (!_engine->getSearchManager()->hasFile(_fileName))
 			return true;
 
 		// Volume in the script files is mapped to [0, 100], but the ScummVM mixer uses [0, 255]
-		_engine->getScriptManager()->addSideFX(new MusicNode(_engine, _slotKey, _fileName, _loop, volume * 255 / 100));
+		_scriptManager->addSideFX(new MusicNode(_engine, _slotKey, _fileName, _loop, volume * 255 / 100));
 	}
 
 	return true;
@@ -530,14 +533,14 @@ ActionPanTrack::ActionPanTrack(ZVision *engine, int32 slotkey, const Common::Str
 }
 
 ActionPanTrack::~ActionPanTrack() {
-	_engine->getScriptManager()->killSideFx(_slotKey);
+	_scriptManager->killSideFx(_slotKey);
 }
 
 bool ActionPanTrack::execute() {
-	if (_engine->getScriptManager()->getSideFX(_slotKey))
+	if (_scriptManager->getSideFX(_slotKey))
 		return true;
 
-	_engine->getScriptManager()->addSideFX(new PanTrackNode(_engine, _slotKey, _musicSlot, _pos));
+	_scriptManager->addSideFX(new PanTrackNode(_engine, _slotKey, _musicSlot, _pos));
 
 	return true;
 }
@@ -587,18 +590,18 @@ ActionPreloadAnimation::ActionPreloadAnimation(ZVision *engine, int32 slotkey, c
 }
 
 ActionPreloadAnimation::~ActionPreloadAnimation() {
-	_engine->getScriptManager()->deleteSideFx(_slotKey);
+	_scriptManager->deleteSideFx(_slotKey);
 }
 
 bool ActionPreloadAnimation::execute() {
-	AnimationEffect *nod = (AnimationEffect *)_engine->getScriptManager()->getSideFX(_slotKey);
+	AnimationEffect *nod = (AnimationEffect *)_scriptManager->getSideFX(_slotKey);
 
 	if (!nod) {
 		nod = new AnimationEffect(_engine, _slotKey, _fileName, _mask, _framerate, false);
-		_engine->getScriptManager()->addSideFX(nod);
+		_scriptManager->addSideFX(nod);
 	} else
 		nod->stop();
-	_engine->getScriptManager()->setStateValue(_slotKey, 2);
+	_scriptManager->setStateValue(_slotKey, 2);
 	return true;
 }
 
@@ -614,10 +617,10 @@ ActionUnloadAnimation::ActionUnloadAnimation(ZVision *engine, int32 slotkey, con
 }
 
 bool ActionUnloadAnimation::execute() {
-	AnimationEffect *nod = (AnimationEffect *)_engine->getScriptManager()->getSideFX(_key);
+	AnimationEffect *nod = (AnimationEffect *)_scriptManager->getSideFX(_key);
 
 	if (nod && nod->getType() == ScriptingEffect::SCRIPTING_EFFECT_ANIM)
-		_engine->getScriptManager()->deleteSideFx(_key);
+		_scriptManager->deleteSideFx(_key);
 
 	return true;
 }
@@ -662,15 +665,15 @@ ActionPlayAnimation::ActionPlayAnimation(ZVision *engine, int32 slotkey, const C
 }
 
 ActionPlayAnimation::~ActionPlayAnimation() {
-	_engine->getScriptManager()->deleteSideFx(_slotKey);
+	_scriptManager->deleteSideFx(_slotKey);
 }
 
 bool ActionPlayAnimation::execute() {
-	AnimationEffect *nod = (AnimationEffect *)_engine->getScriptManager()->getSideFX(_slotKey);
+	AnimationEffect *nod = (AnimationEffect *)_scriptManager->getSideFX(_slotKey);
 
 	if (!nod) {
 		nod = new AnimationEffect(_engine, _slotKey, _fileName, _mask, _framerate);
-		_engine->getScriptManager()->addSideFX(nod);
+		_scriptManager->addSideFX(nod);
 	} else
 		nod->stop();
 
@@ -701,7 +704,7 @@ ActionPlayPreloadAnimation::ActionPlayPreloadAnimation(ZVision *engine, int32 sl
 }
 
 bool ActionPlayPreloadAnimation::execute() {
-	AnimationEffect *nod = (AnimationEffect *)_engine->getScriptManager()->getSideFX(_controlKey);
+	AnimationEffect *nod = (AnimationEffect *)_scriptManager->getSideFX(_controlKey);
 
 	if (nod)
 		nod->addPlayNode(_slotKey, _x1, _y1, _x2, _y2, _startFrame, _endFrame, _loopCount);
@@ -742,11 +745,11 @@ ActionRegion::ActionRegion(ZVision *engine, int32 slotkey, const Common::String
 }
 
 ActionRegion::~ActionRegion() {
-	_engine->getScriptManager()->killSideFx(_slotKey);
+	_scriptManager->killSideFx(_slotKey);
 }
 
 bool ActionRegion::execute() {
-	if (_engine->getScriptManager()->getSideFX(_slotKey))
+	if (_scriptManager->getSideFX(_slotKey))
 		return true;
 
 	GraphicsEffect *effect = NULL;
@@ -791,7 +794,7 @@ bool ActionRegion::execute() {
 	}
 
 	if (effect) {
-		_engine->getScriptManager()->addSideFX(new RegionNode(_engine, _slotKey, effect, _delay));
+		_scriptManager->addSideFX(new RegionNode(_engine, _slotKey, effect, _delay));
 		_engine->getRenderManager()->addEffect(effect);
 	}
 
@@ -807,7 +810,7 @@ ActionRandom::ActionRandom(ZVision *engine, int32 slotkey, const Common::String
 	char maxBuffer[64];
 	memset(maxBuffer, 0, 64);
 	sscanf(line.c_str(), "%s", maxBuffer);
-	_max = new ValueSlot(_engine->getScriptManager(), maxBuffer);
+	_max = new ValueSlot(_scriptManager, maxBuffer);
 }
 
 ActionRandom::~ActionRandom() {
@@ -816,7 +819,7 @@ ActionRandom::~ActionRandom() {
 
 bool ActionRandom::execute() {
 	uint randNumber = _engine->getRandomSource()->getRandomNumber(_max->getValue());
-	_engine->getScriptManager()->setStateValue(_slotKey, randNumber);
+	_scriptManager->setStateValue(_slotKey, randNumber);
 	return true;
 }
 
@@ -923,7 +926,7 @@ ActionStop::ActionStop(ZVision *engine, int32 slotkey, const Common::String &lin
 }
 
 bool ActionStop::execute() {
-	_engine->getScriptManager()->stopSideFx(_key);
+	_scriptManager->stopSideFx(_key);
 	return true;
 }
 
@@ -967,7 +970,7 @@ bool ActionStreamVideo::execute() {
 	hiresFileName.setChar('o', hiresFileName.size() - 2);
 	hiresFileName.setChar('b', hiresFileName.size() - 1);
 
-	if (_engine->getScriptManager()->getStateValue(StateKey_MPEGMovies) == 1 &&_engine->getSearchManager()->hasFile(hiresFileName)) {
+	if (_scriptManager->getStateValue(StateKey_MPEGMovies) == 1 &&_engine->getSearchManager()->hasFile(hiresFileName)) {
 		// TODO: Enable once AC3 support is implemented
 		if (!_engine->getSearchManager()->hasFile(_fileName))	// Check for the regular video
 			return true;
@@ -1026,14 +1029,14 @@ ActionSyncSound::ActionSyncSound(ZVision *engine, int32 slotkey, const Common::S
 }
 
 bool ActionSyncSound::execute() {
-	ScriptingEffect *fx = _engine->getScriptManager()->getSideFX(_syncto);
+	ScriptingEffect *fx = _scriptManager->getSideFX(_syncto);
 	if (!fx)
 		return true;
 
 	if (!(fx->getType() & ScriptingEffect::SCRIPTING_EFFECT_ANIM))
 		return true;
 
-	_engine->getScriptManager()->addSideFX(new SyncSoundNode(_engine, _slotKey, _fileName, _syncto));
+	_scriptManager->addSideFX(new SyncSoundNode(_engine, _slotKey, _fileName, _syncto));
 	return true;
 }
 
@@ -1046,18 +1049,18 @@ ActionTimer::ActionTimer(ZVision *engine, int32 slotkey, const Common::String &l
 	char timeBuffer[64];
 	memset(timeBuffer, 0, 64);
 	sscanf(line.c_str(), "%s", timeBuffer);
-	_time = new ValueSlot(_engine->getScriptManager(), timeBuffer);
+	_time = new ValueSlot(_scriptManager, timeBuffer);
 }
 
 ActionTimer::~ActionTimer() {
 	delete _time;
-	_engine->getScriptManager()->killSideFx(_slotKey);
+	_scriptManager->killSideFx(_slotKey);
 }
 
 bool ActionTimer::execute() {
-	if (_engine->getScriptManager()->getSideFX(_slotKey))
+	if (_scriptManager->getSideFX(_slotKey))
 		return true;
-	_engine->getScriptManager()->addSideFX(new TimerNode(_engine, _slotKey, _time->getValue()));
+	_scriptManager->addSideFX(new TimerNode(_engine, _slotKey, _time->getValue()));
 	return true;
 }
 
@@ -1077,13 +1080,13 @@ ActionTtyText::ActionTtyText(ZVision *engine, int32 slotkey, const Common::Strin
 }
 
 ActionTtyText::~ActionTtyText() {
-	_engine->getScriptManager()->killSideFx(_slotKey);
+	_scriptManager->killSideFx(_slotKey);
 }
 
 bool ActionTtyText::execute() {
-	if (_engine->getScriptManager()->getSideFX(_slotKey))
+	if (_scriptManager->getSideFX(_slotKey))
 		return true;
-	_engine->getScriptManager()->addSideFX(new ttyTextNode(_engine, _slotKey, _filename, _r, _delay));
+	_scriptManager->addSideFX(new ttyTextNode(_engine, _slotKey, _filename, _r, _delay));
 	return true;
 }
 
diff --git a/engines/zvision/scripting/actions.h b/engines/zvision/scripting/actions.h
index 94c2d04..ff19fc5 100644
--- a/engines/zvision/scripting/actions.h
+++ b/engines/zvision/scripting/actions.h
@@ -32,6 +32,7 @@ namespace ZVision {
 
 // Forward declaration of ZVision. This file is included before ZVision is declared
 class ZVision;
+class ScriptManager;
 class ValueSlot;
 
 /**
@@ -40,7 +41,7 @@ class ValueSlot;
   */
 class ResultAction {
 public:
-	ResultAction(ZVision *engine, int32 slotkey) : _engine(engine), _slotKey(slotkey) {}
+	ResultAction(ZVision *engine, int32 slotkey);
 	virtual ~ResultAction() {}
 	/**
 	 * This is called by the script system whenever a Puzzle's criteria are found to be true.
@@ -53,6 +54,7 @@ public:
 	virtual bool execute() = 0;
 protected:
 	ZVision *_engine;
+	ScriptManager *_scriptManager;
 	int32 _slotKey;
 };
 






More information about the Scummvm-git-logs mailing list