aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoruruk2013-06-28 18:23:04 +0200
committeruruk2013-06-28 18:23:04 +0200
commit3c413c7ccb7925fce6d80f8b158747b0bb39d326 (patch)
tree369968ba78b1f6b493b3b5298d825a62f37cf5fa /engines
parent7623ea79fe1db5c505e03459977e8ea38ffbc03c (diff)
downloadscummvm-rg350-3c413c7ccb7925fce6d80f8b158747b0bb39d326.tar.gz
scummvm-rg350-3c413c7ccb7925fce6d80f8b158747b0bb39d326.tar.bz2
scummvm-rg350-3c413c7ccb7925fce6d80f8b158747b0bb39d326.zip
AVALANCHE: Enid: replace namespace with class.
Diffstat (limited to 'engines')
-rw-r--r--engines/avalanche/avalanche.cpp1
-rw-r--r--engines/avalanche/avalanche.h2
-rw-r--r--engines/avalanche/enid2.cpp422
-rw-r--r--engines/avalanche/enid2.h51
4 files changed, 258 insertions, 218 deletions
diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp
index e17f1ee9bc..c6821711df 100644
--- a/engines/avalanche/avalanche.cpp
+++ b/engines/avalanche/avalanche.cpp
@@ -54,6 +54,7 @@ namespace Avalanche {
_scrolls.setParent(this);
_visa.setParent(this);
_lucerna.setParent(this);
+ _enid.setParent(this);
}
AvalancheEngine::~AvalancheEngine() {
diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h
index e0f544c73b..643b97c7f0 100644
--- a/engines/avalanche/avalanche.h
+++ b/engines/avalanche/avalanche.h
@@ -36,6 +36,7 @@
#include "avalanche/scrolls2.h"
#include "avalanche/visa2.h"
#include "avalanche/lucerna2.h"
+#include "avalanche/enid2.h"
#include "engines/engine.h"
#include "engines/advancedDetector.h"
@@ -59,6 +60,7 @@ public:
Scrolls _scrolls;
Visa _visa;
Lucerna _lucerna;
+ Enid _enid;
AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd);
diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp
index 9c7d64a1b1..3ca6daa2af 100644
--- a/engines/avalanche/enid2.cpp
+++ b/engines/avalanche/enid2.cpp
@@ -30,6 +30,8 @@
#include "common/scummsys.h"
#include "common/textconsole.h"
+#include "avalanche/avalanche.h"
+
#include "avalanche/enid2.h"
#include "avalanche/scrolls2.h"
#include "avalanche/lucerna2.h"
@@ -43,285 +45,273 @@
namespace Avalanche {
- namespace Enid {
-
- const Common::String crlf = Common::String(char(15)) + Common::String(char(12));
- const char tab = '\t';
- const char eof_ = '\n';
-
- const Common::String ednafirst =
- 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*/
- "Luke 2:14." + /*10*/
- crlf + crlf + crlf + /* 6 */
- "1234567890" +crlf; /*11*/
-
- const Common::String ednaid = Common::String("TT") + char(261) + char(60) + char(1) + char(165) + char(261) + char(231) + char(261);
-
- const int16 ttage = 18;
- const Common::String ttwashere = "Thomas was here ";
-
- bool bug;
-
-
-
- Common::String expanddate(byte d, byte m, uint16 y);
-
- static Common::String month;
-
- static Common::String day;
-
- static void addon(Common::String x) {
- //month[0]--;
- month = month + x;
+void Enid::setParent(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::ednafirst =
+ 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*/
+ "Luke 2:14." + /*10*/
+ crlf + crlf + crlf + /* 6 */
+ "1234567890" +crlf; /*11*/
+
+const Common::String Enid::ednaid = 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 Enid::fourtype Enid::avaricius_file = "Avvy";
+
+
+
+void Enid::addon(Common::String x) {
+ //month[0]--;
+ month = month + x;
+}
+
+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()]) {
+ case '#':
+ addon("uary");
+ break;
+ case '*':
+ addon("ber");
+ break;
}
- Common::String 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()]) {
- case '#':
- addon("uary");
+ day = _vm->_gyro.strf(d);
+
+ if (((d >= 0) && (d <= 9)) || ((d >= 21) && (d <= 31)))
+ switch (d % 10) {
+ case 1:
+ day = day + "st";
+ break;
+ case 2:
+ day = day + "nd";
break;
- case '*':
- addon("ber");
+ case 3:
+ day = day + "rd";
break;
+ default:
+ day = day + "th";
}
- day = Gyro::strf(d);
-
- if (((d >= 0) && (d <= 9)) || ((d >= 21) && (d <= 31)))
- switch (d % 10) {
- case 1:
- day = day + "st";
- break;
- case 2:
- day = day + "nd";
- break;
- case 3:
- day = day + "rd";
- break;
- default:
- day = day + "th";
- }
-
- expanddate_result = day + ' ' + month + ' ' + Gyro::strf(y);
- return expanddate_result;
- }
+ expanddate_result = day + ' ' + month + ' ' + _vm->_gyro.strf(y);
+ return expanddate_result;
+}
- void edna_save(Common::String name);
- static void show_bug(char icon, Common::String strn) {
- Scrolls::display(Common::String("\7\6\23") + icon + "\26\r" + strn + '\15');
- }
- static bool test_bug(byte what) {
- bool test_bug_result;
- if (what == 0) {
- test_bug_result = false;
- return test_bug_result;
- }
- switch (what) {
- case 2:
- show_bug('7', "Error in filename!");
- break;
- case 101:
- show_bug('6', "Disk full!");
- break;
- case 150:
- show_bug('4', "Disk is write-protected!");
- break;
- default:
- show_bug('B', "Saving error!");
- }
- test_bug_result = true;
+void Enid::show_bug(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 test_bug_result;
+ if (what == 0) {
+ test_bug_result = false;
return test_bug_result;
}
-
- void edna_save(Common::String name) {
- warning("STUB: Enid::edna_save()");
+ switch (what) {
+ case 2:
+ show_bug('7', "Error in filename!");
+ break;
+ case 101:
+ show_bug('6', "Disk full!");
+ break;
+ case 150:
+ show_bug('4', "Disk is write-protected!");
+ break;
+ default:
+ show_bug('B', "Saving error!");
}
-
- void loaderror(Common::String x, char icon) {
- if (Gyro::holdthedawn) {
- Gyro::holdthedawn = false;
- Lucerna::dawn();
- }
- Scrolls::display(Common::String('\7') + '\6' + '\23' + icon + '\26' + "Loading error: " + "\r\r\22" + x);
- bug = true;
+ test_bug_result = true;
+ return test_bug_result;
+}
+
+void Enid::edna_save(Common::String name) {
+ warning("STUB: Enid::edna_save()");
+}
+
+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;
+}
- typedef char fourtype[5];
-
+void Enid::edna_load(Common::String name) {
+ warning("STUB: Enid::edna_load()");
+}
- const fourtype avaricius_file = "Avvy";
- void edna_load(Common::String name) {
- warning("STUB: Enid::edna_load()");
- }
- void dir(Common::String where);
+void Enid::showheader() {
+ _vm->_scrolls.display(Common::String("Dir: ") + path + "\r\r\4");
+}
- static Common::String path, groi;
-
- static void showheader() {
- 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 dir(Common::String where) { /* OK, it worked in Avaricius, let's do it in Avalot! */
- warning("STUB: Enid::dir()");
- }
-
- void avvy_background() { /* 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. */
+void Enid::avvy_background() { /* 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. */
- /* port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1; port[$3CF]:=1; { Blue. }*/
- /*
- asm
- mov dx,$3c4; mov al,2; out dx,al; { Set up the VGA to use the "blue" }
- mov dx,$3ce; mov al,4; out dx,al; { register. }
- mov dx,$3c5; mov al,1; out dx,al;
- mov dx,$3cf; out dx,al;
+ /* port[$3c4]:=2; port[$3ce]:=4; port[$3C5]:=1; port[$3CF]:=1; { Blue. }*/
+ /*
+ asm
+ mov dx,$3c4; mov al,2; out dx,al; { Set up the VGA to use the "blue" }
+ mov dx,$3ce; mov al,4; out dx,al; { register. }
+ mov dx,$3c5; mov al,1; out dx,al;
+ mov dx,$3cf; out dx,al;
- mov bx,$A000; call far ptr @drawup;
- mov bx,$A400; call far ptr @drawup;
+ mov bx,$A000; call far ptr @drawup;
+ mov bx,$A400; call far ptr @drawup;
- jmp @the_end;
+ jmp @the_end;
- @drawup:
+ @drawup:
- mov es,bx; { The segment to copy it to... }
- mov di,$370; { The offset (10 pixels down, plus 1 offset.) }
+ mov es,bx; { The segment to copy it to... }
+ mov di,$370; { The offset (10 pixels down, plus 1 offset.) }
- mov cx,10;
- mov ax,$AA4A; call far ptr @sameline; { Print "AVVY" }
- mov ax,$AEAA; call far ptr @sameline;
- mov ax,$A4EA; call far ptr @sameline;
- mov ax,$44A4; call far ptr @sameline;
+ mov cx,10;
+ mov ax,$AA4A; call far ptr @sameline; { Print "AVVY" }
+ mov ax,$AEAA; call far ptr @sameline;
+ mov ax,$A4EA; call far ptr @sameline;
+ mov ax,$44A4; call far ptr @sameline;
- mov cx,9;
- mov ax,$AAA4; call far ptr @sameline; { Print "YAVV" }
- mov ax,$AAEA; call far ptr @sameline;
- mov ax,$AA4E; call far ptr @sameline;
- mov ax,$444A; call far ptr @sameline;
+ mov cx,9;
+ mov ax,$AAA4; call far ptr @sameline; { Print "YAVV" }
+ mov ax,$AAEA; call far ptr @sameline;
+ mov ax,$AA4E; call far ptr @sameline;
+ mov ax,$444A; call far ptr @sameline;
- mov ax,$4AAA; call far ptr @sameline; { Print "VYAV" }
- mov ax,$AAAE; call far ptr @sameline;
- mov ax,$EAA4; call far ptr @sameline;
- mov ax,$A444; call far ptr @sameline;
+ mov ax,$4AAA; call far ptr @sameline; { Print "VYAV" }
+ mov ax,$AAAE; call far ptr @sameline;
+ mov ax,$EAA4; call far ptr @sameline;
+ mov ax,$A444; call far ptr @sameline;
- mov ax,$A4AA; call far ptr @sameline; { Print "VVYA" }
- mov ax,$EAAA; call far ptr @sameline;
- mov ax,$4EAA; call far ptr @sameline;
- mov ax,$4A44; call far ptr @sameline;
+ mov ax,$A4AA; call far ptr @sameline; { Print "VVYA" }
+ mov ax,$EAAA; call far ptr @sameline;
+ mov ax,$4EAA; call far ptr @sameline;
+ mov ax,$4A44; call far ptr @sameline;
- ret;
+ ret;
- { Replicate the same line many times. }
+ { Replicate the same line many times. }
- @sameline:
- { Requires:
- what to copy in AX,
- how many lines in CX, and
- original offset in DI. }
- push cx;
- push di;
+ @sameline:
+ { Requires:
+ what to copy in AX,
+ how many lines in CX, and
+ original offset in DI. }
+ push cx;
+ push di;
- @samelineloop:
+ @samelineloop:
- push cx;
- mov cx,40; { No. of times to repeat it on one line. }
+ push cx;
+ mov cx,40; { No. of times to repeat it on one line. }
- repz stosw; { Fast uint16-copying }
+ repz stosw; { Fast uint16-copying }
- pop cx;
+ pop cx;
- add di,1200; { The next one will be 16 lines down. }
+ add di,1200; { The next one will be 16 lines down. }
- loop @samelineloop;
- pop di;
- add di,80;
- pop cx;
+ loop @samelineloop;
+ pop di;
+ add di,80;
+ pop cx;
- ret;
+ ret;
- @the_end:
- end;
- */
- Lucerna::blitfix();
- }
+ @the_end:
+ end;
+ */
+ _vm->_lucerna.blitfix();
+}
- void to_sundry(Gyro::sundry &sund) {
- {
- sund.qenid_filename = Gyro::enid_filename;
- sund.qsoundfx = Gyro::soundfx;
- sund.qthinks = Gyro::thinks;
- sund.qthinkthing = Gyro::thinkthing;
- }
+void Enid::to_sundry(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 from_sundry(Gyro::sundry sund) {
- {
- Gyro::enid_filename = sund.qenid_filename;
- Gyro::soundfx = sund.qsoundfx;
- Gyro::thinks = sund.qthinks;
- Gyro::thinkthing = sund.qthinkthing;
- }
+}
+
+void Enid::from_sundry(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 restore_dna() {
- uint16 here, fv;
- Gyro::sundry sund;
+void Enid::restore_dna() {
+ uint16 here, fv;
+ sundry sund;
- warning("STUB: Enid::restore_dna()");
- }
+ warning("STUB: Enid::restore_dna()");
+}
- void edna_reload() {
+void Enid::edna_reload() {
- restore_dna();
+ restore_dna();
- Gyro::seescroll = true; /* This prevents display of the new sprites before the
- new picture is loaded. */
+ _vm->_gyro.seescroll = true; /* This prevents display of the new sprites before the
+ new picture is loaded. */
- Lucerna::major_redraw();
+ _vm->_lucerna.major_redraw();
- Gyro::whereis[Gyro::pavalot] = Gyro::dna.room;
+ _vm->_gyro.whereis[_vm->_gyro.pavalot] = _vm->_gyro.dna.room;
- Gyro::alive = true;
+ _vm->_gyro.alive = true;
- Lucerna::objectlist();
+ _vm->_lucerna.objectlist();
- if (Gyro::holdthedawn) {
- Gyro::holdthedawn = false;
- Lucerna::dawn();
- }
+ if (_vm->_gyro.holdthedawn) {
+ _vm->_gyro.holdthedawn = false;
+ _vm->_lucerna.dawn();
}
+}
- void back_to_bootstrap(byte what) {
- warning("STUB: Enid::back_to_bootstrap()");
- }
+void Enid::back_to_bootstrap(byte what) {
+ warning("STUB: Enid::back_to_bootstrap()");
+}
- bool there_was_a_problem() {
- return bug;
- }
+bool Enid::there_was_a_problem() {
+ return bug;
+}
- } // End of namespace Enid.
} // End of namespace Avalanche.
diff --git a/engines/avalanche/enid2.h b/engines/avalanche/enid2.h
index 0b4671ad30..4351354270 100644
--- a/engines/avalanche/enid2.h
+++ b/engines/avalanche/enid2.h
@@ -35,8 +35,11 @@
#include "avalanche/gyro2.h"
namespace Avalanche {
+class AvalancheEngine;
- namespace Enid {
+class Enid {
+public:
+ void setParent(AvalancheEngine *vm);
void edna_save(Common::String name);
@@ -52,7 +55,51 @@ namespace Avalanche {
bool there_was_a_problem();
- } // End of namespace Enid.
+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;
+
+
+
+ void addon(Common::String x);
+ Common::String expanddate(byte d, byte m, uint16 y);
+
+ void show_bug(char icon, Common::String strn);
+ bool test_bug(byte what);
+
+ void loaderror(Common::String x, char icon);
+
+ void showheader();
+
+ void to_sundry(sundry &sund);
+ void from_sundry(sundry sund);
+
+ void restore_dna();
+
+
+};
} // End of namespace Avalanche.