aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2006-03-02 01:17:41 +0000
committerTravis Howell2006-03-02 01:17:41 +0000
commitfd8f11f7a452ae18d5e00f58430cc33bc5a48fed (patch)
tree13d05dde5e4865760831bf24b7c067bfbf13a3e3
parentc01ef102aff7661528b1a68e6e024bf7d69211d6 (diff)
downloadscummvm-rg350-fd8f11f7a452ae18d5e00f58430cc33bc5a48fed.tar.gz
scummvm-rg350-fd8f11f7a452ae18d5e00f58430cc33bc5a48fed.tar.bz2
scummvm-rg350-fd8f11f7a452ae18d5e00f58430cc33bc5a48fed.zip
Improve input in C64 maniac
svn-id: r21000
-rw-r--r--engines/scumm/intern.h7
-rw-r--r--engines/scumm/script.cpp44
-rw-r--r--engines/scumm/script_v2.cpp12
-rw-r--r--engines/scumm/scumm.cpp15
-rw-r--r--engines/scumm/scumm.h5
-rw-r--r--engines/scumm/verbs.cpp74
6 files changed, 97 insertions, 60 deletions
diff --git a/engines/scumm/intern.h b/engines/scumm/intern.h
index 89e493fca5..16a8adc231 100644
--- a/engines/scumm/intern.h
+++ b/engines/scumm/intern.h
@@ -278,6 +278,7 @@ protected:
virtual void readGlobalObjects();
virtual void loadCharset(int no);
+ virtual void runInputScript(int a, int cmd, int mode);
virtual void runInventoryScript(int i);
virtual int getVar();
@@ -377,6 +378,10 @@ protected:
byte VAR_SENTENCE_OBJECT2;
byte VAR_SENTENCE_PREPOSITION;
byte VAR_BACKUP_VERB;
+
+ byte VAR_CLICK_AREA;
+ byte VAR_CLICK_VERB;
+ byte VAR_CLICK_OBJECT;
};
/**
@@ -392,7 +397,7 @@ protected:
const OpcodeEntryC64 *_opcodesC64;
- int _currentAction;
+ int _activeVerb;
int _currentMode;
public:
ScummEngine_c64(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index 594a7f4128..da536e5b7b 100644
--- a/engines/scumm/script.cpp
+++ b/engines/scumm/script.cpp
@@ -27,6 +27,7 @@
#include "common/util.h"
#include "scumm/actor.h"
+#include "scumm/intern.h"
#include "scumm/object.h"
#include "scumm/resource.h"
#include "scumm/util.h"
@@ -1137,33 +1138,40 @@ void ScummEngine::checkAndRunSentenceScript() {
runScript(sentenceScript, 0, 0, localParamList);
}
-void ScummEngine::runInputScript(int a, int cmd, int mode) {
+void ScummEngine_v2::runInputScript(int a, int cmd, int mode) {
int args[24];
int verbScript;
- if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) {
- verbScript = 3;
- //_scummVars[9] = cmd;
-
- } else if (_game.version <= 2) {
- verbScript = 4;
- VAR(VAR_CLICK_AREA) = a;
- switch (a) {
- case 1: // Verb clicked
- VAR(VAR_CLICK_VERB) = cmd;
- break;
- case 3: // Inventory clicked
- VAR(VAR_CLICK_OBJECT) = cmd;
- break;
- }
- } else {
- verbScript = VAR(VAR_VERB_SCRIPT);
+ verbScript = 4;
+ VAR(VAR_CLICK_AREA) = a;
+ switch (a) {
+ case 1: // Verb clicked
+ VAR(VAR_CLICK_VERB) = cmd;
+ break;
+ case 3: // Inventory clicked
+ VAR(VAR_CLICK_OBJECT) = cmd;
+ break;
}
memset(args, 0, sizeof(args));
args[0] = a;
args[1] = cmd;
args[2] = mode;
+
+ if (verbScript)
+ runScript(verbScript, 0, 0, args);
+}
+
+void ScummEngine::runInputScript(int a, int cmd, int mode) {
+ int args[24];
+ int verbScript;
+
+ verbScript = VAR(VAR_VERB_SCRIPT);
+
+ memset(args, 0, sizeof(args));
+ args[0] = a;
+ args[1] = cmd;
+ args[2] = mode;
// All HE 72+ games but only some HE 71 games.
if (_game.heversion >= 71) {
args[3] = VAR(VAR_VIRT_MOUSE_X);
diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp
index d13b045ed8..3b82677138 100644
--- a/engines/scumm/script_v2.cpp
+++ b/engines/scumm/script_v2.cpp
@@ -1612,10 +1612,14 @@ void ScummEngine_v2::o2_switchCostumeSet() {
}
void ScummEngine_v2::resetSentence() {
- VAR(VAR_SENTENCE_VERB) = VAR(VAR_BACKUP_VERB);
- VAR(VAR_SENTENCE_OBJECT1) = 0;
- VAR(VAR_SENTENCE_OBJECT2) = 0;
- VAR(VAR_SENTENCE_PREPOSITION) = 0;
+ if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) {
+ // TODO
+ } else {
+ VAR(VAR_SENTENCE_VERB) = VAR(VAR_BACKUP_VERB);
+ VAR(VAR_SENTENCE_OBJECT1) = 0;
+ VAR(VAR_SENTENCE_OBJECT2) = 0;
+ VAR(VAR_SENTENCE_PREPOSITION) = 0;
+ }
}
void ScummEngine_v2::runInventoryScript(int i) {
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 6563070326..f966aec62a 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -785,9 +785,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
VAR_ACTIVE_OBJECT1 = 0xFF;
VAR_ACTIVE_OBJECT2 = 0xFF;
VAR_VERB_ALLOWED = 0xFF;
- VAR_CLICK_AREA = 0xFF;
- VAR_CLICK_VERB = 0xFF;
- VAR_CLICK_OBJECT = 0xFF;
VAR_BLAST_ABOVE_TEXT = 0xFF;
VAR_VOICE_MODE = 0xFF;
@@ -970,12 +967,22 @@ ScummEngine_v3old::ScummEngine_v3old(GameDetector *detector, OSystem *syst, cons
ScummEngine_v2::ScummEngine_v2(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v3old(detector, syst, gs, md5sum, subst) {
+
+ VAR_SENTENCE_VERB = 0xFF;
+ VAR_SENTENCE_OBJECT1 = 0xFF;
+ VAR_SENTENCE_OBJECT2 = 0xFF;
+ VAR_SENTENCE_PREPOSITION = 0xFF;
+ VAR_BACKUP_VERB = 0xFF;
+
+ VAR_CLICK_AREA = 0xFF;
+ VAR_CLICK_VERB = 0xFF;
+ VAR_CLICK_OBJECT = 0xFF;
}
ScummEngine_c64::ScummEngine_c64(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v2(detector, syst, gs, md5sum, subst) {
- _currentAction = 0;
+ _activeVerb = 0;
_currentMode = 0;
}
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 0bb99c937e..9a515947aa 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -893,7 +893,7 @@ protected:
void verbMouseOver(int verb);
int findVerbAtPos(int x, int y) const;
virtual void drawVerb(int verb, int mode);
- void runInputScript(int a, int cmd, int mode);
+ virtual void runInputScript(int a, int cmd, int mode);
void restoreVerbBG(int verb);
void drawVerbBitmap(int verb, int x, int y);
int getVerbSlot(int id, int mode) const;
@@ -1377,9 +1377,6 @@ public:
byte VAR_ACTIVE_VERB;
byte VAR_ACTIVE_OBJECT1;
byte VAR_ACTIVE_OBJECT2;
- byte VAR_CLICK_AREA;
- byte VAR_CLICK_VERB;
- byte VAR_CLICK_OBJECT;
// HE specific variables
byte VAR_REDRAW_ALL_ACTORS; // Used in setActorRedrawFlags()
diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp
index 9164398558..3740ccbd50 100644
--- a/engines/scumm/verbs.cpp
+++ b/engines/scumm/verbs.cpp
@@ -306,6 +306,11 @@ void ScummEngine_v2::checkV2Inventory(int x, int y) {
object = findInventory(_scummVars[VAR_EGO], object + 1 + _inventoryOffset);
+ if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) {
+ // TODO
+ return;
+ }
+
if (object > 0) {
runInputScript(3, object, 0);
}
@@ -500,38 +505,49 @@ void ScummEngine_c64::checkExecVerbs() {
if (_userPut <= 0 || _mouseAndKeyboardStat == 0)
return;
- if (zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) {
+ if (_mouseAndKeyboardStat < MBS_MAX_KEY) {
+ /* Check keypresses */
// TODO
- } else if (_game.version <= 2 && zone->number == kVerbVirtScreen && _mouse.y > zone->topline + 32) {
- // Click into V2 inventory
- checkV2Inventory(_mouse.x, _mouse.y);
- } else {
- int over = findVerbAtPos(_mouse.x, _mouse.y);
- if (over) {
- _currentAction = _verbs[over].verbid;
- return;
- }
-
- // HACK: Reset value
- VAR(VAR_EGO) = 3;
-
- int object = findObject(_mouse.x, _mouse.y);
- if (object) {
- _activeObject = object;
- if (_currentMode == 3) {
- int x, y, dir;
- a = derefActor(VAR(VAR_EGO), "checkExecVerbs");
- getObjectXYPos(object, x, y, dir);
- a->startWalkActor(x, y, dir);
+ } else if (_mouseAndKeyboardStat & MBS_MOUSE_MASK) {
+ if (zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) {
+ // TODO
+ } else if (zone->number == kVerbVirtScreen && _mouse.y > zone->topline + 32) {
+ // Click into V2 inventory
+ checkV2Inventory(_mouse.x, _mouse.y);
+ } else {
+ int over = findVerbAtPos(_mouse.x, _mouse.y);
+ if (over) {
+ _activeVerb = _verbs[over].verbid;
+ return;
}
- int tmp = (_currentMode == 3) ? _currentAction : 15;
- runObjectScript(object, tmp, false, false, NULL);
- } else {
- _activeObject = 0;
- if (zone->number == kMainVirtScreen) {
- a = derefActor(VAR(VAR_EGO), "checkExecVerbs");
- a->startWalkActor(_mouse.x, _mouse.y, -1);
+ // HACK: Reset value
+ VAR(VAR_EGO) = 3;
+
+ int object = findObject(_virtualMouse.x, _virtualMouse.y);
+ if (object) {
+ _activeObject = object;
+ if (_currentMode == 3 && _activeVerb == 13) {
+ int x, y, dir;
+ a = derefActor(VAR(VAR_EGO), "checkExecVerbs");
+ getObjectXYPos(object, x, y, dir);
+ a->startWalkActor(x, y, dir);
+ }
+
+ int tmp = (_currentMode == 3) ? _activeVerb : 15;
+ if (getVerbEntrypoint(object, tmp) != 0) {
+ runObjectScript(object, tmp, false, false, NULL);
+ } else if (_activeVerb != 13 && _activeVerb != 15) {
+ VAR(9) = _activeVerb;
+ runScript(3, 0, 0, 0);
+ }
+ } else {
+ _activeObject = 0;
+ _activeVerb = 13;
+ if (zone->number == kMainVirtScreen) {
+ a = derefActor(VAR(VAR_EGO), "checkExecVerbs");
+ a->startWalkActor(_virtualMouse.x, _virtualMouse.y, -1);
+ }
}
}
}