aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2011-12-12 20:00:45 +0200
committerFilippos Karapetis2011-12-12 20:02:34 +0200
commit30b2c37e53852fba8ee73f692492f489b4d86e5a (patch)
treebf29afcaf519b1687d8c7b5a021a5096da30fa52 /engines
parentd1628feb761acc9f4607f64de3eb620fea53bcc9 (diff)
downloadscummvm-rg350-30b2c37e53852fba8ee73f692492f489b4d86e5a.tar.gz
scummvm-rg350-30b2c37e53852fba8ee73f692492f489b4d86e5a.tar.bz2
scummvm-rg350-30b2c37e53852fba8ee73f692492f489b4d86e5a.zip
DREAMWEB: Convert 'setuptimeduse', 'entrytexts' to C++ and move priestText() to DreamBase
Diffstat (limited to 'engines')
-rw-r--r--engines/dreamweb/dreambase.h3
-rw-r--r--engines/dreamweb/dreamgen.cpp101
-rw-r--r--engines/dreamweb/dreamgen.h2
-rw-r--r--engines/dreamweb/people.cpp13
-rw-r--r--engines/dreamweb/stubs.cpp46
-rw-r--r--engines/dreamweb/stubs.h2
6 files changed, 52 insertions, 115 deletions
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index 3d5c9ce88b..7ef6a9219e 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -115,6 +115,7 @@ public:
const Frame *getReelFrameAX(uint16 frame);
void soundOnReels(uint16 reelPointer);
void rollEndCredits();
+ void priestText(ReelRoutine &routine);
// from stubs.cpp
void crosshair();
@@ -154,6 +155,7 @@ public:
// from use.cpp
void placeFreeObject(uint8 index);
void removeFreeObject(uint8 index);
+ void setupTimedUse(uint16 offset, uint16 countToTimed, uint16 timeCount, byte x, byte y);
// from vgafades.cpp
uint8 *mainPalette();
@@ -209,6 +211,7 @@ public:
void createPanel();
void createPanel2();
void showPanel();
+ void entryTexts();
};
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 6d3da6d0f2..76fbf92d83 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -4531,28 +4531,6 @@ void DreamGenContext::removeFreeObject() {
es = pop();
}
-void DreamGenContext::setupTimedUse() {
- STACK_CHECK;
- _cmp(data.word(kTimecount), 0);
- if (!flags.z())
- return /* (cantsetup) */;
- data.byte(kTimedy) = bh;
- data.byte(kTimedx) = bl;
- data.word(kCounttotimed) = cx;
- _add(dx, cx);
- data.word(kTimecount) = dx;
- bl = al;
- bh = 0;
- _add(bx, bx);
- es = data.word(kPuzzletext);
- cx = (66*2);
- ax = es.word(bx);
- _add(ax, cx);
- bx = ax;
- data.word(kTimedseg) = es;
- data.word(kTimedoffset) = bx;
-}
-
void DreamGenContext::useGun() {
STACK_CHECK;
_cmp(data.byte(kObjecttype), 4);
@@ -5051,85 +5029,6 @@ nomatchslot:
goto slotloop;
}
-void DreamGenContext::entryTexts() {
- STACK_CHECK;
- _cmp(data.byte(kLocation), 21);
- if (!flags.z())
- goto notloc15;
- al = 28;
- cx = 60;
- dx = 11;
- bl = 68;
- bh = 64;
- setupTimedUse();
- return;
-notloc15:
- _cmp(data.byte(kLocation), 30);
- if (!flags.z())
- goto notloc43;
- al = 27;
- cx = 60;
- dx = 11;
- bl = 68;
- bh = 64;
- setupTimedUse();
- return;
-notloc43:
- _cmp(data.byte(kLocation), 23);
- if (!flags.z())
- goto notloc23;
- al = 29;
- cx = 60;
- dx = 11;
- bl = 68;
- bh = 64;
- setupTimedUse();
- return;
-notloc23:
- _cmp(data.byte(kLocation), 31);
- if (!flags.z())
- goto notloc44;
- al = 30;
- cx = 60;
- dx = 11;
- bl = 68;
- bh = 64;
- setupTimedUse();
- return;
-notloc44:
- _cmp(data.byte(kLocation), 20);
- if (!flags.z())
- goto notsarters2;
- al = 31;
- cx = 60;
- dx = 11;
- bl = 68;
- bh = 64;
- setupTimedUse();
- return;
-notsarters2:
- _cmp(data.byte(kLocation), 24);
- if (!flags.z())
- goto notedenlob;
- al = 32;
- cx = 60;
- dx = 3;
- bl = 68;
- bh = 64;
- setupTimedUse();
- return;
-notedenlob:
- _cmp(data.byte(kLocation), 34);
- if (!flags.z())
- return /* (noteden2) */;
- al = 33;
- cx = 60;
- dx = 3;
- bl = 68;
- bh = 64;
- setupTimedUse();
-}
-
void DreamGenContext::entryAnims() {
STACK_CHECK;
data.word(kReeltowatch) = -1;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index ae9bf3bb06..c0c7407f3f 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -491,7 +491,6 @@ public:
void useOpenBox();
void clearBuffers();
void getObTextStart();
- void entryTexts();
void putUnderCentre();
void checkObjectSize();
void findText1();
@@ -580,7 +579,6 @@ public:
void checkInside();
void findPathOfPoint();
void getDestInfo();
- void setupTimedUse();
void makeCaps();
void read();
void additionalText();
diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp
index 889a430a22..efb9a028b6 100644
--- a/engines/dreamweb/people.cpp
+++ b/engines/dreamweb/people.cpp
@@ -629,25 +629,16 @@ void DreamGenContext::priest(ReelRoutine &routine) {
if (checkSpeed(routine)) {
routine.incReelPointer();
- push(es);
- push(bx);
priestText(routine);
- bx = pop();
- es = pop();
}
}
-void DreamGenContext::priestText(ReelRoutine &routine) {
+void DreamBase::priestText(ReelRoutine &routine) {
uint16 reel = routine.reelPointer();
if (reel < 2 || reel >= 7 || (reel & 1))
return; // nopriesttext
- al = ((reel & 0xFF) >> 1) + 50;
- bl = 72;
- bh = 80;
- cx = 54;
- dx = 1;
- setupTimedUse();
+ setupTimedUse((reel >> 1) + 50, 54, 1, 72, 80);
}
void DreamGenContext::monkAndRyan(ReelRoutine &routine) {
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 162152ccda..e4c9a7514d 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -4317,4 +4317,50 @@ void DreamGenContext::quitKey() {
data.byte(kGetback) = 1;
}
+void DreamGenContext::setupTimedUse() {
+ DreamBase::setupTimedUse(al, cx, dx, bl, bh);
+}
+
+void DreamBase::setupTimedUse(uint16 textIndex, uint16 countToTimed, uint16 timeCount, byte x, byte y) {
+ if (data.word(kTimecount) != 0)
+ return; // can't setup
+
+ data.byte(kTimedy) = y;
+ data.byte(kTimedx) = x;
+ data.word(kCounttotimed) = countToTimed;
+ data.word(kTimecount) = timeCount + countToTimed;
+ data.word(kTimedseg) = data.word(kPuzzletext);
+ data.word(kTimedoffset) = kTextstart + getSegment(data.word(kPuzzletext)).word(textIndex * 2);
+ const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(data.word(kTimedoffset), 0);
+ debug(1, "setupTimedUse: %d => '%s'", textIndex, string);
+}
+
+void DreamBase::entryTexts() {
+ switch (data.byte(kLocation)) {
+ case 21:
+ setupTimedUse(28, 60, 11, 68, 64);
+ break;
+ case 30:
+ setupTimedUse(27, 60, 11, 68, 64);
+ break;
+ case 23:
+ setupTimedUse(29, 60, 11, 68, 64);
+ break;
+ case 31:
+ setupTimedUse(30, 60, 11, 68, 64);
+ break;
+ case 20:
+ setupTimedUse(31, 60, 11, 68, 64);
+ break;
+ case 24:
+ setupTimedUse(32, 60, 3, 68, 64);
+ break;
+ case 34:
+ setupTimedUse(33, 60, 3, 68, 64);
+ break;
+ default:
+ break;
+ }
+}
+
} // End of namespace DreamGen
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 4308bd54ea..661eba3633 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -408,7 +408,6 @@
void louisChair(ReelRoutine &routine);
void bossMan(ReelRoutine &routine);
void priest(ReelRoutine &routine);
- void priestText(ReelRoutine &routine);
void monkAndRyan(ReelRoutine &routine);
void copper(ReelRoutine &routine);
void introMonks1(ReelRoutine &routine);
@@ -568,5 +567,6 @@
void useButtonA();
void autoAppear();
void quitKey();
+ void setupTimedUse();
#endif