AVALANCHE: Do renaming in Enid. (Keep the refactoring for the implementation of it.)

This commit is contained in:
uruk 2013-09-05 12:59:01 +02:00
parent a698a2a2f9
commit ce95f738be
7 changed files with 75 additions and 121 deletions

View file

@ -1246,7 +1246,7 @@ void Acci::giveGeidaTheLute() {
_vm->_visa->dixi('q', 64); // She plays it. _vm->_visa->dixi('q', 64); // She plays it.
_vm->_timeout->set_up_timer(1, _vm->_timeout->procgive_lute_to_geida, _vm->_timeout->reason_geida_sings); _vm->_timeout->set_up_timer(1, _vm->_timeout->procgive_lute_to_geida, _vm->_timeout->reason_geida_sings);
_vm->_enid->back_to_bootstrap(4); _vm->_enid->backToBootstrap(4);
} }
void Acci::playHarp() { void Acci::playHarp() {

View file

@ -221,8 +221,6 @@ void MenuItem::parseKey(char c) {
_dr->_vm->_gyro->blip(); _dr->_vm->_gyro->blip();
} }
void MenuBar::init(Dropdown *dr) { void MenuBar::init(Dropdown *dr) {
_dr = dr; _dr = dr;
_menuNum = 0; _menuNum = 0;
@ -282,8 +280,6 @@ void MenuBar::chooseMenuItem(int16 x) {
} while (i < _menuNum); } while (i < _menuNum);
} }
Dropdown::Dropdown(AvalancheEngine *vm) { Dropdown::Dropdown(AvalancheEngine *vm) {
_vm = vm; _vm = vm;
_activeMenuItem.init(this); _activeMenuItem.init(this);
@ -599,7 +595,7 @@ void Dropdown::runMenuFile() {
warning("STUB: Dropdown::runMenuFile()"); warning("STUB: Dropdown::runMenuFile()");
break; break;
case 4: case 4:
_vm->_enid->back_to_bootstrap(2); _vm->_enid->backToBootstrap(2);
break; break;
case 5: case 5:
_vm->_lucerna->callverb(_vm->_acci->kVerbCodeQuit); _vm->_lucerna->callverb(_vm->_acci->kVerbCodeQuit);
@ -710,8 +706,6 @@ void Dropdown::runMenuWith() {
_vm->_lucerna->callverb(_vm->_gyro->verbstr[_activeMenuItem._choiceNum]); _vm->_lucerna->callverb(_vm->_gyro->verbstr[_activeMenuItem._choiceNum]);
} }
void Dropdown::setupMenu() { void Dropdown::setupMenu() {
_menuBar.init(this); _menuBar.init(this);
_activeMenuItem.init(this); _activeMenuItem.init(this);

View file

@ -42,12 +42,8 @@ class AvalancheEngine;
class Dropdown; class Dropdown;
typedef void (Dropdown::*DropdownFunc)(); typedef void (Dropdown::*DropdownFunc)();
class HeadType { class HeadType {
public: public:
Common::String _title; Common::String _title;
@ -65,8 +61,6 @@ private:
Dropdown *_dr; Dropdown *_dr;
}; };
struct OptionType { struct OptionType {
Common::String _title; Common::String _title;
byte _trigger; byte _trigger;
@ -74,8 +68,6 @@ struct OptionType {
bool _valid; bool _valid;
}; };
class MenuItem { class MenuItem {
public: public:
OptionType _options[12]; OptionType _options[12];
@ -104,8 +96,6 @@ private:
Dropdown *_dr; Dropdown *_dr;
}; };
class MenuBar { class MenuBar {
public: public:
HeadType _menuItems[8]; HeadType _menuItems[8];
@ -122,8 +112,6 @@ private:
Dropdown *_dr; Dropdown *_dr;
}; };
class Dropdown { class Dropdown {
public: public:
friend class HeadType; friend class HeadType;

View file

@ -39,53 +39,49 @@
#include "common/textconsole.h" #include "common/textconsole.h"
//#include "fileunit.h"
//#include "basher.h"
namespace Avalanche { namespace Avalanche {
Enid::Enid(AvalancheEngine *vm) { Enid::Enid(AvalancheEngine *vm) {
_vm = vm; _vm = vm;
} }
const Common::String Enid::crlf = Common::String(char(15)) + Common::String(char(12)); const Common::String Enid::kCrlf = Common::String(char(15)) + Common::String(char(12));
const char Enid::tab = '\t'; const char Enid::kTab = '\t';
const char Enid::eof_ = '\n'; const char Enid::kEof = '\n';
const Common::String Enid::ednafirst = const Common::String Enid::kEdnaFirst =
Common::String("This is an EDNA-based file, saved by a Thorsoft game. Good luck!") + // 64 Common::String("This is an EDNA-based file, saved by a Thorsoft game. Good luck!") + // 64
crlf + eof_ + crlf + crlf + // 7 kCrlf + kEof + kCrlf + kCrlf + // 7
tab + "Glory to God in the highest," + crlf + // 31 kTab + "Glory to God in the highest," + kCrlf + // 31
tab + "and on earth peace, goodwill toward men." + // 42 kTab + "and on earth peace, goodwill toward men." + // 42
crlf + tab + tab + tab + tab + // 6 kCrlf + kTab + kTab + kTab + kTab + // 6
"Luke 2:14." + // 10 "Luke 2:14." + // 10
crlf + crlf + crlf + // 6 kCrlf + kCrlf + kCrlf + // 6
"1234567890" +crlf; // 11 "1234567890" +kCrlf; // 11
const Common::String Enid::ednaid = Common::String("TT") + char(261) + char(60) + char(1) + char(165) + char(261) + char(231) + char(261); const Common::String Enid::kEdnaId = Common::String("TT") + char(261) + char(60) + char(1) + char(165) + char(261) + char(231) + char(261);
const int16 Enid::ttage = 18; const int16 Enid::kAge = 18;
const Common::String Enid::ttwashere = "Thomas was here "; const Common::String Enid::kWasHere = "Thomas was here ";
const Enid::fourtype Enid::avaricius_file = "Avvy"; const Enid::FourType Enid::kAvariciusFile = "Avvy";
void Enid::addon(Common::String x) { void Enid::addon(Common::String x) {
//month[0]--; //month[0]--;
month = month + x; _month = _month + x;
} }
Common::String Enid::expanddate(byte d, byte m, uint16 y) { Common::String Enid::expandDate(byte d, byte m, uint16 y) {
const Common::String months[12] = { const Common::String months[12] = {
"Jan#", "Febr#", "March", "April", "May", "June", "July", "August", "Jan#", "Febr#", "March", "April", "May", "June", "July", "August",
"Septem*", "Octo*", "Novem*", "Decem*" "Septem*", "Octo*", "Novem*", "Decem*"
}; };
Common::String expanddate_result; Common::String expanddate_result;
month = months[m]; _month = months[m];
switch (month[month.size()]) { switch (_month[_month.size()]) {
case '#': case '#':
addon("uary"); addon("uary");
break; break;
@ -94,34 +90,34 @@ Common::String Enid::expanddate(byte d, byte m, uint16 y) {
break; break;
} }
day = _vm->_gyro->strf(d); _day = _vm->_gyro->strf(d);
// d is always positive // d is always positive
if ((d <= 9) || ((d >= 21) && (d <= 31))) { if ((d <= 9) || ((d >= 21) && (d <= 31))) {
switch (d % 10) { switch (d % 10) {
case 1: case 1:
day = day + "st"; _day = _day + "st";
break; break;
case 2: case 2:
day = day + "nd"; _day = _day + "nd";
break; break;
case 3: case 3:
day = day + "rd"; _day = _day + "rd";
break; break;
default: default:
day = day + "th"; _day = _day + "th";
} }
} }
expanddate_result = day + ' ' + month + ' ' + _vm->_gyro->strf(y); expanddate_result = _day + ' ' + _month + ' ' + _vm->_gyro->strf(y);
return expanddate_result; return expanddate_result;
} }
void Enid::show_bug(char icon, Common::String strn) { void Enid::showBug(char icon, Common::String strn) {
_vm->_scrolls->display(Common::String("\7\6\23") + icon + "\26\r" + strn + '\15'); _vm->_scrolls->display(Common::String("\7\6\23") + icon + "\26\r" + strn + '\15');
} }
bool Enid::test_bug(byte what) { bool Enid::testBug(byte what) {
bool test_bug_result; bool test_bug_result;
if (what == 0) { if (what == 0) {
test_bug_result = false; test_bug_result = false;
@ -129,47 +125,47 @@ bool Enid::test_bug(byte what) {
} }
switch (what) { switch (what) {
case 2: case 2:
show_bug('7', "Error in filename!"); showBug('7', "Error in filename!");
break; break;
case 101: case 101:
show_bug('6', "Disk full!"); showBug('6', "Disk full!");
break; break;
case 150: case 150:
show_bug('4', "Disk is write-protected!"); showBug('4', "Disk is write-protected!");
break; break;
default: default:
show_bug('B', "Saving error!"); showBug('B', "Saving error!");
} }
test_bug_result = true; test_bug_result = true;
return test_bug_result; return test_bug_result;
} }
void Enid::edna_save(Common::String name) { void Enid::ednaSave(Common::String name) {
warning("STUB: Enid::edna_save()"); warning("STUB: Enid::ednaSave()");
} }
void Enid::loaderror(Common::String x, char icon) { void Enid::loadError(Common::String x, char icon) {
if (_vm->_gyro->holdthedawn) { if (_vm->_gyro->holdthedawn) {
_vm->_gyro->holdthedawn = false; _vm->_gyro->holdthedawn = false;
_vm->_lucerna->dawn(); _vm->_lucerna->dawn();
} }
_vm->_scrolls->display(Common::String('\7') + '\6' + '\23' + icon + '\26' + "Loading error: " + "\r\r\22" + x); _vm->_scrolls->display(Common::String('\7') + '\6' + '\23' + icon + '\26' + "Loading error: " + "\r\r\22" + x);
bug = true; _bug = true;
} }
void Enid::edna_load(Common::String name) { void Enid::ednaLoad(Common::String name) {
warning("STUB: Enid::edna_load()"); warning("STUB: Enid::ednaLoad()");
} }
void Enid::showheader() { void Enid::showHeader() {
_vm->_scrolls->display(Common::String("Dir: ") + path + "\r\r\4"); _vm->_scrolls->display(Common::String("Dir: ") + _path + "\r\r\4");
} }
void Enid::dir(Common::String where) { // OK, it worked in Avaricius, let's do it in Avalot! void Enid::dir(Common::String where) { // OK, it worked in Avaricius, let's do it in Avalot!
warning("STUB: Enid::dir()"); warning("STUB: Enid::dir()");
} }
void Enid::avvy_background() { void Enid::avvyBackground() {
// Not really a filing procedure, // Not really a filing procedure,
// but it's only called just before edna_load, so I thought I'd put it // but it's only called just before edna_load, so I thought I'd put it
// in Enid instead of, say, Lucerna. // in Enid instead of, say, Lucerna.
@ -251,30 +247,30 @@ void Enid::avvy_background() {
#endif #endif
} }
void Enid::to_sundry(sundry &sund) { void Enid::toSundry(sundry &sund) {
sund.qenid_filename = _vm->_gyro->enid_filename; sund.qenid_filename = _vm->_gyro->enid_filename;
sund.qsoundfx = _vm->_gyro->soundfx; sund.qsoundfx = _vm->_gyro->soundfx;
sund.qthinks = _vm->_gyro->thinks; sund.qthinks = _vm->_gyro->thinks;
sund.qthinkthing = _vm->_gyro->thinkthing; sund.qthinkthing = _vm->_gyro->thinkthing;
} }
void Enid::from_sundry(sundry sund) { void Enid::fromSundry(sundry sund) {
_vm->_gyro->enid_filename = sund.qenid_filename; _vm->_gyro->enid_filename = sund.qenid_filename;
_vm->_gyro->soundfx = sund.qsoundfx; _vm->_gyro->soundfx = sund.qsoundfx;
_vm->_gyro->thinks = sund.qthinks; _vm->_gyro->thinks = sund.qthinks;
_vm->_gyro->thinkthing = sund.qthinkthing; _vm->_gyro->thinkthing = sund.qthinkthing;
} }
void Enid::restore_dna() { void Enid::restoreDna() {
// uint16 here, fv; // uint16 here, fv;
// sundry sund; // sundry sund;
warning("STUB: Enid::restore_dna()"); warning("STUB: Enid::restoreDna()");
} }
void Enid::edna_reload() { void Enid::ednaReload() {
restore_dna(); restoreDna();
_vm->_gyro->seescroll = true; // This prevents display of the new sprites before the _vm->_gyro->seescroll = true; // This prevents display of the new sprites before the
// new picture is loaded. // new picture is loaded.
@ -293,12 +289,12 @@ void Enid::edna_reload() {
} }
} }
void Enid::back_to_bootstrap(byte what) { void Enid::backToBootstrap(byte what) {
warning("STUB: Enid::back_to_bootstrap()"); warning("STUB: Enid::back_to_bootstrap()");
} }
bool Enid::there_was_a_problem() { bool Enid::thereWasAProblem() {
return bug; return _bug;
} }

View file

@ -32,72 +32,48 @@
#include "common/scummsys.h" #include "common/scummsys.h"
namespace Avalanche { namespace Avalanche {
class AvalancheEngine; class AvalancheEngine;
class Enid { class Enid {
public: public:
Enid(AvalancheEngine *vm); Enid(AvalancheEngine *vm);
void ednaSave(Common::String name);
void edna_save(Common::String name); void ednaLoad(Common::String name);
void ednaReload(); // From Bootstrap's storage.
void edna_load(Common::String name);
void edna_reload(); // From Bootstrap's storage.
void dir(Common::String where); void dir(Common::String where);
void avvyBackground();
void avvy_background(); void backToBootstrap(byte what);
bool thereWasAProblem();
void back_to_bootstrap(byte what);
bool there_was_a_problem();
private: private:
AvalancheEngine *_vm; AvalancheEngine *_vm;
static const Common::String crlf; static const Common::String kCrlf;
static const char tab; static const char kTab, kEof;
static const char eof_; static const Common::String kEdnaFirst, kEdnaId, kWasHere;
static const int16 kAge;
static const Common::String ednafirst;
static const Common::String ednaid;
static const int16 ttage;
static const Common::String ttwashere;
typedef char fourtype[5];
static const fourtype avaricius_file;
bool bug;
Common::String path, groi;
Common::String month;
Common::String day;
typedef char FourType[5];
static const FourType kAvariciusFile;
bool _bug;
Common::String _path, _groi;
Common::String _month, _day;
void addon(Common::String x); void addon(Common::String x);
Common::String expanddate(byte d, byte m, uint16 y); Common::String expandDate(byte d, byte m, uint16 y);
void show_bug(char icon, Common::String strn); void showBug(char icon, Common::String strn);
bool test_bug(byte what); bool testBug(byte what);
void loaderror(Common::String x, char icon); void loadError(Common::String x, char icon);
void showHeader();
void showheader(); void toSundry(sundry &sund);
void fromSundry(sundry sund);
void to_sundry(sundry &sund); void restoreDna();
void from_sundry(sundry sund);
void restore_dna();
}; };
} // End of namespace Avalanche. } // End of namespace Avalanche.

View file

@ -337,7 +337,7 @@ void Timeout::hang_around2() {
_vm->_gyro->dna.tied_up = false; _vm->_gyro->dna.tied_up = false;
_vm->_enid->back_to_bootstrap(1); // Call the shoot-'em-up. _vm->_enid->backToBootstrap(1); // Call the shoot-'em-up.
} }
void Timeout::after_the_shootemup() { void Timeout::after_the_shootemup() {

View file

@ -878,7 +878,7 @@ void Trip::call_special(uint16 which) {
_vm->_lucerna->dusk(); _vm->_lucerna->dusk();
tr[0].turn(right); // you'll see this after we get back from bootstrap tr[0].turn(right); // you'll see this after we get back from bootstrap
_vm->_timeout->set_up_timer(1, _vm->_timeout->procghost_room_phew, _vm->_timeout->reason_ghost_room_phew); _vm->_timeout->set_up_timer(1, _vm->_timeout->procghost_room_phew, _vm->_timeout->reason_ghost_room_phew);
_vm->_enid->back_to_bootstrap(3); _vm->_enid->backToBootstrap(3);
break; break;
case 5: case 5:
if (_vm->_gyro->dna.friar_will_tie_you_up) { if (_vm->_gyro->dna.friar_will_tie_you_up) {