diff options
| -rw-r--r-- | engines/toltecs/detection.cpp | 18 | ||||
| -rw-r--r-- | engines/toltecs/movie.cpp | 1 | ||||
| -rw-r--r-- | engines/toltecs/palette.cpp | 1 | ||||
| -rw-r--r-- | engines/toltecs/render.cpp | 2 | ||||
| -rw-r--r-- | engines/toltecs/script.cpp | 43 | ||||
| -rw-r--r-- | engines/toltecs/toltecs.h | 3 | 
6 files changed, 17 insertions, 51 deletions
| diff --git a/engines/toltecs/detection.cpp b/engines/toltecs/detection.cpp index 9db6155a6e..5180a0711a 100644 --- a/engines/toltecs/detection.cpp +++ b/engines/toltecs/detection.cpp @@ -23,7 +23,7 @@  #include "base/plugins.h" -#include "common/advancedDetector.h" +#include "engines/advancedDetector.h"  #include "common/file.h"  #include "toltecs/toltecs.h" @@ -32,7 +32,7 @@  namespace Toltecs {  struct ToltecsGameDescription { -	Common::ADGameDescription desc; +	ADGameDescription desc;  };  uint32 ToltecsEngine::getFeatures() const { @@ -63,7 +63,7 @@ static const ToltecsGameDescription gameDescriptions[] = {  			AD_ENTRY1s("WESTERN", "05472037e9cfde146e953c434e74f0f4", 337643527),  			Common::EN_ANY,  			Common::kPlatformPC, -			Common::ADGF_NO_FLAGS +			ADGF_NO_FLAGS  		},  	}, @@ -75,7 +75,7 @@ static const ToltecsGameDescription gameDescriptions[] = {  			AD_ENTRY1s("WESTERN", "ba1742d3193b68ceb9434e2ab7a09a9b", 391462783),  			Common::RU_RUS,  			Common::kPlatformPC, -			Common::ADGF_NO_FLAGS +			ADGF_NO_FLAGS  		},  	}, @@ -84,7 +84,7 @@ static const ToltecsGameDescription gameDescriptions[] = {  } // End of namespace Toltecs -static const Common::ADParams detectionParams = { +static const ADParams detectionParams = {  	// Pointer to ADGameDescription or its superset structure  	(const byte *)Toltecs::gameDescriptions,  	// Size of that superset structure @@ -103,9 +103,9 @@ static const Common::ADParams detectionParams = {  	0  }; -class ToltecsMetaEngine : public Common::AdvancedMetaEngine { +class ToltecsMetaEngine : public AdvancedMetaEngine {  public: -	ToltecsMetaEngine() : Common::AdvancedMetaEngine(detectionParams) {} +	ToltecsMetaEngine() : AdvancedMetaEngine(detectionParams) {}  	virtual const char *getName() const {  		return "Toltecs Engine"; @@ -116,7 +116,7 @@ public:  	}  	virtual bool hasFeature(MetaEngineFeature f) const; -	virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; +	virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;  	SaveStateList listSaves(const char *target) const;  	virtual int getMaximumSaveSlot() const;  	void removeSaveState(const char *target, int slot) const; @@ -139,7 +139,7 @@ bool Toltecs::ToltecsEngine::hasFeature(EngineFeature f) const {  		(f == kSupportsSavingDuringRuntime);  } -bool ToltecsMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const { +bool ToltecsMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {  	const Toltecs::ToltecsGameDescription *gd = (const Toltecs::ToltecsGameDescription *)desc;  	if (gd) {  		*engine = new Toltecs::ToltecsEngine(syst, gd); diff --git a/engines/toltecs/movie.cpp b/engines/toltecs/movie.cpp index 28402c9812..eedf4966da 100644 --- a/engines/toltecs/movie.cpp +++ b/engines/toltecs/movie.cpp @@ -201,7 +201,6 @@ void MoviePlayer::fetchAudioChunks() {  			chunkBuffer = NULL;  			prefetchChunkCount++;  			_soundChunkFramesLeft += _framesPerSoundChunk; -			delete[] chunkBuffer;  		} else {  			_vm->_arc->seek(chunkSize, SEEK_CUR);  		} diff --git a/engines/toltecs/palette.cpp b/engines/toltecs/palette.cpp index 23ce3d8dd3..0d5faec090 100644 --- a/engines/toltecs/palette.cpp +++ b/engines/toltecs/palette.cpp @@ -165,6 +165,7 @@ void Palette::buildColorTransTable(byte limit, char deltaValue, byte mask) {  		if (deltaValue < 0) {  			// TODO +			warning("Palette::buildColorTransTable(%d, %d, %02X) not yet implemented!", limit, deltaValue, mask);  		} else {  			r = _mainPalette[i * 3 + 0];  			g = _mainPalette[i * 3 + 1]; diff --git a/engines/toltecs/render.cpp b/engines/toltecs/render.cpp index dd7dfc212f..4ffb9f6664 100644 --- a/engines/toltecs/render.cpp +++ b/engines/toltecs/render.cpp @@ -174,7 +174,7 @@ void RenderQueue::update() {  	for (RenderQueueArray::iterator iter = _currQueue->begin(); iter != _currQueue->end(); iter++) {  		const RenderQueueItem *item = &(*iter); -		if (item->flags == kRefresh) { +		if (item->flags == kRefresh || doFullRefresh) {  			switch (item->type) {  			case kSprite: diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp index 2433a1a554..059640246e 100644 --- a/engines/toltecs/script.cpp +++ b/engines/toltecs/script.cpp @@ -168,36 +168,29 @@ void ScriptInterpreter::execOpcode(byte opcode) {  	case 1:  		// ok  		_regs.reg0 = readInt16(); -		debug(1, "mov reg0, #%d", _regs.reg0);  		break;  	case 2:  		// ok  		_regs.reg1 = readInt16(); -		debug(1, "mov reg1, #%d", _regs.reg1);  		break;  	case 3:  		// ok  		_regs.reg3 = readInt16(); -		debug(1, "mov reg3, #%d", _regs.reg3);  		break;  	case 4:  		// ok  		_regs.reg5 = _regs.reg0; -		debug(1, "mov reg5, reg0");  		break;  	case 5:  		// ok  		_regs.reg3 = _regs.reg0; -		debug(1, "mov reg3, reg0");  		break;  	case 6:  		// ok  		_regs.reg1 = _regs.reg0; -		debug(1, "mov reg1, reg0");  		break;  	case 7:  		_regs.reg1 = localRead16(_regs.reg3); -		debug(1, "mov reg1, *%d", _regs.reg3);  		break;  	case 8:  		localWrite16(_regs.reg3, _regs.reg0); @@ -279,19 +272,15 @@ void ScriptInterpreter::execOpcode(byte opcode) {  		break;  	case 34:  		pushInt16(_regs.reg0); -		debug(1, "pushw reg0");  		break;  	case 35:  		pushInt16(_regs.reg1); -		debug(1, "pushw reg1");  		break;  	case 36:  		_regs.reg1 = popInt16(); -		debug(1, "popw reg1");  		break;  	case 37:  		_regs.reg0 = popInt16(); -		debug(1, "popw reg0");  		break;  	case 38:  		_regs.reg2 = -_regs.reg2; @@ -313,23 +302,19 @@ void ScriptInterpreter::execOpcode(byte opcode) {  		_cmpBitTest = true;  		break;  	case 43: -		debug(1, "retn (slot: %d; ofs: %04X)\n", _regs.reg4, _regs.reg0);  		_code = getSlotData(_regs.reg4) + _regs.reg0;  		break;  	case 44: -		debug(1, "retf (slot: %d; ofs: %04X)\n", _regs.reg5, _regs.reg0);  		_code = getSlotData(_regs.reg5) + _regs.reg0;  		_regs.reg4 = _regs.reg5;  		_switchLocalDataNear = true;  		break;  	case 45: -		debug(1, "callnear %04X (slot: %d; ofs: %04X)\n", _regs.reg0, _regs.reg4, _regs.reg0);  		pushInt16(_code - getSlotData(_regs.reg4));  		pushInt16(_regs.reg4);  		_code = getSlotData(_regs.reg4) + _regs.reg0;  		break;  	case 46: -		debug(1, "callfar %04X (slot: %d; ofs: %04X)\n", _regs.reg0, _regs.reg5, _regs.reg0);  		pushInt16(_code - getSlotData(_regs.reg4));  		pushInt16(_regs.reg4);  		_code = getSlotData(_regs.reg5) + _regs.reg0; @@ -340,16 +325,12 @@ void ScriptInterpreter::execOpcode(byte opcode) {  		_regs.reg4 = popInt16();  		ofs = popInt16();  		_code = getSlotData(_regs.reg4) + ofs; -		debug(1, "ret (slot: %d; ofs: %04X)\n", _regs.reg4, ofs); -		//_code = getSlotData(_regs.reg4) + popInt16();  		_switchLocalDataNear = true;  		break;  	case 48:  		_regs.reg4 = popInt16();  		ofs = popInt16();  		_code = getSlotData(_regs.reg4) + ofs; -		debug(1, "retsp (slot: %d; ofs: %04X)\n", _regs.reg4, ofs); -		//_code = getSlotData(_regs.reg4) + popInt16();  		_regs.sp += _regs.reg0;  		_switchLocalDataNear = true;  		break; @@ -400,15 +381,8 @@ void ScriptInterpreter::execOpcode(byte opcode) {  		_code++;  		break;  	default: -	{ -		/* -		FILE *ex = fopen("error.0", "wb"); -		fwrite(_code - 8, 4096, 1, ex); -		fclose(ex); -		*/  		error("Invalid opcode %d", opcode);  	} -	}  } @@ -612,6 +586,7 @@ void ScriptInterpreter::execKernelOpcode(uint16 kernelOpcode) {  	case 23:// ok  	{  		debug(0, "o2_findMouseInRectIndex1(offset: %d; slot: %d; elemSize: %d; var: %d; index: %d)", arg16(3), arg16(5), arg16(7), arg16(9), arg16(11)); +  		int16 index = -1;  		if (_vm->_mouseY < _vm->_cameraHeight) {  			index = _vm->findRectAtPoint(getSlotData(arg16(5)) + arg16(3), @@ -625,19 +600,11 @@ void ScriptInterpreter::execKernelOpcode(uint16 kernelOpcode) {  	case 24:// ok  	{ +  		debug(0, "o2_findMouseInRectIndex2(offset: %d, slot: %d, elemSize: %d, var: %d)", arg16(3), arg16(5), arg16(7), arg16(9));  		int16 index = -1; -		debug(0, "_vm->_mouseDisabled = %d", _vm->_mouseDisabled); - -		/* FIXME: This opcode is called after the Revistronic logo at the beginning, -			but at the slot/offset there's bytecode and not a rect array as expected. -			To avoid crashes we skip searching the rectangle index for now when scene 215 is active. -			I don't know yet whether this is a bug in the original engine as well or just here. -			Needs some more checking. -			Annoyingly scene 215 is the map which becomes unusable with this hack. -		*/ -		if (_vm->_sceneResIndex != 215) { +		if (_vm->_sceneResIndex != 0) {  			if (_vm->_mouseY < _vm->_cameraHeight) {  				index = _vm->findRectAtPoint(getSlotData(arg16(5)) + arg16(3),  					_vm->_mouseX + _vm->_cameraX, @@ -645,9 +612,9 @@ void ScriptInterpreter::execKernelOpcode(uint16 kernelOpcode) {  					0, arg16(7));  			}  		} -		 +  		localWrite16(arg16(9), index); -		 +  		break;  	} diff --git a/engines/toltecs/toltecs.h b/engines/toltecs/toltecs.h index 1992d9d914..c3c538ba91 100644 --- a/engines/toltecs/toltecs.h +++ b/engines/toltecs/toltecs.h @@ -114,12 +114,11 @@ public:  	uint _sceneResIndex;  	int16 _sceneWidth, _sceneHeight; - +	  	int _counter01, _counter02;  	bool _movieSceneFlag;  	byte _flag01; -	// TODO: Move camera stuff into own Scene class  	int16 _cameraX, _cameraY;  	int16 _newCameraX, _newCameraY;  	int16 _cameraHeight; | 
