diff options
| -rw-r--r-- | engines/gob/pregob/onceupon/brokenstrings.h | 7 | ||||
| -rw-r--r-- | engines/gob/pregob/onceupon/onceupon.cpp | 154 | ||||
| -rw-r--r-- | engines/gob/pregob/onceupon/onceupon.h | 35 | 
3 files changed, 191 insertions, 5 deletions
| diff --git a/engines/gob/pregob/onceupon/brokenstrings.h b/engines/gob/pregob/onceupon/brokenstrings.h index 98dcb720fb..0a40493cc1 100644 --- a/engines/gob/pregob/onceupon/brokenstrings.h +++ b/engines/gob/pregob/onceupon/brokenstrings.h @@ -40,7 +40,12 @@ static const BrokenString kBrokenStringsGerman[] = {  	{ "  Fortgeschrittene"           , "  Fortgeschritten"            },  	{ "die Vespe"                    , "die Wespe"                    },  	{ "das Rhinoceros"               , "das Rhinozeros"               }, -	{ "die Heusschrecke"             , "die Heuschrecke"              } +	{ "die Heusschrecke"             , "die Heuschrecke"              }, +	{ "Das, von Drachen gebrachte"   , "Das vom Drachen gebrachte"    }, +	{ "Am Waldesrand es sieht"       , "Am Waldesrand sieht es"       }, +	{ " das Kind den Palast."        , "das Kind den Palast."         }, +	{ "Am Waldessaum sieht"          , "Am Waldesrand sieht"          }, +	{ "tipp auf ESC!"                , "dr\201cke ESC!"               }  };  static const BrokenStringLanguage kBrokenStrings[kLanguageCount] = { diff --git a/engines/gob/pregob/onceupon/onceupon.cpp b/engines/gob/pregob/onceupon/onceupon.cpp index 785d78b769..fb9629566c 100644 --- a/engines/gob/pregob/onceupon/onceupon.cpp +++ b/engines/gob/pregob/onceupon/onceupon.cpp @@ -131,6 +131,24 @@ const char *OnceUpon::kSound[kSoundMAX] = {  	"diamant.snd"  }; +const OnceUpon::SectionFunc OnceUpon::kSectionFuncs[kSectionCount] = { +	&OnceUpon::sectionStork, +	&OnceUpon::sectionChapter1, +	&OnceUpon::section02, +	&OnceUpon::sectionChapter2, +	&OnceUpon::section04, +	&OnceUpon::sectionChapter3, +	&OnceUpon::section06, +	&OnceUpon::sectionChapter4, +	&OnceUpon::section08, +	&OnceUpon::sectionChapter5, +	&OnceUpon::section10, +	&OnceUpon::sectionChapter6, +	&OnceUpon::section12, +	&OnceUpon::sectionChapter7, +	&OnceUpon::sectionEnd +}; +  OnceUpon::ScreenBackup::ScreenBackup() : palette(-1), changedCursor(false), cursorVisible(false) {  	screen = new Surface(320, 200, 1); @@ -194,6 +212,9 @@ void OnceUpon::init() {  	// We start with an invalid palette  	_palette = -1; +	// No quit requested at start +	_quit = false; +  	// We start with no selected difficulty and at section 0  	_difficulty = kDifficultyMAX;  	_section    = 0; @@ -930,7 +951,7 @@ void OnceUpon::drawMainMenu() {  		if (!button.needDraw)  			continue; -		if (_section >= (uint)button.id) +		if (_section >= (int)button.id)  			drawButton(*_vm->_draw->_backSurface, elements, button);  	} @@ -998,6 +1019,41 @@ void OnceUpon::clearIngameMenu(const Surface &background) {  	drawLineByLine(background, left, top, right, bottom, left, top);  } +OnceUpon::MenuAction OnceUpon::doIngameMenu() { +	// Show the ingame menu +	MenuAction action = handleIngameMenu(); + +	if ((action == kMenuActionQuit) || _vm->shouldQuit()) { + +		// User pressed the quit button, or quit ScummVM +		_quit = true; +		return kMenuActionQuit; + +	} else if (action == kMenuActionPlay) { + +		// User pressed the return to game button +		return kMenuActionPlay; + +	} else if (kMenuActionMainMenu) { + +		// User pressed the return to main menu button +		return handleMainMenu(); +	} + +	return action; +} + +OnceUpon::MenuAction OnceUpon::doIngameMenu(int16 key, MouseButtons mouseButtons) { +	if ((key != kKeyEscape) && (mouseButtons != kMouseButtonsRight)) +		return kMenuActionNone; + +	MenuAction action = doIngameMenu(); +	if (action == kMenuActionPlay) +		return kMenuActionNone; + +	return action; +} +  int OnceUpon::checkButton(const MenuButton *buttons, uint count, int16 x, int16 y, int failValue) const {  	// Look through all buttons, and return the ID of the button we're in @@ -1203,7 +1259,101 @@ void OnceUpon::anPlayAnimalName(const Common::String &animal, uint language) {  }  void OnceUpon::playGame() { -	warning("OnceUpon::playGame(): TODO"); +	while (!_vm->shouldQuit() && !_quit) { +		// Play a section and advance to the next section if we finished it +		if (playSection()) +			_section = MIN(_section + 1, kSectionCount - 1); +	} + +	// If we quit through the game and not through ScummVM, show the "Bye Bye" screen +	if (!_vm->shouldQuit()) +		showByeBye(); +} + +bool OnceUpon::playSection() { +	if ((_section < 0) || (_section >= ARRAYSIZE(kSectionFuncs))) { +		_quit = true; +		return false; +	} + +	return (this->*kSectionFuncs[_section])(); +} + +bool OnceUpon::sectionStork() { +	warning("OnceUpon::sectionStork(): TODO"); +	return true; +} + +bool OnceUpon::sectionChapter1() { +	showChapter(1); +	return true; +} + +bool OnceUpon::section02() { +	warning("OnceUpon::section02(): TODO"); +	return true; +} + +bool OnceUpon::sectionChapter2() { +	showChapter(2); +	return true; +} + +bool OnceUpon::section04() { +	warning("OnceUpon::section04(): TODO"); +	return true; +} + +bool OnceUpon::sectionChapter3() { +	showChapter(3); +	return true; +} + +bool OnceUpon::section06() { +	warning("OnceUpon::section06(): TODO"); +	return true; +} + +bool OnceUpon::sectionChapter4() { +	showChapter(4); +	return true; +} + +bool OnceUpon::section08() { +	warning("OnceUpon::section08(): TODO"); +	return true; +} + +bool OnceUpon::sectionChapter5() { +	showChapter(5); +	return true; +} + +bool OnceUpon::section10() { +	warning("OnceUpon::section10(): TODO"); +	return true; +} + +bool OnceUpon::sectionChapter6() { +	showChapter(6); +	return true; +} + +bool OnceUpon::section12() { +	warning("OnceUpon::section12(): TODO"); +	return true; +} + +bool OnceUpon::sectionChapter7() { +	showChapter(7); +	return true; +} + +bool OnceUpon::sectionEnd() { +	warning("OnceUpon::sectionEnd(): TODO"); + +	_quit = true; +	return false;  }  } // End of namespace OnceUpon diff --git a/engines/gob/pregob/onceupon/onceupon.h b/engines/gob/pregob/onceupon/onceupon.h index 08c8803c67..0cae369758 100644 --- a/engines/gob/pregob/onceupon/onceupon.h +++ b/engines/gob/pregob/onceupon/onceupon.h @@ -136,7 +136,7 @@ private:  	/** The number of game sections. */ -	static const uint kSectionCount = 15; +	static const int kSectionCount = 15;  	static const MenuButton kMainMenuDifficultyButton[]; ///< Difficulty buttons.  	static const MenuButton kSectionButtons[];           ///< Section buttons. @@ -149,6 +149,10 @@ private:  	/** All general game sounds we know about. */  	static const char *kSound[kSoundMAX]; +	/** Function pointer type for a section handler. */ +	typedef bool (OnceUpon::*SectionFunc)(); +	/** Section handler function. */ +	static const SectionFunc kSectionFuncs[kSectionCount];  	// -- General helpers -- @@ -219,6 +223,11 @@ private:  	/** Clear the ingame menu in an animated way. */  	void clearIngameMenu(const Surface &background); +	/** Handle the whole ingame menu. */ +	MenuAction doIngameMenu(); +	/** Handle the whole ingame menu if ESC or right mouse button was pressed. */ +	MenuAction doIngameMenu(int16 key, MouseButtons mouseButtons); +  	// -- Menu button helpers -- @@ -243,6 +252,26 @@ private:  	/** Play / Display the name of an animal in one language. */  	void anPlayAnimalName(const Common::String &animal, uint language); +	// -- Game sections -- + +	bool playSection(); + +	bool sectionStork(); +	bool sectionChapter1(); +	bool section02(); +	bool sectionChapter2(); +	bool section04(); +	bool sectionChapter3(); +	bool section06(); +	bool sectionChapter4(); +	bool section08(); +	bool sectionChapter5(); +	bool section10(); +	bool sectionChapter6(); +	bool section12(); +	bool sectionChapter7(); +	bool sectionEnd(); +  	/** Did we open the game archives? */  	bool _openedArchives; @@ -256,8 +285,10 @@ private:  	/** The current palette. */  	int _palette; +	bool _quit; ///< Did the user request a normal game quit? +  	Difficulty _difficulty; ///< The current difficulty. -	uint8      _section;    ///< The current game section. +	int        _section;    ///< The current game section.  };  } // End of namespace OnceUpon | 
