aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/scene.cpp
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/sherlock/scene.cpp
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/sherlock/scene.cpp')
-rw-r--r--engines/sherlock/scene.cpp112
1 files changed, 72 insertions, 40 deletions
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