aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/console.cpp19
-rw-r--r--engines/sci/console.h3
-rw-r--r--engines/sci/graphics/gui.cpp6
-rw-r--r--engines/sci/graphics/gui.h2
-rw-r--r--engines/sci/graphics/robot.cpp75
-rw-r--r--engines/sci/graphics/robot.h56
6 files changed, 161 insertions, 0 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index d2e885c0f7..9db6301816 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -111,6 +111,9 @@ Console::Console(SciEngine *vm) : GUI::Debugger() {
DCmd_Register("set_palette", WRAP_METHOD(Console, cmdSetPalette));
DCmd_Register("draw_pic", WRAP_METHOD(Console, cmdDrawPic));
DCmd_Register("draw_cel", WRAP_METHOD(Console, cmdDrawCel));
+#ifdef ENABLE_SCI32
+ DCmd_Register("draw_robot", WRAP_METHOD(Console, cmdDrawRobot));
+#endif
DCmd_Register("undither", WRAP_METHOD(Console, cmdUndither));
DCmd_Register("play_video", WRAP_METHOD(Console, cmdPlayVideo));
// Segments
@@ -1018,6 +1021,22 @@ bool Console::cmdDrawCel(int argc, const char **argv) {
return true;
}
+#ifdef ENABLE_SCI32
+bool Console::cmdDrawRobot(int argc, const char **argv) {
+ if (argc < 2) {
+ DebugPrintf("Draws a frame from a robot resource\n");
+ DebugPrintf("Usage: %s <resourceId>\n", argv[0]);
+ DebugPrintf("where <resourceId> is the id of the robot resource to draw\n");
+ return true;
+ }
+
+ uint16 resourceId = atoi(argv[1]);
+
+ _vm->_gamestate->_gui->drawRobot();
+ return true;
+}
+#endif
+
bool Console::cmdUndither(int argc, const char **argv) {
if (argc != 2) {
DebugPrintf("Enable/disable undithering.\n");
diff --git a/engines/sci/console.h b/engines/sci/console.h
index de3d7e566f..e325db25f1 100644
--- a/engines/sci/console.h
+++ b/engines/sci/console.h
@@ -86,6 +86,9 @@ private:
bool cmdSetPalette(int argc, const char **argv);
bool cmdDrawPic(int argc, const char **argv);
bool cmdDrawCel(int argc, const char **argv);
+#ifdef ENABLE_SCI32
+ bool cmdDrawRobot(int argc, const char **argv);
+#endif
bool cmdUndither(int argc, const char **argv);
bool cmdPlayVideo(int argc, const char **argv);
// Segments
diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp
index 8eb83495fa..8d76ea064d 100644
--- a/engines/sci/graphics/gui.cpp
+++ b/engines/sci/graphics/gui.cpp
@@ -39,6 +39,7 @@
#include "sci/graphics/animate.h"
#include "sci/graphics/controls.h"
#include "sci/graphics/menu.h"
+#include "sci/graphics/robot.h"
#include "sci/graphics/text.h"
#include "sci/graphics/transitions.h"
#include "sci/graphics/view.h"
@@ -919,6 +920,11 @@ void SciGui::frameOut() {
}
}
}
+
+void SciGui::drawRobot() {
+ Robot *test = new Robot(_s->resMan, _screen, 91);
+ test->draw();
+}
#endif
bool SciGui::debugUndither(bool flag) {
diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h
index 293c41da70..6ca800efc2 100644
--- a/engines/sci/graphics/gui.h
+++ b/engines/sci/graphics/gui.h
@@ -161,6 +161,8 @@ public:
virtual void frameOut();
virtual void globalToLocal(int16 *x, int16 *y, reg_t planeObj);
virtual void localToGlobal(int16 *x, int16 *y, reg_t planeObj);
+
+ virtual void drawRobot();
#endif
virtual bool debugUndither(bool flag);
diff --git a/engines/sci/graphics/robot.cpp b/engines/sci/graphics/robot.cpp
new file mode 100644
index 0000000000..e1ba592e64
--- /dev/null
+++ b/engines/sci/graphics/robot.cpp
@@ -0,0 +1,75 @@
+/* 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 "sci/sci.h"
+#include "sci/engine/state.h"
+#include "sci/graphics/gfx.h"
+#include "sci/graphics/screen.h"
+#include "sci/graphics/robot.h"
+
+namespace Sci {
+
+#ifdef ENABLE_SCI32
+Robot::Robot(ResourceManager *resMan, Screen *screen, GuiResourceId resourceId)
+ : _resMan(resMan), _screen(screen), _resourceId(resourceId) {
+ assert(resourceId != -1);
+ initData(resourceId);
+}
+
+Robot::~Robot() {
+ _resMan->unlockResource(_resource);
+}
+
+void Robot::initData(GuiResourceId resourceId) {
+ _resource = _resMan->findResource(ResourceId(kResourceTypeRobot, resourceId), true);
+ if (!_resource) {
+ error("robot resource %d not found", resourceId);
+ }
+ _resourceData = _resource->data;
+
+ _width = READ_LE_UINT16(_resourceData + 10);
+ _height = READ_LE_UINT16(_resourceData + 12);
+}
+
+// TODO: just trying around in here...
+
+void Robot::draw() {
+ byte *bitmapData = _resourceData + 0x48;
+ int x, y;
+ int frame;
+
+ //for (frame = 0; frame < 30; frame++) {
+ for (y = 0; y < _height; y++) {
+ for (x = 0; x < _width; x++) {
+ _screen->putPixel(x, y, SCI_SCREEN_MASK_VISUAL, *bitmapData, 0, 0);
+ bitmapData++;
+ }
+ }
+ //}
+ _screen->copyToScreen();
+}
+#endif
+
+} // End of namespace Sci
diff --git a/engines/sci/graphics/robot.h b/engines/sci/graphics/robot.h
new file mode 100644
index 0000000000..482ce75d40
--- /dev/null
+++ b/engines/sci/graphics/robot.h
@@ -0,0 +1,56 @@
+/* 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 SCI_GRAPHICS_ROBOT_H
+#define SCI_GRAPHICS_ROBOT_H
+
+namespace Sci {
+
+#ifdef ENABLE_SCI32
+class Robot {
+public:
+ Robot(ResourceManager *resMan, Screen *screen, GuiResourceId resourceId);
+ ~Robot();
+
+ void draw();
+
+private:
+ void initData(GuiResourceId resourceId);
+
+ ResourceManager *_resMan;
+ Screen *_screen;
+
+ GuiResourceId _resourceId;
+ Resource *_resource;
+ byte *_resourceData;
+
+ uint16 _width;
+ uint16 _height;
+};
+#endif
+
+} // End of namespace Sci
+
+#endif