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 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
|
/* 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 "bladerunner/bladerunner.h"
#include "bladerunner/detection.h"
#include "bladerunner/savefile.h"
#include "backends/keymapper/action.h"
#include "backends/keymapper/keymap.h"
#include "backends/keymapper/standard-actions.h"
#include "common/config-manager.h"
#include "common/system.h"
#include "common/savefile.h"
#include "common/serializer.h"
#include "common/translation.h"
#include "engines/advancedDetector.h"
namespace BladeRunner {
static const ADExtraGuiOptionsMap optionsList[] = {
{
GAMEOPTION_SITCOM,
{
_s("Sitcom mode"),
_s("Game will add laughter after actor's line or narration"),
"sitcom",
false,
0,
0
}
},
{
GAMEOPTION_SHORTY,
{
_s("Shorty mode"),
_s("Game will shrink the actors and make their voices high pitched"),
"shorty",
false,
0,
0
}
},
{
GAMEOPTION_FRAMELIMITER_NODELAYMILLIS,
{
_s("Frame limiter high performance mode"),
_s("This mode may result in high CPU usage! It avoids use of delayMillis() function."),
"nodelaymillisfl",
false,
0,
0
}
},
{
GAMEOPTION_FRAMELIMITER_FPS,
{
_s("Max frames per second limit"),
_s("This mode targets a maximum of 120 fps. When disabled, the game targets 60 fps"),
"frames_per_secondfl",
false,
0,
0
}
},
{
GAMEOPTION_DISABLE_STAMINA_DRAIN,
{
_s("Disable McCoy's quick stamina drain"),
_s("When running, McCoy won't start slowing down as soon as the player stops clicking the mouse"),
"disable_stamina_drain",
false,
0,
0
}
},
{
GAMEOPTION_SHOW_SUBS_IN_CRAWL,
{
_s("Show subtitles during text crawl"),
_s("During the intro cutscene, show subtitles during the text crawl"),
"use_crawl_subs",
true,
0,
0
}
},
{
GAMEOPTION_FIX_SPANISH_CREDITS,
{
_s("Fix credits for voice actors"),
_s("Updates the end credits with corrected credits for the Spanish voice actors"),
"correct_spanish_credits",
false,
0,
0
}
},
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
} // End of namespace BladeRunner
class BladeRunnerMetaEngine : public AdvancedMetaEngine<ADGameDescription> {
public:
const char *getName() const override;
const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override {
return BladeRunner::optionsList;
}
Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
bool hasFeature(MetaEngineFeature f) const override;
Common::KeymapArray initKeymaps(const char *target) const override;
SaveStateList listSaves(const char *target) const override;
int getMaximumSaveSlot() const override;
bool removeSaveState(const char *target, int slot) const override;
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
// Disable autosave (see mirrored method in bladerunner.h for detailed explanation)
int getAutosaveSlot() const override { return -1; }
};
const char *BladeRunnerMetaEngine::getName() const {
return "bladerunner";
}
Common::Error BladeRunnerMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
*engine = new BladeRunner::BladeRunnerEngine(syst, desc);
return Common::kNoError;
}
bool BladeRunnerMetaEngine::hasFeature(MetaEngineFeature f) const {
return
f == kSupportsListSaves ||
f == kSupportsLoadingDuringStartup ||
f == kSupportsDeleteSave ||
f == kSavesSupportMetaInfo ||
f == kSavesSupportThumbnail ||
f == kSavesSupportCreationDate ||
f == kSavesSupportPlayTime ||
f == kSimpleSavesNames;
}
Common::KeymapArray BladeRunnerMetaEngine::initKeymaps(const char *target) const {
using namespace Common;
using namespace BladeRunner;
Common::String gameId = ConfMan.get("gameid", target);
Common::U32String gameDesc;
Keymap *commonKeymap;
Keymap *gameplayKeymap;
Keymap *kiaOnlyKeymap;
if (gameId == "bladerunner") {
gameDesc = "Blade Runner";
} else if (gameId == "bladerunner-final") {
gameDesc = "Blade Runner (Restored Content)";
} else if (gameId == "bladerunner-ee") {
gameDesc = "Blade Runner: Enhanced Edition";
}
if (gameDesc.empty()) {
return AdvancedMetaEngine::initKeymaps(target);
}
// We use 3 keymaps: common (main game and KIA), gameplay (main game only) and kia (KIA only).
// This helps us with disabling unneeded keymaps, which is especially useful in KIA, when typing in a saved game.
// In general, Blade Runner by default, can bind a key (eg. spacebar) to multiple actions
// (eg. skip cutscene, toggle combat, enter a blank space in save game input field).
// We need to be able to disable the conflicting keymaps, while keeping others that should still work in KIA
// (eg. "Esc" (by default) toggling KIA should work in normal gameplay and also within KIA).
// Another related issue we tackle is that a custom action event does not maintain the keycode and ascii value
// (if it was associated with a keyboard key), and there's no obvious way to retrieve those from it.
// Thus, a custom action event cannot be somehow utilised to produce keyboard key presses
// (again if a keyboard key is mapped to that action), so it cannot by itself be used
// for text entering in the save file name input field, or for typing the Easter Egg strings.
// I18N: These are keymaps that work in the main gameplay and also when KIA (Knowledge Integration Assistant) is open.
commonKeymap = new Keymap(Keymap::kKeymapTypeGame, BladeRunnerEngine::kCommonKeymapId, gameDesc + Common::U32String(" - ") + _("common shortcuts"));
// I18N: These are keymaps which work only in the main gameplay and not within KIA's (Knowledge Integration Assistant) screens.
gameplayKeymap = new Keymap(Keymap::kKeymapTypeGame, BladeRunnerEngine::kGameplayKeymapId, gameDesc + Common::U32String(" - ") + _("main game shortcuts"));
// I18N: These are keymaps that work only within KIA's (Knowledge Integration Assistant) screens.
kiaOnlyKeymap = new Keymap(Keymap::kKeymapTypeGame, BladeRunnerEngine::kKiaKeymapId, gameDesc + Common::U32String(" - ") + _("KIA only shortcuts"));
Action *act;
// Look at backends\keymapper\hardware-input.cpp for the strings that can be used in InputMapping
// I18N: This keymap is the main way for the user interact with the game.
// It is used with the game's cursor to select, walk-to, run-to, look-at, talk-to, pick up, use, shoot (combat mode), open KIA (when clicking on McCoy).
act = new Action(kStandardActionLeftClick, _("Walk / Look / Talk / Select / Shoot"));
act->setLeftClickEvent();
act->addDefaultInputMapping("MOUSE_LEFT");
act->addDefaultInputMapping("JOY_A");
commonKeymap->addAction(act);
// I18N: This keymap toggles McCoy's status between combat mode (drawing his gun) and normal mode (holstering his gun)
// In Blade Runner's official localizations, there is a description of this keymap
// on the KIA Help Page, under Keyboard Shortcuts. In the English version it is
// TOGGLE MCCOY'S COMBAT MODE
act = new Action("COMBAT", _("Toggle Combat"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionToggleCombat);
act->addDefaultInputMapping("MOUSE_RIGHT");
act->addDefaultInputMapping("MOUSE_MIDDLE");
act->addDefaultInputMapping("JOY_B");
act->addDefaultInputMapping("SPACE");
gameplayKeymap->addAction(act);
// I18N: This keymap allows skipping video cutscenes
act = new Action("SKIPVIDEO", _("Skip cutscene"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionCutsceneSkip);
act->addDefaultInputMapping("ESCAPE");
act->addDefaultInputMapping("RETURN");
act->addDefaultInputMapping("KP_ENTER");
act->addDefaultInputMapping("SPACE");
act->addDefaultInputMapping("JOY_Y");
gameplayKeymap->addAction(act);
// I18N: This keymap allows skipping the current line of dialogue.
// In Blade Runner's official localizations, there is a description of this keymap
// on the KIA Help Page, under Keyboard Shortcuts. In the English version it is
// SKIP PAST CURRENT LINE OF DIALOGUE
act = new Action("SKIPDLG", _("Skip dialogue"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionDialogueSkip);
act->addDefaultInputMapping("RETURN");
act->addDefaultInputMapping("KP_ENTER");
act->addDefaultInputMapping("JOY_X");
gameplayKeymap->addAction(act);
// I18N: This keymap toggles between opening the KIA in the Game Options tab, and closing the KIA.
// In Blade Runner's official localizations, there is a description of this keymap
// on the KIA Help Page, under Keyboard Shortcuts. In the English version it is
// GAME OPTIONS
act = new Action("KIAOPTS", _("Game Options"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionToggleKiaOptions);
act->addDefaultInputMapping("ESCAPE");
act->addDefaultInputMapping("JOY_Y");
commonKeymap->addAction(act);
// I18N: This keymap opens the KIA database on one of the investigation tabs,
// CRIME SCENE DATABASE, SUSPECT DATABASE and CLUES DATABASE.
// In Blade Runner's official localizations, there is a description of this keymap
// on the KIA Help Page, under Keyboard Shortcuts. In the English version it is
// ACTIVATE KIA CLUE DATABASE SYSTEM
act = new Action("KIADB", _("Open KIA Database"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionOpenKiaDatabase);
act->addDefaultInputMapping("TAB");
act->addDefaultInputMapping("JOY_LEFT_SHOULDER");
gameplayKeymap->addAction(act);
// I18N: This keymap works within the KIA Save Game screen
// and allows confirming popup dialogue prompts (eg. for save game deletion or overwriting)
// and also submitting a new save game name, or choosing an existing save game for overwriting.
act = new Action("KIACONFIRMDLG", _("Confirm"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpConfirmDlg);
act->addDefaultInputMapping("RETURN");
act->addDefaultInputMapping("KP_ENTER");
act->addDefaultInputMapping("JOY_B");
kiaOnlyKeymap->addAction(act);
// I18N: This keymap works within the KIA Save Game screen
// and allows submitting a selected existing save game for deletion.
act = new Action("KIADELETESVDGAME", _("Delete Selected Saved Game"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpDeleteSelectedSvdGame);
act->addDefaultInputMapping("DELETE");
// TODO In the original KP_PERIOD with NUMLOCK on, would work as a normal '.' character.
// KP_PERIOD with NUMLOCK off, would work as a delete request for the selected saved game.
// However, NUMLOCK is currently not working as a modifier key for keymaps,
// so maybe we should implement this original behavior more accurately,
// when that is fixed in the keymapper or hardware-input code.
// For now, KP_PERIOD will work (by default) as a delete request.
act->addDefaultInputMapping("KP_PERIOD");
act->addDefaultInputMapping("JOY_X");
kiaOnlyKeymap->addAction(act);
// I18N: This keymap allows scrolling texts and lists upwards
act = new Action("KIASCROLLUP", _("Scroll Up"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionScrollUp);
act->addDefaultInputMapping("MOUSE_WHEEL_UP");
act->addDefaultInputMapping("JOY_UP");
kiaOnlyKeymap->addAction(act);
// I18N: This keymap allows scrolling texts and lists downwards
act = new Action("KIASCROLLDOWN", _("Scroll Down"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionScrollDown);
act->addDefaultInputMapping("MOUSE_WHEEL_DOWN");
act->addDefaultInputMapping("JOY_DOWN");
kiaOnlyKeymap->addAction(act);
// I18N: This keymap allows (in KIA only) for a clue to be set as private or public
// (only when the KIA is upgraded).
act = new Action("KIATOGGLECLUEPRIVACY", _("Toggle Clue Privacy"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionToggleCluePrivacy);
act->addDefaultInputMapping("MOUSE_RIGHT");
act->addDefaultInputMapping("JOY_RIGHT_SHOULDER");
kiaOnlyKeymap->addAction(act);
// I18N: This keymap opens KIA's HELP tab.
// In Blade Runner's official localizations, there is a description of this keymap
// on the KIA Help Page, under Keyboard Shortcuts. In the English version it is
// ONLINE HELP
act = new Action("KIAHLP", _("Help"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionOpenKIATabHelp);
act->addDefaultInputMapping("F1");
commonKeymap->addAction(act);
// I18N: This keymap opens KIA's SAVE GAME tab.
// In Blade Runner's official localizations, there is a description of this keymap
// on the KIA Help Page, under Keyboard Shortcuts. In the English version it is
// SAVE GAME
act = new Action("KIASAVE", _("Save Game"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionOpenKIATabSaveGame);
act->addDefaultInputMapping("F2");
commonKeymap->addAction(act);
// I18N: This keymap opens KIA's LOAD GAME tab.
// In Blade Runner's official localizations, there is a description of this keymap
// on the KIA Help Page, under Keyboard Shortcuts. In the English version it is
// LOAD GAME
act = new Action("KIALOAD", _("Load Game"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionOpenKIATabLoadGame);
act->addDefaultInputMapping("F3");
commonKeymap->addAction(act);
// I18N: This keymap opens KIA's CRIME SCENE DATABASE tab.
// In Blade Runner's official localizations, there is a description of this keymap
// on the KIA Help Page, under Keyboard Shortcuts. In the English version it is
// CRIME SCENE DATABASE
act = new Action("KIACRIMES", _("Crime Scene Database"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionOpenKIATabCrimeSceneDatabase);
act->addDefaultInputMapping("F4");
commonKeymap->addAction(act);
// I18N: This keymap opens KIA's SUSPECT DATABASE tab.
// In Blade Runner's official localizations, there is a description of this keymap
// on the KIA Help Page, under Keyboard Shortcuts. In the English version it is
// SUSPECT DATABASE
act = new Action("KIASUSPECTS", _("Suspect Database"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionOpenKIATabSuspectDatabase);
act->addDefaultInputMapping("F5");
commonKeymap->addAction(act);
// I18N: This keymap opens KIA's CLUE DATABASE tab.
// In Blade Runner's official localizations, there is a description of this keymap
// on the KIA Help Page, under Keyboard Shortcuts. In the English version it is
// CLUE DATABASE
act = new Action("KIACLUES", _("Clue Database"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionOpenKIATabClueDatabase);
act->addDefaultInputMapping("F6");
commonKeymap->addAction(act);
// I18N: This keymap opens KIA's QUIT GAME tab.
// In Blade Runner's official localizations, there is a description of this keymap
// on the KIA Help Page, under Keyboard Shortcuts. In the English version it is
// QUIT GAME
act = new Action("KIAQUIT", _("Quit Game"));
act->setCustomEngineActionEvent(BladeRunnerEngine::kMpActionOpenKIATabQuitGame);
act->addDefaultInputMapping("F10");
commonKeymap->addAction(act);
KeymapArray keymaps(3);
keymaps[0] = commonKeymap;
keymaps[1] = gameplayKeymap;
keymaps[2] = kiaOnlyKeymap;
return keymaps;
}
SaveStateList BladeRunnerMetaEngine::listSaves(const char *target) const {
return BladeRunner::SaveFileManager::list(this, target);
}
int BladeRunnerMetaEngine::getMaximumSaveSlot() const {
return 999;
}
bool BladeRunnerMetaEngine::removeSaveState(const char *target, int slot) const {
return BladeRunner::SaveFileManager::remove(target, slot);
}
SaveStateDescriptor BladeRunnerMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
return BladeRunner::SaveFileManager::queryMetaInfos(this, target, slot);
}
#if PLUGIN_ENABLED_DYNAMIC(BLADERUNNER)
REGISTER_PLUGIN_DYNAMIC(BLADERUNNER, PLUGIN_TYPE_ENGINE, BladeRunnerMetaEngine);
#else
REGISTER_PLUGIN_STATIC(BLADERUNNER, PLUGIN_TYPE_ENGINE, BladeRunnerMetaEngine);
#endif
|