diff options
| -rw-r--r-- | engines/prince/prince.cpp | 2 | ||||
| -rw-r--r-- | engines/prince/prince.h | 4 | ||||
| -rw-r--r-- | engines/prince/script.cpp | 19 | ||||
| -rw-r--r-- | engines/prince/script.h | 3 | 
4 files changed, 19 insertions, 9 deletions
| diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 1ef70d0c4b..6e8847e780 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -401,7 +401,7 @@ bool PrinceEngine::loadLocation(uint16 locationNr) {  	_mainHero->setShadowScale(_script->getShadowScale(_locationNr));  	for (uint i = 0; i < _mobList.size(); i++) { -		_mobList[i]._visible = _script->getMobVisible(_room->_mobs, i); +		_mobList[i]._visible = _script->getMobVisible(i);  	}  	clearBackAnimList(); diff --git a/engines/prince/prince.h b/engines/prince/prince.h index 28ef4b662a..be0d93109f 100644 --- a/engines/prince/prince.h +++ b/engines/prince/prince.h @@ -266,6 +266,8 @@ public:  	int32 _picWindowY;  	Image::BitmapDecoder *_roomBmp;  	MhwanhDecoder *_suitcaseBmp; +	Room *_room; +	Script *_script;  	Common::Array<AnimListItem> _animList;  	Common::Array<BackgroundAnim> _backAnimList; @@ -403,12 +405,10 @@ private:  	Cursor *_cursor3;  	Debugger *_debugger;  	GraphicsMan *_graph; -	Script *_script;  	InterpreterFlags *_flags;  	Interpreter *_interpreter;  	Font *_font;  	MusicPlayer *_midiPlayer; -	Room *_room;  	static const uint32 MAX_SAMPLES = 60;	  	Common::SeekableReadStream *_voiceStream[MAX_SAMPLES]; diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp index 3ed3adba0d..7806218df8 100644 --- a/engines/prince/script.cpp +++ b/engines/prince/script.cpp @@ -224,8 +224,12 @@ uint32 Script::getStartGameOffset() {  	return _scriptInfo.startGame;  } -bool Script::getMobVisible(int roomMobOffset, int mobNr) { -	return _data[roomMobOffset + mobNr]; +bool Script::getMobVisible(int mob) { +	return _data[_vm->_room->_mobs + mob]; +} + +void Script::setMobVisible(int mob, int value) { +	_data[_vm->_room->_mobs + mob] = value;  }  uint8 *Script::getRoomOffset(int locationNr) { @@ -458,7 +462,9 @@ void Interpreter::debugInterpreter(const char *s, ...) {  	Common::String str = Common::String::format("@0x%08X: ", _lastInstruction);  	str += Common::String::format("op %04d: ", _lastOpcode);  	//debugC(10, DebugChannel::kScript, "PrinceEngine::Script %s %s", str.c_str(), buf); -	debug(10, "PrinceEngine::Script %s %s", str.c_str(), buf); +	if (_mode == "fg") { +		debug(10, "PrinceEngine::Script %s %s", str.c_str(), buf); +	}  	//debug("Prince::Script frame %08ld mode %s %s %s", _vm->_frameNr, _mode, str.c_str(), buf);  } @@ -536,7 +542,7 @@ Flags::Id Interpreter::readScriptFlagId() {  }  void Interpreter::O_WAITFOREVER() { -	debugInterpreter("O_WAITFOREVER"); +	//debugInterpreter("O_WAITFOREVER");  	_opcodeNF = 1;  	_currentInstruction -= 2;  } @@ -965,7 +971,10 @@ void Interpreter::O_CHANGEMOB() {  	uint16 mob = readScriptFlagValue();  	uint16 value = readScriptFlagValue();  	debugInterpreter("O_CHANGEMOB mob %d, value %d", mob, value); -	// Probably sets mobs visible flag to value + +	value ^= 1; +	_vm->_script->setMobVisible(mob, value); +	_vm->_mobList[mob]._visible = value;  }  void Interpreter::O_ADDINV() { diff --git a/engines/prince/script.h b/engines/prince/script.h index 44da67a99e..cd2186b744 100644 --- a/engines/prince/script.h +++ b/engines/prince/script.h @@ -143,7 +143,8 @@ public:  	int scanMobEvents(int mobMask, int dataEventOffset);  	int scanMobEventsWithItem(int mobMask, int dataEventOffset, int itemMask); -	bool getMobVisible(int roomMobOffset, int mobNr); +	bool getMobVisible(int mob); +	void setMobVisible(int mob, int value);  	const char *getString(uint32 offset) {  		return (const char *)(&_data[offset]); | 
