[Scummvm-cvs-logs] SF.net SVN: scummvm:[40212] scummvm/trunk/engines/gob
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Thu Apr 30 01:54:29 CEST 2009
Revision: 40212
http://scummvm.svn.sourceforge.net/scummvm/?rev=40212&view=rev
Author: drmccoy
Date: 2009-04-29 23:54:29 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Moving the demo-related stuff into a demos-subdirectory
Modified Paths:
--------------
scummvm/trunk/engines/gob/init.cpp
scummvm/trunk/engines/gob/module.mk
Added Paths:
-----------
scummvm/trunk/engines/gob/demos/
scummvm/trunk/engines/gob/demos/batplayer.cpp
scummvm/trunk/engines/gob/demos/batplayer.h
scummvm/trunk/engines/gob/demos/demoplayer.cpp
scummvm/trunk/engines/gob/demos/demoplayer.h
scummvm/trunk/engines/gob/demos/scnplayer.cpp
scummvm/trunk/engines/gob/demos/scnplayer.h
Removed Paths:
-------------
scummvm/trunk/engines/gob/batplayer.cpp
scummvm/trunk/engines/gob/batplayer.h
scummvm/trunk/engines/gob/demoplayer.cpp
scummvm/trunk/engines/gob/demoplayer.h
scummvm/trunk/engines/gob/scnplayer.cpp
scummvm/trunk/engines/gob/scnplayer.h
Deleted: scummvm/trunk/engines/gob/batplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/batplayer.cpp 2009-04-29 19:58:43 UTC (rev 40211)
+++ scummvm/trunk/engines/gob/batplayer.cpp 2009-04-29 23:54:29 UTC (rev 40212)
@@ -1,84 +0,0 @@
-/* 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/endian.h"
-
-#include "gob/gob.h"
-#include "gob/batplayer.h"
-#include "gob/global.h"
-#include "gob/util.h"
-#include "gob/draw.h"
-#include "gob/inter.h"
-#include "gob/videoplayer.h"
-
-namespace Gob {
-
-BATPlayer::BATPlayer(GobEngine *vm) : DemoPlayer(vm) {
- _doubleMode = false;
-}
-
-BATPlayer::~BATPlayer() {
-}
-
-bool BATPlayer::play(const char *fileName) {
- if (!fileName)
- return false;
-
- debugC(1, kDebugDemo, "Playing BAT \"%s\"", fileName);
-
- init();
-
- Common::File bat;
-
- if (!bat.open(fileName))
- return false;
-
- return play(bat);
-}
-
-bool BATPlayer::play(Common::File &bat) {
- // Iterate over all lines
- while (!bat.err() && !bat.eos()) {
- Common::String line = bat.readLine();
-
- // Interpret
- if (lineStartsWith(line, "slide ")) {
- playVideo(line.c_str() + 6);
- clearScreen();
- }
-
- // Mind user input
- _vm->_util->processInput();
- if (_vm->shouldQuit())
- return true;
- }
-
- if (bat.err())
- return false;
-
- return true;
-}
-
-} // End of namespace Gob
Deleted: scummvm/trunk/engines/gob/batplayer.h
===================================================================
--- scummvm/trunk/engines/gob/batplayer.h 2009-04-29 19:58:43 UTC (rev 40211)
+++ scummvm/trunk/engines/gob/batplayer.h 2009-04-29 23:54:29 UTC (rev 40212)
@@ -1,48 +0,0 @@
-/* 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef GOB_BATPLAYER_H
-#define GOB_BATPLAYER_H
-
-#include "common/file.h"
-
-#include "demoplayer.h"
-
-namespace Gob {
-
-class BATPlayer : public DemoPlayer {
-public:
- BATPlayer(GobEngine *vm);
- virtual ~BATPlayer();
-
- virtual bool play(const char *fileName);
-
-private:
- bool play(Common::File &bat);
-};
-
-} // End of namespace Gob
-
-#endif // GOB_BATPLAYER_H
Deleted: scummvm/trunk/engines/gob/demoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/demoplayer.cpp 2009-04-29 19:58:43 UTC (rev 40211)
+++ scummvm/trunk/engines/gob/demoplayer.cpp 2009-04-29 23:54:29 UTC (rev 40212)
@@ -1,166 +0,0 @@
-/* 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/endian.h"
-
-#include "gob/gob.h"
-#include "gob/demoplayer.h"
-#include "gob/global.h"
-#include "gob/util.h"
-#include "gob/draw.h"
-#include "gob/inter.h"
-#include "gob/videoplayer.h"
-
-namespace Gob {
-
-DemoPlayer::DemoPlayer(GobEngine *vm) : _vm(vm) {
- _doubleMode = false;
-}
-
-DemoPlayer::~DemoPlayer() {
-}
-
-bool DemoPlayer::lineStartsWith(const Common::String &line, const char *start) {
- return (strstr(line.c_str(), start) == line.c_str());
-}
-
-void DemoPlayer::init() {
- // The video player needs some fake variables
- _vm->_inter->allocateVars(32);
-
- // Init the screen
- _vm->_draw->initScreen();
- _vm->_draw->_cursorIndex = -1;
-
- _vm->_util->longDelay(200); // Letting everything settle
-
-}
-
-void DemoPlayer::clearScreen() {
- debugC(1, kDebugDemo, "Clearing the screen");
- _vm->_video->clearScreen();
-}
-
-void DemoPlayer::playVideo(const char *fileName) {
- uint32 waitTime = 0;
- char *file, *filePtr;
-
- file = filePtr = new char[strlen(fileName) + 1];
- strcpy(file, fileName);
-
- // Trimming spaces front
- while (*file == ' ')
- file++;
-
- char *spaceBack = strchr(file, ' ');
- if (spaceBack) {
- char *nextSpace = strchr(spaceBack, ' ');
-
- if (nextSpace)
- *nextSpace = '\0';
-
- *spaceBack++ = '\0';
-
- waitTime = atoi(spaceBack) * 100;
- }
-
- // WORKAROUND: The Inca2 demo wants to play cons2.imd, but that file doesn't exist.
- // cons.imd does, however.
- if ((_vm->getGameType() == kGameTypeInca2) && (!scumm_stricmp(file, "cons2.imd")))
- strcpy(file, "cons.imd");
-
- debugC(1, kDebugDemo, "Playing video \"%s\"", file);
-
- if (_vm->_vidPlayer->primaryOpen(file)) {
- bool videoSupportsDouble =
- ((_vm->_vidPlayer->getFeatures() & CoktelVideo::kFeaturesSupportsDouble) != 0);
-
- if (_doubleMode) {
- if (videoSupportsDouble) {
- _vm->_vidPlayer->slotSetDoubleMode(-1, true);
- playVideoNormal();
- } else
- playVideoDoubled();
- } else
- playVideoNormal();
-
- _vm->_vidPlayer->primaryClose();
-
- if (waitTime > 0)
- _vm->_util->longDelay(waitTime);
- }
-
-
- delete[] filePtr;
-}
-
-void DemoPlayer::playVideoNormal() {
- _vm->_vidPlayer->primaryPlay();
-}
-
-void DemoPlayer::playVideoDoubled() {
- const char *fileNameOpened;
- char *fileName;
-
- fileNameOpened = _vm->_vidPlayer->getFileName();
-
- fileName = new char[strlen(fileNameOpened) + 1];
- strcpy(fileName, fileNameOpened);
-
- _vm->_vidPlayer->primaryClose();
-
- if (_vm->_vidPlayer->primaryOpen(fileName, 0, -1, VideoPlayer::kFlagOtherSurface)) {
- for (int i = 0; i < _vm->_vidPlayer->getFramesCount(); i++) {
- if (_vm->_vidPlayer->primaryPlay(i, i))
- break;
-
- CoktelVideo::State state = _vm->_vidPlayer->getState();
-
- int16 w = state.right - state.left + 1;
- int16 h = state.bottom - state.top + 1;
- int16 wD = (state.left * 2) + (w * 2);
- int16 hD = (state.top * 2) + (h * 2);
-
- _vm->_video->drawSpriteDouble(_vm->_draw->_spritesArray[0], _vm->_draw->_frontSurface,
- state.left, state.top, state.right, state.bottom, state.left, state.top, 0);
- _vm->_draw->dirtiedRect(_vm->_draw->_frontSurface,
- state.left * 2, state.top * 2, wD, hD);
- _vm->_video->retrace();
- }
- }
-
- delete[] fileName;
-}
-
-void DemoPlayer::evaluateVideoMode(const char *mode) {
- debugC(2, kDebugDemo, "Video mode \"%s\"", mode);
-
- if (!scumm_strnicmp(mode, "VESA", 4))
- _doubleMode = false;
- else if (!scumm_strnicmp(mode, "VGA", 3) && _vm->is640())
- _doubleMode = true;
-}
-
-} // End of namespace Gob
Deleted: scummvm/trunk/engines/gob/demoplayer.h
===================================================================
--- scummvm/trunk/engines/gob/demoplayer.h 2009-04-29 19:58:43 UTC (rev 40211)
+++ scummvm/trunk/engines/gob/demoplayer.h 2009-04-29 23:54:29 UTC (rev 40212)
@@ -1,62 +0,0 @@
-/* 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef GOB_DEMOPLAYER_H
-#define GOB_DEMOPLAYER_H
-
-#include "common/file.h"
-#include "common/str.h"
-#include "common/hashmap.h"
-
-namespace Gob {
-
-class GobEngine;
-
-class DemoPlayer {
-public:
- DemoPlayer(GobEngine *vm);
- virtual ~DemoPlayer();
-
- virtual bool play(const char *fileName) = 0;
-
-protected:
- GobEngine *_vm;
- bool _doubleMode;
-
- bool lineStartsWith(const Common::String &line, const char *start);
-
- void init();
-
- void evaluateVideoMode(const char *mode);
- void clearScreen();
- void playVideo(const char *fileName);
-
- void playVideoNormal();
- void playVideoDoubled();
-};
-
-} // End of namespace Gob
-
-#endif // GOB_DEMOPLAYER_H
Property changes on: scummvm/trunk/engines/gob/demos
___________________________________________________________________
Added: svn:ignore
+ .deps
*.o
lib*.a
Copied: scummvm/trunk/engines/gob/demos/batplayer.cpp (from rev 40210, scummvm/trunk/engines/gob/batplayer.cpp)
===================================================================
--- scummvm/trunk/engines/gob/demos/batplayer.cpp (rev 0)
+++ scummvm/trunk/engines/gob/demos/batplayer.cpp 2009-04-29 23:54:29 UTC (rev 40212)
@@ -0,0 +1,84 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/endian.h"
+
+#include "gob/gob.h"
+#include "gob/demos/batplayer.h"
+#include "gob/global.h"
+#include "gob/util.h"
+#include "gob/draw.h"
+#include "gob/inter.h"
+#include "gob/videoplayer.h"
+
+namespace Gob {
+
+BATPlayer::BATPlayer(GobEngine *vm) : DemoPlayer(vm) {
+ _doubleMode = false;
+}
+
+BATPlayer::~BATPlayer() {
+}
+
+bool BATPlayer::play(const char *fileName) {
+ if (!fileName)
+ return false;
+
+ debugC(1, kDebugDemo, "Playing BAT \"%s\"", fileName);
+
+ init();
+
+ Common::File bat;
+
+ if (!bat.open(fileName))
+ return false;
+
+ return play(bat);
+}
+
+bool BATPlayer::play(Common::File &bat) {
+ // Iterate over all lines
+ while (!bat.err() && !bat.eos()) {
+ Common::String line = bat.readLine();
+
+ // Interpret
+ if (lineStartsWith(line, "slide ")) {
+ playVideo(line.c_str() + 6);
+ clearScreen();
+ }
+
+ // Mind user input
+ _vm->_util->processInput();
+ if (_vm->shouldQuit())
+ return true;
+ }
+
+ if (bat.err())
+ return false;
+
+ return true;
+}
+
+} // End of namespace Gob
Copied: scummvm/trunk/engines/gob/demos/batplayer.h (from rev 40210, scummvm/trunk/engines/gob/batplayer.h)
===================================================================
--- scummvm/trunk/engines/gob/demos/batplayer.h (rev 0)
+++ scummvm/trunk/engines/gob/demos/batplayer.h 2009-04-29 23:54:29 UTC (rev 40212)
@@ -0,0 +1,48 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef GOB_BATPLAYER_H
+#define GOB_BATPLAYER_H
+
+#include "common/file.h"
+
+#include "gob/demos/demoplayer.h"
+
+namespace Gob {
+
+class BATPlayer : public DemoPlayer {
+public:
+ BATPlayer(GobEngine *vm);
+ virtual ~BATPlayer();
+
+ virtual bool play(const char *fileName);
+
+private:
+ bool play(Common::File &bat);
+};
+
+} // End of namespace Gob
+
+#endif // GOB_BATPLAYER_H
Copied: scummvm/trunk/engines/gob/demos/demoplayer.cpp (from rev 40211, scummvm/trunk/engines/gob/demoplayer.cpp)
===================================================================
--- scummvm/trunk/engines/gob/demos/demoplayer.cpp (rev 0)
+++ scummvm/trunk/engines/gob/demos/demoplayer.cpp 2009-04-29 23:54:29 UTC (rev 40212)
@@ -0,0 +1,166 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/endian.h"
+
+#include "gob/gob.h"
+#include "gob/demos/demoplayer.h"
+#include "gob/global.h"
+#include "gob/util.h"
+#include "gob/draw.h"
+#include "gob/inter.h"
+#include "gob/videoplayer.h"
+
+namespace Gob {
+
+DemoPlayer::DemoPlayer(GobEngine *vm) : _vm(vm) {
+ _doubleMode = false;
+}
+
+DemoPlayer::~DemoPlayer() {
+}
+
+bool DemoPlayer::lineStartsWith(const Common::String &line, const char *start) {
+ return (strstr(line.c_str(), start) == line.c_str());
+}
+
+void DemoPlayer::init() {
+ // The video player needs some fake variables
+ _vm->_inter->allocateVars(32);
+
+ // Init the screen
+ _vm->_draw->initScreen();
+ _vm->_draw->_cursorIndex = -1;
+
+ _vm->_util->longDelay(200); // Letting everything settle
+
+}
+
+void DemoPlayer::clearScreen() {
+ debugC(1, kDebugDemo, "Clearing the screen");
+ _vm->_video->clearScreen();
+}
+
+void DemoPlayer::playVideo(const char *fileName) {
+ uint32 waitTime = 0;
+ char *file, *filePtr;
+
+ file = filePtr = new char[strlen(fileName) + 1];
+ strcpy(file, fileName);
+
+ // Trimming spaces front
+ while (*file == ' ')
+ file++;
+
+ char *spaceBack = strchr(file, ' ');
+ if (spaceBack) {
+ char *nextSpace = strchr(spaceBack, ' ');
+
+ if (nextSpace)
+ *nextSpace = '\0';
+
+ *spaceBack++ = '\0';
+
+ waitTime = atoi(spaceBack) * 100;
+ }
+
+ // WORKAROUND: The Inca2 demo wants to play cons2.imd, but that file doesn't exist.
+ // cons.imd does, however.
+ if ((_vm->getGameType() == kGameTypeInca2) && (!scumm_stricmp(file, "cons2.imd")))
+ strcpy(file, "cons.imd");
+
+ debugC(1, kDebugDemo, "Playing video \"%s\"", file);
+
+ if (_vm->_vidPlayer->primaryOpen(file)) {
+ bool videoSupportsDouble =
+ ((_vm->_vidPlayer->getFeatures() & CoktelVideo::kFeaturesSupportsDouble) != 0);
+
+ if (_doubleMode) {
+ if (videoSupportsDouble) {
+ _vm->_vidPlayer->slotSetDoubleMode(-1, true);
+ playVideoNormal();
+ } else
+ playVideoDoubled();
+ } else
+ playVideoNormal();
+
+ _vm->_vidPlayer->primaryClose();
+
+ if (waitTime > 0)
+ _vm->_util->longDelay(waitTime);
+ }
+
+
+ delete[] filePtr;
+}
+
+void DemoPlayer::playVideoNormal() {
+ _vm->_vidPlayer->primaryPlay();
+}
+
+void DemoPlayer::playVideoDoubled() {
+ const char *fileNameOpened;
+ char *fileName;
+
+ fileNameOpened = _vm->_vidPlayer->getFileName();
+
+ fileName = new char[strlen(fileNameOpened) + 1];
+ strcpy(fileName, fileNameOpened);
+
+ _vm->_vidPlayer->primaryClose();
+
+ if (_vm->_vidPlayer->primaryOpen(fileName, 0, -1, VideoPlayer::kFlagOtherSurface)) {
+ for (int i = 0; i < _vm->_vidPlayer->getFramesCount(); i++) {
+ if (_vm->_vidPlayer->primaryPlay(i, i))
+ break;
+
+ CoktelVideo::State state = _vm->_vidPlayer->getState();
+
+ int16 w = state.right - state.left + 1;
+ int16 h = state.bottom - state.top + 1;
+ int16 wD = (state.left * 2) + (w * 2);
+ int16 hD = (state.top * 2) + (h * 2);
+
+ _vm->_video->drawSpriteDouble(_vm->_draw->_spritesArray[0], _vm->_draw->_frontSurface,
+ state.left, state.top, state.right, state.bottom, state.left, state.top, 0);
+ _vm->_draw->dirtiedRect(_vm->_draw->_frontSurface,
+ state.left * 2, state.top * 2, wD, hD);
+ _vm->_video->retrace();
+ }
+ }
+
+ delete[] fileName;
+}
+
+void DemoPlayer::evaluateVideoMode(const char *mode) {
+ debugC(2, kDebugDemo, "Video mode \"%s\"", mode);
+
+ if (!scumm_strnicmp(mode, "VESA", 4))
+ _doubleMode = false;
+ else if (!scumm_strnicmp(mode, "VGA", 3) && _vm->is640())
+ _doubleMode = true;
+}
+
+} // End of namespace Gob
Copied: scummvm/trunk/engines/gob/demos/demoplayer.h (from rev 40211, scummvm/trunk/engines/gob/demoplayer.h)
===================================================================
--- scummvm/trunk/engines/gob/demos/demoplayer.h (rev 0)
+++ scummvm/trunk/engines/gob/demos/demoplayer.h 2009-04-29 23:54:29 UTC (rev 40212)
@@ -0,0 +1,62 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef GOB_DEMOPLAYER_H
+#define GOB_DEMOPLAYER_H
+
+#include "common/file.h"
+#include "common/str.h"
+#include "common/hashmap.h"
+
+namespace Gob {
+
+class GobEngine;
+
+class DemoPlayer {
+public:
+ DemoPlayer(GobEngine *vm);
+ virtual ~DemoPlayer();
+
+ virtual bool play(const char *fileName) = 0;
+
+protected:
+ GobEngine *_vm;
+ bool _doubleMode;
+
+ bool lineStartsWith(const Common::String &line, const char *start);
+
+ void init();
+
+ void evaluateVideoMode(const char *mode);
+ void clearScreen();
+ void playVideo(const char *fileName);
+
+ void playVideoNormal();
+ void playVideoDoubled();
+};
+
+} // End of namespace Gob
+
+#endif // GOB_DEMOPLAYER_H
Copied: scummvm/trunk/engines/gob/demos/scnplayer.cpp (from rev 40210, scummvm/trunk/engines/gob/scnplayer.cpp)
===================================================================
--- scummvm/trunk/engines/gob/demos/scnplayer.cpp (rev 0)
+++ scummvm/trunk/engines/gob/demos/scnplayer.cpp 2009-04-29 23:54:29 UTC (rev 40212)
@@ -0,0 +1,131 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/endian.h"
+
+#include "gob/gob.h"
+#include "gob/demos/scnplayer.h"
+#include "gob/global.h"
+#include "gob/util.h"
+#include "gob/draw.h"
+#include "gob/inter.h"
+#include "gob/videoplayer.h"
+
+namespace Gob {
+
+SCNPlayer::SCNPlayer(GobEngine *vm) : DemoPlayer(vm) {
+ _doubleMode = false;
+}
+
+SCNPlayer::~SCNPlayer() {
+}
+
+bool SCNPlayer::play(const char *fileName) {
+ if (!fileName)
+ return false;
+
+ debugC(1, kDebugDemo, "Playing SCN \"%s\"", fileName);
+
+ init();
+
+ Common::File scn;
+
+ if (!scn.open(fileName))
+ return false;
+
+ return play(scn);
+}
+
+bool SCNPlayer::play(Common::File &scn) {
+ // Read labels
+ LabelMap labels;
+ if (!readLabels(scn, labels))
+ return false;
+
+ // Iterate over all lines
+ while (!scn.err() && !scn.eos()) {
+ Common::String line = scn.readLine();
+
+ // Interpret
+ if (line == "CLEAR") {
+ clearScreen();
+ } else if (lineStartsWith(line, "VIDEO:")) {
+ evaluateVideoMode(line.c_str() + 6);
+ } else if (lineStartsWith(line, "IMD_PRELOAD ")) {
+ playVideo(line.c_str() + 12);
+ } else if (lineStartsWith(line, "IMD ")) {
+ playVideo(line.c_str() + 4);
+ } else if (lineStartsWith(line, "GOTO ")) {
+ gotoLabel(scn, labels, line.c_str() + 5);
+ }
+
+ // Mind user input
+ _vm->_util->processInput();
+ if (_vm->shouldQuit())
+ return true;
+ }
+
+ if (scn.err())
+ return false;
+
+ return true;
+}
+
+bool SCNPlayer::readLabels(Common::File &scn, LabelMap &labels) {
+ debugC(1, kDebugDemo, "Reading SCN labels");
+
+ int32 startPos = scn.pos();
+
+ // Iterate over all lines
+ while (!scn.err() && !scn.eos()) {
+ Common::String line = scn.readLine();
+
+ if (lineStartsWith(line, "LABEL ")) {
+ // Label => Add to the hashmap
+ labels.setVal(line.c_str() + 6, scn.pos());
+ debugC(2, kDebugDemo, "Found label \"%s\" (%d)", line.c_str() + 6, scn.pos());
+ }
+ }
+
+ if (scn.err())
+ return false;
+
+ // Seek back
+ if (!scn.seek(startPos))
+ return false;
+
+ return true;
+}
+
+void SCNPlayer::gotoLabel(Common::File &scn, const LabelMap &labels, const char *label) {
+ debugC(2, kDebugDemo, "Jumping to label \"%s\"", label);
+
+ if (!labels.contains(label))
+ return;
+
+ scn.seek(labels.getVal(label));
+}
+
+} // End of namespace Gob
Copied: scummvm/trunk/engines/gob/demos/scnplayer.h (from rev 40210, scummvm/trunk/engines/gob/scnplayer.h)
===================================================================
--- scummvm/trunk/engines/gob/demos/scnplayer.h (rev 0)
+++ scummvm/trunk/engines/gob/demos/scnplayer.h 2009-04-29 23:54:29 UTC (rev 40212)
@@ -0,0 +1,55 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef GOB_SCNPLAYER_H
+#define GOB_SCNPLAYER_H
+
+#include "common/file.h"
+#include "common/str.h"
+#include "common/hashmap.h"
+
+#include "gob/demos/demoplayer.h"
+
+namespace Gob {
+
+class SCNPlayer : public DemoPlayer {
+public:
+ SCNPlayer(GobEngine *vm);
+ virtual ~SCNPlayer();
+
+ virtual bool play(const char *fileName);
+
+private:
+ typedef Common::HashMap<Common::String, int32, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> LabelMap;
+
+ bool play(Common::File &scn);
+ bool readLabels(Common::File &scn, LabelMap &labels);
+
+ void gotoLabel(Common::File &scn, const LabelMap &labels, const char *label);
+};
+
+} // End of namespace Gob
+
+#endif // GOB_SCNPLAYER_H
Modified: scummvm/trunk/engines/gob/init.cpp
===================================================================
--- scummvm/trunk/engines/gob/init.cpp 2009-04-29 19:58:43 UTC (rev 40211)
+++ scummvm/trunk/engines/gob/init.cpp 2009-04-29 23:54:29 UTC (rev 40212)
@@ -36,8 +36,8 @@
#include "gob/inter.h"
#include "gob/video.h"
#include "gob/videoplayer.h"
-#include "gob/scnplayer.h"
-#include "gob/batplayer.h"
+#include "gob/demos/scnplayer.h"
+#include "gob/demos/batplayer.h"
#include "gob/sound/sound.h"
namespace Gob {
Modified: scummvm/trunk/engines/gob/module.mk
===================================================================
--- scummvm/trunk/engines/gob/module.mk 2009-04-29 19:58:43 UTC (rev 40211)
+++ scummvm/trunk/engines/gob/module.mk 2009-04-29 23:54:29 UTC (rev 40212)
@@ -56,15 +56,15 @@
scenery.o \
scenery_v1.o \
scenery_v2.o \
- demoplayer.o \
- scnplayer.o \
- batplayer.o \
util.o \
variables.o \
video.o \
video_v1.o \
video_v2.o \
video_v6.o \
+ demos/demoplayer.o \
+ demos/scnplayer.o \
+ demos/batplayer.o \
sound/sound.o \
sound/sounddesc.o \
sound/pcspeaker.o \
Deleted: scummvm/trunk/engines/gob/scnplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/scnplayer.cpp 2009-04-29 19:58:43 UTC (rev 40211)
+++ scummvm/trunk/engines/gob/scnplayer.cpp 2009-04-29 23:54:29 UTC (rev 40212)
@@ -1,131 +0,0 @@
-/* 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/endian.h"
-
-#include "gob/gob.h"
-#include "gob/scnplayer.h"
-#include "gob/global.h"
-#include "gob/util.h"
-#include "gob/draw.h"
-#include "gob/inter.h"
-#include "gob/videoplayer.h"
-
-namespace Gob {
-
-SCNPlayer::SCNPlayer(GobEngine *vm) : DemoPlayer(vm) {
- _doubleMode = false;
-}
-
-SCNPlayer::~SCNPlayer() {
-}
-
-bool SCNPlayer::play(const char *fileName) {
- if (!fileName)
- return false;
-
- debugC(1, kDebugDemo, "Playing SCN \"%s\"", fileName);
-
- init();
-
- Common::File scn;
-
- if (!scn.open(fileName))
- return false;
-
- return play(scn);
-}
-
-bool SCNPlayer::play(Common::File &scn) {
- // Read labels
- LabelMap labels;
- if (!readLabels(scn, labels))
- return false;
-
- // Iterate over all lines
- while (!scn.err() && !scn.eos()) {
- Common::String line = scn.readLine();
-
- // Interpret
- if (line == "CLEAR") {
- clearScreen();
- } else if (lineStartsWith(line, "VIDEO:")) {
- evaluateVideoMode(line.c_str() + 6);
- } else if (lineStartsWith(line, "IMD_PRELOAD ")) {
- playVideo(line.c_str() + 12);
- } else if (lineStartsWith(line, "IMD ")) {
- playVideo(line.c_str() + 4);
- } else if (lineStartsWith(line, "GOTO ")) {
- gotoLabel(scn, labels, line.c_str() + 5);
- }
-
- // Mind user input
- _vm->_util->processInput();
- if (_vm->shouldQuit())
- return true;
- }
-
- if (scn.err())
- return false;
-
- return true;
-}
-
-bool SCNPlayer::readLabels(Common::File &scn, LabelMap &labels) {
- debugC(1, kDebugDemo, "Reading SCN labels");
-
- int32 startPos = scn.pos();
-
- // Iterate over all lines
- while (!scn.err() && !scn.eos()) {
- Common::String line = scn.readLine();
-
- if (lineStartsWith(line, "LABEL ")) {
- // Label => Add to the hashmap
- labels.setVal(line.c_str() + 6, scn.pos());
- debugC(2, kDebugDemo, "Found label \"%s\" (%d)", line.c_str() + 6, scn.pos());
- }
- }
-
- if (scn.err())
- return false;
-
- // Seek back
- if (!scn.seek(startPos))
- return false;
-
- return true;
-}
-
-void SCNPlayer::gotoLabel(Common::File &scn, const LabelMap &labels, const char *label) {
- debugC(2, kDebugDemo, "Jumping to label \"%s\"", label);
-
- if (!labels.contains(label))
- return;
-
- scn.seek(labels.getVal(label));
-}
-
-} // End of namespace Gob
Deleted: scummvm/trunk/engines/gob/scnplayer.h
===================================================================
--- scummvm/trunk/engines/gob/scnplayer.h 2009-04-29 19:58:43 UTC (rev 40211)
+++ scummvm/trunk/engines/gob/scnplayer.h 2009-04-29 23:54:29 UTC (rev 40212)
@@ -1,55 +0,0 @@
-/* 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef GOB_SCNPLAYER_H
-#define GOB_SCNPLAYER_H
-
-#include "common/file.h"
-#include "common/str.h"
-#include "common/hashmap.h"
-
-#include "demoplayer.h"
-
-namespace Gob {
-
-class SCNPlayer : public DemoPlayer {
-public:
- SCNPlayer(GobEngine *vm);
- virtual ~SCNPlayer();
-
- virtual bool play(const char *fileName);
-
-private:
- typedef Common::HashMap<Common::String, int32, Common::CaseSensitiveString_Hash, Common::CaseSensitiveString_EqualTo> LabelMap;
-
- bool play(Common::File &scn);
- bool readLabels(Common::File &scn, LabelMap &labels);
-
- void gotoLabel(Common::File &scn, const LabelMap &labels, const char *label);
-};
-
-} // End of namespace Gob
-
-#endif // GOB_SCNPLAYER_H
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list