diff options
| author | Max Horn | 2005-04-20 23:33:35 +0000 | 
|---|---|---|
| committer | Max Horn | 2005-04-20 23:33:35 +0000 | 
| commit | 7963bb4cb92345948b8f737df8414929f93db527 (patch) | |
| tree | d89bb97667bb09fb515e3c59a15ecbd37e04f77e | |
| parent | c04ad861fe751503c978cd47258baaa57c22b96d (diff) | |
| download | scummvm-rg350-7963bb4cb92345948b8f737df8414929f93db527.tar.gz scummvm-rg350-7963bb4cb92345948b8f737df8414929f93db527.tar.bz2 scummvm-rg350-7963bb4cb92345948b8f737df8414929f93db527.zip  | |
Renamed _mouseButStat -> _mouseAndKeyboardStat (that's what it really is); moved _audioNames to class IMuseDigital
svn-id: r17723
| -rw-r--r-- | scumm/imuse_digi/dimuse.cpp | 4 | ||||
| -rw-r--r-- | scumm/imuse_digi/dimuse.h | 5 | ||||
| -rw-r--r-- | scumm/imuse_digi/dimuse_music.cpp | 10 | ||||
| -rw-r--r-- | scumm/input.cpp | 18 | ||||
| -rw-r--r-- | scumm/intern.h | 1 | ||||
| -rw-r--r-- | scumm/resource.cpp | 24 | ||||
| -rw-r--r-- | scumm/scumm.cpp | 5 | ||||
| -rw-r--r-- | scumm/scumm.h | 5 | ||||
| -rw-r--r-- | scumm/verbs.cpp | 20 | 
9 files changed, 56 insertions, 36 deletions
diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index d4f2f18c82..3e382b2364 100644 --- a/scumm/imuse_digi/dimuse.cpp +++ b/scumm/imuse_digi/dimuse.cpp @@ -54,6 +54,9 @@ IMuseDigital::IMuseDigital(ScummEngine *scumm, int fps)  		_track[l]->used = false;  	}  	_vm->_timer->installTimerProc(timer_handler, 1000000 / _callbackFps, this); + +	_audioNames = NULL; +	_numAudioNames = 0;  }  IMuseDigital::~IMuseDigital() { @@ -63,6 +66,7 @@ IMuseDigital::~IMuseDigital() {  		delete _track[l];  	}  	delete _sound; +	free(_audioNames);  }  void IMuseDigital::resetState() { diff --git a/scumm/imuse_digi/dimuse.h b/scumm/imuse_digi/dimuse.h index cb8e9892c6..52484ecf64 100644 --- a/scumm/imuse_digi/dimuse.h +++ b/scumm/imuse_digi/dimuse.h @@ -90,6 +90,9 @@ private:  	ScummEngine *_vm;  	ImuseDigiSndMgr *_sound; +	char *_audioNames; +	int32 _numAudioNames; +  	bool _pause;  	int32 _attributes[188]; @@ -129,6 +132,8 @@ public:  	IMuseDigital(ScummEngine *scumm, int fps);  	virtual ~IMuseDigital(); +	void setAudioNames(int32 num, char *names); +  	void startVoice(int soundId, AudioStream *input);  	void startVoice(int soundId, const char *soundName);  	void startMusic(int soundId, int volume); diff --git a/scumm/imuse_digi/dimuse_music.cpp b/scumm/imuse_digi/dimuse_music.cpp index da57398353..43490da5e9 100644 --- a/scumm/imuse_digi/dimuse_music.cpp +++ b/scumm/imuse_digi/dimuse_music.cpp @@ -394,10 +394,16 @@ void IMuseDigital::setFtMusicCuePoint(int cueId) {  	_curMusicCue = cueId;  } +void IMuseDigital::setAudioNames(int32 num, char *names) { +	free(_audioNames); +	_numAudioNames = num; +	_audioNames = names; +} +  int IMuseDigital::getSoundIdByName(const char *soundName) {  	if (soundName && soundName[0] != 0) { -		for (int r = 0; r < _vm->_numAudioNames; r++) { -			if (strcmp(soundName, &_vm->_audioNames[r * 9]) == 0) { +		for (int r = 0; r < _numAudioNames; r++) { +			if (strcmp(soundName, &_audioNames[r * 9]) == 0) {  				return r;  			}  		} diff --git a/scumm/input.cpp b/scumm/input.cpp index b9ac0abb92..dd2f29cafe 100644 --- a/scumm/input.cpp +++ b/scumm/input.cpp @@ -210,7 +210,7 @@ void ScummEngine::parseEvents() {  void ScummEngine::clearClickedStatus() {  	_keyPressed = 0; -	_mouseButStat = 0; +	_mouseAndKeyboardStat = 0;  	_leftBtnPressed &= ~msClicked;  	_rightBtnPressed &= ~msClicked;  } @@ -251,15 +251,15 @@ void ScummEngine::processKbd(bool smushMode) {  	//  	// Determine the mouse button state.  	// -	_mouseButStat = 0; +	_mouseAndKeyboardStat = 0;  	// Interpret 'return' as left click and 'tab' as right click  	if (_lastKeyHit && _cursor.state > 0) {  		if (_lastKeyHit == 9) { -			_mouseButStat = MBS_RIGHT_CLICK; +			_mouseAndKeyboardStat = MBS_RIGHT_CLICK;  			_lastKeyHit = 0;  		} else if (_lastKeyHit == 13) { -			_mouseButStat = MBS_LEFT_CLICK; +			_mouseAndKeyboardStat = MBS_LEFT_CLICK;  			_lastKeyHit = 0;  		}  	} @@ -269,19 +269,19 @@ void ScummEngine::processKbd(bool smushMode) {  		// the cutscene exit key (i.e. ESC in most games). That mimicks  		// the behaviour of the original engine where pressing both  		// mouse buttons also skips the current cutscene. -		_mouseButStat = 0; +		_mouseAndKeyboardStat = 0;  		_lastKeyHit = (uint)VAR(VAR_CUTSCENEEXIT_KEY);  	} else if (_rightBtnPressed & msClicked && (_version < 4 && _gameId != GID_LOOM)) {  		// Pressing right mouse button is treated as if you pressed  		// the cutscene exit key (i.e. ESC in most games). That mimicks  		// the behaviour of the original engine where pressing right  		// mouse button also skips the current cutscene. -		_mouseButStat = 0; +		_mouseAndKeyboardStat = 0;  		_lastKeyHit = (uint)VAR(VAR_CUTSCENEEXIT_KEY);  	} else if (_leftBtnPressed & msClicked) { -		_mouseButStat = MBS_LEFT_CLICK; +		_mouseAndKeyboardStat = MBS_LEFT_CLICK;  	} else if (_rightBtnPressed & msClicked) { -		_mouseButStat = MBS_RIGHT_CLICK; +		_mouseAndKeyboardStat = MBS_RIGHT_CLICK;  	}  	if (_version == 8) { @@ -478,7 +478,7 @@ void ScummEngine::processKbd(bool smushMode) {  		}  	} -	_mouseButStat = _lastKeyHit; +	_mouseAndKeyboardStat = _lastKeyHit;  }  } // End of namespace Scumm diff --git a/scumm/intern.h b/scumm/intern.h index 60876cdd20..d4cc1402b1 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -1231,6 +1231,7 @@ protected:  	virtual void readMAXS(int blockSize);  	virtual void readGlobalObjects(); +	virtual void readIndexBlock(uint32 blocktype, uint32 itemsize);  	virtual void setCameraAt(int pos_x, int pos_y);  	virtual void setCameraFollows(Actor *a); diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 9b96557b13..060f3f83b8 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -341,6 +341,23 @@ void ScummEngine::readIndexFile() {  	closeRoom();  } +void ScummEngine_v7::readIndexBlock(uint32 blocktype, uint32 itemsize) { +	int num; +	char *ptr; +	switch (blocktype) { +	case MKID('ANAM'):		// Used by: The Dig, FT +		debug(9, "found ANAM block, reading audio names"); +		num = _fileHandle->readUint16LE(); +		ptr = (char*)malloc(num * 9); +		_fileHandle->read(ptr, num * 9); +		_imuseDigital->setAudioNames(num, ptr); +		break; + +	default: +		ScummEngine::readIndexBlock(blocktype, itemsize); +	} +} +  void ScummEngine_v70he::readIndexBlock(uint32 blocktype, uint32 itemsize) {  	int i;  	switch (blocktype) { @@ -421,13 +438,6 @@ void ScummEngine::readIndexBlock(uint32 blocktype, uint32 itemsize) {  		readResTypeList(rtRoomImage, MKID('RMIM'), "room image");  		break; -	case MKID('ANAM'):		// Used by: The Dig, FT -		debug(9, "found ANAM block, reading audio names"); -		_numAudioNames = _fileHandle->readUint16LE(); -		_audioNames = (char*)malloc(_numAudioNames * 9); -		_fileHandle->read(_audioNames, _numAudioNames * 9); -		break; -  	case MKID('DIRR'):  	case MKID('DROO'):  		readResTypeList(rtRoom, MKID('ROOM'), "room"); diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index afe1964bd6..2ce332b2f2 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -755,8 +755,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS  	_numTalkies = 0;  	_numPalettes = 0;  	_numUnk = 0; -	_audioNames = NULL; -	_numAudioNames = 0;  	_curActor = 0;  	_curVerb = 0;  	_curVerbSlot = 0; @@ -765,7 +763,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS  	_egoPositioned = false;  	_keyPressed = 0;  	_lastKeyHit = 0; -	_mouseButStat = 0; +	_mouseAndKeyboardStat = 0;  	_leftBtnPressed = 0;  	_rightBtnPressed = 0;  	_bootParam = 0; @@ -1173,7 +1171,6 @@ ScummEngine::~ScummEngine() {  	delete _sound;  	free(_languageBuffer); -	free(_audioNames);  	delete _costumeLoader;  	delete _costumeRenderer; diff --git a/scumm/scumm.h b/scumm/scumm.h index 5eee65969d..e7eb497e3d 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -524,9 +524,6 @@ public:  	int _NESStartStrip; -	char *_audioNames; -	int32 _numAudioNames; -  protected:  	/* Current objects - can go in their respective classes */  	byte _curActor; @@ -550,7 +547,7 @@ protected:  	Common::Point _mouse;  	Common::Point _virtualMouse; -	uint16 _mouseButStat; +	uint16 _mouseAndKeyboardStat;  	byte _leftBtnPressed, _rightBtnPressed;  	/** The bootparam, to be passed to the script 1, the bootscript. */ diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp index a88a09bee7..d392ed7604 100644 --- a/scumm/verbs.cpp +++ b/scumm/verbs.cpp @@ -230,7 +230,7 @@ void ScummEngine::checkV2Inventory(int x, int y) {  	y -= virtscr[kVerbVirtScreen].topline; -	if ((y < inventoryArea) || !(_mouseButStat & MBS_LEFT_CLICK))  +	if ((y < inventoryArea) || !(_mouseAndKeyboardStat & MBS_LEFT_CLICK))   		return;  	if (v2_mouseover_boxes[kInventoryUpArrow].rect.contains(x, y)) { @@ -356,18 +356,18 @@ void ScummEngine::checkExecVerbs() {  	if (VAR_MOUSE_STATE != 0xFF)  		VAR(VAR_MOUSE_STATE) = 0; -	if (_userPut <= 0 || _mouseButStat == 0) +	if (_userPut <= 0 || _mouseAndKeyboardStat == 0)  		return;  	if (VAR_MOUSE_STATE != 0xFF) -		VAR(VAR_MOUSE_STATE) = _mouseButStat; +		VAR(VAR_MOUSE_STATE) = _mouseAndKeyboardStat; -	if (_mouseButStat < MBS_MAX_KEY) { +	if (_mouseAndKeyboardStat < MBS_MAX_KEY) {  		/* Check keypresses */  		vs = &_verbs[1];  		for (i = 1; i < _numVerbs; i++, vs++) {  			if (vs->verbid && vs->saveid == 0 && vs->curmode == 1) { -				if (_mouseButStat == vs->key) { +				if (_mouseAndKeyboardStat == vs->key) {  					// Trigger verb as if the user clicked it  					runInputScript(1, vs->verbid, 1);  					return; @@ -375,7 +375,7 @@ void ScummEngine::checkExecVerbs() {  			}  		} -		if ((_gameId == GID_INDY4 || _gameId == GID_PASS) && _mouseButStat >= '0' && _mouseButStat <= '9') { +		if ((_gameId == GID_INDY4 || _gameId == GID_PASS) && _mouseAndKeyboardStat >= '0' && _mouseAndKeyboardStat <= '9') {  			// To support keyboard fighting in FOA, we need to remap the number keys.  			// FOA apparently expects PC scancode values (see script 46 if you want  			// to know where I got these numbers from). Oddly enough, the The Indy 3 @@ -387,14 +387,14 @@ void ScummEngine::checkExecVerbs() {  					331, 332, 333,  					327, 328, 329  				}; -			_mouseButStat = numpad[_mouseButStat - '0']; +			_mouseAndKeyboardStat = numpad[_mouseAndKeyboardStat - '0'];  		}  		// Generic keyboard input -		runInputScript(4, _mouseButStat, 1); -	} else if (_mouseButStat & MBS_MOUSE_MASK) { +		runInputScript(4, _mouseAndKeyboardStat, 1); +	} else if (_mouseAndKeyboardStat & MBS_MOUSE_MASK) {  		VirtScreen *zone = findVirtScreen(_mouse.y); -		byte code = _mouseButStat & MBS_LEFT_CLICK ? 1 : 2; +		byte code = _mouseAndKeyboardStat & MBS_LEFT_CLICK ? 1 : 2;  		int inventoryArea = (_platform == Common::kPlatformNES) ? 48: 32;  		if (_version <= 2 && zone->number == 2 && _mouse.y <= zone->topline + 8) {  | 
