Improve input in C64 maniac

svn-id: r21000
This commit is contained in:
Travis Howell 2006-03-02 01:17:41 +00:00
parent c01ef102af
commit fd8f11f7a4
6 changed files with 97 additions and 60 deletions

View file

@ -278,6 +278,7 @@ protected:
virtual void readGlobalObjects(); virtual void readGlobalObjects();
virtual void loadCharset(int no); virtual void loadCharset(int no);
virtual void runInputScript(int a, int cmd, int mode);
virtual void runInventoryScript(int i); virtual void runInventoryScript(int i);
virtual int getVar(); virtual int getVar();
@ -377,6 +378,10 @@ protected:
byte VAR_SENTENCE_OBJECT2; byte VAR_SENTENCE_OBJECT2;
byte VAR_SENTENCE_PREPOSITION; byte VAR_SENTENCE_PREPOSITION;
byte VAR_BACKUP_VERB; byte VAR_BACKUP_VERB;
byte VAR_CLICK_AREA;
byte VAR_CLICK_VERB;
byte VAR_CLICK_OBJECT;
}; };
/** /**
@ -392,7 +397,7 @@ protected:
const OpcodeEntryC64 *_opcodesC64; const OpcodeEntryC64 *_opcodesC64;
int _currentAction; int _activeVerb;
int _currentMode; int _currentMode;
public: public:
ScummEngine_c64(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_c64(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);

View file

@ -27,6 +27,7 @@
#include "common/util.h" #include "common/util.h"
#include "scumm/actor.h" #include "scumm/actor.h"
#include "scumm/intern.h"
#include "scumm/object.h" #include "scumm/object.h"
#include "scumm/resource.h" #include "scumm/resource.h"
#include "scumm/util.h" #include "scumm/util.h"
@ -1137,15 +1138,10 @@ void ScummEngine::checkAndRunSentenceScript() {
runScript(sentenceScript, 0, 0, localParamList); 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 args[24];
int verbScript; int verbScript;
if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) {
verbScript = 3;
//_scummVars[9] = cmd;
} else if (_game.version <= 2) {
verbScript = 4; verbScript = 4;
VAR(VAR_CLICK_AREA) = a; VAR(VAR_CLICK_AREA) = a;
switch (a) { switch (a) {
@ -1156,10 +1152,22 @@ void ScummEngine::runInputScript(int a, int cmd, int mode) {
VAR(VAR_CLICK_OBJECT) = cmd; VAR(VAR_CLICK_OBJECT) = cmd;
break; break;
} }
} else {
verbScript = VAR(VAR_VERB_SCRIPT); 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)); memset(args, 0, sizeof(args));
args[0] = a; args[0] = a;
args[1] = cmd; args[1] = cmd;

View file

@ -1612,11 +1612,15 @@ void ScummEngine_v2::o2_switchCostumeSet() {
} }
void ScummEngine_v2::resetSentence() { void ScummEngine_v2::resetSentence() {
if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) {
// TODO
} else {
VAR(VAR_SENTENCE_VERB) = VAR(VAR_BACKUP_VERB); VAR(VAR_SENTENCE_VERB) = VAR(VAR_BACKUP_VERB);
VAR(VAR_SENTENCE_OBJECT1) = 0; VAR(VAR_SENTENCE_OBJECT1) = 0;
VAR(VAR_SENTENCE_OBJECT2) = 0; VAR(VAR_SENTENCE_OBJECT2) = 0;
VAR(VAR_SENTENCE_PREPOSITION) = 0; VAR(VAR_SENTENCE_PREPOSITION) = 0;
} }
}
void ScummEngine_v2::runInventoryScript(int i) { void ScummEngine_v2::runInventoryScript(int i) {
redrawV2Inventory(); redrawV2Inventory();

View file

@ -785,9 +785,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
VAR_ACTIVE_OBJECT1 = 0xFF; VAR_ACTIVE_OBJECT1 = 0xFF;
VAR_ACTIVE_OBJECT2 = 0xFF; VAR_ACTIVE_OBJECT2 = 0xFF;
VAR_VERB_ALLOWED = 0xFF; VAR_VERB_ALLOWED = 0xFF;
VAR_CLICK_AREA = 0xFF;
VAR_CLICK_VERB = 0xFF;
VAR_CLICK_OBJECT = 0xFF;
VAR_BLAST_ABOVE_TEXT = 0xFF; VAR_BLAST_ABOVE_TEXT = 0xFF;
VAR_VOICE_MODE = 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_v2::ScummEngine_v2(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v3old(detector, syst, gs, md5sum, 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_c64::ScummEngine_c64(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v2(detector, syst, gs, md5sum, subst) { : ScummEngine_v2(detector, syst, gs, md5sum, subst) {
_currentAction = 0; _activeVerb = 0;
_currentMode = 0; _currentMode = 0;
} }

View file

@ -893,7 +893,7 @@ protected:
void verbMouseOver(int verb); void verbMouseOver(int verb);
int findVerbAtPos(int x, int y) const; int findVerbAtPos(int x, int y) const;
virtual void drawVerb(int verb, int mode); 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 restoreVerbBG(int verb);
void drawVerbBitmap(int verb, int x, int y); void drawVerbBitmap(int verb, int x, int y);
int getVerbSlot(int id, int mode) const; int getVerbSlot(int id, int mode) const;
@ -1377,9 +1377,6 @@ public:
byte VAR_ACTIVE_VERB; byte VAR_ACTIVE_VERB;
byte VAR_ACTIVE_OBJECT1; byte VAR_ACTIVE_OBJECT1;
byte VAR_ACTIVE_OBJECT2; byte VAR_ACTIVE_OBJECT2;
byte VAR_CLICK_AREA;
byte VAR_CLICK_VERB;
byte VAR_CLICK_OBJECT;
// HE specific variables // HE specific variables
byte VAR_REDRAW_ALL_ACTORS; // Used in setActorRedrawFlags() byte VAR_REDRAW_ALL_ACTORS; // Used in setActorRedrawFlags()

View file

@ -306,6 +306,11 @@ void ScummEngine_v2::checkV2Inventory(int x, int y) {
object = findInventory(_scummVars[VAR_EGO], object + 1 + _inventoryOffset); object = findInventory(_scummVars[VAR_EGO], object + 1 + _inventoryOffset);
if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) {
// TODO
return;
}
if (object > 0) { if (object > 0) {
runInputScript(3, object, 0); runInputScript(3, object, 0);
} }
@ -500,38 +505,49 @@ void ScummEngine_c64::checkExecVerbs() {
if (_userPut <= 0 || _mouseAndKeyboardStat == 0) if (_userPut <= 0 || _mouseAndKeyboardStat == 0)
return; return;
if (_mouseAndKeyboardStat < MBS_MAX_KEY) {
/* Check keypresses */
// TODO
} else if (_mouseAndKeyboardStat & MBS_MOUSE_MASK) {
if (zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) { if (zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) {
// TODO // TODO
} else if (_game.version <= 2 && zone->number == kVerbVirtScreen && _mouse.y > zone->topline + 32) { } else if (zone->number == kVerbVirtScreen && _mouse.y > zone->topline + 32) {
// Click into V2 inventory // Click into V2 inventory
checkV2Inventory(_mouse.x, _mouse.y); checkV2Inventory(_mouse.x, _mouse.y);
} else { } else {
int over = findVerbAtPos(_mouse.x, _mouse.y); int over = findVerbAtPos(_mouse.x, _mouse.y);
if (over) { if (over) {
_currentAction = _verbs[over].verbid; _activeVerb = _verbs[over].verbid;
return; return;
} }
// HACK: Reset value // HACK: Reset value
VAR(VAR_EGO) = 3; VAR(VAR_EGO) = 3;
int object = findObject(_mouse.x, _mouse.y); int object = findObject(_virtualMouse.x, _virtualMouse.y);
if (object) { if (object) {
_activeObject = object; _activeObject = object;
if (_currentMode == 3) { if (_currentMode == 3 && _activeVerb == 13) {
int x, y, dir; int x, y, dir;
a = derefActor(VAR(VAR_EGO), "checkExecVerbs"); a = derefActor(VAR(VAR_EGO), "checkExecVerbs");
getObjectXYPos(object, x, y, dir); getObjectXYPos(object, x, y, dir);
a->startWalkActor(x, y, dir); a->startWalkActor(x, y, dir);
} }
int tmp = (_currentMode == 3) ? _currentAction : 15; int tmp = (_currentMode == 3) ? _activeVerb : 15;
if (getVerbEntrypoint(object, tmp) != 0) {
runObjectScript(object, tmp, false, false, NULL); runObjectScript(object, tmp, false, false, NULL);
} else if (_activeVerb != 13 && _activeVerb != 15) {
VAR(9) = _activeVerb;
runScript(3, 0, 0, 0);
}
} else { } else {
_activeObject = 0; _activeObject = 0;
_activeVerb = 13;
if (zone->number == kMainVirtScreen) { if (zone->number == kMainVirtScreen) {
a = derefActor(VAR(VAR_EGO), "checkExecVerbs"); a = derefActor(VAR(VAR_EGO), "checkExecVerbs");
a->startWalkActor(_mouse.x, _mouse.y, -1); a->startWalkActor(_virtualMouse.x, _virtualMouse.y, -1);
}
} }
} }
} }