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->_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() {

View file

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

View file

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

View file

@ -39,53 +39,49 @@
#include "common/textconsole.h"
//#include "fileunit.h"
//#include "basher.h"
namespace Avalanche {
Enid::Enid(AvalancheEngine *vm) {
_vm = vm;
}
const Common::String Enid::crlf = Common::String(char(15)) + Common::String(char(12));
const char Enid::tab = '\t';
const char Enid::eof_ = '\n';
const Common::String Enid::kCrlf = Common::String(char(15)) + Common::String(char(12));
const char Enid::kTab = '\t';
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
crlf + eof_ + crlf + crlf + // 7
tab + "Glory to God in the highest," + crlf + // 31
tab + "and on earth peace, goodwill toward men." + // 42
crlf + tab + tab + tab + tab + // 6
kCrlf + kEof + kCrlf + kCrlf + // 7
kTab + "Glory to God in the highest," + kCrlf + // 31
kTab + "and on earth peace, goodwill toward men." + // 42
kCrlf + kTab + kTab + kTab + kTab + // 6
"Luke 2:14." + // 10
crlf + crlf + crlf + // 6
"1234567890" +crlf; // 11
kCrlf + kCrlf + kCrlf + // 6
"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 Common::String Enid::ttwashere = "Thomas was here ";
const int16 Enid::kAge = 18;
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) {
//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] = {
"Jan#", "Febr#", "March", "April", "May", "June", "July", "August",
"Septem*", "Octo*", "Novem*", "Decem*"
};
Common::String expanddate_result;
month = months[m];
switch (month[month.size()]) {
_month = months[m];
switch (_month[_month.size()]) {
case '#':
addon("uary");
break;
@ -94,34 +90,34 @@ Common::String Enid::expanddate(byte d, byte m, uint16 y) {
break;
}
day = _vm->_gyro->strf(d);
_day = _vm->_gyro->strf(d);
// d is always positive
if ((d <= 9) || ((d >= 21) && (d <= 31))) {
switch (d % 10) {
case 1:
day = day + "st";
_day = _day + "st";
break;
case 2:
day = day + "nd";
_day = _day + "nd";
break;
case 3:
day = day + "rd";
_day = _day + "rd";
break;
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;
}
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');
}
bool Enid::test_bug(byte what) {
bool Enid::testBug(byte what) {
bool test_bug_result;
if (what == 0) {
test_bug_result = false;
@ -129,47 +125,47 @@ bool Enid::test_bug(byte what) {
}
switch (what) {
case 2:
show_bug('7', "Error in filename!");
showBug('7', "Error in filename!");
break;
case 101:
show_bug('6', "Disk full!");
showBug('6', "Disk full!");
break;
case 150:
show_bug('4', "Disk is write-protected!");
showBug('4', "Disk is write-protected!");
break;
default:
show_bug('B', "Saving error!");
showBug('B', "Saving error!");
}
test_bug_result = true;
return test_bug_result;
}
void Enid::edna_save(Common::String name) {
warning("STUB: Enid::edna_save()");
void Enid::ednaSave(Common::String name) {
warning("STUB: Enid::ednaSave()");
}
void Enid::loaderror(Common::String x, char icon) {
void Enid::loadError(Common::String x, char icon) {
if (_vm->_gyro->holdthedawn) {
_vm->_gyro->holdthedawn = false;
_vm->_lucerna->dawn();
}
_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) {
warning("STUB: Enid::edna_load()");
void Enid::ednaLoad(Common::String name) {
warning("STUB: Enid::ednaLoad()");
}
void Enid::showheader() {
_vm->_scrolls->display(Common::String("Dir: ") + path + "\r\r\4");
void Enid::showHeader() {
_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!
warning("STUB: Enid::dir()");
}
void Enid::avvy_background() {
void Enid::avvyBackground() {
// Not really a filing procedure,
// but it's only called just before edna_load, so I thought I'd put it
// in Enid instead of, say, Lucerna.
@ -251,30 +247,30 @@ void Enid::avvy_background() {
#endif
}
void Enid::to_sundry(sundry &sund) {
void Enid::toSundry(sundry &sund) {
sund.qenid_filename = _vm->_gyro->enid_filename;
sund.qsoundfx = _vm->_gyro->soundfx;
sund.qthinks = _vm->_gyro->thinks;
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->soundfx = sund.qsoundfx;
_vm->_gyro->thinks = sund.qthinks;
_vm->_gyro->thinkthing = sund.qthinkthing;
}
void Enid::restore_dna() {
void Enid::restoreDna() {
// uint16 here, fv;
// 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
// 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()");
}
bool Enid::there_was_a_problem() {
return bug;
bool Enid::thereWasAProblem() {
return _bug;
}

View file

@ -32,72 +32,48 @@
#include "common/scummsys.h"
namespace Avalanche {
class AvalancheEngine;
class Enid {
public:
Enid(AvalancheEngine *vm);
void edna_save(Common::String name);
void edna_load(Common::String name);
void edna_reload(); // From Bootstrap's storage.
void ednaSave(Common::String name);
void ednaLoad(Common::String name);
void ednaReload(); // From Bootstrap's storage.
void dir(Common::String where);
void avvy_background();
void back_to_bootstrap(byte what);
bool there_was_a_problem();
void avvyBackground();
void backToBootstrap(byte what);
bool thereWasAProblem();
private:
AvalancheEngine *_vm;
static const Common::String crlf;
static const char tab;
static const char eof_;
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;
static const Common::String kCrlf;
static const char kTab, kEof;
static const Common::String kEdnaFirst, kEdnaId, kWasHere;
static const int16 kAge;
typedef char FourType[5];
static const FourType kAvariciusFile;
bool _bug;
Common::String _path, _groi;
Common::String _month, _day;
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);
bool test_bug(byte what);
void showBug(char icon, Common::String strn);
bool testBug(byte what);
void loaderror(Common::String x, char icon);
void showheader();
void to_sundry(sundry &sund);
void from_sundry(sundry sund);
void restore_dna();
void loadError(Common::String x, char icon);
void showHeader();
void toSundry(sundry &sund);
void fromSundry(sundry sund);
void restoreDna();
};
} // End of namespace Avalanche.

View file

@ -337,7 +337,7 @@ void Timeout::hang_around2() {
_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() {

View file

@ -878,7 +878,7 @@ void Trip::call_special(uint16 which) {
_vm->_lucerna->dusk();
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->_enid->back_to_bootstrap(3);
_vm->_enid->backToBootstrap(3);
break;
case 5:
if (_vm->_gyro->dna.friar_will_tie_you_up) {