diff options
| -rw-r--r-- | engines/avalanche/acci2.cpp | 13 | ||||
| -rw-r--r-- | engines/avalanche/avalanche.cpp | 225 | ||||
| -rw-r--r-- | engines/avalanche/avalanche.h | 35 | ||||
| -rw-r--r-- | engines/avalanche/avalot.cpp | 7 | ||||
| -rw-r--r-- | engines/avalanche/lucerna2.cpp | 14 | ||||
| -rw-r--r-- | engines/avalanche/timer.cpp | 12 | 
6 files changed, 128 insertions, 178 deletions
| diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 34768b4147..0db9db7c9f 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -512,8 +512,9 @@ void Acci::parse() {  	}  	Common::String unkString; -	if (_vm->_parser->pos(Common::String('\xFE'), _thats) > -1) -		unkString = _realWords[_vm->_parser->pos(Common::String('\xFE'), _thats)]; +	int16 pos = _vm->_parser->pos(Common::String('\xFE'), _thats); +	if (pos > -1) +		unkString = _realWords[pos];  	else  		unkString.clear(); @@ -982,10 +983,10 @@ void Acci::putProc() {  			if (_vm->_gyro->_dna._rottenOnion)  				_vm->_scrolls->displayText("That's a bit like shutting the stable door after the horse has bolted!");  			else { // Put onion into wine? -				if (_vm->_gyro->_dna._wineState != 3) -					_vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "Oignon au vin" -					+ _vm->_scrolls->kControlRoman + " is a bit too strong for your tastes!"); -				else { // Put onion into vinegar! Yes! +				if (_vm->_gyro->_dna._wineState != 3) { +					Common::String tmpStr = Common::String::format("%cOignon au vin%c is a bit too strong for your tastes!", Scrolls::kControlItalic, Scrolls::kControlRoman); +					_vm->_scrolls->displayText(tmpStr); +				} else { // Put onion into vinegar! Yes!  					_vm->_gyro->_dna._onionInVinegar = true;  					_vm->_lucerna->incScore(7);  					_vm->_visa->displayScrollChain('u', 9); diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index d2e9a8de9b..3a952192cc 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -97,7 +97,6 @@ Common::ErrorCode AvalancheEngine::initialize() {  	_closing = new Closing(this);  	_graphics->init(); -  	_scrolls->init();  	_lucerna->init();  	_acci->init(); @@ -106,7 +105,6 @@ Common::ErrorCode AvalancheEngine::initialize() {  	return Common::kNoError;  } -  GUI::Debugger *AvalancheEngine::getDebugger() {  	return _console;  } @@ -115,8 +113,6 @@ Common::Platform AvalancheEngine::getPlatform() const {  	return _platform;  } - -  bool AvalancheEngine::hasFeature(EngineFeature f) const {  	return (f == kSupportsSavingDuringRuntime) || (f == kSupportsLoadingDuringRuntime);  } @@ -125,8 +121,6 @@ const char *AvalancheEngine::getCopyrightString() const {  	return "Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.";  } - -  void AvalancheEngine::synchronize(Common::Serializer &sz) {  	//blockwrite(f, dna, sizeof(dna));  	sz.syncAsByte(_gyro->_dna._direction); @@ -300,7 +294,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {  		sz.syncAsByte(_animation->_sprites[i]._id);  		sz.syncAsByte(_animation->_sprites[i]._doCheck); -  		if (sz.isLoading()) {  			_animation->_sprites[i]._quick = true;  			_animation->_sprites[i].init(_animation->_sprites[i]._id, _animation->_sprites[i]._doCheck, _animation); @@ -322,7 +315,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {  		sz.syncAsByte(_animation->_sprites[i]._callEachStepFl);  		sz.syncAsByte(_animation->_sprites[i]._eachStepProc);  		sz.syncAsByte(_animation->_sprites[i]._vanishIfStill); -  		sz.syncAsSint16LE(_animation->_sprites[i]._x);  		sz.syncAsSint16LE(_animation->_sprites[i]._y); @@ -377,26 +369,19 @@ bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) {  	f->writeSint16LE(t.tm_year);  	Common::Serializer sz(NULL, f); -  	synchronize(sz); -  	f->finalize(); -  	delete f;  	return true;  } - -  Common::String AvalancheEngine::getSaveFileName(const int slot) {  	Common::String upperName = _targetName;  	upperName.toUppercase();  	return upperName+ Common::String::format("-%02d.SAV", slot);  } - -  bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!!  	return (!_gyro->_seeScroll);  } @@ -433,8 +418,8 @@ bool AvalancheEngine::loadGame(const int16 slot) {  		char actChar = f->readByte();  		description += actChar;  	} -	description.toUppercase(); +	description.toUppercase();  	::Graphics::skipThumbnail(*f);  	// Read the time the game was saved. @@ -444,13 +429,10 @@ bool AvalancheEngine::loadGame(const int16 slot) {  	t.tm_year = f->readSint16LE();  	Common::Serializer sz(f, NULL); -  	synchronize(sz); -  	delete f;  	_gyro->isLoaded = true; -  	_gyro->_seeScroll = true;  // This prevents display of the new sprites before the new picture is loaded.  	if (_gyro->_holdTheDawn) { @@ -459,30 +441,22 @@ bool AvalancheEngine::loadGame(const int16 slot) {  	}  	_celer->forgetBackgroundSprites(); -  	_lucerna->minorRedraw(); -  	_dropdown->setupMenu(); -  	_gyro->_whereIs[0] = _gyro->_dna._room; -  	_gyro->_alive = true; -  	_lucerna->refreshObjectList(); -  	_animation->updateSpeed(); -  	_lucerna->drawDirection(); -  	_gyro->_onToolbar = false;  	_animation->animLink(); -  	_celer->updateBackgroundSprites(); -	_scrolls->displayText(Common::String(_scrolls->kControlItalic) + "Loaded: " + _scrolls->kControlRoman + description + ".ASG" -		+ _scrolls->kControlCenter + _scrolls->kControlNewLine + _scrolls->kControlNewLine -		+ _gyro->_roomnName + _scrolls->kControlNewLine + _scrolls->kControlNewLine -		+ "saved on " + expandDate(t.tm_mday, t.tm_mon, t.tm_year) + '.'); +	Common::String tmpStr = Common::String::format("%cLoaded: %c%s.ASG%c%c%c%s%c%csaved on %s.",  +		Scrolls::kControlItalic, Scrolls::kControlRoman, description.c_str(), Scrolls::kControlCenter,  +		Scrolls::kControlNewLine, Scrolls::kControlNewLine, _gyro->_roomnName, Scrolls::kControlNewLine,  +		Scrolls::kControlNewLine, expandDate(t.tm_mday, t.tm_mon, t.tm_year).c_str()); +	_scrolls->displayText(tmpStr);  	if (_animation->_sprites[0]._quick && _animation->_sprites[0]._visible)  		_animation->changeDirection(0, _gyro->_dna._direction); // We push Avvy in the right direction is he was moving. @@ -496,29 +470,26 @@ Common::String AvalancheEngine::expandDate(int d, int m, int y) {  	};  	Common::String month = months[m]; -  	Common::String day = _gyro->intToStr(d);  	if (((1 <= d) && (d <= 9)) || ((21 <= d) && (d <= 31)))  		switch (d % 10) {  		case 1: -			day = day + "st"; +			day += "st";  			break;  		case 2: -			day = day + "nd"; +			day += "nd";  			break;  		case 3: -			day = day + "rd"; +			day += "rd";  			break;  		default: -			day = day + "th"; +			day += "th";  		}  	return day + ' ' + month + ' ' + _gyro->intToStr(y + 1900);  } - -  void AvalancheEngine::updateEvents() {  	Common::Event event; @@ -547,76 +518,13 @@ Common::Point AvalancheEngine::getMousePos() {  	return _eventMan->getMousePos();  } - - - -  // From Bootstrp: -  const char AvalancheEngine::kRuncodes[2][3] = {"et", "Go"}; - - -// The original ones were all commented out, so porbably there's no need -// of these two cursor functions at all. TODO: Remove later. -void AvalancheEngine::cursorOff() { -	warning("STUB: cursorOff()"); -} - -void AvalancheEngine::cursorOn() { -	warning("STUB: cursorOn()"); -} - -// Needed later. -void AvalancheEngine::quit() { -	cursorOn(); -} - -// Needed in dos_shell(). TODO: Remove later. -Common::String AvalancheEngine::commandCom() { -	warning("STUB: commandCom()"); -	return ("STUB: commandCom()"); -} - -// Needed for run_avalot()'s errors. TODO: Remove later. -void AvalancheEngine::explain(byte error) { -	warning("STUB: explain()"); -} - - - -//TODO: Remove these (b_flight) functions later ( https://github.com/tthurman/avalot/wiki/B-Flight ) - -void AvalancheEngine::bFlight() {   //interrupt; -	_storage._skellern++; -} -  void AvalancheEngine::bFlightOn() {  	_storage._skellern = kReset;  	// setintvec(0x1c, &b_flight);  } - -void AvalancheEngine::bFlightOff() { -	// setintvec(0x1c, old_1c); -} - - - -Common::String AvalancheEngine::elmToStr(Elm how) { -	switch (how) { -	case kNormal: -	case kMusical: -		return Common::String("jsb"); -	case kRegi: -		return Common::String("REGI"); -	case kElmpoyten: -		return Common::String("ELMPOYTEN"); -	// Useless, but silent a warning -	default: -		return Common::String(""); -	} -} -  void AvalancheEngine::run(Common::String what, bool withJsb, bool withBflight, Elm how) {  	warning("STUB: run(%s)", what.c_str());  	// Probably there'll be no need of this function, as all *.AVX-es will become classes. @@ -637,54 +545,22 @@ void AvalancheEngine::callMenu() {  	warning("STUB: callMenu()");  } -void AvalancheEngine::runDemo() { -	warning("STUB: runDemo()"); -} - -void AvalancheEngine::dosShell() { -	warning("STUB: dosShell()"); -} - -// Getting used only in demo() / call_menu(). Going to be implemented at the same time with these. -bool AvalancheEngine::keyPressed() { -	warning("STUB: keyPressed()"); -	return false; -} - -// Same as keypressed1(). -void AvalancheEngine::flushBuffer() { -	warning("STUB: flushBuffer()"); -} - -// Same as keypressed1(). -void AvalancheEngine::demo() { -	warning("STUB: demo()"); -} - - - -  void AvalancheEngine::runAvalot() {  	bFlightOn();  	_avalot->run(Common::String(kRuncodes[_firstTime]) + _arguments); -	// TODO: Check if parameteres are ever used (probably not) and eventually remove them. -	// If there's an error initalizing avalot, i'll handle it in there, not here +	// TODO: Check if parameters are ever used (probably not) and eventually remove them. +	// If there's an error initializing avalot, i'll handle it in there, not here  	_firstTime = false;  } - -  Common::Error AvalancheEngine::run() {  	Common::ErrorCode err = initialize();  	if (err != Common::kNoError)  		return err; - -  	// From bootstrp: -  	_firstTime = true;  	getArguments(); @@ -696,8 +572,6 @@ Common::Error AvalancheEngine::run() {  	if (!_zoomy)  		callMenu();    // Not run when zoomy. - -  	do {  		runAvalot(); @@ -722,11 +596,84 @@ Common::Error AvalancheEngine::run() {  	} while (!shouldQuit()); +	return Common::kNoError; +} +#if 0 +void AvalancheEngine::bFlightOff() { +	// setintvec(0x1c, old_1c); +} -	return Common::kNoError; +Common::String AvalancheEngine::elmToStr(Elm how) { +	switch (how) { +	case kNormal: +	case kMusical: +		return Common::String("jsb"); +	case kRegi: +		return Common::String("REGI"); +	case kElmpoyten: +		return Common::String("ELMPOYTEN"); +		// Useless, but silent a warning +	default: +		return Common::String(""); +	} +} + +// Getting used only in demo() / call_menu(). Going to be implemented at the same time with these. +bool AvalancheEngine::keyPressed() { +	warning("STUB: keyPressed()"); +	return false; +} + +// Same as keypressed1(). +void AvalancheEngine::flushBuffer() { +	warning("STUB: flushBuffer()"); +} + +// Same as keypressed1(). +void AvalancheEngine::demo() { +	warning("STUB: demo()"); +} + +void AvalancheEngine::runDemo() { +	warning("STUB: runDemo()"); +} + +void AvalancheEngine::dosShell() { +	warning("STUB: dosShell()"); +} + +//TODO: Remove these (b_flight) functions later ( https://github.com/tthurman/avalot/wiki/B-Flight ) +void AvalancheEngine::bFlight() {   //interrupt; +	_storage._skellern++;  } +// Needed in dos_shell(). TODO: Remove later. +Common::String AvalancheEngine::commandCom() { +	warning("STUB: commandCom()"); +	return ("STUB: commandCom()"); +} +// Needed for run_avalot()'s errors. TODO: Remove later. +void AvalancheEngine::explain(byte error) { +	warning("STUB: explain()"); +} + +// The original ones were all commented out, so probably there's no need +// of these two cursor functions at all. TODO: Remove later. +void AvalancheEngine::cursorOff() { +	warning("STUB: cursorOff()"); +} + +void AvalancheEngine::cursorOn() { +	warning("STUB: cursorOn()"); +} + +// Needed later. +void AvalancheEngine::quit() { +	cursorOn(); +} + +#endif  } // End of namespace Avalanche diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 998363a242..d6327521b6 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -141,33 +141,38 @@ private:  		byte _contents[1000];  	} _storage; -	Common::String _arguments, _demoArgs, _argsWithNoFilename; +	Common::String _arguments;  	bool _firstTime; -	byte _originalMode; -	byte *_old1c; -	Common::String _segofs;  	bool _zoomy; -	int32 _soundcard, _speed, _baseaddr, _irq, _dma; -	void cursorOff(); -	void cursorOn(); -	void quit(); -	Common::String commandCom(); -	void explain(byte error); -	void bFlight();  	void bFlightOn(); -	void bFlightOff(); -	Common::String elmToStr(Elm how);  	void run(Common::String what, bool withJsb, bool withBflight, Elm how);  	void getArguments();  	void getSlope();  	void callMenu();  	void runAvalot(); -	void runDemo(); -	void dosShell(); + +#if 0 +	Common::String _demoArgs, _argsWithNoFilename; +	byte _originalMode; +	byte *_old1c; +	Common::String _segofs; +	int32 _soundcard, _speed, _baseaddr, _irq, _dma; + +	void bFlightOff(); +	Common::String elmToStr(Elm how);  	bool keyPressed();  	void flushBuffer();  	void demo(); +	void runDemo(); +	void dosShell(); +	void bFlight(); +	Common::String commandCom(); +	void explain(byte error); +	void cursorOff(); +	void cursorOn(); +	void quit(); +#endif  };  } // End of namespace Avalanche diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 99c3950ef1..287f8443b3 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -185,8 +185,6 @@ void Avalot::setup() {  	}  } - -  void Avalot::run(Common::String arg) {  	setup(); @@ -195,8 +193,6 @@ void Avalot::run(Common::String arg) {  		_vm->updateEvents(); // The event handler. - -  		_vm->_lucerna->_clock.update();  		_vm->_dropdown->updateMenu();  		_vm->_gyro->forceNumlock(); @@ -205,8 +201,6 @@ void Avalot::run(Common::String arg) {  		_vm->_lucerna->checkClick();  		_vm->_timer->updateTimer(); - -  #ifdef DEBUG  		// ONLY FOR TESTING!!!  		for (byte i = 0; i < _vm->_gyro->_lineNum; i++) @@ -219,7 +213,6 @@ void Avalot::run(Common::String arg) {  		// ONLY FOR TESTING!!!  #endif -  		_vm->_graphics->refreshScreen();  // TODO: Maybe it'll have a better place later. Move it there when it's needed.  		uint32 delay = _vm->_system->getMillis() - beginLoop; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index a10c5e14ee..041236c73b 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -217,7 +217,7 @@ void Lucerna::loadAlso(byte num) {  		}  	}  	Common::String filename; -	filename = filename.format("also%d.avd", num); +	filename = Common::String::format("also%d.avd", num);  	if (!file.open(filename)) {  		warning("AVALANCHE: Lucerna: File not found: %s", filename.c_str());  		return; @@ -226,12 +226,14 @@ void Lucerna::loadAlso(byte num) {  	file.seek(128);  	byte alsoNum = file.readByte(); +	Common::String tmpStr;  	for (byte i = 0; i <= alsoNum; i++) {  		for (byte j = 0; j < 2; j++) {  			_vm->_gyro->_also[i][j] = new Common::String;  			*_vm->_gyro->_also[i][j] = readAlsoStringFromFile();  		} -		*_vm->_gyro->_also[i][0] = Common::String('\x9D') + *_vm->_gyro->_also[i][0] + Common::String('\x9D'); +		tmpStr = Common::String::format("\x9D%s\x9D", *_vm->_gyro->_also[i][0]); +		*_vm->_gyro->_also[i][0] = tmpStr;  	}  	memset(_vm->_gyro->_lines, 0xFF, sizeof(_vm->_gyro->_lines)); @@ -284,8 +286,10 @@ void Lucerna::loadAlso(byte num) {  	file.close();  	unScramble(); -	for (byte i = 0; i <= alsoNum; i++) -		*_vm->_gyro->_also[i][0] = Common::String(',') + *_vm->_gyro->_also[i][0] + ','; +	for (byte i = 0; i <= alsoNum; i++) { +		tmpStr = Common::String::format(",%s,", *_vm->_gyro->_also[i][0]); +		*_vm->_gyro->_also[i][0] = tmpStr; +	}  }  void Lucerna::loadRoom(byte num) { @@ -1150,7 +1154,7 @@ void Lucerna::checkClick() {  			} else if ((396 <= cursorPos.x) && (cursorPos.x <= 483))  				fxToggle();  			else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) -				_vm->_gyro->_mouseText = Common::String(13) + _vm->_gyro->_mouseText; +				_vm->_gyro->_mouseText.insertChar(Scrolls::kControlNewLine, 0);  		} else if (!_vm->_gyro->_dropsOk)  			_vm->_gyro->_mouseText = Common::String(13) + _vm->_gyro->_mouseText;  	} diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp index eaa2211224..cb6f10ad12 100644 --- a/engines/avalanche/timer.cpp +++ b/engines/avalanche/timer.cpp @@ -652,12 +652,12 @@ void Timer::avalotFalls() {  		_vm->_animation->_sprites[0]._stepNum++;  		addTimer(3, kProcAvalotFalls, kReasonFallingOver);  	} else { -		Common::String toDisplay; -		for (byte i = 0; i < 6; i++) -			toDisplay += _vm->_scrolls->kControlNewLine; -		for (byte i = 0; i < 6; i++) -			toDisplay += _vm->_scrolls->kControlInsertSpaces; -		toDisplay += _vm->_scrolls->kControlRegister + 'Z' + _vm->_scrolls->kControlIcon; +		Common::String toDisplay = Common::String::format("%c%c%c%c%c%c%c%c%c%c%c%c%cZ%c", +			Scrolls::kControlNewLine, Scrolls::kControlNewLine, Scrolls::kControlNewLine, +			Scrolls::kControlNewLine, Scrolls::kControlNewLine, Scrolls::kControlNewLine, +			Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, +			Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, Scrolls::kControlInsertSpaces, +			Scrolls::kControlRegister, Scrolls::kControlIcon);  		_vm->_scrolls->displayText(toDisplay);  	}  } | 
