aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2010-07-22 22:04:40 +0000
committerFilippos Karapetis2010-07-22 22:04:40 +0000
commita9414ebb08feea0353ab32b97f5e1234f232f302 (patch)
tree32d3d2e8924e44d0ba02836e53edd106b956e10d /engines/sci
parent7fb37db81ea56f35251a189ace9dcee964d74c36 (diff)
downloadscummvm-rg350-a9414ebb08feea0353ab32b97f5e1234f232f302.tar.gz
scummvm-rg350-a9414ebb08feea0353ab32b97f5e1234f232f302.tar.bz2
scummvm-rg350-a9414ebb08feea0353ab32b97f5e1234f232f302.zip
SCI: Some slight work on robot files
svn-id: r51176
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kgraphics.cpp5
-rw-r--r--engines/sci/graphics/robot.cpp33
-rw-r--r--engines/sci/graphics/robot.h1
3 files changed, 31 insertions, 8 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 299a4f5c81..bea91d7bf3 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -44,6 +44,7 @@
#include "sci/graphics/palette.h"
#include "sci/graphics/paint16.h"
#include "sci/graphics/ports.h"
+#include "sci/graphics/robot.h"
#include "sci/graphics/screen.h"
#include "sci/graphics/text16.h"
#include "sci/graphics/view.h"
@@ -1318,6 +1319,10 @@ reg_t kRobot(EngineState *s, int argc, reg_t *argv) {
int16 x = argv[4].toUint16();
int16 y = argv[5].toUint16();
warning("kRobot(init), id %d, obj %04x:%04x, flag %d, x=%d, y=%d", id, PRINT_REG(obj), flag, x, y);
+ GfxRobot *test = new GfxRobot(g_sci->getResMan(), g_sci->_gfxScreen, id);
+ test->draw();
+ delete test;
+
}
break;
case 1: // LSL6 hires (startup)
diff --git a/engines/sci/graphics/robot.cpp b/engines/sci/graphics/robot.cpp
index d926e037f4..352dc8177c 100644
--- a/engines/sci/graphics/robot.cpp
+++ b/engines/sci/graphics/robot.cpp
@@ -28,6 +28,8 @@
#include "sci/graphics/screen.h"
#include "sci/graphics/robot.h"
+#include "common/file.h"
+
namespace Sci {
#ifdef ENABLE_SCI32
@@ -38,15 +40,29 @@ GfxRobot::GfxRobot(ResourceManager *resMan, GfxScreen *screen, GuiResourceId res
}
GfxRobot::~GfxRobot() {
- _resMan->unlockResource(_resource);
+ delete[] _resourceData;
}
void GfxRobot::initData(GuiResourceId resourceId) {
- _resource = _resMan->findResource(ResourceId(kResourceTypeRobot, resourceId), true);
- if (!_resource) {
- error("robot resource %d not found", resourceId);
+ char fileName[10];
+ sprintf(fileName, "%d.rbt", resourceId);
+
+ Common::File robotFile;
+ if (robotFile.open(fileName)) {
+ _resourceData = new byte[robotFile.size()];
+ robotFile.read(_resourceData, robotFile.size());
+ robotFile.close();
+ } else {
+ warning("Unable to open robot file %s", fileName);
+ return;
+ }
+
+ byte version = _resourceData[6];
+
+ if (version != 4 && version != 5) {
+ warning("Robot version %d isn't supported yet", version);
+ return;
}
- _resourceData = _resource->data;
// sample data:
// Header - 14 bytes
@@ -152,8 +168,11 @@ void GfxRobot::initData(GuiResourceId resourceId) {
// ^ ??
// 00000120: 70 70 70 70 70 70 70 70-70 70 70 70 70 70 70 70 pppppppppppppppp
- _frameCount = READ_LE_UINT16(_resourceData + 12);
- _frameSize = READ_LE_UINT32(_resourceData + 34);
+ _frameCount = READ_LE_UINT16(_resourceData + 14);
+ //_frameSize = READ_LE_UINT32(_resourceData + 34);
+ byte hasSound = _resourceData[25];
+
+ debug("Robot %d, %d frames, sound: %d\n", resourceId, _frameCount, hasSound);
}
// TODO: just trying around in here...
diff --git a/engines/sci/graphics/robot.h b/engines/sci/graphics/robot.h
index 80dae95f95..3ea9a7f735 100644
--- a/engines/sci/graphics/robot.h
+++ b/engines/sci/graphics/robot.h
@@ -45,7 +45,6 @@ private:
GfxScreen *_screen;
GuiResourceId _resourceId;
- Resource *_resource;
byte *_resourceData;
uint16 _width;