aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-05-26 22:05:27 -0400
committerPaul Gilbert2015-05-26 22:05:27 -0400
commit483a72b8b840a9ebbb7009b3dcd20878d0ffad58 (patch)
tree2745e69a24da7b239078fd870e9e65d624f30381 /engines
parent30edd4efb80e203d7315e0fad41989c40dfe68ff (diff)
downloadscummvm-rg350-483a72b8b840a9ebbb7009b3dcd20878d0ffad58.tar.gz
scummvm-rg350-483a72b8b840a9ebbb7009b3dcd20878d0ffad58.tar.bz2
scummvm-rg350-483a72b8b840a9ebbb7009b3dcd20878d0ffad58.zip
SHERLOK: Beginnings of split of doBgAnim logic
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/events.cpp8
-rw-r--r--engines/sherlock/events.h7
-rw-r--r--engines/sherlock/scene.cpp112
-rw-r--r--engines/sherlock/scene.h17
4 files changed, 100 insertions, 44 deletions
diff --git a/engines/sherlock/events.cpp b/engines/sherlock/events.cpp
index c2015079a8..a02a06cafc 100644
--- a/engines/sherlock/events.cpp
+++ b/engines/sherlock/events.cpp
@@ -75,6 +75,14 @@ void Events::setCursor(const Graphics::Surface &src) {
showCursor();
}
+void Events::animateCursorIfNeeded() {
+ if (_cursorId >= WAIT && _cursorId < (WAIT + 3)) {
+ CursorId newId = (WAIT + 2) ? WAIT : (CursorId)((int)_cursorId + 1);
+ setCursor(newId);
+ }
+}
+
+
void Events::showCursor() {
CursorMan.showMouse(true);
}
diff --git a/engines/sherlock/events.h b/engines/sherlock/events.h
index c19a92de8c..b35109fefe 100644
--- a/engines/sherlock/events.h
+++ b/engines/sherlock/events.h
@@ -33,7 +33,7 @@ namespace Sherlock {
#define GAME_FRAME_RATE 60
#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
-enum CursorId { ARROW = 0, MAGNIFY = 1, WAIT = 2, INVALID_CURSOR = -1 };
+enum CursorId { ARROW = 0, MAGNIFY = 1, WAIT = 2, EXIT_ZONES_START = 5, INVALID_CURSOR = -1 };
class SherlockEngine;
@@ -78,6 +78,11 @@ public:
void setCursor(const Graphics::Surface &src);
/**
+ * Animates the mouse cursor if the Wait cursor is showing
+ */
+ void animateCursorIfNeeded();
+
+ /**
* Show the mouse cursor
*/
void showCursor();
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index 63203e1859..41aafff8c3 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -1199,53 +1199,15 @@ int Scene::startCAnim(int cAnimNum, int playRate) {
void Scene::doBgAnim() {
Events &events = *_vm->_events;
- Inventory &inv = *_vm->_inventory;
People &people = *_vm->_people;
Screen &screen = *_vm->_screen;
- Sound &sound = *_vm->_sound;
Talk &talk = *_vm->_talk;
- UserInterface &ui = *_vm->_ui;
-
- screen.setDisplayBounds(Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCENE_HEIGHT));
-
- int cursorId = events.getCursor();
Common::Point mousePos = events.mousePos();
+ events.animateCursorIfNeeded();
+ screen.setDisplayBounds(Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCENE_HEIGHT));
talk._talkToAbort = false;
- // Animate the mouse cursor
- if (cursorId >= WAIT) {
- if (++cursorId > (WAIT + 2))
- cursorId = WAIT;
-
- events.setCursor((CursorId)cursorId);
- }
-
- if (ui._menuMode == LOOK_MODE) {
- if (mousePos.y > CONTROLS_Y1)
- events.setCursor(ARROW);
- else if (mousePos.y < CONTROLS_Y)
- events.setCursor(MAGNIFY);
- }
-
- // Check for setting magnifying glass cursor
- if (ui._menuMode == INV_MODE || ui._menuMode == USE_MODE || ui._menuMode == GIVE_MODE) {
- if (inv._invMode == INVMODE_LOOK) {
- // Only show Magnifying glass cursor if it's not on the inventory command line
- if (mousePos.y < CONTROLS_Y || mousePos.y >(CONTROLS_Y1 + 13))
- events.setCursor(MAGNIFY);
- else
- events.setCursor(ARROW);
- } else {
- events.setCursor(ARROW);
- }
- }
-
- if (sound._diskSoundPlaying && !*sound._soundIsOn) {
- // Loaded sound just finished playing
- sound.freeDigiSound();
- }
-
if (_restoreFlag) {
if (people[AL]._type == CHARACTER)
people[AL].checkSprite();
@@ -1676,8 +1638,48 @@ void ScalpelScene::checkBgShapes() {
}
}
+void ScalpelScene::doBgAnim() {
+ Inventory &inv = *_vm->_inventory;
+ Events &events = *_vm->_events;
+ Sound &sound = *_vm->_sound;
+ UserInterface &ui = *_vm->_ui;
+ Common::Point mousePos = events.mousePos();
+
+ if (ui._menuMode == LOOK_MODE) {
+ if (mousePos.y > CONTROLS_Y1)
+ events.setCursor(ARROW);
+ else if (mousePos.y < CONTROLS_Y)
+ events.setCursor(MAGNIFY);
+ }
+
+ // Check for setting magnifying glass cursor
+ if (ui._menuMode == INV_MODE || ui._menuMode == USE_MODE || ui._menuMode == GIVE_MODE) {
+ if (inv._invMode == INVMODE_LOOK) {
+ // Only show Magnifying glass cursor if it's not on the inventory command line
+ if (mousePos.y < CONTROLS_Y || mousePos.y >(CONTROLS_Y1 + 13))
+ events.setCursor(MAGNIFY);
+ else
+ events.setCursor(ARROW);
+ } else {
+ events.setCursor(ARROW);
+ }
+ }
+
+ if (sound._diskSoundPlaying && !*sound._soundIsOn) {
+ // Loaded sound just finished playing
+ sound.freeDigiSound();
+ }
+
+ // Handle doing the actual drawing
+ Scene::doBgAnim();
+}
+
/*----------------------------------------------------------------*/
+TattooScene::TattooScene(SherlockEngine *vm) : Scene(vm) {
+ _arrowZone = -1;
+}
+
void TattooScene::checkBgShapes() {
People &people = *_vm->_people;
Person &holmes = people._player;
@@ -1705,4 +1707,34 @@ void TattooScene::checkBgShapes() {
}
}
+void TattooScene::doBgAnim() {
+ Events &events = *_vm->_events;
+ UserInterface &ui = *_vm->_ui;
+ Common::Point mousePos = events.mousePos();
+
+ // If we're in Look Mode, make sure the cursor is the magnifying glass
+ if (ui._menuMode == LOOK_MODE && events.getCursor() != MAGNIFY)
+ events.setCursor(MAGNIFY);
+
+ // See if the mouse is over any of the arrow zones, and if so, change the cursor to the correct
+ // arrow cursor indicating the direcetion of the exit
+ if (events.getCursor() == ARROW || events.getCursor() >= EXIT_ZONES_START) {
+ CursorId cursorId = ARROW;
+
+ if (ui._menuMode == STD_MODE && _arrowZone != -1 && _currentScene != 90) {
+ for (uint idx = 0; idx < _exits.size(); ++idx) {
+ Exit &exit = _exits[idx];
+ if (exit.contains(mousePos))
+ cursorId = (CursorId)(exit._image + EXIT_ZONES_START);
+ }
+ }
+
+ events.setCursor(cursorId);
+ }
+
+ // Handle doing the actual drawing
+ _restoreFlag = true;
+ Scene::doBgAnim();
+}
+
} // End of namespace Sherlock
diff --git a/engines/sherlock/scene.h b/engines/sherlock/scene.h
index 50f8f07ef4..2aecdfa3b2 100644
--- a/engines/sherlock/scene.h
+++ b/engines/sherlock/scene.h
@@ -273,9 +273,9 @@ public:
int toggleObject(const Common::String &name);
/**
- * Animate all objects and people.
+ * Draw all objects and characters.
*/
- void doBgAnim();
+ virtual void doBgAnim();
/**
* Attempts to find a background shape within the passed bounds. If found,
@@ -328,11 +328,17 @@ protected:
virtual void checkBgShapes();
public:
ScalpelScene(SherlockEngine *vm) : Scene(vm) {}
+
+ /**
+ * Draw all objects and characters.
+ */
+ virtual void doBgAnim();
};
class TattooScene : public Scene {
private:
CAnimStream _activeCAnim;
+ int _arrowZone;
protected:
/**
* Checks all the background shapes. If a background shape is animating,
@@ -341,7 +347,12 @@ protected:
*/
virtual void checkBgShapes();
public:
- TattooScene(SherlockEngine *vm) : Scene(vm) {}
+ TattooScene(SherlockEngine *vm);
+
+ /**
+ * Draw all objects and characters.
+ */
+ virtual void doBgAnim();
};
} // End of namespace Sherlock