aboutsummaryrefslogtreecommitdiff
path: root/engines/m4/dialogs.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2009-12-20 07:10:32 +0000
committerPaul Gilbert2009-12-20 07:10:32 +0000
commit5c732e00ee61b3661ad3ca8679ff270ace6d7d10 (patch)
tree0fc3b21950f2705023a837991787a9828c5adc39 /engines/m4/dialogs.cpp
parentb729218bb6f48a7e57cd938f76ca0065983b792e (diff)
downloadscummvm-rg350-5c732e00ee61b3661ad3ca8679ff270ace6d7d10.tar.gz
scummvm-rg350-5c732e00ee61b3661ad3ca8679ff270ace6d7d10.tar.bz2
scummvm-rg350-5c732e00ee61b3661ad3ca8679ff270ace6d7d10.zip
Started implementation of the original game's cheat mode
svn-id: r46425
Diffstat (limited to 'engines/m4/dialogs.cpp')
-rw-r--r--engines/m4/dialogs.cpp42
1 files changed, 37 insertions, 5 deletions
diff --git a/engines/m4/dialogs.cpp b/engines/m4/dialogs.cpp
index 442c31f35d..9adf6c42e5 100644
--- a/engines/m4/dialogs.cpp
+++ b/engines/m4/dialogs.cpp
@@ -364,18 +364,24 @@ Dialog::Dialog(M4Engine *vm, const char *msgData, const char *title): View(vm, C
// Noun command 1
handleNounSuffix(lineP, 1, cmdText + 5);
- } else if (matchCommand(cmdText, "NOUN1")) {
+ } else if (matchCommand(cmdText, "NOUN2")) {
// Noun command 2
handleNounSuffix(lineP, 2, cmdText + 5);
+ } else if (matchCommand(cmdText, "TAB")) {
+ // Specifies the X offset for the current line
+ _lines[_lines.size() - 1].xp = atoi(cmdText + 3);
+
+ } else if (matchCommand(cmdText, "UNDER")) {
+ // Underline command
+ underline = true;
+
} else if (matchCommand(cmdText, "VERB")) {
// Verb/vocab retrieval
int verbId = 1; // TODO: Get correct vocab
getVocab(verbId, &lineP);
- } else if (matchCommand(cmdText, "UNDER")) {
- // Underline command
- underline = true;
+
} else if (matchCommand(cmdText, "ASK")) {
// doAsk();
@@ -396,6 +402,27 @@ Dialog::Dialog(M4Engine *vm, const char *msgData, const char *title): View(vm, C
draw();
}
+Dialog::Dialog(M4Engine *vm, int widthChars, const char **descEntries): View(vm, Common::Rect(0, 0, 0, 0)) {
+ _vm->_font->setFont(FONT_INTERFACE_MADS);
+ _widthChars = widthChars * 2;
+ _dialogWidth = widthChars * (_vm->_font->getMaxWidth() + DIALOG_SPACING) + 10;
+ _screenType = LAYER_DIALOG;
+ _lineX = 0;
+ _widthX = 0;
+
+ while (*descEntries != NULL) {
+ incLine();
+ writeChars(*descEntries);
+
+ int lineWidth = _vm->_font->getWidth(*descEntries, DIALOG_SPACING);
+ _lines[_lines.size() - 1].xp = (_dialogWidth - 10 - lineWidth) / 2;
+ ++descEntries;
+ }
+
+ _lines[0].underline = true;
+ draw();
+}
+
Dialog::~Dialog() {
_vm->_palette->deleteRange(_palette);
delete _palette;
@@ -477,7 +504,7 @@ void Dialog::draw() {
this->translate(_palette);
}
-bool Dialog::onEvent(M4EventType eventType, int param1, int x, int y, bool &captureEvents) {
+bool Dialog::onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents) {
if (_vm->_mouse->getCursorNum() != CURSOR_ARROW)
_vm->_mouse->setCursorNum(CURSOR_ARROW);
@@ -491,5 +518,10 @@ bool Dialog::onEvent(M4EventType eventType, int param1, int x, int y, bool &capt
return true;
}
+void Dialog::display(M4Engine *vm, int widthChars, const char **descEntries) {
+ Dialog *dlg = new Dialog(vm, widthChars, descEntries);
+ vm->_viewManager->addView(dlg);
+ vm->_viewManager->moveToFront(dlg);
+}
} // End of namespace M4