aboutsummaryrefslogtreecommitdiff
path: root/saga/gamedesc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'saga/gamedesc.cpp')
-rw-r--r--saga/gamedesc.cpp91
1 files changed, 33 insertions, 58 deletions
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;
}