aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2019-04-28 14:50:01 +1000
committerPaul Gilbert2019-04-28 14:50:01 +1000
commit70febd034a6ff16c2945c52198386729a75a68e2 (patch)
tree5d61675bd2634a3a1aa7f80d37b77d0aff7c98f8
parent401b010ef3f488601244129b93a6ea3bf5bc3fb1 (diff)
downloadscummvm-rg350-70febd034a6ff16c2945c52198386729a75a68e2.tar.gz
scummvm-rg350-70febd034a6ff16c2945c52198386729a75a68e2.tar.bz2
scummvm-rg350-70febd034a6ff16c2945c52198386729a75a68e2.zip
GLK: Add gli registration for other object types
-rw-r--r--engines/glk/sound.cpp7
-rw-r--r--engines/glk/streams.cpp7
-rw-r--r--engines/glk/windows.cpp4
3 files changed, 13 insertions, 5 deletions
diff --git a/engines/glk/sound.cpp b/engines/glk/sound.cpp
index 70c33c27da..4f56ee2add 100644
--- a/engines/glk/sound.cpp
+++ b/engines/glk/sound.cpp
@@ -75,13 +75,16 @@ void Sounds::poll() {
SoundChannel::SoundChannel(Sounds *owner) : _owner(owner), _soundNum(0),
_rock(0), _notify(0) {
- _dispRock.num = 0;
- _dispRock.ptr = nullptr;
+ if (g_vm->gli_register_obj)
+ _dispRock = (*g_vm->gli_register_obj)(this, gidisp_Class_Schannel);
}
SoundChannel::~SoundChannel() {
stop();
_owner->removeSound(this);
+
+ if (g_vm->gli_unregister_obj)
+ (*g_vm->gli_unregister_obj)(this, gidisp_Class_Schannel, _dispRock);
}
uint SoundChannel::play(uint soundNum, uint repeats, uint notify) {
diff --git a/engines/glk/streams.cpp b/engines/glk/streams.cpp
index 8b1a11d354..b124e30ec9 100644
--- a/engines/glk/streams.cpp
+++ b/engines/glk/streams.cpp
@@ -36,12 +36,15 @@ namespace Glk {
Stream::Stream(Streams *streams, bool readable, bool writable, uint rock, bool unicode) :
_streams(streams), _readable(readable), _writable(writable), _rock(0), _unicode(unicode),
_readCount(0), _writeCount(0), _prev(nullptr), _next(nullptr) {
- _dispRock.num = 0;
- _dispRock.ptr = nullptr;
+ if (g_vm->gli_register_obj)
+ _dispRock = (*g_vm->gli_register_obj)(this, gidisp_Class_Stream);
}
Stream::~Stream() {
_streams->removeStream(this);
+
+ if (g_vm->gli_unregister_obj)
+ (*g_vm->gli_unregister_obj)(this, gidisp_Class_Stream, _dispRock);
}
Stream *Stream::getNext(uint *rock) const {
diff --git a/engines/glk/windows.cpp b/engines/glk/windows.cpp
index d01f9defa3..ffb1fbf906 100644
--- a/engines/glk/windows.cpp
+++ b/engines/glk/windows.cpp
@@ -517,10 +517,12 @@ Window::Window(Windows *windows, uint rock) : _windows(windows), _rock(rock),
_bgColor = g_conf->_windowColor;
_fgColor = g_conf->_propInfo._moreColor;
- _dispRock.num = 0;
Streams &streams = *g_vm->_streams;
_stream = streams.openWindowStream(this);
+
+ if (g_vm->gli_register_obj)
+ _dispRock = (*g_vm->gli_register_obj)(this, gidisp_Class_Window);
}
Window::~Window() {