From d1d308ff743c85fd91d45bf8a2e2a7f9507b6ced Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Fri, 27 Aug 2004 01:32:10 +0000 Subject: R_GAMETYPE -> GID, remove unused supported flag and trim some unused bits of GAME svn-id: r14793 --- saga/animation.cpp | 8 ++++---- saga/game.cpp | 53 ++++++++++++++--------------------------------------- saga/game.h | 1 - saga/game_mod.h | 7 ------- saga/image.cpp | 2 +- saga/interface.cpp | 4 ++-- saga/music.cpp | 2 +- saga/palanim.cpp | 2 +- saga/saga.cpp | 1 - saga/scene.cpp | 4 ++-- saga/script.cpp | 2 +- saga/sndres.cpp | 4 ++-- 12 files changed, 28 insertions(+), 62 deletions(-) (limited to 'saga') diff --git a/saga/animation.cpp b/saga/animation.cpp index fd59630aa8..2c12afafcd 100644 --- a/saga/animation.cpp +++ b/saga/animation.cpp @@ -96,7 +96,7 @@ int Anim::load(const byte *anim_resdata, size_t anim_resdata_len, uint16 *anim_i new_anim->resdata = anim_resdata; new_anim->resdata_len = anim_resdata_len; - if (GAME_GetGameType() == R_GAMETYPE_ITE) { + if (GAME_GetGameType() == GID_ITE) { if (getNumFrames(anim_resdata, anim_resdata_len, &new_anim->n_frames) != R_SUCCESS) { warning("Anim::load Couldn't get animation frame count"); return R_FAILURE; @@ -198,7 +198,7 @@ int Anim::play(uint16 anim_id, int vector_time) { if (anim->play_flag) { frame = anim->current_frame; - if (GAME_GetGameType() == R_GAMETYPE_ITE) { + if (GAME_GetGameType() == GID_ITE) { result = ITE_DecodeFrame(anim->resdata, anim->resdata_len, anim->frame_offsets[frame - 1], display_buf, disp_info.logical_w * disp_info.logical_h); if (result != R_SUCCESS) { @@ -353,7 +353,7 @@ int Anim::freeId(uint16 anim_id) { return R_FAILURE; } - if (GAME_GetGameType() == R_GAMETYPE_ITE) { + if (GAME_GetGameType() == GID_ITE) { free(anim->frame_offsets); anim->frame_offsets = NULL; } @@ -391,7 +391,7 @@ int Anim::getNumFrames(const byte *anim_resource, size_t anim_resource_len, uint ah.unknown07 = readS.readByte(); ah.nframes = readS.readByte(); - if (GAME_GetGameType() == R_GAMETYPE_IHNM) { + if (GAME_GetGameType() == GID_IHNM) { *n_frames = ah.nframes; } diff --git a/saga/game.cpp b/saga/game.cpp index 831d439645..dff6a692ca 100644 --- a/saga/game.cpp +++ b/saga/game.cpp @@ -159,7 +159,7 @@ R_GAMEDESC GameDescs[] = { // Inherit the earth - DOS Demo version { "ite-demo", - R_GAMETYPE_ITE, + GID_ITE, R_GAME_ITE_DEMO, // Game id "Inherit the Earth (DOS Demo)", // Game title 320, 200, // Logical resolution @@ -171,14 +171,13 @@ R_GAMEDESC GameDescs[] = { ARRAYSIZE(ITEDEMO_GameFonts), ITEDEMO_GameFonts, &ITEDEMO_GameSound, - 0, - 0 // Game supported flag + 0 // features }, // Inherit the earth - win32 Wyrmkeep Demo version { "ite-demo-win", - R_GAMETYPE_ITE, + GID_ITE, R_GAME_ITE_WINDEMO, "Inherit the Earth (Win32 Demo)", 320, 200, @@ -190,7 +189,6 @@ R_GAMEDESC GameDescs[] = { ARRAYSIZE(ITECD_GameFonts), ITECD_GameFonts, &ITECD_GameSound, - 0, 0 }, @@ -198,7 +196,7 @@ R_GAMEDESC GameDescs[] = { // NOTE: it should be before floppy version { "itecd", - R_GAMETYPE_ITE, + GID_ITE, R_GAME_ITE_CD, "Inherit the Earth (DOS CD Version)", 320, 200, @@ -210,14 +208,13 @@ R_GAMEDESC GameDescs[] = { ARRAYSIZE(ITECD_GameFonts), ITECD_GameFonts, &ITECD_GameSound, - 0, - 1 + 0 }, // Inherit the earth - Disk version { "ite", - R_GAMETYPE_ITE, + GID_ITE, R_GAME_ITE_DISK, "Inherit the Earth (DOS)", 320, 200, @@ -229,14 +226,13 @@ R_GAMEDESC GameDescs[] = { ARRAYSIZE(ITEDISK_GameFonts), ITEDISK_GameFonts, &ITE_GameSound, - 0, - 1 + 0 }, // I Have No Mouth And I Must Scream - Demo version { "ihnm-demo", - R_GAMETYPE_IHNM, + GID_IHNM, R_GAME_IHNM_DEMO, "I Have No Mouth and I Must Scream (DOS Demo)", 640, 480, @@ -248,14 +244,13 @@ R_GAMEDESC GameDescs[] = { 0, NULL, &IHNM_GameSound, - GF_DEFAULT_TO_1X_SCALER, - 0 + GF_DEFAULT_TO_1X_SCALER }, // I Have No Mouth And I Must Scream - CD version { "ihnm", - R_GAMETYPE_IHNM, + GID_IHNM, R_GAME_IHNM_CD, "I Have No Mouth and I Must Scream (DOS)", 640, 480, @@ -267,8 +262,7 @@ R_GAMEDESC GameDescs[] = { ARRAYSIZE(IHNMCD_GameFonts), IHNMCD_GameFonts, &IHNM_GameSound, - GF_DEFAULT_TO_1X_SCALER, - 1 + GF_DEFAULT_TO_1X_SCALER } }; @@ -316,22 +310,12 @@ int GAME_Init() { game_dir = GameModule.game_dir; if (DetectGame(game_dir, &game_n) != R_SUCCESS) { - GameModule.err_str = "No valid games were found in the specified directory."; - return R_FAILURE; - } - - if (!GameDescs[game_n].gd_supported) { - GameModule.err_str = "This game is not currently supported."; - return R_FAILURE; - } - - if (!GameDescs[game_n].gd_supported) { - GameModule.err_str = "This game is not currently supported."; + warning("No valid games were found in the specified directory."); return R_FAILURE; } if (LoadGame(game_dir, game_n) != R_SUCCESS) { - GameModule.err_str = "Error loading game resource files."; + warning("Error loading game resource files."); return R_FAILURE; } @@ -343,14 +327,13 @@ int GAME_Init() { int LoadLanguage() { char lang_file[R_MAXPATH]; -// char lang_path[R_MAXPATH]; uint16 game_n; File test_file; game_n = GameModule.game_number; - if (GameDescs[game_n].gd_game_type == R_GAMETYPE_ITE) { + if (GameDescs[game_n].gd_game_type == GID_ITE) { snprintf(lang_file, R_MAXPATH, "%s%s.%s", R_GAME_ITE_LANG_PREFIX, GameModule.game_language, R_GAME_LANG_EXT); if (!test_file.open(lang_file)) { debug(0, "Couldn't open language file %s. Using default (US English)", lang_file); @@ -379,14 +362,6 @@ int LoadLanguage() { return R_SUCCESS; } -int GAME_GetErrN() { - return 0; -} - -const char *GAME_GetErrS() { - return GameModule.err_str == NULL ? "No error description." : GameModule.err_str; -} - int GAME_GetFileContext(R_RSCFILE_CONTEXT ** ctxt_p, uint16 r_type, int param) { R_RSCFILE_CONTEXT *found_ctxt = NULL; uint16 i; diff --git a/saga/game.h b/saga/game.h index 0e694cc4ad..0e7e585566 100644 --- a/saga/game.h +++ b/saga/game.h @@ -61,7 +61,6 @@ struct R_GAMEDESC { R_GAME_FONTDESC *gd_fontdescs; R_GAME_SOUNDINFO *gd_soundinfo; uint32 features; - int gd_supported; GameSettings toGameSettings() const { GameSettings dummy = { name, gd_title, features }; diff --git a/saga/game_mod.h b/saga/game_mod.h index 215b58ab61..c229627aca 100644 --- a/saga/game_mod.h +++ b/saga/game_mod.h @@ -30,11 +30,6 @@ namespace Saga { -enum R_GAME_BASETYPES { - R_GAMETYPE_ITE, - R_GAMETYPE_IHNM -}; - enum R_GAME_IDS { R_GAME_ITE_DEMO = 0, R_GAME_ITE_DISK = 1, @@ -109,9 +104,7 @@ int GAME_GetDisplayInfo(R_GAME_DISPLAYINFO *); int GAME_GetSceneInfo(R_GAME_SCENEDESC *); int GAME_GetGame(); int GAME_GetGameType(); -int GAME_GetErrN(); void GAME_setGameDirectory(const char *gamedir); -const char *GAME_GetErrS(); GameList GAME_GameList(); DetectedGameList GAME_ProbeGame(const FSList &fslist); diff --git a/saga/image.cpp b/saga/image.cpp index 602545e235..80a732317d 100644 --- a/saga/image.cpp +++ b/saga/image.cpp @@ -92,7 +92,7 @@ int SagaEngine::decodeBGImage(const byte *image_data, size_t image_size, unbankBGImage(out_buf, decode_buf, hdr.width, hdr.height); // For some reason bg images in IHNM are upside down - if (GAME_GetGameType() == R_GAMETYPE_IHNM) { + if (GAME_GetGameType() == GID_IHNM) { flipImage(out_buf, hdr.width, hdr.height); } diff --git a/saga/interface.cpp b/saga/interface.cpp index f16dd19e50..ab438458d0 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -156,13 +156,13 @@ Interface::Interface(SagaEngine *vm) : _vm(vm), _initialized(false) { // Initialize interface data by game type game_type = GAME_GetGameType(); - if (game_type == R_GAMETYPE_ITE) { + if (game_type == GID_ITE) { // Load Inherit the Earth interface desc _cPanel.buttons = ITE_c_buttons; _cPanel.nbuttons = ARRAYSIZE(ITE_c_buttons); _iDesc = ITE_interface; - } else if (game_type == R_GAMETYPE_IHNM) { + } else if (game_type == GID_IHNM) { // Load I Have No Mouth interface desc _cPanel.buttons = IHNM_c_buttons; _cPanel.nbuttons = ARRAYSIZE(IHNM_c_buttons); diff --git a/saga/music.cpp b/saga/music.cpp index 1906543057..a1b87c4dab 100644 --- a/saga/music.cpp +++ b/saga/music.cpp @@ -210,7 +210,7 @@ int Music::play(uint32 music_rn, uint16 flags) { File f_midi; MidiParser *parser; - if (GAME_GetGameType() == R_GAMETYPE_ITE) { + if (GAME_GetGameType() == GID_ITE) { if (music_rn >= 9 && music_rn <= 34) { char file_name[20]; sprintf(file_name, "music/%s.mid", _midiTableITECD[music_rn - 9].filename); diff --git a/saga/palanim.cpp b/saga/palanim.cpp index c763680444..860333d8c5 100644 --- a/saga/palanim.cpp +++ b/saga/palanim.cpp @@ -56,7 +56,7 @@ int PalAnim::loadPalAnim(const byte *resdata, size_t resdata_len) { MemoryReadStream readS(resdata, resdata_len); - if (GAME_GetGameType() == R_GAMETYPE_IHNM) { + if (GAME_GetGameType() == GID_IHNM) { return R_SUCCESS; } diff --git a/saga/saga.cpp b/saga/saga.cpp index df755caf3d..62950d937d 100644 --- a/saga/saga.cpp +++ b/saga/saga.cpp @@ -130,7 +130,6 @@ void SagaEngine::go() { // Detect game and open resource files if (GAME_Init() != R_SUCCESS) { - warning("Couldn't start the game: %s", GAME_GetErrS()); return; } diff --git a/saga/scene.cpp b/saga/scene.cpp index 66bf9faaff..d7246e0473 100644 --- a/saga/scene.cpp +++ b/saga/scene.cpp @@ -179,10 +179,10 @@ int Scene::startScene() { } switch (GAME_GetGameType()) { - case R_GAMETYPE_ITE: + case GID_ITE: ITEStartProc(); break; - case R_GAMETYPE_IHNM: + case GID_IHNM: IHNMStartProc(); break; default: diff --git a/saga/script.cpp b/saga/script.cpp index 7411f5b002..d2b25f699e 100644 --- a/saga/script.cpp +++ b/saga/script.cpp @@ -173,7 +173,7 @@ int Script::loadScript(int script_num) { uint32 voicelut_rn; int result; - if (GAME_GetGameType() == R_GAMETYPE_IHNM) { + if (GAME_GetGameType() == GID_IHNM) { return R_SUCCESS; } diff --git a/saga/sndres.cpp b/saga/sndres.cpp index 5fef6afd23..4efe99d95c 100644 --- a/saga/sndres.cpp +++ b/saga/sndres.cpp @@ -71,7 +71,7 @@ int SndRes::playVoice(uint32 voice_rn) { File f; - if (GAME_GetGameType() == R_GAMETYPE_ITE && voice_rn == 4 && f.open("sound/p2_a.voc")) { + if (GAME_GetGameType() == GID_ITE && voice_rn == 4 && f.open("sound/p2_a.voc")) { uint32 size = f.size(); byte *snd_res = (byte *)malloc(size); f.read(snd_res, size); @@ -228,7 +228,7 @@ int SndRes::getVoiceLength(uint32 voice_rn) { // file, sound/p2_a.voc, to correct voice 4 in the intro. Use that, if // available. - if (GAME_GetGameType() == R_GAMETYPE_ITE && voice_rn == 4 && f.open("sound/p2_a.voc")) { + if (GAME_GetGameType() == GID_ITE && voice_rn == 4 && f.open("sound/p2_a.voc")) { length = f.size(); res_type = R_GAME_SOUND_VOC; f.close(); -- cgit v1.2.3