mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-23 10:19:27 +00:00
SCI: Some slight work on robot files
svn-id: r51176
This commit is contained in:
parent
7fb37db81e
commit
a9414ebb08
@ -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)
|
||||
|
@ -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...
|
||||
|
@ -45,7 +45,6 @@ private:
|
||||
GfxScreen *_screen;
|
||||
|
||||
GuiResourceId _resourceId;
|
||||
Resource *_resource;
|
||||
byte *_resourceData;
|
||||
|
||||
uint16 _width;
|
||||
|
Loading…
Reference in New Issue
Block a user