aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorEugene Sandulenko2004-03-15 01:14:49 +0000
committerEugene Sandulenko2004-03-15 01:14:49 +0000
commit08332ab559f45366e3c965990d7ecf7f6ebc8db7 (patch)
tree0986d70fd541367028ea5ec84c6baef6f591b15f /saga
parent54b9b1ccc71ed3e8de250c8fed942c1d95acc102 (diff)
downloadscummvm-rg350-08332ab559f45366e3c965990d7ecf7f6ebc8db7.tar.gz
scummvm-rg350-08332ab559f45366e3c965990d7ecf7f6ebc8db7.tar.bz2
scummvm-rg350-08332ab559f45366e3c965990d7ecf7f6ebc8db7.zip
Code formatting
svn-id: r13288
Diffstat (limited to 'saga')
-rw-r--r--saga/binread.cpp79
-rw-r--r--saga/gamedesc.cpp91
-rw-r--r--saga/gamedesc.h10
-rw-r--r--saga/resfile.cpp64
-rw-r--r--saga/resfile.h2
5 files changed, 92 insertions, 154 deletions
diff --git a/saga/binread.cpp b/saga/binread.cpp
index 06715dd730..27ca8e8e70 100644
--- a/saga/binread.cpp
+++ b/saga/binread.cpp
@@ -30,7 +30,7 @@ BinReader::BinReader() {
_bufLen = 0;
}
-BinReader::BinReader( const byte *buf, size_t buflen ) {
+BinReader::BinReader(const byte *buf, size_t buflen) {
_buf = buf;
_bufPtr = buf;
_bufEnd = buf + buflen;
@@ -38,29 +38,25 @@ BinReader::BinReader( const byte *buf, size_t buflen ) {
}
BinReader::~BinReader() {
-
}
-void BinReader::setBuf( const byte *buf, size_t buflen )
-{
+void BinReader::setBuf(const byte *buf, size_t buflen) {
_buf = buf;
_bufPtr = buf;
_bufEnd = buf + buflen;
_bufLen = buflen;
}
-void BinReader::skip( size_t skip_ct )
-{
- assert(( _bufPtr + skip_ct ) <= _bufEnd );
+void BinReader::skip(size_t skip_ct) {
+ assert((_bufPtr + skip_ct) <= _bufEnd );
_bufPtr += skip_ct;
}
unsigned int BinReader::readUint16LE() {
+ assert((_bufPtr + 2) <= _bufEnd);
- assert(( _bufPtr + 2 ) <= _bufEnd );
-
- unsigned int u16_le = ((unsigned int)_bufPtr[1] << 8 ) | _bufPtr[0];
+ unsigned int u16_le = ((unsigned int)_bufPtr[1] << 8) | _bufPtr[0];
_bufPtr += 2;
@@ -68,10 +64,9 @@ unsigned int BinReader::readUint16LE() {
}
unsigned int BinReader::readUint16BE() {
+ assert((_bufPtr + 2) <= _bufEnd);
- assert(( _bufPtr + 2 ) <= _bufEnd );
-
- unsigned int u16_be = ((unsigned int)_bufPtr[0] << 8 ) | _bufPtr[1];
+ unsigned int u16_be = ((unsigned int)_bufPtr[0] << 8) | _bufPtr[1];
_bufPtr += 2;
@@ -79,10 +74,9 @@ unsigned int BinReader::readUint16BE() {
}
int BinReader::readSint16LE() {
+ assert((_bufPtr + 2) <= _bufEnd);
- assert(( _bufPtr + 2 ) <= _bufEnd );
-
- unsigned int u16_le = ((unsigned int)_bufPtr[1] << 8 ) | _bufPtr[0];
+ unsigned int u16_le = ((unsigned int)_bufPtr[1] << 8) | _bufPtr[0];
_bufPtr += 2;
@@ -90,10 +84,9 @@ int BinReader::readSint16LE() {
}
int BinReader::readSint16BE() {
+ assert((_bufPtr + 2) <= _bufEnd);
- assert(( _bufPtr + 2 ) <= _bufEnd );
-
- unsigned int u16_be = ((unsigned int)_bufPtr[0] << 8 ) | _bufPtr[1];
+ unsigned int u16_be = ((unsigned int)_bufPtr[0] << 8) | _bufPtr[1];
_bufPtr += 2;
@@ -101,14 +94,12 @@ int BinReader::readSint16BE() {
}
-uint32 BinReader::readUint32LE()
-{
+uint32 BinReader::readUint32LE() {
+ assert((_bufPtr + 4) <= _bufEnd);
- assert(( _bufPtr + 4 ) <= _bufEnd );
-
- unsigned long u32_le = ((unsigned long)_bufPtr[3] << 24 ) |
- ((unsigned long)_bufPtr[2] << 16 ) |
- ((unsigned long)_bufPtr[1] << 8 ) |
+ unsigned long u32_le = ((unsigned long)_bufPtr[3] << 24) |
+ ((unsigned long)_bufPtr[2] << 16) |
+ ((unsigned long)_bufPtr[1] << 8 ) |
_bufPtr[0];
_bufPtr += 4;
@@ -116,14 +107,12 @@ uint32 BinReader::readUint32LE()
return u32_le;
}
-uint32 BinReader::readUint32BE()
-{
-
- assert(( _bufPtr + 4 ) <= _bufEnd );
+uint32 BinReader::readUint32BE() {
+ assert((_bufPtr + 4) <= _bufEnd);
- unsigned long u32_be = ((unsigned long)_bufPtr[0] << 24 ) |
- ((unsigned long)_bufPtr[1] << 16 ) |
- ((unsigned long)_bufPtr[2] << 8 ) |
+ unsigned long u32_be = ((unsigned long)_bufPtr[0] << 24) |
+ ((unsigned long)_bufPtr[1] << 16) |
+ ((unsigned long)_bufPtr[2] << 8 ) |
_bufPtr[3];
_bufPtr += 4;
@@ -131,14 +120,12 @@ uint32 BinReader::readUint32BE()
return u32_be;
}
-int32 BinReader::readSint32LE()
-{
+int32 BinReader::readSint32LE() {
+ assert((_bufPtr + 4) <= _bufEnd);
- assert(( _bufPtr + 4 ) <= _bufEnd );
-
- unsigned long u32_le = ((unsigned long)_bufPtr[3] << 24 ) |
- ((unsigned long)_bufPtr[2] << 16 ) |
- ((unsigned long)_bufPtr[1] << 8 ) |
+ unsigned long u32_le = ((unsigned long)_bufPtr[3] << 24) |
+ ((unsigned long)_bufPtr[2] << 16) |
+ ((unsigned long)_bufPtr[1] << 8 ) |
_bufPtr[0];
_bufPtr += 4;
@@ -146,14 +133,12 @@ int32 BinReader::readSint32LE()
return u32_le;
}
-int32 BinReader::readSint32BE()
-{
-
- assert(( _bufPtr + 4 ) <= _bufEnd );
+int32 BinReader::readSint32BE() {
+ assert((_bufPtr + 4) <= _bufEnd);
- unsigned long u32_be = ((unsigned long)_bufPtr[0] << 24 ) |
- ((unsigned long)_bufPtr[1] << 16 ) |
- ((unsigned long)_bufPtr[2] << 8 ) |
+ unsigned long u32_be = ((unsigned long)_bufPtr[0] << 24) |
+ ((unsigned long)_bufPtr[1] << 16) |
+ ((unsigned long)_bufPtr[2] << 8 ) |
_bufPtr[3];
_bufPtr += 4;
diff --git a/saga/gamedesc.cpp b/saga/gamedesc.cpp
index 735058c813..66812158df 100644
--- a/saga/gamedesc.cpp
+++ b/saga/gamedesc.cpp
@@ -38,7 +38,6 @@ using namespace SagaGameDesc;
\*--------------------------------------------------------------------------*/
R_GAME_FILEDESC ITEDEMO_GameFiles[] = {
-
{ "ITE.RSC", R_GAME_RESOURCEFILE },
{ "ITE.DMO", R_GAME_DEMOFILE },
{ "SCRIPTS.RSC", R_GAME_SCRIPTFILE },
@@ -46,13 +45,11 @@ R_GAME_FILEDESC ITEDEMO_GameFiles[] = {
};
R_GAME_FONTDESC ITEDEMO_GameFonts[] = {
-
{ R_GAME_FONT_SMALL, 0 },
{ R_GAME_FONT_MEDIUM, 1 }
};
R_GAME_SOUNDINFO ITEDEMO_GameSound = {
-
R_GAME_SOUND_VOC, 0, 0, 0
};
@@ -61,28 +58,24 @@ R_GAME_SOUNDINFO ITEDEMO_GameSound = {
\*--------------------------------------------------------------------------*/
R_GAME_FILEDESC ITEDISK_GameFiles[] = {
-
{ "ITE.RSC", R_GAME_RESOURCEFILE },
{ "SCRIPTS.RSC", R_GAME_SCRIPTFILE },
{ "VOICES.RSC", R_GAME_SOUNDFILE | R_GAME_VOICEFILE }
};
R_GAME_FONTDESC ITEDISK_GameFonts[] = {
-
{ R_GAME_FONT_MEDIUM, 0 },
{ R_GAME_FONT_LARGE, 1 },
{ R_GAME_FONT_SMALL, 2 }
};
R_GAME_DISPLAYINFO ITE_DisplayInfo = {
-
320, 200, /* Logical width and height */
137, /* Scene playfield height */
0, 0 /* Overlay palette start index and length */
};
-R_GAME_RESOURCEINFO ITE_Resources =
-{
+R_GAME_RESOURCEINFO ITE_Resources = {
ITE_SCENE_LUT, /* Scene lookup table RN */
ITE_SCRIPT_LUT, /* Script lookup table RN */
@@ -98,7 +91,6 @@ R_GAME_RESOURCEINFO ITE_Resources =
};
R_GAME_SOUNDINFO ITE_GameSound = {
-
R_GAME_SOUND_VOC, 0, 0, 0
};
@@ -107,7 +99,6 @@ R_GAME_SOUNDINFO ITE_GameSound = {
\*--------------------------------------------------------------------------*/
R_GAME_FILEDESC ITECD_GameFiles[] = {
-
{ "ITE.RSC", R_GAME_RESOURCEFILE },
{ "SCRIPTS.RSC", R_GAME_SCRIPTFILE },
{ "SOUNDS.RSC", R_GAME_SOUNDFILE },
@@ -115,14 +106,12 @@ R_GAME_FILEDESC ITECD_GameFiles[] = {
};
R_GAME_FONTDESC ITECD_GameFonts[] = {
-
{ R_GAME_FONT_MEDIUM, 0 },
{ R_GAME_FONT_LARGE, 1 },
{ R_GAME_FONT_SMALL, 2 }
};
R_GAME_SOUNDINFO ITECD_GameSound = {
-
R_GAME_SOUND_PCM,
22050,
16,
@@ -134,7 +123,6 @@ R_GAME_SOUNDINFO ITECD_GameSound = {
\*--------------------------------------------------------------------------*/
R_GAME_FILEDESC IHNMDEMO_GameFiles[] = {
-
{ "SCREAM.RES", R_GAME_RESOURCEFILE },
{ "SCRIPTS.RES", R_GAME_SCRIPTFILE },
{ "SFX.RES", R_GAME_SOUNDFILE },
@@ -146,7 +134,6 @@ R_GAME_FILEDESC IHNMDEMO_GameFiles[] = {
\*--------------------------------------------------------------------------*/
R_GAME_FILEDESC IHNMCD_GameFiles[] = {
-
{ "MUSICFM.RES", R_GAME_MUSICFILE },
{ "MUSICGM.RES", R_GAME_MUSICFILE },
{ "SCREAM.RES", R_GAME_RESOURCEFILE },
@@ -162,7 +149,6 @@ R_GAME_FILEDESC IHNMCD_GameFiles[] = {
};
R_GAME_FONTDESC IHNMCD_GameFonts[] = {
-
{ R_GAME_FONT_MEDIUM, 2 },
{ R_GAME_FONT_LARGE, 3 },
{ R_GAME_FONT_SMALL, 4 },
@@ -173,14 +159,12 @@ R_GAME_FONTDESC IHNMCD_GameFonts[] = {
};
R_GAME_DISPLAYINFO IHNM_DisplayInfo = {
-
640, 480, /* Logical width and height */
304, /* Scene playfield height */
248, 255 /* Overlay palette start index and length */
};
-R_GAME_RESOURCEINFO IHNM_Resources[] =
-{
+R_GAME_RESOURCEINFO IHNM_Resources[] = {
IHNM_SCENE_LUT, /* Scene lookup table RN */
IHNM_SCRIPT_LUT, /* Script lookup table RN */
@@ -197,12 +181,10 @@ R_GAME_RESOURCEINFO IHNM_Resources[] =
R_GAME_SOUNDINFO IHNM_GameSound = {
-
R_GAME_SOUND_WAV, 0, 0, 0
};
R_GAMEDESC GameDescs[] = {
-
/* Inherit the earth - Demo version
\*-------------------------------------------------------------*/
{
@@ -216,10 +198,10 @@ R_GAMEDESC GameDescs[] = {
&ITE_Resources,
- ARRAYSIZE( ITEDEMO_GameFiles ), /* Game datafiles */
+ ARRAYSIZE(ITEDEMO_GameFiles), /* Game datafiles */
ITEDEMO_GameFiles,
- ARRAYSIZE( ITEDEMO_GameFonts ),
+ ARRAYSIZE(ITEDEMO_GameFonts),
ITEDEMO_GameFonts,
&ITEDEMO_GameSound,
@@ -240,10 +222,10 @@ R_GAMEDESC GameDescs[] = {
&ITE_Resources,
- ARRAYSIZE( ITEDISK_GameFiles ),
+ ARRAYSIZE(ITEDISK_GameFiles),
ITEDISK_GameFiles,
- ARRAYSIZE( ITEDISK_GameFonts ),
+ ARRAYSIZE(ITEDISK_GameFonts),
ITEDISK_GameFonts,
&ITE_GameSound,
@@ -288,7 +270,7 @@ R_GAMEDESC GameDescs[] = {
IHNM_Resources,
- ARRAYSIZE( IHNMDEMO_GameFiles ),
+ ARRAYSIZE(IHNMDEMO_GameFiles),
IHNMDEMO_GameFiles,
0,
@@ -312,10 +294,10 @@ R_GAMEDESC GameDescs[] = {
IHNM_Resources,
- ARRAYSIZE( IHNMCD_GameFiles ),
+ ARRAYSIZE(IHNMCD_GameFiles),
IHNMCD_GameFiles,
- ARRAYSIZE( IHNMCD_GameFonts ),
+ ARRAYSIZE(IHNMCD_GameFonts),
IHNMCD_GameFonts,
&IHNM_GameSound,
@@ -326,17 +308,15 @@ R_GAMEDESC GameDescs[] = {
static R_GAMEMODULE GameModule;
-void SagaGameDesc::setGameDirectory( const char *gamedir ) {
-
- assert( gamedir != NULL );
+void SagaGameDesc::setGameDirectory(const char *gamedir) {
+ assert(gamedir != NULL);
- debug( 1, "Using game data path: %s", gamedir );
+ debug(1, "Using game data path: %s", gamedir);
GameModule.game_dir = gamedir;
}
int SagaGameDesc::detectGame() {
-
File test_file;
bool disqualified = false;
@@ -347,12 +327,11 @@ int SagaGameDesc::detectGame() {
const char *file_name;
int game_n;
- int game_ct = ARRAYSIZE( GameDescs );
-
- assert( GameModule.game_dir != NULL );
+ int game_ct = ARRAYSIZE(GameDescs);
- for( game_n = 0 ; game_n < game_ct ; game_n++ ) {
+ assert(GameModule.game_dir != NULL);
+ for (game_n = 0; game_n < game_ct; game_n++) {
disqualified = false;
/* Attempt to open all files for this game
@@ -361,10 +340,9 @@ int SagaGameDesc::detectGame() {
*/
file_ct = GameDescs[game_n].gd_filect;
- for( file_n = 0; file_n < file_ct; file_n++ ) {
-
+ for (file_n = 0; file_n < file_ct; file_n++) {
file_name = GameDescs[game_n].gd_filedescs[file_n].gf_fname;
- if( !test_file.open( file_name, GameModule.game_dir )) {
+ if (!test_file.open(file_name, GameModule.game_dir)) {
disqualified = true;
break;
}
@@ -372,11 +350,11 @@ int SagaGameDesc::detectGame() {
test_file.close();
}
- if ( disqualified ) {
+ if (disqualified) {
continue;
}
- switch ( GameDescs[game_n].gd_game_id ) {
+ switch (GameDescs[game_n].gd_game_id) {
case R_GAME_ITE_DEMO:
disqualified = !verifyITEDEMO();
@@ -389,15 +367,14 @@ int SagaGameDesc::detectGame() {
break;
}
- if( !disqualified ) {
+ if (!disqualified) {
found_game = true;
break;
}
}
- if( found_game ) {
-
- debug( 1, "Found SAGA game: %s\n", GameDescs[game_n].gd_title );
+ if (found_game) {
+ debug(1, "Found SAGA game: %s\n", GameDescs[game_n].gd_title);
return game_n;
}
@@ -405,23 +382,22 @@ int SagaGameDesc::detectGame() {
}
bool SagaGameDesc::openGame() {
-
int game_filect;
- if(( GameModule.game_index = detectGame() ) < 0 ) {
- error( "Couldn't locate any valid SAGA games" );
+ if ((GameModule.game_index = detectGame()) < 0) {
+ error("Couldn't locate any valid SAGA games");
return false;
}
- assert( GameModule.game_index < ARRAYSIZE(GameDescs));
+ assert(GameModule.game_index < ARRAYSIZE(GameDescs));
- if( !GameModule.game_dir ) {
+ if (!GameModule.game_dir) {
return false;
}
- game_filect = GameDescs[ GameModule.game_index ].gd_filect;
+ game_filect = GameDescs[GameModule.game_index].gd_filect;
- GameModule.gfile_data = new R_GAME_FILEDATA[ game_filect ];
+ GameModule.gfile_data = new R_GAME_FILEDATA[game_filect];
return true;
}
@@ -431,7 +407,6 @@ bool verifyITEDEMO() {
}
bool verifyITEDISK() {
-
ResourceFile test_file;
int32 script_lut_rn;
int32 script_lut_len;
@@ -442,17 +417,17 @@ bool verifyITEDISK() {
* version.
*/
- assert( GameModule.game_dir != NULL );
+ assert (GameModule.game_dir != NULL);
- if ( !test_file.open( "ITE.RSC", GameModule.game_dir )) {
+ if (!test_file.open("ITE.RSC", GameModule.game_dir)) {
return false;
}
- script_lut_rn = GameDescs[ R_GAME_ITE_DISK ].gd_resource_info->script_lut_rn;
+ script_lut_rn = GameDescs[R_GAME_ITE_DISK].gd_resource_info->script_lut_rn;
- script_lut_len = test_file.getResourceLen( script_lut_rn );
+ script_lut_len = test_file.getResourceLen(script_lut_rn);
- if( script_lut_len % R_SCR_LUT_ENTRYLEN_ITEDISK == 0 ) {
+ if (script_lut_len % R_SCR_LUT_ENTRYLEN_ITEDISK == 0) {
return true;
}
diff --git a/saga/gamedesc.h b/saga/gamedesc.h
index a3b57f88f0..cdcf2a1b19 100644
--- a/saga/gamedesc.h
+++ b/saga/gamedesc.h
@@ -29,13 +29,11 @@
namespace SagaGameDesc {
enum R_GAME_BASETYPES {
-
R_GAMETYPE_ITE,
R_GAMETYPE_IHNM
};
enum R_GAME_IDS {
-
R_GAME_ITE_DEMO = 0,
R_GAME_ITE_DISK = 1,
R_GAME_ITE_CD = 2,
@@ -44,7 +42,6 @@ enum R_GAME_IDS {
};
enum R_GAME_FILETYPES {
-
R_GAME_RESOURCEFILE = 0x01,
R_GAME_SCRIPTFILE = 0x02,
R_GAME_SOUNDFILE = 0x04,
@@ -56,14 +53,12 @@ enum R_GAME_FILETYPES {
};
enum R_GAME_SOUNDINFO_TYPES {
-
R_GAME_SOUND_PCM = 0,
R_GAME_SOUND_VOC,
R_GAME_SOUND_WAV
};
enum R_GAME_FONT_IDS {
-
R_GAME_FONT_SMALL = 0,
R_GAME_FONT_MEDIUM,
R_GAME_FONT_LARGE,
@@ -74,7 +69,6 @@ enum R_GAME_FONT_IDS {
};
typedef struct R_GAME_DISPLAYINFO_tag {
-
int logical_w;
int logical_h;
int scene_h;
@@ -85,7 +79,6 @@ typedef struct R_GAME_DISPLAYINFO_tag {
} R_GAME_DISPLAYINFO;
typedef struct R_GAMESOUND_INFO_tag {
-
int res_type;
long freq;
int sample_size;
@@ -94,21 +87,18 @@ typedef struct R_GAMESOUND_INFO_tag {
} R_GAME_SOUNDINFO;
typedef struct R_GAMEFONT_DESC_tag {
-
unsigned int font_id;
unsigned long font_rn;
} R_GAME_FONTDESC;
typedef struct R_GAMESCENE_DESC_tag {
-
unsigned long scene_lut_rn;
unsigned long first_scene;
} R_GAME_SCENEDESC;
typedef struct R_GAME_RESOURCEINFO_tag {
-
unsigned long scene_lut_rn;
unsigned long script_lut_rn;
diff --git a/saga/resfile.cpp b/saga/resfile.cpp
index 12b0a88c33..31831994eb 100644
--- a/saga/resfile.cpp
+++ b/saga/resfile.cpp
@@ -28,7 +28,6 @@
ResourceFile::ResourceFile() {
-
_resTblOffset = 0;
_resTblCt = 0;
_resTblLoaded = false;
@@ -36,30 +35,27 @@ ResourceFile::ResourceFile() {
}
ResourceFile::~ResourceFile() {
-
close();
}
-bool
-ResourceFile::open( const char *filename, const char *directory ) {
-
+bool ResourceFile::open(const char *filename, const char *directory) {
byte * temp_tbl;
uint32 tbl_len;
- if( !File::open( filename, directory )) {
+ if (!File::open(filename, directory)) {
return false;
}
/* Seek to end of file to read resource table 'trailer' */
_file_len = size();
- seek( _file_len - RSC_TABLEINFO_SIZE, SEEK_SET );
+ seek(_file_len - RSC_TABLEINFO_SIZE, SEEK_SET);
_resTblOffset = readSint32LE();
_resTblCt = readSint32LE();
/* Check for sane values */
- if( _resTblOffset != _file_len - RSC_TABLEINFO_SIZE -
+ if (_resTblOffset != _file_len - RSC_TABLEINFO_SIZE -
(RSC_TABLEENTRY_SIZE * _resTblCt)) {
return false;
}
@@ -67,26 +63,25 @@ ResourceFile::open( const char *filename, const char *directory ) {
/* Load resource table */
_resTbl = new Resource[_resTblCt];
- seek( _resTblOffset, SEEK_SET );
+ seek(_resTblOffset, SEEK_SET);
tbl_len = _resTblCt * RSC_TABLEENTRY_SIZE;
temp_tbl = new byte[tbl_len];
- if( read( temp_tbl, tbl_len ) != tbl_len ) {
+ if (read(temp_tbl, tbl_len) != tbl_len) {
delete [] _resTbl;
delete [] temp_tbl;
return false;
}
- BinReader bread( temp_tbl, tbl_len );
+ BinReader bread(temp_tbl, tbl_len);
- for( int i = 0 ; i < _resTblCt ; i++ ) {
-
+ for (int i = 0; i < _resTblCt; i++) {
_resTbl[i].res_offset = bread.readSint32LE();
_resTbl[i].res_len = bread.readSint32LE();
}
- delete [] temp_tbl;
+ delete[] temp_tbl;
_resTblLoaded = true;
@@ -95,8 +90,7 @@ ResourceFile::open( const char *filename, const char *directory ) {
void ResourceFile::close() {
-
- if( _resTblLoaded ) {
+ if ( _resTblLoaded) {
delete [] _resTbl;
_resTblLoaded = false;
_resTbl = NULL;
@@ -105,57 +99,52 @@ void ResourceFile::close() {
_resTblOffset = 0;
_resTblCt = 0;
- if( File::isOpen() ) {
+ if (File::isOpen()) {
File::close();
}
}
int32 ResourceFile::getResourceCt() {
-
return (_resTblLoaded) ? _resTblCt : -1;
}
-int32 ResourceFile::getResourceOffset( int32 rn ) {
-
- if (!R_PBOUNDS( rn, _resTblCt )) {
+int32 ResourceFile::getResourceOffset(int32 rn) {
+ if (!R_PBOUNDS(rn, _resTblCt))
return -1;
- }
return _resTbl[rn].res_offset;
}
-int32 ResourceFile::getResourceLen( int32 rn ) {
-
- if (!R_PBOUNDS( rn, _resTblCt )) {
+int32 ResourceFile::getResourceLen(int32 rn) {
+ if (!R_PBOUNDS(rn, _resTblCt))
return -1;
- }
return _resTbl[rn].res_len;
}
-bool ResourceFile::loadResource( int32 rn, byte **res, int32 *res_len ) {
-
+bool ResourceFile::loadResource(int32 rn, byte **res, int32 *res_len) {
byte *new_res;
uint32 new_res_len;
- assert( res != NULL && res_len != NULL );
+ assert(res != NULL && res_len != NULL);
*res = NULL;
*res_len = NULL;
- if( !R_PBOUNDS( rn, _resTblCt )) {
+ if (!R_PBOUNDS( rn, _resTblCt)) {
return false;
}
new_res_len = _resTbl[rn].res_len;
- new_res = new byte[ new_res_len ];
- if( !new_res ) {
+ new_res = new byte[new_res_len];
+
+ if (!new_res) {
return false;
}
- seek( _resTbl[rn].res_offset, SEEK_SET );
+ seek(_resTbl[rn].res_offset, SEEK_SET);
- if( read( new_res, new_res_len ) != new_res_len ) {
- delete [] new_res;
+ if (read(new_res, new_res_len) != new_res_len) {
+ delete[] new_res;
return false;
}
@@ -165,9 +154,8 @@ bool ResourceFile::loadResource( int32 rn, byte **res, int32 *res_len ) {
return true;
}
-void ResourceFile::freeResource( byte *res ) {
-
- delete [] res;
+void ResourceFile::freeResource(byte *res) {
+ delete[] res;
}
diff --git a/saga/resfile.h b/saga/resfile.h
index 03816fc4ce..a636aa549a 100644
--- a/saga/resfile.h
+++ b/saga/resfile.h
@@ -66,7 +66,7 @@ public:
ResourceFile();
virtual ~ResourceFile();
- bool open( const char *filename, const char *directory );
+ bool open(const char *filename, const char *directory);
void close();
inline int16 readSint16LE() {