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,6 +25,7 @@
|
||||||
#include "common/file.h"
|
#include "common/file.h"
|
||||||
|
|
||||||
#include "asylum/asylum.h"
|
#include "asylum/asylum.h"
|
||||||
|
#include "asylum/screen.h"
|
||||||
#include "asylum/resource.h"
|
#include "asylum/resource.h"
|
||||||
#include "asylum/graphics.h"
|
#include "asylum/graphics.h"
|
||||||
|
|
||||||
|
@ -41,17 +42,30 @@ AsylumEngine::AsylumEngine( OSystem *system, Common::Language language )
|
||||||
|
|
||||||
AsylumEngine::~AsylumEngine() {
|
AsylumEngine::~AsylumEngine() {
|
||||||
//Common::clearAllDebugChannels();
|
//Common::clearAllDebugChannels();
|
||||||
|
delete _screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Error AsylumEngine::run() {
|
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;
|
Resource* res = new Resource;
|
||||||
|
|
||||||
res->load("res.001");
|
res->load("res.001");
|
||||||
res->dump();
|
res->dump();
|
||||||
|
|
||||||
GraphicResource *gres = new GraphicResource( res->getResource(23) );
|
GraphicResource *gres = new GraphicResource( res->getResource(0) );
|
||||||
gres->dump();
|
gres->dump();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,11 @@
|
||||||
|
|
||||||
#include "engines/engine.h"
|
#include "engines/engine.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Asylum {
|
namespace Asylum {
|
||||||
|
|
||||||
|
class Screen;
|
||||||
|
|
||||||
class AsylumEngine: public Engine {
|
class AsylumEngine: public Engine {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -33,11 +36,15 @@ public:
|
||||||
virtual ~AsylumEngine();
|
virtual ~AsylumEngine();
|
||||||
|
|
||||||
// Engine APIs
|
// Engine APIs
|
||||||
|
Common::Error init();
|
||||||
|
Common::Error go();
|
||||||
virtual Common::Error run();
|
virtual Common::Error run();
|
||||||
virtual bool hasFeature(EngineFeature f) const;
|
virtual bool hasFeature(EngineFeature f) const;
|
||||||
private:
|
private:
|
||||||
Common::Language _language;
|
Common::Language _language;
|
||||||
Common::RandomSource _rnd;
|
Common::RandomSource _rnd;
|
||||||
|
|
||||||
|
Screen *_screen;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Asylum
|
} // namespace Asylum
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "asylum/graphics.h"
|
#include "asylum/graphics.h"
|
||||||
#include "asylum/utils.h"
|
#include "asylum/utils.h"
|
||||||
|
|
||||||
|
#include "common/endian.h"
|
||||||
#include "common/file.h"
|
#include "common/file.h"
|
||||||
#include "common/stream.h"
|
#include "common/stream.h"
|
||||||
|
|
||||||
|
@ -31,35 +32,26 @@ GraphicResource::GraphicResource( ResourceItem item )
|
||||||
{
|
{
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
_packSize = item.size;
|
_tagValue = READ_UINT32( item.data + pos ); pos += 4;
|
||||||
|
_flag = READ_UINT32( item.data + pos ); pos += 4;
|
||||||
// DEBUG
|
_contentOffset = READ_UINT32( item.data + pos ); pos += 4;
|
||||||
// This logic is somewhat flawed, as the Flag value is
|
_unknown1 = READ_UINT32( item.data + pos ); pos += 4;
|
||||||
// getting the tag value, and the tag value is getting
|
_unknown2 = READ_UINT32( item.data + pos ); pos += 4;
|
||||||
// junk data, but the rest seems to be correct.
|
_unknown3 = READ_UINT32( item.data + pos ); pos += 4;
|
||||||
// Since this is still a test though, it'll likely
|
_numEntries = READ_UINT16( item.data + pos ); pos += 2;
|
||||||
// be re-written at some point
|
_maxWidthSize = READ_UINT16( item.data + pos ); pos += 2;
|
||||||
|
|
||||||
_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 );
|
|
||||||
|
|
||||||
Common::Array<uint32> offsets;
|
Common::Array<uint32> offsets;
|
||||||
|
|
||||||
// read the individual asset offsets
|
// read the individual asset offsets
|
||||||
for( int i = 0; i < _numEntries; i++ ){
|
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++ ){
|
for( int i = 0; i < _numEntries; i++ ){
|
||||||
GraphicAsset* gra = new GraphicAsset;
|
GraphicAsset* gra = new GraphicAsset;
|
||||||
|
|
||||||
uint32 size;
|
uint32 size = 0;
|
||||||
|
|
||||||
// Allocate size based on offset differences
|
// Allocate size based on offset differences
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -67,7 +59,7 @@ GraphicResource::GraphicResource( ResourceItem item )
|
||||||
if( i < _numEntries - 1 ){
|
if( i < _numEntries - 1 ){
|
||||||
size = offsets[i + 1] - offsets[i];
|
size = offsets[i + 1] - offsets[i];
|
||||||
}else{
|
}else{
|
||||||
size = _packSize - offsets[i];
|
size = item.size - offsets[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
gra->size = size;
|
gra->size = size;
|
||||||
|
@ -78,11 +70,11 @@ GraphicResource::GraphicResource( ResourceItem item )
|
||||||
}
|
}
|
||||||
|
|
||||||
int entryPos = 0;
|
int entryPos = 0;
|
||||||
gra->flag = read32( gra->data, entryPos );
|
gra->flag = READ_UINT32( gra->data + entryPos ); entryPos += 4;
|
||||||
gra->x = read16( gra->data, entryPos );
|
gra->x = READ_UINT16( gra->data + entryPos ); entryPos += 2;
|
||||||
gra->y = read16( gra->data, entryPos );
|
gra->y = READ_UINT16( gra->data + entryPos ); entryPos += 2;
|
||||||
gra->width = read16( gra->data, entryPos );
|
gra->width = READ_UINT16( gra->data + entryPos ); entryPos += 2;
|
||||||
gra->height = read16( gra->data, entryPos );
|
gra->height = READ_UINT16( gra->data + entryPos );
|
||||||
|
|
||||||
_items.push_back( *gra );
|
_items.push_back( *gra );
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Common::String _filename;
|
Common::String _filename;
|
||||||
uint32 _packSize;
|
|
||||||
uint32 _tagValue;
|
uint32 _tagValue;
|
||||||
uint32 _flag;
|
uint32 _flag;
|
||||||
uint32 _contentOffset;
|
uint32 _contentOffset;
|
||||||
|
@ -49,6 +48,7 @@ private:
|
||||||
uint32 _unknown3;
|
uint32 _unknown3;
|
||||||
uint16 _numEntries;
|
uint16 _numEntries;
|
||||||
uint16 _maxWidthSize;
|
uint16 _maxWidthSize;
|
||||||
|
|
||||||
Common::Array<GraphicAsset> _items;
|
Common::Array<GraphicAsset> _items;
|
||||||
|
|
||||||
}; // end of class GraphicResource
|
}; // end of class GraphicResource
|
||||||
|
|
|
@ -4,7 +4,8 @@ MODULE_OBJS := \
|
||||||
detection.o \
|
detection.o \
|
||||||
graphics.o \
|
graphics.o \
|
||||||
resource.o \
|
resource.o \
|
||||||
asylum.o
|
asylum.o \
|
||||||
|
screen.o
|
||||||
|
|
||||||
# This module can be built as a plugin
|
# This module can be built as a plugin
|
||||||
ifeq ($(ENABLE_ASYLUM), DYNAMIC_PLUGIN)
|
ifeq ($(ENABLE_ASYLUM), DYNAMIC_PLUGIN)
|
||||||
|
|
|
@ -119,10 +119,9 @@ uint32 Resource::getNextValidOffset( uint8 startPos )
|
||||||
|
|
||||||
ResourceItem Resource::getResource( uint32 pos )
|
ResourceItem Resource::getResource( uint32 pos )
|
||||||
{
|
{
|
||||||
if( pos >= 0 && pos < _size ){
|
// TODO bounds check the array accessor
|
||||||
return _items[pos];
|
return _items[pos];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Resource::dump()
|
void Resource::dump()
|
||||||
{
|
{
|
||||||
|
@ -152,6 +151,8 @@ int ResourceItem::save( Common::String filename )
|
||||||
fd = fopen( filename.c_str(), "wb+" );
|
fd = fopen( filename.c_str(), "wb+" );
|
||||||
fwrite( data, size, 1, fd );
|
fwrite( data, size, 1, fd );
|
||||||
fclose( fd );
|
fclose( fd );
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of namespace Asylum
|
} // end of namespace Asylum
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue