aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2011-12-09 18:55:02 +0200
committerFilippos Karapetis2011-12-09 18:55:02 +0200
commite2a92bff295639144157516d6c21711bf50eeda9 (patch)
treedf729db5c06232834057caf10cb9893b64fb858b /engines
parent6c5f4245404fa7ed3e1732203d7154663d8b5808 (diff)
downloadscummvm-rg350-e2a92bff295639144157516d6c21711bf50eeda9.tar.gz
scummvm-rg350-e2a92bff295639144157516d6c21711bf50eeda9.tar.bz2
scummvm-rg350-e2a92bff295639144157516d6c21711bf50eeda9.zip
DREAMWEB: Port 'diarykeyp', 'diarykeyn' to C++
Diffstat (limited to 'engines')
-rw-r--r--engines/dreamweb/dreamgen.cpp60
-rw-r--r--engines/dreamweb/dreamgen.h2
-rw-r--r--engines/dreamweb/stubs.cpp35
-rw-r--r--engines/dreamweb/stubs.h2
4 files changed, 37 insertions, 62 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 0ffc4349ab..77c21ac96c 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -5465,66 +5465,6 @@ notdumpdiary:
multiDump();
}
-void DreamGenContext::diaryKeyP() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 214);
- if (flags.z())
- goto alreadykeyp;
- data.byte(kCommandtype) = 214;
- al = 23;
- commandOnly();
-alreadykeyp:
- _cmp(data.word(kMousebutton), 0);
- if (flags.z())
- return /* (notkeyp) */;
- ax = data.word(kOldbutton);
- _cmp(ax, data.word(kMousebutton));
- if (flags.z())
- return /* (notkeyp) */;
- _cmp(data.byte(kPresscount), 0);
- if (!flags.z())
- return /* (notkeyp) */;
- al = 16;
- playChannel1();
- data.byte(kPresscount) = 12;
- data.byte(kPressed) = 'P';
- _dec(data.byte(kDiarypage));
- _cmp(data.byte(kDiarypage), -1);
- if (!flags.z())
- return /* (notkeyp) */;
- data.byte(kDiarypage) = 11;
-}
-
-void DreamGenContext::diaryKeyN() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 213);
- if (flags.z())
- goto alreadykeyn;
- data.byte(kCommandtype) = 213;
- al = 23;
- commandOnly();
-alreadykeyn:
- _cmp(data.word(kMousebutton), 0);
- if (flags.z())
- return /* (notkeyn) */;
- ax = data.word(kOldbutton);
- _cmp(ax, data.word(kMousebutton));
- if (flags.z())
- return /* (notkeyn) */;
- _cmp(data.byte(kPresscount), 0);
- if (!flags.z())
- return /* (notkeyn) */;
- al = 16;
- playChannel1();
- data.byte(kPresscount) = 12;
- data.byte(kPressed) = 'N';
- _inc(data.byte(kDiarypage));
- _cmp(data.byte(kDiarypage), 12);
- if (!flags.z())
- return /* (notkeyn) */;
- data.byte(kDiarypage) = 0;
-}
-
void DreamGenContext::showDiaryPage() {
STACK_CHECK;
al = 0;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 02195cbebd..853d8b406c 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -591,9 +591,7 @@ public:
void reExFromInv();
void businessMan();
void outOfInv();
- void diaryKeyP();
void transferMap();
- void diaryKeyN();
void purgeAnItem();
void purgeALocation();
void notHeldError();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 7c388cba6f..01dc31e4b8 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -4164,4 +4164,39 @@ void DreamGenContext::showGun() {
getRidOfTempText();
}
+void DreamGenContext::diaryKeyP() {
+ if (data.byte(kCommandtype) != 214) {
+ data.byte(kCommandtype) = 214;
+ commandOnly(23);
+ }
+
+ if (!data.word(kMousebutton) ||
+ data.word(kOldbutton) == data.word(kMousebutton) ||
+ data.byte(kPresscount))
+ return; // notkeyp
+
+ playChannel1(16);
+ data.byte(kPresscount) = 12;
+ data.byte(kPressed) = 'P';
+ data.byte(kDiarypage)--;
+
+ if (data.byte(kDiarypage) == 0xFF)
+ data.byte(kDiarypage) = 11;
+}
+
+void DreamGenContext::diaryKeyN() {
+ if (data.byte(kCommandtype) != 213) {
+ data.byte(kCommandtype) = 213;
+ commandOnly(23);
+ }
+
+ playChannel1(16);
+ data.byte(kPresscount) = 12;
+ data.byte(kPressed) = 'N';
+ data.byte(kDiarypage)++;
+
+ if (data.byte(kDiarypage) == 12)
+ data.byte(kDiarypage) = 0;
+}
+
} // End of namespace DreamGen
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 3930e06b56..abc7f4fa81 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -564,5 +564,7 @@
void endGame();
void monitorLogo();
void quitSymbol();
+ void diaryKeyP();
+ void diaryKeyN();
#endif