AVALANCHE: Implement Dialogs::displayQuestion(), repair setSeed() and getRandomNumber() calls.

This commit is contained in:
uruk 2013-10-01 09:40:41 +02:00
parent bfb28c7a39
commit 8408fa46c7
4 changed files with 18 additions and 5 deletions

View File

@ -51,7 +51,9 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *
_console = new AvalancheConsole(this);
_rnd = new Common::RandomSource("avalanche");
_rnd->setSeed(42);
TimeDate time;
_system->getTimeAndDate(time);
_rnd->setSeed(time.tm_sec + time.tm_min + time.tm_hour);
// Needed because of Lucerna::load_also()
for (int i = 0; i < 31; i++) {

View File

@ -1526,7 +1526,7 @@ void AvalancheEngine::newGame() {
_her = kPeoplePardon;
_it = Parser::kPardon;
_lastPerson = kPeoplePardon; // = Pardon?
_passwordNum = _rnd->getRandomNumber(30) + 1; //Random(30) + 1;
_passwordNum = _rnd->getRandomNumber(29) + 1; //Random(30) + 1;
_userMovesAvvy = false;
_doingSpriteRun = false;
_avvyInBed = true;

View File

@ -66,8 +66,8 @@ void Closing::exitGame() {
_vm->_sound->stopSound();
getScreen(kScreenNagScreen);
byte nounId = _vm->_rnd->getRandomNumber(12);
byte verbId = _vm->_rnd->getRandomNumber(12);
byte nounId = _vm->_rnd->getRandomNumber(11);
byte verbId = _vm->_rnd->getRandomNumber(11);
Common::String result = nouns[nounId] + " will " + verbs[verbId] + " you";
putIn(result, 1628);
showScreen(); // No halt- it's already set up.

View File

@ -34,6 +34,7 @@
#include "common/textconsole.h"
#include "common/file.h"
#include "common/random.h"
namespace Avalanche {
@ -765,7 +766,17 @@ void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A
bool Dialogs::displayQuestion(Common::String question) {
displayText(question + kControlNewLine + kControlQuestion);
warning("STUB: Dialogs::displayQuestion()");
if (_scReturn && (_vm->_rnd->getRandomNumber(1) == 0)) { // Half-and-half chance.
Common::String tmpStr = Common::String::format("...Positive about that?%cI%c%c%c", kControlRegister, kControlIcon, kControlNewLine, kControlQuestion);
displayText(tmpStr); // Be annoying!
if (_scReturn && (_vm->_rnd->getRandomNumber(3) == 3)) { // Another 25% chance
// \? are used to avoid that ??! is parsed as a trigraph
tmpStr = Common::String::format("%c100%% certain\?\?!%c%c%c%c", kControlInsertSpaces, kControlInsertSpaces, kControlIcon, kControlNewLine, kControlQuestion);
displayText(tmpStr); // Be very annoying!
}
}
return _scReturn;
}