mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-05 17:20:30 +00:00
ASYLUM: Fixed compilation. Put code according to ScummVM coding convention. Get reed of utils.h and use common/endian.h from ScummVM common library.
git-svn-id: http://asylumengine.googlecode.com/svn/trunk@8 0bfb4aae-4ea4-11de-8d8d-752d95cf3e3c
This commit is contained in:
parent
0fab2082c9
commit
43f9e6253a
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
#include "asylum/graphics.h"
|
||||
#include "asylum/utils.h"
|
||||
|
||||
#include "common/endian.h"
|
||||
#include "common/file.h"
|
||||
#include "common/stream.h"
|
||||
|
||||
@ -30,14 +30,14 @@ namespace Asylum {
|
||||
GraphicResource::GraphicResource( ResourceItem item )
|
||||
{
|
||||
int pos = 0;
|
||||
_tagValue = read32(item.data, pos);
|
||||
_flag = read32(item.data, pos+=4);
|
||||
_contentOffset = read32(item.data, pos+=4);
|
||||
_unknown1 = read32(item.data, pos+=4);
|
||||
_unknown2 = read32(item.data, pos+=4);
|
||||
_unknown3 = read32(item.data, pos+=4);
|
||||
_numEntries = read32(item.data, pos+=4);
|
||||
_maxWidthSize = read16(item.data, pos+=2);
|
||||
_tagValue = READ_UINT32(item.data);
|
||||
_flag = READ_UINT32(item.data); pos+=4;
|
||||
_contentOffset = READ_UINT32(item.data); pos+=4;
|
||||
_unknown1 = READ_UINT32(item.data); pos+=4;
|
||||
_unknown2 = READ_UINT32(item.data); pos+=4;
|
||||
_unknown3 = READ_UINT32(item.data); pos+=4;
|
||||
_numEntries = READ_UINT32(item.data); pos+=4;
|
||||
_maxWidthSize = READ_UINT16(item.data); pos+=2;
|
||||
}
|
||||
|
||||
GraphicResource::~GraphicResource()
|
||||
|
@ -64,7 +64,7 @@ private:
|
||||
uint8 _width;
|
||||
uint8 _height;
|
||||
uint8 _dataSize; // data block size
|
||||
unsigned char *_data;
|
||||
uint8 *_data;
|
||||
|
||||
}; // end of class GraphicAsset
|
||||
|
||||
|
@ -116,6 +116,7 @@ ResourceItem Resource::getResource( uint32 pos )
|
||||
if( pos >= 0 && pos < _size ){
|
||||
return _items[pos];
|
||||
}
|
||||
return ResourceItem();
|
||||
}
|
||||
|
||||
void Resource::dump()
|
||||
@ -146,6 +147,7 @@ int ResourceItem::save( Common::String filename )
|
||||
fd = fopen(filename.c_str(),"wb+");
|
||||
fwrite( data, size, 1, fd);
|
||||
fclose(fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
} // end of namespace Asylum
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
|
||||
uint32 offset;
|
||||
uint32 size;
|
||||
unsigned char *data;
|
||||
uint8 *data;
|
||||
|
||||
}; // end of class ResourceItem
|
||||
|
||||
|
@ -22,9 +22,12 @@
|
||||
#ifndef ASYLUM_UTILS_H
|
||||
#define ASYLUM_UTILS_H
|
||||
|
||||
#include "common/endian.h"
|
||||
|
||||
|
||||
namespace Asylum {
|
||||
|
||||
uint32 read32( unsigned char *value, int offset )
|
||||
uint32 read32( uint8 *value, int offset )
|
||||
{
|
||||
uint32 val = (byte)value[offset] |
|
||||
(byte)value[offset + 1] << 8 |
|
||||
@ -33,7 +36,7 @@ uint32 read32( unsigned char *value, int offset )
|
||||
return val;
|
||||
}
|
||||
|
||||
uint16 read16( unsigned char *value, int offset )
|
||||
uint16 read16( uint8 *value, int offset )
|
||||
{
|
||||
uint16 val = (byte)value[offset] | (byte)value[offset + 1] << 8;
|
||||
return val;
|
||||
|
Loading…
Reference in New Issue
Block a user