DIRECTOR: System beep and Mouse Cursors.

This commit is contained in:
stevenhoefel 2017-01-09 09:31:48 +11:00 committed by Eugene Sandulenko
parent 3359ea9c99
commit 8c3c9df350
7 changed files with 129 additions and 2 deletions

View File

@ -615,7 +615,7 @@ void Lingo::b_alert(int nargs) {
void Lingo::b_cursor(int nargs) { void Lingo::b_cursor(int nargs) {
Datum d = g_lingo->pop(); Datum d = g_lingo->pop();
d.toInt(); d.toInt();
warning("STUB: b_cursor(%d)", d.u.i); g_lingo->func_cursor(d.u.i);
} }
void Lingo::b_showGlobals(int nargs) { void Lingo::b_showGlobals(int nargs) {
@ -767,7 +767,7 @@ void Lingo::b_point(int nargs) {
/////////////////// ///////////////////
void Lingo::b_beep(int nargs) { void Lingo::b_beep(int nargs) {
Datum d = g_lingo->pop(); 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) { void Lingo::b_mci(int nargs) {

View File

@ -26,6 +26,7 @@
#include "common/util.h" #include "common/util.h"
#include "director/lingo/lingo-gr.h" #include "director/lingo/lingo-gr.h"
#include "director/sound.h" #include "director/sound.h"
#include "graphics/macgui/macwindowmanager.h"
namespace Director { namespace Director {
@ -210,4 +211,38 @@ void Lingo::func_gotoprevious() {
_vm->_currentScore->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();
}
} }

View File

@ -401,10 +401,12 @@ public:
void func_mci(Common::String &s); void func_mci(Common::String &s);
void func_mciwait(Common::String &s); void func_mciwait(Common::String &s);
void func_beep(int repeats);
void func_goto(Datum &frame, Datum &movie); void func_goto(Datum &frame, Datum &movie);
void func_gotoloop(); void func_gotoloop();
void func_gotonext(); void func_gotonext();
void func_gotoprevious(); void func_gotoprevious();
void func_cursor(int c);
public: public:
void setTheEntity(int entity, Datum &id, int field, Datum &d); void setTheEntity(int entity, Datum &id, int field, Datum &d);
@ -440,6 +442,8 @@ public:
bool _exitRepeat; bool _exitRepeat;
bool _cursorOnStack;
private: private:
int parse(const char *code); int parse(const char *code);
void parseMenu(const char *code); void parseMenu(const char *code);

View File

@ -34,6 +34,11 @@ DirectorSound::DirectorSound() {
_sound2 = new Audio::SoundHandle(); _sound2 = new Audio::SoundHandle();
_scriptSound = new Audio::SoundHandle(); _scriptSound = new Audio::SoundHandle();
_mixer = g_system->getMixer(); _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() { DirectorSound::~DirectorSound() {
@ -100,6 +105,11 @@ bool DirectorSound::isChannelActive(uint8 channelID) {
void DirectorSound::stopSound() { void DirectorSound::stopSound() {
_mixer->stopHandle(*_sound1); _mixer->stopHandle(*_sound1);
_mixer->stopHandle(*_sound2); _mixer->stopHandle(*_sound2);
_mixer->stopHandle(*_pcSpeakerHandle);
}
void DirectorSound::systemBeep() {
_speaker->play(Audio::PCSpeaker::kWaveFormSquare, 500, 150);
} }
} // End of namespace Director } // End of namespace Director

View File

@ -22,6 +22,7 @@
#include "audio/audiostream.h" #include "audio/audiostream.h"
#include "audio/mixer.h" #include "audio/mixer.h"
#include "audio/softsynth/pcspk.h"
#ifndef DIRECTOR_SOUND_H #ifndef DIRECTOR_SOUND_H
#define DIRECTOR_SOUND_H #define DIRECTOR_SOUND_H
@ -35,6 +36,8 @@ private:
Audio::SoundHandle *_sound2; Audio::SoundHandle *_sound2;
Audio::SoundHandle *_scriptSound; Audio::SoundHandle *_scriptSound;
Audio::Mixer *_mixer; Audio::Mixer *_mixer;
Audio::PCSpeaker *_speaker;
Audio::SoundHandle *_pcSpeakerHandle;
public: public:
DirectorSound(); DirectorSound();
@ -43,6 +46,7 @@ public:
void playWAV(Common::String filename, uint8 channelID); void playWAV(Common::String filename, uint8 channelID);
void playAIFF(Common::String filename, uint8 channelID); void playAIFF(Common::String filename, uint8 channelID);
void playMCI(Audio::AudioStream &stream, uint32 from, uint32 to); void playMCI(Audio::AudioStream &stream, uint32 from, uint32 to);
void systemBeep();
bool isChannelActive(uint8 channelID); bool isChannelActive(uint8 channelID);
void stopSound(); void stopSound();
}; };

View File

@ -88,6 +88,60 @@ static const byte macCursorBeam[] = {
3, 3, 0, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 0, 3, 3, 3, 3, 3, 3,
0, 0, 3, 3, 3, 0, 0, 3, 3, 3, 3, 0, 0, 3, 3, 3, 0, 0, 3, 3, 3, 3,
}; };
static const byte macCursorCrossHair[] = {
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 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 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() { MacWindowManager::MacWindowManager() {
_screen = 0; _screen = 0;
@ -327,6 +381,22 @@ void MacWindowManager::pushArrowCursor() {
CursorMan.pushCursor(macCursorArrow, 11, 16, 1, 1, 3); 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() { void MacWindowManager::popCursor() {
CursorMan.popCursor(); CursorMan.popCursor();
} }

View File

@ -146,6 +146,10 @@ public:
void drawFilledRoundRect(ManagedSurface *surface, Common::Rect &rect, int arc, int color); void drawFilledRoundRect(ManagedSurface *surface, Common::Rect &rect, int arc, int color);
void pushArrowCursor(); void pushArrowCursor();
void pushBeamCursor();
void pushCrossHairCursor();
void pushCrossBarCursor();
void pushWatchCursor();
void popCursor(); void popCursor();
public: public: