ASYLUM: Reverted to r11, then re-applied updates
git-svn-id: http://asylumengine.googlecode.com/svn/trunk@13 0bfb4aae-4ea4-11de-8d8d-752d95cf3e3c
This commit is contained in:
parent
faaf87aea9
commit
2285907cd1
6 changed files with 107 additions and 92 deletions
|
@ -25,33 +25,47 @@
|
|||
#include "common/file.h"
|
||||
|
||||
#include "asylum/asylum.h"
|
||||
#include "asylum/screen.h"
|
||||
#include "asylum/resource.h"
|
||||
#include "asylum/graphics.h"
|
||||
|
||||
namespace Asylum {
|
||||
|
||||
AsylumEngine::AsylumEngine( OSystem *system, Common::Language language )
|
||||
: Engine( system ) {
|
||||
AsylumEngine::AsylumEngine(OSystem *system, Common::Language language)
|
||||
: Engine(system) {
|
||||
|
||||
Common::File::addDefaultDirectory( _gameDataDir.getChild("Data") );
|
||||
Common::File::addDefaultDirectory( _gameDataDir.getChild("Vids") );
|
||||
Common::File::addDefaultDirectory(_gameDataDir.getChild("Data"));
|
||||
Common::File::addDefaultDirectory(_gameDataDir.getChild("Vids"));
|
||||
|
||||
_eventMan->registerRandomSource( _rnd, "asylum");
|
||||
_eventMan->registerRandomSource(_rnd, "asylum");
|
||||
}
|
||||
|
||||
AsylumEngine::~AsylumEngine() {
|
||||
//Common::clearAllDebugChannels();
|
||||
delete _screen;
|
||||
}
|
||||
|
||||
Common::Error AsylumEngine::run() {
|
||||
initGraphics( 640, 480, true );
|
||||
Common::Error err;
|
||||
err = init();
|
||||
if (err != Common::kNoError)
|
||||
return err;
|
||||
return go();
|
||||
}
|
||||
|
||||
Common::Error AsylumEngine::init() {
|
||||
_screen = new Screen(_system);
|
||||
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
Common::Error AsylumEngine::go() {
|
||||
Resource* res = new Resource;
|
||||
|
||||
res->load( "res.001" );
|
||||
res->load("res.001");
|
||||
res->dump();
|
||||
|
||||
GraphicResource *gres = new GraphicResource( res->getResource(23) );
|
||||
GraphicResource *gres = new GraphicResource( res->getResource(0) );
|
||||
gres->dump();
|
||||
|
||||
|
||||
|
|
|
@ -24,8 +24,11 @@
|
|||
|
||||
#include "engines/engine.h"
|
||||
|
||||
|
||||
namespace Asylum {
|
||||
|
||||
class Screen;
|
||||
|
||||
class AsylumEngine: public Engine {
|
||||
public:
|
||||
|
||||
|
@ -33,11 +36,15 @@ public:
|
|||
virtual ~AsylumEngine();
|
||||
|
||||
// Engine APIs
|
||||
Common::Error init();
|
||||
Common::Error go();
|
||||
virtual Common::Error run();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
private:
|
||||
Common::Language _language;
|
||||
Common::RandomSource _rnd;
|
||||
|
||||
Screen *_screen;
|
||||
};
|
||||
|
||||
} // namespace Asylum
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "asylum/graphics.h"
|
||||
#include "asylum/utils.h"
|
||||
|
||||
#include "common/endian.h"
|
||||
#include "common/file.h"
|
||||
#include "common/stream.h"
|
||||
|
||||
|
@ -31,35 +32,26 @@ GraphicResource::GraphicResource( ResourceItem item )
|
|||
{
|
||||
int pos = 0;
|
||||
|
||||
_packSize = item.size;
|
||||
|
||||
// DEBUG
|
||||
// This logic is somewhat flawed, as the Flag value is
|
||||
// getting the tag value, and the tag value is getting
|
||||
// junk data, but the rest seems to be correct.
|
||||
// Since this is still a test though, it'll likely
|
||||
// be re-written at some point
|
||||
|
||||
_tagValue = read32( item.data, pos );
|
||||
_flag = read32( item.data, pos );
|
||||
_contentOffset = read32( item.data, pos );
|
||||
_unknown1 = read32( item.data, pos );
|
||||
_unknown2 = read32( item.data, pos );
|
||||
_unknown3 = read32( item.data, pos );
|
||||
_numEntries = read16( item.data, pos );
|
||||
_maxWidthSize = read16( item.data, pos );
|
||||
_tagValue = READ_UINT32( item.data + pos ); pos += 4;
|
||||
_flag = READ_UINT32( item.data + pos ); pos += 4;
|
||||
_contentOffset = READ_UINT32( item.data + pos ); pos += 4;
|
||||
_unknown1 = READ_UINT32( item.data + pos ); pos += 4;
|
||||
_unknown2 = READ_UINT32( item.data + pos ); pos += 4;
|
||||
_unknown3 = READ_UINT32( item.data + pos ); pos += 4;
|
||||
_numEntries = READ_UINT16( item.data + pos ); pos += 2;
|
||||
_maxWidthSize = READ_UINT16( item.data + pos ); pos += 2;
|
||||
|
||||
Common::Array<uint32> offsets;
|
||||
|
||||
// read the individual asset offsets
|
||||
for( int i = 0; i < _numEntries; i++ ){
|
||||
offsets.push_back( read32(item.data, pos) );
|
||||
offsets.push_back( READ_UINT32(item.data + pos) ); pos += 4;
|
||||
}
|
||||
|
||||
for( int i = 0; i < _numEntries; i++ ){
|
||||
GraphicAsset* gra = new GraphicAsset;
|
||||
|
||||
uint32 size;
|
||||
uint32 size = 0;
|
||||
|
||||
// Allocate size based on offset differences
|
||||
// TODO
|
||||
|
@ -67,7 +59,7 @@ GraphicResource::GraphicResource( ResourceItem item )
|
|||
if( i < _numEntries - 1 ){
|
||||
size = offsets[i + 1] - offsets[i];
|
||||
}else{
|
||||
size = _packSize - offsets[i];
|
||||
size = item.size - offsets[i];
|
||||
}
|
||||
|
||||
gra->size = size;
|
||||
|
@ -78,11 +70,11 @@ GraphicResource::GraphicResource( ResourceItem item )
|
|||
}
|
||||
|
||||
int entryPos = 0;
|
||||
gra->flag = read32( gra->data, entryPos );
|
||||
gra->x = read16( gra->data, entryPos );
|
||||
gra->y = read16( gra->data, entryPos );
|
||||
gra->width = read16( gra->data, entryPos );
|
||||
gra->height = read16( gra->data, entryPos );
|
||||
gra->flag = READ_UINT32( gra->data + entryPos ); entryPos += 4;
|
||||
gra->x = READ_UINT16( gra->data + entryPos ); entryPos += 2;
|
||||
gra->y = READ_UINT16( gra->data + entryPos ); entryPos += 2;
|
||||
gra->width = READ_UINT16( gra->data + entryPos ); entryPos += 2;
|
||||
gra->height = READ_UINT16( gra->data + entryPos );
|
||||
|
||||
_items.push_back( *gra );
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ public:
|
|||
|
||||
private:
|
||||
Common::String _filename;
|
||||
uint32 _packSize;
|
||||
uint32 _tagValue;
|
||||
uint32 _flag;
|
||||
uint32 _contentOffset;
|
||||
|
@ -49,6 +48,7 @@ private:
|
|||
uint32 _unknown3;
|
||||
uint16 _numEntries;
|
||||
uint16 _maxWidthSize;
|
||||
|
||||
Common::Array<GraphicAsset> _items;
|
||||
|
||||
}; // end of class GraphicResource
|
||||
|
|
|
@ -4,7 +4,8 @@ MODULE_OBJS := \
|
|||
detection.o \
|
||||
graphics.o \
|
||||
resource.o \
|
||||
asylum.o
|
||||
asylum.o \
|
||||
screen.o
|
||||
|
||||
# This module can be built as a plugin
|
||||
ifeq ($(ENABLE_ASYLUM), DYNAMIC_PLUGIN)
|
||||
|
|
|
@ -119,9 +119,8 @@ uint32 Resource::getNextValidOffset( uint8 startPos )
|
|||
|
||||
ResourceItem Resource::getResource( uint32 pos )
|
||||
{
|
||||
if( pos >= 0 && pos < _size ){
|
||||
// TODO bounds check the array accessor
|
||||
return _items[pos];
|
||||
}
|
||||
}
|
||||
|
||||
void Resource::dump()
|
||||
|
@ -152,6 +151,8 @@ int ResourceItem::save( Common::String filename )
|
|||
fd = fopen( filename.c_str(), "wb+" );
|
||||
fwrite( data, size, 1, fd );
|
||||
fclose( fd );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // end of namespace Asylum
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue