aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure
diff options
context:
space:
mode:
authorBorja Lorente2016-07-14 00:18:08 +0200
committerBorja Lorente2016-08-14 18:55:16 +0200
commit8162483026ec52476a1106e72259c84e5476fd2d (patch)
tree46515e4af1cb9ba015d7d05f60bdf53a40a06256 /engines/macventure
parentdad1edcef0e5b95b0d4b09e97c2045a3b5ba61f3 (diff)
downloadscummvm-rg350-8162483026ec52476a1106e72259c84e5476fd2d.tar.gz
scummvm-rg350-8162483026ec52476a1106e72259c84e5476fd2d.tar.bz2
scummvm-rg350-8162483026ec52476a1106e72259c84e5476fd2d.zip
MACVENTURE: Add text input logic
Diffstat (limited to 'engines/macventure')
-rw-r--r--engines/macventure/gui.cpp5
-rw-r--r--engines/macventure/macventure.cpp12
-rw-r--r--engines/macventure/macventure.h25
-rw-r--r--engines/macventure/script.cpp6
-rw-r--r--engines/macventure/script.h21
-rw-r--r--engines/macventure/world.cpp5
6 files changed, 35 insertions, 39 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 91df455318..02f603659e 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -460,7 +460,7 @@ bool Gui::loadWindows() {
data.title = Common::String(newTitle);
}
- debug(4, "Window loaded: %s", data.title);
+ debug(4, "Window loaded: %s", data.title.c_str());
_windowData->push_back(data);
}
@@ -1163,7 +1163,6 @@ bool Gui::processCommandEvents(WindowClick click, Common::Event &event) {
}
}
-
_engine->selectControl(data.getData().refcon);
_engine->activateCommand(data.getData().refcon);
_engine->refreshReady();
@@ -1178,7 +1177,6 @@ bool MacVenture::Gui::processMainGameEvents(WindowClick click, Common::Event & e
if (click == kBorderInner && event.type == Common::EVENT_LBUTTONDOWN) {
WindowData &data = findWindowData(kMainGameWindow);
- ObjID child = 0;
Common::Point pos;
// Click rect to local coordinates. We assume the click is inside the window ^
Common::Rect clickRect = calculateClickRect(event.mouse, _mainGameWindow->getDimensions());
@@ -1254,7 +1252,6 @@ bool Gui::processInventoryEvents(WindowClick click, Common::Event & event) {
if (ref == kNoWindow) return false;
Graphics::MacWindow *win = findWindow(ref);
WindowData &data = findWindowData((WindowReference) ref);
- ObjID child;
Common::Point pos;
// Click rect to local coordinates. We assume the click is inside the window ^
Common::Rect clickRect = calculateClickRect(event.mouse, win->getDimensions());
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index 211ba43971..b6db45c93a 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -370,11 +370,17 @@ void MacVentureEngine::updateWindow(WindowReference winID) {
_gui->updateWindow(winID, true);
}
+bool MacVentureEngine::showTextEntry(ObjID text, ObjID srcObj, ObjID destObj) {
+ debug("Showing speech dialog, asset %d from %d to %d", text, srcObj, destObj);
+ _userInput = Common::String("epor");
+ warning("Show text entry: not fully implemented");
+ return true;
+}
+
const GlobalSettings& MacVentureEngine::getGlobalSettings() const {
return _globalSettings;
}
-
// Private engine methods
void MacVentureEngine::processEvents() {
Common::Event event;
@@ -585,6 +591,10 @@ Common::String MacVentureEngine::getNoun(ObjID ndx) {
return _decodingIndirectArticles->getString(ndx);
}
+Common::String MacVentureEngine::getUserInput() {
+ return _userInput;
+}
+
void MacVentureEngine::highlightExit(ObjID objID) {
//ObjID ctl = _gui->getWinChild(obj);
/*if (ctl) {
diff --git a/engines/macventure/macventure.h b/engines/macventure/macventure.h
index 735dda51cc..71c3cbea8b 100644
--- a/engines/macventure/macventure.h
+++ b/engines/macventure/macventure.h
@@ -71,27 +71,6 @@ enum {
kClickToContinueTextID = 0x84,
kStartGameFilenameID = 0x85
};
-/*
-enum ControlAction {
- kNoCommand = 0,
- kStartOrResume = 1,
- kClose = 2,
- kTick = 3,
- kActivateObject = 4,
- kMoveObject = 5,
- kConsume = 6,
- kExamine = 7,
- kGo = 8,
- kHit = 9,
- kOpen = 10,
- kOperate = 11,
- kSpeak = 12,
- kBabble = 13,
- kTargetName = 14,
- kDebugObject = 15,
- kClickToContinue = 16
-};
-*/
enum FilePathID {
kMCVID = 1,
@@ -206,6 +185,8 @@ public:
void focusObjWin(ObjID objID);
void updateWindow(WindowReference winID);
+ bool showTextEntry(ObjID text, ObjID srcObj, ObjID destObj);
+
// Data retrieval
bool isPaused();
bool needsClickToContinue();
@@ -220,6 +201,7 @@ public:
uint getPrefixNdx(ObjID obj);
Common::String getPrefixString(uint flag, ObjID obj);
Common::String getNoun(ObjID ndx);
+ Common::String getUserInput();
// Attributes consult
Common::Point getObjPosition(ObjID objID);
@@ -317,6 +299,7 @@ private: // Attributes
Common::Array<ObjID> _currentSelection;
Common::Array<ObjID> _selectedObjs;
Common::Point _deltaPoint;
+ Common::String _userInput;
};
diff --git a/engines/macventure/script.cpp b/engines/macventure/script.cpp
index 5b86c31e84..794bbdde60 100644
--- a/engines/macventure/script.cpp
+++ b/engines/macventure/script.cpp
@@ -1073,7 +1073,11 @@ void ScriptEngine::opd4RELC(EngineState * state, EngineFrame * frame) {
void ScriptEngine::opd5DLOG(EngineState * state, EngineFrame * frame) {
word txt = state->pop();
- op00NOOP(0xd5);
+ if (_engine->showTextEntry(txt, frame->src, frame->dest)) {
+ state->push(0xFFFF);
+ } else {
+ state->push(0x0000);
+ }
}
void ScriptEngine::opd6ACMD(EngineState * state, EngineFrame * frame) {
diff --git a/engines/macventure/script.h b/engines/macventure/script.h
index 8aee88fd66..49b69874e6 100644
--- a/engines/macventure/script.h
+++ b/engines/macventure/script.h
@@ -27,21 +27,20 @@
#include "macventure/world.h"
namespace MacVenture {
-
+
class Container;
class World;
-
typedef uint32 ObjID;
typedef int16 word;
class ScriptAsset {
public:
- ScriptAsset(ObjID id, Container *container);
+ ScriptAsset(ObjID id, Container *container);
~ScriptAsset() {}
void reset();
- uint8 fetch();
+ uint8 fetch();
bool hasNext();
void branch(word amount);
@@ -66,7 +65,7 @@ public:
}
void push(word data) {
- sp--;
+ sp--;
stack[sp] = unneg16(data);
}
@@ -97,7 +96,7 @@ public:
private:
word unneg16(word data) {
- if (data < 0)
+ if (data < 0)
data = ((-data) ^ 0xFFFF) + 1;
return data;
@@ -141,17 +140,17 @@ public:
~ScriptEngine();
public:
- bool runControl(ControlAction action, ObjID source, ObjID destination, Common::Point delta);
- bool resume(bool execAll);
+ bool runControl(ControlAction action, ObjID source, ObjID destination, Common::Point delta);
+ bool resume(bool execAll);
void reset();
private:
bool execFrame(bool execAll);
bool loadScript(EngineFrame * frame, uint32 scriptID);
- bool resumeFunc(EngineFrame * frame);
+ bool resumeFunc(EngineFrame * frame);
bool runFunc(EngineFrame * frame);
-private:
+private:
// Aux
word neg16(word val);
@@ -208,7 +207,7 @@ private:
void opacEQ(EngineState *state, EngineFrame *frame); //eq?
void opadEQS(EngineState *state, EngineFrame *frame); //eq string?
void opaeCONT(EngineState *state, EngineFrame *frame); //contains
- void opafCONTW(EngineState *state, EngineFrame *frame); //contains word
+ void opafCONTW(EngineState *state, EngineFrame *frame); //contains word
void opb0BRA(EngineState *state, EngineFrame *frame, ScriptAsset *script); //bra
void opb1BRAB(EngineState *state, EngineFrame *frame, ScriptAsset *script); //bra.b
diff --git a/engines/macventure/world.cpp b/engines/macventure/world.cpp
index ec20ba6b20..e247404eb6 100644
--- a/engines/macventure/world.cpp
+++ b/engines/macventure/world.cpp
@@ -156,6 +156,9 @@ void World::releaseChildren(ObjID objID) {
}
Common::String World::getText(ObjID objID, ObjID source, ObjID target) {
+ if (objID & 0x8000){
+ return _engine->getUserInput();
+ }
TextAsset text = TextAsset(_engine, objID, source, target, _gameText, _engine->isOldText(), _engine->getDecodingHuffman());
return *text.decode();
@@ -169,7 +172,7 @@ bool World::isObjDraggable(ObjID objID) {
}
bool World::intersects(ObjID objID, Common::Rect rect) {
- return _engine->getObjBounds(objID).intersects(rect);
+ return _engine->getObjBounds(objID).intersects(rect);
}
bool World::loadStartGameFileName() {