aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2013-09-26 19:22:48 +0200
committeruruk2013-09-26 19:22:48 +0200
commit8efaa45425cdb8d10d7f3fbc58a3a143c3033ff2 (patch)
tree803f9367014e9d97c413452cb935ffc62a23bbf1
parent90c6e6a6899cd8af6ca01dbac80d039c9f93e8a3 (diff)
downloadscummvm-rg350-8efaa45425cdb8d10d7f3fbc58a3a143c3033ff2.tar.gz
scummvm-rg350-8efaa45425cdb8d10d7f3fbc58a3a143c3033ff2.tar.bz2
scummvm-rg350-8efaa45425cdb8d10d7f3fbc58a3a143c3033ff2.zip
AVALANCHE: Partially implement (there are still missing features: icon, keyboard control) the last missing type of scrolls: dialogs. Move some functions/variables, remove unused code in order to do so.
-rw-r--r--engines/avalanche/avalot.cpp26
-rw-r--r--engines/avalanche/avalot.h7
-rw-r--r--engines/avalanche/dialogs.cpp76
-rw-r--r--engines/avalanche/dialogs.h7
4 files changed, 80 insertions, 36 deletions
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp
index 78bcc2659f..42f29424ec 100644
--- a/engines/avalanche/avalot.cpp
+++ b/engines/avalanche/avalot.cpp
@@ -51,15 +51,15 @@ const char *Avalot::kVersionNum = "1.30";
const char *Avalot::kCopyright = "1995";
const MouseHotspotType Avalot::kMouseHotSpots[9] = {
- {8,0}, // 1 - up-arrow
- {0,0}, // 2 - screwdriver
- {15,6}, // 3 - right-arrow
- {0,0}, // 4 - fletch
- {8,7}, // 5 - hourglass
- {4,0}, // 6 - TTHand
- {8,5}, // 7- Mark's crosshairs
- {8,7}, // 8- I-beam
- {0,0} // 9 - question mark
+ {8,0}, // 0 - up-arrow
+ {0,0}, // 1 - screwdriver
+ {15,6}, // 2 - right-arrow
+ {0,0}, // 3 - fletch
+ {8,7}, // 4 - hourglass
+ {4,0}, // 5 - TTHand
+ {8,5}, // 6 - Mark's crosshairs
+ {8,7}, // 7 - I-beam
+ {0,0} // 8 - question mark
};
// Art gallery at 2,1; notice about this at 2,2.
@@ -1581,14 +1581,6 @@ void Avalot::setMousePointerWait() {
newMouse(4);
}
-void Avalot::drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc) {
- warning("STUB: Avalot::shadow()");
-}
-
-void Avalot::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) {
- warning("STUB: Avalot::shbox()");
-}
-
void Avalot::resetVariables() {
_vm->_animation->setDirection(kDirUp);
_carryNum = 0;
diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h
index 2a5234af08..fa61690246 100644
--- a/engines/avalanche/avalot.h
+++ b/engines/avalanche/avalot.h
@@ -237,7 +237,7 @@ public:
byte _lineNum; // Number of lines.
LineType _lines[50]; // For Also.
enum MouseState { kMouseStateNo, kMouseStateYes, kMouseStateVirtual } _mouse;
- bool _dropsOk, _scReturn, _soundFx, _cheat;
+ bool _dropsOk, _soundFx, _cheat;
Common::String _mouseText;
bool _weirdWord;
bool _letMeOut;
@@ -324,8 +324,7 @@ public:
void loadMouse(byte which);
void setBackgroundColor(byte x);
- void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t);
-
+
void resetVariables();
void newGame(); // This sets up the DNA for a completely new game.
void slowDown();
@@ -367,8 +366,6 @@ private:
int8 fades(int8 x);
void fadeOut(byte n);
void fadeIn(byte n);
-
- void drawShadow(int16 x1, int16 y1, int16 x2, int16 y2, byte hc, byte sc);
};
} // End of namespace Avalanche
diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp
index 930bb40eec..7eb8d50b3b 100644
--- a/engines/avalanche/dialogs.cpp
+++ b/engines/avalanche/dialogs.cpp
@@ -178,8 +178,60 @@ void Dialogs::scrollModeNormal() {
warning("STUB: Scrolls::scrollModeNormal()");
}
+void Dialogs::drawShadow(int16 x1, int16 y1, int16 x2, int16 y2) {
+ for (byte i = 0; i < 2; i ++) {
+ _vm->_graphics->_scrolls.fillRect(Common::Rect(x1 + i, y1 + i, x1 + i + 1, y2 - i), kColorWhite);
+ _vm->_graphics->_scrolls.fillRect(Common::Rect(x1 + i, y1 + i, x2 - i, y1 + i + 1), kColorWhite);
+
+ _vm->_graphics->_scrolls.fillRect(Common::Rect(x2 - i, y1 + i, x2 - i + 1, y2 - i + 1), kColorDarkgray);
+ _vm->_graphics->_scrolls.fillRect(Common::Rect(x1 + i, y2 - i, x2 - i, y2 - i + 1), kColorDarkgray);
+ }
+}
+
+void Dialogs::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text) {
+ CursorMan.showMouse(false);
+
+ drawShadow(x1, y1, x2, y2);
+
+ bool offset = text.size() % 2;
+ x1 = (x2 - x1) / 2 + x1 - text.size() / 2 * 8 - offset * 3;
+ y1 = (y2 - y1) / 2 + y1 - 4;
+ _vm->_graphics->drawText(_vm->_graphics->_scrolls, text, _vm->_avalot->_font, 8, x1, y1, kColorBlue);
+ _vm->_graphics->drawText(_vm->_graphics->_scrolls, Common::String('_'), _vm->_avalot->_font, 8, x1, y1, kColorBlue);
+
+ CursorMan.showMouse(true);
+}
+
void Dialogs::scrollModeDialogue() {
warning("STUB: Scrolls::scrollModeDialogue()");
+ // It should work with keypresses too! TODO: Implement it!
+
+ _vm->_avalot->loadMouse(5);
+
+ ::Graphics::Surface temp;
+ temp.copyFrom(_vm->_graphics->_surface);
+ _vm->_graphics->_surface.copyFrom(_vm->_graphics->_scrolls); // TODO: Rework it using getSubArea !!!!!!!
+
+ Common::Event event;
+ while (!_vm->shouldQuit()) {
+ _vm->_graphics->refreshScreen();
+
+ _vm->getEvent(event);
+ Common::Point cursorPos = _vm->getMousePos();
+ cursorPos.y /= 2;
+ if (_vm->shouldQuit() || (event.type == Common::EVENT_LBUTTONUP)) {
+ if ((cursorPos.x >= _shadowBoxX - 65) && (cursorPos.y >= _shadowBoxY - 24) && (cursorPos.x <= _shadowBoxX - 5) && (cursorPos.y <= _shadowBoxY - 10)) {
+ _scReturn = true;
+ break;
+ } else if ((cursorPos.x >= _shadowBoxX + 5) && (cursorPos.y >= _shadowBoxY - 24) && (cursorPos.x <= _shadowBoxX + 65) && (cursorPos.y <= _shadowBoxY - 10)) {
+ _scReturn = false;
+ break;
+ }
+ }
+ }
+
+ _vm->_graphics->_surface.copyFrom(temp);
+ temp.free();
}
void Dialogs::store(byte what, TuneType &played) {
@@ -457,14 +509,11 @@ void Dialogs::drawScroll(DialogFunctionType modeFunc) {
_vm->_avalot->_scroll[i].deleteLastChar();
break;
case kControlQuestion:
- //settextjustify(1, 1);
_shadowBoxX = mx + lx;
_shadowBoxY = my + ly;
_vm->_avalot->_scroll[i].setChar(' ', 0);
- // byte groi = *_vm->_graphics->getPixel(0, 0);
- // inc(diy,14);
- _vm->_avalot->drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes.");
- _vm->_avalot->drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No.");
+ drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes.");
+ drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No.");
break;
}
@@ -561,11 +610,6 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) {
resetScrollDriver();
}
-bool Dialogs::displayQuestion(Common::String question) {
- warning("STUB: Scrolls::displayQuestion()");
- return true;
-}
-
void Dialogs::reset() {
_vm->_avalot->_scrollNum = 1;
for (int i = 0; i < 15; i++) {
@@ -628,7 +672,7 @@ void Dialogs::callDialogDriver() {
_vm->_sound->stopSound();
setReadyLight(0);
- _vm->_avalot->_scReturn = false;
+ _scReturn = false;
bool mouthnext = false;
bool call_spriterun = true; // Only call sprite_run the FIRST time.
@@ -670,7 +714,7 @@ void Dialogs::callDialogDriver() {
reset();
- if (_vm->_avalot->_scReturn)
+ if (_scReturn)
return;
break;
case kControlBell:
@@ -712,7 +756,7 @@ void Dialogs::callDialogDriver() {
reset();
- if (_vm->_avalot->_scReturn)
+ if (_scReturn)
return;
break;
@@ -809,6 +853,12 @@ void Dialogs::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A
callDialogDriver();
}
+bool Dialogs::displayQuestion(Common::String question) {
+ displayText(question + kControlNewLine + kControlQuestion);
+ warning("STUB: Dialogs::displayQuestion()");
+ return _scReturn;
+}
+
void Dialogs::loadFont() {
Common::File file;
diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h
index 9cb4470959..d754eb1672 100644
--- a/engines/avalanche/dialogs.h
+++ b/engines/avalanche/dialogs.h
@@ -97,10 +97,15 @@ private:
Common::Point _dodgeCoord;
byte _param; // For using arguments code
byte _useIcon;
+ bool _scReturn;
- // These 3 functions are always passed as ScrollsFunctionType parameters.
+ // These 3 "Mode" functions are always passed as ScrollsFunctionType parameters.
void scrollModeNormal();
+ // The "asking" scroll. Used indirectly in diplayQuestion().
+ void drawShadow(int16 x1, int16 y1, int16 x2, int16 y2);
+ void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text);
void scrollModeDialogue();
+ // Part of the harp mini-game.
void scrollModeMusic();
// These 2 are used only in musicalScroll().