aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--saga/actionmap.cpp1
-rw-r--r--saga/actor.cpp3
-rw-r--r--saga/animation.cpp13
-rw-r--r--saga/events.cpp1
-rw-r--r--saga/font.cpp5
-rw-r--r--saga/game.cpp161
-rw-r--r--saga/game.h9
-rw-r--r--saga/game_mod.h124
-rw-r--r--saga/ihnm_introproc.cpp2
-rw-r--r--saga/image.cpp4
-rw-r--r--saga/interface.cpp19
-rw-r--r--saga/isomap.cpp4
-rw-r--r--saga/ite_introproc.cpp3
-rw-r--r--saga/music.cpp15
-rw-r--r--saga/music.h1
-rw-r--r--saga/objectmap.cpp1
-rw-r--r--saga/palanim.cpp3
-rw-r--r--saga/render.cpp5
-rw-r--r--saga/rscfile.cpp1
-rw-r--r--saga/saga.cpp6
-rw-r--r--saga/saga.h107
-rw-r--r--saga/scene.cpp15
-rw-r--r--saga/script.cpp9
-rw-r--r--saga/sdebug.cpp1
-rw-r--r--saga/sndres.cpp15
-rw-r--r--saga/sndres.h1
-rw-r--r--saga/sound.cpp14
-rw-r--r--saga/sound.h1
-rw-r--r--saga/sprite.cpp3
-rw-r--r--saga/sthread.cpp3
30 files changed, 228 insertions, 322 deletions
diff --git a/saga/actionmap.cpp b/saga/actionmap.cpp
index e3d988c3a0..426bc1cda3 100644
--- a/saga/actionmap.cpp
+++ b/saga/actionmap.cpp
@@ -28,7 +28,6 @@
#include "saga/console.h"
#include "saga/actionmap.h"
-#include "saga/game_mod.h"
#include "saga/stream.h"
namespace Saga {
diff --git a/saga/actor.cpp b/saga/actor.cpp
index 6eb59a13eb..fc2336f415 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -24,7 +24,6 @@
#include "saga/saga.h"
#include "saga/gfx.h"
-#include "saga/game_mod.h"
#include "saga/console.h"
#include "saga/rscfile_mod.h"
#include "saga/script.h"
@@ -66,7 +65,7 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) {
debug(9, "Actor::Actor()");
// Get actor resource file context
- _actorContext = GAME_GetFileContext(GAME_RESOURCEFILE, 0);
+ _actorContext = _vm->getFileContext(GAME_RESOURCEFILE, 0);
if (_actorContext == NULL) {
error("Actor::Actor(): Couldn't load actor module resource context.");
}
diff --git a/saga/animation.cpp b/saga/animation.cpp
index b92d81f296..4c01edf219 100644
--- a/saga/animation.cpp
+++ b/saga/animation.cpp
@@ -26,7 +26,6 @@
#include "saga/gfx.h"
#include "saga/console.h"
-#include "saga/game_mod.h"
#include "saga/events.h"
#include "saga/render.h"
@@ -89,7 +88,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() == GID_ITE) {
+ if (_vm->_gameType == GType_ITE) {
if (getNumFrames(anim_resdata, anim_resdata_len, &new_anim->n_frames) != SUCCESS) {
warning("Anim::load Couldn't get animation frame count");
return FAILURE;
@@ -176,7 +175,7 @@ int Anim::play(uint16 anim_id, int vector_time) {
return FAILURE;
}
- GAME_GetDisplayInfo(&disp_info);
+ _vm->getDisplayInfo(&disp_info);
_vm->_render->getBufferInfo(&buf_info);
display_buf = buf_info.bg_buf;
@@ -191,7 +190,7 @@ int Anim::play(uint16 anim_id, int vector_time) {
if (anim->play_flag) {
frame = anim->current_frame;
- if (GAME_GetGameType() == GID_ITE) {
+ if (_vm->_gameType == GType_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 != SUCCESS) {
@@ -346,7 +345,7 @@ int Anim::freeId(uint16 anim_id) {
return FAILURE;
}
- if (GAME_GetGameType() == GID_ITE) {
+ if (_vm->_gameType == GType_ITE) {
free(anim->frame_offsets);
anim->frame_offsets = NULL;
}
@@ -385,7 +384,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() == GID_IHNM) {
+ if (_vm->_gameType == GType_IHNM) {
*n_frames = ah.nframes;
}
@@ -618,7 +617,7 @@ int Anim::IHNM_DecodeFrame(byte *decode_buf, size_t decode_buf_len, const byte *
GAME_DISPLAYINFO di;
- GAME_GetDisplayInfo(&di);
+ _vm->getDisplayInfo(&di);
*nextf_p = NULL;
diff --git a/saga/events.cpp b/saga/events.cpp
index a1984f21b2..184d53bc99 100644
--- a/saga/events.cpp
+++ b/saga/events.cpp
@@ -35,7 +35,6 @@
#include "saga/text.h"
#include "saga/palanim.h"
#include "saga/render.h"
-#include "saga/game_mod.h"
#include "saga/sndres.h"
#include "saga/music.h"
diff --git a/saga/font.cpp b/saga/font.cpp
index 3fe61688d7..21098936ca 100644
--- a/saga/font.cpp
+++ b/saga/font.cpp
@@ -26,7 +26,6 @@
#include "saga/gfx.h"
#include "saga/rscfile_mod.h"
-#include "saga/game_mod.h"
#include "saga/font.h"
#include "saga/stream.h"
@@ -38,13 +37,13 @@ Font::Font(SagaEngine *vm) : _vm(vm), _initialized(false) {
int i;
// Load font module resource context
- _fontContext = GAME_GetFileContext(GAME_RESOURCEFILE, 0);
+ _fontContext = _vm->getFileContext(GAME_RESOURCEFILE, 0);
if (_fontContext == NULL) {
error("Font::Font(): Couldn't get resource context.");
}
// Allocate font table
- GAME_GetFontInfo(&gamefonts, &_nFonts);
+ _vm->getFontInfo(&gamefonts, &_nFonts);
assert(_nFonts > 0);
diff --git a/saga/game.cpp b/saga/game.cpp
index 189a9502b3..0ad7e53c80 100644
--- a/saga/game.cpp
+++ b/saga/game.cpp
@@ -33,31 +33,30 @@
#include "saga/interface.h"
#include "saga/scene.h"
-#include "saga/game_mod.h"
#include "saga/game.h"
namespace Saga {
// Inherit the Earth - DOS Demo version
-GAME_FILEDESC ITEDEMO_GameFiles[] = {
+static GAME_FILEDESC ITEDEMO_GameFiles[] = {
{"ITE.RSC", GAME_RESOURCEFILE},
{"ITE.DMO", GAME_DEMOFILE},
{"SCRIPTS.RSC", GAME_SCRIPTFILE},
{"VOICES.RSC", GAME_SOUNDFILE | GAME_VOICEFILE}
};
-GAME_FONTDESC ITEDEMO_GameFonts[] = {
+static GAME_FONTDESC ITEDEMO_GameFonts[] = {
{GAME_FONT_SMALL, 0},
{GAME_FONT_MEDIUM, 1}
};
-GAME_SOUNDINFO ITEDEMO_GameSound = {
+static GAME_SOUNDINFO ITEDEMO_GameSound = {
GAME_SOUND_VOC, 0, 0, 0
};
// Inherit the Earth - MAC Wyrmkeep Demo version
-GAME_FILEDESC ITEMACDEMO_GameFiles[] = {
+static GAME_FILEDESC ITEMACDEMO_GameFiles[] = {
{"ITED.RSC", GAME_RESOURCEFILE},
{"SCRIPTSD.RSC", GAME_SCRIPTFILE},
{"SOUNDSD.RSC", GAME_SOUNDFILE},
@@ -65,13 +64,13 @@ GAME_FILEDESC ITEMACDEMO_GameFiles[] = {
{"MUSICD.RSC", GAME_MUSICFILE}
};
-GAME_FONTDESC ITEMACDEMO_GameFonts[] = {
+static GAME_FONTDESC ITEMACDEMO_GameFonts[] = {
{GAME_FONT_MEDIUM, 0},
{GAME_FONT_SMALL, 2}
};
// Inherit the Earth - win32 Wyrmkeep Linux Demo version
-GAME_FILEDESC ITEWINDEMO_GameFiles[] = {
+static GAME_FILEDESC ITEWINDEMO_GameFiles[] = {
{"ITED.RSC", GAME_RESOURCEFILE},
{"SCRIPTSD.RSC", GAME_SCRIPTFILE},
{"SOUNDSD.RSC", GAME_SOUNDFILE},
@@ -79,13 +78,13 @@ GAME_FILEDESC ITEWINDEMO_GameFiles[] = {
{"MUSICD.RSC", GAME_MUSICFILE}
};
-GAME_FONTDESC ITEWINDEMO_GameFonts[] = {
+static GAME_FONTDESC ITEWINDEMO_GameFonts[] = {
{GAME_FONT_MEDIUM, 0},
{GAME_FONT_SMALL, 2}
};
// Inherit the Earth - win32 Wyrmkeep Demo version older release
-GAME_FILEDESC ITEWINDEMOOld_GameFiles[] = {
+static GAME_FILEDESC ITEWINDEMOOld_GameFiles[] = {
{"ITED.RSC", GAME_RESOURCEFILE},
{"SCRIPTSD.RSC", GAME_SCRIPTFILE},
{"SOUNDSD.RSC", GAME_SOUNDFILE},
@@ -93,45 +92,44 @@ GAME_FILEDESC ITEWINDEMOOld_GameFiles[] = {
};
// Inherit the Earth - Diskette version
-GAME_FILEDESC ITEDISK_GameFiles[] = {
+static GAME_FILEDESC ITEDISK_GameFiles[] = {
{"ITE.RSC", GAME_RESOURCEFILE},
{"SCRIPTS.RSC", GAME_SCRIPTFILE},
{"VOICES.RSC", GAME_SOUNDFILE | GAME_VOICEFILE}
};
-GAME_FONTDESC ITEDISK_GameFonts[] = {
+static GAME_FONTDESC ITEDISK_GameFonts[] = {
{GAME_FONT_MEDIUM, 0},
{GAME_FONT_LARGE, 1},
{GAME_FONT_SMALL, 2}
};
-GAME_RESOURCEDESC ITE_Resources = {
+static GAME_RESOURCEDESC ITE_Resources = {
ITE_SCENE_LUT, // Scene lookup table RN
ITE_SCRIPT_LUT, // Script lookup table RN
ITE_COMMAND_PANEL,
ITE_DIALOGUE_PANEL
};
-
-GAME_SOUNDINFO ITE_GameSound = {
+static GAME_SOUNDINFO ITE_GameSound = {
GAME_SOUND_VOC, 0, 0, 0
};
// Inherit the Earth - CD Enhanced version
-GAME_FILEDESC ITECD_GameFiles[] = {
+static GAME_FILEDESC ITECD_GameFiles[] = {
{"ITE.RSC", GAME_RESOURCEFILE},
{"SCRIPTS.RSC", GAME_SCRIPTFILE},
{"SOUNDS.RSC", GAME_SOUNDFILE},
{"VOICES.RSC", GAME_VOICEFILE}
};
-GAME_FONTDESC ITECD_GameFonts[] = {
+static GAME_FONTDESC ITECD_GameFonts[] = {
{GAME_FONT_MEDIUM, 0},
{GAME_FONT_LARGE, 1},
{GAME_FONT_SMALL, 2}
};
-GAME_SOUNDINFO ITECD_GameSound = {
+static GAME_SOUNDINFO ITECD_GameSound = {
GAME_SOUND_PCM,
22050,
16,
@@ -139,7 +137,7 @@ GAME_SOUNDINFO ITECD_GameSound = {
};
// I Have No Mouth and I Must Scream - Demo version
-GAME_FILEDESC IHNMDEMO_GameFiles[] = {
+static GAME_FILEDESC IHNMDEMO_GameFiles[] = {
{"SCREAM.RES", GAME_RESOURCEFILE},
{"SCRIPTS.RES", GAME_SCRIPTFILE},
{"SFX.RES", GAME_SOUNDFILE},
@@ -147,7 +145,7 @@ GAME_FILEDESC IHNMDEMO_GameFiles[] = {
};
// I Have No Mouth and I Must Scream - Retail CD version
-GAME_FILEDESC IHNMCD_GameFiles[] = {
+static GAME_FILEDESC IHNMCD_GameFiles[] = {
{"MUSICFM.RES", GAME_MUSICFILE_FM},
{"MUSICGM.RES", GAME_MUSICFILE_GM},
{"SCREAM.RES", GAME_RESOURCEFILE},
@@ -162,7 +160,7 @@ GAME_FILEDESC IHNMCD_GameFiles[] = {
{"VOICESS.RES", GAME_VOICEFILE}
};
-GAME_FONTDESC IHNMCD_GameFonts[] = {
+static GAME_FONTDESC IHNMCD_GameFonts[] = {
{GAME_FONT_MEDIUM, 2},
{GAME_FONT_LARGE, 3},
{GAME_FONT_SMALL, 4},
@@ -172,23 +170,23 @@ GAME_FONTDESC IHNMCD_GameFonts[] = {
{GAME_FONT_LARGE3, 8}
};
-GAME_RESOURCEDESC IHNM_Resources = {
+static GAME_RESOURCEDESC IHNM_Resources = {
IHNM_SCENE_LUT, // Scene lookup table RN
IHNM_SCRIPT_LUT, // Script lookup table RN
IHNM_COMMAND_PANEL,
IHNM_DIALOGUE_PANEL
};
-GAME_SOUNDINFO IHNM_GameSound = {
+static GAME_SOUNDINFO IHNM_GameSound = {
GAME_SOUND_WAV, 0, 0, 0
};
-GAMEDESC GameDescs[] = {
+static GAMEDESC GameDescs[] = {
// Inherit the earth - DOS Demo version
{
"ite-demo",
- GID_ITE,
- GAME_ITE_DEMO, // Game id
+ GType_ITE,
+ GID_ITE_DEMO, // Game id
"Inherit the Earth (DOS Demo)", // Game title
320, 200, // Logical resolution
137, // Scene viewport height
@@ -205,28 +203,28 @@ GAMEDESC GameDescs[] = {
// Inherit the earth - MAC Demo version
// Note: it should be before win32 version ???
{
- "ite-demo",
- GID_ITE,
- GAME_ITE_MACDEMO,
- "Inherit the Earth (MAC Demo)",
- 320, 200,
- 137,
- ITE_DEFAULT_SCENE,
- &ITE_Resources,
- ARRAYSIZE(ITEMACDEMO_GameFiles),
- ITEMACDEMO_GameFiles,
- ARRAYSIZE(ITEMACDEMO_GameFonts),
- ITEMACDEMO_GameFonts,
- &ITECD_GameSound,
- GF_VOX_VOICES | GF_BIG_ENDIAN_DATA
+ "ite-demo",
+ GType_ITE,
+ GID_ITE_MACDEMO,
+ "Inherit the Earth (MAC Demo)",
+ 320, 200,
+ 137,
+ ITE_DEFAULT_SCENE,
+ &ITE_Resources,
+ ARRAYSIZE(ITEMACDEMO_GameFiles),
+ ITEMACDEMO_GameFiles,
+ ARRAYSIZE(ITEMACDEMO_GameFonts),
+ ITEMACDEMO_GameFonts,
+ &ITECD_GameSound,
+ GF_VOX_VOICES | GF_BIG_ENDIAN_DATA
},
// Inherit the earth - Linux Demo version
// Note: it should be before win32 version
{
"ite-demo",
- GID_ITE,
- GAME_ITE_WINDEMO,
+ GType_ITE,
+ GID_ITE_WINDEMO,
"Inherit the Earth (Linux Demo)",
320, 200,
137,
@@ -243,8 +241,8 @@ GAMEDESC GameDescs[] = {
// Inherit the earth - Win32 Demo version
{
"ite-demo",
- GID_ITE,
- GAME_ITE_WINDEMO,
+ GType_ITE,
+ GID_ITE_WINDEMO,
"Inherit the Earth (Win32 Demo)",
320, 200,
137,
@@ -262,8 +260,8 @@ GAMEDESC GameDescs[] = {
// NOTE: it should be before floppy version
{
"ite",
- GID_ITE,
- GAME_ITE_CD,
+ GType_ITE,
+ GID_ITE_CD,
"Inherit the Earth (DOS CD Version)",
320, 200,
137,
@@ -280,8 +278,8 @@ GAMEDESC GameDescs[] = {
// Inherit the earth - Disk version
{
"ite",
- GID_ITE,
- GAME_ITE_DISK,
+ GType_ITE,
+ GID_ITE_DISK,
"Inherit the Earth (DOS)",
320, 200,
137,
@@ -298,8 +296,8 @@ GAMEDESC GameDescs[] = {
// I Have No Mouth And I Must Scream - Demo version
{
"ihnm-demo",
- GID_IHNM,
- GAME_IHNM_DEMO,
+ GType_IHNM,
+ GID_IHNM_DEMO,
"I Have No Mouth and I Must Scream (DOS Demo)",
640, 480,
7,
@@ -316,8 +314,8 @@ GAMEDESC GameDescs[] = {
// I Have No Mouth And I Must Scream - CD version
{
"ihnm",
- GID_IHNM,
- GAME_IHNM_CD,
+ GType_IHNM,
+ GID_IHNM_CD,
"I Have No Mouth and I Must Scream (DOS)",
640, 480,
7,
@@ -334,26 +332,26 @@ GAMEDESC GameDescs[] = {
static GAMEMODULE GameModule;
-int GAME_Init() {
+int SagaEngine::initGame() {
uint16 game_n;
- if (DetectGame(&game_n) != SUCCESS) {
+ if (detectGame(&game_n) != SUCCESS) {
warning("No valid games were found in the specified directory.");
return FAILURE;
}
- if (LoadGame(game_n) != SUCCESS) {
+ if (loadGame(game_n) != SUCCESS) {
warning("Error loading game resource files.");
return FAILURE;
}
// Load dialogue file
- LoadLanguage();
+ loadLanguage();
return SUCCESS;
}
-int LoadLanguage() {
+int SagaEngine::loadLanguage() {
char lang_file[MAXPATH];
uint16 game_n;
@@ -361,7 +359,7 @@ int LoadLanguage() {
game_n = GameModule.game_number;
- if (GameDescs[game_n].gd_game_type == GID_ITE) {
+ if (GameDescs[game_n].gd_game_type == GType_ITE) {
snprintf(lang_file, MAXPATH, "%s%s.%s", GAME_ITE_LANG_PREFIX, GameModule.game_language, GAME_LANG_EXT);
if (!test_file.open(lang_file)) {
debug(0, "Couldn't open language file %s. Using default (US English)", lang_file);
@@ -390,7 +388,7 @@ int LoadLanguage() {
return SUCCESS;
}
-RSCFILE_CONTEXT *GAME_GetFileContext(uint16 type, int param) {
+RSCFILE_CONTEXT *SagaEngine::getFileContext(uint16 type, int param) {
RSCFILE_CONTEXT *found_ctxt = NULL;
uint16 i;
@@ -452,7 +450,7 @@ DetectedGameList GAME_ProbeGame(const FSList &fslist) {
return detectedGames;
}
-int DetectGame(uint16 *game_n_p) {
+int SagaEngine::detectGame(uint16 *game_n_p) {
uint16 game_count = ARRAYSIZE(GameDescs);
uint16 game_n;
@@ -493,7 +491,7 @@ int DetectGame(uint16 *game_n_p) {
return FAILURE;
}
-int LoadGame(uint16 game_n) {
+int SagaEngine::loadGame(uint16 game_n) {
RSCFILE_CONTEXT *load_ctxt;
uint16 game_count = ARRAYSIZE(GameDescs);
const char *game_fname;
@@ -534,37 +532,26 @@ int LoadGame(uint16 game_n) {
GameModule.gd_fontct = GameDescs[game_n].gd_fontct;
GameModule.gd_fontdescs = GameDescs[game_n].gd_fontdescs;
- // Finish initialization
- GameModule.game_init = 1;
+ _gameId = GameModule.gamedesc->gd_game_id;
+ _gameType = GameModule.gamedesc->gd_game_type;
+ _features = GameModule.gamedesc->features;
return SUCCESS;
}
-int GAME_GetResourceInfo(GAME_RESOURCEDESC *rsc_desc) {
- assert(rsc_desc != NULL);
-
- *rsc_desc = *GameModule.gamedesc->gd_resource_desc;
-
- return SUCCESS;
+const GAME_RESOURCEDESC SagaEngine::getResourceInfo(void) {
+ return *GameModule.gamedesc->gd_resource_desc;
}
-int GAME_GetSoundInfo(GAME_SOUNDINFO *snd_info) {
- assert(snd_info != NULL);
-
- *snd_info = *GameModule.gamedesc->gd_soundinfo;
-
- return SUCCESS;
+const GAME_SOUNDINFO SagaEngine::getSoundInfo(void) {
+ return *GameModule.gamedesc->gd_soundinfo;
}
-int GAME_GetDisplayInfo(GAME_DISPLAYINFO *disp_info) {
+int SagaEngine::getDisplayInfo(GAME_DISPLAYINFO *disp_info) {
int game_n;
assert(disp_info != NULL);
- if (!GameModule.game_init) {
- return FAILURE;
- }
-
game_n = GameModule.game_number;
disp_info->logical_w = GameDescs[game_n].gd_logical_w;
@@ -574,7 +561,7 @@ int GAME_GetDisplayInfo(GAME_DISPLAYINFO *disp_info) {
return SUCCESS;
}
-int GAME_GetFontInfo(GAME_FONTDESC **gf_desc, int *font_n) {
+int SagaEngine::getFontInfo(GAME_FONTDESC **gf_desc, int *font_n) {
assert((gf_desc != NULL) && (font_n != NULL));
*gf_desc = GameModule.gd_fontdescs;
@@ -583,7 +570,7 @@ int GAME_GetFontInfo(GAME_FONTDESC **gf_desc, int *font_n) {
return SUCCESS;
}
-int GAME_GetSceneInfo(GAME_SCENEDESC *gs_desc) {
+int SagaEngine::getSceneInfo(GAME_SCENEDESC *gs_desc) {
assert(gs_desc != NULL);
gs_desc->first_scene = GameModule.gamedesc->gd_startscene;
@@ -592,16 +579,4 @@ int GAME_GetSceneInfo(GAME_SCENEDESC *gs_desc) {
return SUCCESS;
}
-GAME_IDS GAME_GetGame() {
- return GameModule.gamedesc->gd_game_id;
-}
-
-SAGAGameId GAME_GetGameType() {
- return GameModule.gamedesc->gd_game_type;
-}
-
-uint32 GAME_GetFeatures() {
- return GameModule.gamedesc->features;
-}
-
} // End of namespace Saga
diff --git a/saga/game.h b/saga/game.h
index 5fc021a535..e8e0184c0e 100644
--- a/saga/game.h
+++ b/saga/game.h
@@ -26,7 +26,7 @@
#ifndef SAGA_GAME_H_
#define SAGA_GAME_H_
-#include "base/plugins.h"
+#include "saga/saga.h"
namespace Saga {
@@ -47,7 +47,7 @@ struct GAME_FILEDESC {
struct GAMEDESC {
const char *name;
- SAGAGameId gd_game_type;
+ SAGAGameType gd_game_type;
GAME_IDS gd_game_id;
const char *gd_title;
int gd_logical_w;
@@ -75,7 +75,6 @@ struct GAME_FILEDATA {
};
struct GAMEMODULE {
- int game_init;
int game_number;
GAMEDESC *gamedesc;
int g_skipintro;
@@ -88,9 +87,7 @@ struct GAMEMODULE {
const char *err_str;
};
-int LoadLanguage();
-int LoadGame(uint16 game_n_p);
-int DetectGame(uint16 *game_n_p);
+DetectedGameList GAME_ProbeGame(const FSList &fslist);
} // End of namespace Saga
diff --git a/saga/game_mod.h b/saga/game_mod.h
deleted file mode 100644
index e9a522dd19..0000000000
--- a/saga/game_mod.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2004 The ScummVM project
- *
- * The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Header$
- *
- */
-
-// Game detection, general game parameters - module header
-
-#ifndef SAGA_GAME_MOD_H__
-#define SAGA_GAME_MOD_H__
-
-#include "base/plugins.h"
-
-namespace Saga {
-
-#define IS_BIG_ENDIAN ((GAME_GetFeatures() & GF_BIG_ENDIAN_DATA) != 0)
-#define IS_MAC_VERSION (GAME_GetGame() == GAME_ITE_MACDEMO)
-
-
-enum GAME_IDS {
- GAME_ITE_DEMO = 0,
- GAME_ITE_DISK = 1,
- GAME_ITE_CD = 2,
- GAME_IHNM_DEMO = 3,
- GAME_IHNM_CD = 4,
- GAME_ITE_WINDEMO = 5,
- GAME_ITE_MACDEMO = 6
-};
-
-enum GAME_FILETYPES {
- GAME_RESOURCEFILE = 0x01,
- GAME_SCRIPTFILE = 0x02,
- GAME_SOUNDFILE = 0x04,
- GAME_VOICEFILE = 0x08,
- GAME_DEMOFILE = 0x10,
- GAME_MUSICFILE = 0x20,
- GAME_MUSICFILE_GM = 0x40,
- GAME_MUSICFILE_FM = 0x80
-};
-
-enum GAME_SOUNDINFO_TYPES {
- GAME_SOUND_PCM = 0,
- GAME_SOUND_VOC,
- GAME_SOUND_WAV,
- GAME_SOUND_VOX
-};
-
-enum GAME_FONT_IDS {
- GAME_FONT_SMALL = 0,
- GAME_FONT_MEDIUM,
- GAME_FONT_LARGE,
- GAME_FONT_SMALL2,
- GAME_FONT_MEDIUM2,
- GAME_FONT_LARGE2,
- GAME_FONT_LARGE3
-};
-
-enum GAME_FEATURES {
- GF_VOX_VOICES = 1,
- GF_BIG_ENDIAN_DATA = 2
-};
-
-struct GAME_DISPLAYINFO {
- int logical_w;
- int logical_h;
- int scene_h;
-};
-
-struct GAME_SOUNDINFO {
- int res_type;
- long freq;
- int sample_size;
- int stereo;
-};
-
-struct GAME_FONTDESC {
- uint16 font_id;
- uint32 font_rn;
-};
-
-struct GAME_SCENEDESC {
- uint32 scene_lut_rn;
- uint32 first_scene;
-};
-
-struct GAME_RESOURCEDESC {
- uint32 scene_lut_rn;
- uint32 script_lut_rn;
- uint32 command_panel_rn;
- uint32 dialogue_panel_rn;
-};
-
-int GAME_Register();
-int GAME_Init();
-RSCFILE_CONTEXT *GAME_GetFileContext(uint16 type, int param);
-int GAME_GetFontInfo(GAME_FONTDESC **, int *);
-int GAME_GetResourceInfo(GAME_RESOURCEDESC *);
-int GAME_GetSoundInfo(GAME_SOUNDINFO *);
-int GAME_GetDisplayInfo(GAME_DISPLAYINFO *);
-int GAME_GetSceneInfo(GAME_SCENEDESC *);
-GAME_IDS GAME_GetGame();
-SAGAGameId GAME_GetGameType();
-DetectedGameList GAME_ProbeGame(const FSList &fslist);
-uint32 GAME_GetFeatures();
-} // End of namespace Saga
-
-#endif
diff --git a/saga/ihnm_introproc.cpp b/saga/ihnm_introproc.cpp
index e95d3b6fd2..3a157b6c4a 100644
--- a/saga/ihnm_introproc.cpp
+++ b/saga/ihnm_introproc.cpp
@@ -105,7 +105,7 @@ int Scene::IHNMStartProc() {
// it will cause the end titles music to play, which is wrong. (But
// hey, it's a nice piece of music!)
- GAME_GetSceneInfo(&gs_desc);
+ _vm->getSceneInfo(&gs_desc);
first_scene.load_flag = BY_SCENE;
first_scene.scene_n = gs_desc.first_scene;
diff --git a/saga/image.cpp b/saga/image.cpp
index d87a0e7f4f..e9603798a0 100644
--- a/saga/image.cpp
+++ b/saga/image.cpp
@@ -24,8 +24,6 @@
// SAGA Image resource management routines
#include "saga/saga.h"
-#include "saga/game_mod.h"
-
#include "saga/image.h"
#include "saga/stream.h"
@@ -94,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() == GID_IHNM) {
+ if (_vm->_gameType == GType_IHNM) {
flipImage(out_buf, hdr.width, hdr.height);
}
diff --git a/saga/interface.cpp b/saga/interface.cpp
index cfb71bc374..ad58a17b08 100644
--- a/saga/interface.cpp
+++ b/saga/interface.cpp
@@ -25,7 +25,6 @@
#include "saga/saga.h"
#include "saga/gfx.h"
-#include "saga/game_mod.h"
#include "saga/actor.h"
#include "saga/console.h"
#include "saga/font.h"
@@ -164,7 +163,6 @@ int Interface::registerLang(void) {
Interface::Interface(SagaEngine *vm) : _vm(vm), _initialized(false) {
GAME_RESOURCEDESC g_resdesc;
- int game_type;
int result;
if (_initialized) {
@@ -178,20 +176,19 @@ Interface::Interface(SagaEngine *vm) : _vm(vm), _initialized(false) {
}
// Load interface module resource file context
- _interfaceContext = GAME_GetFileContext(GAME_RESOURCEFILE, 0);
+ _interfaceContext = _vm->getFileContext(GAME_RESOURCEFILE, 0);
if (_interfaceContext == NULL) {
return;
}
// Initialize interface data by game type
- game_type = GAME_GetGameType();
- if (game_type == GID_ITE) {
+ if (_vm->_gameType == GType_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 == GID_IHNM) {
+ } else if (_vm->_gameType == GType_IHNM) {
// Load I Have No Mouth interface desc
_cPanel.buttons = IHNM_c_buttons;
_cPanel.nbuttons = ARRAYSIZE(IHNM_c_buttons);
@@ -201,7 +198,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm), _initialized(false) {
}
// Load interface resources
- GAME_GetResourceInfo(&g_resdesc);
+ g_resdesc = _vm->getResourceInfo();
// Load command panel resource
result = RSC_LoadResource(_interfaceContext, g_resdesc.command_panel_rn,
@@ -330,7 +327,7 @@ int Interface::draw() {
}
// Get game display info
- GAME_GetDisplayInfo(&g_di);
+ _vm->getDisplayInfo(&g_di);
drawStatusBar(back_buf);
@@ -390,7 +387,7 @@ int Interface::update(const Point& imousePt, int update_flag) {
back_buf = _vm->_gfx->getBackBuffer();
// Get game display info
- GAME_GetDisplayInfo(&g_di);
+ _vm->getDisplayInfo(&g_di);
if (_panelMode == kPanelCommand) {
// Update playfield space ( only if cursor is inside )
@@ -425,12 +422,12 @@ int Interface::drawStatusBar(SURFACE *ds) {
// Disable this for IHNM for now, since that game uses the full screen
// in some cases.
- if (GAME_GetGameType() == GID_IHNM) {
+ if (_vm->_gameType == GType_IHNM) {
return SUCCESS;
}
// Get game display info
- GAME_GetDisplayInfo(&g_di);
+ _vm->getDisplayInfo(&g_di);
// Erase background of status bar
rect.left = 0;
diff --git a/saga/isomap.cpp b/saga/isomap.cpp
index c8cc4cde81..e8d910eafc 100644
--- a/saga/isomap.cpp
+++ b/saga/isomap.cpp
@@ -24,7 +24,6 @@
// Isometric level module
#include "saga/saga.h"
-#include "saga/game_mod.h"
#include "saga/gfx.h"
#include "saga/isomap.h"
@@ -134,7 +133,8 @@ int IsoMap::loadMetamap(const byte *mm_res_p, size_t mm_res_len) {
int IsoMap::draw(SURFACE *dst_s) {
GAME_DISPLAYINFO disp_info;
- GAME_GetDisplayInfo(&disp_info);
+
+ _vm->getDisplayInfo(&disp_info);
Rect iso_rect(disp_info.logical_w, disp_info.scene_h);
drawRect(dst_s, &iso_rect, 0);
drawMetamap(dst_s, -1000, -500);
diff --git a/saga/ite_introproc.cpp b/saga/ite_introproc.cpp
index 5caa7286ea..9a6dc9ea05 100644
--- a/saga/ite_introproc.cpp
+++ b/saga/ite_introproc.cpp
@@ -30,7 +30,6 @@
#include "saga/animation.h"
#include "saga/events.h"
#include "saga/font.h"
-#include "saga/game_mod.h"
#include "saga/rscfile_mod.h"
#include "saga/sndres.h"
#include "saga/text.h"
@@ -137,7 +136,7 @@ int Scene::ITEStartProc() {
_vm->_scene->queueScene(&tempScene);
}
- GAME_GetSceneInfo(&gs_desc);
+ _vm->getSceneInfo(&gs_desc);
first_scene.load_flag = BY_SCENE;
first_scene.scene_n = gs_desc.first_scene;
diff --git a/saga/music.cpp b/saga/music.cpp
index 01c208edaf..26eee9df4d 100644
--- a/saga/music.cpp
+++ b/saga/music.cpp
@@ -24,7 +24,6 @@
#include "saga/music.h"
#include "saga/rscfile_mod.h"
-#include "saga/game_mod.h"
#include "saga/stream.h"
#include "sound/audiostream.h"
#include "sound/mididrv.h"
@@ -298,7 +297,7 @@ Music::Music(SoundMixer *mixer, MidiDriver *driver, int enabled) : _mixer(mixer)
_musicInitialized = 1;
_mixer->setMusicVolume(ConfMan.getInt("music_volume"));
- if (GAME_GetGameType() == GID_ITE) {
+ if (_vm->_gameType == GType_ITE) {
File file;
byte footerBuf[ARRAYSIZE(_digiTableITECD) * 8];
@@ -314,7 +313,7 @@ Music::Music(SoundMixer *mixer, MidiDriver *driver, int enabled) : _mixer(mixer)
// Proper approach would be to extend resource manager so it could
// return File object.
- _musicContext = GAME_GetFileContext(GAME_MUSICFILE, 0);
+ _musicContext = _vm->getFileContext(GAME_MUSICFILE, 0);
if (_musicContext != NULL) {
_hasDigiMusic = true;
@@ -407,7 +406,7 @@ int Music::play(uint32 music_rn, uint16 flags) {
MidiParser *parser;
File midiFile;
- if (GAME_GetGameType() == GID_ITE) {
+ if (_vm->_gameType == GType_ITE) {
if (music_rn >= 9 && music_rn <= 34) {
if (flags == MUSIC_DEFAULT) {
flags = _midiTableITECD[music_rn - 9].flags;
@@ -457,8 +456,8 @@ int Music::play(uint32 music_rn, uint16 flags) {
} else {
// Load MIDI/XMI resource data
- if (GAME_GetGameType() == GID_ITE) {
- rsc_ctxt = GAME_GetFileContext(GAME_RESOURCEFILE, 0);
+ if (_vm->_gameType == GType_ITE) {
+ rsc_ctxt = _vm->getFileContext(GAME_RESOURCEFILE, 0);
} else {
// I've listened to music from both the FM and the GM
// file, and I've tentatively reached the conclusion
@@ -484,9 +483,9 @@ int Music::play(uint32 music_rn, uint16 flags) {
// different in the two files. I have no idea why.
if (hasAdlib()) {
- rsc_ctxt = GAME_GetFileContext(GAME_MUSICFILE_FM, 0);
+ rsc_ctxt = _vm->getFileContext(GAME_MUSICFILE_FM, 0);
} else {
- rsc_ctxt = GAME_GetFileContext(GAME_MUSICFILE_GM, 0);
+ rsc_ctxt = _vm->getFileContext(GAME_MUSICFILE_GM, 0);
}
_player->setGM(true);
diff --git a/saga/music.h b/saga/music.h
index d97b69fc85..b1a5f3ac22 100644
--- a/saga/music.h
+++ b/saga/music.h
@@ -27,7 +27,6 @@
#define SAGA_MUSIC_H_
#include "saga/rscfile_mod.h"
-#include "saga/game_mod.h"
#include "sound/mixer.h"
#include "sound/mididrv.h"
#include "sound/midiparser.h"
diff --git a/saga/objectmap.cpp b/saga/objectmap.cpp
index b5d1e3102c..fcae5c4d75 100644
--- a/saga/objectmap.cpp
+++ b/saga/objectmap.cpp
@@ -32,7 +32,6 @@
#include "saga/console.h"
#include "saga/font.h"
#include "saga/objectmap.h"
-#include "saga/game_mod.h"
#include "saga/stream.h"
namespace Saga {
diff --git a/saga/palanim.cpp b/saga/palanim.cpp
index 3bb3ca6506..6b4a6b8b8a 100644
--- a/saga/palanim.cpp
+++ b/saga/palanim.cpp
@@ -26,7 +26,6 @@
#include "saga/gfx.h"
#include "saga/events.h"
-#include "saga/game_mod.h"
#include "saga/palanim.h"
#include "saga/stream.h"
@@ -57,7 +56,7 @@ int PalAnim::loadPalAnim(const byte *resdata, size_t resdata_len) {
MemoryReadStreamEndian readS(resdata, resdata_len, IS_BIG_ENDIAN);
- if (GAME_GetGameType() == GID_IHNM) {
+ if (_vm->_gameType == GType_IHNM) {
return SUCCESS;
}
diff --git a/saga/render.cpp b/saga/render.cpp
index 38c9363bca..bf71d71ef4 100644
--- a/saga/render.cpp
+++ b/saga/render.cpp
@@ -27,7 +27,6 @@
#include "saga/gfx.h"
#include "saga/actor.h"
#include "saga/font.h"
-#include "saga/game_mod.h"
#include "saga/interface.h"
#include "saga/scene.h"
#include "saga/text.h"
@@ -51,7 +50,7 @@ Render::Render(SagaEngine *vm, OSystem *system) {
int tmp_w, tmp_h, tmp_bytepp;
// Initialize system graphics
- GAME_GetDisplayInfo(&disp_info);
+ _vm->getDisplayInfo(&disp_info);
// Initialize FPS timer callback
g_timer->installTimerProc(&fpsTimerCallback, 1000000, this);
@@ -119,7 +118,7 @@ int Render::drawScene() {
mouse_pt = _vm->getMousePos();
_vm->_scene->getBGInfo(&bg_info);
- GAME_GetDisplayInfo(&disp_info);
+ _vm->getDisplayInfo(&disp_info);
bg_pt.x = 0;
bg_pt.y = 0;
diff --git a/saga/rscfile.cpp b/saga/rscfile.cpp
index cbfa60b484..b6b5f2b3ec 100644
--- a/saga/rscfile.cpp
+++ b/saga/rscfile.cpp
@@ -26,7 +26,6 @@
#include "saga/rscfile_mod.h"
#include "saga/rscfile.h"
-#include "saga/game_mod.h"
#include "saga/stream.h"
namespace Saga {
diff --git a/saga/saga.cpp b/saga/saga.cpp
index bb43f53451..25680a7383 100644
--- a/saga/saga.cpp
+++ b/saga/saga.cpp
@@ -40,7 +40,6 @@
#include "saga/console.h"
#include "saga/events.h"
#include "saga/font.h"
-#include "saga/game_mod.h"
#include "saga/game.h"
#include "saga/interface.h"
#include "saga/isomap.h"
@@ -51,7 +50,6 @@
#include "saga/sprite.h"
#include "saga/sound.h"
#include "saga/music.h"
-#include "saga/game_mod.h"
#include "saga/palanim.h"
static const GameSettings saga_games[] = {
@@ -142,7 +140,7 @@ int SagaEngine::init(GameDetector &detector) {
// Process command line
// Detect game and open resource files
- if (GAME_Init() != SUCCESS) {
+ if (initGame() != SUCCESS) {
return -1;
}
@@ -171,7 +169,7 @@ int SagaEngine::init(GameDetector &detector) {
// Initialize graphics
GAME_DISPLAYINFO disp_info;
- GAME_GetDisplayInfo(&disp_info);
+ getDisplayInfo(&disp_info);
_gfx = new Gfx(_system, disp_info.logical_w, disp_info.logical_h, detector);
// Graphics driver should be initialized before console
diff --git a/saga/saga.h b/saga/saga.h
index 2c59b1c6d2..2dbcef472b 100644
--- a/saga/saga.h
+++ b/saga/saga.h
@@ -28,6 +28,8 @@
#include "common/scummsys.h"
#include "base/engine.h"
#include "base/gameDetector.h"
+#include "base/plugins.h"
+
#include "common/util.h"
#include "common/stream.h"
#include "common/rect.h"
@@ -72,9 +74,9 @@ enum ERRORCODE {
SUCCESS = 0
};
-enum SAGAGameId {
- GID_ITE,
- GID_IHNM
+enum SAGAGameType {
+ GType_ITE,
+ GType_IHNM
};
enum scriptTimings {
@@ -86,6 +88,84 @@ struct CLICKAREA {
Point *points;
};
+
+#define IS_BIG_ENDIAN ((_vm->_features & GF_BIG_ENDIAN_DATA) != 0)
+#define IS_MAC_VERSION (_vm->_gameId == GID_ITE_MACDEMO)
+
+
+enum GAME_IDS {
+ GID_ITE_DEMO = 0,
+ GID_ITE_DISK = 1,
+ GID_ITE_CD = 2,
+ GID_IHNM_DEMO = 3,
+ GID_IHNM_CD = 4,
+ GID_ITE_WINDEMO = 5,
+ GID_ITE_MACDEMO = 6
+};
+
+enum GAME_FILETYPES {
+ GAME_RESOURCEFILE = 0x01,
+ GAME_SCRIPTFILE = 0x02,
+ GAME_SOUNDFILE = 0x04,
+ GAME_VOICEFILE = 0x08,
+ GAME_DEMOFILE = 0x10,
+ GAME_MUSICFILE = 0x20,
+ GAME_MUSICFILE_GM = 0x40,
+ GAME_MUSICFILE_FM = 0x80
+};
+
+enum GAME_SOUNDINFO_TYPES {
+ GAME_SOUND_PCM = 0,
+ GAME_SOUND_VOC,
+ GAME_SOUND_WAV,
+ GAME_SOUND_VOX
+};
+
+enum GAME_FONT_IDS {
+ GAME_FONT_SMALL = 0,
+ GAME_FONT_MEDIUM,
+ GAME_FONT_LARGE,
+ GAME_FONT_SMALL2,
+ GAME_FONT_MEDIUM2,
+ GAME_FONT_LARGE2,
+ GAME_FONT_LARGE3
+};
+
+enum GAME_FEATURES {
+ GF_VOX_VOICES = 1,
+ GF_BIG_ENDIAN_DATA = 2
+};
+
+struct GAME_DISPLAYINFO {
+ int logical_w;
+ int logical_h;
+ int scene_h;
+};
+
+struct GAME_SOUNDINFO {
+ int res_type;
+ long freq;
+ int sample_size;
+ int stereo;
+};
+
+struct GAME_FONTDESC {
+ uint16 font_id;
+ uint32 font_rn;
+};
+
+struct GAME_SCENEDESC {
+ uint32 scene_lut_rn;
+ uint32 first_scene;
+};
+
+struct GAME_RESOURCEDESC {
+ uint32 scene_lut_rn;
+ uint32 script_lut_rn;
+ uint32 command_panel_rn;
+ uint32 dialogue_panel_rn;
+};
+
inline int ticksToMSec(int tick) {
return tick * 1000 / kScriptTimeTicksPerSecond;
}
@@ -106,6 +186,10 @@ public:
int _soundEnabled;
int _musicEnabled;
+ int _gameId;
+ int _gameType;
+ uint32 _features;
+
SndRes *_sndRes;
Sound *_sound;
Music *_music;
@@ -159,8 +243,23 @@ public:
int processInput(void);
Point getMousePos();
- private:
+private:
Point _mousePos;
+
+public:
+ int initGame();
+ RSCFILE_CONTEXT *getFileContext(uint16 type, int param);
+ int getFontInfo(GAME_FONTDESC **, int *);
+ const GAME_RESOURCEDESC getResourceInfo(void);
+ const GAME_SOUNDINFO getSoundInfo(void);
+ int getDisplayInfo(GAME_DISPLAYINFO *disp_info);
+ int getSceneInfo(GAME_SCENEDESC *);
+
+private:
+ int loadLanguage();
+ int loadGame(uint16 game_n_p);
+ int detectGame(uint16 *game_n_p);
+
};
// FIXME: Global var. We use it until everything will be turned into objects
diff --git a/saga/scene.cpp b/saga/scene.cpp
index 8d3b39edfc..8d9e8cff51 100644
--- a/saga/scene.cpp
+++ b/saga/scene.cpp
@@ -25,7 +25,6 @@
#include "saga/saga.h"
#include "saga/gfx.h"
-#include "saga/game_mod.h"
#include "saga/animation.h"
#include "saga/console.h"
#include "saga/interface.h"
@@ -55,10 +54,10 @@ Scene::Scene(SagaEngine *vm) : _vm(vm), _initialized(false) {
int i;
// Load game-specific scene data
- GAME_GetSceneInfo(&gs_desc);
+ _vm->getSceneInfo(&gs_desc);
// Load scene module resource context
- _sceneContext = GAME_GetFileContext(GAME_RESOURCEFILE, 0);
+ _sceneContext = _vm->getFileContext(GAME_RESOURCEFILE, 0);
if (_sceneContext == NULL) {
warning("Scene::Scene(): Couldn't load scene resource context");
return;
@@ -173,11 +172,11 @@ int Scene::startScene() {
event.op = EVENT_HIDE;
_vm->_events->queue(&event);
- switch (GAME_GetGameType()) {
- case GID_ITE:
+ switch (_vm->_gameType) {
+ case GType_ITE:
ITEStartProc();
break;
- case GID_IHNM:
+ case GType_IHNM:
IHNMStartProc();
break;
default:
@@ -334,7 +333,7 @@ int Scene::getBGInfo(SCENE_BGINFO *bginfo) {
bginfo->bg_h = _bg.h;
bginfo->bg_p = _bg.p;
- GAME_GetDisplayInfo(&di);
+ _vm->getDisplayInfo(&di);
x = 0;
y = 0;
@@ -784,7 +783,7 @@ int Scene::draw(SURFACE *dst_s) {
assert(_initialized);
_vm->_render->getBufferInfo(&buf_info);
- GAME_GetDisplayInfo(&disp_info);
+ _vm->getDisplayInfo(&disp_info);
bg_pt.x = 0;
bg_pt.y = 0;
diff --git a/saga/script.cpp b/saga/script.cpp
index a8f6c11764..dc178d9a41 100644
--- a/saga/script.cpp
+++ b/saga/script.cpp
@@ -26,7 +26,6 @@
#include "saga/gfx.h"
#include "saga/rscfile_mod.h"
-#include "saga/game_mod.h"
#include "saga/console.h"
#include "saga/script.h"
@@ -55,17 +54,17 @@ Script::Script() {
_skipSpeeches = false;
memset(_dataBuf, 0, sizeof(_dataBuf));
- GAME_GetResourceInfo(&gr_desc);
+ gr_desc = _vm->getResourceInfo();
debug(0, "Initializing scripting subsystem");
// Load script resource file context
- _scriptContext = GAME_GetFileContext(GAME_SCRIPTFILE, 0);
+ _scriptContext = _vm->getFileContext(GAME_SCRIPTFILE, 0);
if (_scriptContext == NULL) {
error("Couldn't get script file context");
}
// Load script LUT resource
- s_lut_ctxt = GAME_GetFileContext(GAME_RESOURCEFILE, 0);
+ s_lut_ctxt = _vm->getFileContext(GAME_RESOURCEFILE, 0);
if (s_lut_ctxt == NULL) {
error("Couldn't get resource file context");
}
@@ -156,7 +155,7 @@ int Script::loadScript(int script_num) {
uint32 voicelut_rn;
int result;
- if (GAME_GetGameType() == GID_IHNM) {
+ if (_vm->_gameType == GType_IHNM) {
return SUCCESS;
}
diff --git a/saga/sdebug.cpp b/saga/sdebug.cpp
index 14c2e3654a..350e284f54 100644
--- a/saga/sdebug.cpp
+++ b/saga/sdebug.cpp
@@ -30,7 +30,6 @@
#include "saga/font.h"
#include "saga/script.h"
-#include "saga/game_mod.h"
#include "saga/stream.h"
namespace Saga {
diff --git a/saga/sndres.cpp b/saga/sndres.cpp
index 38e1fdfcae..89154c7d84 100644
--- a/saga/sndres.cpp
+++ b/saga/sndres.cpp
@@ -25,7 +25,6 @@
#include "saga/saga.h"
-#include "saga/game_mod.h"
#include "saga/rscfile_mod.h"
#include "saga/sndres.h"
@@ -40,18 +39,18 @@ namespace Saga {
SndRes::SndRes(SagaEngine *vm) : _vm(vm) {
/* Load sound module resource file contexts */
- _sfx_ctxt = GAME_GetFileContext(GAME_SOUNDFILE, 0);
+ _sfx_ctxt = _vm->getFileContext(GAME_SOUNDFILE, 0);
if (_sfx_ctxt == NULL) {
return;
}
- _voice_ctxt = GAME_GetFileContext(GAME_VOICEFILE, 0);
+ _voice_ctxt = _vm->getFileContext(GAME_VOICEFILE, 0);
if (_voice_ctxt == NULL) {
return;
}
// Grab sound resource information for the current game
- GAME_GetSoundInfo(&_snd_info);
+ _snd_info = _vm->getSoundInfo();
_init = 1;
}
@@ -78,7 +77,7 @@ int SndRes::playVoice(uint32 voice_rn) {
debug(0, "SndRes::playVoice(%ld)", voice_rn);
- if (GAME_GetGameType() == GID_ITE && voice_rn == 4) {
+ if (_vm->_gameType == GType_ITE && voice_rn == 4) {
// The Wyrmkeep release of Inherit the Earth provides a
// separate file (p2_a.voc or P2_A.iaf), to correct voice 4 in
// the intro. Use that, if available.
@@ -122,7 +121,7 @@ int SndRes::playVoice(uint32 voice_rn) {
return FAILURE;
}
- if (GAME_GetFeatures() & GF_VOX_VOICES && !voiceFile)
+ if (_vm->_features & GF_VOX_VOICES && !voiceFile)
_vm->_sound->playVoxVoice(&snd_buffer);
else
_vm->_sound->playVoice(&snd_buffer);
@@ -274,7 +273,7 @@ int SndRes::getVoiceLength(uint32 voice_rn) {
// (p2_a.voc or P2_A.iaf), to correct voice 4 in the intro. Use that,
// if available.
- if (GAME_GetGameType() == GID_ITE && voice_rn == 4) {
+ if (_vm->_gameType == GType_ITE && voice_rn == 4) {
if (f.open("p2_a.voc")) {
result = SUCCESS;
length = f.size();
@@ -298,7 +297,7 @@ int SndRes::getVoiceLength(uint32 voice_rn) {
}
}
- if (GAME_GetFeatures() & GF_VOX_VOICES && !voiceFile) {
+ if (_vm->_features & GF_VOX_VOICES && !voiceFile) {
// Rough hack, fix this to be accurate
ms_f = (double)length / 22050 * 2000.0;
ms_i = (int)ms_f;
diff --git a/saga/sndres.h b/saga/sndres.h
index 30c5dd1a7a..9c758753bb 100644
--- a/saga/sndres.h
+++ b/saga/sndres.h
@@ -27,7 +27,6 @@
#define SAGA_SNDRES_H_
#include "saga/rscfile_mod.h"
-#include "saga/game_mod.h"
#include "saga/sound.h"
namespace Saga {
diff --git a/saga/sound.cpp b/saga/sound.cpp
index e68b71384f..1b36ec1dbc 100644
--- a/saga/sound.cpp
+++ b/saga/sound.cpp
@@ -23,7 +23,6 @@
#include "saga/saga.h"
#include "saga/sound.h"
-#include "saga/game_mod.h"
#include "sound/audiostream.h"
#include "sound/mixer.h"
@@ -172,19 +171,6 @@ int Sound::playSoundBuffer(PlayingSoundHandle *handle, SOUNDBUFFER *buf, int vol
if (!buf->s_signed)
flags |= SoundMixer::FLAG_UNSIGNED;
- // FIXME: Remove the code below if the code above works.
-
-#if 0
- int game_id = GAME_GetGame();
-
- if((game_id == GAME_ITE_DISK) || (game_id == GAME_ITE_DEMO)) {
- flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE;
- } else {
- flags = SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_16BITS |
- SoundMixer::FLAG_LITTLE_ENDIAN;
- }
-#endif
-
_mixer->playRaw(handle, buf->s_buf, buf->s_buf_len, buf->s_freq, flags, -1, volume);
return SUCCESS;
diff --git a/saga/sound.h b/saga/sound.h
index 1f339b2f5a..d910c6b55e 100644
--- a/saga/sound.h
+++ b/saga/sound.h
@@ -27,7 +27,6 @@
#define SAGA_SOUND_H_
#include "saga/rscfile_mod.h"
-#include "saga/game_mod.h"
#include "sound/mixer.h"
namespace Saga {
diff --git a/saga/sprite.cpp b/saga/sprite.cpp
index fabdf8a06f..db75a18ea0 100644
--- a/saga/sprite.cpp
+++ b/saga/sprite.cpp
@@ -24,7 +24,6 @@
// Sprite management module
#include "saga/saga.h"
-#include "saga/game_mod.h"
#include "saga/gfx.h"
#include "saga/scene.h"
#include "saga/rscfile_mod.h"
@@ -41,7 +40,7 @@ Sprite::Sprite(SagaEngine *vm) : _vm(vm), _initialized(false) {
debug(0, "Initializing sprite subsystem...");
// Load sprite module resource context
- _spriteContext = GAME_GetFileContext(GAME_RESOURCEFILE, 0);
+ _spriteContext = _vm->getFileContext(GAME_RESOURCEFILE, 0);
if (_spriteContext == NULL) {
return;
}
diff --git a/saga/sthread.cpp b/saga/sthread.cpp
index 2eebfb0c08..799c16061e 100644
--- a/saga/sthread.cpp
+++ b/saga/sthread.cpp
@@ -31,7 +31,6 @@
#include "saga/script.h"
#include "saga/sdata.h"
-#include "saga/game_mod.h"
#include "saga/stream.h"
#include "saga/scene.h"
#include "saga/resnames.h"
@@ -763,7 +762,7 @@ int Script::SThreadRun(SCRIPT_THREAD *thread, int instr_limit) {
}
// now data contains last string index
- if (GAME_GetGame() == GAME_ITE_DISK) { // special ITE dos
+ if (_vm->_gameId == GID_ITE_DISK) { // special ITE dos
if ((_vm->_scene->currentSceneNumber() == ITE_DEFAULT_SCENE) && (data >= 288) && (data <= (SCENE1_VOICE_138 - SCENE1_VOICE_009 + 288))) {
sampleResourceId = SCENE1_VOICE_009 + data - 288;
}