aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstevenhoefel2017-01-09 09:31:48 +1100
committerEugene Sandulenko2017-01-09 00:00:17 +0100
commit8c3c9df3508bdb18f0b083de93f0e88983660028 (patch)
treef062344c6d9358f4b6a7e6386c345a6a0be50ff6
parent3359ea9c99eba7f7e630a2b8057ec4df55fed83c (diff)
downloadscummvm-rg350-8c3c9df3508bdb18f0b083de93f0e88983660028.tar.gz
scummvm-rg350-8c3c9df3508bdb18f0b083de93f0e88983660028.tar.bz2
scummvm-rg350-8c3c9df3508bdb18f0b083de93f0e88983660028.zip
DIRECTOR: System beep and Mouse Cursors.
-rw-r--r--engines/director/lingo/lingo-builtins.cpp4
-rw-r--r--engines/director/lingo/lingo-funcs.cpp35
-rw-r--r--engines/director/lingo/lingo.h4
-rw-r--r--engines/director/sound.cpp10
-rw-r--r--engines/director/sound.h4
-rw-r--r--graphics/macgui/macwindowmanager.cpp70
-rw-r--r--graphics/macgui/macwindowmanager.h4
7 files changed, 129 insertions, 2 deletions
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 1d93b9ab44..a53601366d 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -615,7 +615,7 @@ void Lingo::b_alert(int nargs) {
void Lingo::b_cursor(int nargs) {
Datum d = g_lingo->pop();
d.toInt();
- warning("STUB: b_cursor(%d)", d.u.i);
+ g_lingo->func_cursor(d.u.i);
}
void Lingo::b_showGlobals(int nargs) {
@@ -767,7 +767,7 @@ void Lingo::b_point(int nargs) {
///////////////////
void Lingo::b_beep(int nargs) {
Datum d = g_lingo->pop();
- warning("STUB: b_beep(%d)", d.u.i);
+ g_lingo->func_beep(d.u.i);
}
void Lingo::b_mci(int nargs) {
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index e22044c1e9..6becd1410d 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -26,6 +26,7 @@
#include "common/util.h"
#include "director/lingo/lingo-gr.h"
#include "director/sound.h"
+#include "graphics/macgui/macwindowmanager.h"
namespace Director {
@@ -210,4 +211,38 @@ void Lingo::func_gotoprevious() {
_vm->_currentScore->gotoprevious();
}
+void Lingo::func_cursor(int c) {
+ if (_cursorOnStack) {
+ //pop cursor
+ _vm->getMacWindowManager()->popCursor();
+ }
+
+ //and then push cursor.
+ switch (c) {
+ case 0:
+ case -1:
+ _vm->getMacWindowManager()->pushArrowCursor();
+ break;
+ case 1:
+ _vm->getMacWindowManager()->pushBeamCursor();
+ break;
+ case 2:
+ _vm->getMacWindowManager()->pushCrossHairCursor();
+ break;
+ case 3:
+ _vm->getMacWindowManager()->pushCrossBarCursor();
+ break;
+ case 4:
+ _vm->getMacWindowManager()->pushWatchCursor();
+ break;
+ }
+
+ warning("STUB: func_cursor(%d)", c);
+}
+
+void Lingo::func_beep(int repeats) {
+ for (int r = 0; r <= repeats; r++)
+ _vm->getSoundManager()->systemBeep();
+}
+
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 5e7242abe6..67ab57ae22 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -401,10 +401,12 @@ public:
void func_mci(Common::String &s);
void func_mciwait(Common::String &s);
+ void func_beep(int repeats);
void func_goto(Datum &frame, Datum &movie);
void func_gotoloop();
void func_gotonext();
void func_gotoprevious();
+ void func_cursor(int c);
public:
void setTheEntity(int entity, Datum &id, int field, Datum &d);
@@ -440,6 +442,8 @@ public:
bool _exitRepeat;
+ bool _cursorOnStack;
+
private:
int parse(const char *code);
void parseMenu(const char *code);
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index 1bd70d257d..0fc1a43666 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -34,6 +34,11 @@ DirectorSound::DirectorSound() {
_sound2 = new Audio::SoundHandle();
_scriptSound = new Audio::SoundHandle();
_mixer = g_system->getMixer();
+
+ _speaker = new Audio::PCSpeaker();
+ _pcSpeakerHandle = new Audio::SoundHandle();
+ _mixer->playStream(Audio::Mixer::kSFXSoundType,
+ _pcSpeakerHandle, _speaker, -1, 50, 0, DisposeAfterUse::NO, true);
}
DirectorSound::~DirectorSound() {
@@ -100,6 +105,11 @@ bool DirectorSound::isChannelActive(uint8 channelID) {
void DirectorSound::stopSound() {
_mixer->stopHandle(*_sound1);
_mixer->stopHandle(*_sound2);
+ _mixer->stopHandle(*_pcSpeakerHandle);
+}
+
+void DirectorSound::systemBeep() {
+ _speaker->play(Audio::PCSpeaker::kWaveFormSquare, 500, 150);
}
} // End of namespace Director
diff --git a/engines/director/sound.h b/engines/director/sound.h
index 0472da0ef7..6a770314a3 100644
--- a/engines/director/sound.h
+++ b/engines/director/sound.h
@@ -22,6 +22,7 @@
#include "audio/audiostream.h"
#include "audio/mixer.h"
+#include "audio/softsynth/pcspk.h"
#ifndef DIRECTOR_SOUND_H
#define DIRECTOR_SOUND_H
@@ -35,6 +36,8 @@ private:
Audio::SoundHandle *_sound2;
Audio::SoundHandle *_scriptSound;
Audio::Mixer *_mixer;
+ Audio::PCSpeaker *_speaker;
+ Audio::SoundHandle *_pcSpeakerHandle;
public:
DirectorSound();
@@ -43,6 +46,7 @@ public:
void playWAV(Common::String filename, uint8 channelID);
void playAIFF(Common::String filename, uint8 channelID);
void playMCI(Audio::AudioStream &stream, uint32 from, uint32 to);
+ void systemBeep();
bool isChannelActive(uint8 channelID);
void stopSound();
};
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 42cab7cf8e..bad4ad3acc 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -88,6 +88,60 @@ static const byte macCursorBeam[] = {
3, 3, 0, 3, 0, 3, 3, 3, 3, 3, 3,
0, 0, 3, 3, 3, 0, 0, 3, 3, 3, 3,
};
+static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0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+ 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+};
+static const byte macCursorCrossBar[] = {
+ 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0,
+ 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0,
+ 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1,
+ 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1,
+ 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1,
+ 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1,
+ 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
MacWindowManager::MacWindowManager() {
_screen = 0;
@@ -327,6 +381,22 @@ void MacWindowManager::pushArrowCursor() {
CursorMan.pushCursor(macCursorArrow, 11, 16, 1, 1, 3);
}
+void MacWindowManager::pushBeamCursor() {
+ CursorMan.pushCursor(macCursorBeam, 11, 16, 1, 1, 3);
+}
+
+void MacWindowManager::pushCrossHairCursor() {
+ CursorMan.pushCursor(macCursorCrossHair, 11, 16, 1, 1, 3);
+}
+
+void MacWindowManager::pushCrossBarCursor() {
+ CursorMan.pushCursor(macCursorCrossBar, 11, 16, 1, 1, 3);
+}
+
+void MacWindowManager::pushWatchCursor() {
+ CursorMan.pushCursor(macCursorWatch, 11, 16, 1, 1, 3);
+}
+
void MacWindowManager::popCursor() {
CursorMan.popCursor();
}
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index 3449ab13c2..9f62403813 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -146,6 +146,10 @@ public:
void drawFilledRoundRect(ManagedSurface *surface, Common::Rect &rect, int arc, int color);
void pushArrowCursor();
+ void pushBeamCursor();
+ void pushCrossHairCursor();
+ void pushCrossBarCursor();
+ void pushWatchCursor();
void popCursor();
public: