[Scummvm-cvs-logs] SF.net SVN: scummvm:[51176] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Fri Jul 23 00:04:40 CEST 2010
Revision: 51176
http://scummvm.svn.sourceforge.net/scummvm/?rev=51176&view=rev
Author: thebluegr
Date: 2010-07-22 22:04:40 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
SCI: Some slight work on robot files
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kgraphics.cpp
scummvm/trunk/engines/sci/graphics/robot.cpp
scummvm/trunk/engines/sci/graphics/robot.h
Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp 2010-07-22 22:00:46 UTC (rev 51175)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp 2010-07-22 22:04:40 UTC (rev 51176)
@@ -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 @@
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)
Modified: scummvm/trunk/engines/sci/graphics/robot.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/robot.cpp 2010-07-22 22:00:46 UTC (rev 51175)
+++ scummvm/trunk/engines/sci/graphics/robot.cpp 2010-07-22 22:04:40 UTC (rev 51176)
@@ -28,6 +28,8 @@
#include "sci/graphics/screen.h"
#include "sci/graphics/robot.h"
+#include "common/file.h"
+
namespace Sci {
#ifdef ENABLE_SCI32
@@ -38,16 +40,30 @@
}
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;
}
- _resourceData = _resource->data;
+
+ byte version = _resourceData[6];
+ if (version != 4 && version != 5) {
+ warning("Robot version %d isn't supported yet", version);
+ return;
+ }
+
// sample data:
// Header - 14 bytes
// DWORD:Sample Size - 2 needs to be subtracted (??!!)
@@ -152,8 +168,11 @@
// ^ ??
// 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...
Modified: scummvm/trunk/engines/sci/graphics/robot.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/robot.h 2010-07-22 22:00:46 UTC (rev 51175)
+++ scummvm/trunk/engines/sci/graphics/robot.h 2010-07-22 22:04:40 UTC (rev 51176)
@@ -45,7 +45,6 @@
GfxScreen *_screen;
GuiResourceId _resourceId;
- Resource *_resource;
byte *_resourceData;
uint16 _width;
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