aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorMax Horn2007-06-29 23:08:15 +0000
committerMax Horn2007-06-29 23:08:15 +0000
commit0723e3e24a906c2935965df2ccd555ef314c58cb (patch)
tree5ddbadd6878f6abf1b4f38ad58766889268a1840 /engines/scumm
parent314ef72bb188240bb145e13c620310af142b693e (diff)
downloadscummvm-rg350-0723e3e24a906c2935965df2ccd555ef314c58cb.tar.gz
scummvm-rg350-0723e3e24a906c2935965df2ccd555ef314c58cb.tar.bz2
scummvm-rg350-0723e3e24a906c2935965df2ccd555ef314c58cb.zip
Introduced ClickArea enum, some related cleanup in runInputScript and checkExecVerbs
svn-id: r27778
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/input.cpp5
-rw-r--r--engines/scumm/intern.h2
-rw-r--r--engines/scumm/script.cpp32
-rw-r--r--engines/scumm/scumm.h2
-rw-r--r--engines/scumm/verbs.cpp14
-rw-r--r--engines/scumm/verbs.h12
6 files changed, 37 insertions, 30 deletions
diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp
index ae93507df8..a802ea1c96 100644
--- a/engines/scumm/input.cpp
+++ b/engines/scumm/input.cpp
@@ -437,11 +437,6 @@ void ScummEngine_v2::processKeyboard(Common::KeyState lastKeyHit) {
// Fall back to default behavior
ScummEngine::processKeyboard(lastKeyHit);
- // Store the input type. So far we can't distinguish
- // between 1, 3 and 5.
- // 1) Verb 2) Scene 3) Inv. 4) Key
- // 5) Sentence Bar
-
if (VAR_KEYPRESS != 0xFF && _mouseAndKeyboardStat) { // Key Input
if (315 <= _mouseAndKeyboardStat && _mouseAndKeyboardStat <= 323) {
// Convert F-Keys for V1/V2 games (they start at 1)
diff --git a/engines/scumm/intern.h b/engines/scumm/intern.h
index 008c2995e5..85025919d6 100644
--- a/engines/scumm/intern.h
+++ b/engines/scumm/intern.h
@@ -313,7 +313,7 @@ protected:
virtual void readGlobalObjects();
virtual void loadCharset(int no);
- virtual void runInputScript(int a, int cmd, int mode);
+ virtual void runInputScript(int clickArea, int val, int mode);
virtual void runInventoryScript(int i);
virtual int getVar();
diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index 46e4e64347..cc56adf622 100644
--- a/engines/scumm/script.cpp
+++ b/engines/scumm/script.cpp
@@ -1156,39 +1156,39 @@ void ScummEngine::checkAndRunSentenceScript() {
runScript(sentenceScript, 0, 0, localParamList);
}
-void ScummEngine_v2::runInputScript(int a, int cmd, int mode) {
+void ScummEngine_v2::runInputScript(int clickArea, int val, int mode) {
int args[24];
int verbScript;
verbScript = 4;
- VAR(VAR_CLICK_AREA) = a;
- switch (a) {
- case 1: // Verb clicked
- VAR(VAR_CLICK_VERB) = cmd;
+ VAR(VAR_CLICK_AREA) = clickArea;
+ switch (clickArea) {
+ case kVerbClickArea: // Verb clicked
+ VAR(VAR_CLICK_VERB) = val;
break;
- case 3: // Inventory clicked
- VAR(VAR_CLICK_OBJECT) = cmd;
+ case kInventoryClickArea: // Inventory clicked
+ VAR(VAR_CLICK_OBJECT) = val;
break;
}
memset(args, 0, sizeof(args));
- args[0] = a;
- args[1] = cmd;
+ args[0] = clickArea;
+ args[1] = val;
args[2] = mode;
if (verbScript)
runScript(verbScript, 0, 0, args);
}
-void ScummEngine::runInputScript(int a, int cmd, int mode) {
+void ScummEngine::runInputScript(int clickArea, int val, int mode) {
int args[24];
int verbScript;
verbScript = VAR(VAR_VERB_SCRIPT);
memset(args, 0, sizeof(args));
- args[0] = a;
- args[1] = cmd;
+ args[0] = clickArea;
+ args[1] = val;
args[2] = mode;
// All HE 72+ games but only some HE 71 games.
if (_game.heversion >= 71) {
@@ -1198,18 +1198,18 @@ void ScummEngine::runInputScript(int a, int cmd, int mode) {
// Macintosh verison of indy3ega used different interface, so adjust values.
if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformMacintosh) {
- if (a == 1 && (cmd >= 101 && cmd <= 108)) {
- if (cmd == 107) {
+ if (clickArea == kVerbClickArea && (val >= 101 && val <= 108)) {
+ if (val == 107) {
VAR(67) -= 2;
inventoryScript();
return;
- } else if (cmd == 108) {
+ } else if (val == 108) {
VAR(67) += 2;
inventoryScript();
return;
} else {
args[0] = 3;
- args[1] = VAR(83 + (cmd - 101));
+ args[1] = VAR(83 + (val - 101));
}
}
}
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 8c8124714d..3a5e9fb1ba 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -863,7 +863,7 @@ protected:
void verbMouseOver(int verb);
int findVerbAtPos(int x, int y) const;
virtual void drawVerb(int verb, int mode);
- virtual void runInputScript(int a, int cmd, int mode);
+ virtual void runInputScript(int clickArea, int val, int mode);
void restoreVerbBG(int verb);
void drawVerbBitmap(int verb, int x, int y);
int getVerbSlot(int id, int mode) const;
diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp
index edd8004d30..56ee454240 100644
--- a/engines/scumm/verbs.cpp
+++ b/engines/scumm/verbs.cpp
@@ -385,7 +385,7 @@ void ScummEngine_v2::checkV2Inventory(int x, int y) {
runObject(_activeInventory, _activeVerb);
}
} else {
- runInputScript(3, object, 0);
+ runInputScript(kInventoryClickArea, object, 0);
}
}
}
@@ -537,7 +537,7 @@ void ScummEngine::checkExecVerbs() {
if (vs->verbid && vs->saveid == 0 && vs->curmode == 1) {
if (_mouseAndKeyboardStat == vs->key) {
// Trigger verb as if the user clicked it
- runInputScript(1, vs->verbid, 1);
+ runInputScript(kVerbClickArea, vs->verbid, 1);
return;
}
}
@@ -580,14 +580,14 @@ void ScummEngine::checkExecVerbs() {
// Check if person is available (see script 23 from ZAK_FM-TOWNS and script 4 from ZAK_PC).
// Zak: Var[144 Bit 15], Annie: Var[145 Bit 0], Melissa: Var[145 Bit 1], Leslie: Var[145 Bit 2]
if (!readVar(0x890E + fKey)) {
- runInputScript(1, 36 + fKey, 0);
+ runInputScript(kVerbClickArea, 36 + fKey, 0);
}
}
return;
}
// Generic keyboard input
- runInputScript(4, _mouseAndKeyboardStat, 1);
+ runInputScript(kKeyClickArea, _mouseAndKeyboardStat, 1);
} else if (_mouseAndKeyboardStat & MBS_MOUSE_MASK) {
VirtScreen *zone = findVirtScreen(_mouse.y);
byte code = _mouseAndKeyboardStat & MBS_LEFT_CLICK ? 1 : 2;
@@ -600,7 +600,7 @@ void ScummEngine::checkExecVerbs() {
if (_game.version <= 2 && zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) {
// Click into V2 sentence line
- runInputScript(5, 0, 0);
+ runInputScript(kSentenceClickArea, 0, 0);
} else if (_game.version <= 2 && zone->number == kVerbVirtScreen && _mouse.y > zone->topline + inventoryArea) {
// Click into V2 inventory
((ScummEngine_v2 *)this)->checkV2Inventory(_mouse.x, _mouse.y);
@@ -608,10 +608,10 @@ void ScummEngine::checkExecVerbs() {
over = findVerbAtPos(_mouse.x, _mouse.y);
if (over != 0) {
// Verb was clicked
- runInputScript(1, _verbs[over].verbid, code);
+ runInputScript(kVerbClickArea, _verbs[over].verbid, code);
} else {
// Scene was clicked
- runInputScript((zone->number == kMainVirtScreen) ? 2 : 1, 0, code);
+ runInputScript((zone->number == kMainVirtScreen) ? kSceneClickArea : kVerbClickArea, 0, code);
}
}
}
diff --git a/engines/scumm/verbs.h b/engines/scumm/verbs.h
index 47fa98a9de..96a49a7ced 100644
--- a/engines/scumm/verbs.h
+++ b/engines/scumm/verbs.h
@@ -30,6 +30,18 @@
namespace Scumm {
+/**
+ * The area in which some click (or key press) occured and which is passed
+ * to the input script.
+ */
+enum ClickArea {
+ kVerbClickArea = 1,
+ kSceneClickArea = 2,
+ kInventoryClickArea = 3,
+ kKeyClickArea = 4,
+ kSentenceClickArea = 5
+};
+
enum {
kTextVerbType = 0,
kImageVerbType = 1