aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cge2/cge2.cpp2
-rw-r--r--engines/cge2/cge2.h5
-rw-r--r--engines/cge2/cge2_main.cpp16
-rw-r--r--engines/cge2/sound.cpp3
-rw-r--r--engines/cge2/vga13h.cpp10
5 files changed, 28 insertions, 8 deletions
diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp
index 9e1e30a109..6976a6fc82 100644
--- a/engines/cge2/cge2.cpp
+++ b/engines/cge2/cge2.cpp
@@ -96,6 +96,8 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
_sayCap = true;
_sayVox = true;
_req = 1;
+ _midiNotify = nullptr;
+ _spriteNotify = nullptr;
}
void CGE2Engine::init() {
diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h
index 130b1bac08..c569bf9458 100644
--- a/engines/cge2/cge2.h
+++ b/engines/cge2/cge2.h
@@ -113,6 +113,8 @@ enum Action { kNear, kMTake, kFTake, kActions };
enum ColorBank { kCBRel, kCBStd, kCBSay, kCBInf, kCBMnu, kCBWar };
+typedef void (CGE2Engine::*NotifyFunctionType)();
+
class CGE2Engine : public Engine {
private:
uint32 _lastFrame, _lastTick;
@@ -170,6 +172,7 @@ public:
Sprite *spriteAt(V2D pos);
void keyClick();
void swapInPocket(Sprite *spr, Sprite *xspr);
+ void busyStep();
void optionTouch(int opt, uint16 mask);
void switchColorMode();
@@ -262,6 +265,8 @@ public:
bool _sayCap;
bool _sayVox;
int _req;
+ NotifyFunctionType _midiNotify;
+ NotifyFunctionType _spriteNotify;
ResourceManager *_resman;
Vga *_vga;
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index 34e7cfe50f..797dbe22d1 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -648,7 +648,21 @@ void CGE2Engine::selectPocket(int n) {
}
void CGE2Engine::busy(bool on) {
- warning("STUB: CGE2Engine::busy()");
+ if (on) {
+ _spriteNotify = _midiNotify = &CGE2::CGE2Engine::busyStep;
+ busyStep();
+ } else {
+ if (_busyPtr)
+ _busyPtr->step(0);
+ _spriteNotify = _midiNotify = nullptr;
+ }
+}
+
+void CGE2Engine::busyStep() {
+ if (_busyPtr) {
+ _busyPtr->step((_busyPtr->_seqPtr) ? -1 : 1);
+ _busyPtr->show(0);
+ }
}
void CGE2Engine::runGame() {
diff --git a/engines/cge2/sound.cpp b/engines/cge2/sound.cpp
index c657a37e46..652907b37d 100644
--- a/engines/cge2/sound.cpp
+++ b/engines/cge2/sound.cpp
@@ -190,7 +190,8 @@ void MusicPlayer::killMidi() {
}
void MusicPlayer::loadMidi(int ref) {
- warning("STUB: MusicPlayer::loadMidi()"); // if (MidiNotify) MidiNotify();
+ if (_vm->_midiNotify != nullptr)
+ (_vm->*_vm->_midiNotify)();
// Work out the filename and check the given MIDI file exists
Common::String filename = Common::String::format("%.2dSG%.2d.MID", ref >> 8, ref & 0xFF);
diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp
index 24376d91bb..1c48a96210 100644
--- a/engines/cge2/vga13h.cpp
+++ b/engines/cge2/vga13h.cpp
@@ -56,8 +56,6 @@ Seq *getConstantSeq(bool seqFlag) {
return seq;
}
-void (*Sprite::notify)() = nullptr;
-
byte Sprite::_constY = 0;
byte Sprite::_follow = 0;
@@ -249,8 +247,8 @@ Sprite *Sprite::expand() {
if (_ext)
return this;
- if (notify != nullptr)
- notify();
+ if (_vm->_spriteNotify != nullptr)
+ (_vm->*_vm->_spriteNotify)();
_ext = new SprExt(_vm);
assert(_ext != NULL);
@@ -439,8 +437,8 @@ Sprite *Sprite::contract() {
curSeq->_dx = curSeq->_dy = curSeq->_dz = 0;
}
- if (notify)
- notify();
+ if (_vm->_spriteNotify != nullptr)
+ (_vm->*_vm->_spriteNotify)();
if (e->_name) {
delete[] e->_name;