aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2011-12-28 20:31:50 +0100
committerMax Horn2011-12-28 23:06:49 +0100
commitdc4af2afc2013a0ab20955440221dc55332a0063 (patch)
tree4caaab5db863efc599092eb02a443334cdc11ab8
parentbfd891d571bfad4d0e192a0db0b9b1bba4ffe4a7 (diff)
downloadscummvm-rg350-dc4af2afc2013a0ab20955440221dc55332a0063.tar.gz
scummvm-rg350-dc4af2afc2013a0ab20955440221dc55332a0063.tar.bz2
scummvm-rg350-dc4af2afc2013a0ab20955440221dc55332a0063.zip
DREAMWEB: Added commandOnlyCond() method
-rw-r--r--engines/dreamweb/dreamweb.h3
-rw-r--r--engines/dreamweb/keypad.cpp56
-rw-r--r--engines/dreamweb/newplace.cpp20
-rw-r--r--engines/dreamweb/object.cpp5
-rw-r--r--engines/dreamweb/saveload.cpp45
-rw-r--r--engines/dreamweb/stubs.cpp52
-rw-r--r--engines/dreamweb/talk.cpp10
7 files changed, 45 insertions, 146 deletions
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index 355c70715e..7e6ca1ddd7 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -814,7 +814,9 @@ public:
void roomName();
void showIcon();
void eraseOldObs();
+ void commandOnlyCond(uint8 command, uint8 commandType);
void commandOnly(uint8 command);
+ void commandWithOb(uint8 command, uint8 type, uint8 index);
void blank();
void setTopLeft();
void setTopRight();
@@ -884,7 +886,6 @@ public:
void makeMainScreen();
void showWatchReel();
void watchReel();
- void commandWithOb(uint8 command, uint8 type, uint8 index);
void examineObText();
void blockNameText();
void personNameText();
diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp
index eaffad822d..2a31652ace 100644
--- a/engines/dreamweb/keypad.cpp
+++ b/engines/dreamweb/keypad.cpp
@@ -112,10 +112,7 @@ void DreamWebEngine::loadKeypad() {
}
void DreamWebEngine::quitKey() {
- if (_commandType != 222) {
- _commandType = 222;
- commandOnly(4);
- }
+ commandOnlyCond(4, 222);
if (_mouseButton != _oldButton && (_mouseButton & 1))
_getBack = 1;
@@ -177,11 +174,7 @@ void DreamWebEngine::buttonEnter() {
}
void DreamWebEngine::buttonPress(uint8 buttonId) {
- uint8 commandType = 100 + buttonId;
- if (_commandType != commandType) {
- _commandType = commandType;
- commandOnly(buttonId + 4);
- }
+ commandOnlyCond(buttonId + 4, buttonId + 100);
if ((_mouseButton & 1) && (_mouseButton != _oldButton)) {
_pressed = buttonId;
_graphicPress = buttonId + 21;
@@ -338,10 +331,7 @@ void DreamWebEngine::nextFolder() {
blank();
return;
}
- if (_commandType != 201) {
- _commandType = 201;
- commandOnly(16);
- }
+ commandOnlyCond(16, 201);
if ((_mouseButton == 1) && (_mouseButton != _oldButton)) {
++_folderPage;
folderHints();
@@ -380,10 +370,7 @@ void DreamWebEngine::lastFolder() {
blank();
return;
}
- if (_commandType != 202) {
- _commandType = 202;
- commandOnly(17);
- }
+ commandOnlyCond(17, 202);
if ((_mouseButton == 1) && (_mouseButton != _oldButton)) {
--_folderPage;
@@ -564,10 +551,7 @@ void DreamWebEngine::quitSymbol() {
return;
};
- if (_commandType != 222) {
- _commandType = 222;
- commandOnly(18);
- }
+ commandOnlyCond(18, 222);
if (_mouseButton == _oldButton)
return; // notqs
@@ -584,10 +568,7 @@ void DreamWebEngine::setTopLeft() {
return;
}
- if (_commandType != 210) {
- _commandType = 210;
- commandOnly(19);
- }
+ commandOnlyCond(19, 210);
if (_mouseButton != 0)
_symbolTopDir = -1;
@@ -599,10 +580,7 @@ void DreamWebEngine::setTopRight() {
return;
}
- if (_commandType != 211) {
- _commandType = 211;
- commandOnly(20);
- }
+ commandOnlyCond(20, 211);
if (_mouseButton != 0)
_symbolTopDir = +1;
@@ -614,10 +592,7 @@ void DreamWebEngine::setBotLeft() {
return;
}
- if (_commandType != 212) {
- _commandType = 212;
- commandOnly(21);
- }
+ commandOnlyCond(21, 212);
if (_mouseButton != 0)
_symbolBotDir = -1;
@@ -629,10 +604,7 @@ void DreamWebEngine::setBotRight() {
return;
}
- if (_commandType != 213) {
- _commandType = 213;
- commandOnly(22);
- }
+ commandOnlyCond(22, 213);
if (_mouseButton != 0)
_symbolBotDir = +1;
@@ -841,10 +813,7 @@ void DreamWebEngine::dumpDiaryKeys() {
}
void DreamWebEngine::diaryKeyP() {
- if (_commandType != 214) {
- _commandType = 214;
- commandOnly(23);
- }
+ commandOnlyCond(23, 214);
if (!_mouseButton ||
_oldButton == _mouseButton ||
@@ -861,10 +830,7 @@ void DreamWebEngine::diaryKeyP() {
}
void DreamWebEngine::diaryKeyN() {
- if (_commandType != 213) {
- _commandType = 213;
- commandOnly(23);
- }
+ commandOnlyCond(23, 213);
if (!_mouseButton ||
_oldButton == _mouseButton ||
diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp
index 248f04a4d9..0d7c5a18fe 100644
--- a/engines/dreamweb/newplace.cpp
+++ b/engines/dreamweb/newplace.cpp
@@ -103,10 +103,7 @@ void DreamWebEngine::showCity() {
}
void DreamWebEngine::lookAtPlace() {
- if (_commandType != 224) {
- _commandType = 224;
- commandOnly(27);
- }
+ commandOnlyCond(27, 224);
if (!(_mouseButton & 1) ||
_mouseButton == _oldButton ||
@@ -164,10 +161,7 @@ void DreamWebEngine::showArrows() {
}
void DreamWebEngine::nextDest() {
- if (_commandType != 218) {
- _commandType = 218;
- commandOnly(28);
- }
+ commandOnlyCond(28, 218);
if (!(_mouseButton & 1) || _oldButton == 1)
return; // nodu
@@ -193,10 +187,7 @@ void DreamWebEngine::nextDest() {
}
void DreamWebEngine::lastDest() {
- if (_commandType != 219) {
- _commandType = 219;
- commandOnly(29);
- }
+ commandOnlyCond(29, 219);
if (!(_mouseButton & 1) || _oldButton == 1)
return; // nodd
@@ -222,10 +213,7 @@ void DreamWebEngine::lastDest() {
}
void DreamWebEngine::destSelect() {
- if (_commandType != 222) {
- _commandType = 222;
- commandOnly(30);
- }
+ commandOnlyCond(30, 222);
if (!(_mouseButton & 1) || _oldButton == 1)
return; // notrav
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 249c275a3f..bcdf2e5eb9 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -218,10 +218,7 @@ void DreamWebEngine::inventory() {
return;
}
- if (_commandType != 239) {
- _commandType = 239;
- commandOnly(32);
- }
+ commandOnlyCond(32, 239);
if (_mouseButton == _oldButton)
return;
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index 29f1b916a4..386319db34 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -107,10 +107,7 @@ void syncGameVars(Common::Serializer &s, GameVars &vars) {
}
void DreamWebEngine::loadGame() {
- if (_commandType != 246) {
- _commandType = 246;
- commandOnly(41);
- }
+ commandOnlyCond(41, 246);
if (_mouseButton == _oldButton)
return; // "noload"
if (_mouseButton == 1)
@@ -204,10 +201,7 @@ void DreamWebEngine::saveGame() {
return;
}
- if (_commandType != 247) {
- _commandType = 247;
- commandOnly(44);
- }
+ commandOnlyCond(44, 247);
if (_mouseButton != 1)
return;
@@ -304,10 +298,7 @@ void DreamWebEngine::saveLoad() {
blank();
return;
}
- if (_commandType != 253) {
- _commandType = 253;
- commandOnly(43);
- }
+ commandOnlyCond(43, 253);
if ((_mouseButton != _oldButton) && (_mouseButton & 1))
doSaveLoad();
}
@@ -384,10 +375,7 @@ void DreamWebEngine::getBackFromOps() {
}
void DreamWebEngine::getBackToOps() {
- if (_commandType != 201) {
- _commandType = 201;
- commandOnly(42);
- }
+ commandOnlyCond(42, 201);
if (_mouseButton != _oldButton) {
if (_mouseButton & 1) {
@@ -411,10 +399,7 @@ void DreamWebEngine::showDiscOps() {
}
void DreamWebEngine::discOps() {
- if (_commandType != 249) {
- _commandType = 249;
- commandOnly(43);
- }
+ commandOnlyCond(43, 249);
if (_mouseButton == _oldButton || !(_mouseButton & 1))
return;
@@ -450,10 +435,7 @@ void DreamWebEngine::discOps() {
}
void DreamWebEngine::actualSave() {
- if (_commandType != 222) {
- _commandType = 222;
- commandOnly(44);
- }
+ commandOnlyCond(44, 222);
if (!(_mouseButton & 1))
return;
@@ -477,10 +459,7 @@ void DreamWebEngine::actualSave() {
}
void DreamWebEngine::actualLoad() {
- if (_commandType != 221) {
- _commandType = 221;
- commandOnly(41);
- }
+ commandOnlyCond(41, 221);
if (_mouseButton == _oldButton || _mouseButton != 1)
return;
@@ -702,10 +681,7 @@ uint DreamWebEngine::scanForNames() {
}
void DreamWebEngine::loadOld() {
- if (_commandType != 252) {
- _commandType = 252;
- commandOnly(48);
- }
+ commandOnlyCond(48, 252);
if (!(_mouseButton & 1))
return;
@@ -793,10 +769,7 @@ void DreamWebEngine::checkInput() {
}
void DreamWebEngine::selectSlot() {
- if (_commandType != 244) {
- _commandType = 244;
- commandOnly(45);
- }
+ commandOnlyCond(45, 244);
if (_mouseButton != 1 || _mouseButton == _oldButton)
return; // noselslot
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index ef10aad0dc..5bca846b36 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -979,10 +979,7 @@ void DreamWebEngine::getTime() {
}
void DreamWebEngine::DOSReturn() {
- if (_commandType != 250) {
- _commandType = 250;
- commandOnly(46);
- }
+ commandOnlyCond(46, 250);
if (_mouseButton & 1) {
_mouseButton = 0;
@@ -1120,6 +1117,13 @@ void DreamWebEngine::delTextLine() {
multiPut(_textUnder, _textAddressX, _textAddressY, kUnderTextSizeX, kUnderTextSizeY);
}
+void DreamWebEngine::commandOnlyCond(uint8 command, uint8 commandType) {
+ if (_commandType != commandType) {
+ _commandType = commandType;
+ commandOnly(command);
+ }
+}
+
void DreamWebEngine::commandOnly(uint8 command) {
delTextLine();
const uint8 *string = (const uint8 *)_commandText.getString(command);
@@ -1768,10 +1772,7 @@ void DreamWebEngine::zoomOnOff() {
return;
}
- if (_commandType != 222) {
- _commandType = 222;
- commandOnly(39);
- }
+ commandOnlyCond(39, 222);
if (!(_mouseButton & 1) || (_mouseButton == _oldButton))
return;
@@ -1965,10 +1966,7 @@ void DreamWebEngine::look() {
blank();
return;
}
- if (_commandType != 241) {
- _commandType = 241;
- commandOnly(25);
- }
+ commandOnlyCond(25, 241);
if ((_mouseButton == 1) && (_mouseButton != _oldButton))
doLook();
}
@@ -2300,10 +2298,7 @@ void DreamWebEngine::readKey() {
}
void DreamWebEngine::newGame() {
- if (_commandType != 251) {
- _commandType = 251;
- commandOnly(47);
- }
+ commandOnlyCond(47, 251);
if (_mouseButton == 1)
_getBack = 3;
@@ -2377,10 +2372,7 @@ void DreamWebEngine::redrawMainScrn() {
}
void DreamWebEngine::blank() {
- if (_commandType != 199) {
- _commandType = 199;
- commandOnly(0);
- }
+ commandOnlyCond(0, 199);
}
void DreamWebEngine::allPointer() {
@@ -2537,10 +2529,7 @@ bool DreamWebEngine::isSetObOnMap(uint8 index) {
}
void DreamWebEngine::examineInventory() {
- if (_commandType != 249) {
- _commandType = 249;
- commandOnly(32);
- }
+ commandOnlyCond(32, 249);
if (!(_mouseButton & 1))
return;
@@ -2663,10 +2652,7 @@ void DreamWebEngine::madmanRun() {
return;
}
- if (_commandType != 211) {
- _commandType = 211;
- commandOnly(52);
- }
+ commandOnlyCond(52, 211);
if (_mouseButton == 1 &&
_mouseButton != _oldButton)
@@ -2789,10 +2775,7 @@ void DreamWebEngine::getBack1() {
}
- if (_commandType != 202) {
- _commandType = 202;
- commandOnly(26);
- }
+ commandOnlyCond(26, 202);
if (_mouseButton == _oldButton)
return;
@@ -3105,10 +3088,7 @@ void DreamWebEngine::edensFlatReminders() {
}
void DreamWebEngine::incRyanPage() {
- if (_commandType != 222) {
- _commandType = 222;
- commandOnly(31);
- }
+ commandOnlyCond(31, 222);
if (_mouseButton == _oldButton || !(_mouseButton & 1))
return;
diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp
index 9a94f0f68d..0f59cad895 100644
--- a/engines/dreamweb/talk.cpp
+++ b/engines/dreamweb/talk.cpp
@@ -119,10 +119,7 @@ void DreamWebEngine::moreTalk() {
return;
}
- if (_commandType != 215) {
- _commandType = 215;
- commandOnly(49);
- }
+ commandOnlyCond(49, 215);
if (_mouseButton == _oldButton)
return; // nomore
@@ -245,10 +242,7 @@ void DreamWebEngine::redes() {
return;
}
- if (_commandType != 217) {
- _commandType = 217;
- commandOnly(50);
- }
+ commandOnlyCond(50, 217);
if (!(_mouseButton & 1))
return;