[Scummvm-git-logs] scummvm master -> 58201f765b832f114388daf7a8dff54e9afcc38e
rvanlaar
noreply at scummvm.org
Wed Sep 7 08:57:31 UTC 2022
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
55ba933b76 DIRECTOR: LINGO: XOBJ: Implement MoovXOBJ
58201f765b JANITORIAL: DIRECTOR: fix missing namespace member
Commit: 55ba933b76a2294011463bb23c228965d9e395c5
https://github.com/scummvm/scummvm/commit/55ba933b76a2294011463bb23c228965d9e395c5
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-09-07T10:57:15+02:00
Commit Message:
DIRECTOR: LINGO: XOBJ: Implement MoovXOBJ
The game C.H.A.O.S. Continuum (D3, win) uses an XOBJ to play Quicktime Video.
Implements the methods that are called in game.
In contrast to the documentation the mMovieDone function returns true when the movie is _not_ done. Otherwise movies are disposed of while playing.
The videos don't use sound.
Changed paths:
A engines/director/lingo/xlibs/moovxobj.cpp
A engines/director/lingo/xlibs/moovxobj.h
engines/director/lingo/lingo-object.cpp
engines/director/module.mk
diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index 1ef4123113a..61e80d073ee 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -49,6 +49,7 @@
#include "director/lingo/xlibs/labeldrvxobj.h"
#include "director/lingo/xlibs/memoryxobj.h"
#include "director/lingo/xlibs/miscx.h"
+#include "director/lingo/xlibs/moovxobj.h"
#include "director/lingo/xlibs/movemousexobj.h"
#include "director/lingo/xlibs/movutils.h"
#include "director/lingo/xlibs/orthoplayxobj.h"
@@ -143,6 +144,7 @@ static struct XLibProto {
{ LabelDrvXObj::fileNames, LabelDrvXObj::open, LabelDrvXObj::close, kXObj, 400 }, // D4
{ MemoryXObj::fileNames, MemoryXObj::open, MemoryXObj::close, kXObj, 300 }, // D3
{ MiscX::fileNames, MiscX::open, MiscX::close, kXObj, 400 }, // D4
+ { MoovXObj::fileNames, MoovXObj::open, MoovXObj::close, kXObj, 300 }, // D3
{ MoveMouseXObj::fileNames, MoveMouseXObj::open, MoveMouseXObj::close, kXObj, 400 }, // D4
{ MovUtilsXObj::fileNames, MovUtilsXObj::open, MovUtilsXObj::close, kXObj, 400 }, // D4
{ OrthoPlayXObj::fileNames, OrthoPlayXObj::open, OrthoPlayXObj::close, kXObj, 400 }, // D4
diff --git a/engines/director/lingo/xlibs/moovxobj.cpp b/engines/director/lingo/xlibs/moovxobj.cpp
new file mode 100644
index 00000000000..584559e0980
--- /dev/null
+++ b/engines/director/lingo/xlibs/moovxobj.cpp
@@ -0,0 +1,201 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*************************************
+ *
+ * Xobject to play Quicktime Videos
+ *
+ * USED IN:
+ * C.H.A.O.S. Continuum
+ *
+ *************************************/
+
+/*
+--moovXobj 10.22.93 <<gzr>>
+moovXobj
+I mNew --Creates a new instance of the XObject.
+X mDispose --Disposes of XObject instance.
+S mName --Returns the XObject name (moovobj).
+I mMovieInit --Initialize QTW.
+I mMovieKill --Dispose of QTW.
+I mFondler --Movie idle task.
+ISII mPlayMovie name,left,top --Play movie at designated location.
+I mPauseMovie --Pause active movie.
+II mSoundMovie --Turn movie sound on or off.
+I mStopMovie --Stops active movie.
+I mMovieDone --Returns true if movie done.
+
+ScummVM Note: mMovieDone returns true when the movie is _not_ done.
+
+ */
+
+#include "video/qt_decoder.h"
+
+#include "director/director.h"
+#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-object.h"
+#include "director/lingo/xlibs/moovxobj.h"
+
+
+namespace Director {
+
+const char *MoovXObj::xlibName = "moovxobj";
+const char *MoovXObj::fileNames[] = {
+ "moovxobj",
+ nullptr
+};
+
+static MethodProto xlibMethods[] = {
+ { "new", MoovXObj::m_new, 0, 0, 300 }, // D3
+ { "Dispose", MoovXObj::m_dispose, 0, 0, 300 }, // D3
+ { "Name", MoovXObj::m_name, 0, 0, 300 }, // D4
+ { "MovieInit", MoovXObj::m_movieInit, 0, 0, 300 }, // D4
+ { "MovieKill", MoovXObj::m_movieKill, 0, 0, 300 }, // D4
+ { "Fondler", MoovXObj::m_fondler, 0, 0, 300 }, // D4
+ { "PlayMovie", MoovXObj::m_playMovie, 3, 3, 300 }, // D4
+ { "PauseMovie", MoovXObj::m_pauseMovie, 0, 0, 300 }, // D4
+ { "SoundMovie", MoovXObj::m_soundMovie, 0, 0, 300 }, // D4
+ { "StopMovie", MoovXObj::m_stopMovie, 0, 0, 300 }, // D4
+ { "MovieDone", MoovXObj::m_movieDone, 0, 0, 300 }, // D4
+
+ { nullptr, nullptr, 0, 0, 0 }
+};
+
+void MoovXObj::open(int type) {
+ if (type == kXObj) {
+ MoovXObject::initMethods(xlibMethods);
+ MoovXObject *xobj = new MoovXObject(kXObj);
+ g_lingo->exposeXObject(xlibName, xobj);
+ }
+}
+
+void MoovXObj::close(int type) {
+ if (type == kXObj) {
+ MoovXObject::cleanupMethods();
+ g_lingo->_globalvars[xlibName] = Datum();
+ }
+}
+
+MoovXObject::MoovXObject(ObjectType ObjectType) :Object<MoovXObject>("MoovXObj") {
+ _objType = ObjectType;
+ _video = nullptr;
+ _x = 0;
+ _y = 0;
+}
+
+MoovXObject::~MoovXObject() {
+ if (_video) {
+ delete _video;
+ _video = nullptr;
+ }
+}
+
+void MoovXObj::m_new(int nargs) {
+ g_lingo->push(g_lingo->_currentMe);
+}
+
+void MoovXObj::m_dispose(int nargs) {
+ debug(5, "MoovXObj::m_dispose");
+ MoovXObject *me = static_cast<MoovXObject *>(g_lingo->_currentMe.u.obj);
+ if (me->_video) {
+ delete me->_video;
+ me->_video = nullptr;
+ }
+}
+
+void MoovXObj::m_name(int nargs) {
+ // unused in C.H.A.O.S.
+ g_lingo->printSTUBWithArglist("MoovXObj::m_name", nargs);
+}
+
+void MoovXObj::m_movieInit(int nargs) {
+ // called in C.H.A.O.S. ScummVMs setup happens in playMovie
+ g_lingo->printSTUBWithArglist("MoovXObj::m_movieInit", nargs);
+}
+
+void MoovXObj::m_movieKill(int nargs) {
+ debug(5, "MoovXObj::m_movieKill");
+ MoovXObject *me = static_cast<MoovXObject *>(g_lingo->_currentMe.u.obj);
+
+ if (me->_video)
+ me->_video->stop();
+}
+
+void MoovXObj::m_fondler(int nargs) {
+ MoovXObject *me = static_cast<MoovXObject *>(g_lingo->_currentMe.u.obj);
+
+ debug(5, "MoovXObj::m_fondler");
+ Graphics::Surface const *frame;
+
+ if (me->_video && me->_video->needsUpdate()) {
+ frame = me->_video->decodeNextFrame();
+ if (frame) {
+ g_system->copyRectToScreen(frame->getPixels(), frame->pitch, me->_x, me->_y, frame->w, frame->h);
+ g_system->updateScreen();
+ }
+ }
+}
+
+void MoovXObj::m_playMovie(int nargs) {
+ MoovXObject *me = static_cast<MoovXObject *>(g_lingo->_currentMe.u.obj);
+
+ me->_y = g_lingo->pop().asInt();
+ me->_x = g_lingo->pop().asInt();
+ Common::String filename = g_lingo->pop().asString();
+
+ debug(5, "MoovXObj::m_playMovie: name: %s, x: %i y: %i", filename.c_str(), me->_x, me->_y);
+
+ me->_video = new Video::QuickTimeDecoder();
+ bool result = me->_video->loadFile(Common::Path(filename, g_director->_dirSeparator));
+ if (result && g_director->_pixelformat.bytesPerPixel == 1) {
+ // Director supports playing back RGB and paletted video in 256 colour mode.
+ // In both cases they are dithered to match the Director palette.
+ byte palette[256 * 3];
+ g_system->getPaletteManager()->grabPalette(palette, 0, 256);
+ me->_video->setDitheringPalette(palette);
+ }
+ me->_video->start();
+}
+
+void MoovXObj::m_pauseMovie(int nargs) {
+ // unused in C.H.A.O.S.
+ g_lingo->printSTUBWithArglist("MoovXObj::m_pauseMovie", nargs);
+}
+
+void MoovXObj::m_soundMovie(int nargs) {
+ // unused in C.H.A.O.S.
+ g_lingo->printSTUBWithArglist("MoovXObj::m_soundMovie", nargs);
+}
+
+void MoovXObj::m_stopMovie(int nargs) {
+ // unused in C.H.A.O.S.
+ g_lingo->printSTUBWithArglist("MoovXObj::m_stopMovie", nargs);
+}
+
+void MoovXObj::m_movieDone(int nargs) {
+ MoovXObject *me = static_cast<MoovXObject *>(g_lingo->_currentMe.u.obj);
+ debug(5, "MoovXObj::m_movieDone");
+ bool result = (me->_video && !me->_video->endOfVideo());
+ g_lingo->push(result);
+}
+
+}
+// End of namespace Director
diff --git a/engines/director/lingo/xlibs/moovxobj.h b/engines/director/lingo/xlibs/moovxobj.h
new file mode 100644
index 00000000000..1137c30382c
--- /dev/null
+++ b/engines/director/lingo/xlibs/moovxobj.h
@@ -0,0 +1,66 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef DIRECTOR_LINGO_XLIBS_MOOVXOBJ_H
+#define DIRECTOR_LINGO_XLIBS_MOOVXOBJ_H
+
+namespace Video {
+class QuickTimeDecoder;
+}
+
+namespace Director {
+
+class MoovXObject : public Object<MoovXObject> {
+public:
+ MoovXObject(ObjectType objType);
+ ~MoovXObject();
+
+public:
+ Video::QuickTimeDecoder *_video;
+ int _x;
+ int _y;
+};
+
+namespace MoovXObj {
+
+extern const char *xlibName;
+extern const char *fileNames[];
+
+void open(int type);
+void close(int type);
+
+void m_new(int nargs);
+void m_dispose(int nargs);
+void m_name(int nargs);
+void m_movieInit(int nargs);
+void m_movieKill(int nargs);
+void m_fondler(int nargs);
+void m_playMovie(int nargs);
+void m_pauseMovie(int nargs);
+void m_soundMovie(int nargs);
+void m_stopMovie(int nargs);
+void m_movieDone(int nargs);
+
+} // End of namespace MoovXObj
+
+} // End of namespace Director
+
+#endif
\ No newline at end of file
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 9a967d602d0..ac3b82d902b 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -52,6 +52,7 @@ MODULE_OBJS = \
lingo/xlibs/labeldrvxobj.o \
lingo/xlibs/memoryxobj.o \
lingo/xlibs/miscx.o \
+ lingo/xlibs/moovxobj.o \
lingo/xlibs/movemousexobj.o \
lingo/xlibs/movutils.o \
lingo/xlibs/orthoplayxobj.o \
Commit: 58201f765b832f114388daf7a8dff54e9afcc38e
https://github.com/scummvm/scummvm/commit/58201f765b832f114388daf7a8dff54e9afcc38e
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-09-07T10:57:15+02:00
Commit Message:
JANITORIAL: DIRECTOR: fix missing namespace member
Changed paths:
engines/director/lingo/xlibs/fileio.h
diff --git a/engines/director/lingo/xlibs/fileio.h b/engines/director/lingo/xlibs/fileio.h
index 0f4400d0cb6..941052f585c 100644
--- a/engines/director/lingo/xlibs/fileio.h
+++ b/engines/director/lingo/xlibs/fileio.h
@@ -27,6 +27,7 @@ class SeekableReadStream;
typedef SeekableReadStream InSaveFile;
class OutSaveFile;
class MemoryWriteStreamDynamic;
+class String;
}
namespace Director {
More information about the Scummvm-git-logs
mailing list