1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#include "ultima/detection.h"
#include "base/plugins.h"
#include "common/system.h"
#include "common/config-manager.h"
#include "common/savefile.h"
#include "common/str-array.h"
#include "common/memstream.h"
#include "common/translation.h"
#ifdef ENABLE_ULTIMA1
#include "ultima/shared/early/ultima_early.h"
#endif
#ifdef ENABLE_ULTIMA4
#include "ultima/ultima4/ultima4.h"
#include "ultima/ultima4/metaengine.h"
#endif
#ifdef ENABLE_ULTIMA6
#include "ultima/nuvie/metaengine.h"
#include "ultima/nuvie/nuvie.h"
#endif
#ifdef ENABLE_ULTIMA8
#include "ultima/ultima8/ultima8.h"
#include "ultima/ultima8/metaengine.h"
#endif
#include "ultima/metaengine.h"
static const ADExtraGuiOptionsMap optionsList[] = {
{
GAMEOPTION_ORIGINAL_SAVELOAD,
{
_s("Use original save/load screens"),
_s("Use the original save/load screens instead of the ScummVM ones"),
"originalsaveload",
false,
0,
0
}
},
{
GAMEOPTION_FRAME_SKIPPING,
{
_s("Enable frame skipping"),
_s("Allow the game to skip animation frames when running too slow."),
"frameSkip",
false,
0,
0
}
},
{
GAMEOPTION_FRAME_LIMITING,
{
_s("Enable frame limiting"),
_s("Limits the speed of the game to prevent running too fast."),
"frameLimit",
true,
0,
0
}
},
{
GAMEOPTION_CHEATS,
{
_s("Enable cheats"),
_s("Allow cheats by commands and a menu when player is clicked."),
"cheat",
false,
0,
0
}
},
{
GAMEOPTION_HIGH_RESOLUTION,
{
_s("Enable high resolution"),
_s("Enable a higher resolution for the game"),
"usehighres",
false,
0,
0
}
},
{
GAMEOPTION_FOOTSTEP_SOUNDS,
{
_s("Play foot step sounds"),
_s("Plays sound when the player moves."),
"footsteps",
true,
0,
0
}
},
{
GAMEOPTION_JUMP_TO_MOUSE,
{
_s("Enable jump to mouse position"),
_s("Jumping while not moving targets the mouse cursor rather than direction only."),
"targetedjump",
true,
0,
0
}
},
{
GAMEOPTION_FONT_REPLACEMENT,
{
_s("Enable font replacement"),
_s("Replaces game fonts with rendered fonts"),
"font_override",
false,
0,
0
}
},
{
GAMEOPTION_FONT_ANTIALIASING,
{
_s("Enable font anti-aliasing"),
_s("When font anti-aliasing is enabled, the text is smoother."),
"font_antialiasing",
false,
0,
0
}
},
{
GAMEOPTION_CAMERA_WITH_SILENCER,
{
// I18N: Silencer is the player-character in Crusader games, known as the Avatar in Ultima series.
_s("Camera moves with Silencer"),
_s("Camera tracks the player movement rather than snapping to defined positions."),
"camera_on_player",
true,
0,
0
}
},
{
GAMEOPTION_ALWAYS_CHRISTMAS,
{
_s("Always enable Christmas easter-egg"),
_s("Enable the Christmas music at any time of year."),
"always_christmas",
true,
0,
0
}
},
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
const char *UltimaMetaEngine::getName() const {
return "ultima";
}
const ADExtraGuiOptionsMap *UltimaMetaEngine::getAdvancedExtraGuiOptions() const {
return optionsList;
}
Common::Error UltimaMetaEngine::createInstance(OSystem *syst, Engine **engine, const Ultima::UltimaGameDescription *gd) const {
switch (gd->gameId) {
#ifdef ENABLE_ULTIMA1
case Ultima::GAME_ULTIMA1:
*engine = new Ultima::Shared::UltimaEarlyEngine(syst, gd);
break;
#endif
#ifdef ENABLE_ULTIMA4
case Ultima::GAME_ULTIMA4:
*engine = new Ultima::Ultima4::Ultima4Engine(syst, gd);
break;
#endif
#ifdef ENABLE_ULTIMA6
case Ultima::GAME_ULTIMA6:
case Ultima::GAME_MARTIAN_DREAMS:
case Ultima::GAME_SAVAGE_EMPIRE:
*engine = new Ultima::Nuvie::NuvieEngine(syst, gd);
break;
#endif
#ifdef ENABLE_ULTIMA8
case Ultima::GAME_ULTIMA8:
case Ultima::GAME_CRUSADER_REG:
case Ultima::GAME_CRUSADER_REM:
*engine = new Ultima::Ultima8::Ultima8Engine(syst, gd);
break;
#endif
default:
return Common::kUnsupportedGameidError;
}
return Common::kNoError;
}
int UltimaMetaEngine::getMaximumSaveSlot() const {
return MAX_SAVES;
}
SaveStateList UltimaMetaEngine::listSaves(const char *target) const {
SaveStateList saveList = AdvancedMetaEngine::listSaves(target);
#ifdef ENABLE_ULTIMA6
Common::String gameId = getGameId(target);
if (gameId == "ultima6" || gameId == "ultima6_enh")
Ultima::Nuvie::MetaEngine::listSaves(saveList);
#endif
return saveList;
}
SaveStateDescriptor UltimaMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
SaveStateDescriptor desc = AdvancedMetaEngine::querySaveMetaInfos(target, slot);
if (!desc.isValid() && slot > 0) {
#ifdef ENABLE_ULTIMA8
Common::String gameId = getGameId(target);
if (gameId == "ultima8") {
Common::String filename = getSavegameFile(slot, target);
desc = SaveStateDescriptor(this, slot, Common::U32String());
if (!Ultima::Ultima8::MetaEngine::querySaveMetaInfos(filename, desc))
return SaveStateDescriptor();
}
#endif
}
return desc;
}
Common::KeymapArray UltimaMetaEngine::initKeymaps(const char *target) const {
#if defined(ENABLE_ULTIMA4) || defined(ENABLE_ULTIMA6) || defined(ENABLE_ULTIMA8)
const Common::String gameId = getGameId(target);
#endif
#ifdef ENABLE_ULTIMA4
if (gameId == "ultima4" || gameId == "ultima4_enh")
return Ultima::Ultima4::MetaEngine::initKeymaps();
#endif
#ifdef ENABLE_ULTIMA6
if (gameId == "ultima6" || gameId == "ultima6_enh"
|| gameId == "martiandreams" || gameId == "martiandreams_enh"
|| gameId == "savageempire" || gameId == "savageempire_enh")
return Ultima::Nuvie::MetaEngine::initKeymaps(gameId);
#endif
#ifdef ENABLE_ULTIMA8
if (gameId == "ultima8" || gameId == "remorse" || gameId == "regret")
return Ultima::Ultima8::MetaEngine::initKeymaps(gameId);
#endif
return Common::KeymapArray();
}
Common::String UltimaMetaEngine::getGameId(const Common::String& target) {
// Store a copy of the active domain
Common::String currDomain = ConfMan.getActiveDomainName();
// Switch to the given target domain and get it's game Id
ConfMan.setActiveDomain(target);
Common::String gameId = ConfMan.get("gameid");
// Switch back to the original domain and return the game Id
ConfMan.setActiveDomain(currDomain);
return gameId;
}
#if PLUGIN_ENABLED_DYNAMIC(ULTIMA)
REGISTER_PLUGIN_DYNAMIC(ULTIMA, PLUGIN_TYPE_ENGINE, UltimaMetaEngine);
#else
REGISTER_PLUGIN_STATIC(ULTIMA, PLUGIN_TYPE_ENGINE, UltimaMetaEngine);
#endif
|