diff options
-rw-r--r-- | engines/glk/sound.cpp | 7 | ||||
-rw-r--r-- | engines/glk/streams.cpp | 7 | ||||
-rw-r--r-- | engines/glk/windows.cpp | 4 |
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() { |